From ecdd9b972d1528a49d93c44117d856cefb024cd7 Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Sat, 13 May 2017 15:44:23 -0700 Subject: [PATCH 01/13] First round of i18n in acs-engine based on gettext. Subsequent changes will replace and extract resource strings in acs-engine and make acsengine/api package's i18n used by other go program. --- Dockerfile | 6 +- Makefile | 2 + cmd/generate.go | 32 ++++-- pkg/acsengine/engine.go | 4 +- pkg/acsengine/engine_test.go | 12 +- pkg/acsengine/types.go | 6 + pkg/i18n/i18n.go | 107 ++++++++++++++++++ pkg/i18n/i18n_test.go | 81 +++++++++++++ test/i18n/i18ntestinput.go | 35 ++++++ .../test/default/LC_MESSAGES/acsengine.mo | Bin 0 -> 684 bytes .../test/default/LC_MESSAGES/acsengine.po | 34 ++++++ .../test/en_US/LC_MESSAGES/acsengine.mo | Bin 0 -> 684 bytes .../test/en_US/LC_MESSAGES/acsengine.po | 34 ++++++ 13 files changed, 342 insertions(+), 11 deletions(-) create mode 100644 pkg/i18n/i18n.go create mode 100644 pkg/i18n/i18n_test.go create mode 100644 test/i18n/i18ntestinput.go create mode 100644 translations/test/default/LC_MESSAGES/acsengine.mo create mode 100644 translations/test/default/LC_MESSAGES/acsengine.po create mode 100644 translations/test/en_US/LC_MESSAGES/acsengine.mo create mode 100644 translations/test/en_US/LC_MESSAGES/acsengine.po diff --git a/Dockerfile b/Dockerfile index c409027af6..1ec7d8e528 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ENV AZURE_CLI_VERSION 2.0.3 RUN apt-get update \ && apt-get -y upgrade \ - && apt-get -y install python-pip make build-essential curl openssl vim jq \ + && apt-get -y install python-pip make build-essential curl openssl vim jq gettext \ && rm -rf /var/lib/apt/lists/* RUN mkdir /tmp/godeb \ @@ -29,6 +29,10 @@ RUN git clone https://github.com/akesterson/cmdarg.git /tmp/cmdarg \ RUN git clone https://github.com/akesterson/shunit.git /tmp/shunit \ && cd /tmp/shunit && make install && rm -rf /tmp/shunit +# Go tool for internationalization and localization +RUN go get github.com/gosexy/gettext/... \ + && go install github.com/gosexy/gettext/... + # Used by some CI jobs ADD ./test/bootstrap/checkout-pr.sh /tmp/checkout-pr.sh diff --git a/Makefile b/Makefile index 4ddab61b89..ae7d786a30 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ prereqs: go get github.com/jteeuwen/go-bindata/... go get github.com/Sirupsen/logrus go get github.com/spf13/cobra + go get github.com/onsi/gomega + go get github.com/leonelquinteros/gotext build: prereqs go generate -v ./... diff --git a/cmd/generate.go b/cmd/generate.go index d2d9eb8565..03086c9a63 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -9,6 +9,8 @@ import ( "github.com/Azure/acs-engine/pkg/acsengine" "github.com/Azure/acs-engine/pkg/api" + "github.com/Azure/acs-engine/pkg/i18n" + "github.com/leonelquinteros/gotext" ) const ( @@ -18,17 +20,19 @@ const ( ) type generateCmd struct { - apimodelPath string - outputDirectory string // can be auto-determined from clusterDefinition - caCertificatePath string - caPrivateKeyPath string - classicMode bool - noPrettyPrint bool - parametersOnly bool + translationsDirectory string + apimodelPath string + outputDirectory string // can be auto-determined from clusterDefinition + caCertificatePath string + caPrivateKeyPath string + classicMode bool + noPrettyPrint bool + parametersOnly bool // Parsed from inputs containerService *api.ContainerService apiVersion string + locale *gotext.Locale } func NewGenerateCmd() *cobra.Command { @@ -44,6 +48,7 @@ func NewGenerateCmd() *cobra.Command { } f := generateCmd.Flags() + f.StringVar(&gc.translationsDirectory, "translations-directory", "", "translations directory (translations in the current directory if absent)") f.StringVar(&gc.apimodelPath, "api-model", "", "") f.StringVar(&gc.outputDirectory, "output-directory", "", "output directory (derived from FQDN if absent)") f.StringVar(&gc.caCertificatePath, "ca-certificate-path", "", "path to the CA certificate to use for Kubernetes PKI assets") @@ -59,6 +64,13 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) { var caCertificateBytes []byte var caKeyBytes []byte + locale, err := i18n.LoadTranslations(gc.translationsDirectory) + if err != nil { + log.Fatalf("error loading translation files: %s", err.Error()) + } + + i18n.Initialize(locale) + if gc.apimodelPath == "" { if len(args) > 0 { gc.apimodelPath = args[0] @@ -93,13 +105,17 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) { gc.containerService = containerService gc.apiVersion = apiVersion + gc.locale = locale } func (gc *generateCmd) run(cmd *cobra.Command, args []string) error { gc.validate(cmd, args) log.Infoln("Generating...") - templateGenerator, err := acsengine.InitializeTemplateGenerator(gc.classicMode) + ctx := acsengine.Context{ + Locale: gc.locale, + } + templateGenerator, err := acsengine.InitializeTemplateGenerator(ctx, gc.classicMode) if err != nil { log.Fatalln("failed to initialize template generator: %s", err.Error()) } diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index 93489bc956..eecdcc1a6e 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -174,12 +174,14 @@ func (t *TemplateGenerator) verifyFiles() error { // TemplateGenerator represents the object that performs the template generation. type TemplateGenerator struct { ClassicMode bool + Context Context } // InitializeTemplateGenerator creates a new template generator object -func InitializeTemplateGenerator(classicMode bool) (*TemplateGenerator, error) { +func InitializeTemplateGenerator(ctx Context, classicMode bool) (*TemplateGenerator, error) { t := &TemplateGenerator{ ClassicMode: classicMode, + Context: ctx, } if err := t.verifyFiles(); err != nil { diff --git a/pkg/acsengine/engine_test.go b/pkg/acsengine/engine_test.go index 8979e3866b..41e8be4f24 100644 --- a/pkg/acsengine/engine_test.go +++ b/pkg/acsengine/engine_test.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "io/ioutil" + "path" "path/filepath" "strings" "testing" @@ -11,6 +12,8 @@ import ( "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/api/v20160330" "github.com/Azure/acs-engine/pkg/api/vlabs" + "github.com/Azure/acs-engine/pkg/i18n" + "github.com/leonelquinteros/gotext" ) const ( @@ -18,6 +21,10 @@ const ( ) func TestExpected(t *testing.T) { + // Initialize locale for translation + locale := gotext.NewLocale(path.Join("..", "..", "translations"), "en_US") + i18n.Initialize(locale) + // iterate the test data directory apiModelTestFiles := &[]APIModelTestFile{} if e := IterateTestFilesDirectory(TestDataDir, apiModelTestFiles); e != nil { @@ -50,7 +57,10 @@ func TestExpected(t *testing.T) { // 1. first time tests loaded containerService // 2. second time tests generated containerService // 3. third time tests the generated containerService from the generated containerService - templateGenerator, e3 := InitializeTemplateGenerator(isClassicMode) + ctx := Context{ + Locale: locale, + } + templateGenerator, e3 := InitializeTemplateGenerator(ctx, isClassicMode) if e3 != nil { t.Error(e3.Error()) continue diff --git a/pkg/acsengine/types.go b/pkg/acsengine/types.go index 2b781c14b3..bb2c02e3bc 100644 --- a/pkg/acsengine/types.go +++ b/pkg/acsengine/types.go @@ -4,6 +4,7 @@ import ( "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/api/v20160330" "github.com/Azure/acs-engine/pkg/api/vlabs" + "github.com/leonelquinteros/gotext" ) // DCOSNodeType represents the type of DCOS Node @@ -51,3 +52,8 @@ type AzureEnvironmentSpecConfig struct { KubernetesSpecConfig KubernetesSpecConfig DCOSSpecConfig DCOSSpecConfig } + +// Context represents the object that is passed to the package +type Context struct { + Locale *gotext.Locale +} diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go new file mode 100644 index 0000000000..c74a507e5e --- /dev/null +++ b/pkg/i18n/i18n.go @@ -0,0 +1,107 @@ +package i18n + +import ( + "errors" + "fmt" + "os" + "strings" + + "github.com/leonelquinteros/gotext" +) + +const ( + defaultLanguage = "default" + defaultDomain = "acsengine" + defaultLocalDir = "translations" +) + +var supportedTranslations = map[string]bool{ + defaultLanguage: true, + "en_US": true, + "zh_CN": true, +} + +func loadSystemLanguage() string { + language := os.Getenv("LANG") + if language == "" { + return defaultLanguage + } + + // Posix locale name usually has the ll_CC.encoding syntax. + parts := strings.Split(language, ".") + if len(parts) == 0 { + return defaultLanguage + } + return parts[0] +} + +// LoadTranslations loads translation files and sets the locale to +// the system locale. It should be called by the main program. +func LoadTranslations(translationsDir string) (*gotext.Locale, error) { + dir := defaultLocalDir + if translationsDir != "" { + dir = translationsDir + } + + if stat, err := os.Stat(dir); os.IsNotExist(err) || !stat.IsDir() { + return nil, fmt.Errorf("Translations directory %s does not exist: %v", dir, err) + } + + lang := loadSystemLanguage() + SetLanguage(lang) + + locale := gotext.NewLocale(dir, lang) + Initialize(locale) + + return locale, nil +} + +// Initialize is the translation initialization function shared by the main program and package. +func Initialize(locale *gotext.Locale) error { + if locale == nil { + return fmt.Errorf("Initialize expected locale but got nil") + } + locale.AddDomain(defaultDomain) + return nil +} + +// SetLanguage sets the program's current locale. If the language is not +// supported, then the default locale is used. +func SetLanguage(language string) { + if _, ok := supportedTranslations[language]; ok { + gotext.SetLanguage(language) + return + } + gotext.SetLanguage(defaultLanguage) +} + +// GetLanguage queries the program's current locale. +func GetLanguage() string { + return gotext.GetLanguage() +} + +// Translator is a wrapper over gotext's Locale and provides interface to +// translate text string and produce translated error +type Translator struct { + Locale *gotext.Locale +} + +// T translates a text string, based on GNU's gettext library. +func (t *Translator) T(msgid string, vars ...interface{}) string { + return t.Locale.GetD(defaultDomain, msgid, vars...) +} + +// NT translates a text string into the appropriate plural form, based on GNU's gettext library. +func (t *Translator) NT(msgid, msgidPlural string, n int, vars ...interface{}) string { + return t.Locale.GetND(defaultDomain, msgid, msgidPlural, n, vars...) +} + +// Errorf produces an error with a translated error string. +func (t *Translator) Errorf(msgid string, vars ...interface{}) error { + return errors.New(t.T(msgid, vars...)) +} + +// NErrorf produces an error with a translated error string in the appropriate plural form. +func (t *Translator) NErrorf(msgid, msgidPlural string, n int, vars ...interface{}) error { + return errors.New(t.NT(msgid, msgidPlural, n, vars...)) +} diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go new file mode 100644 index 0000000000..74c57f96ca --- /dev/null +++ b/pkg/i18n/i18n_test.go @@ -0,0 +1,81 @@ +package i18n + +import ( + "os" + "path" + "testing" + + . "github.com/onsi/gomega" +) + +func TestLoadTranslations(t *testing.T) { + RegisterTestingT(t) + + _, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + Expect(err).Should(BeNil()) + + _, err = LoadTranslations("non_existing_directory") + Expect(err).ShouldNot(BeNil()) +} + +func TestTranslationLanguage(t *testing.T) { + RegisterTestingT(t) + + origLang := os.Getenv("LANG") + os.Setenv("LANG", "en_US.UTF-8") + _, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + Expect(err).Should(BeNil()) + + lang := GetLanguage() + Expect(lang).Should(Equal("en_US")) + + os.Setenv("LANG", origLang) +} + +func TestTranslationLanguageDefault(t *testing.T) { + RegisterTestingT(t) + + origLang := os.Getenv("LANG") + os.Setenv("LANG", "ll_CC.UTF-8") + _, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + Expect(err).Should(BeNil()) + + lang := GetLanguage() + Expect(lang).Should(Equal("default")) + + os.Setenv("LANG", origLang) +} + +func TestTranslations(t *testing.T) { + RegisterTestingT(t) + + l, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + Expect(err).Should(BeNil()) + + translator := &Translator{ + Locale: l, + } + + msg := translator.T("Aloha") + Expect(msg).Should(Equal("Aloha")) + + msg = translator.T("Hello %s", "World") + Expect(msg).Should(Equal("Hello World")) +} + +func TestTranslationsPlural(t *testing.T) { + RegisterTestingT(t) + + l, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + Expect(err).Should(BeNil()) + + translator := &Translator{ + Locale: l, + } + + msg := translator.NT("There is %d parameter in resource %s", "There are %d parameters in resource %s", 1, 1, "Foo") + Expect(msg).Should(Equal("There is 1 parameter in resource Foo")) + + msg = translator.NT("There is %d parameter in resource %s", "There are %d parameters in resource %s", 9, 9, "Foo") + Expect(msg).Should(Equal("There are 9 parameters in resource Foo")) +} diff --git a/test/i18n/i18ntestinput.go b/test/i18n/i18ntestinput.go new file mode 100644 index 0000000000..147976a13b --- /dev/null +++ b/test/i18n/i18ntestinput.go @@ -0,0 +1,35 @@ +package fake + +import ( + "github.com/Azure/acs-engine/pkg/i18n" + "github.com/leonelquinteros/gotext" +) + +// This file is used to generate the test translation file +// 1. go-xgettext -o i18ntestinput.pot --keyword=translator.T --keyword-plural=translator.NT --msgid-bugs-address="" --sort-output test/i18n/i18ntestinput.go +// 2. msginit -l en_US -o i18ntestinput.po -i i18ntestinput.pot +// 3. Modify i18ntestinput.po using poedit as necessary +// Or msgfmt -c -v -o i18ntestinput.mo i18ntestinput.po +// 4. for d in "default" "en_US"; do cp i18ntestinput.mo translations/test/$d/LC_MESSAGES/acsengine.mo; cp i18ntestinput.po translations/test/$d/LC_MESSAGES/acsengine.po; done +// 5. rm i18ntestinput.* + +var ( + locale = gotext.NewLocale("d", "l") + translator = &i18n.Translator{ + Locale: locale, + } + world = "World" + resource = "Foo" +) + +func aloha() { + translator.T("Aloha") +} + +func foo() { + translator.T("Hello %s", world) +} + +func bar() { + translator.NT("There is %d parameter in resource %s", "There are %d parameters in resource %s", 9, 9, resource) +} diff --git a/translations/test/default/LC_MESSAGES/acsengine.mo b/translations/test/default/LC_MESSAGES/acsengine.mo new file mode 100644 index 0000000000000000000000000000000000000000..89cd0ec5cc78dd67a901086a70f7ac57b8ad4fec GIT binary patch literal 684 zcmcJM&2H2%5P$;|3FXL{!*HksLbD_hON+OQpk)h%u2@P69FV{y)5MiCPHitgHx9f4 zZ^bk4EKFFzA~-YB=gD}!_(%SJdE;v$u_0U$c7%(UcCctJ5z4p4JNFEG>r{I>p zqP3(&{L>15YYXpAsfu_|;|ub^I98ymK-?In^oV-rBhEu(YTR8m0ZXSKT|6yu&y$X# z;{zQ@L6PNKn2j;N4MncT;~SZTh*=k!-)&AryeP8&O_Tz6Og<7TNF!jg2SV8)F#q5VCrfcVYv^K^bNpRKQ#kFs>n zaU_;KKlO6>NFU?P-fF`Ws9Nm<#p!XmkK1c+INJ$%oN?u9!;OONcP6F_yY$-PzVlsB r!2QoMOp6JuKBw0hu1+DpK1pBULt^r)`z;*RCPFdFMn#(Z$M^jKiYCHE literal 0 HcmV?d00001 diff --git a/translations/test/default/LC_MESSAGES/acsengine.po b/translations/test/default/LC_MESSAGES/acsengine.po new file mode 100644 index 0000000000..b058ea8c36 --- /dev/null +++ b/translations/test/default/LC_MESSAGES/acsengine.po @@ -0,0 +1,34 @@ +# Test translations for acsengine package. +# Copyright (C) 2017 +# Jiangtian Li , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: acsengine\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-16 21:55+0000\n" +"PO-Revision-Date: 2017-05-16 14:59-0700\n" +"Last-Translator: Jiangtian Li \n" +"Language-Team: English\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.0.2\n" + +#: test/i18n/i18ntestinput.go:26 +msgid "Aloha" +msgstr "Aloha" + +#: test/i18n/i18ntestinput.go:30 +#, c-format +msgid "Hello %s" +msgstr "Hello %s" + +#: test/i18n/i18ntestinput.go:34 +#, c-format +msgid "There is %d parameter in resource %s" +msgid_plural "There are %d parameters in resource %s" +msgstr[0] "There is %d parameter in resource %s" +msgstr[1] "There are %d parameters in resource %s" diff --git a/translations/test/en_US/LC_MESSAGES/acsengine.mo b/translations/test/en_US/LC_MESSAGES/acsengine.mo new file mode 100644 index 0000000000000000000000000000000000000000..89cd0ec5cc78dd67a901086a70f7ac57b8ad4fec GIT binary patch literal 684 zcmcJM&2H2%5P$;|3FXL{!*HksLbD_hON+OQpk)h%u2@P69FV{y)5MiCPHitgHx9f4 zZ^bk4EKFFzA~-YB=gD}!_(%SJdE;v$u_0U$c7%(UcCctJ5z4p4JNFEG>r{I>p zqP3(&{L>15YYXpAsfu_|;|ub^I98ymK-?In^oV-rBhEu(YTR8m0ZXSKT|6yu&y$X# z;{zQ@L6PNKn2j;N4MncT;~SZTh*=k!-)&AryeP8&O_Tz6Og<7TNF!jg2SV8)F#q5VCrfcVYv^K^bNpRKQ#kFs>n zaU_;KKlO6>NFU?P-fF`Ws9Nm<#p!XmkK1c+INJ$%oN?u9!;OONcP6F_yY$-PzVlsB r!2QoMOp6JuKBw0hu1+DpK1pBULt^r)`z;*RCPFdFMn#(Z$M^jKiYCHE literal 0 HcmV?d00001 diff --git a/translations/test/en_US/LC_MESSAGES/acsengine.po b/translations/test/en_US/LC_MESSAGES/acsengine.po new file mode 100644 index 0000000000..b058ea8c36 --- /dev/null +++ b/translations/test/en_US/LC_MESSAGES/acsengine.po @@ -0,0 +1,34 @@ +# Test translations for acsengine package. +# Copyright (C) 2017 +# Jiangtian Li , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: acsengine\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-16 21:55+0000\n" +"PO-Revision-Date: 2017-05-16 14:59-0700\n" +"Last-Translator: Jiangtian Li \n" +"Language-Team: English\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.0.2\n" + +#: test/i18n/i18ntestinput.go:26 +msgid "Aloha" +msgstr "Aloha" + +#: test/i18n/i18ntestinput.go:30 +#, c-format +msgid "Hello %s" +msgstr "Hello %s" + +#: test/i18n/i18ntestinput.go:34 +#, c-format +msgid "There is %d parameter in resource %s" +msgid_plural "There are %d parameters in resource %s" +msgstr[0] "There is %d parameter in resource %s" +msgstr[1] "There are %d parameters in resource %s" From 78be458bee62e08ec58a0415af79afb6ec1bfc9c Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Wed, 17 May 2017 23:51:03 -0700 Subject: [PATCH 02/13] Update acs-engine go source to use translation functions. Generate translation resource files. --- Dockerfile | 4 +- cmd/generate.go | 18 ++++- pkg/acsengine/engine.go | 21 +++--- pkg/acsengine/engine_test.go | 15 +++- pkg/acsengine/output.go | 45 +++++++----- pkg/acsengine/types.go | 4 +- pkg/api/apiloader.go | 25 ++++--- pkg/i18n/i18n_test.go | 17 +++++ scripts/update-translation.sh | 59 +++++++++++++++ test/i18n/i18ntestinput.go | 18 ++++- translations/default/LC_MESSAGES/acsengine.mo | Bin 0 -> 1352 bytes translations/default/LC_MESSAGES/acsengine.po | 69 ++++++++++++++++++ translations/en_US/LC_MESSAGES/acsengine.mo | Bin 0 -> 1352 bytes translations/en_US/LC_MESSAGES/acsengine.po | 69 ++++++++++++++++++ .../test/default/LC_MESSAGES/acsengine.mo | Bin 684 -> 916 bytes .../test/default/LC_MESSAGES/acsengine.po | 21 ++++-- .../test/en_US/LC_MESSAGES/acsengine.mo | Bin 684 -> 916 bytes .../test/en_US/LC_MESSAGES/acsengine.po | 21 ++++-- translations/zh_CN/LC_MESSAGES/acsengine.mo | Bin 0 -> 1297 bytes translations/zh_CN/LC_MESSAGES/acsengine.po | 68 +++++++++++++++++ 20 files changed, 411 insertions(+), 63 deletions(-) create mode 100644 scripts/update-translation.sh create mode 100644 translations/default/LC_MESSAGES/acsengine.mo create mode 100644 translations/default/LC_MESSAGES/acsengine.po create mode 100644 translations/en_US/LC_MESSAGES/acsengine.mo create mode 100644 translations/en_US/LC_MESSAGES/acsengine.po create mode 100644 translations/zh_CN/LC_MESSAGES/acsengine.mo create mode 100644 translations/zh_CN/LC_MESSAGES/acsengine.po diff --git a/Dockerfile b/Dockerfile index 1ec7d8e528..071aebca80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,8 +30,8 @@ RUN git clone https://github.com/akesterson/shunit.git /tmp/shunit \ && cd /tmp/shunit && make install && rm -rf /tmp/shunit # Go tool for internationalization and localization -RUN go get github.com/gosexy/gettext/... \ - && go install github.com/gosexy/gettext/... +RUN go get github.com/JiangtianLi/gettext/... \ + && go install github.com/JiangtianLi/gettext/... # Used by some CI jobs ADD ./test/bootstrap/checkout-pr.sh /tmp/checkout-pr.sh diff --git a/cmd/generate.go b/cmd/generate.go index 03086c9a63..fac696ab4a 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -87,7 +87,12 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) { log.Fatalf("specified api model does not exist (%s)", gc.apimodelPath) } - containerService, apiVersion, err := api.LoadContainerServiceFromFile(gc.apimodelPath) + apiloader := &api.Apiloader{ + Translator: &i18n.Translator{ + Locale: locale, + }, + } + containerService, apiVersion, err := apiloader.LoadContainerServiceFromFile(gc.apimodelPath) if err != nil { log.Fatalf("error parsing the api model: %s", err.Error()) } @@ -113,7 +118,9 @@ func (gc *generateCmd) run(cmd *cobra.Command, args []string) error { log.Infoln("Generating...") ctx := acsengine.Context{ - Locale: gc.locale, + Translator: &i18n.Translator{ + Locale: gc.locale, + }, } templateGenerator, err := acsengine.InitializeTemplateGenerator(ctx, gc.classicMode) if err != nil { @@ -136,7 +143,12 @@ func (gc *generateCmd) run(cmd *cobra.Command, args []string) error { } } - if err = acsengine.WriteArtifacts(gc.containerService, gc.apiVersion, template, parameters, gc.outputDirectory, certsGenerated, gc.parametersOnly); err != nil { + writer := &acsengine.ArtifactWriter{ + Translator: &i18n.Translator{ + Locale: gc.locale, + }, + } + if err = writer.WriteArtifacts(gc.containerService, gc.apiVersion, template, parameters, gc.outputDirectory, certsGenerated, gc.parametersOnly); err != nil { log.Fatalf("error writing artifacts: %s \n", err.Error()) } diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index eecdcc1a6e..ee3d1ceb52 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -14,6 +14,7 @@ import ( "text/template" "github.com/Azure/acs-engine/pkg/api" + "github.com/Azure/acs-engine/pkg/i18n" "github.com/ghodss/yaml" ) @@ -165,7 +166,7 @@ func (t *TemplateGenerator) verifyFiles() error { allFiles = append(allFiles, swarmTemplateFiles...) for _, file := range allFiles { if _, err := Asset(file); err != nil { - return fmt.Errorf("template file %s does not exist", file) + return t.Translator.Errorf("template file %s does not exist", file) } } return nil @@ -174,14 +175,14 @@ func (t *TemplateGenerator) verifyFiles() error { // TemplateGenerator represents the object that performs the template generation. type TemplateGenerator struct { ClassicMode bool - Context Context + Translator *i18n.Translator } // InitializeTemplateGenerator creates a new template generator object func InitializeTemplateGenerator(ctx Context, classicMode bool) (*TemplateGenerator, error) { t := &TemplateGenerator{ ClassicMode: classicMode, - Context: ctx, + Translator: ctx.Translator, } if err := t.verifyFiles(); err != nil { @@ -209,7 +210,7 @@ func (t *TemplateGenerator) GenerateTemplate(containerService *api.ContainerServ templ = template.New("acs template").Funcs(t.getTemplateFuncMap(containerService)) - files, baseFile, e := prepareTemplateFiles(properties) + files, baseFile, e := t.prepareTemplateFiles(properties) if e != nil { return "", "", false, e } @@ -217,7 +218,7 @@ func (t *TemplateGenerator) GenerateTemplate(containerService *api.ContainerServ for _, file := range files { bytes, e := Asset(file) if e != nil { - err = fmt.Errorf("Error reading file %s, Error: %s", file, e.Error()) + err = t.Translator.Errorf("Error reading file %s, Error: %s", file, e.Error()) return templateRaw, parametersRaw, certsGenerated, err } if _, err = templ.New(file).Parse(string(bytes)); err != nil { @@ -282,7 +283,7 @@ func GenerateKubeConfig(properties *api.Properties, location string) (string, er return kubeconfig, nil } -func prepareTemplateFiles(properties *api.Properties) ([]string, string, error) { +func (t *TemplateGenerator) prepareTemplateFiles(properties *api.Properties) ([]string, string, error) { var files []string var baseFile string if properties.OrchestratorProfile.OrchestratorType == api.DCOS { @@ -298,7 +299,7 @@ func prepareTemplateFiles(properties *api.Properties) ([]string, string, error) files = append(commonTemplateFiles, swarmModeTemplateFiles...) baseFile = swarmBaseFile } else { - return nil, "", fmt.Errorf("orchestrator '%s' is unsupported", properties.OrchestratorProfile.OrchestratorType) + return nil, "", t.Translator.Errorf("orchestrator '%s' is unsupported", properties.OrchestratorProfile.OrchestratorType) } return files, baseFile, nil @@ -1001,18 +1002,18 @@ func getSecurityRules(ports []int) string { func (t *TemplateGenerator) getSingleLineForTemplate(textFilename string, cs *api.ContainerService, profile interface{}) (string, error) { b, err := Asset(textFilename) if err != nil { - return "", fmt.Errorf("yaml file %s does not exist", textFilename) + return "", t.Translator.Errorf("yaml file %s does not exist", textFilename) } // use go templates to process the text filename templ := template.New("customdata template").Funcs(t.getTemplateFuncMap(cs)) if _, err = templ.New(textFilename).Parse(string(b)); err != nil { - return "", fmt.Errorf("error parsing file %s: %v", textFilename, err) + return "", t.Translator.Errorf("error parsing file %s: %v", textFilename, err) } var buffer bytes.Buffer if err = templ.ExecuteTemplate(&buffer, textFilename, profile); err != nil { - return "", fmt.Errorf("error executing template for file %s: %v", textFilename, err) + return "", t.Translator.Errorf("error executing template for file %s: %v", textFilename, err) } expandedTemplate := buffer.String() diff --git a/pkg/acsengine/engine_test.go b/pkg/acsengine/engine_test.go index 41e8be4f24..48969ddd84 100644 --- a/pkg/acsengine/engine_test.go +++ b/pkg/acsengine/engine_test.go @@ -25,6 +25,11 @@ func TestExpected(t *testing.T) { locale := gotext.NewLocale(path.Join("..", "..", "translations"), "en_US") i18n.Initialize(locale) + apiloader := &api.Apiloader{ + Translator: &i18n.Translator{ + Locale: locale, + }, + } // iterate the test data directory apiModelTestFiles := &[]APIModelTestFile{} if e := IterateTestFilesDirectory(TestDataDir, apiModelTestFiles); e != nil { @@ -33,7 +38,7 @@ func TestExpected(t *testing.T) { } for _, tuple := range *apiModelTestFiles { - containerService, version, err := api.LoadContainerServiceFromFile(tuple.APIModelFilename) + containerService, version, err := apiloader.LoadContainerServiceFromFile(tuple.APIModelFilename) if err != nil { t.Errorf("Loading file %s got error: %s", tuple.APIModelFilename, err.Error()) continue @@ -58,7 +63,9 @@ func TestExpected(t *testing.T) { // 2. second time tests generated containerService // 3. third time tests the generated containerService from the generated containerService ctx := Context{ - Locale: locale, + Translator: &i18n.Translator{ + Locale: locale, + }, } templateGenerator, e3 := InitializeTemplateGenerator(ctx, isClassicMode) if e3 != nil { @@ -128,11 +135,11 @@ func TestExpected(t *testing.T) { t.Errorf("generated parameters different from expected for model %s: '%s'", tuple.APIModelFilename, diffstr) } - b, err := api.SerializeContainerService(containerService, version) + b, err := apiloader.SerializeContainerService(containerService, version) if err != nil { t.Error(err) } - containerService, version, err = api.DeserializeContainerService(b) + containerService, version, err = apiloader.DeserializeContainerService(b) if err != nil { t.Error(err) } diff --git a/pkg/acsengine/output.go b/pkg/acsengine/output.go index ea2d48c6c5..bb83ee6984 100644 --- a/pkg/acsengine/output.go +++ b/pkg/acsengine/output.go @@ -7,9 +7,15 @@ import ( "path" "github.com/Azure/acs-engine/pkg/api" + "github.com/Azure/acs-engine/pkg/i18n" ) -func WriteArtifacts(containerService *api.ContainerService, apiVersion, template, parameters, artifactsDir string, certsGenerated bool, parametersOnly bool) error { +// ArtifactWriter represents the object that writes artifacts +type ArtifactWriter struct { + Translator *i18n.Translator +} + +func (w *ArtifactWriter) WriteArtifacts(containerService *api.ContainerService, apiVersion, template, parameters, artifactsDir string, certsGenerated bool, parametersOnly bool) error { if len(artifactsDir) == 0 { artifactsDir = fmt.Sprintf("%s-%s", containerService.Properties.OrchestratorProfile.OrchestratorType, GenerateClusterID(containerService.Properties)) artifactsDir = path.Join("_output", artifactsDir) @@ -19,22 +25,25 @@ func WriteArtifacts(containerService *api.ContainerService, apiVersion, template var b []byte var err error if !parametersOnly { - b, err = api.SerializeContainerService(containerService, apiVersion) + apiloader := &api.Apiloader{ + Translator: w.Translator, + } + b, err = apiloader.SerializeContainerService(containerService, apiVersion) if err != nil { return err } - if e := saveFile(artifactsDir, "apimodel.json", b); e != nil { + if e := w.saveFile(artifactsDir, "apimodel.json", b); e != nil { return e } - if e := saveFileString(artifactsDir, "azuredeploy.json", template); e != nil { + if e := w.saveFileString(artifactsDir, "azuredeploy.json", template); e != nil { return e } } - if e := saveFileString(artifactsDir, "azuredeploy.parameters.json", parameters); e != nil { + if e := w.saveFileString(artifactsDir, "azuredeploy.parameters.json", parameters); e != nil { return e } @@ -54,35 +63,35 @@ func WriteArtifacts(containerService *api.ContainerService, apiVersion, template if gkcerr != nil { return gkcerr } - if e := saveFileString(directory, fmt.Sprintf("kubeconfig.%s.json", location), b); e != nil { + if e := w.saveFileString(directory, fmt.Sprintf("kubeconfig.%s.json", location), b); e != nil { return e } } } - if e := saveFileString(artifactsDir, "ca.key", properties.CertificateProfile.GetCAPrivateKey()); e != nil { + if e := w.saveFileString(artifactsDir, "ca.key", properties.CertificateProfile.GetCAPrivateKey()); e != nil { return e } - if e := saveFileString(artifactsDir, "ca.crt", properties.CertificateProfile.CaCertificate); e != nil { + if e := w.saveFileString(artifactsDir, "ca.crt", properties.CertificateProfile.CaCertificate); e != nil { return e } - if e := saveFileString(artifactsDir, "apiserver.key", properties.CertificateProfile.APIServerPrivateKey); e != nil { + if e := w.saveFileString(artifactsDir, "apiserver.key", properties.CertificateProfile.APIServerPrivateKey); e != nil { return e } - if e := saveFileString(artifactsDir, "apiserver.crt", properties.CertificateProfile.APIServerCertificate); e != nil { + if e := w.saveFileString(artifactsDir, "apiserver.crt", properties.CertificateProfile.APIServerCertificate); e != nil { return e } - if e := saveFileString(artifactsDir, "client.key", properties.CertificateProfile.ClientPrivateKey); e != nil { + if e := w.saveFileString(artifactsDir, "client.key", properties.CertificateProfile.ClientPrivateKey); e != nil { return e } - if e := saveFileString(artifactsDir, "client.crt", properties.CertificateProfile.ClientCertificate); e != nil { + if e := w.saveFileString(artifactsDir, "client.crt", properties.CertificateProfile.ClientCertificate); e != nil { return e } - if e := saveFileString(artifactsDir, "kubectlClient.key", properties.CertificateProfile.KubeConfigPrivateKey); e != nil { + if e := w.saveFileString(artifactsDir, "kubectlClient.key", properties.CertificateProfile.KubeConfigPrivateKey); e != nil { return e } - if e := saveFileString(artifactsDir, "kubectlClient.crt", properties.CertificateProfile.KubeConfigCertificate); e != nil { + if e := w.saveFileString(artifactsDir, "kubectlClient.crt", properties.CertificateProfile.KubeConfigCertificate); e != nil { return e } } @@ -90,14 +99,14 @@ func WriteArtifacts(containerService *api.ContainerService, apiVersion, template return nil } -func saveFileString(dir string, file string, data string) error { - return saveFile(dir, file, []byte(data)) +func (w *ArtifactWriter) saveFileString(dir string, file string, data string) error { + return w.saveFile(dir, file, []byte(data)) } -func saveFile(dir string, file string, data []byte) error { +func (w *ArtifactWriter) saveFile(dir string, file string, data []byte) error { if _, err := os.Stat(dir); os.IsNotExist(err) { if e := os.MkdirAll(dir, 0700); e != nil { - return fmt.Errorf("error creating directory '%s': %s", dir, e.Error()) + return w.Translator.Errorf("error creating directory '%s': %s", dir, e.Error()) } } diff --git a/pkg/acsengine/types.go b/pkg/acsengine/types.go index bb2c02e3bc..8882db0465 100644 --- a/pkg/acsengine/types.go +++ b/pkg/acsengine/types.go @@ -4,7 +4,7 @@ import ( "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/api/v20160330" "github.com/Azure/acs-engine/pkg/api/vlabs" - "github.com/leonelquinteros/gotext" + "github.com/Azure/acs-engine/pkg/i18n" ) // DCOSNodeType represents the type of DCOS Node @@ -55,5 +55,5 @@ type AzureEnvironmentSpecConfig struct { // Context represents the object that is passed to the package type Context struct { - Locale *gotext.Locale + Translator *i18n.Translator } diff --git a/pkg/api/apiloader.go b/pkg/api/apiloader.go index c61a621599..95f9bcdf9b 100644 --- a/pkg/api/apiloader.go +++ b/pkg/api/apiloader.go @@ -2,38 +2,43 @@ package api import ( "encoding/json" - "fmt" "io/ioutil" "github.com/Azure/acs-engine/pkg/api/v20160330" "github.com/Azure/acs-engine/pkg/api/v20160930" "github.com/Azure/acs-engine/pkg/api/v20170131" "github.com/Azure/acs-engine/pkg/api/vlabs" + "github.com/Azure/acs-engine/pkg/i18n" ) +// Apiloader represents the object that loads api model +type Apiloader struct { + Translator *i18n.Translator +} + // LoadContainerServiceFromFile loads an ACS Cluster API Model from a JSON file -func LoadContainerServiceFromFile(jsonFile string) (*ContainerService, string, error) { +func (a *Apiloader) LoadContainerServiceFromFile(jsonFile string) (*ContainerService, string, error) { contents, e := ioutil.ReadFile(jsonFile) if e != nil { - return nil, "", fmt.Errorf("error reading file %s: %s", jsonFile, e.Error()) + return nil, "", a.Translator.Errorf("error reading file %s: %s", jsonFile, e.Error()) } - return DeserializeContainerService(contents) + return a.DeserializeContainerService(contents) } // DeserializeContainerService loads an ACS Cluster API Model, validates it, and returns the unversioned representation -func DeserializeContainerService(contents []byte) (*ContainerService, string, error) { +func (a *Apiloader) DeserializeContainerService(contents []byte) (*ContainerService, string, error) { m := &TypeMeta{} if err := json.Unmarshal(contents, &m); err != nil { return nil, "", err } version := m.APIVersion - service, err := LoadContainerService(contents, version) + service, err := a.LoadContainerService(contents, version) return service, version, err } // LoadContainerService loads an ACS Cluster API Model, validates it, and returns the unversioned representation -func LoadContainerService(contents []byte, version string) (*ContainerService, error) { +func (a *Apiloader) LoadContainerService(contents []byte, version string) (*ContainerService, error) { switch version { case v20160930.APIVersion: containerService := &v20160930.ContainerService{} @@ -76,12 +81,12 @@ func LoadContainerService(contents []byte, version string) (*ContainerService, e return ConvertVLabsContainerService(containerService), nil default: - return nil, fmt.Errorf("unrecognized APIVersion '%s'", version) + return nil, a.Translator.Errorf("unrecognized APIVersion '%s'", version) } } // SerializeContainerService takes an unversioned container service and returns the bytes -func SerializeContainerService(containerService *ContainerService, version string) ([]byte, error) { +func (a *Apiloader) SerializeContainerService(containerService *ContainerService, version string) ([]byte, error) { switch version { case v20160930.APIVersion: v20160930ContainerService := ConvertContainerServiceToV20160930(containerService) @@ -128,6 +133,6 @@ func SerializeContainerService(containerService *ContainerService, version strin return b, nil default: - return nil, fmt.Errorf("invalid version %s for conversion back from unversioned object", version) + return nil, a.Translator.Errorf("invalid version %s for conversion back from unversioned object", version) } } diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go index 74c57f96ca..b20ef6c977 100644 --- a/pkg/i18n/i18n_test.go +++ b/pkg/i18n/i18n_test.go @@ -79,3 +79,20 @@ func TestTranslationsPlural(t *testing.T) { msg = translator.NT("There is %d parameter in resource %s", "There are %d parameters in resource %s", 9, 9, "Foo") Expect(msg).Should(Equal("There are 9 parameters in resource Foo")) } + +func TestTranslationsError(t *testing.T) { + RegisterTestingT(t) + + l, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + Expect(err).Should(BeNil()) + + translator := &Translator{ + Locale: l, + } + + e := translator.Errorf("File not exists") + Expect(e.Error()).Should(Equal("File not exists")) + + e = translator.NErrorf("There is %d error in the api model", "There are %d errors in the api model", 3, 3) + Expect(e.Error()).Should(Equal("There are 3 errors in the api model")) +} diff --git a/scripts/update-translation.sh b/scripts/update-translation.sh new file mode 100644 index 0000000000..39f2a9fdc5 --- /dev/null +++ b/scripts/update-translation.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +GO_SOURCE="pkg/acsengine/*.go pkg/api/*.go" +LANGUAGE="en_US" +DOMAIN="acsengine" +generate_po="false" +generate_mo="false" + +while getopts "hl:pm" opt; do + case $opt in + h) + echo "$0 [-l language] [-p] [-m]" + echo " -l : Language to translate" + echo " -p extract strings and generate PO file" + echo " -m generate MO file" + exit 0 + ;; + l) + LANGUAGE="${OPTARG}" + ;; + p) + generate_po="true" + ;; + m) + generate_mo="true" + ;; + \?) + echo "$0 [-l language] [-p] [-m]" + exit 1 + ;; + esac +done + +if ! which go-xgettext > /dev/null; then + echo 'Can not find go-xgettext, install with:' + echo 'go get github.com/gosexy/gettext/go-xgettext' + exit 1 +fi + +if ! which msginit > /dev/null; then + echo 'Can not find msginit, install with:' + echo 'apt-get install gettext' + exit 1 +fi + +if [[ "${generate_po}" == "true" ]]; then + echo "Extract strings and generate PO files..." + go-xgettext -o ${DOMAIN}.pot --keyword=Translator.Errorf --keyword-plural=Translator.NErrorf --msgid-bugs-address="" --sort-output ${GO_SOURCE} + msginit -l ${LANGUAGE} -o ${DOMAIN}.po -i ${DOMAIN}.pot +fi + +if [[ "${generate_mo}" == "true" ]]; then + echo "Generate MO file..." + if [ ! -f ${DOMAIN}.po ]; then + echo "${DOMAIN}.po not found!" + exit 1 + fi + msgfmt -c -v -o ${DOMAIN}.mo ${DOMAIN}.po +fi diff --git a/test/i18n/i18ntestinput.go b/test/i18n/i18ntestinput.go index 147976a13b..df6a0b601b 100644 --- a/test/i18n/i18ntestinput.go +++ b/test/i18n/i18ntestinput.go @@ -7,11 +7,13 @@ import ( // This file is used to generate the test translation file // 1. go-xgettext -o i18ntestinput.pot --keyword=translator.T --keyword-plural=translator.NT --msgid-bugs-address="" --sort-output test/i18n/i18ntestinput.go -// 2. msginit -l en_US -o i18ntestinput.po -i i18ntestinput.pot -// 3. Modify i18ntestinput.po using poedit as necessary +// 2. go-xgettext -o i18ntestinput.err.pot --keyword=translator.Errorf --keyword-plural=translator.NErrorf --msgid-bugs-address="" --sort-output test/i18n/i18ntestinput.go +// 3. sed '1,18d' i18ntestinput.err.pot >> i18ntestinput.pot +// 4. msginit -l en_US -o i18ntestinput.po -i i18ntestinput.pot +// 5. Modify i18ntestinput.po using poedit as necessary // Or msgfmt -c -v -o i18ntestinput.mo i18ntestinput.po -// 4. for d in "default" "en_US"; do cp i18ntestinput.mo translations/test/$d/LC_MESSAGES/acsengine.mo; cp i18ntestinput.po translations/test/$d/LC_MESSAGES/acsengine.po; done -// 5. rm i18ntestinput.* +// 6. for d in "default" "en_US"; do cp i18ntestinput.mo translations/test/$d/LC_MESSAGES/acsengine.mo; cp i18ntestinput.po translations/test/$d/LC_MESSAGES/acsengine.po; done +// 7. rm i18ntestinput.* var ( locale = gotext.NewLocale("d", "l") @@ -33,3 +35,11 @@ func foo() { func bar() { translator.NT("There is %d parameter in resource %s", "There are %d parameters in resource %s", 9, 9, resource) } + +func file() error { + return translator.Errorf("File not exists") +} + +func api() error { + return translator.NErrorf("There is %d error in the api model", "There are %d errors in the api model", 3, 3) +} diff --git a/translations/default/LC_MESSAGES/acsengine.mo b/translations/default/LC_MESSAGES/acsengine.mo new file mode 100644 index 0000000000000000000000000000000000000000..345731a5a1ff116adcf85ff4740d19cc5b20a050 GIT binary patch literal 1352 zcmeH`&u-H&9LEEUf8oH!4S~dOhiOC1C5<#TGCBdHLqi)>qeDm>ke9frM`BmDQ*B7x zxN|~02k(J+1YTi00$-=?Hg@KSrC&d>^YzzX$L_BiQ(ptLYpB~OhnhkCK>0R(E(i#m z0cXJ&TmZY^P4Ls0-@rBWzk>w+2Je6~=SRLx@D}b<5;4u)jAcewtMJA0%oi>LwKWFDpDa3(Dt6JhjIViXj)PwWb5yIiv zYQT*>wbrROXHwMWQVn?_Ga3ra(h7-c+f=K`$R1BWP|xU+s>zthNbl_ z>=^A6u+5B(=On~aD^xC(2zP{EpKaS*X6$K|Th`SHg`HPjwqAc~t=Kbs!-V3fxy+&^ z)?A@zDTyB5i_josJ7OsPCpoKIrZ`TT4_LGe-4?fwbq!Y*C!$S4FCR!($2TTd9)R;l)PFrk$_>B3G?8D6jrZAzPv8q{6e tidSj$*ji9D+oI;()$lEQE|jQ`IH8UfnRFC4qDCD4zum`w#eaOe{{UsReeM7N literal 0 HcmV?d00001 diff --git a/translations/default/LC_MESSAGES/acsengine.po b/translations/default/LC_MESSAGES/acsengine.po new file mode 100644 index 0000000000..bc46c74a36 --- /dev/null +++ b/translations/default/LC_MESSAGES/acsengine.po @@ -0,0 +1,69 @@ +# English translations for acsengine package. +# Copyright (C) 2017 +# This file is distributed under the same license as the acsengine package. +# Jiangtian Li , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: acsengine\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-18 05:09+0000\n" +"PO-Revision-Date: 2017-05-17 22:16-0700\n" +"Last-Translator: Jiangtian Li \n" +"Language-Team: English\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.0.2\n" + +#: pkg/acsengine/engine.go:221 +#, c-format +msgid "Error reading file %s, Error: %s" +msgstr "Error reading file %s, Error: %s" + +#: pkg/acsengine/output.go:109 +#, c-format +msgid "error creating directory '%s': %s" +msgstr "error creating directory '%s': %s" + +#: pkg/acsengine/engine.go:1016 +#, c-format +msgid "error executing template for file %s: %v" +msgstr "error executing template for file %s: %v" + +#: pkg/acsengine/engine.go:1011 +#, c-format +msgid "error parsing file %s: %v" +msgstr "error parsing file %s: %v" + +#: pkg/api/apiloader.go:23 +#, c-format +msgid "error reading file %s: %s" +msgstr "error reading file %s: %s" + +#: pkg/api/apiloader.go:136 +#, c-format +msgid "invalid version %s for conversion back from unversioned object" +msgstr "invalid version %s for conversion back from unversioned object" + +#: pkg/acsengine/engine.go:302 +#, c-format +msgid "orchestrator '%s' is unsupported" +msgstr "orchestrator '%s' is unsupported" + +#: pkg/acsengine/engine.go:169 +#, c-format +msgid "template file %s does not exist" +msgstr "template file %s does not exist" + +#: pkg/api/apiloader.go:84 +#, c-format +msgid "unrecognized APIVersion '%s'" +msgstr "unrecognized APIVersion '%s'" + +#: pkg/acsengine/engine.go:1005 +#, c-format +msgid "yaml file %s does not exist" +msgstr "yaml file %s does not exist" diff --git a/translations/en_US/LC_MESSAGES/acsengine.mo b/translations/en_US/LC_MESSAGES/acsengine.mo new file mode 100644 index 0000000000000000000000000000000000000000..345731a5a1ff116adcf85ff4740d19cc5b20a050 GIT binary patch literal 1352 zcmeH`&u-H&9LEEUf8oH!4S~dOhiOC1C5<#TGCBdHLqi)>qeDm>ke9frM`BmDQ*B7x zxN|~02k(J+1YTi00$-=?Hg@KSrC&d>^YzzX$L_BiQ(ptLYpB~OhnhkCK>0R(E(i#m z0cXJ&TmZY^P4Ls0-@rBWzk>w+2Je6~=SRLx@D}b<5;4u)jAcewtMJA0%oi>LwKWFDpDa3(Dt6JhjIViXj)PwWb5yIiv zYQT*>wbrROXHwMWQVn?_Ga3ra(h7-c+f=K`$R1BWP|xU+s>zthNbl_ z>=^A6u+5B(=On~aD^xC(2zP{EpKaS*X6$K|Th`SHg`HPjwqAc~t=Kbs!-V3fxy+&^ z)?A@zDTyB5i_josJ7OsPCpoKIrZ`TT4_LGe-4?fwbq!Y*C!$S4FCR!($2TTd9)R;l)PFrk$_>B3G?8D6jrZAzPv8q{6e tidSj$*ji9D+oI;()$lEQE|jQ`IH8UfnRFC4qDCD4zum`w#eaOe{{UsReeM7N literal 0 HcmV?d00001 diff --git a/translations/en_US/LC_MESSAGES/acsengine.po b/translations/en_US/LC_MESSAGES/acsengine.po new file mode 100644 index 0000000000..bc46c74a36 --- /dev/null +++ b/translations/en_US/LC_MESSAGES/acsengine.po @@ -0,0 +1,69 @@ +# English translations for acsengine package. +# Copyright (C) 2017 +# This file is distributed under the same license as the acsengine package. +# Jiangtian Li , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: acsengine\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-18 05:09+0000\n" +"PO-Revision-Date: 2017-05-17 22:16-0700\n" +"Last-Translator: Jiangtian Li \n" +"Language-Team: English\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.0.2\n" + +#: pkg/acsengine/engine.go:221 +#, c-format +msgid "Error reading file %s, Error: %s" +msgstr "Error reading file %s, Error: %s" + +#: pkg/acsengine/output.go:109 +#, c-format +msgid "error creating directory '%s': %s" +msgstr "error creating directory '%s': %s" + +#: pkg/acsengine/engine.go:1016 +#, c-format +msgid "error executing template for file %s: %v" +msgstr "error executing template for file %s: %v" + +#: pkg/acsengine/engine.go:1011 +#, c-format +msgid "error parsing file %s: %v" +msgstr "error parsing file %s: %v" + +#: pkg/api/apiloader.go:23 +#, c-format +msgid "error reading file %s: %s" +msgstr "error reading file %s: %s" + +#: pkg/api/apiloader.go:136 +#, c-format +msgid "invalid version %s for conversion back from unversioned object" +msgstr "invalid version %s for conversion back from unversioned object" + +#: pkg/acsengine/engine.go:302 +#, c-format +msgid "orchestrator '%s' is unsupported" +msgstr "orchestrator '%s' is unsupported" + +#: pkg/acsengine/engine.go:169 +#, c-format +msgid "template file %s does not exist" +msgstr "template file %s does not exist" + +#: pkg/api/apiloader.go:84 +#, c-format +msgid "unrecognized APIVersion '%s'" +msgstr "unrecognized APIVersion '%s'" + +#: pkg/acsengine/engine.go:1005 +#, c-format +msgid "yaml file %s does not exist" +msgstr "yaml file %s does not exist" diff --git a/translations/test/default/LC_MESSAGES/acsengine.mo b/translations/test/default/LC_MESSAGES/acsengine.mo index 89cd0ec5cc78dd67a901086a70f7ac57b8ad4fec..c57a041dc94c632c96b1c261b2b39d8e10e94600 100644 GIT binary patch delta 406 zcmZ3(I)%Odo)F7a1|VPqVi_Rz0b*_-t^r~YSOLVWK)e!&`GI&n5OVYoE?koxaH8l;|q8KT|;NCTDDgM>h0V88+-K@I@{kRc!d z)CU2MIr$lh3~re@sS0`dB?_q(nZ+f=3?8XDIr$2z#S9@CsYR&@nZ*jKDGI4YMfpVv znRyB&8L0}11(^!D`6;P6P$h{#WiU0xf*7hM*3V8Hhn<1Gy03n3JE8$l#HhlasHYT0HSM?_?RqiR@+yMut|V crjxfYDgxPtCRV1Fo9{4kGfvzu3Y2#M099icVgLXD diff --git a/translations/test/default/LC_MESSAGES/acsengine.po b/translations/test/default/LC_MESSAGES/acsengine.po index b058ea8c36..e8283edc67 100644 --- a/translations/test/default/LC_MESSAGES/acsengine.po +++ b/translations/test/default/LC_MESSAGES/acsengine.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: acsengine\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-16 21:55+0000\n" -"PO-Revision-Date: 2017-05-16 14:59-0700\n" +"POT-Creation-Date: 2017-05-18 00:31+0000\n" +"PO-Revision-Date: 2017-05-17 17:35-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: English\n" "Language: en_US\n" @@ -17,18 +17,29 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.0.2\n" -#: test/i18n/i18ntestinput.go:26 +#: test/i18n/i18ntestinput.go:28 msgid "Aloha" msgstr "Aloha" -#: test/i18n/i18ntestinput.go:30 +#: test/i18n/i18ntestinput.go:32 #, c-format msgid "Hello %s" msgstr "Hello %s" -#: test/i18n/i18ntestinput.go:34 +#: test/i18n/i18ntestinput.go:36 #, c-format msgid "There is %d parameter in resource %s" msgid_plural "There are %d parameters in resource %s" msgstr[0] "There is %d parameter in resource %s" msgstr[1] "There are %d parameters in resource %s" + +#: test/i18n/i18ntestinput.go:40 +msgid "File not exists" +msgstr "File not exists" + +#: test/i18n/i18ntestinput.go:44 +#, c-format +msgid "There is %d error in the api model" +msgid_plural "There are %d errors in the api model" +msgstr[0] "There is %d error in the api model" +msgstr[1] "There are %d errors in the api model" diff --git a/translations/test/en_US/LC_MESSAGES/acsengine.mo b/translations/test/en_US/LC_MESSAGES/acsengine.mo index 89cd0ec5cc78dd67a901086a70f7ac57b8ad4fec..c57a041dc94c632c96b1c261b2b39d8e10e94600 100644 GIT binary patch delta 406 zcmZ3(I)%Odo)F7a1|VPqVi_Rz0b*_-t^r~YSOLVWK)e!&`GI&n5OVYoE?koxaH8l;|q8KT|;NCTDDgM>h0V88+-K@I@{kRc!d z)CU2MIr$lh3~re@sS0`dB?_q(nZ+f=3?8XDIr$2z#S9@CsYR&@nZ*jKDGI4YMfpVv znRyB&8L0}11(^!D`6;P6P$h{#WiU0xf*7hM*3V8Hhn<1Gy03n3JE8$l#HhlasHYT0HSM?_?RqiR@+yMut|V crjxfYDgxPtCRV1Fo9{4kGfvzu3Y2#M099icVgLXD diff --git a/translations/test/en_US/LC_MESSAGES/acsengine.po b/translations/test/en_US/LC_MESSAGES/acsengine.po index b058ea8c36..e8283edc67 100644 --- a/translations/test/en_US/LC_MESSAGES/acsengine.po +++ b/translations/test/en_US/LC_MESSAGES/acsengine.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: acsengine\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-16 21:55+0000\n" -"PO-Revision-Date: 2017-05-16 14:59-0700\n" +"POT-Creation-Date: 2017-05-18 00:31+0000\n" +"PO-Revision-Date: 2017-05-17 17:35-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: English\n" "Language: en_US\n" @@ -17,18 +17,29 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.0.2\n" -#: test/i18n/i18ntestinput.go:26 +#: test/i18n/i18ntestinput.go:28 msgid "Aloha" msgstr "Aloha" -#: test/i18n/i18ntestinput.go:30 +#: test/i18n/i18ntestinput.go:32 #, c-format msgid "Hello %s" msgstr "Hello %s" -#: test/i18n/i18ntestinput.go:34 +#: test/i18n/i18ntestinput.go:36 #, c-format msgid "There is %d parameter in resource %s" msgid_plural "There are %d parameters in resource %s" msgstr[0] "There is %d parameter in resource %s" msgstr[1] "There are %d parameters in resource %s" + +#: test/i18n/i18ntestinput.go:40 +msgid "File not exists" +msgstr "File not exists" + +#: test/i18n/i18ntestinput.go:44 +#, c-format +msgid "There is %d error in the api model" +msgid_plural "There are %d errors in the api model" +msgstr[0] "There is %d error in the api model" +msgstr[1] "There are %d errors in the api model" diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.mo b/translations/zh_CN/LC_MESSAGES/acsengine.mo new file mode 100644 index 0000000000000000000000000000000000000000..b22463d02498df91bccdecb4e1b3a3594a98b5c0 GIT binary patch literal 1297 zcmZuvOHUL*5N;J;s|WFA-jxO(shc=E&y%SAnU^qXOJS%{s~eBISweN{DGKQ~ql5v+Bv ztuO_vhJA6t}eF`IMt2 zB;1{65?XWcho#U?;MeIi9*s3>(FQHnM57J*zJ}dVED*J`tcUx5VkxhY#^d__m=>6GC|(^6#(o~buw_6XucDsQBimS9F!r_E_D zn8RqD!||j%$(gmQ%+cwU^rhyGNPBC0%R-B>`e>wC3dIBp=*yuK#d_6V39kWaiz^zhkJiT{#2dafGyM+J z@cYxi-2Jg)p-?PLyLX4Zk$3K`kMIP;)n1{oE#`CVM3`l zHR(P2TBecW^QYd#y)wn0)ddj}rYx1>r>wZ0d4IOPzze(>9&V&SIS{{o8tpVV?66@mW%y0yE> literal 0 HcmV?d00001 diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.po b/translations/zh_CN/LC_MESSAGES/acsengine.po new file mode 100644 index 0000000000..ccd03d4bce --- /dev/null +++ b/translations/zh_CN/LC_MESSAGES/acsengine.po @@ -0,0 +1,68 @@ +# Chinese translations for acsengine package. +# Copyright (C) 2017 +# This file is distributed under the same license as the acsengine package. +# Jiangtian Li , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-18 05:35+0000\n" +"PO-Revision-Date: 2017-05-17 22:41-0700\n" +"Last-Translator: Jiangtian Li \n" +"Language-Team: Chinese (simplified)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.2\n" + +#: pkg/acsengine/engine.go:221 +#, c-format +msgid "Error reading file %s, Error: %s" +msgstr "文件 %s,错误读取时出错: %s" + +#: pkg/acsengine/output.go:109 +#, c-format +msgid "error creating directory '%s': %s" +msgstr "创建目录 %s 时出错: %s" + +#: pkg/acsengine/engine.go:1016 +#, c-format +msgid "error executing template for file %s: %v" +msgstr "执行文件 %s %v 模板时出错" + +#: pkg/acsengine/engine.go:1011 +#, c-format +msgid "error parsing file %s: %v" +msgstr "解析文件 %s: %v 时出错" + +#: pkg/api/apiloader.go:23 +#, c-format +msgid "error reading file %s: %s" +msgstr "读取文件 %s: %s 时出错" + +#: pkg/api/apiloader.go:136 +#, c-format +msgid "invalid version %s for conversion back from unversioned object" +msgstr "与回是非版本化的对象的转换的版本无效 %s" + +#: pkg/acsengine/engine.go:302 +#, c-format +msgid "orchestrator '%s' is unsupported" +msgstr "%s 配器是不受支持" + +#: pkg/acsengine/engine.go:169 +#, c-format +msgid "template file %s does not exist" +msgstr "模板文件 %s 不存在" + +#: pkg/api/apiloader.go:84 +#, c-format +msgid "unrecognized APIVersion '%s'" +msgstr "无法识别的 APIVersion '%s'" + +#: pkg/acsengine/engine.go:1005 +#, c-format +msgid "yaml file %s does not exist" +msgstr "yaml 文件 %s 不存在" From 1867b0c3d665524342a6172c23fffe9e8ebcba66 Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Thu, 18 May 2017 14:31:46 -0700 Subject: [PATCH 03/13] Vendor github.com/leonelquinteros/gotext package using glide --- glide.lock | 12 +- glide.yaml | 2 + .../Azure/azure-sdk-for-go/.gitignore | 64 +- .../Azure/azure-sdk-for-go/.travis.yml | 64 +- .../Azure/azure-sdk-for-go/CHANGELOG.md | 966 +- .../Azure/azure-sdk-for-go/Gododir/gen.go | 1376 +- .../github.com/Azure/azure-sdk-for-go/LICENSE | 404 +- .../Azure/azure-sdk-for-go/README.md | 118 +- .../Azure/azure-sdk-for-go/arm/README.md | 570 +- .../azure-sdk-for-go/arm/advisor/client.go | 106 +- .../azure-sdk-for-go/arm/advisor/models.go | 376 +- .../arm/advisor/operations.go | 244 +- .../arm/advisor/recommendations.go | 676 +- .../arm/advisor/suppressions.go | 690 +- .../azure-sdk-for-go/arm/advisor/version.go | 58 +- .../arm/analysisservices/client.go | 110 +- .../arm/analysisservices/models.go | 370 +- .../arm/analysisservices/servers.go | 1480 +- .../arm/analysisservices/version.go | 58 +- .../arm/apimanagement/apiexport.go | 244 +- .../arm/apimanagement/apioperations.go | 1070 +- .../arm/apimanagement/apioperationspolicy.go | 624 +- .../arm/apimanagement/apipolicy.go | 578 +- .../arm/apimanagement/apiproducts.go | 332 +- .../arm/apimanagement/apis.go | 1024 +- .../arm/apimanagement/authorizationservers.go | 1000 +- .../arm/apimanagement/backends.go | 984 +- .../arm/apimanagement/certificates.go | 844 +- .../arm/apimanagement/client.go | 106 +- .../arm/apimanagement/groups.go | 1002 +- .../arm/apimanagement/groupusers.go | 702 +- .../arm/apimanagement/identityproviders.go | 876 +- .../arm/apimanagement/loggers.go | 974 +- .../arm/apimanagement/models.go | 3062 +- .../arm/apimanagement/networkstatus.go | 238 +- .../apimanagement/openidconnectproviders.go | 988 +- .../arm/apimanagement/operations.go | 246 +- .../arm/apimanagement/policysnippets.go | 240 +- .../arm/apimanagement/productapis.go | 688 +- .../arm/apimanagement/productgroups.go | 690 +- .../arm/apimanagement/productpolicy.go | 580 +- .../arm/apimanagement/products.go | 1032 +- .../arm/apimanagement/productsubscriptions.go | 354 +- .../arm/apimanagement/properties.go | 326 +- .../arm/apimanagement/property.go | 754 +- .../arm/apimanagement/quotabycounterkeys.go | 402 +- .../arm/apimanagement/quotabyperiodkeys.go | 402 +- .../arm/apimanagement/regions.go | 230 +- .../arm/apimanagement/reports.go | 330 +- .../arm/apimanagement/services.go | 2556 +- .../arm/apimanagement/subscriptions.go | 1348 +- .../arm/apimanagement/tenantaccess.go | 680 +- .../arm/apimanagement/tenantaccessgit.go | 526 +- .../arm/apimanagement/tenantconfiguration.go | 680 +- .../tenantconfigurationsyncstate.go | 238 +- .../arm/apimanagement/tenantpolicy.go | 544 +- .../arm/apimanagement/usergroups.go | 340 +- .../arm/apimanagement/useridentities.go | 246 +- .../arm/apimanagement/users.go | 1202 +- .../arm/apimanagement/usersubscriptions.go | 352 +- .../arm/apimanagement/version.go | 58 +- .../apimdeployment/apimanagementservices.go | 2120 +- .../arm/apimdeployment/client.go | 116 +- .../arm/apimdeployment/models.go | 502 +- .../arm/apimdeployment/version.go | 120 +- .../arm/appinsights/client.go | 106 +- .../arm/appinsights/components.go | 994 +- .../arm/appinsights/models.go | 452 +- .../arm/appinsights/operations.go | 246 +- .../arm/appinsights/version.go | 58 +- .../arm/appinsights/webtests.go | 998 +- .../authorization/classicadministrators.go | 266 +- .../arm/authorization/client.go | 114 +- .../arm/authorization/models.go | 446 +- .../arm/authorization/permissions.go | 464 +- .../provideroperationsmetadata.go | 400 +- .../arm/authorization/roleassignments.go | 1650 +- .../arm/authorization/roledefinitions.go | 798 +- .../arm/authorization/version.go | 58 +- .../arm/automation/account.go | 1028 +- .../arm/automation/activity.go | 432 +- .../agentregistrationinformation.go | 382 +- .../arm/automation/certificate.go | 882 +- .../azure-sdk-for-go/arm/automation/client.go | 104 +- .../arm/automation/connection.go | 884 +- .../arm/automation/connectiontype.go | 732 +- .../arm/automation/credential.go | 886 +- .../arm/automation/dsccompilationjob.go | 746 +- .../arm/automation/dscconfiguration.go | 888 +- .../arm/automation/dscnode.go | 724 +- .../arm/automation/dscnodeconfiguration.go | 754 +- .../azure-sdk-for-go/arm/automation/fields.go | 234 +- .../automation/hybridrunbookworkergroup.go | 726 +- .../azure-sdk-for-go/arm/automation/job.go | 1308 +- .../arm/automation/jobschedule.go | 730 +- .../arm/automation/jobstream.go | 436 +- .../azure-sdk-for-go/arm/automation/models.go | 3852 +- .../azure-sdk-for-go/arm/automation/module.go | 886 +- .../arm/automation/nodereports.go | 584 +- .../arm/automation/objectdatatypes.go | 388 +- .../arm/automation/operations.go | 196 +- .../arm/automation/runbook.go | 1046 +- .../arm/automation/runbookdraft.go | 894 +- .../arm/automation/schedule.go | 878 +- .../arm/automation/statistics.go | 234 +- .../arm/automation/testjobs.go | 820 +- .../arm/automation/testjobstreams.go | 442 +- .../azure-sdk-for-go/arm/automation/usages.go | 226 +- .../arm/automation/variable.go | 876 +- .../arm/automation/version.go | 58 +- .../arm/automation/webhook.go | 1024 +- .../azure-sdk-for-go/arm/batch/account.go | 1642 +- .../azure-sdk-for-go/arm/batch/application.go | 928 +- .../arm/batch/applicationpackage.go | 726 +- .../azure-sdk-for-go/arm/batch/client.go | 104 +- .../azure-sdk-for-go/arm/batch/location.go | 212 +- .../azure-sdk-for-go/arm/batch/models.go | 528 +- .../azure-sdk-for-go/arm/batch/version.go | 58 +- .../azure-sdk-for-go/arm/billing/client.go | 110 +- .../azure-sdk-for-go/arm/billing/invoices.go | 586 +- .../azure-sdk-for-go/arm/billing/models.go | 320 +- .../arm/billing/operations.go | 250 +- .../azure-sdk-for-go/arm/billing/periods.go | 442 +- .../azure-sdk-for-go/arm/billing/version.go | 58 +- .../Azure/azure-sdk-for-go/arm/cdn/client.go | 586 +- .../azure-sdk-for-go/arm/cdn/customdomains.go | 1170 +- .../azure-sdk-for-go/arm/cdn/edgenodes.go | 248 +- .../azure-sdk-for-go/arm/cdn/endpoints.go | 2202 +- .../Azure/azure-sdk-for-go/arm/cdn/models.go | 1194 +- .../Azure/azure-sdk-for-go/arm/cdn/origins.go | 646 +- .../azure-sdk-for-go/arm/cdn/profiles.go | 1548 +- .../Azure/azure-sdk-for-go/arm/cdn/version.go | 58 +- .../arm/cognitiveservices/accounts.go | 1448 +- .../arm/cognitiveservices/client.go | 106 +- .../arm/cognitiveservices/models.go | 424 +- .../arm/cognitiveservices/version.go | 58 +- .../azure-sdk-for-go/arm/commerce/client.go | 106 +- .../azure-sdk-for-go/arm/commerce/models.go | 302 +- .../azure-sdk-for-go/arm/commerce/ratecard.go | 234 +- .../arm/commerce/usageaggregates.go | 310 +- .../azure-sdk-for-go/arm/commerce/version.go | 58 +- .../arm/compute/availabilitysets.go | 748 +- .../azure-sdk-for-go/arm/compute/client.go | 106 +- .../azure-sdk-for-go/arm/compute/images.go | 926 +- .../azure-sdk-for-go/arm/compute/models.go | 2684 +- .../azure-sdk-for-go/arm/compute/usage.go | 274 +- .../azure-sdk-for-go/arm/compute/version.go | 58 +- .../compute/virtualmachineextensionimages.go | 494 +- .../arm/compute/virtualmachineextensions.go | 572 +- .../arm/compute/virtualmachineimages.go | 782 +- .../arm/compute/virtualmachines.go | 2414 +- .../arm/compute/virtualmachinescalesets.go | 2632 +- .../arm/compute/virtualmachinescalesetvms.go | 1744 +- .../arm/compute/virtualmachinesizes.go | 228 +- .../arm/consumption/client.go | 112 +- .../arm/consumption/models.go | 282 +- .../arm/consumption/operations.go | 250 +- .../arm/consumption/usagedetails.go | 340 +- .../arm/consumption/version.go | 58 +- .../arm/containerregistry/client.go | 106 +- .../arm/containerregistry/models.go | 446 +- .../arm/containerregistry/operations.go | 248 +- .../arm/containerregistry/registries.go | 1566 +- .../arm/containerregistry/version.go | 58 +- .../arm/containerservice/client.go | 106 +- .../arm/containerservice/containerservices.go | 998 +- .../arm/containerservice/models.go | 514 +- .../arm/containerservice/version.go | 58 +- .../authorizationpolicies.go | 848 +- .../arm/customer-insights/client.go | 112 +- .../customer-insights/connectormappings.go | 738 +- .../arm/customer-insights/connectors.go | 766 +- .../arm/customer-insights/hubs.go | 1042 +- .../arm/customer-insights/images.go | 364 +- .../arm/customer-insights/interactions.go | 750 +- .../arm/customer-insights/kpi.go | 910 +- .../arm/customer-insights/links.go | 740 +- .../arm/customer-insights/models.go | 2514 +- .../arm/customer-insights/profiles.go | 922 +- .../customer-insights/relationshiplinks.go | 782 +- .../arm/customer-insights/relationships.go | 776 +- .../arm/customer-insights/roleassignments.go | 740 +- .../arm/customer-insights/roles.go | 266 +- .../arm/customer-insights/version.go | 58 +- .../arm/customer-insights/views.go | 704 +- .../arm/customer-insights/widgettypes.go | 402 +- .../account/accountgroup.go | 1282 +- .../arm/datalake-analytics/account/client.go | 106 +- .../account/datalakestoreaccounts.go | 782 +- .../account/firewallrules.go | 864 +- .../arm/datalake-analytics/account/models.go | 858 +- .../account/storageaccounts.go | 1476 +- .../arm/datalake-analytics/account/version.go | 58 +- .../datalake-store/account/accountgroup.go | 1404 +- .../arm/datalake-store/account/client.go | 106 +- .../datalake-store/account/firewallrules.go | 864 +- .../arm/datalake-store/account/models.go | 740 +- .../account/trustedidproviders.go | 868 +- .../arm/datalake-store/account/version.go | 58 +- .../arm/devtestlabs/armtemplates.go | 442 +- .../arm/devtestlabs/artifacts.go | 590 +- .../arm/devtestlabs/artifactsources.go | 864 +- .../arm/devtestlabs/client.go | 106 +- .../azure-sdk-for-go/arm/devtestlabs/costs.go | 374 +- .../arm/devtestlabs/customimages.go | 790 +- .../azure-sdk-for-go/arm/devtestlabs/disks.go | 1148 +- .../arm/devtestlabs/environments.go | 806 +- .../arm/devtestlabs/formulas.go | 786 +- .../arm/devtestlabs/galleryimages.go | 294 +- .../arm/devtestlabs/globalschedules.go | 1382 +- .../azure-sdk-for-go/arm/devtestlabs/labs.go | 1954 +- .../arm/devtestlabs/models.go | 3904 +- .../arm/devtestlabs/notificationchannels.go | 1002 +- .../arm/devtestlabs/policies.go | 876 +- .../arm/devtestlabs/policysets.go | 222 +- .../arm/devtestlabs/schedules.go | 1202 +- .../arm/devtestlabs/secrets.go | 732 +- .../arm/devtestlabs/servicerunners.go | 692 +- .../azure-sdk-for-go/arm/devtestlabs/users.go | 878 +- .../arm/devtestlabs/version.go | 58 +- .../arm/devtestlabs/virtualmachines.go | 2090 +- .../devtestlabs/virtualmachineschedules.go | 1046 +- .../arm/devtestlabs/virtualnetworks.go | 914 +- .../Azure/azure-sdk-for-go/arm/disk/client.go | 106 +- .../Azure/azure-sdk-for-go/arm/disk/disks.go | 1456 +- .../Azure/azure-sdk-for-go/arm/disk/models.go | 556 +- .../azure-sdk-for-go/arm/disk/snapshots.go | 1466 +- .../azure-sdk-for-go/arm/disk/version.go | 58 +- .../Azure/azure-sdk-for-go/arm/dns/client.go | 104 +- .../Azure/azure-sdk-for-go/arm/dns/models.go | 720 +- .../azure-sdk-for-go/arm/dns/recordsets.go | 1090 +- .../Azure/azure-sdk-for-go/arm/dns/version.go | 58 +- .../Azure/azure-sdk-for-go/arm/dns/zones.go | 926 +- .../azure-sdk-for-go/arm/documentdb/client.go | 106 +- .../arm/documentdb/databaseaccounts.go | 2138 +- .../azure-sdk-for-go/arm/documentdb/models.go | 420 +- .../arm/documentdb/version.go | 58 +- .../azure-sdk-for-go/arm/eventhub/client.go | 106 +- .../arm/eventhub/consumergroups.go | 820 +- .../arm/eventhub/eventhubs.go | 1862 +- .../azure-sdk-for-go/arm/eventhub/models.go | 898 +- .../arm/eventhub/namespaces.go | 2326 +- .../arm/eventhub/operations.go | 244 +- .../azure-sdk-for-go/arm/eventhub/version.go | 58 +- .../arm/examples/check/check.go | 172 +- .../arm/examples/create/create.go | 162 +- .../arm/examples/helpers/helpers.go | 98 +- .../arm/graphrbac/applications.go | 1404 +- .../azure-sdk-for-go/arm/graphrbac/client.go | 106 +- .../azure-sdk-for-go/arm/graphrbac/groups.go | 1572 +- .../azure-sdk-for-go/arm/graphrbac/models.go | 596 +- .../azure-sdk-for-go/arm/graphrbac/objects.go | 480 +- .../arm/graphrbac/serviceprincipals.go | 1278 +- .../azure-sdk-for-go/arm/graphrbac/users.go | 1032 +- .../azure-sdk-for-go/arm/graphrbac/version.go | 58 +- .../arm/hdinsight/applications.go | 704 +- .../azure-sdk-for-go/arm/hdinsight/client.go | 104 +- .../arm/hdinsight/clusters.go | 1570 +- .../arm/hdinsight/configurations.go | 390 +- .../arm/hdinsight/extension.go | 486 +- .../arm/hdinsight/location.go | 210 +- .../azure-sdk-for-go/arm/hdinsight/models.go | 1204 +- .../arm/hdinsight/operations.go | 244 +- .../arm/hdinsight/scriptactions.go | 396 +- .../arm/hdinsight/scriptexecutionhistory.go | 530 +- .../azure-sdk-for-go/arm/hdinsight/version.go | 58 +- .../arm/insights/alertruleincidents.go | 352 +- .../arm/insights/alertrules.go | 642 +- .../arm/insights/autoscalesettings.go | 694 +- .../azure-sdk-for-go/arm/insights/client.go | 104 +- .../arm/insights/logprofiles.go | 618 +- .../azure-sdk-for-go/arm/insights/models.go | 1022 +- .../arm/insights/servicediagnosticsettings.go | 346 +- .../azure-sdk-for-go/arm/insights/version.go | 58 +- .../azure-sdk-for-go/arm/intune/android.go | 1750 +- .../azure-sdk-for-go/arm/intune/client.go | 1946 +- .../Azure/azure-sdk-for-go/arm/intune/ios.go | 1750 +- .../azure-sdk-for-go/arm/intune/models.go | 1380 +- .../azure-sdk-for-go/arm/intune/version.go | 58 +- .../azure-sdk-for-go/arm/iothub/client.go | 106 +- .../azure-sdk-for-go/arm/iothub/models.go | 1078 +- .../azure-sdk-for-go/arm/iothub/resource.go | 3154 +- .../azure-sdk-for-go/arm/iothub/version.go | 58 +- .../azure-sdk-for-go/arm/keyvault/client.go | 108 +- .../azure-sdk-for-go/arm/keyvault/models.go | 486 +- .../azure-sdk-for-go/arm/keyvault/vaults.go | 886 +- .../azure-sdk-for-go/arm/keyvault/version.go | 58 +- .../azure-sdk-for-go/arm/logic/agreements.go | 1558 +- .../arm/logic/certificates.go | 704 +- .../azure-sdk-for-go/arm/logic/client.go | 270 +- .../arm/logic/integrationaccounts.go | 1118 +- .../Azure/azure-sdk-for-go/arm/logic/maps.go | 694 +- .../azure-sdk-for-go/arm/logic/models.go | 4060 +- .../azure-sdk-for-go/arm/logic/partners.go | 702 +- .../azure-sdk-for-go/arm/logic/schemas.go | 694 +- .../azure-sdk-for-go/arm/logic/sessions.go | 700 +- .../azure-sdk-for-go/arm/logic/version.go | 58 +- .../arm/logic/workflowrunactions.go | 418 +- .../arm/logic/workflowruns.go | 542 +- .../azure-sdk-for-go/arm/logic/workflows.go | 1796 +- .../arm/logic/workflowtriggerhistories.go | 560 +- .../arm/logic/workflowtriggers.go | 680 +- .../arm/logic/workflowversions.go | 552 +- .../machinelearning/commitmentplans/client.go | 114 +- .../commitmentplans/commitmentassociations.go | 558 +- .../commitmentplans/commitmentplansgroup.go | 998 +- .../machinelearning/commitmentplans/models.go | 364 +- .../commitmentplans/usagehistory.go | 280 +- .../commitmentplans/version.go | 58 +- .../arm/machinelearning/webservices/client.go | 116 +- .../arm/machinelearning/webservices/models.go | 898 +- .../machinelearning/webservices/version.go | 58 +- .../webservices/webservicesgroup.go | 1482 +- .../arm/mediaservices/client.go | 106 +- .../arm/mediaservices/mediaservice.go | 1432 +- .../arm/mediaservices/models.go | 298 +- .../arm/mediaservices/version.go | 58 +- .../arm/mobileengagement/appcollections.go | 384 +- .../arm/mobileengagement/apps.go | 260 +- .../arm/mobileengagement/campaigns.go | 2152 +- .../arm/mobileengagement/client.go | 106 +- .../arm/mobileengagement/devices.go | 954 +- .../arm/mobileengagement/exporttasks.go | 2014 +- .../arm/mobileengagement/importtasks.go | 618 +- .../arm/mobileengagement/models.go | 1840 +- .../mobileengagement/supportedplatforms.go | 206 +- .../arm/mobileengagement/version.go | 58 +- .../arm/monitor/activitylogalerts.go | 904 +- .../arm/monitor/alertruleincidents.go | 352 +- .../arm/monitor/alertrules.go | 630 +- .../arm/monitor/autoscalesettings.go | 682 +- .../azure-sdk-for-go/arm/monitor/client.go | 104 +- .../arm/monitor/logprofiles.go | 622 +- .../azure-sdk-for-go/arm/monitor/models.go | 1172 +- .../arm/monitor/servicediagnosticsettings.go | 484 +- .../azure-sdk-for-go/arm/monitor/version.go | 58 +- .../arm/network/applicationgateways.go | 1546 +- .../arm/network/bgpservicecommunities.go | 254 +- .../azure-sdk-for-go/arm/network/client.go | 248 +- .../expressroutecircuitauthorizations.go | 744 +- .../network/expressroutecircuitpeerings.go | 740 +- .../arm/network/expressroutecircuits.go | 1680 +- .../network/expressrouteserviceproviders.go | 256 +- .../arm/network/interfaces.go | 1742 +- .../arm/network/loadbalancers.go | 900 +- .../arm/network/localnetworkgateways.go | 778 +- .../azure-sdk-for-go/arm/network/models.go | 5992 +-- .../arm/network/packetcaptures.go | 1052 +- .../arm/network/publicipaddresses.go | 930 +- .../arm/network/routefilterrules.go | 936 +- .../arm/network/routefilters.go | 1070 +- .../azure-sdk-for-go/arm/network/routes.go | 730 +- .../arm/network/routetables.go | 898 +- .../arm/network/securitygroups.go | 904 +- .../arm/network/securityrules.go | 766 +- .../azure-sdk-for-go/arm/network/subnets.go | 738 +- .../azure-sdk-for-go/arm/network/usages.go | 270 +- .../azure-sdk-for-go/arm/network/version.go | 58 +- .../virtualnetworkgatewayconnections.go | 1304 +- .../arm/network/virtualnetworkgateways.go | 1570 +- .../arm/network/virtualnetworkpeerings.go | 740 +- .../arm/network/virtualnetworks.go | 1042 +- .../azure-sdk-for-go/arm/network/watchers.go | 2262 +- .../arm/networkwatcher/client.go | 122 +- .../arm/networkwatcher/models.go | 1026 +- .../arm/networkwatcher/networkwatchers.go | 1962 +- .../arm/networkwatcher/packetcaptures.go | 926 +- .../arm/networkwatcher/version.go | 120 +- .../arm/notificationhubs/client.go | 106 +- .../arm/notificationhubs/models.go | 790 +- .../arm/notificationhubs/namespaces.go | 2036 +- .../notificationhubs/notificationhubsgroup.go | 1874 +- .../arm/notificationhubs/version.go | 58 +- .../arm/operationalinsights/client.go | 106 +- .../arm/operationalinsights/datasources.go | 760 +- .../arm/operationalinsights/linkedservices.go | 708 +- .../arm/operationalinsights/models.go | 570 +- .../arm/operationalinsights/version.go | 58 +- .../arm/operationalinsights/workspaces.go | 1716 +- .../arm/powerbiembedded/client.go | 228 +- .../arm/powerbiembedded/models.go | 324 +- .../arm/powerbiembedded/version.go | 58 +- .../powerbiembedded/workspacecollections.go | 1478 +- .../arm/powerbiembedded/workspaces.go | 218 +- .../arm/recoveryservices/client.go | 106 +- .../arm/recoveryservices/models.go | 384 +- .../arm/recoveryservices/operations.go | 262 +- .../arm/recoveryservices/vaultextendedinfo.go | 500 +- .../arm/recoveryservices/vaults.go | 878 +- .../arm/recoveryservices/version.go | 58 +- .../recoveryservicesbackup/backupengines.go | 432 +- .../arm/recoveryservicesbackup/backupjobs.go | 278 +- .../backupoperationresults.go | 230 +- .../backupoperationstatuses.go | 230 +- .../recoveryservicesbackup/backuppolicies.go | 276 +- .../backupprotectableitems.go | 282 +- .../backupprotecteditems.go | 282 +- .../backupprotectioncontainers.go | 274 +- .../backupresourcestorageconfigs.go | 348 +- .../backupresourcevaultconfigs.go | 356 +- .../arm/recoveryservicesbackup/backups.go | 234 +- .../backupusagesummaries.go | 232 +- .../arm/recoveryservicesbackup/client.go | 106 +- .../exportjobsoperationresults.go | 228 +- .../itemlevelrecoveryconnections.go | 396 +- .../jobcancellations.go | 222 +- .../arm/recoveryservicesbackup/jobdetails.go | 220 +- .../joboperationresults.go | 226 +- .../arm/recoveryservicesbackup/jobs.go | 222 +- .../arm/recoveryservicesbackup/models.go | 4226 +- .../arm/recoveryservicesbackup/operations.go | 250 +- .../protecteditemoperationresults.go | 234 +- .../protecteditemoperationstatuses.go | 244 +- .../recoveryservicesbackup/protecteditems.go | 538 +- .../protectioncontaineroperationresults.go | 232 +- ...tectioncontainerrefreshoperationresults.go | 228 +- .../protectioncontainers.go | 366 +- .../protectionpolicies.go | 510 +- .../protectionpolicyoperationresults.go | 230 +- .../protectionpolicyoperationstatuses.go | 238 +- .../recoveryservicesbackup/recoverypoints.go | 438 +- .../arm/recoveryservicesbackup/restores.go | 240 +- .../recoveryservicesbackup/securitypins.go | 216 +- .../arm/recoveryservicesbackup/version.go | 58 +- .../azure-sdk-for-go/arm/redis/client.go | 104 +- .../arm/redis/firewallrule.go | 508 +- .../arm/redis/firewallrules.go | 264 +- .../azure-sdk-for-go/arm/redis/models.go | 670 +- .../azure-sdk-for-go/arm/redis/operations.go | 246 +- .../arm/redis/patchschedules.go | 504 +- .../azure-sdk-for-go/arm/redis/redisgroup.go | 1832 +- .../azure-sdk-for-go/arm/redis/version.go | 58 +- .../azure-sdk-for-go/arm/relay/client.go | 106 +- .../arm/relay/hybridconnections.go | 1886 +- .../azure-sdk-for-go/arm/relay/models.go | 660 +- .../azure-sdk-for-go/arm/relay/namespaces.go | 2334 +- .../azure-sdk-for-go/arm/relay/operations.go | 246 +- .../azure-sdk-for-go/arm/relay/version.go | 58 +- .../azure-sdk-for-go/arm/relay/wcfrelays.go | 1858 +- .../resourcehealth/availabilitystatuses.go | 850 +- .../arm/resourcehealth/client.go | 110 +- .../arm/resourcehealth/models.go | 326 +- .../arm/resourcehealth/operations.go | 196 +- .../arm/resourcehealth/version.go | 58 +- .../arm/resources/features/client.go | 114 +- .../arm/resources/features/featuresgroup.go | 706 +- .../arm/resources/features/models.go | 116 +- .../arm/resources/features/version.go | 58 +- .../arm/resources/links/client.go | 114 +- .../arm/resources/links/models.go | 144 +- .../arm/resources/links/resourcelinks.go | 884 +- .../arm/resources/links/version.go | 58 +- .../arm/resources/locks/client.go | 106 +- .../arm/resources/locks/managementlocks.go | 2496 +- .../arm/resources/locks/models.go | 154 +- .../arm/resources/locks/version.go | 58 +- .../arm/resources/policy/assignments.go | 1508 +- .../arm/resources/policy/client.go | 108 +- .../arm/resources/policy/definitions.go | 652 +- .../arm/resources/policy/models.go | 220 +- .../arm/resources/policy/version.go | 58 +- .../arm/resources/resources/client.go | 106 +- .../resources/deploymentoperations.go | 460 +- .../arm/resources/resources/deployments.go | 1534 +- .../arm/resources/resources/groups.go | 1422 +- .../arm/resources/resources/models.go | 914 +- .../arm/resources/resources/providers.go | 676 +- .../arm/resources/resources/resourcesgroup.go | 1796 +- .../arm/resources/resources/tags.go | 774 +- .../arm/resources/resources/version.go | 58 +- .../arm/resources/subscriptions/client.go | 108 +- .../arm/resources/subscriptions/models.go | 264 +- .../subscriptions/subscriptionsgroup.go | 504 +- .../arm/resources/subscriptions/tenants.go | 248 +- .../arm/resources/subscriptions/version.go | 58 +- .../azure-sdk-for-go/arm/scheduler/client.go | 106 +- .../arm/scheduler/jobcollections.go | 1322 +- .../azure-sdk-for-go/arm/scheduler/jobs.go | 1200 +- .../azure-sdk-for-go/arm/scheduler/models.go | 1072 +- .../azure-sdk-for-go/arm/scheduler/version.go | 58 +- .../azure-sdk-for-go/arm/search/adminkeys.go | 392 +- .../azure-sdk-for-go/arm/search/client.go | 106 +- .../azure-sdk-for-go/arm/search/models.go | 400 +- .../azure-sdk-for-go/arm/search/querykeys.go | 544 +- .../azure-sdk-for-go/arm/search/services.go | 892 +- .../azure-sdk-for-go/arm/search/version.go | 58 +- .../arm/servermanagement/client.go | 106 +- .../arm/servermanagement/gateway.go | 1738 +- .../arm/servermanagement/models.go | 826 +- .../arm/servermanagement/node.go | 1152 +- .../arm/servermanagement/powershell.go | 1386 +- .../arm/servermanagement/session.go | 596 +- .../arm/servermanagement/version.go | 58 +- .../arm/service-map/client.go | 106 +- .../arm/service-map/clientgroups.go | 714 +- .../arm/service-map/machinegroups.go | 984 +- .../arm/service-map/machines.go | 1692 +- .../azure-sdk-for-go/arm/service-map/maps.go | 244 +- .../arm/service-map/models.go | 1518 +- .../azure-sdk-for-go/arm/service-map/ports.go | 966 +- .../arm/service-map/processes.go | 956 +- .../arm/service-map/summaries.go | 262 +- .../arm/service-map/version.go | 58 +- .../azure-sdk-for-go/arm/servicebus/client.go | 106 +- .../azure-sdk-for-go/arm/servicebus/models.go | 1142 +- .../arm/servicebus/namespaces.go | 2322 +- .../arm/servicebus/operations.go | 244 +- .../azure-sdk-for-go/arm/servicebus/queues.go | 1856 +- .../arm/servicebus/subscriptions.go | 814 +- .../azure-sdk-for-go/arm/servicebus/topics.go | 1854 +- .../arm/servicebus/version.go | 58 +- .../arm/servicefabric/client.go | 106 +- .../arm/servicefabric/clusters.go | 1144 +- .../arm/servicefabric/clusterversions.go | 268 +- .../arm/servicefabric/models.go | 878 +- .../arm/servicefabric/operations.go | 246 +- .../arm/servicefabric/version.go | 58 +- .../azure-sdk-for-go/arm/sql/capabilities.go | 216 +- .../Azure/azure-sdk-for-go/arm/sql/client.go | 108 +- .../azure-sdk-for-go/arm/sql/databases.go | 3946 +- .../azure-sdk-for-go/arm/sql/elasticpools.go | 1230 +- .../azure-sdk-for-go/arm/sql/firewallrules.go | 662 +- .../Azure/azure-sdk-for-go/arm/sql/models.go | 2360 +- .../azure-sdk-for-go/arm/sql/operations.go | 202 +- .../arm/sql/recommendedelasticpools.go | 780 +- .../Azure/azure-sdk-for-go/arm/sql/servers.go | 1152 +- .../Azure/azure-sdk-for-go/arm/sql/version.go | 58 +- .../azure-sdk-for-go/arm/storage/accounts.go | 1920 +- .../azure-sdk-for-go/arm/storage/client.go | 106 +- .../azure-sdk-for-go/arm/storage/models.go | 904 +- .../azure-sdk-for-go/arm/storage/usage.go | 204 +- .../azure-sdk-for-go/arm/storage/version.go | 58 +- .../arm/storageimportexport/client.go | 488 +- .../arm/storageimportexport/jobs.go | 1474 +- .../arm/storageimportexport/models.go | 662 +- .../arm/storageimportexport/version.go | 58 +- .../arm/trafficmanager/client.go | 106 +- .../arm/trafficmanager/endpoints.go | 660 +- .../arm/trafficmanager/models.go | 240 +- .../arm/trafficmanager/profiles.go | 1016 +- .../arm/trafficmanager/version.go | 58 +- .../Azure/azure-sdk-for-go/arm/web/apps.go | 35214 ++++++++-------- .../arm/web/appservicecertificateorders.go | 2998 +- .../arm/web/appserviceenvironments.go | 6922 +-- .../arm/web/appserviceplans.go | 4474 +- .../azure-sdk-for-go/arm/web/certificates.go | 1050 +- .../Azure/azure-sdk-for-go/arm/web/client.go | 1752 +- .../arm/web/deletedwebapps.go | 450 +- .../Azure/azure-sdk-for-go/arm/web/domains.go | 2302 +- .../Azure/azure-sdk-for-go/arm/web/models.go | 7346 ++-- .../azure-sdk-for-go/arm/web/provider.go | 320 +- .../arm/web/recommendations.go | 1140 +- .../arm/web/topleveldomains.go | 566 +- .../Azure/azure-sdk-for-go/arm/web/version.go | 58 +- .../datalake-store/filesystem/client.go | 102 +- .../filesystem/filesystemgroup.go | 3666 +- .../datalake-store/filesystem/models.go | 484 +- .../datalake-store/filesystem/version.go | 58 +- .../dataplane/keyvault/client.go | 6820 +-- .../dataplane/keyvault/models.go | 1216 +- .../dataplane/keyvault/version.go | 58 +- .../Azure/azure-sdk-for-go/glide.lock | 126 +- .../Azure/azure-sdk-for-go/glide.yaml | 26 +- .../azure-sdk-for-go/management/README.md | 20 +- .../management/affinitygroup/client.go | 262 +- .../management/affinitygroup/entities.go | 160 +- .../azure-sdk-for-go/management/client.go | 304 +- .../azure-sdk-for-go/management/errors.go | 72 +- .../management/errors_test.go | 60 +- .../management/hostedservice/client.go | 250 +- .../management/hostedservice/entities.go | 116 +- .../Azure/azure-sdk-for-go/management/http.go | 380 +- .../management/location/client.go | 60 +- .../management/location/entities.go | 74 +- .../management/networksecuritygroup/client.go | 490 +- .../networksecuritygroup/entities.go | 230 +- .../azure-sdk-for-go/management/operations.go | 184 +- .../management/osimage/client.go | 88 +- .../management/osimage/entities.go | 98 +- .../management/publishSettings.go | 216 +- .../azure-sdk-for-go/management/sql/client.go | 632 +- .../management/sql/entities.go | 248 +- .../management/storageservice/client.go | 216 +- .../management/storageservice/entities.go | 158 +- .../storageservice/entities_test.go | 62 +- .../management/testutils/managementclient.go | 174 +- .../Azure/azure-sdk-for-go/management/util.go | 22 +- .../azure-sdk-for-go/management/version.go | 10 +- .../management/virtualmachine/client.go | 656 +- .../management/virtualmachine/entities.go | 1158 +- .../virtualmachine/entities_test.go | 598 +- .../virtualmachine/resourceextensions.go | 50 +- .../virtualmachine/resourceextensions_test.go | 54 +- .../management/virtualmachinedisk/client.go | 460 +- .../management/virtualmachinedisk/entities.go | 268 +- .../management/virtualmachineimage/client.go | 220 +- .../virtualmachineimage/entities.go | 190 +- .../virtualmachineimage/entities_test.go | 220 +- .../management/virtualnetwork/client.go | 94 +- .../management/virtualnetwork/entities.go | 180 +- .../management/vmutils/configurationset.go | 56 +- .../management/vmutils/datadisks.go | 116 +- .../management/vmutils/deployment.go | 182 +- .../management/vmutils/extensions.go | 180 +- .../management/vmutils/extensions_test.go | 84 +- .../management/vmutils/integration_test.go | 916 +- .../management/vmutils/network.go | 166 +- .../management/vmutils/rolesize.go | 152 +- .../management/vmutils/rolestate.go | 116 +- .../management/vmutils/vmutils.go | 354 +- .../management/vmutils/vmutils_test.go | 880 +- .../Azure/azure-sdk-for-go/rungas.sh | 28 +- .../azure-sdk-for-go/storage/appendblob.go | 140 +- .../storage/appendblob_test.go | 252 +- .../azure-sdk-for-go/storage/authorization.go | 454 +- .../storage/authorization_test.go | 460 +- .../Azure/azure-sdk-for-go/storage/blob.go | 1234 +- .../azure-sdk-for-go/storage/blob_test.go | 1048 +- .../azure-sdk-for-go/storage/blobsasuri.go | 212 +- .../storage/blobsasuri_test.go | 370 +- .../storage/blobserviceclient.go | 190 +- .../azure-sdk-for-go/storage/blockblob.go | 450 +- .../storage/blockblob_test.go | 304 +- .../Azure/azure-sdk-for-go/storage/client.go | 1304 +- .../azure-sdk-for-go/storage/client_test.go | 944 +- .../azure-sdk-for-go/storage/container.go | 900 +- .../storage/container_test.go | 1106 +- .../azure-sdk-for-go/storage/copyblob.go | 446 +- .../azure-sdk-for-go/storage/copyblob_test.go | 342 +- .../azure-sdk-for-go/storage/directory.go | 444 +- .../storage/directory_test.go | 340 +- .../Azure/azure-sdk-for-go/storage/entity.go | 878 +- .../azure-sdk-for-go/storage/entity_test.go | 1098 +- .../Azure/azure-sdk-for-go/storage/file.go | 924 +- .../azure-sdk-for-go/storage/file_test.go | 806 +- .../storage/fileserviceclient.go | 648 +- .../azure-sdk-for-go/storage/leaseblob.go | 374 +- .../storage/leaseblob_test.go | 422 +- .../Azure/azure-sdk-for-go/storage/message.go | 306 +- .../azure-sdk-for-go/storage/message_test.go | 158 +- .../Azure/azure-sdk-for-go/storage/odata.go | 66 +- .../azure-sdk-for-go/storage/pageblob.go | 378 +- .../azure-sdk-for-go/storage/pageblob_test.go | 358 +- .../Azure/azure-sdk-for-go/storage/queue.go | 854 +- .../azure-sdk-for-go/storage/queue_test.go | 722 +- .../storage/queueserviceclient.go | 56 +- .../AppendBlobSuite/TestPutAppendBlob.yaml | 288 +- .../TestPutAppendBlobAppendBlocks.yaml | 676 +- .../Test_allSharedKeys.yaml | 588 +- .../TestBlobSASURICorrectness.yaml | 284 +- .../BlockBlobSuite/TestCreateBlockBlob.yaml | 272 +- .../TestCreateBlockBlobFromReader.yaml | 740 +- ...reateBlockBlobFromReaderWithShortData.yaml | 186 +- .../TestGetBlockList_PutBlockList.yaml | 528 +- .../BlockBlobSuite/TestPutBlock.yaml | 214 +- .../BlockBlobSuite/TestPutEmptyBlockBlob.yaml | 296 +- .../ContainerSuite/TestContainerExists.yaml | 248 +- .../TestCreateContainerDeleteContainer.yaml | 124 +- .../TestCreateContainerIfExists.yaml | 70 +- .../TestCreateContainerIfNotExists.yaml | 124 +- .../TestDeleteContainerIfExists.yaml | 240 +- .../TestListBlobsPagination.yaml | 688 +- .../TestListBlobsTraversal.yaml | 804 +- .../TestListBlobsWithMetadata.yaml | 1164 +- .../TestListContainersPagination.yaml | 762 +- ...tContainerPermissionsOnlySuccessfully.yaml | 194 +- ...stSetContainerPermissionsSuccessfully.yaml | 194 +- ...nerPermissionsWithTimeoutSuccessfully.yaml | 194 +- ...tContainerPermissionsOnlySuccessfully.yaml | 264 +- ...enGetContainerPermissionsSuccessfully.yaml | 264 +- .../CopyBlobSuite/TestAbortBlobCopy.yaml | 534 +- .../CopyBlobSuite/TestBlobCopy.yaml | 660 +- .../TestIncrementalCopyBlobNoTimeout.yaml | 346 +- .../TestIncrementalCopyBlobWithTimeout.yaml | 346 +- .../CopyBlobSuite/TestStartBlobCopy.yaml | 354 +- .../TestAcquireInfiniteLease.yaml | 280 +- ...estAcquireLeaseWithBadProposedLeaseID.yaml | 276 +- ...TestAcquireLeaseWithNoProposedLeaseID.yaml | 276 +- .../TestAcquireLeaseWithProposedLeaseID.yaml | 280 +- .../TestBreakLeaseSuccessful.yaml | 350 +- ...eLeaseNotSuccessfulbadProposedLeaseID.yaml | 354 +- .../TestChangeLeaseSuccessful.yaml | 358 +- ...stReleaseLeaseNotSuccessfulBadLeaseID.yaml | 350 +- .../TestReleaseLeaseSuccessful.yaml | 350 +- .../TestRenewLeaseAgainstNoCurrentLease.yaml | 272 +- .../TestRenewLeaseSuccessful.yaml | 354 +- .../PageBlobSuite/TestGetPageRanges.yaml | 886 +- .../PageBlobSuite/TestPutPageBlob.yaml | 296 +- .../PageBlobSuite/TestPutPagesClear.yaml | 568 +- .../PageBlobSuite/TestPutPagesUpdate.yaml | 808 +- .../StorageBlobSuite/TestBlobExists.yaml | 412 +- .../TestDeleteBlobIfExists.yaml | 248 +- .../TestDeleteBlobWithConditions.yaml | 514 +- .../TestGetAndSetBlobMetadata.yaml | 486 +- .../TestGetBlobProperties.yaml | 350 +- .../StorageBlobSuite/TestGetBlobRange.yaml | 574 +- .../TestMetadataCaseMunging.yaml | 346 +- .../TestPutAppendBlobSpecialChars.yaml | 770 +- .../TestSetBlobProperties.yaml | 390 +- .../TestSetMetadataWithExtraHeaders.yaml | 448 +- .../StorageBlobSuite/TestSnapshotBlob.yaml | 268 +- .../TestSnapshotBlobWithInvalidLease.yaml | 342 +- .../TestSnapshotBlobWithTimeout.yaml | 268 +- .../TestSnapshotBlobWithValidLease.yaml | 346 +- .../TestReturnsStorageServiceError.yaml | 70 +- ...orageServiceError_withoutResponseBody.yaml | 62 +- .../StorageClientSuite/Test_doRetry.yaml | 188 +- .../StorageDirSuite/TestCreateDirectory.yaml | 294 +- .../TestCreateDirectoryIfExists.yaml | 186 +- .../TestCreateDirectoryIfNotExists.yaml | 294 +- .../TestDirectoryMetadata.yaml | 326 +- .../StorageDirSuite/TestListDirsAndFiles.yaml | 422 +- .../TestListZeroDirsAndFiles.yaml | 182 +- .../StorageEntitySuite/TestDelete.yaml | 616 +- .../TestExecuteQueryNextResults.yaml | 898 +- .../StorageEntitySuite/TestGet.yaml | 506 +- .../StorageEntitySuite/TestInsert.yaml | 382 +- .../StorageEntitySuite/TestInsertOrMerge.yaml | 370 +- .../TestInsertOrReplace.yaml | 370 +- .../StorageEntitySuite/TestMerge.yaml | 564 +- .../StorageEntitySuite/TestUpdate.yaml | 564 +- .../Test_InsertAndDeleteEntities.yaml | 600 +- .../Test_InsertAndExecuteQuery.yaml | 456 +- .../Test_InsertAndGetEntities.yaml | 452 +- .../TestCopyFileMissingFile.yaml | 256 +- .../TestCopyFileSameAccountNoMetaData.yaml | 578 +- .../TestCopyFileSameAccountTimeout.yaml | 504 +- .../StorageFileSuite/TestCreateFile.yaml | 480 +- .../StorageFileSuite/TestFileMD5.yaml | 450 +- .../StorageFileSuite/TestFileMetadata.yaml | 346 +- .../StorageFileSuite/TestFileProperties.yaml | 370 +- .../StorageFileSuite/TestFileRanges.yaml | 2020 +- .../StorageFileSuite/TestGetFile.yaml | 630 +- .../TestDeleteMessages.yaml | 302 +- .../TestPutMessage_Peek.yaml | 1894 +- .../TestPutMessage_Peek_Update_Delete.yaml | 2084 +- .../TestCreateQueue_DeleteQueue.yaml | 120 +- .../StorageQueueSuite/TestDeleteMessages.yaml | 302 +- .../StorageQueueSuite/TestGetMessages.yaml | 430 +- .../StorageQueueSuite/TestQueueExists.yaml | 244 +- .../Test_GetMetadata_GetApproximateCount.yaml | 542 +- .../Test_GetPermissionsAllTrueNoTimeout.yaml | 244 +- ...Test_GetPermissionsAllTrueWithTimeout.yaml | 244 +- ..._GetPermissionsAlternateTrueNoTimeout.yaml | 244 +- ...est_SetMetadataGetMetadata_Roundtrips.yaml | 256 +- .../Test_SetPermissionsAllTrueNoTimeout.yaml | 182 +- ...Test_SetPermissionsAllTrueWithTimeout.yaml | 182 +- ..._SetPermissionsAlternateTrueNoTimeout.yaml | 182 +- ...etPermissionsAlternateTrueWithTimeout.yaml | 182 +- .../TestCreateShareDeleteShare.yaml | 124 +- .../TestCreateShareIfExists.yaml | 136 +- .../TestCreateShareIfNotExists.yaml | 124 +- .../TestDeleteShareIfNotExists.yaml | 186 +- .../TestGetAndSetShareMetadata.yaml | 450 +- .../TestGetAndSetShareProperties.yaml | 256 +- .../StorageShareSuite/TestListShares.yaml | 182 +- .../TestMetadataCaseMunging.yaml | 268 +- .../StorageShareSuite/TestShareExists.yaml | 252 +- .../TestGetServiceProperties.yaml | 66 +- .../TestSetServiceProperties.yaml | 132 +- .../recordings/StorageTableSuite/TestGet.yaml | 252 +- .../TestQueryTablesNextResults.yaml | 674 +- .../TestSetPermissionsSuccessfully.yaml | 244 +- .../TestSetPermissionsUnsuccessfully.yaml | 80 +- ...TestSetThenGetPermissionsSuccessfully.yaml | 302 +- .../Test_CreateAndDeleteTable.yaml | 352 +- ...eateTableWithAllResponsePayloadLevels.yaml | 692 +- .../Test_BatchInsertDeleteSameEntity.yaml | 278 +- .../Test_BatchInsertMultipleEntities.yaml | 350 +- ...est_BatchInsertSameEntryMultipleTimes.yaml | 278 +- ...BatchInsertThenDeleteDifferentBatches.yaml | 494 +- ..._BatchInsertThenMergeDifferentBatches.yaml | 424 +- .../Azure/azure-sdk-for-go/storage/share.go | 404 +- .../azure-sdk-for-go/storage/share_test.go | 414 +- .../azure-sdk-for-go/storage/storagepolicy.go | 94 +- .../storage/storageservice.go | 234 +- .../storage/storageservice_test.go | 170 +- .../Azure/azure-sdk-for-go/storage/table.go | 824 +- .../azure-sdk-for-go/storage/table_batch.go | 604 +- .../storage/table_batch_test.go | 432 +- .../azure-sdk-for-go/storage/table_test.go | 418 +- .../storage/tableserviceclient.go | 380 +- .../Azure/azure-sdk-for-go/storage/util.go | 398 +- .../azure-sdk-for-go/storage/util_test.go | 374 +- .../Azure/azure-sdk-for-go/storage/version.go | 10 +- .../github.com/Azure/go-autorest/.gitignore | 58 +- .../github.com/Azure/go-autorest/.travis.yml | 44 +- .../github.com/Azure/go-autorest/CHANGELOG.md | 314 +- vendor/github.com/Azure/go-autorest/LICENSE | 382 +- vendor/github.com/Azure/go-autorest/README.md | 264 +- .../Azure/go-autorest/autorest/adal/README.md | 506 +- .../go-autorest/autorest/adal/cmd/adal.go | 568 +- .../Azure/go-autorest/autorest/adal/config.go | 102 +- .../go-autorest/autorest/adal/config_test.go | 60 +- .../go-autorest/autorest/adal/devicetoken.go | 456 +- .../autorest/adal/devicetoken_test.go | 632 +- .../go-autorest/autorest/adal/persist.go | 118 +- .../go-autorest/autorest/adal/persist_test.go | 314 +- .../Azure/go-autorest/autorest/adal/sender.go | 92 +- .../Azure/go-autorest/autorest/adal/token.go | 816 +- .../go-autorest/autorest/adal/token_test.go | 1198 +- .../go-autorest/autorest/authorization.go | 114 +- .../autorest/authorization_test.go | 274 +- .../Azure/go-autorest/autorest/autorest.go | 230 +- .../go-autorest/autorest/autorest_test.go | 252 +- .../Azure/go-autorest/autorest/azure/async.go | 604 +- .../go-autorest/autorest/azure/async_test.go | 2232 +- .../Azure/go-autorest/autorest/azure/azure.go | 360 +- .../go-autorest/autorest/azure/azure_test.go | 862 +- .../autorest/azure/environments.go | 260 +- .../autorest/azure/environments_test.go | 432 +- .../autorest/azure/example/README.md | 254 +- .../autorest/azure/example/main.go | 516 +- .../Azure/go-autorest/autorest/client.go | 470 +- .../Azure/go-autorest/autorest/client_test.go | 684 +- .../Azure/go-autorest/autorest/date/date.go | 164 +- .../go-autorest/autorest/date/date_test.go | 446 +- .../Azure/go-autorest/autorest/date/time.go | 178 +- .../go-autorest/autorest/date/time_test.go | 526 +- .../go-autorest/autorest/date/timerfc1123.go | 172 +- .../autorest/date/timerfc1123_test.go | 424 +- .../go-autorest/autorest/date/unixtime.go | 218 +- .../autorest/date/unixtime_test.go | 534 +- .../go-autorest/autorest/date/utility.go | 22 +- .../Azure/go-autorest/autorest/error.go | 160 +- .../Azure/go-autorest/autorest/error_test.go | 376 +- .../go-autorest/autorest/mocks/helpers.go | 274 +- .../autorest/mocks/helpers_test.go | 2 +- .../Azure/go-autorest/autorest/mocks/mocks.go | 324 +- .../go-autorest/autorest/mocks/mocks_test.go | 2 +- .../Azure/go-autorest/autorest/preparer.go | 856 +- .../go-autorest/autorest/preparer_test.go | 1504 +- .../Azure/go-autorest/autorest/responder.go | 472 +- .../go-autorest/autorest/responder_test.go | 1302 +- .../Azure/go-autorest/autorest/sender.go | 540 +- .../Azure/go-autorest/autorest/sender_test.go | 1534 +- .../Azure/go-autorest/autorest/to/convert.go | 266 +- .../go-autorest/autorest/to/convert_test.go | 440 +- .../Azure/go-autorest/autorest/utility.go | 356 +- .../go-autorest/autorest/utility_test.go | 736 +- .../autorest/validation/validation.go | 746 +- .../autorest/validation/validation_test.go | 4834 +-- .../Azure/go-autorest/autorest/version.go | 70 +- .../github.com/Azure/go-autorest/glide.lock | 84 +- .../github.com/Azure/go-autorest/glide.yaml | 56 +- vendor/github.com/Sirupsen/logrus/.gitignore | 2 +- vendor/github.com/Sirupsen/logrus/.travis.yml | 16 +- .../github.com/Sirupsen/logrus/CHANGELOG.md | 188 +- vendor/github.com/Sirupsen/logrus/LICENSE | 42 +- vendor/github.com/Sirupsen/logrus/README.md | 952 +- vendor/github.com/Sirupsen/logrus/alt_exit.go | 128 +- .../Sirupsen/logrus/alt_exit_test.go | 148 +- vendor/github.com/Sirupsen/logrus/doc.go | 52 +- vendor/github.com/Sirupsen/logrus/entry.go | 550 +- .../github.com/Sirupsen/logrus/entry_test.go | 154 +- .../Sirupsen/logrus/examples/basic/basic.go | 118 +- .../Sirupsen/logrus/examples/hook/hook.go | 60 +- vendor/github.com/Sirupsen/logrus/exported.go | 386 +- .../github.com/Sirupsen/logrus/formatter.go | 90 +- .../Sirupsen/logrus/formatter_bench_test.go | 202 +- .../github.com/Sirupsen/logrus/hook_test.go | 244 +- vendor/github.com/Sirupsen/logrus/hooks.go | 68 +- .../Sirupsen/logrus/hooks/syslog/README.md | 76 +- .../Sirupsen/logrus/hooks/syslog/syslog.go | 108 +- .../logrus/hooks/syslog/syslog_test.go | 52 +- .../Sirupsen/logrus/hooks/test/test.go | 134 +- .../Sirupsen/logrus/hooks/test/test_test.go | 78 +- .../Sirupsen/logrus/json_formatter.go | 148 +- .../Sirupsen/logrus/json_formatter_test.go | 398 +- vendor/github.com/Sirupsen/logrus/logger.go | 616 +- .../Sirupsen/logrus/logger_bench_test.go | 122 +- vendor/github.com/Sirupsen/logrus/logrus.go | 286 +- .../github.com/Sirupsen/logrus/logrus_test.go | 772 +- .../Sirupsen/logrus/terminal_appengine.go | 20 +- .../Sirupsen/logrus/terminal_bsd.go | 20 +- .../Sirupsen/logrus/terminal_linux.go | 28 +- .../Sirupsen/logrus/terminal_notwindows.go | 56 +- .../Sirupsen/logrus/terminal_solaris.go | 42 +- .../Sirupsen/logrus/terminal_windows.go | 66 +- .../Sirupsen/logrus/text_formatter.go | 378 +- .../Sirupsen/logrus/text_formatter_test.go | 174 +- vendor/github.com/Sirupsen/logrus/writer.go | 124 +- vendor/github.com/dgrijalva/jwt-go/.gitignore | 8 +- .../github.com/dgrijalva/jwt-go/.travis.yml | 26 +- vendor/github.com/dgrijalva/jwt-go/LICENSE | 16 +- .../dgrijalva/jwt-go/MIGRATION_GUIDE.md | 194 +- vendor/github.com/dgrijalva/jwt-go/README.md | 170 +- .../dgrijalva/jwt-go/VERSION_HISTORY.md | 208 +- vendor/github.com/dgrijalva/jwt-go/claims.go | 268 +- .../dgrijalva/jwt-go/cmd/jwt/README.md | 26 +- .../dgrijalva/jwt-go/cmd/jwt/app.go | 564 +- .../dgrijalva/jwt-go/cmd/jwt/args.go | 46 +- vendor/github.com/dgrijalva/jwt-go/doc.go | 8 +- vendor/github.com/dgrijalva/jwt-go/ecdsa.go | 294 +- .../github.com/dgrijalva/jwt-go/ecdsa_test.go | 200 +- .../dgrijalva/jwt-go/ecdsa_utils.go | 134 +- vendor/github.com/dgrijalva/jwt-go/errors.go | 118 +- .../dgrijalva/jwt-go/example_test.go | 228 +- vendor/github.com/dgrijalva/jwt-go/hmac.go | 188 +- .../dgrijalva/jwt-go/hmac_example_test.go | 132 +- .../github.com/dgrijalva/jwt-go/hmac_test.go | 182 +- .../dgrijalva/jwt-go/http_example_test.go | 432 +- .../github.com/dgrijalva/jwt-go/map_claims.go | 188 +- vendor/github.com/dgrijalva/jwt-go/none.go | 104 +- .../github.com/dgrijalva/jwt-go/none_test.go | 144 +- vendor/github.com/dgrijalva/jwt-go/parser.go | 262 +- .../dgrijalva/jwt-go/parser_test.go | 522 +- .../dgrijalva/jwt-go/request/doc.go | 14 +- .../dgrijalva/jwt-go/request/extractor.go | 162 +- .../jwt-go/request/extractor_example_test.go | 64 +- .../jwt-go/request/extractor_test.go | 182 +- .../dgrijalva/jwt-go/request/oauth2.go | 56 +- .../dgrijalva/jwt-go/request/request.go | 48 +- .../dgrijalva/jwt-go/request/request_test.go | 206 +- vendor/github.com/dgrijalva/jwt-go/rsa.go | 200 +- vendor/github.com/dgrijalva/jwt-go/rsa_pss.go | 252 +- .../dgrijalva/jwt-go/rsa_pss_test.go | 192 +- .../github.com/dgrijalva/jwt-go/rsa_test.go | 352 +- .../github.com/dgrijalva/jwt-go/rsa_utils.go | 138 +- .../dgrijalva/jwt-go/signing_method.go | 70 +- .../dgrijalva/jwt-go/test/ec256-private.pem | 10 +- .../dgrijalva/jwt-go/test/ec256-public.pem | 8 +- .../dgrijalva/jwt-go/test/ec384-private.pem | 12 +- .../dgrijalva/jwt-go/test/ec384-public.pem | 10 +- .../dgrijalva/jwt-go/test/ec512-private.pem | 14 +- .../dgrijalva/jwt-go/test/ec512-public.pem | 12 +- .../dgrijalva/jwt-go/test/helpers.go | 84 +- .../dgrijalva/jwt-go/test/sample_key | 54 +- .../dgrijalva/jwt-go/test/sample_key.pub | 18 +- vendor/github.com/dgrijalva/jwt-go/token.go | 216 +- vendor/github.com/ghodss/yaml/.gitignore | 40 +- vendor/github.com/ghodss/yaml/.travis.yml | 14 +- vendor/github.com/ghodss/yaml/LICENSE | 100 +- vendor/github.com/ghodss/yaml/README.md | 242 +- vendor/github.com/ghodss/yaml/fields.go | 1002 +- vendor/github.com/ghodss/yaml/yaml.go | 554 +- vendor/github.com/ghodss/yaml/yaml_test.go | 574 +- .../inconshreveable/mousetrap/LICENSE | 26 +- .../inconshreveable/mousetrap/README.md | 46 +- .../inconshreveable/mousetrap/trap_others.go | 30 +- .../inconshreveable/mousetrap/trap_windows.go | 196 +- .../mousetrap/trap_windows_1.4.go | 92 +- .../leonelquinteros/gotext/.gitignore | 29 + .../leonelquinteros/gotext/.travis.yml | 7 + .../leonelquinteros/gotext/Godeps/Godeps.json | 22 + .../leonelquinteros/gotext/Godeps/Readme | 5 + .../github.com/leonelquinteros/gotext/LICENSE | 21 + .../leonelquinteros/gotext/README.md | 307 + .../leonelquinteros/gotext/gotext.go | 151 + .../leonelquinteros/gotext/gotext_test.go | 199 + .../leonelquinteros/gotext/locale.go | 176 + .../leonelquinteros/gotext/locale_test.go | 310 + .../github.com/leonelquinteros/gotext/po.go | 450 + .../leonelquinteros/gotext/po_test.go | 424 + .../vendor/github.com/mattn/anko/ast/doc.go | 2 + .../vendor/github.com/mattn/anko/ast/expr.go | 201 + .../vendor/github.com/mattn/anko/ast/pos.go | 28 + .../vendor/github.com/mattn/anko/ast/stmt.go | 127 + .../vendor/github.com/mattn/anko/ast/token.go | 7 + .../github.com/mattn/anko/parser/Makefile | 4 + .../github.com/mattn/anko/parser/lexer.go | 530 + .../github.com/mattn/anko/parser/parser.go | 1997 + .../github.com/mattn/anko/parser/parser.go.y | 705 + .../vendor/github.com/mattn/anko/vm/doc.go | 2 + .../vendor/github.com/mattn/anko/vm/env.go | 258 + .../vendor/github.com/mattn/anko/vm/vm.go | 1504 + vendor/github.com/mattn/anko/.travis.yml | 10 + vendor/github.com/mattn/anko/README.md | 92 + vendor/github.com/mattn/anko/TODO | 0 .../mattn/anko/_example/embed/main.go | 24 + .../anko/_example/scripts/anonymous-call.ank | 9 + .../mattn/anko/_example/scripts/chan.ank | 13 + .../mattn/anko/_example/scripts/env.ank | 9 + .../mattn/anko/_example/scripts/example.ank | 70 + .../mattn/anko/_example/scripts/exec.ank | 7 + .../mattn/anko/_example/scripts/fib-for.ank | 15 + .../anko/_example/scripts/fib-recursion.ank | 14 + .../_example/scripts/for-break-continue.ank | 12 + .../mattn/anko/_example/scripts/http.ank | 8 + .../mattn/anko/_example/scripts/module.ank | 10 + .../mattn/anko/_example/scripts/regexp.ank | 8 + .../mattn/anko/_example/scripts/server.ank | 8 + .../mattn/anko/_example/scripts/signal.ank | 14 + .../mattn/anko/_example/scripts/slice.ank | 10 + .../mattn/anko/_example/scripts/socket.ank | 26 + .../mattn/anko/_example/scripts/term.ank | 60 + .../mattn/anko/_example/scripts/try-catch.ank | 19 + .../mattn/anko/_example/scripts/url.ank | 7 + vendor/github.com/mattn/anko/anko.go | 238 + vendor/github.com/mattn/anko/anko.png | Bin 0 -> 363250 bytes vendor/github.com/mattn/anko/ast/doc.go | 2 + vendor/github.com/mattn/anko/ast/expr.go | 201 + vendor/github.com/mattn/anko/ast/pos.go | 28 + vendor/github.com/mattn/anko/ast/stmt.go | 127 + vendor/github.com/mattn/anko/ast/token.go | 7 + vendor/github.com/mattn/anko/builtins/core.go | 217 + .../mattn/anko/builtins/encoding/json/json.go | 15 + .../mattn/anko/builtins/errors/errors.go | 13 + .../mattn/anko/builtins/flag/flag.go | 48 + .../github.com/mattn/anko/builtins/fmt/fmt.go | 32 + .../daviddengcn/go-colortext/colortext.go | 53 + .../go-colortext/colortext_appengine.go | 13 + .../github.com/mattn/anko/builtins/io/io.go | 30 + .../mattn/anko/builtins/io/ioutil/ioutil.go | 17 + .../mattn/anko/builtins/math/math.go | 74 + .../mattn/anko/builtins/math/rand/rand.go | 26 + .../mattn/anko/builtins/net/http/http.go | 40 + .../anko/builtins/net/http/http_appengine.go | 13 + .../github.com/mattn/anko/builtins/net/net.go | 76 + .../mattn/anko/builtins/net/net_appengine.go | 13 + .../mattn/anko/builtins/net/url/url.go | 16 + .../anko/builtins/net/url/url_appengine.go | 13 + .../mattn/anko/builtins/os/exec/exec.go | 16 + .../github.com/mattn/anko/builtins/os/os.go | 102 + .../mattn/anko/builtins/os/os_appengine.go | 10 + .../mattn/anko/builtins/os/os_nonappengine.go | 13 + .../mattn/anko/builtins/os/signal/signal.go | 18 + .../anko/builtins/path/filepath/filepath.go | 32 + .../mattn/anko/builtins/path/path.go | 22 + .../mattn/anko/builtins/regexp/regexp.go | 21 + .../mattn/anko/builtins/runtime/runtime.go | 45 + .../mattn/anko/builtins/sort/sort.go | 43 + .../mattn/anko/builtins/strings/strings.go | 56 + .../mattn/anko/builtins/time/time.go | 28 + .../mattn/anko/misc/vim/ftdetect/ank.vim | 1 + .../anko/misc/vim/ftplugin/anko/comment.vim | 11 + .../anko/misc/vim/ftplugin/anko/play.vim | 15 + .../mattn/anko/misc/vim/syntax/anko.vim | 100 + vendor/github.com/mattn/anko/parser/Makefile | 4 + vendor/github.com/mattn/anko/parser/lexer.go | 530 + vendor/github.com/mattn/anko/parser/parser.go | 1997 + .../github.com/mattn/anko/parser/parser.go.y | 705 + vendor/github.com/mattn/anko/t/01-let.ank | 31 + .../github.com/mattn/anko/t/02-toString.ank | 7 + vendor/github.com/mattn/anko/t/03-op.ank | 68 + vendor/github.com/mattn/anko/t/04-func.ank | 23 + vendor/github.com/mattn/anko/t/05-len.ank | 5 + vendor/github.com/mattn/anko/t/06-for.ank | 74 + vendor/github.com/mattn/anko/t/07-switch.ank | 39 + vendor/github.com/mattn/anko/t/08-if.ank | 15 + vendor/github.com/mattn/anko/t/09-toBytes.ank | 11 + vendor/github.com/mattn/anko/t/10-toRunes.ank | 11 + vendor/github.com/mattn/anko/t/lib/tester.ank | 43 + vendor/github.com/mattn/anko/t/test.bat | 13 + vendor/github.com/mattn/anko/t/test.sh | 8 + .../github.com/mattn/anko/tool/makebuiltin.go | 128 + vendor/github.com/mattn/anko/vm/doc.go | 2 + vendor/github.com/mattn/anko/vm/env.go | 258 + vendor/github.com/mattn/anko/vm/env_test.go | 202 + .../github.com/mattn/anko/vm/example_test.go | 48 + vendor/github.com/mattn/anko/vm/vm.go | 1504 + vendor/github.com/mattn/anko/vm/vm_test.go | 54 + .../github.com/mitchellh/go-homedir/LICENSE | 42 +- .../github.com/mitchellh/go-homedir/README.md | 28 +- .../mitchellh/go-homedir/homedir.go | 274 +- .../mitchellh/go-homedir/homedir_test.go | 224 +- vendor/github.com/onsi/gomega/.gitignore | 10 +- vendor/github.com/onsi/gomega/.travis.yml | 22 +- vendor/github.com/onsi/gomega/CHANGELOG.md | 140 +- vendor/github.com/onsi/gomega/LICENSE | 40 +- vendor/github.com/onsi/gomega/README.md | 42 +- .../github.com/onsi/gomega/format/format.go | 768 +- .../onsi/gomega/format/format_suite_test.go | 26 +- .../onsi/gomega/format/format_test.go | 1180 +- .../github.com/onsi/gomega/gbytes/buffer.go | 458 +- .../onsi/gomega/gbytes/buffer_test.go | 316 +- .../onsi/gomega/gbytes/gbuffer_suite_test.go | 26 +- .../onsi/gomega/gbytes/say_matcher.go | 210 +- .../onsi/gomega/gbytes/say_matcher_test.go | 326 +- .../gomega/gexec/_fixture/firefly/main.go | 72 +- vendor/github.com/onsi/gomega/gexec/build.go | 198 +- .../onsi/gomega/gexec/build_test.go | 118 +- .../onsi/gomega/gexec/exit_matcher.go | 176 +- .../onsi/gomega/gexec/exit_matcher_test.go | 226 +- .../onsi/gomega/gexec/gexec_suite_test.go | 52 +- .../onsi/gomega/gexec/prefixed_writer.go | 106 +- .../onsi/gomega/gexec/prefixed_writer_test.go | 86 +- .../github.com/onsi/gomega/gexec/session.go | 610 +- .../onsi/gomega/gexec/session_test.go | 702 +- .../github.com/onsi/gomega/ghttp/handlers.go | 626 +- .../onsi/gomega/ghttp/protobuf/protobuf.go | 6 +- .../ghttp/protobuf/simple_message.pb.go | 110 +- .../ghttp/protobuf/simple_message.proto | 18 +- .../onsi/gomega/ghttp/test_server.go | 762 +- .../gomega/ghttp/test_server_suite_test.go | 26 +- .../onsi/gomega/ghttp/test_server_test.go | 2178 +- vendor/github.com/onsi/gomega/gomega_dsl.go | 670 +- .../onsi/gomega/gstruct/elements.go | 290 +- .../onsi/gomega/gstruct/elements_test.go | 288 +- .../gomega/gstruct/errors/nested_types.go | 144 +- .../github.com/onsi/gomega/gstruct/fields.go | 282 +- .../onsi/gomega/gstruct/fields_test.go | 152 +- .../gstruct/gstruct_tests_suite_test.go | 26 +- .../github.com/onsi/gomega/gstruct/ignore.go | 74 +- .../onsi/gomega/gstruct/ignore_test.go | 46 +- .../github.com/onsi/gomega/gstruct/pointer.go | 112 +- .../onsi/gomega/gstruct/pointer_test.go | 66 +- .../github.com/onsi/gomega/gstruct/types.go | 30 +- .../gomega/internal/assertion/assertion.go | 196 +- .../assertion/assertion_suite_test.go | 26 +- .../internal/assertion/assertion_test.go | 504 +- .../asyncassertion/async_assertion.go | 378 +- .../async_assertion_suite_test.go | 26 +- .../asyncassertion/async_assertion_test.go | 690 +- .../internal/fakematcher/fake_matcher.go | 46 +- .../internal/oraclematcher/oracle_matcher.go | 50 +- .../testingtsupport/testing_t_support.go | 80 +- .../testingtsupport/testing_t_support_test.go | 24 +- vendor/github.com/onsi/gomega/matchers.go | 836 +- vendor/github.com/onsi/gomega/matchers/and.go | 128 +- .../onsi/gomega/matchers/and_test.go | 206 +- .../matchers/assignable_to_type_of_matcher.go | 62 +- .../assignable_to_type_of_matcher_test.go | 60 +- .../onsi/gomega/matchers/be_a_directory.go | 108 +- .../gomega/matchers/be_a_directory_test.go | 80 +- .../onsi/gomega/matchers/be_a_regular_file.go | 108 +- .../gomega/matchers/be_a_regular_file_test.go | 80 +- .../gomega/matchers/be_an_existing_file.go | 76 +- .../matchers/be_an_existing_file_test.go | 80 +- .../onsi/gomega/matchers/be_closed_matcher.go | 90 +- .../gomega/matchers/be_closed_matcher_test.go | 140 +- .../onsi/gomega/matchers/be_empty_matcher.go | 52 +- .../gomega/matchers/be_empty_matcher_test.go | 104 +- .../matchers/be_equivalent_to_matcher.go | 66 +- .../matchers/be_equivalent_to_matcher_test.go | 100 +- .../onsi/gomega/matchers/be_false_matcher.go | 50 +- .../gomega/matchers/be_false_matcher_test.go | 40 +- .../onsi/gomega/matchers/be_identical_to.go | 74 +- .../gomega/matchers/be_identical_to_test.go | 122 +- .../onsi/gomega/matchers/be_nil_matcher.go | 36 +- .../gomega/matchers/be_nil_matcher_test.go | 56 +- .../gomega/matchers/be_numerically_matcher.go | 240 +- .../matchers/be_numerically_matcher_test.go | 296 +- .../onsi/gomega/matchers/be_sent_matcher.go | 142 +- .../gomega/matchers/be_sent_matcher_test.go | 212 +- .../gomega/matchers/be_temporally_matcher.go | 130 +- .../matchers/be_temporally_matcher_test.go | 196 +- .../onsi/gomega/matchers/be_true_matcher.go | 50 +- .../gomega/matchers/be_true_matcher_test.go | 40 +- .../onsi/gomega/matchers/be_zero_matcher.go | 54 +- .../gomega/matchers/be_zero_matcher_test.go | 60 +- .../onsi/gomega/matchers/consist_of.go | 160 +- .../onsi/gomega/matchers/consist_of_test.go | 150 +- .../matchers/contain_element_matcher.go | 112 +- .../matchers/contain_element_matcher_test.go | 152 +- .../matchers/contain_substring_matcher.go | 74 +- .../contain_substring_matcher_test.go | 72 +- .../onsi/gomega/matchers/equal_matcher.go | 66 +- .../gomega/matchers/equal_matcher_test.go | 156 +- .../onsi/gomega/matchers/have_cap_matcher.go | 56 +- .../gomega/matchers/have_cap_matcher_test.go | 100 +- .../onsi/gomega/matchers/have_key_matcher.go | 106 +- .../gomega/matchers/have_key_matcher_test.go | 146 +- .../matchers/have_key_with_value_matcher.go | 146 +- .../have_key_with_value_matcher_test.go | 164 +- .../onsi/gomega/matchers/have_len_matcher.go | 54 +- .../gomega/matchers/have_len_matcher_test.go | 106 +- .../gomega/matchers/have_occurred_matcher.go | 66 +- .../matchers/have_occurred_matcher_test.go | 116 +- .../gomega/matchers/have_prefix_matcher.go | 70 +- .../matchers/have_prefix_matcher_test.go | 72 +- .../gomega/matchers/have_suffix_matcher.go | 70 +- .../matchers/have_suffix_matcher_test.go | 72 +- .../gomega/matchers/match_error_matcher.go | 100 +- .../matchers/match_error_matcher_test.go | 186 +- .../gomega/matchers/match_json_matcher.go | 128 +- .../matchers/match_json_matcher_test.go | 146 +- .../gomega/matchers/match_regexp_matcher.go | 84 +- .../matchers/match_regexp_matcher_test.go | 88 +- .../gomega/matchers/match_yaml_matcher.go | 148 +- .../matchers/match_yaml_matcher_test.go | 188 +- .../matchers/matcher_tests_suite_test.go | 60 +- vendor/github.com/onsi/gomega/matchers/not.go | 60 +- .../onsi/gomega/matchers/not_test.go | 114 +- vendor/github.com/onsi/gomega/matchers/or.go | 134 +- .../onsi/gomega/matchers/or_test.go | 170 +- .../onsi/gomega/matchers/panic_matcher.go | 92 +- .../gomega/matchers/panic_matcher_test.go | 90 +- .../onsi/gomega/matchers/receive_matcher.go | 252 +- .../gomega/matchers/receive_matcher_test.go | 560 +- .../onsi/gomega/matchers/succeed_matcher.go | 66 +- .../gomega/matchers/succeed_matcher_test.go | 124 +- .../matchers/support/goraph/MIT.LICENSE | 40 +- .../goraph/bipartitegraph/bipartitegraph.go | 82 +- .../bipartitegraph/bipartitegraphmatching.go | 322 +- .../matchers/support/goraph/edge/edge.go | 122 +- .../matchers/support/goraph/node/node.go | 14 +- .../matchers/support/goraph/util/util.go | 14 +- .../onsi/gomega/matchers/type_support.go | 352 +- .../onsi/gomega/matchers/with_transform.go | 144 +- .../gomega/matchers/with_transform_test.go | 204 +- vendor/github.com/onsi/gomega/types/types.go | 34 +- .../github.com/prometheus/common/.travis.yml | 12 +- .../prometheus/common/CONTRIBUTING.md | 36 +- vendor/github.com/prometheus/common/LICENSE | 402 +- .../prometheus/common/MAINTAINERS.md | 2 +- vendor/github.com/prometheus/common/NOTICE | 10 +- vendor/github.com/prometheus/common/README.md | 24 +- .../prometheus/common/config/config.go | 60 +- .../testdata/tls_config.cert_no_key.bad.yml | 2 +- .../testdata/tls_config.insecure.good.yml | 2 +- .../testdata/tls_config.invalid_field.bad.yml | 2 +- .../testdata/tls_config.key_no_cert.bad.yml | 2 +- .../prometheus/common/config/tls_config.go | 158 +- .../common/config/tls_config_test.go | 184 +- .../prometheus/common/expfmt/bench_test.go | 334 +- .../prometheus/common/expfmt/decode.go | 858 +- .../prometheus/common/expfmt/decode_test.go | 870 +- .../prometheus/common/expfmt/encode.go | 176 +- .../prometheus/common/expfmt/expfmt.go | 76 +- .../prometheus/common/expfmt/fuzz.go | 72 +- .../expfmt/fuzz/corpus/from_test_parse_0 | 4 +- .../expfmt/fuzz/corpus/from_test_parse_1 | 12 +- .../expfmt/fuzz/corpus/from_test_parse_2 | 24 +- .../expfmt/fuzz/corpus/from_test_parse_3 | 44 +- .../expfmt/fuzz/corpus/from_test_parse_4 | 20 +- .../fuzz/corpus/from_test_parse_error_10 | 2 +- .../fuzz/corpus/from_test_parse_error_11 | 2 +- .../fuzz/corpus/from_test_parse_error_12 | 6 +- .../fuzz/corpus/from_test_parse_error_13 | 6 +- .../fuzz/corpus/from_test_parse_error_14 | 6 +- .../fuzz/corpus/from_test_parse_error_15 | 4 +- .../fuzz/corpus/from_test_parse_error_16 | 4 +- .../fuzz/corpus/from_test_parse_error_19 | 6 +- .../fuzz/corpus/from_test_parse_error_2 | 6 +- .../fuzz/corpus/from_test_parse_error_7 | 6 +- .../fuzz/corpus/from_test_parse_error_9 | 2 +- .../common/expfmt/fuzz/corpus/minimal | 2 +- .../prometheus/common/expfmt/testdata/json2 | 92 +- .../common/expfmt/testdata/json2_bad | 92 +- .../prometheus/common/expfmt/testdata/text | 644 +- .../prometheus/common/expfmt/text_create.go | 606 +- .../common/expfmt/text_create_test.go | 886 +- .../prometheus/common/expfmt/text_parse.go | 1506 +- .../common/expfmt/text_parse_test.go | 1176 +- .../bitbucket.org/ww/goautoneg/README.txt | 134 +- .../bitbucket.org/ww/goautoneg/autoneg.go | 324 +- .../ww/goautoneg/autoneg_test.go | 66 +- .../common/log/eventlog_formatter.go | 178 +- .../github.com/prometheus/common/log/log.go | 730 +- .../prometheus/common/log/log_test.go | 78 +- .../prometheus/common/log/syslog_formatter.go | 252 +- .../common/log/syslog_formatter_test.go | 104 +- .../prometheus/common/model/alert.go | 272 +- .../prometheus/common/model/alert_test.go | 236 +- .../prometheus/common/model/fingerprinting.go | 210 +- .../github.com/prometheus/common/model/fnv.go | 84 +- .../prometheus/common/model/labels.go | 420 +- .../prometheus/common/model/labels_test.go | 280 +- .../prometheus/common/model/labelset.go | 338 +- .../prometheus/common/model/metric.go | 206 +- .../prometheus/common/model/metric_test.go | 264 +- .../prometheus/common/model/model.go | 32 +- .../prometheus/common/model/signature.go | 288 +- .../prometheus/common/model/signature_test.go | 628 +- .../prometheus/common/model/silence.go | 212 +- .../prometheus/common/model/silence_test.go | 456 +- .../prometheus/common/model/time.go | 498 +- .../prometheus/common/model/time_test.go | 258 +- .../prometheus/common/model/value.go | 832 +- .../prometheus/common/model/value_test.go | 936 +- .../prometheus/common/route/route.go | 200 +- .../prometheus/common/route/route_test.go | 88 +- .../prometheus/common/version/info.go | 178 +- vendor/github.com/satori/go.uuid/.travis.yml | 30 +- vendor/github.com/satori/go.uuid/LICENSE | 40 +- vendor/github.com/satori/go.uuid/README.md | 130 +- .../satori/go.uuid/benchmarks_test.go | 242 +- vendor/github.com/satori/go.uuid/uuid.go | 976 +- vendor/github.com/satori/go.uuid/uuid_test.go | 1266 +- vendor/github.com/satori/uuid/.travis.yml | 44 +- vendor/github.com/satori/uuid/LICENSE | 40 +- vendor/github.com/satori/uuid/README.md | 130 +- .../github.com/satori/uuid/benchmarks_test.go | 246 +- vendor/github.com/satori/uuid/uuid.go | 962 +- vendor/github.com/satori/uuid/uuid_test.go | 1266 +- vendor/github.com/spf13/cobra/.gitignore | 72 +- vendor/github.com/spf13/cobra/.mailmap | 6 +- vendor/github.com/spf13/cobra/.travis.yml | 42 +- vendor/github.com/spf13/cobra/LICENSE.txt | 348 +- vendor/github.com/spf13/cobra/README.md | 1774 +- .../spf13/cobra/bash_completions.go | 1290 +- .../spf13/cobra/bash_completions.md | 412 +- .../spf13/cobra/bash_completions_test.go | 360 +- vendor/github.com/spf13/cobra/cobra.go | 362 +- .../github.com/spf13/cobra/cobra/cmd/add.go | 344 +- .../spf13/cobra/cobra/cmd/add_test.go | 200 +- .../spf13/cobra/cobra/cmd/golden_test.go | 154 +- .../spf13/cobra/cobra/cmd/helpers.go | 280 +- .../github.com/spf13/cobra/cobra/cmd/init.go | 468 +- .../spf13/cobra/cobra/cmd/init_test.go | 148 +- .../spf13/cobra/cobra/cmd/license_agpl.go | 1368 +- .../spf13/cobra/cobra/cmd/license_apache_2.go | 474 +- .../cobra/cobra/cmd/license_bsd_clause_2.go | 144 +- .../cobra/cobra/cmd/license_bsd_clause_3.go | 158 +- .../spf13/cobra/cobra/cmd/license_gpl_2.go | 754 +- .../spf13/cobra/cobra/cmd/license_gpl_3.go | 1424 +- .../spf13/cobra/cobra/cmd/license_lgpl.go | 374 +- .../spf13/cobra/cobra/cmd/license_mit.go | 126 +- .../spf13/cobra/cobra/cmd/licenses.go | 228 +- .../spf13/cobra/cobra/cmd/project.go | 390 +- .../spf13/cobra/cobra/cmd/project_test.go | 48 +- .../github.com/spf13/cobra/cobra/cmd/root.go | 168 +- .../cobra/cobra/cmd/testdata/LICENSE.golden | 404 +- .../cobra/cobra/cmd/testdata/main.go.golden | 40 +- .../cobra/cobra/cmd/testdata/root.go.golden | 176 +- .../cobra/cobra/cmd/testdata/test.go.golden | 98 +- vendor/github.com/spf13/cobra/cobra/main.go | 40 +- vendor/github.com/spf13/cobra/cobra_test.go | 2346 +- vendor/github.com/spf13/cobra/command.go | 2578 +- .../github.com/spf13/cobra/command_notwin.go | 10 +- vendor/github.com/spf13/cobra/command_test.go | 600 +- vendor/github.com/spf13/cobra/command_win.go | 52 +- vendor/github.com/spf13/cobra/doc/cmd_test.go | 290 +- vendor/github.com/spf13/cobra/doc/man_docs.go | 466 +- vendor/github.com/spf13/cobra/doc/man_docs.md | 62 +- .../spf13/cobra/doc/man_docs_test.go | 432 +- .../spf13/cobra/doc/man_examples_test.go | 70 +- vendor/github.com/spf13/cobra/doc/md_docs.go | 312 +- vendor/github.com/spf13/cobra/doc/md_docs.md | 230 +- .../spf13/cobra/doc/md_docs_test.go | 248 +- vendor/github.com/spf13/cobra/doc/util.go | 102 +- .../github.com/spf13/cobra/doc/yaml_docs.go | 332 +- .../github.com/spf13/cobra/doc/yaml_docs.md | 224 +- .../spf13/cobra/doc/yaml_docs_test.go | 250 +- vendor/github.com/spf13/pflag/.gitignore | 4 +- vendor/github.com/spf13/pflag/.travis.yml | 42 +- vendor/github.com/spf13/pflag/LICENSE | 56 +- vendor/github.com/spf13/pflag/README.md | 592 +- vendor/github.com/spf13/pflag/bool.go | 188 +- vendor/github.com/spf13/pflag/bool_slice.go | 294 +- .../github.com/spf13/pflag/bool_slice_test.go | 430 +- vendor/github.com/spf13/pflag/bool_test.go | 358 +- vendor/github.com/spf13/pflag/count.go | 192 +- vendor/github.com/spf13/pflag/count_test.go | 104 +- vendor/github.com/spf13/pflag/duration.go | 172 +- vendor/github.com/spf13/pflag/example_test.go | 72 +- vendor/github.com/spf13/pflag/export_test.go | 58 +- vendor/github.com/spf13/pflag/flag.go | 2256 +- vendor/github.com/spf13/pflag/flag_test.go | 2170 +- vendor/github.com/spf13/pflag/float32.go | 176 +- vendor/github.com/spf13/pflag/float64.go | 168 +- vendor/github.com/spf13/pflag/golangflag.go | 202 +- .../github.com/spf13/pflag/golangflag_test.go | 78 +- vendor/github.com/spf13/pflag/int.go | 168 +- vendor/github.com/spf13/pflag/int32.go | 176 +- vendor/github.com/spf13/pflag/int64.go | 168 +- vendor/github.com/spf13/pflag/int8.go | 176 +- vendor/github.com/spf13/pflag/int_slice.go | 256 +- .../github.com/spf13/pflag/int_slice_test.go | 330 +- vendor/github.com/spf13/pflag/ip.go | 188 +- vendor/github.com/spf13/pflag/ip_slice.go | 296 +- .../github.com/spf13/pflag/ip_slice_test.go | 444 +- vendor/github.com/spf13/pflag/ip_test.go | 126 +- vendor/github.com/spf13/pflag/ipmask.go | 244 +- vendor/github.com/spf13/pflag/ipnet.go | 196 +- vendor/github.com/spf13/pflag/ipnet_test.go | 140 +- vendor/github.com/spf13/pflag/string.go | 160 +- vendor/github.com/spf13/pflag/string_array.go | 206 +- .../spf13/pflag/string_array_test.go | 466 +- vendor/github.com/spf13/pflag/string_slice.go | 258 +- .../spf13/pflag/string_slice_test.go | 506 +- vendor/github.com/spf13/pflag/uint.go | 176 +- vendor/github.com/spf13/pflag/uint16.go | 176 +- vendor/github.com/spf13/pflag/uint32.go | 176 +- vendor/github.com/spf13/pflag/uint64.go | 176 +- vendor/github.com/spf13/pflag/uint8.go | 176 +- vendor/github.com/spf13/pflag/uint_slice.go | 252 +- .../github.com/spf13/pflag/uint_slice_test.go | 322 +- vendor/github.com/spf13/pflag/verify/all.sh | 138 +- vendor/github.com/spf13/pflag/verify/gofmt.sh | 38 +- .../github.com/spf13/pflag/verify/golint.sh | 30 +- vendor/gopkg.in/yaml.v2/.travis.yml | 18 +- vendor/gopkg.in/yaml.v2/LICENSE | 26 +- vendor/gopkg.in/yaml.v2/LICENSE.libyaml | 62 +- vendor/gopkg.in/yaml.v2/README.md | 262 +- vendor/gopkg.in/yaml.v2/apic.go | 1484 +- vendor/gopkg.in/yaml.v2/decode.go | 1364 +- vendor/gopkg.in/yaml.v2/decode_test.go | 1996 +- vendor/gopkg.in/yaml.v2/emitterc.go | 3368 +- vendor/gopkg.in/yaml.v2/encode.go | 612 +- vendor/gopkg.in/yaml.v2/encode_test.go | 1002 +- vendor/gopkg.in/yaml.v2/parserc.go | 2190 +- vendor/gopkg.in/yaml.v2/readerc.go | 788 +- vendor/gopkg.in/yaml.v2/resolve.go | 416 +- vendor/gopkg.in/yaml.v2/scannerc.go | 5420 +-- vendor/gopkg.in/yaml.v2/sorter.go | 208 +- vendor/gopkg.in/yaml.v2/suite_test.go | 24 +- vendor/gopkg.in/yaml.v2/writerc.go | 178 +- vendor/gopkg.in/yaml.v2/yaml.go | 692 +- vendor/gopkg.in/yaml.v2/yamlh.go | 1432 +- vendor/gopkg.in/yaml.v2/yamlprivateh.go | 346 +- 1392 files changed, 360503 insertions(+), 344957 deletions(-) create mode 100644 vendor/github.com/leonelquinteros/gotext/.gitignore create mode 100644 vendor/github.com/leonelquinteros/gotext/.travis.yml create mode 100644 vendor/github.com/leonelquinteros/gotext/Godeps/Godeps.json create mode 100644 vendor/github.com/leonelquinteros/gotext/Godeps/Readme create mode 100644 vendor/github.com/leonelquinteros/gotext/LICENSE create mode 100644 vendor/github.com/leonelquinteros/gotext/README.md create mode 100644 vendor/github.com/leonelquinteros/gotext/gotext.go create mode 100644 vendor/github.com/leonelquinteros/gotext/gotext_test.go create mode 100644 vendor/github.com/leonelquinteros/gotext/locale.go create mode 100644 vendor/github.com/leonelquinteros/gotext/locale_test.go create mode 100644 vendor/github.com/leonelquinteros/gotext/po.go create mode 100644 vendor/github.com/leonelquinteros/gotext/po_test.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/doc.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/expr.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/pos.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/stmt.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/token.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/Makefile create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/lexer.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go.y create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/doc.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/env.go create mode 100644 vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/vm.go create mode 100644 vendor/github.com/mattn/anko/.travis.yml create mode 100644 vendor/github.com/mattn/anko/README.md create mode 100644 vendor/github.com/mattn/anko/TODO create mode 100644 vendor/github.com/mattn/anko/_example/embed/main.go create mode 100644 vendor/github.com/mattn/anko/_example/scripts/anonymous-call.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/chan.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/env.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/example.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/exec.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/fib-for.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/fib-recursion.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/for-break-continue.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/http.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/module.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/regexp.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/server.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/signal.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/slice.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/socket.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/term.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/try-catch.ank create mode 100644 vendor/github.com/mattn/anko/_example/scripts/url.ank create mode 100644 vendor/github.com/mattn/anko/anko.go create mode 100644 vendor/github.com/mattn/anko/anko.png create mode 100644 vendor/github.com/mattn/anko/ast/doc.go create mode 100644 vendor/github.com/mattn/anko/ast/expr.go create mode 100644 vendor/github.com/mattn/anko/ast/pos.go create mode 100644 vendor/github.com/mattn/anko/ast/stmt.go create mode 100644 vendor/github.com/mattn/anko/ast/token.go create mode 100644 vendor/github.com/mattn/anko/builtins/core.go create mode 100644 vendor/github.com/mattn/anko/builtins/encoding/json/json.go create mode 100644 vendor/github.com/mattn/anko/builtins/errors/errors.go create mode 100644 vendor/github.com/mattn/anko/builtins/flag/flag.go create mode 100644 vendor/github.com/mattn/anko/builtins/fmt/fmt.go create mode 100644 vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext.go create mode 100644 vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext_appengine.go create mode 100644 vendor/github.com/mattn/anko/builtins/io/io.go create mode 100644 vendor/github.com/mattn/anko/builtins/io/ioutil/ioutil.go create mode 100644 vendor/github.com/mattn/anko/builtins/math/math.go create mode 100644 vendor/github.com/mattn/anko/builtins/math/rand/rand.go create mode 100644 vendor/github.com/mattn/anko/builtins/net/http/http.go create mode 100644 vendor/github.com/mattn/anko/builtins/net/http/http_appengine.go create mode 100644 vendor/github.com/mattn/anko/builtins/net/net.go create mode 100644 vendor/github.com/mattn/anko/builtins/net/net_appengine.go create mode 100644 vendor/github.com/mattn/anko/builtins/net/url/url.go create mode 100644 vendor/github.com/mattn/anko/builtins/net/url/url_appengine.go create mode 100644 vendor/github.com/mattn/anko/builtins/os/exec/exec.go create mode 100644 vendor/github.com/mattn/anko/builtins/os/os.go create mode 100644 vendor/github.com/mattn/anko/builtins/os/os_appengine.go create mode 100644 vendor/github.com/mattn/anko/builtins/os/os_nonappengine.go create mode 100644 vendor/github.com/mattn/anko/builtins/os/signal/signal.go create mode 100644 vendor/github.com/mattn/anko/builtins/path/filepath/filepath.go create mode 100644 vendor/github.com/mattn/anko/builtins/path/path.go create mode 100644 vendor/github.com/mattn/anko/builtins/regexp/regexp.go create mode 100644 vendor/github.com/mattn/anko/builtins/runtime/runtime.go create mode 100644 vendor/github.com/mattn/anko/builtins/sort/sort.go create mode 100644 vendor/github.com/mattn/anko/builtins/strings/strings.go create mode 100644 vendor/github.com/mattn/anko/builtins/time/time.go create mode 100644 vendor/github.com/mattn/anko/misc/vim/ftdetect/ank.vim create mode 100644 vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/comment.vim create mode 100644 vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/play.vim create mode 100644 vendor/github.com/mattn/anko/misc/vim/syntax/anko.vim create mode 100644 vendor/github.com/mattn/anko/parser/Makefile create mode 100644 vendor/github.com/mattn/anko/parser/lexer.go create mode 100644 vendor/github.com/mattn/anko/parser/parser.go create mode 100644 vendor/github.com/mattn/anko/parser/parser.go.y create mode 100644 vendor/github.com/mattn/anko/t/01-let.ank create mode 100644 vendor/github.com/mattn/anko/t/02-toString.ank create mode 100644 vendor/github.com/mattn/anko/t/03-op.ank create mode 100644 vendor/github.com/mattn/anko/t/04-func.ank create mode 100644 vendor/github.com/mattn/anko/t/05-len.ank create mode 100644 vendor/github.com/mattn/anko/t/06-for.ank create mode 100644 vendor/github.com/mattn/anko/t/07-switch.ank create mode 100644 vendor/github.com/mattn/anko/t/08-if.ank create mode 100644 vendor/github.com/mattn/anko/t/09-toBytes.ank create mode 100644 vendor/github.com/mattn/anko/t/10-toRunes.ank create mode 100644 vendor/github.com/mattn/anko/t/lib/tester.ank create mode 100644 vendor/github.com/mattn/anko/t/test.bat create mode 100644 vendor/github.com/mattn/anko/t/test.sh create mode 100644 vendor/github.com/mattn/anko/tool/makebuiltin.go create mode 100644 vendor/github.com/mattn/anko/vm/doc.go create mode 100644 vendor/github.com/mattn/anko/vm/env.go create mode 100644 vendor/github.com/mattn/anko/vm/env_test.go create mode 100644 vendor/github.com/mattn/anko/vm/example_test.go create mode 100644 vendor/github.com/mattn/anko/vm/vm.go create mode 100644 vendor/github.com/mattn/anko/vm/vm_test.go diff --git a/glide.lock b/glide.lock index ae021fc304..8ee1fd5751 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: e217865c5465d4716f3e1b48ecba293a1e50b8498c1ad000334baaacfbd8a775 -updated: 2017-05-17T11:57:36.3187972-07:00 +hash: 3f99d1be0dbcab7f2196ed9896f8b215b096742a7d71e234ef265c426b01e00c +updated: 2017-05-18T20:17:11.1103248Z imports: - name: github.com/Azure/azure-sdk-for-go version: 5841475edc7c8725d79885d635aa8956f97fdf0e @@ -25,6 +25,14 @@ imports: version: 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 +- name: github.com/leonelquinteros/gotext + version: a735812a72672008b3902f8b2bc1302166a9a8ea +- name: github.com/mattn/anko + version: a8c68fa2983e7dd5d3472992b1fbe2f7c44261f0 + subpackages: + - ast + - parser + - vm - name: github.com/mitchellh/go-homedir version: b8bc1bf767474819792c23f32d8286a45736f1c6 - name: github.com/prometheus/common diff --git a/glide.yaml b/glide.yaml index 7fbf67e334..644504226f 100644 --- a/glide.yaml +++ b/glide.yaml @@ -28,6 +28,8 @@ import: version: ^1.1.0 - package: github.com/spf13/cobra - package: github.com/spf13/pflag +- package: github.com/leonelquinteros/gotext + version: v1.1.1 testImport: - package: github.com/onsi/gomega version: ^1.1.0 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/.gitignore b/vendor/github.com/Azure/azure-sdk-for-go/.gitignore index a73698d688..2da4dc3587 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/.gitignore +++ b/vendor/github.com/Azure/azure-sdk-for-go/.gitignore @@ -1,32 +1,32 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -# Editor swap files -*.swp -*~ -.DS_Store - -# ignore vendor/ -vendor/ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +# Editor swap files +*.swp +*~ +.DS_Store + +# ignore vendor/ +vendor/ diff --git a/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml b/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml index 0bc3d5f202..0a6a1c1e4e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml +++ b/vendor/github.com/Azure/azure-sdk-for-go/.travis.yml @@ -1,32 +1,32 @@ -sudo: false - -language: go - -go: - - 1.7 - - 1.8 - -install: - - go get -u github.com/golang/lint/golint - - go get -u github.com/Masterminds/glide - - go get -u golang.org/x/net/context - - go get -u gopkg.in/godo.v2/cmd/godo - - export GO15VENDOREXPERIMENT=1 - - glide install - -script: - - bash rungas.sh - - test -z "$(gofmt -s -l $(find ./arm/* -type d -print) | tee /dev/stderr)" - - test -z "$(gofmt -s -l -w management | tee /dev/stderr)" - - test -z "$(gofmt -s -l -w storage | tee /dev/stderr)" - - test -z "$(gofmt -s -l -w Gododir | tee /dev/stderr)" - - test -z "$(go build $(find ./* -type d -print | grep -v '^./vendor$' | grep -v '^./storage$') | tee /dev/stderr)" - - test -z "$(go vet $(find ./arm/* -type d -print) | tee /dev/stderr)" - - test -z "$(golint ./arm/... | tee /dev/stderr)" - - go test -v ./management/... - - go test -v ./storage/... - - test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)" - - go vet ./management/... - - go vet ./storage/... - - test -z "$(golint ./Gododir/... | tee /dev/stderr)" - - go vet ./Gododir/... +sudo: false + +language: go + +go: + - 1.7 + - 1.8 + +install: + - go get -u github.com/golang/lint/golint + - go get -u github.com/Masterminds/glide + - go get -u golang.org/x/net/context + - go get -u gopkg.in/godo.v2/cmd/godo + - export GO15VENDOREXPERIMENT=1 + - glide install + +script: + - bash rungas.sh + - test -z "$(gofmt -s -l $(find ./arm/* -type d -print) | tee /dev/stderr)" + - test -z "$(gofmt -s -l -w management | tee /dev/stderr)" + - test -z "$(gofmt -s -l -w storage | tee /dev/stderr)" + - test -z "$(gofmt -s -l -w Gododir | tee /dev/stderr)" + - test -z "$(go build $(find ./* -type d -print | grep -v '^./vendor$' | grep -v '^./storage$') | tee /dev/stderr)" + - test -z "$(go vet $(find ./arm/* -type d -print) | tee /dev/stderr)" + - test -z "$(golint ./arm/... | tee /dev/stderr)" + - go test -v ./management/... + - go test -v ./storage/... + - test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)" + - go vet ./management/... + - go vet ./storage/... + - test -z "$(golint ./Gododir/... | tee /dev/stderr)" + - go vet ./Gododir/... diff --git a/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md index ea0d7634c4..a3a63ad384 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/CHANGELOG.md @@ -1,484 +1,484 @@ -# CHANGELOG - ------ -## `v10.0.0-beta` -### ARM -In addition to the tabulated changes below, each package had the following updates: -- Long running operations now run inside a goroutine and return channels for the response and the errors. -- Some functions changed from returning `autorest.Response` to return the already unmarshaled struct. -- Uses go-autorest v8.0.0. - -| api | version | note | -|:------------------------------------|:-------------------|:------------------------------------| -| arm/advisor | 2017-04-19 | new | -| arm/analysisservices | 2016-05-16 | refactor | -| arm/apimanagement | 2016-10-10 | update to latest swagger & refactor | -| arm/appinsights | 2015-05-01 | new | -| arm/automation | 2015-10-31 | new | -| arm/billing | 2017-04-24-preview | update to latest swagger & refactor | -| arm/cdn | 2016-10-02 | refactor | -| arm/commerce | 2015-06-01-preview | refactor | -| arm/compute | 2016-04-30-preview | refactor | -| arm/consumption | 2017-04-24-preview | new | -| arm/containerregistry | 2017-03-01 | update to latest swagger & refactor | -| arm/containerservice | 2017-01-31 | update to latest swagger & refactor | -| arm/customer-insights | 2017-01-01 | refactor | -| arm/datalake-analytics/account | 2016-11-01 | refactor | -| arm/datalake-store/account | 2016-11-01 | refactor | -| arm/devtestlabs | 2016-05-15 | refactor | -| arm/disk | 2016-04-30-preview | refactor | -| arm/dns | 2016-04-01 | refactor | -| arm/documentdb | 2015-04-08 | refactor | -| arm/eventhub | 2015-08-01 | refactor | -| arm/graphrbac | 1.6 | refactor | -| arm/hdinsight | 2015-03-01-preview | new | -| arm/insights | multiple | new | -| arm/intune | 2015-01-14-preview | refactor | -| arm/iothub | 2016-02-03 | refactor | -| arm/machinelearning/commitmentplans | 2016-05-01-preview | refactor | -| arm/machinelearning/webservices | 2017-01-01 | update to latest swagger & refactor | -| arm/monitor | multiple | new | -| arm/network | 2017-03-01 | update to latest swagger & refactor | -| arm/notificationhubs | 2017-04-01 | update to latest swagger & refactor | -| arm/operationalinsights | 2015-11-01-preview | update to latest swagger & refactor | -| arm/powerbiembedded | 2016-01-29 | refactor | -| arm/recoveryservices | 2016-12-01 | refactor | -| arm/recoveryservicesbackup | 2016-12-01 | new | -| arm/redis | 2016-04-01 | refactor | -| arm/relay | 2016-07-01 | new | -| arm/resourcehealth | 2015-01-01 | new | -| arm/resources/features | 2015-12-01 | refactor | -| arm/resources/links | 2016-09-01 | refactor | -| arm/resources/resources | 2016-09-01 | refactor | -| arm/resources/subscriptions | 2016-06-01 | refactor | -| arm/scheduler | 2016-03-01 | refactor | -| arm/servermanagement | 2016-07-01-preview | refactor | -| arm/servicebus | 2015-08-01 | refactor | -| arm/servicefabric | 2016-09-01 | new | -| arm/service-map | 2015-11-01-preview | refactor | -| arm/sql | multiple | update to latest swagger & refactor | -| arm/storage | 2016-12-01 | update to latest swagger & refactor | -| arm/storageimportexport | 2016-11-01 | refactor | -| arm/web | multiple | refactor | - -### Data plane -| api | version | note | -|:------------------------------------|:-------------------|:------------------------------------| -| dataplane/keyvault | 2016-10-01 | refactor | - -### Storage -Storage has returned to this repo. -It has also been refactored: -- Blobs, containers, tables, etc are now method receivers. These structs are the ones being - updated with each operation. -- When creating a client, the SDK checks if the storage account provided is valid. -- Added retry logic. It provides the flexibility for user to provide their own retry logic. -- Added operations: - - Get table - - Get entity - - Get and set queue ACL - - Table batch - - Page blob incremental copy -- All operations that previously had `extraHeaders` as parameter now recieve a struct with well - defined possible headers and other options. Some functions are easier to use. -- Storage tests now use HTTP recordings. - -### Generated code notes -- [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs) commit: 519980465d9c195622d466dc4601b1999a448ed5 -- [AutoRest](https://github.com/Azure/autorest) commit: ced950d64e39735b84d41876a56b54b27c227dc7 - -## `v9.0.0-beta` -### ARM -In addition to the tabulated changes below, each package had the following updates: - - API Version is now associated with individual methods, instead of the client. This was done to - support composite swaggers, which logically may contain more than one API Version. - - Version numbers are now calculated in the generator instead of at runtime. This keeps us from - adding new allocations, while removing the race-conditions that were added. - -| api | version | note | -|:------------------------------------|:-------------------|:-----------------------------------| -| arm/analysisservices | 2016-05-16 | update to latest swagger | -| arm/authorization | 2015-07-01 | refactoring | -| arm/batch | 2017-01-01 | update to latest swagger &refactor | -| arm/cdn | 2016-10-02 | update to latest swagger | -| arm/compute | 2016-04-30-preview | update to latest swagger | -| arm/dns | 2016-04-01 | update to latest swagger &refactor | -| arm/eventhub | 2015-08-01 | refactoring | -| arm/logic | 2016-06-01 | update to latest swagger &refactor | -| arm/notificationshub | 2016-03-01 | update to latest swagger &refactor | -| arm/redis | 2016-04-01 | update to latest swagger &refactor | -| arm/resources/resources | 2016-09-01 | update to latest swagger | -| arm/servicebus | 2015-08-01 | update to latest swagger | -| arm/sql | 2014-04-01 | update to latest swagger | -| arm/web | multiple | generating from composite | -| datalake-analytics/account | 2016-11-01 | update to latest swagger | -| datalake-store/filesystem | 2016-11-01 | update to latest swagger | - -### Storage -Storage has been moved to its own repository which can be found here: -https://github.com/Azure/azure-storage-go - -For backwards compatibility, a submodule has been added to this repo. However, consuming storage -via this repository is deprecated and may be deleted in future versions. - -## `v8.1.0-beta` -### ARM -| api | version | note | -|:------------------------------------|:-------------------|:-----------------------------------| -| arm/apimanagement | 2016-07-07 | new | -| arm/apideployment | 2016-07-07 | new | -| arm/billing | 2017-02-27-preview | new | -| arm/compute | 2016-04-30-preview | update to latest swagger | -| arm/containerservice | 2017-01-31 | update to latest swagger | -| arm/customer-insights | 2017-01-01 | new | -| arm/graphrbac | 1.6 | new | -| arm/networkwatcher | 2016-12-01 | new | -| arm/operationalinsights | 2015-11-01-preview | new | -| arm/service-map | 2015-11-01-preview | new | -| arm/storageimportexport | 2016-11-01 | new | - -### Data plane -| api | version | note | -|:------------------------------------|:-------------------|:-----------------------------------| -| dataplane/keyvault | 2016-10-01 | new | - -- Uses go-autorest v7.3.0 - - -## `v8.0.0-beta` -### ARM -- In addition to the tablulated changes below, all updated packages received performance - improvements to their Version() method. -- Some validation that was taking place in the runtime was erroneously blocking calls. - all packages have been updated to take that bug fix. - -| api | version | note | -|:------------------------------------|:-------------------|:-----------------------------------| -| arm/analysisservices | 2016-05-16 | update to latest swagger | -| arm/cdn | 2016-10-02 | update to latest swagger | -| arm/cognitiveservices | 2016-02-01-preview | update to latest swagger | -| arm/compute | 2016-03-30 | update to latest swagger, refactor | -| arm/containerregistry | 2016-06-27-preview | update to latest swagger | -| arm/containerservice | 2016-09-30 | update to latest swagger | -| arm/datalake-analytics | 2016-11-01 | update to latest swagger | -| arm/datalake-store | 2016-11-01 | update to latest swagger | -| arm/disk | 2016-04-30-preview | new | -| arm/documentdb | 2015-04-08 | update to latest swagger | -| arm/iothub | 2016-02-03 | update to latest swagger | -| arm/keyvault | 2015-06-01 | update to latest swagger | -| arm/logic | 2016-06-01 | update to latest swagger | -| arm/machinelearning | 2016-05-01-preview | update to latest swagger | -| arm/mobileengagement | 2014-12-01 | update to latest swagger, refactor | -| arm/redis | 2016-04-01 | update to latest swagger | -| arm/resources/locks | 2016-09-01 | refactor | -| arm/resources/policy | 2016-12-01 | previous version was deleted | -| arm/resources/resources | 2016-09-01 | update to latest swagger, refactor | -| arm/scheduler | 2016-03-01 | refactor | -| arm/search | 2015-08-19 | refactor | -| arm/web | 2015-08-01 | refactor | - -## `v7.0.0-beta` - -| api | version | note | -|:------------------------------------|:-------------------|:-----------------------------------| -| arm/analysisservices | 2016-05-16 | new | -| arm/cdn | 2016-10-02 | update to latest swagger | -| arm/commerce | 2015-06-01-preview | new | -| arm/containerservice | 2016-09-30 | update to latest swagger | -| arm/containerregistry | 2016-06-27-preview | new | -| arm/datalake-analytics/account | 2016-11-01 | update to latest swagger | -| arm/datalake-store/account | 2016-11-01 | update to latest swagger | -| arm/datalake-store/filesystem | 2016-11-01 | update to latest swagger | -| arm/documentdb | 2015-04-08 | new | -| arm/machinelearning/commitmentplans | 2016-05-01-preview | new | -| arm/recoveryservices | 2016-06-01 | new | -| arm/resources/subscriptions | 2016-06-01 | new | -| arm/search | 2015-08-19 | update to latest swagger | -| arm/sql | 2014-04-01 | previous version was deleted | - -### Storage -- Can now update messages in storage queues. -- Added support for blob snapshots and aborting blob copy operations. -- Added support for getting and setting ACLs on containers. -- Added various APIs for file and directory manipulation. - -### Support for the following swagger extensions was added to the Go generator which affected codegen. -- x-ms-client-flatten -- x-ms-paramater-location - -## `v6.0.0-beta` - -| api | version | note | -|:-------------------------------|:-------------------|:-----------------------------------| -| arm/authorization | no change | code refactoring | -| arm/batch | no change | code refactoring | -| arm/compute | no change | code refactoring | -| arm/containerservice | 2016-03-30 | return | -| arm/datalake-analytics/account | 2015-10-01-preview | new | -| arm/datalake-store/filesystem | no change | moved to datalake-store/filesystem | -| arm/eventhub | no change | code refactoring | -| arm/intune | no change | code refactoring | -| arm/iothub | no change | code refactoring | -| arm/keyvault | no change | code refactoring | -| arm/mediaservices | no change | code refactoring | -| arm/network | no change | code refactoring | -| arm/notificationhubs | no change | code refactoring | -| arm/redis | no change | code refactoring | -| arm/resources/resources | no change | code refactoring | -| arm/resources/links | 2016-09-01 | new | -| arm/resources/locks | 2016-09-01 | updated | -| arm/resources/policy | no change | code refactoring | -| arm/resources/resources | 2016-09-01 | updated | -| arm/servermanagement | 2016-07-01-preview | updated | -| arm/web | no change | code refactoring | - -- storage: Added blob lease functionality and tests - -## `v5.0.0-beta` - -| api | version | note | -|:------------------------------|:--------------------|:-----------------| -| arm/network | 2016-09-01 | updated | -| arm/servermanagement | 2015-07-01-preview | new | -| arm/eventhub | 2015-08-01 | new | -| arm/containerservice | -- | removed | -| arm/resources/subscriptions | no change | code refactoring | -| arm/resources/features | no change | code refactoring | -| arm/resources/resources | no change | code refactoring | -| arm/datalake-store/accounts | no change | code refactoring | -| arm/datalake-store/filesystem | no change | code refactoring | -| arm/notificationhubs | no change | code refactoring | -| arm/redis | no change | code refactoring | - -- storage: Add more file storage share operations. -- azure-rest-api-specs/commit/b8cdc2c50a0872fc0039f20c2b6b33aa0c2af4bf -- Uses go-autorest v7.2.1 - -## `v4.0.0-beta` - -- arm/logic: breaking change in package logic. -- arm: parameter validation code added in all arm packages. -- Uses go-autorest v7.2.0. - - -## `v3.2.0-beta` - -| api | version | note | -|:----------------------------|:--------------------|:----------| -| arm/mediaservices | 2015-10-01 | new | -| arm/keyvault | 2015-06-01 | new | -| arm/iothub | 2016-02-03 | new | -| arm/datalake-store | 2015-12-01 | new | -| arm/network | 2016-06-01 | updated | -| arm/resources/resources | 2016-07-01 | updated | -| arm/resources/policy | 2016-04-01 | updated | -| arm/servicebus | 2015-08-01 | updated | - -- arm: uses go-autorest version v7.1.0. -- storage: fix for operating on blobs names containing special characters. -- storage: add SetBlobProperties(), update BlobProperties response fields. -- storage: make storage client work correctly with read-only secondary account. -- storage: add Azure Storage Emulator support. - - -## `v3.1.0-beta` - -- Added a new arm/compute/containerservice (2016-03-30) package -- Reintroduced NewxxClientWithBaseURI method. -- Uses go-autorest version - v7.0.7. - - -## `v3.0.0-beta` - -This release brings the Go SDK ARM packages up-to-date with Azure ARM Swagger files for most -services. Since the underlying [Swagger files](https://github.com/Azure/azure-rest-api-specs) -continue to change substantially, the ARM packages are still in *beta* status. - -The ARM packages now align with the following API versions (*highlighted* packages are new or -updated in this release): - -| api | version | note | -|:----------------------------|:--------------------|:----------| -| arm/authorization | 2015-07-01 | no change | -| arm/intune | 2015-01-14-preview | no change | -| arm/notificationhubs | 2014-09-01 | no change | -| arm/resources/features | 2015-12-01 | no change | -| arm/resources/subscriptions | 2015-11-01 | no change | -| arm/web | 2015-08-01 | no change | -| arm/cdn | 2016-04-02 | updated | -| arm/compute | 2016-03-30 | updated | -| arm/dns | 2016-04-01 | updated | -| arm/logic | 2015-08-01-preview | updated | -| arm/network | 2016-03-30 | updated | -| arm/redis | 2016-04-01 | updated | -| arm/resources/resources | 2016-02-01 | updated | -| arm/resources/policy | 2015-10-01-preview | updated | -| arm/resources/locks | 2015-01-01 | updated (resources/authorization earlier)| -| arm/scheduler | 2016-03-01 | updated | -| arm/storage | 2016-01-01 | updated | -| arm/search | 2015-02-28 | updated | -| arm/batch | 2015-12-01 | new | -| arm/cognitiveservices | 2016-02-01-preview | new | -| arm/devtestlabs | 2016-05-15 | new | -| arm/machinelearning | 2016-05-01-preview | new | -| arm/powerbiembedded | 2016-01-29 | new | -| arm/mobileengagement | 2014-12-01 | new | -| arm/servicebus | 2014-09-01 | new | -| arm/sql | 2015-05-01 | new | -| arm/trafficmanager | 2015-11-01 | new | - - -Below are some design changes. -- Removed Api version from method arguments. -- Removed New...ClientWithBaseURI() method in all clients. BaseURI value is set in client.go. -- Uses go-autorest version v7.0.6. - - -## `v2.2.0-beta` - -- Uses go-autorest version v7.0.5. -- Update version of pacakges "jwt-go" and "crypto" in glide.lock. - - -## `v2.1.1-beta` - -- arm: Better error messages for long running operation failures (Uses go-autorest version v7.0.4). - - -## `v2.1.0-beta` - -- arm: Uses go-autorest v7.0.3 (polling related updates). -- arm: Cancel channel argument added in long-running calls. -- storage: Allow caller to provide headers for DeleteBlob methods. -- storage: Enables connection sharing with http keepalive. -- storage: Add BlobPrefixes and Delimiter to BlobListResponse - - -## `v2.0.0-beta` - -- Uses go-autorest v6.0.0 (Polling and Asynchronous requests related changes). - - -## `v0.5.0-beta` - -Updated following packages to new API versions: -- arm/resources/features 2015-12-01 -- arm/resources/resources 2015-11-01 -- arm/resources/subscriptions 2015-11-01 - - -### Changes - - - SDK now uses go-autorest v3.0.0. - - - -## `v0.4.0-beta` - -This release brings the Go SDK ARM packages up-to-date with Azure ARM Swagger files for most -services. Since the underlying [Swagger files](https://github.com/Azure/azure-rest-api-specs) -continue to change substantially, the ARM packages are still in *beta* status. - -The ARM packages now align with the following API versions (*highlighted* packages are new or -updated in this release): - -- *arm/authorization 2015-07-01* -- *arm/cdn 2015-06-01* -- arm/compute 2015-06-15 -- arm/dns 2015-05-04-preview -- *arm/intune 2015-01-14-preview* -- arm/logic 2015-02-01-preview -- *arm/network 2015-06-15* -- *arm/notificationhubs 2014-09-01* -- arm/redis 2015-08-01 -- *arm/resources/authorization 2015-01-01* -- *arm/resources/features 2014-08-01-preview* -- *arm/resources/resources 2014-04-01-preview* -- *arm/resources/subscriptions 2014-04-01-preview* -- *arm/scheduler 2016-01-01* -- arm/storage 2015-06-15 -- arm/web 2015-08-01 - -### Changes - -- Moved the arm/authorization, arm/features, arm/resources, and arm/subscriptions packages under a new, resources, package (to reflect the corresponding Swagger structure) -- Added a new arm/authoriation (2015-07-01) package -- Added a new arm/cdn (2015-06-01) package -- Added a new arm/intune (2015-01-14-preview) package -- Udated arm/network (2015-06-01) -- Added a new arm/notificationhubs (2014-09-01) package -- Updated arm/scheduler (2016-01-01) package - - ------ - -## `v0.3.0-beta` - -- Corrected unintentional struct field renaming and client renaming in v0.2.0-beta - ------ - -## `v0.2.0-beta` - -- Added support for DNS, Redis, and Web site services -- Updated Storage service to API version 2015-06-15 -- Updated Network to include routing table support -- Address https://github.com/Azure/azure-sdk-for-go/issues/232 -- Address https://github.com/Azure/azure-sdk-for-go/issues/231 -- Address https://github.com/Azure/azure-sdk-for-go/issues/230 -- Address https://github.com/Azure/azure-sdk-for-go/issues/224 -- Address https://github.com/Azure/azure-sdk-for-go/issues/184 -- Address https://github.com/Azure/azure-sdk-for-go/issues/183 - ------- - -## `v0.1.1-beta` - -- Improves the UserAgent string to disambiguate arm packages from others in the SDK -- Improves setting the http.Response into generated results (reduces likelihood of a nil reference) -- Adds gofmt, golint, and govet to Travis CI for the arm packages - -##### Fixed Issues - -- https://github.com/Azure/azure-sdk-for-go/issues/196 -- https://github.com/Azure/azure-sdk-for-go/issues/213 - ------- - -## v0.1.0-beta - -This release addresses the issues raised against the alpha release and adds more features. Most -notably, to address the challenges of encoding JSON -(see the [comments](https://github.com/Azure/go-autorest#handling-empty-values) in the -[go-autorest](https://github.com/Azure/go-autorest) package) by using pointers for *all* structure -fields (with the exception of enumerations). The -[go-autorest/autorest/to](https://github.com/Azure/go-autorest/tree/master/autorest/to) package -provides helpers to convert to / from pointers. The examples demonstrate their usage. - -Additionally, the packages now align with Go coding standards and pass both `golint` and `govet`. -Accomplishing this required renaming various fields and parameters (such as changing Url to URL). - -##### Changes - -- Changed request / response structures to use pointer fields. -- Changed methods to return `error` instead of `autorest.Error`. -- Re-divided methods to ease asynchronous requests. -- Added paged results support. -- Added a UserAgent string. -- Added changes necessary to pass golint and govet. -- Updated README.md with details on asynchronous requests and paging. -- Saved package dependencies through Godep (for the entire SDK). - -##### Fixed Issues: - -- https://github.com/Azure/azure-sdk-for-go/issues/205 -- https://github.com/Azure/azure-sdk-for-go/issues/206 -- https://github.com/Azure/azure-sdk-for-go/issues/211 -- https://github.com/Azure/azure-sdk-for-go/issues/212 - ------ - -## v0.1.0-alpha - -This release introduces the Azure Resource Manager packages generated from the corresponding +# CHANGELOG + +----- +## `v10.0.0-beta` +### ARM +In addition to the tabulated changes below, each package had the following updates: +- Long running operations now run inside a goroutine and return channels for the response and the errors. +- Some functions changed from returning `autorest.Response` to return the already unmarshaled struct. +- Uses go-autorest v8.0.0. + +| api | version | note | +|:------------------------------------|:-------------------|:------------------------------------| +| arm/advisor | 2017-04-19 | new | +| arm/analysisservices | 2016-05-16 | refactor | +| arm/apimanagement | 2016-10-10 | update to latest swagger & refactor | +| arm/appinsights | 2015-05-01 | new | +| arm/automation | 2015-10-31 | new | +| arm/billing | 2017-04-24-preview | update to latest swagger & refactor | +| arm/cdn | 2016-10-02 | refactor | +| arm/commerce | 2015-06-01-preview | refactor | +| arm/compute | 2016-04-30-preview | refactor | +| arm/consumption | 2017-04-24-preview | new | +| arm/containerregistry | 2017-03-01 | update to latest swagger & refactor | +| arm/containerservice | 2017-01-31 | update to latest swagger & refactor | +| arm/customer-insights | 2017-01-01 | refactor | +| arm/datalake-analytics/account | 2016-11-01 | refactor | +| arm/datalake-store/account | 2016-11-01 | refactor | +| arm/devtestlabs | 2016-05-15 | refactor | +| arm/disk | 2016-04-30-preview | refactor | +| arm/dns | 2016-04-01 | refactor | +| arm/documentdb | 2015-04-08 | refactor | +| arm/eventhub | 2015-08-01 | refactor | +| arm/graphrbac | 1.6 | refactor | +| arm/hdinsight | 2015-03-01-preview | new | +| arm/insights | multiple | new | +| arm/intune | 2015-01-14-preview | refactor | +| arm/iothub | 2016-02-03 | refactor | +| arm/machinelearning/commitmentplans | 2016-05-01-preview | refactor | +| arm/machinelearning/webservices | 2017-01-01 | update to latest swagger & refactor | +| arm/monitor | multiple | new | +| arm/network | 2017-03-01 | update to latest swagger & refactor | +| arm/notificationhubs | 2017-04-01 | update to latest swagger & refactor | +| arm/operationalinsights | 2015-11-01-preview | update to latest swagger & refactor | +| arm/powerbiembedded | 2016-01-29 | refactor | +| arm/recoveryservices | 2016-12-01 | refactor | +| arm/recoveryservicesbackup | 2016-12-01 | new | +| arm/redis | 2016-04-01 | refactor | +| arm/relay | 2016-07-01 | new | +| arm/resourcehealth | 2015-01-01 | new | +| arm/resources/features | 2015-12-01 | refactor | +| arm/resources/links | 2016-09-01 | refactor | +| arm/resources/resources | 2016-09-01 | refactor | +| arm/resources/subscriptions | 2016-06-01 | refactor | +| arm/scheduler | 2016-03-01 | refactor | +| arm/servermanagement | 2016-07-01-preview | refactor | +| arm/servicebus | 2015-08-01 | refactor | +| arm/servicefabric | 2016-09-01 | new | +| arm/service-map | 2015-11-01-preview | refactor | +| arm/sql | multiple | update to latest swagger & refactor | +| arm/storage | 2016-12-01 | update to latest swagger & refactor | +| arm/storageimportexport | 2016-11-01 | refactor | +| arm/web | multiple | refactor | + +### Data plane +| api | version | note | +|:------------------------------------|:-------------------|:------------------------------------| +| dataplane/keyvault | 2016-10-01 | refactor | + +### Storage +Storage has returned to this repo. +It has also been refactored: +- Blobs, containers, tables, etc are now method receivers. These structs are the ones being + updated with each operation. +- When creating a client, the SDK checks if the storage account provided is valid. +- Added retry logic. It provides the flexibility for user to provide their own retry logic. +- Added operations: + - Get table + - Get entity + - Get and set queue ACL + - Table batch + - Page blob incremental copy +- All operations that previously had `extraHeaders` as parameter now recieve a struct with well + defined possible headers and other options. Some functions are easier to use. +- Storage tests now use HTTP recordings. + +### Generated code notes +- [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs) commit: 519980465d9c195622d466dc4601b1999a448ed5 +- [AutoRest](https://github.com/Azure/autorest) commit: ced950d64e39735b84d41876a56b54b27c227dc7 + +## `v9.0.0-beta` +### ARM +In addition to the tabulated changes below, each package had the following updates: + - API Version is now associated with individual methods, instead of the client. This was done to + support composite swaggers, which logically may contain more than one API Version. + - Version numbers are now calculated in the generator instead of at runtime. This keeps us from + adding new allocations, while removing the race-conditions that were added. + +| api | version | note | +|:------------------------------------|:-------------------|:-----------------------------------| +| arm/analysisservices | 2016-05-16 | update to latest swagger | +| arm/authorization | 2015-07-01 | refactoring | +| arm/batch | 2017-01-01 | update to latest swagger &refactor | +| arm/cdn | 2016-10-02 | update to latest swagger | +| arm/compute | 2016-04-30-preview | update to latest swagger | +| arm/dns | 2016-04-01 | update to latest swagger &refactor | +| arm/eventhub | 2015-08-01 | refactoring | +| arm/logic | 2016-06-01 | update to latest swagger &refactor | +| arm/notificationshub | 2016-03-01 | update to latest swagger &refactor | +| arm/redis | 2016-04-01 | update to latest swagger &refactor | +| arm/resources/resources | 2016-09-01 | update to latest swagger | +| arm/servicebus | 2015-08-01 | update to latest swagger | +| arm/sql | 2014-04-01 | update to latest swagger | +| arm/web | multiple | generating from composite | +| datalake-analytics/account | 2016-11-01 | update to latest swagger | +| datalake-store/filesystem | 2016-11-01 | update to latest swagger | + +### Storage +Storage has been moved to its own repository which can be found here: +https://github.com/Azure/azure-storage-go + +For backwards compatibility, a submodule has been added to this repo. However, consuming storage +via this repository is deprecated and may be deleted in future versions. + +## `v8.1.0-beta` +### ARM +| api | version | note | +|:------------------------------------|:-------------------|:-----------------------------------| +| arm/apimanagement | 2016-07-07 | new | +| arm/apideployment | 2016-07-07 | new | +| arm/billing | 2017-02-27-preview | new | +| arm/compute | 2016-04-30-preview | update to latest swagger | +| arm/containerservice | 2017-01-31 | update to latest swagger | +| arm/customer-insights | 2017-01-01 | new | +| arm/graphrbac | 1.6 | new | +| arm/networkwatcher | 2016-12-01 | new | +| arm/operationalinsights | 2015-11-01-preview | new | +| arm/service-map | 2015-11-01-preview | new | +| arm/storageimportexport | 2016-11-01 | new | + +### Data plane +| api | version | note | +|:------------------------------------|:-------------------|:-----------------------------------| +| dataplane/keyvault | 2016-10-01 | new | + +- Uses go-autorest v7.3.0 + + +## `v8.0.0-beta` +### ARM +- In addition to the tablulated changes below, all updated packages received performance + improvements to their Version() method. +- Some validation that was taking place in the runtime was erroneously blocking calls. + all packages have been updated to take that bug fix. + +| api | version | note | +|:------------------------------------|:-------------------|:-----------------------------------| +| arm/analysisservices | 2016-05-16 | update to latest swagger | +| arm/cdn | 2016-10-02 | update to latest swagger | +| arm/cognitiveservices | 2016-02-01-preview | update to latest swagger | +| arm/compute | 2016-03-30 | update to latest swagger, refactor | +| arm/containerregistry | 2016-06-27-preview | update to latest swagger | +| arm/containerservice | 2016-09-30 | update to latest swagger | +| arm/datalake-analytics | 2016-11-01 | update to latest swagger | +| arm/datalake-store | 2016-11-01 | update to latest swagger | +| arm/disk | 2016-04-30-preview | new | +| arm/documentdb | 2015-04-08 | update to latest swagger | +| arm/iothub | 2016-02-03 | update to latest swagger | +| arm/keyvault | 2015-06-01 | update to latest swagger | +| arm/logic | 2016-06-01 | update to latest swagger | +| arm/machinelearning | 2016-05-01-preview | update to latest swagger | +| arm/mobileengagement | 2014-12-01 | update to latest swagger, refactor | +| arm/redis | 2016-04-01 | update to latest swagger | +| arm/resources/locks | 2016-09-01 | refactor | +| arm/resources/policy | 2016-12-01 | previous version was deleted | +| arm/resources/resources | 2016-09-01 | update to latest swagger, refactor | +| arm/scheduler | 2016-03-01 | refactor | +| arm/search | 2015-08-19 | refactor | +| arm/web | 2015-08-01 | refactor | + +## `v7.0.0-beta` + +| api | version | note | +|:------------------------------------|:-------------------|:-----------------------------------| +| arm/analysisservices | 2016-05-16 | new | +| arm/cdn | 2016-10-02 | update to latest swagger | +| arm/commerce | 2015-06-01-preview | new | +| arm/containerservice | 2016-09-30 | update to latest swagger | +| arm/containerregistry | 2016-06-27-preview | new | +| arm/datalake-analytics/account | 2016-11-01 | update to latest swagger | +| arm/datalake-store/account | 2016-11-01 | update to latest swagger | +| arm/datalake-store/filesystem | 2016-11-01 | update to latest swagger | +| arm/documentdb | 2015-04-08 | new | +| arm/machinelearning/commitmentplans | 2016-05-01-preview | new | +| arm/recoveryservices | 2016-06-01 | new | +| arm/resources/subscriptions | 2016-06-01 | new | +| arm/search | 2015-08-19 | update to latest swagger | +| arm/sql | 2014-04-01 | previous version was deleted | + +### Storage +- Can now update messages in storage queues. +- Added support for blob snapshots and aborting blob copy operations. +- Added support for getting and setting ACLs on containers. +- Added various APIs for file and directory manipulation. + +### Support for the following swagger extensions was added to the Go generator which affected codegen. +- x-ms-client-flatten +- x-ms-paramater-location + +## `v6.0.0-beta` + +| api | version | note | +|:-------------------------------|:-------------------|:-----------------------------------| +| arm/authorization | no change | code refactoring | +| arm/batch | no change | code refactoring | +| arm/compute | no change | code refactoring | +| arm/containerservice | 2016-03-30 | return | +| arm/datalake-analytics/account | 2015-10-01-preview | new | +| arm/datalake-store/filesystem | no change | moved to datalake-store/filesystem | +| arm/eventhub | no change | code refactoring | +| arm/intune | no change | code refactoring | +| arm/iothub | no change | code refactoring | +| arm/keyvault | no change | code refactoring | +| arm/mediaservices | no change | code refactoring | +| arm/network | no change | code refactoring | +| arm/notificationhubs | no change | code refactoring | +| arm/redis | no change | code refactoring | +| arm/resources/resources | no change | code refactoring | +| arm/resources/links | 2016-09-01 | new | +| arm/resources/locks | 2016-09-01 | updated | +| arm/resources/policy | no change | code refactoring | +| arm/resources/resources | 2016-09-01 | updated | +| arm/servermanagement | 2016-07-01-preview | updated | +| arm/web | no change | code refactoring | + +- storage: Added blob lease functionality and tests + +## `v5.0.0-beta` + +| api | version | note | +|:------------------------------|:--------------------|:-----------------| +| arm/network | 2016-09-01 | updated | +| arm/servermanagement | 2015-07-01-preview | new | +| arm/eventhub | 2015-08-01 | new | +| arm/containerservice | -- | removed | +| arm/resources/subscriptions | no change | code refactoring | +| arm/resources/features | no change | code refactoring | +| arm/resources/resources | no change | code refactoring | +| arm/datalake-store/accounts | no change | code refactoring | +| arm/datalake-store/filesystem | no change | code refactoring | +| arm/notificationhubs | no change | code refactoring | +| arm/redis | no change | code refactoring | + +- storage: Add more file storage share operations. +- azure-rest-api-specs/commit/b8cdc2c50a0872fc0039f20c2b6b33aa0c2af4bf +- Uses go-autorest v7.2.1 + +## `v4.0.0-beta` + +- arm/logic: breaking change in package logic. +- arm: parameter validation code added in all arm packages. +- Uses go-autorest v7.2.0. + + +## `v3.2.0-beta` + +| api | version | note | +|:----------------------------|:--------------------|:----------| +| arm/mediaservices | 2015-10-01 | new | +| arm/keyvault | 2015-06-01 | new | +| arm/iothub | 2016-02-03 | new | +| arm/datalake-store | 2015-12-01 | new | +| arm/network | 2016-06-01 | updated | +| arm/resources/resources | 2016-07-01 | updated | +| arm/resources/policy | 2016-04-01 | updated | +| arm/servicebus | 2015-08-01 | updated | + +- arm: uses go-autorest version v7.1.0. +- storage: fix for operating on blobs names containing special characters. +- storage: add SetBlobProperties(), update BlobProperties response fields. +- storage: make storage client work correctly with read-only secondary account. +- storage: add Azure Storage Emulator support. + + +## `v3.1.0-beta` + +- Added a new arm/compute/containerservice (2016-03-30) package +- Reintroduced NewxxClientWithBaseURI method. +- Uses go-autorest version - v7.0.7. + + +## `v3.0.0-beta` + +This release brings the Go SDK ARM packages up-to-date with Azure ARM Swagger files for most +services. Since the underlying [Swagger files](https://github.com/Azure/azure-rest-api-specs) +continue to change substantially, the ARM packages are still in *beta* status. + +The ARM packages now align with the following API versions (*highlighted* packages are new or +updated in this release): + +| api | version | note | +|:----------------------------|:--------------------|:----------| +| arm/authorization | 2015-07-01 | no change | +| arm/intune | 2015-01-14-preview | no change | +| arm/notificationhubs | 2014-09-01 | no change | +| arm/resources/features | 2015-12-01 | no change | +| arm/resources/subscriptions | 2015-11-01 | no change | +| arm/web | 2015-08-01 | no change | +| arm/cdn | 2016-04-02 | updated | +| arm/compute | 2016-03-30 | updated | +| arm/dns | 2016-04-01 | updated | +| arm/logic | 2015-08-01-preview | updated | +| arm/network | 2016-03-30 | updated | +| arm/redis | 2016-04-01 | updated | +| arm/resources/resources | 2016-02-01 | updated | +| arm/resources/policy | 2015-10-01-preview | updated | +| arm/resources/locks | 2015-01-01 | updated (resources/authorization earlier)| +| arm/scheduler | 2016-03-01 | updated | +| arm/storage | 2016-01-01 | updated | +| arm/search | 2015-02-28 | updated | +| arm/batch | 2015-12-01 | new | +| arm/cognitiveservices | 2016-02-01-preview | new | +| arm/devtestlabs | 2016-05-15 | new | +| arm/machinelearning | 2016-05-01-preview | new | +| arm/powerbiembedded | 2016-01-29 | new | +| arm/mobileengagement | 2014-12-01 | new | +| arm/servicebus | 2014-09-01 | new | +| arm/sql | 2015-05-01 | new | +| arm/trafficmanager | 2015-11-01 | new | + + +Below are some design changes. +- Removed Api version from method arguments. +- Removed New...ClientWithBaseURI() method in all clients. BaseURI value is set in client.go. +- Uses go-autorest version v7.0.6. + + +## `v2.2.0-beta` + +- Uses go-autorest version v7.0.5. +- Update version of pacakges "jwt-go" and "crypto" in glide.lock. + + +## `v2.1.1-beta` + +- arm: Better error messages for long running operation failures (Uses go-autorest version v7.0.4). + + +## `v2.1.0-beta` + +- arm: Uses go-autorest v7.0.3 (polling related updates). +- arm: Cancel channel argument added in long-running calls. +- storage: Allow caller to provide headers for DeleteBlob methods. +- storage: Enables connection sharing with http keepalive. +- storage: Add BlobPrefixes and Delimiter to BlobListResponse + + +## `v2.0.0-beta` + +- Uses go-autorest v6.0.0 (Polling and Asynchronous requests related changes). + + +## `v0.5.0-beta` + +Updated following packages to new API versions: +- arm/resources/features 2015-12-01 +- arm/resources/resources 2015-11-01 +- arm/resources/subscriptions 2015-11-01 + + +### Changes + + - SDK now uses go-autorest v3.0.0. + + + +## `v0.4.0-beta` + +This release brings the Go SDK ARM packages up-to-date with Azure ARM Swagger files for most +services. Since the underlying [Swagger files](https://github.com/Azure/azure-rest-api-specs) +continue to change substantially, the ARM packages are still in *beta* status. + +The ARM packages now align with the following API versions (*highlighted* packages are new or +updated in this release): + +- *arm/authorization 2015-07-01* +- *arm/cdn 2015-06-01* +- arm/compute 2015-06-15 +- arm/dns 2015-05-04-preview +- *arm/intune 2015-01-14-preview* +- arm/logic 2015-02-01-preview +- *arm/network 2015-06-15* +- *arm/notificationhubs 2014-09-01* +- arm/redis 2015-08-01 +- *arm/resources/authorization 2015-01-01* +- *arm/resources/features 2014-08-01-preview* +- *arm/resources/resources 2014-04-01-preview* +- *arm/resources/subscriptions 2014-04-01-preview* +- *arm/scheduler 2016-01-01* +- arm/storage 2015-06-15 +- arm/web 2015-08-01 + +### Changes + +- Moved the arm/authorization, arm/features, arm/resources, and arm/subscriptions packages under a new, resources, package (to reflect the corresponding Swagger structure) +- Added a new arm/authoriation (2015-07-01) package +- Added a new arm/cdn (2015-06-01) package +- Added a new arm/intune (2015-01-14-preview) package +- Udated arm/network (2015-06-01) +- Added a new arm/notificationhubs (2014-09-01) package +- Updated arm/scheduler (2016-01-01) package + + +----- + +## `v0.3.0-beta` + +- Corrected unintentional struct field renaming and client renaming in v0.2.0-beta + +----- + +## `v0.2.0-beta` + +- Added support for DNS, Redis, and Web site services +- Updated Storage service to API version 2015-06-15 +- Updated Network to include routing table support +- Address https://github.com/Azure/azure-sdk-for-go/issues/232 +- Address https://github.com/Azure/azure-sdk-for-go/issues/231 +- Address https://github.com/Azure/azure-sdk-for-go/issues/230 +- Address https://github.com/Azure/azure-sdk-for-go/issues/224 +- Address https://github.com/Azure/azure-sdk-for-go/issues/184 +- Address https://github.com/Azure/azure-sdk-for-go/issues/183 + +------ + +## `v0.1.1-beta` + +- Improves the UserAgent string to disambiguate arm packages from others in the SDK +- Improves setting the http.Response into generated results (reduces likelihood of a nil reference) +- Adds gofmt, golint, and govet to Travis CI for the arm packages + +##### Fixed Issues + +- https://github.com/Azure/azure-sdk-for-go/issues/196 +- https://github.com/Azure/azure-sdk-for-go/issues/213 + +------ + +## v0.1.0-beta + +This release addresses the issues raised against the alpha release and adds more features. Most +notably, to address the challenges of encoding JSON +(see the [comments](https://github.com/Azure/go-autorest#handling-empty-values) in the +[go-autorest](https://github.com/Azure/go-autorest) package) by using pointers for *all* structure +fields (with the exception of enumerations). The +[go-autorest/autorest/to](https://github.com/Azure/go-autorest/tree/master/autorest/to) package +provides helpers to convert to / from pointers. The examples demonstrate their usage. + +Additionally, the packages now align with Go coding standards and pass both `golint` and `govet`. +Accomplishing this required renaming various fields and parameters (such as changing Url to URL). + +##### Changes + +- Changed request / response structures to use pointer fields. +- Changed methods to return `error` instead of `autorest.Error`. +- Re-divided methods to ease asynchronous requests. +- Added paged results support. +- Added a UserAgent string. +- Added changes necessary to pass golint and govet. +- Updated README.md with details on asynchronous requests and paging. +- Saved package dependencies through Godep (for the entire SDK). + +##### Fixed Issues: + +- https://github.com/Azure/azure-sdk-for-go/issues/205 +- https://github.com/Azure/azure-sdk-for-go/issues/206 +- https://github.com/Azure/azure-sdk-for-go/issues/211 +- https://github.com/Azure/azure-sdk-for-go/issues/212 + +----- + +## v0.1.0-alpha + +This release introduces the Azure Resource Manager packages generated from the corresponding [Swagger API](http://swagger.io) [definitions](https://github.com/Azure/azure-rest-api-specs). \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/Gododir/gen.go b/vendor/github.com/Azure/azure-sdk-for-go/Gododir/gen.go index fc613858cd..6b68f16ebc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/Gododir/gen.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/Gododir/gen.go @@ -1,688 +1,688 @@ -package main - -// To run this package... -// go run gen.go -- --sdk 3.14.16 - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - - do "gopkg.in/godo.v2" -) - -type service struct { - Name string - Fullname string - Namespace string - Packages []string - TaskName string - Version string - Input string - Output string - Swagger string - SubServices []service - Modeler modeler - Extension extension -} - -type modeler string - -const ( - swagger modeler = "Swagger" - compSwagger modeler = "CompositeSwagger" -) - -type extension string - -const ( - md extension = "md" - json extension = "json" -) - -const ( - testsSubDir = "tests" -) - -type mapping struct { - Plane string - InputPrefix string - Services []service -} - -var ( - gopath = os.Getenv("GOPATH") - sdkVersion string - autorestDir string - swaggersDir string - testGen bool - deps do.S - services = []*service{} - servicesMapping = []mapping{ - { - Plane: "arm", - InputPrefix: "arm-", - Services: []service{ - { - Name: "advisor", - Version: "2017-04-19", - }, - { - Name: "analysisservices", - Version: "2016-05-16", - }, - { - Name: "apimanagement", - Swagger: "compositeApiManagementClient", - Modeler: compSwagger, - }, - { - Name: "appinsights", - Swagger: "compositeAppInsightsManagementClient", - Modeler: compSwagger, - }, - { - Name: "authorization", - Version: "2015-07-01", - }, - { - Name: "automation", - Swagger: "compositeAutomation", - Modeler: compSwagger, - }, - { - Name: "batch", - Version: "2017-01-01", - Swagger: "BatchManagement", - }, - { - Name: "billing", - Version: "2017-04-24-preview", - }, - { - Name: "cdn", - Version: "2016-10-02", - }, - { - // bug in AutoRest (duplicated files) - Name: "cognitiveservices", - // Version: "2017-04-18", - Version: "2016-02-01-preview", - }, - { - Name: "commerce", - Version: "2015-06-01-preview", - }, - { - Name: "compute", - Version: "2016-04-30-preview", - }, - { - Name: "containerservice", - Version: "2017-01-31", - Swagger: "containerService", - Input: "compute", - }, - { - Name: "consumption", - Version: "2017-04-24-preview", - }, - { - Name: "containerregistry", - Version: "2017-03-01", - }, - { - Name: "customer-insights", - Version: "2017-01-01", - }, - { - Name: "datalake-analytics", - SubServices: []service{ - { - Name: "account", - Version: "2016-11-01", - }, - }, - }, - { - Name: "datalake-store", - SubServices: []service{ - { - Name: "account", - Version: "2016-11-01", - }, - }, - }, - { - Name: "devtestlabs", - Version: "2016-05-15", - Swagger: "DTL", - }, - { - Name: "disk", - Version: "2016-04-30-preview", - Swagger: "disk", - Input: "compute", - }, - { - Name: "dns", - Version: "2016-04-01", - }, - { - Name: "documentdb", - Version: "2015-04-08", - }, - { - Name: "eventhub", - Version: "2015-08-01", - Swagger: "EventHub", - }, - { - Name: "graphrbac", - Swagger: "compositeGraphRbacManagementClient", - Modeler: compSwagger, - }, - { - Name: "hdinsight", - Swagger: "compositeHDInsight", - Modeler: compSwagger, - }, - { - Name: "insights", - Swagger: "compositeInsightsManagementClient", - Modeler: compSwagger, - }, - { - Name: "intune", - Version: "2015-01-14-preview", - }, - { - Name: "iothub", - Version: "2016-02-03", - }, - { - Name: "keyvault", - Version: "2015-06-01", - }, - { - Name: "logic", - Version: "2016-06-01", - }, - { - Name: "machinelearning", - SubServices: []service{ - { - Name: "commitmentplans", - Version: "2016-05-01-preview", - Swagger: "commitmentPlans", - Input: "machinelearning", - }, - { - Name: "webservices", - Version: "2017-01-01", - Input: "machinelearning", - }, - }, - }, - { - Name: "mediaservices", - Version: "2015-10-01", - Swagger: "media", - }, - { - Name: "mobileengagement", - Version: "2014-12-01", - Swagger: "mobile-engagement", - }, - { - Name: "monitor", - Swagger: "compositeMonitorManagementClient", - Modeler: compSwagger, - }, - { - Name: "network", - Swagger: "compositeNetworkClient", - Modeler: compSwagger, - }, - { - Name: "notificationhubs", - Version: "2017-04-01", - }, - { - // bug in the Go generator https://github.com/Azure/autorest/issues/2219 - Name: "operationalinsights", - // Swagger: "compositeOperationalInsights", - // Modeler: compSwagger, - Version: "2015-11-01-preview", - }, - { - Name: "powerbiembedded", - Version: "2016-01-29", - }, - { - // bug in the go generator - Name: "recoveryservices", - // Swagger: "compositeRecoveryServicesClient", - // Modeler: compSwagger, - Version: "2016-06-01", - Swagger: "vaults", - }, - { - // When using the readme.md, there is an exception in the modeler - Name: "recoveryservicesbackup", - Version: "2016-12-01", - // Swagger: "readme", - // Extension: md, - Swagger: "backupManagement", - }, - { - Name: "redis", - Version: "2016-04-01", - }, - { - Name: "relay", - Version: "2016-07-01", - }, - { - Name: "resourcehealth", - Version: "2015-01-01", - }, - { - Name: "resources", - SubServices: []service{ - { - Name: "features", - Version: "2015-12-01", - }, - { - Name: "links", - Version: "2016-09-01", - }, - { - Name: "locks", - Version: "2016-09-01", - }, - { - Name: "policy", - Version: "2016-12-01", - }, - { - Name: "resources", - Version: "2016-09-01", - // Version: "2017-05-10", - }, - { - Name: "subscriptions", - Version: "2016-06-01", - }, - }, - }, - { - Name: "scheduler", - Version: "2016-03-01", - }, - { - Name: "search", - Version: "2015-08-19", - }, - { - Name: "servermanagement", - Version: "2016-07-01-preview", - }, - { - Name: "service-map", - Version: "2015-11-01-preview", - Swagger: "arm-service-map", - }, - { - Name: "servicebus", - Version: "2015-08-01", - }, - { - Name: "servicefabric", - Version: "2016-09-01", - }, - { - Name: "sql", - Swagger: "compositeSql", - Modeler: compSwagger, - }, - { - Name: "storage", - Version: "2016-12-01", - }, - { - Name: "storageimportexport", - Version: "2016-11-01", - }, - // { - // Too soon to release - // Name: "storsimple8000series", - // Version: "2017-06-01". - // Swagger: "storsimple", - // }, - // { - // error in the modeler - // Name: "timeseriesinsights", - // Version: "2017-02-28-preview", - // }, - { - Name: "trafficmanager", - Version: "2015-11-01", - }, - { - Name: "web", - Swagger: "compositeWebAppClient", - Modeler: compSwagger, - }, - }, - }, - { - Plane: "dataplane", - InputPrefix: "", - Services: []service{ - // { - // Name: "batch", - // Version: "2017-01-01.4.0", - // Swagger: "BatchService", - // }, - // { - // Name: "insights", - // Swagger: "compositeInsightsClient", - // Modeler: compSwagger, - // }, - { - Name: "keyvault", - Version: "2016-10-01", - }, - // { - // Name: "monitor", - // Swagger: "compositeMonitorClient", - // Modeler: compSwagger, - // }, - // { - // Name: "search", - // SubServices: []service{ - // { - // Name: "searchindex", - // Version: "2016-09-01", - // Input: "search", - // }, - // { - // Name: "searchservice", - // Version: "2016-09-01", - // Input: "search", - // }, - // }, - // }, - // { - // Name: "servicefabric", - // Version: "2016-01-28", - // }, - }, - }, - { - Plane: "", - InputPrefix: "arm-", - Services: []service{ - { - Name: "datalake-store", - SubServices: []service{ - { - Name: "filesystem", - Version: "2016-11-01", - }, - }, - }, - // { - // Name: "datalake-analytics", - // SubServices: []service{ - // { - // Name: "catalog", - // Version: "2016-11-01", - // }, - // { - // Name: "job", - // Version: "2016-11-01", - // }, - // }, - // }, - }, - }, - } -) - -func main() { - for _, swaggerGroup := range servicesMapping { - swg := swaggerGroup - for _, service := range swg.Services { - s := service - initAndAddService(&s, swg.InputPrefix, swg.Plane) - } - } - do.Godo(tasks) -} - -func initAndAddService(service *service, inputPrefix, plane string) { - if service.Swagger == "" { - service.Swagger = service.Name - } - if service.Extension == "" { - service.Extension = json - } - packages := append(service.Packages, service.Name) - service.TaskName = fmt.Sprintf("%s>%s", plane, strings.Join(packages, ">")) - service.Fullname = filepath.Join(plane, strings.Join(packages, string(os.PathSeparator))) - if service.Modeler == compSwagger { - service.Input = filepath.Join(inputPrefix+strings.Join(packages, string(os.PathSeparator)), service.Swagger) - } else { - input := []string{} - if service.Input == "" { - input = append(input, inputPrefix+strings.Join(packages, string(os.PathSeparator))) - } else { - input = append(input, inputPrefix+service.Input) - } - input = append(input, service.Version) - if service.Extension == json { - input = append(input, "swagger") - } - input = append(input, service.Swagger) - service.Input = filepath.Join(input...) - service.Modeler = swagger - } - service.Namespace = filepath.Join("github.com", "Azure", "azure-sdk-for-go", service.Fullname) - service.Output = filepath.Join(gopath, "src", service.Namespace) - - if service.SubServices != nil { - for _, subs := range service.SubServices { - ss := subs - ss.Packages = append(ss.Packages, service.Name) - initAndAddService(&ss, inputPrefix, plane) - } - } else { - services = append(services, service) - deps = append(deps, service.TaskName) - } -} - -func tasks(p *do.Project) { - p.Task("default", do.S{"setvars", "generate:all", "management"}, nil) - p.Task("setvars", nil, setVars) - p.Use("generate", generateTasks) - p.Use("gofmt", formatTasks) - p.Use("gobuild", buildTasks) - p.Use("golint", lintTasks) - p.Use("govet", vetTasks) - p.Use("delete", deleteTasks) - p.Task("management", do.S{"setvars"}, managementVersion) -} - -func setVars(c *do.Context) { - if gopath == "" { - panic("Gopath not set\n") - } - - sdkVersion = c.Args.MustString("s", "sdk", "version") - autorestDir = c.Args.MayString("", "a", "ar", "autorest") - swaggersDir = c.Args.MayString("C:/", "w", "sw", "swagger") - testGen = c.Args.MayBool(false, "t", "testgen") -} - -func generateTasks(p *do.Project) { - addTasks(generate, p) -} - -func generate(service *service) { - codegen := "Go" - if testGen { - codegen = "Go.TestGen" - service.Fullname = strings.Join([]string{service.Fullname, testsSubDir}, string(os.PathSeparator)) - service.Output = filepath.Join(service.Output, testsSubDir) - } - - fmt.Printf("Generating %s...\n\n", service.Fullname) - - delete(service) - - execCommand := "autorest" - commandArgs := []string{ - "-Input", filepath.Join(swaggersDir, "azure-rest-api-specs", service.Input+"."+string(service.Extension)), - "-CodeGenerator", codegen, - "-Header", "MICROSOFT_APACHE", - "-Namespace", service.Name, - "-OutputDirectory", service.Output, - "-Modeler", string(service.Modeler), - "-pv", sdkVersion, - } - - // default to the current directory - workingDir := "" - - if autorestDir != "" { - // if an AutoRest directory was specified then assume - // the caller wants to use a locally-built version. - execCommand = "gulp" - commandArgs = append([]string{"autorest"}, commandArgs...) - workingDir = filepath.Join(autorestDir, "autorest") - } - - autorest := exec.Command(execCommand, commandArgs...) - autorest.Dir = workingDir - - if err := runner(autorest); err != nil { - panic(fmt.Errorf("Autorest error: %s", err)) - } - - format(service) - build(service) - lint(service) - vet(service) -} - -func deleteTasks(p *do.Project) { - addTasks(format, p) -} - -func delete(service *service) { - fmt.Printf("Deleting %s...\n\n", service.Fullname) - err := os.RemoveAll(service.Output) - if err != nil { - panic(fmt.Sprintf("Error deleting %s : %s\n", service.Output, err)) - } -} - -func formatTasks(p *do.Project) { - addTasks(format, p) -} - -func format(service *service) { - fmt.Printf("Formatting %s...\n\n", service.Fullname) - gofmt := exec.Command("gofmt", "-w", service.Output) - err := runner(gofmt) - if err != nil { - panic(fmt.Errorf("gofmt error: %s", err)) - } -} - -func buildTasks(p *do.Project) { - addTasks(build, p) -} - -func build(service *service) { - fmt.Printf("Building %s...\n\n", service.Fullname) - gobuild := exec.Command("go", "build", service.Namespace) - err := runner(gobuild) - if err != nil { - panic(fmt.Errorf("go build error: %s", err)) - } -} - -func lintTasks(p *do.Project) { - addTasks(lint, p) -} - -func lint(service *service) { - fmt.Printf("Linting %s...\n\n", service.Fullname) - golint := exec.Command(filepath.Join(gopath, "bin", "golint"), service.Namespace) - err := runner(golint) - if err != nil { - panic(fmt.Errorf("golint error: %s", err)) - } -} - -func vetTasks(p *do.Project) { - addTasks(vet, p) -} - -func vet(service *service) { - fmt.Printf("Vetting %s...\n\n", service.Fullname) - govet := exec.Command("go", "vet", service.Namespace) - err := runner(govet) - if err != nil { - panic(fmt.Errorf("go vet error: %s", err)) - } -} - -func managementVersion(c *do.Context) { - version("management") -} - -func version(packageName string) { - versionFile := filepath.Join(packageName, "version.go") - os.Remove(versionFile) - template := `package %s - -var ( - sdkVersion = "%s" -) -` - data := []byte(fmt.Sprintf(template, packageName, sdkVersion)) - ioutil.WriteFile(versionFile, data, 0644) -} - -func addTasks(fn func(*service), p *do.Project) { - for _, service := range services { - s := service - p.Task(s.TaskName, nil, func(c *do.Context) { - fn(s) - }) - } - p.Task("all", deps, nil) -} - -func runner(cmd *exec.Cmd) error { - var stdout, stderr bytes.Buffer - cmd.Stdout, cmd.Stderr = &stdout, &stderr - err := cmd.Run() - if stdout.Len() > 0 { - fmt.Println(stdout.String()) - } - if stderr.Len() > 0 { - fmt.Println(stderr.String()) - } - return err -} +package main + +// To run this package... +// go run gen.go -- --sdk 3.14.16 + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" + + do "gopkg.in/godo.v2" +) + +type service struct { + Name string + Fullname string + Namespace string + Packages []string + TaskName string + Version string + Input string + Output string + Swagger string + SubServices []service + Modeler modeler + Extension extension +} + +type modeler string + +const ( + swagger modeler = "Swagger" + compSwagger modeler = "CompositeSwagger" +) + +type extension string + +const ( + md extension = "md" + json extension = "json" +) + +const ( + testsSubDir = "tests" +) + +type mapping struct { + Plane string + InputPrefix string + Services []service +} + +var ( + gopath = os.Getenv("GOPATH") + sdkVersion string + autorestDir string + swaggersDir string + testGen bool + deps do.S + services = []*service{} + servicesMapping = []mapping{ + { + Plane: "arm", + InputPrefix: "arm-", + Services: []service{ + { + Name: "advisor", + Version: "2017-04-19", + }, + { + Name: "analysisservices", + Version: "2016-05-16", + }, + { + Name: "apimanagement", + Swagger: "compositeApiManagementClient", + Modeler: compSwagger, + }, + { + Name: "appinsights", + Swagger: "compositeAppInsightsManagementClient", + Modeler: compSwagger, + }, + { + Name: "authorization", + Version: "2015-07-01", + }, + { + Name: "automation", + Swagger: "compositeAutomation", + Modeler: compSwagger, + }, + { + Name: "batch", + Version: "2017-01-01", + Swagger: "BatchManagement", + }, + { + Name: "billing", + Version: "2017-04-24-preview", + }, + { + Name: "cdn", + Version: "2016-10-02", + }, + { + // bug in AutoRest (duplicated files) + Name: "cognitiveservices", + // Version: "2017-04-18", + Version: "2016-02-01-preview", + }, + { + Name: "commerce", + Version: "2015-06-01-preview", + }, + { + Name: "compute", + Version: "2016-04-30-preview", + }, + { + Name: "containerservice", + Version: "2017-01-31", + Swagger: "containerService", + Input: "compute", + }, + { + Name: "consumption", + Version: "2017-04-24-preview", + }, + { + Name: "containerregistry", + Version: "2017-03-01", + }, + { + Name: "customer-insights", + Version: "2017-01-01", + }, + { + Name: "datalake-analytics", + SubServices: []service{ + { + Name: "account", + Version: "2016-11-01", + }, + }, + }, + { + Name: "datalake-store", + SubServices: []service{ + { + Name: "account", + Version: "2016-11-01", + }, + }, + }, + { + Name: "devtestlabs", + Version: "2016-05-15", + Swagger: "DTL", + }, + { + Name: "disk", + Version: "2016-04-30-preview", + Swagger: "disk", + Input: "compute", + }, + { + Name: "dns", + Version: "2016-04-01", + }, + { + Name: "documentdb", + Version: "2015-04-08", + }, + { + Name: "eventhub", + Version: "2015-08-01", + Swagger: "EventHub", + }, + { + Name: "graphrbac", + Swagger: "compositeGraphRbacManagementClient", + Modeler: compSwagger, + }, + { + Name: "hdinsight", + Swagger: "compositeHDInsight", + Modeler: compSwagger, + }, + { + Name: "insights", + Swagger: "compositeInsightsManagementClient", + Modeler: compSwagger, + }, + { + Name: "intune", + Version: "2015-01-14-preview", + }, + { + Name: "iothub", + Version: "2016-02-03", + }, + { + Name: "keyvault", + Version: "2015-06-01", + }, + { + Name: "logic", + Version: "2016-06-01", + }, + { + Name: "machinelearning", + SubServices: []service{ + { + Name: "commitmentplans", + Version: "2016-05-01-preview", + Swagger: "commitmentPlans", + Input: "machinelearning", + }, + { + Name: "webservices", + Version: "2017-01-01", + Input: "machinelearning", + }, + }, + }, + { + Name: "mediaservices", + Version: "2015-10-01", + Swagger: "media", + }, + { + Name: "mobileengagement", + Version: "2014-12-01", + Swagger: "mobile-engagement", + }, + { + Name: "monitor", + Swagger: "compositeMonitorManagementClient", + Modeler: compSwagger, + }, + { + Name: "network", + Swagger: "compositeNetworkClient", + Modeler: compSwagger, + }, + { + Name: "notificationhubs", + Version: "2017-04-01", + }, + { + // bug in the Go generator https://github.com/Azure/autorest/issues/2219 + Name: "operationalinsights", + // Swagger: "compositeOperationalInsights", + // Modeler: compSwagger, + Version: "2015-11-01-preview", + }, + { + Name: "powerbiembedded", + Version: "2016-01-29", + }, + { + // bug in the go generator + Name: "recoveryservices", + // Swagger: "compositeRecoveryServicesClient", + // Modeler: compSwagger, + Version: "2016-06-01", + Swagger: "vaults", + }, + { + // When using the readme.md, there is an exception in the modeler + Name: "recoveryservicesbackup", + Version: "2016-12-01", + // Swagger: "readme", + // Extension: md, + Swagger: "backupManagement", + }, + { + Name: "redis", + Version: "2016-04-01", + }, + { + Name: "relay", + Version: "2016-07-01", + }, + { + Name: "resourcehealth", + Version: "2015-01-01", + }, + { + Name: "resources", + SubServices: []service{ + { + Name: "features", + Version: "2015-12-01", + }, + { + Name: "links", + Version: "2016-09-01", + }, + { + Name: "locks", + Version: "2016-09-01", + }, + { + Name: "policy", + Version: "2016-12-01", + }, + { + Name: "resources", + Version: "2016-09-01", + // Version: "2017-05-10", + }, + { + Name: "subscriptions", + Version: "2016-06-01", + }, + }, + }, + { + Name: "scheduler", + Version: "2016-03-01", + }, + { + Name: "search", + Version: "2015-08-19", + }, + { + Name: "servermanagement", + Version: "2016-07-01-preview", + }, + { + Name: "service-map", + Version: "2015-11-01-preview", + Swagger: "arm-service-map", + }, + { + Name: "servicebus", + Version: "2015-08-01", + }, + { + Name: "servicefabric", + Version: "2016-09-01", + }, + { + Name: "sql", + Swagger: "compositeSql", + Modeler: compSwagger, + }, + { + Name: "storage", + Version: "2016-12-01", + }, + { + Name: "storageimportexport", + Version: "2016-11-01", + }, + // { + // Too soon to release + // Name: "storsimple8000series", + // Version: "2017-06-01". + // Swagger: "storsimple", + // }, + // { + // error in the modeler + // Name: "timeseriesinsights", + // Version: "2017-02-28-preview", + // }, + { + Name: "trafficmanager", + Version: "2015-11-01", + }, + { + Name: "web", + Swagger: "compositeWebAppClient", + Modeler: compSwagger, + }, + }, + }, + { + Plane: "dataplane", + InputPrefix: "", + Services: []service{ + // { + // Name: "batch", + // Version: "2017-01-01.4.0", + // Swagger: "BatchService", + // }, + // { + // Name: "insights", + // Swagger: "compositeInsightsClient", + // Modeler: compSwagger, + // }, + { + Name: "keyvault", + Version: "2016-10-01", + }, + // { + // Name: "monitor", + // Swagger: "compositeMonitorClient", + // Modeler: compSwagger, + // }, + // { + // Name: "search", + // SubServices: []service{ + // { + // Name: "searchindex", + // Version: "2016-09-01", + // Input: "search", + // }, + // { + // Name: "searchservice", + // Version: "2016-09-01", + // Input: "search", + // }, + // }, + // }, + // { + // Name: "servicefabric", + // Version: "2016-01-28", + // }, + }, + }, + { + Plane: "", + InputPrefix: "arm-", + Services: []service{ + { + Name: "datalake-store", + SubServices: []service{ + { + Name: "filesystem", + Version: "2016-11-01", + }, + }, + }, + // { + // Name: "datalake-analytics", + // SubServices: []service{ + // { + // Name: "catalog", + // Version: "2016-11-01", + // }, + // { + // Name: "job", + // Version: "2016-11-01", + // }, + // }, + // }, + }, + }, + } +) + +func main() { + for _, swaggerGroup := range servicesMapping { + swg := swaggerGroup + for _, service := range swg.Services { + s := service + initAndAddService(&s, swg.InputPrefix, swg.Plane) + } + } + do.Godo(tasks) +} + +func initAndAddService(service *service, inputPrefix, plane string) { + if service.Swagger == "" { + service.Swagger = service.Name + } + if service.Extension == "" { + service.Extension = json + } + packages := append(service.Packages, service.Name) + service.TaskName = fmt.Sprintf("%s>%s", plane, strings.Join(packages, ">")) + service.Fullname = filepath.Join(plane, strings.Join(packages, string(os.PathSeparator))) + if service.Modeler == compSwagger { + service.Input = filepath.Join(inputPrefix+strings.Join(packages, string(os.PathSeparator)), service.Swagger) + } else { + input := []string{} + if service.Input == "" { + input = append(input, inputPrefix+strings.Join(packages, string(os.PathSeparator))) + } else { + input = append(input, inputPrefix+service.Input) + } + input = append(input, service.Version) + if service.Extension == json { + input = append(input, "swagger") + } + input = append(input, service.Swagger) + service.Input = filepath.Join(input...) + service.Modeler = swagger + } + service.Namespace = filepath.Join("github.com", "Azure", "azure-sdk-for-go", service.Fullname) + service.Output = filepath.Join(gopath, "src", service.Namespace) + + if service.SubServices != nil { + for _, subs := range service.SubServices { + ss := subs + ss.Packages = append(ss.Packages, service.Name) + initAndAddService(&ss, inputPrefix, plane) + } + } else { + services = append(services, service) + deps = append(deps, service.TaskName) + } +} + +func tasks(p *do.Project) { + p.Task("default", do.S{"setvars", "generate:all", "management"}, nil) + p.Task("setvars", nil, setVars) + p.Use("generate", generateTasks) + p.Use("gofmt", formatTasks) + p.Use("gobuild", buildTasks) + p.Use("golint", lintTasks) + p.Use("govet", vetTasks) + p.Use("delete", deleteTasks) + p.Task("management", do.S{"setvars"}, managementVersion) +} + +func setVars(c *do.Context) { + if gopath == "" { + panic("Gopath not set\n") + } + + sdkVersion = c.Args.MustString("s", "sdk", "version") + autorestDir = c.Args.MayString("", "a", "ar", "autorest") + swaggersDir = c.Args.MayString("C:/", "w", "sw", "swagger") + testGen = c.Args.MayBool(false, "t", "testgen") +} + +func generateTasks(p *do.Project) { + addTasks(generate, p) +} + +func generate(service *service) { + codegen := "Go" + if testGen { + codegen = "Go.TestGen" + service.Fullname = strings.Join([]string{service.Fullname, testsSubDir}, string(os.PathSeparator)) + service.Output = filepath.Join(service.Output, testsSubDir) + } + + fmt.Printf("Generating %s...\n\n", service.Fullname) + + delete(service) + + execCommand := "autorest" + commandArgs := []string{ + "-Input", filepath.Join(swaggersDir, "azure-rest-api-specs", service.Input+"."+string(service.Extension)), + "-CodeGenerator", codegen, + "-Header", "MICROSOFT_APACHE", + "-Namespace", service.Name, + "-OutputDirectory", service.Output, + "-Modeler", string(service.Modeler), + "-pv", sdkVersion, + } + + // default to the current directory + workingDir := "" + + if autorestDir != "" { + // if an AutoRest directory was specified then assume + // the caller wants to use a locally-built version. + execCommand = "gulp" + commandArgs = append([]string{"autorest"}, commandArgs...) + workingDir = filepath.Join(autorestDir, "autorest") + } + + autorest := exec.Command(execCommand, commandArgs...) + autorest.Dir = workingDir + + if err := runner(autorest); err != nil { + panic(fmt.Errorf("Autorest error: %s", err)) + } + + format(service) + build(service) + lint(service) + vet(service) +} + +func deleteTasks(p *do.Project) { + addTasks(format, p) +} + +func delete(service *service) { + fmt.Printf("Deleting %s...\n\n", service.Fullname) + err := os.RemoveAll(service.Output) + if err != nil { + panic(fmt.Sprintf("Error deleting %s : %s\n", service.Output, err)) + } +} + +func formatTasks(p *do.Project) { + addTasks(format, p) +} + +func format(service *service) { + fmt.Printf("Formatting %s...\n\n", service.Fullname) + gofmt := exec.Command("gofmt", "-w", service.Output) + err := runner(gofmt) + if err != nil { + panic(fmt.Errorf("gofmt error: %s", err)) + } +} + +func buildTasks(p *do.Project) { + addTasks(build, p) +} + +func build(service *service) { + fmt.Printf("Building %s...\n\n", service.Fullname) + gobuild := exec.Command("go", "build", service.Namespace) + err := runner(gobuild) + if err != nil { + panic(fmt.Errorf("go build error: %s", err)) + } +} + +func lintTasks(p *do.Project) { + addTasks(lint, p) +} + +func lint(service *service) { + fmt.Printf("Linting %s...\n\n", service.Fullname) + golint := exec.Command(filepath.Join(gopath, "bin", "golint"), service.Namespace) + err := runner(golint) + if err != nil { + panic(fmt.Errorf("golint error: %s", err)) + } +} + +func vetTasks(p *do.Project) { + addTasks(vet, p) +} + +func vet(service *service) { + fmt.Printf("Vetting %s...\n\n", service.Fullname) + govet := exec.Command("go", "vet", service.Namespace) + err := runner(govet) + if err != nil { + panic(fmt.Errorf("go vet error: %s", err)) + } +} + +func managementVersion(c *do.Context) { + version("management") +} + +func version(packageName string) { + versionFile := filepath.Join(packageName, "version.go") + os.Remove(versionFile) + template := `package %s + +var ( + sdkVersion = "%s" +) +` + data := []byte(fmt.Sprintf(template, packageName, sdkVersion)) + ioutil.WriteFile(versionFile, data, 0644) +} + +func addTasks(fn func(*service), p *do.Project) { + for _, service := range services { + s := service + p.Task(s.TaskName, nil, func(c *do.Context) { + fn(s) + }) + } + p.Task("all", deps, nil) +} + +func runner(cmd *exec.Cmd) error { + var stdout, stderr bytes.Buffer + cmd.Stdout, cmd.Stderr = &stdout, &stderr + err := cmd.Run() + if stdout.Len() > 0 { + fmt.Println(stdout.String()) + } + if stderr.Len() > 0 { + fmt.Println(stderr.String()) + } + return err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE index 9cf48bdcfb..af39a91e70 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/LICENSE +++ b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE @@ -1,202 +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 2016 Microsoft Corporation - - 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. + + 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 2016 Microsoft Corporation + + 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/Azure/azure-sdk-for-go/README.md b/vendor/github.com/Azure/azure-sdk-for-go/README.md index dde81d81f3..a95cd5be7d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/README.md @@ -1,59 +1,59 @@ -# Microsoft Azure SDK for Go -[![GoDoc](https://godoc.org/github.com/Azure/azure-sdk-for-go?status.svg)](https://godoc.org/github.com/Azure/azure-sdk-for-go) -[![Build Status](https://travis-ci.org/Azure/azure-sdk-for-go.svg?branch=master)](https://travis-ci.org/Azure/azure-sdk-for-go) -[![Go Report Card](https://goreportcard.com/badge/github.com/Azure/azure-sdk-for-go)](https://goreportcard.com/report/github.com/Azure/azure-sdk-for-go) - -This is Microsoft Azure's core repository for hosting Go packages which offer a more convenient way of targeting Azure -REST endpoints. Here, you'll find a mix of code generated by [Autorest](https://github.com/Azure/autorest) and hand -maintained packages. - -> **NOTE:** This repository is under heavy ongoing development and should be considered a preview. Vendoring your -dependencies is always a good idea, but it is doubly important if you're consuming this library. - -# Installation -- If you don't already have it, install [the Go Programming Language](https://golang.org/dl/). -- Go get the SDK: - -``` -$ go get -u github.com/Azure/azure-sdk-for-go -``` - -> **IMPORTANT:** We highly suggest vendoring Azure SDK for Go as a dependency. For vendoring dependencies, Azure SDK -for Go uses [glide](https://github.com/Masterminds/glide). - -# Versioning -## SDK Versions -The tags in this repository are based on, but do not conform to [SemVer.org's recommendations](http://semver.org/). -For now, the "-beta" tag is an indicator that we are still in preview and still are planning on releasing some breaking -changes. - -## Azure Versions -Azure services _mostly_ do not use SemVer based versions. Rather, they use profiles identified by dates. One will often -see this casually referred to as an "APIVersion". At the moment, our SDK only supports the most recent profiles. In -order to lock to an API version, one must also lock to an SDK version. However, as discussed in -[#517](https://github.com/Azure/azure-sdk-for-go/issues/517), our objective is to reorganize and publish independent -packages for each profile. In that way, we'll be able to have parallel support in a single SDK version for all -APIVersions supported by Azure. - -# Documentation - -- Azure SDK for Go Documentation is available at [GoDoc.org](http://godoc.org/github.com/Azure/azure-sdk-for-go/). -- Azure REST APIs used by packages in this repository are documented at [Microsoft Docs, Azure REST](https://docs.microsoft.com/en-us/rest/api/). -- Azure Services are discussed in detail at [Microsoft Docs, Azure Services](https://docs.microsoft.com/en-us/azure/#pivot=services). - -# Code samples - -- [Getting Started with Azure Blob Service in Go](https://github.com/Azure-Samples/storage-blob-go-getting-started) - -# License - -This project is published under [Apache 2.0 License](LICENSE). - -# Contribute - -If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft -Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact -[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +# Microsoft Azure SDK for Go +[![GoDoc](https://godoc.org/github.com/Azure/azure-sdk-for-go?status.svg)](https://godoc.org/github.com/Azure/azure-sdk-for-go) +[![Build Status](https://travis-ci.org/Azure/azure-sdk-for-go.svg?branch=master)](https://travis-ci.org/Azure/azure-sdk-for-go) +[![Go Report Card](https://goreportcard.com/badge/github.com/Azure/azure-sdk-for-go)](https://goreportcard.com/report/github.com/Azure/azure-sdk-for-go) + +This is Microsoft Azure's core repository for hosting Go packages which offer a more convenient way of targeting Azure +REST endpoints. Here, you'll find a mix of code generated by [Autorest](https://github.com/Azure/autorest) and hand +maintained packages. + +> **NOTE:** This repository is under heavy ongoing development and should be considered a preview. Vendoring your +dependencies is always a good idea, but it is doubly important if you're consuming this library. + +# Installation +- If you don't already have it, install [the Go Programming Language](https://golang.org/dl/). +- Go get the SDK: + +``` +$ go get -u github.com/Azure/azure-sdk-for-go +``` + +> **IMPORTANT:** We highly suggest vendoring Azure SDK for Go as a dependency. For vendoring dependencies, Azure SDK +for Go uses [glide](https://github.com/Masterminds/glide). + +# Versioning +## SDK Versions +The tags in this repository are based on, but do not conform to [SemVer.org's recommendations](http://semver.org/). +For now, the "-beta" tag is an indicator that we are still in preview and still are planning on releasing some breaking +changes. + +## Azure Versions +Azure services _mostly_ do not use SemVer based versions. Rather, they use profiles identified by dates. One will often +see this casually referred to as an "APIVersion". At the moment, our SDK only supports the most recent profiles. In +order to lock to an API version, one must also lock to an SDK version. However, as discussed in +[#517](https://github.com/Azure/azure-sdk-for-go/issues/517), our objective is to reorganize and publish independent +packages for each profile. In that way, we'll be able to have parallel support in a single SDK version for all +APIVersions supported by Azure. + +# Documentation + +- Azure SDK for Go Documentation is available at [GoDoc.org](http://godoc.org/github.com/Azure/azure-sdk-for-go/). +- Azure REST APIs used by packages in this repository are documented at [Microsoft Docs, Azure REST](https://docs.microsoft.com/en-us/rest/api/). +- Azure Services are discussed in detail at [Microsoft Docs, Azure Services](https://docs.microsoft.com/en-us/azure/#pivot=services). + +# Code samples + +- [Getting Started with Azure Blob Service in Go](https://github.com/Azure-Samples/storage-blob-go-getting-started) + +# License + +This project is published under [Apache 2.0 License](LICENSE). + +# Contribute + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact +[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/README.md b/vendor/github.com/Azure/azure-sdk-for-go/arm/README.md index 549ad7a616..ec781f17a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/README.md @@ -1,285 +1,285 @@ -# Introducing the Azure Resource Manager packages for Go - -The `github.com/Azure/azure-sdk-for-go/arm` packages are used to perform operations using the Azure Resource Manager (ARM). Read more about [Azure Resource Manager vs. classic deployment](https://azure.microsoft.com/documentation/articles/resource-manager-deployment-model/). Packages for Azure Service Manager or classic deployment are in the [management](https://github.com/Azure/azure-sdk-for-go/tree/master/management) folder. - - -## How Did We Get Here? - -Azure is growing rapidly, regularly adding new services and features. While rapid growth -is good for users, it is hard on SDKs. Each new service and each new feature requires someone to -learn the details and add the needed code to the SDK. As a result, the -[Azure SDK for Go](https://github.com/Azure/azure-sdk-for-go) -has lagged behind Azure. It is missing -entire services and has not kept current with features. There is simply too much change to maintain -a hand-written SDK. - -For this reason, the -[Azure SDK for Go](https://github.com/Azure/azure-sdk-for-go), -with the release of the Azure Resource Manager (ARM) -packages, is transitioning to a generated-code model. Other Azure SDKs, notably the -[Azure SDK for .NET](https://github.com/Azure/azure-sdk-for-net), have successfully adopted a -generated-code strategy. Recently, Microsoft published the -[AutoRest](https://github.com/Azure/autorest) tool used to create these SDKs and we have been adding support for Go. The ARM packages are -the first set generated using this new toolchain. The input for AutoRest are the [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs), files in Swagger JSON format. - -There are a couple of items to note. First, since both the tooling and the underlying support -packages are new, the code is not yet "production ready". Treat these packages as of -***beta*** quality. -That's not to say we don't believe in the code, but we want to see what others think and how well -they work in a variety of environments before settling down into an official, first release. If you -find problems or have suggestions, please submit a pull request to document what you find. However, -since the code is generated, we'll use your pull request to guide changes we make to the underlying -generator versus merging the pull request itself. - -The second item of note is that, to keep the generated code clean and reliable, it depends on -another new package [go-autorest](https://github.com/Azure/go-autorest). -Though part of the SDK, we separated the code to better control versioning and maintain agility. -Since -[go-autorest](https://github.com/Azure/go-autorest) -is hand-crafted, we will take pull requests in the same manner as for our other repositories. - -We intend to rapidly improve these packages until they are "production ready". -So, try them out and give us your thoughts. - -## What Have We Done? - -Creating new frameworks is hard and often leads to "cliffs": The code is easy to use until some -special case or tweak arises and then, well, then you're stuck. Often times small differences in -requirements can lead to forking the code and investing a lot of time. Cliffs occur even more -frequently in generated code. We wanted to avoid them and believe the new model does. Our initial -goals were: - -* Easy-to-use out of the box. It should be "clone and go" for straight-forward use. -* Easy composition to handle the majority of complex cases. -* Easy to integrate with existing frameworks, fit nicely with channels, supporting fan-out / -fan-in set ups. - -These are best shown in a series of examples, all of which are included in the -[examples](/arm/examples) sub-folder. - -## How is the SDK tested? - -Testing the SDK is currently a work in progress. It includes three different points: - -* Test the [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs) against the APIs themselves. This way we can find if the specs are reflecting correctly the API behavior. All Azure SDKs can benefit from this tests. -* Add [acceptance tests](https://github.com/Azure/autorest/blob/master/docs/developer/guide/writing-tests.md) to AutoRest. -* Test the generated SDK with code samples. This would catch bugs that escaped the previous tests, and provide some documentation. - - -## First a Sidenote: Authentication and the Azure Resource Manager - -Before using the Azure Resource Manager packages, you need to understand how it authenticates and -authorizes requests. -Azure Resource Manager requests can be authorized through [OAuth2](http://oauth.net). While OAuth2 provides many advantages over -certificates, programmatic use, such as for scripts on headless servers, requires understanding and -creating one or more *Service Principals.* - -The Azure-SDK-for-Node has an excellent tutorial that includes instructions for how to create Service Principals in the Portal and using the Azure CLI, both of which are applicable to Go. -Find that documentation here: [Authenticaion, Azure/azure-sdk-for-node](https://github.com/Azure/azure-sdk-for-node/blob/master/Documentation/Authentication.md) - -In addition, there are several good blog posts, such as -[Automating Azure on your CI server using a Service Principal](http://blog.davidebbo.com/2014/12/azure-service-principal.html) -and -[Microsoft Azure REST API + OAuth 2.0](https://ahmetalpbalkan.com/blog/azure-rest-api-with-oauth2/), -that describe what this means. -For details on creating and authorizing Service Principals, see the MSDN articles -[Azure API Management REST API Authentication](https://msdn.microsoft.com/library/azure/5b13010a-d202-4af5-aabf-7ebc26800b3d) -and -[Create a new Azure Service Principal using the Azure portal](https://azure.microsoft.com/documentation/articles/resource-group-create-service-principal-portal/). -Dushyant Gill, a Senior Program Manager for Azure Active Directory, has written an extensive blog -post, -[Developer's Guide to Auth with Azure Resource Manager API](http://www.dushyantgill.com/blog/2015/05/23/developers-guide-to-auth-with-azure-resource-manager-api/), -that is also quite helpful. - -### Complete source code - -Get code for a full example of [authenticating to Azure via certificate or device authorization](https://github.com/Azure/go-autorest/tree/master/autorest/azure/example). - -## A Simple Example: Checking availability of name within Azure Storage - -Each ARM provider, such as -[Azure Storage](http://azure.microsoft.com/documentation/services/storage/) -or -[Azure Compute](https://azure.microsoft.com/documentation/services/virtual-machines/), -has its own package. Start by importing -the packages for the providers you need. Next, most packages divide their APIs across multiple -clients to avoid name collision and improve usability. For example, the -[Azure Storage](http://azure.microsoft.com/documentation/services/storage/) -package has -two clients: -[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient) -and -[storage.UsageOperationsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#UsageOperationsClient). -To check if a name is available, use the -[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient). - -Each ARM client composes with [autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client). -[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) -enables altering the behavior of the API calls by leveraging the decorator pattern of -[go-autorest](https://github.com/Azure/go-autorest). For example, in the code above, the -[azure.ServicePrincipalToken](https://godoc.org/github.com/Azure/go-autorest/autorest/azure#ServicePrincipalToken) -includes a -[WithAuthorization](https://godoc.org/github.com/Azure/go-autorest/autorest#Client.WithAuthorization) -[autorest.PrepareDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#PrepareDecorator) -that applies the OAuth2 authorization token to the request. It will, as needed, refresh the token -using the supplied credentials. - -Providing a decorated -[autorest.Sender](https://godoc.org/github.com/Azure/go-autorest/autorest#Sender) or populating -the [autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) -with a custom -[autorest.PrepareDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#PrepareDecorator) -or -[autorest.RespondDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#RespondDecorator) -enables more control. See the included example file -[check.go](/arm/examples/check/check.go) -for more details. Through these you can modify the outgoing request, inspect the incoming response, -or even go so far as to provide a -[circuit breaker](https://msdn.microsoft.com/library/dn589784.aspx) -to protect your service from unexpected latencies. - -Lastly, all Azure ARM API calls return an instance of -[autorest.DetailedError](https://godoc.org/github.com/Azure/go-autorest/autorest#DetailedError). -Not only DetailedError gives anonymous access to the original -[error](http://golang.org/ref/spec#Errors), -but provides the package type (e.g., -[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient)), -the failing method (e.g., -[CheckNameAvailability](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient.CheckNameAvailability)), -and a detailed error message. - -### Complete source code - -Complete source code for this example can be found in [check.go](/arm/examples/check/check.go). - -1. Create a [service principal](https://azure.microsoft.com/documentation/articles/resource-group-authenticate-service-principal-cli/). You will need the Tenant ID, Client ID and Client Secret for [authentication](#first-a-sidenote-authentication-and-the-azure-resource-manager), so keep them as soon as you get them. -2. Get your Azure Subscription ID using either of the methods mentioned below: - - Get it through the [portal](portal.azure.com) in the subscriptions section. - - Get it using the [Azure CLI](https://azure.microsoft.com/documentation/articles/xplat-cli-install/) with command `azure account show`. - - Get it using [Azure Powershell](https://azure.microsoft.com/documentation/articles/powershell-install-configure/) with cmdlet `Get-AzureRmSubscription`. -3. Set environment variables `AZURE_TENANT_ID = `, `AZURE_CLIENT_ID = `, `AZURE_CLIENT_SECRET = ` and `AZURE_SUBSCRIPTION_ID = `. -4. Run the sample with commands: - -``` -$ cd arm/examples/check -$ go run check.go -``` - -## Something a Bit More Complex: Creating a new Azure Storage account - -Redundancy, both local and across regions, and service load affect service responsiveness. Some -API calls will return before having completed the request. An Azure ARM API call indicates the -request is incomplete (versus the request failed for some reason) by returning HTTP status code -'202 Accepted.' The -[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) -composed into -all of the Azure ARM clients, provides support for basic request polling. The default is to -poll until a specified duration has passed (with polling frequency determined by the -HTTP [Retry-After](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37) -header in the response). By changing the -[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) -settings, you can poll for a fixed number of attempts or elect to not poll at all. - -Whether you elect to poll or not, all Azure ARM client responses compose with an instance of -[autorest.Response](https://godoc.org/github.com/Azure/go-autorest/autorest#Response). -At present, -[autorest.Response](https://godoc.org/github.com/Azure/go-autorest/autorest#Response) -only composes over the standard -[http.Response](https://golang.org/pkg/net/http/#Response) -object (that may change as we implement more features). When your code receives an error from an -Azure ARM API call, you may find it useful to inspect the HTTP status code contained in the returned -[autorest.Response](https://godoc.org/github.com/Azure/go-autorest/autorest#Response). -If, for example, it is an HTTP 202, then you can use the -[GetPollingLocation](https://godoc.org/github.com/Azure/go-autorest/autorest#Response.GetPollingLocation) -response method to extract the URL at which to continue polling. Similarly, the -[GetPollingDelay](https://godoc.org/github.com/Azure/go-autorest/autorest#Response.GetPollingDelay) -response method returns, as a -[time.Duration](http://golang.org/pkg/time/#Duration), -the service suggested minimum polling delay. - -Creating a new Azure storage account is a straight-forward way to see these concepts. - -[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) -portion of the -[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient) -to poll for a fixed number of attempts versus polling for a set duration (which is the default). -If an error occurs creating the storage account, the code inspects the HTTP status code and -prints the URL the -[Azure Storage](http://azure.microsoft.com/documentation/services/storage/) -service returned for polling. - -### Complete source for the example -More details, including deleting the created account, are in the example code file [create.go](/arm/examples/create/create.go) - -1. Create a [service principal](https://azure.microsoft.com/documentation/articles/resource-group-authenticate-service-principal-cli/). You will need the Tenant ID, Client ID and Client Secret for [authentication](#first-a-sidenote-authentication-and-the-azure-resource-manager), so keep them as soon as you get them. -2. Get your Azure Subscription ID using either of the methods mentioned below: - - Get it through the [portal](portal.azure.com) in the subscriptions section. - - Get it using the [Azure CLI](https://azure.microsoft.com/documentation/articles/xplat-cli-install/) with command `azure account show`. - - Get it using [Azure Powershell](https://azure.microsoft.com/documentation/articles/powershell-install-configure/) with cmdlet `Get-AzureRmSubscription`. -3. Set environment variables `AZURE_TENANT_ID = `, `AZURE_CLIENT_ID = `, `AZURE_CLIENT_SECRET = ` and `AZURE_SUBSCRIPTION_ID = `. -4. Create a resource group and add its name in the first line of the main function. -5. Run the example with commands: - -``` -$ cd arm/examples/create -$ go run create.go -``` - - -## Making Asynchronous Requests - -One of Go's many strong points is how natural it makes sending and managing asynchronous requests -by means of goroutines. We wanted the ARM packages to fit naturally in the variety of asynchronous -patterns used in Go code, but also be straight-forward for simple use cases. We accomplished both -by adopting a pattern for all APIs. Each package API includes (at least) four methods -(more if the API returns a paged result set). For example, for an API call named `Foo` the package -defines: - -- `FooPreparer`: This method accepts the arguments for the API and returns a prepared -`http.Request`. -- `FooSender`: This method sends the prepared `http.Request`. It handles the possible status codes -and will, unless the disabled in the [autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client), handling polling. -- `FooResponder`: This method accepts and handles the `http.Response` returned by the sender -and unmarshals the JSON, if any, into the result. -- `Foo`: This method accepts the arguments for the API and returns the result. It is a wrapper -around the `FooPreparer`, `FooSender`, and `FooResponder`. - -By using the preparer, sender, and responder methods, package users can spread request and -response handling across goroutines as needed. Further, adding a cancel channel to the -`http.Response` (most easily through a -[PrepareDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#PrepareDecorator)), -enables canceling sent requests (see the documentation on -[http.Request](https://golang.org/pkg/net/http/#Request)) for details. - -## Paged Result Sets - -Some API calls return partial results. Typically, when they do, the result structure will include -a `Value` array and a `NextLink` URL. The `NextLink` URL is used to retrieve the next page or -block of results. - -The packages add two methods to make working with and retrieving paged results natural. First, -on paged result structures, the packages include a preparer method that returns an `http.Request` -for the next set of results. For a result set returned in a structure named `FooResults`, the -package will include a method named `FooResultsPreparer`. If the `NextLink` is `nil` or empty, the -method returns `nil`. - -The corresponding API (which typically includes "List" in the name) has a method to ease retrieving -the next result set given a result set. For example, for an API named `FooList`, the package will -include `FooListNextResults` that accepts the results of the last call and returns the next set. - -## Summing Up - -The new Azure Resource Manager packages for the Azure SDK for Go are a big step toward keeping the -SDK current with Azure's rapid growth. -As mentioned, we intend to rapidly stabilize these packages for production use. -We'll also add more examples, including some highlighting the -[Azure Resource Manager Templates](https://msdn.microsoft.com/library/azure/dn790568.aspx) -and the other providers. - -So, give the packages a try, explore the various ARM providers, and let us know what you think. - -We look forward to hearing from you! - -## License - -See the Azure SDK for Go LICENSE file. +# Introducing the Azure Resource Manager packages for Go + +The `github.com/Azure/azure-sdk-for-go/arm` packages are used to perform operations using the Azure Resource Manager (ARM). Read more about [Azure Resource Manager vs. classic deployment](https://azure.microsoft.com/documentation/articles/resource-manager-deployment-model/). Packages for Azure Service Manager or classic deployment are in the [management](https://github.com/Azure/azure-sdk-for-go/tree/master/management) folder. + + +## How Did We Get Here? + +Azure is growing rapidly, regularly adding new services and features. While rapid growth +is good for users, it is hard on SDKs. Each new service and each new feature requires someone to +learn the details and add the needed code to the SDK. As a result, the +[Azure SDK for Go](https://github.com/Azure/azure-sdk-for-go) +has lagged behind Azure. It is missing +entire services and has not kept current with features. There is simply too much change to maintain +a hand-written SDK. + +For this reason, the +[Azure SDK for Go](https://github.com/Azure/azure-sdk-for-go), +with the release of the Azure Resource Manager (ARM) +packages, is transitioning to a generated-code model. Other Azure SDKs, notably the +[Azure SDK for .NET](https://github.com/Azure/azure-sdk-for-net), have successfully adopted a +generated-code strategy. Recently, Microsoft published the +[AutoRest](https://github.com/Azure/autorest) tool used to create these SDKs and we have been adding support for Go. The ARM packages are +the first set generated using this new toolchain. The input for AutoRest are the [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs), files in Swagger JSON format. + +There are a couple of items to note. First, since both the tooling and the underlying support +packages are new, the code is not yet "production ready". Treat these packages as of +***beta*** quality. +That's not to say we don't believe in the code, but we want to see what others think and how well +they work in a variety of environments before settling down into an official, first release. If you +find problems or have suggestions, please submit a pull request to document what you find. However, +since the code is generated, we'll use your pull request to guide changes we make to the underlying +generator versus merging the pull request itself. + +The second item of note is that, to keep the generated code clean and reliable, it depends on +another new package [go-autorest](https://github.com/Azure/go-autorest). +Though part of the SDK, we separated the code to better control versioning and maintain agility. +Since +[go-autorest](https://github.com/Azure/go-autorest) +is hand-crafted, we will take pull requests in the same manner as for our other repositories. + +We intend to rapidly improve these packages until they are "production ready". +So, try them out and give us your thoughts. + +## What Have We Done? + +Creating new frameworks is hard and often leads to "cliffs": The code is easy to use until some +special case or tweak arises and then, well, then you're stuck. Often times small differences in +requirements can lead to forking the code and investing a lot of time. Cliffs occur even more +frequently in generated code. We wanted to avoid them and believe the new model does. Our initial +goals were: + +* Easy-to-use out of the box. It should be "clone and go" for straight-forward use. +* Easy composition to handle the majority of complex cases. +* Easy to integrate with existing frameworks, fit nicely with channels, supporting fan-out / +fan-in set ups. + +These are best shown in a series of examples, all of which are included in the +[examples](/arm/examples) sub-folder. + +## How is the SDK tested? + +Testing the SDK is currently a work in progress. It includes three different points: + +* Test the [Azure REST API specs](https://github.com/Azure/azure-rest-api-specs) against the APIs themselves. This way we can find if the specs are reflecting correctly the API behavior. All Azure SDKs can benefit from this tests. +* Add [acceptance tests](https://github.com/Azure/autorest/blob/master/docs/developer/guide/writing-tests.md) to AutoRest. +* Test the generated SDK with code samples. This would catch bugs that escaped the previous tests, and provide some documentation. + + +## First a Sidenote: Authentication and the Azure Resource Manager + +Before using the Azure Resource Manager packages, you need to understand how it authenticates and +authorizes requests. +Azure Resource Manager requests can be authorized through [OAuth2](http://oauth.net). While OAuth2 provides many advantages over +certificates, programmatic use, such as for scripts on headless servers, requires understanding and +creating one or more *Service Principals.* + +The Azure-SDK-for-Node has an excellent tutorial that includes instructions for how to create Service Principals in the Portal and using the Azure CLI, both of which are applicable to Go. +Find that documentation here: [Authenticaion, Azure/azure-sdk-for-node](https://github.com/Azure/azure-sdk-for-node/blob/master/Documentation/Authentication.md) + +In addition, there are several good blog posts, such as +[Automating Azure on your CI server using a Service Principal](http://blog.davidebbo.com/2014/12/azure-service-principal.html) +and +[Microsoft Azure REST API + OAuth 2.0](https://ahmetalpbalkan.com/blog/azure-rest-api-with-oauth2/), +that describe what this means. +For details on creating and authorizing Service Principals, see the MSDN articles +[Azure API Management REST API Authentication](https://msdn.microsoft.com/library/azure/5b13010a-d202-4af5-aabf-7ebc26800b3d) +and +[Create a new Azure Service Principal using the Azure portal](https://azure.microsoft.com/documentation/articles/resource-group-create-service-principal-portal/). +Dushyant Gill, a Senior Program Manager for Azure Active Directory, has written an extensive blog +post, +[Developer's Guide to Auth with Azure Resource Manager API](http://www.dushyantgill.com/blog/2015/05/23/developers-guide-to-auth-with-azure-resource-manager-api/), +that is also quite helpful. + +### Complete source code + +Get code for a full example of [authenticating to Azure via certificate or device authorization](https://github.com/Azure/go-autorest/tree/master/autorest/azure/example). + +## A Simple Example: Checking availability of name within Azure Storage + +Each ARM provider, such as +[Azure Storage](http://azure.microsoft.com/documentation/services/storage/) +or +[Azure Compute](https://azure.microsoft.com/documentation/services/virtual-machines/), +has its own package. Start by importing +the packages for the providers you need. Next, most packages divide their APIs across multiple +clients to avoid name collision and improve usability. For example, the +[Azure Storage](http://azure.microsoft.com/documentation/services/storage/) +package has +two clients: +[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient) +and +[storage.UsageOperationsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#UsageOperationsClient). +To check if a name is available, use the +[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient). + +Each ARM client composes with [autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client). +[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) +enables altering the behavior of the API calls by leveraging the decorator pattern of +[go-autorest](https://github.com/Azure/go-autorest). For example, in the code above, the +[azure.ServicePrincipalToken](https://godoc.org/github.com/Azure/go-autorest/autorest/azure#ServicePrincipalToken) +includes a +[WithAuthorization](https://godoc.org/github.com/Azure/go-autorest/autorest#Client.WithAuthorization) +[autorest.PrepareDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#PrepareDecorator) +that applies the OAuth2 authorization token to the request. It will, as needed, refresh the token +using the supplied credentials. + +Providing a decorated +[autorest.Sender](https://godoc.org/github.com/Azure/go-autorest/autorest#Sender) or populating +the [autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) +with a custom +[autorest.PrepareDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#PrepareDecorator) +or +[autorest.RespondDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#RespondDecorator) +enables more control. See the included example file +[check.go](/arm/examples/check/check.go) +for more details. Through these you can modify the outgoing request, inspect the incoming response, +or even go so far as to provide a +[circuit breaker](https://msdn.microsoft.com/library/dn589784.aspx) +to protect your service from unexpected latencies. + +Lastly, all Azure ARM API calls return an instance of +[autorest.DetailedError](https://godoc.org/github.com/Azure/go-autorest/autorest#DetailedError). +Not only DetailedError gives anonymous access to the original +[error](http://golang.org/ref/spec#Errors), +but provides the package type (e.g., +[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient)), +the failing method (e.g., +[CheckNameAvailability](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient.CheckNameAvailability)), +and a detailed error message. + +### Complete source code + +Complete source code for this example can be found in [check.go](/arm/examples/check/check.go). + +1. Create a [service principal](https://azure.microsoft.com/documentation/articles/resource-group-authenticate-service-principal-cli/). You will need the Tenant ID, Client ID and Client Secret for [authentication](#first-a-sidenote-authentication-and-the-azure-resource-manager), so keep them as soon as you get them. +2. Get your Azure Subscription ID using either of the methods mentioned below: + - Get it through the [portal](portal.azure.com) in the subscriptions section. + - Get it using the [Azure CLI](https://azure.microsoft.com/documentation/articles/xplat-cli-install/) with command `azure account show`. + - Get it using [Azure Powershell](https://azure.microsoft.com/documentation/articles/powershell-install-configure/) with cmdlet `Get-AzureRmSubscription`. +3. Set environment variables `AZURE_TENANT_ID = `, `AZURE_CLIENT_ID = `, `AZURE_CLIENT_SECRET = ` and `AZURE_SUBSCRIPTION_ID = `. +4. Run the sample with commands: + +``` +$ cd arm/examples/check +$ go run check.go +``` + +## Something a Bit More Complex: Creating a new Azure Storage account + +Redundancy, both local and across regions, and service load affect service responsiveness. Some +API calls will return before having completed the request. An Azure ARM API call indicates the +request is incomplete (versus the request failed for some reason) by returning HTTP status code +'202 Accepted.' The +[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) +composed into +all of the Azure ARM clients, provides support for basic request polling. The default is to +poll until a specified duration has passed (with polling frequency determined by the +HTTP [Retry-After](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37) +header in the response). By changing the +[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) +settings, you can poll for a fixed number of attempts or elect to not poll at all. + +Whether you elect to poll or not, all Azure ARM client responses compose with an instance of +[autorest.Response](https://godoc.org/github.com/Azure/go-autorest/autorest#Response). +At present, +[autorest.Response](https://godoc.org/github.com/Azure/go-autorest/autorest#Response) +only composes over the standard +[http.Response](https://golang.org/pkg/net/http/#Response) +object (that may change as we implement more features). When your code receives an error from an +Azure ARM API call, you may find it useful to inspect the HTTP status code contained in the returned +[autorest.Response](https://godoc.org/github.com/Azure/go-autorest/autorest#Response). +If, for example, it is an HTTP 202, then you can use the +[GetPollingLocation](https://godoc.org/github.com/Azure/go-autorest/autorest#Response.GetPollingLocation) +response method to extract the URL at which to continue polling. Similarly, the +[GetPollingDelay](https://godoc.org/github.com/Azure/go-autorest/autorest#Response.GetPollingDelay) +response method returns, as a +[time.Duration](http://golang.org/pkg/time/#Duration), +the service suggested minimum polling delay. + +Creating a new Azure storage account is a straight-forward way to see these concepts. + +[autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) +portion of the +[storage.AccountsClient](https://godoc.org/github.com/Azure/azure-sdk-for-go/arm/storage#AccountsClient) +to poll for a fixed number of attempts versus polling for a set duration (which is the default). +If an error occurs creating the storage account, the code inspects the HTTP status code and +prints the URL the +[Azure Storage](http://azure.microsoft.com/documentation/services/storage/) +service returned for polling. + +### Complete source for the example +More details, including deleting the created account, are in the example code file [create.go](/arm/examples/create/create.go) + +1. Create a [service principal](https://azure.microsoft.com/documentation/articles/resource-group-authenticate-service-principal-cli/). You will need the Tenant ID, Client ID and Client Secret for [authentication](#first-a-sidenote-authentication-and-the-azure-resource-manager), so keep them as soon as you get them. +2. Get your Azure Subscription ID using either of the methods mentioned below: + - Get it through the [portal](portal.azure.com) in the subscriptions section. + - Get it using the [Azure CLI](https://azure.microsoft.com/documentation/articles/xplat-cli-install/) with command `azure account show`. + - Get it using [Azure Powershell](https://azure.microsoft.com/documentation/articles/powershell-install-configure/) with cmdlet `Get-AzureRmSubscription`. +3. Set environment variables `AZURE_TENANT_ID = `, `AZURE_CLIENT_ID = `, `AZURE_CLIENT_SECRET = ` and `AZURE_SUBSCRIPTION_ID = `. +4. Create a resource group and add its name in the first line of the main function. +5. Run the example with commands: + +``` +$ cd arm/examples/create +$ go run create.go +``` + + +## Making Asynchronous Requests + +One of Go's many strong points is how natural it makes sending and managing asynchronous requests +by means of goroutines. We wanted the ARM packages to fit naturally in the variety of asynchronous +patterns used in Go code, but also be straight-forward for simple use cases. We accomplished both +by adopting a pattern for all APIs. Each package API includes (at least) four methods +(more if the API returns a paged result set). For example, for an API call named `Foo` the package +defines: + +- `FooPreparer`: This method accepts the arguments for the API and returns a prepared +`http.Request`. +- `FooSender`: This method sends the prepared `http.Request`. It handles the possible status codes +and will, unless the disabled in the [autorest.Client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client), handling polling. +- `FooResponder`: This method accepts and handles the `http.Response` returned by the sender +and unmarshals the JSON, if any, into the result. +- `Foo`: This method accepts the arguments for the API and returns the result. It is a wrapper +around the `FooPreparer`, `FooSender`, and `FooResponder`. + +By using the preparer, sender, and responder methods, package users can spread request and +response handling across goroutines as needed. Further, adding a cancel channel to the +`http.Response` (most easily through a +[PrepareDecorator](https://godoc.org/github.com/Azure/go-autorest/autorest#PrepareDecorator)), +enables canceling sent requests (see the documentation on +[http.Request](https://golang.org/pkg/net/http/#Request)) for details. + +## Paged Result Sets + +Some API calls return partial results. Typically, when they do, the result structure will include +a `Value` array and a `NextLink` URL. The `NextLink` URL is used to retrieve the next page or +block of results. + +The packages add two methods to make working with and retrieving paged results natural. First, +on paged result structures, the packages include a preparer method that returns an `http.Request` +for the next set of results. For a result set returned in a structure named `FooResults`, the +package will include a method named `FooResultsPreparer`. If the `NextLink` is `nil` or empty, the +method returns `nil`. + +The corresponding API (which typically includes "List" in the name) has a method to ease retrieving +the next result set given a result set. For example, for an API named `FooList`, the package will +include `FooListNextResults` that accepts the results of the last call and returns the next set. + +## Summing Up + +The new Azure Resource Manager packages for the Azure SDK for Go are a big step toward keeping the +SDK current with Azure's rapid growth. +As mentioned, we intend to rapidly stabilize these packages for production use. +We'll also add more examples, including some highlighting the +[Azure Resource Manager Templates](https://msdn.microsoft.com/library/azure/dn790568.aspx) +and the other providers. + +So, give the packages a try, explore the various ARM providers, and let us know what you think. + +We look forward to hearing from you! + +## License + +See the Azure SDK for Go LICENSE file. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/client.go index 1015db13e2..eccfe2c63a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/client.go @@ -1,53 +1,53 @@ -// Package advisor implements the Azure ARM Advisor service API version -// 2017-04-19. -// -// REST APIs for Azure Advisor -package advisor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Advisor - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Advisor. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package advisor implements the Azure ARM Advisor service API version +// 2017-04-19. +// +// REST APIs for Azure Advisor +package advisor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Advisor + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Advisor. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/models.go index c91829ea2b..9b861c068e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/models.go @@ -1,188 +1,188 @@ -package advisor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/satori/uuid" - "net/http" -) - -// Category enumerates the values for category. -type Category string - -const ( - // Cost specifies the cost state for category. - Cost Category = "Cost" - // HighAvailability specifies the high availability state for category. - HighAvailability Category = "HighAvailability" - // Performance specifies the performance state for category. - Performance Category = "Performance" - // Security specifies the security state for category. - Security Category = "Security" -) - -// Impact enumerates the values for impact. -type Impact string - -const ( - // High specifies the high state for impact. - High Impact = "High" - // Low specifies the low state for impact. - Low Impact = "Low" - // Medium specifies the medium state for impact. - Medium Impact = "Medium" -) - -// Risk enumerates the values for risk. -type Risk string - -const ( - // Error specifies the error state for risk. - Error Risk = "Error" - // None specifies the none state for risk. - None Risk = "None" - // Warning specifies the warning state for risk. - Warning Risk = "Warning" -) - -// OperationDisplayInfo is the operation supported by Advisor. -type OperationDisplayInfo struct { - Description *string `json:"description,omitempty"` - Operation *string `json:"operation,omitempty"` - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` -} - -// OperationEntity is the operation supported by Advisor. -type OperationEntity struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplayInfo `json:"display,omitempty"` -} - -// OperationEntityListResult is the list of Advisor operations. -type OperationEntityListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]OperationEntity `json:"value,omitempty"` -} - -// OperationEntityListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationEntityListResult) OperationEntityListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RecommendationProperties is the properties of the recommendation. -type RecommendationProperties struct { - Category Category `json:"category,omitempty"` - Impact Impact `json:"impact,omitempty"` - ImpactedField *string `json:"impactedField,omitempty"` - ImpactedValue *string `json:"impactedValue,omitempty"` - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - Metadata *map[string]*map[string]interface{} `json:"metadata,omitempty"` - RecommendationTypeID *string `json:"recommendationTypeId,omitempty"` - Risk Risk `json:"risk,omitempty"` - ShortDescription *ShortDescription `json:"shortDescription,omitempty"` - SuppressionIds *[]uuid.UUID `json:"suppressionIds,omitempty"` -} - -// Resource is an Azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// ResourceRecommendationBase is advisor Recommendation. -type ResourceRecommendationBase struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RecommendationProperties `json:"properties,omitempty"` -} - -// ResourceRecommendationBaseListResult is the list of Advisor recommendations. -type ResourceRecommendationBaseListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]ResourceRecommendationBase `json:"value,omitempty"` -} - -// ResourceRecommendationBaseListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceRecommendationBaseListResult) ResourceRecommendationBaseListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ShortDescription is a summary of the recommendation. -type ShortDescription struct { - Problem *string `json:"problem,omitempty"` - Solution *string `json:"solution,omitempty"` -} - -// SuppressionContract is the details of the snoozed or dismissed rule; for -// example, the duration, name, and GUID associated with the rule. -type SuppressionContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *SuppressionProperties `json:"properties,omitempty"` -} - -// SuppressionContractListResult is the list of Advisor suppressions. -type SuppressionContractListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]SuppressionContract `json:"value,omitempty"` -} - -// SuppressionContractListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SuppressionContractListResult) SuppressionContractListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SuppressionProperties is the properties of the suppression. -type SuppressionProperties struct { - SuppressionID *string `json:"suppressionId,omitempty"` - TTL *string `json:"ttl,omitempty"` -} +package advisor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" + "net/http" +) + +// Category enumerates the values for category. +type Category string + +const ( + // Cost specifies the cost state for category. + Cost Category = "Cost" + // HighAvailability specifies the high availability state for category. + HighAvailability Category = "HighAvailability" + // Performance specifies the performance state for category. + Performance Category = "Performance" + // Security specifies the security state for category. + Security Category = "Security" +) + +// Impact enumerates the values for impact. +type Impact string + +const ( + // High specifies the high state for impact. + High Impact = "High" + // Low specifies the low state for impact. + Low Impact = "Low" + // Medium specifies the medium state for impact. + Medium Impact = "Medium" +) + +// Risk enumerates the values for risk. +type Risk string + +const ( + // Error specifies the error state for risk. + Error Risk = "Error" + // None specifies the none state for risk. + None Risk = "None" + // Warning specifies the warning state for risk. + Warning Risk = "Warning" +) + +// OperationDisplayInfo is the operation supported by Advisor. +type OperationDisplayInfo struct { + Description *string `json:"description,omitempty"` + Operation *string `json:"operation,omitempty"` + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` +} + +// OperationEntity is the operation supported by Advisor. +type OperationEntity struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplayInfo `json:"display,omitempty"` +} + +// OperationEntityListResult is the list of Advisor operations. +type OperationEntityListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]OperationEntity `json:"value,omitempty"` +} + +// OperationEntityListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationEntityListResult) OperationEntityListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecommendationProperties is the properties of the recommendation. +type RecommendationProperties struct { + Category Category `json:"category,omitempty"` + Impact Impact `json:"impact,omitempty"` + ImpactedField *string `json:"impactedField,omitempty"` + ImpactedValue *string `json:"impactedValue,omitempty"` + LastUpdated *date.Time `json:"lastUpdated,omitempty"` + Metadata *map[string]*map[string]interface{} `json:"metadata,omitempty"` + RecommendationTypeID *string `json:"recommendationTypeId,omitempty"` + Risk Risk `json:"risk,omitempty"` + ShortDescription *ShortDescription `json:"shortDescription,omitempty"` + SuppressionIds *[]uuid.UUID `json:"suppressionIds,omitempty"` +} + +// Resource is an Azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// ResourceRecommendationBase is advisor Recommendation. +type ResourceRecommendationBase struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RecommendationProperties `json:"properties,omitempty"` +} + +// ResourceRecommendationBaseListResult is the list of Advisor recommendations. +type ResourceRecommendationBaseListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]ResourceRecommendationBase `json:"value,omitempty"` +} + +// ResourceRecommendationBaseListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceRecommendationBaseListResult) ResourceRecommendationBaseListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ShortDescription is a summary of the recommendation. +type ShortDescription struct { + Problem *string `json:"problem,omitempty"` + Solution *string `json:"solution,omitempty"` +} + +// SuppressionContract is the details of the snoozed or dismissed rule; for +// example, the duration, name, and GUID associated with the rule. +type SuppressionContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *SuppressionProperties `json:"properties,omitempty"` +} + +// SuppressionContractListResult is the list of Advisor suppressions. +type SuppressionContractListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]SuppressionContract `json:"value,omitempty"` +} + +// SuppressionContractListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SuppressionContractListResult) SuppressionContractListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SuppressionProperties is the properties of the suppression. +type SuppressionProperties struct { + SuppressionID *string `json:"suppressionId,omitempty"` + TTL *string `json:"ttl,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/operations.go index a5a42d7312..611dafec8a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/operations.go @@ -1,122 +1,122 @@ -package advisor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the rEST APIs for Azure Advisor -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the available Advisor REST API operations. -func (client OperationsClient) List() (result OperationEntityListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Advisor/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { - req, err := lastResults.OperationEntityListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package advisor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the rEST APIs for Azure Advisor +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all the available Advisor REST API operations. +func (client OperationsClient) List() (result OperationEntityListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Advisor/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { + req, err := lastResults.OperationEntityListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/recommendations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/recommendations.go index 34a75df434..beaa8e74cb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/recommendations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/recommendations.go @@ -1,338 +1,338 @@ -package advisor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/satori/uuid" - "net/http" -) - -// RecommendationsClient is the rEST APIs for Azure Advisor -type RecommendationsClient struct { - ManagementClient -} - -// NewRecommendationsClient creates an instance of the RecommendationsClient -// client. -func NewRecommendationsClient(subscriptionID string) RecommendationsClient { - return NewRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecommendationsClientWithBaseURI creates an instance of the -// RecommendationsClient client. -func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) RecommendationsClient { - return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Generate initiates the recommendation generation or computation process for -// a subscription. This operation is asynchronous. The generated -// recommendations are stored in a cache in the Advisor service. -func (client RecommendationsClient) Generate() (result autorest.Response, err error) { - req, err := client.GeneratePreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Generate", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Generate", resp, "Failure sending request") - return - } - - result, err = client.GenerateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Generate", resp, "Failure responding to request") - } - - return -} - -// GeneratePreparer prepares the Generate request. -func (client RecommendationsClient) GeneratePreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateSender sends the Generate request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) GenerateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateResponder handles the response to the Generate request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) GenerateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get obtains details of a cached recommendation. -// -// resourceURI is the fully qualified Azure Resource Manager identifier of the -// resource to which the recommendation applies. recommendationID is the -// recommendation ID. -func (client RecommendationsClient) Get(resourceURI string, recommendationID string) (result ResourceRecommendationBase, err error) { - req, err := client.GetPreparer(resourceURI, recommendationID) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecommendationsClient) GetPreparer(resourceURI string, recommendationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendationId": autorest.Encode("path", recommendationID), - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) GetResponder(resp *http.Response) (result ResourceRecommendationBase, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGenerateStatus retrieves the status of the recommendation computation or -// generation process. Invoke this API after calling the generation -// recommendation. The URI of this API is returned in the Location field of the -// response header. -// -// operationID is the operation ID, which can be found from the Location field -// in the generate recommendation response header. -func (client RecommendationsClient) GetGenerateStatus(operationID uuid.UUID) (result autorest.Response, err error) { - req, err := client.GetGenerateStatusPreparer(operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "GetGenerateStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetGenerateStatusSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "GetGenerateStatus", resp, "Failure sending request") - return - } - - result, err = client.GetGenerateStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "GetGenerateStatus", resp, "Failure responding to request") - } - - return -} - -// GetGenerateStatusPreparer prepares the GetGenerateStatus request. -func (client RecommendationsClient) GetGenerateStatusPreparer(operationID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetGenerateStatusSender sends the GetGenerateStatus request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) GetGenerateStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetGenerateStatusResponder handles the response to the GetGenerateStatus request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) GetGenerateStatusResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List obtains cached recommendations for a subscription. The recommendations -// are generated or computed by invoking generateRecommendations. -// -// filter is the filter to apply to the recommendations. top is the number of -// recommendations per page if a paged version of this API is being used. -// skipToken is the page-continuation token to use with a paged version of this -// API. -func (client RecommendationsClient) List(filter string, top *int32, skipToken string) (result ResourceRecommendationBaseListResult, err error) { - req, err := client.ListPreparer(filter, top, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RecommendationsClient) ListPreparer(filter string, top *int32, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) ListResponder(resp *http.Response) (result ResourceRecommendationBaseListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RecommendationsClient) ListNextResults(lastResults ResourceRecommendationBaseListResult) (result ResourceRecommendationBaseListResult, err error) { - req, err := lastResults.ResourceRecommendationBaseListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package advisor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/satori/uuid" + "net/http" +) + +// RecommendationsClient is the rEST APIs for Azure Advisor +type RecommendationsClient struct { + ManagementClient +} + +// NewRecommendationsClient creates an instance of the RecommendationsClient +// client. +func NewRecommendationsClient(subscriptionID string) RecommendationsClient { + return NewRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecommendationsClientWithBaseURI creates an instance of the +// RecommendationsClient client. +func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) RecommendationsClient { + return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Generate initiates the recommendation generation or computation process for +// a subscription. This operation is asynchronous. The generated +// recommendations are stored in a cache in the Advisor service. +func (client RecommendationsClient) Generate() (result autorest.Response, err error) { + req, err := client.GeneratePreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Generate", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Generate", resp, "Failure sending request") + return + } + + result, err = client.GenerateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Generate", resp, "Failure responding to request") + } + + return +} + +// GeneratePreparer prepares the Generate request. +func (client RecommendationsClient) GeneratePreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateSender sends the Generate request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GenerateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateResponder handles the response to the Generate request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GenerateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get obtains details of a cached recommendation. +// +// resourceURI is the fully qualified Azure Resource Manager identifier of the +// resource to which the recommendation applies. recommendationID is the +// recommendation ID. +func (client RecommendationsClient) Get(resourceURI string, recommendationID string) (result ResourceRecommendationBase, err error) { + req, err := client.GetPreparer(resourceURI, recommendationID) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecommendationsClient) GetPreparer(resourceURI string, recommendationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recommendationId": autorest.Encode("path", recommendationID), + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GetResponder(resp *http.Response) (result ResourceRecommendationBase, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetGenerateStatus retrieves the status of the recommendation computation or +// generation process. Invoke this API after calling the generation +// recommendation. The URI of this API is returned in the Location field of the +// response header. +// +// operationID is the operation ID, which can be found from the Location field +// in the generate recommendation response header. +func (client RecommendationsClient) GetGenerateStatus(operationID uuid.UUID) (result autorest.Response, err error) { + req, err := client.GetGenerateStatusPreparer(operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "GetGenerateStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetGenerateStatusSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "GetGenerateStatus", resp, "Failure sending request") + return + } + + result, err = client.GetGenerateStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "GetGenerateStatus", resp, "Failure responding to request") + } + + return +} + +// GetGenerateStatusPreparer prepares the GetGenerateStatus request. +func (client RecommendationsClient) GetGenerateStatusPreparer(operationID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetGenerateStatusSender sends the GetGenerateStatus request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GetGenerateStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetGenerateStatusResponder handles the response to the GetGenerateStatus request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GetGenerateStatusResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// List obtains cached recommendations for a subscription. The recommendations +// are generated or computed by invoking generateRecommendations. +// +// filter is the filter to apply to the recommendations. top is the number of +// recommendations per page if a paged version of this API is being used. +// skipToken is the page-continuation token to use with a paged version of this +// API. +func (client RecommendationsClient) List(filter string, top *int32, skipToken string) (result ResourceRecommendationBaseListResult, err error) { + req, err := client.ListPreparer(filter, top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RecommendationsClient) ListPreparer(filter string, top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListResponder(resp *http.Response) (result ResourceRecommendationBaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RecommendationsClient) ListNextResults(lastResults ResourceRecommendationBaseListResult) (result ResourceRecommendationBaseListResult, err error) { + req, err := lastResults.ResourceRecommendationBaseListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.RecommendationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/suppressions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/suppressions.go index 8125c39144..ec0c6c494d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/suppressions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/suppressions.go @@ -1,345 +1,345 @@ -package advisor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// SuppressionsClient is the rEST APIs for Azure Advisor -type SuppressionsClient struct { - ManagementClient -} - -// NewSuppressionsClient creates an instance of the SuppressionsClient client. -func NewSuppressionsClient(subscriptionID string) SuppressionsClient { - return NewSuppressionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSuppressionsClientWithBaseURI creates an instance of the -// SuppressionsClient client. -func NewSuppressionsClientWithBaseURI(baseURI string, subscriptionID string) SuppressionsClient { - return SuppressionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create enables the snoozed or dismissed attribute of a recommendation. The -// snoozed or dismissed attribute is referred to as a suppression. Use this API -// to create or update the snoozed or dismissed status of a recommendation. -// -// resourceURI is the fully qualified Azure Resource Manager identifier of the -// resource to which the recommendation applies. recommendationID is the -// recommendation ID. name is the name of the suppression. suppressionContract -// is the snoozed or dismissed attribute; for example, the snooze duration. -func (client SuppressionsClient) Create(resourceURI string, recommendationID string, name string, suppressionContract SuppressionContract) (result SuppressionContract, err error) { - req, err := client.CreatePreparer(resourceURI, recommendationID, name, suppressionContract) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SuppressionsClient) CreatePreparer(resourceURI string, recommendationID string, name string, suppressionContract SuppressionContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "recommendationId": autorest.Encode("path", recommendationID), - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", pathParameters), - autorest.WithJSON(suppressionContract), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SuppressionsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SuppressionsClient) CreateResponder(resp *http.Response) (result SuppressionContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete enables the activation of a snoozed or dismissed recommendation. The -// snoozed or dismissed attribute of a recommendation is referred to as a -// suppression. -// -// resourceURI is the fully qualified Azure Resource Manager identifier of the -// resource to which the recommendation applies. recommendationID is the -// recommendation ID. name is the name of the suppression. -func (client SuppressionsClient) Delete(resourceURI string, recommendationID string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceURI, recommendationID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SuppressionsClient) DeletePreparer(resourceURI string, recommendationID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "recommendationId": autorest.Encode("path", recommendationID), - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SuppressionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SuppressionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get obtains the details of a suppression. -// -// resourceURI is the fully qualified Azure Resource Manager identifier of the -// resource to which the recommendation applies. recommendationID is the -// recommendation ID. name is the name of the suppression. -func (client SuppressionsClient) Get(resourceURI string, recommendationID string, name string) (result SuppressionContract, err error) { - req, err := client.GetPreparer(resourceURI, recommendationID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SuppressionsClient) GetPreparer(resourceURI string, recommendationID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "recommendationId": autorest.Encode("path", recommendationID), - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SuppressionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SuppressionsClient) GetResponder(resp *http.Response) (result SuppressionContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List retrieves the list of snoozed or dismissed suppressions for a -// subscription. The snoozed or dismissed attribute of a recommendation is -// referred to as a suppression. -// -// top is the number of suppressions per page if a paged version of this API is -// being used. skipToken is the page-continuation token to use with a paged -// version of this API. -func (client SuppressionsClient) List(top *int32, skipToken string) (result SuppressionContractListResult, err error) { - req, err := client.ListPreparer(top, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SuppressionsClient) ListPreparer(top *int32, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SuppressionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SuppressionsClient) ListResponder(resp *http.Response) (result SuppressionContractListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SuppressionsClient) ListNextResults(lastResults SuppressionContractListResult) (result SuppressionContractListResult, err error) { - req, err := lastResults.SuppressionContractListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package advisor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// SuppressionsClient is the rEST APIs for Azure Advisor +type SuppressionsClient struct { + ManagementClient +} + +// NewSuppressionsClient creates an instance of the SuppressionsClient client. +func NewSuppressionsClient(subscriptionID string) SuppressionsClient { + return NewSuppressionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSuppressionsClientWithBaseURI creates an instance of the +// SuppressionsClient client. +func NewSuppressionsClientWithBaseURI(baseURI string, subscriptionID string) SuppressionsClient { + return SuppressionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create enables the snoozed or dismissed attribute of a recommendation. The +// snoozed or dismissed attribute is referred to as a suppression. Use this API +// to create or update the snoozed or dismissed status of a recommendation. +// +// resourceURI is the fully qualified Azure Resource Manager identifier of the +// resource to which the recommendation applies. recommendationID is the +// recommendation ID. name is the name of the suppression. suppressionContract +// is the snoozed or dismissed attribute; for example, the snooze duration. +func (client SuppressionsClient) Create(resourceURI string, recommendationID string, name string, suppressionContract SuppressionContract) (result SuppressionContract, err error) { + req, err := client.CreatePreparer(resourceURI, recommendationID, name, suppressionContract) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SuppressionsClient) CreatePreparer(resourceURI string, recommendationID string, name string, suppressionContract SuppressionContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "recommendationId": autorest.Encode("path", recommendationID), + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", pathParameters), + autorest.WithJSON(suppressionContract), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SuppressionsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SuppressionsClient) CreateResponder(resp *http.Response) (result SuppressionContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete enables the activation of a snoozed or dismissed recommendation. The +// snoozed or dismissed attribute of a recommendation is referred to as a +// suppression. +// +// resourceURI is the fully qualified Azure Resource Manager identifier of the +// resource to which the recommendation applies. recommendationID is the +// recommendation ID. name is the name of the suppression. +func (client SuppressionsClient) Delete(resourceURI string, recommendationID string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceURI, recommendationID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SuppressionsClient) DeletePreparer(resourceURI string, recommendationID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "recommendationId": autorest.Encode("path", recommendationID), + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SuppressionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SuppressionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get obtains the details of a suppression. +// +// resourceURI is the fully qualified Azure Resource Manager identifier of the +// resource to which the recommendation applies. recommendationID is the +// recommendation ID. name is the name of the suppression. +func (client SuppressionsClient) Get(resourceURI string, recommendationID string, name string) (result SuppressionContract, err error) { + req, err := client.GetPreparer(resourceURI, recommendationID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SuppressionsClient) GetPreparer(resourceURI string, recommendationID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "recommendationId": autorest.Encode("path", recommendationID), + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SuppressionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SuppressionsClient) GetResponder(resp *http.Response) (result SuppressionContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves the list of snoozed or dismissed suppressions for a +// subscription. The snoozed or dismissed attribute of a recommendation is +// referred to as a suppression. +// +// top is the number of suppressions per page if a paged version of this API is +// being used. skipToken is the page-continuation token to use with a paged +// version of this API. +func (client SuppressionsClient) List(top *int32, skipToken string) (result SuppressionContractListResult, err error) { + req, err := client.ListPreparer(top, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SuppressionsClient) ListPreparer(top *int32, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SuppressionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SuppressionsClient) ListResponder(resp *http.Response) (result SuppressionContractListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SuppressionsClient) ListNextResults(lastResults SuppressionContractListResult) (result SuppressionContractListResult, err error) { + req, err := lastResults.SuppressionContractListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "advisor.SuppressionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/version.go index 1870794e07..94b9607062 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/advisor/version.go @@ -1,29 +1,29 @@ -package advisor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-advisor/2017-04-19" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package advisor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-advisor/2017-04-19" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/client.go index be506a2637..22fc2bd29a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/client.go @@ -1,55 +1,55 @@ -// Package analysisservices implements the Azure ARM Analysisservices service -// API version 2016-05-16. -// -// The Azure Analysis Services Web API provides a RESTful set of web services -// that enables users to create, retrieve, update, and delete Analysis Services -// servers -package analysisservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Analysisservices - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Analysisservices. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package analysisservices implements the Azure ARM Analysisservices service +// API version 2016-05-16. +// +// The Azure Analysis Services Web API provides a RESTful set of web services +// that enables users to create, retrieve, update, and delete Analysis Services +// servers +package analysisservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Analysisservices + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Analysisservices. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/models.go index f68eb20d4f..96fb36496c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/models.go @@ -1,185 +1,185 @@ -package analysisservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Deleting specifies the deleting state for provisioning state. - Deleting ProvisioningState = "Deleting" - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "Failed" - // Paused specifies the paused state for provisioning state. - Paused ProvisioningState = "Paused" - // Pausing specifies the pausing state for provisioning state. - Pausing ProvisioningState = "Pausing" - // Preparing specifies the preparing state for provisioning state. - Preparing ProvisioningState = "Preparing" - // Provisioning specifies the provisioning state for provisioning state. - Provisioning ProvisioningState = "Provisioning" - // Resuming specifies the resuming state for provisioning state. - Resuming ProvisioningState = "Resuming" - // Scaling specifies the scaling state for provisioning state. - Scaling ProvisioningState = "Scaling" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" - // Suspended specifies the suspended state for provisioning state. - Suspended ProvisioningState = "Suspended" - // Suspending specifies the suspending state for provisioning state. - Suspending ProvisioningState = "Suspending" - // Updating specifies the updating state for provisioning state. - Updating ProvisioningState = "Updating" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // B1 specifies the b1 state for sku name. - B1 SkuName = "B1" - // B2 specifies the b2 state for sku name. - B2 SkuName = "B2" - // D1 specifies the d1 state for sku name. - D1 SkuName = "D1" - // S0 specifies the s0 state for sku name. - S0 SkuName = "S0" - // S1 specifies the s1 state for sku name. - S1 SkuName = "S1" - // S2 specifies the s2 state for sku name. - S2 SkuName = "S2" - // S4 specifies the s4 state for sku name. - S4 SkuName = "S4" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Basic specifies the basic state for sku tier. - Basic SkuTier = "Basic" - // Development specifies the development state for sku tier. - Development SkuTier = "Development" - // Standard specifies the standard state for sku tier. - Standard SkuTier = "Standard" -) - -// State enumerates the values for state. -type State string - -const ( - // StateDeleting specifies the state deleting state for state. - StateDeleting State = "Deleting" - // StateFailed specifies the state failed state for state. - StateFailed State = "Failed" - // StatePaused specifies the state paused state for state. - StatePaused State = "Paused" - // StatePausing specifies the state pausing state for state. - StatePausing State = "Pausing" - // StatePreparing specifies the state preparing state for state. - StatePreparing State = "Preparing" - // StateProvisioning specifies the state provisioning state for state. - StateProvisioning State = "Provisioning" - // StateResuming specifies the state resuming state for state. - StateResuming State = "Resuming" - // StateScaling specifies the state scaling state for state. - StateScaling State = "Scaling" - // StateSucceeded specifies the state succeeded state for state. - StateSucceeded State = "Succeeded" - // StateSuspended specifies the state suspended state for state. - StateSuspended State = "Suspended" - // StateSuspending specifies the state suspending state for state. - StateSuspending State = "Suspending" - // StateUpdating specifies the state updating state for state. - StateUpdating State = "Updating" -) - -// BackupConfiguration is an object that represents backup configurations -type BackupConfiguration struct { - StorageAccount *string `json:"storageAccount,omitempty"` - BlobContainer *string `json:"blobContainer,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` -} - -// Resource is represents an instance of an Analysis Services resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceSku is represents the SKU name and Azure pricing tier for Analysis -// Services resource. -type ResourceSku struct { - Name SkuName `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` -} - -// Server is represents an instance of an Analysis Services resource. -type Server struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServerProperties `json:"properties,omitempty"` -} - -// ServerAdministrators is an array of administrator user identities -type ServerAdministrators struct { - Members *[]string `json:"members,omitempty"` -} - -// ServerMutableProperties is an object that represents a set of mutable -// Analysis Services resource properties. -type ServerMutableProperties struct { - AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` - BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` -} - -// ServerProperties is properties of Analysis Services resource. -type ServerProperties struct { - AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` - BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` - State State `json:"state,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - ServerFullName *string `json:"serverFullName,omitempty"` -} - -// Servers is an array of Analysis Services resources. -type Servers struct { - autorest.Response `json:"-"` - Value *[]Server `json:"value,omitempty"` -} - -// ServerUpdateParameters is provision request specification -type ServerUpdateParameters struct { - Sku *ResourceSku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServerMutableProperties `json:"properties,omitempty"` -} +package analysisservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Deleting specifies the deleting state for provisioning state. + Deleting ProvisioningState = "Deleting" + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // Paused specifies the paused state for provisioning state. + Paused ProvisioningState = "Paused" + // Pausing specifies the pausing state for provisioning state. + Pausing ProvisioningState = "Pausing" + // Preparing specifies the preparing state for provisioning state. + Preparing ProvisioningState = "Preparing" + // Provisioning specifies the provisioning state for provisioning state. + Provisioning ProvisioningState = "Provisioning" + // Resuming specifies the resuming state for provisioning state. + Resuming ProvisioningState = "Resuming" + // Scaling specifies the scaling state for provisioning state. + Scaling ProvisioningState = "Scaling" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" + // Suspended specifies the suspended state for provisioning state. + Suspended ProvisioningState = "Suspended" + // Suspending specifies the suspending state for provisioning state. + Suspending ProvisioningState = "Suspending" + // Updating specifies the updating state for provisioning state. + Updating ProvisioningState = "Updating" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // B1 specifies the b1 state for sku name. + B1 SkuName = "B1" + // B2 specifies the b2 state for sku name. + B2 SkuName = "B2" + // D1 specifies the d1 state for sku name. + D1 SkuName = "D1" + // S0 specifies the s0 state for sku name. + S0 SkuName = "S0" + // S1 specifies the s1 state for sku name. + S1 SkuName = "S1" + // S2 specifies the s2 state for sku name. + S2 SkuName = "S2" + // S4 specifies the s4 state for sku name. + S4 SkuName = "S4" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic specifies the basic state for sku tier. + Basic SkuTier = "Basic" + // Development specifies the development state for sku tier. + Development SkuTier = "Development" + // Standard specifies the standard state for sku tier. + Standard SkuTier = "Standard" +) + +// State enumerates the values for state. +type State string + +const ( + // StateDeleting specifies the state deleting state for state. + StateDeleting State = "Deleting" + // StateFailed specifies the state failed state for state. + StateFailed State = "Failed" + // StatePaused specifies the state paused state for state. + StatePaused State = "Paused" + // StatePausing specifies the state pausing state for state. + StatePausing State = "Pausing" + // StatePreparing specifies the state preparing state for state. + StatePreparing State = "Preparing" + // StateProvisioning specifies the state provisioning state for state. + StateProvisioning State = "Provisioning" + // StateResuming specifies the state resuming state for state. + StateResuming State = "Resuming" + // StateScaling specifies the state scaling state for state. + StateScaling State = "Scaling" + // StateSucceeded specifies the state succeeded state for state. + StateSucceeded State = "Succeeded" + // StateSuspended specifies the state suspended state for state. + StateSuspended State = "Suspended" + // StateSuspending specifies the state suspending state for state. + StateSuspending State = "Suspending" + // StateUpdating specifies the state updating state for state. + StateUpdating State = "Updating" +) + +// BackupConfiguration is an object that represents backup configurations +type BackupConfiguration struct { + StorageAccount *string `json:"storageAccount,omitempty"` + BlobContainer *string `json:"blobContainer,omitempty"` + AccessKey *string `json:"accessKey,omitempty"` +} + +// Resource is represents an instance of an Analysis Services resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceSku is represents the SKU name and Azure pricing tier for Analysis +// Services resource. +type ResourceSku struct { + Name SkuName `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` +} + +// Server is represents an instance of an Analysis Services resource. +type Server struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ServerProperties `json:"properties,omitempty"` +} + +// ServerAdministrators is an array of administrator user identities +type ServerAdministrators struct { + Members *[]string `json:"members,omitempty"` +} + +// ServerMutableProperties is an object that represents a set of mutable +// Analysis Services resource properties. +type ServerMutableProperties struct { + AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` + BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` +} + +// ServerProperties is properties of Analysis Services resource. +type ServerProperties struct { + AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` + BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` + State State `json:"state,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + ServerFullName *string `json:"serverFullName,omitempty"` +} + +// Servers is an array of Analysis Services resources. +type Servers struct { + autorest.Response `json:"-"` + Value *[]Server `json:"value,omitempty"` +} + +// ServerUpdateParameters is provision request specification +type ServerUpdateParameters struct { + Sku *ResourceSku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ServerMutableProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/servers.go index aecfdda671..70e0e448ba 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/servers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/servers.go @@ -1,740 +1,740 @@ -package analysisservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ServersClient is the the Azure Analysis Services Web API provides a RESTful -// set of web services that enables users to create, retrieve, update, and -// delete Analysis Services servers -type ServersClient struct { - ManagementClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient client. -func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create provisions the specified Analysis Services server based on the -// configuration specified in the request. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. serverName is the name of the Analysis Services -// server. It must be a minimum of 3 characters, and a maximum of 63. -// serverParameters is contains the information used to provision the Analysis -// Services server. -func (client ServersClient) Create(resourceGroupName string, serverName string, serverParameters Server, cancel <-chan struct{}) (<-chan Server, <-chan error) { - resultChan := make(chan Server, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: serverName, - Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Server - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, serverName, serverParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client ServersClient) CreatePreparer(resourceGroupName string, serverName string, serverParameters Server, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), - autorest.WithJSON(serverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Analysis Services server. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. serverName is the name of the Analysis Services -// server. It must be at least 3 characters in length, and no more than 63. -func (client ServersClient) Delete(resourceGroupName string, serverName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: serverName, - Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, serverName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(resourceGroupName string, serverName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetDetails gets details about the specified Analysis Services server. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. serverName is the name of the Analysis Services -// server. It must be a minimum of 3 characters, and a maximum of 63. -func (client ServersClient) GetDetails(resourceGroupName string, serverName string) (result Server, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: serverName, - Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "GetDetails") - } - - req, err := client.GetDetailsPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", resp, "Failure responding to request") - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client ServersClient) GetDetailsPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client ServersClient) GetDetailsResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the Analysis Services servers for the given subscription. -func (client ServersClient) List() (result Servers, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServersClient) ListResponder(resp *http.Response) (result Servers, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all the Analysis Services servers for the given -// resource group. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. -func (client ServersClient) ListByResourceGroup(resourceGroupName string) (result Servers, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result Servers, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Resume resumes operation of the specified Analysis Services server instance. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. serverName is the name of the Analysis Services -// server. It must be at least 3 characters in length, and no more than 63. -func (client ServersClient) Resume(resourceGroupName string, serverName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: serverName, - Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Resume") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ResumePreparer(resourceGroupName, serverName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ResumePreparer prepares the Resume request. -func (client ServersClient) ResumePreparer(resourceGroupName string, serverName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResumeSender sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ResumeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client ServersClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend supends operation of the specified Analysis Services server -// instance. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. serverName is the name of the Analysis Services -// server. It must be at least 3 characters in length, and no more than 63. -func (client ServersClient) Suspend(resourceGroupName string, serverName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: serverName, - Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Suspend") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.SuspendPreparer(resourceGroupName, serverName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// SuspendPreparer prepares the Suspend request. -func (client ServersClient) SuspendPreparer(resourceGroupName string, serverName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SuspendSender sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) SuspendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client ServersClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the current state of the specified Analysis Services server. -// -// resourceGroupName is the name of the Azure Resource group of which a given -// Analysis Services server is part. This name must be at least 1 character in -// length, and no more than 90. serverName is the name of the Analysis Services -// server. It must be at least 3 characters in length, and no more than 63. -// serverUpdateParameters is request object that contains the updated -// information for the server. -func (client ServersClient) Update(resourceGroupName string, serverName string, serverUpdateParameters ServerUpdateParameters) (result Server, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: serverName, - Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serverName, serverUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(resourceGroupName string, serverName string, serverUpdateParameters ServerUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-16" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), - autorest.WithJSON(serverUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package analysisservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ServersClient is the the Azure Analysis Services Web API provides a RESTful +// set of web services that enables users to create, retrieve, update, and +// delete Analysis Services servers +type ServersClient struct { + ManagementClient +} + +// NewServersClient creates an instance of the ServersClient client. +func NewServersClient(subscriptionID string) ServersClient { + return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServersClientWithBaseURI creates an instance of the ServersClient client. +func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { + return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create provisions the specified Analysis Services server based on the +// configuration specified in the request. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. serverName is the name of the Analysis Services +// server. It must be a minimum of 3 characters, and a maximum of 63. +// serverParameters is contains the information used to provision the Analysis +// Services server. +func (client ServersClient) Create(resourceGroupName string, serverName string, serverParameters Server, cancel <-chan struct{}) (<-chan Server, <-chan error) { + resultChan := make(chan Server, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: serverName, + Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Server + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, serverName, serverParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ServersClient) CreatePreparer(resourceGroupName string, serverName string, serverParameters Server, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), + autorest.WithJSON(serverParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Analysis Services server. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. serverName is the name of the Analysis Services +// server. It must be at least 3 characters in length, and no more than 63. +func (client ServersClient) Delete(resourceGroupName string, serverName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: serverName, + Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, serverName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ServersClient) DeletePreparer(resourceGroupName string, serverName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetDetails gets details about the specified Analysis Services server. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. serverName is the name of the Analysis Services +// server. It must be a minimum of 3 characters, and a maximum of 63. +func (client ServersClient) GetDetails(resourceGroupName string, serverName string) (result Server, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: serverName, + Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "GetDetails") + } + + req, err := client.GetDetailsPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", nil, "Failure preparing request") + return + } + + resp, err := client.GetDetailsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", resp, "Failure sending request") + return + } + + result, err = client.GetDetailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", resp, "Failure responding to request") + } + + return +} + +// GetDetailsPreparer prepares the GetDetails request. +func (client ServersClient) GetDetailsPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDetailsSender sends the GetDetails request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) GetDetailsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDetailsResponder handles the response to the GetDetails request. The method always +// closes the http.Response Body. +func (client ServersClient) GetDetailsResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the Analysis Services servers for the given subscription. +func (client ServersClient) List() (result Servers, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServersClient) ListResponder(resp *http.Response) (result Servers, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all the Analysis Services servers for the given +// resource group. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. +func (client ServersClient) ListByResourceGroup(resourceGroupName string) (result Servers, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result Servers, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Resume resumes operation of the specified Analysis Services server instance. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. serverName is the name of the Analysis Services +// server. It must be at least 3 characters in length, and no more than 63. +func (client ServersClient) Resume(resourceGroupName string, serverName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: serverName, + Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Resume") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ResumePreparer(resourceGroupName, serverName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", nil, "Failure preparing request") + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", resp, "Failure sending request") + return + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ResumePreparer prepares the Resume request. +func (client ServersClient) ResumePreparer(resourceGroupName string, serverName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ResumeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client ServersClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Suspend supends operation of the specified Analysis Services server +// instance. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. serverName is the name of the Analysis Services +// server. It must be at least 3 characters in length, and no more than 63. +func (client ServersClient) Suspend(resourceGroupName string, serverName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: serverName, + Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Suspend") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.SuspendPreparer(resourceGroupName, serverName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", nil, "Failure preparing request") + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", resp, "Failure sending request") + return + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SuspendPreparer prepares the Suspend request. +func (client ServersClient) SuspendPreparer(resourceGroupName string, serverName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) SuspendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client ServersClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates the current state of the specified Analysis Services server. +// +// resourceGroupName is the name of the Azure Resource group of which a given +// Analysis Services server is part. This name must be at least 1 character in +// length, and no more than 90. serverName is the name of the Analysis Services +// server. It must be at least 3 characters in length, and no more than 63. +// serverUpdateParameters is request object that contains the updated +// information for the server. +func (client ServersClient) Update(resourceGroupName string, serverName string, serverUpdateParameters ServerUpdateParameters) (result Server, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: serverName, + Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "analysisservices.ServersClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serverName, serverUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServersClient) UpdatePreparer(resourceGroupName string, serverName string, serverUpdateParameters ServerUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), + autorest.WithJSON(serverUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/version.go index 773db61fb8..e801840792 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/analysisservices/version.go @@ -1,29 +1,29 @@ -package analysisservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-analysisservices/2016-05-16" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package analysisservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-analysisservices/2016-05-16" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiexport.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiexport.go index 888acca9eb..5474d88fbf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiexport.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiexport.go @@ -1,122 +1,122 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// APIExportClient is the composite Swagger for ApiManagement Client -type APIExportClient struct { - ManagementClient -} - -// NewAPIExportClient creates an instance of the APIExportClient client. -func NewAPIExportClient(subscriptionID string) APIExportClient { - return NewAPIExportClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIExportClientWithBaseURI creates an instance of the APIExportClient -// client. -func NewAPIExportClientWithBaseURI(baseURI string, subscriptionID string) APIExportClient { - return APIExportClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the details of the API specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. -func (client APIExportClient) Get(resourceGroupName string, serviceName string, aPIID string) (result APIExportResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIExportClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIExportClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIExportClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIExportClient) GetResponder(resp *http.Response) (result APIExportResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// APIExportClient is the composite Swagger for ApiManagement Client +type APIExportClient struct { + ManagementClient +} + +// NewAPIExportClient creates an instance of the APIExportClient client. +func NewAPIExportClient(subscriptionID string) APIExportClient { + return NewAPIExportClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIExportClientWithBaseURI creates an instance of the APIExportClient +// client. +func NewAPIExportClientWithBaseURI(baseURI string, subscriptionID string) APIExportClient { + return APIExportClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the details of the API specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. +func (client APIExportClient) Get(resourceGroupName string, serviceName string, aPIID string) (result APIExportResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIExportClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIExportClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIExportClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIExportClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIExportClient) GetResponder(resp *http.Response) (result APIExportResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperations.go index 08b4ed1dc7..5e05c51d4a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperations.go @@ -1,535 +1,535 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// APIOperationsClient is the composite Swagger for ApiManagement Client -type APIOperationsClient struct { - ManagementClient -} - -// NewAPIOperationsClient creates an instance of the APIOperationsClient -// client. -func NewAPIOperationsClient(subscriptionID string) APIOperationsClient { - return NewAPIOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationsClientWithBaseURI creates an instance of the -// APIOperationsClient client. -func NewAPIOperationsClientWithBaseURI(baseURI string, subscriptionID string) APIOperationsClient { - return APIOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new API operation or updates an existing one. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. parameters is create parameters. -func (client APIOperationsClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.Method", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.URLTemplate", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.URLTemplate", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.URLTemplate", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, operationID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIOperationsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified operation. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. ifMatch is eTag of the API Operation Entity. ETag should -// match the current entity state from the header response of the GET request -// or it should be * for unconditional update. -func (client APIOperationsClient) Delete(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationsClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIOperationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the API Operation specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. -func (client APIOperationsClient) Get(resourceGroupName string, serviceName string, aPIID string, operationID string) (result OperationContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationsClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIOperationsClient) GetResponder(resp *http.Response) (result OperationContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByApis lists a collection of the operations for the specified API. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. filter is | Field | -// Supported operators | Supported functions | -// |-------------|------------------------|-----------------------------------| -// | name | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | method | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | urlTemplate | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// top is number of records to return. skip is number of records to skip. -func (client APIOperationsClient) ListByApis(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (result OperationCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "ListByApis") - } - - req, err := client.ListByApisPreparer(resourceGroupName, serviceName, aPIID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure sending request") - return - } - - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure responding to request") - } - - return -} - -// ListByApisPreparer prepares the ListByApis request. -func (client APIOperationsClient) ListByApisPreparer(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByApisSender sends the ListByApis request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsClient) ListByApisSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByApisResponder handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (client APIOperationsClient) ListByApisResponder(resp *http.Response) (result OperationCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByApisNextResults retrieves the next set of results, if any. -func (client APIOperationsClient) ListByApisNextResults(lastResults OperationCollection) (result OperationCollection, err error) { - req, err := lastResults.OperationCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure sending next results request") - } - - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the details of the operation specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. parameters is aPI Operation Update parameters. ifMatch is -// eTag of the API Operation Entity. ETag should match the current entity state -// from the header response of the GET request or it should be * for -// unconditional update. -func (client APIOperationsClient) Update(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationUpdateContract, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, aPIID, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIOperationsClient) UpdatePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIOperationsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// APIOperationsClient is the composite Swagger for ApiManagement Client +type APIOperationsClient struct { + ManagementClient +} + +// NewAPIOperationsClient creates an instance of the APIOperationsClient +// client. +func NewAPIOperationsClient(subscriptionID string) APIOperationsClient { + return NewAPIOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIOperationsClientWithBaseURI creates an instance of the +// APIOperationsClient client. +func NewAPIOperationsClientWithBaseURI(baseURI string, subscriptionID string) APIOperationsClient { + return APIOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new API operation or updates an existing one. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. parameters is create parameters. +func (client APIOperationsClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.Method", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.URLTemplate", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.URLTemplate", Name: validation.MaxLength, Rule: 1000, Chain: nil}, + {Target: "parameters.URLTemplate", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, operationID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client APIOperationsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client APIOperationsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified operation. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. ifMatch is eTag of the API Operation Entity. ETag should +// match the current entity state from the header response of the GET request +// or it should be * for unconditional update. +func (client APIOperationsClient) Delete(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, operationID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIOperationsClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client APIOperationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the API Operation specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. +func (client APIOperationsClient) Get(resourceGroupName string, serviceName string, aPIID string, operationID string) (result OperationContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIOperationsClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIOperationsClient) GetResponder(resp *http.Response) (result OperationContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByApis lists a collection of the operations for the specified API. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. filter is | Field | +// Supported operators | Supported functions | +// |-------------|------------------------|-----------------------------------| +// | name | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | method | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | urlTemplate | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// top is number of records to return. skip is number of records to skip. +func (client APIOperationsClient) ListByApis(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (result OperationCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "ListByApis") + } + + req, err := client.ListByApisPreparer(resourceGroupName, serviceName, aPIID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", nil, "Failure preparing request") + return + } + + resp, err := client.ListByApisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure sending request") + return + } + + result, err = client.ListByApisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure responding to request") + } + + return +} + +// ListByApisPreparer prepares the ListByApis request. +func (client APIOperationsClient) ListByApisPreparer(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByApisSender sends the ListByApis request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsClient) ListByApisSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByApisResponder handles the response to the ListByApis request. The method always +// closes the http.Response Body. +func (client APIOperationsClient) ListByApisResponder(resp *http.Response) (result OperationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByApisNextResults retrieves the next set of results, if any. +func (client APIOperationsClient) ListByApisNextResults(lastResults OperationCollection) (result OperationCollection, err error) { + req, err := lastResults.OperationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByApisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure sending next results request") + } + + result, err = client.ListByApisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "ListByApis", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the details of the operation specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. parameters is aPI Operation Update parameters. ifMatch is +// eTag of the API Operation Entity. ETag should match the current entity state +// from the header response of the GET request or it should be * for +// unconditional update. +func (client APIOperationsClient) Update(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationUpdateContract, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, aPIID, operationID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client APIOperationsClient) UpdatePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters OperationUpdateContract, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client APIOperationsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperationspolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperationspolicy.go index 3611688aac..2c16dedad7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperationspolicy.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apioperationspolicy.go @@ -1,312 +1,312 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "io" - "net/http" -) - -// APIOperationsPolicyClient is the composite Swagger for ApiManagement Client -type APIOperationsPolicyClient struct { - ManagementClient -} - -// NewAPIOperationsPolicyClient creates an instance of the -// APIOperationsPolicyClient client. -func NewAPIOperationsPolicyClient(subscriptionID string) APIOperationsPolicyClient { - return NewAPIOperationsPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIOperationsPolicyClientWithBaseURI creates an instance of the -// APIOperationsPolicyClient client. -func NewAPIOperationsPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIOperationsPolicyClient { - return APIOperationsPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API Operation -// level. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. parameters is the policy contents to apply. parameters -// will be closed upon successful return. Callers should ensure closure when -// receiving an error.ifMatch is the entity state (Etag) version of the Api -// Operation policy to update. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client APIOperationsPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, operationID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIOperationsPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policy", pathParameters), - autorest.WithFile(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIOperationsPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the policy configuration at the Api Operation. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. ifMatch is the entity state (Etag) version of the Api -// operation policy to update. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client APIOperationsPolicyClient) Delete(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsPolicyClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, operationID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIOperationsPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIOperationsPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the policy configuration at the API Operation level. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. operationID is operation -// identifier within an API. Must be unique in the current API Management -// service instance. -func (client APIOperationsPolicyClient) Get(resourceGroupName string, serviceName string, aPIID string, operationID string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: operationID, - Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsPolicyClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIOperationsPolicyClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIOperationsPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIOperationsPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "io" + "net/http" +) + +// APIOperationsPolicyClient is the composite Swagger for ApiManagement Client +type APIOperationsPolicyClient struct { + ManagementClient +} + +// NewAPIOperationsPolicyClient creates an instance of the +// APIOperationsPolicyClient client. +func NewAPIOperationsPolicyClient(subscriptionID string) APIOperationsPolicyClient { + return NewAPIOperationsPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIOperationsPolicyClientWithBaseURI creates an instance of the +// APIOperationsPolicyClient client. +func NewAPIOperationsPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIOperationsPolicyClient { + return APIOperationsPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates policy configuration for the API Operation +// level. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. parameters is the policy contents to apply. parameters +// will be closed upon successful return. Callers should ensure closure when +// receiving an error.ifMatch is the entity state (Etag) version of the Api +// Operation policy to update. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client APIOperationsPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, operationID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client APIOperationsPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policy", pathParameters), + autorest.WithFile(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client APIOperationsPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the policy configuration at the Api Operation. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. ifMatch is the entity state (Etag) version of the Api +// operation policy to update. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client APIOperationsPolicyClient) Delete(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsPolicyClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, operationID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIOperationsPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, operationID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client APIOperationsPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the policy configuration at the API Operation level. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. operationID is operation +// identifier within an API. Must be unique in the current API Management +// service instance. +func (client APIOperationsPolicyClient) Get(resourceGroupName string, serviceName string, aPIID string, operationID string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: operationID, + Constraints: []validation.Constraint{{Target: "operationID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "operationID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "operationID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIOperationsPolicyClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIOperationsPolicyClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIOperationsPolicyClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIOperationsPolicyClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIOperationsPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apipolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apipolicy.go index 67d8d028a6..bf65107c5e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apipolicy.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apipolicy.go @@ -1,289 +1,289 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "io" - "net/http" -) - -// APIPolicyClient is the composite Swagger for ApiManagement Client -type APIPolicyClient struct { - ManagementClient -} - -// NewAPIPolicyClient creates an instance of the APIPolicyClient client. -func NewAPIPolicyClient(subscriptionID string) APIPolicyClient { - return NewAPIPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIPolicyClientWithBaseURI creates an instance of the APIPolicyClient -// client. -func NewAPIPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIPolicyClient { - return APIPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the API. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. parameters is the policy -// contents to apply. parameters will be closed upon successful return. Callers -// should ensure closure when receiving an error.ifMatch is the entity state -// (Etag) version of the Api Policy to update. A value of "*" can be used for -// If-Match to unconditionally apply the operation. -func (client APIPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policy", pathParameters), - autorest.WithFile(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the policy configuration at the Api. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. ifMatch is the entity state -// (Etag) version of the Api policy to update. A value of "*" can be used for -// If-Match to unconditionally apply the operation. -func (client APIPolicyClient) Delete(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIPolicyClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the policy configuration at the API level. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. -func (client APIPolicyClient) Get(resourceGroupName string, serviceName string, aPIID string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIPolicyClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIPolicyClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "io" + "net/http" +) + +// APIPolicyClient is the composite Swagger for ApiManagement Client +type APIPolicyClient struct { + ManagementClient +} + +// NewAPIPolicyClient creates an instance of the APIPolicyClient client. +func NewAPIPolicyClient(subscriptionID string) APIPolicyClient { + return NewAPIPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIPolicyClientWithBaseURI creates an instance of the APIPolicyClient +// client. +func NewAPIPolicyClientWithBaseURI(baseURI string, subscriptionID string) APIPolicyClient { + return APIPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates policy configuration for the API. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. parameters is the policy +// contents to apply. parameters will be closed upon successful return. Callers +// should ensure closure when receiving an error.ifMatch is the entity state +// (Etag) version of the Api Policy to update. A value of "*" can be used for +// If-Match to unconditionally apply the operation. +func (client APIPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client APIPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policy", pathParameters), + autorest.WithFile(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client APIPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client APIPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the policy configuration at the Api. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. ifMatch is the entity state +// (Etag) version of the Api policy to update. A value of "*" can be used for +// If-Match to unconditionally apply the operation. +func (client APIPolicyClient) Delete(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIPolicyClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client APIPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client APIPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the policy configuration at the API level. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. +func (client APIPolicyClient) Get(resourceGroupName string, serviceName string, aPIID string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIPolicyClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIPolicyClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIPolicyClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIPolicyClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiproducts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiproducts.go index 380ac80bfa..e1b2cf73fe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiproducts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apiproducts.go @@ -1,166 +1,166 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// APIProductsClient is the composite Swagger for ApiManagement Client -type APIProductsClient struct { - ManagementClient -} - -// NewAPIProductsClient creates an instance of the APIProductsClient client. -func NewAPIProductsClient(subscriptionID string) APIProductsClient { - return NewAPIProductsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIProductsClientWithBaseURI creates an instance of the APIProductsClient -// client. -func NewAPIProductsClientWithBaseURI(baseURI string, subscriptionID string) APIProductsClient { - return APIProductsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByApis lists all API associated products. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. filter is | Field | Supported -// operators | Supported functions | -// |-------|------------------------|---------------------------------------------| -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of records to -// skip. -func (client APIProductsClient) ListByApis(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (result ProductCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.APIProductsClient", "ListByApis") - } - - req, err := client.ListByApisPreparer(resourceGroupName, serviceName, aPIID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", nil, "Failure preparing request") - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure sending request") - return - } - - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure responding to request") - } - - return -} - -// ListByApisPreparer prepares the ListByApis request. -func (client APIProductsClient) ListByApisPreparer(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByApisSender sends the ListByApis request. The method will close the -// http.Response Body if it receives an error. -func (client APIProductsClient) ListByApisSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByApisResponder handles the response to the ListByApis request. The method always -// closes the http.Response Body. -func (client APIProductsClient) ListByApisResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByApisNextResults retrieves the next set of results, if any. -func (client APIProductsClient) ListByApisNextResults(lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.ProductCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByApisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure sending next results request") - } - - result, err = client.ListByApisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// APIProductsClient is the composite Swagger for ApiManagement Client +type APIProductsClient struct { + ManagementClient +} + +// NewAPIProductsClient creates an instance of the APIProductsClient client. +func NewAPIProductsClient(subscriptionID string) APIProductsClient { + return NewAPIProductsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIProductsClientWithBaseURI creates an instance of the APIProductsClient +// client. +func NewAPIProductsClientWithBaseURI(baseURI string, subscriptionID string) APIProductsClient { + return APIProductsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByApis lists all API associated products. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. filter is | Field | Supported +// operators | Supported functions | +// |-------|------------------------|---------------------------------------------| +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of records to +// skip. +func (client APIProductsClient) ListByApis(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (result ProductCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.APIProductsClient", "ListByApis") + } + + req, err := client.ListByApisPreparer(resourceGroupName, serviceName, aPIID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", nil, "Failure preparing request") + return + } + + resp, err := client.ListByApisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure sending request") + return + } + + result, err = client.ListByApisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure responding to request") + } + + return +} + +// ListByApisPreparer prepares the ListByApis request. +func (client APIProductsClient) ListByApisPreparer(resourceGroupName string, serviceName string, aPIID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByApisSender sends the ListByApis request. The method will close the +// http.Response Body if it receives an error. +func (client APIProductsClient) ListByApisSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByApisResponder handles the response to the ListByApis request. The method always +// closes the http.Response Body. +func (client APIProductsClient) ListByApisResponder(resp *http.Response) (result ProductCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByApisNextResults retrieves the next set of results, if any. +func (client APIProductsClient) ListByApisNextResults(lastResults ProductCollection) (result ProductCollection, err error) { + req, err := lastResults.ProductCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByApisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure sending next results request") + } + + result, err = client.ListByApisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.APIProductsClient", "ListByApis", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apis.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apis.go index 1825da47ee..63c6cbce96 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apis.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/apis.go @@ -1,512 +1,512 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ApisClient is the composite Swagger for ApiManagement Client -type ApisClient struct { - ManagementClient -} - -// NewApisClient creates an instance of the ApisClient client. -func NewApisClient(subscriptionID string) ApisClient { - return NewApisClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApisClientWithBaseURI creates an instance of the ApisClient client. -func NewApisClientWithBaseURI(baseURI string, subscriptionID string) ApisClient { - return ApisClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new or updates existing specified API of the API -// Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. parameters is create or update -// parameters. ifMatch is eTag of the Api Entity. For Create Api Etag should -// not be specified. For Update Etag should match the existing Entity or it can -// be * for unconditional update. -func (client ApisClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, parameters APIContract, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.ServiceURL", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}, - {Target: "parameters.ServiceURL", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.Path", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Path", Name: validation.MaxLength, Rule: 400, Chain: nil}, - {Target: "parameters.Path", Name: validation.MinLength, Rule: 0, Chain: nil}, - }}, - {Target: "parameters.Protocols", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApisClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, parameters APIContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApisClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApisClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified API of the API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. ifMatch is eTag of the API -// Entity. ETag should match the current entity state from the header response -// of the GET request or it should be * for unconditional update. -func (client ApisClient) Delete(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApisClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApisClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApisClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the API specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. -func (client ApisClient) Get(resourceGroupName string, serviceName string, aPIID string) (result APIContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApisClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApisClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApisClient) GetResponder(resp *http.Response) (result APIContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists all APIs of the API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators -// | Supported functions | -// |-------------|------------------------|-----------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | serviceUrl | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// | path | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | -// top is number of records to return. skip is number of records to skip. -func (client ApisClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APICollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ApisClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ApisClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ApisClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client ApisClient) ListByServiceNextResults(lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.APICollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the specified API of the API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aPIID is aPI identifier. Must be unique in -// the current API Management service instance. parameters is aPI Update -// Contract parameters. ifMatch is eTag of the API entity. ETag should match -// the current entity state in the header response of the GET request or it -// should be * for unconditional update. -func (client ApisClient) Update(resourceGroupName string, serviceName string, aPIID string, parameters APIUpdateContract, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, aPIID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApisClient) UpdatePreparer(resourceGroupName string, serviceName string, aPIID string, parameters APIUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApisClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApisClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ApisClient is the composite Swagger for ApiManagement Client +type ApisClient struct { + ManagementClient +} + +// NewApisClient creates an instance of the ApisClient client. +func NewApisClient(subscriptionID string) ApisClient { + return NewApisClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApisClientWithBaseURI creates an instance of the ApisClient client. +func NewApisClientWithBaseURI(baseURI string, subscriptionID string) ApisClient { + return ApisClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates new or updates existing specified API of the API +// Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. parameters is create or update +// parameters. ifMatch is eTag of the Api Entity. For Create Api Etag should +// not be specified. For Update Etag should match the existing Entity or it can +// be * for unconditional update. +func (client ApisClient) CreateOrUpdate(resourceGroupName string, serviceName string, aPIID string, parameters APIContract, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.ServiceURL", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ServiceURL", Name: validation.MaxLength, Rule: 2000, Chain: nil}, + {Target: "parameters.ServiceURL", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Path", Name: validation.MaxLength, Rule: 400, Chain: nil}, + {Target: "parameters.Path", Name: validation.MinLength, Rule: 0, Chain: nil}, + }}, + {Target: "parameters.Protocols", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, aPIID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ApisClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, aPIID string, parameters APIContract, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ApisClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ApisClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified API of the API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. ifMatch is eTag of the API +// Entity. ETag should match the current entity state from the header response +// of the GET request or it should be * for unconditional update. +func (client ApisClient) Delete(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, aPIID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApisClient) DeletePreparer(resourceGroupName string, serviceName string, aPIID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApisClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApisClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the API specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. +func (client ApisClient) Get(resourceGroupName string, serviceName string, aPIID string) (result APIContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, aPIID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApisClient) GetPreparer(resourceGroupName string, serviceName string, aPIID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApisClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApisClient) GetResponder(resp *http.Response) (result APIContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists all APIs of the API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators +// | Supported functions | +// |-------------|------------------------|-----------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | serviceUrl | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// | path | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | +// top is number of records to return. skip is number of records to skip. +func (client ApisClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result APICollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client ApisClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client ApisClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client ApisClient) ListByServiceResponder(resp *http.Response) (result APICollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client ApisClient) ListByServiceNextResults(lastResults APICollection) (result APICollection, err error) { + req, err := lastResults.APICollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specified API of the API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aPIID is aPI identifier. Must be unique in +// the current API Management service instance. parameters is aPI Update +// Contract parameters. ifMatch is eTag of the API entity. ETag should match +// the current entity state in the header response of the GET request or it +// should be * for unconditional update. +func (client ApisClient) Update(resourceGroupName string, serviceName string, aPIID string, parameters APIUpdateContract, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ApisClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, aPIID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ApisClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ApisClient) UpdatePreparer(resourceGroupName string, serviceName string, aPIID string, parameters APIUpdateContract, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ApisClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ApisClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/authorizationservers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/authorizationservers.go index cfbf869f81..e86fadd130 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/authorizationservers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/authorizationservers.go @@ -1,500 +1,500 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AuthorizationServersClient is the composite Swagger for ApiManagement Client -type AuthorizationServersClient struct { - ManagementClient -} - -// NewAuthorizationServersClient creates an instance of the -// AuthorizationServersClient client. -func NewAuthorizationServersClient(subscriptionID string) AuthorizationServersClient { - return NewAuthorizationServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAuthorizationServersClientWithBaseURI creates an instance of the -// AuthorizationServersClient client. -func NewAuthorizationServersClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationServersClient { - return AuthorizationServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates new authorization server or updates an existing -// authorization server. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. authsid is identifier of the authorization -// server. parameters is create or update parameters. -func (client AuthorizationServersClient) CreateOrUpdate(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.ClientRegistrationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AuthorizationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.GrantTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, authsid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AuthorizationServersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AuthorizationServersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes specific authorization server instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. authsid is identifier of the authorization -// server. ifMatch is the entity state (Etag) version of the authentication -// server to delete. A value of "*" can be used for If-Match to unconditionally -// apply the operation. -func (client AuthorizationServersClient) Delete(resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, authsid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AuthorizationServersClient) DeletePreparer(resourceGroupName string, serviceName string, authsid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AuthorizationServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the authorization server specified by its -// identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. authsid is identifier of the authorization -// server. -func (client AuthorizationServersClient) Get(resourceGroupName string, serviceName string, authsid string) (result OAuth2AuthorizationServerContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, authsid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AuthorizationServersClient) GetPreparer(resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AuthorizationServersClient) GetResponder(resp *http.Response) (result OAuth2AuthorizationServerContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of authorization servers defined within a -// service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators | -// Supported functions | -// |-------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of records to -// skip. -func (client AuthorizationServersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client AuthorizationServersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client AuthorizationServersClient) ListByServiceResponder(resp *http.Response) (result AuthorizationServerCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client AuthorizationServersClient) ListByServiceNextResults(lastResults AuthorizationServerCollection) (result AuthorizationServerCollection, err error) { - req, err := lastResults.AuthorizationServerCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the details of the authorization server specified by its -// identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. authsid is identifier of the authorization -// server. parameters is oAuth2 Server settings Update parameters. ifMatch is -// the entity state (Etag) version of the authorization server to update. A -// value of "*" can be used for If-Match to unconditionally apply the -// operation. -func (client AuthorizationServersClient) Update(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerUpdateContract, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: authsid, - Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, authsid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AuthorizationServersClient) UpdatePreparer(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authsid": autorest.Encode("path", authsid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationServersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AuthorizationServersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AuthorizationServersClient is the composite Swagger for ApiManagement Client +type AuthorizationServersClient struct { + ManagementClient +} + +// NewAuthorizationServersClient creates an instance of the +// AuthorizationServersClient client. +func NewAuthorizationServersClient(subscriptionID string) AuthorizationServersClient { + return NewAuthorizationServersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAuthorizationServersClientWithBaseURI creates an instance of the +// AuthorizationServersClient client. +func NewAuthorizationServersClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationServersClient { + return AuthorizationServersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates new authorization server or updates an existing +// authorization server. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. authsid is identifier of the authorization +// server. parameters is create or update parameters. +func (client AuthorizationServersClient) CreateOrUpdate(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: authsid, + Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.ClientRegistrationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AuthorizationEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.GrantTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, authsid, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AuthorizationServersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authsid": autorest.Encode("path", authsid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationServersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AuthorizationServersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes specific authorization server instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. authsid is identifier of the authorization +// server. ifMatch is the entity state (Etag) version of the authentication +// server to delete. A value of "*" can be used for If-Match to unconditionally +// apply the operation. +func (client AuthorizationServersClient) Delete(resourceGroupName string, serviceName string, authsid string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: authsid, + Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, authsid, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AuthorizationServersClient) DeletePreparer(resourceGroupName string, serviceName string, authsid string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authsid": autorest.Encode("path", authsid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationServersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AuthorizationServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the authorization server specified by its +// identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. authsid is identifier of the authorization +// server. +func (client AuthorizationServersClient) Get(resourceGroupName string, serviceName string, authsid string) (result OAuth2AuthorizationServerContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: authsid, + Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, authsid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AuthorizationServersClient) GetPreparer(resourceGroupName string, serviceName string, authsid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authsid": autorest.Encode("path", authsid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationServersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AuthorizationServersClient) GetResponder(resp *http.Response) (result OAuth2AuthorizationServerContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of authorization servers defined within a +// service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators | +// Supported functions | +// |-------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of records to +// skip. +func (client AuthorizationServersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result AuthorizationServerCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client AuthorizationServersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationServersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client AuthorizationServersClient) ListByServiceResponder(resp *http.Response) (result AuthorizationServerCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client AuthorizationServersClient) ListByServiceNextResults(lastResults AuthorizationServerCollection) (result AuthorizationServerCollection, err error) { + req, err := lastResults.AuthorizationServerCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the details of the authorization server specified by its +// identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. authsid is identifier of the authorization +// server. parameters is oAuth2 Server settings Update parameters. ifMatch is +// the entity state (Etag) version of the authorization server to update. A +// value of "*" can be used for If-Match to unconditionally apply the +// operation. +func (client AuthorizationServersClient) Update(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerUpdateContract, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: authsid, + Constraints: []validation.Constraint{{Target: "authsid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "authsid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.AuthorizationServersClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, authsid, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.AuthorizationServersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AuthorizationServersClient) UpdatePreparer(resourceGroupName string, serviceName string, authsid string, parameters OAuth2AuthorizationServerUpdateContract, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authsid": autorest.Encode("path", authsid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationServersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AuthorizationServersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/backends.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/backends.go index 93298f9995..807088d83c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/backends.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/backends.go @@ -1,492 +1,492 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// BackendsClient is the composite Swagger for ApiManagement Client -type BackendsClient struct { - ManagementClient -} - -// NewBackendsClient creates an instance of the BackendsClient client. -func NewBackendsClient(subscriptionID string) BackendsClient { - return NewBackendsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackendsClientWithBaseURI creates an instance of the BackendsClient -// client. -func NewBackendsClientWithBaseURI(baseURI string, subscriptionID string) BackendsClient { - return BackendsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a backend. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. backendid is identifier of the Backend -// entity. Must be unique in the current API Management service instance. -// parameters is create parameters. -func (client BackendsClient) CreateOrUpdate(resourceGroupName string, serviceName string, backendid string, parameters BackendContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendid, - Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, backendid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackendsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, backendid string, parameters BackendContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendid": autorest.Encode("path", backendid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackendsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client BackendsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified backend. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. backendid is identifier of the Backend -// entity. Must be unique in the current API Management service instance. -// ifMatch is the entity state (Etag) version of the backend to delete. A value -// of "*" can be used for If-Match to unconditionally apply the operation. -func (client BackendsClient) Delete(resourceGroupName string, serviceName string, backendid string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendid, - Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, backendid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackendsClient) DeletePreparer(resourceGroupName string, serviceName string, backendid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendid": autorest.Encode("path", backendid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackendsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackendsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the backend specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. backendid is identifier of the Backend -// entity. Must be unique in the current API Management service instance. -func (client BackendsClient) Get(resourceGroupName string, serviceName string, backendid string) (result BackendResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendid, - Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, backendid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackendsClient) GetPreparer(resourceGroupName string, serviceName string, backendid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendid": autorest.Encode("path", backendid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackendsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackendsClient) GetResponder(resp *http.Response) (result BackendResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of backends in the specified service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators | -// Supported functions | -// |-------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | host | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of records to -// skip. -func (client BackendsClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client BackendsClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client BackendsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client BackendsClient) ListByServiceResponder(resp *http.Response) (result BackendCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client BackendsClient) ListByServiceNextResults(lastResults BackendCollection) (result BackendCollection, err error) { - req, err := lastResults.BackendCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates an existing backend. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. backendid is identifier of the Backend -// entity. Must be unique in the current API Management service instance. -// parameters is update parameters. ifMatch is the entity state (Etag) version -// of the backend to update. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client BackendsClient) Update(resourceGroupName string, serviceName string, backendid string, parameters BackendUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: backendid, - Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, - {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, backendid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackendsClient) UpdatePreparer(resourceGroupName string, serviceName string, backendid string, parameters BackendUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backendid": autorest.Encode("path", backendid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackendsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackendsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// BackendsClient is the composite Swagger for ApiManagement Client +type BackendsClient struct { + ManagementClient +} + +// NewBackendsClient creates an instance of the BackendsClient client. +func NewBackendsClient(subscriptionID string) BackendsClient { + return NewBackendsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackendsClientWithBaseURI creates an instance of the BackendsClient +// client. +func NewBackendsClientWithBaseURI(baseURI string, subscriptionID string) BackendsClient { + return BackendsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a backend. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. backendid is identifier of the Backend +// entity. Must be unique in the current API Management service instance. +// parameters is create parameters. +func (client BackendsClient) CreateOrUpdate(resourceGroupName string, serviceName string, backendid string, parameters BackendContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: backendid, + Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, backendid, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BackendsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, backendid string, parameters BackendContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendid": autorest.Encode("path", backendid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BackendsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BackendsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified backend. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. backendid is identifier of the Backend +// entity. Must be unique in the current API Management service instance. +// ifMatch is the entity state (Etag) version of the backend to delete. A value +// of "*" can be used for If-Match to unconditionally apply the operation. +func (client BackendsClient) Delete(resourceGroupName string, serviceName string, backendid string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: backendid, + Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, backendid, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BackendsClient) DeletePreparer(resourceGroupName string, serviceName string, backendid string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendid": autorest.Encode("path", backendid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BackendsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BackendsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the backend specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. backendid is identifier of the Backend +// entity. Must be unique in the current API Management service instance. +func (client BackendsClient) Get(resourceGroupName string, serviceName string, backendid string) (result BackendResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: backendid, + Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, backendid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackendsClient) GetPreparer(resourceGroupName string, serviceName string, backendid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendid": autorest.Encode("path", backendid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackendsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackendsClient) GetResponder(resp *http.Response) (result BackendResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of backends in the specified service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators | +// Supported functions | +// |-------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | host | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of records to +// skip. +func (client BackendsClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result BackendCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client BackendsClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client BackendsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client BackendsClient) ListByServiceResponder(resp *http.Response) (result BackendCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client BackendsClient) ListByServiceNextResults(lastResults BackendCollection) (result BackendCollection, err error) { + req, err := lastResults.BackendCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates an existing backend. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. backendid is identifier of the Backend +// entity. Must be unique in the current API Management service instance. +// parameters is update parameters. ifMatch is the entity state (Etag) version +// of the backend to update. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client BackendsClient) Update(resourceGroupName string, serviceName string, backendid string, parameters BackendUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: backendid, + Constraints: []validation.Constraint{{Target: "backendid", Name: validation.MaxLength, Rule: 255, Chain: nil}, + {Target: "backendid", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "backendid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.BackendsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, backendid, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.BackendsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackendsClient) UpdatePreparer(resourceGroupName string, serviceName string, backendid string, parameters BackendUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendid": autorest.Encode("path", backendid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackendsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackendsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/certificates.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/certificates.go index 7c8aaa860b..0c4187e111 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/certificates.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/certificates.go @@ -1,422 +1,422 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CertificatesClient is the composite Swagger for ApiManagement Client -type CertificatesClient struct { - ManagementClient -} - -// NewCertificatesClient creates an instance of the CertificatesClient client. -func NewCertificatesClient(subscriptionID string) CertificatesClient { - return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificatesClientWithBaseURI creates an instance of the -// CertificatesClient client. -func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { - return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the certificate being used for -// authentication with the backend. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. certificateID is identifier of the -// certificate entity. Must be unique in the current API Management service -// instance. parameters is create parameters. ifMatch is the entity state -// (Etag) version of the certificate to update. A value of "*" can be used for -// If-Match to unconditionally apply the operation.. -func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Data", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Password", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, certificateID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes specific certificate. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. certificateID is identifier of the -// certificate entity. Must be unique in the current API Management service -// instance. ifMatch is the entity state (Etag) version of the certificate to -// delete. A value of "*" can be used for If-Match to unconditionally apply the -// operation. -func (client CertificatesClient) Delete(resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, certificateID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificatesClient) DeletePreparer(resourceGroupName string, serviceName string, certificateID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the certificate specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. certificateID is identifier of the -// certificate entity. Must be unique in the current API Management service -// instance. -func (client CertificatesClient) Get(resourceGroupName string, serviceName string, certificateID string) (result CertificateContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: certificateID, - Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, certificateID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificatesClient) GetPreparer(resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateId": autorest.Encode("path", certificateID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificatesClient) GetResponder(resp *http.Response) (result CertificateContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of all certificates in the specified -// service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported -// operators | Supported functions | -// |----------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | subject | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | thumbprint | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | expirationDate | ge, le, eq, ne, gt, lt | N/A -// | top is number of records to return. skip is number of records to skip. -func (client CertificatesClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result CertificateCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client CertificatesClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client CertificatesClient) ListByServiceResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client CertificatesClient) ListByServiceNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.CertificateCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CertificatesClient is the composite Swagger for ApiManagement Client +type CertificatesClient struct { + ManagementClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the +// CertificatesClient client. +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the certificate being used for +// authentication with the backend. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. certificateID is identifier of the +// certificate entity. Must be unique in the current API Management service +// instance. parameters is create parameters. ifMatch is the entity state +// (Etag) version of the certificate to update. A value of "*" can be used for +// If-Match to unconditionally apply the operation.. +func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: certificateID, + Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Data", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Password", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, certificateID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, certificateID string, parameters CertificateCreateOrUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateId": autorest.Encode("path", certificateID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes specific certificate. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. certificateID is identifier of the +// certificate entity. Must be unique in the current API Management service +// instance. ifMatch is the entity state (Etag) version of the certificate to +// delete. A value of "*" can be used for If-Match to unconditionally apply the +// operation. +func (client CertificatesClient) Delete(resourceGroupName string, serviceName string, certificateID string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: certificateID, + Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, certificateID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(resourceGroupName string, serviceName string, certificateID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateId": autorest.Encode("path", certificateID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the certificate specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. certificateID is identifier of the +// certificate entity. Must be unique in the current API Management service +// instance. +func (client CertificatesClient) Get(resourceGroupName string, serviceName string, certificateID string) (result CertificateContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: certificateID, + Constraints: []validation.Constraint{{Target: "certificateID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "certificateID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "certificateID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, certificateID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(resourceGroupName string, serviceName string, certificateID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateId": autorest.Encode("path", certificateID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result CertificateContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of all certificates in the specified +// service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported +// operators | Supported functions | +// |----------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | subject | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | thumbprint | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | expirationDate | ge, le, eq, ne, gt, lt | N/A +// | top is number of records to return. skip is number of records to skip. +func (client CertificatesClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result CertificateCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.CertificatesClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client CertificatesClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListByServiceResponder(resp *http.Response) (result CertificateCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListByServiceNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { + req, err := lastResults.CertificateCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.CertificatesClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/client.go index 2c380e4f90..8abb7d74e8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/client.go @@ -1,53 +1,53 @@ -// Package apimanagement implements the Azure ARM Apimanagement service API -// version . -// -// Composite Swagger for ApiManagement Client -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Apimanagement - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Apimanagement. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package apimanagement implements the Azure ARM Apimanagement service API +// version . +// +// Composite Swagger for ApiManagement Client +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Apimanagement + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Apimanagement. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groups.go index 043288cfaa..6d0b626709 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groups.go @@ -1,501 +1,501 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupsClient is the composite Swagger for ApiManagement Client -type GroupsClient struct { - ManagementClient -} - -// NewGroupsClient creates an instance of the GroupsClient client. -func NewGroupsClient(subscriptionID string) GroupsClient { - return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client. -func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { - return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a group. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. parameters is create -// parameters. -func (client GroupsClient) CreateOrUpdate(resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, groupID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes specific group of the API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. ifMatch is eTag of the Group -// Entity. ETag should match the current entity state from the header response -// of the GET request or it should be * for unconditional update. -func (client GroupsClient) Delete(resourceGroupName string, serviceName string, groupID string, ifMatch string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, groupID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupsClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the group specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. -func (client GroupsClient) Get(resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupsClient) GetPreparer(resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetResponder(resp *http.Response) (result GroupContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of groups defined within a service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators -// | Supported functions | -// |-------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | type | eq, ne | N/A -// | top is number of records to return. skip is number of records to skip. -func (client GroupsClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client GroupsClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client GroupsClient) ListByServiceNextResults(lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.GroupCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the details of the group specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. parameters is update -// parameters. ifMatch is eTag of the Group Entity. ETag should match the -// current entity state from the header response of the GET request or it -// should be * for unconditional update. -func (client GroupsClient) Update(resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, groupID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupsClient) UpdatePreparer(resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupsClient) UpdateResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupsClient is the composite Swagger for ApiManagement Client +type GroupsClient struct { + ManagementClient +} + +// NewGroupsClient creates an instance of the GroupsClient client. +func NewGroupsClient(subscriptionID string) GroupsClient { + return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client. +func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { + return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a group. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. parameters is create +// parameters. +func (client GroupsClient) CreateOrUpdate(resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, groupID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes specific group of the API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. ifMatch is eTag of the Group +// Entity. ETag should match the current entity state from the header response +// of the GET request or it should be * for unconditional update. +func (client GroupsClient) Delete(resourceGroupName string, serviceName string, groupID string, ifMatch string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, groupID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GroupsClient) DeletePreparer(resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupsClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the details of the group specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. +func (client GroupsClient) Get(resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupsClient) GetPreparer(resourceGroupName string, serviceName string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetResponder(resp *http.Response) (result GroupContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of groups defined within a service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators +// | Supported functions | +// |-------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | type | eq, ne | N/A +// | top is number of records to return. skip is number of records to skip. +func (client GroupsClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client GroupsClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client GroupsClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client GroupsClient) ListByServiceNextResults(lastResults GroupCollection) (result GroupCollection, err error) { + req, err := lastResults.GroupCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the details of the group specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. parameters is update +// parameters. ifMatch is eTag of the Group Entity. ETag should match the +// current entity state from the header response of the GET request or it +// should be * for unconditional update. +func (client GroupsClient) Update(resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, groupID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GroupsClient) UpdatePreparer(resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GroupsClient) UpdateResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groupusers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groupusers.go index 2545c0e461..6df3b94435 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groupusers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/groupusers.go @@ -1,351 +1,351 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupUsersClient is the composite Swagger for ApiManagement Client -type GroupUsersClient struct { - ManagementClient -} - -// NewGroupUsersClient creates an instance of the GroupUsersClient client. -func NewGroupUsersClient(subscriptionID string) GroupUsersClient { - return NewGroupUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupUsersClientWithBaseURI creates an instance of the GroupUsersClient -// client. -func NewGroupUsersClientWithBaseURI(baseURI string, subscriptionID string) GroupUsersClient { - return GroupUsersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds a user to the specified group. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. UID is user identifier. Must -// be unique in the current API Management service instance. -func (client GroupUsersClient) Create(resourceGroupName string, serviceName string, groupID string, UID string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupUsersClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, serviceName, groupID, UID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupUsersClient) CreatePreparer(resourceGroupName string, serviceName string, groupID string, UID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{uid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUsersClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupUsersClient) CreateResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove existing user from existing group. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. UID is user identifier. Must -// be unique in the current API Management service instance. -func (client GroupUsersClient) Delete(resourceGroupName string, serviceName string, groupID string, UID string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupUsersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, groupID, UID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupUsersClient) DeletePreparer(resourceGroupName string, serviceName string, groupID string, UID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{uid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUsersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupUsersClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByGroups lists a collection of the members of the group, specified by -// its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. groupID is group identifier. Must be unique -// in the current API Management service instance. filter is | Field -// | Supported operators | Supported functions | -// |------------------|------------------------|-----------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | firstName | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | lastName | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | email | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | state | eq | N/A -// | -// | registrationDate | ge, le, eq, ne, gt, lt | N/A -// | -// | note | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | top is number of records to return. skip is number of -// records to skip. -func (client GroupUsersClient) ListByGroups(resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupUsersClient", "ListByGroups") - } - - req, err := client.ListByGroupsPreparer(resourceGroupName, serviceName, groupID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", nil, "Failure preparing request") - return - } - - resp, err := client.ListByGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure sending request") - return - } - - result, err = client.ListByGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure responding to request") - } - - return -} - -// ListByGroupsPreparer prepares the ListByGroups request. -func (client GroupUsersClient) ListByGroupsPreparer(resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByGroupsSender sends the ListByGroups request. The method will close the -// http.Response Body if it receives an error. -func (client GroupUsersClient) ListByGroupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByGroupsResponder handles the response to the ListByGroups request. The method always -// closes the http.Response Body. -func (client GroupUsersClient) ListByGroupsResponder(resp *http.Response) (result UserCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByGroupsNextResults retrieves the next set of results, if any. -func (client GroupUsersClient) ListByGroupsNextResults(lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.UserCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure sending next results request") - } - - result, err = client.ListByGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupUsersClient is the composite Swagger for ApiManagement Client +type GroupUsersClient struct { + ManagementClient +} + +// NewGroupUsersClient creates an instance of the GroupUsersClient client. +func NewGroupUsersClient(subscriptionID string) GroupUsersClient { + return NewGroupUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupUsersClientWithBaseURI creates an instance of the GroupUsersClient +// client. +func NewGroupUsersClientWithBaseURI(baseURI string, subscriptionID string) GroupUsersClient { + return GroupUsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create adds a user to the specified group. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. UID is user identifier. Must +// be unique in the current API Management service instance. +func (client GroupUsersClient) Create(resourceGroupName string, serviceName string, groupID string, UID string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupUsersClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, serviceName, groupID, UID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client GroupUsersClient) CreatePreparer(resourceGroupName string, serviceName string, groupID string, UID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{uid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GroupUsersClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GroupUsersClient) CreateResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete remove existing user from existing group. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. UID is user identifier. Must +// be unique in the current API Management service instance. +func (client GroupUsersClient) Delete(resourceGroupName string, serviceName string, groupID string, UID string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupUsersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, groupID, UID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GroupUsersClient) DeletePreparer(resourceGroupName string, serviceName string, groupID string, UID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{uid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupUsersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupUsersClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByGroups lists a collection of the members of the group, specified by +// its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. groupID is group identifier. Must be unique +// in the current API Management service instance. filter is | Field +// | Supported operators | Supported functions | +// |------------------|------------------------|-----------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | firstName | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | lastName | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | email | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | state | eq | N/A +// | +// | registrationDate | ge, le, eq, ne, gt, lt | N/A +// | +// | note | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | top is number of records to return. skip is number of +// records to skip. +func (client GroupUsersClient) ListByGroups(resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (result UserCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.GroupUsersClient", "ListByGroups") + } + + req, err := client.ListByGroupsPreparer(resourceGroupName, serviceName, groupID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", nil, "Failure preparing request") + return + } + + resp, err := client.ListByGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure sending request") + return + } + + result, err = client.ListByGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure responding to request") + } + + return +} + +// ListByGroupsPreparer prepares the ListByGroups request. +func (client GroupUsersClient) ListByGroupsPreparer(resourceGroupName string, serviceName string, groupID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByGroupsSender sends the ListByGroups request. The method will close the +// http.Response Body if it receives an error. +func (client GroupUsersClient) ListByGroupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByGroupsResponder handles the response to the ListByGroups request. The method always +// closes the http.Response Body. +func (client GroupUsersClient) ListByGroupsResponder(resp *http.Response) (result UserCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByGroupsNextResults retrieves the next set of results, if any. +func (client GroupUsersClient) ListByGroupsNextResults(lastResults UserCollection) (result UserCollection, err error) { + req, err := lastResults.UserCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure sending next results request") + } + + result, err = client.ListByGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.GroupUsersClient", "ListByGroups", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/identityproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/identityproviders.go index f6abc59295..9bc0cc0545 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/identityproviders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/identityproviders.go @@ -1,438 +1,438 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// IdentityProvidersClient is the composite Swagger for ApiManagement Client -type IdentityProvidersClient struct { - ManagementClient -} - -// NewIdentityProvidersClient creates an instance of the -// IdentityProvidersClient client. -func NewIdentityProvidersClient(subscriptionID string) IdentityProvidersClient { - return NewIdentityProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIdentityProvidersClientWithBaseURI creates an instance of the -// IdentityProvidersClient client. -func NewIdentityProvidersClientWithBaseURI(baseURI string, subscriptionID string) IdentityProvidersClient { - return IdentityProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates the IdentityProvider configuration. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. identityProviderName is identity Provider -// Type identifier. parameters is create parameters. -func (client IdentityProvidersClient) CreateOrUpdate(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {Target: "parameters.ClientSecret", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClientSecret", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {Target: "parameters.AllowedTenants", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AllowedTenants", Name: validation.MaxItems, Rule: 32, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, identityProviderName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IdentityProvidersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IdentityProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified identity provider configuration. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. identityProviderName is identity Provider -// Type identifier. ifMatch is the entity state (Etag) version of the backend -// to delete. A value of "*" can be used for If-Match to unconditionally apply -// the operation. -func (client IdentityProvidersClient) Delete(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, identityProviderName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IdentityProvidersClient) DeletePreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IdentityProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the configuration details of the identity Provider configured in -// specified service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. identityProviderName is identity Provider -// Type identifier. -func (client IdentityProvidersClient) Get(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType) (result IdentityProviderContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, identityProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client IdentityProvidersClient) GetPreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProvidersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IdentityProvidersClient) GetResponder(resp *http.Response) (result IdentityProviderContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of Identity Provider configured in the -// specified service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client IdentityProvidersClient) ListByService(resourceGroupName string, serviceName string) (result IdentityProviderList, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client IdentityProvidersClient) ListByServicePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProvidersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client IdentityProvidersClient) ListByServiceResponder(resp *http.Response) (result IdentityProviderList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing IdentityProvider configuration. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. identityProviderName is identity Provider -// Type identifier. parameters is update parameters. ifMatch is the entity -// state (Etag) version of the identity provider configuration to update. A -// value of "*" can be used for If-Match to unconditionally apply the -// operation. -func (client IdentityProvidersClient) Update(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IdentityProvidersClient) UpdatePreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "identityProviderName": autorest.Encode("path", identityProviderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client IdentityProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client IdentityProvidersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// IdentityProvidersClient is the composite Swagger for ApiManagement Client +type IdentityProvidersClient struct { + ManagementClient +} + +// NewIdentityProvidersClient creates an instance of the +// IdentityProvidersClient client. +func NewIdentityProvidersClient(subscriptionID string) IdentityProvidersClient { + return NewIdentityProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIdentityProvidersClientWithBaseURI creates an instance of the +// IdentityProvidersClient client. +func NewIdentityProvidersClientWithBaseURI(baseURI string, subscriptionID string) IdentityProvidersClient { + return IdentityProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates the IdentityProvider configuration. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. identityProviderName is identity Provider +// Type identifier. parameters is create parameters. +func (client IdentityProvidersClient) CreateOrUpdate(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "parameters.ClientSecret", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ClientSecret", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {Target: "parameters.AllowedTenants", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AllowedTenants", Name: validation.MaxItems, Rule: 32, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, identityProviderName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IdentityProvidersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "identityProviderName": autorest.Encode("path", identityProviderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IdentityProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified identity provider configuration. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. identityProviderName is identity Provider +// Type identifier. ifMatch is the entity state (Etag) version of the backend +// to delete. A value of "*" can be used for If-Match to unconditionally apply +// the operation. +func (client IdentityProvidersClient) Delete(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, identityProviderName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IdentityProvidersClient) DeletePreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "identityProviderName": autorest.Encode("path", identityProviderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IdentityProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the configuration details of the identity Provider configured in +// specified service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. identityProviderName is identity Provider +// Type identifier. +func (client IdentityProvidersClient) Get(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType) (result IdentityProviderContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, identityProviderName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IdentityProvidersClient) GetPreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "identityProviderName": autorest.Encode("path", identityProviderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IdentityProvidersClient) GetResponder(resp *http.Response) (result IdentityProviderContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of Identity Provider configured in the +// specified service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client IdentityProvidersClient) ListByService(resourceGroupName string, serviceName string) (result IdentityProviderList, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client IdentityProvidersClient) ListByServicePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityProvidersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client IdentityProvidersClient) ListByServiceResponder(resp *http.Response) (result IdentityProviderList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing IdentityProvider configuration. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. identityProviderName is identity Provider +// Type identifier. parameters is update parameters. ifMatch is the entity +// state (Etag) version of the identity provider configuration to update. A +// value of "*" can be used for If-Match to unconditionally apply the +// operation. +func (client IdentityProvidersClient) Update(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.IdentityProvidersClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.IdentityProvidersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client IdentityProvidersClient) UpdatePreparer(resourceGroupName string, serviceName string, identityProviderName IdentityProviderNameType, parameters IdentityProviderUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "identityProviderName": autorest.Encode("path", identityProviderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client IdentityProvidersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/loggers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/loggers.go index 0baade23b9..8a2506b790 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/loggers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/loggers.go @@ -1,487 +1,487 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LoggersClient is the composite Swagger for ApiManagement Client -type LoggersClient struct { - ManagementClient -} - -// NewLoggersClient creates an instance of the LoggersClient client. -func NewLoggersClient(subscriptionID string) LoggersClient { - return NewLoggersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLoggersClientWithBaseURI creates an instance of the LoggersClient client. -func NewLoggersClientWithBaseURI(baseURI string, subscriptionID string) LoggersClient { - return LoggersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a logger. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. loggerid is logger identifier. Must be unique -// in the API Management service instance. parameters is create parameters. -func (client LoggersClient) CreateOrUpdate(resourceGroupName string, serviceName string, loggerid string, parameters LoggerCreateParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerid, - Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Credentials", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, loggerid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LoggersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, loggerid string, parameters LoggerCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerid": autorest.Encode("path", loggerid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LoggersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LoggersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified logger. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. loggerid is logger identifier. Must be unique -// in the API Management service instance. ifMatch is the entity state (Etag) -// version of the logger to delete. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client LoggersClient) Delete(resourceGroupName string, serviceName string, loggerid string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerid, - Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, loggerid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LoggersClient) DeletePreparer(resourceGroupName string, serviceName string, loggerid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerid": autorest.Encode("path", loggerid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LoggersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LoggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the logger specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. loggerid is logger identifier. Must be unique -// in the API Management service instance. -func (client LoggersClient) Get(resourceGroupName string, serviceName string, loggerid string) (result LoggerResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerid, - Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, loggerid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LoggersClient) GetPreparer(resourceGroupName string, serviceName string, loggerid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerid": autorest.Encode("path", loggerid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LoggersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LoggersClient) GetResponder(resp *http.Response) (result LoggerResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of loggers in the specified service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators | -// Supported functions | -// |-------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | type | eq | -// | top is number of records to return. skip is number of records to skip. -func (client LoggersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client LoggersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client LoggersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client LoggersClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client LoggersClient) ListByServiceNextResults(lastResults LoggerCollection) (result LoggerCollection, err error) { - req, err := lastResults.LoggerCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates an existing logger. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. loggerid is logger identifier. Must be unique -// in the API Management service instance. parameters is update parameters. -// ifMatch is the entity state (Etag) version of the logger to update. A value -// of "*" can be used for If-Match to unconditionally apply the operation. -func (client LoggersClient) Update(resourceGroupName string, serviceName string, loggerid string, parameters LoggerUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: loggerid, - Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, loggerid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LoggersClient) UpdatePreparer(resourceGroupName string, serviceName string, loggerid string, parameters LoggerUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loggerid": autorest.Encode("path", loggerid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client LoggersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client LoggersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LoggersClient is the composite Swagger for ApiManagement Client +type LoggersClient struct { + ManagementClient +} + +// NewLoggersClient creates an instance of the LoggersClient client. +func NewLoggersClient(subscriptionID string) LoggersClient { + return NewLoggersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoggersClientWithBaseURI creates an instance of the LoggersClient client. +func NewLoggersClientWithBaseURI(baseURI string, subscriptionID string) LoggersClient { + return LoggersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a logger. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. loggerid is logger identifier. Must be unique +// in the API Management service instance. parameters is create parameters. +func (client LoggersClient) CreateOrUpdate(resourceGroupName string, serviceName string, loggerid string, parameters LoggerCreateParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: loggerid, + Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Credentials", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, loggerid, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LoggersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, loggerid string, parameters LoggerCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loggerid": autorest.Encode("path", loggerid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LoggersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LoggersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified logger. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. loggerid is logger identifier. Must be unique +// in the API Management service instance. ifMatch is the entity state (Etag) +// version of the logger to delete. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client LoggersClient) Delete(resourceGroupName string, serviceName string, loggerid string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: loggerid, + Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, loggerid, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LoggersClient) DeletePreparer(resourceGroupName string, serviceName string, loggerid string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loggerid": autorest.Encode("path", loggerid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LoggersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LoggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the logger specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. loggerid is logger identifier. Must be unique +// in the API Management service instance. +func (client LoggersClient) Get(resourceGroupName string, serviceName string, loggerid string) (result LoggerResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: loggerid, + Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, loggerid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoggersClient) GetPreparer(resourceGroupName string, serviceName string, loggerid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loggerid": autorest.Encode("path", loggerid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoggersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoggersClient) GetResponder(resp *http.Response) (result LoggerResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of loggers in the specified service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators | +// Supported functions | +// |-------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | type | eq | +// | top is number of records to return. skip is number of records to skip. +func (client LoggersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result LoggerCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client LoggersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client LoggersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client LoggersClient) ListByServiceResponder(resp *http.Response) (result LoggerCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client LoggersClient) ListByServiceNextResults(lastResults LoggerCollection) (result LoggerCollection, err error) { + req, err := lastResults.LoggerCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates an existing logger. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. loggerid is logger identifier. Must be unique +// in the API Management service instance. parameters is update parameters. +// ifMatch is the entity state (Etag) version of the logger to update. A value +// of "*" can be used for If-Match to unconditionally apply the operation. +func (client LoggersClient) Update(resourceGroupName string, serviceName string, loggerid string, parameters LoggerUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: loggerid, + Constraints: []validation.Constraint{{Target: "loggerid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "loggerid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.LoggersClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, loggerid, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.LoggersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LoggersClient) UpdatePreparer(resourceGroupName string, serviceName string, loggerid string, parameters LoggerUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loggerid": autorest.Encode("path", loggerid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LoggersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client LoggersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/models.go index 88b5075518..f2fd0fc9d4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/models.go @@ -1,1531 +1,1531 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "io" - "net/http" -) - -// APIProtocolContract enumerates the values for api protocol contract. -type APIProtocolContract string - -const ( - // HTTP specifies the http state for api protocol contract. - HTTP APIProtocolContract = "Http" - // HTTPS specifies the https state for api protocol contract. - HTTPS APIProtocolContract = "Https" -) - -// APITypeContract enumerates the values for api type contract. -type APITypeContract string - -const ( - // APITypeContractHTTP specifies the api type contract http state for api - // type contract. - APITypeContractHTTP APITypeContract = "Http" - // APITypeContractSoap specifies the api type contract soap state for api - // type contract. - APITypeContractSoap APITypeContract = "Soap" -) - -// AsyncOperationState enumerates the values for async operation state. -type AsyncOperationState string - -const ( - // Failed specifies the failed state for async operation state. - Failed AsyncOperationState = "Failed" - // InProgress specifies the in progress state for async operation state. - InProgress AsyncOperationState = "InProgress" - // Started specifies the started state for async operation state. - Started AsyncOperationState = "Started" - // Succeeded specifies the succeeded state for async operation state. - Succeeded AsyncOperationState = "Succeeded" -) - -// BackendProtocol enumerates the values for backend protocol. -type BackendProtocol string - -const ( - // BackendProtocolHTTP specifies the backend protocol http state for - // backend protocol. - BackendProtocolHTTP BackendProtocol = "http" - // BackendProtocolSoap specifies the backend protocol soap state for - // backend protocol. - BackendProtocolSoap BackendProtocol = "soap" -) - -// BearerTokenSendingMethodsContract enumerates the values for bearer token -// sending methods contract. -type BearerTokenSendingMethodsContract string - -const ( - // AuthorizationHeader specifies the authorization header state for bearer - // token sending methods contract. - AuthorizationHeader BearerTokenSendingMethodsContract = "authorizationHeader" - // Query specifies the query state for bearer token sending methods - // contract. - Query BearerTokenSendingMethodsContract = "query" -) - -// ClientAuthenticationMethodContract enumerates the values for client -// authentication method contract. -type ClientAuthenticationMethodContract string - -const ( - // Basic specifies the basic state for client authentication method - // contract. - Basic ClientAuthenticationMethodContract = "Basic" - // Body specifies the body state for client authentication method contract. - Body ClientAuthenticationMethodContract = "Body" -) - -// ConnectivityStatusType enumerates the values for connectivity status type. -type ConnectivityStatusType string - -const ( - // Failure specifies the failure state for connectivity status type. - Failure ConnectivityStatusType = "failure" - // Initializing specifies the initializing state for connectivity status - // type. - Initializing ConnectivityStatusType = "initializing" - // Success specifies the success state for connectivity status type. - Success ConnectivityStatusType = "success" -) - -// GrantTypesContract enumerates the values for grant types contract. -type GrantTypesContract string - -const ( - // AuthorizationCode specifies the authorization code state for grant types - // contract. - AuthorizationCode GrantTypesContract = "authorizationCode" - // ClientCredentials specifies the client credentials state for grant types - // contract. - ClientCredentials GrantTypesContract = "clientCredentials" - // Implicit specifies the implicit state for grant types contract. - Implicit GrantTypesContract = "implicit" - // ResourceOwnerPassword specifies the resource owner password state for - // grant types contract. - ResourceOwnerPassword GrantTypesContract = "resourceOwnerPassword" -) - -// GroupTypeContract enumerates the values for group type contract. -type GroupTypeContract string - -const ( - // Custom specifies the custom state for group type contract. - Custom GroupTypeContract = "Custom" - // External specifies the external state for group type contract. - External GroupTypeContract = "External" - // System specifies the system state for group type contract. - System GroupTypeContract = "System" -) - -// HostnameType enumerates the values for hostname type. -type HostnameType string - -const ( - // Management specifies the management state for hostname type. - Management HostnameType = "Management" - // Portal specifies the portal state for hostname type. - Portal HostnameType = "Portal" - // Proxy specifies the proxy state for hostname type. - Proxy HostnameType = "Proxy" - // Scm specifies the scm state for hostname type. - Scm HostnameType = "Scm" -) - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted specifies the accepted state for http status code. - Accepted HTTPStatusCode = "Accepted" - // Conflict specifies the conflict state for http status code. - Conflict HTTPStatusCode = "Conflict" - // Continue specifies the continue state for http status code. - Continue HTTPStatusCode = "Continue" - // Created specifies the created state for http status code. - Created HTTPStatusCode = "Created" - // NotFound specifies the not found state for http status code. - NotFound HTTPStatusCode = "NotFound" - // OK specifies the ok state for http status code. - OK HTTPStatusCode = "OK" -) - -// IdentityProviderNameType enumerates the values for identity provider name -// type. -type IdentityProviderNameType string - -const ( - // Aad specifies the aad state for identity provider name type. - Aad IdentityProviderNameType = "aad" - // AadB2C specifies the aad b2c state for identity provider name type. - AadB2C IdentityProviderNameType = "aadB2C" - // Facebook specifies the facebook state for identity provider name type. - Facebook IdentityProviderNameType = "facebook" - // Google specifies the google state for identity provider name type. - Google IdentityProviderNameType = "google" - // Microsoft specifies the microsoft state for identity provider name type. - Microsoft IdentityProviderNameType = "microsoft" - // Twitter specifies the twitter state for identity provider name type. - Twitter IdentityProviderNameType = "twitter" -) - -// MethodContract enumerates the values for method contract. -type MethodContract string - -const ( - // DELETE specifies the delete state for method contract. - DELETE MethodContract = "DELETE" - // GET specifies the get state for method contract. - GET MethodContract = "GET" - // HEAD specifies the head state for method contract. - HEAD MethodContract = "HEAD" - // OPTIONS specifies the options state for method contract. - OPTIONS MethodContract = "OPTIONS" - // PATCH specifies the patch state for method contract. - PATCH MethodContract = "PATCH" - // POST specifies the post state for method contract. - POST MethodContract = "POST" - // PUT specifies the put state for method contract. - PUT MethodContract = "PUT" - // TRACE specifies the trace state for method contract. - TRACE MethodContract = "TRACE" -) - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // AlreadyExists specifies the already exists state for name availability - // reason. - AlreadyExists NameAvailabilityReason = "AlreadyExists" - // Invalid specifies the invalid state for name availability reason. - Invalid NameAvailabilityReason = "Invalid" - // Valid specifies the valid state for name availability reason. - Valid NameAvailabilityReason = "Valid" -) - -// PolicyScopeContract enumerates the values for policy scope contract. -type PolicyScopeContract string - -const ( - // PolicyScopeContractAll specifies the policy scope contract all state for - // policy scope contract. - PolicyScopeContractAll PolicyScopeContract = "All" - // PolicyScopeContractAPI specifies the policy scope contract api state for - // policy scope contract. - PolicyScopeContractAPI PolicyScopeContract = "Api" - // PolicyScopeContractOperation specifies the policy scope contract - // operation state for policy scope contract. - PolicyScopeContractOperation PolicyScopeContract = "Operation" - // PolicyScopeContractProduct specifies the policy scope contract product - // state for policy scope contract. - PolicyScopeContractProduct PolicyScopeContract = "Product" - // PolicyScopeContractTenant specifies the policy scope contract tenant - // state for policy scope contract. - PolicyScopeContractTenant PolicyScopeContract = "Tenant" -) - -// ProductStateContract enumerates the values for product state contract. -type ProductStateContract string - -const ( - // NotPublished specifies the not published state for product state - // contract. - NotPublished ProductStateContract = "NotPublished" - // Published specifies the published state for product state contract. - Published ProductStateContract = "Published" -) - -// ReportsAggregation enumerates the values for reports aggregation. -type ReportsAggregation string - -const ( - // ByAPI specifies the by api state for reports aggregation. - ByAPI ReportsAggregation = "byApi" - // ByGeo specifies the by geo state for reports aggregation. - ByGeo ReportsAggregation = "byGeo" - // ByOperation specifies the by operation state for reports aggregation. - ByOperation ReportsAggregation = "byOperation" - // ByProduct specifies the by product state for reports aggregation. - ByProduct ReportsAggregation = "byProduct" - // BySubscription specifies the by subscription state for reports - // aggregation. - BySubscription ReportsAggregation = "bySubscription" - // ByTime specifies the by time state for reports aggregation. - ByTime ReportsAggregation = "byTime" - // ByUser specifies the by user state for reports aggregation. - ByUser ReportsAggregation = "byUser" -) - -// SkuType enumerates the values for sku type. -type SkuType string - -const ( - // Developer specifies the developer state for sku type. - Developer SkuType = "Developer" - // Premium specifies the premium state for sku type. - Premium SkuType = "Premium" - // Standard specifies the standard state for sku type. - Standard SkuType = "Standard" -) - -// SubscriptionStateContract enumerates the values for subscription state -// contract. -type SubscriptionStateContract string - -const ( - // Active specifies the active state for subscription state contract. - Active SubscriptionStateContract = "Active" - // Cancelled specifies the cancelled state for subscription state contract. - Cancelled SubscriptionStateContract = "Cancelled" - // Expired specifies the expired state for subscription state contract. - Expired SubscriptionStateContract = "Expired" - // Rejected specifies the rejected state for subscription state contract. - Rejected SubscriptionStateContract = "Rejected" - // Submitted specifies the submitted state for subscription state contract. - Submitted SubscriptionStateContract = "Submitted" - // Suspended specifies the suspended state for subscription state contract. - Suspended SubscriptionStateContract = "Suspended" -) - -// UserStateContract enumerates the values for user state contract. -type UserStateContract string - -const ( - // UserStateContractActive specifies the user state contract active state - // for user state contract. - UserStateContractActive UserStateContract = "Active" - // UserStateContractBlocked specifies the user state contract blocked state - // for user state contract. - UserStateContractBlocked UserStateContract = "Blocked" -) - -// VirtualNetworkType enumerates the values for virtual network type. -type VirtualNetworkType string - -const ( - // VirtualNetworkTypeExternal specifies the virtual network type external - // state for virtual network type. - VirtualNetworkTypeExternal VirtualNetworkType = "External" - // VirtualNetworkTypeInternal specifies the virtual network type internal - // state for virtual network type. - VirtualNetworkTypeInternal VirtualNetworkType = "Internal" - // VirtualNetworkTypeNone specifies the virtual network type none state for - // virtual network type. - VirtualNetworkTypeNone VirtualNetworkType = "None" -) - -// AccessInformationContract is tenant access information contract of the API -// Management service. -type AccessInformationContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// AccessInformationUpdateParameters is tenant access information update -// parameters of the API Management service. -type AccessInformationUpdateParameters struct { - Enabled *bool `json:"enabled,omitempty"` -} - -// AdditionalRegion is description of an additional API Management resource -// location. -type AdditionalRegion struct { - Location *string `json:"location,omitempty"` - SkuType SkuType `json:"skuType,omitempty"` - SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` - StaticIPs *[]string `json:"staticIPs,omitempty"` - Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` -} - -// APICollection is paged Api list representation. -type APICollection struct { - autorest.Response `json:"-"` - Value *[]APIContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// APICollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client APICollection) APICollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// APIContract is aPI details. -type APIContract struct { - autorest.Response `json:"-"` - Description *string `json:"description,omitempty"` - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - Type APITypeContract `json:"type,omitempty"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ServiceURL *string `json:"serviceUrl,omitempty"` - Path *string `json:"path,omitempty"` - Protocols *[]APIProtocolContract `json:"protocols,omitempty"` -} - -// APIEntityBaseContract is aPI base contract details. -type APIEntityBaseContract struct { - Description *string `json:"description,omitempty"` - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - Type APITypeContract `json:"type,omitempty"` -} - -// APIExportResult is the response model for the export API output operation. -type APIExportResult struct { - autorest.Response `json:"-"` - Content *[]byte `json:"content,omitempty"` - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - RequestID *string `json:"requestId,omitempty"` -} - -// APIUpdateContract is aPI Update Contract details. -type APIUpdateContract struct { - Description *string `json:"description,omitempty"` - AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` - SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` - Type APITypeContract `json:"type,omitempty"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ServiceURL *string `json:"serviceUrl,omitempty"` - Path *string `json:"path,omitempty"` - Protocols *[]APIProtocolContract `json:"protocols,omitempty"` -} - -// AuthenticationSettingsContract is aPI Authentication Settings. -type AuthenticationSettingsContract struct { - OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` -} - -// AuthorizationServerCollection is paged OAuth2 Authorization Servers list -// representation. -type AuthorizationServerCollection struct { - autorest.Response `json:"-"` - Value *[]OAuth2AuthorizationServerContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationServerCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AuthorizationServerCollection) AuthorizationServerCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// BackendAuthorizationHeaderCredentials is authorization header information. -type BackendAuthorizationHeaderCredentials struct { - Scheme *string `json:"scheme,omitempty"` - Parameter *string `json:"parameter,omitempty"` -} - -// BackendBaseParameters is backend entity base Parameter set. -type BackendBaseParameters struct { - Certificate *[]string `json:"certificate,omitempty"` - Query *map[string][]string `json:"query,omitempty"` - Header *map[string][]string `json:"header,omitempty"` - URL *string `json:"url,omitempty"` - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - *BackendProperties `json:"properties,omitempty"` -} - -// BackendCollection is paged Backend list representation. -type BackendCollection struct { - autorest.Response `json:"-"` - Value *[]BackendResponse `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// BackendCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client BackendCollection) BackendCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// BackendContract is parameters supplied to the Create Backend operation. -type BackendContract struct { - Certificate *[]string `json:"certificate,omitempty"` - Query *map[string][]string `json:"query,omitempty"` - Header *map[string][]string `json:"header,omitempty"` - URL *string `json:"url,omitempty"` - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - *BackendProperties `json:"properties,omitempty"` - ID *string `json:"id,omitempty"` - Protocol BackendProtocol `json:"protocol,omitempty"` -} - -// BackendCredentialsContract is details of the Credentials used to connect to -// Backend. -type BackendCredentialsContract struct { - Scheme *string `json:"scheme,omitempty"` - Parameter *string `json:"parameter,omitempty"` - Certificate *[]string `json:"certificate,omitempty"` - Query *map[string][]string `json:"query,omitempty"` - Header *map[string][]string `json:"header,omitempty"` -} - -// BackendProperties is properties specific to a Backend. -type BackendProperties struct { - SkipCertificateChainValidation *bool `json:"skipCertificateChainValidation,omitempty"` - SkipCertificateNameValidation *bool `json:"skipCertificateNameValidation,omitempty"` -} - -// BackendProxyContract is details of the Backend WebProxy Server to use in the -// Request to Backend. -type BackendProxyContract struct { - URL *string `json:"url,omitempty"` - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` -} - -// BackendResponse is the Backend entity in API Management represents a backend -// service that is configured to skip certification chain validation when using -// a self-signed certificate to test mutual certificate authentication. -type BackendResponse struct { - autorest.Response `json:"-"` - Certificate *[]string `json:"certificate,omitempty"` - Query *map[string][]string `json:"query,omitempty"` - Header *map[string][]string `json:"header,omitempty"` - URL *string `json:"url,omitempty"` - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - *BackendProperties `json:"properties,omitempty"` - ID *string `json:"id,omitempty"` - Protocol BackendProtocol `json:"protocol,omitempty"` -} - -// BackendUpdateParameters is parameters supplied to the Update Backend -// operation. -type BackendUpdateParameters struct { - Certificate *[]string `json:"certificate,omitempty"` - Query *map[string][]string `json:"query,omitempty"` - Header *map[string][]string `json:"header,omitempty"` - URL *string `json:"url,omitempty"` - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - *BackendProperties `json:"properties,omitempty"` - Protocol BackendProtocol `json:"protocol,omitempty"` -} - -// CertificateCollection is paged Certificates list representation. -type CertificateCollection struct { - autorest.Response `json:"-"` - Value *[]CertificateContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateCollection) CertificateCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CertificateContract is certificate details. -type CertificateContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Subject *string `json:"subject,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` -} - -// CertificateCreateOrUpdateParameters is parameters supplied to the -// CreateOrUpdate certificate operation. -type CertificateCreateOrUpdateParameters struct { - Data *string `json:"data,omitempty"` - Password *string `json:"password,omitempty"` -} - -// CertificateInformation is sSL certificate information. -type CertificateInformation struct { - autorest.Response `json:"-"` - Expiry *date.Time `json:"expiry,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - Subject *string `json:"subject,omitempty"` -} - -// ConnectivityStatusContract is details about connectivity to a resource. -type ConnectivityStatusContract struct { - Name *string `json:"name,omitempty"` - Status ConnectivityStatusType `json:"status,omitempty"` - Error *string `json:"error,omitempty"` - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` -} - -// DeployConfigurationParameters is parameters supplied to the Deploy -// Configuration operation. -type DeployConfigurationParameters struct { - Branch *string `json:"branch,omitempty"` - Force *bool `json:"force,omitempty"` -} - -// ErrorBodyContract is error Body contract. -type ErrorBodyContract struct { - autorest.Response `json:"-"` - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Details *[]ErrorFieldContract `json:"details,omitempty"` -} - -// ErrorFieldContract is error Field contract. -type ErrorFieldContract struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// ErrorResponse is error Response. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// GenerateSsoURLResult is generate SSO Url operations response details. -type GenerateSsoURLResult struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// GroupCollection is paged Group list representation. -type GroupCollection struct { - autorest.Response `json:"-"` - Value *[]GroupContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// GroupCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client GroupCollection) GroupCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// GroupContract is developer group. -type GroupContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - BuiltIn *bool `json:"builtIn,omitempty"` - Type GroupTypeContract `json:"type,omitempty"` - ExternalID *string `json:"externalId,omitempty"` -} - -// GroupCreateParameters is parameters supplied to the Create Group operation. -type GroupCreateParameters struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Type GroupTypeContract `json:"type,omitempty"` - ExternalID *string `json:"externalId,omitempty"` -} - -// GroupUpdateParameters is parameters supplied to the Update Group operation. -type GroupUpdateParameters struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Type GroupTypeContract `json:"type,omitempty"` - ExternalID *string `json:"externalId,omitempty"` -} - -// HostnameConfiguration is custom hostname configuration. -type HostnameConfiguration struct { - Type HostnameType `json:"type,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// IdentityProviderContract is the external Identity Providers like Facebook, -// Google, Microsoft, Twitter or Azure Active Directory which can be used to -// enable access to the API Management service developer portal for all users. -type IdentityProviderContract struct { - autorest.Response `json:"-"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - Type IdentityProviderNameType `json:"type,omitempty"` - AllowedTenants *[]string `json:"allowedTenants,omitempty"` -} - -// IdentityProviderList is list of all the Identity Providers configured on the -// service instance. -type IdentityProviderList struct { - autorest.Response `json:"-"` - Value *[]IdentityProviderContract `json:"value,omitempty"` -} - -// IdentityProviderUpdateParameters is parameters supplied to the Update -// Identity Provider operation. -type IdentityProviderUpdateParameters struct { - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - AllowedTenants *[]string `json:"allowedTenants,omitempty"` -} - -// LoggerCollection is paged Logger list representation. -type LoggerCollection struct { - autorest.Response `json:"-"` - Value *[]LoggerResponse `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// LoggerCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client LoggerCollection) LoggerCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// LoggerCreateParameters is parameters supplied to the Create Logger -// operation. -type LoggerCreateParameters struct { - Type *string `json:"type,omitempty"` - Description *string `json:"description,omitempty"` - Credentials *map[string]*string `json:"credentials,omitempty"` - IsBuffered *bool `json:"isBuffered,omitempty"` -} - -// LoggerResponse is the Logger entity in API Management represents an event -// sink that you can use to log API Management events. Currently the Logger -// entity supports logging API Management events to Azure Event Hubs. -type LoggerResponse struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Description *string `json:"description,omitempty"` - Credentials *map[string]*string `json:"credentials,omitempty"` - IsBuffered *bool `json:"isBuffered,omitempty"` -} - -// LoggerUpdateParameters is parameters supplied to the Update Logger -// operation. -type LoggerUpdateParameters struct { - Type *string `json:"type,omitempty"` - Description *string `json:"description,omitempty"` - Credentials *map[string]*string `json:"credentials,omitempty"` - IsBuffered *bool `json:"isBuffered,omitempty"` -} - -// NetworkStatusContract is network Status details. -type NetworkStatusContract struct { - autorest.Response `json:"-"` - DNSServers *[]string `json:"dnsServers,omitempty"` - ConnectivityStatus *[]ConnectivityStatusContract `json:"connectivityStatus,omitempty"` -} - -// OAuth2AuthenticationSettingsContract is aPI OAuth2 Authentication settings -// details. -type OAuth2AuthenticationSettingsContract struct { - AuthorizationServerID *string `json:"authorizationServerId,omitempty"` - Scope *string `json:"scope,omitempty"` -} - -// OAuth2AuthorizationServerContract is external OAuth authorization server -// settings. -type OAuth2AuthorizationServerContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - AuthorizationMethods *[]MethodContract `json:"authorizationMethods,omitempty"` - ClientAuthenticationMethod *[]ClientAuthenticationMethodContract `json:"clientAuthenticationMethod,omitempty"` - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - SupportState *bool `json:"supportState,omitempty"` - DefaultScope *string `json:"defaultScope,omitempty"` - GrantTypes *[]GrantTypesContract `json:"grantTypes,omitempty"` - BearerTokenSendingMethods *[]BearerTokenSendingMethodsContract `json:"bearerTokenSendingMethods,omitempty"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// OAuth2AuthorizationServerUpdateContract is external OAuth authorization -// server Update settings contract. -type OAuth2AuthorizationServerUpdateContract struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` - AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` - AuthorizationMethods *[]MethodContract `json:"authorizationMethods,omitempty"` - ClientAuthenticationMethod *[]ClientAuthenticationMethodContract `json:"clientAuthenticationMethod,omitempty"` - TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` - TokenEndpoint *string `json:"tokenEndpoint,omitempty"` - SupportState *bool `json:"supportState,omitempty"` - DefaultScope *string `json:"defaultScope,omitempty"` - GrantTypes *[]GrantTypesContract `json:"grantTypes,omitempty"` - BearerTokenSendingMethods *[]BearerTokenSendingMethodsContract `json:"bearerTokenSendingMethods,omitempty"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` - ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` -} - -// OpenIDConnectProviderCollection is paged OpenIdProviders list -// representation. -type OpenIDConnectProviderCollection struct { - autorest.Response `json:"-"` - Value *[]OpenidConnectProviderContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OpenIDConnectProviderCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OpenIDConnectProviderCollection) OpenIDConnectProviderCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OpenidConnectProviderContract is openID Connect Providers Contract. -type OpenidConnectProviderContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// OpenidConnectProviderCreateContract is parameters supplied to the Create -// OpenID Connect Provider operation. -type OpenidConnectProviderCreateContract struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// OpenidConnectProviderUpdateContract is parameters supplied to the Update -// OpenID Connect Provider operation. -type OpenidConnectProviderUpdateContract struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` -} - -// Operation is rEST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that describes the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Operation *string `json:"operation,omitempty"` - Resource *string `json:"resource,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationCollection is paged Operation list representation. -type OperationCollection struct { - autorest.Response `json:"-"` - Value *[]OperationContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationCollection) OperationCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OperationContract is api Operation details. -type OperationContract struct { - autorest.Response `json:"-"` - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - Description *string `json:"description,omitempty"` - Request *RequestContract `json:"request,omitempty"` - Responses *[]ResultContract `json:"responses,omitempty"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Method *string `json:"method,omitempty"` - URLTemplate *string `json:"urlTemplate,omitempty"` -} - -// OperationEntityBaseContract is api Operation Entity Base Contract details. -type OperationEntityBaseContract struct { - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - Description *string `json:"description,omitempty"` - Request *RequestContract `json:"request,omitempty"` - Responses *[]ResultContract `json:"responses,omitempty"` -} - -// OperationListResult is result of the request to list REST API operations. It -// contains a list of operations and a URL nextLink to get the next set of -// results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OperationResultContract is operation Result. -type OperationResultContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Status AsyncOperationState `json:"status,omitempty"` - Started *date.Time `json:"started,omitempty"` - Updated *date.Time `json:"updated,omitempty"` - ResultInfo *string `json:"resultInfo,omitempty"` - Error *ErrorBodyContract `json:"error,omitempty"` -} - -// OperationUpdateContract is api Operation Update Contract details. -type OperationUpdateContract struct { - TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` - Description *string `json:"description,omitempty"` - Request *RequestContract `json:"request,omitempty"` - Responses *[]ResultContract `json:"responses,omitempty"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Method *string `json:"method,omitempty"` - URLTemplate *string `json:"urlTemplate,omitempty"` -} - -// ParameterContract is operation parameters details. -type ParameterContract struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - DefaultValue *string `json:"defaultValue,omitempty"` - Required *bool `json:"required,omitempty"` - Values *[]string `json:"values,omitempty"` -} - -// PolicySnippetContract is policy snippet. -type PolicySnippetContract struct { - Name *string `json:"name,omitempty"` - Content *string `json:"content,omitempty"` - ToolTip *string `json:"toolTip,omitempty"` - Scope PolicyScopeContract `json:"scope,omitempty"` -} - -// PolicySnippetsCollection is the response of the list policy snippets -// operation. -type PolicySnippetsCollection struct { - autorest.Response `json:"-"` - Value *[]PolicySnippetContract `json:"value,omitempty"` -} - -// ProductCollection is paged Products list representation. -type ProductCollection struct { - autorest.Response `json:"-"` - Value *[]ProductContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ProductCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProductCollection) ProductCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProductContract is product profile. -type ProductContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Terms *string `json:"terms,omitempty"` - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - State ProductStateContract `json:"state,omitempty"` -} - -// ProductUpdateParameters is parameters supplied to the CreateOrUpdate Product -// operation. -type ProductUpdateParameters struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Terms *string `json:"terms,omitempty"` - SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` - ApprovalRequired *bool `json:"approvalRequired,omitempty"` - SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` - State ProductStateContract `json:"state,omitempty"` -} - -// PropertyCollection is paged Property list representation. -type PropertyCollection struct { - autorest.Response `json:"-"` - Value *[]PropertyContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PropertyCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PropertyCollection) PropertyCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PropertyContract is property details. -type PropertyContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - Tags *[]string `json:"tags,omitempty"` - Secret *bool `json:"secret,omitempty"` -} - -// PropertyCreateParameters is parameters supplied to the Create Property -// operation. -type PropertyCreateParameters struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - Tags *[]string `json:"tags,omitempty"` - Secret *bool `json:"secret,omitempty"` -} - -// PropertyUpdateParameters is parameters supplied to the Update Property -// operation. -type PropertyUpdateParameters struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - Tags *[]string `json:"tags,omitempty"` - Secret *bool `json:"secret,omitempty"` -} - -// QuotaCounterCollection is paged Quota Counter list representation. -type QuotaCounterCollection struct { - autorest.Response `json:"-"` - Value *[]QuotaCounterContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// QuotaCounterContract is quota counter details. -type QuotaCounterContract struct { - autorest.Response `json:"-"` - CallsCount *int32 `json:"callsCount,omitempty"` - KbTransferred *float64 `json:"kbTransferred,omitempty"` - CounterKey *string `json:"counterKey,omitempty"` - PeriodKey *string `json:"periodKey,omitempty"` - PeriodStartTime *date.Time `json:"periodStartTime,omitempty"` - PeriodEndTime *date.Time `json:"periodEndTime,omitempty"` -} - -// QuotaCounterValueContract is quota counter value details. -type QuotaCounterValueContract struct { - CallsCount *int32 `json:"callsCount,omitempty"` - KbTransferred *float64 `json:"kbTransferred,omitempty"` -} - -// ReadCloser is -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} - -// RegionContract is region profile. -type RegionContract struct { - Name *string `json:"name,omitempty"` - IsMasterRegion *bool `json:"isMasterRegion,omitempty"` -} - -// RegionListResult is lists Regions operation response details. -type RegionListResult struct { - autorest.Response `json:"-"` - Value *[]RegionContract `json:"value,omitempty"` -} - -// ReportCollection is paged Report records list representation. -type ReportCollection struct { - autorest.Response `json:"-"` - Value *[]ReportRecordContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ReportCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ReportCollection) ReportCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ReportRecordContract is report data. -type ReportRecordContract struct { - Name *string `json:"name,omitempty"` - Timestamp *date.Time `json:"timestamp,omitempty"` - Interval *int64 `json:"interval,omitempty"` - Country *string `json:"country,omitempty"` - Region *string `json:"region,omitempty"` - Zip *string `json:"zip,omitempty"` - UserID *string `json:"userId,omitempty"` - ProductID *string `json:"productId,omitempty"` - APIID *string `json:"apiId,omitempty"` - OperationID *string `json:"operationId,omitempty"` - APIRegion *string `json:"apiRegion,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - CallCountSuccess *int32 `json:"callCountSuccess,omitempty"` - CallCountBlocked *int32 `json:"callCountBlocked,omitempty"` - CallCountFailed *int32 `json:"callCountFailed,omitempty"` - CallCountOther *int32 `json:"callCountOther,omitempty"` - CallCountTotal *int32 `json:"callCountTotal,omitempty"` - Bandwidth *int64 `json:"bandwidth,omitempty"` - CacheHitCount *int32 `json:"cacheHitCount,omitempty"` - CacheMissCount *int32 `json:"cacheMissCount,omitempty"` - APITimeAvg *float64 `json:"apiTimeAvg,omitempty"` - APITimeMin *float64 `json:"apiTimeMin,omitempty"` - APITimeMax *float64 `json:"apiTimeMax,omitempty"` - ServiceTimeAvg *float64 `json:"serviceTimeAvg,omitempty"` - ServiceTimeMin *float64 `json:"serviceTimeMin,omitempty"` - ServiceTimeMax *float64 `json:"serviceTimeMax,omitempty"` -} - -// RepresentationContract is operation request/response representation details. -type RepresentationContract struct { - ContentType *string `json:"contentType,omitempty"` - Sample *string `json:"sample,omitempty"` -} - -// RequestContract is operation request details. -type RequestContract struct { - Description *string `json:"description,omitempty"` - QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` - Headers *[]ParameterContract `json:"headers,omitempty"` - Representations *[]RepresentationContract `json:"representations,omitempty"` -} - -// Resource is the Resource definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResultContract is operation response details. -type ResultContract struct { - StatusCode *int32 `json:"statusCode,omitempty"` - Description *string `json:"description,omitempty"` - Representations *[]RepresentationContract `json:"representations,omitempty"` -} - -// SaveConfigurationParameter is parameters supplied to the Save Tenant -// Configuration operation. -type SaveConfigurationParameter struct { - Branch *string `json:"branch,omitempty"` - Force *bool `json:"force,omitempty"` -} - -// ServiceBackupRestoreParameters is parameters supplied to the Backup/Restore -// of an API Management service operation. -type ServiceBackupRestoreParameters struct { - StorageAccount *string `json:"storageAccount,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - BackupName *string `json:"backupName,omitempty"` -} - -// ServiceCheckNameAvailabilityParameters is parameters supplied to the -// CheckNameAvailability operation. -type ServiceCheckNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` -} - -// ServiceGetSsoTokenResult is the response of the GetSsoToken operation. -type ServiceGetSsoTokenResult struct { - autorest.Response `json:"-"` - RedirectURI *string `json:"redirect_uri,omitempty"` -} - -// ServiceListResult is the response of the List API Management services -// operation. -type ServiceListResult struct { - autorest.Response `json:"-"` - Value *[]ServiceResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ServiceListResult) ServiceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ServiceManageDeploymentsParameters is parameters supplied to the -// ManageDeployments operation. -type ServiceManageDeploymentsParameters struct { - Location *string `json:"location,omitempty"` - SkuType SkuType `json:"skuType,omitempty"` - SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` - AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` - VpnConfiguration *VirtualNetworkConfiguration `json:"vpnConfiguration,omitempty"` - VpnType VirtualNetworkType `json:"vpnType,omitempty"` -} - -// ServiceNameAvailabilityResult is response of the CheckNameAvailability -// operation. -type ServiceNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Message *string `json:"message,omitempty"` - Reason NameAvailabilityReason `json:"reason,omitempty"` -} - -// ServiceProperties is properties of an API Management service resource -// description. -type ServiceProperties struct { - PublisherEmail *string `json:"publisherEmail,omitempty"` - PublisherName *string `json:"publisherName,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - RuntimeURL *string `json:"runtimeUrl,omitempty"` - PortalURL *string `json:"portalUrl,omitempty"` - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - ScmURL *string `json:"scmUrl,omitempty"` - AddresserEmail *string `json:"addresserEmail,omitempty"` - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - StaticIPs *[]string `json:"staticIPs,omitempty"` - Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` - AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` - CustomProperties *map[string]*string `json:"customProperties,omitempty"` - VpnType VirtualNetworkType `json:"vpnType,omitempty"` -} - -// ServiceResource is a single API Management service resource in List or Get -// response. -type ServiceResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServiceProperties `json:"properties,omitempty"` - Sku *ServiceSkuProperties `json:"sku,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ServiceSkuProperties is aPI Management service resource SKU properties. -type ServiceSkuProperties struct { - Name SkuType `json:"name,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// ServiceUpdateHostnameParameters is parameters supplied to the UpdateHostname -// operation. -type ServiceUpdateHostnameParameters struct { - Update *[]HostnameConfiguration `json:"update,omitempty"` - Delete *[]HostnameType `json:"delete,omitempty"` -} - -// ServiceUpdateParameters is parameters supplied to the Update API Management -// service operation. -type ServiceUpdateParameters struct { - *ServiceProperties `json:"properties,omitempty"` - Sku *ServiceSkuProperties `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ServiceUploadCertificateParameters is parameters supplied to the Upload SSL -// certificate for an API Management service operation. -type ServiceUploadCertificateParameters struct { - Type HostnameType `json:"type,omitempty"` - Certificate *string `json:"certificate,omitempty"` - CertificatePassword *string `json:"certificate_password,omitempty"` -} - -// SubscriptionCollection is paged Subscriptions list representation. -type SubscriptionCollection struct { - autorest.Response `json:"-"` - Value *[]SubscriptionContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SubscriptionCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SubscriptionCollection) SubscriptionCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SubscriptionContract is subscription details. -type SubscriptionContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - UserID *string `json:"userId,omitempty"` - ProductID *string `json:"productId,omitempty"` - Name *string `json:"name,omitempty"` - State SubscriptionStateContract `json:"state,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - StartDate *date.Time `json:"startDate,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - EndDate *date.Time `json:"endDate,omitempty"` - NotificationDate *date.Time `json:"notificationDate,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - StateComment *string `json:"stateComment,omitempty"` -} - -// SubscriptionCreateParameters is parameters supplied to the Create -// subscription operation. -type SubscriptionCreateParameters struct { - UserID *string `json:"userId,omitempty"` - ProductID *string `json:"productId,omitempty"` - Name *string `json:"name,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - State SubscriptionStateContract `json:"state,omitempty"` -} - -// SubscriptionKeyParameterNamesContract is subscription key parameter names -// details. -type SubscriptionKeyParameterNamesContract struct { - Header *string `json:"header,omitempty"` - Query *string `json:"query,omitempty"` -} - -// SubscriptionUpdateParameters is parameters supplied to the Update -// subscription operation. -type SubscriptionUpdateParameters struct { - UserID *string `json:"userId,omitempty"` - ProductID *string `json:"productId,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - Name *string `json:"name,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - State SubscriptionStateContract `json:"state,omitempty"` - StateComment *string `json:"stateComment,omitempty"` -} - -// TenantConfigurationSyncStateContract is tenant Configuration Synchronization -// State. -type TenantConfigurationSyncStateContract struct { - autorest.Response `json:"-"` - Branch *string `json:"branch,omitempty"` - CommitID *string `json:"commitId,omitempty"` - IsExport *bool `json:"isExport,omitempty"` - IsSynced *bool `json:"isSynced,omitempty"` - IsGitEnabled *bool `json:"isGitEnabled,omitempty"` - SyncDate *date.Time `json:"syncDate,omitempty"` - ConfigurationChangeDate *date.Time `json:"configurationChangeDate,omitempty"` -} - -// TokenBodyParameterContract is oAuth acquire token request body parameter -// (www-url-form-encoded). -type TokenBodyParameterContract struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// UserCollection is paged Users list representation. -type UserCollection struct { - autorest.Response `json:"-"` - Value *[]UserContract `json:"value,omitempty"` - Count *int64 `json:"count,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// UserCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client UserCollection) UserCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// UserContract is user profile. -type UserContract struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - FirstName *string `json:"firstName,omitempty"` - LastName *string `json:"lastName,omitempty"` - Email *string `json:"email,omitempty"` - State UserStateContract `json:"state,omitempty"` - RegistrationDate *date.Time `json:"registrationDate,omitempty"` - Note *string `json:"note,omitempty"` - Identities *[]UserIdentityContract `json:"identities,omitempty"` -} - -// UserCreateParameters is parameters supplied to the Create User operation. -type UserCreateParameters struct { - Email *string `json:"email,omitempty"` - Password *string `json:"password,omitempty"` - FirstName *string `json:"firstName,omitempty"` - LastName *string `json:"lastName,omitempty"` - State UserStateContract `json:"state,omitempty"` - Note *string `json:"note,omitempty"` -} - -// UserIdentityCollection is list of Users Identity list representation. -type UserIdentityCollection struct { - autorest.Response `json:"-"` - Value *[]UserIdentityContract `json:"value,omitempty"` -} - -// UserIdentityContract is user identity details. -type UserIdentityContract struct { - Provider *string `json:"provider,omitempty"` - ID *string `json:"id,omitempty"` -} - -// UserUpdateParameters is parameters supplied to the Update User operation. -type UserUpdateParameters struct { - Email *string `json:"email,omitempty"` - Password *string `json:"password,omitempty"` - FirstName *string `json:"firstName,omitempty"` - LastName *string `json:"lastName,omitempty"` - State UserStateContract `json:"state,omitempty"` - Note *string `json:"note,omitempty"` -} - -// VirtualNetworkConfiguration is configuration of a virtual network to which -// API Management service is deployed. -type VirtualNetworkConfiguration struct { - Vnetid *string `json:"vnetid,omitempty"` - Subnetname *string `json:"subnetname,omitempty"` - SubnetResourceID *string `json:"subnetResourceId,omitempty"` - Location *string `json:"location,omitempty"` -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "io" + "net/http" +) + +// APIProtocolContract enumerates the values for api protocol contract. +type APIProtocolContract string + +const ( + // HTTP specifies the http state for api protocol contract. + HTTP APIProtocolContract = "Http" + // HTTPS specifies the https state for api protocol contract. + HTTPS APIProtocolContract = "Https" +) + +// APITypeContract enumerates the values for api type contract. +type APITypeContract string + +const ( + // APITypeContractHTTP specifies the api type contract http state for api + // type contract. + APITypeContractHTTP APITypeContract = "Http" + // APITypeContractSoap specifies the api type contract soap state for api + // type contract. + APITypeContractSoap APITypeContract = "Soap" +) + +// AsyncOperationState enumerates the values for async operation state. +type AsyncOperationState string + +const ( + // Failed specifies the failed state for async operation state. + Failed AsyncOperationState = "Failed" + // InProgress specifies the in progress state for async operation state. + InProgress AsyncOperationState = "InProgress" + // Started specifies the started state for async operation state. + Started AsyncOperationState = "Started" + // Succeeded specifies the succeeded state for async operation state. + Succeeded AsyncOperationState = "Succeeded" +) + +// BackendProtocol enumerates the values for backend protocol. +type BackendProtocol string + +const ( + // BackendProtocolHTTP specifies the backend protocol http state for + // backend protocol. + BackendProtocolHTTP BackendProtocol = "http" + // BackendProtocolSoap specifies the backend protocol soap state for + // backend protocol. + BackendProtocolSoap BackendProtocol = "soap" +) + +// BearerTokenSendingMethodsContract enumerates the values for bearer token +// sending methods contract. +type BearerTokenSendingMethodsContract string + +const ( + // AuthorizationHeader specifies the authorization header state for bearer + // token sending methods contract. + AuthorizationHeader BearerTokenSendingMethodsContract = "authorizationHeader" + // Query specifies the query state for bearer token sending methods + // contract. + Query BearerTokenSendingMethodsContract = "query" +) + +// ClientAuthenticationMethodContract enumerates the values for client +// authentication method contract. +type ClientAuthenticationMethodContract string + +const ( + // Basic specifies the basic state for client authentication method + // contract. + Basic ClientAuthenticationMethodContract = "Basic" + // Body specifies the body state for client authentication method contract. + Body ClientAuthenticationMethodContract = "Body" +) + +// ConnectivityStatusType enumerates the values for connectivity status type. +type ConnectivityStatusType string + +const ( + // Failure specifies the failure state for connectivity status type. + Failure ConnectivityStatusType = "failure" + // Initializing specifies the initializing state for connectivity status + // type. + Initializing ConnectivityStatusType = "initializing" + // Success specifies the success state for connectivity status type. + Success ConnectivityStatusType = "success" +) + +// GrantTypesContract enumerates the values for grant types contract. +type GrantTypesContract string + +const ( + // AuthorizationCode specifies the authorization code state for grant types + // contract. + AuthorizationCode GrantTypesContract = "authorizationCode" + // ClientCredentials specifies the client credentials state for grant types + // contract. + ClientCredentials GrantTypesContract = "clientCredentials" + // Implicit specifies the implicit state for grant types contract. + Implicit GrantTypesContract = "implicit" + // ResourceOwnerPassword specifies the resource owner password state for + // grant types contract. + ResourceOwnerPassword GrantTypesContract = "resourceOwnerPassword" +) + +// GroupTypeContract enumerates the values for group type contract. +type GroupTypeContract string + +const ( + // Custom specifies the custom state for group type contract. + Custom GroupTypeContract = "Custom" + // External specifies the external state for group type contract. + External GroupTypeContract = "External" + // System specifies the system state for group type contract. + System GroupTypeContract = "System" +) + +// HostnameType enumerates the values for hostname type. +type HostnameType string + +const ( + // Management specifies the management state for hostname type. + Management HostnameType = "Management" + // Portal specifies the portal state for hostname type. + Portal HostnameType = "Portal" + // Proxy specifies the proxy state for hostname type. + Proxy HostnameType = "Proxy" + // Scm specifies the scm state for hostname type. + Scm HostnameType = "Scm" +) + +// HTTPStatusCode enumerates the values for http status code. +type HTTPStatusCode string + +const ( + // Accepted specifies the accepted state for http status code. + Accepted HTTPStatusCode = "Accepted" + // Conflict specifies the conflict state for http status code. + Conflict HTTPStatusCode = "Conflict" + // Continue specifies the continue state for http status code. + Continue HTTPStatusCode = "Continue" + // Created specifies the created state for http status code. + Created HTTPStatusCode = "Created" + // NotFound specifies the not found state for http status code. + NotFound HTTPStatusCode = "NotFound" + // OK specifies the ok state for http status code. + OK HTTPStatusCode = "OK" +) + +// IdentityProviderNameType enumerates the values for identity provider name +// type. +type IdentityProviderNameType string + +const ( + // Aad specifies the aad state for identity provider name type. + Aad IdentityProviderNameType = "aad" + // AadB2C specifies the aad b2c state for identity provider name type. + AadB2C IdentityProviderNameType = "aadB2C" + // Facebook specifies the facebook state for identity provider name type. + Facebook IdentityProviderNameType = "facebook" + // Google specifies the google state for identity provider name type. + Google IdentityProviderNameType = "google" + // Microsoft specifies the microsoft state for identity provider name type. + Microsoft IdentityProviderNameType = "microsoft" + // Twitter specifies the twitter state for identity provider name type. + Twitter IdentityProviderNameType = "twitter" +) + +// MethodContract enumerates the values for method contract. +type MethodContract string + +const ( + // DELETE specifies the delete state for method contract. + DELETE MethodContract = "DELETE" + // GET specifies the get state for method contract. + GET MethodContract = "GET" + // HEAD specifies the head state for method contract. + HEAD MethodContract = "HEAD" + // OPTIONS specifies the options state for method contract. + OPTIONS MethodContract = "OPTIONS" + // PATCH specifies the patch state for method contract. + PATCH MethodContract = "PATCH" + // POST specifies the post state for method contract. + POST MethodContract = "POST" + // PUT specifies the put state for method contract. + PUT MethodContract = "PUT" + // TRACE specifies the trace state for method contract. + TRACE MethodContract = "TRACE" +) + +// NameAvailabilityReason enumerates the values for name availability reason. +type NameAvailabilityReason string + +const ( + // AlreadyExists specifies the already exists state for name availability + // reason. + AlreadyExists NameAvailabilityReason = "AlreadyExists" + // Invalid specifies the invalid state for name availability reason. + Invalid NameAvailabilityReason = "Invalid" + // Valid specifies the valid state for name availability reason. + Valid NameAvailabilityReason = "Valid" +) + +// PolicyScopeContract enumerates the values for policy scope contract. +type PolicyScopeContract string + +const ( + // PolicyScopeContractAll specifies the policy scope contract all state for + // policy scope contract. + PolicyScopeContractAll PolicyScopeContract = "All" + // PolicyScopeContractAPI specifies the policy scope contract api state for + // policy scope contract. + PolicyScopeContractAPI PolicyScopeContract = "Api" + // PolicyScopeContractOperation specifies the policy scope contract + // operation state for policy scope contract. + PolicyScopeContractOperation PolicyScopeContract = "Operation" + // PolicyScopeContractProduct specifies the policy scope contract product + // state for policy scope contract. + PolicyScopeContractProduct PolicyScopeContract = "Product" + // PolicyScopeContractTenant specifies the policy scope contract tenant + // state for policy scope contract. + PolicyScopeContractTenant PolicyScopeContract = "Tenant" +) + +// ProductStateContract enumerates the values for product state contract. +type ProductStateContract string + +const ( + // NotPublished specifies the not published state for product state + // contract. + NotPublished ProductStateContract = "NotPublished" + // Published specifies the published state for product state contract. + Published ProductStateContract = "Published" +) + +// ReportsAggregation enumerates the values for reports aggregation. +type ReportsAggregation string + +const ( + // ByAPI specifies the by api state for reports aggregation. + ByAPI ReportsAggregation = "byApi" + // ByGeo specifies the by geo state for reports aggregation. + ByGeo ReportsAggregation = "byGeo" + // ByOperation specifies the by operation state for reports aggregation. + ByOperation ReportsAggregation = "byOperation" + // ByProduct specifies the by product state for reports aggregation. + ByProduct ReportsAggregation = "byProduct" + // BySubscription specifies the by subscription state for reports + // aggregation. + BySubscription ReportsAggregation = "bySubscription" + // ByTime specifies the by time state for reports aggregation. + ByTime ReportsAggregation = "byTime" + // ByUser specifies the by user state for reports aggregation. + ByUser ReportsAggregation = "byUser" +) + +// SkuType enumerates the values for sku type. +type SkuType string + +const ( + // Developer specifies the developer state for sku type. + Developer SkuType = "Developer" + // Premium specifies the premium state for sku type. + Premium SkuType = "Premium" + // Standard specifies the standard state for sku type. + Standard SkuType = "Standard" +) + +// SubscriptionStateContract enumerates the values for subscription state +// contract. +type SubscriptionStateContract string + +const ( + // Active specifies the active state for subscription state contract. + Active SubscriptionStateContract = "Active" + // Cancelled specifies the cancelled state for subscription state contract. + Cancelled SubscriptionStateContract = "Cancelled" + // Expired specifies the expired state for subscription state contract. + Expired SubscriptionStateContract = "Expired" + // Rejected specifies the rejected state for subscription state contract. + Rejected SubscriptionStateContract = "Rejected" + // Submitted specifies the submitted state for subscription state contract. + Submitted SubscriptionStateContract = "Submitted" + // Suspended specifies the suspended state for subscription state contract. + Suspended SubscriptionStateContract = "Suspended" +) + +// UserStateContract enumerates the values for user state contract. +type UserStateContract string + +const ( + // UserStateContractActive specifies the user state contract active state + // for user state contract. + UserStateContractActive UserStateContract = "Active" + // UserStateContractBlocked specifies the user state contract blocked state + // for user state contract. + UserStateContractBlocked UserStateContract = "Blocked" +) + +// VirtualNetworkType enumerates the values for virtual network type. +type VirtualNetworkType string + +const ( + // VirtualNetworkTypeExternal specifies the virtual network type external + // state for virtual network type. + VirtualNetworkTypeExternal VirtualNetworkType = "External" + // VirtualNetworkTypeInternal specifies the virtual network type internal + // state for virtual network type. + VirtualNetworkTypeInternal VirtualNetworkType = "Internal" + // VirtualNetworkTypeNone specifies the virtual network type none state for + // virtual network type. + VirtualNetworkTypeNone VirtualNetworkType = "None" +) + +// AccessInformationContract is tenant access information contract of the API +// Management service. +type AccessInformationContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// AccessInformationUpdateParameters is tenant access information update +// parameters of the API Management service. +type AccessInformationUpdateParameters struct { + Enabled *bool `json:"enabled,omitempty"` +} + +// AdditionalRegion is description of an additional API Management resource +// location. +type AdditionalRegion struct { + Location *string `json:"location,omitempty"` + SkuType SkuType `json:"skuType,omitempty"` + SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` + StaticIPs *[]string `json:"staticIPs,omitempty"` + Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` +} + +// APICollection is paged Api list representation. +type APICollection struct { + autorest.Response `json:"-"` + Value *[]APIContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// APICollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client APICollection) APICollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// APIContract is aPI details. +type APIContract struct { + autorest.Response `json:"-"` + Description *string `json:"description,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + Type APITypeContract `json:"type,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + ServiceURL *string `json:"serviceUrl,omitempty"` + Path *string `json:"path,omitempty"` + Protocols *[]APIProtocolContract `json:"protocols,omitempty"` +} + +// APIEntityBaseContract is aPI base contract details. +type APIEntityBaseContract struct { + Description *string `json:"description,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + Type APITypeContract `json:"type,omitempty"` +} + +// APIExportResult is the response model for the export API output operation. +type APIExportResult struct { + autorest.Response `json:"-"` + Content *[]byte `json:"content,omitempty"` + StatusCode HTTPStatusCode `json:"statusCode,omitempty"` + RequestID *string `json:"requestId,omitempty"` +} + +// APIUpdateContract is aPI Update Contract details. +type APIUpdateContract struct { + Description *string `json:"description,omitempty"` + AuthenticationSettings *AuthenticationSettingsContract `json:"authenticationSettings,omitempty"` + SubscriptionKeyParameterNames *SubscriptionKeyParameterNamesContract `json:"subscriptionKeyParameterNames,omitempty"` + Type APITypeContract `json:"type,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + ServiceURL *string `json:"serviceUrl,omitempty"` + Path *string `json:"path,omitempty"` + Protocols *[]APIProtocolContract `json:"protocols,omitempty"` +} + +// AuthenticationSettingsContract is aPI Authentication Settings. +type AuthenticationSettingsContract struct { + OAuth2 *OAuth2AuthenticationSettingsContract `json:"oAuth2,omitempty"` +} + +// AuthorizationServerCollection is paged OAuth2 Authorization Servers list +// representation. +type AuthorizationServerCollection struct { + autorest.Response `json:"-"` + Value *[]OAuth2AuthorizationServerContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AuthorizationServerCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AuthorizationServerCollection) AuthorizationServerCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// BackendAuthorizationHeaderCredentials is authorization header information. +type BackendAuthorizationHeaderCredentials struct { + Scheme *string `json:"scheme,omitempty"` + Parameter *string `json:"parameter,omitempty"` +} + +// BackendBaseParameters is backend entity base Parameter set. +type BackendBaseParameters struct { + Certificate *[]string `json:"certificate,omitempty"` + Query *map[string][]string `json:"query,omitempty"` + Header *map[string][]string `json:"header,omitempty"` + URL *string `json:"url,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + *BackendProperties `json:"properties,omitempty"` +} + +// BackendCollection is paged Backend list representation. +type BackendCollection struct { + autorest.Response `json:"-"` + Value *[]BackendResponse `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// BackendCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client BackendCollection) BackendCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// BackendContract is parameters supplied to the Create Backend operation. +type BackendContract struct { + Certificate *[]string `json:"certificate,omitempty"` + Query *map[string][]string `json:"query,omitempty"` + Header *map[string][]string `json:"header,omitempty"` + URL *string `json:"url,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + *BackendProperties `json:"properties,omitempty"` + ID *string `json:"id,omitempty"` + Protocol BackendProtocol `json:"protocol,omitempty"` +} + +// BackendCredentialsContract is details of the Credentials used to connect to +// Backend. +type BackendCredentialsContract struct { + Scheme *string `json:"scheme,omitempty"` + Parameter *string `json:"parameter,omitempty"` + Certificate *[]string `json:"certificate,omitempty"` + Query *map[string][]string `json:"query,omitempty"` + Header *map[string][]string `json:"header,omitempty"` +} + +// BackendProperties is properties specific to a Backend. +type BackendProperties struct { + SkipCertificateChainValidation *bool `json:"skipCertificateChainValidation,omitempty"` + SkipCertificateNameValidation *bool `json:"skipCertificateNameValidation,omitempty"` +} + +// BackendProxyContract is details of the Backend WebProxy Server to use in the +// Request to Backend. +type BackendProxyContract struct { + URL *string `json:"url,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` +} + +// BackendResponse is the Backend entity in API Management represents a backend +// service that is configured to skip certification chain validation when using +// a self-signed certificate to test mutual certificate authentication. +type BackendResponse struct { + autorest.Response `json:"-"` + Certificate *[]string `json:"certificate,omitempty"` + Query *map[string][]string `json:"query,omitempty"` + Header *map[string][]string `json:"header,omitempty"` + URL *string `json:"url,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + *BackendProperties `json:"properties,omitempty"` + ID *string `json:"id,omitempty"` + Protocol BackendProtocol `json:"protocol,omitempty"` +} + +// BackendUpdateParameters is parameters supplied to the Update Backend +// operation. +type BackendUpdateParameters struct { + Certificate *[]string `json:"certificate,omitempty"` + Query *map[string][]string `json:"query,omitempty"` + Header *map[string][]string `json:"header,omitempty"` + URL *string `json:"url,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + *BackendProperties `json:"properties,omitempty"` + Protocol BackendProtocol `json:"protocol,omitempty"` +} + +// CertificateCollection is paged Certificates list representation. +type CertificateCollection struct { + autorest.Response `json:"-"` + Value *[]CertificateContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CertificateCollection) CertificateCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CertificateContract is certificate details. +type CertificateContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Subject *string `json:"subject,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` +} + +// CertificateCreateOrUpdateParameters is parameters supplied to the +// CreateOrUpdate certificate operation. +type CertificateCreateOrUpdateParameters struct { + Data *string `json:"data,omitempty"` + Password *string `json:"password,omitempty"` +} + +// CertificateInformation is sSL certificate information. +type CertificateInformation struct { + autorest.Response `json:"-"` + Expiry *date.Time `json:"expiry,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Subject *string `json:"subject,omitempty"` +} + +// ConnectivityStatusContract is details about connectivity to a resource. +type ConnectivityStatusContract struct { + Name *string `json:"name,omitempty"` + Status ConnectivityStatusType `json:"status,omitempty"` + Error *string `json:"error,omitempty"` + LastUpdated *date.Time `json:"lastUpdated,omitempty"` + LastStatusChange *date.Time `json:"lastStatusChange,omitempty"` +} + +// DeployConfigurationParameters is parameters supplied to the Deploy +// Configuration operation. +type DeployConfigurationParameters struct { + Branch *string `json:"branch,omitempty"` + Force *bool `json:"force,omitempty"` +} + +// ErrorBodyContract is error Body contract. +type ErrorBodyContract struct { + autorest.Response `json:"-"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Details *[]ErrorFieldContract `json:"details,omitempty"` +} + +// ErrorFieldContract is error Field contract. +type ErrorFieldContract struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} + +// ErrorResponse is error Response. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// GenerateSsoURLResult is generate SSO Url operations response details. +type GenerateSsoURLResult struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// GroupCollection is paged Group list representation. +type GroupCollection struct { + autorest.Response `json:"-"` + Value *[]GroupContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// GroupCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client GroupCollection) GroupCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// GroupContract is developer group. +type GroupContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + BuiltIn *bool `json:"builtIn,omitempty"` + Type GroupTypeContract `json:"type,omitempty"` + ExternalID *string `json:"externalId,omitempty"` +} + +// GroupCreateParameters is parameters supplied to the Create Group operation. +type GroupCreateParameters struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Type GroupTypeContract `json:"type,omitempty"` + ExternalID *string `json:"externalId,omitempty"` +} + +// GroupUpdateParameters is parameters supplied to the Update Group operation. +type GroupUpdateParameters struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Type GroupTypeContract `json:"type,omitempty"` + ExternalID *string `json:"externalId,omitempty"` +} + +// HostnameConfiguration is custom hostname configuration. +type HostnameConfiguration struct { + Type HostnameType `json:"type,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Certificate *CertificateInformation `json:"certificate,omitempty"` +} + +// IdentityProviderContract is the external Identity Providers like Facebook, +// Google, Microsoft, Twitter or Azure Active Directory which can be used to +// enable access to the API Management service developer portal for all users. +type IdentityProviderContract struct { + autorest.Response `json:"-"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + Type IdentityProviderNameType `json:"type,omitempty"` + AllowedTenants *[]string `json:"allowedTenants,omitempty"` +} + +// IdentityProviderList is list of all the Identity Providers configured on the +// service instance. +type IdentityProviderList struct { + autorest.Response `json:"-"` + Value *[]IdentityProviderContract `json:"value,omitempty"` +} + +// IdentityProviderUpdateParameters is parameters supplied to the Update +// Identity Provider operation. +type IdentityProviderUpdateParameters struct { + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + AllowedTenants *[]string `json:"allowedTenants,omitempty"` +} + +// LoggerCollection is paged Logger list representation. +type LoggerCollection struct { + autorest.Response `json:"-"` + Value *[]LoggerResponse `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// LoggerCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client LoggerCollection) LoggerCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// LoggerCreateParameters is parameters supplied to the Create Logger +// operation. +type LoggerCreateParameters struct { + Type *string `json:"type,omitempty"` + Description *string `json:"description,omitempty"` + Credentials *map[string]*string `json:"credentials,omitempty"` + IsBuffered *bool `json:"isBuffered,omitempty"` +} + +// LoggerResponse is the Logger entity in API Management represents an event +// sink that you can use to log API Management events. Currently the Logger +// entity supports logging API Management events to Azure Event Hubs. +type LoggerResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Description *string `json:"description,omitempty"` + Credentials *map[string]*string `json:"credentials,omitempty"` + IsBuffered *bool `json:"isBuffered,omitempty"` +} + +// LoggerUpdateParameters is parameters supplied to the Update Logger +// operation. +type LoggerUpdateParameters struct { + Type *string `json:"type,omitempty"` + Description *string `json:"description,omitempty"` + Credentials *map[string]*string `json:"credentials,omitempty"` + IsBuffered *bool `json:"isBuffered,omitempty"` +} + +// NetworkStatusContract is network Status details. +type NetworkStatusContract struct { + autorest.Response `json:"-"` + DNSServers *[]string `json:"dnsServers,omitempty"` + ConnectivityStatus *[]ConnectivityStatusContract `json:"connectivityStatus,omitempty"` +} + +// OAuth2AuthenticationSettingsContract is aPI OAuth2 Authentication settings +// details. +type OAuth2AuthenticationSettingsContract struct { + AuthorizationServerID *string `json:"authorizationServerId,omitempty"` + Scope *string `json:"scope,omitempty"` +} + +// OAuth2AuthorizationServerContract is external OAuth authorization server +// settings. +type OAuth2AuthorizationServerContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` + AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` + AuthorizationMethods *[]MethodContract `json:"authorizationMethods,omitempty"` + ClientAuthenticationMethod *[]ClientAuthenticationMethodContract `json:"clientAuthenticationMethod,omitempty"` + TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` + SupportState *bool `json:"supportState,omitempty"` + DefaultScope *string `json:"defaultScope,omitempty"` + GrantTypes *[]GrantTypesContract `json:"grantTypes,omitempty"` + BearerTokenSendingMethods *[]BearerTokenSendingMethodsContract `json:"bearerTokenSendingMethods,omitempty"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` + ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` +} + +// OAuth2AuthorizationServerUpdateContract is external OAuth authorization +// server Update settings contract. +type OAuth2AuthorizationServerUpdateContract struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + ClientRegistrationEndpoint *string `json:"clientRegistrationEndpoint,omitempty"` + AuthorizationEndpoint *string `json:"authorizationEndpoint,omitempty"` + AuthorizationMethods *[]MethodContract `json:"authorizationMethods,omitempty"` + ClientAuthenticationMethod *[]ClientAuthenticationMethodContract `json:"clientAuthenticationMethod,omitempty"` + TokenBodyParameters *[]TokenBodyParameterContract `json:"tokenBodyParameters,omitempty"` + TokenEndpoint *string `json:"tokenEndpoint,omitempty"` + SupportState *bool `json:"supportState,omitempty"` + DefaultScope *string `json:"defaultScope,omitempty"` + GrantTypes *[]GrantTypesContract `json:"grantTypes,omitempty"` + BearerTokenSendingMethods *[]BearerTokenSendingMethodsContract `json:"bearerTokenSendingMethods,omitempty"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + ResourceOwnerUsername *string `json:"resourceOwnerUsername,omitempty"` + ResourceOwnerPassword *string `json:"resourceOwnerPassword,omitempty"` +} + +// OpenIDConnectProviderCollection is paged OpenIdProviders list +// representation. +type OpenIDConnectProviderCollection struct { + autorest.Response `json:"-"` + Value *[]OpenidConnectProviderContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OpenIDConnectProviderCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OpenIDConnectProviderCollection) OpenIDConnectProviderCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OpenidConnectProviderContract is openID Connect Providers Contract. +type OpenidConnectProviderContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` +} + +// OpenidConnectProviderCreateContract is parameters supplied to the Create +// OpenID Connect Provider operation. +type OpenidConnectProviderCreateContract struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` +} + +// OpenidConnectProviderUpdateContract is parameters supplied to the Update +// OpenID Connect Provider operation. +type OpenidConnectProviderUpdateContract struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + MetadataEndpoint *string `json:"metadataEndpoint,omitempty"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` +} + +// Operation is rEST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that describes the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationCollection is paged Operation list representation. +type OperationCollection struct { + autorest.Response `json:"-"` + Value *[]OperationContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationCollection) OperationCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OperationContract is api Operation details. +type OperationContract struct { + autorest.Response `json:"-"` + TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` + Description *string `json:"description,omitempty"` + Request *RequestContract `json:"request,omitempty"` + Responses *[]ResultContract `json:"responses,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Method *string `json:"method,omitempty"` + URLTemplate *string `json:"urlTemplate,omitempty"` +} + +// OperationEntityBaseContract is api Operation Entity Base Contract details. +type OperationEntityBaseContract struct { + TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` + Description *string `json:"description,omitempty"` + Request *RequestContract `json:"request,omitempty"` + Responses *[]ResultContract `json:"responses,omitempty"` +} + +// OperationListResult is result of the request to list REST API operations. It +// contains a list of operations and a URL nextLink to get the next set of +// results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OperationResultContract is operation Result. +type OperationResultContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Status AsyncOperationState `json:"status,omitempty"` + Started *date.Time `json:"started,omitempty"` + Updated *date.Time `json:"updated,omitempty"` + ResultInfo *string `json:"resultInfo,omitempty"` + Error *ErrorBodyContract `json:"error,omitempty"` +} + +// OperationUpdateContract is api Operation Update Contract details. +type OperationUpdateContract struct { + TemplateParameters *[]ParameterContract `json:"templateParameters,omitempty"` + Description *string `json:"description,omitempty"` + Request *RequestContract `json:"request,omitempty"` + Responses *[]ResultContract `json:"responses,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Method *string `json:"method,omitempty"` + URLTemplate *string `json:"urlTemplate,omitempty"` +} + +// ParameterContract is operation parameters details. +type ParameterContract struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + Required *bool `json:"required,omitempty"` + Values *[]string `json:"values,omitempty"` +} + +// PolicySnippetContract is policy snippet. +type PolicySnippetContract struct { + Name *string `json:"name,omitempty"` + Content *string `json:"content,omitempty"` + ToolTip *string `json:"toolTip,omitempty"` + Scope PolicyScopeContract `json:"scope,omitempty"` +} + +// PolicySnippetsCollection is the response of the list policy snippets +// operation. +type PolicySnippetsCollection struct { + autorest.Response `json:"-"` + Value *[]PolicySnippetContract `json:"value,omitempty"` +} + +// ProductCollection is paged Products list representation. +type ProductCollection struct { + autorest.Response `json:"-"` + Value *[]ProductContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProductCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProductCollection) ProductCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProductContract is product profile. +type ProductContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Terms *string `json:"terms,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + ApprovalRequired *bool `json:"approvalRequired,omitempty"` + SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` + State ProductStateContract `json:"state,omitempty"` +} + +// ProductUpdateParameters is parameters supplied to the CreateOrUpdate Product +// operation. +type ProductUpdateParameters struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Terms *string `json:"terms,omitempty"` + SubscriptionRequired *bool `json:"subscriptionRequired,omitempty"` + ApprovalRequired *bool `json:"approvalRequired,omitempty"` + SubscriptionsLimit *int32 `json:"subscriptionsLimit,omitempty"` + State ProductStateContract `json:"state,omitempty"` +} + +// PropertyCollection is paged Property list representation. +type PropertyCollection struct { + autorest.Response `json:"-"` + Value *[]PropertyContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PropertyCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PropertyCollection) PropertyCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PropertyContract is property details. +type PropertyContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Secret *bool `json:"secret,omitempty"` +} + +// PropertyCreateParameters is parameters supplied to the Create Property +// operation. +type PropertyCreateParameters struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Secret *bool `json:"secret,omitempty"` +} + +// PropertyUpdateParameters is parameters supplied to the Update Property +// operation. +type PropertyUpdateParameters struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + Tags *[]string `json:"tags,omitempty"` + Secret *bool `json:"secret,omitempty"` +} + +// QuotaCounterCollection is paged Quota Counter list representation. +type QuotaCounterCollection struct { + autorest.Response `json:"-"` + Value *[]QuotaCounterContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// QuotaCounterContract is quota counter details. +type QuotaCounterContract struct { + autorest.Response `json:"-"` + CallsCount *int32 `json:"callsCount,omitempty"` + KbTransferred *float64 `json:"kbTransferred,omitempty"` + CounterKey *string `json:"counterKey,omitempty"` + PeriodKey *string `json:"periodKey,omitempty"` + PeriodStartTime *date.Time `json:"periodStartTime,omitempty"` + PeriodEndTime *date.Time `json:"periodEndTime,omitempty"` +} + +// QuotaCounterValueContract is quota counter value details. +type QuotaCounterValueContract struct { + CallsCount *int32 `json:"callsCount,omitempty"` + KbTransferred *float64 `json:"kbTransferred,omitempty"` +} + +// ReadCloser is +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + +// RegionContract is region profile. +type RegionContract struct { + Name *string `json:"name,omitempty"` + IsMasterRegion *bool `json:"isMasterRegion,omitempty"` +} + +// RegionListResult is lists Regions operation response details. +type RegionListResult struct { + autorest.Response `json:"-"` + Value *[]RegionContract `json:"value,omitempty"` +} + +// ReportCollection is paged Report records list representation. +type ReportCollection struct { + autorest.Response `json:"-"` + Value *[]ReportRecordContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ReportCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ReportCollection) ReportCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ReportRecordContract is report data. +type ReportRecordContract struct { + Name *string `json:"name,omitempty"` + Timestamp *date.Time `json:"timestamp,omitempty"` + Interval *int64 `json:"interval,omitempty"` + Country *string `json:"country,omitempty"` + Region *string `json:"region,omitempty"` + Zip *string `json:"zip,omitempty"` + UserID *string `json:"userId,omitempty"` + ProductID *string `json:"productId,omitempty"` + APIID *string `json:"apiId,omitempty"` + OperationID *string `json:"operationId,omitempty"` + APIRegion *string `json:"apiRegion,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + CallCountSuccess *int32 `json:"callCountSuccess,omitempty"` + CallCountBlocked *int32 `json:"callCountBlocked,omitempty"` + CallCountFailed *int32 `json:"callCountFailed,omitempty"` + CallCountOther *int32 `json:"callCountOther,omitempty"` + CallCountTotal *int32 `json:"callCountTotal,omitempty"` + Bandwidth *int64 `json:"bandwidth,omitempty"` + CacheHitCount *int32 `json:"cacheHitCount,omitempty"` + CacheMissCount *int32 `json:"cacheMissCount,omitempty"` + APITimeAvg *float64 `json:"apiTimeAvg,omitempty"` + APITimeMin *float64 `json:"apiTimeMin,omitempty"` + APITimeMax *float64 `json:"apiTimeMax,omitempty"` + ServiceTimeAvg *float64 `json:"serviceTimeAvg,omitempty"` + ServiceTimeMin *float64 `json:"serviceTimeMin,omitempty"` + ServiceTimeMax *float64 `json:"serviceTimeMax,omitempty"` +} + +// RepresentationContract is operation request/response representation details. +type RepresentationContract struct { + ContentType *string `json:"contentType,omitempty"` + Sample *string `json:"sample,omitempty"` +} + +// RequestContract is operation request details. +type RequestContract struct { + Description *string `json:"description,omitempty"` + QueryParameters *[]ParameterContract `json:"queryParameters,omitempty"` + Headers *[]ParameterContract `json:"headers,omitempty"` + Representations *[]RepresentationContract `json:"representations,omitempty"` +} + +// Resource is the Resource definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResultContract is operation response details. +type ResultContract struct { + StatusCode *int32 `json:"statusCode,omitempty"` + Description *string `json:"description,omitempty"` + Representations *[]RepresentationContract `json:"representations,omitempty"` +} + +// SaveConfigurationParameter is parameters supplied to the Save Tenant +// Configuration operation. +type SaveConfigurationParameter struct { + Branch *string `json:"branch,omitempty"` + Force *bool `json:"force,omitempty"` +} + +// ServiceBackupRestoreParameters is parameters supplied to the Backup/Restore +// of an API Management service operation. +type ServiceBackupRestoreParameters struct { + StorageAccount *string `json:"storageAccount,omitempty"` + AccessKey *string `json:"accessKey,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + BackupName *string `json:"backupName,omitempty"` +} + +// ServiceCheckNameAvailabilityParameters is parameters supplied to the +// CheckNameAvailability operation. +type ServiceCheckNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` +} + +// ServiceGetSsoTokenResult is the response of the GetSsoToken operation. +type ServiceGetSsoTokenResult struct { + autorest.Response `json:"-"` + RedirectURI *string `json:"redirect_uri,omitempty"` +} + +// ServiceListResult is the response of the List API Management services +// operation. +type ServiceListResult struct { + autorest.Response `json:"-"` + Value *[]ServiceResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ServiceListResult) ServiceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ServiceManageDeploymentsParameters is parameters supplied to the +// ManageDeployments operation. +type ServiceManageDeploymentsParameters struct { + Location *string `json:"location,omitempty"` + SkuType SkuType `json:"skuType,omitempty"` + SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` + AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` + VpnConfiguration *VirtualNetworkConfiguration `json:"vpnConfiguration,omitempty"` + VpnType VirtualNetworkType `json:"vpnType,omitempty"` +} + +// ServiceNameAvailabilityResult is response of the CheckNameAvailability +// operation. +type ServiceNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Message *string `json:"message,omitempty"` + Reason NameAvailabilityReason `json:"reason,omitempty"` +} + +// ServiceProperties is properties of an API Management service resource +// description. +type ServiceProperties struct { + PublisherEmail *string `json:"publisherEmail,omitempty"` + PublisherName *string `json:"publisherName,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` + CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` + RuntimeURL *string `json:"runtimeUrl,omitempty"` + PortalURL *string `json:"portalUrl,omitempty"` + ManagementAPIURL *string `json:"managementApiUrl,omitempty"` + ScmURL *string `json:"scmUrl,omitempty"` + AddresserEmail *string `json:"addresserEmail,omitempty"` + HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` + StaticIPs *[]string `json:"staticIPs,omitempty"` + Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` + AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` + CustomProperties *map[string]*string `json:"customProperties,omitempty"` + VpnType VirtualNetworkType `json:"vpnType,omitempty"` +} + +// ServiceResource is a single API Management service resource in List or Get +// response. +type ServiceResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ServiceProperties `json:"properties,omitempty"` + Sku *ServiceSkuProperties `json:"sku,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ServiceSkuProperties is aPI Management service resource SKU properties. +type ServiceSkuProperties struct { + Name SkuType `json:"name,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// ServiceUpdateHostnameParameters is parameters supplied to the UpdateHostname +// operation. +type ServiceUpdateHostnameParameters struct { + Update *[]HostnameConfiguration `json:"update,omitempty"` + Delete *[]HostnameType `json:"delete,omitempty"` +} + +// ServiceUpdateParameters is parameters supplied to the Update API Management +// service operation. +type ServiceUpdateParameters struct { + *ServiceProperties `json:"properties,omitempty"` + Sku *ServiceSkuProperties `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServiceUploadCertificateParameters is parameters supplied to the Upload SSL +// certificate for an API Management service operation. +type ServiceUploadCertificateParameters struct { + Type HostnameType `json:"type,omitempty"` + Certificate *string `json:"certificate,omitempty"` + CertificatePassword *string `json:"certificate_password,omitempty"` +} + +// SubscriptionCollection is paged Subscriptions list representation. +type SubscriptionCollection struct { + autorest.Response `json:"-"` + Value *[]SubscriptionContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SubscriptionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SubscriptionCollection) SubscriptionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SubscriptionContract is subscription details. +type SubscriptionContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + UserID *string `json:"userId,omitempty"` + ProductID *string `json:"productId,omitempty"` + Name *string `json:"name,omitempty"` + State SubscriptionStateContract `json:"state,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + StartDate *date.Time `json:"startDate,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + EndDate *date.Time `json:"endDate,omitempty"` + NotificationDate *date.Time `json:"notificationDate,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + StateComment *string `json:"stateComment,omitempty"` +} + +// SubscriptionCreateParameters is parameters supplied to the Create +// subscription operation. +type SubscriptionCreateParameters struct { + UserID *string `json:"userId,omitempty"` + ProductID *string `json:"productId,omitempty"` + Name *string `json:"name,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + State SubscriptionStateContract `json:"state,omitempty"` +} + +// SubscriptionKeyParameterNamesContract is subscription key parameter names +// details. +type SubscriptionKeyParameterNamesContract struct { + Header *string `json:"header,omitempty"` + Query *string `json:"query,omitempty"` +} + +// SubscriptionUpdateParameters is parameters supplied to the Update +// subscription operation. +type SubscriptionUpdateParameters struct { + UserID *string `json:"userId,omitempty"` + ProductID *string `json:"productId,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + Name *string `json:"name,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + State SubscriptionStateContract `json:"state,omitempty"` + StateComment *string `json:"stateComment,omitempty"` +} + +// TenantConfigurationSyncStateContract is tenant Configuration Synchronization +// State. +type TenantConfigurationSyncStateContract struct { + autorest.Response `json:"-"` + Branch *string `json:"branch,omitempty"` + CommitID *string `json:"commitId,omitempty"` + IsExport *bool `json:"isExport,omitempty"` + IsSynced *bool `json:"isSynced,omitempty"` + IsGitEnabled *bool `json:"isGitEnabled,omitempty"` + SyncDate *date.Time `json:"syncDate,omitempty"` + ConfigurationChangeDate *date.Time `json:"configurationChangeDate,omitempty"` +} + +// TokenBodyParameterContract is oAuth acquire token request body parameter +// (www-url-form-encoded). +type TokenBodyParameterContract struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// UserCollection is paged Users list representation. +type UserCollection struct { + autorest.Response `json:"-"` + Value *[]UserContract `json:"value,omitempty"` + Count *int64 `json:"count,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// UserCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client UserCollection) UserCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// UserContract is user profile. +type UserContract struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + FirstName *string `json:"firstName,omitempty"` + LastName *string `json:"lastName,omitempty"` + Email *string `json:"email,omitempty"` + State UserStateContract `json:"state,omitempty"` + RegistrationDate *date.Time `json:"registrationDate,omitempty"` + Note *string `json:"note,omitempty"` + Identities *[]UserIdentityContract `json:"identities,omitempty"` +} + +// UserCreateParameters is parameters supplied to the Create User operation. +type UserCreateParameters struct { + Email *string `json:"email,omitempty"` + Password *string `json:"password,omitempty"` + FirstName *string `json:"firstName,omitempty"` + LastName *string `json:"lastName,omitempty"` + State UserStateContract `json:"state,omitempty"` + Note *string `json:"note,omitempty"` +} + +// UserIdentityCollection is list of Users Identity list representation. +type UserIdentityCollection struct { + autorest.Response `json:"-"` + Value *[]UserIdentityContract `json:"value,omitempty"` +} + +// UserIdentityContract is user identity details. +type UserIdentityContract struct { + Provider *string `json:"provider,omitempty"` + ID *string `json:"id,omitempty"` +} + +// UserUpdateParameters is parameters supplied to the Update User operation. +type UserUpdateParameters struct { + Email *string `json:"email,omitempty"` + Password *string `json:"password,omitempty"` + FirstName *string `json:"firstName,omitempty"` + LastName *string `json:"lastName,omitempty"` + State UserStateContract `json:"state,omitempty"` + Note *string `json:"note,omitempty"` +} + +// VirtualNetworkConfiguration is configuration of a virtual network to which +// API Management service is deployed. +type VirtualNetworkConfiguration struct { + Vnetid *string `json:"vnetid,omitempty"` + Subnetname *string `json:"subnetname,omitempty"` + SubnetResourceID *string `json:"subnetResourceId,omitempty"` + Location *string `json:"location,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/networkstatus.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/networkstatus.go index ab533643a1..11625067f4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/networkstatus.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/networkstatus.go @@ -1,119 +1,119 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NetworkStatusClient is the composite Swagger for ApiManagement Client -type NetworkStatusClient struct { - ManagementClient -} - -// NewNetworkStatusClient creates an instance of the NetworkStatusClient -// client. -func NewNetworkStatusClient(subscriptionID string) NetworkStatusClient { - return NewNetworkStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkStatusClientWithBaseURI creates an instance of the -// NetworkStatusClient client. -func NewNetworkStatusClientWithBaseURI(baseURI string, subscriptionID string) NetworkStatusClient { - return NetworkStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByService gets the Connectivity Status to the external resources on which -// the Api Management service depends from inside the Cloud Service. This also -// returns the DNS Servers as visible to the CloudService. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client NetworkStatusClient) GetByService(resourceGroupName string, serviceName string) (result NetworkStatusContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.NetworkStatusClient", "GetByService") - } - - req, err := client.GetByServicePreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "GetByService", nil, "Failure preparing request") - return - } - - resp, err := client.GetByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "GetByService", resp, "Failure sending request") - return - } - - result, err = client.GetByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "GetByService", resp, "Failure responding to request") - } - - return -} - -// GetByServicePreparer prepares the GetByService request. -func (client NetworkStatusClient) GetByServicePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByServiceSender sends the GetByService request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkStatusClient) GetByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByServiceResponder handles the response to the GetByService request. The method always -// closes the http.Response Body. -func (client NetworkStatusClient) GetByServiceResponder(resp *http.Response) (result NetworkStatusContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NetworkStatusClient is the composite Swagger for ApiManagement Client +type NetworkStatusClient struct { + ManagementClient +} + +// NewNetworkStatusClient creates an instance of the NetworkStatusClient +// client. +func NewNetworkStatusClient(subscriptionID string) NetworkStatusClient { + return NewNetworkStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNetworkStatusClientWithBaseURI creates an instance of the +// NetworkStatusClient client. +func NewNetworkStatusClientWithBaseURI(baseURI string, subscriptionID string) NetworkStatusClient { + return NetworkStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByService gets the Connectivity Status to the external resources on which +// the Api Management service depends from inside the Cloud Service. This also +// returns the DNS Servers as visible to the CloudService. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client NetworkStatusClient) GetByService(resourceGroupName string, serviceName string) (result NetworkStatusContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.NetworkStatusClient", "GetByService") + } + + req, err := client.GetByServicePreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "GetByService", nil, "Failure preparing request") + return + } + + resp, err := client.GetByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "GetByService", resp, "Failure sending request") + return + } + + result, err = client.GetByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.NetworkStatusClient", "GetByService", resp, "Failure responding to request") + } + + return +} + +// GetByServicePreparer prepares the GetByService request. +func (client NetworkStatusClient) GetByServicePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByServiceSender sends the GetByService request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkStatusClient) GetByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByServiceResponder handles the response to the GetByService request. The method always +// closes the http.Response Body. +func (client NetworkStatusClient) GetByServiceResponder(resp *http.Response) (result NetworkStatusContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/openidconnectproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/openidconnectproviders.go index b9f873d2fd..5b63f1012a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/openidconnectproviders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/openidconnectproviders.go @@ -1,494 +1,494 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// OpenIDConnectProvidersClient is the composite Swagger for ApiManagement -// Client -type OpenIDConnectProvidersClient struct { - ManagementClient -} - -// NewOpenIDConnectProvidersClient creates an instance of the -// OpenIDConnectProvidersClient client. -func NewOpenIDConnectProvidersClient(subscriptionID string) OpenIDConnectProvidersClient { - return NewOpenIDConnectProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOpenIDConnectProvidersClientWithBaseURI creates an instance of the -// OpenIDConnectProvidersClient client. -func NewOpenIDConnectProvidersClientWithBaseURI(baseURI string, subscriptionID string) OpenIDConnectProvidersClient { - return OpenIDConnectProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the OpenID Connect Provider. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. opid is identifier of the OpenID Connect -// Provider. parameters is create parameters. -func (client OpenIDConnectProvidersClient) CreateOrUpdate(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderCreateContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, - {Target: "parameters.MetadataEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, opid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client OpenIDConnectProvidersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderCreateContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes specific OpenID Connect Provider of the API Management -// service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. opid is identifier of the OpenID Connect -// Provider. ifMatch is the entity state (Etag) version of the OpenID Connect -// Provider to delete. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client OpenIDConnectProvidersClient) Delete(resourceGroupName string, serviceName string, opid string, ifMatch string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, opid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OpenIDConnectProvidersClient) DeletePreparer(resourceGroupName string, serviceName string, opid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProvidersClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets specific OpenID Connect Provider. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. opid is identifier of the OpenID Connect -// Provider. -func (client OpenIDConnectProvidersClient) Get(resourceGroupName string, serviceName string, opid string) (result OpenidConnectProviderContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, opid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client OpenIDConnectProvidersClient) GetPreparer(resourceGroupName string, serviceName string, opid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProvidersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProvidersClient) GetResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists all OpenID Connect Providers. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators | -// Supported functions | -// |-------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of records to -// skip. -func (client OpenIDConnectProvidersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client OpenIDConnectProvidersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProvidersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProvidersClient) ListByServiceResponder(resp *http.Response) (result OpenIDConnectProviderCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client OpenIDConnectProvidersClient) ListByServiceNextResults(lastResults OpenIDConnectProviderCollection) (result OpenIDConnectProviderCollection, err error) { - req, err := lastResults.OpenIDConnectProviderCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the specific OpenID Connect Provider. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. opid is identifier of the OpenID Connect -// Provider. parameters is update parameters. ifMatch is the entity state -// (Etag) version of the OpenID Connect Provider to update. A value of "*" can -// be used for If-Match to unconditionally apply the operation. -func (client OpenIDConnectProvidersClient) Update(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: opid, - Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, opid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client OpenIDConnectProvidersClient) UpdatePreparer(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "opid": autorest.Encode("path", opid), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client OpenIDConnectProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client OpenIDConnectProvidersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// OpenIDConnectProvidersClient is the composite Swagger for ApiManagement +// Client +type OpenIDConnectProvidersClient struct { + ManagementClient +} + +// NewOpenIDConnectProvidersClient creates an instance of the +// OpenIDConnectProvidersClient client. +func NewOpenIDConnectProvidersClient(subscriptionID string) OpenIDConnectProvidersClient { + return NewOpenIDConnectProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOpenIDConnectProvidersClientWithBaseURI creates an instance of the +// OpenIDConnectProvidersClient client. +func NewOpenIDConnectProvidersClientWithBaseURI(baseURI string, subscriptionID string) OpenIDConnectProvidersClient { + return OpenIDConnectProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the OpenID Connect Provider. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. opid is identifier of the OpenID Connect +// Provider. parameters is create parameters. +func (client OpenIDConnectProvidersClient) CreateOrUpdate(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderCreateContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: opid, + Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "parameters.MetadataEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, opid, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OpenIDConnectProvidersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderCreateContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "opid": autorest.Encode("path", opid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client OpenIDConnectProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client OpenIDConnectProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes specific OpenID Connect Provider of the API Management +// service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. opid is identifier of the OpenID Connect +// Provider. ifMatch is the entity state (Etag) version of the OpenID Connect +// Provider to delete. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client OpenIDConnectProvidersClient) Delete(resourceGroupName string, serviceName string, opid string, ifMatch string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: opid, + Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, opid, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OpenIDConnectProvidersClient) DeletePreparer(resourceGroupName string, serviceName string, opid string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "opid": autorest.Encode("path", opid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OpenIDConnectProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OpenIDConnectProvidersClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets specific OpenID Connect Provider. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. opid is identifier of the OpenID Connect +// Provider. +func (client OpenIDConnectProvidersClient) Get(resourceGroupName string, serviceName string, opid string) (result OpenidConnectProviderContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: opid, + Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, opid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client OpenIDConnectProvidersClient) GetPreparer(resourceGroupName string, serviceName string, opid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "opid": autorest.Encode("path", opid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OpenIDConnectProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OpenIDConnectProvidersClient) GetResponder(resp *http.Response) (result OpenidConnectProviderContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists all OpenID Connect Providers. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators | +// Supported functions | +// |-------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of records to +// skip. +func (client OpenIDConnectProvidersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result OpenIDConnectProviderCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client OpenIDConnectProvidersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client OpenIDConnectProvidersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client OpenIDConnectProvidersClient) ListByServiceResponder(resp *http.Response) (result OpenIDConnectProviderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client OpenIDConnectProvidersClient) ListByServiceNextResults(lastResults OpenIDConnectProviderCollection) (result OpenIDConnectProviderCollection, err error) { + req, err := lastResults.OpenIDConnectProviderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specific OpenID Connect Provider. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. opid is identifier of the OpenID Connect +// Provider. parameters is update parameters. ifMatch is the entity state +// (Etag) version of the OpenID Connect Provider to update. A value of "*" can +// be used for If-Match to unconditionally apply the operation. +func (client OpenIDConnectProvidersClient) Update(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: opid, + Constraints: []validation.Constraint{{Target: "opid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "opid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.OpenIDConnectProvidersClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, opid, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OpenIDConnectProvidersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OpenIDConnectProvidersClient) UpdatePreparer(resourceGroupName string, serviceName string, opid string, parameters OpenidConnectProviderUpdateContract, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "opid": autorest.Encode("path", opid), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OpenIDConnectProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OpenIDConnectProvidersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/operations.go index abcafcb014..335c01805b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/operations.go @@ -1,123 +1,123 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the composite Swagger for ApiManagement Client -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the -// Microsoft.ApiManagement provider. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ApiManagement/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the composite Swagger for ApiManagement Client +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the +// Microsoft.ApiManagement provider. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ApiManagement/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/policysnippets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/policysnippets.go index 95b0abb57a..d54456bdd9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/policysnippets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/policysnippets.go @@ -1,120 +1,120 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PolicySnippetsClient is the composite Swagger for ApiManagement Client -type PolicySnippetsClient struct { - ManagementClient -} - -// NewPolicySnippetsClient creates an instance of the PolicySnippetsClient -// client. -func NewPolicySnippetsClient(subscriptionID string) PolicySnippetsClient { - return NewPolicySnippetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicySnippetsClientWithBaseURI creates an instance of the -// PolicySnippetsClient client. -func NewPolicySnippetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySnippetsClient { - return PolicySnippetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all policy snippets. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. scope is policy scope. -func (client PolicySnippetsClient) ListByService(resourceGroupName string, serviceName string, scope PolicyScopeContract) (result PolicySnippetsCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.PolicySnippetsClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PolicySnippetsClient) ListByServicePreparer(resourceGroupName string, serviceName string, scope PolicyScopeContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(scope)) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policySnippets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PolicySnippetsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PolicySnippetsClient) ListByServiceResponder(resp *http.Response) (result PolicySnippetsCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PolicySnippetsClient is the composite Swagger for ApiManagement Client +type PolicySnippetsClient struct { + ManagementClient +} + +// NewPolicySnippetsClient creates an instance of the PolicySnippetsClient +// client. +func NewPolicySnippetsClient(subscriptionID string) PolicySnippetsClient { + return NewPolicySnippetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPolicySnippetsClientWithBaseURI creates an instance of the +// PolicySnippetsClient client. +func NewPolicySnippetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySnippetsClient { + return PolicySnippetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByService lists all policy snippets. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. scope is policy scope. +func (client PolicySnippetsClient) ListByService(resourceGroupName string, serviceName string, scope PolicyScopeContract) (result PolicySnippetsCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.PolicySnippetsClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PolicySnippetsClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client PolicySnippetsClient) ListByServicePreparer(resourceGroupName string, serviceName string, scope PolicyScopeContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(scope)) > 0 { + queryParameters["scope"] = autorest.Encode("query", scope) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policySnippets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client PolicySnippetsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client PolicySnippetsClient) ListByServiceResponder(resp *http.Response) (result PolicySnippetsCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productapis.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productapis.go index c23bfa8443..80fbe70780 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productapis.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productapis.go @@ -1,344 +1,344 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProductApisClient is the composite Swagger for ApiManagement Client -type ProductApisClient struct { - ManagementClient -} - -// NewProductApisClient creates an instance of the ProductApisClient client. -func NewProductApisClient(subscriptionID string) ProductApisClient { - return NewProductApisClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductApisClientWithBaseURI creates an instance of the ProductApisClient -// client. -func NewProductApisClientWithBaseURI(baseURI string, subscriptionID string) ProductApisClient { - return ProductApisClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds an API to the specified product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. aPIID is aPI -// identifier. Must be unique in the current API Management service instance. -func (client ProductApisClient) Create(resourceGroupName string, serviceName string, productID string, aPIID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductApisClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, serviceName, productID, aPIID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ProductApisClient) CreatePreparer(resourceGroupName string, serviceName string, productID string, aPIID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ProductApisClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ProductApisClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified API from the specified product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. aPIID is aPI -// identifier. Must be unique in the current API Management service instance. -func (client ProductApisClient) Delete(resourceGroupName string, serviceName string, productID string, aPIID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: aPIID, - Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductApisClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, aPIID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductApisClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, aPIID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "apiId": autorest.Encode("path", aPIID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductApisClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductApisClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListByProducts lists a collection of the APIs associated with a product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. filter is | Field -// | Supported operators | Supported functions | -// |-------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of records to -// skip. -func (client ProductApisClient) ListByProducts(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductApisClient", "ListByProducts") - } - - req, err := client.ListByProductsPreparer(resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure sending request") - return - } - - result, err = client.ListByProductsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure responding to request") - } - - return -} - -// ListByProductsPreparer prepares the ListByProducts request. -func (client ProductApisClient) ListByProductsPreparer(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByProductsSender sends the ListByProducts request. The method will close the -// http.Response Body if it receives an error. -func (client ProductApisClient) ListByProductsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByProductsResponder handles the response to the ListByProducts request. The method always -// closes the http.Response Body. -func (client ProductApisClient) ListByProductsResponder(resp *http.Response) (result APICollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProductsNextResults retrieves the next set of results, if any. -func (client ProductApisClient) ListByProductsNextResults(lastResults APICollection) (result APICollection, err error) { - req, err := lastResults.APICollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByProductsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure sending next results request") - } - - result, err = client.ListByProductsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProductApisClient is the composite Swagger for ApiManagement Client +type ProductApisClient struct { + ManagementClient +} + +// NewProductApisClient creates an instance of the ProductApisClient client. +func NewProductApisClient(subscriptionID string) ProductApisClient { + return NewProductApisClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProductApisClientWithBaseURI creates an instance of the ProductApisClient +// client. +func NewProductApisClientWithBaseURI(baseURI string, subscriptionID string) ProductApisClient { + return ProductApisClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create adds an API to the specified product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. aPIID is aPI +// identifier. Must be unique in the current API Management service instance. +func (client ProductApisClient) Create(resourceGroupName string, serviceName string, productID string, aPIID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductApisClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, serviceName, productID, aPIID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ProductApisClient) CreatePreparer(resourceGroupName string, serviceName string, productID string, aPIID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ProductApisClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ProductApisClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified API from the specified product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. aPIID is aPI +// identifier. Must be unique in the current API Management service instance. +func (client ProductApisClient) Delete(resourceGroupName string, serviceName string, productID string, aPIID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: aPIID, + Constraints: []validation.Constraint{{Target: "aPIID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "aPIID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "aPIID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductApisClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, aPIID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProductApisClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, aPIID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiId": autorest.Encode("path", aPIID), + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProductApisClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProductApisClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListByProducts lists a collection of the APIs associated with a product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. filter is | Field +// | Supported operators | Supported functions | +// |-------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | serviceUrl | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | path | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of records to +// skip. +func (client ProductApisClient) ListByProducts(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result APICollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductApisClient", "ListByProducts") + } + + req, err := client.ListByProductsPreparer(resourceGroupName, serviceName, productID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProductsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure sending request") + return + } + + result, err = client.ListByProductsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure responding to request") + } + + return +} + +// ListByProductsPreparer prepares the ListByProducts request. +func (client ProductApisClient) ListByProductsPreparer(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByProductsSender sends the ListByProducts request. The method will close the +// http.Response Body if it receives an error. +func (client ProductApisClient) ListByProductsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByProductsResponder handles the response to the ListByProducts request. The method always +// closes the http.Response Body. +func (client ProductApisClient) ListByProductsResponder(resp *http.Response) (result APICollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProductsNextResults retrieves the next set of results, if any. +func (client ProductApisClient) ListByProductsNextResults(lastResults APICollection) (result APICollection, err error) { + req, err := lastResults.APICollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByProductsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure sending next results request") + } + + result, err = client.ListByProductsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductApisClient", "ListByProducts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productgroups.go index 5ce9770727..15c1936675 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productgroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productgroups.go @@ -1,345 +1,345 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProductGroupsClient is the composite Swagger for ApiManagement Client -type ProductGroupsClient struct { - ManagementClient -} - -// NewProductGroupsClient creates an instance of the ProductGroupsClient -// client. -func NewProductGroupsClient(subscriptionID string) ProductGroupsClient { - return NewProductGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductGroupsClientWithBaseURI creates an instance of the -// ProductGroupsClient client. -func NewProductGroupsClientWithBaseURI(baseURI string, subscriptionID string) ProductGroupsClient { - return ProductGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds the association between the specified developer group with the -// specified product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. groupID is group -// identifier. Must be unique in the current API Management service instance. -func (client ProductGroupsClient) Create(resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductGroupsClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ProductGroupsClient) CreatePreparer(resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ProductGroupsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the association between the specified group and product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. groupID is group -// identifier. Must be unique in the current API Management service instance. -func (client ProductGroupsClient) Delete(resourceGroupName string, serviceName string, productID string, groupID string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: groupID, - Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductGroupsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductGroupsClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductGroupsClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusBadRequest), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProducts lists the collection of developer groups associated with the -// specified product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. filter is | Field -// | Supported operators | Supported functions | -// |-------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | type | eq, ne | N/A -// | top is number of records to return. skip is number of records to skip. -func (client ProductGroupsClient) ListByProducts(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductGroupsClient", "ListByProducts") - } - - req, err := client.ListByProductsPreparer(resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure sending request") - return - } - - result, err = client.ListByProductsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure responding to request") - } - - return -} - -// ListByProductsPreparer prepares the ListByProducts request. -func (client ProductGroupsClient) ListByProductsPreparer(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByProductsSender sends the ListByProducts request. The method will close the -// http.Response Body if it receives an error. -func (client ProductGroupsClient) ListByProductsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByProductsResponder handles the response to the ListByProducts request. The method always -// closes the http.Response Body. -func (client ProductGroupsClient) ListByProductsResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProductsNextResults retrieves the next set of results, if any. -func (client ProductGroupsClient) ListByProductsNextResults(lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.GroupCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByProductsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure sending next results request") - } - - result, err = client.ListByProductsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProductGroupsClient is the composite Swagger for ApiManagement Client +type ProductGroupsClient struct { + ManagementClient +} + +// NewProductGroupsClient creates an instance of the ProductGroupsClient +// client. +func NewProductGroupsClient(subscriptionID string) ProductGroupsClient { + return NewProductGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProductGroupsClientWithBaseURI creates an instance of the +// ProductGroupsClient client. +func NewProductGroupsClientWithBaseURI(baseURI string, subscriptionID string) ProductGroupsClient { + return ProductGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create adds the association between the specified developer group with the +// specified product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. groupID is group +// identifier. Must be unique in the current API Management service instance. +func (client ProductGroupsClient) Create(resourceGroupName string, serviceName string, productID string, groupID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductGroupsClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, serviceName, productID, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ProductGroupsClient) CreatePreparer(resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ProductGroupsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ProductGroupsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the association between the specified group and product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. groupID is group +// identifier. Must be unique in the current API Management service instance. +func (client ProductGroupsClient) Delete(resourceGroupName string, serviceName string, productID string, groupID string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: groupID, + Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "groupID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductGroupsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProductGroupsClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProductGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProductGroupsClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProducts lists the collection of developer groups associated with the +// specified product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. filter is | Field +// | Supported operators | Supported functions | +// |-------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | type | eq, ne | N/A +// | top is number of records to return. skip is number of records to skip. +func (client ProductGroupsClient) ListByProducts(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result GroupCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductGroupsClient", "ListByProducts") + } + + req, err := client.ListByProductsPreparer(resourceGroupName, serviceName, productID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProductsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure sending request") + return + } + + result, err = client.ListByProductsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure responding to request") + } + + return +} + +// ListByProductsPreparer prepares the ListByProducts request. +func (client ProductGroupsClient) ListByProductsPreparer(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByProductsSender sends the ListByProducts request. The method will close the +// http.Response Body if it receives an error. +func (client ProductGroupsClient) ListByProductsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByProductsResponder handles the response to the ListByProducts request. The method always +// closes the http.Response Body. +func (client ProductGroupsClient) ListByProductsResponder(resp *http.Response) (result GroupCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProductsNextResults retrieves the next set of results, if any. +func (client ProductGroupsClient) ListByProductsNextResults(lastResults GroupCollection) (result GroupCollection, err error) { + req, err := lastResults.GroupCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByProductsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure sending next results request") + } + + result, err = client.ListByProductsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductGroupsClient", "ListByProducts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productpolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productpolicy.go index 89c64db049..7ed2e8146b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productpolicy.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productpolicy.go @@ -1,290 +1,290 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "io" - "net/http" -) - -// ProductPolicyClient is the composite Swagger for ApiManagement Client -type ProductPolicyClient struct { - ManagementClient -} - -// NewProductPolicyClient creates an instance of the ProductPolicyClient -// client. -func NewProductPolicyClient(subscriptionID string) ProductPolicyClient { - return NewProductPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductPolicyClientWithBaseURI creates an instance of the -// ProductPolicyClient client. -func NewProductPolicyClientWithBaseURI(baseURI string, subscriptionID string) ProductPolicyClient { - return ProductPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates policy configuration for the Product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. parameters is the -// policy contents to apply. parameters will be closed upon successful return. -// Callers should ensure closure when receiving an error.ifMatch is the entity -// state (Etag) version of the product policy to update. A value of "*" can be -// used for If-Match to unconditionally apply the operation. -func (client ProductPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, productID string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, productID string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policy", pathParameters), - autorest.WithFile(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the policy configuration at the Product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. ifMatch is the entity -// state (Etag) version of the product policy to update. A value of "*" can be -// used for If-Match to unconditionally apply the operation. -func (client ProductPolicyClient) Delete(resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductPolicyClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the policy configuration at the Product level. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. -func (client ProductPolicyClient) Get(resourceGroupName string, serviceName string, productID string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductPolicyClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductPolicyClient) GetPreparer(resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProductPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProductPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "io" + "net/http" +) + +// ProductPolicyClient is the composite Swagger for ApiManagement Client +type ProductPolicyClient struct { + ManagementClient +} + +// NewProductPolicyClient creates an instance of the ProductPolicyClient +// client. +func NewProductPolicyClient(subscriptionID string) ProductPolicyClient { + return NewProductPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProductPolicyClientWithBaseURI creates an instance of the +// ProductPolicyClient client. +func NewProductPolicyClientWithBaseURI(baseURI string, subscriptionID string) ProductPolicyClient { + return ProductPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates policy configuration for the Product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. parameters is the +// policy contents to apply. parameters will be closed upon successful return. +// Callers should ensure closure when receiving an error.ifMatch is the entity +// state (Etag) version of the product policy to update. A value of "*" can be +// used for If-Match to unconditionally apply the operation. +func (client ProductPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, productID string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, productID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProductPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, productID string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policy", pathParameters), + autorest.WithFile(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProductPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProductPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the policy configuration at the Product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. ifMatch is the entity +// state (Etag) version of the product policy to update. A value of "*" can be +// used for If-Match to unconditionally apply the operation. +func (client ProductPolicyClient) Delete(resourceGroupName string, serviceName string, productID string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductPolicyClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProductPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProductPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProductPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the policy configuration at the Product level. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. +func (client ProductPolicyClient) Get(resourceGroupName string, serviceName string, productID string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductPolicyClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, productID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductPolicyClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProductPolicyClient) GetPreparer(resourceGroupName string, serviceName string, productID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProductPolicyClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProductPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/products.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/products.go index bd07405c87..4c930436ba 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/products.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/products.go @@ -1,516 +1,516 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProductsClient is the composite Swagger for ApiManagement Client -type ProductsClient struct { - ManagementClient -} - -// NewProductsClient creates an instance of the ProductsClient client. -func NewProductsClient(subscriptionID string) ProductsClient { - return NewProductsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductsClientWithBaseURI creates an instance of the ProductsClient -// client. -func NewProductsClientWithBaseURI(baseURI string, subscriptionID string) ProductsClient { - return ProductsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. parameters is create -// or update parameters. -func (client ProductsClient) CreateOrUpdate(resourceGroupName string, serviceName string, productID string, parameters ProductContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.Description", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Description", Name: validation.MaxLength, Rule: 1000, Chain: nil}, - {Target: "parameters.Description", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, productID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProductsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, productID string, parameters ProductContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProductsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProductsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete delete product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. ifMatch is eTag of -// the Product Entity. ETag should match the current entity state from the -// header response of the GET request or it should be * for unconditional -// update. deleteSubscriptions is delete existing subscriptions to the product -// or not. -func (client ProductsClient) Delete(resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, ifMatch, deleteSubscriptions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProductsClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProductsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProductsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of the product specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. -func (client ProductsClient) Get(resourceGroupName string, serviceName string, productID string) (result ProductContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, productID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProductsClient) GetPreparer(resourceGroupName string, serviceName string, productID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProductsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProductsClient) GetResponder(resp *http.Response) (result ProductContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of products in the specified service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators -// | Supported functions | -// |-------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | terms | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | state | eq | -// | top is number of records to return. skip is number of records to skip. -// expandGroups is when set to true, the response contains an array of groups -// that have visibility to the product. The default is false. -func (client ProductsClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result ProductCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip, expandGroups) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ProductsClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if expandGroups != nil { - queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ProductsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ProductsClient) ListByServiceResponder(resp *http.Response) (result ProductCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client ProductsClient) ListByServiceNextResults(lastResults ProductCollection) (result ProductCollection, err error) { - req, err := lastResults.ProductCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update update product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. parameters is update -// parameters. ifMatch is eTag of the Product Entity. ETag should match the -// current entity state from the header response of the GET request or it -// should be * for unconditional update. -func (client ProductsClient) Update(resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, productID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProductsClient) UpdatePreparer(resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ProductsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ProductsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProductsClient is the composite Swagger for ApiManagement Client +type ProductsClient struct { + ManagementClient +} + +// NewProductsClient creates an instance of the ProductsClient client. +func NewProductsClient(subscriptionID string) ProductsClient { + return NewProductsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProductsClientWithBaseURI creates an instance of the ProductsClient +// client. +func NewProductsClientWithBaseURI(baseURI string, subscriptionID string) ProductsClient { + return ProductsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. parameters is create +// or update parameters. +func (client ProductsClient) CreateOrUpdate(resourceGroupName string, serviceName string, productID string, parameters ProductContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 300, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.Description", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Description", Name: validation.MaxLength, Rule: 1000, Chain: nil}, + {Target: "parameters.Description", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, productID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProductsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, productID string, parameters ProductContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProductsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete delete product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. ifMatch is eTag of +// the Product Entity. ETag should match the current entity state from the +// header response of the GET request or it should be * for unconditional +// update. deleteSubscriptions is delete existing subscriptions to the product +// or not. +func (client ProductsClient) Delete(resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, productID, ifMatch, deleteSubscriptions) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProductsClient) DeletePreparer(resourceGroupName string, serviceName string, productID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteSubscriptions != nil { + queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProductsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of the product specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. +func (client ProductsClient) Get(resourceGroupName string, serviceName string, productID string) (result ProductContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, productID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProductsClient) GetPreparer(resourceGroupName string, serviceName string, productID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProductsClient) GetResponder(resp *http.Response) (result ProductContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of products in the specified service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators +// | Supported functions | +// |-------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | terms | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | state | eq | +// | top is number of records to return. skip is number of records to skip. +// expandGroups is when set to true, the response contains an array of groups +// that have visibility to the product. The default is false. +func (client ProductsClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (result ProductCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip, expandGroups) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client ProductsClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32, expandGroups *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if expandGroups != nil { + queryParameters["expandGroups"] = autorest.Encode("query", *expandGroups) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client ProductsClient) ListByServiceResponder(resp *http.Response) (result ProductCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client ProductsClient) ListByServiceNextResults(lastResults ProductCollection) (result ProductCollection, err error) { + req, err := lastResults.ProductCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update update product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. parameters is update +// parameters. ifMatch is eTag of the Product Entity. ETag should match the +// current entity state from the header response of the GET request or it +// should be * for unconditional update. +func (client ProductsClient) Update(resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, productID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProductsClient) UpdatePreparer(resourceGroupName string, serviceName string, productID string, parameters ProductUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProductsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productsubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productsubscriptions.go index a5f7c8ec79..51ee3d6cd3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productsubscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/productsubscriptions.go @@ -1,177 +1,177 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProductSubscriptionsClient is the composite Swagger for ApiManagement Client -type ProductSubscriptionsClient struct { - ManagementClient -} - -// NewProductSubscriptionsClient creates an instance of the -// ProductSubscriptionsClient client. -func NewProductSubscriptionsClient(subscriptionID string) ProductSubscriptionsClient { - return NewProductSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductSubscriptionsClientWithBaseURI creates an instance of the -// ProductSubscriptionsClient client. -func NewProductSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductSubscriptionsClient { - return ProductSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByProducts lists the collection of subscriptions to the specified -// product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. productID is product identifier. Must be -// unique in the current API Management service instance. filter is | Field -// | Supported operators | Supported functions | -// |--------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | state | eq | -// | top is number of records to return. skip is number of records to skip. -func (client ProductSubscriptionsClient) ListByProducts(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: productID, - Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts") - } - - req, err := client.ListByProductsPreparer(resourceGroupName, serviceName, productID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProductsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure sending request") - return - } - - result, err = client.ListByProductsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure responding to request") - } - - return -} - -// ListByProductsPreparer prepares the ListByProducts request. -func (client ProductSubscriptionsClient) ListByProductsPreparer(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "productId": autorest.Encode("path", productID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByProductsSender sends the ListByProducts request. The method will close the -// http.Response Body if it receives an error. -func (client ProductSubscriptionsClient) ListByProductsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByProductsResponder handles the response to the ListByProducts request. The method always -// closes the http.Response Body. -func (client ProductSubscriptionsClient) ListByProductsResponder(resp *http.Response) (result SubscriptionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProductsNextResults retrieves the next set of results, if any. -func (client ProductSubscriptionsClient) ListByProductsNextResults(lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.SubscriptionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByProductsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure sending next results request") - } - - result, err = client.ListByProductsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProductSubscriptionsClient is the composite Swagger for ApiManagement Client +type ProductSubscriptionsClient struct { + ManagementClient +} + +// NewProductSubscriptionsClient creates an instance of the +// ProductSubscriptionsClient client. +func NewProductSubscriptionsClient(subscriptionID string) ProductSubscriptionsClient { + return NewProductSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProductSubscriptionsClientWithBaseURI creates an instance of the +// ProductSubscriptionsClient client. +func NewProductSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductSubscriptionsClient { + return ProductSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByProducts lists the collection of subscriptions to the specified +// product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. productID is product identifier. Must be +// unique in the current API Management service instance. filter is | Field +// | Supported operators | Supported functions | +// |--------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | state | eq | +// | top is number of records to return. skip is number of records to skip. +func (client ProductSubscriptionsClient) ListByProducts(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (result SubscriptionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: productID, + Constraints: []validation.Constraint{{Target: "productID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "productID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "productID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts") + } + + req, err := client.ListByProductsPreparer(resourceGroupName, serviceName, productID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProductsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure sending request") + return + } + + result, err = client.ListByProductsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure responding to request") + } + + return +} + +// ListByProductsPreparer prepares the ListByProducts request. +func (client ProductSubscriptionsClient) ListByProductsPreparer(resourceGroupName string, serviceName string, productID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "productId": autorest.Encode("path", productID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByProductsSender sends the ListByProducts request. The method will close the +// http.Response Body if it receives an error. +func (client ProductSubscriptionsClient) ListByProductsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByProductsResponder handles the response to the ListByProducts request. The method always +// closes the http.Response Body. +func (client ProductSubscriptionsClient) ListByProductsResponder(resp *http.Response) (result SubscriptionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProductsNextResults retrieves the next set of results, if any. +func (client ProductSubscriptionsClient) ListByProductsNextResults(lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { + req, err := lastResults.SubscriptionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByProductsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure sending next results request") + } + + result, err = client.ListByProductsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ProductSubscriptionsClient", "ListByProducts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/properties.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/properties.go index c00dc79429..10d6f1efd5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/properties.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/properties.go @@ -1,163 +1,163 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PropertiesClient is the composite Swagger for ApiManagement Client -type PropertiesClient struct { - ManagementClient -} - -// NewPropertiesClient creates an instance of the PropertiesClient client. -func NewPropertiesClient(subscriptionID string) PropertiesClient { - return NewPropertiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPropertiesClientWithBaseURI creates an instance of the PropertiesClient -// client. -func NewPropertiesClientWithBaseURI(baseURI string, subscriptionID string) PropertiesClient { - return PropertiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of properties defined within a service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported operators | -// Supported functions | -// |-------|------------------------|-------------------------------------------------------| -// | tags | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith, any, all | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of -// records to skip. -func (client PropertiesClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result PropertyCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertiesClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client PropertiesClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client PropertiesClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client PropertiesClient) ListByServiceResponder(resp *http.Response) (result PropertyCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client PropertiesClient) ListByServiceNextResults(lastResults PropertyCollection) (result PropertyCollection, err error) { - req, err := lastResults.PropertyCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PropertiesClient is the composite Swagger for ApiManagement Client +type PropertiesClient struct { + ManagementClient +} + +// NewPropertiesClient creates an instance of the PropertiesClient client. +func NewPropertiesClient(subscriptionID string) PropertiesClient { + return NewPropertiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPropertiesClientWithBaseURI creates an instance of the PropertiesClient +// client. +func NewPropertiesClientWithBaseURI(baseURI string, subscriptionID string) PropertiesClient { + return PropertiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByService lists a collection of properties defined within a service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported operators | +// Supported functions | +// |-------|------------------------|-------------------------------------------------------| +// | tags | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith, any, all | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of +// records to skip. +func (client PropertiesClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result PropertyCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertiesClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client PropertiesClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client PropertiesClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client PropertiesClient) ListByServiceResponder(resp *http.Response) (result PropertyCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client PropertiesClient) ListByServiceNextResults(lastResults PropertyCollection) (result PropertyCollection, err error) { + req, err := lastResults.PropertyCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertiesClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/property.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/property.go index c257c5f40c..b39dc58190 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/property.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/property.go @@ -1,377 +1,377 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PropertyClient is the composite Swagger for ApiManagement Client -type PropertyClient struct { - ManagementClient -} - -// NewPropertyClient creates an instance of the PropertyClient client. -func NewPropertyClient(subscriptionID string) PropertyClient { - return NewPropertyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPropertyClientWithBaseURI creates an instance of the PropertyClient -// client. -func NewPropertyClientWithBaseURI(baseURI string, subscriptionID string) PropertyClient { - return PropertyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a property. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. propID is identifier of the property. -// parameters is create parameters. -func (client PropertyClient) CreateOrUpdate(resourceGroupName string, serviceName string, propID string, parameters PropertyCreateParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "parameters.Name", Name: validation.Pattern, Rule: `^[A-Z0-9-._]+$`, Chain: nil}, - }}, - {Target: "parameters.Value", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Value", Name: validation.MaxLength, Rule: 4096, Chain: nil}, - {Target: "parameters.Value", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.Tags", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Tags", Name: validation.MaxItems, Rule: 32, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, propID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PropertyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, propID string, parameters PropertyCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PropertyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes specific property from the the API Management service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. propID is identifier of the property. ifMatch -// is the entity state (Etag) version of the property to delete. A value of "*" -// can be used for If-Match to unconditionally apply the operation. -func (client PropertyClient) Delete(resourceGroupName string, serviceName string, propID string, ifMatch string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, propID, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PropertyClient) DeletePreparer(resourceGroupName string, serviceName string, propID string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PropertyClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the property specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. propID is identifier of the property. -func (client PropertyClient) Get(resourceGroupName string, serviceName string, propID string) (result PropertyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, propID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PropertyClient) GetPreparer(resourceGroupName string, serviceName string, propID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PropertyClient) GetResponder(resp *http.Response) (result PropertyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the specific property. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. propID is identifier of the property. -// parameters is update parameters. ifMatch is the entity state (Etag) version -// of the property to update. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client PropertyClient) Update(resourceGroupName string, serviceName string, propID string, parameters PropertyUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: propID, - Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, propID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PropertyClient) UpdatePreparer(resourceGroupName string, serviceName string, propID string, parameters PropertyUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "propId": autorest.Encode("path", propID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PropertyClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PropertyClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PropertyClient is the composite Swagger for ApiManagement Client +type PropertyClient struct { + ManagementClient +} + +// NewPropertyClient creates an instance of the PropertyClient client. +func NewPropertyClient(subscriptionID string) PropertyClient { + return NewPropertyClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPropertyClientWithBaseURI creates an instance of the PropertyClient +// client. +func NewPropertyClientWithBaseURI(baseURI string, subscriptionID string) PropertyClient { + return PropertyClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a property. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. propID is identifier of the property. +// parameters is create parameters. +func (client PropertyClient) CreateOrUpdate(resourceGroupName string, serviceName string, propID string, parameters PropertyCreateParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: propID, + Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "parameters.Name", Name: validation.Pattern, Rule: `^[A-Z0-9-._]+$`, Chain: nil}, + }}, + {Target: "parameters.Value", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Value", Name: validation.MaxLength, Rule: 4096, Chain: nil}, + {Target: "parameters.Value", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.Tags", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Tags", Name: validation.MaxItems, Rule: 32, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, propID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PropertyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, propID string, parameters PropertyCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "propId": autorest.Encode("path", propID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PropertyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PropertyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes specific property from the the API Management service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. propID is identifier of the property. ifMatch +// is the entity state (Etag) version of the property to delete. A value of "*" +// can be used for If-Match to unconditionally apply the operation. +func (client PropertyClient) Delete(resourceGroupName string, serviceName string, propID string, ifMatch string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: propID, + Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, propID, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PropertyClient) DeletePreparer(resourceGroupName string, serviceName string, propID string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "propId": autorest.Encode("path", propID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PropertyClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PropertyClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the details of the property specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. propID is identifier of the property. +func (client PropertyClient) Get(resourceGroupName string, serviceName string, propID string) (result PropertyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: propID, + Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, propID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PropertyClient) GetPreparer(resourceGroupName string, serviceName string, propID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "propId": autorest.Encode("path", propID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PropertyClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PropertyClient) GetResponder(resp *http.Response) (result PropertyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the specific property. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. propID is identifier of the property. +// parameters is update parameters. ifMatch is the entity state (Etag) version +// of the property to update. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client PropertyClient) Update(resourceGroupName string, serviceName string, propID string, parameters PropertyUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: propID, + Constraints: []validation.Constraint{{Target: "propID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "propID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.PropertyClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, propID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.PropertyClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PropertyClient) UpdatePreparer(resourceGroupName string, serviceName string, propID string, parameters PropertyUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "propId": autorest.Encode("path", propID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/properties/{propId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PropertyClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PropertyClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabycounterkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabycounterkeys.go index 443596373a..f6f16c9037 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabycounterkeys.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabycounterkeys.go @@ -1,201 +1,201 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// QuotaByCounterKeysClient is the composite Swagger for ApiManagement Client -type QuotaByCounterKeysClient struct { - ManagementClient -} - -// NewQuotaByCounterKeysClient creates an instance of the -// QuotaByCounterKeysClient client. -func NewQuotaByCounterKeysClient(subscriptionID string) QuotaByCounterKeysClient { - return NewQuotaByCounterKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByCounterKeysClientWithBaseURI creates an instance of the -// QuotaByCounterKeysClient client. -func NewQuotaByCounterKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByCounterKeysClient { - return QuotaByCounterKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists a collection of current quota counter periods associated -// with the counter-key configured in the policy on the specified service -// instance. The api does not support paging yet. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. quotaCounterKey is quota counter key -// identifier. -func (client QuotaByCounterKeysClient) ListByService(resourceGroupName string, serviceName string, quotaCounterKey string) (result QuotaCounterCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, quotaCounterKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client QuotaByCounterKeysClient) ListByServicePreparer(resourceGroupName string, serviceName string, quotaCounterKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByCounterKeysClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client QuotaByCounterKeysClient) ListByServiceResponder(resp *http.Response) (result QuotaCounterCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates all the quota counter values specified with the existing -// quota counter key to a value in the specified service instance. This should -// be used for reset of the quota counter values. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. quotaCounterKey is quota counter key -// identifier. parameters is the value of the quota counter to be applied to -// all quota counter periods. -func (client QuotaByCounterKeysClient) Update(resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByCounterKeysClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, quotaCounterKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByCounterKeysClient) UpdatePreparer(resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByCounterKeysClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client QuotaByCounterKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// QuotaByCounterKeysClient is the composite Swagger for ApiManagement Client +type QuotaByCounterKeysClient struct { + ManagementClient +} + +// NewQuotaByCounterKeysClient creates an instance of the +// QuotaByCounterKeysClient client. +func NewQuotaByCounterKeysClient(subscriptionID string) QuotaByCounterKeysClient { + return NewQuotaByCounterKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQuotaByCounterKeysClientWithBaseURI creates an instance of the +// QuotaByCounterKeysClient client. +func NewQuotaByCounterKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByCounterKeysClient { + return QuotaByCounterKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByService lists a collection of current quota counter periods associated +// with the counter-key configured in the policy on the specified service +// instance. The api does not support paging yet. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. quotaCounterKey is quota counter key +// identifier. +func (client QuotaByCounterKeysClient) ListByService(resourceGroupName string, serviceName string, quotaCounterKey string) (result QuotaCounterCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, quotaCounterKey) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client QuotaByCounterKeysClient) ListByServicePreparer(resourceGroupName string, serviceName string, quotaCounterKey string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "quotaCounterKey": autorest.Encode("path", quotaCounterKey), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaByCounterKeysClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client QuotaByCounterKeysClient) ListByServiceResponder(resp *http.Response) (result QuotaCounterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates all the quota counter values specified with the existing +// quota counter key to a value in the specified service instance. This should +// be used for reset of the quota counter values. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. quotaCounterKey is quota counter key +// identifier. parameters is the value of the quota counter to be applied to +// all quota counter periods. +func (client QuotaByCounterKeysClient) Update(resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByCounterKeysClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, quotaCounterKey, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByCounterKeysClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client QuotaByCounterKeysClient) UpdatePreparer(resourceGroupName string, serviceName string, quotaCounterKey string, parameters QuotaCounterValueContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "quotaCounterKey": autorest.Encode("path", quotaCounterKey), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaByCounterKeysClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client QuotaByCounterKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabyperiodkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabyperiodkeys.go index e45daefbae..20da7fe1fa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabyperiodkeys.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/quotabyperiodkeys.go @@ -1,201 +1,201 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// QuotaByPeriodKeysClient is the composite Swagger for ApiManagement Client -type QuotaByPeriodKeysClient struct { - ManagementClient -} - -// NewQuotaByPeriodKeysClient creates an instance of the -// QuotaByPeriodKeysClient client. -func NewQuotaByPeriodKeysClient(subscriptionID string) QuotaByPeriodKeysClient { - return NewQuotaByPeriodKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQuotaByPeriodKeysClientWithBaseURI creates an instance of the -// QuotaByPeriodKeysClient client. -func NewQuotaByPeriodKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByPeriodKeysClient { - return QuotaByPeriodKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the value of the quota counter associated with the counter-key in -// the policy for the specific period in service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. quotaCounterKey is quota counter key -// identifier. quotaPeriodKey is quota period key identifier. -func (client QuotaByPeriodKeysClient) Get(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result QuotaCounterContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByPeriodKeysClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client QuotaByPeriodKeysClient) GetPreparer(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/{quotaPeriodKey}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByPeriodKeysClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QuotaByPeriodKeysClient) GetResponder(resp *http.Response) (result QuotaCounterContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing quota counter value in the specified service -// instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. quotaCounterKey is quota counter key -// identifier. quotaPeriodKey is quota period key identifier. parameters is the -// value of the Quota counter to be applied on the specified period. -func (client QuotaByPeriodKeysClient) Update(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContract) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByPeriodKeysClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QuotaByPeriodKeysClient) UpdatePreparer(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContract) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "quotaCounterKey": autorest.Encode("path", quotaCounterKey), - "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/{quotaPeriodKey}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client QuotaByPeriodKeysClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client QuotaByPeriodKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// QuotaByPeriodKeysClient is the composite Swagger for ApiManagement Client +type QuotaByPeriodKeysClient struct { + ManagementClient +} + +// NewQuotaByPeriodKeysClient creates an instance of the +// QuotaByPeriodKeysClient client. +func NewQuotaByPeriodKeysClient(subscriptionID string) QuotaByPeriodKeysClient { + return NewQuotaByPeriodKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQuotaByPeriodKeysClientWithBaseURI creates an instance of the +// QuotaByPeriodKeysClient client. +func NewQuotaByPeriodKeysClientWithBaseURI(baseURI string, subscriptionID string) QuotaByPeriodKeysClient { + return QuotaByPeriodKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the value of the quota counter associated with the counter-key in +// the policy for the specific period in service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. quotaCounterKey is quota counter key +// identifier. quotaPeriodKey is quota period key identifier. +func (client QuotaByPeriodKeysClient) Get(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (result QuotaCounterContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByPeriodKeysClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client QuotaByPeriodKeysClient) GetPreparer(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "quotaCounterKey": autorest.Encode("path", quotaCounterKey), + "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/{quotaPeriodKey}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaByPeriodKeysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client QuotaByPeriodKeysClient) GetResponder(resp *http.Response) (result QuotaCounterContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing quota counter value in the specified service +// instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. quotaCounterKey is quota counter key +// identifier. quotaPeriodKey is quota period key identifier. parameters is the +// value of the Quota counter to be applied on the specified period. +func (client QuotaByPeriodKeysClient) Update(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContract) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.QuotaByPeriodKeysClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.QuotaByPeriodKeysClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client QuotaByPeriodKeysClient) UpdatePreparer(resourceGroupName string, serviceName string, quotaCounterKey string, quotaPeriodKey string, parameters QuotaCounterValueContract) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "quotaCounterKey": autorest.Encode("path", quotaCounterKey), + "quotaPeriodKey": autorest.Encode("path", quotaPeriodKey), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/{quotaPeriodKey}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaByPeriodKeysClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client QuotaByPeriodKeysClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/regions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/regions.go index 97e52624ea..abc3227f09 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/regions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/regions.go @@ -1,115 +1,115 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RegionsClient is the composite Swagger for ApiManagement Client -type RegionsClient struct { - ManagementClient -} - -// NewRegionsClient creates an instance of the RegionsClient client. -func NewRegionsClient(subscriptionID string) RegionsClient { - return NewRegionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegionsClientWithBaseURI creates an instance of the RegionsClient client. -func NewRegionsClientWithBaseURI(baseURI string, subscriptionID string) RegionsClient { - return RegionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists all azure regions in which the service exists. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client RegionsClient) ListByService(resourceGroupName string, serviceName string) (result RegionListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.RegionsClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.RegionsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.RegionsClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client RegionsClient) ListByServicePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client RegionsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client RegionsClient) ListByServiceResponder(resp *http.Response) (result RegionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RegionsClient is the composite Swagger for ApiManagement Client +type RegionsClient struct { + ManagementClient +} + +// NewRegionsClient creates an instance of the RegionsClient client. +func NewRegionsClient(subscriptionID string) RegionsClient { + return NewRegionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRegionsClientWithBaseURI creates an instance of the RegionsClient client. +func NewRegionsClientWithBaseURI(baseURI string, subscriptionID string) RegionsClient { + return RegionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByService lists all azure regions in which the service exists. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client RegionsClient) ListByService(resourceGroupName string, serviceName string) (result RegionListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.RegionsClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.RegionsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.RegionsClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.RegionsClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client RegionsClient) ListByServicePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client RegionsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client RegionsClient) ListByServiceResponder(resp *http.Response) (result RegionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/reports.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/reports.go index 3211b97221..83b12cb6f4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/reports.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/reports.go @@ -1,165 +1,165 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ReportsClient is the composite Swagger for ApiManagement Client -type ReportsClient struct { - ManagementClient -} - -// NewReportsClient creates an instance of the ReportsClient client. -func NewReportsClient(subscriptionID string) ReportsClient { - return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReportsClientWithBaseURI creates an instance of the ReportsClient client. -func NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { - return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByService lists report records. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. aggregation is report aggregation. filter is -// the filter to apply on the operation. top is number of records to return. -// skip is number of records to skip. interval is by time interval. This value -// is only applicable to ByTime aggregation. Interval must be multiple of 15 -// minutes and may not be zero. The value should be in ISO 8601 format -// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to -// convert TimSpan to a valid interval string: XmlConvert.ToString(new -// TimeSpan(hours, minutes, secconds)) -func (client ReportsClient) ListByService(resourceGroupName string, serviceName string, aggregation ReportsAggregation, filter string, top *int32, skip *int32, interval *string) (result ReportCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ReportsClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, aggregation, filter, top, skip, interval) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client ReportsClient) ListByServicePreparer(resourceGroupName string, serviceName string, aggregation ReportsAggregation, filter string, top *int32, skip *int32, interval *string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "aggregation": autorest.Encode("path", aggregation), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if interval != nil { - queryParameters["interval"] = autorest.Encode("query", *interval) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/{aggregation}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client ReportsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client ReportsClient) ListByServiceResponder(resp *http.Response) (result ReportCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client ReportsClient) ListByServiceNextResults(lastResults ReportCollection) (result ReportCollection, err error) { - req, err := lastResults.ReportCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ReportsClient is the composite Swagger for ApiManagement Client +type ReportsClient struct { + ManagementClient +} + +// NewReportsClient creates an instance of the ReportsClient client. +func NewReportsClient(subscriptionID string) ReportsClient { + return NewReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewReportsClientWithBaseURI creates an instance of the ReportsClient client. +func NewReportsClientWithBaseURI(baseURI string, subscriptionID string) ReportsClient { + return ReportsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByService lists report records. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. aggregation is report aggregation. filter is +// the filter to apply on the operation. top is number of records to return. +// skip is number of records to skip. interval is by time interval. This value +// is only applicable to ByTime aggregation. Interval must be multiple of 15 +// minutes and may not be zero. The value should be in ISO 8601 format +// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to +// convert TimSpan to a valid interval string: XmlConvert.ToString(new +// TimeSpan(hours, minutes, secconds)) +func (client ReportsClient) ListByService(resourceGroupName string, serviceName string, aggregation ReportsAggregation, filter string, top *int32, skip *int32, interval *string) (result ReportCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ReportsClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, aggregation, filter, top, skip, interval) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client ReportsClient) ListByServicePreparer(resourceGroupName string, serviceName string, aggregation ReportsAggregation, filter string, top *int32, skip *int32, interval *string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "aggregation": autorest.Encode("path", aggregation), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/{aggregation}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client ReportsClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client ReportsClient) ListByServiceResponder(resp *http.Response) (result ReportCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client ReportsClient) ListByServiceNextResults(lastResults ReportCollection) (result ReportCollection, err error) { + req, err := lastResults.ReportCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ReportsClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/services.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/services.go index 0d04dffdf4..7a396f2630 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/services.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/services.go @@ -1,1278 +1,1278 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ServicesClient is the composite Swagger for ApiManagement Client -type ServicesClient struct { - ManagementClient -} - -// NewServicesClient creates an instance of the ServicesClient client. -func NewServicesClient(subscriptionID string) ServicesClient { - return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServicesClientWithBaseURI creates an instance of the ServicesClient -// client. -func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { - return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ApplyNetworkConfigurationUpdates updates the Microsoft.ApiManagement -// resource running in the Virtual network to pick the updated network -// settings. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client ServicesClient) ApplyNetworkConfigurationUpdates(resourceGroupName string, serviceName string, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { - resultChan := make(chan ServiceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ServiceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ApplyNetworkConfigurationUpdatesPreparer(resourceGroupName, serviceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") - return - } - - resp, err := client.ApplyNetworkConfigurationUpdatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates", resp, "Failure sending request") - return - } - - result, err = client.ApplyNetworkConfigurationUpdatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ApplyNetworkConfigurationUpdatesPreparer prepares the ApplyNetworkConfigurationUpdates request. -func (client ServicesClient) ApplyNetworkConfigurationUpdatesPreparer(resourceGroupName string, serviceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ApplyNetworkConfigurationUpdatesSender sends the ApplyNetworkConfigurationUpdates request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ApplyNetworkConfigurationUpdatesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ApplyNetworkConfigurationUpdatesResponder handles the response to the ApplyNetworkConfigurationUpdates request. The method always -// closes the http.Response Body. -func (client ServicesClient) ApplyNetworkConfigurationUpdatesResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Backup creates a backup of the API Management service to the given Azure -// Storage Account. This is long running operation and could take several -// minutes to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// ApiManagementServices_Backup operation. -func (client ServicesClient) Backup(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { - resultChan := make(chan ServiceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Backup") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ServiceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.BackupPreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Backup", nil, "Failure preparing request") - return - } - - resp, err := client.BackupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Backup", resp, "Failure sending request") - return - } - - result, err = client.BackupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Backup", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// BackupPreparer prepares the Backup request. -func (client ServicesClient) BackupPreparer(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// BackupSender sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) BackupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// BackupResponder handles the response to the Backup request. The method always -// closes the http.Response Body. -func (client ServicesClient) BackupResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability checks availability and correctness of a name for an -// API Management service. -// -// parameters is parameters supplied to the CheckNameAvailability operation. -func (client ServicesClient) CheckNameAvailability(parameters ServiceCheckNameAvailabilityParameters) (result ServiceNameAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServicesClient) CheckNameAvailabilityPreparer(parameters ServiceCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result ServiceNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates an API Management service. This is long -// running operation and could take several minutes to complete. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// CreateOrUpdate API Management service operation. -func (client ServicesClient) CreateOrUpdate(resourceGroupName string, serviceName string, parameters ServiceResource) (result ServiceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, - {Target: "parameters.ServiceProperties.PublisherName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ServiceProperties.Vpnconfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.Vpnconfiguration.SubnetResourceID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.Vpnconfiguration.SubnetResourceID", Name: validation.Pattern, Rule: `^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$`, Chain: nil}}}, - }}, - }}, - {Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServicesClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, parameters ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing API Management service. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client ServicesClient) Delete(resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicesClient) DeletePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an API Management service resource description. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client ServicesClient) Get(resourceGroupName string, serviceName string) (result ServiceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicesClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSsoToken gets the Single-Sign-On token for the API Management Service -// which is valid for 5 Minutes. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client ServicesClient) GetSsoToken(resourceGroupName string, serviceName string) (result ServiceGetSsoTokenResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "GetSsoToken") - } - - req, err := client.GetSsoTokenPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "GetSsoToken", nil, "Failure preparing request") - return - } - - resp, err := client.GetSsoTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "GetSsoToken", resp, "Failure sending request") - return - } - - result, err = client.GetSsoTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "GetSsoToken", resp, "Failure responding to request") - } - - return -} - -// GetSsoTokenPreparer prepares the GetSsoToken request. -func (client ServicesClient) GetSsoTokenPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSsoTokenSender sends the GetSsoToken request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (client ServicesClient) GetSsoTokenResponder(resp *http.Response) (result ServiceGetSsoTokenResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all API Management services within an Azure subscription. -func (client ServicesClient) List() (result ServiceListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ServicesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ServicesClient) ListNextResults(lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.ServiceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup list all API Management services within a resource -// group. -// -// resourceGroupName is the name of the resource group. -func (client ServicesClient) ListByResourceGroup(resourceGroupName string) (result ServiceListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServicesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ServicesClient) ListByResourceGroupNextResults(lastResults ServiceListResult) (result ServiceListResult, err error) { - req, err := lastResults.ServiceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ManageDeployments manages deployments of an API Management service. This -// operation can be used to do the following: Change SKU, Change SKU Units, -// Change Service Tier (Developer/Standard/Premium) and Manage VPN -// Configuration. This is a long running operation and can take several minutes -// to complete. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// ManageDeployments operation. -func (client ServicesClient) ManageDeployments(resourceGroupName string, serviceName string, parameters ServiceManageDeploymentsParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { - resultChan := make(chan ServiceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VpnConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VpnConfiguration.SubnetResourceID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VpnConfiguration.SubnetResourceID", Name: validation.Pattern, Rule: `^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$`, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "ManageDeployments") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ServiceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ManageDeploymentsPreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ManageDeployments", nil, "Failure preparing request") - return - } - - resp, err := client.ManageDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ManageDeployments", resp, "Failure sending request") - return - } - - result, err = client.ManageDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ManageDeployments", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ManageDeploymentsPreparer prepares the ManageDeployments request. -func (client ServicesClient) ManageDeploymentsPreparer(resourceGroupName string, serviceName string, parameters ServiceManageDeploymentsParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/managedeployments", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ManageDeploymentsSender sends the ManageDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ManageDeploymentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ManageDeploymentsResponder handles the response to the ManageDeployments request. The method always -// closes the http.Response Body. -func (client ServicesClient) ManageDeploymentsResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restore restores a backup of an API Management service created using the -// ApiManagementServices_Backup operation on the current service. This is a -// long running operation and could take several minutes to complete. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// Restore API Management service from backup operation. -func (client ServicesClient) Restore(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { - resultChan := make(chan ServiceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Restore") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ServiceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RestorePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Restore", nil, "Failure preparing request") - return - } - - resp, err := client.RestoreSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Restore", resp, "Failure sending request") - return - } - - result, err = client.RestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Restore", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RestorePreparer prepares the Restore request. -func (client ServicesClient) RestorePreparer(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) RestoreSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client ServicesClient) RestoreResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing API Management service. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// CreateOrUpdate API Management service operation. -func (client ServicesClient) Update(resourceGroupName string, serviceName string, parameters ServiceUpdateParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { - resultChan := make(chan ServiceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Update") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ServiceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client ServicesClient) UpdatePreparer(resourceGroupName string, serviceName string, parameters ServiceUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateHostname creates, updates, or deletes the custom hostnames for an API -// Management service. The custom hostname can be applied to the Proxy and -// Portal endpoint. This is a long running operation and could take several -// minutes to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// UpdateHostname operation. -func (client ServicesClient) UpdateHostname(resourceGroupName string, serviceName string, parameters ServiceUpdateHostnameParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { - resultChan := make(chan ServiceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "UpdateHostname") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ServiceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdateHostnamePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UpdateHostname", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateHostnameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UpdateHostname", resp, "Failure sending request") - return - } - - result, err = client.UpdateHostnameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UpdateHostname", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdateHostnamePreparer prepares the UpdateHostname request. -func (client ServicesClient) UpdateHostnamePreparer(resourceGroupName string, serviceName string, parameters ServiceUpdateHostnameParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/updatehostname", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateHostnameSender sends the UpdateHostname request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) UpdateHostnameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateHostnameResponder handles the response to the UpdateHostname request. The method always -// closes the http.Response Body. -func (client ServicesClient) UpdateHostnameResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UploadCertificate upload Custom Domain SSL certificate for an API Management -// service. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// Upload SSL certificate for an API Management service operation. -func (client ServicesClient) UploadCertificate(resourceGroupName string, serviceName string, parameters ServiceUploadCertificateParameters) (result CertificateInformation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Certificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificatePassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "UploadCertificate") - } - - req, err := client.UploadCertificatePreparer(resourceGroupName, serviceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UploadCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.UploadCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UploadCertificate", resp, "Failure sending request") - return - } - - result, err = client.UploadCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UploadCertificate", resp, "Failure responding to request") - } - - return -} - -// UploadCertificatePreparer prepares the UploadCertificate request. -func (client ServicesClient) UploadCertificatePreparer(resourceGroupName string, serviceName string, parameters ServiceUploadCertificateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/uploadcertificate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UploadCertificateSender sends the UploadCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) UploadCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UploadCertificateResponder handles the response to the UploadCertificate request. The method always -// closes the http.Response Body. -func (client ServicesClient) UploadCertificateResponder(resp *http.Response) (result CertificateInformation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ServicesClient is the composite Swagger for ApiManagement Client +type ServicesClient struct { + ManagementClient +} + +// NewServicesClient creates an instance of the ServicesClient client. +func NewServicesClient(subscriptionID string) ServicesClient { + return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicesClientWithBaseURI creates an instance of the ServicesClient +// client. +func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { + return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ApplyNetworkConfigurationUpdates updates the Microsoft.ApiManagement +// resource running in the Virtual network to pick the updated network +// settings. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client ServicesClient) ApplyNetworkConfigurationUpdates(resourceGroupName string, serviceName string, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { + resultChan := make(chan ServiceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ServiceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ApplyNetworkConfigurationUpdatesPreparer(resourceGroupName, serviceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates", nil, "Failure preparing request") + return + } + + resp, err := client.ApplyNetworkConfigurationUpdatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates", resp, "Failure sending request") + return + } + + result, err = client.ApplyNetworkConfigurationUpdatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ApplyNetworkConfigurationUpdates", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ApplyNetworkConfigurationUpdatesPreparer prepares the ApplyNetworkConfigurationUpdates request. +func (client ServicesClient) ApplyNetworkConfigurationUpdatesPreparer(resourceGroupName string, serviceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ApplyNetworkConfigurationUpdatesSender sends the ApplyNetworkConfigurationUpdates request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ApplyNetworkConfigurationUpdatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ApplyNetworkConfigurationUpdatesResponder handles the response to the ApplyNetworkConfigurationUpdates request. The method always +// closes the http.Response Body. +func (client ServicesClient) ApplyNetworkConfigurationUpdatesResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Backup creates a backup of the API Management service to the given Azure +// Storage Account. This is long running operation and could take several +// minutes to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// ApiManagementServices_Backup operation. +func (client ServicesClient) Backup(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { + resultChan := make(chan ServiceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Backup") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ServiceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.BackupPreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Backup", nil, "Failure preparing request") + return + } + + resp, err := client.BackupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Backup", resp, "Failure sending request") + return + } + + result, err = client.BackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Backup", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// BackupPreparer prepares the Backup request. +func (client ServicesClient) BackupPreparer(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// BackupSender sends the Backup request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) BackupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// BackupResponder handles the response to the Backup request. The method always +// closes the http.Response Body. +func (client ServicesClient) BackupResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability checks availability and correctness of a name for an +// API Management service. +// +// parameters is parameters supplied to the CheckNameAvailability operation. +func (client ServicesClient) CheckNameAvailability(parameters ServiceCheckNameAvailabilityParameters) (result ServiceNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ServicesClient) CheckNameAvailabilityPreparer(parameters ServiceCheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result ServiceNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates an API Management service. This is long +// running operation and could take several minutes to complete. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// CreateOrUpdate API Management service operation. +func (client ServicesClient) CreateOrUpdate(resourceGroupName string, serviceName string, parameters ServiceResource) (result ServiceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.PublisherEmail", Name: validation.MaxLength, Rule: 100, Chain: nil}}}, + {Target: "parameters.ServiceProperties.PublisherName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ServiceProperties.Vpnconfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.Vpnconfiguration.SubnetResourceID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.Vpnconfiguration.SubnetResourceID", Name: validation.Pattern, Rule: `^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$`, Chain: nil}}}, + }}, + }}, + {Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServicesClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, parameters ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing API Management service. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client ServicesClient) Delete(resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicesClient) DeletePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an API Management service resource description. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client ServicesClient) Get(resourceGroupName string, serviceName string) (result ServiceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicesClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSsoToken gets the Single-Sign-On token for the API Management Service +// which is valid for 5 Minutes. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client ServicesClient) GetSsoToken(resourceGroupName string, serviceName string) (result ServiceGetSsoTokenResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "GetSsoToken") + } + + req, err := client.GetSsoTokenPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "GetSsoToken", nil, "Failure preparing request") + return + } + + resp, err := client.GetSsoTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "GetSsoToken", resp, "Failure sending request") + return + } + + result, err = client.GetSsoTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "GetSsoToken", resp, "Failure responding to request") + } + + return +} + +// GetSsoTokenPreparer prepares the GetSsoToken request. +func (client ServicesClient) GetSsoTokenPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSsoTokenSender sends the GetSsoToken request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always +// closes the http.Response Body. +func (client ServicesClient) GetSsoTokenResponder(resp *http.Response) (result ServiceGetSsoTokenResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all API Management services within an Azure subscription. +func (client ServicesClient) List() (result ServiceListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServicesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ServicesClient) ListNextResults(lastResults ServiceListResult) (result ServiceListResult, err error) { + req, err := lastResults.ServiceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup list all API Management services within a resource +// group. +// +// resourceGroupName is the name of the resource group. +func (client ServicesClient) ListByResourceGroup(resourceGroupName string) (result ServiceListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServicesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ServicesClient) ListByResourceGroupNextResults(lastResults ServiceListResult) (result ServiceListResult, err error) { + req, err := lastResults.ServiceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ManageDeployments manages deployments of an API Management service. This +// operation can be used to do the following: Change SKU, Change SKU Units, +// Change Service Tier (Developer/Standard/Premium) and Manage VPN +// Configuration. This is a long running operation and can take several minutes +// to complete. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// ManageDeployments operation. +func (client ServicesClient) ManageDeployments(resourceGroupName string, serviceName string, parameters ServiceManageDeploymentsParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { + resultChan := make(chan ServiceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VpnConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VpnConfiguration.SubnetResourceID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VpnConfiguration.SubnetResourceID", Name: validation.Pattern, Rule: `^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$`, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "ManageDeployments") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ServiceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ManageDeploymentsPreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ManageDeployments", nil, "Failure preparing request") + return + } + + resp, err := client.ManageDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ManageDeployments", resp, "Failure sending request") + return + } + + result, err = client.ManageDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "ManageDeployments", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ManageDeploymentsPreparer prepares the ManageDeployments request. +func (client ServicesClient) ManageDeploymentsPreparer(resourceGroupName string, serviceName string, parameters ServiceManageDeploymentsParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/managedeployments", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ManageDeploymentsSender sends the ManageDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ManageDeploymentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ManageDeploymentsResponder handles the response to the ManageDeployments request. The method always +// closes the http.Response Body. +func (client ServicesClient) ManageDeploymentsResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Restore restores a backup of an API Management service created using the +// ApiManagementServices_Backup operation on the current service. This is a +// long running operation and could take several minutes to complete. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// Restore API Management service from backup operation. +func (client ServicesClient) Restore(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { + resultChan := make(chan ServiceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Restore") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ServiceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RestorePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Restore", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Restore", resp, "Failure sending request") + return + } + + result, err = client.RestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Restore", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestorePreparer prepares the Restore request. +func (client ServicesClient) RestorePreparer(resourceGroupName string, serviceName string, parameters ServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestoreSender sends the Restore request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) RestoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestoreResponder handles the response to the Restore request. The method always +// closes the http.Response Body. +func (client ServicesClient) RestoreResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing API Management service. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// CreateOrUpdate API Management service operation. +func (client ServicesClient) Update(resourceGroupName string, serviceName string, parameters ServiceUpdateParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { + resultChan := make(chan ServiceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "Update") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ServiceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ServicesClient) UpdatePreparer(resourceGroupName string, serviceName string, parameters ServiceUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHostname creates, updates, or deletes the custom hostnames for an API +// Management service. The custom hostname can be applied to the Proxy and +// Portal endpoint. This is a long running operation and could take several +// minutes to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// UpdateHostname operation. +func (client ServicesClient) UpdateHostname(resourceGroupName string, serviceName string, parameters ServiceUpdateHostnameParameters, cancel <-chan struct{}) (<-chan ServiceResource, <-chan error) { + resultChan := make(chan ServiceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "UpdateHostname") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ServiceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdateHostnamePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UpdateHostname", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHostnameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UpdateHostname", resp, "Failure sending request") + return + } + + result, err = client.UpdateHostnameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UpdateHostname", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateHostnamePreparer prepares the UpdateHostname request. +func (client ServicesClient) UpdateHostnamePreparer(resourceGroupName string, serviceName string, parameters ServiceUpdateHostnameParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/updatehostname", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateHostnameSender sends the UpdateHostname request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) UpdateHostnameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateHostnameResponder handles the response to the UpdateHostname request. The method always +// closes the http.Response Body. +func (client ServicesClient) UpdateHostnameResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UploadCertificate upload Custom Domain SSL certificate for an API Management +// service. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// Upload SSL certificate for an API Management service operation. +func (client ServicesClient) UploadCertificate(resourceGroupName string, serviceName string, parameters ServiceUploadCertificateParameters) (result CertificateInformation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Certificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CertificatePassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.ServicesClient", "UploadCertificate") + } + + req, err := client.UploadCertificatePreparer(resourceGroupName, serviceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UploadCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.UploadCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UploadCertificate", resp, "Failure sending request") + return + } + + result, err = client.UploadCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.ServicesClient", "UploadCertificate", resp, "Failure responding to request") + } + + return +} + +// UploadCertificatePreparer prepares the UploadCertificate request. +func (client ServicesClient) UploadCertificatePreparer(resourceGroupName string, serviceName string, parameters ServiceUploadCertificateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/uploadcertificate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UploadCertificateSender sends the UploadCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) UploadCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UploadCertificateResponder handles the response to the UploadCertificate request. The method always +// closes the http.Response Body. +func (client ServicesClient) UploadCertificateResponder(resp *http.Response) (result CertificateInformation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/subscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/subscriptions.go index f0281d2cde..edd18aca27 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/subscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/subscriptions.go @@ -1,674 +1,674 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SubscriptionsClient is the composite Swagger for ApiManagement Client -type SubscriptionsClient struct { - ManagementClient -} - -// NewSubscriptionsClient creates an instance of the SubscriptionsClient -// client. -func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { - return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionsClientWithBaseURI creates an instance of the -// SubscriptionsClient client. -func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { - return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the subscription of specified user to the -// specified product. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. sid is subscription entity Identifier. The -// entity represents the association between a user and a product in API -// Management. parameters is create parameters. -func (client SubscriptionsClient) CreateOrUpdate(resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.UserID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ProductID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.PrimaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrimaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.PrimaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.SecondaryKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SecondaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "parameters.SecondaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, sid, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified subscription. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. sid is subscription entity Identifier. The -// entity represents the association between a user and a product in API -// Management. ifMatch is eTag of the Subscription Entity. ETag should match -// the current entity state from the header response of the GET request or it -// should be * for unconditional update. -func (client SubscriptionsClient) Delete(resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, sid, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionsClient) DeletePreparer(resourceGroupName string, serviceName string, sid string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Subscription entity. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. sid is subscription entity Identifier. The -// entity represents the association between a user and a product in API -// Management. -func (client SubscriptionsClient) Get(resourceGroupName string, serviceName string, sid string) (result SubscriptionContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionsClient) GetPreparer(resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) GetResponder(resp *http.Response) (result SubscriptionContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all subscriptions of the API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported -// operators | Supported functions | -// |--------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | state | eq | -// | top is number of records to return. skip is number of records to skip. -func (client SubscriptionsClient) List(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionsClient) ListPreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) ListResponder(resp *http.Response) (result SubscriptionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SubscriptionsClient) ListNextResults(lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.SubscriptionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// RegeneratePrimaryKey regenerates primary key of existing subscription of the -// API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. sid is subscription entity Identifier. The -// entity represents the association between a user and a product in API -// Management. -func (client SubscriptionsClient) RegeneratePrimaryKey(resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey") - } - - req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client SubscriptionsClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerates secondary key of existing subscription of -// the API Management service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. sid is subscription entity Identifier. The -// entity represents the association between a user and a product in API -// Management. -func (client SubscriptionsClient) RegenerateSecondaryKey(resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey") - } - - req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, serviceName, sid) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client SubscriptionsClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, serviceName string, sid string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the details of a subscription specificied by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. sid is subscription entity Identifier. The -// entity represents the association between a user and a product in API -// Management. parameters is update parameters. ifMatch is eTag of the -// Subscription Entity. ETag should match the current entity state from the -// header response of the GET request or it should be * for unconditional -// update. -func (client SubscriptionsClient) Update(resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: sid, - Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, sid, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SubscriptionsClient) UpdatePreparer(resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "sid": autorest.Encode("path", sid), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SubscriptionsClient is the composite Swagger for ApiManagement Client +type SubscriptionsClient struct { + ManagementClient +} + +// NewSubscriptionsClient creates an instance of the SubscriptionsClient +// client. +func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { + return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionsClientWithBaseURI creates an instance of the +// SubscriptionsClient client. +func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { + return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the subscription of specified user to the +// specified product. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. sid is subscription entity Identifier. The +// entity represents the association between a user and a product in API +// Management. parameters is create parameters. +func (client SubscriptionsClient) CreateOrUpdate(resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: sid, + Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.UserID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ProductID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 100, Chain: nil}, + {Target: "parameters.Name", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.PrimaryKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrimaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "parameters.PrimaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.SecondaryKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SecondaryKey", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "parameters.SecondaryKey", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, sid, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubscriptionsClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, sid string, parameters SubscriptionCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "sid": autorest.Encode("path", sid), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified subscription. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. sid is subscription entity Identifier. The +// entity represents the association between a user and a product in API +// Management. ifMatch is eTag of the Subscription Entity. ETag should match +// the current entity state from the header response of the GET request or it +// should be * for unconditional update. +func (client SubscriptionsClient) Delete(resourceGroupName string, serviceName string, sid string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: sid, + Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, sid, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubscriptionsClient) DeletePreparer(resourceGroupName string, serviceName string, sid string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "sid": autorest.Encode("path", sid), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Subscription entity. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. sid is subscription entity Identifier. The +// entity represents the association between a user and a product in API +// Management. +func (client SubscriptionsClient) Get(resourceGroupName string, serviceName string, sid string) (result SubscriptionContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: sid, + Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, sid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubscriptionsClient) GetPreparer(resourceGroupName string, serviceName string, sid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "sid": autorest.Encode("path", sid), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) GetResponder(resp *http.Response) (result SubscriptionContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all subscriptions of the API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported +// operators | Supported functions | +// |--------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | state | eq | +// | top is number of records to return. skip is number of records to skip. +func (client SubscriptionsClient) List(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result SubscriptionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SubscriptionsClient) ListPreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListResponder(resp *http.Response) (result SubscriptionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SubscriptionsClient) ListNextResults(lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { + req, err := lastResults.SubscriptionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// RegeneratePrimaryKey regenerates primary key of existing subscription of the +// API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. sid is subscription entity Identifier. The +// entity represents the association between a user and a product in API +// Management. +func (client SubscriptionsClient) RegeneratePrimaryKey(resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: sid, + Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey") + } + + req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, serviceName, sid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegeneratePrimaryKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegeneratePrimaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegeneratePrimaryKey", resp, "Failure responding to request") + } + + return +} + +// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. +func (client SubscriptionsClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, serviceName string, sid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "sid": autorest.Encode("path", sid), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RegenerateSecondaryKey regenerates secondary key of existing subscription of +// the API Management service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. sid is subscription entity Identifier. The +// entity represents the association between a user and a product in API +// Management. +func (client SubscriptionsClient) RegenerateSecondaryKey(resourceGroupName string, serviceName string, sid string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: sid, + Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey") + } + + req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, serviceName, sid) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateSecondaryKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateSecondaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "RegenerateSecondaryKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. +func (client SubscriptionsClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, serviceName string, sid string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "sid": autorest.Encode("path", sid), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates the details of a subscription specificied by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. sid is subscription entity Identifier. The +// entity represents the association between a user and a product in API +// Management. parameters is update parameters. ifMatch is eTag of the +// Subscription Entity. ETag should match the current entity state from the +// header response of the GET request or it should be * for unconditional +// update. +func (client SubscriptionsClient) Update(resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: sid, + Constraints: []validation.Constraint{{Target: "sid", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "sid", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.SubscriptionsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, sid, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.SubscriptionsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SubscriptionsClient) UpdatePreparer(resourceGroupName string, serviceName string, sid string, parameters SubscriptionUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "sid": autorest.Encode("path", sid), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccess.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccess.go index 6bec78b3e3..531b9913c0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccess.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccess.go @@ -1,340 +1,340 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TenantAccessClient is the composite Swagger for ApiManagement Client -type TenantAccessClient struct { - ManagementClient -} - -// NewTenantAccessClient creates an instance of the TenantAccessClient client. -func NewTenantAccessClient(subscriptionID string) TenantAccessClient { - return NewTenantAccessClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessClientWithBaseURI creates an instance of the -// TenantAccessClient client. -func NewTenantAccessClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessClient { - return TenantAccessClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get tenant access information details. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantAccessClient) Get(resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerate primary access key. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantAccessClient) RegeneratePrimaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey") - } - - req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantAccessClient) RegenerateSecondaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey") - } - - req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update tenant access information details. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters. ifMatch is the -// entity state (Etag) version of the tenant access settings to update. A value -// of "*" can be used for If-Match to unconditionally apply the operation. -func (client TenantAccessClient) Update(resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TenantAccessClient) UpdatePreparer(resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TenantAccessClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TenantAccessClient is the composite Swagger for ApiManagement Client +type TenantAccessClient struct { + ManagementClient +} + +// NewTenantAccessClient creates an instance of the TenantAccessClient client. +func NewTenantAccessClient(subscriptionID string) TenantAccessClient { + return NewTenantAccessClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantAccessClientWithBaseURI creates an instance of the +// TenantAccessClient client. +func NewTenantAccessClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessClient { + return TenantAccessClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get tenant access information details. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantAccessClient) Get(resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TenantAccessClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TenantAccessClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegeneratePrimaryKey regenerate primary access key. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantAccessClient) RegeneratePrimaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey") + } + + req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegeneratePrimaryKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegeneratePrimaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegeneratePrimaryKey", resp, "Failure responding to request") + } + + return +} + +// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. +func (client TenantAccessClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/regeneratePrimaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always +// closes the http.Response Body. +func (client TenantAccessClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RegenerateSecondaryKey regenerate secondary access key. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantAccessClient) RegenerateSecondaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey") + } + + req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateSecondaryKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateSecondaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "RegenerateSecondaryKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. +func (client TenantAccessClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/regenerateSecondaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always +// closes the http.Response Body. +func (client TenantAccessClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update tenant access information details. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters. ifMatch is the +// entity state (Etag) version of the tenant access settings to update. A value +// of "*" can be used for If-Match to unconditionally apply the operation. +func (client TenantAccessClient) Update(resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TenantAccessClient) UpdatePreparer(resourceGroupName string, serviceName string, parameters AccessInformationUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TenantAccessClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccessgit.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccessgit.go index 1d23eaccd0..7d5a67c38c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccessgit.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantaccessgit.go @@ -1,263 +1,263 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TenantAccessGitClient is the composite Swagger for ApiManagement Client -type TenantAccessGitClient struct { - ManagementClient -} - -// NewTenantAccessGitClient creates an instance of the TenantAccessGitClient -// client. -func NewTenantAccessGitClient(subscriptionID string) TenantAccessGitClient { - return NewTenantAccessGitClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantAccessGitClientWithBaseURI creates an instance of the -// TenantAccessGitClient client. -func NewTenantAccessGitClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessGitClient { - return TenantAccessGitClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the Git access configuration for the tenant. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantAccessGitClient) Get(resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessGitClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantAccessGitClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/git", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegeneratePrimaryKey regenerate primary access key for GIT. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantAccessGitClient) RegeneratePrimaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey") - } - - req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client TenantAccessGitClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/git/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateSecondaryKey regenerate secondary access key for GIT. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantAccessGitClient) RegenerateSecondaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey") - } - - req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client TenantAccessGitClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/git/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client TenantAccessGitClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client TenantAccessGitClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TenantAccessGitClient is the composite Swagger for ApiManagement Client +type TenantAccessGitClient struct { + ManagementClient +} + +// NewTenantAccessGitClient creates an instance of the TenantAccessGitClient +// client. +func NewTenantAccessGitClient(subscriptionID string) TenantAccessGitClient { + return NewTenantAccessGitClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantAccessGitClientWithBaseURI creates an instance of the +// TenantAccessGitClient client. +func NewTenantAccessGitClientWithBaseURI(baseURI string, subscriptionID string) TenantAccessGitClient { + return TenantAccessGitClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the Git access configuration for the tenant. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantAccessGitClient) Get(resourceGroupName string, serviceName string) (result AccessInformationContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessGitClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TenantAccessGitClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/git", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessGitClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TenantAccessGitClient) GetResponder(resp *http.Response) (result AccessInformationContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegeneratePrimaryKey regenerate primary access key for GIT. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantAccessGitClient) RegeneratePrimaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey") + } + + req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegeneratePrimaryKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegeneratePrimaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegeneratePrimaryKey", resp, "Failure responding to request") + } + + return +} + +// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. +func (client TenantAccessGitClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/git/regeneratePrimaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessGitClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always +// closes the http.Response Body. +func (client TenantAccessGitClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RegenerateSecondaryKey regenerate secondary access key for GIT. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantAccessGitClient) RegenerateSecondaryKey(resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey") + } + + req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateSecondaryKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateSecondaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantAccessGitClient", "RegenerateSecondaryKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. +func (client TenantAccessGitClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/access/git/regenerateSecondaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client TenantAccessGitClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always +// closes the http.Response Body. +func (client TenantAccessGitClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfiguration.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfiguration.go index c0f087de23..90aeb4deed 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfiguration.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfiguration.go @@ -1,340 +1,340 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TenantConfigurationClient is the composite Swagger for ApiManagement Client -type TenantConfigurationClient struct { - ManagementClient -} - -// NewTenantConfigurationClient creates an instance of the -// TenantConfigurationClient client. -func NewTenantConfigurationClient(subscriptionID string) TenantConfigurationClient { - return NewTenantConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantConfigurationClientWithBaseURI creates an instance of the -// TenantConfigurationClient client. -func NewTenantConfigurationClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationClient { - return TenantConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Deploy this operation applies changes from the specified Git branch to the -// configuration database. This is a long running operation and could take -// several minutes to complete. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is deploy Configuration -// parameters. -func (client TenantConfigurationClient) Deploy(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (<-chan OperationResultContract, <-chan error) { - resultChan := make(chan OperationResultContract, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationClient", "Deploy") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result OperationResultContract - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeployPreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") - return - } - - resp, err := client.DeploySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", resp, "Failure sending request") - return - } - - result, err = client.DeployResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeployPreparer prepares the Deploy request. -func (client TenantConfigurationClient) DeployPreparer(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/deploy", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeploySender sends the Deploy request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) DeploySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeployResponder handles the response to the Deploy request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) DeployResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Save this operation creates a commit with the current configuration snapshot -// to the specified branch in the repository. This is a long running operation -// and could take several minutes to complete. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is save Configuration parameters. -func (client TenantConfigurationClient) Save(resourceGroupName string, serviceName string, parameters SaveConfigurationParameter, cancel <-chan struct{}) (<-chan OperationResultContract, <-chan error) { - resultChan := make(chan OperationResultContract, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationClient", "Save") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result OperationResultContract - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.SavePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", nil, "Failure preparing request") - return - } - - resp, err := client.SaveSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", resp, "Failure sending request") - return - } - - result, err = client.SaveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// SavePreparer prepares the Save request. -func (client TenantConfigurationClient) SavePreparer(resourceGroupName string, serviceName string, parameters SaveConfigurationParameter, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/save", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SaveSender sends the Save request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) SaveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SaveResponder handles the response to the Save request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) SaveResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Validate this operation validates the changes in the specified Git branch. -// This is a long running operation and could take several minutes to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is validate Configuration -// parameters. -func (client TenantConfigurationClient) Validate(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (<-chan OperationResultContract, <-chan error) { - resultChan := make(chan OperationResultContract, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationClient", "Validate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result OperationResultContract - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ValidatePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", resp, "Failure sending request") - return - } - - result, err = client.ValidateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ValidatePreparer prepares the Validate request. -func (client TenantConfigurationClient) ValidatePreparer(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationClient) ValidateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client TenantConfigurationClient) ValidateResponder(resp *http.Response) (result OperationResultContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TenantConfigurationClient is the composite Swagger for ApiManagement Client +type TenantConfigurationClient struct { + ManagementClient +} + +// NewTenantConfigurationClient creates an instance of the +// TenantConfigurationClient client. +func NewTenantConfigurationClient(subscriptionID string) TenantConfigurationClient { + return NewTenantConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantConfigurationClientWithBaseURI creates an instance of the +// TenantConfigurationClient client. +func NewTenantConfigurationClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationClient { + return TenantConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deploy this operation applies changes from the specified Git branch to the +// configuration database. This is a long running operation and could take +// several minutes to complete. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is deploy Configuration +// parameters. +func (client TenantConfigurationClient) Deploy(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (<-chan OperationResultContract, <-chan error) { + resultChan := make(chan OperationResultContract, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationClient", "Deploy") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result OperationResultContract + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeployPreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", nil, "Failure preparing request") + return + } + + resp, err := client.DeploySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", resp, "Failure sending request") + return + } + + result, err = client.DeployResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Deploy", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeployPreparer prepares the Deploy request. +func (client TenantConfigurationClient) DeployPreparer(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/deploy", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeploySender sends the Deploy request. The method will close the +// http.Response Body if it receives an error. +func (client TenantConfigurationClient) DeploySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeployResponder handles the response to the Deploy request. The method always +// closes the http.Response Body. +func (client TenantConfigurationClient) DeployResponder(resp *http.Response) (result OperationResultContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Save this operation creates a commit with the current configuration snapshot +// to the specified branch in the repository. This is a long running operation +// and could take several minutes to complete. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is save Configuration parameters. +func (client TenantConfigurationClient) Save(resourceGroupName string, serviceName string, parameters SaveConfigurationParameter, cancel <-chan struct{}) (<-chan OperationResultContract, <-chan error) { + resultChan := make(chan OperationResultContract, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationClient", "Save") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result OperationResultContract + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.SavePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", nil, "Failure preparing request") + return + } + + resp, err := client.SaveSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", resp, "Failure sending request") + return + } + + result, err = client.SaveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Save", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SavePreparer prepares the Save request. +func (client TenantConfigurationClient) SavePreparer(resourceGroupName string, serviceName string, parameters SaveConfigurationParameter, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/save", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SaveSender sends the Save request. The method will close the +// http.Response Body if it receives an error. +func (client TenantConfigurationClient) SaveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SaveResponder handles the response to the Save request. The method always +// closes the http.Response Body. +func (client TenantConfigurationClient) SaveResponder(resp *http.Response) (result OperationResultContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate this operation validates the changes in the specified Git branch. +// This is a long running operation and could take several minutes to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is validate Configuration +// parameters. +func (client TenantConfigurationClient) Validate(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (<-chan OperationResultContract, <-chan error) { + resultChan := make(chan OperationResultContract, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Branch", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationClient", "Validate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result OperationResultContract + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ValidatePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationClient", "Validate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ValidatePreparer prepares the Validate request. +func (client TenantConfigurationClient) ValidatePreparer(resourceGroupName string, serviceName string, parameters DeployConfigurationParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client TenantConfigurationClient) ValidateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client TenantConfigurationClient) ValidateResponder(resp *http.Response) (result OperationResultContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfigurationsyncstate.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfigurationsyncstate.go index c1d2d42f60..14e36721c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfigurationsyncstate.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantconfigurationsyncstate.go @@ -1,119 +1,119 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TenantConfigurationSyncStateClient is the composite Swagger for -// ApiManagement Client -type TenantConfigurationSyncStateClient struct { - ManagementClient -} - -// NewTenantConfigurationSyncStateClient creates an instance of the -// TenantConfigurationSyncStateClient client. -func NewTenantConfigurationSyncStateClient(subscriptionID string) TenantConfigurationSyncStateClient { - return NewTenantConfigurationSyncStateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantConfigurationSyncStateClientWithBaseURI creates an instance of the -// TenantConfigurationSyncStateClient client. -func NewTenantConfigurationSyncStateClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationSyncStateClient { - return TenantConfigurationSyncStateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the status of the most recent synchronization between the -// configuration database and the Git repository. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantConfigurationSyncStateClient) Get(resourceGroupName string, serviceName string) (result TenantConfigurationSyncStateContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantConfigurationSyncStateClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/syncState", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationSyncStateClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantConfigurationSyncStateClient) GetResponder(resp *http.Response) (result TenantConfigurationSyncStateContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TenantConfigurationSyncStateClient is the composite Swagger for +// ApiManagement Client +type TenantConfigurationSyncStateClient struct { + ManagementClient +} + +// NewTenantConfigurationSyncStateClient creates an instance of the +// TenantConfigurationSyncStateClient client. +func NewTenantConfigurationSyncStateClient(subscriptionID string) TenantConfigurationSyncStateClient { + return NewTenantConfigurationSyncStateClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantConfigurationSyncStateClientWithBaseURI creates an instance of the +// TenantConfigurationSyncStateClient client. +func NewTenantConfigurationSyncStateClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationSyncStateClient { + return TenantConfigurationSyncStateClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the status of the most recent synchronization between the +// configuration database and the Git repository. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantConfigurationSyncStateClient) Get(resourceGroupName string, serviceName string) (result TenantConfigurationSyncStateContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantConfigurationSyncStateClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TenantConfigurationSyncStateClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/configuration/syncState", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TenantConfigurationSyncStateClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TenantConfigurationSyncStateClient) GetResponder(resp *http.Response) (result TenantConfigurationSyncStateContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantpolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantpolicy.go index e97005bd0e..6bb36d4094 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantpolicy.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/tenantpolicy.go @@ -1,272 +1,272 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "io" - "net/http" -) - -// TenantPolicyClient is the composite Swagger for ApiManagement Client -type TenantPolicyClient struct { - ManagementClient -} - -// NewTenantPolicyClient creates an instance of the TenantPolicyClient client. -func NewTenantPolicyClient(subscriptionID string) TenantPolicyClient { - return NewTenantPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantPolicyClientWithBaseURI creates an instance of the -// TenantPolicyClient client. -func NewTenantPolicyClientWithBaseURI(baseURI string, subscriptionID string) TenantPolicyClient { - return TenantPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates global policy configuration for the -// tenant. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is the policy content details. -// parameters will be closed upon successful return. Callers should ensure -// closure when receiving an error.ifMatch is the entity state (Etag) version -// of the tenant policy to update. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client TenantPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TenantPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/policy", pathParameters), - autorest.WithFile(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TenantPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TenantPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the global tenant policy configuration. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. ifMatch is the entity state (Etag) version of -// the tenant policy to update. A value of "*" can be used for If-Match to -// unconditionally apply the operation. -func (client TenantPolicyClient) Delete(resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantPolicyClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TenantPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/policy", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TenantPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TenantPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the global policy configuration of the tenant. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client TenantPolicyClient) Get(resourceGroupName string, serviceName string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantPolicyClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantPolicyClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/policy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantPolicyClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "io" + "net/http" +) + +// TenantPolicyClient is the composite Swagger for ApiManagement Client +type TenantPolicyClient struct { + ManagementClient +} + +// NewTenantPolicyClient creates an instance of the TenantPolicyClient client. +func NewTenantPolicyClient(subscriptionID string) TenantPolicyClient { + return NewTenantPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantPolicyClientWithBaseURI creates an instance of the +// TenantPolicyClient client. +func NewTenantPolicyClientWithBaseURI(baseURI string, subscriptionID string) TenantPolicyClient { + return TenantPolicyClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates global policy configuration for the +// tenant. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is the policy content details. +// parameters will be closed upon successful return. Callers should ensure +// closure when receiving an error.ifMatch is the entity state (Etag) version +// of the tenant policy to update. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client TenantPolicyClient) CreateOrUpdate(resourceGroupName string, serviceName string, parameters io.ReadCloser, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TenantPolicyClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, parameters io.ReadCloser, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/policy", pathParameters), + autorest.WithFile(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TenantPolicyClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TenantPolicyClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the global tenant policy configuration. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. ifMatch is the entity state (Etag) version of +// the tenant policy to update. A value of "*" can be used for If-Match to +// unconditionally apply the operation. +func (client TenantPolicyClient) Delete(resourceGroupName string, serviceName string, ifMatch string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantPolicyClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TenantPolicyClient) DeletePreparer(resourceGroupName string, serviceName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/policy", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TenantPolicyClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TenantPolicyClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the global policy configuration of the tenant. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client TenantPolicyClient) Get(resourceGroupName string, serviceName string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.TenantPolicyClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.TenantPolicyClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TenantPolicyClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/policy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TenantPolicyClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TenantPolicyClient) GetResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usergroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usergroups.go index d30bc06bba..a922a4d8f4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usergroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usergroups.go @@ -1,170 +1,170 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UserGroupsClient is the composite Swagger for ApiManagement Client -type UserGroupsClient struct { - ManagementClient -} - -// NewUserGroupsClient creates an instance of the UserGroupsClient client. -func NewUserGroupsClient(subscriptionID string) UserGroupsClient { - return NewUserGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserGroupsClientWithBaseURI creates an instance of the UserGroupsClient -// client. -func NewUserGroupsClientWithBaseURI(baseURI string, subscriptionID string) UserGroupsClient { - return UserGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByUsers lists all user groups. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. filter is | Field | Supported -// operators | Supported functions | -// |-------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | top is number of records to return. skip is number of records to -// skip. -func (client UserGroupsClient) ListByUsers(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (result GroupCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UserGroupsClient", "ListByUsers") - } - - req, err := client.ListByUsersPreparer(resourceGroupName, serviceName, UID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", nil, "Failure preparing request") - return - } - - resp, err := client.ListByUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure sending request") - return - } - - result, err = client.ListByUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure responding to request") - } - - return -} - -// ListByUsersPreparer prepares the ListByUsers request. -func (client UserGroupsClient) ListByUsersPreparer(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByUsersSender sends the ListByUsers request. The method will close the -// http.Response Body if it receives an error. -func (client UserGroupsClient) ListByUsersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByUsersResponder handles the response to the ListByUsers request. The method always -// closes the http.Response Body. -func (client UserGroupsClient) ListByUsersResponder(resp *http.Response) (result GroupCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByUsersNextResults retrieves the next set of results, if any. -func (client UserGroupsClient) ListByUsersNextResults(lastResults GroupCollection) (result GroupCollection, err error) { - req, err := lastResults.GroupCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure sending next results request") - } - - result, err = client.ListByUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UserGroupsClient is the composite Swagger for ApiManagement Client +type UserGroupsClient struct { + ManagementClient +} + +// NewUserGroupsClient creates an instance of the UserGroupsClient client. +func NewUserGroupsClient(subscriptionID string) UserGroupsClient { + return NewUserGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUserGroupsClientWithBaseURI creates an instance of the UserGroupsClient +// client. +func NewUserGroupsClientWithBaseURI(baseURI string, subscriptionID string) UserGroupsClient { + return UserGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByUsers lists all user groups. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. filter is | Field | Supported +// operators | Supported functions | +// |-------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | top is number of records to return. skip is number of records to +// skip. +func (client UserGroupsClient) ListByUsers(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (result GroupCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UserGroupsClient", "ListByUsers") + } + + req, err := client.ListByUsersPreparer(resourceGroupName, serviceName, UID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", nil, "Failure preparing request") + return + } + + resp, err := client.ListByUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure sending request") + return + } + + result, err = client.ListByUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure responding to request") + } + + return +} + +// ListByUsersPreparer prepares the ListByUsers request. +func (client UserGroupsClient) ListByUsersPreparer(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/groups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByUsersSender sends the ListByUsers request. The method will close the +// http.Response Body if it receives an error. +func (client UserGroupsClient) ListByUsersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByUsersResponder handles the response to the ListByUsers request. The method always +// closes the http.Response Body. +func (client UserGroupsClient) ListByUsersResponder(resp *http.Response) (result GroupCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByUsersNextResults retrieves the next set of results, if any. +func (client UserGroupsClient) ListByUsersNextResults(lastResults GroupCollection) (result GroupCollection, err error) { + req, err := lastResults.GroupCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure sending next results request") + } + + result, err = client.ListByUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserGroupsClient", "ListByUsers", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/useridentities.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/useridentities.go index 8929271c4e..ce04f2d9ce 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/useridentities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/useridentities.go @@ -1,123 +1,123 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UserIdentitiesClient is the composite Swagger for ApiManagement Client -type UserIdentitiesClient struct { - ManagementClient -} - -// NewUserIdentitiesClient creates an instance of the UserIdentitiesClient -// client. -func NewUserIdentitiesClient(subscriptionID string) UserIdentitiesClient { - return NewUserIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserIdentitiesClientWithBaseURI creates an instance of the -// UserIdentitiesClient client. -func NewUserIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserIdentitiesClient { - return UserIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByUsers lists all user identities. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. -func (client UserIdentitiesClient) ListByUsers(resourceGroupName string, serviceName string, UID string) (result UserIdentityCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UserIdentitiesClient", "ListByUsers") - } - - req, err := client.ListByUsersPreparer(resourceGroupName, serviceName, UID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "ListByUsers", nil, "Failure preparing request") - return - } - - resp, err := client.ListByUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "ListByUsers", resp, "Failure sending request") - return - } - - result, err = client.ListByUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "ListByUsers", resp, "Failure responding to request") - } - - return -} - -// ListByUsersPreparer prepares the ListByUsers request. -func (client UserIdentitiesClient) ListByUsersPreparer(resourceGroupName string, serviceName string, UID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/identities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByUsersSender sends the ListByUsers request. The method will close the -// http.Response Body if it receives an error. -func (client UserIdentitiesClient) ListByUsersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByUsersResponder handles the response to the ListByUsers request. The method always -// closes the http.Response Body. -func (client UserIdentitiesClient) ListByUsersResponder(resp *http.Response) (result UserIdentityCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UserIdentitiesClient is the composite Swagger for ApiManagement Client +type UserIdentitiesClient struct { + ManagementClient +} + +// NewUserIdentitiesClient creates an instance of the UserIdentitiesClient +// client. +func NewUserIdentitiesClient(subscriptionID string) UserIdentitiesClient { + return NewUserIdentitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUserIdentitiesClientWithBaseURI creates an instance of the +// UserIdentitiesClient client. +func NewUserIdentitiesClientWithBaseURI(baseURI string, subscriptionID string) UserIdentitiesClient { + return UserIdentitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByUsers lists all user identities. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. +func (client UserIdentitiesClient) ListByUsers(resourceGroupName string, serviceName string, UID string) (result UserIdentityCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UserIdentitiesClient", "ListByUsers") + } + + req, err := client.ListByUsersPreparer(resourceGroupName, serviceName, UID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "ListByUsers", nil, "Failure preparing request") + return + } + + resp, err := client.ListByUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "ListByUsers", resp, "Failure sending request") + return + } + + result, err = client.ListByUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserIdentitiesClient", "ListByUsers", resp, "Failure responding to request") + } + + return +} + +// ListByUsersPreparer prepares the ListByUsers request. +func (client UserIdentitiesClient) ListByUsersPreparer(resourceGroupName string, serviceName string, UID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/identities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByUsersSender sends the ListByUsers request. The method will close the +// http.Response Body if it receives an error. +func (client UserIdentitiesClient) ListByUsersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByUsersResponder handles the response to the ListByUsers request. The method always +// closes the http.Response Body. +func (client UserIdentitiesClient) ListByUsersResponder(resp *http.Response) (result UserIdentityCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/users.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/users.go index b3954dcf40..2ae82ce85f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/users.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/users.go @@ -1,601 +1,601 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UsersClient is the composite Swagger for ApiManagement Client -type UsersClient struct { - ManagementClient -} - -// NewUsersClient creates an instance of the UsersClient client. -func NewUsersClient(subscriptionID string) UsersClient { - return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsersClientWithBaseURI creates an instance of the UsersClient client. -func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { - return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a user. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. parameters is create or update -// parameters. -func (client UsersClient) CreateOrUpdate(resourceGroupName string, serviceName string, UID string, parameters UserCreateParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Email", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Email", Name: validation.MaxLength, Rule: 254, Chain: nil}, - {Target: "parameters.Email", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.Password", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirstName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirstName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.FirstName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.LastName", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LastName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "parameters.LastName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, UID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client UsersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, UID string, parameters UserCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes specific user. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. ifMatch is the entity state (Etag) -// version of the user to delete. A value of "*" can be used for If-Match to -// unconditionally apply the operation. deleteSubscriptions is whether to -// delete user's subscription or not. -func (client UsersClient) Delete(resourceGroupName string, serviceName string, UID string, ifMatch string, deleteSubscriptions *bool) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName, UID, ifMatch, deleteSubscriptions) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UsersClient) DeletePreparer(resourceGroupName string, serviceName string, UID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteSubscriptions != nil { - queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UsersClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GenerateSsoURL retrieves a redirection URL containing an authentication -// token for signing a given user into the developer portal. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. -func (client UsersClient) GenerateSsoURL(resourceGroupName string, serviceName string, UID string) (result GenerateSsoURLResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "GenerateSsoURL") - } - - req, err := client.GenerateSsoURLPreparer(resourceGroupName, serviceName, UID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "GenerateSsoURL", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSsoURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "GenerateSsoURL", resp, "Failure sending request") - return - } - - result, err = client.GenerateSsoURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "GenerateSsoURL", resp, "Failure responding to request") - } - - return -} - -// GenerateSsoURLPreparer prepares the GenerateSsoURL request. -func (client UsersClient) GenerateSsoURLPreparer(resourceGroupName string, serviceName string, UID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/generateSsoUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateSsoURLSender sends the GenerateSsoURL request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GenerateSsoURLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateSsoURLResponder handles the response to the GenerateSsoURL request. The method always -// closes the http.Response Body. -func (client UsersClient) GenerateSsoURLResponder(resp *http.Response) (result GenerateSsoURLResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the details of the user specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. -func (client UsersClient) Get(resourceGroupName string, serviceName string, UID string) (result UserContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName, UID) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client UsersClient) GetPreparer(resourceGroupName string, serviceName string, UID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UsersClient) GetResponder(resp *http.Response) (result UserContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByService lists a collection of registered users in the specified -// service instance. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. filter is | Field | Supported -// operators | Supported functions | -// |------------------|------------------------|-----------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | firstName | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | lastName | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | email | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | -// | state | eq | N/A -// | -// | registrationDate | ge, le, eq, ne, gt, lt | N/A -// | -// | note | ge, le, eq, ne, gt, lt | substringof, contains, -// startswith, endswith | top is number of records to return. skip is number of -// records to skip. -func (client UsersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result UserCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "ListByService") - } - - req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure sending request") - return - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure responding to request") - } - - return -} - -// ListByServicePreparer prepares the ListByService request. -func (client UsersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServiceSender sends the ListByService request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServiceResponder handles the response to the ListByService request. The method always -// closes the http.Response Body. -func (client UsersClient) ListByServiceResponder(resp *http.Response) (result UserCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServiceNextResults retrieves the next set of results, if any. -func (client UsersClient) ListByServiceNextResults(lastResults UserCollection) (result UserCollection, err error) { - req, err := lastResults.UserCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure sending next results request") - } - - result, err = client.ListByServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the details of the user specified by its identifier. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. parameters is update parameters. -// ifMatch is the entity state (Etag) version of the user to update. A value of -// "*" can be used for If-Match to unconditionally apply the operation. -func (client UsersClient) Update(resourceGroupName string, serviceName string, UID string, parameters UserUpdateParameters, ifMatch string) (result ErrorBodyContract, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, UID, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UsersClient) UpdatePreparer(resourceGroupName string, serviceName string, UID string, parameters UserUpdateParameters, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client UsersClient) UpdateResponder(resp *http.Response) (result ErrorBodyContract, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UsersClient is the composite Swagger for ApiManagement Client +type UsersClient struct { + ManagementClient +} + +// NewUsersClient creates an instance of the UsersClient client. +func NewUsersClient(subscriptionID string) UsersClient { + return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsersClientWithBaseURI creates an instance of the UsersClient client. +func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { + return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a user. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. parameters is create or update +// parameters. +func (client UsersClient) CreateOrUpdate(resourceGroupName string, serviceName string, UID string, parameters UserCreateParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Email", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Email", Name: validation.MaxLength, Rule: 254, Chain: nil}, + {Target: "parameters.Email", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.Password", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FirstName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirstName", Name: validation.MaxLength, Rule: 100, Chain: nil}, + {Target: "parameters.FirstName", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.LastName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LastName", Name: validation.MaxLength, Rule: 100, Chain: nil}, + {Target: "parameters.LastName", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, UID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UsersClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, UID string, parameters UserCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes specific user. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. ifMatch is the entity state (Etag) +// version of the user to delete. A value of "*" can be used for If-Match to +// unconditionally apply the operation. deleteSubscriptions is whether to +// delete user's subscription or not. +func (client UsersClient) Delete(resourceGroupName string, serviceName string, UID string, ifMatch string, deleteSubscriptions *bool) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName, UID, ifMatch, deleteSubscriptions) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UsersClient) DeletePreparer(resourceGroupName string, serviceName string, UID string, ifMatch string, deleteSubscriptions *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteSubscriptions != nil { + queryParameters["deleteSubscriptions"] = autorest.Encode("query", *deleteSubscriptions) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UsersClient) DeleteResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GenerateSsoURL retrieves a redirection URL containing an authentication +// token for signing a given user into the developer portal. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. +func (client UsersClient) GenerateSsoURL(resourceGroupName string, serviceName string, UID string) (result GenerateSsoURLResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "GenerateSsoURL") + } + + req, err := client.GenerateSsoURLPreparer(resourceGroupName, serviceName, UID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "GenerateSsoURL", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateSsoURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "GenerateSsoURL", resp, "Failure sending request") + return + } + + result, err = client.GenerateSsoURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "GenerateSsoURL", resp, "Failure responding to request") + } + + return +} + +// GenerateSsoURLPreparer prepares the GenerateSsoURL request. +func (client UsersClient) GenerateSsoURLPreparer(resourceGroupName string, serviceName string, UID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/generateSsoUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateSsoURLSender sends the GenerateSsoURL request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GenerateSsoURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateSsoURLResponder handles the response to the GenerateSsoURL request. The method always +// closes the http.Response Body. +func (client UsersClient) GenerateSsoURLResponder(resp *http.Response) (result GenerateSsoURLResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the details of the user specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. +func (client UsersClient) Get(resourceGroupName string, serviceName string, UID string) (result UserContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName, UID) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client UsersClient) GetPreparer(resourceGroupName string, serviceName string, UID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client UsersClient) GetResponder(resp *http.Response) (result UserContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByService lists a collection of registered users in the specified +// service instance. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. filter is | Field | Supported +// operators | Supported functions | +// |------------------|------------------------|-----------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | firstName | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | lastName | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | email | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | +// | state | eq | N/A +// | +// | registrationDate | ge, le, eq, ne, gt, lt | N/A +// | +// | note | ge, le, eq, ne, gt, lt | substringof, contains, +// startswith, endswith | top is number of records to return. skip is number of +// records to skip. +func (client UsersClient) ListByService(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result UserCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "ListByService") + } + + req, err := client.ListByServicePreparer(resourceGroupName, serviceName, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure sending request") + return + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure responding to request") + } + + return +} + +// ListByServicePreparer prepares the ListByService request. +func (client UsersClient) ListByServicePreparer(resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServiceSender sends the ListByService request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListByServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServiceResponder handles the response to the ListByService request. The method always +// closes the http.Response Body. +func (client UsersClient) ListByServiceResponder(resp *http.Response) (result UserCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServiceNextResults retrieves the next set of results, if any. +func (client UsersClient) ListByServiceNextResults(lastResults UserCollection) (result UserCollection, err error) { + req, err := lastResults.UserCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure sending next results request") + } + + result, err = client.ListByServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "ListByService", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the details of the user specified by its identifier. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. parameters is update parameters. +// ifMatch is the entity state (Etag) version of the user to update. A value of +// "*" can be used for If-Match to unconditionally apply the operation. +func (client UsersClient) Update(resourceGroupName string, serviceName string, UID string, parameters UserUpdateParameters, ifMatch string) (result ErrorBodyContract, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UsersClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, UID, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UsersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UsersClient) UpdatePreparer(resourceGroupName string, serviceName string, UID string, parameters UserUpdateParameters, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client UsersClient) UpdateResponder(resp *http.Response) (result ErrorBodyContract, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusMethodNotAllowed), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usersubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usersubscriptions.go index 6d2c6da196..4c4281763e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usersubscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/usersubscriptions.go @@ -1,176 +1,176 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UserSubscriptionsClient is the composite Swagger for ApiManagement Client -type UserSubscriptionsClient struct { - ManagementClient -} - -// NewUserSubscriptionsClient creates an instance of the -// UserSubscriptionsClient client. -func NewUserSubscriptionsClient(subscriptionID string) UserSubscriptionsClient { - return NewUserSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserSubscriptionsClientWithBaseURI creates an instance of the -// UserSubscriptionsClient client. -func NewUserSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) UserSubscriptionsClient { - return UserSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByUsers lists the collection of subscriptions of the specified user. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. UID is user identifier. Must be unique in the -// current API Management service instance. filter is | Field | -// Supported operators | Supported functions | -// |--------------|------------------------|---------------------------------------------| -// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, -// endswith | -// | state | eq | -// | top is number of records to return. skip is number of records to skip. -func (client UserSubscriptionsClient) ListByUsers(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (result SubscriptionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: UID, - Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers") - } - - req, err := client.ListByUsersPreparer(resourceGroupName, serviceName, UID, filter, top, skip) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", nil, "Failure preparing request") - return - } - - resp, err := client.ListByUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure sending request") - return - } - - result, err = client.ListByUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure responding to request") - } - - return -} - -// ListByUsersPreparer prepares the ListByUsers request. -func (client UserSubscriptionsClient) ListByUsersPreparer(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "uid": autorest.Encode("path", UID), - } - - const APIVersion = "2016-10-10" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByUsersSender sends the ListByUsers request. The method will close the -// http.Response Body if it receives an error. -func (client UserSubscriptionsClient) ListByUsersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByUsersResponder handles the response to the ListByUsers request. The method always -// closes the http.Response Body. -func (client UserSubscriptionsClient) ListByUsersResponder(resp *http.Response) (result SubscriptionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByUsersNextResults retrieves the next set of results, if any. -func (client UserSubscriptionsClient) ListByUsersNextResults(lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { - req, err := lastResults.SubscriptionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure sending next results request") - } - - result, err = client.ListByUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure responding to next results request") - } - - return -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UserSubscriptionsClient is the composite Swagger for ApiManagement Client +type UserSubscriptionsClient struct { + ManagementClient +} + +// NewUserSubscriptionsClient creates an instance of the +// UserSubscriptionsClient client. +func NewUserSubscriptionsClient(subscriptionID string) UserSubscriptionsClient { + return NewUserSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUserSubscriptionsClientWithBaseURI creates an instance of the +// UserSubscriptionsClient client. +func NewUserSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) UserSubscriptionsClient { + return UserSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByUsers lists the collection of subscriptions of the specified user. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. UID is user identifier. Must be unique in the +// current API Management service instance. filter is | Field | +// Supported operators | Supported functions | +// |--------------|------------------------|---------------------------------------------| +// | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, +// endswith | +// | state | eq | +// | top is number of records to return. skip is number of records to skip. +func (client UserSubscriptionsClient) ListByUsers(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (result SubscriptionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: UID, + Constraints: []validation.Constraint{{Target: "UID", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "UID", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "UID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers") + } + + req, err := client.ListByUsersPreparer(resourceGroupName, serviceName, UID, filter, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", nil, "Failure preparing request") + return + } + + resp, err := client.ListByUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure sending request") + return + } + + result, err = client.ListByUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure responding to request") + } + + return +} + +// ListByUsersPreparer prepares the ListByUsers request. +func (client UserSubscriptionsClient) ListByUsersPreparer(resourceGroupName string, serviceName string, UID string, filter string, top *int32, skip *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "uid": autorest.Encode("path", UID), + } + + const APIVersion = "2016-10-10" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{uid}/subscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByUsersSender sends the ListByUsers request. The method will close the +// http.Response Body if it receives an error. +func (client UserSubscriptionsClient) ListByUsersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByUsersResponder handles the response to the ListByUsers request. The method always +// closes the http.Response Body. +func (client UserSubscriptionsClient) ListByUsersResponder(resp *http.Response) (result SubscriptionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByUsersNextResults retrieves the next set of results, if any. +func (client UserSubscriptionsClient) ListByUsersNextResults(lastResults SubscriptionCollection) (result SubscriptionCollection, err error) { + req, err := lastResults.SubscriptionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure sending next results request") + } + + result, err = client.ListByUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimanagement.UserSubscriptionsClient", "ListByUsers", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/version.go index 724f0f3eba..53a1c459ec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimanagement/version.go @@ -1,29 +1,29 @@ -package apimanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-apimanagement/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package apimanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-apimanagement/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/apimanagementservices.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/apimanagementservices.go index c2ce414001..d0a215094b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/apimanagementservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/apimanagementservices.go @@ -1,1060 +1,1060 @@ -package apimdeployment - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// APIManagementServicesClient is the use these REST APIs to manage Azure API -// Management deployment. -type APIManagementServicesClient struct { - ManagementClient -} - -// NewAPIManagementServicesClient creates an instance of the -// APIManagementServicesClient client. -func NewAPIManagementServicesClient(subscriptionID string) APIManagementServicesClient { - return NewAPIManagementServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIManagementServicesClientWithBaseURI creates an instance of the -// APIManagementServicesClient client. -func NewAPIManagementServicesClientWithBaseURI(baseURI string, subscriptionID string) APIManagementServicesClient { - return APIManagementServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Backup creates a backup of the API Management service to the given Azure -// Storage Account. This is long running operation and could take several -// minutes to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// ApiManagementServices_Backup operation. -func (client APIManagementServicesClient) Backup(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Backup") - } - - req, err := client.BackupPreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Backup", nil, "Failure preparing request") - } - - resp, err := client.BackupSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Backup", resp, "Failure sending request") - } - - result, err = client.BackupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Backup", resp, "Failure responding to request") - } - - return -} - -// BackupPreparer prepares the Backup request. -func (client APIManagementServicesClient) BackupPreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// BackupSender sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) BackupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// BackupResponder handles the response to the Backup request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) BackupResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckNameAvailability checks availability and correctness of a name for an -// API Management service. -// -// parameters is parameters supplied to the CheckNameAvailability operation. -func (client APIManagementServicesClient) CheckNameAvailability(parameters APIManagementServiceCheckNameAvailabilityParameters) (result APIManagementServiceNameAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(parameters) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability", nil, "Failure preparing request") - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability", resp, "Failure sending request") - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client APIManagementServicesClient) CheckNameAvailabilityPreparer(parameters APIManagementServiceCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result APIManagementServiceNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates an API Management service. This is long -// running operation and could take several minutes to complete. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// CreateOrUpdate API Management service operation. -func (client APIManagementServicesClient) CreateOrUpdate(resourceGroupName string, serviceName string, parameters APIManagementServiceResource) (result APIManagementServiceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, parameters) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APIManagementServicesClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) CreateOrUpdateResponder(resp *http.Response) (result APIManagementServiceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing API Management service. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client APIManagementServicesClient) Delete(resourceGroupName string, serviceName string) (result ErrorResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, serviceName) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Delete", nil, "Failure preparing request") - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Delete", resp, "Failure sending request") - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIManagementServicesClient) DeletePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) DeleteResponder(resp *http.Response) (result ErrorResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an API Management service resource description. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client APIManagementServicesClient) Get(resourceGroupName string, serviceName string) (result SetObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, serviceName) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Get", nil, "Failure preparing request") - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Get", resp, "Failure sending request") - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIManagementServicesClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) GetResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSsoToken gets the Single-Sign-On token for the API Management Service -// which is valid for 5 Minutes. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. -func (client APIManagementServicesClient) GetSsoToken(resourceGroupName string, serviceName string) (result APIManagementServiceGetSsoTokenResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken") - } - - req, err := client.GetSsoTokenPreparer(resourceGroupName, serviceName) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken", nil, "Failure preparing request") - } - - resp, err := client.GetSsoTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken", resp, "Failure sending request") - } - - result, err = client.GetSsoTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken", resp, "Failure responding to request") - } - - return -} - -// GetSsoTokenPreparer prepares the GetSsoToken request. -func (client APIManagementServicesClient) GetSsoTokenPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSsoTokenSender sends the GetSsoToken request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) GetSsoTokenResponder(resp *http.Response) (result APIManagementServiceGetSsoTokenResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all API Management services within an Azure subscription. -func (client APIManagementServicesClient) List() (result APIManagementServiceListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", nil, "Failure preparing request") - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure sending request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client APIManagementServicesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) ListResponder(resp *http.Response) (result APIManagementServiceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client APIManagementServicesClient) ListNextResults(lastResults APIManagementServiceListResult) (result APIManagementServiceListResult, err error) { - req, err := lastResults.APIManagementServiceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup list all API Management services within a resource -// group. -// -// resourceGroupName is the name of the resource group. -func (client APIManagementServicesClient) ListByResourceGroup(resourceGroupName string) (result APIManagementServiceListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure sending request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client APIManagementServicesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) ListByResourceGroupResponder(resp *http.Response) (result APIManagementServiceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client APIManagementServicesClient) ListByResourceGroupNextResults(lastResults APIManagementServiceListResult) (result APIManagementServiceListResult, err error) { - req, err := lastResults.APIManagementServiceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ManageDeployments manages deployments of an API Management service. This -// operation can be used to do the following: Change SKU, Change SKU Units, -// Change Service Tier (Developer/Standard/Premium) and Manage VPN -// Configuration. This is a long running operation and can take several minutes -// to complete. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// ManageDeployments operation. -func (client APIManagementServicesClient) ManageDeployments(resourceGroupName string, serviceName string, parameters APIManagementServiceManageDeploymentsParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments") - } - - req, err := client.ManageDeploymentsPreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments", nil, "Failure preparing request") - } - - resp, err := client.ManageDeploymentsSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments", resp, "Failure sending request") - } - - result, err = client.ManageDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments", resp, "Failure responding to request") - } - - return -} - -// ManageDeploymentsPreparer prepares the ManageDeployments request. -func (client APIManagementServicesClient) ManageDeploymentsPreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceManageDeploymentsParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/managedeployments", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ManageDeploymentsSender sends the ManageDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) ManageDeploymentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ManageDeploymentsResponder handles the response to the ManageDeployments request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) ManageDeploymentsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Restore restores a backup of an API Management service created using the -// ApiManagementServices_Backup operation on the current service. This is a -// long running operation and could take several minutes to complete. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// Restore API Management service from backup operation. -func (client APIManagementServicesClient) Restore(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Restore") - } - - req, err := client.RestorePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Restore", nil, "Failure preparing request") - } - - resp, err := client.RestoreSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Restore", resp, "Failure sending request") - } - - result, err = client.RestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Restore", resp, "Failure responding to request") - } - - return -} - -// RestorePreparer prepares the Restore request. -func (client APIManagementServicesClient) RestorePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) RestoreSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) RestoreResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing API Management service. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// CreateOrUpdate API Management service operation. -func (client APIManagementServicesClient) Update(resourceGroupName string, serviceName string, parameters APIManagementServiceBaseParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Update", nil, "Failure preparing request") - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Update", resp, "Failure sending request") - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client APIManagementServicesClient) UpdatePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceBaseParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateHostname creates, updates, or deletes the custom hostnames for an API -// Management service. The custom hostname can be applied to the Proxy and -// Portal endpoint. This is a long running operation and could take several -// minutes to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// UpdateHostname operation. -func (client APIManagementServicesClient) UpdateHostname(resourceGroupName string, serviceName string, parameters APIManagementServiceUpdateHostnameParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname") - } - - req, err := client.UpdateHostnamePreparer(resourceGroupName, serviceName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname", nil, "Failure preparing request") - } - - resp, err := client.UpdateHostnameSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname", resp, "Failure sending request") - } - - result, err = client.UpdateHostnameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname", resp, "Failure responding to request") - } - - return -} - -// UpdateHostnamePreparer prepares the UpdateHostname request. -func (client APIManagementServicesClient) UpdateHostnamePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceUpdateHostnameParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/updatehostname", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateHostnameSender sends the UpdateHostname request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) UpdateHostnameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateHostnameResponder handles the response to the UpdateHostname request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) UpdateHostnameResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// UploadCertificate upload Custom Domain SSL certificate for an API Management -// service. -// -// resourceGroupName is the name of the resource group. serviceName is the name -// of the API Management service. parameters is parameters supplied to the -// Upload SSL certificate for an API Management service operation. -func (client APIManagementServicesClient) UploadCertificate(resourceGroupName string, serviceName string, parameters APIManagementServiceUploadCertificateParameters) (result CertificateInformation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: serviceName, - Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Certificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificatePassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate") - } - - req, err := client.UploadCertificatePreparer(resourceGroupName, serviceName, parameters) - if err != nil { - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate", nil, "Failure preparing request") - } - - resp, err := client.UploadCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate", resp, "Failure sending request") - } - - result, err = client.UploadCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate", resp, "Failure responding to request") - } - - return -} - -// UploadCertificatePreparer prepares the UploadCertificate request. -func (client APIManagementServicesClient) UploadCertificatePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceUploadCertificateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/updatecertificate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UploadCertificateSender sends the UploadCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client APIManagementServicesClient) UploadCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UploadCertificateResponder handles the response to the UploadCertificate request. The method always -// closes the http.Response Body. -func (client APIManagementServicesClient) UploadCertificateResponder(resp *http.Response) (result CertificateInformation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package apimdeployment + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// APIManagementServicesClient is the use these REST APIs to manage Azure API +// Management deployment. +type APIManagementServicesClient struct { + ManagementClient +} + +// NewAPIManagementServicesClient creates an instance of the +// APIManagementServicesClient client. +func NewAPIManagementServicesClient(subscriptionID string) APIManagementServicesClient { + return NewAPIManagementServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIManagementServicesClientWithBaseURI creates an instance of the +// APIManagementServicesClient client. +func NewAPIManagementServicesClientWithBaseURI(baseURI string, subscriptionID string) APIManagementServicesClient { + return APIManagementServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Backup creates a backup of the API Management service to the given Azure +// Storage Account. This is long running operation and could take several +// minutes to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// ApiManagementServices_Backup operation. +func (client APIManagementServicesClient) Backup(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Backup") + } + + req, err := client.BackupPreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Backup", nil, "Failure preparing request") + } + + resp, err := client.BackupSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Backup", resp, "Failure sending request") + } + + result, err = client.BackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Backup", resp, "Failure responding to request") + } + + return +} + +// BackupPreparer prepares the Backup request. +func (client APIManagementServicesClient) BackupPreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// BackupSender sends the Backup request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) BackupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// BackupResponder handles the response to the Backup request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) BackupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckNameAvailability checks availability and correctness of a name for an +// API Management service. +// +// parameters is parameters supplied to the CheckNameAvailability operation. +func (client APIManagementServicesClient) CheckNameAvailability(parameters APIManagementServiceCheckNameAvailabilityParameters) (result APIManagementServiceNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability", resp, "Failure sending request") + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client APIManagementServicesClient) CheckNameAvailabilityPreparer(parameters APIManagementServiceCheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result APIManagementServiceNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates an API Management service. This is long +// running operation and could take several minutes to complete. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// CreateOrUpdate API Management service operation. +func (client APIManagementServicesClient) CreateOrUpdate(resourceGroupName string, serviceName string, parameters APIManagementServiceResource) (result APIManagementServiceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serviceName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client APIManagementServicesClient) CreateOrUpdatePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) CreateOrUpdateResponder(resp *http.Response) (result APIManagementServiceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing API Management service. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client APIManagementServicesClient) Delete(resourceGroupName string, serviceName string) (result ErrorResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, serviceName) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIManagementServicesClient) DeletePreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) DeleteResponder(resp *http.Response) (result ErrorResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an API Management service resource description. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client APIManagementServicesClient) Get(resourceGroupName string, serviceName string) (result SetObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, serviceName) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIManagementServicesClient) GetPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) GetResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSsoToken gets the Single-Sign-On token for the API Management Service +// which is valid for 5 Minutes. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. +func (client APIManagementServicesClient) GetSsoToken(resourceGroupName string, serviceName string) (result APIManagementServiceGetSsoTokenResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken") + } + + req, err := client.GetSsoTokenPreparer(resourceGroupName, serviceName) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken", nil, "Failure preparing request") + } + + resp, err := client.GetSsoTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken", resp, "Failure sending request") + } + + result, err = client.GetSsoTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "GetSsoToken", resp, "Failure responding to request") + } + + return +} + +// GetSsoTokenPreparer prepares the GetSsoToken request. +func (client APIManagementServicesClient) GetSsoTokenPreparer(resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSsoTokenSender sends the GetSsoToken request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) GetSsoTokenSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSsoTokenResponder handles the response to the GetSsoToken request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) GetSsoTokenResponder(resp *http.Response) (result APIManagementServiceGetSsoTokenResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all API Management services within an Azure subscription. +func (client APIManagementServicesClient) List() (result APIManagementServiceListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client APIManagementServicesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) ListResponder(resp *http.Response) (result APIManagementServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client APIManagementServicesClient) ListNextResults(lastResults APIManagementServiceListResult) (result APIManagementServiceListResult, err error) { + req, err := lastResults.APIManagementServiceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup list all API Management services within a resource +// group. +// +// resourceGroupName is the name of the resource group. +func (client APIManagementServicesClient) ListByResourceGroup(resourceGroupName string) (result APIManagementServiceListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure sending request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client APIManagementServicesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) ListByResourceGroupResponder(resp *http.Response) (result APIManagementServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client APIManagementServicesClient) ListByResourceGroupNextResults(lastResults APIManagementServiceListResult) (result APIManagementServiceListResult, err error) { + req, err := lastResults.APIManagementServiceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ManageDeployments manages deployments of an API Management service. This +// operation can be used to do the following: Change SKU, Change SKU Units, +// Change Service Tier (Developer/Standard/Premium) and Manage VPN +// Configuration. This is a long running operation and can take several minutes +// to complete. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// ManageDeployments operation. +func (client APIManagementServicesClient) ManageDeployments(resourceGroupName string, serviceName string, parameters APIManagementServiceManageDeploymentsParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments") + } + + req, err := client.ManageDeploymentsPreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments", nil, "Failure preparing request") + } + + resp, err := client.ManageDeploymentsSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments", resp, "Failure sending request") + } + + result, err = client.ManageDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "ManageDeployments", resp, "Failure responding to request") + } + + return +} + +// ManageDeploymentsPreparer prepares the ManageDeployments request. +func (client APIManagementServicesClient) ManageDeploymentsPreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceManageDeploymentsParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/managedeployments", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ManageDeploymentsSender sends the ManageDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) ManageDeploymentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ManageDeploymentsResponder handles the response to the ManageDeployments request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) ManageDeploymentsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restore restores a backup of an API Management service created using the +// ApiManagementServices_Backup operation on the current service. This is a +// long running operation and could take several minutes to complete. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// Restore API Management service from backup operation. +func (client APIManagementServicesClient) Restore(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageAccount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BackupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Restore") + } + + req, err := client.RestorePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Restore", nil, "Failure preparing request") + } + + resp, err := client.RestoreSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Restore", resp, "Failure sending request") + } + + result, err = client.RestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Restore", resp, "Failure responding to request") + } + + return +} + +// RestorePreparer prepares the Restore request. +func (client APIManagementServicesClient) RestorePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceBackupRestoreParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestoreSender sends the Restore request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) RestoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestoreResponder handles the response to the Restore request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) RestoreResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates an existing API Management service. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// CreateOrUpdate API Management service operation. +func (client APIManagementServicesClient) Update(resourceGroupName string, serviceName string, parameters APIManagementServiceBaseParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Update", nil, "Failure preparing request") + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Update", resp, "Failure sending request") + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client APIManagementServicesClient) UpdatePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceBaseParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateHostname creates, updates, or deletes the custom hostnames for an API +// Management service. The custom hostname can be applied to the Proxy and +// Portal endpoint. This is a long running operation and could take several +// minutes to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// UpdateHostname operation. +func (client APIManagementServicesClient) UpdateHostname(resourceGroupName string, serviceName string, parameters APIManagementServiceUpdateHostnameParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname") + } + + req, err := client.UpdateHostnamePreparer(resourceGroupName, serviceName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname", nil, "Failure preparing request") + } + + resp, err := client.UpdateHostnameSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname", resp, "Failure sending request") + } + + result, err = client.UpdateHostnameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UpdateHostname", resp, "Failure responding to request") + } + + return +} + +// UpdateHostnamePreparer prepares the UpdateHostname request. +func (client APIManagementServicesClient) UpdateHostnamePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceUpdateHostnameParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/updatehostname", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateHostnameSender sends the UpdateHostname request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) UpdateHostnameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateHostnameResponder handles the response to the UpdateHostname request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) UpdateHostnameResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// UploadCertificate upload Custom Domain SSL certificate for an API Management +// service. +// +// resourceGroupName is the name of the resource group. serviceName is the name +// of the API Management service. parameters is parameters supplied to the +// Upload SSL certificate for an API Management service operation. +func (client APIManagementServicesClient) UploadCertificate(resourceGroupName string, serviceName string, parameters APIManagementServiceUploadCertificateParameters) (result CertificateInformation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: serviceName, + Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Certificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CertificatePassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate") + } + + req, err := client.UploadCertificatePreparer(resourceGroupName, serviceName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate", nil, "Failure preparing request") + } + + resp, err := client.UploadCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate", resp, "Failure sending request") + } + + result, err = client.UploadCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "apimdeployment.APIManagementServicesClient", "UploadCertificate", resp, "Failure responding to request") + } + + return +} + +// UploadCertificatePreparer prepares the UploadCertificate request. +func (client APIManagementServicesClient) UploadCertificatePreparer(resourceGroupName string, serviceName string, parameters APIManagementServiceUploadCertificateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/updatecertificate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UploadCertificateSender sends the UploadCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client APIManagementServicesClient) UploadCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UploadCertificateResponder handles the response to the UploadCertificate request. The method always +// closes the http.Response Body. +func (client APIManagementServicesClient) UploadCertificateResponder(resp *http.Response) (result CertificateInformation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/client.go index 13d2457040..0c42237342 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/client.go @@ -1,58 +1,58 @@ -// Package apimdeployment implements the Azure ARM Apimdeployment service API -// version 2016-07-07. -// -// Use these REST APIs to manage Azure API Management deployment. -package apimdeployment - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // APIVersion is the version of the Apimdeployment - APIVersion = "2016-07-07" - - // DefaultBaseURI is the default URI used for the service Apimdeployment - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Apimdeployment. -type ManagementClient struct { - autorest.Client - BaseURI string - APIVersion string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - APIVersion: APIVersion, - SubscriptionID: subscriptionID, - } -} +// Package apimdeployment implements the Azure ARM Apimdeployment service API +// version 2016-07-07. +// +// Use these REST APIs to manage Azure API Management deployment. +package apimdeployment + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // APIVersion is the version of the Apimdeployment + APIVersion = "2016-07-07" + + // DefaultBaseURI is the default URI used for the service Apimdeployment + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Apimdeployment. +type ManagementClient struct { + autorest.Client + BaseURI string + APIVersion string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + APIVersion: APIVersion, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/models.go index 0d663d115f..9ba2d9047a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/models.go @@ -1,251 +1,251 @@ -package apimdeployment - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// HostnameType enumerates the values for hostname type. -type HostnameType string - -const ( - // Management specifies the management state for hostname type. - Management HostnameType = "Management" - // Portal specifies the portal state for hostname type. - Portal HostnameType = "Portal" - // Proxy specifies the proxy state for hostname type. - Proxy HostnameType = "Proxy" - // Scm specifies the scm state for hostname type. - Scm HostnameType = "Scm" -) - -// NameAvailabilityReason enumerates the values for name availability reason. -type NameAvailabilityReason string - -const ( - // AlreadyExists specifies the already exists state for name availability - // reason. - AlreadyExists NameAvailabilityReason = "AlreadyExists" - // Invalid specifies the invalid state for name availability reason. - Invalid NameAvailabilityReason = "Invalid" - // Valid specifies the valid state for name availability reason. - Valid NameAvailabilityReason = "Valid" -) - -// SkuType enumerates the values for sku type. -type SkuType string - -const ( - // Developer specifies the developer state for sku type. - Developer SkuType = "Developer" - // Premium specifies the premium state for sku type. - Premium SkuType = "Premium" - // Standard specifies the standard state for sku type. - Standard SkuType = "Standard" -) - -// VirtualNetworkType enumerates the values for virtual network type. -type VirtualNetworkType string - -const ( - // External specifies the external state for virtual network type. - External VirtualNetworkType = "External" - // Internal specifies the internal state for virtual network type. - Internal VirtualNetworkType = "Internal" - // None specifies the none state for virtual network type. - None VirtualNetworkType = "None" -) - -// AdditionalRegion is description of an additional API Management resource -// location. -type AdditionalRegion struct { - Location *string `json:"location,omitempty"` - SkuType SkuType `json:"skuType,omitempty"` - SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` - StaticIPs *[]string `json:"staticIPs,omitempty"` - Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` -} - -// APIManagementServiceBackupRestoreParameters is parameters supplied to the -// Backup/Restore of an API Management service operation. -type APIManagementServiceBackupRestoreParameters struct { - StorageAccount *string `json:"storageAccount,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - BackupName *string `json:"backupName,omitempty"` -} - -// APIManagementServiceBaseParameters is parameters supplied to the Update API -// Management service operation. -type APIManagementServiceBaseParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *APIManagementServiceProperties `json:"properties,omitempty"` - Sku *APIManagementServiceSkuProperties `json:"sku,omitempty"` -} - -// APIManagementServiceCheckNameAvailabilityParameters is parameters supplied -// to the CheckNameAvailability operation. -type APIManagementServiceCheckNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` -} - -// APIManagementServiceGetSsoTokenResult is the response of the GetSsoToken -// operation. -type APIManagementServiceGetSsoTokenResult struct { - autorest.Response `json:"-"` - RedirectURI *string `json:"redirect_uri,omitempty"` -} - -// APIManagementServiceListResult is the response of the List API Management -// services operation. -type APIManagementServiceListResult struct { - autorest.Response `json:"-"` - Value *[]APIManagementServiceResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// APIManagementServiceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client APIManagementServiceListResult) APIManagementServiceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// APIManagementServiceManageDeploymentsParameters is parameters supplied to -// the ManageDeployments operation. -type APIManagementServiceManageDeploymentsParameters struct { - Location *string `json:"location,omitempty"` - SkuType SkuType `json:"skuType,omitempty"` - SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` - AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` - VpnConfiguration *VirtualNetworkConfiguration `json:"vpnConfiguration,omitempty"` - VpnType VirtualNetworkType `json:"vpnType,omitempty"` -} - -// APIManagementServiceNameAvailabilityResult is response of the -// CheckNameAvailability operation. -type APIManagementServiceNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Message *string `json:"message,omitempty"` - Reason NameAvailabilityReason `json:"reason,omitempty"` -} - -// APIManagementServiceProperties is properties of an API Management service -// resource description. -type APIManagementServiceProperties struct { - PublisherEmail *string `json:"publisherEmail,omitempty"` - PublisherName *string `json:"publisherName,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` - CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` - RuntimeURL *string `json:"runtimeUrl,omitempty"` - PortalURL *string `json:"portalUrl,omitempty"` - ManagementAPIURL *string `json:"managementApiUrl,omitempty"` - ScmURL *string `json:"scmUrl,omitempty"` - AddresserEmail *string `json:"addresserEmail,omitempty"` - HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` - StaticIPs *[]string `json:"staticIPs,omitempty"` - Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` - AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` - CustomProperties *map[string]*string `json:"customProperties,omitempty"` - VpnType VirtualNetworkType `json:"vpnType,omitempty"` -} - -// APIManagementServiceResource is description of an API Management service -// resource. -type APIManagementServiceResource struct { - autorest.Response `json:"-"` - Tags *map[string]*string `json:"tags,omitempty"` - *APIManagementServiceProperties `json:"properties,omitempty"` - Sku *APIManagementServiceSkuProperties `json:"sku,omitempty"` - ID *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// APIManagementServiceSkuProperties is aPI Management service resource SKU -// properties. -type APIManagementServiceSkuProperties struct { - Name SkuType `json:"name,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// APIManagementServiceUpdateHostnameParameters is parameters supplied to the -// UpdateHostname operation. -type APIManagementServiceUpdateHostnameParameters struct { - Update *[]HostnameConfiguration `json:"update,omitempty"` - Delete *[]HostnameType `json:"delete,omitempty"` -} - -// APIManagementServiceUploadCertificateParameters is parameters supplied to -// the Upload SSL certificate for an API Management service operation. -type APIManagementServiceUploadCertificateParameters struct { - Type HostnameType `json:"type,omitempty"` - Certificate *string `json:"certificate,omitempty"` - CertificatePassword *string `json:"certificate_password,omitempty"` -} - -// CertificateInformation is sSL certificate information. -type CertificateInformation struct { - autorest.Response `json:"-"` - Expiry *date.Time `json:"expiry,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - Subject *string `json:"subject,omitempty"` -} - -// ErrorResponse is error Response. -type ErrorResponse struct { - autorest.Response `json:"-"` - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// HostnameConfiguration is custom hostname configuration. -type HostnameConfiguration struct { - Type HostnameType `json:"type,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Certificate *CertificateInformation `json:"certificate,omitempty"` -} - -// SetObject is -type SetObject struct { - autorest.Response `json:"-"` - Value *map[string]interface{} `json:"value,omitempty"` -} - -// VirtualNetworkConfiguration is configuration of a virtual network to which -// API Management service is deployed. -type VirtualNetworkConfiguration struct { - Vnetid *string `json:"vnetid,omitempty"` - Subnetname *string `json:"subnetname,omitempty"` - SubnetResourceID *string `json:"subnetResourceId,omitempty"` - Location *string `json:"location,omitempty"` -} +package apimdeployment + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// HostnameType enumerates the values for hostname type. +type HostnameType string + +const ( + // Management specifies the management state for hostname type. + Management HostnameType = "Management" + // Portal specifies the portal state for hostname type. + Portal HostnameType = "Portal" + // Proxy specifies the proxy state for hostname type. + Proxy HostnameType = "Proxy" + // Scm specifies the scm state for hostname type. + Scm HostnameType = "Scm" +) + +// NameAvailabilityReason enumerates the values for name availability reason. +type NameAvailabilityReason string + +const ( + // AlreadyExists specifies the already exists state for name availability + // reason. + AlreadyExists NameAvailabilityReason = "AlreadyExists" + // Invalid specifies the invalid state for name availability reason. + Invalid NameAvailabilityReason = "Invalid" + // Valid specifies the valid state for name availability reason. + Valid NameAvailabilityReason = "Valid" +) + +// SkuType enumerates the values for sku type. +type SkuType string + +const ( + // Developer specifies the developer state for sku type. + Developer SkuType = "Developer" + // Premium specifies the premium state for sku type. + Premium SkuType = "Premium" + // Standard specifies the standard state for sku type. + Standard SkuType = "Standard" +) + +// VirtualNetworkType enumerates the values for virtual network type. +type VirtualNetworkType string + +const ( + // External specifies the external state for virtual network type. + External VirtualNetworkType = "External" + // Internal specifies the internal state for virtual network type. + Internal VirtualNetworkType = "Internal" + // None specifies the none state for virtual network type. + None VirtualNetworkType = "None" +) + +// AdditionalRegion is description of an additional API Management resource +// location. +type AdditionalRegion struct { + Location *string `json:"location,omitempty"` + SkuType SkuType `json:"skuType,omitempty"` + SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` + StaticIPs *[]string `json:"staticIPs,omitempty"` + Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` +} + +// APIManagementServiceBackupRestoreParameters is parameters supplied to the +// Backup/Restore of an API Management service operation. +type APIManagementServiceBackupRestoreParameters struct { + StorageAccount *string `json:"storageAccount,omitempty"` + AccessKey *string `json:"accessKey,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + BackupName *string `json:"backupName,omitempty"` +} + +// APIManagementServiceBaseParameters is parameters supplied to the Update API +// Management service operation. +type APIManagementServiceBaseParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + *APIManagementServiceProperties `json:"properties,omitempty"` + Sku *APIManagementServiceSkuProperties `json:"sku,omitempty"` +} + +// APIManagementServiceCheckNameAvailabilityParameters is parameters supplied +// to the CheckNameAvailability operation. +type APIManagementServiceCheckNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` +} + +// APIManagementServiceGetSsoTokenResult is the response of the GetSsoToken +// operation. +type APIManagementServiceGetSsoTokenResult struct { + autorest.Response `json:"-"` + RedirectURI *string `json:"redirect_uri,omitempty"` +} + +// APIManagementServiceListResult is the response of the List API Management +// services operation. +type APIManagementServiceListResult struct { + autorest.Response `json:"-"` + Value *[]APIManagementServiceResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// APIManagementServiceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client APIManagementServiceListResult) APIManagementServiceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// APIManagementServiceManageDeploymentsParameters is parameters supplied to +// the ManageDeployments operation. +type APIManagementServiceManageDeploymentsParameters struct { + Location *string `json:"location,omitempty"` + SkuType SkuType `json:"skuType,omitempty"` + SkuUnitCount *int32 `json:"skuUnitCount,omitempty"` + AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` + VpnConfiguration *VirtualNetworkConfiguration `json:"vpnConfiguration,omitempty"` + VpnType VirtualNetworkType `json:"vpnType,omitempty"` +} + +// APIManagementServiceNameAvailabilityResult is response of the +// CheckNameAvailability operation. +type APIManagementServiceNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Message *string `json:"message,omitempty"` + Reason NameAvailabilityReason `json:"reason,omitempty"` +} + +// APIManagementServiceProperties is properties of an API Management service +// resource description. +type APIManagementServiceProperties struct { + PublisherEmail *string `json:"publisherEmail,omitempty"` + PublisherName *string `json:"publisherName,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + TargetProvisioningState *string `json:"targetProvisioningState,omitempty"` + CreatedAtUtc *date.Time `json:"createdAtUtc,omitempty"` + RuntimeURL *string `json:"runtimeUrl,omitempty"` + PortalURL *string `json:"portalUrl,omitempty"` + ManagementAPIURL *string `json:"managementApiUrl,omitempty"` + ScmURL *string `json:"scmUrl,omitempty"` + AddresserEmail *string `json:"addresserEmail,omitempty"` + HostnameConfigurations *[]HostnameConfiguration `json:"hostnameConfigurations,omitempty"` + StaticIPs *[]string `json:"staticIPs,omitempty"` + Vpnconfiguration *VirtualNetworkConfiguration `json:"vpnconfiguration,omitempty"` + AdditionalLocations *[]AdditionalRegion `json:"additionalLocations,omitempty"` + CustomProperties *map[string]*string `json:"customProperties,omitempty"` + VpnType VirtualNetworkType `json:"vpnType,omitempty"` +} + +// APIManagementServiceResource is description of an API Management service +// resource. +type APIManagementServiceResource struct { + autorest.Response `json:"-"` + Tags *map[string]*string `json:"tags,omitempty"` + *APIManagementServiceProperties `json:"properties,omitempty"` + Sku *APIManagementServiceSkuProperties `json:"sku,omitempty"` + ID *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// APIManagementServiceSkuProperties is aPI Management service resource SKU +// properties. +type APIManagementServiceSkuProperties struct { + Name SkuType `json:"name,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// APIManagementServiceUpdateHostnameParameters is parameters supplied to the +// UpdateHostname operation. +type APIManagementServiceUpdateHostnameParameters struct { + Update *[]HostnameConfiguration `json:"update,omitempty"` + Delete *[]HostnameType `json:"delete,omitempty"` +} + +// APIManagementServiceUploadCertificateParameters is parameters supplied to +// the Upload SSL certificate for an API Management service operation. +type APIManagementServiceUploadCertificateParameters struct { + Type HostnameType `json:"type,omitempty"` + Certificate *string `json:"certificate,omitempty"` + CertificatePassword *string `json:"certificate_password,omitempty"` +} + +// CertificateInformation is sSL certificate information. +type CertificateInformation struct { + autorest.Response `json:"-"` + Expiry *date.Time `json:"expiry,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Subject *string `json:"subject,omitempty"` +} + +// ErrorResponse is error Response. +type ErrorResponse struct { + autorest.Response `json:"-"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// HostnameConfiguration is custom hostname configuration. +type HostnameConfiguration struct { + Type HostnameType `json:"type,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Certificate *CertificateInformation `json:"certificate,omitempty"` +} + +// SetObject is +type SetObject struct { + autorest.Response `json:"-"` + Value *map[string]interface{} `json:"value,omitempty"` +} + +// VirtualNetworkConfiguration is configuration of a virtual network to which +// API Management service is deployed. +type VirtualNetworkConfiguration struct { + Vnetid *string `json:"vnetid,omitempty"` + Subnetname *string `json:"subnetname,omitempty"` + SubnetResourceID *string `json:"subnetResourceId,omitempty"` + Location *string `json:"location,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/version.go index 298f8253e5..5099053f4f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/apimdeployment/version.go @@ -1,60 +1,60 @@ -package apimdeployment - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "apimdeployment", "2016-07-07") - } - return userAgent -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version -} +package apimdeployment + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "bytes" + "fmt" + "strings" +) + +const ( + major = "8" + minor = "1" + patch = "0" + tag = "beta" + userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" +) + +// cached results of UserAgent and Version to prevent repeated operations. +var ( + userAgent string + version string +) + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + if userAgent == "" { + userAgent = fmt.Sprintf(userAgentFormat, Version(), "apimdeployment", "2016-07-07") + } + return userAgent +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + if version == "" { + versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) + if tag != "" { + versionBuilder.WriteRune('-') + versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) + } + version = string(versionBuilder.Bytes()) + } + return version +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/client.go index 4fd7d36de4..e00640451a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/client.go @@ -1,53 +1,53 @@ -// Package appinsights implements the Azure ARM Appinsights service API version -// . -// -// Composite Swagger for Application Insights Management Client -package appinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Appinsights - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Appinsights. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package appinsights implements the Azure ARM Appinsights service API version +// . +// +// Composite Swagger for Application Insights Management Client +package appinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Appinsights + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Appinsights. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/components.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/components.go index b689c08f13..45c5c8282a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/components.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/components.go @@ -1,497 +1,497 @@ -package appinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ComponentsClient is the composite Swagger for Application Insights -// Management Client -type ComponentsClient struct { - ManagementClient -} - -// NewComponentsClient creates an instance of the ComponentsClient client. -func NewComponentsClient(subscriptionID string) ComponentsClient { - return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentsClientWithBaseURI creates an instance of the ComponentsClient -// client. -func NewComponentsClientWithBaseURI(baseURI string, subscriptionID string) ComponentsClient { - return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates (or updates) an Application Insights component. Note: -// You cannot specify a different value for InstrumentationKey nor AppId in the -// Put operation. -// -// resourceGroupName is the name of the resource group. resourceName is the -// name of the Application Insights component resource. insightProperties is -// properties that need to be specified to create an Application Insights -// component. -func (client ComponentsClient) CreateOrUpdate(resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (result ApplicationInsightsComponent, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: insightProperties, - Constraints: []validation.Constraint{{Target: "insightProperties.Kind", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "appinsights.ComponentsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceName, insightProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ComponentsClient) CreateOrUpdatePreparer(resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), - autorest.WithJSON(insightProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ComponentsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Application Insights component. -// -// resourceGroupName is the name of the resource group. resourceName is the -// name of the Application Insights component resource. -func (client ComponentsClient) Delete(resourceGroupName string, resourceName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ComponentsClient) DeletePreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ComponentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns an Application Insights component. -// -// resourceGroupName is the name of the resource group. resourceName is the -// name of the Application Insights component resource. -func (client ComponentsClient) Get(resourceGroupName string, resourceName string) (result ApplicationInsightsComponent, err error) { - req, err := client.GetPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentsClient) GetPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ComponentsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all Application Insights components within a -// subscription. -func (client ComponentsClient) List() (result ApplicationInsightsComponentListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ComponentsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/components", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ComponentsClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ComponentsClient) ListNextResults(lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { - req, err := lastResults.ApplicationInsightsComponentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets a list of Application Insights components within a -// resource group. -// -// resourceGroupName is the name of the resource group. -func (client ComponentsClient) ListByResourceGroup(resourceGroupName string) (result ApplicationInsightsComponentListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ComponentsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ComponentsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ComponentsClient) ListByResourceGroupNextResults(lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { - req, err := lastResults.ApplicationInsightsComponentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// UpdateTags updates an existing component's tags. To update other fields use -// the CreateOrUpdate method. -// -// resourceGroupName is the name of the resource group. resourceName is the -// name of the Application Insights component resource. componentTags is -// updated tag information to set into the component instance. -func (client ComponentsClient) UpdateTags(resourceGroupName string, resourceName string, componentTags TagsResource) (result ApplicationInsightsComponent, err error) { - req, err := client.UpdateTagsPreparer(resourceGroupName, resourceName, componentTags) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "UpdateTags", resp, "Failure responding to request") - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client ComponentsClient) UpdateTagsPreparer(resourceGroupName string, resourceName string, componentTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), - autorest.WithJSON(componentTags), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client ComponentsClient) UpdateTagsResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package appinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ComponentsClient is the composite Swagger for Application Insights +// Management Client +type ComponentsClient struct { + ManagementClient +} + +// NewComponentsClient creates an instance of the ComponentsClient client. +func NewComponentsClient(subscriptionID string) ComponentsClient { + return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentsClientWithBaseURI creates an instance of the ComponentsClient +// client. +func NewComponentsClientWithBaseURI(baseURI string, subscriptionID string) ComponentsClient { + return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates (or updates) an Application Insights component. Note: +// You cannot specify a different value for InstrumentationKey nor AppId in the +// Put operation. +// +// resourceGroupName is the name of the resource group. resourceName is the +// name of the Application Insights component resource. insightProperties is +// properties that need to be specified to create an Application Insights +// component. +func (client ComponentsClient) CreateOrUpdate(resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (result ApplicationInsightsComponent, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: insightProperties, + Constraints: []validation.Constraint{{Target: "insightProperties.Kind", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "appinsights.ComponentsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceName, insightProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentsClient) CreateOrUpdatePreparer(resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithJSON(insightProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ComponentsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Application Insights component. +// +// resourceGroupName is the name of the resource group. resourceName is the +// name of the Application Insights component resource. +func (client ComponentsClient) Delete(resourceGroupName string, resourceName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentsClient) DeletePreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ComponentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an Application Insights component. +// +// resourceGroupName is the name of the resource group. resourceName is the +// name of the Application Insights component resource. +func (client ComponentsClient) Get(resourceGroupName string, resourceName string) (result ApplicationInsightsComponent, err error) { + req, err := client.GetPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentsClient) GetPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all Application Insights components within a +// subscription. +func (client ComponentsClient) List() (result ApplicationInsightsComponentListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ComponentsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/components", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ComponentsClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ComponentsClient) ListNextResults(lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { + req, err := lastResults.ApplicationInsightsComponentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets a list of Application Insights components within a +// resource group. +// +// resourceGroupName is the name of the resource group. +func (client ComponentsClient) ListByResourceGroup(resourceGroupName string) (result ApplicationInsightsComponentListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ComponentsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ComponentsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ComponentsClient) ListByResourceGroupNextResults(lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { + req, err := lastResults.ApplicationInsightsComponentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// UpdateTags updates an existing component's tags. To update other fields use +// the CreateOrUpdate method. +// +// resourceGroupName is the name of the resource group. resourceName is the +// name of the Application Insights component resource. componentTags is +// updated tag information to set into the component instance. +func (client ComponentsClient) UpdateTags(resourceGroupName string, resourceName string, componentTags TagsResource) (result ApplicationInsightsComponent, err error) { + req, err := client.UpdateTagsPreparer(resourceGroupName, resourceName, componentTags) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.ComponentsClient", "UpdateTags", resp, "Failure responding to request") + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ComponentsClient) UpdateTagsPreparer(resourceGroupName string, resourceName string, componentTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithJSON(componentTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ComponentsClient) UpdateTagsResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/models.go index e03c7dcf89..0cf0bb0ad0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/models.go @@ -1,226 +1,226 @@ -package appinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ApplicationType enumerates the values for application type. -type ApplicationType string - -const ( - // Other specifies the other state for application type. - Other ApplicationType = "other" - // Web specifies the web state for application type. - Web ApplicationType = "web" -) - -// FlowType enumerates the values for flow type. -type FlowType string - -const ( - // Bluefield specifies the bluefield state for flow type. - Bluefield FlowType = "Bluefield" -) - -// RequestSource enumerates the values for request source. -type RequestSource string - -const ( - // Rest specifies the rest state for request source. - Rest RequestSource = "rest" -) - -// WebTestKind enumerates the values for web test kind. -type WebTestKind string - -const ( - // Multistep specifies the multistep state for web test kind. - Multistep WebTestKind = "multistep" - // Ping specifies the ping state for web test kind. - Ping WebTestKind = "ping" -) - -// ApplicationInsightsComponent is an Application Insights component -// definition. -type ApplicationInsightsComponent struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Kind *string `json:"kind,omitempty"` - *ApplicationInsightsComponentProperties `json:"properties,omitempty"` -} - -// ApplicationInsightsComponentListResult is describes the list of Application -// Insights Resources. -type ApplicationInsightsComponentListResult struct { - autorest.Response `json:"-"` - Value *[]ApplicationInsightsComponent `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationInsightsComponentListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ApplicationInsightsComponentListResult) ApplicationInsightsComponentListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ApplicationInsightsComponentProperties is properties that define an -// Application Insights component resource. -type ApplicationInsightsComponentProperties struct { - ApplicationID *string `json:"ApplicationId,omitempty"` - AppID *string `json:"AppId,omitempty"` - ApplicationType ApplicationType `json:"Application_Type,omitempty"` - FlowType FlowType `json:"Flow_Type,omitempty"` - RequestSource RequestSource `json:"Request_Source,omitempty"` - InstrumentationKey *string `json:"InstrumentationKey,omitempty"` - CreationDate *date.Time `json:"CreationDate,omitempty"` - TenantID *string `json:"TenantId,omitempty"` - HockeyAppID *string `json:"HockeyAppId,omitempty"` - HockeyAppToken *string `json:"HockeyAppToken,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"` -} - -// ErrorResponse is error reponse indicates Insights service is not able to -// process the incoming request. The reason is provided in the error message. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// Operation is cDN REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list CDN operations. It -// contains a list of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Resource is an azure resource object -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// TagsResource is a container holding only the Tags for a resource, allowing -// the user to update the tags on a WebTest instance. -type TagsResource struct { - Tags *map[string]*string `json:"tags,omitempty"` -} - -// WebTest is an Application Insights web test definition. -type WebTest struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Kind WebTestKind `json:"kind,omitempty"` - *WebTestProperties `json:"properties,omitempty"` -} - -// WebTestGeolocation is geo-physical location to run a web test from. You must -// specify one or more locations for the test to run from. -type WebTestGeolocation struct { - Location *string `json:"Id,omitempty"` -} - -// WebTestListResult is a list of 0 or more Application Insights web test -// definitions. -type WebTestListResult struct { - autorest.Response `json:"-"` - Value *[]WebTest `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WebTestListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WebTestListResult) WebTestListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WebTestProperties is metadata describing a web test for an Azure resource. -type WebTestProperties struct { - SyntheticMonitorID *string `json:"SyntheticMonitorId,omitempty"` - WebTestName *string `json:"Name,omitempty"` - Description *string `json:"Description,omitempty"` - Enabled *bool `json:"Enabled,omitempty"` - Frequency *int32 `json:"Frequency,omitempty"` - Timeout *int32 `json:"Timeout,omitempty"` - WebTestKind WebTestKind `json:"Kind,omitempty"` - RetryEnabled *bool `json:"RetryEnabled,omitempty"` - Locations *[]WebTestGeolocation `json:"Locations,omitempty"` - Configuration *WebTestPropertiesConfiguration `json:"Configuration,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// WebTestPropertiesConfiguration is an XML configuration specification for a -// WebTest. -type WebTestPropertiesConfiguration struct { - WebTest *string `json:"WebTest,omitempty"` -} +package appinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ApplicationType enumerates the values for application type. +type ApplicationType string + +const ( + // Other specifies the other state for application type. + Other ApplicationType = "other" + // Web specifies the web state for application type. + Web ApplicationType = "web" +) + +// FlowType enumerates the values for flow type. +type FlowType string + +const ( + // Bluefield specifies the bluefield state for flow type. + Bluefield FlowType = "Bluefield" +) + +// RequestSource enumerates the values for request source. +type RequestSource string + +const ( + // Rest specifies the rest state for request source. + Rest RequestSource = "rest" +) + +// WebTestKind enumerates the values for web test kind. +type WebTestKind string + +const ( + // Multistep specifies the multistep state for web test kind. + Multistep WebTestKind = "multistep" + // Ping specifies the ping state for web test kind. + Ping WebTestKind = "ping" +) + +// ApplicationInsightsComponent is an Application Insights component +// definition. +type ApplicationInsightsComponent struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Kind *string `json:"kind,omitempty"` + *ApplicationInsightsComponentProperties `json:"properties,omitempty"` +} + +// ApplicationInsightsComponentListResult is describes the list of Application +// Insights Resources. +type ApplicationInsightsComponentListResult struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponent `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationInsightsComponentListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ApplicationInsightsComponentListResult) ApplicationInsightsComponentListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ApplicationInsightsComponentProperties is properties that define an +// Application Insights component resource. +type ApplicationInsightsComponentProperties struct { + ApplicationID *string `json:"ApplicationId,omitempty"` + AppID *string `json:"AppId,omitempty"` + ApplicationType ApplicationType `json:"Application_Type,omitempty"` + FlowType FlowType `json:"Flow_Type,omitempty"` + RequestSource RequestSource `json:"Request_Source,omitempty"` + InstrumentationKey *string `json:"InstrumentationKey,omitempty"` + CreationDate *date.Time `json:"CreationDate,omitempty"` + TenantID *string `json:"TenantId,omitempty"` + HockeyAppID *string `json:"HockeyAppId,omitempty"` + HockeyAppToken *string `json:"HockeyAppToken,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"` +} + +// ErrorResponse is error reponse indicates Insights service is not able to +// process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Operation is cDN REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list CDN operations. It +// contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Resource is an azure resource object +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// TagsResource is a container holding only the Tags for a resource, allowing +// the user to update the tags on a WebTest instance. +type TagsResource struct { + Tags *map[string]*string `json:"tags,omitempty"` +} + +// WebTest is an Application Insights web test definition. +type WebTest struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Kind WebTestKind `json:"kind,omitempty"` + *WebTestProperties `json:"properties,omitempty"` +} + +// WebTestGeolocation is geo-physical location to run a web test from. You must +// specify one or more locations for the test to run from. +type WebTestGeolocation struct { + Location *string `json:"Id,omitempty"` +} + +// WebTestListResult is a list of 0 or more Application Insights web test +// definitions. +type WebTestListResult struct { + autorest.Response `json:"-"` + Value *[]WebTest `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WebTestListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WebTestListResult) WebTestListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WebTestProperties is metadata describing a web test for an Azure resource. +type WebTestProperties struct { + SyntheticMonitorID *string `json:"SyntheticMonitorId,omitempty"` + WebTestName *string `json:"Name,omitempty"` + Description *string `json:"Description,omitempty"` + Enabled *bool `json:"Enabled,omitempty"` + Frequency *int32 `json:"Frequency,omitempty"` + Timeout *int32 `json:"Timeout,omitempty"` + WebTestKind WebTestKind `json:"Kind,omitempty"` + RetryEnabled *bool `json:"RetryEnabled,omitempty"` + Locations *[]WebTestGeolocation `json:"Locations,omitempty"` + Configuration *WebTestPropertiesConfiguration `json:"Configuration,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// WebTestPropertiesConfiguration is an XML configuration specification for a +// WebTest. +type WebTestPropertiesConfiguration struct { + WebTest *string `json:"WebTest,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/operations.go index db3609e565..37e9fd47c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/operations.go @@ -1,123 +1,123 @@ -package appinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the composite Swagger for Application Insights -// Management Client -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available insights REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package appinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the composite Swagger for Application Insights +// Management Client +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available insights REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/version.go index 752779b95f..d8e37bc801 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/version.go @@ -1,29 +1,29 @@ -package appinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-appinsights/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package appinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-appinsights/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/webtests.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/webtests.go index bc9a09b041..509dfe804c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/webtests.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/appinsights/webtests.go @@ -1,499 +1,499 @@ -package appinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WebTestsClient is the composite Swagger for Application Insights Management -// Client -type WebTestsClient struct { - ManagementClient -} - -// NewWebTestsClient creates an instance of the WebTestsClient client. -func NewWebTestsClient(subscriptionID string) WebTestsClient { - return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebTestsClientWithBaseURI creates an instance of the WebTestsClient -// client. -func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { - return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an Application Insights web test -// definition. -// -// resourceGroupName is the name of the resource group. webTestName is the name -// of the Application Insights webtest resource. webTestDefinition is -// properties that need to be specified to create or update an Application -// Insights web test definition. -func (client WebTestsClient) CreateOrUpdate(resourceGroupName string, webTestName string, webTestDefinition WebTest) (result WebTest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: webTestDefinition, - Constraints: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties.SyntheticMonitorID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webTestDefinition.WebTestProperties.WebTestName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webTestDefinition.WebTestProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "appinsights.WebTestsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, webTestName, webTestDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WebTestsClient) CreateOrUpdatePreparer(resourceGroupName string, webTestName string, webTestDefinition WebTest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), - autorest.WithJSON(webTestDefinition), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WebTestsClient) CreateOrUpdateResponder(resp *http.Response) (result WebTest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Application Insights web test. -// -// resourceGroupName is the name of the resource group. webTestName is the name -// of the Application Insights webtest resource. -func (client WebTestsClient) Delete(resourceGroupName string, webTestName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, webTestName) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebTestsClient) DeletePreparer(resourceGroupName string, webTestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WebTestsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a specific Application Insights web test definition. -// -// resourceGroupName is the name of the resource group. webTestName is the name -// of the Application Insights webtest resource. -func (client WebTestsClient) Get(resourceGroupName string, webTestName string) (result WebTest, err error) { - req, err := client.GetPreparer(resourceGroupName, webTestName) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebTestsClient) GetPreparer(resourceGroupName string, webTestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WebTestsClient) GetResponder(resp *http.Response) (result WebTest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all Application Insights web test alerts definitioned within a -// subscription. -func (client WebTestsClient) List() (result WebTestListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WebTestsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/webtests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WebTestsClient) ListResponder(resp *http.Response) (result WebTestListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client WebTestsClient) ListNextResults(lastResults WebTestListResult) (result WebTestListResult, err error) { - req, err := lastResults.WebTestListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup get all Application Insights web tests defined within a -// specified resource group. -// -// resourceGroupName is the name of the resource group. -func (client WebTestsClient) ListByResourceGroup(resourceGroupName string) (result WebTestListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WebTestsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WebTestsClient) ListByResourceGroupResponder(resp *http.Response) (result WebTestListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client WebTestsClient) ListByResourceGroupNextResults(lastResults WebTestListResult) (result WebTestListResult, err error) { - req, err := lastResults.WebTestListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// UpdateTags creates or updates an Application Insights web test definition. -// -// resourceGroupName is the name of the resource group. webTestName is the name -// of the Application Insights webtest resource. webTestTags is updated tag -// information to set into the web test instance. -func (client WebTestsClient) UpdateTags(resourceGroupName string, webTestName string, webTestTags TagsResource) (result WebTest, err error) { - req, err := client.UpdateTagsPreparer(resourceGroupName, webTestName, webTestTags) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "UpdateTags", resp, "Failure responding to request") - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client WebTestsClient) UpdateTagsPreparer(resourceGroupName string, webTestName string, webTestTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), - autorest.WithJSON(webTestTags), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client WebTestsClient) UpdateTagsResponder(resp *http.Response) (result WebTest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package appinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WebTestsClient is the composite Swagger for Application Insights Management +// Client +type WebTestsClient struct { + ManagementClient +} + +// NewWebTestsClient creates an instance of the WebTestsClient client. +func NewWebTestsClient(subscriptionID string) WebTestsClient { + return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebTestsClientWithBaseURI creates an instance of the WebTestsClient +// client. +func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { + return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an Application Insights web test +// definition. +// +// resourceGroupName is the name of the resource group. webTestName is the name +// of the Application Insights webtest resource. webTestDefinition is +// properties that need to be specified to create or update an Application +// Insights web test definition. +func (client WebTestsClient) CreateOrUpdate(resourceGroupName string, webTestName string, webTestDefinition WebTest) (result WebTest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: webTestDefinition, + Constraints: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties.SyntheticMonitorID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webTestDefinition.WebTestProperties.WebTestName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webTestDefinition.WebTestProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "appinsights.WebTestsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, webTestName, webTestDefinition) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WebTestsClient) CreateOrUpdatePreparer(resourceGroupName string, webTestName string, webTestDefinition WebTest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithJSON(webTestDefinition), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WebTestsClient) CreateOrUpdateResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Application Insights web test. +// +// resourceGroupName is the name of the resource group. webTestName is the name +// of the Application Insights webtest resource. +func (client WebTestsClient) Delete(resourceGroupName string, webTestName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, webTestName) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WebTestsClient) DeletePreparer(resourceGroupName string, webTestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WebTestsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a specific Application Insights web test definition. +// +// resourceGroupName is the name of the resource group. webTestName is the name +// of the Application Insights webtest resource. +func (client WebTestsClient) Get(resourceGroupName string, webTestName string) (result WebTest, err error) { + req, err := client.GetPreparer(resourceGroupName, webTestName) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebTestsClient) GetPreparer(resourceGroupName string, webTestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WebTestsClient) GetResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all Application Insights web test alerts definitioned within a +// subscription. +func (client WebTestsClient) List() (result WebTestListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WebTestsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/webtests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client WebTestsClient) ListNextResults(lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.WebTestListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all Application Insights web tests defined within a +// specified resource group. +// +// resourceGroupName is the name of the resource group. +func (client WebTestsClient) ListByResourceGroup(resourceGroupName string) (result WebTestListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WebTestsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListByResourceGroupResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client WebTestsClient) ListByResourceGroupNextResults(lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.WebTestListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// UpdateTags creates or updates an Application Insights web test definition. +// +// resourceGroupName is the name of the resource group. webTestName is the name +// of the Application Insights webtest resource. webTestTags is updated tag +// information to set into the web test instance. +func (client WebTestsClient) UpdateTags(resourceGroupName string, webTestName string, webTestTags TagsResource) (result WebTest, err error) { + req, err := client.UpdateTagsPreparer(resourceGroupName, webTestName, webTestTags) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appinsights.WebTestsClient", "UpdateTags", resp, "Failure responding to request") + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client WebTestsClient) UpdateTagsPreparer(resourceGroupName string, webTestName string, webTestTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithJSON(webTestTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client WebTestsClient) UpdateTagsResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/classicadministrators.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/classicadministrators.go index 704f169d5c..50824a38a3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/classicadministrators.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/classicadministrators.go @@ -1,133 +1,133 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ClassicAdministratorsClient is the role based access control provides you a -// way to apply granular level policy administration down to individual -// resources or resource groups. These operations enable you to manage role -// definitions and role assignments. A role definition describes the set of -// actions that can be performed on resources. A role assignment grants access -// to Azure Active Directory users. -type ClassicAdministratorsClient struct { - ManagementClient -} - -// NewClassicAdministratorsClient creates an instance of the -// ClassicAdministratorsClient client. -func NewClassicAdministratorsClient(subscriptionID string) ClassicAdministratorsClient { - return NewClassicAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClassicAdministratorsClientWithBaseURI creates an instance of the -// ClassicAdministratorsClient client. -func NewClassicAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ClassicAdministratorsClient { - return ClassicAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets service administrator, account administrator, and -// co-administrators for the subscription. -func (client ClassicAdministratorsClient) List() (result ClassicAdministratorListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ClassicAdministratorsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClassicAdministratorsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClassicAdministratorsClient) ListResponder(resp *http.Response) (result ClassicAdministratorListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ClassicAdministratorsClient) ListNextResults(lastResults ClassicAdministratorListResult) (result ClassicAdministratorListResult, err error) { - req, err := lastResults.ClassicAdministratorListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ClassicAdministratorsClient is the role based access control provides you a +// way to apply granular level policy administration down to individual +// resources or resource groups. These operations enable you to manage role +// definitions and role assignments. A role definition describes the set of +// actions that can be performed on resources. A role assignment grants access +// to Azure Active Directory users. +type ClassicAdministratorsClient struct { + ManagementClient +} + +// NewClassicAdministratorsClient creates an instance of the +// ClassicAdministratorsClient client. +func NewClassicAdministratorsClient(subscriptionID string) ClassicAdministratorsClient { + return NewClassicAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClassicAdministratorsClientWithBaseURI creates an instance of the +// ClassicAdministratorsClient client. +func NewClassicAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ClassicAdministratorsClient { + return ClassicAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets service administrator, account administrator, and +// co-administrators for the subscription. +func (client ClassicAdministratorsClient) List() (result ClassicAdministratorListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ClassicAdministratorsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClassicAdministratorsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClassicAdministratorsClient) ListResponder(resp *http.Response) (result ClassicAdministratorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ClassicAdministratorsClient) ListNextResults(lastResults ClassicAdministratorListResult) (result ClassicAdministratorListResult, err error) { + req, err := lastResults.ClassicAdministratorListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/client.go index a8b14aa718..5330315d28 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/client.go @@ -1,57 +1,57 @@ -// Package authorization implements the Azure ARM Authorization service API -// version 2015-07-01. -// -// Role based access control provides you a way to apply granular level policy -// administration down to individual resources or resource groups. These -// operations enable you to manage role definitions and role assignments. A -// role definition describes the set of actions that can be performed on -// resources. A role assignment grants access to Azure Active Directory users. -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Authorization - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Authorization. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package authorization implements the Azure ARM Authorization service API +// version 2015-07-01. +// +// Role based access control provides you a way to apply granular level policy +// administration down to individual resources or resource groups. These +// operations enable you to manage role definitions and role assignments. A +// role definition describes the set of actions that can be performed on +// resources. A role assignment grants access to Azure Active Directory users. +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Authorization + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Authorization. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/models.go index 60526cd407..b615a2c3ec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/models.go @@ -1,223 +1,223 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ClassicAdministrator is classic Administrators -type ClassicAdministrator struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Properties *ClassicAdministratorProperties `json:"properties,omitempty"` -} - -// ClassicAdministratorListResult is classicAdministrator list result -// information. -type ClassicAdministratorListResult struct { - autorest.Response `json:"-"` - Value *[]ClassicAdministrator `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClassicAdministratorListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClassicAdministratorListResult) ClassicAdministratorListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClassicAdministratorProperties is classic Administrator properties. -type ClassicAdministratorProperties struct { - EmailAddress *string `json:"emailAddress,omitempty"` - Role *string `json:"role,omitempty"` -} - -// Permission is role definition permissions. -type Permission struct { - Actions *[]string `json:"actions,omitempty"` - NotActions *[]string `json:"notActions,omitempty"` -} - -// PermissionGetResult is permissions information. -type PermissionGetResult struct { - autorest.Response `json:"-"` - Value *[]Permission `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PermissionGetResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PermissionGetResult) PermissionGetResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProviderOperation is operation -type ProviderOperation struct { - Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Description *string `json:"description,omitempty"` - Origin *string `json:"origin,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` -} - -// ProviderOperationsMetadata is provider Operations metadata -type ProviderOperationsMetadata struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - ResourceTypes *[]ResourceType `json:"resourceTypes,omitempty"` - Operations *[]ProviderOperation `json:"operations,omitempty"` -} - -// ProviderOperationsMetadataListResult is provider operations metadata list -type ProviderOperationsMetadataListResult struct { - autorest.Response `json:"-"` - Value *[]ProviderOperationsMetadata `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ProviderOperationsMetadataListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProviderOperationsMetadataListResult) ProviderOperationsMetadataListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResourceType is resource Type -type ResourceType struct { - Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Operations *[]ProviderOperation `json:"operations,omitempty"` -} - -// RoleAssignment is role Assignments -type RoleAssignment struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Properties *RoleAssignmentPropertiesWithScope `json:"properties,omitempty"` -} - -// RoleAssignmentCreateParameters is role assignment create parameters. -type RoleAssignmentCreateParameters struct { - Properties *RoleAssignmentProperties `json:"properties,omitempty"` -} - -// RoleAssignmentFilter is role Assignments filter -type RoleAssignmentFilter struct { - PrincipalID *string `json:"principalId,omitempty"` -} - -// RoleAssignmentListResult is role assignment list operation result. -type RoleAssignmentListResult struct { - autorest.Response `json:"-"` - Value *[]RoleAssignment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RoleAssignmentListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RoleAssignmentListResult) RoleAssignmentListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RoleAssignmentProperties is role assignment properties. -type RoleAssignmentProperties struct { - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - PrincipalID *string `json:"principalId,omitempty"` -} - -// RoleAssignmentPropertiesWithScope is role assignment properties with scope. -type RoleAssignmentPropertiesWithScope struct { - Scope *string `json:"scope,omitempty"` - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - PrincipalID *string `json:"principalId,omitempty"` -} - -// RoleDefinition is role definition. -type RoleDefinition struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Properties *RoleDefinitionProperties `json:"properties,omitempty"` -} - -// RoleDefinitionFilter is role Definitions filter -type RoleDefinitionFilter struct { - RoleName *string `json:"roleName,omitempty"` -} - -// RoleDefinitionListResult is role definition list operation result. -type RoleDefinitionListResult struct { - autorest.Response `json:"-"` - Value *[]RoleDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RoleDefinitionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RoleDefinitionListResult) RoleDefinitionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RoleDefinitionProperties is role definition properties. -type RoleDefinitionProperties struct { - RoleName *string `json:"roleName,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - Permissions *[]Permission `json:"permissions,omitempty"` - AssignableScopes *[]string `json:"assignableScopes,omitempty"` -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ClassicAdministrator is classic Administrators +type ClassicAdministrator struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Properties *ClassicAdministratorProperties `json:"properties,omitempty"` +} + +// ClassicAdministratorListResult is classicAdministrator list result +// information. +type ClassicAdministratorListResult struct { + autorest.Response `json:"-"` + Value *[]ClassicAdministrator `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClassicAdministratorListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClassicAdministratorListResult) ClassicAdministratorListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClassicAdministratorProperties is classic Administrator properties. +type ClassicAdministratorProperties struct { + EmailAddress *string `json:"emailAddress,omitempty"` + Role *string `json:"role,omitempty"` +} + +// Permission is role definition permissions. +type Permission struct { + Actions *[]string `json:"actions,omitempty"` + NotActions *[]string `json:"notActions,omitempty"` +} + +// PermissionGetResult is permissions information. +type PermissionGetResult struct { + autorest.Response `json:"-"` + Value *[]Permission `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PermissionGetResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PermissionGetResult) PermissionGetResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProviderOperation is operation +type ProviderOperation struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// ProviderOperationsMetadata is provider Operations metadata +type ProviderOperationsMetadata struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + ResourceTypes *[]ResourceType `json:"resourceTypes,omitempty"` + Operations *[]ProviderOperation `json:"operations,omitempty"` +} + +// ProviderOperationsMetadataListResult is provider operations metadata list +type ProviderOperationsMetadataListResult struct { + autorest.Response `json:"-"` + Value *[]ProviderOperationsMetadata `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProviderOperationsMetadataListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProviderOperationsMetadataListResult) ProviderOperationsMetadataListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResourceType is resource Type +type ResourceType struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Operations *[]ProviderOperation `json:"operations,omitempty"` +} + +// RoleAssignment is role Assignments +type RoleAssignment struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Properties *RoleAssignmentPropertiesWithScope `json:"properties,omitempty"` +} + +// RoleAssignmentCreateParameters is role assignment create parameters. +type RoleAssignmentCreateParameters struct { + Properties *RoleAssignmentProperties `json:"properties,omitempty"` +} + +// RoleAssignmentFilter is role Assignments filter +type RoleAssignmentFilter struct { + PrincipalID *string `json:"principalId,omitempty"` +} + +// RoleAssignmentListResult is role assignment list operation result. +type RoleAssignmentListResult struct { + autorest.Response `json:"-"` + Value *[]RoleAssignment `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleAssignmentListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RoleAssignmentListResult) RoleAssignmentListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RoleAssignmentProperties is role assignment properties. +type RoleAssignmentProperties struct { + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` +} + +// RoleAssignmentPropertiesWithScope is role assignment properties with scope. +type RoleAssignmentPropertiesWithScope struct { + Scope *string `json:"scope,omitempty"` + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` +} + +// RoleDefinition is role definition. +type RoleDefinition struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Properties *RoleDefinitionProperties `json:"properties,omitempty"` +} + +// RoleDefinitionFilter is role Definitions filter +type RoleDefinitionFilter struct { + RoleName *string `json:"roleName,omitempty"` +} + +// RoleDefinitionListResult is role definition list operation result. +type RoleDefinitionListResult struct { + autorest.Response `json:"-"` + Value *[]RoleDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleDefinitionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RoleDefinitionListResult) RoleDefinitionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RoleDefinitionProperties is role definition properties. +type RoleDefinitionProperties struct { + RoleName *string `json:"roleName,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + Permissions *[]Permission `json:"permissions,omitempty"` + AssignableScopes *[]string `json:"assignableScopes,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/permissions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/permissions.go index 6d8f2eb1d4..36abbb9c2c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/permissions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/permissions.go @@ -1,232 +1,232 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// PermissionsClient is the role based access control provides you a way to -// apply granular level policy administration down to individual resources or -// resource groups. These operations enable you to manage role definitions and -// role assignments. A role definition describes the set of actions that can be -// performed on resources. A role assignment grants access to Azure Active -// Directory users. -type PermissionsClient struct { - ManagementClient -} - -// NewPermissionsClient creates an instance of the PermissionsClient client. -func NewPermissionsClient(subscriptionID string) PermissionsClient { - return NewPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPermissionsClientWithBaseURI creates an instance of the PermissionsClient -// client. -func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { - return PermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListForResource gets all permissions the caller has for a resource. -// -// resourceGroupName is the name of the resource group containing the resource. -// The name is case insensitive. resourceProviderNamespace is the namespace of -// the resource provider. parentResourcePath is the parent resource identity. -// resourceType is the resource type of the resource. resourceName is the name -// of the resource to get the permissions for. -func (client PermissionsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResult, err error) { - req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure responding to request") - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client PermissionsClient) ListForResourcePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client PermissionsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client PermissionsClient) ListForResourceResponder(resp *http.Response) (result PermissionGetResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceNextResults retrieves the next set of results, if any. -func (client PermissionsClient) ListForResourceNextResults(lastResults PermissionGetResult) (result PermissionGetResult, err error) { - req, err := lastResults.PermissionGetResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure responding to next results request") - } - - return -} - -// ListForResourceGroup gets all permissions the caller has for a resource -// group. -// -// resourceGroupName is the name of the resource group to get the permissions -// for. The name is case insensitive. -func (client PermissionsClient) ListForResourceGroup(resourceGroupName string) (result PermissionGetResult, err error) { - req, err := client.ListForResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client PermissionsClient) ListForResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PermissionsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client PermissionsClient) ListForResourceGroupResponder(resp *http.Response) (result PermissionGetResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceGroupNextResults retrieves the next set of results, if any. -func (client PermissionsClient) ListForResourceGroupNextResults(lastResults PermissionGetResult) (result PermissionGetResult, err error) { - req, err := lastResults.PermissionGetResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// PermissionsClient is the role based access control provides you a way to +// apply granular level policy administration down to individual resources or +// resource groups. These operations enable you to manage role definitions and +// role assignments. A role definition describes the set of actions that can be +// performed on resources. A role assignment grants access to Azure Active +// Directory users. +type PermissionsClient struct { + ManagementClient +} + +// NewPermissionsClient creates an instance of the PermissionsClient client. +func NewPermissionsClient(subscriptionID string) PermissionsClient { + return NewPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPermissionsClientWithBaseURI creates an instance of the PermissionsClient +// client. +func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { + return PermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListForResource gets all permissions the caller has for a resource. +// +// resourceGroupName is the name of the resource group containing the resource. +// The name is case insensitive. resourceProviderNamespace is the namespace of +// the resource provider. parentResourcePath is the parent resource identity. +// resourceType is the resource type of the resource. resourceName is the name +// of the resource to get the permissions for. +func (client PermissionsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResult, err error) { + req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure responding to request") + } + + return +} + +// ListForResourcePreparer prepares the ListForResource request. +func (client PermissionsClient) ListForResourcePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceSender sends the ListForResource request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceResponder handles the response to the ListForResource request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListForResourceResponder(resp *http.Response) (result PermissionGetResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceNextResults retrieves the next set of results, if any. +func (client PermissionsClient) ListForResourceNextResults(lastResults PermissionGetResult) (result PermissionGetResult, err error) { + req, err := lastResults.PermissionGetResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure responding to next results request") + } + + return +} + +// ListForResourceGroup gets all permissions the caller has for a resource +// group. +// +// resourceGroupName is the name of the resource group to get the permissions +// for. The name is case insensitive. +func (client PermissionsClient) ListForResourceGroup(resourceGroupName string) (result PermissionGetResult, err error) { + req, err := client.ListForResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client PermissionsClient) ListForResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListForResourceGroupResponder(resp *http.Response) (result PermissionGetResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceGroupNextResults retrieves the next set of results, if any. +func (client PermissionsClient) ListForResourceGroupNextResults(lastResults PermissionGetResult) (result PermissionGetResult, err error) { + req, err := lastResults.PermissionGetResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/provideroperationsmetadata.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/provideroperationsmetadata.go index 686a71e81c..5208637b55 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/provideroperationsmetadata.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/provideroperationsmetadata.go @@ -1,200 +1,200 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProviderOperationsMetadataClient is the role based access control provides -// you a way to apply granular level policy administration down to individual -// resources or resource groups. These operations enable you to manage role -// definitions and role assignments. A role definition describes the set of -// actions that can be performed on resources. A role assignment grants access -// to Azure Active Directory users. -type ProviderOperationsMetadataClient struct { - ManagementClient -} - -// NewProviderOperationsMetadataClient creates an instance of the -// ProviderOperationsMetadataClient client. -func NewProviderOperationsMetadataClient(subscriptionID string) ProviderOperationsMetadataClient { - return NewProviderOperationsMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProviderOperationsMetadataClientWithBaseURI creates an instance of the -// ProviderOperationsMetadataClient client. -func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsMetadataClient { - return ProviderOperationsMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets provider operations metadata for the specified resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider. expand -// is specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) Get(resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { - req, err := client.GetPreparer(resourceProviderNamespace, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProviderOperationsMetadataClient) GetPreparer(resourceProviderNamespace string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderOperationsMetadataClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) (result ProviderOperationsMetadata, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets provider operations metadata for all resource providers. -// -// expand is specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) List(expand string) (result ProviderOperationsMetadataListResult, err error) { - req, err := client.ListPreparer(expand) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProviderOperationsMetadataClient) ListPreparer(expand string) (*http.Request, error) { - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Authorization/providerOperations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderOperationsMetadataClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProviderOperationsMetadataClient) ListResponder(resp *http.Response) (result ProviderOperationsMetadataListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ProviderOperationsMetadataClient) ListNextResults(lastResults ProviderOperationsMetadataListResult) (result ProviderOperationsMetadataListResult, err error) { - req, err := lastResults.ProviderOperationsMetadataListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to next results request") - } - - return -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProviderOperationsMetadataClient is the role based access control provides +// you a way to apply granular level policy administration down to individual +// resources or resource groups. These operations enable you to manage role +// definitions and role assignments. A role definition describes the set of +// actions that can be performed on resources. A role assignment grants access +// to Azure Active Directory users. +type ProviderOperationsMetadataClient struct { + ManagementClient +} + +// NewProviderOperationsMetadataClient creates an instance of the +// ProviderOperationsMetadataClient client. +func NewProviderOperationsMetadataClient(subscriptionID string) ProviderOperationsMetadataClient { + return NewProviderOperationsMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderOperationsMetadataClientWithBaseURI creates an instance of the +// ProviderOperationsMetadataClient client. +func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsMetadataClient { + return ProviderOperationsMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets provider operations metadata for the specified resource provider. +// +// resourceProviderNamespace is the namespace of the resource provider. expand +// is specifies whether to expand the values. +func (client ProviderOperationsMetadataClient) Get(resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { + req, err := client.GetPreparer(resourceProviderNamespace, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProviderOperationsMetadataClient) GetPreparer(resourceProviderNamespace string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderOperationsMetadataClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) (result ProviderOperationsMetadata, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets provider operations metadata for all resource providers. +// +// expand is specifies whether to expand the values. +func (client ProviderOperationsMetadataClient) List(expand string) (result ProviderOperationsMetadataListResult, err error) { + req, err := client.ListPreparer(expand) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ProviderOperationsMetadataClient) ListPreparer(expand string) (*http.Request, error) { + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Authorization/providerOperations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderOperationsMetadataClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProviderOperationsMetadataClient) ListResponder(resp *http.Response) (result ProviderOperationsMetadataListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ProviderOperationsMetadataClient) ListNextResults(lastResults ProviderOperationsMetadataListResult) (result ProviderOperationsMetadataListResult, err error) { + req, err := lastResults.ProviderOperationsMetadataListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roleassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roleassignments.go index 02b17a5046..6f02c9550d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roleassignments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roleassignments.go @@ -1,825 +1,825 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RoleAssignmentsClient is the role based access control provides you a way to -// apply granular level policy administration down to individual resources or -// resource groups. These operations enable you to manage role definitions and -// role assignments. A role definition describes the set of actions that can be -// performed on resources. A role assignment grants access to Azure Active -// Directory users. -type RoleAssignmentsClient struct { - ManagementClient -} - -// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient -// client. -func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { - return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoleAssignmentsClientWithBaseURI creates an instance of the -// RoleAssignmentsClient client. -func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { - return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a role assignment. -// -// scope is the scope of the role assignment to create. The scope can be any -// REST resource instance. For example, use '/subscriptions/{subscription-id}/' -// for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for -// a resource group, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' -// for a resource. roleAssignmentName is the name of the role assignment to -// create. It can be any valid GUID. parameters is parameters for the role -// assignment. -func (client RoleAssignmentsClient) Create(scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { - req, err := client.CreatePreparer(scope, roleAssignmentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RoleAssignmentsClient) CreatePreparer(scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentName": autorest.Encode("path", roleAssignmentName), - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) CreateResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateByID creates a role assignment by ID. -// -// roleAssignmentID is the ID of the role assignment to create. parameters is -// parameters for the role assignment. -func (client RoleAssignmentsClient) CreateByID(roleAssignmentID string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { - req, err := client.CreateByIDPreparer(roleAssignmentID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", nil, "Failure preparing request") - return - } - - resp, err := client.CreateByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure sending request") - return - } - - result, err = client.CreateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure responding to request") - } - - return -} - -// CreateByIDPreparer prepares the CreateByID request. -func (client RoleAssignmentsClient) CreateByIDPreparer(roleAssignmentID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentId": roleAssignmentID, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateByIDSender sends the CreateByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateByIDResponder handles the response to the CreateByID request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) CreateByIDResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a role assignment. -// -// scope is the scope of the role assignment to delete. roleAssignmentName is -// the name of the role assignment to delete. -func (client RoleAssignmentsClient) Delete(scope string, roleAssignmentName string) (result RoleAssignment, err error) { - req, err := client.DeletePreparer(scope, roleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RoleAssignmentsClient) DeletePreparer(scope string, roleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentName": autorest.Encode("path", roleAssignmentName), - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteByID deletes a role assignment. -// -// roleAssignmentID is the ID of the role assignment to delete. -func (client RoleAssignmentsClient) DeleteByID(roleAssignmentID string) (result RoleAssignment, err error) { - req, err := client.DeleteByIDPreparer(roleAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure sending request") - return - } - - result, err = client.DeleteByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure responding to request") - } - - return -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client RoleAssignmentsClient) DeleteByIDPreparer(roleAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentId": roleAssignmentID, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the specified role assignment. -// -// scope is the scope of the role assignment. roleAssignmentName is the name of -// the role assignment to get. -func (client RoleAssignmentsClient) Get(scope string, roleAssignmentName string) (result RoleAssignment, err error) { - req, err := client.GetPreparer(scope, roleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RoleAssignmentsClient) GetPreparer(scope string, roleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentName": autorest.Encode("path", roleAssignmentName), - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a role assignment by ID. -// -// roleAssignmentID is the ID of the role assignment to get. -func (client RoleAssignmentsClient) GetByID(roleAssignmentID string) (result RoleAssignment, err error) { - req, err := client.GetByIDPreparer(roleAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure responding to request") - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client RoleAssignmentsClient) GetByIDPreparer(roleAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentId": roleAssignmentID, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) GetByIDResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all role assignments for the subscription. -// -// filter is the filter to apply on the operation. Use $filter=atScope() to -// return all role assignments at or above the scope. Use $filter=principalId -// eq {id} to return all role assignments at, above or below the scope for the -// specified principal. -func (client RoleAssignmentsClient) List(filter string) (result RoleAssignmentListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RoleAssignmentsClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) ListNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.RoleAssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListForResource gets role assignments for a resource. -// -// resourceGroupName is the name of the resource group. -// resourceProviderNamespace is the namespace of the resource provider. -// parentResourcePath is the parent resource identity. resourceType is the -// resource type of the resource. resourceName is the name of the resource to -// get role assignments for. filter is the filter to apply on the operation. -// Use $filter=atScope() to return all role assignments at or above the scope. -// Use $filter=principalId eq {id} to return all role assignments at, above or -// below the scope for the specified principal. -func (client RoleAssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result RoleAssignmentListResult, err error) { - req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure responding to request") - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client RoleAssignmentsClient) ListForResourcePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListForResourceResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) ListForResourceNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.RoleAssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure responding to next results request") - } - - return -} - -// ListForResourceGroup gets role assignments for a resource group. -// -// resourceGroupName is the name of the resource group. filter is the filter to -// apply on the operation. Use $filter=atScope() to return all role assignments -// at or above the scope. Use $filter=principalId eq {id} to return all role -// assignments at, above or below the scope for the specified principal. -func (client RoleAssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result RoleAssignmentListResult, err error) { - req, err := client.ListForResourceGroupPreparer(resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client RoleAssignmentsClient) ListForResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceGroupNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) ListForResourceGroupNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.RoleAssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListForScope gets role assignments for a scope. -// -// scope is the scope of the role assignments. filter is the filter to apply on -// the operation. Use $filter=atScope() to return all role assignments at or -// above the scope. Use $filter=principalId eq {id} to return all role -// assignments at, above or below the scope for the specified principal. -func (client RoleAssignmentsClient) ListForScope(scope string, filter string) (result RoleAssignmentListResult, err error) { - req, err := client.ListForScopePreparer(scope, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListForScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure sending request") - return - } - - result, err = client.ListForScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure responding to request") - } - - return -} - -// ListForScopePreparer prepares the ListForScope request. -func (client RoleAssignmentsClient) ListForScopePreparer(scope string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForScopeSender sends the ListForScope request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForScopeResponder handles the response to the ListForScope request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForScopeNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) ListForScopeNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.RoleAssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure sending next results request") - } - - result, err = client.ListForScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure responding to next results request") - } - - return -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RoleAssignmentsClient is the role based access control provides you a way to +// apply granular level policy administration down to individual resources or +// resource groups. These operations enable you to manage role definitions and +// role assignments. A role definition describes the set of actions that can be +// performed on resources. A role assignment grants access to Azure Active +// Directory users. +type RoleAssignmentsClient struct { + ManagementClient +} + +// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient +// client. +func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { + return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentsClientWithBaseURI creates an instance of the +// RoleAssignmentsClient client. +func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { + return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a role assignment. +// +// scope is the scope of the role assignment to create. The scope can be any +// REST resource instance. For example, use '/subscriptions/{subscription-id}/' +// for a subscription, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// a resource group, and +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. roleAssignmentName is the name of the role assignment to +// create. It can be any valid GUID. parameters is parameters for the role +// assignment. +func (client RoleAssignmentsClient) Create(scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { + req, err := client.CreatePreparer(scope, roleAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoleAssignmentsClient) CreatePreparer(scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": autorest.Encode("path", roleAssignmentName), + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) CreateResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateByID creates a role assignment by ID. +// +// roleAssignmentID is the ID of the role assignment to create. parameters is +// parameters for the role assignment. +func (client RoleAssignmentsClient) CreateByID(roleAssignmentID string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { + req, err := client.CreateByIDPreparer(roleAssignmentID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure responding to request") + } + + return +} + +// CreateByIDPreparer prepares the CreateByID request. +func (client RoleAssignmentsClient) CreateByIDPreparer(roleAssignmentID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateByIDSender sends the CreateByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateByIDResponder handles the response to the CreateByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) CreateByIDResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a role assignment. +// +// scope is the scope of the role assignment to delete. roleAssignmentName is +// the name of the role assignment to delete. +func (client RoleAssignmentsClient) Delete(scope string, roleAssignmentName string) (result RoleAssignment, err error) { + req, err := client.DeletePreparer(scope, roleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleAssignmentsClient) DeletePreparer(scope string, roleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": autorest.Encode("path", roleAssignmentName), + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByID deletes a role assignment. +// +// roleAssignmentID is the ID of the role assignment to delete. +func (client RoleAssignmentsClient) DeleteByID(roleAssignmentID string) (result RoleAssignment, err error) { + req, err := client.DeleteByIDPreparer(roleAssignmentID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure responding to request") + } + + return +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client RoleAssignmentsClient) DeleteByIDPreparer(roleAssignmentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteByIDSender sends the DeleteByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteByIDResponder handles the response to the DeleteByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the specified role assignment. +// +// scope is the scope of the role assignment. roleAssignmentName is the name of +// the role assignment to get. +func (client RoleAssignmentsClient) Get(scope string, roleAssignmentName string) (result RoleAssignment, err error) { + req, err := client.GetPreparer(scope, roleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleAssignmentsClient) GetPreparer(scope string, roleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": autorest.Encode("path", roleAssignmentName), + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID gets a role assignment by ID. +// +// roleAssignmentID is the ID of the role assignment to get. +func (client RoleAssignmentsClient) GetByID(roleAssignmentID string) (result RoleAssignment, err error) { + req, err := client.GetByIDPreparer(roleAssignmentID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure responding to request") + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client RoleAssignmentsClient) GetByIDPreparer(roleAssignmentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetByIDResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all role assignments for the subscription. +// +// filter is the filter to apply on the operation. Use $filter=atScope() to +// return all role assignments at or above the scope. Use $filter=principalId +// eq {id} to return all role assignments at, above or below the scope for the +// specified principal. +func (client RoleAssignmentsClient) List(filter string) (result RoleAssignmentListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RoleAssignmentsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) ListNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.RoleAssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListForResource gets role assignments for a resource. +// +// resourceGroupName is the name of the resource group. +// resourceProviderNamespace is the namespace of the resource provider. +// parentResourcePath is the parent resource identity. resourceType is the +// resource type of the resource. resourceName is the name of the resource to +// get role assignments for. filter is the filter to apply on the operation. +// Use $filter=atScope() to return all role assignments at or above the scope. +// Use $filter=principalId eq {id} to return all role assignments at, above or +// below the scope for the specified principal. +func (client RoleAssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result RoleAssignmentListResult, err error) { + req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure responding to request") + } + + return +} + +// ListForResourcePreparer prepares the ListForResource request. +func (client RoleAssignmentsClient) ListForResourcePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceSender sends the ListForResource request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceResponder handles the response to the ListForResource request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForResourceResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) ListForResourceNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.RoleAssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure responding to next results request") + } + + return +} + +// ListForResourceGroup gets role assignments for a resource group. +// +// resourceGroupName is the name of the resource group. filter is the filter to +// apply on the operation. Use $filter=atScope() to return all role assignments +// at or above the scope. Use $filter=principalId eq {id} to return all role +// assignments at, above or below the scope for the specified principal. +func (client RoleAssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result RoleAssignmentListResult, err error) { + req, err := client.ListForResourceGroupPreparer(resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client RoleAssignmentsClient) ListForResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceGroupNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) ListForResourceGroupNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.RoleAssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListForScope gets role assignments for a scope. +// +// scope is the scope of the role assignments. filter is the filter to apply on +// the operation. Use $filter=atScope() to return all role assignments at or +// above the scope. Use $filter=principalId eq {id} to return all role +// assignments at, above or below the scope for the specified principal. +func (client RoleAssignmentsClient) ListForScope(scope string, filter string) (result RoleAssignmentListResult, err error) { + req, err := client.ListForScopePreparer(scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure sending request") + return + } + + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure responding to request") + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleAssignmentsClient) ListForScopePreparer(scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScopeNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) ListForScopeNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.RoleAssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure sending next results request") + } + + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roledefinitions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roledefinitions.go index f03566906d..cdd9efc22a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roledefinitions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/roledefinitions.go @@ -1,399 +1,399 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RoleDefinitionsClient is the role based access control provides you a way to -// apply granular level policy administration down to individual resources or -// resource groups. These operations enable you to manage role definitions and -// role assignments. A role definition describes the set of actions that can be -// performed on resources. A role assignment grants access to Azure Active -// Directory users. -type RoleDefinitionsClient struct { - ManagementClient -} - -// NewRoleDefinitionsClient creates an instance of the RoleDefinitionsClient -// client. -func NewRoleDefinitionsClient(subscriptionID string) RoleDefinitionsClient { - return NewRoleDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoleDefinitionsClientWithBaseURI creates an instance of the -// RoleDefinitionsClient client. -func NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) RoleDefinitionsClient { - return RoleDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a role definition. -// -// scope is the scope of the role definition. roleDefinitionID is the ID of the -// role definition. roleDefinition is the values for the role definition. -func (client RoleDefinitionsClient) CreateOrUpdate(scope string, roleDefinitionID string, roleDefinition RoleDefinition) (result RoleDefinition, err error) { - req, err := client.CreateOrUpdatePreparer(scope, roleDefinitionID, roleDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RoleDefinitionsClient) CreateOrUpdatePreparer(scope string, roleDefinitionID string, roleDefinition RoleDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithJSON(roleDefinition), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a role definition. -// -// scope is the scope of the role definition. roleDefinitionID is the ID of the -// role definition to delete. -func (client RoleDefinitionsClient) Delete(scope string, roleDefinitionID string) (result RoleDefinition, err error) { - req, err := client.DeletePreparer(scope, roleDefinitionID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RoleDefinitionsClient) DeletePreparer(scope string, roleDefinitionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get role definition by name (GUID). -// -// scope is the scope of the role definition. roleDefinitionID is the ID of the -// role definition. -func (client RoleDefinitionsClient) Get(scope string, roleDefinitionID string) (result RoleDefinition, err error) { - req, err := client.GetPreparer(scope, roleDefinitionID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RoleDefinitionsClient) GetPreparer(scope string, roleDefinitionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) GetResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a role definition by ID. -// -// roleDefinitionID is the fully qualified role definition ID to get. -func (client RoleDefinitionsClient) GetByID(roleDefinitionID string) (result RoleDefinition, err error) { - req, err := client.GetByIDPreparer(roleDefinitionID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure responding to request") - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client RoleDefinitionsClient) GetByIDPreparer(roleDefinitionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": roleDefinitionID, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) GetByIDResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all role definitions that are applicable at scope and above. -// -// scope is the scope of the role definition. filter is the filter to apply on -// the operation. Use atScopeAndBelow filter to search below the given scope as -// well. -func (client RoleDefinitionsClient) List(scope string, filter string) (result RoleDefinitionListResult, err error) { - req, err := client.ListPreparer(scope, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RoleDefinitionsClient) ListPreparer(scope string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RoleDefinitionsClient) ListNextResults(lastResults RoleDefinitionListResult) (result RoleDefinitionListResult, err error) { - req, err := lastResults.RoleDefinitionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RoleDefinitionsClient is the role based access control provides you a way to +// apply granular level policy administration down to individual resources or +// resource groups. These operations enable you to manage role definitions and +// role assignments. A role definition describes the set of actions that can be +// performed on resources. A role assignment grants access to Azure Active +// Directory users. +type RoleDefinitionsClient struct { + ManagementClient +} + +// NewRoleDefinitionsClient creates an instance of the RoleDefinitionsClient +// client. +func NewRoleDefinitionsClient(subscriptionID string) RoleDefinitionsClient { + return NewRoleDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleDefinitionsClientWithBaseURI creates an instance of the +// RoleDefinitionsClient client. +func NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) RoleDefinitionsClient { + return RoleDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a role definition. +// +// scope is the scope of the role definition. roleDefinitionID is the ID of the +// role definition. roleDefinition is the values for the role definition. +func (client RoleDefinitionsClient) CreateOrUpdate(scope string, roleDefinitionID string, roleDefinition RoleDefinition) (result RoleDefinition, err error) { + req, err := client.CreateOrUpdatePreparer(scope, roleDefinitionID, roleDefinition) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RoleDefinitionsClient) CreateOrUpdatePreparer(scope string, roleDefinitionID string, roleDefinition RoleDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), + autorest.WithJSON(roleDefinition), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a role definition. +// +// scope is the scope of the role definition. roleDefinitionID is the ID of the +// role definition to delete. +func (client RoleDefinitionsClient) Delete(scope string, roleDefinitionID string) (result RoleDefinition, err error) { + req, err := client.DeletePreparer(scope, roleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleDefinitionsClient) DeletePreparer(scope string, roleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get role definition by name (GUID). +// +// scope is the scope of the role definition. roleDefinitionID is the ID of the +// role definition. +func (client RoleDefinitionsClient) Get(scope string, roleDefinitionID string) (result RoleDefinition, err error) { + req, err := client.GetPreparer(scope, roleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleDefinitionsClient) GetPreparer(scope string, roleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID gets a role definition by ID. +// +// roleDefinitionID is the fully qualified role definition ID to get. +func (client RoleDefinitionsClient) GetByID(roleDefinitionID string) (result RoleDefinition, err error) { + req, err := client.GetByIDPreparer(roleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure responding to request") + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client RoleDefinitionsClient) GetByIDPreparer(roleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": roleDefinitionID, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleDefinitionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetByIDResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all role definitions that are applicable at scope and above. +// +// scope is the scope of the role definition. filter is the filter to apply on +// the operation. Use atScopeAndBelow filter to search below the given scope as +// well. +func (client RoleDefinitionsClient) List(scope string, filter string) (result RoleDefinitionListResult, err error) { + req, err := client.ListPreparer(scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RoleDefinitionsClient) ListPreparer(scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RoleDefinitionsClient) ListNextResults(lastResults RoleDefinitionListResult) (result RoleDefinitionListResult, err error) { + req, err := lastResults.RoleDefinitionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/version.go index fa6e7332ab..f6b65dcd35 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/authorization/version.go @@ -1,29 +1,29 @@ -package authorization - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-authorization/2015-07-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package authorization + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-authorization/2015-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/account.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/account.go index 40062d3442..e651973d5f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/account.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/account.go @@ -1,514 +1,514 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AccountClient is the composite Swagger json for Azure Automation Client -type AccountClient struct { - ManagementClient -} - -// NewAccountClient creates an instance of the AccountClient client. -func NewAccountClient(subscriptionID string) AccountClient { - return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountClientWithBaseURI creates an instance of the AccountClient client. -func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { - return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update automation account. -// -// resourceGroupName is the resource group name. automationAccountName is -// parameters supplied to the create or update automation account. parameters -// is parameters supplied to the create or update automation account. -func (client AccountClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AccountClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an automation account. -// -// resourceGroupName is the resource group name. automationAccountName is -// automation account name. -func (client AccountClient) Delete(resourceGroupName string, automationAccountName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get information about an Automation Account. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client AccountClient) Get(resourceGroupName string, automationAccountName string) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List retrieve a list of accounts within a given subscription. -func (client AccountClient) List() (result AccountListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AccountClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.AccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.AccountClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup retrieve a list of accounts within a given resource -// group. -// -// resourceGroupName is the resource group name. -func (client AccountClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.AccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update update an automation account. -// -// resourceGroupName is the resource group name. automationAccountName is -// automation account name. parameters is parameters supplied to the update -// automation account. -func (client AccountClient) Update(resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AccountClient is the composite Swagger json for Azure Automation Client +type AccountClient struct { + ManagementClient +} + +// NewAccountClient creates an instance of the AccountClient client. +func NewAccountClient(subscriptionID string) AccountClient { + return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountClientWithBaseURI creates an instance of the AccountClient client. +func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { + return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update automation account. +// +// resourceGroupName is the resource group name. automationAccountName is +// parameters supplied to the create or update automation account. parameters +// is parameters supplied to the create or update automation account. +func (client AccountClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AccountClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, parameters AccountCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AccountClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an automation account. +// +// resourceGroupName is the resource group name. automationAccountName is +// automation account name. +func (client AccountClient) Delete(resourceGroupName string, automationAccountName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountClient) DeletePreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get information about an Automation Account. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client AccountClient) Get(resourceGroupName string, automationAccountName string) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountClient) GetPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieve a list of accounts within a given subscription. +func (client AccountClient) List() (result AccountListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AccountClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.AccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.AccountClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup retrieve a list of accounts within a given resource +// group. +// +// resourceGroupName is the resource group name. +func (client AccountClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AccountClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.AccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update update an automation account. +// +// resourceGroupName is the resource group name. automationAccountName is +// automation account name. parameters is parameters supplied to the update +// automation account. +func (client AccountClient) Update(resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AccountClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AccountClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountClient) UpdatePreparer(resourceGroupName string, automationAccountName string, parameters AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/activity.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/activity.go index 25ea3c3070..a103e55443 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/activity.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/activity.go @@ -1,216 +1,216 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ActivityClient is the composite Swagger json for Azure Automation Client -type ActivityClient struct { - ManagementClient -} - -// NewActivityClient creates an instance of the ActivityClient client. -func NewActivityClient(subscriptionID string) ActivityClient { - return NewActivityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityClientWithBaseURI creates an instance of the ActivityClient -// client. -func NewActivityClientWithBaseURI(baseURI string, subscriptionID string) ActivityClient { - return ActivityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the activity in the module identified by module name and -// activity name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the name of module. activityName is -// the name of activity. -func (client ActivityClient) Get(resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result Activity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ActivityClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, moduleName, activityName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityClient) GetPreparer(resourceGroupName string, automationAccountName string, moduleName string, activityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityName": autorest.Encode("path", activityName), - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ActivityClient) GetResponder(resp *http.Response) (result Activity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByModule retrieve a list of activities in the module identified by -// module name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the name of module. -func (client ActivityClient) ListByModule(resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ActivityClient", "ListByModule") - } - - req, err := client.ListByModulePreparer(resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByModuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending request") - return - } - - result, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to request") - } - - return -} - -// ListByModulePreparer prepares the ListByModule request. -func (client ActivityClient) ListByModulePreparer(resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByModuleSender sends the ListByModule request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityClient) ListByModuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByModuleResponder handles the response to the ListByModule request. The method always -// closes the http.Response Body. -func (client ActivityClient) ListByModuleResponder(resp *http.Response) (result ActivityListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByModuleNextResults retrieves the next set of results, if any. -func (client ActivityClient) ListByModuleNextResults(lastResults ActivityListResult) (result ActivityListResult, err error) { - req, err := lastResults.ActivityListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByModuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending next results request") - } - - result, err = client.ListByModuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ActivityClient is the composite Swagger json for Azure Automation Client +type ActivityClient struct { + ManagementClient +} + +// NewActivityClient creates an instance of the ActivityClient client. +func NewActivityClient(subscriptionID string) ActivityClient { + return NewActivityClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActivityClientWithBaseURI creates an instance of the ActivityClient +// client. +func NewActivityClientWithBaseURI(baseURI string, subscriptionID string) ActivityClient { + return ActivityClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieve the activity in the module identified by module name and +// activity name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the name of module. activityName is +// the name of activity. +func (client ActivityClient) Get(resourceGroupName string, automationAccountName string, moduleName string, activityName string) (result Activity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ActivityClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, moduleName, activityName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActivityClient) GetPreparer(resourceGroupName string, automationAccountName string, moduleName string, activityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityName": autorest.Encode("path", activityName), + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ActivityClient) GetResponder(resp *http.Response) (result Activity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByModule retrieve a list of activities in the module identified by +// module name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the name of module. +func (client ActivityClient) ListByModule(resourceGroupName string, automationAccountName string, moduleName string) (result ActivityListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ActivityClient", "ListByModule") + } + + req, err := client.ListByModulePreparer(resourceGroupName, automationAccountName, moduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByModuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending request") + return + } + + result, err = client.ListByModuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to request") + } + + return +} + +// ListByModulePreparer prepares the ListByModule request. +func (client ActivityClient) ListByModulePreparer(resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByModuleSender sends the ListByModule request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityClient) ListByModuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByModuleResponder handles the response to the ListByModule request. The method always +// closes the http.Response Body. +func (client ActivityClient) ListByModuleResponder(resp *http.Response) (result ActivityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByModuleNextResults retrieves the next set of results, if any. +func (client ActivityClient) ListByModuleNextResults(lastResults ActivityListResult) (result ActivityListResult, err error) { + req, err := lastResults.ActivityListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByModuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure sending next results request") + } + + result, err = client.ListByModuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ActivityClient", "ListByModule", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/agentregistrationinformation.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/agentregistrationinformation.go index d893932e8a..02d16325ca 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/agentregistrationinformation.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/agentregistrationinformation.go @@ -1,191 +1,191 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AgentRegistrationInformationClient is the composite Swagger json for Azure -// Automation Client -type AgentRegistrationInformationClient struct { - ManagementClient -} - -// NewAgentRegistrationInformationClient creates an instance of the -// AgentRegistrationInformationClient client. -func NewAgentRegistrationInformationClient(subscriptionID string) AgentRegistrationInformationClient { - return NewAgentRegistrationInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgentRegistrationInformationClientWithBaseURI creates an instance of the -// AgentRegistrationInformationClient client. -func NewAgentRegistrationInformationClientWithBaseURI(baseURI string, subscriptionID string) AgentRegistrationInformationClient { - return AgentRegistrationInformationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the automation agent registration information. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client AgentRegistrationInformationClient) Get(resourceGroupName string, automationAccountName string) (result AgentRegistration, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AgentRegistrationInformationClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgentRegistrationInformationClient) GetPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AgentRegistrationInformationClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AgentRegistrationInformationClient) GetResponder(resp *http.Response) (result AgentRegistration, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate a primary or secondary agent registration key -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. parameters is the name of the agent registration -// key to be regenerated -func (client AgentRegistrationInformationClient) RegenerateKey(resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (result AgentRegistration, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey") - } - - req, err := client.RegenerateKeyPreparer(resourceGroupName, automationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AgentRegistrationInformationClient) RegenerateKeyPreparer(resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AgentRegistrationInformationClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AgentRegistrationInformationClient) RegenerateKeyResponder(resp *http.Response) (result AgentRegistration, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AgentRegistrationInformationClient is the composite Swagger json for Azure +// Automation Client +type AgentRegistrationInformationClient struct { + ManagementClient +} + +// NewAgentRegistrationInformationClient creates an instance of the +// AgentRegistrationInformationClient client. +func NewAgentRegistrationInformationClient(subscriptionID string) AgentRegistrationInformationClient { + return NewAgentRegistrationInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgentRegistrationInformationClientWithBaseURI creates an instance of the +// AgentRegistrationInformationClient client. +func NewAgentRegistrationInformationClientWithBaseURI(baseURI string, subscriptionID string) AgentRegistrationInformationClient { + return AgentRegistrationInformationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieve the automation agent registration information. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client AgentRegistrationInformationClient) Get(resourceGroupName string, automationAccountName string) (result AgentRegistration, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AgentRegistrationInformationClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgentRegistrationInformationClient) GetPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AgentRegistrationInformationClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AgentRegistrationInformationClient) GetResponder(resp *http.Response) (result AgentRegistration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate a primary or secondary agent registration key +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. parameters is the name of the agent registration +// key to be regenerated +func (client AgentRegistrationInformationClient) RegenerateKey(resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (result AgentRegistration, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey") + } + + req, err := client.RegenerateKeyPreparer(resourceGroupName, automationAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.AgentRegistrationInformationClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AgentRegistrationInformationClient) RegenerateKeyPreparer(resourceGroupName string, automationAccountName string, parameters AgentRegistrationRegenerateKeyParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AgentRegistrationInformationClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AgentRegistrationInformationClient) RegenerateKeyResponder(resp *http.Response) (result AgentRegistration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/certificate.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/certificate.go index cc31392fb2..368c73d49f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/certificate.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/certificate.go @@ -1,441 +1,441 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CertificateClient is the composite Swagger json for Azure Automation Client -type CertificateClient struct { - ManagementClient -} - -// NewCertificateClient creates an instance of the CertificateClient client. -func NewCertificateClient(subscriptionID string) CertificateClient { - return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificateClientWithBaseURI creates an instance of the CertificateClient -// client. -func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { - return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a certificate. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. certificateName is the parameters supplied to the -// create or update certificate operation. parameters is the parameters -// supplied to the create or update certificate operation. -func (client CertificateClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (result Certificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Base64Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificateClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the certificate. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. certificateName is the name of certificate. -func (client CertificateClient) Delete(resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificateClient) DeletePreparer(resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the certificate identified by certificate name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. certificateName is the name of certificate. -func (client CertificateClient) Get(resourceGroupName string, automationAccountName string, certificateName string) (result Certificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificateClient) GetPreparer(resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of certificates. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client CertificateClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result CertificateListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CertificateClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CertificateClient) ListByAutomationAccountResponder(resp *http.Response) (result CertificateListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CertificateClient) ListByAutomationAccountNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.CertificateListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update a certificate. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. certificateName is the parameters supplied to the -// update certificate operation. parameters is the parameters supplied to the -// update certificate operation. -func (client CertificateClient) Update(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (result Certificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificateClient) UpdatePreparer(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "certificateName": autorest.Encode("path", certificateName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CertificateClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CertificateClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CertificateClient is the composite Swagger json for Azure Automation Client +type CertificateClient struct { + ManagementClient +} + +// NewCertificateClient creates an instance of the CertificateClient client. +func NewCertificateClient(subscriptionID string) CertificateClient { + return NewCertificateClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificateClientWithBaseURI creates an instance of the CertificateClient +// client. +func NewCertificateClientWithBaseURI(baseURI string, subscriptionID string) CertificateClient { + return CertificateClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a certificate. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. certificateName is the parameters supplied to the +// create or update certificate operation. parameters is the parameters +// supplied to the create or update certificate operation. +func (client CertificateClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CertificateCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.CertificateCreateOrUpdateProperties.Base64Value", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificateClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificateClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the certificate. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. certificateName is the name of certificate. +func (client CertificateClient) Delete(resourceGroupName string, automationAccountName string, certificateName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificateClient) DeletePreparer(resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificateClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the certificate identified by certificate name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. certificateName is the name of certificate. +func (client CertificateClient) Get(resourceGroupName string, automationAccountName string, certificateName string) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificateClient) GetPreparer(resourceGroupName string, automationAccountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificateClient) GetResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of certificates. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client CertificateClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result CertificateListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client CertificateClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client CertificateClient) ListByAutomationAccountResponder(resp *http.Response) (result CertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client CertificateClient) ListByAutomationAccountNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.CertificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update a certificate. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. certificateName is the parameters supplied to the +// update certificate operation. parameters is the parameters supplied to the +// update certificate operation. +func (client CertificateClient) Update(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CertificateClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CertificateClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CertificateClient) UpdatePreparer(resourceGroupName string, automationAccountName string, certificateName string, parameters CertificateUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CertificateClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CertificateClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/client.go index d157c96a55..4d2bf5c16e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/client.go @@ -1,52 +1,52 @@ -// Package automation implements the Azure ARM Automation service API version . -// -// Composite Swagger json for Azure Automation Client -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Automation - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Automation. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package automation implements the Azure ARM Automation service API version . +// +// Composite Swagger json for Azure Automation Client +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Automation + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Automation. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connection.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connection.go index b86708c237..7d3300e5d0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connection.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connection.go @@ -1,442 +1,442 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ConnectionClient is the composite Swagger json for Azure Automation Client -type ConnectionClient struct { - ManagementClient -} - -// NewConnectionClient creates an instance of the ConnectionClient client. -func NewConnectionClient(subscriptionID string) ConnectionClient { - return NewConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionClientWithBaseURI creates an instance of the ConnectionClient -// client. -func NewConnectionClientWithBaseURI(baseURI string, subscriptionID string) ConnectionClient { - return ConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a connection. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionName is the parameters supplied to the -// create or update connection operation. parameters is the parameters supplied -// to the create or update connection operation. -func (client ConnectionClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (result Connection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionCreateOrUpdateProperties.ConnectionType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the connection. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionName is the name of connection. -func (client ConnectionClient) Delete(resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionClient) DeletePreparer(resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConnectionClient) DeleteResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the connection identified by connection name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionName is the name of connection. -func (client ConnectionClient) Get(resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, connectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionClient) GetPreparer(resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConnectionClient) GetResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connections. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client ConnectionClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ConnectionListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionClient) ListByAutomationAccountNextResults(lastResults ConnectionListResult) (result ConnectionListResult, err error) { - req, err := lastResults.ConnectionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update a connection. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionName is the parameters supplied to the -// update a connection operation. parameters is the parameters supplied to the -// update a connection operation. -func (client ConnectionClient) Update(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (result Connection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, connectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConnectionClient) UpdatePreparer(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionName": autorest.Encode("path", connectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ConnectionClient) UpdateResponder(resp *http.Response) (result Connection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ConnectionClient is the composite Swagger json for Azure Automation Client +type ConnectionClient struct { + ManagementClient +} + +// NewConnectionClient creates an instance of the ConnectionClient client. +func NewConnectionClient(subscriptionID string) ConnectionClient { + return NewConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectionClientWithBaseURI creates an instance of the ConnectionClient +// client. +func NewConnectionClientWithBaseURI(baseURI string, subscriptionID string) ConnectionClient { + return ConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a connection. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionName is the parameters supplied to the +// create or update connection operation. parameters is the parameters supplied +// to the create or update connection operation. +func (client ConnectionClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (result Connection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConnectionCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectionCreateOrUpdateProperties.ConnectionType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectionClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result Connection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the connection. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionName is the name of connection. +func (client ConnectionClient) Delete(resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectionClient) DeletePreparer(resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectionClient) DeleteResponder(resp *http.Response) (result Connection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve the connection identified by connection name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionName is the name of connection. +func (client ConnectionClient) Get(resourceGroupName string, automationAccountName string, connectionName string) (result Connection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectionClient) GetPreparer(resourceGroupName string, automationAccountName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectionClient) GetResponder(resp *http.Response) (result Connection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of connections. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client ConnectionClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ConnectionListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client ConnectionClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client ConnectionClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client ConnectionClient) ListByAutomationAccountNextResults(lastResults ConnectionListResult) (result ConnectionListResult, err error) { + req, err := lastResults.ConnectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update a connection. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionName is the parameters supplied to the +// update a connection operation. parameters is the parameters supplied to the +// update a connection operation. +func (client ConnectionClient) Update(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (result Connection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ConnectionClient) UpdatePreparer(resourceGroupName string, automationAccountName string, connectionName string, parameters ConnectionUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ConnectionClient) UpdateResponder(resp *http.Response) (result Connection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connectiontype.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connectiontype.go index 6cf07b3a5f..5e2effaf2e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connectiontype.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/connectiontype.go @@ -1,366 +1,366 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ConnectionTypeClient is the composite Swagger json for Azure Automation -// Client -type ConnectionTypeClient struct { - ManagementClient -} - -// NewConnectionTypeClient creates an instance of the ConnectionTypeClient -// client. -func NewConnectionTypeClient(subscriptionID string) ConnectionTypeClient { - return NewConnectionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectionTypeClientWithBaseURI creates an instance of the -// ConnectionTypeClient client. -func NewConnectionTypeClientWithBaseURI(baseURI string, subscriptionID string) ConnectionTypeClient { - return ConnectionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a connectiontype. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionTypeName is the parameters supplied to -// the create or update connectiontype operation. parameters is the parameters -// supplied to the create or update connectiontype operation. -func (client ConnectionTypeClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (result ConnectionType, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectionTypeCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectionTypeCreateOrUpdateProperties.FieldDefinitions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, connectionTypeName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectionTypeClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the connectiontype. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionTypeName is the name of connectiontype. -func (client ConnectionTypeClient) Delete(resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectionTypeClient) DeletePreparer(resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the connectiontype identified by connectiontype name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. connectionTypeName is the name of connectiontype. -func (client ConnectionTypeClient) Get(resourceGroupName string, automationAccountName string, connectionTypeName string) (result ConnectionType, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, connectionTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectionTypeClient) GetPreparer(resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "connectionTypeName": autorest.Encode("path", connectionTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) GetResponder(resp *http.Response) (result ConnectionType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of connectiontypes. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client ConnectionTypeClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ConnectionTypeListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ConnectionTypeClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectionTypeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ConnectionTypeClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionTypeListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ConnectionTypeClient) ListByAutomationAccountNextResults(lastResults ConnectionTypeListResult) (result ConnectionTypeListResult, err error) { - req, err := lastResults.ConnectionTypeListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ConnectionTypeClient is the composite Swagger json for Azure Automation +// Client +type ConnectionTypeClient struct { + ManagementClient +} + +// NewConnectionTypeClient creates an instance of the ConnectionTypeClient +// client. +func NewConnectionTypeClient(subscriptionID string) ConnectionTypeClient { + return NewConnectionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectionTypeClientWithBaseURI creates an instance of the +// ConnectionTypeClient client. +func NewConnectionTypeClientWithBaseURI(baseURI string, subscriptionID string) ConnectionTypeClient { + return ConnectionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a connectiontype. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionTypeName is the parameters supplied to +// the create or update connectiontype operation. parameters is the parameters +// supplied to the create or update connectiontype operation. +func (client ConnectionTypeClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (result ConnectionType, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConnectionTypeCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectionTypeCreateOrUpdateProperties.FieldDefinitions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, connectionTypeName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectionTypeClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, connectionTypeName string, parameters ConnectionTypeCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionTypeName": autorest.Encode("path", connectionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionTypeClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the connectiontype. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionTypeName is the name of connectiontype. +func (client ConnectionTypeClient) Delete(resourceGroupName string, automationAccountName string, connectionTypeName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, connectionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectionTypeClient) DeletePreparer(resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionTypeName": autorest.Encode("path", connectionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionTypeClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectionTypeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the connectiontype identified by connectiontype name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. connectionTypeName is the name of connectiontype. +func (client ConnectionTypeClient) Get(resourceGroupName string, automationAccountName string, connectionTypeName string) (result ConnectionType, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, connectionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectionTypeClient) GetPreparer(resourceGroupName string, automationAccountName string, connectionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "connectionTypeName": autorest.Encode("path", connectionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionTypeClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectionTypeClient) GetResponder(resp *http.Response) (result ConnectionType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of connectiontypes. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client ConnectionTypeClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ConnectionTypeListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client ConnectionTypeClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionTypeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client ConnectionTypeClient) ListByAutomationAccountResponder(resp *http.Response) (result ConnectionTypeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client ConnectionTypeClient) ListByAutomationAccountNextResults(lastResults ConnectionTypeListResult) (result ConnectionTypeListResult, err error) { + req, err := lastResults.ConnectionTypeListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ConnectionTypeClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/credential.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/credential.go index cf2e5ea3ab..5834f6ac00 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/credential.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/credential.go @@ -1,443 +1,443 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CredentialClient is the composite Swagger json for Azure Automation Client -type CredentialClient struct { - ManagementClient -} - -// NewCredentialClient creates an instance of the CredentialClient client. -func NewCredentialClient(subscriptionID string) CredentialClient { - return NewCredentialClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCredentialClientWithBaseURI creates an instance of the CredentialClient -// client. -func NewCredentialClientWithBaseURI(baseURI string, subscriptionID string) CredentialClient { - return CredentialClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a credential. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. credentialName is the parameters supplied to the -// create or update credential operation. parameters is the parameters supplied -// to the create or update credential operation. -func (client CredentialClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (result Credential, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CredentialCreateOrUpdateProperties.UserName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CredentialCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CredentialClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CredentialClient) CreateOrUpdateResponder(resp *http.Response) (result Credential, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the credential. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. credentialName is the name of credential. -func (client CredentialClient) Delete(resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CredentialClient) DeletePreparer(resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CredentialClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the credential identified by credential name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. credentialName is the name of credential. -func (client CredentialClient) Get(resourceGroupName string, automationAccountName string, credentialName string) (result Credential, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, credentialName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CredentialClient) GetPreparer(resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CredentialClient) GetResponder(resp *http.Response) (result Credential, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of credentials. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client CredentialClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result CredentialListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client CredentialClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client CredentialClient) ListByAutomationAccountResponder(resp *http.Response) (result CredentialListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client CredentialClient) ListByAutomationAccountNextResults(lastResults CredentialListResult) (result CredentialListResult, err error) { - req, err := lastResults.CredentialListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update a credential. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. credentialName is the parameters supplied to the -// Update credential operation. parameters is the parameters supplied to the -// Update credential operation. -func (client CredentialClient) Update(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (result Credential, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, credentialName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CredentialClient) UpdatePreparer(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "credentialName": autorest.Encode("path", credentialName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CredentialClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CredentialClient) UpdateResponder(resp *http.Response) (result Credential, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CredentialClient is the composite Swagger json for Azure Automation Client +type CredentialClient struct { + ManagementClient +} + +// NewCredentialClient creates an instance of the CredentialClient client. +func NewCredentialClient(subscriptionID string) CredentialClient { + return NewCredentialClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCredentialClientWithBaseURI creates an instance of the CredentialClient +// client. +func NewCredentialClientWithBaseURI(baseURI string, subscriptionID string) CredentialClient { + return CredentialClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a credential. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. credentialName is the parameters supplied to the +// create or update credential operation. parameters is the parameters supplied +// to the create or update credential operation. +func (client CredentialClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (result Credential, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CredentialCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.CredentialCreateOrUpdateProperties.UserName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CredentialCreateOrUpdateProperties.Password", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, credentialName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CredentialClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "credentialName": autorest.Encode("path", credentialName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CredentialClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CredentialClient) CreateOrUpdateResponder(resp *http.Response) (result Credential, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the credential. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. credentialName is the name of credential. +func (client CredentialClient) Delete(resourceGroupName string, automationAccountName string, credentialName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, credentialName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CredentialClient) DeletePreparer(resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "credentialName": autorest.Encode("path", credentialName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CredentialClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CredentialClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the credential identified by credential name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. credentialName is the name of credential. +func (client CredentialClient) Get(resourceGroupName string, automationAccountName string, credentialName string) (result Credential, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, credentialName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CredentialClient) GetPreparer(resourceGroupName string, automationAccountName string, credentialName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "credentialName": autorest.Encode("path", credentialName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CredentialClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CredentialClient) GetResponder(resp *http.Response) (result Credential, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of credentials. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client CredentialClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result CredentialListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client CredentialClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client CredentialClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client CredentialClient) ListByAutomationAccountResponder(resp *http.Response) (result CredentialListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client CredentialClient) ListByAutomationAccountNextResults(lastResults CredentialListResult) (result CredentialListResult, err error) { + req, err := lastResults.CredentialListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update a credential. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. credentialName is the parameters supplied to the +// Update credential operation. parameters is the parameters supplied to the +// Update credential operation. +func (client CredentialClient) Update(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (result Credential, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.CredentialClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, credentialName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.CredentialClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CredentialClient) UpdatePreparer(resourceGroupName string, automationAccountName string, credentialName string, parameters CredentialUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "credentialName": autorest.Encode("path", credentialName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CredentialClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CredentialClient) UpdateResponder(resp *http.Response) (result Credential, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dsccompilationjob.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dsccompilationjob.go index cc8a8e2653..15fe2346d7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dsccompilationjob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dsccompilationjob.go @@ -1,373 +1,373 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/uuid" - "net/http" -) - -// DscCompilationJobClient is the composite Swagger json for Azure Automation -// Client -type DscCompilationJobClient struct { - ManagementClient -} - -// NewDscCompilationJobClient creates an instance of the -// DscCompilationJobClient client. -func NewDscCompilationJobClient(subscriptionID string) DscCompilationJobClient { - return NewDscCompilationJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscCompilationJobClientWithBaseURI creates an instance of the -// DscCompilationJobClient client. -func NewDscCompilationJobClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobClient { - return DscCompilationJobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the Dsc compilation job of the configuration. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. compilationJobID is the the DSC configuration Id. -// parameters is the parameters supplied to the create compilation job -// operation. -func (client DscCompilationJobClient) Create(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters DscCompilationJobCreateParameters) (result DscCompilationJob, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, automationAccountName, compilationJobID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DscCompilationJobClient) CreatePreparer(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters DscCompilationJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobId": autorest.Encode("path", compilationJobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) CreateResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the Dsc configuration compilation job identified by job id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. compilationJobID is the Dsc configuration -// compilation job id. -func (client DscCompilationJobClient) Get(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (result DscCompilationJob, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, compilationJobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscCompilationJobClient) GetPreparer(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "compilationJobId": autorest.Encode("path", compilationJobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) GetResponder(resp *http.Response) (result DscCompilationJob, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStream retrieve the job stream identified by job stream id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. jobStreamID is the job stream -// id. -func (client DscCompilationJobClient) GetStream(resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result JobStream, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "GetStream") - } - - req, err := client.GetStreamPreparer(resourceGroupName, automationAccountName, jobID, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", nil, "Failure preparing request") - return - } - - resp, err := client.GetStreamSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure sending request") - return - } - - result, err = client.GetStreamResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure responding to request") - } - - return -} - -// GetStreamPreparer prepares the GetStream request. -func (client DscCompilationJobClient) GetStreamPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetStreamSender sends the GetStream request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) GetStreamSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetStreamResponder handles the response to the GetStream request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) GetStreamResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc compilation jobs. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. filter is the filter to apply on the operation. -func (client DscCompilationJobClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscCompilationJobClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscCompilationJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscCompilationJobClient) ListByAutomationAccountResponder(resp *http.Response) (result DscCompilationJobListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscCompilationJobClient) ListByAutomationAccountNextResults(lastResults DscCompilationJobListResult) (result DscCompilationJobListResult, err error) { - req, err := lastResults.DscCompilationJobListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/satori/uuid" + "net/http" +) + +// DscCompilationJobClient is the composite Swagger json for Azure Automation +// Client +type DscCompilationJobClient struct { + ManagementClient +} + +// NewDscCompilationJobClient creates an instance of the +// DscCompilationJobClient client. +func NewDscCompilationJobClient(subscriptionID string) DscCompilationJobClient { + return NewDscCompilationJobClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDscCompilationJobClientWithBaseURI creates an instance of the +// DscCompilationJobClient client. +func NewDscCompilationJobClientWithBaseURI(baseURI string, subscriptionID string) DscCompilationJobClient { + return DscCompilationJobClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates the Dsc compilation job of the configuration. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. compilationJobID is the the DSC configuration Id. +// parameters is the parameters supplied to the create compilation job +// operation. +func (client DscCompilationJobClient) Create(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters DscCompilationJobCreateParameters) (result DscCompilationJob, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.DscCompilationJobCreateProperties.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, automationAccountName, compilationJobID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client DscCompilationJobClient) CreatePreparer(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID, parameters DscCompilationJobCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "compilationJobId": autorest.Encode("path", compilationJobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client DscCompilationJobClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client DscCompilationJobClient) CreateResponder(resp *http.Response) (result DscCompilationJob, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve the Dsc configuration compilation job identified by job id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. compilationJobID is the Dsc configuration +// compilation job id. +func (client DscCompilationJobClient) Get(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (result DscCompilationJob, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, compilationJobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DscCompilationJobClient) GetPreparer(resourceGroupName string, automationAccountName string, compilationJobID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "compilationJobId": autorest.Encode("path", compilationJobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DscCompilationJobClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DscCompilationJobClient) GetResponder(resp *http.Response) (result DscCompilationJob, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStream retrieve the job stream identified by job stream id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. jobStreamID is the job stream +// id. +func (client DscCompilationJobClient) GetStream(resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (result JobStream, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "GetStream") + } + + req, err := client.GetStreamPreparer(resourceGroupName, automationAccountName, jobID, jobStreamID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", nil, "Failure preparing request") + return + } + + resp, err := client.GetStreamSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure sending request") + return + } + + result, err = client.GetStreamResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "GetStream", resp, "Failure responding to request") + } + + return +} + +// GetStreamPreparer prepares the GetStream request. +func (client DscCompilationJobClient) GetStreamPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID, jobStreamID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "jobStreamId": autorest.Encode("path", jobStreamID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetStreamSender sends the GetStream request. The method will close the +// http.Response Body if it receives an error. +func (client DscCompilationJobClient) GetStreamSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetStreamResponder handles the response to the GetStream request. The method always +// closes the http.Response Body. +func (client DscCompilationJobClient) GetStreamResponder(resp *http.Response) (result JobStream, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of dsc compilation jobs. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. filter is the filter to apply on the operation. +func (client DscCompilationJobClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result DscCompilationJobListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client DscCompilationJobClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client DscCompilationJobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client DscCompilationJobClient) ListByAutomationAccountResponder(resp *http.Response) (result DscCompilationJobListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client DscCompilationJobClient) ListByAutomationAccountNextResults(lastResults DscCompilationJobListResult) (result DscCompilationJobListResult, err error) { + req, err := lastResults.DscCompilationJobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscCompilationJobClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscconfiguration.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscconfiguration.go index 27711bbbfd..88a8fd8456 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscconfiguration.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscconfiguration.go @@ -1,444 +1,444 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DscConfigurationClient is the composite Swagger json for Azure Automation -// Client -type DscConfigurationClient struct { - ManagementClient -} - -// NewDscConfigurationClient creates an instance of the DscConfigurationClient -// client. -func NewDscConfigurationClient(subscriptionID string) DscConfigurationClient { - return NewDscConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscConfigurationClientWithBaseURI creates an instance of the -// DscConfigurationClient client. -func NewDscConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscConfigurationClient { - return DscConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the configuration identified by configuration name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. configurationName is the create or update -// parameters for configuration. parameters is the create or update parameters -// for configuration. -func (client DscConfigurationClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (result DscConfiguration, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscConfigurationClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscConfiguration, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the dsc configuration identified by configuration name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. configurationName is the configuration name. -func (client DscConfigurationClient) Delete(resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscConfigurationClient) DeletePreparer(resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the configuration identified by configuration name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. configurationName is the configuration name. -func (client DscConfigurationClient) Get(resourceGroupName string, automationAccountName string, configurationName string) (result DscConfiguration, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscConfigurationClient) GetPreparer(resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) GetResponder(resp *http.Response) (result DscConfiguration, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the configuration script identified by configuration -// name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. configurationName is the configuration name. -func (client DscConfigurationClient) GetContent(resourceGroupName string, automationAccountName string, configurationName string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "GetContent") - } - - req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure responding to request") - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client DscConfigurationClient) GetContentPreparer(resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) GetContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of configurations. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client DscConfigurationClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result DscConfigurationListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscConfigurationClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscConfigurationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscConfigurationClient) ListByAutomationAccountNextResults(lastResults DscConfigurationListResult) (result DscConfigurationListResult, err error) { - req, err := lastResults.DscConfigurationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DscConfigurationClient is the composite Swagger json for Azure Automation +// Client +type DscConfigurationClient struct { + ManagementClient +} + +// NewDscConfigurationClient creates an instance of the DscConfigurationClient +// client. +func NewDscConfigurationClient(subscriptionID string) DscConfigurationClient { + return NewDscConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDscConfigurationClientWithBaseURI creates an instance of the +// DscConfigurationClient client. +func NewDscConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscConfigurationClient { + return DscConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the configuration identified by configuration name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. configurationName is the create or update +// parameters for configuration. parameters is the create or update parameters +// for configuration. +func (client DscConfigurationClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (result DscConfiguration, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DscConfigurationCreateOrUpdateProperties.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, configurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DscConfigurationClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, configurationName string, parameters DscConfigurationCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DscConfigurationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DscConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the dsc configuration identified by configuration name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. configurationName is the configuration name. +func (client DscConfigurationClient) Delete(resourceGroupName string, automationAccountName string, configurationName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DscConfigurationClient) DeletePreparer(resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DscConfigurationClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DscConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the configuration identified by configuration name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. configurationName is the configuration name. +func (client DscConfigurationClient) Get(resourceGroupName string, automationAccountName string, configurationName string) (result DscConfiguration, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DscConfigurationClient) GetPreparer(resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DscConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DscConfigurationClient) GetResponder(resp *http.Response) (result DscConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContent retrieve the configuration script identified by configuration +// name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. configurationName is the configuration name. +func (client DscConfigurationClient) GetContent(resourceGroupName string, automationAccountName string, configurationName string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "GetContent") + } + + req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", nil, "Failure preparing request") + return + } + + resp, err := client.GetContentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure sending request") + return + } + + result, err = client.GetContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "GetContent", resp, "Failure responding to request") + } + + return +} + +// GetContentPreparer prepares the GetContent request. +func (client DscConfigurationClient) GetContentPreparer(resourceGroupName string, automationAccountName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetContentSender sends the GetContent request. The method will close the +// http.Response Body if it receives an error. +func (client DscConfigurationClient) GetContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetContentResponder handles the response to the GetContent request. The method always +// closes the http.Response Body. +func (client DscConfigurationClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of configurations. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client DscConfigurationClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result DscConfigurationListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscConfigurationClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client DscConfigurationClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client DscConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client DscConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscConfigurationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client DscConfigurationClient) ListByAutomationAccountNextResults(lastResults DscConfigurationListResult) (result DscConfigurationListResult, err error) { + req, err := lastResults.DscConfigurationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnode.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnode.go index 89d8bac24a..fbeb848b19 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnode.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnode.go @@ -1,362 +1,362 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DscNodeClient is the composite Swagger json for Azure Automation Client -type DscNodeClient struct { - ManagementClient -} - -// NewDscNodeClient creates an instance of the DscNodeClient client. -func NewDscNodeClient(subscriptionID string) DscNodeClient { - return NewDscNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeClientWithBaseURI creates an instance of the DscNodeClient client. -func NewDscNodeClientWithBaseURI(baseURI string, subscriptionID string) DscNodeClient { - return DscNodeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete the dsc node identified by node id. -// -// resourceGroupName is the resource group name. automationAccountName is -// automation account name. nodeID is the node id. -func (client DscNodeClient) Delete(resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeClient) DeletePreparer(resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DscNodeClient) DeleteResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the dsc node identified by node id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeID is the node id. -func (client DscNodeClient) Get(resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, nodeID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeClient) GetPreparer(resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DscNodeClient) GetResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc nodes. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. filter is the filter to apply on the operation. -func (client DscNodeClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result DscNodeListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeClient) ListByAutomationAccountNextResults(lastResults DscNodeListResult) (result DscNodeListResult, err error) { - req, err := lastResults.DscNodeListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update the dsc node. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeID is parameters supplied to the update dsc -// node. parameters is parameters supplied to the update dsc node. -func (client DscNodeClient) Update(resourceGroupName string, automationAccountName string, nodeID string, parameters DscNodeUpdateParameters) (result DscNode, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, nodeID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DscNodeClient) UpdatePreparer(resourceGroupName string, automationAccountName string, nodeID string, parameters DscNodeUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DscNodeClient) UpdateResponder(resp *http.Response) (result DscNode, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DscNodeClient is the composite Swagger json for Azure Automation Client +type DscNodeClient struct { + ManagementClient +} + +// NewDscNodeClient creates an instance of the DscNodeClient client. +func NewDscNodeClient(subscriptionID string) DscNodeClient { + return NewDscNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDscNodeClientWithBaseURI creates an instance of the DscNodeClient client. +func NewDscNodeClientWithBaseURI(baseURI string, subscriptionID string) DscNodeClient { + return DscNodeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete the dsc node identified by node id. +// +// resourceGroupName is the resource group name. automationAccountName is +// automation account name. nodeID is the node id. +func (client DscNodeClient) Delete(resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, nodeID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DscNodeClient) DeletePreparer(resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeId": autorest.Encode("path", nodeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DscNodeClient) DeleteResponder(resp *http.Response) (result DscNode, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve the dsc node identified by node id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeID is the node id. +func (client DscNodeClient) Get(resourceGroupName string, automationAccountName string, nodeID string) (result DscNode, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, nodeID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DscNodeClient) GetPreparer(resourceGroupName string, automationAccountName string, nodeID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeId": autorest.Encode("path", nodeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DscNodeClient) GetResponder(resp *http.Response) (result DscNode, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of dsc nodes. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. filter is the filter to apply on the operation. +func (client DscNodeClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result DscNodeListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client DscNodeClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client DscNodeClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client DscNodeClient) ListByAutomationAccountNextResults(lastResults DscNodeListResult) (result DscNodeListResult, err error) { + req, err := lastResults.DscNodeListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update the dsc node. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeID is parameters supplied to the update dsc +// node. parameters is parameters supplied to the update dsc node. +func (client DscNodeClient) Update(resourceGroupName string, automationAccountName string, nodeID string, parameters DscNodeUpdateParameters) (result DscNode, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, nodeID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DscNodeClient) UpdatePreparer(resourceGroupName string, automationAccountName string, nodeID string, parameters DscNodeUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeId": autorest.Encode("path", nodeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DscNodeClient) UpdateResponder(resp *http.Response) (result DscNode, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnodeconfiguration.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnodeconfiguration.go index d5203eb910..32c31ea073 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnodeconfiguration.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/dscnodeconfiguration.go @@ -1,377 +1,377 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DscNodeConfigurationClient is the composite Swagger json for Azure -// Automation Client -type DscNodeConfigurationClient struct { - ManagementClient -} - -// NewDscNodeConfigurationClient creates an instance of the -// DscNodeConfigurationClient client. -func NewDscNodeConfigurationClient(subscriptionID string) DscNodeConfigurationClient { - return NewDscNodeConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDscNodeConfigurationClientWithBaseURI creates an instance of the -// DscNodeConfigurationClient client. -func NewDscNodeConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscNodeConfigurationClient { - return DscNodeConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the node configuration identified by node -// configuration name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeConfigurationName is the create or update -// parameters for configuration. parameters is the create or update parameters -// for configuration. -func (client DscNodeConfigurationClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (result DscNodeConfiguration, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Source.Hash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, nodeConfigurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DscNodeConfigurationClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscNodeConfiguration, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the Dsc node configurations by node configuration. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeConfigurationName is the Dsc node configuration -// name. -func (client DscNodeConfigurationClient) Delete(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DscNodeConfigurationClient) DeletePreparer(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the Dsc node configurations by node configuration. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeConfigurationName is the Dsc node configuration -// name. -func (client DscNodeConfigurationClient) Get(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result DscNodeConfiguration, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, nodeConfigurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DscNodeConfigurationClient) GetPreparer(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) GetResponder(resp *http.Response) (result DscNodeConfiguration, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of dsc node configurations. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. filter is the filter to apply on the operation. -func (client DscNodeConfigurationClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result DscNodeConfigurationListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client DscNodeConfigurationClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DscNodeConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client DscNodeConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeConfigurationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client DscNodeConfigurationClient) ListByAutomationAccountNextResults(lastResults DscNodeConfigurationListResult) (result DscNodeConfigurationListResult, err error) { - req, err := lastResults.DscNodeConfigurationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DscNodeConfigurationClient is the composite Swagger json for Azure +// Automation Client +type DscNodeConfigurationClient struct { + ManagementClient +} + +// NewDscNodeConfigurationClient creates an instance of the +// DscNodeConfigurationClient client. +func NewDscNodeConfigurationClient(subscriptionID string) DscNodeConfigurationClient { + return NewDscNodeConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDscNodeConfigurationClientWithBaseURI creates an instance of the +// DscNodeConfigurationClient client. +func NewDscNodeConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscNodeConfigurationClient { + return DscNodeConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the node configuration identified by node +// configuration name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeConfigurationName is the create or update +// parameters for configuration. parameters is the create or update parameters +// for configuration. +func (client DscNodeConfigurationClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (result DscNodeConfiguration, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Source.Hash", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Source.Hash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Source.Hash.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Configuration", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, nodeConfigurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DscNodeConfigurationClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, nodeConfigurationName string, parameters DscNodeConfigurationCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeConfigurationClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DscNodeConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscNodeConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the Dsc node configurations by node configuration. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeConfigurationName is the Dsc node configuration +// name. +func (client DscNodeConfigurationClient) Delete(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, nodeConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DscNodeConfigurationClient) DeletePreparer(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeConfigurationClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DscNodeConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the Dsc node configurations by node configuration. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeConfigurationName is the Dsc node configuration +// name. +func (client DscNodeConfigurationClient) Get(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (result DscNodeConfiguration, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, nodeConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DscNodeConfigurationClient) GetPreparer(resourceGroupName string, automationAccountName string, nodeConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeConfigurationName": autorest.Encode("path", nodeConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DscNodeConfigurationClient) GetResponder(resp *http.Response) (result DscNodeConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of dsc node configurations. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. filter is the filter to apply on the operation. +func (client DscNodeConfigurationClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result DscNodeConfigurationListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client DscNodeConfigurationClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client DscNodeConfigurationClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client DscNodeConfigurationClient) ListByAutomationAccountResponder(resp *http.Response) (result DscNodeConfigurationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client DscNodeConfigurationClient) ListByAutomationAccountNextResults(lastResults DscNodeConfigurationListResult) (result DscNodeConfigurationListResult, err error) { + req, err := lastResults.DscNodeConfigurationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.DscNodeConfigurationClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/fields.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/fields.go index 6a09dadc11..ef597c0fb6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/fields.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/fields.go @@ -1,117 +1,117 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// FieldsClient is the composite Swagger json for Azure Automation Client -type FieldsClient struct { - ManagementClient -} - -// NewFieldsClient creates an instance of the FieldsClient client. -func NewFieldsClient(subscriptionID string) FieldsClient { - return NewFieldsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFieldsClientWithBaseURI creates an instance of the FieldsClient client. -func NewFieldsClientWithBaseURI(baseURI string, subscriptionID string) FieldsClient { - return FieldsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByType retrieve a list of fields of a given type identified by module -// name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the name of module. typeName is the -// name of type. -func (client FieldsClient) ListByType(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.FieldsClient", "ListByType") - } - - req, err := client.ListByTypePreparer(resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure sending request") - return - } - - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure responding to request") - } - - return -} - -// ListByTypePreparer prepares the ListByType request. -func (client FieldsClient) ListByTypePreparer(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByTypeSender sends the ListByType request. The method will close the -// http.Response Body if it receives an error. -func (client FieldsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByTypeResponder handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (client FieldsClient) ListByTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FieldsClient is the composite Swagger json for Azure Automation Client +type FieldsClient struct { + ManagementClient +} + +// NewFieldsClient creates an instance of the FieldsClient client. +func NewFieldsClient(subscriptionID string) FieldsClient { + return NewFieldsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFieldsClientWithBaseURI creates an instance of the FieldsClient client. +func NewFieldsClientWithBaseURI(baseURI string, subscriptionID string) FieldsClient { + return FieldsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByType retrieve a list of fields of a given type identified by module +// name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the name of module. typeName is the +// name of type. +func (client FieldsClient) ListByType(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.FieldsClient", "ListByType") + } + + req, err := client.ListByTypePreparer(resourceGroupName, automationAccountName, moduleName, typeName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure sending request") + return + } + + result, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.FieldsClient", "ListByType", resp, "Failure responding to request") + } + + return +} + +// ListByTypePreparer prepares the ListByType request. +func (client FieldsClient) ListByTypePreparer(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "typeName": autorest.Encode("path", typeName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByTypeSender sends the ListByType request. The method will close the +// http.Response Body if it receives an error. +func (client FieldsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByTypeResponder handles the response to the ListByType request. The method always +// closes the http.Response Body. +func (client FieldsClient) ListByTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/hybridrunbookworkergroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/hybridrunbookworkergroup.go index 31b979084e..b36eb3b681 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/hybridrunbookworkergroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/hybridrunbookworkergroup.go @@ -1,363 +1,363 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// HybridRunbookWorkerGroupClient is the composite Swagger json for Azure -// Automation Client -type HybridRunbookWorkerGroupClient struct { - ManagementClient -} - -// NewHybridRunbookWorkerGroupClient creates an instance of the -// HybridRunbookWorkerGroupClient client. -func NewHybridRunbookWorkerGroupClient(subscriptionID string) HybridRunbookWorkerGroupClient { - return NewHybridRunbookWorkerGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHybridRunbookWorkerGroupClientWithBaseURI creates an instance of the -// HybridRunbookWorkerGroupClient client. -func NewHybridRunbookWorkerGroupClientWithBaseURI(baseURI string, subscriptionID string) HybridRunbookWorkerGroupClient { - return HybridRunbookWorkerGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete a hybrid runbook worker group. -// -// resourceGroupName is the resource group name. automationAccountName is -// automation account name. hybridRunbookWorkerGroupName is the hybrid runbook -// worker group name -func (client HybridRunbookWorkerGroupClient) Delete(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HybridRunbookWorkerGroupClient) DeletePreparer(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve a hybrid runbook worker group. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. hybridRunbookWorkerGroupName is the hybrid runbook -// worker group name -func (client HybridRunbookWorkerGroupClient) Get(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result HybridRunbookWorkerGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client HybridRunbookWorkerGroupClient) GetPreparer(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) GetResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of hybrid runbook worker groups. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result HybridRunbookWorkerGroupsListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountResponder(resp *http.Response) (result HybridRunbookWorkerGroupsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountNextResults(lastResults HybridRunbookWorkerGroupsListResult) (result HybridRunbookWorkerGroupsListResult, err error) { - req, err := lastResults.HybridRunbookWorkerGroupsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update a hybrid runbook worker group. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. hybridRunbookWorkerGroupName is the hybrid runbook -// worker group name parameters is the hybrid runbook worker group -func (client HybridRunbookWorkerGroupClient) Update(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (result HybridRunbookWorkerGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HybridRunbookWorkerGroupClient) UpdatePreparer(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client HybridRunbookWorkerGroupClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client HybridRunbookWorkerGroupClient) UpdateResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// HybridRunbookWorkerGroupClient is the composite Swagger json for Azure +// Automation Client +type HybridRunbookWorkerGroupClient struct { + ManagementClient +} + +// NewHybridRunbookWorkerGroupClient creates an instance of the +// HybridRunbookWorkerGroupClient client. +func NewHybridRunbookWorkerGroupClient(subscriptionID string) HybridRunbookWorkerGroupClient { + return NewHybridRunbookWorkerGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHybridRunbookWorkerGroupClientWithBaseURI creates an instance of the +// HybridRunbookWorkerGroupClient client. +func NewHybridRunbookWorkerGroupClientWithBaseURI(baseURI string, subscriptionID string) HybridRunbookWorkerGroupClient { + return HybridRunbookWorkerGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete a hybrid runbook worker group. +// +// resourceGroupName is the resource group name. automationAccountName is +// automation account name. hybridRunbookWorkerGroupName is the hybrid runbook +// worker group name +func (client HybridRunbookWorkerGroupClient) Delete(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client HybridRunbookWorkerGroupClient) DeletePreparer(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client HybridRunbookWorkerGroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client HybridRunbookWorkerGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve a hybrid runbook worker group. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. hybridRunbookWorkerGroupName is the hybrid runbook +// worker group name +func (client HybridRunbookWorkerGroupClient) Get(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (result HybridRunbookWorkerGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client HybridRunbookWorkerGroupClient) GetPreparer(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HybridRunbookWorkerGroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HybridRunbookWorkerGroupClient) GetResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of hybrid runbook worker groups. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client HybridRunbookWorkerGroupClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result HybridRunbookWorkerGroupsListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountResponder(resp *http.Response) (result HybridRunbookWorkerGroupsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client HybridRunbookWorkerGroupClient) ListByAutomationAccountNextResults(lastResults HybridRunbookWorkerGroupsListResult) (result HybridRunbookWorkerGroupsListResult, err error) { + req, err := lastResults.HybridRunbookWorkerGroupsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update a hybrid runbook worker group. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. hybridRunbookWorkerGroupName is the hybrid runbook +// worker group name parameters is the hybrid runbook worker group +func (client HybridRunbookWorkerGroupClient) Update(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (result HybridRunbookWorkerGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.HybridRunbookWorkerGroupClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.HybridRunbookWorkerGroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client HybridRunbookWorkerGroupClient) UpdatePreparer(resourceGroupName string, automationAccountName string, hybridRunbookWorkerGroupName string, parameters HybridRunbookWorkerGroupUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "hybridRunbookWorkerGroupName": autorest.Encode("path", hybridRunbookWorkerGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client HybridRunbookWorkerGroupClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client HybridRunbookWorkerGroupClient) UpdateResponder(resp *http.Response) (result HybridRunbookWorkerGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/job.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/job.go index db171b41b3..d1257ab970 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/job.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/job.go @@ -1,654 +1,654 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/uuid" - "net/http" -) - -// JobClient is the composite Swagger json for Azure Automation Client -type JobClient struct { - ManagementClient -} - -// NewJobClient creates an instance of the JobClient client. -func NewJobClient(subscriptionID string) JobClient { - return NewJobClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobClientWithBaseURI creates an instance of the JobClient client. -func NewJobClientWithBaseURI(baseURI string, subscriptionID string) JobClient { - return JobClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job of the runbook. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. parameters is the parameters -// supplied to the create job operation. -func (client JobClient) Create(resourceGroupName string, automationAccountName string, jobID uuid.UUID, parameters JobCreateParameters) (result Job, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JobCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, automationAccountName, jobID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobClient) CreatePreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID, parameters JobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client JobClient) CreateResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the job identified by job id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. -func (client JobClient) Get(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result Job, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobClient) GetPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobClient) GetResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOutput retrieve the job output identified by job id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. -func (client JobClient) GetOutput(resourceGroupName string, automationAccountName string, jobID string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "GetOutput") - } - - req, err := client.GetOutputPreparer(resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", nil, "Failure preparing request") - return - } - - resp, err := client.GetOutputSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure sending request") - return - } - - result, err = client.GetOutputResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure responding to request") - } - - return -} - -// GetOutputPreparer prepares the GetOutput request. -func (client JobClient) GetOutputPreparer(resourceGroupName string, automationAccountName string, jobID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/output", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetOutputSender sends the GetOutput request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetOutputResponder handles the response to the GetOutput request. The method always -// closes the http.Response Body. -func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRunbookContent retrieve the runbook content of the job identified by job -// id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. -func (client JobClient) GetRunbookContent(resourceGroupName string, automationAccountName string, jobID string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "GetRunbookContent") - } - - req, err := client.GetRunbookContentPreparer(resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetRunbookContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure sending request") - return - } - - result, err = client.GetRunbookContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure responding to request") - } - - return -} - -// GetRunbookContentPreparer prepares the GetRunbookContent request. -func (client JobClient) GetRunbookContentPreparer(resourceGroupName string, automationAccountName string, jobID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/runbookContent", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRunbookContentSender sends the GetRunbookContent request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always -// closes the http.Response Body. -func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of jobs. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. filter is the filter to apply on the operation. -func (client JobClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result JobListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobClient) ListByAutomationAccountResponder(resp *http.Response) (result JobListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobClient) ListByAutomationAccountNextResults(lastResults JobListResult) (result JobListResult, err error) { - req, err := lastResults.JobListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Resume resume the job identified by jobId. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. -func (client JobClient) Resume(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Resume") - } - - req, err := client.ResumePreparer(resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure responding to request") - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client JobClient) ResumePreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResumeSender sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) ResumeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client JobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the job identified by jobId. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. -func (client JobClient) Stop(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Stop") - } - - req, err := client.StopPreparer(resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure responding to request") - } - - return -} - -// StopPreparer prepares the Stop request. -func (client JobClient) StopPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client JobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the job identified by jobId. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. -func (client JobClient) Suspend(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Suspend") - } - - req, err := client.SuspendPreparer(resourceGroupName, automationAccountName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure responding to request") - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client JobClient) SuspendPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SuspendSender sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (client JobClient) SuspendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client JobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/satori/uuid" + "net/http" +) + +// JobClient is the composite Swagger json for Azure Automation Client +type JobClient struct { + ManagementClient +} + +// NewJobClient creates an instance of the JobClient client. +func NewJobClient(subscriptionID string) JobClient { + return NewJobClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobClientWithBaseURI creates an instance of the JobClient client. +func NewJobClientWithBaseURI(baseURI string, subscriptionID string) JobClient { + return JobClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a job of the runbook. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. parameters is the parameters +// supplied to the create job operation. +func (client JobClient) Create(resourceGroupName string, automationAccountName string, jobID uuid.UUID, parameters JobCreateParameters) (result Job, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.JobCreateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.JobCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, automationAccountName, jobID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client JobClient) CreatePreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID, parameters JobCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client JobClient) CreateResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve the job identified by job id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. +func (client JobClient) Get(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result Job, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobClient) GetPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobClient) GetResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOutput retrieve the job output identified by job id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. +func (client JobClient) GetOutput(resourceGroupName string, automationAccountName string, jobID string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "GetOutput") + } + + req, err := client.GetOutputPreparer(resourceGroupName, automationAccountName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", nil, "Failure preparing request") + return + } + + resp, err := client.GetOutputSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure sending request") + return + } + + result, err = client.GetOutputResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "GetOutput", resp, "Failure responding to request") + } + + return +} + +// GetOutputPreparer prepares the GetOutput request. +func (client JobClient) GetOutputPreparer(resourceGroupName string, automationAccountName string, jobID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/output", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetOutputSender sends the GetOutput request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetOutputResponder handles the response to the GetOutput request. The method always +// closes the http.Response Body. +func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRunbookContent retrieve the runbook content of the job identified by job +// id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. +func (client JobClient) GetRunbookContent(resourceGroupName string, automationAccountName string, jobID string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "GetRunbookContent") + } + + req, err := client.GetRunbookContentPreparer(resourceGroupName, automationAccountName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", nil, "Failure preparing request") + return + } + + resp, err := client.GetRunbookContentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure sending request") + return + } + + result, err = client.GetRunbookContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "GetRunbookContent", resp, "Failure responding to request") + } + + return +} + +// GetRunbookContentPreparer prepares the GetRunbookContent request. +func (client JobClient) GetRunbookContentPreparer(resourceGroupName string, automationAccountName string, jobID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/runbookContent", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRunbookContentSender sends the GetRunbookContent request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always +// closes the http.Response Body. +func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of jobs. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. filter is the filter to apply on the operation. +func (client JobClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result JobListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client JobClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client JobClient) ListByAutomationAccountResponder(resp *http.Response) (result JobListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client JobClient) ListByAutomationAccountNextResults(lastResults JobListResult) (result JobListResult, err error) { + req, err := lastResults.JobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Resume resume the job identified by jobId. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. +func (client JobClient) Resume(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Resume") + } + + req, err := client.ResumePreparer(resourceGroupName, automationAccountName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", nil, "Failure preparing request") + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure sending request") + return + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Resume", resp, "Failure responding to request") + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client JobClient) ResumePreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) ResumeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client JobClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop the job identified by jobId. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. +func (client JobClient) Stop(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Stop") + } + + req, err := client.StopPreparer(resourceGroupName, automationAccountName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Stop", resp, "Failure responding to request") + } + + return +} + +// StopPreparer prepares the Stop request. +func (client JobClient) StopPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client JobClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Suspend suspend the job identified by jobId. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. +func (client JobClient) Suspend(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobClient", "Suspend") + } + + req, err := client.SuspendPreparer(resourceGroupName, automationAccountName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", nil, "Failure preparing request") + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure sending request") + return + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobClient", "Suspend", resp, "Failure responding to request") + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client JobClient) SuspendPreparer(resourceGroupName string, automationAccountName string, jobID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client JobClient) SuspendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client JobClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobschedule.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobschedule.go index b3a4fd3c8e..a10ec7dba6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobschedule.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobschedule.go @@ -1,365 +1,365 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/uuid" - "net/http" -) - -// JobScheduleClient is the composite Swagger json for Azure Automation Client -type JobScheduleClient struct { - ManagementClient -} - -// NewJobScheduleClient creates an instance of the JobScheduleClient client. -func NewJobScheduleClient(subscriptionID string) JobScheduleClient { - return NewJobScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient -// client. -func NewJobScheduleClientWithBaseURI(baseURI string, subscriptionID string) JobScheduleClient { - return JobScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a job schedule. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobScheduleID is the job schedule name. parameters -// is the parameters supplied to the create job schedule operation. -func (client JobScheduleClient) Create(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (result JobSchedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties.Schedule", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.JobScheduleCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, automationAccountName, jobScheduleID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client JobScheduleClient) CreatePreparer(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) CreateResponder(resp *http.Response) (result JobSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the job schedule identified by job schedule name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobScheduleID is the job schedule name. -func (client JobScheduleClient) Delete(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobScheduleClient) DeletePreparer(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the job schedule identified by job schedule name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobScheduleID is the job schedule name. -func (client JobScheduleClient) Get(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result JobSchedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, jobScheduleID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobScheduleClient) GetPreparer(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobScheduleId": autorest.Encode("path", jobScheduleID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) GetResponder(resp *http.Response) (result JobSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of job schedules. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client JobScheduleClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result JobScheduleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client JobScheduleClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client JobScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client JobScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result JobScheduleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client JobScheduleClient) ListByAutomationAccountNextResults(lastResults JobScheduleListResult) (result JobScheduleListResult, err error) { - req, err := lastResults.JobScheduleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/satori/uuid" + "net/http" +) + +// JobScheduleClient is the composite Swagger json for Azure Automation Client +type JobScheduleClient struct { + ManagementClient +} + +// NewJobScheduleClient creates an instance of the JobScheduleClient client. +func NewJobScheduleClient(subscriptionID string) JobScheduleClient { + return NewJobScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobScheduleClientWithBaseURI creates an instance of the JobScheduleClient +// client. +func NewJobScheduleClientWithBaseURI(baseURI string, subscriptionID string) JobScheduleClient { + return JobScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a job schedule. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobScheduleID is the job schedule name. parameters +// is the parameters supplied to the create job schedule operation. +func (client JobScheduleClient) Create(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (result JobSchedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.JobScheduleCreateProperties.Schedule", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.JobScheduleCreateProperties.Runbook", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, automationAccountName, jobScheduleID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client JobScheduleClient) CreatePreparer(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID, parameters JobScheduleCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobScheduleId": autorest.Encode("path", jobScheduleID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) CreateResponder(resp *http.Response) (result JobSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the job schedule identified by job schedule name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobScheduleID is the job schedule name. +func (client JobScheduleClient) Delete(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, jobScheduleID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobScheduleClient) DeletePreparer(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobScheduleId": autorest.Encode("path", jobScheduleID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the job schedule identified by job schedule name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobScheduleID is the job schedule name. +func (client JobScheduleClient) Get(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (result JobSchedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, jobScheduleID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobScheduleClient) GetPreparer(resourceGroupName string, automationAccountName string, jobScheduleID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobScheduleId": autorest.Encode("path", jobScheduleID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) GetResponder(resp *http.Response) (result JobSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of job schedules. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client JobScheduleClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result JobScheduleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobScheduleClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client JobScheduleClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client JobScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client JobScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result JobScheduleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client JobScheduleClient) ListByAutomationAccountNextResults(lastResults JobScheduleListResult) (result JobScheduleListResult, err error) { + req, err := lastResults.JobScheduleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobScheduleClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobstream.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobstream.go index 7cc691e90b..95b497598e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobstream.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/jobstream.go @@ -1,218 +1,218 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// JobStreamClient is the composite Swagger json for Azure Automation Client -type JobStreamClient struct { - ManagementClient -} - -// NewJobStreamClient creates an instance of the JobStreamClient client. -func NewJobStreamClient(subscriptionID string) JobStreamClient { - return NewJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobStreamClientWithBaseURI creates an instance of the JobStreamClient -// client. -func NewJobStreamClientWithBaseURI(baseURI string, subscriptionID string) JobStreamClient { - return JobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the job stream identified by job stream id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job id. jobStreamID is the job stream -// id. -func (client JobStreamClient) Get(resourceGroupName string, automationAccountName string, jobID string, jobStreamID string) (result JobStream, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobStreamClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, jobID, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobStreamClient) GetPreparer(resourceGroupName string, automationAccountName string, jobID string, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobStreamClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobStreamClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJob retrieve a list of jobs streams identified by job id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. jobID is the job Id. filter is the filter to apply -// on the operation. -func (client JobStreamClient) ListByJob(resourceGroupName string, automationAccountName string, jobID string, filter string) (result JobStreamListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.JobStreamClient", "ListByJob") - } - - req, err := client.ListByJobPreparer(resourceGroupName, automationAccountName, jobID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending request") - return - } - - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to request") - } - - return -} - -// ListByJobPreparer prepares the ListByJob request. -func (client JobStreamClient) ListByJobPreparer(resourceGroupName string, automationAccountName string, jobID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByJobSender sends the ListByJob request. The method will close the -// http.Response Body if it receives an error. -func (client JobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByJobResponder handles the response to the ListByJob request. The method always -// closes the http.Response Body. -func (client JobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByJobNextResults retrieves the next set of results, if any. -func (client JobStreamClient) ListByJobNextResults(lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.JobStreamListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending next results request") - } - - result, err = client.ListByJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// JobStreamClient is the composite Swagger json for Azure Automation Client +type JobStreamClient struct { + ManagementClient +} + +// NewJobStreamClient creates an instance of the JobStreamClient client. +func NewJobStreamClient(subscriptionID string) JobStreamClient { + return NewJobStreamClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobStreamClientWithBaseURI creates an instance of the JobStreamClient +// client. +func NewJobStreamClientWithBaseURI(baseURI string, subscriptionID string) JobStreamClient { + return JobStreamClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieve the job stream identified by job stream id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job id. jobStreamID is the job stream +// id. +func (client JobStreamClient) Get(resourceGroupName string, automationAccountName string, jobID string, jobStreamID string) (result JobStream, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobStreamClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, jobID, jobStreamID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobStreamClient) GetPreparer(resourceGroupName string, automationAccountName string, jobID string, jobStreamID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "jobStreamId": autorest.Encode("path", jobStreamID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams/{jobStreamId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobStreamClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobStreamClient) GetResponder(resp *http.Response) (result JobStream, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByJob retrieve a list of jobs streams identified by job id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. jobID is the job Id. filter is the filter to apply +// on the operation. +func (client JobStreamClient) ListByJob(resourceGroupName string, automationAccountName string, jobID string, filter string) (result JobStreamListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.JobStreamClient", "ListByJob") + } + + req, err := client.ListByJobPreparer(resourceGroupName, automationAccountName, jobID, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending request") + return + } + + result, err = client.ListByJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to request") + } + + return +} + +// ListByJobPreparer prepares the ListByJob request. +func (client JobStreamClient) ListByJobPreparer(resourceGroupName string, automationAccountName string, jobID string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByJobSender sends the ListByJob request. The method will close the +// http.Response Body if it receives an error. +func (client JobStreamClient) ListByJobSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByJobResponder handles the response to the ListByJob request. The method always +// closes the http.Response Body. +func (client JobStreamClient) ListByJobResponder(resp *http.Response) (result JobStreamListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByJobNextResults retrieves the next set of results, if any. +func (client JobStreamClient) ListByJobNextResults(lastResults JobStreamListResult) (result JobStreamListResult, err error) { + req, err := lastResults.JobStreamListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure sending next results request") + } + + result, err = client.ListByJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.JobStreamClient", "ListByJob", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/models.go index 63e259a172..9bba30646a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/models.go @@ -1,1926 +1,1926 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/satori/uuid" - "io" - "net/http" -) - -// AccountState enumerates the values for account state. -type AccountState string - -const ( - // Ok specifies the ok state for account state. - Ok AccountState = "Ok" - // Suspended specifies the suspended state for account state. - Suspended AccountState = "Suspended" - // Unavailable specifies the unavailable state for account state. - Unavailable AccountState = "Unavailable" -) - -// AgentRegistrationKeyName enumerates the values for agent registration key -// name. -type AgentRegistrationKeyName string - -const ( - // Primary specifies the primary state for agent registration key name. - Primary AgentRegistrationKeyName = "Primary" - // Secondary specifies the secondary state for agent registration key name. - Secondary AgentRegistrationKeyName = "Secondary" -) - -// ContentSourceType enumerates the values for content source type. -type ContentSourceType string - -const ( - // EmbeddedContent specifies the embedded content state for content source - // type. - EmbeddedContent ContentSourceType = "embeddedContent" - // URI specifies the uri state for content source type. - URI ContentSourceType = "uri" -) - -// DscConfigurationProvisioningState enumerates the values for dsc -// configuration provisioning state. -type DscConfigurationProvisioningState string - -const ( - // Succeeded specifies the succeeded state for dsc configuration - // provisioning state. - Succeeded DscConfigurationProvisioningState = "Succeeded" -) - -// DscConfigurationState enumerates the values for dsc configuration state. -type DscConfigurationState string - -const ( - // DscConfigurationStateEdit specifies the dsc configuration state edit - // state for dsc configuration state. - DscConfigurationStateEdit DscConfigurationState = "Edit" - // DscConfigurationStateNew specifies the dsc configuration state new state - // for dsc configuration state. - DscConfigurationStateNew DscConfigurationState = "New" - // DscConfigurationStatePublished specifies the dsc configuration state - // published state for dsc configuration state. - DscConfigurationStatePublished DscConfigurationState = "Published" -) - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted specifies the accepted state for http status code. - Accepted HTTPStatusCode = "Accepted" - // Ambiguous specifies the ambiguous state for http status code. - Ambiguous HTTPStatusCode = "Ambiguous" - // BadGateway specifies the bad gateway state for http status code. - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest specifies the bad request state for http status code. - BadRequest HTTPStatusCode = "BadRequest" - // Conflict specifies the conflict state for http status code. - Conflict HTTPStatusCode = "Conflict" - // Continue specifies the continue state for http status code. - Continue HTTPStatusCode = "Continue" - // Created specifies the created state for http status code. - Created HTTPStatusCode = "Created" - // ExpectationFailed specifies the expectation failed state for http status - // code. - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden specifies the forbidden state for http status code. - Forbidden HTTPStatusCode = "Forbidden" - // Found specifies the found state for http status code. - Found HTTPStatusCode = "Found" - // GatewayTimeout specifies the gateway timeout state for http status code. - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone specifies the gone state for http status code. - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported specifies the http version not supported state - // for http status code. - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError specifies the internal server error state for http - // status code. - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired specifies the length required state for http status code. - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed specifies the method not allowed state for http status - // code. - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // Moved specifies the moved state for http status code. - Moved HTTPStatusCode = "Moved" - // MovedPermanently specifies the moved permanently state for http status - // code. - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices specifies the multiple choices state for http status - // code. - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent specifies the no content state for http status code. - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation specifies the non authoritative information - // state for http status code. - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable specifies the not acceptable state for http status code. - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound specifies the not found state for http status code. - NotFound HTTPStatusCode = "NotFound" - // NotImplemented specifies the not implemented state for http status code. - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified specifies the not modified state for http status code. - NotModified HTTPStatusCode = "NotModified" - // OK specifies the ok state for http status code. - OK HTTPStatusCode = "OK" - // PartialContent specifies the partial content state for http status code. - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired specifies the payment required state for http status - // code. - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed specifies the precondition failed state for http - // status code. - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired specifies the proxy authentication required - // state for http status code. - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect specifies the redirect state for http status code. - Redirect HTTPStatusCode = "Redirect" - // RedirectKeepVerb specifies the redirect keep verb state for http status - // code. - RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - // RedirectMethod specifies the redirect method state for http status code. - RedirectMethod HTTPStatusCode = "RedirectMethod" - // RequestedRangeNotSatisfiable specifies the requested range not - // satisfiable state for http status code. - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge specifies the request entity too large state for - // http status code. - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout specifies the request timeout state for http status code. - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong specifies the request uri too long state for http - // status code. - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent specifies the reset content state for http status code. - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther specifies the see other state for http status code. - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable specifies the service unavailable state for http - // status code. - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols specifies the switching protocols state for http - // status code. - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect specifies the temporary redirect state for http status - // code. - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized specifies the unauthorized state for http status code. - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType specifies the unsupported media type state for http - // status code. - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused specifies the unused state for http status code. - Unused HTTPStatusCode = "Unused" - // UpgradeRequired specifies the upgrade required state for http status - // code. - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy specifies the use proxy state for http status code. - UseProxy HTTPStatusCode = "UseProxy" -) - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // JobStatusActivating specifies the job status activating state for job - // status. - JobStatusActivating JobStatus = "Activating" - // JobStatusBlocked specifies the job status blocked state for job status. - JobStatusBlocked JobStatus = "Blocked" - // JobStatusCompleted specifies the job status completed state for job - // status. - JobStatusCompleted JobStatus = "Completed" - // JobStatusDisconnected specifies the job status disconnected state for - // job status. - JobStatusDisconnected JobStatus = "Disconnected" - // JobStatusFailed specifies the job status failed state for job status. - JobStatusFailed JobStatus = "Failed" - // JobStatusNew specifies the job status new state for job status. - JobStatusNew JobStatus = "New" - // JobStatusRemoving specifies the job status removing state for job - // status. - JobStatusRemoving JobStatus = "Removing" - // JobStatusResuming specifies the job status resuming state for job - // status. - JobStatusResuming JobStatus = "Resuming" - // JobStatusRunning specifies the job status running state for job status. - JobStatusRunning JobStatus = "Running" - // JobStatusStopped specifies the job status stopped state for job status. - JobStatusStopped JobStatus = "Stopped" - // JobStatusStopping specifies the job status stopping state for job - // status. - JobStatusStopping JobStatus = "Stopping" - // JobStatusSuspended specifies the job status suspended state for job - // status. - JobStatusSuspended JobStatus = "Suspended" - // JobStatusSuspending specifies the job status suspending state for job - // status. - JobStatusSuspending JobStatus = "Suspending" -) - -// JobStreamType enumerates the values for job stream type. -type JobStreamType string - -const ( - // Any specifies the any state for job stream type. - Any JobStreamType = "Any" - // Debug specifies the debug state for job stream type. - Debug JobStreamType = "Debug" - // Error specifies the error state for job stream type. - Error JobStreamType = "Error" - // Output specifies the output state for job stream type. - Output JobStreamType = "Output" - // Progress specifies the progress state for job stream type. - Progress JobStreamType = "Progress" - // Verbose specifies the verbose state for job stream type. - Verbose JobStreamType = "Verbose" - // Warning specifies the warning state for job stream type. - Warning JobStreamType = "Warning" -) - -// ModuleProvisioningState enumerates the values for module provisioning state. -type ModuleProvisioningState string - -const ( - // ModuleProvisioningStateActivitiesStored specifies the module - // provisioning state activities stored state for module provisioning - // state. - ModuleProvisioningStateActivitiesStored ModuleProvisioningState = "ActivitiesStored" - // ModuleProvisioningStateCancelled specifies the module provisioning state - // cancelled state for module provisioning state. - ModuleProvisioningStateCancelled ModuleProvisioningState = "Cancelled" - // ModuleProvisioningStateConnectionTypeImported specifies the module - // provisioning state connection type imported state for module - // provisioning state. - ModuleProvisioningStateConnectionTypeImported ModuleProvisioningState = "ConnectionTypeImported" - // ModuleProvisioningStateContentDownloaded specifies the module - // provisioning state content downloaded state for module provisioning - // state. - ModuleProvisioningStateContentDownloaded ModuleProvisioningState = "ContentDownloaded" - // ModuleProvisioningStateContentRetrieved specifies the module - // provisioning state content retrieved state for module provisioning - // state. - ModuleProvisioningStateContentRetrieved ModuleProvisioningState = "ContentRetrieved" - // ModuleProvisioningStateContentStored specifies the module provisioning - // state content stored state for module provisioning state. - ModuleProvisioningStateContentStored ModuleProvisioningState = "ContentStored" - // ModuleProvisioningStateContentValidated specifies the module - // provisioning state content validated state for module provisioning - // state. - ModuleProvisioningStateContentValidated ModuleProvisioningState = "ContentValidated" - // ModuleProvisioningStateCreated specifies the module provisioning state - // created state for module provisioning state. - ModuleProvisioningStateCreated ModuleProvisioningState = "Created" - // ModuleProvisioningStateCreating specifies the module provisioning state - // creating state for module provisioning state. - ModuleProvisioningStateCreating ModuleProvisioningState = "Creating" - // ModuleProvisioningStateFailed specifies the module provisioning state - // failed state for module provisioning state. - ModuleProvisioningStateFailed ModuleProvisioningState = "Failed" - // ModuleProvisioningStateModuleDataStored specifies the module - // provisioning state module data stored state for module provisioning - // state. - ModuleProvisioningStateModuleDataStored ModuleProvisioningState = "ModuleDataStored" - // ModuleProvisioningStateModuleImportRunbookComplete specifies the module - // provisioning state module import runbook complete state for module - // provisioning state. - ModuleProvisioningStateModuleImportRunbookComplete ModuleProvisioningState = "ModuleImportRunbookComplete" - // ModuleProvisioningStateRunningImportModuleRunbook specifies the module - // provisioning state running import module runbook state for module - // provisioning state. - ModuleProvisioningStateRunningImportModuleRunbook ModuleProvisioningState = "RunningImportModuleRunbook" - // ModuleProvisioningStateStartingImportModuleRunbook specifies the module - // provisioning state starting import module runbook state for module - // provisioning state. - ModuleProvisioningStateStartingImportModuleRunbook ModuleProvisioningState = "StartingImportModuleRunbook" - // ModuleProvisioningStateSucceeded specifies the module provisioning state - // succeeded state for module provisioning state. - ModuleProvisioningStateSucceeded ModuleProvisioningState = "Succeeded" - // ModuleProvisioningStateUpdating specifies the module provisioning state - // updating state for module provisioning state. - ModuleProvisioningStateUpdating ModuleProvisioningState = "Updating" -) - -// RunbookProvisioningState enumerates the values for runbook provisioning -// state. -type RunbookProvisioningState string - -const ( - // RunbookProvisioningStateSucceeded specifies the runbook provisioning - // state succeeded state for runbook provisioning state. - RunbookProvisioningStateSucceeded RunbookProvisioningState = "Succeeded" -) - -// RunbookState enumerates the values for runbook state. -type RunbookState string - -const ( - // RunbookStateEdit specifies the runbook state edit state for runbook - // state. - RunbookStateEdit RunbookState = "Edit" - // RunbookStateNew specifies the runbook state new state for runbook state. - RunbookStateNew RunbookState = "New" - // RunbookStatePublished specifies the runbook state published state for - // runbook state. - RunbookStatePublished RunbookState = "Published" -) - -// RunbookTypeEnum enumerates the values for runbook type enum. -type RunbookTypeEnum string - -const ( - // Graph specifies the graph state for runbook type enum. - Graph RunbookTypeEnum = "Graph" - // GraphPowerShell specifies the graph power shell state for runbook type - // enum. - GraphPowerShell RunbookTypeEnum = "GraphPowerShell" - // GraphPowerShellWorkflow specifies the graph power shell workflow state - // for runbook type enum. - GraphPowerShellWorkflow RunbookTypeEnum = "GraphPowerShellWorkflow" - // PowerShell specifies the power shell state for runbook type enum. - PowerShell RunbookTypeEnum = "PowerShell" - // PowerShellWorkflow specifies the power shell workflow state for runbook - // type enum. - PowerShellWorkflow RunbookTypeEnum = "PowerShellWorkflow" - // Script specifies the script state for runbook type enum. - Script RunbookTypeEnum = "Script" -) - -// ScheduleDay enumerates the values for schedule day. -type ScheduleDay string - -const ( - // Friday specifies the friday state for schedule day. - Friday ScheduleDay = "Friday" - // Monday specifies the monday state for schedule day. - Monday ScheduleDay = "Monday" - // Saturday specifies the saturday state for schedule day. - Saturday ScheduleDay = "Saturday" - // Sunday specifies the sunday state for schedule day. - Sunday ScheduleDay = "Sunday" - // Thursday specifies the thursday state for schedule day. - Thursday ScheduleDay = "Thursday" - // Tuesday specifies the tuesday state for schedule day. - Tuesday ScheduleDay = "Tuesday" - // Wednesday specifies the wednesday state for schedule day. - Wednesday ScheduleDay = "Wednesday" -) - -// ScheduleFrequency enumerates the values for schedule frequency. -type ScheduleFrequency string - -const ( - // Day specifies the day state for schedule frequency. - Day ScheduleFrequency = "Day" - // Hour specifies the hour state for schedule frequency. - Hour ScheduleFrequency = "Hour" - // Month specifies the month state for schedule frequency. - Month ScheduleFrequency = "Month" - // OneTime specifies the one time state for schedule frequency. - OneTime ScheduleFrequency = "OneTime" - // Week specifies the week state for schedule frequency. - Week ScheduleFrequency = "Week" -) - -// SkuNameEnum enumerates the values for sku name enum. -type SkuNameEnum string - -const ( - // Basic specifies the basic state for sku name enum. - Basic SkuNameEnum = "Basic" - // Free specifies the free state for sku name enum. - Free SkuNameEnum = "Free" -) - -// Account is definition of the automation account type. -type Account struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AccountProperties `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// AccountCreateOrUpdateParameters is the parameters supplied to the create or -// update automation account operation. -type AccountCreateOrUpdateParameters struct { - *AccountCreateOrUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// AccountCreateOrUpdateProperties is the parameters supplied to the create or -// update account properties. -type AccountCreateOrUpdateProperties struct { - Sku *Sku `json:"sku,omitempty"` -} - -// AccountListResult is the response model for the list account operation. -type AccountListResult struct { - autorest.Response `json:"-"` - Value *[]Account `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AccountListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AccountListResult) AccountListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AccountProperties is definition of the account property. -type AccountProperties struct { - Sku *Sku `json:"sku,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - State AccountState `json:"state,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// AccountUpdateParameters is the parameters supplied to the update automation -// account operation. -type AccountUpdateParameters struct { - *AccountUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// AccountUpdateProperties is the parameters supplied to the update account -// properties. -type AccountUpdateProperties struct { - Sku *Sku `json:"sku,omitempty"` -} - -// Activity is definition of the activity. -type Activity struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *ActivityProperties `json:"properties,omitempty"` -} - -// ActivityListResult is the response model for the list activity operation. -type ActivityListResult struct { - autorest.Response `json:"-"` - Value *[]Activity `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ActivityListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ActivityListResult) ActivityListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ActivityOutputType is definition of the activity output type. -type ActivityOutputType struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// ActivityParameter is definition of the activity parameter. -type ActivityParameter struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - IsMandatory *bool `json:"isMandatory,omitempty"` - IsDynamic *bool `json:"isDynamic,omitempty"` - Position *bool `json:"position,omitempty"` - ValueFromPipeline *bool `json:"valueFromPipeline,omitempty"` - ValueFromPipelineByPropertyName *bool `json:"valueFromPipelineByPropertyName,omitempty"` - ValueFromRemainingArguments *bool `json:"valueFromRemainingArguments,omitempty"` -} - -// ActivityParameterSet is definition of the activity parameter set. -type ActivityParameterSet struct { - Name *string `json:"name,omitempty"` - Parameters *[]ActivityParameter `json:"parameters,omitempty"` -} - -// ActivityProperties is properties of the activity. -type ActivityProperties struct { - Definition *string `json:"definition,omitempty"` - ParameterSets *[]ActivityParameterSet `json:"parameterSets,omitempty"` - OutputTypes *[]ActivityOutputType `json:"outputTypes,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// AdvancedSchedule is the properties of the create Advanced Schedule. -type AdvancedSchedule struct { - WeekDays *[]string `json:"weekDays,omitempty"` - MonthDays *[]int32 `json:"monthDays,omitempty"` - MonthlyOccurrences *[]AdvancedScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// AdvancedScheduleMonthlyOccurrence is the properties of the create advanced -// schedule monthly occurrence. -type AdvancedScheduleMonthlyOccurrence struct { - Occurrence *int32 `json:"occurrence,omitempty"` - Day ScheduleDay `json:"day,omitempty"` -} - -// AgentRegistration is definition of the agent registration infomration type. -type AgentRegistration struct { - autorest.Response `json:"-"` - DscMetaConfiguration *string `json:"dscMetaConfiguration,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - Keys *AgentRegistrationKeys `json:"keys,omitempty"` - ID *string `json:"id,omitempty"` -} - -// AgentRegistrationKeys is definition of the agent registration keys. -type AgentRegistrationKeys struct { - Primary *string `json:"primary,omitempty"` - Secondary *string `json:"secondary,omitempty"` -} - -// AgentRegistrationRegenerateKeyParameter is the parameters supplied to the -// regenerate keys operation. -type AgentRegistrationRegenerateKeyParameter struct { - KeyName AgentRegistrationKeyName `json:"keyName,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Certificate is definition of the certificate. -type Certificate struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *CertificateProperties `json:"properties,omitempty"` -} - -// CertificateCreateOrUpdateParameters is the parameters supplied to the create -// or update or replace certificate operation. -type CertificateCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// CertificateCreateOrUpdateProperties is the properties of the create -// certificate operation. -type CertificateCreateOrUpdateProperties struct { - Base64Value *string `json:"base64Value,omitempty"` - Description *string `json:"description,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - IsExportable *bool `json:"isExportable,omitempty"` -} - -// CertificateListResult is the response model for the list certificate -// operation. -type CertificateListResult struct { - autorest.Response `json:"-"` - Value *[]Certificate `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateListResult) CertificateListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CertificateProperties is properties of the certificate. -type CertificateProperties struct { - Thumbprint *string `json:"thumbprint,omitempty"` - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - IsExportable *bool `json:"isExportable,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// CertificateUpdateParameters is the parameters supplied to the update -// certificate operation. -type CertificateUpdateParameters struct { - Name *string `json:"name,omitempty"` - *CertificateUpdateProperties `json:"properties,omitempty"` -} - -// CertificateUpdateProperties is the properties of the update certificate -// operation -type CertificateUpdateProperties struct { - Description *string `json:"description,omitempty"` -} - -// Connection is definition of the connection. -type Connection struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *ConnectionProperties `json:"properties,omitempty"` -} - -// ConnectionCreateOrUpdateParameters is the parameters supplied to the create -// or update connection operation. -type ConnectionCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *ConnectionCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// ConnectionCreateOrUpdateProperties is the properties of the create -// connection properties -type ConnectionCreateOrUpdateProperties struct { - Description *string `json:"description,omitempty"` - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - FieldDefinitionValues *map[string]*string `json:"fieldDefinitionValues,omitempty"` -} - -// ConnectionListResult is the response model for the list connection -// operation. -type ConnectionListResult struct { - autorest.Response `json:"-"` - Value *[]Connection `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ConnectionListResult) ConnectionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ConnectionProperties is definition of the connection properties. -type ConnectionProperties struct { - ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` - FieldDefinitionValues *map[string]*string `json:"fieldDefinitionValues,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ConnectionType is definition of the connection type. -type ConnectionType struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *ConnectionTypeProperties `json:"properties,omitempty"` -} - -// ConnectionTypeAssociationProperty is the connection type property associated -// with the entity. -type ConnectionTypeAssociationProperty struct { - Name *string `json:"name,omitempty"` -} - -// ConnectionTypeCreateOrUpdateParameters is the parameters supplied to the -// create or update connection type operation. -type ConnectionTypeCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *ConnectionTypeCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// ConnectionTypeCreateOrUpdateProperties is the properties of the create -// connection type. -type ConnectionTypeCreateOrUpdateProperties struct { - IsGlobal *bool `json:"isGlobal,omitempty"` - FieldDefinitions *map[string]*FieldDefinition `json:"fieldDefinitions,omitempty"` -} - -// ConnectionTypeListResult is the response model for the list connection type -// operation. -type ConnectionTypeListResult struct { - autorest.Response `json:"-"` - Value *[]ConnectionType `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionTypeListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ConnectionTypeListResult) ConnectionTypeListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ConnectionTypeProperties is properties of the connection type. -type ConnectionTypeProperties struct { - IsGlobal *bool `json:"isGlobal,omitempty"` - FieldDefinitions *map[string]*FieldDefinition `json:"fieldDefinitions,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ConnectionUpdateParameters is the parameters supplied to the update -// connection operation. -type ConnectionUpdateParameters struct { - Name *string `json:"name,omitempty"` - *ConnectionUpdateProperties `json:"properties,omitempty"` -} - -// ConnectionUpdateProperties is the properties of the update connection -// operation. -type ConnectionUpdateProperties struct { - Description *string `json:"description,omitempty"` - FieldDefinitionValues *map[string]*string `json:"fieldDefinitionValues,omitempty"` -} - -// ContentHash is definition of the runbook property type. -type ContentHash struct { - Algorithm *string `json:"algorithm,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ContentLink is definition of the content link. -type ContentLink struct { - URI *string `json:"uri,omitempty"` - ContentHash *ContentHash `json:"contentHash,omitempty"` - Version *string `json:"version,omitempty"` -} - -// ContentSource is definition of the content source. -type ContentSource struct { - Hash *ContentHash `json:"hash,omitempty"` - Type ContentSourceType `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - Version *string `json:"version,omitempty"` -} - -// Credential is definition of the credential. -type Credential struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *CredentialProperties `json:"properties,omitempty"` -} - -// CredentialCreateOrUpdateParameters is the parameters supplied to the create -// or update credential operation. -type CredentialCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *CredentialCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// CredentialCreateOrUpdateProperties is the properties of the create -// cerdential operation. -type CredentialCreateOrUpdateProperties struct { - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` - Description *string `json:"description,omitempty"` -} - -// CredentialListResult is the response model for the list credential -// operation. -type CredentialListResult struct { - autorest.Response `json:"-"` - Value *[]Credential `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CredentialListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CredentialListResult) CredentialListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CredentialProperties is definition of the credential properties -type CredentialProperties struct { - UserName *string `json:"userName,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// CredentialUpdateParameters is the parameters supplied to the Update -// credential operation. -type CredentialUpdateParameters struct { - Name *string `json:"name,omitempty"` - *CredentialUpdateProperties `json:"properties,omitempty"` -} - -// CredentialUpdateProperties is the properties of the Update credential -type CredentialUpdateProperties struct { - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` - Description *string `json:"description,omitempty"` -} - -// DscCompilationJob is definition of the Dsc Compilation job. -type DscCompilationJob struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *DscCompilationJobProperties `json:"properties,omitempty"` -} - -// DscCompilationJobCreateParameters is the parameters supplied to the create -// compilation job operation. -type DscCompilationJobCreateParameters struct { - *DscCompilationJobCreateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// DscCompilationJobCreateProperties is the parameters supplied to the create -// compilation job operation. -type DscCompilationJobCreateProperties struct { - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` -} - -// DscCompilationJobListResult is the response model for the list job -// operation. -type DscCompilationJobListResult struct { - autorest.Response `json:"-"` - Value *[]DscCompilationJob `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DscCompilationJobListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DscCompilationJobListResult) DscCompilationJobListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DscCompilationJobProperties is definition of Dsc Compilation job properties. -type DscCompilationJobProperties struct { - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - StartedBy *string `json:"startedBy,omitempty"` - JobID *uuid.UUID `json:"jobId,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - Status JobStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Exception *string `json:"exception,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` -} - -// DscConfiguration is definition of the configuration type. -type DscConfiguration struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DscConfigurationProperties `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// DscConfigurationAssociationProperty is the Dsc configuration property -// associated with the entity. -type DscConfigurationAssociationProperty struct { - Name *string `json:"name,omitempty"` -} - -// DscConfigurationCreateOrUpdateParameters is the parameters supplied to the -// create or update configuration operation. -type DscConfigurationCreateOrUpdateParameters struct { - *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// DscConfigurationCreateOrUpdateProperties is the properties to create or -// update configuration. -type DscConfigurationCreateOrUpdateProperties struct { - LogVerbose *bool `json:"logVerbose,omitempty"` - LogProgress *bool `json:"logProgress,omitempty"` - Source *ContentSource `json:"source,omitempty"` - Parameters *map[string]*DscConfigurationParameter `json:"parameters,omitempty"` - Description *string `json:"description,omitempty"` -} - -// DscConfigurationListResult is the response model for the list configuration -// operation. -type DscConfigurationListResult struct { - autorest.Response `json:"-"` - Value *[]DscConfiguration `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DscConfigurationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DscConfigurationListResult) DscConfigurationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DscConfigurationParameter is definition of the configuration parameter type. -type DscConfigurationParameter struct { - Type *string `json:"type,omitempty"` - IsMandatory *bool `json:"isMandatory,omitempty"` - Position *int32 `json:"position,omitempty"` - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// DscConfigurationProperties is definition of the configuration property type. -type DscConfigurationProperties struct { - ProvisioningState DscConfigurationProvisioningState `json:"provisioningState,omitempty"` - JobCount *int32 `json:"jobCount,omitempty"` - Parameters *map[string]*DscConfigurationParameter `json:"parameters,omitempty"` - Source *ContentSource `json:"source,omitempty"` - State DscConfigurationState `json:"state,omitempty"` - LogVerbose *bool `json:"logVerbose,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// DscMetaConfiguration is definition of the DSC Meta Configuration. -type DscMetaConfiguration struct { - ConfigurationModeFrequencyMins *int32 `json:"configurationModeFrequencyMins,omitempty"` - RebootNodeIfNeeded *bool `json:"rebootNodeIfNeeded,omitempty"` - ConfigurationMode *string `json:"configurationMode,omitempty"` - ActionAfterReboot *string `json:"actionAfterReboot,omitempty"` - CertificateID *string `json:"certificateId,omitempty"` - RefreshFrequencyMins *int32 `json:"refreshFrequencyMins,omitempty"` - AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` -} - -// DscNode is definition of the dsc node type. -type DscNode struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - LastSeen *date.Time `json:"lastSeen,omitempty"` - RegistrationTime *date.Time `json:"registrationTime,omitempty"` - IP *string `json:"ip,omitempty"` - AccountID *string `json:"accountId,omitempty"` - NodeConfiguration *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` - Status *string `json:"status,omitempty"` - NodeID *string `json:"nodeId,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// DscNodeConfiguration is definition of the dsc node configuration. -type DscNodeConfiguration struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` - ID *string `json:"id,omitempty"` -} - -// DscNodeConfigurationAssociationProperty is the dsc nodeconfiguration -// property associated with the entity. -type DscNodeConfigurationAssociationProperty struct { - Name *string `json:"name,omitempty"` -} - -// DscNodeConfigurationCreateOrUpdateParameters is the parameters supplied to -// the create or update node configuration operation. -type DscNodeConfigurationCreateOrUpdateParameters struct { - Source *ContentSource `json:"source,omitempty"` - Name *string `json:"name,omitempty"` - Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` -} - -// DscNodeConfigurationListResult is the response model for the list job -// operation. -type DscNodeConfigurationListResult struct { - autorest.Response `json:"-"` - Value *[]DscNodeConfiguration `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeConfigurationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DscNodeConfigurationListResult) DscNodeConfigurationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DscNodeListResult is the response model for the list dsc nodes operation. -type DscNodeListResult struct { - autorest.Response `json:"-"` - Value *[]DscNode `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DscNodeListResult) DscNodeListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DscNodeReport is definition of the dsc node report type. -type DscNodeReport struct { - autorest.Response `json:"-"` - EndTime *date.Time `json:"endTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - Type *string `json:"type,omitempty"` - ReportID *string `json:"reportId,omitempty"` - Status *string `json:"status,omitempty"` - RefreshMode *string `json:"refreshMode,omitempty"` - RebootRequested *string `json:"rebootRequested,omitempty"` - ReportFormatVersion *string `json:"reportFormatVersion,omitempty"` - ConfigurationVersion *string `json:"configurationVersion,omitempty"` - ID *string `json:"id,omitempty"` - Errors *[]DscReportError `json:"errors,omitempty"` - Resources *[]DscReportResource `json:"resources,omitempty"` - MetaConfiguration *DscMetaConfiguration `json:"metaConfiguration,omitempty"` - HostName *string `json:"hostName,omitempty"` - IPV4Addresses *[]string `json:"iPV4Addresses,omitempty"` - IPV6Addresses *[]string `json:"iPV6Addresses,omitempty"` - NumberOfResources *int32 `json:"numberOfResources,omitempty"` - RawErrors *string `json:"rawErrors,omitempty"` -} - -// DscNodeReportListResult is the response model for the list dsc nodes -// operation. -type DscNodeReportListResult struct { - autorest.Response `json:"-"` - Value *[]DscNodeReport `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DscNodeReportListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DscNodeReportListResult) DscNodeReportListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DscNodeUpdateParameters is the parameters supplied to the update dsc node -// operation. -type DscNodeUpdateParameters struct { - NodeID *string `json:"nodeId,omitempty"` - NodeConfiguration *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` -} - -// DscReportError is definition of the dsc node report error type. -type DscReportError struct { - ErrorSource *string `json:"errorSource,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - ErrorCode *string `json:"errorCode,omitempty"` - ErrorMessage *string `json:"errorMessage,omitempty"` - Locale *string `json:"locale,omitempty"` - ErrorDetails *string `json:"errorDetails,omitempty"` -} - -// DscReportResource is definition of the DSC Report Resource. -type DscReportResource struct { - ResourceID *string `json:"resourceId,omitempty"` - SourceInfo *string `json:"sourceInfo,omitempty"` - DependsOn *[]DscReportResourceNavigation `json:"dependsOn,omitempty"` - ModuleName *string `json:"moduleName,omitempty"` - ModuleVersion *string `json:"moduleVersion,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` - Error *string `json:"error,omitempty"` - Status *string `json:"status,omitempty"` - DurationInSeconds *float64 `json:"durationInSeconds,omitempty"` - StartDate *date.Time `json:"startDate,omitempty"` -} - -// DscReportResourceNavigation is navigation for DSC Report Resource. -type DscReportResourceNavigation struct { - ResourceID *string `json:"resourceId,omitempty"` -} - -// ErrorResponse is error response of an operation failure -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// FieldDefinition is definition of the connection fields. -type FieldDefinition struct { - IsEncrypted *bool `json:"isEncrypted,omitempty"` - IsOptional *bool `json:"isOptional,omitempty"` - Type *string `json:"type,omitempty"` -} - -// HybridRunbookWorker is definition of hybrid runbook worker. -type HybridRunbookWorker struct { - Name *string `json:"name,omitempty"` - IP *string `json:"ip,omitempty"` - RegistrationTime *date.Time `json:"registrationTime,omitempty"` -} - -// HybridRunbookWorkerGroup is definition of hybrid runbook worker group. -type HybridRunbookWorkerGroup struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - HybridRunbookWorkers *[]HybridRunbookWorker `json:"hybridRunbookWorkers,omitempty"` - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` -} - -// HybridRunbookWorkerGroupsListResult is the response model for the list -// hybrid runbook worker groups. -type HybridRunbookWorkerGroupsListResult struct { - autorest.Response `json:"-"` - Value *[]HybridRunbookWorkerGroup `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// HybridRunbookWorkerGroupsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client HybridRunbookWorkerGroupsListResult) HybridRunbookWorkerGroupsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// HybridRunbookWorkerGroupUpdateParameters is parameters supplied to the -// update operation. -type HybridRunbookWorkerGroupUpdateParameters struct { - Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` -} - -// Job is definition of the job. -type Job struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *JobProperties `json:"properties,omitempty"` -} - -// JobCreateParameters is the parameters supplied to the create job operation. -type JobCreateParameters struct { - *JobCreateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// JobCreateProperties is the parameters supplied to the create job operation. -type JobCreateProperties struct { - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` - RunOn *string `json:"runOn,omitempty"` -} - -// JobListResult is the response model for the list job operation. -type JobListResult struct { - autorest.Response `json:"-"` - Value *[]Job `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobListResult) JobListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobProperties is definition of job properties. -type JobProperties struct { - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - StartedBy *string `json:"startedBy,omitempty"` - RunOn *string `json:"runOn,omitempty"` - JobID *uuid.UUID `json:"jobId,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - Status JobStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Exception *string `json:"exception,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` -} - -// JobSchedule is definition of the job schedule. -type JobSchedule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *JobScheduleProperties `json:"properties,omitempty"` -} - -// JobScheduleCreateParameters is the parameters supplied to the create job -// schedule operation. -type JobScheduleCreateParameters struct { - *JobScheduleCreateProperties `json:"properties,omitempty"` -} - -// JobScheduleCreateProperties is the parameters supplied to the create job -// schedule operation. -type JobScheduleCreateProperties struct { - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - RunOn *string `json:"runOn,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` -} - -// JobScheduleListResult is the response model for the list job schedule -// operation. -type JobScheduleListResult struct { - autorest.Response `json:"-"` - Value *[]JobSchedule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobScheduleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobScheduleListResult) JobScheduleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobScheduleProperties is definition of job schedule parameters. -type JobScheduleProperties struct { - JobScheduleID *string `json:"jobScheduleId,omitempty"` - Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - RunOn *string `json:"runOn,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` -} - -// JobStream is definition of the job stream. -type JobStream struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *JobStreamProperties `json:"properties,omitempty"` -} - -// JobStreamListResult is the response model for the list job stream operation. -type JobStreamListResult struct { - autorest.Response `json:"-"` - Value *[]JobStream `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobStreamListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobStreamListResult) JobStreamListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobStreamProperties is definition of the job stream. -type JobStreamProperties struct { - JobStreamID *string `json:"jobStreamId,omitempty"` - Time *date.Time `json:"time,omitempty"` - StreamType JobStreamType `json:"streamType,omitempty"` - StreamText *string `json:"streamText,omitempty"` - Summary *string `json:"summary,omitempty"` - Value *map[string]*map[string]interface{} `json:"value,omitempty"` -} - -// Module is definition of the module type. -type Module struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ModuleProperties `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ModuleCreateOrUpdateParameters is the parameters supplied to the create or -// update module operation. -type ModuleCreateOrUpdateParameters struct { - *ModuleCreateOrUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ModuleCreateOrUpdateProperties is the parameters supplied to the create or -// update module properties. -type ModuleCreateOrUpdateProperties struct { - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// ModuleErrorInfo is definition of the module error info type. -type ModuleErrorInfo struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ModuleListResult is the response model for the list module operation. -type ModuleListResult struct { - autorest.Response `json:"-"` - Value *[]Module `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ModuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ModuleListResult) ModuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ModuleProperties is definition of the module property type. -type ModuleProperties struct { - IsGlobal *bool `json:"isGlobal,omitempty"` - Version *string `json:"version,omitempty"` - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - ActivityCount *int32 `json:"activityCount,omitempty"` - ProvisioningState ModuleProvisioningState `json:"provisioningState,omitempty"` - ContentLink *ContentLink `json:"contentLink,omitempty"` - Error *ModuleErrorInfo `json:"error,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ModuleUpdateParameters is the parameters supplied to the update module -// operation. -type ModuleUpdateParameters struct { - *ModuleUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ModuleUpdateProperties is the parameters supplied to the update properties. -type ModuleUpdateProperties struct { - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// Operation is automation REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is provider, Resource and Operation values -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is the response model for the list of Automation -// operations -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` -} - -// ReadCloser is -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} - -// Resource is the Resource definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RunAsCredentialAssociationProperty is definition of runas credential to use -// for hybrid worker. -type RunAsCredentialAssociationProperty struct { - Name *string `json:"name,omitempty"` -} - -// Runbook is definition of the runbook type. -type Runbook struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RunbookProperties `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// RunbookAssociationProperty is the runbook property associated with the -// entity. -type RunbookAssociationProperty struct { - Name *string `json:"name,omitempty"` -} - -// RunbookCreateOrUpdateParameters is the parameters supplied to the create or -// update runbook operation. -type RunbookCreateOrUpdateParameters struct { - *RunbookCreateOrUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RunbookCreateOrUpdateProperties is the parameters supplied to the create or -// update runbook properties. -type RunbookCreateOrUpdateProperties struct { - LogVerbose *bool `json:"logVerbose,omitempty"` - LogProgress *bool `json:"logProgress,omitempty"` - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - Draft *RunbookDraft `json:"draft,omitempty"` - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - Description *string `json:"description,omitempty"` - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// RunbookDraft is definition of the runbook type. -type RunbookDraft struct { - autorest.Response `json:"-"` - InEdit *bool `json:"inEdit,omitempty"` - DraftContentLink *ContentLink `json:"draftContentLink,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Parameters *map[string]*RunbookParameter `json:"parameters,omitempty"` - OutputTypes *[]string `json:"outputTypes,omitempty"` -} - -// RunbookDraftUndoEditResult is the response model for the undoedit runbook -// operation. -type RunbookDraftUndoEditResult struct { - autorest.Response `json:"-"` - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - RequestID *string `json:"requestId,omitempty"` -} - -// RunbookListResult is the response model for the list runbook operation. -type RunbookListResult struct { - autorest.Response `json:"-"` - Value *[]Runbook `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RunbookListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RunbookListResult) RunbookListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RunbookParameter is definition of the runbook parameter type. -type RunbookParameter struct { - Type *string `json:"type,omitempty"` - IsMandatory *bool `json:"isMandatory,omitempty"` - Position *int32 `json:"position,omitempty"` - DefaultValue *string `json:"defaultValue,omitempty"` -} - -// RunbookProperties is definition of the runbook property type. -type RunbookProperties struct { - RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` - PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` - State RunbookState `json:"state,omitempty"` - LogVerbose *bool `json:"logVerbose,omitempty"` - LogProgress *bool `json:"logProgress,omitempty"` - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` - JobCount *int32 `json:"jobCount,omitempty"` - Parameters *map[string]*RunbookParameter `json:"parameters,omitempty"` - OutputTypes *[]string `json:"outputTypes,omitempty"` - Draft *RunbookDraft `json:"draft,omitempty"` - ProvisioningState RunbookProvisioningState `json:"provisioningState,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// RunbookUpdateParameters is the parameters supplied to the update runbook -// operation. -type RunbookUpdateParameters struct { - *RunbookUpdateProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RunbookUpdateProperties is the parameters supplied to the update runbook -// properties. -type RunbookUpdateProperties struct { - Description *string `json:"description,omitempty"` - LogVerbose *bool `json:"logVerbose,omitempty"` - LogProgress *bool `json:"logProgress,omitempty"` - LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` -} - -// Schedule is definition of the schedule. -type Schedule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *ScheduleProperties `json:"properties,omitempty"` -} - -// ScheduleAssociationProperty is the schedule property associated with the -// entity. -type ScheduleAssociationProperty struct { - Name *string `json:"name,omitempty"` -} - -// ScheduleCreateOrUpdateParameters is the parameters supplied to the create or -// update schedule operation. -type ScheduleCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *ScheduleCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// ScheduleCreateOrUpdateProperties is the parameters supplied to the create or -// update schedule operation. -type ScheduleCreateOrUpdateProperties struct { - Description *string `json:"description,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - Interval *map[string]interface{} `json:"interval,omitempty"` - Frequency ScheduleFrequency `json:"frequency,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` -} - -// ScheduleListResult is the response model for the list schedule operation. -type ScheduleListResult struct { - autorest.Response `json:"-"` - Value *[]Schedule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ScheduleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ScheduleListResult) ScheduleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ScheduleProperties is definition of schedule parameters. -type ScheduleProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - StartTimeOffsetMinutes *float64 `json:"startTimeOffsetMinutes,omitempty"` - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - ExpiryTimeOffsetMinutes *float64 `json:"expiryTimeOffsetMinutes,omitempty"` - IsEnabled *bool `json:"isEnabled,omitempty"` - NextRun *date.Time `json:"nextRun,omitempty"` - NextRunOffsetMinutes *float64 `json:"nextRunOffsetMinutes,omitempty"` - Interval *map[string]interface{} `json:"interval,omitempty"` - Frequency ScheduleFrequency `json:"frequency,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` - AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ScheduleUpdateParameters is the parameters supplied to the update schedule -// operation. -type ScheduleUpdateParameters struct { - Name *string `json:"name,omitempty"` - *ScheduleUpdateProperties `json:"properties,omitempty"` -} - -// ScheduleUpdateProperties is the parameters supplied to the update schedule -// operation. -type ScheduleUpdateProperties struct { - Description *string `json:"description,omitempty"` - IsEnabled *bool `json:"isEnabled,omitempty"` -} - -// Sku is the account SKU. -type Sku struct { - Name SkuNameEnum `json:"name,omitempty"` - Family *string `json:"family,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// Statistics is definition of the statistic. -type Statistics struct { - CounterProperty *string `json:"counterProperty,omitempty"` - CounterValue *int64 `json:"counterValue,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ID *string `json:"id,omitempty"` -} - -// StatisticsListResult is the response model for the list statistics -// operation. -type StatisticsListResult struct { - autorest.Response `json:"-"` - Value *[]Statistics `json:"value,omitempty"` -} - -// String is -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// TestJob is definition of the test job. -type TestJob struct { - autorest.Response `json:"-"` - CreationTime *date.Time `json:"creationTime,omitempty"` - Status *string `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - RunOn *string `json:"runOn,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Exception *string `json:"exception,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` -} - -// TestJobCreateParameters is the parameters supplied to the create test job -// operation. -type TestJobCreateParameters struct { - RunbookName *string `json:"runbookName,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` - RunOn *string `json:"runOn,omitempty"` -} - -// TypeField is information about a field of a type. -type TypeField struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// TypeFieldListResult is the response model for the list fields operation. -type TypeFieldListResult struct { - autorest.Response `json:"-"` - Value *[]TypeField `json:"value,omitempty"` -} - -// Usage is definition of Usage. -type Usage struct { - ID *string `json:"id,omitempty"` - Name *UsageCounterName `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - CurrentValue *float64 `json:"currentValue,omitempty"` - Limit *int64 `json:"limit,omitempty"` - ThrottleStatus *string `json:"throttleStatus,omitempty"` -} - -// UsageCounterName is definition of usage counter name. -type UsageCounterName struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// UsageListResult is the response model for the get usage operation. -type UsageListResult struct { - autorest.Response `json:"-"` - Value *[]Usage `json:"value,omitempty"` -} - -// Variable is definition of the varible. -type Variable struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *VariableProperties `json:"properties,omitempty"` -} - -// VariableCreateOrUpdateParameters is the parameters supplied to the create or -// update variable operation. -type VariableCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *VariableCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// VariableCreateOrUpdateProperties is the properties of the create variable -// operation. -type VariableCreateOrUpdateProperties struct { - Value *string `json:"value,omitempty"` - Description *string `json:"description,omitempty"` - IsEncrypted *bool `json:"isEncrypted,omitempty"` -} - -// VariableListResult is the response model for the list variables operation. -type VariableListResult struct { - autorest.Response `json:"-"` - Value *[]Variable `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VariableListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VariableListResult) VariableListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VariableProperties is definition of the varible properties -type VariableProperties struct { - Value *string `json:"value,omitempty"` - IsEncrypted *bool `json:"isEncrypted,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// VariableUpdateParameters is the parameters supplied to the update variable -// operation. -type VariableUpdateParameters struct { - Name *string `json:"name,omitempty"` - *VariableUpdateProperties `json:"properties,omitempty"` -} - -// VariableUpdateProperties is the properties of the update variable -type VariableUpdateProperties struct { - Value *string `json:"value,omitempty"` - Description *string `json:"description,omitempty"` -} - -// Webhook is definition of the webhook type. -type Webhook struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *WebhookProperties `json:"properties,omitempty"` -} - -// WebhookCreateOrUpdateParameters is the parameters supplied to the create or -// update webhook operation. -type WebhookCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - *WebhookCreateOrUpdateProperties `json:"properties,omitempty"` -} - -// WebhookCreateOrUpdateProperties is the properties of the create webhook -// operation. -type WebhookCreateOrUpdateProperties struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - URI *string `json:"uri,omitempty"` - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - RunOn *string `json:"runOn,omitempty"` -} - -// WebhookListResult is the response model for the list webhook operation. -type WebhookListResult struct { - autorest.Response `json:"-"` - Value *[]Webhook `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WebhookListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WebhookListResult) WebhookListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WebhookProperties is definition of the webhook properties -type WebhookProperties struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - URI *string `json:"uri,omitempty"` - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - LastInvokedTime *date.Time `json:"lastInvokedTime,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` - Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` - RunOn *string `json:"runOn,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Description *string `json:"description,omitempty"` -} - -// WebhookUpdateParameters is the parameters supplied to the update webhook -// operation. -type WebhookUpdateParameters struct { - Name *string `json:"name,omitempty"` - *WebhookUpdateProperties `json:"properties,omitempty"` -} - -// WebhookUpdateProperties is the properties of the update webhook. -type WebhookUpdateProperties struct { - IsEnabled *bool `json:"isEnabled,omitempty"` - RunOn *string `json:"runOn,omitempty"` - Parameters *map[string]*string `json:"parameters,omitempty"` - Description *string `json:"description,omitempty"` -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" + "io" + "net/http" +) + +// AccountState enumerates the values for account state. +type AccountState string + +const ( + // Ok specifies the ok state for account state. + Ok AccountState = "Ok" + // Suspended specifies the suspended state for account state. + Suspended AccountState = "Suspended" + // Unavailable specifies the unavailable state for account state. + Unavailable AccountState = "Unavailable" +) + +// AgentRegistrationKeyName enumerates the values for agent registration key +// name. +type AgentRegistrationKeyName string + +const ( + // Primary specifies the primary state for agent registration key name. + Primary AgentRegistrationKeyName = "Primary" + // Secondary specifies the secondary state for agent registration key name. + Secondary AgentRegistrationKeyName = "Secondary" +) + +// ContentSourceType enumerates the values for content source type. +type ContentSourceType string + +const ( + // EmbeddedContent specifies the embedded content state for content source + // type. + EmbeddedContent ContentSourceType = "embeddedContent" + // URI specifies the uri state for content source type. + URI ContentSourceType = "uri" +) + +// DscConfigurationProvisioningState enumerates the values for dsc +// configuration provisioning state. +type DscConfigurationProvisioningState string + +const ( + // Succeeded specifies the succeeded state for dsc configuration + // provisioning state. + Succeeded DscConfigurationProvisioningState = "Succeeded" +) + +// DscConfigurationState enumerates the values for dsc configuration state. +type DscConfigurationState string + +const ( + // DscConfigurationStateEdit specifies the dsc configuration state edit + // state for dsc configuration state. + DscConfigurationStateEdit DscConfigurationState = "Edit" + // DscConfigurationStateNew specifies the dsc configuration state new state + // for dsc configuration state. + DscConfigurationStateNew DscConfigurationState = "New" + // DscConfigurationStatePublished specifies the dsc configuration state + // published state for dsc configuration state. + DscConfigurationStatePublished DscConfigurationState = "Published" +) + +// HTTPStatusCode enumerates the values for http status code. +type HTTPStatusCode string + +const ( + // Accepted specifies the accepted state for http status code. + Accepted HTTPStatusCode = "Accepted" + // Ambiguous specifies the ambiguous state for http status code. + Ambiguous HTTPStatusCode = "Ambiguous" + // BadGateway specifies the bad gateway state for http status code. + BadGateway HTTPStatusCode = "BadGateway" + // BadRequest specifies the bad request state for http status code. + BadRequest HTTPStatusCode = "BadRequest" + // Conflict specifies the conflict state for http status code. + Conflict HTTPStatusCode = "Conflict" + // Continue specifies the continue state for http status code. + Continue HTTPStatusCode = "Continue" + // Created specifies the created state for http status code. + Created HTTPStatusCode = "Created" + // ExpectationFailed specifies the expectation failed state for http status + // code. + ExpectationFailed HTTPStatusCode = "ExpectationFailed" + // Forbidden specifies the forbidden state for http status code. + Forbidden HTTPStatusCode = "Forbidden" + // Found specifies the found state for http status code. + Found HTTPStatusCode = "Found" + // GatewayTimeout specifies the gateway timeout state for http status code. + GatewayTimeout HTTPStatusCode = "GatewayTimeout" + // Gone specifies the gone state for http status code. + Gone HTTPStatusCode = "Gone" + // HTTPVersionNotSupported specifies the http version not supported state + // for http status code. + HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" + // InternalServerError specifies the internal server error state for http + // status code. + InternalServerError HTTPStatusCode = "InternalServerError" + // LengthRequired specifies the length required state for http status code. + LengthRequired HTTPStatusCode = "LengthRequired" + // MethodNotAllowed specifies the method not allowed state for http status + // code. + MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" + // Moved specifies the moved state for http status code. + Moved HTTPStatusCode = "Moved" + // MovedPermanently specifies the moved permanently state for http status + // code. + MovedPermanently HTTPStatusCode = "MovedPermanently" + // MultipleChoices specifies the multiple choices state for http status + // code. + MultipleChoices HTTPStatusCode = "MultipleChoices" + // NoContent specifies the no content state for http status code. + NoContent HTTPStatusCode = "NoContent" + // NonAuthoritativeInformation specifies the non authoritative information + // state for http status code. + NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" + // NotAcceptable specifies the not acceptable state for http status code. + NotAcceptable HTTPStatusCode = "NotAcceptable" + // NotFound specifies the not found state for http status code. + NotFound HTTPStatusCode = "NotFound" + // NotImplemented specifies the not implemented state for http status code. + NotImplemented HTTPStatusCode = "NotImplemented" + // NotModified specifies the not modified state for http status code. + NotModified HTTPStatusCode = "NotModified" + // OK specifies the ok state for http status code. + OK HTTPStatusCode = "OK" + // PartialContent specifies the partial content state for http status code. + PartialContent HTTPStatusCode = "PartialContent" + // PaymentRequired specifies the payment required state for http status + // code. + PaymentRequired HTTPStatusCode = "PaymentRequired" + // PreconditionFailed specifies the precondition failed state for http + // status code. + PreconditionFailed HTTPStatusCode = "PreconditionFailed" + // ProxyAuthenticationRequired specifies the proxy authentication required + // state for http status code. + ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" + // Redirect specifies the redirect state for http status code. + Redirect HTTPStatusCode = "Redirect" + // RedirectKeepVerb specifies the redirect keep verb state for http status + // code. + RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" + // RedirectMethod specifies the redirect method state for http status code. + RedirectMethod HTTPStatusCode = "RedirectMethod" + // RequestedRangeNotSatisfiable specifies the requested range not + // satisfiable state for http status code. + RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" + // RequestEntityTooLarge specifies the request entity too large state for + // http status code. + RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" + // RequestTimeout specifies the request timeout state for http status code. + RequestTimeout HTTPStatusCode = "RequestTimeout" + // RequestURITooLong specifies the request uri too long state for http + // status code. + RequestURITooLong HTTPStatusCode = "RequestUriTooLong" + // ResetContent specifies the reset content state for http status code. + ResetContent HTTPStatusCode = "ResetContent" + // SeeOther specifies the see other state for http status code. + SeeOther HTTPStatusCode = "SeeOther" + // ServiceUnavailable specifies the service unavailable state for http + // status code. + ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" + // SwitchingProtocols specifies the switching protocols state for http + // status code. + SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" + // TemporaryRedirect specifies the temporary redirect state for http status + // code. + TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" + // Unauthorized specifies the unauthorized state for http status code. + Unauthorized HTTPStatusCode = "Unauthorized" + // UnsupportedMediaType specifies the unsupported media type state for http + // status code. + UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" + // Unused specifies the unused state for http status code. + Unused HTTPStatusCode = "Unused" + // UpgradeRequired specifies the upgrade required state for http status + // code. + UpgradeRequired HTTPStatusCode = "UpgradeRequired" + // UseProxy specifies the use proxy state for http status code. + UseProxy HTTPStatusCode = "UseProxy" +) + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // JobStatusActivating specifies the job status activating state for job + // status. + JobStatusActivating JobStatus = "Activating" + // JobStatusBlocked specifies the job status blocked state for job status. + JobStatusBlocked JobStatus = "Blocked" + // JobStatusCompleted specifies the job status completed state for job + // status. + JobStatusCompleted JobStatus = "Completed" + // JobStatusDisconnected specifies the job status disconnected state for + // job status. + JobStatusDisconnected JobStatus = "Disconnected" + // JobStatusFailed specifies the job status failed state for job status. + JobStatusFailed JobStatus = "Failed" + // JobStatusNew specifies the job status new state for job status. + JobStatusNew JobStatus = "New" + // JobStatusRemoving specifies the job status removing state for job + // status. + JobStatusRemoving JobStatus = "Removing" + // JobStatusResuming specifies the job status resuming state for job + // status. + JobStatusResuming JobStatus = "Resuming" + // JobStatusRunning specifies the job status running state for job status. + JobStatusRunning JobStatus = "Running" + // JobStatusStopped specifies the job status stopped state for job status. + JobStatusStopped JobStatus = "Stopped" + // JobStatusStopping specifies the job status stopping state for job + // status. + JobStatusStopping JobStatus = "Stopping" + // JobStatusSuspended specifies the job status suspended state for job + // status. + JobStatusSuspended JobStatus = "Suspended" + // JobStatusSuspending specifies the job status suspending state for job + // status. + JobStatusSuspending JobStatus = "Suspending" +) + +// JobStreamType enumerates the values for job stream type. +type JobStreamType string + +const ( + // Any specifies the any state for job stream type. + Any JobStreamType = "Any" + // Debug specifies the debug state for job stream type. + Debug JobStreamType = "Debug" + // Error specifies the error state for job stream type. + Error JobStreamType = "Error" + // Output specifies the output state for job stream type. + Output JobStreamType = "Output" + // Progress specifies the progress state for job stream type. + Progress JobStreamType = "Progress" + // Verbose specifies the verbose state for job stream type. + Verbose JobStreamType = "Verbose" + // Warning specifies the warning state for job stream type. + Warning JobStreamType = "Warning" +) + +// ModuleProvisioningState enumerates the values for module provisioning state. +type ModuleProvisioningState string + +const ( + // ModuleProvisioningStateActivitiesStored specifies the module + // provisioning state activities stored state for module provisioning + // state. + ModuleProvisioningStateActivitiesStored ModuleProvisioningState = "ActivitiesStored" + // ModuleProvisioningStateCancelled specifies the module provisioning state + // cancelled state for module provisioning state. + ModuleProvisioningStateCancelled ModuleProvisioningState = "Cancelled" + // ModuleProvisioningStateConnectionTypeImported specifies the module + // provisioning state connection type imported state for module + // provisioning state. + ModuleProvisioningStateConnectionTypeImported ModuleProvisioningState = "ConnectionTypeImported" + // ModuleProvisioningStateContentDownloaded specifies the module + // provisioning state content downloaded state for module provisioning + // state. + ModuleProvisioningStateContentDownloaded ModuleProvisioningState = "ContentDownloaded" + // ModuleProvisioningStateContentRetrieved specifies the module + // provisioning state content retrieved state for module provisioning + // state. + ModuleProvisioningStateContentRetrieved ModuleProvisioningState = "ContentRetrieved" + // ModuleProvisioningStateContentStored specifies the module provisioning + // state content stored state for module provisioning state. + ModuleProvisioningStateContentStored ModuleProvisioningState = "ContentStored" + // ModuleProvisioningStateContentValidated specifies the module + // provisioning state content validated state for module provisioning + // state. + ModuleProvisioningStateContentValidated ModuleProvisioningState = "ContentValidated" + // ModuleProvisioningStateCreated specifies the module provisioning state + // created state for module provisioning state. + ModuleProvisioningStateCreated ModuleProvisioningState = "Created" + // ModuleProvisioningStateCreating specifies the module provisioning state + // creating state for module provisioning state. + ModuleProvisioningStateCreating ModuleProvisioningState = "Creating" + // ModuleProvisioningStateFailed specifies the module provisioning state + // failed state for module provisioning state. + ModuleProvisioningStateFailed ModuleProvisioningState = "Failed" + // ModuleProvisioningStateModuleDataStored specifies the module + // provisioning state module data stored state for module provisioning + // state. + ModuleProvisioningStateModuleDataStored ModuleProvisioningState = "ModuleDataStored" + // ModuleProvisioningStateModuleImportRunbookComplete specifies the module + // provisioning state module import runbook complete state for module + // provisioning state. + ModuleProvisioningStateModuleImportRunbookComplete ModuleProvisioningState = "ModuleImportRunbookComplete" + // ModuleProvisioningStateRunningImportModuleRunbook specifies the module + // provisioning state running import module runbook state for module + // provisioning state. + ModuleProvisioningStateRunningImportModuleRunbook ModuleProvisioningState = "RunningImportModuleRunbook" + // ModuleProvisioningStateStartingImportModuleRunbook specifies the module + // provisioning state starting import module runbook state for module + // provisioning state. + ModuleProvisioningStateStartingImportModuleRunbook ModuleProvisioningState = "StartingImportModuleRunbook" + // ModuleProvisioningStateSucceeded specifies the module provisioning state + // succeeded state for module provisioning state. + ModuleProvisioningStateSucceeded ModuleProvisioningState = "Succeeded" + // ModuleProvisioningStateUpdating specifies the module provisioning state + // updating state for module provisioning state. + ModuleProvisioningStateUpdating ModuleProvisioningState = "Updating" +) + +// RunbookProvisioningState enumerates the values for runbook provisioning +// state. +type RunbookProvisioningState string + +const ( + // RunbookProvisioningStateSucceeded specifies the runbook provisioning + // state succeeded state for runbook provisioning state. + RunbookProvisioningStateSucceeded RunbookProvisioningState = "Succeeded" +) + +// RunbookState enumerates the values for runbook state. +type RunbookState string + +const ( + // RunbookStateEdit specifies the runbook state edit state for runbook + // state. + RunbookStateEdit RunbookState = "Edit" + // RunbookStateNew specifies the runbook state new state for runbook state. + RunbookStateNew RunbookState = "New" + // RunbookStatePublished specifies the runbook state published state for + // runbook state. + RunbookStatePublished RunbookState = "Published" +) + +// RunbookTypeEnum enumerates the values for runbook type enum. +type RunbookTypeEnum string + +const ( + // Graph specifies the graph state for runbook type enum. + Graph RunbookTypeEnum = "Graph" + // GraphPowerShell specifies the graph power shell state for runbook type + // enum. + GraphPowerShell RunbookTypeEnum = "GraphPowerShell" + // GraphPowerShellWorkflow specifies the graph power shell workflow state + // for runbook type enum. + GraphPowerShellWorkflow RunbookTypeEnum = "GraphPowerShellWorkflow" + // PowerShell specifies the power shell state for runbook type enum. + PowerShell RunbookTypeEnum = "PowerShell" + // PowerShellWorkflow specifies the power shell workflow state for runbook + // type enum. + PowerShellWorkflow RunbookTypeEnum = "PowerShellWorkflow" + // Script specifies the script state for runbook type enum. + Script RunbookTypeEnum = "Script" +) + +// ScheduleDay enumerates the values for schedule day. +type ScheduleDay string + +const ( + // Friday specifies the friday state for schedule day. + Friday ScheduleDay = "Friday" + // Monday specifies the monday state for schedule day. + Monday ScheduleDay = "Monday" + // Saturday specifies the saturday state for schedule day. + Saturday ScheduleDay = "Saturday" + // Sunday specifies the sunday state for schedule day. + Sunday ScheduleDay = "Sunday" + // Thursday specifies the thursday state for schedule day. + Thursday ScheduleDay = "Thursday" + // Tuesday specifies the tuesday state for schedule day. + Tuesday ScheduleDay = "Tuesday" + // Wednesday specifies the wednesday state for schedule day. + Wednesday ScheduleDay = "Wednesday" +) + +// ScheduleFrequency enumerates the values for schedule frequency. +type ScheduleFrequency string + +const ( + // Day specifies the day state for schedule frequency. + Day ScheduleFrequency = "Day" + // Hour specifies the hour state for schedule frequency. + Hour ScheduleFrequency = "Hour" + // Month specifies the month state for schedule frequency. + Month ScheduleFrequency = "Month" + // OneTime specifies the one time state for schedule frequency. + OneTime ScheduleFrequency = "OneTime" + // Week specifies the week state for schedule frequency. + Week ScheduleFrequency = "Week" +) + +// SkuNameEnum enumerates the values for sku name enum. +type SkuNameEnum string + +const ( + // Basic specifies the basic state for sku name enum. + Basic SkuNameEnum = "Basic" + // Free specifies the free state for sku name enum. + Free SkuNameEnum = "Free" +) + +// Account is definition of the automation account type. +type Account struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AccountProperties `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// AccountCreateOrUpdateParameters is the parameters supplied to the create or +// update automation account operation. +type AccountCreateOrUpdateParameters struct { + *AccountCreateOrUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// AccountCreateOrUpdateProperties is the parameters supplied to the create or +// update account properties. +type AccountCreateOrUpdateProperties struct { + Sku *Sku `json:"sku,omitempty"` +} + +// AccountListResult is the response model for the list account operation. +type AccountListResult struct { + autorest.Response `json:"-"` + Value *[]Account `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AccountListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AccountListResult) AccountListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AccountProperties is definition of the account property. +type AccountProperties struct { + Sku *Sku `json:"sku,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + State AccountState `json:"state,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// AccountUpdateParameters is the parameters supplied to the update automation +// account operation. +type AccountUpdateParameters struct { + *AccountUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// AccountUpdateProperties is the parameters supplied to the update account +// properties. +type AccountUpdateProperties struct { + Sku *Sku `json:"sku,omitempty"` +} + +// Activity is definition of the activity. +type Activity struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *ActivityProperties `json:"properties,omitempty"` +} + +// ActivityListResult is the response model for the list activity operation. +type ActivityListResult struct { + autorest.Response `json:"-"` + Value *[]Activity `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ActivityListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ActivityListResult) ActivityListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ActivityOutputType is definition of the activity output type. +type ActivityOutputType struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// ActivityParameter is definition of the activity parameter. +type ActivityParameter struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + IsMandatory *bool `json:"isMandatory,omitempty"` + IsDynamic *bool `json:"isDynamic,omitempty"` + Position *bool `json:"position,omitempty"` + ValueFromPipeline *bool `json:"valueFromPipeline,omitempty"` + ValueFromPipelineByPropertyName *bool `json:"valueFromPipelineByPropertyName,omitempty"` + ValueFromRemainingArguments *bool `json:"valueFromRemainingArguments,omitempty"` +} + +// ActivityParameterSet is definition of the activity parameter set. +type ActivityParameterSet struct { + Name *string `json:"name,omitempty"` + Parameters *[]ActivityParameter `json:"parameters,omitempty"` +} + +// ActivityProperties is properties of the activity. +type ActivityProperties struct { + Definition *string `json:"definition,omitempty"` + ParameterSets *[]ActivityParameterSet `json:"parameterSets,omitempty"` + OutputTypes *[]ActivityOutputType `json:"outputTypes,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// AdvancedSchedule is the properties of the create Advanced Schedule. +type AdvancedSchedule struct { + WeekDays *[]string `json:"weekDays,omitempty"` + MonthDays *[]int32 `json:"monthDays,omitempty"` + MonthlyOccurrences *[]AdvancedScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` +} + +// AdvancedScheduleMonthlyOccurrence is the properties of the create advanced +// schedule monthly occurrence. +type AdvancedScheduleMonthlyOccurrence struct { + Occurrence *int32 `json:"occurrence,omitempty"` + Day ScheduleDay `json:"day,omitempty"` +} + +// AgentRegistration is definition of the agent registration infomration type. +type AgentRegistration struct { + autorest.Response `json:"-"` + DscMetaConfiguration *string `json:"dscMetaConfiguration,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + Keys *AgentRegistrationKeys `json:"keys,omitempty"` + ID *string `json:"id,omitempty"` +} + +// AgentRegistrationKeys is definition of the agent registration keys. +type AgentRegistrationKeys struct { + Primary *string `json:"primary,omitempty"` + Secondary *string `json:"secondary,omitempty"` +} + +// AgentRegistrationRegenerateKeyParameter is the parameters supplied to the +// regenerate keys operation. +type AgentRegistrationRegenerateKeyParameter struct { + KeyName AgentRegistrationKeyName `json:"keyName,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Certificate is definition of the certificate. +type Certificate struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *CertificateProperties `json:"properties,omitempty"` +} + +// CertificateCreateOrUpdateParameters is the parameters supplied to the create +// or update or replace certificate operation. +type CertificateCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// CertificateCreateOrUpdateProperties is the properties of the create +// certificate operation. +type CertificateCreateOrUpdateProperties struct { + Base64Value *string `json:"base64Value,omitempty"` + Description *string `json:"description,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + IsExportable *bool `json:"isExportable,omitempty"` +} + +// CertificateListResult is the response model for the list certificate +// operation. +type CertificateListResult struct { + autorest.Response `json:"-"` + Value *[]Certificate `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CertificateListResult) CertificateListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CertificateProperties is properties of the certificate. +type CertificateProperties struct { + Thumbprint *string `json:"thumbprint,omitempty"` + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + IsExportable *bool `json:"isExportable,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// CertificateUpdateParameters is the parameters supplied to the update +// certificate operation. +type CertificateUpdateParameters struct { + Name *string `json:"name,omitempty"` + *CertificateUpdateProperties `json:"properties,omitempty"` +} + +// CertificateUpdateProperties is the properties of the update certificate +// operation +type CertificateUpdateProperties struct { + Description *string `json:"description,omitempty"` +} + +// Connection is definition of the connection. +type Connection struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *ConnectionProperties `json:"properties,omitempty"` +} + +// ConnectionCreateOrUpdateParameters is the parameters supplied to the create +// or update connection operation. +type ConnectionCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *ConnectionCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// ConnectionCreateOrUpdateProperties is the properties of the create +// connection properties +type ConnectionCreateOrUpdateProperties struct { + Description *string `json:"description,omitempty"` + ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` + FieldDefinitionValues *map[string]*string `json:"fieldDefinitionValues,omitempty"` +} + +// ConnectionListResult is the response model for the list connection +// operation. +type ConnectionListResult struct { + autorest.Response `json:"-"` + Value *[]Connection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConnectionListResult) ConnectionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ConnectionProperties is definition of the connection properties. +type ConnectionProperties struct { + ConnectionType *ConnectionTypeAssociationProperty `json:"connectionType,omitempty"` + FieldDefinitionValues *map[string]*string `json:"fieldDefinitionValues,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ConnectionType is definition of the connection type. +type ConnectionType struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *ConnectionTypeProperties `json:"properties,omitempty"` +} + +// ConnectionTypeAssociationProperty is the connection type property associated +// with the entity. +type ConnectionTypeAssociationProperty struct { + Name *string `json:"name,omitempty"` +} + +// ConnectionTypeCreateOrUpdateParameters is the parameters supplied to the +// create or update connection type operation. +type ConnectionTypeCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *ConnectionTypeCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// ConnectionTypeCreateOrUpdateProperties is the properties of the create +// connection type. +type ConnectionTypeCreateOrUpdateProperties struct { + IsGlobal *bool `json:"isGlobal,omitempty"` + FieldDefinitions *map[string]*FieldDefinition `json:"fieldDefinitions,omitempty"` +} + +// ConnectionTypeListResult is the response model for the list connection type +// operation. +type ConnectionTypeListResult struct { + autorest.Response `json:"-"` + Value *[]ConnectionType `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectionTypeListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConnectionTypeListResult) ConnectionTypeListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ConnectionTypeProperties is properties of the connection type. +type ConnectionTypeProperties struct { + IsGlobal *bool `json:"isGlobal,omitempty"` + FieldDefinitions *map[string]*FieldDefinition `json:"fieldDefinitions,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ConnectionUpdateParameters is the parameters supplied to the update +// connection operation. +type ConnectionUpdateParameters struct { + Name *string `json:"name,omitempty"` + *ConnectionUpdateProperties `json:"properties,omitempty"` +} + +// ConnectionUpdateProperties is the properties of the update connection +// operation. +type ConnectionUpdateProperties struct { + Description *string `json:"description,omitempty"` + FieldDefinitionValues *map[string]*string `json:"fieldDefinitionValues,omitempty"` +} + +// ContentHash is definition of the runbook property type. +type ContentHash struct { + Algorithm *string `json:"algorithm,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ContentLink is definition of the content link. +type ContentLink struct { + URI *string `json:"uri,omitempty"` + ContentHash *ContentHash `json:"contentHash,omitempty"` + Version *string `json:"version,omitempty"` +} + +// ContentSource is definition of the content source. +type ContentSource struct { + Hash *ContentHash `json:"hash,omitempty"` + Type ContentSourceType `json:"type,omitempty"` + Value *string `json:"value,omitempty"` + Version *string `json:"version,omitempty"` +} + +// Credential is definition of the credential. +type Credential struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *CredentialProperties `json:"properties,omitempty"` +} + +// CredentialCreateOrUpdateParameters is the parameters supplied to the create +// or update credential operation. +type CredentialCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *CredentialCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// CredentialCreateOrUpdateProperties is the properties of the create +// cerdential operation. +type CredentialCreateOrUpdateProperties struct { + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` + Description *string `json:"description,omitempty"` +} + +// CredentialListResult is the response model for the list credential +// operation. +type CredentialListResult struct { + autorest.Response `json:"-"` + Value *[]Credential `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CredentialListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CredentialListResult) CredentialListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CredentialProperties is definition of the credential properties +type CredentialProperties struct { + UserName *string `json:"userName,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// CredentialUpdateParameters is the parameters supplied to the Update +// credential operation. +type CredentialUpdateParameters struct { + Name *string `json:"name,omitempty"` + *CredentialUpdateProperties `json:"properties,omitempty"` +} + +// CredentialUpdateProperties is the properties of the Update credential +type CredentialUpdateProperties struct { + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` + Description *string `json:"description,omitempty"` +} + +// DscCompilationJob is definition of the Dsc Compilation job. +type DscCompilationJob struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *DscCompilationJobProperties `json:"properties,omitempty"` +} + +// DscCompilationJobCreateParameters is the parameters supplied to the create +// compilation job operation. +type DscCompilationJobCreateParameters struct { + *DscCompilationJobCreateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// DscCompilationJobCreateProperties is the parameters supplied to the create +// compilation job operation. +type DscCompilationJobCreateProperties struct { + Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` +} + +// DscCompilationJobListResult is the response model for the list job +// operation. +type DscCompilationJobListResult struct { + autorest.Response `json:"-"` + Value *[]DscCompilationJob `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DscCompilationJobListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DscCompilationJobListResult) DscCompilationJobListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DscCompilationJobProperties is definition of Dsc Compilation job properties. +type DscCompilationJobProperties struct { + Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` + StartedBy *string `json:"startedBy,omitempty"` + JobID *uuid.UUID `json:"jobId,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + Status JobStatus `json:"status,omitempty"` + StatusDetails *string `json:"statusDetails,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Exception *string `json:"exception,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` +} + +// DscConfiguration is definition of the configuration type. +type DscConfiguration struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DscConfigurationProperties `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// DscConfigurationAssociationProperty is the Dsc configuration property +// associated with the entity. +type DscConfigurationAssociationProperty struct { + Name *string `json:"name,omitempty"` +} + +// DscConfigurationCreateOrUpdateParameters is the parameters supplied to the +// create or update configuration operation. +type DscConfigurationCreateOrUpdateParameters struct { + *DscConfigurationCreateOrUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// DscConfigurationCreateOrUpdateProperties is the properties to create or +// update configuration. +type DscConfigurationCreateOrUpdateProperties struct { + LogVerbose *bool `json:"logVerbose,omitempty"` + LogProgress *bool `json:"logProgress,omitempty"` + Source *ContentSource `json:"source,omitempty"` + Parameters *map[string]*DscConfigurationParameter `json:"parameters,omitempty"` + Description *string `json:"description,omitempty"` +} + +// DscConfigurationListResult is the response model for the list configuration +// operation. +type DscConfigurationListResult struct { + autorest.Response `json:"-"` + Value *[]DscConfiguration `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DscConfigurationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DscConfigurationListResult) DscConfigurationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DscConfigurationParameter is definition of the configuration parameter type. +type DscConfigurationParameter struct { + Type *string `json:"type,omitempty"` + IsMandatory *bool `json:"isMandatory,omitempty"` + Position *int32 `json:"position,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` +} + +// DscConfigurationProperties is definition of the configuration property type. +type DscConfigurationProperties struct { + ProvisioningState DscConfigurationProvisioningState `json:"provisioningState,omitempty"` + JobCount *int32 `json:"jobCount,omitempty"` + Parameters *map[string]*DscConfigurationParameter `json:"parameters,omitempty"` + Source *ContentSource `json:"source,omitempty"` + State DscConfigurationState `json:"state,omitempty"` + LogVerbose *bool `json:"logVerbose,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// DscMetaConfiguration is definition of the DSC Meta Configuration. +type DscMetaConfiguration struct { + ConfigurationModeFrequencyMins *int32 `json:"configurationModeFrequencyMins,omitempty"` + RebootNodeIfNeeded *bool `json:"rebootNodeIfNeeded,omitempty"` + ConfigurationMode *string `json:"configurationMode,omitempty"` + ActionAfterReboot *string `json:"actionAfterReboot,omitempty"` + CertificateID *string `json:"certificateId,omitempty"` + RefreshFrequencyMins *int32 `json:"refreshFrequencyMins,omitempty"` + AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` +} + +// DscNode is definition of the dsc node type. +type DscNode struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + LastSeen *date.Time `json:"lastSeen,omitempty"` + RegistrationTime *date.Time `json:"registrationTime,omitempty"` + IP *string `json:"ip,omitempty"` + AccountID *string `json:"accountId,omitempty"` + NodeConfiguration *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` + Status *string `json:"status,omitempty"` + NodeID *string `json:"nodeId,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// DscNodeConfiguration is definition of the dsc node configuration. +type DscNodeConfiguration struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` + ID *string `json:"id,omitempty"` +} + +// DscNodeConfigurationAssociationProperty is the dsc nodeconfiguration +// property associated with the entity. +type DscNodeConfigurationAssociationProperty struct { + Name *string `json:"name,omitempty"` +} + +// DscNodeConfigurationCreateOrUpdateParameters is the parameters supplied to +// the create or update node configuration operation. +type DscNodeConfigurationCreateOrUpdateParameters struct { + Source *ContentSource `json:"source,omitempty"` + Name *string `json:"name,omitempty"` + Configuration *DscConfigurationAssociationProperty `json:"configuration,omitempty"` +} + +// DscNodeConfigurationListResult is the response model for the list job +// operation. +type DscNodeConfigurationListResult struct { + autorest.Response `json:"-"` + Value *[]DscNodeConfiguration `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DscNodeConfigurationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DscNodeConfigurationListResult) DscNodeConfigurationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DscNodeListResult is the response model for the list dsc nodes operation. +type DscNodeListResult struct { + autorest.Response `json:"-"` + Value *[]DscNode `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DscNodeListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DscNodeListResult) DscNodeListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DscNodeReport is definition of the dsc node report type. +type DscNodeReport struct { + autorest.Response `json:"-"` + EndTime *date.Time `json:"endTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + Type *string `json:"type,omitempty"` + ReportID *string `json:"reportId,omitempty"` + Status *string `json:"status,omitempty"` + RefreshMode *string `json:"refreshMode,omitempty"` + RebootRequested *string `json:"rebootRequested,omitempty"` + ReportFormatVersion *string `json:"reportFormatVersion,omitempty"` + ConfigurationVersion *string `json:"configurationVersion,omitempty"` + ID *string `json:"id,omitempty"` + Errors *[]DscReportError `json:"errors,omitempty"` + Resources *[]DscReportResource `json:"resources,omitempty"` + MetaConfiguration *DscMetaConfiguration `json:"metaConfiguration,omitempty"` + HostName *string `json:"hostName,omitempty"` + IPV4Addresses *[]string `json:"iPV4Addresses,omitempty"` + IPV6Addresses *[]string `json:"iPV6Addresses,omitempty"` + NumberOfResources *int32 `json:"numberOfResources,omitempty"` + RawErrors *string `json:"rawErrors,omitempty"` +} + +// DscNodeReportListResult is the response model for the list dsc nodes +// operation. +type DscNodeReportListResult struct { + autorest.Response `json:"-"` + Value *[]DscNodeReport `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DscNodeReportListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DscNodeReportListResult) DscNodeReportListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DscNodeUpdateParameters is the parameters supplied to the update dsc node +// operation. +type DscNodeUpdateParameters struct { + NodeID *string `json:"nodeId,omitempty"` + NodeConfiguration *DscNodeConfigurationAssociationProperty `json:"nodeConfiguration,omitempty"` +} + +// DscReportError is definition of the dsc node report error type. +type DscReportError struct { + ErrorSource *string `json:"errorSource,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Locale *string `json:"locale,omitempty"` + ErrorDetails *string `json:"errorDetails,omitempty"` +} + +// DscReportResource is definition of the DSC Report Resource. +type DscReportResource struct { + ResourceID *string `json:"resourceId,omitempty"` + SourceInfo *string `json:"sourceInfo,omitempty"` + DependsOn *[]DscReportResourceNavigation `json:"dependsOn,omitempty"` + ModuleName *string `json:"moduleName,omitempty"` + ModuleVersion *string `json:"moduleVersion,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + Error *string `json:"error,omitempty"` + Status *string `json:"status,omitempty"` + DurationInSeconds *float64 `json:"durationInSeconds,omitempty"` + StartDate *date.Time `json:"startDate,omitempty"` +} + +// DscReportResourceNavigation is navigation for DSC Report Resource. +type DscReportResourceNavigation struct { + ResourceID *string `json:"resourceId,omitempty"` +} + +// ErrorResponse is error response of an operation failure +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// FieldDefinition is definition of the connection fields. +type FieldDefinition struct { + IsEncrypted *bool `json:"isEncrypted,omitempty"` + IsOptional *bool `json:"isOptional,omitempty"` + Type *string `json:"type,omitempty"` +} + +// HybridRunbookWorker is definition of hybrid runbook worker. +type HybridRunbookWorker struct { + Name *string `json:"name,omitempty"` + IP *string `json:"ip,omitempty"` + RegistrationTime *date.Time `json:"registrationTime,omitempty"` +} + +// HybridRunbookWorkerGroup is definition of hybrid runbook worker group. +type HybridRunbookWorkerGroup struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + HybridRunbookWorkers *[]HybridRunbookWorker `json:"hybridRunbookWorkers,omitempty"` + Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` +} + +// HybridRunbookWorkerGroupsListResult is the response model for the list +// hybrid runbook worker groups. +type HybridRunbookWorkerGroupsListResult struct { + autorest.Response `json:"-"` + Value *[]HybridRunbookWorkerGroup `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// HybridRunbookWorkerGroupsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client HybridRunbookWorkerGroupsListResult) HybridRunbookWorkerGroupsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// HybridRunbookWorkerGroupUpdateParameters is parameters supplied to the +// update operation. +type HybridRunbookWorkerGroupUpdateParameters struct { + Credential *RunAsCredentialAssociationProperty `json:"credential,omitempty"` +} + +// Job is definition of the job. +type Job struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *JobProperties `json:"properties,omitempty"` +} + +// JobCreateParameters is the parameters supplied to the create job operation. +type JobCreateParameters struct { + *JobCreateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// JobCreateProperties is the parameters supplied to the create job operation. +type JobCreateProperties struct { + Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` + RunOn *string `json:"runOn,omitempty"` +} + +// JobListResult is the response model for the list job operation. +type JobListResult struct { + autorest.Response `json:"-"` + Value *[]Job `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobListResult) JobListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobProperties is definition of job properties. +type JobProperties struct { + Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` + StartedBy *string `json:"startedBy,omitempty"` + RunOn *string `json:"runOn,omitempty"` + JobID *uuid.UUID `json:"jobId,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + Status JobStatus `json:"status,omitempty"` + StatusDetails *string `json:"statusDetails,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Exception *string `json:"exception,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` +} + +// JobSchedule is definition of the job schedule. +type JobSchedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *JobScheduleProperties `json:"properties,omitempty"` +} + +// JobScheduleCreateParameters is the parameters supplied to the create job +// schedule operation. +type JobScheduleCreateParameters struct { + *JobScheduleCreateProperties `json:"properties,omitempty"` +} + +// JobScheduleCreateProperties is the parameters supplied to the create job +// schedule operation. +type JobScheduleCreateProperties struct { + Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` + Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` + RunOn *string `json:"runOn,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` +} + +// JobScheduleListResult is the response model for the list job schedule +// operation. +type JobScheduleListResult struct { + autorest.Response `json:"-"` + Value *[]JobSchedule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobScheduleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobScheduleListResult) JobScheduleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobScheduleProperties is definition of job schedule parameters. +type JobScheduleProperties struct { + JobScheduleID *string `json:"jobScheduleId,omitempty"` + Schedule *ScheduleAssociationProperty `json:"schedule,omitempty"` + Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` + RunOn *string `json:"runOn,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` +} + +// JobStream is definition of the job stream. +type JobStream struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *JobStreamProperties `json:"properties,omitempty"` +} + +// JobStreamListResult is the response model for the list job stream operation. +type JobStreamListResult struct { + autorest.Response `json:"-"` + Value *[]JobStream `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobStreamListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobStreamListResult) JobStreamListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobStreamProperties is definition of the job stream. +type JobStreamProperties struct { + JobStreamID *string `json:"jobStreamId,omitempty"` + Time *date.Time `json:"time,omitempty"` + StreamType JobStreamType `json:"streamType,omitempty"` + StreamText *string `json:"streamText,omitempty"` + Summary *string `json:"summary,omitempty"` + Value *map[string]*map[string]interface{} `json:"value,omitempty"` +} + +// Module is definition of the module type. +type Module struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ModuleProperties `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ModuleCreateOrUpdateParameters is the parameters supplied to the create or +// update module operation. +type ModuleCreateOrUpdateParameters struct { + *ModuleCreateOrUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ModuleCreateOrUpdateProperties is the parameters supplied to the create or +// update module properties. +type ModuleCreateOrUpdateProperties struct { + ContentLink *ContentLink `json:"contentLink,omitempty"` +} + +// ModuleErrorInfo is definition of the module error info type. +type ModuleErrorInfo struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ModuleListResult is the response model for the list module operation. +type ModuleListResult struct { + autorest.Response `json:"-"` + Value *[]Module `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ModuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ModuleListResult) ModuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ModuleProperties is definition of the module property type. +type ModuleProperties struct { + IsGlobal *bool `json:"isGlobal,omitempty"` + Version *string `json:"version,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + ActivityCount *int32 `json:"activityCount,omitempty"` + ProvisioningState ModuleProvisioningState `json:"provisioningState,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` + Error *ModuleErrorInfo `json:"error,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ModuleUpdateParameters is the parameters supplied to the update module +// operation. +type ModuleUpdateParameters struct { + *ModuleUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ModuleUpdateProperties is the parameters supplied to the update properties. +type ModuleUpdateProperties struct { + ContentLink *ContentLink `json:"contentLink,omitempty"` +} + +// Operation is automation REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is provider, Resource and Operation values +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is the response model for the list of Automation +// operations +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// ReadCloser is +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + +// Resource is the Resource definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RunAsCredentialAssociationProperty is definition of runas credential to use +// for hybrid worker. +type RunAsCredentialAssociationProperty struct { + Name *string `json:"name,omitempty"` +} + +// Runbook is definition of the runbook type. +type Runbook struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RunbookProperties `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// RunbookAssociationProperty is the runbook property associated with the +// entity. +type RunbookAssociationProperty struct { + Name *string `json:"name,omitempty"` +} + +// RunbookCreateOrUpdateParameters is the parameters supplied to the create or +// update runbook operation. +type RunbookCreateOrUpdateParameters struct { + *RunbookCreateOrUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RunbookCreateOrUpdateProperties is the parameters supplied to the create or +// update runbook properties. +type RunbookCreateOrUpdateProperties struct { + LogVerbose *bool `json:"logVerbose,omitempty"` + LogProgress *bool `json:"logProgress,omitempty"` + RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` + Draft *RunbookDraft `json:"draft,omitempty"` + PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` + Description *string `json:"description,omitempty"` + LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` +} + +// RunbookDraft is definition of the runbook type. +type RunbookDraft struct { + autorest.Response `json:"-"` + InEdit *bool `json:"inEdit,omitempty"` + DraftContentLink *ContentLink `json:"draftContentLink,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Parameters *map[string]*RunbookParameter `json:"parameters,omitempty"` + OutputTypes *[]string `json:"outputTypes,omitempty"` +} + +// RunbookDraftUndoEditResult is the response model for the undoedit runbook +// operation. +type RunbookDraftUndoEditResult struct { + autorest.Response `json:"-"` + StatusCode HTTPStatusCode `json:"statusCode,omitempty"` + RequestID *string `json:"requestId,omitempty"` +} + +// RunbookListResult is the response model for the list runbook operation. +type RunbookListResult struct { + autorest.Response `json:"-"` + Value *[]Runbook `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RunbookListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RunbookListResult) RunbookListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RunbookParameter is definition of the runbook parameter type. +type RunbookParameter struct { + Type *string `json:"type,omitempty"` + IsMandatory *bool `json:"isMandatory,omitempty"` + Position *int32 `json:"position,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` +} + +// RunbookProperties is definition of the runbook property type. +type RunbookProperties struct { + RunbookType RunbookTypeEnum `json:"runbookType,omitempty"` + PublishContentLink *ContentLink `json:"publishContentLink,omitempty"` + State RunbookState `json:"state,omitempty"` + LogVerbose *bool `json:"logVerbose,omitempty"` + LogProgress *bool `json:"logProgress,omitempty"` + LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` + JobCount *int32 `json:"jobCount,omitempty"` + Parameters *map[string]*RunbookParameter `json:"parameters,omitempty"` + OutputTypes *[]string `json:"outputTypes,omitempty"` + Draft *RunbookDraft `json:"draft,omitempty"` + ProvisioningState RunbookProvisioningState `json:"provisioningState,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// RunbookUpdateParameters is the parameters supplied to the update runbook +// operation. +type RunbookUpdateParameters struct { + *RunbookUpdateProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RunbookUpdateProperties is the parameters supplied to the update runbook +// properties. +type RunbookUpdateProperties struct { + Description *string `json:"description,omitempty"` + LogVerbose *bool `json:"logVerbose,omitempty"` + LogProgress *bool `json:"logProgress,omitempty"` + LogActivityTrace *int32 `json:"logActivityTrace,omitempty"` +} + +// Schedule is definition of the schedule. +type Schedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *ScheduleProperties `json:"properties,omitempty"` +} + +// ScheduleAssociationProperty is the schedule property associated with the +// entity. +type ScheduleAssociationProperty struct { + Name *string `json:"name,omitempty"` +} + +// ScheduleCreateOrUpdateParameters is the parameters supplied to the create or +// update schedule operation. +type ScheduleCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *ScheduleCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// ScheduleCreateOrUpdateProperties is the parameters supplied to the create or +// update schedule operation. +type ScheduleCreateOrUpdateProperties struct { + Description *string `json:"description,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + Interval *map[string]interface{} `json:"interval,omitempty"` + Frequency ScheduleFrequency `json:"frequency,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` +} + +// ScheduleListResult is the response model for the list schedule operation. +type ScheduleListResult struct { + autorest.Response `json:"-"` + Value *[]Schedule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ScheduleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ScheduleListResult) ScheduleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ScheduleProperties is definition of schedule parameters. +type ScheduleProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + StartTimeOffsetMinutes *float64 `json:"startTimeOffsetMinutes,omitempty"` + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + ExpiryTimeOffsetMinutes *float64 `json:"expiryTimeOffsetMinutes,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + NextRun *date.Time `json:"nextRun,omitempty"` + NextRunOffsetMinutes *float64 `json:"nextRunOffsetMinutes,omitempty"` + Interval *map[string]interface{} `json:"interval,omitempty"` + Frequency ScheduleFrequency `json:"frequency,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + AdvancedSchedule *AdvancedSchedule `json:"advancedSchedule,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ScheduleUpdateParameters is the parameters supplied to the update schedule +// operation. +type ScheduleUpdateParameters struct { + Name *string `json:"name,omitempty"` + *ScheduleUpdateProperties `json:"properties,omitempty"` +} + +// ScheduleUpdateProperties is the parameters supplied to the update schedule +// operation. +type ScheduleUpdateProperties struct { + Description *string `json:"description,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` +} + +// Sku is the account SKU. +type Sku struct { + Name SkuNameEnum `json:"name,omitempty"` + Family *string `json:"family,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// Statistics is definition of the statistic. +type Statistics struct { + CounterProperty *string `json:"counterProperty,omitempty"` + CounterValue *int64 `json:"counterValue,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ID *string `json:"id,omitempty"` +} + +// StatisticsListResult is the response model for the list statistics +// operation. +type StatisticsListResult struct { + autorest.Response `json:"-"` + Value *[]Statistics `json:"value,omitempty"` +} + +// String is +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// TestJob is definition of the test job. +type TestJob struct { + autorest.Response `json:"-"` + CreationTime *date.Time `json:"creationTime,omitempty"` + Status *string `json:"status,omitempty"` + StatusDetails *string `json:"statusDetails,omitempty"` + RunOn *string `json:"runOn,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Exception *string `json:"exception,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + LastStatusModifiedTime *date.Time `json:"lastStatusModifiedTime,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` +} + +// TestJobCreateParameters is the parameters supplied to the create test job +// operation. +type TestJobCreateParameters struct { + RunbookName *string `json:"runbookName,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` + RunOn *string `json:"runOn,omitempty"` +} + +// TypeField is information about a field of a type. +type TypeField struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// TypeFieldListResult is the response model for the list fields operation. +type TypeFieldListResult struct { + autorest.Response `json:"-"` + Value *[]TypeField `json:"value,omitempty"` +} + +// Usage is definition of Usage. +type Usage struct { + ID *string `json:"id,omitempty"` + Name *UsageCounterName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + CurrentValue *float64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + ThrottleStatus *string `json:"throttleStatus,omitempty"` +} + +// UsageCounterName is definition of usage counter name. +type UsageCounterName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UsageListResult is the response model for the get usage operation. +type UsageListResult struct { + autorest.Response `json:"-"` + Value *[]Usage `json:"value,omitempty"` +} + +// Variable is definition of the varible. +type Variable struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *VariableProperties `json:"properties,omitempty"` +} + +// VariableCreateOrUpdateParameters is the parameters supplied to the create or +// update variable operation. +type VariableCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *VariableCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// VariableCreateOrUpdateProperties is the properties of the create variable +// operation. +type VariableCreateOrUpdateProperties struct { + Value *string `json:"value,omitempty"` + Description *string `json:"description,omitempty"` + IsEncrypted *bool `json:"isEncrypted,omitempty"` +} + +// VariableListResult is the response model for the list variables operation. +type VariableListResult struct { + autorest.Response `json:"-"` + Value *[]Variable `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VariableListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VariableListResult) VariableListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VariableProperties is definition of the varible properties +type VariableProperties struct { + Value *string `json:"value,omitempty"` + IsEncrypted *bool `json:"isEncrypted,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// VariableUpdateParameters is the parameters supplied to the update variable +// operation. +type VariableUpdateParameters struct { + Name *string `json:"name,omitempty"` + *VariableUpdateProperties `json:"properties,omitempty"` +} + +// VariableUpdateProperties is the properties of the update variable +type VariableUpdateProperties struct { + Value *string `json:"value,omitempty"` + Description *string `json:"description,omitempty"` +} + +// Webhook is definition of the webhook type. +type Webhook struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *WebhookProperties `json:"properties,omitempty"` +} + +// WebhookCreateOrUpdateParameters is the parameters supplied to the create or +// update webhook operation. +type WebhookCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + *WebhookCreateOrUpdateProperties `json:"properties,omitempty"` +} + +// WebhookCreateOrUpdateProperties is the properties of the create webhook +// operation. +type WebhookCreateOrUpdateProperties struct { + IsEnabled *bool `json:"isEnabled,omitempty"` + URI *string `json:"uri,omitempty"` + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` + Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` + RunOn *string `json:"runOn,omitempty"` +} + +// WebhookListResult is the response model for the list webhook operation. +type WebhookListResult struct { + autorest.Response `json:"-"` + Value *[]Webhook `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WebhookListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WebhookListResult) WebhookListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WebhookProperties is definition of the webhook properties +type WebhookProperties struct { + IsEnabled *bool `json:"isEnabled,omitempty"` + URI *string `json:"uri,omitempty"` + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + LastInvokedTime *date.Time `json:"lastInvokedTime,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` + Runbook *RunbookAssociationProperty `json:"runbook,omitempty"` + RunOn *string `json:"runOn,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Description *string `json:"description,omitempty"` +} + +// WebhookUpdateParameters is the parameters supplied to the update webhook +// operation. +type WebhookUpdateParameters struct { + Name *string `json:"name,omitempty"` + *WebhookUpdateProperties `json:"properties,omitempty"` +} + +// WebhookUpdateProperties is the properties of the update webhook. +type WebhookUpdateProperties struct { + IsEnabled *bool `json:"isEnabled,omitempty"` + RunOn *string `json:"runOn,omitempty"` + Parameters *map[string]*string `json:"parameters,omitempty"` + Description *string `json:"description,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/module.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/module.go index 3ea9d048f9..225b0a4957 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/module.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/module.go @@ -1,443 +1,443 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ModuleClient is the composite Swagger json for Azure Automation Client -type ModuleClient struct { - ManagementClient -} - -// NewModuleClient creates an instance of the ModuleClient client. -func NewModuleClient(subscriptionID string) ModuleClient { - return NewModuleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewModuleClientWithBaseURI creates an instance of the ModuleClient client. -func NewModuleClientWithBaseURI(baseURI string, subscriptionID string) ModuleClient { - return ModuleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update the module identified by module name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the name of module. parameters is the -// create or update parameters for module. -func (client ModuleClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (result Module, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ModuleClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ModuleClient) CreateOrUpdateResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the module by name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the module name. -func (client ModuleClient) Delete(resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ModuleClient) DeletePreparer(resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ModuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the module identified by module name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the module name. -func (client ModuleClient) Get(resourceGroupName string, automationAccountName string, moduleName string) (result Module, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, moduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ModuleClient) GetPreparer(resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ModuleClient) GetResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of modules. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client ModuleClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ModuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ModuleClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ModuleClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ModuleClient) ListByAutomationAccountNextResults(lastResults ModuleListResult) (result ModuleListResult, err error) { - req, err := lastResults.ModuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update the module identified by module name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the name of module. parameters is the -// update parameters for module. -func (client ModuleClient) Update(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (result Module, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, moduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ModuleClient) UpdatePreparer(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ModuleClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ModuleClient) UpdateResponder(resp *http.Response) (result Module, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ModuleClient is the composite Swagger json for Azure Automation Client +type ModuleClient struct { + ManagementClient +} + +// NewModuleClient creates an instance of the ModuleClient client. +func NewModuleClient(subscriptionID string) ModuleClient { + return NewModuleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewModuleClientWithBaseURI creates an instance of the ModuleClient client. +func NewModuleClientWithBaseURI(baseURI string, subscriptionID string) ModuleClient { + return ModuleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or Update the module identified by module name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the name of module. parameters is the +// create or update parameters for module. +func (client ModuleClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (result Module, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, moduleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ModuleClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ModuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ModuleClient) CreateOrUpdateResponder(resp *http.Response) (result Module, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the module by name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the module name. +func (client ModuleClient) Delete(resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, moduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ModuleClient) DeletePreparer(resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ModuleClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ModuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the module identified by module name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the module name. +func (client ModuleClient) Get(resourceGroupName string, automationAccountName string, moduleName string) (result Module, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, moduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ModuleClient) GetPreparer(resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ModuleClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ModuleClient) GetResponder(resp *http.Response) (result Module, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of modules. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client ModuleClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ModuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client ModuleClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client ModuleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client ModuleClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client ModuleClient) ListByAutomationAccountNextResults(lastResults ModuleListResult) (result ModuleListResult, err error) { + req, err := lastResults.ModuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update the module identified by module name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the name of module. parameters is the +// update parameters for module. +func (client ModuleClient) Update(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (result Module, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ModuleClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, moduleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ModuleClient) UpdatePreparer(resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ModuleClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ModuleClient) UpdateResponder(resp *http.Response) (result Module, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/nodereports.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/nodereports.go index 436d1c4530..ad9f6acb3d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/nodereports.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/nodereports.go @@ -1,292 +1,292 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NodeReportsClient is the composite Swagger json for Azure Automation Client -type NodeReportsClient struct { - ManagementClient -} - -// NewNodeReportsClient creates an instance of the NodeReportsClient client. -func NewNodeReportsClient(subscriptionID string) NodeReportsClient { - return NewNodeReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeReportsClientWithBaseURI creates an instance of the NodeReportsClient -// client. -func NewNodeReportsClientWithBaseURI(baseURI string, subscriptionID string) NodeReportsClient { - return NodeReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the Dsc node report data by node id and report id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeID is the Dsc node id. reportID is the report -// id. -func (client NodeReportsClient) Get(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result DscNodeReport, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.NodeReportsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeReportsClient) GetPreparer(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) GetResponder(resp *http.Response) (result DscNodeReport, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the Dsc node reports by node id and report id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeID is the Dsc node id. reportID is the report -// id. -func (client NodeReportsClient) GetContent(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.NodeReportsClient", "GetContent") - } - - req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, nodeID, reportID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure responding to request") - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client NodeReportsClient) GetContentPreparer(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) GetContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNode retrieve the Dsc node report list by node id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. nodeID is the parameters supplied to the list -// operation. filter is the filter to apply on the operation. -func (client NodeReportsClient) ListByNode(resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.NodeReportsClient", "ListByNode") - } - - req, err := client.ListByNodePreparer(resourceGroupName, automationAccountName, nodeID, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNodeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending request") - return - } - - result, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to request") - } - - return -} - -// ListByNodePreparer prepares the ListByNode request. -func (client NodeReportsClient) ListByNodePreparer(resourceGroupName string, automationAccountName string, nodeID string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "nodeId": autorest.Encode("path", nodeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByNodeSender sends the ListByNode request. The method will close the -// http.Response Body if it receives an error. -func (client NodeReportsClient) ListByNodeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByNodeResponder handles the response to the ListByNode request. The method always -// closes the http.Response Body. -func (client NodeReportsClient) ListByNodeResponder(resp *http.Response) (result DscNodeReportListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNodeNextResults retrieves the next set of results, if any. -func (client NodeReportsClient) ListByNodeNextResults(lastResults DscNodeReportListResult) (result DscNodeReportListResult, err error) { - req, err := lastResults.DscNodeReportListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByNodeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending next results request") - } - - result, err = client.ListByNodeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NodeReportsClient is the composite Swagger json for Azure Automation Client +type NodeReportsClient struct { + ManagementClient +} + +// NewNodeReportsClient creates an instance of the NodeReportsClient client. +func NewNodeReportsClient(subscriptionID string) NodeReportsClient { + return NewNodeReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNodeReportsClientWithBaseURI creates an instance of the NodeReportsClient +// client. +func NewNodeReportsClientWithBaseURI(baseURI string, subscriptionID string) NodeReportsClient { + return NodeReportsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieve the Dsc node report data by node id and report id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeID is the Dsc node id. reportID is the report +// id. +func (client NodeReportsClient) Get(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result DscNodeReport, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.NodeReportsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, nodeID, reportID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NodeReportsClient) GetPreparer(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeId": autorest.Encode("path", nodeID), + "reportId": autorest.Encode("path", reportID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NodeReportsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NodeReportsClient) GetResponder(resp *http.Response) (result DscNodeReport, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContent retrieve the Dsc node reports by node id and report id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeID is the Dsc node id. reportID is the report +// id. +func (client NodeReportsClient) GetContent(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.NodeReportsClient", "GetContent") + } + + req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, nodeID, reportID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", nil, "Failure preparing request") + return + } + + resp, err := client.GetContentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure sending request") + return + } + + result, err = client.GetContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "GetContent", resp, "Failure responding to request") + } + + return +} + +// GetContentPreparer prepares the GetContent request. +func (client NodeReportsClient) GetContentPreparer(resourceGroupName string, automationAccountName string, nodeID string, reportID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeId": autorest.Encode("path", nodeID), + "reportId": autorest.Encode("path", reportID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetContentSender sends the GetContent request. The method will close the +// http.Response Body if it receives an error. +func (client NodeReportsClient) GetContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetContentResponder handles the response to the GetContent request. The method always +// closes the http.Response Body. +func (client NodeReportsClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByNode retrieve the Dsc node report list by node id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. nodeID is the parameters supplied to the list +// operation. filter is the filter to apply on the operation. +func (client NodeReportsClient) ListByNode(resourceGroupName string, automationAccountName string, nodeID string, filter string) (result DscNodeReportListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.NodeReportsClient", "ListByNode") + } + + req, err := client.ListByNodePreparer(resourceGroupName, automationAccountName, nodeID, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNodeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending request") + return + } + + result, err = client.ListByNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to request") + } + + return +} + +// ListByNodePreparer prepares the ListByNode request. +func (client NodeReportsClient) ListByNodePreparer(resourceGroupName string, automationAccountName string, nodeID string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "nodeId": autorest.Encode("path", nodeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByNodeSender sends the ListByNode request. The method will close the +// http.Response Body if it receives an error. +func (client NodeReportsClient) ListByNodeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByNodeResponder handles the response to the ListByNode request. The method always +// closes the http.Response Body. +func (client NodeReportsClient) ListByNodeResponder(resp *http.Response) (result DscNodeReportListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByNodeNextResults retrieves the next set of results, if any. +func (client NodeReportsClient) ListByNodeNextResults(lastResults DscNodeReportListResult) (result DscNodeReportListResult, err error) { + req, err := lastResults.DscNodeReportListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByNodeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure sending next results request") + } + + result, err = client.ListByNodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.NodeReportsClient", "ListByNode", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/objectdatatypes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/objectdatatypes.go index ee2c623dcc..0a0952fb2d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/objectdatatypes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/objectdatatypes.go @@ -1,194 +1,194 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ObjectDataTypesClient is the composite Swagger json for Azure Automation -// Client -type ObjectDataTypesClient struct { - ManagementClient -} - -// NewObjectDataTypesClient creates an instance of the ObjectDataTypesClient -// client. -func NewObjectDataTypesClient(subscriptionID string) ObjectDataTypesClient { - return NewObjectDataTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewObjectDataTypesClientWithBaseURI creates an instance of the -// ObjectDataTypesClient client. -func NewObjectDataTypesClientWithBaseURI(baseURI string, subscriptionID string) ObjectDataTypesClient { - return ObjectDataTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListFieldsByModuleAndType retrieve a list of fields of a given type -// identified by module name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. moduleName is the name of module. typeName is the -// name of type. -func (client ObjectDataTypesClient) ListFieldsByModuleAndType(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType") - } - - req, err := client.ListFieldsByModuleAndTypePreparer(resourceGroupName, automationAccountName, moduleName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByModuleAndTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByModuleAndTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure responding to request") - } - - return -} - -// ListFieldsByModuleAndTypePreparer prepares the ListFieldsByModuleAndType request. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypePreparer(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "moduleName": autorest.Encode("path", moduleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListFieldsByModuleAndTypeSender sends the ListFieldsByModuleAndType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListFieldsByModuleAndTypeResponder handles the response to the ListFieldsByModuleAndType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListFieldsByType retrieve a list of fields of a given type across all -// accessible modules. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. typeName is the name of type. -func (client ObjectDataTypesClient) ListFieldsByType(resourceGroupName string, automationAccountName string, typeName string) (result TypeFieldListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ObjectDataTypesClient", "ListFieldsByType") - } - - req, err := client.ListFieldsByTypePreparer(resourceGroupName, automationAccountName, typeName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListFieldsByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure sending request") - return - } - - result, err = client.ListFieldsByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure responding to request") - } - - return -} - -// ListFieldsByTypePreparer prepares the ListFieldsByType request. -func (client ObjectDataTypesClient) ListFieldsByTypePreparer(resourceGroupName string, automationAccountName string, typeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "typeName": autorest.Encode("path", typeName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListFieldsByTypeSender sends the ListFieldsByType request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectDataTypesClient) ListFieldsByTypeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListFieldsByTypeResponder handles the response to the ListFieldsByType request. The method always -// closes the http.Response Body. -func (client ObjectDataTypesClient) ListFieldsByTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ObjectDataTypesClient is the composite Swagger json for Azure Automation +// Client +type ObjectDataTypesClient struct { + ManagementClient +} + +// NewObjectDataTypesClient creates an instance of the ObjectDataTypesClient +// client. +func NewObjectDataTypesClient(subscriptionID string) ObjectDataTypesClient { + return NewObjectDataTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewObjectDataTypesClientWithBaseURI creates an instance of the +// ObjectDataTypesClient client. +func NewObjectDataTypesClientWithBaseURI(baseURI string, subscriptionID string) ObjectDataTypesClient { + return ObjectDataTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListFieldsByModuleAndType retrieve a list of fields of a given type +// identified by module name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. moduleName is the name of module. typeName is the +// name of type. +func (client ObjectDataTypesClient) ListFieldsByModuleAndType(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (result TypeFieldListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType") + } + + req, err := client.ListFieldsByModuleAndTypePreparer(resourceGroupName, automationAccountName, moduleName, typeName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", nil, "Failure preparing request") + return + } + + resp, err := client.ListFieldsByModuleAndTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure sending request") + return + } + + result, err = client.ListFieldsByModuleAndTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByModuleAndType", resp, "Failure responding to request") + } + + return +} + +// ListFieldsByModuleAndTypePreparer prepares the ListFieldsByModuleAndType request. +func (client ObjectDataTypesClient) ListFieldsByModuleAndTypePreparer(resourceGroupName string, automationAccountName string, moduleName string, typeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "moduleName": autorest.Encode("path", moduleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "typeName": autorest.Encode("path", typeName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListFieldsByModuleAndTypeSender sends the ListFieldsByModuleAndType request. The method will close the +// http.Response Body if it receives an error. +func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListFieldsByModuleAndTypeResponder handles the response to the ListFieldsByModuleAndType request. The method always +// closes the http.Response Body. +func (client ObjectDataTypesClient) ListFieldsByModuleAndTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFieldsByType retrieve a list of fields of a given type across all +// accessible modules. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. typeName is the name of type. +func (client ObjectDataTypesClient) ListFieldsByType(resourceGroupName string, automationAccountName string, typeName string) (result TypeFieldListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ObjectDataTypesClient", "ListFieldsByType") + } + + req, err := client.ListFieldsByTypePreparer(resourceGroupName, automationAccountName, typeName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", nil, "Failure preparing request") + return + } + + resp, err := client.ListFieldsByTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure sending request") + return + } + + result, err = client.ListFieldsByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ObjectDataTypesClient", "ListFieldsByType", resp, "Failure responding to request") + } + + return +} + +// ListFieldsByTypePreparer prepares the ListFieldsByType request. +func (client ObjectDataTypesClient) ListFieldsByTypePreparer(resourceGroupName string, automationAccountName string, typeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "typeName": autorest.Encode("path", typeName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListFieldsByTypeSender sends the ListFieldsByType request. The method will close the +// http.Response Body if it receives an error. +func (client ObjectDataTypesClient) ListFieldsByTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListFieldsByTypeResponder handles the response to the ListFieldsByType request. The method always +// closes the http.Response Body. +func (client ObjectDataTypesClient) ListFieldsByTypeResponder(resp *http.Response) (result TypeFieldListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/operations.go index 98b2c788f5..a70339b7a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/operations.go @@ -1,98 +1,98 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the composite Swagger json for Azure Automation Client -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Automation REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Automation/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the composite Swagger json for Azure Automation Client +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Automation REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Automation/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbook.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbook.go index 7e69fa2354..52a522bea7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbook.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbook.go @@ -1,523 +1,523 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RunbookClient is the composite Swagger json for Azure Automation Client -type RunbookClient struct { - ManagementClient -} - -// NewRunbookClient creates an instance of the RunbookClient client. -func NewRunbookClient(subscriptionID string) RunbookClient { - return NewRunbookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookClientWithBaseURI creates an instance of the RunbookClient client. -func NewRunbookClientWithBaseURI(baseURI string, subscriptionID string) RunbookClient { - return RunbookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the runbook identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. parameters is the -// create or update parameters for runbook. Provide either content link for a -// published runbook or draft, not both. -func (client RunbookClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RunbookClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete delete the runbook by name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client RunbookClient) Delete(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RunbookClient) DeletePreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RunbookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the runbook identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client RunbookClient) Get(resourceGroupName string, automationAccountName string, runbookName string) (result Runbook, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RunbookClient) GetResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client RunbookClient) GetContent(resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "GetContent") - } - - req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure responding to request") - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookClient) GetContentPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of runbooks. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client RunbookClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result RunbookListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client RunbookClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client RunbookClient) ListByAutomationAccountResponder(resp *http.Response) (result RunbookListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client RunbookClient) ListByAutomationAccountNextResults(lastResults RunbookListResult) (result RunbookListResult, err error) { - req, err := lastResults.RunbookListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update the runbook identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. parameters is the -// update parameters for runbook. -func (client RunbookClient) Update(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (result Runbook, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunbookClient) UpdatePreparer(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RunbookClient) UpdateResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RunbookClient is the composite Swagger json for Azure Automation Client +type RunbookClient struct { + ManagementClient +} + +// NewRunbookClient creates an instance of the RunbookClient client. +func NewRunbookClient(subscriptionID string) RunbookClient { + return NewRunbookClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRunbookClientWithBaseURI creates an instance of the RunbookClient client. +func NewRunbookClientWithBaseURI(baseURI string, subscriptionID string) RunbookClient { + return RunbookClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the runbook identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. parameters is the +// create or update parameters for runbook. Provide either content link for a +// published runbook or draft, not both. +func (client RunbookClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RunbookCreateOrUpdateProperties.Draft.DraftContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RunbookCreateOrUpdateProperties.PublishContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, runbookName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RunbookClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete delete the runbook by name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client RunbookClient) Delete(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RunbookClient) DeletePreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RunbookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the runbook identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client RunbookClient) Get(resourceGroupName string, automationAccountName string, runbookName string) (result Runbook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RunbookClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RunbookClient) GetResponder(resp *http.Response) (result Runbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContent retrieve the content of runbook identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client RunbookClient) GetContent(resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "GetContent") + } + + req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", nil, "Failure preparing request") + return + } + + resp, err := client.GetContentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure sending request") + return + } + + result, err = client.GetContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "GetContent", resp, "Failure responding to request") + } + + return +} + +// GetContentPreparer prepares the GetContent request. +func (client RunbookClient) GetContentPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetContentSender sends the GetContent request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetContentResponder handles the response to the GetContent request. The method always +// closes the http.Response Body. +func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of runbooks. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client RunbookClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result RunbookListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client RunbookClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client RunbookClient) ListByAutomationAccountResponder(resp *http.Response) (result RunbookListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client RunbookClient) ListByAutomationAccountNextResults(lastResults RunbookListResult) (result RunbookListResult, err error) { + req, err := lastResults.RunbookListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update the runbook identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. parameters is the +// update parameters for runbook. +func (client RunbookClient) Update(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (result Runbook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, runbookName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RunbookClient) UpdatePreparer(resourceGroupName string, automationAccountName string, runbookName string, parameters RunbookUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RunbookClient) UpdateResponder(resp *http.Response) (result Runbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbookdraft.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbookdraft.go index 9242e7739d..d3679ee437 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbookdraft.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/runbookdraft.go @@ -1,447 +1,447 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "io" - "net/http" -) - -// RunbookDraftClient is the composite Swagger json for Azure Automation Client -type RunbookDraftClient struct { - ManagementClient -} - -// NewRunbookDraftClient creates an instance of the RunbookDraftClient client. -func NewRunbookDraftClient(subscriptionID string) RunbookDraftClient { - return NewRunbookDraftClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRunbookDraftClientWithBaseURI creates an instance of the -// RunbookDraftClient client. -func NewRunbookDraftClientWithBaseURI(baseURI string, subscriptionID string) RunbookDraftClient { - return RunbookDraftClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates the runbook draft with runbookStream as its content. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. runbookContent is -// the runbook draft content. runbookContent will be closed upon successful -// return. Callers should ensure closure when receiving an error. -func (client RunbookDraftClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, runbookName, runbookContent, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RunbookDraftClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithFile(runbookContent), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the runbook draft identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client RunbookDraftClient) Get(resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraft, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RunbookDraftClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) GetResponder(resp *http.Response) (result RunbookDraft, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContent retrieve the content of runbook draft identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client RunbookDraftClient) GetContent(resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "GetContent") - } - - req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure sending request") - return - } - - result, err = client.GetContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure responding to request") - } - - return -} - -// GetContentPreparer prepares the GetContent request. -func (client RunbookDraftClient) GetContentPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetContentSender sends the GetContent request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetContentResponder handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// Publish publish runbook draft. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the parameters supplied to the -// publish runbook operation. -func (client RunbookDraftClient) Publish(resourceGroupName string, automationAccountName string, runbookName string, cancel <-chan struct{}) (<-chan Runbook, <-chan error) { - resultChan := make(chan Runbook, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "Publish") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Runbook - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PublishPreparer(resourceGroupName, automationAccountName, runbookName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", nil, "Failure preparing request") - return - } - - resp, err := client.PublishSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", resp, "Failure sending request") - return - } - - result, err = client.PublishResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PublishPreparer prepares the Publish request. -func (client RunbookDraftClient) PublishPreparer(resourceGroupName string, automationAccountName string, runbookName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PublishSender sends the Publish request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) PublishSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PublishResponder handles the response to the Publish request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result Runbook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UndoEdit retrieve the runbook identified by runbook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client RunbookDraftClient) UndoEdit(resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftUndoEditResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "UndoEdit") - } - - req, err := client.UndoEditPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", nil, "Failure preparing request") - return - } - - resp, err := client.UndoEditSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure sending request") - return - } - - result, err = client.UndoEditResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure responding to request") - } - - return -} - -// UndoEditPreparer prepares the UndoEdit request. -func (client RunbookDraftClient) UndoEditPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UndoEditSender sends the UndoEdit request. The method will close the -// http.Response Body if it receives an error. -func (client RunbookDraftClient) UndoEditSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UndoEditResponder handles the response to the UndoEdit request. The method always -// closes the http.Response Body. -func (client RunbookDraftClient) UndoEditResponder(resp *http.Response) (result RunbookDraftUndoEditResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "io" + "net/http" +) + +// RunbookDraftClient is the composite Swagger json for Azure Automation Client +type RunbookDraftClient struct { + ManagementClient +} + +// NewRunbookDraftClient creates an instance of the RunbookDraftClient client. +func NewRunbookDraftClient(subscriptionID string) RunbookDraftClient { + return NewRunbookDraftClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRunbookDraftClientWithBaseURI creates an instance of the +// RunbookDraftClient client. +func NewRunbookDraftClientWithBaseURI(baseURI string, subscriptionID string) RunbookDraftClient { + return RunbookDraftClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate updates the runbook draft with runbookStream as its content. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. runbookContent is +// the runbook draft content. runbookContent will be closed upon successful +// return. Callers should ensure closure when receiving an error. +func (client RunbookDraftClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, runbookName, runbookContent, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RunbookDraftClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, runbookName string, runbookContent io.ReadCloser, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), + autorest.WithFile(runbookContent), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookDraftClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RunbookDraftClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the runbook draft identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client RunbookDraftClient) Get(resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraft, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RunbookDraftClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookDraftClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RunbookDraftClient) GetResponder(resp *http.Response) (result RunbookDraft, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContent retrieve the content of runbook draft identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client RunbookDraftClient) GetContent(resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "GetContent") + } + + req, err := client.GetContentPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", nil, "Failure preparing request") + return + } + + resp, err := client.GetContentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure sending request") + return + } + + result, err = client.GetContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "GetContent", resp, "Failure responding to request") + } + + return +} + +// GetContentPreparer prepares the GetContent request. +func (client RunbookDraftClient) GetContentPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetContentSender sends the GetContent request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetContentResponder handles the response to the GetContent request. The method always +// closes the http.Response Body. +func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// Publish publish runbook draft. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the parameters supplied to the +// publish runbook operation. +func (client RunbookDraftClient) Publish(resourceGroupName string, automationAccountName string, runbookName string, cancel <-chan struct{}) (<-chan Runbook, <-chan error) { + resultChan := make(chan Runbook, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "Publish") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Runbook + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PublishPreparer(resourceGroupName, automationAccountName, runbookName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", nil, "Failure preparing request") + return + } + + resp, err := client.PublishSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", resp, "Failure sending request") + return + } + + result, err = client.PublishResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "Publish", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PublishPreparer prepares the Publish request. +func (client RunbookDraftClient) PublishPreparer(resourceGroupName string, automationAccountName string, runbookName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PublishSender sends the Publish request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookDraftClient) PublishSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PublishResponder handles the response to the Publish request. The method always +// closes the http.Response Body. +func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result Runbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UndoEdit retrieve the runbook identified by runbook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client RunbookDraftClient) UndoEdit(resourceGroupName string, automationAccountName string, runbookName string) (result RunbookDraftUndoEditResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.RunbookDraftClient", "UndoEdit") + } + + req, err := client.UndoEditPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", nil, "Failure preparing request") + return + } + + resp, err := client.UndoEditSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure sending request") + return + } + + result, err = client.UndoEditResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.RunbookDraftClient", "UndoEdit", resp, "Failure responding to request") + } + + return +} + +// UndoEditPreparer prepares the UndoEdit request. +func (client RunbookDraftClient) UndoEditPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UndoEditSender sends the UndoEdit request. The method will close the +// http.Response Body if it receives an error. +func (client RunbookDraftClient) UndoEditSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UndoEditResponder handles the response to the UndoEdit request. The method always +// closes the http.Response Body. +func (client RunbookDraftClient) UndoEditResponder(resp *http.Response) (result RunbookDraftUndoEditResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/schedule.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/schedule.go index 3cafa296b1..9a98147d69 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/schedule.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/schedule.go @@ -1,439 +1,439 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ScheduleClient is the composite Swagger json for Azure Automation Client -type ScheduleClient struct { - ManagementClient -} - -// NewScheduleClient creates an instance of the ScheduleClient client. -func NewScheduleClient(subscriptionID string) ScheduleClient { - return NewScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScheduleClientWithBaseURI creates an instance of the ScheduleClient -// client. -func NewScheduleClientWithBaseURI(baseURI string, subscriptionID string) ScheduleClient { - return ScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a schedule. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. scheduleName is the schedule name. parameters is -// the parameters supplied to the create or update schedule operation. -func (client ScheduleClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (result Schedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ScheduleCreateOrUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ScheduleCreateOrUpdateProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScheduleClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the schedule identified by schedule name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. scheduleName is the schedule name. -func (client ScheduleClient) Delete(resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScheduleClient) DeletePreparer(resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the schedule identified by schedule name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. scheduleName is the schedule name. -func (client ScheduleClient) Get(resourceGroupName string, automationAccountName string, scheduleName string) (result Schedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, scheduleName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScheduleClient) GetPreparer(resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ScheduleClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of schedules. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client ScheduleClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ScheduleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client ScheduleClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client ScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result ScheduleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client ScheduleClient) ListByAutomationAccountNextResults(lastResults ScheduleListResult) (result ScheduleListResult, err error) { - req, err := lastResults.ScheduleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update the schedule identified by schedule name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. scheduleName is the schedule name. parameters is -// the parameters supplied to the update schedule operation. -func (client ScheduleClient) Update(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (result Schedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, scheduleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScheduleClient) UpdatePreparer(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scheduleName": autorest.Encode("path", scheduleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ScheduleClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ScheduleClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ScheduleClient is the composite Swagger json for Azure Automation Client +type ScheduleClient struct { + ManagementClient +} + +// NewScheduleClient creates an instance of the ScheduleClient client. +func NewScheduleClient(subscriptionID string) ScheduleClient { + return NewScheduleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScheduleClientWithBaseURI creates an instance of the ScheduleClient +// client. +func NewScheduleClientWithBaseURI(baseURI string, subscriptionID string) ScheduleClient { + return ScheduleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a schedule. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. scheduleName is the schedule name. parameters is +// the parameters supplied to the create or update schedule operation. +func (client ScheduleClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ScheduleCreateOrUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ScheduleCreateOrUpdateProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, scheduleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ScheduleClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scheduleName": autorest.Encode("path", scheduleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the schedule identified by schedule name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. scheduleName is the schedule name. +func (client ScheduleClient) Delete(resourceGroupName string, automationAccountName string, scheduleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, scheduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ScheduleClient) DeletePreparer(resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scheduleName": autorest.Encode("path", scheduleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduleClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ScheduleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the schedule identified by schedule name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. scheduleName is the schedule name. +func (client ScheduleClient) Get(resourceGroupName string, automationAccountName string, scheduleName string) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, scheduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ScheduleClient) GetPreparer(resourceGroupName string, automationAccountName string, scheduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scheduleName": autorest.Encode("path", scheduleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduleClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ScheduleClient) GetResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of schedules. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client ScheduleClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result ScheduleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client ScheduleClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client ScheduleClient) ListByAutomationAccountResponder(resp *http.Response) (result ScheduleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client ScheduleClient) ListByAutomationAccountNextResults(lastResults ScheduleListResult) (result ScheduleListResult, err error) { + req, err := lastResults.ScheduleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update the schedule identified by schedule name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. scheduleName is the schedule name. parameters is +// the parameters supplied to the update schedule operation. +func (client ScheduleClient) Update(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.ScheduleClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, scheduleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.ScheduleClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ScheduleClient) UpdatePreparer(resourceGroupName string, automationAccountName string, scheduleName string, parameters ScheduleUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scheduleName": autorest.Encode("path", scheduleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduleClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ScheduleClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/statistics.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/statistics.go index 4756d049c1..74d027ebe3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/statistics.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/statistics.go @@ -1,117 +1,117 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// StatisticsClient is the composite Swagger json for Azure Automation Client -type StatisticsClient struct { - ManagementClient -} - -// NewStatisticsClient creates an instance of the StatisticsClient client. -func NewStatisticsClient(subscriptionID string) StatisticsClient { - return NewStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStatisticsClientWithBaseURI creates an instance of the StatisticsClient -// client. -func NewStatisticsClientWithBaseURI(baseURI string, subscriptionID string) StatisticsClient { - return StatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the statistics for the account. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. filter is the filter to apply on the operation. -func (client StatisticsClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result StatisticsListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.StatisticsClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client StatisticsClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client StatisticsClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client StatisticsClient) ListByAutomationAccountResponder(resp *http.Response) (result StatisticsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// StatisticsClient is the composite Swagger json for Azure Automation Client +type StatisticsClient struct { + ManagementClient +} + +// NewStatisticsClient creates an instance of the StatisticsClient client. +func NewStatisticsClient(subscriptionID string) StatisticsClient { + return NewStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStatisticsClientWithBaseURI creates an instance of the StatisticsClient +// client. +func NewStatisticsClientWithBaseURI(baseURI string, subscriptionID string) StatisticsClient { + return StatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByAutomationAccount retrieve the statistics for the account. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. filter is the filter to apply on the operation. +func (client StatisticsClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result StatisticsListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.StatisticsClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.StatisticsClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client StatisticsClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client StatisticsClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client StatisticsClient) ListByAutomationAccountResponder(resp *http.Response) (result StatisticsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobs.go index 71f3542137..55a39599a1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobs.go @@ -1,410 +1,410 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TestJobsClient is the composite Swagger json for Azure Automation Client -type TestJobsClient struct { - ManagementClient -} - -// NewTestJobsClient creates an instance of the TestJobsClient client. -func NewTestJobsClient(subscriptionID string) TestJobsClient { - return NewTestJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobsClientWithBaseURI creates an instance of the TestJobsClient -// client. -func NewTestJobsClientWithBaseURI(baseURI string, subscriptionID string) TestJobsClient { - return TestJobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a test job of the runbook. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the parameters supplied to the -// create test job operation. parameters is the parameters supplied to the -// create test job operation. -func (client TestJobsClient) Create(resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (result TestJob, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RunbookName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, automationAccountName, runbookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TestJobsClient) CreatePreparer(resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client TestJobsClient) CreateResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the test job for the specified runbook. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client TestJobsClient) Get(resourceGroupName string, automationAccountName string, runbookName string) (result TestJob, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobsClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TestJobsClient) GetResponder(resp *http.Response) (result TestJob, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Resume resume the test job. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client TestJobsClient) Resume(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Resume") - } - - req, err := client.ResumePreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Resume", resp, "Failure responding to request") - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client TestJobsClient) ResumePreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResumeSender sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobsClient) ResumeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client TestJobsClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop the test job. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client TestJobsClient) Stop(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Stop") - } - - req, err := client.StopPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Stop", resp, "Failure responding to request") - } - - return -} - -// StopPreparer prepares the Stop request. -func (client TestJobsClient) StopPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobsClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client TestJobsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Suspend suspend the test job. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. -func (client TestJobsClient) Suspend(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Suspend") - } - - req, err := client.SuspendPreparer(resourceGroupName, automationAccountName, runbookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Suspend", resp, "Failure responding to request") - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client TestJobsClient) SuspendPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SuspendSender sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobsClient) SuspendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client TestJobsClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TestJobsClient is the composite Swagger json for Azure Automation Client +type TestJobsClient struct { + ManagementClient +} + +// NewTestJobsClient creates an instance of the TestJobsClient client. +func NewTestJobsClient(subscriptionID string) TestJobsClient { + return NewTestJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTestJobsClientWithBaseURI creates an instance of the TestJobsClient +// client. +func NewTestJobsClientWithBaseURI(baseURI string, subscriptionID string) TestJobsClient { + return TestJobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a test job of the runbook. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the parameters supplied to the +// create test job operation. parameters is the parameters supplied to the +// create test job operation. +func (client TestJobsClient) Create(resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (result TestJob, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RunbookName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, automationAccountName, runbookName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client TestJobsClient) CreatePreparer(resourceGroupName string, automationAccountName string, runbookName string, parameters TestJobCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client TestJobsClient) CreateResponder(resp *http.Response) (result TestJob, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve the test job for the specified runbook. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client TestJobsClient) Get(resourceGroupName string, automationAccountName string, runbookName string) (result TestJob, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TestJobsClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TestJobsClient) GetResponder(resp *http.Response) (result TestJob, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Resume resume the test job. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client TestJobsClient) Resume(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Resume") + } + + req, err := client.ResumePreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Resume", nil, "Failure preparing request") + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Resume", resp, "Failure sending request") + return + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Resume", resp, "Failure responding to request") + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client TestJobsClient) ResumePreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobsClient) ResumeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client TestJobsClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop the test job. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client TestJobsClient) Stop(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Stop") + } + + req, err := client.StopPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Stop", resp, "Failure responding to request") + } + + return +} + +// StopPreparer prepares the Stop request. +func (client TestJobsClient) StopPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobsClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client TestJobsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Suspend suspend the test job. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. +func (client TestJobsClient) Suspend(resourceGroupName string, automationAccountName string, runbookName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobsClient", "Suspend") + } + + req, err := client.SuspendPreparer(resourceGroupName, automationAccountName, runbookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Suspend", nil, "Failure preparing request") + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Suspend", resp, "Failure sending request") + return + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobsClient", "Suspend", resp, "Failure responding to request") + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client TestJobsClient) SuspendPreparer(resourceGroupName string, automationAccountName string, runbookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobsClient) SuspendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client TestJobsClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobstreams.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobstreams.go index d7a20c687f..f5f608457c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobstreams.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/testjobstreams.go @@ -1,221 +1,221 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TestJobStreamsClient is the composite Swagger json for Azure Automation -// Client -type TestJobStreamsClient struct { - ManagementClient -} - -// NewTestJobStreamsClient creates an instance of the TestJobStreamsClient -// client. -func NewTestJobStreamsClient(subscriptionID string) TestJobStreamsClient { - return NewTestJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTestJobStreamsClientWithBaseURI creates an instance of the -// TestJobStreamsClient client. -func NewTestJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) TestJobStreamsClient { - return TestJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve a test job streams identified by runbook name and stream id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. jobStreamID is the -// job stream id. -func (client TestJobStreamsClient) Get(resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result JobStream, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobStreamsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName, jobStreamID) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TestJobStreamsClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "jobStreamId": autorest.Encode("path", jobStreamID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobStreamsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TestJobStreamsClient) GetResponder(resp *http.Response) (result JobStream, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTestJob retrieve a list of test job streams identified by runbook -// name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. runbookName is the runbook name. filter is the -// filter to apply on the operation. -func (client TestJobStreamsClient) ListByTestJob(resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.TestJobStreamsClient", "ListByTestJob") - } - - req, err := client.ListByTestJobPreparer(resourceGroupName, automationAccountName, runbookName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending request") - return - } - - result, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to request") - } - - return -} - -// ListByTestJobPreparer prepares the ListByTestJob request. -func (client TestJobStreamsClient) ListByTestJobPreparer(resourceGroupName string, automationAccountName string, runbookName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runbookName": autorest.Encode("path", runbookName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByTestJobSender sends the ListByTestJob request. The method will close the -// http.Response Body if it receives an error. -func (client TestJobStreamsClient) ListByTestJobSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByTestJobResponder handles the response to the ListByTestJob request. The method always -// closes the http.Response Body. -func (client TestJobStreamsClient) ListByTestJobResponder(resp *http.Response) (result JobStreamListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTestJobNextResults retrieves the next set of results, if any. -func (client TestJobStreamsClient) ListByTestJobNextResults(lastResults JobStreamListResult) (result JobStreamListResult, err error) { - req, err := lastResults.JobStreamListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByTestJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending next results request") - } - - result, err = client.ListByTestJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to next results request") - } - - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TestJobStreamsClient is the composite Swagger json for Azure Automation +// Client +type TestJobStreamsClient struct { + ManagementClient +} + +// NewTestJobStreamsClient creates an instance of the TestJobStreamsClient +// client. +func NewTestJobStreamsClient(subscriptionID string) TestJobStreamsClient { + return NewTestJobStreamsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTestJobStreamsClientWithBaseURI creates an instance of the +// TestJobStreamsClient client. +func NewTestJobStreamsClientWithBaseURI(baseURI string, subscriptionID string) TestJobStreamsClient { + return TestJobStreamsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieve a test job streams identified by runbook name and stream id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. jobStreamID is the +// job stream id. +func (client TestJobStreamsClient) Get(resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (result JobStream, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobStreamsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, runbookName, jobStreamID) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TestJobStreamsClient) GetPreparer(resourceGroupName string, automationAccountName string, runbookName string, jobStreamID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "jobStreamId": autorest.Encode("path", jobStreamID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobStreamsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TestJobStreamsClient) GetResponder(resp *http.Response) (result JobStream, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByTestJob retrieve a list of test job streams identified by runbook +// name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. runbookName is the runbook name. filter is the +// filter to apply on the operation. +func (client TestJobStreamsClient) ListByTestJob(resourceGroupName string, automationAccountName string, runbookName string, filter string) (result JobStreamListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.TestJobStreamsClient", "ListByTestJob") + } + + req, err := client.ListByTestJobPreparer(resourceGroupName, automationAccountName, runbookName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTestJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending request") + return + } + + result, err = client.ListByTestJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to request") + } + + return +} + +// ListByTestJobPreparer prepares the ListByTestJob request. +func (client TestJobStreamsClient) ListByTestJobPreparer(resourceGroupName string, automationAccountName string, runbookName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runbookName": autorest.Encode("path", runbookName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByTestJobSender sends the ListByTestJob request. The method will close the +// http.Response Body if it receives an error. +func (client TestJobStreamsClient) ListByTestJobSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByTestJobResponder handles the response to the ListByTestJob request. The method always +// closes the http.Response Body. +func (client TestJobStreamsClient) ListByTestJobResponder(resp *http.Response) (result JobStreamListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByTestJobNextResults retrieves the next set of results, if any. +func (client TestJobStreamsClient) ListByTestJobNextResults(lastResults JobStreamListResult) (result JobStreamListResult, err error) { + req, err := lastResults.JobStreamListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByTestJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure sending next results request") + } + + result, err = client.ListByTestJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.TestJobStreamsClient", "ListByTestJob", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/usages.go index a800ac01cf..63057bebad 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/usages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/usages.go @@ -1,113 +1,113 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UsagesClient is the composite Swagger json for Azure Automation Client -type UsagesClient struct { - ManagementClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client. -func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByAutomationAccount retrieve the usage for the account id. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client UsagesClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result UsageListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.UsagesClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client UsagesClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListByAutomationAccountResponder(resp *http.Response) (result UsageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UsagesClient is the composite Swagger json for Azure Automation Client +type UsagesClient struct { + ManagementClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client. +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByAutomationAccount retrieve the usage for the account id. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client UsagesClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result UsageListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.UsagesClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.UsagesClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client UsagesClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListByAutomationAccountResponder(resp *http.Response) (result UsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/variable.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/variable.go index 70f75cd266..22da1431d9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/variable.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/variable.go @@ -1,438 +1,438 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VariableClient is the composite Swagger json for Azure Automation Client -type VariableClient struct { - ManagementClient -} - -// NewVariableClient creates an instance of the VariableClient client. -func NewVariableClient(subscriptionID string) VariableClient { - return NewVariableClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVariableClientWithBaseURI creates an instance of the VariableClient -// client. -func NewVariableClientWithBaseURI(baseURI string, subscriptionID string) VariableClient { - return VariableClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a variable. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. variableName is the variable name. parameters is -// the parameters supplied to the create or update variable operation. -func (client VariableClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (result Variable, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VariableCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VariableClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VariableClient) CreateOrUpdateResponder(resp *http.Response) (result Variable, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the variable. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. variableName is the name of variable. -func (client VariableClient) Delete(resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VariableClient) DeletePreparer(resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VariableClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve the variable identified by variable name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. variableName is the name of variable. -func (client VariableClient) Get(resourceGroupName string, automationAccountName string, variableName string) (result Variable, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, variableName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VariableClient) GetPreparer(resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VariableClient) GetResponder(resp *http.Response) (result Variable, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of variables. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client VariableClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result VariableListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client VariableClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client VariableClient) ListByAutomationAccountResponder(resp *http.Response) (result VariableListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client VariableClient) ListByAutomationAccountNextResults(lastResults VariableListResult) (result VariableListResult, err error) { - req, err := lastResults.VariableListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update a variable. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. variableName is the variable name. parameters is -// the parameters supplied to the update variable operation. -func (client VariableClient) Update(resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (result Variable, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, variableName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VariableClient) UpdatePreparer(resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "variableName": autorest.Encode("path", variableName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VariableClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VariableClient) UpdateResponder(resp *http.Response) (result Variable, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VariableClient is the composite Swagger json for Azure Automation Client +type VariableClient struct { + ManagementClient +} + +// NewVariableClient creates an instance of the VariableClient client. +func NewVariableClient(subscriptionID string) VariableClient { + return NewVariableClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVariableClientWithBaseURI creates an instance of the VariableClient +// client. +func NewVariableClientWithBaseURI(baseURI string, subscriptionID string) VariableClient { + return VariableClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a variable. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. variableName is the variable name. parameters is +// the parameters supplied to the create or update variable operation. +func (client VariableClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (result Variable, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VariableCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, variableName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VariableClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, variableName string, parameters VariableCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "variableName": autorest.Encode("path", variableName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VariableClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VariableClient) CreateOrUpdateResponder(resp *http.Response) (result Variable, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the variable. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. variableName is the name of variable. +func (client VariableClient) Delete(resourceGroupName string, automationAccountName string, variableName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, variableName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VariableClient) DeletePreparer(resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "variableName": autorest.Encode("path", variableName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VariableClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VariableClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the variable identified by variable name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. variableName is the name of variable. +func (client VariableClient) Get(resourceGroupName string, automationAccountName string, variableName string) (result Variable, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, variableName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VariableClient) GetPreparer(resourceGroupName string, automationAccountName string, variableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "variableName": autorest.Encode("path", variableName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VariableClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VariableClient) GetResponder(resp *http.Response) (result Variable, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of variables. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client VariableClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string) (result VariableListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client VariableClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client VariableClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client VariableClient) ListByAutomationAccountResponder(resp *http.Response) (result VariableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client VariableClient) ListByAutomationAccountNextResults(lastResults VariableListResult) (result VariableListResult, err error) { + req, err := lastResults.VariableListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update a variable. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. variableName is the variable name. parameters is +// the parameters supplied to the update variable operation. +func (client VariableClient) Update(resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (result Variable, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.VariableClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, variableName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.VariableClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VariableClient) UpdatePreparer(resourceGroupName string, automationAccountName string, variableName string, parameters VariableUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "variableName": autorest.Encode("path", variableName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VariableClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VariableClient) UpdateResponder(resp *http.Response) (result Variable, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/version.go index 23c61a5909..5a144eb099 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/version.go @@ -1,29 +1,29 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-automation/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-automation/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/webhook.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/webhook.go index b86e042d2f..8b172c0727 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/webhook.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/automation/webhook.go @@ -1,512 +1,512 @@ -package automation - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WebhookClient is the composite Swagger json for Azure Automation Client -type WebhookClient struct { - ManagementClient -} - -// NewWebhookClient creates an instance of the WebhookClient client. -func NewWebhookClient(subscriptionID string) WebhookClient { - return NewWebhookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhookClientWithBaseURI creates an instance of the WebhookClient client. -func NewWebhookClientWithBaseURI(baseURI string, subscriptionID string) WebhookClient { - return WebhookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create the webhook identified by webhook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. webhookName is the webhook name. parameters is the -// create or update parameters for webhook. -func (client WebhookClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (result Webhook, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WebhookCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WebhookClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WebhookClient) CreateOrUpdateResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the webhook by name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. webhookName is the webhook name. -func (client WebhookClient) Delete(resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhookClient) DeletePreparer(resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WebhookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateURI generates a Uri for use in creating a webhook. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. -func (client WebhookClient) GenerateURI(resourceGroupName string, automationAccountName string) (result String, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "GenerateURI") - } - - req, err := client.GenerateURIPreparer(resourceGroupName, automationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure responding to request") - } - - return -} - -// GenerateURIPreparer prepares the GenerateURI request. -func (client WebhookClient) GenerateURIPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateURISender sends the GenerateURI request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) GenerateURISender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateURIResponder handles the response to the GenerateURI request. The method always -// closes the http.Response Body. -func (client WebhookClient) GenerateURIResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve the webhook identified by webhook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. webhookName is the webhook name. -func (client WebhookClient) Get(resourceGroupName string, automationAccountName string, webhookName string) (result Webhook, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, automationAccountName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhookClient) GetPreparer(resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WebhookClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccount retrieve a list of webhooks. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. filter is the filter to apply on the operation. -func (client WebhookClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result WebhookListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "ListByAutomationAccount") - } - - req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. -func (client WebhookClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (client WebhookClient) ListByAutomationAccountResponder(resp *http.Response) (result WebhookListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAutomationAccountNextResults retrieves the next set of results, if any. -func (client WebhookClient) ListByAutomationAccountNextResults(lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.WebhookListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAutomationAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAutomationAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update update the webhook identified by webhook name. -// -// resourceGroupName is the resource group name. automationAccountName is the -// automation account name. webhookName is the webhook name. parameters is the -// update parameters for webhook. -func (client WebhookClient) Update(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (result Webhook, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, webhookName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhookClient) UpdatePreparer(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "automationAccountName": autorest.Encode("path", automationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2015-10-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WebhookClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WebhookClient) UpdateResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package automation + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WebhookClient is the composite Swagger json for Azure Automation Client +type WebhookClient struct { + ManagementClient +} + +// NewWebhookClient creates an instance of the WebhookClient client. +func NewWebhookClient(subscriptionID string) WebhookClient { + return NewWebhookClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebhookClientWithBaseURI creates an instance of the WebhookClient client. +func NewWebhookClientWithBaseURI(baseURI string, subscriptionID string) WebhookClient { + return WebhookClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the webhook identified by webhook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. webhookName is the webhook name. parameters is the +// create or update parameters for webhook. +func (client WebhookClient) CreateOrUpdate(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (result Webhook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WebhookCreateOrUpdateProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, automationAccountName, webhookName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WebhookClient) CreateOrUpdatePreparer(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WebhookClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WebhookClient) CreateOrUpdateResponder(resp *http.Response) (result Webhook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the webhook by name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. webhookName is the webhook name. +func (client WebhookClient) Delete(resourceGroupName string, automationAccountName string, webhookName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, automationAccountName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WebhookClient) DeletePreparer(resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WebhookClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WebhookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateURI generates a Uri for use in creating a webhook. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. +func (client WebhookClient) GenerateURI(resourceGroupName string, automationAccountName string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "GenerateURI") + } + + req, err := client.GenerateURIPreparer(resourceGroupName, automationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateURISender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure sending request") + return + } + + result, err = client.GenerateURIResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "GenerateURI", resp, "Failure responding to request") + } + + return +} + +// GenerateURIPreparer prepares the GenerateURI request. +func (client WebhookClient) GenerateURIPreparer(resourceGroupName string, automationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateURISender sends the GenerateURI request. The method will close the +// http.Response Body if it receives an error. +func (client WebhookClient) GenerateURISender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateURIResponder handles the response to the GenerateURI request. The method always +// closes the http.Response Body. +func (client WebhookClient) GenerateURIResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve the webhook identified by webhook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. webhookName is the webhook name. +func (client WebhookClient) Get(resourceGroupName string, automationAccountName string, webhookName string) (result Webhook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, automationAccountName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebhookClient) GetPreparer(resourceGroupName string, automationAccountName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WebhookClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WebhookClient) GetResponder(resp *http.Response) (result Webhook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of webhooks. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. filter is the filter to apply on the operation. +func (client WebhookClient) ListByAutomationAccount(resourceGroupName string, automationAccountName string, filter string) (result WebhookListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "ListByAutomationAccount") + } + + req, err := client.ListByAutomationAccountPreparer(resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client WebhookClient) ListByAutomationAccountPreparer(resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client WebhookClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client WebhookClient) ListByAutomationAccountResponder(resp *http.Response) (result WebhookListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccountNextResults retrieves the next set of results, if any. +func (client WebhookClient) ListByAutomationAccountNextResults(lastResults WebhookListResult) (result WebhookListResult, err error) { + req, err := lastResults.WebhookListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "ListByAutomationAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update update the webhook identified by webhook name. +// +// resourceGroupName is the resource group name. automationAccountName is the +// automation account name. webhookName is the webhook name. parameters is the +// update parameters for webhook. +func (client WebhookClient) Update(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (result Webhook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "automation.WebhookClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, automationAccountName, webhookName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WebhookClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WebhookClient) UpdatePreparer(resourceGroupName string, automationAccountName string, webhookName string, parameters WebhookUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WebhookClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WebhookClient) UpdateResponder(resp *http.Response) (result Webhook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/account.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/account.go index 89dcbd85c8..9b8ad8a485 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/account.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/account.go @@ -1,821 +1,821 @@ -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AccountClient is the client for the Account methods of the Batch service. -type AccountClient struct { - ManagementClient -} - -// NewAccountClient creates an instance of the AccountClient client. -func NewAccountClient(subscriptionID string) AccountClient { - return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountClientWithBaseURI creates an instance of the AccountClient client. -func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { - return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new Batch account with the specified parameters. Existing -// accounts cannot be updated with this API and should instead be updated with -// the Update Batch Account API. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the new -// Batch account. accountName is a name for the Batch account which must be -// unique within the region. Batch account names must be between 3 and 24 -// characters in length and must use only numbers and lowercase letters. This -// name is used as part of the DNS name that is used to access the Batch -// service in the region in which the account is created. For example: -// http://accountname.region.batch.azure.com/. parameters is additional -// parameters for account creation. -func (client AccountClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (<-chan Account, <-chan error) { - resultChan := make(chan Account, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountBaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.AutoStorage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.AccountBaseProperties.KeyVaultReference", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountBaseProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "batch.AccountClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Account - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client AccountClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Batch account. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account to be deleted. accountName is the name of the account to be deleted. -func (client AccountClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "batch.AccountClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client AccountClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified Batch account. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the account. -func (client AccountClient) Get(resourceGroupName string, accountName string) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeys this operation applies only to Batch accounts created with a -// poolAllocationMode of 'BatchService'. If the Batch account was created with -// a poolAllocationMode of 'UserSubscription', clients cannot use access to -// keys to authenticate, and must use Azure Active Directory instead. In this -// case, getting the keys will fail. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the account. -func (client AccountClient) GetKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "GetKeys") - } - - req, err := client.GetKeysPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") - return - } - - result, err = client.GetKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") - } - - return -} - -// GetKeysPreparer prepares the GetKeys request. -func (client AccountClient) GetKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetKeysSender sends the GetKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetKeysResponder handles the response to the GetKeys request. The method always -// closes the http.Response Body. -func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets information about the Batch accounts associated with the -// subscription. -func (client AccountClient) List() (result AccountListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AccountClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.AccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets information about the Batch accounts associated -// within the specified resource group. -// -// resourceGroupName is the name of the resource group whose Batch accounts to -// list. -func (client AccountClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.AccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// RegenerateKey regenerates the specified account key for the Batch account. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the account. parameters is the type of -// key to regenerate. -func (client AccountClient) RegenerateKey(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "RegenerateKey") - } - - req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SynchronizeAutoStorageKeys synchronizes access keys for the auto storage -// account configured for the specified Batch account. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. -func (client AccountClient) SynchronizeAutoStorageKeys(resourceGroupName string, accountName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys") - } - - req, err := client.SynchronizeAutoStorageKeysPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") - return - } - - resp, err := client.SynchronizeAutoStorageKeysSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") - return - } - - result, err = client.SynchronizeAutoStorageKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") - } - - return -} - -// SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. -func (client AccountClient) SynchronizeAutoStorageKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always -// closes the http.Response Body. -func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates the properties of an existing Batch account. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the account. parameters is additional -// parameters for account update. -func (client AccountClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AccountClient is the client for the Account methods of the Batch service. +type AccountClient struct { + ManagementClient +} + +// NewAccountClient creates an instance of the AccountClient client. +func NewAccountClient(subscriptionID string) AccountClient { + return NewAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountClientWithBaseURI creates an instance of the AccountClient client. +func NewAccountClientWithBaseURI(baseURI string, subscriptionID string) AccountClient { + return AccountClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new Batch account with the specified parameters. Existing +// accounts cannot be updated with this API and should instead be updated with +// the Update Batch Account API. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the new +// Batch account. accountName is a name for the Batch account which must be +// unique within the region. Batch account names must be between 3 and 24 +// characters in length and must use only numbers and lowercase letters. This +// name is used as part of the DNS name that is used to access the Batch +// service in the region in which the account is created. For example: +// http://accountname.region.batch.azure.com/. parameters is additional +// parameters for account creation. +func (client AccountClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (<-chan Account, <-chan error) { + resultChan := make(chan Account, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountBaseProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.AutoStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.AutoStorage.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountBaseProperties.KeyVaultReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountBaseProperties.KeyVaultReference.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountBaseProperties.KeyVaultReference.URL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "batch.AccountClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Account + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client AccountClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountClient) CreateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Batch account. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account to be deleted. accountName is the name of the account to be deleted. +func (client AccountClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "batch.AccountClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client AccountClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Batch account. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the account. +func (client AccountClient) Get(resourceGroupName string, accountName string) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AccountClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeys this operation applies only to Batch accounts created with a +// poolAllocationMode of 'BatchService'. If the Batch account was created with +// a poolAllocationMode of 'UserSubscription', clients cannot use access to +// keys to authenticate, and must use Azure Active Directory instead. In this +// case, getting the keys will fail. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the account. +func (client AccountClient) GetKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "GetKeys") + } + + req, err := client.GetKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure sending request") + return + } + + result, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "GetKeys", resp, "Failure responding to request") + } + + return +} + +// GetKeysPreparer prepares the GetKeys request. +func (client AccountClient) GetKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetKeysSender sends the GetKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) GetKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetKeysResponder handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (client AccountClient) GetKeysResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets information about the Batch accounts associated with the +// subscription. +func (client AccountClient) List() (result AccountListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AccountClient) ListNextResults(lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.AccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets information about the Batch accounts associated +// within the specified resource group. +// +// resourceGroupName is the name of the resource group whose Batch accounts to +// list. +func (client AccountClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AccountClient) ListByResourceGroupNextResults(lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.AccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// RegenerateKey regenerates the specified account key for the Batch account. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the account. parameters is the type of +// key to regenerate. +func (client AccountClient) RegenerateKey(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (result AccountKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "RegenerateKey") + } + + req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, parameters AccountRegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SynchronizeAutoStorageKeys synchronizes access keys for the auto storage +// account configured for the specified Batch account. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. +func (client AccountClient) SynchronizeAutoStorageKeys(resourceGroupName string, accountName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys") + } + + req, err := client.SynchronizeAutoStorageKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", nil, "Failure preparing request") + return + } + + resp, err := client.SynchronizeAutoStorageKeysSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure sending request") + return + } + + result, err = client.SynchronizeAutoStorageKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "SynchronizeAutoStorageKeys", resp, "Failure responding to request") + } + + return +} + +// SynchronizeAutoStorageKeysPreparer prepares the SynchronizeAutoStorageKeys request. +func (client AccountClient) SynchronizeAutoStorageKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SynchronizeAutoStorageKeysSender sends the SynchronizeAutoStorageKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) SynchronizeAutoStorageKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SynchronizeAutoStorageKeysResponder handles the response to the SynchronizeAutoStorageKeys request. The method always +// closes the http.Response Body. +func (client AccountClient) SynchronizeAutoStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates the properties of an existing Batch account. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the account. parameters is additional +// parameters for account update. +func (client AccountClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.AccountClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.AccountClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/application.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/application.go index ff63c9691e..1701b29120 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/application.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/application.go @@ -1,464 +1,464 @@ -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ApplicationClient is the client for the Application methods of the Batch -// service. -type ApplicationClient struct { - ManagementClient -} - -// NewApplicationClient creates an instance of the ApplicationClient client. -func NewApplicationClient(subscriptionID string) ApplicationClient { - return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient -// client. -func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { - return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create adds an application to the specified Batch account. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. parameters is the parameters for the request. -func (client ApplicationClient) Create(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (result Application, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, accountName, applicationID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an application. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. -func (client ApplicationClient) Delete(resourceGroupName string, accountName string, applicationID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, accountName, applicationID) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified application. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. -func (client ApplicationClient) Get(resourceGroupName string, accountName string, applicationID string) (result Application, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, accountName, applicationID) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationClient) GetPreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the applications in the specified account. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. maxresults is the -// maximum number of items to return in the response. -func (client ApplicationClient) List(resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, accountName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationClient) ListPreparer(resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ApplicationClient) ListNextResults(lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { - req, err := lastResults.ListApplicationsResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Update updates settings for the specified application. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. parameters is the parameters for the request. -func (client ApplicationClient) Update(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, accountName, applicationID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationClient) UpdatePreparer(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ApplicationClient is the client for the Application methods of the Batch +// service. +type ApplicationClient struct { + ManagementClient +} + +// NewApplicationClient creates an instance of the ApplicationClient client. +func NewApplicationClient(subscriptionID string) ApplicationClient { + return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient +// client. +func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient { + return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create adds an application to the specified Batch account. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. parameters is the parameters for the request. +func (client ApplicationClient) Create(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (result Application, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, accountName, applicationID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, parameters *AddApplicationParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationClient) CreateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. +func (client ApplicationClient) Delete(resourceGroupName string, accountName string, applicationID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, accountName, applicationID) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. +func (client ApplicationClient) Get(resourceGroupName string, accountName string, applicationID string) (result Application, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, accountName, applicationID) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationClient) GetPreparer(resourceGroupName string, accountName string, applicationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationClient) GetResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the applications in the specified account. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. maxresults is the +// maximum number of items to return in the response. +func (client ApplicationClient) List(resourceGroupName string, accountName string, maxresults *int32) (result ListApplicationsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, accountName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationClient) ListPreparer(resourceGroupName string, accountName string, maxresults *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationClient) ListResponder(resp *http.Response) (result ListApplicationsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ApplicationClient) ListNextResults(lastResults ListApplicationsResult) (result ListApplicationsResult, err error) { + req, err := lastResults.ListApplicationsResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Update updates settings for the specified application. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. parameters is the parameters for the request. +func (client ApplicationClient) Update(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, accountName, applicationID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ApplicationClient) UpdatePreparer(resourceGroupName string, accountName string, applicationID string, parameters UpdateApplicationParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ApplicationClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/applicationpackage.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/applicationpackage.go index 7e0595c79c..0fe441880a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/applicationpackage.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/applicationpackage.go @@ -1,363 +1,363 @@ -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ApplicationPackageClient is the client for the ApplicationPackage methods of -// the Batch service. -type ApplicationPackageClient struct { - ManagementClient -} - -// NewApplicationPackageClient creates an instance of the -// ApplicationPackageClient client. -func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { - return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationPackageClientWithBaseURI creates an instance of the -// ApplicationPackageClient client. -func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { - return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Activate activates the specified application package. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. version is the version of the application to -// activate. parameters is the parameters for the request. -func (client ApplicationPackageClient) Activate(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Activate") - } - - req, err := client.ActivatePreparer(resourceGroupName, accountName, applicationID, version, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") - return - } - - resp, err := client.ActivateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") - return - } - - result, err = client.ActivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") - } - - return -} - -// ActivatePreparer prepares the Activate request. -func (client ApplicationPackageClient) ActivatePreparer(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}/activate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ActivateSender sends the Activate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ActivateResponder handles the response to the Activate request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create creates an application package record. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. version is the version of the application. -func (client ApplicationPackageClient) Create(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, accountName, applicationID, version) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationPackageClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an application package record and its associated binary file. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. version is the version of the application to delete. -func (client ApplicationPackageClient) Delete(resourceGroupName string, accountName string, applicationID string, version string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, accountName, applicationID, version) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationPackageClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified application package. -// -// resourceGroupName is the name of the resource group that contains the Batch -// account. accountName is the name of the Batch account. applicationID is the -// ID of the application. version is the version of the application. -func (client ApplicationPackageClient) Get(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, accountName, applicationID, version) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationPackageClient) GetPreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "applicationId": autorest.Encode("path", applicationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ApplicationPackageClient is the client for the ApplicationPackage methods of +// the Batch service. +type ApplicationPackageClient struct { + ManagementClient +} + +// NewApplicationPackageClient creates an instance of the +// ApplicationPackageClient client. +func NewApplicationPackageClient(subscriptionID string) ApplicationPackageClient { + return NewApplicationPackageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationPackageClientWithBaseURI creates an instance of the +// ApplicationPackageClient client. +func NewApplicationPackageClientWithBaseURI(baseURI string, subscriptionID string) ApplicationPackageClient { + return ApplicationPackageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Activate activates the specified application package. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application to +// activate. parameters is the parameters for the request. +func (client ApplicationPackageClient) Activate(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Format", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Activate") + } + + req, err := client.ActivatePreparer(resourceGroupName, accountName, applicationID, version, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", nil, "Failure preparing request") + return + } + + resp, err := client.ActivateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure sending request") + return + } + + result, err = client.ActivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Activate", resp, "Failure responding to request") + } + + return +} + +// ActivatePreparer prepares the Activate request. +func (client ApplicationPackageClient) ActivatePreparer(resourceGroupName string, accountName string, applicationID string, version string, parameters ActivateApplicationPackageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}/activate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ActivateSender sends the Activate request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) ActivateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ActivateResponder handles the response to the Activate request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) ActivateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create creates an application package record. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application. +func (client ApplicationPackageClient) Create(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, accountName, applicationID, version) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationPackageClient) CreatePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) CreateResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an application package record and its associated binary file. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application to delete. +func (client ApplicationPackageClient) Delete(resourceGroupName string, accountName string, applicationID string, version string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, accountName, applicationID, version) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationPackageClient) DeletePreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application package. +// +// resourceGroupName is the name of the resource group that contains the Batch +// account. accountName is the name of the Batch account. applicationID is the +// ID of the application. version is the version of the application. +func (client ApplicationPackageClient) Get(resourceGroupName string, accountName string, applicationID string, version string) (result ApplicationPackage, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "batch.ApplicationPackageClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, accountName, applicationID, version) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.ApplicationPackageClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationPackageClient) GetPreparer(resourceGroupName string, accountName string, applicationID string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "applicationId": autorest.Encode("path", applicationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationPackageClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationPackageClient) GetResponder(resp *http.Response) (result ApplicationPackage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/client.go index 86dcb2d902..e5e5c9d8e0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/client.go @@ -1,52 +1,52 @@ -// Package batch implements the Azure ARM Batch service API version 2017-01-01. -// -// -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Batch - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Batch. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package batch implements the Azure ARM Batch service API version 2017-01-01. +// +// +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Batch + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Batch. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/location.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/location.go index acc18fcefa..7ee2e0c721 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/location.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/location.go @@ -1,106 +1,106 @@ -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// LocationClient is the client for the Location methods of the Batch service. -type LocationClient struct { - ManagementClient -} - -// NewLocationClient creates an instance of the LocationClient client. -func NewLocationClient(subscriptionID string) LocationClient { - return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationClientWithBaseURI creates an instance of the LocationClient -// client. -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetQuotas gets the Batch service quotas for the specified subscription at -// the given location. -// -// locationName is the desired region for the quotas. -func (client LocationClient) GetQuotas(locationName string) (result LocationQuota, err error) { - req, err := client.GetQuotasPreparer(locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", nil, "Failure preparing request") - return - } - - resp, err := client.GetQuotasSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure sending request") - return - } - - result, err = client.GetQuotasResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure responding to request") - } - - return -} - -// GetQuotasPreparer prepares the GetQuotas request. -func (client LocationClient) GetQuotasPreparer(locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetQuotasSender sends the GetQuotas request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) GetQuotasSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetQuotasResponder handles the response to the GetQuotas request. The method always -// closes the http.Response Body. -func (client LocationClient) GetQuotasResponder(resp *http.Response) (result LocationQuota, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// LocationClient is the client for the Location methods of the Batch service. +type LocationClient struct { + ManagementClient +} + +// NewLocationClient creates an instance of the LocationClient client. +func NewLocationClient(subscriptionID string) LocationClient { + return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationClientWithBaseURI creates an instance of the LocationClient +// client. +func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { + return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetQuotas gets the Batch service quotas for the specified subscription at +// the given location. +// +// locationName is the desired region for the quotas. +func (client LocationClient) GetQuotas(locationName string) (result LocationQuota, err error) { + req, err := client.GetQuotasPreparer(locationName) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", nil, "Failure preparing request") + return + } + + resp, err := client.GetQuotasSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure sending request") + return + } + + result, err = client.GetQuotasResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "batch.LocationClient", "GetQuotas", resp, "Failure responding to request") + } + + return +} + +// GetQuotasPreparer prepares the GetQuotas request. +func (client LocationClient) GetQuotasPreparer(locationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetQuotasSender sends the GetQuotas request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) GetQuotasSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetQuotasResponder handles the response to the GetQuotas request. The method always +// closes the http.Response Body. +func (client LocationClient) GetQuotasResponder(resp *http.Response) (result LocationQuota, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/models.go index 316403bceb..8573f5005b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/models.go @@ -1,264 +1,264 @@ -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccountKeyType enumerates the values for account key type. -type AccountKeyType string - -const ( - // Primary specifies the primary state for account key type. - Primary AccountKeyType = "Primary" - // Secondary specifies the secondary state for account key type. - Secondary AccountKeyType = "Secondary" -) - -// PackageState enumerates the values for package state. -type PackageState string - -const ( - // Active specifies the active state for package state. - Active PackageState = "active" - // Pending specifies the pending state for package state. - Pending PackageState = "pending" - // Unmapped specifies the unmapped state for package state. - Unmapped PackageState = "unmapped" -) - -// PoolAllocationMode enumerates the values for pool allocation mode. -type PoolAllocationMode string - -const ( - // BatchService specifies the batch service state for pool allocation mode. - BatchService PoolAllocationMode = "BatchService" - // UserSubscription specifies the user subscription state for pool - // allocation mode. - UserSubscription PoolAllocationMode = "UserSubscription" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Cancelled specifies the cancelled state for provisioning state. - Cancelled ProvisioningState = "Cancelled" - // Creating specifies the creating state for provisioning state. - Creating ProvisioningState = "Creating" - // Deleting specifies the deleting state for provisioning state. - Deleting ProvisioningState = "Deleting" - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "Failed" - // Invalid specifies the invalid state for provisioning state. - Invalid ProvisioningState = "Invalid" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" -) - -// Account is contains information about an Azure Batch account. -type Account struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AccountProperties `json:"properties,omitempty"` -} - -// AccountBaseProperties is the properties of a Batch account. -type AccountBaseProperties struct { - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` - PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` - KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` -} - -// AccountCreateParameters is parameters supplied to the Create operation. -type AccountCreateParameters struct { - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AccountBaseProperties `json:"properties,omitempty"` -} - -// AccountKeys is a set of Azure Batch account keys. -type AccountKeys struct { - autorest.Response `json:"-"` - Primary *string `json:"primary,omitempty"` - Secondary *string `json:"secondary,omitempty"` -} - -// AccountListResult is values returned by the List operation. -type AccountListResult struct { - autorest.Response `json:"-"` - Value *[]Account `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AccountListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AccountListResult) AccountListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AccountProperties is account specific properties. -type AccountProperties struct { - AccountEndpoint *string `json:"accountEndpoint,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` - KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` - AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` - CoreQuota *int32 `json:"coreQuota,omitempty"` - PoolQuota *int32 `json:"poolQuota,omitempty"` - ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` -} - -// AccountRegenerateKeyParameters is parameters supplied to the RegenerateKey -// operation. -type AccountRegenerateKeyParameters struct { - KeyName AccountKeyType `json:"keyName,omitempty"` -} - -// AccountUpdateBaseProperties is the properties for a Batch account update. -type AccountUpdateBaseProperties struct { - AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` -} - -// AccountUpdateParameters is parameters supplied to the Update operation. -type AccountUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *AccountUpdateBaseProperties `json:"properties,omitempty"` -} - -// ActivateApplicationPackageParameters is parameters for an -// ApplicationOperations.ActivateApplicationPackage request. -type ActivateApplicationPackageParameters struct { - Format *string `json:"format,omitempty"` -} - -// AddApplicationParameters is parameters for an -// ApplicationOperations.AddApplication request. -type AddApplicationParameters struct { - AllowUpdates *bool `json:"allowUpdates,omitempty"` - DisplayName *string `json:"displayName,omitempty"` -} - -// Application is contains information about an application in a Batch account. -type Application struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Packages *[]ApplicationPackage `json:"packages,omitempty"` - AllowUpdates *bool `json:"allowUpdates,omitempty"` - DefaultVersion *string `json:"defaultVersion,omitempty"` -} - -// ApplicationPackage is an application package which represents a particular -// version of an application. -type ApplicationPackage struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Version *string `json:"version,omitempty"` - State PackageState `json:"state,omitempty"` - Format *string `json:"format,omitempty"` - StorageURL *string `json:"storageUrl,omitempty"` - StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` - LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` -} - -// AutoStorageBaseProperties is the properties related to auto storage account. -type AutoStorageBaseProperties struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` -} - -// AutoStorageProperties is contains information about the auto storage account -// associated with a Batch account. -type AutoStorageProperties struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` - LastKeySync *date.Time `json:"lastKeySync,omitempty"` -} - -// CloudError is an error response from the Batch service. -type CloudError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]CloudError `json:"details,omitempty"` -} - -// KeyVaultReference is identifies the Azure key vault associated with a Batch -// account. -type KeyVaultReference struct { - ID *string `json:"id,omitempty"` - URL *string `json:"url,omitempty"` -} - -// ListApplicationsResult is response to an -// ApplicationOperations.ListApplications request. -type ListApplicationsResult struct { - autorest.Response `json:"-"` - Value *[]Application `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListApplicationsResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListApplicationsResult) ListApplicationsResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// LocationQuota is quotas associated with a Batch region for a particular -// subscription. -type LocationQuota struct { - autorest.Response `json:"-"` - AccountQuota *int32 `json:"accountQuota,omitempty"` -} - -// Resource is a definition of an Azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// UpdateApplicationParameters is parameters for an -// ApplicationOperations.UpdateApplication request. -type UpdateApplicationParameters struct { - AllowUpdates *bool `json:"allowUpdates,omitempty"` - DefaultVersion *string `json:"defaultVersion,omitempty"` - DisplayName *string `json:"displayName,omitempty"` -} +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccountKeyType enumerates the values for account key type. +type AccountKeyType string + +const ( + // Primary specifies the primary state for account key type. + Primary AccountKeyType = "Primary" + // Secondary specifies the secondary state for account key type. + Secondary AccountKeyType = "Secondary" +) + +// PackageState enumerates the values for package state. +type PackageState string + +const ( + // Active specifies the active state for package state. + Active PackageState = "active" + // Pending specifies the pending state for package state. + Pending PackageState = "pending" + // Unmapped specifies the unmapped state for package state. + Unmapped PackageState = "unmapped" +) + +// PoolAllocationMode enumerates the values for pool allocation mode. +type PoolAllocationMode string + +const ( + // BatchService specifies the batch service state for pool allocation mode. + BatchService PoolAllocationMode = "BatchService" + // UserSubscription specifies the user subscription state for pool + // allocation mode. + UserSubscription PoolAllocationMode = "UserSubscription" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Cancelled specifies the cancelled state for provisioning state. + Cancelled ProvisioningState = "Cancelled" + // Creating specifies the creating state for provisioning state. + Creating ProvisioningState = "Creating" + // Deleting specifies the deleting state for provisioning state. + Deleting ProvisioningState = "Deleting" + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // Invalid specifies the invalid state for provisioning state. + Invalid ProvisioningState = "Invalid" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" +) + +// Account is contains information about an Azure Batch account. +type Account struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AccountProperties `json:"properties,omitempty"` +} + +// AccountBaseProperties is the properties of a Batch account. +type AccountBaseProperties struct { + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` +} + +// AccountCreateParameters is parameters supplied to the Create operation. +type AccountCreateParameters struct { + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AccountBaseProperties `json:"properties,omitempty"` +} + +// AccountKeys is a set of Azure Batch account keys. +type AccountKeys struct { + autorest.Response `json:"-"` + Primary *string `json:"primary,omitempty"` + Secondary *string `json:"secondary,omitempty"` +} + +// AccountListResult is values returned by the List operation. +type AccountListResult struct { + autorest.Response `json:"-"` + Value *[]Account `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AccountListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AccountListResult) AccountListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AccountProperties is account specific properties. +type AccountProperties struct { + AccountEndpoint *string `json:"accountEndpoint,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` + KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` + AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` + CoreQuota *int32 `json:"coreQuota,omitempty"` + PoolQuota *int32 `json:"poolQuota,omitempty"` + ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` +} + +// AccountRegenerateKeyParameters is parameters supplied to the RegenerateKey +// operation. +type AccountRegenerateKeyParameters struct { + KeyName AccountKeyType `json:"keyName,omitempty"` +} + +// AccountUpdateBaseProperties is the properties for a Batch account update. +type AccountUpdateBaseProperties struct { + AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` +} + +// AccountUpdateParameters is parameters supplied to the Update operation. +type AccountUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + *AccountUpdateBaseProperties `json:"properties,omitempty"` +} + +// ActivateApplicationPackageParameters is parameters for an +// ApplicationOperations.ActivateApplicationPackage request. +type ActivateApplicationPackageParameters struct { + Format *string `json:"format,omitempty"` +} + +// AddApplicationParameters is parameters for an +// ApplicationOperations.AddApplication request. +type AddApplicationParameters struct { + AllowUpdates *bool `json:"allowUpdates,omitempty"` + DisplayName *string `json:"displayName,omitempty"` +} + +// Application is contains information about an application in a Batch account. +type Application struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Packages *[]ApplicationPackage `json:"packages,omitempty"` + AllowUpdates *bool `json:"allowUpdates,omitempty"` + DefaultVersion *string `json:"defaultVersion,omitempty"` +} + +// ApplicationPackage is an application package which represents a particular +// version of an application. +type ApplicationPackage struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Version *string `json:"version,omitempty"` + State PackageState `json:"state,omitempty"` + Format *string `json:"format,omitempty"` + StorageURL *string `json:"storageUrl,omitempty"` + StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` + LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` +} + +// AutoStorageBaseProperties is the properties related to auto storage account. +type AutoStorageBaseProperties struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` +} + +// AutoStorageProperties is contains information about the auto storage account +// associated with a Batch account. +type AutoStorageProperties struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` + LastKeySync *date.Time `json:"lastKeySync,omitempty"` +} + +// CloudError is an error response from the Batch service. +type CloudError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]CloudError `json:"details,omitempty"` +} + +// KeyVaultReference is identifies the Azure key vault associated with a Batch +// account. +type KeyVaultReference struct { + ID *string `json:"id,omitempty"` + URL *string `json:"url,omitempty"` +} + +// ListApplicationsResult is response to an +// ApplicationOperations.ListApplications request. +type ListApplicationsResult struct { + autorest.Response `json:"-"` + Value *[]Application `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListApplicationsResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListApplicationsResult) ListApplicationsResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// LocationQuota is quotas associated with a Batch region for a particular +// subscription. +type LocationQuota struct { + autorest.Response `json:"-"` + AccountQuota *int32 `json:"accountQuota,omitempty"` +} + +// Resource is a definition of an Azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// UpdateApplicationParameters is parameters for an +// ApplicationOperations.UpdateApplication request. +type UpdateApplicationParameters struct { + AllowUpdates *bool `json:"allowUpdates,omitempty"` + DefaultVersion *string `json:"defaultVersion,omitempty"` + DisplayName *string `json:"displayName,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/version.go index bf6287453d..2c0c5959e5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/batch/version.go @@ -1,29 +1,29 @@ -package batch - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-batch/2017-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package batch + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-batch/2017-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/client.go index 6e9ac70534..9b65a1cacf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/client.go @@ -1,55 +1,55 @@ -// Package billing implements the Azure ARM Billing service API version -// 2017-04-24-preview. -// -// Billing client provides access to billing resources for Azure Web-Direct -// subscriptions. Other subscription types which were not purchased directly -// through the Azure web portal are not supported through this preview API. -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Billing - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Billing. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package billing implements the Azure ARM Billing service API version +// 2017-04-24-preview. +// +// Billing client provides access to billing resources for Azure Web-Direct +// subscriptions. Other subscription types which were not purchased directly +// through the Azure web portal are not supported through this preview API. +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Billing + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Billing. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/invoices.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/invoices.go index 2c90ad375e..25c6fa2d7e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/invoices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/invoices.go @@ -1,293 +1,293 @@ -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// InvoicesClient is the billing client provides access to billing resources -// for Azure Web-Direct subscriptions. Other subscription types which were not -// purchased directly through the Azure web portal are not supported through -// this preview API. -type InvoicesClient struct { - ManagementClient -} - -// NewInvoicesClient creates an instance of the InvoicesClient client. -func NewInvoicesClient(subscriptionID string) InvoicesClient { - return NewInvoicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoicesClientWithBaseURI creates an instance of the InvoicesClient -// client. -func NewInvoicesClientWithBaseURI(baseURI string, subscriptionID string) InvoicesClient { - return InvoicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a named invoice resource. When getting a single invoice, the -// downloadUrl property is expanded automatically. -// -// invoiceName is the name of an invoice resource. -func (client InvoicesClient) Get(invoiceName string) (result Invoice, err error) { - req, err := client.GetPreparer(invoiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client InvoicesClient) GetPreparer(invoiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "invoiceName": autorest.Encode("path", invoiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client InvoicesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client InvoicesClient) GetResponder(resp *http.Response) (result Invoice, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLatest gets the most recent invoice. When getting a single invoice, the -// downloadUrl property is expanded automatically. -func (client InvoicesClient) GetLatest() (result Invoice, err error) { - req, err := client.GetLatestPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "GetLatest", nil, "Failure preparing request") - return - } - - resp, err := client.GetLatestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "GetLatest", resp, "Failure sending request") - return - } - - result, err = client.GetLatestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "GetLatest", resp, "Failure responding to request") - } - - return -} - -// GetLatestPreparer prepares the GetLatest request. -func (client InvoicesClient) GetLatestPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/latest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetLatestSender sends the GetLatest request. The method will close the -// http.Response Body if it receives an error. -func (client InvoicesClient) GetLatestSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLatestResponder handles the response to the GetLatest request. The method always -// closes the http.Response Body. -func (client InvoicesClient) GetLatestResponder(resp *http.Response) (result Invoice, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the available invoices for a subscription in reverse -// chronological order beginning with the most recent invoice. In preview, -// invoices are available via this API only for invoice periods which end -// December 1, 2016 or later. -// -// expand is may be used to expand the downloadUrl property within a list of -// invoices. This enables download links to be generated for multiple invoices -// at once. By default, downloadURLs are not included when listing invoices. -// filter is may be used to filter invoices by invoicePeriodEndDate. The filter -// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently -// support 'ne', 'or', or 'not'. skiptoken is skiptoken is only used if a -// previous operation returned a partial result. If a previous response -// contains a nextLink element, the value of the nextLink element will include -// a skiptoken parameter that specifies a starting point to use for subsequent -// calls. top is may be used to limit the number of results to the most recent -// N invoices. -func (client InvoicesClient) List(expand string, filter string, skiptoken string, top *int32) (result InvoicesListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "billing.InvoicesClient", "List") - } - - req, err := client.ListPreparer(expand, filter, skiptoken, top) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoicesClient) ListPreparer(expand string, filter string, skiptoken string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client InvoicesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client InvoicesClient) ListResponder(resp *http.Response) (result InvoicesListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client InvoicesClient) ListNextResults(lastResults InvoicesListResult) (result InvoicesListResult, err error) { - req, err := lastResults.InvoicesListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// InvoicesClient is the billing client provides access to billing resources +// for Azure Web-Direct subscriptions. Other subscription types which were not +// purchased directly through the Azure web portal are not supported through +// this preview API. +type InvoicesClient struct { + ManagementClient +} + +// NewInvoicesClient creates an instance of the InvoicesClient client. +func NewInvoicesClient(subscriptionID string) InvoicesClient { + return NewInvoicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInvoicesClientWithBaseURI creates an instance of the InvoicesClient +// client. +func NewInvoicesClientWithBaseURI(baseURI string, subscriptionID string) InvoicesClient { + return InvoicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a named invoice resource. When getting a single invoice, the +// downloadUrl property is expanded automatically. +// +// invoiceName is the name of an invoice resource. +func (client InvoicesClient) Get(invoiceName string) (result Invoice, err error) { + req, err := client.GetPreparer(invoiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client InvoicesClient) GetPreparer(invoiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "invoiceName": autorest.Encode("path", invoiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InvoicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InvoicesClient) GetResponder(resp *http.Response) (result Invoice, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLatest gets the most recent invoice. When getting a single invoice, the +// downloadUrl property is expanded automatically. +func (client InvoicesClient) GetLatest() (result Invoice, err error) { + req, err := client.GetLatestPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "GetLatest", nil, "Failure preparing request") + return + } + + resp, err := client.GetLatestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "GetLatest", resp, "Failure sending request") + return + } + + result, err = client.GetLatestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "GetLatest", resp, "Failure responding to request") + } + + return +} + +// GetLatestPreparer prepares the GetLatest request. +func (client InvoicesClient) GetLatestPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/latest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetLatestSender sends the GetLatest request. The method will close the +// http.Response Body if it receives an error. +func (client InvoicesClient) GetLatestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLatestResponder handles the response to the GetLatest request. The method always +// closes the http.Response Body. +func (client InvoicesClient) GetLatestResponder(resp *http.Response) (result Invoice, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the available invoices for a subscription in reverse +// chronological order beginning with the most recent invoice. In preview, +// invoices are available via this API only for invoice periods which end +// December 1, 2016 or later. +// +// expand is may be used to expand the downloadUrl property within a list of +// invoices. This enables download links to be generated for multiple invoices +// at once. By default, downloadURLs are not included when listing invoices. +// filter is may be used to filter invoices by invoicePeriodEndDate. The filter +// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently +// support 'ne', 'or', or 'not'. skiptoken is skiptoken is only used if a +// previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include +// a skiptoken parameter that specifies a starting point to use for subsequent +// calls. top is may be used to limit the number of results to the most recent +// N invoices. +func (client InvoicesClient) List(expand string, filter string, skiptoken string, top *int32) (result InvoicesListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "billing.InvoicesClient", "List") + } + + req, err := client.ListPreparer(expand, filter, skiptoken, top) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client InvoicesClient) ListPreparer(expand string, filter string, skiptoken string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InvoicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InvoicesClient) ListResponder(resp *http.Response) (result InvoicesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client InvoicesClient) ListNextResults(lastResults InvoicesListResult) (result InvoicesListResult, err error) { + req, err := lastResults.InvoicesListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/models.go index da51494549..03c32d20c3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/models.go @@ -1,160 +1,160 @@ -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DownloadURL is a secure URL that can be used to download a PDF invoice until -// the URL expires. -type DownloadURL struct { - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - URL *string `json:"url,omitempty"` -} - -// ErrorDetails is the details of the error. -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// ErrorResponse is error response indicates that the service is not able to -// process the incoming request. The reason is provided in the error message. -type ErrorResponse struct { - Error *ErrorDetails `json:"error,omitempty"` -} - -// Invoice is an invoice resource can be used download a PDF version of an -// invoice. -type Invoice struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *InvoiceProperties `json:"properties,omitempty"` -} - -// InvoiceProperties is the properties of the invoice. -type InvoiceProperties struct { - DownloadURL *DownloadURL `json:"downloadUrl,omitempty"` - InvoicePeriodStartDate *date.Date `json:"invoicePeriodStartDate,omitempty"` - InvoicePeriodEndDate *date.Date `json:"invoicePeriodEndDate,omitempty"` - BillingPeriodIds *[]string `json:"billingPeriodIds,omitempty"` -} - -// InvoicesListResult is result of listing invoices. It contains a list of -// available invoices in reverse chronological order. -type InvoicesListResult struct { - autorest.Response `json:"-"` - Value *[]Invoice `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// InvoicesListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client InvoicesListResult) InvoicesListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Operation is a Billing REST API operation. -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result listing billing operations. It contains a list -// of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Period is a billing period resource. -type Period struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *PeriodProperties `json:"properties,omitempty"` -} - -// PeriodProperties is the properties of the billing period. -type PeriodProperties struct { - BillingPeriodStartDate *date.Date `json:"billingPeriodStartDate,omitempty"` - BillingPeriodEndDate *date.Date `json:"billingPeriodEndDate,omitempty"` - InvoiceIds *[]string `json:"invoiceIds,omitempty"` -} - -// PeriodsListResult is result of listing billing periods. It contains a list -// of available billing periods in reverse chronological order. -type PeriodsListResult struct { - autorest.Response `json:"-"` - Value *[]Period `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PeriodsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PeriodsListResult) PeriodsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DownloadURL is a secure URL that can be used to download a PDF invoice until +// the URL expires. +type DownloadURL struct { + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + URL *string `json:"url,omitempty"` +} + +// ErrorDetails is the details of the error. +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} + +// ErrorResponse is error response indicates that the service is not able to +// process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + Error *ErrorDetails `json:"error,omitempty"` +} + +// Invoice is an invoice resource can be used download a PDF version of an +// invoice. +type Invoice struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *InvoiceProperties `json:"properties,omitempty"` +} + +// InvoiceProperties is the properties of the invoice. +type InvoiceProperties struct { + DownloadURL *DownloadURL `json:"downloadUrl,omitempty"` + InvoicePeriodStartDate *date.Date `json:"invoicePeriodStartDate,omitempty"` + InvoicePeriodEndDate *date.Date `json:"invoicePeriodEndDate,omitempty"` + BillingPeriodIds *[]string `json:"billingPeriodIds,omitempty"` +} + +// InvoicesListResult is result of listing invoices. It contains a list of +// available invoices in reverse chronological order. +type InvoicesListResult struct { + autorest.Response `json:"-"` + Value *[]Invoice `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// InvoicesListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client InvoicesListResult) InvoicesListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Operation is a Billing REST API operation. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result listing billing operations. It contains a list +// of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Period is a billing period resource. +type Period struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *PeriodProperties `json:"properties,omitempty"` +} + +// PeriodProperties is the properties of the billing period. +type PeriodProperties struct { + BillingPeriodStartDate *date.Date `json:"billingPeriodStartDate,omitempty"` + BillingPeriodEndDate *date.Date `json:"billingPeriodEndDate,omitempty"` + InvoiceIds *[]string `json:"invoiceIds,omitempty"` +} + +// PeriodsListResult is result of listing billing periods. It contains a list +// of available billing periods in reverse chronological order. +type PeriodsListResult struct { + autorest.Response `json:"-"` + Value *[]Period `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PeriodsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PeriodsListResult) PeriodsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/operations.go index 84ce12dc4b..32baa3a541 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/operations.go @@ -1,125 +1,125 @@ -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the billing client provides access to billing resources -// for Azure Web-Direct subscriptions. Other subscription types which were not -// purchased directly through the Azure web portal are not supported through -// this preview API. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available billing REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Billing/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the billing client provides access to billing resources +// for Azure Web-Direct subscriptions. Other subscription types which were not +// purchased directly through the Azure web portal are not supported through +// this preview API. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available billing REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Billing/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/periods.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/periods.go index 1679f9c7ad..3178c9828f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/periods.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/periods.go @@ -1,221 +1,221 @@ -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PeriodsClient is the billing client provides access to billing resources for -// Azure Web-Direct subscriptions. Other subscription types which were not -// purchased directly through the Azure web portal are not supported through -// this preview API. -type PeriodsClient struct { - ManagementClient -} - -// NewPeriodsClient creates an instance of the PeriodsClient client. -func NewPeriodsClient(subscriptionID string) PeriodsClient { - return NewPeriodsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPeriodsClientWithBaseURI creates an instance of the PeriodsClient client. -func NewPeriodsClientWithBaseURI(baseURI string, subscriptionID string) PeriodsClient { - return PeriodsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a named billing period. -// -// billingPeriodName is the name of a BillingPeriod resource. -func (client PeriodsClient) Get(billingPeriodName string) (result Period, err error) { - req, err := client.GetPreparer(billingPeriodName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PeriodsClient) GetPreparer(billingPeriodName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingPeriodName": autorest.Encode("path", billingPeriodName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PeriodsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PeriodsClient) GetResponder(resp *http.Response) (result Period, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the available billing periods for a subscription in reverse -// chronological order. -// -// filter is may be used to filter billing periods by billingPeriodEndDate. The -// filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not -// currently support 'ne', 'or', or 'not'. skiptoken is skiptoken is only used -// if a previous operation returned a partial result. If a previous response -// contains a nextLink element, the value of the nextLink element will include -// a skiptoken parameter that specifies a starting point to use for subsequent -// calls. top is may be used to limit the number of results to the most recent -// N billing periods. -func (client PeriodsClient) List(filter string, skiptoken string, top *int32) (result PeriodsListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "billing.PeriodsClient", "List") - } - - req, err := client.ListPreparer(filter, skiptoken, top) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PeriodsClient) ListPreparer(filter string, skiptoken string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PeriodsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PeriodsClient) ListResponder(resp *http.Response) (result PeriodsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client PeriodsClient) ListNextResults(lastResults PeriodsListResult) (result PeriodsListResult, err error) { - req, err := lastResults.PeriodsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PeriodsClient is the billing client provides access to billing resources for +// Azure Web-Direct subscriptions. Other subscription types which were not +// purchased directly through the Azure web portal are not supported through +// this preview API. +type PeriodsClient struct { + ManagementClient +} + +// NewPeriodsClient creates an instance of the PeriodsClient client. +func NewPeriodsClient(subscriptionID string) PeriodsClient { + return NewPeriodsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPeriodsClientWithBaseURI creates an instance of the PeriodsClient client. +func NewPeriodsClientWithBaseURI(baseURI string, subscriptionID string) PeriodsClient { + return PeriodsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a named billing period. +// +// billingPeriodName is the name of a BillingPeriod resource. +func (client PeriodsClient) Get(billingPeriodName string) (result Period, err error) { + req, err := client.GetPreparer(billingPeriodName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PeriodsClient) GetPreparer(billingPeriodName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingPeriodName": autorest.Encode("path", billingPeriodName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PeriodsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PeriodsClient) GetResponder(resp *http.Response) (result Period, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the available billing periods for a subscription in reverse +// chronological order. +// +// filter is may be used to filter billing periods by billingPeriodEndDate. The +// filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not +// currently support 'ne', 'or', or 'not'. skiptoken is skiptoken is only used +// if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element will include +// a skiptoken parameter that specifies a starting point to use for subsequent +// calls. top is may be used to limit the number of results to the most recent +// N billing periods. +func (client PeriodsClient) List(filter string, skiptoken string, top *int32) (result PeriodsListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "billing.PeriodsClient", "List") + } + + req, err := client.ListPreparer(filter, skiptoken, top) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PeriodsClient) ListPreparer(filter string, skiptoken string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PeriodsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PeriodsClient) ListResponder(resp *http.Response) (result PeriodsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client PeriodsClient) ListNextResults(lastResults PeriodsListResult) (result PeriodsListResult, err error) { + req, err := lastResults.PeriodsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PeriodsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/version.go index 7d39cb3b06..6ef3da8302 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/billing/version.go @@ -1,29 +1,29 @@ -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-billing/2017-04-24-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-billing/2017-04-24-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go index 1960c1eeaa..bd5ca9d8b5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go @@ -1,293 +1,293 @@ -// Package cdn implements the Azure ARM Cdn service API version 2016-10-02. -// -// Use these APIs to manage Azure CDN resources through the Azure Resource -// Manager. You must make sure that requests made to these resources are -// secure. -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Cdn - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Cdn. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CheckNameAvailability check the availability of a resource name. This is -// needed for resources where name is globally unique, such as a CDN endpoint. -// -// checkNameAvailabilityInput is input to check. -func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: checkNameAvailabilityInput, - Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.ManagementClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ManagementClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cdn/checkNameAvailability"), - autorest.WithJSON(checkNameAvailabilityInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOperations lists all of the available CDN REST API operations. -func (client ManagementClient) ListOperations() (result OperationListResult, err error) { - req, err := client.ListOperationsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending request") - return - } - - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to request") - } - - return -} - -// ListOperationsPreparer prepares the ListOperations request. -func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cdn/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListOperationsSender sends the ListOperations request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListOperationsResponder handles the response to the ListOperations request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOperationsNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending next results request") - } - - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to next results request") - } - - return -} - -// ListResourceUsage check the quota and actual usage of the CDN profiles under -// the given subscription. -func (client ManagementClient) ListResourceUsage() (result ResourceUsageListResult, err error) { - req, err := client.ListResourceUsagePreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ListResourceUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending request") - return - } - - result, err = client.ListResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to request") - } - - return -} - -// ListResourceUsagePreparer prepares the ListResourceUsage request. -func (client ManagementClient) ListResourceUsagePreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListResourceUsageSender sends the ListResourceUsage request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListResourceUsageNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { - req, err := lastResults.ResourceUsageListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListResourceUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending next results request") - } - - result, err = client.ListResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to next results request") - } - - return -} +// Package cdn implements the Azure ARM Cdn service API version 2016-10-02. +// +// Use these APIs to manage Azure CDN resources through the Azure Resource +// Manager. You must make sure that requests made to these resources are +// secure. +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Cdn + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Cdn. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckNameAvailability check the availability of a resource name. This is +// needed for resources where name is globally unique, such as a CDN endpoint. +// +// checkNameAvailabilityInput is input to check. +func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.ManagementClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ManagementClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/checkNameAvailability"), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOperations lists all of the available CDN REST API operations. +func (client ManagementClient) ListOperations() (result OperationListResult, err error) { + req, err := client.ListOperationsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending request") + return + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to request") + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOperationsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending next results request") + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure responding to next results request") + } + + return +} + +// ListResourceUsage check the quota and actual usage of the CDN profiles under +// the given subscription. +func (client ManagementClient) ListResourceUsage() (result ResourceUsageListResult, err error) { + req, err := client.ListResourceUsagePreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to request") + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client ManagementClient) ListResourceUsagePreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListResourceUsageNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.ResourceUsageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending next results request") + } + + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go index 52bed2b529..6889272175 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go @@ -1,585 +1,585 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CustomDomainsClient is the use these APIs to manage Azure CDN resources -// through the Azure Resource Manager. You must make sure that requests made to -// these resources are secure. -type CustomDomainsClient struct { - ManagementClient -} - -// NewCustomDomainsClient creates an instance of the CustomDomainsClient -// client. -func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { - return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCustomDomainsClientWithBaseURI creates an instance of the -// CustomDomainsClient client. -func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { - return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new custom domain within an endpoint. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. customDomainName is name of the custom domain -// within an endpoint. customDomainProperties is properties required to create -// a new custom domain. -func (client CustomDomainsClient) Create(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (<-chan CustomDomain, <-chan error) { - resultChan := make(chan CustomDomain, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: customDomainProperties, - Constraints: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result CustomDomain - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, customDomainName, customDomainProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client CustomDomainsClient) CreatePreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "customDomainName": autorest.Encode("path", customDomainName), - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), - autorest.WithJSON(customDomainProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client CustomDomainsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result CustomDomain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing custom domain within an endpoint. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. customDomainName is name of the custom domain -// within an endpoint. -func (client CustomDomainsClient) Delete(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (<-chan CustomDomain, <-chan error) { - resultChan := make(chan CustomDomain, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result CustomDomain - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, customDomainName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client CustomDomainsClient) DeletePreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "customDomainName": autorest.Encode("path", customDomainName), - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CustomDomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result CustomDomain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DisableCustomHTTPS disable https delivery of the custom domain. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. customDomainName is name of the custom domain -// within an endpoint. -func (client CustomDomainsClient) DisableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS") - } - - req, err := client.DisableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", nil, "Failure preparing request") - return - } - - resp, err := client.DisableCustomHTTPSSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure sending request") - return - } - - result, err = client.DisableCustomHTTPSResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure responding to request") - } - - return -} - -// DisableCustomHTTPSPreparer prepares the DisableCustomHTTPS request. -func (client CustomDomainsClient) DisableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "customDomainName": autorest.Encode("path", customDomainName), - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DisableCustomHTTPSSender sends the DisableCustomHTTPS request. The method will close the -// http.Response Body if it receives an error. -func (client CustomDomainsClient) DisableCustomHTTPSSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DisableCustomHTTPSResponder handles the response to the DisableCustomHTTPS request. The method always -// closes the http.Response Body. -func (client CustomDomainsClient) DisableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// EnableCustomHTTPS enable https delivery of the custom domain. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. customDomainName is name of the custom domain -// within an endpoint. -func (client CustomDomainsClient) EnableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS") - } - - req, err := client.EnableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", nil, "Failure preparing request") - return - } - - resp, err := client.EnableCustomHTTPSSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure sending request") - return - } - - result, err = client.EnableCustomHTTPSResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure responding to request") - } - - return -} - -// EnableCustomHTTPSPreparer prepares the EnableCustomHTTPS request. -func (client CustomDomainsClient) EnableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "customDomainName": autorest.Encode("path", customDomainName), - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// EnableCustomHTTPSSender sends the EnableCustomHTTPS request. The method will close the -// http.Response Body if it receives an error. -func (client CustomDomainsClient) EnableCustomHTTPSSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// EnableCustomHTTPSResponder handles the response to the EnableCustomHTTPS request. The method always -// closes the http.Response Body. -func (client CustomDomainsClient) EnableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an exisitng custom domain within an endpoint. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. customDomainName is name of the custom domain -// within an endpoint. -func (client CustomDomainsClient) Get(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, profileName, endpointName, customDomainName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CustomDomainsClient) GetPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "customDomainName": autorest.Encode("path", customDomainName), - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByEndpoint lists all of the existing custom domains within an endpoint. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client CustomDomainsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "ListByEndpoint") - } - - req, err := client.ListByEndpointPreparer(resourceGroupName, profileName, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing request") - return - } - - resp, err := client.ListByEndpointSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending request") - return - } - - result, err = client.ListByEndpointResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure responding to request") - } - - return -} - -// ListByEndpointPreparer prepares the ListByEndpoint request. -func (client CustomDomainsClient) ListByEndpointPreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByEndpointSender sends the ListByEndpoint request. The method will close the -// http.Response Body if it receives an error. -func (client CustomDomainsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always -// closes the http.Response Body. -func (client CustomDomainsClient) ListByEndpointResponder(resp *http.Response) (result CustomDomainListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByEndpointNextResults retrieves the next set of results, if any. -func (client CustomDomainsClient) ListByEndpointNextResults(lastResults CustomDomainListResult) (result CustomDomainListResult, err error) { - req, err := lastResults.CustomDomainListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByEndpointSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending next results request") - } - - result, err = client.ListByEndpointResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure responding to next results request") - } - - return -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CustomDomainsClient is the use these APIs to manage Azure CDN resources +// through the Azure Resource Manager. You must make sure that requests made to +// these resources are secure. +type CustomDomainsClient struct { + ManagementClient +} + +// NewCustomDomainsClient creates an instance of the CustomDomainsClient +// client. +func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { + return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomDomainsClientWithBaseURI creates an instance of the +// CustomDomainsClient client. +func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { + return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new custom domain within an endpoint. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. customDomainProperties is properties required to create +// a new custom domain. +func (client CustomDomainsClient) Create(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (<-chan CustomDomain, <-chan error) { + resultChan := make(chan CustomDomain, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result CustomDomain + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, customDomainName, customDomainProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client CustomDomainsClient) CreatePreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing custom domain within an endpoint. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. +func (client CustomDomainsClient) Delete(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (<-chan CustomDomain, <-chan error) { + resultChan := make(chan CustomDomain, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result CustomDomain + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, customDomainName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client CustomDomainsClient) DeletePreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DisableCustomHTTPS disable https delivery of the custom domain. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. +func (client CustomDomainsClient) DisableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS") + } + + req, err := client.DisableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", nil, "Failure preparing request") + return + } + + resp, err := client.DisableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure sending request") + return + } + + result, err = client.DisableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure responding to request") + } + + return +} + +// DisableCustomHTTPSPreparer prepares the DisableCustomHTTPS request. +func (client CustomDomainsClient) DisableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DisableCustomHTTPSSender sends the DisableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DisableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DisableCustomHTTPSResponder handles the response to the DisableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) DisableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// EnableCustomHTTPS enable https delivery of the custom domain. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. +func (client CustomDomainsClient) EnableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS") + } + + req, err := client.EnableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", nil, "Failure preparing request") + return + } + + resp, err := client.EnableCustomHTTPSSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure sending request") + return + } + + result, err = client.EnableCustomHTTPSResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure responding to request") + } + + return +} + +// EnableCustomHTTPSPreparer prepares the EnableCustomHTTPS request. +func (client CustomDomainsClient) EnableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EnableCustomHTTPSSender sends the EnableCustomHTTPS request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) EnableCustomHTTPSSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EnableCustomHTTPSResponder handles the response to the EnableCustomHTTPS request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) EnableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an exisitng custom domain within an endpoint. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainName is name of the custom domain +// within an endpoint. +func (client CustomDomainsClient) Get(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, profileName, endpointName, customDomainName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomDomainsClient) GetPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customDomainName": autorest.Encode("path", customDomainName), + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing custom domains within an endpoint. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client CustomDomainsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result CustomDomainListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "ListByEndpoint") + } + + req, err := client.ListByEndpointPreparer(resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure responding to request") + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client CustomDomainsClient) ListByEndpointPreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client CustomDomainsClient) ListByEndpointResponder(resp *http.Response) (result CustomDomainListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpointNextResults retrieves the next set of results, if any. +func (client CustomDomainsClient) ListByEndpointNextResults(lastResults CustomDomainListResult) (result CustomDomainListResult, err error) { + req, err := lastResults.CustomDomainListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending next results request") + } + + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go index 49ba51b757..a68b5c1896 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go @@ -1,124 +1,124 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// EdgeNodesClient is the use these APIs to manage Azure CDN resources through -// the Azure Resource Manager. You must make sure that requests made to these -// resources are secure. -type EdgeNodesClient struct { - ManagementClient -} - -// NewEdgeNodesClient creates an instance of the EdgeNodesClient client. -func NewEdgeNodesClient(subscriptionID string) EdgeNodesClient { - return NewEdgeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEdgeNodesClientWithBaseURI creates an instance of the EdgeNodesClient -// client. -func NewEdgeNodesClientWithBaseURI(baseURI string, subscriptionID string) EdgeNodesClient { - return EdgeNodesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the edge nodes of a CDN service. -func (client EdgeNodesClient) List() (result EdgenodeResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client EdgeNodesClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cdn/edgenodes"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client EdgeNodesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client EdgeNodesClient) ListResponder(resp *http.Response) (result EdgenodeResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client EdgeNodesClient) ListNextResults(lastResults EdgenodeResult) (result EdgenodeResult, err error) { - req, err := lastResults.EdgenodeResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// EdgeNodesClient is the use these APIs to manage Azure CDN resources through +// the Azure Resource Manager. You must make sure that requests made to these +// resources are secure. +type EdgeNodesClient struct { + ManagementClient +} + +// NewEdgeNodesClient creates an instance of the EdgeNodesClient client. +func NewEdgeNodesClient(subscriptionID string) EdgeNodesClient { + return NewEdgeNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEdgeNodesClientWithBaseURI creates an instance of the EdgeNodesClient +// client. +func NewEdgeNodesClientWithBaseURI(baseURI string, subscriptionID string) EdgeNodesClient { + return EdgeNodesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all the edge nodes of a CDN service. +func (client EdgeNodesClient) List() (result EdgenodeResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client EdgeNodesClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cdn/edgenodes"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EdgeNodesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EdgeNodesClient) ListResponder(resp *http.Response) (result EdgenodeResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client EdgeNodesClient) ListNextResults(lastResults EdgenodeResult) (result EdgenodeResult, err error) { + req, err := lastResults.EdgenodeResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go index ab4c1fb557..dcc411e052 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go @@ -1,1101 +1,1101 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// EndpointsClient is the use these APIs to manage Azure CDN resources through -// the Azure Resource Manager. You must make sure that requests made to these -// resources are secure. -type EndpointsClient struct { - ManagementClient -} - -// NewEndpointsClient creates an instance of the EndpointsClient client. -func NewEndpointsClient(subscriptionID string) EndpointsClient { - return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient -// client. -func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { - return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new CDN endpoint with the specified endpoint name under the -// specified subscription, resource group and profile. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. endpoint is endpoint properties -func (client EndpointsClient) Create(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { - resultChan := make(chan Endpoint, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: endpoint, - Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Endpoint - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, endpoint, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client EndpointsClient) CreatePreparer(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), - autorest.WithJSON(endpoint), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client EndpointsClient) CreateResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing CDN endpoint with the specified endpoint name -// under the specified subscription, resource group and profile. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an existing CDN endpoint with the specified endpoint name under the -// specified subscription, resource group and profile. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, profileName, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProfile lists existing CDN endpoints. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. -func (client EndpointsClient) ListByProfile(resourceGroupName string, profileName string) (result EndpointListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ListByProfile") - } - - req, err := client.ListByProfilePreparer(resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing request") - return - } - - resp, err := client.ListByProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending request") - return - } - - result, err = client.ListByProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure responding to request") - } - - return -} - -// ListByProfilePreparer prepares the ListByProfile request. -func (client EndpointsClient) ListByProfilePreparer(resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByProfileSender sends the ListByProfile request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByProfileResponder handles the response to the ListByProfile request. The method always -// closes the http.Response Body. -func (client EndpointsClient) ListByProfileResponder(resp *http.Response) (result EndpointListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByProfileNextResults retrieves the next set of results, if any. -func (client EndpointsClient) ListByProfileNextResults(lastResults EndpointListResult) (result EndpointListResult, err error) { - req, err := lastResults.EndpointListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending next results request") - } - - result, err = client.ListByProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure responding to next results request") - } - - return -} - -// ListResourceUsage checks the quota and usage of geo filters and custom -// domains under the given endpoint. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client EndpointsClient) ListResourceUsage(resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ListResourceUsage") - } - - req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ListResourceUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request") - return - } - - result, err = client.ListResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to request") - } - - return -} - -// ListResourceUsagePreparer prepares the ListResourceUsage request. -func (client EndpointsClient) ListResourceUsagePreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListResourceUsageSender sends the ListResourceUsage request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always -// closes the http.Response Body. -func (client EndpointsClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListResourceUsageNextResults retrieves the next set of results, if any. -func (client EndpointsClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { - req, err := lastResults.ResourceUsageListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListResourceUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending next results request") - } - - result, err = client.ListResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to next results request") - } - - return -} - -// LoadContent pre-loads a content to CDN. Available for Verizon Profiles. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. contentFilePaths is the path to the content to be -// loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a -// single file -func (client EndpointsClient) LoadContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: contentFilePaths, - Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "LoadContent") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.LoadContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", nil, "Failure preparing request") - return - } - - resp, err := client.LoadContentSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure sending request") - return - } - - result, err = client.LoadContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// LoadContentPreparer prepares the LoadContent request. -func (client EndpointsClient) LoadContentPreparer(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load", pathParameters), - autorest.WithJSON(contentFilePaths), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// LoadContentSender sends the LoadContent request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) LoadContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// LoadContentResponder handles the response to the LoadContent request. The method always -// closes the http.Response Body. -func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// PurgeContent removes a content from CDN. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. contentFilePaths is the path to the content to be -// purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a -// single file, or a directory with a wildcard, e.g. '/pictures/*' which -// removes all folders and files in the directory. -func (client EndpointsClient) PurgeContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: contentFilePaths, - Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "PurgeContent") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PurgeContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", nil, "Failure preparing request") - return - } - - resp, err := client.PurgeContentSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure sending request") - return - } - - result, err = client.PurgeContentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PurgeContentPreparer prepares the PurgeContent request. -func (client EndpointsClient) PurgeContentPreparer(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge", pathParameters), - autorest.WithJSON(contentFilePaths), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PurgeContentSender sends the PurgeContent request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) PurgeContentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PurgeContentResponder handles the response to the PurgeContent request. The method always -// closes the http.Response Body. -func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start starts an existing CDN endpoint that is on a stopped state. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { - resultChan := make(chan Endpoint, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Start") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Endpoint - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StartPreparer(resourceGroupName, profileName, endpointName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StartPreparer prepares the Start request. -func (client EndpointsClient) StartPreparer(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client EndpointsClient) StartResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Stop stops an existing running CDN endpoint. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { - resultChan := make(chan Endpoint, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Stop") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Endpoint - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StopPreparer(resourceGroupName, profileName, endpointName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StopPreparer prepares the Stop request. -func (client EndpointsClient) StopPreparer(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client EndpointsClient) StopResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing CDN endpoint with the specified endpoint name -// under the specified subscription, resource group and profile. Only tags and -// Origin HostHeader can be updated after creating an endpoint. To update -// origins, use the Update Origin operation. To update custom domains, use the -// Update Custom Domain operation. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. endpointUpdateProperties is endpoint update -// properties -func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { - resultChan := make(chan Endpoint, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Update") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Endpoint - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, endpointUpdateProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), - autorest.WithJSON(endpointUpdateProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateCustomDomain validates the custom domain mapping to ensure it maps -// to the correct CDN endpoint in DNS. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. customDomainProperties is custom domain to be -// validated. -func (client EndpointsClient) ValidateCustomDomain(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: customDomainProperties, - Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ValidateCustomDomain") - } - - req, err := client.ValidateCustomDomainPreparer(resourceGroupName, profileName, endpointName, customDomainProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateCustomDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure sending request") - return - } - - result, err = client.ValidateCustomDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure responding to request") - } - - return -} - -// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. -func (client EndpointsClient) ValidateCustomDomainPreparer(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain", pathParameters), - autorest.WithJSON(customDomainProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always -// closes the http.Response Body. -func (client EndpointsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// EndpointsClient is the use these APIs to manage Azure CDN resources through +// the Azure Resource Manager. You must make sure that requests made to these +// resources are secure. +type EndpointsClient struct { + ManagementClient +} + +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient +// client. +func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new CDN endpoint with the specified endpoint name under the +// specified subscription, resource group and profile. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. endpoint is endpoint properties +func (client EndpointsClient) Create(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { + resultChan := make(chan Endpoint, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: endpoint, + Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Endpoint + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, endpoint, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client EndpointsClient) CreatePreparer(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpoint), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client EndpointsClient) CreateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing CDN endpoint with the specified endpoint name +// under the specified subscription, resource group and profile. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an existing CDN endpoint with the specified endpoint name under the +// specified subscription, resource group and profile. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointName string) (result Endpoint, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfile lists existing CDN endpoints. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. +func (client EndpointsClient) ListByProfile(resourceGroupName string, profileName string) (result EndpointListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ListByProfile") + } + + req, err := client.ListByProfilePreparer(resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending request") + return + } + + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure responding to request") + } + + return +} + +// ListByProfilePreparer prepares the ListByProfile request. +func (client EndpointsClient) ListByProfilePreparer(resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByProfileSender sends the ListByProfile request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ListByProfileSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByProfileResponder handles the response to the ListByProfile request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ListByProfileResponder(resp *http.Response) (result EndpointListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByProfileNextResults retrieves the next set of results, if any. +func (client EndpointsClient) ListByProfileNextResults(lastResults EndpointListResult) (result EndpointListResult, err error) { + req, err := lastResults.EndpointListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending next results request") + } + + result, err = client.ListByProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure responding to next results request") + } + + return +} + +// ListResourceUsage checks the quota and usage of geo filters and custom +// domains under the given endpoint. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client EndpointsClient) ListResourceUsage(resourceGroupName string, profileName string, endpointName string) (result ResourceUsageListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ListResourceUsage") + } + + req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to request") + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client EndpointsClient) ListResourceUsagePreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListResourceUsageNextResults retrieves the next set of results, if any. +func (client EndpointsClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.ResourceUsageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending next results request") + } + + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure responding to next results request") + } + + return +} + +// LoadContent pre-loads a content to CDN. Available for Verizon Profiles. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. contentFilePaths is the path to the content to be +// loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a +// single file +func (client EndpointsClient) LoadContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "LoadContent") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.LoadContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", nil, "Failure preparing request") + return + } + + resp, err := client.LoadContentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure sending request") + return + } + + result, err = client.LoadContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// LoadContentPreparer prepares the LoadContent request. +func (client EndpointsClient) LoadContentPreparer(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// LoadContentSender sends the LoadContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) LoadContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// LoadContentResponder handles the response to the LoadContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// PurgeContent removes a content from CDN. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. contentFilePaths is the path to the content to be +// purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a +// single file, or a directory with a wildcard, e.g. '/pictures/*' which +// removes all folders and files in the directory. +func (client EndpointsClient) PurgeContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: contentFilePaths, + Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "PurgeContent") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PurgeContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeContentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure sending request") + return + } + + result, err = client.PurgeContentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PurgeContentPreparer prepares the PurgeContent request. +func (client EndpointsClient) PurgeContentPreparer(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge", pathParameters), + autorest.WithJSON(contentFilePaths), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PurgeContentSender sends the PurgeContent request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) PurgeContentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PurgeContentResponder handles the response to the PurgeContent request. The method always +// closes the http.Response Body. +func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts an existing CDN endpoint that is on a stopped state. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { + resultChan := make(chan Endpoint, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Start") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Endpoint + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, profileName, endpointName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client EndpointsClient) StartPreparer(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client EndpointsClient) StartResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops an existing running CDN endpoint. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { + resultChan := make(chan Endpoint, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Stop") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Endpoint + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StopPreparer(resourceGroupName, profileName, endpointName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StopPreparer prepares the Stop request. +func (client EndpointsClient) StopPreparer(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client EndpointsClient) StopResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing CDN endpoint with the specified endpoint name +// under the specified subscription, resource group and profile. Only tags and +// Origin HostHeader can be updated after creating an endpoint. To update +// origins, use the Update Origin operation. To update custom domains, use the +// Update Custom Domain operation. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. endpointUpdateProperties is endpoint update +// properties +func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) { + resultChan := make(chan Endpoint, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Update") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Endpoint + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, endpointUpdateProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpointUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateCustomDomain validates the custom domain mapping to ensure it maps +// to the correct CDN endpoint in DNS. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. customDomainProperties is custom domain to be +// validated. +func (client EndpointsClient) ValidateCustomDomain(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (result ValidateCustomDomainOutput, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: customDomainProperties, + Constraints: []validation.Constraint{{Target: "customDomainProperties.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "ValidateCustomDomain") + } + + req, err := client.ValidateCustomDomainPreparer(resourceGroupName, profileName, endpointName, customDomainProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateCustomDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateCustomDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure responding to request") + } + + return +} + +// ValidateCustomDomainPreparer prepares the ValidateCustomDomain request. +func (client EndpointsClient) ValidateCustomDomainPreparer(resourceGroupName string, profileName string, endpointName string, customDomainProperties ValidateCustomDomainInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain", pathParameters), + autorest.WithJSON(customDomainProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateCustomDomainSender sends the ValidateCustomDomain request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) ValidateCustomDomainSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateCustomDomainResponder handles the response to the ValidateCustomDomain request. The method always +// closes the http.Response Body. +func (client EndpointsClient) ValidateCustomDomainResponder(resp *http.Response) (result ValidateCustomDomainOutput, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go index 01910eb523..f291f8c52c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go @@ -1,597 +1,597 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// CustomDomainResourceState enumerates the values for custom domain resource -// state. -type CustomDomainResourceState string - -const ( - // Active specifies the active state for custom domain resource state. - Active CustomDomainResourceState = "Active" - // Creating specifies the creating state for custom domain resource state. - Creating CustomDomainResourceState = "Creating" - // Deleting specifies the deleting state for custom domain resource state. - Deleting CustomDomainResourceState = "Deleting" -) - -// CustomHTTPSProvisioningState enumerates the values for custom https -// provisioning state. -type CustomHTTPSProvisioningState string - -const ( - // Disabled specifies the disabled state for custom https provisioning - // state. - Disabled CustomHTTPSProvisioningState = "Disabled" - // Disabling specifies the disabling state for custom https provisioning - // state. - Disabling CustomHTTPSProvisioningState = "Disabling" - // Enabled specifies the enabled state for custom https provisioning state. - Enabled CustomHTTPSProvisioningState = "Enabled" - // Enabling specifies the enabling state for custom https provisioning - // state. - Enabling CustomHTTPSProvisioningState = "Enabling" - // Failed specifies the failed state for custom https provisioning state. - Failed CustomHTTPSProvisioningState = "Failed" -) - -// EndpointResourceState enumerates the values for endpoint resource state. -type EndpointResourceState string - -const ( - // EndpointResourceStateCreating specifies the endpoint resource state - // creating state for endpoint resource state. - EndpointResourceStateCreating EndpointResourceState = "Creating" - // EndpointResourceStateDeleting specifies the endpoint resource state - // deleting state for endpoint resource state. - EndpointResourceStateDeleting EndpointResourceState = "Deleting" - // EndpointResourceStateRunning specifies the endpoint resource state - // running state for endpoint resource state. - EndpointResourceStateRunning EndpointResourceState = "Running" - // EndpointResourceStateStarting specifies the endpoint resource state - // starting state for endpoint resource state. - EndpointResourceStateStarting EndpointResourceState = "Starting" - // EndpointResourceStateStopped specifies the endpoint resource state - // stopped state for endpoint resource state. - EndpointResourceStateStopped EndpointResourceState = "Stopped" - // EndpointResourceStateStopping specifies the endpoint resource state - // stopping state for endpoint resource state. - EndpointResourceStateStopping EndpointResourceState = "Stopping" -) - -// GeoFilterActions enumerates the values for geo filter actions. -type GeoFilterActions string - -const ( - // Allow specifies the allow state for geo filter actions. - Allow GeoFilterActions = "Allow" - // Block specifies the block state for geo filter actions. - Block GeoFilterActions = "Block" -) - -// OriginResourceState enumerates the values for origin resource state. -type OriginResourceState string - -const ( - // OriginResourceStateActive specifies the origin resource state active - // state for origin resource state. - OriginResourceStateActive OriginResourceState = "Active" - // OriginResourceStateCreating specifies the origin resource state creating - // state for origin resource state. - OriginResourceStateCreating OriginResourceState = "Creating" - // OriginResourceStateDeleting specifies the origin resource state deleting - // state for origin resource state. - OriginResourceStateDeleting OriginResourceState = "Deleting" -) - -// ProfileResourceState enumerates the values for profile resource state. -type ProfileResourceState string - -const ( - // ProfileResourceStateActive specifies the profile resource state active - // state for profile resource state. - ProfileResourceStateActive ProfileResourceState = "Active" - // ProfileResourceStateCreating specifies the profile resource state - // creating state for profile resource state. - ProfileResourceStateCreating ProfileResourceState = "Creating" - // ProfileResourceStateDeleting specifies the profile resource state - // deleting state for profile resource state. - ProfileResourceStateDeleting ProfileResourceState = "Deleting" - // ProfileResourceStateDisabled specifies the profile resource state - // disabled state for profile resource state. - ProfileResourceStateDisabled ProfileResourceState = "Disabled" -) - -// QueryStringCachingBehavior enumerates the values for query string caching -// behavior. -type QueryStringCachingBehavior string - -const ( - // BypassCaching specifies the bypass caching state for query string - // caching behavior. - BypassCaching QueryStringCachingBehavior = "BypassCaching" - // IgnoreQueryString specifies the ignore query string state for query - // string caching behavior. - IgnoreQueryString QueryStringCachingBehavior = "IgnoreQueryString" - // NotSet specifies the not set state for query string caching behavior. - NotSet QueryStringCachingBehavior = "NotSet" - // UseQueryString specifies the use query string state for query string - // caching behavior. - UseQueryString QueryStringCachingBehavior = "UseQueryString" -) - -// ResourceType enumerates the values for resource type. -type ResourceType string - -const ( - // MicrosoftCdnProfilesEndpoints specifies the microsoft cdn profiles - // endpoints state for resource type. - MicrosoftCdnProfilesEndpoints ResourceType = "Microsoft.Cdn/Profiles/Endpoints" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // CustomVerizon specifies the custom verizon state for sku name. - CustomVerizon SkuName = "Custom_Verizon" - // PremiumVerizon specifies the premium verizon state for sku name. - PremiumVerizon SkuName = "Premium_Verizon" - // StandardAkamai specifies the standard akamai state for sku name. - StandardAkamai SkuName = "Standard_Akamai" - // StandardChinaCdn specifies the standard china cdn state for sku name. - StandardChinaCdn SkuName = "Standard_ChinaCdn" - // StandardVerizon specifies the standard verizon state for sku name. - StandardVerizon SkuName = "Standard_Verizon" -) - -// CheckNameAvailabilityInput is input of CheckNameAvailability API. -type CheckNameAvailabilityInput struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityOutput is output of check name availability API. -type CheckNameAvailabilityOutput struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CidrIPAddress is cIDR Ip address -type CidrIPAddress struct { - BaseIPAddress *string `json:"baseIpAddress,omitempty"` - PrefixLength *int32 `json:"prefixLength,omitempty"` -} - -// CustomDomain is customer provided domain for branding purposes, e.g. -// www.consoto.com. -type CustomDomain struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CustomDomainProperties `json:"properties,omitempty"` -} - -// CustomDomainListResult is result of the request to list custom domains. It -// contains a list of custom domain objects and a URL link to get the next set -// of results. -type CustomDomainListResult struct { - autorest.Response `json:"-"` - Value *[]CustomDomain `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CustomDomainListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CustomDomainListResult) CustomDomainListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CustomDomainParameters is the customDomain JSON object required for custom -// domain creation or update. -type CustomDomainParameters struct { - *CustomDomainPropertiesParameters `json:"properties,omitempty"` -} - -// CustomDomainProperties is the JSON object that contains the properties of -// the custom domain to create. -type CustomDomainProperties struct { - HostName *string `json:"hostName,omitempty"` - ResourceState CustomDomainResourceState `json:"resourceState,omitempty"` - CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` - ValidationData *string `json:"validationData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// CustomDomainPropertiesParameters is the JSON object that contains the -// properties of the custom domain to create. -type CustomDomainPropertiesParameters struct { - HostName *string `json:"hostName,omitempty"` -} - -// DeepCreatedOrigin is origin to be added when creating a CDN endpoint. -type DeepCreatedOrigin struct { - Name *string `json:"name,omitempty"` - *DeepCreatedOriginProperties `json:"properties,omitempty"` -} - -// DeepCreatedOriginProperties is properties of origin Properties of the origin -// created on the CDN endpoint. -type DeepCreatedOriginProperties struct { - HostName *string `json:"hostName,omitempty"` - HTTPPort *int32 `json:"httpPort,omitempty"` - HTTPSPort *int32 `json:"httpsPort,omitempty"` -} - -// EdgeNode is edge node of CDN service. -type EdgeNode struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *EdgeNodeProperties `json:"properties,omitempty"` -} - -// EdgeNodeProperties is the JSON object that contains the properties required -// to create an edgenode. -type EdgeNodeProperties struct { - IPAddressGroups *[]IPAddressGroup `json:"ipAddressGroups,omitempty"` -} - -// EdgenodeResult is result of the request to list CDN edgenodes. It contains a -// list of ip address group and a URL link to get the next set of results. -type EdgenodeResult struct { - autorest.Response `json:"-"` - Value *[]EdgeNode `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// EdgenodeResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client EdgenodeResult) EdgenodeResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Endpoint is cDN endpoint is the entity within a CDN profile containing -// configuration information such as origin, protocol, content caching and -// delivery behavior. The CDN endpoint uses the URL format -// .azureedge.net. -type Endpoint struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *EndpointProperties `json:"properties,omitempty"` -} - -// EndpointListResult is result of the request to list endpoints. It contains a -// list of endpoint objects and a URL link to get the the next set of results. -type EndpointListResult struct { - autorest.Response `json:"-"` - Value *[]Endpoint `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// EndpointListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client EndpointListResult) EndpointListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// EndpointProperties is the JSON object that contains the properties required -// to create an endpoint. -type EndpointProperties struct { - OriginHostHeader *string `json:"originHostHeader,omitempty"` - OriginPath *string `json:"originPath,omitempty"` - ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` - IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` - IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` - IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` - QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` - OptimizationType *string `json:"optimizationType,omitempty"` - GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` - HostName *string `json:"hostName,omitempty"` - Origins *[]DeepCreatedOrigin `json:"origins,omitempty"` - ResourceState EndpointResourceState `json:"resourceState,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// EndpointPropertiesUpdateParameters is result of the request to list -// endpoints. It contains a list of endpoints and a URL link to get the next -// set of results. -type EndpointPropertiesUpdateParameters struct { - OriginHostHeader *string `json:"originHostHeader,omitempty"` - OriginPath *string `json:"originPath,omitempty"` - ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` - IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` - IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` - IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` - QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` - OptimizationType *string `json:"optimizationType,omitempty"` - GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` -} - -// EndpointUpdateParameters is properties required to create a new endpoint. -type EndpointUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *EndpointPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// ErrorResponse is error reponse indicates CDN service is not able to process -// the incoming request. The reason is provided in the error message. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// GeoFilter is rules defining user geo access within a CDN endpoint. -type GeoFilter struct { - RelativePath *string `json:"relativePath,omitempty"` - Action GeoFilterActions `json:"action,omitempty"` - CountryCodes *[]string `json:"countryCodes,omitempty"` -} - -// IPAddressGroup is cDN Ip address group -type IPAddressGroup struct { - DeliveryRegion *string `json:"deliveryRegion,omitempty"` - Ipv4Addresses *[]CidrIPAddress `json:"ipv4Addresses,omitempty"` - Ipv6Addresses *[]CidrIPAddress `json:"ipv6Addresses,omitempty"` -} - -// LoadParameters is parameters required for content load. -type LoadParameters struct { - ContentPaths *[]string `json:"contentPaths,omitempty"` -} - -// Operation is cDN REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list CDN operations. It -// contains a list of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Origin is cDN origin is the source of the content being delivered via CDN. -// When the edge nodes represented by an endpoint do not have the requested -// content cached, they attempt to fetch it from one or more of the configured -// origins. -type Origin struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *OriginProperties `json:"properties,omitempty"` -} - -// OriginListResult is result of the request to list origins. It contains a -// list of origin objects and a URL link to get the next set of results. -type OriginListResult struct { - autorest.Response `json:"-"` - Value *[]Origin `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OriginListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OriginListResult) OriginListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OriginProperties is the JSON object that contains the properties of the -// origin to create. -type OriginProperties struct { - HostName *string `json:"hostName,omitempty"` - HTTPPort *int32 `json:"httpPort,omitempty"` - HTTPSPort *int32 `json:"httpsPort,omitempty"` - ResourceState OriginResourceState `json:"resourceState,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// OriginPropertiesParameters is the JSON object that contains the properties -// of the origin to create. -type OriginPropertiesParameters struct { - HostName *string `json:"hostName,omitempty"` - HTTPPort *int32 `json:"httpPort,omitempty"` - HTTPSPort *int32 `json:"httpsPort,omitempty"` -} - -// OriginUpdateParameters is origin properties needed for origin creation or -// update. -type OriginUpdateParameters struct { - *OriginPropertiesParameters `json:"properties,omitempty"` -} - -// Profile is cDN profile represents the top level resource and the entry point -// into the CDN API. This allows users to set up a logical grouping of -// endpoints in addition to creating shared configuration settings and -// selecting pricing tiers and providers. -type Profile struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *ProfileProperties `json:"properties,omitempty"` -} - -// ProfileListResult is result of the request to list profiles. It contains a -// list of profile objects and a URL link to get the the next set of results. -type ProfileListResult struct { - autorest.Response `json:"-"` - Value *[]Profile `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ProfileListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProfileListResult) ProfileListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProfileProperties is the JSON object that contains the properties required -// to create a profile. -type ProfileProperties struct { - ResourceState ProfileResourceState `json:"resourceState,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ProfileUpdateParameters is properties required to update a profile. -type ProfileUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` -} - -// PurgeParameters is parameters required for content purge. -type PurgeParameters struct { - ContentPaths *[]string `json:"contentPaths,omitempty"` -} - -// Resource is the Resource definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceUsage is output of check resource usage API. -type ResourceUsage struct { - ResourceType *string `json:"resourceType,omitempty"` - Unit *string `json:"unit,omitempty"` - CurrentValue *int32 `json:"currentValue,omitempty"` - Limit *int32 `json:"limit,omitempty"` -} - -// ResourceUsageListResult is output of check resource usage API. -type ResourceUsageListResult struct { - autorest.Response `json:"-"` - Value *[]ResourceUsage `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceUsageListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceUsageListResult) ResourceUsageListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Sku is the pricing tier (defines a CDN provider, feature list and rate) of -// the CDN profile. -type Sku struct { - Name SkuName `json:"name,omitempty"` -} - -// SsoURI is sSO URI required to login to the supplemental portal. -type SsoURI struct { - autorest.Response `json:"-"` - SsoURIValue *string `json:"ssoUriValue,omitempty"` -} - -// ValidateCustomDomainInput is input of the custom domain to be validated for -// DNS mapping. -type ValidateCustomDomainInput struct { - HostName *string `json:"hostName,omitempty"` -} - -// ValidateCustomDomainOutput is output of custom domain validation. -type ValidateCustomDomainOutput struct { - autorest.Response `json:"-"` - CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// CustomDomainResourceState enumerates the values for custom domain resource +// state. +type CustomDomainResourceState string + +const ( + // Active specifies the active state for custom domain resource state. + Active CustomDomainResourceState = "Active" + // Creating specifies the creating state for custom domain resource state. + Creating CustomDomainResourceState = "Creating" + // Deleting specifies the deleting state for custom domain resource state. + Deleting CustomDomainResourceState = "Deleting" +) + +// CustomHTTPSProvisioningState enumerates the values for custom https +// provisioning state. +type CustomHTTPSProvisioningState string + +const ( + // Disabled specifies the disabled state for custom https provisioning + // state. + Disabled CustomHTTPSProvisioningState = "Disabled" + // Disabling specifies the disabling state for custom https provisioning + // state. + Disabling CustomHTTPSProvisioningState = "Disabling" + // Enabled specifies the enabled state for custom https provisioning state. + Enabled CustomHTTPSProvisioningState = "Enabled" + // Enabling specifies the enabling state for custom https provisioning + // state. + Enabling CustomHTTPSProvisioningState = "Enabling" + // Failed specifies the failed state for custom https provisioning state. + Failed CustomHTTPSProvisioningState = "Failed" +) + +// EndpointResourceState enumerates the values for endpoint resource state. +type EndpointResourceState string + +const ( + // EndpointResourceStateCreating specifies the endpoint resource state + // creating state for endpoint resource state. + EndpointResourceStateCreating EndpointResourceState = "Creating" + // EndpointResourceStateDeleting specifies the endpoint resource state + // deleting state for endpoint resource state. + EndpointResourceStateDeleting EndpointResourceState = "Deleting" + // EndpointResourceStateRunning specifies the endpoint resource state + // running state for endpoint resource state. + EndpointResourceStateRunning EndpointResourceState = "Running" + // EndpointResourceStateStarting specifies the endpoint resource state + // starting state for endpoint resource state. + EndpointResourceStateStarting EndpointResourceState = "Starting" + // EndpointResourceStateStopped specifies the endpoint resource state + // stopped state for endpoint resource state. + EndpointResourceStateStopped EndpointResourceState = "Stopped" + // EndpointResourceStateStopping specifies the endpoint resource state + // stopping state for endpoint resource state. + EndpointResourceStateStopping EndpointResourceState = "Stopping" +) + +// GeoFilterActions enumerates the values for geo filter actions. +type GeoFilterActions string + +const ( + // Allow specifies the allow state for geo filter actions. + Allow GeoFilterActions = "Allow" + // Block specifies the block state for geo filter actions. + Block GeoFilterActions = "Block" +) + +// OriginResourceState enumerates the values for origin resource state. +type OriginResourceState string + +const ( + // OriginResourceStateActive specifies the origin resource state active + // state for origin resource state. + OriginResourceStateActive OriginResourceState = "Active" + // OriginResourceStateCreating specifies the origin resource state creating + // state for origin resource state. + OriginResourceStateCreating OriginResourceState = "Creating" + // OriginResourceStateDeleting specifies the origin resource state deleting + // state for origin resource state. + OriginResourceStateDeleting OriginResourceState = "Deleting" +) + +// ProfileResourceState enumerates the values for profile resource state. +type ProfileResourceState string + +const ( + // ProfileResourceStateActive specifies the profile resource state active + // state for profile resource state. + ProfileResourceStateActive ProfileResourceState = "Active" + // ProfileResourceStateCreating specifies the profile resource state + // creating state for profile resource state. + ProfileResourceStateCreating ProfileResourceState = "Creating" + // ProfileResourceStateDeleting specifies the profile resource state + // deleting state for profile resource state. + ProfileResourceStateDeleting ProfileResourceState = "Deleting" + // ProfileResourceStateDisabled specifies the profile resource state + // disabled state for profile resource state. + ProfileResourceStateDisabled ProfileResourceState = "Disabled" +) + +// QueryStringCachingBehavior enumerates the values for query string caching +// behavior. +type QueryStringCachingBehavior string + +const ( + // BypassCaching specifies the bypass caching state for query string + // caching behavior. + BypassCaching QueryStringCachingBehavior = "BypassCaching" + // IgnoreQueryString specifies the ignore query string state for query + // string caching behavior. + IgnoreQueryString QueryStringCachingBehavior = "IgnoreQueryString" + // NotSet specifies the not set state for query string caching behavior. + NotSet QueryStringCachingBehavior = "NotSet" + // UseQueryString specifies the use query string state for query string + // caching behavior. + UseQueryString QueryStringCachingBehavior = "UseQueryString" +) + +// ResourceType enumerates the values for resource type. +type ResourceType string + +const ( + // MicrosoftCdnProfilesEndpoints specifies the microsoft cdn profiles + // endpoints state for resource type. + MicrosoftCdnProfilesEndpoints ResourceType = "Microsoft.Cdn/Profiles/Endpoints" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // CustomVerizon specifies the custom verizon state for sku name. + CustomVerizon SkuName = "Custom_Verizon" + // PremiumVerizon specifies the premium verizon state for sku name. + PremiumVerizon SkuName = "Premium_Verizon" + // StandardAkamai specifies the standard akamai state for sku name. + StandardAkamai SkuName = "Standard_Akamai" + // StandardChinaCdn specifies the standard china cdn state for sku name. + StandardChinaCdn SkuName = "Standard_ChinaCdn" + // StandardVerizon specifies the standard verizon state for sku name. + StandardVerizon SkuName = "Standard_Verizon" +) + +// CheckNameAvailabilityInput is input of CheckNameAvailability API. +type CheckNameAvailabilityInput struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityOutput is output of check name availability API. +type CheckNameAvailabilityOutput struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CidrIPAddress is cIDR Ip address +type CidrIPAddress struct { + BaseIPAddress *string `json:"baseIpAddress,omitempty"` + PrefixLength *int32 `json:"prefixLength,omitempty"` +} + +// CustomDomain is customer provided domain for branding purposes, e.g. +// www.consoto.com. +type CustomDomain struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CustomDomainProperties `json:"properties,omitempty"` +} + +// CustomDomainListResult is result of the request to list custom domains. It +// contains a list of custom domain objects and a URL link to get the next set +// of results. +type CustomDomainListResult struct { + autorest.Response `json:"-"` + Value *[]CustomDomain `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomDomainListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CustomDomainListResult) CustomDomainListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CustomDomainParameters is the customDomain JSON object required for custom +// domain creation or update. +type CustomDomainParameters struct { + *CustomDomainPropertiesParameters `json:"properties,omitempty"` +} + +// CustomDomainProperties is the JSON object that contains the properties of +// the custom domain to create. +type CustomDomainProperties struct { + HostName *string `json:"hostName,omitempty"` + ResourceState CustomDomainResourceState `json:"resourceState,omitempty"` + CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"` + ValidationData *string `json:"validationData,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// CustomDomainPropertiesParameters is the JSON object that contains the +// properties of the custom domain to create. +type CustomDomainPropertiesParameters struct { + HostName *string `json:"hostName,omitempty"` +} + +// DeepCreatedOrigin is origin to be added when creating a CDN endpoint. +type DeepCreatedOrigin struct { + Name *string `json:"name,omitempty"` + *DeepCreatedOriginProperties `json:"properties,omitempty"` +} + +// DeepCreatedOriginProperties is properties of origin Properties of the origin +// created on the CDN endpoint. +type DeepCreatedOriginProperties struct { + HostName *string `json:"hostName,omitempty"` + HTTPPort *int32 `json:"httpPort,omitempty"` + HTTPSPort *int32 `json:"httpsPort,omitempty"` +} + +// EdgeNode is edge node of CDN service. +type EdgeNode struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *EdgeNodeProperties `json:"properties,omitempty"` +} + +// EdgeNodeProperties is the JSON object that contains the properties required +// to create an edgenode. +type EdgeNodeProperties struct { + IPAddressGroups *[]IPAddressGroup `json:"ipAddressGroups,omitempty"` +} + +// EdgenodeResult is result of the request to list CDN edgenodes. It contains a +// list of ip address group and a URL link to get the next set of results. +type EdgenodeResult struct { + autorest.Response `json:"-"` + Value *[]EdgeNode `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// EdgenodeResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client EdgenodeResult) EdgenodeResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Endpoint is cDN endpoint is the entity within a CDN profile containing +// configuration information such as origin, protocol, content caching and +// delivery behavior. The CDN endpoint uses the URL format +// .azureedge.net. +type Endpoint struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *EndpointProperties `json:"properties,omitempty"` +} + +// EndpointListResult is result of the request to list endpoints. It contains a +// list of endpoint objects and a URL link to get the the next set of results. +type EndpointListResult struct { + autorest.Response `json:"-"` + Value *[]Endpoint `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// EndpointListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client EndpointListResult) EndpointListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// EndpointProperties is the JSON object that contains the properties required +// to create an endpoint. +type EndpointProperties struct { + OriginHostHeader *string `json:"originHostHeader,omitempty"` + OriginPath *string `json:"originPath,omitempty"` + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + OptimizationType *string `json:"optimizationType,omitempty"` + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` + HostName *string `json:"hostName,omitempty"` + Origins *[]DeepCreatedOrigin `json:"origins,omitempty"` + ResourceState EndpointResourceState `json:"resourceState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// EndpointPropertiesUpdateParameters is result of the request to list +// endpoints. It contains a list of endpoints and a URL link to get the next +// set of results. +type EndpointPropertiesUpdateParameters struct { + OriginHostHeader *string `json:"originHostHeader,omitempty"` + OriginPath *string `json:"originPath,omitempty"` + ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"` + IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"` + IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"` + IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"` + QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"` + OptimizationType *string `json:"optimizationType,omitempty"` + GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"` +} + +// EndpointUpdateParameters is properties required to create a new endpoint. +type EndpointUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + *EndpointPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// ErrorResponse is error reponse indicates CDN service is not able to process +// the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// GeoFilter is rules defining user geo access within a CDN endpoint. +type GeoFilter struct { + RelativePath *string `json:"relativePath,omitempty"` + Action GeoFilterActions `json:"action,omitempty"` + CountryCodes *[]string `json:"countryCodes,omitempty"` +} + +// IPAddressGroup is cDN Ip address group +type IPAddressGroup struct { + DeliveryRegion *string `json:"deliveryRegion,omitempty"` + Ipv4Addresses *[]CidrIPAddress `json:"ipv4Addresses,omitempty"` + Ipv6Addresses *[]CidrIPAddress `json:"ipv6Addresses,omitempty"` +} + +// LoadParameters is parameters required for content load. +type LoadParameters struct { + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// Operation is cDN REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list CDN operations. It +// contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Origin is cDN origin is the source of the content being delivered via CDN. +// When the edge nodes represented by an endpoint do not have the requested +// content cached, they attempt to fetch it from one or more of the configured +// origins. +type Origin struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *OriginProperties `json:"properties,omitempty"` +} + +// OriginListResult is result of the request to list origins. It contains a +// list of origin objects and a URL link to get the next set of results. +type OriginListResult struct { + autorest.Response `json:"-"` + Value *[]Origin `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OriginListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OriginListResult) OriginListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OriginProperties is the JSON object that contains the properties of the +// origin to create. +type OriginProperties struct { + HostName *string `json:"hostName,omitempty"` + HTTPPort *int32 `json:"httpPort,omitempty"` + HTTPSPort *int32 `json:"httpsPort,omitempty"` + ResourceState OriginResourceState `json:"resourceState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// OriginPropertiesParameters is the JSON object that contains the properties +// of the origin to create. +type OriginPropertiesParameters struct { + HostName *string `json:"hostName,omitempty"` + HTTPPort *int32 `json:"httpPort,omitempty"` + HTTPSPort *int32 `json:"httpsPort,omitempty"` +} + +// OriginUpdateParameters is origin properties needed for origin creation or +// update. +type OriginUpdateParameters struct { + *OriginPropertiesParameters `json:"properties,omitempty"` +} + +// Profile is cDN profile represents the top level resource and the entry point +// into the CDN API. This allows users to set up a logical grouping of +// endpoints in addition to creating shared configuration settings and +// selecting pricing tiers and providers. +type Profile struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *ProfileProperties `json:"properties,omitempty"` +} + +// ProfileListResult is result of the request to list profiles. It contains a +// list of profile objects and a URL link to get the the next set of results. +type ProfileListResult struct { + autorest.Response `json:"-"` + Value *[]Profile `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProfileListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProfileListResult) ProfileListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProfileProperties is the JSON object that contains the properties required +// to create a profile. +type ProfileProperties struct { + ResourceState ProfileResourceState `json:"resourceState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ProfileUpdateParameters is properties required to update a profile. +type ProfileUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` +} + +// PurgeParameters is parameters required for content purge. +type PurgeParameters struct { + ContentPaths *[]string `json:"contentPaths,omitempty"` +} + +// Resource is the Resource definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceUsage is output of check resource usage API. +type ResourceUsage struct { + ResourceType *string `json:"resourceType,omitempty"` + Unit *string `json:"unit,omitempty"` + CurrentValue *int32 `json:"currentValue,omitempty"` + Limit *int32 `json:"limit,omitempty"` +} + +// ResourceUsageListResult is output of check resource usage API. +type ResourceUsageListResult struct { + autorest.Response `json:"-"` + Value *[]ResourceUsage `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceUsageListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceUsageListResult) ResourceUsageListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Sku is the pricing tier (defines a CDN provider, feature list and rate) of +// the CDN profile. +type Sku struct { + Name SkuName `json:"name,omitempty"` +} + +// SsoURI is sSO URI required to login to the supplemental portal. +type SsoURI struct { + autorest.Response `json:"-"` + SsoURIValue *string `json:"ssoUriValue,omitempty"` +} + +// ValidateCustomDomainInput is input of the custom domain to be validated for +// DNS mapping. +type ValidateCustomDomainInput struct { + HostName *string `json:"hostName,omitempty"` +} + +// ValidateCustomDomainOutput is output of custom domain validation. +type ValidateCustomDomainOutput struct { + autorest.Response `json:"-"` + CustomDomainValidated *bool `json:"customDomainValidated,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go index 6bc9f7a56d..f9fa1ff5c0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go @@ -1,323 +1,323 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// OriginsClient is the use these APIs to manage Azure CDN resources through -// the Azure Resource Manager. You must make sure that requests made to these -// resources are secure. -type OriginsClient struct { - ManagementClient -} - -// NewOriginsClient creates an instance of the OriginsClient client. -func NewOriginsClient(subscriptionID string) OriginsClient { - return NewOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOriginsClientWithBaseURI creates an instance of the OriginsClient client. -func NewOriginsClientWithBaseURI(baseURI string, subscriptionID string) OriginsClient { - return OriginsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an existing origin within an endpoint. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. originName is name of the origin which is unique -// within the endpoint. -func (client OriginsClient) Get(resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, profileName, endpointName, originName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client OriginsClient) GetPreparer(resourceGroupName string, profileName string, endpointName string, originName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "originName": autorest.Encode("path", originName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OriginsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OriginsClient) GetResponder(resp *http.Response) (result Origin, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByEndpoint lists all of the existing origins within an endpoint. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. -func (client OriginsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result OriginListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "ListByEndpoint") - } - - req, err := client.ListByEndpointPreparer(resourceGroupName, profileName, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing request") - return - } - - resp, err := client.ListByEndpointSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending request") - return - } - - result, err = client.ListByEndpointResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure responding to request") - } - - return -} - -// ListByEndpointPreparer prepares the ListByEndpoint request. -func (client OriginsClient) ListByEndpointPreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByEndpointSender sends the ListByEndpoint request. The method will close the -// http.Response Body if it receives an error. -func (client OriginsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always -// closes the http.Response Body. -func (client OriginsClient) ListByEndpointResponder(resp *http.Response) (result OriginListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByEndpointNextResults retrieves the next set of results, if any. -func (client OriginsClient) ListByEndpointNextResults(lastResults OriginListResult) (result OriginListResult, err error) { - req, err := lastResults.OriginListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByEndpointSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending next results request") - } - - result, err = client.ListByEndpointResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure responding to next results request") - } - - return -} - -// Update updates an existing origin within an endpoint. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. endpointName is name of the endpoint under the profile -// which is unique globally. originName is name of the origin which is unique -// within the endpoint. originUpdateProperties is origin properties -func (client OriginsClient) Update(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (<-chan Origin, <-chan error) { - resultChan := make(chan Origin, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "Update") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Origin - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, originName, originUpdateProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client OriginsClient) UpdatePreparer(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "originName": autorest.Encode("path", originName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), - autorest.WithJSON(originUpdateProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client OriginsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client OriginsClient) UpdateResponder(resp *http.Response) (result Origin, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// OriginsClient is the use these APIs to manage Azure CDN resources through +// the Azure Resource Manager. You must make sure that requests made to these +// resources are secure. +type OriginsClient struct { + ManagementClient +} + +// NewOriginsClient creates an instance of the OriginsClient client. +func NewOriginsClient(subscriptionID string) OriginsClient { + return NewOriginsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOriginsClientWithBaseURI creates an instance of the OriginsClient client. +func NewOriginsClientWithBaseURI(baseURI string, subscriptionID string) OriginsClient { + return OriginsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an existing origin within an endpoint. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. originName is name of the origin which is unique +// within the endpoint. +func (client OriginsClient) Get(resourceGroupName string, profileName string, endpointName string, originName string) (result Origin, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, profileName, endpointName, originName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client OriginsClient) GetPreparer(resourceGroupName string, profileName string, endpointName string, originName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OriginsClient) GetResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpoint lists all of the existing origins within an endpoint. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. +func (client OriginsClient) ListByEndpoint(resourceGroupName string, profileName string, endpointName string) (result OriginListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "ListByEndpoint") + } + + req, err := client.ListByEndpointPreparer(resourceGroupName, profileName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending request") + return + } + + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure responding to request") + } + + return +} + +// ListByEndpointPreparer prepares the ListByEndpoint request. +func (client OriginsClient) ListByEndpointPreparer(resourceGroupName string, profileName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByEndpointSender sends the ListByEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) ListByEndpointSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByEndpointResponder handles the response to the ListByEndpoint request. The method always +// closes the http.Response Body. +func (client OriginsClient) ListByEndpointResponder(resp *http.Response) (result OriginListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByEndpointNextResults retrieves the next set of results, if any. +func (client OriginsClient) ListByEndpointNextResults(lastResults OriginListResult) (result OriginListResult, err error) { + req, err := lastResults.OriginListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending next results request") + } + + result, err = client.ListByEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure responding to next results request") + } + + return +} + +// Update updates an existing origin within an endpoint. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. endpointName is name of the endpoint under the profile +// which is unique globally. originName is name of the origin which is unique +// within the endpoint. originUpdateProperties is origin properties +func (client OriginsClient) Update(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (<-chan Origin, <-chan error) { + resultChan := make(chan Origin, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "Update") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Origin + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, originName, originUpdateProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client OriginsClient) UpdatePreparer(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "originName": autorest.Encode("path", originName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}", pathParameters), + autorest.WithJSON(originUpdateProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OriginsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OriginsClient) UpdateResponder(resp *http.Response) (result Origin, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go index 5afb38bc7b..c166a1b730 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go @@ -1,774 +1,774 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProfilesClient is the use these APIs to manage Azure CDN resources through -// the Azure Resource Manager. You must make sure that requests made to these -// resources are secure. -type ProfilesClient struct { - ManagementClient -} - -// NewProfilesClient creates an instance of the ProfilesClient client. -func NewProfilesClient(subscriptionID string) ProfilesClient { - return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient -// client. -func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { - return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new CDN profile with a profile name under the specified -// subscription and resource group. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. profile is profile properties needed to create a new -// profile. -func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (<-chan Profile, <-chan error) { - resultChan := make(chan Profile, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: profile, - Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Profile - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, profileName, profile, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client ProfilesClient) CreatePreparer(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), - autorest.WithJSON(profile), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ProfilesClient) CreateResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing CDN profile with the specified parameters. -// Deleting a profile will result in the deletion of all of the sub-resources -// including endpoints, origins and custom domains. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. -func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, profileName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateSsoURI generates a dynamic SSO URI used to sign in to the CDN -// supplemental portal. Supplemnetal portal is used to configure advanced -// feature capabilities that are not yet available in the Azure portal, such as -// core reports in a standard profile; rules engine, advanced HTTP reports, and -// real-time stats and alerts in a premium profile. The SSO URI changes -// approximately every 10 minutes. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. -func (client ProfilesClient) GenerateSsoURI(resourceGroupName string, profileName string) (result SsoURI, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "GenerateSsoURI") - } - - req, err := client.GenerateSsoURIPreparer(resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSsoURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateSsoURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure responding to request") - } - - return -} - -// GenerateSsoURIPreparer prepares the GenerateSsoURI request. -func (client ProfilesClient) GenerateSsoURIPreparer(resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateSsoURISender sends the GenerateSsoURI request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) GenerateSsoURISender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateSsoURIResponder handles the response to the GenerateSsoURI request. The method always -// closes the http.Response Body. -func (client ProfilesClient) GenerateSsoURIResponder(resp *http.Response) (result SsoURI, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a CDN profile with the specified profile name under the specified -// subscription and resource group. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. -func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the CDN profiles within an Azure subscription. -func (client ProfilesClient) List() (result ProfileListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProfilesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProfilesClient) ListResponder(resp *http.Response) (result ProfileListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ProfilesClient) ListNextResults(lastResults ProfileListResult) (result ProfileListResult, err error) { - req, err := lastResults.ProfileListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists all of the CDN profiles within a resource group. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. -func (client ProfilesClient) ListByResourceGroup(resourceGroupName string) (result ProfileListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ProfilesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ProfilesClient) ListByResourceGroupNextResults(lastResults ProfileListResult) (result ProfileListResult, err error) { - req, err := lastResults.ProfileListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListResourceUsage checks the quota and actual usage of endpoints under the -// given CDN profile. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. -func (client ProfilesClient) ListResourceUsage(resourceGroupName string, profileName string) (result ResourceUsageListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "ListResourceUsage") - } - - req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ListResourceUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request") - return - } - - result, err = client.ListResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to request") - } - - return -} - -// ListResourceUsagePreparer prepares the ListResourceUsage request. -func (client ProfilesClient) ListResourceUsagePreparer(resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListResourceUsageSender sends the ListResourceUsage request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always -// closes the http.Response Body. -func (client ProfilesClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListResourceUsageNextResults retrieves the next set of results, if any. -func (client ProfilesClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { - req, err := lastResults.ResourceUsageListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListResourceUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending next results request") - } - - result, err = client.ListResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to next results request") - } - - return -} - -// Update updates an existing CDN profile with the specified profile name under -// the specified subscription and resource group. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. profileName is name of the CDN profile which is unique within -// the resource group. profileUpdateParameters is profile properties needed to -// update an existing profile. -func (client ProfilesClient) Update(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (<-chan Profile, <-chan error) { - resultChan := make(chan Profile, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Update") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Profile - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, profileName, profileUpdateParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-10-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), - autorest.WithJSON(profileUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProfilesClient is the use these APIs to manage Azure CDN resources through +// the Azure Resource Manager. You must make sure that requests made to these +// resources are secure. +type ProfilesClient struct { + ManagementClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient +// client. +func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new CDN profile with a profile name under the specified +// subscription and resource group. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. profile is profile properties needed to create a new +// profile. +func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (<-chan Profile, <-chan error) { + resultChan := make(chan Profile, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: profile, + Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Profile + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, profileName, profile, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ProfilesClient) CreatePreparer(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithJSON(profile), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing CDN profile with the specified parameters. +// Deleting a profile will result in the deletion of all of the sub-resources +// including endpoints, origins and custom domains. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. +func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, profileName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateSsoURI generates a dynamic SSO URI used to sign in to the CDN +// supplemental portal. Supplemnetal portal is used to configure advanced +// feature capabilities that are not yet available in the Azure portal, such as +// core reports in a standard profile; rules engine, advanced HTTP reports, and +// real-time stats and alerts in a premium profile. The SSO URI changes +// approximately every 10 minutes. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. +func (client ProfilesClient) GenerateSsoURI(resourceGroupName string, profileName string) (result SsoURI, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "GenerateSsoURI") + } + + req, err := client.GenerateSsoURIPreparer(resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateSsoURISender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure sending request") + return + } + + result, err = client.GenerateSsoURIResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure responding to request") + } + + return +} + +// GenerateSsoURIPreparer prepares the GenerateSsoURI request. +func (client ProfilesClient) GenerateSsoURIPreparer(resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateSsoURISender sends the GenerateSsoURI request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GenerateSsoURISender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateSsoURIResponder handles the response to the GenerateSsoURI request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GenerateSsoURIResponder(resp *http.Response) (result SsoURI, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a CDN profile with the specified profile name under the specified +// subscription and resource group. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. +func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the CDN profiles within an Azure subscription. +func (client ProfilesClient) List() (result ProfileListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ProfilesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ProfilesClient) ListNextResults(lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.ProfileListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists all of the CDN profiles within a resource group. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. +func (client ProfilesClient) ListByResourceGroup(resourceGroupName string) (result ProfileListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ProfilesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ProfilesClient) ListByResourceGroupNextResults(lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.ProfileListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListResourceUsage checks the quota and actual usage of endpoints under the +// given CDN profile. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. +func (client ProfilesClient) ListResourceUsage(resourceGroupName string, profileName string) (result ResourceUsageListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "ListResourceUsage") + } + + req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request") + return + } + + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to request") + } + + return +} + +// ListResourceUsagePreparer prepares the ListResourceUsage request. +func (client ProfilesClient) ListResourceUsagePreparer(resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkResourceUsage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListResourceUsageSender sends the ListResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListResourceUsageNextResults retrieves the next set of results, if any. +func (client ProfilesClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) { + req, err := lastResults.ResourceUsageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListResourceUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending next results request") + } + + result, err = client.ListResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure responding to next results request") + } + + return +} + +// Update updates an existing CDN profile with the specified profile name under +// the specified subscription and resource group. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. profileName is name of the CDN profile which is unique within +// the resource group. profileUpdateParameters is profile properties needed to +// update an existing profile. +func (client ProfilesClient) Update(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (<-chan Profile, <-chan error) { + resultChan := make(chan Profile, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Update") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Profile + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, profileName, profileUpdateParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-10-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", pathParameters), + autorest.WithJSON(profileUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go index 9ffe98333d..afea5d8416 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go @@ -1,29 +1,29 @@ -package cdn - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-cdn/2016-10-02" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package cdn + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-cdn/2016-10-02" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/accounts.go index 575185bb2e..76cb1d4f96 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/accounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/accounts.go @@ -1,724 +1,724 @@ -package cognitiveservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AccountsClient is the cognitive Services Management Client -type AccountsClient struct { - ManagementClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient -// client. -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create Cognitive Services Account. Accounts is a resource group wide -// resource type. It holds the keys for developer to access intelligent APIs. -// It's also the resource type for billing. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Cognitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. parameters is the parameters to provide for the created -// account. -func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Cognitive Services account from the resource group. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Cognitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetProperties returns a Cognitive Services account specified by the -// parameters. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Cognitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "GetProperties") - } - - req, err := client.GetPropertiesPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetProperties", nil, "Failure preparing request") - return - } - - resp, err := client.GetPropertiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetProperties", resp, "Failure sending request") - return - } - - result, err = client.GetPropertiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetProperties", resp, "Failure responding to request") - } - - return -} - -// GetPropertiesPreparer prepares the GetProperties request. -func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPropertiesSender sends the GetProperties request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPropertiesResponder handles the response to the GetProperties request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns all the resources of a particular type belonging to a -// subscription. -func (client AccountsClient) List() (result AccountListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup returns all the resources of a particular type belonging -// to a resource group -// -// resourceGroupName is the name of the resource group within the user's -// subscription. -func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the account keys for the specified Cognitive Services -// account. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Congitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSkus list available SKUs for the requested Cognitive Services account -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Cognitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) ListSkus(resourceGroupName string, accountName string) (result AccountEnumerateSkusResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "ListSkus") - } - - req, err := client.ListSkusPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", resp, "Failure sending request") - return - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", resp, "Failure responding to request") - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client AccountsClient) ListSkusPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListSkusResponder(resp *http.Response) (result AccountEnumerateSkusResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates the specified account key for the specified -// Cognitive Services account. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Cognitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. body is regenerate key parameters. -func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, body RegenerateKeyParameters) (result AccountKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "RegenerateKey") - } - - req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, body RegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a Cognitive Services account -// -// resourceGroupName is the name of the resource group within the user's -// subscription. accountName is the name of the cognitive services account -// within the specified resource group. Cognitive Services account names must -// be between 3 and 24 characters in length and use numbers and lower-case -// letters only. body is the parameters to provide for the created account. -func (client AccountsClient) Update(resourceGroupName string, accountName string, body AccountUpdateParameters) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, accountName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, body AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package cognitiveservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AccountsClient is the cognitive Services Management Client +type AccountsClient struct { + ManagementClient +} + +// NewAccountsClient creates an instance of the AccountsClient client. +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountsClientWithBaseURI creates an instance of the AccountsClient +// client. +func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create Cognitive Services Account. Accounts is a resource group wide +// resource type. It holds the keys for developer to access intelligent APIs. +// It's also the resource type for billing. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Cognitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. parameters is the parameters to provide for the created +// account. +func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Cognitive Services account from the resource group. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Cognitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountsClient) DeletePreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetProperties returns a Cognitive Services account specified by the +// parameters. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Cognitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "GetProperties") + } + + req, err := client.GetPropertiesPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetProperties", nil, "Failure preparing request") + return + } + + resp, err := client.GetPropertiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetProperties", resp, "Failure sending request") + return + } + + result, err = client.GetPropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetProperties", resp, "Failure responding to request") + } + + return +} + +// GetPropertiesPreparer prepares the GetProperties request. +func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPropertiesSender sends the GetProperties request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPropertiesResponder handles the response to the GetProperties request. The method always +// closes the http.Response Body. +func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns all the resources of a particular type belonging to a +// subscription. +func (client AccountsClient) List() (result AccountListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns all the resources of a particular type belonging +// to a resource group +// +// resourceGroupName is the name of the resource group within the user's +// subscription. +func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeys lists the account keys for the specified Cognitive Services +// account. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Congitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkus list available SKUs for the requested Cognitive Services account +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Cognitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) ListSkus(resourceGroupName string, accountName string) (result AccountEnumerateSkusResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "ListSkus") + } + + req, err := client.ListSkusPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client AccountsClient) ListSkusPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListSkusResponder(resp *http.Response) (result AccountEnumerateSkusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerates the specified account key for the specified +// Cognitive Services account. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Cognitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. body is regenerate key parameters. +func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, body RegenerateKeyParameters) (result AccountKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "RegenerateKey") + } + + req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, body RegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a Cognitive Services account +// +// resourceGroupName is the name of the resource group within the user's +// subscription. accountName is the name of the cognitive services account +// within the specified resource group. Cognitive Services account names must +// be between 3 and 24 characters in length and use numbers and lower-case +// letters only. body is the parameters to provide for the created account. +func (client AccountsClient) Update(resourceGroupName string, accountName string, body AccountUpdateParameters) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "cognitiveservices.AccountsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, accountName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, body AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/client.go index 037b9a7e79..ba9db94240 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/client.go @@ -1,53 +1,53 @@ -// Package cognitiveservices implements the Azure ARM Cognitiveservices service -// API version 2016-02-01-preview. -// -// Cognitive Services Management Client -package cognitiveservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Cognitiveservices - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Cognitiveservices. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package cognitiveservices implements the Azure ARM Cognitiveservices service +// API version 2016-02-01-preview. +// +// Cognitive Services Management Client +package cognitiveservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Cognitiveservices + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Cognitiveservices. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/models.go index 316932fc87..e4ba9e6916 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/models.go @@ -1,212 +1,212 @@ -package cognitiveservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// KeyName enumerates the values for key name. -type KeyName string - -const ( - // Key1 specifies the key 1 state for key name. - Key1 KeyName = "Key1" - // Key2 specifies the key 2 state for key name. - Key2 KeyName = "Key2" -) - -// Kind enumerates the values for kind. -type Kind string - -const ( - // Academic specifies the academic state for kind. - Academic Kind = "Academic" - // BingAutosuggest specifies the bing autosuggest state for kind. - BingAutosuggest Kind = "Bing.Autosuggest" - // BingSearch specifies the bing search state for kind. - BingSearch Kind = "Bing.Search" - // BingSpeech specifies the bing speech state for kind. - BingSpeech Kind = "Bing.Speech" - // BingSpellCheck specifies the bing spell check state for kind. - BingSpellCheck Kind = "Bing.SpellCheck" - // ComputerVision specifies the computer vision state for kind. - ComputerVision Kind = "ComputerVision" - // ContentModerator specifies the content moderator state for kind. - ContentModerator Kind = "ContentModerator" - // Emotion specifies the emotion state for kind. - Emotion Kind = "Emotion" - // Face specifies the face state for kind. - Face Kind = "Face" - // LUIS specifies the luis state for kind. - LUIS Kind = "LUIS" - // Recommendations specifies the recommendations state for kind. - Recommendations Kind = "Recommendations" - // SpeakerRecognition specifies the speaker recognition state for kind. - SpeakerRecognition Kind = "SpeakerRecognition" - // Speech specifies the speech state for kind. - Speech Kind = "Speech" - // SpeechTranslation specifies the speech translation state for kind. - SpeechTranslation Kind = "SpeechTranslation" - // TextAnalytics specifies the text analytics state for kind. - TextAnalytics Kind = "TextAnalytics" - // TextTranslation specifies the text translation state for kind. - TextTranslation Kind = "TextTranslation" - // WebLM specifies the web lm state for kind. - WebLM Kind = "WebLM" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Creating specifies the creating state for provisioning state. - Creating ProvisioningState = "Creating" - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "Failed" - // ResolvingDNS specifies the resolving dns state for provisioning state. - ResolvingDNS ProvisioningState = "ResolvingDNS" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // F0 specifies the f0 state for sku name. - F0 SkuName = "F0" - // P0 specifies the p0 state for sku name. - P0 SkuName = "P0" - // P1 specifies the p1 state for sku name. - P1 SkuName = "P1" - // P2 specifies the p2 state for sku name. - P2 SkuName = "P2" - // S0 specifies the s0 state for sku name. - S0 SkuName = "S0" - // S1 specifies the s1 state for sku name. - S1 SkuName = "S1" - // S2 specifies the s2 state for sku name. - S2 SkuName = "S2" - // S3 specifies the s3 state for sku name. - S3 SkuName = "S3" - // S4 specifies the s4 state for sku name. - S4 SkuName = "S4" - // S5 specifies the s5 state for sku name. - S5 SkuName = "S5" - // S6 specifies the s6 state for sku name. - S6 SkuName = "S6" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Free specifies the free state for sku tier. - Free SkuTier = "Free" - // Premium specifies the premium state for sku tier. - Premium SkuTier = "Premium" - // Standard specifies the standard state for sku tier. - Standard SkuTier = "Standard" -) - -// Account is cognitive Services Account is an Azure resource representing the -// provisioned account, its type, location and SKU. -type Account struct { - autorest.Response `json:"-"` - Etag *string `json:"etag,omitempty"` - ID *string `json:"id,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - *AccountProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} - -// AccountCreateParameters is the parameters to provide for the account. -type AccountCreateParameters struct { - Sku *Sku `json:"sku,omitempty"` - Kind Kind `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` -} - -// AccountEnumerateSkusResult is the list of cognitive services accounts -// operation response. -type AccountEnumerateSkusResult struct { - autorest.Response `json:"-"` - Value *[]ResourceAndSku `json:"value,omitempty"` -} - -// AccountKeys is the access keys for the cognitive services account. -type AccountKeys struct { - autorest.Response `json:"-"` - Key1 *string `json:"key1,omitempty"` - Key2 *string `json:"key2,omitempty"` -} - -// AccountListResult is the list of cognitive services accounts operation -// response. -type AccountListResult struct { - autorest.Response `json:"-"` - Value *[]Account `json:"value,omitempty"` -} - -// AccountProperties is -type AccountProperties struct { - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` -} - -// AccountUpdateParameters is the parameters to provide for the account. -type AccountUpdateParameters struct { - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Error is -type Error struct { - Error *ErrorBody `json:"error,omitempty"` -} - -// ErrorBody is -type ErrorBody struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// RegenerateKeyParameters is regenerate key parameters. -type RegenerateKeyParameters struct { - KeyName KeyName `json:"keyName,omitempty"` -} - -// ResourceAndSku is -type ResourceAndSku struct { - ResourceType *string `json:"resourceType,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// Sku is the SKU of the cognitive services account. -type Sku struct { - Name SkuName `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` -} +package cognitiveservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// KeyName enumerates the values for key name. +type KeyName string + +const ( + // Key1 specifies the key 1 state for key name. + Key1 KeyName = "Key1" + // Key2 specifies the key 2 state for key name. + Key2 KeyName = "Key2" +) + +// Kind enumerates the values for kind. +type Kind string + +const ( + // Academic specifies the academic state for kind. + Academic Kind = "Academic" + // BingAutosuggest specifies the bing autosuggest state for kind. + BingAutosuggest Kind = "Bing.Autosuggest" + // BingSearch specifies the bing search state for kind. + BingSearch Kind = "Bing.Search" + // BingSpeech specifies the bing speech state for kind. + BingSpeech Kind = "Bing.Speech" + // BingSpellCheck specifies the bing spell check state for kind. + BingSpellCheck Kind = "Bing.SpellCheck" + // ComputerVision specifies the computer vision state for kind. + ComputerVision Kind = "ComputerVision" + // ContentModerator specifies the content moderator state for kind. + ContentModerator Kind = "ContentModerator" + // Emotion specifies the emotion state for kind. + Emotion Kind = "Emotion" + // Face specifies the face state for kind. + Face Kind = "Face" + // LUIS specifies the luis state for kind. + LUIS Kind = "LUIS" + // Recommendations specifies the recommendations state for kind. + Recommendations Kind = "Recommendations" + // SpeakerRecognition specifies the speaker recognition state for kind. + SpeakerRecognition Kind = "SpeakerRecognition" + // Speech specifies the speech state for kind. + Speech Kind = "Speech" + // SpeechTranslation specifies the speech translation state for kind. + SpeechTranslation Kind = "SpeechTranslation" + // TextAnalytics specifies the text analytics state for kind. + TextAnalytics Kind = "TextAnalytics" + // TextTranslation specifies the text translation state for kind. + TextTranslation Kind = "TextTranslation" + // WebLM specifies the web lm state for kind. + WebLM Kind = "WebLM" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Creating specifies the creating state for provisioning state. + Creating ProvisioningState = "Creating" + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // ResolvingDNS specifies the resolving dns state for provisioning state. + ResolvingDNS ProvisioningState = "ResolvingDNS" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // F0 specifies the f0 state for sku name. + F0 SkuName = "F0" + // P0 specifies the p0 state for sku name. + P0 SkuName = "P0" + // P1 specifies the p1 state for sku name. + P1 SkuName = "P1" + // P2 specifies the p2 state for sku name. + P2 SkuName = "P2" + // S0 specifies the s0 state for sku name. + S0 SkuName = "S0" + // S1 specifies the s1 state for sku name. + S1 SkuName = "S1" + // S2 specifies the s2 state for sku name. + S2 SkuName = "S2" + // S3 specifies the s3 state for sku name. + S3 SkuName = "S3" + // S4 specifies the s4 state for sku name. + S4 SkuName = "S4" + // S5 specifies the s5 state for sku name. + S5 SkuName = "S5" + // S6 specifies the s6 state for sku name. + S6 SkuName = "S6" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Free specifies the free state for sku tier. + Free SkuTier = "Free" + // Premium specifies the premium state for sku tier. + Premium SkuTier = "Premium" + // Standard specifies the standard state for sku tier. + Standard SkuTier = "Standard" +) + +// Account is cognitive Services Account is an Azure resource representing the +// provisioned account, its type, location and SKU. +type Account struct { + autorest.Response `json:"-"` + Etag *string `json:"etag,omitempty"` + ID *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + *AccountProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} + +// AccountCreateParameters is the parameters to provide for the account. +type AccountCreateParameters struct { + Sku *Sku `json:"sku,omitempty"` + Kind Kind `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// AccountEnumerateSkusResult is the list of cognitive services accounts +// operation response. +type AccountEnumerateSkusResult struct { + autorest.Response `json:"-"` + Value *[]ResourceAndSku `json:"value,omitempty"` +} + +// AccountKeys is the access keys for the cognitive services account. +type AccountKeys struct { + autorest.Response `json:"-"` + Key1 *string `json:"key1,omitempty"` + Key2 *string `json:"key2,omitempty"` +} + +// AccountListResult is the list of cognitive services accounts operation +// response. +type AccountListResult struct { + autorest.Response `json:"-"` + Value *[]Account `json:"value,omitempty"` +} + +// AccountProperties is +type AccountProperties struct { + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` +} + +// AccountUpdateParameters is the parameters to provide for the account. +type AccountUpdateParameters struct { + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Error is +type Error struct { + Error *ErrorBody `json:"error,omitempty"` +} + +// ErrorBody is +type ErrorBody struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// RegenerateKeyParameters is regenerate key parameters. +type RegenerateKeyParameters struct { + KeyName KeyName `json:"keyName,omitempty"` +} + +// ResourceAndSku is +type ResourceAndSku struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// Sku is the SKU of the cognitive services account. +type Sku struct { + Name SkuName `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/version.go index 2df9be9f1a..cba03d5e9d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/cognitiveservices/version.go @@ -1,29 +1,29 @@ -package cognitiveservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-cognitiveservices/2016-02-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package cognitiveservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-cognitiveservices/2016-02-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/client.go index 96af4e5647..289d50cfed 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/client.go @@ -1,53 +1,53 @@ -// Package commerce implements the Azure ARM Commerce service API version -// 2015-06-01-preview. -// -// -package commerce - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Commerce - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Commerce. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package commerce implements the Azure ARM Commerce service API version +// 2015-06-01-preview. +// +// +package commerce + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Commerce + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Commerce. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/models.go index 601cf334f9..1497c45d80 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/models.go @@ -1,151 +1,151 @@ -package commerce - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/satori/uuid" - "github.com/shopspring/decimal" - "net/http" -) - -// AggregationGranularity enumerates the values for aggregation granularity. -type AggregationGranularity string - -const ( - // Daily specifies the daily state for aggregation granularity. - Daily AggregationGranularity = "Daily" - // Hourly specifies the hourly state for aggregation granularity. - Hourly AggregationGranularity = "Hourly" -) - -// ErrorResponse is describes the format of Error response. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// InfoField is key-value pairs of instance details in the legacy format. -type InfoField struct { - Project *string `json:"project,omitempty"` -} - -// MeterInfo is detailed information about the meter. -type MeterInfo struct { - MeterID *uuid.UUID `json:"MeterId,omitempty"` - MeterName *string `json:"MeterName,omitempty"` - MeterCategory *string `json:"MeterCategory,omitempty"` - MeterSubCategory *string `json:"MeterSubCategory,omitempty"` - Unit *string `json:"Unit,omitempty"` - MeterTags *[]string `json:"MeterTags,omitempty"` - MeterRegion *string `json:"MeterRegion,omitempty"` - MeterRates *map[string]*float64 `json:"MeterRates,omitempty"` - EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` - IncludedQuantity *float64 `json:"IncludedQuantity,omitempty"` -} - -// MonetaryCommitment is indicates that a monetary commitment is required for -// this offer -type MonetaryCommitment struct { - EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` - TieredDiscount *map[string]*decimal.Decimal `json:"TieredDiscount,omitempty"` - ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"` -} - -// MonetaryCredit is indicates that this is a monetary credit offer. -type MonetaryCredit struct { - EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` - Credit *decimal.Decimal `json:"Credit,omitempty"` - ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"` -} - -// OfferTermInfo is describes the offer term. -type OfferTermInfo struct { - EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` -} - -// RateCardQueryParameters is parameters that are used in the odata $filter -// query parameter for providing RateCard information. -type RateCardQueryParameters struct { - OfferDurableID *string `json:"OfferDurableId,omitempty"` - Currency *string `json:"Currency,omitempty"` - Locale *string `json:"Locale,omitempty"` - RegionInfo *string `json:"RegionInfo,omitempty"` -} - -// RecurringCharge is indicates a recurring charge is present for this offer. -type RecurringCharge struct { - EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` - RecurringCharge *int32 `json:"RecurringCharge,omitempty"` -} - -// ResourceRateCardInfo is price and Metadata information for resources -type ResourceRateCardInfo struct { - autorest.Response `json:"-"` - Currency *string `json:"Currency,omitempty"` - Locale *string `json:"Locale,omitempty"` - IsTaxIncluded *bool `json:"IsTaxIncluded,omitempty"` - OfferTerms *[]OfferTermInfo `json:"OfferTerms,omitempty"` - Meters *[]MeterInfo `json:"Meters,omitempty"` -} - -// UsageAggregation is describes the usageAggregation. -type UsageAggregation struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *UsageSample `json:"properties,omitempty"` -} - -// UsageAggregationListResult is the Get UsageAggregates operation response. -type UsageAggregationListResult struct { - autorest.Response `json:"-"` - Value *[]UsageAggregation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// UsageAggregationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client UsageAggregationListResult) UsageAggregationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// UsageSample is describes a sample of the usageAggregation. -type UsageSample struct { - SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` - MeterID *string `json:"meterId,omitempty"` - UsageStartTime *date.Time `json:"usageStartTime,omitempty"` - UsageEndTime *date.Time `json:"usageEndTime,omitempty"` - Quantity *map[string]interface{} `json:"quantity,omitempty"` - Unit *string `json:"unit,omitempty"` - MeterName *string `json:"meterName,omitempty"` - MeterCategory *string `json:"meterCategory,omitempty"` - MeterSubCategory *string `json:"meterSubCategory,omitempty"` - MeterRegion *string `json:"meterRegion,omitempty"` - InfoFields *InfoField `json:"infoFields,omitempty"` - InstanceData *string `json:"instanceData,omitempty"` -} +package commerce + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" + "github.com/shopspring/decimal" + "net/http" +) + +// AggregationGranularity enumerates the values for aggregation granularity. +type AggregationGranularity string + +const ( + // Daily specifies the daily state for aggregation granularity. + Daily AggregationGranularity = "Daily" + // Hourly specifies the hourly state for aggregation granularity. + Hourly AggregationGranularity = "Hourly" +) + +// ErrorResponse is describes the format of Error response. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// InfoField is key-value pairs of instance details in the legacy format. +type InfoField struct { + Project *string `json:"project,omitempty"` +} + +// MeterInfo is detailed information about the meter. +type MeterInfo struct { + MeterID *uuid.UUID `json:"MeterId,omitempty"` + MeterName *string `json:"MeterName,omitempty"` + MeterCategory *string `json:"MeterCategory,omitempty"` + MeterSubCategory *string `json:"MeterSubCategory,omitempty"` + Unit *string `json:"Unit,omitempty"` + MeterTags *[]string `json:"MeterTags,omitempty"` + MeterRegion *string `json:"MeterRegion,omitempty"` + MeterRates *map[string]*float64 `json:"MeterRates,omitempty"` + EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` + IncludedQuantity *float64 `json:"IncludedQuantity,omitempty"` +} + +// MonetaryCommitment is indicates that a monetary commitment is required for +// this offer +type MonetaryCommitment struct { + EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` + TieredDiscount *map[string]*decimal.Decimal `json:"TieredDiscount,omitempty"` + ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"` +} + +// MonetaryCredit is indicates that this is a monetary credit offer. +type MonetaryCredit struct { + EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` + Credit *decimal.Decimal `json:"Credit,omitempty"` + ExcludedMeterIds *[]uuid.UUID `json:"ExcludedMeterIds,omitempty"` +} + +// OfferTermInfo is describes the offer term. +type OfferTermInfo struct { + EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` +} + +// RateCardQueryParameters is parameters that are used in the odata $filter +// query parameter for providing RateCard information. +type RateCardQueryParameters struct { + OfferDurableID *string `json:"OfferDurableId,omitempty"` + Currency *string `json:"Currency,omitempty"` + Locale *string `json:"Locale,omitempty"` + RegionInfo *string `json:"RegionInfo,omitempty"` +} + +// RecurringCharge is indicates a recurring charge is present for this offer. +type RecurringCharge struct { + EffectiveDate *date.Time `json:"EffectiveDate,omitempty"` + RecurringCharge *int32 `json:"RecurringCharge,omitempty"` +} + +// ResourceRateCardInfo is price and Metadata information for resources +type ResourceRateCardInfo struct { + autorest.Response `json:"-"` + Currency *string `json:"Currency,omitempty"` + Locale *string `json:"Locale,omitempty"` + IsTaxIncluded *bool `json:"IsTaxIncluded,omitempty"` + OfferTerms *[]OfferTermInfo `json:"OfferTerms,omitempty"` + Meters *[]MeterInfo `json:"Meters,omitempty"` +} + +// UsageAggregation is describes the usageAggregation. +type UsageAggregation struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *UsageSample `json:"properties,omitempty"` +} + +// UsageAggregationListResult is the Get UsageAggregates operation response. +type UsageAggregationListResult struct { + autorest.Response `json:"-"` + Value *[]UsageAggregation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// UsageAggregationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client UsageAggregationListResult) UsageAggregationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// UsageSample is describes a sample of the usageAggregation. +type UsageSample struct { + SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` + MeterID *string `json:"meterId,omitempty"` + UsageStartTime *date.Time `json:"usageStartTime,omitempty"` + UsageEndTime *date.Time `json:"usageEndTime,omitempty"` + Quantity *map[string]interface{} `json:"quantity,omitempty"` + Unit *string `json:"unit,omitempty"` + MeterName *string `json:"meterName,omitempty"` + MeterCategory *string `json:"meterCategory,omitempty"` + MeterSubCategory *string `json:"meterSubCategory,omitempty"` + MeterRegion *string `json:"meterRegion,omitempty"` + InfoFields *InfoField `json:"infoFields,omitempty"` + InstanceData *string `json:"instanceData,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/ratecard.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/ratecard.go index 03fcad0f0c..2550c64efc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/ratecard.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/ratecard.go @@ -1,117 +1,117 @@ -package commerce - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RateCardClient is the client for the RateCard methods of the Commerce -// service. -type RateCardClient struct { - ManagementClient -} - -// NewRateCardClient creates an instance of the RateCardClient client. -func NewRateCardClient(subscriptionID string) RateCardClient { - return NewRateCardClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRateCardClientWithBaseURI creates an instance of the RateCardClient -// client. -func NewRateCardClientWithBaseURI(baseURI string, subscriptionID string) RateCardClient { - return RateCardClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get enables you to query for the resource/meter metadata and related prices -// used in a given subscription by Offer ID, Currency, Locale and Region. The -// metadata associated with the billing meters, including but not limited to -// service names, types, resources, units of measure, and regions, is subject -// to change at any time and without notice. If you intend to use this billing -// data in an automated fashion, please use the billing meter GUID to uniquely -// identify each billable item. If the billing meter GUID is scheduled to -// change due to a new billing model, you will be notified in advance of the -// change. -// -// filter is the filter to apply on the operation. It ONLY supports the 'eq' -// and 'and' logical operators at this time. All the 4 query parameters -// 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part -// of the $filter. -func (client RateCardClient) Get(filter string) (result ResourceRateCardInfo, err error) { - req, err := client.GetPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RateCardClient) GetPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-06-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RateCardClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RateCardClient) GetResponder(resp *http.Response) (result ResourceRateCardInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package commerce + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RateCardClient is the client for the RateCard methods of the Commerce +// service. +type RateCardClient struct { + ManagementClient +} + +// NewRateCardClient creates an instance of the RateCardClient client. +func NewRateCardClient(subscriptionID string) RateCardClient { + return NewRateCardClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRateCardClientWithBaseURI creates an instance of the RateCardClient +// client. +func NewRateCardClientWithBaseURI(baseURI string, subscriptionID string) RateCardClient { + return RateCardClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get enables you to query for the resource/meter metadata and related prices +// used in a given subscription by Offer ID, Currency, Locale and Region. The +// metadata associated with the billing meters, including but not limited to +// service names, types, resources, units of measure, and regions, is subject +// to change at any time and without notice. If you intend to use this billing +// data in an automated fashion, please use the billing meter GUID to uniquely +// identify each billable item. If the billing meter GUID is scheduled to +// change due to a new billing model, you will be notified in advance of the +// change. +// +// filter is the filter to apply on the operation. It ONLY supports the 'eq' +// and 'and' logical operators at this time. All the 4 query parameters +// 'OfferDurableId', 'Currency', 'Locale', 'Region' are required to be a part +// of the $filter. +func (client RateCardClient) Get(filter string) (result ResourceRateCardInfo, err error) { + req, err := client.GetPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commerce.RateCardClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RateCardClient) GetPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", filter), + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RateCardClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RateCardClient) GetResponder(resp *http.Response) (result ResourceRateCardInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/usageaggregates.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/usageaggregates.go index 10b0e2f1e4..4fe2284056 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/usageaggregates.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/usageaggregates.go @@ -1,155 +1,155 @@ -package commerce - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "net/http" -) - -// UsageAggregatesClient is the client for the UsageAggregates methods of the -// Commerce service. -type UsageAggregatesClient struct { - ManagementClient -} - -// NewUsageAggregatesClient creates an instance of the UsageAggregatesClient -// client. -func NewUsageAggregatesClient(subscriptionID string) UsageAggregatesClient { - return NewUsageAggregatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsageAggregatesClientWithBaseURI creates an instance of the -// UsageAggregatesClient client. -func NewUsageAggregatesClientWithBaseURI(baseURI string, subscriptionID string) UsageAggregatesClient { - return UsageAggregatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List query aggregated Azure subscription consumption data for a date range. -// -// reportedStartTime is the start of the time range to retrieve data for. -// reportedEndTime is the end of the time range to retrieve data for. -// showDetails is `True` returns usage data in instance-level detail, `false` -// causes server-side aggregation with fewer details. For example, if you have -// 3 website instances, by default you will get 3 line items for website -// consumption. If you specify showDetails = false, the data will be aggregated -// as a single line item for website consumption within the time period (for -// the given subscriptionId, meterId, usageStartTime and usageEndTime). -// aggregationGranularity is `Daily` (default) returns the data in daily -// granularity, `Hourly` returns the data in hourly granularity. -// continuationToken is used when a continuation token string is provided in -// the response body of the previous call, enabling paging through a large -// result set. If not present, the data is retrieved from the beginning of the -// day/hour (based on the granularity) passed in. -func (client UsageAggregatesClient) List(reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (result UsageAggregationListResult, err error) { - req, err := client.ListPreparer(reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken) - if err != nil { - err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsageAggregatesClient) ListPreparer(reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "reportedEndTime": autorest.Encode("query", reportedEndTime), - "reportedStartTime": autorest.Encode("query", reportedStartTime), - } - if showDetails != nil { - queryParameters["showDetails"] = autorest.Encode("query", *showDetails) - } - if len(string(aggregationGranularity)) > 0 { - queryParameters["aggregationGranularity"] = autorest.Encode("query", aggregationGranularity) - } - if len(continuationToken) > 0 { - queryParameters["continuationToken"] = autorest.Encode("query", continuationToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsageAggregatesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsageAggregatesClient) ListResponder(resp *http.Response) (result UsageAggregationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client UsageAggregatesClient) ListNextResults(lastResults UsageAggregationListResult) (result UsageAggregationListResult, err error) { - req, err := lastResults.UsageAggregationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package commerce + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "net/http" +) + +// UsageAggregatesClient is the client for the UsageAggregates methods of the +// Commerce service. +type UsageAggregatesClient struct { + ManagementClient +} + +// NewUsageAggregatesClient creates an instance of the UsageAggregatesClient +// client. +func NewUsageAggregatesClient(subscriptionID string) UsageAggregatesClient { + return NewUsageAggregatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageAggregatesClientWithBaseURI creates an instance of the +// UsageAggregatesClient client. +func NewUsageAggregatesClientWithBaseURI(baseURI string, subscriptionID string) UsageAggregatesClient { + return UsageAggregatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List query aggregated Azure subscription consumption data for a date range. +// +// reportedStartTime is the start of the time range to retrieve data for. +// reportedEndTime is the end of the time range to retrieve data for. +// showDetails is `True` returns usage data in instance-level detail, `false` +// causes server-side aggregation with fewer details. For example, if you have +// 3 website instances, by default you will get 3 line items for website +// consumption. If you specify showDetails = false, the data will be aggregated +// as a single line item for website consumption within the time period (for +// the given subscriptionId, meterId, usageStartTime and usageEndTime). +// aggregationGranularity is `Daily` (default) returns the data in daily +// granularity, `Hourly` returns the data in hourly granularity. +// continuationToken is used when a continuation token string is provided in +// the response body of the previous call, enabling paging through a large +// result set. If not present, the data is retrieved from the beginning of the +// day/hour (based on the granularity) passed in. +func (client UsageAggregatesClient) List(reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (result UsageAggregationListResult, err error) { + req, err := client.ListPreparer(reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken) + if err != nil { + err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageAggregatesClient) ListPreparer(reportedStartTime date.Time, reportedEndTime date.Time, showDetails *bool, aggregationGranularity AggregationGranularity, continuationToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "reportedEndTime": autorest.Encode("query", reportedEndTime), + "reportedStartTime": autorest.Encode("query", reportedStartTime), + } + if showDetails != nil { + queryParameters["showDetails"] = autorest.Encode("query", *showDetails) + } + if len(string(aggregationGranularity)) > 0 { + queryParameters["aggregationGranularity"] = autorest.Encode("query", aggregationGranularity) + } + if len(continuationToken) > 0 { + queryParameters["continuationToken"] = autorest.Encode("query", continuationToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageAggregatesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageAggregatesClient) ListResponder(resp *http.Response) (result UsageAggregationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client UsageAggregatesClient) ListNextResults(lastResults UsageAggregationListResult) (result UsageAggregationListResult, err error) { + req, err := lastResults.UsageAggregationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commerce.UsageAggregatesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/version.go index f4c4519f53..185b4c56df 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/commerce/version.go @@ -1,29 +1,29 @@ -package commerce - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-commerce/2015-06-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package commerce + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-commerce/2015-06-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go index 974929219b..738c2c61ea 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go @@ -1,374 +1,374 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// AvailabilitySetsClient is the the Compute Management Client. -type AvailabilitySetsClient struct { - ManagementClient -} - -// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient -// client. -func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient { - return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAvailabilitySetsClientWithBaseURI creates an instance of the -// AvailabilitySetsClient client. -func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient { - return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an availability set. -// -// resourceGroupName is the name of the resource group. name is the name of the -// availability set. parameters is parameters supplied to the Create -// Availability Set operation. -func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters AvailabilitySet) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilitySet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is -// the name of the availability set. -func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) { - req, err := client.DeletePreparer(resourceGroupName, availabilitySetName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "availabilitySetName": autorest.Encode("path", availabilitySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieves information about an availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is -// the name of the availability set. -func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) { - req, err := client.GetPreparer(resourceGroupName, availabilitySetName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "availabilitySetName": autorest.Encode("path", availabilitySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result AvailabilitySet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all availability sets in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result AvailabilitySetListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAvailableSizes lists all available virtual machine sizes that can be -// used to create a new virtual machine in an existing availability set. -// -// resourceGroupName is the name of the resource group. availabilitySetName is -// the name of the availability set. -func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) { - req, err := client.ListAvailableSizesPreparer(resourceGroupName, availabilitySetName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request") - return - } - - resp, err := client.ListAvailableSizesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request") - return - } - - result, err = client.ListAvailableSizesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request") - } - - return -} - -// ListAvailableSizesPreparer prepares the ListAvailableSizes request. -func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "availabilitySetName": autorest.Encode("path", availabilitySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always -// closes the http.Response Body. -func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AvailabilitySetsClient is the the Compute Management Client. +type AvailabilitySetsClient struct { + ManagementClient +} + +// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient +// client. +func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient { + return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailabilitySetsClientWithBaseURI creates an instance of the +// AvailabilitySetsClient client. +func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient { + return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an availability set. +// +// resourceGroupName is the name of the resource group. name is the name of the +// availability set. parameters is parameters supplied to the Create +// Availability Set operation. +func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters AvailabilitySet) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an availability set. +// +// resourceGroupName is the name of the resource group. availabilitySetName is +// the name of the availability set. +func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) { + req, err := client.DeletePreparer(resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieves information about an availability set. +// +// resourceGroupName is the name of the resource group. availabilitySetName is +// the name of the availability set. +func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) { + req, err := client.GetPreparer(resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result AvailabilitySet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all availability sets in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result AvailabilitySetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableSizes lists all available virtual machine sizes that can be +// used to create a new virtual machine in an existing availability set. +// +// resourceGroupName is the name of the resource group. availabilitySetName is +// the name of the availability set. +func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) { + req, err := client.ListAvailableSizesPreparer(resourceGroupName, availabilitySetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableSizesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSizesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request") + } + + return +} + +// ListAvailableSizesPreparer prepares the ListAvailableSizes request. +func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "availabilitySetName": autorest.Encode("path", availabilitySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always +// closes the http.Response Body. +func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go index be5526478a..c60452b9d7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go @@ -1,53 +1,53 @@ -// Package compute implements the Azure ARM Compute service API version -// 2016-04-30-preview. -// -// The Compute Management Client. -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Compute - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Compute. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package compute implements the Azure ARM Compute service API version +// 2016-04-30-preview. +// +// The Compute Management Client. +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Compute + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Compute. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go index c333b59210..64f14dd082 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go @@ -1,463 +1,463 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ImagesClient is the the Compute Management Client. -type ImagesClient struct { - ManagementClient -} - -// NewImagesClient creates an instance of the ImagesClient client. -func NewImagesClient(subscriptionID string) ImagesClient { - return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImagesClientWithBaseURI creates an instance of the ImagesClient client. -func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient { - return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an image. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. imageName is the name -// of the image. parameters is parameters supplied to the Create Image -// operation. -func (client ImagesClient) CreateOrUpdate(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (<-chan Image, <-chan error) { - resultChan := make(chan Image, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ImageProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "compute.ImagesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Image - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, imageName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ImagesClient) CreateOrUpdatePreparer(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "imageName": autorest.Encode("path", imageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result Image, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Image. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. imageName is the name -// of the image. -func (client ImagesClient) Delete(resourceGroupName string, imageName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, imageName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ImagesClient) DeletePreparer(resourceGroupName string, imageName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "imageName": autorest.Encode("path", imageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ImagesClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an image. -// -// resourceGroupName is the name of the resource group. imageName is the name -// of the image. expand is the expand expression to apply on the operation. -func (client ImagesClient) Get(resourceGroupName string, imageName string, expand string) (result Image, err error) { - req, err := client.GetPreparer(resourceGroupName, imageName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ImagesClient) GetPreparer(resourceGroupName string, imageName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "imageName": autorest.Encode("path", imageName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the list of Images in the subscription. Use nextLink property in -// the response to get the next page of Images. Do this till nextLink is not -// null to fetch all the Images. -func (client ImagesClient) List() (result ImageListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ImagesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ImagesClient) ListNextResults(lastResults ImageListResult) (result ImageListResult, err error) { - req, err := lastResults.ImageListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets the list of images under a resource group. -// -// resourceGroupName is the name of the resource group. -func (client ImagesClient) ListByResourceGroup(resourceGroupName string) (result ImageListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ImagesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ImagesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ImagesClient) ListByResourceGroupNextResults(lastResults ImageListResult) (result ImageListResult, err error) { - req, err := lastResults.ImageListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ImagesClient is the the Compute Management Client. +type ImagesClient struct { + ManagementClient +} + +// NewImagesClient creates an instance of the ImagesClient client. +func NewImagesClient(subscriptionID string) ImagesClient { + return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImagesClientWithBaseURI creates an instance of the ImagesClient client. +func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient { + return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an image. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. imageName is the name +// of the image. parameters is parameters supplied to the Create Image +// operation. +func (client ImagesClient) CreateOrUpdate(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (<-chan Image, <-chan error) { + resultChan := make(chan Image, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ImageProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "compute.ImagesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Image + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, imageName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ImagesClient) CreateOrUpdatePreparer(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Image. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. imageName is the name +// of the image. +func (client ImagesClient) Delete(resourceGroupName string, imageName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, imageName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ImagesClient) DeletePreparer(resourceGroupName string, imageName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ImagesClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an image. +// +// resourceGroupName is the name of the resource group. imageName is the name +// of the image. expand is the expand expression to apply on the operation. +func (client ImagesClient) Get(resourceGroupName string, imageName string, expand string) (result Image, err error) { + req, err := client.GetPreparer(resourceGroupName, imageName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ImagesClient) GetPreparer(resourceGroupName string, imageName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageName": autorest.Encode("path", imageName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list of Images in the subscription. Use nextLink property in +// the response to get the next page of Images. Do this till nextLink is not +// null to fetch all the Images. +func (client ImagesClient) List() (result ImageListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ImagesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ImagesClient) ListNextResults(lastResults ImageListResult) (result ImageListResult, err error) { + req, err := lastResults.ImageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets the list of images under a resource group. +// +// resourceGroupName is the name of the resource group. +func (client ImagesClient) ListByResourceGroup(resourceGroupName string) (result ImageListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ImagesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ImagesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ImagesClient) ListByResourceGroupNextResults(lastResults ImageListResult) (result ImageListResult, err error) { + req, err := lastResults.ImageListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go index 19b624b3fe..a9524daeff 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go @@ -1,1342 +1,1342 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// CachingTypes enumerates the values for caching types. -type CachingTypes string - -const ( - // None specifies the none state for caching types. - None CachingTypes = "None" - // ReadOnly specifies the read only state for caching types. - ReadOnly CachingTypes = "ReadOnly" - // ReadWrite specifies the read write state for caching types. - ReadWrite CachingTypes = "ReadWrite" -) - -// ComponentNames enumerates the values for component names. -type ComponentNames string - -const ( - // MicrosoftWindowsShellSetup specifies the microsoft windows shell setup - // state for component names. - MicrosoftWindowsShellSetup ComponentNames = "Microsoft-Windows-Shell-Setup" -) - -// DiskCreateOptionTypes enumerates the values for disk create option types. -type DiskCreateOptionTypes string - -const ( - // Attach specifies the attach state for disk create option types. - Attach DiskCreateOptionTypes = "attach" - // Empty specifies the empty state for disk create option types. - Empty DiskCreateOptionTypes = "empty" - // FromImage specifies the from image state for disk create option types. - FromImage DiskCreateOptionTypes = "fromImage" -) - -// InstanceViewTypes enumerates the values for instance view types. -type InstanceViewTypes string - -const ( - // InstanceView specifies the instance view state for instance view types. - InstanceView InstanceViewTypes = "instanceView" -) - -// OperatingSystemStateTypes enumerates the values for operating system state -// types. -type OperatingSystemStateTypes string - -const ( - // Generalized specifies the generalized state for operating system state - // types. - Generalized OperatingSystemStateTypes = "Generalized" - // Specialized specifies the specialized state for operating system state - // types. - Specialized OperatingSystemStateTypes = "Specialized" -) - -// OperatingSystemTypes enumerates the values for operating system types. -type OperatingSystemTypes string - -const ( - // Linux specifies the linux state for operating system types. - Linux OperatingSystemTypes = "Linux" - // Windows specifies the windows state for operating system types. - Windows OperatingSystemTypes = "Windows" -) - -// PassNames enumerates the values for pass names. -type PassNames string - -const ( - // OobeSystem specifies the oobe system state for pass names. - OobeSystem PassNames = "oobeSystem" -) - -// ProtocolTypes enumerates the values for protocol types. -type ProtocolTypes string - -const ( - // HTTP specifies the http state for protocol types. - HTTP ProtocolTypes = "Http" - // HTTPS specifies the https state for protocol types. - HTTPS ProtocolTypes = "Https" -) - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // SystemAssigned specifies the system assigned state for resource identity - // type. - SystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// SettingNames enumerates the values for setting names. -type SettingNames string - -const ( - // AutoLogon specifies the auto logon state for setting names. - AutoLogon SettingNames = "AutoLogon" - // FirstLogonCommands specifies the first logon commands state for setting - // names. - FirstLogonCommands SettingNames = "FirstLogonCommands" -) - -// StatusLevelTypes enumerates the values for status level types. -type StatusLevelTypes string - -const ( - // Error specifies the error state for status level types. - Error StatusLevelTypes = "Error" - // Info specifies the info state for status level types. - Info StatusLevelTypes = "Info" - // Warning specifies the warning state for status level types. - Warning StatusLevelTypes = "Warning" -) - -// StorageAccountTypes enumerates the values for storage account types. -type StorageAccountTypes string - -const ( - // PremiumLRS specifies the premium lrs state for storage account types. - PremiumLRS StorageAccountTypes = "Premium_LRS" - // StandardLRS specifies the standard lrs state for storage account types. - StandardLRS StorageAccountTypes = "Standard_LRS" -) - -// UpgradeMode enumerates the values for upgrade mode. -type UpgradeMode string - -const ( - // Automatic specifies the automatic state for upgrade mode. - Automatic UpgradeMode = "Automatic" - // Manual specifies the manual state for upgrade mode. - Manual UpgradeMode = "Manual" -) - -// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine -// scale set sku scale type. -type VirtualMachineScaleSetSkuScaleType string - -const ( - // VirtualMachineScaleSetSkuScaleTypeAutomatic specifies the virtual - // machine scale set sku scale type automatic state for virtual machine - // scale set sku scale type. - VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" - // VirtualMachineScaleSetSkuScaleTypeNone specifies the virtual machine - // scale set sku scale type none state for virtual machine scale set sku - // scale type. - VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" -) - -// VirtualMachineSizeTypes enumerates the values for virtual machine size -// types. -type VirtualMachineSizeTypes string - -const ( - // BasicA0 specifies the basic a0 state for virtual machine size types. - BasicA0 VirtualMachineSizeTypes = "Basic_A0" - // BasicA1 specifies the basic a1 state for virtual machine size types. - BasicA1 VirtualMachineSizeTypes = "Basic_A1" - // BasicA2 specifies the basic a2 state for virtual machine size types. - BasicA2 VirtualMachineSizeTypes = "Basic_A2" - // BasicA3 specifies the basic a3 state for virtual machine size types. - BasicA3 VirtualMachineSizeTypes = "Basic_A3" - // BasicA4 specifies the basic a4 state for virtual machine size types. - BasicA4 VirtualMachineSizeTypes = "Basic_A4" - // StandardA0 specifies the standard a0 state for virtual machine size - // types. - StandardA0 VirtualMachineSizeTypes = "Standard_A0" - // StandardA1 specifies the standard a1 state for virtual machine size - // types. - StandardA1 VirtualMachineSizeTypes = "Standard_A1" - // StandardA10 specifies the standard a10 state for virtual machine size - // types. - StandardA10 VirtualMachineSizeTypes = "Standard_A10" - // StandardA11 specifies the standard a11 state for virtual machine size - // types. - StandardA11 VirtualMachineSizeTypes = "Standard_A11" - // StandardA2 specifies the standard a2 state for virtual machine size - // types. - StandardA2 VirtualMachineSizeTypes = "Standard_A2" - // StandardA3 specifies the standard a3 state for virtual machine size - // types. - StandardA3 VirtualMachineSizeTypes = "Standard_A3" - // StandardA4 specifies the standard a4 state for virtual machine size - // types. - StandardA4 VirtualMachineSizeTypes = "Standard_A4" - // StandardA5 specifies the standard a5 state for virtual machine size - // types. - StandardA5 VirtualMachineSizeTypes = "Standard_A5" - // StandardA6 specifies the standard a6 state for virtual machine size - // types. - StandardA6 VirtualMachineSizeTypes = "Standard_A6" - // StandardA7 specifies the standard a7 state for virtual machine size - // types. - StandardA7 VirtualMachineSizeTypes = "Standard_A7" - // StandardA8 specifies the standard a8 state for virtual machine size - // types. - StandardA8 VirtualMachineSizeTypes = "Standard_A8" - // StandardA9 specifies the standard a9 state for virtual machine size - // types. - StandardA9 VirtualMachineSizeTypes = "Standard_A9" - // StandardD1 specifies the standard d1 state for virtual machine size - // types. - StandardD1 VirtualMachineSizeTypes = "Standard_D1" - // StandardD11 specifies the standard d11 state for virtual machine size - // types. - StandardD11 VirtualMachineSizeTypes = "Standard_D11" - // StandardD11V2 specifies the standard d11v2 state for virtual machine - // size types. - StandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" - // StandardD12 specifies the standard d12 state for virtual machine size - // types. - StandardD12 VirtualMachineSizeTypes = "Standard_D12" - // StandardD12V2 specifies the standard d12v2 state for virtual machine - // size types. - StandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" - // StandardD13 specifies the standard d13 state for virtual machine size - // types. - StandardD13 VirtualMachineSizeTypes = "Standard_D13" - // StandardD13V2 specifies the standard d13v2 state for virtual machine - // size types. - StandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" - // StandardD14 specifies the standard d14 state for virtual machine size - // types. - StandardD14 VirtualMachineSizeTypes = "Standard_D14" - // StandardD14V2 specifies the standard d14v2 state for virtual machine - // size types. - StandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2" - // StandardD15V2 specifies the standard d15v2 state for virtual machine - // size types. - StandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2" - // StandardD1V2 specifies the standard d1v2 state for virtual machine size - // types. - StandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" - // StandardD2 specifies the standard d2 state for virtual machine size - // types. - StandardD2 VirtualMachineSizeTypes = "Standard_D2" - // StandardD2V2 specifies the standard d2v2 state for virtual machine size - // types. - StandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" - // StandardD3 specifies the standard d3 state for virtual machine size - // types. - StandardD3 VirtualMachineSizeTypes = "Standard_D3" - // StandardD3V2 specifies the standard d3v2 state for virtual machine size - // types. - StandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" - // StandardD4 specifies the standard d4 state for virtual machine size - // types. - StandardD4 VirtualMachineSizeTypes = "Standard_D4" - // StandardD4V2 specifies the standard d4v2 state for virtual machine size - // types. - StandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" - // StandardD5V2 specifies the standard d5v2 state for virtual machine size - // types. - StandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" - // StandardDS1 specifies the standard ds1 state for virtual machine size - // types. - StandardDS1 VirtualMachineSizeTypes = "Standard_DS1" - // StandardDS11 specifies the standard ds11 state for virtual machine size - // types. - StandardDS11 VirtualMachineSizeTypes = "Standard_DS11" - // StandardDS11V2 specifies the standard ds11v2 state for virtual machine - // size types. - StandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2" - // StandardDS12 specifies the standard ds12 state for virtual machine size - // types. - StandardDS12 VirtualMachineSizeTypes = "Standard_DS12" - // StandardDS12V2 specifies the standard ds12v2 state for virtual machine - // size types. - StandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2" - // StandardDS13 specifies the standard ds13 state for virtual machine size - // types. - StandardDS13 VirtualMachineSizeTypes = "Standard_DS13" - // StandardDS13V2 specifies the standard ds13v2 state for virtual machine - // size types. - StandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2" - // StandardDS14 specifies the standard ds14 state for virtual machine size - // types. - StandardDS14 VirtualMachineSizeTypes = "Standard_DS14" - // StandardDS14V2 specifies the standard ds14v2 state for virtual machine - // size types. - StandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2" - // StandardDS15V2 specifies the standard ds15v2 state for virtual machine - // size types. - StandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2" - // StandardDS1V2 specifies the standard ds1v2 state for virtual machine - // size types. - StandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2" - // StandardDS2 specifies the standard ds2 state for virtual machine size - // types. - StandardDS2 VirtualMachineSizeTypes = "Standard_DS2" - // StandardDS2V2 specifies the standard ds2v2 state for virtual machine - // size types. - StandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2" - // StandardDS3 specifies the standard ds3 state for virtual machine size - // types. - StandardDS3 VirtualMachineSizeTypes = "Standard_DS3" - // StandardDS3V2 specifies the standard ds3v2 state for virtual machine - // size types. - StandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2" - // StandardDS4 specifies the standard ds4 state for virtual machine size - // types. - StandardDS4 VirtualMachineSizeTypes = "Standard_DS4" - // StandardDS4V2 specifies the standard ds4v2 state for virtual machine - // size types. - StandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2" - // StandardDS5V2 specifies the standard ds5v2 state for virtual machine - // size types. - StandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2" - // StandardG1 specifies the standard g1 state for virtual machine size - // types. - StandardG1 VirtualMachineSizeTypes = "Standard_G1" - // StandardG2 specifies the standard g2 state for virtual machine size - // types. - StandardG2 VirtualMachineSizeTypes = "Standard_G2" - // StandardG3 specifies the standard g3 state for virtual machine size - // types. - StandardG3 VirtualMachineSizeTypes = "Standard_G3" - // StandardG4 specifies the standard g4 state for virtual machine size - // types. - StandardG4 VirtualMachineSizeTypes = "Standard_G4" - // StandardG5 specifies the standard g5 state for virtual machine size - // types. - StandardG5 VirtualMachineSizeTypes = "Standard_G5" - // StandardGS1 specifies the standard gs1 state for virtual machine size - // types. - StandardGS1 VirtualMachineSizeTypes = "Standard_GS1" - // StandardGS2 specifies the standard gs2 state for virtual machine size - // types. - StandardGS2 VirtualMachineSizeTypes = "Standard_GS2" - // StandardGS3 specifies the standard gs3 state for virtual machine size - // types. - StandardGS3 VirtualMachineSizeTypes = "Standard_GS3" - // StandardGS4 specifies the standard gs4 state for virtual machine size - // types. - StandardGS4 VirtualMachineSizeTypes = "Standard_GS4" - // StandardGS5 specifies the standard gs5 state for virtual machine size - // types. - StandardGS5 VirtualMachineSizeTypes = "Standard_GS5" -) - -// AdditionalUnattendContent is additional XML formatted information that can -// be included in the Unattend.xml file, which is used by Windows Setup. -// Contents are defined by setting name, component name, and the pass in which -// the content is a applied. -type AdditionalUnattendContent struct { - PassName PassNames `json:"passName,omitempty"` - ComponentName ComponentNames `json:"componentName,omitempty"` - SettingName SettingNames `json:"settingName,omitempty"` - Content *string `json:"content,omitempty"` -} - -// APIEntityReference is the API entity reference. -type APIEntityReference struct { - ID *string `json:"id,omitempty"` -} - -// APIError is api error. -type APIError struct { - Details *[]APIErrorBase `json:"details,omitempty"` - Innererror *InnerError `json:"innererror,omitempty"` - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` -} - -// APIErrorBase is api error base. -type APIErrorBase struct { - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AvailabilitySet is create or update availability set parameters. -type AvailabilitySet struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AvailabilitySetProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// AvailabilitySetListResult is the List Availability Set operation response. -type AvailabilitySetListResult struct { - autorest.Response `json:"-"` - Value *[]AvailabilitySet `json:"value,omitempty"` -} - -// AvailabilitySetProperties is the instance view of a resource. -type AvailabilitySetProperties struct { - PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` - PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` - VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` - Managed *bool `json:"managed,omitempty"` -} - -// BootDiagnostics is describes Boot Diagnostics. -type BootDiagnostics struct { - Enabled *bool `json:"enabled,omitempty"` - StorageURI *string `json:"storageUri,omitempty"` -} - -// BootDiagnosticsInstanceView is the instance view of a virtual machine boot -// diagnostics. -type BootDiagnosticsInstanceView struct { - ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` - SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` -} - -// DataDisk is describes a data disk. -type DataDisk struct { - Lun *int32 `json:"lun,omitempty"` - Name *string `json:"name,omitempty"` - Vhd *VirtualHardDisk `json:"vhd,omitempty"` - Image *VirtualHardDisk `json:"image,omitempty"` - Caching CachingTypes `json:"caching,omitempty"` - CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` -} - -// DataDiskImage is contains the data disk images information. -type DataDiskImage struct { - Lun *int32 `json:"lun,omitempty"` -} - -// DiagnosticsProfile is describes a diagnostics profile. -type DiagnosticsProfile struct { - BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` -} - -// DiskEncryptionSettings is describes a Encryption Settings for a Disk -type DiskEncryptionSettings struct { - DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` - KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// DiskInstanceView is the instance view of the disk. -type DiskInstanceView struct { - Name *string `json:"name,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` -} - -// HardwareProfile is describes a hardware profile. -type HardwareProfile struct { - VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"` -} - -// Image is describes an Image. -type Image struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ImageProperties `json:"properties,omitempty"` -} - -// ImageDataDisk is describes a data disk. -type ImageDataDisk struct { - Lun *int32 `json:"lun,omitempty"` - Snapshot *SubResource `json:"snapshot,omitempty"` - ManagedDisk *SubResource `json:"managedDisk,omitempty"` - BlobURI *string `json:"blobUri,omitempty"` - Caching CachingTypes `json:"caching,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` -} - -// ImageListResult is the List Image operation response. -type ImageListResult struct { - autorest.Response `json:"-"` - Value *[]Image `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ImageListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ImageListResult) ImageListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ImageOSDisk is describes an Operating System disk. -type ImageOSDisk struct { - OsType OperatingSystemTypes `json:"osType,omitempty"` - OsState OperatingSystemStateTypes `json:"osState,omitempty"` - Snapshot *SubResource `json:"snapshot,omitempty"` - ManagedDisk *SubResource `json:"managedDisk,omitempty"` - BlobURI *string `json:"blobUri,omitempty"` - Caching CachingTypes `json:"caching,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` -} - -// ImageProperties is describes the properties of an Image. -type ImageProperties struct { - SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` - StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ImageReference is the image reference. -type ImageReference struct { - ID *string `json:"id,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Offer *string `json:"offer,omitempty"` - Sku *string `json:"sku,omitempty"` - Version *string `json:"version,omitempty"` -} - -// ImageStorageProfile is describes a storage profile. -type ImageStorageProfile struct { - OsDisk *ImageOSDisk `json:"osDisk,omitempty"` - DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` -} - -// InnerError is inner error details. -type InnerError struct { - Exceptiontype *string `json:"exceptiontype,omitempty"` - Errordetail *string `json:"errordetail,omitempty"` -} - -// InstanceViewStatus is instance view status. -type InstanceViewStatus struct { - Code *string `json:"code,omitempty"` - Level StatusLevelTypes `json:"level,omitempty"` - DisplayStatus *string `json:"displayStatus,omitempty"` - Message *string `json:"message,omitempty"` - Time *date.Time `json:"time,omitempty"` -} - -// KeyVaultKeyReference is describes a reference to Key Vault Key -type KeyVaultKeyReference struct { - KeyURL *string `json:"keyUrl,omitempty"` - SourceVault *SubResource `json:"sourceVault,omitempty"` -} - -// KeyVaultSecretReference is describes a reference to Key Vault Secret -type KeyVaultSecretReference struct { - SecretURL *string `json:"secretUrl,omitempty"` - SourceVault *SubResource `json:"sourceVault,omitempty"` -} - -// LinuxConfiguration is describes Windows configuration of the OS Profile. -type LinuxConfiguration struct { - DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` - SSH *SSHConfiguration `json:"ssh,omitempty"` -} - -// ListUsagesResult is the List Usages operation response. -type ListUsagesResult struct { - autorest.Response `json:"-"` - Value *[]Usage `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListUsagesResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListUsagesResult) ListUsagesResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ListVirtualMachineExtensionImage is -type ListVirtualMachineExtensionImage struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineExtensionImage `json:"value,omitempty"` -} - -// ListVirtualMachineImageResource is -type ListVirtualMachineImageResource struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineImageResource `json:"value,omitempty"` -} - -// LongRunningOperationProperties is compute-specific operation properties, -// including output -type LongRunningOperationProperties struct { - Output *map[string]interface{} `json:"output,omitempty"` -} - -// ManagedDiskParameters is the parameters of a managed disk. -type ManagedDiskParameters struct { - ID *string `json:"id,omitempty"` - StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` -} - -// NetworkInterfaceReference is describes a network interface reference. -type NetworkInterfaceReference struct { - ID *string `json:"id,omitempty"` - *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` -} - -// NetworkInterfaceReferenceProperties is describes a network interface -// reference properties. -type NetworkInterfaceReferenceProperties struct { - Primary *bool `json:"primary,omitempty"` -} - -// NetworkProfile is describes a network profile. -type NetworkProfile struct { - NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` -} - -// OperationStatusResponse is operation status response -type OperationStatusResponse struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Status *string `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Error *APIError `json:"error,omitempty"` -} - -// OSDisk is describes an Operating System disk. -type OSDisk struct { - OsType OperatingSystemTypes `json:"osType,omitempty"` - EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` - Name *string `json:"name,omitempty"` - Vhd *VirtualHardDisk `json:"vhd,omitempty"` - Image *VirtualHardDisk `json:"image,omitempty"` - Caching CachingTypes `json:"caching,omitempty"` - CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` -} - -// OSDiskImage is contains the os disk image information. -type OSDiskImage struct { - OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` -} - -// OSProfile is describes an OS profile. -type OSProfile struct { - ComputerName *string `json:"computerName,omitempty"` - AdminUsername *string `json:"adminUsername,omitempty"` - AdminPassword *string `json:"adminPassword,omitempty"` - CustomData *string `json:"customData,omitempty"` - WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` - LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` - Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` -} - -// Plan is plan for the resource. -type Plan struct { - Name *string `json:"name,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Product *string `json:"product,omitempty"` - PromotionCode *string `json:"promotionCode,omitempty"` -} - -// PurchasePlan is used for establishing the purchase context of any 3rd Party -// artifact through MarketPlace. -type PurchasePlan struct { - Publisher *string `json:"publisher,omitempty"` - Name *string `json:"name,omitempty"` - Product *string `json:"product,omitempty"` -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Sku is describes a virtual machine scale set sku. -type Sku struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` - Capacity *int64 `json:"capacity,omitempty"` -} - -// SSHConfiguration is sSH configuration for Linux based VMs running on Azure -type SSHConfiguration struct { - PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` -} - -// SSHPublicKey is contains information about SSH certificate public key and -// the path on the Linux VM where the public key is placed. -type SSHPublicKey struct { - Path *string `json:"path,omitempty"` - KeyData *string `json:"keyData,omitempty"` -} - -// StorageProfile is describes a storage profile. -type StorageProfile struct { - ImageReference *ImageReference `json:"imageReference,omitempty"` - OsDisk *OSDisk `json:"osDisk,omitempty"` - DataDisks *[]DataDisk `json:"dataDisks,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// SubResourceReadOnly is -type SubResourceReadOnly struct { - ID *string `json:"id,omitempty"` -} - -// UpgradePolicy is describes an upgrade policy - automatic or manual. -type UpgradePolicy struct { - Mode UpgradeMode `json:"mode,omitempty"` -} - -// Usage is describes Compute Resource Usage. -type Usage struct { - Unit *string `json:"unit,omitempty"` - CurrentValue *int32 `json:"currentValue,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Name *UsageName `json:"name,omitempty"` -} - -// UsageName is the Usage Names. -type UsageName struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// VaultCertificate is describes a single certificate reference in a Key Vault, -// and where the certificate should reside on the VM. -type VaultCertificate struct { - CertificateURL *string `json:"certificateUrl,omitempty"` - CertificateStore *string `json:"certificateStore,omitempty"` -} - -// VaultSecretGroup is describes a set of certificates which are all in the -// same Key Vault. -type VaultSecretGroup struct { - SourceVault *SubResource `json:"sourceVault,omitempty"` - VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` -} - -// VirtualHardDisk is describes the uri of a disk. -type VirtualHardDisk struct { - URI *string `json:"uri,omitempty"` -} - -// VirtualMachine is describes a Virtual Machine. -type VirtualMachine struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Plan *Plan `json:"plan,omitempty"` - *VirtualMachineProperties `json:"properties,omitempty"` - Resources *[]VirtualMachineExtension `json:"resources,omitempty"` - Identity *VirtualMachineIdentity `json:"identity,omitempty"` -} - -// VirtualMachineAgentInstanceView is the instance view of the VM Agent running -// on the virtual machine. -type VirtualMachineAgentInstanceView struct { - VMAgentVersion *string `json:"vmAgentVersion,omitempty"` - ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` -} - -// VirtualMachineCaptureParameters is capture Virtual Machine parameters. -type VirtualMachineCaptureParameters struct { - VhdPrefix *string `json:"vhdPrefix,omitempty"` - DestinationContainerName *string `json:"destinationContainerName,omitempty"` - OverwriteVhds *bool `json:"overwriteVhds,omitempty"` -} - -// VirtualMachineCaptureResult is resource Id. -type VirtualMachineCaptureResult struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *VirtualMachineCaptureResultProperties `json:"properties,omitempty"` -} - -// VirtualMachineCaptureResultProperties is compute-specific operation -// properties, including output -type VirtualMachineCaptureResultProperties struct { - Output *map[string]interface{} `json:"output,omitempty"` -} - -// VirtualMachineExtension is describes a Virtual Machine Extension. -type VirtualMachineExtension struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualMachineExtensionProperties `json:"properties,omitempty"` -} - -// VirtualMachineExtensionHandlerInstanceView is the instance view of a virtual -// machine extension handler. -type VirtualMachineExtensionHandlerInstanceView struct { - Type *string `json:"type,omitempty"` - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` - Status *InstanceViewStatus `json:"status,omitempty"` -} - -// VirtualMachineExtensionImage is describes a Virtual Machine Extension Image. -type VirtualMachineExtensionImage struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` -} - -// VirtualMachineExtensionImageProperties is describes the properties of a -// Virtual Machine Extension Image. -type VirtualMachineExtensionImageProperties struct { - OperatingSystem *string `json:"operatingSystem,omitempty"` - ComputeRole *string `json:"computeRole,omitempty"` - HandlerSchema *string `json:"handlerSchema,omitempty"` - VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` - SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` -} - -// VirtualMachineExtensionInstanceView is the instance view of a virtual -// machine extension. -type VirtualMachineExtensionInstanceView struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` - Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` -} - -// VirtualMachineExtensionProperties is describes the properties of a Virtual -// Machine Extension. -type VirtualMachineExtensionProperties struct { - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Type *string `json:"type,omitempty"` - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` - AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` - Settings *map[string]interface{} `json:"settings,omitempty"` - ProtectedSettings *map[string]interface{} `json:"protectedSettings,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` -} - -// VirtualMachineIdentity is identity for the virtual machine. -type VirtualMachineIdentity struct { - PrincipalID *string `json:"principalId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - Type ResourceIdentityType `json:"type,omitempty"` -} - -// VirtualMachineImage is describes a Virtual Machine Image. -type VirtualMachineImage struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualMachineImageProperties `json:"properties,omitempty"` -} - -// VirtualMachineImageProperties is describes the properties of a Virtual -// Machine Image. -type VirtualMachineImageProperties struct { - Plan *PurchasePlan `json:"plan,omitempty"` - OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` - DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` -} - -// VirtualMachineImageResource is virtual machine image resource information. -type VirtualMachineImageResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// VirtualMachineInstanceView is the instance view of a virtual machine. -type VirtualMachineInstanceView struct { - PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` - PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` - RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` - VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` - Disks *[]DiskInstanceView `json:"disks,omitempty"` - Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` - BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` -} - -// VirtualMachineListResult is the List Virtual Machine operation response. -type VirtualMachineListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualMachine `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualMachineListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualMachineListResult) VirtualMachineListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualMachineProperties is describes the properties of a Virtual Machine. -type VirtualMachineProperties struct { - HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - OsProfile *OSProfile `json:"osProfile,omitempty"` - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` - AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` - LicenseType *string `json:"licenseType,omitempty"` - VMID *string `json:"vmId,omitempty"` -} - -// VirtualMachineScaleSet is describes a Virtual Machine Scale Set. -type VirtualMachineScaleSet struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Plan *Plan `json:"plan,omitempty"` - *VirtualMachineScaleSetProperties `json:"properties,omitempty"` - Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` -} - -// VirtualMachineScaleSetDataDisk is describes a virtual machine scale set data -// disk. -type VirtualMachineScaleSetDataDisk struct { - Name *string `json:"name,omitempty"` - Lun *int32 `json:"lun,omitempty"` - Caching CachingTypes `json:"caching,omitempty"` - CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` -} - -// VirtualMachineScaleSetExtension is describes a Virtual Machine Scale Set -// Extension. -type VirtualMachineScaleSetExtension struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` -} - -// VirtualMachineScaleSetExtensionProfile is describes a virtual machine scale -// set extension profile. -type VirtualMachineScaleSetExtensionProfile struct { - Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` -} - -// VirtualMachineScaleSetExtensionProperties is describes the properties of a -// Virtual Machine Scale Set Extension. -type VirtualMachineScaleSetExtensionProperties struct { - Publisher *string `json:"publisher,omitempty"` - Type *string `json:"type,omitempty"` - TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` - AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` - Settings *map[string]interface{} `json:"settings,omitempty"` - ProtectedSettings *map[string]interface{} `json:"protectedSettings,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VirtualMachineScaleSetIdentity is identity for the virtual machine scale -// set. -type VirtualMachineScaleSetIdentity struct { - PrincipalID *string `json:"principalId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - Type ResourceIdentityType `json:"type,omitempty"` -} - -// VirtualMachineScaleSetInstanceView is the instance view of a virtual machine -// scale set. -type VirtualMachineScaleSetInstanceView struct { - autorest.Response `json:"-"` - VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` - Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` -} - -// VirtualMachineScaleSetInstanceViewStatusesSummary is instance view statuses -// summary for virtual machines of a virtual machine scale set. -type VirtualMachineScaleSetInstanceViewStatusesSummary struct { - StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` -} - -// VirtualMachineScaleSetIPConfiguration is describes a virtual machine scale -// set network profile's IP configuration. -type VirtualMachineScaleSetIPConfiguration struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` -} - -// VirtualMachineScaleSetIPConfigurationProperties is describes a virtual -// machine scale set network profile's IP configuration properties. -type VirtualMachineScaleSetIPConfigurationProperties struct { - Subnet *APIEntityReference `json:"subnet,omitempty"` - ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` - LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` - LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` -} - -// VirtualMachineScaleSetListResult is the List Virtual Machine operation -// response. -type VirtualMachineScaleSetListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineScaleSet `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualMachineScaleSetListResult) VirtualMachineScaleSetListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualMachineScaleSetListSkusResult is the Virtual Machine Scale Set List -// Skus operation response. -type VirtualMachineScaleSetListSkusResult struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualMachineScaleSetListSkusResult) VirtualMachineScaleSetListSkusResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualMachineScaleSetListWithLinkResult is the List Virtual Machine -// operation response. -type VirtualMachineScaleSetListWithLinkResult struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineScaleSet `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualMachineScaleSetListWithLinkResult) VirtualMachineScaleSetListWithLinkResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualMachineScaleSetManagedDiskParameters is describes the parameters of a -// ScaleSet managed disk. -type VirtualMachineScaleSetManagedDiskParameters struct { - StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` -} - -// VirtualMachineScaleSetNetworkConfiguration is describes a virtual machine -// scale set network profile's network configurations. -type VirtualMachineScaleSetNetworkConfiguration struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` -} - -// VirtualMachineScaleSetNetworkConfigurationProperties is describes a virtual -// machine scale set network profile's IP configuration. -type VirtualMachineScaleSetNetworkConfigurationProperties struct { - Primary *bool `json:"primary,omitempty"` - IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` -} - -// VirtualMachineScaleSetNetworkProfile is describes a virtual machine scale -// set network profile. -type VirtualMachineScaleSetNetworkProfile struct { - NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` -} - -// VirtualMachineScaleSetOSDisk is describes a virtual machine scale set -// operating system disk. -type VirtualMachineScaleSetOSDisk struct { - Name *string `json:"name,omitempty"` - Caching CachingTypes `json:"caching,omitempty"` - CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` - OsType OperatingSystemTypes `json:"osType,omitempty"` - Image *VirtualHardDisk `json:"image,omitempty"` - VhdContainers *[]string `json:"vhdContainers,omitempty"` - ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` -} - -// VirtualMachineScaleSetOSProfile is describes a virtual machine scale set OS -// profile. -type VirtualMachineScaleSetOSProfile struct { - ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` - AdminUsername *string `json:"adminUsername,omitempty"` - AdminPassword *string `json:"adminPassword,omitempty"` - CustomData *string `json:"customData,omitempty"` - WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` - LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` - Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` -} - -// VirtualMachineScaleSetProperties is describes the properties of a Virtual -// Machine Scale Set. -type VirtualMachineScaleSetProperties struct { - UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` - VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Overprovision *bool `json:"overprovision,omitempty"` - SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` -} - -// VirtualMachineScaleSetSku is describes an available virtual machine scale -// set sku. -type VirtualMachineScaleSetSku struct { - ResourceType *string `json:"resourceType,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` -} - -// VirtualMachineScaleSetSkuCapacity is describes scaling information of a sku. -type VirtualMachineScaleSetSkuCapacity struct { - Minimum *int64 `json:"minimum,omitempty"` - Maximum *int64 `json:"maximum,omitempty"` - DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` - ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` -} - -// VirtualMachineScaleSetStorageProfile is describes a virtual machine scale -// set storage profile. -type VirtualMachineScaleSetStorageProfile struct { - ImageReference *ImageReference `json:"imageReference,omitempty"` - OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` - DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` -} - -// VirtualMachineScaleSetVM is describes a virtual machine scale set virtual -// machine. -type VirtualMachineScaleSetVM struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - InstanceID *string `json:"instanceId,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` - Plan *Plan `json:"plan,omitempty"` - Resources *[]VirtualMachineExtension `json:"resources,omitempty"` -} - -// VirtualMachineScaleSetVMExtensionsSummary is extensions summary for virtual -// machines of a virtual machine scale set. -type VirtualMachineScaleSetVMExtensionsSummary struct { - Name *string `json:"name,omitempty"` - StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` -} - -// VirtualMachineScaleSetVMInstanceIDs is specifies a list of virtual machine -// instance IDs from the VM scale set. -type VirtualMachineScaleSetVMInstanceIDs struct { - InstanceIds *[]string `json:"instanceIds,omitempty"` -} - -// VirtualMachineScaleSetVMInstanceRequiredIDs is specifies a list of virtual -// machine instance IDs from the VM scale set. -type VirtualMachineScaleSetVMInstanceRequiredIDs struct { - InstanceIds *[]string `json:"instanceIds,omitempty"` -} - -// VirtualMachineScaleSetVMInstanceView is the instance view of a virtual -// machine scale set VM. -type VirtualMachineScaleSetVMInstanceView struct { - autorest.Response `json:"-"` - PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` - PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` - RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` - VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` - Disks *[]DiskInstanceView `json:"disks,omitempty"` - Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` - BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` - Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` - PlacementGroupID *string `json:"placementGroupId,omitempty"` -} - -// VirtualMachineScaleSetVMListResult is the List Virtual Machine Scale Set VMs -// operation response. -type VirtualMachineScaleSetVMListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualMachineScaleSetVMListResult) VirtualMachineScaleSetVMListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualMachineScaleSetVMProfile is describes a virtual machine scale set -// virtual machine profile. -type VirtualMachineScaleSetVMProfile struct { - OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` - StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` - NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` - ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` -} - -// VirtualMachineScaleSetVMProperties is describes the properties of a virtual -// machine scale set virtual machine. -type VirtualMachineScaleSetVMProperties struct { - LatestModelApplied *bool `json:"latestModelApplied,omitempty"` - VMID *string `json:"vmId,omitempty"` - InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` - HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - OsProfile *OSProfile `json:"osProfile,omitempty"` - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` - AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - LicenseType *string `json:"licenseType,omitempty"` -} - -// VirtualMachineSize is describes the properties of a VM size. -type VirtualMachineSize struct { - Name *string `json:"name,omitempty"` - NumberOfCores *int32 `json:"numberOfCores,omitempty"` - OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` - ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` - MemoryInMB *int32 `json:"memoryInMB,omitempty"` - MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` -} - -// VirtualMachineSizeListResult is the List Virtual Machine operation response. -type VirtualMachineSizeListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualMachineSize `json:"value,omitempty"` -} - -// VirtualMachineStatusCodeCount is the status code and count of the virtual -// machine scale set instance view status summary. -type VirtualMachineStatusCodeCount struct { - Code *string `json:"code,omitempty"` - Count *int32 `json:"count,omitempty"` -} - -// WindowsConfiguration is describes Windows Configuration of the OS Profile. -type WindowsConfiguration struct { - ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` - EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` - AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` - WinRM *WinRMConfiguration `json:"winRM,omitempty"` -} - -// WinRMConfiguration is describes Windows Remote Management configuration of -// the VM -type WinRMConfiguration struct { - Listeners *[]WinRMListener `json:"listeners,omitempty"` -} - -// WinRMListener is describes Protocol and thumbprint of Windows Remote -// Management listener -type WinRMListener struct { - Protocol ProtocolTypes `json:"protocol,omitempty"` - CertificateURL *string `json:"certificateUrl,omitempty"` -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// CachingTypes enumerates the values for caching types. +type CachingTypes string + +const ( + // None specifies the none state for caching types. + None CachingTypes = "None" + // ReadOnly specifies the read only state for caching types. + ReadOnly CachingTypes = "ReadOnly" + // ReadWrite specifies the read write state for caching types. + ReadWrite CachingTypes = "ReadWrite" +) + +// ComponentNames enumerates the values for component names. +type ComponentNames string + +const ( + // MicrosoftWindowsShellSetup specifies the microsoft windows shell setup + // state for component names. + MicrosoftWindowsShellSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +// DiskCreateOptionTypes enumerates the values for disk create option types. +type DiskCreateOptionTypes string + +const ( + // Attach specifies the attach state for disk create option types. + Attach DiskCreateOptionTypes = "attach" + // Empty specifies the empty state for disk create option types. + Empty DiskCreateOptionTypes = "empty" + // FromImage specifies the from image state for disk create option types. + FromImage DiskCreateOptionTypes = "fromImage" +) + +// InstanceViewTypes enumerates the values for instance view types. +type InstanceViewTypes string + +const ( + // InstanceView specifies the instance view state for instance view types. + InstanceView InstanceViewTypes = "instanceView" +) + +// OperatingSystemStateTypes enumerates the values for operating system state +// types. +type OperatingSystemStateTypes string + +const ( + // Generalized specifies the generalized state for operating system state + // types. + Generalized OperatingSystemStateTypes = "Generalized" + // Specialized specifies the specialized state for operating system state + // types. + Specialized OperatingSystemStateTypes = "Specialized" +) + +// OperatingSystemTypes enumerates the values for operating system types. +type OperatingSystemTypes string + +const ( + // Linux specifies the linux state for operating system types. + Linux OperatingSystemTypes = "Linux" + // Windows specifies the windows state for operating system types. + Windows OperatingSystemTypes = "Windows" +) + +// PassNames enumerates the values for pass names. +type PassNames string + +const ( + // OobeSystem specifies the oobe system state for pass names. + OobeSystem PassNames = "oobeSystem" +) + +// ProtocolTypes enumerates the values for protocol types. +type ProtocolTypes string + +const ( + // HTTP specifies the http state for protocol types. + HTTP ProtocolTypes = "Http" + // HTTPS specifies the https state for protocol types. + HTTPS ProtocolTypes = "Https" +) + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned specifies the system assigned state for resource identity + // type. + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// SettingNames enumerates the values for setting names. +type SettingNames string + +const ( + // AutoLogon specifies the auto logon state for setting names. + AutoLogon SettingNames = "AutoLogon" + // FirstLogonCommands specifies the first logon commands state for setting + // names. + FirstLogonCommands SettingNames = "FirstLogonCommands" +) + +// StatusLevelTypes enumerates the values for status level types. +type StatusLevelTypes string + +const ( + // Error specifies the error state for status level types. + Error StatusLevelTypes = "Error" + // Info specifies the info state for status level types. + Info StatusLevelTypes = "Info" + // Warning specifies the warning state for status level types. + Warning StatusLevelTypes = "Warning" +) + +// StorageAccountTypes enumerates the values for storage account types. +type StorageAccountTypes string + +const ( + // PremiumLRS specifies the premium lrs state for storage account types. + PremiumLRS StorageAccountTypes = "Premium_LRS" + // StandardLRS specifies the standard lrs state for storage account types. + StandardLRS StorageAccountTypes = "Standard_LRS" +) + +// UpgradeMode enumerates the values for upgrade mode. +type UpgradeMode string + +const ( + // Automatic specifies the automatic state for upgrade mode. + Automatic UpgradeMode = "Automatic" + // Manual specifies the manual state for upgrade mode. + Manual UpgradeMode = "Manual" +) + +// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine +// scale set sku scale type. +type VirtualMachineScaleSetSkuScaleType string + +const ( + // VirtualMachineScaleSetSkuScaleTypeAutomatic specifies the virtual + // machine scale set sku scale type automatic state for virtual machine + // scale set sku scale type. + VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" + // VirtualMachineScaleSetSkuScaleTypeNone specifies the virtual machine + // scale set sku scale type none state for virtual machine scale set sku + // scale type. + VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" +) + +// VirtualMachineSizeTypes enumerates the values for virtual machine size +// types. +type VirtualMachineSizeTypes string + +const ( + // BasicA0 specifies the basic a0 state for virtual machine size types. + BasicA0 VirtualMachineSizeTypes = "Basic_A0" + // BasicA1 specifies the basic a1 state for virtual machine size types. + BasicA1 VirtualMachineSizeTypes = "Basic_A1" + // BasicA2 specifies the basic a2 state for virtual machine size types. + BasicA2 VirtualMachineSizeTypes = "Basic_A2" + // BasicA3 specifies the basic a3 state for virtual machine size types. + BasicA3 VirtualMachineSizeTypes = "Basic_A3" + // BasicA4 specifies the basic a4 state for virtual machine size types. + BasicA4 VirtualMachineSizeTypes = "Basic_A4" + // StandardA0 specifies the standard a0 state for virtual machine size + // types. + StandardA0 VirtualMachineSizeTypes = "Standard_A0" + // StandardA1 specifies the standard a1 state for virtual machine size + // types. + StandardA1 VirtualMachineSizeTypes = "Standard_A1" + // StandardA10 specifies the standard a10 state for virtual machine size + // types. + StandardA10 VirtualMachineSizeTypes = "Standard_A10" + // StandardA11 specifies the standard a11 state for virtual machine size + // types. + StandardA11 VirtualMachineSizeTypes = "Standard_A11" + // StandardA2 specifies the standard a2 state for virtual machine size + // types. + StandardA2 VirtualMachineSizeTypes = "Standard_A2" + // StandardA3 specifies the standard a3 state for virtual machine size + // types. + StandardA3 VirtualMachineSizeTypes = "Standard_A3" + // StandardA4 specifies the standard a4 state for virtual machine size + // types. + StandardA4 VirtualMachineSizeTypes = "Standard_A4" + // StandardA5 specifies the standard a5 state for virtual machine size + // types. + StandardA5 VirtualMachineSizeTypes = "Standard_A5" + // StandardA6 specifies the standard a6 state for virtual machine size + // types. + StandardA6 VirtualMachineSizeTypes = "Standard_A6" + // StandardA7 specifies the standard a7 state for virtual machine size + // types. + StandardA7 VirtualMachineSizeTypes = "Standard_A7" + // StandardA8 specifies the standard a8 state for virtual machine size + // types. + StandardA8 VirtualMachineSizeTypes = "Standard_A8" + // StandardA9 specifies the standard a9 state for virtual machine size + // types. + StandardA9 VirtualMachineSizeTypes = "Standard_A9" + // StandardD1 specifies the standard d1 state for virtual machine size + // types. + StandardD1 VirtualMachineSizeTypes = "Standard_D1" + // StandardD11 specifies the standard d11 state for virtual machine size + // types. + StandardD11 VirtualMachineSizeTypes = "Standard_D11" + // StandardD11V2 specifies the standard d11v2 state for virtual machine + // size types. + StandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" + // StandardD12 specifies the standard d12 state for virtual machine size + // types. + StandardD12 VirtualMachineSizeTypes = "Standard_D12" + // StandardD12V2 specifies the standard d12v2 state for virtual machine + // size types. + StandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" + // StandardD13 specifies the standard d13 state for virtual machine size + // types. + StandardD13 VirtualMachineSizeTypes = "Standard_D13" + // StandardD13V2 specifies the standard d13v2 state for virtual machine + // size types. + StandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" + // StandardD14 specifies the standard d14 state for virtual machine size + // types. + StandardD14 VirtualMachineSizeTypes = "Standard_D14" + // StandardD14V2 specifies the standard d14v2 state for virtual machine + // size types. + StandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2" + // StandardD15V2 specifies the standard d15v2 state for virtual machine + // size types. + StandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2" + // StandardD1V2 specifies the standard d1v2 state for virtual machine size + // types. + StandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" + // StandardD2 specifies the standard d2 state for virtual machine size + // types. + StandardD2 VirtualMachineSizeTypes = "Standard_D2" + // StandardD2V2 specifies the standard d2v2 state for virtual machine size + // types. + StandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" + // StandardD3 specifies the standard d3 state for virtual machine size + // types. + StandardD3 VirtualMachineSizeTypes = "Standard_D3" + // StandardD3V2 specifies the standard d3v2 state for virtual machine size + // types. + StandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" + // StandardD4 specifies the standard d4 state for virtual machine size + // types. + StandardD4 VirtualMachineSizeTypes = "Standard_D4" + // StandardD4V2 specifies the standard d4v2 state for virtual machine size + // types. + StandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" + // StandardD5V2 specifies the standard d5v2 state for virtual machine size + // types. + StandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" + // StandardDS1 specifies the standard ds1 state for virtual machine size + // types. + StandardDS1 VirtualMachineSizeTypes = "Standard_DS1" + // StandardDS11 specifies the standard ds11 state for virtual machine size + // types. + StandardDS11 VirtualMachineSizeTypes = "Standard_DS11" + // StandardDS11V2 specifies the standard ds11v2 state for virtual machine + // size types. + StandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2" + // StandardDS12 specifies the standard ds12 state for virtual machine size + // types. + StandardDS12 VirtualMachineSizeTypes = "Standard_DS12" + // StandardDS12V2 specifies the standard ds12v2 state for virtual machine + // size types. + StandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2" + // StandardDS13 specifies the standard ds13 state for virtual machine size + // types. + StandardDS13 VirtualMachineSizeTypes = "Standard_DS13" + // StandardDS13V2 specifies the standard ds13v2 state for virtual machine + // size types. + StandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2" + // StandardDS14 specifies the standard ds14 state for virtual machine size + // types. + StandardDS14 VirtualMachineSizeTypes = "Standard_DS14" + // StandardDS14V2 specifies the standard ds14v2 state for virtual machine + // size types. + StandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2" + // StandardDS15V2 specifies the standard ds15v2 state for virtual machine + // size types. + StandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2" + // StandardDS1V2 specifies the standard ds1v2 state for virtual machine + // size types. + StandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2" + // StandardDS2 specifies the standard ds2 state for virtual machine size + // types. + StandardDS2 VirtualMachineSizeTypes = "Standard_DS2" + // StandardDS2V2 specifies the standard ds2v2 state for virtual machine + // size types. + StandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2" + // StandardDS3 specifies the standard ds3 state for virtual machine size + // types. + StandardDS3 VirtualMachineSizeTypes = "Standard_DS3" + // StandardDS3V2 specifies the standard ds3v2 state for virtual machine + // size types. + StandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2" + // StandardDS4 specifies the standard ds4 state for virtual machine size + // types. + StandardDS4 VirtualMachineSizeTypes = "Standard_DS4" + // StandardDS4V2 specifies the standard ds4v2 state for virtual machine + // size types. + StandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2" + // StandardDS5V2 specifies the standard ds5v2 state for virtual machine + // size types. + StandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2" + // StandardG1 specifies the standard g1 state for virtual machine size + // types. + StandardG1 VirtualMachineSizeTypes = "Standard_G1" + // StandardG2 specifies the standard g2 state for virtual machine size + // types. + StandardG2 VirtualMachineSizeTypes = "Standard_G2" + // StandardG3 specifies the standard g3 state for virtual machine size + // types. + StandardG3 VirtualMachineSizeTypes = "Standard_G3" + // StandardG4 specifies the standard g4 state for virtual machine size + // types. + StandardG4 VirtualMachineSizeTypes = "Standard_G4" + // StandardG5 specifies the standard g5 state for virtual machine size + // types. + StandardG5 VirtualMachineSizeTypes = "Standard_G5" + // StandardGS1 specifies the standard gs1 state for virtual machine size + // types. + StandardGS1 VirtualMachineSizeTypes = "Standard_GS1" + // StandardGS2 specifies the standard gs2 state for virtual machine size + // types. + StandardGS2 VirtualMachineSizeTypes = "Standard_GS2" + // StandardGS3 specifies the standard gs3 state for virtual machine size + // types. + StandardGS3 VirtualMachineSizeTypes = "Standard_GS3" + // StandardGS4 specifies the standard gs4 state for virtual machine size + // types. + StandardGS4 VirtualMachineSizeTypes = "Standard_GS4" + // StandardGS5 specifies the standard gs5 state for virtual machine size + // types. + StandardGS5 VirtualMachineSizeTypes = "Standard_GS5" +) + +// AdditionalUnattendContent is additional XML formatted information that can +// be included in the Unattend.xml file, which is used by Windows Setup. +// Contents are defined by setting name, component name, and the pass in which +// the content is a applied. +type AdditionalUnattendContent struct { + PassName PassNames `json:"passName,omitempty"` + ComponentName ComponentNames `json:"componentName,omitempty"` + SettingName SettingNames `json:"settingName,omitempty"` + Content *string `json:"content,omitempty"` +} + +// APIEntityReference is the API entity reference. +type APIEntityReference struct { + ID *string `json:"id,omitempty"` +} + +// APIError is api error. +type APIError struct { + Details *[]APIErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// APIErrorBase is api error base. +type APIErrorBase struct { + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AvailabilitySet is create or update availability set parameters. +type AvailabilitySet struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// AvailabilitySetListResult is the List Availability Set operation response. +type AvailabilitySetListResult struct { + autorest.Response `json:"-"` + Value *[]AvailabilitySet `json:"value,omitempty"` +} + +// AvailabilitySetProperties is the instance view of a resource. +type AvailabilitySetProperties struct { + PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` + PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Managed *bool `json:"managed,omitempty"` +} + +// BootDiagnostics is describes Boot Diagnostics. +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageURI *string `json:"storageUri,omitempty"` +} + +// BootDiagnosticsInstanceView is the instance view of a virtual machine boot +// diagnostics. +type BootDiagnosticsInstanceView struct { + ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` +} + +// DataDisk is describes a data disk. +type DataDisk struct { + Lun *int32 `json:"lun,omitempty"` + Name *string `json:"name,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Caching CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// DataDiskImage is contains the data disk images information. +type DataDiskImage struct { + Lun *int32 `json:"lun,omitempty"` +} + +// DiagnosticsProfile is describes a diagnostics profile. +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} + +// DiskEncryptionSettings is describes a Encryption Settings for a Disk +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// DiskInstanceView is the instance view of the disk. +type DiskInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// HardwareProfile is describes a hardware profile. +type HardwareProfile struct { + VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"` +} + +// Image is describes an Image. +type Image struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ImageProperties `json:"properties,omitempty"` +} + +// ImageDataDisk is describes a data disk. +type ImageDataDisk struct { + Lun *int32 `json:"lun,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + BlobURI *string `json:"blobUri,omitempty"` + Caching CachingTypes `json:"caching,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` +} + +// ImageListResult is the List Image operation response. +type ImageListResult struct { + autorest.Response `json:"-"` + Value *[]Image `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ImageListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ImageListResult) ImageListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ImageOSDisk is describes an Operating System disk. +type ImageOSDisk struct { + OsType OperatingSystemTypes `json:"osType,omitempty"` + OsState OperatingSystemStateTypes `json:"osState,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + BlobURI *string `json:"blobUri,omitempty"` + Caching CachingTypes `json:"caching,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` +} + +// ImageProperties is describes the properties of an Image. +type ImageProperties struct { + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ImageReference is the image reference. +type ImageReference struct { + ID *string `json:"id,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Offer *string `json:"offer,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} + +// ImageStorageProfile is describes a storage profile. +type ImageStorageProfile struct { + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` +} + +// InnerError is inner error details. +type InnerError struct { + Exceptiontype *string `json:"exceptiontype,omitempty"` + Errordetail *string `json:"errordetail,omitempty"` +} + +// InstanceViewStatus is instance view status. +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + Level StatusLevelTypes `json:"level,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Message *string `json:"message,omitempty"` + Time *date.Time `json:"time,omitempty"` +} + +// KeyVaultKeyReference is describes a reference to Key Vault Key +type KeyVaultKeyReference struct { + KeyURL *string `json:"keyUrl,omitempty"` + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// KeyVaultSecretReference is describes a reference to Key Vault Secret +type KeyVaultSecretReference struct { + SecretURL *string `json:"secretUrl,omitempty"` + SourceVault *SubResource `json:"sourceVault,omitempty"` +} + +// LinuxConfiguration is describes Windows configuration of the OS Profile. +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// ListUsagesResult is the List Usages operation response. +type ListUsagesResult struct { + autorest.Response `json:"-"` + Value *[]Usage `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListUsagesResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListUsagesResult) ListUsagesResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ListVirtualMachineExtensionImage is +type ListVirtualMachineExtensionImage struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineExtensionImage `json:"value,omitempty"` +} + +// ListVirtualMachineImageResource is +type ListVirtualMachineImageResource struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineImageResource `json:"value,omitempty"` +} + +// LongRunningOperationProperties is compute-specific operation properties, +// including output +type LongRunningOperationProperties struct { + Output *map[string]interface{} `json:"output,omitempty"` +} + +// ManagedDiskParameters is the parameters of a managed disk. +type ManagedDiskParameters struct { + ID *string `json:"id,omitempty"` + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// NetworkInterfaceReference is describes a network interface reference. +type NetworkInterfaceReference struct { + ID *string `json:"id,omitempty"` + *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} + +// NetworkInterfaceReferenceProperties is describes a network interface +// reference properties. +type NetworkInterfaceReferenceProperties struct { + Primary *bool `json:"primary,omitempty"` +} + +// NetworkProfile is describes a network profile. +type NetworkProfile struct { + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} + +// OperationStatusResponse is operation status response +type OperationStatusResponse struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Error *APIError `json:"error,omitempty"` +} + +// OSDisk is describes an Operating System disk. +type OSDisk struct { + OsType OperatingSystemTypes `json:"osType,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Name *string `json:"name,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Caching CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// OSDiskImage is contains the os disk image information. +type OSDiskImage struct { + OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` +} + +// OSProfile is describes an OS profile. +type OSProfile struct { + ComputerName *string `json:"computerName,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` +} + +// Plan is plan for the resource. +type Plan struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` +} + +// PurchasePlan is used for establishing the purchase context of any 3rd Party +// artifact through MarketPlace. +type PurchasePlan struct { + Publisher *string `json:"publisher,omitempty"` + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Sku is describes a virtual machine scale set sku. +type Sku struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Capacity *int64 `json:"capacity,omitempty"` +} + +// SSHConfiguration is sSH configuration for Linux based VMs running on Azure +type SSHConfiguration struct { + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey is contains information about SSH certificate public key and +// the path on the Linux VM where the public key is placed. +type SSHPublicKey struct { + Path *string `json:"path,omitempty"` + KeyData *string `json:"keyData,omitempty"` +} + +// StorageProfile is describes a storage profile. +type StorageProfile struct { + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// SubResourceReadOnly is +type SubResourceReadOnly struct { + ID *string `json:"id,omitempty"` +} + +// UpgradePolicy is describes an upgrade policy - automatic or manual. +type UpgradePolicy struct { + Mode UpgradeMode `json:"mode,omitempty"` +} + +// Usage is describes Compute Resource Usage. +type Usage struct { + Unit *string `json:"unit,omitempty"` + CurrentValue *int32 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *UsageName `json:"name,omitempty"` +} + +// UsageName is the Usage Names. +type UsageName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// VaultCertificate is describes a single certificate reference in a Key Vault, +// and where the certificate should reside on the VM. +type VaultCertificate struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + CertificateStore *string `json:"certificateStore,omitempty"` +} + +// VaultSecretGroup is describes a set of certificates which are all in the +// same Key Vault. +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} + +// VirtualHardDisk is describes the uri of a disk. +type VirtualHardDisk struct { + URI *string `json:"uri,omitempty"` +} + +// VirtualMachine is describes a Virtual Machine. +type VirtualMachine struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineProperties `json:"properties,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + Identity *VirtualMachineIdentity `json:"identity,omitempty"` +} + +// VirtualMachineAgentInstanceView is the instance view of the VM Agent running +// on the virtual machine. +type VirtualMachineAgentInstanceView struct { + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineCaptureParameters is capture Virtual Machine parameters. +type VirtualMachineCaptureParameters struct { + VhdPrefix *string `json:"vhdPrefix,omitempty"` + DestinationContainerName *string `json:"destinationContainerName,omitempty"` + OverwriteVhds *bool `json:"overwriteVhds,omitempty"` +} + +// VirtualMachineCaptureResult is resource Id. +type VirtualMachineCaptureResult struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *VirtualMachineCaptureResultProperties `json:"properties,omitempty"` +} + +// VirtualMachineCaptureResultProperties is compute-specific operation +// properties, including output +type VirtualMachineCaptureResultProperties struct { + Output *map[string]interface{} `json:"output,omitempty"` +} + +// VirtualMachineExtension is describes a Virtual Machine Extension. +type VirtualMachineExtension struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualMachineExtensionProperties `json:"properties,omitempty"` +} + +// VirtualMachineExtensionHandlerInstanceView is the instance view of a virtual +// machine extension handler. +type VirtualMachineExtensionHandlerInstanceView struct { + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} + +// VirtualMachineExtensionImage is describes a Virtual Machine Extension Image. +type VirtualMachineExtensionImage struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` +} + +// VirtualMachineExtensionImageProperties is describes the properties of a +// Virtual Machine Extension Image. +type VirtualMachineExtensionImageProperties struct { + OperatingSystem *string `json:"operatingSystem,omitempty"` + ComputeRole *string `json:"computeRole,omitempty"` + HandlerSchema *string `json:"handlerSchema,omitempty"` + VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` + SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` +} + +// VirtualMachineExtensionInstanceView is the instance view of a virtual +// machine extension. +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineExtensionProperties is describes the properties of a Virtual +// Machine Extension. +type VirtualMachineExtensionProperties struct { + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Settings *map[string]interface{} `json:"settings,omitempty"` + ProtectedSettings *map[string]interface{} `json:"protectedSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` +} + +// VirtualMachineIdentity is identity for the virtual machine. +type VirtualMachineIdentity struct { + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + Type ResourceIdentityType `json:"type,omitempty"` +} + +// VirtualMachineImage is describes a Virtual Machine Image. +type VirtualMachineImage struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualMachineImageProperties `json:"properties,omitempty"` +} + +// VirtualMachineImageProperties is describes the properties of a Virtual +// Machine Image. +type VirtualMachineImageProperties struct { + Plan *PurchasePlan `json:"plan,omitempty"` + OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` + DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` +} + +// VirtualMachineImageResource is virtual machine image resource information. +type VirtualMachineImageResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// VirtualMachineInstanceView is the instance view of a virtual machine. +type VirtualMachineInstanceView struct { + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineListResult is the List Virtual Machine operation response. +type VirtualMachineListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualMachine `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualMachineListResult) VirtualMachineListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualMachineProperties is describes the properties of a Virtual Machine. +type VirtualMachineProperties struct { + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + VMID *string `json:"vmId,omitempty"` +} + +// VirtualMachineScaleSet is describes a Virtual Machine Scale Set. +type VirtualMachineScaleSet struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Plan *Plan `json:"plan,omitempty"` + *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` +} + +// VirtualMachineScaleSetDataDisk is describes a virtual machine scale set data +// disk. +type VirtualMachineScaleSetDataDisk struct { + Name *string `json:"name,omitempty"` + Lun *int32 `json:"lun,omitempty"` + Caching CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// VirtualMachineScaleSetExtension is describes a Virtual Machine Scale Set +// Extension. +type VirtualMachineScaleSetExtension struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetExtensionProfile is describes a virtual machine scale +// set extension profile. +type VirtualMachineScaleSetExtensionProfile struct { + Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` +} + +// VirtualMachineScaleSetExtensionProperties is describes the properties of a +// Virtual Machine Scale Set Extension. +type VirtualMachineScaleSetExtensionProperties struct { + Publisher *string `json:"publisher,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + Settings *map[string]interface{} `json:"settings,omitempty"` + ProtectedSettings *map[string]interface{} `json:"protectedSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VirtualMachineScaleSetIdentity is identity for the virtual machine scale +// set. +type VirtualMachineScaleSetIdentity struct { + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + Type ResourceIdentityType `json:"type,omitempty"` +} + +// VirtualMachineScaleSetInstanceView is the instance view of a virtual machine +// scale set. +type VirtualMachineScaleSetInstanceView struct { + autorest.Response `json:"-"` + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` + Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +// VirtualMachineScaleSetInstanceViewStatusesSummary is instance view statuses +// summary for virtual machines of a virtual machine scale set. +type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} + +// VirtualMachineScaleSetIPConfiguration is describes a virtual machine scale +// set network profile's IP configuration. +type VirtualMachineScaleSetIPConfiguration struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetIPConfigurationProperties is describes a virtual +// machine scale set network profile's IP configuration properties. +type VirtualMachineScaleSetIPConfigurationProperties struct { + Subnet *APIEntityReference `json:"subnet,omitempty"` + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` +} + +// VirtualMachineScaleSetListResult is the List Virtual Machine operation +// response. +type VirtualMachineScaleSetListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineScaleSet `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualMachineScaleSetListResult) VirtualMachineScaleSetListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualMachineScaleSetListSkusResult is the Virtual Machine Scale Set List +// Skus operation response. +type VirtualMachineScaleSetListSkusResult struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualMachineScaleSetListSkusResult) VirtualMachineScaleSetListSkusResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualMachineScaleSetListWithLinkResult is the List Virtual Machine +// operation response. +type VirtualMachineScaleSetListWithLinkResult struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineScaleSet `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualMachineScaleSetListWithLinkResult) VirtualMachineScaleSetListWithLinkResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualMachineScaleSetManagedDiskParameters is describes the parameters of a +// ScaleSet managed disk. +type VirtualMachineScaleSetManagedDiskParameters struct { + StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfiguration is describes a virtual machine +// scale set network profile's network configurations. +type VirtualMachineScaleSetNetworkConfiguration struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` +} + +// VirtualMachineScaleSetNetworkConfigurationProperties is describes a virtual +// machine scale set network profile's IP configuration. +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + Primary *bool `json:"primary,omitempty"` + IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` +} + +// VirtualMachineScaleSetNetworkProfile is describes a virtual machine scale +// set network profile. +type VirtualMachineScaleSetNetworkProfile struct { + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} + +// VirtualMachineScaleSetOSDisk is describes a virtual machine scale set +// operating system disk. +type VirtualMachineScaleSetOSDisk struct { + Name *string `json:"name,omitempty"` + Caching CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` + OsType OperatingSystemTypes `json:"osType,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + VhdContainers *[]string `json:"vhdContainers,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` +} + +// VirtualMachineScaleSetOSProfile is describes a virtual machine scale set OS +// profile. +type VirtualMachineScaleSetOSProfile struct { + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` +} + +// VirtualMachineScaleSetProperties is describes the properties of a Virtual +// Machine Scale Set. +type VirtualMachineScaleSetProperties struct { + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Overprovision *bool `json:"overprovision,omitempty"` + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` +} + +// VirtualMachineScaleSetSku is describes an available virtual machine scale +// set sku. +type VirtualMachineScaleSetSku struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` +} + +// VirtualMachineScaleSetSkuCapacity is describes scaling information of a sku. +type VirtualMachineScaleSetSkuCapacity struct { + Minimum *int64 `json:"minimum,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` + ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` +} + +// VirtualMachineScaleSetStorageProfile is describes a virtual machine scale +// set storage profile. +type VirtualMachineScaleSetStorageProfile struct { + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` +} + +// VirtualMachineScaleSetVM is describes a virtual machine scale set virtual +// machine. +type VirtualMachineScaleSetVM struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + InstanceID *string `json:"instanceId,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` +} + +// VirtualMachineScaleSetVMExtensionsSummary is extensions summary for virtual +// machines of a virtual machine scale set. +type VirtualMachineScaleSetVMExtensionsSummary struct { + Name *string `json:"name,omitempty"` + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceIDs is specifies a list of virtual machine +// instance IDs from the VM scale set. +type VirtualMachineScaleSetVMInstanceIDs struct { + InstanceIds *[]string `json:"instanceIds,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceRequiredIDs is specifies a list of virtual +// machine instance IDs from the VM scale set. +type VirtualMachineScaleSetVMInstanceRequiredIDs struct { + InstanceIds *[]string `json:"instanceIds,omitempty"` +} + +// VirtualMachineScaleSetVMInstanceView is the instance view of a virtual +// machine scale set VM. +type VirtualMachineScaleSetVMInstanceView struct { + autorest.Response `json:"-"` + PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` + PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + PlacementGroupID *string `json:"placementGroupId,omitempty"` +} + +// VirtualMachineScaleSetVMListResult is the List Virtual Machine Scale Set VMs +// operation response. +type VirtualMachineScaleSetVMListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualMachineScaleSetVMListResult) VirtualMachineScaleSetVMListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualMachineScaleSetVMProfile is describes a virtual machine scale set +// virtual machine profile. +type VirtualMachineScaleSetVMProfile struct { + OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` +} + +// VirtualMachineScaleSetVMProperties is describes the properties of a virtual +// machine scale set virtual machine. +type VirtualMachineScaleSetVMProperties struct { + LatestModelApplied *bool `json:"latestModelApplied,omitempty"` + VMID *string `json:"vmId,omitempty"` + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` +} + +// VirtualMachineSize is describes the properties of a VM size. +type VirtualMachineSize struct { + Name *string `json:"name,omitempty"` + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` + MemoryInMB *int32 `json:"memoryInMB,omitempty"` + MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` +} + +// VirtualMachineSizeListResult is the List Virtual Machine operation response. +type VirtualMachineSizeListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualMachineSize `json:"value,omitempty"` +} + +// VirtualMachineStatusCodeCount is the status code and count of the virtual +// machine scale set instance view status summary. +type VirtualMachineStatusCodeCount struct { + Code *string `json:"code,omitempty"` + Count *int32 `json:"count,omitempty"` +} + +// WindowsConfiguration is describes Windows Configuration of the OS Profile. +type WindowsConfiguration struct { + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} + +// WinRMConfiguration is describes Windows Remote Management configuration of +// the VM +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} + +// WinRMListener is describes Protocol and thumbprint of Windows Remote +// Management listener +type WinRMListener struct { + Protocol ProtocolTypes `json:"protocol,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go index 286b5dffb7..97c53e0efd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go @@ -1,137 +1,137 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UsageClient is the the Compute Management Client. -type UsageClient struct { - ManagementClient -} - -// NewUsageClient creates an instance of the UsageClient client. -func NewUsageClient(subscriptionID string) UsageClient { - return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsageClientWithBaseURI creates an instance of the UsageClient client. -func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { - return UsageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets, for the specified location, the current compute resource usage -// information as well as the limits for compute resources under the -// subscription. -// -// location is the location for which resource usage is queried. -func (client UsageClient) List(location string) (result ListUsagesResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "compute.UsageClient", "List") - } - - req, err := client.ListPreparer(location) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsageClient) ListPreparer(location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client UsageClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) { - req, err := lastResults.ListUsagesResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to next results request") - } - - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UsageClient is the the Compute Management Client. +type UsageClient struct { + ManagementClient +} + +// NewUsageClient creates an instance of the UsageClient client. +func NewUsageClient(subscriptionID string) UsageClient { + return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageClientWithBaseURI creates an instance of the UsageClient client. +func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { + return UsageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets, for the specified location, the current compute resource usage +// information as well as the limits for compute resources under the +// subscription. +// +// location is the location for which resource usage is queried. +func (client UsageClient) List(location string) (result ListUsagesResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "compute.UsageClient", "List") + } + + req, err := client.ListPreparer(location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageClient) ListPreparer(location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client UsageClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) { + req, err := lastResults.ListUsagesResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go index 5b008064ed..a5318ebf79 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go @@ -1,29 +1,29 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-compute/2016-04-30-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-compute/2016-04-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go index 45db05ed2b..fcd1227042 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go @@ -1,247 +1,247 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualMachineExtensionImagesClient is the the Compute Management Client. -type VirtualMachineExtensionImagesClient struct { - ManagementClient -} - -// NewVirtualMachineExtensionImagesClient creates an instance of the -// VirtualMachineExtensionImagesClient client. -func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient { - return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the -// VirtualMachineExtensionImagesClient client. -func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient { - return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a virtual machine extension image. -// -func (client VirtualMachineExtensionImagesClient) Get(location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) { - req, err := client.GetPreparer(location, publisherName, typeParameter, version) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, publisherName string, typeParameter string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "publisherName": autorest.Encode("path", publisherName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "type": autorest.Encode("path", typeParameter), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Response) (result VirtualMachineExtensionImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTypes gets a list of virtual machine extension image types. -// -func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) { - req, err := client.ListTypesPreparer(location, publisherName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request") - return - } - - resp, err := client.ListTypesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request") - return - } - - result, err = client.ListTypesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request") - } - - return -} - -// ListTypesPreparer prepares the ListTypes request. -func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location string, publisherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "publisherName": autorest.Encode("path", publisherName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListTypesSender sends the ListTypes request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListTypesResponder handles the response to the ListTypes request. The method always -// closes the http.Response Body. -func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVersions gets a list of virtual machine extension image versions. -// -// filter is the filter to apply on the operation. -func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) { - req, err := client.ListVersionsPreparer(location, publisherName, typeParameter, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request") - return - } - - resp, err := client.ListVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request") - return - } - - result, err = client.ListVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request") - } - - return -} - -// ListVersionsPreparer prepares the ListVersions request. -func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "publisherName": autorest.Encode("path", publisherName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "type": autorest.Encode("path", typeParameter), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVersionsSender sends the ListVersions request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVersionsResponder handles the response to the ListVersions request. The method always -// closes the http.Response Body. -func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualMachineExtensionImagesClient is the the Compute Management Client. +type VirtualMachineExtensionImagesClient struct { + ManagementClient +} + +// NewVirtualMachineExtensionImagesClient creates an instance of the +// VirtualMachineExtensionImagesClient client. +func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient { + return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the +// VirtualMachineExtensionImagesClient client. +func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient { + return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a virtual machine extension image. +// +func (client VirtualMachineExtensionImagesClient) Get(location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) { + req, err := client.GetPreparer(location, publisherName, typeParameter, version) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, publisherName string, typeParameter string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "type": autorest.Encode("path", typeParameter), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Response) (result VirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListTypes gets a list of virtual machine extension image types. +// +func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) { + req, err := client.ListTypesPreparer(location, publisherName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request") + return + } + + resp, err := client.ListTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request") + return + } + + result, err = client.ListTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request") + } + + return +} + +// ListTypesPreparer prepares the ListTypes request. +func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location string, publisherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListTypesSender sends the ListTypes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListTypesResponder handles the response to the ListTypes request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVersions gets a list of virtual machine extension image versions. +// +// filter is the filter to apply on the operation. +func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) { + req, err := client.ListVersionsPreparer(location, publisherName, typeParameter, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request") + return + } + + resp, err := client.ListVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request") + return + } + + result, err = client.ListVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request") + } + + return +} + +// ListVersionsPreparer prepares the ListVersions request. +func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "type": autorest.Encode("path", typeParameter), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVersionsSender sends the ListVersions request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVersionsResponder handles the response to the ListVersions request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go index 1438b9a5e7..7a876cfef1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go @@ -1,286 +1,286 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualMachineExtensionsClient is the the Compute Management Client. -type VirtualMachineExtensionsClient struct { - ManagementClient -} - -// NewVirtualMachineExtensionsClient creates an instance of the -// VirtualMachineExtensionsClient client. -func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient { - return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the -// VirtualMachineExtensionsClient client. -func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient { - return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the operation to create or update the extension. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine where the extension should be create or updated. -// VMExtensionName is the name of the virtual machine extension. -// extensionParameters is parameters supplied to the Create Virtual Machine -// Extension operation. -func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (<-chan VirtualMachineExtension, <-chan error) { - resultChan := make(chan VirtualMachineExtension, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result VirtualMachineExtension - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, VMName, VMExtensionName, extensionParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmExtensionName": autorest.Encode("path", VMExtensionName), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), - autorest.WithJSON(extensionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the operation to delete the extension. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine where the extension should be deleted. VMExtensionName -// is the name of the virtual machine extension. -func (client VirtualMachineExtensionsClient) Delete(resourceGroupName string, VMName string, VMExtensionName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, VMName, VMExtensionName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName string, VMName string, VMExtensionName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmExtensionName": autorest.Encode("path", VMExtensionName), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get the operation to get the extension. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine containing the extension. VMExtensionName is the name of -// the virtual machine extension. expand is the expand expression to apply on -// the operation. -func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) { - req, err := client.GetPreparer(resourceGroupName, VMName, VMExtensionName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmExtensionName": autorest.Encode("path", VMExtensionName), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineExtension, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualMachineExtensionsClient is the the Compute Management Client. +type VirtualMachineExtensionsClient struct { + ManagementClient +} + +// NewVirtualMachineExtensionsClient creates an instance of the +// VirtualMachineExtensionsClient client. +func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient { + return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the +// VirtualMachineExtensionsClient client. +func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient { + return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation to create or update the extension. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine where the extension should be create or updated. +// VMExtensionName is the name of the virtual machine extension. +// extensionParameters is parameters supplied to the Create Virtual Machine +// Extension operation. +func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (<-chan VirtualMachineExtension, <-chan error) { + resultChan := make(chan VirtualMachineExtension, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VirtualMachineExtension + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, VMName, VMExtensionName, extensionParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithJSON(extensionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation to delete the extension. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine where the extension should be deleted. VMExtensionName +// is the name of the virtual machine extension. +func (client VirtualMachineExtensionsClient) Delete(resourceGroupName string, VMName string, VMExtensionName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, VMName, VMExtensionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName string, VMName string, VMExtensionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get the operation to get the extension. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine containing the extension. VMExtensionName is the name of +// the virtual machine extension. expand is the expand expression to apply on +// the operation. +func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) { + req, err := client.GetPreparer(resourceGroupName, VMName, VMExtensionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmExtensionName": autorest.Encode("path", VMExtensionName), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineExtension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go index 83e704d12d..6c090568f5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go @@ -1,391 +1,391 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualMachineImagesClient is the the Compute Management Client. -type VirtualMachineImagesClient struct { - ManagementClient -} - -// NewVirtualMachineImagesClient creates an instance of the -// VirtualMachineImagesClient client. -func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient { - return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineImagesClientWithBaseURI creates an instance of the -// VirtualMachineImagesClient client. -func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient { - return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a virtual machine image. -// -// location is the name of a supported Azure region. publisherName is a valid -// image publisher. offer is a valid image publisher offer. skus is a valid -// image SKU. version is a valid image SKU version. -func (client VirtualMachineImagesClient) Get(location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) { - req, err := client.GetPreparer(location, publisherName, offer, skus, version) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineImagesClient) GetPreparer(location string, publisherName string, offer string, skus string, version string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "offer": autorest.Encode("path", offer), - "publisherName": autorest.Encode("path", publisherName), - "skus": autorest.Encode("path", skus), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "version": autorest.Encode("path", version), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (result VirtualMachineImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all virtual machine image versions for the specified -// location, publisher, offer, and SKU. -// -// location is the name of a supported Azure region. publisherName is a valid -// image publisher. offer is a valid image publisher offer. skus is a valid -// image SKU. filter is the filter to apply on the operation. -func (client VirtualMachineImagesClient) List(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) { - req, err := client.ListPreparer(location, publisherName, offer, skus, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachineImagesClient) ListPreparer(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "offer": autorest.Encode("path", offer), - "publisherName": autorest.Encode("path", publisherName), - "skus": autorest.Encode("path", skus), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOffers gets a list of virtual machine image offers for the specified -// location and publisher. -// -// location is the name of a supported Azure region. publisherName is a valid -// image publisher. -func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result ListVirtualMachineImageResource, err error) { - req, err := client.ListOffersPreparer(location, publisherName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request") - return - } - - resp, err := client.ListOffersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request") - return - } - - result, err = client.ListOffersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request") - } - - return -} - -// ListOffersPreparer prepares the ListOffers request. -func (client VirtualMachineImagesClient) ListOffersPreparer(location string, publisherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "publisherName": autorest.Encode("path", publisherName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListOffersSender sends the ListOffers request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListOffersResponder handles the response to the ListOffers request. The method always -// closes the http.Response Body. -func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPublishers gets a list of virtual machine image publishers for the -// specified Azure location. -// -// location is the name of a supported Azure region. -func (client VirtualMachineImagesClient) ListPublishers(location string) (result ListVirtualMachineImageResource, err error) { - req, err := client.ListPublishersPreparer(location) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request") - return - } - - resp, err := client.ListPublishersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request") - return - } - - result, err = client.ListPublishersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request") - } - - return -} - -// ListPublishersPreparer prepares the ListPublishers request. -func (client VirtualMachineImagesClient) ListPublishersPreparer(location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPublishersSender sends the ListPublishers request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPublishersResponder handles the response to the ListPublishers request. The method always -// closes the http.Response Body. -func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSkus gets a list of virtual machine image SKUs for the specified -// location, publisher, and offer. -// -// location is the name of a supported Azure region. publisherName is a valid -// image publisher. offer is a valid image publisher offer. -func (client VirtualMachineImagesClient) ListSkus(location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) { - req, err := client.ListSkusPreparer(location, publisherName, offer) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request") - return - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request") - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publisherName string, offer string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "offer": autorest.Encode("path", offer), - "publisherName": autorest.Encode("path", publisherName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualMachineImagesClient is the the Compute Management Client. +type VirtualMachineImagesClient struct { + ManagementClient +} + +// NewVirtualMachineImagesClient creates an instance of the +// VirtualMachineImagesClient client. +func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient { + return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineImagesClientWithBaseURI creates an instance of the +// VirtualMachineImagesClient client. +func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient { + return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a virtual machine image. +// +// location is the name of a supported Azure region. publisherName is a valid +// image publisher. offer is a valid image publisher offer. skus is a valid +// image SKU. version is a valid image SKU version. +func (client VirtualMachineImagesClient) Get(location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) { + req, err := client.GetPreparer(location, publisherName, offer, skus, version) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineImagesClient) GetPreparer(location string, publisherName string, offer string, skus string, version string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "offer": autorest.Encode("path", offer), + "publisherName": autorest.Encode("path", publisherName), + "skus": autorest.Encode("path", skus), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (result VirtualMachineImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all virtual machine image versions for the specified +// location, publisher, offer, and SKU. +// +// location is the name of a supported Azure region. publisherName is a valid +// image publisher. offer is a valid image publisher offer. skus is a valid +// image SKU. filter is the filter to apply on the operation. +func (client VirtualMachineImagesClient) List(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) { + req, err := client.ListPreparer(location, publisherName, offer, skus, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineImagesClient) ListPreparer(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "offer": autorest.Encode("path", offer), + "publisherName": autorest.Encode("path", publisherName), + "skus": autorest.Encode("path", skus), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOffers gets a list of virtual machine image offers for the specified +// location and publisher. +// +// location is the name of a supported Azure region. publisherName is a valid +// image publisher. +func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result ListVirtualMachineImageResource, err error) { + req, err := client.ListOffersPreparer(location, publisherName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request") + return + } + + resp, err := client.ListOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request") + return + } + + result, err = client.ListOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request") + } + + return +} + +// ListOffersPreparer prepares the ListOffers request. +func (client VirtualMachineImagesClient) ListOffersPreparer(location string, publisherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOffersSender sends the ListOffers request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOffersResponder handles the response to the ListOffers request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishers gets a list of virtual machine image publishers for the +// specified Azure location. +// +// location is the name of a supported Azure region. +func (client VirtualMachineImagesClient) ListPublishers(location string) (result ListVirtualMachineImageResource, err error) { + req, err := client.ListPublishersPreparer(location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request") + return + } + + result, err = client.ListPublishersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request") + } + + return +} + +// ListPublishersPreparer prepares the ListPublishers request. +func (client VirtualMachineImagesClient) ListPublishersPreparer(location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPublishersSender sends the ListPublishers request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPublishersResponder handles the response to the ListPublishers request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkus gets a list of virtual machine image SKUs for the specified +// location, publisher, and offer. +// +// location is the name of a supported Azure region. publisherName is a valid +// image publisher. offer is a valid image publisher offer. +func (client VirtualMachineImagesClient) ListSkus(location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) { + req, err := client.ListSkusPreparer(location, publisherName, offer) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publisherName string, offer string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "offer": autorest.Encode("path", offer), + "publisherName": autorest.Encode("path", publisherName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go index 540e8e180d..686b7ace23 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go @@ -1,1207 +1,1207 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualMachinesClient is the the Compute Management Client. -type VirtualMachinesClient struct { - ManagementClient -} - -// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient -// client. -func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { - return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachinesClientWithBaseURI creates an instance of the -// VirtualMachinesClient client. -func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { - return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Capture captures the VM by copying virtual hard disks of the VM and outputs -// a template that can be used to create similar VMs. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. parameters is parameters supplied to the Capture -// Virtual Machine operation. -func (client VirtualMachinesClient) Capture(resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (<-chan VirtualMachineCaptureResult, <-chan error) { - resultChan := make(chan VirtualMachineCaptureResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "Capture") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result VirtualMachineCaptureResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CapturePreparer(resourceGroupName, VMName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil, "Failure preparing request") - return - } - - resp, err := client.CaptureSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", resp, "Failure sending request") - return - } - - result, err = client.CaptureResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CapturePreparer prepares the Capture request. -func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CaptureSender sends the Capture request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) CaptureSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CaptureResponder handles the response to the Capture request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ConvertToManagedDisks converts virtual machine disks from blob-based to -// managed disks. Virtual machine must be stop-deallocated before invoking this -// operation. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) ConvertToManagedDisks(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ConvertToManagedDisksPreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", nil, "Failure preparing request") - return - } - - resp, err := client.ConvertToManagedDisksSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", resp, "Failure sending request") - return - } - - result, err = client.ConvertToManagedDisksResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ConvertToManagedDisksPreparer prepares the ConvertToManagedDisks request. -func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ConvertToManagedDisksSender sends the ConvertToManagedDisks request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ConvertToManagedDisksSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ConvertToManagedDisksResponder handles the response to the ConvertToManagedDisks request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate the operation to create or update a virtual machine. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. parameters is parameters supplied to the Create Virtual -// Machine operation. -func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, VMName string, parameters VirtualMachine, cancel <-chan struct{}) (<-chan VirtualMachine, <-chan error) { - resultChan := make(chan VirtualMachine, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result VirtualMachine - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, VMName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, VMName string, parameters VirtualMachine, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Deallocate shuts down the virtual machine and releases the compute -// resources. You are not billed for the compute resources that this virtual -// machine uses. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) Deallocate(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeallocatePreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil, "Failure preparing request") - return - } - - resp, err := client.DeallocateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", resp, "Failure sending request") - return - } - - result, err = client.DeallocateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeallocatePreparer prepares the Deallocate request. -func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeallocateSender sends the Deallocate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) DeallocateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeallocateResponder handles the response to the Deallocate request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the operation to delete a virtual machine. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) Delete(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Generalize sets the state of the virtual machine to generalized. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) Generalize(resourceGroupName string, VMName string) (result OperationStatusResponse, err error) { - req, err := client.GeneralizePreparer(resourceGroupName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request") - return - } - - resp, err := client.GeneralizeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request") - return - } - - result, err = client.GeneralizeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request") - } - - return -} - -// GeneralizePreparer prepares the Generalize request. -func (client VirtualMachinesClient) GeneralizePreparer(resourceGroupName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GeneralizeSender sends the Generalize request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GeneralizeResponder handles the response to the Generalize request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieves information about the model view or the instance view of a -// virtual machine. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. expand is the expand expression to apply on the -// operation. -func (client VirtualMachinesClient) Get(resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) { - req, err := client.GetPreparer(resourceGroupName, VMName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, VMName string, expand InstanceViewTypes) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(expand)) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the virtual machines in the specified resource group. Use -// the nextLink property in the response to get the next page of virtual -// machines. -// -// resourceGroupName is the name of the resource group. -func (client VirtualMachinesClient) List(resourceGroupName string) (result VirtualMachineListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachinesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result VirtualMachineListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { - req, err := lastResults.VirtualMachineListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll lists all of the virtual machines in the specified subscription. Use -// the nextLink property in the response to get the next page of virtual -// machines. -func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client VirtualMachinesClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (result VirtualMachineListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { - req, err := lastResults.VirtualMachineListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListAvailableSizes lists all available virtual machine sizes to which the -// specified virtual machine can be resized. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) ListAvailableSizes(resourceGroupName string, VMName string) (result VirtualMachineSizeListResult, err error) { - req, err := client.ListAvailableSizesPreparer(resourceGroupName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request") - return - } - - resp, err := client.ListAvailableSizesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request") - return - } - - result, err = client.ListAvailableSizesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request") - } - - return -} - -// ListAvailableSizesPreparer prepares the ListAvailableSizes request. -func (client VirtualMachinesClient) ListAvailableSizesPreparer(resourceGroupName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// PowerOff the operation to power off (stop) a virtual machine. The virtual -// machine can be restarted with the same provisioned resources. You are still -// charged for this virtual machine. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) PowerOff(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PowerOffPreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil, "Failure preparing request") - return - } - - resp, err := client.PowerOffSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", resp, "Failure sending request") - return - } - - result, err = client.PowerOffResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PowerOffPreparer prepares the PowerOff request. -func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PowerOffSender sends the PowerOff request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) PowerOffSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PowerOffResponder handles the response to the PowerOff request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Redeploy the operation to redeploy a virtual machine. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) Redeploy(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RedeployPreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request") - return - } - - resp, err := client.RedeploySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", resp, "Failure sending request") - return - } - - result, err = client.RedeployResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RedeployPreparer prepares the Redeploy request. -func (client VirtualMachinesClient) RedeployPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RedeploySender sends the Redeploy request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) RedeploySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RedeployResponder handles the response to the Redeploy request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restart the operation to restart a virtual machine. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) Restart(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RestartPreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil, "Failure preparing request") - return - } - - resp, err := client.RestartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", resp, "Failure sending request") - return - } - - result, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RestartPreparer prepares the Restart request. -func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) RestartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start the operation to start a virtual machine. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. VMName is the name of -// the virtual machine. -func (client VirtualMachinesClient) Start(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StartPreparer(resourceGroupName, VMName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StartPreparer prepares the Start request. -func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualMachinesClient is the the Compute Management Client. +type VirtualMachinesClient struct { + ManagementClient +} + +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient +// client. +func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the +// VirtualMachinesClient client. +func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { + return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Capture captures the VM by copying virtual hard disks of the VM and outputs +// a template that can be used to create similar VMs. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. parameters is parameters supplied to the Capture +// Virtual Machine operation. +func (client VirtualMachinesClient) Capture(resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (<-chan VirtualMachineCaptureResult, <-chan error) { + resultChan := make(chan VirtualMachineCaptureResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "Capture") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result VirtualMachineCaptureResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CapturePreparer(resourceGroupName, VMName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil, "Failure preparing request") + return + } + + resp, err := client.CaptureSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", resp, "Failure sending request") + return + } + + result, err = client.CaptureResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CapturePreparer prepares the Capture request. +func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CaptureSender sends the Capture request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) CaptureSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CaptureResponder handles the response to the Capture request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ConvertToManagedDisks converts virtual machine disks from blob-based to +// managed disks. Virtual machine must be stop-deallocated before invoking this +// operation. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) ConvertToManagedDisks(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ConvertToManagedDisksPreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", nil, "Failure preparing request") + return + } + + resp, err := client.ConvertToManagedDisksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", resp, "Failure sending request") + return + } + + result, err = client.ConvertToManagedDisksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ConvertToManagedDisksPreparer prepares the ConvertToManagedDisks request. +func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ConvertToManagedDisksSender sends the ConvertToManagedDisks request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ConvertToManagedDisksSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ConvertToManagedDisksResponder handles the response to the ConvertToManagedDisks request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate the operation to create or update a virtual machine. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. parameters is parameters supplied to the Create Virtual +// Machine operation. +func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, VMName string, parameters VirtualMachine, cancel <-chan struct{}) (<-chan VirtualMachine, <-chan error) { + resultChan := make(chan VirtualMachine, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachinesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result VirtualMachine + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, VMName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, VMName string, parameters VirtualMachine, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deallocate shuts down the virtual machine and releases the compute +// resources. You are not billed for the compute resources that this virtual +// machine uses. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) Deallocate(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeallocatePreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil, "Failure preparing request") + return + } + + resp, err := client.DeallocateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", resp, "Failure sending request") + return + } + + result, err = client.DeallocateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeallocatePreparer prepares the Deallocate request. +func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeallocateSender sends the Deallocate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DeallocateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeallocateResponder handles the response to the Deallocate request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation to delete a virtual machine. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) Delete(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Generalize sets the state of the virtual machine to generalized. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) Generalize(resourceGroupName string, VMName string) (result OperationStatusResponse, err error) { + req, err := client.GeneralizePreparer(resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request") + return + } + + resp, err := client.GeneralizeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request") + return + } + + result, err = client.GeneralizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request") + } + + return +} + +// GeneralizePreparer prepares the Generalize request. +func (client VirtualMachinesClient) GeneralizePreparer(resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GeneralizeSender sends the Generalize request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GeneralizeResponder handles the response to the Generalize request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieves information about the model view or the instance view of a +// virtual machine. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. expand is the expand expression to apply on the +// operation. +func (client VirtualMachinesClient) Get(resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) { + req, err := client.GetPreparer(resourceGroupName, VMName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, VMName string, expand InstanceViewTypes) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the virtual machines in the specified resource group. Use +// the nextLink property in the response to get the next page of virtual +// machines. +// +// resourceGroupName is the name of the resource group. +func (client VirtualMachinesClient) List(resourceGroupName string) (result VirtualMachineListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachinesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.VirtualMachineListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll lists all of the virtual machines in the specified subscription. Use +// the nextLink property in the response to get the next page of virtual +// machines. +func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualMachinesClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (result VirtualMachineListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) { + req, err := lastResults.VirtualMachineListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAvailableSizes lists all available virtual machine sizes to which the +// specified virtual machine can be resized. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) ListAvailableSizes(resourceGroupName string, VMName string) (result VirtualMachineSizeListResult, err error) { + req, err := client.ListAvailableSizesPreparer(resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableSizesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSizesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request") + } + + return +} + +// ListAvailableSizesPreparer prepares the ListAvailableSizes request. +func (client VirtualMachinesClient) ListAvailableSizesPreparer(resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PowerOff the operation to power off (stop) a virtual machine. The virtual +// machine can be restarted with the same provisioned resources. You are still +// charged for this virtual machine. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) PowerOff(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PowerOffPreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil, "Failure preparing request") + return + } + + resp, err := client.PowerOffSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", resp, "Failure sending request") + return + } + + result, err = client.PowerOffResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PowerOffPreparer prepares the PowerOff request. +func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PowerOffSender sends the PowerOff request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) PowerOffSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PowerOffResponder handles the response to the PowerOff request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Redeploy the operation to redeploy a virtual machine. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) Redeploy(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RedeployPreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request") + return + } + + resp, err := client.RedeploySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", resp, "Failure sending request") + return + } + + result, err = client.RedeployResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RedeployPreparer prepares the Redeploy request. +func (client VirtualMachinesClient) RedeployPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RedeploySender sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) RedeploySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RedeployResponder handles the response to the Redeploy request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Restart the operation to restart a virtual machine. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) Restart(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RestartPreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestartPreparer prepares the Restart request. +func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) RestartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start the operation to start a virtual machine. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. VMName is the name of +// the virtual machine. +func (client VirtualMachinesClient) Start(resourceGroupName string, VMName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, VMName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, VMName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go index af3e7cefa0..53700c8dd9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go @@ -1,1316 +1,1316 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualMachineScaleSetsClient is the the Compute Management Client. -type VirtualMachineScaleSetsClient struct { - ManagementClient -} - -// NewVirtualMachineScaleSetsClient creates an instance of the -// VirtualMachineScaleSetsClient client. -func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient { - return NewVirtualMachineScaleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineScaleSetsClientWithBaseURI creates an instance of the -// VirtualMachineScaleSetsClient client. -func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient { - return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a VM scale set. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// VM scale set to create or update. parameters is the scale set object. -func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (<-chan VirtualMachineScaleSet, <-chan error) { - resultChan := make(chan VirtualMachineScaleSet, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result VirtualMachineScaleSet - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Deallocate deallocates specific virtual machines in a VM scale set. Shuts -// down the virtual machines and releases the compute resources. You are not -// billed for the compute resources that this virtual machine scale set -// deallocates. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. VMInstanceIDs is a list of virtual machine -// instance IDs from the VM scale set. -func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeallocatePreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request") - return - } - - resp, err := client.DeallocateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure sending request") - return - } - - result, err = client.DeallocateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeallocatePreparer prepares the Deallocate request. -func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if VMInstanceIDs != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(VMInstanceIDs)) - } - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeallocateSender sends the Deallocate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) DeallocateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeallocateResponder handles the response to the Deallocate request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a VM scale set. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. -func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, VMScaleSetName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteInstances deletes virtual machines in a VM scale set. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. VMInstanceIDs is a list of virtual machine -// instance IDs from the VM scale set. -func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: VMInstanceIDs, - Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeleteInstancesPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteInstancesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure sending request") - return - } - - result, err = client.DeleteInstancesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeleteInstancesPreparer prepares the DeleteInstances request. -func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", pathParameters), - autorest.WithJSON(VMInstanceIDs), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteInstancesSender sends the DeleteInstances request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) DeleteInstancesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteInstancesResponder handles the response to the DeleteInstances request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get display information about a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. -func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSet, err error) { - req, err := client.GetPreparer(resourceGroupName, VMScaleSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineScaleSetsClient) GetPreparer(resourceGroupName string, VMScaleSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceView gets the status of a VM scale set instance. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. -func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) { - req, err := client.GetInstanceViewPreparer(resourceGroupName, VMScaleSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request") - return - } - - resp, err := client.GetInstanceViewSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request") - return - } - - result, err = client.GetInstanceViewResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request") - } - - return -} - -// GetInstanceViewPreparer prepares the GetInstanceView request. -func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(resourceGroupName string, VMScaleSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceViewSender sends the GetInstanceView request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetInstanceView, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all VM scale sets under a resource group. -// -// resourceGroupName is the name of the resource group. -func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachineScaleSetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) { - req, err := lastResults.VirtualMachineScaleSetListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets a list of all VM Scale Sets in the subscription, regardless of -// the associated resource group. Use nextLink property in the response to get -// the next page of VM Scale Sets. Do this till nextLink is not null to fetch -// all the VM Scale Sets. -func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client VirtualMachineScaleSetsClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response) (result VirtualMachineScaleSetListWithLinkResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) { - req, err := lastResults.VirtualMachineScaleSetListWithLinkResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListSkus gets a list of SKUs available for your VM scale set, including the -// minimum and maximum VM instances allowed for each SKU. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. -func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResult, err error) { - req, err := client.ListSkusPreparer(resourceGroupName, VMScaleSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request") - return - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request") - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client VirtualMachineScaleSetsClient) ListSkusPreparer(resourceGroupName string, VMScaleSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Response) (result VirtualMachineScaleSetListSkusResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSkusNextResults retrieves the next set of results, if any. -func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) { - req, err := lastResults.VirtualMachineScaleSetListSkusResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending next results request") - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to next results request") - } - - return -} - -// PowerOff power off (stop) one or more virtual machines in a VM scale set. -// Note that resources are still attached and you are getting charged for the -// resources. Instead, use deallocate to release resources and avoid charges. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. VMInstanceIDs is a list of virtual machine -// instance IDs from the VM scale set. -func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PowerOffPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request") - return - } - - resp, err := client.PowerOffSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure sending request") - return - } - - result, err = client.PowerOffResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PowerOffPreparer prepares the PowerOff request. -func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if VMInstanceIDs != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(VMInstanceIDs)) - } - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PowerOffSender sends the PowerOff request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) PowerOffSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PowerOffResponder handles the response to the PowerOff request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Reimage reimages (upgrade the operating system) one or more virtual machines -// in a VM scale set. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. -func (client VirtualMachineScaleSetsClient) Reimage(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ReimagePreparer(resourceGroupName, VMScaleSetName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", nil, "Failure preparing request") - return - } - - resp, err := client.ReimageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", resp, "Failure sending request") - return - } - - result, err = client.ReimageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ReimagePreparer prepares the Reimage request. -func (client VirtualMachineScaleSetsClient) ReimagePreparer(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ReimageSender sends the Reimage request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) ReimageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ReimageResponder handles the response to the Reimage request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ReimageAll reimages all the disks ( including data disks ) in the virtual -// machines in a virtual machine scale set. This operation is only supported -// for managed disks. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. -func (client VirtualMachineScaleSetsClient) ReimageAll(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ReimageAllPreparer(resourceGroupName, VMScaleSetName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", nil, "Failure preparing request") - return - } - - resp, err := client.ReimageAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", resp, "Failure sending request") - return - } - - result, err = client.ReimageAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ReimageAllPreparer prepares the ReimageAll request. -func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ReimageAllSender sends the ReimageAll request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) ReimageAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ReimageAllResponder handles the response to the ReimageAll request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restart restarts one or more virtual machines in a VM scale set. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. VMInstanceIDs is a list of virtual machine -// instance IDs from the VM scale set. -func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RestartPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request") - return - } - - resp, err := client.RestartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", resp, "Failure sending request") - return - } - - result, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RestartPreparer prepares the Restart request. -func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if VMInstanceIDs != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(VMInstanceIDs)) - } - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) RestartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start starts one or more virtual machines in a VM scale set. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. VMInstanceIDs is a list of virtual machine -// instance IDs from the VM scale set. -func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StartPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StartPreparer prepares the Start request. -func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if VMInstanceIDs != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(VMInstanceIDs)) - } - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateInstances upgrades one or more virtual machines to the latest SKU set -// in the VM scale set model. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. VMInstanceIDs is a list of virtual machine -// instance IDs from the VM scale set. -func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: VMInstanceIDs, - Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdateInstancesPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateInstancesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure sending request") - return - } - - result, err = client.UpdateInstancesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdateInstancesPreparer prepares the UpdateInstances request. -func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", pathParameters), - autorest.WithJSON(VMInstanceIDs), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateInstancesSender sends the UpdateInstances request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetsClient) UpdateInstancesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateInstancesResponder handles the response to the UpdateInstances request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetsClient) UpdateInstancesResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualMachineScaleSetsClient is the the Compute Management Client. +type VirtualMachineScaleSetsClient struct { + ManagementClient +} + +// NewVirtualMachineScaleSetsClient creates an instance of the +// VirtualMachineScaleSetsClient client. +func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient { + return NewVirtualMachineScaleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetsClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetsClient client. +func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient { + return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a VM scale set. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// VM scale set to create or update. parameters is the scale set object. +func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (<-chan VirtualMachineScaleSet, <-chan error) { + resultChan := make(chan VirtualMachineScaleSet, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VirtualMachineScaleSet + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deallocate deallocates specific virtual machines in a VM scale set. Shuts +// down the virtual machines and releases the compute resources. You are not +// billed for the compute resources that this virtual machine scale set +// deallocates. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. VMInstanceIDs is a list of virtual machine +// instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeallocatePreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request") + return + } + + resp, err := client.DeallocateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure sending request") + return + } + + result, err = client.DeallocateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeallocatePreparer prepares the Deallocate request. +func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeallocateSender sends the Deallocate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) DeallocateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeallocateResponder handles the response to the Deallocate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VM scale set. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, VMScaleSetName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteInstances deletes virtual machines in a VM scale set. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. VMInstanceIDs is a list of virtual machine +// instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: VMInstanceIDs, + Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeleteInstancesPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteInstancesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure sending request") + return + } + + result, err = client.DeleteInstancesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeleteInstancesPreparer prepares the DeleteInstances request. +func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", pathParameters), + autorest.WithJSON(VMInstanceIDs), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteInstancesSender sends the DeleteInstances request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) DeleteInstancesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteInstancesResponder handles the response to the DeleteInstances request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get display information about a virtual machine scale set. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSet, err error) { + req, err := client.GetPreparer(resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineScaleSetsClient) GetPreparer(resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceView gets the status of a VM scale set instance. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. +func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) { + req, err := client.GetInstanceViewPreparer(resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request") + } + + return +} + +// GetInstanceViewPreparer prepares the GetInstanceView request. +func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetInstanceViewSender sends the GetInstanceView request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetInstanceView, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all VM scale sets under a resource group. +// +// resourceGroupName is the name of the resource group. +func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineScaleSetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) { + req, err := lastResults.VirtualMachineScaleSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets a list of all VM Scale Sets in the subscription, regardless of +// the associated resource group. Use nextLink property in the response to get +// the next page of VM Scale Sets. Do this till nextLink is not null to fetch +// all the VM Scale Sets. +func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualMachineScaleSetsClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response) (result VirtualMachineScaleSetListWithLinkResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) { + req, err := lastResults.VirtualMachineScaleSetListWithLinkResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListSkus gets a list of SKUs available for your VM scale set, including the +// minimum and maximum VM instances allowed for each SKU. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. +func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResult, err error) { + req, err := client.ListSkusPreparer(resourceGroupName, VMScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client VirtualMachineScaleSetsClient) ListSkusPreparer(resourceGroupName string, VMScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Response) (result VirtualMachineScaleSetListSkusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkusNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) { + req, err := lastResults.VirtualMachineScaleSetListSkusResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending next results request") + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to next results request") + } + + return +} + +// PowerOff power off (stop) one or more virtual machines in a VM scale set. +// Note that resources are still attached and you are getting charged for the +// resources. Instead, use deallocate to release resources and avoid charges. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. VMInstanceIDs is a list of virtual machine +// instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PowerOffPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request") + return + } + + resp, err := client.PowerOffSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure sending request") + return + } + + result, err = client.PowerOffResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PowerOffPreparer prepares the PowerOff request. +func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PowerOffSender sends the PowerOff request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) PowerOffSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PowerOffResponder handles the response to the PowerOff request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Reimage reimages (upgrade the operating system) one or more virtual machines +// in a VM scale set. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. +func (client VirtualMachineScaleSetsClient) Reimage(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ReimagePreparer(resourceGroupName, VMScaleSetName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", nil, "Failure preparing request") + return + } + + resp, err := client.ReimageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", resp, "Failure sending request") + return + } + + result, err = client.ReimageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReimagePreparer prepares the Reimage request. +func (client VirtualMachineScaleSetsClient) ReimagePreparer(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReimageSender sends the Reimage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ReimageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReimageResponder handles the response to the Reimage request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ReimageAll reimages all the disks ( including data disks ) in the virtual +// machines in a virtual machine scale set. This operation is only supported +// for managed disks. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. +func (client VirtualMachineScaleSetsClient) ReimageAll(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ReimageAllPreparer(resourceGroupName, VMScaleSetName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", nil, "Failure preparing request") + return + } + + resp, err := client.ReimageAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", resp, "Failure sending request") + return + } + + result, err = client.ReimageAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReimageAllPreparer prepares the ReimageAll request. +func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(resourceGroupName string, VMScaleSetName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReimageAllSender sends the ReimageAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) ReimageAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReimageAllResponder handles the response to the ReimageAll request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Restart restarts one or more virtual machines in a VM scale set. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. VMInstanceIDs is a list of virtual machine +// instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RestartPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestartPreparer prepares the Restart request. +func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) RestartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts one or more virtual machines in a VM scale set. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. VMInstanceIDs is a list of virtual machine +// instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if VMInstanceIDs != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(VMInstanceIDs)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateInstances upgrades one or more virtual machines to the latest SKU set +// in the VM scale set model. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. VMInstanceIDs is a list of virtual machine +// instance IDs from the VM scale set. +func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: VMInstanceIDs, + Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdateInstancesPreparer(resourceGroupName, VMScaleSetName, VMInstanceIDs, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateInstancesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure sending request") + return + } + + result, err = client.UpdateInstancesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateInstancesPreparer prepares the UpdateInstances request. +func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", pathParameters), + autorest.WithJSON(VMInstanceIDs), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateInstancesSender sends the UpdateInstances request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetsClient) UpdateInstancesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateInstancesResponder handles the response to the UpdateInstances request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetsClient) UpdateInstancesResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go index cb5b269ded..34e0934dcb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go @@ -1,872 +1,872 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualMachineScaleSetVMsClient is the the Compute Management Client. -type VirtualMachineScaleSetVMsClient struct { - ManagementClient -} - -// NewVirtualMachineScaleSetVMsClient creates an instance of the -// VirtualMachineScaleSetVMsClient client. -func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient { - return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the -// VirtualMachineScaleSetVMsClient client. -func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient { - return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts -// down the virtual machine and releases the compute resources it uses. You are -// not billed for the compute resources of this virtual machine once it is -// deallocated. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeallocatePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request") - return - } - - resp, err := client.DeallocateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure sending request") - return - } - - result, err = client.DeallocateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeallocatePreparer prepares the Deallocate request. -func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeallocateSender sends the Deallocate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) DeallocateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeallocateResponder handles the response to the Deallocate request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a virtual machine from a VM scale set. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a virtual machine from a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) { - req, err := client.GetPreparer(resourceGroupName, VMScaleSetName, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineScaleSetVMsClient) GetPreparer(resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceView gets the status of a virtual machine from a VM scale set. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) { - req, err := client.GetInstanceViewPreparer(resourceGroupName, VMScaleSetName, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request") - return - } - - resp, err := client.GetInstanceViewSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request") - return - } - - result, err = client.GetInstanceViewResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request") - } - - return -} - -// GetInstanceViewPreparer prepares the GetInstanceView request. -func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceViewSender sends the GetInstanceView request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetVMInstanceView, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all virtual machines in a VM scale sets. -// -// resourceGroupName is the name of the resource group. -// virtualMachineScaleSetName is the name of the VM scale set. filter is the -// filter to apply to the operation. selectParameter is the list parameters. -// expand is the expand expression to apply to the operation. -func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachineScaleSetVMsClient) ListPreparer(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) { - req, err := lastResults.VirtualMachineScaleSetVMListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// PowerOff power off (stop) a virtual machine in a VM scale set. Note that -// resources are still attached and you are getting charged for the resources. -// Instead, use deallocate to release resources and avoid charges. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PowerOffPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request") - return - } - - resp, err := client.PowerOffSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure sending request") - return - } - - result, err = client.PowerOffResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PowerOffPreparer prepares the PowerOff request. -func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PowerOffSender sends the PowerOff request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) PowerOffSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PowerOffResponder handles the response to the PowerOff request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Reimage reimages (upgrade the operating system) a specific virtual machine -// in a VM scale set. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) Reimage(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ReimagePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil, "Failure preparing request") - return - } - - resp, err := client.ReimageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure sending request") - return - } - - result, err = client.ReimageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ReimagePreparer prepares the Reimage request. -func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ReimageSender sends the Reimage request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ReimageResponder handles the response to the Reimage request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ReimageAll allows you to re-image all the disks ( including data disks ) in -// the a virtual machine scale set instance. This operation is only supported -// for managed disks. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) ReimageAll(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ReimageAllPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", nil, "Failure preparing request") - return - } - - resp, err := client.ReimageAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", resp, "Failure sending request") - return - } - - result, err = client.ReimageAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ReimageAllPreparer prepares the ReimageAll request. -func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ReimageAllSender sends the ReimageAll request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) ReimageAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ReimageAllResponder handles the response to the ReimageAll request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restart restarts a virtual machine in a VM scale set. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RestartPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request") - return - } - - resp, err := client.RestartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure sending request") - return - } - - result, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RestartPreparer prepares the Restart request. -func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) RestartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start starts a virtual machine in a VM scale set. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. VMScaleSetName is the -// name of the VM scale set. instanceID is the instance ID of the virtual -// machine. -func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StartPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StartPreparer prepares the Start request. -func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmScaleSetName": autorest.Encode("path", VMScaleSetName), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineScaleSetVMsClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualMachineScaleSetVMsClient is the the Compute Management Client. +type VirtualMachineScaleSetVMsClient struct { + ManagementClient +} + +// NewVirtualMachineScaleSetVMsClient creates an instance of the +// VirtualMachineScaleSetVMsClient client. +func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient { + return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the +// VirtualMachineScaleSetVMsClient client. +func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient { + return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts +// down the virtual machine and releases the compute resources it uses. You are +// not billed for the compute resources of this virtual machine once it is +// deallocated. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeallocatePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request") + return + } + + resp, err := client.DeallocateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure sending request") + return + } + + result, err = client.DeallocateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeallocatePreparer prepares the Deallocate request. +func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeallocateSender sends the Deallocate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) DeallocateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeallocateResponder handles the response to the Deallocate request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a virtual machine from a VM scale set. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a virtual machine from a VM scale set. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) { + req, err := client.GetPreparer(resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineScaleSetVMsClient) GetPreparer(resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceView gets the status of a virtual machine from a VM scale set. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) { + req, err := client.GetInstanceViewPreparer(resourceGroupName, VMScaleSetName, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceViewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceViewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request") + } + + return +} + +// GetInstanceViewPreparer prepares the GetInstanceView request. +func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetInstanceViewSender sends the GetInstanceView request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetVMInstanceView, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all virtual machines in a VM scale sets. +// +// resourceGroupName is the name of the resource group. +// virtualMachineScaleSetName is the name of the VM scale set. filter is the +// filter to apply to the operation. selectParameter is the list parameters. +// expand is the expand expression to apply to the operation. +func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineScaleSetVMsClient) ListPreparer(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) { + req, err := lastResults.VirtualMachineScaleSetVMListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// PowerOff power off (stop) a virtual machine in a VM scale set. Note that +// resources are still attached and you are getting charged for the resources. +// Instead, use deallocate to release resources and avoid charges. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PowerOffPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request") + return + } + + resp, err := client.PowerOffSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure sending request") + return + } + + result, err = client.PowerOffResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PowerOffPreparer prepares the PowerOff request. +func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PowerOffSender sends the PowerOff request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) PowerOffSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PowerOffResponder handles the response to the PowerOff request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Reimage reimages (upgrade the operating system) a specific virtual machine +// in a VM scale set. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) Reimage(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ReimagePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil, "Failure preparing request") + return + } + + resp, err := client.ReimageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure sending request") + return + } + + result, err = client.ReimageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReimagePreparer prepares the Reimage request. +func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReimageSender sends the Reimage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReimageResponder handles the response to the Reimage request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ReimageAll allows you to re-image all the disks ( including data disks ) in +// the a virtual machine scale set instance. This operation is only supported +// for managed disks. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) ReimageAll(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ReimageAllPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", nil, "Failure preparing request") + return + } + + resp, err := client.ReimageAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", resp, "Failure sending request") + return + } + + result, err = client.ReimageAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ReimageAllPreparer prepares the ReimageAll request. +func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ReimageAllSender sends the ReimageAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) ReimageAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ReimageAllResponder handles the response to the ReimageAll request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Restart restarts a virtual machine in a VM scale set. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RestartPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestartPreparer prepares the Restart request. +func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) RestartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts a virtual machine in a VM scale set. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. VMScaleSetName is the +// name of the VM scale set. instanceID is the instance ID of the virtual +// machine. +func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmScaleSetName": autorest.Encode("path", VMScaleSetName), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineScaleSetVMsClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go index 8726014403..c76b203e7e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go @@ -1,114 +1,114 @@ -package compute - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualMachineSizesClient is the the Compute Management Client. -type VirtualMachineSizesClient struct { - ManagementClient -} - -// NewVirtualMachineSizesClient creates an instance of the -// VirtualMachineSizesClient client. -func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient { - return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineSizesClientWithBaseURI creates an instance of the -// VirtualMachineSizesClient client. -func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient { - return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all available virtual machine sizes for a subscription in a -// location. -// -// location is the location upon which virtual-machine-sizes is queried. -func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineSizesClient", "List") - } - - req, err := client.ListPreparer(location) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package compute + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualMachineSizesClient is the the Compute Management Client. +type VirtualMachineSizesClient struct { + ManagementClient +} + +// NewVirtualMachineSizesClient creates an instance of the +// VirtualMachineSizesClient client. +func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient { + return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineSizesClientWithBaseURI creates an instance of the +// VirtualMachineSizesClient client. +func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient { + return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all available virtual machine sizes for a subscription in a +// location. +// +// location is the location upon which virtual-machine-sizes is queried. +func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "compute.VirtualMachineSizesClient", "List") + } + + req, err := client.ListPreparer(location) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/client.go index 0c29e08f03..54adcbaf10 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/client.go @@ -1,56 +1,56 @@ -// Package consumption implements the Azure ARM Consumption service API version -// 2017-04-24-preview. -// -// Consumption management client provides access to consumption resources for -// Azure Web-Direct subscriptions. Other subscription types which were not -// purchased directly through the Azure web portal are not supported through -// this preview API. -package consumption - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Consumption - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Consumption. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package consumption implements the Azure ARM Consumption service API version +// 2017-04-24-preview. +// +// Consumption management client provides access to consumption resources for +// Azure Web-Direct subscriptions. Other subscription types which were not +// purchased directly through the Azure web portal are not supported through +// this preview API. +package consumption + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Consumption + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Consumption. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/models.go index d412622835..49e06fe8cf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/models.go @@ -1,141 +1,141 @@ -package consumption - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/shopspring/decimal" - "net/http" -) - -// ErrorDetails is the details of the error. -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// ErrorResponse is error response indicates that the service is not able to -// process the incoming request. The reason is provided in the error message. -type ErrorResponse struct { - Error *ErrorDetails `json:"error,omitempty"` -} - -// MeterDetails is the properties of the meter detail. -type MeterDetails struct { - MeterName *string `json:"meterName,omitempty"` - MeterCategory *string `json:"meterCategory,omitempty"` - MeterSubCategory *string `json:"meterSubCategory,omitempty"` - Unit *string `json:"unit,omitempty"` - MeterLocation *string `json:"meterLocation,omitempty"` - TotalIncludedQuantity *decimal.Decimal `json:"totalIncludedQuantity,omitempty"` - PretaxStandardRate *decimal.Decimal `json:"pretaxStandardRate,omitempty"` -} - -// Operation is a Consumption REST API operation. -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of listing consumption operations. It contains -// a list of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// UsageDetail is an usage detail resource. -type UsageDetail struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *UsageDetailProperties `json:"properties,omitempty"` -} - -// UsageDetailProperties is the properties of the usage detail. -type UsageDetailProperties struct { - BillingPeriodID *string `json:"billingPeriodId,omitempty"` - InvoiceID *string `json:"invoiceId,omitempty"` - UsageStart *date.Time `json:"usageStart,omitempty"` - UsageEnd *date.Time `json:"usageEnd,omitempty"` - InstanceName *string `json:"instanceName,omitempty"` - InstanceID *string `json:"instanceId,omitempty"` - InstanceLocation *string `json:"instanceLocation,omitempty"` - Currency *string `json:"currency,omitempty"` - UsageQuantity *decimal.Decimal `json:"usageQuantity,omitempty"` - BillableQuantity *decimal.Decimal `json:"billableQuantity,omitempty"` - PretaxCost *decimal.Decimal `json:"pretaxCost,omitempty"` - IsEstimated *bool `json:"isEstimated,omitempty"` - MeterID *string `json:"meterId,omitempty"` - MeterDetails *MeterDetails `json:"meterDetails,omitempty"` - AdditionalProperties *map[string]*string `json:"additionalProperties,omitempty"` -} - -// UsageDetailsListResult is result of listing usage details. It contains a -// list of available usage details in reverse chronological order by billing -// period. -type UsageDetailsListResult struct { - autorest.Response `json:"-"` - Value *[]UsageDetail `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// UsageDetailsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client UsageDetailsListResult) UsageDetailsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} +package consumption + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/shopspring/decimal" + "net/http" +) + +// ErrorDetails is the details of the error. +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} + +// ErrorResponse is error response indicates that the service is not able to +// process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + Error *ErrorDetails `json:"error,omitempty"` +} + +// MeterDetails is the properties of the meter detail. +type MeterDetails struct { + MeterName *string `json:"meterName,omitempty"` + MeterCategory *string `json:"meterCategory,omitempty"` + MeterSubCategory *string `json:"meterSubCategory,omitempty"` + Unit *string `json:"unit,omitempty"` + MeterLocation *string `json:"meterLocation,omitempty"` + TotalIncludedQuantity *decimal.Decimal `json:"totalIncludedQuantity,omitempty"` + PretaxStandardRate *decimal.Decimal `json:"pretaxStandardRate,omitempty"` +} + +// Operation is a Consumption REST API operation. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of listing consumption operations. It contains +// a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// UsageDetail is an usage detail resource. +type UsageDetail struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *UsageDetailProperties `json:"properties,omitempty"` +} + +// UsageDetailProperties is the properties of the usage detail. +type UsageDetailProperties struct { + BillingPeriodID *string `json:"billingPeriodId,omitempty"` + InvoiceID *string `json:"invoiceId,omitempty"` + UsageStart *date.Time `json:"usageStart,omitempty"` + UsageEnd *date.Time `json:"usageEnd,omitempty"` + InstanceName *string `json:"instanceName,omitempty"` + InstanceID *string `json:"instanceId,omitempty"` + InstanceLocation *string `json:"instanceLocation,omitempty"` + Currency *string `json:"currency,omitempty"` + UsageQuantity *decimal.Decimal `json:"usageQuantity,omitempty"` + BillableQuantity *decimal.Decimal `json:"billableQuantity,omitempty"` + PretaxCost *decimal.Decimal `json:"pretaxCost,omitempty"` + IsEstimated *bool `json:"isEstimated,omitempty"` + MeterID *string `json:"meterId,omitempty"` + MeterDetails *MeterDetails `json:"meterDetails,omitempty"` + AdditionalProperties *map[string]*string `json:"additionalProperties,omitempty"` +} + +// UsageDetailsListResult is result of listing usage details. It contains a +// list of available usage details in reverse chronological order by billing +// period. +type UsageDetailsListResult struct { + autorest.Response `json:"-"` + Value *[]UsageDetail `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// UsageDetailsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client UsageDetailsListResult) UsageDetailsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/operations.go index 70967ad3f8..d4d0b313dc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/operations.go @@ -1,125 +1,125 @@ -package consumption - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the consumption management client provides access to -// consumption resources for Azure Web-Direct subscriptions. Other subscription -// types which were not purchased directly through the Azure web portal are not -// supported through this preview API. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available consumption REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Consumption/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package consumption + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the consumption management client provides access to +// consumption resources for Azure Web-Direct subscriptions. Other subscription +// types which were not purchased directly through the Azure web portal are not +// supported through this preview API. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available consumption REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Consumption/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/usagedetails.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/usagedetails.go index 28b11e9c69..f60768e730 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/usagedetails.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/usagedetails.go @@ -1,170 +1,170 @@ -package consumption - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UsageDetailsClient is the consumption management client provides access to -// consumption resources for Azure Web-Direct subscriptions. Other subscription -// types which were not purchased directly through the Azure web portal are not -// supported through this preview API. -type UsageDetailsClient struct { - ManagementClient -} - -// NewUsageDetailsClient creates an instance of the UsageDetailsClient client. -func NewUsageDetailsClient(subscriptionID string) UsageDetailsClient { - return NewUsageDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsageDetailsClientWithBaseURI creates an instance of the -// UsageDetailsClient client. -func NewUsageDetailsClientWithBaseURI(baseURI string, subscriptionID string) UsageDetailsClient { - return UsageDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the usage details for a scope in reverse chronological order by -// billing period. Usage details are available via this API only for January 1, -// 2017 or later. -// -// scope is the scope of the usage details. The scope can be -// '/subscriptions/{subscriptionId}/' for a subscription, or -// '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}' -// for an invoice or -// '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' -// for a billing perdiod. expand is may be used to expand the -// additionalProperties or meterDetails property within a list of usage -// details. By default, these fields are not included when listing usage -// details. filter is may be used to filter usageDetails by usageEnd (Utc -// time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does -// not currently support 'ne', 'or', or 'not'. skiptoken is skiptoken is only -// used if a previous operation returned a partial result. If a previous -// response contains a nextLink element, the value of the nextLink element will -// include a skiptoken parameter that specifies a starting point to use for -// subsequent calls. top is may be used to limit the number of results to the -// most recent N usageDetails. -func (client UsageDetailsClient) List(scope string, expand string, filter string, skiptoken string, top *int32) (result UsageDetailsListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "consumption.UsageDetailsClient", "List") - } - - req, err := client.ListPreparer(scope, expand, filter, skiptoken, top) - if err != nil { - err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsageDetailsClient) ListPreparer(scope string, expand string, filter string, skiptoken string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2017-04-24-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Consumption/usageDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsageDetailsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsageDetailsClient) ListResponder(resp *http.Response) (result UsageDetailsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client UsageDetailsClient) ListNextResults(lastResults UsageDetailsListResult) (result UsageDetailsListResult, err error) { - req, err := lastResults.UsageDetailsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package consumption + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UsageDetailsClient is the consumption management client provides access to +// consumption resources for Azure Web-Direct subscriptions. Other subscription +// types which were not purchased directly through the Azure web portal are not +// supported through this preview API. +type UsageDetailsClient struct { + ManagementClient +} + +// NewUsageDetailsClient creates an instance of the UsageDetailsClient client. +func NewUsageDetailsClient(subscriptionID string) UsageDetailsClient { + return NewUsageDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageDetailsClientWithBaseURI creates an instance of the +// UsageDetailsClient client. +func NewUsageDetailsClientWithBaseURI(baseURI string, subscriptionID string) UsageDetailsClient { + return UsageDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the usage details for a scope in reverse chronological order by +// billing period. Usage details are available via this API only for January 1, +// 2017 or later. +// +// scope is the scope of the usage details. The scope can be +// '/subscriptions/{subscriptionId}/' for a subscription, or +// '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}' +// for an invoice or +// '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' +// for a billing perdiod. expand is may be used to expand the +// additionalProperties or meterDetails property within a list of usage +// details. By default, these fields are not included when listing usage +// details. filter is may be used to filter usageDetails by usageEnd (Utc +// time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does +// not currently support 'ne', 'or', or 'not'. skiptoken is skiptoken is only +// used if a previous operation returned a partial result. If a previous +// response contains a nextLink element, the value of the nextLink element will +// include a skiptoken parameter that specifies a starting point to use for +// subsequent calls. top is may be used to limit the number of results to the +// most recent N usageDetails. +func (client UsageDetailsClient) List(scope string, expand string, filter string, skiptoken string, top *int32) (result UsageDetailsListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 1000, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "consumption.UsageDetailsClient", "List") + } + + req, err := client.ListPreparer(scope, expand, filter, skiptoken, top) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageDetailsClient) ListPreparer(scope string, expand string, filter string, skiptoken string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2017-04-24-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Consumption/usageDetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageDetailsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageDetailsClient) ListResponder(resp *http.Response) (result UsageDetailsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client UsageDetailsClient) ListNextResults(lastResults UsageDetailsListResult) (result UsageDetailsListResult, err error) { + req, err := lastResults.UsageDetailsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.UsageDetailsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/version.go index 1667a593fa..a4e9f43a4b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/consumption/version.go @@ -1,29 +1,29 @@ -package consumption - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-consumption/2017-04-24-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package consumption + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-consumption/2017-04-24-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go index 11fdade17f..e5e99db676 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go @@ -1,53 +1,53 @@ -// Package containerregistry implements the Azure ARM Containerregistry service -// API version 2017-03-01. -// -// -package containerregistry - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Containerregistry - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Containerregistry. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package containerregistry implements the Azure ARM Containerregistry service +// API version 2017-03-01. +// +// +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Containerregistry + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Containerregistry. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go index c04266d166..66edd68c56 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go @@ -1,223 +1,223 @@ -package containerregistry - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// PasswordName enumerates the values for password name. -type PasswordName string - -const ( - // Password specifies the password state for password name. - Password PasswordName = "password" - // Password2 specifies the password 2 state for password name. - Password2 PasswordName = "password2" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Creating specifies the creating state for provisioning state. - Creating ProvisioningState = "Creating" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Basic specifies the basic state for sku tier. - Basic SkuTier = "Basic" -) - -// OperationDefinition is the definition of a container registry operation. -type OperationDefinition struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplayDefinition `json:"display,omitempty"` -} - -// OperationDisplayDefinition is the display information for a container -// registry operation. -type OperationDisplayDefinition struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult is the result of a request to list container registry -// operations. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]OperationDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RegenerateCredentialParameters is the parameters used to regenerate the -// login credential. -type RegenerateCredentialParameters struct { - Name PasswordName `json:"name,omitempty"` -} - -// Registry is an object that represents a container registry. -type Registry struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *RegistryProperties `json:"properties,omitempty"` -} - -// RegistryCreateParameters is the parameters for creating a container -// registry. -type RegistryCreateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *RegistryPropertiesCreateParameters `json:"properties,omitempty"` -} - -// RegistryListCredentialsResult is the response from the ListCredentials -// operation. -type RegistryListCredentialsResult struct { - autorest.Response `json:"-"` - Username *string `json:"username,omitempty"` - Passwords *[]RegistryPassword `json:"passwords,omitempty"` -} - -// RegistryListResult is the result of a request to list container registries. -type RegistryListResult struct { - autorest.Response `json:"-"` - Value *[]Registry `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RegistryListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RegistryListResult) RegistryListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RegistryNameCheckRequest is a request to check whether a container registry -// name is available. -type RegistryNameCheckRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// RegistryNameStatus is the result of a request to check the availability of a -// container registry name. -type RegistryNameStatus struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// RegistryPassword is the login password for the container registry. -type RegistryPassword struct { - Name PasswordName `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// RegistryProperties is the properties of a container registry. -type RegistryProperties struct { - LoginServer *string `json:"loginServer,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` -} - -// RegistryPropertiesCreateParameters is the parameters for creating the -// properties of a container registry. -type RegistryPropertiesCreateParameters struct { - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - StorageAccount *StorageAccountParameters `json:"storageAccount,omitempty"` -} - -// RegistryPropertiesUpdateParameters is the parameters for updating the -// properties of a container registry. -type RegistryPropertiesUpdateParameters struct { - AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - StorageAccount *StorageAccountParameters `json:"storageAccount,omitempty"` -} - -// RegistryUpdateParameters is the parameters for updating a container -// registry. -type RegistryUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// Resource is an Azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Sku is the SKU of a container registry. -type Sku struct { - Name *string `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` -} - -// StorageAccountParameters is the parameters of a storage account for a -// container registry. -type StorageAccountParameters struct { - Name *string `json:"name,omitempty"` - AccessKey *string `json:"accessKey,omitempty"` -} - -// StorageAccountProperties is the properties of a storage account for a -// container registry. -type StorageAccountProperties struct { - Name *string `json:"name,omitempty"` -} +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// PasswordName enumerates the values for password name. +type PasswordName string + +const ( + // Password specifies the password state for password name. + Password PasswordName = "password" + // Password2 specifies the password 2 state for password name. + Password2 PasswordName = "password2" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Creating specifies the creating state for provisioning state. + Creating ProvisioningState = "Creating" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic specifies the basic state for sku tier. + Basic SkuTier = "Basic" +) + +// OperationDefinition is the definition of a container registry operation. +type OperationDefinition struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplayDefinition `json:"display,omitempty"` +} + +// OperationDisplayDefinition is the display information for a container +// registry operation. +type OperationDisplayDefinition struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult is the result of a request to list container registry +// operations. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]OperationDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RegenerateCredentialParameters is the parameters used to regenerate the +// login credential. +type RegenerateCredentialParameters struct { + Name PasswordName `json:"name,omitempty"` +} + +// Registry is an object that represents a container registry. +type Registry struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *RegistryProperties `json:"properties,omitempty"` +} + +// RegistryCreateParameters is the parameters for creating a container +// registry. +type RegistryCreateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *RegistryPropertiesCreateParameters `json:"properties,omitempty"` +} + +// RegistryListCredentialsResult is the response from the ListCredentials +// operation. +type RegistryListCredentialsResult struct { + autorest.Response `json:"-"` + Username *string `json:"username,omitempty"` + Passwords *[]RegistryPassword `json:"passwords,omitempty"` +} + +// RegistryListResult is the result of a request to list container registries. +type RegistryListResult struct { + autorest.Response `json:"-"` + Value *[]Registry `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RegistryListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RegistryListResult) RegistryListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RegistryNameCheckRequest is a request to check whether a container registry +// name is available. +type RegistryNameCheckRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RegistryNameStatus is the result of a request to check the availability of a +// container registry name. +type RegistryNameStatus struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// RegistryPassword is the login password for the container registry. +type RegistryPassword struct { + Name PasswordName `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// RegistryProperties is the properties of a container registry. +type RegistryProperties struct { + LoginServer *string `json:"loginServer,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` + StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` +} + +// RegistryPropertiesCreateParameters is the parameters for creating the +// properties of a container registry. +type RegistryPropertiesCreateParameters struct { + AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` + StorageAccount *StorageAccountParameters `json:"storageAccount,omitempty"` +} + +// RegistryPropertiesUpdateParameters is the parameters for updating the +// properties of a container registry. +type RegistryPropertiesUpdateParameters struct { + AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` + StorageAccount *StorageAccountParameters `json:"storageAccount,omitempty"` +} + +// RegistryUpdateParameters is the parameters for updating a container +// registry. +type RegistryUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// Resource is an Azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Sku is the SKU of a container registry. +type Sku struct { + Name *string `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` +} + +// StorageAccountParameters is the parameters of a storage account for a +// container registry. +type StorageAccountParameters struct { + Name *string `json:"name,omitempty"` + AccessKey *string `json:"accessKey,omitempty"` +} + +// StorageAccountProperties is the properties of a storage account for a +// container registry. +type StorageAccountProperties struct { + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/operations.go index df705c42b9..a1694180c5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/operations.go @@ -1,124 +1,124 @@ -package containerregistry - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the -// Containerregistry service. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Azure Container Registry REST API -// operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerRegistry/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the +// Containerregistry service. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Azure Container Registry REST API +// operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerRegistry/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go index 4b44c4a5b5..fe03ba3381 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go @@ -1,783 +1,783 @@ -package containerregistry - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RegistriesClient is the client for the Registries methods of the -// Containerregistry service. -type RegistriesClient struct { - ManagementClient -} - -// NewRegistriesClient creates an instance of the RegistriesClient client. -func NewRegistriesClient(subscriptionID string) RegistriesClient { - return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient -// client. -func NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { - return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the container registry name is -// available for use. The name must contain only alphanumeric characters, be -// globally unique, and between 5 and 60 characters in length. -// -// registryNameCheckRequest is the object containing information for the -// availability request. -func (client RegistriesClient) CheckNameAvailability(registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryNameCheckRequest, - Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, - }}, - {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(registryNameCheckRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client RegistriesClient) CheckNameAvailabilityPreparer(registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), - autorest.WithJSON(registryNameCheckRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates a container registry with the specified parameters. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. registryName is the name of the container registry. -// registryCreateParameters is the parameters for creating a container -// registry. -func (client RegistriesClient) Create(resourceGroupName string, registryName string, registryCreateParameters RegistryCreateParameters, cancel <-chan struct{}) (<-chan Registry, <-chan error) { - resultChan := make(chan Registry, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: registryCreateParameters, - Constraints: []validation.Constraint{{Target: "registryCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registryCreateParameters.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryCreateParameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "registryCreateParameters.RegistryPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registryCreateParameters.RegistryPropertiesCreateParameters.StorageAccount", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "registryCreateParameters.RegistryPropertiesCreateParameters.StorageAccount.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registryCreateParameters.RegistryPropertiesCreateParameters.StorageAccount.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Registry - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, registryName, registryCreateParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client RegistriesClient) CreatePreparer(resourceGroupName string, registryName string, registryCreateParameters RegistryCreateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryCreateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client RegistriesClient) CreateResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a container registry. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. registryName is the name of the container registry. -func (client RegistriesClient) Delete(resourceGroupName string, registryName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistriesClient) DeletePreparer(resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the properties of the specified container registry. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. registryName is the name of the container registry. -func (client RegistriesClient) Get(resourceGroupName string, registryName string) (result Registry, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistriesClient) GetPreparer(resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the container registries under the specified subscription. -func (client RegistriesClient) List() (result RegistryListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistriesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RegistriesClient) ListNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.RegistryListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists all the container registries under the specified -// resource group. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. -func (client RegistriesClient) ListByResourceGroup(resourceGroupName string) (result RegistryListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RegistriesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client RegistriesClient) ListByResourceGroupNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) { - req, err := lastResults.RegistryListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListCredentials lists the login credentials for the specified container -// registry. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. registryName is the name of the container registry. -func (client RegistriesClient) ListCredentials(resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "ListCredentials") - } - - req, err := client.ListCredentialsPreparer(resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") - } - - return -} - -// ListCredentialsPreparer prepares the ListCredentials request. -func (client RegistriesClient) ListCredentialsPreparer(resourceGroupName string, registryName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListCredentialsSender sends the ListCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListCredentialsResponder handles the response to the ListCredentials request. The method always -// closes the http.Response Body. -func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateCredential regenerates one of the login credentials for the -// specified container registry. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. registryName is the name of the container registry. -// regenerateCredentialParameters is specifies name of the password which -// should be regenerated -- password or password2. -func (client RegistriesClient) RegenerateCredential(resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "RegenerateCredential") - } - - req, err := client.RegenerateCredentialPreparer(resourceGroupName, registryName, regenerateCredentialParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateCredentialSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") - return - } - - result, err = client.RegenerateCredentialResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") - } - - return -} - -// RegenerateCredentialPreparer prepares the RegenerateCredential request. -func (client RegistriesClient) RegenerateCredentialPreparer(resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), - autorest.WithJSON(regenerateCredentialParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always -// closes the http.Response Body. -func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a container registry with the specified parameters. -// -// resourceGroupName is the name of the resource group to which the container -// registry belongs. registryName is the name of the container registry. -// registryUpdateParameters is the parameters for updating a container -// registry. -func (client RegistriesClient) Update(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result Registry, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: registryName, - Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, registryName, registryUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RegistriesClient) UpdatePreparer(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), - autorest.WithJSON(registryUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RegistriesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RegistriesClient is the client for the Registries methods of the +// Containerregistry service. +type RegistriesClient struct { + ManagementClient +} + +// NewRegistriesClient creates an instance of the RegistriesClient client. +func NewRegistriesClient(subscriptionID string) RegistriesClient { + return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient +// client. +func NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { + return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks whether the container registry name is +// available for use. The name must contain only alphanumeric characters, be +// globally unique, and between 5 and 60 characters in length. +// +// registryNameCheckRequest is the object containing information for the +// availability request. +func (client RegistriesClient) CheckNameAvailability(registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryNameCheckRequest, + Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, + }}, + {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(registryNameCheckRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client RegistriesClient) CheckNameAvailabilityPreparer(registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), + autorest.WithJSON(registryNameCheckRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates a container registry with the specified parameters. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. registryName is the name of the container registry. +// registryCreateParameters is the parameters for creating a container +// registry. +func (client RegistriesClient) Create(resourceGroupName string, registryName string, registryCreateParameters RegistryCreateParameters, cancel <-chan struct{}) (<-chan Registry, <-chan error) { + resultChan := make(chan Registry, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: registryCreateParameters, + Constraints: []validation.Constraint{{Target: "registryCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "registryCreateParameters.Sku", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "registryCreateParameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "registryCreateParameters.RegistryPropertiesCreateParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "registryCreateParameters.RegistryPropertiesCreateParameters.StorageAccount", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "registryCreateParameters.RegistryPropertiesCreateParameters.StorageAccount.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "registryCreateParameters.RegistryPropertiesCreateParameters.StorageAccount.AccessKey", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Registry + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, registryName, registryCreateParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client RegistriesClient) CreatePreparer(resourceGroupName string, registryName string, registryCreateParameters RegistryCreateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), + autorest.WithJSON(registryCreateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RegistriesClient) CreateResponder(resp *http.Response) (result Registry, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a container registry. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. registryName is the name of the container registry. +func (client RegistriesClient) Delete(resourceGroupName string, registryName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RegistriesClient) DeletePreparer(resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified container registry. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. registryName is the name of the container registry. +func (client RegistriesClient) Get(resourceGroupName string, registryName string) (result Registry, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RegistriesClient) GetPreparer(resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the container registries under the specified subscription. +func (client RegistriesClient) List() (result RegistryListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RegistriesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RegistriesClient) ListNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) { + req, err := lastResults.RegistryListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists all the container registries under the specified +// resource group. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. +func (client RegistriesClient) ListByResourceGroup(resourceGroupName string) (result RegistryListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client RegistriesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client RegistriesClient) ListByResourceGroupNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) { + req, err := lastResults.RegistryListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCredentials lists the login credentials for the specified container +// registry. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. registryName is the name of the container registry. +func (client RegistriesClient) ListCredentials(resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "ListCredentials") + } + + req, err := client.ListCredentialsPreparer(resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") + } + + return +} + +// ListCredentialsPreparer prepares the ListCredentials request. +func (client RegistriesClient) ListCredentialsPreparer(resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCredentialsSender sends the ListCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCredentialsResponder handles the response to the ListCredentials request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateCredential regenerates one of the login credentials for the +// specified container registry. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. registryName is the name of the container registry. +// regenerateCredentialParameters is specifies name of the password which +// should be regenerated -- password or password2. +func (client RegistriesClient) RegenerateCredential(resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "RegenerateCredential") + } + + req, err := client.RegenerateCredentialPreparer(resourceGroupName, registryName, regenerateCredentialParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateCredentialSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") + return + } + + result, err = client.RegenerateCredentialResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") + } + + return +} + +// RegenerateCredentialPreparer prepares the RegenerateCredential request. +func (client RegistriesClient) RegenerateCredentialPreparer(resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), + autorest.WithJSON(regenerateCredentialParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always +// closes the http.Response Body. +func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a container registry with the specified parameters. +// +// resourceGroupName is the name of the resource group to which the container +// registry belongs. registryName is the name of the container registry. +// registryUpdateParameters is the parameters for updating a container +// registry. +func (client RegistriesClient) Update(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result Registry, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, registryName, registryUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RegistriesClient) UpdatePreparer(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters), + autorest.WithJSON(registryUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go index 431ef50ff4..e586a01ce7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go @@ -1,29 +1,29 @@ -package containerregistry - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-containerregistry/2017-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-containerregistry/2017-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/client.go index 6a2177e5dd..7aefda8a8e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/client.go @@ -1,53 +1,53 @@ -// Package containerservice implements the Azure ARM Containerservice service -// API version 2017-01-31. -// -// The Container Service Client. -package containerservice - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Containerservice - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Containerservice. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package containerservice implements the Azure ARM Containerservice service +// API version 2017-01-31. +// +// The Container Service Client. +package containerservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Containerservice + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Containerservice. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/containerservices.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/containerservices.go index f8c74bb01e..6fca953c88 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/containerservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/containerservices.go @@ -1,499 +1,499 @@ -package containerservice - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ContainerServicesClient is the the Container Service Client. -type ContainerServicesClient struct { - ManagementClient -} - -// NewContainerServicesClient creates an instance of the -// ContainerServicesClient client. -func NewContainerServicesClient(subscriptionID string) ContainerServicesClient { - return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContainerServicesClientWithBaseURI creates an instance of the -// ContainerServicesClient client. -func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient { - return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a container service with the specified -// configuration of orchestrator, masters, and agents. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. containerServiceName is -// the name of the container service in the specified subscription and resource -// group. parameters is parameters supplied to the Create or Update a Container -// Service operation. -func (client ContainerServicesClient) CreateOrUpdate(resourceGroupName string, containerServiceName string, parameters ContainerService, cancel <-chan struct{}) (<-chan ContainerService, <-chan error) { - resultChan := make(chan ContainerService, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ServicePrincipalProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties.ServicePrincipalProfile.Secret", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Properties.MasterProfile", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties.WindowsProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}}, - {Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Pattern, Rule: `^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$`, Chain: nil}}}, - }}, - {Target: "parameters.Properties.LinuxProfile", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-z][a-z0-9_-]*$`, Chain: nil}}}, - {Target: "parameters.Properties.LinuxProfile.SSH", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "parameters.Properties.DiagnosticsProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ContainerService - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, containerServiceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ContainerServicesClient) CreateOrUpdatePreparer(resourceGroupName string, containerServiceName string, parameters ContainerService, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerServiceName": autorest.Encode("path", containerServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified container service in the specified subscription -// and resource group. The operation does not delete other resources created as -// part of creating a container service, including storage accounts, VMs, and -// availability sets. All the other resources created with the container -// service are part of the same resource group and can be deleted individually. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. containerServiceName is -// the name of the container service in the specified subscription and resource -// group. -func (client ContainerServicesClient) Delete(resourceGroupName string, containerServiceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, containerServiceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ContainerServicesClient) DeletePreparer(resourceGroupName string, containerServiceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerServiceName": autorest.Encode("path", containerServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the properties of the specified container service in the specified -// subscription and resource group. The operation returns the properties -// including state, orchestrator, number of masters and agents, and FQDNs of -// masters and agents. -// -// resourceGroupName is the name of the resource group. containerServiceName is -// the name of the container service in the specified subscription and resource -// group. -func (client ContainerServicesClient) Get(resourceGroupName string, containerServiceName string) (result ContainerService, err error) { - req, err := client.GetPreparer(resourceGroupName, containerServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ContainerServicesClient) GetPreparer(resourceGroupName string, containerServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerServiceName": autorest.Encode("path", containerServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of container services in the specified subscription. The -// operation returns properties of each container service including state, -// orchestrator, number of masters and agents, and FQDNs of masters and agents. -func (client ContainerServicesClient) List() (result ListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ContainerServicesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ContainerServicesClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets a list of container services in the specified -// subscription and resource group. The operation returns properties of each -// container service including state, orchestrator, number of masters and -// agents, and FQDNs of masters and agents. -// -// resourceGroupName is the name of the resource group. -func (client ContainerServicesClient) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ContainerServicesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-31" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ContainerServicesClient) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package containerservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ContainerServicesClient is the the Container Service Client. +type ContainerServicesClient struct { + ManagementClient +} + +// NewContainerServicesClient creates an instance of the +// ContainerServicesClient client. +func NewContainerServicesClient(subscriptionID string) ContainerServicesClient { + return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainerServicesClientWithBaseURI creates an instance of the +// ContainerServicesClient client. +func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient { + return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a container service with the specified +// configuration of orchestrator, masters, and agents. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. containerServiceName is +// the name of the container service in the specified subscription and resource +// group. parameters is parameters supplied to the Create or Update a Container +// Service operation. +func (client ContainerServicesClient) CreateOrUpdate(resourceGroupName string, containerServiceName string, parameters ContainerService, cancel <-chan struct{}) (<-chan ContainerService, <-chan error) { + resultChan := make(chan ContainerService, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Properties.ServicePrincipalProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.ServicePrincipalProfile.Secret", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.Properties.MasterProfile", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Properties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.WindowsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}}, + {Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Pattern, Rule: `^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%\^&\*\(\)])[a-zA-Z\d!@#$%\^&\*\(\)]{12,123}$`, Chain: nil}}}, + }}, + {Target: "parameters.Properties.LinuxProfile", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-z][a-z0-9_-]*$`, Chain: nil}}}, + {Target: "parameters.Properties.LinuxProfile.SSH", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.Properties.DiagnosticsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ContainerService + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, containerServiceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ContainerServicesClient) CreateOrUpdatePreparer(resourceGroupName string, containerServiceName string, parameters ContainerService, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerServiceName": autorest.Encode("path", containerServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified container service in the specified subscription +// and resource group. The operation does not delete other resources created as +// part of creating a container service, including storage accounts, VMs, and +// availability sets. All the other resources created with the container +// service are part of the same resource group and can be deleted individually. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. containerServiceName is +// the name of the container service in the specified subscription and resource +// group. +func (client ContainerServicesClient) Delete(resourceGroupName string, containerServiceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, containerServiceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ContainerServicesClient) DeletePreparer(resourceGroupName string, containerServiceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerServiceName": autorest.Encode("path", containerServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified container service in the specified +// subscription and resource group. The operation returns the properties +// including state, orchestrator, number of masters and agents, and FQDNs of +// masters and agents. +// +// resourceGroupName is the name of the resource group. containerServiceName is +// the name of the container service in the specified subscription and resource +// group. +func (client ContainerServicesClient) Get(resourceGroupName string, containerServiceName string) (result ContainerService, err error) { + req, err := client.GetPreparer(resourceGroupName, containerServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ContainerServicesClient) GetPreparer(resourceGroupName string, containerServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerServiceName": autorest.Encode("path", containerServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of container services in the specified subscription. The +// operation returns properties of each container service including state, +// orchestrator, number of masters and agents, and FQDNs of masters and agents. +func (client ContainerServicesClient) List() (result ListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ContainerServicesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ContainerServicesClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets a list of container services in the specified +// subscription and resource group. The operation returns properties of each +// container service including state, orchestrator, number of masters and +// agents, and FQDNs of masters and agents. +// +// resourceGroupName is the name of the resource group. +func (client ContainerServicesClient) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ContainerServicesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ContainerServicesClient) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/models.go index d1247abf35..852420c668 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/models.go @@ -1,257 +1,257 @@ -package containerservice - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// OchestratorTypes enumerates the values for ochestrator types. -type OchestratorTypes string - -const ( - // Custom specifies the custom state for ochestrator types. - Custom OchestratorTypes = "Custom" - // DCOS specifies the dcos state for ochestrator types. - DCOS OchestratorTypes = "DCOS" - // Kubernetes specifies the kubernetes state for ochestrator types. - Kubernetes OchestratorTypes = "Kubernetes" - // Swarm specifies the swarm state for ochestrator types. - Swarm OchestratorTypes = "Swarm" -) - -// VMSizeTypes enumerates the values for vm size types. -type VMSizeTypes string - -const ( - // StandardA0 specifies the standard a0 state for vm size types. - StandardA0 VMSizeTypes = "Standard_A0" - // StandardA1 specifies the standard a1 state for vm size types. - StandardA1 VMSizeTypes = "Standard_A1" - // StandardA10 specifies the standard a10 state for vm size types. - StandardA10 VMSizeTypes = "Standard_A10" - // StandardA11 specifies the standard a11 state for vm size types. - StandardA11 VMSizeTypes = "Standard_A11" - // StandardA2 specifies the standard a2 state for vm size types. - StandardA2 VMSizeTypes = "Standard_A2" - // StandardA3 specifies the standard a3 state for vm size types. - StandardA3 VMSizeTypes = "Standard_A3" - // StandardA4 specifies the standard a4 state for vm size types. - StandardA4 VMSizeTypes = "Standard_A4" - // StandardA5 specifies the standard a5 state for vm size types. - StandardA5 VMSizeTypes = "Standard_A5" - // StandardA6 specifies the standard a6 state for vm size types. - StandardA6 VMSizeTypes = "Standard_A6" - // StandardA7 specifies the standard a7 state for vm size types. - StandardA7 VMSizeTypes = "Standard_A7" - // StandardA8 specifies the standard a8 state for vm size types. - StandardA8 VMSizeTypes = "Standard_A8" - // StandardA9 specifies the standard a9 state for vm size types. - StandardA9 VMSizeTypes = "Standard_A9" - // StandardD1 specifies the standard d1 state for vm size types. - StandardD1 VMSizeTypes = "Standard_D1" - // StandardD11 specifies the standard d11 state for vm size types. - StandardD11 VMSizeTypes = "Standard_D11" - // StandardD11V2 specifies the standard d11v2 state for vm size types. - StandardD11V2 VMSizeTypes = "Standard_D11_v2" - // StandardD12 specifies the standard d12 state for vm size types. - StandardD12 VMSizeTypes = "Standard_D12" - // StandardD12V2 specifies the standard d12v2 state for vm size types. - StandardD12V2 VMSizeTypes = "Standard_D12_v2" - // StandardD13 specifies the standard d13 state for vm size types. - StandardD13 VMSizeTypes = "Standard_D13" - // StandardD13V2 specifies the standard d13v2 state for vm size types. - StandardD13V2 VMSizeTypes = "Standard_D13_v2" - // StandardD14 specifies the standard d14 state for vm size types. - StandardD14 VMSizeTypes = "Standard_D14" - // StandardD14V2 specifies the standard d14v2 state for vm size types. - StandardD14V2 VMSizeTypes = "Standard_D14_v2" - // StandardD1V2 specifies the standard d1v2 state for vm size types. - StandardD1V2 VMSizeTypes = "Standard_D1_v2" - // StandardD2 specifies the standard d2 state for vm size types. - StandardD2 VMSizeTypes = "Standard_D2" - // StandardD2V2 specifies the standard d2v2 state for vm size types. - StandardD2V2 VMSizeTypes = "Standard_D2_v2" - // StandardD3 specifies the standard d3 state for vm size types. - StandardD3 VMSizeTypes = "Standard_D3" - // StandardD3V2 specifies the standard d3v2 state for vm size types. - StandardD3V2 VMSizeTypes = "Standard_D3_v2" - // StandardD4 specifies the standard d4 state for vm size types. - StandardD4 VMSizeTypes = "Standard_D4" - // StandardD4V2 specifies the standard d4v2 state for vm size types. - StandardD4V2 VMSizeTypes = "Standard_D4_v2" - // StandardD5V2 specifies the standard d5v2 state for vm size types. - StandardD5V2 VMSizeTypes = "Standard_D5_v2" - // StandardDS1 specifies the standard ds1 state for vm size types. - StandardDS1 VMSizeTypes = "Standard_DS1" - // StandardDS11 specifies the standard ds11 state for vm size types. - StandardDS11 VMSizeTypes = "Standard_DS11" - // StandardDS12 specifies the standard ds12 state for vm size types. - StandardDS12 VMSizeTypes = "Standard_DS12" - // StandardDS13 specifies the standard ds13 state for vm size types. - StandardDS13 VMSizeTypes = "Standard_DS13" - // StandardDS14 specifies the standard ds14 state for vm size types. - StandardDS14 VMSizeTypes = "Standard_DS14" - // StandardDS2 specifies the standard ds2 state for vm size types. - StandardDS2 VMSizeTypes = "Standard_DS2" - // StandardDS3 specifies the standard ds3 state for vm size types. - StandardDS3 VMSizeTypes = "Standard_DS3" - // StandardDS4 specifies the standard ds4 state for vm size types. - StandardDS4 VMSizeTypes = "Standard_DS4" - // StandardG1 specifies the standard g1 state for vm size types. - StandardG1 VMSizeTypes = "Standard_G1" - // StandardG2 specifies the standard g2 state for vm size types. - StandardG2 VMSizeTypes = "Standard_G2" - // StandardG3 specifies the standard g3 state for vm size types. - StandardG3 VMSizeTypes = "Standard_G3" - // StandardG4 specifies the standard g4 state for vm size types. - StandardG4 VMSizeTypes = "Standard_G4" - // StandardG5 specifies the standard g5 state for vm size types. - StandardG5 VMSizeTypes = "Standard_G5" - // StandardGS1 specifies the standard gs1 state for vm size types. - StandardGS1 VMSizeTypes = "Standard_GS1" - // StandardGS2 specifies the standard gs2 state for vm size types. - StandardGS2 VMSizeTypes = "Standard_GS2" - // StandardGS3 specifies the standard gs3 state for vm size types. - StandardGS3 VMSizeTypes = "Standard_GS3" - // StandardGS4 specifies the standard gs4 state for vm size types. - StandardGS4 VMSizeTypes = "Standard_GS4" - // StandardGS5 specifies the standard gs5 state for vm size types. - StandardGS5 VMSizeTypes = "Standard_GS5" -) - -// AgentPoolProfile is profile for the container service agent pool. -type AgentPoolProfile struct { - Name *string `json:"name,omitempty"` - Count *int32 `json:"count,omitempty"` - VMSize VMSizeTypes `json:"vmSize,omitempty"` - DNSPrefix *string `json:"dnsPrefix,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` -} - -// ContainerService is container service. -type ContainerService struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// CustomProfile is properties to configure a custom container service cluster. -type CustomProfile struct { - Orchestrator *string `json:"orchestrator,omitempty"` -} - -// DiagnosticsProfile is -type DiagnosticsProfile struct { - VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` -} - -// LinuxProfile is profile for Linux VMs in the container service cluster. -type LinuxProfile struct { - AdminUsername *string `json:"adminUsername,omitempty"` - SSH *SSHConfiguration `json:"ssh,omitempty"` -} - -// ListResult is the response from the List Container Services operation. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]ContainerService `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MasterProfile is profile for the container service master. -type MasterProfile struct { - Count *int32 `json:"count,omitempty"` - DNSPrefix *string `json:"dnsPrefix,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` -} - -// OrchestratorProfile is profile for the container service orchestrator. -type OrchestratorProfile struct { - OrchestratorType OchestratorTypes `json:"orchestratorType,omitempty"` -} - -// Properties is properties of the container service. -type Properties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - OrchestratorProfile *OrchestratorProfile `json:"orchestratorProfile,omitempty"` - CustomProfile *CustomProfile `json:"customProfile,omitempty"` - ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` - MasterProfile *MasterProfile `json:"masterProfile,omitempty"` - AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"` - WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"` - LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` - DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ServicePrincipalProfile is information about a service principal identity -// for the cluster to use for manipulating Azure APIs. -type ServicePrincipalProfile struct { - ClientID *string `json:"clientId,omitempty"` - Secret *string `json:"secret,omitempty"` -} - -// SSHConfiguration is sSH configuration for Linux-based VMs running on Azure. -type SSHConfiguration struct { - PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` -} - -// SSHPublicKey is contains information about SSH certificate public key data. -type SSHPublicKey struct { - KeyData *string `json:"keyData,omitempty"` -} - -// VMDiagnostics is profile for diagnostics on the container service VMs. -type VMDiagnostics struct { - Enabled *bool `json:"enabled,omitempty"` - StorageURI *string `json:"storageUri,omitempty"` -} - -// WindowsProfile is profile for Windows VMs in the container service cluster. -type WindowsProfile struct { - AdminUsername *string `json:"adminUsername,omitempty"` - AdminPassword *string `json:"adminPassword,omitempty"` -} +package containerservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// OchestratorTypes enumerates the values for ochestrator types. +type OchestratorTypes string + +const ( + // Custom specifies the custom state for ochestrator types. + Custom OchestratorTypes = "Custom" + // DCOS specifies the dcos state for ochestrator types. + DCOS OchestratorTypes = "DCOS" + // Kubernetes specifies the kubernetes state for ochestrator types. + Kubernetes OchestratorTypes = "Kubernetes" + // Swarm specifies the swarm state for ochestrator types. + Swarm OchestratorTypes = "Swarm" +) + +// VMSizeTypes enumerates the values for vm size types. +type VMSizeTypes string + +const ( + // StandardA0 specifies the standard a0 state for vm size types. + StandardA0 VMSizeTypes = "Standard_A0" + // StandardA1 specifies the standard a1 state for vm size types. + StandardA1 VMSizeTypes = "Standard_A1" + // StandardA10 specifies the standard a10 state for vm size types. + StandardA10 VMSizeTypes = "Standard_A10" + // StandardA11 specifies the standard a11 state for vm size types. + StandardA11 VMSizeTypes = "Standard_A11" + // StandardA2 specifies the standard a2 state for vm size types. + StandardA2 VMSizeTypes = "Standard_A2" + // StandardA3 specifies the standard a3 state for vm size types. + StandardA3 VMSizeTypes = "Standard_A3" + // StandardA4 specifies the standard a4 state for vm size types. + StandardA4 VMSizeTypes = "Standard_A4" + // StandardA5 specifies the standard a5 state for vm size types. + StandardA5 VMSizeTypes = "Standard_A5" + // StandardA6 specifies the standard a6 state for vm size types. + StandardA6 VMSizeTypes = "Standard_A6" + // StandardA7 specifies the standard a7 state for vm size types. + StandardA7 VMSizeTypes = "Standard_A7" + // StandardA8 specifies the standard a8 state for vm size types. + StandardA8 VMSizeTypes = "Standard_A8" + // StandardA9 specifies the standard a9 state for vm size types. + StandardA9 VMSizeTypes = "Standard_A9" + // StandardD1 specifies the standard d1 state for vm size types. + StandardD1 VMSizeTypes = "Standard_D1" + // StandardD11 specifies the standard d11 state for vm size types. + StandardD11 VMSizeTypes = "Standard_D11" + // StandardD11V2 specifies the standard d11v2 state for vm size types. + StandardD11V2 VMSizeTypes = "Standard_D11_v2" + // StandardD12 specifies the standard d12 state for vm size types. + StandardD12 VMSizeTypes = "Standard_D12" + // StandardD12V2 specifies the standard d12v2 state for vm size types. + StandardD12V2 VMSizeTypes = "Standard_D12_v2" + // StandardD13 specifies the standard d13 state for vm size types. + StandardD13 VMSizeTypes = "Standard_D13" + // StandardD13V2 specifies the standard d13v2 state for vm size types. + StandardD13V2 VMSizeTypes = "Standard_D13_v2" + // StandardD14 specifies the standard d14 state for vm size types. + StandardD14 VMSizeTypes = "Standard_D14" + // StandardD14V2 specifies the standard d14v2 state for vm size types. + StandardD14V2 VMSizeTypes = "Standard_D14_v2" + // StandardD1V2 specifies the standard d1v2 state for vm size types. + StandardD1V2 VMSizeTypes = "Standard_D1_v2" + // StandardD2 specifies the standard d2 state for vm size types. + StandardD2 VMSizeTypes = "Standard_D2" + // StandardD2V2 specifies the standard d2v2 state for vm size types. + StandardD2V2 VMSizeTypes = "Standard_D2_v2" + // StandardD3 specifies the standard d3 state for vm size types. + StandardD3 VMSizeTypes = "Standard_D3" + // StandardD3V2 specifies the standard d3v2 state for vm size types. + StandardD3V2 VMSizeTypes = "Standard_D3_v2" + // StandardD4 specifies the standard d4 state for vm size types. + StandardD4 VMSizeTypes = "Standard_D4" + // StandardD4V2 specifies the standard d4v2 state for vm size types. + StandardD4V2 VMSizeTypes = "Standard_D4_v2" + // StandardD5V2 specifies the standard d5v2 state for vm size types. + StandardD5V2 VMSizeTypes = "Standard_D5_v2" + // StandardDS1 specifies the standard ds1 state for vm size types. + StandardDS1 VMSizeTypes = "Standard_DS1" + // StandardDS11 specifies the standard ds11 state for vm size types. + StandardDS11 VMSizeTypes = "Standard_DS11" + // StandardDS12 specifies the standard ds12 state for vm size types. + StandardDS12 VMSizeTypes = "Standard_DS12" + // StandardDS13 specifies the standard ds13 state for vm size types. + StandardDS13 VMSizeTypes = "Standard_DS13" + // StandardDS14 specifies the standard ds14 state for vm size types. + StandardDS14 VMSizeTypes = "Standard_DS14" + // StandardDS2 specifies the standard ds2 state for vm size types. + StandardDS2 VMSizeTypes = "Standard_DS2" + // StandardDS3 specifies the standard ds3 state for vm size types. + StandardDS3 VMSizeTypes = "Standard_DS3" + // StandardDS4 specifies the standard ds4 state for vm size types. + StandardDS4 VMSizeTypes = "Standard_DS4" + // StandardG1 specifies the standard g1 state for vm size types. + StandardG1 VMSizeTypes = "Standard_G1" + // StandardG2 specifies the standard g2 state for vm size types. + StandardG2 VMSizeTypes = "Standard_G2" + // StandardG3 specifies the standard g3 state for vm size types. + StandardG3 VMSizeTypes = "Standard_G3" + // StandardG4 specifies the standard g4 state for vm size types. + StandardG4 VMSizeTypes = "Standard_G4" + // StandardG5 specifies the standard g5 state for vm size types. + StandardG5 VMSizeTypes = "Standard_G5" + // StandardGS1 specifies the standard gs1 state for vm size types. + StandardGS1 VMSizeTypes = "Standard_GS1" + // StandardGS2 specifies the standard gs2 state for vm size types. + StandardGS2 VMSizeTypes = "Standard_GS2" + // StandardGS3 specifies the standard gs3 state for vm size types. + StandardGS3 VMSizeTypes = "Standard_GS3" + // StandardGS4 specifies the standard gs4 state for vm size types. + StandardGS4 VMSizeTypes = "Standard_GS4" + // StandardGS5 specifies the standard gs5 state for vm size types. + StandardGS5 VMSizeTypes = "Standard_GS5" +) + +// AgentPoolProfile is profile for the container service agent pool. +type AgentPoolProfile struct { + Name *string `json:"name,omitempty"` + Count *int32 `json:"count,omitempty"` + VMSize VMSizeTypes `json:"vmSize,omitempty"` + DNSPrefix *string `json:"dnsPrefix,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` +} + +// ContainerService is container service. +type ContainerService struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// CustomProfile is properties to configure a custom container service cluster. +type CustomProfile struct { + Orchestrator *string `json:"orchestrator,omitempty"` +} + +// DiagnosticsProfile is +type DiagnosticsProfile struct { + VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` +} + +// LinuxProfile is profile for Linux VMs in the container service cluster. +type LinuxProfile struct { + AdminUsername *string `json:"adminUsername,omitempty"` + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// ListResult is the response from the List Container Services operation. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]ContainerService `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// MasterProfile is profile for the container service master. +type MasterProfile struct { + Count *int32 `json:"count,omitempty"` + DNSPrefix *string `json:"dnsPrefix,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` +} + +// OrchestratorProfile is profile for the container service orchestrator. +type OrchestratorProfile struct { + OrchestratorType OchestratorTypes `json:"orchestratorType,omitempty"` +} + +// Properties is properties of the container service. +type Properties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + OrchestratorProfile *OrchestratorProfile `json:"orchestratorProfile,omitempty"` + CustomProfile *CustomProfile `json:"customProfile,omitempty"` + ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + MasterProfile *MasterProfile `json:"masterProfile,omitempty"` + AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"` + WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"` + LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServicePrincipalProfile is information about a service principal identity +// for the cluster to use for manipulating Azure APIs. +type ServicePrincipalProfile struct { + ClientID *string `json:"clientId,omitempty"` + Secret *string `json:"secret,omitempty"` +} + +// SSHConfiguration is sSH configuration for Linux-based VMs running on Azure. +type SSHConfiguration struct { + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey is contains information about SSH certificate public key data. +type SSHPublicKey struct { + KeyData *string `json:"keyData,omitempty"` +} + +// VMDiagnostics is profile for diagnostics on the container service VMs. +type VMDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageURI *string `json:"storageUri,omitempty"` +} + +// WindowsProfile is profile for Windows VMs in the container service cluster. +type WindowsProfile struct { + AdminUsername *string `json:"adminUsername,omitempty"` + AdminPassword *string `json:"adminPassword,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/version.go index 2762c6f589..a678060b4b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/containerservice/version.go @@ -1,29 +1,29 @@ -package containerservice - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-containerservice/2017-01-31" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package containerservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-containerservice/2017-01-31" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/authorizationpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/authorizationpolicies.go index 3a4a0c7681..fb08c5a4d3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/authorizationpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/authorizationpolicies.go @@ -1,424 +1,424 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AuthorizationPoliciesClient is the the Azure Customer Insights management -// API provides a RESTful set of web services that interact with Azure Customer -// Insights service to manage your resources. The API has entities that capture -// the relationship between an end user and the Azure Customer Insights -// service. -type AuthorizationPoliciesClient struct { - ManagementClient -} - -// NewAuthorizationPoliciesClient creates an instance of the -// AuthorizationPoliciesClient client. -func NewAuthorizationPoliciesClient(subscriptionID string) AuthorizationPoliciesClient { - return NewAuthorizationPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAuthorizationPoliciesClientWithBaseURI creates an instance of the -// AuthorizationPoliciesClient client. -func NewAuthorizationPoliciesClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationPoliciesClient { - return AuthorizationPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates an authorization policy or updates an existing -// authorization policy. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. authorizationPolicyName is the name of the policy. parameters is -// parameters supplied to the CreateOrUpdate authorization policy operation. -func (client AuthorizationPoliciesClient) CreateOrUpdate(resourceGroupName string, hubName string, authorizationPolicyName string, parameters AuthorizationPolicyResourceFormat) (result AuthorizationPolicyResourceFormat, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: authorizationPolicyName, - Constraints: []validation.Constraint{{Target: "authorizationPolicyName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationPolicyName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "authorizationPolicyName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]$|^[A-Za-z0-9][\w-\.]*[A-Za-z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationPolicy.Permissions", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationPolicy.Permissions", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, authorizationPolicyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AuthorizationPoliciesClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, authorizationPolicyName string, parameters AuthorizationPolicyResourceFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AuthorizationPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result AuthorizationPolicyResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets an authorization policy in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. authorizationPolicyName is the name of the policy. -func (client AuthorizationPoliciesClient) Get(resourceGroupName string, hubName string, authorizationPolicyName string) (result AuthorizationPolicyResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, authorizationPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AuthorizationPoliciesClient) GetPreparer(resourceGroupName string, hubName string, authorizationPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AuthorizationPoliciesClient) GetResponder(resp *http.Response) (result AuthorizationPolicyResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all the authorization policies in a specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client AuthorizationPoliciesClient) ListByHub(resourceGroupName string, hubName string) (result AuthorizationPolicyListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client AuthorizationPoliciesClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationPoliciesClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client AuthorizationPoliciesClient) ListByHubResponder(resp *http.Response) (result AuthorizationPolicyListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client AuthorizationPoliciesClient) ListByHubNextResults(lastResults AuthorizationPolicyListResult) (result AuthorizationPolicyListResult, err error) { - req, err := lastResults.AuthorizationPolicyListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} - -// RegeneratePrimaryKey regenerates the primary policy key of the specified -// authorization policy. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. authorizationPolicyName is the name of the policy. -func (client AuthorizationPoliciesClient) RegeneratePrimaryKey(resourceGroupName string, hubName string, authorizationPolicyName string) (result AuthorizationPolicy, err error) { - req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, hubName, authorizationPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegeneratePrimaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegeneratePrimaryKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegeneratePrimaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegeneratePrimaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegeneratePrimaryKey", resp, "Failure responding to request") - } - - return -} - -// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. -func (client AuthorizationPoliciesClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, hubName string, authorizationPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regeneratePrimaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationPoliciesClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always -// closes the http.Response Body. -func (client AuthorizationPoliciesClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result AuthorizationPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateSecondaryKey regenerates the secondary policy key of the specified -// authorization policy. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. authorizationPolicyName is the name of the policy. -func (client AuthorizationPoliciesClient) RegenerateSecondaryKey(resourceGroupName string, hubName string, authorizationPolicyName string) (result AuthorizationPolicy, err error) { - req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, hubName, authorizationPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegenerateSecondaryKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSecondaryKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegenerateSecondaryKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateSecondaryKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegenerateSecondaryKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. -func (client AuthorizationPoliciesClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, hubName string, authorizationPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regenerateSecondaryKey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the -// http.Response Body if it receives an error. -func (client AuthorizationPoliciesClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always -// closes the http.Response Body. -func (client AuthorizationPoliciesClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result AuthorizationPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AuthorizationPoliciesClient is the the Azure Customer Insights management +// API provides a RESTful set of web services that interact with Azure Customer +// Insights service to manage your resources. The API has entities that capture +// the relationship between an end user and the Azure Customer Insights +// service. +type AuthorizationPoliciesClient struct { + ManagementClient +} + +// NewAuthorizationPoliciesClient creates an instance of the +// AuthorizationPoliciesClient client. +func NewAuthorizationPoliciesClient(subscriptionID string) AuthorizationPoliciesClient { + return NewAuthorizationPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAuthorizationPoliciesClientWithBaseURI creates an instance of the +// AuthorizationPoliciesClient client. +func NewAuthorizationPoliciesClientWithBaseURI(baseURI string, subscriptionID string) AuthorizationPoliciesClient { + return AuthorizationPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates an authorization policy or updates an existing +// authorization policy. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. authorizationPolicyName is the name of the policy. parameters is +// parameters supplied to the CreateOrUpdate authorization policy operation. +func (client AuthorizationPoliciesClient) CreateOrUpdate(resourceGroupName string, hubName string, authorizationPolicyName string, parameters AuthorizationPolicyResourceFormat) (result AuthorizationPolicyResourceFormat, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: authorizationPolicyName, + Constraints: []validation.Constraint{{Target: "authorizationPolicyName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationPolicyName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "authorizationPolicyName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]$|^[A-Za-z0-9][\w-\.]*[A-Za-z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AuthorizationPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationPolicy.Permissions", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationPolicy.Permissions", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, authorizationPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AuthorizationPoliciesClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, authorizationPolicyName string, parameters AuthorizationPolicyResourceFormat) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AuthorizationPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result AuthorizationPolicyResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets an authorization policy in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. authorizationPolicyName is the name of the policy. +func (client AuthorizationPoliciesClient) Get(resourceGroupName string, hubName string, authorizationPolicyName string) (result AuthorizationPolicyResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, authorizationPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AuthorizationPoliciesClient) GetPreparer(resourceGroupName string, hubName string, authorizationPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AuthorizationPoliciesClient) GetResponder(resp *http.Response) (result AuthorizationPolicyResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all the authorization policies in a specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client AuthorizationPoliciesClient) ListByHub(resourceGroupName string, hubName string) (result AuthorizationPolicyListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client AuthorizationPoliciesClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationPoliciesClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client AuthorizationPoliciesClient) ListByHubResponder(resp *http.Response) (result AuthorizationPolicyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client AuthorizationPoliciesClient) ListByHubNextResults(lastResults AuthorizationPolicyListResult) (result AuthorizationPolicyListResult, err error) { + req, err := lastResults.AuthorizationPolicyListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} + +// RegeneratePrimaryKey regenerates the primary policy key of the specified +// authorization policy. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. authorizationPolicyName is the name of the policy. +func (client AuthorizationPoliciesClient) RegeneratePrimaryKey(resourceGroupName string, hubName string, authorizationPolicyName string) (result AuthorizationPolicy, err error) { + req, err := client.RegeneratePrimaryKeyPreparer(resourceGroupName, hubName, authorizationPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegeneratePrimaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegeneratePrimaryKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegeneratePrimaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegeneratePrimaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegeneratePrimaryKey", resp, "Failure responding to request") + } + + return +} + +// RegeneratePrimaryKeyPreparer prepares the RegeneratePrimaryKey request. +func (client AuthorizationPoliciesClient) RegeneratePrimaryKeyPreparer(resourceGroupName string, hubName string, authorizationPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regeneratePrimaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegeneratePrimaryKeySender sends the RegeneratePrimaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationPoliciesClient) RegeneratePrimaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegeneratePrimaryKeyResponder handles the response to the RegeneratePrimaryKey request. The method always +// closes the http.Response Body. +func (client AuthorizationPoliciesClient) RegeneratePrimaryKeyResponder(resp *http.Response) (result AuthorizationPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateSecondaryKey regenerates the secondary policy key of the specified +// authorization policy. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. authorizationPolicyName is the name of the policy. +func (client AuthorizationPoliciesClient) RegenerateSecondaryKey(resourceGroupName string, hubName string, authorizationPolicyName string) (result AuthorizationPolicy, err error) { + req, err := client.RegenerateSecondaryKeyPreparer(resourceGroupName, hubName, authorizationPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegenerateSecondaryKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateSecondaryKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegenerateSecondaryKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateSecondaryKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.AuthorizationPoliciesClient", "RegenerateSecondaryKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateSecondaryKeyPreparer prepares the RegenerateSecondaryKey request. +func (client AuthorizationPoliciesClient) RegenerateSecondaryKeyPreparer(resourceGroupName string, hubName string, authorizationPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationPolicyName": autorest.Encode("path", authorizationPolicyName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regenerateSecondaryKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateSecondaryKeySender sends the RegenerateSecondaryKey request. The method will close the +// http.Response Body if it receives an error. +func (client AuthorizationPoliciesClient) RegenerateSecondaryKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateSecondaryKeyResponder handles the response to the RegenerateSecondaryKey request. The method always +// closes the http.Response Body. +func (client AuthorizationPoliciesClient) RegenerateSecondaryKeyResponder(resp *http.Response) (result AuthorizationPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/client.go index cf2f2b7e13..7161204a7b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/client.go @@ -1,56 +1,56 @@ -// Package customerinsights implements the Azure ARM Customerinsights service -// API version 2017-01-01. -// -// The Azure Customer Insights management API provides a RESTful set of web -// services that interact with Azure Customer Insights service to manage your -// resources. The API has entities that capture the relationship between an end -// user and the Azure Customer Insights service. -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Customerinsights - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Customerinsights. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package customerinsights implements the Azure ARM Customerinsights service +// API version 2017-01-01. +// +// The Azure Customer Insights management API provides a RESTful set of web +// services that interact with Azure Customer Insights service to manage your +// resources. The API has entities that capture the relationship between an end +// user and the Azure Customer Insights service. +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Customerinsights + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Customerinsights. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectormappings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectormappings.go index b6e92a4887..fd13b7d699 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectormappings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectormappings.go @@ -1,369 +1,369 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ConnectorMappingsClient is the the Azure Customer Insights management API -// provides a RESTful set of web services that interact with Azure Customer -// Insights service to manage your resources. The API has entities that capture -// the relationship between an end user and the Azure Customer Insights -// service. -type ConnectorMappingsClient struct { - ManagementClient -} - -// NewConnectorMappingsClient creates an instance of the -// ConnectorMappingsClient client. -func NewConnectorMappingsClient(subscriptionID string) ConnectorMappingsClient { - return NewConnectorMappingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectorMappingsClientWithBaseURI creates an instance of the -// ConnectorMappingsClient client. -func NewConnectorMappingsClientWithBaseURI(baseURI string, subscriptionID string) ConnectorMappingsClient { - return ConnectorMappingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a connector mapping or updates an existing connector -// mapping in the connector. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. mappingName is the name -// of the connector mapping. parameters is parameters supplied to the -// CreateOrUpdate Connector Mapping operation. -func (client ConnectorMappingsClient) CreateOrUpdate(resourceGroupName string, hubName string, connectorName string, mappingName string, parameters ConnectorMappingResourceFormat) (result ConnectorMappingResourceFormat, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mappingName, - Constraints: []validation.Constraint{{Target: "mappingName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "mappingName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "mappingName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ConnectorMapping", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.EntityTypeName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectorMapping.MappingProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.MappingProperties.ErrorManagement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectorMapping.MappingProperties.Format", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.MappingProperties.Format.FormatType", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ConnectorMapping.MappingProperties.Availability", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.MappingProperties.Availability.Interval", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ConnectorMapping.MappingProperties.Structure", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ConnectorMapping.MappingProperties.CompleteOperation", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, connectorName, mappingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectorMappingsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, connectorName string, mappingName string, parameters ConnectorMappingResourceFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "mappingName": autorest.Encode("path", mappingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorMappingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConnectorMappingsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectorMappingResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a connector mapping in the connector. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. mappingName is the name -// of the connector mapping. -func (client ConnectorMappingsClient) Delete(resourceGroupName string, hubName string, connectorName string, mappingName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, hubName, connectorName, mappingName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConnectorMappingsClient) DeletePreparer(resourceGroupName string, hubName string, connectorName string, mappingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "mappingName": autorest.Encode("path", mappingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorMappingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConnectorMappingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a connector mapping in the connector. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. mappingName is the name -// of the connector mapping. -func (client ConnectorMappingsClient) Get(resourceGroupName string, hubName string, connectorName string, mappingName string) (result ConnectorMappingResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, connectorName, mappingName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectorMappingsClient) GetPreparer(resourceGroupName string, hubName string, connectorName string, mappingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "mappingName": autorest.Encode("path", mappingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorMappingsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConnectorMappingsClient) GetResponder(resp *http.Response) (result ConnectorMappingResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByConnector gets all the connector mappings in the specified connector. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. -func (client ConnectorMappingsClient) ListByConnector(resourceGroupName string, hubName string, connectorName string) (result ConnectorMappingListResult, err error) { - req, err := client.ListByConnectorPreparer(resourceGroupName, hubName, connectorName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", nil, "Failure preparing request") - return - } - - resp, err := client.ListByConnectorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure sending request") - return - } - - result, err = client.ListByConnectorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure responding to request") - } - - return -} - -// ListByConnectorPreparer prepares the ListByConnector request. -func (client ConnectorMappingsClient) ListByConnectorPreparer(resourceGroupName string, hubName string, connectorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByConnectorSender sends the ListByConnector request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorMappingsClient) ListByConnectorSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByConnectorResponder handles the response to the ListByConnector request. The method always -// closes the http.Response Body. -func (client ConnectorMappingsClient) ListByConnectorResponder(resp *http.Response) (result ConnectorMappingListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByConnectorNextResults retrieves the next set of results, if any. -func (client ConnectorMappingsClient) ListByConnectorNextResults(lastResults ConnectorMappingListResult) (result ConnectorMappingListResult, err error) { - req, err := lastResults.ConnectorMappingListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByConnectorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure sending next results request") - } - - result, err = client.ListByConnectorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ConnectorMappingsClient is the the Azure Customer Insights management API +// provides a RESTful set of web services that interact with Azure Customer +// Insights service to manage your resources. The API has entities that capture +// the relationship between an end user and the Azure Customer Insights +// service. +type ConnectorMappingsClient struct { + ManagementClient +} + +// NewConnectorMappingsClient creates an instance of the +// ConnectorMappingsClient client. +func NewConnectorMappingsClient(subscriptionID string) ConnectorMappingsClient { + return NewConnectorMappingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectorMappingsClientWithBaseURI creates an instance of the +// ConnectorMappingsClient client. +func NewConnectorMappingsClientWithBaseURI(baseURI string, subscriptionID string) ConnectorMappingsClient { + return ConnectorMappingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a connector mapping or updates an existing connector +// mapping in the connector. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. mappingName is the name +// of the connector mapping. parameters is parameters supplied to the +// CreateOrUpdate Connector Mapping operation. +func (client ConnectorMappingsClient) CreateOrUpdate(resourceGroupName string, hubName string, connectorName string, mappingName string, parameters ConnectorMappingResourceFormat) (result ConnectorMappingResourceFormat, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mappingName, + Constraints: []validation.Constraint{{Target: "mappingName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "mappingName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "mappingName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ConnectorMapping", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.EntityTypeName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConnectorMapping.MappingProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.MappingProperties.ErrorManagement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConnectorMapping.MappingProperties.Format", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.MappingProperties.Format.FormatType", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ConnectorMapping.MappingProperties.Availability", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectorMapping.MappingProperties.Availability.Interval", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ConnectorMapping.MappingProperties.Structure", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConnectorMapping.MappingProperties.CompleteOperation", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, connectorName, mappingName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectorMappingsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, connectorName string, mappingName string, parameters ConnectorMappingResourceFormat) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "mappingName": autorest.Encode("path", mappingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorMappingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectorMappingsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectorMappingResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a connector mapping in the connector. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. mappingName is the name +// of the connector mapping. +func (client ConnectorMappingsClient) Delete(resourceGroupName string, hubName string, connectorName string, mappingName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, hubName, connectorName, mappingName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectorMappingsClient) DeletePreparer(resourceGroupName string, hubName string, connectorName string, mappingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "mappingName": autorest.Encode("path", mappingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorMappingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectorMappingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a connector mapping in the connector. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. mappingName is the name +// of the connector mapping. +func (client ConnectorMappingsClient) Get(resourceGroupName string, hubName string, connectorName string, mappingName string) (result ConnectorMappingResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, connectorName, mappingName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectorMappingsClient) GetPreparer(resourceGroupName string, hubName string, connectorName string, mappingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "mappingName": autorest.Encode("path", mappingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorMappingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectorMappingsClient) GetResponder(resp *http.Response) (result ConnectorMappingResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByConnector gets all the connector mappings in the specified connector. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. +func (client ConnectorMappingsClient) ListByConnector(resourceGroupName string, hubName string, connectorName string) (result ConnectorMappingListResult, err error) { + req, err := client.ListByConnectorPreparer(resourceGroupName, hubName, connectorName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", nil, "Failure preparing request") + return + } + + resp, err := client.ListByConnectorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure sending request") + return + } + + result, err = client.ListByConnectorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure responding to request") + } + + return +} + +// ListByConnectorPreparer prepares the ListByConnector request. +func (client ConnectorMappingsClient) ListByConnectorPreparer(resourceGroupName string, hubName string, connectorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByConnectorSender sends the ListByConnector request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorMappingsClient) ListByConnectorSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByConnectorResponder handles the response to the ListByConnector request. The method always +// closes the http.Response Body. +func (client ConnectorMappingsClient) ListByConnectorResponder(resp *http.Response) (result ConnectorMappingListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByConnectorNextResults retrieves the next set of results, if any. +func (client ConnectorMappingsClient) ListByConnectorNextResults(lastResults ConnectorMappingListResult) (result ConnectorMappingListResult, err error) { + req, err := lastResults.ConnectorMappingListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByConnectorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure sending next results request") + } + + result, err = client.ListByConnectorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorMappingsClient", "ListByConnector", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectors.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectors.go index 965935f69e..de3ff1d820 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectors.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/connectors.go @@ -1,383 +1,383 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ConnectorsClient is the the Azure Customer Insights management API provides -// a RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type ConnectorsClient struct { - ManagementClient -} - -// NewConnectorsClient creates an instance of the ConnectorsClient client. -func NewConnectorsClient(subscriptionID string) ConnectorsClient { - return NewConnectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConnectorsClientWithBaseURI creates an instance of the ConnectorsClient -// client. -func NewConnectorsClientWithBaseURI(baseURI string, subscriptionID string) ConnectorsClient { - return ConnectorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a connector or updates an existing connector in the -// hub. This method may poll for completion. Polling can be canceled by passing -// the cancel channel argument. The channel will be used to cancel polling and -// any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. parameters is -// parameters supplied to the CreateOrUpdate Connector operation. -func (client ConnectorsClient) CreateOrUpdate(resourceGroupName string, hubName string, connectorName string, parameters ConnectorResourceFormat, cancel <-chan struct{}) (<-chan ConnectorResourceFormat, <-chan error) { - resultChan := make(chan ConnectorResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: connectorName, - Constraints: []validation.Constraint{{Target: "connectorName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "connectorName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "connectorName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Connector", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Connector.ConnectorProperties", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ConnectorResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, connectorName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConnectorsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, connectorName string, parameters ConnectorResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConnectorsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectorResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a connector in the hub. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. -func (client ConnectorsClient) Delete(resourceGroupName string, hubName string, connectorName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, hubName, connectorName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ConnectorsClient) DeletePreparer(resourceGroupName string, hubName string, connectorName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConnectorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a connector in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. connectorName is the name of the connector. -func (client ConnectorsClient) Get(resourceGroupName string, hubName string, connectorName string) (result ConnectorResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, connectorName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConnectorsClient) GetPreparer(resourceGroupName string, hubName string, connectorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "connectorName": autorest.Encode("path", connectorName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConnectorsClient) GetResponder(resp *http.Response) (result ConnectorResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all the connectors in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client ConnectorsClient) ListByHub(resourceGroupName string, hubName string) (result ConnectorListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client ConnectorsClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client ConnectorsClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client ConnectorsClient) ListByHubResponder(resp *http.Response) (result ConnectorListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client ConnectorsClient) ListByHubNextResults(lastResults ConnectorListResult) (result ConnectorListResult, err error) { - req, err := lastResults.ConnectorListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ConnectorsClient is the the Azure Customer Insights management API provides +// a RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type ConnectorsClient struct { + ManagementClient +} + +// NewConnectorsClient creates an instance of the ConnectorsClient client. +func NewConnectorsClient(subscriptionID string) ConnectorsClient { + return NewConnectorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectorsClientWithBaseURI creates an instance of the ConnectorsClient +// client. +func NewConnectorsClientWithBaseURI(baseURI string, subscriptionID string) ConnectorsClient { + return ConnectorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a connector or updates an existing connector in the +// hub. This method may poll for completion. Polling can be canceled by passing +// the cancel channel argument. The channel will be used to cancel polling and +// any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. parameters is +// parameters supplied to the CreateOrUpdate Connector operation. +func (client ConnectorsClient) CreateOrUpdate(resourceGroupName string, hubName string, connectorName string, parameters ConnectorResourceFormat, cancel <-chan struct{}) (<-chan ConnectorResourceFormat, <-chan error) { + resultChan := make(chan ConnectorResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: connectorName, + Constraints: []validation.Constraint{{Target: "connectorName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "connectorName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "connectorName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Connector", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Connector.ConnectorProperties", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ConnectorResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, connectorName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectorsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, connectorName string, parameters ConnectorResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectorResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a connector in the hub. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. +func (client ConnectorsClient) Delete(resourceGroupName string, hubName string, connectorName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, hubName, connectorName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ConnectorsClient) DeletePreparer(resourceGroupName string, hubName string, connectorName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a connector in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. connectorName is the name of the connector. +func (client ConnectorsClient) Get(resourceGroupName string, hubName string, connectorName string) (result ConnectorResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, connectorName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectorsClient) GetPreparer(resourceGroupName string, hubName string, connectorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) GetResponder(resp *http.Response) (result ConnectorResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all the connectors in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client ConnectorsClient) ListByHub(resourceGroupName string, hubName string) (result ConnectorListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client ConnectorsClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorsClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) ListByHubResponder(resp *http.Response) (result ConnectorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client ConnectorsClient) ListByHubNextResults(lastResults ConnectorListResult) (result ConnectorListResult, err error) { + req, err := lastResults.ConnectorListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ConnectorsClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/hubs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/hubs.go index a0144ea549..42becee80d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/hubs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/hubs.go @@ -1,521 +1,521 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// HubsClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type HubsClient struct { - ManagementClient -} - -// NewHubsClient creates an instance of the HubsClient client. -func NewHubsClient(subscriptionID string) HubsClient { - return NewHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHubsClientWithBaseURI creates an instance of the HubsClient client. -func NewHubsClientWithBaseURI(baseURI string, subscriptionID string) HubsClient { - return HubsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a hub, or updates an existing hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the Hub. parameters is parameters supplied to the CreateOrUpdate Hub -// operation. -func (client HubsClient) CreateOrUpdate(resourceGroupName string, hubName string, parameters Hub) (result Hub, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: hubName, - Constraints: []validation.Constraint{{Target: "hubName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hubName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "hubName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.HubPropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo.MinUnits", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo.MinUnits", Name: validation.InclusiveMaximum, Rule: 10, Chain: nil}, - {Target: "parameters.HubPropertiesFormat.HubBillingInfo.MinUnits", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.HubPropertiesFormat.HubBillingInfo.MaxUnits", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo.MaxUnits", Name: validation.InclusiveMaximum, Rule: 10, Chain: nil}, - {Target: "parameters.HubPropertiesFormat.HubBillingInfo.MaxUnits", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "customerinsights.HubsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client HubsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, parameters Hub) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client HubsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client HubsClient) CreateOrUpdateResponder(resp *http.Response) (result Hub, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified hub. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client HubsClient) Delete(resourceGroupName string, hubName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, hubName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client HubsClient) DeletePreparer(resourceGroupName string, hubName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client HubsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client HubsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client HubsClient) Get(resourceGroupName string, hubName string) (result Hub, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client HubsClient) GetPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HubsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HubsClient) GetResponder(resp *http.Response) (result Hub, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all hubs in the specified subscription. -func (client HubsClient) List() (result HubListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client HubsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client HubsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client HubsClient) ListResponder(resp *http.Response) (result HubListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client HubsClient) ListNextResults(lastResults HubListResult) (result HubListResult, err error) { - req, err := lastResults.HubListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets all the hubs in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client HubsClient) ListByResourceGroup(resourceGroupName string) (result HubListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client HubsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client HubsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client HubsClient) ListByResourceGroupResponder(resp *http.Response) (result HubListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client HubsClient) ListByResourceGroupNextResults(lastResults HubListResult) (result HubListResult, err error) { - req, err := lastResults.HubListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update updates a Hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the Hub. parameters is parameters supplied to the Update Hub operation. -func (client HubsClient) Update(resourceGroupName string, hubName string, parameters Hub) (result Hub, err error) { - req, err := client.UpdatePreparer(resourceGroupName, hubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HubsClient) UpdatePreparer(resourceGroupName string, hubName string, parameters Hub) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client HubsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client HubsClient) UpdateResponder(resp *http.Response) (result Hub, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// HubsClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type HubsClient struct { + ManagementClient +} + +// NewHubsClient creates an instance of the HubsClient client. +func NewHubsClient(subscriptionID string) HubsClient { + return NewHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHubsClientWithBaseURI creates an instance of the HubsClient client. +func NewHubsClientWithBaseURI(baseURI string, subscriptionID string) HubsClient { + return HubsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a hub, or updates an existing hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the Hub. parameters is parameters supplied to the CreateOrUpdate Hub +// operation. +func (client HubsClient) CreateOrUpdate(resourceGroupName string, hubName string, parameters Hub) (result Hub, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: hubName, + Constraints: []validation.Constraint{{Target: "hubName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "hubName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "hubName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.HubPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo.MinUnits", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo.MinUnits", Name: validation.InclusiveMaximum, Rule: 10, Chain: nil}, + {Target: "parameters.HubPropertiesFormat.HubBillingInfo.MinUnits", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.HubPropertiesFormat.HubBillingInfo.MaxUnits", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubPropertiesFormat.HubBillingInfo.MaxUnits", Name: validation.InclusiveMaximum, Rule: 10, Chain: nil}, + {Target: "parameters.HubPropertiesFormat.HubBillingInfo.MaxUnits", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "customerinsights.HubsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client HubsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, parameters Hub) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client HubsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client HubsClient) CreateOrUpdateResponder(resp *http.Response) (result Hub, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified hub. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client HubsClient) Delete(resourceGroupName string, hubName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, hubName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client HubsClient) DeletePreparer(resourceGroupName string, hubName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client HubsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client HubsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client HubsClient) Get(resourceGroupName string, hubName string) (result Hub, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client HubsClient) GetPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HubsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HubsClient) GetResponder(resp *http.Response) (result Hub, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all hubs in the specified subscription. +func (client HubsClient) List() (result HubListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client HubsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client HubsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client HubsClient) ListResponder(resp *http.Response) (result HubListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client HubsClient) ListNextResults(lastResults HubListResult) (result HubListResult, err error) { + req, err := lastResults.HubListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets all the hubs in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client HubsClient) ListByResourceGroup(resourceGroupName string) (result HubListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client HubsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client HubsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client HubsClient) ListByResourceGroupResponder(resp *http.Response) (result HubListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client HubsClient) ListByResourceGroupNextResults(lastResults HubListResult) (result HubListResult, err error) { + req, err := lastResults.HubListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update updates a Hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the Hub. parameters is parameters supplied to the Update Hub operation. +func (client HubsClient) Update(resourceGroupName string, hubName string, parameters Hub) (result Hub, err error) { + req, err := client.UpdatePreparer(resourceGroupName, hubName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.HubsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client HubsClient) UpdatePreparer(resourceGroupName string, hubName string, parameters Hub) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client HubsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client HubsClient) UpdateResponder(resp *http.Response) (result Hub, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/images.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/images.go index 75caf89bec..c77ace5a9b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/images.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/images.go @@ -1,182 +1,182 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ImagesClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type ImagesClient struct { - ManagementClient -} - -// NewImagesClient creates an instance of the ImagesClient client. -func NewImagesClient(subscriptionID string) ImagesClient { - return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImagesClientWithBaseURI creates an instance of the ImagesClient client. -func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient { - return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetUploadURLForData gets data image upload URL. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. parameters is parameters supplied to the GetUploadUrlForData -// operation. -func (client ImagesClient) GetUploadURLForData(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (result ImageDefinition, err error) { - req, err := client.GetUploadURLForDataPreparer(resourceGroupName, hubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForData", nil, "Failure preparing request") - return - } - - resp, err := client.GetUploadURLForDataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForData", resp, "Failure sending request") - return - } - - result, err = client.GetUploadURLForDataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForData", resp, "Failure responding to request") - } - - return -} - -// GetUploadURLForDataPreparer prepares the GetUploadURLForData request. -func (client ImagesClient) GetUploadURLForDataPreparer(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getDataImageUploadUrl", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetUploadURLForDataSender sends the GetUploadURLForData request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) GetUploadURLForDataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetUploadURLForDataResponder handles the response to the GetUploadURLForData request. The method always -// closes the http.Response Body. -func (client ImagesClient) GetUploadURLForDataResponder(resp *http.Response) (result ImageDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetUploadURLForEntityType gets entity type (profile or interaction) image -// upload URL. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. parameters is parameters supplied to the GetUploadUrlForEntityType -// operation. -func (client ImagesClient) GetUploadURLForEntityType(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (result ImageDefinition, err error) { - req, err := client.GetUploadURLForEntityTypePreparer(resourceGroupName, hubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForEntityType", nil, "Failure preparing request") - return - } - - resp, err := client.GetUploadURLForEntityTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForEntityType", resp, "Failure sending request") - return - } - - result, err = client.GetUploadURLForEntityTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForEntityType", resp, "Failure responding to request") - } - - return -} - -// GetUploadURLForEntityTypePreparer prepares the GetUploadURLForEntityType request. -func (client ImagesClient) GetUploadURLForEntityTypePreparer(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetUploadURLForEntityTypeSender sends the GetUploadURLForEntityType request. The method will close the -// http.Response Body if it receives an error. -func (client ImagesClient) GetUploadURLForEntityTypeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetUploadURLForEntityTypeResponder handles the response to the GetUploadURLForEntityType request. The method always -// closes the http.Response Body. -func (client ImagesClient) GetUploadURLForEntityTypeResponder(resp *http.Response) (result ImageDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ImagesClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type ImagesClient struct { + ManagementClient +} + +// NewImagesClient creates an instance of the ImagesClient client. +func NewImagesClient(subscriptionID string) ImagesClient { + return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImagesClientWithBaseURI creates an instance of the ImagesClient client. +func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient { + return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetUploadURLForData gets data image upload URL. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. parameters is parameters supplied to the GetUploadUrlForData +// operation. +func (client ImagesClient) GetUploadURLForData(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (result ImageDefinition, err error) { + req, err := client.GetUploadURLForDataPreparer(resourceGroupName, hubName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForData", nil, "Failure preparing request") + return + } + + resp, err := client.GetUploadURLForDataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForData", resp, "Failure sending request") + return + } + + result, err = client.GetUploadURLForDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForData", resp, "Failure responding to request") + } + + return +} + +// GetUploadURLForDataPreparer prepares the GetUploadURLForData request. +func (client ImagesClient) GetUploadURLForDataPreparer(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getDataImageUploadUrl", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetUploadURLForDataSender sends the GetUploadURLForData request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) GetUploadURLForDataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetUploadURLForDataResponder handles the response to the GetUploadURLForData request. The method always +// closes the http.Response Body. +func (client ImagesClient) GetUploadURLForDataResponder(resp *http.Response) (result ImageDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUploadURLForEntityType gets entity type (profile or interaction) image +// upload URL. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. parameters is parameters supplied to the GetUploadUrlForEntityType +// operation. +func (client ImagesClient) GetUploadURLForEntityType(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (result ImageDefinition, err error) { + req, err := client.GetUploadURLForEntityTypePreparer(resourceGroupName, hubName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForEntityType", nil, "Failure preparing request") + return + } + + resp, err := client.GetUploadURLForEntityTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForEntityType", resp, "Failure sending request") + return + } + + result, err = client.GetUploadURLForEntityTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ImagesClient", "GetUploadURLForEntityType", resp, "Failure responding to request") + } + + return +} + +// GetUploadURLForEntityTypePreparer prepares the GetUploadURLForEntityType request. +func (client ImagesClient) GetUploadURLForEntityTypePreparer(resourceGroupName string, hubName string, parameters GetImageUploadURLInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetUploadURLForEntityTypeSender sends the GetUploadURLForEntityType request. The method will close the +// http.Response Body if it receives an error. +func (client ImagesClient) GetUploadURLForEntityTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetUploadURLForEntityTypeResponder handles the response to the GetUploadURLForEntityType request. The method always +// closes the http.Response Body. +func (client ImagesClient) GetUploadURLForEntityTypeResponder(resp *http.Response) (result ImageDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/interactions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/interactions.go index b7039be7f3..1999cf078b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/interactions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/interactions.go @@ -1,375 +1,375 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// InteractionsClient is the the Azure Customer Insights management API -// provides a RESTful set of web services that interact with Azure Customer -// Insights service to manage your resources. The API has entities that capture -// the relationship between an end user and the Azure Customer Insights -// service. -type InteractionsClient struct { - ManagementClient -} - -// NewInteractionsClient creates an instance of the InteractionsClient client. -func NewInteractionsClient(subscriptionID string) InteractionsClient { - return NewInteractionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInteractionsClientWithBaseURI creates an instance of the -// InteractionsClient client. -func NewInteractionsClientWithBaseURI(baseURI string, subscriptionID string) InteractionsClient { - return InteractionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates an interaction or updates an existing interaction -// within a hub. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. interactionName is the name of the interaction. parameters is -// parameters supplied to the CreateOrUpdate Interaction operation. -func (client InteractionsClient) CreateOrUpdate(resourceGroupName string, hubName string, interactionName string, parameters InteractionResourceFormat, cancel <-chan struct{}) (<-chan InteractionResourceFormat, <-chan error) { - resultChan := make(chan InteractionResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: interactionName, - Constraints: []validation.Constraint{{Target: "interactionName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "interactionName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "interactionName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.InteractionsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result InteractionResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, interactionName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InteractionsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, interactionName string, parameters InteractionResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "interactionName": autorest.Encode("path", interactionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client InteractionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client InteractionsClient) CreateOrUpdateResponder(resp *http.Response) (result InteractionResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about the specified interaction. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. interactionName is the name of the interaction. localeCode is -// locale of interaction to retrieve, default is en-us. -func (client InteractionsClient) Get(resourceGroupName string, hubName string, interactionName string, localeCode string) (result InteractionResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, interactionName, localeCode) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client InteractionsClient) GetPreparer(resourceGroupName string, hubName string, interactionName string, localeCode string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "interactionName": autorest.Encode("path", interactionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(localeCode) > 0 { - queryParameters["locale-code"] = autorest.Encode("query", localeCode) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client InteractionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client InteractionsClient) GetResponder(resp *http.Response) (result InteractionResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all interactions in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. localeCode is locale of interaction to retrieve, default is en-us. -func (client InteractionsClient) ListByHub(resourceGroupName string, hubName string, localeCode string) (result InteractionListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName, localeCode) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client InteractionsClient) ListByHubPreparer(resourceGroupName string, hubName string, localeCode string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(localeCode) > 0 { - queryParameters["locale-code"] = autorest.Encode("query", localeCode) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client InteractionsClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client InteractionsClient) ListByHubResponder(resp *http.Response) (result InteractionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client InteractionsClient) ListByHubNextResults(lastResults InteractionListResult) (result InteractionListResult, err error) { - req, err := lastResults.InteractionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} - -// SuggestRelationshipLinks suggests relationships to create relationship -// links. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. interactionName is the name of the interaction. -func (client InteractionsClient) SuggestRelationshipLinks(resourceGroupName string, hubName string, interactionName string) (result SuggestRelationshipLinksResponse, err error) { - req, err := client.SuggestRelationshipLinksPreparer(resourceGroupName, hubName, interactionName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "SuggestRelationshipLinks", nil, "Failure preparing request") - return - } - - resp, err := client.SuggestRelationshipLinksSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "SuggestRelationshipLinks", resp, "Failure sending request") - return - } - - result, err = client.SuggestRelationshipLinksResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "SuggestRelationshipLinks", resp, "Failure responding to request") - } - - return -} - -// SuggestRelationshipLinksPreparer prepares the SuggestRelationshipLinks request. -func (client InteractionsClient) SuggestRelationshipLinksPreparer(resourceGroupName string, hubName string, interactionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "interactionName": autorest.Encode("path", interactionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}/suggestRelationshipLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SuggestRelationshipLinksSender sends the SuggestRelationshipLinks request. The method will close the -// http.Response Body if it receives an error. -func (client InteractionsClient) SuggestRelationshipLinksSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SuggestRelationshipLinksResponder handles the response to the SuggestRelationshipLinks request. The method always -// closes the http.Response Body. -func (client InteractionsClient) SuggestRelationshipLinksResponder(resp *http.Response) (result SuggestRelationshipLinksResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// InteractionsClient is the the Azure Customer Insights management API +// provides a RESTful set of web services that interact with Azure Customer +// Insights service to manage your resources. The API has entities that capture +// the relationship between an end user and the Azure Customer Insights +// service. +type InteractionsClient struct { + ManagementClient +} + +// NewInteractionsClient creates an instance of the InteractionsClient client. +func NewInteractionsClient(subscriptionID string) InteractionsClient { + return NewInteractionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInteractionsClientWithBaseURI creates an instance of the +// InteractionsClient client. +func NewInteractionsClientWithBaseURI(baseURI string, subscriptionID string) InteractionsClient { + return InteractionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates an interaction or updates an existing interaction +// within a hub. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. interactionName is the name of the interaction. parameters is +// parameters supplied to the CreateOrUpdate Interaction operation. +func (client InteractionsClient) CreateOrUpdate(resourceGroupName string, hubName string, interactionName string, parameters InteractionResourceFormat, cancel <-chan struct{}) (<-chan InteractionResourceFormat, <-chan error) { + resultChan := make(chan InteractionResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: interactionName, + Constraints: []validation.Constraint{{Target: "interactionName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "interactionName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "interactionName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.InteractionsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result InteractionResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, interactionName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InteractionsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, interactionName string, parameters InteractionResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "interactionName": autorest.Encode("path", interactionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InteractionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InteractionsClient) CreateOrUpdateResponder(resp *http.Response) (result InteractionResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets information about the specified interaction. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. interactionName is the name of the interaction. localeCode is +// locale of interaction to retrieve, default is en-us. +func (client InteractionsClient) Get(resourceGroupName string, hubName string, interactionName string, localeCode string) (result InteractionResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, interactionName, localeCode) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client InteractionsClient) GetPreparer(resourceGroupName string, hubName string, interactionName string, localeCode string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "interactionName": autorest.Encode("path", interactionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(localeCode) > 0 { + queryParameters["locale-code"] = autorest.Encode("query", localeCode) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InteractionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InteractionsClient) GetResponder(resp *http.Response) (result InteractionResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all interactions in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. localeCode is locale of interaction to retrieve, default is en-us. +func (client InteractionsClient) ListByHub(resourceGroupName string, hubName string, localeCode string) (result InteractionListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName, localeCode) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client InteractionsClient) ListByHubPreparer(resourceGroupName string, hubName string, localeCode string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(localeCode) > 0 { + queryParameters["locale-code"] = autorest.Encode("query", localeCode) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client InteractionsClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client InteractionsClient) ListByHubResponder(resp *http.Response) (result InteractionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client InteractionsClient) ListByHubNextResults(lastResults InteractionListResult) (result InteractionListResult, err error) { + req, err := lastResults.InteractionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} + +// SuggestRelationshipLinks suggests relationships to create relationship +// links. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. interactionName is the name of the interaction. +func (client InteractionsClient) SuggestRelationshipLinks(resourceGroupName string, hubName string, interactionName string) (result SuggestRelationshipLinksResponse, err error) { + req, err := client.SuggestRelationshipLinksPreparer(resourceGroupName, hubName, interactionName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "SuggestRelationshipLinks", nil, "Failure preparing request") + return + } + + resp, err := client.SuggestRelationshipLinksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "SuggestRelationshipLinks", resp, "Failure sending request") + return + } + + result, err = client.SuggestRelationshipLinksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.InteractionsClient", "SuggestRelationshipLinks", resp, "Failure responding to request") + } + + return +} + +// SuggestRelationshipLinksPreparer prepares the SuggestRelationshipLinks request. +func (client InteractionsClient) SuggestRelationshipLinksPreparer(resourceGroupName string, hubName string, interactionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "interactionName": autorest.Encode("path", interactionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}/suggestRelationshipLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SuggestRelationshipLinksSender sends the SuggestRelationshipLinks request. The method will close the +// http.Response Body if it receives an error. +func (client InteractionsClient) SuggestRelationshipLinksSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SuggestRelationshipLinksResponder handles the response to the SuggestRelationshipLinks request. The method always +// closes the http.Response Body. +func (client InteractionsClient) SuggestRelationshipLinksResponder(resp *http.Response) (result SuggestRelationshipLinksResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/kpi.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/kpi.go index a289da3175..7110ba1984 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/kpi.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/kpi.go @@ -1,455 +1,455 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// KpiClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type KpiClient struct { - ManagementClient -} - -// NewKpiClient creates an instance of the KpiClient client. -func NewKpiClient(subscriptionID string) KpiClient { - return NewKpiClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewKpiClientWithBaseURI creates an instance of the KpiClient client. -func NewKpiClientWithBaseURI(baseURI string, subscriptionID string) KpiClient { - return KpiClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a KPI or updates an existing KPI in the hub. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. kpiName is the name of the KPI. parameters is parameters supplied -// to the create/update KPI operation. -func (client KpiClient) CreateOrUpdate(resourceGroupName string, hubName string, kpiName string, parameters KpiResourceFormat, cancel <-chan struct{}) (<-chan KpiResourceFormat, <-chan error) { - resultChan := make(chan KpiResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: kpiName, - Constraints: []validation.Constraint{{Target: "kpiName", Name: validation.MaxLength, Rule: 512, Chain: nil}, - {Target: "kpiName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "kpiName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.KpiDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.KpiDefinition.EntityTypeName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.KpiDefinition.Expression", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.KpiDefinition.ThresHolds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.KpiDefinition.ThresHolds.LowerLimit", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.KpiDefinition.ThresHolds.UpperLimit", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.KpiDefinition.ThresHolds.IncreasingKpi", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.KpiClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result KpiResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, kpiName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client KpiClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, kpiName string, parameters KpiResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "kpiName": autorest.Encode("path", kpiName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client KpiClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client KpiClient) CreateOrUpdateResponder(resp *http.Response) (result KpiResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a KPI in the hub. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. kpiName is the name of the KPI. -func (client KpiClient) Delete(resourceGroupName string, hubName string, kpiName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, hubName, kpiName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client KpiClient) DeletePreparer(resourceGroupName string, hubName string, kpiName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "kpiName": autorest.Encode("path", kpiName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client KpiClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client KpiClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a KPI in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. kpiName is the name of the KPI. -func (client KpiClient) Get(resourceGroupName string, hubName string, kpiName string) (result KpiResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, kpiName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client KpiClient) GetPreparer(resourceGroupName string, hubName string, kpiName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "kpiName": autorest.Encode("path", kpiName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client KpiClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client KpiClient) GetResponder(resp *http.Response) (result KpiResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all the KPIs in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client KpiClient) ListByHub(resourceGroupName string, hubName string) (result KpiListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client KpiClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client KpiClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client KpiClient) ListByHubResponder(resp *http.Response) (result KpiListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client KpiClient) ListByHubNextResults(lastResults KpiListResult) (result KpiListResult, err error) { - req, err := lastResults.KpiListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} - -// Reprocess reprocesses the Kpi values of the specified KPI. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. kpiName is the name of the KPI. -func (client KpiClient) Reprocess(resourceGroupName string, hubName string, kpiName string) (result autorest.Response, err error) { - req, err := client.ReprocessPreparer(resourceGroupName, hubName, kpiName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Reprocess", nil, "Failure preparing request") - return - } - - resp, err := client.ReprocessSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Reprocess", resp, "Failure sending request") - return - } - - result, err = client.ReprocessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Reprocess", resp, "Failure responding to request") - } - - return -} - -// ReprocessPreparer prepares the Reprocess request. -func (client KpiClient) ReprocessPreparer(resourceGroupName string, hubName string, kpiName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "kpiName": autorest.Encode("path", kpiName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}/reprocess", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ReprocessSender sends the Reprocess request. The method will close the -// http.Response Body if it receives an error. -func (client KpiClient) ReprocessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ReprocessResponder handles the response to the Reprocess request. The method always -// closes the http.Response Body. -func (client KpiClient) ReprocessResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// KpiClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type KpiClient struct { + ManagementClient +} + +// NewKpiClient creates an instance of the KpiClient client. +func NewKpiClient(subscriptionID string) KpiClient { + return NewKpiClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewKpiClientWithBaseURI creates an instance of the KpiClient client. +func NewKpiClientWithBaseURI(baseURI string, subscriptionID string) KpiClient { + return KpiClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a KPI or updates an existing KPI in the hub. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. kpiName is the name of the KPI. parameters is parameters supplied +// to the create/update KPI operation. +func (client KpiClient) CreateOrUpdate(resourceGroupName string, hubName string, kpiName string, parameters KpiResourceFormat, cancel <-chan struct{}) (<-chan KpiResourceFormat, <-chan error) { + resultChan := make(chan KpiResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: kpiName, + Constraints: []validation.Constraint{{Target: "kpiName", Name: validation.MaxLength, Rule: 512, Chain: nil}, + {Target: "kpiName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "kpiName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.KpiDefinition", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.KpiDefinition.EntityTypeName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.KpiDefinition.Expression", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.KpiDefinition.ThresHolds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.KpiDefinition.ThresHolds.LowerLimit", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.KpiDefinition.ThresHolds.UpperLimit", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.KpiDefinition.ThresHolds.IncreasingKpi", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.KpiClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result KpiResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, kpiName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client KpiClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, kpiName string, parameters KpiResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "kpiName": autorest.Encode("path", kpiName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client KpiClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client KpiClient) CreateOrUpdateResponder(resp *http.Response) (result KpiResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a KPI in the hub. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. kpiName is the name of the KPI. +func (client KpiClient) Delete(resourceGroupName string, hubName string, kpiName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, hubName, kpiName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client KpiClient) DeletePreparer(resourceGroupName string, hubName string, kpiName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "kpiName": autorest.Encode("path", kpiName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client KpiClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client KpiClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a KPI in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. kpiName is the name of the KPI. +func (client KpiClient) Get(resourceGroupName string, hubName string, kpiName string) (result KpiResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, kpiName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client KpiClient) GetPreparer(resourceGroupName string, hubName string, kpiName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "kpiName": autorest.Encode("path", kpiName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client KpiClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client KpiClient) GetResponder(resp *http.Response) (result KpiResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all the KPIs in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client KpiClient) ListByHub(resourceGroupName string, hubName string) (result KpiListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client KpiClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client KpiClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client KpiClient) ListByHubResponder(resp *http.Response) (result KpiListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client KpiClient) ListByHubNextResults(lastResults KpiListResult) (result KpiListResult, err error) { + req, err := lastResults.KpiListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} + +// Reprocess reprocesses the Kpi values of the specified KPI. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. kpiName is the name of the KPI. +func (client KpiClient) Reprocess(resourceGroupName string, hubName string, kpiName string) (result autorest.Response, err error) { + req, err := client.ReprocessPreparer(resourceGroupName, hubName, kpiName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Reprocess", nil, "Failure preparing request") + return + } + + resp, err := client.ReprocessSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Reprocess", resp, "Failure sending request") + return + } + + result, err = client.ReprocessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.KpiClient", "Reprocess", resp, "Failure responding to request") + } + + return +} + +// ReprocessPreparer prepares the Reprocess request. +func (client KpiClient) ReprocessPreparer(resourceGroupName string, hubName string, kpiName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "kpiName": autorest.Encode("path", kpiName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}/reprocess", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ReprocessSender sends the Reprocess request. The method will close the +// http.Response Body if it receives an error. +func (client KpiClient) ReprocessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ReprocessResponder handles the response to the Reprocess request. The method always +// closes the http.Response Body. +func (client KpiClient) ReprocessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/links.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/links.go index c68045b851..dcae7fcd14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/links.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/links.go @@ -1,370 +1,370 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LinksClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type LinksClient struct { - ManagementClient -} - -// NewLinksClient creates an instance of the LinksClient client. -func NewLinksClient(subscriptionID string) LinksClient { - return NewLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLinksClientWithBaseURI creates an instance of the LinksClient client. -func NewLinksClientWithBaseURI(baseURI string, subscriptionID string) LinksClient { - return LinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a link or updates an existing link in the hub. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. linkName is the name of the link. parameters is parameters supplied -// to the CreateOrUpdate Link operation. -func (client LinksClient) CreateOrUpdate(resourceGroupName string, hubName string, linkName string, parameters LinkResourceFormat, cancel <-chan struct{}) (<-chan LinkResourceFormat, <-chan error) { - resultChan := make(chan LinkResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: linkName, - Constraints: []validation.Constraint{{Target: "linkName", Name: validation.MaxLength, Rule: 512, Chain: nil}, - {Target: "linkName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "linkName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LinkDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LinkDefinition.SourceInteractionType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LinkDefinition.TargetProfileType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LinkDefinition.ParticipantPropertyReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.LinksClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result LinkResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, linkName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LinksClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, linkName string, parameters LinkResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "linkName": autorest.Encode("path", linkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LinksClient) CreateOrUpdateResponder(resp *http.Response) (result LinkResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a link in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. linkName is the name of the link. -func (client LinksClient) Delete(resourceGroupName string, hubName string, linkName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, hubName, linkName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LinksClient) DeletePreparer(resourceGroupName string, hubName string, linkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "linkName": autorest.Encode("path", linkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LinksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a link in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. linkName is the name of the link. -func (client LinksClient) Get(resourceGroupName string, hubName string, linkName string) (result LinkResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, linkName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LinksClient) GetPreparer(resourceGroupName string, hubName string, linkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "linkName": autorest.Encode("path", linkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LinksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LinksClient) GetResponder(resp *http.Response) (result LinkResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all the links in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client LinksClient) ListByHub(resourceGroupName string, hubName string) (result LinkListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client LinksClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client LinksClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client LinksClient) ListByHubResponder(resp *http.Response) (result LinkListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client LinksClient) ListByHubNextResults(lastResults LinkListResult) (result LinkListResult, err error) { - req, err := lastResults.LinkListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LinksClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type LinksClient struct { + ManagementClient +} + +// NewLinksClient creates an instance of the LinksClient client. +func NewLinksClient(subscriptionID string) LinksClient { + return NewLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLinksClientWithBaseURI creates an instance of the LinksClient client. +func NewLinksClientWithBaseURI(baseURI string, subscriptionID string) LinksClient { + return LinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a link or updates an existing link in the hub. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. linkName is the name of the link. parameters is parameters supplied +// to the CreateOrUpdate Link operation. +func (client LinksClient) CreateOrUpdate(resourceGroupName string, hubName string, linkName string, parameters LinkResourceFormat, cancel <-chan struct{}) (<-chan LinkResourceFormat, <-chan error) { + resultChan := make(chan LinkResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: linkName, + Constraints: []validation.Constraint{{Target: "linkName", Name: validation.MaxLength, Rule: 512, Chain: nil}, + {Target: "linkName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "linkName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LinkDefinition", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.LinkDefinition.SourceInteractionType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LinkDefinition.TargetProfileType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LinkDefinition.ParticipantPropertyReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.LinksClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result LinkResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, linkName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LinksClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, linkName string, parameters LinkResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "linkName": autorest.Encode("path", linkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LinksClient) CreateOrUpdateResponder(resp *http.Response) (result LinkResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a link in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. linkName is the name of the link. +func (client LinksClient) Delete(resourceGroupName string, hubName string, linkName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, hubName, linkName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LinksClient) DeletePreparer(resourceGroupName string, hubName string, linkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "linkName": autorest.Encode("path", linkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LinksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a link in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. linkName is the name of the link. +func (client LinksClient) Get(resourceGroupName string, hubName string, linkName string) (result LinkResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, linkName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LinksClient) GetPreparer(resourceGroupName string, hubName string, linkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "linkName": autorest.Encode("path", linkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LinksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LinksClient) GetResponder(resp *http.Response) (result LinkResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all the links in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client LinksClient) ListByHub(resourceGroupName string, hubName string) (result LinkListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client LinksClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client LinksClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client LinksClient) ListByHubResponder(resp *http.Response) (result LinkListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client LinksClient) ListByHubNextResults(lastResults LinkListResult) (result LinkListResult, err error) { + req, err := lastResults.LinkListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.LinksClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/models.go index e3c8d31880..8458d73cc3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/models.go @@ -1,1257 +1,1257 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/shopspring/decimal" - "net/http" -) - -// CalculationWindowTypes enumerates the values for calculation window types. -type CalculationWindowTypes string - -const ( - // Day specifies the day state for calculation window types. - Day CalculationWindowTypes = "Day" - // Hour specifies the hour state for calculation window types. - Hour CalculationWindowTypes = "Hour" - // Lifetime specifies the lifetime state for calculation window types. - Lifetime CalculationWindowTypes = "Lifetime" - // Month specifies the month state for calculation window types. - Month CalculationWindowTypes = "Month" - // Week specifies the week state for calculation window types. - Week CalculationWindowTypes = "Week" -) - -// CardinalityTypes enumerates the values for cardinality types. -type CardinalityTypes string - -const ( - // ManyToMany specifies the many to many state for cardinality types. - ManyToMany CardinalityTypes = "ManyToMany" - // OneToMany specifies the one to many state for cardinality types. - OneToMany CardinalityTypes = "OneToMany" - // OneToOne specifies the one to one state for cardinality types. - OneToOne CardinalityTypes = "OneToOne" -) - -// CompletionOperationTypes enumerates the values for completion operation -// types. -type CompletionOperationTypes string - -const ( - // DeleteFile specifies the delete file state for completion operation - // types. - DeleteFile CompletionOperationTypes = "DeleteFile" - // DoNothing specifies the do nothing state for completion operation types. - DoNothing CompletionOperationTypes = "DoNothing" - // MoveFile specifies the move file state for completion operation types. - MoveFile CompletionOperationTypes = "MoveFile" -) - -// ConnectorMappingStates enumerates the values for connector mapping states. -type ConnectorMappingStates string - -const ( - // Created specifies the created state for connector mapping states. - Created ConnectorMappingStates = "Created" - // Creating specifies the creating state for connector mapping states. - Creating ConnectorMappingStates = "Creating" - // Expiring specifies the expiring state for connector mapping states. - Expiring ConnectorMappingStates = "Expiring" - // Failed specifies the failed state for connector mapping states. - Failed ConnectorMappingStates = "Failed" - // Ready specifies the ready state for connector mapping states. - Ready ConnectorMappingStates = "Ready" - // Running specifies the running state for connector mapping states. - Running ConnectorMappingStates = "Running" - // Stopped specifies the stopped state for connector mapping states. - Stopped ConnectorMappingStates = "Stopped" -) - -// ConnectorStates enumerates the values for connector states. -type ConnectorStates string - -const ( - // ConnectorStatesCreated specifies the connector states created state for - // connector states. - ConnectorStatesCreated ConnectorStates = "Created" - // ConnectorStatesCreating specifies the connector states creating state - // for connector states. - ConnectorStatesCreating ConnectorStates = "Creating" - // ConnectorStatesDeleting specifies the connector states deleting state - // for connector states. - ConnectorStatesDeleting ConnectorStates = "Deleting" - // ConnectorStatesExpiring specifies the connector states expiring state - // for connector states. - ConnectorStatesExpiring ConnectorStates = "Expiring" - // ConnectorStatesFailed specifies the connector states failed state for - // connector states. - ConnectorStatesFailed ConnectorStates = "Failed" - // ConnectorStatesReady specifies the connector states ready state for - // connector states. - ConnectorStatesReady ConnectorStates = "Ready" -) - -// ConnectorTypes enumerates the values for connector types. -type ConnectorTypes string - -const ( - // AzureBlob specifies the azure blob state for connector types. - AzureBlob ConnectorTypes = "AzureBlob" - // CRM specifies the crm state for connector types. - CRM ConnectorTypes = "CRM" - // ExchangeOnline specifies the exchange online state for connector types. - ExchangeOnline ConnectorTypes = "ExchangeOnline" - // None specifies the none state for connector types. - None ConnectorTypes = "None" - // Outbound specifies the outbound state for connector types. - Outbound ConnectorTypes = "Outbound" - // Salesforce specifies the salesforce state for connector types. - Salesforce ConnectorTypes = "Salesforce" -) - -// DataSourceType enumerates the values for data source type. -type DataSourceType string - -const ( - // DataSourceTypeConnectorMapping specifies the data source type connector - // mapping state for data source type. - DataSourceTypeConnectorMapping DataSourceType = "ConnectorMapping" - // DataSourceTypeLinkInteraction specifies the data source type link - // interaction state for data source type. - DataSourceTypeLinkInteraction DataSourceType = "LinkInteraction" - // DataSourceTypeSystemDefault specifies the data source type system - // default state for data source type. - DataSourceTypeSystemDefault DataSourceType = "SystemDefault" -) - -// EntityTypes enumerates the values for entity types. -type EntityTypes string - -const ( - // EntityTypesInteraction specifies the entity types interaction state for - // entity types. - EntityTypesInteraction EntityTypes = "Interaction" - // EntityTypesNone specifies the entity types none state for entity types. - EntityTypesNone EntityTypes = "None" - // EntityTypesProfile specifies the entity types profile state for entity - // types. - EntityTypesProfile EntityTypes = "Profile" - // EntityTypesRelationship specifies the entity types relationship state - // for entity types. - EntityTypesRelationship EntityTypes = "Relationship" -) - -// ErrorManagementTypes enumerates the values for error management types. -type ErrorManagementTypes string - -const ( - // RejectAndContinue specifies the reject and continue state for error - // management types. - RejectAndContinue ErrorManagementTypes = "RejectAndContinue" - // RejectUntilLimit specifies the reject until limit state for error - // management types. - RejectUntilLimit ErrorManagementTypes = "RejectUntilLimit" - // StopImport specifies the stop import state for error management types. - StopImport ErrorManagementTypes = "StopImport" -) - -// FrequencyTypes enumerates the values for frequency types. -type FrequencyTypes string - -const ( - // FrequencyTypesDay specifies the frequency types day state for frequency - // types. - FrequencyTypesDay FrequencyTypes = "Day" - // FrequencyTypesHour specifies the frequency types hour state for - // frequency types. - FrequencyTypesHour FrequencyTypes = "Hour" - // FrequencyTypesMinute specifies the frequency types minute state for - // frequency types. - FrequencyTypesMinute FrequencyTypes = "Minute" - // FrequencyTypesMonth specifies the frequency types month state for - // frequency types. - FrequencyTypesMonth FrequencyTypes = "Month" - // FrequencyTypesWeek specifies the frequency types week state for - // frequency types. - FrequencyTypesWeek FrequencyTypes = "Week" -) - -// InstanceOperationType enumerates the values for instance operation type. -type InstanceOperationType string - -const ( - // Delete specifies the delete state for instance operation type. - Delete InstanceOperationType = "Delete" - // Upsert specifies the upsert state for instance operation type. - Upsert InstanceOperationType = "Upsert" -) - -// KpiFunctions enumerates the values for kpi functions. -type KpiFunctions string - -const ( - // KpiFunctionsAvg specifies the kpi functions avg state for kpi functions. - KpiFunctionsAvg KpiFunctions = "Avg" - // KpiFunctionsCount specifies the kpi functions count state for kpi - // functions. - KpiFunctionsCount KpiFunctions = "Count" - // KpiFunctionsCountDistinct specifies the kpi functions count distinct - // state for kpi functions. - KpiFunctionsCountDistinct KpiFunctions = "CountDistinct" - // KpiFunctionsLast specifies the kpi functions last state for kpi - // functions. - KpiFunctionsLast KpiFunctions = "Last" - // KpiFunctionsMax specifies the kpi functions max state for kpi functions. - KpiFunctionsMax KpiFunctions = "Max" - // KpiFunctionsMin specifies the kpi functions min state for kpi functions. - KpiFunctionsMin KpiFunctions = "Min" - // KpiFunctionsNone specifies the kpi functions none state for kpi - // functions. - KpiFunctionsNone KpiFunctions = "None" - // KpiFunctionsSum specifies the kpi functions sum state for kpi functions. - KpiFunctionsSum KpiFunctions = "Sum" -) - -// LinkTypes enumerates the values for link types. -type LinkTypes string - -const ( - // CopyIfNull specifies the copy if null state for link types. - CopyIfNull LinkTypes = "CopyIfNull" - // UpdateAlways specifies the update always state for link types. - UpdateAlways LinkTypes = "UpdateAlways" -) - -// PermissionTypes enumerates the values for permission types. -type PermissionTypes string - -const ( - // Manage specifies the manage state for permission types. - Manage PermissionTypes = "Manage" - // Read specifies the read state for permission types. - Read PermissionTypes = "Read" - // Write specifies the write state for permission types. - Write PermissionTypes = "Write" -) - -// ProvisioningStates enumerates the values for provisioning states. -type ProvisioningStates string - -const ( - // ProvisioningStatesDeleting specifies the provisioning states deleting - // state for provisioning states. - ProvisioningStatesDeleting ProvisioningStates = "Deleting" - // ProvisioningStatesExpiring specifies the provisioning states expiring - // state for provisioning states. - ProvisioningStatesExpiring ProvisioningStates = "Expiring" - // ProvisioningStatesFailed specifies the provisioning states failed state - // for provisioning states. - ProvisioningStatesFailed ProvisioningStates = "Failed" - // ProvisioningStatesHumanIntervention specifies the provisioning states - // human intervention state for provisioning states. - ProvisioningStatesHumanIntervention ProvisioningStates = "HumanIntervention" - // ProvisioningStatesProvisioning specifies the provisioning states - // provisioning state for provisioning states. - ProvisioningStatesProvisioning ProvisioningStates = "Provisioning" - // ProvisioningStatesSucceeded specifies the provisioning states succeeded - // state for provisioning states. - ProvisioningStatesSucceeded ProvisioningStates = "Succeeded" -) - -// RoleTypes enumerates the values for role types. -type RoleTypes string - -const ( - // Admin specifies the admin state for role types. - Admin RoleTypes = "Admin" - // DataAdmin specifies the data admin state for role types. - DataAdmin RoleTypes = "DataAdmin" - // DataReader specifies the data reader state for role types. - DataReader RoleTypes = "DataReader" - // ManageAdmin specifies the manage admin state for role types. - ManageAdmin RoleTypes = "ManageAdmin" - // ManageReader specifies the manage reader state for role types. - ManageReader RoleTypes = "ManageReader" - // Reader specifies the reader state for role types. - Reader RoleTypes = "Reader" -) - -// AssignmentPrincipal is the AssignmentPrincipal -type AssignmentPrincipal struct { - PrincipalID *string `json:"principalId,omitempty"` - PrincipalType *string `json:"principalType,omitempty"` - PrincipalMetadata *map[string]*string `json:"principalMetadata,omitempty"` -} - -// AuthorizationPolicy is the authorization policy. -type AuthorizationPolicy struct { - autorest.Response `json:"-"` - PolicyName *string `json:"policyName,omitempty"` - Permissions *[]PermissionTypes `json:"permissions,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// AuthorizationPolicyListResult is the response of list authorization policy -// operation. -type AuthorizationPolicyListResult struct { - autorest.Response `json:"-"` - Value *[]AuthorizationPolicyResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationPolicyListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AuthorizationPolicyListResult) AuthorizationPolicyListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AuthorizationPolicyResourceFormat is the authorization policy resource -// format. -type AuthorizationPolicyResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *AuthorizationPolicy `json:"properties,omitempty"` -} - -// AzureBlobConnectorProperties is the Azure Blob connector properties. -type AzureBlobConnectorProperties struct { - ConnectionKeyVaultURL *string `json:"connectionKeyVaultUrl,omitempty"` -} - -// Connector is properties of connector. -type Connector struct { - ConnectorID *int32 `json:"connectorId,omitempty"` - ConnectorName *string `json:"connectorName,omitempty"` - ConnectorType ConnectorTypes `json:"connectorType,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Description *string `json:"description,omitempty"` - ConnectorProperties *map[string]*map[string]interface{} `json:"connectorProperties,omitempty"` - Created *date.Time `json:"created,omitempty"` - LastModified *date.Time `json:"lastModified,omitempty"` - State ConnectorStates `json:"state,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - IsInternal *bool `json:"isInternal,omitempty"` -} - -// ConnectorListResult is the response of list connector operation. -type ConnectorListResult struct { - autorest.Response `json:"-"` - Value *[]ConnectorResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectorListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ConnectorListResult) ConnectorListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ConnectorMapping is the connector mapping definition. -type ConnectorMapping struct { - ConnectorName *string `json:"connectorName,omitempty"` - ConnectorType ConnectorTypes `json:"connectorType,omitempty"` - Created *date.Time `json:"created,omitempty"` - LastModified *date.Time `json:"lastModified,omitempty"` - EntityType EntityTypes `json:"entityType,omitempty"` - EntityTypeName *string `json:"entityTypeName,omitempty"` - ConnectorMappingName *string `json:"connectorMappingName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Description *string `json:"description,omitempty"` - DataFormatID *string `json:"dataFormatId,omitempty"` - MappingProperties *ConnectorMappingProperties `json:"mappingProperties,omitempty"` - NextRunTime *date.Time `json:"nextRunTime,omitempty"` - RunID *string `json:"runId,omitempty"` - State ConnectorMappingStates `json:"state,omitempty"` - TenantID *string `json:"tenantId,omitempty"` -} - -// ConnectorMappingAvailability is connector mapping property availability. -type ConnectorMappingAvailability struct { - Frequency FrequencyTypes `json:"frequency,omitempty"` - Interval *int32 `json:"interval,omitempty"` -} - -// ConnectorMappingCompleteOperation is the complete operation. -type ConnectorMappingCompleteOperation struct { - CompletionOperationType CompletionOperationTypes `json:"completionOperationType,omitempty"` - DestinationFolder *string `json:"destinationFolder,omitempty"` -} - -// ConnectorMappingErrorManagement is the error mangement. -type ConnectorMappingErrorManagement struct { - ErrorManagementType ErrorManagementTypes `json:"errorManagementType,omitempty"` - ErrorLimit *int32 `json:"errorLimit,omitempty"` -} - -// ConnectorMappingFormat is connector mapping property format. -type ConnectorMappingFormat struct { - FormatType *string `json:"formatType,omitempty"` - ColumnDelimiter *string `json:"columnDelimiter,omitempty"` - AcceptLanguage *string `json:"acceptLanguage,omitempty"` - QuoteCharacter *string `json:"quoteCharacter,omitempty"` - QuoteEscapeCharacter *string `json:"quoteEscapeCharacter,omitempty"` - ArraySeparator *string `json:"arraySeparator,omitempty"` -} - -// ConnectorMappingListResult is the response of list connector mapping -// operation. -type ConnectorMappingListResult struct { - autorest.Response `json:"-"` - Value *[]ConnectorMappingResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectorMappingListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ConnectorMappingListResult) ConnectorMappingListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ConnectorMappingProperties is the connector mapping properties. -type ConnectorMappingProperties struct { - FolderPath *string `json:"folderPath,omitempty"` - FileFilter *string `json:"fileFilter,omitempty"` - HasHeader *bool `json:"hasHeader,omitempty"` - ErrorManagement *ConnectorMappingErrorManagement `json:"errorManagement,omitempty"` - Format *ConnectorMappingFormat `json:"format,omitempty"` - Availability *ConnectorMappingAvailability `json:"availability,omitempty"` - Structure *[]ConnectorMappingStructure `json:"structure,omitempty"` - CompleteOperation *ConnectorMappingCompleteOperation `json:"completeOperation,omitempty"` -} - -// ConnectorMappingResourceFormat is the c onnector mapping resource format. -type ConnectorMappingResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *ConnectorMapping `json:"properties,omitempty"` -} - -// ConnectorMappingStructure is connector mapping property structure. -type ConnectorMappingStructure struct { - PropertyName *string `json:"propertyName,omitempty"` - ColumnName *string `json:"columnName,omitempty"` - CustomFormatSpecifier *string `json:"customFormatSpecifier,omitempty"` - IsEncrypted *bool `json:"isEncrypted,omitempty"` -} - -// ConnectorResourceFormat is the connector resource format. -type ConnectorResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *Connector `json:"properties,omitempty"` -} - -// CrmConnectorEntities is the CRM connector entities. -type CrmConnectorEntities struct { - LogicalName *string `json:"logicalName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - IsProfile *bool `json:"isProfile,omitempty"` -} - -// CrmConnectorProperties is the CRM connector properties. -type CrmConnectorProperties struct { - ConnectionString *string `json:"connectionString,omitempty"` - OrganizationID *string `json:"organizationId,omitempty"` - OrganizationURL *string `json:"organizationUrl,omitempty"` - Entities *[]CrmConnectorEntities `json:"entities,omitempty"` - AccessToken *string `json:"accessToken,omitempty"` -} - -// DataSource is data Source is a way for us to know the source of instances. A -// single type can have data coming in from multiple places. In activities we -// use this to determine precedence rules. -type DataSource struct { - DataSourceType DataSourceType `json:"dataSourceType,omitempty"` - ID *string `json:"id,omitempty"` - LinkID *string `json:"linkId,omitempty"` - ConnectorMappingID *string `json:"connectorMappingId,omitempty"` -} - -// EnrichingKpi is the enriching KPI definition. -type EnrichingKpi struct { - EntityType EntityTypes `json:"entityType,omitempty"` - EntityTypeName *string `json:"entityTypeName,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - KpiName *string `json:"kpiName,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - CalculationWindow CalculationWindowTypes `json:"calculationWindow,omitempty"` - CalculationWindowFieldName *string `json:"calculationWindowFieldName,omitempty"` - Function KpiFunctions `json:"function,omitempty"` - Expression *string `json:"expression,omitempty"` - Unit *string `json:"unit,omitempty"` - Filter *string `json:"filter,omitempty"` - GroupBy *[]string `json:"groupBy,omitempty"` - GroupByMetadata *[]KpiGroupByMetadata `json:"groupByMetadata,omitempty"` - ParticipantProfilesMetadata *[]KpiParticipantProfilesMetadata `json:"participantProfilesMetadata,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - ThresHolds *KpiThresholds `json:"thresHolds,omitempty"` - Aliases *[]KpiAlias `json:"aliases,omitempty"` - Extracts *[]KpiExtract `json:"extracts,omitempty"` -} - -// EntityTypeDefinition is describes an entity. -type EntityTypeDefinition struct { - Attributes *map[string][]string `json:"attributes,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` - SmallImage *string `json:"smallImage,omitempty"` - MediumImage *string `json:"mediumImage,omitempty"` - LargeImage *string `json:"largeImage,omitempty"` - APIEntitySetName *string `json:"apiEntitySetName,omitempty"` - EntityType EntityTypes `json:"entityType,omitempty"` - Fields *[]PropertyDefinition `json:"fields,omitempty"` - InstancesCount *int32 `json:"instancesCount,omitempty"` - LastChangedUtc *date.Time `json:"lastChangedUtc,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - SchemaItemTypeLink *string `json:"schemaItemTypeLink,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - TimestampFieldName *string `json:"timestampFieldName,omitempty"` - TypeName *string `json:"typeName,omitempty"` -} - -// GetImageUploadURLInput is input type for getting image upload url. -type GetImageUploadURLInput struct { - EntityType *string `json:"entityType,omitempty"` - EntityTypeName *string `json:"entityTypeName,omitempty"` - RelativePath *string `json:"relativePath,omitempty"` -} - -// Hub is hub resource. -type Hub struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *HubPropertiesFormat `json:"properties,omitempty"` -} - -// HubBillingInfoFormat is hub billing info. -type HubBillingInfoFormat struct { - SkuName *string `json:"skuName,omitempty"` - MinUnits *int32 `json:"minUnits,omitempty"` - MaxUnits *int32 `json:"maxUnits,omitempty"` -} - -// HubListResult is response of list hub operation. -type HubListResult struct { - autorest.Response `json:"-"` - Value *[]Hub `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// HubListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client HubListResult) HubListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// HubPropertiesFormat is properties of hub. -type HubPropertiesFormat struct { - APIEndpoint *string `json:"apiEndpoint,omitempty"` - WebEndpoint *string `json:"webEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - TenantFeatures *int32 `json:"tenantFeatures,omitempty"` - HubBillingInfo *HubBillingInfoFormat `json:"hubBillingInfo,omitempty"` -} - -// ImageDefinition is the image definition. -type ImageDefinition struct { - autorest.Response `json:"-"` - ImageExists *bool `json:"imageExists,omitempty"` - ContentURL *string `json:"contentUrl,omitempty"` - RelativePath *string `json:"relativePath,omitempty"` -} - -// InteractionListResult is the response of list interaction operation. -type InteractionListResult struct { - autorest.Response `json:"-"` - Value *[]InteractionResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// InteractionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client InteractionListResult) InteractionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// InteractionResourceFormat is the interaction resource format. -type InteractionResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *InteractionTypeDefinition `json:"properties,omitempty"` -} - -// InteractionTypeDefinition is the Interaction Type Definition -type InteractionTypeDefinition struct { - Attributes *map[string][]string `json:"attributes,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` - SmallImage *string `json:"smallImage,omitempty"` - MediumImage *string `json:"mediumImage,omitempty"` - LargeImage *string `json:"largeImage,omitempty"` - APIEntitySetName *string `json:"apiEntitySetName,omitempty"` - EntityType EntityTypes `json:"entityType,omitempty"` - Fields *[]PropertyDefinition `json:"fields,omitempty"` - InstancesCount *int32 `json:"instancesCount,omitempty"` - LastChangedUtc *date.Time `json:"lastChangedUtc,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - SchemaItemTypeLink *string `json:"schemaItemTypeLink,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - TimestampFieldName *string `json:"timestampFieldName,omitempty"` - TypeName *string `json:"typeName,omitempty"` - IDPropertyNames *[]string `json:"idPropertyNames,omitempty"` - ParticipantProfiles *[]Participant `json:"participantProfiles,omitempty"` - PrimaryParticipantProfilePropertyName *string `json:"primaryParticipantProfilePropertyName,omitempty"` - DataSources *[]DataSource `json:"dataSources,omitempty"` - DefaultDataSourceID *string `json:"defaultDataSourceId,omitempty"` - IsActivity *bool `json:"isActivity,omitempty"` -} - -// KpiAlias is the KPI alias. -type KpiAlias struct { - AliasName *string `json:"aliasName,omitempty"` - Expression *string `json:"expression,omitempty"` -} - -// KpiDefinition is defines the KPI Threshold limits. -type KpiDefinition struct { - EntityType EntityTypes `json:"entityType,omitempty"` - EntityTypeName *string `json:"entityTypeName,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - KpiName *string `json:"kpiName,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - CalculationWindow CalculationWindowTypes `json:"calculationWindow,omitempty"` - CalculationWindowFieldName *string `json:"calculationWindowFieldName,omitempty"` - Function KpiFunctions `json:"function,omitempty"` - Expression *string `json:"expression,omitempty"` - Unit *string `json:"unit,omitempty"` - Filter *string `json:"filter,omitempty"` - GroupBy *[]string `json:"groupBy,omitempty"` - GroupByMetadata *[]KpiGroupByMetadata `json:"groupByMetadata,omitempty"` - ParticipantProfilesMetadata *[]KpiParticipantProfilesMetadata `json:"participantProfilesMetadata,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - ThresHolds *KpiThresholds `json:"thresHolds,omitempty"` - Aliases *[]KpiAlias `json:"aliases,omitempty"` - Extracts *[]KpiExtract `json:"extracts,omitempty"` -} - -// KpiExtract is the KPI extract. -type KpiExtract struct { - ExtractName *string `json:"extractName,omitempty"` - Expression *string `json:"expression,omitempty"` -} - -// KpiGroupByMetadata is the KPI GroupBy field metadata. -type KpiGroupByMetadata struct { - DisplayName *map[string]*string `json:"displayName,omitempty"` - FieldName *string `json:"fieldName,omitempty"` - FieldType *string `json:"fieldType,omitempty"` -} - -// KpiListResult is the response of list KPI operation. -type KpiListResult struct { - autorest.Response `json:"-"` - Value *[]KpiResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// KpiListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client KpiListResult) KpiListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// KpiParticipantProfilesMetadata is the KPI participant profile metadata. -type KpiParticipantProfilesMetadata struct { - TypeName *string `json:"typeName,omitempty"` -} - -// KpiResourceFormat is the KPI resource format. -type KpiResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *KpiDefinition `json:"properties,omitempty"` -} - -// KpiThresholds is defines the KPI Threshold limits. -type KpiThresholds struct { - LowerLimit *decimal.Decimal `json:"lowerLimit,omitempty"` - UpperLimit *decimal.Decimal `json:"upperLimit,omitempty"` - IncreasingKpi *bool `json:"increasingKpi,omitempty"` -} - -// LinkDefinition is the definition of Link. -type LinkDefinition struct { - TenantID *string `json:"tenantId,omitempty"` - LinkName *string `json:"linkName,omitempty"` - SourceInteractionType *string `json:"sourceInteractionType,omitempty"` - TargetProfileType *string `json:"targetProfileType,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - Mappings *[]TypePropertiesMapping `json:"mappings,omitempty"` - ParticipantPropertyReferences *[]ParticipantPropertyReference `json:"participantPropertyReferences,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - ReferenceOnly *bool `json:"referenceOnly,omitempty"` - OperationType InstanceOperationType `json:"operationType,omitempty"` -} - -// LinkListResult is the response of list link operation. -type LinkListResult struct { - autorest.Response `json:"-"` - Value *[]LinkResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// LinkListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client LinkListResult) LinkListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// LinkResourceFormat is the link resource format. -type LinkResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *LinkDefinition `json:"properties,omitempty"` -} - -// ListKpiDefinition is -type ListKpiDefinition struct { - autorest.Response `json:"-"` - Value *[]KpiDefinition `json:"value,omitempty"` -} - -// MetadataDefinitionBase is the Metadata definition base. -type MetadataDefinitionBase struct { - Attributes *map[string][]string `json:"attributes,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` - SmallImage *string `json:"smallImage,omitempty"` - MediumImage *string `json:"mediumImage,omitempty"` - LargeImage *string `json:"largeImage,omitempty"` -} - -// Participant is describes a profile type participating in an interaction. -type Participant struct { - ProfileTypeName *string `json:"profileTypeName,omitempty"` - ParticipantPropertyReferences *[]ParticipantPropertyReference `json:"participantPropertyReferences,omitempty"` - ParticipantName *string `json:"participantName,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - Role *string `json:"role,omitempty"` -} - -// ParticipantPropertyReference is the participant property reference. -type ParticipantPropertyReference struct { - InteractionPropertyName *string `json:"interactionPropertyName,omitempty"` - ProfilePropertyName *string `json:"profilePropertyName,omitempty"` -} - -// ProfileEnumValidValuesFormat is valid enum values in case of an enum -// property. -type ProfileEnumValidValuesFormat struct { - Value *int32 `json:"value,omitempty"` - LocalizedValueNames *map[string]*string `json:"localizedValueNames,omitempty"` -} - -// ProfileListResult is the response of list profile operation. -type ProfileListResult struct { - autorest.Response `json:"-"` - Value *[]ProfileResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ProfileListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProfileListResult) ProfileListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProfileResourceFormat is the profile resource format. -type ProfileResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *ProfileTypeDefinition `json:"properties,omitempty"` -} - -// ProfileTypeDefinition is the profile type definition. -type ProfileTypeDefinition struct { - Attributes *map[string][]string `json:"attributes,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` - SmallImage *string `json:"smallImage,omitempty"` - MediumImage *string `json:"mediumImage,omitempty"` - LargeImage *string `json:"largeImage,omitempty"` - APIEntitySetName *string `json:"apiEntitySetName,omitempty"` - EntityType EntityTypes `json:"entityType,omitempty"` - Fields *[]PropertyDefinition `json:"fields,omitempty"` - InstancesCount *int32 `json:"instancesCount,omitempty"` - LastChangedUtc *date.Time `json:"lastChangedUtc,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - SchemaItemTypeLink *string `json:"schemaItemTypeLink,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - TimestampFieldName *string `json:"timestampFieldName,omitempty"` - TypeName *string `json:"typeName,omitempty"` - StrongIds *[]StrongID `json:"strongIds,omitempty"` -} - -// PropertyDefinition is property definition. -type PropertyDefinition struct { - ArrayValueSeparator *string `json:"arrayValueSeparator,omitempty"` - EnumValidValues *[]ProfileEnumValidValuesFormat `json:"enumValidValues,omitempty"` - FieldName *string `json:"fieldName,omitempty"` - FieldType *string `json:"fieldType,omitempty"` - IsArray *bool `json:"isArray,omitempty"` - IsEnum *bool `json:"isEnum,omitempty"` - IsFlagEnum *bool `json:"isFlagEnum,omitempty"` - IsImage *bool `json:"isImage,omitempty"` - IsLocalizedString *bool `json:"isLocalizedString,omitempty"` - IsName *bool `json:"isName,omitempty"` - IsRequired *bool `json:"isRequired,omitempty"` - PropertyID *string `json:"propertyId,omitempty"` - SchemaItemPropLink *string `json:"schemaItemPropLink,omitempty"` - MaxLength *int32 `json:"maxLength,omitempty"` - IsAvailableInGraph *bool `json:"isAvailableInGraph,omitempty"` -} - -// ProxyResource is common properties of proxy resource. -type ProxyResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// RelationshipDefinition is the definition of Relationship. -type RelationshipDefinition struct { - Cardinality CardinalityTypes `json:"cardinality,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - ExpiryDateTimeUtc *date.Time `json:"expiryDateTimeUtc,omitempty"` - Fields *[]PropertyDefinition `json:"fields,omitempty"` - LookupMappings *[]RelationshipTypeMapping `json:"lookupMappings,omitempty"` - ProfileType *string `json:"profileType,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - RelationshipName *string `json:"relationshipName,omitempty"` - RelatedProfileType *string `json:"relatedProfileType,omitempty"` - RelationshipGUIDID *string `json:"relationshipGuidId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` -} - -// RelationshipLinkDefinition is the definition of relationship link. -type RelationshipLinkDefinition struct { - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - InteractionType *string `json:"interactionType,omitempty"` - LinkName *string `json:"linkName,omitempty"` - Mappings *[]RelationshipLinkFieldMapping `json:"mappings,omitempty"` - ProfilePropertyReferences *[]ParticipantPropertyReference `json:"profilePropertyReferences,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - RelatedProfilePropertyReferences *[]ParticipantPropertyReference `json:"relatedProfilePropertyReferences,omitempty"` - RelationshipName *string `json:"relationshipName,omitempty"` - RelationshipGUIDID *string `json:"relationshipGuidId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` -} - -// RelationshipLinkFieldMapping is the fields mapping for Relationships. -type RelationshipLinkFieldMapping struct { - InteractionFieldName *string `json:"interactionFieldName,omitempty"` - LinkType LinkTypes `json:"linkType,omitempty"` - RelationshipFieldName *string `json:"relationshipFieldName,omitempty"` -} - -// RelationshipLinkListResult is the response of list relationship link -// operation. -type RelationshipLinkListResult struct { - autorest.Response `json:"-"` - Value *[]RelationshipLinkResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RelationshipLinkListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RelationshipLinkListResult) RelationshipLinkListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RelationshipLinkResourceFormat is the relationship link resource format. -type RelationshipLinkResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RelationshipLinkDefinition `json:"properties,omitempty"` -} - -// RelationshipListResult is the response of list relationship operation. -type RelationshipListResult struct { - autorest.Response `json:"-"` - Value *[]RelationshipResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RelationshipListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RelationshipListResult) RelationshipListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RelationshipResourceFormat is the relationship resource format. -type RelationshipResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RelationshipDefinition `json:"properties,omitempty"` -} - -// RelationshipsLookup is the definition of suggested relationship for the -// type. -type RelationshipsLookup struct { - ProfileName *string `json:"profileName,omitempty"` - ProfilePropertyReferences *[]ParticipantPropertyReference `json:"profilePropertyReferences,omitempty"` - RelatedProfileName *string `json:"relatedProfileName,omitempty"` - RelatedProfilePropertyReferences *[]ParticipantPropertyReference `json:"relatedProfilePropertyReferences,omitempty"` - ExistingRelationshipName *string `json:"existingRelationshipName,omitempty"` -} - -// RelationshipTypeFieldMapping is map a field of profile to its corresponding -// StrongId in Related Profile. -type RelationshipTypeFieldMapping struct { - ProfileFieldName *string `json:"profileFieldName,omitempty"` - RelatedProfileKeyProperty *string `json:"relatedProfileKeyProperty,omitempty"` -} - -// RelationshipTypeMapping is maps fields in Profile to their corresponding -// StrongIds in Related Profile. -type RelationshipTypeMapping struct { - FieldMappings *[]RelationshipTypeFieldMapping `json:"fieldMappings,omitempty"` -} - -// Resource is common properties of Azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceSetDescription is the resource set description. -type ResourceSetDescription struct { - Elements *[]string `json:"elements,omitempty"` - Exceptions *[]string `json:"exceptions,omitempty"` -} - -// Role is the Role definition. -type Role struct { - RoleName *string `json:"roleName,omitempty"` - Description *string `json:"description,omitempty"` -} - -// RoleAssignment is the Role Assignment definition. -type RoleAssignment struct { - TenantID *string `json:"tenantId,omitempty"` - AssignmentName *string `json:"assignmentName,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` - Role RoleTypes `json:"role,omitempty"` - Principals *[]AssignmentPrincipal `json:"principals,omitempty"` - Profiles *ResourceSetDescription `json:"profiles,omitempty"` - Interactions *ResourceSetDescription `json:"interactions,omitempty"` - Links *ResourceSetDescription `json:"links,omitempty"` - Kpis *ResourceSetDescription `json:"kpis,omitempty"` - SasPolicies *ResourceSetDescription `json:"sasPolicies,omitempty"` - Connectors *ResourceSetDescription `json:"connectors,omitempty"` - Views *ResourceSetDescription `json:"views,omitempty"` - RelationshipLinks *ResourceSetDescription `json:"relationshipLinks,omitempty"` - Relationships *ResourceSetDescription `json:"relationships,omitempty"` - WidgetTypes *ResourceSetDescription `json:"widgetTypes,omitempty"` - RoleAssignments *ResourceSetDescription `json:"roleAssignments,omitempty"` - ConflationPolicies *ResourceSetDescription `json:"conflationPolicies,omitempty"` - Segments *ResourceSetDescription `json:"segments,omitempty"` -} - -// RoleAssignmentListResult is the response of list role assignment operation. -type RoleAssignmentListResult struct { - autorest.Response `json:"-"` - Value *[]RoleAssignmentResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RoleAssignmentListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RoleAssignmentListResult) RoleAssignmentListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RoleAssignmentResourceFormat is the Role Assignment resource format. -type RoleAssignmentResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RoleAssignment `json:"properties,omitempty"` -} - -// RoleListResult is the response of list role assignment operation. -type RoleListResult struct { - autorest.Response `json:"-"` - Value *[]RoleResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RoleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RoleListResult) RoleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RoleResourceFormat is the role resource format. -type RoleResourceFormat struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *Role `json:"properties,omitempty"` -} - -// SalesforceConnectorProperties is the Salesforce connector properties. -type SalesforceConnectorProperties struct { - Usersetting *SalesforceDiscoverSetting `json:"usersetting,omitempty"` - Salesforcetables *[]SalesforceTable `json:"salesforcetables,omitempty"` -} - -// SalesforceDiscoverSetting is salesforce discover setting. -type SalesforceDiscoverSetting struct { - SalesforceConnectionStringSecretURL *string `json:"salesforceConnectionStringSecretUrl,omitempty"` -} - -// SalesforceTable is salesforce table. -type SalesforceTable struct { - IsProfile *string `json:"isProfile,omitempty"` - TableCategory *string `json:"tableCategory,omitempty"` - TableName *string `json:"tableName,omitempty"` - TableRemarks *string `json:"tableRemarks,omitempty"` - TableSchema *string `json:"tableSchema,omitempty"` -} - -// StrongID is property/Properties which represent a unique ID. -type StrongID struct { - KeyPropertyNames *[]string `json:"keyPropertyNames,omitempty"` - StrongIDName *string `json:"strongIdName,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Description *map[string]*string `json:"description,omitempty"` -} - -// SuggestRelationshipLinksResponse is the response of suggest relationship -// links operation. -type SuggestRelationshipLinksResponse struct { - autorest.Response `json:"-"` - InteractionName *string `json:"interactionName,omitempty"` - SuggestedRelationships *[]RelationshipsLookup `json:"suggestedRelationships,omitempty"` -} - -// TypePropertiesMapping is metadata for a Link's property mapping. -type TypePropertiesMapping struct { - InteractionTypePropertyName *string `json:"interactionTypePropertyName,omitempty"` - ProfileTypePropertyName *string `json:"profileTypePropertyName,omitempty"` - IsProfileTypeID *bool `json:"isProfileTypeId,omitempty"` - LinkType LinkTypes `json:"linkType,omitempty"` -} - -// View is the view in Customer 360 web application. -type View struct { - ViewName *string `json:"viewName,omitempty"` - UserID *string `json:"userId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - Definition *string `json:"definition,omitempty"` - Changed *date.Time `json:"changed,omitempty"` - Created *date.Time `json:"created,omitempty"` -} - -// ViewListResult is the response of list view operation. -type ViewListResult struct { - autorest.Response `json:"-"` - Value *[]ViewResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ViewListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ViewListResult) ViewListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ViewResourceFormat is the view resource format. -type ViewResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *View `json:"properties,omitempty"` -} - -// WidgetType is definition of WidgetType. -type WidgetType struct { - WidgetTypeName *string `json:"widgetTypeName,omitempty"` - Definition *string `json:"definition,omitempty"` - Description *string `json:"description,omitempty"` - DisplayName *map[string]*string `json:"displayName,omitempty"` - ImageURL *string `json:"imageUrl,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - WidgetVersion *string `json:"widgetVersion,omitempty"` - Changed *date.Time `json:"changed,omitempty"` - Created *date.Time `json:"created,omitempty"` -} - -// WidgetTypeListResult is the response of list widget type operation. -type WidgetTypeListResult struct { - autorest.Response `json:"-"` - Value *[]WidgetTypeResourceFormat `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WidgetTypeListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WidgetTypeListResult) WidgetTypeListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WidgetTypeResourceFormat is the WidgetTypeResourceFormat -type WidgetTypeResourceFormat struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *WidgetType `json:"properties,omitempty"` -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/shopspring/decimal" + "net/http" +) + +// CalculationWindowTypes enumerates the values for calculation window types. +type CalculationWindowTypes string + +const ( + // Day specifies the day state for calculation window types. + Day CalculationWindowTypes = "Day" + // Hour specifies the hour state for calculation window types. + Hour CalculationWindowTypes = "Hour" + // Lifetime specifies the lifetime state for calculation window types. + Lifetime CalculationWindowTypes = "Lifetime" + // Month specifies the month state for calculation window types. + Month CalculationWindowTypes = "Month" + // Week specifies the week state for calculation window types. + Week CalculationWindowTypes = "Week" +) + +// CardinalityTypes enumerates the values for cardinality types. +type CardinalityTypes string + +const ( + // ManyToMany specifies the many to many state for cardinality types. + ManyToMany CardinalityTypes = "ManyToMany" + // OneToMany specifies the one to many state for cardinality types. + OneToMany CardinalityTypes = "OneToMany" + // OneToOne specifies the one to one state for cardinality types. + OneToOne CardinalityTypes = "OneToOne" +) + +// CompletionOperationTypes enumerates the values for completion operation +// types. +type CompletionOperationTypes string + +const ( + // DeleteFile specifies the delete file state for completion operation + // types. + DeleteFile CompletionOperationTypes = "DeleteFile" + // DoNothing specifies the do nothing state for completion operation types. + DoNothing CompletionOperationTypes = "DoNothing" + // MoveFile specifies the move file state for completion operation types. + MoveFile CompletionOperationTypes = "MoveFile" +) + +// ConnectorMappingStates enumerates the values for connector mapping states. +type ConnectorMappingStates string + +const ( + // Created specifies the created state for connector mapping states. + Created ConnectorMappingStates = "Created" + // Creating specifies the creating state for connector mapping states. + Creating ConnectorMappingStates = "Creating" + // Expiring specifies the expiring state for connector mapping states. + Expiring ConnectorMappingStates = "Expiring" + // Failed specifies the failed state for connector mapping states. + Failed ConnectorMappingStates = "Failed" + // Ready specifies the ready state for connector mapping states. + Ready ConnectorMappingStates = "Ready" + // Running specifies the running state for connector mapping states. + Running ConnectorMappingStates = "Running" + // Stopped specifies the stopped state for connector mapping states. + Stopped ConnectorMappingStates = "Stopped" +) + +// ConnectorStates enumerates the values for connector states. +type ConnectorStates string + +const ( + // ConnectorStatesCreated specifies the connector states created state for + // connector states. + ConnectorStatesCreated ConnectorStates = "Created" + // ConnectorStatesCreating specifies the connector states creating state + // for connector states. + ConnectorStatesCreating ConnectorStates = "Creating" + // ConnectorStatesDeleting specifies the connector states deleting state + // for connector states. + ConnectorStatesDeleting ConnectorStates = "Deleting" + // ConnectorStatesExpiring specifies the connector states expiring state + // for connector states. + ConnectorStatesExpiring ConnectorStates = "Expiring" + // ConnectorStatesFailed specifies the connector states failed state for + // connector states. + ConnectorStatesFailed ConnectorStates = "Failed" + // ConnectorStatesReady specifies the connector states ready state for + // connector states. + ConnectorStatesReady ConnectorStates = "Ready" +) + +// ConnectorTypes enumerates the values for connector types. +type ConnectorTypes string + +const ( + // AzureBlob specifies the azure blob state for connector types. + AzureBlob ConnectorTypes = "AzureBlob" + // CRM specifies the crm state for connector types. + CRM ConnectorTypes = "CRM" + // ExchangeOnline specifies the exchange online state for connector types. + ExchangeOnline ConnectorTypes = "ExchangeOnline" + // None specifies the none state for connector types. + None ConnectorTypes = "None" + // Outbound specifies the outbound state for connector types. + Outbound ConnectorTypes = "Outbound" + // Salesforce specifies the salesforce state for connector types. + Salesforce ConnectorTypes = "Salesforce" +) + +// DataSourceType enumerates the values for data source type. +type DataSourceType string + +const ( + // DataSourceTypeConnectorMapping specifies the data source type connector + // mapping state for data source type. + DataSourceTypeConnectorMapping DataSourceType = "ConnectorMapping" + // DataSourceTypeLinkInteraction specifies the data source type link + // interaction state for data source type. + DataSourceTypeLinkInteraction DataSourceType = "LinkInteraction" + // DataSourceTypeSystemDefault specifies the data source type system + // default state for data source type. + DataSourceTypeSystemDefault DataSourceType = "SystemDefault" +) + +// EntityTypes enumerates the values for entity types. +type EntityTypes string + +const ( + // EntityTypesInteraction specifies the entity types interaction state for + // entity types. + EntityTypesInteraction EntityTypes = "Interaction" + // EntityTypesNone specifies the entity types none state for entity types. + EntityTypesNone EntityTypes = "None" + // EntityTypesProfile specifies the entity types profile state for entity + // types. + EntityTypesProfile EntityTypes = "Profile" + // EntityTypesRelationship specifies the entity types relationship state + // for entity types. + EntityTypesRelationship EntityTypes = "Relationship" +) + +// ErrorManagementTypes enumerates the values for error management types. +type ErrorManagementTypes string + +const ( + // RejectAndContinue specifies the reject and continue state for error + // management types. + RejectAndContinue ErrorManagementTypes = "RejectAndContinue" + // RejectUntilLimit specifies the reject until limit state for error + // management types. + RejectUntilLimit ErrorManagementTypes = "RejectUntilLimit" + // StopImport specifies the stop import state for error management types. + StopImport ErrorManagementTypes = "StopImport" +) + +// FrequencyTypes enumerates the values for frequency types. +type FrequencyTypes string + +const ( + // FrequencyTypesDay specifies the frequency types day state for frequency + // types. + FrequencyTypesDay FrequencyTypes = "Day" + // FrequencyTypesHour specifies the frequency types hour state for + // frequency types. + FrequencyTypesHour FrequencyTypes = "Hour" + // FrequencyTypesMinute specifies the frequency types minute state for + // frequency types. + FrequencyTypesMinute FrequencyTypes = "Minute" + // FrequencyTypesMonth specifies the frequency types month state for + // frequency types. + FrequencyTypesMonth FrequencyTypes = "Month" + // FrequencyTypesWeek specifies the frequency types week state for + // frequency types. + FrequencyTypesWeek FrequencyTypes = "Week" +) + +// InstanceOperationType enumerates the values for instance operation type. +type InstanceOperationType string + +const ( + // Delete specifies the delete state for instance operation type. + Delete InstanceOperationType = "Delete" + // Upsert specifies the upsert state for instance operation type. + Upsert InstanceOperationType = "Upsert" +) + +// KpiFunctions enumerates the values for kpi functions. +type KpiFunctions string + +const ( + // KpiFunctionsAvg specifies the kpi functions avg state for kpi functions. + KpiFunctionsAvg KpiFunctions = "Avg" + // KpiFunctionsCount specifies the kpi functions count state for kpi + // functions. + KpiFunctionsCount KpiFunctions = "Count" + // KpiFunctionsCountDistinct specifies the kpi functions count distinct + // state for kpi functions. + KpiFunctionsCountDistinct KpiFunctions = "CountDistinct" + // KpiFunctionsLast specifies the kpi functions last state for kpi + // functions. + KpiFunctionsLast KpiFunctions = "Last" + // KpiFunctionsMax specifies the kpi functions max state for kpi functions. + KpiFunctionsMax KpiFunctions = "Max" + // KpiFunctionsMin specifies the kpi functions min state for kpi functions. + KpiFunctionsMin KpiFunctions = "Min" + // KpiFunctionsNone specifies the kpi functions none state for kpi + // functions. + KpiFunctionsNone KpiFunctions = "None" + // KpiFunctionsSum specifies the kpi functions sum state for kpi functions. + KpiFunctionsSum KpiFunctions = "Sum" +) + +// LinkTypes enumerates the values for link types. +type LinkTypes string + +const ( + // CopyIfNull specifies the copy if null state for link types. + CopyIfNull LinkTypes = "CopyIfNull" + // UpdateAlways specifies the update always state for link types. + UpdateAlways LinkTypes = "UpdateAlways" +) + +// PermissionTypes enumerates the values for permission types. +type PermissionTypes string + +const ( + // Manage specifies the manage state for permission types. + Manage PermissionTypes = "Manage" + // Read specifies the read state for permission types. + Read PermissionTypes = "Read" + // Write specifies the write state for permission types. + Write PermissionTypes = "Write" +) + +// ProvisioningStates enumerates the values for provisioning states. +type ProvisioningStates string + +const ( + // ProvisioningStatesDeleting specifies the provisioning states deleting + // state for provisioning states. + ProvisioningStatesDeleting ProvisioningStates = "Deleting" + // ProvisioningStatesExpiring specifies the provisioning states expiring + // state for provisioning states. + ProvisioningStatesExpiring ProvisioningStates = "Expiring" + // ProvisioningStatesFailed specifies the provisioning states failed state + // for provisioning states. + ProvisioningStatesFailed ProvisioningStates = "Failed" + // ProvisioningStatesHumanIntervention specifies the provisioning states + // human intervention state for provisioning states. + ProvisioningStatesHumanIntervention ProvisioningStates = "HumanIntervention" + // ProvisioningStatesProvisioning specifies the provisioning states + // provisioning state for provisioning states. + ProvisioningStatesProvisioning ProvisioningStates = "Provisioning" + // ProvisioningStatesSucceeded specifies the provisioning states succeeded + // state for provisioning states. + ProvisioningStatesSucceeded ProvisioningStates = "Succeeded" +) + +// RoleTypes enumerates the values for role types. +type RoleTypes string + +const ( + // Admin specifies the admin state for role types. + Admin RoleTypes = "Admin" + // DataAdmin specifies the data admin state for role types. + DataAdmin RoleTypes = "DataAdmin" + // DataReader specifies the data reader state for role types. + DataReader RoleTypes = "DataReader" + // ManageAdmin specifies the manage admin state for role types. + ManageAdmin RoleTypes = "ManageAdmin" + // ManageReader specifies the manage reader state for role types. + ManageReader RoleTypes = "ManageReader" + // Reader specifies the reader state for role types. + Reader RoleTypes = "Reader" +) + +// AssignmentPrincipal is the AssignmentPrincipal +type AssignmentPrincipal struct { + PrincipalID *string `json:"principalId,omitempty"` + PrincipalType *string `json:"principalType,omitempty"` + PrincipalMetadata *map[string]*string `json:"principalMetadata,omitempty"` +} + +// AuthorizationPolicy is the authorization policy. +type AuthorizationPolicy struct { + autorest.Response `json:"-"` + PolicyName *string `json:"policyName,omitempty"` + Permissions *[]PermissionTypes `json:"permissions,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} + +// AuthorizationPolicyListResult is the response of list authorization policy +// operation. +type AuthorizationPolicyListResult struct { + autorest.Response `json:"-"` + Value *[]AuthorizationPolicyResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AuthorizationPolicyListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AuthorizationPolicyListResult) AuthorizationPolicyListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AuthorizationPolicyResourceFormat is the authorization policy resource +// format. +type AuthorizationPolicyResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *AuthorizationPolicy `json:"properties,omitempty"` +} + +// AzureBlobConnectorProperties is the Azure Blob connector properties. +type AzureBlobConnectorProperties struct { + ConnectionKeyVaultURL *string `json:"connectionKeyVaultUrl,omitempty"` +} + +// Connector is properties of connector. +type Connector struct { + ConnectorID *int32 `json:"connectorId,omitempty"` + ConnectorName *string `json:"connectorName,omitempty"` + ConnectorType ConnectorTypes `json:"connectorType,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` + ConnectorProperties *map[string]*map[string]interface{} `json:"connectorProperties,omitempty"` + Created *date.Time `json:"created,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + State ConnectorStates `json:"state,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + IsInternal *bool `json:"isInternal,omitempty"` +} + +// ConnectorListResult is the response of list connector operation. +type ConnectorListResult struct { + autorest.Response `json:"-"` + Value *[]ConnectorResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectorListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConnectorListResult) ConnectorListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ConnectorMapping is the connector mapping definition. +type ConnectorMapping struct { + ConnectorName *string `json:"connectorName,omitempty"` + ConnectorType ConnectorTypes `json:"connectorType,omitempty"` + Created *date.Time `json:"created,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + EntityType EntityTypes `json:"entityType,omitempty"` + EntityTypeName *string `json:"entityTypeName,omitempty"` + ConnectorMappingName *string `json:"connectorMappingName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` + DataFormatID *string `json:"dataFormatId,omitempty"` + MappingProperties *ConnectorMappingProperties `json:"mappingProperties,omitempty"` + NextRunTime *date.Time `json:"nextRunTime,omitempty"` + RunID *string `json:"runId,omitempty"` + State ConnectorMappingStates `json:"state,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + +// ConnectorMappingAvailability is connector mapping property availability. +type ConnectorMappingAvailability struct { + Frequency FrequencyTypes `json:"frequency,omitempty"` + Interval *int32 `json:"interval,omitempty"` +} + +// ConnectorMappingCompleteOperation is the complete operation. +type ConnectorMappingCompleteOperation struct { + CompletionOperationType CompletionOperationTypes `json:"completionOperationType,omitempty"` + DestinationFolder *string `json:"destinationFolder,omitempty"` +} + +// ConnectorMappingErrorManagement is the error mangement. +type ConnectorMappingErrorManagement struct { + ErrorManagementType ErrorManagementTypes `json:"errorManagementType,omitempty"` + ErrorLimit *int32 `json:"errorLimit,omitempty"` +} + +// ConnectorMappingFormat is connector mapping property format. +type ConnectorMappingFormat struct { + FormatType *string `json:"formatType,omitempty"` + ColumnDelimiter *string `json:"columnDelimiter,omitempty"` + AcceptLanguage *string `json:"acceptLanguage,omitempty"` + QuoteCharacter *string `json:"quoteCharacter,omitempty"` + QuoteEscapeCharacter *string `json:"quoteEscapeCharacter,omitempty"` + ArraySeparator *string `json:"arraySeparator,omitempty"` +} + +// ConnectorMappingListResult is the response of list connector mapping +// operation. +type ConnectorMappingListResult struct { + autorest.Response `json:"-"` + Value *[]ConnectorMappingResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectorMappingListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConnectorMappingListResult) ConnectorMappingListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ConnectorMappingProperties is the connector mapping properties. +type ConnectorMappingProperties struct { + FolderPath *string `json:"folderPath,omitempty"` + FileFilter *string `json:"fileFilter,omitempty"` + HasHeader *bool `json:"hasHeader,omitempty"` + ErrorManagement *ConnectorMappingErrorManagement `json:"errorManagement,omitempty"` + Format *ConnectorMappingFormat `json:"format,omitempty"` + Availability *ConnectorMappingAvailability `json:"availability,omitempty"` + Structure *[]ConnectorMappingStructure `json:"structure,omitempty"` + CompleteOperation *ConnectorMappingCompleteOperation `json:"completeOperation,omitempty"` +} + +// ConnectorMappingResourceFormat is the c onnector mapping resource format. +type ConnectorMappingResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ConnectorMapping `json:"properties,omitempty"` +} + +// ConnectorMappingStructure is connector mapping property structure. +type ConnectorMappingStructure struct { + PropertyName *string `json:"propertyName,omitempty"` + ColumnName *string `json:"columnName,omitempty"` + CustomFormatSpecifier *string `json:"customFormatSpecifier,omitempty"` + IsEncrypted *bool `json:"isEncrypted,omitempty"` +} + +// ConnectorResourceFormat is the connector resource format. +type ConnectorResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *Connector `json:"properties,omitempty"` +} + +// CrmConnectorEntities is the CRM connector entities. +type CrmConnectorEntities struct { + LogicalName *string `json:"logicalName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsProfile *bool `json:"isProfile,omitempty"` +} + +// CrmConnectorProperties is the CRM connector properties. +type CrmConnectorProperties struct { + ConnectionString *string `json:"connectionString,omitempty"` + OrganizationID *string `json:"organizationId,omitempty"` + OrganizationURL *string `json:"organizationUrl,omitempty"` + Entities *[]CrmConnectorEntities `json:"entities,omitempty"` + AccessToken *string `json:"accessToken,omitempty"` +} + +// DataSource is data Source is a way for us to know the source of instances. A +// single type can have data coming in from multiple places. In activities we +// use this to determine precedence rules. +type DataSource struct { + DataSourceType DataSourceType `json:"dataSourceType,omitempty"` + ID *string `json:"id,omitempty"` + LinkID *string `json:"linkId,omitempty"` + ConnectorMappingID *string `json:"connectorMappingId,omitempty"` +} + +// EnrichingKpi is the enriching KPI definition. +type EnrichingKpi struct { + EntityType EntityTypes `json:"entityType,omitempty"` + EntityTypeName *string `json:"entityTypeName,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + KpiName *string `json:"kpiName,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + CalculationWindow CalculationWindowTypes `json:"calculationWindow,omitempty"` + CalculationWindowFieldName *string `json:"calculationWindowFieldName,omitempty"` + Function KpiFunctions `json:"function,omitempty"` + Expression *string `json:"expression,omitempty"` + Unit *string `json:"unit,omitempty"` + Filter *string `json:"filter,omitempty"` + GroupBy *[]string `json:"groupBy,omitempty"` + GroupByMetadata *[]KpiGroupByMetadata `json:"groupByMetadata,omitempty"` + ParticipantProfilesMetadata *[]KpiParticipantProfilesMetadata `json:"participantProfilesMetadata,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + ThresHolds *KpiThresholds `json:"thresHolds,omitempty"` + Aliases *[]KpiAlias `json:"aliases,omitempty"` + Extracts *[]KpiExtract `json:"extracts,omitempty"` +} + +// EntityTypeDefinition is describes an entity. +type EntityTypeDefinition struct { + Attributes *map[string][]string `json:"attributes,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` + SmallImage *string `json:"smallImage,omitempty"` + MediumImage *string `json:"mediumImage,omitempty"` + LargeImage *string `json:"largeImage,omitempty"` + APIEntitySetName *string `json:"apiEntitySetName,omitempty"` + EntityType EntityTypes `json:"entityType,omitempty"` + Fields *[]PropertyDefinition `json:"fields,omitempty"` + InstancesCount *int32 `json:"instancesCount,omitempty"` + LastChangedUtc *date.Time `json:"lastChangedUtc,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + SchemaItemTypeLink *string `json:"schemaItemTypeLink,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + TimestampFieldName *string `json:"timestampFieldName,omitempty"` + TypeName *string `json:"typeName,omitempty"` +} + +// GetImageUploadURLInput is input type for getting image upload url. +type GetImageUploadURLInput struct { + EntityType *string `json:"entityType,omitempty"` + EntityTypeName *string `json:"entityTypeName,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` +} + +// Hub is hub resource. +type Hub struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HubPropertiesFormat `json:"properties,omitempty"` +} + +// HubBillingInfoFormat is hub billing info. +type HubBillingInfoFormat struct { + SkuName *string `json:"skuName,omitempty"` + MinUnits *int32 `json:"minUnits,omitempty"` + MaxUnits *int32 `json:"maxUnits,omitempty"` +} + +// HubListResult is response of list hub operation. +type HubListResult struct { + autorest.Response `json:"-"` + Value *[]Hub `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// HubListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client HubListResult) HubListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// HubPropertiesFormat is properties of hub. +type HubPropertiesFormat struct { + APIEndpoint *string `json:"apiEndpoint,omitempty"` + WebEndpoint *string `json:"webEndpoint,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + TenantFeatures *int32 `json:"tenantFeatures,omitempty"` + HubBillingInfo *HubBillingInfoFormat `json:"hubBillingInfo,omitempty"` +} + +// ImageDefinition is the image definition. +type ImageDefinition struct { + autorest.Response `json:"-"` + ImageExists *bool `json:"imageExists,omitempty"` + ContentURL *string `json:"contentUrl,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` +} + +// InteractionListResult is the response of list interaction operation. +type InteractionListResult struct { + autorest.Response `json:"-"` + Value *[]InteractionResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// InteractionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client InteractionListResult) InteractionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// InteractionResourceFormat is the interaction resource format. +type InteractionResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *InteractionTypeDefinition `json:"properties,omitempty"` +} + +// InteractionTypeDefinition is the Interaction Type Definition +type InteractionTypeDefinition struct { + Attributes *map[string][]string `json:"attributes,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` + SmallImage *string `json:"smallImage,omitempty"` + MediumImage *string `json:"mediumImage,omitempty"` + LargeImage *string `json:"largeImage,omitempty"` + APIEntitySetName *string `json:"apiEntitySetName,omitempty"` + EntityType EntityTypes `json:"entityType,omitempty"` + Fields *[]PropertyDefinition `json:"fields,omitempty"` + InstancesCount *int32 `json:"instancesCount,omitempty"` + LastChangedUtc *date.Time `json:"lastChangedUtc,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + SchemaItemTypeLink *string `json:"schemaItemTypeLink,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + TimestampFieldName *string `json:"timestampFieldName,omitempty"` + TypeName *string `json:"typeName,omitempty"` + IDPropertyNames *[]string `json:"idPropertyNames,omitempty"` + ParticipantProfiles *[]Participant `json:"participantProfiles,omitempty"` + PrimaryParticipantProfilePropertyName *string `json:"primaryParticipantProfilePropertyName,omitempty"` + DataSources *[]DataSource `json:"dataSources,omitempty"` + DefaultDataSourceID *string `json:"defaultDataSourceId,omitempty"` + IsActivity *bool `json:"isActivity,omitempty"` +} + +// KpiAlias is the KPI alias. +type KpiAlias struct { + AliasName *string `json:"aliasName,omitempty"` + Expression *string `json:"expression,omitempty"` +} + +// KpiDefinition is defines the KPI Threshold limits. +type KpiDefinition struct { + EntityType EntityTypes `json:"entityType,omitempty"` + EntityTypeName *string `json:"entityTypeName,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + KpiName *string `json:"kpiName,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + CalculationWindow CalculationWindowTypes `json:"calculationWindow,omitempty"` + CalculationWindowFieldName *string `json:"calculationWindowFieldName,omitempty"` + Function KpiFunctions `json:"function,omitempty"` + Expression *string `json:"expression,omitempty"` + Unit *string `json:"unit,omitempty"` + Filter *string `json:"filter,omitempty"` + GroupBy *[]string `json:"groupBy,omitempty"` + GroupByMetadata *[]KpiGroupByMetadata `json:"groupByMetadata,omitempty"` + ParticipantProfilesMetadata *[]KpiParticipantProfilesMetadata `json:"participantProfilesMetadata,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + ThresHolds *KpiThresholds `json:"thresHolds,omitempty"` + Aliases *[]KpiAlias `json:"aliases,omitempty"` + Extracts *[]KpiExtract `json:"extracts,omitempty"` +} + +// KpiExtract is the KPI extract. +type KpiExtract struct { + ExtractName *string `json:"extractName,omitempty"` + Expression *string `json:"expression,omitempty"` +} + +// KpiGroupByMetadata is the KPI GroupBy field metadata. +type KpiGroupByMetadata struct { + DisplayName *map[string]*string `json:"displayName,omitempty"` + FieldName *string `json:"fieldName,omitempty"` + FieldType *string `json:"fieldType,omitempty"` +} + +// KpiListResult is the response of list KPI operation. +type KpiListResult struct { + autorest.Response `json:"-"` + Value *[]KpiResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// KpiListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client KpiListResult) KpiListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// KpiParticipantProfilesMetadata is the KPI participant profile metadata. +type KpiParticipantProfilesMetadata struct { + TypeName *string `json:"typeName,omitempty"` +} + +// KpiResourceFormat is the KPI resource format. +type KpiResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *KpiDefinition `json:"properties,omitempty"` +} + +// KpiThresholds is defines the KPI Threshold limits. +type KpiThresholds struct { + LowerLimit *decimal.Decimal `json:"lowerLimit,omitempty"` + UpperLimit *decimal.Decimal `json:"upperLimit,omitempty"` + IncreasingKpi *bool `json:"increasingKpi,omitempty"` +} + +// LinkDefinition is the definition of Link. +type LinkDefinition struct { + TenantID *string `json:"tenantId,omitempty"` + LinkName *string `json:"linkName,omitempty"` + SourceInteractionType *string `json:"sourceInteractionType,omitempty"` + TargetProfileType *string `json:"targetProfileType,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + Mappings *[]TypePropertiesMapping `json:"mappings,omitempty"` + ParticipantPropertyReferences *[]ParticipantPropertyReference `json:"participantPropertyReferences,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + ReferenceOnly *bool `json:"referenceOnly,omitempty"` + OperationType InstanceOperationType `json:"operationType,omitempty"` +} + +// LinkListResult is the response of list link operation. +type LinkListResult struct { + autorest.Response `json:"-"` + Value *[]LinkResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// LinkListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client LinkListResult) LinkListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// LinkResourceFormat is the link resource format. +type LinkResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *LinkDefinition `json:"properties,omitempty"` +} + +// ListKpiDefinition is +type ListKpiDefinition struct { + autorest.Response `json:"-"` + Value *[]KpiDefinition `json:"value,omitempty"` +} + +// MetadataDefinitionBase is the Metadata definition base. +type MetadataDefinitionBase struct { + Attributes *map[string][]string `json:"attributes,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` + SmallImage *string `json:"smallImage,omitempty"` + MediumImage *string `json:"mediumImage,omitempty"` + LargeImage *string `json:"largeImage,omitempty"` +} + +// Participant is describes a profile type participating in an interaction. +type Participant struct { + ProfileTypeName *string `json:"profileTypeName,omitempty"` + ParticipantPropertyReferences *[]ParticipantPropertyReference `json:"participantPropertyReferences,omitempty"` + ParticipantName *string `json:"participantName,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + Role *string `json:"role,omitempty"` +} + +// ParticipantPropertyReference is the participant property reference. +type ParticipantPropertyReference struct { + InteractionPropertyName *string `json:"interactionPropertyName,omitempty"` + ProfilePropertyName *string `json:"profilePropertyName,omitempty"` +} + +// ProfileEnumValidValuesFormat is valid enum values in case of an enum +// property. +type ProfileEnumValidValuesFormat struct { + Value *int32 `json:"value,omitempty"` + LocalizedValueNames *map[string]*string `json:"localizedValueNames,omitempty"` +} + +// ProfileListResult is the response of list profile operation. +type ProfileListResult struct { + autorest.Response `json:"-"` + Value *[]ProfileResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProfileListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProfileListResult) ProfileListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProfileResourceFormat is the profile resource format. +type ProfileResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ProfileTypeDefinition `json:"properties,omitempty"` +} + +// ProfileTypeDefinition is the profile type definition. +type ProfileTypeDefinition struct { + Attributes *map[string][]string `json:"attributes,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + LocalizedAttributes *map[string]map[string]*string `json:"localizedAttributes,omitempty"` + SmallImage *string `json:"smallImage,omitempty"` + MediumImage *string `json:"mediumImage,omitempty"` + LargeImage *string `json:"largeImage,omitempty"` + APIEntitySetName *string `json:"apiEntitySetName,omitempty"` + EntityType EntityTypes `json:"entityType,omitempty"` + Fields *[]PropertyDefinition `json:"fields,omitempty"` + InstancesCount *int32 `json:"instancesCount,omitempty"` + LastChangedUtc *date.Time `json:"lastChangedUtc,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + SchemaItemTypeLink *string `json:"schemaItemTypeLink,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + TimestampFieldName *string `json:"timestampFieldName,omitempty"` + TypeName *string `json:"typeName,omitempty"` + StrongIds *[]StrongID `json:"strongIds,omitempty"` +} + +// PropertyDefinition is property definition. +type PropertyDefinition struct { + ArrayValueSeparator *string `json:"arrayValueSeparator,omitempty"` + EnumValidValues *[]ProfileEnumValidValuesFormat `json:"enumValidValues,omitempty"` + FieldName *string `json:"fieldName,omitempty"` + FieldType *string `json:"fieldType,omitempty"` + IsArray *bool `json:"isArray,omitempty"` + IsEnum *bool `json:"isEnum,omitempty"` + IsFlagEnum *bool `json:"isFlagEnum,omitempty"` + IsImage *bool `json:"isImage,omitempty"` + IsLocalizedString *bool `json:"isLocalizedString,omitempty"` + IsName *bool `json:"isName,omitempty"` + IsRequired *bool `json:"isRequired,omitempty"` + PropertyID *string `json:"propertyId,omitempty"` + SchemaItemPropLink *string `json:"schemaItemPropLink,omitempty"` + MaxLength *int32 `json:"maxLength,omitempty"` + IsAvailableInGraph *bool `json:"isAvailableInGraph,omitempty"` +} + +// ProxyResource is common properties of proxy resource. +type ProxyResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RelationshipDefinition is the definition of Relationship. +type RelationshipDefinition struct { + Cardinality CardinalityTypes `json:"cardinality,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + ExpiryDateTimeUtc *date.Time `json:"expiryDateTimeUtc,omitempty"` + Fields *[]PropertyDefinition `json:"fields,omitempty"` + LookupMappings *[]RelationshipTypeMapping `json:"lookupMappings,omitempty"` + ProfileType *string `json:"profileType,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + RelationshipName *string `json:"relationshipName,omitempty"` + RelatedProfileType *string `json:"relatedProfileType,omitempty"` + RelationshipGUIDID *string `json:"relationshipGuidId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + +// RelationshipLinkDefinition is the definition of relationship link. +type RelationshipLinkDefinition struct { + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + InteractionType *string `json:"interactionType,omitempty"` + LinkName *string `json:"linkName,omitempty"` + Mappings *[]RelationshipLinkFieldMapping `json:"mappings,omitempty"` + ProfilePropertyReferences *[]ParticipantPropertyReference `json:"profilePropertyReferences,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + RelatedProfilePropertyReferences *[]ParticipantPropertyReference `json:"relatedProfilePropertyReferences,omitempty"` + RelationshipName *string `json:"relationshipName,omitempty"` + RelationshipGUIDID *string `json:"relationshipGuidId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + +// RelationshipLinkFieldMapping is the fields mapping for Relationships. +type RelationshipLinkFieldMapping struct { + InteractionFieldName *string `json:"interactionFieldName,omitempty"` + LinkType LinkTypes `json:"linkType,omitempty"` + RelationshipFieldName *string `json:"relationshipFieldName,omitempty"` +} + +// RelationshipLinkListResult is the response of list relationship link +// operation. +type RelationshipLinkListResult struct { + autorest.Response `json:"-"` + Value *[]RelationshipLinkResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RelationshipLinkListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RelationshipLinkListResult) RelationshipLinkListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RelationshipLinkResourceFormat is the relationship link resource format. +type RelationshipLinkResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RelationshipLinkDefinition `json:"properties,omitempty"` +} + +// RelationshipListResult is the response of list relationship operation. +type RelationshipListResult struct { + autorest.Response `json:"-"` + Value *[]RelationshipResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RelationshipListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RelationshipListResult) RelationshipListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RelationshipResourceFormat is the relationship resource format. +type RelationshipResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RelationshipDefinition `json:"properties,omitempty"` +} + +// RelationshipsLookup is the definition of suggested relationship for the +// type. +type RelationshipsLookup struct { + ProfileName *string `json:"profileName,omitempty"` + ProfilePropertyReferences *[]ParticipantPropertyReference `json:"profilePropertyReferences,omitempty"` + RelatedProfileName *string `json:"relatedProfileName,omitempty"` + RelatedProfilePropertyReferences *[]ParticipantPropertyReference `json:"relatedProfilePropertyReferences,omitempty"` + ExistingRelationshipName *string `json:"existingRelationshipName,omitempty"` +} + +// RelationshipTypeFieldMapping is map a field of profile to its corresponding +// StrongId in Related Profile. +type RelationshipTypeFieldMapping struct { + ProfileFieldName *string `json:"profileFieldName,omitempty"` + RelatedProfileKeyProperty *string `json:"relatedProfileKeyProperty,omitempty"` +} + +// RelationshipTypeMapping is maps fields in Profile to their corresponding +// StrongIds in Related Profile. +type RelationshipTypeMapping struct { + FieldMappings *[]RelationshipTypeFieldMapping `json:"fieldMappings,omitempty"` +} + +// Resource is common properties of Azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceSetDescription is the resource set description. +type ResourceSetDescription struct { + Elements *[]string `json:"elements,omitempty"` + Exceptions *[]string `json:"exceptions,omitempty"` +} + +// Role is the Role definition. +type Role struct { + RoleName *string `json:"roleName,omitempty"` + Description *string `json:"description,omitempty"` +} + +// RoleAssignment is the Role Assignment definition. +type RoleAssignment struct { + TenantID *string `json:"tenantId,omitempty"` + AssignmentName *string `json:"assignmentName,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` + Role RoleTypes `json:"role,omitempty"` + Principals *[]AssignmentPrincipal `json:"principals,omitempty"` + Profiles *ResourceSetDescription `json:"profiles,omitempty"` + Interactions *ResourceSetDescription `json:"interactions,omitempty"` + Links *ResourceSetDescription `json:"links,omitempty"` + Kpis *ResourceSetDescription `json:"kpis,omitempty"` + SasPolicies *ResourceSetDescription `json:"sasPolicies,omitempty"` + Connectors *ResourceSetDescription `json:"connectors,omitempty"` + Views *ResourceSetDescription `json:"views,omitempty"` + RelationshipLinks *ResourceSetDescription `json:"relationshipLinks,omitempty"` + Relationships *ResourceSetDescription `json:"relationships,omitempty"` + WidgetTypes *ResourceSetDescription `json:"widgetTypes,omitempty"` + RoleAssignments *ResourceSetDescription `json:"roleAssignments,omitempty"` + ConflationPolicies *ResourceSetDescription `json:"conflationPolicies,omitempty"` + Segments *ResourceSetDescription `json:"segments,omitempty"` +} + +// RoleAssignmentListResult is the response of list role assignment operation. +type RoleAssignmentListResult struct { + autorest.Response `json:"-"` + Value *[]RoleAssignmentResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleAssignmentListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RoleAssignmentListResult) RoleAssignmentListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RoleAssignmentResourceFormat is the Role Assignment resource format. +type RoleAssignmentResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RoleAssignment `json:"properties,omitempty"` +} + +// RoleListResult is the response of list role assignment operation. +type RoleListResult struct { + autorest.Response `json:"-"` + Value *[]RoleResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RoleListResult) RoleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RoleResourceFormat is the role resource format. +type RoleResourceFormat struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *Role `json:"properties,omitempty"` +} + +// SalesforceConnectorProperties is the Salesforce connector properties. +type SalesforceConnectorProperties struct { + Usersetting *SalesforceDiscoverSetting `json:"usersetting,omitempty"` + Salesforcetables *[]SalesforceTable `json:"salesforcetables,omitempty"` +} + +// SalesforceDiscoverSetting is salesforce discover setting. +type SalesforceDiscoverSetting struct { + SalesforceConnectionStringSecretURL *string `json:"salesforceConnectionStringSecretUrl,omitempty"` +} + +// SalesforceTable is salesforce table. +type SalesforceTable struct { + IsProfile *string `json:"isProfile,omitempty"` + TableCategory *string `json:"tableCategory,omitempty"` + TableName *string `json:"tableName,omitempty"` + TableRemarks *string `json:"tableRemarks,omitempty"` + TableSchema *string `json:"tableSchema,omitempty"` +} + +// StrongID is property/Properties which represent a unique ID. +type StrongID struct { + KeyPropertyNames *[]string `json:"keyPropertyNames,omitempty"` + StrongIDName *string `json:"strongIdName,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Description *map[string]*string `json:"description,omitempty"` +} + +// SuggestRelationshipLinksResponse is the response of suggest relationship +// links operation. +type SuggestRelationshipLinksResponse struct { + autorest.Response `json:"-"` + InteractionName *string `json:"interactionName,omitempty"` + SuggestedRelationships *[]RelationshipsLookup `json:"suggestedRelationships,omitempty"` +} + +// TypePropertiesMapping is metadata for a Link's property mapping. +type TypePropertiesMapping struct { + InteractionTypePropertyName *string `json:"interactionTypePropertyName,omitempty"` + ProfileTypePropertyName *string `json:"profileTypePropertyName,omitempty"` + IsProfileTypeID *bool `json:"isProfileTypeId,omitempty"` + LinkType LinkTypes `json:"linkType,omitempty"` +} + +// View is the view in Customer 360 web application. +type View struct { + ViewName *string `json:"viewName,omitempty"` + UserID *string `json:"userId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + Definition *string `json:"definition,omitempty"` + Changed *date.Time `json:"changed,omitempty"` + Created *date.Time `json:"created,omitempty"` +} + +// ViewListResult is the response of list view operation. +type ViewListResult struct { + autorest.Response `json:"-"` + Value *[]ViewResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ViewListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ViewListResult) ViewListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ViewResourceFormat is the view resource format. +type ViewResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *View `json:"properties,omitempty"` +} + +// WidgetType is definition of WidgetType. +type WidgetType struct { + WidgetTypeName *string `json:"widgetTypeName,omitempty"` + Definition *string `json:"definition,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *map[string]*string `json:"displayName,omitempty"` + ImageURL *string `json:"imageUrl,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + WidgetVersion *string `json:"widgetVersion,omitempty"` + Changed *date.Time `json:"changed,omitempty"` + Created *date.Time `json:"created,omitempty"` +} + +// WidgetTypeListResult is the response of list widget type operation. +type WidgetTypeListResult struct { + autorest.Response `json:"-"` + Value *[]WidgetTypeResourceFormat `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WidgetTypeListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WidgetTypeListResult) WidgetTypeListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WidgetTypeResourceFormat is the WidgetTypeResourceFormat +type WidgetTypeResourceFormat struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *WidgetType `json:"properties,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/profiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/profiles.go index da5ef3cbec..c323e8179e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/profiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/profiles.go @@ -1,461 +1,461 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProfilesClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type ProfilesClient struct { - ManagementClient -} - -// NewProfilesClient creates an instance of the ProfilesClient client. -func NewProfilesClient(subscriptionID string) ProfilesClient { - return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient -// client. -func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { - return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a profile within a Hub, or updates an existing -// profile. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. profileName is the name of the profile. parameters is parameters -// supplied to the create/delete Profile type operation -func (client ProfilesClient) CreateOrUpdate(resourceGroupName string, hubName string, profileName string, parameters ProfileResourceFormat, cancel <-chan struct{}) (<-chan ProfileResourceFormat, <-chan error) { - resultChan := make(chan ProfileResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: profileName, - Constraints: []validation.Constraint{{Target: "profileName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "profileName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.ProfilesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ProfileResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, profileName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProfilesClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, profileName string, parameters ProfileResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result ProfileResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a profile within a hub This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. profileName is the name of the profile. localeCode is locale of -// profile to retrieve, default is en-us. -func (client ProfilesClient) Delete(resourceGroupName string, hubName string, profileName string, localeCode string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, hubName, profileName, localeCode, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ProfilesClient) DeletePreparer(resourceGroupName string, hubName string, profileName string, localeCode string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(localeCode) > 0 { - queryParameters["locale-code"] = autorest.Encode("query", localeCode) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified profile. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. profileName is the name of the profile. localeCode is locale of -// profile to retrieve, default is en-us. -func (client ProfilesClient) Get(resourceGroupName string, hubName string, profileName string, localeCode string) (result ProfileResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, profileName, localeCode) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProfilesClient) GetPreparer(resourceGroupName string, hubName string, profileName string, localeCode string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(localeCode) > 0 { - queryParameters["locale-code"] = autorest.Encode("query", localeCode) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProfilesClient) GetResponder(resp *http.Response) (result ProfileResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEnrichingKpis gets the KPIs that enrich the profile Type identified by -// the supplied name. Enrichment happens through participants of the -// Interaction on an Interaction KPI and through Relationships for Profile -// KPIs. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. profileName is the name of the profile. -func (client ProfilesClient) GetEnrichingKpis(resourceGroupName string, hubName string, profileName string) (result ListKpiDefinition, err error) { - req, err := client.GetEnrichingKpisPreparer(resourceGroupName, hubName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "GetEnrichingKpis", nil, "Failure preparing request") - return - } - - resp, err := client.GetEnrichingKpisSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "GetEnrichingKpis", resp, "Failure sending request") - return - } - - result, err = client.GetEnrichingKpisResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "GetEnrichingKpis", resp, "Failure responding to request") - } - - return -} - -// GetEnrichingKpisPreparer prepares the GetEnrichingKpis request. -func (client ProfilesClient) GetEnrichingKpisPreparer(resourceGroupName string, hubName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}/getEnrichingKpis", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetEnrichingKpisSender sends the GetEnrichingKpis request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) GetEnrichingKpisSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetEnrichingKpisResponder handles the response to the GetEnrichingKpis request. The method always -// closes the http.Response Body. -func (client ProfilesClient) GetEnrichingKpisResponder(resp *http.Response) (result ListKpiDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all profile in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. localeCode is locale of profile to retrieve, default is en-us. -func (client ProfilesClient) ListByHub(resourceGroupName string, hubName string, localeCode string) (result ProfileListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName, localeCode) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client ProfilesClient) ListByHubPreparer(resourceGroupName string, hubName string, localeCode string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(localeCode) > 0 { - queryParameters["locale-code"] = autorest.Encode("query", localeCode) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client ProfilesClient) ListByHubResponder(resp *http.Response) (result ProfileListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client ProfilesClient) ListByHubNextResults(lastResults ProfileListResult) (result ProfileListResult, err error) { - req, err := lastResults.ProfileListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProfilesClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type ProfilesClient struct { + ManagementClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient +// client. +func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a profile within a Hub, or updates an existing +// profile. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. profileName is the name of the profile. parameters is parameters +// supplied to the create/delete Profile type operation +func (client ProfilesClient) CreateOrUpdate(resourceGroupName string, hubName string, profileName string, parameters ProfileResourceFormat, cancel <-chan struct{}) (<-chan ProfileResourceFormat, <-chan error) { + resultChan := make(chan ProfileResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: profileName, + Constraints: []validation.Constraint{{Target: "profileName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "profileName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "profileName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.ProfilesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ProfileResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, profileName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProfilesClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, profileName string, parameters ProfileResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result ProfileResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a profile within a hub This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. profileName is the name of the profile. localeCode is locale of +// profile to retrieve, default is en-us. +func (client ProfilesClient) Delete(resourceGroupName string, hubName string, profileName string, localeCode string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, hubName, profileName, localeCode, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(resourceGroupName string, hubName string, profileName string, localeCode string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(localeCode) > 0 { + queryParameters["locale-code"] = autorest.Encode("query", localeCode) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified profile. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. profileName is the name of the profile. localeCode is locale of +// profile to retrieve, default is en-us. +func (client ProfilesClient) Get(resourceGroupName string, hubName string, profileName string, localeCode string) (result ProfileResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, profileName, localeCode) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(resourceGroupName string, hubName string, profileName string, localeCode string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(localeCode) > 0 { + queryParameters["locale-code"] = autorest.Encode("query", localeCode) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetResponder(resp *http.Response) (result ProfileResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEnrichingKpis gets the KPIs that enrich the profile Type identified by +// the supplied name. Enrichment happens through participants of the +// Interaction on an Interaction KPI and through Relationships for Profile +// KPIs. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. profileName is the name of the profile. +func (client ProfilesClient) GetEnrichingKpis(resourceGroupName string, hubName string, profileName string) (result ListKpiDefinition, err error) { + req, err := client.GetEnrichingKpisPreparer(resourceGroupName, hubName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "GetEnrichingKpis", nil, "Failure preparing request") + return + } + + resp, err := client.GetEnrichingKpisSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "GetEnrichingKpis", resp, "Failure sending request") + return + } + + result, err = client.GetEnrichingKpisResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "GetEnrichingKpis", resp, "Failure responding to request") + } + + return +} + +// GetEnrichingKpisPreparer prepares the GetEnrichingKpis request. +func (client ProfilesClient) GetEnrichingKpisPreparer(resourceGroupName string, hubName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}/getEnrichingKpis", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetEnrichingKpisSender sends the GetEnrichingKpis request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetEnrichingKpisSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetEnrichingKpisResponder handles the response to the GetEnrichingKpis request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetEnrichingKpisResponder(resp *http.Response) (result ListKpiDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all profile in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. localeCode is locale of profile to retrieve, default is en-us. +func (client ProfilesClient) ListByHub(resourceGroupName string, hubName string, localeCode string) (result ProfileListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName, localeCode) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client ProfilesClient) ListByHubPreparer(resourceGroupName string, hubName string, localeCode string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(localeCode) > 0 { + queryParameters["locale-code"] = autorest.Encode("query", localeCode) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListByHubResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client ProfilesClient) ListByHubNextResults(lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.ProfileListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ProfilesClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationshiplinks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationshiplinks.go index 961c121068..6cac63649f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationshiplinks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationshiplinks.go @@ -1,391 +1,391 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RelationshipLinksClient is the the Azure Customer Insights management API -// provides a RESTful set of web services that interact with Azure Customer -// Insights service to manage your resources. The API has entities that capture -// the relationship between an end user and the Azure Customer Insights -// service. -type RelationshipLinksClient struct { - ManagementClient -} - -// NewRelationshipLinksClient creates an instance of the -// RelationshipLinksClient client. -func NewRelationshipLinksClient(subscriptionID string) RelationshipLinksClient { - return NewRelationshipLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRelationshipLinksClientWithBaseURI creates an instance of the -// RelationshipLinksClient client. -func NewRelationshipLinksClientWithBaseURI(baseURI string, subscriptionID string) RelationshipLinksClient { - return RelationshipLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a relationship link or updates an existing -// relationship link within a hub. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. relationshipLinkName is the name of the relationship link. -// parameters is parameters supplied to the CreateOrUpdate relationship link -// operation. -func (client RelationshipLinksClient) CreateOrUpdate(resourceGroupName string, hubName string, relationshipLinkName string, parameters RelationshipLinkResourceFormat, cancel <-chan struct{}) (<-chan RelationshipLinkResourceFormat, <-chan error) { - resultChan := make(chan RelationshipLinkResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: relationshipLinkName, - Constraints: []validation.Constraint{{Target: "relationshipLinkName", Name: validation.MaxLength, Rule: 512, Chain: nil}, - {Target: "relationshipLinkName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "relationshipLinkName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RelationshipLinkDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RelationshipLinkDefinition.InteractionType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RelationshipLinkDefinition.ProfilePropertyReferences", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RelationshipLinkDefinition.RelatedProfilePropertyReferences", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RelationshipLinkDefinition.RelationshipName", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RelationshipLinkResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, relationshipLinkName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RelationshipLinksClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, relationshipLinkName string, parameters RelationshipLinkResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "relationshipLinkName": autorest.Encode("path", relationshipLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipLinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RelationshipLinksClient) CreateOrUpdateResponder(resp *http.Response) (result RelationshipLinkResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a relationship link within a hub. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. relationshipLinkName is the name of the relationship. -func (client RelationshipLinksClient) Delete(resourceGroupName string, hubName string, relationshipLinkName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, hubName, relationshipLinkName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client RelationshipLinksClient) DeletePreparer(resourceGroupName string, hubName string, relationshipLinkName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "relationshipLinkName": autorest.Encode("path", relationshipLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RelationshipLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified relationship Link. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. relationshipLinkName is the name of the relationship link. -func (client RelationshipLinksClient) Get(resourceGroupName string, hubName string, relationshipLinkName string) (result RelationshipLinkResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, relationshipLinkName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RelationshipLinksClient) GetPreparer(resourceGroupName string, hubName string, relationshipLinkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "relationshipLinkName": autorest.Encode("path", relationshipLinkName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipLinksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RelationshipLinksClient) GetResponder(resp *http.Response) (result RelationshipLinkResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all relationship links in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client RelationshipLinksClient) ListByHub(resourceGroupName string, hubName string) (result RelationshipLinkListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client RelationshipLinksClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipLinksClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client RelationshipLinksClient) ListByHubResponder(resp *http.Response) (result RelationshipLinkListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client RelationshipLinksClient) ListByHubNextResults(lastResults RelationshipLinkListResult) (result RelationshipLinkListResult, err error) { - req, err := lastResults.RelationshipLinkListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RelationshipLinksClient is the the Azure Customer Insights management API +// provides a RESTful set of web services that interact with Azure Customer +// Insights service to manage your resources. The API has entities that capture +// the relationship between an end user and the Azure Customer Insights +// service. +type RelationshipLinksClient struct { + ManagementClient +} + +// NewRelationshipLinksClient creates an instance of the +// RelationshipLinksClient client. +func NewRelationshipLinksClient(subscriptionID string) RelationshipLinksClient { + return NewRelationshipLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRelationshipLinksClientWithBaseURI creates an instance of the +// RelationshipLinksClient client. +func NewRelationshipLinksClientWithBaseURI(baseURI string, subscriptionID string) RelationshipLinksClient { + return RelationshipLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a relationship link or updates an existing +// relationship link within a hub. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. relationshipLinkName is the name of the relationship link. +// parameters is parameters supplied to the CreateOrUpdate relationship link +// operation. +func (client RelationshipLinksClient) CreateOrUpdate(resourceGroupName string, hubName string, relationshipLinkName string, parameters RelationshipLinkResourceFormat, cancel <-chan struct{}) (<-chan RelationshipLinkResourceFormat, <-chan error) { + resultChan := make(chan RelationshipLinkResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: relationshipLinkName, + Constraints: []validation.Constraint{{Target: "relationshipLinkName", Name: validation.MaxLength, Rule: 512, Chain: nil}, + {Target: "relationshipLinkName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "relationshipLinkName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RelationshipLinkDefinition", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RelationshipLinkDefinition.InteractionType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RelationshipLinkDefinition.ProfilePropertyReferences", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RelationshipLinkDefinition.RelatedProfilePropertyReferences", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RelationshipLinkDefinition.RelationshipName", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RelationshipLinkResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, relationshipLinkName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RelationshipLinksClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, relationshipLinkName string, parameters RelationshipLinkResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "relationshipLinkName": autorest.Encode("path", relationshipLinkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipLinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RelationshipLinksClient) CreateOrUpdateResponder(resp *http.Response) (result RelationshipLinkResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a relationship link within a hub. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. relationshipLinkName is the name of the relationship. +func (client RelationshipLinksClient) Delete(resourceGroupName string, hubName string, relationshipLinkName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, hubName, relationshipLinkName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client RelationshipLinksClient) DeletePreparer(resourceGroupName string, hubName string, relationshipLinkName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "relationshipLinkName": autorest.Encode("path", relationshipLinkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RelationshipLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified relationship Link. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. relationshipLinkName is the name of the relationship link. +func (client RelationshipLinksClient) Get(resourceGroupName string, hubName string, relationshipLinkName string) (result RelationshipLinkResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, relationshipLinkName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RelationshipLinksClient) GetPreparer(resourceGroupName string, hubName string, relationshipLinkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "relationshipLinkName": autorest.Encode("path", relationshipLinkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipLinksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RelationshipLinksClient) GetResponder(resp *http.Response) (result RelationshipLinkResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all relationship links in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client RelationshipLinksClient) ListByHub(resourceGroupName string, hubName string) (result RelationshipLinkListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client RelationshipLinksClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipLinksClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client RelationshipLinksClient) ListByHubResponder(resp *http.Response) (result RelationshipLinkListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client RelationshipLinksClient) ListByHubNextResults(lastResults RelationshipLinkListResult) (result RelationshipLinkListResult, err error) { + req, err := lastResults.RelationshipLinkListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipLinksClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationships.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationships.go index 3be02d3818..297835f2d1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationships.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/relationships.go @@ -1,388 +1,388 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RelationshipsClient is the the Azure Customer Insights management API -// provides a RESTful set of web services that interact with Azure Customer -// Insights service to manage your resources. The API has entities that capture -// the relationship between an end user and the Azure Customer Insights -// service. -type RelationshipsClient struct { - ManagementClient -} - -// NewRelationshipsClient creates an instance of the RelationshipsClient -// client. -func NewRelationshipsClient(subscriptionID string) RelationshipsClient { - return NewRelationshipsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRelationshipsClientWithBaseURI creates an instance of the -// RelationshipsClient client. -func NewRelationshipsClientWithBaseURI(baseURI string, subscriptionID string) RelationshipsClient { - return RelationshipsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a relationship or updates an existing relationship -// within a hub. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. relationshipName is the name of the Relationship. parameters is -// parameters supplied to the CreateOrUpdate Relationship operation. -func (client RelationshipsClient) CreateOrUpdate(resourceGroupName string, hubName string, relationshipName string, parameters RelationshipResourceFormat, cancel <-chan struct{}) (<-chan RelationshipResourceFormat, <-chan error) { - resultChan := make(chan RelationshipResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: relationshipName, - Constraints: []validation.Constraint{{Target: "relationshipName", Name: validation.MaxLength, Rule: 512, Chain: nil}, - {Target: "relationshipName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "relationshipName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RelationshipDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RelationshipDefinition.ProfileType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RelationshipDefinition.RelatedProfileType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RelationshipResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, relationshipName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RelationshipsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, relationshipName string, parameters RelationshipResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "relationshipName": autorest.Encode("path", relationshipName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RelationshipsClient) CreateOrUpdateResponder(resp *http.Response) (result RelationshipResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a relationship within a hub. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. relationshipName is the name of the relationship. -func (client RelationshipsClient) Delete(resourceGroupName string, hubName string, relationshipName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, hubName, relationshipName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client RelationshipsClient) DeletePreparer(resourceGroupName string, hubName string, relationshipName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "relationshipName": autorest.Encode("path", relationshipName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RelationshipsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified relationship. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. relationshipName is the name of the relationship. -func (client RelationshipsClient) Get(resourceGroupName string, hubName string, relationshipName string) (result RelationshipResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, relationshipName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RelationshipsClient) GetPreparer(resourceGroupName string, hubName string, relationshipName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "relationshipName": autorest.Encode("path", relationshipName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RelationshipsClient) GetResponder(resp *http.Response) (result RelationshipResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all relationships in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client RelationshipsClient) ListByHub(resourceGroupName string, hubName string) (result RelationshipListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client RelationshipsClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client RelationshipsClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client RelationshipsClient) ListByHubResponder(resp *http.Response) (result RelationshipListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client RelationshipsClient) ListByHubNextResults(lastResults RelationshipListResult) (result RelationshipListResult, err error) { - req, err := lastResults.RelationshipListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RelationshipsClient is the the Azure Customer Insights management API +// provides a RESTful set of web services that interact with Azure Customer +// Insights service to manage your resources. The API has entities that capture +// the relationship between an end user and the Azure Customer Insights +// service. +type RelationshipsClient struct { + ManagementClient +} + +// NewRelationshipsClient creates an instance of the RelationshipsClient +// client. +func NewRelationshipsClient(subscriptionID string) RelationshipsClient { + return NewRelationshipsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRelationshipsClientWithBaseURI creates an instance of the +// RelationshipsClient client. +func NewRelationshipsClientWithBaseURI(baseURI string, subscriptionID string) RelationshipsClient { + return RelationshipsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a relationship or updates an existing relationship +// within a hub. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. relationshipName is the name of the Relationship. parameters is +// parameters supplied to the CreateOrUpdate Relationship operation. +func (client RelationshipsClient) CreateOrUpdate(resourceGroupName string, hubName string, relationshipName string, parameters RelationshipResourceFormat, cancel <-chan struct{}) (<-chan RelationshipResourceFormat, <-chan error) { + resultChan := make(chan RelationshipResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: relationshipName, + Constraints: []validation.Constraint{{Target: "relationshipName", Name: validation.MaxLength, Rule: 512, Chain: nil}, + {Target: "relationshipName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "relationshipName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RelationshipDefinition", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RelationshipDefinition.ProfileType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RelationshipDefinition.RelatedProfileType", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RelationshipResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, relationshipName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RelationshipsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, relationshipName string, parameters RelationshipResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "relationshipName": autorest.Encode("path", relationshipName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RelationshipsClient) CreateOrUpdateResponder(resp *http.Response) (result RelationshipResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a relationship within a hub. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. relationshipName is the name of the relationship. +func (client RelationshipsClient) Delete(resourceGroupName string, hubName string, relationshipName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, hubName, relationshipName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client RelationshipsClient) DeletePreparer(resourceGroupName string, hubName string, relationshipName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "relationshipName": autorest.Encode("path", relationshipName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RelationshipsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified relationship. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. relationshipName is the name of the relationship. +func (client RelationshipsClient) Get(resourceGroupName string, hubName string, relationshipName string) (result RelationshipResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, relationshipName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RelationshipsClient) GetPreparer(resourceGroupName string, hubName string, relationshipName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "relationshipName": autorest.Encode("path", relationshipName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RelationshipsClient) GetResponder(resp *http.Response) (result RelationshipResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all relationships in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client RelationshipsClient) ListByHub(resourceGroupName string, hubName string) (result RelationshipListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client RelationshipsClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client RelationshipsClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client RelationshipsClient) ListByHubResponder(resp *http.Response) (result RelationshipListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client RelationshipsClient) ListByHubNextResults(lastResults RelationshipListResult) (result RelationshipListResult, err error) { + req, err := lastResults.RelationshipListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RelationshipsClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roleassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roleassignments.go index cbd50a81ac..22b8988123 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roleassignments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roleassignments.go @@ -1,370 +1,370 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RoleAssignmentsClient is the the Azure Customer Insights management API -// provides a RESTful set of web services that interact with Azure Customer -// Insights service to manage your resources. The API has entities that capture -// the relationship between an end user and the Azure Customer Insights -// service. -type RoleAssignmentsClient struct { - ManagementClient -} - -// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient -// client. -func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { - return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoleAssignmentsClientWithBaseURI creates an instance of the -// RoleAssignmentsClient client. -func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { - return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a role assignment in the hub. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. assignmentName is the assignment name parameters is parameters -// supplied to the CreateOrUpdate RoleAssignment operation. -func (client RoleAssignmentsClient) CreateOrUpdate(resourceGroupName string, hubName string, assignmentName string, parameters RoleAssignmentResourceFormat, cancel <-chan struct{}) (<-chan RoleAssignmentResourceFormat, <-chan error) { - resultChan := make(chan RoleAssignmentResourceFormat, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: assignmentName, - Constraints: []validation.Constraint{{Target: "assignmentName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "assignmentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "assignmentName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RoleAssignment", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.RoleAssignment.Principals", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RoleAssignmentResourceFormat - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, assignmentName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RoleAssignmentsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, assignmentName string, parameters RoleAssignmentResourceFormat, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assignmentName": autorest.Encode("path", assignmentName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result RoleAssignmentResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the role assignment in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. assignmentName is the name of the role assignment. -func (client RoleAssignmentsClient) Delete(resourceGroupName string, hubName string, assignmentName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, hubName, assignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RoleAssignmentsClient) DeletePreparer(resourceGroupName string, hubName string, assignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assignmentName": autorest.Encode("path", assignmentName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the role assignment in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. assignmentName is the name of the role assignment. -func (client RoleAssignmentsClient) Get(resourceGroupName string, hubName string, assignmentName string) (result RoleAssignmentResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, assignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RoleAssignmentsClient) GetPreparer(resourceGroupName string, hubName string, assignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "assignmentName": autorest.Encode("path", assignmentName), - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result RoleAssignmentResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all the role assignments for the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client RoleAssignmentsClient) ListByHub(resourceGroupName string, hubName string) (result RoleAssignmentListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client RoleAssignmentsClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListByHubResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) ListByHubNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.RoleAssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RoleAssignmentsClient is the the Azure Customer Insights management API +// provides a RESTful set of web services that interact with Azure Customer +// Insights service to manage your resources. The API has entities that capture +// the relationship between an end user and the Azure Customer Insights +// service. +type RoleAssignmentsClient struct { + ManagementClient +} + +// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient +// client. +func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { + return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentsClientWithBaseURI creates an instance of the +// RoleAssignmentsClient client. +func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { + return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a role assignment in the hub. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. assignmentName is the assignment name parameters is parameters +// supplied to the CreateOrUpdate RoleAssignment operation. +func (client RoleAssignmentsClient) CreateOrUpdate(resourceGroupName string, hubName string, assignmentName string, parameters RoleAssignmentResourceFormat, cancel <-chan struct{}) (<-chan RoleAssignmentResourceFormat, <-chan error) { + resultChan := make(chan RoleAssignmentResourceFormat, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: assignmentName, + Constraints: []validation.Constraint{{Target: "assignmentName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "assignmentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "assignmentName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9_]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleAssignment", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RoleAssignment.Principals", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RoleAssignmentResourceFormat + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, assignmentName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RoleAssignmentsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, assignmentName string, parameters RoleAssignmentResourceFormat, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assignmentName": autorest.Encode("path", assignmentName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result RoleAssignmentResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the role assignment in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. assignmentName is the name of the role assignment. +func (client RoleAssignmentsClient) Delete(resourceGroupName string, hubName string, assignmentName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, hubName, assignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleAssignmentsClient) DeletePreparer(resourceGroupName string, hubName string, assignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assignmentName": autorest.Encode("path", assignmentName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the role assignment in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. assignmentName is the name of the role assignment. +func (client RoleAssignmentsClient) Get(resourceGroupName string, hubName string, assignmentName string) (result RoleAssignmentResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, assignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleAssignmentsClient) GetPreparer(resourceGroupName string, hubName string, assignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assignmentName": autorest.Encode("path", assignmentName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result RoleAssignmentResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all the role assignments for the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client RoleAssignmentsClient) ListByHub(resourceGroupName string, hubName string) (result RoleAssignmentListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client RoleAssignmentsClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListByHubResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) ListByHubNextResults(lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.RoleAssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RoleAssignmentsClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roles.go index 81650ac5cc..6f0bc7e77e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/roles.go @@ -1,133 +1,133 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RolesClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type RolesClient struct { - ManagementClient -} - -// NewRolesClient creates an instance of the RolesClient client. -func NewRolesClient(subscriptionID string) RolesClient { - return NewRolesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRolesClientWithBaseURI creates an instance of the RolesClient client. -func NewRolesClientWithBaseURI(baseURI string, subscriptionID string) RolesClient { - return RolesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByHub gets all the roles for the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client RolesClient) ListByHub(resourceGroupName string, hubName string) (result RoleListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client RolesClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client RolesClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client RolesClient) ListByHubResponder(resp *http.Response) (result RoleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client RolesClient) ListByHubNextResults(lastResults RoleListResult) (result RoleListResult, err error) { - req, err := lastResults.RoleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RolesClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type RolesClient struct { + ManagementClient +} + +// NewRolesClient creates an instance of the RolesClient client. +func NewRolesClient(subscriptionID string) RolesClient { + return NewRolesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRolesClientWithBaseURI creates an instance of the RolesClient client. +func NewRolesClientWithBaseURI(baseURI string, subscriptionID string) RolesClient { + return RolesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByHub gets all the roles for the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client RolesClient) ListByHub(resourceGroupName string, hubName string) (result RoleListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client RolesClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client RolesClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client RolesClient) ListByHubResponder(resp *http.Response) (result RoleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client RolesClient) ListByHubNextResults(lastResults RoleListResult) (result RoleListResult, err error) { + req, err := lastResults.RoleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.RolesClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/version.go index 633f7ade34..ed2f00824d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/version.go @@ -1,29 +1,29 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-customerinsights/2017-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-customerinsights/2017-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/views.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/views.go index 795329d56f..6eaba3d707 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/views.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/views.go @@ -1,352 +1,352 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ViewsClient is the the Azure Customer Insights management API provides a -// RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type ViewsClient struct { - ManagementClient -} - -// NewViewsClient creates an instance of the ViewsClient client. -func NewViewsClient(subscriptionID string) ViewsClient { - return NewViewsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewViewsClientWithBaseURI creates an instance of the ViewsClient client. -func NewViewsClientWithBaseURI(baseURI string, subscriptionID string) ViewsClient { - return ViewsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a view or updates an exisiting view in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. viewName is the name of the view. parameters is parameters supplied -// to the CreateOrUpdate View operation. -func (client ViewsClient) CreateOrUpdate(resourceGroupName string, hubName string, viewName string, parameters ViewResourceFormat) (result ViewResourceFormat, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: viewName, - Constraints: []validation.Constraint{{Target: "viewName", Name: validation.MaxLength, Rule: 512, Chain: nil}, - {Target: "viewName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.View", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.View.Definition", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "customerinsights.ViewsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, viewName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ViewsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, viewName string, parameters ViewResourceFormat) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ViewsClient) CreateOrUpdateResponder(resp *http.Response) (result ViewResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a view in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. viewName is the name of the view. userID is the user ID. Use * to -// retreive hub level view. -func (client ViewsClient) Delete(resourceGroupName string, hubName string, viewName string, userID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, hubName, viewName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ViewsClient) DeletePreparer(resourceGroupName string, hubName string, viewName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "userId": autorest.Encode("query", userID), - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ViewsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a view in the hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. viewName is the name of the view. userID is the user ID. Use * to -// retreive hub level view. -func (client ViewsClient) Get(resourceGroupName string, hubName string, viewName string, userID string) (result ViewResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, viewName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ViewsClient) GetPreparer(resourceGroupName string, hubName string, viewName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "userId": autorest.Encode("query", userID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ViewsClient) GetResponder(resp *http.Response) (result ViewResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all available views for given user in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. userID is the user ID. Use * to retreive hub level views. -func (client ViewsClient) ListByHub(resourceGroupName string, hubName string, userID string) (result ViewListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client ViewsClient) ListByHubPreparer(resourceGroupName string, hubName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "userId": autorest.Encode("query", userID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client ViewsClient) ListByHubResponder(resp *http.Response) (result ViewListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client ViewsClient) ListByHubNextResults(lastResults ViewListResult) (result ViewListResult, err error) { - req, err := lastResults.ViewListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ViewsClient is the the Azure Customer Insights management API provides a +// RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type ViewsClient struct { + ManagementClient +} + +// NewViewsClient creates an instance of the ViewsClient client. +func NewViewsClient(subscriptionID string) ViewsClient { + return NewViewsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewViewsClientWithBaseURI creates an instance of the ViewsClient client. +func NewViewsClientWithBaseURI(baseURI string, subscriptionID string) ViewsClient { + return ViewsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a view or updates an exisiting view in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. viewName is the name of the view. parameters is parameters supplied +// to the CreateOrUpdate View operation. +func (client ViewsClient) CreateOrUpdate(resourceGroupName string, hubName string, viewName string, parameters ViewResourceFormat) (result ViewResourceFormat, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: viewName, + Constraints: []validation.Constraint{{Target: "viewName", Name: validation.MaxLength, Rule: 512, Chain: nil}, + {Target: "viewName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.View", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.View.Definition", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "customerinsights.ViewsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, hubName, viewName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ViewsClient) CreateOrUpdatePreparer(resourceGroupName string, hubName string, viewName string, parameters ViewResourceFormat) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "viewName": autorest.Encode("path", viewName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ViewsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ViewsClient) CreateOrUpdateResponder(resp *http.Response) (result ViewResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a view in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. viewName is the name of the view. userID is the user ID. Use * to +// retreive hub level view. +func (client ViewsClient) Delete(resourceGroupName string, hubName string, viewName string, userID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, hubName, viewName, userID) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ViewsClient) DeletePreparer(resourceGroupName string, hubName string, viewName string, userID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "viewName": autorest.Encode("path", viewName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "userId": autorest.Encode("query", userID), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ViewsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ViewsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a view in the hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. viewName is the name of the view. userID is the user ID. Use * to +// retreive hub level view. +func (client ViewsClient) Get(resourceGroupName string, hubName string, viewName string, userID string) (result ViewResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, viewName, userID) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ViewsClient) GetPreparer(resourceGroupName string, hubName string, viewName string, userID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "viewName": autorest.Encode("path", viewName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "userId": autorest.Encode("query", userID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ViewsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ViewsClient) GetResponder(resp *http.Response) (result ViewResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all available views for given user in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. userID is the user ID. Use * to retreive hub level views. +func (client ViewsClient) ListByHub(resourceGroupName string, hubName string, userID string) (result ViewListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName, userID) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client ViewsClient) ListByHubPreparer(resourceGroupName string, hubName string, userID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "userId": autorest.Encode("query", userID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client ViewsClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client ViewsClient) ListByHubResponder(resp *http.Response) (result ViewListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client ViewsClient) ListByHubNextResults(lastResults ViewListResult) (result ViewListResult, err error) { + req, err := lastResults.ViewListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.ViewsClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/widgettypes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/widgettypes.go index f00fa0b285..120d613fbb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/widgettypes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/customer-insights/widgettypes.go @@ -1,201 +1,201 @@ -package customerinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WidgetTypesClient is the the Azure Customer Insights management API provides -// a RESTful set of web services that interact with Azure Customer Insights -// service to manage your resources. The API has entities that capture the -// relationship between an end user and the Azure Customer Insights service. -type WidgetTypesClient struct { - ManagementClient -} - -// NewWidgetTypesClient creates an instance of the WidgetTypesClient client. -func NewWidgetTypesClient(subscriptionID string) WidgetTypesClient { - return NewWidgetTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWidgetTypesClientWithBaseURI creates an instance of the WidgetTypesClient -// client. -func NewWidgetTypesClientWithBaseURI(baseURI string, subscriptionID string) WidgetTypesClient { - return WidgetTypesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a widget type in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. widgetTypeName is the name of the widget type. -func (client WidgetTypesClient) Get(resourceGroupName string, hubName string, widgetTypeName string) (result WidgetTypeResourceFormat, err error) { - req, err := client.GetPreparer(resourceGroupName, hubName, widgetTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WidgetTypesClient) GetPreparer(resourceGroupName string, hubName string, widgetTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "widgetTypeName": autorest.Encode("path", widgetTypeName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/widgetTypes/{widgetTypeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WidgetTypesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WidgetTypesClient) GetResponder(resp *http.Response) (result WidgetTypeResourceFormat, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHub gets all available widget types in the specified hub. -// -// resourceGroupName is the name of the resource group. hubName is the name of -// the hub. -func (client WidgetTypesClient) ListByHub(resourceGroupName string, hubName string) (result WidgetTypeListResult, err error) { - req, err := client.ListByHubPreparer(resourceGroupName, hubName) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure sending request") - return - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure responding to request") - } - - return -} - -// ListByHubPreparer prepares the ListByHub request. -func (client WidgetTypesClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hubName": autorest.Encode("path", hubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/widgetTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByHubSender sends the ListByHub request. The method will close the -// http.Response Body if it receives an error. -func (client WidgetTypesClient) ListByHubSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByHubResponder handles the response to the ListByHub request. The method always -// closes the http.Response Body. -func (client WidgetTypesClient) ListByHubResponder(resp *http.Response) (result WidgetTypeListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHubNextResults retrieves the next set of results, if any. -func (client WidgetTypesClient) ListByHubNextResults(lastResults WidgetTypeListResult) (result WidgetTypeListResult, err error) { - req, err := lastResults.WidgetTypeListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure sending next results request") - } - - result, err = client.ListByHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure responding to next results request") - } - - return -} +package customerinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WidgetTypesClient is the the Azure Customer Insights management API provides +// a RESTful set of web services that interact with Azure Customer Insights +// service to manage your resources. The API has entities that capture the +// relationship between an end user and the Azure Customer Insights service. +type WidgetTypesClient struct { + ManagementClient +} + +// NewWidgetTypesClient creates an instance of the WidgetTypesClient client. +func NewWidgetTypesClient(subscriptionID string) WidgetTypesClient { + return NewWidgetTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWidgetTypesClientWithBaseURI creates an instance of the WidgetTypesClient +// client. +func NewWidgetTypesClientWithBaseURI(baseURI string, subscriptionID string) WidgetTypesClient { + return WidgetTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a widget type in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. widgetTypeName is the name of the widget type. +func (client WidgetTypesClient) Get(resourceGroupName string, hubName string, widgetTypeName string) (result WidgetTypeResourceFormat, err error) { + req, err := client.GetPreparer(resourceGroupName, hubName, widgetTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WidgetTypesClient) GetPreparer(resourceGroupName string, hubName string, widgetTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "widgetTypeName": autorest.Encode("path", widgetTypeName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/widgetTypes/{widgetTypeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WidgetTypesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WidgetTypesClient) GetResponder(resp *http.Response) (result WidgetTypeResourceFormat, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHub gets all available widget types in the specified hub. +// +// resourceGroupName is the name of the resource group. hubName is the name of +// the hub. +func (client WidgetTypesClient) ListByHub(resourceGroupName string, hubName string) (result WidgetTypeListResult, err error) { + req, err := client.ListByHubPreparer(resourceGroupName, hubName) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", nil, "Failure preparing request") + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure sending request") + return + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure responding to request") + } + + return +} + +// ListByHubPreparer prepares the ListByHub request. +func (client WidgetTypesClient) ListByHubPreparer(resourceGroupName string, hubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/widgetTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByHubSender sends the ListByHub request. The method will close the +// http.Response Body if it receives an error. +func (client WidgetTypesClient) ListByHubSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByHubResponder handles the response to the ListByHub request. The method always +// closes the http.Response Body. +func (client WidgetTypesClient) ListByHubResponder(resp *http.Response) (result WidgetTypeListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByHubNextResults retrieves the next set of results, if any. +func (client WidgetTypesClient) ListByHubNextResults(lastResults WidgetTypeListResult) (result WidgetTypeListResult, err error) { + req, err := lastResults.WidgetTypeListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByHubSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure sending next results request") + } + + result, err = client.ListByHubResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "customerinsights.WidgetTypesClient", "ListByHub", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/accountgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/accountgroup.go index fcec9e97d4..e1791b1dac 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/accountgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/accountgroup.go @@ -1,641 +1,641 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupClient is the creates an Azure Data Lake Analytics account management -// client. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the specified Data Lake Analytics account. This supplies the -// user with computation services for Data Lake Analytics workloads This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account.the account will be associated with. accountName -// is the name of the Data Lake Analytics account to create. parameters is -// parameters supplied to the create Data Lake Analytics account operation. -func (client GroupClient) Create(resourceGroupName string, accountName string, parameters DataLakeAnalyticsAccount, cancel <-chan struct{}) (<-chan DataLakeAnalyticsAccount, <-chan error) { - resultChan := make(chan DataLakeAnalyticsAccount, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.DefaultDataLakeStoreAccount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataLakeAnalyticsAccountProperties.MaxDegreeOfParallelism", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.MaxDegreeOfParallelism", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, - {Target: "parameters.DataLakeAnalyticsAccountProperties.QueryStoreRetention", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.QueryStoreRetention", Name: validation.InclusiveMaximum, Rule: 180, Chain: nil}, - {Target: "parameters.DataLakeAnalyticsAccountProperties.QueryStoreRetention", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - {Target: "parameters.DataLakeAnalyticsAccountProperties.MaxJobCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.MaxJobCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, - {Target: "parameters.DataLakeAnalyticsAccountProperties.DataLakeStoreAccounts", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "account.GroupClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result DataLakeAnalyticsAccount - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client GroupClient) CreatePreparer(resourceGroupName string, accountName string, parameters DataLakeAnalyticsAccount, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateResponder(resp *http.Response) (result DataLakeAnalyticsAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete begins the delete delete process for the Data Lake Analytics account -// object specified by the account name. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to delete -func (client GroupClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets details of the specified Data Lake Analytics account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to retrieve. -func (client GroupClient) Get(resourceGroupName string, accountName string) (result DataLakeAnalyticsAccount, err error) { - req, err := client.GetPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result DataLakeAnalyticsAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the first page of Data Lake Analytics accounts, if any, within the -// current subscription. This includes a link to the next page, if any. -// -// filter is oData filter. Optional. top is the number of items to return. -// Optional. skip is the number of items to skip over before returning -// elements. Optional. selectParameter is oData Select statement. Limits the -// properties on each entry to just those requested, e.g. -// Categories?$select=CategoryName,Description. Optional. orderby is orderBy -// clause. One or more comma-separated expressions with an optional "asc" (the -// default) or "desc" depending on the order you'd like the values sorted, e.g. -// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value -// of true or false to request a count of the matching resources included with -// the resources in the response, e.g. Categories?$count=true. Optional. -func (client GroupClient) List(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "List") - } - - req, err := client.ListPreparer(filter, top, skip, selectParameter, orderby, count) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if count != nil { - queryParameters["$count"] = autorest.Encode("query", *count) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result DataLakeAnalyticsAccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults DataLakeAnalyticsAccountListResult) (result DataLakeAnalyticsAccountListResult, err error) { - req, err := lastResults.DataLakeAnalyticsAccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets the first page of Data Lake Analytics accounts, if -// any, within a specific resource group. This includes a link to the next -// page, if any. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. filter is oData filter. Optional. top is the -// number of items to return. Optional. skip is the number of items to skip -// over before returning elements. Optional. selectParameter is oData Select -// statement. Limits the properties on each entry to just those requested, e.g. -// Categories?$select=CategoryName,Description. Optional. orderby is orderBy -// clause. One or more comma-separated expressions with an optional "asc" (the -// default) or "desc" depending on the order you'd like the values sorted, e.g. -// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value -// of true or false to request a count of the matching resources included with -// the resources in the response, e.g. Categories?$count=true. Optional. -func (client GroupClient) ListByResourceGroup(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter, top, skip, selectParameter, orderby, count) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if count != nil { - queryParameters["$count"] = autorest.Encode("query", *count) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result DataLakeAnalyticsAccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client GroupClient) ListByResourceGroupNextResults(lastResults DataLakeAnalyticsAccountListResult) (result DataLakeAnalyticsAccountListResult, err error) { - req, err := lastResults.DataLakeAnalyticsAccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the Data Lake Analytics account object specified by the -// accountName with the contents of the account object. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to update. parameters is parameters supplied to the update -// Data Lake Analytics account operation. -func (client GroupClient) Update(resourceGroupName string, accountName string, parameters *DataLakeAnalyticsAccountUpdateParameters, cancel <-chan struct{}) (<-chan DataLakeAnalyticsAccount, <-chan error) { - resultChan := make(chan DataLakeAnalyticsAccount, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result DataLakeAnalyticsAccount - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client GroupClient) UpdatePreparer(resourceGroupName string, accountName string, parameters *DataLakeAnalyticsAccountUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupClient) UpdateResponder(resp *http.Response) (result DataLakeAnalyticsAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupClient is the creates an Azure Data Lake Analytics account management +// client. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates the specified Data Lake Analytics account. This supplies the +// user with computation services for Data Lake Analytics workloads This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account.the account will be associated with. accountName +// is the name of the Data Lake Analytics account to create. parameters is +// parameters supplied to the create Data Lake Analytics account operation. +func (client GroupClient) Create(resourceGroupName string, accountName string, parameters DataLakeAnalyticsAccount, cancel <-chan struct{}) (<-chan DataLakeAnalyticsAccount, <-chan error) { + resultChan := make(chan DataLakeAnalyticsAccount, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.DefaultDataLakeStoreAccount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DataLakeAnalyticsAccountProperties.MaxDegreeOfParallelism", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.MaxDegreeOfParallelism", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, + {Target: "parameters.DataLakeAnalyticsAccountProperties.QueryStoreRetention", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.QueryStoreRetention", Name: validation.InclusiveMaximum, Rule: 180, Chain: nil}, + {Target: "parameters.DataLakeAnalyticsAccountProperties.QueryStoreRetention", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + {Target: "parameters.DataLakeAnalyticsAccountProperties.MaxJobCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataLakeAnalyticsAccountProperties.MaxJobCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, + {Target: "parameters.DataLakeAnalyticsAccountProperties.DataLakeStoreAccounts", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "account.GroupClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DataLakeAnalyticsAccount + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client GroupClient) CreatePreparer(resourceGroupName string, accountName string, parameters DataLakeAnalyticsAccount, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateResponder(resp *http.Response) (result DataLakeAnalyticsAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete begins the delete delete process for the Data Lake Analytics account +// object specified by the account name. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to delete +func (client GroupClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client GroupClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the specified Data Lake Analytics account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to retrieve. +func (client GroupClient) Get(resourceGroupName string, accountName string) (result DataLakeAnalyticsAccount, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result DataLakeAnalyticsAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the first page of Data Lake Analytics accounts, if any, within the +// current subscription. This includes a link to the next page, if any. +// +// filter is oData filter. Optional. top is the number of items to return. +// Optional. skip is the number of items to skip over before returning +// elements. Optional. selectParameter is oData Select statement. Limits the +// properties on each entry to just those requested, e.g. +// Categories?$select=CategoryName,Description. Optional. orderby is orderBy +// clause. One or more comma-separated expressions with an optional "asc" (the +// default) or "desc" depending on the order you'd like the values sorted, e.g. +// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value +// of true or false to request a count of the matching resources included with +// the resources in the response, e.g. Categories?$count=true. Optional. +func (client GroupClient) List(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "List") + } + + req, err := client.ListPreparer(filter, top, skip, selectParameter, orderby, count) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if count != nil { + queryParameters["$count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result DataLakeAnalyticsAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults DataLakeAnalyticsAccountListResult) (result DataLakeAnalyticsAccountListResult, err error) { + req, err := lastResults.DataLakeAnalyticsAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets the first page of Data Lake Analytics accounts, if +// any, within a specific resource group. This includes a link to the next +// page, if any. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. filter is oData filter. Optional. top is the +// number of items to return. Optional. skip is the number of items to skip +// over before returning elements. Optional. selectParameter is oData Select +// statement. Limits the properties on each entry to just those requested, e.g. +// Categories?$select=CategoryName,Description. Optional. orderby is orderBy +// clause. One or more comma-separated expressions with an optional "asc" (the +// default) or "desc" depending on the order you'd like the values sorted, e.g. +// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value +// of true or false to request a count of the matching resources included with +// the resources in the response, e.g. Categories?$count=true. Optional. +func (client GroupClient) ListByResourceGroup(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter, top, skip, selectParameter, orderby, count) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if count != nil { + queryParameters["$count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result DataLakeAnalyticsAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client GroupClient) ListByResourceGroupNextResults(lastResults DataLakeAnalyticsAccountListResult) (result DataLakeAnalyticsAccountListResult, err error) { + req, err := lastResults.DataLakeAnalyticsAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the Data Lake Analytics account object specified by the +// accountName with the contents of the account object. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to update. parameters is parameters supplied to the update +// Data Lake Analytics account operation. +func (client GroupClient) Update(resourceGroupName string, accountName string, parameters *DataLakeAnalyticsAccountUpdateParameters, cancel <-chan struct{}) (<-chan DataLakeAnalyticsAccount, <-chan error) { + resultChan := make(chan DataLakeAnalyticsAccount, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result DataLakeAnalyticsAccount + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client GroupClient) UpdatePreparer(resourceGroupName string, accountName string, parameters *DataLakeAnalyticsAccountUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GroupClient) UpdateResponder(resp *http.Response) (result DataLakeAnalyticsAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/client.go index 1699775a4e..41f91ac709 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/client.go @@ -1,53 +1,53 @@ -// Package account implements the Azure ARM Account service API version -// 2016-11-01. -// -// Creates an Azure Data Lake Analytics account management client. -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Account - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Account. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package account implements the Azure ARM Account service API version +// 2016-11-01. +// +// Creates an Azure Data Lake Analytics account management client. +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Account + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Account. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/datalakestoreaccounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/datalakestoreaccounts.go index 9a2063ead2..81bfb42433 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/datalakestoreaccounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/datalakestoreaccounts.go @@ -1,391 +1,391 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DataLakeStoreAccountsClient is the creates an Azure Data Lake Analytics -// account management client. -type DataLakeStoreAccountsClient struct { - ManagementClient -} - -// NewDataLakeStoreAccountsClient creates an instance of the -// DataLakeStoreAccountsClient client. -func NewDataLakeStoreAccountsClient(subscriptionID string) DataLakeStoreAccountsClient { - return NewDataLakeStoreAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataLakeStoreAccountsClientWithBaseURI creates an instance of the -// DataLakeStoreAccountsClient client. -func NewDataLakeStoreAccountsClientWithBaseURI(baseURI string, subscriptionID string) DataLakeStoreAccountsClient { - return DataLakeStoreAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add updates the specified Data Lake Analytics account to include the -// additional Data Lake Store account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to which to add the Data Lake Store account. -// dataLakeStoreAccountName is the name of the Data Lake Store account to add. -// parameters is the details of the Data Lake Store account. -func (client DataLakeStoreAccountsClient) Add(resourceGroupName string, accountName string, dataLakeStoreAccountName string, parameters *AddDataLakeStoreParameters) (result autorest.Response, err error) { - req, err := client.AddPreparer(resourceGroupName, accountName, dataLakeStoreAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Add", resp, "Failure responding to request") - } - - return -} - -// AddPreparer prepares the Add request. -func (client DataLakeStoreAccountsClient) AddPreparer(resourceGroupName string, accountName string, dataLakeStoreAccountName string, parameters *AddDataLakeStoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataLakeStoreAccountName": autorest.Encode("path", dataLakeStoreAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// AddSender sends the Add request. The method will close the -// http.Response Body if it receives an error. -func (client DataLakeStoreAccountsClient) AddSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddResponder handles the response to the Add request. The method always -// closes the http.Response Body. -func (client DataLakeStoreAccountsClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete updates the Data Lake Analytics account specified to remove the -// specified Data Lake Store account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to remove the Data Lake Store account. -// dataLakeStoreAccountName is the name of the Data Lake Store account to -// remove -func (client DataLakeStoreAccountsClient) Delete(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, accountName, dataLakeStoreAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataLakeStoreAccountsClient) DeletePreparer(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataLakeStoreAccountName": autorest.Encode("path", dataLakeStoreAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DataLakeStoreAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataLakeStoreAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Data Lake Store account details in the specified Data -// Lake Analytics account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to retrieve the Data Lake Store account -// details. dataLakeStoreAccountName is the name of the Data Lake Store account -// to retrieve -func (client DataLakeStoreAccountsClient) Get(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (result DataLakeStoreAccountInfo, err error) { - req, err := client.GetPreparer(resourceGroupName, accountName, dataLakeStoreAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataLakeStoreAccountsClient) GetPreparer(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "dataLakeStoreAccountName": autorest.Encode("path", dataLakeStoreAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DataLakeStoreAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DataLakeStoreAccountsClient) GetResponder(resp *http.Response) (result DataLakeStoreAccountInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount gets the first page of Data Lake Store accounts linked to the -// specified Data Lake Analytics account. The response includes a link to the -// next page, if any. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account for which to list Data Lake Store accounts. filter is -// oData filter. Optional. top is the number of items to return. Optional. skip -// is the number of items to skip over before returning elements. Optional. -// selectParameter is oData Select statement. Limits the properties on each -// entry to just those requested, e.g. -// Categories?$select=CategoryName,Description. Optional. orderby is orderBy -// clause. One or more comma-separated expressions with an optional "asc" (the -// default) or "desc" depending on the order you'd like the values sorted, e.g. -// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value -// of true or false to request a count of the matching resources included with -// the resources in the response, e.g. Categories?$count=true. Optional. -func (client DataLakeStoreAccountsClient) ListByAccount(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListDataLakeStoreResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.DataLakeStoreAccountsClient", "ListByAccount") - } - - req, err := client.ListByAccountPreparer(resourceGroupName, accountName, filter, top, skip, selectParameter, orderby, count) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client DataLakeStoreAccountsClient) ListByAccountPreparer(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if count != nil { - queryParameters["$count"] = autorest.Encode("query", *count) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client DataLakeStoreAccountsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client DataLakeStoreAccountsClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsAccountListDataLakeStoreResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccountNextResults retrieves the next set of results, if any. -func (client DataLakeStoreAccountsClient) ListByAccountNextResults(lastResults DataLakeAnalyticsAccountListDataLakeStoreResult) (result DataLakeAnalyticsAccountListDataLakeStoreResult, err error) { - req, err := lastResults.DataLakeAnalyticsAccountListDataLakeStoreResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure responding to next results request") - } - - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DataLakeStoreAccountsClient is the creates an Azure Data Lake Analytics +// account management client. +type DataLakeStoreAccountsClient struct { + ManagementClient +} + +// NewDataLakeStoreAccountsClient creates an instance of the +// DataLakeStoreAccountsClient client. +func NewDataLakeStoreAccountsClient(subscriptionID string) DataLakeStoreAccountsClient { + return NewDataLakeStoreAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataLakeStoreAccountsClientWithBaseURI creates an instance of the +// DataLakeStoreAccountsClient client. +func NewDataLakeStoreAccountsClientWithBaseURI(baseURI string, subscriptionID string) DataLakeStoreAccountsClient { + return DataLakeStoreAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Add updates the specified Data Lake Analytics account to include the +// additional Data Lake Store account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to which to add the Data Lake Store account. +// dataLakeStoreAccountName is the name of the Data Lake Store account to add. +// parameters is the details of the Data Lake Store account. +func (client DataLakeStoreAccountsClient) Add(resourceGroupName string, accountName string, dataLakeStoreAccountName string, parameters *AddDataLakeStoreParameters) (result autorest.Response, err error) { + req, err := client.AddPreparer(resourceGroupName, accountName, dataLakeStoreAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client DataLakeStoreAccountsClient) AddPreparer(resourceGroupName string, accountName string, dataLakeStoreAccountName string, parameters *AddDataLakeStoreParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "dataLakeStoreAccountName": autorest.Encode("path", dataLakeStoreAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client DataLakeStoreAccountsClient) AddSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client DataLakeStoreAccountsClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete updates the Data Lake Analytics account specified to remove the +// specified Data Lake Store account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to remove the Data Lake Store account. +// dataLakeStoreAccountName is the name of the Data Lake Store account to +// remove +func (client DataLakeStoreAccountsClient) Delete(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, accountName, dataLakeStoreAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataLakeStoreAccountsClient) DeletePreparer(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "dataLakeStoreAccountName": autorest.Encode("path", dataLakeStoreAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DataLakeStoreAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataLakeStoreAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Data Lake Store account details in the specified Data +// Lake Analytics account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to retrieve the Data Lake Store account +// details. dataLakeStoreAccountName is the name of the Data Lake Store account +// to retrieve +func (client DataLakeStoreAccountsClient) Get(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (result DataLakeStoreAccountInfo, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName, dataLakeStoreAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataLakeStoreAccountsClient) GetPreparer(resourceGroupName string, accountName string, dataLakeStoreAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "dataLakeStoreAccountName": autorest.Encode("path", dataLakeStoreAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/{dataLakeStoreAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataLakeStoreAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataLakeStoreAccountsClient) GetResponder(resp *http.Response) (result DataLakeStoreAccountInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccount gets the first page of Data Lake Store accounts linked to the +// specified Data Lake Analytics account. The response includes a link to the +// next page, if any. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account for which to list Data Lake Store accounts. filter is +// oData filter. Optional. top is the number of items to return. Optional. skip +// is the number of items to skip over before returning elements. Optional. +// selectParameter is oData Select statement. Limits the properties on each +// entry to just those requested, e.g. +// Categories?$select=CategoryName,Description. Optional. orderby is orderBy +// clause. One or more comma-separated expressions with an optional "asc" (the +// default) or "desc" depending on the order you'd like the values sorted, e.g. +// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value +// of true or false to request a count of the matching resources included with +// the resources in the response, e.g. Categories?$count=true. Optional. +func (client DataLakeStoreAccountsClient) ListByAccount(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListDataLakeStoreResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.DataLakeStoreAccountsClient", "ListByAccount") + } + + req, err := client.ListByAccountPreparer(resourceGroupName, accountName, filter, top, skip, selectParameter, orderby, count) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAccountPreparer prepares the ListByAccount request. +func (client DataLakeStoreAccountsClient) ListByAccountPreparer(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if count != nil { + queryParameters["$count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/DataLakeStoreAccounts/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAccountSender sends the ListByAccount request. The method will close the +// http.Response Body if it receives an error. +func (client DataLakeStoreAccountsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAccountResponder handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (client DataLakeStoreAccountsClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsAccountListDataLakeStoreResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccountNextResults retrieves the next set of results, if any. +func (client DataLakeStoreAccountsClient) ListByAccountNextResults(lastResults DataLakeAnalyticsAccountListDataLakeStoreResult) (result DataLakeAnalyticsAccountListDataLakeStoreResult, err error) { + req, err := lastResults.DataLakeAnalyticsAccountListDataLakeStoreResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.DataLakeStoreAccountsClient", "ListByAccount", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/firewallrules.go index bd904fb2df..deeb032520 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/firewallrules.go @@ -1,432 +1,432 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// FirewallRulesClient is the creates an Azure Data Lake Analytics account -// management client. -type FirewallRulesClient struct { - ManagementClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient -// client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the -// FirewallRulesClient client. -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the specified firewall rule. During -// update, the firewall rule with the specified name will be replaced with this -// new firewall rule. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to add or replace the firewall rule. firewallRuleName is -// the name of the firewall rule to create or update. parameters is parameters -// supplied to create or update the firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.FirewallRulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified firewall rule from the specified Data Lake -// Analytics account -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to delete the firewall rule. firewallRuleName -// is the name of the firewall rule to delete. -func (client FirewallRulesClient) Delete(resourceGroupName string, accountName string, firewallRuleName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, accountName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Data Lake Analytics firewall rule. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to get the firewall rule. firewallRuleName is -// the name of the firewall rule to retrieve. -func (client FirewallRulesClient) Get(resourceGroupName string, accountName string, firewallRuleName string) (result FirewallRule, err error) { - req, err := client.GetPreparer(resourceGroupName, accountName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount lists the Data Lake Analytics firewall rules within the -// specified Data Lake Analytics account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to get the firewall rules. -func (client FirewallRulesClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeAnalyticsFirewallRuleListResult, err error) { - req, err := client.ListByAccountPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client FirewallRulesClient) ListByAccountPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsFirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccountNextResults retrieves the next set of results, if any. -func (client FirewallRulesClient) ListByAccountNextResults(lastResults DataLakeAnalyticsFirewallRuleListResult) (result DataLakeAnalyticsFirewallRuleListResult, err error) { - req, err := lastResults.DataLakeAnalyticsFirewallRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the specified firewall rule. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to which to update the firewall rule. firewallRuleName is -// the name of the firewall rule to update. parameters is parameters supplied -// to update the firewall rule. -func (client FirewallRulesClient) Update(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (result FirewallRule, err error) { - req, err := client.UpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FirewallRulesClient) UpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) UpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FirewallRulesClient is the creates an Azure Data Lake Analytics account +// management client. +type FirewallRulesClient struct { + ManagementClient +} + +// NewFirewallRulesClient creates an instance of the FirewallRulesClient +// client. +func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { + return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallRulesClientWithBaseURI creates an instance of the +// FirewallRulesClient client. +func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { + return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified firewall rule. During +// update, the firewall rule with the specified name will be replaced with this +// new firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to add or replace the firewall rule. firewallRuleName is +// the name of the firewall rule to create or update. parameters is parameters +// supplied to create or update the firewall rule. +func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.FirewallRulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified firewall rule from the specified Data Lake +// Analytics account +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to delete the firewall rule. firewallRuleName +// is the name of the firewall rule to delete. +func (client FirewallRulesClient) Delete(resourceGroupName string, accountName string, firewallRuleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, accountName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Data Lake Analytics firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to get the firewall rule. firewallRuleName is +// the name of the firewall rule to retrieve. +func (client FirewallRulesClient) Get(resourceGroupName string, accountName string, firewallRuleName string) (result FirewallRule, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallRulesClient) GetPreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccount lists the Data Lake Analytics firewall rules within the +// specified Data Lake Analytics account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to get the firewall rules. +func (client FirewallRulesClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeAnalyticsFirewallRuleListResult, err error) { + req, err := client.ListByAccountPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAccountPreparer prepares the ListByAccount request. +func (client FirewallRulesClient) ListByAccountPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAccountSender sends the ListByAccount request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAccountResponder handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsFirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccountNextResults retrieves the next set of results, if any. +func (client FirewallRulesClient) ListByAccountNextResults(lastResults DataLakeAnalyticsFirewallRuleListResult) (result DataLakeAnalyticsFirewallRuleListResult, err error) { + req, err := lastResults.DataLakeAnalyticsFirewallRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specified firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to which to update the firewall rule. firewallRuleName is +// the name of the firewall rule to update. parameters is parameters supplied +// to update the firewall rule. +func (client FirewallRulesClient) Update(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (result FirewallRule, err error) { + req, err := client.UpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FirewallRulesClient) UpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) UpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/models.go index d8c42d7607..8ca7a8d2a1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/models.go @@ -1,429 +1,429 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DataLakeAnalyticsAccountState enumerates the values for data lake analytics -// account state. -type DataLakeAnalyticsAccountState string - -const ( - // Active specifies the active state for data lake analytics account state. - Active DataLakeAnalyticsAccountState = "Active" - // Suspended specifies the suspended state for data lake analytics account - // state. - Suspended DataLakeAnalyticsAccountState = "Suspended" -) - -// DataLakeAnalyticsAccountStatus enumerates the values for data lake analytics -// account status. -type DataLakeAnalyticsAccountStatus string - -const ( - // Creating specifies the creating state for data lake analytics account - // status. - Creating DataLakeAnalyticsAccountStatus = "Creating" - // Deleted specifies the deleted state for data lake analytics account - // status. - Deleted DataLakeAnalyticsAccountStatus = "Deleted" - // Deleting specifies the deleting state for data lake analytics account - // status. - Deleting DataLakeAnalyticsAccountStatus = "Deleting" - // Failed specifies the failed state for data lake analytics account - // status. - Failed DataLakeAnalyticsAccountStatus = "Failed" - // Patching specifies the patching state for data lake analytics account - // status. - Patching DataLakeAnalyticsAccountStatus = "Patching" - // Resuming specifies the resuming state for data lake analytics account - // status. - Resuming DataLakeAnalyticsAccountStatus = "Resuming" - // Running specifies the running state for data lake analytics account - // status. - Running DataLakeAnalyticsAccountStatus = "Running" - // Succeeded specifies the succeeded state for data lake analytics account - // status. - Succeeded DataLakeAnalyticsAccountStatus = "Succeeded" - // Suspending specifies the suspending state for data lake analytics - // account status. - Suspending DataLakeAnalyticsAccountStatus = "Suspending" -) - -// FirewallAllowAzureIpsState enumerates the values for firewall allow azure -// ips state. -type FirewallAllowAzureIpsState string - -const ( - // Disabled specifies the disabled state for firewall allow azure ips - // state. - Disabled FirewallAllowAzureIpsState = "Disabled" - // Enabled specifies the enabled state for firewall allow azure ips state. - Enabled FirewallAllowAzureIpsState = "Enabled" -) - -// FirewallState enumerates the values for firewall state. -type FirewallState string - -const ( - // FirewallStateDisabled specifies the firewall state disabled state for - // firewall state. - FirewallStateDisabled FirewallState = "Disabled" - // FirewallStateEnabled specifies the firewall state enabled state for - // firewall state. - FirewallStateEnabled FirewallState = "Enabled" -) - -// TierType enumerates the values for tier type. -type TierType string - -const ( - // Commitment100000AUHours specifies the commitment 100000au hours state - // for tier type. - Commitment100000AUHours TierType = "Commitment_100000AUHours" - // Commitment10000AUHours specifies the commitment 10000au hours state for - // tier type. - Commitment10000AUHours TierType = "Commitment_10000AUHours" - // Commitment1000AUHours specifies the commitment 1000au hours state for - // tier type. - Commitment1000AUHours TierType = "Commitment_1000AUHours" - // Commitment100AUHours specifies the commitment 100au hours state for tier - // type. - Commitment100AUHours TierType = "Commitment_100AUHours" - // Commitment500000AUHours specifies the commitment 500000au hours state - // for tier type. - Commitment500000AUHours TierType = "Commitment_500000AUHours" - // Commitment50000AUHours specifies the commitment 50000au hours state for - // tier type. - Commitment50000AUHours TierType = "Commitment_50000AUHours" - // Commitment5000AUHours specifies the commitment 5000au hours state for - // tier type. - Commitment5000AUHours TierType = "Commitment_5000AUHours" - // Commitment500AUHours specifies the commitment 500au hours state for tier - // type. - Commitment500AUHours TierType = "Commitment_500AUHours" - // Consumption specifies the consumption state for tier type. - Consumption TierType = "Consumption" -) - -// AddDataLakeStoreParameters is additional Data Lake Store parameters. -type AddDataLakeStoreParameters struct { - *DataLakeStoreAccountInfoProperties `json:"properties,omitempty"` -} - -// AddStorageAccountParameters is storage account parameters for a storage -// account being added to a Data Lake Analytics account. -type AddStorageAccountParameters struct { - *StorageAccountProperties `json:"properties,omitempty"` -} - -// DataLakeAnalyticsAccount is a Data Lake Analytics account object, containing -// all information associated with the named Data Lake Analytics account. -type DataLakeAnalyticsAccount struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DataLakeAnalyticsAccountProperties `json:"properties,omitempty"` -} - -// DataLakeAnalyticsAccountListDataLakeStoreResult is data Lake Account list -// information. -type DataLakeAnalyticsAccountListDataLakeStoreResult struct { - autorest.Response `json:"-"` - Value *[]DataLakeStoreAccountInfo `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeAnalyticsAccountListDataLakeStoreResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeAnalyticsAccountListDataLakeStoreResult) DataLakeAnalyticsAccountListDataLakeStoreResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DataLakeAnalyticsAccountListResult is dataLakeAnalytics Account list -// information. -type DataLakeAnalyticsAccountListResult struct { - autorest.Response `json:"-"` - Value *[]DataLakeAnalyticsAccount `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeAnalyticsAccountListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeAnalyticsAccountListResult) DataLakeAnalyticsAccountListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DataLakeAnalyticsAccountListStorageAccountsResult is azure Storage Account -// list information. -type DataLakeAnalyticsAccountListStorageAccountsResult struct { - autorest.Response `json:"-"` - Value *[]StorageAccountInfo `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeAnalyticsAccountListStorageAccountsResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeAnalyticsAccountListStorageAccountsResult) DataLakeAnalyticsAccountListStorageAccountsResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DataLakeAnalyticsAccountProperties is the account specific properties that -// are associated with an underlying Data Lake Analytics account. -type DataLakeAnalyticsAccountProperties struct { - ProvisioningState DataLakeAnalyticsAccountStatus `json:"provisioningState,omitempty"` - State DataLakeAnalyticsAccountState `json:"state,omitempty"` - DefaultDataLakeStoreAccount *string `json:"defaultDataLakeStoreAccount,omitempty"` - MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"` - QueryStoreRetention *int32 `json:"queryStoreRetention,omitempty"` - MaxJobCount *int32 `json:"maxJobCount,omitempty"` - SystemMaxDegreeOfParallelism *int32 `json:"systemMaxDegreeOfParallelism,omitempty"` - SystemMaxJobCount *int32 `json:"systemMaxJobCount,omitempty"` - DataLakeStoreAccounts *[]DataLakeStoreAccountInfo `json:"dataLakeStoreAccounts,omitempty"` - StorageAccounts *[]StorageAccountInfo `json:"storageAccounts,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - NewTier TierType `json:"newTier,omitempty"` - CurrentTier TierType `json:"currentTier,omitempty"` - FirewallState FirewallState `json:"firewallState,omitempty"` - FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` - FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` -} - -// DataLakeAnalyticsAccountUpdateParameters is the parameters that can be used -// to update an existing Data Lake Analytics account. -type DataLakeAnalyticsAccountUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *UpdateDataLakeAnalyticsAccountProperties `json:"properties,omitempty"` -} - -// DataLakeAnalyticsFirewallRuleListResult is data Lake Analytics firewall rule -// list information. -type DataLakeAnalyticsFirewallRuleListResult struct { - autorest.Response `json:"-"` - Value *[]FirewallRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeAnalyticsFirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeAnalyticsFirewallRuleListResult) DataLakeAnalyticsFirewallRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DataLakeStoreAccountInfo is data Lake Store account information. -type DataLakeStoreAccountInfo struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *DataLakeStoreAccountInfoProperties `json:"properties,omitempty"` -} - -// DataLakeStoreAccountInfoProperties is data Lake Store account properties -// information. -type DataLakeStoreAccountInfoProperties struct { - Suffix *string `json:"suffix,omitempty"` -} - -// FirewallRule is data Lake Analytics firewall rule information -type FirewallRule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *FirewallRuleProperties `json:"properties,omitempty"` -} - -// FirewallRuleProperties is data Lake Analytics firewall rule properties -// information -type FirewallRuleProperties struct { - StartIPAddress *string `json:"startIpAddress,omitempty"` - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// ListSasTokensResult is the SAS response that contains the storage account, -// container and associated SAS token for connection use. -type ListSasTokensResult struct { - autorest.Response `json:"-"` - Value *[]SasTokenInfo `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListSasTokensResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListSasTokensResult) ListSasTokensResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ListStorageContainersResult is the list of blob containers associated with -// the storage account attached to the Data Lake Analytics account. -type ListStorageContainersResult struct { - autorest.Response `json:"-"` - Value *[]StorageContainer `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListStorageContainersResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListStorageContainersResult) ListStorageContainersResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OptionalSubResource is the Resource model definition for a nested resource -// with no required properties. -type OptionalSubResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SasTokenInfo is sAS token information. -type SasTokenInfo struct { - AccessToken *string `json:"accessToken,omitempty"` -} - -// StorageAccountInfo is azure Storage account information. -type StorageAccountInfo struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *StorageAccountProperties `json:"properties,omitempty"` -} - -// StorageAccountProperties is azure Storage account properties information. -type StorageAccountProperties struct { - AccessKey *string `json:"accessKey,omitempty"` - Suffix *string `json:"suffix,omitempty"` -} - -// StorageContainer is azure Storage blob container information. -type StorageContainer struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - *StorageContainerProperties `json:"properties,omitempty"` -} - -// StorageContainerProperties is azure Storage blob container properties -// information. -type StorageContainerProperties struct { - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` -} - -// SubResource is the Sub Resource model definition. -type SubResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// UpdateDataLakeAnalyticsAccountProperties is the properties to update that -// are associated with an underlying Data Lake Analytics account to. -type UpdateDataLakeAnalyticsAccountProperties struct { - MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"` - QueryStoreRetention *int32 `json:"queryStoreRetention,omitempty"` - MaxJobCount *int32 `json:"maxJobCount,omitempty"` - NewTier TierType `json:"newTier,omitempty"` - FirewallState FirewallState `json:"firewallState,omitempty"` - FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` - FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` -} - -// UpdateFirewallRuleParameters is data Lake Analytics firewall rule update -// parameters -type UpdateFirewallRuleParameters struct { - *UpdateFirewallRuleProperties `json:"properties,omitempty"` -} - -// UpdateFirewallRuleProperties is data Lake Analytics firewall rule properties -// information -type UpdateFirewallRuleProperties struct { - StartIPAddress *string `json:"startIpAddress,omitempty"` - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// UpdateStorageAccountParameters is storage account parameters for a storage -// account being updated in a Data Lake Analytics account. -type UpdateStorageAccountParameters struct { - *UpdateStorageAccountProperties `json:"properties,omitempty"` -} - -// UpdateStorageAccountProperties is azure Storage account properties -// information to update. -type UpdateStorageAccountProperties struct { - AccessKey *string `json:"accessKey,omitempty"` - Suffix *string `json:"suffix,omitempty"` -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DataLakeAnalyticsAccountState enumerates the values for data lake analytics +// account state. +type DataLakeAnalyticsAccountState string + +const ( + // Active specifies the active state for data lake analytics account state. + Active DataLakeAnalyticsAccountState = "Active" + // Suspended specifies the suspended state for data lake analytics account + // state. + Suspended DataLakeAnalyticsAccountState = "Suspended" +) + +// DataLakeAnalyticsAccountStatus enumerates the values for data lake analytics +// account status. +type DataLakeAnalyticsAccountStatus string + +const ( + // Creating specifies the creating state for data lake analytics account + // status. + Creating DataLakeAnalyticsAccountStatus = "Creating" + // Deleted specifies the deleted state for data lake analytics account + // status. + Deleted DataLakeAnalyticsAccountStatus = "Deleted" + // Deleting specifies the deleting state for data lake analytics account + // status. + Deleting DataLakeAnalyticsAccountStatus = "Deleting" + // Failed specifies the failed state for data lake analytics account + // status. + Failed DataLakeAnalyticsAccountStatus = "Failed" + // Patching specifies the patching state for data lake analytics account + // status. + Patching DataLakeAnalyticsAccountStatus = "Patching" + // Resuming specifies the resuming state for data lake analytics account + // status. + Resuming DataLakeAnalyticsAccountStatus = "Resuming" + // Running specifies the running state for data lake analytics account + // status. + Running DataLakeAnalyticsAccountStatus = "Running" + // Succeeded specifies the succeeded state for data lake analytics account + // status. + Succeeded DataLakeAnalyticsAccountStatus = "Succeeded" + // Suspending specifies the suspending state for data lake analytics + // account status. + Suspending DataLakeAnalyticsAccountStatus = "Suspending" +) + +// FirewallAllowAzureIpsState enumerates the values for firewall allow azure +// ips state. +type FirewallAllowAzureIpsState string + +const ( + // Disabled specifies the disabled state for firewall allow azure ips + // state. + Disabled FirewallAllowAzureIpsState = "Disabled" + // Enabled specifies the enabled state for firewall allow azure ips state. + Enabled FirewallAllowAzureIpsState = "Enabled" +) + +// FirewallState enumerates the values for firewall state. +type FirewallState string + +const ( + // FirewallStateDisabled specifies the firewall state disabled state for + // firewall state. + FirewallStateDisabled FirewallState = "Disabled" + // FirewallStateEnabled specifies the firewall state enabled state for + // firewall state. + FirewallStateEnabled FirewallState = "Enabled" +) + +// TierType enumerates the values for tier type. +type TierType string + +const ( + // Commitment100000AUHours specifies the commitment 100000au hours state + // for tier type. + Commitment100000AUHours TierType = "Commitment_100000AUHours" + // Commitment10000AUHours specifies the commitment 10000au hours state for + // tier type. + Commitment10000AUHours TierType = "Commitment_10000AUHours" + // Commitment1000AUHours specifies the commitment 1000au hours state for + // tier type. + Commitment1000AUHours TierType = "Commitment_1000AUHours" + // Commitment100AUHours specifies the commitment 100au hours state for tier + // type. + Commitment100AUHours TierType = "Commitment_100AUHours" + // Commitment500000AUHours specifies the commitment 500000au hours state + // for tier type. + Commitment500000AUHours TierType = "Commitment_500000AUHours" + // Commitment50000AUHours specifies the commitment 50000au hours state for + // tier type. + Commitment50000AUHours TierType = "Commitment_50000AUHours" + // Commitment5000AUHours specifies the commitment 5000au hours state for + // tier type. + Commitment5000AUHours TierType = "Commitment_5000AUHours" + // Commitment500AUHours specifies the commitment 500au hours state for tier + // type. + Commitment500AUHours TierType = "Commitment_500AUHours" + // Consumption specifies the consumption state for tier type. + Consumption TierType = "Consumption" +) + +// AddDataLakeStoreParameters is additional Data Lake Store parameters. +type AddDataLakeStoreParameters struct { + *DataLakeStoreAccountInfoProperties `json:"properties,omitempty"` +} + +// AddStorageAccountParameters is storage account parameters for a storage +// account being added to a Data Lake Analytics account. +type AddStorageAccountParameters struct { + *StorageAccountProperties `json:"properties,omitempty"` +} + +// DataLakeAnalyticsAccount is a Data Lake Analytics account object, containing +// all information associated with the named Data Lake Analytics account. +type DataLakeAnalyticsAccount struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DataLakeAnalyticsAccountProperties `json:"properties,omitempty"` +} + +// DataLakeAnalyticsAccountListDataLakeStoreResult is data Lake Account list +// information. +type DataLakeAnalyticsAccountListDataLakeStoreResult struct { + autorest.Response `json:"-"` + Value *[]DataLakeStoreAccountInfo `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeAnalyticsAccountListDataLakeStoreResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeAnalyticsAccountListDataLakeStoreResult) DataLakeAnalyticsAccountListDataLakeStoreResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DataLakeAnalyticsAccountListResult is dataLakeAnalytics Account list +// information. +type DataLakeAnalyticsAccountListResult struct { + autorest.Response `json:"-"` + Value *[]DataLakeAnalyticsAccount `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeAnalyticsAccountListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeAnalyticsAccountListResult) DataLakeAnalyticsAccountListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DataLakeAnalyticsAccountListStorageAccountsResult is azure Storage Account +// list information. +type DataLakeAnalyticsAccountListStorageAccountsResult struct { + autorest.Response `json:"-"` + Value *[]StorageAccountInfo `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeAnalyticsAccountListStorageAccountsResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeAnalyticsAccountListStorageAccountsResult) DataLakeAnalyticsAccountListStorageAccountsResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DataLakeAnalyticsAccountProperties is the account specific properties that +// are associated with an underlying Data Lake Analytics account. +type DataLakeAnalyticsAccountProperties struct { + ProvisioningState DataLakeAnalyticsAccountStatus `json:"provisioningState,omitempty"` + State DataLakeAnalyticsAccountState `json:"state,omitempty"` + DefaultDataLakeStoreAccount *string `json:"defaultDataLakeStoreAccount,omitempty"` + MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"` + QueryStoreRetention *int32 `json:"queryStoreRetention,omitempty"` + MaxJobCount *int32 `json:"maxJobCount,omitempty"` + SystemMaxDegreeOfParallelism *int32 `json:"systemMaxDegreeOfParallelism,omitempty"` + SystemMaxJobCount *int32 `json:"systemMaxJobCount,omitempty"` + DataLakeStoreAccounts *[]DataLakeStoreAccountInfo `json:"dataLakeStoreAccounts,omitempty"` + StorageAccounts *[]StorageAccountInfo `json:"storageAccounts,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + NewTier TierType `json:"newTier,omitempty"` + CurrentTier TierType `json:"currentTier,omitempty"` + FirewallState FirewallState `json:"firewallState,omitempty"` + FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` + FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` +} + +// DataLakeAnalyticsAccountUpdateParameters is the parameters that can be used +// to update an existing Data Lake Analytics account. +type DataLakeAnalyticsAccountUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + *UpdateDataLakeAnalyticsAccountProperties `json:"properties,omitempty"` +} + +// DataLakeAnalyticsFirewallRuleListResult is data Lake Analytics firewall rule +// list information. +type DataLakeAnalyticsFirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeAnalyticsFirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeAnalyticsFirewallRuleListResult) DataLakeAnalyticsFirewallRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DataLakeStoreAccountInfo is data Lake Store account information. +type DataLakeStoreAccountInfo struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *DataLakeStoreAccountInfoProperties `json:"properties,omitempty"` +} + +// DataLakeStoreAccountInfoProperties is data Lake Store account properties +// information. +type DataLakeStoreAccountInfoProperties struct { + Suffix *string `json:"suffix,omitempty"` +} + +// FirewallRule is data Lake Analytics firewall rule information +type FirewallRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *FirewallRuleProperties `json:"properties,omitempty"` +} + +// FirewallRuleProperties is data Lake Analytics firewall rule properties +// information +type FirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// ListSasTokensResult is the SAS response that contains the storage account, +// container and associated SAS token for connection use. +type ListSasTokensResult struct { + autorest.Response `json:"-"` + Value *[]SasTokenInfo `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListSasTokensResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListSasTokensResult) ListSasTokensResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ListStorageContainersResult is the list of blob containers associated with +// the storage account attached to the Data Lake Analytics account. +type ListStorageContainersResult struct { + autorest.Response `json:"-"` + Value *[]StorageContainer `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListStorageContainersResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListStorageContainersResult) ListStorageContainersResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OptionalSubResource is the Resource model definition for a nested resource +// with no required properties. +type OptionalSubResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SasTokenInfo is sAS token information. +type SasTokenInfo struct { + AccessToken *string `json:"accessToken,omitempty"` +} + +// StorageAccountInfo is azure Storage account information. +type StorageAccountInfo struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *StorageAccountProperties `json:"properties,omitempty"` +} + +// StorageAccountProperties is azure Storage account properties information. +type StorageAccountProperties struct { + AccessKey *string `json:"accessKey,omitempty"` + Suffix *string `json:"suffix,omitempty"` +} + +// StorageContainer is azure Storage blob container information. +type StorageContainer struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + *StorageContainerProperties `json:"properties,omitempty"` +} + +// StorageContainerProperties is azure Storage blob container properties +// information. +type StorageContainerProperties struct { + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` +} + +// SubResource is the Sub Resource model definition. +type SubResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// UpdateDataLakeAnalyticsAccountProperties is the properties to update that +// are associated with an underlying Data Lake Analytics account to. +type UpdateDataLakeAnalyticsAccountProperties struct { + MaxDegreeOfParallelism *int32 `json:"maxDegreeOfParallelism,omitempty"` + QueryStoreRetention *int32 `json:"queryStoreRetention,omitempty"` + MaxJobCount *int32 `json:"maxJobCount,omitempty"` + NewTier TierType `json:"newTier,omitempty"` + FirewallState FirewallState `json:"firewallState,omitempty"` + FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` + FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` +} + +// UpdateFirewallRuleParameters is data Lake Analytics firewall rule update +// parameters +type UpdateFirewallRuleParameters struct { + *UpdateFirewallRuleProperties `json:"properties,omitempty"` +} + +// UpdateFirewallRuleProperties is data Lake Analytics firewall rule properties +// information +type UpdateFirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// UpdateStorageAccountParameters is storage account parameters for a storage +// account being updated in a Data Lake Analytics account. +type UpdateStorageAccountParameters struct { + *UpdateStorageAccountProperties `json:"properties,omitempty"` +} + +// UpdateStorageAccountProperties is azure Storage account properties +// information to update. +type UpdateStorageAccountProperties struct { + AccessKey *string `json:"accessKey,omitempty"` + Suffix *string `json:"suffix,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/storageaccounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/storageaccounts.go index d7e485dad4..d0f823938f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/storageaccounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/storageaccounts.go @@ -1,738 +1,738 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// StorageAccountsClient is the creates an Azure Data Lake Analytics account -// management client. -type StorageAccountsClient struct { - ManagementClient -} - -// NewStorageAccountsClient creates an instance of the StorageAccountsClient -// client. -func NewStorageAccountsClient(subscriptionID string) StorageAccountsClient { - return NewStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStorageAccountsClientWithBaseURI creates an instance of the -// StorageAccountsClient client. -func NewStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) StorageAccountsClient { - return StorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add updates the specified Data Lake Analytics account to add an Azure -// Storage account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to which to add the Azure Storage account. -// storageAccountName is the name of the Azure Storage account to add -// parameters is the parameters containing the access key and optional suffix -// for the Azure Storage Account. -func (client StorageAccountsClient) Add(resourceGroupName string, accountName string, storageAccountName string, parameters AddStorageAccountParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageAccountProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.StorageAccountProperties.AccessKey", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.StorageAccountsClient", "Add") - } - - req, err := client.AddPreparer(resourceGroupName, accountName, storageAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Add", resp, "Failure responding to request") - } - - return -} - -// AddPreparer prepares the Add request. -func (client StorageAccountsClient) AddPreparer(resourceGroupName string, accountName string, storageAccountName string, parameters AddStorageAccountParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddSender sends the Add request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) AddSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddResponder handles the response to the Add request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete updates the specified Data Lake Analytics account to remove an Azure -// Storage account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to remove the Azure Storage account. -// storageAccountName is the name of the Azure Storage account to remove -func (client StorageAccountsClient) Delete(resourceGroupName string, accountName string, storageAccountName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, accountName, storageAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client StorageAccountsClient) DeletePreparer(resourceGroupName string, accountName string, storageAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Azure Storage account linked to the given Data Lake -// Analytics account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which to retrieve Azure storage account details. -// storageAccountName is the name of the Azure Storage account for which to -// retrieve the details. -func (client StorageAccountsClient) Get(resourceGroupName string, accountName string, storageAccountName string) (result StorageAccountInfo, err error) { - req, err := client.GetPreparer(resourceGroupName, accountName, storageAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client StorageAccountsClient) GetPreparer(resourceGroupName string, accountName string, storageAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) GetResponder(resp *http.Response) (result StorageAccountInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStorageContainer gets the specified Azure Storage container associated -// with the given Data Lake Analytics and Azure Storage accounts. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account for which to retrieve blob container. storageAccountName -// is the name of the Azure storage account from which to retrieve the blob -// container. containerName is the name of the Azure storage container to -// retrieve -func (client StorageAccountsClient) GetStorageContainer(resourceGroupName string, accountName string, storageAccountName string, containerName string) (result StorageContainer, err error) { - req, err := client.GetStorageContainerPreparer(resourceGroupName, accountName, storageAccountName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "GetStorageContainer", nil, "Failure preparing request") - return - } - - resp, err := client.GetStorageContainerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "GetStorageContainer", resp, "Failure sending request") - return - } - - result, err = client.GetStorageContainerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "GetStorageContainer", resp, "Failure responding to request") - } - - return -} - -// GetStorageContainerPreparer prepares the GetStorageContainer request. -func (client StorageAccountsClient) GetStorageContainerPreparer(resourceGroupName string, accountName string, storageAccountName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}/Containers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetStorageContainerSender sends the GetStorageContainer request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) GetStorageContainerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetStorageContainerResponder handles the response to the GetStorageContainer request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) GetStorageContainerResponder(resp *http.Response) (result StorageContainer, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount gets the first page of Azure Storage accounts, if any, linked -// to the specified Data Lake Analytics account. The response includes a link -// to the next page, if any. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account for which to list Azure Storage accounts. filter is the -// OData filter. Optional. top is the number of items to return. Optional. skip -// is the number of items to skip over before returning elements. Optional. -// selectParameter is oData Select statement. Limits the properties on each -// entry to just those requested, e.g. -// Categories?$select=CategoryName,Description. Optional. orderby is orderBy -// clause. One or more comma-separated expressions with an optional "asc" (the -// default) or "desc" depending on the order you'd like the values sorted, e.g. -// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value -// of true or false to request a count of the matching resources included with -// the resources in the response, e.g. Categories?$count=true. Optional. -func (client StorageAccountsClient) ListByAccount(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListStorageAccountsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.StorageAccountsClient", "ListByAccount") - } - - req, err := client.ListByAccountPreparer(resourceGroupName, accountName, filter, top, skip, selectParameter, orderby, count) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client StorageAccountsClient) ListByAccountPreparer(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if count != nil { - queryParameters["$count"] = autorest.Encode("query", *count) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsAccountListStorageAccountsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccountNextResults retrieves the next set of results, if any. -func (client StorageAccountsClient) ListByAccountNextResults(lastResults DataLakeAnalyticsAccountListStorageAccountsResult) (result DataLakeAnalyticsAccountListStorageAccountsResult, err error) { - req, err := lastResults.DataLakeAnalyticsAccountListStorageAccountsResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure responding to next results request") - } - - return -} - -// ListSasTokens gets the SAS token associated with the specified Data Lake -// Analytics and Azure Storage account and container combination. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account from which an Azure Storage account's SAS token is being -// requested. storageAccountName is the name of the Azure storage account for -// which the SAS token is being requested. containerName is the name of the -// Azure storage container for which the SAS token is being requested. -func (client StorageAccountsClient) ListSasTokens(resourceGroupName string, accountName string, storageAccountName string, containerName string) (result ListSasTokensResult, err error) { - req, err := client.ListSasTokensPreparer(resourceGroupName, accountName, storageAccountName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", nil, "Failure preparing request") - return - } - - resp, err := client.ListSasTokensSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure sending request") - return - } - - result, err = client.ListSasTokensResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure responding to request") - } - - return -} - -// ListSasTokensPreparer prepares the ListSasTokens request. -func (client StorageAccountsClient) ListSasTokensPreparer(resourceGroupName string, accountName string, storageAccountName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}/Containers/{containerName}/listSasTokens", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSasTokensSender sends the ListSasTokens request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) ListSasTokensSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSasTokensResponder handles the response to the ListSasTokens request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) ListSasTokensResponder(resp *http.Response) (result ListSasTokensResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSasTokensNextResults retrieves the next set of results, if any. -func (client StorageAccountsClient) ListSasTokensNextResults(lastResults ListSasTokensResult) (result ListSasTokensResult, err error) { - req, err := lastResults.ListSasTokensResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSasTokensSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure sending next results request") - } - - result, err = client.ListSasTokensResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure responding to next results request") - } - - return -} - -// ListStorageContainers lists the Azure Storage containers, if any, associated -// with the specified Data Lake Analytics and Azure Storage account -// combination. The response includes a link to the next page of results, if -// any. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account for which to list Azure Storage blob containers. -// storageAccountName is the name of the Azure storage account from which to -// list blob containers. -func (client StorageAccountsClient) ListStorageContainers(resourceGroupName string, accountName string, storageAccountName string) (result ListStorageContainersResult, err error) { - req, err := client.ListStorageContainersPreparer(resourceGroupName, accountName, storageAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", nil, "Failure preparing request") - return - } - - resp, err := client.ListStorageContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure sending request") - return - } - - result, err = client.ListStorageContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure responding to request") - } - - return -} - -// ListStorageContainersPreparer prepares the ListStorageContainers request. -func (client StorageAccountsClient) ListStorageContainersPreparer(resourceGroupName string, accountName string, storageAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}/Containers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListStorageContainersSender sends the ListStorageContainers request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) ListStorageContainersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListStorageContainersResponder handles the response to the ListStorageContainers request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) ListStorageContainersResponder(resp *http.Response) (result ListStorageContainersResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListStorageContainersNextResults retrieves the next set of results, if any. -func (client StorageAccountsClient) ListStorageContainersNextResults(lastResults ListStorageContainersResult) (result ListStorageContainersResult, err error) { - req, err := lastResults.ListStorageContainersResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListStorageContainersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure sending next results request") - } - - result, err = client.ListStorageContainersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the Data Lake Analytics account to replace Azure Storage blob -// account details, such as the access key and/or suffix. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Analytics account. accountName is the name of the Data Lake -// Analytics account to modify storage accounts in storageAccountName is the -// Azure Storage account to modify parameters is the parameters containing the -// access key and suffix to update the storage account with, if any. Passing -// nothing results in no change. -func (client StorageAccountsClient) Update(resourceGroupName string, accountName string, storageAccountName string, parameters *UpdateStorageAccountParameters) (result autorest.Response, err error) { - req, err := client.UpdatePreparer(resourceGroupName, accountName, storageAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client StorageAccountsClient) UpdatePreparer(resourceGroupName string, accountName string, storageAccountName string, parameters *UpdateStorageAccountParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "storageAccountName": autorest.Encode("path", storageAccountName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client StorageAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client StorageAccountsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// StorageAccountsClient is the creates an Azure Data Lake Analytics account +// management client. +type StorageAccountsClient struct { + ManagementClient +} + +// NewStorageAccountsClient creates an instance of the StorageAccountsClient +// client. +func NewStorageAccountsClient(subscriptionID string) StorageAccountsClient { + return NewStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStorageAccountsClientWithBaseURI creates an instance of the +// StorageAccountsClient client. +func NewStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) StorageAccountsClient { + return StorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Add updates the specified Data Lake Analytics account to add an Azure +// Storage account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to which to add the Azure Storage account. +// storageAccountName is the name of the Azure Storage account to add +// parameters is the parameters containing the access key and optional suffix +// for the Azure Storage Account. +func (client StorageAccountsClient) Add(resourceGroupName string, accountName string, storageAccountName string, parameters AddStorageAccountParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageAccountProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.StorageAccountProperties.AccessKey", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.StorageAccountsClient", "Add") + } + + req, err := client.AddPreparer(resourceGroupName, accountName, storageAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client StorageAccountsClient) AddPreparer(resourceGroupName string, accountName string, storageAccountName string, parameters AddStorageAccountParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) AddSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete updates the specified Data Lake Analytics account to remove an Azure +// Storage account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to remove the Azure Storage account. +// storageAccountName is the name of the Azure Storage account to remove +func (client StorageAccountsClient) Delete(resourceGroupName string, accountName string, storageAccountName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, accountName, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client StorageAccountsClient) DeletePreparer(resourceGroupName string, accountName string, storageAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Azure Storage account linked to the given Data Lake +// Analytics account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which to retrieve Azure storage account details. +// storageAccountName is the name of the Azure Storage account for which to +// retrieve the details. +func (client StorageAccountsClient) Get(resourceGroupName string, accountName string, storageAccountName string) (result StorageAccountInfo, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client StorageAccountsClient) GetPreparer(resourceGroupName string, accountName string, storageAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) GetResponder(resp *http.Response) (result StorageAccountInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStorageContainer gets the specified Azure Storage container associated +// with the given Data Lake Analytics and Azure Storage accounts. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account for which to retrieve blob container. storageAccountName +// is the name of the Azure storage account from which to retrieve the blob +// container. containerName is the name of the Azure storage container to +// retrieve +func (client StorageAccountsClient) GetStorageContainer(resourceGroupName string, accountName string, storageAccountName string, containerName string) (result StorageContainer, err error) { + req, err := client.GetStorageContainerPreparer(resourceGroupName, accountName, storageAccountName, containerName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "GetStorageContainer", nil, "Failure preparing request") + return + } + + resp, err := client.GetStorageContainerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "GetStorageContainer", resp, "Failure sending request") + return + } + + result, err = client.GetStorageContainerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "GetStorageContainer", resp, "Failure responding to request") + } + + return +} + +// GetStorageContainerPreparer prepares the GetStorageContainer request. +func (client StorageAccountsClient) GetStorageContainerPreparer(resourceGroupName string, accountName string, storageAccountName string, containerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "containerName": autorest.Encode("path", containerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}/Containers/{containerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetStorageContainerSender sends the GetStorageContainer request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) GetStorageContainerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetStorageContainerResponder handles the response to the GetStorageContainer request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) GetStorageContainerResponder(resp *http.Response) (result StorageContainer, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccount gets the first page of Azure Storage accounts, if any, linked +// to the specified Data Lake Analytics account. The response includes a link +// to the next page, if any. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account for which to list Azure Storage accounts. filter is the +// OData filter. Optional. top is the number of items to return. Optional. skip +// is the number of items to skip over before returning elements. Optional. +// selectParameter is oData Select statement. Limits the properties on each +// entry to just those requested, e.g. +// Categories?$select=CategoryName,Description. Optional. orderby is orderBy +// clause. One or more comma-separated expressions with an optional "asc" (the +// default) or "desc" depending on the order you'd like the values sorted, e.g. +// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value +// of true or false to request a count of the matching resources included with +// the resources in the response, e.g. Categories?$count=true. Optional. +func (client StorageAccountsClient) ListByAccount(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeAnalyticsAccountListStorageAccountsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.StorageAccountsClient", "ListByAccount") + } + + req, err := client.ListByAccountPreparer(resourceGroupName, accountName, filter, top, skip, selectParameter, orderby, count) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAccountPreparer prepares the ListByAccount request. +func (client StorageAccountsClient) ListByAccountPreparer(resourceGroupName string, accountName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if count != nil { + queryParameters["$count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAccountSender sends the ListByAccount request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAccountResponder handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) ListByAccountResponder(resp *http.Response) (result DataLakeAnalyticsAccountListStorageAccountsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccountNextResults retrieves the next set of results, if any. +func (client StorageAccountsClient) ListByAccountNextResults(lastResults DataLakeAnalyticsAccountListStorageAccountsResult) (result DataLakeAnalyticsAccountListStorageAccountsResult, err error) { + req, err := lastResults.DataLakeAnalyticsAccountListStorageAccountsResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListByAccount", resp, "Failure responding to next results request") + } + + return +} + +// ListSasTokens gets the SAS token associated with the specified Data Lake +// Analytics and Azure Storage account and container combination. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account from which an Azure Storage account's SAS token is being +// requested. storageAccountName is the name of the Azure storage account for +// which the SAS token is being requested. containerName is the name of the +// Azure storage container for which the SAS token is being requested. +func (client StorageAccountsClient) ListSasTokens(resourceGroupName string, accountName string, storageAccountName string, containerName string) (result ListSasTokensResult, err error) { + req, err := client.ListSasTokensPreparer(resourceGroupName, accountName, storageAccountName, containerName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", nil, "Failure preparing request") + return + } + + resp, err := client.ListSasTokensSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure sending request") + return + } + + result, err = client.ListSasTokensResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure responding to request") + } + + return +} + +// ListSasTokensPreparer prepares the ListSasTokens request. +func (client StorageAccountsClient) ListSasTokensPreparer(resourceGroupName string, accountName string, storageAccountName string, containerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "containerName": autorest.Encode("path", containerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}/Containers/{containerName}/listSasTokens", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSasTokensSender sends the ListSasTokens request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) ListSasTokensSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSasTokensResponder handles the response to the ListSasTokens request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) ListSasTokensResponder(resp *http.Response) (result ListSasTokensResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSasTokensNextResults retrieves the next set of results, if any. +func (client StorageAccountsClient) ListSasTokensNextResults(lastResults ListSasTokensResult) (result ListSasTokensResult, err error) { + req, err := lastResults.ListSasTokensResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSasTokensSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure sending next results request") + } + + result, err = client.ListSasTokensResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListSasTokens", resp, "Failure responding to next results request") + } + + return +} + +// ListStorageContainers lists the Azure Storage containers, if any, associated +// with the specified Data Lake Analytics and Azure Storage account +// combination. The response includes a link to the next page of results, if +// any. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account for which to list Azure Storage blob containers. +// storageAccountName is the name of the Azure storage account from which to +// list blob containers. +func (client StorageAccountsClient) ListStorageContainers(resourceGroupName string, accountName string, storageAccountName string) (result ListStorageContainersResult, err error) { + req, err := client.ListStorageContainersPreparer(resourceGroupName, accountName, storageAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", nil, "Failure preparing request") + return + } + + resp, err := client.ListStorageContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure sending request") + return + } + + result, err = client.ListStorageContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure responding to request") + } + + return +} + +// ListStorageContainersPreparer prepares the ListStorageContainers request. +func (client StorageAccountsClient) ListStorageContainersPreparer(resourceGroupName string, accountName string, storageAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}/Containers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListStorageContainersSender sends the ListStorageContainers request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) ListStorageContainersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListStorageContainersResponder handles the response to the ListStorageContainers request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) ListStorageContainersResponder(resp *http.Response) (result ListStorageContainersResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStorageContainersNextResults retrieves the next set of results, if any. +func (client StorageAccountsClient) ListStorageContainersNextResults(lastResults ListStorageContainersResult) (result ListStorageContainersResult, err error) { + req, err := lastResults.ListStorageContainersResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListStorageContainersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure sending next results request") + } + + result, err = client.ListStorageContainersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "ListStorageContainers", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the Data Lake Analytics account to replace Azure Storage blob +// account details, such as the access key and/or suffix. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Analytics account. accountName is the name of the Data Lake +// Analytics account to modify storage accounts in storageAccountName is the +// Azure Storage account to modify parameters is the parameters containing the +// access key and suffix to update the storage account with, if any. Passing +// nothing results in no change. +func (client StorageAccountsClient) Update(resourceGroupName string, accountName string, storageAccountName string, parameters *UpdateStorageAccountParameters) (result autorest.Response, err error) { + req, err := client.UpdatePreparer(resourceGroupName, accountName, storageAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.StorageAccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client StorageAccountsClient) UpdatePreparer(resourceGroupName string, accountName string, storageAccountName string, parameters *UpdateStorageAccountParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/StorageAccounts/{storageAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/version.go index 8b6cfe7e8e..5d627a4dce 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-analytics/account/version.go @@ -1,29 +1,29 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-account/2016-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-account/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/accountgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/accountgroup.go index dc5793a0a4..50042ad67a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/accountgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/accountgroup.go @@ -1,702 +1,702 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupClient is the creates an Azure Data Lake Store account management -// client. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates the specified Data Lake Store account. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. name is the name of the Data Lake Store account to -// create. parameters is parameters supplied to create the Data Lake Store -// account. -func (client GroupClient) Create(resourceGroupName string, name string, parameters DataLakeStoreAccount, cancel <-chan struct{}) (<-chan DataLakeStoreAccount, <-chan error) { - resultChan := make(chan DataLakeStoreAccount, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Identity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Identity.Type", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.DataLakeStoreAccountProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo.KeyVaultResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo.EncryptionKeyName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo.EncryptionKeyVersion", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "account.GroupClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result DataLakeStoreAccount - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, name, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client GroupClient) CreatePreparer(resourceGroupName string, name string, parameters DataLakeStoreAccount, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Data Lake Store account. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. name is the name of the Data Lake Store account to -// delete. -func (client GroupClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableKeyVault attempts to enable a user managed key vault for encryption of -// the specified Data Lake Store account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account to attempt to enable the Key Vault for. -func (client GroupClient) EnableKeyVault(resourceGroupName string, accountName string) (result autorest.Response, err error) { - req, err := client.EnableKeyVaultPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "EnableKeyVault", nil, "Failure preparing request") - return - } - - resp, err := client.EnableKeyVaultSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.GroupClient", "EnableKeyVault", resp, "Failure sending request") - return - } - - result, err = client.EnableKeyVaultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "EnableKeyVault", resp, "Failure responding to request") - } - - return -} - -// EnableKeyVaultPreparer prepares the EnableKeyVault request. -func (client GroupClient) EnableKeyVaultPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// EnableKeyVaultSender sends the EnableKeyVault request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) EnableKeyVaultSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// EnableKeyVaultResponder handles the response to the EnableKeyVault request. The method always -// closes the http.Response Body. -func (client GroupClient) EnableKeyVaultResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Data Lake Store account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. name is the name of the Data Lake Store account to -// retrieve. -func (client GroupClient) Get(resourceGroupName string, name string) (result DataLakeStoreAccount, err error) { - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the Data Lake Store accounts within the subscription. The -// response includes a link to the next page of results, if any. -// -// filter is oData filter. Optional. top is the number of items to return. -// Optional. skip is the number of items to skip over before returning -// elements. Optional. selectParameter is oData Select statement. Limits the -// properties on each entry to just those requested, e.g. -// Categories?$select=CategoryName,Description. Optional. orderby is orderBy -// clause. One or more comma-separated expressions with an optional "asc" (the -// default) or "desc" depending on the order you'd like the values sorted, e.g. -// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value -// of true or false to request a count of the matching resources included with -// the resources in the response, e.g. Categories?$count=true. Optional. -func (client GroupClient) List(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeStoreAccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "List") - } - - req, err := client.ListPreparer(filter, top, skip, selectParameter, orderby, count) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if count != nil { - queryParameters["$count"] = autorest.Encode("query", *count) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result DataLakeStoreAccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults DataLakeStoreAccountListResult) (result DataLakeStoreAccountListResult, err error) { - req, err := lastResults.DataLakeStoreAccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists the Data Lake Store accounts within a specific -// resource group. The response includes a link to the next page of results, if -// any. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account(s). filter is oData filter. Optional. top is the -// number of items to return. Optional. skip is the number of items to skip -// over before returning elements. Optional. selectParameter is oData Select -// statement. Limits the properties on each entry to just those requested, e.g. -// Categories?$select=CategoryName,Description. Optional. orderby is orderBy -// clause. One or more comma-separated expressions with an optional "asc" (the -// default) or "desc" depending on the order you'd like the values sorted, e.g. -// Categories?$orderby=CategoryName desc. Optional. count is a Boolean value of -// true or false to request a count of the matching resources included with the -// resources in the response, e.g. Categories?$count=true. Optional. -func (client GroupClient) ListByResourceGroup(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeStoreAccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter, top, skip, selectParameter, orderby, count) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if count != nil { - queryParameters["$count"] = autorest.Encode("query", *count) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result DataLakeStoreAccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client GroupClient) ListByResourceGroupNextResults(lastResults DataLakeStoreAccountListResult) (result DataLakeStoreAccountListResult, err error) { - req, err := lastResults.DataLakeStoreAccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the specified Data Lake Store account information. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. name is the name of the Data Lake Store account to -// update. parameters is parameters supplied to update the Data Lake Store -// account. -func (client GroupClient) Update(resourceGroupName string, name string, parameters DataLakeStoreAccountUpdateParameters, cancel <-chan struct{}) (<-chan DataLakeStoreAccount, <-chan error) { - resultChan := make(chan DataLakeStoreAccount, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result DataLakeStoreAccount - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, name, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, parameters DataLakeStoreAccountUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupClient) UpdateResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupClient is the creates an Azure Data Lake Store account management +// client. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates the specified Data Lake Store account. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. name is the name of the Data Lake Store account to +// create. parameters is parameters supplied to create the Data Lake Store +// account. +func (client GroupClient) Create(resourceGroupName string, name string, parameters DataLakeStoreAccount, cancel <-chan struct{}) (<-chan DataLakeStoreAccount, <-chan error) { + resultChan := make(chan DataLakeStoreAccount, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Identity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Identity.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.DataLakeStoreAccountProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo.KeyVaultResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo.EncryptionKeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DataLakeStoreAccountProperties.EncryptionConfig.KeyVaultMetaInfo.EncryptionKeyVersion", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "account.GroupClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DataLakeStoreAccount + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, name, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client GroupClient) CreatePreparer(resourceGroupName string, name string, parameters DataLakeStoreAccount, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Data Lake Store account. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. name is the name of the Data Lake Store account to +// delete. +func (client GroupClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client GroupClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableKeyVault attempts to enable a user managed key vault for encryption of +// the specified Data Lake Store account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account to attempt to enable the Key Vault for. +func (client GroupClient) EnableKeyVault(resourceGroupName string, accountName string) (result autorest.Response, err error) { + req, err := client.EnableKeyVaultPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "EnableKeyVault", nil, "Failure preparing request") + return + } + + resp, err := client.EnableKeyVaultSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.GroupClient", "EnableKeyVault", resp, "Failure sending request") + return + } + + result, err = client.EnableKeyVaultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "EnableKeyVault", resp, "Failure responding to request") + } + + return +} + +// EnableKeyVaultPreparer prepares the EnableKeyVault request. +func (client GroupClient) EnableKeyVaultPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/enableKeyVault", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EnableKeyVaultSender sends the EnableKeyVault request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) EnableKeyVaultSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EnableKeyVaultResponder handles the response to the EnableKeyVault request. The method always +// closes the http.Response Body. +func (client GroupClient) EnableKeyVaultResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Data Lake Store account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. name is the name of the Data Lake Store account to +// retrieve. +func (client GroupClient) Get(resourceGroupName string, name string) (result DataLakeStoreAccount, err error) { + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the Data Lake Store accounts within the subscription. The +// response includes a link to the next page of results, if any. +// +// filter is oData filter. Optional. top is the number of items to return. +// Optional. skip is the number of items to skip over before returning +// elements. Optional. selectParameter is oData Select statement. Limits the +// properties on each entry to just those requested, e.g. +// Categories?$select=CategoryName,Description. Optional. orderby is orderBy +// clause. One or more comma-separated expressions with an optional "asc" (the +// default) or "desc" depending on the order you'd like the values sorted, e.g. +// Categories?$orderby=CategoryName desc. Optional. count is the Boolean value +// of true or false to request a count of the matching resources included with +// the resources in the response, e.g. Categories?$count=true. Optional. +func (client GroupClient) List(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeStoreAccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "List") + } + + req, err := client.ListPreparer(filter, top, skip, selectParameter, orderby, count) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer(filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if count != nil { + queryParameters["$count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result DataLakeStoreAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults DataLakeStoreAccountListResult) (result DataLakeStoreAccountListResult, err error) { + req, err := lastResults.DataLakeStoreAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists the Data Lake Store accounts within a specific +// resource group. The response includes a link to the next page of results, if +// any. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account(s). filter is oData filter. Optional. top is the +// number of items to return. Optional. skip is the number of items to skip +// over before returning elements. Optional. selectParameter is oData Select +// statement. Limits the properties on each entry to just those requested, e.g. +// Categories?$select=CategoryName,Description. Optional. orderby is orderBy +// clause. One or more comma-separated expressions with an optional "asc" (the +// default) or "desc" depending on the order you'd like the values sorted, e.g. +// Categories?$orderby=CategoryName desc. Optional. count is a Boolean value of +// true or false to request a count of the matching resources included with the +// resources in the response, e.g. Categories?$count=true. Optional. +func (client GroupClient) ListByResourceGroup(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result DataLakeStoreAccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}, + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.GroupClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter, top, skip, selectParameter, orderby, count) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if count != nil { + queryParameters["$count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result DataLakeStoreAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client GroupClient) ListByResourceGroupNextResults(lastResults DataLakeStoreAccountListResult) (result DataLakeStoreAccountListResult, err error) { + req, err := lastResults.DataLakeStoreAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specified Data Lake Store account information. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. name is the name of the Data Lake Store account to +// update. parameters is parameters supplied to update the Data Lake Store +// account. +func (client GroupClient) Update(resourceGroupName string, name string, parameters DataLakeStoreAccountUpdateParameters, cancel <-chan struct{}) (<-chan DataLakeStoreAccount, <-chan error) { + resultChan := make(chan DataLakeStoreAccount, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result DataLakeStoreAccount + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, name, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.GroupClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, parameters DataLakeStoreAccountUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GroupClient) UpdateResponder(resp *http.Response) (result DataLakeStoreAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/client.go index 7ee5ba59b0..b48c790c3e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/client.go @@ -1,53 +1,53 @@ -// Package account implements the Azure ARM Account service API version -// 2016-11-01. -// -// Creates an Azure Data Lake Store account management client. -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Account - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Account. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package account implements the Azure ARM Account service API version +// 2016-11-01. +// +// Creates an Azure Data Lake Store account management client. +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Account + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Account. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/firewallrules.go index a2cb953e7c..cd27b5ee12 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/firewallrules.go @@ -1,432 +1,432 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// FirewallRulesClient is the creates an Azure Data Lake Store account -// management client. -type FirewallRulesClient struct { - ManagementClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient -// client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the -// FirewallRulesClient client. -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the specified firewall rule. During -// update, the firewall rule with the specified name will be replaced with this -// new firewall rule. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account to add or replace the firewall rule. firewallRuleName is the name of -// the firewall rule to create or update. parameters is parameters supplied to -// create or update the firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.FirewallRulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified firewall rule from the specified Data Lake -// Store account -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account from which to delete the firewall rule. firewallRuleName is the name -// of the firewall rule to delete. -func (client FirewallRulesClient) Delete(resourceGroupName string, accountName string, firewallRuleName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, accountName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Data Lake Store firewall rule. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account from which to get the firewall rule. firewallRuleName is the name of -// the firewall rule to retrieve. -func (client FirewallRulesClient) Get(resourceGroupName string, accountName string, firewallRuleName string) (result FirewallRule, err error) { - req, err := client.GetPreparer(resourceGroupName, accountName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount lists the Data Lake Store firewall rules within the specified -// Data Lake Store account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account from which to get the firewall rules. -func (client FirewallRulesClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeStoreFirewallRuleListResult, err error) { - req, err := client.ListByAccountPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client FirewallRulesClient) ListByAccountPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByAccountResponder(resp *http.Response) (result DataLakeStoreFirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccountNextResults retrieves the next set of results, if any. -func (client FirewallRulesClient) ListByAccountNextResults(lastResults DataLakeStoreFirewallRuleListResult) (result DataLakeStoreFirewallRuleListResult, err error) { - req, err := lastResults.DataLakeStoreFirewallRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the specified firewall rule. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account to which to update the firewall rule. firewallRuleName is the name -// of the firewall rule to update. parameters is parameters supplied to update -// the firewall rule. -func (client FirewallRulesClient) Update(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (result FirewallRule, err error) { - req, err := client.UpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FirewallRulesClient) UpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) UpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FirewallRulesClient is the creates an Azure Data Lake Store account +// management client. +type FirewallRulesClient struct { + ManagementClient +} + +// NewFirewallRulesClient creates an instance of the FirewallRulesClient +// client. +func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { + return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallRulesClientWithBaseURI creates an instance of the +// FirewallRulesClient client. +func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { + return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified firewall rule. During +// update, the firewall rule with the specified name will be replaced with this +// new firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account to add or replace the firewall rule. firewallRuleName is the name of +// the firewall rule to create or update. parameters is parameters supplied to +// create or update the firewall rule. +func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.FirewallRulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified firewall rule from the specified Data Lake +// Store account +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account from which to delete the firewall rule. firewallRuleName is the name +// of the firewall rule to delete. +func (client FirewallRulesClient) Delete(resourceGroupName string, accountName string, firewallRuleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, accountName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Data Lake Store firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account from which to get the firewall rule. firewallRuleName is the name of +// the firewall rule to retrieve. +func (client FirewallRulesClient) Get(resourceGroupName string, accountName string, firewallRuleName string) (result FirewallRule, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallRulesClient) GetPreparer(resourceGroupName string, accountName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccount lists the Data Lake Store firewall rules within the specified +// Data Lake Store account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account from which to get the firewall rules. +func (client FirewallRulesClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeStoreFirewallRuleListResult, err error) { + req, err := client.ListByAccountPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAccountPreparer prepares the ListByAccount request. +func (client FirewallRulesClient) ListByAccountPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAccountSender sends the ListByAccount request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAccountResponder handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) ListByAccountResponder(resp *http.Response) (result DataLakeStoreFirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccountNextResults retrieves the next set of results, if any. +func (client FirewallRulesClient) ListByAccountNextResults(lastResults DataLakeStoreFirewallRuleListResult) (result DataLakeStoreFirewallRuleListResult, err error) { + req, err := lastResults.DataLakeStoreFirewallRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "ListByAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specified firewall rule. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account to which to update the firewall rule. firewallRuleName is the name +// of the firewall rule to update. parameters is parameters supplied to update +// the firewall rule. +func (client FirewallRulesClient) Update(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (result FirewallRule, err error) { + req, err := client.UpdatePreparer(resourceGroupName, accountName, firewallRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.FirewallRulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FirewallRulesClient) UpdatePreparer(resourceGroupName string, accountName string, firewallRuleName string, parameters *UpdateFirewallRuleParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) UpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/models.go index cd9da1fc7a..c70781ff17 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/models.go @@ -1,370 +1,370 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/satori/uuid" - "net/http" -) - -// DataLakeStoreAccountState enumerates the values for data lake store account -// state. -type DataLakeStoreAccountState string - -const ( - // Active specifies the active state for data lake store account state. - Active DataLakeStoreAccountState = "Active" - // Suspended specifies the suspended state for data lake store account - // state. - Suspended DataLakeStoreAccountState = "Suspended" -) - -// DataLakeStoreAccountStatus enumerates the values for data lake store account -// status. -type DataLakeStoreAccountStatus string - -const ( - // Creating specifies the creating state for data lake store account - // status. - Creating DataLakeStoreAccountStatus = "Creating" - // Deleted specifies the deleted state for data lake store account status. - Deleted DataLakeStoreAccountStatus = "Deleted" - // Deleting specifies the deleting state for data lake store account - // status. - Deleting DataLakeStoreAccountStatus = "Deleting" - // Failed specifies the failed state for data lake store account status. - Failed DataLakeStoreAccountStatus = "Failed" - // Patching specifies the patching state for data lake store account - // status. - Patching DataLakeStoreAccountStatus = "Patching" - // Resuming specifies the resuming state for data lake store account - // status. - Resuming DataLakeStoreAccountStatus = "Resuming" - // Running specifies the running state for data lake store account status. - Running DataLakeStoreAccountStatus = "Running" - // Succeeded specifies the succeeded state for data lake store account - // status. - Succeeded DataLakeStoreAccountStatus = "Succeeded" - // Suspending specifies the suspending state for data lake store account - // status. - Suspending DataLakeStoreAccountStatus = "Suspending" -) - -// EncryptionConfigType enumerates the values for encryption config type. -type EncryptionConfigType string - -const ( - // ServiceManaged specifies the service managed state for encryption config - // type. - ServiceManaged EncryptionConfigType = "ServiceManaged" - // UserManaged specifies the user managed state for encryption config type. - UserManaged EncryptionConfigType = "UserManaged" -) - -// EncryptionProvisioningState enumerates the values for encryption -// provisioning state. -type EncryptionProvisioningState string - -const ( - // EncryptionProvisioningStateCreating specifies the encryption - // provisioning state creating state for encryption provisioning state. - EncryptionProvisioningStateCreating EncryptionProvisioningState = "Creating" - // EncryptionProvisioningStateSucceeded specifies the encryption - // provisioning state succeeded state for encryption provisioning state. - EncryptionProvisioningStateSucceeded EncryptionProvisioningState = "Succeeded" -) - -// EncryptionState enumerates the values for encryption state. -type EncryptionState string - -const ( - // Disabled specifies the disabled state for encryption state. - Disabled EncryptionState = "Disabled" - // Enabled specifies the enabled state for encryption state. - Enabled EncryptionState = "Enabled" -) - -// FirewallAllowAzureIpsState enumerates the values for firewall allow azure -// ips state. -type FirewallAllowAzureIpsState string - -const ( - // FirewallAllowAzureIpsStateDisabled specifies the firewall allow azure - // ips state disabled state for firewall allow azure ips state. - FirewallAllowAzureIpsStateDisabled FirewallAllowAzureIpsState = "Disabled" - // FirewallAllowAzureIpsStateEnabled specifies the firewall allow azure ips - // state enabled state for firewall allow azure ips state. - FirewallAllowAzureIpsStateEnabled FirewallAllowAzureIpsState = "Enabled" -) - -// FirewallState enumerates the values for firewall state. -type FirewallState string - -const ( - // FirewallStateDisabled specifies the firewall state disabled state for - // firewall state. - FirewallStateDisabled FirewallState = "Disabled" - // FirewallStateEnabled specifies the firewall state enabled state for - // firewall state. - FirewallStateEnabled FirewallState = "Enabled" -) - -// TierType enumerates the values for tier type. -type TierType string - -const ( - // Commitment100TB specifies the commitment 100tb state for tier type. - Commitment100TB TierType = "Commitment_100TB" - // Commitment10TB specifies the commitment 10tb state for tier type. - Commitment10TB TierType = "Commitment_10TB" - // Commitment1PB specifies the commitment 1pb state for tier type. - Commitment1PB TierType = "Commitment_1PB" - // Commitment1TB specifies the commitment 1tb state for tier type. - Commitment1TB TierType = "Commitment_1TB" - // Commitment500TB specifies the commitment 500tb state for tier type. - Commitment500TB TierType = "Commitment_500TB" - // Commitment5PB specifies the commitment 5pb state for tier type. - Commitment5PB TierType = "Commitment_5PB" - // Consumption specifies the consumption state for tier type. - Consumption TierType = "Consumption" -) - -// TrustedIDProviderState enumerates the values for trusted id provider state. -type TrustedIDProviderState string - -const ( - // TrustedIDProviderStateDisabled specifies the trusted id provider state - // disabled state for trusted id provider state. - TrustedIDProviderStateDisabled TrustedIDProviderState = "Disabled" - // TrustedIDProviderStateEnabled specifies the trusted id provider state - // enabled state for trusted id provider state. - TrustedIDProviderStateEnabled TrustedIDProviderState = "Enabled" -) - -// DataLakeStoreAccount is data Lake Store account information -type DataLakeStoreAccount struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Identity *EncryptionIdentity `json:"identity,omitempty"` - *DataLakeStoreAccountProperties `json:"properties,omitempty"` -} - -// DataLakeStoreAccountListResult is data Lake Store account list information -// response. -type DataLakeStoreAccountListResult struct { - autorest.Response `json:"-"` - Value *[]DataLakeStoreAccount `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeStoreAccountListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeStoreAccountListResult) DataLakeStoreAccountListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DataLakeStoreAccountProperties is data Lake Store account properties -// information -type DataLakeStoreAccountProperties struct { - ProvisioningState DataLakeStoreAccountStatus `json:"provisioningState,omitempty"` - State DataLakeStoreAccountState `json:"state,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - EncryptionState EncryptionState `json:"encryptionState,omitempty"` - EncryptionProvisioningState EncryptionProvisioningState `json:"encryptionProvisioningState,omitempty"` - EncryptionConfig *EncryptionConfig `json:"encryptionConfig,omitempty"` - FirewallState FirewallState `json:"firewallState,omitempty"` - FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` - TrustedIDProviderState TrustedIDProviderState `json:"trustedIdProviderState,omitempty"` - TrustedIDProviders *[]TrustedIDProvider `json:"trustedIdProviders,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - DefaultGroup *string `json:"defaultGroup,omitempty"` - NewTier TierType `json:"newTier,omitempty"` - CurrentTier TierType `json:"currentTier,omitempty"` - FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` -} - -// DataLakeStoreAccountUpdateParameters is data Lake Store account information -// to update -type DataLakeStoreAccountUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - *UpdateDataLakeStoreAccountProperties `json:"properties,omitempty"` -} - -// DataLakeStoreFirewallRuleListResult is data Lake Store firewall rule list -// information. -type DataLakeStoreFirewallRuleListResult struct { - autorest.Response `json:"-"` - Value *[]FirewallRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeStoreFirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeStoreFirewallRuleListResult) DataLakeStoreFirewallRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DataLakeStoreTrustedIDProviderListResult is data Lake Store trusted identity -// provider list information. -type DataLakeStoreTrustedIDProviderListResult struct { - autorest.Response `json:"-"` - Value *[]TrustedIDProvider `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataLakeStoreTrustedIDProviderListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataLakeStoreTrustedIDProviderListResult) DataLakeStoreTrustedIDProviderListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// EncryptionConfig is the encryption configuration for the account. -type EncryptionConfig struct { - Type EncryptionConfigType `json:"type,omitempty"` - KeyVaultMetaInfo *KeyVaultMetaInfo `json:"keyVaultMetaInfo,omitempty"` -} - -// EncryptionIdentity is the encryption identity properties. -type EncryptionIdentity struct { - Type *string `json:"type,omitempty"` - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ErrorDetails is data Lake Store error details information -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// FirewallRule is data Lake Store firewall rule information -type FirewallRule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *FirewallRuleProperties `json:"properties,omitempty"` -} - -// FirewallRuleProperties is data Lake Store firewall rule properties -// information -type FirewallRuleProperties struct { - StartIPAddress *string `json:"startIpAddress,omitempty"` - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// KeyVaultMetaInfo is metadata information used by account encryption. -type KeyVaultMetaInfo struct { - KeyVaultResourceID *string `json:"keyVaultResourceId,omitempty"` - EncryptionKeyName *string `json:"encryptionKeyName,omitempty"` - EncryptionKeyVersion *string `json:"encryptionKeyVersion,omitempty"` -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SubResource is the Resource model definition for a nested resource. -type SubResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// TrustedIDProvider is data Lake Store Trusted Identity Provider information -type TrustedIDProvider struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *TrustedIDProviderProperties `json:"properties,omitempty"` -} - -// TrustedIDProviderProperties is data Lake Store trusted identity provider -// properties information -type TrustedIDProviderProperties struct { - IDProvider *string `json:"idProvider,omitempty"` -} - -// UpdateDataLakeStoreAccountProperties is data Lake Store account properties -// information to be updated. -type UpdateDataLakeStoreAccountProperties struct { - FirewallState FirewallState `json:"firewallState,omitempty"` - TrustedIDProviderState TrustedIDProviderState `json:"trustedIdProviderState,omitempty"` - DefaultGroup *string `json:"defaultGroup,omitempty"` - NewTier TierType `json:"newTier,omitempty"` - FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` -} - -// UpdateFirewallRuleParameters is data Lake Analytics firewall rule update -// parameters -type UpdateFirewallRuleParameters struct { - *UpdateFirewallRuleProperties `json:"properties,omitempty"` -} - -// UpdateFirewallRuleProperties is data Lake Analytics firewall rule properties -// information -type UpdateFirewallRuleProperties struct { - StartIPAddress *string `json:"startIpAddress,omitempty"` - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// UpdateTrustedIDProviderParameters is data Lake Store Trusted Identity -// Provider update parameters -type UpdateTrustedIDProviderParameters struct { - *UpdateTrustedIDProviderProperties `json:"properties,omitempty"` -} - -// UpdateTrustedIDProviderProperties is data Lake Store trusted identity -// provider property update information -type UpdateTrustedIDProviderProperties struct { - IDProvider *string `json:"idProvider,omitempty"` -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" + "net/http" +) + +// DataLakeStoreAccountState enumerates the values for data lake store account +// state. +type DataLakeStoreAccountState string + +const ( + // Active specifies the active state for data lake store account state. + Active DataLakeStoreAccountState = "Active" + // Suspended specifies the suspended state for data lake store account + // state. + Suspended DataLakeStoreAccountState = "Suspended" +) + +// DataLakeStoreAccountStatus enumerates the values for data lake store account +// status. +type DataLakeStoreAccountStatus string + +const ( + // Creating specifies the creating state for data lake store account + // status. + Creating DataLakeStoreAccountStatus = "Creating" + // Deleted specifies the deleted state for data lake store account status. + Deleted DataLakeStoreAccountStatus = "Deleted" + // Deleting specifies the deleting state for data lake store account + // status. + Deleting DataLakeStoreAccountStatus = "Deleting" + // Failed specifies the failed state for data lake store account status. + Failed DataLakeStoreAccountStatus = "Failed" + // Patching specifies the patching state for data lake store account + // status. + Patching DataLakeStoreAccountStatus = "Patching" + // Resuming specifies the resuming state for data lake store account + // status. + Resuming DataLakeStoreAccountStatus = "Resuming" + // Running specifies the running state for data lake store account status. + Running DataLakeStoreAccountStatus = "Running" + // Succeeded specifies the succeeded state for data lake store account + // status. + Succeeded DataLakeStoreAccountStatus = "Succeeded" + // Suspending specifies the suspending state for data lake store account + // status. + Suspending DataLakeStoreAccountStatus = "Suspending" +) + +// EncryptionConfigType enumerates the values for encryption config type. +type EncryptionConfigType string + +const ( + // ServiceManaged specifies the service managed state for encryption config + // type. + ServiceManaged EncryptionConfigType = "ServiceManaged" + // UserManaged specifies the user managed state for encryption config type. + UserManaged EncryptionConfigType = "UserManaged" +) + +// EncryptionProvisioningState enumerates the values for encryption +// provisioning state. +type EncryptionProvisioningState string + +const ( + // EncryptionProvisioningStateCreating specifies the encryption + // provisioning state creating state for encryption provisioning state. + EncryptionProvisioningStateCreating EncryptionProvisioningState = "Creating" + // EncryptionProvisioningStateSucceeded specifies the encryption + // provisioning state succeeded state for encryption provisioning state. + EncryptionProvisioningStateSucceeded EncryptionProvisioningState = "Succeeded" +) + +// EncryptionState enumerates the values for encryption state. +type EncryptionState string + +const ( + // Disabled specifies the disabled state for encryption state. + Disabled EncryptionState = "Disabled" + // Enabled specifies the enabled state for encryption state. + Enabled EncryptionState = "Enabled" +) + +// FirewallAllowAzureIpsState enumerates the values for firewall allow azure +// ips state. +type FirewallAllowAzureIpsState string + +const ( + // FirewallAllowAzureIpsStateDisabled specifies the firewall allow azure + // ips state disabled state for firewall allow azure ips state. + FirewallAllowAzureIpsStateDisabled FirewallAllowAzureIpsState = "Disabled" + // FirewallAllowAzureIpsStateEnabled specifies the firewall allow azure ips + // state enabled state for firewall allow azure ips state. + FirewallAllowAzureIpsStateEnabled FirewallAllowAzureIpsState = "Enabled" +) + +// FirewallState enumerates the values for firewall state. +type FirewallState string + +const ( + // FirewallStateDisabled specifies the firewall state disabled state for + // firewall state. + FirewallStateDisabled FirewallState = "Disabled" + // FirewallStateEnabled specifies the firewall state enabled state for + // firewall state. + FirewallStateEnabled FirewallState = "Enabled" +) + +// TierType enumerates the values for tier type. +type TierType string + +const ( + // Commitment100TB specifies the commitment 100tb state for tier type. + Commitment100TB TierType = "Commitment_100TB" + // Commitment10TB specifies the commitment 10tb state for tier type. + Commitment10TB TierType = "Commitment_10TB" + // Commitment1PB specifies the commitment 1pb state for tier type. + Commitment1PB TierType = "Commitment_1PB" + // Commitment1TB specifies the commitment 1tb state for tier type. + Commitment1TB TierType = "Commitment_1TB" + // Commitment500TB specifies the commitment 500tb state for tier type. + Commitment500TB TierType = "Commitment_500TB" + // Commitment5PB specifies the commitment 5pb state for tier type. + Commitment5PB TierType = "Commitment_5PB" + // Consumption specifies the consumption state for tier type. + Consumption TierType = "Consumption" +) + +// TrustedIDProviderState enumerates the values for trusted id provider state. +type TrustedIDProviderState string + +const ( + // TrustedIDProviderStateDisabled specifies the trusted id provider state + // disabled state for trusted id provider state. + TrustedIDProviderStateDisabled TrustedIDProviderState = "Disabled" + // TrustedIDProviderStateEnabled specifies the trusted id provider state + // enabled state for trusted id provider state. + TrustedIDProviderStateEnabled TrustedIDProviderState = "Enabled" +) + +// DataLakeStoreAccount is data Lake Store account information +type DataLakeStoreAccount struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Identity *EncryptionIdentity `json:"identity,omitempty"` + *DataLakeStoreAccountProperties `json:"properties,omitempty"` +} + +// DataLakeStoreAccountListResult is data Lake Store account list information +// response. +type DataLakeStoreAccountListResult struct { + autorest.Response `json:"-"` + Value *[]DataLakeStoreAccount `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeStoreAccountListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeStoreAccountListResult) DataLakeStoreAccountListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DataLakeStoreAccountProperties is data Lake Store account properties +// information +type DataLakeStoreAccountProperties struct { + ProvisioningState DataLakeStoreAccountStatus `json:"provisioningState,omitempty"` + State DataLakeStoreAccountState `json:"state,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + EncryptionState EncryptionState `json:"encryptionState,omitempty"` + EncryptionProvisioningState EncryptionProvisioningState `json:"encryptionProvisioningState,omitempty"` + EncryptionConfig *EncryptionConfig `json:"encryptionConfig,omitempty"` + FirewallState FirewallState `json:"firewallState,omitempty"` + FirewallRules *[]FirewallRule `json:"firewallRules,omitempty"` + TrustedIDProviderState TrustedIDProviderState `json:"trustedIdProviderState,omitempty"` + TrustedIDProviders *[]TrustedIDProvider `json:"trustedIdProviders,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + DefaultGroup *string `json:"defaultGroup,omitempty"` + NewTier TierType `json:"newTier,omitempty"` + CurrentTier TierType `json:"currentTier,omitempty"` + FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` +} + +// DataLakeStoreAccountUpdateParameters is data Lake Store account information +// to update +type DataLakeStoreAccountUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + *UpdateDataLakeStoreAccountProperties `json:"properties,omitempty"` +} + +// DataLakeStoreFirewallRuleListResult is data Lake Store firewall rule list +// information. +type DataLakeStoreFirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeStoreFirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeStoreFirewallRuleListResult) DataLakeStoreFirewallRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DataLakeStoreTrustedIDProviderListResult is data Lake Store trusted identity +// provider list information. +type DataLakeStoreTrustedIDProviderListResult struct { + autorest.Response `json:"-"` + Value *[]TrustedIDProvider `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataLakeStoreTrustedIDProviderListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataLakeStoreTrustedIDProviderListResult) DataLakeStoreTrustedIDProviderListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// EncryptionConfig is the encryption configuration for the account. +type EncryptionConfig struct { + Type EncryptionConfigType `json:"type,omitempty"` + KeyVaultMetaInfo *KeyVaultMetaInfo `json:"keyVaultMetaInfo,omitempty"` +} + +// EncryptionIdentity is the encryption identity properties. +type EncryptionIdentity struct { + Type *string `json:"type,omitempty"` + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + TenantID *uuid.UUID `json:"tenantId,omitempty"` +} + +// ErrorDetails is data Lake Store error details information +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} + +// FirewallRule is data Lake Store firewall rule information +type FirewallRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *FirewallRuleProperties `json:"properties,omitempty"` +} + +// FirewallRuleProperties is data Lake Store firewall rule properties +// information +type FirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// KeyVaultMetaInfo is metadata information used by account encryption. +type KeyVaultMetaInfo struct { + KeyVaultResourceID *string `json:"keyVaultResourceId,omitempty"` + EncryptionKeyName *string `json:"encryptionKeyName,omitempty"` + EncryptionKeyVersion *string `json:"encryptionKeyVersion,omitempty"` +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SubResource is the Resource model definition for a nested resource. +type SubResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// TrustedIDProvider is data Lake Store Trusted Identity Provider information +type TrustedIDProvider struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *TrustedIDProviderProperties `json:"properties,omitempty"` +} + +// TrustedIDProviderProperties is data Lake Store trusted identity provider +// properties information +type TrustedIDProviderProperties struct { + IDProvider *string `json:"idProvider,omitempty"` +} + +// UpdateDataLakeStoreAccountProperties is data Lake Store account properties +// information to be updated. +type UpdateDataLakeStoreAccountProperties struct { + FirewallState FirewallState `json:"firewallState,omitempty"` + TrustedIDProviderState TrustedIDProviderState `json:"trustedIdProviderState,omitempty"` + DefaultGroup *string `json:"defaultGroup,omitempty"` + NewTier TierType `json:"newTier,omitempty"` + FirewallAllowAzureIps FirewallAllowAzureIpsState `json:"firewallAllowAzureIps,omitempty"` +} + +// UpdateFirewallRuleParameters is data Lake Analytics firewall rule update +// parameters +type UpdateFirewallRuleParameters struct { + *UpdateFirewallRuleProperties `json:"properties,omitempty"` +} + +// UpdateFirewallRuleProperties is data Lake Analytics firewall rule properties +// information +type UpdateFirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// UpdateTrustedIDProviderParameters is data Lake Store Trusted Identity +// Provider update parameters +type UpdateTrustedIDProviderParameters struct { + *UpdateTrustedIDProviderProperties `json:"properties,omitempty"` +} + +// UpdateTrustedIDProviderProperties is data Lake Store trusted identity +// provider property update information +type UpdateTrustedIDProviderProperties struct { + IDProvider *string `json:"idProvider,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/trustedidproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/trustedidproviders.go index fc223e6709..9411268b32 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/trustedidproviders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/trustedidproviders.go @@ -1,434 +1,434 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TrustedIDProvidersClient is the creates an Azure Data Lake Store account -// management client. -type TrustedIDProvidersClient struct { - ManagementClient -} - -// NewTrustedIDProvidersClient creates an instance of the -// TrustedIDProvidersClient client. -func NewTrustedIDProvidersClient(subscriptionID string) TrustedIDProvidersClient { - return NewTrustedIDProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTrustedIDProvidersClientWithBaseURI creates an instance of the -// TrustedIDProvidersClient client. -func NewTrustedIDProvidersClientWithBaseURI(baseURI string, subscriptionID string) TrustedIDProvidersClient { - return TrustedIDProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates the specified trusted identity provider. -// During update, the trusted identity provider with the specified name will be -// replaced with this new provider -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account to add or replace the trusted identity provider. -// trustedIDProviderName is the name of the trusted identity provider. This is -// used for differentiation of providers in the account. parameters is -// parameters supplied to create or replace the trusted identity provider. -func (client TrustedIDProvidersClient) CreateOrUpdate(resourceGroupName string, accountName string, trustedIDProviderName string, parameters TrustedIDProvider) (result TrustedIDProvider, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TrustedIDProviderProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TrustedIDProviderProperties.IDProvider", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, trustedIDProviderName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TrustedIDProvidersClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, trustedIDProviderName string, parameters TrustedIDProvider) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TrustedIDProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TrustedIDProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result TrustedIDProvider, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified trusted identity provider from the specified -// Data Lake Store account -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account from which to delete the trusted identity provider. -// trustedIDProviderName is the name of the trusted identity provider to -// delete. -func (client TrustedIDProvidersClient) Delete(resourceGroupName string, accountName string, trustedIDProviderName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, accountName, trustedIDProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TrustedIDProvidersClient) DeletePreparer(resourceGroupName string, accountName string, trustedIDProviderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TrustedIDProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TrustedIDProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Data Lake Store trusted identity provider. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account from which to get the trusted identity provider. -// trustedIDProviderName is the name of the trusted identity provider to -// retrieve. -func (client TrustedIDProvidersClient) Get(resourceGroupName string, accountName string, trustedIDProviderName string) (result TrustedIDProvider, err error) { - req, err := client.GetPreparer(resourceGroupName, accountName, trustedIDProviderName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TrustedIDProvidersClient) GetPreparer(resourceGroupName string, accountName string, trustedIDProviderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TrustedIDProvidersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TrustedIDProvidersClient) GetResponder(resp *http.Response) (result TrustedIDProvider, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount lists the Data Lake Store trusted identity providers within -// the specified Data Lake Store account. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account from which to get the trusted identity providers. -func (client TrustedIDProvidersClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeStoreTrustedIDProviderListResult, err error) { - req, err := client.ListByAccountPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure responding to request") - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client TrustedIDProvidersClient) ListByAccountPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client TrustedIDProvidersClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client TrustedIDProvidersClient) ListByAccountResponder(resp *http.Response) (result DataLakeStoreTrustedIDProviderListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccountNextResults retrieves the next set of results, if any. -func (client TrustedIDProvidersClient) ListByAccountNextResults(lastResults DataLakeStoreTrustedIDProviderListResult) (result DataLakeStoreTrustedIDProviderListResult, err error) { - req, err := lastResults.DataLakeStoreTrustedIDProviderListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure sending next results request") - } - - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure responding to next results request") - } - - return -} - -// Update updates the specified trusted identity provider. -// -// resourceGroupName is the name of the Azure resource group that contains the -// Data Lake Store account. accountName is the name of the Data Lake Store -// account to which to update the trusted identity provider. -// trustedIDProviderName is the name of the trusted identity provider. This is -// used for differentiation of providers in the account. parameters is -// parameters supplied to update the trusted identity provider. -func (client TrustedIDProvidersClient) Update(resourceGroupName string, accountName string, trustedIDProviderName string, parameters *UpdateTrustedIDProviderParameters) (result TrustedIDProvider, err error) { - req, err := client.UpdatePreparer(resourceGroupName, accountName, trustedIDProviderName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TrustedIDProvidersClient) UpdatePreparer(resourceGroupName string, accountName string, trustedIDProviderName string, parameters *UpdateTrustedIDProviderParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client TrustedIDProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TrustedIDProvidersClient) UpdateResponder(resp *http.Response) (result TrustedIDProvider, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TrustedIDProvidersClient is the creates an Azure Data Lake Store account +// management client. +type TrustedIDProvidersClient struct { + ManagementClient +} + +// NewTrustedIDProvidersClient creates an instance of the +// TrustedIDProvidersClient client. +func NewTrustedIDProvidersClient(subscriptionID string) TrustedIDProvidersClient { + return NewTrustedIDProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTrustedIDProvidersClientWithBaseURI creates an instance of the +// TrustedIDProvidersClient client. +func NewTrustedIDProvidersClientWithBaseURI(baseURI string, subscriptionID string) TrustedIDProvidersClient { + return TrustedIDProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified trusted identity provider. +// During update, the trusted identity provider with the specified name will be +// replaced with this new provider +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account to add or replace the trusted identity provider. +// trustedIDProviderName is the name of the trusted identity provider. This is +// used for differentiation of providers in the account. parameters is +// parameters supplied to create or replace the trusted identity provider. +func (client TrustedIDProvidersClient) CreateOrUpdate(resourceGroupName string, accountName string, trustedIDProviderName string, parameters TrustedIDProvider) (result TrustedIDProvider, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TrustedIDProviderProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.TrustedIDProviderProperties.IDProvider", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, trustedIDProviderName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TrustedIDProvidersClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, trustedIDProviderName string, parameters TrustedIDProvider) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TrustedIDProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TrustedIDProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result TrustedIDProvider, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified trusted identity provider from the specified +// Data Lake Store account +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account from which to delete the trusted identity provider. +// trustedIDProviderName is the name of the trusted identity provider to +// delete. +func (client TrustedIDProvidersClient) Delete(resourceGroupName string, accountName string, trustedIDProviderName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, accountName, trustedIDProviderName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TrustedIDProvidersClient) DeletePreparer(resourceGroupName string, accountName string, trustedIDProviderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TrustedIDProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TrustedIDProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Data Lake Store trusted identity provider. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account from which to get the trusted identity provider. +// trustedIDProviderName is the name of the trusted identity provider to +// retrieve. +func (client TrustedIDProvidersClient) Get(resourceGroupName string, accountName string, trustedIDProviderName string) (result TrustedIDProvider, err error) { + req, err := client.GetPreparer(resourceGroupName, accountName, trustedIDProviderName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TrustedIDProvidersClient) GetPreparer(resourceGroupName string, accountName string, trustedIDProviderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TrustedIDProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TrustedIDProvidersClient) GetResponder(resp *http.Response) (result TrustedIDProvider, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccount lists the Data Lake Store trusted identity providers within +// the specified Data Lake Store account. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account from which to get the trusted identity providers. +func (client TrustedIDProvidersClient) ListByAccount(resourceGroupName string, accountName string) (result DataLakeStoreTrustedIDProviderListResult, err error) { + req, err := client.ListByAccountPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure responding to request") + } + + return +} + +// ListByAccountPreparer prepares the ListByAccount request. +func (client TrustedIDProvidersClient) ListByAccountPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAccountSender sends the ListByAccount request. The method will close the +// http.Response Body if it receives an error. +func (client TrustedIDProvidersClient) ListByAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAccountResponder handles the response to the ListByAccount request. The method always +// closes the http.Response Body. +func (client TrustedIDProvidersClient) ListByAccountResponder(resp *http.Response) (result DataLakeStoreTrustedIDProviderListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAccountNextResults retrieves the next set of results, if any. +func (client TrustedIDProvidersClient) ListByAccountNextResults(lastResults DataLakeStoreTrustedIDProviderListResult) (result DataLakeStoreTrustedIDProviderListResult, err error) { + req, err := lastResults.DataLakeStoreTrustedIDProviderListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure sending next results request") + } + + result, err = client.ListByAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "ListByAccount", resp, "Failure responding to next results request") + } + + return +} + +// Update updates the specified trusted identity provider. +// +// resourceGroupName is the name of the Azure resource group that contains the +// Data Lake Store account. accountName is the name of the Data Lake Store +// account to which to update the trusted identity provider. +// trustedIDProviderName is the name of the trusted identity provider. This is +// used for differentiation of providers in the account. parameters is +// parameters supplied to update the trusted identity provider. +func (client TrustedIDProvidersClient) Update(resourceGroupName string, accountName string, trustedIDProviderName string, parameters *UpdateTrustedIDProviderParameters) (result TrustedIDProvider, err error) { + req, err := client.UpdatePreparer(resourceGroupName, accountName, trustedIDProviderName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "account.TrustedIDProvidersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TrustedIDProvidersClient) UpdatePreparer(resourceGroupName string, accountName string, trustedIDProviderName string, parameters *UpdateTrustedIDProviderParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "trustedIdProviderName": autorest.Encode("path", trustedIDProviderName), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client TrustedIDProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TrustedIDProvidersClient) UpdateResponder(resp *http.Response) (result TrustedIDProvider, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/version.go index 8b6cfe7e8e..5d627a4dce 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/datalake-store/account/version.go @@ -1,29 +1,29 @@ -package account - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-account/2016-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package account + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-account/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/armtemplates.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/armtemplates.go index f9574515dc..1e017dc103 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/armtemplates.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/armtemplates.go @@ -1,221 +1,221 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ArmTemplatesClient is the the DevTest Labs Client. -type ArmTemplatesClient struct { - ManagementClient -} - -// NewArmTemplatesClient creates an instance of the ArmTemplatesClient client. -func NewArmTemplatesClient(subscriptionID string) ArmTemplatesClient { - return NewArmTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewArmTemplatesClientWithBaseURI creates an instance of the -// ArmTemplatesClient client. -func NewArmTemplatesClientWithBaseURI(baseURI string, subscriptionID string) ArmTemplatesClient { - return ArmTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get azure resource manager template. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. artifactSourceName is the name of the artifact source. name is the -// name of the azure Resource Manager template. expand is specify the $expand -// query. Example: 'properties($select=displayName)' -func (client ArmTemplatesClient) Get(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result ArmTemplate, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, artifactSourceName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ArmTemplatesClient) GetPreparer(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ArmTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ArmTemplatesClient) GetResponder(resp *http.Response) (result ArmTemplate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list azure resource manager templates in a given artifact source. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. artifactSourceName is the name of the artifact source. expand is -// specify the $expand query. Example: 'properties($select=displayName)' filter -// is the filter to apply to the operation. top is the maximum number of -// resources to return from the operation. orderby is the ordering expression -// for the results, using OData notation. -func (client ArmTemplatesClient) List(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArmTemplate, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ArmTemplatesClient) ListPreparer(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ArmTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ArmTemplatesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArmTemplate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ArmTemplatesClient) ListNextResults(lastResults ResponseWithContinuationArmTemplate) (result ResponseWithContinuationArmTemplate, err error) { - req, err := lastResults.ResponseWithContinuationArmTemplatePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ArmTemplatesClient is the the DevTest Labs Client. +type ArmTemplatesClient struct { + ManagementClient +} + +// NewArmTemplatesClient creates an instance of the ArmTemplatesClient client. +func NewArmTemplatesClient(subscriptionID string) ArmTemplatesClient { + return NewArmTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArmTemplatesClientWithBaseURI creates an instance of the +// ArmTemplatesClient client. +func NewArmTemplatesClientWithBaseURI(baseURI string, subscriptionID string) ArmTemplatesClient { + return ArmTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get azure resource manager template. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. artifactSourceName is the name of the artifact source. name is the +// name of the azure Resource Manager template. expand is specify the $expand +// query. Example: 'properties($select=displayName)' +func (client ArmTemplatesClient) Get(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result ArmTemplate, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, artifactSourceName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArmTemplatesClient) GetPreparer(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArmTemplatesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ArmTemplatesClient) GetResponder(resp *http.Response) (result ArmTemplate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list azure resource manager templates in a given artifact source. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. artifactSourceName is the name of the artifact source. expand is +// specify the $expand query. Example: 'properties($select=displayName)' filter +// is the filter to apply to the operation. top is the maximum number of +// resources to return from the operation. orderby is the ordering expression +// for the results, using OData notation. +func (client ArmTemplatesClient) List(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArmTemplate, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ArmTemplatesClient) ListPreparer(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ArmTemplatesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ArmTemplatesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArmTemplate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ArmTemplatesClient) ListNextResults(lastResults ResponseWithContinuationArmTemplate) (result ResponseWithContinuationArmTemplate, err error) { + req, err := lastResults.ResponseWithContinuationArmTemplatePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArmTemplatesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifacts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifacts.go index 3e393cdc0f..eaed0a1aa6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifacts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifacts.go @@ -1,295 +1,295 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ArtifactsClient is the the DevTest Labs Client. -type ArtifactsClient struct { - ManagementClient -} - -// NewArtifactsClient creates an instance of the ArtifactsClient client. -func NewArtifactsClient(subscriptionID string) ArtifactsClient { - return NewArtifactsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewArtifactsClientWithBaseURI creates an instance of the ArtifactsClient -// client. -func NewArtifactsClientWithBaseURI(baseURI string, subscriptionID string) ArtifactsClient { - return ArtifactsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GenerateArmTemplate generates an ARM template for the given artifact, -// uploads the required files to a storage account, and validates the generated -// artifact. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. artifactSourceName is the name of the artifact source. name is the -// name of the artifact. generateArmTemplateRequest is parameters for -// generating an ARM template for deploying artifacts. -func (client ArtifactsClient) GenerateArmTemplate(resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (result ArmTemplateInfo, err error) { - req, err := client.GenerateArmTemplatePreparer(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "GenerateArmTemplate", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateArmTemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "GenerateArmTemplate", resp, "Failure sending request") - return - } - - result, err = client.GenerateArmTemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "GenerateArmTemplate", resp, "Failure responding to request") - } - - return -} - -// GenerateArmTemplatePreparer prepares the GenerateArmTemplate request. -func (client ArtifactsClient) GenerateArmTemplatePreparer(resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate", pathParameters), - autorest.WithJSON(generateArmTemplateRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateArmTemplateSender sends the GenerateArmTemplate request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactsClient) GenerateArmTemplateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateArmTemplateResponder handles the response to the GenerateArmTemplate request. The method always -// closes the http.Response Body. -func (client ArtifactsClient) GenerateArmTemplateResponder(resp *http.Response) (result ArmTemplateInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get artifact. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. artifactSourceName is the name of the artifact source. name is the -// name of the artifact. expand is specify the $expand query. Example: -// 'properties($select=title)' -func (client ArtifactsClient) Get(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result Artifact, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, artifactSourceName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ArtifactsClient) GetPreparer(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ArtifactsClient) GetResponder(resp *http.Response) (result Artifact, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list artifacts in a given artifact source. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. artifactSourceName is the name of the artifact source. expand is -// specify the $expand query. Example: 'properties($select=title)' filter is -// the filter to apply to the operation. top is the maximum number of resources -// to return from the operation. orderby is the ordering expression for the -// results, using OData notation. -func (client ArtifactsClient) List(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifact, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ArtifactsClient) ListPreparer(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "artifactSourceName": autorest.Encode("path", artifactSourceName), - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ArtifactsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArtifact, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ArtifactsClient) ListNextResults(lastResults ResponseWithContinuationArtifact) (result ResponseWithContinuationArtifact, err error) { - req, err := lastResults.ResponseWithContinuationArtifactPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ArtifactsClient is the the DevTest Labs Client. +type ArtifactsClient struct { + ManagementClient +} + +// NewArtifactsClient creates an instance of the ArtifactsClient client. +func NewArtifactsClient(subscriptionID string) ArtifactsClient { + return NewArtifactsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArtifactsClientWithBaseURI creates an instance of the ArtifactsClient +// client. +func NewArtifactsClientWithBaseURI(baseURI string, subscriptionID string) ArtifactsClient { + return ArtifactsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GenerateArmTemplate generates an ARM template for the given artifact, +// uploads the required files to a storage account, and validates the generated +// artifact. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. artifactSourceName is the name of the artifact source. name is the +// name of the artifact. generateArmTemplateRequest is parameters for +// generating an ARM template for deploying artifacts. +func (client ArtifactsClient) GenerateArmTemplate(resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (result ArmTemplateInfo, err error) { + req, err := client.GenerateArmTemplatePreparer(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "GenerateArmTemplate", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateArmTemplateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "GenerateArmTemplate", resp, "Failure sending request") + return + } + + result, err = client.GenerateArmTemplateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "GenerateArmTemplate", resp, "Failure responding to request") + } + + return +} + +// GenerateArmTemplatePreparer prepares the GenerateArmTemplate request. +func (client ArtifactsClient) GenerateArmTemplatePreparer(resourceGroupName string, labName string, artifactSourceName string, name string, generateArmTemplateRequest GenerateArmTemplateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate", pathParameters), + autorest.WithJSON(generateArmTemplateRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateArmTemplateSender sends the GenerateArmTemplate request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactsClient) GenerateArmTemplateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateArmTemplateResponder handles the response to the GenerateArmTemplate request. The method always +// closes the http.Response Body. +func (client ArtifactsClient) GenerateArmTemplateResponder(resp *http.Response) (result ArmTemplateInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get artifact. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. artifactSourceName is the name of the artifact source. name is the +// name of the artifact. expand is specify the $expand query. Example: +// 'properties($select=title)' +func (client ArtifactsClient) Get(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (result Artifact, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, artifactSourceName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArtifactsClient) GetPreparer(resourceGroupName string, labName string, artifactSourceName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ArtifactsClient) GetResponder(resp *http.Response) (result Artifact, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list artifacts in a given artifact source. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. artifactSourceName is the name of the artifact source. expand is +// specify the $expand query. Example: 'properties($select=title)' filter is +// the filter to apply to the operation. top is the maximum number of resources +// to return from the operation. orderby is the ordering expression for the +// results, using OData notation. +func (client ArtifactsClient) List(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifact, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ArtifactsClient) ListPreparer(resourceGroupName string, labName string, artifactSourceName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "artifactSourceName": autorest.Encode("path", artifactSourceName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ArtifactsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArtifact, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ArtifactsClient) ListNextResults(lastResults ResponseWithContinuationArtifact) (result ResponseWithContinuationArtifact, err error) { + req, err := lastResults.ResponseWithContinuationArtifactPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifactsources.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifactsources.go index 7b4fd99191..20b7306a45 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifactsources.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/artifactsources.go @@ -1,432 +1,432 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ArtifactSourcesClient is the the DevTest Labs Client. -type ArtifactSourcesClient struct { - ManagementClient -} - -// NewArtifactSourcesClient creates an instance of the ArtifactSourcesClient -// client. -func NewArtifactSourcesClient(subscriptionID string) ArtifactSourcesClient { - return NewArtifactSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewArtifactSourcesClientWithBaseURI creates an instance of the -// ArtifactSourcesClient client. -func NewArtifactSourcesClientWithBaseURI(baseURI string, subscriptionID string) ArtifactSourcesClient { - return ArtifactSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing artifact source. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the artifact source. artifactSource is -// properties of an artifact source. -func (client ArtifactSourcesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (result ArtifactSource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: artifactSource, - Constraints: []validation.Constraint{{Target: "artifactSource.ArtifactSourceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, artifactSource) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ArtifactSourcesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithJSON(artifactSource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ArtifactSource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete artifact source. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the artifact source. -func (client ArtifactSourcesClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ArtifactSourcesClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get artifact source. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the artifact source. expand is specify the -// $expand query. Example: 'properties($select=displayName)' -func (client ArtifactSourcesClient) Get(resourceGroupName string, labName string, name string, expand string) (result ArtifactSource, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ArtifactSourcesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) GetResponder(resp *http.Response) (result ArtifactSource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list artifact sources in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=displayName)' filter is the filter to apply to the -// operation. top is the maximum number of resources to return from the -// operation. orderby is the ordering expression for the results, using OData -// notation. -func (client ArtifactSourcesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifactSource, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ArtifactSourcesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArtifactSource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ArtifactSourcesClient) ListNextResults(lastResults ResponseWithContinuationArtifactSource) (result ResponseWithContinuationArtifactSource, err error) { - req, err := lastResults.ResponseWithContinuationArtifactSourcePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of artifact sources. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the artifact source. artifactSource is -// properties of an artifact source. -func (client ArtifactSourcesClient) Update(resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (result ArtifactSource, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, name, artifactSource) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ArtifactSourcesClient) UpdatePreparer(resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), - autorest.WithJSON(artifactSource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ArtifactSourcesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ArtifactSourcesClient) UpdateResponder(resp *http.Response) (result ArtifactSource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ArtifactSourcesClient is the the DevTest Labs Client. +type ArtifactSourcesClient struct { + ManagementClient +} + +// NewArtifactSourcesClient creates an instance of the ArtifactSourcesClient +// client. +func NewArtifactSourcesClient(subscriptionID string) ArtifactSourcesClient { + return NewArtifactSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewArtifactSourcesClientWithBaseURI creates an instance of the +// ArtifactSourcesClient client. +func NewArtifactSourcesClientWithBaseURI(baseURI string, subscriptionID string) ArtifactSourcesClient { + return ArtifactSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing artifact source. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the artifact source. artifactSource is +// properties of an artifact source. +func (client ArtifactSourcesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (result ArtifactSource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: artifactSource, + Constraints: []validation.Constraint{{Target: "artifactSource.ArtifactSourceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, artifactSource) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ArtifactSourcesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, artifactSource ArtifactSource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithJSON(artifactSource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ArtifactSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ArtifactSource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete artifact source. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the artifact source. +func (client ArtifactSourcesClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ArtifactSourcesClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ArtifactSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get artifact source. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the artifact source. expand is specify the +// $expand query. Example: 'properties($select=displayName)' +func (client ArtifactSourcesClient) Get(resourceGroupName string, labName string, name string, expand string) (result ArtifactSource, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ArtifactSourcesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ArtifactSourcesClient) GetResponder(resp *http.Response) (result ArtifactSource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list artifact sources in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=displayName)' filter is the filter to apply to the +// operation. top is the maximum number of resources to return from the +// operation. orderby is the ordering expression for the results, using OData +// notation. +func (client ArtifactSourcesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationArtifactSource, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ArtifactSourcesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ArtifactSourcesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationArtifactSource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ArtifactSourcesClient) ListNextResults(lastResults ResponseWithContinuationArtifactSource) (result ResponseWithContinuationArtifactSource, err error) { + req, err := lastResults.ResponseWithContinuationArtifactSourcePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of artifact sources. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the artifact source. artifactSource is +// properties of an artifact source. +func (client ArtifactSourcesClient) Update(resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (result ArtifactSource, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, name, artifactSource) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ArtifactSourcesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ArtifactSourcesClient) UpdatePreparer(resourceGroupName string, labName string, name string, artifactSource ArtifactSourceFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", pathParameters), + autorest.WithJSON(artifactSource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ArtifactSourcesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ArtifactSourcesClient) UpdateResponder(resp *http.Response) (result ArtifactSource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/client.go index e63efc45d5..65e59fad01 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/client.go @@ -1,53 +1,53 @@ -// Package devtestlabs implements the Azure ARM Devtestlabs service API version -// 2016-05-15. -// -// The DevTest Labs Client. -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Devtestlabs - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Devtestlabs. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package devtestlabs implements the Azure ARM Devtestlabs service API version +// 2016-05-15. +// +// The DevTest Labs Client. +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Devtestlabs + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Devtestlabs. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/costs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/costs.go index e549e0e305..0e4dcc2566 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/costs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/costs.go @@ -1,187 +1,187 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CostsClient is the the DevTest Labs Client. -type CostsClient struct { - ManagementClient -} - -// NewCostsClient creates an instance of the CostsClient client. -func NewCostsClient(subscriptionID string) CostsClient { - return NewCostsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCostsClientWithBaseURI creates an instance of the CostsClient client. -func NewCostsClientWithBaseURI(baseURI string, subscriptionID string) CostsClient { - return CostsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing cost. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the cost. labCost is a cost item. -func (client CostsClient) CreateOrUpdate(resourceGroupName string, labName string, name string, labCost LabCost) (result LabCost, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: labCost, - Constraints: []validation.Constraint{{Target: "labCost.LabCostProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.CostsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, labCost) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CostsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, labCost LabCost) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), - autorest.WithJSON(labCost), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CostsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CostsClient) CreateOrUpdateResponder(resp *http.Response) (result LabCost, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get cost. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the cost. expand is specify the $expand query. -// Example: 'properties($expand=labCostDetails)' -func (client CostsClient) Get(resourceGroupName string, labName string, name string, expand string) (result LabCost, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CostsClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CostsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CostsClient) GetResponder(resp *http.Response) (result LabCost, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CostsClient is the the DevTest Labs Client. +type CostsClient struct { + ManagementClient +} + +// NewCostsClient creates an instance of the CostsClient client. +func NewCostsClient(subscriptionID string) CostsClient { + return NewCostsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCostsClientWithBaseURI creates an instance of the CostsClient client. +func NewCostsClientWithBaseURI(baseURI string, subscriptionID string) CostsClient { + return CostsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing cost. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the cost. labCost is a cost item. +func (client CostsClient) CreateOrUpdate(resourceGroupName string, labName string, name string, labCost LabCost) (result LabCost, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: labCost, + Constraints: []validation.Constraint{{Target: "labCost.LabCostProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.CostsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, labCost) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CostsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, labCost LabCost) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), + autorest.WithJSON(labCost), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CostsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CostsClient) CreateOrUpdateResponder(resp *http.Response) (result LabCost, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get cost. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the cost. expand is specify the $expand query. +// Example: 'properties($expand=labCostDetails)' +func (client CostsClient) Get(resourceGroupName string, labName string, name string, expand string) (result LabCost, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CostsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CostsClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CostsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CostsClient) GetResponder(resp *http.Response) (result LabCost, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/customimages.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/customimages.go index 5b403010fb..7cfdd5715c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/customimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/customimages.go @@ -1,395 +1,395 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CustomImagesClient is the the DevTest Labs Client. -type CustomImagesClient struct { - ManagementClient -} - -// NewCustomImagesClient creates an instance of the CustomImagesClient client. -func NewCustomImagesClient(subscriptionID string) CustomImagesClient { - return NewCustomImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCustomImagesClientWithBaseURI creates an instance of the -// CustomImagesClient client. -func NewCustomImagesClientWithBaseURI(baseURI string, subscriptionID string) CustomImagesClient { - return CustomImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing custom image. This operation -// can take a while to complete. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the custom image. customImage is a custom -// image. -func (client CustomImagesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, customImage CustomImage, cancel <-chan struct{}) (<-chan CustomImage, <-chan error) { - resultChan := make(chan CustomImage, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: customImage, - Constraints: []validation.Constraint{{Target: "customImage.CustomImageProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result CustomImage - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, customImage, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CustomImagesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, customImage CustomImage, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithJSON(customImage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) CreateOrUpdateResponder(resp *http.Response) (result CustomImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete custom image. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the custom image. -func (client CustomImagesClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client CustomImagesClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get custom image. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the custom image. expand is specify the $expand -// query. Example: 'properties($select=vm)' -func (client CustomImagesClient) Get(resourceGroupName string, labName string, name string, expand string) (result CustomImage, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CustomImagesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) GetResponder(resp *http.Response) (result CustomImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list custom images in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=vm)' filter is the filter to apply to the operation. top -// is the maximum number of resources to return from the operation. orderby is -// the ordering expression for the results, using OData notation. -func (client CustomImagesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationCustomImage, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client CustomImagesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client CustomImagesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client CustomImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationCustomImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client CustomImagesClient) ListNextResults(lastResults ResponseWithContinuationCustomImage) (result ResponseWithContinuationCustomImage, err error) { - req, err := lastResults.ResponseWithContinuationCustomImagePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CustomImagesClient is the the DevTest Labs Client. +type CustomImagesClient struct { + ManagementClient +} + +// NewCustomImagesClient creates an instance of the CustomImagesClient client. +func NewCustomImagesClient(subscriptionID string) CustomImagesClient { + return NewCustomImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomImagesClientWithBaseURI creates an instance of the +// CustomImagesClient client. +func NewCustomImagesClientWithBaseURI(baseURI string, subscriptionID string) CustomImagesClient { + return CustomImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing custom image. This operation +// can take a while to complete. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the custom image. customImage is a custom +// image. +func (client CustomImagesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, customImage CustomImage, cancel <-chan struct{}) (<-chan CustomImage, <-chan error) { + resultChan := make(chan CustomImage, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: customImage, + Constraints: []validation.Constraint{{Target: "customImage.CustomImageProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result CustomImage + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, customImage, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CustomImagesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, customImage CustomImage, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), + autorest.WithJSON(customImage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CustomImagesClient) CreateOrUpdateResponder(resp *http.Response) (result CustomImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete custom image. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the custom image. +func (client CustomImagesClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client CustomImagesClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CustomImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get custom image. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the custom image. expand is specify the $expand +// query. Example: 'properties($select=vm)' +func (client CustomImagesClient) Get(resourceGroupName string, labName string, name string, expand string) (result CustomImage, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomImagesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CustomImagesClient) GetResponder(resp *http.Response) (result CustomImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list custom images in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=vm)' filter is the filter to apply to the operation. top +// is the maximum number of resources to return from the operation. orderby is +// the ordering expression for the results, using OData notation. +func (client CustomImagesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationCustomImage, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client CustomImagesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CustomImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CustomImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationCustomImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client CustomImagesClient) ListNextResults(lastResults ResponseWithContinuationCustomImage) (result ResponseWithContinuationCustomImage, err error) { + req, err := lastResults.ResponseWithContinuationCustomImagePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.CustomImagesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/disks.go index a8a00b32ac..6cf3809334 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/disks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/disks.go @@ -1,574 +1,574 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DisksClient is the the DevTest Labs Client. -type DisksClient struct { - ManagementClient -} - -// NewDisksClient creates an instance of the DisksClient client. -func NewDisksClient(subscriptionID string) DisksClient { - return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDisksClientWithBaseURI creates an instance of the DisksClient client. -func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { - return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Attach attach and create the lease of the disk to the virtual machine. This -// operation can take a while to complete. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// disk. attachDiskProperties is properties of the disk to attach. -func (client DisksClient) Attach(resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.AttachPreparer(resourceGroupName, labName, userName, name, attachDiskProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Attach", nil, "Failure preparing request") - return - } - - resp, err := client.AttachSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Attach", resp, "Failure sending request") - return - } - - result, err = client.AttachResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Attach", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// AttachPreparer prepares the Attach request. -func (client DisksClient) AttachPreparer(resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach", pathParameters), - autorest.WithJSON(attachDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// AttachSender sends the Attach request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) AttachSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// AttachResponder handles the response to the Attach request. The method always -// closes the http.Response Body. -func (client DisksClient) AttachResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or replace an existing disk. This operation can take a -// while to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// disk. disk is a Disk. -func (client DisksClient) CreateOrUpdate(resourceGroupName string, labName string, userName string, name string, disk Disk, cancel <-chan struct{}) (<-chan Disk, <-chan error) { - resultChan := make(chan Disk, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: disk, - Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.DisksClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Disk - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, userName, name, disk, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DisksClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, userName string, name string, disk Disk, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithJSON(disk), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete disk. This operation can take a while to complete. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// disk. -func (client DisksClient) Delete(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, labName, userName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client DisksClient) DeletePreparer(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Detach detach and break the lease of the disk attached to the virtual -// machine. This operation can take a while to complete. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// disk. detachDiskProperties is properties of the disk to detach. -func (client DisksClient) Detach(resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DetachPreparer(resourceGroupName, labName, userName, name, detachDiskProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Detach", nil, "Failure preparing request") - return - } - - resp, err := client.DetachSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Detach", resp, "Failure sending request") - return - } - - result, err = client.DetachResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Detach", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DetachPreparer prepares the Detach request. -func (client DisksClient) DetachPreparer(resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach", pathParameters), - autorest.WithJSON(detachDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DetachSender sends the Detach request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) DetachSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DetachResponder handles the response to the Detach request. The method always -// closes the http.Response Body. -func (client DisksClient) DetachResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get disk. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// disk. expand is specify the $expand query. Example: -// 'properties($select=diskType)' -func (client DisksClient) Get(resourceGroupName string, labName string, userName string, name string, expand string) (result Disk, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DisksClient) GetPreparer(resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list disks in a given user profile. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. expand is specify the -// $expand query. Example: 'properties($select=diskType)' filter is the filter -// to apply to the operation. top is the maximum number of resources to return -// from the operation. orderby is the ordering expression for the results, -// using OData notation. -func (client DisksClient) List(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDisk, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DisksClient) ListPreparer(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DisksClient) ListResponder(resp *http.Response) (result ResponseWithContinuationDisk, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DisksClient) ListNextResults(lastResults ResponseWithContinuationDisk) (result ResponseWithContinuationDisk, err error) { - req, err := lastResults.ResponseWithContinuationDiskPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DisksClient is the the DevTest Labs Client. +type DisksClient struct { + ManagementClient +} + +// NewDisksClient creates an instance of the DisksClient client. +func NewDisksClient(subscriptionID string) DisksClient { + return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisksClientWithBaseURI creates an instance of the DisksClient client. +func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { + return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Attach attach and create the lease of the disk to the virtual machine. This +// operation can take a while to complete. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// disk. attachDiskProperties is properties of the disk to attach. +func (client DisksClient) Attach(resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.AttachPreparer(resourceGroupName, labName, userName, name, attachDiskProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Attach", nil, "Failure preparing request") + return + } + + resp, err := client.AttachSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Attach", resp, "Failure sending request") + return + } + + result, err = client.AttachResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Attach", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// AttachPreparer prepares the Attach request. +func (client DisksClient) AttachPreparer(resourceGroupName string, labName string, userName string, name string, attachDiskProperties AttachDiskProperties, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach", pathParameters), + autorest.WithJSON(attachDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// AttachSender sends the Attach request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) AttachSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// AttachResponder handles the response to the Attach request. The method always +// closes the http.Response Body. +func (client DisksClient) AttachResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing disk. This operation can take a +// while to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// disk. disk is a Disk. +func (client DisksClient) CreateOrUpdate(resourceGroupName string, labName string, userName string, name string, disk Disk, cancel <-chan struct{}) (<-chan Disk, <-chan error) { + resultChan := make(chan Disk, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: disk, + Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.DisksClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Disk + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, userName, name, disk, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DisksClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, userName string, name string, disk Disk, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), + autorest.WithJSON(disk), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete disk. This operation can take a while to complete. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// disk. +func (client DisksClient) Delete(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, labName, userName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DisksClient) DeletePreparer(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DisksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Detach detach and break the lease of the disk attached to the virtual +// machine. This operation can take a while to complete. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// disk. detachDiskProperties is properties of the disk to detach. +func (client DisksClient) Detach(resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DetachPreparer(resourceGroupName, labName, userName, name, detachDiskProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Detach", nil, "Failure preparing request") + return + } + + resp, err := client.DetachSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Detach", resp, "Failure sending request") + return + } + + result, err = client.DetachResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Detach", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DetachPreparer prepares the Detach request. +func (client DisksClient) DetachPreparer(resourceGroupName string, labName string, userName string, name string, detachDiskProperties DetachDiskProperties, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach", pathParameters), + autorest.WithJSON(detachDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DetachSender sends the Detach request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) DetachSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DetachResponder handles the response to the Detach request. The method always +// closes the http.Response Body. +func (client DisksClient) DetachResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get disk. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// disk. expand is specify the $expand query. Example: +// 'properties($select=diskType)' +func (client DisksClient) Get(resourceGroupName string, labName string, userName string, name string, expand string) (result Disk, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, userName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DisksClient) GetPreparer(resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list disks in a given user profile. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. expand is specify the +// $expand query. Example: 'properties($select=diskType)' filter is the filter +// to apply to the operation. top is the maximum number of resources to return +// from the operation. orderby is the ordering expression for the results, +// using OData notation. +func (client DisksClient) List(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDisk, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, userName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DisksClient) ListPreparer(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DisksClient) ListResponder(resp *http.Response) (result ResponseWithContinuationDisk, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DisksClient) ListNextResults(lastResults ResponseWithContinuationDisk) (result ResponseWithContinuationDisk, err error) { + req, err := lastResults.ResponseWithContinuationDiskPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.DisksClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/environments.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/environments.go index 25164f83aa..ee5f41fe72 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/environments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/environments.go @@ -1,403 +1,403 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// EnvironmentsClient is the the DevTest Labs Client. -type EnvironmentsClient struct { - ManagementClient -} - -// NewEnvironmentsClient creates an instance of the EnvironmentsClient client. -func NewEnvironmentsClient(subscriptionID string) EnvironmentsClient { - return NewEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEnvironmentsClientWithBaseURI creates an instance of the -// EnvironmentsClient client. -func NewEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentsClient { - return EnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing environment. This operation can -// take a while to complete. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// environment. dtlEnvironment is an environment, which is essentially an ARM -// template deployment. -func (client EnvironmentsClient) CreateOrUpdate(resourceGroupName string, labName string, userName string, name string, dtlEnvironment DtlEnvironment, cancel <-chan struct{}) (<-chan DtlEnvironment, <-chan error) { - resultChan := make(chan DtlEnvironment, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: dtlEnvironment, - Constraints: []validation.Constraint{{Target: "dtlEnvironment.EnvironmentProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result DtlEnvironment - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, userName, name, dtlEnvironment, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EnvironmentsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, userName string, name string, dtlEnvironment DtlEnvironment, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithJSON(dtlEnvironment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DtlEnvironment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete environment. This operation can take a while to complete. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// environment. -func (client EnvironmentsClient) Delete(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, labName, userName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client EnvironmentsClient) DeletePreparer(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get environment. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// environment. expand is specify the $expand query. Example: -// 'properties($select=deploymentProperties)' -func (client EnvironmentsClient) Get(resourceGroupName string, labName string, userName string, name string, expand string) (result DtlEnvironment, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client EnvironmentsClient) GetPreparer(resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) GetResponder(resp *http.Response) (result DtlEnvironment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list environments in a given user profile. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. expand is specify the -// $expand query. Example: 'properties($select=deploymentProperties)' filter is -// the filter to apply to the operation. top is the maximum number of resources -// to return from the operation. orderby is the ordering expression for the -// results, using OData notation. -func (client EnvironmentsClient) List(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDtlEnvironment, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client EnvironmentsClient) ListPreparer(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client EnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client EnvironmentsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationDtlEnvironment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client EnvironmentsClient) ListNextResults(lastResults ResponseWithContinuationDtlEnvironment) (result ResponseWithContinuationDtlEnvironment, err error) { - req, err := lastResults.ResponseWithContinuationDtlEnvironmentPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// EnvironmentsClient is the the DevTest Labs Client. +type EnvironmentsClient struct { + ManagementClient +} + +// NewEnvironmentsClient creates an instance of the EnvironmentsClient client. +func NewEnvironmentsClient(subscriptionID string) EnvironmentsClient { + return NewEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentsClientWithBaseURI creates an instance of the +// EnvironmentsClient client. +func NewEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentsClient { + return EnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing environment. This operation can +// take a while to complete. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// environment. dtlEnvironment is an environment, which is essentially an ARM +// template deployment. +func (client EnvironmentsClient) CreateOrUpdate(resourceGroupName string, labName string, userName string, name string, dtlEnvironment DtlEnvironment, cancel <-chan struct{}) (<-chan DtlEnvironment, <-chan error) { + resultChan := make(chan DtlEnvironment, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: dtlEnvironment, + Constraints: []validation.Constraint{{Target: "dtlEnvironment.EnvironmentProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DtlEnvironment + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, userName, name, dtlEnvironment, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, userName string, name string, dtlEnvironment DtlEnvironment, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), + autorest.WithJSON(dtlEnvironment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DtlEnvironment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete environment. This operation can take a while to complete. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// environment. +func (client EnvironmentsClient) Delete(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, labName, userName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentsClient) DeletePreparer(resourceGroupName string, labName string, userName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get environment. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// environment. expand is specify the $expand query. Example: +// 'properties($select=deploymentProperties)' +func (client EnvironmentsClient) Get(resourceGroupName string, labName string, userName string, name string, expand string) (result DtlEnvironment, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, userName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentsClient) GetPreparer(resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) GetResponder(resp *http.Response) (result DtlEnvironment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list environments in a given user profile. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. expand is specify the +// $expand query. Example: 'properties($select=deploymentProperties)' filter is +// the filter to apply to the operation. top is the maximum number of resources +// to return from the operation. orderby is the ordering expression for the +// results, using OData notation. +func (client EnvironmentsClient) List(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationDtlEnvironment, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, userName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentsClient) ListPreparer(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationDtlEnvironment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client EnvironmentsClient) ListNextResults(lastResults ResponseWithContinuationDtlEnvironment) (result ResponseWithContinuationDtlEnvironment, err error) { + req, err := lastResults.ResponseWithContinuationDtlEnvironmentPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.EnvironmentsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/formulas.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/formulas.go index 807d27095b..9c85729216 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/formulas.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/formulas.go @@ -1,393 +1,393 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// FormulasClient is the the DevTest Labs Client. -type FormulasClient struct { - ManagementClient -} - -// NewFormulasClient creates an instance of the FormulasClient client. -func NewFormulasClient(subscriptionID string) FormulasClient { - return NewFormulasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFormulasClientWithBaseURI creates an instance of the FormulasClient -// client. -func NewFormulasClientWithBaseURI(baseURI string, subscriptionID string) FormulasClient { - return FormulasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing Formula. This operation can -// take a while to complete. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the formula. formula is a formula for creating -// a VM, specifying an image base and other parameters -func (client FormulasClient) CreateOrUpdate(resourceGroupName string, labName string, name string, formula Formula, cancel <-chan struct{}) (<-chan Formula, <-chan error) { - resultChan := make(chan Formula, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: formula, - Constraints: []validation.Constraint{{Target: "formula.FormulaProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.FormulasClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Formula - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, formula, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FormulasClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, formula Formula, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithJSON(formula), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FormulasClient) CreateOrUpdateResponder(resp *http.Response) (result Formula, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete formula. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the formula. -func (client FormulasClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FormulasClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FormulasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get formula. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the formula. expand is specify the $expand -// query. Example: 'properties($select=description)' -func (client FormulasClient) Get(resourceGroupName string, labName string, name string, expand string) (result Formula, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client FormulasClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FormulasClient) GetResponder(resp *http.Response) (result Formula, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list formulas in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=description)' filter is the filter to apply to the -// operation. top is the maximum number of resources to return from the -// operation. orderby is the ordering expression for the results, using OData -// notation. -func (client FormulasClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationFormula, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client FormulasClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client FormulasClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client FormulasClient) ListResponder(resp *http.Response) (result ResponseWithContinuationFormula, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client FormulasClient) ListNextResults(lastResults ResponseWithContinuationFormula) (result ResponseWithContinuationFormula, err error) { - req, err := lastResults.ResponseWithContinuationFormulaPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FormulasClient is the the DevTest Labs Client. +type FormulasClient struct { + ManagementClient +} + +// NewFormulasClient creates an instance of the FormulasClient client. +func NewFormulasClient(subscriptionID string) FormulasClient { + return NewFormulasClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFormulasClientWithBaseURI creates an instance of the FormulasClient +// client. +func NewFormulasClientWithBaseURI(baseURI string, subscriptionID string) FormulasClient { + return FormulasClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing Formula. This operation can +// take a while to complete. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the formula. formula is a formula for creating +// a VM, specifying an image base and other parameters +func (client FormulasClient) CreateOrUpdate(resourceGroupName string, labName string, name string, formula Formula, cancel <-chan struct{}) (<-chan Formula, <-chan error) { + resultChan := make(chan Formula, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: formula, + Constraints: []validation.Constraint{{Target: "formula.FormulaProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "formula.FormulaProperties.FormulaContent.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.FormulasClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Formula + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, formula, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FormulasClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, formula Formula, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), + autorest.WithJSON(formula), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FormulasClient) CreateOrUpdateResponder(resp *http.Response) (result Formula, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete formula. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the formula. +func (client FormulasClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FormulasClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FormulasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get formula. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the formula. expand is specify the $expand +// query. Example: 'properties($select=description)' +func (client FormulasClient) Get(resourceGroupName string, labName string, name string, expand string) (result Formula, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FormulasClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FormulasClient) GetResponder(resp *http.Response) (result Formula, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list formulas in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=description)' filter is the filter to apply to the +// operation. top is the maximum number of resources to return from the +// operation. orderby is the ordering expression for the results, using OData +// notation. +func (client FormulasClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationFormula, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client FormulasClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FormulasClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FormulasClient) ListResponder(resp *http.Response) (result ResponseWithContinuationFormula, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client FormulasClient) ListNextResults(lastResults ResponseWithContinuationFormula) (result ResponseWithContinuationFormula, err error) { + req, err := lastResults.ResponseWithContinuationFormulaPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.FormulasClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/galleryimages.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/galleryimages.go index e275e34ad7..16df40fb45 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/galleryimages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/galleryimages.go @@ -1,147 +1,147 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// GalleryImagesClient is the the DevTest Labs Client. -type GalleryImagesClient struct { - ManagementClient -} - -// NewGalleryImagesClient creates an instance of the GalleryImagesClient -// client. -func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { - return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGalleryImagesClientWithBaseURI creates an instance of the -// GalleryImagesClient client. -func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { - return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list gallery images in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=author)' filter is the filter to apply to the operation. -// top is the maximum number of resources to return from the operation. orderby -// is the ordering expression for the results, using OData notation. -func (client GalleryImagesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationGalleryImage, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GalleryImagesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GalleryImagesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GalleryImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationGalleryImage, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GalleryImagesClient) ListNextResults(lastResults ResponseWithContinuationGalleryImage) (result ResponseWithContinuationGalleryImage, err error) { - req, err := lastResults.ResponseWithContinuationGalleryImagePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// GalleryImagesClient is the the DevTest Labs Client. +type GalleryImagesClient struct { + ManagementClient +} + +// NewGalleryImagesClient creates an instance of the GalleryImagesClient +// client. +func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { + return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGalleryImagesClientWithBaseURI creates an instance of the +// GalleryImagesClient client. +func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { + return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list gallery images in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=author)' filter is the filter to apply to the operation. +// top is the maximum number of resources to return from the operation. orderby +// is the ordering expression for the results, using OData notation. +func (client GalleryImagesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationGalleryImage, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GalleryImagesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationGalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GalleryImagesClient) ListNextResults(lastResults ResponseWithContinuationGalleryImage) (result ResponseWithContinuationGalleryImage, err error) { + req, err := lastResults.ResponseWithContinuationGalleryImagePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GalleryImagesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/globalschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/globalschedules.go index 7ad45653e4..8c5b5d0761 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/globalschedules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/globalschedules.go @@ -1,691 +1,691 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GlobalSchedulesClient is the the DevTest Labs Client. -type GlobalSchedulesClient struct { - ManagementClient -} - -// NewGlobalSchedulesClient creates an instance of the GlobalSchedulesClient -// client. -func NewGlobalSchedulesClient(subscriptionID string) GlobalSchedulesClient { - return NewGlobalSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalSchedulesClientWithBaseURI creates an instance of the -// GlobalSchedulesClient client. -func NewGlobalSchedulesClientWithBaseURI(baseURI string, subscriptionID string) GlobalSchedulesClient { - return GlobalSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// -// resourceGroupName is the name of the resource group. name is the name of the -// schedule. schedule is a schedule. -func (client GlobalSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, schedule Schedule) (result Schedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GlobalSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// -// resourceGroupName is the name of the resource group. name is the name of the -// schedule. -func (client GlobalSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GlobalSchedulesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// schedule. -func (client GlobalSchedulesClient) Execute(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExecutePreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Execute", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExecutePreparer prepares the Execute request. -func (client GlobalSchedulesClient) ExecutePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// -// resourceGroupName is the name of the resource group. name is the name of the -// schedule. expand is specify the $expand query. Example: -// 'properties($select=status)' -func (client GlobalSchedulesClient) Get(resourceGroupName string, name string, expand string) (result Schedule, err error) { - req, err := client.GetPreparer(resourceGroupName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GlobalSchedulesClient) GetPreparer(resourceGroupName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list schedules in a resource group. -// -// resourceGroupName is the name of the resource group. expand is specify the -// $expand query. Example: 'properties($select=status)' filter is the filter to -// apply to the operation. top is the maximum number of resources to return -// from the operation. orderby is the ordering expression for the results, -// using OData notation. -func (client GlobalSchedulesClient) ListByResourceGroup(resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GlobalSchedulesClient) ListByResourceGroupPreparer(resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client GlobalSchedulesClient) ListByResourceGroupNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { - req, err := lastResults.ResponseWithContinuationSchedulePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription list schedules in a subscription. -// -// expand is specify the $expand query. Example: 'properties($select=status)' -// filter is the filter to apply to the operation. top is the maximum number of -// resources to return from the operation. orderby is the ordering expression -// for the results, using OData notation. -func (client GlobalSchedulesClient) ListBySubscription(expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { - req, err := client.ListBySubscriptionPreparer(expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client GlobalSchedulesClient) ListBySubscriptionPreparer(expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client GlobalSchedulesClient) ListBySubscriptionNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { - req, err := lastResults.ResponseWithContinuationSchedulePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// Retarget updates a schedule's target resource Id. This operation can take a -// while to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// schedule. retargetScheduleProperties is properties for retargeting a virtual -// machine schedule. -func (client GlobalSchedulesClient) Retarget(resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RetargetPreparer(resourceGroupName, name, retargetScheduleProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Retarget", nil, "Failure preparing request") - return - } - - resp, err := client.RetargetSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Retarget", resp, "Failure sending request") - return - } - - result, err = client.RetargetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Retarget", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RetargetPreparer prepares the Retarget request. -func (client GlobalSchedulesClient) RetargetPreparer(resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget", pathParameters), - autorest.WithJSON(retargetScheduleProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RetargetSender sends the Retarget request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) RetargetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RetargetResponder handles the response to the Retarget request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) RetargetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update modify properties of schedules. -// -// resourceGroupName is the name of the resource group. name is the name of the -// schedule. schedule is a schedule. -func (client GlobalSchedulesClient) Update(resourceGroupName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - req, err := client.UpdatePreparer(resourceGroupName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GlobalSchedulesClient) UpdatePreparer(resourceGroupName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GlobalSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GlobalSchedulesClient is the the DevTest Labs Client. +type GlobalSchedulesClient struct { + ManagementClient +} + +// NewGlobalSchedulesClient creates an instance of the GlobalSchedulesClient +// client. +func NewGlobalSchedulesClient(subscriptionID string) GlobalSchedulesClient { + return NewGlobalSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGlobalSchedulesClientWithBaseURI creates an instance of the +// GlobalSchedulesClient client. +func NewGlobalSchedulesClientWithBaseURI(baseURI string, subscriptionID string) GlobalSchedulesClient { + return GlobalSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing schedule. +// +// resourceGroupName is the name of the resource group. name is the name of the +// schedule. schedule is a schedule. +func (client GlobalSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, schedule Schedule) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schedule, + Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GlobalSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, schedule Schedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete schedule. +// +// resourceGroupName is the name of the resource group. name is the name of the +// schedule. +func (client GlobalSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GlobalSchedulesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Execute execute a schedule. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// schedule. +func (client GlobalSchedulesClient) Execute(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExecutePreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Execute", resp, "Failure sending request") + return + } + + result, err = client.ExecuteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Execute", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExecutePreparer prepares the Execute request. +func (client GlobalSchedulesClient) ExecutePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) ExecuteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get schedule. +// +// resourceGroupName is the name of the resource group. name is the name of the +// schedule. expand is specify the $expand query. Example: +// 'properties($select=status)' +func (client GlobalSchedulesClient) Get(resourceGroupName string, name string, expand string) (result Schedule, err error) { + req, err := client.GetPreparer(resourceGroupName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GlobalSchedulesClient) GetPreparer(resourceGroupName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list schedules in a resource group. +// +// resourceGroupName is the name of the resource group. expand is specify the +// $expand query. Example: 'properties($select=status)' filter is the filter to +// apply to the operation. top is the maximum number of resources to return +// from the operation. orderby is the ordering expression for the results, +// using OData notation. +func (client GlobalSchedulesClient) ListByResourceGroup(resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GlobalSchedulesClient) ListByResourceGroupPreparer(resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client GlobalSchedulesClient) ListByResourceGroupNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.ResponseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription list schedules in a subscription. +// +// expand is specify the $expand query. Example: 'properties($select=status)' +// filter is the filter to apply to the operation. top is the maximum number of +// resources to return from the operation. orderby is the ordering expression +// for the results, using OData notation. +func (client GlobalSchedulesClient) ListBySubscription(expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { + req, err := client.ListBySubscriptionPreparer(expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client GlobalSchedulesClient) ListBySubscriptionPreparer(expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client GlobalSchedulesClient) ListBySubscriptionNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.ResponseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// Retarget updates a schedule's target resource Id. This operation can take a +// while to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// schedule. retargetScheduleProperties is properties for retargeting a virtual +// machine schedule. +func (client GlobalSchedulesClient) Retarget(resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RetargetPreparer(resourceGroupName, name, retargetScheduleProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Retarget", nil, "Failure preparing request") + return + } + + resp, err := client.RetargetSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Retarget", resp, "Failure sending request") + return + } + + result, err = client.RetargetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Retarget", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RetargetPreparer prepares the Retarget request. +func (client GlobalSchedulesClient) RetargetPreparer(resourceGroupName string, name string, retargetScheduleProperties RetargetScheduleProperties, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget", pathParameters), + autorest.WithJSON(retargetScheduleProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RetargetSender sends the Retarget request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) RetargetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RetargetResponder handles the response to the Retarget request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) RetargetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of schedules. +// +// resourceGroupName is the name of the resource group. name is the name of the +// schedule. schedule is a schedule. +func (client GlobalSchedulesClient) Update(resourceGroupName string, name string, schedule ScheduleFragment) (result Schedule, err error) { + req, err := client.UpdatePreparer(resourceGroupName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.GlobalSchedulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GlobalSchedulesClient) UpdatePreparer(resourceGroupName string, name string, schedule ScheduleFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GlobalSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/labs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/labs.go index 09d6ffe241..0ed14dabb5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/labs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/labs.go @@ -1,977 +1,977 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LabsClient is the the DevTest Labs Client. -type LabsClient struct { - ManagementClient -} - -// NewLabsClient creates an instance of the LabsClient client. -func NewLabsClient(subscriptionID string) LabsClient { - return NewLabsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLabsClientWithBaseURI creates an instance of the LabsClient client. -func NewLabsClientWithBaseURI(baseURI string, subscriptionID string) LabsClient { - return LabsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ClaimAnyVM claim a random claimable virtual machine in the lab. This -// operation can take a while to complete. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. -func (client LabsClient) ClaimAnyVM(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ClaimAnyVMPreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ClaimAnyVM", nil, "Failure preparing request") - return - } - - resp, err := client.ClaimAnyVMSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ClaimAnyVM", resp, "Failure sending request") - return - } - - result, err = client.ClaimAnyVMResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ClaimAnyVM", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ClaimAnyVMPreparer prepares the ClaimAnyVM request. -func (client LabsClient) ClaimAnyVMPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ClaimAnyVMSender sends the ClaimAnyVM request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ClaimAnyVMSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ClaimAnyVMResponder handles the response to the ClaimAnyVM request. The method always -// closes the http.Response Body. -func (client LabsClient) ClaimAnyVMResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateEnvironment create virtual machines in a lab. This operation can take -// a while to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. labVirtualMachineCreationParameter is properties for creating a virtual -// machine. -func (client LabsClient) CreateEnvironment(resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: labVirtualMachineCreationParameter, - Constraints: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.LabsClient", "CreateEnvironment") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateEnvironmentPreparer(resourceGroupName, name, labVirtualMachineCreationParameter, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateEnvironment", nil, "Failure preparing request") - return - } - - resp, err := client.CreateEnvironmentSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateEnvironment", resp, "Failure sending request") - return - } - - result, err = client.CreateEnvironmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateEnvironment", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateEnvironmentPreparer prepares the CreateEnvironment request. -func (client LabsClient) CreateEnvironmentPreparer(resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment", pathParameters), - autorest.WithJSON(labVirtualMachineCreationParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateEnvironmentSender sends the CreateEnvironment request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) CreateEnvironmentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateEnvironmentResponder handles the response to the CreateEnvironment request. The method always -// closes the http.Response Body. -func (client LabsClient) CreateEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or replace an existing lab. This operation can take a -// while to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. lab is a lab. -func (client LabsClient) CreateOrUpdate(resourceGroupName string, name string, lab Lab, cancel <-chan struct{}) (<-chan Lab, <-chan error) { - resultChan := make(chan Lab, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Lab - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, lab, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LabsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, lab Lab, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithJSON(lab), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LabsClient) CreateOrUpdateResponder(resp *http.Response) (result Lab, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete lab. This operation can take a while to complete. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. -func (client LabsClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client LabsClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LabsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportResourceUsage exports the lab resource usage into a storage account -// This operation can take a while to complete. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. exportResourceUsageParameters is the parameters of the export -// operation. -func (client LabsClient) ExportResourceUsage(resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExportResourceUsagePreparer(resourceGroupName, name, exportResourceUsageParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ExportResourceUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ExportResourceUsageSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ExportResourceUsage", resp, "Failure sending request") - return - } - - result, err = client.ExportResourceUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ExportResourceUsage", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExportResourceUsagePreparer prepares the ExportResourceUsage request. -func (client LabsClient) ExportResourceUsagePreparer(resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage", pathParameters), - autorest.WithJSON(exportResourceUsageParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExportResourceUsageSender sends the ExportResourceUsage request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ExportResourceUsageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExportResourceUsageResponder handles the response to the ExportResourceUsage request. The method always -// closes the http.Response Body. -func (client LabsClient) ExportResourceUsageResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateUploadURI generate a URI for uploading custom disk images to a Lab. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. generateUploadURIParameter is properties for generating an upload URI. -func (client LabsClient) GenerateUploadURI(resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (result GenerateUploadURIResponse, err error) { - req, err := client.GenerateUploadURIPreparer(resourceGroupName, name, generateUploadURIParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "GenerateUploadURI", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateUploadURISender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "GenerateUploadURI", resp, "Failure sending request") - return - } - - result, err = client.GenerateUploadURIResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "GenerateUploadURI", resp, "Failure responding to request") - } - - return -} - -// GenerateUploadURIPreparer prepares the GenerateUploadURI request. -func (client LabsClient) GenerateUploadURIPreparer(resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri", pathParameters), - autorest.WithJSON(generateUploadURIParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateUploadURISender sends the GenerateUploadURI request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) GenerateUploadURISender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateUploadURIResponder handles the response to the GenerateUploadURI request. The method always -// closes the http.Response Body. -func (client LabsClient) GenerateUploadURIResponder(resp *http.Response) (result GenerateUploadURIResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get lab. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. expand is specify the $expand query. Example: -// 'properties($select=defaultStorageAccount)' -func (client LabsClient) Get(resourceGroupName string, name string, expand string) (result Lab, err error) { - req, err := client.GetPreparer(resourceGroupName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LabsClient) GetPreparer(resourceGroupName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LabsClient) GetResponder(resp *http.Response) (result Lab, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list labs in a resource group. -// -// resourceGroupName is the name of the resource group. expand is specify the -// $expand query. Example: 'properties($select=defaultStorageAccount)' filter -// is the filter to apply to the operation. top is the maximum number of -// resources to return from the operation. orderby is the ordering expression -// for the results, using OData notation. -func (client LabsClient) ListByResourceGroup(resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLab, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client LabsClient) ListByResourceGroupPreparer(resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client LabsClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationLab, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client LabsClient) ListByResourceGroupNextResults(lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { - req, err := lastResults.ResponseWithContinuationLabPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription list labs in a subscription. -// -// expand is specify the $expand query. Example: -// 'properties($select=defaultStorageAccount)' filter is the filter to apply to -// the operation. top is the maximum number of resources to return from the -// operation. orderby is the ordering expression for the results, using OData -// notation. -func (client LabsClient) ListBySubscription(expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLab, err error) { - req, err := client.ListBySubscriptionPreparer(expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client LabsClient) ListBySubscriptionPreparer(expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client LabsClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationLab, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client LabsClient) ListBySubscriptionNextResults(lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { - req, err := lastResults.ResponseWithContinuationLabPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// ListVhds list disk images available for custom image creation. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. -func (client LabsClient) ListVhds(resourceGroupName string, name string) (result ResponseWithContinuationLabVhd, err error) { - req, err := client.ListVhdsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", nil, "Failure preparing request") - return - } - - resp, err := client.ListVhdsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure sending request") - return - } - - result, err = client.ListVhdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure responding to request") - } - - return -} - -// ListVhdsPreparer prepares the ListVhds request. -func (client LabsClient) ListVhdsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVhdsSender sends the ListVhds request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) ListVhdsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVhdsResponder handles the response to the ListVhds request. The method always -// closes the http.Response Body. -func (client LabsClient) ListVhdsResponder(resp *http.Response) (result ResponseWithContinuationLabVhd, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVhdsNextResults retrieves the next set of results, if any. -func (client LabsClient) ListVhdsNextResults(lastResults ResponseWithContinuationLabVhd) (result ResponseWithContinuationLabVhd, err error) { - req, err := lastResults.ResponseWithContinuationLabVhdPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListVhdsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure sending next results request") - } - - result, err = client.ListVhdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of labs. -// -// resourceGroupName is the name of the resource group. name is the name of the -// lab. lab is a lab. -func (client LabsClient) Update(resourceGroupName string, name string, lab LabFragment) (result Lab, err error) { - req, err := client.UpdatePreparer(resourceGroupName, name, lab) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client LabsClient) UpdatePreparer(resourceGroupName string, name string, lab LabFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), - autorest.WithJSON(lab), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client LabsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client LabsClient) UpdateResponder(resp *http.Response) (result Lab, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LabsClient is the the DevTest Labs Client. +type LabsClient struct { + ManagementClient +} + +// NewLabsClient creates an instance of the LabsClient client. +func NewLabsClient(subscriptionID string) LabsClient { + return NewLabsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLabsClientWithBaseURI creates an instance of the LabsClient client. +func NewLabsClientWithBaseURI(baseURI string, subscriptionID string) LabsClient { + return LabsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ClaimAnyVM claim a random claimable virtual machine in the lab. This +// operation can take a while to complete. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. +func (client LabsClient) ClaimAnyVM(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ClaimAnyVMPreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ClaimAnyVM", nil, "Failure preparing request") + return + } + + resp, err := client.ClaimAnyVMSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ClaimAnyVM", resp, "Failure sending request") + return + } + + result, err = client.ClaimAnyVMResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ClaimAnyVM", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ClaimAnyVMPreparer prepares the ClaimAnyVM request. +func (client LabsClient) ClaimAnyVMPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ClaimAnyVMSender sends the ClaimAnyVM request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ClaimAnyVMSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ClaimAnyVMResponder handles the response to the ClaimAnyVM request. The method always +// closes the http.Response Body. +func (client LabsClient) ClaimAnyVMResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateEnvironment create virtual machines in a lab. This operation can take +// a while to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. labVirtualMachineCreationParameter is properties for creating a virtual +// machine. +func (client LabsClient) CreateEnvironment(resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: labVirtualMachineCreationParameter, + Constraints: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachineCreationParameter.LabVirtualMachineCreationParameterProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.LabsClient", "CreateEnvironment") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateEnvironmentPreparer(resourceGroupName, name, labVirtualMachineCreationParameter, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.CreateEnvironmentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateEnvironment", resp, "Failure sending request") + return + } + + result, err = client.CreateEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateEnvironment", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateEnvironmentPreparer prepares the CreateEnvironment request. +func (client LabsClient) CreateEnvironmentPreparer(resourceGroupName string, name string, labVirtualMachineCreationParameter LabVirtualMachineCreationParameter, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment", pathParameters), + autorest.WithJSON(labVirtualMachineCreationParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateEnvironmentSender sends the CreateEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) CreateEnvironmentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateEnvironmentResponder handles the response to the CreateEnvironment request. The method always +// closes the http.Response Body. +func (client LabsClient) CreateEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing lab. This operation can take a +// while to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. lab is a lab. +func (client LabsClient) CreateOrUpdate(resourceGroupName string, name string, lab Lab, cancel <-chan struct{}) (<-chan Lab, <-chan error) { + resultChan := make(chan Lab, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Lab + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, lab, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LabsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, lab Lab, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithJSON(lab), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LabsClient) CreateOrUpdateResponder(resp *http.Response) (result Lab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete lab. This operation can take a while to complete. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. +func (client LabsClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client LabsClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LabsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportResourceUsage exports the lab resource usage into a storage account +// This operation can take a while to complete. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. exportResourceUsageParameters is the parameters of the export +// operation. +func (client LabsClient) ExportResourceUsage(resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExportResourceUsagePreparer(resourceGroupName, name, exportResourceUsageParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ExportResourceUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ExportResourceUsageSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ExportResourceUsage", resp, "Failure sending request") + return + } + + result, err = client.ExportResourceUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ExportResourceUsage", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExportResourceUsagePreparer prepares the ExportResourceUsage request. +func (client LabsClient) ExportResourceUsagePreparer(resourceGroupName string, name string, exportResourceUsageParameters ExportResourceUsageParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage", pathParameters), + autorest.WithJSON(exportResourceUsageParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExportResourceUsageSender sends the ExportResourceUsage request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ExportResourceUsageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExportResourceUsageResponder handles the response to the ExportResourceUsage request. The method always +// closes the http.Response Body. +func (client LabsClient) ExportResourceUsageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateUploadURI generate a URI for uploading custom disk images to a Lab. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. generateUploadURIParameter is properties for generating an upload URI. +func (client LabsClient) GenerateUploadURI(resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (result GenerateUploadURIResponse, err error) { + req, err := client.GenerateUploadURIPreparer(resourceGroupName, name, generateUploadURIParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "GenerateUploadURI", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateUploadURISender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "GenerateUploadURI", resp, "Failure sending request") + return + } + + result, err = client.GenerateUploadURIResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "GenerateUploadURI", resp, "Failure responding to request") + } + + return +} + +// GenerateUploadURIPreparer prepares the GenerateUploadURI request. +func (client LabsClient) GenerateUploadURIPreparer(resourceGroupName string, name string, generateUploadURIParameter GenerateUploadURIParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri", pathParameters), + autorest.WithJSON(generateUploadURIParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateUploadURISender sends the GenerateUploadURI request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) GenerateUploadURISender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateUploadURIResponder handles the response to the GenerateUploadURI request. The method always +// closes the http.Response Body. +func (client LabsClient) GenerateUploadURIResponder(resp *http.Response) (result GenerateUploadURIResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get lab. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. expand is specify the $expand query. Example: +// 'properties($select=defaultStorageAccount)' +func (client LabsClient) Get(resourceGroupName string, name string, expand string) (result Lab, err error) { + req, err := client.GetPreparer(resourceGroupName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LabsClient) GetPreparer(resourceGroupName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LabsClient) GetResponder(resp *http.Response) (result Lab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list labs in a resource group. +// +// resourceGroupName is the name of the resource group. expand is specify the +// $expand query. Example: 'properties($select=defaultStorageAccount)' filter +// is the filter to apply to the operation. top is the maximum number of +// resources to return from the operation. orderby is the ordering expression +// for the results, using OData notation. +func (client LabsClient) ListByResourceGroup(resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLab, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client LabsClient) ListByResourceGroupPreparer(resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client LabsClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationLab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client LabsClient) ListByResourceGroupNextResults(lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { + req, err := lastResults.ResponseWithContinuationLabPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription list labs in a subscription. +// +// expand is specify the $expand query. Example: +// 'properties($select=defaultStorageAccount)' filter is the filter to apply to +// the operation. top is the maximum number of resources to return from the +// operation. orderby is the ordering expression for the results, using OData +// notation. +func (client LabsClient) ListBySubscription(expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLab, err error) { + req, err := client.ListBySubscriptionPreparer(expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client LabsClient) ListBySubscriptionPreparer(expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client LabsClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationLab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client LabsClient) ListBySubscriptionNextResults(lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { + req, err := lastResults.ResponseWithContinuationLabPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListVhds list disk images available for custom image creation. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. +func (client LabsClient) ListVhds(resourceGroupName string, name string) (result ResponseWithContinuationLabVhd, err error) { + req, err := client.ListVhdsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", nil, "Failure preparing request") + return + } + + resp, err := client.ListVhdsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure sending request") + return + } + + result, err = client.ListVhdsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure responding to request") + } + + return +} + +// ListVhdsPreparer prepares the ListVhds request. +func (client LabsClient) ListVhdsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVhdsSender sends the ListVhds request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListVhdsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVhdsResponder handles the response to the ListVhds request. The method always +// closes the http.Response Body. +func (client LabsClient) ListVhdsResponder(resp *http.Response) (result ResponseWithContinuationLabVhd, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVhdsNextResults retrieves the next set of results, if any. +func (client LabsClient) ListVhdsNextResults(lastResults ResponseWithContinuationLabVhd) (result ResponseWithContinuationLabVhd, err error) { + req, err := lastResults.ResponseWithContinuationLabVhdPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListVhdsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure sending next results request") + } + + result, err = client.ListVhdsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "ListVhds", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of labs. +// +// resourceGroupName is the name of the resource group. name is the name of the +// lab. lab is a lab. +func (client LabsClient) Update(resourceGroupName string, name string, lab LabFragment) (result Lab, err error) { + req, err := client.UpdatePreparer(resourceGroupName, name, lab) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.LabsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LabsClient) UpdatePreparer(resourceGroupName string, name string, lab LabFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", pathParameters), + autorest.WithJSON(lab), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client LabsClient) UpdateResponder(resp *http.Response) (result Lab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/models.go index 9c9058e050..5525e7f014 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/models.go @@ -1,1952 +1,1952 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// CostThresholdStatus enumerates the values for cost threshold status. -type CostThresholdStatus string - -const ( - // Disabled specifies the disabled state for cost threshold status. - Disabled CostThresholdStatus = "Disabled" - // Enabled specifies the enabled state for cost threshold status. - Enabled CostThresholdStatus = "Enabled" -) - -// CostType enumerates the values for cost type. -type CostType string - -const ( - // Projected specifies the projected state for cost type. - Projected CostType = "Projected" - // Reported specifies the reported state for cost type. - Reported CostType = "Reported" - // Unavailable specifies the unavailable state for cost type. - Unavailable CostType = "Unavailable" -) - -// CustomImageOsType enumerates the values for custom image os type. -type CustomImageOsType string - -const ( - // Linux specifies the linux state for custom image os type. - Linux CustomImageOsType = "Linux" - // None specifies the none state for custom image os type. - None CustomImageOsType = "None" - // Windows specifies the windows state for custom image os type. - Windows CustomImageOsType = "Windows" -) - -// EnableStatus enumerates the values for enable status. -type EnableStatus string - -const ( - // EnableStatusDisabled specifies the enable status disabled state for - // enable status. - EnableStatusDisabled EnableStatus = "Disabled" - // EnableStatusEnabled specifies the enable status enabled state for enable - // status. - EnableStatusEnabled EnableStatus = "Enabled" -) - -// FileUploadOptions enumerates the values for file upload options. -type FileUploadOptions string - -const ( - // FileUploadOptionsNone specifies the file upload options none state for - // file upload options. - FileUploadOptionsNone FileUploadOptions = "None" - // FileUploadOptionsUploadFilesAndGenerateSasTokens specifies the file - // upload options upload files and generate sas tokens state for file - // upload options. - FileUploadOptionsUploadFilesAndGenerateSasTokens FileUploadOptions = "UploadFilesAndGenerateSasTokens" -) - -// HostCachingOptions enumerates the values for host caching options. -type HostCachingOptions string - -const ( - // HostCachingOptionsNone specifies the host caching options none state for - // host caching options. - HostCachingOptionsNone HostCachingOptions = "None" - // HostCachingOptionsReadOnly specifies the host caching options read only - // state for host caching options. - HostCachingOptionsReadOnly HostCachingOptions = "ReadOnly" - // HostCachingOptionsReadWrite specifies the host caching options read - // write state for host caching options. - HostCachingOptionsReadWrite HostCachingOptions = "ReadWrite" -) - -// LinuxOsState enumerates the values for linux os state. -type LinuxOsState string - -const ( - // DeprovisionApplied specifies the deprovision applied state for linux os - // state. - DeprovisionApplied LinuxOsState = "DeprovisionApplied" - // DeprovisionRequested specifies the deprovision requested state for linux - // os state. - DeprovisionRequested LinuxOsState = "DeprovisionRequested" - // NonDeprovisioned specifies the non deprovisioned state for linux os - // state. - NonDeprovisioned LinuxOsState = "NonDeprovisioned" -) - -// NotificationChannelEventType enumerates the values for notification channel -// event type. -type NotificationChannelEventType string - -const ( - // AutoShutdown specifies the auto shutdown state for notification channel - // event type. - AutoShutdown NotificationChannelEventType = "AutoShutdown" - // Cost specifies the cost state for notification channel event type. - Cost NotificationChannelEventType = "Cost" -) - -// NotificationStatus enumerates the values for notification status. -type NotificationStatus string - -const ( - // NotificationStatusDisabled specifies the notification status disabled - // state for notification status. - NotificationStatusDisabled NotificationStatus = "Disabled" - // NotificationStatusEnabled specifies the notification status enabled - // state for notification status. - NotificationStatusEnabled NotificationStatus = "Enabled" -) - -// PolicyEvaluatorType enumerates the values for policy evaluator type. -type PolicyEvaluatorType string - -const ( - // AllowedValuesPolicy specifies the allowed values policy state for policy - // evaluator type. - AllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy" - // MaxValuePolicy specifies the max value policy state for policy evaluator - // type. - MaxValuePolicy PolicyEvaluatorType = "MaxValuePolicy" -) - -// PolicyFactName enumerates the values for policy fact name. -type PolicyFactName string - -const ( - // PolicyFactNameGalleryImage specifies the policy fact name gallery image - // state for policy fact name. - PolicyFactNameGalleryImage PolicyFactName = "GalleryImage" - // PolicyFactNameLabPremiumVMCount specifies the policy fact name lab - // premium vm count state for policy fact name. - PolicyFactNameLabPremiumVMCount PolicyFactName = "LabPremiumVmCount" - // PolicyFactNameLabTargetCost specifies the policy fact name lab target - // cost state for policy fact name. - PolicyFactNameLabTargetCost PolicyFactName = "LabTargetCost" - // PolicyFactNameLabVMCount specifies the policy fact name lab vm count - // state for policy fact name. - PolicyFactNameLabVMCount PolicyFactName = "LabVmCount" - // PolicyFactNameLabVMSize specifies the policy fact name lab vm size state - // for policy fact name. - PolicyFactNameLabVMSize PolicyFactName = "LabVmSize" - // PolicyFactNameUserOwnedLabPremiumVMCount specifies the policy fact name - // user owned lab premium vm count state for policy fact name. - PolicyFactNameUserOwnedLabPremiumVMCount PolicyFactName = "UserOwnedLabPremiumVmCount" - // PolicyFactNameUserOwnedLabVMCount specifies the policy fact name user - // owned lab vm count state for policy fact name. - PolicyFactNameUserOwnedLabVMCount PolicyFactName = "UserOwnedLabVmCount" - // PolicyFactNameUserOwnedLabVMCountInSubnet specifies the policy fact name - // user owned lab vm count in subnet state for policy fact name. - PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet" -) - -// PolicyStatus enumerates the values for policy status. -type PolicyStatus string - -const ( - // PolicyStatusDisabled specifies the policy status disabled state for - // policy status. - PolicyStatusDisabled PolicyStatus = "Disabled" - // PolicyStatusEnabled specifies the policy status enabled state for policy - // status. - PolicyStatusEnabled PolicyStatus = "Enabled" -) - -// PremiumDataDisk enumerates the values for premium data disk. -type PremiumDataDisk string - -const ( - // PremiumDataDiskDisabled specifies the premium data disk disabled state - // for premium data disk. - PremiumDataDiskDisabled PremiumDataDisk = "Disabled" - // PremiumDataDiskEnabled specifies the premium data disk enabled state for - // premium data disk. - PremiumDataDiskEnabled PremiumDataDisk = "Enabled" -) - -// ReportingCycleType enumerates the values for reporting cycle type. -type ReportingCycleType string - -const ( - // CalendarMonth specifies the calendar month state for reporting cycle - // type. - CalendarMonth ReportingCycleType = "CalendarMonth" - // Custom specifies the custom state for reporting cycle type. - Custom ReportingCycleType = "Custom" -) - -// SourceControlType enumerates the values for source control type. -type SourceControlType string - -const ( - // GitHub specifies the git hub state for source control type. - GitHub SourceControlType = "GitHub" - // VsoGit specifies the vso git state for source control type. - VsoGit SourceControlType = "VsoGit" -) - -// StorageType enumerates the values for storage type. -type StorageType string - -const ( - // Premium specifies the premium state for storage type. - Premium StorageType = "Premium" - // Standard specifies the standard state for storage type. - Standard StorageType = "Standard" -) - -// TargetCostStatus enumerates the values for target cost status. -type TargetCostStatus string - -const ( - // TargetCostStatusDisabled specifies the target cost status disabled state - // for target cost status. - TargetCostStatusDisabled TargetCostStatus = "Disabled" - // TargetCostStatusEnabled specifies the target cost status enabled state - // for target cost status. - TargetCostStatusEnabled TargetCostStatus = "Enabled" -) - -// TransportProtocol enumerates the values for transport protocol. -type TransportProtocol string - -const ( - // TCP specifies the tcp state for transport protocol. - TCP TransportProtocol = "Tcp" - // UDP specifies the udp state for transport protocol. - UDP TransportProtocol = "Udp" -) - -// UsagePermissionType enumerates the values for usage permission type. -type UsagePermissionType string - -const ( - // Allow specifies the allow state for usage permission type. - Allow UsagePermissionType = "Allow" - // Default specifies the default state for usage permission type. - Default UsagePermissionType = "Default" - // Deny specifies the deny state for usage permission type. - Deny UsagePermissionType = "Deny" -) - -// VirtualMachineCreationSource enumerates the values for virtual machine -// creation source. -type VirtualMachineCreationSource string - -const ( - // FromCustomImage specifies the from custom image state for virtual - // machine creation source. - FromCustomImage VirtualMachineCreationSource = "FromCustomImage" - // FromGalleryImage specifies the from gallery image state for virtual - // machine creation source. - FromGalleryImage VirtualMachineCreationSource = "FromGalleryImage" -) - -// WindowsOsState enumerates the values for windows os state. -type WindowsOsState string - -const ( - // NonSysprepped specifies the non sysprepped state for windows os state. - NonSysprepped WindowsOsState = "NonSysprepped" - // SysprepApplied specifies the sysprep applied state for windows os state. - SysprepApplied WindowsOsState = "SysprepApplied" - // SysprepRequested specifies the sysprep requested state for windows os - // state. - SysprepRequested WindowsOsState = "SysprepRequested" -) - -// ApplicableSchedule is schedules applicable to a virtual machine. The -// schedules may have been defined on a VM or on lab level. -type ApplicableSchedule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ApplicableScheduleProperties `json:"properties,omitempty"` -} - -// ApplicableScheduleFragment is schedules applicable to a virtual machine. The -// schedules may have been defined on a VM or on lab level. -type ApplicableScheduleFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ApplicableSchedulePropertiesFragment `json:"properties,omitempty"` -} - -// ApplicableScheduleProperties is properties of a schedules applicable to a -// virtual machine. -type ApplicableScheduleProperties struct { - LabVmsShutdown *Schedule `json:"labVmsShutdown,omitempty"` - LabVmsStartup *Schedule `json:"labVmsStartup,omitempty"` -} - -// ApplicableSchedulePropertiesFragment is properties of a schedules applicable -// to a virtual machine. -type ApplicableSchedulePropertiesFragment struct { - LabVmsShutdown *ScheduleFragment `json:"labVmsShutdown,omitempty"` - LabVmsStartup *ScheduleFragment `json:"labVmsStartup,omitempty"` -} - -// ApplyArtifactsRequest is request body for applying artifacts to a virtual -// machine. -type ApplyArtifactsRequest struct { - Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` -} - -// ArmTemplate is an Azure Resource Manager template. -type ArmTemplate struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ArmTemplateProperties `json:"properties,omitempty"` -} - -// ArmTemplateInfo is information about a generated ARM template. -type ArmTemplateInfo struct { - autorest.Response `json:"-"` - Template *map[string]interface{} `json:"template,omitempty"` - Parameters *map[string]interface{} `json:"parameters,omitempty"` -} - -// ArmTemplateParameterProperties is properties of an Azure Resource Manager -// template parameter. -type ArmTemplateParameterProperties struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ArmTemplateProperties is properties of an Azure Resource Manager template. -type ArmTemplateProperties struct { - DisplayName *string `json:"displayName,omitempty"` - Description *string `json:"description,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Icon *string `json:"icon,omitempty"` - Contents *map[string]interface{} `json:"contents,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ParametersValueFilesInfo *[]ParametersValueFileInfo `json:"parametersValueFilesInfo,omitempty"` -} - -// Artifact is an artifact. -type Artifact struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ArtifactProperties `json:"properties,omitempty"` -} - -// ArtifactDeploymentStatusProperties is properties of an artifact deployment. -type ArtifactDeploymentStatusProperties struct { - DeploymentStatus *string `json:"deploymentStatus,omitempty"` - ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` - TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` -} - -// ArtifactDeploymentStatusPropertiesFragment is properties of an artifact -// deployment. -type ArtifactDeploymentStatusPropertiesFragment struct { - DeploymentStatus *string `json:"deploymentStatus,omitempty"` - ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` - TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` -} - -// ArtifactInstallProperties is properties of an artifact. -type ArtifactInstallProperties struct { - ArtifactID *string `json:"artifactId,omitempty"` - Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"` - Status *string `json:"status,omitempty"` - DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` - VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` - InstallTime *date.Time `json:"installTime,omitempty"` -} - -// ArtifactInstallPropertiesFragment is properties of an artifact. -type ArtifactInstallPropertiesFragment struct { - ArtifactID *string `json:"artifactId,omitempty"` - Parameters *[]ArtifactParameterPropertiesFragment `json:"parameters,omitempty"` - Status *string `json:"status,omitempty"` - DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` - VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` - InstallTime *date.Time `json:"installTime,omitempty"` -} - -// ArtifactParameterProperties is properties of an artifact parameter. -type ArtifactParameterProperties struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ArtifactParameterPropertiesFragment is properties of an artifact parameter. -type ArtifactParameterPropertiesFragment struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ArtifactProperties is properties of an artifact. -type ArtifactProperties struct { - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - Publisher *string `json:"publisher,omitempty"` - FilePath *string `json:"filePath,omitempty"` - Icon *string `json:"icon,omitempty"` - TargetOsType *string `json:"targetOsType,omitempty"` - Parameters *map[string]interface{} `json:"parameters,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` -} - -// ArtifactSource is properties of an artifact source. -type ArtifactSource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ArtifactSourceProperties `json:"properties,omitempty"` -} - -// ArtifactSourceFragment is properties of an artifact source. -type ArtifactSourceFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ArtifactSourcePropertiesFragment `json:"properties,omitempty"` -} - -// ArtifactSourceProperties is properties of an artifact source. -type ArtifactSourceProperties struct { - DisplayName *string `json:"displayName,omitempty"` - URI *string `json:"uri,omitempty"` - SourceType SourceControlType `json:"sourceType,omitempty"` - FolderPath *string `json:"folderPath,omitempty"` - ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` - BranchRef *string `json:"branchRef,omitempty"` - SecurityToken *string `json:"securityToken,omitempty"` - Status EnableStatus `json:"status,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// ArtifactSourcePropertiesFragment is properties of an artifact source. -type ArtifactSourcePropertiesFragment struct { - DisplayName *string `json:"displayName,omitempty"` - URI *string `json:"uri,omitempty"` - SourceType SourceControlType `json:"sourceType,omitempty"` - FolderPath *string `json:"folderPath,omitempty"` - ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` - BranchRef *string `json:"branchRef,omitempty"` - SecurityToken *string `json:"securityToken,omitempty"` - Status EnableStatus `json:"status,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// AttachDiskProperties is properties of the disk to attach. -type AttachDiskProperties struct { - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` -} - -// AttachNewDataDiskOptions is properties to attach new disk to the Virtual -// Machine. -type AttachNewDataDiskOptions struct { - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` - DiskName *string `json:"diskName,omitempty"` - DiskType StorageType `json:"diskType,omitempty"` -} - -// BulkCreationParameters is parameters for creating multiple virtual machines -// as a single action. -type BulkCreationParameters struct { - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// CloudError is error from a REST request. -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody is body of an error from a REST request. -type CloudErrorBody struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ComputeDataDisk is a data disks attached to a virtual machine. -type ComputeDataDisk struct { - Name *string `json:"name,omitempty"` - DiskURI *string `json:"diskUri,omitempty"` - ManagedDiskID *string `json:"managedDiskId,omitempty"` - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` -} - -// ComputeDataDiskFragment is a data disks attached to a virtual machine. -type ComputeDataDiskFragment struct { - Name *string `json:"name,omitempty"` - DiskURI *string `json:"diskUri,omitempty"` - ManagedDiskID *string `json:"managedDiskId,omitempty"` - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` -} - -// ComputeVMInstanceViewStatus is status information about a virtual machine. -type ComputeVMInstanceViewStatus struct { - Code *string `json:"code,omitempty"` - DisplayStatus *string `json:"displayStatus,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ComputeVMInstanceViewStatusFragment is status information about a virtual -// machine. -type ComputeVMInstanceViewStatusFragment struct { - Code *string `json:"code,omitempty"` - DisplayStatus *string `json:"displayStatus,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ComputeVMProperties is properties of a virtual machine returned by the -// Microsoft.Compute API. -type ComputeVMProperties struct { - Statuses *[]ComputeVMInstanceViewStatus `json:"statuses,omitempty"` - OsType *string `json:"osType,omitempty"` - VMSize *string `json:"vmSize,omitempty"` - NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` - OsDiskID *string `json:"osDiskId,omitempty"` - DataDiskIds *[]string `json:"dataDiskIds,omitempty"` - DataDisks *[]ComputeDataDisk `json:"dataDisks,omitempty"` -} - -// ComputeVMPropertiesFragment is properties of a virtual machine returned by -// the Microsoft.Compute API. -type ComputeVMPropertiesFragment struct { - Statuses *[]ComputeVMInstanceViewStatusFragment `json:"statuses,omitempty"` - OsType *string `json:"osType,omitempty"` - VMSize *string `json:"vmSize,omitempty"` - NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` - OsDiskID *string `json:"osDiskId,omitempty"` - DataDiskIds *[]string `json:"dataDiskIds,omitempty"` - DataDisks *[]ComputeDataDiskFragment `json:"dataDisks,omitempty"` -} - -// CostThresholdProperties is properties of a cost threshold item. -type CostThresholdProperties struct { - ThresholdID *string `json:"thresholdId,omitempty"` - PercentageThreshold *PercentageCostThresholdProperties `json:"percentageThreshold,omitempty"` - DisplayOnChart CostThresholdStatus `json:"displayOnChart,omitempty"` - SendNotificationWhenExceeded CostThresholdStatus `json:"sendNotificationWhenExceeded,omitempty"` - NotificationSent *string `json:"NotificationSent,omitempty"` -} - -// CustomImage is a custom image. -type CustomImage struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CustomImageProperties `json:"properties,omitempty"` -} - -// CustomImageProperties is properties of a custom image. -type CustomImageProperties struct { - VM *CustomImagePropertiesFromVM `json:"vm,omitempty"` - Vhd *CustomImagePropertiesCustom `json:"vhd,omitempty"` - Description *string `json:"description,omitempty"` - Author *string `json:"author,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` - ManagedImageID *string `json:"managedImageId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// CustomImagePropertiesCustom is properties for creating a custom image from a -// VHD. -type CustomImagePropertiesCustom struct { - ImageName *string `json:"imageName,omitempty"` - SysPrep *bool `json:"sysPrep,omitempty"` - OsType CustomImageOsType `json:"osType,omitempty"` -} - -// CustomImagePropertiesFromVM is properties for creating a custom image from a -// virtual machine. -type CustomImagePropertiesFromVM struct { - SourceVMID *string `json:"sourceVmId,omitempty"` - WindowsOsInfo *WindowsOsInfo `json:"windowsOsInfo,omitempty"` - LinuxOsInfo *LinuxOsInfo `json:"linuxOsInfo,omitempty"` -} - -// DataDiskProperties is request body for adding a new or existing data disk to -// a virtual machine. -type DataDiskProperties struct { - AttachNewDataDiskOptions *AttachNewDataDiskOptions `json:"attachNewDataDiskOptions,omitempty"` - ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` - HostCaching HostCachingOptions `json:"hostCaching,omitempty"` -} - -// DayDetails is properties of a daily schedule. -type DayDetails struct { - Time *string `json:"time,omitempty"` -} - -// DayDetailsFragment is properties of a daily schedule. -type DayDetailsFragment struct { - Time *string `json:"time,omitempty"` -} - -// DetachDataDiskProperties is request body for detaching data disk from a -// virtual machine. -type DetachDataDiskProperties struct { - ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` -} - -// DetachDiskProperties is properties of the disk to detach. -type DetachDiskProperties struct { - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` -} - -// Disk is a Disk. -type Disk struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DiskProperties `json:"properties,omitempty"` -} - -// DiskProperties is properties of a disk. -type DiskProperties struct { - DiskType StorageType `json:"diskType,omitempty"` - DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` - LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` - DiskBlobName *string `json:"diskBlobName,omitempty"` - DiskURI *string `json:"diskUri,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - HostCaching *string `json:"hostCaching,omitempty"` - ManagedDiskID *string `json:"managedDiskId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// DtlEnvironment is an environment, which is essentially an ARM template -// deployment. -type DtlEnvironment struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *EnvironmentProperties `json:"properties,omitempty"` -} - -// EnvironmentDeploymentProperties is properties of an environment deployment. -type EnvironmentDeploymentProperties struct { - ArmTemplateID *string `json:"armTemplateId,omitempty"` - Parameters *[]ArmTemplateParameterProperties `json:"parameters,omitempty"` -} - -// EnvironmentProperties is properties of an environment. -type EnvironmentProperties struct { - DeploymentProperties *EnvironmentDeploymentProperties `json:"deploymentProperties,omitempty"` - ArmTemplateDisplayName *string `json:"armTemplateDisplayName,omitempty"` - ResourceGroupID *string `json:"resourceGroupId,omitempty"` - CreatedByUser *string `json:"createdByUser,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// EvaluatePoliciesProperties is properties for evaluating a policy set. -type EvaluatePoliciesProperties struct { - FactName *string `json:"factName,omitempty"` - FactData *string `json:"factData,omitempty"` - ValueOffset *string `json:"valueOffset,omitempty"` -} - -// EvaluatePoliciesRequest is request body for evaluating a policy set. -type EvaluatePoliciesRequest struct { - Policies *[]EvaluatePoliciesProperties `json:"policies,omitempty"` -} - -// EvaluatePoliciesResponse is response body for evaluating a policy set. -type EvaluatePoliciesResponse struct { - autorest.Response `json:"-"` - Results *[]PolicySetResult `json:"results,omitempty"` -} - -// Event is an event to be notified for. -type Event struct { - EventName NotificationChannelEventType `json:"eventName,omitempty"` -} - -// EventFragment is an event to be notified for. -type EventFragment struct { - EventName NotificationChannelEventType `json:"eventName,omitempty"` -} - -// ExportResourceUsageParameters is the parameters of the export operation. -type ExportResourceUsageParameters struct { - BlobStorageAbsoluteSasURI *string `json:"blobStorageAbsoluteSasUri,omitempty"` - UsageStartDate *date.Time `json:"usageStartDate,omitempty"` -} - -// ExternalSubnet is subnet information as returned by the Microsoft.Network -// API. -type ExternalSubnet struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -// ExternalSubnetFragment is subnet information as returned by the -// Microsoft.Network API. -type ExternalSubnetFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -// Formula is a formula for creating a VM, specifying an image base and other -// parameters -type Formula struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *FormulaProperties `json:"properties,omitempty"` -} - -// FormulaProperties is properties of a formula. -type FormulaProperties struct { - Description *string `json:"description,omitempty"` - Author *string `json:"author,omitempty"` - OsType *string `json:"osType,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` - FormulaContent *LabVirtualMachineCreationParameter `json:"formulaContent,omitempty"` - VM *FormulaPropertiesFromVM `json:"vm,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// FormulaPropertiesFromVM is information about a VM from which a formula is to -// be created. -type FormulaPropertiesFromVM struct { - LabVMID *string `json:"labVmId,omitempty"` -} - -// GalleryImage is a gallery image. -type GalleryImage struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *GalleryImageProperties `json:"properties,omitempty"` -} - -// GalleryImageProperties is properties of a gallery image. -type GalleryImageProperties struct { - Author *string `json:"author,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - Description *string `json:"description,omitempty"` - ImageReference *GalleryImageReference `json:"imageReference,omitempty"` - Icon *string `json:"icon,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// GalleryImageReference is the reference information for an Azure Marketplace -// image. -type GalleryImageReference struct { - Offer *string `json:"offer,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Sku *string `json:"sku,omitempty"` - OsType *string `json:"osType,omitempty"` - Version *string `json:"version,omitempty"` -} - -// GalleryImageReferenceFragment is the reference information for an Azure -// Marketplace image. -type GalleryImageReferenceFragment struct { - Offer *string `json:"offer,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Sku *string `json:"sku,omitempty"` - OsType *string `json:"osType,omitempty"` - Version *string `json:"version,omitempty"` -} - -// GenerateArmTemplateRequest is parameters for generating an ARM template for -// deploying artifacts. -type GenerateArmTemplateRequest struct { - VirtualMachineName *string `json:"virtualMachineName,omitempty"` - Parameters *[]ParameterInfo `json:"parameters,omitempty"` - Location *string `json:"location,omitempty"` - FileUploadOptions FileUploadOptions `json:"fileUploadOptions,omitempty"` -} - -// GenerateUploadURIParameter is properties for generating an upload URI. -type GenerateUploadURIParameter struct { - BlobName *string `json:"blobName,omitempty"` -} - -// GenerateUploadURIResponse is reponse body for generating an upload URI. -type GenerateUploadURIResponse struct { - autorest.Response `json:"-"` - UploadURI *string `json:"uploadUri,omitempty"` -} - -// HourDetails is properties of an hourly schedule. -type HourDetails struct { - Minute *int32 `json:"minute,omitempty"` -} - -// HourDetailsFragment is properties of an hourly schedule. -type HourDetailsFragment struct { - Minute *int32 `json:"minute,omitempty"` -} - -// IdentityProperties is identityProperties -type IdentityProperties struct { - Type *string `json:"type,omitempty"` - PrincipalID *string `json:"principalId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - ClientSecretURL *string `json:"clientSecretUrl,omitempty"` -} - -// InboundNatRule is a rule for NAT - exposing a VM's port (backendPort) on the -// public IP address using a load balancer. -type InboundNatRule struct { - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - FrontendPort *int32 `json:"frontendPort,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// InboundNatRuleFragment is a rule for NAT - exposing a VM's port -// (backendPort) on the public IP address using a load balancer. -type InboundNatRuleFragment struct { - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - FrontendPort *int32 `json:"frontendPort,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// Lab is a lab. -type Lab struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LabProperties `json:"properties,omitempty"` -} - -// LabCost is a cost item. -type LabCost struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LabCostProperties `json:"properties,omitempty"` -} - -// LabCostDetailsProperties is the properties of a lab cost item. -type LabCostDetailsProperties struct { - Date *date.Time `json:"date,omitempty"` - Cost *float64 `json:"cost,omitempty"` - CostType CostType `json:"costType,omitempty"` -} - -// LabCostProperties is properties of a cost item. -type LabCostProperties struct { - TargetCost *TargetCostProperties `json:"targetCost,omitempty"` - LabCostSummary *LabCostSummaryProperties `json:"labCostSummary,omitempty"` - LabCostDetails *[]LabCostDetailsProperties `json:"labCostDetails,omitempty"` - ResourceCosts *[]LabResourceCostProperties `json:"resourceCosts,omitempty"` - CurrencyCode *string `json:"currencyCode,omitempty"` - StartDateTime *date.Time `json:"startDateTime,omitempty"` - EndDateTime *date.Time `json:"endDateTime,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// LabCostSummaryProperties is the properties of the cost summary. -type LabCostSummaryProperties struct { - EstimatedLabCost *float64 `json:"estimatedLabCost,omitempty"` -} - -// LabFragment is a lab. -type LabFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LabPropertiesFragment `json:"properties,omitempty"` -} - -// LabProperties is properties of a lab. -type LabProperties struct { - DefaultStorageAccount *string `json:"defaultStorageAccount,omitempty"` - DefaultPremiumStorageAccount *string `json:"defaultPremiumStorageAccount,omitempty"` - ArtifactsStorageAccount *string `json:"artifactsStorageAccount,omitempty"` - PremiumDataDiskStorageAccount *string `json:"premiumDataDiskStorageAccount,omitempty"` - VaultName *string `json:"vaultName,omitempty"` - LabStorageType StorageType `json:"labStorageType,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// LabPropertiesFragment is properties of a lab. -type LabPropertiesFragment struct { - LabStorageType StorageType `json:"labStorageType,omitempty"` - PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// LabResourceCostProperties is the properties of a resource cost item. -type LabResourceCostProperties struct { - Resourcename *string `json:"resourcename,omitempty"` - ResourceUID *string `json:"resourceUId,omitempty"` - ResourceCost *float64 `json:"resourceCost,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` - ResourceOwner *string `json:"resourceOwner,omitempty"` - ResourcePricingTier *string `json:"resourcePricingTier,omitempty"` - ResourceStatus *string `json:"resourceStatus,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - ExternalResourceID *string `json:"externalResourceId,omitempty"` -} - -// LabVhd is properties of a VHD in the lab. -type LabVhd struct { - ID *string `json:"id,omitempty"` -} - -// LabVirtualMachine is a virtual machine. -type LabVirtualMachine struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LabVirtualMachineProperties `json:"properties,omitempty"` -} - -// LabVirtualMachineCreationParameter is properties for creating a virtual -// machine. -type LabVirtualMachineCreationParameter struct { - *LabVirtualMachineCreationParameterProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// LabVirtualMachineCreationParameterProperties is properties for virtual -// machine creation. -type LabVirtualMachineCreationParameterProperties struct { - BulkCreationParameters *BulkCreationParameters `json:"bulkCreationParameters,omitempty"` - Notes *string `json:"notes,omitempty"` - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - CreatedByUserID *string `json:"createdByUserId,omitempty"` - CreatedByUser *string `json:"createdByUser,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - CustomImageID *string `json:"customImageId,omitempty"` - OsType *string `json:"osType,omitempty"` - Size *string `json:"size,omitempty"` - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` - SSHKey *string `json:"sshKey,omitempty"` - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` - ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` - GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` - ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` - NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` - ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - AllowClaim *bool `json:"allowClaim,omitempty"` - StorageType *string `json:"storageType,omitempty"` - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - EnvironmentID *string `json:"environmentId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// LabVirtualMachineFragment is a virtual machine. -type LabVirtualMachineFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LabVirtualMachinePropertiesFragment `json:"properties,omitempty"` -} - -// LabVirtualMachineProperties is properties of a virtual machine. -type LabVirtualMachineProperties struct { - Notes *string `json:"notes,omitempty"` - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - CreatedByUserID *string `json:"createdByUserId,omitempty"` - CreatedByUser *string `json:"createdByUser,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ComputeID *string `json:"computeId,omitempty"` - CustomImageID *string `json:"customImageId,omitempty"` - OsType *string `json:"osType,omitempty"` - Size *string `json:"size,omitempty"` - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` - SSHKey *string `json:"sshKey,omitempty"` - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` - ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` - GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` - ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` - NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` - ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - AllowClaim *bool `json:"allowClaim,omitempty"` - StorageType *string `json:"storageType,omitempty"` - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - EnvironmentID *string `json:"environmentId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// LabVirtualMachinePropertiesFragment is properties of a virtual machine. -type LabVirtualMachinePropertiesFragment struct { - Notes *string `json:"notes,omitempty"` - OwnerObjectID *string `json:"ownerObjectId,omitempty"` - OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` - CreatedByUserID *string `json:"createdByUserId,omitempty"` - CreatedByUser *string `json:"createdByUser,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - CustomImageID *string `json:"customImageId,omitempty"` - OsType *string `json:"osType,omitempty"` - Size *string `json:"size,omitempty"` - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` - SSHKey *string `json:"sshKey,omitempty"` - IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` - DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` - Artifacts *[]ArtifactInstallPropertiesFragment `json:"artifacts,omitempty"` - ArtifactDeploymentStatus *ArtifactDeploymentStatusPropertiesFragment `json:"artifactDeploymentStatus,omitempty"` - GalleryImageReference *GalleryImageReferenceFragment `json:"galleryImageReference,omitempty"` - ComputeVM *ComputeVMPropertiesFragment `json:"computeVm,omitempty"` - NetworkInterface *NetworkInterfacePropertiesFragment `json:"networkInterface,omitempty"` - ApplicableSchedule *ApplicableScheduleFragment `json:"applicableSchedule,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - AllowClaim *bool `json:"allowClaim,omitempty"` - StorageType *string `json:"storageType,omitempty"` - VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` - EnvironmentID *string `json:"environmentId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// LinuxOsInfo is information about a Linux OS. -type LinuxOsInfo struct { - LinuxOsState LinuxOsState `json:"linuxOsState,omitempty"` -} - -// NetworkInterfaceProperties is properties of a network interface. -type NetworkInterfaceProperties struct { - VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` - DNSName *string `json:"dnsName,omitempty"` - RdpAuthority *string `json:"rdpAuthority,omitempty"` - SSHAuthority *string `json:"sshAuthority,omitempty"` - SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` -} - -// NetworkInterfacePropertiesFragment is properties of a network interface. -type NetworkInterfacePropertiesFragment struct { - VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` - PublicIPAddress *string `json:"publicIpAddress,omitempty"` - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` - DNSName *string `json:"dnsName,omitempty"` - RdpAuthority *string `json:"rdpAuthority,omitempty"` - SSHAuthority *string `json:"sshAuthority,omitempty"` - SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` -} - -// NotificationChannel is a notification. -type NotificationChannel struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *NotificationChannelProperties `json:"properties,omitempty"` -} - -// NotificationChannelFragment is a notification. -type NotificationChannelFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *NotificationChannelPropertiesFragment `json:"properties,omitempty"` -} - -// NotificationChannelProperties is properties of a schedule. -type NotificationChannelProperties struct { - WebHookURL *string `json:"webHookUrl,omitempty"` - Description *string `json:"description,omitempty"` - Events *[]Event `json:"events,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// NotificationChannelPropertiesFragment is properties of a schedule. -type NotificationChannelPropertiesFragment struct { - WebHookURL *string `json:"webHookUrl,omitempty"` - Description *string `json:"description,omitempty"` - Events *[]EventFragment `json:"events,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// NotificationSettings is notification settings for a schedule. -type NotificationSettings struct { - Status NotificationStatus `json:"status,omitempty"` - TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` - WebhookURL *string `json:"webhookUrl,omitempty"` -} - -// NotificationSettingsFragment is notification settings for a schedule. -type NotificationSettingsFragment struct { - Status NotificationStatus `json:"status,omitempty"` - TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` - WebhookURL *string `json:"webhookUrl,omitempty"` -} - -// NotifyParameters is properties for generating a Notification. -type NotifyParameters struct { - EventName NotificationChannelEventType `json:"eventName,omitempty"` - JSONPayload *string `json:"jsonPayload,omitempty"` -} - -// ParameterInfo is information about an artifact's parameter. -type ParameterInfo struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ParametersValueFileInfo is a file containing a set of parameter values for -// an ARM template. -type ParametersValueFileInfo struct { - FileName *string `json:"fileName,omitempty"` - ParametersValueInfo *map[string]interface{} `json:"parametersValueInfo,omitempty"` -} - -// PercentageCostThresholdProperties is properties of a percentage cost -// threshold. -type PercentageCostThresholdProperties struct { - ThresholdValue *float64 `json:"thresholdValue,omitempty"` -} - -// Policy is a Policy. -type Policy struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *PolicyProperties `json:"properties,omitempty"` -} - -// PolicyFragment is a Policy. -type PolicyFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *PolicyPropertiesFragment `json:"properties,omitempty"` -} - -// PolicyProperties is properties of a Policy. -type PolicyProperties struct { - Description *string `json:"description,omitempty"` - Status PolicyStatus `json:"status,omitempty"` - FactName PolicyFactName `json:"factName,omitempty"` - FactData *string `json:"factData,omitempty"` - Threshold *string `json:"threshold,omitempty"` - EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// PolicyPropertiesFragment is properties of a Policy. -type PolicyPropertiesFragment struct { - Description *string `json:"description,omitempty"` - Status PolicyStatus `json:"status,omitempty"` - FactName PolicyFactName `json:"factName,omitempty"` - FactData *string `json:"factData,omitempty"` - Threshold *string `json:"threshold,omitempty"` - EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// PolicySetResult is result of a policy set evaluation. -type PolicySetResult struct { - HasError *bool `json:"hasError,omitempty"` - PolicyViolations *[]PolicyViolation `json:"policyViolations,omitempty"` -} - -// PolicyViolation is policy violation. -type PolicyViolation struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// Port is properties of a network port. -type Port struct { - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// PortFragment is properties of a network port. -type PortFragment struct { - TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` -} - -// Resource is an Azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResponseWithContinuationArmTemplate is the response of a list operation. -type ResponseWithContinuationArmTemplate struct { - autorest.Response `json:"-"` - Value *[]ArmTemplate `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationArmTemplatePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationArmTemplate) ResponseWithContinuationArmTemplatePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationArtifact is the response of a list operation. -type ResponseWithContinuationArtifact struct { - autorest.Response `json:"-"` - Value *[]Artifact `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationArtifactPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationArtifact) ResponseWithContinuationArtifactPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationArtifactSource is the response of a list operation. -type ResponseWithContinuationArtifactSource struct { - autorest.Response `json:"-"` - Value *[]ArtifactSource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationArtifactSourcePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationArtifactSource) ResponseWithContinuationArtifactSourcePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationCustomImage is the response of a list operation. -type ResponseWithContinuationCustomImage struct { - autorest.Response `json:"-"` - Value *[]CustomImage `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationCustomImagePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationCustomImage) ResponseWithContinuationCustomImagePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationDisk is the response of a list operation. -type ResponseWithContinuationDisk struct { - autorest.Response `json:"-"` - Value *[]Disk `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationDiskPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationDisk) ResponseWithContinuationDiskPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationDtlEnvironment is the response of a list operation. -type ResponseWithContinuationDtlEnvironment struct { - autorest.Response `json:"-"` - Value *[]DtlEnvironment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationDtlEnvironmentPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationDtlEnvironment) ResponseWithContinuationDtlEnvironmentPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationFormula is the response of a list operation. -type ResponseWithContinuationFormula struct { - autorest.Response `json:"-"` - Value *[]Formula `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationFormulaPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationFormula) ResponseWithContinuationFormulaPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationGalleryImage is the response of a list operation. -type ResponseWithContinuationGalleryImage struct { - autorest.Response `json:"-"` - Value *[]GalleryImage `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationGalleryImagePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationGalleryImage) ResponseWithContinuationGalleryImagePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationLab is the response of a list operation. -type ResponseWithContinuationLab struct { - autorest.Response `json:"-"` - Value *[]Lab `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationLabPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationLab) ResponseWithContinuationLabPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationLabVhd is the response of a list operation. -type ResponseWithContinuationLabVhd struct { - autorest.Response `json:"-"` - Value *[]LabVhd `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationLabVhdPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationLabVhd) ResponseWithContinuationLabVhdPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationLabVirtualMachine is the response of a list -// operation. -type ResponseWithContinuationLabVirtualMachine struct { - autorest.Response `json:"-"` - Value *[]LabVirtualMachine `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationLabVirtualMachinePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationLabVirtualMachine) ResponseWithContinuationLabVirtualMachinePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationNotificationChannel is the response of a list -// operation. -type ResponseWithContinuationNotificationChannel struct { - autorest.Response `json:"-"` - Value *[]NotificationChannel `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationNotificationChannelPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationNotificationChannel) ResponseWithContinuationNotificationChannelPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationPolicy is the response of a list operation. -type ResponseWithContinuationPolicy struct { - autorest.Response `json:"-"` - Value *[]Policy `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationPolicyPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationPolicy) ResponseWithContinuationPolicyPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationSchedule is the response of a list operation. -type ResponseWithContinuationSchedule struct { - autorest.Response `json:"-"` - Value *[]Schedule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationSchedulePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationSchedule) ResponseWithContinuationSchedulePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationSecret is the response of a list operation. -type ResponseWithContinuationSecret struct { - autorest.Response `json:"-"` - Value *[]Secret `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationSecretPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationSecret) ResponseWithContinuationSecretPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationServiceRunner is the response of a list operation. -type ResponseWithContinuationServiceRunner struct { - autorest.Response `json:"-"` - Value *[]ServiceRunner `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationServiceRunnerPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationServiceRunner) ResponseWithContinuationServiceRunnerPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationUser is the response of a list operation. -type ResponseWithContinuationUser struct { - autorest.Response `json:"-"` - Value *[]User `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationUserPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationUser) ResponseWithContinuationUserPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResponseWithContinuationVirtualNetwork is the response of a list operation. -type ResponseWithContinuationVirtualNetwork struct { - autorest.Response `json:"-"` - Value *[]VirtualNetwork `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResponseWithContinuationVirtualNetworkPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResponseWithContinuationVirtualNetwork) ResponseWithContinuationVirtualNetworkPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RetargetScheduleProperties is properties for retargeting a virtual machine -// schedule. -type RetargetScheduleProperties struct { - CurrentResourceID *string `json:"currentResourceId,omitempty"` - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// Schedule is a schedule. -type Schedule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ScheduleProperties `json:"properties,omitempty"` -} - -// ScheduleFragment is a schedule. -type ScheduleFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SchedulePropertiesFragment `json:"properties,omitempty"` -} - -// ScheduleProperties is properties of a schedule. -type ScheduleProperties struct { - Status EnableStatus `json:"status,omitempty"` - TaskType *string `json:"taskType,omitempty"` - WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` - DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` - HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` - TimeZoneID *string `json:"timeZoneId,omitempty"` - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - TargetResourceID *string `json:"targetResourceId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// SchedulePropertiesFragment is properties of a schedule. -type SchedulePropertiesFragment struct { - Status EnableStatus `json:"status,omitempty"` - TaskType *string `json:"taskType,omitempty"` - WeeklyRecurrence *WeekDetailsFragment `json:"weeklyRecurrence,omitempty"` - DailyRecurrence *DayDetailsFragment `json:"dailyRecurrence,omitempty"` - HourlyRecurrence *HourDetailsFragment `json:"hourlyRecurrence,omitempty"` - TimeZoneID *string `json:"timeZoneId,omitempty"` - NotificationSettings *NotificationSettingsFragment `json:"notificationSettings,omitempty"` - TargetResourceID *string `json:"targetResourceId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// Secret is a secret. -type Secret struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SecretProperties `json:"properties,omitempty"` -} - -// SecretProperties is properties of a secret. -type SecretProperties struct { - Value *string `json:"value,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// ServiceRunner is a container for a managed identity to execute DevTest lab -// services. -type ServiceRunner struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Identity *IdentityProperties `json:"identity,omitempty"` -} - -// SharedPublicIPAddressConfiguration is properties of a virtual machine that -// determine how it is connected to a load balancer. -type SharedPublicIPAddressConfiguration struct { - InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` -} - -// SharedPublicIPAddressConfigurationFragment is properties of a virtual -// machine that determine how it is connected to a load balancer. -type SharedPublicIPAddressConfigurationFragment struct { - InboundNatRules *[]InboundNatRuleFragment `json:"inboundNatRules,omitempty"` -} - -// ShutdownNotificationContent is the contents of a shutdown notification. -// Webhooks can use this type to deserialize the request body when they get -// notified of an imminent shutdown. -type ShutdownNotificationContent struct { - SkipURL *string `json:"skipUrl,omitempty"` - DelayURL60 *string `json:"delayUrl60,omitempty"` - DelayURL120 *string `json:"delayUrl120,omitempty"` - VMName *string `json:"vmName,omitempty"` - GUID *string `json:"guid,omitempty"` - Owner *string `json:"owner,omitempty"` - EventType *string `json:"eventType,omitempty"` - Text *string `json:"text,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - LabName *string `json:"labName,omitempty"` -} - -// Subnet is subnet information. -type Subnet struct { - ResourceID *string `json:"resourceId,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` -} - -// SubnetFragment is subnet information. -type SubnetFragment struct { - ResourceID *string `json:"resourceId,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` -} - -// SubnetOverride is property overrides on a subnet of a virtual network. -type SubnetOverride struct { - ResourceID *string `json:"resourceId,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` - UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` - SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` - VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` -} - -// SubnetOverrideFragment is property overrides on a subnet of a virtual -// network. -type SubnetOverrideFragment struct { - ResourceID *string `json:"resourceId,omitempty"` - LabSubnetName *string `json:"labSubnetName,omitempty"` - UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` - UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` - SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` - VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` -} - -// SubnetSharedPublicIPAddressConfiguration is configuration for public IP -// address sharing. -type SubnetSharedPublicIPAddressConfiguration struct { - AllowedPorts *[]Port `json:"allowedPorts,omitempty"` -} - -// SubnetSharedPublicIPAddressConfigurationFragment is configuration for public -// IP address sharing. -type SubnetSharedPublicIPAddressConfigurationFragment struct { - AllowedPorts *[]PortFragment `json:"allowedPorts,omitempty"` -} - -// TargetCostProperties is properties of a cost target. -type TargetCostProperties struct { - Status TargetCostStatus `json:"status,omitempty"` - Target *int32 `json:"target,omitempty"` - CostThresholds *[]CostThresholdProperties `json:"costThresholds,omitempty"` - CycleStartDateTime *date.Time `json:"cycleStartDateTime,omitempty"` - CycleEndDateTime *date.Time `json:"cycleEndDateTime,omitempty"` - CycleType ReportingCycleType `json:"cycleType,omitempty"` -} - -// User is profile of a lab user. -type User struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *UserProperties `json:"properties,omitempty"` -} - -// UserFragment is profile of a lab user. -type UserFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *UserPropertiesFragment `json:"properties,omitempty"` -} - -// UserIdentity is identity attributes of a lab user. -type UserIdentity struct { - PrincipalName *string `json:"principalName,omitempty"` - PrincipalID *string `json:"principalId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - ObjectID *string `json:"objectId,omitempty"` - AppID *string `json:"appId,omitempty"` -} - -// UserIdentityFragment is identity attributes of a lab user. -type UserIdentityFragment struct { - PrincipalName *string `json:"principalName,omitempty"` - PrincipalID *string `json:"principalId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - ObjectID *string `json:"objectId,omitempty"` - AppID *string `json:"appId,omitempty"` -} - -// UserProperties is properties of a lab user profile. -type UserProperties struct { - Identity *UserIdentity `json:"identity,omitempty"` - SecretStore *UserSecretStore `json:"secretStore,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// UserPropertiesFragment is properties of a lab user profile. -type UserPropertiesFragment struct { - Identity *UserIdentityFragment `json:"identity,omitempty"` - SecretStore *UserSecretStoreFragment `json:"secretStore,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// UserSecretStore is properties of a user's secret store. -type UserSecretStore struct { - KeyVaultURI *string `json:"keyVaultUri,omitempty"` - KeyVaultID *string `json:"keyVaultId,omitempty"` -} - -// UserSecretStoreFragment is properties of a user's secret store. -type UserSecretStoreFragment struct { - KeyVaultURI *string `json:"keyVaultUri,omitempty"` - KeyVaultID *string `json:"keyVaultId,omitempty"` -} - -// VirtualNetwork is a virtual network. -type VirtualNetwork struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualNetworkProperties `json:"properties,omitempty"` -} - -// VirtualNetworkFragment is a virtual network. -type VirtualNetworkFragment struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualNetworkPropertiesFragment `json:"properties,omitempty"` -} - -// VirtualNetworkProperties is properties of a virtual network. -type VirtualNetworkProperties struct { - AllowedSubnets *[]Subnet `json:"allowedSubnets,omitempty"` - Description *string `json:"description,omitempty"` - ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` - ExternalSubnets *[]ExternalSubnet `json:"externalSubnets,omitempty"` - SubnetOverrides *[]SubnetOverride `json:"subnetOverrides,omitempty"` - CreatedDate *date.Time `json:"createdDate,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// VirtualNetworkPropertiesFragment is properties of a virtual network. -type VirtualNetworkPropertiesFragment struct { - AllowedSubnets *[]SubnetFragment `json:"allowedSubnets,omitempty"` - Description *string `json:"description,omitempty"` - ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` - ExternalSubnets *[]ExternalSubnetFragment `json:"externalSubnets,omitempty"` - SubnetOverrides *[]SubnetOverrideFragment `json:"subnetOverrides,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` -} - -// WeekDetails is properties of a weekly schedule. -type WeekDetails struct { - Weekdays *[]string `json:"weekdays,omitempty"` - Time *string `json:"time,omitempty"` -} - -// WeekDetailsFragment is properties of a weekly schedule. -type WeekDetailsFragment struct { - Weekdays *[]string `json:"weekdays,omitempty"` - Time *string `json:"time,omitempty"` -} - -// WindowsOsInfo is information about a Windows OS. -type WindowsOsInfo struct { - WindowsOsState WindowsOsState `json:"windowsOsState,omitempty"` -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// CostThresholdStatus enumerates the values for cost threshold status. +type CostThresholdStatus string + +const ( + // Disabled specifies the disabled state for cost threshold status. + Disabled CostThresholdStatus = "Disabled" + // Enabled specifies the enabled state for cost threshold status. + Enabled CostThresholdStatus = "Enabled" +) + +// CostType enumerates the values for cost type. +type CostType string + +const ( + // Projected specifies the projected state for cost type. + Projected CostType = "Projected" + // Reported specifies the reported state for cost type. + Reported CostType = "Reported" + // Unavailable specifies the unavailable state for cost type. + Unavailable CostType = "Unavailable" +) + +// CustomImageOsType enumerates the values for custom image os type. +type CustomImageOsType string + +const ( + // Linux specifies the linux state for custom image os type. + Linux CustomImageOsType = "Linux" + // None specifies the none state for custom image os type. + None CustomImageOsType = "None" + // Windows specifies the windows state for custom image os type. + Windows CustomImageOsType = "Windows" +) + +// EnableStatus enumerates the values for enable status. +type EnableStatus string + +const ( + // EnableStatusDisabled specifies the enable status disabled state for + // enable status. + EnableStatusDisabled EnableStatus = "Disabled" + // EnableStatusEnabled specifies the enable status enabled state for enable + // status. + EnableStatusEnabled EnableStatus = "Enabled" +) + +// FileUploadOptions enumerates the values for file upload options. +type FileUploadOptions string + +const ( + // FileUploadOptionsNone specifies the file upload options none state for + // file upload options. + FileUploadOptionsNone FileUploadOptions = "None" + // FileUploadOptionsUploadFilesAndGenerateSasTokens specifies the file + // upload options upload files and generate sas tokens state for file + // upload options. + FileUploadOptionsUploadFilesAndGenerateSasTokens FileUploadOptions = "UploadFilesAndGenerateSasTokens" +) + +// HostCachingOptions enumerates the values for host caching options. +type HostCachingOptions string + +const ( + // HostCachingOptionsNone specifies the host caching options none state for + // host caching options. + HostCachingOptionsNone HostCachingOptions = "None" + // HostCachingOptionsReadOnly specifies the host caching options read only + // state for host caching options. + HostCachingOptionsReadOnly HostCachingOptions = "ReadOnly" + // HostCachingOptionsReadWrite specifies the host caching options read + // write state for host caching options. + HostCachingOptionsReadWrite HostCachingOptions = "ReadWrite" +) + +// LinuxOsState enumerates the values for linux os state. +type LinuxOsState string + +const ( + // DeprovisionApplied specifies the deprovision applied state for linux os + // state. + DeprovisionApplied LinuxOsState = "DeprovisionApplied" + // DeprovisionRequested specifies the deprovision requested state for linux + // os state. + DeprovisionRequested LinuxOsState = "DeprovisionRequested" + // NonDeprovisioned specifies the non deprovisioned state for linux os + // state. + NonDeprovisioned LinuxOsState = "NonDeprovisioned" +) + +// NotificationChannelEventType enumerates the values for notification channel +// event type. +type NotificationChannelEventType string + +const ( + // AutoShutdown specifies the auto shutdown state for notification channel + // event type. + AutoShutdown NotificationChannelEventType = "AutoShutdown" + // Cost specifies the cost state for notification channel event type. + Cost NotificationChannelEventType = "Cost" +) + +// NotificationStatus enumerates the values for notification status. +type NotificationStatus string + +const ( + // NotificationStatusDisabled specifies the notification status disabled + // state for notification status. + NotificationStatusDisabled NotificationStatus = "Disabled" + // NotificationStatusEnabled specifies the notification status enabled + // state for notification status. + NotificationStatusEnabled NotificationStatus = "Enabled" +) + +// PolicyEvaluatorType enumerates the values for policy evaluator type. +type PolicyEvaluatorType string + +const ( + // AllowedValuesPolicy specifies the allowed values policy state for policy + // evaluator type. + AllowedValuesPolicy PolicyEvaluatorType = "AllowedValuesPolicy" + // MaxValuePolicy specifies the max value policy state for policy evaluator + // type. + MaxValuePolicy PolicyEvaluatorType = "MaxValuePolicy" +) + +// PolicyFactName enumerates the values for policy fact name. +type PolicyFactName string + +const ( + // PolicyFactNameGalleryImage specifies the policy fact name gallery image + // state for policy fact name. + PolicyFactNameGalleryImage PolicyFactName = "GalleryImage" + // PolicyFactNameLabPremiumVMCount specifies the policy fact name lab + // premium vm count state for policy fact name. + PolicyFactNameLabPremiumVMCount PolicyFactName = "LabPremiumVmCount" + // PolicyFactNameLabTargetCost specifies the policy fact name lab target + // cost state for policy fact name. + PolicyFactNameLabTargetCost PolicyFactName = "LabTargetCost" + // PolicyFactNameLabVMCount specifies the policy fact name lab vm count + // state for policy fact name. + PolicyFactNameLabVMCount PolicyFactName = "LabVmCount" + // PolicyFactNameLabVMSize specifies the policy fact name lab vm size state + // for policy fact name. + PolicyFactNameLabVMSize PolicyFactName = "LabVmSize" + // PolicyFactNameUserOwnedLabPremiumVMCount specifies the policy fact name + // user owned lab premium vm count state for policy fact name. + PolicyFactNameUserOwnedLabPremiumVMCount PolicyFactName = "UserOwnedLabPremiumVmCount" + // PolicyFactNameUserOwnedLabVMCount specifies the policy fact name user + // owned lab vm count state for policy fact name. + PolicyFactNameUserOwnedLabVMCount PolicyFactName = "UserOwnedLabVmCount" + // PolicyFactNameUserOwnedLabVMCountInSubnet specifies the policy fact name + // user owned lab vm count in subnet state for policy fact name. + PolicyFactNameUserOwnedLabVMCountInSubnet PolicyFactName = "UserOwnedLabVmCountInSubnet" +) + +// PolicyStatus enumerates the values for policy status. +type PolicyStatus string + +const ( + // PolicyStatusDisabled specifies the policy status disabled state for + // policy status. + PolicyStatusDisabled PolicyStatus = "Disabled" + // PolicyStatusEnabled specifies the policy status enabled state for policy + // status. + PolicyStatusEnabled PolicyStatus = "Enabled" +) + +// PremiumDataDisk enumerates the values for premium data disk. +type PremiumDataDisk string + +const ( + // PremiumDataDiskDisabled specifies the premium data disk disabled state + // for premium data disk. + PremiumDataDiskDisabled PremiumDataDisk = "Disabled" + // PremiumDataDiskEnabled specifies the premium data disk enabled state for + // premium data disk. + PremiumDataDiskEnabled PremiumDataDisk = "Enabled" +) + +// ReportingCycleType enumerates the values for reporting cycle type. +type ReportingCycleType string + +const ( + // CalendarMonth specifies the calendar month state for reporting cycle + // type. + CalendarMonth ReportingCycleType = "CalendarMonth" + // Custom specifies the custom state for reporting cycle type. + Custom ReportingCycleType = "Custom" +) + +// SourceControlType enumerates the values for source control type. +type SourceControlType string + +const ( + // GitHub specifies the git hub state for source control type. + GitHub SourceControlType = "GitHub" + // VsoGit specifies the vso git state for source control type. + VsoGit SourceControlType = "VsoGit" +) + +// StorageType enumerates the values for storage type. +type StorageType string + +const ( + // Premium specifies the premium state for storage type. + Premium StorageType = "Premium" + // Standard specifies the standard state for storage type. + Standard StorageType = "Standard" +) + +// TargetCostStatus enumerates the values for target cost status. +type TargetCostStatus string + +const ( + // TargetCostStatusDisabled specifies the target cost status disabled state + // for target cost status. + TargetCostStatusDisabled TargetCostStatus = "Disabled" + // TargetCostStatusEnabled specifies the target cost status enabled state + // for target cost status. + TargetCostStatusEnabled TargetCostStatus = "Enabled" +) + +// TransportProtocol enumerates the values for transport protocol. +type TransportProtocol string + +const ( + // TCP specifies the tcp state for transport protocol. + TCP TransportProtocol = "Tcp" + // UDP specifies the udp state for transport protocol. + UDP TransportProtocol = "Udp" +) + +// UsagePermissionType enumerates the values for usage permission type. +type UsagePermissionType string + +const ( + // Allow specifies the allow state for usage permission type. + Allow UsagePermissionType = "Allow" + // Default specifies the default state for usage permission type. + Default UsagePermissionType = "Default" + // Deny specifies the deny state for usage permission type. + Deny UsagePermissionType = "Deny" +) + +// VirtualMachineCreationSource enumerates the values for virtual machine +// creation source. +type VirtualMachineCreationSource string + +const ( + // FromCustomImage specifies the from custom image state for virtual + // machine creation source. + FromCustomImage VirtualMachineCreationSource = "FromCustomImage" + // FromGalleryImage specifies the from gallery image state for virtual + // machine creation source. + FromGalleryImage VirtualMachineCreationSource = "FromGalleryImage" +) + +// WindowsOsState enumerates the values for windows os state. +type WindowsOsState string + +const ( + // NonSysprepped specifies the non sysprepped state for windows os state. + NonSysprepped WindowsOsState = "NonSysprepped" + // SysprepApplied specifies the sysprep applied state for windows os state. + SysprepApplied WindowsOsState = "SysprepApplied" + // SysprepRequested specifies the sysprep requested state for windows os + // state. + SysprepRequested WindowsOsState = "SysprepRequested" +) + +// ApplicableSchedule is schedules applicable to a virtual machine. The +// schedules may have been defined on a VM or on lab level. +type ApplicableSchedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ApplicableScheduleProperties `json:"properties,omitempty"` +} + +// ApplicableScheduleFragment is schedules applicable to a virtual machine. The +// schedules may have been defined on a VM or on lab level. +type ApplicableScheduleFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ApplicableSchedulePropertiesFragment `json:"properties,omitempty"` +} + +// ApplicableScheduleProperties is properties of a schedules applicable to a +// virtual machine. +type ApplicableScheduleProperties struct { + LabVmsShutdown *Schedule `json:"labVmsShutdown,omitempty"` + LabVmsStartup *Schedule `json:"labVmsStartup,omitempty"` +} + +// ApplicableSchedulePropertiesFragment is properties of a schedules applicable +// to a virtual machine. +type ApplicableSchedulePropertiesFragment struct { + LabVmsShutdown *ScheduleFragment `json:"labVmsShutdown,omitempty"` + LabVmsStartup *ScheduleFragment `json:"labVmsStartup,omitempty"` +} + +// ApplyArtifactsRequest is request body for applying artifacts to a virtual +// machine. +type ApplyArtifactsRequest struct { + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` +} + +// ArmTemplate is an Azure Resource Manager template. +type ArmTemplate struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ArmTemplateProperties `json:"properties,omitempty"` +} + +// ArmTemplateInfo is information about a generated ARM template. +type ArmTemplateInfo struct { + autorest.Response `json:"-"` + Template *map[string]interface{} `json:"template,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` +} + +// ArmTemplateParameterProperties is properties of an Azure Resource Manager +// template parameter. +type ArmTemplateParameterProperties struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ArmTemplateProperties is properties of an Azure Resource Manager template. +type ArmTemplateProperties struct { + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Icon *string `json:"icon,omitempty"` + Contents *map[string]interface{} `json:"contents,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ParametersValueFilesInfo *[]ParametersValueFileInfo `json:"parametersValueFilesInfo,omitempty"` +} + +// Artifact is an artifact. +type Artifact struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ArtifactProperties `json:"properties,omitempty"` +} + +// ArtifactDeploymentStatusProperties is properties of an artifact deployment. +type ArtifactDeploymentStatusProperties struct { + DeploymentStatus *string `json:"deploymentStatus,omitempty"` + ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` + TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` +} + +// ArtifactDeploymentStatusPropertiesFragment is properties of an artifact +// deployment. +type ArtifactDeploymentStatusPropertiesFragment struct { + DeploymentStatus *string `json:"deploymentStatus,omitempty"` + ArtifactsApplied *int32 `json:"artifactsApplied,omitempty"` + TotalArtifacts *int32 `json:"totalArtifacts,omitempty"` +} + +// ArtifactInstallProperties is properties of an artifact. +type ArtifactInstallProperties struct { + ArtifactID *string `json:"artifactId,omitempty"` + Parameters *[]ArtifactParameterProperties `json:"parameters,omitempty"` + Status *string `json:"status,omitempty"` + DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` + VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` + InstallTime *date.Time `json:"installTime,omitempty"` +} + +// ArtifactInstallPropertiesFragment is properties of an artifact. +type ArtifactInstallPropertiesFragment struct { + ArtifactID *string `json:"artifactId,omitempty"` + Parameters *[]ArtifactParameterPropertiesFragment `json:"parameters,omitempty"` + Status *string `json:"status,omitempty"` + DeploymentStatusMessage *string `json:"deploymentStatusMessage,omitempty"` + VMExtensionStatusMessage *string `json:"vmExtensionStatusMessage,omitempty"` + InstallTime *date.Time `json:"installTime,omitempty"` +} + +// ArtifactParameterProperties is properties of an artifact parameter. +type ArtifactParameterProperties struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ArtifactParameterPropertiesFragment is properties of an artifact parameter. +type ArtifactParameterPropertiesFragment struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ArtifactProperties is properties of an artifact. +type ArtifactProperties struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Publisher *string `json:"publisher,omitempty"` + FilePath *string `json:"filePath,omitempty"` + Icon *string `json:"icon,omitempty"` + TargetOsType *string `json:"targetOsType,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` +} + +// ArtifactSource is properties of an artifact source. +type ArtifactSource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ArtifactSourceProperties `json:"properties,omitempty"` +} + +// ArtifactSourceFragment is properties of an artifact source. +type ArtifactSourceFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ArtifactSourcePropertiesFragment `json:"properties,omitempty"` +} + +// ArtifactSourceProperties is properties of an artifact source. +type ArtifactSourceProperties struct { + DisplayName *string `json:"displayName,omitempty"` + URI *string `json:"uri,omitempty"` + SourceType SourceControlType `json:"sourceType,omitempty"` + FolderPath *string `json:"folderPath,omitempty"` + ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` + BranchRef *string `json:"branchRef,omitempty"` + SecurityToken *string `json:"securityToken,omitempty"` + Status EnableStatus `json:"status,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// ArtifactSourcePropertiesFragment is properties of an artifact source. +type ArtifactSourcePropertiesFragment struct { + DisplayName *string `json:"displayName,omitempty"` + URI *string `json:"uri,omitempty"` + SourceType SourceControlType `json:"sourceType,omitempty"` + FolderPath *string `json:"folderPath,omitempty"` + ArmTemplateFolderPath *string `json:"armTemplateFolderPath,omitempty"` + BranchRef *string `json:"branchRef,omitempty"` + SecurityToken *string `json:"securityToken,omitempty"` + Status EnableStatus `json:"status,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// AttachDiskProperties is properties of the disk to attach. +type AttachDiskProperties struct { + LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` +} + +// AttachNewDataDiskOptions is properties to attach new disk to the Virtual +// Machine. +type AttachNewDataDiskOptions struct { + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` + DiskName *string `json:"diskName,omitempty"` + DiskType StorageType `json:"diskType,omitempty"` +} + +// BulkCreationParameters is parameters for creating multiple virtual machines +// as a single action. +type BulkCreationParameters struct { + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// CloudError is error from a REST request. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody is body of an error from a REST request. +type CloudErrorBody struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ComputeDataDisk is a data disks attached to a virtual machine. +type ComputeDataDisk struct { + Name *string `json:"name,omitempty"` + DiskURI *string `json:"diskUri,omitempty"` + ManagedDiskID *string `json:"managedDiskId,omitempty"` + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` +} + +// ComputeDataDiskFragment is a data disks attached to a virtual machine. +type ComputeDataDiskFragment struct { + Name *string `json:"name,omitempty"` + DiskURI *string `json:"diskUri,omitempty"` + ManagedDiskID *string `json:"managedDiskId,omitempty"` + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` +} + +// ComputeVMInstanceViewStatus is status information about a virtual machine. +type ComputeVMInstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ComputeVMInstanceViewStatusFragment is status information about a virtual +// machine. +type ComputeVMInstanceViewStatusFragment struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ComputeVMProperties is properties of a virtual machine returned by the +// Microsoft.Compute API. +type ComputeVMProperties struct { + Statuses *[]ComputeVMInstanceViewStatus `json:"statuses,omitempty"` + OsType *string `json:"osType,omitempty"` + VMSize *string `json:"vmSize,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` + OsDiskID *string `json:"osDiskId,omitempty"` + DataDiskIds *[]string `json:"dataDiskIds,omitempty"` + DataDisks *[]ComputeDataDisk `json:"dataDisks,omitempty"` +} + +// ComputeVMPropertiesFragment is properties of a virtual machine returned by +// the Microsoft.Compute API. +type ComputeVMPropertiesFragment struct { + Statuses *[]ComputeVMInstanceViewStatusFragment `json:"statuses,omitempty"` + OsType *string `json:"osType,omitempty"` + VMSize *string `json:"vmSize,omitempty"` + NetworkInterfaceID *string `json:"networkInterfaceId,omitempty"` + OsDiskID *string `json:"osDiskId,omitempty"` + DataDiskIds *[]string `json:"dataDiskIds,omitempty"` + DataDisks *[]ComputeDataDiskFragment `json:"dataDisks,omitempty"` +} + +// CostThresholdProperties is properties of a cost threshold item. +type CostThresholdProperties struct { + ThresholdID *string `json:"thresholdId,omitempty"` + PercentageThreshold *PercentageCostThresholdProperties `json:"percentageThreshold,omitempty"` + DisplayOnChart CostThresholdStatus `json:"displayOnChart,omitempty"` + SendNotificationWhenExceeded CostThresholdStatus `json:"sendNotificationWhenExceeded,omitempty"` + NotificationSent *string `json:"NotificationSent,omitempty"` +} + +// CustomImage is a custom image. +type CustomImage struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CustomImageProperties `json:"properties,omitempty"` +} + +// CustomImageProperties is properties of a custom image. +type CustomImageProperties struct { + VM *CustomImagePropertiesFromVM `json:"vm,omitempty"` + Vhd *CustomImagePropertiesCustom `json:"vhd,omitempty"` + Description *string `json:"description,omitempty"` + Author *string `json:"author,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + ManagedImageID *string `json:"managedImageId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// CustomImagePropertiesCustom is properties for creating a custom image from a +// VHD. +type CustomImagePropertiesCustom struct { + ImageName *string `json:"imageName,omitempty"` + SysPrep *bool `json:"sysPrep,omitempty"` + OsType CustomImageOsType `json:"osType,omitempty"` +} + +// CustomImagePropertiesFromVM is properties for creating a custom image from a +// virtual machine. +type CustomImagePropertiesFromVM struct { + SourceVMID *string `json:"sourceVmId,omitempty"` + WindowsOsInfo *WindowsOsInfo `json:"windowsOsInfo,omitempty"` + LinuxOsInfo *LinuxOsInfo `json:"linuxOsInfo,omitempty"` +} + +// DataDiskProperties is request body for adding a new or existing data disk to +// a virtual machine. +type DataDiskProperties struct { + AttachNewDataDiskOptions *AttachNewDataDiskOptions `json:"attachNewDataDiskOptions,omitempty"` + ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` + HostCaching HostCachingOptions `json:"hostCaching,omitempty"` +} + +// DayDetails is properties of a daily schedule. +type DayDetails struct { + Time *string `json:"time,omitempty"` +} + +// DayDetailsFragment is properties of a daily schedule. +type DayDetailsFragment struct { + Time *string `json:"time,omitempty"` +} + +// DetachDataDiskProperties is request body for detaching data disk from a +// virtual machine. +type DetachDataDiskProperties struct { + ExistingLabDiskID *string `json:"existingLabDiskId,omitempty"` +} + +// DetachDiskProperties is properties of the disk to detach. +type DetachDiskProperties struct { + LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` +} + +// Disk is a Disk. +type Disk struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DiskProperties `json:"properties,omitempty"` +} + +// DiskProperties is properties of a disk. +type DiskProperties struct { + DiskType StorageType `json:"diskType,omitempty"` + DiskSizeGiB *int32 `json:"diskSizeGiB,omitempty"` + LeasedByLabVMID *string `json:"leasedByLabVmId,omitempty"` + DiskBlobName *string `json:"diskBlobName,omitempty"` + DiskURI *string `json:"diskUri,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + HostCaching *string `json:"hostCaching,omitempty"` + ManagedDiskID *string `json:"managedDiskId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// DtlEnvironment is an environment, which is essentially an ARM template +// deployment. +type DtlEnvironment struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *EnvironmentProperties `json:"properties,omitempty"` +} + +// EnvironmentDeploymentProperties is properties of an environment deployment. +type EnvironmentDeploymentProperties struct { + ArmTemplateID *string `json:"armTemplateId,omitempty"` + Parameters *[]ArmTemplateParameterProperties `json:"parameters,omitempty"` +} + +// EnvironmentProperties is properties of an environment. +type EnvironmentProperties struct { + DeploymentProperties *EnvironmentDeploymentProperties `json:"deploymentProperties,omitempty"` + ArmTemplateDisplayName *string `json:"armTemplateDisplayName,omitempty"` + ResourceGroupID *string `json:"resourceGroupId,omitempty"` + CreatedByUser *string `json:"createdByUser,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// EvaluatePoliciesProperties is properties for evaluating a policy set. +type EvaluatePoliciesProperties struct { + FactName *string `json:"factName,omitempty"` + FactData *string `json:"factData,omitempty"` + ValueOffset *string `json:"valueOffset,omitempty"` +} + +// EvaluatePoliciesRequest is request body for evaluating a policy set. +type EvaluatePoliciesRequest struct { + Policies *[]EvaluatePoliciesProperties `json:"policies,omitempty"` +} + +// EvaluatePoliciesResponse is response body for evaluating a policy set. +type EvaluatePoliciesResponse struct { + autorest.Response `json:"-"` + Results *[]PolicySetResult `json:"results,omitempty"` +} + +// Event is an event to be notified for. +type Event struct { + EventName NotificationChannelEventType `json:"eventName,omitempty"` +} + +// EventFragment is an event to be notified for. +type EventFragment struct { + EventName NotificationChannelEventType `json:"eventName,omitempty"` +} + +// ExportResourceUsageParameters is the parameters of the export operation. +type ExportResourceUsageParameters struct { + BlobStorageAbsoluteSasURI *string `json:"blobStorageAbsoluteSasUri,omitempty"` + UsageStartDate *date.Time `json:"usageStartDate,omitempty"` +} + +// ExternalSubnet is subnet information as returned by the Microsoft.Network +// API. +type ExternalSubnet struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// ExternalSubnetFragment is subnet information as returned by the +// Microsoft.Network API. +type ExternalSubnetFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// Formula is a formula for creating a VM, specifying an image base and other +// parameters +type Formula struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *FormulaProperties `json:"properties,omitempty"` +} + +// FormulaProperties is properties of a formula. +type FormulaProperties struct { + Description *string `json:"description,omitempty"` + Author *string `json:"author,omitempty"` + OsType *string `json:"osType,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + FormulaContent *LabVirtualMachineCreationParameter `json:"formulaContent,omitempty"` + VM *FormulaPropertiesFromVM `json:"vm,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// FormulaPropertiesFromVM is information about a VM from which a formula is to +// be created. +type FormulaPropertiesFromVM struct { + LabVMID *string `json:"labVmId,omitempty"` +} + +// GalleryImage is a gallery image. +type GalleryImage struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *GalleryImageProperties `json:"properties,omitempty"` +} + +// GalleryImageProperties is properties of a gallery image. +type GalleryImageProperties struct { + Author *string `json:"author,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + Description *string `json:"description,omitempty"` + ImageReference *GalleryImageReference `json:"imageReference,omitempty"` + Icon *string `json:"icon,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// GalleryImageReference is the reference information for an Azure Marketplace +// image. +type GalleryImageReference struct { + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + OsType *string `json:"osType,omitempty"` + Version *string `json:"version,omitempty"` +} + +// GalleryImageReferenceFragment is the reference information for an Azure +// Marketplace image. +type GalleryImageReferenceFragment struct { + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Sku *string `json:"sku,omitempty"` + OsType *string `json:"osType,omitempty"` + Version *string `json:"version,omitempty"` +} + +// GenerateArmTemplateRequest is parameters for generating an ARM template for +// deploying artifacts. +type GenerateArmTemplateRequest struct { + VirtualMachineName *string `json:"virtualMachineName,omitempty"` + Parameters *[]ParameterInfo `json:"parameters,omitempty"` + Location *string `json:"location,omitempty"` + FileUploadOptions FileUploadOptions `json:"fileUploadOptions,omitempty"` +} + +// GenerateUploadURIParameter is properties for generating an upload URI. +type GenerateUploadURIParameter struct { + BlobName *string `json:"blobName,omitempty"` +} + +// GenerateUploadURIResponse is reponse body for generating an upload URI. +type GenerateUploadURIResponse struct { + autorest.Response `json:"-"` + UploadURI *string `json:"uploadUri,omitempty"` +} + +// HourDetails is properties of an hourly schedule. +type HourDetails struct { + Minute *int32 `json:"minute,omitempty"` +} + +// HourDetailsFragment is properties of an hourly schedule. +type HourDetailsFragment struct { + Minute *int32 `json:"minute,omitempty"` +} + +// IdentityProperties is identityProperties +type IdentityProperties struct { + Type *string `json:"type,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + ClientSecretURL *string `json:"clientSecretUrl,omitempty"` +} + +// InboundNatRule is a rule for NAT - exposing a VM's port (backendPort) on the +// public IP address using a load balancer. +type InboundNatRule struct { + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + FrontendPort *int32 `json:"frontendPort,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// InboundNatRuleFragment is a rule for NAT - exposing a VM's port +// (backendPort) on the public IP address using a load balancer. +type InboundNatRuleFragment struct { + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + FrontendPort *int32 `json:"frontendPort,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// Lab is a lab. +type Lab struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LabProperties `json:"properties,omitempty"` +} + +// LabCost is a cost item. +type LabCost struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LabCostProperties `json:"properties,omitempty"` +} + +// LabCostDetailsProperties is the properties of a lab cost item. +type LabCostDetailsProperties struct { + Date *date.Time `json:"date,omitempty"` + Cost *float64 `json:"cost,omitempty"` + CostType CostType `json:"costType,omitempty"` +} + +// LabCostProperties is properties of a cost item. +type LabCostProperties struct { + TargetCost *TargetCostProperties `json:"targetCost,omitempty"` + LabCostSummary *LabCostSummaryProperties `json:"labCostSummary,omitempty"` + LabCostDetails *[]LabCostDetailsProperties `json:"labCostDetails,omitempty"` + ResourceCosts *[]LabResourceCostProperties `json:"resourceCosts,omitempty"` + CurrencyCode *string `json:"currencyCode,omitempty"` + StartDateTime *date.Time `json:"startDateTime,omitempty"` + EndDateTime *date.Time `json:"endDateTime,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabCostSummaryProperties is the properties of the cost summary. +type LabCostSummaryProperties struct { + EstimatedLabCost *float64 `json:"estimatedLabCost,omitempty"` +} + +// LabFragment is a lab. +type LabFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LabPropertiesFragment `json:"properties,omitempty"` +} + +// LabProperties is properties of a lab. +type LabProperties struct { + DefaultStorageAccount *string `json:"defaultStorageAccount,omitempty"` + DefaultPremiumStorageAccount *string `json:"defaultPremiumStorageAccount,omitempty"` + ArtifactsStorageAccount *string `json:"artifactsStorageAccount,omitempty"` + PremiumDataDiskStorageAccount *string `json:"premiumDataDiskStorageAccount,omitempty"` + VaultName *string `json:"vaultName,omitempty"` + LabStorageType StorageType `json:"labStorageType,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabPropertiesFragment is properties of a lab. +type LabPropertiesFragment struct { + LabStorageType StorageType `json:"labStorageType,omitempty"` + PremiumDataDisks PremiumDataDisk `json:"premiumDataDisks,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabResourceCostProperties is the properties of a resource cost item. +type LabResourceCostProperties struct { + Resourcename *string `json:"resourcename,omitempty"` + ResourceUID *string `json:"resourceUId,omitempty"` + ResourceCost *float64 `json:"resourceCost,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceOwner *string `json:"resourceOwner,omitempty"` + ResourcePricingTier *string `json:"resourcePricingTier,omitempty"` + ResourceStatus *string `json:"resourceStatus,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + ExternalResourceID *string `json:"externalResourceId,omitempty"` +} + +// LabVhd is properties of a VHD in the lab. +type LabVhd struct { + ID *string `json:"id,omitempty"` +} + +// LabVirtualMachine is a virtual machine. +type LabVirtualMachine struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LabVirtualMachineProperties `json:"properties,omitempty"` +} + +// LabVirtualMachineCreationParameter is properties for creating a virtual +// machine. +type LabVirtualMachineCreationParameter struct { + *LabVirtualMachineCreationParameterProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// LabVirtualMachineCreationParameterProperties is properties for virtual +// machine creation. +type LabVirtualMachineCreationParameterProperties struct { + BulkCreationParameters *BulkCreationParameters `json:"bulkCreationParameters,omitempty"` + Notes *string `json:"notes,omitempty"` + OwnerObjectID *string `json:"ownerObjectId,omitempty"` + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + CreatedByUserID *string `json:"createdByUserId,omitempty"` + CreatedByUser *string `json:"createdByUser,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + CustomImageID *string `json:"customImageId,omitempty"` + OsType *string `json:"osType,omitempty"` + Size *string `json:"size,omitempty"` + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` + SSHKey *string `json:"sshKey,omitempty"` + IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` + ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` + GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` + ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` + NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` + ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + AllowClaim *bool `json:"allowClaim,omitempty"` + StorageType *string `json:"storageType,omitempty"` + VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` + EnvironmentID *string `json:"environmentId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabVirtualMachineFragment is a virtual machine. +type LabVirtualMachineFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LabVirtualMachinePropertiesFragment `json:"properties,omitempty"` +} + +// LabVirtualMachineProperties is properties of a virtual machine. +type LabVirtualMachineProperties struct { + Notes *string `json:"notes,omitempty"` + OwnerObjectID *string `json:"ownerObjectId,omitempty"` + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + CreatedByUserID *string `json:"createdByUserId,omitempty"` + CreatedByUser *string `json:"createdByUser,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ComputeID *string `json:"computeId,omitempty"` + CustomImageID *string `json:"customImageId,omitempty"` + OsType *string `json:"osType,omitempty"` + Size *string `json:"size,omitempty"` + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` + SSHKey *string `json:"sshKey,omitempty"` + IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + Artifacts *[]ArtifactInstallProperties `json:"artifacts,omitempty"` + ArtifactDeploymentStatus *ArtifactDeploymentStatusProperties `json:"artifactDeploymentStatus,omitempty"` + GalleryImageReference *GalleryImageReference `json:"galleryImageReference,omitempty"` + ComputeVM *ComputeVMProperties `json:"computeVm,omitempty"` + NetworkInterface *NetworkInterfaceProperties `json:"networkInterface,omitempty"` + ApplicableSchedule *ApplicableSchedule `json:"applicableSchedule,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + AllowClaim *bool `json:"allowClaim,omitempty"` + StorageType *string `json:"storageType,omitempty"` + VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` + EnvironmentID *string `json:"environmentId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabVirtualMachinePropertiesFragment is properties of a virtual machine. +type LabVirtualMachinePropertiesFragment struct { + Notes *string `json:"notes,omitempty"` + OwnerObjectID *string `json:"ownerObjectId,omitempty"` + OwnerUserPrincipalName *string `json:"ownerUserPrincipalName,omitempty"` + CreatedByUserID *string `json:"createdByUserId,omitempty"` + CreatedByUser *string `json:"createdByUser,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + CustomImageID *string `json:"customImageId,omitempty"` + OsType *string `json:"osType,omitempty"` + Size *string `json:"size,omitempty"` + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` + SSHKey *string `json:"sshKey,omitempty"` + IsAuthenticationWithSSHKey *bool `json:"isAuthenticationWithSshKey,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + LabVirtualNetworkID *string `json:"labVirtualNetworkId,omitempty"` + DisallowPublicIPAddress *bool `json:"disallowPublicIpAddress,omitempty"` + Artifacts *[]ArtifactInstallPropertiesFragment `json:"artifacts,omitempty"` + ArtifactDeploymentStatus *ArtifactDeploymentStatusPropertiesFragment `json:"artifactDeploymentStatus,omitempty"` + GalleryImageReference *GalleryImageReferenceFragment `json:"galleryImageReference,omitempty"` + ComputeVM *ComputeVMPropertiesFragment `json:"computeVm,omitempty"` + NetworkInterface *NetworkInterfacePropertiesFragment `json:"networkInterface,omitempty"` + ApplicableSchedule *ApplicableScheduleFragment `json:"applicableSchedule,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + AllowClaim *bool `json:"allowClaim,omitempty"` + StorageType *string `json:"storageType,omitempty"` + VirtualMachineCreationSource VirtualMachineCreationSource `json:"virtualMachineCreationSource,omitempty"` + EnvironmentID *string `json:"environmentId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LinuxOsInfo is information about a Linux OS. +type LinuxOsInfo struct { + LinuxOsState LinuxOsState `json:"linuxOsState,omitempty"` +} + +// NetworkInterfaceProperties is properties of a network interface. +type NetworkInterfaceProperties struct { + VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + DNSName *string `json:"dnsName,omitempty"` + RdpAuthority *string `json:"rdpAuthority,omitempty"` + SSHAuthority *string `json:"sshAuthority,omitempty"` + SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` +} + +// NetworkInterfacePropertiesFragment is properties of a network interface. +type NetworkInterfacePropertiesFragment struct { + VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + PublicIPAddressID *string `json:"publicIpAddressId,omitempty"` + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + DNSName *string `json:"dnsName,omitempty"` + RdpAuthority *string `json:"rdpAuthority,omitempty"` + SSHAuthority *string `json:"sshAuthority,omitempty"` + SharedPublicIPAddressConfiguration *SharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` +} + +// NotificationChannel is a notification. +type NotificationChannel struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *NotificationChannelProperties `json:"properties,omitempty"` +} + +// NotificationChannelFragment is a notification. +type NotificationChannelFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *NotificationChannelPropertiesFragment `json:"properties,omitempty"` +} + +// NotificationChannelProperties is properties of a schedule. +type NotificationChannelProperties struct { + WebHookURL *string `json:"webHookUrl,omitempty"` + Description *string `json:"description,omitempty"` + Events *[]Event `json:"events,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// NotificationChannelPropertiesFragment is properties of a schedule. +type NotificationChannelPropertiesFragment struct { + WebHookURL *string `json:"webHookUrl,omitempty"` + Description *string `json:"description,omitempty"` + Events *[]EventFragment `json:"events,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// NotificationSettings is notification settings for a schedule. +type NotificationSettings struct { + Status NotificationStatus `json:"status,omitempty"` + TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` + WebhookURL *string `json:"webhookUrl,omitempty"` +} + +// NotificationSettingsFragment is notification settings for a schedule. +type NotificationSettingsFragment struct { + Status NotificationStatus `json:"status,omitempty"` + TimeInMinutes *int32 `json:"timeInMinutes,omitempty"` + WebhookURL *string `json:"webhookUrl,omitempty"` +} + +// NotifyParameters is properties for generating a Notification. +type NotifyParameters struct { + EventName NotificationChannelEventType `json:"eventName,omitempty"` + JSONPayload *string `json:"jsonPayload,omitempty"` +} + +// ParameterInfo is information about an artifact's parameter. +type ParameterInfo struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ParametersValueFileInfo is a file containing a set of parameter values for +// an ARM template. +type ParametersValueFileInfo struct { + FileName *string `json:"fileName,omitempty"` + ParametersValueInfo *map[string]interface{} `json:"parametersValueInfo,omitempty"` +} + +// PercentageCostThresholdProperties is properties of a percentage cost +// threshold. +type PercentageCostThresholdProperties struct { + ThresholdValue *float64 `json:"thresholdValue,omitempty"` +} + +// Policy is a Policy. +type Policy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PolicyProperties `json:"properties,omitempty"` +} + +// PolicyFragment is a Policy. +type PolicyFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PolicyPropertiesFragment `json:"properties,omitempty"` +} + +// PolicyProperties is properties of a Policy. +type PolicyProperties struct { + Description *string `json:"description,omitempty"` + Status PolicyStatus `json:"status,omitempty"` + FactName PolicyFactName `json:"factName,omitempty"` + FactData *string `json:"factData,omitempty"` + Threshold *string `json:"threshold,omitempty"` + EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// PolicyPropertiesFragment is properties of a Policy. +type PolicyPropertiesFragment struct { + Description *string `json:"description,omitempty"` + Status PolicyStatus `json:"status,omitempty"` + FactName PolicyFactName `json:"factName,omitempty"` + FactData *string `json:"factData,omitempty"` + Threshold *string `json:"threshold,omitempty"` + EvaluatorType PolicyEvaluatorType `json:"evaluatorType,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// PolicySetResult is result of a policy set evaluation. +type PolicySetResult struct { + HasError *bool `json:"hasError,omitempty"` + PolicyViolations *[]PolicyViolation `json:"policyViolations,omitempty"` +} + +// PolicyViolation is policy violation. +type PolicyViolation struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Port is properties of a network port. +type Port struct { + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// PortFragment is properties of a network port. +type PortFragment struct { + TransportProtocol TransportProtocol `json:"transportProtocol,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// Resource is an Azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResponseWithContinuationArmTemplate is the response of a list operation. +type ResponseWithContinuationArmTemplate struct { + autorest.Response `json:"-"` + Value *[]ArmTemplate `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationArmTemplatePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationArmTemplate) ResponseWithContinuationArmTemplatePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationArtifact is the response of a list operation. +type ResponseWithContinuationArtifact struct { + autorest.Response `json:"-"` + Value *[]Artifact `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationArtifactPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationArtifact) ResponseWithContinuationArtifactPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationArtifactSource is the response of a list operation. +type ResponseWithContinuationArtifactSource struct { + autorest.Response `json:"-"` + Value *[]ArtifactSource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationArtifactSourcePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationArtifactSource) ResponseWithContinuationArtifactSourcePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationCustomImage is the response of a list operation. +type ResponseWithContinuationCustomImage struct { + autorest.Response `json:"-"` + Value *[]CustomImage `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationCustomImagePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationCustomImage) ResponseWithContinuationCustomImagePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationDisk is the response of a list operation. +type ResponseWithContinuationDisk struct { + autorest.Response `json:"-"` + Value *[]Disk `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationDiskPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationDisk) ResponseWithContinuationDiskPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationDtlEnvironment is the response of a list operation. +type ResponseWithContinuationDtlEnvironment struct { + autorest.Response `json:"-"` + Value *[]DtlEnvironment `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationDtlEnvironmentPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationDtlEnvironment) ResponseWithContinuationDtlEnvironmentPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationFormula is the response of a list operation. +type ResponseWithContinuationFormula struct { + autorest.Response `json:"-"` + Value *[]Formula `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationFormulaPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationFormula) ResponseWithContinuationFormulaPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationGalleryImage is the response of a list operation. +type ResponseWithContinuationGalleryImage struct { + autorest.Response `json:"-"` + Value *[]GalleryImage `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationGalleryImagePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationGalleryImage) ResponseWithContinuationGalleryImagePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationLab is the response of a list operation. +type ResponseWithContinuationLab struct { + autorest.Response `json:"-"` + Value *[]Lab `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationLab) ResponseWithContinuationLabPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationLabVhd is the response of a list operation. +type ResponseWithContinuationLabVhd struct { + autorest.Response `json:"-"` + Value *[]LabVhd `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabVhdPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationLabVhd) ResponseWithContinuationLabVhdPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationLabVirtualMachine is the response of a list +// operation. +type ResponseWithContinuationLabVirtualMachine struct { + autorest.Response `json:"-"` + Value *[]LabVirtualMachine `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabVirtualMachinePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationLabVirtualMachine) ResponseWithContinuationLabVirtualMachinePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationNotificationChannel is the response of a list +// operation. +type ResponseWithContinuationNotificationChannel struct { + autorest.Response `json:"-"` + Value *[]NotificationChannel `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationNotificationChannelPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationNotificationChannel) ResponseWithContinuationNotificationChannelPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationPolicy is the response of a list operation. +type ResponseWithContinuationPolicy struct { + autorest.Response `json:"-"` + Value *[]Policy `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationPolicyPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationPolicy) ResponseWithContinuationPolicyPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationSchedule is the response of a list operation. +type ResponseWithContinuationSchedule struct { + autorest.Response `json:"-"` + Value *[]Schedule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationSchedulePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationSchedule) ResponseWithContinuationSchedulePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationSecret is the response of a list operation. +type ResponseWithContinuationSecret struct { + autorest.Response `json:"-"` + Value *[]Secret `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationSecretPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationSecret) ResponseWithContinuationSecretPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationServiceRunner is the response of a list operation. +type ResponseWithContinuationServiceRunner struct { + autorest.Response `json:"-"` + Value *[]ServiceRunner `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationServiceRunnerPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationServiceRunner) ResponseWithContinuationServiceRunnerPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationUser is the response of a list operation. +type ResponseWithContinuationUser struct { + autorest.Response `json:"-"` + Value *[]User `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationUserPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationUser) ResponseWithContinuationUserPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResponseWithContinuationVirtualNetwork is the response of a list operation. +type ResponseWithContinuationVirtualNetwork struct { + autorest.Response `json:"-"` + Value *[]VirtualNetwork `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationVirtualNetworkPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResponseWithContinuationVirtualNetwork) ResponseWithContinuationVirtualNetworkPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RetargetScheduleProperties is properties for retargeting a virtual machine +// schedule. +type RetargetScheduleProperties struct { + CurrentResourceID *string `json:"currentResourceId,omitempty"` + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// Schedule is a schedule. +type Schedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ScheduleProperties `json:"properties,omitempty"` +} + +// ScheduleFragment is a schedule. +type ScheduleFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SchedulePropertiesFragment `json:"properties,omitempty"` +} + +// ScheduleProperties is properties of a schedule. +type ScheduleProperties struct { + Status EnableStatus `json:"status,omitempty"` + TaskType *string `json:"taskType,omitempty"` + WeeklyRecurrence *WeekDetails `json:"weeklyRecurrence,omitempty"` + DailyRecurrence *DayDetails `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetails `json:"hourlyRecurrence,omitempty"` + TimeZoneID *string `json:"timeZoneId,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + TargetResourceID *string `json:"targetResourceId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// SchedulePropertiesFragment is properties of a schedule. +type SchedulePropertiesFragment struct { + Status EnableStatus `json:"status,omitempty"` + TaskType *string `json:"taskType,omitempty"` + WeeklyRecurrence *WeekDetailsFragment `json:"weeklyRecurrence,omitempty"` + DailyRecurrence *DayDetailsFragment `json:"dailyRecurrence,omitempty"` + HourlyRecurrence *HourDetailsFragment `json:"hourlyRecurrence,omitempty"` + TimeZoneID *string `json:"timeZoneId,omitempty"` + NotificationSettings *NotificationSettingsFragment `json:"notificationSettings,omitempty"` + TargetResourceID *string `json:"targetResourceId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// Secret is a secret. +type Secret struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SecretProperties `json:"properties,omitempty"` +} + +// SecretProperties is properties of a secret. +type SecretProperties struct { + Value *string `json:"value,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// ServiceRunner is a container for a managed identity to execute DevTest lab +// services. +type ServiceRunner struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Identity *IdentityProperties `json:"identity,omitempty"` +} + +// SharedPublicIPAddressConfiguration is properties of a virtual machine that +// determine how it is connected to a load balancer. +type SharedPublicIPAddressConfiguration struct { + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` +} + +// SharedPublicIPAddressConfigurationFragment is properties of a virtual +// machine that determine how it is connected to a load balancer. +type SharedPublicIPAddressConfigurationFragment struct { + InboundNatRules *[]InboundNatRuleFragment `json:"inboundNatRules,omitempty"` +} + +// ShutdownNotificationContent is the contents of a shutdown notification. +// Webhooks can use this type to deserialize the request body when they get +// notified of an imminent shutdown. +type ShutdownNotificationContent struct { + SkipURL *string `json:"skipUrl,omitempty"` + DelayURL60 *string `json:"delayUrl60,omitempty"` + DelayURL120 *string `json:"delayUrl120,omitempty"` + VMName *string `json:"vmName,omitempty"` + GUID *string `json:"guid,omitempty"` + Owner *string `json:"owner,omitempty"` + EventType *string `json:"eventType,omitempty"` + Text *string `json:"text,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + LabName *string `json:"labName,omitempty"` +} + +// Subnet is subnet information. +type Subnet struct { + ResourceID *string `json:"resourceId,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` +} + +// SubnetFragment is subnet information. +type SubnetFragment struct { + ResourceID *string `json:"resourceId,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + AllowPublicIP UsagePermissionType `json:"allowPublicIp,omitempty"` +} + +// SubnetOverride is property overrides on a subnet of a virtual network. +type SubnetOverride struct { + ResourceID *string `json:"resourceId,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` + UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` + SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfiguration `json:"sharedPublicIpAddressConfiguration,omitempty"` + VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` +} + +// SubnetOverrideFragment is property overrides on a subnet of a virtual +// network. +type SubnetOverrideFragment struct { + ResourceID *string `json:"resourceId,omitempty"` + LabSubnetName *string `json:"labSubnetName,omitempty"` + UseInVMCreationPermission UsagePermissionType `json:"useInVmCreationPermission,omitempty"` + UsePublicIPAddressPermission UsagePermissionType `json:"usePublicIpAddressPermission,omitempty"` + SharedPublicIPAddressConfiguration *SubnetSharedPublicIPAddressConfigurationFragment `json:"sharedPublicIpAddressConfiguration,omitempty"` + VirtualNetworkPoolName *string `json:"virtualNetworkPoolName,omitempty"` +} + +// SubnetSharedPublicIPAddressConfiguration is configuration for public IP +// address sharing. +type SubnetSharedPublicIPAddressConfiguration struct { + AllowedPorts *[]Port `json:"allowedPorts,omitempty"` +} + +// SubnetSharedPublicIPAddressConfigurationFragment is configuration for public +// IP address sharing. +type SubnetSharedPublicIPAddressConfigurationFragment struct { + AllowedPorts *[]PortFragment `json:"allowedPorts,omitempty"` +} + +// TargetCostProperties is properties of a cost target. +type TargetCostProperties struct { + Status TargetCostStatus `json:"status,omitempty"` + Target *int32 `json:"target,omitempty"` + CostThresholds *[]CostThresholdProperties `json:"costThresholds,omitempty"` + CycleStartDateTime *date.Time `json:"cycleStartDateTime,omitempty"` + CycleEndDateTime *date.Time `json:"cycleEndDateTime,omitempty"` + CycleType ReportingCycleType `json:"cycleType,omitempty"` +} + +// User is profile of a lab user. +type User struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *UserProperties `json:"properties,omitempty"` +} + +// UserFragment is profile of a lab user. +type UserFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *UserPropertiesFragment `json:"properties,omitempty"` +} + +// UserIdentity is identity attributes of a lab user. +type UserIdentity struct { + PrincipalName *string `json:"principalName,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + ObjectID *string `json:"objectId,omitempty"` + AppID *string `json:"appId,omitempty"` +} + +// UserIdentityFragment is identity attributes of a lab user. +type UserIdentityFragment struct { + PrincipalName *string `json:"principalName,omitempty"` + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + ObjectID *string `json:"objectId,omitempty"` + AppID *string `json:"appId,omitempty"` +} + +// UserProperties is properties of a lab user profile. +type UserProperties struct { + Identity *UserIdentity `json:"identity,omitempty"` + SecretStore *UserSecretStore `json:"secretStore,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// UserPropertiesFragment is properties of a lab user profile. +type UserPropertiesFragment struct { + Identity *UserIdentityFragment `json:"identity,omitempty"` + SecretStore *UserSecretStoreFragment `json:"secretStore,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// UserSecretStore is properties of a user's secret store. +type UserSecretStore struct { + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + KeyVaultID *string `json:"keyVaultId,omitempty"` +} + +// UserSecretStoreFragment is properties of a user's secret store. +type UserSecretStoreFragment struct { + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + KeyVaultID *string `json:"keyVaultId,omitempty"` +} + +// VirtualNetwork is a virtual network. +type VirtualNetwork struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualNetworkProperties `json:"properties,omitempty"` +} + +// VirtualNetworkFragment is a virtual network. +type VirtualNetworkFragment struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualNetworkPropertiesFragment `json:"properties,omitempty"` +} + +// VirtualNetworkProperties is properties of a virtual network. +type VirtualNetworkProperties struct { + AllowedSubnets *[]Subnet `json:"allowedSubnets,omitempty"` + Description *string `json:"description,omitempty"` + ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` + ExternalSubnets *[]ExternalSubnet `json:"externalSubnets,omitempty"` + SubnetOverrides *[]SubnetOverride `json:"subnetOverrides,omitempty"` + CreatedDate *date.Time `json:"createdDate,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// VirtualNetworkPropertiesFragment is properties of a virtual network. +type VirtualNetworkPropertiesFragment struct { + AllowedSubnets *[]SubnetFragment `json:"allowedSubnets,omitempty"` + Description *string `json:"description,omitempty"` + ExternalProviderResourceID *string `json:"externalProviderResourceId,omitempty"` + ExternalSubnets *[]ExternalSubnetFragment `json:"externalSubnets,omitempty"` + SubnetOverrides *[]SubnetOverrideFragment `json:"subnetOverrides,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// WeekDetails is properties of a weekly schedule. +type WeekDetails struct { + Weekdays *[]string `json:"weekdays,omitempty"` + Time *string `json:"time,omitempty"` +} + +// WeekDetailsFragment is properties of a weekly schedule. +type WeekDetailsFragment struct { + Weekdays *[]string `json:"weekdays,omitempty"` + Time *string `json:"time,omitempty"` +} + +// WindowsOsInfo is information about a Windows OS. +type WindowsOsInfo struct { + WindowsOsState WindowsOsState `json:"windowsOsState,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/notificationchannels.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/notificationchannels.go index 4c33f956e9..f9acf5b38e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/notificationchannels.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/notificationchannels.go @@ -1,501 +1,501 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NotificationChannelsClient is the the DevTest Labs Client. -type NotificationChannelsClient struct { - ManagementClient -} - -// NewNotificationChannelsClient creates an instance of the -// NotificationChannelsClient client. -func NewNotificationChannelsClient(subscriptionID string) NotificationChannelsClient { - return NewNotificationChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNotificationChannelsClientWithBaseURI creates an instance of the -// NotificationChannelsClient client. -func NewNotificationChannelsClientWithBaseURI(baseURI string, subscriptionID string) NotificationChannelsClient { - return NotificationChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing notificationChannel. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the notificationChannel. notificationChannel is -// a notification. -func (client NotificationChannelsClient) CreateOrUpdate(resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (result NotificationChannel, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: notificationChannel, - Constraints: []validation.Constraint{{Target: "notificationChannel.NotificationChannelProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, notificationChannel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NotificationChannelsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithJSON(notificationChannel), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationChannel, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete notificationchannel. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the notificationChannel. -func (client NotificationChannelsClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NotificationChannelsClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get notificationchannel. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the notificationChannel. expand is specify the -// $expand query. Example: 'properties($select=webHookUrl)' -func (client NotificationChannelsClient) Get(resourceGroupName string, labName string, name string, expand string) (result NotificationChannel, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NotificationChannelsClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) GetResponder(resp *http.Response) (result NotificationChannel, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list notificationchannels in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=webHookUrl)' filter is the filter to apply to the -// operation. top is the maximum number of resources to return from the -// operation. orderby is the ordering expression for the results, using OData -// notation. -func (client NotificationChannelsClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationNotificationChannel, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client NotificationChannelsClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationNotificationChannel, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client NotificationChannelsClient) ListNextResults(lastResults ResponseWithContinuationNotificationChannel) (result ResponseWithContinuationNotificationChannel, err error) { - req, err := lastResults.ResponseWithContinuationNotificationChannelPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Notify send notification to provided channel. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the notificationChannel. notifyParameters is -// properties for generating a Notification. -func (client NotificationChannelsClient) Notify(resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (result autorest.Response, err error) { - req, err := client.NotifyPreparer(resourceGroupName, labName, name, notifyParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Notify", nil, "Failure preparing request") - return - } - - resp, err := client.NotifySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Notify", resp, "Failure sending request") - return - } - - result, err = client.NotifyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Notify", resp, "Failure responding to request") - } - - return -} - -// NotifyPreparer prepares the Notify request. -func (client NotificationChannelsClient) NotifyPreparer(resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify", pathParameters), - autorest.WithJSON(notifyParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// NotifySender sends the Notify request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) NotifySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// NotifyResponder handles the response to the Notify request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) NotifyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update modify properties of notificationchannels. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the notificationChannel. notificationChannel is -// a notification. -func (client NotificationChannelsClient) Update(resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (result NotificationChannel, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, name, notificationChannel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NotificationChannelsClient) UpdatePreparer(resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), - autorest.WithJSON(notificationChannel), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NotificationChannelsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NotificationChannelsClient) UpdateResponder(resp *http.Response) (result NotificationChannel, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NotificationChannelsClient is the the DevTest Labs Client. +type NotificationChannelsClient struct { + ManagementClient +} + +// NewNotificationChannelsClient creates an instance of the +// NotificationChannelsClient client. +func NewNotificationChannelsClient(subscriptionID string) NotificationChannelsClient { + return NewNotificationChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNotificationChannelsClientWithBaseURI creates an instance of the +// NotificationChannelsClient client. +func NewNotificationChannelsClientWithBaseURI(baseURI string, subscriptionID string) NotificationChannelsClient { + return NotificationChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing notificationChannel. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the notificationChannel. notificationChannel is +// a notification. +func (client NotificationChannelsClient) CreateOrUpdate(resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (result NotificationChannel, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: notificationChannel, + Constraints: []validation.Constraint{{Target: "notificationChannel.NotificationChannelProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, notificationChannel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NotificationChannelsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, notificationChannel NotificationChannel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithJSON(notificationChannel), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result NotificationChannel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete notificationchannel. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the notificationChannel. +func (client NotificationChannelsClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NotificationChannelsClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get notificationchannel. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the notificationChannel. expand is specify the +// $expand query. Example: 'properties($select=webHookUrl)' +func (client NotificationChannelsClient) Get(resourceGroupName string, labName string, name string, expand string) (result NotificationChannel, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NotificationChannelsClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) GetResponder(resp *http.Response) (result NotificationChannel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list notificationchannels in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=webHookUrl)' filter is the filter to apply to the +// operation. top is the maximum number of resources to return from the +// operation. orderby is the ordering expression for the results, using OData +// notation. +func (client NotificationChannelsClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationNotificationChannel, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client NotificationChannelsClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationNotificationChannel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client NotificationChannelsClient) ListNextResults(lastResults ResponseWithContinuationNotificationChannel) (result ResponseWithContinuationNotificationChannel, err error) { + req, err := lastResults.ResponseWithContinuationNotificationChannelPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Notify send notification to provided channel. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the notificationChannel. notifyParameters is +// properties for generating a Notification. +func (client NotificationChannelsClient) Notify(resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (result autorest.Response, err error) { + req, err := client.NotifyPreparer(resourceGroupName, labName, name, notifyParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Notify", nil, "Failure preparing request") + return + } + + resp, err := client.NotifySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Notify", resp, "Failure sending request") + return + } + + result, err = client.NotifyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Notify", resp, "Failure responding to request") + } + + return +} + +// NotifyPreparer prepares the Notify request. +func (client NotificationChannelsClient) NotifyPreparer(resourceGroupName string, labName string, name string, notifyParameters NotifyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify", pathParameters), + autorest.WithJSON(notifyParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// NotifySender sends the Notify request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) NotifySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// NotifyResponder handles the response to the Notify request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) NotifyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of notificationchannels. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the notificationChannel. notificationChannel is +// a notification. +func (client NotificationChannelsClient) Update(resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (result NotificationChannel, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, name, notificationChannel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.NotificationChannelsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NotificationChannelsClient) UpdatePreparer(resourceGroupName string, labName string, name string, notificationChannel NotificationChannelFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", pathParameters), + autorest.WithJSON(notificationChannel), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NotificationChannelsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NotificationChannelsClient) UpdateResponder(resp *http.Response) (result NotificationChannel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policies.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policies.go index e8f8af30f4..7405b86e1b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policies.go @@ -1,438 +1,438 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PoliciesClient is the the DevTest Labs Client. -type PoliciesClient struct { - ManagementClient -} - -// NewPoliciesClient creates an instance of the PoliciesClient client. -func NewPoliciesClient(subscriptionID string) PoliciesClient { - return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient -// client. -func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { - return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing policy. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. policySetName is the name of the policy set. name is the name of -// the policy. policy is a Policy. -func (client PoliciesClient) CreateOrUpdate(resourceGroupName string, labName string, policySetName string, name string, policy Policy) (result Policy, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: policy, - Constraints: []validation.Constraint{{Target: "policy.PolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, policySetName, name, policy) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PoliciesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, policySetName string, name string, policy Policy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithJSON(policy), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result Policy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete policy. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. policySetName is the name of the policy set. name is the name of -// the policy. -func (client PoliciesClient) Delete(resourceGroupName string, labName string, policySetName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, policySetName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoliciesClient) DeletePreparer(resourceGroupName string, labName string, policySetName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get policy. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. policySetName is the name of the policy set. name is the name of -// the policy. expand is specify the $expand query. Example: -// 'properties($select=description)' -func (client PoliciesClient) Get(resourceGroupName string, labName string, policySetName string, name string, expand string) (result Policy, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, policySetName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoliciesClient) GetPreparer(resourceGroupName string, labName string, policySetName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PoliciesClient) GetResponder(resp *http.Response) (result Policy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list policies in a given policy set. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. policySetName is the name of the policy set. expand is specify the -// $expand query. Example: 'properties($select=description)' filter is the -// filter to apply to the operation. top is the maximum number of resources to -// return from the operation. orderby is the ordering expression for the -// results, using OData notation. -func (client PoliciesClient) List(resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationPolicy, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, policySetName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PoliciesClient) ListPreparer(resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PoliciesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client PoliciesClient) ListNextResults(lastResults ResponseWithContinuationPolicy) (result ResponseWithContinuationPolicy, err error) { - req, err := lastResults.ResponseWithContinuationPolicyPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of policies. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. policySetName is the name of the policy set. name is the name of -// the policy. policy is a Policy. -func (client PoliciesClient) Update(resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (result Policy, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, policySetName, name, policy) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PoliciesClient) UpdatePreparer(resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "policySetName": autorest.Encode("path", policySetName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), - autorest.WithJSON(policy), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PoliciesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PoliciesClient) UpdateResponder(resp *http.Response) (result Policy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PoliciesClient is the the DevTest Labs Client. +type PoliciesClient struct { + ManagementClient +} + +// NewPoliciesClient creates an instance of the PoliciesClient client. +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient +// client. +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing policy. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. policySetName is the name of the policy set. name is the name of +// the policy. policy is a Policy. +func (client PoliciesClient) CreateOrUpdate(resourceGroupName string, labName string, policySetName string, name string, policy Policy) (result Policy, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: policy, + Constraints: []validation.Constraint{{Target: "policy.PolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, policySetName, name, policy) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PoliciesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, policySetName string, name string, policy Policy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithJSON(policy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result Policy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete policy. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. policySetName is the name of the policy set. name is the name of +// the policy. +func (client PoliciesClient) Delete(resourceGroupName string, labName string, policySetName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, policySetName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PoliciesClient) DeletePreparer(resourceGroupName string, labName string, policySetName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get policy. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. policySetName is the name of the policy set. name is the name of +// the policy. expand is specify the $expand query. Example: +// 'properties($select=description)' +func (client PoliciesClient) Get(resourceGroupName string, labName string, policySetName string, name string, expand string) (result Policy, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, policySetName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PoliciesClient) GetPreparer(resourceGroupName string, labName string, policySetName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PoliciesClient) GetResponder(resp *http.Response) (result Policy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list policies in a given policy set. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. policySetName is the name of the policy set. expand is specify the +// $expand query. Example: 'properties($select=description)' filter is the +// filter to apply to the operation. top is the maximum number of resources to +// return from the operation. orderby is the ordering expression for the +// results, using OData notation. +func (client PoliciesClient) List(resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationPolicy, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, policySetName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PoliciesClient) ListPreparer(resourceGroupName string, labName string, policySetName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PoliciesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client PoliciesClient) ListNextResults(lastResults ResponseWithContinuationPolicy) (result ResponseWithContinuationPolicy, err error) { + req, err := lastResults.ResponseWithContinuationPolicyPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of policies. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. policySetName is the name of the policy set. name is the name of +// the policy. policy is a Policy. +func (client PoliciesClient) Update(resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (result Policy, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, policySetName, name, policy) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PoliciesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PoliciesClient) UpdatePreparer(resourceGroupName string, labName string, policySetName string, name string, policy PolicyFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "policySetName": autorest.Encode("path", policySetName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", pathParameters), + autorest.WithJSON(policy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PoliciesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PoliciesClient) UpdateResponder(resp *http.Response) (result Policy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policysets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policysets.go index 1f6e294959..d61065502b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policysets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/policysets.go @@ -1,111 +1,111 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// PolicySetsClient is the the DevTest Labs Client. -type PolicySetsClient struct { - ManagementClient -} - -// NewPolicySetsClient creates an instance of the PolicySetsClient client. -func NewPolicySetsClient(subscriptionID string) PolicySetsClient { - return NewPolicySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPolicySetsClientWithBaseURI creates an instance of the PolicySetsClient -// client. -func NewPolicySetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySetsClient { - return PolicySetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// EvaluatePolicies evaluates lab policy. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the policy set. evaluatePoliciesRequest is -// request body for evaluating a policy set. -func (client PolicySetsClient) EvaluatePolicies(resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (result EvaluatePoliciesResponse, err error) { - req, err := client.EvaluatePoliciesPreparer(resourceGroupName, labName, name, evaluatePoliciesRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PolicySetsClient", "EvaluatePolicies", nil, "Failure preparing request") - return - } - - resp, err := client.EvaluatePoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.PolicySetsClient", "EvaluatePolicies", resp, "Failure sending request") - return - } - - result, err = client.EvaluatePoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.PolicySetsClient", "EvaluatePolicies", resp, "Failure responding to request") - } - - return -} - -// EvaluatePoliciesPreparer prepares the EvaluatePolicies request. -func (client PolicySetsClient) EvaluatePoliciesPreparer(resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies", pathParameters), - autorest.WithJSON(evaluatePoliciesRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// EvaluatePoliciesSender sends the EvaluatePolicies request. The method will close the -// http.Response Body if it receives an error. -func (client PolicySetsClient) EvaluatePoliciesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// EvaluatePoliciesResponder handles the response to the EvaluatePolicies request. The method always -// closes the http.Response Body. -func (client PolicySetsClient) EvaluatePoliciesResponder(resp *http.Response) (result EvaluatePoliciesResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// PolicySetsClient is the the DevTest Labs Client. +type PolicySetsClient struct { + ManagementClient +} + +// NewPolicySetsClient creates an instance of the PolicySetsClient client. +func NewPolicySetsClient(subscriptionID string) PolicySetsClient { + return NewPolicySetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPolicySetsClientWithBaseURI creates an instance of the PolicySetsClient +// client. +func NewPolicySetsClientWithBaseURI(baseURI string, subscriptionID string) PolicySetsClient { + return PolicySetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// EvaluatePolicies evaluates lab policy. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the policy set. evaluatePoliciesRequest is +// request body for evaluating a policy set. +func (client PolicySetsClient) EvaluatePolicies(resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (result EvaluatePoliciesResponse, err error) { + req, err := client.EvaluatePoliciesPreparer(resourceGroupName, labName, name, evaluatePoliciesRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PolicySetsClient", "EvaluatePolicies", nil, "Failure preparing request") + return + } + + resp, err := client.EvaluatePoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.PolicySetsClient", "EvaluatePolicies", resp, "Failure sending request") + return + } + + result, err = client.EvaluatePoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.PolicySetsClient", "EvaluatePolicies", resp, "Failure responding to request") + } + + return +} + +// EvaluatePoliciesPreparer prepares the EvaluatePolicies request. +func (client PolicySetsClient) EvaluatePoliciesPreparer(resourceGroupName string, labName string, name string, evaluatePoliciesRequest EvaluatePoliciesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies", pathParameters), + autorest.WithJSON(evaluatePoliciesRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EvaluatePoliciesSender sends the EvaluatePolicies request. The method will close the +// http.Response Body if it receives an error. +func (client PolicySetsClient) EvaluatePoliciesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EvaluatePoliciesResponder handles the response to the EvaluatePolicies request. The method always +// closes the http.Response Body. +func (client PolicySetsClient) EvaluatePoliciesResponder(resp *http.Response) (result EvaluatePoliciesResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/schedules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/schedules.go index 961299f682..2a8ab3335d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/schedules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/schedules.go @@ -1,601 +1,601 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SchedulesClient is the the DevTest Labs Client. -type SchedulesClient struct { - ManagementClient -} - -// NewSchedulesClient creates an instance of the SchedulesClient client. -func NewSchedulesClient(subscriptionID string) SchedulesClient { - return NewSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSchedulesClientWithBaseURI creates an instance of the SchedulesClient -// client. -func NewSchedulesClientWithBaseURI(baseURI string, subscriptionID string) SchedulesClient { - return SchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the schedule. schedule is a schedule. -func (client SchedulesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, schedule Schedule) (result Schedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the schedule. -func (client SchedulesClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SchedulesClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the schedule. -func (client SchedulesClient) Execute(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExecutePreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Execute", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExecutePreparer prepares the Execute request. -func (client SchedulesClient) ExecutePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client SchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the schedule. expand is specify the $expand -// query. Example: 'properties($select=status)' -func (client SchedulesClient) Get(resourceGroupName string, labName string, name string, expand string) (result Schedule, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SchedulesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list schedules in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=status)' filter is the filter to apply to the operation. -// top is the maximum number of resources to return from the operation. orderby -// is the ordering expression for the results, using OData notation. -func (client SchedulesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SchedulesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SchedulesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SchedulesClient) ListNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { - req, err := lastResults.ResponseWithContinuationSchedulePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListApplicable lists all applicable schedules -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the schedule. -func (client SchedulesClient) ListApplicable(resourceGroupName string, labName string, name string) (result ResponseWithContinuationSchedule, err error) { - req, err := client.ListApplicablePreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure sending request") - return - } - - result, err = client.ListApplicableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure responding to request") - } - - return -} - -// ListApplicablePreparer prepares the ListApplicable request. -func (client SchedulesClient) ListApplicablePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListApplicableSender sends the ListApplicable request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) ListApplicableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListApplicableResponder handles the response to the ListApplicable request. The method always -// closes the http.Response Body. -func (client SchedulesClient) ListApplicableResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListApplicableNextResults retrieves the next set of results, if any. -func (client SchedulesClient) ListApplicableNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { - req, err := lastResults.ResponseWithContinuationSchedulePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListApplicableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure sending next results request") - } - - result, err = client.ListApplicableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of schedules. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the schedule. schedule is a schedule. -func (client SchedulesClient) Update(resourceGroupName string, labName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SchedulesClient) UpdatePreparer(resourceGroupName string, labName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SchedulesClient is the the DevTest Labs Client. +type SchedulesClient struct { + ManagementClient +} + +// NewSchedulesClient creates an instance of the SchedulesClient client. +func NewSchedulesClient(subscriptionID string) SchedulesClient { + return NewSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSchedulesClientWithBaseURI creates an instance of the SchedulesClient +// client. +func NewSchedulesClientWithBaseURI(baseURI string, subscriptionID string) SchedulesClient { + return SchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing schedule. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the schedule. schedule is a schedule. +func (client SchedulesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, schedule Schedule) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schedule, + Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete schedule. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the schedule. +func (client SchedulesClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SchedulesClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Execute execute a schedule. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the schedule. +func (client SchedulesClient) Execute(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExecutePreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Execute", resp, "Failure sending request") + return + } + + result, err = client.ExecuteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Execute", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExecutePreparer prepares the Execute request. +func (client SchedulesClient) ExecutePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) ExecuteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client SchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get schedule. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the schedule. expand is specify the $expand +// query. Example: 'properties($select=status)' +func (client SchedulesClient) Get(resourceGroupName string, labName string, name string, expand string) (result Schedule, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SchedulesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list schedules in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=status)' filter is the filter to apply to the operation. +// top is the maximum number of resources to return from the operation. orderby +// is the ordering expression for the results, using OData notation. +func (client SchedulesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SchedulesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SchedulesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SchedulesClient) ListNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.ResponseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListApplicable lists all applicable schedules +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the schedule. +func (client SchedulesClient) ListApplicable(resourceGroupName string, labName string, name string) (result ResponseWithContinuationSchedule, err error) { + req, err := client.ListApplicablePreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure sending request") + return + } + + result, err = client.ListApplicableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure responding to request") + } + + return +} + +// ListApplicablePreparer prepares the ListApplicable request. +func (client SchedulesClient) ListApplicablePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListApplicableSender sends the ListApplicable request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) ListApplicableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListApplicableResponder handles the response to the ListApplicable request. The method always +// closes the http.Response Body. +func (client SchedulesClient) ListApplicableResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListApplicableNextResults retrieves the next set of results, if any. +func (client SchedulesClient) ListApplicableNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.ResponseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListApplicableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure sending next results request") + } + + result, err = client.ListApplicableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "ListApplicable", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of schedules. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the schedule. schedule is a schedule. +func (client SchedulesClient) Update(resourceGroupName string, labName string, name string, schedule ScheduleFragment) (result Schedule, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SchedulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SchedulesClient) UpdatePreparer(resourceGroupName string, labName string, name string, schedule ScheduleFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/secrets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/secrets.go index e6aaabaafc..598a7d0652 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/secrets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/secrets.go @@ -1,366 +1,366 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SecretsClient is the the DevTest Labs Client. -type SecretsClient struct { - ManagementClient -} - -// NewSecretsClient creates an instance of the SecretsClient client. -func NewSecretsClient(subscriptionID string) SecretsClient { - return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client. -func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { - return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing secret. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// secret. secret is a secret. -func (client SecretsClient) CreateOrUpdate(resourceGroupName string, labName string, userName string, name string, secret Secret) (result Secret, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: secret, - Constraints: []validation.Constraint{{Target: "secret.SecretProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.SecretsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, userName, name, secret) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SecretsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, userName string, name string, secret Secret) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithJSON(secret), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete secret. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// secret. -func (client SecretsClient) Delete(resourceGroupName string, labName string, userName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, userName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SecretsClient) DeletePreparer(resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get secret. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. name is the name of the -// secret. expand is specify the $expand query. Example: -// 'properties($select=value)' -func (client SecretsClient) Get(resourceGroupName string, labName string, userName string, name string, expand string) (result Secret, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, userName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SecretsClient) GetPreparer(resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list secrets in a given user profile. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. userName is the name of the user profile. expand is specify the -// $expand query. Example: 'properties($select=value)' filter is the filter to -// apply to the operation. top is the maximum number of resources to return -// from the operation. orderby is the ordering expression for the results, -// using OData notation. -func (client SecretsClient) List(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSecret, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, userName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SecretsClient) ListPreparer(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SecretsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SecretsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSecret, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SecretsClient) ListNextResults(lastResults ResponseWithContinuationSecret) (result ResponseWithContinuationSecret, err error) { - req, err := lastResults.ResponseWithContinuationSecretPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SecretsClient is the the DevTest Labs Client. +type SecretsClient struct { + ManagementClient +} + +// NewSecretsClient creates an instance of the SecretsClient client. +func NewSecretsClient(subscriptionID string) SecretsClient { + return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client. +func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { + return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing secret. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// secret. secret is a secret. +func (client SecretsClient) CreateOrUpdate(resourceGroupName string, labName string, userName string, name string, secret Secret) (result Secret, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: secret, + Constraints: []validation.Constraint{{Target: "secret.SecretProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.SecretsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, userName, name, secret) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecretsClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, userName string, name string, secret Secret) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), + autorest.WithJSON(secret), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete secret. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// secret. +func (client SecretsClient) Delete(resourceGroupName string, labName string, userName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, userName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecretsClient) DeletePreparer(resourceGroupName string, labName string, userName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get secret. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. name is the name of the +// secret. expand is specify the $expand query. Example: +// 'properties($select=value)' +func (client SecretsClient) Get(resourceGroupName string, labName string, userName string, name string, expand string) (result Secret, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, userName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecretsClient) GetPreparer(resourceGroupName string, labName string, userName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list secrets in a given user profile. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. userName is the name of the user profile. expand is specify the +// $expand query. Example: 'properties($select=value)' filter is the filter to +// apply to the operation. top is the maximum number of resources to return +// from the operation. orderby is the ordering expression for the results, +// using OData notation. +func (client SecretsClient) List(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSecret, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, userName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecretsClient) ListPreparer(resourceGroupName string, labName string, userName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecretsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSecret, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SecretsClient) ListNextResults(lastResults ResponseWithContinuationSecret) (result ResponseWithContinuationSecret, err error) { + req, err := lastResults.ResponseWithContinuationSecretPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.SecretsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/servicerunners.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/servicerunners.go index 9f99d41c93..5f473b636d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/servicerunners.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/servicerunners.go @@ -1,346 +1,346 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ServiceRunnersClient is the the DevTest Labs Client. -type ServiceRunnersClient struct { - ManagementClient -} - -// NewServiceRunnersClient creates an instance of the ServiceRunnersClient -// client. -func NewServiceRunnersClient(subscriptionID string) ServiceRunnersClient { - return NewServiceRunnersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceRunnersClientWithBaseURI creates an instance of the -// ServiceRunnersClient client. -func NewServiceRunnersClientWithBaseURI(baseURI string, subscriptionID string) ServiceRunnersClient { - return ServiceRunnersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing Service runner. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the service runner. serviceRunner is a -// container for a managed identity to execute DevTest lab services. -func (client ServiceRunnersClient) CreateOrUpdate(resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (result ServiceRunner, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, serviceRunner) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceRunnersClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), - autorest.WithJSON(serviceRunner), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceRunner, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete service runner. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the service runner. -func (client ServiceRunnersClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceRunnersClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get service runner. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the service runner. -func (client ServiceRunnersClient) Get(resourceGroupName string, labName string, name string) (result ServiceRunner, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceRunnersClient) GetPreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) GetResponder(resp *http.Response) (result ServiceRunner, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list service runners in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. filter is the filter to apply to the operation. top is the maximum -// number of resources to return from the operation. orderby is the ordering -// expression for the results, using OData notation. -func (client ServiceRunnersClient) List(resourceGroupName string, labName string, filter string, top *int32, orderby string) (result ResponseWithContinuationServiceRunner, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ServiceRunnersClient) ListPreparer(resourceGroupName string, labName string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceRunnersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServiceRunnersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationServiceRunner, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ServiceRunnersClient) ListNextResults(lastResults ResponseWithContinuationServiceRunner) (result ResponseWithContinuationServiceRunner, err error) { - req, err := lastResults.ResponseWithContinuationServiceRunnerPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure responding to next results request") - } - - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ServiceRunnersClient is the the DevTest Labs Client. +type ServiceRunnersClient struct { + ManagementClient +} + +// NewServiceRunnersClient creates an instance of the ServiceRunnersClient +// client. +func NewServiceRunnersClient(subscriptionID string) ServiceRunnersClient { + return NewServiceRunnersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceRunnersClientWithBaseURI creates an instance of the +// ServiceRunnersClient client. +func NewServiceRunnersClientWithBaseURI(baseURI string, subscriptionID string) ServiceRunnersClient { + return ServiceRunnersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing Service runner. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the service runner. serviceRunner is a +// container for a managed identity to execute DevTest lab services. +func (client ServiceRunnersClient) CreateOrUpdate(resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (result ServiceRunner, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, serviceRunner) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceRunnersClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, serviceRunner ServiceRunner) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), + autorest.WithJSON(serviceRunner), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServiceRunnersClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceRunner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete service runner. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the service runner. +func (client ServiceRunnersClient) Delete(resourceGroupName string, labName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServiceRunnersClient) DeletePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServiceRunnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get service runner. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the service runner. +func (client ServiceRunnersClient) Get(resourceGroupName string, labName string, name string) (result ServiceRunner, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceRunnersClient) GetPreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServiceRunnersClient) GetResponder(resp *http.Response) (result ServiceRunner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list service runners in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. filter is the filter to apply to the operation. top is the maximum +// number of resources to return from the operation. orderby is the ordering +// expression for the results, using OData notation. +func (client ServiceRunnersClient) List(resourceGroupName string, labName string, filter string, top *int32, orderby string) (result ResponseWithContinuationServiceRunner, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceRunnersClient) ListPreparer(resourceGroupName string, labName string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRunnersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServiceRunnersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationServiceRunner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ServiceRunnersClient) ListNextResults(lastResults ResponseWithContinuationServiceRunner) (result ResponseWithContinuationServiceRunner, err error) { + req, err := lastResults.ResponseWithContinuationServiceRunnerPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.ServiceRunnersClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/users.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/users.go index 01be36c5d2..86c22e8de5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/users.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/users.go @@ -1,439 +1,439 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// UsersClient is the the DevTest Labs Client. -type UsersClient struct { - ManagementClient -} - -// NewUsersClient creates an instance of the UsersClient client. -func NewUsersClient(subscriptionID string) UsersClient { - return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsersClientWithBaseURI creates an instance of the UsersClient client. -func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { - return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing user profile. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the user profile. userParameter is profile of a -// lab user. -func (client UsersClient) CreateOrUpdate(resourceGroupName string, labName string, name string, userParameter User) (result User, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, userParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client UsersClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, userParameter User) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithJSON(userParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete user profile. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the user profile. -func (client UsersClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client UsersClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get user profile. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the user profile. expand is specify the $expand -// query. Example: 'properties($select=identity)' -func (client UsersClient) Get(resourceGroupName string, labName string, name string, expand string) (result User, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client UsersClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list user profiles in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($select=identity)' filter is the filter to apply to the -// operation. top is the maximum number of resources to return from the -// operation. orderby is the ordering expression for the results, using OData -// notation. -func (client UsersClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationUser, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsersClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationUser, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client UsersClient) ListNextResults(lastResults ResponseWithContinuationUser) (result ResponseWithContinuationUser, err error) { - req, err := lastResults.ResponseWithContinuationUserPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of user profiles. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the user profile. userParameter is profile of a -// lab user. -func (client UsersClient) Update(resourceGroupName string, labName string, name string, userParameter UserFragment) (result User, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, name, userParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UsersClient) UpdatePreparer(resourceGroupName string, labName string, name string, userParameter UserFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), - autorest.WithJSON(userParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client UsersClient) UpdateResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// UsersClient is the the DevTest Labs Client. +type UsersClient struct { + ManagementClient +} + +// NewUsersClient creates an instance of the UsersClient client. +func NewUsersClient(subscriptionID string) UsersClient { + return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsersClientWithBaseURI creates an instance of the UsersClient client. +func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { + return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing user profile. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the user profile. userParameter is profile of a +// lab user. +func (client UsersClient) CreateOrUpdate(resourceGroupName string, labName string, name string, userParameter User) (result User, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, userParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UsersClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, userParameter User) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete user profile. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the user profile. +func (client UsersClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client UsersClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get user profile. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the user profile. expand is specify the $expand +// query. Example: 'properties($select=identity)' +func (client UsersClient) Get(resourceGroupName string, labName string, name string, expand string) (result User, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client UsersClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list user profiles in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($select=identity)' filter is the filter to apply to the +// operation. top is the maximum number of resources to return from the +// operation. orderby is the ordering expression for the results, using OData +// notation. +func (client UsersClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationUser, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsersClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationUser, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client UsersClient) ListNextResults(lastResults ResponseWithContinuationUser) (result ResponseWithContinuationUser, err error) { + req, err := lastResults.ResponseWithContinuationUserPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of user profiles. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the user profile. userParameter is profile of a +// lab user. +func (client UsersClient) Update(resourceGroupName string, labName string, name string, userParameter UserFragment) (result User, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, name, userParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.UsersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UsersClient) UpdatePreparer(resourceGroupName string, labName string, name string, userParameter UserFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client UsersClient) UpdateResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/version.go index c52586311c..32062bdcfa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/version.go @@ -1,29 +1,29 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-devtestlabs/2016-05-15" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-devtestlabs/2016-05-15" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachines.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachines.go index 89f76547c9..bcd1f5194d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachines.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachines.go @@ -1,1045 +1,1045 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualMachinesClient is the the DevTest Labs Client. -type VirtualMachinesClient struct { - ManagementClient -} - -// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient -// client. -func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { - return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachinesClientWithBaseURI creates an instance of the -// VirtualMachinesClient client. -func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { - return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddDataDisk attach a new or existing data disk to virtual machine. This -// operation can take a while to complete. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. dataDiskProperties is -// request body for adding a new or existing data disk to a virtual machine. -func (client VirtualMachinesClient) AddDataDisk(resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.AddDataDiskPreparer(resourceGroupName, labName, name, dataDiskProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "AddDataDisk", nil, "Failure preparing request") - return - } - - resp, err := client.AddDataDiskSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "AddDataDisk", resp, "Failure sending request") - return - } - - result, err = client.AddDataDiskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "AddDataDisk", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// AddDataDiskPreparer prepares the AddDataDisk request. -func (client VirtualMachinesClient) AddDataDiskPreparer(resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk", pathParameters), - autorest.WithJSON(dataDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// AddDataDiskSender sends the AddDataDisk request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) AddDataDiskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// AddDataDiskResponder handles the response to the AddDataDisk request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) AddDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ApplyArtifacts apply artifacts to virtual machine. This operation can take a -// while to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. applyArtifactsRequest is -// request body for applying artifacts to a virtual machine. -func (client VirtualMachinesClient) ApplyArtifacts(resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ApplyArtifactsPreparer(resourceGroupName, labName, name, applyArtifactsRequest, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ApplyArtifacts", nil, "Failure preparing request") - return - } - - resp, err := client.ApplyArtifactsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ApplyArtifacts", resp, "Failure sending request") - return - } - - result, err = client.ApplyArtifactsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ApplyArtifacts", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ApplyArtifactsPreparer prepares the ApplyArtifacts request. -func (client VirtualMachinesClient) ApplyArtifactsPreparer(resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts", pathParameters), - autorest.WithJSON(applyArtifactsRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ApplyArtifactsSender sends the ApplyArtifacts request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ApplyArtifactsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ApplyArtifactsResponder handles the response to the ApplyArtifacts request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ApplyArtifactsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Claim take ownership of an existing virtual machine This operation can take -// a while to complete. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. -func (client VirtualMachinesClient) Claim(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ClaimPreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Claim", nil, "Failure preparing request") - return - } - - resp, err := client.ClaimSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Claim", resp, "Failure sending request") - return - } - - result, err = client.ClaimResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Claim", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ClaimPreparer prepares the Claim request. -func (client VirtualMachinesClient) ClaimPreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ClaimSender sends the Claim request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ClaimSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ClaimResponder handles the response to the Claim request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ClaimResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or replace an existing Virtual machine. This operation -// can take a while to complete. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. labVirtualMachine is a -// virtual machine. -func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine, cancel <-chan struct{}) (<-chan LabVirtualMachine, <-chan error) { - resultChan := make(chan LabVirtualMachine, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: labVirtualMachine, - Constraints: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result LabVirtualMachine - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, labVirtualMachine, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithJSON(labVirtualMachine), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result LabVirtualMachine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete virtual machine. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. -func (client VirtualMachinesClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachDataDisk detach the specified disk from the virtual machine. This -// operation can take a while to complete. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. detachDataDiskProperties -// is request body for detaching data disk from a virtual machine. -func (client VirtualMachinesClient) DetachDataDisk(resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DetachDataDiskPreparer(resourceGroupName, labName, name, detachDataDiskProperties, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "DetachDataDisk", nil, "Failure preparing request") - return - } - - resp, err := client.DetachDataDiskSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "DetachDataDisk", resp, "Failure sending request") - return - } - - result, err = client.DetachDataDiskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "DetachDataDisk", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DetachDataDiskPreparer prepares the DetachDataDisk request. -func (client VirtualMachinesClient) DetachDataDiskPreparer(resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk", pathParameters), - autorest.WithJSON(detachDataDiskProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DetachDataDiskSender sends the DetachDataDisk request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) DetachDataDiskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DetachDataDiskResponder handles the response to the DetachDataDisk request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) DetachDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get virtual machine. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. expand is specify the -// $expand query. Example: -// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' -func (client VirtualMachinesClient) Get(resourceGroupName string, labName string, name string, expand string) (result LabVirtualMachine, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result LabVirtualMachine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list virtual machines in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' -// filter is the filter to apply to the operation. top is the maximum number of -// resources to return from the operation. orderby is the ordering expression -// for the results, using OData notation. -func (client VirtualMachinesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabVirtualMachine, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachinesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationLabVirtualMachine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualMachinesClient) ListNextResults(lastResults ResponseWithContinuationLabVirtualMachine) (result ResponseWithContinuationLabVirtualMachine, err error) { - req, err := lastResults.ResponseWithContinuationLabVirtualMachinePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListApplicableSchedules lists all applicable schedules -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. -func (client VirtualMachinesClient) ListApplicableSchedules(resourceGroupName string, labName string, name string) (result ApplicableSchedule, err error) { - req, err := client.ListApplicableSchedulesPreparer(resourceGroupName, labName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ListApplicableSchedules", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicableSchedulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure sending request") - return - } - - result, err = client.ListApplicableSchedulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure responding to request") - } - - return -} - -// ListApplicableSchedulesPreparer prepares the ListApplicableSchedules request. -func (client VirtualMachinesClient) ListApplicableSchedulesPreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListApplicableSchedulesSender sends the ListApplicableSchedules request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) ListApplicableSchedulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListApplicableSchedulesResponder handles the response to the ListApplicableSchedules request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) ListApplicableSchedulesResponder(resp *http.Response) (result ApplicableSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start start a virtual machine. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. -func (client VirtualMachinesClient) Start(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StartPreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Start", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StartPreparer prepares the Start request. -func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stop a virtual machine This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. -func (client VirtualMachinesClient) Stop(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StopPreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Stop", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StopPreparer prepares the Stop request. -func (client VirtualMachinesClient) StopPreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update modify properties of virtual machines. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual machine. labVirtualMachine is a -// virtual machine. -func (client VirtualMachinesClient) Update(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (result LabVirtualMachine, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, name, labVirtualMachine) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualMachinesClient) UpdatePreparer(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), - autorest.WithJSON(labVirtualMachine), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachinesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VirtualMachinesClient) UpdateResponder(resp *http.Response) (result LabVirtualMachine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualMachinesClient is the the DevTest Labs Client. +type VirtualMachinesClient struct { + ManagementClient +} + +// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient +// client. +func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient { + return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachinesClientWithBaseURI creates an instance of the +// VirtualMachinesClient client. +func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient { + return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddDataDisk attach a new or existing data disk to virtual machine. This +// operation can take a while to complete. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. dataDiskProperties is +// request body for adding a new or existing data disk to a virtual machine. +func (client VirtualMachinesClient) AddDataDisk(resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.AddDataDiskPreparer(resourceGroupName, labName, name, dataDiskProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "AddDataDisk", nil, "Failure preparing request") + return + } + + resp, err := client.AddDataDiskSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "AddDataDisk", resp, "Failure sending request") + return + } + + result, err = client.AddDataDiskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "AddDataDisk", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// AddDataDiskPreparer prepares the AddDataDisk request. +func (client VirtualMachinesClient) AddDataDiskPreparer(resourceGroupName string, labName string, name string, dataDiskProperties DataDiskProperties, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk", pathParameters), + autorest.WithJSON(dataDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// AddDataDiskSender sends the AddDataDisk request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) AddDataDiskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// AddDataDiskResponder handles the response to the AddDataDisk request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) AddDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApplyArtifacts apply artifacts to virtual machine. This operation can take a +// while to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. applyArtifactsRequest is +// request body for applying artifacts to a virtual machine. +func (client VirtualMachinesClient) ApplyArtifacts(resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ApplyArtifactsPreparer(resourceGroupName, labName, name, applyArtifactsRequest, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ApplyArtifacts", nil, "Failure preparing request") + return + } + + resp, err := client.ApplyArtifactsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ApplyArtifacts", resp, "Failure sending request") + return + } + + result, err = client.ApplyArtifactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ApplyArtifacts", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ApplyArtifactsPreparer prepares the ApplyArtifacts request. +func (client VirtualMachinesClient) ApplyArtifactsPreparer(resourceGroupName string, labName string, name string, applyArtifactsRequest ApplyArtifactsRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts", pathParameters), + autorest.WithJSON(applyArtifactsRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ApplyArtifactsSender sends the ApplyArtifacts request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ApplyArtifactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ApplyArtifactsResponder handles the response to the ApplyArtifacts request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ApplyArtifactsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Claim take ownership of an existing virtual machine This operation can take +// a while to complete. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. +func (client VirtualMachinesClient) Claim(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ClaimPreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Claim", nil, "Failure preparing request") + return + } + + resp, err := client.ClaimSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Claim", resp, "Failure sending request") + return + } + + result, err = client.ClaimResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Claim", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ClaimPreparer prepares the Claim request. +func (client VirtualMachinesClient) ClaimPreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ClaimSender sends the Claim request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ClaimSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ClaimResponder handles the response to the Claim request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ClaimResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing Virtual machine. This operation +// can take a while to complete. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. labVirtualMachine is a +// virtual machine. +func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine, cancel <-chan struct{}) (<-chan LabVirtualMachine, <-chan error) { + resultChan := make(chan LabVirtualMachine, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: labVirtualMachine, + Constraints: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsShutdown.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "labVirtualMachine.LabVirtualMachineProperties.ApplicableSchedule.ApplicableScheduleProperties.LabVmsStartup.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result LabVirtualMachine + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, labVirtualMachine, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachine, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithJSON(labVirtualMachine), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result LabVirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete virtual machine. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. +func (client VirtualMachinesClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DetachDataDisk detach the specified disk from the virtual machine. This +// operation can take a while to complete. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. detachDataDiskProperties +// is request body for detaching data disk from a virtual machine. +func (client VirtualMachinesClient) DetachDataDisk(resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DetachDataDiskPreparer(resourceGroupName, labName, name, detachDataDiskProperties, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "DetachDataDisk", nil, "Failure preparing request") + return + } + + resp, err := client.DetachDataDiskSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "DetachDataDisk", resp, "Failure sending request") + return + } + + result, err = client.DetachDataDiskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "DetachDataDisk", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DetachDataDiskPreparer prepares the DetachDataDisk request. +func (client VirtualMachinesClient) DetachDataDiskPreparer(resourceGroupName string, labName string, name string, detachDataDiskProperties DetachDataDiskProperties, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk", pathParameters), + autorest.WithJSON(detachDataDiskProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DetachDataDiskSender sends the DetachDataDisk request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) DetachDataDiskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DetachDataDiskResponder handles the response to the DetachDataDisk request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) DetachDataDiskResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get virtual machine. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. expand is specify the +// $expand query. Example: +// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' +func (client VirtualMachinesClient) Get(resourceGroupName string, labName string, name string, expand string) (result LabVirtualMachine, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result LabVirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list virtual machines in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' +// filter is the filter to apply to the operation. top is the maximum number of +// resources to return from the operation. orderby is the ordering expression +// for the results, using OData notation. +func (client VirtualMachinesClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabVirtualMachine, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachinesClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationLabVirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualMachinesClient) ListNextResults(lastResults ResponseWithContinuationLabVirtualMachine) (result ResponseWithContinuationLabVirtualMachine, err error) { + req, err := lastResults.ResponseWithContinuationLabVirtualMachinePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListApplicableSchedules lists all applicable schedules +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. +func (client VirtualMachinesClient) ListApplicableSchedules(resourceGroupName string, labName string, name string) (result ApplicableSchedule, err error) { + req, err := client.ListApplicableSchedulesPreparer(resourceGroupName, labName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ListApplicableSchedules", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicableSchedulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure sending request") + return + } + + result, err = client.ListApplicableSchedulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "ListApplicableSchedules", resp, "Failure responding to request") + } + + return +} + +// ListApplicableSchedulesPreparer prepares the ListApplicableSchedules request. +func (client VirtualMachinesClient) ListApplicableSchedulesPreparer(resourceGroupName string, labName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListApplicableSchedulesSender sends the ListApplicableSchedules request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) ListApplicableSchedulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListApplicableSchedulesResponder handles the response to the ListApplicableSchedules request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) ListApplicableSchedulesResponder(resp *http.Response) (result ApplicableSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start start a virtual machine. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. +func (client VirtualMachinesClient) Start(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop a virtual machine This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. +func (client VirtualMachinesClient) Stop(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StopPreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Stop", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StopPreparer prepares the Stop request. +func (client VirtualMachinesClient) StopPreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of virtual machines. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual machine. labVirtualMachine is a +// virtual machine. +func (client VirtualMachinesClient) Update(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (result LabVirtualMachine, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, name, labVirtualMachine) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachinesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachinesClient) UpdatePreparer(resourceGroupName string, labName string, name string, labVirtualMachine LabVirtualMachineFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", pathParameters), + autorest.WithJSON(labVirtualMachine), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachinesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachinesClient) UpdateResponder(resp *http.Response) (result LabVirtualMachine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachineschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachineschedules.go index f34390f453..509d9d03d6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachineschedules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualmachineschedules.go @@ -1,523 +1,523 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualMachineSchedulesClient is the the DevTest Labs Client. -type VirtualMachineSchedulesClient struct { - ManagementClient -} - -// NewVirtualMachineSchedulesClient creates an instance of the -// VirtualMachineSchedulesClient client. -func NewVirtualMachineSchedulesClient(subscriptionID string) VirtualMachineSchedulesClient { - return NewVirtualMachineSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualMachineSchedulesClientWithBaseURI creates an instance of the -// VirtualMachineSchedulesClient client. -func NewVirtualMachineSchedulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSchedulesClient { - return VirtualMachineSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing schedule. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. virtualMachineName is the name of the virtual machine. name is the -// name of the schedule. schedule is a schedule. -func (client VirtualMachineSchedulesClient) CreateOrUpdate(resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (result Schedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: schedule, - Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, virtualMachineName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualMachineSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete schedule. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. virtualMachineName is the name of the virtual machine. name is the -// name of the schedule. -func (client VirtualMachineSchedulesClient) Delete(resourceGroupName string, labName string, virtualMachineName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, labName, virtualMachineName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualMachineSchedulesClient) DeletePreparer(resourceGroupName string, labName string, virtualMachineName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute execute a schedule. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. virtualMachineName is the name of the virtual machine. name is the -// name of the schedule. -func (client VirtualMachineSchedulesClient) Execute(resourceGroupName string, labName string, virtualMachineName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExecutePreparer(resourceGroupName, labName, virtualMachineName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Execute", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExecutePreparer prepares the Execute request. -func (client VirtualMachineSchedulesClient) ExecutePreparer(resourceGroupName string, labName string, virtualMachineName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get schedule. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. virtualMachineName is the name of the virtual machine. name is the -// name of the schedule. expand is specify the $expand query. Example: -// 'properties($select=status)' -func (client VirtualMachineSchedulesClient) Get(resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (result Schedule, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, virtualMachineName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualMachineSchedulesClient) GetPreparer(resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list schedules in a given virtual machine. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. virtualMachineName is the name of the virtual machine. expand is -// specify the $expand query. Example: 'properties($select=status)' filter is -// the filter to apply to the operation. top is the maximum number of resources -// to return from the operation. orderby is the ordering expression for the -// results, using OData notation. -func (client VirtualMachineSchedulesClient) List(resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualMachineSchedulesClient) ListPreparer(resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualMachineSchedulesClient) ListNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { - req, err := lastResults.ResponseWithContinuationSchedulePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of schedules. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. virtualMachineName is the name of the virtual machine. name is the -// name of the schedule. schedule is a schedule. -func (client VirtualMachineSchedulesClient) Update(resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (result Schedule, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, virtualMachineName, name, schedule) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualMachineSchedulesClient) UpdatePreparer(resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineName": autorest.Encode("path", virtualMachineName), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), - autorest.WithJSON(schedule), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualMachineSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VirtualMachineSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualMachineSchedulesClient is the the DevTest Labs Client. +type VirtualMachineSchedulesClient struct { + ManagementClient +} + +// NewVirtualMachineSchedulesClient creates an instance of the +// VirtualMachineSchedulesClient client. +func NewVirtualMachineSchedulesClient(subscriptionID string) VirtualMachineSchedulesClient { + return NewVirtualMachineSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineSchedulesClientWithBaseURI creates an instance of the +// VirtualMachineSchedulesClient client. +func NewVirtualMachineSchedulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSchedulesClient { + return VirtualMachineSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing schedule. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. virtualMachineName is the name of the virtual machine. name is the +// name of the schedule. schedule is a schedule. +func (client VirtualMachineSchedulesClient) CreateOrUpdate(resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (result Schedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schedule, + Constraints: []validation.Constraint{{Target: "schedule.ScheduleProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, virtualMachineName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, virtualMachineName string, name string, schedule Schedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete schedule. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. virtualMachineName is the name of the virtual machine. name is the +// name of the schedule. +func (client VirtualMachineSchedulesClient) Delete(resourceGroupName string, labName string, virtualMachineName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, labName, virtualMachineName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineSchedulesClient) DeletePreparer(resourceGroupName string, labName string, virtualMachineName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Execute execute a schedule. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. virtualMachineName is the name of the virtual machine. name is the +// name of the schedule. +func (client VirtualMachineSchedulesClient) Execute(resourceGroupName string, labName string, virtualMachineName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExecutePreparer(resourceGroupName, labName, virtualMachineName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Execute", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Execute", resp, "Failure sending request") + return + } + + result, err = client.ExecuteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Execute", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExecutePreparer prepares the Execute request. +func (client VirtualMachineSchedulesClient) ExecutePreparer(resourceGroupName string, labName string, virtualMachineName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExecuteSender sends the Execute request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) ExecuteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExecuteResponder handles the response to the Execute request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get schedule. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. virtualMachineName is the name of the virtual machine. name is the +// name of the schedule. expand is specify the $expand query. Example: +// 'properties($select=status)' +func (client VirtualMachineSchedulesClient) Get(resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (result Schedule, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, virtualMachineName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineSchedulesClient) GetPreparer(resourceGroupName string, labName string, virtualMachineName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) GetResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list schedules in a given virtual machine. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. virtualMachineName is the name of the virtual machine. expand is +// specify the $expand query. Example: 'properties($select=status)' filter is +// the filter to apply to the operation. top is the maximum number of resources +// to return from the operation. orderby is the ordering expression for the +// results, using OData notation. +func (client VirtualMachineSchedulesClient) List(resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationSchedule, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineSchedulesClient) ListPreparer(resourceGroupName string, labName string, virtualMachineName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualMachineSchedulesClient) ListNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) { + req, err := lastResults.ResponseWithContinuationSchedulePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of schedules. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. virtualMachineName is the name of the virtual machine. name is the +// name of the schedule. schedule is a schedule. +func (client VirtualMachineSchedulesClient) Update(resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (result Schedule, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, virtualMachineName, name, schedule) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualMachineSchedulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineSchedulesClient) UpdatePreparer(resourceGroupName string, labName string, virtualMachineName string, name string, schedule ScheduleFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineName": autorest.Encode("path", virtualMachineName), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", pathParameters), + autorest.WithJSON(schedule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSchedulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualMachineSchedulesClient) UpdateResponder(resp *http.Response) (result Schedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualnetworks.go index 8381ffdfed..148411c28d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualnetworks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/devtestlabs/virtualnetworks.go @@ -1,457 +1,457 @@ -package devtestlabs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualNetworksClient is the the DevTest Labs Client. -type VirtualNetworksClient struct { - ManagementClient -} - -// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient -// client. -func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { - return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworksClientWithBaseURI creates an instance of the -// VirtualNetworksClient client. -func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { - return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace an existing virtual network. This operation -// can take a while to complete. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual network. virtualNetwork is a -// virtual network. -func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { - resultChan := make(chan VirtualNetwork, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result VirtualNetwork - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, virtualNetwork, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithJSON(virtualNetwork), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete virtual network. This operation can take a while to complete. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual network. -func (client VirtualNetworksClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get virtual network. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual network. expand is specify the -// $expand query. Example: 'properties($expand=externalSubnets)' -func (client VirtualNetworksClient) Get(resourceGroupName string, labName string, name string, expand string) (result VirtualNetwork, err error) { - req, err := client.GetPreparer(resourceGroupName, labName, name, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list virtual networks in a given lab. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. expand is specify the $expand query. Example: -// 'properties($expand=externalSubnets)' filter is the filter to apply to the -// operation. top is the maximum number of resources to return from the -// operation. orderby is the ordering expression for the results, using OData -// notation. -func (client VirtualNetworksClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationVirtualNetwork, err error) { - req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworksClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result ResponseWithContinuationVirtualNetwork, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) ListNextResults(lastResults ResponseWithContinuationVirtualNetwork) (result ResponseWithContinuationVirtualNetwork, err error) { - req, err := lastResults.ResponseWithContinuationVirtualNetworkPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Update modify properties of virtual networks. -// -// resourceGroupName is the name of the resource group. labName is the name of -// the lab. name is the name of the virtual network. virtualNetwork is a -// virtual network. -func (client VirtualNetworksClient) Update(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (result VirtualNetwork, err error) { - req, err := client.UpdatePreparer(resourceGroupName, labName, name, virtualNetwork) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VirtualNetworksClient) UpdatePreparer(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "labName": autorest.Encode("path", labName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-15" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), - autorest.WithJSON(virtualNetwork), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) UpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package devtestlabs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualNetworksClient is the the DevTest Labs Client. +type VirtualNetworksClient struct { + ManagementClient +} + +// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient +// client. +func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { + return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworksClientWithBaseURI creates an instance of the +// VirtualNetworksClient client. +func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { + return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing virtual network. This operation +// can take a while to complete. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual network. virtualNetwork is a +// virtual network. +func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { + resultChan := make(chan VirtualNetwork, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VirtualNetwork + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, labName, name, virtualNetwork, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithJSON(virtualNetwork), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete virtual network. This operation can take a while to complete. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual network. +func (client VirtualNetworksClient) Delete(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, labName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get virtual network. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual network. expand is specify the +// $expand query. Example: 'properties($expand=externalSubnets)' +func (client VirtualNetworksClient) Get(resourceGroupName string, labName string, name string, expand string) (result VirtualNetwork, err error) { + req, err := client.GetPreparer(resourceGroupName, labName, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, labName string, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list virtual networks in a given lab. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. expand is specify the $expand query. Example: +// 'properties($expand=externalSubnets)' filter is the filter to apply to the +// operation. top is the maximum number of resources to return from the +// operation. orderby is the ordering expression for the results, using OData +// notation. +func (client VirtualNetworksClient) List(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationVirtualNetwork, err error) { + req, err := client.ListPreparer(resourceGroupName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksClient) ListPreparer(resourceGroupName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result ResponseWithContinuationVirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) ListNextResults(lastResults ResponseWithContinuationVirtualNetwork) (result ResponseWithContinuationVirtualNetwork, err error) { + req, err := lastResults.ResponseWithContinuationVirtualNetworkPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Update modify properties of virtual networks. +// +// resourceGroupName is the name of the resource group. labName is the name of +// the lab. name is the name of the virtual network. virtualNetwork is a +// virtual network. +func (client VirtualNetworksClient) Update(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (result VirtualNetwork, err error) { + req, err := client.UpdatePreparer(resourceGroupName, labName, name, virtualNetwork) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devtestlabs.VirtualNetworksClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualNetworksClient) UpdatePreparer(resourceGroupName string, labName string, name string, virtualNetwork VirtualNetworkFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labName": autorest.Encode("path", labName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", pathParameters), + autorest.WithJSON(virtualNetwork), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) UpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/client.go index 48cfcfe431..8bab7acc13 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/client.go @@ -1,53 +1,53 @@ -// Package disk implements the Azure ARM Disk service API version -// 2016-04-30-preview. -// -// The Disk Resource Provider Client. -package disk - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Disk - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Disk. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package disk implements the Azure ARM Disk service API version +// 2016-04-30-preview. +// +// The Disk Resource Provider Client. +package disk + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Disk + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Disk. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/disks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/disks.go index 99dfbe1809..4f7fce74fc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/disks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/disks.go @@ -1,728 +1,728 @@ -package disk - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DisksClient is the the Disk Resource Provider Client. -type DisksClient struct { - ManagementClient -} - -// NewDisksClient creates an instance of the DisksClient client. -func NewDisksClient(subscriptionID string) DisksClient { - return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDisksClientWithBaseURI creates an instance of the DisksClient client. -func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { - return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a disk. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. diskName is the name of -// the disk within the given subscription and resource group. diskParameter is -// disk object supplied in the body of the Put disk operation. -func (client DisksClient) CreateOrUpdate(resourceGroupName string, diskName string, diskParameter Model, cancel <-chan struct{}) (<-chan Model, <-chan error) { - resultChan := make(chan Model, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: diskParameter, - Constraints: []validation.Constraint{{Target: "diskParameter.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData.ImageReference", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "diskParameter.Properties.EncryptionSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "disk.DisksClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Model - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, diskName, diskParameter, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DisksClient) CreateOrUpdatePreparer(resourceGroupName string, diskName string, diskParameter Model, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diskName": autorest.Encode("path", diskName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), - autorest.WithJSON(diskParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Model, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a disk. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. diskName is the name of -// the disk within the given subscription and resource group. -func (client DisksClient) Delete(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, diskName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client DisksClient) DeletePreparer(resourceGroupName string, diskName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diskName": autorest.Encode("path", diskName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DisksClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about a disk. -// -// resourceGroupName is the name of the resource group. diskName is the name of -// the disk within the given subscription and resource group. -func (client DisksClient) Get(resourceGroupName string, diskName string) (result Model, err error) { - req, err := client.GetPreparer(resourceGroupName, diskName) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DisksClient) GetPreparer(resourceGroupName string, diskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diskName": autorest.Encode("path", diskName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DisksClient) GetResponder(resp *http.Response) (result Model, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GrantAccess grants access to a disk. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. diskName is the name of -// the disk within the given subscription and resource group. grantAccessData -// is access data object supplied in the body of the get disk access operation. -func (client DisksClient) GrantAccess(resourceGroupName string, diskName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (<-chan AccessURI, <-chan error) { - resultChan := make(chan AccessURI, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: grantAccessData, - Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "disk.DisksClient", "GrantAccess") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result AccessURI - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GrantAccessPreparer(resourceGroupName, diskName, grantAccessData, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", nil, "Failure preparing request") - return - } - - resp, err := client.GrantAccessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", resp, "Failure sending request") - return - } - - result, err = client.GrantAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GrantAccessPreparer prepares the GrantAccess request. -func (client DisksClient) GrantAccessPreparer(resourceGroupName string, diskName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diskName": autorest.Encode("path", diskName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters), - autorest.WithJSON(grantAccessData), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GrantAccessSender sends the GrantAccess request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) GrantAccessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GrantAccessResponder handles the response to the GrantAccess request. The method always -// closes the http.Response Body. -func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the disks under a subscription. -func (client DisksClient) List() (result ListType, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DisksClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DisksClient) ListResponder(resp *http.Response) (result ListType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DisksClient) ListNextResults(lastResults ListType) (result ListType, err error) { - req, err := lastResults.ListTypePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "disk.DisksClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists all the disks under a resource group. -// -// resourceGroupName is the name of the resource group. -func (client DisksClient) ListByResourceGroup(resourceGroupName string) (result ListType, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DisksClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result ListType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client DisksClient) ListByResourceGroupNextResults(lastResults ListType) (result ListType, err error) { - req, err := lastResults.ListTypePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// RevokeAccess revokes access to a disk. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. diskName is the name of -// the disk within the given subscription and resource group. -func (client DisksClient) RevokeAccess(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RevokeAccessPreparer(resourceGroupName, diskName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", nil, "Failure preparing request") - return - } - - resp, err := client.RevokeAccessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", resp, "Failure sending request") - return - } - - result, err = client.RevokeAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RevokeAccessPreparer prepares the RevokeAccess request. -func (client DisksClient) RevokeAccessPreparer(resourceGroupName string, diskName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diskName": autorest.Encode("path", diskName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RevokeAccessSender sends the RevokeAccess request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) RevokeAccessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RevokeAccessResponder handles the response to the RevokeAccess request. The method always -// closes the http.Response Body. -func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates (patches) a disk. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. diskName is the name of -// the disk within the given subscription and resource group. diskParameter is -// disk object supplied in the body of the Patch disk operation. -func (client DisksClient) Update(resourceGroupName string, diskName string, diskParameter UpdateType, cancel <-chan struct{}) (<-chan Model, <-chan error) { - resultChan := make(chan Model, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Model - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, diskName, diskParameter, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client DisksClient) UpdatePreparer(resourceGroupName string, diskName string, diskParameter UpdateType, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diskName": autorest.Encode("path", diskName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), - autorest.WithJSON(diskParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DisksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DisksClient) UpdateResponder(resp *http.Response) (result Model, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package disk + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DisksClient is the the Disk Resource Provider Client. +type DisksClient struct { + ManagementClient +} + +// NewDisksClient creates an instance of the DisksClient client. +func NewDisksClient(subscriptionID string) DisksClient { + return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDisksClientWithBaseURI creates an instance of the DisksClient client. +func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient { + return DisksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a disk. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. diskName is the name of +// the disk within the given subscription and resource group. diskParameter is +// disk object supplied in the body of the Put disk operation. +func (client DisksClient) CreateOrUpdate(resourceGroupName string, diskName string, diskParameter Model, cancel <-chan struct{}) (<-chan Model, <-chan error) { + resultChan := make(chan Model, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: diskParameter, + Constraints: []validation.Constraint{{Target: "diskParameter.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData.ImageReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "diskParameter.Properties.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "disk.DisksClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Model + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, diskName, diskParameter, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DisksClient) CreateOrUpdatePreparer(resourceGroupName string, diskName string, diskParameter Model, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithJSON(diskParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Model, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a disk. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. diskName is the name of +// the disk within the given subscription and resource group. +func (client DisksClient) Delete(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, diskName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DisksClient) DeletePreparer(resourceGroupName string, diskName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DisksClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets information about a disk. +// +// resourceGroupName is the name of the resource group. diskName is the name of +// the disk within the given subscription and resource group. +func (client DisksClient) Get(resourceGroupName string, diskName string) (result Model, err error) { + req, err := client.GetPreparer(resourceGroupName, diskName) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DisksClient) GetPreparer(resourceGroupName string, diskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DisksClient) GetResponder(resp *http.Response) (result Model, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GrantAccess grants access to a disk. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. diskName is the name of +// the disk within the given subscription and resource group. grantAccessData +// is access data object supplied in the body of the get disk access operation. +func (client DisksClient) GrantAccess(resourceGroupName string, diskName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (<-chan AccessURI, <-chan error) { + resultChan := make(chan AccessURI, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: grantAccessData, + Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "disk.DisksClient", "GrantAccess") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AccessURI + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GrantAccessPreparer(resourceGroupName, diskName, grantAccessData, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", nil, "Failure preparing request") + return + } + + resp, err := client.GrantAccessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", resp, "Failure sending request") + return + } + + result, err = client.GrantAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GrantAccessPreparer prepares the GrantAccess request. +func (client DisksClient) GrantAccessPreparer(resourceGroupName string, diskName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters), + autorest.WithJSON(grantAccessData), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GrantAccessSender sends the GrantAccess request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) GrantAccessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GrantAccessResponder handles the response to the GrantAccess request. The method always +// closes the http.Response Body. +func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the disks under a subscription. +func (client DisksClient) List() (result ListType, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DisksClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DisksClient) ListResponder(resp *http.Response) (result ListType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DisksClient) ListNextResults(lastResults ListType) (result ListType, err error) { + req, err := lastResults.ListTypePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "disk.DisksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists all the disks under a resource group. +// +// resourceGroupName is the name of the resource group. +func (client DisksClient) ListByResourceGroup(resourceGroupName string) (result ListType, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DisksClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result ListType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client DisksClient) ListByResourceGroupNextResults(lastResults ListType) (result ListType, err error) { + req, err := lastResults.ListTypePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// RevokeAccess revokes access to a disk. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. diskName is the name of +// the disk within the given subscription and resource group. +func (client DisksClient) RevokeAccess(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RevokeAccessPreparer(resourceGroupName, diskName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", nil, "Failure preparing request") + return + } + + resp, err := client.RevokeAccessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", resp, "Failure sending request") + return + } + + result, err = client.RevokeAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RevokeAccessPreparer prepares the RevokeAccess request. +func (client DisksClient) RevokeAccessPreparer(resourceGroupName string, diskName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RevokeAccessSender sends the RevokeAccess request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) RevokeAccessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RevokeAccessResponder handles the response to the RevokeAccess request. The method always +// closes the http.Response Body. +func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates (patches) a disk. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. diskName is the name of +// the disk within the given subscription and resource group. diskParameter is +// disk object supplied in the body of the Patch disk operation. +func (client DisksClient) Update(resourceGroupName string, diskName string, diskParameter UpdateType, cancel <-chan struct{}) (<-chan Model, <-chan error) { + resultChan := make(chan Model, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Model + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, diskName, diskParameter, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client DisksClient) UpdatePreparer(resourceGroupName string, diskName string, diskParameter UpdateType, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diskName": autorest.Encode("path", diskName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters), + autorest.WithJSON(diskParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DisksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DisksClient) UpdateResponder(resp *http.Response) (result Model, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/models.go index b630b3a121..e8118696ad 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/models.go @@ -1,278 +1,278 @@ -package disk - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccessLevel enumerates the values for access level. -type AccessLevel string - -const ( - // None specifies the none state for access level. - None AccessLevel = "None" - // Read specifies the read state for access level. - Read AccessLevel = "Read" -) - -// CreateOption enumerates the values for create option. -type CreateOption string - -const ( - // Attach specifies the attach state for create option. - Attach CreateOption = "Attach" - // Copy specifies the copy state for create option. - Copy CreateOption = "Copy" - // Empty specifies the empty state for create option. - Empty CreateOption = "Empty" - // FromImage specifies the from image state for create option. - FromImage CreateOption = "FromImage" - // Import specifies the import state for create option. - Import CreateOption = "Import" - // Restore specifies the restore state for create option. - Restore CreateOption = "Restore" -) - -// OperatingSystemTypes enumerates the values for operating system types. -type OperatingSystemTypes string - -const ( - // Linux specifies the linux state for operating system types. - Linux OperatingSystemTypes = "Linux" - // Windows specifies the windows state for operating system types. - Windows OperatingSystemTypes = "Windows" -) - -// StorageAccountTypes enumerates the values for storage account types. -type StorageAccountTypes string - -const ( - // PremiumLRS specifies the premium lrs state for storage account types. - PremiumLRS StorageAccountTypes = "Premium_LRS" - // StandardLRS specifies the standard lrs state for storage account types. - StandardLRS StorageAccountTypes = "Standard_LRS" -) - -// AccessURI is a disk access SAS uri. -type AccessURI struct { - autorest.Response `json:"-"` - *AccessURIOutput `json:"properties,omitempty"` -} - -// AccessURIOutput is azure properties, including output. -type AccessURIOutput struct { - *AccessURIRaw `json:"output,omitempty"` -} - -// AccessURIRaw is this object gets 'bubbled up' through flattening. -type AccessURIRaw struct { - AccessSAS *string `json:"accessSAS,omitempty"` -} - -// APIError is api error. -type APIError struct { - Details *[]APIErrorBase `json:"details,omitempty"` - Innererror *InnerError `json:"innererror,omitempty"` - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` -} - -// APIErrorBase is api error base. -type APIErrorBase struct { - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CreationData is data used when creating a disk. -type CreationData struct { - CreateOption CreateOption `json:"createOption,omitempty"` - StorageAccountID *string `json:"storageAccountId,omitempty"` - ImageReference *ImageDiskReference `json:"imageReference,omitempty"` - SourceURI *string `json:"sourceUri,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` -} - -// EncryptionSettings is encryption settings for disk or snapshot -type EncryptionSettings struct { - Enabled *bool `json:"enabled,omitempty"` - DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"` - KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"` -} - -// GrantAccessData is data used for requesting a SAS. -type GrantAccessData struct { - Access AccessLevel `json:"access,omitempty"` - DurationInSeconds *int32 `json:"durationInSeconds,omitempty"` -} - -// ImageDiskReference is the source image used for creating the disk. -type ImageDiskReference struct { - ID *string `json:"id,omitempty"` - Lun *int32 `json:"lun,omitempty"` -} - -// InnerError is inner error details. -type InnerError struct { - Exceptiontype *string `json:"exceptiontype,omitempty"` - Errordetail *string `json:"errordetail,omitempty"` -} - -// KeyVaultAndKeyReference is key Vault Key Url and vault id of KeK, KeK is -// optional and when provided is used to unwrap the encryptionKey -type KeyVaultAndKeyReference struct { - SourceVault *SourceVault `json:"sourceVault,omitempty"` - KeyURL *string `json:"keyUrl,omitempty"` -} - -// KeyVaultAndSecretReference is key Vault Secret Url and vault id of the -// encryption key -type KeyVaultAndSecretReference struct { - SourceVault *SourceVault `json:"sourceVault,omitempty"` - SecretURL *string `json:"secretUrl,omitempty"` -} - -// ListType is the List Disks operation response. -type ListType struct { - autorest.Response `json:"-"` - Value *[]Model `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListTypePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListType) ListTypePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Model is disk resource. -type Model struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// OperationStatusResponse is operation status response -type OperationStatusResponse struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Status *string `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Error *APIError `json:"error,omitempty"` -} - -// Properties is disk resource properties. -type Properties struct { - AccountType StorageAccountTypes `json:"accountType,omitempty"` - TimeCreated *date.Time `json:"timeCreated,omitempty"` - OsType OperatingSystemTypes `json:"osType,omitempty"` - CreationData *CreationData `json:"creationData,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"` - OwnerID *string `json:"ownerId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceUpdate is the Resource model definition. -type ResourceUpdate struct { - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Snapshot is snapshot resource. -type Snapshot struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// SnapshotList is the List Snapshots operation response. -type SnapshotList struct { - autorest.Response `json:"-"` - Value *[]Snapshot `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SnapshotListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SnapshotList) SnapshotListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SnapshotUpdate is snapshot update resource. -type SnapshotUpdate struct { - Tags *map[string]*string `json:"tags,omitempty"` - *UpdateProperties `json:"properties,omitempty"` -} - -// SourceVault is the vault id is an Azure Resource Manager Resoure id in the -// form -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} -type SourceVault struct { - ID *string `json:"id,omitempty"` -} - -// UpdateProperties is disk resource update properties. -type UpdateProperties struct { - AccountType StorageAccountTypes `json:"accountType,omitempty"` - OsType OperatingSystemTypes `json:"osType,omitempty"` - CreationData *CreationData `json:"creationData,omitempty"` - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"` -} - -// UpdateType is disk update resource. -type UpdateType struct { - Tags *map[string]*string `json:"tags,omitempty"` - *UpdateProperties `json:"properties,omitempty"` -} +package disk + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessLevel enumerates the values for access level. +type AccessLevel string + +const ( + // None specifies the none state for access level. + None AccessLevel = "None" + // Read specifies the read state for access level. + Read AccessLevel = "Read" +) + +// CreateOption enumerates the values for create option. +type CreateOption string + +const ( + // Attach specifies the attach state for create option. + Attach CreateOption = "Attach" + // Copy specifies the copy state for create option. + Copy CreateOption = "Copy" + // Empty specifies the empty state for create option. + Empty CreateOption = "Empty" + // FromImage specifies the from image state for create option. + FromImage CreateOption = "FromImage" + // Import specifies the import state for create option. + Import CreateOption = "Import" + // Restore specifies the restore state for create option. + Restore CreateOption = "Restore" +) + +// OperatingSystemTypes enumerates the values for operating system types. +type OperatingSystemTypes string + +const ( + // Linux specifies the linux state for operating system types. + Linux OperatingSystemTypes = "Linux" + // Windows specifies the windows state for operating system types. + Windows OperatingSystemTypes = "Windows" +) + +// StorageAccountTypes enumerates the values for storage account types. +type StorageAccountTypes string + +const ( + // PremiumLRS specifies the premium lrs state for storage account types. + PremiumLRS StorageAccountTypes = "Premium_LRS" + // StandardLRS specifies the standard lrs state for storage account types. + StandardLRS StorageAccountTypes = "Standard_LRS" +) + +// AccessURI is a disk access SAS uri. +type AccessURI struct { + autorest.Response `json:"-"` + *AccessURIOutput `json:"properties,omitempty"` +} + +// AccessURIOutput is azure properties, including output. +type AccessURIOutput struct { + *AccessURIRaw `json:"output,omitempty"` +} + +// AccessURIRaw is this object gets 'bubbled up' through flattening. +type AccessURIRaw struct { + AccessSAS *string `json:"accessSAS,omitempty"` +} + +// APIError is api error. +type APIError struct { + Details *[]APIErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// APIErrorBase is api error base. +type APIErrorBase struct { + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CreationData is data used when creating a disk. +type CreationData struct { + CreateOption CreateOption `json:"createOption,omitempty"` + StorageAccountID *string `json:"storageAccountId,omitempty"` + ImageReference *ImageDiskReference `json:"imageReference,omitempty"` + SourceURI *string `json:"sourceUri,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// EncryptionSettings is encryption settings for disk or snapshot +type EncryptionSettings struct { + Enabled *bool `json:"enabled,omitempty"` + DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"` + KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"` +} + +// GrantAccessData is data used for requesting a SAS. +type GrantAccessData struct { + Access AccessLevel `json:"access,omitempty"` + DurationInSeconds *int32 `json:"durationInSeconds,omitempty"` +} + +// ImageDiskReference is the source image used for creating the disk. +type ImageDiskReference struct { + ID *string `json:"id,omitempty"` + Lun *int32 `json:"lun,omitempty"` +} + +// InnerError is inner error details. +type InnerError struct { + Exceptiontype *string `json:"exceptiontype,omitempty"` + Errordetail *string `json:"errordetail,omitempty"` +} + +// KeyVaultAndKeyReference is key Vault Key Url and vault id of KeK, KeK is +// optional and when provided is used to unwrap the encryptionKey +type KeyVaultAndKeyReference struct { + SourceVault *SourceVault `json:"sourceVault,omitempty"` + KeyURL *string `json:"keyUrl,omitempty"` +} + +// KeyVaultAndSecretReference is key Vault Secret Url and vault id of the +// encryption key +type KeyVaultAndSecretReference struct { + SourceVault *SourceVault `json:"sourceVault,omitempty"` + SecretURL *string `json:"secretUrl,omitempty"` +} + +// ListType is the List Disks operation response. +type ListType struct { + autorest.Response `json:"-"` + Value *[]Model `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListTypePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListType) ListTypePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Model is disk resource. +type Model struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// OperationStatusResponse is operation status response +type OperationStatusResponse struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Error *APIError `json:"error,omitempty"` +} + +// Properties is disk resource properties. +type Properties struct { + AccountType StorageAccountTypes `json:"accountType,omitempty"` + TimeCreated *date.Time `json:"timeCreated,omitempty"` + OsType OperatingSystemTypes `json:"osType,omitempty"` + CreationData *CreationData `json:"creationData,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"` + OwnerID *string `json:"ownerId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceUpdate is the Resource model definition. +type ResourceUpdate struct { + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Snapshot is snapshot resource. +type Snapshot struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// SnapshotList is the List Snapshots operation response. +type SnapshotList struct { + autorest.Response `json:"-"` + Value *[]Snapshot `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SnapshotListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SnapshotList) SnapshotListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SnapshotUpdate is snapshot update resource. +type SnapshotUpdate struct { + Tags *map[string]*string `json:"tags,omitempty"` + *UpdateProperties `json:"properties,omitempty"` +} + +// SourceVault is the vault id is an Azure Resource Manager Resoure id in the +// form +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} +type SourceVault struct { + ID *string `json:"id,omitempty"` +} + +// UpdateProperties is disk resource update properties. +type UpdateProperties struct { + AccountType StorageAccountTypes `json:"accountType,omitempty"` + OsType OperatingSystemTypes `json:"osType,omitempty"` + CreationData *CreationData `json:"creationData,omitempty"` + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"` +} + +// UpdateType is disk update resource. +type UpdateType struct { + Tags *map[string]*string `json:"tags,omitempty"` + *UpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/snapshots.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/snapshots.go index f43035cde3..f4e5579d04 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/snapshots.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/snapshots.go @@ -1,733 +1,733 @@ -package disk - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SnapshotsClient is the the Disk Resource Provider Client. -type SnapshotsClient struct { - ManagementClient -} - -// NewSnapshotsClient creates an instance of the SnapshotsClient client. -func NewSnapshotsClient(subscriptionID string) SnapshotsClient { - return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient -// client. -func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { - return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a snapshot. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. snapshotName is the -// name of the snapshot within the given subscription and resource group. -// snapshot is snapshot object supplied in the body of the Put disk operation. -func (client SnapshotsClient) CreateOrUpdate(resourceGroupName string, snapshotName string, snapshot Snapshot, cancel <-chan struct{}) (<-chan Snapshot, <-chan error) { - resultChan := make(chan Snapshot, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: snapshot, - Constraints: []validation.Constraint{{Target: "snapshot.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData.ImageReference", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "snapshot.Properties.EncryptionSettings", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "disk.SnapshotsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Snapshot - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, snapshotName, snapshot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SnapshotsClient) CreateOrUpdatePreparer(resourceGroupName string, snapshotName string, snapshot Snapshot, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), - autorest.WithJSON(snapshot), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a snapshot. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. snapshotName is the -// name of the snapshot within the given subscription and resource group. -func (client SnapshotsClient) Delete(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, snapshotName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client SnapshotsClient) DeletePreparer(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about a snapshot. -// -// resourceGroupName is the name of the resource group. snapshotName is the -// name of the snapshot within the given subscription and resource group. -func (client SnapshotsClient) Get(resourceGroupName string, snapshotName string) (result Snapshot, err error) { - req, err := client.GetPreparer(resourceGroupName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SnapshotsClient) GetPreparer(resourceGroupName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GrantAccess grants access to a snapshot. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. snapshotName is the -// name of the snapshot within the given subscription and resource group. -// grantAccessData is access data object supplied in the body of the get -// snapshot access operation. -func (client SnapshotsClient) GrantAccess(resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (<-chan AccessURI, <-chan error) { - resultChan := make(chan AccessURI, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: grantAccessData, - Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "disk.SnapshotsClient", "GrantAccess") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result AccessURI - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GrantAccessPreparer(resourceGroupName, snapshotName, grantAccessData, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", nil, "Failure preparing request") - return - } - - resp, err := client.GrantAccessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", resp, "Failure sending request") - return - } - - result, err = client.GrantAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GrantAccessPreparer prepares the GrantAccess request. -func (client SnapshotsClient) GrantAccessPreparer(resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters), - autorest.WithJSON(grantAccessData), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GrantAccessSender sends the GrantAccess request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) GrantAccessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GrantAccessResponder handles the response to the GrantAccess request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists snapshots under a subscription. -func (client SnapshotsClient) List() (result SnapshotList, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SnapshotsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SnapshotsClient) ListNextResults(lastResults SnapshotList) (result SnapshotList, err error) { - req, err := lastResults.SnapshotListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists snapshots under a resource group. -// -// resourceGroupName is the name of the resource group. -func (client SnapshotsClient) ListByResourceGroup(resourceGroupName string) (result SnapshotList, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client SnapshotsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client SnapshotsClient) ListByResourceGroupNextResults(lastResults SnapshotList) (result SnapshotList, err error) { - req, err := lastResults.SnapshotListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// RevokeAccess revokes access to a snapshot. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. snapshotName is the -// name of the snapshot within the given subscription and resource group. -func (client SnapshotsClient) RevokeAccess(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { - resultChan := make(chan OperationStatusResponse, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result OperationStatusResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RevokeAccessPreparer(resourceGroupName, snapshotName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request") - return - } - - resp, err := client.RevokeAccessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", resp, "Failure sending request") - return - } - - result, err = client.RevokeAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RevokeAccessPreparer prepares the RevokeAccess request. -func (client SnapshotsClient) RevokeAccessPreparer(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RevokeAccessSender sends the RevokeAccess request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RevokeAccessResponder handles the response to the RevokeAccess request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates (patches) a snapshot. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. snapshotName is the -// name of the snapshot within the given subscription and resource group. -// snapshot is snapshot object supplied in the body of the Patch snapshot -// operation. -func (client SnapshotsClient) Update(resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, cancel <-chan struct{}) (<-chan Snapshot, <-chan error) { - resultChan := make(chan Snapshot, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Snapshot - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, snapshotName, snapshot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client SnapshotsClient) UpdatePreparer(resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-30-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), - autorest.WithJSON(snapshot), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package disk + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SnapshotsClient is the the Disk Resource Provider Client. +type SnapshotsClient struct { + ManagementClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient +// client. +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a snapshot. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. snapshotName is the +// name of the snapshot within the given subscription and resource group. +// snapshot is snapshot object supplied in the body of the Put disk operation. +func (client SnapshotsClient) CreateOrUpdate(resourceGroupName string, snapshotName string, snapshot Snapshot, cancel <-chan struct{}) (<-chan Snapshot, <-chan error) { + resultChan := make(chan Snapshot, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: snapshot, + Constraints: []validation.Constraint{{Target: "snapshot.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData.ImageReference", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "snapshot.Properties.EncryptionSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "disk.SnapshotsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Snapshot + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, snapshotName, snapshot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SnapshotsClient) CreateOrUpdatePreparer(resourceGroupName string, snapshotName string, snapshot Snapshot, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(snapshot), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a snapshot. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. snapshotName is the +// name of the snapshot within the given subscription and resource group. +func (client SnapshotsClient) Delete(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, snapshotName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets information about a snapshot. +// +// resourceGroupName is the name of the resource group. snapshotName is the +// name of the snapshot within the given subscription and resource group. +func (client SnapshotsClient) Get(resourceGroupName string, snapshotName string) (result Snapshot, err error) { + req, err := client.GetPreparer(resourceGroupName, snapshotName) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(resourceGroupName string, snapshotName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GrantAccess grants access to a snapshot. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. snapshotName is the +// name of the snapshot within the given subscription and resource group. +// grantAccessData is access data object supplied in the body of the get +// snapshot access operation. +func (client SnapshotsClient) GrantAccess(resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (<-chan AccessURI, <-chan error) { + resultChan := make(chan AccessURI, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: grantAccessData, + Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "disk.SnapshotsClient", "GrantAccess") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AccessURI + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GrantAccessPreparer(resourceGroupName, snapshotName, grantAccessData, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", nil, "Failure preparing request") + return + } + + resp, err := client.GrantAccessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", resp, "Failure sending request") + return + } + + result, err = client.GrantAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GrantAccessPreparer prepares the GrantAccess request. +func (client SnapshotsClient) GrantAccessPreparer(resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters), + autorest.WithJSON(grantAccessData), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GrantAccessSender sends the GrantAccess request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GrantAccessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GrantAccessResponder handles the response to the GrantAccess request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists snapshots under a subscription. +func (client SnapshotsClient) List() (result SnapshotList, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) ListNextResults(lastResults SnapshotList) (result SnapshotList, err error) { + req, err := lastResults.SnapshotListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists snapshots under a resource group. +// +// resourceGroupName is the name of the resource group. +func (client SnapshotsClient) ListByResourceGroup(resourceGroupName string) (result SnapshotList, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SnapshotsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) ListByResourceGroupNextResults(lastResults SnapshotList) (result SnapshotList, err error) { + req, err := lastResults.SnapshotListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// RevokeAccess revokes access to a snapshot. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. snapshotName is the +// name of the snapshot within the given subscription and resource group. +func (client SnapshotsClient) RevokeAccess(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) { + resultChan := make(chan OperationStatusResponse, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result OperationStatusResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RevokeAccessPreparer(resourceGroupName, snapshotName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request") + return + } + + resp, err := client.RevokeAccessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", resp, "Failure sending request") + return + } + + result, err = client.RevokeAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RevokeAccessPreparer prepares the RevokeAccess request. +func (client SnapshotsClient) RevokeAccessPreparer(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RevokeAccessSender sends the RevokeAccess request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RevokeAccessResponder handles the response to the RevokeAccess request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates (patches) a snapshot. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. snapshotName is the +// name of the snapshot within the given subscription and resource group. +// snapshot is snapshot object supplied in the body of the Patch snapshot +// operation. +func (client SnapshotsClient) Update(resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, cancel <-chan struct{}) (<-chan Snapshot, <-chan error) { + resultChan := make(chan Snapshot, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Snapshot + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, snapshotName, snapshot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client SnapshotsClient) UpdatePreparer(resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotName": autorest.Encode("path", snapshotName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters), + autorest.WithJSON(snapshot), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/version.go index e8be150b55..a78b351a0e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/disk/version.go @@ -1,29 +1,29 @@ -package disk - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-disk/2016-04-30-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package disk + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-disk/2016-04-30-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go index fba7dab515..05ef369957 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go @@ -1,52 +1,52 @@ -// Package dns implements the Azure ARM Dns service API version 2016-04-01. -// -// The DNS Management Client. -package dns - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Dns - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Dns. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package dns implements the Azure ARM Dns service API version 2016-04-01. +// +// The DNS Management Client. +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Dns + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Dns. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go index b6294ec7dc..a95db4a295 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go @@ -1,360 +1,360 @@ -package dns - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted specifies the accepted state for http status code. - Accepted HTTPStatusCode = "Accepted" - // Ambiguous specifies the ambiguous state for http status code. - Ambiguous HTTPStatusCode = "Ambiguous" - // BadGateway specifies the bad gateway state for http status code. - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest specifies the bad request state for http status code. - BadRequest HTTPStatusCode = "BadRequest" - // Conflict specifies the conflict state for http status code. - Conflict HTTPStatusCode = "Conflict" - // Continue specifies the continue state for http status code. - Continue HTTPStatusCode = "Continue" - // Created specifies the created state for http status code. - Created HTTPStatusCode = "Created" - // ExpectationFailed specifies the expectation failed state for http status - // code. - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden specifies the forbidden state for http status code. - Forbidden HTTPStatusCode = "Forbidden" - // Found specifies the found state for http status code. - Found HTTPStatusCode = "Found" - // GatewayTimeout specifies the gateway timeout state for http status code. - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone specifies the gone state for http status code. - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported specifies the http version not supported state - // for http status code. - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError specifies the internal server error state for http - // status code. - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired specifies the length required state for http status code. - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed specifies the method not allowed state for http status - // code. - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // Moved specifies the moved state for http status code. - Moved HTTPStatusCode = "Moved" - // MovedPermanently specifies the moved permanently state for http status - // code. - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices specifies the multiple choices state for http status - // code. - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent specifies the no content state for http status code. - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation specifies the non authoritative information - // state for http status code. - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable specifies the not acceptable state for http status code. - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound specifies the not found state for http status code. - NotFound HTTPStatusCode = "NotFound" - // NotImplemented specifies the not implemented state for http status code. - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified specifies the not modified state for http status code. - NotModified HTTPStatusCode = "NotModified" - // OK specifies the ok state for http status code. - OK HTTPStatusCode = "OK" - // PartialContent specifies the partial content state for http status code. - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired specifies the payment required state for http status - // code. - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed specifies the precondition failed state for http - // status code. - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired specifies the proxy authentication required - // state for http status code. - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect specifies the redirect state for http status code. - Redirect HTTPStatusCode = "Redirect" - // RedirectKeepVerb specifies the redirect keep verb state for http status - // code. - RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - // RedirectMethod specifies the redirect method state for http status code. - RedirectMethod HTTPStatusCode = "RedirectMethod" - // RequestedRangeNotSatisfiable specifies the requested range not - // satisfiable state for http status code. - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge specifies the request entity too large state for - // http status code. - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout specifies the request timeout state for http status code. - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong specifies the request uri too long state for http - // status code. - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent specifies the reset content state for http status code. - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther specifies the see other state for http status code. - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable specifies the service unavailable state for http - // status code. - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols specifies the switching protocols state for http - // status code. - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect specifies the temporary redirect state for http status - // code. - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized specifies the unauthorized state for http status code. - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType specifies the unsupported media type state for http - // status code. - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused specifies the unused state for http status code. - Unused HTTPStatusCode = "Unused" - // UpgradeRequired specifies the upgrade required state for http status - // code. - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy specifies the use proxy state for http status code. - UseProxy HTTPStatusCode = "UseProxy" -) - -// OperationStatus enumerates the values for operation status. -type OperationStatus string - -const ( - // Failed specifies the failed state for operation status. - Failed OperationStatus = "Failed" - // InProgress specifies the in progress state for operation status. - InProgress OperationStatus = "InProgress" - // Succeeded specifies the succeeded state for operation status. - Succeeded OperationStatus = "Succeeded" -) - -// RecordType enumerates the values for record type. -type RecordType string - -const ( - // A specifies the a state for record type. - A RecordType = "A" - // AAAA specifies the aaaa state for record type. - AAAA RecordType = "AAAA" - // CNAME specifies the cname state for record type. - CNAME RecordType = "CNAME" - // MX specifies the mx state for record type. - MX RecordType = "MX" - // NS specifies the ns state for record type. - NS RecordType = "NS" - // PTR specifies the ptr state for record type. - PTR RecordType = "PTR" - // SOA specifies the soa state for record type. - SOA RecordType = "SOA" - // SRV specifies the srv state for record type. - SRV RecordType = "SRV" - // TXT specifies the txt state for record type. - TXT RecordType = "TXT" -) - -// AaaaRecord is an AAAA record. -type AaaaRecord struct { - Ipv6Address *string `json:"ipv6Address,omitempty"` -} - -// ARecord is an A record. -type ARecord struct { - Ipv4Address *string `json:"ipv4Address,omitempty"` -} - -// CloudError is -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody is -type CloudErrorBody struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// CnameRecord is a CNAME record. -type CnameRecord struct { - Cname *string `json:"cname,omitempty"` -} - -// MxRecord is an MX record. -type MxRecord struct { - Preference *int32 `json:"preference,omitempty"` - Exchange *string `json:"exchange,omitempty"` -} - -// NsRecord is an NS record. -type NsRecord struct { - Nsdname *string `json:"nsdname,omitempty"` -} - -// PtrRecord is a PTR record. -type PtrRecord struct { - Ptrdname *string `json:"ptrdname,omitempty"` -} - -// RecordSet is describes a DNS record set (a collection of DNS records with -// the same name and type). -type RecordSet struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Etag *string `json:"etag,omitempty"` - *RecordSetProperties `json:"properties,omitempty"` -} - -// RecordSetListResult is the response to a record set List operation. -type RecordSetListResult struct { - autorest.Response `json:"-"` - Value *[]RecordSet `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RecordSetListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RecordSetListResult) RecordSetListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RecordSetProperties is represents the properties of the records in the -// record set. -type RecordSetProperties struct { - Metadata *map[string]*string `json:"metadata,omitempty"` - TTL *int64 `json:"TTL,omitempty"` - ARecords *[]ARecord `json:"ARecords,omitempty"` - AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"` - MxRecords *[]MxRecord `json:"MXRecords,omitempty"` - NsRecords *[]NsRecord `json:"NSRecords,omitempty"` - PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"` - SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"` - TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"` - CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"` - SoaRecord *SoaRecord `json:"SOARecord,omitempty"` -} - -// RecordSetUpdateParameters is parameters supplied to update a record set. -type RecordSetUpdateParameters struct { - RecordSet *RecordSet `json:"RecordSet,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SoaRecord is an SOA record. -type SoaRecord struct { - Host *string `json:"host,omitempty"` - Email *string `json:"email,omitempty"` - SerialNumber *int64 `json:"serialNumber,omitempty"` - RefreshTime *int64 `json:"refreshTime,omitempty"` - RetryTime *int64 `json:"retryTime,omitempty"` - ExpireTime *int64 `json:"expireTime,omitempty"` - MinimumTTL *int64 `json:"minimumTTL,omitempty"` -} - -// SrvRecord is an SRV record. -type SrvRecord struct { - Priority *int32 `json:"priority,omitempty"` - Weight *int32 `json:"weight,omitempty"` - Port *int32 `json:"port,omitempty"` - Target *string `json:"target,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// TxtRecord is a TXT record. -type TxtRecord struct { - Value *[]string `json:"value,omitempty"` -} - -// Zone is describes a DNS zone. -type Zone struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *ZoneProperties `json:"properties,omitempty"` -} - -// ZoneDeleteResult is the response to a Zone Delete operation. -type ZoneDeleteResult struct { - autorest.Response `json:"-"` - AzureAsyncOperation *string `json:"azureAsyncOperation,omitempty"` - Status OperationStatus `json:"status,omitempty"` - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - RequestID *string `json:"requestId,omitempty"` -} - -// ZoneListResult is the response to a Zone List or ListAll operation. -type ZoneListResult struct { - autorest.Response `json:"-"` - Value *[]Zone `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ZoneListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ZoneListResult) ZoneListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ZoneProperties is represents the properties of the zone. -type ZoneProperties struct { - MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` - NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` - NameServers *[]string `json:"nameServers,omitempty"` -} +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// HTTPStatusCode enumerates the values for http status code. +type HTTPStatusCode string + +const ( + // Accepted specifies the accepted state for http status code. + Accepted HTTPStatusCode = "Accepted" + // Ambiguous specifies the ambiguous state for http status code. + Ambiguous HTTPStatusCode = "Ambiguous" + // BadGateway specifies the bad gateway state for http status code. + BadGateway HTTPStatusCode = "BadGateway" + // BadRequest specifies the bad request state for http status code. + BadRequest HTTPStatusCode = "BadRequest" + // Conflict specifies the conflict state for http status code. + Conflict HTTPStatusCode = "Conflict" + // Continue specifies the continue state for http status code. + Continue HTTPStatusCode = "Continue" + // Created specifies the created state for http status code. + Created HTTPStatusCode = "Created" + // ExpectationFailed specifies the expectation failed state for http status + // code. + ExpectationFailed HTTPStatusCode = "ExpectationFailed" + // Forbidden specifies the forbidden state for http status code. + Forbidden HTTPStatusCode = "Forbidden" + // Found specifies the found state for http status code. + Found HTTPStatusCode = "Found" + // GatewayTimeout specifies the gateway timeout state for http status code. + GatewayTimeout HTTPStatusCode = "GatewayTimeout" + // Gone specifies the gone state for http status code. + Gone HTTPStatusCode = "Gone" + // HTTPVersionNotSupported specifies the http version not supported state + // for http status code. + HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" + // InternalServerError specifies the internal server error state for http + // status code. + InternalServerError HTTPStatusCode = "InternalServerError" + // LengthRequired specifies the length required state for http status code. + LengthRequired HTTPStatusCode = "LengthRequired" + // MethodNotAllowed specifies the method not allowed state for http status + // code. + MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" + // Moved specifies the moved state for http status code. + Moved HTTPStatusCode = "Moved" + // MovedPermanently specifies the moved permanently state for http status + // code. + MovedPermanently HTTPStatusCode = "MovedPermanently" + // MultipleChoices specifies the multiple choices state for http status + // code. + MultipleChoices HTTPStatusCode = "MultipleChoices" + // NoContent specifies the no content state for http status code. + NoContent HTTPStatusCode = "NoContent" + // NonAuthoritativeInformation specifies the non authoritative information + // state for http status code. + NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" + // NotAcceptable specifies the not acceptable state for http status code. + NotAcceptable HTTPStatusCode = "NotAcceptable" + // NotFound specifies the not found state for http status code. + NotFound HTTPStatusCode = "NotFound" + // NotImplemented specifies the not implemented state for http status code. + NotImplemented HTTPStatusCode = "NotImplemented" + // NotModified specifies the not modified state for http status code. + NotModified HTTPStatusCode = "NotModified" + // OK specifies the ok state for http status code. + OK HTTPStatusCode = "OK" + // PartialContent specifies the partial content state for http status code. + PartialContent HTTPStatusCode = "PartialContent" + // PaymentRequired specifies the payment required state for http status + // code. + PaymentRequired HTTPStatusCode = "PaymentRequired" + // PreconditionFailed specifies the precondition failed state for http + // status code. + PreconditionFailed HTTPStatusCode = "PreconditionFailed" + // ProxyAuthenticationRequired specifies the proxy authentication required + // state for http status code. + ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" + // Redirect specifies the redirect state for http status code. + Redirect HTTPStatusCode = "Redirect" + // RedirectKeepVerb specifies the redirect keep verb state for http status + // code. + RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" + // RedirectMethod specifies the redirect method state for http status code. + RedirectMethod HTTPStatusCode = "RedirectMethod" + // RequestedRangeNotSatisfiable specifies the requested range not + // satisfiable state for http status code. + RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" + // RequestEntityTooLarge specifies the request entity too large state for + // http status code. + RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" + // RequestTimeout specifies the request timeout state for http status code. + RequestTimeout HTTPStatusCode = "RequestTimeout" + // RequestURITooLong specifies the request uri too long state for http + // status code. + RequestURITooLong HTTPStatusCode = "RequestUriTooLong" + // ResetContent specifies the reset content state for http status code. + ResetContent HTTPStatusCode = "ResetContent" + // SeeOther specifies the see other state for http status code. + SeeOther HTTPStatusCode = "SeeOther" + // ServiceUnavailable specifies the service unavailable state for http + // status code. + ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" + // SwitchingProtocols specifies the switching protocols state for http + // status code. + SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" + // TemporaryRedirect specifies the temporary redirect state for http status + // code. + TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" + // Unauthorized specifies the unauthorized state for http status code. + Unauthorized HTTPStatusCode = "Unauthorized" + // UnsupportedMediaType specifies the unsupported media type state for http + // status code. + UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" + // Unused specifies the unused state for http status code. + Unused HTTPStatusCode = "Unused" + // UpgradeRequired specifies the upgrade required state for http status + // code. + UpgradeRequired HTTPStatusCode = "UpgradeRequired" + // UseProxy specifies the use proxy state for http status code. + UseProxy HTTPStatusCode = "UseProxy" +) + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // Failed specifies the failed state for operation status. + Failed OperationStatus = "Failed" + // InProgress specifies the in progress state for operation status. + InProgress OperationStatus = "InProgress" + // Succeeded specifies the succeeded state for operation status. + Succeeded OperationStatus = "Succeeded" +) + +// RecordType enumerates the values for record type. +type RecordType string + +const ( + // A specifies the a state for record type. + A RecordType = "A" + // AAAA specifies the aaaa state for record type. + AAAA RecordType = "AAAA" + // CNAME specifies the cname state for record type. + CNAME RecordType = "CNAME" + // MX specifies the mx state for record type. + MX RecordType = "MX" + // NS specifies the ns state for record type. + NS RecordType = "NS" + // PTR specifies the ptr state for record type. + PTR RecordType = "PTR" + // SOA specifies the soa state for record type. + SOA RecordType = "SOA" + // SRV specifies the srv state for record type. + SRV RecordType = "SRV" + // TXT specifies the txt state for record type. + TXT RecordType = "TXT" +) + +// AaaaRecord is an AAAA record. +type AaaaRecord struct { + Ipv6Address *string `json:"ipv6Address,omitempty"` +} + +// ARecord is an A record. +type ARecord struct { + Ipv4Address *string `json:"ipv4Address,omitempty"` +} + +// CloudError is +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody is +type CloudErrorBody struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CnameRecord is a CNAME record. +type CnameRecord struct { + Cname *string `json:"cname,omitempty"` +} + +// MxRecord is an MX record. +type MxRecord struct { + Preference *int32 `json:"preference,omitempty"` + Exchange *string `json:"exchange,omitempty"` +} + +// NsRecord is an NS record. +type NsRecord struct { + Nsdname *string `json:"nsdname,omitempty"` +} + +// PtrRecord is a PTR record. +type PtrRecord struct { + Ptrdname *string `json:"ptrdname,omitempty"` +} + +// RecordSet is describes a DNS record set (a collection of DNS records with +// the same name and type). +type RecordSet struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Etag *string `json:"etag,omitempty"` + *RecordSetProperties `json:"properties,omitempty"` +} + +// RecordSetListResult is the response to a record set List operation. +type RecordSetListResult struct { + autorest.Response `json:"-"` + Value *[]RecordSet `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RecordSetListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RecordSetListResult) RecordSetListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecordSetProperties is represents the properties of the records in the +// record set. +type RecordSetProperties struct { + Metadata *map[string]*string `json:"metadata,omitempty"` + TTL *int64 `json:"TTL,omitempty"` + ARecords *[]ARecord `json:"ARecords,omitempty"` + AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"` + MxRecords *[]MxRecord `json:"MXRecords,omitempty"` + NsRecords *[]NsRecord `json:"NSRecords,omitempty"` + PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"` + SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"` + TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"` + CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"` + SoaRecord *SoaRecord `json:"SOARecord,omitempty"` +} + +// RecordSetUpdateParameters is parameters supplied to update a record set. +type RecordSetUpdateParameters struct { + RecordSet *RecordSet `json:"RecordSet,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SoaRecord is an SOA record. +type SoaRecord struct { + Host *string `json:"host,omitempty"` + Email *string `json:"email,omitempty"` + SerialNumber *int64 `json:"serialNumber,omitempty"` + RefreshTime *int64 `json:"refreshTime,omitempty"` + RetryTime *int64 `json:"retryTime,omitempty"` + ExpireTime *int64 `json:"expireTime,omitempty"` + MinimumTTL *int64 `json:"minimumTTL,omitempty"` +} + +// SrvRecord is an SRV record. +type SrvRecord struct { + Priority *int32 `json:"priority,omitempty"` + Weight *int32 `json:"weight,omitempty"` + Port *int32 `json:"port,omitempty"` + Target *string `json:"target,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// TxtRecord is a TXT record. +type TxtRecord struct { + Value *[]string `json:"value,omitempty"` +} + +// Zone is describes a DNS zone. +type Zone struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *ZoneProperties `json:"properties,omitempty"` +} + +// ZoneDeleteResult is the response to a Zone Delete operation. +type ZoneDeleteResult struct { + autorest.Response `json:"-"` + AzureAsyncOperation *string `json:"azureAsyncOperation,omitempty"` + Status OperationStatus `json:"status,omitempty"` + StatusCode HTTPStatusCode `json:"statusCode,omitempty"` + RequestID *string `json:"requestId,omitempty"` +} + +// ZoneListResult is the response to a Zone List or ListAll operation. +type ZoneListResult struct { + autorest.Response `json:"-"` + Value *[]Zone `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ZoneListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ZoneListResult) ZoneListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ZoneProperties is represents the properties of the zone. +type ZoneProperties struct { + MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` + NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` + NameServers *[]string `json:"nameServers,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go index 70ed29b757..8d3992dd66 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go @@ -1,545 +1,545 @@ -package dns - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RecordSetsClient is the the DNS Management Client. -type RecordSetsClient struct { - ManagementClient -} - -// NewRecordSetsClient creates an instance of the RecordSetsClient client. -func NewRecordSetsClient(subscriptionID string) RecordSetsClient { - return NewRecordSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecordSetsClientWithBaseURI creates an instance of the RecordSetsClient -// client. -func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) RecordSetsClient { - return RecordSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a record set within a DNS zone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). relativeRecordSetName is the name -// of the record set, relative to the name of the zone. recordType is the type -// of DNS record in this record set. Record sets of type SOA can be updated but -// not created (they are created when the DNS zone is created). parameters is -// parameters supplied to the CreateOrUpdate operation. ifMatch is the etag of -// the record set. Omit this value to always overwrite the current record set. -// Specify the last-seen etag value to prevent accidentally overwritting any -// concurrent changes. ifNoneMatch is set to '*' to allow a new record set to -// be created, but to prevent updating an existing record set. Other values -// will be ignored. -func (client RecordSetsClient) CreateOrUpdate(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RecordSetsClient) CreateOrUpdatePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (result RecordSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a record set from a DNS zone. This operation cannot be -// undone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). relativeRecordSetName is the name -// of the record set, relative to the name of the zone. recordType is the type -// of DNS record in this record set. Record sets of type SOA cannot be deleted -// (they are deleted when the DNS zone is deleted). ifMatch is the etag of the -// record set. Omit this value to always delete the current record set. Specify -// the last-seen etag value to prevent accidentally deleting any concurrent -// changes. -func (client RecordSetsClient) Delete(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RecordSetsClient) DeletePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a record set. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). relativeRecordSetName is the name -// of the record set, relative to the name of the zone. recordType is the type -// of DNS record in this record set. -func (client RecordSetsClient) Get(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { - req, err := client.GetPreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecordSetsClient) GetPreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDNSZone lists all record sets in a DNS zone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). top is the maximum number of -// record sets to return. If not specified, returns up to 100 record sets. -func (client RecordSetsClient) ListByDNSZone(resourceGroupName string, zoneName string, top *int32) (result RecordSetListResult, err error) { - req, err := client.ListByDNSZonePreparer(resourceGroupName, zoneName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDNSZoneSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending request") - return - } - - result, err = client.ListByDNSZoneResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to request") - } - - return -} - -// ListByDNSZonePreparer prepares the ListByDNSZone request. -func (client RecordSetsClient) ListByDNSZonePreparer(resourceGroupName string, zoneName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByDNSZoneSender sends the ListByDNSZone request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) ListByDNSZoneSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByDNSZoneResponder handles the response to the ListByDNSZone request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDNSZoneNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) ListByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.RecordSetListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByDNSZoneSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending next results request") - } - - result, err = client.ListByDNSZoneResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to next results request") - } - - return -} - -// ListByType lists the record sets of a specified type in a DNS zone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). recordType is the type of record -// sets to enumerate. top is the maximum number of record sets to return. If -// not specified, returns up to 100 record sets. -func (client RecordSetsClient) ListByType(resourceGroupName string, zoneName string, recordType RecordType, top *int32) (result RecordSetListResult, err error) { - req, err := client.ListByTypePreparer(resourceGroupName, zoneName, recordType, top) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending request") - return - } - - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to request") - } - - return -} - -// ListByTypePreparer prepares the ListByType request. -func (client RecordSetsClient) ListByTypePreparer(resourceGroupName string, zoneName string, recordType RecordType, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByTypeSender sends the ListByType request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByTypeResponder handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result RecordSetListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTypeNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) ListByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.RecordSetListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending next results request") - } - - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to next results request") - } - - return -} - -// Update updates a record set within a DNS zone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). relativeRecordSetName is the name -// of the record set, relative to the name of the zone. recordType is the type -// of DNS record in this record set. parameters is parameters supplied to the -// Update operation. ifMatch is the etag of the record set. Omit this value to -// always overwrite the current record set. Specify the last-seen etag value to -// prevent accidentally overwritting concurrent changes. -func (client RecordSetsClient) Update(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { - req, err := client.UpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RecordSetsClient) UpdatePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) UpdateResponder(resp *http.Response) (result RecordSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RecordSetsClient is the the DNS Management Client. +type RecordSetsClient struct { + ManagementClient +} + +// NewRecordSetsClient creates an instance of the RecordSetsClient client. +func NewRecordSetsClient(subscriptionID string) RecordSetsClient { + return NewRecordSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecordSetsClientWithBaseURI creates an instance of the RecordSetsClient +// client. +func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) RecordSetsClient { + return RecordSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a record set within a DNS zone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. Record sets of type SOA can be updated but +// not created (they are created when the DNS zone is created). parameters is +// parameters supplied to the CreateOrUpdate operation. ifMatch is the etag of +// the record set. Omit this value to always overwrite the current record set. +// Specify the last-seen etag value to prevent accidentally overwritting any +// concurrent changes. ifNoneMatch is set to '*' to allow a new record set to +// be created, but to prevent updating an existing record set. Other values +// will be ignored. +func (client RecordSetsClient) CreateOrUpdate(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RecordSetsClient) CreateOrUpdatePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a record set from a DNS zone. This operation cannot be +// undone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. Record sets of type SOA cannot be deleted +// (they are deleted when the DNS zone is deleted). ifMatch is the etag of the +// record set. Omit this value to always delete the current record set. Specify +// the last-seen etag value to prevent accidentally deleting any concurrent +// changes. +func (client RecordSetsClient) Delete(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RecordSetsClient) DeletePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a record set. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. +func (client RecordSetsClient) Get(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { + req, err := client.GetPreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecordSetsClient) GetPreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDNSZone lists all record sets in a DNS zone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). top is the maximum number of +// record sets to return. If not specified, returns up to 100 record sets. +func (client RecordSetsClient) ListByDNSZone(resourceGroupName string, zoneName string, top *int32) (result RecordSetListResult, err error) { + req, err := client.ListByDNSZonePreparer(resourceGroupName, zoneName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDNSZoneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending request") + return + } + + result, err = client.ListByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to request") + } + + return +} + +// ListByDNSZonePreparer prepares the ListByDNSZone request. +func (client RecordSetsClient) ListByDNSZonePreparer(resourceGroupName string, zoneName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByDNSZoneSender sends the ListByDNSZone request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListByDNSZoneSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByDNSZoneResponder handles the response to the ListByDNSZone request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDNSZoneNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) ListByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.RecordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByDNSZoneSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending next results request") + } + + result, err = client.ListByDNSZoneResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to next results request") + } + + return +} + +// ListByType lists the record sets of a specified type in a DNS zone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). recordType is the type of record +// sets to enumerate. top is the maximum number of record sets to return. If +// not specified, returns up to 100 record sets. +func (client RecordSetsClient) ListByType(resourceGroupName string, zoneName string, recordType RecordType, top *int32) (result RecordSetListResult, err error) { + req, err := client.ListByTypePreparer(resourceGroupName, zoneName, recordType, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + resp, err := client.ListByTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending request") + return + } + + result, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to request") + } + + return +} + +// ListByTypePreparer prepares the ListByType request. +func (client RecordSetsClient) ListByTypePreparer(resourceGroupName string, zoneName string, recordType RecordType, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByTypeSender sends the ListByType request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByTypeResponder handles the response to the ListByType request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result RecordSetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByTypeNextResults retrieves the next set of results, if any. +func (client RecordSetsClient) ListByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.RecordSetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending next results request") + } + + result, err = client.ListByTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to next results request") + } + + return +} + +// Update updates a record set within a DNS zone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). relativeRecordSetName is the name +// of the record set, relative to the name of the zone. recordType is the type +// of DNS record in this record set. parameters is parameters supplied to the +// Update operation. ifMatch is the etag of the record set. Omit this value to +// always overwrite the current record set. Specify the last-seen etag value to +// prevent accidentally overwritting concurrent changes. +func (client RecordSetsClient) Update(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { + req, err := client.UpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RecordSetsClient) UpdatePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recordType": autorest.Encode("path", recordType), + "relativeRecordSetName": relativeRecordSetName, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RecordSetsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RecordSetsClient) UpdateResponder(resp *http.Response) (result RecordSet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go index 620e0d8eae..054f065276 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go @@ -1,29 +1,29 @@ -package dns - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-dns/2016-04-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-dns/2016-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go index be66888d9f..31ad0ba36f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go @@ -1,463 +1,463 @@ -package dns - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ZonesClient is the the DNS Management Client. -type ZonesClient struct { - ManagementClient -} - -// NewZonesClient creates an instance of the ZonesClient client. -func NewZonesClient(subscriptionID string) ZonesClient { - return NewZonesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewZonesClientWithBaseURI creates an instance of the ZonesClient client. -func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClient { - return ZonesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records -// within the zone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). parameters is parameters supplied -// to the CreateOrUpdate operation. ifMatch is the etag of the DNS zone. Omit -// this value to always overwrite the current zone. Specify the last-seen etag -// value to prevent accidentally overwritting any concurrent changes. -// ifNoneMatch is set to '*' to allow a new DNS zone to be created, but to -// prevent updating an existing zone. Other values will be ignored. -func (client ZonesClient) CreateOrUpdate(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ZonesClient) CreateOrUpdatePreparer(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Zone, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be -// deleted. This operation cannot be undone. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). ifMatch is the etag of the DNS -// zone. Omit this value to always delete the current zone. Specify the -// last-seen etag value to prevent accidentally deleting any concurrent -// changes. -func (client ZonesClient) Delete(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (<-chan ZoneDeleteResult, <-chan error) { - resultChan := make(chan ZoneDeleteResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ZoneDeleteResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, zoneName, ifMatch, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ZonesClient) DeletePreparer(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ZonesClient) DeleteResponder(resp *http.Response) (result ZoneDeleteResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a DNS zone. Retrieves the zone properties, but not the record sets -// within the zone. -// -// resourceGroupName is the name of the resource group. zoneName is the name of -// the DNS zone (without a terminating dot). -func (client ZonesClient) Get(resourceGroupName string, zoneName string) (result Zone, err error) { - req, err := client.GetPreparer(resourceGroupName, zoneName) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ZonesClient) GetPreparer(resourceGroupName string, zoneName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the DNS zones in all resource groups in a subscription. -// -// top is the maximum number of DNS zones to return. If not specified, returns -// up to 100 zones. -func (client ZonesClient) List(top *int32) (result ZoneListResult, err error) { - req, err := client.ListPreparer(top) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ZonesClient) ListPreparer(top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ZonesClient) ListNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { - req, err := lastResults.ZoneListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists the DNS zones within a resource group. -// -// resourceGroupName is the name of the resource group. top is the maximum -// number of record sets to return. If not specified, returns up to 100 record -// sets. -func (client ZonesClient) ListByResourceGroup(resourceGroupName string, top *int32) (result ZoneListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ZonesClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (result ZoneListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ZonesClient) ListByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { - req, err := lastResults.ZoneListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package dns + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ZonesClient is the the DNS Management Client. +type ZonesClient struct { + ManagementClient +} + +// NewZonesClient creates an instance of the ZonesClient client. +func NewZonesClient(subscriptionID string) ZonesClient { + return NewZonesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewZonesClientWithBaseURI creates an instance of the ZonesClient client. +func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClient { + return ZonesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records +// within the zone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). parameters is parameters supplied +// to the CreateOrUpdate operation. ifMatch is the etag of the DNS zone. Omit +// this value to always overwrite the current zone. Specify the last-seen etag +// value to prevent accidentally overwritting any concurrent changes. +// ifNoneMatch is set to '*' to allow a new DNS zone to be created, but to +// prevent updating an existing zone. Other values will be ignored. +func (client ZonesClient) CreateOrUpdate(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ZonesClient) CreateOrUpdatePreparer(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be +// deleted. This operation cannot be undone. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). ifMatch is the etag of the DNS +// zone. Omit this value to always delete the current zone. Specify the +// last-seen etag value to prevent accidentally deleting any concurrent +// changes. +func (client ZonesClient) Delete(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (<-chan ZoneDeleteResult, <-chan error) { + resultChan := make(chan ZoneDeleteResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ZoneDeleteResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, zoneName, ifMatch, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ZonesClient) DeletePreparer(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ZonesClient) DeleteResponder(resp *http.Response) (result ZoneDeleteResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a DNS zone. Retrieves the zone properties, but not the record sets +// within the zone. +// +// resourceGroupName is the name of the resource group. zoneName is the name of +// the DNS zone (without a terminating dot). +func (client ZonesClient) Get(resourceGroupName string, zoneName string) (result Zone, err error) { + req, err := client.GetPreparer(resourceGroupName, zoneName) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ZonesClient) GetPreparer(resourceGroupName string, zoneName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "zoneName": autorest.Encode("path", zoneName), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the DNS zones in all resource groups in a subscription. +// +// top is the maximum number of DNS zones to return. If not specified, returns +// up to 100 zones. +func (client ZonesClient) List(top *int32) (result ZoneListResult, err error) { + req, err := client.ListPreparer(top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ZonesClient) ListPreparer(top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ZonesClient) ListNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.ZoneListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists the DNS zones within a resource group. +// +// resourceGroupName is the name of the resource group. top is the maximum +// number of record sets to return. If not specified, returns up to 100 record +// sets. +func (client ZonesClient) ListByResourceGroup(resourceGroupName string, top *int32) (result ZoneListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ZonesClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ZonesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (result ZoneListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ZonesClient) ListByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.ZoneListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/client.go index 6206b7f4d2..5c0752c012 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/client.go @@ -1,53 +1,53 @@ -// Package documentdb implements the Azure ARM Documentdb service API version -// 2015-04-08. -// -// Azure DocumentDB Database Service Resource Provider REST API -package documentdb - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Documentdb - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Documentdb. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package documentdb implements the Azure ARM Documentdb service API version +// 2015-04-08. +// +// Azure DocumentDB Database Service Resource Provider REST API +package documentdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Documentdb + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Documentdb. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/databaseaccounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/databaseaccounts.go index a351ee06a4..7d44807422 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/databaseaccounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/databaseaccounts.go @@ -1,1069 +1,1069 @@ -package documentdb - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DatabaseAccountsClient is the azure DocumentDB Database Service Resource -// Provider REST API -type DatabaseAccountsClient struct { - ManagementClient -} - -// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient -// client. -func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { - return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabaseAccountsClientWithBaseURI creates an instance of the -// DatabaseAccountsClient client. -func NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { - return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameExists checks that the Azure DocumentDB account name already -// exists. A valid account name may contain only lowercase letters, numbers, -// and the '-' character, and must be between 3 and 50 characters. -// -// accountName is documentDB database account name. -func (client DatabaseAccountsClient) CheckNameExists(accountName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists") - } - - req, err := client.CheckNameExistsPreparer(accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameExistsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") - return - } - - result, err = client.CheckNameExistsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") - } - - return -} - -// CheckNameExistsPreparer prepares the CheckNameExists request. -func (client DatabaseAccountsClient) CheckNameExistsPreparer(accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameExistsSender sends the CheckNameExists request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates or updates an Azure DocumentDB database account. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. createUpdateParameters is the parameters -// to provide for the current database account. -func (client DatabaseAccountsClient) CreateOrUpdate(resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters, cancel <-chan struct{}) (<-chan DatabaseAccount, <-chan error) { - resultChan := make(chan DatabaseAccount, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: createUpdateParameters, - Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: 2147483647, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result DatabaseAccount - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, createUpdateParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabaseAccountsClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(createUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing Azure DocumentDB database account. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. -func (client DatabaseAccountsClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client DatabaseAccountsClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// FailoverPriorityChange changes the failover priority for the Azure -// DocumentDB database account. A failover priority of 0 indicates a write -// region. The maximum value for a failover priority = (total number of regions -// - 1). Failover priority values must be unique for each of the regions in -// which the database account exists. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. failoverParameters is the new failover -// policies for the database account. -func (client DatabaseAccountsClient) FailoverPriorityChange(resourceGroupName string, accountName string, failoverParameters FailoverPolicies, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.FailoverPriorityChangePreparer(resourceGroupName, accountName, failoverParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") - return - } - - resp, err := client.FailoverPriorityChangeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", resp, "Failure sending request") - return - } - - result, err = client.FailoverPriorityChangeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. -func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(resourceGroupName string, accountName string, failoverParameters FailoverPolicies, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), - autorest.WithJSON(failoverParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieves the properties of an existing Azure DocumentDB database -// account. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. -func (client DatabaseAccountsClient) Get(resourceGroupName string, accountName string) (result DatabaseAccount, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabaseAccountsClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the Azure DocumentDB database accounts available under the -// subscription. -func (client DatabaseAccountsClient) List() (result DatabaseAccountsListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DatabaseAccountsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the Azure DocumentDB database accounts -// available under the given resource group. -// -// resourceGroupName is name of an Azure resource group. -func (client DatabaseAccountsClient) ListByResourceGroup(resourceGroupName string) (result DatabaseAccountsListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DatabaseAccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStrings lists the connection strings for the specified Azure -// DocumentDB database account. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. -func (client DatabaseAccountsClient) ListConnectionStrings(resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings") - } - - req, err := client.ListConnectionStringsPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client DatabaseAccountsClient) ListConnectionStringsPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified Azure DocumentDB database -// account. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. -func (client DatabaseAccountsClient) ListKeys(resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DatabaseAccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReadOnlyKeys lists the read-only access keys for the specified Azure -// DocumentDB database account. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. -func (client DatabaseAccountsClient) ListReadOnlyKeys(resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys") - } - - req, err := client.ListReadOnlyKeysPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListReadOnlyKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") - return - } - - result, err = client.ListReadOnlyKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") - } - - return -} - -// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. -func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch patches the properties of an existing Azure DocumentDB database -// account. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. updateParameters is the tags parameter to -// patch for the current database account. -func (client DatabaseAccountsClient) Patch(resourceGroupName string, accountName string, updateParameters DatabaseAccountPatchParameters, cancel <-chan struct{}) (<-chan DatabaseAccount, <-chan error) { - resultChan := make(chan DatabaseAccount, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "Patch") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result DatabaseAccount - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PatchPreparer(resourceGroupName, accountName, updateParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Patch", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PatchPreparer prepares the Patch request. -func (client DatabaseAccountsClient) PatchPreparer(resourceGroupName string, accountName string, updateParameters DatabaseAccountPatchParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), - autorest.WithJSON(updateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) PatchResponder(resp *http.Response) (result DatabaseAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates an access key for the specified Azure DocumentDB -// database account. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of an Azure resource group. accountName is -// documentDB database account name. keyToRegenerate is the name of the key to -// regenerate. -func (client DatabaseAccountsClient) RegenerateKey(resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, keyToRegenerate, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client DatabaseAccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-08" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keyToRegenerate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client DatabaseAccountsClient) RegenerateKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package documentdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DatabaseAccountsClient is the azure DocumentDB Database Service Resource +// Provider REST API +type DatabaseAccountsClient struct { + ManagementClient +} + +// NewDatabaseAccountsClient creates an instance of the DatabaseAccountsClient +// client. +func NewDatabaseAccountsClient(subscriptionID string) DatabaseAccountsClient { + return NewDatabaseAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabaseAccountsClientWithBaseURI creates an instance of the +// DatabaseAccountsClient client. +func NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) DatabaseAccountsClient { + return DatabaseAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameExists checks that the Azure DocumentDB account name already +// exists. A valid account name may contain only lowercase letters, numbers, +// and the '-' character, and must be between 3 and 50 characters. +// +// accountName is documentDB database account name. +func (client DatabaseAccountsClient) CheckNameExists(accountName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists") + } + + req, err := client.CheckNameExistsPreparer(accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameExistsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure sending request") + return + } + + result, err = client.CheckNameExistsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CheckNameExists", resp, "Failure responding to request") + } + + return +} + +// CheckNameExistsPreparer prepares the CheckNameExists request. +func (client DatabaseAccountsClient) CheckNameExistsPreparer(accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameExistsSender sends the CheckNameExists request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) CheckNameExistsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameExistsResponder handles the response to the CheckNameExists request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate creates or updates an Azure DocumentDB database account. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. createUpdateParameters is the parameters +// to provide for the current database account. +func (client DatabaseAccountsClient) CreateOrUpdate(resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters, cancel <-chan struct{}) (<-chan DatabaseAccount, <-chan error) { + resultChan := make(chan DatabaseAccount, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: createUpdateParameters, + Constraints: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMaximum, Rule: 2147483647, Chain: nil}, + {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxStalenessPrefix", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.ConsistencyPolicy.MaxIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}, + {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createUpdateParameters.DatabaseAccountCreateUpdateProperties.DatabaseAccountOfferType", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DatabaseAccount + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, accountName, createUpdateParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabaseAccountsClient) CreateOrUpdatePreparer(resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), + autorest.WithJSON(createUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing Azure DocumentDB database account. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. +func (client DatabaseAccountsClient) Delete(resourceGroupName string, accountName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, accountName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DatabaseAccountsClient) DeletePreparer(resourceGroupName string, accountName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// FailoverPriorityChange changes the failover priority for the Azure +// DocumentDB database account. A failover priority of 0 indicates a write +// region. The maximum value for a failover priority = (total number of regions +// - 1). Failover priority values must be unique for each of the regions in +// which the database account exists. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. failoverParameters is the new failover +// policies for the database account. +func (client DatabaseAccountsClient) FailoverPriorityChange(resourceGroupName string, accountName string, failoverParameters FailoverPolicies, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.FailoverPriorityChangePreparer(resourceGroupName, accountName, failoverParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverPriorityChangeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", resp, "Failure sending request") + return + } + + result, err = client.FailoverPriorityChangeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "FailoverPriorityChange", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// FailoverPriorityChangePreparer prepares the FailoverPriorityChange request. +func (client DatabaseAccountsClient) FailoverPriorityChangePreparer(resourceGroupName string, accountName string, failoverParameters FailoverPolicies, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", pathParameters), + autorest.WithJSON(failoverParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// FailoverPriorityChangeSender sends the FailoverPriorityChange request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) FailoverPriorityChangeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// FailoverPriorityChangeResponder handles the response to the FailoverPriorityChange request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the properties of an existing Azure DocumentDB database +// account. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. +func (client DatabaseAccountsClient) Get(resourceGroupName string, accountName string) (result DatabaseAccount, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabaseAccountsClient) GetPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) GetResponder(resp *http.Response) (result DatabaseAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the Azure DocumentDB database accounts available under the +// subscription. +func (client DatabaseAccountsClient) List() (result DatabaseAccountsListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DatabaseAccountsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) ListResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all the Azure DocumentDB database accounts +// available under the given resource group. +// +// resourceGroupName is name of an Azure resource group. +func (client DatabaseAccountsClient) ListByResourceGroup(resourceGroupName string) (result DatabaseAccountsListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DatabaseAccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result DatabaseAccountsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionStrings lists the connection strings for the specified Azure +// DocumentDB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. +func (client DatabaseAccountsClient) ListConnectionStrings(resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings") + } + + req, err := client.ListConnectionStringsPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListConnectionStrings", resp, "Failure responding to request") + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client DatabaseAccountsClient) ListConnectionStringsPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.Response) (result DatabaseAccountListConnectionStringsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeys lists the access keys for the specified Azure DocumentDB database +// account. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. +func (client DatabaseAccountsClient) ListKeys(resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client DatabaseAccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (result DatabaseAccountListKeysResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListReadOnlyKeys lists the read-only access keys for the specified Azure +// DocumentDB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. +func (client DatabaseAccountsClient) ListReadOnlyKeys(resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys") + } + + req, err := client.ListReadOnlyKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListReadOnlyKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure sending request") + return + } + + result, err = client.ListReadOnlyKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "ListReadOnlyKeys", resp, "Failure responding to request") + } + + return +} + +// ListReadOnlyKeysPreparer prepares the ListReadOnlyKeys request. +func (client DatabaseAccountsClient) ListReadOnlyKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListReadOnlyKeysSender sends the ListReadOnlyKeys request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) ListReadOnlyKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListReadOnlyKeysResponder handles the response to the ListReadOnlyKeys request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Response) (result DatabaseAccountListReadOnlyKeysResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Patch patches the properties of an existing Azure DocumentDB database +// account. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. updateParameters is the tags parameter to +// patch for the current database account. +func (client DatabaseAccountsClient) Patch(resourceGroupName string, accountName string, updateParameters DatabaseAccountPatchParameters, cancel <-chan struct{}) (<-chan DatabaseAccount, <-chan error) { + resultChan := make(chan DatabaseAccount, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "Patch") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DatabaseAccount + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PatchPreparer(resourceGroupName, accountName, updateParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "Patch", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PatchPreparer prepares the Patch request. +func (client DatabaseAccountsClient) PatchPreparer(resourceGroupName string, accountName string, updateParameters DatabaseAccountPatchParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", pathParameters), + autorest.WithJSON(updateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) PatchResponder(resp *http.Response) (result DatabaseAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerates an access key for the specified Azure DocumentDB +// database account. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of an Azure resource group. accountName is +// documentDB database account name. keyToRegenerate is the name of the key to +// regenerate. +func (client DatabaseAccountsClient) RegenerateKey(resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, keyToRegenerate, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "RegenerateKey", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client DatabaseAccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey", pathParameters), + autorest.WithJSON(keyToRegenerate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) RegenerateKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/models.go index b6775aa944..cc2d6de038 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/models.go @@ -1,210 +1,210 @@ -package documentdb - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// DatabaseAccountKind enumerates the values for database account kind. -type DatabaseAccountKind string - -const ( - // GlobalDocumentDB specifies the global document db state for database - // account kind. - GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" - // MongoDB specifies the mongo db state for database account kind. - MongoDB DatabaseAccountKind = "MongoDB" - // Parse specifies the parse state for database account kind. - Parse DatabaseAccountKind = "Parse" -) - -// DatabaseAccountOfferType enumerates the values for database account offer -// type. -type DatabaseAccountOfferType string - -const ( - // Standard specifies the standard state for database account offer type. - Standard DatabaseAccountOfferType = "Standard" -) - -// DefaultConsistencyLevel enumerates the values for default consistency level. -type DefaultConsistencyLevel string - -const ( - // BoundedStaleness specifies the bounded staleness state for default - // consistency level. - BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" - // Eventual specifies the eventual state for default consistency level. - Eventual DefaultConsistencyLevel = "Eventual" - // Session specifies the session state for default consistency level. - Session DefaultConsistencyLevel = "Session" - // Strong specifies the strong state for default consistency level. - Strong DefaultConsistencyLevel = "Strong" -) - -// KeyKind enumerates the values for key kind. -type KeyKind string - -const ( - // Primary specifies the primary state for key kind. - Primary KeyKind = "primary" - // PrimaryReadonly specifies the primary readonly state for key kind. - PrimaryReadonly KeyKind = "primaryReadonly" - // Secondary specifies the secondary state for key kind. - Secondary KeyKind = "secondary" - // SecondaryReadonly specifies the secondary readonly state for key kind. - SecondaryReadonly KeyKind = "secondaryReadonly" -) - -// ConsistencyPolicy is the consistency policy for the DocumentDB database -// account. -type ConsistencyPolicy struct { - DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` - MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` - MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` -} - -// DatabaseAccount is a DocumentDB database account. -type DatabaseAccount struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountProperties `json:"properties,omitempty"` -} - -// DatabaseAccountConnectionString is connection string for the DocumentDB -// account -type DatabaseAccountConnectionString struct { - ConnectionString *string `json:"connectionString,omitempty"` - Description *string `json:"description,omitempty"` -} - -// DatabaseAccountCreateUpdateParameters is parameters to create and update -// DocumentDB database accounts. -type DatabaseAccountCreateUpdateParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Kind DatabaseAccountKind `json:"kind,omitempty"` - *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` -} - -// DatabaseAccountCreateUpdateProperties is properties to create and update -// Azure DocumentDB database accounts. -type DatabaseAccountCreateUpdateProperties struct { - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - Locations *[]Location `json:"locations,omitempty"` - DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` -} - -// DatabaseAccountListConnectionStringsResult is the connection strings for the -// given database account. -type DatabaseAccountListConnectionStringsResult struct { - autorest.Response `json:"-"` - ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` -} - -// DatabaseAccountListKeysResult is the access keys for the given database -// account. -type DatabaseAccountListKeysResult struct { - autorest.Response `json:"-"` - PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` - SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` - *DatabaseAccountListReadOnlyKeysResult `json:"properties,omitempty"` -} - -// DatabaseAccountListReadOnlyKeysResult is the read-only access keys for the -// given database account. -type DatabaseAccountListReadOnlyKeysResult struct { - autorest.Response `json:"-"` - PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` - SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` -} - -// DatabaseAccountPatchParameters is parameters for patching Azure DocumentDB -// database account properties. -type DatabaseAccountPatchParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` -} - -// DatabaseAccountProperties is properties for the database account. -type DatabaseAccountProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` - IPRangeFilter *string `json:"ipRangeFilter,omitempty"` - ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` - WriteLocations *[]Location `json:"writeLocations,omitempty"` - ReadLocations *[]Location `json:"readLocations,omitempty"` - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// DatabaseAccountRegenerateKeyParameters is parameters to regenerate the keys -// within the database account. -type DatabaseAccountRegenerateKeyParameters struct { - KeyKind KeyKind `json:"keyKind,omitempty"` -} - -// DatabaseAccountsListResult is the List operation response, that contains the -// database accounts and their properties. -type DatabaseAccountsListResult struct { - autorest.Response `json:"-"` - Value *[]DatabaseAccount `json:"value,omitempty"` -} - -// FailoverPolicies is the list of new failover policies for the failover -// priority change. -type FailoverPolicies struct { - FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` -} - -// FailoverPolicy is the failover policy for a given region of a database -// account. -type FailoverPolicy struct { - ID *string `json:"id,omitempty"` - LocationName *string `json:"locationName,omitempty"` - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// Location is a region in which the Azure DocumentDB database account is -// deployed. -type Location struct { - ID *string `json:"id,omitempty"` - LocationName *string `json:"locationName,omitempty"` - DocumentEndpoint *string `json:"documentEndpoint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - FailoverPriority *int32 `json:"failoverPriority,omitempty"` -} - -// Resource is a database account resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} +package documentdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// DatabaseAccountKind enumerates the values for database account kind. +type DatabaseAccountKind string + +const ( + // GlobalDocumentDB specifies the global document db state for database + // account kind. + GlobalDocumentDB DatabaseAccountKind = "GlobalDocumentDB" + // MongoDB specifies the mongo db state for database account kind. + MongoDB DatabaseAccountKind = "MongoDB" + // Parse specifies the parse state for database account kind. + Parse DatabaseAccountKind = "Parse" +) + +// DatabaseAccountOfferType enumerates the values for database account offer +// type. +type DatabaseAccountOfferType string + +const ( + // Standard specifies the standard state for database account offer type. + Standard DatabaseAccountOfferType = "Standard" +) + +// DefaultConsistencyLevel enumerates the values for default consistency level. +type DefaultConsistencyLevel string + +const ( + // BoundedStaleness specifies the bounded staleness state for default + // consistency level. + BoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" + // Eventual specifies the eventual state for default consistency level. + Eventual DefaultConsistencyLevel = "Eventual" + // Session specifies the session state for default consistency level. + Session DefaultConsistencyLevel = "Session" + // Strong specifies the strong state for default consistency level. + Strong DefaultConsistencyLevel = "Strong" +) + +// KeyKind enumerates the values for key kind. +type KeyKind string + +const ( + // Primary specifies the primary state for key kind. + Primary KeyKind = "primary" + // PrimaryReadonly specifies the primary readonly state for key kind. + PrimaryReadonly KeyKind = "primaryReadonly" + // Secondary specifies the secondary state for key kind. + Secondary KeyKind = "secondary" + // SecondaryReadonly specifies the secondary readonly state for key kind. + SecondaryReadonly KeyKind = "secondaryReadonly" +) + +// ConsistencyPolicy is the consistency policy for the DocumentDB database +// account. +type ConsistencyPolicy struct { + DefaultConsistencyLevel DefaultConsistencyLevel `json:"defaultConsistencyLevel,omitempty"` + MaxStalenessPrefix *int64 `json:"maxStalenessPrefix,omitempty"` + MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` +} + +// DatabaseAccount is a DocumentDB database account. +type DatabaseAccount struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Kind DatabaseAccountKind `json:"kind,omitempty"` + *DatabaseAccountProperties `json:"properties,omitempty"` +} + +// DatabaseAccountConnectionString is connection string for the DocumentDB +// account +type DatabaseAccountConnectionString struct { + ConnectionString *string `json:"connectionString,omitempty"` + Description *string `json:"description,omitempty"` +} + +// DatabaseAccountCreateUpdateParameters is parameters to create and update +// DocumentDB database accounts. +type DatabaseAccountCreateUpdateParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Kind DatabaseAccountKind `json:"kind,omitempty"` + *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` +} + +// DatabaseAccountCreateUpdateProperties is properties to create and update +// Azure DocumentDB database accounts. +type DatabaseAccountCreateUpdateProperties struct { + ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` + Locations *[]Location `json:"locations,omitempty"` + DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` + IPRangeFilter *string `json:"ipRangeFilter,omitempty"` +} + +// DatabaseAccountListConnectionStringsResult is the connection strings for the +// given database account. +type DatabaseAccountListConnectionStringsResult struct { + autorest.Response `json:"-"` + ConnectionStrings *[]DatabaseAccountConnectionString `json:"connectionStrings,omitempty"` +} + +// DatabaseAccountListKeysResult is the access keys for the given database +// account. +type DatabaseAccountListKeysResult struct { + autorest.Response `json:"-"` + PrimaryMasterKey *string `json:"primaryMasterKey,omitempty"` + SecondaryMasterKey *string `json:"secondaryMasterKey,omitempty"` + *DatabaseAccountListReadOnlyKeysResult `json:"properties,omitempty"` +} + +// DatabaseAccountListReadOnlyKeysResult is the read-only access keys for the +// given database account. +type DatabaseAccountListReadOnlyKeysResult struct { + autorest.Response `json:"-"` + PrimaryReadonlyMasterKey *string `json:"primaryReadonlyMasterKey,omitempty"` + SecondaryReadonlyMasterKey *string `json:"secondaryReadonlyMasterKey,omitempty"` +} + +// DatabaseAccountPatchParameters is parameters for patching Azure DocumentDB +// database account properties. +type DatabaseAccountPatchParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` +} + +// DatabaseAccountProperties is properties for the database account. +type DatabaseAccountProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + DocumentEndpoint *string `json:"documentEndpoint,omitempty"` + DatabaseAccountOfferType DatabaseAccountOfferType `json:"databaseAccountOfferType,omitempty"` + IPRangeFilter *string `json:"ipRangeFilter,omitempty"` + ConsistencyPolicy *ConsistencyPolicy `json:"consistencyPolicy,omitempty"` + WriteLocations *[]Location `json:"writeLocations,omitempty"` + ReadLocations *[]Location `json:"readLocations,omitempty"` + FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` +} + +// DatabaseAccountRegenerateKeyParameters is parameters to regenerate the keys +// within the database account. +type DatabaseAccountRegenerateKeyParameters struct { + KeyKind KeyKind `json:"keyKind,omitempty"` +} + +// DatabaseAccountsListResult is the List operation response, that contains the +// database accounts and their properties. +type DatabaseAccountsListResult struct { + autorest.Response `json:"-"` + Value *[]DatabaseAccount `json:"value,omitempty"` +} + +// FailoverPolicies is the list of new failover policies for the failover +// priority change. +type FailoverPolicies struct { + FailoverPolicies *[]FailoverPolicy `json:"failoverPolicies,omitempty"` +} + +// FailoverPolicy is the failover policy for a given region of a database +// account. +type FailoverPolicy struct { + ID *string `json:"id,omitempty"` + LocationName *string `json:"locationName,omitempty"` + FailoverPriority *int32 `json:"failoverPriority,omitempty"` +} + +// Location is a region in which the Azure DocumentDB database account is +// deployed. +type Location struct { + ID *string `json:"id,omitempty"` + LocationName *string `json:"locationName,omitempty"` + DocumentEndpoint *string `json:"documentEndpoint,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + FailoverPriority *int32 `json:"failoverPriority,omitempty"` +} + +// Resource is a database account resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/version.go index b5f4826440..dbbd4d7b1f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/documentdb/version.go @@ -1,29 +1,29 @@ -package documentdb - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-documentdb/2015-04-08" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package documentdb + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-documentdb/2015-04-08" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go index 759de8a5b5..204ad67293 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/client.go @@ -1,53 +1,53 @@ -// Package eventhub implements the Azure ARM Eventhub service API version -// 2015-08-01. -// -// Azure Event Hubs client -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Eventhub - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Eventhub. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package eventhub implements the Azure ARM Eventhub service API version +// 2015-08-01. +// +// Azure Event Hubs client +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Eventhub + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Eventhub. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go index d14e4e8a6f..e9a194ba95 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/consumergroups.go @@ -1,410 +1,410 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ConsumerGroupsClient is the azure Event Hubs client -type ConsumerGroupsClient struct { - ManagementClient -} - -// NewConsumerGroupsClient creates an instance of the ConsumerGroupsClient -// client. -func NewConsumerGroupsClient(subscriptionID string) ConsumerGroupsClient { - return NewConsumerGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConsumerGroupsClientWithBaseURI creates an instance of the -// ConsumerGroupsClient client. -func NewConsumerGroupsClientWithBaseURI(baseURI string, subscriptionID string) ConsumerGroupsClient { - return ConsumerGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an Event Hubs consumer group as a nested -// resource within a Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name consumerGroupName is the consumer group name parameters is -// parameters supplied to create or update a consumer group resource. -func (client ConsumerGroupsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (result ConsumerGroupResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: consumerGroupName, - Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConsumerGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "consumerGroupName": autorest.Encode("path", consumerGroupName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConsumerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ConsumerGroupResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a consumer group from the specified Event Hub and resource -// group. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name consumerGroupName is the consumer group name -func (client ConsumerGroupsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: consumerGroupName, - Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConsumerGroupsClient) DeletePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "consumerGroupName": autorest.Encode("path", consumerGroupName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConsumerGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a description for the specified consumer group. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name consumerGroupName is the consumer group name -func (client ConsumerGroupsClient) Get(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result ConsumerGroupResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: consumerGroupName, - Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConsumerGroupsClient) GetPreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "consumerGroupName": autorest.Encode("path", consumerGroupName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConsumerGroupsClient) GetResponder(resp *http.Response) (result ConsumerGroupResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets all the consumer groups in a Namespace. An empty feed is -// returned if no consumer group exists in the Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name -func (client ConsumerGroupsClient) ListAll(resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "ListAll") - } - - req, err := client.ListAllPreparer(resourceGroupName, namespaceName, eventHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client ConsumerGroupsClient) ListAllPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client ConsumerGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client ConsumerGroupsClient) ListAllResponder(resp *http.Response) (result ConsumerGroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client ConsumerGroupsClient) ListAllNextResults(lastResults ConsumerGroupListResult) (result ConsumerGroupListResult, err error) { - req, err := lastResults.ConsumerGroupListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ConsumerGroupsClient is the azure Event Hubs client +type ConsumerGroupsClient struct { + ManagementClient +} + +// NewConsumerGroupsClient creates an instance of the ConsumerGroupsClient +// client. +func NewConsumerGroupsClient(subscriptionID string) ConsumerGroupsClient { + return NewConsumerGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConsumerGroupsClientWithBaseURI creates an instance of the +// ConsumerGroupsClient client. +func NewConsumerGroupsClientWithBaseURI(baseURI string, subscriptionID string) ConsumerGroupsClient { + return ConsumerGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an Event Hubs consumer group as a nested +// resource within a Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name consumerGroupName is the consumer group name parameters is +// parameters supplied to create or update a consumer group resource. +func (client ConsumerGroupsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (result ConsumerGroupResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: consumerGroupName, + Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConsumerGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string, parameters ConsumerGroupCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consumerGroupName": autorest.Encode("path", consumerGroupName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConsumerGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConsumerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ConsumerGroupResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a consumer group from the specified Event Hub and resource +// group. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name consumerGroupName is the consumer group name +func (client ConsumerGroupsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: consumerGroupName, + Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConsumerGroupsClient) DeletePreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consumerGroupName": autorest.Encode("path", consumerGroupName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConsumerGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConsumerGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a description for the specified consumer group. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name consumerGroupName is the consumer group name +func (client ConsumerGroupsClient) Get(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (result ConsumerGroupResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: consumerGroupName, + Constraints: []validation.Constraint{{Target: "consumerGroupName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "consumerGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName, consumerGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConsumerGroupsClient) GetPreparer(resourceGroupName string, namespaceName string, eventHubName string, consumerGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "consumerGroupName": autorest.Encode("path", consumerGroupName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConsumerGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConsumerGroupsClient) GetResponder(resp *http.Response) (result ConsumerGroupResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets all the consumer groups in a Namespace. An empty feed is +// returned if no consumer group exists in the Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name +func (client ConsumerGroupsClient) ListAll(resourceGroupName string, namespaceName string, eventHubName string) (result ConsumerGroupListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.ConsumerGroupsClient", "ListAll") + } + + req, err := client.ListAllPreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ConsumerGroupsClient) ListAllPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ConsumerGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ConsumerGroupsClient) ListAllResponder(resp *http.Response) (result ConsumerGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client ConsumerGroupsClient) ListAllNextResults(lastResults ConsumerGroupListResult) (result ConsumerGroupListResult, err error) { + req, err := lastResults.ConsumerGroupListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.ConsumerGroupsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go index 9645ff529f..359e0da10c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/eventhubs.go @@ -1,931 +1,931 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// EventHubsClient is the azure Event Hubs client -type EventHubsClient struct { - ManagementClient -} - -// NewEventHubsClient creates an instance of the EventHubsClient client. -func NewEventHubsClient(subscriptionID string) EventHubsClient { - return NewEventHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEventHubsClientWithBaseURI creates an instance of the EventHubsClient -// client. -func NewEventHubsClientWithBaseURI(baseURI string, subscriptionID string) EventHubsClient { - return EventHubsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a new Event Hub as a nested resource -// within a Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name parameters is parameters supplied to create an Event Hub resource. -func (client EventHubsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, eventHubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EventHubsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client EventHubsClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or updates an AuthorizationRule for -// the specified Event Hub. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name authorizationRuleName is the authorization rule name. parameters is -// the shared access AuthorizationRule. -func (client EventHubsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client EventHubsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Event Hub from the specified Namespace and resource group. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name -func (client EventHubsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EventHubsClient) DeletePreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EventHubsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes an Event Hub AuthorizationRule. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name authorizationRuleName is the authorization rule name. -func (client EventHubsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client EventHubsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client EventHubsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an Event Hubs description for the specified Event Hub. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name -func (client EventHubsClient) Get(resourceGroupName string, namespaceName string, eventHubName string) (result ResourceType, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client EventHubsClient) GetPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EventHubsClient) GetResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an AuthorizationRule for an Event Hub by rule -// name. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name authorizationRuleName is the authorization rule name. -func (client EventHubsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client EventHubsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client EventHubsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets all the Event Hubs in a Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name -func (client EventHubsClient) ListAll(resourceGroupName string, namespaceName string) (result ListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListAll") - } - - req, err := client.ListAllPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client EventHubsClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client EventHubsClient) ListAllResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client EventHubsClient) ListAllNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListAuthorizationRules gets the authorization rules for an Event Hub. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name -func (client EventHubsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, eventHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, eventHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client EventHubsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client EventHubsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client EventHubsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the ACS and SAS connection strings for the Event Hub. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name authorizationRuleName is the authorization rule name. -func (client EventHubsClient) ListKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client EventHubsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client EventHubsClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the ACS and SAS connection strings for the Event -// Hub. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name eventHubName is the Event -// Hub name authorizationRuleName is the authorization rule name. parameters is -// parameters supplied to regenerate the AuthorizationRule Keys -// (PrimaryKey/SecondaryKey). -func (client EventHubsClient) RegenerateKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: eventHubName, - Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client EventHubsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "eventHubName": autorest.Encode("path", eventHubName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client EventHubsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client EventHubsClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// EventHubsClient is the azure Event Hubs client +type EventHubsClient struct { + ManagementClient +} + +// NewEventHubsClient creates an instance of the EventHubsClient client. +func NewEventHubsClient(subscriptionID string) EventHubsClient { + return NewEventHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventHubsClientWithBaseURI creates an instance of the EventHubsClient +// client. +func NewEventHubsClientWithBaseURI(baseURI string, subscriptionID string) EventHubsClient { + return EventHubsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a new Event Hub as a nested resource +// within a Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name parameters is parameters supplied to create an Event Hub resource. +func (client EventHubsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, eventHubName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EventHubsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, eventHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EventHubsClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates or updates an AuthorizationRule for +// the specified Event Hub. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name authorizationRuleName is the authorization rule name. parameters is +// the shared access AuthorizationRule. +func (client EventHubsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client EventHubsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Event Hub from the specified Namespace and resource group. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name +func (client EventHubsClient) Delete(resourceGroupName string, namespaceName string, eventHubName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EventHubsClient) DeletePreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EventHubsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes an Event Hub AuthorizationRule. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name authorizationRuleName is the authorization rule name. +func (client EventHubsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client EventHubsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an Event Hubs description for the specified Event Hub. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name +func (client EventHubsClient) Get(resourceGroupName string, namespaceName string, eventHubName string) (result ResourceType, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EventHubsClient) GetPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EventHubsClient) GetResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an AuthorizationRule for an Event Hub by rule +// name. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name authorizationRuleName is the authorization rule name. +func (client EventHubsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client EventHubsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client EventHubsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets all the Event Hubs in a Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name +func (client EventHubsClient) ListAll(resourceGroupName string, namespaceName string) (result ListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListAll") + } + + req, err := client.ListAllPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client EventHubsClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client EventHubsClient) ListAllResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client EventHubsClient) ListAllNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules gets the authorization rules for an Event Hub. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name +func (client EventHubsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, eventHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, eventHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client EventHubsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, eventHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client EventHubsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client EventHubsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the ACS and SAS connection strings for the Event Hub. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name authorizationRuleName is the authorization rule name. +func (client EventHubsClient) ListKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client EventHubsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client EventHubsClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the ACS and SAS connection strings for the Event +// Hub. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name eventHubName is the Event +// Hub name authorizationRuleName is the authorization rule name. parameters is +// parameters supplied to regenerate the AuthorizationRule Keys +// (PrimaryKey/SecondaryKey). +func (client EventHubsClient) RegenerateKeys(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: eventHubName, + Constraints: []validation.Constraint{{Target: "eventHubName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "eventHubName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.EventHubsClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, eventHubName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.EventHubsClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client EventHubsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, eventHubName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "eventHubName": autorest.Encode("path", eventHubName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client EventHubsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client EventHubsClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go index 4ae8f73347..299bb5e87c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/models.go @@ -1,449 +1,449 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // Listen specifies the listen state for access rights. - Listen AccessRights = "Listen" - // Manage specifies the manage state for access rights. - Manage AccessRights = "Manage" - // Send specifies the send state for access rights. - Send AccessRights = "Send" -) - -// EntityStatus enumerates the values for entity status. -type EntityStatus string - -const ( - // Active specifies the active state for entity status. - Active EntityStatus = "Active" - // Creating specifies the creating state for entity status. - Creating EntityStatus = "Creating" - // Deleting specifies the deleting state for entity status. - Deleting EntityStatus = "Deleting" - // Disabled specifies the disabled state for entity status. - Disabled EntityStatus = "Disabled" - // ReceiveDisabled specifies the receive disabled state for entity status. - ReceiveDisabled EntityStatus = "ReceiveDisabled" - // Renaming specifies the renaming state for entity status. - Renaming EntityStatus = "Renaming" - // Restoring specifies the restoring state for entity status. - Restoring EntityStatus = "Restoring" - // SendDisabled specifies the send disabled state for entity status. - SendDisabled EntityStatus = "SendDisabled" - // Unknown specifies the unknown state for entity status. - Unknown EntityStatus = "Unknown" -) - -// NamespaceState enumerates the values for namespace state. -type NamespaceState string - -const ( - // NamespaceStateActivating specifies the namespace state activating state - // for namespace state. - NamespaceStateActivating NamespaceState = "Activating" - // NamespaceStateActive specifies the namespace state active state for - // namespace state. - NamespaceStateActive NamespaceState = "Active" - // NamespaceStateCreated specifies the namespace state created state for - // namespace state. - NamespaceStateCreated NamespaceState = "Created" - // NamespaceStateCreating specifies the namespace state creating state for - // namespace state. - NamespaceStateCreating NamespaceState = "Creating" - // NamespaceStateDisabled specifies the namespace state disabled state for - // namespace state. - NamespaceStateDisabled NamespaceState = "Disabled" - // NamespaceStateDisabling specifies the namespace state disabling state - // for namespace state. - NamespaceStateDisabling NamespaceState = "Disabling" - // NamespaceStateEnabling specifies the namespace state enabling state for - // namespace state. - NamespaceStateEnabling NamespaceState = "Enabling" - // NamespaceStateFailed specifies the namespace state failed state for - // namespace state. - NamespaceStateFailed NamespaceState = "Failed" - // NamespaceStateRemoved specifies the namespace state removed state for - // namespace state. - NamespaceStateRemoved NamespaceState = "Removed" - // NamespaceStateRemoving specifies the namespace state removing state for - // namespace state. - NamespaceStateRemoving NamespaceState = "Removing" - // NamespaceStateSoftDeleted specifies the namespace state soft deleted - // state for namespace state. - NamespaceStateSoftDeleted NamespaceState = "SoftDeleted" - // NamespaceStateSoftDeleting specifies the namespace state soft deleting - // state for namespace state. - NamespaceStateSoftDeleting NamespaceState = "SoftDeleting" - // NamespaceStateUnknown specifies the namespace state unknown state for - // namespace state. - NamespaceStateUnknown NamespaceState = "Unknown" -) - -// Policykey enumerates the values for policykey. -type Policykey string - -const ( - // PrimaryKey specifies the primary key state for policykey. - PrimaryKey Policykey = "PrimaryKey" - // SecondaryKey specifies the secondary key state for policykey. - SecondaryKey Policykey = "SecondaryKey" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic specifies the basic state for sku name. - Basic SkuName = "Basic" - // Standard specifies the standard state for sku name. - Standard SkuName = "Standard" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic specifies the sku tier basic state for sku tier. - SkuTierBasic SkuTier = "Basic" - // SkuTierPremium specifies the sku tier premium state for sku tier. - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard specifies the sku tier standard state for sku tier. - SkuTierStandard SkuTier = "Standard" -) - -// UnavailableReason enumerates the values for unavailable reason. -type UnavailableReason string - -const ( - // InvalidName specifies the invalid name state for unavailable reason. - InvalidName UnavailableReason = "InvalidName" - // NameInLockdown specifies the name in lockdown state for unavailable - // reason. - NameInLockdown UnavailableReason = "NameInLockdown" - // NameInUse specifies the name in use state for unavailable reason. - NameInUse UnavailableReason = "NameInUse" - // None specifies the none state for unavailable reason. - None UnavailableReason = "None" - // SubscriptionIsDisabled specifies the subscription is disabled state for - // unavailable reason. - SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" - // TooManyNamespaceInCurrentSubscription specifies the too many namespace - // in current subscription state for unavailable reason. - TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" -) - -// CheckNameAvailabilityParameter is parameter supplied to check Namespace name -// availability operation -type CheckNameAvailabilityParameter struct { - Name *string `json:"name,omitempty"` -} - -// CheckNameAvailabilityResult is the Result of the CheckNameAvailability -// operation -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason UnavailableReason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ConsumerGroupCreateOrUpdateParameters is parameters supplied to the Create -// Or Update Consumer Group operation. -type ConsumerGroupCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *ConsumerGroupProperties `json:"properties,omitempty"` -} - -// ConsumerGroupListResult is the result to the List Consumer Group operation. -type ConsumerGroupListResult struct { - autorest.Response `json:"-"` - Value *[]ConsumerGroupResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ConsumerGroupListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ConsumerGroupListResult) ConsumerGroupListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ConsumerGroupProperties is properties supplied to the Create Or Update -// Consumer Group operation. -type ConsumerGroupProperties struct { - CreatedAt *date.Time `json:"createdAt,omitempty"` - EventHubPath *string `json:"eventHubPath,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - UserMetadata *string `json:"userMetadata,omitempty"` -} - -// ConsumerGroupResource is single item in List or Get Consumer group operation -type ConsumerGroupResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *ConsumerGroupProperties `json:"properties,omitempty"` -} - -// CreateOrUpdateParameters is parameters supplied to the Create Or Update -// Event Hub operation. -type CreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// ListResult is the result of the List EventHubs operation. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]ResourceType `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NamespaceCreateOrUpdateParameters is parameters supplied to the Create Or -// Update Namespace operation. -type NamespaceCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// NamespaceListResult is the response of the List Namespace operation. -type NamespaceListResult struct { - autorest.Response `json:"-"` - Value *[]NamespaceResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NamespaceProperties is properties of the Namespace supplied for create or -// update Namespace operation -type NamespaceProperties struct { - Status NamespaceState `json:"status,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - MetricID *string `json:"metricId,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// NamespaceResource is single Namespace item in List or Get Operation -type NamespaceResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// NamespaceUpdateParameter is parameters supplied to the Patch/update -// Namespace operation. -type NamespaceUpdateParameter struct { - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// Operation is a Event Hub REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list Event Hub operations. -// It contains a list of operations and a URL link to get the next set of -// results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Properties is properties supplied to the Create Or Update Event Hub -// operation. -type Properties struct { - CreatedAt *date.Time `json:"createdAt,omitempty"` - MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` - PartitionCount *int64 `json:"partitionCount,omitempty"` - PartitionIds *[]string `json:"partitionIds,omitempty"` - Status EntityStatus `json:"status,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` -} - -// RegenerateKeysParameters is parameters supplied to the Regenerate -// Authorization Rule keys operation. -type RegenerateKeysParameters struct { - Policykey Policykey `json:"policykey,omitempty"` -} - -// Resource is the Resource definition -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` -} - -// ResourceListKeys is namespace/EventHub Connection String -type ResourceListKeys struct { - autorest.Response `json:"-"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - KeyName *string `json:"keyName,omitempty"` -} - -// ResourceType is single item in List or Get Event Hub operation -type ResourceType struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied -// to the Create Or Update Authorization Rules operation. -type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleListResult is the response from the List -// Namespace operation. -type SharedAccessAuthorizationRuleListResult struct { - autorest.Response `json:"-"` - Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SharedAccessAuthorizationRuleProperties is properties supplied to create or -// update SharedAccessAuthorizationRule -type SharedAccessAuthorizationRuleProperties struct { - Rights *[]AccessRights `json:"rights,omitempty"` -} - -// SharedAccessAuthorizationRuleResource is single item in a List or Get -// AuthorizationRule operation -type SharedAccessAuthorizationRuleResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// Sku is sKU parameters supplied to the create Namespace operation -type Sku struct { - Name SkuName `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// TrackedResource is definition of Resource -type TrackedResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // Listen specifies the listen state for access rights. + Listen AccessRights = "Listen" + // Manage specifies the manage state for access rights. + Manage AccessRights = "Manage" + // Send specifies the send state for access rights. + Send AccessRights = "Send" +) + +// EntityStatus enumerates the values for entity status. +type EntityStatus string + +const ( + // Active specifies the active state for entity status. + Active EntityStatus = "Active" + // Creating specifies the creating state for entity status. + Creating EntityStatus = "Creating" + // Deleting specifies the deleting state for entity status. + Deleting EntityStatus = "Deleting" + // Disabled specifies the disabled state for entity status. + Disabled EntityStatus = "Disabled" + // ReceiveDisabled specifies the receive disabled state for entity status. + ReceiveDisabled EntityStatus = "ReceiveDisabled" + // Renaming specifies the renaming state for entity status. + Renaming EntityStatus = "Renaming" + // Restoring specifies the restoring state for entity status. + Restoring EntityStatus = "Restoring" + // SendDisabled specifies the send disabled state for entity status. + SendDisabled EntityStatus = "SendDisabled" + // Unknown specifies the unknown state for entity status. + Unknown EntityStatus = "Unknown" +) + +// NamespaceState enumerates the values for namespace state. +type NamespaceState string + +const ( + // NamespaceStateActivating specifies the namespace state activating state + // for namespace state. + NamespaceStateActivating NamespaceState = "Activating" + // NamespaceStateActive specifies the namespace state active state for + // namespace state. + NamespaceStateActive NamespaceState = "Active" + // NamespaceStateCreated specifies the namespace state created state for + // namespace state. + NamespaceStateCreated NamespaceState = "Created" + // NamespaceStateCreating specifies the namespace state creating state for + // namespace state. + NamespaceStateCreating NamespaceState = "Creating" + // NamespaceStateDisabled specifies the namespace state disabled state for + // namespace state. + NamespaceStateDisabled NamespaceState = "Disabled" + // NamespaceStateDisabling specifies the namespace state disabling state + // for namespace state. + NamespaceStateDisabling NamespaceState = "Disabling" + // NamespaceStateEnabling specifies the namespace state enabling state for + // namespace state. + NamespaceStateEnabling NamespaceState = "Enabling" + // NamespaceStateFailed specifies the namespace state failed state for + // namespace state. + NamespaceStateFailed NamespaceState = "Failed" + // NamespaceStateRemoved specifies the namespace state removed state for + // namespace state. + NamespaceStateRemoved NamespaceState = "Removed" + // NamespaceStateRemoving specifies the namespace state removing state for + // namespace state. + NamespaceStateRemoving NamespaceState = "Removing" + // NamespaceStateSoftDeleted specifies the namespace state soft deleted + // state for namespace state. + NamespaceStateSoftDeleted NamespaceState = "SoftDeleted" + // NamespaceStateSoftDeleting specifies the namespace state soft deleting + // state for namespace state. + NamespaceStateSoftDeleting NamespaceState = "SoftDeleting" + // NamespaceStateUnknown specifies the namespace state unknown state for + // namespace state. + NamespaceStateUnknown NamespaceState = "Unknown" +) + +// Policykey enumerates the values for policykey. +type Policykey string + +const ( + // PrimaryKey specifies the primary key state for policykey. + PrimaryKey Policykey = "PrimaryKey" + // SecondaryKey specifies the secondary key state for policykey. + SecondaryKey Policykey = "SecondaryKey" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Basic specifies the basic state for sku name. + Basic SkuName = "Basic" + // Standard specifies the standard state for sku name. + Standard SkuName = "Standard" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierBasic specifies the sku tier basic state for sku tier. + SkuTierBasic SkuTier = "Basic" + // SkuTierPremium specifies the sku tier premium state for sku tier. + SkuTierPremium SkuTier = "Premium" + // SkuTierStandard specifies the sku tier standard state for sku tier. + SkuTierStandard SkuTier = "Standard" +) + +// UnavailableReason enumerates the values for unavailable reason. +type UnavailableReason string + +const ( + // InvalidName specifies the invalid name state for unavailable reason. + InvalidName UnavailableReason = "InvalidName" + // NameInLockdown specifies the name in lockdown state for unavailable + // reason. + NameInLockdown UnavailableReason = "NameInLockdown" + // NameInUse specifies the name in use state for unavailable reason. + NameInUse UnavailableReason = "NameInUse" + // None specifies the none state for unavailable reason. + None UnavailableReason = "None" + // SubscriptionIsDisabled specifies the subscription is disabled state for + // unavailable reason. + SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + // TooManyNamespaceInCurrentSubscription specifies the too many namespace + // in current subscription state for unavailable reason. + TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// CheckNameAvailabilityParameter is parameter supplied to check Namespace name +// availability operation +type CheckNameAvailabilityParameter struct { + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult is the Result of the CheckNameAvailability +// operation +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason UnavailableReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ConsumerGroupCreateOrUpdateParameters is parameters supplied to the Create +// Or Update Consumer Group operation. +type ConsumerGroupCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *ConsumerGroupProperties `json:"properties,omitempty"` +} + +// ConsumerGroupListResult is the result to the List Consumer Group operation. +type ConsumerGroupListResult struct { + autorest.Response `json:"-"` + Value *[]ConsumerGroupResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConsumerGroupListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConsumerGroupListResult) ConsumerGroupListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ConsumerGroupProperties is properties supplied to the Create Or Update +// Consumer Group operation. +type ConsumerGroupProperties struct { + CreatedAt *date.Time `json:"createdAt,omitempty"` + EventHubPath *string `json:"eventHubPath,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + UserMetadata *string `json:"userMetadata,omitempty"` +} + +// ConsumerGroupResource is single item in List or Get Consumer group operation +type ConsumerGroupResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *ConsumerGroupProperties `json:"properties,omitempty"` +} + +// CreateOrUpdateParameters is parameters supplied to the Create Or Update +// Event Hub operation. +type CreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// ListResult is the result of the List EventHubs operation. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]ResourceType `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NamespaceCreateOrUpdateParameters is parameters supplied to the Create Or +// Update Namespace operation. +type NamespaceCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceListResult is the response of the List Namespace operation. +type NamespaceListResult struct { + autorest.Response `json:"-"` + Value *[]NamespaceResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NamespaceProperties is properties of the Namespace supplied for create or +// update Namespace operation +type NamespaceProperties struct { + Status NamespaceState `json:"status,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + MetricID *string `json:"metricId,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// NamespaceResource is single Namespace item in List or Get Operation +type NamespaceResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceUpdateParameter is parameters supplied to the Patch/update +// Namespace operation. +type NamespaceUpdateParameter struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// Operation is a Event Hub REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list Event Hub operations. +// It contains a list of operations and a URL link to get the next set of +// results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Properties is properties supplied to the Create Or Update Event Hub +// operation. +type Properties struct { + CreatedAt *date.Time `json:"createdAt,omitempty"` + MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` + PartitionCount *int64 `json:"partitionCount,omitempty"` + PartitionIds *[]string `json:"partitionIds,omitempty"` + Status EntityStatus `json:"status,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` +} + +// RegenerateKeysParameters is parameters supplied to the Regenerate +// Authorization Rule keys operation. +type RegenerateKeysParameters struct { + Policykey Policykey `json:"policykey,omitempty"` +} + +// Resource is the Resource definition +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` +} + +// ResourceListKeys is namespace/EventHub Connection String +type ResourceListKeys struct { + autorest.Response `json:"-"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + KeyName *string `json:"keyName,omitempty"` +} + +// ResourceType is single item in List or Get Event Hub operation +type ResourceType struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied +// to the Create Or Update Authorization Rules operation. +type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleListResult is the response from the List +// Namespace operation. +type SharedAccessAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SharedAccessAuthorizationRuleProperties is properties supplied to create or +// update SharedAccessAuthorizationRule +type SharedAccessAuthorizationRuleProperties struct { + Rights *[]AccessRights `json:"rights,omitempty"` +} + +// SharedAccessAuthorizationRuleResource is single item in a List or Get +// AuthorizationRule operation +type SharedAccessAuthorizationRuleResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// Sku is sKU parameters supplied to the create Namespace operation +type Sku struct { + Name SkuName `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// TrackedResource is definition of Resource +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go index 9f4de2bd6a..2f1f3bcbb2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/namespaces.go @@ -1,1163 +1,1163 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NamespacesClient is the azure Event Hubs client -type NamespacesClient struct { - ManagementClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient -// client. -func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability check the give Namespace name availability. -// -// parameters is parameters to check availability of the given Namespace name -func (client NamespacesClient) CheckNameAvailability(parameters CheckNameAvailabilityParameter) (result CheckNameAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client NamespacesClient) CheckNameAvailabilityPreparer(parameters CheckNameAvailabilityParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/CheckNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a namespace. Once created, this -// namespace's resource manifest is immutable. This operation is idempotent. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name parameters is parameters -// for creating a namespace resource. -func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (<-chan NamespaceResource, <-chan error) { - resultChan := make(chan NamespaceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result NamespaceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or updates an AuthorizationRule for -// a Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name authorizationRuleName is -// the authorization rule name. parameters is the shared access -// AuthorizationRule. -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing namespace. This operation also removes all -// associated resources under the namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name -func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes an AuthorizationRule for a Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name authorizationRuleName is -// the authorization rule name. -func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the description of the specified namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name -func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an AuthorizationRule for a Namespace by rule name. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name authorizationRuleName is -// the authorization rule name. -func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRules gets a list of authorization rules for a Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name -func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists the available Namespaces within a resource group. -// -// resourceGroupName is name of the resource group within the azure -// subscription. -func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription lists all the available Namespaces within a subscription, -// irrespective of the resource groups. -func (client NamespacesClient) ListBySubscription() (result NamespaceListResult, err error) { - req, err := client.ListBySubscriptionPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListBySubscriptionNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the primary and secondary connection strings for the -// Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name authorizationRuleName is -// the authorization rule name. -func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the primary or secondary connection strings for -// the specified Namespace. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name authorizationRuleName is -// the authorization rule name. parameters is parameters required to regenerate -// the connection string. -func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update creates or updates a namespace. Once created, this namespace's -// resource manifest is immutable. This operation is idempotent. -// -// resourceGroupName is name of the resource group within the azure -// subscription. namespaceName is the Namespace name parameters is parameters -// for updating a namespace resource. -func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (result NamespaceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NamespacesClient) UpdateResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NamespacesClient is the azure Event Hubs client +type NamespacesClient struct { + ManagementClient +} + +// NewNamespacesClient creates an instance of the NamespacesClient client. +func NewNamespacesClient(subscriptionID string) NamespacesClient { + return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient +// client. +func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { + return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability check the give Namespace name availability. +// +// parameters is parameters to check availability of the given Namespace name +func (client NamespacesClient) CheckNameAvailability(parameters CheckNameAvailabilityParameter) (result CheckNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client NamespacesClient) CheckNameAvailabilityPreparer(parameters CheckNameAvailabilityParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a namespace. Once created, this +// namespace's resource manifest is immutable. This operation is idempotent. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name parameters is parameters +// for creating a namespace resource. +func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (<-chan NamespaceResource, <-chan error) { + resultChan := make(chan NamespaceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result NamespaceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates or updates an AuthorizationRule for +// a Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name authorizationRuleName is +// the authorization rule name. parameters is the shared access +// AuthorizationRule. +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing namespace. This operation also removes all +// associated resources under the namespace. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name +func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes an AuthorizationRule for a Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name authorizationRuleName is +// the authorization rule name. +func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the description of the specified namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name +func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an AuthorizationRule for a Namespace by rule name. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name authorizationRuleName is +// the authorization rule name. +func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules gets a list of authorization rules for a Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name +func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists the available Namespaces within a resource group. +// +// resourceGroupName is name of the resource group within the azure +// subscription. +func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription lists all the available Namespaces within a subscription, +// irrespective of the resource groups. +func (client NamespacesClient) ListBySubscription() (result NamespaceListResult, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListBySubscriptionNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the primary and secondary connection strings for the +// Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name authorizationRuleName is +// the authorization rule name. +func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the primary or secondary connection strings for +// the specified Namespace. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name authorizationRuleName is +// the authorization rule name. parameters is parameters required to regenerate +// the connection string. +func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update creates or updates a namespace. Once created, this namespace's +// resource manifest is immutable. This operation is idempotent. +// +// resourceGroupName is name of the resource group within the azure +// subscription. namespaceName is the Namespace name parameters is parameters +// for updating a namespace resource. +func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (result NamespaceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "eventhub.NamespacesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.NamespacesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NamespacesClient) UpdateResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/operations.go index 69e85febdf..c86a016198 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/operations.go @@ -1,122 +1,122 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the azure Event Hubs client -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Event Hub REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.EventHub/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the azure Event Hubs client +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Event Hub REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.EventHub/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhub.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go index 1cca218141..58298d4ebf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/eventhub/version.go @@ -1,29 +1,29 @@ -package eventhub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-eventhub/2015-08-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package eventhub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-eventhub/2015-08-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/check/check.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/check/check.go index 918146f46b..91c84513b8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/check/check.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/check/check.go @@ -1,86 +1,86 @@ -package main - -import ( - "fmt" - "log" - "net/http" - "os" - - "github.com/Azure/azure-sdk-for-go/arm/examples/helpers" - "github.com/Azure/azure-sdk-for-go/arm/storage" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" -) - -func withInspection() autorest.PrepareDecorator { - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - fmt.Printf("Inspecting Request: %s %s\n", r.Method, r.URL) - return p.Prepare(r) - }) - } -} - -func byInspecting() autorest.RespondDecorator { - return func(r autorest.Responder) autorest.Responder { - return autorest.ResponderFunc(func(resp *http.Response) error { - fmt.Printf("Inspecting Response: %s for %s %s\n", resp.Status, resp.Request.Method, resp.Request.URL) - return r.Respond(resp) - }) - } -} - -func main() { - name := "testname01" - - c := map[string]string{ - "AZURE_CLIENT_ID": os.Getenv("AZURE_CLIENT_ID"), - "AZURE_CLIENT_SECRET": os.Getenv("AZURE_CLIENT_SECRET"), - "AZURE_SUBSCRIPTION_ID": os.Getenv("AZURE_SUBSCRIPTION_ID"), - "AZURE_TENANT_ID": os.Getenv("AZURE_TENANT_ID")} - if err := checkEnvVar(&c); err != nil { - log.Fatalf("Error: %v", err) - return - } - spt, err := helpers.NewServicePrincipalTokenFromCredentials(c, azure.PublicCloud.ResourceManagerEndpoint) - if err != nil { - log.Fatalf("Error: %v", err) - return - } - ac := storage.NewAccountsClient(c["AZURE_SUBSCRIPTION_ID"]) - ac.Authorizer = spt - - ac.Sender = autorest.CreateSender( - autorest.WithLogging(log.New(os.Stdout, "sdk-example: ", log.LstdFlags))) - - ac.RequestInspector = withInspection() - ac.ResponseInspector = byInspecting() - cna, err := ac.CheckNameAvailability( - storage.AccountCheckNameAvailabilityParameters{ - Name: to.StringPtr(name), - Type: to.StringPtr("Microsoft.Storage/storageAccounts")}) - - if err != nil { - log.Fatalf("Error: %v", err) - return - } - if to.Bool(cna.NameAvailable) { - fmt.Printf("The storage account name '%s' is available\n", name) - } else { - fmt.Printf("The storage account name '%s' is unavailable because %s\n", name, to.String(cna.Message)) - } -} - -func checkEnvVar(envVars *map[string]string) error { - var missingVars []string - for varName, value := range *envVars { - if value == "" { - missingVars = append(missingVars, varName) - } - } - if len(missingVars) > 0 { - return fmt.Errorf("Missing environment variables %v", missingVars) - } - return nil -} +package main + +import ( + "fmt" + "log" + "net/http" + "os" + + "github.com/Azure/azure-sdk-for-go/arm/examples/helpers" + "github.com/Azure/azure-sdk-for-go/arm/storage" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" +) + +func withInspection() autorest.PrepareDecorator { + return func(p autorest.Preparer) autorest.Preparer { + return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { + fmt.Printf("Inspecting Request: %s %s\n", r.Method, r.URL) + return p.Prepare(r) + }) + } +} + +func byInspecting() autorest.RespondDecorator { + return func(r autorest.Responder) autorest.Responder { + return autorest.ResponderFunc(func(resp *http.Response) error { + fmt.Printf("Inspecting Response: %s for %s %s\n", resp.Status, resp.Request.Method, resp.Request.URL) + return r.Respond(resp) + }) + } +} + +func main() { + name := "testname01" + + c := map[string]string{ + "AZURE_CLIENT_ID": os.Getenv("AZURE_CLIENT_ID"), + "AZURE_CLIENT_SECRET": os.Getenv("AZURE_CLIENT_SECRET"), + "AZURE_SUBSCRIPTION_ID": os.Getenv("AZURE_SUBSCRIPTION_ID"), + "AZURE_TENANT_ID": os.Getenv("AZURE_TENANT_ID")} + if err := checkEnvVar(&c); err != nil { + log.Fatalf("Error: %v", err) + return + } + spt, err := helpers.NewServicePrincipalTokenFromCredentials(c, azure.PublicCloud.ResourceManagerEndpoint) + if err != nil { + log.Fatalf("Error: %v", err) + return + } + ac := storage.NewAccountsClient(c["AZURE_SUBSCRIPTION_ID"]) + ac.Authorizer = spt + + ac.Sender = autorest.CreateSender( + autorest.WithLogging(log.New(os.Stdout, "sdk-example: ", log.LstdFlags))) + + ac.RequestInspector = withInspection() + ac.ResponseInspector = byInspecting() + cna, err := ac.CheckNameAvailability( + storage.AccountCheckNameAvailabilityParameters{ + Name: to.StringPtr(name), + Type: to.StringPtr("Microsoft.Storage/storageAccounts")}) + + if err != nil { + log.Fatalf("Error: %v", err) + return + } + if to.Bool(cna.NameAvailable) { + fmt.Printf("The storage account name '%s' is available\n", name) + } else { + fmt.Printf("The storage account name '%s' is unavailable because %s\n", name, to.String(cna.Message)) + } +} + +func checkEnvVar(envVars *map[string]string) error { + var missingVars []string + for varName, value := range *envVars { + if value == "" { + missingVars = append(missingVars, varName) + } + } + if len(missingVars) > 0 { + return fmt.Errorf("Missing environment variables %v", missingVars) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/create/create.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/create/create.go index b6b73679b1..0cf3cf8723 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/create/create.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/create/create.go @@ -1,81 +1,81 @@ -package main - -import ( - "fmt" - "log" - "os" - - "github.com/Azure/azure-sdk-for-go/arm/examples/helpers" - "github.com/Azure/azure-sdk-for-go/arm/storage" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" -) - -func main() { - resourceGroup := "resourceGroupName" - name := "gosdktestname01" - - c := map[string]string{ - "AZURE_CLIENT_ID": os.Getenv("AZURE_CLIENT_ID"), - "AZURE_CLIENT_SECRET": os.Getenv("AZURE_CLIENT_SECRET"), - "AZURE_SUBSCRIPTION_ID": os.Getenv("AZURE_SUBSCRIPTION_ID"), - "AZURE_TENANT_ID": os.Getenv("AZURE_TENANT_ID")} - if err := checkEnvVar(&c); err != nil { - log.Fatalf("Error: %v", err) - return - } - spt, err := helpers.NewServicePrincipalTokenFromCredentials(c, azure.PublicCloud.ResourceManagerEndpoint) - if err != nil { - log.Fatalf("Error: %v", err) - return - } - - ac := storage.NewAccountsClient(c["AZURE_SUBSCRIPTION_ID"]) - ac.Authorizer = spt - - cna, err := ac.CheckNameAvailability( - storage.AccountCheckNameAvailabilityParameters{ - Name: to.StringPtr(name), - Type: to.StringPtr("Microsoft.Storage/storageAccounts")}) - if err != nil { - log.Fatalf("Error: %v", err) - return - } - if !to.Bool(cna.NameAvailable) { - fmt.Printf("%s is unavailable -- try with another name\n", name) - return - } - fmt.Printf("%s is available\n\n", name) - - cp := storage.AccountCreateParameters{ - Sku: &storage.Sku{ - Name: storage.StandardLRS, - Tier: storage.Standard}, - Location: to.StringPtr("westus")} - cancel := make(chan struct{}) - if _, err = ac.Create(resourceGroup, name, cp, cancel); err != nil { - fmt.Printf("Create '%s' storage account failed: %v\n", name, err) - return - } - fmt.Printf("Successfully created '%s' storage account in '%s' resource group\n\n", name, resourceGroup) - - r, err := ac.Delete(resourceGroup, name) - if err != nil { - fmt.Printf("Delete of '%s' failed with status %s\n...%v\n", name, r.Status, err) - return - } - fmt.Printf("Deletion of '%s' storage account in '%s' resource group succeeded -- %s\n", name, resourceGroup, r.Status) -} - -func checkEnvVar(envVars *map[string]string) error { - var missingVars []string - for varName, value := range *envVars { - if value == "" { - missingVars = append(missingVars, varName) - } - } - if len(missingVars) > 0 { - return fmt.Errorf("Missing environment variables %v", missingVars) - } - return nil -} +package main + +import ( + "fmt" + "log" + "os" + + "github.com/Azure/azure-sdk-for-go/arm/examples/helpers" + "github.com/Azure/azure-sdk-for-go/arm/storage" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" +) + +func main() { + resourceGroup := "resourceGroupName" + name := "gosdktestname01" + + c := map[string]string{ + "AZURE_CLIENT_ID": os.Getenv("AZURE_CLIENT_ID"), + "AZURE_CLIENT_SECRET": os.Getenv("AZURE_CLIENT_SECRET"), + "AZURE_SUBSCRIPTION_ID": os.Getenv("AZURE_SUBSCRIPTION_ID"), + "AZURE_TENANT_ID": os.Getenv("AZURE_TENANT_ID")} + if err := checkEnvVar(&c); err != nil { + log.Fatalf("Error: %v", err) + return + } + spt, err := helpers.NewServicePrincipalTokenFromCredentials(c, azure.PublicCloud.ResourceManagerEndpoint) + if err != nil { + log.Fatalf("Error: %v", err) + return + } + + ac := storage.NewAccountsClient(c["AZURE_SUBSCRIPTION_ID"]) + ac.Authorizer = spt + + cna, err := ac.CheckNameAvailability( + storage.AccountCheckNameAvailabilityParameters{ + Name: to.StringPtr(name), + Type: to.StringPtr("Microsoft.Storage/storageAccounts")}) + if err != nil { + log.Fatalf("Error: %v", err) + return + } + if !to.Bool(cna.NameAvailable) { + fmt.Printf("%s is unavailable -- try with another name\n", name) + return + } + fmt.Printf("%s is available\n\n", name) + + cp := storage.AccountCreateParameters{ + Sku: &storage.Sku{ + Name: storage.StandardLRS, + Tier: storage.Standard}, + Location: to.StringPtr("westus")} + cancel := make(chan struct{}) + if _, err = ac.Create(resourceGroup, name, cp, cancel); err != nil { + fmt.Printf("Create '%s' storage account failed: %v\n", name, err) + return + } + fmt.Printf("Successfully created '%s' storage account in '%s' resource group\n\n", name, resourceGroup) + + r, err := ac.Delete(resourceGroup, name) + if err != nil { + fmt.Printf("Delete of '%s' failed with status %s\n...%v\n", name, r.Status, err) + return + } + fmt.Printf("Deletion of '%s' storage account in '%s' resource group succeeded -- %s\n", name, resourceGroup, r.Status) +} + +func checkEnvVar(envVars *map[string]string) error { + var missingVars []string + for varName, value := range *envVars { + if value == "" { + missingVars = append(missingVars, varName) + } + } + if len(missingVars) > 0 { + return fmt.Errorf("Missing environment variables %v", missingVars) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/helpers/helpers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/helpers/helpers.go index b85cf09079..24c76dcfa3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/helpers/helpers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/examples/helpers/helpers.go @@ -1,49 +1,49 @@ -package helpers - -import ( - "encoding/json" - "fmt" - - "github.com/Azure/go-autorest/autorest/azure" -) - -const ( - credentialsPath = "/.azure/credentials.json" -) - -// ToJSON returns the passed item as a pretty-printed JSON string. If any JSON error occurs, -// it returns the empty string. -func ToJSON(v interface{}) (string, error) { - j, err := json.MarshalIndent(v, "", " ") - return string(j), err -} - -// NewServicePrincipalTokenFromCredentials creates a new ServicePrincipalToken using values of the -// passed credentials map. -func NewServicePrincipalTokenFromCredentials(c map[string]string, scope string) (*azure.ServicePrincipalToken, error) { - oauthConfig, err := azure.PublicCloud.OAuthConfigForTenant(c["AZURE_TENANT_ID"]) - if err != nil { - panic(err) - } - return azure.NewServicePrincipalToken(*oauthConfig, c["AZURE_CLIENT_ID"], c["AZURE_CLIENT_SECRET"], scope) -} - -func ensureValueStrings(mapOfInterface map[string]interface{}) map[string]string { - mapOfStrings := make(map[string]string) - for key, value := range mapOfInterface { - mapOfStrings[key] = ensureValueString(value) - } - return mapOfStrings -} - -func ensureValueString(value interface{}) string { - if value == nil { - return "" - } - switch v := value.(type) { - case string: - return v - default: - return fmt.Sprintf("%v", v) - } -} +package helpers + +import ( + "encoding/json" + "fmt" + + "github.com/Azure/go-autorest/autorest/azure" +) + +const ( + credentialsPath = "/.azure/credentials.json" +) + +// ToJSON returns the passed item as a pretty-printed JSON string. If any JSON error occurs, +// it returns the empty string. +func ToJSON(v interface{}) (string, error) { + j, err := json.MarshalIndent(v, "", " ") + return string(j), err +} + +// NewServicePrincipalTokenFromCredentials creates a new ServicePrincipalToken using values of the +// passed credentials map. +func NewServicePrincipalTokenFromCredentials(c map[string]string, scope string) (*azure.ServicePrincipalToken, error) { + oauthConfig, err := azure.PublicCloud.OAuthConfigForTenant(c["AZURE_TENANT_ID"]) + if err != nil { + panic(err) + } + return azure.NewServicePrincipalToken(*oauthConfig, c["AZURE_CLIENT_ID"], c["AZURE_CLIENT_SECRET"], scope) +} + +func ensureValueStrings(mapOfInterface map[string]interface{}) map[string]string { + mapOfStrings := make(map[string]string) + for key, value := range mapOfInterface { + mapOfStrings[key] = ensureValueString(value) + } + return mapOfStrings +} + +func ensureValueString(value interface{}) string { + if value == nil { + return "" + } + switch v := value.(type) { + case string: + return v + default: + return fmt.Sprintf("%v", v) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/applications.go index 953613d6a6..cb0fad4d58 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/applications.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/applications.go @@ -1,702 +1,702 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ApplicationsClient is the composite Swagger specification for Azure Active -// Directory Graph RBAC management client. -type ApplicationsClient struct { - ManagementClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(tenantID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the -// ApplicationsClient client. -func NewApplicationsClientWithBaseURI(baseURI string, tenantID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Create create a new application. -// -// parameters is the parameters for creating an application. -func (client ApplicationsClient) Create(parameters ApplicationCreateParameters) (result Application, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AvailableToOtherTenants", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.IdentifierUris", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.ApplicationsClient", "Create") - } - - req, err := client.CreatePreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationsClient) CreatePreparer(parameters ApplicationCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an application. -// -// applicationObjectID is application object ID. -func (client ApplicationsClient) Delete(applicationObjectID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an application by object ID. -// -// applicationObjectID is application object ID. -func (client ApplicationsClient) Get(applicationObjectID string) (result Application, err error) { - req, err := client.GetPreparer(applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists applications by filter parameters. -// -// filter is the filters to apply to the operation. -func (client ApplicationsClient) List(filter string) (result ApplicationListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeyCredentials get the keyCredentials associated with an application. -// -// applicationObjectID is application object ID. -func (client ApplicationsClient) ListKeyCredentials(applicationObjectID string) (result KeyCredentialListResult, err error) { - req, err := client.ListKeyCredentialsPreparer(applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeyCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure responding to request") - } - - return -} - -// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. -func (client ApplicationsClient) ListKeyCredentialsPreparer(applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNext gets a list of applications from the current tenant. -// -// nextLink is next link for the list operation. -func (client ApplicationsClient) ListNext(nextLink string) (result ApplicationListResult, err error) { - req, err := client.ListNextPreparer(nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure responding to request") - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client ApplicationsClient) ListNextPreparer(nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPasswordCredentials get the passwordCredentials associated with an -// application. -// -// applicationObjectID is application object ID. -func (client ApplicationsClient) ListPasswordCredentials(applicationObjectID string) (result PasswordCredentialListResult, err error) { - req, err := client.ListPasswordCredentialsPreparer(applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListPasswordCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListPasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure responding to request") - } - - return -} - -// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. -func (client ApplicationsClient) ListPasswordCredentialsPreparer(applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch update an existing application. -// -// applicationObjectID is application object ID. parameters is parameters to -// update an existing application. -func (client ApplicationsClient) Patch(applicationObjectID string, parameters ApplicationUpdateParameters) (result autorest.Response, err error) { - req, err := client.PatchPreparer(applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure responding to request") - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client ApplicationsClient) PatchPreparer(applicationObjectID string, parameters ApplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateKeyCredentials update the keyCredentials associated with an -// application. -// -// applicationObjectID is application object ID. parameters is parameters to -// update the keyCredentials of an existing application. -func (client ApplicationsClient) UpdateKeyCredentials(applicationObjectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { - req, err := client.UpdateKeyCredentialsPreparer(applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateKeyCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdateKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure responding to request") - } - - return -} - -// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. -func (client ApplicationsClient) UpdateKeyCredentialsPreparer(applicationObjectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdatePasswordCredentials update passwordCredentials associated with an -// application. -// -// applicationObjectID is application object ID. parameters is parameters to -// update passwordCredentials of an existing application. -func (client ApplicationsClient) UpdatePasswordCredentials(applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { - req, err := client.UpdatePasswordCredentialsPreparer(applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdatePasswordCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdatePasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") - } - - return -} - -// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. -func (client ApplicationsClient) UpdatePasswordCredentialsPreparer(applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": applicationObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ApplicationsClient is the composite Swagger specification for Azure Active +// Directory Graph RBAC management client. +type ApplicationsClient struct { + ManagementClient +} + +// NewApplicationsClient creates an instance of the ApplicationsClient client. +func NewApplicationsClient(tenantID string) ApplicationsClient { + return NewApplicationsClientWithBaseURI(DefaultBaseURI, tenantID) +} + +// NewApplicationsClientWithBaseURI creates an instance of the +// ApplicationsClient client. +func NewApplicationsClientWithBaseURI(baseURI string, tenantID string) ApplicationsClient { + return ApplicationsClient{NewWithBaseURI(baseURI, tenantID)} +} + +// Create create a new application. +// +// parameters is the parameters for creating an application. +func (client ApplicationsClient) Create(parameters ApplicationCreateParameters) (result Application, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AvailableToOtherTenants", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.IdentifierUris", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.ApplicationsClient", "Create") + } + + req, err := client.CreatePreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationsClient) CreatePreparer(parameters ApplicationCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an application. +// +// applicationObjectID is application object ID. +func (client ApplicationsClient) Delete(applicationObjectID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(applicationObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationsClient) DeletePreparer(applicationObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an application by object ID. +// +// applicationObjectID is application object ID. +func (client ApplicationsClient) Get(applicationObjectID string) (result Application, err error) { + req, err := client.GetPreparer(applicationObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationsClient) GetPreparer(applicationObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists applications by filter parameters. +// +// filter is the filters to apply to the operation. +func (client ApplicationsClient) List(filter string) (result ApplicationListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeyCredentials get the keyCredentials associated with an application. +// +// applicationObjectID is application object ID. +func (client ApplicationsClient) ListKeyCredentials(applicationObjectID string) (result KeyCredentialListResult, err error) { + req, err := client.ListKeyCredentialsPreparer(applicationObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeyCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListKeyCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure responding to request") + } + + return +} + +// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. +func (client ApplicationsClient) ListKeyCredentialsPreparer(applicationObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNext gets a list of applications from the current tenant. +// +// nextLink is next link for the list operation. +func (client ApplicationsClient) ListNext(nextLink string) (result ApplicationListResult, err error) { + req, err := client.ListNextPreparer(nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", nil, "Failure preparing request") + return + } + + resp, err := client.ListNextSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure sending request") + return + } + + result, err = client.ListNextResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure responding to request") + } + + return +} + +// ListNextPreparer prepares the ListNext request. +func (client ApplicationsClient) ListNextPreparer(nextLink string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nextLink": nextLink, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNextSender sends the ListNext request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) ListNextSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNextResponder handles the response to the ListNext request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPasswordCredentials get the passwordCredentials associated with an +// application. +// +// applicationObjectID is application object ID. +func (client ApplicationsClient) ListPasswordCredentials(applicationObjectID string) (result PasswordCredentialListResult, err error) { + req, err := client.ListPasswordCredentialsPreparer(applicationObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListPasswordCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListPasswordCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure responding to request") + } + + return +} + +// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. +func (client ApplicationsClient) ListPasswordCredentialsPreparer(applicationObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Patch update an existing application. +// +// applicationObjectID is application object ID. parameters is parameters to +// update an existing application. +func (client ApplicationsClient) Patch(applicationObjectID string, parameters ApplicationUpdateParameters) (result autorest.Response, err error) { + req, err := client.PatchPreparer(applicationObjectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client ApplicationsClient) PatchPreparer(applicationObjectID string, parameters ApplicationUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateKeyCredentials update the keyCredentials associated with an +// application. +// +// applicationObjectID is application object ID. parameters is parameters to +// update the keyCredentials of an existing application. +func (client ApplicationsClient) UpdateKeyCredentials(applicationObjectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { + req, err := client.UpdateKeyCredentialsPreparer(applicationObjectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateKeyCredentialsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure sending request") + return + } + + result, err = client.UpdateKeyCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure responding to request") + } + + return +} + +// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. +func (client ApplicationsClient) UpdateKeyCredentialsPreparer(applicationObjectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdatePasswordCredentials update passwordCredentials associated with an +// application. +// +// applicationObjectID is application object ID. parameters is parameters to +// update passwordCredentials of an existing application. +func (client ApplicationsClient) UpdatePasswordCredentials(applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { + req, err := client.UpdatePasswordCredentialsPreparer(applicationObjectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePasswordCredentialsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure sending request") + return + } + + result, err = client.UpdatePasswordCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") + } + + return +} + +// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. +func (client ApplicationsClient) UpdatePasswordCredentialsPreparer(applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationObjectId": applicationObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/client.go index b23c2b97e5..282c2af0db 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/client.go @@ -1,53 +1,53 @@ -// Package graphrbac implements the Azure ARM Graphrbac service API version . -// -// Composite Swagger specification for Azure Active Directory Graph RBAC -// management client. -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Graphrbac - DefaultBaseURI = "https://graph.windows.net" -) - -// ManagementClient is the base client for Graphrbac. -type ManagementClient struct { - autorest.Client - BaseURI string - TenantID string -} - -// New creates an instance of the ManagementClient client. -func New(tenantID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, tenantID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - TenantID: tenantID, - } -} +// Package graphrbac implements the Azure ARM Graphrbac service API version . +// +// Composite Swagger specification for Azure Active Directory Graph RBAC +// management client. +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Graphrbac + DefaultBaseURI = "https://graph.windows.net" +) + +// ManagementClient is the base client for Graphrbac. +type ManagementClient struct { + autorest.Client + BaseURI string + TenantID string +} + +// New creates an instance of the ManagementClient client. +func New(tenantID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, tenantID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, tenantID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + TenantID: tenantID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/groups.go index 3cc95732bb..6c26e0805f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/groups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/groups.go @@ -1,786 +1,786 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupsClient is the composite Swagger specification for Azure Active -// Directory Graph RBAC management client. -type GroupsClient struct { - ManagementClient -} - -// NewGroupsClient creates an instance of the GroupsClient client. -func NewGroupsClient(tenantID string) GroupsClient { - return NewGroupsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client. -func NewGroupsClientWithBaseURI(baseURI string, tenantID string) GroupsClient { - return GroupsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// AddMember add a member to a group. -// -// groupObjectID is the object ID of the group to which to add the member. -// parameters is the URL of the member object, such as -// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. -func (client GroupsClient) AddMember(groupObjectID string, parameters GroupAddMemberParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "AddMember") - } - - req, err := client.AddMemberPreparer(groupObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", nil, "Failure preparing request") - return - } - - resp, err := client.AddMemberSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure sending request") - return - } - - result, err = client.AddMemberResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure responding to request") - } - - return -} - -// AddMemberPreparer prepares the AddMember request. -func (client GroupsClient) AddMemberPreparer(groupObjectID string, parameters GroupAddMemberParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupObjectId": groupObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddMemberSender sends the AddMember request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) AddMemberSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddMemberResponder handles the response to the AddMember request. The method always -// closes the http.Response Body. -func (client GroupsClient) AddMemberResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create create a group in the directory. -// -// parameters is the parameters for the group to create. -func (client GroupsClient) Create(parameters GroupCreateParameters) (result ADGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MailEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SecurityEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "Create") - } - - req, err := client.CreatePreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupsClient) CreatePreparer(parameters GroupCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupsClient) CreateResponder(resp *http.Response) (result ADGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a group from the directory. -// -// groupObjectID is the object ID of the group to delete. -func (client GroupsClient) Delete(groupObjectID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(groupObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(groupObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupObjectId": groupObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets group information from the directory. -// -// objectID is the object ID of the user for which to get group information. -func (client GroupsClient) Get(objectID string) (result ADGroup, err error) { - req, err := client.GetPreparer(objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupsClient) GetPreparer(objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetResponder(resp *http.Response) (result ADGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGroupMembers gets the members of a group. -// -// objectID is the object ID of the group whose members should be retrieved. -func (client GroupsClient) GetGroupMembers(objectID string) (result GetObjectsResult, err error) { - req, err := client.GetGroupMembersPreparer(objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", nil, "Failure preparing request") - return - } - - resp, err := client.GetGroupMembersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure sending request") - return - } - - result, err = client.GetGroupMembersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure responding to request") - } - - return -} - -// GetGroupMembersPreparer prepares the GetGroupMembers request. -func (client GroupsClient) GetGroupMembersPreparer(objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/members", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetGroupMembersSender sends the GetGroupMembers request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetGroupMembersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetGroupMembersResponder handles the response to the GetGroupMembers request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetGroupMembersResponder(resp *http.Response) (result GetObjectsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGroupMembersNext gets the members of a group. -// -// nextLink is next link for the list operation. -func (client GroupsClient) GetGroupMembersNext(nextLink string) (result GetObjectsResult, err error) { - req, err := client.GetGroupMembersNextPreparer(nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", nil, "Failure preparing request") - return - } - - resp, err := client.GetGroupMembersNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure sending request") - return - } - - result, err = client.GetGroupMembersNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure responding to request") - } - - return -} - -// GetGroupMembersNextPreparer prepares the GetGroupMembersNext request. -func (client GroupsClient) GetGroupMembersNextPreparer(nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetGroupMembersNextSender sends the GetGroupMembersNext request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetGroupMembersNextSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetGroupMembersNextResponder handles the response to the GetGroupMembersNext request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetGroupMembersNextResponder(resp *http.Response) (result GetObjectsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMemberGroups gets a collection of object IDs of groups of which the -// specified group is a member. -// -// objectID is the object ID of the group for which to get group membership. -// parameters is group filtering parameters. -func (client GroupsClient) GetMemberGroups(objectID string, parameters GroupGetMemberGroupsParameters) (result GroupGetMemberGroupsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "GetMemberGroups") - } - - req, err := client.GetMemberGroupsPreparer(objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", nil, "Failure preparing request") - return - } - - resp, err := client.GetMemberGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure sending request") - return - } - - result, err = client.GetMemberGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure responding to request") - } - - return -} - -// GetMemberGroupsPreparer prepares the GetMemberGroups request. -func (client GroupsClient) GetMemberGroupsPreparer(objectID string, parameters GroupGetMemberGroupsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/getMemberGroups", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetMemberGroupsResponder(resp *http.Response) (result GroupGetMemberGroupsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsMemberOf checks whether the specified user, group, contact, or service -// principal is a direct or transitive member of the specified group. -// -// parameters is the check group membership parameters. -func (client GroupsClient) IsMemberOf(parameters CheckGroupMembershipParameters) (result CheckGroupMembershipResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GroupID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MemberID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "IsMemberOf") - } - - req, err := client.IsMemberOfPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", nil, "Failure preparing request") - return - } - - resp, err := client.IsMemberOfSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure sending request") - return - } - - result, err = client.IsMemberOfResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure responding to request") - } - - return -} - -// IsMemberOfPreparer prepares the IsMemberOf request. -func (client GroupsClient) IsMemberOfPreparer(parameters CheckGroupMembershipParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/isMemberOf", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsMemberOfSender sends the IsMemberOf request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) IsMemberOfSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsMemberOfResponder handles the response to the IsMemberOf request. The method always -// closes the http.Response Body. -func (client GroupsClient) IsMemberOfResponder(resp *http.Response) (result CheckGroupMembershipResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets list of groups for the current tenant. -// -// filter is the filter to apply to the operation. -func (client GroupsClient) List(filter string) (result GroupListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupsClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNext gets a list of groups for the current tenant. -// -// nextLink is next link for the list operation. -func (client GroupsClient) ListNext(nextLink string) (result GroupListResult, err error) { - req, err := client.ListNextPreparer(nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure responding to request") - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client GroupsClient) ListNextPreparer(nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListNextResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RemoveMember remove a member from a group. -// -// groupObjectID is the object ID of the group from which to remove the member. -// memberObjectID is member object id -func (client GroupsClient) RemoveMember(groupObjectID string, memberObjectID string) (result autorest.Response, err error) { - req, err := client.RemoveMemberPreparer(groupObjectID, memberObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveMemberSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure sending request") - return - } - - result, err = client.RemoveMemberResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure responding to request") - } - - return -} - -// RemoveMemberPreparer prepares the RemoveMember request. -func (client GroupsClient) RemoveMemberPreparer(groupObjectID string, memberObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupObjectId": groupObjectID, - "memberObjectId": memberObjectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RemoveMemberSender sends the RemoveMember request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) RemoveMemberSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RemoveMemberResponder handles the response to the RemoveMember request. The method always -// closes the http.Response Body. -func (client GroupsClient) RemoveMemberResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupsClient is the composite Swagger specification for Azure Active +// Directory Graph RBAC management client. +type GroupsClient struct { + ManagementClient +} + +// NewGroupsClient creates an instance of the GroupsClient client. +func NewGroupsClient(tenantID string) GroupsClient { + return NewGroupsClientWithBaseURI(DefaultBaseURI, tenantID) +} + +// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client. +func NewGroupsClientWithBaseURI(baseURI string, tenantID string) GroupsClient { + return GroupsClient{NewWithBaseURI(baseURI, tenantID)} +} + +// AddMember add a member to a group. +// +// groupObjectID is the object ID of the group to which to add the member. +// parameters is the URL of the member object, such as +// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. +func (client GroupsClient) AddMember(groupObjectID string, parameters GroupAddMemberParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "AddMember") + } + + req, err := client.AddMemberPreparer(groupObjectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", nil, "Failure preparing request") + return + } + + resp, err := client.AddMemberSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure sending request") + return + } + + result, err = client.AddMemberResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure responding to request") + } + + return +} + +// AddMemberPreparer prepares the AddMember request. +func (client GroupsClient) AddMemberPreparer(groupObjectID string, parameters GroupAddMemberParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupObjectId": groupObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddMemberSender sends the AddMember request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) AddMemberSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddMemberResponder handles the response to the AddMember request. The method always +// closes the http.Response Body. +func (client GroupsClient) AddMemberResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create create a group in the directory. +// +// parameters is the parameters for the group to create. +func (client GroupsClient) Create(parameters GroupCreateParameters) (result ADGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MailEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.SecurityEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "Create") + } + + req, err := client.CreatePreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client GroupsClient) CreatePreparer(parameters GroupCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GroupsClient) CreateResponder(resp *http.Response) (result ADGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a group from the directory. +// +// groupObjectID is the object ID of the group to delete. +func (client GroupsClient) Delete(groupObjectID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(groupObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GroupsClient) DeletePreparer(groupObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupObjectId": groupObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets group information from the directory. +// +// objectID is the object ID of the user for which to get group information. +func (client GroupsClient) Get(objectID string) (result ADGroup, err error) { + req, err := client.GetPreparer(objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupsClient) GetPreparer(objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups/{objectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetResponder(resp *http.Response) (result ADGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetGroupMembers gets the members of a group. +// +// objectID is the object ID of the group whose members should be retrieved. +func (client GroupsClient) GetGroupMembers(objectID string) (result GetObjectsResult, err error) { + req, err := client.GetGroupMembersPreparer(objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", nil, "Failure preparing request") + return + } + + resp, err := client.GetGroupMembersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure sending request") + return + } + + result, err = client.GetGroupMembersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure responding to request") + } + + return +} + +// GetGroupMembersPreparer prepares the GetGroupMembers request. +func (client GroupsClient) GetGroupMembersPreparer(objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups/{objectId}/members", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetGroupMembersSender sends the GetGroupMembers request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetGroupMembersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetGroupMembersResponder handles the response to the GetGroupMembers request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetGroupMembersResponder(resp *http.Response) (result GetObjectsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetGroupMembersNext gets the members of a group. +// +// nextLink is next link for the list operation. +func (client GroupsClient) GetGroupMembersNext(nextLink string) (result GetObjectsResult, err error) { + req, err := client.GetGroupMembersNextPreparer(nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", nil, "Failure preparing request") + return + } + + resp, err := client.GetGroupMembersNextSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure sending request") + return + } + + result, err = client.GetGroupMembersNextResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure responding to request") + } + + return +} + +// GetGroupMembersNextPreparer prepares the GetGroupMembersNext request. +func (client GroupsClient) GetGroupMembersNextPreparer(nextLink string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nextLink": nextLink, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetGroupMembersNextSender sends the GetGroupMembersNext request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetGroupMembersNextSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetGroupMembersNextResponder handles the response to the GetGroupMembersNext request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetGroupMembersNextResponder(resp *http.Response) (result GetObjectsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMemberGroups gets a collection of object IDs of groups of which the +// specified group is a member. +// +// objectID is the object ID of the group for which to get group membership. +// parameters is group filtering parameters. +func (client GroupsClient) GetMemberGroups(objectID string, parameters GroupGetMemberGroupsParameters) (result GroupGetMemberGroupsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "GetMemberGroups") + } + + req, err := client.GetMemberGroupsPreparer(objectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", nil, "Failure preparing request") + return + } + + resp, err := client.GetMemberGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure sending request") + return + } + + result, err = client.GetMemberGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure responding to request") + } + + return +} + +// GetMemberGroupsPreparer prepares the GetMemberGroups request. +func (client GroupsClient) GetMemberGroupsPreparer(objectID string, parameters GroupGetMemberGroupsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups/{objectId}/getMemberGroups", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetMemberGroupsResponder(resp *http.Response) (result GroupGetMemberGroupsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsMemberOf checks whether the specified user, group, contact, or service +// principal is a direct or transitive member of the specified group. +// +// parameters is the check group membership parameters. +func (client GroupsClient) IsMemberOf(parameters CheckGroupMembershipParameters) (result CheckGroupMembershipResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.GroupID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MemberID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "IsMemberOf") + } + + req, err := client.IsMemberOfPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", nil, "Failure preparing request") + return + } + + resp, err := client.IsMemberOfSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure sending request") + return + } + + result, err = client.IsMemberOfResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure responding to request") + } + + return +} + +// IsMemberOfPreparer prepares the IsMemberOf request. +func (client GroupsClient) IsMemberOfPreparer(parameters CheckGroupMembershipParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/isMemberOf", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// IsMemberOfSender sends the IsMemberOf request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) IsMemberOfSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// IsMemberOfResponder handles the response to the IsMemberOf request. The method always +// closes the http.Response Body. +func (client GroupsClient) IsMemberOfResponder(resp *http.Response) (result CheckGroupMembershipResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets list of groups for the current tenant. +// +// filter is the filter to apply to the operation. +func (client GroupsClient) List(filter string) (result GroupListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNext gets a list of groups for the current tenant. +// +// nextLink is next link for the list operation. +func (client GroupsClient) ListNext(nextLink string) (result GroupListResult, err error) { + req, err := client.ListNextPreparer(nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", nil, "Failure preparing request") + return + } + + resp, err := client.ListNextSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure sending request") + return + } + + result, err = client.ListNextResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure responding to request") + } + + return +} + +// ListNextPreparer prepares the ListNext request. +func (client GroupsClient) ListNextPreparer(nextLink string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nextLink": nextLink, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNextSender sends the ListNext request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ListNextSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNextResponder handles the response to the ListNext request. The method always +// closes the http.Response Body. +func (client GroupsClient) ListNextResponder(resp *http.Response) (result GroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RemoveMember remove a member from a group. +// +// groupObjectID is the object ID of the group from which to remove the member. +// memberObjectID is member object id +func (client GroupsClient) RemoveMember(groupObjectID string, memberObjectID string) (result autorest.Response, err error) { + req, err := client.RemoveMemberPreparer(groupObjectID, memberObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveMemberSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure sending request") + return + } + + result, err = client.RemoveMemberResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure responding to request") + } + + return +} + +// RemoveMemberPreparer prepares the RemoveMember request. +func (client GroupsClient) RemoveMemberPreparer(groupObjectID string, memberObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupObjectId": groupObjectID, + "memberObjectId": memberObjectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RemoveMemberSender sends the RemoveMember request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) RemoveMemberSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RemoveMemberResponder handles the response to the RemoveMember request. The method always +// closes the http.Response Body. +func (client GroupsClient) RemoveMemberResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/models.go index 11fea97698..ab8775a723 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/models.go @@ -1,298 +1,298 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// AADObject is the properties of an Active Directory object. -type AADObject struct { - autorest.Response `json:"-"` - ObjectID *string `json:"objectId,omitempty"` - ObjectType *string `json:"objectType,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - Mail *string `json:"mail,omitempty"` - MailEnabled *bool `json:"mailEnabled,omitempty"` - SecurityEnabled *bool `json:"securityEnabled,omitempty"` - SignInName *string `json:"signInName,omitempty"` - ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"` - UserType *string `json:"userType,omitempty"` -} - -// ADGroup is active Directory group information. -type ADGroup struct { - autorest.Response `json:"-"` - ObjectID *string `json:"objectId,omitempty"` - ObjectType *string `json:"objectType,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - SecurityEnabled *bool `json:"securityEnabled,omitempty"` - Mail *string `json:"mail,omitempty"` -} - -// Application is active Directory application information. -type Application struct { - autorest.Response `json:"-"` - ObjectID *string `json:"objectId,omitempty"` - ObjectType *string `json:"objectType,omitempty"` - AppID *string `json:"appId,omitempty"` - AppPermissions *[]string `json:"appPermissions,omitempty"` - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - IdentifierUris *[]string `json:"identifierUris,omitempty"` - ReplyUrls *[]string `json:"replyUrls,omitempty"` - Homepage *string `json:"homepage,omitempty"` -} - -// ApplicationCreateParameters is request parameters for creating a new -// application. -type ApplicationCreateParameters struct { - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Homepage *string `json:"homepage,omitempty"` - IdentifierUris *[]string `json:"identifierUris,omitempty"` - ReplyUrls *[]string `json:"replyUrls,omitempty"` - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` -} - -// ApplicationListResult is application list operation result. -type ApplicationListResult struct { - autorest.Response `json:"-"` - Value *[]Application `json:"value,omitempty"` - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// ApplicationUpdateParameters is request parameters for updating an existing -// application. -type ApplicationUpdateParameters struct { - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Homepage *string `json:"homepage,omitempty"` - IdentifierUris *[]string `json:"identifierUris,omitempty"` - ReplyUrls *[]string `json:"replyUrls,omitempty"` - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` -} - -// CheckGroupMembershipParameters is request parameters for IsMemberOf API -// call. -type CheckGroupMembershipParameters struct { - GroupID *string `json:"groupId,omitempty"` - MemberID *string `json:"memberId,omitempty"` -} - -// CheckGroupMembershipResult is server response for IsMemberOf API call -type CheckGroupMembershipResult struct { - autorest.Response `json:"-"` - Value *bool `json:"value,omitempty"` -} - -// ErrorMessage is active Directory error message. -type ErrorMessage struct { - Message *string `json:"value,omitempty"` -} - -// GetObjectsParameters is request parameters for the GetObjectsByObjectIds -// API. -type GetObjectsParameters struct { - ObjectIds *[]string `json:"objectIds,omitempty"` - Types *[]string `json:"types,omitempty"` - IncludeDirectoryObjectReferences *bool `json:"includeDirectoryObjectReferences,omitempty"` -} - -// GetObjectsResult is the response to an Active Directory object inquiry API -// request. -type GetObjectsResult struct { - autorest.Response `json:"-"` - Value *[]AADObject `json:"value,omitempty"` - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// GraphError is active Directory error information. -type GraphError struct { - *OdataError `json:"odata.error,omitempty"` -} - -// GroupAddMemberParameters is request parameters for adding a member to a -// group. -type GroupAddMemberParameters struct { - URL *string `json:"url,omitempty"` -} - -// GroupCreateParameters is request parameters for creating a new group. -type GroupCreateParameters struct { - DisplayName *string `json:"displayName,omitempty"` - MailEnabled *bool `json:"mailEnabled,omitempty"` - MailNickname *string `json:"mailNickname,omitempty"` - SecurityEnabled *bool `json:"securityEnabled,omitempty"` -} - -// GroupGetMemberGroupsParameters is request parameters for GetMemberGroups API -// call. -type GroupGetMemberGroupsParameters struct { - SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"` -} - -// GroupGetMemberGroupsResult is server response for GetMemberGroups API call. -type GroupGetMemberGroupsResult struct { - autorest.Response `json:"-"` - Value *[]string `json:"value,omitempty"` -} - -// GroupListResult is server response for Get tenant groups API call -type GroupListResult struct { - autorest.Response `json:"-"` - Value *[]ADGroup `json:"value,omitempty"` - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// KeyCredential is active Directory Key Credential information. -type KeyCredential struct { - StartDate *date.Time `json:"startDate,omitempty"` - EndDate *date.Time `json:"endDate,omitempty"` - Value *string `json:"value,omitempty"` - KeyID *string `json:"keyId,omitempty"` - Usage *string `json:"usage,omitempty"` - Type *string `json:"type,omitempty"` -} - -// KeyCredentialListResult is keyCredential list operation result. -type KeyCredentialListResult struct { - autorest.Response `json:"-"` - Value *[]KeyCredential `json:"value,omitempty"` -} - -// KeyCredentialsUpdateParameters is request parameters for a KeyCredentials -// update operation -type KeyCredentialsUpdateParameters struct { - Value *[]KeyCredential `json:"value,omitempty"` -} - -// OdataError is active Directory OData error information. -type OdataError struct { - Code *string `json:"code,omitempty"` - *ErrorMessage `json:"message,omitempty"` -} - -// PasswordCredential is active Directory Password Credential information. -type PasswordCredential struct { - StartDate *date.Time `json:"startDate,omitempty"` - EndDate *date.Time `json:"endDate,omitempty"` - KeyID *string `json:"keyId,omitempty"` - Value *string `json:"value,omitempty"` -} - -// PasswordCredentialListResult is passwordCredential list operation result. -type PasswordCredentialListResult struct { - autorest.Response `json:"-"` - Value *[]PasswordCredential `json:"value,omitempty"` -} - -// PasswordCredentialsUpdateParameters is request parameters for a -// PasswordCredentials update operation. -type PasswordCredentialsUpdateParameters struct { - Value *[]PasswordCredential `json:"value,omitempty"` -} - -// PasswordProfile is the password profile associated with a user. -type PasswordProfile struct { - Password *string `json:"password,omitempty"` - ForceChangePasswordNextLogin *bool `json:"forceChangePasswordNextLogin,omitempty"` -} - -// ServicePrincipal is active Directory service principal information. -type ServicePrincipal struct { - autorest.Response `json:"-"` - ObjectID *string `json:"objectId,omitempty"` - ObjectType *string `json:"objectType,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - AppID *string `json:"appId,omitempty"` - ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"` -} - -// ServicePrincipalCreateParameters is request parameters for creating a new -// service principal. -type ServicePrincipalCreateParameters struct { - AppID *string `json:"appId,omitempty"` - AccountEnabled *bool `json:"accountEnabled,omitempty"` - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` -} - -// ServicePrincipalListResult is server response for get tenant service -// principals API call. -type ServicePrincipalListResult struct { - autorest.Response `json:"-"` - Value *[]ServicePrincipal `json:"value,omitempty"` - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// User is active Directory user information. -type User struct { - autorest.Response `json:"-"` - ObjectID *string `json:"objectId,omitempty"` - ObjectType *string `json:"objectType,omitempty"` - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - SignInName *string `json:"signInName,omitempty"` - Mail *string `json:"mail,omitempty"` - MailNickname *string `json:"mailNickname,omitempty"` -} - -// UserCreateParameters is request parameters for creating a new work or school -// account user. -type UserCreateParameters struct { - AccountEnabled *bool `json:"accountEnabled,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"` - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - MailNickname *string `json:"mailNickname,omitempty"` - ImmutableID *string `json:"immutableId,omitempty"` -} - -// UserGetMemberGroupsParameters is request parameters for GetMemberGroups API -// call. -type UserGetMemberGroupsParameters struct { - SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"` -} - -// UserGetMemberGroupsResult is server response for GetMemberGroups API call. -type UserGetMemberGroupsResult struct { - autorest.Response `json:"-"` - Value *[]string `json:"value,omitempty"` -} - -// UserListResult is server response for Get tenant users API call. -type UserListResult struct { - autorest.Response `json:"-"` - Value *[]User `json:"value,omitempty"` - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// UserUpdateParameters is request parameters for updating an existing work or -// school account user. -type UserUpdateParameters struct { - AccountEnabled *bool `json:"accountEnabled,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"` - MailNickname *string `json:"mailNickname,omitempty"` -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// AADObject is the properties of an Active Directory object. +type AADObject struct { + autorest.Response `json:"-"` + ObjectID *string `json:"objectId,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + UserPrincipalName *string `json:"userPrincipalName,omitempty"` + Mail *string `json:"mail,omitempty"` + MailEnabled *bool `json:"mailEnabled,omitempty"` + SecurityEnabled *bool `json:"securityEnabled,omitempty"` + SignInName *string `json:"signInName,omitempty"` + ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"` + UserType *string `json:"userType,omitempty"` +} + +// ADGroup is active Directory group information. +type ADGroup struct { + autorest.Response `json:"-"` + ObjectID *string `json:"objectId,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + SecurityEnabled *bool `json:"securityEnabled,omitempty"` + Mail *string `json:"mail,omitempty"` +} + +// Application is active Directory application information. +type Application struct { + autorest.Response `json:"-"` + ObjectID *string `json:"objectId,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + AppID *string `json:"appId,omitempty"` + AppPermissions *[]string `json:"appPermissions,omitempty"` + AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IdentifierUris *[]string `json:"identifierUris,omitempty"` + ReplyUrls *[]string `json:"replyUrls,omitempty"` + Homepage *string `json:"homepage,omitempty"` +} + +// ApplicationCreateParameters is request parameters for creating a new +// application. +type ApplicationCreateParameters struct { + AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Homepage *string `json:"homepage,omitempty"` + IdentifierUris *[]string `json:"identifierUris,omitempty"` + ReplyUrls *[]string `json:"replyUrls,omitempty"` + KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` + PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` +} + +// ApplicationListResult is application list operation result. +type ApplicationListResult struct { + autorest.Response `json:"-"` + Value *[]Application `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// ApplicationUpdateParameters is request parameters for updating an existing +// application. +type ApplicationUpdateParameters struct { + AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Homepage *string `json:"homepage,omitempty"` + IdentifierUris *[]string `json:"identifierUris,omitempty"` + ReplyUrls *[]string `json:"replyUrls,omitempty"` + KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` + PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` +} + +// CheckGroupMembershipParameters is request parameters for IsMemberOf API +// call. +type CheckGroupMembershipParameters struct { + GroupID *string `json:"groupId,omitempty"` + MemberID *string `json:"memberId,omitempty"` +} + +// CheckGroupMembershipResult is server response for IsMemberOf API call +type CheckGroupMembershipResult struct { + autorest.Response `json:"-"` + Value *bool `json:"value,omitempty"` +} + +// ErrorMessage is active Directory error message. +type ErrorMessage struct { + Message *string `json:"value,omitempty"` +} + +// GetObjectsParameters is request parameters for the GetObjectsByObjectIds +// API. +type GetObjectsParameters struct { + ObjectIds *[]string `json:"objectIds,omitempty"` + Types *[]string `json:"types,omitempty"` + IncludeDirectoryObjectReferences *bool `json:"includeDirectoryObjectReferences,omitempty"` +} + +// GetObjectsResult is the response to an Active Directory object inquiry API +// request. +type GetObjectsResult struct { + autorest.Response `json:"-"` + Value *[]AADObject `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// GraphError is active Directory error information. +type GraphError struct { + *OdataError `json:"odata.error,omitempty"` +} + +// GroupAddMemberParameters is request parameters for adding a member to a +// group. +type GroupAddMemberParameters struct { + URL *string `json:"url,omitempty"` +} + +// GroupCreateParameters is request parameters for creating a new group. +type GroupCreateParameters struct { + DisplayName *string `json:"displayName,omitempty"` + MailEnabled *bool `json:"mailEnabled,omitempty"` + MailNickname *string `json:"mailNickname,omitempty"` + SecurityEnabled *bool `json:"securityEnabled,omitempty"` +} + +// GroupGetMemberGroupsParameters is request parameters for GetMemberGroups API +// call. +type GroupGetMemberGroupsParameters struct { + SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"` +} + +// GroupGetMemberGroupsResult is server response for GetMemberGroups API call. +type GroupGetMemberGroupsResult struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` +} + +// GroupListResult is server response for Get tenant groups API call +type GroupListResult struct { + autorest.Response `json:"-"` + Value *[]ADGroup `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// KeyCredential is active Directory Key Credential information. +type KeyCredential struct { + StartDate *date.Time `json:"startDate,omitempty"` + EndDate *date.Time `json:"endDate,omitempty"` + Value *string `json:"value,omitempty"` + KeyID *string `json:"keyId,omitempty"` + Usage *string `json:"usage,omitempty"` + Type *string `json:"type,omitempty"` +} + +// KeyCredentialListResult is keyCredential list operation result. +type KeyCredentialListResult struct { + autorest.Response `json:"-"` + Value *[]KeyCredential `json:"value,omitempty"` +} + +// KeyCredentialsUpdateParameters is request parameters for a KeyCredentials +// update operation +type KeyCredentialsUpdateParameters struct { + Value *[]KeyCredential `json:"value,omitempty"` +} + +// OdataError is active Directory OData error information. +type OdataError struct { + Code *string `json:"code,omitempty"` + *ErrorMessage `json:"message,omitempty"` +} + +// PasswordCredential is active Directory Password Credential information. +type PasswordCredential struct { + StartDate *date.Time `json:"startDate,omitempty"` + EndDate *date.Time `json:"endDate,omitempty"` + KeyID *string `json:"keyId,omitempty"` + Value *string `json:"value,omitempty"` +} + +// PasswordCredentialListResult is passwordCredential list operation result. +type PasswordCredentialListResult struct { + autorest.Response `json:"-"` + Value *[]PasswordCredential `json:"value,omitempty"` +} + +// PasswordCredentialsUpdateParameters is request parameters for a +// PasswordCredentials update operation. +type PasswordCredentialsUpdateParameters struct { + Value *[]PasswordCredential `json:"value,omitempty"` +} + +// PasswordProfile is the password profile associated with a user. +type PasswordProfile struct { + Password *string `json:"password,omitempty"` + ForceChangePasswordNextLogin *bool `json:"forceChangePasswordNextLogin,omitempty"` +} + +// ServicePrincipal is active Directory service principal information. +type ServicePrincipal struct { + autorest.Response `json:"-"` + ObjectID *string `json:"objectId,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + AppID *string `json:"appId,omitempty"` + ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"` +} + +// ServicePrincipalCreateParameters is request parameters for creating a new +// service principal. +type ServicePrincipalCreateParameters struct { + AppID *string `json:"appId,omitempty"` + AccountEnabled *bool `json:"accountEnabled,omitempty"` + KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` + PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` +} + +// ServicePrincipalListResult is server response for get tenant service +// principals API call. +type ServicePrincipalListResult struct { + autorest.Response `json:"-"` + Value *[]ServicePrincipal `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// User is active Directory user information. +type User struct { + autorest.Response `json:"-"` + ObjectID *string `json:"objectId,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + UserPrincipalName *string `json:"userPrincipalName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + SignInName *string `json:"signInName,omitempty"` + Mail *string `json:"mail,omitempty"` + MailNickname *string `json:"mailNickname,omitempty"` +} + +// UserCreateParameters is request parameters for creating a new work or school +// account user. +type UserCreateParameters struct { + AccountEnabled *bool `json:"accountEnabled,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"` + UserPrincipalName *string `json:"userPrincipalName,omitempty"` + MailNickname *string `json:"mailNickname,omitempty"` + ImmutableID *string `json:"immutableId,omitempty"` +} + +// UserGetMemberGroupsParameters is request parameters for GetMemberGroups API +// call. +type UserGetMemberGroupsParameters struct { + SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"` +} + +// UserGetMemberGroupsResult is server response for GetMemberGroups API call. +type UserGetMemberGroupsResult struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` +} + +// UserListResult is server response for Get tenant users API call. +type UserListResult struct { + autorest.Response `json:"-"` + Value *[]User `json:"value,omitempty"` + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// UserUpdateParameters is request parameters for updating an existing work or +// school account user. +type UserUpdateParameters struct { + AccountEnabled *bool `json:"accountEnabled,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"` + MailNickname *string `json:"mailNickname,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/objects.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/objects.go index 53ccac90fb..b0a7e94dae 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/objects.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/objects.go @@ -1,240 +1,240 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ObjectsClient is the composite Swagger specification for Azure Active -// Directory Graph RBAC management client. -type ObjectsClient struct { - ManagementClient -} - -// NewObjectsClient creates an instance of the ObjectsClient client. -func NewObjectsClient(tenantID string) ObjectsClient { - return NewObjectsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewObjectsClientWithBaseURI creates an instance of the ObjectsClient client. -func NewObjectsClientWithBaseURI(baseURI string, tenantID string) ObjectsClient { - return ObjectsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// GetCurrentUser gets the details for the currently logged-in user. -func (client ObjectsClient) GetCurrentUser() (result AADObject, err error) { - req, err := client.GetCurrentUserPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", nil, "Failure preparing request") - return - } - - resp, err := client.GetCurrentUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", resp, "Failure sending request") - return - } - - result, err = client.GetCurrentUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", resp, "Failure responding to request") - } - - return -} - -// GetCurrentUserPreparer prepares the GetCurrentUser request. -func (client ObjectsClient) GetCurrentUserPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/me", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCurrentUserSender sends the GetCurrentUser request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectsClient) GetCurrentUserSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCurrentUserResponder handles the response to the GetCurrentUser request. The method always -// closes the http.Response Body. -func (client ObjectsClient) GetCurrentUserResponder(resp *http.Response) (result AADObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetObjectsByObjectIds gets AD group membership for the specified AD object -// IDs. -// -// parameters is objects filtering parameters. -func (client ObjectsClient) GetObjectsByObjectIds(parameters GetObjectsParameters) (result GetObjectsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.IncludeDirectoryObjectReferences", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds") - } - - req, err := client.GetObjectsByObjectIdsPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", nil, "Failure preparing request") - return - } - - resp, err := client.GetObjectsByObjectIdsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure sending request") - return - } - - result, err = client.GetObjectsByObjectIdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure responding to request") - } - - return -} - -// GetObjectsByObjectIdsPreparer prepares the GetObjectsByObjectIds request. -func (client ObjectsClient) GetObjectsByObjectIdsPreparer(parameters GetObjectsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/getObjectsByObjectIds", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetObjectsByObjectIdsSender sends the GetObjectsByObjectIds request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectsClient) GetObjectsByObjectIdsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetObjectsByObjectIdsResponder handles the response to the GetObjectsByObjectIds request. The method always -// closes the http.Response Body. -func (client ObjectsClient) GetObjectsByObjectIdsResponder(resp *http.Response) (result GetObjectsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetObjectsByObjectIdsNext gets AD group membership for the specified AD -// object IDs. -// -// nextLink is next link for the list operation. -func (client ObjectsClient) GetObjectsByObjectIdsNext(nextLink string) (result GetObjectsResult, err error) { - req, err := client.GetObjectsByObjectIdsNextPreparer(nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", nil, "Failure preparing request") - return - } - - resp, err := client.GetObjectsByObjectIdsNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure sending request") - return - } - - result, err = client.GetObjectsByObjectIdsNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure responding to request") - } - - return -} - -// GetObjectsByObjectIdsNextPreparer prepares the GetObjectsByObjectIdsNext request. -func (client ObjectsClient) GetObjectsByObjectIdsNextPreparer(nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetObjectsByObjectIdsNextSender sends the GetObjectsByObjectIdsNext request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectsClient) GetObjectsByObjectIdsNextSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetObjectsByObjectIdsNextResponder handles the response to the GetObjectsByObjectIdsNext request. The method always -// closes the http.Response Body. -func (client ObjectsClient) GetObjectsByObjectIdsNextResponder(resp *http.Response) (result GetObjectsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ObjectsClient is the composite Swagger specification for Azure Active +// Directory Graph RBAC management client. +type ObjectsClient struct { + ManagementClient +} + +// NewObjectsClient creates an instance of the ObjectsClient client. +func NewObjectsClient(tenantID string) ObjectsClient { + return NewObjectsClientWithBaseURI(DefaultBaseURI, tenantID) +} + +// NewObjectsClientWithBaseURI creates an instance of the ObjectsClient client. +func NewObjectsClientWithBaseURI(baseURI string, tenantID string) ObjectsClient { + return ObjectsClient{NewWithBaseURI(baseURI, tenantID)} +} + +// GetCurrentUser gets the details for the currently logged-in user. +func (client ObjectsClient) GetCurrentUser() (result AADObject, err error) { + req, err := client.GetCurrentUserPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", nil, "Failure preparing request") + return + } + + resp, err := client.GetCurrentUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", resp, "Failure sending request") + return + } + + result, err = client.GetCurrentUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", resp, "Failure responding to request") + } + + return +} + +// GetCurrentUserPreparer prepares the GetCurrentUser request. +func (client ObjectsClient) GetCurrentUserPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/me", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCurrentUserSender sends the GetCurrentUser request. The method will close the +// http.Response Body if it receives an error. +func (client ObjectsClient) GetCurrentUserSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCurrentUserResponder handles the response to the GetCurrentUser request. The method always +// closes the http.Response Body. +func (client ObjectsClient) GetCurrentUserResponder(resp *http.Response) (result AADObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetObjectsByObjectIds gets AD group membership for the specified AD object +// IDs. +// +// parameters is objects filtering parameters. +func (client ObjectsClient) GetObjectsByObjectIds(parameters GetObjectsParameters) (result GetObjectsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.IncludeDirectoryObjectReferences", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds") + } + + req, err := client.GetObjectsByObjectIdsPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", nil, "Failure preparing request") + return + } + + resp, err := client.GetObjectsByObjectIdsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure sending request") + return + } + + result, err = client.GetObjectsByObjectIdsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure responding to request") + } + + return +} + +// GetObjectsByObjectIdsPreparer prepares the GetObjectsByObjectIds request. +func (client ObjectsClient) GetObjectsByObjectIdsPreparer(parameters GetObjectsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/getObjectsByObjectIds", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetObjectsByObjectIdsSender sends the GetObjectsByObjectIds request. The method will close the +// http.Response Body if it receives an error. +func (client ObjectsClient) GetObjectsByObjectIdsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetObjectsByObjectIdsResponder handles the response to the GetObjectsByObjectIds request. The method always +// closes the http.Response Body. +func (client ObjectsClient) GetObjectsByObjectIdsResponder(resp *http.Response) (result GetObjectsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetObjectsByObjectIdsNext gets AD group membership for the specified AD +// object IDs. +// +// nextLink is next link for the list operation. +func (client ObjectsClient) GetObjectsByObjectIdsNext(nextLink string) (result GetObjectsResult, err error) { + req, err := client.GetObjectsByObjectIdsNextPreparer(nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", nil, "Failure preparing request") + return + } + + resp, err := client.GetObjectsByObjectIdsNextSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure sending request") + return + } + + result, err = client.GetObjectsByObjectIdsNextResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure responding to request") + } + + return +} + +// GetObjectsByObjectIdsNextPreparer prepares the GetObjectsByObjectIdsNext request. +func (client ObjectsClient) GetObjectsByObjectIdsNextPreparer(nextLink string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nextLink": nextLink, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetObjectsByObjectIdsNextSender sends the GetObjectsByObjectIdsNext request. The method will close the +// http.Response Body if it receives an error. +func (client ObjectsClient) GetObjectsByObjectIdsNextSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetObjectsByObjectIdsNextResponder handles the response to the GetObjectsByObjectIdsNext request. The method always +// closes the http.Response Body. +func (client ObjectsClient) GetObjectsByObjectIdsNextResponder(resp *http.Response) (result GetObjectsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/serviceprincipals.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/serviceprincipals.go index f1572ce99e..57a173968c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/serviceprincipals.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/serviceprincipals.go @@ -1,639 +1,639 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ServicePrincipalsClient is the composite Swagger specification for Azure -// Active Directory Graph RBAC management client. -type ServicePrincipalsClient struct { - ManagementClient -} - -// NewServicePrincipalsClient creates an instance of the -// ServicePrincipalsClient client. -func NewServicePrincipalsClient(tenantID string) ServicePrincipalsClient { - return NewServicePrincipalsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewServicePrincipalsClientWithBaseURI creates an instance of the -// ServicePrincipalsClient client. -func NewServicePrincipalsClientWithBaseURI(baseURI string, tenantID string) ServicePrincipalsClient { - return ServicePrincipalsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Create creates a service principal in the directory. -// -// parameters is parameters to create a service principal. -func (client ServicePrincipalsClient) Create(parameters ServicePrincipalCreateParameters) (result ServicePrincipal, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AppID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.ServicePrincipalsClient", "Create") - } - - req, err := client.CreatePreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ServicePrincipalsClient) CreatePreparer(parameters ServicePrincipalCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) CreateResponder(resp *http.Response) (result ServicePrincipal, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a service principal from the directory. -// -// objectID is the object ID of the service principal to delete. -func (client ServicePrincipalsClient) Delete(objectID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicePrincipalsClient) DeletePreparer(objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets service principal information from the directory. -// -// objectID is the object ID of the service principal to get. -func (client ServicePrincipalsClient) Get(objectID string) (result ServicePrincipal, err error) { - req, err := client.GetPreparer(objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicePrincipalsClient) GetPreparer(objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) GetResponder(resp *http.Response) (result ServicePrincipal, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of service principals from the current tenant. -// -// filter is the filter to apply to the operation. -func (client ServicePrincipalsClient) List(filter string) (result ServicePrincipalListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ServicePrincipalsClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeyCredentials get the keyCredentials associated with the specified -// service principal. -// -// objectID is the object ID of the service principal for which to get -// keyCredentials. -func (client ServicePrincipalsClient) ListKeyCredentials(objectID string) (result KeyCredentialListResult, err error) { - req, err := client.ListKeyCredentialsPreparer(objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeyCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure responding to request") - } - - return -} - -// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. -func (client ServicePrincipalsClient) ListKeyCredentialsPreparer(objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNext gets a list of service principals from the current tenant. -// -// nextLink is next link for the list operation. -func (client ServicePrincipalsClient) ListNext(nextLink string) (result ServicePrincipalListResult, err error) { - req, err := client.ListNextPreparer(nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure responding to request") - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client ServicePrincipalsClient) ListNextPreparer(nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListNextResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPasswordCredentials gets the passwordCredentials associated with a -// service principal. -// -// objectID is the object ID of the service principal. -func (client ServicePrincipalsClient) ListPasswordCredentials(objectID string) (result PasswordCredentialListResult, err error) { - req, err := client.ListPasswordCredentialsPreparer(objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListPasswordCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListPasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure responding to request") - } - - return -} - -// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. -func (client ServicePrincipalsClient) ListPasswordCredentialsPreparer(objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateKeyCredentials update the keyCredentials associated with a service -// principal. -// -// objectID is the object ID for which to get service principal information. -// parameters is parameters to update the keyCredentials of an existing service -// principal. -func (client ServicePrincipalsClient) UpdateKeyCredentials(objectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { - req, err := client.UpdateKeyCredentialsPreparer(objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateKeyCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdateKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure responding to request") - } - - return -} - -// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. -func (client ServicePrincipalsClient) UpdateKeyCredentialsPreparer(objectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdatePasswordCredentials updates the passwordCredentials associated with a -// service principal. -// -// objectID is the object ID of the service principal. parameters is parameters -// to update the passwordCredentials of an existing service principal. -func (client ServicePrincipalsClient) UpdatePasswordCredentials(objectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { - req, err := client.UpdatePasswordCredentialsPreparer(objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdatePasswordCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdatePasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") - } - - return -} - -// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. -func (client ServicePrincipalsClient) UpdatePasswordCredentialsPreparer(objectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ServicePrincipalsClient is the composite Swagger specification for Azure +// Active Directory Graph RBAC management client. +type ServicePrincipalsClient struct { + ManagementClient +} + +// NewServicePrincipalsClient creates an instance of the +// ServicePrincipalsClient client. +func NewServicePrincipalsClient(tenantID string) ServicePrincipalsClient { + return NewServicePrincipalsClientWithBaseURI(DefaultBaseURI, tenantID) +} + +// NewServicePrincipalsClientWithBaseURI creates an instance of the +// ServicePrincipalsClient client. +func NewServicePrincipalsClientWithBaseURI(baseURI string, tenantID string) ServicePrincipalsClient { + return ServicePrincipalsClient{NewWithBaseURI(baseURI, tenantID)} +} + +// Create creates a service principal in the directory. +// +// parameters is parameters to create a service principal. +func (client ServicePrincipalsClient) Create(parameters ServicePrincipalCreateParameters) (result ServicePrincipal, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AppID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.ServicePrincipalsClient", "Create") + } + + req, err := client.CreatePreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ServicePrincipalsClient) CreatePreparer(parameters ServicePrincipalCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) CreateResponder(resp *http.Response) (result ServicePrincipal, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a service principal from the directory. +// +// objectID is the object ID of the service principal to delete. +func (client ServicePrincipalsClient) Delete(objectID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicePrincipalsClient) DeletePreparer(objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets service principal information from the directory. +// +// objectID is the object ID of the service principal to get. +func (client ServicePrincipalsClient) Get(objectID string) (result ServicePrincipal, err error) { + req, err := client.GetPreparer(objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicePrincipalsClient) GetPreparer(objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) GetResponder(resp *http.Response) (result ServicePrincipal, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of service principals from the current tenant. +// +// filter is the filter to apply to the operation. +func (client ServicePrincipalsClient) List(filter string) (result ServicePrincipalListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServicePrincipalsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeyCredentials get the keyCredentials associated with the specified +// service principal. +// +// objectID is the object ID of the service principal for which to get +// keyCredentials. +func (client ServicePrincipalsClient) ListKeyCredentials(objectID string) (result KeyCredentialListResult, err error) { + req, err := client.ListKeyCredentialsPreparer(objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeyCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListKeyCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure responding to request") + } + + return +} + +// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. +func (client ServicePrincipalsClient) ListKeyCredentialsPreparer(objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNext gets a list of service principals from the current tenant. +// +// nextLink is next link for the list operation. +func (client ServicePrincipalsClient) ListNext(nextLink string) (result ServicePrincipalListResult, err error) { + req, err := client.ListNextPreparer(nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", nil, "Failure preparing request") + return + } + + resp, err := client.ListNextSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure sending request") + return + } + + result, err = client.ListNextResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure responding to request") + } + + return +} + +// ListNextPreparer prepares the ListNext request. +func (client ServicePrincipalsClient) ListNextPreparer(nextLink string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nextLink": nextLink, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNextSender sends the ListNext request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListNextSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNextResponder handles the response to the ListNext request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListNextResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPasswordCredentials gets the passwordCredentials associated with a +// service principal. +// +// objectID is the object ID of the service principal. +func (client ServicePrincipalsClient) ListPasswordCredentials(objectID string) (result PasswordCredentialListResult, err error) { + req, err := client.ListPasswordCredentialsPreparer(objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListPasswordCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListPasswordCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure responding to request") + } + + return +} + +// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. +func (client ServicePrincipalsClient) ListPasswordCredentialsPreparer(objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateKeyCredentials update the keyCredentials associated with a service +// principal. +// +// objectID is the object ID for which to get service principal information. +// parameters is parameters to update the keyCredentials of an existing service +// principal. +func (client ServicePrincipalsClient) UpdateKeyCredentials(objectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { + req, err := client.UpdateKeyCredentialsPreparer(objectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateKeyCredentialsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure sending request") + return + } + + result, err = client.UpdateKeyCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure responding to request") + } + + return +} + +// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. +func (client ServicePrincipalsClient) UpdateKeyCredentialsPreparer(objectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdatePasswordCredentials updates the passwordCredentials associated with a +// service principal. +// +// objectID is the object ID of the service principal. parameters is parameters +// to update the passwordCredentials of an existing service principal. +func (client ServicePrincipalsClient) UpdatePasswordCredentials(objectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { + req, err := client.UpdatePasswordCredentialsPreparer(objectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePasswordCredentialsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure sending request") + return + } + + result, err = client.UpdatePasswordCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") + } + + return +} + +// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. +func (client ServicePrincipalsClient) UpdatePasswordCredentialsPreparer(objectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/users.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/users.go index ff89cd3a53..5722cb92ae 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/users.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/users.go @@ -1,516 +1,516 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UsersClient is the composite Swagger specification for Azure Active -// Directory Graph RBAC management client. -type UsersClient struct { - ManagementClient -} - -// NewUsersClient creates an instance of the UsersClient client. -func NewUsersClient(tenantID string) UsersClient { - return NewUsersClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewUsersClientWithBaseURI creates an instance of the UsersClient client. -func NewUsersClientWithBaseURI(baseURI string, tenantID string) UsersClient { - return UsersClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Create create a new user. -// -// parameters is parameters to create a user. -func (client UsersClient) Create(parameters UserCreateParameters) (result User, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PasswordProfile", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PasswordProfile.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.UserPrincipalName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.UsersClient", "Create") - } - - req, err := client.CreatePreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client UsersClient) CreatePreparer(parameters UserCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client UsersClient) CreateResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a user. -// -// upnOrObjectID is the object ID or principal name of the user to delete. -func (client UsersClient) Delete(upnOrObjectID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(upnOrObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UsersClient) DeletePreparer(upnOrObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - "upnOrObjectId": upnOrObjectID, - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets user information from the directory. -// -// upnOrObjectID is the object ID or principal name of the user for which to -// get information. -func (client UsersClient) Get(upnOrObjectID string) (result User, err error) { - req, err := client.GetPreparer(upnOrObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client UsersClient) GetPreparer(upnOrObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - "upnOrObjectId": upnOrObjectID, - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMemberGroups gets a collection that contains the object IDs of the groups -// of which the user is a member. -// -// objectID is the object ID of the user for which to get group membership. -// parameters is user filtering parameters. -func (client UsersClient) GetMemberGroups(objectID string, parameters UserGetMemberGroupsParameters) (result UserGetMemberGroupsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "graphrbac.UsersClient", "GetMemberGroups") - } - - req, err := client.GetMemberGroupsPreparer(objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", nil, "Failure preparing request") - return - } - - resp, err := client.GetMemberGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure sending request") - return - } - - result, err = client.GetMemberGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure responding to request") - } - - return -} - -// GetMemberGroupsPreparer prepares the GetMemberGroups request. -func (client UsersClient) GetMemberGroupsPreparer(objectID string, parameters UserGetMemberGroupsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": objectID, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{objectId}/getMemberGroups", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always -// closes the http.Response Body. -func (client UsersClient) GetMemberGroupsResponder(resp *http.Response) (result UserGetMemberGroupsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets list of users for the current tenant. -// -// filter is the filter to apply to the operation. -func (client UsersClient) List(filter string) (result UserListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsersClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsersClient) ListResponder(resp *http.Response) (result UserListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNext gets a list of users for the current tenant. -// -// nextLink is next link for the list operation. -func (client UsersClient) ListNext(nextLink string) (result UserListResult, err error) { - req, err := client.ListNextPreparer(nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure responding to request") - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client UsersClient) ListNextPreparer(nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListNextSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client UsersClient) ListNextResponder(resp *http.Response) (result UserListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a user. -// -// upnOrObjectID is the object ID or principal name of the user to update. -// parameters is parameters to update an existing user. -func (client UsersClient) Update(upnOrObjectID string, parameters UserUpdateParameters) (result autorest.Response, err error) { - req, err := client.UpdatePreparer(upnOrObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UsersClient) UpdatePreparer(upnOrObjectID string, parameters UserUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - "upnOrObjectId": upnOrObjectID, - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client UsersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UsersClient is the composite Swagger specification for Azure Active +// Directory Graph RBAC management client. +type UsersClient struct { + ManagementClient +} + +// NewUsersClient creates an instance of the UsersClient client. +func NewUsersClient(tenantID string) UsersClient { + return NewUsersClientWithBaseURI(DefaultBaseURI, tenantID) +} + +// NewUsersClientWithBaseURI creates an instance of the UsersClient client. +func NewUsersClientWithBaseURI(baseURI string, tenantID string) UsersClient { + return UsersClient{NewWithBaseURI(baseURI, tenantID)} +} + +// Create create a new user. +// +// parameters is parameters to create a user. +func (client UsersClient) Create(parameters UserCreateParameters) (result User, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PasswordProfile", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.PasswordProfile.Password", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.UserPrincipalName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.UsersClient", "Create") + } + + req, err := client.CreatePreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client UsersClient) CreatePreparer(parameters UserCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/users", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client UsersClient) CreateResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a user. +// +// upnOrObjectID is the object ID or principal name of the user to delete. +func (client UsersClient) Delete(upnOrObjectID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(upnOrObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UsersClient) DeletePreparer(upnOrObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + "upnOrObjectId": upnOrObjectID, + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets user information from the directory. +// +// upnOrObjectID is the object ID or principal name of the user for which to +// get information. +func (client UsersClient) Get(upnOrObjectID string) (result User, err error) { + req, err := client.GetPreparer(upnOrObjectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client UsersClient) GetPreparer(upnOrObjectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + "upnOrObjectId": upnOrObjectID, + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMemberGroups gets a collection that contains the object IDs of the groups +// of which the user is a member. +// +// objectID is the object ID of the user for which to get group membership. +// parameters is user filtering parameters. +func (client UsersClient) GetMemberGroups(objectID string, parameters UserGetMemberGroupsParameters) (result UserGetMemberGroupsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "graphrbac.UsersClient", "GetMemberGroups") + } + + req, err := client.GetMemberGroupsPreparer(objectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", nil, "Failure preparing request") + return + } + + resp, err := client.GetMemberGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure sending request") + return + } + + result, err = client.GetMemberGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure responding to request") + } + + return +} + +// GetMemberGroupsPreparer prepares the GetMemberGroups request. +func (client UsersClient) GetMemberGroupsPreparer(objectID string, parameters UserGetMemberGroupsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": objectID, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/users/{objectId}/getMemberGroups", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always +// closes the http.Response Body. +func (client UsersClient) GetMemberGroupsResponder(resp *http.Response) (result UserGetMemberGroupsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets list of users for the current tenant. +// +// filter is the filter to apply to the operation. +func (client UsersClient) List(filter string) (result UserListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsersClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsersClient) ListResponder(resp *http.Response) (result UserListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNext gets a list of users for the current tenant. +// +// nextLink is next link for the list operation. +func (client UsersClient) ListNext(nextLink string) (result UserListResult, err error) { + req, err := client.ListNextPreparer(nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", nil, "Failure preparing request") + return + } + + resp, err := client.ListNextSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure sending request") + return + } + + result, err = client.ListNextResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure responding to request") + } + + return +} + +// ListNextPreparer prepares the ListNext request. +func (client UsersClient) ListNextPreparer(nextLink string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nextLink": nextLink, + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNextSender sends the ListNext request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListNextSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNextResponder handles the response to the ListNext request. The method always +// closes the http.Response Body. +func (client UsersClient) ListNextResponder(resp *http.Response) (result UserListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a user. +// +// upnOrObjectID is the object ID or principal name of the user to update. +// parameters is parameters to update an existing user. +func (client UsersClient) Update(upnOrObjectID string, parameters UserUpdateParameters) (result autorest.Response, err error) { + req, err := client.UpdatePreparer(upnOrObjectID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UsersClient) UpdatePreparer(upnOrObjectID string, parameters UserUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "tenantID": autorest.Encode("path", client.TenantID), + "upnOrObjectId": upnOrObjectID, + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client UsersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/version.go index 9ddf4d7446..1283f0d758 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/graphrbac/version.go @@ -1,29 +1,29 @@ -package graphrbac - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-graphrbac/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package graphrbac + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-graphrbac/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/applications.go index faf72be0ed..c3a5cddc51 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/applications.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/applications.go @@ -1,352 +1,352 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ApplicationsClient is the the HDInsight Management Client. -type ApplicationsClient struct { - ManagementClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(subscriptionID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the -// ApplicationsClient client. -func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create the operation creates applications for the HDInsight cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. applicationName is the constant value for the -// applicationName parameters is the application create request. -func (client ApplicationsClient) Create(resourceGroupName string, clusterName string, applicationName string, parameters ApplicationGetProperties) (result Application, err error) { - req, err := client.CreatePreparer(resourceGroupName, clusterName, applicationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationsClient) CreatePreparer(resourceGroupName string, clusterName string, applicationName string, parameters ApplicationGetProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete lists all of the applications HDInsight cluster. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. applicationName is the constant value for the -// applicationName. -func (client ApplicationsClient) Delete(resourceGroupName string, clusterName string, applicationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, clusterName, applicationName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(resourceGroupName string, clusterName string, applicationName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get lists properties of the application. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. applicationName is the constant value for the -// applicationName -func (client ApplicationsClient) Get(resourceGroupName string, clusterName string, applicationName string) (result Application, err error) { - req, err := client.GetPreparer(resourceGroupName, clusterName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationName": autorest.Encode("path", applicationName), - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all of the applications HDInsight cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. -func (client ApplicationsClient) List(resourceGroupName string, clusterName string) (result ApplicationListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ApplicationsClient) ListNextResults(lastResults ApplicationListResult) (result ApplicationListResult, err error) { - req, err := lastResults.ApplicationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ApplicationsClient is the the HDInsight Management Client. +type ApplicationsClient struct { + ManagementClient +} + +// NewApplicationsClient creates an instance of the ApplicationsClient client. +func NewApplicationsClient(subscriptionID string) ApplicationsClient { + return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationsClientWithBaseURI creates an instance of the +// ApplicationsClient client. +func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { + return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create the operation creates applications for the HDInsight cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. applicationName is the constant value for the +// applicationName parameters is the application create request. +func (client ApplicationsClient) Create(resourceGroupName string, clusterName string, applicationName string, parameters ApplicationGetProperties) (result Application, err error) { + req, err := client.CreatePreparer(resourceGroupName, clusterName, applicationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ApplicationsClient) CreatePreparer(resourceGroupName string, clusterName string, applicationName string, parameters ApplicationGetProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationName": autorest.Encode("path", applicationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete lists all of the applications HDInsight cluster. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. applicationName is the constant value for the +// applicationName. +func (client ApplicationsClient) Delete(resourceGroupName string, clusterName string, applicationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, clusterName, applicationName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationsClient) DeletePreparer(resourceGroupName string, clusterName string, applicationName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationName": autorest.Encode("path", applicationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get lists properties of the application. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. applicationName is the constant value for the +// applicationName +func (client ApplicationsClient) Get(resourceGroupName string, clusterName string, applicationName string) (result Application, err error) { + req, err := client.GetPreparer(resourceGroupName, clusterName, applicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationsClient) GetPreparer(resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationName": autorest.Encode("path", applicationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the applications HDInsight cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. +func (client ApplicationsClient) List(resourceGroupName string, clusterName string) (result ApplicationListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationsClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ApplicationsClient) ListNextResults(lastResults ApplicationListResult) (result ApplicationListResult, err error) { + req, err := lastResults.ApplicationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/client.go index a35601b672..f057af2d59 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/client.go @@ -1,52 +1,52 @@ -// Package hdinsight implements the Azure ARM Hdinsight service API version . -// -// The HDInsight Management Client. -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Hdinsight - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Hdinsight. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package hdinsight implements the Azure ARM Hdinsight service API version . +// +// The HDInsight Management Client. +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Hdinsight + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Hdinsight. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/clusters.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/clusters.go index 7ef2cf3972..69ec386f67 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/clusters.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/clusters.go @@ -1,785 +1,785 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ClustersClient is the the HDInsight Management Client. -type ClustersClient struct { - ManagementClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient -// client. -func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ChangeRdpSettings begins changing the RDP settings on the specified cluster. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. parameters is the OS profile for RDP. -func (client ClustersClient) ChangeRdpSettings(resourceGroupName string, clusterName string, parameters RDPSettingsParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z][0-9a-zA-Z-]*[a-zA-Z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.OsProfile", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "hdinsight.ClustersClient", "ChangeRdpSettings") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ChangeRdpSettingsPreparer(resourceGroupName, clusterName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", nil, "Failure preparing request") - return - } - - resp, err := client.ChangeRdpSettingsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", resp, "Failure sending request") - return - } - - result, err = client.ChangeRdpSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ChangeRdpSettingsPreparer prepares the ChangeRdpSettings request. -func (client ClustersClient) ChangeRdpSettingsPreparer(resourceGroupName string, clusterName string, parameters RDPSettingsParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/changerdpsetting", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ChangeRdpSettingsSender sends the ChangeRdpSettings request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ChangeRdpSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ChangeRdpSettingsResponder handles the response to the ChangeRdpSettings request. The method always -// closes the http.Response Body. -func (client ClustersClient) ChangeRdpSettingsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create begins creating a new HDInsight cluster with the specified -// parameters. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. parameters is the cluster create request. -func (client ClustersClient) Create(resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, cancel <-chan struct{}) (<-chan Cluster, <-chan error) { - resultChan := make(chan Cluster, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Cluster - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client ClustersClient) CreatePreparer(resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete begins deleting the specified HDInsight cluster. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. -func (client ClustersClient) Delete(resourceGroupName string, clusterName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, clusterName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(resourceGroupName string, clusterName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExecuteScriptActions begins executing script actions on the specified -// HDInsight cluster. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. parameters is the parameters for executing script actions. -func (client ClustersClient) ExecuteScriptActions(resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PersistOnSuccess", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "hdinsight.ClustersClient", "ExecuteScriptActions") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExecuteScriptActionsPreparer(resourceGroupName, clusterName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteScriptActionsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", resp, "Failure sending request") - return - } - - result, err = client.ExecuteScriptActionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExecuteScriptActionsPreparer prepares the ExecuteScriptActions request. -func (client ClustersClient) ExecuteScriptActionsPreparer(resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExecuteScriptActionsSender sends the ExecuteScriptActions request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ExecuteScriptActionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExecuteScriptActionsResponder handles the response to the ExecuteScriptActions request. The method always -// closes the http.Response Body. -func (client ClustersClient) ExecuteScriptActionsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. -func (client ClustersClient) Get(resourceGroupName string, clusterName string) (result Cluster, err error) { - req, err := client.GetPreparer(resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists HDInsight clusters under the subscription. -func (client ClustersClient) List() (result ClusterListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ClustersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ClustersClient) ListNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { - req, err := lastResults.ClusterListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup list the HDInsight clusters in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client ClustersClient) ListByResourceGroup(resourceGroupName string) (result ClusterListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ClustersClient) ListByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { - req, err := lastResults.ClusterListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Resize begins a resize operation on the specified HDInsight cluster. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. roleName is the constant value for the roleName parameters -// is the parameters for the resize operation. -func (client ClustersClient) Resize(resourceGroupName string, clusterName string, roleName string, parameters ClusterResizeParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ResizePreparer(resourceGroupName, clusterName, roleName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", nil, "Failure preparing request") - return - } - - resp, err := client.ResizeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", resp, "Failure sending request") - return - } - - result, err = client.ResizeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ResizePreparer prepares the Resize request. -func (client ClustersClient) ResizePreparer(resourceGroupName string, clusterName string, roleName string, parameters ClusterResizeParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "roleName": autorest.Encode("path", roleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResizeSender sends the Resize request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ResizeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResizeResponder handles the response to the Resize request. The method always -// closes the http.Response Body. -func (client ClustersClient) ResizeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update patch HDInsight cluster with the specified parameters. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. parameters is the cluster patch request. -func (client ClustersClient) Update(resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (result Cluster, err error) { - req, err := client.UpdatePreparer(resourceGroupName, clusterName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ClustersClient is the the HDInsight Management Client. +type ClustersClient struct { + ManagementClient +} + +// NewClustersClient creates an instance of the ClustersClient client. +func NewClustersClient(subscriptionID string) ClustersClient { + return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClustersClientWithBaseURI creates an instance of the ClustersClient +// client. +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ChangeRdpSettings begins changing the RDP settings on the specified cluster. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. parameters is the OS profile for RDP. +func (client ClustersClient) ChangeRdpSettings(resourceGroupName string, clusterName string, parameters RDPSettingsParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: clusterName, + Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z][0-9a-zA-Z-]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.OsProfile", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "hdinsight.ClustersClient", "ChangeRdpSettings") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ChangeRdpSettingsPreparer(resourceGroupName, clusterName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ChangeRdpSettingsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", resp, "Failure sending request") + return + } + + result, err = client.ChangeRdpSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ChangeRdpSettingsPreparer prepares the ChangeRdpSettings request. +func (client ClustersClient) ChangeRdpSettingsPreparer(resourceGroupName string, clusterName string, parameters RDPSettingsParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/changerdpsetting", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ChangeRdpSettingsSender sends the ChangeRdpSettings request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ChangeRdpSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ChangeRdpSettingsResponder handles the response to the ChangeRdpSettings request. The method always +// closes the http.Response Body. +func (client ClustersClient) ChangeRdpSettingsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create begins creating a new HDInsight cluster with the specified +// parameters. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. parameters is the cluster create request. +func (client ClustersClient) Create(resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, cancel <-chan struct{}) (<-chan Cluster, <-chan error) { + resultChan := make(chan Cluster, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Cluster + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ClustersClient) CreatePreparer(resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete begins deleting the specified HDInsight cluster. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. +func (client ClustersClient) Delete(resourceGroupName string, clusterName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, clusterName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(resourceGroupName string, clusterName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExecuteScriptActions begins executing script actions on the specified +// HDInsight cluster. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. parameters is the parameters for executing script actions. +func (client ClustersClient) ExecuteScriptActions(resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PersistOnSuccess", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "hdinsight.ClustersClient", "ExecuteScriptActions") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExecuteScriptActionsPreparer(resourceGroupName, clusterName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", nil, "Failure preparing request") + return + } + + resp, err := client.ExecuteScriptActionsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", resp, "Failure sending request") + return + } + + result, err = client.ExecuteScriptActionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExecuteScriptActionsPreparer prepares the ExecuteScriptActions request. +func (client ClustersClient) ExecuteScriptActionsPreparer(resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExecuteScriptActionsSender sends the ExecuteScriptActions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ExecuteScriptActionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExecuteScriptActionsResponder handles the response to the ExecuteScriptActions request. The method always +// closes the http.Response Body. +func (client ClustersClient) ExecuteScriptActionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. +func (client ClustersClient) Get(resourceGroupName string, clusterName string) (result Cluster, err error) { + req, err := client.GetPreparer(resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists HDInsight clusters under the subscription. +func (client ClustersClient) List() (result ClusterListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ClustersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ClustersClient) ListNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.ClusterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup list the HDInsight clusters in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client ClustersClient) ListByResourceGroup(resourceGroupName string) (result ClusterListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ClustersClient) ListByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.ClusterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Resize begins a resize operation on the specified HDInsight cluster. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. roleName is the constant value for the roleName parameters +// is the parameters for the resize operation. +func (client ClustersClient) Resize(resourceGroupName string, clusterName string, roleName string, parameters ClusterResizeParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ResizePreparer(resourceGroupName, clusterName, roleName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", nil, "Failure preparing request") + return + } + + resp, err := client.ResizeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", resp, "Failure sending request") + return + } + + result, err = client.ResizeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ResizePreparer prepares the Resize request. +func (client ClustersClient) ResizePreparer(resourceGroupName string, clusterName string, roleName string, parameters ClusterResizeParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResizeSender sends the Resize request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ResizeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResizeResponder handles the response to the Resize request. The method always +// closes the http.Response Body. +func (client ClustersClient) ResizeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update patch HDInsight cluster with the specified parameters. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. parameters is the cluster patch request. +func (client ClustersClient) Update(resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (result Cluster, err error) { + req, err := client.UpdatePreparer(resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/configurations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/configurations.go index 1de5d79b76..a1d3ee2213 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/configurations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/configurations.go @@ -1,195 +1,195 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ConfigurationsClient is the the HDInsight Management Client. -type ConfigurationsClient struct { - ManagementClient -} - -// NewConfigurationsClient creates an instance of the ConfigurationsClient -// client. -func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { - return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsClientWithBaseURI creates an instance of the -// ConfigurationsClient client. -func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { - return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get the configuration object for the specified cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. configurationName is the constant for configuration type of -// gateway. -func (client ConfigurationsClient) Get(resourceGroupName string, clusterName string, configurationName Configurationname) (result HTTPConnectivitySettings, err error) { - req, err := client.GetPreparer(resourceGroupName, clusterName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConfigurationsClient) GetPreparer(resourceGroupName string, clusterName string, configurationName Configurationname) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) GetResponder(resp *http.Response) (result HTTPConnectivitySettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateHTTPSettings begins configuring the HTTP settings on the specified -// cluster. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. configurationName is the constant for configuration type of -// gateway. parameters is the name of the resource group. -func (client ConfigurationsClient) UpdateHTTPSettings(resourceGroupName string, clusterName string, configurationName string, parameters HTTPConnectivitySettings, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdateHTTPSettingsPreparer(resourceGroupName, clusterName, configurationName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateHTTPSettingsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", resp, "Failure sending request") - return - } - - result, err = client.UpdateHTTPSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdateHTTPSettingsPreparer prepares the UpdateHTTPSettings request. -func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(resourceGroupName string, clusterName string, configurationName string, parameters HTTPConnectivitySettings, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateHTTPSettingsSender sends the UpdateHTTPSettings request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) UpdateHTTPSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateHTTPSettingsResponder handles the response to the UpdateHTTPSettings request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) UpdateHTTPSettingsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ConfigurationsClient is the the HDInsight Management Client. +type ConfigurationsClient struct { + ManagementClient +} + +// NewConfigurationsClient creates an instance of the ConfigurationsClient +// client. +func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { + return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationsClientWithBaseURI creates an instance of the +// ConfigurationsClient client. +func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { + return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get the configuration object for the specified cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. configurationName is the constant for configuration type of +// gateway. +func (client ConfigurationsClient) Get(resourceGroupName string, clusterName string, configurationName Configurationname) (result HTTPConnectivitySettings, err error) { + req, err := client.GetPreparer(resourceGroupName, clusterName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationsClient) GetPreparer(resourceGroupName string, clusterName string, configurationName Configurationname) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConfigurationsClient) GetResponder(resp *http.Response) (result HTTPConnectivitySettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHTTPSettings begins configuring the HTTP settings on the specified +// cluster. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. configurationName is the constant for configuration type of +// gateway. parameters is the name of the resource group. +func (client ConfigurationsClient) UpdateHTTPSettings(resourceGroupName string, clusterName string, configurationName string, parameters HTTPConnectivitySettings, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdateHTTPSettingsPreparer(resourceGroupName, clusterName, configurationName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHTTPSettingsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateHTTPSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateHTTPSettingsPreparer prepares the UpdateHTTPSettings request. +func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(resourceGroupName string, clusterName string, configurationName string, parameters HTTPConnectivitySettings, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationName": autorest.Encode("path", configurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateHTTPSettingsSender sends the UpdateHTTPSettings request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationsClient) UpdateHTTPSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateHTTPSettingsResponder handles the response to the UpdateHTTPSettings request. The method always +// closes the http.Response Body. +func (client ConfigurationsClient) UpdateHTTPSettingsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/extension.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/extension.go index 6c2165edeb..348ef83683 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/extension.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/extension.go @@ -1,243 +1,243 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ExtensionClient is the the HDInsight Management Client. -type ExtensionClient struct { - ManagementClient -} - -// NewExtensionClient creates an instance of the ExtensionClient client. -func NewExtensionClient(subscriptionID string) ExtensionClient { - return NewExtensionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExtensionClientWithBaseURI creates an instance of the ExtensionClient -// client. -func NewExtensionClientWithBaseURI(baseURI string, subscriptionID string) ExtensionClient { - return ExtensionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create HDInsight cluster extension. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. parameters is the cluster extensions create request. -// extensionName is the name of the cluster extension. -func (client ExtensionClient) Create(resourceGroupName string, clusterName string, parameters Extension, extensionName string) (result autorest.Response, err error) { - req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, extensionName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ExtensionClient) CreatePreparer(resourceGroupName string, clusterName string, parameters Extension, extensionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "extensionName": autorest.Encode("path", extensionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ExtensionClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ExtensionClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete delete extension for HDInsight cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. extensionName is the name of the cluster extension. -func (client ExtensionClient) Delete(resourceGroupName string, clusterName string, extensionName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, clusterName, extensionName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExtensionClient) DeletePreparer(resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "extensionName": autorest.Encode("path", extensionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ExtensionClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ExtensionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get extension properties for HDInsight cluster extension. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. extensionName is the name of the cluster extension. -func (client ExtensionClient) Get(resourceGroupName string, clusterName string, extensionName string) (result Extension, err error) { - req, err := client.GetPreparer(resourceGroupName, clusterName, extensionName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExtensionClient) GetPreparer(resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "extensionName": autorest.Encode("path", extensionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExtensionClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExtensionClient) GetResponder(resp *http.Response) (result Extension, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ExtensionClient is the the HDInsight Management Client. +type ExtensionClient struct { + ManagementClient +} + +// NewExtensionClient creates an instance of the ExtensionClient client. +func NewExtensionClient(subscriptionID string) ExtensionClient { + return NewExtensionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionClientWithBaseURI creates an instance of the ExtensionClient +// client. +func NewExtensionClientWithBaseURI(baseURI string, subscriptionID string) ExtensionClient { + return ExtensionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create HDInsight cluster extension. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. parameters is the cluster extensions create request. +// extensionName is the name of the cluster extension. +func (client ExtensionClient) Create(resourceGroupName string, clusterName string, parameters Extension, extensionName string) (result autorest.Response, err error) { + req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionClient) CreatePreparer(resourceGroupName string, clusterName string, parameters Extension, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete delete extension for HDInsight cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. extensionName is the name of the cluster extension. +func (client ExtensionClient) Delete(resourceGroupName string, clusterName string, extensionName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionClient) DeletePreparer(resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get extension properties for HDInsight cluster extension. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. extensionName is the name of the cluster extension. +func (client ExtensionClient) Get(resourceGroupName string, clusterName string, extensionName string) (result Extension, err error) { + req, err := client.GetPreparer(resourceGroupName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionClient) GetPreparer(resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExtensionClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/location.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/location.go index 7ff6236c21..8a94df775b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/location.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/location.go @@ -1,105 +1,105 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// LocationClient is the the HDInsight Management Client. -type LocationClient struct { - ManagementClient -} - -// NewLocationClient creates an instance of the LocationClient client. -func NewLocationClient(subscriptionID string) LocationClient { - return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationClientWithBaseURI creates an instance of the LocationClient -// client. -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetCapabilities gets the capabilities for the specified location. -// -// location is the location to get capabilities for. -func (client LocationClient) GetCapabilities(location string) (result CapabilitiesResult, err error) { - req, err := client.GetCapabilitiesPreparer(location) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", nil, "Failure preparing request") - return - } - - resp, err := client.GetCapabilitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure sending request") - return - } - - result, err = client.GetCapabilitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure responding to request") - } - - return -} - -// GetCapabilitiesPreparer prepares the GetCapabilities request. -func (client LocationClient) GetCapabilitiesPreparer(location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCapabilitiesSender sends the GetCapabilities request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) GetCapabilitiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCapabilitiesResponder handles the response to the GetCapabilities request. The method always -// closes the http.Response Body. -func (client LocationClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// LocationClient is the the HDInsight Management Client. +type LocationClient struct { + ManagementClient +} + +// NewLocationClient creates an instance of the LocationClient client. +func NewLocationClient(subscriptionID string) LocationClient { + return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationClientWithBaseURI creates an instance of the LocationClient +// client. +func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { + return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetCapabilities gets the capabilities for the specified location. +// +// location is the location to get capabilities for. +func (client LocationClient) GetCapabilities(location string) (result CapabilitiesResult, err error) { + req, err := client.GetCapabilitiesPreparer(location) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.GetCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure sending request") + return + } + + result, err = client.GetCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure responding to request") + } + + return +} + +// GetCapabilitiesPreparer prepares the GetCapabilities request. +func (client LocationClient) GetCapabilitiesPreparer(location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCapabilitiesSender sends the GetCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client LocationClient) GetCapabilitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCapabilitiesResponder handles the response to the GetCapabilities request. The method always +// closes the http.Response Body. +func (client LocationClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/models.go index f2e2581392..f151cb7d58 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/models.go @@ -1,602 +1,602 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AsyncOperationState enumerates the values for async operation state. -type AsyncOperationState string - -const ( - // Failed specifies the failed state for async operation state. - Failed AsyncOperationState = "Failed" - // InProgress specifies the in progress state for async operation state. - InProgress AsyncOperationState = "InProgress" - // Succeeded specifies the succeeded state for async operation state. - Succeeded AsyncOperationState = "Succeeded" -) - -// ClusterProvisioningState enumerates the values for cluster provisioning -// state. -type ClusterProvisioningState string - -const ( - // ClusterProvisioningStateCanceled specifies the cluster provisioning - // state canceled state for cluster provisioning state. - ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled" - // ClusterProvisioningStateDeleting specifies the cluster provisioning - // state deleting state for cluster provisioning state. - ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" - // ClusterProvisioningStateFailed specifies the cluster provisioning state - // failed state for cluster provisioning state. - ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" - // ClusterProvisioningStateInProgress specifies the cluster provisioning - // state in progress state for cluster provisioning state. - ClusterProvisioningStateInProgress ClusterProvisioningState = "InProgress" - // ClusterProvisioningStateSucceeded specifies the cluster provisioning - // state succeeded state for cluster provisioning state. - ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" -) - -// Configurationname enumerates the values for configurationname. -type Configurationname string - -const ( - // CoreSite specifies the core site state for configurationname. - CoreSite Configurationname = "core-site" - // Gateway specifies the gateway state for configurationname. - Gateway Configurationname = "gateway" -) - -// DirectoryType enumerates the values for directory type. -type DirectoryType string - -const ( - // ActiveDirectory specifies the active directory state for directory type. - ActiveDirectory DirectoryType = "ActiveDirectory" -) - -// OSType enumerates the values for os type. -type OSType string - -const ( - // Linux specifies the linux state for os type. - Linux OSType = "Linux" - // Windows specifies the windows state for os type. - Windows OSType = "Windows" -) - -// Tier enumerates the values for tier. -type Tier string - -const ( - // Premium specifies the premium state for tier. - Premium Tier = "Premium" - // Standard specifies the standard state for tier. - Standard Tier = "Standard" -) - -// Application is hDInsight cluster application -type Application struct { - autorest.Response `json:"-"` - ID *SubResource `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Etag *string `json:"etag,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *ApplicationGetProperties `json:"properties,omitempty"` -} - -// ApplicationGetEndpoint is gets Application ssh endpoint -type ApplicationGetEndpoint struct { - Location *string `json:"location,omitempty"` - DestinationPort *int32 `json:"destinationPort,omitempty"` - PublicPort *int32 `json:"publicPort,omitempty"` -} - -// ApplicationGetHTTPSEndpoint is gets application Http endpoints. -type ApplicationGetHTTPSEndpoint struct { - AdditionalProperties *map[string]*string `json:",omitempty"` - AccessModes *[]string `json:"accessModes,omitempty"` - Location *string `json:"location,omitempty"` - DestinationPort *int32 `json:"destinationPort,omitempty"` - PublicPort *int32 `json:"publicPort,omitempty"` -} - -// ApplicationGetProperties is hDInsight cluster application. -type ApplicationGetProperties struct { - ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` - InstallScriptActions *[]RuntimeScriptAction `json:"installScriptActions,omitempty"` - UninstallScriptActions *[]RuntimeScriptAction `json:"uninstallScriptActions,omitempty"` - HTTPSEndpoints *[]ApplicationGetHTTPSEndpoint `json:"httpsEndpoints,omitempty"` - SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ApplicationType *string `json:"applicationType,omitempty"` - ApplicationState *string `json:"applicationState,omitempty"` - Errors *[]Errors `json:"errors,omitempty"` - CreatedDate *string `json:"createdDate,omitempty"` - MarketplaceIdentifier *string `json:"marketplaceIdentifier,omitempty"` - AdditionalProperties *string `json:"additionalProperties,omitempty"` -} - -// ApplicationListResult is result of the request to list cluster Applications. -// It contains a list of operations and a URL link to get the next set of -// results. -type ApplicationListResult struct { - autorest.Response `json:"-"` - Value *[]Application `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ApplicationListResult) ApplicationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CapabilitiesResult is the Get Capabilities operation response. -type CapabilitiesResult struct { - autorest.Response `json:"-"` - Versions *map[string]*VersionsCapability `json:"versions,omitempty"` - Regions *map[string]*RegionsCapability `json:"regions,omitempty"` - Vmsizes *map[string]*VMSizesCapability `json:"vmsizes,omitempty"` - VmsizeFilters *[]VMSizeCompatibilityFilter `json:"vmsize_filters,omitempty"` - Features *[]string `json:"features,omitempty"` - Quota *QuotaCapability `json:"quota,omitempty"` -} - -// Cluster is describes the cluster. -type Cluster struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - Properties *ClusterGetProperties `json:"properties,omitempty"` -} - -// ClusterCreateParametersExtended is the CreateCluster request parameters. -type ClusterCreateParametersExtended struct { - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *ClusterCreateProperties `json:"properties,omitempty"` -} - -// ClusterCreateProperties is the cluster create parameters. -type ClusterCreateProperties struct { - ClusterVersion *string `json:"clusterVersion,omitempty"` - OsType OSType `json:"osType,omitempty"` - Tier Tier `json:"tier,omitempty"` - ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"` - SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` - ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` -} - -// ClusterDefinition is the cluste definition. -type ClusterDefinition struct { - Blueprint *string `json:"blueprint,omitempty"` - Kind *string `json:"kind,omitempty"` - ComponentVersion *map[string]*string `json:"componentVersion,omitempty"` - Configurations *map[string]interface{} `json:"configurations,omitempty"` -} - -// ClusterGetProperties is the properties of cluster. -type ClusterGetProperties struct { - ClusterVersion *string `json:"clusterVersion,omitempty"` - OsType OSType `json:"osType,omitempty"` - Tier Tier `json:"tier,omitempty"` - ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"` - SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` - ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` - ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` - CreatedDate *string `json:"createdDate,omitempty"` - ClusterState *string `json:"clusterState,omitempty"` - QuotaInfo *QuotaInfo `json:"quotaInfo,omitempty"` - Errors *[]Errors `json:"errors,omitempty"` - ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` -} - -// ClusterListPersistedScriptActionsResult is list PersistedScriptActions -// operations response. -type ClusterListPersistedScriptActionsResult struct { - Value *[]RuntimeScriptAction `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterListResult is the List Cluster operation response. -type ClusterListResult struct { - autorest.Response `json:"-"` - Value *[]Cluster `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClusterListResult) ClusterListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClusterListRuntimeScriptActionDetailResult is the ListScriptExecutionHistory -// response. -type ClusterListRuntimeScriptActionDetailResult struct { - Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterPatchParameters is the PatchCluster request parameters -type ClusterPatchParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ClusterResizeParameters is the Resize Cluster request parameters. -type ClusterResizeParameters struct { - TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"` -} - -// ComputeProfile is describes the compute profile. -type ComputeProfile struct { - Roles *[]Role `json:"roles,omitempty"` -} - -// ConnectivityEndpoint is the connectivity properties -type ConnectivityEndpoint struct { - Name *string `json:"name,omitempty"` - Protocol *string `json:"protocol,omitempty"` - Location *string `json:"location,omitempty"` - Port *int32 `json:"port,omitempty"` -} - -// Errors is the error message associated with the cluster creation. -type Errors struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ExecuteScriptActionParameters is describes the script actions on a running -// cluster. -type ExecuteScriptActionParameters struct { - ScriptActions *[]RuntimeScriptAction `json:"scriptActions,omitempty"` - PersistOnSuccess *string `json:"persistOnSuccess,omitempty"` -} - -// Extension is cluster monitoring extensions -type Extension struct { - autorest.Response `json:"-"` - WorkspaceID *string `json:"workspaceId,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` -} - -// HardwareProfile is describes the hardware profile. -type HardwareProfile struct { - VMSize *string `json:"vmSize,omitempty"` -} - -// HTTPConnectivitySettings is the payload for a Configure HTTP settings -// request. -type HTTPConnectivitySettings struct { - autorest.Response `json:"-"` - EnabledCredential *string `json:"restAuthCredential.isEnabled,omitempty"` - Username *string `json:"restAuthCredential.username,omitempty"` - Password *string `json:"restAuthCredential.password,omitempty"` -} - -// HTTPSettingsParameters is the payload for a Configure HTTP settings request. -type HTTPSettingsParameters struct { - RestAuthCredentialisEnabled *string `json:"restAuthCredential.isEnabled,omitempty"` - RestAuthCredentialusername *string `json:"restAuthCredential.username,omitempty"` - RestAuthCredentialpassword *string `json:"restAuthCredential.password,omitempty"` -} - -// LinuxOperatingSystemProfile is the ssh username, password, and ssh public -// key. -type LinuxOperatingSystemProfile struct { - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - SSHProfile *SSHProfile `json:"sshProfile,omitempty"` -} - -// Operation is hDInsight REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list HDInsight operations. -// It contains a list of operations and a URL link to get the next set of -// results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OperationResource is the azure async operation response. -type OperationResource struct { - Status AsyncOperationState `json:"status,omitempty"` - Error *Errors `json:"error,omitempty"` -} - -// OsProfile is the Windows operation systems profile, and configure remote -// desktop settings. -type OsProfile struct { - WindowsOperatingSystemProfile *WindowsOperatingSystemProfile `json:"windowsOperatingSystemProfile,omitempty"` - LinuxOperatingSystemProfile *LinuxOperatingSystemProfile `json:"linuxOperatingSystemProfile,omitempty"` -} - -// QuotaCapability is the regional quota capability. -type QuotaCapability struct { - RegionalQuotas *[]RegionalQuotaCapability `json:"regionalQuotas,omitempty"` -} - -// QuotaInfo is gets or sets Quota properties for the cluster. -type QuotaInfo struct { - CoresUsed *int32 `json:"coresUsed,omitempty"` -} - -// RdpSettings is the RDP settings for the windows cluster. -type RdpSettings struct { - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` - ExpiryDate *date.Date `json:"expiryDate,omitempty"` -} - -// RDPSettingsParameters is parameters specifying the data factory gateway -// definition for a create or update operation. -type RDPSettingsParameters struct { - OsProfile *OsProfile `json:"osProfile,omitempty"` -} - -// RegionalQuotaCapability is the regional quota capacity. -type RegionalQuotaCapability struct { - RegionName *string `json:"region_name,omitempty"` - CoresUsed *int64 `json:"cores_used,omitempty"` - CoresAvailable *int64 `json:"cores_available,omitempty"` -} - -// RegionsCapability is the regions capability. -type RegionsCapability struct { - Available *[]string `json:"available,omitempty"` -} - -// Resource is the resource definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Role is describes a role on the cluster. -type Role struct { - Name *string `json:"name,omitempty"` - MinInstanceCount *int32 `json:"minInstanceCount,omitempty"` - TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"` - HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` - OsProfile *OsProfile `json:"osProfile,omitempty"` - VirtualNetworkProfile *VirtualNetworkProfile `json:"virtualNetworkProfile,omitempty"` - ScriptActions *[]ScriptAction `json:"scriptActions,omitempty"` -} - -// RuntimeScriptAction is describes a script action on a running cluster. -type RuntimeScriptAction struct { - Name *string `json:"name,omitempty"` - URI *string `json:"uri,omitempty"` - Parameters *string `json:"parameters,omitempty"` - Roles *[]string `json:"roles,omitempty"` - ApplicationName *string `json:"applicationName,omitempty"` -} - -// RuntimeScriptActionDetail is describes the execution details of a script -// action. -type RuntimeScriptActionDetail struct { - autorest.Response `json:"-"` - ScriptExecutionID *int64 `json:"scriptExecutionId,omitempty"` - StartTime *string `json:"startTime,omitempty"` - EndTime *string `json:"endTime,omitempty"` - Status *string `json:"status,omitempty"` - Operation *string `json:"operation,omitempty"` - ExecutionSummary *[]ScriptActionExecutionSummary `json:"executionSummary,omitempty"` - DebugInformation *string `json:"debugInformation,omitempty"` - Name *string `json:"name,omitempty"` - URI *string `json:"uri,omitempty"` - Parameters *string `json:"parameters,omitempty"` - Roles *[]string `json:"roles,omitempty"` - ApplicationName *string `json:"applicationName,omitempty"` -} - -// ScriptAction is describes a script action on role on the cluster. -type ScriptAction struct { - Name *string `json:"name,omitempty"` - URI *string `json:"uri,omitempty"` - Parameters *string `json:"parameters,omitempty"` -} - -// ScriptActionExecutionHistoryList is the ListScriptExecutionHistory response. -type ScriptActionExecutionHistoryList struct { - autorest.Response `json:"-"` - Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ScriptActionExecutionHistoryListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ScriptActionExecutionHistoryList) ScriptActionExecutionHistoryListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ScriptActionExecutionSummary is describes the execution summary of a script -// action. -type ScriptActionExecutionSummary struct { - Status *string `json:"status,omitempty"` - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// ScriptActionPersistedGetResponseSpec is the persisted script action for -// cluster -type ScriptActionPersistedGetResponseSpec struct { - Name *string `json:"name,omitempty"` - URI *string `json:"uri,omitempty"` - Parameters *string `json:"parameters,omitempty"` - Roles *[]string `json:"roles,omitempty"` - ApplicationName *string `json:"applicationName,omitempty"` -} - -// ScriptActionsList is all persisted script action for the cluster. -type ScriptActionsList struct { - autorest.Response `json:"-"` - Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ScriptActionsListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ScriptActionsList) ScriptActionsListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SecurityProfile is the security profile which contains Ssh public key for -// the HDInsight cluster. -type SecurityProfile struct { - DirectoryType DirectoryType `json:"directoryType,omitempty"` - Domain *string `json:"domain,omitempty"` - OrganizationalUnitDN *string `json:"organizationalUnitDN,omitempty"` - LdapsUrls *[]string `json:"ldapsUrls,omitempty"` - DomainUsername *string `json:"domainUsername,omitempty"` - DomainUserPassword *string `json:"domainUserPassword,omitempty"` - ClusterUsersGroupDNS *[]string `json:"clusterUsersGroupDNs,omitempty"` -} - -// SSHProfile is the list of Ssh public keys. -type SSHProfile struct { - PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` -} - -// SSHPublicKey is the Ssh public key for the cluster nodes. -type SSHPublicKey struct { - CertificateData *string `json:"certificateData,omitempty"` -} - -// StorageAccount is describes the storage Account. -type StorageAccount struct { - Name *string `json:"name,omitempty"` - IsDefault *bool `json:"isDefault,omitempty"` - Container *string `json:"container,omitempty"` - Key *string `json:"key,omitempty"` -} - -// StorageProfile is describes the storage profile. -type StorageProfile struct { - Storageaccounts *[]StorageAccount `json:"storageaccounts,omitempty"` -} - -// SubResource is the sub resource definition. -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// VersionsCapability is the version capability. -type VersionsCapability struct { - Available *[]VersionSpec `json:"available,omitempty"` -} - -// VersionSpec is gets or sets Version spec properties. -type VersionSpec struct { - FriendlyName *string `json:"friendlyName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - IsDefault *string `json:"isDefault,omitempty"` - ComponentVersions *map[string]*string `json:"componentVersions,omitempty"` -} - -// VirtualNetworkProfile is the Virtual network properties. -type VirtualNetworkProfile struct { - ID *string `json:"id,omitempty"` - Subnet *string `json:"subnet,omitempty"` -} - -// VMSizeCompatibilityFilter is the virtual machine type compatibility filter. -type VMSizeCompatibilityFilter struct { - FilterMode *string `json:"FilterMode,omitempty"` - Regions *[]string `json:"Regions,omitempty"` - ClusterFlavors *[]string `json:"ClusterFlavors,omitempty"` - NodeTypes *[]string `json:"NodeTypes,omitempty"` - ClusterVersions *[]string `json:"ClusterVersions,omitempty"` - Vmsizes *[]string `json:"vmsizes,omitempty"` -} - -// VMSizesCapability is the virtual machine sizes capability. -type VMSizesCapability struct { - Available *[]string `json:"available,omitempty"` -} - -// WindowsOperatingSystemProfile is the Windows operation system settings. -type WindowsOperatingSystemProfile struct { - RdpSettings *RdpSettings `json:"rdpSettings,omitempty"` -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AsyncOperationState enumerates the values for async operation state. +type AsyncOperationState string + +const ( + // Failed specifies the failed state for async operation state. + Failed AsyncOperationState = "Failed" + // InProgress specifies the in progress state for async operation state. + InProgress AsyncOperationState = "InProgress" + // Succeeded specifies the succeeded state for async operation state. + Succeeded AsyncOperationState = "Succeeded" +) + +// ClusterProvisioningState enumerates the values for cluster provisioning +// state. +type ClusterProvisioningState string + +const ( + // ClusterProvisioningStateCanceled specifies the cluster provisioning + // state canceled state for cluster provisioning state. + ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled" + // ClusterProvisioningStateDeleting specifies the cluster provisioning + // state deleting state for cluster provisioning state. + ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" + // ClusterProvisioningStateFailed specifies the cluster provisioning state + // failed state for cluster provisioning state. + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + // ClusterProvisioningStateInProgress specifies the cluster provisioning + // state in progress state for cluster provisioning state. + ClusterProvisioningStateInProgress ClusterProvisioningState = "InProgress" + // ClusterProvisioningStateSucceeded specifies the cluster provisioning + // state succeeded state for cluster provisioning state. + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" +) + +// Configurationname enumerates the values for configurationname. +type Configurationname string + +const ( + // CoreSite specifies the core site state for configurationname. + CoreSite Configurationname = "core-site" + // Gateway specifies the gateway state for configurationname. + Gateway Configurationname = "gateway" +) + +// DirectoryType enumerates the values for directory type. +type DirectoryType string + +const ( + // ActiveDirectory specifies the active directory state for directory type. + ActiveDirectory DirectoryType = "ActiveDirectory" +) + +// OSType enumerates the values for os type. +type OSType string + +const ( + // Linux specifies the linux state for os type. + Linux OSType = "Linux" + // Windows specifies the windows state for os type. + Windows OSType = "Windows" +) + +// Tier enumerates the values for tier. +type Tier string + +const ( + // Premium specifies the premium state for tier. + Premium Tier = "Premium" + // Standard specifies the standard state for tier. + Standard Tier = "Standard" +) + +// Application is hDInsight cluster application +type Application struct { + autorest.Response `json:"-"` + ID *SubResource `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Etag *string `json:"etag,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *ApplicationGetProperties `json:"properties,omitempty"` +} + +// ApplicationGetEndpoint is gets Application ssh endpoint +type ApplicationGetEndpoint struct { + Location *string `json:"location,omitempty"` + DestinationPort *int32 `json:"destinationPort,omitempty"` + PublicPort *int32 `json:"publicPort,omitempty"` +} + +// ApplicationGetHTTPSEndpoint is gets application Http endpoints. +type ApplicationGetHTTPSEndpoint struct { + AdditionalProperties *map[string]*string `json:",omitempty"` + AccessModes *[]string `json:"accessModes,omitempty"` + Location *string `json:"location,omitempty"` + DestinationPort *int32 `json:"destinationPort,omitempty"` + PublicPort *int32 `json:"publicPort,omitempty"` +} + +// ApplicationGetProperties is hDInsight cluster application. +type ApplicationGetProperties struct { + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + InstallScriptActions *[]RuntimeScriptAction `json:"installScriptActions,omitempty"` + UninstallScriptActions *[]RuntimeScriptAction `json:"uninstallScriptActions,omitempty"` + HTTPSEndpoints *[]ApplicationGetHTTPSEndpoint `json:"httpsEndpoints,omitempty"` + SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ApplicationType *string `json:"applicationType,omitempty"` + ApplicationState *string `json:"applicationState,omitempty"` + Errors *[]Errors `json:"errors,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + MarketplaceIdentifier *string `json:"marketplaceIdentifier,omitempty"` + AdditionalProperties *string `json:"additionalProperties,omitempty"` +} + +// ApplicationListResult is result of the request to list cluster Applications. +// It contains a list of operations and a URL link to get the next set of +// results. +type ApplicationListResult struct { + autorest.Response `json:"-"` + Value *[]Application `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ApplicationListResult) ApplicationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CapabilitiesResult is the Get Capabilities operation response. +type CapabilitiesResult struct { + autorest.Response `json:"-"` + Versions *map[string]*VersionsCapability `json:"versions,omitempty"` + Regions *map[string]*RegionsCapability `json:"regions,omitempty"` + Vmsizes *map[string]*VMSizesCapability `json:"vmsizes,omitempty"` + VmsizeFilters *[]VMSizeCompatibilityFilter `json:"vmsize_filters,omitempty"` + Features *[]string `json:"features,omitempty"` + Quota *QuotaCapability `json:"quota,omitempty"` +} + +// Cluster is describes the cluster. +type Cluster struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + Properties *ClusterGetProperties `json:"properties,omitempty"` +} + +// ClusterCreateParametersExtended is the CreateCluster request parameters. +type ClusterCreateParametersExtended struct { + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *ClusterCreateProperties `json:"properties,omitempty"` +} + +// ClusterCreateProperties is the cluster create parameters. +type ClusterCreateProperties struct { + ClusterVersion *string `json:"clusterVersion,omitempty"` + OsType OSType `json:"osType,omitempty"` + Tier Tier `json:"tier,omitempty"` + ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` +} + +// ClusterDefinition is the cluste definition. +type ClusterDefinition struct { + Blueprint *string `json:"blueprint,omitempty"` + Kind *string `json:"kind,omitempty"` + ComponentVersion *map[string]*string `json:"componentVersion,omitempty"` + Configurations *map[string]interface{} `json:"configurations,omitempty"` +} + +// ClusterGetProperties is the properties of cluster. +type ClusterGetProperties struct { + ClusterVersion *string `json:"clusterVersion,omitempty"` + OsType OSType `json:"osType,omitempty"` + Tier Tier `json:"tier,omitempty"` + ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"` + ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + ClusterState *string `json:"clusterState,omitempty"` + QuotaInfo *QuotaInfo `json:"quotaInfo,omitempty"` + Errors *[]Errors `json:"errors,omitempty"` + ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"` +} + +// ClusterListPersistedScriptActionsResult is list PersistedScriptActions +// operations response. +type ClusterListPersistedScriptActionsResult struct { + Value *[]RuntimeScriptAction `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterListResult is the List Cluster operation response. +type ClusterListResult struct { + autorest.Response `json:"-"` + Value *[]Cluster `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClusterListResult) ClusterListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClusterListRuntimeScriptActionDetailResult is the ListScriptExecutionHistory +// response. +type ClusterListRuntimeScriptActionDetailResult struct { + Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterPatchParameters is the PatchCluster request parameters +type ClusterPatchParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ClusterResizeParameters is the Resize Cluster request parameters. +type ClusterResizeParameters struct { + TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"` +} + +// ComputeProfile is describes the compute profile. +type ComputeProfile struct { + Roles *[]Role `json:"roles,omitempty"` +} + +// ConnectivityEndpoint is the connectivity properties +type ConnectivityEndpoint struct { + Name *string `json:"name,omitempty"` + Protocol *string `json:"protocol,omitempty"` + Location *string `json:"location,omitempty"` + Port *int32 `json:"port,omitempty"` +} + +// Errors is the error message associated with the cluster creation. +type Errors struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ExecuteScriptActionParameters is describes the script actions on a running +// cluster. +type ExecuteScriptActionParameters struct { + ScriptActions *[]RuntimeScriptAction `json:"scriptActions,omitempty"` + PersistOnSuccess *string `json:"persistOnSuccess,omitempty"` +} + +// Extension is cluster monitoring extensions +type Extension struct { + autorest.Response `json:"-"` + WorkspaceID *string `json:"workspaceId,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` +} + +// HardwareProfile is describes the hardware profile. +type HardwareProfile struct { + VMSize *string `json:"vmSize,omitempty"` +} + +// HTTPConnectivitySettings is the payload for a Configure HTTP settings +// request. +type HTTPConnectivitySettings struct { + autorest.Response `json:"-"` + EnabledCredential *string `json:"restAuthCredential.isEnabled,omitempty"` + Username *string `json:"restAuthCredential.username,omitempty"` + Password *string `json:"restAuthCredential.password,omitempty"` +} + +// HTTPSettingsParameters is the payload for a Configure HTTP settings request. +type HTTPSettingsParameters struct { + RestAuthCredentialisEnabled *string `json:"restAuthCredential.isEnabled,omitempty"` + RestAuthCredentialusername *string `json:"restAuthCredential.username,omitempty"` + RestAuthCredentialpassword *string `json:"restAuthCredential.password,omitempty"` +} + +// LinuxOperatingSystemProfile is the ssh username, password, and ssh public +// key. +type LinuxOperatingSystemProfile struct { + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + SSHProfile *SSHProfile `json:"sshProfile,omitempty"` +} + +// Operation is hDInsight REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list HDInsight operations. +// It contains a list of operations and a URL link to get the next set of +// results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OperationResource is the azure async operation response. +type OperationResource struct { + Status AsyncOperationState `json:"status,omitempty"` + Error *Errors `json:"error,omitempty"` +} + +// OsProfile is the Windows operation systems profile, and configure remote +// desktop settings. +type OsProfile struct { + WindowsOperatingSystemProfile *WindowsOperatingSystemProfile `json:"windowsOperatingSystemProfile,omitempty"` + LinuxOperatingSystemProfile *LinuxOperatingSystemProfile `json:"linuxOperatingSystemProfile,omitempty"` +} + +// QuotaCapability is the regional quota capability. +type QuotaCapability struct { + RegionalQuotas *[]RegionalQuotaCapability `json:"regionalQuotas,omitempty"` +} + +// QuotaInfo is gets or sets Quota properties for the cluster. +type QuotaInfo struct { + CoresUsed *int32 `json:"coresUsed,omitempty"` +} + +// RdpSettings is the RDP settings for the windows cluster. +type RdpSettings struct { + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` + ExpiryDate *date.Date `json:"expiryDate,omitempty"` +} + +// RDPSettingsParameters is parameters specifying the data factory gateway +// definition for a create or update operation. +type RDPSettingsParameters struct { + OsProfile *OsProfile `json:"osProfile,omitempty"` +} + +// RegionalQuotaCapability is the regional quota capacity. +type RegionalQuotaCapability struct { + RegionName *string `json:"region_name,omitempty"` + CoresUsed *int64 `json:"cores_used,omitempty"` + CoresAvailable *int64 `json:"cores_available,omitempty"` +} + +// RegionsCapability is the regions capability. +type RegionsCapability struct { + Available *[]string `json:"available,omitempty"` +} + +// Resource is the resource definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Role is describes a role on the cluster. +type Role struct { + Name *string `json:"name,omitempty"` + MinInstanceCount *int32 `json:"minInstanceCount,omitempty"` + TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + OsProfile *OsProfile `json:"osProfile,omitempty"` + VirtualNetworkProfile *VirtualNetworkProfile `json:"virtualNetworkProfile,omitempty"` + ScriptActions *[]ScriptAction `json:"scriptActions,omitempty"` +} + +// RuntimeScriptAction is describes a script action on a running cluster. +type RuntimeScriptAction struct { + Name *string `json:"name,omitempty"` + URI *string `json:"uri,omitempty"` + Parameters *string `json:"parameters,omitempty"` + Roles *[]string `json:"roles,omitempty"` + ApplicationName *string `json:"applicationName,omitempty"` +} + +// RuntimeScriptActionDetail is describes the execution details of a script +// action. +type RuntimeScriptActionDetail struct { + autorest.Response `json:"-"` + ScriptExecutionID *int64 `json:"scriptExecutionId,omitempty"` + StartTime *string `json:"startTime,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Status *string `json:"status,omitempty"` + Operation *string `json:"operation,omitempty"` + ExecutionSummary *[]ScriptActionExecutionSummary `json:"executionSummary,omitempty"` + DebugInformation *string `json:"debugInformation,omitempty"` + Name *string `json:"name,omitempty"` + URI *string `json:"uri,omitempty"` + Parameters *string `json:"parameters,omitempty"` + Roles *[]string `json:"roles,omitempty"` + ApplicationName *string `json:"applicationName,omitempty"` +} + +// ScriptAction is describes a script action on role on the cluster. +type ScriptAction struct { + Name *string `json:"name,omitempty"` + URI *string `json:"uri,omitempty"` + Parameters *string `json:"parameters,omitempty"` +} + +// ScriptActionExecutionHistoryList is the ListScriptExecutionHistory response. +type ScriptActionExecutionHistoryList struct { + autorest.Response `json:"-"` + Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ScriptActionExecutionHistoryListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ScriptActionExecutionHistoryList) ScriptActionExecutionHistoryListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ScriptActionExecutionSummary is describes the execution summary of a script +// action. +type ScriptActionExecutionSummary struct { + Status *string `json:"status,omitempty"` + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// ScriptActionPersistedGetResponseSpec is the persisted script action for +// cluster +type ScriptActionPersistedGetResponseSpec struct { + Name *string `json:"name,omitempty"` + URI *string `json:"uri,omitempty"` + Parameters *string `json:"parameters,omitempty"` + Roles *[]string `json:"roles,omitempty"` + ApplicationName *string `json:"applicationName,omitempty"` +} + +// ScriptActionsList is all persisted script action for the cluster. +type ScriptActionsList struct { + autorest.Response `json:"-"` + Value *[]RuntimeScriptActionDetail `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ScriptActionsListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ScriptActionsList) ScriptActionsListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SecurityProfile is the security profile which contains Ssh public key for +// the HDInsight cluster. +type SecurityProfile struct { + DirectoryType DirectoryType `json:"directoryType,omitempty"` + Domain *string `json:"domain,omitempty"` + OrganizationalUnitDN *string `json:"organizationalUnitDN,omitempty"` + LdapsUrls *[]string `json:"ldapsUrls,omitempty"` + DomainUsername *string `json:"domainUsername,omitempty"` + DomainUserPassword *string `json:"domainUserPassword,omitempty"` + ClusterUsersGroupDNS *[]string `json:"clusterUsersGroupDNs,omitempty"` +} + +// SSHProfile is the list of Ssh public keys. +type SSHProfile struct { + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey is the Ssh public key for the cluster nodes. +type SSHPublicKey struct { + CertificateData *string `json:"certificateData,omitempty"` +} + +// StorageAccount is describes the storage Account. +type StorageAccount struct { + Name *string `json:"name,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + Container *string `json:"container,omitempty"` + Key *string `json:"key,omitempty"` +} + +// StorageProfile is describes the storage profile. +type StorageProfile struct { + Storageaccounts *[]StorageAccount `json:"storageaccounts,omitempty"` +} + +// SubResource is the sub resource definition. +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// VersionsCapability is the version capability. +type VersionsCapability struct { + Available *[]VersionSpec `json:"available,omitempty"` +} + +// VersionSpec is gets or sets Version spec properties. +type VersionSpec struct { + FriendlyName *string `json:"friendlyName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IsDefault *string `json:"isDefault,omitempty"` + ComponentVersions *map[string]*string `json:"componentVersions,omitempty"` +} + +// VirtualNetworkProfile is the Virtual network properties. +type VirtualNetworkProfile struct { + ID *string `json:"id,omitempty"` + Subnet *string `json:"subnet,omitempty"` +} + +// VMSizeCompatibilityFilter is the virtual machine type compatibility filter. +type VMSizeCompatibilityFilter struct { + FilterMode *string `json:"FilterMode,omitempty"` + Regions *[]string `json:"Regions,omitempty"` + ClusterFlavors *[]string `json:"ClusterFlavors,omitempty"` + NodeTypes *[]string `json:"NodeTypes,omitempty"` + ClusterVersions *[]string `json:"ClusterVersions,omitempty"` + Vmsizes *[]string `json:"vmsizes,omitempty"` +} + +// VMSizesCapability is the virtual machine sizes capability. +type VMSizesCapability struct { + Available *[]string `json:"available,omitempty"` +} + +// WindowsOperatingSystemProfile is the Windows operation system settings. +type WindowsOperatingSystemProfile struct { + RdpSettings *RdpSettings `json:"rdpSettings,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/operations.go index cf7a7a04cb..ee3e33792a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/operations.go @@ -1,122 +1,122 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the the HDInsight Management Client. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available HDInsight REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.HDInsight/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the the HDInsight Management Client. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available HDInsight REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.HDInsight/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptactions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptactions.go index ae84a09c93..9b5917edfa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptactions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptactions.go @@ -1,198 +1,198 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ScriptActionsClient is the the HDInsight Management Client. -type ScriptActionsClient struct { - ManagementClient -} - -// NewScriptActionsClient creates an instance of the ScriptActionsClient -// client. -func NewScriptActionsClient(subscriptionID string) ScriptActionsClient { - return NewScriptActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScriptActionsClientWithBaseURI creates an instance of the -// ScriptActionsClient client. -func NewScriptActionsClientWithBaseURI(baseURI string, subscriptionID string) ScriptActionsClient { - return ScriptActionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a given persisted script action of the cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. scriptName is the name of the script. -func (client ScriptActionsClient) Delete(resourceGroupName string, clusterName string, scriptName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, clusterName, scriptName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScriptActionsClient) DeletePreparer(resourceGroupName string, clusterName string, scriptName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptName": autorest.Encode("path", scriptName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptActionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ScriptActionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all persisted script actions for the given cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. -func (client ScriptActionsClient) List(resourceGroupName string, clusterName string) (result ScriptActionsList, err error) { - req, err := client.ListPreparer(resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ScriptActionsClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptActionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ScriptActionsClient) ListResponder(resp *http.Response) (result ScriptActionsList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ScriptActionsClient) ListNextResults(lastResults ScriptActionsList) (result ScriptActionsList, err error) { - req, err := lastResults.ScriptActionsListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ScriptActionsClient is the the HDInsight Management Client. +type ScriptActionsClient struct { + ManagementClient +} + +// NewScriptActionsClient creates an instance of the ScriptActionsClient +// client. +func NewScriptActionsClient(subscriptionID string) ScriptActionsClient { + return NewScriptActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScriptActionsClientWithBaseURI creates an instance of the +// ScriptActionsClient client. +func NewScriptActionsClientWithBaseURI(baseURI string, subscriptionID string) ScriptActionsClient { + return ScriptActionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes a given persisted script action of the cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. scriptName is the name of the script. +func (client ScriptActionsClient) Delete(resourceGroupName string, clusterName string, scriptName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, clusterName, scriptName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ScriptActionsClient) DeletePreparer(resourceGroupName string, clusterName string, scriptName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scriptName": autorest.Encode("path", scriptName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptActionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ScriptActionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// List lists all persisted script actions for the given cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. +func (client ScriptActionsClient) List(resourceGroupName string, clusterName string) (result ScriptActionsList, err error) { + req, err := client.ListPreparer(resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ScriptActionsClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptActionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ScriptActionsClient) ListResponder(resp *http.Response) (result ScriptActionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ScriptActionsClient) ListNextResults(lastResults ScriptActionsList) (result ScriptActionsList, err error) { + req, err := lastResults.ScriptActionsListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptexecutionhistory.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptexecutionhistory.go index 990bf3aead..dd06c170c6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptexecutionhistory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/scriptexecutionhistory.go @@ -1,265 +1,265 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ScriptExecutionHistoryClient is the the HDInsight Management Client. -type ScriptExecutionHistoryClient struct { - ManagementClient -} - -// NewScriptExecutionHistoryClient creates an instance of the -// ScriptExecutionHistoryClient client. -func NewScriptExecutionHistoryClient(subscriptionID string) ScriptExecutionHistoryClient { - return NewScriptExecutionHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScriptExecutionHistoryClientWithBaseURI creates an instance of the -// ScriptExecutionHistoryClient client. -func NewScriptExecutionHistoryClientWithBaseURI(baseURI string, subscriptionID string) ScriptExecutionHistoryClient { - return ScriptExecutionHistoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the script execution detail for the given script execution id. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. scriptExecutionID is the script execution Id -func (client ScriptExecutionHistoryClient) Get(resourceGroupName string, clusterName string, scriptExecutionID string) (result RuntimeScriptActionDetail, err error) { - req, err := client.GetPreparer(resourceGroupName, clusterName, scriptExecutionID) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScriptExecutionHistoryClient) GetPreparer(resourceGroupName string, clusterName string, scriptExecutionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptExecutionId": autorest.Encode("path", scriptExecutionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptExecutionHistoryClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ScriptExecutionHistoryClient) GetResponder(resp *http.Response) (result RuntimeScriptActionDetail, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all scripts execution history for the given cluster. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. -func (client ScriptExecutionHistoryClient) List(resourceGroupName string, clusterName string) (result ScriptActionExecutionHistoryList, err error) { - req, err := client.ListPreparer(resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ScriptExecutionHistoryClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptExecutionHistoryClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ScriptExecutionHistoryClient) ListResponder(resp *http.Response) (result ScriptActionExecutionHistoryList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ScriptExecutionHistoryClient) ListNextResults(lastResults ScriptActionExecutionHistoryList) (result ScriptActionExecutionHistoryList, err error) { - req, err := lastResults.ScriptActionExecutionHistoryListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Promote promote ad-hoc script execution to a persisted script. -// -// resourceGroupName is the name of the resource group. clusterName is the name -// of the cluster. scriptExecutionID is the script execution Id -func (client ScriptExecutionHistoryClient) Promote(resourceGroupName string, clusterName string, scriptExecutionID int64) (result autorest.Response, err error) { - req, err := client.PromotePreparer(resourceGroupName, clusterName, scriptExecutionID) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", nil, "Failure preparing request") - return - } - - resp, err := client.PromoteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure sending request") - return - } - - result, err = client.PromoteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure responding to request") - } - - return -} - -// PromotePreparer prepares the Promote request. -func (client ScriptExecutionHistoryClient) PromotePreparer(resourceGroupName string, clusterName string, scriptExecutionID int64) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptExecutionId": autorest.Encode("path", scriptExecutionID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PromoteSender sends the Promote request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptExecutionHistoryClient) PromoteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PromoteResponder handles the response to the Promote request. The method always -// closes the http.Response Body. -func (client ScriptExecutionHistoryClient) PromoteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ScriptExecutionHistoryClient is the the HDInsight Management Client. +type ScriptExecutionHistoryClient struct { + ManagementClient +} + +// NewScriptExecutionHistoryClient creates an instance of the +// ScriptExecutionHistoryClient client. +func NewScriptExecutionHistoryClient(subscriptionID string) ScriptExecutionHistoryClient { + return NewScriptExecutionHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScriptExecutionHistoryClientWithBaseURI creates an instance of the +// ScriptExecutionHistoryClient client. +func NewScriptExecutionHistoryClientWithBaseURI(baseURI string, subscriptionID string) ScriptExecutionHistoryClient { + return ScriptExecutionHistoryClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the script execution detail for the given script execution id. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. scriptExecutionID is the script execution Id +func (client ScriptExecutionHistoryClient) Get(resourceGroupName string, clusterName string, scriptExecutionID string) (result RuntimeScriptActionDetail, err error) { + req, err := client.GetPreparer(resourceGroupName, clusterName, scriptExecutionID) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ScriptExecutionHistoryClient) GetPreparer(resourceGroupName string, clusterName string, scriptExecutionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scriptExecutionId": autorest.Encode("path", scriptExecutionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptExecutionHistoryClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ScriptExecutionHistoryClient) GetResponder(resp *http.Response) (result RuntimeScriptActionDetail, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all scripts execution history for the given cluster. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. +func (client ScriptExecutionHistoryClient) List(resourceGroupName string, clusterName string) (result ScriptActionExecutionHistoryList, err error) { + req, err := client.ListPreparer(resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ScriptExecutionHistoryClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptExecutionHistoryClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ScriptExecutionHistoryClient) ListResponder(resp *http.Response) (result ScriptActionExecutionHistoryList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ScriptExecutionHistoryClient) ListNextResults(lastResults ScriptActionExecutionHistoryList) (result ScriptActionExecutionHistoryList, err error) { + req, err := lastResults.ScriptActionExecutionHistoryListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Promote promote ad-hoc script execution to a persisted script. +// +// resourceGroupName is the name of the resource group. clusterName is the name +// of the cluster. scriptExecutionID is the script execution Id +func (client ScriptExecutionHistoryClient) Promote(resourceGroupName string, clusterName string, scriptExecutionID int64) (result autorest.Response, err error) { + req, err := client.PromotePreparer(resourceGroupName, clusterName, scriptExecutionID) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", nil, "Failure preparing request") + return + } + + resp, err := client.PromoteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure sending request") + return + } + + result, err = client.PromoteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure responding to request") + } + + return +} + +// PromotePreparer prepares the Promote request. +func (client ScriptExecutionHistoryClient) PromotePreparer(resourceGroupName string, clusterName string, scriptExecutionID int64) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scriptExecutionId": autorest.Encode("path", scriptExecutionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PromoteSender sends the Promote request. The method will close the +// http.Response Body if it receives an error. +func (client ScriptExecutionHistoryClient) PromoteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PromoteResponder handles the response to the Promote request. The method always +// closes the http.Response Body. +func (client ScriptExecutionHistoryClient) PromoteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/version.go index 38fee8af42..9346b53d71 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/hdinsight/version.go @@ -1,29 +1,29 @@ -package hdinsight - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-hdinsight/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package hdinsight + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-hdinsight/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertruleincidents.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertruleincidents.go index b6cf5c8419..5be1fc5e80 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertruleincidents.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertruleincidents.go @@ -1,176 +1,176 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// AlertRuleIncidentsClient is the composite Swagger for Insights Management -// Client -type AlertRuleIncidentsClient struct { - ManagementClient -} - -// NewAlertRuleIncidentsClient creates an instance of the -// AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the -// AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. incidentName is the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - req, err := client.GetPreparer(resourceGroupName, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRuleIncidentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - req, err := client.ListByAlertRulePreparer(resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always -// closes the http.Response Body. -func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AlertRuleIncidentsClient is the composite Swagger for Insights Management +// Client +type AlertRuleIncidentsClient struct { + ManagementClient +} + +// NewAlertRuleIncidentsClient creates an instance of the +// AlertRuleIncidentsClient client. +func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { + return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the +// AlertRuleIncidentsClient client. +func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { + return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an incident associated to an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. incidentName is the name of the incident to retrieve. +func (client AlertRuleIncidentsClient) Get(resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { + req, err := client.GetPreparer(resourceGroupName, ruleName, incidentName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRuleIncidentsClient) GetPreparer(resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentName": autorest.Encode("path", incidentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleIncidentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAlertRule gets a list of incidents associated to an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. +func (client AlertRuleIncidentsClient) ListByAlertRule(resourceGroupName string, ruleName string) (result IncidentListResult, err error) { + req, err := client.ListByAlertRulePreparer(resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAlertRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") + return + } + + result, err = client.ListByAlertRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") + } + + return +} + +// ListByAlertRulePreparer prepares the ListByAlertRule request. +func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always +// closes the http.Response Body. +func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertrules.go index 27ffd1e456..1e3e5f2838 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/alertrules.go @@ -1,321 +1,321 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AlertRulesClient is the composite Swagger for Insights Management Client -type AlertRulesClient struct { - ManagementClient -} - -// NewAlertRulesClient creates an instance of the AlertRulesClient client. -func NewAlertRulesClient(subscriptionID string) AlertRulesClient { - return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient -// client. -func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { - return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an alert rule. -// Request method: PUT Request URI: -// https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/alertRules/{alert-rule-name}?api-version={api-version} -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. parameters is the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.AlertRulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. -func (client AlertRulesClient) Delete(resourceGroupName string, ruleName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. -func (client AlertRulesClient) Get(resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { - req, err := client.GetPreparer(resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the alert rules within a resource group. -// -// resourceGroupName is the name of the resource group. filter is the filter to -// apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client AlertRulesClient) ListByResourceGroup(resourceGroupName string, filter string) (result AlertRuleResourceCollection, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) ListByResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AlertRulesClient is the composite Swagger for Insights Management Client +type AlertRulesClient struct { + ManagementClient +} + +// NewAlertRulesClient creates an instance of the AlertRulesClient client. +func NewAlertRulesClient(subscriptionID string) AlertRulesClient { + return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient +// client. +func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { + return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an alert rule. +// Request method: PUT Request URI: +// https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/alertRules/{alert-rule-name}?api-version={api-version} +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. parameters is the parameters of the rule to create or update. +func (client AlertRulesClient) CreateOrUpdate(resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "insights.AlertRulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AlertRulesClient) CreateOrUpdatePreparer(resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. +func (client AlertRulesClient) Delete(resourceGroupName string, ruleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AlertRulesClient) DeletePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. +func (client AlertRulesClient) Get(resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { + req, err := client.GetPreparer(resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRulesClient) GetPreparer(resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list the alert rules within a resource group. +// +// resourceGroupName is the name of the resource group. filter is the filter to +// apply on the operation. For more information please see +// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx +func (client AlertRulesClient) ListByResourceGroup(resourceGroupName string, filter string) (result AlertRuleResourceCollection, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AlertRulesClient) ListByResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/autoscalesettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/autoscalesettings.go index f51a3991e5..f25b210700 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/autoscalesettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/autoscalesettings.go @@ -1,347 +1,347 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AutoscaleSettingsClient is the composite Swagger for Insights Management -// Client -type AutoscaleSettingsClient struct { - ManagementClient -} - -// NewAutoscaleSettingsClient creates an instance of the -// AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the -// AutoscaleSettingsClient client. -func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// -// resourceGroupName is the name of the resource group. autoscaleSettingName is -// the autoscale setting name. parameters is parameters supplied to the -// operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - {Target: "parameters.AutoscaleSetting.Name", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes and autoscale setting -// -// resourceGroupName is the name of the resource group. autoscaleSettingName is -// the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an autoscale setting -// -// resourceGroupName is the name of the resource group. autoscaleSettingName is -// the autoscale setting name. -func (client AutoscaleSettingsClient) Get(resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - req, err := client.GetPreparer(resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// -// resourceGroupName is the name of the resource group. filter is the filter to -// apply on the operation. For more information please see -// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx -func (client AutoscaleSettingsClient) ListByResourceGroup(resourceGroupName string, filter string) (result AutoscaleSettingResourceCollection, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AutoscaleSettingsClient) ListByResourceGroupNextResults(lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.AutoscaleSettingResourceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AutoscaleSettingsClient is the composite Swagger for Insights Management +// Client +type AutoscaleSettingsClient struct { + ManagementClient +} + +// NewAutoscaleSettingsClient creates an instance of the +// AutoscaleSettingsClient client. +func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { + return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAutoscaleSettingsClientWithBaseURI creates an instance of the +// AutoscaleSettingsClient client. +func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { + return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an autoscale setting. +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is +// the autoscale setting name. parameters is parameters supplied to the +// operation. +func (client AutoscaleSettingsClient) CreateOrUpdate(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, + {Target: "parameters.AutoscaleSetting.Name", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, autoscaleSettingName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes and autoscale setting +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is +// the autoscale setting name. +func (client AutoscaleSettingsClient) Delete(resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutoscaleSettingsClient) DeletePreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an autoscale setting +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is +// the autoscale setting name. +func (client AutoscaleSettingsClient) Get(resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { + req, err := client.GetPreparer(resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutoscaleSettingsClient) GetPreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists the autoscale settings for a resource group +// +// resourceGroupName is the name of the resource group. filter is the filter to +// apply on the operation. For more information please see +// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx +func (client AutoscaleSettingsClient) ListByResourceGroup(resourceGroupName string, filter string) (result AutoscaleSettingResourceCollection, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AutoscaleSettingsClient) ListByResourceGroupNextResults(lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { + req, err := lastResults.AutoscaleSettingResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/client.go index b78f0c6073..1543209fb4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/client.go @@ -1,52 +1,52 @@ -// Package insights implements the Azure ARM Insights service API version . -// -// Composite Swagger for Insights Management Client -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Insights - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Insights. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package insights implements the Azure ARM Insights service API version . +// +// Composite Swagger for Insights Management Client +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Insights + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Insights. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/logprofiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/logprofiles.go index 73b5d02d16..e17e1d470d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/logprofiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/logprofiles.go @@ -1,309 +1,309 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LogProfilesClient is the composite Swagger for Insights Management Client -type LogProfilesClient struct { - ManagementClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient -// client. -func NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// -// logProfileName is the name of the log profile. parameters is parameters -// supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.LogProfilesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the log profile. -// -// logProfileName is the name of the log profile. -func (client LogProfilesClient) Delete(logProfileName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the log profile. -// -// logProfileName is the name of the log profile. -func (client LogProfilesClient) Get(logProfileName string) (result LogProfileResource, err error) { - req, err := client.GetPreparer(logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List() (result LogProfileCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LogProfilesClient is the composite Swagger for Insights Management Client +type LogProfilesClient struct { + ManagementClient +} + +// NewLogProfilesClient creates an instance of the LogProfilesClient client. +func NewLogProfilesClient(subscriptionID string) LogProfilesClient { + return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient +// client. +func NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { + return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. +// +// logProfileName is the name of the log profile. parameters is parameters +// supplied to the operation. +func (client LogProfilesClient) CreateOrUpdate(logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "insights.LogProfilesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(logProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LogProfilesClient) CreateOrUpdatePreparer(logProfileName string, parameters LogProfileResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the log profile. +// +// logProfileName is the name of the log profile. +func (client LogProfilesClient) Delete(logProfileName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LogProfilesClient) DeletePreparer(logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the log profile. +// +// logProfileName is the name of the log profile. +func (client LogProfilesClient) Get(logProfileName string) (result LogProfileResource, err error) { + req, err := client.GetPreparer(logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LogProfilesClient) GetPreparer(logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the log profiles. +func (client LogProfilesClient) List() (result LogProfileCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client LogProfilesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/models.go index 7ecea01d6e..06690e29ab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/models.go @@ -1,511 +1,511 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals specifies the equals state for comparison operation type. - Equals ComparisonOperationType = "Equals" - // GreaterThan specifies the greater than state for comparison operation - // type. - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual specifies the greater than or equal state for - // comparison operation type. - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan specifies the less than state for comparison operation type. - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual specifies the less than or equal state for comparison - // operation type. - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals specifies the not equals state for comparison operation type. - NotEquals ComparisonOperationType = "NotEquals" -) - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan specifies the condition operator greater - // than state for condition operator. - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual specifies the condition operator - // greater than or equal state for condition operator. - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan specifies the condition operator less than - // state for condition operator. - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual specifies the condition operator less - // than or equal state for condition operator. - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // Average specifies the average state for metric statistic type. - Average MetricStatisticType = "Average" - // Max specifies the max state for metric statistic type. - Max MetricStatisticType = "Max" - // Min specifies the min state for metric statistic type. - Min MetricStatisticType = "Min" - // Sum specifies the sum state for metric statistic type. - Sum MetricStatisticType = "Sum" -) - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // Day specifies the day state for recurrence frequency. - Day RecurrenceFrequency = "Day" - // Hour specifies the hour state for recurrence frequency. - Hour RecurrenceFrequency = "Hour" - // Minute specifies the minute state for recurrence frequency. - Minute RecurrenceFrequency = "Minute" - // Month specifies the month state for recurrence frequency. - Month RecurrenceFrequency = "Month" - // None specifies the none state for recurrence frequency. - None RecurrenceFrequency = "None" - // Second specifies the second state for recurrence frequency. - Second RecurrenceFrequency = "Second" - // Week specifies the week state for recurrence frequency. - Week RecurrenceFrequency = "Week" - // Year specifies the year state for recurrence frequency. - Year RecurrenceFrequency = "Year" -) - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease specifies the scale direction decrease state for - // scale direction. - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease specifies the scale direction increase state for - // scale direction. - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone specifies the scale direction none state for scale - // direction. - ScaleDirectionNone ScaleDirection = "None" -) - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount specifies the change count state for scale type. - ChangeCount ScaleType = "ChangeCount" - // ExactCount specifies the exact count state for scale type. - ExactCount ScaleType = "ExactCount" - // PercentChangeCount specifies the percent change count state for scale - // type. - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage specifies the time aggregation operator - // average state for time aggregation operator. - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast specifies the time aggregation operator last - // state for time aggregation operator. - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum specifies the time aggregation operator - // maximum state for time aggregation operator. - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum specifies the time aggregation operator - // minimum state for time aggregation operator. - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal specifies the time aggregation operator - // total state for time aggregation operator. - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage specifies the time aggregation type average - // state for time aggregation type. - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount specifies the time aggregation type count state - // for time aggregation type. - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeMaximum specifies the time aggregation type maximum - // state for time aggregation type. - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum specifies the time aggregation type minimum - // state for time aggregation type. - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal specifies the time aggregation type total state - // for time aggregation type. - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// AlertRule is an alert rule. -type AlertRule struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - IsEnabled *bool `json:"isEnabled,omitempty"` - Condition *RuleCondition `json:"condition,omitempty"` - Actions *[]RuleAction `json:"actions,omitempty"` - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// AlertRuleResource is the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AlertRule `json:"properties,omitempty"` -} - -// AlertRuleResourceCollection is represents a collection of alert rule -// resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AutoscaleNotification is autoscale notification. -type AutoscaleNotification struct { - Operation *string `json:"operation,omitempty"` - Email *EmailNotification `json:"email,omitempty"` - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile is autoscale profile. -type AutoscaleProfile struct { - Name *string `json:"name,omitempty"` - Capacity *ScaleCapacity `json:"capacity,omitempty"` - Rules *[]ScaleRule `json:"rules,omitempty"` - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting is a setting that contains all of the configuration for the -// automatic scaling of a resource. -type AutoscaleSetting struct { - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Name *string `json:"name,omitempty"` - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource is the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AutoscaleSetting `json:"properties,omitempty"` -} - -// AutoscaleSettingResourceCollection is represents a collection of autoscale -// setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AutoscaleSettingResourceCollection) AutoscaleSettingResourceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// EmailNotification is email notification of an autoscale event. -type EmailNotification struct { - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// Incident is an alert incident indicates the activation status of an alert -// rule. -type Incident struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - RuleName *string `json:"ruleName,omitempty"` - IsActive *bool `json:"isActive,omitempty"` - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// IncidentListResult is the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - Value *[]Incident `json:"value,omitempty"` -} - -// LocationThresholdRuleCondition is a rule condition based on a certain number -// of locations failing. -type LocationThresholdRuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` -} - -// LogProfileCollection is represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties is the log profile properties. -type LogProfileProperties struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - Locations *[]string `json:"locations,omitempty"` - Categories *[]string `json:"categories,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource is the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LogProfileProperties `json:"properties,omitempty"` -} - -// LogSettings is part of MultiTenantDiagnosticSettings. Specifies the settings -// for a particular log. -type LogSettings struct { - Category *string `json:"category,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// ManagementEventAggregationCondition is how the data that is collected should -// be combined over time. -type ManagementEventAggregationCondition struct { - Operator ConditionOperator `json:"operator,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition is a management event rule condition. -type ManagementEventRuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` -} - -// MetricSettings is part of MultiTenantDiagnosticSettings. Specifies the -// settings for a particular metric. -type MetricSettings struct { - TimeGrain *string `json:"timeGrain,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger is the trigger that results in a scaling action. -type MetricTrigger struct { - MetricName *string `json:"metricName,omitempty"` - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - TimeGrain *string `json:"timeGrain,omitempty"` - Statistic MetricStatisticType `json:"statistic,omitempty"` - TimeWindow *string `json:"timeWindow,omitempty"` - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - Operator ComparisonOperationType `json:"operator,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` -} - -// Recurrence is the repeating times at which this profile begins. This element -// is not used if the FixedDate element is used. -type Recurrence struct { - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule is the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - TimeZone *string `json:"timeZone,omitempty"` - Days *[]string `json:"days,omitempty"` - Hours *[]int32 `json:"hours,omitempty"` - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource is an azure resource object -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RetentionPolicy is specifies the retention policy for the log. -type RetentionPolicy struct { - Enabled *bool `json:"enabled,omitempty"` - Days *int32 `json:"days,omitempty"` -} - -// RuleAction is the action that is performed when the alert rule becomes -// active, and when an alert condition is resolved. -type RuleAction struct { -} - -// RuleCondition is the condition that results in the alert rule being -// activated. -type RuleCondition struct { -} - -// RuleDataSource is the resource from which the rule collects its data. -type RuleDataSource struct { -} - -// RuleEmailAction is specifies the action to send email when the rule -// condition is evaluated. The discriminator is always RuleEmailAction in this -// case. -type RuleEmailAction struct { - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// RuleManagementEventClaimsDataSource is the claims for a rule management -// event data source. -type RuleManagementEventClaimsDataSource struct { - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource is a rule management event data source. The -// discriminator fields is always RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - EventName *string `json:"eventName,omitempty"` - EventSource *string `json:"eventSource,omitempty"` - Level *string `json:"level,omitempty"` - OperationName *string `json:"operationName,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - ResourceURI *string `json:"resourceUri,omitempty"` - Status *string `json:"status,omitempty"` - SubStatus *string `json:"subStatus,omitempty"` - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` -} - -// RuleMetricDataSource is a rule metric data source. The discriminator value -// is always RuleMetricDataSource in this case. -type RuleMetricDataSource struct { - ResourceURI *string `json:"resourceUri,omitempty"` - MetricName *string `json:"metricName,omitempty"` -} - -// RuleWebhookAction is specifies the action to post to service when the rule -// condition is evaluated. The discriminator is always RuleWebhookAction in -// this case. -type RuleWebhookAction struct { - ServiceURI *string `json:"serviceUri,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} - -// ScaleAction is the parameters for the scaling action. -type ScaleAction struct { - Direction ScaleDirection `json:"direction,omitempty"` - Type ScaleType `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity is the number of instances that can be used during this -// profile. -type ScaleCapacity struct { - Minimum *string `json:"minimum,omitempty"` - Maximum *string `json:"maximum,omitempty"` - Default *string `json:"default,omitempty"` -} - -// ScaleRule is a rule that provide the triggers and parameters for the scaling -// action. -type ScaleRule struct { - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ServiceDiagnosticSettings is the diagnostic settings for service. -type ServiceDiagnosticSettings struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - Metrics *[]MetricSettings `json:"metrics,omitempty"` - Logs *[]LogSettings `json:"logs,omitempty"` - WorkspaceID *string `json:"workspaceId,omitempty"` -} - -// ServiceDiagnosticSettingsResource is description of a service diagnostic -// setting -type ServiceDiagnosticSettingsResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServiceDiagnosticSettings `json:"properties,omitempty"` -} - -// ThresholdRuleCondition is a rule condition based on a metric crossing a -// threshold. -type ThresholdRuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` - Operator ConditionOperator `json:"operator,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` -} - -// TimeWindow is a specific date-time for the profile. -type TimeWindow struct { - TimeZone *string `json:"timeZone,omitempty"` - Start *date.Time `json:"start,omitempty"` - End *date.Time `json:"end,omitempty"` -} - -// WebhookNotification is webhook notification of an autoscale event. -type WebhookNotification struct { - ServiceURI *string `json:"serviceUri,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ComparisonOperationType enumerates the values for comparison operation type. +type ComparisonOperationType string + +const ( + // Equals specifies the equals state for comparison operation type. + Equals ComparisonOperationType = "Equals" + // GreaterThan specifies the greater than state for comparison operation + // type. + GreaterThan ComparisonOperationType = "GreaterThan" + // GreaterThanOrEqual specifies the greater than or equal state for + // comparison operation type. + GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" + // LessThan specifies the less than state for comparison operation type. + LessThan ComparisonOperationType = "LessThan" + // LessThanOrEqual specifies the less than or equal state for comparison + // operation type. + LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" + // NotEquals specifies the not equals state for comparison operation type. + NotEquals ComparisonOperationType = "NotEquals" +) + +// ConditionOperator enumerates the values for condition operator. +type ConditionOperator string + +const ( + // ConditionOperatorGreaterThan specifies the condition operator greater + // than state for condition operator. + ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" + // ConditionOperatorGreaterThanOrEqual specifies the condition operator + // greater than or equal state for condition operator. + ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" + // ConditionOperatorLessThan specifies the condition operator less than + // state for condition operator. + ConditionOperatorLessThan ConditionOperator = "LessThan" + // ConditionOperatorLessThanOrEqual specifies the condition operator less + // than or equal state for condition operator. + ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" +) + +// MetricStatisticType enumerates the values for metric statistic type. +type MetricStatisticType string + +const ( + // Average specifies the average state for metric statistic type. + Average MetricStatisticType = "Average" + // Max specifies the max state for metric statistic type. + Max MetricStatisticType = "Max" + // Min specifies the min state for metric statistic type. + Min MetricStatisticType = "Min" + // Sum specifies the sum state for metric statistic type. + Sum MetricStatisticType = "Sum" +) + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // Day specifies the day state for recurrence frequency. + Day RecurrenceFrequency = "Day" + // Hour specifies the hour state for recurrence frequency. + Hour RecurrenceFrequency = "Hour" + // Minute specifies the minute state for recurrence frequency. + Minute RecurrenceFrequency = "Minute" + // Month specifies the month state for recurrence frequency. + Month RecurrenceFrequency = "Month" + // None specifies the none state for recurrence frequency. + None RecurrenceFrequency = "None" + // Second specifies the second state for recurrence frequency. + Second RecurrenceFrequency = "Second" + // Week specifies the week state for recurrence frequency. + Week RecurrenceFrequency = "Week" + // Year specifies the year state for recurrence frequency. + Year RecurrenceFrequency = "Year" +) + +// ScaleDirection enumerates the values for scale direction. +type ScaleDirection string + +const ( + // ScaleDirectionDecrease specifies the scale direction decrease state for + // scale direction. + ScaleDirectionDecrease ScaleDirection = "Decrease" + // ScaleDirectionIncrease specifies the scale direction increase state for + // scale direction. + ScaleDirectionIncrease ScaleDirection = "Increase" + // ScaleDirectionNone specifies the scale direction none state for scale + // direction. + ScaleDirectionNone ScaleDirection = "None" +) + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ChangeCount specifies the change count state for scale type. + ChangeCount ScaleType = "ChangeCount" + // ExactCount specifies the exact count state for scale type. + ExactCount ScaleType = "ExactCount" + // PercentChangeCount specifies the percent change count state for scale + // type. + PercentChangeCount ScaleType = "PercentChangeCount" +) + +// TimeAggregationOperator enumerates the values for time aggregation operator. +type TimeAggregationOperator string + +const ( + // TimeAggregationOperatorAverage specifies the time aggregation operator + // average state for time aggregation operator. + TimeAggregationOperatorAverage TimeAggregationOperator = "Average" + // TimeAggregationOperatorLast specifies the time aggregation operator last + // state for time aggregation operator. + TimeAggregationOperatorLast TimeAggregationOperator = "Last" + // TimeAggregationOperatorMaximum specifies the time aggregation operator + // maximum state for time aggregation operator. + TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" + // TimeAggregationOperatorMinimum specifies the time aggregation operator + // minimum state for time aggregation operator. + TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" + // TimeAggregationOperatorTotal specifies the time aggregation operator + // total state for time aggregation operator. + TimeAggregationOperatorTotal TimeAggregationOperator = "Total" +) + +// TimeAggregationType enumerates the values for time aggregation type. +type TimeAggregationType string + +const ( + // TimeAggregationTypeAverage specifies the time aggregation type average + // state for time aggregation type. + TimeAggregationTypeAverage TimeAggregationType = "Average" + // TimeAggregationTypeCount specifies the time aggregation type count state + // for time aggregation type. + TimeAggregationTypeCount TimeAggregationType = "Count" + // TimeAggregationTypeMaximum specifies the time aggregation type maximum + // state for time aggregation type. + TimeAggregationTypeMaximum TimeAggregationType = "Maximum" + // TimeAggregationTypeMinimum specifies the time aggregation type minimum + // state for time aggregation type. + TimeAggregationTypeMinimum TimeAggregationType = "Minimum" + // TimeAggregationTypeTotal specifies the time aggregation type total state + // for time aggregation type. + TimeAggregationTypeTotal TimeAggregationType = "Total" +) + +// AlertRule is an alert rule. +type AlertRule struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + Condition *RuleCondition `json:"condition,omitempty"` + Actions *[]RuleAction `json:"actions,omitempty"` + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` +} + +// AlertRuleResource is the alert rule resource. +type AlertRuleResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AlertRule `json:"properties,omitempty"` +} + +// AlertRuleResourceCollection is represents a collection of alert rule +// resources. +type AlertRuleResourceCollection struct { + autorest.Response `json:"-"` + Value *[]AlertRuleResource `json:"value,omitempty"` +} + +// AutoscaleNotification is autoscale notification. +type AutoscaleNotification struct { + Operation *string `json:"operation,omitempty"` + Email *EmailNotification `json:"email,omitempty"` + Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` +} + +// AutoscaleProfile is autoscale profile. +type AutoscaleProfile struct { + Name *string `json:"name,omitempty"` + Capacity *ScaleCapacity `json:"capacity,omitempty"` + Rules *[]ScaleRule `json:"rules,omitempty"` + FixedDate *TimeWindow `json:"fixedDate,omitempty"` + Recurrence *Recurrence `json:"recurrence,omitempty"` +} + +// AutoscaleSetting is a setting that contains all of the configuration for the +// automatic scaling of a resource. +type AutoscaleSetting struct { + Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` + Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Name *string `json:"name,omitempty"` + TargetResourceURI *string `json:"targetResourceUri,omitempty"` +} + +// AutoscaleSettingResource is the autoscale setting resource. +type AutoscaleSettingResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AutoscaleSetting `json:"properties,omitempty"` +} + +// AutoscaleSettingResourceCollection is represents a collection of autoscale +// setting resources. +type AutoscaleSettingResourceCollection struct { + autorest.Response `json:"-"` + Value *[]AutoscaleSettingResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AutoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AutoscaleSettingResourceCollection) AutoscaleSettingResourceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// EmailNotification is email notification of an autoscale event. +type EmailNotification struct { + SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` + SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// Incident is an alert incident indicates the activation status of an alert +// rule. +type Incident struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + RuleName *string `json:"ruleName,omitempty"` + IsActive *bool `json:"isActive,omitempty"` + ActivatedTime *date.Time `json:"activatedTime,omitempty"` + ResolvedTime *date.Time `json:"resolvedTime,omitempty"` +} + +// IncidentListResult is the List incidents operation response. +type IncidentListResult struct { + autorest.Response `json:"-"` + Value *[]Incident `json:"value,omitempty"` +} + +// LocationThresholdRuleCondition is a rule condition based on a certain number +// of locations failing. +type LocationThresholdRuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` + FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` +} + +// LogProfileCollection is represents a collection of log profiles. +type LogProfileCollection struct { + autorest.Response `json:"-"` + Value *[]LogProfileResource `json:"value,omitempty"` +} + +// LogProfileProperties is the log profile properties. +type LogProfileProperties struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Categories *[]string `json:"categories,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// LogProfileResource is the log profile resource. +type LogProfileResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LogProfileProperties `json:"properties,omitempty"` +} + +// LogSettings is part of MultiTenantDiagnosticSettings. Specifies the settings +// for a particular log. +type LogSettings struct { + Category *string `json:"category,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// ManagementEventAggregationCondition is how the data that is collected should +// be combined over time. +type ManagementEventAggregationCondition struct { + Operator ConditionOperator `json:"operator,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` +} + +// ManagementEventRuleCondition is a management event rule condition. +type ManagementEventRuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` + Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` +} + +// MetricSettings is part of MultiTenantDiagnosticSettings. Specifies the +// settings for a particular metric. +type MetricSettings struct { + TimeGrain *string `json:"timeGrain,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// MetricTrigger is the trigger that results in a scaling action. +type MetricTrigger struct { + MetricName *string `json:"metricName,omitempty"` + MetricResourceURI *string `json:"metricResourceUri,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + Statistic MetricStatisticType `json:"statistic,omitempty"` + TimeWindow *string `json:"timeWindow,omitempty"` + TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` + Operator ComparisonOperationType `json:"operator,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` +} + +// Recurrence is the repeating times at which this profile begins. This element +// is not used if the FixedDate element is used. +type Recurrence struct { + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + Schedule *RecurrentSchedule `json:"schedule,omitempty"` +} + +// RecurrentSchedule is the scheduling constraints for when the profile begins. +type RecurrentSchedule struct { + TimeZone *string `json:"timeZone,omitempty"` + Days *[]string `json:"days,omitempty"` + Hours *[]int32 `json:"hours,omitempty"` + Minutes *[]int32 `json:"minutes,omitempty"` +} + +// Resource is an azure resource object +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RetentionPolicy is specifies the retention policy for the log. +type RetentionPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + Days *int32 `json:"days,omitempty"` +} + +// RuleAction is the action that is performed when the alert rule becomes +// active, and when an alert condition is resolved. +type RuleAction struct { +} + +// RuleCondition is the condition that results in the alert rule being +// activated. +type RuleCondition struct { +} + +// RuleDataSource is the resource from which the rule collects its data. +type RuleDataSource struct { +} + +// RuleEmailAction is specifies the action to send email when the rule +// condition is evaluated. The discriminator is always RuleEmailAction in this +// case. +type RuleEmailAction struct { + SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// RuleManagementEventClaimsDataSource is the claims for a rule management +// event data source. +type RuleManagementEventClaimsDataSource struct { + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// RuleManagementEventDataSource is a rule management event data source. The +// discriminator fields is always RuleManagementEventDataSource in this case. +type RuleManagementEventDataSource struct { + EventName *string `json:"eventName,omitempty"` + EventSource *string `json:"eventSource,omitempty"` + Level *string `json:"level,omitempty"` + OperationName *string `json:"operationName,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + ResourceProviderName *string `json:"resourceProviderName,omitempty"` + ResourceURI *string `json:"resourceUri,omitempty"` + Status *string `json:"status,omitempty"` + SubStatus *string `json:"subStatus,omitempty"` + Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` +} + +// RuleMetricDataSource is a rule metric data source. The discriminator value +// is always RuleMetricDataSource in this case. +type RuleMetricDataSource struct { + ResourceURI *string `json:"resourceUri,omitempty"` + MetricName *string `json:"metricName,omitempty"` +} + +// RuleWebhookAction is specifies the action to post to service when the rule +// condition is evaluated. The discriminator is always RuleWebhookAction in +// this case. +type RuleWebhookAction struct { + ServiceURI *string `json:"serviceUri,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} + +// ScaleAction is the parameters for the scaling action. +type ScaleAction struct { + Direction ScaleDirection `json:"direction,omitempty"` + Type ScaleType `json:"type,omitempty"` + Value *string `json:"value,omitempty"` + Cooldown *string `json:"cooldown,omitempty"` +} + +// ScaleCapacity is the number of instances that can be used during this +// profile. +type ScaleCapacity struct { + Minimum *string `json:"minimum,omitempty"` + Maximum *string `json:"maximum,omitempty"` + Default *string `json:"default,omitempty"` +} + +// ScaleRule is a rule that provide the triggers and parameters for the scaling +// action. +type ScaleRule struct { + MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` + ScaleAction *ScaleAction `json:"scaleAction,omitempty"` +} + +// ServiceDiagnosticSettings is the diagnostic settings for service. +type ServiceDiagnosticSettings struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + Metrics *[]MetricSettings `json:"metrics,omitempty"` + Logs *[]LogSettings `json:"logs,omitempty"` + WorkspaceID *string `json:"workspaceId,omitempty"` +} + +// ServiceDiagnosticSettingsResource is description of a service diagnostic +// setting +type ServiceDiagnosticSettingsResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ServiceDiagnosticSettings `json:"properties,omitempty"` +} + +// ThresholdRuleCondition is a rule condition based on a metric crossing a +// threshold. +type ThresholdRuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` + Operator ConditionOperator `json:"operator,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` + TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` +} + +// TimeWindow is a specific date-time for the profile. +type TimeWindow struct { + TimeZone *string `json:"timeZone,omitempty"` + Start *date.Time `json:"start,omitempty"` + End *date.Time `json:"end,omitempty"` +} + +// WebhookNotification is webhook notification of an autoscale event. +type WebhookNotification struct { + ServiceURI *string `json:"serviceUri,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/servicediagnosticsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/servicediagnosticsettings.go index 9e1af76bb3..bd061a1574 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/servicediagnosticsettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/servicediagnosticsettings.go @@ -1,173 +1,173 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ServiceDiagnosticSettingsClient is the composite Swagger for Insights -// Management Client -type ServiceDiagnosticSettingsClient struct { - ManagementClient -} - -// NewServiceDiagnosticSettingsClient creates an instance of the -// ServiceDiagnosticSettingsClient client. -func NewServiceDiagnosticSettingsClient(subscriptionID string) ServiceDiagnosticSettingsClient { - return NewServiceDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceDiagnosticSettingsClientWithBaseURI creates an instance of the -// ServiceDiagnosticSettingsClient client. -func NewServiceDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ServiceDiagnosticSettingsClient { - return ServiceDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update new diagnostic settings for the specified -// resource. -// -// resourceURI is the identifier of the resource. parameters is parameters -// supplied to the operation. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdate(resourceURI string, parameters ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) { - req, err := client.CreateOrUpdatePreparer(resourceURI, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdatePreparer(resourceURI string, parameters ServiceDiagnosticSettingsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the active diagnostic settings for the specified resource. -// -// resourceURI is the identifier of the resource. -func (client ServiceDiagnosticSettingsClient) Get(resourceURI string) (result ServiceDiagnosticSettingsResource, err error) { - req, err := client.GetPreparer(resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceDiagnosticSettingsClient) GetPreparer(resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceDiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ServiceDiagnosticSettingsClient is the composite Swagger for Insights +// Management Client +type ServiceDiagnosticSettingsClient struct { + ManagementClient +} + +// NewServiceDiagnosticSettingsClient creates an instance of the +// ServiceDiagnosticSettingsClient client. +func NewServiceDiagnosticSettingsClient(subscriptionID string) ServiceDiagnosticSettingsClient { + return NewServiceDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceDiagnosticSettingsClientWithBaseURI creates an instance of the +// ServiceDiagnosticSettingsClient client. +func NewServiceDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ServiceDiagnosticSettingsClient { + return ServiceDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update new diagnostic settings for the specified +// resource. +// +// resourceURI is the identifier of the resource. parameters is parameters +// supplied to the operation. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdate(resourceURI string, parameters ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) { + req, err := client.CreateOrUpdatePreparer(resourceURI, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdatePreparer(resourceURI string, parameters ServiceDiagnosticSettingsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the active diagnostic settings for the specified resource. +// +// resourceURI is the identifier of the resource. +func (client ServiceDiagnosticSettingsClient) Get(resourceURI string) (result ServiceDiagnosticSettingsResource, err error) { + req, err := client.GetPreparer(resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ServiceDiagnosticSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceDiagnosticSettingsClient) GetPreparer(resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2015-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceDiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServiceDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/version.go index 6bfa69376b..7a1506ff50 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/insights/version.go @@ -1,29 +1,29 @@ -package insights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-insights/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-insights/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/android.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/android.go index 0c46138a41..c9813666a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/android.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/android.go @@ -1,875 +1,875 @@ -package intune - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AndroidClient is the microsoft.Intune Resource provider Api features in the -// swagger-2.0 specification -type AndroidClient struct { - ManagementClient -} - -// NewAndroidClient creates an instance of the AndroidClient client. -func NewAndroidClient() AndroidClient { - return NewAndroidClientWithBaseURI(DefaultBaseURI) -} - -// NewAndroidClientWithBaseURI creates an instance of the AndroidClient client. -func NewAndroidClientWithBaseURI(baseURI string) AndroidClient { - return AndroidClient{NewWithBaseURI(baseURI)} -} - -// AddAppForMAMPolicy add app to an AndroidMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy appName is application unique Name parameters is parameters -// supplied to the Create or update app to an android policy operation. -func (client AndroidClient) AddAppForMAMPolicy(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "intune.AndroidClient", "AddAppForMAMPolicy") - } - - req, err := client.AddAppForMAMPolicyPreparer(hostName, policyName, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddAppForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.AddAppForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddAppForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.AddAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddAppForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// AddAppForMAMPolicyPreparer prepares the AddAppForMAMPolicy request. -func (client AndroidClient) AddAppForMAMPolicyPreparer(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/apps/{appName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddAppForMAMPolicySender sends the AddAppForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) AddAppForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddAppForMAMPolicyResponder handles the response to the AddAppForMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) AddAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// AddGroupForMAMPolicy add group to an AndroidMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy groupID is group Id parameters is parameters supplied to the -// Create or update app to an android policy operation. -func (client AndroidClient) AddGroupForMAMPolicy(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "intune.AndroidClient", "AddGroupForMAMPolicy") - } - - req, err := client.AddGroupForMAMPolicyPreparer(hostName, policyName, groupID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddGroupForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.AddGroupForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddGroupForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.AddGroupForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddGroupForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// AddGroupForMAMPolicyPreparer prepares the AddGroupForMAMPolicy request. -func (client AndroidClient) AddGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddGroupForMAMPolicySender sends the AddGroupForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) AddGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddGroupForMAMPolicyResponder handles the response to the AddGroupForMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) AddGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateMAMPolicy creates or updates AndroidMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy parameters is parameters supplied to the Create or update an -// android policy operation. -func (client AndroidClient) CreateOrUpdateMAMPolicy(hostName string, policyName string, parameters AndroidMAMPolicy) (result AndroidMAMPolicy, err error) { - req, err := client.CreateOrUpdateMAMPolicyPreparer(hostName, policyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "CreateOrUpdateMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "CreateOrUpdateMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "CreateOrUpdateMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateMAMPolicyPreparer prepares the CreateOrUpdateMAMPolicy request. -func (client AndroidClient) CreateOrUpdateMAMPolicyPreparer(hostName string, policyName string, parameters AndroidMAMPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateMAMPolicySender sends the CreateOrUpdateMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) CreateOrUpdateMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateMAMPolicyResponder handles the response to the CreateOrUpdateMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) CreateOrUpdateMAMPolicyResponder(resp *http.Response) (result AndroidMAMPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAppForMAMPolicy delete App for Android Policy -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy appName is application unique Name -func (client AndroidClient) DeleteAppForMAMPolicy(hostName string, policyName string, appName string) (result autorest.Response, err error) { - req, err := client.DeleteAppForMAMPolicyPreparer(hostName, policyName, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteAppForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAppForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteAppForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.DeleteAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteAppForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// DeleteAppForMAMPolicyPreparer prepares the DeleteAppForMAMPolicy request. -func (client AndroidClient) DeleteAppForMAMPolicyPreparer(hostName string, policyName string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/apps/{appName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAppForMAMPolicySender sends the DeleteAppForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) DeleteAppForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAppForMAMPolicyResponder handles the response to the DeleteAppForMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) DeleteAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteGroupForMAMPolicy delete Group for Android Policy -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy groupID is application unique Name -func (client AndroidClient) DeleteGroupForMAMPolicy(hostName string, policyName string, groupID string) (result autorest.Response, err error) { - req, err := client.DeleteGroupForMAMPolicyPreparer(hostName, policyName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteGroupForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteGroupForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteGroupForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.DeleteGroupForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteGroupForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// DeleteGroupForMAMPolicyPreparer prepares the DeleteGroupForMAMPolicy request. -func (client AndroidClient) DeleteGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteGroupForMAMPolicySender sends the DeleteGroupForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) DeleteGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteGroupForMAMPolicyResponder handles the response to the DeleteGroupForMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) DeleteGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteMAMPolicy delete Android Policy -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy -func (client AndroidClient) DeleteMAMPolicy(hostName string, policyName string) (result autorest.Response, err error) { - req, err := client.DeleteMAMPolicyPreparer(hostName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.DeleteMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// DeleteMAMPolicyPreparer prepares the DeleteMAMPolicy request. -func (client AndroidClient) DeleteMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteMAMPolicySender sends the DeleteMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) DeleteMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteMAMPolicyResponder handles the response to the DeleteMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) DeleteMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetAppForMAMPolicy get apps for an AndroidMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy filter is the filter to apply on the operation. selectParameter -// is select specific fields in entity. -func (client AndroidClient) GetAppForMAMPolicy(hostName string, policyName string, filter string, top *int32, selectParameter string) (result ApplicationCollection, err error) { - req, err := client.GetAppForMAMPolicyPreparer(hostName, policyName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetAppForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.GetAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// GetAppForMAMPolicyPreparer prepares the GetAppForMAMPolicy request. -func (client AndroidClient) GetAppForMAMPolicyPreparer(hostName string, policyName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/AndroidPolicies/{policyName}/apps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAppForMAMPolicySender sends the GetAppForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) GetAppForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAppForMAMPolicyResponder handles the response to the GetAppForMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) GetAppForMAMPolicyResponder(resp *http.Response) (result ApplicationCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAppForMAMPolicyNextResults retrieves the next set of results, if any. -func (client AndroidClient) GetAppForMAMPolicyNextResults(lastResults ApplicationCollection) (result ApplicationCollection, err error) { - req, err := lastResults.ApplicationCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAppForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure sending next results request") - } - - result, err = client.GetAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure responding to next results request") - } - - return -} - -// GetGroupsForMAMPolicy returns groups for a given AndroidMAMPolicy. -// -// hostName is location hostName for the tenant policyName is policy name for -// the tenant -func (client AndroidClient) GetGroupsForMAMPolicy(hostName string, policyName string) (result GroupsCollection, err error) { - req, err := client.GetGroupsForMAMPolicyPreparer(hostName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetGroupsForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.GetGroupsForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// GetGroupsForMAMPolicyPreparer prepares the GetGroupsForMAMPolicy request. -func (client AndroidClient) GetGroupsForMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetGroupsForMAMPolicySender sends the GetGroupsForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) GetGroupsForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetGroupsForMAMPolicyResponder handles the response to the GetGroupsForMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) GetGroupsForMAMPolicyResponder(resp *http.Response) (result GroupsCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGroupsForMAMPolicyNextResults retrieves the next set of results, if any. -func (client AndroidClient) GetGroupsForMAMPolicyNextResults(lastResults GroupsCollection) (result GroupsCollection, err error) { - req, err := lastResults.GroupsCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetGroupsForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure sending next results request") - } - - result, err = client.GetGroupsForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMPolicies returns Intune Android policies. -// -// hostName is location hostName for the tenant filter is the filter to apply -// on the operation. selectParameter is select specific fields in entity. -func (client AndroidClient) GetMAMPolicies(hostName string, filter string, top *int32, selectParameter string) (result AndroidMAMPolicyCollection, err error) { - req, err := client.GetMAMPoliciesPreparer(hostName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMPoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure sending request") - return - } - - result, err = client.GetMAMPoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure responding to request") - } - - return -} - -// GetMAMPoliciesPreparer prepares the GetMAMPolicies request. -func (client AndroidClient) GetMAMPoliciesPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMPoliciesSender sends the GetMAMPolicies request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) GetMAMPoliciesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMPoliciesResponder handles the response to the GetMAMPolicies request. The method always -// closes the http.Response Body. -func (client AndroidClient) GetMAMPoliciesResponder(resp *http.Response) (result AndroidMAMPolicyCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMPoliciesNextResults retrieves the next set of results, if any. -func (client AndroidClient) GetMAMPoliciesNextResults(lastResults AndroidMAMPolicyCollection) (result AndroidMAMPolicyCollection, err error) { - req, err := lastResults.AndroidMAMPolicyCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMAMPoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure sending next results request") - } - - result, err = client.GetMAMPoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMPolicyByName returns AndroidMAMPolicy with given name. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy selectParameter is select specific fields in entity. -func (client AndroidClient) GetMAMPolicyByName(hostName string, policyName string, selectParameter string) (result AndroidMAMPolicy, err error) { - req, err := client.GetMAMPolicyByNamePreparer(hostName, policyName, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicyByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMPolicyByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicyByName", resp, "Failure sending request") - return - } - - result, err = client.GetMAMPolicyByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicyByName", resp, "Failure responding to request") - } - - return -} - -// GetMAMPolicyByNamePreparer prepares the GetMAMPolicyByName request. -func (client AndroidClient) GetMAMPolicyByNamePreparer(hostName string, policyName string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMPolicyByNameSender sends the GetMAMPolicyByName request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) GetMAMPolicyByNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMPolicyByNameResponder handles the response to the GetMAMPolicyByName request. The method always -// closes the http.Response Body. -func (client AndroidClient) GetMAMPolicyByNameResponder(resp *http.Response) (result AndroidMAMPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// PatchMAMPolicy patch AndroidMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy parameters is parameters supplied to the Create or update an -// android policy operation. -func (client AndroidClient) PatchMAMPolicy(hostName string, policyName string, parameters AndroidMAMPolicy) (result AndroidMAMPolicy, err error) { - req, err := client.PatchMAMPolicyPreparer(hostName, policyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "PatchMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.PatchMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "PatchMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.PatchMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.AndroidClient", "PatchMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// PatchMAMPolicyPreparer prepares the PatchMAMPolicy request. -func (client AndroidClient) PatchMAMPolicyPreparer(hostName string, policyName string, parameters AndroidMAMPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchMAMPolicySender sends the PatchMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client AndroidClient) PatchMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchMAMPolicyResponder handles the response to the PatchMAMPolicy request. The method always -// closes the http.Response Body. -func (client AndroidClient) PatchMAMPolicyResponder(resp *http.Response) (result AndroidMAMPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package intune + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AndroidClient is the microsoft.Intune Resource provider Api features in the +// swagger-2.0 specification +type AndroidClient struct { + ManagementClient +} + +// NewAndroidClient creates an instance of the AndroidClient client. +func NewAndroidClient() AndroidClient { + return NewAndroidClientWithBaseURI(DefaultBaseURI) +} + +// NewAndroidClientWithBaseURI creates an instance of the AndroidClient client. +func NewAndroidClientWithBaseURI(baseURI string) AndroidClient { + return AndroidClient{NewWithBaseURI(baseURI)} +} + +// AddAppForMAMPolicy add app to an AndroidMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy appName is application unique Name parameters is parameters +// supplied to the Create or update app to an android policy operation. +func (client AndroidClient) AddAppForMAMPolicy(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "intune.AndroidClient", "AddAppForMAMPolicy") + } + + req, err := client.AddAppForMAMPolicyPreparer(hostName, policyName, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddAppForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.AddAppForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddAppForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.AddAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddAppForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// AddAppForMAMPolicyPreparer prepares the AddAppForMAMPolicy request. +func (client AndroidClient) AddAppForMAMPolicyPreparer(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/apps/{appName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddAppForMAMPolicySender sends the AddAppForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) AddAppForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddAppForMAMPolicyResponder handles the response to the AddAppForMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) AddAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// AddGroupForMAMPolicy add group to an AndroidMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy groupID is group Id parameters is parameters supplied to the +// Create or update app to an android policy operation. +func (client AndroidClient) AddGroupForMAMPolicy(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "intune.AndroidClient", "AddGroupForMAMPolicy") + } + + req, err := client.AddGroupForMAMPolicyPreparer(hostName, policyName, groupID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddGroupForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.AddGroupForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddGroupForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.AddGroupForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "AddGroupForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// AddGroupForMAMPolicyPreparer prepares the AddGroupForMAMPolicy request. +func (client AndroidClient) AddGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/groups/{groupId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddGroupForMAMPolicySender sends the AddGroupForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) AddGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddGroupForMAMPolicyResponder handles the response to the AddGroupForMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) AddGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateMAMPolicy creates or updates AndroidMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy parameters is parameters supplied to the Create or update an +// android policy operation. +func (client AndroidClient) CreateOrUpdateMAMPolicy(hostName string, policyName string, parameters AndroidMAMPolicy) (result AndroidMAMPolicy, err error) { + req, err := client.CreateOrUpdateMAMPolicyPreparer(hostName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "CreateOrUpdateMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "CreateOrUpdateMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "CreateOrUpdateMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateMAMPolicyPreparer prepares the CreateOrUpdateMAMPolicy request. +func (client AndroidClient) CreateOrUpdateMAMPolicyPreparer(hostName string, policyName string, parameters AndroidMAMPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateMAMPolicySender sends the CreateOrUpdateMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) CreateOrUpdateMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateMAMPolicyResponder handles the response to the CreateOrUpdateMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) CreateOrUpdateMAMPolicyResponder(resp *http.Response) (result AndroidMAMPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteAppForMAMPolicy delete App for Android Policy +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy appName is application unique Name +func (client AndroidClient) DeleteAppForMAMPolicy(hostName string, policyName string, appName string) (result autorest.Response, err error) { + req, err := client.DeleteAppForMAMPolicyPreparer(hostName, policyName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteAppForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAppForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteAppForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.DeleteAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteAppForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// DeleteAppForMAMPolicyPreparer prepares the DeleteAppForMAMPolicy request. +func (client AndroidClient) DeleteAppForMAMPolicyPreparer(hostName string, policyName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/apps/{appName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAppForMAMPolicySender sends the DeleteAppForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) DeleteAppForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAppForMAMPolicyResponder handles the response to the DeleteAppForMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) DeleteAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteGroupForMAMPolicy delete Group for Android Policy +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy groupID is application unique Name +func (client AndroidClient) DeleteGroupForMAMPolicy(hostName string, policyName string, groupID string) (result autorest.Response, err error) { + req, err := client.DeleteGroupForMAMPolicyPreparer(hostName, policyName, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteGroupForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteGroupForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteGroupForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.DeleteGroupForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteGroupForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// DeleteGroupForMAMPolicyPreparer prepares the DeleteGroupForMAMPolicy request. +func (client AndroidClient) DeleteGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/groups/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteGroupForMAMPolicySender sends the DeleteGroupForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) DeleteGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteGroupForMAMPolicyResponder handles the response to the DeleteGroupForMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) DeleteGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteMAMPolicy delete Android Policy +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy +func (client AndroidClient) DeleteMAMPolicy(hostName string, policyName string) (result autorest.Response, err error) { + req, err := client.DeleteMAMPolicyPreparer(hostName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.DeleteMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "DeleteMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// DeleteMAMPolicyPreparer prepares the DeleteMAMPolicy request. +func (client AndroidClient) DeleteMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteMAMPolicySender sends the DeleteMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) DeleteMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteMAMPolicyResponder handles the response to the DeleteMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) DeleteMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetAppForMAMPolicy get apps for an AndroidMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy filter is the filter to apply on the operation. selectParameter +// is select specific fields in entity. +func (client AndroidClient) GetAppForMAMPolicy(hostName string, policyName string, filter string, top *int32, selectParameter string) (result ApplicationCollection, err error) { + req, err := client.GetAppForMAMPolicyPreparer(hostName, policyName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// GetAppForMAMPolicyPreparer prepares the GetAppForMAMPolicy request. +func (client AndroidClient) GetAppForMAMPolicyPreparer(hostName string, policyName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/AndroidPolicies/{policyName}/apps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAppForMAMPolicySender sends the GetAppForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) GetAppForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAppForMAMPolicyResponder handles the response to the GetAppForMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) GetAppForMAMPolicyResponder(resp *http.Response) (result ApplicationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAppForMAMPolicyNextResults retrieves the next set of results, if any. +func (client AndroidClient) GetAppForMAMPolicyNextResults(lastResults ApplicationCollection) (result ApplicationCollection, err error) { + req, err := lastResults.ApplicationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetAppForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure sending next results request") + } + + result, err = client.GetAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetAppForMAMPolicy", resp, "Failure responding to next results request") + } + + return +} + +// GetGroupsForMAMPolicy returns groups for a given AndroidMAMPolicy. +// +// hostName is location hostName for the tenant policyName is policy name for +// the tenant +func (client AndroidClient) GetGroupsForMAMPolicy(hostName string, policyName string) (result GroupsCollection, err error) { + req, err := client.GetGroupsForMAMPolicyPreparer(hostName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetGroupsForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetGroupsForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// GetGroupsForMAMPolicyPreparer prepares the GetGroupsForMAMPolicy request. +func (client AndroidClient) GetGroupsForMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}/groups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetGroupsForMAMPolicySender sends the GetGroupsForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) GetGroupsForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetGroupsForMAMPolicyResponder handles the response to the GetGroupsForMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) GetGroupsForMAMPolicyResponder(resp *http.Response) (result GroupsCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetGroupsForMAMPolicyNextResults retrieves the next set of results, if any. +func (client AndroidClient) GetGroupsForMAMPolicyNextResults(lastResults GroupsCollection) (result GroupsCollection, err error) { + req, err := lastResults.GroupsCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetGroupsForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure sending next results request") + } + + result, err = client.GetGroupsForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetGroupsForMAMPolicy", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMPolicies returns Intune Android policies. +// +// hostName is location hostName for the tenant filter is the filter to apply +// on the operation. selectParameter is select specific fields in entity. +func (client AndroidClient) GetMAMPolicies(hostName string, filter string, top *int32, selectParameter string) (result AndroidMAMPolicyCollection, err error) { + req, err := client.GetMAMPoliciesPreparer(hostName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMPoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure sending request") + return + } + + result, err = client.GetMAMPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure responding to request") + } + + return +} + +// GetMAMPoliciesPreparer prepares the GetMAMPolicies request. +func (client AndroidClient) GetMAMPoliciesPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMPoliciesSender sends the GetMAMPolicies request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) GetMAMPoliciesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMPoliciesResponder handles the response to the GetMAMPolicies request. The method always +// closes the http.Response Body. +func (client AndroidClient) GetMAMPoliciesResponder(resp *http.Response) (result AndroidMAMPolicyCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMPoliciesNextResults retrieves the next set of results, if any. +func (client AndroidClient) GetMAMPoliciesNextResults(lastResults AndroidMAMPolicyCollection) (result AndroidMAMPolicyCollection, err error) { + req, err := lastResults.AndroidMAMPolicyCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetMAMPoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure sending next results request") + } + + result, err = client.GetMAMPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicies", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMPolicyByName returns AndroidMAMPolicy with given name. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy selectParameter is select specific fields in entity. +func (client AndroidClient) GetMAMPolicyByName(hostName string, policyName string, selectParameter string) (result AndroidMAMPolicy, err error) { + req, err := client.GetMAMPolicyByNamePreparer(hostName, policyName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicyByName", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMPolicyByNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicyByName", resp, "Failure sending request") + return + } + + result, err = client.GetMAMPolicyByNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "GetMAMPolicyByName", resp, "Failure responding to request") + } + + return +} + +// GetMAMPolicyByNamePreparer prepares the GetMAMPolicyByName request. +func (client AndroidClient) GetMAMPolicyByNamePreparer(hostName string, policyName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMPolicyByNameSender sends the GetMAMPolicyByName request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) GetMAMPolicyByNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMPolicyByNameResponder handles the response to the GetMAMPolicyByName request. The method always +// closes the http.Response Body. +func (client AndroidClient) GetMAMPolicyByNameResponder(resp *http.Response) (result AndroidMAMPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PatchMAMPolicy patch AndroidMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy parameters is parameters supplied to the Create or update an +// android policy operation. +func (client AndroidClient) PatchMAMPolicy(hostName string, policyName string, parameters AndroidMAMPolicy) (result AndroidMAMPolicy, err error) { + req, err := client.PatchMAMPolicyPreparer(hostName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "PatchMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.PatchMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "PatchMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.PatchMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.AndroidClient", "PatchMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// PatchMAMPolicyPreparer prepares the PatchMAMPolicy request. +func (client AndroidClient) PatchMAMPolicyPreparer(hostName string, policyName string, parameters AndroidMAMPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/androidPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchMAMPolicySender sends the PatchMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client AndroidClient) PatchMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchMAMPolicyResponder handles the response to the PatchMAMPolicy request. The method always +// closes the http.Response Body. +func (client AndroidClient) PatchMAMPolicyResponder(resp *http.Response) (result AndroidMAMPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/client.go index 920386a5b6..c5b0a0837a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/client.go @@ -1,973 +1,973 @@ -// Package intune implements the Azure ARM Intune service API version -// 2015-01-14-preview. -// -// Microsoft.Intune Resource provider Api features in the swagger-2.0 -// specification -package intune - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Intune - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Intune. -type ManagementClient struct { - autorest.Client - BaseURI string -} - -// New creates an instance of the ManagementClient client. -func New() ManagementClient { - return NewWithBaseURI(DefaultBaseURI) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - } -} - -// GetApps returns Intune Manageable apps. -// -// hostName is location hostName for the tenant filter is the filter to apply -// on the operation. selectParameter is select specific fields in entity. -func (client ManagementClient) GetApps(hostName string, filter string, top *int32, selectParameter string) (result ApplicationCollection, err error) { - req, err := client.GetAppsPreparer(hostName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", nil, "Failure preparing request") - return - } - - resp, err := client.GetAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure sending request") - return - } - - result, err = client.GetAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure responding to request") - } - - return -} - -// GetAppsPreparer prepares the GetApps request. -func (client ManagementClient) GetAppsPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/apps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAppsSender sends the GetApps request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetAppsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAppsResponder handles the response to the GetApps request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetAppsResponder(resp *http.Response) (result ApplicationCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAppsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetAppsNextResults(lastResults ApplicationCollection) (result ApplicationCollection, err error) { - req, err := lastResults.ApplicationCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure sending next results request") - } - - result, err = client.GetAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure responding to next results request") - } - - return -} - -// GetLocationByHostName returns location for given tenant. -func (client ManagementClient) GetLocationByHostName() (result Location, err error) { - req, err := client.GetLocationByHostNamePreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocationByHostName", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationByHostNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocationByHostName", resp, "Failure sending request") - return - } - - result, err = client.GetLocationByHostNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocationByHostName", resp, "Failure responding to request") - } - - return -} - -// GetLocationByHostNamePreparer prepares the GetLocationByHostName request. -func (client ManagementClient) GetLocationByHostNamePreparer() (*http.Request, error) { - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Intune/locations/hostName"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetLocationByHostNameSender sends the GetLocationByHostName request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetLocationByHostNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLocationByHostNameResponder handles the response to the GetLocationByHostName request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetLocationByHostNameResponder(resp *http.Response) (result Location, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLocations returns location for user tenant. -func (client ManagementClient) GetLocations() (result LocationCollection, err error) { - req, err := client.GetLocationsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure sending request") - return - } - - result, err = client.GetLocationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure responding to request") - } - - return -} - -// GetLocationsPreparer prepares the GetLocations request. -func (client ManagementClient) GetLocationsPreparer() (*http.Request, error) { - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Intune/locations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetLocationsSender sends the GetLocations request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetLocationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLocationsResponder handles the response to the GetLocations request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetLocationsResponder(resp *http.Response) (result LocationCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLocationsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetLocationsNextResults(lastResults LocationCollection) (result LocationCollection, err error) { - req, err := lastResults.LocationCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetLocationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure sending next results request") - } - - result, err = client.GetLocationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMFlaggedUserByName returns Intune flagged user details -// -// hostName is location hostName for the tenant userName is flagged userName -// selectParameter is select specific fields in entity. -func (client ManagementClient) GetMAMFlaggedUserByName(hostName string, userName string, selectParameter string) (result FlaggedUser, err error) { - req, err := client.GetMAMFlaggedUserByNamePreparer(hostName, userName, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUserByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMFlaggedUserByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUserByName", resp, "Failure sending request") - return - } - - result, err = client.GetMAMFlaggedUserByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUserByName", resp, "Failure responding to request") - } - - return -} - -// GetMAMFlaggedUserByNamePreparer prepares the GetMAMFlaggedUserByName request. -func (client ManagementClient) GetMAMFlaggedUserByNamePreparer(hostName string, userName string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/flaggedUsers/{userName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMFlaggedUserByNameSender sends the GetMAMFlaggedUserByName request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetMAMFlaggedUserByNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMFlaggedUserByNameResponder handles the response to the GetMAMFlaggedUserByName request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetMAMFlaggedUserByNameResponder(resp *http.Response) (result FlaggedUser, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMFlaggedUsers returns Intune flagged user collection -// -// hostName is location hostName for the tenant filter is the filter to apply -// on the operation. selectParameter is select specific fields in entity. -func (client ManagementClient) GetMAMFlaggedUsers(hostName string, filter string, top *int32, selectParameter string) (result FlaggedUserCollection, err error) { - req, err := client.GetMAMFlaggedUsersPreparer(hostName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMFlaggedUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure sending request") - return - } - - result, err = client.GetMAMFlaggedUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure responding to request") - } - - return -} - -// GetMAMFlaggedUsersPreparer prepares the GetMAMFlaggedUsers request. -func (client ManagementClient) GetMAMFlaggedUsersPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/flaggedUsers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMFlaggedUsersSender sends the GetMAMFlaggedUsers request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetMAMFlaggedUsersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMFlaggedUsersResponder handles the response to the GetMAMFlaggedUsers request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetMAMFlaggedUsersResponder(resp *http.Response) (result FlaggedUserCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMFlaggedUsersNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetMAMFlaggedUsersNextResults(lastResults FlaggedUserCollection) (result FlaggedUserCollection, err error) { - req, err := lastResults.FlaggedUserCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMAMFlaggedUsersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure sending next results request") - } - - result, err = client.GetMAMFlaggedUsersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMStatuses returns Intune Tenant level statuses. -// -// hostName is location hostName for the tenant -func (client ManagementClient) GetMAMStatuses(hostName string) (result StatusesDefault, err error) { - req, err := client.GetMAMStatusesPreparer(hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMStatusesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure sending request") - return - } - - result, err = client.GetMAMStatusesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure responding to request") - } - - return -} - -// GetMAMStatusesPreparer prepares the GetMAMStatuses request. -func (client ManagementClient) GetMAMStatusesPreparer(hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/statuses/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMStatusesSender sends the GetMAMStatuses request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetMAMStatusesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMStatusesResponder handles the response to the GetMAMStatuses request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetMAMStatusesResponder(resp *http.Response) (result StatusesDefault, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMStatusesNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetMAMStatusesNextResults(lastResults StatusesDefault) (result StatusesDefault, err error) { - req, err := lastResults.StatusesDefaultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMAMStatusesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure sending next results request") - } - - result, err = client.GetMAMStatusesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMUserDeviceByDeviceName get a unique device for a user. -// -// hostName is location hostName for the tenant userName is unique user name -// deviceName is device name selectParameter is select specific fields in -// entity. -func (client ManagementClient) GetMAMUserDeviceByDeviceName(hostName string, userName string, deviceName string, selectParameter string) (result Device, err error) { - req, err := client.GetMAMUserDeviceByDeviceNamePreparer(hostName, userName, deviceName, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDeviceByDeviceName", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMUserDeviceByDeviceNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDeviceByDeviceName", resp, "Failure sending request") - return - } - - result, err = client.GetMAMUserDeviceByDeviceNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDeviceByDeviceName", resp, "Failure responding to request") - } - - return -} - -// GetMAMUserDeviceByDeviceNamePreparer prepares the GetMAMUserDeviceByDeviceName request. -func (client ManagementClient) GetMAMUserDeviceByDeviceNamePreparer(hostName string, userName string, deviceName string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deviceName": autorest.Encode("path", deviceName), - "hostName": autorest.Encode("path", hostName), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/users/{userName}/devices/{deviceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMUserDeviceByDeviceNameSender sends the GetMAMUserDeviceByDeviceName request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetMAMUserDeviceByDeviceNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMUserDeviceByDeviceNameResponder handles the response to the GetMAMUserDeviceByDeviceName request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetMAMUserDeviceByDeviceNameResponder(resp *http.Response) (result Device, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMUserDevices get devices for a user. -// -// hostName is location hostName for the tenant userName is user unique Name -// filter is the filter to apply on the operation. selectParameter is select -// specific fields in entity. -func (client ManagementClient) GetMAMUserDevices(hostName string, userName string, filter string, top *int32, selectParameter string) (result DeviceCollection, err error) { - req, err := client.GetMAMUserDevicesPreparer(hostName, userName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMUserDevicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure sending request") - return - } - - result, err = client.GetMAMUserDevicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure responding to request") - } - - return -} - -// GetMAMUserDevicesPreparer prepares the GetMAMUserDevices request. -func (client ManagementClient) GetMAMUserDevicesPreparer(hostName string, userName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/users/{userName}/devices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMUserDevicesSender sends the GetMAMUserDevices request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetMAMUserDevicesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMUserDevicesResponder handles the response to the GetMAMUserDevices request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetMAMUserDevicesResponder(resp *http.Response) (result DeviceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMUserDevicesNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetMAMUserDevicesNextResults(lastResults DeviceCollection) (result DeviceCollection, err error) { - req, err := lastResults.DeviceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMAMUserDevicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure sending next results request") - } - - result, err = client.GetMAMUserDevicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMUserFlaggedEnrolledApps returns Intune flagged enrolled app collection -// for the User -// -// hostName is location hostName for the tenant userName is user name for the -// tenant filter is the filter to apply on the operation. selectParameter is -// select specific fields in entity. -func (client ManagementClient) GetMAMUserFlaggedEnrolledApps(hostName string, userName string, filter string, top *int32, selectParameter string) (result FlaggedEnrolledAppCollection, err error) { - req, err := client.GetMAMUserFlaggedEnrolledAppsPreparer(hostName, userName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMUserFlaggedEnrolledAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure sending request") - return - } - - result, err = client.GetMAMUserFlaggedEnrolledAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure responding to request") - } - - return -} - -// GetMAMUserFlaggedEnrolledAppsPreparer prepares the GetMAMUserFlaggedEnrolledApps request. -func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsPreparer(hostName string, userName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/flaggedUsers/{userName}/flaggedEnrolledApps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMUserFlaggedEnrolledAppsSender sends the GetMAMUserFlaggedEnrolledApps request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMUserFlaggedEnrolledAppsResponder handles the response to the GetMAMUserFlaggedEnrolledApps request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsResponder(resp *http.Response) (result FlaggedEnrolledAppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMUserFlaggedEnrolledAppsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsNextResults(lastResults FlaggedEnrolledAppCollection) (result FlaggedEnrolledAppCollection, err error) { - req, err := lastResults.FlaggedEnrolledAppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMAMUserFlaggedEnrolledAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure sending next results request") - } - - result, err = client.GetMAMUserFlaggedEnrolledAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure responding to next results request") - } - - return -} - -// GetOperationResults returns operationResults. -// -// hostName is location hostName for the tenant filter is the filter to apply -// on the operation. selectParameter is select specific fields in entity. -func (client ManagementClient) GetOperationResults(hostName string, filter string, top *int32, selectParameter string) (result OperationResultCollection, err error) { - req, err := client.GetOperationResultsPreparer(hostName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", nil, "Failure preparing request") - return - } - - resp, err := client.GetOperationResultsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure sending request") - return - } - - result, err = client.GetOperationResultsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure responding to request") - } - - return -} - -// GetOperationResultsPreparer prepares the GetOperationResults request. -func (client ManagementClient) GetOperationResultsPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/operationResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetOperationResultsSender sends the GetOperationResults request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetOperationResultsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetOperationResultsResponder handles the response to the GetOperationResults request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetOperationResultsResponder(resp *http.Response) (result OperationResultCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOperationResultsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetOperationResultsNextResults(lastResults OperationResultCollection) (result OperationResultCollection, err error) { - req, err := lastResults.OperationResultCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetOperationResultsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure sending next results request") - } - - result, err = client.GetOperationResultsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure responding to next results request") - } - - return -} - -// WipeMAMUserDevice wipe a device for a user. -// -// hostName is location hostName for the tenant userName is unique user name -// deviceName is device name -func (client ManagementClient) WipeMAMUserDevice(hostName string, userName string, deviceName string) (result WipeDeviceOperationResult, err error) { - req, err := client.WipeMAMUserDevicePreparer(hostName, userName, deviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "WipeMAMUserDevice", nil, "Failure preparing request") - return - } - - resp, err := client.WipeMAMUserDeviceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "WipeMAMUserDevice", resp, "Failure sending request") - return - } - - result, err = client.WipeMAMUserDeviceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.ManagementClient", "WipeMAMUserDevice", resp, "Failure responding to request") - } - - return -} - -// WipeMAMUserDevicePreparer prepares the WipeMAMUserDevice request. -func (client ManagementClient) WipeMAMUserDevicePreparer(hostName string, userName string, deviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deviceName": autorest.Encode("path", deviceName), - "hostName": autorest.Encode("path", hostName), - "userName": autorest.Encode("path", userName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/users/{userName}/devices/{deviceName}/wipe", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// WipeMAMUserDeviceSender sends the WipeMAMUserDevice request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) WipeMAMUserDeviceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// WipeMAMUserDeviceResponder handles the response to the WipeMAMUserDevice request. The method always -// closes the http.Response Body. -func (client ManagementClient) WipeMAMUserDeviceResponder(resp *http.Response) (result WipeDeviceOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +// Package intune implements the Azure ARM Intune service API version +// 2015-01-14-preview. +// +// Microsoft.Intune Resource provider Api features in the swagger-2.0 +// specification +package intune + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Intune + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Intune. +type ManagementClient struct { + autorest.Client + BaseURI string +} + +// New creates an instance of the ManagementClient client. +func New() ManagementClient { + return NewWithBaseURI(DefaultBaseURI) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + } +} + +// GetApps returns Intune Manageable apps. +// +// hostName is location hostName for the tenant filter is the filter to apply +// on the operation. selectParameter is select specific fields in entity. +func (client ManagementClient) GetApps(hostName string, filter string, top *int32, selectParameter string) (result ApplicationCollection, err error) { + req, err := client.GetAppsPreparer(hostName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure sending request") + return + } + + result, err = client.GetAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure responding to request") + } + + return +} + +// GetAppsPreparer prepares the GetApps request. +func (client ManagementClient) GetAppsPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/apps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAppsSender sends the GetApps request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAppsResponder handles the response to the GetApps request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetAppsResponder(resp *http.Response) (result ApplicationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAppsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetAppsNextResults(lastResults ApplicationCollection) (result ApplicationCollection, err error) { + req, err := lastResults.ApplicationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure sending next results request") + } + + result, err = client.GetAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetApps", resp, "Failure responding to next results request") + } + + return +} + +// GetLocationByHostName returns location for given tenant. +func (client ManagementClient) GetLocationByHostName() (result Location, err error) { + req, err := client.GetLocationByHostNamePreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocationByHostName", nil, "Failure preparing request") + return + } + + resp, err := client.GetLocationByHostNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocationByHostName", resp, "Failure sending request") + return + } + + result, err = client.GetLocationByHostNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocationByHostName", resp, "Failure responding to request") + } + + return +} + +// GetLocationByHostNamePreparer prepares the GetLocationByHostName request. +func (client ManagementClient) GetLocationByHostNamePreparer() (*http.Request, error) { + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Intune/locations/hostName"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetLocationByHostNameSender sends the GetLocationByHostName request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetLocationByHostNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLocationByHostNameResponder handles the response to the GetLocationByHostName request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetLocationByHostNameResponder(resp *http.Response) (result Location, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLocations returns location for user tenant. +func (client ManagementClient) GetLocations() (result LocationCollection, err error) { + req, err := client.GetLocationsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", nil, "Failure preparing request") + return + } + + resp, err := client.GetLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure sending request") + return + } + + result, err = client.GetLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure responding to request") + } + + return +} + +// GetLocationsPreparer prepares the GetLocations request. +func (client ManagementClient) GetLocationsPreparer() (*http.Request, error) { + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Intune/locations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetLocationsSender sends the GetLocations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetLocationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLocationsResponder handles the response to the GetLocations request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetLocationsResponder(resp *http.Response) (result LocationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLocationsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetLocationsNextResults(lastResults LocationCollection) (result LocationCollection, err error) { + req, err := lastResults.LocationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure sending next results request") + } + + result, err = client.GetLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetLocations", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMFlaggedUserByName returns Intune flagged user details +// +// hostName is location hostName for the tenant userName is flagged userName +// selectParameter is select specific fields in entity. +func (client ManagementClient) GetMAMFlaggedUserByName(hostName string, userName string, selectParameter string) (result FlaggedUser, err error) { + req, err := client.GetMAMFlaggedUserByNamePreparer(hostName, userName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUserByName", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMFlaggedUserByNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUserByName", resp, "Failure sending request") + return + } + + result, err = client.GetMAMFlaggedUserByNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUserByName", resp, "Failure responding to request") + } + + return +} + +// GetMAMFlaggedUserByNamePreparer prepares the GetMAMFlaggedUserByName request. +func (client ManagementClient) GetMAMFlaggedUserByNamePreparer(hostName string, userName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/flaggedUsers/{userName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMFlaggedUserByNameSender sends the GetMAMFlaggedUserByName request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetMAMFlaggedUserByNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMFlaggedUserByNameResponder handles the response to the GetMAMFlaggedUserByName request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetMAMFlaggedUserByNameResponder(resp *http.Response) (result FlaggedUser, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMFlaggedUsers returns Intune flagged user collection +// +// hostName is location hostName for the tenant filter is the filter to apply +// on the operation. selectParameter is select specific fields in entity. +func (client ManagementClient) GetMAMFlaggedUsers(hostName string, filter string, top *int32, selectParameter string) (result FlaggedUserCollection, err error) { + req, err := client.GetMAMFlaggedUsersPreparer(hostName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMFlaggedUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure sending request") + return + } + + result, err = client.GetMAMFlaggedUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure responding to request") + } + + return +} + +// GetMAMFlaggedUsersPreparer prepares the GetMAMFlaggedUsers request. +func (client ManagementClient) GetMAMFlaggedUsersPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/flaggedUsers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMFlaggedUsersSender sends the GetMAMFlaggedUsers request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetMAMFlaggedUsersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMFlaggedUsersResponder handles the response to the GetMAMFlaggedUsers request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetMAMFlaggedUsersResponder(resp *http.Response) (result FlaggedUserCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMFlaggedUsersNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetMAMFlaggedUsersNextResults(lastResults FlaggedUserCollection) (result FlaggedUserCollection, err error) { + req, err := lastResults.FlaggedUserCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetMAMFlaggedUsersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure sending next results request") + } + + result, err = client.GetMAMFlaggedUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMFlaggedUsers", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMStatuses returns Intune Tenant level statuses. +// +// hostName is location hostName for the tenant +func (client ManagementClient) GetMAMStatuses(hostName string) (result StatusesDefault, err error) { + req, err := client.GetMAMStatusesPreparer(hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMStatusesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure sending request") + return + } + + result, err = client.GetMAMStatusesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure responding to request") + } + + return +} + +// GetMAMStatusesPreparer prepares the GetMAMStatuses request. +func (client ManagementClient) GetMAMStatusesPreparer(hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/statuses/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMStatusesSender sends the GetMAMStatuses request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetMAMStatusesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMStatusesResponder handles the response to the GetMAMStatuses request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetMAMStatusesResponder(resp *http.Response) (result StatusesDefault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMStatusesNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetMAMStatusesNextResults(lastResults StatusesDefault) (result StatusesDefault, err error) { + req, err := lastResults.StatusesDefaultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetMAMStatusesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure sending next results request") + } + + result, err = client.GetMAMStatusesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMStatuses", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMUserDeviceByDeviceName get a unique device for a user. +// +// hostName is location hostName for the tenant userName is unique user name +// deviceName is device name selectParameter is select specific fields in +// entity. +func (client ManagementClient) GetMAMUserDeviceByDeviceName(hostName string, userName string, deviceName string, selectParameter string) (result Device, err error) { + req, err := client.GetMAMUserDeviceByDeviceNamePreparer(hostName, userName, deviceName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDeviceByDeviceName", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMUserDeviceByDeviceNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDeviceByDeviceName", resp, "Failure sending request") + return + } + + result, err = client.GetMAMUserDeviceByDeviceNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDeviceByDeviceName", resp, "Failure responding to request") + } + + return +} + +// GetMAMUserDeviceByDeviceNamePreparer prepares the GetMAMUserDeviceByDeviceName request. +func (client ManagementClient) GetMAMUserDeviceByDeviceNamePreparer(hostName string, userName string, deviceName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "hostName": autorest.Encode("path", hostName), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/users/{userName}/devices/{deviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMUserDeviceByDeviceNameSender sends the GetMAMUserDeviceByDeviceName request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetMAMUserDeviceByDeviceNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMUserDeviceByDeviceNameResponder handles the response to the GetMAMUserDeviceByDeviceName request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetMAMUserDeviceByDeviceNameResponder(resp *http.Response) (result Device, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMUserDevices get devices for a user. +// +// hostName is location hostName for the tenant userName is user unique Name +// filter is the filter to apply on the operation. selectParameter is select +// specific fields in entity. +func (client ManagementClient) GetMAMUserDevices(hostName string, userName string, filter string, top *int32, selectParameter string) (result DeviceCollection, err error) { + req, err := client.GetMAMUserDevicesPreparer(hostName, userName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMUserDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure sending request") + return + } + + result, err = client.GetMAMUserDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure responding to request") + } + + return +} + +// GetMAMUserDevicesPreparer prepares the GetMAMUserDevices request. +func (client ManagementClient) GetMAMUserDevicesPreparer(hostName string, userName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/users/{userName}/devices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMUserDevicesSender sends the GetMAMUserDevices request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetMAMUserDevicesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMUserDevicesResponder handles the response to the GetMAMUserDevices request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetMAMUserDevicesResponder(resp *http.Response) (result DeviceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMUserDevicesNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetMAMUserDevicesNextResults(lastResults DeviceCollection) (result DeviceCollection, err error) { + req, err := lastResults.DeviceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetMAMUserDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure sending next results request") + } + + result, err = client.GetMAMUserDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserDevices", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMUserFlaggedEnrolledApps returns Intune flagged enrolled app collection +// for the User +// +// hostName is location hostName for the tenant userName is user name for the +// tenant filter is the filter to apply on the operation. selectParameter is +// select specific fields in entity. +func (client ManagementClient) GetMAMUserFlaggedEnrolledApps(hostName string, userName string, filter string, top *int32, selectParameter string) (result FlaggedEnrolledAppCollection, err error) { + req, err := client.GetMAMUserFlaggedEnrolledAppsPreparer(hostName, userName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMUserFlaggedEnrolledAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure sending request") + return + } + + result, err = client.GetMAMUserFlaggedEnrolledAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure responding to request") + } + + return +} + +// GetMAMUserFlaggedEnrolledAppsPreparer prepares the GetMAMUserFlaggedEnrolledApps request. +func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsPreparer(hostName string, userName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/flaggedUsers/{userName}/flaggedEnrolledApps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMUserFlaggedEnrolledAppsSender sends the GetMAMUserFlaggedEnrolledApps request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMUserFlaggedEnrolledAppsResponder handles the response to the GetMAMUserFlaggedEnrolledApps request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsResponder(resp *http.Response) (result FlaggedEnrolledAppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMUserFlaggedEnrolledAppsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetMAMUserFlaggedEnrolledAppsNextResults(lastResults FlaggedEnrolledAppCollection) (result FlaggedEnrolledAppCollection, err error) { + req, err := lastResults.FlaggedEnrolledAppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetMAMUserFlaggedEnrolledAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure sending next results request") + } + + result, err = client.GetMAMUserFlaggedEnrolledAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetMAMUserFlaggedEnrolledApps", resp, "Failure responding to next results request") + } + + return +} + +// GetOperationResults returns operationResults. +// +// hostName is location hostName for the tenant filter is the filter to apply +// on the operation. selectParameter is select specific fields in entity. +func (client ManagementClient) GetOperationResults(hostName string, filter string, top *int32, selectParameter string) (result OperationResultCollection, err error) { + req, err := client.GetOperationResultsPreparer(hostName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", nil, "Failure preparing request") + return + } + + resp, err := client.GetOperationResultsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure sending request") + return + } + + result, err = client.GetOperationResultsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure responding to request") + } + + return +} + +// GetOperationResultsPreparer prepares the GetOperationResults request. +func (client ManagementClient) GetOperationResultsPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/operationResults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetOperationResultsSender sends the GetOperationResults request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetOperationResultsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetOperationResultsResponder handles the response to the GetOperationResults request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetOperationResultsResponder(resp *http.Response) (result OperationResultCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOperationResultsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetOperationResultsNextResults(lastResults OperationResultCollection) (result OperationResultCollection, err error) { + req, err := lastResults.OperationResultCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetOperationResultsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure sending next results request") + } + + result, err = client.GetOperationResultsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "GetOperationResults", resp, "Failure responding to next results request") + } + + return +} + +// WipeMAMUserDevice wipe a device for a user. +// +// hostName is location hostName for the tenant userName is unique user name +// deviceName is device name +func (client ManagementClient) WipeMAMUserDevice(hostName string, userName string, deviceName string) (result WipeDeviceOperationResult, err error) { + req, err := client.WipeMAMUserDevicePreparer(hostName, userName, deviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "WipeMAMUserDevice", nil, "Failure preparing request") + return + } + + resp, err := client.WipeMAMUserDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "WipeMAMUserDevice", resp, "Failure sending request") + return + } + + result, err = client.WipeMAMUserDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.ManagementClient", "WipeMAMUserDevice", resp, "Failure responding to request") + } + + return +} + +// WipeMAMUserDevicePreparer prepares the WipeMAMUserDevice request. +func (client ManagementClient) WipeMAMUserDevicePreparer(hostName string, userName string, deviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "hostName": autorest.Encode("path", hostName), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/users/{userName}/devices/{deviceName}/wipe", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// WipeMAMUserDeviceSender sends the WipeMAMUserDevice request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) WipeMAMUserDeviceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// WipeMAMUserDeviceResponder handles the response to the WipeMAMUserDevice request. The method always +// closes the http.Response Body. +func (client ManagementClient) WipeMAMUserDeviceResponder(resp *http.Response) (result WipeDeviceOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/ios.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/ios.go index 22ce429b29..bcd4edd66c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/ios.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/ios.go @@ -1,875 +1,875 @@ -package intune - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// IosClient is the microsoft.Intune Resource provider Api features in the -// swagger-2.0 specification -type IosClient struct { - ManagementClient -} - -// NewIosClient creates an instance of the IosClient client. -func NewIosClient() IosClient { - return NewIosClientWithBaseURI(DefaultBaseURI) -} - -// NewIosClientWithBaseURI creates an instance of the IosClient client. -func NewIosClientWithBaseURI(baseURI string) IosClient { - return IosClient{NewWithBaseURI(baseURI)} -} - -// AddAppForMAMPolicy add app to an iOSMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy appName is application unique Name parameters is parameters -// supplied to add an app to an ios policy. -func (client IosClient) AddAppForMAMPolicy(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "intune.IosClient", "AddAppForMAMPolicy") - } - - req, err := client.AddAppForMAMPolicyPreparer(hostName, policyName, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "AddAppForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.AddAppForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.IosClient", "AddAppForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.AddAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "AddAppForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// AddAppForMAMPolicyPreparer prepares the AddAppForMAMPolicy request. -func (client IosClient) AddAppForMAMPolicyPreparer(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/apps/{appName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddAppForMAMPolicySender sends the AddAppForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) AddAppForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddAppForMAMPolicyResponder handles the response to the AddAppForMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) AddAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// AddGroupForMAMPolicy add group to an iOSMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy groupID is group Id parameters is parameters supplied to the -// Create or update app to an android policy operation. -func (client IosClient) AddGroupForMAMPolicy(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "intune.IosClient", "AddGroupForMAMPolicy") - } - - req, err := client.AddGroupForMAMPolicyPreparer(hostName, policyName, groupID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "AddGroupForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.AddGroupForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.IosClient", "AddGroupForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.AddGroupForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "AddGroupForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// AddGroupForMAMPolicyPreparer prepares the AddGroupForMAMPolicy request. -func (client IosClient) AddGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/groups/{groupId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddGroupForMAMPolicySender sends the AddGroupForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) AddGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddGroupForMAMPolicyResponder handles the response to the AddGroupForMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) AddGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdateMAMPolicy creates or updates iOSMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy parameters is parameters supplied to the Create or update an -// android policy operation. -func (client IosClient) CreateOrUpdateMAMPolicy(hostName string, policyName string, parameters IOSMAMPolicy) (result IOSMAMPolicy, err error) { - req, err := client.CreateOrUpdateMAMPolicyPreparer(hostName, policyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "CreateOrUpdateMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.IosClient", "CreateOrUpdateMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "CreateOrUpdateMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateMAMPolicyPreparer prepares the CreateOrUpdateMAMPolicy request. -func (client IosClient) CreateOrUpdateMAMPolicyPreparer(hostName string, policyName string, parameters IOSMAMPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateMAMPolicySender sends the CreateOrUpdateMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) CreateOrUpdateMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateMAMPolicyResponder handles the response to the CreateOrUpdateMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) CreateOrUpdateMAMPolicyResponder(resp *http.Response) (result IOSMAMPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAppForMAMPolicy delete App for Ios Policy -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy appName is application unique Name -func (client IosClient) DeleteAppForMAMPolicy(hostName string, policyName string, appName string) (result autorest.Response, err error) { - req, err := client.DeleteAppForMAMPolicyPreparer(hostName, policyName, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteAppForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAppForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteAppForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.DeleteAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteAppForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// DeleteAppForMAMPolicyPreparer prepares the DeleteAppForMAMPolicy request. -func (client IosClient) DeleteAppForMAMPolicyPreparer(hostName string, policyName string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/apps/{appName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAppForMAMPolicySender sends the DeleteAppForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) DeleteAppForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAppForMAMPolicyResponder handles the response to the DeleteAppForMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) DeleteAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteGroupForMAMPolicy delete Group for iOS Policy -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy groupID is application unique Name -func (client IosClient) DeleteGroupForMAMPolicy(hostName string, policyName string, groupID string) (result autorest.Response, err error) { - req, err := client.DeleteGroupForMAMPolicyPreparer(hostName, policyName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteGroupForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteGroupForMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteGroupForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.DeleteGroupForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteGroupForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// DeleteGroupForMAMPolicyPreparer prepares the DeleteGroupForMAMPolicy request. -func (client IosClient) DeleteGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupId": autorest.Encode("path", groupID), - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/groups/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteGroupForMAMPolicySender sends the DeleteGroupForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) DeleteGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteGroupForMAMPolicyResponder handles the response to the DeleteGroupForMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) DeleteGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteMAMPolicy delete Ios Policy -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy -func (client IosClient) DeleteMAMPolicy(hostName string, policyName string) (result autorest.Response, err error) { - req, err := client.DeleteMAMPolicyPreparer(hostName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteMAMPolicySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.DeleteMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// DeleteMAMPolicyPreparer prepares the DeleteMAMPolicy request. -func (client IosClient) DeleteMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteMAMPolicySender sends the DeleteMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) DeleteMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteMAMPolicyResponder handles the response to the DeleteMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) DeleteMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetAppForMAMPolicy get apps for an iOSMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy filter is the filter to apply on the operation. selectParameter -// is select specific fields in entity. -func (client IosClient) GetAppForMAMPolicy(hostName string, policyName string, filter string, top *int32, selectParameter string) (result ApplicationCollection, err error) { - req, err := client.GetAppForMAMPolicyPreparer(hostName, policyName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetAppForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.GetAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// GetAppForMAMPolicyPreparer prepares the GetAppForMAMPolicy request. -func (client IosClient) GetAppForMAMPolicyPreparer(hostName string, policyName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/apps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAppForMAMPolicySender sends the GetAppForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) GetAppForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAppForMAMPolicyResponder handles the response to the GetAppForMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) GetAppForMAMPolicyResponder(resp *http.Response) (result ApplicationCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAppForMAMPolicyNextResults retrieves the next set of results, if any. -func (client IosClient) GetAppForMAMPolicyNextResults(lastResults ApplicationCollection) (result ApplicationCollection, err error) { - req, err := lastResults.ApplicationCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetAppForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure sending next results request") - } - - result, err = client.GetAppForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure responding to next results request") - } - - return -} - -// GetGroupsForMAMPolicy returns groups for a given iOSMAMPolicy. -// -// hostName is location hostName for the tenant policyName is policy name for -// the tenant -func (client IosClient) GetGroupsForMAMPolicy(hostName string, policyName string) (result GroupsCollection, err error) { - req, err := client.GetGroupsForMAMPolicyPreparer(hostName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetGroupsForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.GetGroupsForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// GetGroupsForMAMPolicyPreparer prepares the GetGroupsForMAMPolicy request. -func (client IosClient) GetGroupsForMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetGroupsForMAMPolicySender sends the GetGroupsForMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) GetGroupsForMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetGroupsForMAMPolicyResponder handles the response to the GetGroupsForMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) GetGroupsForMAMPolicyResponder(resp *http.Response) (result GroupsCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGroupsForMAMPolicyNextResults retrieves the next set of results, if any. -func (client IosClient) GetGroupsForMAMPolicyNextResults(lastResults GroupsCollection) (result GroupsCollection, err error) { - req, err := lastResults.GroupsCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetGroupsForMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure sending next results request") - } - - result, err = client.GetGroupsForMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMPolicies returns Intune iOSPolicies. -// -// hostName is location hostName for the tenant filter is the filter to apply -// on the operation. selectParameter is select specific fields in entity. -func (client IosClient) GetMAMPolicies(hostName string, filter string, top *int32, selectParameter string) (result IOSMAMPolicyCollection, err error) { - req, err := client.GetMAMPoliciesPreparer(hostName, filter, top, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMPoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure sending request") - return - } - - result, err = client.GetMAMPoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure responding to request") - } - - return -} - -// GetMAMPoliciesPreparer prepares the GetMAMPolicies request. -func (client IosClient) GetMAMPoliciesPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMPoliciesSender sends the GetMAMPolicies request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) GetMAMPoliciesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMPoliciesResponder handles the response to the GetMAMPolicies request. The method always -// closes the http.Response Body. -func (client IosClient) GetMAMPoliciesResponder(resp *http.Response) (result IOSMAMPolicyCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMAMPoliciesNextResults retrieves the next set of results, if any. -func (client IosClient) GetMAMPoliciesNextResults(lastResults IOSMAMPolicyCollection) (result IOSMAMPolicyCollection, err error) { - req, err := lastResults.IOSMAMPolicyCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetMAMPoliciesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure sending next results request") - } - - result, err = client.GetMAMPoliciesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure responding to next results request") - } - - return -} - -// GetMAMPolicyByName returns Intune iOS policies. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy selectParameter is select specific fields in entity. -func (client IosClient) GetMAMPolicyByName(hostName string, policyName string, selectParameter string) (result IOSMAMPolicy, err error) { - req, err := client.GetMAMPolicyByNamePreparer(hostName, policyName, selectParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicyByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetMAMPolicyByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicyByName", resp, "Failure sending request") - return - } - - result, err = client.GetMAMPolicyByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicyByName", resp, "Failure responding to request") - } - - return -} - -// GetMAMPolicyByNamePreparer prepares the GetMAMPolicyByName request. -func (client IosClient) GetMAMPolicyByNamePreparer(hostName string, policyName string, selectParameter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMAMPolicyByNameSender sends the GetMAMPolicyByName request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) GetMAMPolicyByNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMAMPolicyByNameResponder handles the response to the GetMAMPolicyByName request. The method always -// closes the http.Response Body. -func (client IosClient) GetMAMPolicyByNameResponder(resp *http.Response) (result IOSMAMPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// PatchMAMPolicy patch an iOSMAMPolicy. -// -// hostName is location hostName for the tenant policyName is unique name for -// the policy parameters is parameters supplied to the Create or update an -// android policy operation. -func (client IosClient) PatchMAMPolicy(hostName string, policyName string, parameters IOSMAMPolicy) (result IOSMAMPolicy, err error) { - req, err := client.PatchMAMPolicyPreparer(hostName, policyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "PatchMAMPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.PatchMAMPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "intune.IosClient", "PatchMAMPolicy", resp, "Failure sending request") - return - } - - result, err = client.PatchMAMPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "intune.IosClient", "PatchMAMPolicy", resp, "Failure responding to request") - } - - return -} - -// PatchMAMPolicyPreparer prepares the PatchMAMPolicy request. -func (client IosClient) PatchMAMPolicyPreparer(hostName string, policyName string, parameters IOSMAMPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "policyName": autorest.Encode("path", policyName), - } - - const APIVersion = "2015-01-14-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchMAMPolicySender sends the PatchMAMPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client IosClient) PatchMAMPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchMAMPolicyResponder handles the response to the PatchMAMPolicy request. The method always -// closes the http.Response Body. -func (client IosClient) PatchMAMPolicyResponder(resp *http.Response) (result IOSMAMPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package intune + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// IosClient is the microsoft.Intune Resource provider Api features in the +// swagger-2.0 specification +type IosClient struct { + ManagementClient +} + +// NewIosClient creates an instance of the IosClient client. +func NewIosClient() IosClient { + return NewIosClientWithBaseURI(DefaultBaseURI) +} + +// NewIosClientWithBaseURI creates an instance of the IosClient client. +func NewIosClientWithBaseURI(baseURI string) IosClient { + return IosClient{NewWithBaseURI(baseURI)} +} + +// AddAppForMAMPolicy add app to an iOSMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy appName is application unique Name parameters is parameters +// supplied to add an app to an ios policy. +func (client IosClient) AddAppForMAMPolicy(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "intune.IosClient", "AddAppForMAMPolicy") + } + + req, err := client.AddAppForMAMPolicyPreparer(hostName, policyName, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "AddAppForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.AddAppForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.IosClient", "AddAppForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.AddAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "AddAppForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// AddAppForMAMPolicyPreparer prepares the AddAppForMAMPolicy request. +func (client IosClient) AddAppForMAMPolicyPreparer(hostName string, policyName string, appName string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/apps/{appName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddAppForMAMPolicySender sends the AddAppForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) AddAppForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddAppForMAMPolicyResponder handles the response to the AddAppForMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) AddAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// AddGroupForMAMPolicy add group to an iOSMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy groupID is group Id parameters is parameters supplied to the +// Create or update app to an android policy operation. +func (client IosClient) AddGroupForMAMPolicy(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.URL", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "intune.IosClient", "AddGroupForMAMPolicy") + } + + req, err := client.AddGroupForMAMPolicyPreparer(hostName, policyName, groupID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "AddGroupForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.AddGroupForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.IosClient", "AddGroupForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.AddGroupForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "AddGroupForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// AddGroupForMAMPolicyPreparer prepares the AddGroupForMAMPolicy request. +func (client IosClient) AddGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string, parameters MAMPolicyAppIDOrGroupIDPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/groups/{groupId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddGroupForMAMPolicySender sends the AddGroupForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) AddGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddGroupForMAMPolicyResponder handles the response to the AddGroupForMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) AddGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdateMAMPolicy creates or updates iOSMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy parameters is parameters supplied to the Create or update an +// android policy operation. +func (client IosClient) CreateOrUpdateMAMPolicy(hostName string, policyName string, parameters IOSMAMPolicy) (result IOSMAMPolicy, err error) { + req, err := client.CreateOrUpdateMAMPolicyPreparer(hostName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "CreateOrUpdateMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.IosClient", "CreateOrUpdateMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "CreateOrUpdateMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateMAMPolicyPreparer prepares the CreateOrUpdateMAMPolicy request. +func (client IosClient) CreateOrUpdateMAMPolicyPreparer(hostName string, policyName string, parameters IOSMAMPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateMAMPolicySender sends the CreateOrUpdateMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) CreateOrUpdateMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateMAMPolicyResponder handles the response to the CreateOrUpdateMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) CreateOrUpdateMAMPolicyResponder(resp *http.Response) (result IOSMAMPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteAppForMAMPolicy delete App for Ios Policy +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy appName is application unique Name +func (client IosClient) DeleteAppForMAMPolicy(hostName string, policyName string, appName string) (result autorest.Response, err error) { + req, err := client.DeleteAppForMAMPolicyPreparer(hostName, policyName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteAppForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAppForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteAppForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.DeleteAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteAppForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// DeleteAppForMAMPolicyPreparer prepares the DeleteAppForMAMPolicy request. +func (client IosClient) DeleteAppForMAMPolicyPreparer(hostName string, policyName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/apps/{appName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAppForMAMPolicySender sends the DeleteAppForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) DeleteAppForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAppForMAMPolicyResponder handles the response to the DeleteAppForMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) DeleteAppForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteGroupForMAMPolicy delete Group for iOS Policy +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy groupID is application unique Name +func (client IosClient) DeleteGroupForMAMPolicy(hostName string, policyName string, groupID string) (result autorest.Response, err error) { + req, err := client.DeleteGroupForMAMPolicyPreparer(hostName, policyName, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteGroupForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteGroupForMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteGroupForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.DeleteGroupForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteGroupForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// DeleteGroupForMAMPolicyPreparer prepares the DeleteGroupForMAMPolicy request. +func (client IosClient) DeleteGroupForMAMPolicyPreparer(hostName string, policyName string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/groups/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteGroupForMAMPolicySender sends the DeleteGroupForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) DeleteGroupForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteGroupForMAMPolicyResponder handles the response to the DeleteGroupForMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) DeleteGroupForMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteMAMPolicy delete Ios Policy +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy +func (client IosClient) DeleteMAMPolicy(hostName string, policyName string) (result autorest.Response, err error) { + req, err := client.DeleteMAMPolicyPreparer(hostName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteMAMPolicySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.DeleteMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "DeleteMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// DeleteMAMPolicyPreparer prepares the DeleteMAMPolicy request. +func (client IosClient) DeleteMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteMAMPolicySender sends the DeleteMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) DeleteMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteMAMPolicyResponder handles the response to the DeleteMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) DeleteMAMPolicyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetAppForMAMPolicy get apps for an iOSMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy filter is the filter to apply on the operation. selectParameter +// is select specific fields in entity. +func (client IosClient) GetAppForMAMPolicy(hostName string, policyName string, filter string, top *int32, selectParameter string) (result ApplicationCollection, err error) { + req, err := client.GetAppForMAMPolicyPreparer(hostName, policyName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// GetAppForMAMPolicyPreparer prepares the GetAppForMAMPolicy request. +func (client IosClient) GetAppForMAMPolicyPreparer(hostName string, policyName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/apps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAppForMAMPolicySender sends the GetAppForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) GetAppForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAppForMAMPolicyResponder handles the response to the GetAppForMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) GetAppForMAMPolicyResponder(resp *http.Response) (result ApplicationCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAppForMAMPolicyNextResults retrieves the next set of results, if any. +func (client IosClient) GetAppForMAMPolicyNextResults(lastResults ApplicationCollection) (result ApplicationCollection, err error) { + req, err := lastResults.ApplicationCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetAppForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure sending next results request") + } + + result, err = client.GetAppForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetAppForMAMPolicy", resp, "Failure responding to next results request") + } + + return +} + +// GetGroupsForMAMPolicy returns groups for a given iOSMAMPolicy. +// +// hostName is location hostName for the tenant policyName is policy name for +// the tenant +func (client IosClient) GetGroupsForMAMPolicy(hostName string, policyName string) (result GroupsCollection, err error) { + req, err := client.GetGroupsForMAMPolicyPreparer(hostName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetGroupsForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetGroupsForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// GetGroupsForMAMPolicyPreparer prepares the GetGroupsForMAMPolicy request. +func (client IosClient) GetGroupsForMAMPolicyPreparer(hostName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}/groups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetGroupsForMAMPolicySender sends the GetGroupsForMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) GetGroupsForMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetGroupsForMAMPolicyResponder handles the response to the GetGroupsForMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) GetGroupsForMAMPolicyResponder(resp *http.Response) (result GroupsCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetGroupsForMAMPolicyNextResults retrieves the next set of results, if any. +func (client IosClient) GetGroupsForMAMPolicyNextResults(lastResults GroupsCollection) (result GroupsCollection, err error) { + req, err := lastResults.GroupsCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetGroupsForMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure sending next results request") + } + + result, err = client.GetGroupsForMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetGroupsForMAMPolicy", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMPolicies returns Intune iOSPolicies. +// +// hostName is location hostName for the tenant filter is the filter to apply +// on the operation. selectParameter is select specific fields in entity. +func (client IosClient) GetMAMPolicies(hostName string, filter string, top *int32, selectParameter string) (result IOSMAMPolicyCollection, err error) { + req, err := client.GetMAMPoliciesPreparer(hostName, filter, top, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMPoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure sending request") + return + } + + result, err = client.GetMAMPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure responding to request") + } + + return +} + +// GetMAMPoliciesPreparer prepares the GetMAMPolicies request. +func (client IosClient) GetMAMPoliciesPreparer(hostName string, filter string, top *int32, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMPoliciesSender sends the GetMAMPolicies request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) GetMAMPoliciesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMPoliciesResponder handles the response to the GetMAMPolicies request. The method always +// closes the http.Response Body. +func (client IosClient) GetMAMPoliciesResponder(resp *http.Response) (result IOSMAMPolicyCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMAMPoliciesNextResults retrieves the next set of results, if any. +func (client IosClient) GetMAMPoliciesNextResults(lastResults IOSMAMPolicyCollection) (result IOSMAMPolicyCollection, err error) { + req, err := lastResults.IOSMAMPolicyCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetMAMPoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure sending next results request") + } + + result, err = client.GetMAMPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicies", resp, "Failure responding to next results request") + } + + return +} + +// GetMAMPolicyByName returns Intune iOS policies. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy selectParameter is select specific fields in entity. +func (client IosClient) GetMAMPolicyByName(hostName string, policyName string, selectParameter string) (result IOSMAMPolicy, err error) { + req, err := client.GetMAMPolicyByNamePreparer(hostName, policyName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicyByName", nil, "Failure preparing request") + return + } + + resp, err := client.GetMAMPolicyByNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicyByName", resp, "Failure sending request") + return + } + + result, err = client.GetMAMPolicyByNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "GetMAMPolicyByName", resp, "Failure responding to request") + } + + return +} + +// GetMAMPolicyByNamePreparer prepares the GetMAMPolicyByName request. +func (client IosClient) GetMAMPolicyByNamePreparer(hostName string, policyName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMAMPolicyByNameSender sends the GetMAMPolicyByName request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) GetMAMPolicyByNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMAMPolicyByNameResponder handles the response to the GetMAMPolicyByName request. The method always +// closes the http.Response Body. +func (client IosClient) GetMAMPolicyByNameResponder(resp *http.Response) (result IOSMAMPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PatchMAMPolicy patch an iOSMAMPolicy. +// +// hostName is location hostName for the tenant policyName is unique name for +// the policy parameters is parameters supplied to the Create or update an +// android policy operation. +func (client IosClient) PatchMAMPolicy(hostName string, policyName string, parameters IOSMAMPolicy) (result IOSMAMPolicy, err error) { + req, err := client.PatchMAMPolicyPreparer(hostName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "PatchMAMPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.PatchMAMPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "intune.IosClient", "PatchMAMPolicy", resp, "Failure sending request") + return + } + + result, err = client.PatchMAMPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "intune.IosClient", "PatchMAMPolicy", resp, "Failure responding to request") + } + + return +} + +// PatchMAMPolicyPreparer prepares the PatchMAMPolicy request. +func (client IosClient) PatchMAMPolicyPreparer(hostName string, policyName string, parameters IOSMAMPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "policyName": autorest.Encode("path", policyName), + } + + const APIVersion = "2015-01-14-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Intune/locations/{hostName}/iosPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchMAMPolicySender sends the PatchMAMPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client IosClient) PatchMAMPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchMAMPolicyResponder handles the response to the PatchMAMPolicy request. The method always +// closes the http.Response Body. +func (client IosClient) PatchMAMPolicyResponder(resp *http.Response) (result IOSMAMPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/models.go index ddac278a5e..b43970f620 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/models.go @@ -1,690 +1,690 @@ -package intune - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AppSharingFromLevel enumerates the values for app sharing from level. -type AppSharingFromLevel string - -const ( - // AllApps specifies the all apps state for app sharing from level. - AllApps AppSharingFromLevel = "allApps" - // None specifies the none state for app sharing from level. - None AppSharingFromLevel = "none" - // PolicyManagedApps specifies the policy managed apps state for app - // sharing from level. - PolicyManagedApps AppSharingFromLevel = "policyManagedApps" -) - -// AppSharingToLevel enumerates the values for app sharing to level. -type AppSharingToLevel string - -const ( - // AppSharingToLevelAllApps specifies the app sharing to level all apps - // state for app sharing to level. - AppSharingToLevelAllApps AppSharingToLevel = "allApps" - // AppSharingToLevelNone specifies the app sharing to level none state for - // app sharing to level. - AppSharingToLevelNone AppSharingToLevel = "none" - // AppSharingToLevelPolicyManagedApps specifies the app sharing to level - // policy managed apps state for app sharing to level. - AppSharingToLevelPolicyManagedApps AppSharingToLevel = "policyManagedApps" -) - -// Authentication enumerates the values for authentication. -type Authentication string - -const ( - // NotRequired specifies the not required state for authentication. - NotRequired Authentication = "notRequired" - // Required specifies the required state for authentication. - Required Authentication = "required" -) - -// ClipboardSharingLevel enumerates the values for clipboard sharing level. -type ClipboardSharingLevel string - -const ( - // ClipboardSharingLevelAllApps specifies the clipboard sharing level all - // apps state for clipboard sharing level. - ClipboardSharingLevelAllApps ClipboardSharingLevel = "allApps" - // ClipboardSharingLevelBlocked specifies the clipboard sharing level - // blocked state for clipboard sharing level. - ClipboardSharingLevelBlocked ClipboardSharingLevel = "blocked" - // ClipboardSharingLevelPolicyManagedApps specifies the clipboard sharing - // level policy managed apps state for clipboard sharing level. - ClipboardSharingLevelPolicyManagedApps ClipboardSharingLevel = "policyManagedApps" - // ClipboardSharingLevelPolicyManagedAppsWithPasteIn specifies the - // clipboard sharing level policy managed apps with paste in state for - // clipboard sharing level. - ClipboardSharingLevelPolicyManagedAppsWithPasteIn ClipboardSharingLevel = "policyManagedAppsWithPasteIn" -) - -// DataBackup enumerates the values for data backup. -type DataBackup string - -const ( - // Allow specifies the allow state for data backup. - Allow DataBackup = "allow" - // Block specifies the block state for data backup. - Block DataBackup = "block" -) - -// DeviceCompliance enumerates the values for device compliance. -type DeviceCompliance string - -const ( - // Disable specifies the disable state for device compliance. - Disable DeviceCompliance = "disable" - // Enable specifies the enable state for device compliance. - Enable DeviceCompliance = "enable" -) - -// FileEncryption enumerates the values for file encryption. -type FileEncryption string - -const ( - // FileEncryptionNotRequired specifies the file encryption not required - // state for file encryption. - FileEncryptionNotRequired FileEncryption = "notRequired" - // FileEncryptionRequired specifies the file encryption required state for - // file encryption. - FileEncryptionRequired FileEncryption = "required" -) - -// FileEncryptionLevel enumerates the values for file encryption level. -type FileEncryptionLevel string - -const ( - // AfterDeviceRestart specifies the after device restart state for file - // encryption level. - AfterDeviceRestart FileEncryptionLevel = "afterDeviceRestart" - // DeviceLocked specifies the device locked state for file encryption - // level. - DeviceLocked FileEncryptionLevel = "deviceLocked" - // DeviceLockedExceptFilesOpen specifies the device locked except files - // open state for file encryption level. - DeviceLockedExceptFilesOpen FileEncryptionLevel = "deviceLockedExceptFilesOpen" - // UseDeviceSettings specifies the use device settings state for file - // encryption level. - UseDeviceSettings FileEncryptionLevel = "useDeviceSettings" -) - -// FileSharingSaveAs enumerates the values for file sharing save as. -type FileSharingSaveAs string - -const ( - // FileSharingSaveAsAllow specifies the file sharing save as allow state - // for file sharing save as. - FileSharingSaveAsAllow FileSharingSaveAs = "allow" - // FileSharingSaveAsBlock specifies the file sharing save as block state - // for file sharing save as. - FileSharingSaveAsBlock FileSharingSaveAs = "block" -) - -// GroupStatus enumerates the values for group status. -type GroupStatus string - -const ( - // NotTargeted specifies the not targeted state for group status. - NotTargeted GroupStatus = "notTargeted" - // Targeted specifies the targeted state for group status. - Targeted GroupStatus = "targeted" -) - -// ManagedBrowser enumerates the values for managed browser. -type ManagedBrowser string - -const ( - // ManagedBrowserNotRequired specifies the managed browser not required - // state for managed browser. - ManagedBrowserNotRequired ManagedBrowser = "notRequired" - // ManagedBrowserRequired specifies the managed browser required state for - // managed browser. - ManagedBrowserRequired ManagedBrowser = "required" -) - -// Pin enumerates the values for pin. -type Pin string - -const ( - // PinNotRequired specifies the pin not required state for pin. - PinNotRequired Pin = "notRequired" - // PinRequired specifies the pin required state for pin. - PinRequired Pin = "required" -) - -// Platform enumerates the values for platform. -type Platform string - -const ( - // Android specifies the android state for platform. - Android Platform = "android" - // Ios specifies the ios state for platform. - Ios Platform = "ios" - // Windows specifies the windows state for platform. - Windows Platform = "windows" -) - -// ScreenCapture enumerates the values for screen capture. -type ScreenCapture string - -const ( - // ScreenCaptureAllow specifies the screen capture allow state for screen - // capture. - ScreenCaptureAllow ScreenCapture = "allow" - // ScreenCaptureBlock specifies the screen capture block state for screen - // capture. - ScreenCaptureBlock ScreenCapture = "block" -) - -// TouchID enumerates the values for touch id. -type TouchID string - -const ( - // TouchIDDisable specifies the touch id disable state for touch id. - TouchIDDisable TouchID = "disable" - // TouchIDEnable specifies the touch id enable state for touch id. - TouchIDEnable TouchID = "enable" -) - -// AndroidMAMPolicy is android Policy entity for Intune MAM. -type AndroidMAMPolicy struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *AndroidMAMPolicyProperties `json:"properties,omitempty"` -} - -// AndroidMAMPolicyCollection is -type AndroidMAMPolicyCollection struct { - autorest.Response `json:"-"` - Value *[]AndroidMAMPolicy `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// AndroidMAMPolicyCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AndroidMAMPolicyCollection) AndroidMAMPolicyCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// AndroidMAMPolicyProperties is intune MAM iOS Policy Properties. -type AndroidMAMPolicyProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` - Description *string `json:"description,omitempty"` - AppSharingFromLevel AppSharingFromLevel `json:"appSharingFromLevel,omitempty"` - AppSharingToLevel AppSharingToLevel `json:"appSharingToLevel,omitempty"` - Authentication Authentication `json:"authentication,omitempty"` - ClipboardSharingLevel ClipboardSharingLevel `json:"clipboardSharingLevel,omitempty"` - DataBackup DataBackup `json:"dataBackup,omitempty"` - FileSharingSaveAs FileSharingSaveAs `json:"fileSharingSaveAs,omitempty"` - Pin Pin `json:"pin,omitempty"` - PinNumRetry *int32 `json:"pinNumRetry,omitempty"` - DeviceCompliance DeviceCompliance `json:"deviceCompliance,omitempty"` - ManagedBrowser ManagedBrowser `json:"managedBrowser,omitempty"` - AccessRecheckOfflineTimeout *string `json:"accessRecheckOfflineTimeout,omitempty"` - AccessRecheckOnlineTimeout *string `json:"accessRecheckOnlineTimeout,omitempty"` - OfflineWipeTimeout *string `json:"offlineWipeTimeout,omitempty"` - NumOfApps *int32 `json:"numOfApps,omitempty"` - GroupStatus GroupStatus `json:"groupStatus,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - ScreenCapture ScreenCapture `json:"screenCapture,omitempty"` - FileEncryption FileEncryption `json:"fileEncryption,omitempty"` -} - -// Application is application entity for Intune MAM. -type Application struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *ApplicationProperties `json:"properties,omitempty"` -} - -// ApplicationCollection is -type ApplicationCollection struct { - autorest.Response `json:"-"` - Value *[]Application `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// ApplicationCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ApplicationCollection) ApplicationCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// ApplicationProperties is -type ApplicationProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` - Platform Platform `json:"platform,omitempty"` - AppID *string `json:"appId,omitempty"` -} - -// Device is device entity for Intune. -type Device struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *DeviceProperties `json:"properties,omitempty"` -} - -// DeviceCollection is -type DeviceCollection struct { - autorest.Response `json:"-"` - Value *[]Device `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// DeviceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DeviceCollection) DeviceCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// DeviceProperties is -type DeviceProperties struct { - UserID *string `json:"userId,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - Platform *string `json:"platform,omitempty"` - PlatformVersion *string `json:"platformVersion,omitempty"` - DeviceType *string `json:"deviceType,omitempty"` -} - -// Error is -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// FlaggedEnrolledApp is flagged Enrolled App for the given tenant. -type FlaggedEnrolledApp struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *FlaggedEnrolledAppProperties `json:"properties,omitempty"` -} - -// FlaggedEnrolledAppCollection is flagged Enrolled App collection for the -// given tenant. -type FlaggedEnrolledAppCollection struct { - autorest.Response `json:"-"` - Value *[]FlaggedEnrolledApp `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// FlaggedEnrolledAppCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client FlaggedEnrolledAppCollection) FlaggedEnrolledAppCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// FlaggedEnrolledAppError is -type FlaggedEnrolledAppError struct { - ErrorCode *string `json:"errorCode,omitempty"` - Severity *string `json:"severity,omitempty"` -} - -// FlaggedEnrolledAppProperties is -type FlaggedEnrolledAppProperties struct { - DeviceType *string `json:"deviceType,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - Platform *string `json:"platform,omitempty"` - Errors *[]FlaggedEnrolledAppError `json:"errors,omitempty"` -} - -// FlaggedUser is flagged user for the given tenant. -type FlaggedUser struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *FlaggedUserProperties `json:"properties,omitempty"` -} - -// FlaggedUserCollection is flagged user collection for the given tenant. -type FlaggedUserCollection struct { - autorest.Response `json:"-"` - Value *[]FlaggedUser `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// FlaggedUserCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client FlaggedUserCollection) FlaggedUserCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// FlaggedUserProperties is -type FlaggedUserProperties struct { - ErrorCount *int32 `json:"errorCount,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// GroupItem is group entity for Intune MAM. -type GroupItem struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *GroupProperties `json:"properties,omitempty"` -} - -// GroupProperties is -type GroupProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// GroupsCollection is -type GroupsCollection struct { - autorest.Response `json:"-"` - Value *[]GroupItem `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// GroupsCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client GroupsCollection) GroupsCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// IOSMAMPolicy is iOS Policy entity for Intune MAM. -type IOSMAMPolicy struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *IOSMAMPolicyProperties `json:"properties,omitempty"` -} - -// IOSMAMPolicyCollection is -type IOSMAMPolicyCollection struct { - autorest.Response `json:"-"` - Value *[]IOSMAMPolicy `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// IOSMAMPolicyCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IOSMAMPolicyCollection) IOSMAMPolicyCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// IOSMAMPolicyProperties is intune MAM iOS Policy Properties. -type IOSMAMPolicyProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` - Description *string `json:"description,omitempty"` - AppSharingFromLevel AppSharingFromLevel `json:"appSharingFromLevel,omitempty"` - AppSharingToLevel AppSharingToLevel `json:"appSharingToLevel,omitempty"` - Authentication Authentication `json:"authentication,omitempty"` - ClipboardSharingLevel ClipboardSharingLevel `json:"clipboardSharingLevel,omitempty"` - DataBackup DataBackup `json:"dataBackup,omitempty"` - FileSharingSaveAs FileSharingSaveAs `json:"fileSharingSaveAs,omitempty"` - Pin Pin `json:"pin,omitempty"` - PinNumRetry *int32 `json:"pinNumRetry,omitempty"` - DeviceCompliance DeviceCompliance `json:"deviceCompliance,omitempty"` - ManagedBrowser ManagedBrowser `json:"managedBrowser,omitempty"` - AccessRecheckOfflineTimeout *string `json:"accessRecheckOfflineTimeout,omitempty"` - AccessRecheckOnlineTimeout *string `json:"accessRecheckOnlineTimeout,omitempty"` - OfflineWipeTimeout *string `json:"offlineWipeTimeout,omitempty"` - NumOfApps *int32 `json:"numOfApps,omitempty"` - GroupStatus GroupStatus `json:"groupStatus,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - FileEncryptionLevel FileEncryptionLevel `json:"fileEncryptionLevel,omitempty"` - TouchID TouchID `json:"touchId,omitempty"` -} - -// Location is location entity for given tenant. -type Location struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *LocationProperties `json:"properties,omitempty"` -} - -// LocationCollection is -type LocationCollection struct { - autorest.Response `json:"-"` - Value *[]Location `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// LocationCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client LocationCollection) LocationCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// LocationProperties is -type LocationProperties struct { - HostName *string `json:"hostName,omitempty"` -} - -// MAMPolicyAppIDOrGroupIDPayload is mAM Policy request body for properties -// Intune MAM. -type MAMPolicyAppIDOrGroupIDPayload struct { - Properties *MAMPolicyAppOrGroupIDProperties `json:"properties,omitempty"` -} - -// MAMPolicyAppOrGroupIDProperties is android Policy request body for Intune -// MAM. -type MAMPolicyAppOrGroupIDProperties struct { - URL *string `json:"url,omitempty"` -} - -// MAMPolicyProperties is -type MAMPolicyProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` - Description *string `json:"description,omitempty"` - AppSharingFromLevel AppSharingFromLevel `json:"appSharingFromLevel,omitempty"` - AppSharingToLevel AppSharingToLevel `json:"appSharingToLevel,omitempty"` - Authentication Authentication `json:"authentication,omitempty"` - ClipboardSharingLevel ClipboardSharingLevel `json:"clipboardSharingLevel,omitempty"` - DataBackup DataBackup `json:"dataBackup,omitempty"` - FileSharingSaveAs FileSharingSaveAs `json:"fileSharingSaveAs,omitempty"` - Pin Pin `json:"pin,omitempty"` - PinNumRetry *int32 `json:"pinNumRetry,omitempty"` - DeviceCompliance DeviceCompliance `json:"deviceCompliance,omitempty"` - ManagedBrowser ManagedBrowser `json:"managedBrowser,omitempty"` - AccessRecheckOfflineTimeout *string `json:"accessRecheckOfflineTimeout,omitempty"` - AccessRecheckOnlineTimeout *string `json:"accessRecheckOnlineTimeout,omitempty"` - OfflineWipeTimeout *string `json:"offlineWipeTimeout,omitempty"` - NumOfApps *int32 `json:"numOfApps,omitempty"` - GroupStatus GroupStatus `json:"groupStatus,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` -} - -// OperationMetadataProperties is -type OperationMetadataProperties struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// OperationResult is operationResult entity for Intune. -type OperationResult struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *OperationResultProperties `json:"properties,omitempty"` -} - -// OperationResultCollection is -type OperationResultCollection struct { - autorest.Response `json:"-"` - Value *[]OperationResult `json:"value,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// OperationResultCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationResultCollection) OperationResultCollectionPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// OperationResultProperties is -type OperationResultProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` - Category *string `json:"category,omitempty"` - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - State *string `json:"state,omitempty"` - OperationMetadata *[]OperationMetadataProperties `json:"operationMetadata,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` -} - -// StatusesDefault is default Statuses entity for the given tenant. -type StatusesDefault struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *StatusesProperties `json:"properties,omitempty"` - Nextlink *string `json:"nextlink,omitempty"` -} - -// StatusesDefaultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client StatusesDefault) StatusesDefaultPreparer() (*http.Request, error) { - if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.Nextlink))) -} - -// StatusesProperties is -type StatusesProperties struct { - DeployedPolicies *int32 `json:"deployedPolicies,omitempty"` - EnrolledUsers *int32 `json:"enrolledUsers,omitempty"` - FlaggedUsers *int32 `json:"flaggedUsers,omitempty"` - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - PolicyAppliedUsers *int32 `json:"policyAppliedUsers,omitempty"` - Status *string `json:"status,omitempty"` - WipeFailedApps *int32 `json:"wipeFailedApps,omitempty"` - WipePendingApps *int32 `json:"wipePendingApps,omitempty"` - WipeSucceededApps *int32 `json:"wipeSucceededApps,omitempty"` -} - -// WipeDeviceOperationResult is device entity for Intune. -type WipeDeviceOperationResult struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *WipeDeviceOperationResultProperties `json:"properties,omitempty"` -} - -// WipeDeviceOperationResultProperties is -type WipeDeviceOperationResultProperties struct { - Value *string `json:"value,omitempty"` -} +package intune + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AppSharingFromLevel enumerates the values for app sharing from level. +type AppSharingFromLevel string + +const ( + // AllApps specifies the all apps state for app sharing from level. + AllApps AppSharingFromLevel = "allApps" + // None specifies the none state for app sharing from level. + None AppSharingFromLevel = "none" + // PolicyManagedApps specifies the policy managed apps state for app + // sharing from level. + PolicyManagedApps AppSharingFromLevel = "policyManagedApps" +) + +// AppSharingToLevel enumerates the values for app sharing to level. +type AppSharingToLevel string + +const ( + // AppSharingToLevelAllApps specifies the app sharing to level all apps + // state for app sharing to level. + AppSharingToLevelAllApps AppSharingToLevel = "allApps" + // AppSharingToLevelNone specifies the app sharing to level none state for + // app sharing to level. + AppSharingToLevelNone AppSharingToLevel = "none" + // AppSharingToLevelPolicyManagedApps specifies the app sharing to level + // policy managed apps state for app sharing to level. + AppSharingToLevelPolicyManagedApps AppSharingToLevel = "policyManagedApps" +) + +// Authentication enumerates the values for authentication. +type Authentication string + +const ( + // NotRequired specifies the not required state for authentication. + NotRequired Authentication = "notRequired" + // Required specifies the required state for authentication. + Required Authentication = "required" +) + +// ClipboardSharingLevel enumerates the values for clipboard sharing level. +type ClipboardSharingLevel string + +const ( + // ClipboardSharingLevelAllApps specifies the clipboard sharing level all + // apps state for clipboard sharing level. + ClipboardSharingLevelAllApps ClipboardSharingLevel = "allApps" + // ClipboardSharingLevelBlocked specifies the clipboard sharing level + // blocked state for clipboard sharing level. + ClipboardSharingLevelBlocked ClipboardSharingLevel = "blocked" + // ClipboardSharingLevelPolicyManagedApps specifies the clipboard sharing + // level policy managed apps state for clipboard sharing level. + ClipboardSharingLevelPolicyManagedApps ClipboardSharingLevel = "policyManagedApps" + // ClipboardSharingLevelPolicyManagedAppsWithPasteIn specifies the + // clipboard sharing level policy managed apps with paste in state for + // clipboard sharing level. + ClipboardSharingLevelPolicyManagedAppsWithPasteIn ClipboardSharingLevel = "policyManagedAppsWithPasteIn" +) + +// DataBackup enumerates the values for data backup. +type DataBackup string + +const ( + // Allow specifies the allow state for data backup. + Allow DataBackup = "allow" + // Block specifies the block state for data backup. + Block DataBackup = "block" +) + +// DeviceCompliance enumerates the values for device compliance. +type DeviceCompliance string + +const ( + // Disable specifies the disable state for device compliance. + Disable DeviceCompliance = "disable" + // Enable specifies the enable state for device compliance. + Enable DeviceCompliance = "enable" +) + +// FileEncryption enumerates the values for file encryption. +type FileEncryption string + +const ( + // FileEncryptionNotRequired specifies the file encryption not required + // state for file encryption. + FileEncryptionNotRequired FileEncryption = "notRequired" + // FileEncryptionRequired specifies the file encryption required state for + // file encryption. + FileEncryptionRequired FileEncryption = "required" +) + +// FileEncryptionLevel enumerates the values for file encryption level. +type FileEncryptionLevel string + +const ( + // AfterDeviceRestart specifies the after device restart state for file + // encryption level. + AfterDeviceRestart FileEncryptionLevel = "afterDeviceRestart" + // DeviceLocked specifies the device locked state for file encryption + // level. + DeviceLocked FileEncryptionLevel = "deviceLocked" + // DeviceLockedExceptFilesOpen specifies the device locked except files + // open state for file encryption level. + DeviceLockedExceptFilesOpen FileEncryptionLevel = "deviceLockedExceptFilesOpen" + // UseDeviceSettings specifies the use device settings state for file + // encryption level. + UseDeviceSettings FileEncryptionLevel = "useDeviceSettings" +) + +// FileSharingSaveAs enumerates the values for file sharing save as. +type FileSharingSaveAs string + +const ( + // FileSharingSaveAsAllow specifies the file sharing save as allow state + // for file sharing save as. + FileSharingSaveAsAllow FileSharingSaveAs = "allow" + // FileSharingSaveAsBlock specifies the file sharing save as block state + // for file sharing save as. + FileSharingSaveAsBlock FileSharingSaveAs = "block" +) + +// GroupStatus enumerates the values for group status. +type GroupStatus string + +const ( + // NotTargeted specifies the not targeted state for group status. + NotTargeted GroupStatus = "notTargeted" + // Targeted specifies the targeted state for group status. + Targeted GroupStatus = "targeted" +) + +// ManagedBrowser enumerates the values for managed browser. +type ManagedBrowser string + +const ( + // ManagedBrowserNotRequired specifies the managed browser not required + // state for managed browser. + ManagedBrowserNotRequired ManagedBrowser = "notRequired" + // ManagedBrowserRequired specifies the managed browser required state for + // managed browser. + ManagedBrowserRequired ManagedBrowser = "required" +) + +// Pin enumerates the values for pin. +type Pin string + +const ( + // PinNotRequired specifies the pin not required state for pin. + PinNotRequired Pin = "notRequired" + // PinRequired specifies the pin required state for pin. + PinRequired Pin = "required" +) + +// Platform enumerates the values for platform. +type Platform string + +const ( + // Android specifies the android state for platform. + Android Platform = "android" + // Ios specifies the ios state for platform. + Ios Platform = "ios" + // Windows specifies the windows state for platform. + Windows Platform = "windows" +) + +// ScreenCapture enumerates the values for screen capture. +type ScreenCapture string + +const ( + // ScreenCaptureAllow specifies the screen capture allow state for screen + // capture. + ScreenCaptureAllow ScreenCapture = "allow" + // ScreenCaptureBlock specifies the screen capture block state for screen + // capture. + ScreenCaptureBlock ScreenCapture = "block" +) + +// TouchID enumerates the values for touch id. +type TouchID string + +const ( + // TouchIDDisable specifies the touch id disable state for touch id. + TouchIDDisable TouchID = "disable" + // TouchIDEnable specifies the touch id enable state for touch id. + TouchIDEnable TouchID = "enable" +) + +// AndroidMAMPolicy is android Policy entity for Intune MAM. +type AndroidMAMPolicy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *AndroidMAMPolicyProperties `json:"properties,omitempty"` +} + +// AndroidMAMPolicyCollection is +type AndroidMAMPolicyCollection struct { + autorest.Response `json:"-"` + Value *[]AndroidMAMPolicy `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// AndroidMAMPolicyCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AndroidMAMPolicyCollection) AndroidMAMPolicyCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// AndroidMAMPolicyProperties is intune MAM iOS Policy Properties. +type AndroidMAMPolicyProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + Description *string `json:"description,omitempty"` + AppSharingFromLevel AppSharingFromLevel `json:"appSharingFromLevel,omitempty"` + AppSharingToLevel AppSharingToLevel `json:"appSharingToLevel,omitempty"` + Authentication Authentication `json:"authentication,omitempty"` + ClipboardSharingLevel ClipboardSharingLevel `json:"clipboardSharingLevel,omitempty"` + DataBackup DataBackup `json:"dataBackup,omitempty"` + FileSharingSaveAs FileSharingSaveAs `json:"fileSharingSaveAs,omitempty"` + Pin Pin `json:"pin,omitempty"` + PinNumRetry *int32 `json:"pinNumRetry,omitempty"` + DeviceCompliance DeviceCompliance `json:"deviceCompliance,omitempty"` + ManagedBrowser ManagedBrowser `json:"managedBrowser,omitempty"` + AccessRecheckOfflineTimeout *string `json:"accessRecheckOfflineTimeout,omitempty"` + AccessRecheckOnlineTimeout *string `json:"accessRecheckOnlineTimeout,omitempty"` + OfflineWipeTimeout *string `json:"offlineWipeTimeout,omitempty"` + NumOfApps *int32 `json:"numOfApps,omitempty"` + GroupStatus GroupStatus `json:"groupStatus,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + ScreenCapture ScreenCapture `json:"screenCapture,omitempty"` + FileEncryption FileEncryption `json:"fileEncryption,omitempty"` +} + +// Application is application entity for Intune MAM. +type Application struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *ApplicationProperties `json:"properties,omitempty"` +} + +// ApplicationCollection is +type ApplicationCollection struct { + autorest.Response `json:"-"` + Value *[]Application `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// ApplicationCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ApplicationCollection) ApplicationCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// ApplicationProperties is +type ApplicationProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + Platform Platform `json:"platform,omitempty"` + AppID *string `json:"appId,omitempty"` +} + +// Device is device entity for Intune. +type Device struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *DeviceProperties `json:"properties,omitempty"` +} + +// DeviceCollection is +type DeviceCollection struct { + autorest.Response `json:"-"` + Value *[]Device `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// DeviceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DeviceCollection) DeviceCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// DeviceProperties is +type DeviceProperties struct { + UserID *string `json:"userId,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Platform *string `json:"platform,omitempty"` + PlatformVersion *string `json:"platformVersion,omitempty"` + DeviceType *string `json:"deviceType,omitempty"` +} + +// Error is +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// FlaggedEnrolledApp is flagged Enrolled App for the given tenant. +type FlaggedEnrolledApp struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *FlaggedEnrolledAppProperties `json:"properties,omitempty"` +} + +// FlaggedEnrolledAppCollection is flagged Enrolled App collection for the +// given tenant. +type FlaggedEnrolledAppCollection struct { + autorest.Response `json:"-"` + Value *[]FlaggedEnrolledApp `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// FlaggedEnrolledAppCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client FlaggedEnrolledAppCollection) FlaggedEnrolledAppCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// FlaggedEnrolledAppError is +type FlaggedEnrolledAppError struct { + ErrorCode *string `json:"errorCode,omitempty"` + Severity *string `json:"severity,omitempty"` +} + +// FlaggedEnrolledAppProperties is +type FlaggedEnrolledAppProperties struct { + DeviceType *string `json:"deviceType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + Platform *string `json:"platform,omitempty"` + Errors *[]FlaggedEnrolledAppError `json:"errors,omitempty"` +} + +// FlaggedUser is flagged user for the given tenant. +type FlaggedUser struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *FlaggedUserProperties `json:"properties,omitempty"` +} + +// FlaggedUserCollection is flagged user collection for the given tenant. +type FlaggedUserCollection struct { + autorest.Response `json:"-"` + Value *[]FlaggedUser `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// FlaggedUserCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client FlaggedUserCollection) FlaggedUserCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// FlaggedUserProperties is +type FlaggedUserProperties struct { + ErrorCount *int32 `json:"errorCount,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// GroupItem is group entity for Intune MAM. +type GroupItem struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *GroupProperties `json:"properties,omitempty"` +} + +// GroupProperties is +type GroupProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// GroupsCollection is +type GroupsCollection struct { + autorest.Response `json:"-"` + Value *[]GroupItem `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// GroupsCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client GroupsCollection) GroupsCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// IOSMAMPolicy is iOS Policy entity for Intune MAM. +type IOSMAMPolicy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *IOSMAMPolicyProperties `json:"properties,omitempty"` +} + +// IOSMAMPolicyCollection is +type IOSMAMPolicyCollection struct { + autorest.Response `json:"-"` + Value *[]IOSMAMPolicy `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// IOSMAMPolicyCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IOSMAMPolicyCollection) IOSMAMPolicyCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// IOSMAMPolicyProperties is intune MAM iOS Policy Properties. +type IOSMAMPolicyProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + Description *string `json:"description,omitempty"` + AppSharingFromLevel AppSharingFromLevel `json:"appSharingFromLevel,omitempty"` + AppSharingToLevel AppSharingToLevel `json:"appSharingToLevel,omitempty"` + Authentication Authentication `json:"authentication,omitempty"` + ClipboardSharingLevel ClipboardSharingLevel `json:"clipboardSharingLevel,omitempty"` + DataBackup DataBackup `json:"dataBackup,omitempty"` + FileSharingSaveAs FileSharingSaveAs `json:"fileSharingSaveAs,omitempty"` + Pin Pin `json:"pin,omitempty"` + PinNumRetry *int32 `json:"pinNumRetry,omitempty"` + DeviceCompliance DeviceCompliance `json:"deviceCompliance,omitempty"` + ManagedBrowser ManagedBrowser `json:"managedBrowser,omitempty"` + AccessRecheckOfflineTimeout *string `json:"accessRecheckOfflineTimeout,omitempty"` + AccessRecheckOnlineTimeout *string `json:"accessRecheckOnlineTimeout,omitempty"` + OfflineWipeTimeout *string `json:"offlineWipeTimeout,omitempty"` + NumOfApps *int32 `json:"numOfApps,omitempty"` + GroupStatus GroupStatus `json:"groupStatus,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + FileEncryptionLevel FileEncryptionLevel `json:"fileEncryptionLevel,omitempty"` + TouchID TouchID `json:"touchId,omitempty"` +} + +// Location is location entity for given tenant. +type Location struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *LocationProperties `json:"properties,omitempty"` +} + +// LocationCollection is +type LocationCollection struct { + autorest.Response `json:"-"` + Value *[]Location `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// LocationCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client LocationCollection) LocationCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// LocationProperties is +type LocationProperties struct { + HostName *string `json:"hostName,omitempty"` +} + +// MAMPolicyAppIDOrGroupIDPayload is mAM Policy request body for properties +// Intune MAM. +type MAMPolicyAppIDOrGroupIDPayload struct { + Properties *MAMPolicyAppOrGroupIDProperties `json:"properties,omitempty"` +} + +// MAMPolicyAppOrGroupIDProperties is android Policy request body for Intune +// MAM. +type MAMPolicyAppOrGroupIDProperties struct { + URL *string `json:"url,omitempty"` +} + +// MAMPolicyProperties is +type MAMPolicyProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + Description *string `json:"description,omitempty"` + AppSharingFromLevel AppSharingFromLevel `json:"appSharingFromLevel,omitempty"` + AppSharingToLevel AppSharingToLevel `json:"appSharingToLevel,omitempty"` + Authentication Authentication `json:"authentication,omitempty"` + ClipboardSharingLevel ClipboardSharingLevel `json:"clipboardSharingLevel,omitempty"` + DataBackup DataBackup `json:"dataBackup,omitempty"` + FileSharingSaveAs FileSharingSaveAs `json:"fileSharingSaveAs,omitempty"` + Pin Pin `json:"pin,omitempty"` + PinNumRetry *int32 `json:"pinNumRetry,omitempty"` + DeviceCompliance DeviceCompliance `json:"deviceCompliance,omitempty"` + ManagedBrowser ManagedBrowser `json:"managedBrowser,omitempty"` + AccessRecheckOfflineTimeout *string `json:"accessRecheckOfflineTimeout,omitempty"` + AccessRecheckOnlineTimeout *string `json:"accessRecheckOnlineTimeout,omitempty"` + OfflineWipeTimeout *string `json:"offlineWipeTimeout,omitempty"` + NumOfApps *int32 `json:"numOfApps,omitempty"` + GroupStatus GroupStatus `json:"groupStatus,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` +} + +// OperationMetadataProperties is +type OperationMetadataProperties struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// OperationResult is operationResult entity for Intune. +type OperationResult struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *OperationResultProperties `json:"properties,omitempty"` +} + +// OperationResultCollection is +type OperationResultCollection struct { + autorest.Response `json:"-"` + Value *[]OperationResult `json:"value,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// OperationResultCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationResultCollection) OperationResultCollectionPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// OperationResultProperties is +type OperationResultProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + Category *string `json:"category,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + State *string `json:"state,omitempty"` + OperationMetadata *[]OperationMetadataProperties `json:"operationMetadata,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` +} + +// StatusesDefault is default Statuses entity for the given tenant. +type StatusesDefault struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *StatusesProperties `json:"properties,omitempty"` + Nextlink *string `json:"nextlink,omitempty"` +} + +// StatusesDefaultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client StatusesDefault) StatusesDefaultPreparer() (*http.Request, error) { + if client.Nextlink == nil || len(to.String(client.Nextlink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.Nextlink))) +} + +// StatusesProperties is +type StatusesProperties struct { + DeployedPolicies *int32 `json:"deployedPolicies,omitempty"` + EnrolledUsers *int32 `json:"enrolledUsers,omitempty"` + FlaggedUsers *int32 `json:"flaggedUsers,omitempty"` + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + PolicyAppliedUsers *int32 `json:"policyAppliedUsers,omitempty"` + Status *string `json:"status,omitempty"` + WipeFailedApps *int32 `json:"wipeFailedApps,omitempty"` + WipePendingApps *int32 `json:"wipePendingApps,omitempty"` + WipeSucceededApps *int32 `json:"wipeSucceededApps,omitempty"` +} + +// WipeDeviceOperationResult is device entity for Intune. +type WipeDeviceOperationResult struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *WipeDeviceOperationResultProperties `json:"properties,omitempty"` +} + +// WipeDeviceOperationResultProperties is +type WipeDeviceOperationResultProperties struct { + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/version.go index 38862eedc5..4d79e09d0f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/intune/version.go @@ -1,29 +1,29 @@ -package intune - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-intune/2015-01-14-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package intune + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-intune/2015-01-14-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/client.go index efdd4318ad..b54c132eee 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/client.go @@ -1,53 +1,53 @@ -// Package iothub implements the Azure ARM Iothub service API version -// 2016-02-03. -// -// Use this API to manage the IoT hubs in your subscription. -package iothub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Iothub - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Iothub. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package iothub implements the Azure ARM Iothub service API version +// 2016-02-03. +// +// Use this API to manage the IoT hubs in your subscription. +package iothub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Iothub + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Iothub. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/models.go index 2004f5d5a0..6fa4abb253 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/models.go @@ -1,539 +1,539 @@ -package iothub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // DeviceConnect specifies the device connect state for access rights. - DeviceConnect AccessRights = "DeviceConnect" - // RegistryRead specifies the registry read state for access rights. - RegistryRead AccessRights = "RegistryRead" - // RegistryReadDeviceConnect specifies the registry read device connect - // state for access rights. - RegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" - // RegistryReadRegistryWrite specifies the registry read registry write - // state for access rights. - RegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" - // RegistryReadRegistryWriteDeviceConnect specifies the registry read - // registry write device connect state for access rights. - RegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" - // RegistryReadRegistryWriteServiceConnect specifies the registry read - // registry write service connect state for access rights. - RegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" - // RegistryReadRegistryWriteServiceConnectDeviceConnect specifies the - // registry read registry write service connect device connect state for - // access rights. - RegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" - // RegistryReadServiceConnect specifies the registry read service connect - // state for access rights. - RegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" - // RegistryReadServiceConnectDeviceConnect specifies the registry read - // service connect device connect state for access rights. - RegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" - // RegistryWrite specifies the registry write state for access rights. - RegistryWrite AccessRights = "RegistryWrite" - // RegistryWriteDeviceConnect specifies the registry write device connect - // state for access rights. - RegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" - // RegistryWriteServiceConnect specifies the registry write service connect - // state for access rights. - RegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" - // RegistryWriteServiceConnectDeviceConnect specifies the registry write - // service connect device connect state for access rights. - RegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" - // ServiceConnect specifies the service connect state for access rights. - ServiceConnect AccessRights = "ServiceConnect" - // ServiceConnectDeviceConnect specifies the service connect device connect - // state for access rights. - ServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" -) - -// Capabilities enumerates the values for capabilities. -type Capabilities string - -const ( - // DeviceManagement specifies the device management state for capabilities. - DeviceManagement Capabilities = "DeviceManagement" - // None specifies the none state for capabilities. - None Capabilities = "None" -) - -// IPFilterActionType enumerates the values for ip filter action type. -type IPFilterActionType string - -const ( - // Accept specifies the accept state for ip filter action type. - Accept IPFilterActionType = "Accept" - // Reject specifies the reject state for ip filter action type. - Reject IPFilterActionType = "Reject" -) - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // Cancelled specifies the cancelled state for job status. - Cancelled JobStatus = "cancelled" - // Completed specifies the completed state for job status. - Completed JobStatus = "completed" - // Enqueued specifies the enqueued state for job status. - Enqueued JobStatus = "enqueued" - // Failed specifies the failed state for job status. - Failed JobStatus = "failed" - // Running specifies the running state for job status. - Running JobStatus = "running" - // Unknown specifies the unknown state for job status. - Unknown JobStatus = "unknown" -) - -// JobType enumerates the values for job type. -type JobType string - -const ( - // JobTypeBackup specifies the job type backup state for job type. - JobTypeBackup JobType = "backup" - // JobTypeExport specifies the job type export state for job type. - JobTypeExport JobType = "export" - // JobTypeFactoryResetDevice specifies the job type factory reset device - // state for job type. - JobTypeFactoryResetDevice JobType = "factoryResetDevice" - // JobTypeFirmwareUpdate specifies the job type firmware update state for - // job type. - JobTypeFirmwareUpdate JobType = "firmwareUpdate" - // JobTypeImport specifies the job type import state for job type. - JobTypeImport JobType = "import" - // JobTypeReadDeviceProperties specifies the job type read device - // properties state for job type. - JobTypeReadDeviceProperties JobType = "readDeviceProperties" - // JobTypeRebootDevice specifies the job type reboot device state for job - // type. - JobTypeRebootDevice JobType = "rebootDevice" - // JobTypeUnknown specifies the job type unknown state for job type. - JobTypeUnknown JobType = "unknown" - // JobTypeUpdateDeviceConfiguration specifies the job type update device - // configuration state for job type. - JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration" - // JobTypeWriteDeviceProperties specifies the job type write device - // properties state for job type. - JobTypeWriteDeviceProperties JobType = "writeDeviceProperties" -) - -// NameUnavailabilityReason enumerates the values for name unavailability -// reason. -type NameUnavailabilityReason string - -const ( - // AlreadyExists specifies the already exists state for name unavailability - // reason. - AlreadyExists NameUnavailabilityReason = "AlreadyExists" - // Invalid specifies the invalid state for name unavailability reason. - Invalid NameUnavailabilityReason = "Invalid" -) - -// OperationMonitoringLevel enumerates the values for operation monitoring -// level. -type OperationMonitoringLevel string - -const ( - // OperationMonitoringLevelError specifies the operation monitoring level - // error state for operation monitoring level. - OperationMonitoringLevelError OperationMonitoringLevel = "Error" - // OperationMonitoringLevelErrorInformation specifies the operation - // monitoring level error information state for operation monitoring level. - OperationMonitoringLevelErrorInformation OperationMonitoringLevel = "Error, Information" - // OperationMonitoringLevelInformation specifies the operation monitoring - // level information state for operation monitoring level. - OperationMonitoringLevelInformation OperationMonitoringLevel = "Information" - // OperationMonitoringLevelNone specifies the operation monitoring level - // none state for operation monitoring level. - OperationMonitoringLevelNone OperationMonitoringLevel = "None" -) - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ScaleTypeAutomatic specifies the scale type automatic state for scale - // type. - ScaleTypeAutomatic ScaleType = "Automatic" - // ScaleTypeManual specifies the scale type manual state for scale type. - ScaleTypeManual ScaleType = "Manual" - // ScaleTypeNone specifies the scale type none state for scale type. - ScaleTypeNone ScaleType = "None" -) - -// Sku enumerates the values for sku. -type Sku string - -const ( - // F1 specifies the f1 state for sku. - F1 Sku = "F1" - // S1 specifies the s1 state for sku. - S1 Sku = "S1" - // S2 specifies the s2 state for sku. - S2 Sku = "S2" - // S3 specifies the s3 state for sku. - S3 Sku = "S3" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Free specifies the free state for sku tier. - Free SkuTier = "Free" - // Standard specifies the standard state for sku tier. - Standard SkuTier = "Standard" -) - -// Capacity is ioT Hub capacity information. -type Capacity struct { - Minimum *int64 `json:"minimum,omitempty"` - Maximum *int64 `json:"maximum,omitempty"` - Default *int64 `json:"default,omitempty"` - ScaleType ScaleType `json:"scaleType,omitempty"` -} - -// CloudToDeviceProperties is the IoT hub cloud-to-device messaging properties. -type CloudToDeviceProperties struct { - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` - DefaultTTLAsIso8601 *string `json:"defaultTtlAsIso8601,omitempty"` - Feedback *FeedbackProperties `json:"feedback,omitempty"` -} - -// Description is the description of the IoT hub. -type Description struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Subscriptionid *string `json:"subscriptionid,omitempty"` - Resourcegroup *string `json:"resourcegroup,omitempty"` - Etag *string `json:"etag,omitempty"` - Properties *Properties `json:"properties,omitempty"` - Sku *SkuInfo `json:"sku,omitempty"` -} - -// DescriptionListResult is the JSON-serialized array of IotHubDescription -// objects with a next link. -type DescriptionListResult struct { - autorest.Response `json:"-"` - Value *[]Description `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DescriptionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DescriptionListResult) DescriptionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ErrorDetails is error details. -type ErrorDetails struct { - Code *string `json:"Code,omitempty"` - HTTPStatusCode *string `json:"HttpStatusCode,omitempty"` - Message *string `json:"Message,omitempty"` - Details *string `json:"Details,omitempty"` -} - -// EventHubConsumerGroupInfo is the properties of the EventHubConsumerGroupInfo -// object. -type EventHubConsumerGroupInfo struct { - autorest.Response `json:"-"` - Tags *map[string]*string `json:"tags,omitempty"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -// EventHubConsumerGroupsListResult is the JSON-serialized array of Event -// Hub-compatible consumer group names with a next link. -type EventHubConsumerGroupsListResult struct { - autorest.Response `json:"-"` - Value *[]string `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// EventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client EventHubConsumerGroupsListResult) EventHubConsumerGroupsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// EventHubProperties is the properties of the provisioned Event Hub-compatible -// endpoint used by the IoT hub. -type EventHubProperties struct { - RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"` - PartitionCount *int32 `json:"partitionCount,omitempty"` - PartitionIds *[]string `json:"partitionIds,omitempty"` - Path *string `json:"path,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` -} - -// ExportDevicesRequest is use to provide parameters when requesting an export -// of all devices in the IoT hub. -type ExportDevicesRequest struct { - ExportBlobContainerURI *string `json:"ExportBlobContainerUri,omitempty"` - ExcludeKeys *bool `json:"ExcludeKeys,omitempty"` -} - -// FeedbackProperties is the properties of the feedback queue for -// cloud-to-device messages. -type FeedbackProperties struct { - LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` - TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` -} - -// ImportDevicesRequest is use to provide parameters when requesting an import -// of all devices in the hub. -type ImportDevicesRequest struct { - InputBlobContainerURI *string `json:"InputBlobContainerUri,omitempty"` - OutputBlobContainerURI *string `json:"OutputBlobContainerUri,omitempty"` -} - -// IPFilterRule is the IP filter rules for the IoT hub. -type IPFilterRule struct { - FilterName *string `json:"filterName,omitempty"` - Action IPFilterActionType `json:"action,omitempty"` - IPMask *string `json:"ipMask,omitempty"` -} - -// JobResponse is the properties of the Job Response object. -type JobResponse struct { - autorest.Response `json:"-"` - JobID *string `json:"jobId,omitempty"` - StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"` - EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"` - Type JobType `json:"type,omitempty"` - Status JobStatus `json:"status,omitempty"` - FailureReason *string `json:"failureReason,omitempty"` - StatusMessage *string `json:"statusMessage,omitempty"` - ParentJobID *string `json:"parentJobId,omitempty"` -} - -// JobResponseListResult is the JSON-serialized array of JobResponse objects -// with a next link. -type JobResponseListResult struct { - autorest.Response `json:"-"` - Value *[]JobResponse `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobResponseListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobResponseListResult) JobResponseListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MessagingEndpointProperties is the properties of the messaging endpoints -// used by this IoT hub. -type MessagingEndpointProperties struct { - LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` - TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` -} - -// NameAvailabilityInfo is the properties indicating whether a given IoT hub -// name is available. -type NameAvailabilityInfo struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason NameUnavailabilityReason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// OperationInputs is input values. -type OperationInputs struct { - Name *string `json:"Name,omitempty"` -} - -// OperationsMonitoringProperties is the operations monitoring properties for -// the IoT hub. The possible keys to the dictionary are Connections, -// DeviceTelemetry, C2DCommands, DeviceIdentityOperations, -// FileUploadOperations. -type OperationsMonitoringProperties struct { - Events *map[string]*OperationMonitoringLevel `json:"events,omitempty"` -} - -// Properties is the properties of an IoT hub. -type Properties struct { - AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"` - IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - HostName *string `json:"hostName,omitempty"` - EventHubEndpoints *map[string]*EventHubProperties `json:"eventHubEndpoints,omitempty"` - StorageEndpoints *map[string]*StorageEndpointProperties `json:"storageEndpoints,omitempty"` - MessagingEndpoints *map[string]*MessagingEndpointProperties `json:"messagingEndpoints,omitempty"` - EnableFileUploadNotifications *bool `json:"enableFileUploadNotifications,omitempty"` - CloudToDevice *CloudToDeviceProperties `json:"cloudToDevice,omitempty"` - Comments *string `json:"comments,omitempty"` - OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"` - Features Capabilities `json:"features,omitempty"` -} - -// QuotaMetricInfo is quota metrics properties. -type QuotaMetricInfo struct { - Name *string `json:"Name,omitempty"` - CurrentValue *int64 `json:"CurrentValue,omitempty"` - MaxValue *int64 `json:"MaxValue,omitempty"` -} - -// QuotaMetricInfoListResult is the JSON-serialized array of -// IotHubQuotaMetricInfo objects with a next link. -type QuotaMetricInfoListResult struct { - autorest.Response `json:"-"` - Value *[]QuotaMetricInfo `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// QuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client QuotaMetricInfoListResult) QuotaMetricInfoListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RegistryStatistics is identity registry statistics. -type RegistryStatistics struct { - autorest.Response `json:"-"` - TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"` - EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"` - DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SetObject is -type SetObject struct { - autorest.Response `json:"-"` - Value *map[string]interface{} `json:"value,omitempty"` -} - -// SharedAccessSignatureAuthorizationRule is the properties of an IoT hub -// shared access policy. -type SharedAccessSignatureAuthorizationRule struct { - autorest.Response `json:"-"` - KeyName *string `json:"keyName,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - Rights AccessRights `json:"rights,omitempty"` -} - -// SharedAccessSignatureAuthorizationRuleListResult is the list of shared -// access policies with a next link. -type SharedAccessSignatureAuthorizationRuleListResult struct { - autorest.Response `json:"-"` - Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SharedAccessSignatureAuthorizationRuleListResult) SharedAccessSignatureAuthorizationRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SkuDescription is sKU properties. -type SkuDescription struct { - ResourceType *string `json:"resourceType,omitempty"` - Sku *SkuInfo `json:"sku,omitempty"` - Capacity *Capacity `json:"capacity,omitempty"` -} - -// SkuDescriptionListResult is the JSON-serialized array of -// IotHubSkuDescription objects with a next link. -type SkuDescriptionListResult struct { - autorest.Response `json:"-"` - Value *[]SkuDescription `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SkuDescriptionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SkuDescriptionListResult) SkuDescriptionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SkuInfo is information about the SKU of the IoT hub. -type SkuInfo struct { - Name Sku `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` - Capacity *int64 `json:"capacity,omitempty"` -} - -// StorageEndpointProperties is the properties of the Azure Storage endpoint -// for file upload. -type StorageEndpointProperties struct { - SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"` - ConnectionString *string `json:"connectionString,omitempty"` - ContainerName *string `json:"containerName,omitempty"` -} +package iothub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // DeviceConnect specifies the device connect state for access rights. + DeviceConnect AccessRights = "DeviceConnect" + // RegistryRead specifies the registry read state for access rights. + RegistryRead AccessRights = "RegistryRead" + // RegistryReadDeviceConnect specifies the registry read device connect + // state for access rights. + RegistryReadDeviceConnect AccessRights = "RegistryRead, DeviceConnect" + // RegistryReadRegistryWrite specifies the registry read registry write + // state for access rights. + RegistryReadRegistryWrite AccessRights = "RegistryRead, RegistryWrite" + // RegistryReadRegistryWriteDeviceConnect specifies the registry read + // registry write device connect state for access rights. + RegistryReadRegistryWriteDeviceConnect AccessRights = "RegistryRead, RegistryWrite, DeviceConnect" + // RegistryReadRegistryWriteServiceConnect specifies the registry read + // registry write service connect state for access rights. + RegistryReadRegistryWriteServiceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect" + // RegistryReadRegistryWriteServiceConnectDeviceConnect specifies the + // registry read registry write service connect device connect state for + // access rights. + RegistryReadRegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + // RegistryReadServiceConnect specifies the registry read service connect + // state for access rights. + RegistryReadServiceConnect AccessRights = "RegistryRead, ServiceConnect" + // RegistryReadServiceConnectDeviceConnect specifies the registry read + // service connect device connect state for access rights. + RegistryReadServiceConnectDeviceConnect AccessRights = "RegistryRead, ServiceConnect, DeviceConnect" + // RegistryWrite specifies the registry write state for access rights. + RegistryWrite AccessRights = "RegistryWrite" + // RegistryWriteDeviceConnect specifies the registry write device connect + // state for access rights. + RegistryWriteDeviceConnect AccessRights = "RegistryWrite, DeviceConnect" + // RegistryWriteServiceConnect specifies the registry write service connect + // state for access rights. + RegistryWriteServiceConnect AccessRights = "RegistryWrite, ServiceConnect" + // RegistryWriteServiceConnectDeviceConnect specifies the registry write + // service connect device connect state for access rights. + RegistryWriteServiceConnectDeviceConnect AccessRights = "RegistryWrite, ServiceConnect, DeviceConnect" + // ServiceConnect specifies the service connect state for access rights. + ServiceConnect AccessRights = "ServiceConnect" + // ServiceConnectDeviceConnect specifies the service connect device connect + // state for access rights. + ServiceConnectDeviceConnect AccessRights = "ServiceConnect, DeviceConnect" +) + +// Capabilities enumerates the values for capabilities. +type Capabilities string + +const ( + // DeviceManagement specifies the device management state for capabilities. + DeviceManagement Capabilities = "DeviceManagement" + // None specifies the none state for capabilities. + None Capabilities = "None" +) + +// IPFilterActionType enumerates the values for ip filter action type. +type IPFilterActionType string + +const ( + // Accept specifies the accept state for ip filter action type. + Accept IPFilterActionType = "Accept" + // Reject specifies the reject state for ip filter action type. + Reject IPFilterActionType = "Reject" +) + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // Cancelled specifies the cancelled state for job status. + Cancelled JobStatus = "cancelled" + // Completed specifies the completed state for job status. + Completed JobStatus = "completed" + // Enqueued specifies the enqueued state for job status. + Enqueued JobStatus = "enqueued" + // Failed specifies the failed state for job status. + Failed JobStatus = "failed" + // Running specifies the running state for job status. + Running JobStatus = "running" + // Unknown specifies the unknown state for job status. + Unknown JobStatus = "unknown" +) + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeBackup specifies the job type backup state for job type. + JobTypeBackup JobType = "backup" + // JobTypeExport specifies the job type export state for job type. + JobTypeExport JobType = "export" + // JobTypeFactoryResetDevice specifies the job type factory reset device + // state for job type. + JobTypeFactoryResetDevice JobType = "factoryResetDevice" + // JobTypeFirmwareUpdate specifies the job type firmware update state for + // job type. + JobTypeFirmwareUpdate JobType = "firmwareUpdate" + // JobTypeImport specifies the job type import state for job type. + JobTypeImport JobType = "import" + // JobTypeReadDeviceProperties specifies the job type read device + // properties state for job type. + JobTypeReadDeviceProperties JobType = "readDeviceProperties" + // JobTypeRebootDevice specifies the job type reboot device state for job + // type. + JobTypeRebootDevice JobType = "rebootDevice" + // JobTypeUnknown specifies the job type unknown state for job type. + JobTypeUnknown JobType = "unknown" + // JobTypeUpdateDeviceConfiguration specifies the job type update device + // configuration state for job type. + JobTypeUpdateDeviceConfiguration JobType = "updateDeviceConfiguration" + // JobTypeWriteDeviceProperties specifies the job type write device + // properties state for job type. + JobTypeWriteDeviceProperties JobType = "writeDeviceProperties" +) + +// NameUnavailabilityReason enumerates the values for name unavailability +// reason. +type NameUnavailabilityReason string + +const ( + // AlreadyExists specifies the already exists state for name unavailability + // reason. + AlreadyExists NameUnavailabilityReason = "AlreadyExists" + // Invalid specifies the invalid state for name unavailability reason. + Invalid NameUnavailabilityReason = "Invalid" +) + +// OperationMonitoringLevel enumerates the values for operation monitoring +// level. +type OperationMonitoringLevel string + +const ( + // OperationMonitoringLevelError specifies the operation monitoring level + // error state for operation monitoring level. + OperationMonitoringLevelError OperationMonitoringLevel = "Error" + // OperationMonitoringLevelErrorInformation specifies the operation + // monitoring level error information state for operation monitoring level. + OperationMonitoringLevelErrorInformation OperationMonitoringLevel = "Error, Information" + // OperationMonitoringLevelInformation specifies the operation monitoring + // level information state for operation monitoring level. + OperationMonitoringLevelInformation OperationMonitoringLevel = "Information" + // OperationMonitoringLevelNone specifies the operation monitoring level + // none state for operation monitoring level. + OperationMonitoringLevelNone OperationMonitoringLevel = "None" +) + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ScaleTypeAutomatic specifies the scale type automatic state for scale + // type. + ScaleTypeAutomatic ScaleType = "Automatic" + // ScaleTypeManual specifies the scale type manual state for scale type. + ScaleTypeManual ScaleType = "Manual" + // ScaleTypeNone specifies the scale type none state for scale type. + ScaleTypeNone ScaleType = "None" +) + +// Sku enumerates the values for sku. +type Sku string + +const ( + // F1 specifies the f1 state for sku. + F1 Sku = "F1" + // S1 specifies the s1 state for sku. + S1 Sku = "S1" + // S2 specifies the s2 state for sku. + S2 Sku = "S2" + // S3 specifies the s3 state for sku. + S3 Sku = "S3" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Free specifies the free state for sku tier. + Free SkuTier = "Free" + // Standard specifies the standard state for sku tier. + Standard SkuTier = "Standard" +) + +// Capacity is ioT Hub capacity information. +type Capacity struct { + Minimum *int64 `json:"minimum,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + Default *int64 `json:"default,omitempty"` + ScaleType ScaleType `json:"scaleType,omitempty"` +} + +// CloudToDeviceProperties is the IoT hub cloud-to-device messaging properties. +type CloudToDeviceProperties struct { + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` + DefaultTTLAsIso8601 *string `json:"defaultTtlAsIso8601,omitempty"` + Feedback *FeedbackProperties `json:"feedback,omitempty"` +} + +// Description is the description of the IoT hub. +type Description struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Subscriptionid *string `json:"subscriptionid,omitempty"` + Resourcegroup *string `json:"resourcegroup,omitempty"` + Etag *string `json:"etag,omitempty"` + Properties *Properties `json:"properties,omitempty"` + Sku *SkuInfo `json:"sku,omitempty"` +} + +// DescriptionListResult is the JSON-serialized array of IotHubDescription +// objects with a next link. +type DescriptionListResult struct { + autorest.Response `json:"-"` + Value *[]Description `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DescriptionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DescriptionListResult) DescriptionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ErrorDetails is error details. +type ErrorDetails struct { + Code *string `json:"Code,omitempty"` + HTTPStatusCode *string `json:"HttpStatusCode,omitempty"` + Message *string `json:"Message,omitempty"` + Details *string `json:"Details,omitempty"` +} + +// EventHubConsumerGroupInfo is the properties of the EventHubConsumerGroupInfo +// object. +type EventHubConsumerGroupInfo struct { + autorest.Response `json:"-"` + Tags *map[string]*string `json:"tags,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// EventHubConsumerGroupsListResult is the JSON-serialized array of Event +// Hub-compatible consumer group names with a next link. +type EventHubConsumerGroupsListResult struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// EventHubConsumerGroupsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client EventHubConsumerGroupsListResult) EventHubConsumerGroupsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// EventHubProperties is the properties of the provisioned Event Hub-compatible +// endpoint used by the IoT hub. +type EventHubProperties struct { + RetentionTimeInDays *int64 `json:"retentionTimeInDays,omitempty"` + PartitionCount *int32 `json:"partitionCount,omitempty"` + PartitionIds *[]string `json:"partitionIds,omitempty"` + Path *string `json:"path,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` +} + +// ExportDevicesRequest is use to provide parameters when requesting an export +// of all devices in the IoT hub. +type ExportDevicesRequest struct { + ExportBlobContainerURI *string `json:"ExportBlobContainerUri,omitempty"` + ExcludeKeys *bool `json:"ExcludeKeys,omitempty"` +} + +// FeedbackProperties is the properties of the feedback queue for +// cloud-to-device messages. +type FeedbackProperties struct { + LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` + TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` +} + +// ImportDevicesRequest is use to provide parameters when requesting an import +// of all devices in the hub. +type ImportDevicesRequest struct { + InputBlobContainerURI *string `json:"InputBlobContainerUri,omitempty"` + OutputBlobContainerURI *string `json:"OutputBlobContainerUri,omitempty"` +} + +// IPFilterRule is the IP filter rules for the IoT hub. +type IPFilterRule struct { + FilterName *string `json:"filterName,omitempty"` + Action IPFilterActionType `json:"action,omitempty"` + IPMask *string `json:"ipMask,omitempty"` +} + +// JobResponse is the properties of the Job Response object. +type JobResponse struct { + autorest.Response `json:"-"` + JobID *string `json:"jobId,omitempty"` + StartTimeUtc *date.TimeRFC1123 `json:"startTimeUtc,omitempty"` + EndTimeUtc *date.TimeRFC1123 `json:"endTimeUtc,omitempty"` + Type JobType `json:"type,omitempty"` + Status JobStatus `json:"status,omitempty"` + FailureReason *string `json:"failureReason,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` + ParentJobID *string `json:"parentJobId,omitempty"` +} + +// JobResponseListResult is the JSON-serialized array of JobResponse objects +// with a next link. +type JobResponseListResult struct { + autorest.Response `json:"-"` + Value *[]JobResponse `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobResponseListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobResponseListResult) JobResponseListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// MessagingEndpointProperties is the properties of the messaging endpoints +// used by this IoT hub. +type MessagingEndpointProperties struct { + LockDurationAsIso8601 *string `json:"lockDurationAsIso8601,omitempty"` + TTLAsIso8601 *string `json:"ttlAsIso8601,omitempty"` + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` +} + +// NameAvailabilityInfo is the properties indicating whether a given IoT hub +// name is available. +type NameAvailabilityInfo struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason NameUnavailabilityReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// OperationInputs is input values. +type OperationInputs struct { + Name *string `json:"Name,omitempty"` +} + +// OperationsMonitoringProperties is the operations monitoring properties for +// the IoT hub. The possible keys to the dictionary are Connections, +// DeviceTelemetry, C2DCommands, DeviceIdentityOperations, +// FileUploadOperations. +type OperationsMonitoringProperties struct { + Events *map[string]*OperationMonitoringLevel `json:"events,omitempty"` +} + +// Properties is the properties of an IoT hub. +type Properties struct { + AuthorizationPolicies *[]SharedAccessSignatureAuthorizationRule `json:"authorizationPolicies,omitempty"` + IPFilterRules *[]IPFilterRule `json:"ipFilterRules,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + HostName *string `json:"hostName,omitempty"` + EventHubEndpoints *map[string]*EventHubProperties `json:"eventHubEndpoints,omitempty"` + StorageEndpoints *map[string]*StorageEndpointProperties `json:"storageEndpoints,omitempty"` + MessagingEndpoints *map[string]*MessagingEndpointProperties `json:"messagingEndpoints,omitempty"` + EnableFileUploadNotifications *bool `json:"enableFileUploadNotifications,omitempty"` + CloudToDevice *CloudToDeviceProperties `json:"cloudToDevice,omitempty"` + Comments *string `json:"comments,omitempty"` + OperationsMonitoringProperties *OperationsMonitoringProperties `json:"operationsMonitoringProperties,omitempty"` + Features Capabilities `json:"features,omitempty"` +} + +// QuotaMetricInfo is quota metrics properties. +type QuotaMetricInfo struct { + Name *string `json:"Name,omitempty"` + CurrentValue *int64 `json:"CurrentValue,omitempty"` + MaxValue *int64 `json:"MaxValue,omitempty"` +} + +// QuotaMetricInfoListResult is the JSON-serialized array of +// IotHubQuotaMetricInfo objects with a next link. +type QuotaMetricInfoListResult struct { + autorest.Response `json:"-"` + Value *[]QuotaMetricInfo `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// QuotaMetricInfoListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client QuotaMetricInfoListResult) QuotaMetricInfoListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RegistryStatistics is identity registry statistics. +type RegistryStatistics struct { + autorest.Response `json:"-"` + TotalDeviceCount *int64 `json:"totalDeviceCount,omitempty"` + EnabledDeviceCount *int64 `json:"enabledDeviceCount,omitempty"` + DisabledDeviceCount *int64 `json:"disabledDeviceCount,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SetObject is +type SetObject struct { + autorest.Response `json:"-"` + Value *map[string]interface{} `json:"value,omitempty"` +} + +// SharedAccessSignatureAuthorizationRule is the properties of an IoT hub +// shared access policy. +type SharedAccessSignatureAuthorizationRule struct { + autorest.Response `json:"-"` + KeyName *string `json:"keyName,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + Rights AccessRights `json:"rights,omitempty"` +} + +// SharedAccessSignatureAuthorizationRuleListResult is the list of shared +// access policies with a next link. +type SharedAccessSignatureAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + Value *[]SharedAccessSignatureAuthorizationRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedAccessSignatureAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SharedAccessSignatureAuthorizationRuleListResult) SharedAccessSignatureAuthorizationRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SkuDescription is sKU properties. +type SkuDescription struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *SkuInfo `json:"sku,omitempty"` + Capacity *Capacity `json:"capacity,omitempty"` +} + +// SkuDescriptionListResult is the JSON-serialized array of +// IotHubSkuDescription objects with a next link. +type SkuDescriptionListResult struct { + autorest.Response `json:"-"` + Value *[]SkuDescription `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SkuDescriptionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SkuDescriptionListResult) SkuDescriptionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SkuInfo is information about the SKU of the IoT hub. +type SkuInfo struct { + Name Sku `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` + Capacity *int64 `json:"capacity,omitempty"` +} + +// StorageEndpointProperties is the properties of the Azure Storage endpoint +// for file upload. +type StorageEndpointProperties struct { + SasTTLAsIso8601 *string `json:"sasTtlAsIso8601,omitempty"` + ConnectionString *string `json:"connectionString,omitempty"` + ContainerName *string `json:"containerName,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/resource.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/resource.go index be7edf5157..83b9704299 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/resource.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/resource.go @@ -1,1577 +1,1577 @@ -package iothub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ResourceClient is the use this API to manage the IoT hubs in your -// subscription. -type ResourceClient struct { - ManagementClient -} - -// NewResourceClient creates an instance of the ResourceClient client. -func NewResourceClient(subscriptionID string) ResourceClient { - return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceClientWithBaseURI creates an instance of the ResourceClient -// client. -func NewResourceClientWithBaseURI(baseURI string, subscriptionID string) ResourceClient { - return ResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability check if an IoT hub name is available. -// -// operationInputs is set the name parameter in the OperationInputs structure -// to the name of the IoT hub to check. -func (client ResourceClient) CheckNameAvailability(operationInputs OperationInputs) (result NameAvailabilityInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: operationInputs, - Constraints: []validation.Constraint{{Target: "operationInputs.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(operationInputs) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ResourceClient) CheckNameAvailabilityPreparer(operationInputs OperationInputs) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability", pathParameters), - autorest.WithJSON(operationInputs), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailabilityInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateEventHubConsumerGroup add a consumer group to an Event Hub-compatible -// endpoint in an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the -// name of the Event Hub-compatible endpoint in the IoT hub. name is the name -// of the consumer group to add. -func (client ResourceClient) CreateEventHubConsumerGroup(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result EventHubConsumerGroupInfo, err error) { - req, err := client.CreateEventHubConsumerGroupPreparer(resourceGroupName, resourceName, eventHubEndpointName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateEventHubConsumerGroup", nil, "Failure preparing request") - return - } - - resp, err := client.CreateEventHubConsumerGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateEventHubConsumerGroup", resp, "Failure sending request") - return - } - - result, err = client.CreateEventHubConsumerGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateEventHubConsumerGroup", resp, "Failure responding to request") - } - - return -} - -// CreateEventHubConsumerGroupPreparer prepares the CreateEventHubConsumerGroup request. -func (client ResourceClient) CreateEventHubConsumerGroupPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateEventHubConsumerGroupSender sends the CreateEventHubConsumerGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CreateEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateEventHubConsumerGroupResponder handles the response to the CreateEventHubConsumerGroup request. The method always -// closes the http.Response Body. -func (client ResourceClient) CreateEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update the metadata of an Iot hub. The usual -// pattern to modify a property is to retrieve the IoT hub metadata and -// security metadata, and then combine them with the modified values in a new -// body to update the IoT hub. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub to create or update. -// iotHubDescription is the IoT hub metadata and security metadata. -func (client ResourceClient) CreateOrUpdate(resourceGroupName string, resourceName string, iotHubDescription Description, cancel <-chan struct{}) (<-chan Description, <-chan error) { - resultChan := make(chan Description, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: iotHubDescription, - Constraints: []validation.Constraint{{Target: "iotHubDescription.Subscriptionid", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "iotHubDescription.Resourcegroup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "iotHubDescription.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - {Target: "iotHubDescription.Properties.CloudToDevice.Feedback", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}, - }}, - }}, - {Target: "iotHubDescription.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "iotHubDescription.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Description - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceName, iotHubDescription, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ResourceClient) CreateOrUpdatePreparer(resourceGroupName string, resourceName string, iotHubDescription Description, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), - autorest.WithJSON(iotHubDescription), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ResourceClient) CreateOrUpdateResponder(resp *http.Response) (result Description, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an IoT hub. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub to delete. -func (client ResourceClient) Delete(resourceGroupName string, resourceName string, cancel <-chan struct{}) (<-chan SetObject, <-chan error) { - resultChan := make(chan SetObject, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result SetObject - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, resourceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ResourceClient) DeletePreparer(resourceGroupName string, resourceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ResourceClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteEventHubConsumerGroup delete a consumer group from an Event -// Hub-compatible endpoint in an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the -// name of the Event Hub-compatible endpoint in the IoT hub. name is the name -// of the consumer group to delete. -func (client ResourceClient) DeleteEventHubConsumerGroup(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result autorest.Response, err error) { - req, err := client.DeleteEventHubConsumerGroupPreparer(resourceGroupName, resourceName, eventHubEndpointName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "DeleteEventHubConsumerGroup", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteEventHubConsumerGroupSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "DeleteEventHubConsumerGroup", resp, "Failure sending request") - return - } - - result, err = client.DeleteEventHubConsumerGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "DeleteEventHubConsumerGroup", resp, "Failure responding to request") - } - - return -} - -// DeleteEventHubConsumerGroupPreparer prepares the DeleteEventHubConsumerGroup request. -func (client ResourceClient) DeleteEventHubConsumerGroupPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteEventHubConsumerGroupSender sends the DeleteEventHubConsumerGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) DeleteEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteEventHubConsumerGroupResponder handles the response to the DeleteEventHubConsumerGroup request. The method always -// closes the http.Response Body. -func (client ResourceClient) DeleteEventHubConsumerGroupResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportDevices exports all the device identities in the IoT hub identity -// registry to an Azure Storage blob container. For more information, see: -// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. exportDevicesParameters is the -// parameters that specify the export devices operation. -func (client ResourceClient) ExportDevices(resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest) (result JobResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: exportDevicesParameters, - Constraints: []validation.Constraint{{Target: "exportDevicesParameters.ExportBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "exportDevicesParameters.ExcludeKeys", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "ExportDevices") - } - - req, err := client.ExportDevicesPreparer(resourceGroupName, resourceName, exportDevicesParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ExportDevices", nil, "Failure preparing request") - return - } - - resp, err := client.ExportDevicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ExportDevices", resp, "Failure sending request") - return - } - - result, err = client.ExportDevicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ExportDevices", resp, "Failure responding to request") - } - - return -} - -// ExportDevicesPreparer prepares the ExportDevices request. -func (client ResourceClient) ExportDevicesPreparer(resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices", pathParameters), - autorest.WithJSON(exportDevicesParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ExportDevicesSender sends the ExportDevices request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ExportDevicesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ExportDevicesResponder handles the response to the ExportDevices request. The method always -// closes the http.Response Body. -func (client ResourceClient) ExportDevicesResponder(resp *http.Response) (result JobResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the non-security related metadata of an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. -func (client ResourceClient) Get(resourceGroupName string, resourceName string) (result Description, err error) { - req, err := client.GetPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ResourceClient) GetPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetResponder(resp *http.Response) (result Description, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEventHubConsumerGroup get a consumer group from the Event Hub-compatible -// device-to-cloud endpoint for an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the -// name of the Event Hub-compatible endpoint in the IoT hub. name is the name -// of the consumer group to retrieve. -func (client ResourceClient) GetEventHubConsumerGroup(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result EventHubConsumerGroupInfo, err error) { - req, err := client.GetEventHubConsumerGroupPreparer(resourceGroupName, resourceName, eventHubEndpointName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetEventHubConsumerGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetEventHubConsumerGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetEventHubConsumerGroup", resp, "Failure sending request") - return - } - - result, err = client.GetEventHubConsumerGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetEventHubConsumerGroup", resp, "Failure responding to request") - } - - return -} - -// GetEventHubConsumerGroupPreparer prepares the GetEventHubConsumerGroup request. -func (client ResourceClient) GetEventHubConsumerGroupPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetEventHubConsumerGroupSender sends the GetEventHubConsumerGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetEventHubConsumerGroupResponder handles the response to the GetEventHubConsumerGroup request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetJob get the details of a job from an IoT hub. For more information, see: -// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. jobID is the job identifier. -func (client ResourceClient) GetJob(resourceGroupName string, resourceName string, jobID string) (result JobResponse, err error) { - req, err := client.GetJobPreparer(resourceGroupName, resourceName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetJob", nil, "Failure preparing request") - return - } - - resp, err := client.GetJobSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetJob", resp, "Failure sending request") - return - } - - result, err = client.GetJobResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetJob", resp, "Failure responding to request") - } - - return -} - -// GetJobPreparer prepares the GetJob request. -func (client ResourceClient) GetJobPreparer(resourceGroupName string, resourceName string, jobID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetJobSender sends the GetJob request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetJobSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetJobResponder handles the response to the GetJob request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetJobResponder(resp *http.Response) (result JobResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeysForKeyName get a shared access policy by name from an IoT hub. For -// more information, see: -// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. keyName is the name of the -// shared access policy. -func (client ResourceClient) GetKeysForKeyName(resourceGroupName string, resourceName string, keyName string) (result SharedAccessSignatureAuthorizationRule, err error) { - req, err := client.GetKeysForKeyNamePreparer(resourceGroupName, resourceName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetKeysForKeyName", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeysForKeyNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetKeysForKeyName", resp, "Failure sending request") - return - } - - result, err = client.GetKeysForKeyNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetKeysForKeyName", resp, "Failure responding to request") - } - - return -} - -// GetKeysForKeyNamePreparer prepares the GetKeysForKeyName request. -func (client ResourceClient) GetKeysForKeyNamePreparer(resourceGroupName string, resourceName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetKeysForKeyNameSender sends the GetKeysForKeyName request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetKeysForKeyNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetKeysForKeyNameResponder handles the response to the GetKeysForKeyName request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetKeysForKeyNameResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQuotaMetrics get the quota metrics for an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. -func (client ResourceClient) GetQuotaMetrics(resourceGroupName string, resourceName string) (result QuotaMetricInfoListResult, err error) { - req, err := client.GetQuotaMetricsPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.GetQuotaMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure sending request") - return - } - - result, err = client.GetQuotaMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure responding to request") - } - - return -} - -// GetQuotaMetricsPreparer prepares the GetQuotaMetrics request. -func (client ResourceClient) GetQuotaMetricsPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetQuotaMetricsSender sends the GetQuotaMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetQuotaMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetQuotaMetricsResponder handles the response to the GetQuotaMetrics request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetQuotaMetricsResponder(resp *http.Response) (result QuotaMetricInfoListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetQuotaMetricsNextResults retrieves the next set of results, if any. -func (client ResourceClient) GetQuotaMetricsNextResults(lastResults QuotaMetricInfoListResult) (result QuotaMetricInfoListResult, err error) { - req, err := lastResults.QuotaMetricInfoListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetQuotaMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure sending next results request") - } - - result, err = client.GetQuotaMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure responding to next results request") - } - - return -} - -// GetStats get the statistics from an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. -func (client ResourceClient) GetStats(resourceGroupName string, resourceName string) (result RegistryStatistics, err error) { - req, err := client.GetStatsPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetStats", nil, "Failure preparing request") - return - } - - resp, err := client.GetStatsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetStats", resp, "Failure sending request") - return - } - - result, err = client.GetStatsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetStats", resp, "Failure responding to request") - } - - return -} - -// GetStatsPreparer prepares the GetStats request. -func (client ResourceClient) GetStatsPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetStatsSender sends the GetStats request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetStatsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetStatsResponder handles the response to the GetStats request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetStatsResponder(resp *http.Response) (result RegistryStatistics, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetValidSkus get the list of valid SKUs for an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. -func (client ResourceClient) GetValidSkus(resourceGroupName string, resourceName string) (result SkuDescriptionListResult, err error) { - req, err := client.GetValidSkusPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", nil, "Failure preparing request") - return - } - - resp, err := client.GetValidSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure sending request") - return - } - - result, err = client.GetValidSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure responding to request") - } - - return -} - -// GetValidSkusPreparer prepares the GetValidSkus request. -func (client ResourceClient) GetValidSkusPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetValidSkusSender sends the GetValidSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) GetValidSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetValidSkusResponder handles the response to the GetValidSkus request. The method always -// closes the http.Response Body. -func (client ResourceClient) GetValidSkusResponder(resp *http.Response) (result SkuDescriptionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetValidSkusNextResults retrieves the next set of results, if any. -func (client ResourceClient) GetValidSkusNextResults(lastResults SkuDescriptionListResult) (result SkuDescriptionListResult, err error) { - req, err := lastResults.SkuDescriptionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetValidSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure sending next results request") - } - - result, err = client.GetValidSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure responding to next results request") - } - - return -} - -// ImportDevices import, update, or delete device identities in the IoT hub -// identity registry from a blob. For more information, see: -// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. importDevicesParameters is the -// parameters that specify the import devices operation. -func (client ResourceClient) ImportDevices(resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest) (result JobResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: importDevicesParameters, - Constraints: []validation.Constraint{{Target: "importDevicesParameters.InputBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "importDevicesParameters.OutputBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "ImportDevices") - } - - req, err := client.ImportDevicesPreparer(resourceGroupName, resourceName, importDevicesParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ImportDevices", nil, "Failure preparing request") - return - } - - resp, err := client.ImportDevicesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ImportDevices", resp, "Failure sending request") - return - } - - result, err = client.ImportDevicesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ImportDevices", resp, "Failure responding to request") - } - - return -} - -// ImportDevicesPreparer prepares the ImportDevices request. -func (client ResourceClient) ImportDevicesPreparer(resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices", pathParameters), - autorest.WithJSON(importDevicesParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ImportDevicesSender sends the ImportDevices request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ImportDevicesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ImportDevicesResponder handles the response to the ImportDevices request. The method always -// closes the http.Response Body. -func (client ResourceClient) ImportDevicesResponder(resp *http.Response) (result JobResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get all the IoT hubs in a resource group. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hubs. -func (client ResourceClient) ListByResourceGroup(resourceGroupName string) (result DescriptionListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ResourceClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ResourceClient) ListByResourceGroupResponder(resp *http.Response) (result DescriptionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ResourceClient) ListByResourceGroupNextResults(lastResults DescriptionListResult) (result DescriptionListResult, err error) { - req, err := lastResults.DescriptionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription get all the IoT hubs in a subscription. -func (client ResourceClient) ListBySubscription() (result DescriptionListResult, err error) { - req, err := client.ListBySubscriptionPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ResourceClient) ListBySubscriptionPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ResourceClient) ListBySubscriptionResponder(resp *http.Response) (result DescriptionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client ResourceClient) ListBySubscriptionNextResults(lastResults DescriptionListResult) (result DescriptionListResult, err error) { - req, err := lastResults.DescriptionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// ListEventHubConsumerGroups get a list of the consumer groups in the Event -// Hub-compatible device-to-cloud endpoint in an IoT hub. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the -// name of the Event Hub-compatible endpoint. -func (client ResourceClient) ListEventHubConsumerGroups(resourceGroupName string, resourceName string, eventHubEndpointName string) (result EventHubConsumerGroupsListResult, err error) { - req, err := client.ListEventHubConsumerGroupsPreparer(resourceGroupName, resourceName, eventHubEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventHubConsumerGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure sending request") - return - } - - result, err = client.ListEventHubConsumerGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure responding to request") - } - - return -} - -// ListEventHubConsumerGroupsPreparer prepares the ListEventHubConsumerGroups request. -func (client ResourceClient) ListEventHubConsumerGroupsPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListEventHubConsumerGroupsSender sends the ListEventHubConsumerGroups request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ListEventHubConsumerGroupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListEventHubConsumerGroupsResponder handles the response to the ListEventHubConsumerGroups request. The method always -// closes the http.Response Body. -func (client ResourceClient) ListEventHubConsumerGroupsResponder(resp *http.Response) (result EventHubConsumerGroupsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListEventHubConsumerGroupsNextResults retrieves the next set of results, if any. -func (client ResourceClient) ListEventHubConsumerGroupsNextResults(lastResults EventHubConsumerGroupsListResult) (result EventHubConsumerGroupsListResult, err error) { - req, err := lastResults.EventHubConsumerGroupsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListEventHubConsumerGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure sending next results request") - } - - result, err = client.ListEventHubConsumerGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure responding to next results request") - } - - return -} - -// ListJobs get a list of all the jobs in an IoT hub. For more information, -// see: -// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. -func (client ResourceClient) ListJobs(resourceGroupName string, resourceName string) (result JobResponseListResult, err error) { - req, err := client.ListJobsPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", nil, "Failure preparing request") - return - } - - resp, err := client.ListJobsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure sending request") - return - } - - result, err = client.ListJobsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure responding to request") - } - - return -} - -// ListJobsPreparer prepares the ListJobs request. -func (client ResourceClient) ListJobsPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListJobsSender sends the ListJobs request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ListJobsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListJobsResponder handles the response to the ListJobs request. The method always -// closes the http.Response Body. -func (client ResourceClient) ListJobsResponder(resp *http.Response) (result JobResponseListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListJobsNextResults retrieves the next set of results, if any. -func (client ResourceClient) ListJobsNextResults(lastResults JobResponseListResult) (result JobResponseListResult, err error) { - req, err := lastResults.JobResponseListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListJobsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure sending next results request") - } - - result, err = client.ListJobsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys get the security metadata for an IoT hub. For more information, -// see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. -// -// resourceGroupName is the name of the resource group that contains the IoT -// hub. resourceName is the name of the IoT hub. -func (client ResourceClient) ListKeys(resourceGroupName string, resourceName string) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { - req, err := client.ListKeysPreparer(resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client ResourceClient) ListKeysPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-02-03" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client ResourceClient) ListKeysResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeysNextResults retrieves the next set of results, if any. -func (client ResourceClient) ListKeysNextResults(lastResults SharedAccessSignatureAuthorizationRuleListResult) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessSignatureAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure sending next results request") - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure responding to next results request") - } - - return -} +package iothub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ResourceClient is the use this API to manage the IoT hubs in your +// subscription. +type ResourceClient struct { + ManagementClient +} + +// NewResourceClient creates an instance of the ResourceClient client. +func NewResourceClient(subscriptionID string) ResourceClient { + return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceClientWithBaseURI creates an instance of the ResourceClient +// client. +func NewResourceClientWithBaseURI(baseURI string, subscriptionID string) ResourceClient { + return ResourceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability check if an IoT hub name is available. +// +// operationInputs is set the name parameter in the OperationInputs structure +// to the name of the IoT hub to check. +func (client ResourceClient) CheckNameAvailability(operationInputs OperationInputs) (result NameAvailabilityInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: operationInputs, + Constraints: []validation.Constraint{{Target: "operationInputs.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(operationInputs) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ResourceClient) CheckNameAvailabilityPreparer(operationInputs OperationInputs) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability", pathParameters), + autorest.WithJSON(operationInputs), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailabilityInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateEventHubConsumerGroup add a consumer group to an Event Hub-compatible +// endpoint in an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the +// name of the Event Hub-compatible endpoint in the IoT hub. name is the name +// of the consumer group to add. +func (client ResourceClient) CreateEventHubConsumerGroup(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result EventHubConsumerGroupInfo, err error) { + req, err := client.CreateEventHubConsumerGroupPreparer(resourceGroupName, resourceName, eventHubEndpointName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateEventHubConsumerGroup", nil, "Failure preparing request") + return + } + + resp, err := client.CreateEventHubConsumerGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateEventHubConsumerGroup", resp, "Failure sending request") + return + } + + result, err = client.CreateEventHubConsumerGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateEventHubConsumerGroup", resp, "Failure responding to request") + } + + return +} + +// CreateEventHubConsumerGroupPreparer prepares the CreateEventHubConsumerGroup request. +func (client ResourceClient) CreateEventHubConsumerGroupPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateEventHubConsumerGroupSender sends the CreateEventHubConsumerGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CreateEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateEventHubConsumerGroupResponder handles the response to the CreateEventHubConsumerGroup request. The method always +// closes the http.Response Body. +func (client ResourceClient) CreateEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update the metadata of an Iot hub. The usual +// pattern to modify a property is to retrieve the IoT hub metadata and +// security metadata, and then combine them with the modified values in a new +// body to update the IoT hub. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub to create or update. +// iotHubDescription is the IoT hub metadata and security metadata. +func (client ResourceClient) CreateOrUpdate(resourceGroupName string, resourceName string, iotHubDescription Description, cancel <-chan struct{}) (<-chan Description, <-chan error) { + resultChan := make(chan Description, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: iotHubDescription, + Constraints: []validation.Constraint{{Target: "iotHubDescription.Subscriptionid", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotHubDescription.Resourcegroup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotHubDescription.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "iotHubDescription.Properties.CloudToDevice.MaxDeliveryCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + {Target: "iotHubDescription.Properties.CloudToDevice.Feedback", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "iotHubDescription.Properties.CloudToDevice.Feedback.MaxDeliveryCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "iotHubDescription.Sku", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "iotHubDescription.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Description + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceName, iotHubDescription, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ResourceClient) CreateOrUpdatePreparer(resourceGroupName string, resourceName string, iotHubDescription Description, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithJSON(iotHubDescription), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ResourceClient) CreateOrUpdateResponder(resp *http.Response) (result Description, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an IoT hub. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub to delete. +func (client ResourceClient) Delete(resourceGroupName string, resourceName string, cancel <-chan struct{}) (<-chan SetObject, <-chan error) { + resultChan := make(chan SetObject, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result SetObject + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, resourceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ResourceClient) DeletePreparer(resourceGroupName string, resourceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ResourceClient) DeleteResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteEventHubConsumerGroup delete a consumer group from an Event +// Hub-compatible endpoint in an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the +// name of the Event Hub-compatible endpoint in the IoT hub. name is the name +// of the consumer group to delete. +func (client ResourceClient) DeleteEventHubConsumerGroup(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result autorest.Response, err error) { + req, err := client.DeleteEventHubConsumerGroupPreparer(resourceGroupName, resourceName, eventHubEndpointName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "DeleteEventHubConsumerGroup", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteEventHubConsumerGroupSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "DeleteEventHubConsumerGroup", resp, "Failure sending request") + return + } + + result, err = client.DeleteEventHubConsumerGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "DeleteEventHubConsumerGroup", resp, "Failure responding to request") + } + + return +} + +// DeleteEventHubConsumerGroupPreparer prepares the DeleteEventHubConsumerGroup request. +func (client ResourceClient) DeleteEventHubConsumerGroupPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteEventHubConsumerGroupSender sends the DeleteEventHubConsumerGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) DeleteEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteEventHubConsumerGroupResponder handles the response to the DeleteEventHubConsumerGroup request. The method always +// closes the http.Response Body. +func (client ResourceClient) DeleteEventHubConsumerGroupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportDevices exports all the device identities in the IoT hub identity +// registry to an Azure Storage blob container. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. exportDevicesParameters is the +// parameters that specify the export devices operation. +func (client ResourceClient) ExportDevices(resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest) (result JobResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: exportDevicesParameters, + Constraints: []validation.Constraint{{Target: "exportDevicesParameters.ExportBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "exportDevicesParameters.ExcludeKeys", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "ExportDevices") + } + + req, err := client.ExportDevicesPreparer(resourceGroupName, resourceName, exportDevicesParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ExportDevices", nil, "Failure preparing request") + return + } + + resp, err := client.ExportDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ExportDevices", resp, "Failure sending request") + return + } + + result, err = client.ExportDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ExportDevices", resp, "Failure responding to request") + } + + return +} + +// ExportDevicesPreparer prepares the ExportDevices request. +func (client ResourceClient) ExportDevicesPreparer(resourceGroupName string, resourceName string, exportDevicesParameters ExportDevicesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices", pathParameters), + autorest.WithJSON(exportDevicesParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ExportDevicesSender sends the ExportDevices request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ExportDevicesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ExportDevicesResponder handles the response to the ExportDevices request. The method always +// closes the http.Response Body. +func (client ResourceClient) ExportDevicesResponder(resp *http.Response) (result JobResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the non-security related metadata of an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. +func (client ResourceClient) Get(resourceGroupName string, resourceName string) (result Description, err error) { + req, err := client.GetPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ResourceClient) GetPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetResponder(resp *http.Response) (result Description, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEventHubConsumerGroup get a consumer group from the Event Hub-compatible +// device-to-cloud endpoint for an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the +// name of the Event Hub-compatible endpoint in the IoT hub. name is the name +// of the consumer group to retrieve. +func (client ResourceClient) GetEventHubConsumerGroup(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (result EventHubConsumerGroupInfo, err error) { + req, err := client.GetEventHubConsumerGroupPreparer(resourceGroupName, resourceName, eventHubEndpointName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetEventHubConsumerGroup", nil, "Failure preparing request") + return + } + + resp, err := client.GetEventHubConsumerGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetEventHubConsumerGroup", resp, "Failure sending request") + return + } + + result, err = client.GetEventHubConsumerGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetEventHubConsumerGroup", resp, "Failure responding to request") + } + + return +} + +// GetEventHubConsumerGroupPreparer prepares the GetEventHubConsumerGroup request. +func (client ResourceClient) GetEventHubConsumerGroupPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetEventHubConsumerGroupSender sends the GetEventHubConsumerGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetEventHubConsumerGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetEventHubConsumerGroupResponder handles the response to the GetEventHubConsumerGroup request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetEventHubConsumerGroupResponder(resp *http.Response) (result EventHubConsumerGroupInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetJob get the details of a job from an IoT hub. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. jobID is the job identifier. +func (client ResourceClient) GetJob(resourceGroupName string, resourceName string, jobID string) (result JobResponse, err error) { + req, err := client.GetJobPreparer(resourceGroupName, resourceName, jobID) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetJob", nil, "Failure preparing request") + return + } + + resp, err := client.GetJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetJob", resp, "Failure sending request") + return + } + + result, err = client.GetJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetJob", resp, "Failure responding to request") + } + + return +} + +// GetJobPreparer prepares the GetJob request. +func (client ResourceClient) GetJobPreparer(resourceGroupName string, resourceName string, jobID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetJobSender sends the GetJob request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetJobSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetJobResponder handles the response to the GetJob request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetJobResponder(resp *http.Response) (result JobResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeysForKeyName get a shared access policy by name from an IoT hub. For +// more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. keyName is the name of the +// shared access policy. +func (client ResourceClient) GetKeysForKeyName(resourceGroupName string, resourceName string, keyName string) (result SharedAccessSignatureAuthorizationRule, err error) { + req, err := client.GetKeysForKeyNamePreparer(resourceGroupName, resourceName, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetKeysForKeyName", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysForKeyNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetKeysForKeyName", resp, "Failure sending request") + return + } + + result, err = client.GetKeysForKeyNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetKeysForKeyName", resp, "Failure responding to request") + } + + return +} + +// GetKeysForKeyNamePreparer prepares the GetKeysForKeyName request. +func (client ResourceClient) GetKeysForKeyNamePreparer(resourceGroupName string, resourceName string, keyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetKeysForKeyNameSender sends the GetKeysForKeyName request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetKeysForKeyNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetKeysForKeyNameResponder handles the response to the GetKeysForKeyName request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetKeysForKeyNameResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetQuotaMetrics get the quota metrics for an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. +func (client ResourceClient) GetQuotaMetrics(resourceGroupName string, resourceName string) (result QuotaMetricInfoListResult, err error) { + req, err := client.GetQuotaMetricsPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetQuotaMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetQuotaMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure responding to request") + } + + return +} + +// GetQuotaMetricsPreparer prepares the GetQuotaMetrics request. +func (client ResourceClient) GetQuotaMetricsPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetQuotaMetricsSender sends the GetQuotaMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetQuotaMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetQuotaMetricsResponder handles the response to the GetQuotaMetrics request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetQuotaMetricsResponder(resp *http.Response) (result QuotaMetricInfoListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetQuotaMetricsNextResults retrieves the next set of results, if any. +func (client ResourceClient) GetQuotaMetricsNextResults(lastResults QuotaMetricInfoListResult) (result QuotaMetricInfoListResult, err error) { + req, err := lastResults.QuotaMetricInfoListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetQuotaMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure sending next results request") + } + + result, err = client.GetQuotaMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetQuotaMetrics", resp, "Failure responding to next results request") + } + + return +} + +// GetStats get the statistics from an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. +func (client ResourceClient) GetStats(resourceGroupName string, resourceName string) (result RegistryStatistics, err error) { + req, err := client.GetStatsPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetStats", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetStats", resp, "Failure sending request") + return + } + + result, err = client.GetStatsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetStats", resp, "Failure responding to request") + } + + return +} + +// GetStatsPreparer prepares the GetStats request. +func (client ResourceClient) GetStatsPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetStatsSender sends the GetStats request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetStatsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetStatsResponder handles the response to the GetStats request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetStatsResponder(resp *http.Response) (result RegistryStatistics, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetValidSkus get the list of valid SKUs for an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. +func (client ResourceClient) GetValidSkus(resourceGroupName string, resourceName string) (result SkuDescriptionListResult, err error) { + req, err := client.GetValidSkusPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", nil, "Failure preparing request") + return + } + + resp, err := client.GetValidSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure sending request") + return + } + + result, err = client.GetValidSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure responding to request") + } + + return +} + +// GetValidSkusPreparer prepares the GetValidSkus request. +func (client ResourceClient) GetValidSkusPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetValidSkusSender sends the GetValidSkus request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) GetValidSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetValidSkusResponder handles the response to the GetValidSkus request. The method always +// closes the http.Response Body. +func (client ResourceClient) GetValidSkusResponder(resp *http.Response) (result SkuDescriptionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetValidSkusNextResults retrieves the next set of results, if any. +func (client ResourceClient) GetValidSkusNextResults(lastResults SkuDescriptionListResult) (result SkuDescriptionListResult, err error) { + req, err := lastResults.SkuDescriptionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetValidSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure sending next results request") + } + + result, err = client.GetValidSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "GetValidSkus", resp, "Failure responding to next results request") + } + + return +} + +// ImportDevices import, update, or delete device identities in the IoT hub +// identity registry from a blob. For more information, see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. importDevicesParameters is the +// parameters that specify the import devices operation. +func (client ResourceClient) ImportDevices(resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest) (result JobResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: importDevicesParameters, + Constraints: []validation.Constraint{{Target: "importDevicesParameters.InputBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "importDevicesParameters.OutputBlobContainerURI", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "iothub.ResourceClient", "ImportDevices") + } + + req, err := client.ImportDevicesPreparer(resourceGroupName, resourceName, importDevicesParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ImportDevices", nil, "Failure preparing request") + return + } + + resp, err := client.ImportDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ImportDevices", resp, "Failure sending request") + return + } + + result, err = client.ImportDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ImportDevices", resp, "Failure responding to request") + } + + return +} + +// ImportDevicesPreparer prepares the ImportDevices request. +func (client ResourceClient) ImportDevicesPreparer(resourceGroupName string, resourceName string, importDevicesParameters ImportDevicesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices", pathParameters), + autorest.WithJSON(importDevicesParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ImportDevicesSender sends the ImportDevices request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ImportDevicesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ImportDevicesResponder handles the response to the ImportDevices request. The method always +// closes the http.Response Body. +func (client ResourceClient) ImportDevicesResponder(resp *http.Response) (result JobResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all the IoT hubs in a resource group. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hubs. +func (client ResourceClient) ListByResourceGroup(resourceGroupName string) (result DescriptionListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ResourceClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ResourceClient) ListByResourceGroupResponder(resp *http.Response) (result DescriptionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ResourceClient) ListByResourceGroupNextResults(lastResults DescriptionListResult) (result DescriptionListResult, err error) { + req, err := lastResults.DescriptionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription get all the IoT hubs in a subscription. +func (client ResourceClient) ListBySubscription() (result DescriptionListResult, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ResourceClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ResourceClient) ListBySubscriptionResponder(resp *http.Response) (result DescriptionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client ResourceClient) ListBySubscriptionNextResults(lastResults DescriptionListResult) (result DescriptionListResult, err error) { + req, err := lastResults.DescriptionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListEventHubConsumerGroups get a list of the consumer groups in the Event +// Hub-compatible device-to-cloud endpoint in an IoT hub. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. eventHubEndpointName is the +// name of the Event Hub-compatible endpoint. +func (client ResourceClient) ListEventHubConsumerGroups(resourceGroupName string, resourceName string, eventHubEndpointName string) (result EventHubConsumerGroupsListResult, err error) { + req, err := client.ListEventHubConsumerGroupsPreparer(resourceGroupName, resourceName, eventHubEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", nil, "Failure preparing request") + return + } + + resp, err := client.ListEventHubConsumerGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure sending request") + return + } + + result, err = client.ListEventHubConsumerGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure responding to request") + } + + return +} + +// ListEventHubConsumerGroupsPreparer prepares the ListEventHubConsumerGroups request. +func (client ResourceClient) ListEventHubConsumerGroupsPreparer(resourceGroupName string, resourceName string, eventHubEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventHubEndpointName": autorest.Encode("path", eventHubEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListEventHubConsumerGroupsSender sends the ListEventHubConsumerGroups request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ListEventHubConsumerGroupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListEventHubConsumerGroupsResponder handles the response to the ListEventHubConsumerGroups request. The method always +// closes the http.Response Body. +func (client ResourceClient) ListEventHubConsumerGroupsResponder(resp *http.Response) (result EventHubConsumerGroupsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEventHubConsumerGroupsNextResults retrieves the next set of results, if any. +func (client ResourceClient) ListEventHubConsumerGroupsNextResults(lastResults EventHubConsumerGroupsListResult) (result EventHubConsumerGroupsListResult, err error) { + req, err := lastResults.EventHubConsumerGroupsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListEventHubConsumerGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure sending next results request") + } + + result, err = client.ListEventHubConsumerGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListEventHubConsumerGroups", resp, "Failure responding to next results request") + } + + return +} + +// ListJobs get a list of all the jobs in an IoT hub. For more information, +// see: +// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. +func (client ResourceClient) ListJobs(resourceGroupName string, resourceName string) (result JobResponseListResult, err error) { + req, err := client.ListJobsPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", nil, "Failure preparing request") + return + } + + resp, err := client.ListJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure sending request") + return + } + + result, err = client.ListJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure responding to request") + } + + return +} + +// ListJobsPreparer prepares the ListJobs request. +func (client ResourceClient) ListJobsPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListJobsSender sends the ListJobs request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ListJobsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListJobsResponder handles the response to the ListJobs request. The method always +// closes the http.Response Body. +func (client ResourceClient) ListJobsResponder(resp *http.Response) (result JobResponseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListJobsNextResults retrieves the next set of results, if any. +func (client ResourceClient) ListJobsNextResults(lastResults JobResponseListResult) (result JobResponseListResult, err error) { + req, err := lastResults.JobResponseListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure sending next results request") + } + + result, err = client.ListJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListJobs", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys get the security metadata for an IoT hub. For more information, +// see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. +// +// resourceGroupName is the name of the resource group that contains the IoT +// hub. resourceName is the name of the IoT hub. +func (client ResourceClient) ListKeys(resourceGroupName string, resourceName string) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client ResourceClient) ListKeysPreparer(resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-02-03" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client ResourceClient) ListKeysResponder(resp *http.Response) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeysNextResults retrieves the next set of results, if any. +func (client ResourceClient) ListKeysNextResults(lastResults SharedAccessSignatureAuthorizationRuleListResult) (result SharedAccessSignatureAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessSignatureAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure sending next results request") + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iothub.ResourceClient", "ListKeys", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/version.go index 73e21f7bb6..f827c53a91 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/iothub/version.go @@ -1,29 +1,29 @@ -package iothub - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-iothub/2016-02-03" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package iothub + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-iothub/2016-02-03" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/client.go index 4b3bddbb3a..7bca66be4c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/client.go @@ -1,54 +1,54 @@ -// Package keyvault implements the Azure ARM Keyvault service API version -// 2015-06-01. -// -// The Azure management API provides a RESTful set of web services that -// interact with Azure Key Vault. -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Keyvault - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Keyvault. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package keyvault implements the Azure ARM Keyvault service API version +// 2015-06-01. +// +// The Azure management API provides a RESTful set of web services that +// interact with Azure Key Vault. +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Keyvault + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Keyvault. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/models.go index 7f63c18469..b0162c4b10 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/models.go @@ -1,243 +1,243 @@ -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "github.com/satori/uuid" - "net/http" -) - -// CertificatePermissions enumerates the values for certificate permissions. -type CertificatePermissions string - -const ( - // All specifies the all state for certificate permissions. - All CertificatePermissions = "all" - // Create specifies the create state for certificate permissions. - Create CertificatePermissions = "create" - // Delete specifies the delete state for certificate permissions. - Delete CertificatePermissions = "delete" - // Deleteissuers specifies the deleteissuers state for certificate - // permissions. - Deleteissuers CertificatePermissions = "deleteissuers" - // Get specifies the get state for certificate permissions. - Get CertificatePermissions = "get" - // Getissuers specifies the getissuers state for certificate permissions. - Getissuers CertificatePermissions = "getissuers" - // Import specifies the import state for certificate permissions. - Import CertificatePermissions = "import" - // List specifies the list state for certificate permissions. - List CertificatePermissions = "list" - // Listissuers specifies the listissuers state for certificate permissions. - Listissuers CertificatePermissions = "listissuers" - // Managecontacts specifies the managecontacts state for certificate - // permissions. - Managecontacts CertificatePermissions = "managecontacts" - // Manageissuers specifies the manageissuers state for certificate - // permissions. - Manageissuers CertificatePermissions = "manageissuers" - // Setissuers specifies the setissuers state for certificate permissions. - Setissuers CertificatePermissions = "setissuers" - // Update specifies the update state for certificate permissions. - Update CertificatePermissions = "update" -) - -// KeyPermissions enumerates the values for key permissions. -type KeyPermissions string - -const ( - // KeyPermissionsAll specifies the key permissions all state for key - // permissions. - KeyPermissionsAll KeyPermissions = "all" - // KeyPermissionsBackup specifies the key permissions backup state for key - // permissions. - KeyPermissionsBackup KeyPermissions = "backup" - // KeyPermissionsCreate specifies the key permissions create state for key - // permissions. - KeyPermissionsCreate KeyPermissions = "create" - // KeyPermissionsDecrypt specifies the key permissions decrypt state for - // key permissions. - KeyPermissionsDecrypt KeyPermissions = "decrypt" - // KeyPermissionsDelete specifies the key permissions delete state for key - // permissions. - KeyPermissionsDelete KeyPermissions = "delete" - // KeyPermissionsEncrypt specifies the key permissions encrypt state for - // key permissions. - KeyPermissionsEncrypt KeyPermissions = "encrypt" - // KeyPermissionsGet specifies the key permissions get state for key - // permissions. - KeyPermissionsGet KeyPermissions = "get" - // KeyPermissionsImport specifies the key permissions import state for key - // permissions. - KeyPermissionsImport KeyPermissions = "import" - // KeyPermissionsList specifies the key permissions list state for key - // permissions. - KeyPermissionsList KeyPermissions = "list" - // KeyPermissionsRestore specifies the key permissions restore state for - // key permissions. - KeyPermissionsRestore KeyPermissions = "restore" - // KeyPermissionsSign specifies the key permissions sign state for key - // permissions. - KeyPermissionsSign KeyPermissions = "sign" - // KeyPermissionsUnwrapKey specifies the key permissions unwrap key state - // for key permissions. - KeyPermissionsUnwrapKey KeyPermissions = "unwrapKey" - // KeyPermissionsUpdate specifies the key permissions update state for key - // permissions. - KeyPermissionsUpdate KeyPermissions = "update" - // KeyPermissionsVerify specifies the key permissions verify state for key - // permissions. - KeyPermissionsVerify KeyPermissions = "verify" - // KeyPermissionsWrapKey specifies the key permissions wrap key state for - // key permissions. - KeyPermissionsWrapKey KeyPermissions = "wrapKey" -) - -// SecretPermissions enumerates the values for secret permissions. -type SecretPermissions string - -const ( - // SecretPermissionsAll specifies the secret permissions all state for - // secret permissions. - SecretPermissionsAll SecretPermissions = "all" - // SecretPermissionsDelete specifies the secret permissions delete state - // for secret permissions. - SecretPermissionsDelete SecretPermissions = "delete" - // SecretPermissionsGet specifies the secret permissions get state for - // secret permissions. - SecretPermissionsGet SecretPermissions = "get" - // SecretPermissionsList specifies the secret permissions list state for - // secret permissions. - SecretPermissionsList SecretPermissions = "list" - // SecretPermissionsSet specifies the secret permissions set state for - // secret permissions. - SecretPermissionsSet SecretPermissions = "set" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Premium specifies the premium state for sku name. - Premium SkuName = "premium" - // Standard specifies the standard state for sku name. - Standard SkuName = "standard" -) - -// AccessPolicyEntry is an identity that have access to the key vault. All -// identities in the array must use the same tenant ID as the key vault's -// tenant ID. -type AccessPolicyEntry struct { - TenantID *uuid.UUID `json:"tenantId,omitempty"` - ObjectID *string `json:"objectId,omitempty"` - ApplicationID *uuid.UUID `json:"applicationId,omitempty"` - Permissions *Permissions `json:"permissions,omitempty"` -} - -// Permissions is permissions the identity has for keys, secrets and -// certificates. -type Permissions struct { - Keys *[]KeyPermissions `json:"keys,omitempty"` - Secrets *[]SecretPermissions `json:"secrets,omitempty"` - Certificates *[]CertificatePermissions `json:"certificates,omitempty"` -} - -// Resource is key Vault resource -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceListResult is list of vault resources. -type ResourceListResult struct { - autorest.Response `json:"-"` - Value *[]Resource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceListResult) ResourceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Sku is sKU details -type Sku struct { - Family *string `json:"family,omitempty"` - Name SkuName `json:"name,omitempty"` -} - -// Vault is resource information with extended details. -type Vault struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *VaultProperties `json:"properties,omitempty"` -} - -// VaultCreateOrUpdateParameters is parameters for creating or updating a vault -type VaultCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *VaultProperties `json:"properties,omitempty"` -} - -// VaultListResult is list of vaults -type VaultListResult struct { - autorest.Response `json:"-"` - Value *[]Vault `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VaultListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VaultListResult) VaultListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VaultProperties is properties of the vault -type VaultProperties struct { - VaultURI *string `json:"vaultUri,omitempty"` - TenantID *uuid.UUID `json:"tenantId,omitempty"` - Sku *Sku `json:"sku,omitempty"` - AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` - EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` - EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` - EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` -} +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" + "net/http" +) + +// CertificatePermissions enumerates the values for certificate permissions. +type CertificatePermissions string + +const ( + // All specifies the all state for certificate permissions. + All CertificatePermissions = "all" + // Create specifies the create state for certificate permissions. + Create CertificatePermissions = "create" + // Delete specifies the delete state for certificate permissions. + Delete CertificatePermissions = "delete" + // Deleteissuers specifies the deleteissuers state for certificate + // permissions. + Deleteissuers CertificatePermissions = "deleteissuers" + // Get specifies the get state for certificate permissions. + Get CertificatePermissions = "get" + // Getissuers specifies the getissuers state for certificate permissions. + Getissuers CertificatePermissions = "getissuers" + // Import specifies the import state for certificate permissions. + Import CertificatePermissions = "import" + // List specifies the list state for certificate permissions. + List CertificatePermissions = "list" + // Listissuers specifies the listissuers state for certificate permissions. + Listissuers CertificatePermissions = "listissuers" + // Managecontacts specifies the managecontacts state for certificate + // permissions. + Managecontacts CertificatePermissions = "managecontacts" + // Manageissuers specifies the manageissuers state for certificate + // permissions. + Manageissuers CertificatePermissions = "manageissuers" + // Setissuers specifies the setissuers state for certificate permissions. + Setissuers CertificatePermissions = "setissuers" + // Update specifies the update state for certificate permissions. + Update CertificatePermissions = "update" +) + +// KeyPermissions enumerates the values for key permissions. +type KeyPermissions string + +const ( + // KeyPermissionsAll specifies the key permissions all state for key + // permissions. + KeyPermissionsAll KeyPermissions = "all" + // KeyPermissionsBackup specifies the key permissions backup state for key + // permissions. + KeyPermissionsBackup KeyPermissions = "backup" + // KeyPermissionsCreate specifies the key permissions create state for key + // permissions. + KeyPermissionsCreate KeyPermissions = "create" + // KeyPermissionsDecrypt specifies the key permissions decrypt state for + // key permissions. + KeyPermissionsDecrypt KeyPermissions = "decrypt" + // KeyPermissionsDelete specifies the key permissions delete state for key + // permissions. + KeyPermissionsDelete KeyPermissions = "delete" + // KeyPermissionsEncrypt specifies the key permissions encrypt state for + // key permissions. + KeyPermissionsEncrypt KeyPermissions = "encrypt" + // KeyPermissionsGet specifies the key permissions get state for key + // permissions. + KeyPermissionsGet KeyPermissions = "get" + // KeyPermissionsImport specifies the key permissions import state for key + // permissions. + KeyPermissionsImport KeyPermissions = "import" + // KeyPermissionsList specifies the key permissions list state for key + // permissions. + KeyPermissionsList KeyPermissions = "list" + // KeyPermissionsRestore specifies the key permissions restore state for + // key permissions. + KeyPermissionsRestore KeyPermissions = "restore" + // KeyPermissionsSign specifies the key permissions sign state for key + // permissions. + KeyPermissionsSign KeyPermissions = "sign" + // KeyPermissionsUnwrapKey specifies the key permissions unwrap key state + // for key permissions. + KeyPermissionsUnwrapKey KeyPermissions = "unwrapKey" + // KeyPermissionsUpdate specifies the key permissions update state for key + // permissions. + KeyPermissionsUpdate KeyPermissions = "update" + // KeyPermissionsVerify specifies the key permissions verify state for key + // permissions. + KeyPermissionsVerify KeyPermissions = "verify" + // KeyPermissionsWrapKey specifies the key permissions wrap key state for + // key permissions. + KeyPermissionsWrapKey KeyPermissions = "wrapKey" +) + +// SecretPermissions enumerates the values for secret permissions. +type SecretPermissions string + +const ( + // SecretPermissionsAll specifies the secret permissions all state for + // secret permissions. + SecretPermissionsAll SecretPermissions = "all" + // SecretPermissionsDelete specifies the secret permissions delete state + // for secret permissions. + SecretPermissionsDelete SecretPermissions = "delete" + // SecretPermissionsGet specifies the secret permissions get state for + // secret permissions. + SecretPermissionsGet SecretPermissions = "get" + // SecretPermissionsList specifies the secret permissions list state for + // secret permissions. + SecretPermissionsList SecretPermissions = "list" + // SecretPermissionsSet specifies the secret permissions set state for + // secret permissions. + SecretPermissionsSet SecretPermissions = "set" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Premium specifies the premium state for sku name. + Premium SkuName = "premium" + // Standard specifies the standard state for sku name. + Standard SkuName = "standard" +) + +// AccessPolicyEntry is an identity that have access to the key vault. All +// identities in the array must use the same tenant ID as the key vault's +// tenant ID. +type AccessPolicyEntry struct { + TenantID *uuid.UUID `json:"tenantId,omitempty"` + ObjectID *string `json:"objectId,omitempty"` + ApplicationID *uuid.UUID `json:"applicationId,omitempty"` + Permissions *Permissions `json:"permissions,omitempty"` +} + +// Permissions is permissions the identity has for keys, secrets and +// certificates. +type Permissions struct { + Keys *[]KeyPermissions `json:"keys,omitempty"` + Secrets *[]SecretPermissions `json:"secrets,omitempty"` + Certificates *[]CertificatePermissions `json:"certificates,omitempty"` +} + +// Resource is key Vault resource +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceListResult is list of vault resources. +type ResourceListResult struct { + autorest.Response `json:"-"` + Value *[]Resource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceListResult) ResourceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Sku is sKU details +type Sku struct { + Family *string `json:"family,omitempty"` + Name SkuName `json:"name,omitempty"` +} + +// Vault is resource information with extended details. +type Vault struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` +} + +// VaultCreateOrUpdateParameters is parameters for creating or updating a vault +type VaultCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` +} + +// VaultListResult is list of vaults +type VaultListResult struct { + autorest.Response `json:"-"` + Value *[]Vault `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VaultListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VaultListResult) VaultListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VaultProperties is properties of the vault +type VaultProperties struct { + VaultURI *string `json:"vaultUri,omitempty"` + TenantID *uuid.UUID `json:"tenantId,omitempty"` + Sku *Sku `json:"sku,omitempty"` + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` + EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/vaults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/vaults.go index 575e29a5df..5b8c021ed0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/vaults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/vaults.go @@ -1,443 +1,443 @@ -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VaultsClient is the the Azure management API provides a RESTful set of web -// services that interact with Azure Key Vault. -type VaultsClient struct { - ManagementClient -} - -// NewVaultsClient creates an instance of the VaultsClient client. -func NewVaultsClient(subscriptionID string) VaultsClient { - return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client. -func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { - return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a key vault in the specified subscription. -// -// resourceGroupName is the name of the Resource Group to which the server -// belongs. vaultName is name of the vault parameters is parameters to create -// or update the vault -func (client VaultsClient) CreateOrUpdate(resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (result Vault, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: vaultName, - Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.AccessPolicies", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.MaxItems, Rule: 16, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.VaultsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, vaultName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultsClient) CreateOrUpdatePreparer(resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2015-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Azure key vault. -// -// resourceGroupName is the name of the Resource Group to which the vault -// belongs. vaultName is the name of the vault to delete -func (client VaultsClient) Delete(resourceGroupName string, vaultName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VaultsClient) DeletePreparer(resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2015-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Azure key vault. -// -// resourceGroupName is the name of the Resource Group to which the vault -// belongs. vaultName is the name of the vault. -func (client VaultsClient) Get(resourceGroupName string, vaultName string) (result Vault, err error) { - req, err := client.GetPreparer(resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultsClient) GetPreparer(resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2015-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the List operation gets information about the vaults associated with -// the subscription. -// -// filter is the filter to apply on the operation. top is maximum number of -// results to return. -func (client VaultsClient) List(filter string, top *int32) (result ResourceListResult, err error) { - req, err := client.ListPreparer(filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VaultsClient) ListPreparer(filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListResponder(resp *http.Response) (result ResourceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VaultsClient) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) { - req, err := lastResults.ResourceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup the List operation gets information about the vaults -// associated with the subscription and within the specified resource group. -// -// resourceGroupName is the name of the Resource Group to which the vault -// belongs. top is maximum number of results to return. -func (client VaultsClient) ListByResourceGroup(resourceGroupName string, top *int32) (result VaultListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VaultsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client VaultsClient) ListByResourceGroupNextResults(lastResults VaultListResult) (result VaultListResult, err error) { - req, err := lastResults.VaultListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VaultsClient is the the Azure management API provides a RESTful set of web +// services that interact with Azure Key Vault. +type VaultsClient struct { + ManagementClient +} + +// NewVaultsClient creates an instance of the VaultsClient client. +func NewVaultsClient(subscriptionID string) VaultsClient { + return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client. +func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { + return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a key vault in the specified subscription. +// +// resourceGroupName is the name of the Resource Group to which the server +// belongs. vaultName is name of the vault parameters is parameters to create +// or update the vault +func (client VaultsClient) CreateOrUpdate(resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (result Vault, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.Sku", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Properties.AccessPolicies", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.MaxItems, Rule: 16, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.VaultsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, vaultName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VaultsClient) CreateOrUpdatePreparer(resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2015-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Azure key vault. +// +// resourceGroupName is the name of the Resource Group to which the vault +// belongs. vaultName is the name of the vault to delete +func (client VaultsClient) Delete(resourceGroupName string, vaultName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VaultsClient) DeletePreparer(resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2015-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Azure key vault. +// +// resourceGroupName is the name of the Resource Group to which the vault +// belongs. vaultName is the name of the vault. +func (client VaultsClient) Get(resourceGroupName string, vaultName string) (result Vault, err error) { + req, err := client.GetPreparer(resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VaultsClient) GetPreparer(resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2015-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List operation gets information about the vaults associated with +// the subscription. +// +// filter is the filter to apply on the operation. top is maximum number of +// results to return. +func (client VaultsClient) List(filter string, top *int32) (result ResourceListResult, err error) { + req, err := client.ListPreparer(filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VaultsClient) ListPreparer(filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", filter), + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListResponder(resp *http.Response) (result ResourceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VaultsClient) ListNextResults(lastResults ResourceListResult) (result ResourceListResult, err error) { + req, err := lastResults.ResourceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup the List operation gets information about the vaults +// associated with the subscription and within the specified resource group. +// +// resourceGroupName is the name of the Resource Group to which the vault +// belongs. top is maximum number of results to return. +func (client VaultsClient) ListByResourceGroup(resourceGroupName string, top *int32) (result VaultListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VaultsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client VaultsClient) ListByResourceGroupNextResults(lastResults VaultListResult) (result VaultListResult, err error) { + req, err := lastResults.VaultListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/version.go index 3e94c5b61c..cf5e06aad4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/keyvault/version.go @@ -1,29 +1,29 @@ -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-keyvault/2015-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-keyvault/2015-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/agreements.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/agreements.go index 6e06a8291f..20a2bd1b94 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/agreements.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/agreements.go @@ -1,779 +1,779 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AgreementsClient is the rEST API for Azure Logic Apps. -type AgreementsClient struct { - ManagementClient -} - -// NewAgreementsClient creates an instance of the AgreementsClient client. -func NewAgreementsClient(subscriptionID string) AgreementsClient { - return NewAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAgreementsClientWithBaseURI creates an instance of the AgreementsClient -// client. -func NewAgreementsClientWithBaseURI(baseURI string, subscriptionID string) AgreementsClient { - return AgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account agreement. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. agreementName is the integration account agreement -// name. agreement is the integration account agreement. -func (client AgreementsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (result IntegrationAccountAgreement, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: agreement, - Constraints: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostPartner", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.GuestPartner", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.NeedMdn", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignMdn", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendMdnAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignOutboundMdnIfOptional", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendInboundMdnToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundMdn", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundMdn", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.ResendIfMdnNotReceived", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.NeedMdn", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignMdn", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendMdnAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignOutboundMdnIfOptional", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendInboundMdnToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundMdn", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundMdn", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.ResendIfMdnNotReceived", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "logic.AgreementsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, agreementName, agreement) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AgreementsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), - autorest.WithJSON(agreement), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AgreementsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AgreementsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account agreement. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. agreementName is the integration account agreement -// name. -func (client AgreementsClient) Delete(resourceGroupName string, integrationAccountName string, agreementName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, agreementName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AgreementsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AgreementsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AgreementsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account agreement. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. agreementName is the integration account agreement -// name. -func (client AgreementsClient) Get(resourceGroupName string, integrationAccountName string, agreementName string) (result IntegrationAccountAgreement, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName, agreementName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AgreementsClient) GetPreparer(resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "agreementName": autorest.Encode("path", agreementName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AgreementsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AgreementsClient) GetResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccounts gets a list of integration account agreements. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. top is the number of items to be included in the -// result. filter is the filter to apply on the operation. -func (client AgreementsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountAgreementListResult, err error) { - req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure sending request") - return - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") - } - - return -} - -// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. -func (client AgreementsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the -// http.Response Body if it receives an error. -func (client AgreementsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always -// closes the http.Response Body. -func (client AgreementsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountAgreementListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. -func (client AgreementsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountAgreementListResult) (result IntegrationAccountAgreementListResult, err error) { - req, err := lastResults.IntegrationAccountAgreementListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AgreementsClient is the rEST API for Azure Logic Apps. +type AgreementsClient struct { + ManagementClient +} + +// NewAgreementsClient creates an instance of the AgreementsClient client. +func NewAgreementsClient(subscriptionID string) AgreementsClient { + return NewAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgreementsClientWithBaseURI creates an instance of the AgreementsClient +// client. +func NewAgreementsClientWithBaseURI(baseURI string, subscriptionID string) AgreementsClient { + return AgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account agreement. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. agreementName is the integration account agreement +// name. agreement is the integration account agreement. +func (client AgreementsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (result IntegrationAccountAgreement, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: agreement, + Constraints: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostPartner", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.GuestPartner", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.HostIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.GuestIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.NeedMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendMdnAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SignOutboundMdnIfOptional", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.MdnSettings.SendInboundMdnToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.ReceiveAgreement.ProtocolSettings.ErrorSettings.ResendIfMdnNotReceived", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MessageConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.IgnoreCertificateNameMismatch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.SupportHTTPStatusCodeContinue", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.KeepHTTPConnectionAlive", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.AcknowledgementConnectionSettings.UnfoldHTTPHeaders", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.NeedMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendMdnAsynchronously", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SignOutboundMdnIfOptional", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.MdnSettings.SendInboundMdnToMessageBox", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.OverrideGroupSigningCertificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundEncodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForOutboundDecodedMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.SecuritySettings.EnableNrrForInboundMdn", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.OverrideMessageProperties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.EncryptMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.SignMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CompressMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeDuplicatesValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnSend", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ValidationSettings.CheckCertificateRevocationListOnReceive", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.MessageContentType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.TransmitFileNameInMimeHeader", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.FileNameTemplate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.SuspendMessageOnFileNameGenerationError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.EnvelopeSettings.AutogenerateFileName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.SuspendDuplicateMessage", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.AS2.SendAgreement.ProtocolSettings.ErrorSettings.ResendIfMdnNotReceived", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceSeparatorsInPayload", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.ReplaceCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlStandardsID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.UseControlStandardsIDAsRepetitionCharacter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.SenderApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ReceiverApplicationID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.ControlVersionNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderAgencyCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupHeaderVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedImplementationAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchImplementationAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.AuthorizationQualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SecuritySettings.SecurityQualifier", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.ConvertImpliedDecimal", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.X12.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.ReceiveAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.SenderBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Qualifier", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ReceiverBusinessIdentity.Value", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateCharacterSet", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.InterchangeControlNumberValidityDays", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.CheckDuplicateTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateEdiTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.ValidateXsdTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.AllowLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ValidationSettings.TrimLeadingAndTrailingSpacesAndZeroes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ProtocolVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.DataElementSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ComponentSeparator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.SegmentTerminator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.ReleaseIndicator", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.FramingSettings.RepetitionSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.ApplyDelimiterStringAdvice", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.CreateGroupingSegments", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.EnableDefaultGroupHeaders", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.InterchangeControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverInterchangeControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.GroupControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverGroupControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.OverwriteExistingTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.TransactionSetControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.RolloverTransactionSetControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.EnvelopeSettings.IsTestInterchange", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedTechnicalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchTechnicalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedFunctionalAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.BatchFunctionalAcknowledgements", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.NeedLoopForValidMessages", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.SendSynchronousAcknowledgement", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberLowerBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.AcknowledgementControlNumberUpperBound", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.AcknowledgementSettings.RolloverAcknowledgementControlNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.MessageFilter", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.MaskSecurityInfo", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.PreserveInterchange", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.SuspendInterchangeOnError", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.CreateEmptyXMLTagsForTrailingSeparators", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.ProcessingSettings.UseDotAsDecimalSeparator", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "agreement.IntegrationAccountAgreementProperties.Content.Edifact.SendAgreement.ProtocolSettings.SchemaReferences", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.AgreementsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, agreementName, agreement) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AgreementsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, agreementName string, agreement IntegrationAccountAgreement) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), + autorest.WithJSON(agreement), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AgreementsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account agreement. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. agreementName is the integration account agreement +// name. +func (client AgreementsClient) Delete(resourceGroupName string, integrationAccountName string, agreementName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, agreementName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AgreementsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AgreementsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account agreement. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. agreementName is the integration account agreement +// name. +func (client AgreementsClient) Get(resourceGroupName string, integrationAccountName string, agreementName string) (result IntegrationAccountAgreement, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, agreementName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgreementsClient) GetPreparer(resourceGroupName string, integrationAccountName string, agreementName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AgreementsClient) GetResponder(resp *http.Response) (result IntegrationAccountAgreement, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account agreements. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client AgreementsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountAgreementListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client AgreementsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client AgreementsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountAgreementListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client AgreementsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountAgreementListResult) (result IntegrationAccountAgreementListResult, err error) { + req, err := lastResults.IntegrationAccountAgreementListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.AgreementsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/certificates.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/certificates.go index ed6cacabc8..04f3e7596a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/certificates.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/certificates.go @@ -1,352 +1,352 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CertificatesClient is the rEST API for Azure Logic Apps. -type CertificatesClient struct { - ManagementClient -} - -// NewCertificatesClient creates an instance of the CertificatesClient client. -func NewCertificatesClient(subscriptionID string) CertificatesClient { - return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificatesClientWithBaseURI creates an instance of the -// CertificatesClient client. -func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { - return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account certificate. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. certificateName is the integration account -// certificate name. certificate is the integration account certificate. -func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (result IntegrationAccountCertificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: certificate, - Constraints: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyVault", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyName", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "logic.CertificatesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, certificateName, certificate) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithJSON(certificate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account certificate. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. certificateName is the integration account -// certificate name. -func (client CertificatesClient) Delete(resourceGroupName string, integrationAccountName string, certificateName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificatesClient) DeletePreparer(resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account certificate. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. certificateName is the integration account -// certificate name. -func (client CertificatesClient) Get(resourceGroupName string, integrationAccountName string, certificateName string) (result IntegrationAccountCertificate, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificatesClient) GetPreparer(resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateName": autorest.Encode("path", certificateName), - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificatesClient) GetResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccounts gets a list of integration account certificates. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. top is the number of items to be included in the -// result. -func (client CertificatesClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32) (result IntegrationAccountCertificateListResult, err error) { - req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure sending request") - return - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure responding to request") - } - - return -} - -// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. -func (client CertificatesClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always -// closes the http.Response Body. -func (client CertificatesClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountCertificateListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. -func (client CertificatesClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountCertificateListResult) (result IntegrationAccountCertificateListResult, err error) { - req, err := lastResults.IntegrationAccountCertificateListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CertificatesClient is the rEST API for Azure Logic Apps. +type CertificatesClient struct { + ManagementClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the +// CertificatesClient client. +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account certificate. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. certificateName is the integration account +// certificate name. certificate is the integration account certificate. +func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (result IntegrationAccountCertificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificate, + Constraints: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyVault", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "certificate.IntegrationAccountCertificateProperties.Key.KeyName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.CertificatesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, certificateName, certificate) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, certificateName string, certificate IntegrationAccountCertificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(certificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account certificate. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. certificateName is the integration account +// certificate name. +func (client CertificatesClient) Delete(resourceGroupName string, integrationAccountName string, certificateName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account certificate. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. certificateName is the integration account +// certificate name. +func (client CertificatesClient) Get(resourceGroupName string, integrationAccountName string, certificateName string) (result IntegrationAccountCertificate, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(resourceGroupName string, integrationAccountName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result IntegrationAccountCertificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account certificates. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. +func (client CertificatesClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32) (result IntegrationAccountCertificateListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client CertificatesClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountCertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountCertificateListResult) (result IntegrationAccountCertificateListResult, err error) { + req, err := lastResults.IntegrationAccountCertificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.CertificatesClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/client.go index eb6bb99b32..673d79956b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/client.go @@ -1,135 +1,135 @@ -// Package logic implements the Azure ARM Logic service API version 2016-06-01. -// -// REST API for Azure Logic Apps. -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Logic - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Logic. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// ListOperations lists all of the available Logic REST API operations. -func (client ManagementClient) ListOperations() (result OperationListResult, err error) { - req, err := client.ListOperationsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure sending request") - return - } - - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure responding to request") - } - - return -} - -// ListOperationsPreparer prepares the ListOperations request. -func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Logic/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListOperationsSender sends the ListOperations request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListOperationsResponder handles the response to the ListOperations request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOperationsNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure sending next results request") - } - - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure responding to next results request") - } - - return -} +// Package logic implements the Azure ARM Logic service API version 2016-06-01. +// +// REST API for Azure Logic Apps. +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Logic + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Logic. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// ListOperations lists all of the available Logic REST API operations. +func (client ManagementClient) ListOperations() (result OperationListResult, err error) { + req, err := client.ListOperationsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure sending request") + return + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure responding to request") + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Logic/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListOperationsResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOperationsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListOperationsNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure sending next results request") + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.ManagementClient", "ListOperations", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/integrationaccounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/integrationaccounts.go index 0545d4da21..9de0b8072e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/integrationaccounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/integrationaccounts.go @@ -1,559 +1,559 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// IntegrationAccountsClient is the rEST API for Azure Logic Apps. -type IntegrationAccountsClient struct { - ManagementClient -} - -// NewIntegrationAccountsClient creates an instance of the -// IntegrationAccountsClient client. -func NewIntegrationAccountsClient(subscriptionID string) IntegrationAccountsClient { - return NewIntegrationAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewIntegrationAccountsClientWithBaseURI creates an instance of the -// IntegrationAccountsClient client. -func NewIntegrationAccountsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountsClient { - return IntegrationAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. integrationAccount is the integration account. -func (client IntegrationAccountsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, integrationAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client IntegrationAccountsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithJSON(integrationAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. -func (client IntegrationAccountsClient) Delete(resourceGroupName string, integrationAccountName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client IntegrationAccountsClient) DeletePreparer(resourceGroupName string, integrationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. -func (client IntegrationAccountsClient) Get(resourceGroupName string, integrationAccountName string) (result IntegrationAccount, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client IntegrationAccountsClient) GetPreparer(resourceGroupName string, integrationAccountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) GetResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackURL gets the integration account callback URL. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. parameters is the callback URL parameters. -func (client IntegrationAccountsClient) GetCallbackURL(resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (result CallbackURL, err error) { - req, err := client.GetCallbackURLPreparer(resourceGroupName, integrationAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", resp, "Failure responding to request") - } - - return -} - -// GetCallbackURLPreparer prepares the GetCallbackURL request. -func (client IntegrationAccountsClient) GetCallbackURLPreparer(resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/listCallbackUrl", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCallbackURLSender sends the GetCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) GetCallbackURLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCallbackURLResponder handles the response to the GetCallbackURL request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) GetCallbackURLResponder(resp *http.Response) (result CallbackURL, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets a list of integration accounts by resource group. -// -// resourceGroupName is the resource group name. top is the number of items to -// be included in the result. -func (client IntegrationAccountsClient) ListByResourceGroup(resourceGroupName string, top *int32) (result IntegrationAccountListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client IntegrationAccountsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client IntegrationAccountsClient) ListByResourceGroupNextResults(lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { - req, err := lastResults.IntegrationAccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription gets a list of integration accounts by subscription. -// -// top is the number of items to be included in the result. -func (client IntegrationAccountsClient) ListBySubscription(top *int32) (result IntegrationAccountListResult, err error) { - req, err := client.ListBySubscriptionPreparer(top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client IntegrationAccountsClient) ListBySubscriptionPreparer(top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client IntegrationAccountsClient) ListBySubscriptionNextResults(lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { - req, err := lastResults.IntegrationAccountListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// Update updates an integration account. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. integrationAccount is the integration account. -func (client IntegrationAccountsClient) Update(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { - req, err := client.UpdatePreparer(resourceGroupName, integrationAccountName, integrationAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client IntegrationAccountsClient) UpdatePreparer(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), - autorest.WithJSON(integrationAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client IntegrationAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client IntegrationAccountsClient) UpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// IntegrationAccountsClient is the rEST API for Azure Logic Apps. +type IntegrationAccountsClient struct { + ManagementClient +} + +// NewIntegrationAccountsClient creates an instance of the +// IntegrationAccountsClient client. +func NewIntegrationAccountsClient(subscriptionID string) IntegrationAccountsClient { + return NewIntegrationAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIntegrationAccountsClientWithBaseURI creates an instance of the +// IntegrationAccountsClient client. +func NewIntegrationAccountsClientWithBaseURI(baseURI string, subscriptionID string) IntegrationAccountsClient { + return IntegrationAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. integrationAccount is the integration account. +func (client IntegrationAccountsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, integrationAccount) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IntegrationAccountsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithJSON(integrationAccount), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. +func (client IntegrationAccountsClient) Delete(resourceGroupName string, integrationAccountName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IntegrationAccountsClient) DeletePreparer(resourceGroupName string, integrationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. +func (client IntegrationAccountsClient) Get(resourceGroupName string, integrationAccountName string) (result IntegrationAccount, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IntegrationAccountsClient) GetPreparer(resourceGroupName string, integrationAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) GetResponder(resp *http.Response) (result IntegrationAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCallbackURL gets the integration account callback URL. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. parameters is the callback URL parameters. +func (client IntegrationAccountsClient) GetCallbackURL(resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (result CallbackURL, err error) { + req, err := client.GetCallbackURLPreparer(resourceGroupName, integrationAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetCallbackURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", resp, "Failure sending request") + return + } + + result, err = client.GetCallbackURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "GetCallbackURL", resp, "Failure responding to request") + } + + return +} + +// GetCallbackURLPreparer prepares the GetCallbackURL request. +func (client IntegrationAccountsClient) GetCallbackURLPreparer(resourceGroupName string, integrationAccountName string, parameters GetCallbackURLParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/listCallbackUrl", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCallbackURLSender sends the GetCallbackURL request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) GetCallbackURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCallbackURLResponder handles the response to the GetCallbackURL request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) GetCallbackURLResponder(resp *http.Response) (result CallbackURL, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets a list of integration accounts by resource group. +// +// resourceGroupName is the resource group name. top is the number of items to +// be included in the result. +func (client IntegrationAccountsClient) ListByResourceGroup(resourceGroupName string, top *int32) (result IntegrationAccountListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client IntegrationAccountsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client IntegrationAccountsClient) ListByResourceGroupNextResults(lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { + req, err := lastResults.IntegrationAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription gets a list of integration accounts by subscription. +// +// top is the number of items to be included in the result. +func (client IntegrationAccountsClient) ListBySubscription(top *int32) (result IntegrationAccountListResult, err error) { + req, err := client.ListBySubscriptionPreparer(top) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client IntegrationAccountsClient) ListBySubscriptionPreparer(top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result IntegrationAccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client IntegrationAccountsClient) ListBySubscriptionNextResults(lastResults IntegrationAccountListResult) (result IntegrationAccountListResult, err error) { + req, err := lastResults.IntegrationAccountListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// Update updates an integration account. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. integrationAccount is the integration account. +func (client IntegrationAccountsClient) Update(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (result IntegrationAccount, err error) { + req, err := client.UpdatePreparer(resourceGroupName, integrationAccountName, integrationAccount) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.IntegrationAccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client IntegrationAccountsClient) UpdatePreparer(resourceGroupName string, integrationAccountName string, integrationAccount IntegrationAccount) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}", pathParameters), + autorest.WithJSON(integrationAccount), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client IntegrationAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client IntegrationAccountsClient) UpdateResponder(resp *http.Response) (result IntegrationAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/maps.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/maps.go index c6b8c155ec..40ca83df49 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/maps.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/maps.go @@ -1,347 +1,347 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// MapsClient is the rEST API for Azure Logic Apps. -type MapsClient struct { - ManagementClient -} - -// NewMapsClient creates an instance of the MapsClient client. -func NewMapsClient(subscriptionID string) MapsClient { - return NewMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMapsClientWithBaseURI creates an instance of the MapsClient client. -func NewMapsClientWithBaseURI(baseURI string, subscriptionID string) MapsClient { - return MapsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account map. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. mapName is the integration account map name. -// mapParameter is the integration account map. -func (client MapsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (result IntegrationAccountMap, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mapParameter, - Constraints: []validation.Constraint{{Target: "mapParameter.IntegrationAccountMapProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "logic.MapsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, mapName, mapParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MapsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), - autorest.WithJSON(mapParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client MapsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client MapsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountMap, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account map. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. mapName is the integration account map name. -func (client MapsClient) Delete(resourceGroupName string, integrationAccountName string, mapName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, mapName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MapsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client MapsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client MapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account map. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. mapName is the integration account map name. -func (client MapsClient) Get(resourceGroupName string, integrationAccountName string, mapName string) (result IntegrationAccountMap, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName, mapName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client MapsClient) GetPreparer(resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "mapName": autorest.Encode("path", mapName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MapsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MapsClient) GetResponder(resp *http.Response) (result IntegrationAccountMap, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccounts gets a list of integration account maps. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. top is the number of items to be included in the -// result. filter is the filter to apply on the operation. -func (client MapsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountMapListResult, err error) { - req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure sending request") - return - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") - } - - return -} - -// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. -func (client MapsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the -// http.Response Body if it receives an error. -func (client MapsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always -// closes the http.Response Body. -func (client MapsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountMapListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. -func (client MapsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountMapListResult) (result IntegrationAccountMapListResult, err error) { - req, err := lastResults.IntegrationAccountMapListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// MapsClient is the rEST API for Azure Logic Apps. +type MapsClient struct { + ManagementClient +} + +// NewMapsClient creates an instance of the MapsClient client. +func NewMapsClient(subscriptionID string) MapsClient { + return NewMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMapsClientWithBaseURI creates an instance of the MapsClient client. +func NewMapsClientWithBaseURI(baseURI string, subscriptionID string) MapsClient { + return MapsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account map. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. mapName is the integration account map name. +// mapParameter is the integration account map. +func (client MapsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (result IntegrationAccountMap, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mapParameter, + Constraints: []validation.Constraint{{Target: "mapParameter.IntegrationAccountMapProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.MapsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, mapName, mapParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MapsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, mapName string, mapParameter IntegrationAccountMap) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "mapName": autorest.Encode("path", mapName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), + autorest.WithJSON(mapParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MapsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account map. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. mapName is the integration account map name. +func (client MapsClient) Delete(resourceGroupName string, integrationAccountName string, mapName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, mapName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MapsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "mapName": autorest.Encode("path", mapName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account map. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. mapName is the integration account map name. +func (client MapsClient) Get(resourceGroupName string, integrationAccountName string, mapName string) (result IntegrationAccountMap, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, mapName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client MapsClient) GetPreparer(resourceGroupName string, integrationAccountName string, mapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "mapName": autorest.Encode("path", mapName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MapsClient) GetResponder(resp *http.Response) (result IntegrationAccountMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account maps. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client MapsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountMapListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client MapsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client MapsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountMapListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client MapsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountMapListResult) (result IntegrationAccountMapListResult, err error) { + req, err := lastResults.IntegrationAccountMapListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.MapsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/models.go index 69e62b41e6..159cda6dc3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/models.go @@ -1,2030 +1,2030 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AgreementType enumerates the values for agreement type. -type AgreementType string - -const ( - // AS2 specifies the as2 state for agreement type. - AS2 AgreementType = "AS2" - // Edifact specifies the edifact state for agreement type. - Edifact AgreementType = "Edifact" - // NotSpecified specifies the not specified state for agreement type. - NotSpecified AgreementType = "NotSpecified" - // X12 specifies the x12 state for agreement type. - X12 AgreementType = "X12" -) - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // Friday specifies the friday state for day of week. - Friday DayOfWeek = "Friday" - // Monday specifies the monday state for day of week. - Monday DayOfWeek = "Monday" - // Saturday specifies the saturday state for day of week. - Saturday DayOfWeek = "Saturday" - // Sunday specifies the sunday state for day of week. - Sunday DayOfWeek = "Sunday" - // Thursday specifies the thursday state for day of week. - Thursday DayOfWeek = "Thursday" - // Tuesday specifies the tuesday state for day of week. - Tuesday DayOfWeek = "Tuesday" - // Wednesday specifies the wednesday state for day of week. - Wednesday DayOfWeek = "Wednesday" -) - -// DaysOfWeek enumerates the values for days of week. -type DaysOfWeek string - -const ( - // DaysOfWeekFriday specifies the days of week friday state for days of - // week. - DaysOfWeekFriday DaysOfWeek = "Friday" - // DaysOfWeekMonday specifies the days of week monday state for days of - // week. - DaysOfWeekMonday DaysOfWeek = "Monday" - // DaysOfWeekSaturday specifies the days of week saturday state for days of - // week. - DaysOfWeekSaturday DaysOfWeek = "Saturday" - // DaysOfWeekSunday specifies the days of week sunday state for days of - // week. - DaysOfWeekSunday DaysOfWeek = "Sunday" - // DaysOfWeekThursday specifies the days of week thursday state for days of - // week. - DaysOfWeekThursday DaysOfWeek = "Thursday" - // DaysOfWeekTuesday specifies the days of week tuesday state for days of - // week. - DaysOfWeekTuesday DaysOfWeek = "Tuesday" - // DaysOfWeekWednesday specifies the days of week wednesday state for days - // of week. - DaysOfWeekWednesday DaysOfWeek = "Wednesday" -) - -// EdifactCharacterSet enumerates the values for edifact character set. -type EdifactCharacterSet string - -const ( - // EdifactCharacterSetKECA specifies the edifact character set keca state - // for edifact character set. - EdifactCharacterSetKECA EdifactCharacterSet = "KECA" - // EdifactCharacterSetNotSpecified specifies the edifact character set not - // specified state for edifact character set. - EdifactCharacterSetNotSpecified EdifactCharacterSet = "NotSpecified" - // EdifactCharacterSetUNOA specifies the edifact character set unoa state - // for edifact character set. - EdifactCharacterSetUNOA EdifactCharacterSet = "UNOA" - // EdifactCharacterSetUNOB specifies the edifact character set unob state - // for edifact character set. - EdifactCharacterSetUNOB EdifactCharacterSet = "UNOB" - // EdifactCharacterSetUNOC specifies the edifact character set unoc state - // for edifact character set. - EdifactCharacterSetUNOC EdifactCharacterSet = "UNOC" - // EdifactCharacterSetUNOD specifies the edifact character set unod state - // for edifact character set. - EdifactCharacterSetUNOD EdifactCharacterSet = "UNOD" - // EdifactCharacterSetUNOE specifies the edifact character set unoe state - // for edifact character set. - EdifactCharacterSetUNOE EdifactCharacterSet = "UNOE" - // EdifactCharacterSetUNOF specifies the edifact character set unof state - // for edifact character set. - EdifactCharacterSetUNOF EdifactCharacterSet = "UNOF" - // EdifactCharacterSetUNOG specifies the edifact character set unog state - // for edifact character set. - EdifactCharacterSetUNOG EdifactCharacterSet = "UNOG" - // EdifactCharacterSetUNOH specifies the edifact character set unoh state - // for edifact character set. - EdifactCharacterSetUNOH EdifactCharacterSet = "UNOH" - // EdifactCharacterSetUNOI specifies the edifact character set unoi state - // for edifact character set. - EdifactCharacterSetUNOI EdifactCharacterSet = "UNOI" - // EdifactCharacterSetUNOJ specifies the edifact character set unoj state - // for edifact character set. - EdifactCharacterSetUNOJ EdifactCharacterSet = "UNOJ" - // EdifactCharacterSetUNOK specifies the edifact character set unok state - // for edifact character set. - EdifactCharacterSetUNOK EdifactCharacterSet = "UNOK" - // EdifactCharacterSetUNOX specifies the edifact character set unox state - // for edifact character set. - EdifactCharacterSetUNOX EdifactCharacterSet = "UNOX" - // EdifactCharacterSetUNOY specifies the edifact character set unoy state - // for edifact character set. - EdifactCharacterSetUNOY EdifactCharacterSet = "UNOY" -) - -// EdifactDecimalIndicator enumerates the values for edifact decimal indicator. -type EdifactDecimalIndicator string - -const ( - // EdifactDecimalIndicatorComma specifies the edifact decimal indicator - // comma state for edifact decimal indicator. - EdifactDecimalIndicatorComma EdifactDecimalIndicator = "Comma" - // EdifactDecimalIndicatorDecimal specifies the edifact decimal indicator - // decimal state for edifact decimal indicator. - EdifactDecimalIndicatorDecimal EdifactDecimalIndicator = "Decimal" - // EdifactDecimalIndicatorNotSpecified specifies the edifact decimal - // indicator not specified state for edifact decimal indicator. - EdifactDecimalIndicatorNotSpecified EdifactDecimalIndicator = "NotSpecified" -) - -// EncryptionAlgorithm enumerates the values for encryption algorithm. -type EncryptionAlgorithm string - -const ( - // EncryptionAlgorithmAES128 specifies the encryption algorithm aes128 - // state for encryption algorithm. - EncryptionAlgorithmAES128 EncryptionAlgorithm = "AES128" - // EncryptionAlgorithmAES192 specifies the encryption algorithm aes192 - // state for encryption algorithm. - EncryptionAlgorithmAES192 EncryptionAlgorithm = "AES192" - // EncryptionAlgorithmAES256 specifies the encryption algorithm aes256 - // state for encryption algorithm. - EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" - // EncryptionAlgorithmDES3 specifies the encryption algorithm des3 state - // for encryption algorithm. - EncryptionAlgorithmDES3 EncryptionAlgorithm = "DES3" - // EncryptionAlgorithmNone specifies the encryption algorithm none state - // for encryption algorithm. - EncryptionAlgorithmNone EncryptionAlgorithm = "None" - // EncryptionAlgorithmNotSpecified specifies the encryption algorithm not - // specified state for encryption algorithm. - EncryptionAlgorithmNotSpecified EncryptionAlgorithm = "NotSpecified" - // EncryptionAlgorithmRC2 specifies the encryption algorithm rc2 state for - // encryption algorithm. - EncryptionAlgorithmRC2 EncryptionAlgorithm = "RC2" -) - -// HashingAlgorithm enumerates the values for hashing algorithm. -type HashingAlgorithm string - -const ( - // HashingAlgorithmMD5 specifies the hashing algorithm md5 state for - // hashing algorithm. - HashingAlgorithmMD5 HashingAlgorithm = "MD5" - // HashingAlgorithmNone specifies the hashing algorithm none state for - // hashing algorithm. - HashingAlgorithmNone HashingAlgorithm = "None" - // HashingAlgorithmNotSpecified specifies the hashing algorithm not - // specified state for hashing algorithm. - HashingAlgorithmNotSpecified HashingAlgorithm = "NotSpecified" - // HashingAlgorithmSHA1 specifies the hashing algorithm sha1 state for - // hashing algorithm. - HashingAlgorithmSHA1 HashingAlgorithm = "SHA1" - // HashingAlgorithmSHA2256 specifies the hashing algorithm sha2256 state - // for hashing algorithm. - HashingAlgorithmSHA2256 HashingAlgorithm = "SHA2256" - // HashingAlgorithmSHA2384 specifies the hashing algorithm sha2384 state - // for hashing algorithm. - HashingAlgorithmSHA2384 HashingAlgorithm = "SHA2384" - // HashingAlgorithmSHA2512 specifies the hashing algorithm sha2512 state - // for hashing algorithm. - HashingAlgorithmSHA2512 HashingAlgorithm = "SHA2512" -) - -// IntegrationAccountSkuName enumerates the values for integration account sku -// name. -type IntegrationAccountSkuName string - -const ( - // IntegrationAccountSkuNameFree specifies the integration account sku name - // free state for integration account sku name. - IntegrationAccountSkuNameFree IntegrationAccountSkuName = "Free" - // IntegrationAccountSkuNameNotSpecified specifies the integration account - // sku name not specified state for integration account sku name. - IntegrationAccountSkuNameNotSpecified IntegrationAccountSkuName = "NotSpecified" - // IntegrationAccountSkuNameStandard specifies the integration account sku - // name standard state for integration account sku name. - IntegrationAccountSkuNameStandard IntegrationAccountSkuName = "Standard" -) - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypeNotSpecified specifies the key type not specified state for key - // type. - KeyTypeNotSpecified KeyType = "NotSpecified" - // KeyTypePrimary specifies the key type primary state for key type. - KeyTypePrimary KeyType = "Primary" - // KeyTypeSecondary specifies the key type secondary state for key type. - KeyTypeSecondary KeyType = "Secondary" -) - -// MapType enumerates the values for map type. -type MapType string - -const ( - // MapTypeNotSpecified specifies the map type not specified state for map - // type. - MapTypeNotSpecified MapType = "NotSpecified" - // MapTypeXslt specifies the map type xslt state for map type. - MapTypeXslt MapType = "Xslt" -) - -// MessageFilterType enumerates the values for message filter type. -type MessageFilterType string - -const ( - // MessageFilterTypeExclude specifies the message filter type exclude state - // for message filter type. - MessageFilterTypeExclude MessageFilterType = "Exclude" - // MessageFilterTypeInclude specifies the message filter type include state - // for message filter type. - MessageFilterTypeInclude MessageFilterType = "Include" - // MessageFilterTypeNotSpecified specifies the message filter type not - // specified state for message filter type. - MessageFilterTypeNotSpecified MessageFilterType = "NotSpecified" -) - -// ParameterType enumerates the values for parameter type. -type ParameterType string - -const ( - // ParameterTypeArray specifies the parameter type array state for - // parameter type. - ParameterTypeArray ParameterType = "Array" - // ParameterTypeBool specifies the parameter type bool state for parameter - // type. - ParameterTypeBool ParameterType = "Bool" - // ParameterTypeFloat specifies the parameter type float state for - // parameter type. - ParameterTypeFloat ParameterType = "Float" - // ParameterTypeInt specifies the parameter type int state for parameter - // type. - ParameterTypeInt ParameterType = "Int" - // ParameterTypeNotSpecified specifies the parameter type not specified - // state for parameter type. - ParameterTypeNotSpecified ParameterType = "NotSpecified" - // ParameterTypeObject specifies the parameter type object state for - // parameter type. - ParameterTypeObject ParameterType = "Object" - // ParameterTypeSecureObject specifies the parameter type secure object - // state for parameter type. - ParameterTypeSecureObject ParameterType = "SecureObject" - // ParameterTypeSecureString specifies the parameter type secure string - // state for parameter type. - ParameterTypeSecureString ParameterType = "SecureString" - // ParameterTypeString specifies the parameter type string state for - // parameter type. - ParameterTypeString ParameterType = "String" -) - -// PartnerType enumerates the values for partner type. -type PartnerType string - -const ( - // PartnerTypeB2B specifies the partner type b2b state for partner type. - PartnerTypeB2B PartnerType = "B2B" - // PartnerTypeNotSpecified specifies the partner type not specified state - // for partner type. - PartnerTypeNotSpecified PartnerType = "NotSpecified" -) - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // RecurrenceFrequencyDay specifies the recurrence frequency day state for - // recurrence frequency. - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - // RecurrenceFrequencyHour specifies the recurrence frequency hour state - // for recurrence frequency. - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - // RecurrenceFrequencyMinute specifies the recurrence frequency minute - // state for recurrence frequency. - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - // RecurrenceFrequencyMonth specifies the recurrence frequency month state - // for recurrence frequency. - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - // RecurrenceFrequencyNotSpecified specifies the recurrence frequency not - // specified state for recurrence frequency. - RecurrenceFrequencyNotSpecified RecurrenceFrequency = "NotSpecified" - // RecurrenceFrequencySecond specifies the recurrence frequency second - // state for recurrence frequency. - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - // RecurrenceFrequencyWeek specifies the recurrence frequency week state - // for recurrence frequency. - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - // RecurrenceFrequencyYear specifies the recurrence frequency year state - // for recurrence frequency. - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// SchemaType enumerates the values for schema type. -type SchemaType string - -const ( - // SchemaTypeNotSpecified specifies the schema type not specified state for - // schema type. - SchemaTypeNotSpecified SchemaType = "NotSpecified" - // SchemaTypeXML specifies the schema type xml state for schema type. - SchemaTypeXML SchemaType = "Xml" -) - -// SegmentTerminatorSuffix enumerates the values for segment terminator suffix. -type SegmentTerminatorSuffix string - -const ( - // SegmentTerminatorSuffixCR specifies the segment terminator suffix cr - // state for segment terminator suffix. - SegmentTerminatorSuffixCR SegmentTerminatorSuffix = "CR" - // SegmentTerminatorSuffixCRLF specifies the segment terminator suffix crlf - // state for segment terminator suffix. - SegmentTerminatorSuffixCRLF SegmentTerminatorSuffix = "CRLF" - // SegmentTerminatorSuffixLF specifies the segment terminator suffix lf - // state for segment terminator suffix. - SegmentTerminatorSuffixLF SegmentTerminatorSuffix = "LF" - // SegmentTerminatorSuffixNone specifies the segment terminator suffix none - // state for segment terminator suffix. - SegmentTerminatorSuffixNone SegmentTerminatorSuffix = "None" - // SegmentTerminatorSuffixNotSpecified specifies the segment terminator - // suffix not specified state for segment terminator suffix. - SegmentTerminatorSuffixNotSpecified SegmentTerminatorSuffix = "NotSpecified" -) - -// SigningAlgorithm enumerates the values for signing algorithm. -type SigningAlgorithm string - -const ( - // SigningAlgorithmDefault specifies the signing algorithm default state - // for signing algorithm. - SigningAlgorithmDefault SigningAlgorithm = "Default" - // SigningAlgorithmNotSpecified specifies the signing algorithm not - // specified state for signing algorithm. - SigningAlgorithmNotSpecified SigningAlgorithm = "NotSpecified" - // SigningAlgorithmSHA1 specifies the signing algorithm sha1 state for - // signing algorithm. - SigningAlgorithmSHA1 SigningAlgorithm = "SHA1" - // SigningAlgorithmSHA2256 specifies the signing algorithm sha2256 state - // for signing algorithm. - SigningAlgorithmSHA2256 SigningAlgorithm = "SHA2256" - // SigningAlgorithmSHA2384 specifies the signing algorithm sha2384 state - // for signing algorithm. - SigningAlgorithmSHA2384 SigningAlgorithm = "SHA2384" - // SigningAlgorithmSHA2512 specifies the signing algorithm sha2512 state - // for signing algorithm. - SigningAlgorithmSHA2512 SigningAlgorithm = "SHA2512" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic specifies the sku name basic state for sku name. - SkuNameBasic SkuName = "Basic" - // SkuNameFree specifies the sku name free state for sku name. - SkuNameFree SkuName = "Free" - // SkuNameNotSpecified specifies the sku name not specified state for sku - // name. - SkuNameNotSpecified SkuName = "NotSpecified" - // SkuNamePremium specifies the sku name premium state for sku name. - SkuNamePremium SkuName = "Premium" - // SkuNameShared specifies the sku name shared state for sku name. - SkuNameShared SkuName = "Shared" - // SkuNameStandard specifies the sku name standard state for sku name. - SkuNameStandard SkuName = "Standard" -) - -// TrailingSeparatorPolicy enumerates the values for trailing separator policy. -type TrailingSeparatorPolicy string - -const ( - // TrailingSeparatorPolicyMandatory specifies the trailing separator policy - // mandatory state for trailing separator policy. - TrailingSeparatorPolicyMandatory TrailingSeparatorPolicy = "Mandatory" - // TrailingSeparatorPolicyNotAllowed specifies the trailing separator - // policy not allowed state for trailing separator policy. - TrailingSeparatorPolicyNotAllowed TrailingSeparatorPolicy = "NotAllowed" - // TrailingSeparatorPolicyNotSpecified specifies the trailing separator - // policy not specified state for trailing separator policy. - TrailingSeparatorPolicyNotSpecified TrailingSeparatorPolicy = "NotSpecified" - // TrailingSeparatorPolicyOptional specifies the trailing separator policy - // optional state for trailing separator policy. - TrailingSeparatorPolicyOptional TrailingSeparatorPolicy = "Optional" -) - -// UsageIndicator enumerates the values for usage indicator. -type UsageIndicator string - -const ( - // UsageIndicatorInformation specifies the usage indicator information - // state for usage indicator. - UsageIndicatorInformation UsageIndicator = "Information" - // UsageIndicatorNotSpecified specifies the usage indicator not specified - // state for usage indicator. - UsageIndicatorNotSpecified UsageIndicator = "NotSpecified" - // UsageIndicatorProduction specifies the usage indicator production state - // for usage indicator. - UsageIndicatorProduction UsageIndicator = "Production" - // UsageIndicatorTest specifies the usage indicator test state for usage - // indicator. - UsageIndicatorTest UsageIndicator = "Test" -) - -// WorkflowProvisioningState enumerates the values for workflow provisioning -// state. -type WorkflowProvisioningState string - -const ( - // WorkflowProvisioningStateAccepted specifies the workflow provisioning - // state accepted state for workflow provisioning state. - WorkflowProvisioningStateAccepted WorkflowProvisioningState = "Accepted" - // WorkflowProvisioningStateCanceled specifies the workflow provisioning - // state canceled state for workflow provisioning state. - WorkflowProvisioningStateCanceled WorkflowProvisioningState = "Canceled" - // WorkflowProvisioningStateCompleted specifies the workflow provisioning - // state completed state for workflow provisioning state. - WorkflowProvisioningStateCompleted WorkflowProvisioningState = "Completed" - // WorkflowProvisioningStateCreated specifies the workflow provisioning - // state created state for workflow provisioning state. - WorkflowProvisioningStateCreated WorkflowProvisioningState = "Created" - // WorkflowProvisioningStateCreating specifies the workflow provisioning - // state creating state for workflow provisioning state. - WorkflowProvisioningStateCreating WorkflowProvisioningState = "Creating" - // WorkflowProvisioningStateDeleted specifies the workflow provisioning - // state deleted state for workflow provisioning state. - WorkflowProvisioningStateDeleted WorkflowProvisioningState = "Deleted" - // WorkflowProvisioningStateDeleting specifies the workflow provisioning - // state deleting state for workflow provisioning state. - WorkflowProvisioningStateDeleting WorkflowProvisioningState = "Deleting" - // WorkflowProvisioningStateFailed specifies the workflow provisioning - // state failed state for workflow provisioning state. - WorkflowProvisioningStateFailed WorkflowProvisioningState = "Failed" - // WorkflowProvisioningStateMoving specifies the workflow provisioning - // state moving state for workflow provisioning state. - WorkflowProvisioningStateMoving WorkflowProvisioningState = "Moving" - // WorkflowProvisioningStateNotSpecified specifies the workflow - // provisioning state not specified state for workflow provisioning state. - WorkflowProvisioningStateNotSpecified WorkflowProvisioningState = "NotSpecified" - // WorkflowProvisioningStateReady specifies the workflow provisioning state - // ready state for workflow provisioning state. - WorkflowProvisioningStateReady WorkflowProvisioningState = "Ready" - // WorkflowProvisioningStateRegistered specifies the workflow provisioning - // state registered state for workflow provisioning state. - WorkflowProvisioningStateRegistered WorkflowProvisioningState = "Registered" - // WorkflowProvisioningStateRegistering specifies the workflow provisioning - // state registering state for workflow provisioning state. - WorkflowProvisioningStateRegistering WorkflowProvisioningState = "Registering" - // WorkflowProvisioningStateRunning specifies the workflow provisioning - // state running state for workflow provisioning state. - WorkflowProvisioningStateRunning WorkflowProvisioningState = "Running" - // WorkflowProvisioningStateSucceeded specifies the workflow provisioning - // state succeeded state for workflow provisioning state. - WorkflowProvisioningStateSucceeded WorkflowProvisioningState = "Succeeded" - // WorkflowProvisioningStateUnregistered specifies the workflow - // provisioning state unregistered state for workflow provisioning state. - WorkflowProvisioningStateUnregistered WorkflowProvisioningState = "Unregistered" - // WorkflowProvisioningStateUnregistering specifies the workflow - // provisioning state unregistering state for workflow provisioning state. - WorkflowProvisioningStateUnregistering WorkflowProvisioningState = "Unregistering" - // WorkflowProvisioningStateUpdating specifies the workflow provisioning - // state updating state for workflow provisioning state. - WorkflowProvisioningStateUpdating WorkflowProvisioningState = "Updating" -) - -// WorkflowState enumerates the values for workflow state. -type WorkflowState string - -const ( - // WorkflowStateCompleted specifies the workflow state completed state for - // workflow state. - WorkflowStateCompleted WorkflowState = "Completed" - // WorkflowStateDeleted specifies the workflow state deleted state for - // workflow state. - WorkflowStateDeleted WorkflowState = "Deleted" - // WorkflowStateDisabled specifies the workflow state disabled state for - // workflow state. - WorkflowStateDisabled WorkflowState = "Disabled" - // WorkflowStateEnabled specifies the workflow state enabled state for - // workflow state. - WorkflowStateEnabled WorkflowState = "Enabled" - // WorkflowStateNotSpecified specifies the workflow state not specified - // state for workflow state. - WorkflowStateNotSpecified WorkflowState = "NotSpecified" - // WorkflowStateSuspended specifies the workflow state suspended state for - // workflow state. - WorkflowStateSuspended WorkflowState = "Suspended" -) - -// WorkflowStatus enumerates the values for workflow status. -type WorkflowStatus string - -const ( - // WorkflowStatusAborted specifies the workflow status aborted state for - // workflow status. - WorkflowStatusAborted WorkflowStatus = "Aborted" - // WorkflowStatusCancelled specifies the workflow status cancelled state - // for workflow status. - WorkflowStatusCancelled WorkflowStatus = "Cancelled" - // WorkflowStatusFailed specifies the workflow status failed state for - // workflow status. - WorkflowStatusFailed WorkflowStatus = "Failed" - // WorkflowStatusFaulted specifies the workflow status faulted state for - // workflow status. - WorkflowStatusFaulted WorkflowStatus = "Faulted" - // WorkflowStatusIgnored specifies the workflow status ignored state for - // workflow status. - WorkflowStatusIgnored WorkflowStatus = "Ignored" - // WorkflowStatusNotSpecified specifies the workflow status not specified - // state for workflow status. - WorkflowStatusNotSpecified WorkflowStatus = "NotSpecified" - // WorkflowStatusPaused specifies the workflow status paused state for - // workflow status. - WorkflowStatusPaused WorkflowStatus = "Paused" - // WorkflowStatusRunning specifies the workflow status running state for - // workflow status. - WorkflowStatusRunning WorkflowStatus = "Running" - // WorkflowStatusSkipped specifies the workflow status skipped state for - // workflow status. - WorkflowStatusSkipped WorkflowStatus = "Skipped" - // WorkflowStatusSucceeded specifies the workflow status succeeded state - // for workflow status. - WorkflowStatusSucceeded WorkflowStatus = "Succeeded" - // WorkflowStatusSuspended specifies the workflow status suspended state - // for workflow status. - WorkflowStatusSuspended WorkflowStatus = "Suspended" - // WorkflowStatusTimedOut specifies the workflow status timed out state for - // workflow status. - WorkflowStatusTimedOut WorkflowStatus = "TimedOut" - // WorkflowStatusWaiting specifies the workflow status waiting state for - // workflow status. - WorkflowStatusWaiting WorkflowStatus = "Waiting" -) - -// WorkflowTriggerProvisioningState enumerates the values for workflow trigger -// provisioning state. -type WorkflowTriggerProvisioningState string - -const ( - // WorkflowTriggerProvisioningStateAccepted specifies the workflow trigger - // provisioning state accepted state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateAccepted WorkflowTriggerProvisioningState = "Accepted" - // WorkflowTriggerProvisioningStateCanceled specifies the workflow trigger - // provisioning state canceled state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateCanceled WorkflowTriggerProvisioningState = "Canceled" - // WorkflowTriggerProvisioningStateCompleted specifies the workflow trigger - // provisioning state completed state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateCompleted WorkflowTriggerProvisioningState = "Completed" - // WorkflowTriggerProvisioningStateCreated specifies the workflow trigger - // provisioning state created state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateCreated WorkflowTriggerProvisioningState = "Created" - // WorkflowTriggerProvisioningStateCreating specifies the workflow trigger - // provisioning state creating state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateCreating WorkflowTriggerProvisioningState = "Creating" - // WorkflowTriggerProvisioningStateDeleted specifies the workflow trigger - // provisioning state deleted state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateDeleted WorkflowTriggerProvisioningState = "Deleted" - // WorkflowTriggerProvisioningStateDeleting specifies the workflow trigger - // provisioning state deleting state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateDeleting WorkflowTriggerProvisioningState = "Deleting" - // WorkflowTriggerProvisioningStateFailed specifies the workflow trigger - // provisioning state failed state for workflow trigger provisioning state. - WorkflowTriggerProvisioningStateFailed WorkflowTriggerProvisioningState = "Failed" - // WorkflowTriggerProvisioningStateMoving specifies the workflow trigger - // provisioning state moving state for workflow trigger provisioning state. - WorkflowTriggerProvisioningStateMoving WorkflowTriggerProvisioningState = "Moving" - // WorkflowTriggerProvisioningStateNotSpecified specifies the workflow - // trigger provisioning state not specified state for workflow trigger - // provisioning state. - WorkflowTriggerProvisioningStateNotSpecified WorkflowTriggerProvisioningState = "NotSpecified" - // WorkflowTriggerProvisioningStateReady specifies the workflow trigger - // provisioning state ready state for workflow trigger provisioning state. - WorkflowTriggerProvisioningStateReady WorkflowTriggerProvisioningState = "Ready" - // WorkflowTriggerProvisioningStateRegistered specifies the workflow - // trigger provisioning state registered state for workflow trigger - // provisioning state. - WorkflowTriggerProvisioningStateRegistered WorkflowTriggerProvisioningState = "Registered" - // WorkflowTriggerProvisioningStateRegistering specifies the workflow - // trigger provisioning state registering state for workflow trigger - // provisioning state. - WorkflowTriggerProvisioningStateRegistering WorkflowTriggerProvisioningState = "Registering" - // WorkflowTriggerProvisioningStateRunning specifies the workflow trigger - // provisioning state running state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateRunning WorkflowTriggerProvisioningState = "Running" - // WorkflowTriggerProvisioningStateSucceeded specifies the workflow trigger - // provisioning state succeeded state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateSucceeded WorkflowTriggerProvisioningState = "Succeeded" - // WorkflowTriggerProvisioningStateUnregistered specifies the workflow - // trigger provisioning state unregistered state for workflow trigger - // provisioning state. - WorkflowTriggerProvisioningStateUnregistered WorkflowTriggerProvisioningState = "Unregistered" - // WorkflowTriggerProvisioningStateUnregistering specifies the workflow - // trigger provisioning state unregistering state for workflow trigger - // provisioning state. - WorkflowTriggerProvisioningStateUnregistering WorkflowTriggerProvisioningState = "Unregistering" - // WorkflowTriggerProvisioningStateUpdating specifies the workflow trigger - // provisioning state updating state for workflow trigger provisioning - // state. - WorkflowTriggerProvisioningStateUpdating WorkflowTriggerProvisioningState = "Updating" -) - -// X12CharacterSet enumerates the values for x12 character set. -type X12CharacterSet string - -const ( - // X12CharacterSetBasic specifies the x12 character set basic state for x12 - // character set. - X12CharacterSetBasic X12CharacterSet = "Basic" - // X12CharacterSetExtended specifies the x12 character set extended state - // for x12 character set. - X12CharacterSetExtended X12CharacterSet = "Extended" - // X12CharacterSetNotSpecified specifies the x12 character set not - // specified state for x12 character set. - X12CharacterSetNotSpecified X12CharacterSet = "NotSpecified" - // X12CharacterSetUTF8 specifies the x12 character set utf8 state for x12 - // character set. - X12CharacterSetUTF8 X12CharacterSet = "UTF8" -) - -// X12DateFormat enumerates the values for x12 date format. -type X12DateFormat string - -const ( - // X12DateFormatCCYYMMDD specifies the x12 date format ccyymmdd state for - // x12 date format. - X12DateFormatCCYYMMDD X12DateFormat = "CCYYMMDD" - // X12DateFormatNotSpecified specifies the x12 date format not specified - // state for x12 date format. - X12DateFormatNotSpecified X12DateFormat = "NotSpecified" - // X12DateFormatYYMMDD specifies the x12 date format yymmdd state for x12 - // date format. - X12DateFormatYYMMDD X12DateFormat = "YYMMDD" -) - -// X12TimeFormat enumerates the values for x12 time format. -type X12TimeFormat string - -const ( - // X12TimeFormatHHMM specifies the x12 time format hhmm state for x12 time - // format. - X12TimeFormatHHMM X12TimeFormat = "HHMM" - // X12TimeFormatHHMMSS specifies the x12 time format hhmmss state for x12 - // time format. - X12TimeFormatHHMMSS X12TimeFormat = "HHMMSS" - // X12TimeFormatHHMMSSd specifies the x12 time format hhmms sd state for - // x12 time format. - X12TimeFormatHHMMSSd X12TimeFormat = "HHMMSSd" - // X12TimeFormatHHMMSSdd specifies the x12 time format hhmms sdd state for - // x12 time format. - X12TimeFormatHHMMSSdd X12TimeFormat = "HHMMSSdd" - // X12TimeFormatNotSpecified specifies the x12 time format not specified - // state for x12 time format. - X12TimeFormatNotSpecified X12TimeFormat = "NotSpecified" -) - -// AgreementContent is the integration account agreement content. -type AgreementContent struct { - AS2 *AS2AgreementContent `json:"aS2,omitempty"` - X12 *X12AgreementContent `json:"x12,omitempty"` - Edifact *EdifactAgreementContent `json:"edifact,omitempty"` -} - -// AS2AcknowledgementConnectionSettings is the AS2 agreement acknowledegment -// connection settings. -type AS2AcknowledgementConnectionSettings struct { - IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` - SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` - KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` - UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` -} - -// AS2AgreementContent is the integration account AS2 agreement content. -type AS2AgreementContent struct { - ReceiveAgreement *AS2OneWayAgreement `json:"receiveAgreement,omitempty"` - SendAgreement *AS2OneWayAgreement `json:"sendAgreement,omitempty"` -} - -// AS2EnvelopeSettings is the AS2 agreement envelope settings. -type AS2EnvelopeSettings struct { - MessageContentType *string `json:"messageContentType,omitempty"` - TransmitFileNameInMimeHeader *bool `json:"transmitFileNameInMimeHeader,omitempty"` - FileNameTemplate *string `json:"fileNameTemplate,omitempty"` - SuspendMessageOnFileNameGenerationError *bool `json:"suspendMessageOnFileNameGenerationError,omitempty"` - AutogenerateFileName *bool `json:"autogenerateFileName,omitempty"` -} - -// AS2ErrorSettings is the AS2 agreement error settings. -type AS2ErrorSettings struct { - SuspendDuplicateMessage *bool `json:"suspendDuplicateMessage,omitempty"` - ResendIfMdnNotReceived *bool `json:"resendIfMdnNotReceived,omitempty"` -} - -// AS2MdnSettings is the AS2 agreement mdn settings. -type AS2MdnSettings struct { - NeedMdn *bool `json:"needMdn,omitempty"` - SignMdn *bool `json:"signMdn,omitempty"` - SendMdnAsynchronously *bool `json:"sendMdnAsynchronously,omitempty"` - ReceiptDeliveryURL *string `json:"receiptDeliveryUrl,omitempty"` - DispositionNotificationTo *string `json:"dispositionNotificationTo,omitempty"` - SignOutboundMdnIfOptional *bool `json:"signOutboundMdnIfOptional,omitempty"` - MdnText *string `json:"mdnText,omitempty"` - SendInboundMdnToMessageBox *bool `json:"sendInboundMdnToMessageBox,omitempty"` - MicHashingAlgorithm HashingAlgorithm `json:"micHashingAlgorithm,omitempty"` -} - -// AS2MessageConnectionSettings is the AS2 agreement message connection -// settings. -type AS2MessageConnectionSettings struct { - IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` - SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` - KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` - UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` -} - -// AS2OneWayAgreement is the integration account AS2 oneway agreement. -type AS2OneWayAgreement struct { - SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` - ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` - ProtocolSettings *AS2ProtocolSettings `json:"protocolSettings,omitempty"` -} - -// AS2ProtocolSettings is the AS2 agreement protocol settings. -type AS2ProtocolSettings struct { - MessageConnectionSettings *AS2MessageConnectionSettings `json:"messageConnectionSettings,omitempty"` - AcknowledgementConnectionSettings *AS2AcknowledgementConnectionSettings `json:"acknowledgementConnectionSettings,omitempty"` - MdnSettings *AS2MdnSettings `json:"mdnSettings,omitempty"` - SecuritySettings *AS2SecuritySettings `json:"securitySettings,omitempty"` - ValidationSettings *AS2ValidationSettings `json:"validationSettings,omitempty"` - EnvelopeSettings *AS2EnvelopeSettings `json:"envelopeSettings,omitempty"` - ErrorSettings *AS2ErrorSettings `json:"errorSettings,omitempty"` -} - -// AS2SecuritySettings is the AS2 agreement security settings. -type AS2SecuritySettings struct { - OverrideGroupSigningCertificate *bool `json:"overrideGroupSigningCertificate,omitempty"` - SigningCertificateName *string `json:"signingCertificateName,omitempty"` - EncryptionCertificateName *string `json:"encryptionCertificateName,omitempty"` - EnableNrrForInboundEncodedMessages *bool `json:"enableNrrForInboundEncodedMessages,omitempty"` - EnableNrrForInboundDecodedMessages *bool `json:"enableNrrForInboundDecodedMessages,omitempty"` - EnableNrrForOutboundMdn *bool `json:"enableNrrForOutboundMdn,omitempty"` - EnableNrrForOutboundEncodedMessages *bool `json:"enableNrrForOutboundEncodedMessages,omitempty"` - EnableNrrForOutboundDecodedMessages *bool `json:"enableNrrForOutboundDecodedMessages,omitempty"` - EnableNrrForInboundMdn *bool `json:"enableNrrForInboundMdn,omitempty"` - Sha2AlgorithmFormat *string `json:"sha2AlgorithmFormat,omitempty"` -} - -// AS2ValidationSettings is the AS2 agreement validation settings. -type AS2ValidationSettings struct { - OverrideMessageProperties *bool `json:"overrideMessageProperties,omitempty"` - EncryptMessage *bool `json:"encryptMessage,omitempty"` - SignMessage *bool `json:"signMessage,omitempty"` - CompressMessage *bool `json:"compressMessage,omitempty"` - CheckDuplicateMessage *bool `json:"checkDuplicateMessage,omitempty"` - InterchangeDuplicatesValidityDays *int32 `json:"interchangeDuplicatesValidityDays,omitempty"` - CheckCertificateRevocationListOnSend *bool `json:"checkCertificateRevocationListOnSend,omitempty"` - CheckCertificateRevocationListOnReceive *bool `json:"checkCertificateRevocationListOnReceive,omitempty"` - EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` - SigningAlgorithm SigningAlgorithm `json:"signingAlgorithm,omitempty"` -} - -// B2BPartnerContent is the B2B partner content. -type B2BPartnerContent struct { - BusinessIdentities *[]BusinessIdentity `json:"businessIdentities,omitempty"` -} - -// BusinessIdentity is the integration account partner's business identity. -type BusinessIdentity struct { - Qualifier *string `json:"qualifier,omitempty"` - Value *string `json:"value,omitempty"` -} - -// CallbackURL is the callback url. -type CallbackURL struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// ContentHash is the content hash. -type ContentHash struct { - Algorithm *string `json:"algorithm,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ContentLink is the content link. -type ContentLink struct { - URI *string `json:"uri,omitempty"` - ContentVersion *string `json:"contentVersion,omitempty"` - ContentSize *int64 `json:"contentSize,omitempty"` - ContentHash *ContentHash `json:"contentHash,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` -} - -// Correlation is the correlation property. -type Correlation struct { - ClientTrackingID *string `json:"clientTrackingId,omitempty"` -} - -// EdifactAcknowledgementSettings is the Edifact agreement acknowledgement -// settings. -type EdifactAcknowledgementSettings struct { - NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` - BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` - NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` - BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` - NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` - SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` - AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` - AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` - AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` - AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` - RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` -} - -// EdifactAgreementContent is the Edifact agreement content. -type EdifactAgreementContent struct { - ReceiveAgreement *EdifactOneWayAgreement `json:"receiveAgreement,omitempty"` - SendAgreement *EdifactOneWayAgreement `json:"sendAgreement,omitempty"` -} - -// EdifactDelimiterOverride is the Edifact delimiter override settings. -type EdifactDelimiterOverride struct { - MessageID *string `json:"messageId,omitempty"` - MessageVersion *string `json:"messageVersion,omitempty"` - MessageRelease *string `json:"messageRelease,omitempty"` - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` - DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` - ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` - MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` - TargetNamespace *string `json:"targetNamespace,omitempty"` -} - -// EdifactEnvelopeOverride is the Edifact enevlope override settings. -type EdifactEnvelopeOverride struct { - MessageID *string `json:"messageId,omitempty"` - MessageVersion *string `json:"messageVersion,omitempty"` - MessageRelease *string `json:"messageRelease,omitempty"` - MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` - TargetNamespace *string `json:"targetNamespace,omitempty"` - FunctionalGroupID *string `json:"functionalGroupId,omitempty"` - SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - ReceiverApplicationQualifier *string `json:"receiverApplicationQualifier,omitempty"` - ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` - ControllingAgencyCode *string `json:"controllingAgencyCode,omitempty"` - GroupHeaderMessageVersion *string `json:"groupHeaderMessageVersion,omitempty"` - GroupHeaderMessageRelease *string `json:"groupHeaderMessageRelease,omitempty"` - AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` - ApplicationPassword *string `json:"applicationPassword,omitempty"` -} - -// EdifactEnvelopeSettings is the Edifact agreement envelope settings. -type EdifactEnvelopeSettings struct { - GroupAssociationAssignedCode *string `json:"groupAssociationAssignedCode,omitempty"` - CommunicationAgreementID *string `json:"communicationAgreementId,omitempty"` - ApplyDelimiterStringAdvice *bool `json:"applyDelimiterStringAdvice,omitempty"` - CreateGroupingSegments *bool `json:"createGroupingSegments,omitempty"` - EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` - RecipientReferencePasswordValue *string `json:"recipientReferencePasswordValue,omitempty"` - RecipientReferencePasswordQualifier *string `json:"recipientReferencePasswordQualifier,omitempty"` - ApplicationReferenceID *string `json:"applicationReferenceId,omitempty"` - ProcessingPriorityCode *string `json:"processingPriorityCode,omitempty"` - InterchangeControlNumberLowerBound *int64 `json:"interchangeControlNumberLowerBound,omitempty"` - InterchangeControlNumberUpperBound *int64 `json:"interchangeControlNumberUpperBound,omitempty"` - RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` - InterchangeControlNumberPrefix *string `json:"interchangeControlNumberPrefix,omitempty"` - InterchangeControlNumberSuffix *string `json:"interchangeControlNumberSuffix,omitempty"` - SenderReverseRoutingAddress *string `json:"senderReverseRoutingAddress,omitempty"` - ReceiverReverseRoutingAddress *string `json:"receiverReverseRoutingAddress,omitempty"` - FunctionalGroupID *string `json:"functionalGroupId,omitempty"` - GroupControllingAgencyCode *string `json:"groupControllingAgencyCode,omitempty"` - GroupMessageVersion *string `json:"groupMessageVersion,omitempty"` - GroupMessageRelease *string `json:"groupMessageRelease,omitempty"` - GroupControlNumberLowerBound *int64 `json:"groupControlNumberLowerBound,omitempty"` - GroupControlNumberUpperBound *int64 `json:"groupControlNumberUpperBound,omitempty"` - RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` - GroupControlNumberPrefix *string `json:"groupControlNumberPrefix,omitempty"` - GroupControlNumberSuffix *string `json:"groupControlNumberSuffix,omitempty"` - GroupApplicationReceiverQualifier *string `json:"groupApplicationReceiverQualifier,omitempty"` - GroupApplicationReceiverID *string `json:"groupApplicationReceiverId,omitempty"` - GroupApplicationSenderQualifier *string `json:"groupApplicationSenderQualifier,omitempty"` - GroupApplicationSenderID *string `json:"groupApplicationSenderId,omitempty"` - GroupApplicationPassword *string `json:"groupApplicationPassword,omitempty"` - OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` - TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` - TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` - TransactionSetControlNumberLowerBound *int64 `json:"transactionSetControlNumberLowerBound,omitempty"` - TransactionSetControlNumberUpperBound *int64 `json:"transactionSetControlNumberUpperBound,omitempty"` - RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` - IsTestInterchange *bool `json:"isTestInterchange,omitempty"` - SenderInternalIdentification *string `json:"senderInternalIdentification,omitempty"` - SenderInternalSubIdentification *string `json:"senderInternalSubIdentification,omitempty"` - ReceiverInternalIdentification *string `json:"receiverInternalIdentification,omitempty"` - ReceiverInternalSubIdentification *string `json:"receiverInternalSubIdentification,omitempty"` -} - -// EdifactFramingSettings is the Edifact agreement framing settings. -type EdifactFramingSettings struct { - ServiceCodeListDirectoryVersion *string `json:"serviceCodeListDirectoryVersion,omitempty"` - CharacterEncoding *string `json:"characterEncoding,omitempty"` - ProtocolVersion *int32 `json:"protocolVersion,omitempty"` - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` - RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` - CharacterSet EdifactCharacterSet `json:"characterSet,omitempty"` - DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` -} - -// EdifactMessageFilter is the Edifact message filter for odata query. -type EdifactMessageFilter struct { - MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` -} - -// EdifactMessageIdentifier is the Edifact message identifier. -type EdifactMessageIdentifier struct { - MessageID *string `json:"messageId,omitempty"` -} - -// EdifactOneWayAgreement is the Edifact one way agreement. -type EdifactOneWayAgreement struct { - SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` - ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` - ProtocolSettings *EdifactProtocolSettings `json:"protocolSettings,omitempty"` -} - -// EdifactProcessingSettings is the Edifact agreement protocol settings. -type EdifactProcessingSettings struct { - MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` - PreserveInterchange *bool `json:"preserveInterchange,omitempty"` - SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` - CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` - UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` -} - -// EdifactProtocolSettings is the Edifact agreement protocol settings. -type EdifactProtocolSettings struct { - ValidationSettings *EdifactValidationSettings `json:"validationSettings,omitempty"` - FramingSettings *EdifactFramingSettings `json:"framingSettings,omitempty"` - EnvelopeSettings *EdifactEnvelopeSettings `json:"envelopeSettings,omitempty"` - AcknowledgementSettings *EdifactAcknowledgementSettings `json:"acknowledgementSettings,omitempty"` - MessageFilter *EdifactMessageFilter `json:"messageFilter,omitempty"` - ProcessingSettings *EdifactProcessingSettings `json:"processingSettings,omitempty"` - EnvelopeOverrides *[]EdifactEnvelopeOverride `json:"envelopeOverrides,omitempty"` - MessageFilterList *[]EdifactMessageIdentifier `json:"messageFilterList,omitempty"` - SchemaReferences *[]EdifactSchemaReference `json:"schemaReferences,omitempty"` - ValidationOverrides *[]EdifactValidationOverride `json:"validationOverrides,omitempty"` - EdifactDelimiterOverrides *[]EdifactDelimiterOverride `json:"edifactDelimiterOverrides,omitempty"` -} - -// EdifactSchemaReference is the Edifact schema reference. -type EdifactSchemaReference struct { - MessageID *string `json:"messageId,omitempty"` - MessageVersion *string `json:"messageVersion,omitempty"` - MessageRelease *string `json:"messageRelease,omitempty"` - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` - AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` - SchemaName *string `json:"schemaName,omitempty"` -} - -// EdifactValidationOverride is the Edifact validation override settings. -type EdifactValidationOverride struct { - MessageID *string `json:"messageId,omitempty"` - EnforceCharacterSet *bool `json:"enforceCharacterSet,omitempty"` - ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` - ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` -} - -// EdifactValidationSettings is the Edifact agreement validation settings. -type EdifactValidationSettings struct { - ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` - CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` - InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` - CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` - CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` - ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` - ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` -} - -// ErrorProperties is error properties indicate why the Logic service was not -// able to process the incoming request. The reason is provided in the error -// message. -type ErrorProperties struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ErrorResponse is error reponse indicates Logic service is not able to -// process the incoming request. The error property contains the error details. -type ErrorResponse struct { - Error *ErrorProperties `json:"error,omitempty"` -} - -// GenerateUpgradedDefinitionParameters is the parameters to generate upgraded -// definition. -type GenerateUpgradedDefinitionParameters struct { - TargetSchemaVersion *string `json:"targetSchemaVersion,omitempty"` -} - -// GetCallbackURLParameters is the callback url parameters. -type GetCallbackURLParameters struct { - NotAfter *date.Time `json:"notAfter,omitempty"` - KeyType KeyType `json:"keyType,omitempty"` -} - -// IntegrationAccount is the integration account. -type IntegrationAccount struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Sku *IntegrationAccountSku `json:"sku,omitempty"` -} - -// IntegrationAccountAgreement is the integration account agreement. -type IntegrationAccountAgreement struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IntegrationAccountAgreementProperties `json:"properties,omitempty"` -} - -// IntegrationAccountAgreementFilter is the integration account agreement -// filter for odata query. -type IntegrationAccountAgreementFilter struct { - AgreementType AgreementType `json:"agreementType,omitempty"` -} - -// IntegrationAccountAgreementListResult is the list of integration account -// agreements. -type IntegrationAccountAgreementListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccountAgreement `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountAgreementListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountAgreementListResult) IntegrationAccountAgreementListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountAgreementProperties is the integration account agreement -// properties. -type IntegrationAccountAgreementProperties struct { - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - AgreementType AgreementType `json:"agreementType,omitempty"` - HostPartner *string `json:"hostPartner,omitempty"` - GuestPartner *string `json:"guestPartner,omitempty"` - HostIdentity *BusinessIdentity `json:"hostIdentity,omitempty"` - GuestIdentity *BusinessIdentity `json:"guestIdentity,omitempty"` - Content *AgreementContent `json:"content,omitempty"` -} - -// IntegrationAccountCertificate is the integration account certificate. -type IntegrationAccountCertificate struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IntegrationAccountCertificateProperties `json:"properties,omitempty"` -} - -// IntegrationAccountCertificateListResult is the list of integration account -// certificates. -type IntegrationAccountCertificateListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccountCertificate `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountCertificateListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountCertificateListResult) IntegrationAccountCertificateListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountCertificateProperties is the integration account -// certificate properties. -type IntegrationAccountCertificateProperties struct { - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - Key *KeyVaultKeyReference `json:"key,omitempty"` - PublicCertificate *string `json:"publicCertificate,omitempty"` -} - -// IntegrationAccountListResult is the list of integration accounts. -type IntegrationAccountListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccount `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountListResult) IntegrationAccountListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountMap is the integration account map. -type IntegrationAccountMap struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IntegrationAccountMapProperties `json:"properties,omitempty"` -} - -// IntegrationAccountMapFilter is the integration account map filter for odata -// query. -type IntegrationAccountMapFilter struct { - MapType MapType `json:"mapType,omitempty"` -} - -// IntegrationAccountMapListResult is the list of integration account maps. -type IntegrationAccountMapListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccountMap `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountMapListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountMapListResult) IntegrationAccountMapListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountMapProperties is the integration account map. -type IntegrationAccountMapProperties struct { - MapType MapType `json:"mapType,omitempty"` - ParametersSchema *IntegrationAccountMapPropertiesParametersSchema `json:"parametersSchema,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - Content *string `json:"content,omitempty"` - ContentType *string `json:"contentType,omitempty"` - ContentLink *ContentLink `json:"contentLink,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` -} - -// IntegrationAccountMapPropertiesParametersSchema is the parameters schema of -// integration account map. -type IntegrationAccountMapPropertiesParametersSchema struct { - Ref *string `json:"ref,omitempty"` -} - -// IntegrationAccountPartner is the integration account partner. -type IntegrationAccountPartner struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IntegrationAccountPartnerProperties `json:"properties,omitempty"` -} - -// IntegrationAccountPartnerFilter is the integration account partner filter -// for odata query. -type IntegrationAccountPartnerFilter struct { - PartnerType PartnerType `json:"partnerType,omitempty"` -} - -// IntegrationAccountPartnerListResult is the list of integration account -// partners. -type IntegrationAccountPartnerListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccountPartner `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountPartnerListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountPartnerListResult) IntegrationAccountPartnerListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountPartnerProperties is the integration account partner -// properties. -type IntegrationAccountPartnerProperties struct { - PartnerType PartnerType `json:"partnerType,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - Content *PartnerContent `json:"content,omitempty"` -} - -// IntegrationAccountSchema is the integration account schema. -type IntegrationAccountSchema struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IntegrationAccountSchemaProperties `json:"properties,omitempty"` -} - -// IntegrationAccountSchemaFilter is the integration account schema filter for -// odata query. -type IntegrationAccountSchemaFilter struct { - SchemaType SchemaType `json:"schemaType,omitempty"` -} - -// IntegrationAccountSchemaListResult is the list of integration account -// schemas. -type IntegrationAccountSchemaListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccountSchema `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountSchemaListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountSchemaListResult) IntegrationAccountSchemaListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountSchemaProperties is the integration account schema -// properties. -type IntegrationAccountSchemaProperties struct { - SchemaType SchemaType `json:"schemaType,omitempty"` - TargetNamespace *string `json:"targetNamespace,omitempty"` - DocumentName *string `json:"documentName,omitempty"` - FileName *string `json:"fileName,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - Content *string `json:"content,omitempty"` - ContentType *string `json:"contentType,omitempty"` - ContentLink *ContentLink `json:"contentLink,omitempty"` -} - -// IntegrationAccountSession is the integration account session. -type IntegrationAccountSession struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IntegrationAccountSessionProperties `json:"properties,omitempty"` -} - -// IntegrationAccountSessionFilter is the integration account session filter. -type IntegrationAccountSessionFilter struct { - ChangedTime *date.Time `json:"changedTime,omitempty"` -} - -// IntegrationAccountSessionListResult is the list of integration account -// sessions. -type IntegrationAccountSessionListResult struct { - autorest.Response `json:"-"` - Value *[]IntegrationAccountSession `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IntegrationAccountSessionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IntegrationAccountSessionListResult) IntegrationAccountSessionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntegrationAccountSessionProperties is the integration account session -// properties. -type IntegrationAccountSessionProperties struct { - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - Content *map[string]interface{} `json:"content,omitempty"` -} - -// IntegrationAccountSku is the integration account sku. -type IntegrationAccountSku struct { - Name IntegrationAccountSkuName `json:"name,omitempty"` -} - -// KeyVaultKeyReference is the reference to the key vault key. -type KeyVaultKeyReference struct { - KeyVault *KeyVaultKeyReferenceKeyVault `json:"keyVault,omitempty"` - KeyName *string `json:"keyName,omitempty"` - KeyVersion *string `json:"keyVersion,omitempty"` -} - -// KeyVaultKeyReferenceKeyVault is the key vault reference. -type KeyVaultKeyReferenceKeyVault struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// Operation is logic REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list Logic operations. It -// contains a list of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PartnerContent is the integration account partner content. -type PartnerContent struct { - B2b *B2BPartnerContent `json:"b2b,omitempty"` -} - -// RecurrenceSchedule is the recurrence schedule. -type RecurrenceSchedule struct { - Minutes *[]int32 `json:"minutes,omitempty"` - Hours *[]int32 `json:"hours,omitempty"` - WeekDays *[]DaysOfWeek `json:"weekDays,omitempty"` - MonthDays *[]int32 `json:"monthDays,omitempty"` - MonthlyOccurrences *[]RecurrenceScheduleOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// RecurrenceScheduleOccurrence is the recurrence schedule occurence. -type RecurrenceScheduleOccurrence struct { - Day DayOfWeek `json:"day,omitempty"` - Occurrence *int32 `json:"occurrence,omitempty"` -} - -// RegenerateActionParameter is the access key regenerate action content. -type RegenerateActionParameter struct { - KeyType KeyType `json:"keyType,omitempty"` -} - -// Resource is the base resource type. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceReference is the resource reference. -type ResourceReference struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// RetryHistory is the retry history. -type RetryHistory struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Code *string `json:"code,omitempty"` - ClientRequestID *string `json:"clientRequestId,omitempty"` - ServiceRequestID *string `json:"serviceRequestId,omitempty"` - Error *ErrorResponse `json:"error,omitempty"` -} - -// SetObject is -type SetObject struct { - autorest.Response `json:"-"` - Value *map[string]interface{} `json:"value,omitempty"` -} - -// Sku is the sku type. -type Sku struct { - Name SkuName `json:"name,omitempty"` - Plan *ResourceReference `json:"plan,omitempty"` -} - -// SubResource is the sub resource type. -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// Workflow is the workflow type. -type Workflow struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *WorkflowProperties `json:"properties,omitempty"` -} - -// WorkflowFilter is the workflow filter. -type WorkflowFilter struct { - State WorkflowState `json:"state,omitempty"` -} - -// WorkflowListResult is the list of workflows. -type WorkflowListResult struct { - autorest.Response `json:"-"` - Value *[]Workflow `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkflowListResult) WorkflowListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkflowOutputParameter is the workflow output parameter. -type WorkflowOutputParameter struct { - Type ParameterType `json:"type,omitempty"` - Value *map[string]interface{} `json:"value,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - Description *string `json:"description,omitempty"` - Error *map[string]interface{} `json:"error,omitempty"` -} - -// WorkflowParameter is the workflow parameters. -type WorkflowParameter struct { - Type ParameterType `json:"type,omitempty"` - Value *map[string]interface{} `json:"value,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - Description *string `json:"description,omitempty"` -} - -// WorkflowProperties is the workflow properties. -type WorkflowProperties struct { - ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - State WorkflowState `json:"state,omitempty"` - Version *string `json:"version,omitempty"` - AccessEndpoint *string `json:"accessEndpoint,omitempty"` - Sku *Sku `json:"sku,omitempty"` - IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` - Definition *map[string]interface{} `json:"definition,omitempty"` - Parameters *map[string]*WorkflowParameter `json:"parameters,omitempty"` -} - -// WorkflowRun is the workflow run. -type WorkflowRun struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *WorkflowRunProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// WorkflowRunAction is the workflow run action. -type WorkflowRunAction struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *WorkflowRunActionProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// WorkflowRunActionFilter is the workflow run action filter. -type WorkflowRunActionFilter struct { - Status WorkflowStatus `json:"status,omitempty"` -} - -// WorkflowRunActionListResult is the list of workflow run actions. -type WorkflowRunActionListResult struct { - autorest.Response `json:"-"` - Value *[]WorkflowRunAction `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowRunActionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkflowRunActionListResult) WorkflowRunActionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkflowRunActionProperties is the workflow run action properties. -type WorkflowRunActionProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Status WorkflowStatus `json:"status,omitempty"` - Code *string `json:"code,omitempty"` - Error *map[string]interface{} `json:"error,omitempty"` - TrackingID *string `json:"trackingId,omitempty"` - Correlation *Correlation `json:"correlation,omitempty"` - InputsLink *ContentLink `json:"inputsLink,omitempty"` - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - TrackedProperties *map[string]interface{} `json:"trackedProperties,omitempty"` - RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` -} - -// WorkflowRunFilter is the workflow run filter. -type WorkflowRunFilter struct { - Status WorkflowStatus `json:"status,omitempty"` -} - -// WorkflowRunListResult is the list of workflow runs. -type WorkflowRunListResult struct { - autorest.Response `json:"-"` - Value *[]WorkflowRun `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowRunListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkflowRunListResult) WorkflowRunListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkflowRunProperties is the workflow run properties. -type WorkflowRunProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Status WorkflowStatus `json:"status,omitempty"` - Code *string `json:"code,omitempty"` - Error *map[string]interface{} `json:"error,omitempty"` - CorrelationID *string `json:"correlationId,omitempty"` - Correlation *Correlation `json:"correlation,omitempty"` - Workflow *ResourceReference `json:"workflow,omitempty"` - Trigger *WorkflowRunTrigger `json:"trigger,omitempty"` - Outputs *map[string]*WorkflowOutputParameter `json:"outputs,omitempty"` - Response *WorkflowRunTrigger `json:"response,omitempty"` -} - -// WorkflowRunTrigger is the workflow run trigger. -type WorkflowRunTrigger struct { - Name *string `json:"name,omitempty"` - Inputs *map[string]interface{} `json:"inputs,omitempty"` - InputsLink *ContentLink `json:"inputsLink,omitempty"` - Outputs *map[string]interface{} `json:"outputs,omitempty"` - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - TrackingID *string `json:"trackingId,omitempty"` - Correlation *Correlation `json:"correlation,omitempty"` - Code *string `json:"code,omitempty"` - Status WorkflowStatus `json:"status,omitempty"` - Error *map[string]interface{} `json:"error,omitempty"` - TrackedProperties *map[string]interface{} `json:"trackedProperties,omitempty"` -} - -// WorkflowTrigger is the workflow trigger. -type WorkflowTrigger struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *WorkflowTriggerProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// WorkflowTriggerCallbackURL is the workflow trigger callback URL. -type WorkflowTriggerCallbackURL struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` - Method *string `json:"method,omitempty"` - BasePath *string `json:"basePath,omitempty"` - RelativePath *string `json:"relativePath,omitempty"` - RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` - Queries *WorkflowTriggerListCallbackURLQueries `json:"queries,omitempty"` -} - -// WorkflowTriggerFilter is the workflow trigger filter. -type WorkflowTriggerFilter struct { - State WorkflowState `json:"state,omitempty"` -} - -// WorkflowTriggerHistory is the workflow trigger history. -type WorkflowTriggerHistory struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *WorkflowTriggerHistoryProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// WorkflowTriggerHistoryFilter is the workflow trigger history filter. -type WorkflowTriggerHistoryFilter struct { - Status WorkflowStatus `json:"status,omitempty"` -} - -// WorkflowTriggerHistoryListResult is the list of workflow trigger histories. -type WorkflowTriggerHistoryListResult struct { - autorest.Response `json:"-"` - Value *[]WorkflowTriggerHistory `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowTriggerHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkflowTriggerHistoryListResult) WorkflowTriggerHistoryListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkflowTriggerHistoryProperties is the workflow trigger history properties. -type WorkflowTriggerHistoryProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Status WorkflowStatus `json:"status,omitempty"` - Code *string `json:"code,omitempty"` - Error *map[string]interface{} `json:"error,omitempty"` - TrackingID *string `json:"trackingId,omitempty"` - Correlation *Correlation `json:"correlation,omitempty"` - InputsLink *ContentLink `json:"inputsLink,omitempty"` - OutputsLink *ContentLink `json:"outputsLink,omitempty"` - Fired *bool `json:"fired,omitempty"` - Run *ResourceReference `json:"run,omitempty"` -} - -// WorkflowTriggerListCallbackURLQueries is gets the workflow trigger callback -// URL query parameters. -type WorkflowTriggerListCallbackURLQueries struct { - APIVersion *string `json:"api-version,omitempty"` - Sp *string `json:"sp,omitempty"` - Sv *string `json:"sv,omitempty"` - Sig *string `json:"sig,omitempty"` -} - -// WorkflowTriggerListResult is the list of workflow triggers. -type WorkflowTriggerListResult struct { - autorest.Response `json:"-"` - Value *[]WorkflowTrigger `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowTriggerListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkflowTriggerListResult) WorkflowTriggerListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkflowTriggerProperties is the workflow trigger properties. -type WorkflowTriggerProperties struct { - ProvisioningState WorkflowTriggerProvisioningState `json:"provisioningState,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - State WorkflowState `json:"state,omitempty"` - Status WorkflowStatus `json:"status,omitempty"` - LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` - NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"` - Recurrence *WorkflowTriggerRecurrence `json:"recurrence,omitempty"` - Workflow *ResourceReference `json:"workflow,omitempty"` -} - -// WorkflowTriggerRecurrence is the workflow trigger recurrence. -type WorkflowTriggerRecurrence struct { - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - Interval *int32 `json:"interval,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` - Schedule *RecurrenceSchedule `json:"schedule,omitempty"` -} - -// WorkflowVersion is the workflow version. -type WorkflowVersion struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *WorkflowVersionProperties `json:"properties,omitempty"` -} - -// WorkflowVersionListResult is the list of workflow versions. -type WorkflowVersionListResult struct { - autorest.Response `json:"-"` - Value *[]WorkflowVersion `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkflowVersionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkflowVersionListResult) WorkflowVersionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkflowVersionProperties is the workflow version properties. -type WorkflowVersionProperties struct { - CreatedTime *date.Time `json:"createdTime,omitempty"` - ChangedTime *date.Time `json:"changedTime,omitempty"` - State WorkflowState `json:"state,omitempty"` - Version *string `json:"version,omitempty"` - AccessEndpoint *string `json:"accessEndpoint,omitempty"` - Sku *Sku `json:"sku,omitempty"` - IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` - Definition *map[string]interface{} `json:"definition,omitempty"` - Parameters *map[string]*WorkflowParameter `json:"parameters,omitempty"` -} - -// X12AcknowledgementSettings is the X12 agreement acknowledgement settings. -type X12AcknowledgementSettings struct { - NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` - BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` - NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` - FunctionalAcknowledgementVersion *string `json:"functionalAcknowledgementVersion,omitempty"` - BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` - NeedImplementationAcknowledgement *bool `json:"needImplementationAcknowledgement,omitempty"` - ImplementationAcknowledgementVersion *string `json:"implementationAcknowledgementVersion,omitempty"` - BatchImplementationAcknowledgements *bool `json:"batchImplementationAcknowledgements,omitempty"` - NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` - SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` - AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` - AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` - AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` - AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` - RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` -} - -// X12AgreementContent is the X12 agreement content. -type X12AgreementContent struct { - ReceiveAgreement *X12OneWayAgreement `json:"receiveAgreement,omitempty"` - SendAgreement *X12OneWayAgreement `json:"sendAgreement,omitempty"` -} - -// X12DelimiterOverrides is the X12 delimiter override settings. -type X12DelimiterOverrides struct { - ProtocolVersion *string `json:"protocolVersion,omitempty"` - MessageID *string `json:"messageId,omitempty"` - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` - ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` - ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` - TargetNamespace *string `json:"targetNamespace,omitempty"` -} - -// X12EnvelopeOverride is the X12 envelope override settings. -type X12EnvelopeOverride struct { - TargetNamespace *string `json:"targetNamespace,omitempty"` - ProtocolVersion *string `json:"protocolVersion,omitempty"` - MessageID *string `json:"messageId,omitempty"` - ResponsibleAgencyCode *string `json:"responsibleAgencyCode,omitempty"` - HeaderVersion *string `json:"headerVersion,omitempty"` - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` - FunctionalIdentifierCode *string `json:"functionalIdentifierCode,omitempty"` - DateFormat X12DateFormat `json:"dateFormat,omitempty"` - TimeFormat X12TimeFormat `json:"timeFormat,omitempty"` -} - -// X12EnvelopeSettings is the X12 agreement envelope settings. -type X12EnvelopeSettings struct { - ControlStandardsID *int32 `json:"controlStandardsId,omitempty"` - UseControlStandardsIDAsRepetitionCharacter *bool `json:"useControlStandardsIdAsRepetitionCharacter,omitempty"` - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` - ControlVersionNumber *string `json:"controlVersionNumber,omitempty"` - InterchangeControlNumberLowerBound *int32 `json:"interchangeControlNumberLowerBound,omitempty"` - InterchangeControlNumberUpperBound *int32 `json:"interchangeControlNumberUpperBound,omitempty"` - RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` - EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` - FunctionalGroupID *string `json:"functionalGroupId,omitempty"` - GroupControlNumberLowerBound *int32 `json:"groupControlNumberLowerBound,omitempty"` - GroupControlNumberUpperBound *int32 `json:"groupControlNumberUpperBound,omitempty"` - RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` - GroupHeaderAgencyCode *string `json:"groupHeaderAgencyCode,omitempty"` - GroupHeaderVersion *string `json:"groupHeaderVersion,omitempty"` - TransactionSetControlNumberLowerBound *int32 `json:"transactionSetControlNumberLowerBound,omitempty"` - TransactionSetControlNumberUpperBound *int32 `json:"transactionSetControlNumberUpperBound,omitempty"` - RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` - TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` - TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` - OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` - GroupHeaderDateFormat X12DateFormat `json:"groupHeaderDateFormat,omitempty"` - GroupHeaderTimeFormat X12TimeFormat `json:"groupHeaderTimeFormat,omitempty"` - UsageIndicator UsageIndicator `json:"usageIndicator,omitempty"` -} - -// X12FramingSettings is the X12 agreement framing settings. -type X12FramingSettings struct { - DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` - ComponentSeparator *int32 `json:"componentSeparator,omitempty"` - ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` - ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` - SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` - CharacterSet X12CharacterSet `json:"characterSet,omitempty"` - SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` -} - -// X12MessageFilter is the X12 message filter for odata query. -type X12MessageFilter struct { - MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` -} - -// X12MessageIdentifier is the X12 message identifier. -type X12MessageIdentifier struct { - MessageID *string `json:"messageId,omitempty"` -} - -// X12OneWayAgreement is the X12 oneway agreement. -type X12OneWayAgreement struct { - SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` - ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` - ProtocolSettings *X12ProtocolSettings `json:"protocolSettings,omitempty"` -} - -// X12ProcessingSettings is the X12 processing settings. -type X12ProcessingSettings struct { - MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` - ConvertImpliedDecimal *bool `json:"convertImpliedDecimal,omitempty"` - PreserveInterchange *bool `json:"preserveInterchange,omitempty"` - SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` - CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` - UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` -} - -// X12ProtocolSettings is the X12 agreement protocol settings. -type X12ProtocolSettings struct { - ValidationSettings *X12ValidationSettings `json:"validationSettings,omitempty"` - FramingSettings *X12FramingSettings `json:"framingSettings,omitempty"` - EnvelopeSettings *X12EnvelopeSettings `json:"envelopeSettings,omitempty"` - AcknowledgementSettings *X12AcknowledgementSettings `json:"acknowledgementSettings,omitempty"` - MessageFilter *X12MessageFilter `json:"messageFilter,omitempty"` - SecuritySettings *X12SecuritySettings `json:"securitySettings,omitempty"` - ProcessingSettings *X12ProcessingSettings `json:"processingSettings,omitempty"` - EnvelopeOverrides *[]X12EnvelopeOverride `json:"envelopeOverrides,omitempty"` - ValidationOverrides *[]X12ValidationOverride `json:"validationOverrides,omitempty"` - MessageFilterList *[]X12MessageIdentifier `json:"messageFilterList,omitempty"` - SchemaReferences *[]X12SchemaReference `json:"schemaReferences,omitempty"` - X12DelimiterOverrides *[]X12DelimiterOverrides `json:"x12DelimiterOverrides,omitempty"` -} - -// X12SchemaReference is the X12 schema reference. -type X12SchemaReference struct { - MessageID *string `json:"messageId,omitempty"` - SenderApplicationID *string `json:"senderApplicationId,omitempty"` - SchemaVersion *string `json:"schemaVersion,omitempty"` - SchemaName *string `json:"schemaName,omitempty"` -} - -// X12SecuritySettings is the X12 agreement security settings. -type X12SecuritySettings struct { - AuthorizationQualifier *string `json:"authorizationQualifier,omitempty"` - AuthorizationValue *string `json:"authorizationValue,omitempty"` - SecurityQualifier *string `json:"securityQualifier,omitempty"` - PasswordValue *string `json:"passwordValue,omitempty"` -} - -// X12ValidationOverride is the X12 validation override settings. -type X12ValidationOverride struct { - MessageID *string `json:"messageId,omitempty"` - ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` - ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` -} - -// X12ValidationSettings is the X12 agreement validation settings. -type X12ValidationSettings struct { - ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` - CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` - InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` - CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` - CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` - ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` - ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` - AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` - TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` - TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AgreementType enumerates the values for agreement type. +type AgreementType string + +const ( + // AS2 specifies the as2 state for agreement type. + AS2 AgreementType = "AS2" + // Edifact specifies the edifact state for agreement type. + Edifact AgreementType = "Edifact" + // NotSpecified specifies the not specified state for agreement type. + NotSpecified AgreementType = "NotSpecified" + // X12 specifies the x12 state for agreement type. + X12 AgreementType = "X12" +) + +// DayOfWeek enumerates the values for day of week. +type DayOfWeek string + +const ( + // Friday specifies the friday state for day of week. + Friday DayOfWeek = "Friday" + // Monday specifies the monday state for day of week. + Monday DayOfWeek = "Monday" + // Saturday specifies the saturday state for day of week. + Saturday DayOfWeek = "Saturday" + // Sunday specifies the sunday state for day of week. + Sunday DayOfWeek = "Sunday" + // Thursday specifies the thursday state for day of week. + Thursday DayOfWeek = "Thursday" + // Tuesday specifies the tuesday state for day of week. + Tuesday DayOfWeek = "Tuesday" + // Wednesday specifies the wednesday state for day of week. + Wednesday DayOfWeek = "Wednesday" +) + +// DaysOfWeek enumerates the values for days of week. +type DaysOfWeek string + +const ( + // DaysOfWeekFriday specifies the days of week friday state for days of + // week. + DaysOfWeekFriday DaysOfWeek = "Friday" + // DaysOfWeekMonday specifies the days of week monday state for days of + // week. + DaysOfWeekMonday DaysOfWeek = "Monday" + // DaysOfWeekSaturday specifies the days of week saturday state for days of + // week. + DaysOfWeekSaturday DaysOfWeek = "Saturday" + // DaysOfWeekSunday specifies the days of week sunday state for days of + // week. + DaysOfWeekSunday DaysOfWeek = "Sunday" + // DaysOfWeekThursday specifies the days of week thursday state for days of + // week. + DaysOfWeekThursday DaysOfWeek = "Thursday" + // DaysOfWeekTuesday specifies the days of week tuesday state for days of + // week. + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + // DaysOfWeekWednesday specifies the days of week wednesday state for days + // of week. + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +// EdifactCharacterSet enumerates the values for edifact character set. +type EdifactCharacterSet string + +const ( + // EdifactCharacterSetKECA specifies the edifact character set keca state + // for edifact character set. + EdifactCharacterSetKECA EdifactCharacterSet = "KECA" + // EdifactCharacterSetNotSpecified specifies the edifact character set not + // specified state for edifact character set. + EdifactCharacterSetNotSpecified EdifactCharacterSet = "NotSpecified" + // EdifactCharacterSetUNOA specifies the edifact character set unoa state + // for edifact character set. + EdifactCharacterSetUNOA EdifactCharacterSet = "UNOA" + // EdifactCharacterSetUNOB specifies the edifact character set unob state + // for edifact character set. + EdifactCharacterSetUNOB EdifactCharacterSet = "UNOB" + // EdifactCharacterSetUNOC specifies the edifact character set unoc state + // for edifact character set. + EdifactCharacterSetUNOC EdifactCharacterSet = "UNOC" + // EdifactCharacterSetUNOD specifies the edifact character set unod state + // for edifact character set. + EdifactCharacterSetUNOD EdifactCharacterSet = "UNOD" + // EdifactCharacterSetUNOE specifies the edifact character set unoe state + // for edifact character set. + EdifactCharacterSetUNOE EdifactCharacterSet = "UNOE" + // EdifactCharacterSetUNOF specifies the edifact character set unof state + // for edifact character set. + EdifactCharacterSetUNOF EdifactCharacterSet = "UNOF" + // EdifactCharacterSetUNOG specifies the edifact character set unog state + // for edifact character set. + EdifactCharacterSetUNOG EdifactCharacterSet = "UNOG" + // EdifactCharacterSetUNOH specifies the edifact character set unoh state + // for edifact character set. + EdifactCharacterSetUNOH EdifactCharacterSet = "UNOH" + // EdifactCharacterSetUNOI specifies the edifact character set unoi state + // for edifact character set. + EdifactCharacterSetUNOI EdifactCharacterSet = "UNOI" + // EdifactCharacterSetUNOJ specifies the edifact character set unoj state + // for edifact character set. + EdifactCharacterSetUNOJ EdifactCharacterSet = "UNOJ" + // EdifactCharacterSetUNOK specifies the edifact character set unok state + // for edifact character set. + EdifactCharacterSetUNOK EdifactCharacterSet = "UNOK" + // EdifactCharacterSetUNOX specifies the edifact character set unox state + // for edifact character set. + EdifactCharacterSetUNOX EdifactCharacterSet = "UNOX" + // EdifactCharacterSetUNOY specifies the edifact character set unoy state + // for edifact character set. + EdifactCharacterSetUNOY EdifactCharacterSet = "UNOY" +) + +// EdifactDecimalIndicator enumerates the values for edifact decimal indicator. +type EdifactDecimalIndicator string + +const ( + // EdifactDecimalIndicatorComma specifies the edifact decimal indicator + // comma state for edifact decimal indicator. + EdifactDecimalIndicatorComma EdifactDecimalIndicator = "Comma" + // EdifactDecimalIndicatorDecimal specifies the edifact decimal indicator + // decimal state for edifact decimal indicator. + EdifactDecimalIndicatorDecimal EdifactDecimalIndicator = "Decimal" + // EdifactDecimalIndicatorNotSpecified specifies the edifact decimal + // indicator not specified state for edifact decimal indicator. + EdifactDecimalIndicatorNotSpecified EdifactDecimalIndicator = "NotSpecified" +) + +// EncryptionAlgorithm enumerates the values for encryption algorithm. +type EncryptionAlgorithm string + +const ( + // EncryptionAlgorithmAES128 specifies the encryption algorithm aes128 + // state for encryption algorithm. + EncryptionAlgorithmAES128 EncryptionAlgorithm = "AES128" + // EncryptionAlgorithmAES192 specifies the encryption algorithm aes192 + // state for encryption algorithm. + EncryptionAlgorithmAES192 EncryptionAlgorithm = "AES192" + // EncryptionAlgorithmAES256 specifies the encryption algorithm aes256 + // state for encryption algorithm. + EncryptionAlgorithmAES256 EncryptionAlgorithm = "AES256" + // EncryptionAlgorithmDES3 specifies the encryption algorithm des3 state + // for encryption algorithm. + EncryptionAlgorithmDES3 EncryptionAlgorithm = "DES3" + // EncryptionAlgorithmNone specifies the encryption algorithm none state + // for encryption algorithm. + EncryptionAlgorithmNone EncryptionAlgorithm = "None" + // EncryptionAlgorithmNotSpecified specifies the encryption algorithm not + // specified state for encryption algorithm. + EncryptionAlgorithmNotSpecified EncryptionAlgorithm = "NotSpecified" + // EncryptionAlgorithmRC2 specifies the encryption algorithm rc2 state for + // encryption algorithm. + EncryptionAlgorithmRC2 EncryptionAlgorithm = "RC2" +) + +// HashingAlgorithm enumerates the values for hashing algorithm. +type HashingAlgorithm string + +const ( + // HashingAlgorithmMD5 specifies the hashing algorithm md5 state for + // hashing algorithm. + HashingAlgorithmMD5 HashingAlgorithm = "MD5" + // HashingAlgorithmNone specifies the hashing algorithm none state for + // hashing algorithm. + HashingAlgorithmNone HashingAlgorithm = "None" + // HashingAlgorithmNotSpecified specifies the hashing algorithm not + // specified state for hashing algorithm. + HashingAlgorithmNotSpecified HashingAlgorithm = "NotSpecified" + // HashingAlgorithmSHA1 specifies the hashing algorithm sha1 state for + // hashing algorithm. + HashingAlgorithmSHA1 HashingAlgorithm = "SHA1" + // HashingAlgorithmSHA2256 specifies the hashing algorithm sha2256 state + // for hashing algorithm. + HashingAlgorithmSHA2256 HashingAlgorithm = "SHA2256" + // HashingAlgorithmSHA2384 specifies the hashing algorithm sha2384 state + // for hashing algorithm. + HashingAlgorithmSHA2384 HashingAlgorithm = "SHA2384" + // HashingAlgorithmSHA2512 specifies the hashing algorithm sha2512 state + // for hashing algorithm. + HashingAlgorithmSHA2512 HashingAlgorithm = "SHA2512" +) + +// IntegrationAccountSkuName enumerates the values for integration account sku +// name. +type IntegrationAccountSkuName string + +const ( + // IntegrationAccountSkuNameFree specifies the integration account sku name + // free state for integration account sku name. + IntegrationAccountSkuNameFree IntegrationAccountSkuName = "Free" + // IntegrationAccountSkuNameNotSpecified specifies the integration account + // sku name not specified state for integration account sku name. + IntegrationAccountSkuNameNotSpecified IntegrationAccountSkuName = "NotSpecified" + // IntegrationAccountSkuNameStandard specifies the integration account sku + // name standard state for integration account sku name. + IntegrationAccountSkuNameStandard IntegrationAccountSkuName = "Standard" +) + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // KeyTypeNotSpecified specifies the key type not specified state for key + // type. + KeyTypeNotSpecified KeyType = "NotSpecified" + // KeyTypePrimary specifies the key type primary state for key type. + KeyTypePrimary KeyType = "Primary" + // KeyTypeSecondary specifies the key type secondary state for key type. + KeyTypeSecondary KeyType = "Secondary" +) + +// MapType enumerates the values for map type. +type MapType string + +const ( + // MapTypeNotSpecified specifies the map type not specified state for map + // type. + MapTypeNotSpecified MapType = "NotSpecified" + // MapTypeXslt specifies the map type xslt state for map type. + MapTypeXslt MapType = "Xslt" +) + +// MessageFilterType enumerates the values for message filter type. +type MessageFilterType string + +const ( + // MessageFilterTypeExclude specifies the message filter type exclude state + // for message filter type. + MessageFilterTypeExclude MessageFilterType = "Exclude" + // MessageFilterTypeInclude specifies the message filter type include state + // for message filter type. + MessageFilterTypeInclude MessageFilterType = "Include" + // MessageFilterTypeNotSpecified specifies the message filter type not + // specified state for message filter type. + MessageFilterTypeNotSpecified MessageFilterType = "NotSpecified" +) + +// ParameterType enumerates the values for parameter type. +type ParameterType string + +const ( + // ParameterTypeArray specifies the parameter type array state for + // parameter type. + ParameterTypeArray ParameterType = "Array" + // ParameterTypeBool specifies the parameter type bool state for parameter + // type. + ParameterTypeBool ParameterType = "Bool" + // ParameterTypeFloat specifies the parameter type float state for + // parameter type. + ParameterTypeFloat ParameterType = "Float" + // ParameterTypeInt specifies the parameter type int state for parameter + // type. + ParameterTypeInt ParameterType = "Int" + // ParameterTypeNotSpecified specifies the parameter type not specified + // state for parameter type. + ParameterTypeNotSpecified ParameterType = "NotSpecified" + // ParameterTypeObject specifies the parameter type object state for + // parameter type. + ParameterTypeObject ParameterType = "Object" + // ParameterTypeSecureObject specifies the parameter type secure object + // state for parameter type. + ParameterTypeSecureObject ParameterType = "SecureObject" + // ParameterTypeSecureString specifies the parameter type secure string + // state for parameter type. + ParameterTypeSecureString ParameterType = "SecureString" + // ParameterTypeString specifies the parameter type string state for + // parameter type. + ParameterTypeString ParameterType = "String" +) + +// PartnerType enumerates the values for partner type. +type PartnerType string + +const ( + // PartnerTypeB2B specifies the partner type b2b state for partner type. + PartnerTypeB2B PartnerType = "B2B" + // PartnerTypeNotSpecified specifies the partner type not specified state + // for partner type. + PartnerTypeNotSpecified PartnerType = "NotSpecified" +) + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // RecurrenceFrequencyDay specifies the recurrence frequency day state for + // recurrence frequency. + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + // RecurrenceFrequencyHour specifies the recurrence frequency hour state + // for recurrence frequency. + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + // RecurrenceFrequencyMinute specifies the recurrence frequency minute + // state for recurrence frequency. + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + // RecurrenceFrequencyMonth specifies the recurrence frequency month state + // for recurrence frequency. + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + // RecurrenceFrequencyNotSpecified specifies the recurrence frequency not + // specified state for recurrence frequency. + RecurrenceFrequencyNotSpecified RecurrenceFrequency = "NotSpecified" + // RecurrenceFrequencySecond specifies the recurrence frequency second + // state for recurrence frequency. + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + // RecurrenceFrequencyWeek specifies the recurrence frequency week state + // for recurrence frequency. + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + // RecurrenceFrequencyYear specifies the recurrence frequency year state + // for recurrence frequency. + RecurrenceFrequencyYear RecurrenceFrequency = "Year" +) + +// SchemaType enumerates the values for schema type. +type SchemaType string + +const ( + // SchemaTypeNotSpecified specifies the schema type not specified state for + // schema type. + SchemaTypeNotSpecified SchemaType = "NotSpecified" + // SchemaTypeXML specifies the schema type xml state for schema type. + SchemaTypeXML SchemaType = "Xml" +) + +// SegmentTerminatorSuffix enumerates the values for segment terminator suffix. +type SegmentTerminatorSuffix string + +const ( + // SegmentTerminatorSuffixCR specifies the segment terminator suffix cr + // state for segment terminator suffix. + SegmentTerminatorSuffixCR SegmentTerminatorSuffix = "CR" + // SegmentTerminatorSuffixCRLF specifies the segment terminator suffix crlf + // state for segment terminator suffix. + SegmentTerminatorSuffixCRLF SegmentTerminatorSuffix = "CRLF" + // SegmentTerminatorSuffixLF specifies the segment terminator suffix lf + // state for segment terminator suffix. + SegmentTerminatorSuffixLF SegmentTerminatorSuffix = "LF" + // SegmentTerminatorSuffixNone specifies the segment terminator suffix none + // state for segment terminator suffix. + SegmentTerminatorSuffixNone SegmentTerminatorSuffix = "None" + // SegmentTerminatorSuffixNotSpecified specifies the segment terminator + // suffix not specified state for segment terminator suffix. + SegmentTerminatorSuffixNotSpecified SegmentTerminatorSuffix = "NotSpecified" +) + +// SigningAlgorithm enumerates the values for signing algorithm. +type SigningAlgorithm string + +const ( + // SigningAlgorithmDefault specifies the signing algorithm default state + // for signing algorithm. + SigningAlgorithmDefault SigningAlgorithm = "Default" + // SigningAlgorithmNotSpecified specifies the signing algorithm not + // specified state for signing algorithm. + SigningAlgorithmNotSpecified SigningAlgorithm = "NotSpecified" + // SigningAlgorithmSHA1 specifies the signing algorithm sha1 state for + // signing algorithm. + SigningAlgorithmSHA1 SigningAlgorithm = "SHA1" + // SigningAlgorithmSHA2256 specifies the signing algorithm sha2256 state + // for signing algorithm. + SigningAlgorithmSHA2256 SigningAlgorithm = "SHA2256" + // SigningAlgorithmSHA2384 specifies the signing algorithm sha2384 state + // for signing algorithm. + SigningAlgorithmSHA2384 SigningAlgorithm = "SHA2384" + // SigningAlgorithmSHA2512 specifies the signing algorithm sha2512 state + // for signing algorithm. + SigningAlgorithmSHA2512 SigningAlgorithm = "SHA2512" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameBasic specifies the sku name basic state for sku name. + SkuNameBasic SkuName = "Basic" + // SkuNameFree specifies the sku name free state for sku name. + SkuNameFree SkuName = "Free" + // SkuNameNotSpecified specifies the sku name not specified state for sku + // name. + SkuNameNotSpecified SkuName = "NotSpecified" + // SkuNamePremium specifies the sku name premium state for sku name. + SkuNamePremium SkuName = "Premium" + // SkuNameShared specifies the sku name shared state for sku name. + SkuNameShared SkuName = "Shared" + // SkuNameStandard specifies the sku name standard state for sku name. + SkuNameStandard SkuName = "Standard" +) + +// TrailingSeparatorPolicy enumerates the values for trailing separator policy. +type TrailingSeparatorPolicy string + +const ( + // TrailingSeparatorPolicyMandatory specifies the trailing separator policy + // mandatory state for trailing separator policy. + TrailingSeparatorPolicyMandatory TrailingSeparatorPolicy = "Mandatory" + // TrailingSeparatorPolicyNotAllowed specifies the trailing separator + // policy not allowed state for trailing separator policy. + TrailingSeparatorPolicyNotAllowed TrailingSeparatorPolicy = "NotAllowed" + // TrailingSeparatorPolicyNotSpecified specifies the trailing separator + // policy not specified state for trailing separator policy. + TrailingSeparatorPolicyNotSpecified TrailingSeparatorPolicy = "NotSpecified" + // TrailingSeparatorPolicyOptional specifies the trailing separator policy + // optional state for trailing separator policy. + TrailingSeparatorPolicyOptional TrailingSeparatorPolicy = "Optional" +) + +// UsageIndicator enumerates the values for usage indicator. +type UsageIndicator string + +const ( + // UsageIndicatorInformation specifies the usage indicator information + // state for usage indicator. + UsageIndicatorInformation UsageIndicator = "Information" + // UsageIndicatorNotSpecified specifies the usage indicator not specified + // state for usage indicator. + UsageIndicatorNotSpecified UsageIndicator = "NotSpecified" + // UsageIndicatorProduction specifies the usage indicator production state + // for usage indicator. + UsageIndicatorProduction UsageIndicator = "Production" + // UsageIndicatorTest specifies the usage indicator test state for usage + // indicator. + UsageIndicatorTest UsageIndicator = "Test" +) + +// WorkflowProvisioningState enumerates the values for workflow provisioning +// state. +type WorkflowProvisioningState string + +const ( + // WorkflowProvisioningStateAccepted specifies the workflow provisioning + // state accepted state for workflow provisioning state. + WorkflowProvisioningStateAccepted WorkflowProvisioningState = "Accepted" + // WorkflowProvisioningStateCanceled specifies the workflow provisioning + // state canceled state for workflow provisioning state. + WorkflowProvisioningStateCanceled WorkflowProvisioningState = "Canceled" + // WorkflowProvisioningStateCompleted specifies the workflow provisioning + // state completed state for workflow provisioning state. + WorkflowProvisioningStateCompleted WorkflowProvisioningState = "Completed" + // WorkflowProvisioningStateCreated specifies the workflow provisioning + // state created state for workflow provisioning state. + WorkflowProvisioningStateCreated WorkflowProvisioningState = "Created" + // WorkflowProvisioningStateCreating specifies the workflow provisioning + // state creating state for workflow provisioning state. + WorkflowProvisioningStateCreating WorkflowProvisioningState = "Creating" + // WorkflowProvisioningStateDeleted specifies the workflow provisioning + // state deleted state for workflow provisioning state. + WorkflowProvisioningStateDeleted WorkflowProvisioningState = "Deleted" + // WorkflowProvisioningStateDeleting specifies the workflow provisioning + // state deleting state for workflow provisioning state. + WorkflowProvisioningStateDeleting WorkflowProvisioningState = "Deleting" + // WorkflowProvisioningStateFailed specifies the workflow provisioning + // state failed state for workflow provisioning state. + WorkflowProvisioningStateFailed WorkflowProvisioningState = "Failed" + // WorkflowProvisioningStateMoving specifies the workflow provisioning + // state moving state for workflow provisioning state. + WorkflowProvisioningStateMoving WorkflowProvisioningState = "Moving" + // WorkflowProvisioningStateNotSpecified specifies the workflow + // provisioning state not specified state for workflow provisioning state. + WorkflowProvisioningStateNotSpecified WorkflowProvisioningState = "NotSpecified" + // WorkflowProvisioningStateReady specifies the workflow provisioning state + // ready state for workflow provisioning state. + WorkflowProvisioningStateReady WorkflowProvisioningState = "Ready" + // WorkflowProvisioningStateRegistered specifies the workflow provisioning + // state registered state for workflow provisioning state. + WorkflowProvisioningStateRegistered WorkflowProvisioningState = "Registered" + // WorkflowProvisioningStateRegistering specifies the workflow provisioning + // state registering state for workflow provisioning state. + WorkflowProvisioningStateRegistering WorkflowProvisioningState = "Registering" + // WorkflowProvisioningStateRunning specifies the workflow provisioning + // state running state for workflow provisioning state. + WorkflowProvisioningStateRunning WorkflowProvisioningState = "Running" + // WorkflowProvisioningStateSucceeded specifies the workflow provisioning + // state succeeded state for workflow provisioning state. + WorkflowProvisioningStateSucceeded WorkflowProvisioningState = "Succeeded" + // WorkflowProvisioningStateUnregistered specifies the workflow + // provisioning state unregistered state for workflow provisioning state. + WorkflowProvisioningStateUnregistered WorkflowProvisioningState = "Unregistered" + // WorkflowProvisioningStateUnregistering specifies the workflow + // provisioning state unregistering state for workflow provisioning state. + WorkflowProvisioningStateUnregistering WorkflowProvisioningState = "Unregistering" + // WorkflowProvisioningStateUpdating specifies the workflow provisioning + // state updating state for workflow provisioning state. + WorkflowProvisioningStateUpdating WorkflowProvisioningState = "Updating" +) + +// WorkflowState enumerates the values for workflow state. +type WorkflowState string + +const ( + // WorkflowStateCompleted specifies the workflow state completed state for + // workflow state. + WorkflowStateCompleted WorkflowState = "Completed" + // WorkflowStateDeleted specifies the workflow state deleted state for + // workflow state. + WorkflowStateDeleted WorkflowState = "Deleted" + // WorkflowStateDisabled specifies the workflow state disabled state for + // workflow state. + WorkflowStateDisabled WorkflowState = "Disabled" + // WorkflowStateEnabled specifies the workflow state enabled state for + // workflow state. + WorkflowStateEnabled WorkflowState = "Enabled" + // WorkflowStateNotSpecified specifies the workflow state not specified + // state for workflow state. + WorkflowStateNotSpecified WorkflowState = "NotSpecified" + // WorkflowStateSuspended specifies the workflow state suspended state for + // workflow state. + WorkflowStateSuspended WorkflowState = "Suspended" +) + +// WorkflowStatus enumerates the values for workflow status. +type WorkflowStatus string + +const ( + // WorkflowStatusAborted specifies the workflow status aborted state for + // workflow status. + WorkflowStatusAborted WorkflowStatus = "Aborted" + // WorkflowStatusCancelled specifies the workflow status cancelled state + // for workflow status. + WorkflowStatusCancelled WorkflowStatus = "Cancelled" + // WorkflowStatusFailed specifies the workflow status failed state for + // workflow status. + WorkflowStatusFailed WorkflowStatus = "Failed" + // WorkflowStatusFaulted specifies the workflow status faulted state for + // workflow status. + WorkflowStatusFaulted WorkflowStatus = "Faulted" + // WorkflowStatusIgnored specifies the workflow status ignored state for + // workflow status. + WorkflowStatusIgnored WorkflowStatus = "Ignored" + // WorkflowStatusNotSpecified specifies the workflow status not specified + // state for workflow status. + WorkflowStatusNotSpecified WorkflowStatus = "NotSpecified" + // WorkflowStatusPaused specifies the workflow status paused state for + // workflow status. + WorkflowStatusPaused WorkflowStatus = "Paused" + // WorkflowStatusRunning specifies the workflow status running state for + // workflow status. + WorkflowStatusRunning WorkflowStatus = "Running" + // WorkflowStatusSkipped specifies the workflow status skipped state for + // workflow status. + WorkflowStatusSkipped WorkflowStatus = "Skipped" + // WorkflowStatusSucceeded specifies the workflow status succeeded state + // for workflow status. + WorkflowStatusSucceeded WorkflowStatus = "Succeeded" + // WorkflowStatusSuspended specifies the workflow status suspended state + // for workflow status. + WorkflowStatusSuspended WorkflowStatus = "Suspended" + // WorkflowStatusTimedOut specifies the workflow status timed out state for + // workflow status. + WorkflowStatusTimedOut WorkflowStatus = "TimedOut" + // WorkflowStatusWaiting specifies the workflow status waiting state for + // workflow status. + WorkflowStatusWaiting WorkflowStatus = "Waiting" +) + +// WorkflowTriggerProvisioningState enumerates the values for workflow trigger +// provisioning state. +type WorkflowTriggerProvisioningState string + +const ( + // WorkflowTriggerProvisioningStateAccepted specifies the workflow trigger + // provisioning state accepted state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateAccepted WorkflowTriggerProvisioningState = "Accepted" + // WorkflowTriggerProvisioningStateCanceled specifies the workflow trigger + // provisioning state canceled state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateCanceled WorkflowTriggerProvisioningState = "Canceled" + // WorkflowTriggerProvisioningStateCompleted specifies the workflow trigger + // provisioning state completed state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateCompleted WorkflowTriggerProvisioningState = "Completed" + // WorkflowTriggerProvisioningStateCreated specifies the workflow trigger + // provisioning state created state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateCreated WorkflowTriggerProvisioningState = "Created" + // WorkflowTriggerProvisioningStateCreating specifies the workflow trigger + // provisioning state creating state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateCreating WorkflowTriggerProvisioningState = "Creating" + // WorkflowTriggerProvisioningStateDeleted specifies the workflow trigger + // provisioning state deleted state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateDeleted WorkflowTriggerProvisioningState = "Deleted" + // WorkflowTriggerProvisioningStateDeleting specifies the workflow trigger + // provisioning state deleting state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateDeleting WorkflowTriggerProvisioningState = "Deleting" + // WorkflowTriggerProvisioningStateFailed specifies the workflow trigger + // provisioning state failed state for workflow trigger provisioning state. + WorkflowTriggerProvisioningStateFailed WorkflowTriggerProvisioningState = "Failed" + // WorkflowTriggerProvisioningStateMoving specifies the workflow trigger + // provisioning state moving state for workflow trigger provisioning state. + WorkflowTriggerProvisioningStateMoving WorkflowTriggerProvisioningState = "Moving" + // WorkflowTriggerProvisioningStateNotSpecified specifies the workflow + // trigger provisioning state not specified state for workflow trigger + // provisioning state. + WorkflowTriggerProvisioningStateNotSpecified WorkflowTriggerProvisioningState = "NotSpecified" + // WorkflowTriggerProvisioningStateReady specifies the workflow trigger + // provisioning state ready state for workflow trigger provisioning state. + WorkflowTriggerProvisioningStateReady WorkflowTriggerProvisioningState = "Ready" + // WorkflowTriggerProvisioningStateRegistered specifies the workflow + // trigger provisioning state registered state for workflow trigger + // provisioning state. + WorkflowTriggerProvisioningStateRegistered WorkflowTriggerProvisioningState = "Registered" + // WorkflowTriggerProvisioningStateRegistering specifies the workflow + // trigger provisioning state registering state for workflow trigger + // provisioning state. + WorkflowTriggerProvisioningStateRegistering WorkflowTriggerProvisioningState = "Registering" + // WorkflowTriggerProvisioningStateRunning specifies the workflow trigger + // provisioning state running state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateRunning WorkflowTriggerProvisioningState = "Running" + // WorkflowTriggerProvisioningStateSucceeded specifies the workflow trigger + // provisioning state succeeded state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateSucceeded WorkflowTriggerProvisioningState = "Succeeded" + // WorkflowTriggerProvisioningStateUnregistered specifies the workflow + // trigger provisioning state unregistered state for workflow trigger + // provisioning state. + WorkflowTriggerProvisioningStateUnregistered WorkflowTriggerProvisioningState = "Unregistered" + // WorkflowTriggerProvisioningStateUnregistering specifies the workflow + // trigger provisioning state unregistering state for workflow trigger + // provisioning state. + WorkflowTriggerProvisioningStateUnregistering WorkflowTriggerProvisioningState = "Unregistering" + // WorkflowTriggerProvisioningStateUpdating specifies the workflow trigger + // provisioning state updating state for workflow trigger provisioning + // state. + WorkflowTriggerProvisioningStateUpdating WorkflowTriggerProvisioningState = "Updating" +) + +// X12CharacterSet enumerates the values for x12 character set. +type X12CharacterSet string + +const ( + // X12CharacterSetBasic specifies the x12 character set basic state for x12 + // character set. + X12CharacterSetBasic X12CharacterSet = "Basic" + // X12CharacterSetExtended specifies the x12 character set extended state + // for x12 character set. + X12CharacterSetExtended X12CharacterSet = "Extended" + // X12CharacterSetNotSpecified specifies the x12 character set not + // specified state for x12 character set. + X12CharacterSetNotSpecified X12CharacterSet = "NotSpecified" + // X12CharacterSetUTF8 specifies the x12 character set utf8 state for x12 + // character set. + X12CharacterSetUTF8 X12CharacterSet = "UTF8" +) + +// X12DateFormat enumerates the values for x12 date format. +type X12DateFormat string + +const ( + // X12DateFormatCCYYMMDD specifies the x12 date format ccyymmdd state for + // x12 date format. + X12DateFormatCCYYMMDD X12DateFormat = "CCYYMMDD" + // X12DateFormatNotSpecified specifies the x12 date format not specified + // state for x12 date format. + X12DateFormatNotSpecified X12DateFormat = "NotSpecified" + // X12DateFormatYYMMDD specifies the x12 date format yymmdd state for x12 + // date format. + X12DateFormatYYMMDD X12DateFormat = "YYMMDD" +) + +// X12TimeFormat enumerates the values for x12 time format. +type X12TimeFormat string + +const ( + // X12TimeFormatHHMM specifies the x12 time format hhmm state for x12 time + // format. + X12TimeFormatHHMM X12TimeFormat = "HHMM" + // X12TimeFormatHHMMSS specifies the x12 time format hhmmss state for x12 + // time format. + X12TimeFormatHHMMSS X12TimeFormat = "HHMMSS" + // X12TimeFormatHHMMSSd specifies the x12 time format hhmms sd state for + // x12 time format. + X12TimeFormatHHMMSSd X12TimeFormat = "HHMMSSd" + // X12TimeFormatHHMMSSdd specifies the x12 time format hhmms sdd state for + // x12 time format. + X12TimeFormatHHMMSSdd X12TimeFormat = "HHMMSSdd" + // X12TimeFormatNotSpecified specifies the x12 time format not specified + // state for x12 time format. + X12TimeFormatNotSpecified X12TimeFormat = "NotSpecified" +) + +// AgreementContent is the integration account agreement content. +type AgreementContent struct { + AS2 *AS2AgreementContent `json:"aS2,omitempty"` + X12 *X12AgreementContent `json:"x12,omitempty"` + Edifact *EdifactAgreementContent `json:"edifact,omitempty"` +} + +// AS2AcknowledgementConnectionSettings is the AS2 agreement acknowledegment +// connection settings. +type AS2AcknowledgementConnectionSettings struct { + IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` + SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` + KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` + UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` +} + +// AS2AgreementContent is the integration account AS2 agreement content. +type AS2AgreementContent struct { + ReceiveAgreement *AS2OneWayAgreement `json:"receiveAgreement,omitempty"` + SendAgreement *AS2OneWayAgreement `json:"sendAgreement,omitempty"` +} + +// AS2EnvelopeSettings is the AS2 agreement envelope settings. +type AS2EnvelopeSettings struct { + MessageContentType *string `json:"messageContentType,omitempty"` + TransmitFileNameInMimeHeader *bool `json:"transmitFileNameInMimeHeader,omitempty"` + FileNameTemplate *string `json:"fileNameTemplate,omitempty"` + SuspendMessageOnFileNameGenerationError *bool `json:"suspendMessageOnFileNameGenerationError,omitempty"` + AutogenerateFileName *bool `json:"autogenerateFileName,omitempty"` +} + +// AS2ErrorSettings is the AS2 agreement error settings. +type AS2ErrorSettings struct { + SuspendDuplicateMessage *bool `json:"suspendDuplicateMessage,omitempty"` + ResendIfMdnNotReceived *bool `json:"resendIfMdnNotReceived,omitempty"` +} + +// AS2MdnSettings is the AS2 agreement mdn settings. +type AS2MdnSettings struct { + NeedMdn *bool `json:"needMdn,omitempty"` + SignMdn *bool `json:"signMdn,omitempty"` + SendMdnAsynchronously *bool `json:"sendMdnAsynchronously,omitempty"` + ReceiptDeliveryURL *string `json:"receiptDeliveryUrl,omitempty"` + DispositionNotificationTo *string `json:"dispositionNotificationTo,omitempty"` + SignOutboundMdnIfOptional *bool `json:"signOutboundMdnIfOptional,omitempty"` + MdnText *string `json:"mdnText,omitempty"` + SendInboundMdnToMessageBox *bool `json:"sendInboundMdnToMessageBox,omitempty"` + MicHashingAlgorithm HashingAlgorithm `json:"micHashingAlgorithm,omitempty"` +} + +// AS2MessageConnectionSettings is the AS2 agreement message connection +// settings. +type AS2MessageConnectionSettings struct { + IgnoreCertificateNameMismatch *bool `json:"ignoreCertificateNameMismatch,omitempty"` + SupportHTTPStatusCodeContinue *bool `json:"supportHttpStatusCodeContinue,omitempty"` + KeepHTTPConnectionAlive *bool `json:"keepHttpConnectionAlive,omitempty"` + UnfoldHTTPHeaders *bool `json:"unfoldHttpHeaders,omitempty"` +} + +// AS2OneWayAgreement is the integration account AS2 oneway agreement. +type AS2OneWayAgreement struct { + SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` + ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` + ProtocolSettings *AS2ProtocolSettings `json:"protocolSettings,omitempty"` +} + +// AS2ProtocolSettings is the AS2 agreement protocol settings. +type AS2ProtocolSettings struct { + MessageConnectionSettings *AS2MessageConnectionSettings `json:"messageConnectionSettings,omitempty"` + AcknowledgementConnectionSettings *AS2AcknowledgementConnectionSettings `json:"acknowledgementConnectionSettings,omitempty"` + MdnSettings *AS2MdnSettings `json:"mdnSettings,omitempty"` + SecuritySettings *AS2SecuritySettings `json:"securitySettings,omitempty"` + ValidationSettings *AS2ValidationSettings `json:"validationSettings,omitempty"` + EnvelopeSettings *AS2EnvelopeSettings `json:"envelopeSettings,omitempty"` + ErrorSettings *AS2ErrorSettings `json:"errorSettings,omitempty"` +} + +// AS2SecuritySettings is the AS2 agreement security settings. +type AS2SecuritySettings struct { + OverrideGroupSigningCertificate *bool `json:"overrideGroupSigningCertificate,omitempty"` + SigningCertificateName *string `json:"signingCertificateName,omitempty"` + EncryptionCertificateName *string `json:"encryptionCertificateName,omitempty"` + EnableNrrForInboundEncodedMessages *bool `json:"enableNrrForInboundEncodedMessages,omitempty"` + EnableNrrForInboundDecodedMessages *bool `json:"enableNrrForInboundDecodedMessages,omitempty"` + EnableNrrForOutboundMdn *bool `json:"enableNrrForOutboundMdn,omitempty"` + EnableNrrForOutboundEncodedMessages *bool `json:"enableNrrForOutboundEncodedMessages,omitempty"` + EnableNrrForOutboundDecodedMessages *bool `json:"enableNrrForOutboundDecodedMessages,omitempty"` + EnableNrrForInboundMdn *bool `json:"enableNrrForInboundMdn,omitempty"` + Sha2AlgorithmFormat *string `json:"sha2AlgorithmFormat,omitempty"` +} + +// AS2ValidationSettings is the AS2 agreement validation settings. +type AS2ValidationSettings struct { + OverrideMessageProperties *bool `json:"overrideMessageProperties,omitempty"` + EncryptMessage *bool `json:"encryptMessage,omitempty"` + SignMessage *bool `json:"signMessage,omitempty"` + CompressMessage *bool `json:"compressMessage,omitempty"` + CheckDuplicateMessage *bool `json:"checkDuplicateMessage,omitempty"` + InterchangeDuplicatesValidityDays *int32 `json:"interchangeDuplicatesValidityDays,omitempty"` + CheckCertificateRevocationListOnSend *bool `json:"checkCertificateRevocationListOnSend,omitempty"` + CheckCertificateRevocationListOnReceive *bool `json:"checkCertificateRevocationListOnReceive,omitempty"` + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` + SigningAlgorithm SigningAlgorithm `json:"signingAlgorithm,omitempty"` +} + +// B2BPartnerContent is the B2B partner content. +type B2BPartnerContent struct { + BusinessIdentities *[]BusinessIdentity `json:"businessIdentities,omitempty"` +} + +// BusinessIdentity is the integration account partner's business identity. +type BusinessIdentity struct { + Qualifier *string `json:"qualifier,omitempty"` + Value *string `json:"value,omitempty"` +} + +// CallbackURL is the callback url. +type CallbackURL struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// ContentHash is the content hash. +type ContentHash struct { + Algorithm *string `json:"algorithm,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ContentLink is the content link. +type ContentLink struct { + URI *string `json:"uri,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` + ContentSize *int64 `json:"contentSize,omitempty"` + ContentHash *ContentHash `json:"contentHash,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` +} + +// Correlation is the correlation property. +type Correlation struct { + ClientTrackingID *string `json:"clientTrackingId,omitempty"` +} + +// EdifactAcknowledgementSettings is the Edifact agreement acknowledgement +// settings. +type EdifactAcknowledgementSettings struct { + NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` + BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` + NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` + BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` + NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` + SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` + AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` + AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` + AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` + AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` + RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` +} + +// EdifactAgreementContent is the Edifact agreement content. +type EdifactAgreementContent struct { + ReceiveAgreement *EdifactOneWayAgreement `json:"receiveAgreement,omitempty"` + SendAgreement *EdifactOneWayAgreement `json:"sendAgreement,omitempty"` +} + +// EdifactDelimiterOverride is the Edifact delimiter override settings. +type EdifactDelimiterOverride struct { + MessageID *string `json:"messageId,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` + DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` + ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` + MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// EdifactEnvelopeOverride is the Edifact enevlope override settings. +type EdifactEnvelopeOverride struct { + MessageID *string `json:"messageId,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + MessageAssociationAssignedCode *string `json:"messageAssociationAssignedCode,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` + FunctionalGroupID *string `json:"functionalGroupId,omitempty"` + SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + ReceiverApplicationQualifier *string `json:"receiverApplicationQualifier,omitempty"` + ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` + ControllingAgencyCode *string `json:"controllingAgencyCode,omitempty"` + GroupHeaderMessageVersion *string `json:"groupHeaderMessageVersion,omitempty"` + GroupHeaderMessageRelease *string `json:"groupHeaderMessageRelease,omitempty"` + AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` + ApplicationPassword *string `json:"applicationPassword,omitempty"` +} + +// EdifactEnvelopeSettings is the Edifact agreement envelope settings. +type EdifactEnvelopeSettings struct { + GroupAssociationAssignedCode *string `json:"groupAssociationAssignedCode,omitempty"` + CommunicationAgreementID *string `json:"communicationAgreementId,omitempty"` + ApplyDelimiterStringAdvice *bool `json:"applyDelimiterStringAdvice,omitempty"` + CreateGroupingSegments *bool `json:"createGroupingSegments,omitempty"` + EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` + RecipientReferencePasswordValue *string `json:"recipientReferencePasswordValue,omitempty"` + RecipientReferencePasswordQualifier *string `json:"recipientReferencePasswordQualifier,omitempty"` + ApplicationReferenceID *string `json:"applicationReferenceId,omitempty"` + ProcessingPriorityCode *string `json:"processingPriorityCode,omitempty"` + InterchangeControlNumberLowerBound *int64 `json:"interchangeControlNumberLowerBound,omitempty"` + InterchangeControlNumberUpperBound *int64 `json:"interchangeControlNumberUpperBound,omitempty"` + RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` + InterchangeControlNumberPrefix *string `json:"interchangeControlNumberPrefix,omitempty"` + InterchangeControlNumberSuffix *string `json:"interchangeControlNumberSuffix,omitempty"` + SenderReverseRoutingAddress *string `json:"senderReverseRoutingAddress,omitempty"` + ReceiverReverseRoutingAddress *string `json:"receiverReverseRoutingAddress,omitempty"` + FunctionalGroupID *string `json:"functionalGroupId,omitempty"` + GroupControllingAgencyCode *string `json:"groupControllingAgencyCode,omitempty"` + GroupMessageVersion *string `json:"groupMessageVersion,omitempty"` + GroupMessageRelease *string `json:"groupMessageRelease,omitempty"` + GroupControlNumberLowerBound *int64 `json:"groupControlNumberLowerBound,omitempty"` + GroupControlNumberUpperBound *int64 `json:"groupControlNumberUpperBound,omitempty"` + RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` + GroupControlNumberPrefix *string `json:"groupControlNumberPrefix,omitempty"` + GroupControlNumberSuffix *string `json:"groupControlNumberSuffix,omitempty"` + GroupApplicationReceiverQualifier *string `json:"groupApplicationReceiverQualifier,omitempty"` + GroupApplicationReceiverID *string `json:"groupApplicationReceiverId,omitempty"` + GroupApplicationSenderQualifier *string `json:"groupApplicationSenderQualifier,omitempty"` + GroupApplicationSenderID *string `json:"groupApplicationSenderId,omitempty"` + GroupApplicationPassword *string `json:"groupApplicationPassword,omitempty"` + OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` + TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` + TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` + TransactionSetControlNumberLowerBound *int64 `json:"transactionSetControlNumberLowerBound,omitempty"` + TransactionSetControlNumberUpperBound *int64 `json:"transactionSetControlNumberUpperBound,omitempty"` + RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` + IsTestInterchange *bool `json:"isTestInterchange,omitempty"` + SenderInternalIdentification *string `json:"senderInternalIdentification,omitempty"` + SenderInternalSubIdentification *string `json:"senderInternalSubIdentification,omitempty"` + ReceiverInternalIdentification *string `json:"receiverInternalIdentification,omitempty"` + ReceiverInternalSubIdentification *string `json:"receiverInternalSubIdentification,omitempty"` +} + +// EdifactFramingSettings is the Edifact agreement framing settings. +type EdifactFramingSettings struct { + ServiceCodeListDirectoryVersion *string `json:"serviceCodeListDirectoryVersion,omitempty"` + CharacterEncoding *string `json:"characterEncoding,omitempty"` + ProtocolVersion *int32 `json:"protocolVersion,omitempty"` + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + ReleaseIndicator *int32 `json:"releaseIndicator,omitempty"` + RepetitionSeparator *int32 `json:"repetitionSeparator,omitempty"` + CharacterSet EdifactCharacterSet `json:"characterSet,omitempty"` + DecimalPointIndicator EdifactDecimalIndicator `json:"decimalPointIndicator,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` +} + +// EdifactMessageFilter is the Edifact message filter for odata query. +type EdifactMessageFilter struct { + MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` +} + +// EdifactMessageIdentifier is the Edifact message identifier. +type EdifactMessageIdentifier struct { + MessageID *string `json:"messageId,omitempty"` +} + +// EdifactOneWayAgreement is the Edifact one way agreement. +type EdifactOneWayAgreement struct { + SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` + ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` + ProtocolSettings *EdifactProtocolSettings `json:"protocolSettings,omitempty"` +} + +// EdifactProcessingSettings is the Edifact agreement protocol settings. +type EdifactProcessingSettings struct { + MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` + PreserveInterchange *bool `json:"preserveInterchange,omitempty"` + SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` + CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` + UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` +} + +// EdifactProtocolSettings is the Edifact agreement protocol settings. +type EdifactProtocolSettings struct { + ValidationSettings *EdifactValidationSettings `json:"validationSettings,omitempty"` + FramingSettings *EdifactFramingSettings `json:"framingSettings,omitempty"` + EnvelopeSettings *EdifactEnvelopeSettings `json:"envelopeSettings,omitempty"` + AcknowledgementSettings *EdifactAcknowledgementSettings `json:"acknowledgementSettings,omitempty"` + MessageFilter *EdifactMessageFilter `json:"messageFilter,omitempty"` + ProcessingSettings *EdifactProcessingSettings `json:"processingSettings,omitempty"` + EnvelopeOverrides *[]EdifactEnvelopeOverride `json:"envelopeOverrides,omitempty"` + MessageFilterList *[]EdifactMessageIdentifier `json:"messageFilterList,omitempty"` + SchemaReferences *[]EdifactSchemaReference `json:"schemaReferences,omitempty"` + ValidationOverrides *[]EdifactValidationOverride `json:"validationOverrides,omitempty"` + EdifactDelimiterOverrides *[]EdifactDelimiterOverride `json:"edifactDelimiterOverrides,omitempty"` +} + +// EdifactSchemaReference is the Edifact schema reference. +type EdifactSchemaReference struct { + MessageID *string `json:"messageId,omitempty"` + MessageVersion *string `json:"messageVersion,omitempty"` + MessageRelease *string `json:"messageRelease,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + SenderApplicationQualifier *string `json:"senderApplicationQualifier,omitempty"` + AssociationAssignedCode *string `json:"associationAssignedCode,omitempty"` + SchemaName *string `json:"schemaName,omitempty"` +} + +// EdifactValidationOverride is the Edifact validation override settings. +type EdifactValidationOverride struct { + MessageID *string `json:"messageId,omitempty"` + EnforceCharacterSet *bool `json:"enforceCharacterSet,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` +} + +// EdifactValidationSettings is the Edifact agreement validation settings. +type EdifactValidationSettings struct { + ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` + CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` + InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` + CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` + CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` +} + +// ErrorProperties is error properties indicate why the Logic service was not +// able to process the incoming request. The reason is provided in the error +// message. +type ErrorProperties struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ErrorResponse is error reponse indicates Logic service is not able to +// process the incoming request. The error property contains the error details. +type ErrorResponse struct { + Error *ErrorProperties `json:"error,omitempty"` +} + +// GenerateUpgradedDefinitionParameters is the parameters to generate upgraded +// definition. +type GenerateUpgradedDefinitionParameters struct { + TargetSchemaVersion *string `json:"targetSchemaVersion,omitempty"` +} + +// GetCallbackURLParameters is the callback url parameters. +type GetCallbackURLParameters struct { + NotAfter *date.Time `json:"notAfter,omitempty"` + KeyType KeyType `json:"keyType,omitempty"` +} + +// IntegrationAccount is the integration account. +type IntegrationAccount struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` + Sku *IntegrationAccountSku `json:"sku,omitempty"` +} + +// IntegrationAccountAgreement is the integration account agreement. +type IntegrationAccountAgreement struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountAgreementProperties `json:"properties,omitempty"` +} + +// IntegrationAccountAgreementFilter is the integration account agreement +// filter for odata query. +type IntegrationAccountAgreementFilter struct { + AgreementType AgreementType `json:"agreementType,omitempty"` +} + +// IntegrationAccountAgreementListResult is the list of integration account +// agreements. +type IntegrationAccountAgreementListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountAgreement `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountAgreementListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountAgreementListResult) IntegrationAccountAgreementListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountAgreementProperties is the integration account agreement +// properties. +type IntegrationAccountAgreementProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + AgreementType AgreementType `json:"agreementType,omitempty"` + HostPartner *string `json:"hostPartner,omitempty"` + GuestPartner *string `json:"guestPartner,omitempty"` + HostIdentity *BusinessIdentity `json:"hostIdentity,omitempty"` + GuestIdentity *BusinessIdentity `json:"guestIdentity,omitempty"` + Content *AgreementContent `json:"content,omitempty"` +} + +// IntegrationAccountCertificate is the integration account certificate. +type IntegrationAccountCertificate struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountCertificateProperties `json:"properties,omitempty"` +} + +// IntegrationAccountCertificateListResult is the list of integration account +// certificates. +type IntegrationAccountCertificateListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountCertificate `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountCertificateListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountCertificateListResult) IntegrationAccountCertificateListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountCertificateProperties is the integration account +// certificate properties. +type IntegrationAccountCertificateProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Key *KeyVaultKeyReference `json:"key,omitempty"` + PublicCertificate *string `json:"publicCertificate,omitempty"` +} + +// IntegrationAccountListResult is the list of integration accounts. +type IntegrationAccountListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccount `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountListResult) IntegrationAccountListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountMap is the integration account map. +type IntegrationAccountMap struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountMapProperties `json:"properties,omitempty"` +} + +// IntegrationAccountMapFilter is the integration account map filter for odata +// query. +type IntegrationAccountMapFilter struct { + MapType MapType `json:"mapType,omitempty"` +} + +// IntegrationAccountMapListResult is the list of integration account maps. +type IntegrationAccountMapListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountMap `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountMapListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountMapListResult) IntegrationAccountMapListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountMapProperties is the integration account map. +type IntegrationAccountMapProperties struct { + MapType MapType `json:"mapType,omitempty"` + ParametersSchema *IntegrationAccountMapPropertiesParametersSchema `json:"parametersSchema,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Content *string `json:"content,omitempty"` + ContentType *string `json:"contentType,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` +} + +// IntegrationAccountMapPropertiesParametersSchema is the parameters schema of +// integration account map. +type IntegrationAccountMapPropertiesParametersSchema struct { + Ref *string `json:"ref,omitempty"` +} + +// IntegrationAccountPartner is the integration account partner. +type IntegrationAccountPartner struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountPartnerProperties `json:"properties,omitempty"` +} + +// IntegrationAccountPartnerFilter is the integration account partner filter +// for odata query. +type IntegrationAccountPartnerFilter struct { + PartnerType PartnerType `json:"partnerType,omitempty"` +} + +// IntegrationAccountPartnerListResult is the list of integration account +// partners. +type IntegrationAccountPartnerListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountPartner `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountPartnerListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountPartnerListResult) IntegrationAccountPartnerListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountPartnerProperties is the integration account partner +// properties. +type IntegrationAccountPartnerProperties struct { + PartnerType PartnerType `json:"partnerType,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Content *PartnerContent `json:"content,omitempty"` +} + +// IntegrationAccountSchema is the integration account schema. +type IntegrationAccountSchema struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountSchemaProperties `json:"properties,omitempty"` +} + +// IntegrationAccountSchemaFilter is the integration account schema filter for +// odata query. +type IntegrationAccountSchemaFilter struct { + SchemaType SchemaType `json:"schemaType,omitempty"` +} + +// IntegrationAccountSchemaListResult is the list of integration account +// schemas. +type IntegrationAccountSchemaListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountSchema `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountSchemaListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountSchemaListResult) IntegrationAccountSchemaListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountSchemaProperties is the integration account schema +// properties. +type IntegrationAccountSchemaProperties struct { + SchemaType SchemaType `json:"schemaType,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` + DocumentName *string `json:"documentName,omitempty"` + FileName *string `json:"fileName,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Content *string `json:"content,omitempty"` + ContentType *string `json:"contentType,omitempty"` + ContentLink *ContentLink `json:"contentLink,omitempty"` +} + +// IntegrationAccountSession is the integration account session. +type IntegrationAccountSession struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IntegrationAccountSessionProperties `json:"properties,omitempty"` +} + +// IntegrationAccountSessionFilter is the integration account session filter. +type IntegrationAccountSessionFilter struct { + ChangedTime *date.Time `json:"changedTime,omitempty"` +} + +// IntegrationAccountSessionListResult is the list of integration account +// sessions. +type IntegrationAccountSessionListResult struct { + autorest.Response `json:"-"` + Value *[]IntegrationAccountSession `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IntegrationAccountSessionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IntegrationAccountSessionListResult) IntegrationAccountSessionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntegrationAccountSessionProperties is the integration account session +// properties. +type IntegrationAccountSessionProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + Content *map[string]interface{} `json:"content,omitempty"` +} + +// IntegrationAccountSku is the integration account sku. +type IntegrationAccountSku struct { + Name IntegrationAccountSkuName `json:"name,omitempty"` +} + +// KeyVaultKeyReference is the reference to the key vault key. +type KeyVaultKeyReference struct { + KeyVault *KeyVaultKeyReferenceKeyVault `json:"keyVault,omitempty"` + KeyName *string `json:"keyName,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// KeyVaultKeyReferenceKeyVault is the key vault reference. +type KeyVaultKeyReferenceKeyVault struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// Operation is logic REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list Logic operations. It +// contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PartnerContent is the integration account partner content. +type PartnerContent struct { + B2b *B2BPartnerContent `json:"b2b,omitempty"` +} + +// RecurrenceSchedule is the recurrence schedule. +type RecurrenceSchedule struct { + Minutes *[]int32 `json:"minutes,omitempty"` + Hours *[]int32 `json:"hours,omitempty"` + WeekDays *[]DaysOfWeek `json:"weekDays,omitempty"` + MonthDays *[]int32 `json:"monthDays,omitempty"` + MonthlyOccurrences *[]RecurrenceScheduleOccurrence `json:"monthlyOccurrences,omitempty"` +} + +// RecurrenceScheduleOccurrence is the recurrence schedule occurence. +type RecurrenceScheduleOccurrence struct { + Day DayOfWeek `json:"day,omitempty"` + Occurrence *int32 `json:"occurrence,omitempty"` +} + +// RegenerateActionParameter is the access key regenerate action content. +type RegenerateActionParameter struct { + KeyType KeyType `json:"keyType,omitempty"` +} + +// Resource is the base resource type. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceReference is the resource reference. +type ResourceReference struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RetryHistory is the retry history. +type RetryHistory struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Code *string `json:"code,omitempty"` + ClientRequestID *string `json:"clientRequestId,omitempty"` + ServiceRequestID *string `json:"serviceRequestId,omitempty"` + Error *ErrorResponse `json:"error,omitempty"` +} + +// SetObject is +type SetObject struct { + autorest.Response `json:"-"` + Value *map[string]interface{} `json:"value,omitempty"` +} + +// Sku is the sku type. +type Sku struct { + Name SkuName `json:"name,omitempty"` + Plan *ResourceReference `json:"plan,omitempty"` +} + +// SubResource is the sub resource type. +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// Workflow is the workflow type. +type Workflow struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *WorkflowProperties `json:"properties,omitempty"` +} + +// WorkflowFilter is the workflow filter. +type WorkflowFilter struct { + State WorkflowState `json:"state,omitempty"` +} + +// WorkflowListResult is the list of workflows. +type WorkflowListResult struct { + autorest.Response `json:"-"` + Value *[]Workflow `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkflowListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkflowListResult) WorkflowListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkflowOutputParameter is the workflow output parameter. +type WorkflowOutputParameter struct { + Type ParameterType `json:"type,omitempty"` + Value *map[string]interface{} `json:"value,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Description *string `json:"description,omitempty"` + Error *map[string]interface{} `json:"error,omitempty"` +} + +// WorkflowParameter is the workflow parameters. +type WorkflowParameter struct { + Type ParameterType `json:"type,omitempty"` + Value *map[string]interface{} `json:"value,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Description *string `json:"description,omitempty"` +} + +// WorkflowProperties is the workflow properties. +type WorkflowProperties struct { + ProvisioningState WorkflowProvisioningState `json:"provisioningState,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + State WorkflowState `json:"state,omitempty"` + Version *string `json:"version,omitempty"` + AccessEndpoint *string `json:"accessEndpoint,omitempty"` + Sku *Sku `json:"sku,omitempty"` + IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` + Definition *map[string]interface{} `json:"definition,omitempty"` + Parameters *map[string]*WorkflowParameter `json:"parameters,omitempty"` +} + +// WorkflowRun is the workflow run. +type WorkflowRun struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *WorkflowRunProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// WorkflowRunAction is the workflow run action. +type WorkflowRunAction struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *WorkflowRunActionProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// WorkflowRunActionFilter is the workflow run action filter. +type WorkflowRunActionFilter struct { + Status WorkflowStatus `json:"status,omitempty"` +} + +// WorkflowRunActionListResult is the list of workflow run actions. +type WorkflowRunActionListResult struct { + autorest.Response `json:"-"` + Value *[]WorkflowRunAction `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkflowRunActionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkflowRunActionListResult) WorkflowRunActionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkflowRunActionProperties is the workflow run action properties. +type WorkflowRunActionProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Status WorkflowStatus `json:"status,omitempty"` + Code *string `json:"code,omitempty"` + Error *map[string]interface{} `json:"error,omitempty"` + TrackingID *string `json:"trackingId,omitempty"` + Correlation *Correlation `json:"correlation,omitempty"` + InputsLink *ContentLink `json:"inputsLink,omitempty"` + OutputsLink *ContentLink `json:"outputsLink,omitempty"` + TrackedProperties *map[string]interface{} `json:"trackedProperties,omitempty"` + RetryHistory *[]RetryHistory `json:"retryHistory,omitempty"` +} + +// WorkflowRunFilter is the workflow run filter. +type WorkflowRunFilter struct { + Status WorkflowStatus `json:"status,omitempty"` +} + +// WorkflowRunListResult is the list of workflow runs. +type WorkflowRunListResult struct { + autorest.Response `json:"-"` + Value *[]WorkflowRun `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkflowRunListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkflowRunListResult) WorkflowRunListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkflowRunProperties is the workflow run properties. +type WorkflowRunProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Status WorkflowStatus `json:"status,omitempty"` + Code *string `json:"code,omitempty"` + Error *map[string]interface{} `json:"error,omitempty"` + CorrelationID *string `json:"correlationId,omitempty"` + Correlation *Correlation `json:"correlation,omitempty"` + Workflow *ResourceReference `json:"workflow,omitempty"` + Trigger *WorkflowRunTrigger `json:"trigger,omitempty"` + Outputs *map[string]*WorkflowOutputParameter `json:"outputs,omitempty"` + Response *WorkflowRunTrigger `json:"response,omitempty"` +} + +// WorkflowRunTrigger is the workflow run trigger. +type WorkflowRunTrigger struct { + Name *string `json:"name,omitempty"` + Inputs *map[string]interface{} `json:"inputs,omitempty"` + InputsLink *ContentLink `json:"inputsLink,omitempty"` + Outputs *map[string]interface{} `json:"outputs,omitempty"` + OutputsLink *ContentLink `json:"outputsLink,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + TrackingID *string `json:"trackingId,omitempty"` + Correlation *Correlation `json:"correlation,omitempty"` + Code *string `json:"code,omitempty"` + Status WorkflowStatus `json:"status,omitempty"` + Error *map[string]interface{} `json:"error,omitempty"` + TrackedProperties *map[string]interface{} `json:"trackedProperties,omitempty"` +} + +// WorkflowTrigger is the workflow trigger. +type WorkflowTrigger struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *WorkflowTriggerProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// WorkflowTriggerCallbackURL is the workflow trigger callback URL. +type WorkflowTriggerCallbackURL struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` + Method *string `json:"method,omitempty"` + BasePath *string `json:"basePath,omitempty"` + RelativePath *string `json:"relativePath,omitempty"` + RelativePathParameters *[]string `json:"relativePathParameters,omitempty"` + Queries *WorkflowTriggerListCallbackURLQueries `json:"queries,omitempty"` +} + +// WorkflowTriggerFilter is the workflow trigger filter. +type WorkflowTriggerFilter struct { + State WorkflowState `json:"state,omitempty"` +} + +// WorkflowTriggerHistory is the workflow trigger history. +type WorkflowTriggerHistory struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *WorkflowTriggerHistoryProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// WorkflowTriggerHistoryFilter is the workflow trigger history filter. +type WorkflowTriggerHistoryFilter struct { + Status WorkflowStatus `json:"status,omitempty"` +} + +// WorkflowTriggerHistoryListResult is the list of workflow trigger histories. +type WorkflowTriggerHistoryListResult struct { + autorest.Response `json:"-"` + Value *[]WorkflowTriggerHistory `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkflowTriggerHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkflowTriggerHistoryListResult) WorkflowTriggerHistoryListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkflowTriggerHistoryProperties is the workflow trigger history properties. +type WorkflowTriggerHistoryProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Status WorkflowStatus `json:"status,omitempty"` + Code *string `json:"code,omitempty"` + Error *map[string]interface{} `json:"error,omitempty"` + TrackingID *string `json:"trackingId,omitempty"` + Correlation *Correlation `json:"correlation,omitempty"` + InputsLink *ContentLink `json:"inputsLink,omitempty"` + OutputsLink *ContentLink `json:"outputsLink,omitempty"` + Fired *bool `json:"fired,omitempty"` + Run *ResourceReference `json:"run,omitempty"` +} + +// WorkflowTriggerListCallbackURLQueries is gets the workflow trigger callback +// URL query parameters. +type WorkflowTriggerListCallbackURLQueries struct { + APIVersion *string `json:"api-version,omitempty"` + Sp *string `json:"sp,omitempty"` + Sv *string `json:"sv,omitempty"` + Sig *string `json:"sig,omitempty"` +} + +// WorkflowTriggerListResult is the list of workflow triggers. +type WorkflowTriggerListResult struct { + autorest.Response `json:"-"` + Value *[]WorkflowTrigger `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkflowTriggerListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkflowTriggerListResult) WorkflowTriggerListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkflowTriggerProperties is the workflow trigger properties. +type WorkflowTriggerProperties struct { + ProvisioningState WorkflowTriggerProvisioningState `json:"provisioningState,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + State WorkflowState `json:"state,omitempty"` + Status WorkflowStatus `json:"status,omitempty"` + LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` + NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"` + Recurrence *WorkflowTriggerRecurrence `json:"recurrence,omitempty"` + Workflow *ResourceReference `json:"workflow,omitempty"` +} + +// WorkflowTriggerRecurrence is the workflow trigger recurrence. +type WorkflowTriggerRecurrence struct { + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + Interval *int32 `json:"interval,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + Schedule *RecurrenceSchedule `json:"schedule,omitempty"` +} + +// WorkflowVersion is the workflow version. +type WorkflowVersion struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *WorkflowVersionProperties `json:"properties,omitempty"` +} + +// WorkflowVersionListResult is the list of workflow versions. +type WorkflowVersionListResult struct { + autorest.Response `json:"-"` + Value *[]WorkflowVersion `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkflowVersionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkflowVersionListResult) WorkflowVersionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkflowVersionProperties is the workflow version properties. +type WorkflowVersionProperties struct { + CreatedTime *date.Time `json:"createdTime,omitempty"` + ChangedTime *date.Time `json:"changedTime,omitempty"` + State WorkflowState `json:"state,omitempty"` + Version *string `json:"version,omitempty"` + AccessEndpoint *string `json:"accessEndpoint,omitempty"` + Sku *Sku `json:"sku,omitempty"` + IntegrationAccount *ResourceReference `json:"integrationAccount,omitempty"` + Definition *map[string]interface{} `json:"definition,omitempty"` + Parameters *map[string]*WorkflowParameter `json:"parameters,omitempty"` +} + +// X12AcknowledgementSettings is the X12 agreement acknowledgement settings. +type X12AcknowledgementSettings struct { + NeedTechnicalAcknowledgement *bool `json:"needTechnicalAcknowledgement,omitempty"` + BatchTechnicalAcknowledgements *bool `json:"batchTechnicalAcknowledgements,omitempty"` + NeedFunctionalAcknowledgement *bool `json:"needFunctionalAcknowledgement,omitempty"` + FunctionalAcknowledgementVersion *string `json:"functionalAcknowledgementVersion,omitempty"` + BatchFunctionalAcknowledgements *bool `json:"batchFunctionalAcknowledgements,omitempty"` + NeedImplementationAcknowledgement *bool `json:"needImplementationAcknowledgement,omitempty"` + ImplementationAcknowledgementVersion *string `json:"implementationAcknowledgementVersion,omitempty"` + BatchImplementationAcknowledgements *bool `json:"batchImplementationAcknowledgements,omitempty"` + NeedLoopForValidMessages *bool `json:"needLoopForValidMessages,omitempty"` + SendSynchronousAcknowledgement *bool `json:"sendSynchronousAcknowledgement,omitempty"` + AcknowledgementControlNumberPrefix *string `json:"acknowledgementControlNumberPrefix,omitempty"` + AcknowledgementControlNumberSuffix *string `json:"acknowledgementControlNumberSuffix,omitempty"` + AcknowledgementControlNumberLowerBound *int32 `json:"acknowledgementControlNumberLowerBound,omitempty"` + AcknowledgementControlNumberUpperBound *int32 `json:"acknowledgementControlNumberUpperBound,omitempty"` + RolloverAcknowledgementControlNumber *bool `json:"rolloverAcknowledgementControlNumber,omitempty"` +} + +// X12AgreementContent is the X12 agreement content. +type X12AgreementContent struct { + ReceiveAgreement *X12OneWayAgreement `json:"receiveAgreement,omitempty"` + SendAgreement *X12OneWayAgreement `json:"sendAgreement,omitempty"` +} + +// X12DelimiterOverrides is the X12 delimiter override settings. +type X12DelimiterOverrides struct { + ProtocolVersion *string `json:"protocolVersion,omitempty"` + MessageID *string `json:"messageId,omitempty"` + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` + ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` + ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// X12EnvelopeOverride is the X12 envelope override settings. +type X12EnvelopeOverride struct { + TargetNamespace *string `json:"targetNamespace,omitempty"` + ProtocolVersion *string `json:"protocolVersion,omitempty"` + MessageID *string `json:"messageId,omitempty"` + ResponsibleAgencyCode *string `json:"responsibleAgencyCode,omitempty"` + HeaderVersion *string `json:"headerVersion,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` + FunctionalIdentifierCode *string `json:"functionalIdentifierCode,omitempty"` + DateFormat X12DateFormat `json:"dateFormat,omitempty"` + TimeFormat X12TimeFormat `json:"timeFormat,omitempty"` +} + +// X12EnvelopeSettings is the X12 agreement envelope settings. +type X12EnvelopeSettings struct { + ControlStandardsID *int32 `json:"controlStandardsId,omitempty"` + UseControlStandardsIDAsRepetitionCharacter *bool `json:"useControlStandardsIdAsRepetitionCharacter,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + ReceiverApplicationID *string `json:"receiverApplicationId,omitempty"` + ControlVersionNumber *string `json:"controlVersionNumber,omitempty"` + InterchangeControlNumberLowerBound *int32 `json:"interchangeControlNumberLowerBound,omitempty"` + InterchangeControlNumberUpperBound *int32 `json:"interchangeControlNumberUpperBound,omitempty"` + RolloverInterchangeControlNumber *bool `json:"rolloverInterchangeControlNumber,omitempty"` + EnableDefaultGroupHeaders *bool `json:"enableDefaultGroupHeaders,omitempty"` + FunctionalGroupID *string `json:"functionalGroupId,omitempty"` + GroupControlNumberLowerBound *int32 `json:"groupControlNumberLowerBound,omitempty"` + GroupControlNumberUpperBound *int32 `json:"groupControlNumberUpperBound,omitempty"` + RolloverGroupControlNumber *bool `json:"rolloverGroupControlNumber,omitempty"` + GroupHeaderAgencyCode *string `json:"groupHeaderAgencyCode,omitempty"` + GroupHeaderVersion *string `json:"groupHeaderVersion,omitempty"` + TransactionSetControlNumberLowerBound *int32 `json:"transactionSetControlNumberLowerBound,omitempty"` + TransactionSetControlNumberUpperBound *int32 `json:"transactionSetControlNumberUpperBound,omitempty"` + RolloverTransactionSetControlNumber *bool `json:"rolloverTransactionSetControlNumber,omitempty"` + TransactionSetControlNumberPrefix *string `json:"transactionSetControlNumberPrefix,omitempty"` + TransactionSetControlNumberSuffix *string `json:"transactionSetControlNumberSuffix,omitempty"` + OverwriteExistingTransactionSetControlNumber *bool `json:"overwriteExistingTransactionSetControlNumber,omitempty"` + GroupHeaderDateFormat X12DateFormat `json:"groupHeaderDateFormat,omitempty"` + GroupHeaderTimeFormat X12TimeFormat `json:"groupHeaderTimeFormat,omitempty"` + UsageIndicator UsageIndicator `json:"usageIndicator,omitempty"` +} + +// X12FramingSettings is the X12 agreement framing settings. +type X12FramingSettings struct { + DataElementSeparator *int32 `json:"dataElementSeparator,omitempty"` + ComponentSeparator *int32 `json:"componentSeparator,omitempty"` + ReplaceSeparatorsInPayload *bool `json:"replaceSeparatorsInPayload,omitempty"` + ReplaceCharacter *int32 `json:"replaceCharacter,omitempty"` + SegmentTerminator *int32 `json:"segmentTerminator,omitempty"` + CharacterSet X12CharacterSet `json:"characterSet,omitempty"` + SegmentTerminatorSuffix SegmentTerminatorSuffix `json:"segmentTerminatorSuffix,omitempty"` +} + +// X12MessageFilter is the X12 message filter for odata query. +type X12MessageFilter struct { + MessageFilterType MessageFilterType `json:"messageFilterType,omitempty"` +} + +// X12MessageIdentifier is the X12 message identifier. +type X12MessageIdentifier struct { + MessageID *string `json:"messageId,omitempty"` +} + +// X12OneWayAgreement is the X12 oneway agreement. +type X12OneWayAgreement struct { + SenderBusinessIdentity *BusinessIdentity `json:"senderBusinessIdentity,omitempty"` + ReceiverBusinessIdentity *BusinessIdentity `json:"receiverBusinessIdentity,omitempty"` + ProtocolSettings *X12ProtocolSettings `json:"protocolSettings,omitempty"` +} + +// X12ProcessingSettings is the X12 processing settings. +type X12ProcessingSettings struct { + MaskSecurityInfo *bool `json:"maskSecurityInfo,omitempty"` + ConvertImpliedDecimal *bool `json:"convertImpliedDecimal,omitempty"` + PreserveInterchange *bool `json:"preserveInterchange,omitempty"` + SuspendInterchangeOnError *bool `json:"suspendInterchangeOnError,omitempty"` + CreateEmptyXMLTagsForTrailingSeparators *bool `json:"createEmptyXmlTagsForTrailingSeparators,omitempty"` + UseDotAsDecimalSeparator *bool `json:"useDotAsDecimalSeparator,omitempty"` +} + +// X12ProtocolSettings is the X12 agreement protocol settings. +type X12ProtocolSettings struct { + ValidationSettings *X12ValidationSettings `json:"validationSettings,omitempty"` + FramingSettings *X12FramingSettings `json:"framingSettings,omitempty"` + EnvelopeSettings *X12EnvelopeSettings `json:"envelopeSettings,omitempty"` + AcknowledgementSettings *X12AcknowledgementSettings `json:"acknowledgementSettings,omitempty"` + MessageFilter *X12MessageFilter `json:"messageFilter,omitempty"` + SecuritySettings *X12SecuritySettings `json:"securitySettings,omitempty"` + ProcessingSettings *X12ProcessingSettings `json:"processingSettings,omitempty"` + EnvelopeOverrides *[]X12EnvelopeOverride `json:"envelopeOverrides,omitempty"` + ValidationOverrides *[]X12ValidationOverride `json:"validationOverrides,omitempty"` + MessageFilterList *[]X12MessageIdentifier `json:"messageFilterList,omitempty"` + SchemaReferences *[]X12SchemaReference `json:"schemaReferences,omitempty"` + X12DelimiterOverrides *[]X12DelimiterOverrides `json:"x12DelimiterOverrides,omitempty"` +} + +// X12SchemaReference is the X12 schema reference. +type X12SchemaReference struct { + MessageID *string `json:"messageId,omitempty"` + SenderApplicationID *string `json:"senderApplicationId,omitempty"` + SchemaVersion *string `json:"schemaVersion,omitempty"` + SchemaName *string `json:"schemaName,omitempty"` +} + +// X12SecuritySettings is the X12 agreement security settings. +type X12SecuritySettings struct { + AuthorizationQualifier *string `json:"authorizationQualifier,omitempty"` + AuthorizationValue *string `json:"authorizationValue,omitempty"` + SecurityQualifier *string `json:"securityQualifier,omitempty"` + PasswordValue *string `json:"passwordValue,omitempty"` +} + +// X12ValidationOverride is the X12 validation override settings. +type X12ValidationOverride struct { + MessageID *string `json:"messageId,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` +} + +// X12ValidationSettings is the X12 agreement validation settings. +type X12ValidationSettings struct { + ValidateCharacterSet *bool `json:"validateCharacterSet,omitempty"` + CheckDuplicateInterchangeControlNumber *bool `json:"checkDuplicateInterchangeControlNumber,omitempty"` + InterchangeControlNumberValidityDays *int32 `json:"interchangeControlNumberValidityDays,omitempty"` + CheckDuplicateGroupControlNumber *bool `json:"checkDuplicateGroupControlNumber,omitempty"` + CheckDuplicateTransactionSetControlNumber *bool `json:"checkDuplicateTransactionSetControlNumber,omitempty"` + ValidateEdiTypes *bool `json:"validateEdiTypes,omitempty"` + ValidateXsdTypes *bool `json:"validateXsdTypes,omitempty"` + AllowLeadingAndTrailingSpacesAndZeroes *bool `json:"allowLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrimLeadingAndTrailingSpacesAndZeroes *bool `json:"trimLeadingAndTrailingSpacesAndZeroes,omitempty"` + TrailingSeparatorPolicy TrailingSeparatorPolicy `json:"trailingSeparatorPolicy,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/partners.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/partners.go index 320dbee7f7..f361cd2610 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/partners.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/partners.go @@ -1,351 +1,351 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PartnersClient is the rEST API for Azure Logic Apps. -type PartnersClient struct { - ManagementClient -} - -// NewPartnersClient creates an instance of the PartnersClient client. -func NewPartnersClient(subscriptionID string) PartnersClient { - return NewPartnersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPartnersClientWithBaseURI creates an instance of the PartnersClient -// client. -func NewPartnersClientWithBaseURI(baseURI string, subscriptionID string) PartnersClient { - return PartnersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account partner. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. partnerName is the integration account partner -// name. partner is the integration account partner. -func (client PartnersClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (result IntegrationAccountPartner, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: partner, - Constraints: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties.Content", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "logic.PartnersClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, partnerName, partner) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PartnersClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), - autorest.WithJSON(partner), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PartnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PartnersClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account partner. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. partnerName is the integration account partner -// name. -func (client PartnersClient) Delete(resourceGroupName string, integrationAccountName string, partnerName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, partnerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PartnersClient) DeletePreparer(resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PartnersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PartnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account partner. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. partnerName is the integration account partner -// name. -func (client PartnersClient) Get(resourceGroupName string, integrationAccountName string, partnerName string) (result IntegrationAccountPartner, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName, partnerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PartnersClient) GetPreparer(resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "partnerName": autorest.Encode("path", partnerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PartnersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PartnersClient) GetResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccounts gets a list of integration account partners. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. top is the number of items to be included in the -// result. filter is the filter to apply on the operation. -func (client PartnersClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountPartnerListResult, err error) { - req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure sending request") - return - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure responding to request") - } - - return -} - -// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. -func (client PartnersClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the -// http.Response Body if it receives an error. -func (client PartnersClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always -// closes the http.Response Body. -func (client PartnersClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountPartnerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. -func (client PartnersClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountPartnerListResult) (result IntegrationAccountPartnerListResult, err error) { - req, err := lastResults.IntegrationAccountPartnerListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PartnersClient is the rEST API for Azure Logic Apps. +type PartnersClient struct { + ManagementClient +} + +// NewPartnersClient creates an instance of the PartnersClient client. +func NewPartnersClient(subscriptionID string) PartnersClient { + return NewPartnersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPartnersClientWithBaseURI creates an instance of the PartnersClient +// client. +func NewPartnersClientWithBaseURI(baseURI string, subscriptionID string) PartnersClient { + return PartnersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account partner. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. partnerName is the integration account partner +// name. partner is the integration account partner. +func (client PartnersClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (result IntegrationAccountPartner, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: partner, + Constraints: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "partner.IntegrationAccountPartnerProperties.Content", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.PartnersClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, partnerName, partner) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PartnersClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, partnerName string, partner IntegrationAccountPartner) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "partnerName": autorest.Encode("path", partnerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), + autorest.WithJSON(partner), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PartnersClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account partner. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. partnerName is the integration account partner +// name. +func (client PartnersClient) Delete(resourceGroupName string, integrationAccountName string, partnerName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, partnerName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PartnersClient) DeletePreparer(resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "partnerName": autorest.Encode("path", partnerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PartnersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account partner. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. partnerName is the integration account partner +// name. +func (client PartnersClient) Get(resourceGroupName string, integrationAccountName string, partnerName string) (result IntegrationAccountPartner, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, partnerName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PartnersClient) GetPreparer(resourceGroupName string, integrationAccountName string, partnerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "partnerName": autorest.Encode("path", partnerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PartnersClient) GetResponder(resp *http.Response) (result IntegrationAccountPartner, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account partners. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client PartnersClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountPartnerListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client PartnersClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client PartnersClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client PartnersClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountPartnerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client PartnersClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountPartnerListResult) (result IntegrationAccountPartnerListResult, err error) { + req, err := lastResults.IntegrationAccountPartnerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.PartnersClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/schemas.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/schemas.go index 7c506dff9e..a5ad456b70 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/schemas.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/schemas.go @@ -1,347 +1,347 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SchemasClient is the rEST API for Azure Logic Apps. -type SchemasClient struct { - ManagementClient -} - -// NewSchemasClient creates an instance of the SchemasClient client. -func NewSchemasClient(subscriptionID string) SchemasClient { - return NewSchemasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSchemasClientWithBaseURI creates an instance of the SchemasClient client. -func NewSchemasClientWithBaseURI(baseURI string, subscriptionID string) SchemasClient { - return SchemasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account schema. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. schemaName is the integration account schema name. -// schema is the integration account schema. -func (client SchemasClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (result IntegrationAccountSchema, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: schema, - Constraints: []validation.Constraint{{Target: "schema.IntegrationAccountSchemaProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "logic.SchemasClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, schemaName, schema) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SchemasClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), - autorest.WithJSON(schema), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SchemasClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SchemasClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account schema. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. schemaName is the integration account schema name. -func (client SchemasClient) Delete(resourceGroupName string, integrationAccountName string, schemaName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, schemaName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SchemasClient) DeletePreparer(resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SchemasClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SchemasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account schema. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. schemaName is the integration account schema name. -func (client SchemasClient) Get(resourceGroupName string, integrationAccountName string, schemaName string) (result IntegrationAccountSchema, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName, schemaName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SchemasClient) GetPreparer(resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "schemaName": autorest.Encode("path", schemaName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SchemasClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SchemasClient) GetResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccounts gets a list of integration account schemas. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. top is the number of items to be included in the -// result. filter is the filter to apply on the operation. -func (client SchemasClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSchemaListResult, err error) { - req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure sending request") - return - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure responding to request") - } - - return -} - -// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. -func (client SchemasClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the -// http.Response Body if it receives an error. -func (client SchemasClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always -// closes the http.Response Body. -func (client SchemasClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountSchemaListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. -func (client SchemasClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountSchemaListResult) (result IntegrationAccountSchemaListResult, err error) { - req, err := lastResults.IntegrationAccountSchemaListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SchemasClient is the rEST API for Azure Logic Apps. +type SchemasClient struct { + ManagementClient +} + +// NewSchemasClient creates an instance of the SchemasClient client. +func NewSchemasClient(subscriptionID string) SchemasClient { + return NewSchemasClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSchemasClientWithBaseURI creates an instance of the SchemasClient client. +func NewSchemasClientWithBaseURI(baseURI string, subscriptionID string) SchemasClient { + return SchemasClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account schema. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. schemaName is the integration account schema name. +// schema is the integration account schema. +func (client SchemasClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (result IntegrationAccountSchema, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: schema, + Constraints: []validation.Constraint{{Target: "schema.IntegrationAccountSchemaProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.SchemasClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, schemaName, schema) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SchemasClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, schemaName string, schema IntegrationAccountSchema) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "schemaName": autorest.Encode("path", schemaName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), + autorest.WithJSON(schema), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SchemasClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account schema. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. schemaName is the integration account schema name. +func (client SchemasClient) Delete(resourceGroupName string, integrationAccountName string, schemaName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, schemaName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SchemasClient) DeletePreparer(resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "schemaName": autorest.Encode("path", schemaName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SchemasClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account schema. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. schemaName is the integration account schema name. +func (client SchemasClient) Get(resourceGroupName string, integrationAccountName string, schemaName string) (result IntegrationAccountSchema, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, schemaName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SchemasClient) GetPreparer(resourceGroupName string, integrationAccountName string, schemaName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "schemaName": autorest.Encode("path", schemaName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SchemasClient) GetResponder(resp *http.Response) (result IntegrationAccountSchema, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account schemas. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client SchemasClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSchemaListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client SchemasClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client SchemasClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client SchemasClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountSchemaListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client SchemasClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountSchemaListResult) (result IntegrationAccountSchemaListResult, err error) { + req, err := lastResults.IntegrationAccountSchemaListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SchemasClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/sessions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/sessions.go index 561bb2d6f1..aa7cf60123 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/sessions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/sessions.go @@ -1,350 +1,350 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SessionsClient is the rEST API for Azure Logic Apps. -type SessionsClient struct { - ManagementClient -} - -// NewSessionsClient creates an instance of the SessionsClient client. -func NewSessionsClient(subscriptionID string) SessionsClient { - return NewSessionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSessionsClientWithBaseURI creates an instance of the SessionsClient -// client. -func NewSessionsClientWithBaseURI(baseURI string, subscriptionID string) SessionsClient { - return SessionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an integration account session. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. sessionName is the integration account session -// name. session is the integration account session. -func (client SessionsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (result IntegrationAccountSession, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: session, - Constraints: []validation.Constraint{{Target: "session.IntegrationAccountSessionProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "logic.SessionsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, sessionName, session) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SessionsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionName": autorest.Encode("path", sessionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), - autorest.WithJSON(session), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SessionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SessionsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSession, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an integration account session. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. sessionName is the integration account session -// name. -func (client SessionsClient) Delete(resourceGroupName string, integrationAccountName string, sessionName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, sessionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SessionsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionName": autorest.Encode("path", sessionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SessionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SessionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an integration account session. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. sessionName is the integration account session -// name. -func (client SessionsClient) Get(resourceGroupName string, integrationAccountName string, sessionName string) (result IntegrationAccountSession, err error) { - req, err := client.GetPreparer(resourceGroupName, integrationAccountName, sessionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SessionsClient) GetPreparer(resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionName": autorest.Encode("path", sessionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SessionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SessionsClient) GetResponder(resp *http.Response) (result IntegrationAccountSession, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccounts gets a list of integration account sessions. -// -// resourceGroupName is the resource group name. integrationAccountName is the -// integration account name. top is the number of items to be included in the -// result. filter is the filter to apply on the operation. -func (client SessionsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSessionListResult, err error) { - req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure sending request") - return - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") - } - - return -} - -// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. -func (client SessionsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "integrationAccountName": autorest.Encode("path", integrationAccountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the -// http.Response Body if it receives an error. -func (client SessionsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always -// closes the http.Response Body. -func (client SessionsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountSessionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. -func (client SessionsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountSessionListResult) (result IntegrationAccountSessionListResult, err error) { - req, err := lastResults.IntegrationAccountSessionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByIntegrationAccountsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") - } - - result, err = client.ListByIntegrationAccountsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SessionsClient is the rEST API for Azure Logic Apps. +type SessionsClient struct { + ManagementClient +} + +// NewSessionsClient creates an instance of the SessionsClient client. +func NewSessionsClient(subscriptionID string) SessionsClient { + return NewSessionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSessionsClientWithBaseURI creates an instance of the SessionsClient +// client. +func NewSessionsClientWithBaseURI(baseURI string, subscriptionID string) SessionsClient { + return SessionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an integration account session. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. sessionName is the integration account session +// name. session is the integration account session. +func (client SessionsClient) CreateOrUpdate(resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (result IntegrationAccountSession, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: session, + Constraints: []validation.Constraint{{Target: "session.IntegrationAccountSessionProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "logic.SessionsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, integrationAccountName, sessionName, session) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SessionsClient) CreateOrUpdatePreparer(resourceGroupName string, integrationAccountName string, sessionName string, session IntegrationAccountSession) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sessionName": autorest.Encode("path", sessionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), + autorest.WithJSON(session), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SessionsClient) CreateOrUpdateResponder(resp *http.Response) (result IntegrationAccountSession, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an integration account session. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. sessionName is the integration account session +// name. +func (client SessionsClient) Delete(resourceGroupName string, integrationAccountName string, sessionName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, integrationAccountName, sessionName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SessionsClient) DeletePreparer(resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sessionName": autorest.Encode("path", sessionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SessionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an integration account session. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. sessionName is the integration account session +// name. +func (client SessionsClient) Get(resourceGroupName string, integrationAccountName string, sessionName string) (result IntegrationAccountSession, err error) { + req, err := client.GetPreparer(resourceGroupName, integrationAccountName, sessionName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SessionsClient) GetPreparer(resourceGroupName string, integrationAccountName string, sessionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sessionName": autorest.Encode("path", sessionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SessionsClient) GetResponder(resp *http.Response) (result IntegrationAccountSession, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccounts gets a list of integration account sessions. +// +// resourceGroupName is the resource group name. integrationAccountName is the +// integration account name. top is the number of items to be included in the +// result. filter is the filter to apply on the operation. +func (client SessionsClient) ListByIntegrationAccounts(resourceGroupName string, integrationAccountName string, top *int32, filter string) (result IntegrationAccountSessionListResult, err error) { + req, err := client.ListByIntegrationAccountsPreparer(resourceGroupName, integrationAccountName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", nil, "Failure preparing request") + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure sending request") + return + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure responding to request") + } + + return +} + +// ListByIntegrationAccountsPreparer prepares the ListByIntegrationAccounts request. +func (client SessionsClient) ListByIntegrationAccountsPreparer(resourceGroupName string, integrationAccountName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "integrationAccountName": autorest.Encode("path", integrationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByIntegrationAccountsSender sends the ListByIntegrationAccounts request. The method will close the +// http.Response Body if it receives an error. +func (client SessionsClient) ListByIntegrationAccountsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByIntegrationAccountsResponder handles the response to the ListByIntegrationAccounts request. The method always +// closes the http.Response Body. +func (client SessionsClient) ListByIntegrationAccountsResponder(resp *http.Response) (result IntegrationAccountSessionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByIntegrationAccountsNextResults retrieves the next set of results, if any. +func (client SessionsClient) ListByIntegrationAccountsNextResults(lastResults IntegrationAccountSessionListResult) (result IntegrationAccountSessionListResult, err error) { + req, err := lastResults.IntegrationAccountSessionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByIntegrationAccountsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure sending next results request") + } + + result, err = client.ListByIntegrationAccountsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.SessionsClient", "ListByIntegrationAccounts", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/version.go index 58e3c868aa..6415a25667 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/version.go @@ -1,29 +1,29 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-logic/2016-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-logic/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowrunactions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowrunactions.go index 968fce4211..e89d7c7f37 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowrunactions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowrunactions.go @@ -1,209 +1,209 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkflowRunActionsClient is the rEST API for Azure Logic Apps. -type WorkflowRunActionsClient struct { - ManagementClient -} - -// NewWorkflowRunActionsClient creates an instance of the -// WorkflowRunActionsClient client. -func NewWorkflowRunActionsClient(subscriptionID string) WorkflowRunActionsClient { - return NewWorkflowRunActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunActionsClientWithBaseURI creates an instance of the -// WorkflowRunActionsClient client. -func NewWorkflowRunActionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionsClient { - return WorkflowRunActionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow run action. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. runName is the workflow run name. actionName is the workflow action -// name. -func (client WorkflowRunActionsClient) Get(resourceGroupName string, workflowName string, runName string, actionName string) (result WorkflowRunAction, err error) { - req, err := client.GetPreparer(resourceGroupName, workflowName, runName, actionName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunActionsClient) GetPreparer(resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "actionName": autorest.Encode("path", actionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionsClient) GetResponder(resp *http.Response) (result WorkflowRunAction, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow run actions. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. runName is the workflow run name. top is the number of items to be -// included in the result. filter is the filter to apply on the operation. -func (client WorkflowRunActionsClient) List(resourceGroupName string, workflowName string, runName string, top *int32, filter string) (result WorkflowRunActionListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, workflowName, runName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunActionsClient) ListPreparer(resourceGroupName string, workflowName string, runName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunActionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunActionsClient) ListResponder(resp *http.Response) (result WorkflowRunActionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client WorkflowRunActionsClient) ListNextResults(lastResults WorkflowRunActionListResult) (result WorkflowRunActionListResult, err error) { - req, err := lastResults.WorkflowRunActionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkflowRunActionsClient is the rEST API for Azure Logic Apps. +type WorkflowRunActionsClient struct { + ManagementClient +} + +// NewWorkflowRunActionsClient creates an instance of the +// WorkflowRunActionsClient client. +func NewWorkflowRunActionsClient(subscriptionID string) WorkflowRunActionsClient { + return NewWorkflowRunActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkflowRunActionsClientWithBaseURI creates an instance of the +// WorkflowRunActionsClient client. +func NewWorkflowRunActionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunActionsClient { + return WorkflowRunActionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a workflow run action. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. runName is the workflow run name. actionName is the workflow action +// name. +func (client WorkflowRunActionsClient) Get(resourceGroupName string, workflowName string, runName string, actionName string) (result WorkflowRunAction, err error) { + req, err := client.GetPreparer(resourceGroupName, workflowName, runName, actionName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkflowRunActionsClient) GetPreparer(resourceGroupName string, workflowName string, runName string, actionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionName": autorest.Encode("path", actionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runName": autorest.Encode("path", runName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunActionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkflowRunActionsClient) GetResponder(resp *http.Response) (result WorkflowRunAction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of workflow run actions. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. runName is the workflow run name. top is the number of items to be +// included in the result. filter is the filter to apply on the operation. +func (client WorkflowRunActionsClient) List(resourceGroupName string, workflowName string, runName string, top *int32, filter string) (result WorkflowRunActionListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, workflowName, runName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkflowRunActionsClient) ListPreparer(resourceGroupName string, workflowName string, runName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runName": autorest.Encode("path", runName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunActionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkflowRunActionsClient) ListResponder(resp *http.Response) (result WorkflowRunActionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client WorkflowRunActionsClient) ListNextResults(lastResults WorkflowRunActionListResult) (result WorkflowRunActionListResult, err error) { + req, err := lastResults.WorkflowRunActionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunActionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowruns.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowruns.go index a501de9b8c..57b8959c84 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowruns.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowruns.go @@ -1,271 +1,271 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkflowRunsClient is the rEST API for Azure Logic Apps. -type WorkflowRunsClient struct { - ManagementClient -} - -// NewWorkflowRunsClient creates an instance of the WorkflowRunsClient client. -func NewWorkflowRunsClient(subscriptionID string) WorkflowRunsClient { - return NewWorkflowRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowRunsClientWithBaseURI creates an instance of the -// WorkflowRunsClient client. -func NewWorkflowRunsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunsClient { - return WorkflowRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel cancels a workflow run. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. runName is the workflow run name. -func (client WorkflowRunsClient) Cancel(resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) { - req, err := client.CancelPreparer(resourceGroupName, workflowName, runName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", resp, "Failure responding to request") - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client WorkflowRunsClient) CancelPreparer(resourceGroupName string, workflowName string, runName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunsClient) CancelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client WorkflowRunsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a workflow run. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. runName is the workflow run name. -func (client WorkflowRunsClient) Get(resourceGroupName string, workflowName string, runName string) (result WorkflowRun, err error) { - req, err := client.GetPreparer(resourceGroupName, workflowName, runName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowRunsClient) GetPreparer(resourceGroupName string, workflowName string, runName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runName": autorest.Encode("path", runName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowRunsClient) GetResponder(resp *http.Response) (result WorkflowRun, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow runs. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. top is the number of items to be included in the result. filter is the -// filter to apply on the operation. -func (client WorkflowRunsClient) List(resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowRunListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, workflowName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowRunsClient) ListPreparer(resourceGroupName string, workflowName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowRunsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowRunsClient) ListResponder(resp *http.Response) (result WorkflowRunListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client WorkflowRunsClient) ListNextResults(lastResults WorkflowRunListResult) (result WorkflowRunListResult, err error) { - req, err := lastResults.WorkflowRunListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkflowRunsClient is the rEST API for Azure Logic Apps. +type WorkflowRunsClient struct { + ManagementClient +} + +// NewWorkflowRunsClient creates an instance of the WorkflowRunsClient client. +func NewWorkflowRunsClient(subscriptionID string) WorkflowRunsClient { + return NewWorkflowRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkflowRunsClientWithBaseURI creates an instance of the +// WorkflowRunsClient client. +func NewWorkflowRunsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowRunsClient { + return WorkflowRunsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancels a workflow run. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. runName is the workflow run name. +func (client WorkflowRunsClient) Cancel(resourceGroupName string, workflowName string, runName string) (result autorest.Response, err error) { + req, err := client.CancelPreparer(resourceGroupName, workflowName, runName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Cancel", resp, "Failure responding to request") + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client WorkflowRunsClient) CancelPreparer(resourceGroupName string, workflowName string, runName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runName": autorest.Encode("path", runName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunsClient) CancelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client WorkflowRunsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a workflow run. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. runName is the workflow run name. +func (client WorkflowRunsClient) Get(resourceGroupName string, workflowName string, runName string) (result WorkflowRun, err error) { + req, err := client.GetPreparer(resourceGroupName, workflowName, runName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkflowRunsClient) GetPreparer(resourceGroupName string, workflowName string, runName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runName": autorest.Encode("path", runName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkflowRunsClient) GetResponder(resp *http.Response) (result WorkflowRun, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of workflow runs. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. top is the number of items to be included in the result. filter is the +// filter to apply on the operation. +func (client WorkflowRunsClient) List(resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowRunListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, workflowName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkflowRunsClient) ListPreparer(resourceGroupName string, workflowName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowRunsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkflowRunsClient) ListResponder(resp *http.Response) (result WorkflowRunListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client WorkflowRunsClient) ListNextResults(lastResults WorkflowRunListResult) (result WorkflowRunListResult, err error) { + req, err := lastResults.WorkflowRunListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowRunsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflows.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflows.go index 25395463c9..521a2d458c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflows.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflows.go @@ -1,898 +1,898 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkflowsClient is the rEST API for Azure Logic Apps. -type WorkflowsClient struct { - ManagementClient -} - -// NewWorkflowsClient creates an instance of the WorkflowsClient client. -func NewWorkflowsClient(subscriptionID string) WorkflowsClient { - return NewWorkflowsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowsClientWithBaseURI creates an instance of the WorkflowsClient -// client. -func NewWorkflowsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowsClient { - return WorkflowsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. workflow is the workflow. -func (client WorkflowsClient) CreateOrUpdate(resourceGroupName string, workflowName string, workflow Workflow) (result Workflow, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, workflowName, workflow) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkflowsClient) CreateOrUpdatePreparer(resourceGroupName string, workflowName string, workflow Workflow) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithJSON(workflow), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) CreateOrUpdateResponder(resp *http.Response) (result Workflow, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. -func (client WorkflowsClient) Delete(resourceGroupName string, workflowName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkflowsClient) DeletePreparer(resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Disable disables a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. -func (client WorkflowsClient) Disable(resourceGroupName string, workflowName string) (result autorest.Response, err error) { - req, err := client.DisablePreparer(resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", nil, "Failure preparing request") - return - } - - resp, err := client.DisableSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", resp, "Failure sending request") - return - } - - result, err = client.DisableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", resp, "Failure responding to request") - } - - return -} - -// DisablePreparer prepares the Disable request. -func (client WorkflowsClient) DisablePreparer(resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DisableSender sends the Disable request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) DisableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DisableResponder handles the response to the Disable request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Enable enables a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. -func (client WorkflowsClient) Enable(resourceGroupName string, workflowName string) (result autorest.Response, err error) { - req, err := client.EnablePreparer(resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", nil, "Failure preparing request") - return - } - - resp, err := client.EnableSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", resp, "Failure sending request") - return - } - - result, err = client.EnableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", resp, "Failure responding to request") - } - - return -} - -// EnablePreparer prepares the Enable request. -func (client WorkflowsClient) EnablePreparer(resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// EnableSender sends the Enable request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) EnableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// EnableResponder handles the response to the Enable request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateUpgradedDefinition generates the upgraded definition for a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. parameters is parameters for generating an upgraded definition. -func (client WorkflowsClient) GenerateUpgradedDefinition(resourceGroupName string, workflowName string, parameters GenerateUpgradedDefinitionParameters) (result SetObject, err error) { - req, err := client.GenerateUpgradedDefinitionPreparer(resourceGroupName, workflowName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateUpgradedDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", resp, "Failure sending request") - return - } - - result, err = client.GenerateUpgradedDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", resp, "Failure responding to request") - } - - return -} - -// GenerateUpgradedDefinitionPreparer prepares the GenerateUpgradedDefinition request. -func (client WorkflowsClient) GenerateUpgradedDefinitionPreparer(resourceGroupName string, workflowName string, parameters GenerateUpgradedDefinitionParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/generateUpgradedDefinition", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateUpgradedDefinitionSender sends the GenerateUpgradedDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) GenerateUpgradedDefinitionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateUpgradedDefinitionResponder handles the response to the GenerateUpgradedDefinition request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) GenerateUpgradedDefinitionResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. -func (client WorkflowsClient) Get(resourceGroupName string, workflowName string) (result Workflow, err error) { - req, err := client.GetPreparer(resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowsClient) GetPreparer(resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) GetResponder(resp *http.Response) (result Workflow, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets a list of workflows by resource group. -// -// resourceGroupName is the resource group name. top is the number of items to -// be included in the result. filter is the filter to apply on the operation. -func (client WorkflowsClient) ListByResourceGroup(resourceGroupName string, top *int32, filter string) (result WorkflowListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkflowsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListByResourceGroupResponder(resp *http.Response) (result WorkflowListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client WorkflowsClient) ListByResourceGroupNextResults(lastResults WorkflowListResult) (result WorkflowListResult, err error) { - req, err := lastResults.WorkflowListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription gets a list of workflows by subscription. -// -// top is the number of items to be included in the result. filter is the -// filter to apply on the operation. -func (client WorkflowsClient) ListBySubscription(top *int32, filter string) (result WorkflowListResult, err error) { - req, err := client.ListBySubscriptionPreparer(top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client WorkflowsClient) ListBySubscriptionPreparer(top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListBySubscriptionResponder(resp *http.Response) (result WorkflowListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client WorkflowsClient) ListBySubscriptionNextResults(lastResults WorkflowListResult) (result WorkflowListResult, err error) { - req, err := lastResults.WorkflowListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// ListSwagger gets an OpenAPI definition for the workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. -func (client WorkflowsClient) ListSwagger(resourceGroupName string, workflowName string) (result SetObject, err error) { - req, err := client.ListSwaggerPreparer(resourceGroupName, workflowName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", nil, "Failure preparing request") - return - } - - resp, err := client.ListSwaggerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", resp, "Failure sending request") - return - } - - result, err = client.ListSwaggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", resp, "Failure responding to request") - } - - return -} - -// ListSwaggerPreparer prepares the ListSwagger request. -func (client WorkflowsClient) ListSwaggerPreparer(resourceGroupName string, workflowName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/listSwagger", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSwaggerSender sends the ListSwagger request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ListSwaggerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSwaggerResponder handles the response to the ListSwagger request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ListSwaggerResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateAccessKey regenerates the callback URL access key for request -// triggers. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. keyType is the access key type. -func (client WorkflowsClient) RegenerateAccessKey(resourceGroupName string, workflowName string, keyType RegenerateActionParameter) (result autorest.Response, err error) { - req, err := client.RegenerateAccessKeyPreparer(resourceGroupName, workflowName, keyType) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateAccessKeySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateAccessKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateAccessKeyPreparer prepares the RegenerateAccessKey request. -func (client WorkflowsClient) RegenerateAccessKeyPreparer(resourceGroupName string, workflowName string, keyType RegenerateActionParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/regenerateAccessKey", pathParameters), - autorest.WithJSON(keyType), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateAccessKeySender sends the RegenerateAccessKey request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) RegenerateAccessKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateAccessKeyResponder handles the response to the RegenerateAccessKey request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) RegenerateAccessKeyResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a workflow. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. workflow is the workflow. -func (client WorkflowsClient) Update(resourceGroupName string, workflowName string, workflow Workflow) (result Workflow, err error) { - req, err := client.UpdatePreparer(resourceGroupName, workflowName, workflow) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkflowsClient) UpdatePreparer(resourceGroupName string, workflowName string, workflow Workflow) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), - autorest.WithJSON(workflow), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) UpdateResponder(resp *http.Response) (result Workflow, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Validate validates the workflow definition. -// -// resourceGroupName is the resource group name. location is the workflow -// location. workflowName is the workflow name. workflow is the workflow -// definition. -func (client WorkflowsClient) Validate(resourceGroupName string, location string, workflowName string, workflow Workflow) (result autorest.Response, err error) { - req, err := client.ValidatePreparer(resourceGroupName, location, workflowName, workflow) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Validate", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Validate", resp, "Failure sending request") - return - } - - result, err = client.ValidateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Validate", resp, "Failure responding to request") - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client WorkflowsClient) ValidatePreparer(resourceGroupName string, location string, workflowName string, workflow Workflow) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate", pathParameters), - autorest.WithJSON(workflow), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowsClient) ValidateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client WorkflowsClient) ValidateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkflowsClient is the rEST API for Azure Logic Apps. +type WorkflowsClient struct { + ManagementClient +} + +// NewWorkflowsClient creates an instance of the WorkflowsClient client. +func NewWorkflowsClient(subscriptionID string) WorkflowsClient { + return NewWorkflowsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkflowsClientWithBaseURI creates an instance of the WorkflowsClient +// client. +func NewWorkflowsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowsClient { + return WorkflowsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. workflow is the workflow. +func (client WorkflowsClient) CreateOrUpdate(resourceGroupName string, workflowName string, workflow Workflow) (result Workflow, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, workflowName, workflow) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkflowsClient) CreateOrUpdatePreparer(resourceGroupName string, workflowName string, workflow Workflow) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), + autorest.WithJSON(workflow), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) CreateOrUpdateResponder(resp *http.Response) (result Workflow, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. +func (client WorkflowsClient) Delete(resourceGroupName string, workflowName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, workflowName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkflowsClient) DeletePreparer(resourceGroupName string, workflowName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Disable disables a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. +func (client WorkflowsClient) Disable(resourceGroupName string, workflowName string) (result autorest.Response, err error) { + req, err := client.DisablePreparer(resourceGroupName, workflowName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", nil, "Failure preparing request") + return + } + + resp, err := client.DisableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", resp, "Failure sending request") + return + } + + result, err = client.DisableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Disable", resp, "Failure responding to request") + } + + return +} + +// DisablePreparer prepares the Disable request. +func (client WorkflowsClient) DisablePreparer(resourceGroupName string, workflowName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DisableSender sends the Disable request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) DisableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DisableResponder handles the response to the Disable request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Enable enables a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. +func (client WorkflowsClient) Enable(resourceGroupName string, workflowName string) (result autorest.Response, err error) { + req, err := client.EnablePreparer(resourceGroupName, workflowName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", nil, "Failure preparing request") + return + } + + resp, err := client.EnableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", resp, "Failure sending request") + return + } + + result, err = client.EnableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Enable", resp, "Failure responding to request") + } + + return +} + +// EnablePreparer prepares the Enable request. +func (client WorkflowsClient) EnablePreparer(resourceGroupName string, workflowName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/enable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EnableSender sends the Enable request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) EnableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EnableResponder handles the response to the Enable request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateUpgradedDefinition generates the upgraded definition for a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. parameters is parameters for generating an upgraded definition. +func (client WorkflowsClient) GenerateUpgradedDefinition(resourceGroupName string, workflowName string, parameters GenerateUpgradedDefinitionParameters) (result SetObject, err error) { + req, err := client.GenerateUpgradedDefinitionPreparer(resourceGroupName, workflowName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateUpgradedDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", resp, "Failure sending request") + return + } + + result, err = client.GenerateUpgradedDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "GenerateUpgradedDefinition", resp, "Failure responding to request") + } + + return +} + +// GenerateUpgradedDefinitionPreparer prepares the GenerateUpgradedDefinition request. +func (client WorkflowsClient) GenerateUpgradedDefinitionPreparer(resourceGroupName string, workflowName string, parameters GenerateUpgradedDefinitionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/generateUpgradedDefinition", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateUpgradedDefinitionSender sends the GenerateUpgradedDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) GenerateUpgradedDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateUpgradedDefinitionResponder handles the response to the GenerateUpgradedDefinition request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) GenerateUpgradedDefinitionResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. +func (client WorkflowsClient) Get(resourceGroupName string, workflowName string) (result Workflow, err error) { + req, err := client.GetPreparer(resourceGroupName, workflowName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkflowsClient) GetPreparer(resourceGroupName string, workflowName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) GetResponder(resp *http.Response) (result Workflow, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets a list of workflows by resource group. +// +// resourceGroupName is the resource group name. top is the number of items to +// be included in the result. filter is the filter to apply on the operation. +func (client WorkflowsClient) ListByResourceGroup(resourceGroupName string, top *int32, filter string) (result WorkflowListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkflowsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) ListByResourceGroupResponder(resp *http.Response) (result WorkflowListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client WorkflowsClient) ListByResourceGroupNextResults(lastResults WorkflowListResult) (result WorkflowListResult, err error) { + req, err := lastResults.WorkflowListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription gets a list of workflows by subscription. +// +// top is the number of items to be included in the result. filter is the +// filter to apply on the operation. +func (client WorkflowsClient) ListBySubscription(top *int32, filter string) (result WorkflowListResult, err error) { + req, err := client.ListBySubscriptionPreparer(top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WorkflowsClient) ListBySubscriptionPreparer(top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) ListBySubscriptionResponder(resp *http.Response) (result WorkflowListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client WorkflowsClient) ListBySubscriptionNextResults(lastResults WorkflowListResult) (result WorkflowListResult, err error) { + req, err := lastResults.WorkflowListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListSwagger gets an OpenAPI definition for the workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. +func (client WorkflowsClient) ListSwagger(resourceGroupName string, workflowName string) (result SetObject, err error) { + req, err := client.ListSwaggerPreparer(resourceGroupName, workflowName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", nil, "Failure preparing request") + return + } + + resp, err := client.ListSwaggerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", resp, "Failure sending request") + return + } + + result, err = client.ListSwaggerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "ListSwagger", resp, "Failure responding to request") + } + + return +} + +// ListSwaggerPreparer prepares the ListSwagger request. +func (client WorkflowsClient) ListSwaggerPreparer(resourceGroupName string, workflowName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/listSwagger", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSwaggerSender sends the ListSwagger request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) ListSwaggerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSwaggerResponder handles the response to the ListSwagger request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) ListSwaggerResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateAccessKey regenerates the callback URL access key for request +// triggers. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. keyType is the access key type. +func (client WorkflowsClient) RegenerateAccessKey(resourceGroupName string, workflowName string, keyType RegenerateActionParameter) (result autorest.Response, err error) { + req, err := client.RegenerateAccessKeyPreparer(resourceGroupName, workflowName, keyType) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateAccessKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateAccessKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "RegenerateAccessKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateAccessKeyPreparer prepares the RegenerateAccessKey request. +func (client WorkflowsClient) RegenerateAccessKeyPreparer(resourceGroupName string, workflowName string, keyType RegenerateActionParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/regenerateAccessKey", pathParameters), + autorest.WithJSON(keyType), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateAccessKeySender sends the RegenerateAccessKey request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) RegenerateAccessKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateAccessKeyResponder handles the response to the RegenerateAccessKey request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) RegenerateAccessKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a workflow. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. workflow is the workflow. +func (client WorkflowsClient) Update(resourceGroupName string, workflowName string, workflow Workflow) (result Workflow, err error) { + req, err := client.UpdatePreparer(resourceGroupName, workflowName, workflow) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkflowsClient) UpdatePreparer(resourceGroupName string, workflowName string, workflow Workflow) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}", pathParameters), + autorest.WithJSON(workflow), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) UpdateResponder(resp *http.Response) (result Workflow, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate validates the workflow definition. +// +// resourceGroupName is the resource group name. location is the workflow +// location. workflowName is the workflow name. workflow is the workflow +// definition. +func (client WorkflowsClient) Validate(resourceGroupName string, location string, workflowName string, workflow Workflow) (result autorest.Response, err error) { + req, err := client.ValidatePreparer(resourceGroupName, location, workflowName, workflow) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client WorkflowsClient) ValidatePreparer(resourceGroupName string, location string, workflowName string, workflow Workflow) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate", pathParameters), + autorest.WithJSON(workflow), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowsClient) ValidateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client WorkflowsClient) ValidateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggerhistories.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggerhistories.go index dde6c3f2fb..f83cf395e0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggerhistories.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggerhistories.go @@ -1,280 +1,280 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkflowTriggerHistoriesClient is the rEST API for Azure Logic Apps. -type WorkflowTriggerHistoriesClient struct { - ManagementClient -} - -// NewWorkflowTriggerHistoriesClient creates an instance of the -// WorkflowTriggerHistoriesClient client. -func NewWorkflowTriggerHistoriesClient(subscriptionID string) WorkflowTriggerHistoriesClient { - return NewWorkflowTriggerHistoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowTriggerHistoriesClientWithBaseURI creates an instance of the -// WorkflowTriggerHistoriesClient client. -func NewWorkflowTriggerHistoriesClientWithBaseURI(baseURI string, subscriptionID string) WorkflowTriggerHistoriesClient { - return WorkflowTriggerHistoriesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow trigger history. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. triggerName is the workflow trigger name. historyName is the workflow -// trigger history name. Corresponds to the run name for triggers that resulted -// in a run. -func (client WorkflowTriggerHistoriesClient) Get(resourceGroupName string, workflowName string, triggerName string, historyName string) (result WorkflowTriggerHistory, err error) { - req, err := client.GetPreparer(resourceGroupName, workflowName, triggerName, historyName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowTriggerHistoriesClient) GetPreparer(resourceGroupName string, workflowName string, triggerName string, historyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "historyName": autorest.Encode("path", historyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggerHistoriesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowTriggerHistoriesClient) GetResponder(resp *http.Response) (result WorkflowTriggerHistory, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow trigger histories. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. triggerName is the workflow trigger name. top is the number of items -// to be included in the result. filter is the filter to apply on the -// operation. -func (client WorkflowTriggerHistoriesClient) List(resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (result WorkflowTriggerHistoryListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, workflowName, triggerName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowTriggerHistoriesClient) ListPreparer(resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggerHistoriesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowTriggerHistoriesClient) ListResponder(resp *http.Response) (result WorkflowTriggerHistoryListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client WorkflowTriggerHistoriesClient) ListNextResults(lastResults WorkflowTriggerHistoryListResult) (result WorkflowTriggerHistoryListResult, err error) { - req, err := lastResults.WorkflowTriggerHistoryListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Resubmit resubmits a workflow run based on the trigger history. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. triggerName is the workflow trigger name. historyName is the workflow -// trigger history name. Corresponds to the run name for triggers that resulted -// in a run. -func (client WorkflowTriggerHistoriesClient) Resubmit(resourceGroupName string, workflowName string, triggerName string, historyName string) (result autorest.Response, err error) { - req, err := client.ResubmitPreparer(resourceGroupName, workflowName, triggerName, historyName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", nil, "Failure preparing request") - return - } - - resp, err := client.ResubmitSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", resp, "Failure sending request") - return - } - - result, err = client.ResubmitResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", resp, "Failure responding to request") - } - - return -} - -// ResubmitPreparer prepares the Resubmit request. -func (client WorkflowTriggerHistoriesClient) ResubmitPreparer(resourceGroupName string, workflowName string, triggerName string, historyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "historyName": autorest.Encode("path", historyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}/resubmit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResubmitSender sends the Resubmit request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggerHistoriesClient) ResubmitSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResubmitResponder handles the response to the Resubmit request. The method always -// closes the http.Response Body. -func (client WorkflowTriggerHistoriesClient) ResubmitResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkflowTriggerHistoriesClient is the rEST API for Azure Logic Apps. +type WorkflowTriggerHistoriesClient struct { + ManagementClient +} + +// NewWorkflowTriggerHistoriesClient creates an instance of the +// WorkflowTriggerHistoriesClient client. +func NewWorkflowTriggerHistoriesClient(subscriptionID string) WorkflowTriggerHistoriesClient { + return NewWorkflowTriggerHistoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkflowTriggerHistoriesClientWithBaseURI creates an instance of the +// WorkflowTriggerHistoriesClient client. +func NewWorkflowTriggerHistoriesClientWithBaseURI(baseURI string, subscriptionID string) WorkflowTriggerHistoriesClient { + return WorkflowTriggerHistoriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a workflow trigger history. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. triggerName is the workflow trigger name. historyName is the workflow +// trigger history name. Corresponds to the run name for triggers that resulted +// in a run. +func (client WorkflowTriggerHistoriesClient) Get(resourceGroupName string, workflowName string, triggerName string, historyName string) (result WorkflowTriggerHistory, err error) { + req, err := client.GetPreparer(resourceGroupName, workflowName, triggerName, historyName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkflowTriggerHistoriesClient) GetPreparer(resourceGroupName string, workflowName string, triggerName string, historyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "historyName": autorest.Encode("path", historyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggerHistoriesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkflowTriggerHistoriesClient) GetResponder(resp *http.Response) (result WorkflowTriggerHistory, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of workflow trigger histories. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. triggerName is the workflow trigger name. top is the number of items +// to be included in the result. filter is the filter to apply on the +// operation. +func (client WorkflowTriggerHistoriesClient) List(resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (result WorkflowTriggerHistoryListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, workflowName, triggerName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkflowTriggerHistoriesClient) ListPreparer(resourceGroupName string, workflowName string, triggerName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggerHistoriesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkflowTriggerHistoriesClient) ListResponder(resp *http.Response) (result WorkflowTriggerHistoryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client WorkflowTriggerHistoriesClient) ListNextResults(lastResults WorkflowTriggerHistoryListResult) (result WorkflowTriggerHistoryListResult, err error) { + req, err := lastResults.WorkflowTriggerHistoryListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Resubmit resubmits a workflow run based on the trigger history. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. triggerName is the workflow trigger name. historyName is the workflow +// trigger history name. Corresponds to the run name for triggers that resulted +// in a run. +func (client WorkflowTriggerHistoriesClient) Resubmit(resourceGroupName string, workflowName string, triggerName string, historyName string) (result autorest.Response, err error) { + req, err := client.ResubmitPreparer(resourceGroupName, workflowName, triggerName, historyName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", nil, "Failure preparing request") + return + } + + resp, err := client.ResubmitSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", resp, "Failure sending request") + return + } + + result, err = client.ResubmitResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggerHistoriesClient", "Resubmit", resp, "Failure responding to request") + } + + return +} + +// ResubmitPreparer prepares the Resubmit request. +func (client WorkflowTriggerHistoriesClient) ResubmitPreparer(resourceGroupName string, workflowName string, triggerName string, historyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "historyName": autorest.Encode("path", historyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}/resubmit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResubmitSender sends the Resubmit request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggerHistoriesClient) ResubmitSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResubmitResponder handles the response to the Resubmit request. The method always +// closes the http.Response Body. +func (client WorkflowTriggerHistoriesClient) ResubmitResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggers.go index c41f3bd70c..e374b14e9f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowtriggers.go @@ -1,340 +1,340 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkflowTriggersClient is the rEST API for Azure Logic Apps. -type WorkflowTriggersClient struct { - ManagementClient -} - -// NewWorkflowTriggersClient creates an instance of the WorkflowTriggersClient -// client. -func NewWorkflowTriggersClient(subscriptionID string) WorkflowTriggersClient { - return NewWorkflowTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowTriggersClientWithBaseURI creates an instance of the -// WorkflowTriggersClient client. -func NewWorkflowTriggersClientWithBaseURI(baseURI string, subscriptionID string) WorkflowTriggersClient { - return WorkflowTriggersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow trigger. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. triggerName is the workflow trigger name. -func (client WorkflowTriggersClient) Get(resourceGroupName string, workflowName string, triggerName string) (result WorkflowTrigger, err error) { - req, err := client.GetPreparer(resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowTriggersClient) GetPreparer(resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) GetResponder(resp *http.Response) (result WorkflowTrigger, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow triggers. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. top is the number of items to be included in the result. filter is the -// filter to apply on the operation. -func (client WorkflowTriggersClient) List(resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowTriggerListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, workflowName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowTriggersClient) ListPreparer(resourceGroupName string, workflowName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) ListResponder(resp *http.Response) (result WorkflowTriggerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client WorkflowTriggersClient) ListNextResults(lastResults WorkflowTriggerListResult) (result WorkflowTriggerListResult, err error) { - req, err := lastResults.WorkflowTriggerListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListCallbackURL gets the callback URL for a workflow trigger. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. triggerName is the workflow trigger name. -func (client WorkflowTriggersClient) ListCallbackURL(resourceGroupName string, workflowName string, triggerName string) (result WorkflowTriggerCallbackURL, err error) { - req, err := client.ListCallbackURLPreparer(resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", resp, "Failure responding to request") - } - - return -} - -// ListCallbackURLPreparer prepares the ListCallbackURL request. -func (client WorkflowTriggersClient) ListCallbackURLPreparer(resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/listCallbackUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListCallbackURLSender sends the ListCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Run runs a workflow trigger. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. triggerName is the workflow trigger name. -func (client WorkflowTriggersClient) Run(resourceGroupName string, workflowName string, triggerName string) (result SetObject, err error) { - req, err := client.RunPreparer(resourceGroupName, workflowName, triggerName) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", nil, "Failure preparing request") - return - } - - resp, err := client.RunSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", resp, "Failure sending request") - return - } - - result, err = client.RunResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", resp, "Failure responding to request") - } - - return -} - -// RunPreparer prepares the Run request. -func (client WorkflowTriggersClient) RunPreparer(resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/run", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RunSender sends the Run request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowTriggersClient) RunSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RunResponder handles the response to the Run request. The method always -// closes the http.Response Body. -func (client WorkflowTriggersClient) RunResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkflowTriggersClient is the rEST API for Azure Logic Apps. +type WorkflowTriggersClient struct { + ManagementClient +} + +// NewWorkflowTriggersClient creates an instance of the WorkflowTriggersClient +// client. +func NewWorkflowTriggersClient(subscriptionID string) WorkflowTriggersClient { + return NewWorkflowTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkflowTriggersClientWithBaseURI creates an instance of the +// WorkflowTriggersClient client. +func NewWorkflowTriggersClientWithBaseURI(baseURI string, subscriptionID string) WorkflowTriggersClient { + return WorkflowTriggersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a workflow trigger. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. triggerName is the workflow trigger name. +func (client WorkflowTriggersClient) Get(resourceGroupName string, workflowName string, triggerName string) (result WorkflowTrigger, err error) { + req, err := client.GetPreparer(resourceGroupName, workflowName, triggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkflowTriggersClient) GetPreparer(resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkflowTriggersClient) GetResponder(resp *http.Response) (result WorkflowTrigger, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of workflow triggers. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. top is the number of items to be included in the result. filter is the +// filter to apply on the operation. +func (client WorkflowTriggersClient) List(resourceGroupName string, workflowName string, top *int32, filter string) (result WorkflowTriggerListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, workflowName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkflowTriggersClient) ListPreparer(resourceGroupName string, workflowName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkflowTriggersClient) ListResponder(resp *http.Response) (result WorkflowTriggerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client WorkflowTriggersClient) ListNextResults(lastResults WorkflowTriggerListResult) (result WorkflowTriggerListResult, err error) { + req, err := lastResults.WorkflowTriggerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListCallbackURL gets the callback URL for a workflow trigger. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. triggerName is the workflow trigger name. +func (client WorkflowTriggersClient) ListCallbackURL(resourceGroupName string, workflowName string, triggerName string) (result WorkflowTriggerCallbackURL, err error) { + req, err := client.ListCallbackURLPreparer(resourceGroupName, workflowName, triggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", nil, "Failure preparing request") + return + } + + resp, err := client.ListCallbackURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", resp, "Failure sending request") + return + } + + result, err = client.ListCallbackURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "ListCallbackURL", resp, "Failure responding to request") + } + + return +} + +// ListCallbackURLPreparer prepares the ListCallbackURL request. +func (client WorkflowTriggersClient) ListCallbackURLPreparer(resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/listCallbackUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCallbackURLSender sends the ListCallbackURL request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggersClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always +// closes the http.Response Body. +func (client WorkflowTriggersClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Run runs a workflow trigger. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. triggerName is the workflow trigger name. +func (client WorkflowTriggersClient) Run(resourceGroupName string, workflowName string, triggerName string) (result SetObject, err error) { + req, err := client.RunPreparer(resourceGroupName, workflowName, triggerName) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", nil, "Failure preparing request") + return + } + + resp, err := client.RunSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", resp, "Failure sending request") + return + } + + result, err = client.RunResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowTriggersClient", "Run", resp, "Failure responding to request") + } + + return +} + +// RunPreparer prepares the Run request. +func (client WorkflowTriggersClient) RunPreparer(resourceGroupName string, workflowName string, triggerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/run", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RunSender sends the Run request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowTriggersClient) RunSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RunResponder handles the response to the Run request. The method always +// closes the http.Response Body. +func (client WorkflowTriggersClient) RunResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowversions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowversions.go index 9925a7d209..9db33e9b43 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowversions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/logic/workflowversions.go @@ -1,276 +1,276 @@ -package logic - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkflowVersionsClient is the rEST API for Azure Logic Apps. -type WorkflowVersionsClient struct { - ManagementClient -} - -// NewWorkflowVersionsClient creates an instance of the WorkflowVersionsClient -// client. -func NewWorkflowVersionsClient(subscriptionID string) WorkflowVersionsClient { - return NewWorkflowVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkflowVersionsClientWithBaseURI creates an instance of the -// WorkflowVersionsClient client. -func NewWorkflowVersionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowVersionsClient { - return WorkflowVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a workflow version. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. versionID is the workflow versionId. -func (client WorkflowVersionsClient) Get(resourceGroupName string, workflowName string, versionID string) (result WorkflowVersion, err error) { - req, err := client.GetPreparer(resourceGroupName, workflowName, versionID) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkflowVersionsClient) GetPreparer(resourceGroupName string, workflowName string, versionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "versionId": autorest.Encode("path", versionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowVersionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkflowVersionsClient) GetResponder(resp *http.Response) (result WorkflowVersion, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of workflow versions. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. top is the number of items to be included in the result. -func (client WorkflowVersionsClient) List(resourceGroupName string, workflowName string, top *int32) (result WorkflowVersionListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, workflowName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkflowVersionsClient) ListPreparer(resourceGroupName string, workflowName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkflowVersionsClient) ListResponder(resp *http.Response) (result WorkflowVersionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client WorkflowVersionsClient) ListNextResults(lastResults WorkflowVersionListResult) (result WorkflowVersionListResult, err error) { - req, err := lastResults.WorkflowVersionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListCallbackURL lists the callback URL for a trigger of a workflow version. -// -// resourceGroupName is the resource group name. workflowName is the workflow -// name. versionID is the workflow versionId. triggerName is the workflow -// trigger name. parameters is the callback URL parameters. -func (client WorkflowVersionsClient) ListCallbackURL(resourceGroupName string, workflowName string, versionID string, triggerName string, parameters *GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { - req, err := client.ListCallbackURLPreparer(resourceGroupName, workflowName, versionID, triggerName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "ListCallbackURL", nil, "Failure preparing request") - return - } - - resp, err := client.ListCallbackURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "ListCallbackURL", resp, "Failure sending request") - return - } - - result, err = client.ListCallbackURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "ListCallbackURL", resp, "Failure responding to request") - } - - return -} - -// ListCallbackURLPreparer prepares the ListCallbackURL request. -func (client WorkflowVersionsClient) ListCallbackURLPreparer(resourceGroupName string, workflowName string, versionID string, triggerName string, parameters *GetCallbackURLParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "triggerName": autorest.Encode("path", triggerName), - "versionId": autorest.Encode("path", versionID), - "workflowName": autorest.Encode("path", workflowName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}/triggers/{triggerName}/listCallbackUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare(&http.Request{}) -} - -// ListCallbackURLSender sends the ListCallbackURL request. The method will close the -// http.Response Body if it receives an error. -func (client WorkflowVersionsClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always -// closes the http.Response Body. -func (client WorkflowVersionsClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package logic + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkflowVersionsClient is the rEST API for Azure Logic Apps. +type WorkflowVersionsClient struct { + ManagementClient +} + +// NewWorkflowVersionsClient creates an instance of the WorkflowVersionsClient +// client. +func NewWorkflowVersionsClient(subscriptionID string) WorkflowVersionsClient { + return NewWorkflowVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkflowVersionsClientWithBaseURI creates an instance of the +// WorkflowVersionsClient client. +func NewWorkflowVersionsClientWithBaseURI(baseURI string, subscriptionID string) WorkflowVersionsClient { + return WorkflowVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a workflow version. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. versionID is the workflow versionId. +func (client WorkflowVersionsClient) Get(resourceGroupName string, workflowName string, versionID string) (result WorkflowVersion, err error) { + req, err := client.GetPreparer(resourceGroupName, workflowName, versionID) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkflowVersionsClient) GetPreparer(resourceGroupName string, workflowName string, versionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "versionId": autorest.Encode("path", versionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowVersionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkflowVersionsClient) GetResponder(resp *http.Response) (result WorkflowVersion, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of workflow versions. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. top is the number of items to be included in the result. +func (client WorkflowVersionsClient) List(resourceGroupName string, workflowName string, top *int32) (result WorkflowVersionListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, workflowName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkflowVersionsClient) ListPreparer(resourceGroupName string, workflowName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkflowVersionsClient) ListResponder(resp *http.Response) (result WorkflowVersionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client WorkflowVersionsClient) ListNextResults(lastResults WorkflowVersionListResult) (result WorkflowVersionListResult, err error) { + req, err := lastResults.WorkflowVersionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListCallbackURL lists the callback URL for a trigger of a workflow version. +// +// resourceGroupName is the resource group name. workflowName is the workflow +// name. versionID is the workflow versionId. triggerName is the workflow +// trigger name. parameters is the callback URL parameters. +func (client WorkflowVersionsClient) ListCallbackURL(resourceGroupName string, workflowName string, versionID string, triggerName string, parameters *GetCallbackURLParameters) (result WorkflowTriggerCallbackURL, err error) { + req, err := client.ListCallbackURLPreparer(resourceGroupName, workflowName, versionID, triggerName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "ListCallbackURL", nil, "Failure preparing request") + return + } + + resp, err := client.ListCallbackURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "ListCallbackURL", resp, "Failure sending request") + return + } + + result, err = client.ListCallbackURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logic.WorkflowVersionsClient", "ListCallbackURL", resp, "Failure responding to request") + } + + return +} + +// ListCallbackURLPreparer prepares the ListCallbackURL request. +func (client WorkflowVersionsClient) ListCallbackURLPreparer(resourceGroupName string, workflowName string, versionID string, triggerName string, parameters *GetCallbackURLParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "triggerName": autorest.Encode("path", triggerName), + "versionId": autorest.Encode("path", versionID), + "workflowName": autorest.Encode("path", workflowName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}/triggers/{triggerName}/listCallbackUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare(&http.Request{}) +} + +// ListCallbackURLSender sends the ListCallbackURL request. The method will close the +// http.Response Body if it receives an error. +func (client WorkflowVersionsClient) ListCallbackURLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCallbackURLResponder handles the response to the ListCallbackURL request. The method always +// closes the http.Response Body. +func (client WorkflowVersionsClient) ListCallbackURLResponder(resp *http.Response) (result WorkflowTriggerCallbackURL, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/client.go index eda9d3c086..c4d5300c80 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/client.go @@ -1,57 +1,57 @@ -// Package commitmentplans implements the Azure ARM Commitmentplans service API -// version 2016-05-01-preview. -// -// These APIs allow end users to operate on Azure Machine Learning Commitment -// Plans resources and their child Commitment Association resources. They -// support CRUD operations for commitment plans, get and list operations for -// commitment associations, moving commitment associations between commitment -// plans, and retrieving commitment plan usage history. -package commitmentplans - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Commitmentplans - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Commitmentplans. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package commitmentplans implements the Azure ARM Commitmentplans service API +// version 2016-05-01-preview. +// +// These APIs allow end users to operate on Azure Machine Learning Commitment +// Plans resources and their child Commitment Association resources. They +// support CRUD operations for commitment plans, get and list operations for +// commitment associations, moving commitment associations between commitment +// plans, and retrieving commitment plan usage history. +package commitmentplans + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Commitmentplans + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Commitmentplans. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentassociations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentassociations.go index a07b278eb8..7e72a61034 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentassociations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentassociations.go @@ -1,279 +1,279 @@ -package commitmentplans - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// CommitmentAssociationsClient is the these APIs allow end users to operate on -// Azure Machine Learning Commitment Plans resources and their child Commitment -// Association resources. They support CRUD operations for commitment plans, -// get and list operations for commitment associations, moving commitment -// associations between commitment plans, and retrieving commitment plan usage -// history. -type CommitmentAssociationsClient struct { - ManagementClient -} - -// NewCommitmentAssociationsClient creates an instance of the -// CommitmentAssociationsClient client. -func NewCommitmentAssociationsClient(subscriptionID string) CommitmentAssociationsClient { - return NewCommitmentAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCommitmentAssociationsClientWithBaseURI creates an instance of the -// CommitmentAssociationsClient client. -func NewCommitmentAssociationsClientWithBaseURI(baseURI string, subscriptionID string) CommitmentAssociationsClient { - return CommitmentAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a commitment association. -// -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. commitmentAssociationName is the commitment -// association name. -func (client CommitmentAssociationsClient) Get(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string) (result CommitmentAssociation, err error) { - req, err := client.GetPreparer(resourceGroupName, commitmentPlanName, commitmentAssociationName) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CommitmentAssociationsClient) GetPreparer(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentAssociationName": autorest.Encode("path", commitmentAssociationName), - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations/{commitmentAssociationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CommitmentAssociationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CommitmentAssociationsClient) GetResponder(resp *http.Response) (result CommitmentAssociation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all commitment associations for a parent commitment plan. -// -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. skipToken is continuation token for -// pagination. -func (client CommitmentAssociationsClient) List(resourceGroupName string, commitmentPlanName string, skipToken string) (result CommitmentAssociationListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, commitmentPlanName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client CommitmentAssociationsClient) ListPreparer(resourceGroupName string, commitmentPlanName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client CommitmentAssociationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client CommitmentAssociationsClient) ListResponder(resp *http.Response) (result CommitmentAssociationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client CommitmentAssociationsClient) ListNextResults(lastResults CommitmentAssociationListResult) (result CommitmentAssociationListResult, err error) { - req, err := lastResults.CommitmentAssociationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Move re-parent a commitment association from one commitment plan to another. -// -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. commitmentAssociationName is the commitment -// association name. movePayload is the move request payload. -func (client CommitmentAssociationsClient) Move(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string, movePayload MoveCommitmentAssociationRequest) (result CommitmentAssociation, err error) { - req, err := client.MovePreparer(resourceGroupName, commitmentPlanName, commitmentAssociationName, movePayload) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", nil, "Failure preparing request") - return - } - - resp, err := client.MoveSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", resp, "Failure sending request") - return - } - - result, err = client.MoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", resp, "Failure responding to request") - } - - return -} - -// MovePreparer prepares the Move request. -func (client CommitmentAssociationsClient) MovePreparer(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string, movePayload MoveCommitmentAssociationRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentAssociationName": autorest.Encode("path", commitmentAssociationName), - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations/{commitmentAssociationName}/move", pathParameters), - autorest.WithJSON(movePayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MoveSender sends the Move request. The method will close the -// http.Response Body if it receives an error. -func (client CommitmentAssociationsClient) MoveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MoveResponder handles the response to the Move request. The method always -// closes the http.Response Body. -func (client CommitmentAssociationsClient) MoveResponder(resp *http.Response) (result CommitmentAssociation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package commitmentplans + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// CommitmentAssociationsClient is the these APIs allow end users to operate on +// Azure Machine Learning Commitment Plans resources and their child Commitment +// Association resources. They support CRUD operations for commitment plans, +// get and list operations for commitment associations, moving commitment +// associations between commitment plans, and retrieving commitment plan usage +// history. +type CommitmentAssociationsClient struct { + ManagementClient +} + +// NewCommitmentAssociationsClient creates an instance of the +// CommitmentAssociationsClient client. +func NewCommitmentAssociationsClient(subscriptionID string) CommitmentAssociationsClient { + return NewCommitmentAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCommitmentAssociationsClientWithBaseURI creates an instance of the +// CommitmentAssociationsClient client. +func NewCommitmentAssociationsClientWithBaseURI(baseURI string, subscriptionID string) CommitmentAssociationsClient { + return CommitmentAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get a commitment association. +// +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. commitmentAssociationName is the commitment +// association name. +func (client CommitmentAssociationsClient) Get(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string) (result CommitmentAssociation, err error) { + req, err := client.GetPreparer(resourceGroupName, commitmentPlanName, commitmentAssociationName) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CommitmentAssociationsClient) GetPreparer(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentAssociationName": autorest.Encode("path", commitmentAssociationName), + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations/{commitmentAssociationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CommitmentAssociationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CommitmentAssociationsClient) GetResponder(resp *http.Response) (result CommitmentAssociation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all commitment associations for a parent commitment plan. +// +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. skipToken is continuation token for +// pagination. +func (client CommitmentAssociationsClient) List(resourceGroupName string, commitmentPlanName string, skipToken string) (result CommitmentAssociationListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, commitmentPlanName, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client CommitmentAssociationsClient) ListPreparer(resourceGroupName string, commitmentPlanName string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CommitmentAssociationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CommitmentAssociationsClient) ListResponder(resp *http.Response) (result CommitmentAssociationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client CommitmentAssociationsClient) ListNextResults(lastResults CommitmentAssociationListResult) (result CommitmentAssociationListResult, err error) { + req, err := lastResults.CommitmentAssociationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Move re-parent a commitment association from one commitment plan to another. +// +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. commitmentAssociationName is the commitment +// association name. movePayload is the move request payload. +func (client CommitmentAssociationsClient) Move(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string, movePayload MoveCommitmentAssociationRequest) (result CommitmentAssociation, err error) { + req, err := client.MovePreparer(resourceGroupName, commitmentPlanName, commitmentAssociationName, movePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", nil, "Failure preparing request") + return + } + + resp, err := client.MoveSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", resp, "Failure sending request") + return + } + + result, err = client.MoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.CommitmentAssociationsClient", "Move", resp, "Failure responding to request") + } + + return +} + +// MovePreparer prepares the Move request. +func (client CommitmentAssociationsClient) MovePreparer(resourceGroupName string, commitmentPlanName string, commitmentAssociationName string, movePayload MoveCommitmentAssociationRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentAssociationName": autorest.Encode("path", commitmentAssociationName), + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/commitmentAssociations/{commitmentAssociationName}/move", pathParameters), + autorest.WithJSON(movePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MoveSender sends the Move request. The method will close the +// http.Response Body if it receives an error. +func (client CommitmentAssociationsClient) MoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MoveResponder handles the response to the Move request. The method always +// closes the http.Response Body. +func (client CommitmentAssociationsClient) MoveResponder(resp *http.Response) (result CommitmentAssociation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentplansgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentplansgroup.go index 101d1b1b34..d3ab0eb884 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentplansgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/commitmentplansgroup.go @@ -1,499 +1,499 @@ -package commitmentplans - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// GroupClient is the these APIs allow end users to operate on Azure Machine -// Learning Commitment Plans resources and their child Commitment Association -// resources. They support CRUD operations for commitment plans, get and list -// operations for commitment associations, moving commitment associations -// between commitment plans, and retrieving commitment plan usage history. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new Azure ML commitment plan resource or updates an -// existing one. -// -// createOrUpdatePayload is the payload to create or update the Azure ML -// commitment plan. resourceGroupName is the resource group name. -// commitmentPlanName is the Azure ML commitment plan name. -func (client GroupClient) CreateOrUpdate(createOrUpdatePayload CommitmentPlan, resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) { - req, err := client.CreateOrUpdatePreparer(createOrUpdatePayload, resourceGroupName, commitmentPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(createOrUpdatePayload CommitmentPlan, resourceGroupName string, commitmentPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), - autorest.WithJSON(createOrUpdatePayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result CommitmentPlan, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieve an Azure ML commitment plan by its subscription, resource group -// and name. -// -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. -func (client GroupClient) Get(resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) { - req, err := client.GetPreparer(resourceGroupName, commitmentPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, commitmentPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result CommitmentPlan, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List retrieve all Azure ML commitment plans in a subscription. -// -// skipToken is continuation token for pagination. -func (client GroupClient) List(skipToken string) (result ListResult, err error) { - req, err := client.ListPreparer(skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer(skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/commitmentPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListInResourceGroup retrieve all Azure ML commitment plans in a resource -// group. -// -// resourceGroupName is the resource group name. skipToken is continuation -// token for pagination. -func (client GroupClient) ListInResourceGroup(resourceGroupName string, skipToken string) (result ListResult, err error) { - req, err := client.ListInResourceGroupPreparer(resourceGroupName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListInResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListInResourceGroupPreparer prepares the ListInResourceGroup request. -func (client GroupClient) ListInResourceGroupPreparer(resourceGroupName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListInResourceGroupSender sends the ListInResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListInResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListInResourceGroupResponder handles the response to the ListInResourceGroup request. The method always -// closes the http.Response Body. -func (client GroupClient) ListInResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInResourceGroupNextResults retrieves the next set of results, if any. -func (client GroupClient) ListInResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListInResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Patch patch an existing Azure ML commitment plan resource. -// -// patchPayload is the payload to use to patch the Azure ML commitment plan. -// Only tags and SKU may be modified on an existing commitment plan. -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. -func (client GroupClient) Patch(patchPayload PatchPayload, resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) { - req, err := client.PatchPreparer(patchPayload, resourceGroupName, commitmentPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", resp, "Failure responding to request") - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client GroupClient) PatchPreparer(patchPayload PatchPayload, resourceGroupName string, commitmentPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), - autorest.WithJSON(patchPayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client GroupClient) PatchResponder(resp *http.Response) (result CommitmentPlan, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Remove remove an existing Azure ML commitment plan. -// -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. -func (client GroupClient) Remove(resourceGroupName string, commitmentPlanName string) (result autorest.Response, err error) { - req, err := client.RemovePreparer(resourceGroupName, commitmentPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", resp, "Failure sending request") - return - } - - result, err = client.RemoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", resp, "Failure responding to request") - } - - return -} - -// RemovePreparer prepares the Remove request. -func (client GroupClient) RemovePreparer(resourceGroupName string, commitmentPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RemoveSender sends the Remove request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RemoveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RemoveResponder handles the response to the Remove request. The method always -// closes the http.Response Body. -func (client GroupClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package commitmentplans + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// GroupClient is the these APIs allow end users to operate on Azure Machine +// Learning Commitment Plans resources and their child Commitment Association +// resources. They support CRUD operations for commitment plans, get and list +// operations for commitment associations, moving commitment associations +// between commitment plans, and retrieving commitment plan usage history. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Azure ML commitment plan resource or updates an +// existing one. +// +// createOrUpdatePayload is the payload to create or update the Azure ML +// commitment plan. resourceGroupName is the resource group name. +// commitmentPlanName is the Azure ML commitment plan name. +func (client GroupClient) CreateOrUpdate(createOrUpdatePayload CommitmentPlan, resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) { + req, err := client.CreateOrUpdatePreparer(createOrUpdatePayload, resourceGroupName, commitmentPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupClient) CreateOrUpdatePreparer(createOrUpdatePayload CommitmentPlan, resourceGroupName string, commitmentPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), + autorest.WithJSON(createOrUpdatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result CommitmentPlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieve an Azure ML commitment plan by its subscription, resource group +// and name. +// +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. +func (client GroupClient) Get(resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) { + req, err := client.GetPreparer(resourceGroupName, commitmentPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, commitmentPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result CommitmentPlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieve all Azure ML commitment plans in a subscription. +// +// skipToken is continuation token for pagination. +func (client GroupClient) List(skipToken string) (result ListResult, err error) { + req, err := client.ListPreparer(skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer(skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/commitmentPlans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListInResourceGroup retrieve all Azure ML commitment plans in a resource +// group. +// +// resourceGroupName is the resource group name. skipToken is continuation +// token for pagination. +func (client GroupClient) ListInResourceGroup(resourceGroupName string, skipToken string) (result ListResult, err error) { + req, err := client.ListInResourceGroupPreparer(resourceGroupName, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListInResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListInResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListInResourceGroupPreparer prepares the ListInResourceGroup request. +func (client GroupClient) ListInResourceGroupPreparer(resourceGroupName string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInResourceGroupSender sends the ListInResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListInResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInResourceGroupResponder handles the response to the ListInResourceGroup request. The method always +// closes the http.Response Body. +func (client GroupClient) ListInResourceGroupResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInResourceGroupNextResults retrieves the next set of results, if any. +func (client GroupClient) ListInResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListInResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "ListInResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Patch patch an existing Azure ML commitment plan resource. +// +// patchPayload is the payload to use to patch the Azure ML commitment plan. +// Only tags and SKU may be modified on an existing commitment plan. +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. +func (client GroupClient) Patch(patchPayload PatchPayload, resourceGroupName string, commitmentPlanName string) (result CommitmentPlan, err error) { + req, err := client.PatchPreparer(patchPayload, resourceGroupName, commitmentPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client GroupClient) PatchPreparer(patchPayload PatchPayload, resourceGroupName string, commitmentPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), + autorest.WithJSON(patchPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client GroupClient) PatchResponder(resp *http.Response) (result CommitmentPlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Remove remove an existing Azure ML commitment plan. +// +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. +func (client GroupClient) Remove(resourceGroupName string, commitmentPlanName string) (result autorest.Response, err error) { + req, err := client.RemovePreparer(resourceGroupName, commitmentPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", resp, "Failure sending request") + return + } + + result, err = client.RemoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.GroupClient", "Remove", resp, "Failure responding to request") + } + + return +} + +// RemovePreparer prepares the Remove request. +func (client GroupClient) RemovePreparer(resourceGroupName string, commitmentPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RemoveSender sends the Remove request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RemoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RemoveResponder handles the response to the Remove request. The method always +// closes the http.Response Body. +func (client GroupClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/models.go index 79bf650c96..dc12d0ad67 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/models.go @@ -1,182 +1,182 @@ -package commitmentplans - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// CommitmentAssociation is represents the association between a commitment -// plan and some other resource, such as a Machine Learning web service. -type CommitmentAssociation struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - Properties *CommitmentAssociationProperties `json:"properties,omitempty"` -} - -// CommitmentAssociationListResult is a page of commitment association -// resources. -type CommitmentAssociationListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]CommitmentAssociation `json:"value,omitempty"` -} - -// CommitmentAssociationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CommitmentAssociationListResult) CommitmentAssociationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CommitmentAssociationProperties is properties of an Azure ML commitment -// association. -type CommitmentAssociationProperties struct { - AssociatedResourceID *string `json:"associatedResourceId,omitempty"` - CommitmentPlanID *string `json:"commitmentPlanId,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// CommitmentPlan is an Azure ML commitment plan resource. -type CommitmentPlan struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - Properties *Properties `json:"properties,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` -} - -// ListResult is a page of commitment plan resources. -type ListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]CommitmentPlan `json:"value,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MoveCommitmentAssociationRequest is specifies the destination Azure ML -// commitment plan for a move operation. -type MoveCommitmentAssociationRequest struct { - DestinationPlanID *string `json:"destinationPlanId,omitempty"` -} - -// PatchPayload is the properties of a commitment plan which may be updated via -// PATCH. -type PatchPayload struct { - Tags *map[string]*string `json:"tags,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` -} - -// PlanQuantity is represents the quantity a commitment plan provides of a -// metered resource. -type PlanQuantity struct { - Allowance *float64 `json:"allowance,omitempty"` - Amount *float64 `json:"amount,omitempty"` - IncludedQuantityMeter *string `json:"includedQuantityMeter,omitempty"` - OverageMeter *string `json:"overageMeter,omitempty"` -} - -// PlanUsageHistory is represents historical information about usage of the -// Azure resources associated with a commitment plan. -type PlanUsageHistory struct { - PlanDeletionOverage *map[string]*float64 `json:"planDeletionOverage,omitempty"` - PlanMigrationOverage *map[string]*float64 `json:"planMigrationOverage,omitempty"` - PlanQuantitiesAfterUsage *map[string]*float64 `json:"planQuantitiesAfterUsage,omitempty"` - PlanQuantitiesBeforeUsage *map[string]*float64 `json:"planQuantitiesBeforeUsage,omitempty"` - PlanUsageOverage *map[string]*float64 `json:"planUsageOverage,omitempty"` - Usage *map[string]*float64 `json:"usage,omitempty"` - UsageDate *date.Time `json:"usageDate,omitempty"` -} - -// PlanUsageHistoryListResult is a page of usage history. -type PlanUsageHistoryListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]PlanUsageHistory `json:"value,omitempty"` -} - -// PlanUsageHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PlanUsageHistoryListResult) PlanUsageHistoryListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Properties is properties of an Azure ML commitment plan. -type Properties struct { - ChargeForOverage *bool `json:"chargeForOverage,omitempty"` - ChargeForPlan *bool `json:"chargeForPlan,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` - IncludedQuantities *map[string]*PlanQuantity `json:"includedQuantities,omitempty"` - MaxAssociationLimit *int32 `json:"maxAssociationLimit,omitempty"` - MaxCapacityLimit *int32 `json:"maxCapacityLimit,omitempty"` - MinCapacityLimit *int32 `json:"minCapacityLimit,omitempty"` - PlanMeter *string `json:"planMeter,omitempty"` - RefillFrequencyInDays *int32 `json:"refillFrequencyInDays,omitempty"` - SuspendPlanOnOverage *bool `json:"suspendPlanOnOverage,omitempty"` -} - -// Resource is common properties of an ARM resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceSku is the SKU of a resource. -type ResourceSku struct { - Capacity *int32 `json:"capacity,omitempty"` - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` -} +package commitmentplans + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// CommitmentAssociation is represents the association between a commitment +// plan and some other resource, such as a Machine Learning web service. +type CommitmentAssociation struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + Properties *CommitmentAssociationProperties `json:"properties,omitempty"` +} + +// CommitmentAssociationListResult is a page of commitment association +// resources. +type CommitmentAssociationListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]CommitmentAssociation `json:"value,omitempty"` +} + +// CommitmentAssociationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CommitmentAssociationListResult) CommitmentAssociationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CommitmentAssociationProperties is properties of an Azure ML commitment +// association. +type CommitmentAssociationProperties struct { + AssociatedResourceID *string `json:"associatedResourceId,omitempty"` + CommitmentPlanID *string `json:"commitmentPlanId,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` +} + +// CommitmentPlan is an Azure ML commitment plan resource. +type CommitmentPlan struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + Properties *Properties `json:"properties,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` +} + +// ListResult is a page of commitment plan resources. +type ListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]CommitmentPlan `json:"value,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// MoveCommitmentAssociationRequest is specifies the destination Azure ML +// commitment plan for a move operation. +type MoveCommitmentAssociationRequest struct { + DestinationPlanID *string `json:"destinationPlanId,omitempty"` +} + +// PatchPayload is the properties of a commitment plan which may be updated via +// PATCH. +type PatchPayload struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` +} + +// PlanQuantity is represents the quantity a commitment plan provides of a +// metered resource. +type PlanQuantity struct { + Allowance *float64 `json:"allowance,omitempty"` + Amount *float64 `json:"amount,omitempty"` + IncludedQuantityMeter *string `json:"includedQuantityMeter,omitempty"` + OverageMeter *string `json:"overageMeter,omitempty"` +} + +// PlanUsageHistory is represents historical information about usage of the +// Azure resources associated with a commitment plan. +type PlanUsageHistory struct { + PlanDeletionOverage *map[string]*float64 `json:"planDeletionOverage,omitempty"` + PlanMigrationOverage *map[string]*float64 `json:"planMigrationOverage,omitempty"` + PlanQuantitiesAfterUsage *map[string]*float64 `json:"planQuantitiesAfterUsage,omitempty"` + PlanQuantitiesBeforeUsage *map[string]*float64 `json:"planQuantitiesBeforeUsage,omitempty"` + PlanUsageOverage *map[string]*float64 `json:"planUsageOverage,omitempty"` + Usage *map[string]*float64 `json:"usage,omitempty"` + UsageDate *date.Time `json:"usageDate,omitempty"` +} + +// PlanUsageHistoryListResult is a page of usage history. +type PlanUsageHistoryListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]PlanUsageHistory `json:"value,omitempty"` +} + +// PlanUsageHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PlanUsageHistoryListResult) PlanUsageHistoryListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Properties is properties of an Azure ML commitment plan. +type Properties struct { + ChargeForOverage *bool `json:"chargeForOverage,omitempty"` + ChargeForPlan *bool `json:"chargeForPlan,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + IncludedQuantities *map[string]*PlanQuantity `json:"includedQuantities,omitempty"` + MaxAssociationLimit *int32 `json:"maxAssociationLimit,omitempty"` + MaxCapacityLimit *int32 `json:"maxCapacityLimit,omitempty"` + MinCapacityLimit *int32 `json:"minCapacityLimit,omitempty"` + PlanMeter *string `json:"planMeter,omitempty"` + RefillFrequencyInDays *int32 `json:"refillFrequencyInDays,omitempty"` + SuspendPlanOnOverage *bool `json:"suspendPlanOnOverage,omitempty"` +} + +// Resource is common properties of an ARM resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceSku is the SKU of a resource. +type ResourceSku struct { + Capacity *int32 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/usagehistory.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/usagehistory.go index f0b156a8d9..3fa496d08a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/usagehistory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/usagehistory.go @@ -1,140 +1,140 @@ -package commitmentplans - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// UsageHistoryClient is the these APIs allow end users to operate on Azure -// Machine Learning Commitment Plans resources and their child Commitment -// Association resources. They support CRUD operations for commitment plans, -// get and list operations for commitment associations, moving commitment -// associations between commitment plans, and retrieving commitment plan usage -// history. -type UsageHistoryClient struct { - ManagementClient -} - -// NewUsageHistoryClient creates an instance of the UsageHistoryClient client. -func NewUsageHistoryClient(subscriptionID string) UsageHistoryClient { - return NewUsageHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsageHistoryClientWithBaseURI creates an instance of the -// UsageHistoryClient client. -func NewUsageHistoryClientWithBaseURI(baseURI string, subscriptionID string) UsageHistoryClient { - return UsageHistoryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieve the usage history for an Azure ML commitment plan. -// -// resourceGroupName is the resource group name. commitmentPlanName is the -// Azure ML commitment plan name. skipToken is continuation token for -// pagination. -func (client UsageHistoryClient) List(resourceGroupName string, commitmentPlanName string, skipToken string) (result PlanUsageHistoryListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, commitmentPlanName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsageHistoryClient) ListPreparer(resourceGroupName string, commitmentPlanName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "commitmentPlanName": autorest.Encode("path", commitmentPlanName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/usageHistory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsageHistoryClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsageHistoryClient) ListResponder(resp *http.Response) (result PlanUsageHistoryListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client UsageHistoryClient) ListNextResults(lastResults PlanUsageHistoryListResult) (result PlanUsageHistoryListResult, err error) { - req, err := lastResults.PlanUsageHistoryListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure responding to next results request") - } - - return -} +package commitmentplans + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// UsageHistoryClient is the these APIs allow end users to operate on Azure +// Machine Learning Commitment Plans resources and their child Commitment +// Association resources. They support CRUD operations for commitment plans, +// get and list operations for commitment associations, moving commitment +// associations between commitment plans, and retrieving commitment plan usage +// history. +type UsageHistoryClient struct { + ManagementClient +} + +// NewUsageHistoryClient creates an instance of the UsageHistoryClient client. +func NewUsageHistoryClient(subscriptionID string) UsageHistoryClient { + return NewUsageHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageHistoryClientWithBaseURI creates an instance of the +// UsageHistoryClient client. +func NewUsageHistoryClientWithBaseURI(baseURI string, subscriptionID string) UsageHistoryClient { + return UsageHistoryClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List retrieve the usage history for an Azure ML commitment plan. +// +// resourceGroupName is the resource group name. commitmentPlanName is the +// Azure ML commitment plan name. skipToken is continuation token for +// pagination. +func (client UsageHistoryClient) List(resourceGroupName string, commitmentPlanName string, skipToken string) (result PlanUsageHistoryListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, commitmentPlanName, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageHistoryClient) ListPreparer(resourceGroupName string, commitmentPlanName string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/commitmentPlans/{commitmentPlanName}/usageHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageHistoryClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageHistoryClient) ListResponder(resp *http.Response) (result PlanUsageHistoryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client UsageHistoryClient) ListNextResults(lastResults PlanUsageHistoryListResult) (result PlanUsageHistoryListResult, err error) { + req, err := lastResults.PlanUsageHistoryListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "commitmentplans.UsageHistoryClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/version.go index 6b563c68ae..6aca3510b4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/commitmentplans/version.go @@ -1,29 +1,29 @@ -package commitmentplans - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-commitmentplans/2016-05-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package commitmentplans + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-commitmentplans/2016-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/client.go index 5a3e409b86..24c7399fd7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/client.go @@ -1,58 +1,58 @@ -// Package webservices implements the Azure ARM Webservices service API version -// 2017-01-01. -// -// These APIs allow end users to operate on Azure Machine Learning Web Services -// resources. They support the following operations:
  • Create or update a -// web service
  • Get a web service
  • Patch a web -// service
  • Delete a web service
  • Get All Web Services in a -// Resource Group
  • Get All Web Services in a Subscription
  • Get -// Web Services Keys
-package webservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Webservices - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Webservices. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package webservices implements the Azure ARM Webservices service API version +// 2017-01-01. +// +// These APIs allow end users to operate on Azure Machine Learning Web Services +// resources. They support the following operations:
  • Create or update a +// web service
  • Get a web service
  • Patch a web +// service
  • Delete a web service
  • Get All Web Services in a +// Resource Group
  • Get All Web Services in a Subscription
  • Get +// Web Services Keys
+package webservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Webservices + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Webservices. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/models.go index 8c6a0ad900..c7235051d5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/models.go @@ -1,449 +1,449 @@ -package webservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AssetType enumerates the values for asset type. -type AssetType string - -const ( - // AssetTypeModule specifies the asset type module state for asset type. - AssetTypeModule AssetType = "Module" - // AssetTypeResource specifies the asset type resource state for asset - // type. - AssetTypeResource AssetType = "Resource" -) - -// ColumnFormat enumerates the values for column format. -type ColumnFormat string - -const ( - // Byte specifies the byte state for column format. - Byte ColumnFormat = "Byte" - // Char specifies the char state for column format. - Char ColumnFormat = "Char" - // Complex128 specifies the complex 128 state for column format. - Complex128 ColumnFormat = "Complex128" - // Complex64 specifies the complex 64 state for column format. - Complex64 ColumnFormat = "Complex64" - // DateTime specifies the date time state for column format. - DateTime ColumnFormat = "Date-time" - // DateTimeOffset specifies the date time offset state for column format. - DateTimeOffset ColumnFormat = "Date-timeOffset" - // Double specifies the double state for column format. - Double ColumnFormat = "Double" - // Duration specifies the duration state for column format. - Duration ColumnFormat = "Duration" - // Float specifies the float state for column format. - Float ColumnFormat = "Float" - // Int16 specifies the int 16 state for column format. - Int16 ColumnFormat = "Int16" - // Int32 specifies the int 32 state for column format. - Int32 ColumnFormat = "Int32" - // Int64 specifies the int 64 state for column format. - Int64 ColumnFormat = "Int64" - // Int8 specifies the int 8 state for column format. - Int8 ColumnFormat = "Int8" - // Uint16 specifies the uint 16 state for column format. - Uint16 ColumnFormat = "Uint16" - // Uint32 specifies the uint 32 state for column format. - Uint32 ColumnFormat = "Uint32" - // Uint64 specifies the uint 64 state for column format. - Uint64 ColumnFormat = "Uint64" - // Uint8 specifies the uint 8 state for column format. - Uint8 ColumnFormat = "Uint8" -) - -// ColumnType enumerates the values for column type. -type ColumnType string - -const ( - // Boolean specifies the boolean state for column type. - Boolean ColumnType = "Boolean" - // Integer specifies the integer state for column type. - Integer ColumnType = "Integer" - // Number specifies the number state for column type. - Number ColumnType = "Number" - // String specifies the string state for column type. - String ColumnType = "String" -) - -// DiagnosticsLevel enumerates the values for diagnostics level. -type DiagnosticsLevel string - -const ( - // All specifies the all state for diagnostics level. - All DiagnosticsLevel = "All" - // Error specifies the error state for diagnostics level. - Error DiagnosticsLevel = "Error" - // None specifies the none state for diagnostics level. - None DiagnosticsLevel = "None" -) - -// InputPortType enumerates the values for input port type. -type InputPortType string - -const ( - // Dataset specifies the dataset state for input port type. - Dataset InputPortType = "Dataset" -) - -// OutputPortType enumerates the values for output port type. -type OutputPortType string - -const ( - // OutputPortTypeDataset specifies the output port type dataset state for - // output port type. - OutputPortTypeDataset OutputPortType = "Dataset" -) - -// ParameterType enumerates the values for parameter type. -type ParameterType string - -const ( - // ParameterTypeBoolean specifies the parameter type boolean state for - // parameter type. - ParameterTypeBoolean ParameterType = "Boolean" - // ParameterTypeColumnPicker specifies the parameter type column picker - // state for parameter type. - ParameterTypeColumnPicker ParameterType = "ColumnPicker" - // ParameterTypeCredential specifies the parameter type credential state - // for parameter type. - ParameterTypeCredential ParameterType = "Credential" - // ParameterTypeDataGatewayName specifies the parameter type data gateway - // name state for parameter type. - ParameterTypeDataGatewayName ParameterType = "DataGatewayName" - // ParameterTypeDouble specifies the parameter type double state for - // parameter type. - ParameterTypeDouble ParameterType = "Double" - // ParameterTypeEnumerated specifies the parameter type enumerated state - // for parameter type. - ParameterTypeEnumerated ParameterType = "Enumerated" - // ParameterTypeFloat specifies the parameter type float state for - // parameter type. - ParameterTypeFloat ParameterType = "Float" - // ParameterTypeInt specifies the parameter type int state for parameter - // type. - ParameterTypeInt ParameterType = "Int" - // ParameterTypeMode specifies the parameter type mode state for parameter - // type. - ParameterTypeMode ParameterType = "Mode" - // ParameterTypeParameterRange specifies the parameter type parameter range - // state for parameter type. - ParameterTypeParameterRange ParameterType = "ParameterRange" - // ParameterTypeScript specifies the parameter type script state for - // parameter type. - ParameterTypeScript ParameterType = "Script" - // ParameterTypeString specifies the parameter type string state for - // parameter type. - ParameterTypeString ParameterType = "String" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "Failed" - // Provisioning specifies the provisioning state for provisioning state. - Provisioning ProvisioningState = "Provisioning" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" - // Unknown specifies the unknown state for provisioning state. - Unknown ProvisioningState = "Unknown" -) - -// AssetItem is information about an asset associated with the web service. -type AssetItem struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Type AssetType `json:"type,omitempty"` - LocationInfo *BlobLocation `json:"locationInfo,omitempty"` - InputPorts *map[string]*InputPort `json:"inputPorts,omitempty"` - OutputPorts *map[string]*OutputPort `json:"outputPorts,omitempty"` - Metadata *map[string]*string `json:"metadata,omitempty"` - Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"` -} - -// AsyncOperationErrorInfo is the error detail information for async operation -type AsyncOperationErrorInfo struct { - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` - Details *[]AsyncOperationErrorInfo `json:"details,omitempty"` -} - -// AsyncOperationStatus is azure async operation status. -type AsyncOperationStatus struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - PercentComplete *float64 `json:"percentComplete,omitempty"` - ErrorInfo *AsyncOperationErrorInfo `json:"errorInfo,omitempty"` -} - -// BlobLocation is describes the access location for a blob. -type BlobLocation struct { - URI *string `json:"uri,omitempty"` - Credentials *string `json:"credentials,omitempty"` -} - -// ColumnSpecification is swagger 2.0 schema for a column within the data table -// representing a web service input or output. See Swagger specification: -// http://swagger.io/specification/ -type ColumnSpecification struct { - Type ColumnType `json:"type,omitempty"` - Format ColumnFormat `json:"format,omitempty"` - Enum *[]map[string]interface{} `json:"enum,omitempty"` - XMsIsnullable *bool `json:"x-ms-isnullable,omitempty"` - XMsIsordered *bool `json:"x-ms-isordered,omitempty"` -} - -// CommitmentPlan is information about the machine learning commitment plan -// associated with the web service. -type CommitmentPlan struct { - ID *string `json:"id,omitempty"` -} - -// DiagnosticsConfiguration is diagnostics settings for an Azure ML web -// service. -type DiagnosticsConfiguration struct { - Level DiagnosticsLevel `json:"level,omitempty"` - Expiry *date.Time `json:"expiry,omitempty"` -} - -// ExampleRequest is sample input data for the service's input(s). -type ExampleRequest struct { - Inputs *map[string][][]map[string]interface{} `json:"inputs,omitempty"` - GlobalParameters *map[string]*map[string]interface{} `json:"globalParameters,omitempty"` -} - -// GraphEdge is defines an edge within the web service's graph. -type GraphEdge struct { - SourceNodeID *string `json:"sourceNodeId,omitempty"` - SourcePortID *string `json:"sourcePortId,omitempty"` - TargetNodeID *string `json:"targetNodeId,omitempty"` - TargetPortID *string `json:"targetPortId,omitempty"` -} - -// GraphNode is specifies a node in the web service graph. The node can either -// be an input, output or asset node, so only one of the corresponding id -// properties is populated at any given time. -type GraphNode struct { - AssetID *string `json:"assetId,omitempty"` - InputID *string `json:"inputId,omitempty"` - OutputID *string `json:"outputId,omitempty"` - Parameters *map[string]*Parameter `json:"parameters,omitempty"` -} - -// GraphPackage is defines the graph of modules making up the machine learning -// solution. -type GraphPackage struct { - Nodes *map[string]*GraphNode `json:"nodes,omitempty"` - Edges *[]GraphEdge `json:"edges,omitempty"` - GraphParameters *map[string]*GraphParameter `json:"graphParameters,omitempty"` -} - -// GraphParameter is defines a global parameter in the graph. -type GraphParameter struct { - Description *string `json:"description,omitempty"` - Type ParameterType `json:"type,omitempty"` - Links *[]GraphParameterLink `json:"links,omitempty"` -} - -// GraphParameterLink is association link for a graph global parameter to a -// node in the graph. -type GraphParameterLink struct { - NodeID *string `json:"nodeId,omitempty"` - ParameterKey *string `json:"parameterKey,omitempty"` -} - -// InputPort is asset input port -type InputPort struct { - Type InputPortType `json:"type,omitempty"` -} - -// Keys is access keys for the web service calls. -type Keys struct { - autorest.Response `json:"-"` - Primary *string `json:"primary,omitempty"` - Secondary *string `json:"secondary,omitempty"` -} - -// MachineLearningWorkspace is information about the machine learning workspace -// containing the experiment that is source for the web service. -type MachineLearningWorkspace struct { - ID *string `json:"id,omitempty"` -} - -// ModeValueInfo is nested parameter definition. -type ModeValueInfo struct { - InterfaceString *string `json:"interfaceString,omitempty"` - Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"` -} - -// ModuleAssetParameter is parameter definition for a module asset. -type ModuleAssetParameter struct { - Name *string `json:"name,omitempty"` - ParameterType *string `json:"parameterType,omitempty"` - ModeValuesInfo *map[string]*ModeValueInfo `json:"modeValuesInfo,omitempty"` -} - -// OutputPort is asset output port -type OutputPort struct { - Type OutputPortType `json:"type,omitempty"` -} - -// PaginatedWebServicesList is paginated list of web services. -type PaginatedWebServicesList struct { - autorest.Response `json:"-"` - Value *[]WebService `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PaginatedWebServicesListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PaginatedWebServicesList) PaginatedWebServicesListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Parameter is web Service Parameter object for node and global parameter -type Parameter struct { - Value *map[string]interface{} `json:"value,omitempty"` - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` -} - -// Properties is the set of properties specific to the Azure ML web service -// resource. -type Properties struct { - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - CreatedOn *date.Time `json:"createdOn,omitempty"` - ModifiedOn *date.Time `json:"modifiedOn,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Keys *Keys `json:"keys,omitempty"` - ReadOnly *bool `json:"readOnly,omitempty"` - SwaggerLocation *string `json:"swaggerLocation,omitempty"` - ExposeSampleData *bool `json:"exposeSampleData,omitempty"` - RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"` - Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"` - StorageAccount *StorageAccount `json:"storageAccount,omitempty"` - MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"` - CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"` - Input *ServiceInputOutputSpecification `json:"input,omitempty"` - Output *ServiceInputOutputSpecification `json:"output,omitempty"` - ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"` - Assets *map[string]*AssetItem `json:"assets,omitempty"` - Parameters *map[string]*Parameter `json:"parameters,omitempty"` - PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"` - PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"` -} - -// PropertiesForGraph is properties specific to a Graph based web service. -type PropertiesForGraph struct { - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - CreatedOn *date.Time `json:"createdOn,omitempty"` - ModifiedOn *date.Time `json:"modifiedOn,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Keys *Keys `json:"keys,omitempty"` - ReadOnly *bool `json:"readOnly,omitempty"` - SwaggerLocation *string `json:"swaggerLocation,omitempty"` - ExposeSampleData *bool `json:"exposeSampleData,omitempty"` - RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"` - Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"` - StorageAccount *StorageAccount `json:"storageAccount,omitempty"` - MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"` - CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"` - Input *ServiceInputOutputSpecification `json:"input,omitempty"` - Output *ServiceInputOutputSpecification `json:"output,omitempty"` - ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"` - Assets *map[string]*AssetItem `json:"assets,omitempty"` - Parameters *map[string]*Parameter `json:"parameters,omitempty"` - PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"` - PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"` - Package *GraphPackage `json:"package,omitempty"` -} - -// RealtimeConfiguration is holds the available configuration options for an -// Azure ML web service endpoint. -type RealtimeConfiguration struct { - MaxConcurrentCalls *int32 `json:"maxConcurrentCalls,omitempty"` -} - -// Resource is azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ServiceInputOutputSpecification is the swagger 2.0 schema describing the -// service's inputs or outputs. See Swagger specification: -// http://swagger.io/specification/ -type ServiceInputOutputSpecification struct { - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - Properties *map[string]*TableSpecification `json:"properties,omitempty"` -} - -// StorageAccount is access information for a storage account. -type StorageAccount struct { - Name *string `json:"name,omitempty"` - Key *string `json:"key,omitempty"` -} - -// TableSpecification is the swagger 2.0 schema describing a single service -// input or output. See Swagger specification: http://swagger.io/specification/ -type TableSpecification struct { - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - Type *string `json:"type,omitempty"` - Format *string `json:"format,omitempty"` - Properties *map[string]*ColumnSpecification `json:"properties,omitempty"` -} - -// WebService is instance of an Azure ML web service resource. -type WebService struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *Properties `json:"properties,omitempty"` -} +package webservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AssetType enumerates the values for asset type. +type AssetType string + +const ( + // AssetTypeModule specifies the asset type module state for asset type. + AssetTypeModule AssetType = "Module" + // AssetTypeResource specifies the asset type resource state for asset + // type. + AssetTypeResource AssetType = "Resource" +) + +// ColumnFormat enumerates the values for column format. +type ColumnFormat string + +const ( + // Byte specifies the byte state for column format. + Byte ColumnFormat = "Byte" + // Char specifies the char state for column format. + Char ColumnFormat = "Char" + // Complex128 specifies the complex 128 state for column format. + Complex128 ColumnFormat = "Complex128" + // Complex64 specifies the complex 64 state for column format. + Complex64 ColumnFormat = "Complex64" + // DateTime specifies the date time state for column format. + DateTime ColumnFormat = "Date-time" + // DateTimeOffset specifies the date time offset state for column format. + DateTimeOffset ColumnFormat = "Date-timeOffset" + // Double specifies the double state for column format. + Double ColumnFormat = "Double" + // Duration specifies the duration state for column format. + Duration ColumnFormat = "Duration" + // Float specifies the float state for column format. + Float ColumnFormat = "Float" + // Int16 specifies the int 16 state for column format. + Int16 ColumnFormat = "Int16" + // Int32 specifies the int 32 state for column format. + Int32 ColumnFormat = "Int32" + // Int64 specifies the int 64 state for column format. + Int64 ColumnFormat = "Int64" + // Int8 specifies the int 8 state for column format. + Int8 ColumnFormat = "Int8" + // Uint16 specifies the uint 16 state for column format. + Uint16 ColumnFormat = "Uint16" + // Uint32 specifies the uint 32 state for column format. + Uint32 ColumnFormat = "Uint32" + // Uint64 specifies the uint 64 state for column format. + Uint64 ColumnFormat = "Uint64" + // Uint8 specifies the uint 8 state for column format. + Uint8 ColumnFormat = "Uint8" +) + +// ColumnType enumerates the values for column type. +type ColumnType string + +const ( + // Boolean specifies the boolean state for column type. + Boolean ColumnType = "Boolean" + // Integer specifies the integer state for column type. + Integer ColumnType = "Integer" + // Number specifies the number state for column type. + Number ColumnType = "Number" + // String specifies the string state for column type. + String ColumnType = "String" +) + +// DiagnosticsLevel enumerates the values for diagnostics level. +type DiagnosticsLevel string + +const ( + // All specifies the all state for diagnostics level. + All DiagnosticsLevel = "All" + // Error specifies the error state for diagnostics level. + Error DiagnosticsLevel = "Error" + // None specifies the none state for diagnostics level. + None DiagnosticsLevel = "None" +) + +// InputPortType enumerates the values for input port type. +type InputPortType string + +const ( + // Dataset specifies the dataset state for input port type. + Dataset InputPortType = "Dataset" +) + +// OutputPortType enumerates the values for output port type. +type OutputPortType string + +const ( + // OutputPortTypeDataset specifies the output port type dataset state for + // output port type. + OutputPortTypeDataset OutputPortType = "Dataset" +) + +// ParameterType enumerates the values for parameter type. +type ParameterType string + +const ( + // ParameterTypeBoolean specifies the parameter type boolean state for + // parameter type. + ParameterTypeBoolean ParameterType = "Boolean" + // ParameterTypeColumnPicker specifies the parameter type column picker + // state for parameter type. + ParameterTypeColumnPicker ParameterType = "ColumnPicker" + // ParameterTypeCredential specifies the parameter type credential state + // for parameter type. + ParameterTypeCredential ParameterType = "Credential" + // ParameterTypeDataGatewayName specifies the parameter type data gateway + // name state for parameter type. + ParameterTypeDataGatewayName ParameterType = "DataGatewayName" + // ParameterTypeDouble specifies the parameter type double state for + // parameter type. + ParameterTypeDouble ParameterType = "Double" + // ParameterTypeEnumerated specifies the parameter type enumerated state + // for parameter type. + ParameterTypeEnumerated ParameterType = "Enumerated" + // ParameterTypeFloat specifies the parameter type float state for + // parameter type. + ParameterTypeFloat ParameterType = "Float" + // ParameterTypeInt specifies the parameter type int state for parameter + // type. + ParameterTypeInt ParameterType = "Int" + // ParameterTypeMode specifies the parameter type mode state for parameter + // type. + ParameterTypeMode ParameterType = "Mode" + // ParameterTypeParameterRange specifies the parameter type parameter range + // state for parameter type. + ParameterTypeParameterRange ParameterType = "ParameterRange" + // ParameterTypeScript specifies the parameter type script state for + // parameter type. + ParameterTypeScript ParameterType = "Script" + // ParameterTypeString specifies the parameter type string state for + // parameter type. + ParameterTypeString ParameterType = "String" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // Provisioning specifies the provisioning state for provisioning state. + Provisioning ProvisioningState = "Provisioning" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" + // Unknown specifies the unknown state for provisioning state. + Unknown ProvisioningState = "Unknown" +) + +// AssetItem is information about an asset associated with the web service. +type AssetItem struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Type AssetType `json:"type,omitempty"` + LocationInfo *BlobLocation `json:"locationInfo,omitempty"` + InputPorts *map[string]*InputPort `json:"inputPorts,omitempty"` + OutputPorts *map[string]*OutputPort `json:"outputPorts,omitempty"` + Metadata *map[string]*string `json:"metadata,omitempty"` + Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"` +} + +// AsyncOperationErrorInfo is the error detail information for async operation +type AsyncOperationErrorInfo struct { + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` + Details *[]AsyncOperationErrorInfo `json:"details,omitempty"` +} + +// AsyncOperationStatus is azure async operation status. +type AsyncOperationStatus struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` + ErrorInfo *AsyncOperationErrorInfo `json:"errorInfo,omitempty"` +} + +// BlobLocation is describes the access location for a blob. +type BlobLocation struct { + URI *string `json:"uri,omitempty"` + Credentials *string `json:"credentials,omitempty"` +} + +// ColumnSpecification is swagger 2.0 schema for a column within the data table +// representing a web service input or output. See Swagger specification: +// http://swagger.io/specification/ +type ColumnSpecification struct { + Type ColumnType `json:"type,omitempty"` + Format ColumnFormat `json:"format,omitempty"` + Enum *[]map[string]interface{} `json:"enum,omitempty"` + XMsIsnullable *bool `json:"x-ms-isnullable,omitempty"` + XMsIsordered *bool `json:"x-ms-isordered,omitempty"` +} + +// CommitmentPlan is information about the machine learning commitment plan +// associated with the web service. +type CommitmentPlan struct { + ID *string `json:"id,omitempty"` +} + +// DiagnosticsConfiguration is diagnostics settings for an Azure ML web +// service. +type DiagnosticsConfiguration struct { + Level DiagnosticsLevel `json:"level,omitempty"` + Expiry *date.Time `json:"expiry,omitempty"` +} + +// ExampleRequest is sample input data for the service's input(s). +type ExampleRequest struct { + Inputs *map[string][][]map[string]interface{} `json:"inputs,omitempty"` + GlobalParameters *map[string]*map[string]interface{} `json:"globalParameters,omitempty"` +} + +// GraphEdge is defines an edge within the web service's graph. +type GraphEdge struct { + SourceNodeID *string `json:"sourceNodeId,omitempty"` + SourcePortID *string `json:"sourcePortId,omitempty"` + TargetNodeID *string `json:"targetNodeId,omitempty"` + TargetPortID *string `json:"targetPortId,omitempty"` +} + +// GraphNode is specifies a node in the web service graph. The node can either +// be an input, output or asset node, so only one of the corresponding id +// properties is populated at any given time. +type GraphNode struct { + AssetID *string `json:"assetId,omitempty"` + InputID *string `json:"inputId,omitempty"` + OutputID *string `json:"outputId,omitempty"` + Parameters *map[string]*Parameter `json:"parameters,omitempty"` +} + +// GraphPackage is defines the graph of modules making up the machine learning +// solution. +type GraphPackage struct { + Nodes *map[string]*GraphNode `json:"nodes,omitempty"` + Edges *[]GraphEdge `json:"edges,omitempty"` + GraphParameters *map[string]*GraphParameter `json:"graphParameters,omitempty"` +} + +// GraphParameter is defines a global parameter in the graph. +type GraphParameter struct { + Description *string `json:"description,omitempty"` + Type ParameterType `json:"type,omitempty"` + Links *[]GraphParameterLink `json:"links,omitempty"` +} + +// GraphParameterLink is association link for a graph global parameter to a +// node in the graph. +type GraphParameterLink struct { + NodeID *string `json:"nodeId,omitempty"` + ParameterKey *string `json:"parameterKey,omitempty"` +} + +// InputPort is asset input port +type InputPort struct { + Type InputPortType `json:"type,omitempty"` +} + +// Keys is access keys for the web service calls. +type Keys struct { + autorest.Response `json:"-"` + Primary *string `json:"primary,omitempty"` + Secondary *string `json:"secondary,omitempty"` +} + +// MachineLearningWorkspace is information about the machine learning workspace +// containing the experiment that is source for the web service. +type MachineLearningWorkspace struct { + ID *string `json:"id,omitempty"` +} + +// ModeValueInfo is nested parameter definition. +type ModeValueInfo struct { + InterfaceString *string `json:"interfaceString,omitempty"` + Parameters *[]ModuleAssetParameter `json:"parameters,omitempty"` +} + +// ModuleAssetParameter is parameter definition for a module asset. +type ModuleAssetParameter struct { + Name *string `json:"name,omitempty"` + ParameterType *string `json:"parameterType,omitempty"` + ModeValuesInfo *map[string]*ModeValueInfo `json:"modeValuesInfo,omitempty"` +} + +// OutputPort is asset output port +type OutputPort struct { + Type OutputPortType `json:"type,omitempty"` +} + +// PaginatedWebServicesList is paginated list of web services. +type PaginatedWebServicesList struct { + autorest.Response `json:"-"` + Value *[]WebService `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PaginatedWebServicesListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PaginatedWebServicesList) PaginatedWebServicesListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Parameter is web Service Parameter object for node and global parameter +type Parameter struct { + Value *map[string]interface{} `json:"value,omitempty"` + CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` +} + +// Properties is the set of properties specific to the Azure ML web service +// resource. +type Properties struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + CreatedOn *date.Time `json:"createdOn,omitempty"` + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Keys *Keys `json:"keys,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SwaggerLocation *string `json:"swaggerLocation,omitempty"` + ExposeSampleData *bool `json:"exposeSampleData,omitempty"` + RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"` + Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"` + StorageAccount *StorageAccount `json:"storageAccount,omitempty"` + MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"` + CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"` + Input *ServiceInputOutputSpecification `json:"input,omitempty"` + Output *ServiceInputOutputSpecification `json:"output,omitempty"` + ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"` + Assets *map[string]*AssetItem `json:"assets,omitempty"` + Parameters *map[string]*Parameter `json:"parameters,omitempty"` + PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"` + PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"` +} + +// PropertiesForGraph is properties specific to a Graph based web service. +type PropertiesForGraph struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + CreatedOn *date.Time `json:"createdOn,omitempty"` + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Keys *Keys `json:"keys,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + SwaggerLocation *string `json:"swaggerLocation,omitempty"` + ExposeSampleData *bool `json:"exposeSampleData,omitempty"` + RealtimeConfiguration *RealtimeConfiguration `json:"realtimeConfiguration,omitempty"` + Diagnostics *DiagnosticsConfiguration `json:"diagnostics,omitempty"` + StorageAccount *StorageAccount `json:"storageAccount,omitempty"` + MachineLearningWorkspace *MachineLearningWorkspace `json:"machineLearningWorkspace,omitempty"` + CommitmentPlan *CommitmentPlan `json:"commitmentPlan,omitempty"` + Input *ServiceInputOutputSpecification `json:"input,omitempty"` + Output *ServiceInputOutputSpecification `json:"output,omitempty"` + ExampleRequest *ExampleRequest `json:"exampleRequest,omitempty"` + Assets *map[string]*AssetItem `json:"assets,omitempty"` + Parameters *map[string]*Parameter `json:"parameters,omitempty"` + PayloadsInBlobStorage *bool `json:"payloadsInBlobStorage,omitempty"` + PayloadsLocation *BlobLocation `json:"payloadsLocation,omitempty"` + Package *GraphPackage `json:"package,omitempty"` +} + +// RealtimeConfiguration is holds the available configuration options for an +// Azure ML web service endpoint. +type RealtimeConfiguration struct { + MaxConcurrentCalls *int32 `json:"maxConcurrentCalls,omitempty"` +} + +// Resource is azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServiceInputOutputSpecification is the swagger 2.0 schema describing the +// service's inputs or outputs. See Swagger specification: +// http://swagger.io/specification/ +type ServiceInputOutputSpecification struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + Properties *map[string]*TableSpecification `json:"properties,omitempty"` +} + +// StorageAccount is access information for a storage account. +type StorageAccount struct { + Name *string `json:"name,omitempty"` + Key *string `json:"key,omitempty"` +} + +// TableSpecification is the swagger 2.0 schema describing a single service +// input or output. See Swagger specification: http://swagger.io/specification/ +type TableSpecification struct { + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + Format *string `json:"format,omitempty"` + Properties *map[string]*ColumnSpecification `json:"properties,omitempty"` +} + +// WebService is instance of an Azure ML web service resource. +type WebService struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *Properties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/version.go index 5e733c690b..a9aec92019 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/version.go @@ -1,29 +1,29 @@ -package webservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-webservices/2017-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package webservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-webservices/2017-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/webservicesgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/webservicesgroup.go index 85a76d1b66..642b37e456 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/webservicesgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/machinelearning/webservices/webservicesgroup.go @@ -1,741 +1,741 @@ -package webservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupClient is the these APIs allow end users to operate on Azure Machine -// Learning Web Services resources. They support the following -// operations:
  • Create or update a web service
  • Get a web -// service
  • Patch a web service
  • Delete a web service
  • Get -// All Web Services in a Resource Group
  • Get All Web Services in a -// Subscription
  • Get Web Services Keys
-type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a web service. This call will overwrite an -// existing web service. Note that there is no warning or confirmation. This is -// a nonrecoverable operation. If your intent is to create a new web service, -// call the Get operation first to verify that it does not exist. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the resource group in which the web service is -// located. webServiceName is the name of the web service. -// createOrUpdatePayload is the payload that is used to create or update the -// web service. -func (client GroupClient) CreateOrUpdate(resourceGroupName string, webServiceName string, createOrUpdatePayload WebService, cancel <-chan struct{}) (<-chan WebService, <-chan error) { - resultChan := make(chan WebService, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: createOrUpdatePayload, - Constraints: []validation.Constraint{{Target: "createOrUpdatePayload.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil}, - {Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.InclusiveMinimum, Rule: 4, Chain: nil}, - }}, - }}, - {Target: "createOrUpdatePayload.Properties.MachineLearningWorkspace", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.MachineLearningWorkspace.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createOrUpdatePayload.Properties.CommitmentPlan", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.CommitmentPlan.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "createOrUpdatePayload.Properties.Input", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.Input.Type", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createOrUpdatePayload.Properties.Input.Properties", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "createOrUpdatePayload.Properties.Output", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.Output.Type", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "createOrUpdatePayload.Properties.Output.Properties", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "createOrUpdatePayload.Properties.PayloadsLocation", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.PayloadsLocation.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "webservices.GroupClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result WebService - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, webServiceName, createOrUpdatePayload, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, webServiceName string, createOrUpdatePayload WebService, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webServiceName": autorest.Encode("path", webServiceName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), - autorest.WithJSON(createOrUpdatePayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result WebService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateRegionalProperties creates an encrypted credentials parameter blob for -// the specified region. To get the web service from a region other than the -// region in which it has been created, you must first call Create Regional Web -// Services Properties to create a copy of the encrypted credential parameter -// blob in that region. You only need to do this before the first time that you -// get the web service in the new region. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group in which the web service is -// located. webServiceName is the name of the web service. region is the region -// for which encrypted credential parameters are created. -func (client GroupClient) CreateRegionalProperties(resourceGroupName string, webServiceName string, region string, cancel <-chan struct{}) (<-chan AsyncOperationStatus, <-chan error) { - resultChan := make(chan AsyncOperationStatus, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result AsyncOperationStatus - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateRegionalPropertiesPreparer(resourceGroupName, webServiceName, region, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", nil, "Failure preparing request") - return - } - - resp, err := client.CreateRegionalPropertiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", resp, "Failure sending request") - return - } - - result, err = client.CreateRegionalPropertiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateRegionalPropertiesPreparer prepares the CreateRegionalProperties request. -func (client GroupClient) CreateRegionalPropertiesPreparer(resourceGroupName string, webServiceName string, region string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webServiceName": autorest.Encode("path", webServiceName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "region": autorest.Encode("query", region), - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}/CreateRegionalBlob", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateRegionalPropertiesSender sends the CreateRegionalProperties request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateRegionalPropertiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateRegionalPropertiesResponder handles the response to the CreateRegionalProperties request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateRegionalPropertiesResponder(resp *http.Response) (result AsyncOperationStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the Web Service Definition as specified by a subscription, resource -// group, and name. Note that the storage credentials and web service keys are -// not returned by this call. To get the web service access keys, call List -// Keys. -// -// resourceGroupName is name of the resource group in which the web service is -// located. webServiceName is the name of the web service. region is the region -// for which encrypted credential parameters are valid. -func (client GroupClient) Get(resourceGroupName string, webServiceName string, region string) (result WebService, err error) { - req, err := client.GetPreparer(resourceGroupName, webServiceName, region) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, webServiceName string, region string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webServiceName": autorest.Encode("path", webServiceName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(region) > 0 { - queryParameters["region"] = autorest.Encode("query", region) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result WebService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets the web services in the specified resource group. -// -// resourceGroupName is name of the resource group in which the web service is -// located. skiptoken is continuation token for pagination. -func (client GroupClient) ListByResourceGroup(resourceGroupName string, skiptoken string) (result PaginatedWebServicesList, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, skiptoken) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, skiptoken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result PaginatedWebServicesList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client GroupClient) ListByResourceGroupNextResults(lastResults PaginatedWebServicesList) (result PaginatedWebServicesList, err error) { - req, err := lastResults.PaginatedWebServicesListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscriptionID gets the web services in the specified subscription. -// -// skiptoken is continuation token for pagination. -func (client GroupClient) ListBySubscriptionID(skiptoken string) (result PaginatedWebServicesList, err error) { - req, err := client.ListBySubscriptionIDPreparer(skiptoken) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client GroupClient) ListBySubscriptionIDPreparer(skiptoken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/webServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client GroupClient) ListBySubscriptionIDResponder(resp *http.Response) (result PaginatedWebServicesList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionIDNextResults retrieves the next set of results, if any. -func (client GroupClient) ListBySubscriptionIDNextResults(lastResults PaginatedWebServicesList) (result PaginatedWebServicesList, err error) { - req, err := lastResults.PaginatedWebServicesListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the access keys for the specified web service. -// -// resourceGroupName is name of the resource group in which the web service is -// located. webServiceName is the name of the web service. -func (client GroupClient) ListKeys(resourceGroupName string, webServiceName string) (result Keys, err error) { - req, err := client.ListKeysPreparer(resourceGroupName, webServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client GroupClient) ListKeysPreparer(resourceGroupName string, webServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webServiceName": autorest.Encode("path", webServiceName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client GroupClient) ListKeysResponder(resp *http.Response) (result Keys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch modifies an existing web service resource. The PATCH API call is an -// asynchronous operation. To determine whether it has completed successfully, -// you must perform a Get operation. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group in which the web service is -// located. webServiceName is the name of the web service. patchPayload is the -// payload to use to patch the web service. -func (client GroupClient) Patch(resourceGroupName string, webServiceName string, patchPayload WebService, cancel <-chan struct{}) (<-chan WebService, <-chan error) { - resultChan := make(chan WebService, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result WebService - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PatchPreparer(resourceGroupName, webServiceName, patchPayload, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PatchPreparer prepares the Patch request. -func (client GroupClient) PatchPreparer(resourceGroupName string, webServiceName string, patchPayload WebService, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webServiceName": autorest.Encode("path", webServiceName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), - autorest.WithJSON(patchPayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client GroupClient) PatchResponder(resp *http.Response) (result WebService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Remove deletes the specified web service. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group in which the web service is -// located. webServiceName is the name of the web service. -func (client GroupClient) Remove(resourceGroupName string, webServiceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RemovePreparer(resourceGroupName, webServiceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", resp, "Failure sending request") - return - } - - result, err = client.RemoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RemovePreparer prepares the Remove request. -func (client GroupClient) RemovePreparer(resourceGroupName string, webServiceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webServiceName": autorest.Encode("path", webServiceName), - } - - const APIVersion = "2017-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RemoveSender sends the Remove request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RemoveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RemoveResponder handles the response to the Remove request. The method always -// closes the http.Response Body. -func (client GroupClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package webservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupClient is the these APIs allow end users to operate on Azure Machine +// Learning Web Services resources. They support the following +// operations:
  • Create or update a web service
  • Get a web +// service
  • Patch a web service
  • Delete a web service
  • Get +// All Web Services in a Resource Group
  • Get All Web Services in a +// Subscription
  • Get Web Services Keys
+type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a web service. This call will overwrite an +// existing web service. Note that there is no warning or confirmation. This is +// a nonrecoverable operation. If your intent is to create a new web service, +// call the Get operation first to verify that it does not exist. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group in which the web service is +// located. webServiceName is the name of the web service. +// createOrUpdatePayload is the payload that is used to create or update the +// web service. +func (client GroupClient) CreateOrUpdate(resourceGroupName string, webServiceName string, createOrUpdatePayload WebService, cancel <-chan struct{}) (<-chan WebService, <-chan error) { + resultChan := make(chan WebService, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: createOrUpdatePayload, + Constraints: []validation.Constraint{{Target: "createOrUpdatePayload.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil}, + {Target: "createOrUpdatePayload.Properties.RealtimeConfiguration.MaxConcurrentCalls", Name: validation.InclusiveMinimum, Rule: 4, Chain: nil}, + }}, + }}, + {Target: "createOrUpdatePayload.Properties.MachineLearningWorkspace", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.MachineLearningWorkspace.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "createOrUpdatePayload.Properties.CommitmentPlan", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.CommitmentPlan.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "createOrUpdatePayload.Properties.Input", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.Input.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createOrUpdatePayload.Properties.Input.Properties", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "createOrUpdatePayload.Properties.Output", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.Output.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createOrUpdatePayload.Properties.Output.Properties", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "createOrUpdatePayload.Properties.PayloadsLocation", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOrUpdatePayload.Properties.PayloadsLocation.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "webservices.GroupClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result WebService + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, webServiceName, createOrUpdatePayload, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, webServiceName string, createOrUpdatePayload WebService, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webServiceName": autorest.Encode("path", webServiceName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), + autorest.WithJSON(createOrUpdatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result WebService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateRegionalProperties creates an encrypted credentials parameter blob for +// the specified region. To get the web service from a region other than the +// region in which it has been created, you must first call Create Regional Web +// Services Properties to create a copy of the encrypted credential parameter +// blob in that region. You only need to do this before the first time that you +// get the web service in the new region. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group in which the web service is +// located. webServiceName is the name of the web service. region is the region +// for which encrypted credential parameters are created. +func (client GroupClient) CreateRegionalProperties(resourceGroupName string, webServiceName string, region string, cancel <-chan struct{}) (<-chan AsyncOperationStatus, <-chan error) { + resultChan := make(chan AsyncOperationStatus, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result AsyncOperationStatus + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateRegionalPropertiesPreparer(resourceGroupName, webServiceName, region, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", nil, "Failure preparing request") + return + } + + resp, err := client.CreateRegionalPropertiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", resp, "Failure sending request") + return + } + + result, err = client.CreateRegionalPropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "CreateRegionalProperties", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateRegionalPropertiesPreparer prepares the CreateRegionalProperties request. +func (client GroupClient) CreateRegionalPropertiesPreparer(resourceGroupName string, webServiceName string, region string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webServiceName": autorest.Encode("path", webServiceName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "region": autorest.Encode("query", region), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}/CreateRegionalBlob", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateRegionalPropertiesSender sends the CreateRegionalProperties request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateRegionalPropertiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateRegionalPropertiesResponder handles the response to the CreateRegionalProperties request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateRegionalPropertiesResponder(resp *http.Response) (result AsyncOperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the Web Service Definition as specified by a subscription, resource +// group, and name. Note that the storage credentials and web service keys are +// not returned by this call. To get the web service access keys, call List +// Keys. +// +// resourceGroupName is name of the resource group in which the web service is +// located. webServiceName is the name of the web service. region is the region +// for which encrypted credential parameters are valid. +func (client GroupClient) Get(resourceGroupName string, webServiceName string, region string) (result WebService, err error) { + req, err := client.GetPreparer(resourceGroupName, webServiceName, region) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, webServiceName string, region string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webServiceName": autorest.Encode("path", webServiceName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(region) > 0 { + queryParameters["region"] = autorest.Encode("query", region) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result WebService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets the web services in the specified resource group. +// +// resourceGroupName is name of the resource group in which the web service is +// located. skiptoken is continuation token for pagination. +func (client GroupClient) ListByResourceGroup(resourceGroupName string, skiptoken string) (result PaginatedWebServicesList, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, skiptoken) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string, skiptoken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result PaginatedWebServicesList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client GroupClient) ListByResourceGroupNextResults(lastResults PaginatedWebServicesList) (result PaginatedWebServicesList, err error) { + req, err := lastResults.PaginatedWebServicesListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscriptionID gets the web services in the specified subscription. +// +// skiptoken is continuation token for pagination. +func (client GroupClient) ListBySubscriptionID(skiptoken string) (result PaginatedWebServicesList, err error) { + req, err := client.ListBySubscriptionIDPreparer(skiptoken) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client GroupClient) ListBySubscriptionIDPreparer(skiptoken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/webServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client GroupClient) ListBySubscriptionIDResponder(resp *http.Response) (result PaginatedWebServicesList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionIDNextResults retrieves the next set of results, if any. +func (client GroupClient) ListBySubscriptionIDNextResults(lastResults PaginatedWebServicesList) (result PaginatedWebServicesList, err error) { + req, err := lastResults.PaginatedWebServicesListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListBySubscriptionID", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the access keys for the specified web service. +// +// resourceGroupName is name of the resource group in which the web service is +// located. webServiceName is the name of the web service. +func (client GroupClient) ListKeys(resourceGroupName string, webServiceName string) (result Keys, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, webServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client GroupClient) ListKeysPreparer(resourceGroupName string, webServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webServiceName": autorest.Encode("path", webServiceName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client GroupClient) ListKeysResponder(resp *http.Response) (result Keys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Patch modifies an existing web service resource. The PATCH API call is an +// asynchronous operation. To determine whether it has completed successfully, +// you must perform a Get operation. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group in which the web service is +// located. webServiceName is the name of the web service. patchPayload is the +// payload to use to patch the web service. +func (client GroupClient) Patch(resourceGroupName string, webServiceName string, patchPayload WebService, cancel <-chan struct{}) (<-chan WebService, <-chan error) { + resultChan := make(chan WebService, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result WebService + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PatchPreparer(resourceGroupName, webServiceName, patchPayload, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Patch", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PatchPreparer prepares the Patch request. +func (client GroupClient) PatchPreparer(resourceGroupName string, webServiceName string, patchPayload WebService, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webServiceName": autorest.Encode("path", webServiceName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), + autorest.WithJSON(patchPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client GroupClient) PatchResponder(resp *http.Response) (result WebService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Remove deletes the specified web service. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group in which the web service is +// located. webServiceName is the name of the web service. +func (client GroupClient) Remove(resourceGroupName string, webServiceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RemovePreparer(resourceGroupName, webServiceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", resp, "Failure sending request") + return + } + + result, err = client.RemoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "webservices.GroupClient", "Remove", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RemovePreparer prepares the Remove request. +func (client GroupClient) RemovePreparer(resourceGroupName string, webServiceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webServiceName": autorest.Encode("path", webServiceName), + } + + const APIVersion = "2017-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearning/webServices/{webServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RemoveSender sends the Remove request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RemoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RemoveResponder handles the response to the Remove request. The method always +// closes the http.Response Body. +func (client GroupClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/client.go index 24837df88d..b67e498ad8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/client.go @@ -1,53 +1,53 @@ -// Package mediaservices implements the Azure ARM Mediaservices service API -// version 2015-10-01. -// -// Media Services resource management APIs. -package mediaservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Mediaservices - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Mediaservices. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package mediaservices implements the Azure ARM Mediaservices service API +// version 2015-10-01. +// +// Media Services resource management APIs. +package mediaservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Mediaservices + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Mediaservices. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/mediaservice.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/mediaservice.go index ee3f321dc1..ab632e05b5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/mediaservice.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/mediaservice.go @@ -1,716 +1,716 @@ -package mediaservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// Client is the media Services resource management APIs. -type Client struct { - ManagementClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client. -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether the Media Service resource name is -// available. The name must be globally unique. -// -// checkNameAvailabilityInput is properties needed to check the availability of -// a name. -func (client Client) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: checkNameAvailabilityInput, - Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "checkNameAvailabilityInput.Name", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "checkNameAvailabilityInput.Name", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}, - }}, - {Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client Client) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Media/CheckNameAvailability", pathParameters), - autorest.WithJSON(checkNameAvailabilityInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates a Media Service. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. mediaService is -// media Service properties needed for creation. -func (client Client) Create(resourceGroupName string, mediaServiceName string, mediaService MediaService) (result MediaService, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, mediaServiceName, mediaService) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client Client) CreatePreparer(resourceGroupName string, mediaServiceName string, mediaService MediaService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), - autorest.WithJSON(mediaService), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client Client) CreateResponder(resp *http.Response) (result MediaService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Media Service. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. -func (client Client) Delete(resourceGroupName string, mediaServiceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, mediaServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(resourceGroupName string, mediaServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Media Service. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. -func (client Client) Get(resourceGroupName string, mediaServiceName string) (result MediaService, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, mediaServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client Client) GetPreparer(resourceGroupName string, mediaServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result MediaService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all of the Media Services in a resource group. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. -func (client Client) ListByResourceGroup(resourceGroupName string) (result Collection, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client Client) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client Client) ListByResourceGroupResponder(resp *http.Response) (result Collection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the keys for a Media Service. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. -func (client Client) ListKeys(resourceGroupName string, mediaServiceName string) (result ServiceKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, mediaServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client Client) ListKeysPreparer(resourceGroupName string, mediaServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client Client) ListKeysResponder(resp *http.Response) (result ServiceKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates a primary or secondary key for a Media Service. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. -// regenerateKeyInput is properties needed to regenerate the Media Service key. -func (client Client) RegenerateKey(resourceGroupName string, mediaServiceName string, regenerateKeyInput RegenerateKeyInput) (result RegenerateKeyOutput, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "RegenerateKey") - } - - req, err := client.RegenerateKeyPreparer(resourceGroupName, mediaServiceName, regenerateKeyInput) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client Client) RegenerateKeyPreparer(resourceGroupName string, mediaServiceName string, regenerateKeyInput RegenerateKeyInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKeyInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client Client) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client Client) RegenerateKeyResponder(resp *http.Response) (result RegenerateKeyOutput, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SyncStorageKeys synchronizes storage account keys for a storage account -// associated with the Media Service account. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. -// syncStorageKeysInput is properties needed to synchronize the keys for a -// storage account to the Media Service. -func (client Client) SyncStorageKeys(resourceGroupName string, mediaServiceName string, syncStorageKeysInput SyncStorageKeysInput) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}, - {TargetValue: syncStorageKeysInput, - Constraints: []validation.Constraint{{Target: "syncStorageKeysInput.ID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "SyncStorageKeys") - } - - req, err := client.SyncStorageKeysPreparer(resourceGroupName, mediaServiceName, syncStorageKeysInput) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "SyncStorageKeys", nil, "Failure preparing request") - return - } - - resp, err := client.SyncStorageKeysSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "mediaservices.Client", "SyncStorageKeys", resp, "Failure sending request") - return - } - - result, err = client.SyncStorageKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "SyncStorageKeys", resp, "Failure responding to request") - } - - return -} - -// SyncStorageKeysPreparer prepares the SyncStorageKeys request. -func (client Client) SyncStorageKeysPreparer(resourceGroupName string, mediaServiceName string, syncStorageKeysInput SyncStorageKeysInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/syncStorageKeys", pathParameters), - autorest.WithJSON(syncStorageKeysInput), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncStorageKeysSender sends the SyncStorageKeys request. The method will close the -// http.Response Body if it receives an error. -func (client Client) SyncStorageKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncStorageKeysResponder handles the response to the SyncStorageKeys request. The method always -// closes the http.Response Body. -func (client Client) SyncStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a Media Service. -// -// resourceGroupName is name of the resource group within the Azure -// subscription. mediaServiceName is name of the Media Service. mediaService is -// media Service properties needed for update. -func (client Client) Update(resourceGroupName string, mediaServiceName string, mediaService MediaService) (result MediaService, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: mediaServiceName, - Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, mediaServiceName, mediaService) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mediaservices.Client", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client Client) UpdatePreparer(resourceGroupName string, mediaServiceName string, mediaService MediaService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "mediaServiceName": autorest.Encode("path", mediaServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), - autorest.WithJSON(mediaService), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client Client) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client Client) UpdateResponder(resp *http.Response) (result MediaService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package mediaservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// Client is the media Services resource management APIs. +type Client struct { + ManagementClient +} + +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientWithBaseURI creates an instance of the Client client. +func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks whether the Media Service resource name is +// available. The name must be globally unique. +// +// checkNameAvailabilityInput is properties needed to check the availability of +// a name. +func (client Client) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput) (result CheckNameAvailabilityOutput, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "checkNameAvailabilityInput.Name", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "checkNameAvailabilityInput.Name", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}, + }}, + {Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client Client) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Media/CheckNameAvailability", pathParameters), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates a Media Service. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. mediaService is +// media Service properties needed for creation. +func (client Client) Create(resourceGroupName string, mediaServiceName string, mediaService MediaService) (result MediaService, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, mediaServiceName, mediaService) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client Client) CreatePreparer(resourceGroupName string, mediaServiceName string, mediaService MediaService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), + autorest.WithJSON(mediaService), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client Client) CreateResponder(resp *http.Response) (result MediaService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Media Service. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. +func (client Client) Delete(resourceGroupName string, mediaServiceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, mediaServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client Client) DeletePreparer(resourceGroupName string, mediaServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client Client) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Media Service. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. +func (client Client) Get(resourceGroupName string, mediaServiceName string) (result MediaService, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, mediaServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client Client) GetPreparer(resourceGroupName string, mediaServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client Client) GetResponder(resp *http.Response) (result MediaService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all of the Media Services in a resource group. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. +func (client Client) ListByResourceGroup(resourceGroupName string) (result Collection, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client Client) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client Client) ListByResourceGroupResponder(resp *http.Response) (result Collection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeys lists the keys for a Media Service. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. +func (client Client) ListKeys(resourceGroupName string, mediaServiceName string) (result ServiceKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, mediaServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client Client) ListKeysPreparer(resourceGroupName string, mediaServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client Client) ListKeysResponder(resp *http.Response) (result ServiceKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerates a primary or secondary key for a Media Service. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. +// regenerateKeyInput is properties needed to regenerate the Media Service key. +func (client Client) RegenerateKey(resourceGroupName string, mediaServiceName string, regenerateKeyInput RegenerateKeyInput) (result RegenerateKeyOutput, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "RegenerateKey") + } + + req, err := client.RegenerateKeyPreparer(resourceGroupName, mediaServiceName, regenerateKeyInput) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client Client) RegenerateKeyPreparer(resourceGroupName string, mediaServiceName string, regenerateKeyInput RegenerateKeyInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKeyInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client Client) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client Client) RegenerateKeyResponder(resp *http.Response) (result RegenerateKeyOutput, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SyncStorageKeys synchronizes storage account keys for a storage account +// associated with the Media Service account. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. +// syncStorageKeysInput is properties needed to synchronize the keys for a +// storage account to the Media Service. +func (client Client) SyncStorageKeys(resourceGroupName string, mediaServiceName string, syncStorageKeysInput SyncStorageKeysInput) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}, + {TargetValue: syncStorageKeysInput, + Constraints: []validation.Constraint{{Target: "syncStorageKeysInput.ID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "SyncStorageKeys") + } + + req, err := client.SyncStorageKeysPreparer(resourceGroupName, mediaServiceName, syncStorageKeysInput) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "SyncStorageKeys", nil, "Failure preparing request") + return + } + + resp, err := client.SyncStorageKeysSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "mediaservices.Client", "SyncStorageKeys", resp, "Failure sending request") + return + } + + result, err = client.SyncStorageKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "SyncStorageKeys", resp, "Failure responding to request") + } + + return +} + +// SyncStorageKeysPreparer prepares the SyncStorageKeys request. +func (client Client) SyncStorageKeysPreparer(resourceGroupName string, mediaServiceName string, syncStorageKeysInput SyncStorageKeysInput) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/syncStorageKeys", pathParameters), + autorest.WithJSON(syncStorageKeysInput), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncStorageKeysSender sends the SyncStorageKeys request. The method will close the +// http.Response Body if it receives an error. +func (client Client) SyncStorageKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncStorageKeysResponder handles the response to the SyncStorageKeys request. The method always +// closes the http.Response Body. +func (client Client) SyncStorageKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a Media Service. +// +// resourceGroupName is name of the resource group within the Azure +// subscription. mediaServiceName is name of the Media Service. mediaService is +// media Service properties needed for update. +func (client Client) Update(resourceGroupName string, mediaServiceName string, mediaService MediaService) (result MediaService, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: mediaServiceName, + Constraints: []validation.Constraint{{Target: "mediaServiceName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "mediaServiceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "mediaServiceName", Name: validation.Pattern, Rule: `^[a-z0-9]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mediaservices.Client", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, mediaServiceName, mediaService) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mediaservices.Client", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client Client) UpdatePreparer(resourceGroupName string, mediaServiceName string, mediaService MediaService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "mediaServiceName": autorest.Encode("path", mediaServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}", pathParameters), + autorest.WithJSON(mediaService), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client Client) UpdateResponder(resp *http.Response) (result MediaService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/models.go index fd24b09db7..d8fa72549b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/models.go @@ -1,149 +1,149 @@ -package mediaservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// EntityNameUnavailabilityReason enumerates the values for entity name -// unavailability reason. -type EntityNameUnavailabilityReason string - -const ( - // AlreadyExists specifies the already exists state for entity name - // unavailability reason. - AlreadyExists EntityNameUnavailabilityReason = "AlreadyExists" - // Invalid specifies the invalid state for entity name unavailability - // reason. - Invalid EntityNameUnavailabilityReason = "Invalid" - // None specifies the none state for entity name unavailability reason. - None EntityNameUnavailabilityReason = "None" -) - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // Primary specifies the primary state for key type. - Primary KeyType = "Primary" - // Secondary specifies the secondary state for key type. - Secondary KeyType = "Secondary" -) - -// ResourceType enumerates the values for resource type. -type ResourceType string - -const ( - // Mediaservices specifies the mediaservices state for resource type. - Mediaservices ResourceType = "mediaservices" -) - -// APIEndpoint is the properties for a Media Services REST API endpoint. -type APIEndpoint struct { - Endpoint *string `json:"endpoint,omitempty"` - MajorVersion *string `json:"majorVersion,omitempty"` -} - -// APIError is the error returned from a failed Media Services REST API call. -type APIError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CheckNameAvailabilityInput is the request body for CheckNameAvailability -// API. -type CheckNameAvailabilityInput struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityOutput is the response body for CheckNameAvailability -// API. -type CheckNameAvailabilityOutput struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"NameAvailable,omitempty"` - Reason EntityNameUnavailabilityReason `json:"Reason,omitempty"` - Message *string `json:"Message,omitempty"` -} - -// Collection is the collection of Media Service resources. -type Collection struct { - autorest.Response `json:"-"` - Value *[]MediaService `json:"value,omitempty"` -} - -// MediaService is the properties of a Media Service resource. -type MediaService struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// Properties is the additional properties of a Media Service resource. -type Properties struct { - APIEndpoints *[]APIEndpoint `json:"apiEndpoints,omitempty"` - StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` -} - -// RegenerateKeyInput is the request body for a RegenerateKey API. -type RegenerateKeyInput struct { - KeyType KeyType `json:"keyType,omitempty"` -} - -// RegenerateKeyOutput is the response body for a RegenerateKey API. -type RegenerateKeyOutput struct { - autorest.Response `json:"-"` - Key *string `json:"key,omitempty"` -} - -// Resource is the Azure Resource Manager resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ServiceKeys is the response body for a ListKeys API. -type ServiceKeys struct { - autorest.Response `json:"-"` - PrimaryAuthEndpoint *string `json:"primaryAuthEndpoint,omitempty"` - SecondaryAuthEndpoint *string `json:"secondaryAuthEndpoint,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - Scope *string `json:"scope,omitempty"` -} - -// StorageAccount is the properties of a storage account associated with this -// resource. -type StorageAccount struct { - ID *string `json:"id,omitempty"` - IsPrimary *bool `json:"isPrimary,omitempty"` -} - -// SyncStorageKeysInput is the request body for a SyncStorageKeys API. -type SyncStorageKeysInput struct { - ID *string `json:"id,omitempty"` -} +package mediaservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// EntityNameUnavailabilityReason enumerates the values for entity name +// unavailability reason. +type EntityNameUnavailabilityReason string + +const ( + // AlreadyExists specifies the already exists state for entity name + // unavailability reason. + AlreadyExists EntityNameUnavailabilityReason = "AlreadyExists" + // Invalid specifies the invalid state for entity name unavailability + // reason. + Invalid EntityNameUnavailabilityReason = "Invalid" + // None specifies the none state for entity name unavailability reason. + None EntityNameUnavailabilityReason = "None" +) + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // Primary specifies the primary state for key type. + Primary KeyType = "Primary" + // Secondary specifies the secondary state for key type. + Secondary KeyType = "Secondary" +) + +// ResourceType enumerates the values for resource type. +type ResourceType string + +const ( + // Mediaservices specifies the mediaservices state for resource type. + Mediaservices ResourceType = "mediaservices" +) + +// APIEndpoint is the properties for a Media Services REST API endpoint. +type APIEndpoint struct { + Endpoint *string `json:"endpoint,omitempty"` + MajorVersion *string `json:"majorVersion,omitempty"` +} + +// APIError is the error returned from a failed Media Services REST API call. +type APIError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CheckNameAvailabilityInput is the request body for CheckNameAvailability +// API. +type CheckNameAvailabilityInput struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityOutput is the response body for CheckNameAvailability +// API. +type CheckNameAvailabilityOutput struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"NameAvailable,omitempty"` + Reason EntityNameUnavailabilityReason `json:"Reason,omitempty"` + Message *string `json:"Message,omitempty"` +} + +// Collection is the collection of Media Service resources. +type Collection struct { + autorest.Response `json:"-"` + Value *[]MediaService `json:"value,omitempty"` +} + +// MediaService is the properties of a Media Service resource. +type MediaService struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// Properties is the additional properties of a Media Service resource. +type Properties struct { + APIEndpoints *[]APIEndpoint `json:"apiEndpoints,omitempty"` + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` +} + +// RegenerateKeyInput is the request body for a RegenerateKey API. +type RegenerateKeyInput struct { + KeyType KeyType `json:"keyType,omitempty"` +} + +// RegenerateKeyOutput is the response body for a RegenerateKey API. +type RegenerateKeyOutput struct { + autorest.Response `json:"-"` + Key *string `json:"key,omitempty"` +} + +// Resource is the Azure Resource Manager resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServiceKeys is the response body for a ListKeys API. +type ServiceKeys struct { + autorest.Response `json:"-"` + PrimaryAuthEndpoint *string `json:"primaryAuthEndpoint,omitempty"` + SecondaryAuthEndpoint *string `json:"secondaryAuthEndpoint,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + Scope *string `json:"scope,omitempty"` +} + +// StorageAccount is the properties of a storage account associated with this +// resource. +type StorageAccount struct { + ID *string `json:"id,omitempty"` + IsPrimary *bool `json:"isPrimary,omitempty"` +} + +// SyncStorageKeysInput is the request body for a SyncStorageKeys API. +type SyncStorageKeysInput struct { + ID *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/version.go index d78ad863de..32be126596 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mediaservices/version.go @@ -1,29 +1,29 @@ -package mediaservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-mediaservices/2015-10-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package mediaservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-mediaservices/2015-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/appcollections.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/appcollections.go index d25848cb92..5c91b67e29 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/appcollections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/appcollections.go @@ -1,192 +1,192 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// AppCollectionsClient is the microsoft Azure Mobile Engagement REST APIs. -type AppCollectionsClient struct { - ManagementClient -} - -// NewAppCollectionsClient creates an instance of the AppCollectionsClient -// client. -func NewAppCollectionsClient(subscriptionID string) AppCollectionsClient { - return NewAppCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppCollectionsClientWithBaseURI creates an instance of the -// AppCollectionsClient client. -func NewAppCollectionsClientWithBaseURI(baseURI string, subscriptionID string) AppCollectionsClient { - return AppCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks availability of an app collection name in the -// Engagement domain. -// -func (client AppCollectionsClient) CheckNameAvailability(parameters AppCollectionNameAvailability) (result AppCollectionNameAvailability, err error) { - req, err := client.CheckNameAvailabilityPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client AppCollectionsClient) CheckNameAvailabilityPreparer(parameters AppCollectionNameAvailability) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MobileEngagement/checkAppCollectionNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client AppCollectionsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client AppCollectionsClient) CheckNameAvailabilityResponder(resp *http.Response) (result AppCollectionNameAvailability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists app collections in a subscription. -func (client AppCollectionsClient) List() (result AppCollectionListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AppCollectionsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MobileEngagement/appCollections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppCollectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppCollectionsClient) ListResponder(resp *http.Response) (result AppCollectionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AppCollectionsClient) ListNextResults(lastResults AppCollectionListResult) (result AppCollectionListResult, err error) { - req, err := lastResults.AppCollectionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AppCollectionsClient is the microsoft Azure Mobile Engagement REST APIs. +type AppCollectionsClient struct { + ManagementClient +} + +// NewAppCollectionsClient creates an instance of the AppCollectionsClient +// client. +func NewAppCollectionsClient(subscriptionID string) AppCollectionsClient { + return NewAppCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppCollectionsClientWithBaseURI creates an instance of the +// AppCollectionsClient client. +func NewAppCollectionsClientWithBaseURI(baseURI string, subscriptionID string) AppCollectionsClient { + return AppCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks availability of an app collection name in the +// Engagement domain. +// +func (client AppCollectionsClient) CheckNameAvailability(parameters AppCollectionNameAvailability) (result AppCollectionNameAvailability, err error) { + req, err := client.CheckNameAvailabilityPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client AppCollectionsClient) CheckNameAvailabilityPreparer(parameters AppCollectionNameAvailability) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MobileEngagement/checkAppCollectionNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client AppCollectionsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client AppCollectionsClient) CheckNameAvailabilityResponder(resp *http.Response) (result AppCollectionNameAvailability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists app collections in a subscription. +func (client AppCollectionsClient) List() (result AppCollectionListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppCollectionsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MobileEngagement/appCollections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppCollectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppCollectionsClient) ListResponder(resp *http.Response) (result AppCollectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AppCollectionsClient) ListNextResults(lastResults AppCollectionListResult) (result AppCollectionListResult, err error) { + req, err := lastResults.AppCollectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppCollectionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/apps.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/apps.go index f126c82ea2..ddc0c75490 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/apps.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/apps.go @@ -1,130 +1,130 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// AppsClient is the microsoft Azure Mobile Engagement REST APIs. -type AppsClient struct { - ManagementClient -} - -// NewAppsClient creates an instance of the AppsClient client. -func NewAppsClient(subscriptionID string) AppsClient { - return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppsClientWithBaseURI creates an instance of the AppsClient client. -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists apps in an appCollection. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. -func (client AppsClient) List(resourceGroupName string, appCollection string) (result AppListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, appCollection) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AppsClient) ListPreparer(resourceGroupName string, appCollection string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppsClient) ListResponder(resp *http.Response) (result AppListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AppsClient) ListNextResults(lastResults AppListResult) (result AppListResult, err error) { - req, err := lastResults.AppListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AppsClient is the microsoft Azure Mobile Engagement REST APIs. +type AppsClient struct { + ManagementClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient client. +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists apps in an appCollection. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. +func (client AppsClient) List(resourceGroupName string, appCollection string) (result AppListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, appCollection) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(resourceGroupName string, appCollection string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result AppListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AppsClient) ListNextResults(lastResults AppListResult) (result AppListResult, err error) { + req, err := lastResults.AppListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.AppsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/campaigns.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/campaigns.go index 3e14d2d164..d1da83e0b9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/campaigns.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/campaigns.go @@ -1,1076 +1,1076 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CampaignsClient is the microsoft Azure Mobile Engagement REST APIs. -type CampaignsClient struct { - ManagementClient -} - -// NewCampaignsClient creates an instance of the CampaignsClient client. -func NewCampaignsClient(subscriptionID string) CampaignsClient { - return NewCampaignsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCampaignsClientWithBaseURI creates an instance of the CampaignsClient -// client. -func NewCampaignsClientWithBaseURI(baseURI string, subscriptionID string) CampaignsClient { - return CampaignsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Activate activate a campaign previously created by a call to Create -// campaign. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. ID is campaign identifier. -func (client CampaignsClient) Activate(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (result CampaignStateResult, err error) { - req, err := client.ActivatePreparer(resourceGroupName, appCollection, appName, kind, ID) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Activate", nil, "Failure preparing request") - return - } - - resp, err := client.ActivateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Activate", resp, "Failure sending request") - return - } - - result, err = client.ActivateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Activate", resp, "Failure responding to request") - } - - return -} - -// ActivatePreparer prepares the Activate request. -func (client CampaignsClient) ActivatePreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/activate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ActivateSender sends the Activate request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) ActivateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ActivateResponder handles the response to the Activate request. The method always -// closes the http.Response Body. -func (client CampaignsClient) ActivateResponder(resp *http.Response) (result CampaignStateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create create a push campaign (announcement, poll, data push or native -// push). -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. parameters is parameters supplied to the Update Campaign -// operation. -func (client CampaignsClient) Create(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters Campaign) (result CampaignStateResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, - {Target: "parameters.Category", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, appCollection, appName, kind, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client CampaignsClient) CreatePreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters Campaign) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client CampaignsClient) CreateResponder(resp *http.Response) (result CampaignStateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a campaign previously created by a call to Create campaign. -// -// kind is campaign kind. ID is campaign identifier. resourceGroupName is the -// name of the resource group. appCollection is application collection. appName -// is application resource name. -func (client CampaignsClient) Delete(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(kind, ID, resourceGroupName, appCollection, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CampaignsClient) DeletePreparer(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CampaignsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Finish finish a push campaign previously activated by a call to Activate -// campaign. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. ID is campaign identifier. -func (client CampaignsClient) Finish(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (result CampaignStateResult, err error) { - req, err := client.FinishPreparer(resourceGroupName, appCollection, appName, kind, ID) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Finish", nil, "Failure preparing request") - return - } - - resp, err := client.FinishSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Finish", resp, "Failure sending request") - return - } - - result, err = client.FinishResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Finish", resp, "Failure responding to request") - } - - return -} - -// FinishPreparer prepares the Finish request. -func (client CampaignsClient) FinishPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/finish", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// FinishSender sends the Finish request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) FinishSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// FinishResponder handles the response to the Finish request. The method always -// closes the http.Response Body. -func (client CampaignsClient) FinishResponder(resp *http.Response) (result CampaignStateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get the Get campaign operation retrieves information about a previously -// created campaign. -// -// kind is campaign kind. ID is campaign identifier. resourceGroupName is the -// name of the resource group. appCollection is application collection. appName -// is application resource name. -func (client CampaignsClient) Get(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (result CampaignResult, err error) { - req, err := client.GetPreparer(kind, ID, resourceGroupName, appCollection, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CampaignsClient) GetPreparer(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CampaignsClient) GetResponder(resp *http.Response) (result CampaignResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByName the Get campaign operation retrieves information about a -// previously created campaign. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. name is campaign name. -func (client CampaignsClient) GetByName(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, name string) (result CampaignResult, err error) { - req, err := client.GetByNamePreparer(resourceGroupName, appCollection, appName, kind, name) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetByName", resp, "Failure responding to request") - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client CampaignsClient) GetByNamePreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "kind": autorest.Encode("path", kind), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaignsByName/{kind}/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client CampaignsClient) GetByNameResponder(resp *http.Response) (result CampaignResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStatistics get all the campaign statistics. -// -// kind is campaign kind. ID is campaign identifier. resourceGroupName is the -// name of the resource group. appCollection is application collection. appName -// is application resource name. -func (client CampaignsClient) GetStatistics(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (result CampaignStatisticsResult, err error) { - req, err := client.GetStatisticsPreparer(kind, ID, resourceGroupName, appCollection, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetStatistics", nil, "Failure preparing request") - return - } - - resp, err := client.GetStatisticsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetStatistics", resp, "Failure sending request") - return - } - - result, err = client.GetStatisticsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetStatistics", resp, "Failure responding to request") - } - - return -} - -// GetStatisticsPreparer prepares the GetStatistics request. -func (client CampaignsClient) GetStatisticsPreparer(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/statistics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetStatisticsSender sends the GetStatistics request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) GetStatisticsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetStatisticsResponder handles the response to the GetStatistics request. The method always -// closes the http.Response Body. -func (client CampaignsClient) GetStatisticsResponder(resp *http.Response) (result CampaignStatisticsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get the list of campaigns. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. skip is control paging of campaigns, start results at the -// given offset, defaults to 0 (1st page of data). top is control paging of -// campaigns, number of campaigns to return with each call. It returns all -// campaigns by default. When specifying $top parameter, the response contains -// a `nextLink` property describing the path to get the next page if there are -// more results. filter is filter can be used to restrict the results to -// campaigns matching a specific state. The syntax is `$filter=state eq -// 'draft'`. Valid state values are: draft, scheduled, in-progress, and -// finished. Only the eq operator and the state property are supported. orderby -// is sort results by an expression which looks like `$orderby=id asc` (this -// example is actually the default behavior). The syntax is orderby={property} -// {direction} or just orderby={property}. The available sorting properties are -// id, name, state, activatedDate, and finishedDate. The available directions -// are asc (for ascending order) and desc (for descending order). When not -// specified the asc direction is used. Only one property at a time can be used -// for sorting. search is restrict results to campaigns matching the optional -// `search` expression. This currently performs the search based on the name on -// the campaign only, case insensitive. If the campaign contains the value of -// the `search` parameter anywhere in the name, it matches. -func (client CampaignsClient) List(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, skip *int32, top *int32, filter string, orderby string, search string) (result CampaignsListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, appCollection, appName, kind, skip, top, filter, orderby, search) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client CampaignsClient) ListPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, skip *int32, top *int32, filter string, orderby string, search string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - if len(search) > 0 { - queryParameters["$search"] = autorest.Encode("query", search) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client CampaignsClient) ListResponder(resp *http.Response) (result CampaignsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client CampaignsClient) ListNextResults(lastResults CampaignsListResult) (result CampaignsListResult, err error) { - req, err := lastResults.CampaignsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Push push a previously saved campaign (created with Create campaign) to a -// set of devices. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. ID is campaign identifier. parameters is parameters supplied -// to the Push Campaign operation. -func (client CampaignsClient) Push(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignPushParameters) (result CampaignPushResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DeviceIds", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Data", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, - {Target: "parameters.Data.Category", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Data.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "Push") - } - - req, err := client.PushPreparer(resourceGroupName, appCollection, appName, kind, ID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Push", nil, "Failure preparing request") - return - } - - resp, err := client.PushSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Push", resp, "Failure sending request") - return - } - - result, err = client.PushResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Push", resp, "Failure responding to request") - } - - return -} - -// PushPreparer prepares the Push request. -func (client CampaignsClient) PushPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignPushParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/push", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PushSender sends the Push request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) PushSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PushResponder handles the response to the Push request. The method always -// closes the http.Response Body. -func (client CampaignsClient) PushResponder(resp *http.Response) (result CampaignPushResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Suspend suspend a push campaign previously activated by a call to Activate -// campaign. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. ID is campaign identifier. -func (client CampaignsClient) Suspend(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (result CampaignStateResult, err error) { - req, err := client.SuspendPreparer(resourceGroupName, appCollection, appName, kind, ID) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Suspend", resp, "Failure responding to request") - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client CampaignsClient) SuspendPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SuspendSender sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) SuspendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client CampaignsClient) SuspendResponder(resp *http.Response) (result CampaignStateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// TestNew test a new campaign on a set of devices. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. parameters is parameters supplied to the Test Campaign -// operation. -func (client CampaignsClient) TestNew(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters CampaignTestNewParameters) (result CampaignState, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Data", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, - {Target: "parameters.Data.Category", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Data.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "TestNew") - } - - req, err := client.TestNewPreparer(resourceGroupName, appCollection, appName, kind, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestNew", nil, "Failure preparing request") - return - } - - resp, err := client.TestNewSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestNew", resp, "Failure sending request") - return - } - - result, err = client.TestNewResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestNew", resp, "Failure responding to request") - } - - return -} - -// TestNewPreparer prepares the TestNew request. -func (client CampaignsClient) TestNewPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters CampaignTestNewParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/test", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TestNewSender sends the TestNew request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) TestNewSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TestNewResponder handles the response to the TestNew request. The method always -// closes the http.Response Body. -func (client CampaignsClient) TestNewResponder(resp *http.Response) (result CampaignState, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// TestSaved test an existing campaign (created with Create campaign) on a set -// of devices. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. kind is -// campaign kind. ID is campaign identifier. parameters is parameters supplied -// to the Test Campaign operation. -func (client CampaignsClient) TestSaved(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignTestSavedParameters) (result CampaignStateResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DeviceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "TestSaved") - } - - req, err := client.TestSavedPreparer(resourceGroupName, appCollection, appName, kind, ID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestSaved", nil, "Failure preparing request") - return - } - - resp, err := client.TestSavedSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestSaved", resp, "Failure sending request") - return - } - - result, err = client.TestSavedResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestSaved", resp, "Failure responding to request") - } - - return -} - -// TestSavedPreparer prepares the TestSaved request. -func (client CampaignsClient) TestSavedPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignTestSavedParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/test", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TestSavedSender sends the TestSaved request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) TestSavedSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TestSavedResponder handles the response to the TestSaved request. The method always -// closes the http.Response Body. -func (client CampaignsClient) TestSavedResponder(resp *http.Response) (result CampaignStateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an existing push campaign (announcement, poll, data push or -// native push). -// -// kind is campaign kind. ID is campaign identifier. parameters is parameters -// supplied to the Update Campaign operation. resourceGroupName is the name of -// the resource group. appCollection is application collection. appName is -// application resource name. -func (client CampaignsClient) Update(kind CampaignKinds, ID int32, parameters Campaign, resourceGroupName string, appCollection string, appName string) (result CampaignStateResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, - {Target: "parameters.Category", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "Update") - } - - req, err := client.UpdatePreparer(kind, ID, parameters, resourceGroupName, appCollection, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CampaignsClient) UpdatePreparer(kind CampaignKinds, ID int32, parameters Campaign, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "kind": autorest.Encode("path", kind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CampaignsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CampaignsClient) UpdateResponder(resp *http.Response) (result CampaignStateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CampaignsClient is the microsoft Azure Mobile Engagement REST APIs. +type CampaignsClient struct { + ManagementClient +} + +// NewCampaignsClient creates an instance of the CampaignsClient client. +func NewCampaignsClient(subscriptionID string) CampaignsClient { + return NewCampaignsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCampaignsClientWithBaseURI creates an instance of the CampaignsClient +// client. +func NewCampaignsClientWithBaseURI(baseURI string, subscriptionID string) CampaignsClient { + return CampaignsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Activate activate a campaign previously created by a call to Create +// campaign. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. ID is campaign identifier. +func (client CampaignsClient) Activate(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (result CampaignStateResult, err error) { + req, err := client.ActivatePreparer(resourceGroupName, appCollection, appName, kind, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Activate", nil, "Failure preparing request") + return + } + + resp, err := client.ActivateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Activate", resp, "Failure sending request") + return + } + + result, err = client.ActivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Activate", resp, "Failure responding to request") + } + + return +} + +// ActivatePreparer prepares the Activate request. +func (client CampaignsClient) ActivatePreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/activate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ActivateSender sends the Activate request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) ActivateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ActivateResponder handles the response to the Activate request. The method always +// closes the http.Response Body. +func (client CampaignsClient) ActivateResponder(resp *http.Response) (result CampaignStateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create create a push campaign (announcement, poll, data push or native +// push). +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. parameters is parameters supplied to the Update Campaign +// operation. +func (client CampaignsClient) Create(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters Campaign) (result CampaignStateResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, + {Target: "parameters.Category", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, appCollection, appName, kind, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client CampaignsClient) CreatePreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters Campaign) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client CampaignsClient) CreateResponder(resp *http.Response) (result CampaignStateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a campaign previously created by a call to Create campaign. +// +// kind is campaign kind. ID is campaign identifier. resourceGroupName is the +// name of the resource group. appCollection is application collection. appName +// is application resource name. +func (client CampaignsClient) Delete(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(kind, ID, resourceGroupName, appCollection, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CampaignsClient) DeletePreparer(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CampaignsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Finish finish a push campaign previously activated by a call to Activate +// campaign. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. ID is campaign identifier. +func (client CampaignsClient) Finish(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (result CampaignStateResult, err error) { + req, err := client.FinishPreparer(resourceGroupName, appCollection, appName, kind, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Finish", nil, "Failure preparing request") + return + } + + resp, err := client.FinishSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Finish", resp, "Failure sending request") + return + } + + result, err = client.FinishResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Finish", resp, "Failure responding to request") + } + + return +} + +// FinishPreparer prepares the Finish request. +func (client CampaignsClient) FinishPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/finish", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// FinishSender sends the Finish request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) FinishSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// FinishResponder handles the response to the Finish request. The method always +// closes the http.Response Body. +func (client CampaignsClient) FinishResponder(resp *http.Response) (result CampaignStateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get the Get campaign operation retrieves information about a previously +// created campaign. +// +// kind is campaign kind. ID is campaign identifier. resourceGroupName is the +// name of the resource group. appCollection is application collection. appName +// is application resource name. +func (client CampaignsClient) Get(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (result CampaignResult, err error) { + req, err := client.GetPreparer(kind, ID, resourceGroupName, appCollection, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CampaignsClient) GetPreparer(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CampaignsClient) GetResponder(resp *http.Response) (result CampaignResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByName the Get campaign operation retrieves information about a +// previously created campaign. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. name is campaign name. +func (client CampaignsClient) GetByName(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, name string) (result CampaignResult, err error) { + req, err := client.GetByNamePreparer(resourceGroupName, appCollection, appName, kind, name) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetByName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetByName", resp, "Failure sending request") + return + } + + result, err = client.GetByNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetByName", resp, "Failure responding to request") + } + + return +} + +// GetByNamePreparer prepares the GetByName request. +func (client CampaignsClient) GetByNamePreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "kind": autorest.Encode("path", kind), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaignsByName/{kind}/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByNameSender sends the GetByName request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) GetByNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByNameResponder handles the response to the GetByName request. The method always +// closes the http.Response Body. +func (client CampaignsClient) GetByNameResponder(resp *http.Response) (result CampaignResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStatistics get all the campaign statistics. +// +// kind is campaign kind. ID is campaign identifier. resourceGroupName is the +// name of the resource group. appCollection is application collection. appName +// is application resource name. +func (client CampaignsClient) GetStatistics(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (result CampaignStatisticsResult, err error) { + req, err := client.GetStatisticsPreparer(kind, ID, resourceGroupName, appCollection, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetStatistics", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatisticsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetStatistics", resp, "Failure sending request") + return + } + + result, err = client.GetStatisticsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "GetStatistics", resp, "Failure responding to request") + } + + return +} + +// GetStatisticsPreparer prepares the GetStatistics request. +func (client CampaignsClient) GetStatisticsPreparer(kind CampaignKinds, ID int32, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/statistics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetStatisticsSender sends the GetStatistics request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) GetStatisticsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetStatisticsResponder handles the response to the GetStatistics request. The method always +// closes the http.Response Body. +func (client CampaignsClient) GetStatisticsResponder(resp *http.Response) (result CampaignStatisticsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get the list of campaigns. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. skip is control paging of campaigns, start results at the +// given offset, defaults to 0 (1st page of data). top is control paging of +// campaigns, number of campaigns to return with each call. It returns all +// campaigns by default. When specifying $top parameter, the response contains +// a `nextLink` property describing the path to get the next page if there are +// more results. filter is filter can be used to restrict the results to +// campaigns matching a specific state. The syntax is `$filter=state eq +// 'draft'`. Valid state values are: draft, scheduled, in-progress, and +// finished. Only the eq operator and the state property are supported. orderby +// is sort results by an expression which looks like `$orderby=id asc` (this +// example is actually the default behavior). The syntax is orderby={property} +// {direction} or just orderby={property}. The available sorting properties are +// id, name, state, activatedDate, and finishedDate. The available directions +// are asc (for ascending order) and desc (for descending order). When not +// specified the asc direction is used. Only one property at a time can be used +// for sorting. search is restrict results to campaigns matching the optional +// `search` expression. This currently performs the search based on the name on +// the campaign only, case insensitive. If the campaign contains the value of +// the `search` parameter anywhere in the name, it matches. +func (client CampaignsClient) List(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, skip *int32, top *int32, filter string, orderby string, search string) (result CampaignsListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, appCollection, appName, kind, skip, top, filter, orderby, search) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client CampaignsClient) ListPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, skip *int32, top *int32, filter string, orderby string, search string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if len(search) > 0 { + queryParameters["$search"] = autorest.Encode("query", search) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CampaignsClient) ListResponder(resp *http.Response) (result CampaignsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client CampaignsClient) ListNextResults(lastResults CampaignsListResult) (result CampaignsListResult, err error) { + req, err := lastResults.CampaignsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Push push a previously saved campaign (created with Create campaign) to a +// set of devices. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. ID is campaign identifier. parameters is parameters supplied +// to the Push Campaign operation. +func (client CampaignsClient) Push(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignPushParameters) (result CampaignPushResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DeviceIds", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Data", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, + {Target: "parameters.Data.Category", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Data.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "Push") + } + + req, err := client.PushPreparer(resourceGroupName, appCollection, appName, kind, ID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Push", nil, "Failure preparing request") + return + } + + resp, err := client.PushSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Push", resp, "Failure sending request") + return + } + + result, err = client.PushResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Push", resp, "Failure responding to request") + } + + return +} + +// PushPreparer prepares the Push request. +func (client CampaignsClient) PushPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignPushParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/push", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PushSender sends the Push request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) PushSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PushResponder handles the response to the Push request. The method always +// closes the http.Response Body. +func (client CampaignsClient) PushResponder(resp *http.Response) (result CampaignPushResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Suspend suspend a push campaign previously activated by a call to Activate +// campaign. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. ID is campaign identifier. +func (client CampaignsClient) Suspend(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (result CampaignStateResult, err error) { + req, err := client.SuspendPreparer(resourceGroupName, appCollection, appName, kind, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Suspend", nil, "Failure preparing request") + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Suspend", resp, "Failure sending request") + return + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Suspend", resp, "Failure responding to request") + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client CampaignsClient) SuspendPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) SuspendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client CampaignsClient) SuspendResponder(resp *http.Response) (result CampaignStateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// TestNew test a new campaign on a set of devices. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. parameters is parameters supplied to the Test Campaign +// operation. +func (client CampaignsClient) TestNew(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters CampaignTestNewParameters) (result CampaignState, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Data", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Data.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, + {Target: "parameters.Data.Category", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Data.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "TestNew") + } + + req, err := client.TestNewPreparer(resourceGroupName, appCollection, appName, kind, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestNew", nil, "Failure preparing request") + return + } + + resp, err := client.TestNewSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestNew", resp, "Failure sending request") + return + } + + result, err = client.TestNewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestNew", resp, "Failure responding to request") + } + + return +} + +// TestNewPreparer prepares the TestNew request. +func (client CampaignsClient) TestNewPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, parameters CampaignTestNewParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/test", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TestNewSender sends the TestNew request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) TestNewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TestNewResponder handles the response to the TestNew request. The method always +// closes the http.Response Body. +func (client CampaignsClient) TestNewResponder(resp *http.Response) (result CampaignState, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// TestSaved test an existing campaign (created with Create campaign) on a set +// of devices. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. kind is +// campaign kind. ID is campaign identifier. parameters is parameters supplied +// to the Test Campaign operation. +func (client CampaignsClient) TestSaved(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignTestSavedParameters) (result CampaignStateResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DeviceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "TestSaved") + } + + req, err := client.TestSavedPreparer(resourceGroupName, appCollection, appName, kind, ID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestSaved", nil, "Failure preparing request") + return + } + + resp, err := client.TestSavedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestSaved", resp, "Failure sending request") + return + } + + result, err = client.TestSavedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "TestSaved", resp, "Failure responding to request") + } + + return +} + +// TestSavedPreparer prepares the TestSaved request. +func (client CampaignsClient) TestSavedPreparer(resourceGroupName string, appCollection string, appName string, kind CampaignKinds, ID int32, parameters CampaignTestSavedParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/test", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TestSavedSender sends the TestSaved request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) TestSavedSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TestSavedResponder handles the response to the TestSaved request. The method always +// closes the http.Response Body. +func (client CampaignsClient) TestSavedResponder(resp *http.Response) (result CampaignStateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update an existing push campaign (announcement, poll, data push or +// native push). +// +// kind is campaign kind. ID is campaign identifier. parameters is parameters +// supplied to the Update Campaign operation. resourceGroupName is the name of +// the resource group. appCollection is application collection. appName is +// application resource name. +func (client CampaignsClient) Update(kind CampaignKinds, ID int32, parameters Campaign, resourceGroupName string, appCollection string, appName string) (result CampaignStateResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Name", Name: validation.MaxLength, Rule: 64, Chain: nil}}}, + {Target: "parameters.Category", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Category", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.CampaignsClient", "Update") + } + + req, err := client.UpdatePreparer(kind, ID, parameters, resourceGroupName, appCollection, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.CampaignsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CampaignsClient) UpdatePreparer(kind CampaignKinds, ID int32, parameters Campaign, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "kind": autorest.Encode("path", kind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CampaignsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CampaignsClient) UpdateResponder(resp *http.Response) (result CampaignStateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/client.go index 38a25e18fd..c80e35de91 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/client.go @@ -1,53 +1,53 @@ -// Package mobileengagement implements the Azure ARM Mobileengagement service -// API version 2014-12-01. -// -// Microsoft Azure Mobile Engagement REST APIs. -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Mobileengagement - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Mobileengagement. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package mobileengagement implements the Azure ARM Mobileengagement service +// API version 2014-12-01. +// +// Microsoft Azure Mobile Engagement REST APIs. +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Mobileengagement + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Mobileengagement. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/devices.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/devices.go index 0bb6ea657a..2a221be159 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/devices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/devices.go @@ -1,477 +1,477 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DevicesClient is the microsoft Azure Mobile Engagement REST APIs. -type DevicesClient struct { - ManagementClient -} - -// NewDevicesClient creates an instance of the DevicesClient client. -func NewDevicesClient(subscriptionID string) DevicesClient { - return NewDevicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDevicesClientWithBaseURI creates an instance of the DevicesClient client. -func NewDevicesClientWithBaseURI(baseURI string, subscriptionID string) DevicesClient { - return DevicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByDeviceID get the information associated to a device running an -// application. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. deviceID is -// device identifier. -func (client DevicesClient) GetByDeviceID(resourceGroupName string, appCollection string, appName string, deviceID string) (result Device, err error) { - req, err := client.GetByDeviceIDPreparer(resourceGroupName, appCollection, appName, deviceID) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByDeviceID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByDeviceIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByDeviceID", resp, "Failure sending request") - return - } - - result, err = client.GetByDeviceIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByDeviceID", resp, "Failure responding to request") - } - - return -} - -// GetByDeviceIDPreparer prepares the GetByDeviceID request. -func (client DevicesClient) GetByDeviceIDPreparer(resourceGroupName string, appCollection string, appName string, deviceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "deviceId": autorest.Encode("path", deviceID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/{deviceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByDeviceIDSender sends the GetByDeviceID request. The method will close the -// http.Response Body if it receives an error. -func (client DevicesClient) GetByDeviceIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByDeviceIDResponder handles the response to the GetByDeviceID request. The method always -// closes the http.Response Body. -func (client DevicesClient) GetByDeviceIDResponder(resp *http.Response) (result Device, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByUserID get the information associated to a device running an -// application using the user identifier. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. userID is user -// identifier. -func (client DevicesClient) GetByUserID(resourceGroupName string, appCollection string, appName string, userID string) (result Device, err error) { - req, err := client.GetByUserIDPreparer(resourceGroupName, appCollection, appName, userID) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByUserID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByUserIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByUserID", resp, "Failure sending request") - return - } - - result, err = client.GetByUserIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByUserID", resp, "Failure responding to request") - } - - return -} - -// GetByUserIDPreparer prepares the GetByUserID request. -func (client DevicesClient) GetByUserIDPreparer(resourceGroupName string, appCollection string, appName string, userID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userId": autorest.Encode("path", userID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/users/{userId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByUserIDSender sends the GetByUserID request. The method will close the -// http.Response Body if it receives an error. -func (client DevicesClient) GetByUserIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByUserIDResponder handles the response to the GetByUserID request. The method always -// closes the http.Response Body. -func (client DevicesClient) GetByUserIDResponder(resp *http.Response) (result Device, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List query the information associated to the devices running an application. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. top is number -// of devices to return with each call. Defaults to 100 and cannot return more. -// Passing a greater value is ignored. The response contains a `nextLink` -// property describing the URI path to get the next page of results if not all -// results could be returned at once. selectParameter is by default all `meta` -// and `appInfo` properties are returned, this property is used to restrict the -// output to the desired properties. It also excludes all devices from the -// output that have none of the selected properties. In other terms, only -// devices having at least one of the selected property being set is part of -// the results. Examples: - `$select=appInfo` : select all devices having at -// least 1 appInfo, return them all and don’t return any meta property. - -// `$select=meta` : return only meta properties in the output. - -// `$select=appInfo,meta/firstSeen,meta/lastSeen` : return all `appInfo`, plus -// meta object containing only firstSeen and lastSeen properties. The format is -// thus a comma separated list of properties to select. Use `appInfo` to select -// all appInfo properties, `meta` to select all meta properties. Use -// `appInfo/{key}` and `meta/{key}` to select specific appInfo and meta -// properties. filter is filter can be used to reduce the number of results. -// Filter is a boolean expression that can look like the following examples: * -// `$filter=deviceId gt 'abcdef0123456789abcdef0123456789'` * -// `$filter=lastModified le 1447284263690L` * `$filter=(deviceId ge -// 'abcdef0123456789abcdef0123456789') and (deviceId lt -// 'bacdef0123456789abcdef0123456789') and (lastModified gt 1447284263690L)` -// The first example is used automatically for paging when returning the -// `nextLink` property. The filter expression is a combination of checks on -// some properties that can be compared to their value. The available operators -// are: * `gt` : greater than * `ge` : greater than or equals * `lt` : less -// than * `le` : less than or equals * `and` : to add multiple checks (all -// checks must pass), optional parentheses can be used. The properties that can -// be used in the expression are the following: * `deviceId {operator} -// '{deviceIdValue}'` : a lexicographical comparison is made on the deviceId -// value, use single quotes for the value. * `lastModified {operator} -// {number}L` : returns only meta properties or appInfo properties whose last -// value modification timestamp compared to the specified value is matching -// (value is milliseconds since January 1st, 1970 UTC). Please note the `L` -// character after the number of milliseconds, its required when the number of -// milliseconds exceeds `2^31 - 1` (which is always the case for recent -// timestamps). Using `lastModified` excludes all devices from the output that -// have no property matching the timestamp criteria, like `$select`. Please -// note that the internal value of `lastModified` timestamp for a given -// property is never part of the results. -func (client DevicesClient) List(resourceGroupName string, appCollection string, appName string, top *int32, selectParameter string, filter string) (result DevicesQueryResult, err error) { - req, err := client.ListPreparer(resourceGroupName, appCollection, appName, top, selectParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DevicesClient) ListPreparer(resourceGroupName string, appCollection string, appName string, top *int32, selectParameter string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DevicesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DevicesClient) ListResponder(resp *http.Response) (result DevicesQueryResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DevicesClient) ListNextResults(lastResults DevicesQueryResult) (result DevicesQueryResult, err error) { - req, err := lastResults.DevicesQueryResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// TagByDeviceID update the tags registered for a set of devices running an -// application. Updates are performed asynchronously, meaning that a few -// seconds are needed before the modifications appear in the results of the Get -// device command. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client DevicesClient) TagByDeviceID(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (result DeviceTagsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Tags", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.DevicesClient", "TagByDeviceID") - } - - req, err := client.TagByDeviceIDPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByDeviceID", nil, "Failure preparing request") - return - } - - resp, err := client.TagByDeviceIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByDeviceID", resp, "Failure sending request") - return - } - - result, err = client.TagByDeviceIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByDeviceID", resp, "Failure responding to request") - } - - return -} - -// TagByDeviceIDPreparer prepares the TagByDeviceID request. -func (client DevicesClient) TagByDeviceIDPreparer(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/tag", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TagByDeviceIDSender sends the TagByDeviceID request. The method will close the -// http.Response Body if it receives an error. -func (client DevicesClient) TagByDeviceIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TagByDeviceIDResponder handles the response to the TagByDeviceID request. The method always -// closes the http.Response Body. -func (client DevicesClient) TagByDeviceIDResponder(resp *http.Response) (result DeviceTagsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// TagByUserID update the tags registered for a set of users running an -// application. Updates are performed asynchronously, meaning that a few -// seconds are needed before the modifications appear in the results of the Get -// device command. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client DevicesClient) TagByUserID(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (result DeviceTagsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Tags", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.DevicesClient", "TagByUserID") - } - - req, err := client.TagByUserIDPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByUserID", nil, "Failure preparing request") - return - } - - resp, err := client.TagByUserIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByUserID", resp, "Failure sending request") - return - } - - result, err = client.TagByUserIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByUserID", resp, "Failure responding to request") - } - - return -} - -// TagByUserIDPreparer prepares the TagByUserID request. -func (client DevicesClient) TagByUserIDPreparer(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/users/tag", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TagByUserIDSender sends the TagByUserID request. The method will close the -// http.Response Body if it receives an error. -func (client DevicesClient) TagByUserIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TagByUserIDResponder handles the response to the TagByUserID request. The method always -// closes the http.Response Body. -func (client DevicesClient) TagByUserIDResponder(resp *http.Response) (result DeviceTagsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DevicesClient is the microsoft Azure Mobile Engagement REST APIs. +type DevicesClient struct { + ManagementClient +} + +// NewDevicesClient creates an instance of the DevicesClient client. +func NewDevicesClient(subscriptionID string) DevicesClient { + return NewDevicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDevicesClientWithBaseURI creates an instance of the DevicesClient client. +func NewDevicesClientWithBaseURI(baseURI string, subscriptionID string) DevicesClient { + return DevicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByDeviceID get the information associated to a device running an +// application. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. deviceID is +// device identifier. +func (client DevicesClient) GetByDeviceID(resourceGroupName string, appCollection string, appName string, deviceID string) (result Device, err error) { + req, err := client.GetByDeviceIDPreparer(resourceGroupName, appCollection, appName, deviceID) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByDeviceID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByDeviceIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByDeviceID", resp, "Failure sending request") + return + } + + result, err = client.GetByDeviceIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByDeviceID", resp, "Failure responding to request") + } + + return +} + +// GetByDeviceIDPreparer prepares the GetByDeviceID request. +func (client DevicesClient) GetByDeviceIDPreparer(resourceGroupName string, appCollection string, appName string, deviceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "deviceId": autorest.Encode("path", deviceID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/{deviceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByDeviceIDSender sends the GetByDeviceID request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetByDeviceIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByDeviceIDResponder handles the response to the GetByDeviceID request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetByDeviceIDResponder(resp *http.Response) (result Device, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByUserID get the information associated to a device running an +// application using the user identifier. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. userID is user +// identifier. +func (client DevicesClient) GetByUserID(resourceGroupName string, appCollection string, appName string, userID string) (result Device, err error) { + req, err := client.GetByUserIDPreparer(resourceGroupName, appCollection, appName, userID) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByUserID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByUserIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByUserID", resp, "Failure sending request") + return + } + + result, err = client.GetByUserIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "GetByUserID", resp, "Failure responding to request") + } + + return +} + +// GetByUserIDPreparer prepares the GetByUserID request. +func (client DevicesClient) GetByUserIDPreparer(resourceGroupName string, appCollection string, appName string, userID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userId": autorest.Encode("path", userID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/users/{userId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByUserIDSender sends the GetByUserID request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetByUserIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByUserIDResponder handles the response to the GetByUserID request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetByUserIDResponder(resp *http.Response) (result Device, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List query the information associated to the devices running an application. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. top is number +// of devices to return with each call. Defaults to 100 and cannot return more. +// Passing a greater value is ignored. The response contains a `nextLink` +// property describing the URI path to get the next page of results if not all +// results could be returned at once. selectParameter is by default all `meta` +// and `appInfo` properties are returned, this property is used to restrict the +// output to the desired properties. It also excludes all devices from the +// output that have none of the selected properties. In other terms, only +// devices having at least one of the selected property being set is part of +// the results. Examples: - `$select=appInfo` : select all devices having at +// least 1 appInfo, return them all and don’t return any meta property. - +// `$select=meta` : return only meta properties in the output. - +// `$select=appInfo,meta/firstSeen,meta/lastSeen` : return all `appInfo`, plus +// meta object containing only firstSeen and lastSeen properties. The format is +// thus a comma separated list of properties to select. Use `appInfo` to select +// all appInfo properties, `meta` to select all meta properties. Use +// `appInfo/{key}` and `meta/{key}` to select specific appInfo and meta +// properties. filter is filter can be used to reduce the number of results. +// Filter is a boolean expression that can look like the following examples: * +// `$filter=deviceId gt 'abcdef0123456789abcdef0123456789'` * +// `$filter=lastModified le 1447284263690L` * `$filter=(deviceId ge +// 'abcdef0123456789abcdef0123456789') and (deviceId lt +// 'bacdef0123456789abcdef0123456789') and (lastModified gt 1447284263690L)` +// The first example is used automatically for paging when returning the +// `nextLink` property. The filter expression is a combination of checks on +// some properties that can be compared to their value. The available operators +// are: * `gt` : greater than * `ge` : greater than or equals * `lt` : less +// than * `le` : less than or equals * `and` : to add multiple checks (all +// checks must pass), optional parentheses can be used. The properties that can +// be used in the expression are the following: * `deviceId {operator} +// '{deviceIdValue}'` : a lexicographical comparison is made on the deviceId +// value, use single quotes for the value. * `lastModified {operator} +// {number}L` : returns only meta properties or appInfo properties whose last +// value modification timestamp compared to the specified value is matching +// (value is milliseconds since January 1st, 1970 UTC). Please note the `L` +// character after the number of milliseconds, its required when the number of +// milliseconds exceeds `2^31 - 1` (which is always the case for recent +// timestamps). Using `lastModified` excludes all devices from the output that +// have no property matching the timestamp criteria, like `$select`. Please +// note that the internal value of `lastModified` timestamp for a given +// property is never part of the results. +func (client DevicesClient) List(resourceGroupName string, appCollection string, appName string, top *int32, selectParameter string, filter string) (result DevicesQueryResult, err error) { + req, err := client.ListPreparer(resourceGroupName, appCollection, appName, top, selectParameter, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DevicesClient) ListPreparer(resourceGroupName string, appCollection string, appName string, top *int32, selectParameter string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListResponder(resp *http.Response) (result DevicesQueryResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DevicesClient) ListNextResults(lastResults DevicesQueryResult) (result DevicesQueryResult, err error) { + req, err := lastResults.DevicesQueryResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// TagByDeviceID update the tags registered for a set of devices running an +// application. Updates are performed asynchronously, meaning that a few +// seconds are needed before the modifications appear in the results of the Get +// device command. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client DevicesClient) TagByDeviceID(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (result DeviceTagsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Tags", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.DevicesClient", "TagByDeviceID") + } + + req, err := client.TagByDeviceIDPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByDeviceID", nil, "Failure preparing request") + return + } + + resp, err := client.TagByDeviceIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByDeviceID", resp, "Failure sending request") + return + } + + result, err = client.TagByDeviceIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByDeviceID", resp, "Failure responding to request") + } + + return +} + +// TagByDeviceIDPreparer prepares the TagByDeviceID request. +func (client DevicesClient) TagByDeviceIDPreparer(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/tag", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TagByDeviceIDSender sends the TagByDeviceID request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) TagByDeviceIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TagByDeviceIDResponder handles the response to the TagByDeviceID request. The method always +// closes the http.Response Body. +func (client DevicesClient) TagByDeviceIDResponder(resp *http.Response) (result DeviceTagsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// TagByUserID update the tags registered for a set of users running an +// application. Updates are performed asynchronously, meaning that a few +// seconds are needed before the modifications appear in the results of the Get +// device command. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client DevicesClient) TagByUserID(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (result DeviceTagsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Tags", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.DevicesClient", "TagByUserID") + } + + req, err := client.TagByUserIDPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByUserID", nil, "Failure preparing request") + return + } + + resp, err := client.TagByUserIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByUserID", resp, "Failure sending request") + return + } + + result, err = client.TagByUserIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.DevicesClient", "TagByUserID", resp, "Failure responding to request") + } + + return +} + +// TagByUserIDPreparer prepares the TagByUserID request. +func (client DevicesClient) TagByUserIDPreparer(resourceGroupName string, appCollection string, appName string, parameters DeviceTagsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/users/tag", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TagByUserIDSender sends the TagByUserID request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) TagByUserIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TagByUserIDResponder handles the response to the TagByUserID request. The method always +// closes the http.Response Body. +func (client DevicesClient) TagByUserIDResponder(resp *http.Response) (result DeviceTagsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/exporttasks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/exporttasks.go index c465ab97df..8b7ab443d8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/exporttasks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/exporttasks.go @@ -1,1007 +1,1007 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ExportTasksClient is the microsoft Azure Mobile Engagement REST APIs. -type ExportTasksClient struct { - ManagementClient -} - -// NewExportTasksClient creates an instance of the ExportTasksClient client. -func NewExportTasksClient(subscriptionID string) ExportTasksClient { - return NewExportTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportTasksClientWithBaseURI creates an instance of the ExportTasksClient -// client. -func NewExportTasksClientWithBaseURI(baseURI string, subscriptionID string) ExportTasksClient { - return ExportTasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateActivitiesTask creates a task to export activities. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateActivitiesTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask") - } - - req, err := client.CreateActivitiesTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateActivitiesTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask", resp, "Failure sending request") - return - } - - result, err = client.CreateActivitiesTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask", resp, "Failure responding to request") - } - - return -} - -// CreateActivitiesTaskPreparer prepares the CreateActivitiesTask request. -func (client ExportTasksClient) CreateActivitiesTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/activities", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateActivitiesTaskSender sends the CreateActivitiesTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateActivitiesTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateActivitiesTaskResponder handles the response to the CreateActivitiesTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateActivitiesTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateCrashesTask creates a task to export crashes. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateCrashesTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask") - } - - req, err := client.CreateCrashesTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateCrashesTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask", resp, "Failure sending request") - return - } - - result, err = client.CreateCrashesTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask", resp, "Failure responding to request") - } - - return -} - -// CreateCrashesTaskPreparer prepares the CreateCrashesTask request. -func (client ExportTasksClient) CreateCrashesTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/crashes", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateCrashesTaskSender sends the CreateCrashesTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateCrashesTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateCrashesTaskResponder handles the response to the CreateCrashesTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateCrashesTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateErrorsTask creates a task to export errors. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateErrorsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask") - } - - req, err := client.CreateErrorsTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateErrorsTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask", resp, "Failure sending request") - return - } - - result, err = client.CreateErrorsTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask", resp, "Failure responding to request") - } - - return -} - -// CreateErrorsTaskPreparer prepares the CreateErrorsTask request. -func (client ExportTasksClient) CreateErrorsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/errors", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateErrorsTaskSender sends the CreateErrorsTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateErrorsTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateErrorsTaskResponder handles the response to the CreateErrorsTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateErrorsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateEventsTask creates a task to export events. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateEventsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask") - } - - req, err := client.CreateEventsTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateEventsTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask", resp, "Failure sending request") - return - } - - result, err = client.CreateEventsTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask", resp, "Failure responding to request") - } - - return -} - -// CreateEventsTaskPreparer prepares the CreateEventsTask request. -func (client ExportTasksClient) CreateEventsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/events", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateEventsTaskSender sends the CreateEventsTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateEventsTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateEventsTaskResponder handles the response to the CreateEventsTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateEventsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateFeedbackTaskByCampaign creates a task to export push campaign data for -// a set of campaigns. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateFeedbackTaskByCampaign(resourceGroupName string, appCollection string, appName string, parameters FeedbackByCampaignParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CampaignIds", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CampaignIds", Name: validation.MinItems, Rule: 1, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign") - } - - req, err := client.CreateFeedbackTaskByCampaignPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign", nil, "Failure preparing request") - return - } - - resp, err := client.CreateFeedbackTaskByCampaignSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign", resp, "Failure sending request") - return - } - - result, err = client.CreateFeedbackTaskByCampaignResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign", resp, "Failure responding to request") - } - - return -} - -// CreateFeedbackTaskByCampaignPreparer prepares the CreateFeedbackTaskByCampaign request. -func (client ExportTasksClient) CreateFeedbackTaskByCampaignPreparer(resourceGroupName string, appCollection string, appName string, parameters FeedbackByCampaignParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/feedbackByCampaign", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateFeedbackTaskByCampaignSender sends the CreateFeedbackTaskByCampaign request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateFeedbackTaskByCampaignSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateFeedbackTaskByCampaignResponder handles the response to the CreateFeedbackTaskByCampaign request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateFeedbackTaskByCampaignResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateFeedbackTaskByDateRange creates a task to export push campaign data -// for a date range. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateFeedbackTaskByDateRange(resourceGroupName string, appCollection string, appName string, parameters FeedbackByDateRangeParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CampaignWindowStart", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CampaignWindowEnd", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange") - } - - req, err := client.CreateFeedbackTaskByDateRangePreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange", nil, "Failure preparing request") - return - } - - resp, err := client.CreateFeedbackTaskByDateRangeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange", resp, "Failure sending request") - return - } - - result, err = client.CreateFeedbackTaskByDateRangeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange", resp, "Failure responding to request") - } - - return -} - -// CreateFeedbackTaskByDateRangePreparer prepares the CreateFeedbackTaskByDateRange request. -func (client ExportTasksClient) CreateFeedbackTaskByDateRangePreparer(resourceGroupName string, appCollection string, appName string, parameters FeedbackByDateRangeParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/feedbackByDate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateFeedbackTaskByDateRangeSender sends the CreateFeedbackTaskByDateRange request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateFeedbackTaskByDateRangeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateFeedbackTaskByDateRangeResponder handles the response to the CreateFeedbackTaskByDateRange request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateFeedbackTaskByDateRangeResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateJobsTask creates a task to export jobs. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateJobsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask") - } - - req, err := client.CreateJobsTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateJobsTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask", resp, "Failure sending request") - return - } - - result, err = client.CreateJobsTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask", resp, "Failure responding to request") - } - - return -} - -// CreateJobsTaskPreparer prepares the CreateJobsTask request. -func (client ExportTasksClient) CreateJobsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/jobs", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateJobsTaskSender sends the CreateJobsTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateJobsTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateJobsTaskResponder handles the response to the CreateJobsTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateJobsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateSessionsTask creates a task to export sessions. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateSessionsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask") - } - - req, err := client.CreateSessionsTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSessionsTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask", resp, "Failure sending request") - return - } - - result, err = client.CreateSessionsTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask", resp, "Failure responding to request") - } - - return -} - -// CreateSessionsTaskPreparer prepares the CreateSessionsTask request. -func (client ExportTasksClient) CreateSessionsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/sessions", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSessionsTaskSender sends the CreateSessionsTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateSessionsTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateSessionsTaskResponder handles the response to the CreateSessionsTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateSessionsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateTagsTask creates a task to export tags. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateTagsTask(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask") - } - - req, err := client.CreateTagsTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateTagsTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask", resp, "Failure sending request") - return - } - - result, err = client.CreateTagsTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask", resp, "Failure responding to request") - } - - return -} - -// CreateTagsTaskPreparer prepares the CreateTagsTask request. -func (client ExportTasksClient) CreateTagsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/tags", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateTagsTaskSender sends the CreateTagsTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateTagsTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateTagsTaskResponder handles the response to the CreateTagsTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateTagsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateTokensTask creates a task to export tags. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ExportTasksClient) CreateTokensTask(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (result ExportTaskResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask") - } - - req, err := client.CreateTokensTaskPreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask", nil, "Failure preparing request") - return - } - - resp, err := client.CreateTokensTaskSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask", resp, "Failure sending request") - return - } - - result, err = client.CreateTokensTaskResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask", resp, "Failure responding to request") - } - - return -} - -// CreateTokensTaskPreparer prepares the CreateTokensTask request. -func (client ExportTasksClient) CreateTokensTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/tokens", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateTokensTaskSender sends the CreateTokensTask request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) CreateTokensTaskSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateTokensTaskResponder handles the response to the CreateTokensTask request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) CreateTokensTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get retrieves information about a previously created export task. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. ID is export -// task identifier. -func (client ExportTasksClient) Get(resourceGroupName string, appCollection string, appName string, ID string) (result ExportTaskResult, err error) { - req, err := client.GetPreparer(resourceGroupName, appCollection, appName, ID) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportTasksClient) GetPreparer(resourceGroupName string, appCollection string, appName string, ID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) GetResponder(resp *http.Response) (result ExportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get the list of export tasks. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. skip is -// control paging of export tasks, start results at the given offset, defaults -// to 0 (1st page of data). top is control paging of export tasks, number of -// export tasks to return with each call. By default, it returns all export -// tasks with a default paging of 20. -// The response contains a `nextLink` property describing the path to get the -// next page if there are more results. -// The maximum paging limit for $top is 40. orderby is sort results by an -// expression which looks like `$orderby=taskId asc` (default when not -// specified). -// The syntax is orderby={property} {direction} or just orderby={property}. -// Properties that can be specified for sorting: taskId, errorDetails, -// dateCreated, taskStatus, and dateCreated. -// The available directions are asc (for ascending order) and desc (for -// descending order). -// When not specified the asc direction is used. -// Only one orderby property can be specified. -func (client ExportTasksClient) List(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (result ExportTaskListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 40, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, appCollection, appName, skip, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ExportTasksClient) ListPreparer(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExportTasksClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExportTasksClient) ListResponder(resp *http.Response) (result ExportTaskListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ExportTasksClient) ListNextResults(lastResults ExportTaskListResult) (result ExportTaskListResult, err error) { - req, err := lastResults.ExportTaskListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure responding to next results request") - } - - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ExportTasksClient is the microsoft Azure Mobile Engagement REST APIs. +type ExportTasksClient struct { + ManagementClient +} + +// NewExportTasksClient creates an instance of the ExportTasksClient client. +func NewExportTasksClient(subscriptionID string) ExportTasksClient { + return NewExportTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExportTasksClientWithBaseURI creates an instance of the ExportTasksClient +// client. +func NewExportTasksClientWithBaseURI(baseURI string, subscriptionID string) ExportTasksClient { + return ExportTasksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateActivitiesTask creates a task to export activities. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateActivitiesTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask") + } + + req, err := client.CreateActivitiesTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateActivitiesTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask", resp, "Failure sending request") + return + } + + result, err = client.CreateActivitiesTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateActivitiesTask", resp, "Failure responding to request") + } + + return +} + +// CreateActivitiesTaskPreparer prepares the CreateActivitiesTask request. +func (client ExportTasksClient) CreateActivitiesTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/activities", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateActivitiesTaskSender sends the CreateActivitiesTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateActivitiesTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateActivitiesTaskResponder handles the response to the CreateActivitiesTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateActivitiesTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateCrashesTask creates a task to export crashes. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateCrashesTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask") + } + + req, err := client.CreateCrashesTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateCrashesTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask", resp, "Failure sending request") + return + } + + result, err = client.CreateCrashesTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateCrashesTask", resp, "Failure responding to request") + } + + return +} + +// CreateCrashesTaskPreparer prepares the CreateCrashesTask request. +func (client ExportTasksClient) CreateCrashesTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/crashes", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateCrashesTaskSender sends the CreateCrashesTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateCrashesTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateCrashesTaskResponder handles the response to the CreateCrashesTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateCrashesTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateErrorsTask creates a task to export errors. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateErrorsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask") + } + + req, err := client.CreateErrorsTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateErrorsTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask", resp, "Failure sending request") + return + } + + result, err = client.CreateErrorsTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateErrorsTask", resp, "Failure responding to request") + } + + return +} + +// CreateErrorsTaskPreparer prepares the CreateErrorsTask request. +func (client ExportTasksClient) CreateErrorsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/errors", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateErrorsTaskSender sends the CreateErrorsTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateErrorsTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateErrorsTaskResponder handles the response to the CreateErrorsTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateErrorsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateEventsTask creates a task to export events. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateEventsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask") + } + + req, err := client.CreateEventsTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateEventsTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask", resp, "Failure sending request") + return + } + + result, err = client.CreateEventsTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateEventsTask", resp, "Failure responding to request") + } + + return +} + +// CreateEventsTaskPreparer prepares the CreateEventsTask request. +func (client ExportTasksClient) CreateEventsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/events", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateEventsTaskSender sends the CreateEventsTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateEventsTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateEventsTaskResponder handles the response to the CreateEventsTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateEventsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateFeedbackTaskByCampaign creates a task to export push campaign data for +// a set of campaigns. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateFeedbackTaskByCampaign(resourceGroupName string, appCollection string, appName string, parameters FeedbackByCampaignParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CampaignIds", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.CampaignIds", Name: validation.MinItems, Rule: 1, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign") + } + + req, err := client.CreateFeedbackTaskByCampaignPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign", nil, "Failure preparing request") + return + } + + resp, err := client.CreateFeedbackTaskByCampaignSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign", resp, "Failure sending request") + return + } + + result, err = client.CreateFeedbackTaskByCampaignResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByCampaign", resp, "Failure responding to request") + } + + return +} + +// CreateFeedbackTaskByCampaignPreparer prepares the CreateFeedbackTaskByCampaign request. +func (client ExportTasksClient) CreateFeedbackTaskByCampaignPreparer(resourceGroupName string, appCollection string, appName string, parameters FeedbackByCampaignParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/feedbackByCampaign", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateFeedbackTaskByCampaignSender sends the CreateFeedbackTaskByCampaign request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateFeedbackTaskByCampaignSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateFeedbackTaskByCampaignResponder handles the response to the CreateFeedbackTaskByCampaign request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateFeedbackTaskByCampaignResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateFeedbackTaskByDateRange creates a task to export push campaign data +// for a date range. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateFeedbackTaskByDateRange(resourceGroupName string, appCollection string, appName string, parameters FeedbackByDateRangeParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CampaignWindowStart", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CampaignWindowEnd", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange") + } + + req, err := client.CreateFeedbackTaskByDateRangePreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange", nil, "Failure preparing request") + return + } + + resp, err := client.CreateFeedbackTaskByDateRangeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange", resp, "Failure sending request") + return + } + + result, err = client.CreateFeedbackTaskByDateRangeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateFeedbackTaskByDateRange", resp, "Failure responding to request") + } + + return +} + +// CreateFeedbackTaskByDateRangePreparer prepares the CreateFeedbackTaskByDateRange request. +func (client ExportTasksClient) CreateFeedbackTaskByDateRangePreparer(resourceGroupName string, appCollection string, appName string, parameters FeedbackByDateRangeParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/feedbackByDate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateFeedbackTaskByDateRangeSender sends the CreateFeedbackTaskByDateRange request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateFeedbackTaskByDateRangeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateFeedbackTaskByDateRangeResponder handles the response to the CreateFeedbackTaskByDateRange request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateFeedbackTaskByDateRangeResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateJobsTask creates a task to export jobs. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateJobsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask") + } + + req, err := client.CreateJobsTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateJobsTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask", resp, "Failure sending request") + return + } + + result, err = client.CreateJobsTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateJobsTask", resp, "Failure responding to request") + } + + return +} + +// CreateJobsTaskPreparer prepares the CreateJobsTask request. +func (client ExportTasksClient) CreateJobsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/jobs", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateJobsTaskSender sends the CreateJobsTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateJobsTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateJobsTaskResponder handles the response to the CreateJobsTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateJobsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateSessionsTask creates a task to export sessions. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateSessionsTask(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StartDate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndDate", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask") + } + + req, err := client.CreateSessionsTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSessionsTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask", resp, "Failure sending request") + return + } + + result, err = client.CreateSessionsTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateSessionsTask", resp, "Failure responding to request") + } + + return +} + +// CreateSessionsTaskPreparer prepares the CreateSessionsTask request. +func (client ExportTasksClient) CreateSessionsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters DateRangeExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/sessions", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSessionsTaskSender sends the CreateSessionsTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateSessionsTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateSessionsTaskResponder handles the response to the CreateSessionsTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateSessionsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateTagsTask creates a task to export tags. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateTagsTask(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask") + } + + req, err := client.CreateTagsTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateTagsTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask", resp, "Failure sending request") + return + } + + result, err = client.CreateTagsTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTagsTask", resp, "Failure responding to request") + } + + return +} + +// CreateTagsTaskPreparer prepares the CreateTagsTask request. +func (client ExportTasksClient) CreateTagsTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/tags", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateTagsTaskSender sends the CreateTagsTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateTagsTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateTagsTaskResponder handles the response to the CreateTagsTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateTagsTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateTokensTask creates a task to export tags. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ExportTasksClient) CreateTokensTask(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (result ExportTaskResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ContainerURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask") + } + + req, err := client.CreateTokensTaskPreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask", nil, "Failure preparing request") + return + } + + resp, err := client.CreateTokensTaskSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask", resp, "Failure sending request") + return + } + + result, err = client.CreateTokensTaskResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "CreateTokensTask", resp, "Failure responding to request") + } + + return +} + +// CreateTokensTaskPreparer prepares the CreateTokensTask request. +func (client ExportTasksClient) CreateTokensTaskPreparer(resourceGroupName string, appCollection string, appName string, parameters ExportTaskParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/tokens", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateTokensTaskSender sends the CreateTokensTask request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) CreateTokensTaskSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateTokensTaskResponder handles the response to the CreateTokensTask request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) CreateTokensTaskResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieves information about a previously created export task. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. ID is export +// task identifier. +func (client ExportTasksClient) Get(resourceGroupName string, appCollection string, appName string, ID string) (result ExportTaskResult, err error) { + req, err := client.GetPreparer(resourceGroupName, appCollection, appName, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExportTasksClient) GetPreparer(resourceGroupName string, appCollection string, appName string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) GetResponder(resp *http.Response) (result ExportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get the list of export tasks. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. skip is +// control paging of export tasks, start results at the given offset, defaults +// to 0 (1st page of data). top is control paging of export tasks, number of +// export tasks to return with each call. By default, it returns all export +// tasks with a default paging of 20. +// The response contains a `nextLink` property describing the path to get the +// next page if there are more results. +// The maximum paging limit for $top is 40. orderby is sort results by an +// expression which looks like `$orderby=taskId asc` (default when not +// specified). +// The syntax is orderby={property} {direction} or just orderby={property}. +// Properties that can be specified for sorting: taskId, errorDetails, +// dateCreated, taskStatus, and dateCreated. +// The available directions are asc (for ascending order) and desc (for +// descending order). +// When not specified the asc direction is used. +// Only one orderby property can be specified. +func (client ExportTasksClient) List(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (result ExportTaskListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 40, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ExportTasksClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, appCollection, appName, skip, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExportTasksClient) ListPreparer(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/exportTasks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExportTasksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExportTasksClient) ListResponder(resp *http.Response) (result ExportTaskListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ExportTasksClient) ListNextResults(lastResults ExportTaskListResult) (result ExportTaskListResult, err error) { + req, err := lastResults.ExportTaskListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ExportTasksClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/importtasks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/importtasks.go index 1ba67ff9be..2fae682c87 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/importtasks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/importtasks.go @@ -1,309 +1,309 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ImportTasksClient is the microsoft Azure Mobile Engagement REST APIs. -type ImportTasksClient struct { - ManagementClient -} - -// NewImportTasksClient creates an instance of the ImportTasksClient client. -func NewImportTasksClient(subscriptionID string) ImportTasksClient { - return NewImportTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewImportTasksClientWithBaseURI creates an instance of the ImportTasksClient -// client. -func NewImportTasksClientWithBaseURI(baseURI string, subscriptionID string) ImportTasksClient { - return ImportTasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a job to import the specified data to a storageUrl. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. -func (client ImportTasksClient) Create(resourceGroupName string, appCollection string, appName string, parameters ImportTask) (result ImportTaskResult, err error) { - req, err := client.CreatePreparer(resourceGroupName, appCollection, appName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ImportTasksClient) CreatePreparer(resourceGroupName string, appCollection string, appName string, parameters ImportTask) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/importTasks", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ImportTasksClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ImportTasksClient) CreateResponder(resp *http.Response) (result ImportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get the Get import job operation retrieves information about a previously -// created import job. -// -// ID is import job identifier. resourceGroupName is the name of the resource -// group. appCollection is application collection. appName is application -// resource name. -func (client ImportTasksClient) Get(ID string, resourceGroupName string, appCollection string, appName string) (result ImportTaskResult, err error) { - req, err := client.GetPreparer(ID, resourceGroupName, appCollection, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ImportTasksClient) GetPreparer(ID string, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "id": autorest.Encode("path", ID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/importTasks/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ImportTasksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ImportTasksClient) GetResponder(resp *http.Response) (result ImportTaskResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get the list of import jobs. -// -// resourceGroupName is the name of the resource group. appCollection is -// application collection. appName is application resource name. skip is -// control paging of import jobs, start results at the given offset, defaults -// to 0 (1st page of data). top is control paging of import jobs, number of -// import jobs to return with each call. By default, it returns all import jobs -// with a default paging of 20. -// The response contains a `nextLink` property describing the path to get the -// next page if there are more results. -// The maximum paging limit for $top is 40. orderby is sort results by an -// expression which looks like `$orderby=jobId asc` (default when not -// specified). -// The syntax is orderby={property} {direction} or just orderby={property}. -// Properties that can be specified for sorting: jobId, errorDetails, -// dateCreated, jobStatus, and dateCreated. -// The available directions are asc (for ascending order) and desc (for -// descending order). -// When not specified the asc direction is used. -// Only one orderby property can be specified. -func (client ImportTasksClient) List(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (result ImportTaskListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 40, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "mobileengagement.ImportTasksClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, appCollection, appName, skip, top, orderby) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ImportTasksClient) ListPreparer(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appCollection": autorest.Encode("path", appCollection), - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderby) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderby) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/importTasks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ImportTasksClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ImportTasksClient) ListResponder(resp *http.Response) (result ImportTaskListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ImportTasksClient) ListNextResults(lastResults ImportTaskListResult) (result ImportTaskListResult, err error) { - req, err := lastResults.ImportTaskListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure responding to next results request") - } - - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ImportTasksClient is the microsoft Azure Mobile Engagement REST APIs. +type ImportTasksClient struct { + ManagementClient +} + +// NewImportTasksClient creates an instance of the ImportTasksClient client. +func NewImportTasksClient(subscriptionID string) ImportTasksClient { + return NewImportTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImportTasksClientWithBaseURI creates an instance of the ImportTasksClient +// client. +func NewImportTasksClientWithBaseURI(baseURI string, subscriptionID string) ImportTasksClient { + return ImportTasksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a job to import the specified data to a storageUrl. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. +func (client ImportTasksClient) Create(resourceGroupName string, appCollection string, appName string, parameters ImportTask) (result ImportTaskResult, err error) { + req, err := client.CreatePreparer(resourceGroupName, appCollection, appName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ImportTasksClient) CreatePreparer(resourceGroupName string, appCollection string, appName string, parameters ImportTask) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/importTasks", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ImportTasksClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ImportTasksClient) CreateResponder(resp *http.Response) (result ImportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get the Get import job operation retrieves information about a previously +// created import job. +// +// ID is import job identifier. resourceGroupName is the name of the resource +// group. appCollection is application collection. appName is application +// resource name. +func (client ImportTasksClient) Get(ID string, resourceGroupName string, appCollection string, appName string) (result ImportTaskResult, err error) { + req, err := client.GetPreparer(ID, resourceGroupName, appCollection, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ImportTasksClient) GetPreparer(ID string, resourceGroupName string, appCollection string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/importTasks/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ImportTasksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ImportTasksClient) GetResponder(resp *http.Response) (result ImportTaskResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get the list of import jobs. +// +// resourceGroupName is the name of the resource group. appCollection is +// application collection. appName is application resource name. skip is +// control paging of import jobs, start results at the given offset, defaults +// to 0 (1st page of data). top is control paging of import jobs, number of +// import jobs to return with each call. By default, it returns all import jobs +// with a default paging of 20. +// The response contains a `nextLink` property describing the path to get the +// next page if there are more results. +// The maximum paging limit for $top is 40. orderby is sort results by an +// expression which looks like `$orderby=jobId asc` (default when not +// specified). +// The syntax is orderby={property} {direction} or just orderby={property}. +// Properties that can be specified for sorting: jobId, errorDetails, +// dateCreated, jobStatus, and dateCreated. +// The available directions are asc (for ascending order) and desc (for +// descending order). +// When not specified the asc direction is used. +// Only one orderby property can be specified. +func (client ImportTasksClient) List(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (result ImportTaskListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: skip, + Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 40, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "mobileengagement.ImportTasksClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, appCollection, appName, skip, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ImportTasksClient) ListPreparer(resourceGroupName string, appCollection string, appName string, skip *int32, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appCollection": autorest.Encode("path", appCollection), + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/devices/importTasks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ImportTasksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ImportTasksClient) ListResponder(resp *http.Response) (result ImportTaskListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ImportTasksClient) ListNextResults(lastResults ImportTaskListResult) (result ImportTaskListResult, err error) { + req, err := lastResults.ImportTaskListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.ImportTasksClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/models.go index 790582a09a..92b9ad725c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/models.go @@ -1,920 +1,920 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AudienceOperators enumerates the values for audience operators. -type AudienceOperators string - -const ( - // EQ specifies the eq state for audience operators. - EQ AudienceOperators = "EQ" - // GE specifies the ge state for audience operators. - GE AudienceOperators = "GE" - // GT specifies the gt state for audience operators. - GT AudienceOperators = "GT" - // LE specifies the le state for audience operators. - LE AudienceOperators = "LE" - // LT specifies the lt state for audience operators. - LT AudienceOperators = "LT" -) - -// CampaignFeedbacks enumerates the values for campaign feedbacks. -type CampaignFeedbacks string - -const ( - // Actioned specifies the actioned state for campaign feedbacks. - Actioned CampaignFeedbacks = "actioned" - // Exited specifies the exited state for campaign feedbacks. - Exited CampaignFeedbacks = "exited" - // Pushed specifies the pushed state for campaign feedbacks. - Pushed CampaignFeedbacks = "pushed" - // Replied specifies the replied state for campaign feedbacks. - Replied CampaignFeedbacks = "replied" -) - -// CampaignKinds enumerates the values for campaign kinds. -type CampaignKinds string - -const ( - // Announcements specifies the announcements state for campaign kinds. - Announcements CampaignKinds = "announcements" - // DataPushes specifies the data pushes state for campaign kinds. - DataPushes CampaignKinds = "dataPushes" - // NativePushes specifies the native pushes state for campaign kinds. - NativePushes CampaignKinds = "nativePushes" - // Polls specifies the polls state for campaign kinds. - Polls CampaignKinds = "polls" -) - -// CampaignStates enumerates the values for campaign states. -type CampaignStates string - -const ( - // Draft specifies the draft state for campaign states. - Draft CampaignStates = "draft" - // Finished specifies the finished state for campaign states. - Finished CampaignStates = "finished" - // InProgress specifies the in progress state for campaign states. - InProgress CampaignStates = "in-progress" - // Queued specifies the queued state for campaign states. - Queued CampaignStates = "queued" - // Scheduled specifies the scheduled state for campaign states. - Scheduled CampaignStates = "scheduled" -) - -// CampaignType enumerates the values for campaign type. -type CampaignType string - -const ( - // Announcement specifies the announcement state for campaign type. - Announcement CampaignType = "Announcement" - // DataPush specifies the data push state for campaign type. - DataPush CampaignType = "DataPush" - // NativePush specifies the native push state for campaign type. - NativePush CampaignType = "NativePush" - // Poll specifies the poll state for campaign type. - Poll CampaignType = "Poll" -) - -// CampaignTypes enumerates the values for campaign types. -type CampaignTypes string - -const ( - // OnlyNotif specifies the only notif state for campaign types. - OnlyNotif CampaignTypes = "only_notif" - // Textbase64 specifies the textbase 64 state for campaign types. - Textbase64 CampaignTypes = "text/base64" - // Texthtml specifies the texthtml state for campaign types. - Texthtml CampaignTypes = "text/html" - // Textplain specifies the textplain state for campaign types. - Textplain CampaignTypes = "text/plain" -) - -// DeliveryTimes enumerates the values for delivery times. -type DeliveryTimes string - -const ( - // Any specifies the any state for delivery times. - Any DeliveryTimes = "any" - // Background specifies the background state for delivery times. - Background DeliveryTimes = "background" - // Session specifies the session state for delivery times. - Session DeliveryTimes = "session" -) - -// ExportFormat enumerates the values for export format. -type ExportFormat string - -const ( - // CsvBlob specifies the csv blob state for export format. - CsvBlob ExportFormat = "CsvBlob" - // JSONBlob specifies the json blob state for export format. - JSONBlob ExportFormat = "JsonBlob" -) - -// ExportState enumerates the values for export state. -type ExportState string - -const ( - // ExportStateFailed specifies the export state failed state for export - // state. - ExportStateFailed ExportState = "Failed" - // ExportStateQueued specifies the export state queued state for export - // state. - ExportStateQueued ExportState = "Queued" - // ExportStateStarted specifies the export state started state for export - // state. - ExportStateStarted ExportState = "Started" - // ExportStateSucceeded specifies the export state succeeded state for - // export state. - ExportStateSucceeded ExportState = "Succeeded" -) - -// ExportType enumerates the values for export type. -type ExportType string - -const ( - // ExportTypeActivity specifies the export type activity state for export - // type. - ExportTypeActivity ExportType = "Activity" - // ExportTypeCrash specifies the export type crash state for export type. - ExportTypeCrash ExportType = "Crash" - // ExportTypeError specifies the export type error state for export type. - ExportTypeError ExportType = "Error" - // ExportTypeEvent specifies the export type event state for export type. - ExportTypeEvent ExportType = "Event" - // ExportTypeJob specifies the export type job state for export type. - ExportTypeJob ExportType = "Job" - // ExportTypePush specifies the export type push state for export type. - ExportTypePush ExportType = "Push" - // ExportTypeSession specifies the export type session state for export - // type. - ExportTypeSession ExportType = "Session" - // ExportTypeTag specifies the export type tag state for export type. - ExportTypeTag ExportType = "Tag" - // ExportTypeToken specifies the export type token state for export type. - ExportTypeToken ExportType = "Token" -) - -// JobStates enumerates the values for job states. -type JobStates string - -const ( - // JobStatesFailed specifies the job states failed state for job states. - JobStatesFailed JobStates = "Failed" - // JobStatesQueued specifies the job states queued state for job states. - JobStatesQueued JobStates = "Queued" - // JobStatesStarted specifies the job states started state for job states. - JobStatesStarted JobStates = "Started" - // JobStatesSucceeded specifies the job states succeeded state for job - // states. - JobStatesSucceeded JobStates = "Succeeded" -) - -// NotificationTypes enumerates the values for notification types. -type NotificationTypes string - -const ( - // Popup specifies the popup state for notification types. - Popup NotificationTypes = "popup" - // System specifies the system state for notification types. - System NotificationTypes = "system" -) - -// ProvisioningStates enumerates the values for provisioning states. -type ProvisioningStates string - -const ( - // Creating specifies the creating state for provisioning states. - Creating ProvisioningStates = "Creating" - // Succeeded specifies the succeeded state for provisioning states. - Succeeded ProvisioningStates = "Succeeded" -) - -// PushModes enumerates the values for push modes. -type PushModes string - -const ( - // Manual specifies the manual state for push modes. - Manual PushModes = "manual" - // OneShot specifies the one shot state for push modes. - OneShot PushModes = "one-shot" - // RealTime specifies the real time state for push modes. - RealTime PushModes = "real-time" -) - -// AnnouncementFeedbackCriterion is used to target devices who received an -// announcement. -type AnnouncementFeedbackCriterion struct { - ContentID *int32 `json:"content-id,omitempty"` - Action CampaignFeedbacks `json:"action,omitempty"` -} - -// APIError is -type APIError struct { - Error *APIErrorError `json:"error,omitempty"` -} - -// APIErrorError is -type APIErrorError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// App is the Mobile Engagement App resource. -type App struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AppProperties `json:"properties,omitempty"` -} - -// AppCollection is the AppCollection resource. -type AppCollection struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AppCollectionProperties `json:"properties,omitempty"` -} - -// AppCollectionListResult is the list AppCollections operation response. -type AppCollectionListResult struct { - autorest.Response `json:"-"` - Value *[]AppCollection `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppCollectionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppCollectionListResult) AppCollectionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AppCollectionNameAvailability is -type AppCollectionNameAvailability struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Available *bool `json:"available,omitempty"` - UnavailabilityReason *string `json:"unavailabilityReason,omitempty"` -} - -// AppCollectionProperties is -type AppCollectionProperties struct { - ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` -} - -// AppInfoFilter is send only to users who have some app info set. This is a -// special filter that is automatically added if your campaign contains appInfo -// parameters. It is not intended to be public and should not be used as it -// could be removed or replaced by the API. -type AppInfoFilter struct { - AppInfo *[]string `json:"appInfo,omitempty"` -} - -// ApplicationVersionCriterion is used to target devices based on the version -// of the application they are using. -type ApplicationVersionCriterion struct { - Name *string `json:"name,omitempty"` -} - -// AppListResult is the list Apps operation response. -type AppListResult struct { - autorest.Response `json:"-"` - Value *[]App `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppListResult) AppListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AppProperties is -type AppProperties struct { - BackendID *string `json:"backendId,omitempty"` - Platform *string `json:"platform,omitempty"` - AppState *string `json:"appState,omitempty"` -} - -// BooleanTagCriterion is target devices based on a boolean tag value. -type BooleanTagCriterion struct { - Name *string `json:"name,omitempty"` - Value *bool `json:"value,omitempty"` -} - -// Campaign is -type Campaign struct { - NotificationTitle *string `json:"notificationTitle,omitempty"` - NotificationMessage *string `json:"notificationMessage,omitempty"` - NotificationImage *[]byte `json:"notificationImage,omitempty"` - NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - ActionButtonText *string `json:"actionButtonText,omitempty"` - ExitButtonText *string `json:"exitButtonText,omitempty"` - ActionURL *string `json:"actionUrl,omitempty"` - Payload *map[string]interface{} `json:"payload,omitempty"` - Name *string `json:"name,omitempty"` - Audience *CampaignAudience `json:"audience,omitempty"` - Category *string `json:"category,omitempty"` - PushMode PushModes `json:"pushMode,omitempty"` - Type CampaignTypes `json:"type,omitempty"` - DeliveryTime DeliveryTimes `json:"deliveryTime,omitempty"` - DeliveryActivities *[]string `json:"deliveryActivities,omitempty"` - StartTime *string `json:"startTime,omitempty"` - EndTime *string `json:"endTime,omitempty"` - Timezone *string `json:"timezone,omitempty"` - NotificationType NotificationTypes `json:"notificationType,omitempty"` - NotificationIcon *bool `json:"notificationIcon,omitempty"` - NotificationCloseable *bool `json:"notificationCloseable,omitempty"` - NotificationVibrate *bool `json:"notificationVibrate,omitempty"` - NotificationSound *bool `json:"notificationSound,omitempty"` - NotificationBadge *bool `json:"notificationBadge,omitempty"` - Localization *map[string]*CampaignLocalization `json:"localization,omitempty"` - Questions *[]PollQuestion `json:"questions,omitempty"` -} - -// CampaignAudience is specify which users will be targeted by this campaign. -// By default, all users will be targeted. If you set `pushMode` property to -// `manual`, the only thing you can specify in the audience is the push quota -// filter. An audience is a boolean expression made of criteria (variables) -// operators (`not`, `and` or `or`) and parenthesis. Additionally, a set of -// filters can be added to an audience. 65535 bytes max as per JSON encoding. -type CampaignAudience struct { - Expression *string `json:"expression,omitempty"` - Criteria *map[string]*Criterion `json:"criteria,omitempty"` - Filters *[]Filter `json:"filters,omitempty"` -} - -// CampaignListResult is -type CampaignListResult struct { - State CampaignStates `json:"state,omitempty"` - ID *int32 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - ActivatedDate *date.Time `json:"activatedDate,omitempty"` - FinishedDate *date.Time `json:"finishedDate,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Timezone *string `json:"timezone,omitempty"` -} - -// CampaignLocalization is -type CampaignLocalization struct { - NotificationTitle *string `json:"notificationTitle,omitempty"` - NotificationMessage *string `json:"notificationMessage,omitempty"` - NotificationImage *[]byte `json:"notificationImage,omitempty"` - NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - ActionButtonText *string `json:"actionButtonText,omitempty"` - ExitButtonText *string `json:"exitButtonText,omitempty"` - ActionURL *string `json:"actionUrl,omitempty"` - Payload *map[string]interface{} `json:"payload,omitempty"` -} - -// CampaignPushParameters is -type CampaignPushParameters struct { - DeviceIds *[]string `json:"deviceIds,omitempty"` - Data *Campaign `json:"data,omitempty"` -} - -// CampaignPushResult is -type CampaignPushResult struct { - autorest.Response `json:"-"` - InvalidDeviceIds *[]string `json:"invalidDeviceIds,omitempty"` -} - -// CampaignResult is -type CampaignResult struct { - autorest.Response `json:"-"` - NotificationTitle *string `json:"notificationTitle,omitempty"` - NotificationMessage *string `json:"notificationMessage,omitempty"` - NotificationImage *[]byte `json:"notificationImage,omitempty"` - NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - ActionButtonText *string `json:"actionButtonText,omitempty"` - ExitButtonText *string `json:"exitButtonText,omitempty"` - ActionURL *string `json:"actionUrl,omitempty"` - Payload *map[string]interface{} `json:"payload,omitempty"` - Name *string `json:"name,omitempty"` - Audience *CampaignAudience `json:"audience,omitempty"` - Category *string `json:"category,omitempty"` - PushMode PushModes `json:"pushMode,omitempty"` - Type CampaignTypes `json:"type,omitempty"` - DeliveryTime DeliveryTimes `json:"deliveryTime,omitempty"` - DeliveryActivities *[]string `json:"deliveryActivities,omitempty"` - StartTime *string `json:"startTime,omitempty"` - EndTime *string `json:"endTime,omitempty"` - Timezone *string `json:"timezone,omitempty"` - NotificationType NotificationTypes `json:"notificationType,omitempty"` - NotificationIcon *bool `json:"notificationIcon,omitempty"` - NotificationCloseable *bool `json:"notificationCloseable,omitempty"` - NotificationVibrate *bool `json:"notificationVibrate,omitempty"` - NotificationSound *bool `json:"notificationSound,omitempty"` - NotificationBadge *bool `json:"notificationBadge,omitempty"` - Localization *map[string]*CampaignLocalization `json:"localization,omitempty"` - Questions *[]PollQuestion `json:"questions,omitempty"` - ID *int32 `json:"id,omitempty"` - State CampaignStates `json:"state,omitempty"` - ActivatedDate *date.Time `json:"activatedDate,omitempty"` - FinishedDate *date.Time `json:"finishedDate,omitempty"` -} - -// CampaignsListResult is the campaigns list result. -type CampaignsListResult struct { - autorest.Response `json:"-"` - Value *[]CampaignListResult `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CampaignsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CampaignsListResult) CampaignsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CampaignState is -type CampaignState struct { - autorest.Response `json:"-"` - State CampaignStates `json:"state,omitempty"` -} - -// CampaignStateResult is -type CampaignStateResult struct { - autorest.Response `json:"-"` - State CampaignStates `json:"state,omitempty"` - ID *int32 `json:"id,omitempty"` -} - -// CampaignStatisticsResult is -type CampaignStatisticsResult struct { - autorest.Response `json:"-"` - Queued *int32 `json:"queued,omitempty"` - Pushed *int32 `json:"pushed,omitempty"` - PushedNative *int32 `json:"pushed-native,omitempty"` - PushedNativeGoogle *int32 `json:"pushed-native-google,omitempty"` - PushedNativeAdm *int32 `json:"pushed-native-adm,omitempty"` - Delivered *int32 `json:"delivered,omitempty"` - Dropped *int32 `json:"dropped,omitempty"` - SystemNotificationDisplayed *int32 `json:"system-notification-displayed,omitempty"` - InAppNotificationDisplayed *int32 `json:"in-app-notification-displayed,omitempty"` - ContentDisplayed *int32 `json:"content-displayed,omitempty"` - SystemNotificationActioned *int32 `json:"system-notification-actioned,omitempty"` - SystemNotificationExited *int32 `json:"system-notification-exited,omitempty"` - InAppNotificationActioned *int32 `json:"in-app-notification-actioned,omitempty"` - InAppNotificationExited *int32 `json:"in-app-notification-exited,omitempty"` - ContentActioned *int32 `json:"content-actioned,omitempty"` - ContentExited *int32 `json:"content-exited,omitempty"` - Answers *map[string]*map[string]interface{} `json:"answers,omitempty"` -} - -// CampaignTestNewParameters is -type CampaignTestNewParameters struct { - DeviceID *string `json:"deviceId,omitempty"` - Lang *string `json:"lang,omitempty"` - Data *Campaign `json:"data,omitempty"` -} - -// CampaignTestSavedParameters is -type CampaignTestSavedParameters struct { - DeviceID *string `json:"deviceId,omitempty"` - Lang *string `json:"lang,omitempty"` -} - -// CarrierCountryCriterion is used to target devices based on their carrier -// country. -type CarrierCountryCriterion struct { - Name *string `json:"name,omitempty"` -} - -// CarrierNameCriterion is used to target devices based on their carrier name. -type CarrierNameCriterion struct { - Name *string `json:"name,omitempty"` -} - -// Criterion is -type Criterion struct { -} - -// DatapushFeedbackCriterion is used to target devices who received a data -// push. -type DatapushFeedbackCriterion struct { - ContentID *int32 `json:"content-id,omitempty"` - Action CampaignFeedbacks `json:"action,omitempty"` -} - -// DateRangeExportTaskParameter is -type DateRangeExportTaskParameter struct { - ContainerURL *string `json:"containerUrl,omitempty"` - Description *string `json:"description,omitempty"` - StartDate *date.Date `json:"startDate,omitempty"` - EndDate *date.Date `json:"endDate,omitempty"` - ExportFormat ExportFormat `json:"exportFormat,omitempty"` -} - -// DateTagCriterion is target devices based on a date tag value. -type DateTagCriterion struct { - Name *string `json:"name,omitempty"` - Value *date.Date `json:"value,omitempty"` - Op AudienceOperators `json:"op,omitempty"` -} - -// Device is -type Device struct { - autorest.Response `json:"-"` - DeviceID *string `json:"deviceId,omitempty"` - Meta *DeviceMeta `json:"meta,omitempty"` - Info *DeviceInfo `json:"info,omitempty"` - Location *DeviceLocation `json:"location,omitempty"` - AppInfo *map[string]*string `json:"appInfo,omitempty"` -} - -// DeviceInfo is -type DeviceInfo struct { - PhoneModel *string `json:"phoneModel,omitempty"` - PhoneManufacturer *string `json:"phoneManufacturer,omitempty"` - FirmwareVersion *string `json:"firmwareVersion,omitempty"` - FirmwareName *string `json:"firmwareName,omitempty"` - AndroidAPILevel *int32 `json:"androidAPILevel,omitempty"` - CarrierCountry *string `json:"carrierCountry,omitempty"` - Locale *string `json:"locale,omitempty"` - CarrierName *string `json:"carrierName,omitempty"` - NetworkType *string `json:"networkType,omitempty"` - NetworkSubtype *string `json:"networkSubtype,omitempty"` - ApplicationVersionName *string `json:"applicationVersionName,omitempty"` - ApplicationVersionCode *int32 `json:"applicationVersionCode,omitempty"` - TimeZoneOffset *int32 `json:"timeZoneOffset,omitempty"` - ServiceVersion *string `json:"serviceVersion,omitempty"` -} - -// DeviceLocation is -type DeviceLocation struct { - Countrycode *string `json:"countrycode,omitempty"` - Region *string `json:"region,omitempty"` - Locality *string `json:"locality,omitempty"` -} - -// DeviceManufacturerCriterion is used to target devices based on the device -// manufacturer. -type DeviceManufacturerCriterion struct { - Name *string `json:"name,omitempty"` -} - -// DeviceMeta is -type DeviceMeta struct { - FirstSeen *int64 `json:"firstSeen,omitempty"` - LastSeen *int64 `json:"lastSeen,omitempty"` - LastInfo *int64 `json:"lastInfo,omitempty"` - LastLocation *int64 `json:"lastLocation,omitempty"` - NativePushEnabled *bool `json:"nativePushEnabled,omitempty"` -} - -// DeviceModelCriterion is used to target devices based on the device model. -type DeviceModelCriterion struct { - Name *string `json:"name,omitempty"` -} - -// DeviceQueryResult is -type DeviceQueryResult struct { - DeviceID *string `json:"deviceId,omitempty"` - Meta *DeviceMeta `json:"meta,omitempty"` - AppInfo *map[string]*string `json:"appInfo,omitempty"` -} - -// DevicesQueryResult is the campaigns list result. -type DevicesQueryResult struct { - autorest.Response `json:"-"` - Value *[]DeviceQueryResult `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DevicesQueryResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DevicesQueryResult) DevicesQueryResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DeviceTagsParameters is -type DeviceTagsParameters struct { - Tags *map[string]map[string]*string `json:"tags,omitempty"` - DeleteOnNull *bool `json:"deleteOnNull,omitempty"` -} - -// DeviceTagsResult is -type DeviceTagsResult struct { - autorest.Response `json:"-"` - InvalidIds *[]string `json:"invalidIds,omitempty"` -} - -// EngageActiveUsersFilter is send only to users who have used the app in the -// last {threshold} days. -type EngageActiveUsersFilter struct { - Threshold *int32 `json:"threshold,omitempty"` -} - -// EngageIdleUsersFilter is send only to users who haven't used the app in the -// last {threshold} days. -type EngageIdleUsersFilter struct { - Threshold *int32 `json:"threshold,omitempty"` -} - -// EngageNewUsersFilter is send only to users whose first app use is less than -// {threshold} days old. -type EngageNewUsersFilter struct { - Threshold *int32 `json:"threshold,omitempty"` -} - -// EngageOldUsersFilter is send only to users whose first app use is more than -// {threshold} days old. -type EngageOldUsersFilter struct { - Threshold *int32 `json:"threshold,omitempty"` -} - -// EngageSubsetFilter is send only to a maximum of max users. -type EngageSubsetFilter struct { - Max *int32 `json:"max,omitempty"` -} - -// ExportOptions is options to control export generation. -type ExportOptions struct { - ExportUserID *bool `json:"exportUserId,omitempty"` -} - -// ExportTaskListResult is gets a paged list of ExportTasks. -type ExportTaskListResult struct { - autorest.Response `json:"-"` - Value *[]ExportTaskResult `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExportTaskListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ExportTaskListResult) ExportTaskListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ExportTaskParameter is -type ExportTaskParameter struct { - ContainerURL *string `json:"containerUrl,omitempty"` - Description *string `json:"description,omitempty"` - ExportFormat ExportFormat `json:"exportFormat,omitempty"` -} - -// ExportTaskResult is -type ExportTaskResult struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Description *string `json:"description,omitempty"` - State ExportState `json:"state,omitempty"` - DateCreated *date.Time `json:"dateCreated,omitempty"` - DateCompleted *date.Time `json:"dateCompleted,omitempty"` - ExportType ExportType `json:"exportType,omitempty"` - ErrorDetails *string `json:"errorDetails,omitempty"` -} - -// FeedbackByCampaignParameter is -type FeedbackByCampaignParameter struct { - ContainerURL *string `json:"containerUrl,omitempty"` - Description *string `json:"description,omitempty"` - CampaignType CampaignType `json:"campaignType,omitempty"` - CampaignIds *[]int32 `json:"campaignIds,omitempty"` - ExportFormat ExportFormat `json:"exportFormat,omitempty"` -} - -// FeedbackByDateRangeParameter is -type FeedbackByDateRangeParameter struct { - ContainerURL *string `json:"containerUrl,omitempty"` - Description *string `json:"description,omitempty"` - CampaignType CampaignType `json:"campaignType,omitempty"` - CampaignWindowStart *date.Time `json:"campaignWindowStart,omitempty"` - CampaignWindowEnd *date.Time `json:"campaignWindowEnd,omitempty"` - ExportFormat ExportFormat `json:"exportFormat,omitempty"` -} - -// Filter is -type Filter struct { -} - -// FirmwareVersionCriterion is used to target devices based on their firmware -// version. -type FirmwareVersionCriterion struct { - Name *string `json:"name,omitempty"` -} - -// GeoFencingCriterion is used to target devices based on a specific region. A -// center point (defined by a latitude and longitude) and a radius form the -// boundary for the region. This criterion will be met when the user crosses -// the boundaries of the region. -type GeoFencingCriterion struct { - Lat *float64 `json:"lat,omitempty"` - Lon *float64 `json:"lon,omitempty"` - Radius *int32 `json:"radius,omitempty"` - Expiration *int32 `json:"expiration,omitempty"` -} - -// ImportTask is -type ImportTask struct { - StorageURL *string `json:"storageUrl,omitempty"` -} - -// ImportTaskListResult is gets a paged list of import tasks. -type ImportTaskListResult struct { - autorest.Response `json:"-"` - Value *[]ImportTaskResult `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ImportTaskListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ImportTaskListResult) ImportTaskListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ImportTaskResult is -type ImportTaskResult struct { - autorest.Response `json:"-"` - StorageURL *string `json:"storageUrl,omitempty"` - ID *string `json:"id,omitempty"` - State JobStates `json:"state,omitempty"` - DateCreated *date.Time `json:"dateCreated,omitempty"` - DateCompleted *date.Time `json:"dateCompleted,omitempty"` - ErrorDetails *string `json:"errorDetails,omitempty"` -} - -// IntegerTagCriterion is target devices based on an integer tag value. -type IntegerTagCriterion struct { - Name *string `json:"name,omitempty"` - Value *int32 `json:"value,omitempty"` - Op AudienceOperators `json:"op,omitempty"` -} - -// LanguageCriterion is used to target devices based on the language of their -// device. -type LanguageCriterion struct { - Name *string `json:"name,omitempty"` -} - -// LocationCriterion is used to target devices based on their last know area. -type LocationCriterion struct { - Country *string `json:"country,omitempty"` - Region *string `json:"region,omitempty"` - Locality *string `json:"locality,omitempty"` -} - -// NativePushEnabledFilter is engage only users with native push enabled. -type NativePushEnabledFilter struct { -} - -// NetworkTypeCriterion is used to target devices based their network type. -type NetworkTypeCriterion struct { - Name *string `json:"name,omitempty"` -} - -// NotificationOptions is -type NotificationOptions struct { - BigText *string `json:"bigText,omitempty"` - BigPicture *string `json:"bigPicture,omitempty"` - Sound *string `json:"sound,omitempty"` - ActionText *string `json:"actionText,omitempty"` -} - -// PollAnswerFeedbackCriterion is used to target devices who answered X to a -// given question. -type PollAnswerFeedbackCriterion struct { - ContentID *int32 `json:"content-id,omitempty"` - ChoiceID *int32 `json:"choice-id,omitempty"` -} - -// PollFeedbackCriterion is used to target devices who received a poll. -type PollFeedbackCriterion struct { - ContentID *int32 `json:"content-id,omitempty"` - Action CampaignFeedbacks `json:"action,omitempty"` -} - -// PollQuestion is -type PollQuestion struct { - Title *string `json:"title,omitempty"` - ID *int32 `json:"id,omitempty"` - Localization *map[string]*PollQuestionLocalization `json:"localization,omitempty"` - Choices *[]PollQuestionChoice `json:"choices,omitempty"` -} - -// PollQuestionChoice is -type PollQuestionChoice struct { - Title *string `json:"title,omitempty"` - ID *int32 `json:"id,omitempty"` - Localization *map[string]*PollQuestionChoiceLocalization `json:"localization,omitempty"` - IsDefault *bool `json:"isDefault,omitempty"` -} - -// PollQuestionChoiceLocalization is -type PollQuestionChoiceLocalization struct { - Title *string `json:"title,omitempty"` -} - -// PollQuestionLocalization is -type PollQuestionLocalization struct { - Title *string `json:"title,omitempty"` -} - -// PushQuotaFilter is engage only users for whom the push quota is not reached. -type PushQuotaFilter struct { -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ScreenSizeCriterion is used to target devices based on the screen resolution -// of their device. -type ScreenSizeCriterion struct { - Name *string `json:"name,omitempty"` -} - -// SegmentCriterion is target devices based on an existing segment. -type SegmentCriterion struct { - ID *int32 `json:"id,omitempty"` - Exclude *bool `json:"exclude,omitempty"` -} - -// StringTagCriterion is target devices based on a string tag value. -type StringTagCriterion struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// SupportedPlatformsListResult is -type SupportedPlatformsListResult struct { - autorest.Response `json:"-"` - Platforms *[]string `json:"platforms,omitempty"` -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AudienceOperators enumerates the values for audience operators. +type AudienceOperators string + +const ( + // EQ specifies the eq state for audience operators. + EQ AudienceOperators = "EQ" + // GE specifies the ge state for audience operators. + GE AudienceOperators = "GE" + // GT specifies the gt state for audience operators. + GT AudienceOperators = "GT" + // LE specifies the le state for audience operators. + LE AudienceOperators = "LE" + // LT specifies the lt state for audience operators. + LT AudienceOperators = "LT" +) + +// CampaignFeedbacks enumerates the values for campaign feedbacks. +type CampaignFeedbacks string + +const ( + // Actioned specifies the actioned state for campaign feedbacks. + Actioned CampaignFeedbacks = "actioned" + // Exited specifies the exited state for campaign feedbacks. + Exited CampaignFeedbacks = "exited" + // Pushed specifies the pushed state for campaign feedbacks. + Pushed CampaignFeedbacks = "pushed" + // Replied specifies the replied state for campaign feedbacks. + Replied CampaignFeedbacks = "replied" +) + +// CampaignKinds enumerates the values for campaign kinds. +type CampaignKinds string + +const ( + // Announcements specifies the announcements state for campaign kinds. + Announcements CampaignKinds = "announcements" + // DataPushes specifies the data pushes state for campaign kinds. + DataPushes CampaignKinds = "dataPushes" + // NativePushes specifies the native pushes state for campaign kinds. + NativePushes CampaignKinds = "nativePushes" + // Polls specifies the polls state for campaign kinds. + Polls CampaignKinds = "polls" +) + +// CampaignStates enumerates the values for campaign states. +type CampaignStates string + +const ( + // Draft specifies the draft state for campaign states. + Draft CampaignStates = "draft" + // Finished specifies the finished state for campaign states. + Finished CampaignStates = "finished" + // InProgress specifies the in progress state for campaign states. + InProgress CampaignStates = "in-progress" + // Queued specifies the queued state for campaign states. + Queued CampaignStates = "queued" + // Scheduled specifies the scheduled state for campaign states. + Scheduled CampaignStates = "scheduled" +) + +// CampaignType enumerates the values for campaign type. +type CampaignType string + +const ( + // Announcement specifies the announcement state for campaign type. + Announcement CampaignType = "Announcement" + // DataPush specifies the data push state for campaign type. + DataPush CampaignType = "DataPush" + // NativePush specifies the native push state for campaign type. + NativePush CampaignType = "NativePush" + // Poll specifies the poll state for campaign type. + Poll CampaignType = "Poll" +) + +// CampaignTypes enumerates the values for campaign types. +type CampaignTypes string + +const ( + // OnlyNotif specifies the only notif state for campaign types. + OnlyNotif CampaignTypes = "only_notif" + // Textbase64 specifies the textbase 64 state for campaign types. + Textbase64 CampaignTypes = "text/base64" + // Texthtml specifies the texthtml state for campaign types. + Texthtml CampaignTypes = "text/html" + // Textplain specifies the textplain state for campaign types. + Textplain CampaignTypes = "text/plain" +) + +// DeliveryTimes enumerates the values for delivery times. +type DeliveryTimes string + +const ( + // Any specifies the any state for delivery times. + Any DeliveryTimes = "any" + // Background specifies the background state for delivery times. + Background DeliveryTimes = "background" + // Session specifies the session state for delivery times. + Session DeliveryTimes = "session" +) + +// ExportFormat enumerates the values for export format. +type ExportFormat string + +const ( + // CsvBlob specifies the csv blob state for export format. + CsvBlob ExportFormat = "CsvBlob" + // JSONBlob specifies the json blob state for export format. + JSONBlob ExportFormat = "JsonBlob" +) + +// ExportState enumerates the values for export state. +type ExportState string + +const ( + // ExportStateFailed specifies the export state failed state for export + // state. + ExportStateFailed ExportState = "Failed" + // ExportStateQueued specifies the export state queued state for export + // state. + ExportStateQueued ExportState = "Queued" + // ExportStateStarted specifies the export state started state for export + // state. + ExportStateStarted ExportState = "Started" + // ExportStateSucceeded specifies the export state succeeded state for + // export state. + ExportStateSucceeded ExportState = "Succeeded" +) + +// ExportType enumerates the values for export type. +type ExportType string + +const ( + // ExportTypeActivity specifies the export type activity state for export + // type. + ExportTypeActivity ExportType = "Activity" + // ExportTypeCrash specifies the export type crash state for export type. + ExportTypeCrash ExportType = "Crash" + // ExportTypeError specifies the export type error state for export type. + ExportTypeError ExportType = "Error" + // ExportTypeEvent specifies the export type event state for export type. + ExportTypeEvent ExportType = "Event" + // ExportTypeJob specifies the export type job state for export type. + ExportTypeJob ExportType = "Job" + // ExportTypePush specifies the export type push state for export type. + ExportTypePush ExportType = "Push" + // ExportTypeSession specifies the export type session state for export + // type. + ExportTypeSession ExportType = "Session" + // ExportTypeTag specifies the export type tag state for export type. + ExportTypeTag ExportType = "Tag" + // ExportTypeToken specifies the export type token state for export type. + ExportTypeToken ExportType = "Token" +) + +// JobStates enumerates the values for job states. +type JobStates string + +const ( + // JobStatesFailed specifies the job states failed state for job states. + JobStatesFailed JobStates = "Failed" + // JobStatesQueued specifies the job states queued state for job states. + JobStatesQueued JobStates = "Queued" + // JobStatesStarted specifies the job states started state for job states. + JobStatesStarted JobStates = "Started" + // JobStatesSucceeded specifies the job states succeeded state for job + // states. + JobStatesSucceeded JobStates = "Succeeded" +) + +// NotificationTypes enumerates the values for notification types. +type NotificationTypes string + +const ( + // Popup specifies the popup state for notification types. + Popup NotificationTypes = "popup" + // System specifies the system state for notification types. + System NotificationTypes = "system" +) + +// ProvisioningStates enumerates the values for provisioning states. +type ProvisioningStates string + +const ( + // Creating specifies the creating state for provisioning states. + Creating ProvisioningStates = "Creating" + // Succeeded specifies the succeeded state for provisioning states. + Succeeded ProvisioningStates = "Succeeded" +) + +// PushModes enumerates the values for push modes. +type PushModes string + +const ( + // Manual specifies the manual state for push modes. + Manual PushModes = "manual" + // OneShot specifies the one shot state for push modes. + OneShot PushModes = "one-shot" + // RealTime specifies the real time state for push modes. + RealTime PushModes = "real-time" +) + +// AnnouncementFeedbackCriterion is used to target devices who received an +// announcement. +type AnnouncementFeedbackCriterion struct { + ContentID *int32 `json:"content-id,omitempty"` + Action CampaignFeedbacks `json:"action,omitempty"` +} + +// APIError is +type APIError struct { + Error *APIErrorError `json:"error,omitempty"` +} + +// APIErrorError is +type APIErrorError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// App is the Mobile Engagement App resource. +type App struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppProperties `json:"properties,omitempty"` +} + +// AppCollection is the AppCollection resource. +type AppCollection struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppCollectionProperties `json:"properties,omitempty"` +} + +// AppCollectionListResult is the list AppCollections operation response. +type AppCollectionListResult struct { + autorest.Response `json:"-"` + Value *[]AppCollection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppCollectionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppCollectionListResult) AppCollectionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppCollectionNameAvailability is +type AppCollectionNameAvailability struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Available *bool `json:"available,omitempty"` + UnavailabilityReason *string `json:"unavailabilityReason,omitempty"` +} + +// AppCollectionProperties is +type AppCollectionProperties struct { + ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` +} + +// AppInfoFilter is send only to users who have some app info set. This is a +// special filter that is automatically added if your campaign contains appInfo +// parameters. It is not intended to be public and should not be used as it +// could be removed or replaced by the API. +type AppInfoFilter struct { + AppInfo *[]string `json:"appInfo,omitempty"` +} + +// ApplicationVersionCriterion is used to target devices based on the version +// of the application they are using. +type ApplicationVersionCriterion struct { + Name *string `json:"name,omitempty"` +} + +// AppListResult is the list Apps operation response. +type AppListResult struct { + autorest.Response `json:"-"` + Value *[]App `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppListResult) AppListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppProperties is +type AppProperties struct { + BackendID *string `json:"backendId,omitempty"` + Platform *string `json:"platform,omitempty"` + AppState *string `json:"appState,omitempty"` +} + +// BooleanTagCriterion is target devices based on a boolean tag value. +type BooleanTagCriterion struct { + Name *string `json:"name,omitempty"` + Value *bool `json:"value,omitempty"` +} + +// Campaign is +type Campaign struct { + NotificationTitle *string `json:"notificationTitle,omitempty"` + NotificationMessage *string `json:"notificationMessage,omitempty"` + NotificationImage *[]byte `json:"notificationImage,omitempty"` + NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + ActionButtonText *string `json:"actionButtonText,omitempty"` + ExitButtonText *string `json:"exitButtonText,omitempty"` + ActionURL *string `json:"actionUrl,omitempty"` + Payload *map[string]interface{} `json:"payload,omitempty"` + Name *string `json:"name,omitempty"` + Audience *CampaignAudience `json:"audience,omitempty"` + Category *string `json:"category,omitempty"` + PushMode PushModes `json:"pushMode,omitempty"` + Type CampaignTypes `json:"type,omitempty"` + DeliveryTime DeliveryTimes `json:"deliveryTime,omitempty"` + DeliveryActivities *[]string `json:"deliveryActivities,omitempty"` + StartTime *string `json:"startTime,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Timezone *string `json:"timezone,omitempty"` + NotificationType NotificationTypes `json:"notificationType,omitempty"` + NotificationIcon *bool `json:"notificationIcon,omitempty"` + NotificationCloseable *bool `json:"notificationCloseable,omitempty"` + NotificationVibrate *bool `json:"notificationVibrate,omitempty"` + NotificationSound *bool `json:"notificationSound,omitempty"` + NotificationBadge *bool `json:"notificationBadge,omitempty"` + Localization *map[string]*CampaignLocalization `json:"localization,omitempty"` + Questions *[]PollQuestion `json:"questions,omitempty"` +} + +// CampaignAudience is specify which users will be targeted by this campaign. +// By default, all users will be targeted. If you set `pushMode` property to +// `manual`, the only thing you can specify in the audience is the push quota +// filter. An audience is a boolean expression made of criteria (variables) +// operators (`not`, `and` or `or`) and parenthesis. Additionally, a set of +// filters can be added to an audience. 65535 bytes max as per JSON encoding. +type CampaignAudience struct { + Expression *string `json:"expression,omitempty"` + Criteria *map[string]*Criterion `json:"criteria,omitempty"` + Filters *[]Filter `json:"filters,omitempty"` +} + +// CampaignListResult is +type CampaignListResult struct { + State CampaignStates `json:"state,omitempty"` + ID *int32 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + ActivatedDate *date.Time `json:"activatedDate,omitempty"` + FinishedDate *date.Time `json:"finishedDate,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Timezone *string `json:"timezone,omitempty"` +} + +// CampaignLocalization is +type CampaignLocalization struct { + NotificationTitle *string `json:"notificationTitle,omitempty"` + NotificationMessage *string `json:"notificationMessage,omitempty"` + NotificationImage *[]byte `json:"notificationImage,omitempty"` + NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + ActionButtonText *string `json:"actionButtonText,omitempty"` + ExitButtonText *string `json:"exitButtonText,omitempty"` + ActionURL *string `json:"actionUrl,omitempty"` + Payload *map[string]interface{} `json:"payload,omitempty"` +} + +// CampaignPushParameters is +type CampaignPushParameters struct { + DeviceIds *[]string `json:"deviceIds,omitempty"` + Data *Campaign `json:"data,omitempty"` +} + +// CampaignPushResult is +type CampaignPushResult struct { + autorest.Response `json:"-"` + InvalidDeviceIds *[]string `json:"invalidDeviceIds,omitempty"` +} + +// CampaignResult is +type CampaignResult struct { + autorest.Response `json:"-"` + NotificationTitle *string `json:"notificationTitle,omitempty"` + NotificationMessage *string `json:"notificationMessage,omitempty"` + NotificationImage *[]byte `json:"notificationImage,omitempty"` + NotificationOptions *NotificationOptions `json:"notificationOptions,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + ActionButtonText *string `json:"actionButtonText,omitempty"` + ExitButtonText *string `json:"exitButtonText,omitempty"` + ActionURL *string `json:"actionUrl,omitempty"` + Payload *map[string]interface{} `json:"payload,omitempty"` + Name *string `json:"name,omitempty"` + Audience *CampaignAudience `json:"audience,omitempty"` + Category *string `json:"category,omitempty"` + PushMode PushModes `json:"pushMode,omitempty"` + Type CampaignTypes `json:"type,omitempty"` + DeliveryTime DeliveryTimes `json:"deliveryTime,omitempty"` + DeliveryActivities *[]string `json:"deliveryActivities,omitempty"` + StartTime *string `json:"startTime,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Timezone *string `json:"timezone,omitempty"` + NotificationType NotificationTypes `json:"notificationType,omitempty"` + NotificationIcon *bool `json:"notificationIcon,omitempty"` + NotificationCloseable *bool `json:"notificationCloseable,omitempty"` + NotificationVibrate *bool `json:"notificationVibrate,omitempty"` + NotificationSound *bool `json:"notificationSound,omitempty"` + NotificationBadge *bool `json:"notificationBadge,omitempty"` + Localization *map[string]*CampaignLocalization `json:"localization,omitempty"` + Questions *[]PollQuestion `json:"questions,omitempty"` + ID *int32 `json:"id,omitempty"` + State CampaignStates `json:"state,omitempty"` + ActivatedDate *date.Time `json:"activatedDate,omitempty"` + FinishedDate *date.Time `json:"finishedDate,omitempty"` +} + +// CampaignsListResult is the campaigns list result. +type CampaignsListResult struct { + autorest.Response `json:"-"` + Value *[]CampaignListResult `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CampaignsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CampaignsListResult) CampaignsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CampaignState is +type CampaignState struct { + autorest.Response `json:"-"` + State CampaignStates `json:"state,omitempty"` +} + +// CampaignStateResult is +type CampaignStateResult struct { + autorest.Response `json:"-"` + State CampaignStates `json:"state,omitempty"` + ID *int32 `json:"id,omitempty"` +} + +// CampaignStatisticsResult is +type CampaignStatisticsResult struct { + autorest.Response `json:"-"` + Queued *int32 `json:"queued,omitempty"` + Pushed *int32 `json:"pushed,omitempty"` + PushedNative *int32 `json:"pushed-native,omitempty"` + PushedNativeGoogle *int32 `json:"pushed-native-google,omitempty"` + PushedNativeAdm *int32 `json:"pushed-native-adm,omitempty"` + Delivered *int32 `json:"delivered,omitempty"` + Dropped *int32 `json:"dropped,omitempty"` + SystemNotificationDisplayed *int32 `json:"system-notification-displayed,omitempty"` + InAppNotificationDisplayed *int32 `json:"in-app-notification-displayed,omitempty"` + ContentDisplayed *int32 `json:"content-displayed,omitempty"` + SystemNotificationActioned *int32 `json:"system-notification-actioned,omitempty"` + SystemNotificationExited *int32 `json:"system-notification-exited,omitempty"` + InAppNotificationActioned *int32 `json:"in-app-notification-actioned,omitempty"` + InAppNotificationExited *int32 `json:"in-app-notification-exited,omitempty"` + ContentActioned *int32 `json:"content-actioned,omitempty"` + ContentExited *int32 `json:"content-exited,omitempty"` + Answers *map[string]*map[string]interface{} `json:"answers,omitempty"` +} + +// CampaignTestNewParameters is +type CampaignTestNewParameters struct { + DeviceID *string `json:"deviceId,omitempty"` + Lang *string `json:"lang,omitempty"` + Data *Campaign `json:"data,omitempty"` +} + +// CampaignTestSavedParameters is +type CampaignTestSavedParameters struct { + DeviceID *string `json:"deviceId,omitempty"` + Lang *string `json:"lang,omitempty"` +} + +// CarrierCountryCriterion is used to target devices based on their carrier +// country. +type CarrierCountryCriterion struct { + Name *string `json:"name,omitempty"` +} + +// CarrierNameCriterion is used to target devices based on their carrier name. +type CarrierNameCriterion struct { + Name *string `json:"name,omitempty"` +} + +// Criterion is +type Criterion struct { +} + +// DatapushFeedbackCriterion is used to target devices who received a data +// push. +type DatapushFeedbackCriterion struct { + ContentID *int32 `json:"content-id,omitempty"` + Action CampaignFeedbacks `json:"action,omitempty"` +} + +// DateRangeExportTaskParameter is +type DateRangeExportTaskParameter struct { + ContainerURL *string `json:"containerUrl,omitempty"` + Description *string `json:"description,omitempty"` + StartDate *date.Date `json:"startDate,omitempty"` + EndDate *date.Date `json:"endDate,omitempty"` + ExportFormat ExportFormat `json:"exportFormat,omitempty"` +} + +// DateTagCriterion is target devices based on a date tag value. +type DateTagCriterion struct { + Name *string `json:"name,omitempty"` + Value *date.Date `json:"value,omitempty"` + Op AudienceOperators `json:"op,omitempty"` +} + +// Device is +type Device struct { + autorest.Response `json:"-"` + DeviceID *string `json:"deviceId,omitempty"` + Meta *DeviceMeta `json:"meta,omitempty"` + Info *DeviceInfo `json:"info,omitempty"` + Location *DeviceLocation `json:"location,omitempty"` + AppInfo *map[string]*string `json:"appInfo,omitempty"` +} + +// DeviceInfo is +type DeviceInfo struct { + PhoneModel *string `json:"phoneModel,omitempty"` + PhoneManufacturer *string `json:"phoneManufacturer,omitempty"` + FirmwareVersion *string `json:"firmwareVersion,omitempty"` + FirmwareName *string `json:"firmwareName,omitempty"` + AndroidAPILevel *int32 `json:"androidAPILevel,omitempty"` + CarrierCountry *string `json:"carrierCountry,omitempty"` + Locale *string `json:"locale,omitempty"` + CarrierName *string `json:"carrierName,omitempty"` + NetworkType *string `json:"networkType,omitempty"` + NetworkSubtype *string `json:"networkSubtype,omitempty"` + ApplicationVersionName *string `json:"applicationVersionName,omitempty"` + ApplicationVersionCode *int32 `json:"applicationVersionCode,omitempty"` + TimeZoneOffset *int32 `json:"timeZoneOffset,omitempty"` + ServiceVersion *string `json:"serviceVersion,omitempty"` +} + +// DeviceLocation is +type DeviceLocation struct { + Countrycode *string `json:"countrycode,omitempty"` + Region *string `json:"region,omitempty"` + Locality *string `json:"locality,omitempty"` +} + +// DeviceManufacturerCriterion is used to target devices based on the device +// manufacturer. +type DeviceManufacturerCriterion struct { + Name *string `json:"name,omitempty"` +} + +// DeviceMeta is +type DeviceMeta struct { + FirstSeen *int64 `json:"firstSeen,omitempty"` + LastSeen *int64 `json:"lastSeen,omitempty"` + LastInfo *int64 `json:"lastInfo,omitempty"` + LastLocation *int64 `json:"lastLocation,omitempty"` + NativePushEnabled *bool `json:"nativePushEnabled,omitempty"` +} + +// DeviceModelCriterion is used to target devices based on the device model. +type DeviceModelCriterion struct { + Name *string `json:"name,omitempty"` +} + +// DeviceQueryResult is +type DeviceQueryResult struct { + DeviceID *string `json:"deviceId,omitempty"` + Meta *DeviceMeta `json:"meta,omitempty"` + AppInfo *map[string]*string `json:"appInfo,omitempty"` +} + +// DevicesQueryResult is the campaigns list result. +type DevicesQueryResult struct { + autorest.Response `json:"-"` + Value *[]DeviceQueryResult `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DevicesQueryResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DevicesQueryResult) DevicesQueryResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DeviceTagsParameters is +type DeviceTagsParameters struct { + Tags *map[string]map[string]*string `json:"tags,omitempty"` + DeleteOnNull *bool `json:"deleteOnNull,omitempty"` +} + +// DeviceTagsResult is +type DeviceTagsResult struct { + autorest.Response `json:"-"` + InvalidIds *[]string `json:"invalidIds,omitempty"` +} + +// EngageActiveUsersFilter is send only to users who have used the app in the +// last {threshold} days. +type EngageActiveUsersFilter struct { + Threshold *int32 `json:"threshold,omitempty"` +} + +// EngageIdleUsersFilter is send only to users who haven't used the app in the +// last {threshold} days. +type EngageIdleUsersFilter struct { + Threshold *int32 `json:"threshold,omitempty"` +} + +// EngageNewUsersFilter is send only to users whose first app use is less than +// {threshold} days old. +type EngageNewUsersFilter struct { + Threshold *int32 `json:"threshold,omitempty"` +} + +// EngageOldUsersFilter is send only to users whose first app use is more than +// {threshold} days old. +type EngageOldUsersFilter struct { + Threshold *int32 `json:"threshold,omitempty"` +} + +// EngageSubsetFilter is send only to a maximum of max users. +type EngageSubsetFilter struct { + Max *int32 `json:"max,omitempty"` +} + +// ExportOptions is options to control export generation. +type ExportOptions struct { + ExportUserID *bool `json:"exportUserId,omitempty"` +} + +// ExportTaskListResult is gets a paged list of ExportTasks. +type ExportTaskListResult struct { + autorest.Response `json:"-"` + Value *[]ExportTaskResult `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExportTaskListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ExportTaskListResult) ExportTaskListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ExportTaskParameter is +type ExportTaskParameter struct { + ContainerURL *string `json:"containerUrl,omitempty"` + Description *string `json:"description,omitempty"` + ExportFormat ExportFormat `json:"exportFormat,omitempty"` +} + +// ExportTaskResult is +type ExportTaskResult struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Description *string `json:"description,omitempty"` + State ExportState `json:"state,omitempty"` + DateCreated *date.Time `json:"dateCreated,omitempty"` + DateCompleted *date.Time `json:"dateCompleted,omitempty"` + ExportType ExportType `json:"exportType,omitempty"` + ErrorDetails *string `json:"errorDetails,omitempty"` +} + +// FeedbackByCampaignParameter is +type FeedbackByCampaignParameter struct { + ContainerURL *string `json:"containerUrl,omitempty"` + Description *string `json:"description,omitempty"` + CampaignType CampaignType `json:"campaignType,omitempty"` + CampaignIds *[]int32 `json:"campaignIds,omitempty"` + ExportFormat ExportFormat `json:"exportFormat,omitempty"` +} + +// FeedbackByDateRangeParameter is +type FeedbackByDateRangeParameter struct { + ContainerURL *string `json:"containerUrl,omitempty"` + Description *string `json:"description,omitempty"` + CampaignType CampaignType `json:"campaignType,omitempty"` + CampaignWindowStart *date.Time `json:"campaignWindowStart,omitempty"` + CampaignWindowEnd *date.Time `json:"campaignWindowEnd,omitempty"` + ExportFormat ExportFormat `json:"exportFormat,omitempty"` +} + +// Filter is +type Filter struct { +} + +// FirmwareVersionCriterion is used to target devices based on their firmware +// version. +type FirmwareVersionCriterion struct { + Name *string `json:"name,omitempty"` +} + +// GeoFencingCriterion is used to target devices based on a specific region. A +// center point (defined by a latitude and longitude) and a radius form the +// boundary for the region. This criterion will be met when the user crosses +// the boundaries of the region. +type GeoFencingCriterion struct { + Lat *float64 `json:"lat,omitempty"` + Lon *float64 `json:"lon,omitempty"` + Radius *int32 `json:"radius,omitempty"` + Expiration *int32 `json:"expiration,omitempty"` +} + +// ImportTask is +type ImportTask struct { + StorageURL *string `json:"storageUrl,omitempty"` +} + +// ImportTaskListResult is gets a paged list of import tasks. +type ImportTaskListResult struct { + autorest.Response `json:"-"` + Value *[]ImportTaskResult `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ImportTaskListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ImportTaskListResult) ImportTaskListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ImportTaskResult is +type ImportTaskResult struct { + autorest.Response `json:"-"` + StorageURL *string `json:"storageUrl,omitempty"` + ID *string `json:"id,omitempty"` + State JobStates `json:"state,omitempty"` + DateCreated *date.Time `json:"dateCreated,omitempty"` + DateCompleted *date.Time `json:"dateCompleted,omitempty"` + ErrorDetails *string `json:"errorDetails,omitempty"` +} + +// IntegerTagCriterion is target devices based on an integer tag value. +type IntegerTagCriterion struct { + Name *string `json:"name,omitempty"` + Value *int32 `json:"value,omitempty"` + Op AudienceOperators `json:"op,omitempty"` +} + +// LanguageCriterion is used to target devices based on the language of their +// device. +type LanguageCriterion struct { + Name *string `json:"name,omitempty"` +} + +// LocationCriterion is used to target devices based on their last know area. +type LocationCriterion struct { + Country *string `json:"country,omitempty"` + Region *string `json:"region,omitempty"` + Locality *string `json:"locality,omitempty"` +} + +// NativePushEnabledFilter is engage only users with native push enabled. +type NativePushEnabledFilter struct { +} + +// NetworkTypeCriterion is used to target devices based their network type. +type NetworkTypeCriterion struct { + Name *string `json:"name,omitempty"` +} + +// NotificationOptions is +type NotificationOptions struct { + BigText *string `json:"bigText,omitempty"` + BigPicture *string `json:"bigPicture,omitempty"` + Sound *string `json:"sound,omitempty"` + ActionText *string `json:"actionText,omitempty"` +} + +// PollAnswerFeedbackCriterion is used to target devices who answered X to a +// given question. +type PollAnswerFeedbackCriterion struct { + ContentID *int32 `json:"content-id,omitempty"` + ChoiceID *int32 `json:"choice-id,omitempty"` +} + +// PollFeedbackCriterion is used to target devices who received a poll. +type PollFeedbackCriterion struct { + ContentID *int32 `json:"content-id,omitempty"` + Action CampaignFeedbacks `json:"action,omitempty"` +} + +// PollQuestion is +type PollQuestion struct { + Title *string `json:"title,omitempty"` + ID *int32 `json:"id,omitempty"` + Localization *map[string]*PollQuestionLocalization `json:"localization,omitempty"` + Choices *[]PollQuestionChoice `json:"choices,omitempty"` +} + +// PollQuestionChoice is +type PollQuestionChoice struct { + Title *string `json:"title,omitempty"` + ID *int32 `json:"id,omitempty"` + Localization *map[string]*PollQuestionChoiceLocalization `json:"localization,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` +} + +// PollQuestionChoiceLocalization is +type PollQuestionChoiceLocalization struct { + Title *string `json:"title,omitempty"` +} + +// PollQuestionLocalization is +type PollQuestionLocalization struct { + Title *string `json:"title,omitempty"` +} + +// PushQuotaFilter is engage only users for whom the push quota is not reached. +type PushQuotaFilter struct { +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ScreenSizeCriterion is used to target devices based on the screen resolution +// of their device. +type ScreenSizeCriterion struct { + Name *string `json:"name,omitempty"` +} + +// SegmentCriterion is target devices based on an existing segment. +type SegmentCriterion struct { + ID *int32 `json:"id,omitempty"` + Exclude *bool `json:"exclude,omitempty"` +} + +// StringTagCriterion is target devices based on a string tag value. +type StringTagCriterion struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// SupportedPlatformsListResult is +type SupportedPlatformsListResult struct { + autorest.Response `json:"-"` + Platforms *[]string `json:"platforms,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/supportedplatforms.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/supportedplatforms.go index 11ff421094..f34b1e6e6e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/supportedplatforms.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/supportedplatforms.go @@ -1,103 +1,103 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// SupportedPlatformsClient is the microsoft Azure Mobile Engagement REST APIs. -type SupportedPlatformsClient struct { - ManagementClient -} - -// NewSupportedPlatformsClient creates an instance of the -// SupportedPlatformsClient client. -func NewSupportedPlatformsClient(subscriptionID string) SupportedPlatformsClient { - return NewSupportedPlatformsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSupportedPlatformsClientWithBaseURI creates an instance of the -// SupportedPlatformsClient client. -func NewSupportedPlatformsClientWithBaseURI(baseURI string, subscriptionID string) SupportedPlatformsClient { - return SupportedPlatformsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists supported platforms for Engagement applications. -func (client SupportedPlatformsClient) List() (result SupportedPlatformsListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.SupportedPlatformsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mobileengagement.SupportedPlatformsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mobileengagement.SupportedPlatformsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SupportedPlatformsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MobileEngagement/supportedPlatforms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SupportedPlatformsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SupportedPlatformsClient) ListResponder(resp *http.Response) (result SupportedPlatformsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// SupportedPlatformsClient is the microsoft Azure Mobile Engagement REST APIs. +type SupportedPlatformsClient struct { + ManagementClient +} + +// NewSupportedPlatformsClient creates an instance of the +// SupportedPlatformsClient client. +func NewSupportedPlatformsClient(subscriptionID string) SupportedPlatformsClient { + return NewSupportedPlatformsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSupportedPlatformsClientWithBaseURI creates an instance of the +// SupportedPlatformsClient client. +func NewSupportedPlatformsClientWithBaseURI(baseURI string, subscriptionID string) SupportedPlatformsClient { + return SupportedPlatformsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists supported platforms for Engagement applications. +func (client SupportedPlatformsClient) List() (result SupportedPlatformsListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.SupportedPlatformsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "mobileengagement.SupportedPlatformsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "mobileengagement.SupportedPlatformsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SupportedPlatformsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MobileEngagement/supportedPlatforms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SupportedPlatformsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SupportedPlatformsClient) ListResponder(resp *http.Response) (result SupportedPlatformsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/version.go index 66758efa93..af6758f7e4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/mobileengagement/version.go @@ -1,29 +1,29 @@ -package mobileengagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-mobileengagement/2014-12-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package mobileengagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-mobileengagement/2014-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/activitylogalerts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/activitylogalerts.go index 86998552ee..10e802176b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/activitylogalerts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/activitylogalerts.go @@ -1,452 +1,452 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ActivityLogAlertsClient is the composite Swagger for Monitor Management -// Client -type ActivityLogAlertsClient struct { - ManagementClient -} - -// NewActivityLogAlertsClient creates an instance of the -// ActivityLogAlertsClient client. -func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { - return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewActivityLogAlertsClientWithBaseURI creates an instance of the -// ActivityLogAlertsClient client. -func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { - return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new activity log alert or update an existing one. -// -// resourceGroupName is the name of the resource group. activityLogAlertName is -// the name of the activity log alert. activityLogAlert is the activity log -// alert to create or use for the update. -func (client ActivityLogAlertsClient) CreateOrUpdate(resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: activityLogAlert, - Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, activityLogAlertName, activityLogAlert) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlert), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an activity log alert. -// -// resourceGroupName is the name of the resource group. activityLogAlertName is -// the name of the activity log alert. -func (client ActivityLogAlertsClient) Delete(resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ActivityLogAlertsClient) DeletePreparer(resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an activity log alert. -// -// resourceGroupName is the name of the resource group. activityLogAlertName is -// the name of the activity log alert. -func (client ActivityLogAlertsClient) Get(resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { - req, err := client.GetPreparer(resourceGroupName, activityLogAlertName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ActivityLogAlertsClient) GetPreparer(resourceGroupName string, activityLogAlertName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get a list of all activity log alerts in a resource -// group. -// -// resourceGroupName is the name of the resource group. -func (client ActivityLogAlertsClient) ListByResourceGroup(resourceGroupName string) (result ActivityLogAlertList, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID get a list of all activity log alerts in a -// subscription. -func (client ActivityLogAlertsClient) ListBySubscriptionID() (result ActivityLogAlertList, err error) { - req, err := client.ListBySubscriptionIDPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing ActivityLogAlertResource's tags. To update other -// fields use the CreateOrUpdate method. -// -// resourceGroupName is the name of the resource group. activityLogAlertName is -// the name of the activity log alert. activityLogAlertPatch is parameters -// supplied to the operation. -func (client ActivityLogAlertsClient) Update(resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertResourcePatch) (result ActivityLogAlertResource, err error) { - req, err := client.UpdatePreparer(resourceGroupName, activityLogAlertName, activityLogAlertPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ActivityLogAlertsClient) UpdatePreparer(resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertResourcePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "activityLogAlertName": autorest.Encode("path", activityLogAlertName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), - autorest.WithJSON(activityLogAlertPatch), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ActivityLogAlertsClient is the composite Swagger for Monitor Management +// Client +type ActivityLogAlertsClient struct { + ManagementClient +} + +// NewActivityLogAlertsClient creates an instance of the +// ActivityLogAlertsClient client. +func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { + return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActivityLogAlertsClientWithBaseURI creates an instance of the +// ActivityLogAlertsClient client. +func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { + return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new activity log alert or update an existing one. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is +// the name of the activity log alert. activityLogAlert is the activity log +// alert to create or use for the update. +func (client ActivityLogAlertsClient) CreateOrUpdate(resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: activityLogAlert, + Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, activityLogAlertName, activityLogAlert) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlert), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an activity log alert. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is +// the name of the activity log alert. +func (client ActivityLogAlertsClient) Delete(resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, activityLogAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ActivityLogAlertsClient) DeletePreparer(resourceGroupName string, activityLogAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an activity log alert. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is +// the name of the activity log alert. +func (client ActivityLogAlertsClient) Get(resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { + req, err := client.GetPreparer(resourceGroupName, activityLogAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActivityLogAlertsClient) GetPreparer(resourceGroupName string, activityLogAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get a list of all activity log alerts in a resource +// group. +// +// resourceGroupName is the name of the resource group. +func (client ActivityLogAlertsClient) ListByResourceGroup(resourceGroupName string) (result ActivityLogAlertList, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionID get a list of all activity log alerts in a +// subscription. +func (client ActivityLogAlertsClient) ListBySubscriptionID() (result ActivityLogAlertList, err error) { + req, err := client.ListBySubscriptionIDPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing ActivityLogAlertResource's tags. To update other +// fields use the CreateOrUpdate method. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is +// the name of the activity log alert. activityLogAlertPatch is parameters +// supplied to the operation. +func (client ActivityLogAlertsClient) Update(resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertResourcePatch) (result ActivityLogAlertResource, err error) { + req, err := client.UpdatePreparer(resourceGroupName, activityLogAlertName, activityLogAlertPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ActivityLogAlertsClient) UpdatePreparer(resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlertPatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertruleincidents.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertruleincidents.go index 69a728daba..5874e190f3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertruleincidents.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertruleincidents.go @@ -1,176 +1,176 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// AlertRuleIncidentsClient is the composite Swagger for Monitor Management -// Client -type AlertRuleIncidentsClient struct { - ManagementClient -} - -// NewAlertRuleIncidentsClient creates an instance of the -// AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { - return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the -// AlertRuleIncidentsClient client. -func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { - return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets an incident associated to an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. incidentName is the name of the incident to retrieve. -func (client AlertRuleIncidentsClient) Get(resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { - req, err := client.GetPreparer(resourceGroupName, ruleName, incidentName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRuleIncidentsClient) GetPreparer(resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "incidentName": autorest.Encode("path", incidentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRuleIncidentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAlertRule gets a list of incidents associated to an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. -func (client AlertRuleIncidentsClient) ListByAlertRule(resourceGroupName string, ruleName string) (result IncidentListResult, err error) { - req, err := client.ListByAlertRulePreparer(resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAlertRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") - return - } - - result, err = client.ListByAlertRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") - } - - return -} - -// ListByAlertRulePreparer prepares the ListByAlertRule request. -func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always -// closes the http.Response Body. -func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AlertRuleIncidentsClient is the composite Swagger for Monitor Management +// Client +type AlertRuleIncidentsClient struct { + ManagementClient +} + +// NewAlertRuleIncidentsClient creates an instance of the +// AlertRuleIncidentsClient client. +func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { + return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the +// AlertRuleIncidentsClient client. +func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { + return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an incident associated to an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. incidentName is the name of the incident to retrieve. +func (client AlertRuleIncidentsClient) Get(resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { + req, err := client.GetPreparer(resourceGroupName, ruleName, incidentName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRuleIncidentsClient) GetPreparer(resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentName": autorest.Encode("path", incidentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleIncidentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAlertRule gets a list of incidents associated to an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. +func (client AlertRuleIncidentsClient) ListByAlertRule(resourceGroupName string, ruleName string) (result IncidentListResult, err error) { + req, err := client.ListByAlertRulePreparer(resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAlertRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") + return + } + + result, err = client.ListByAlertRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") + } + + return +} + +// ListByAlertRulePreparer prepares the ListByAlertRule request. +func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always +// closes the http.Response Body. +func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertrules.go index cb590ddb9d..77771b8806 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/alertrules.go @@ -1,315 +1,315 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AlertRulesClient is the composite Swagger for Monitor Management Client -type AlertRulesClient struct { - ManagementClient -} - -// NewAlertRulesClient creates an instance of the AlertRulesClient client. -func NewAlertRulesClient(subscriptionID string) AlertRulesClient { - return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient -// client. -func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { - return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an alert rule. -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. parameters is the parameters of the rule to create or update. -func (client AlertRulesClient) CreateOrUpdate(resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AlertRule.Condition", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "monitor.AlertRulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. -func (client AlertRulesClient) Delete(resourceGroupName string, ruleName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AlertRulesClient) DeletePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an alert rule -// -// resourceGroupName is the name of the resource group. ruleName is the name of -// the rule. -func (client AlertRulesClient) Get(resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { - req, err := client.GetPreparer(resourceGroupName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertRulesClient) GetPreparer(resourceGroupName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list the alert rules within a resource group. -// -// resourceGroupName is the name of the resource group. -func (client AlertRulesClient) ListByResourceGroup(resourceGroupName string) (result AlertRuleResourceCollection, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertRulesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AlertRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AlertRulesClient is the composite Swagger for Monitor Management Client +type AlertRulesClient struct { + ManagementClient +} + +// NewAlertRulesClient creates an instance of the AlertRulesClient client. +func NewAlertRulesClient(subscriptionID string) AlertRulesClient { + return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient +// client. +func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { + return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an alert rule. +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. parameters is the parameters of the rule to create or update. +func (client AlertRulesClient) CreateOrUpdate(resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertRule.Condition", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "monitor.AlertRulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AlertRulesClient) CreateOrUpdatePreparer(resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. +func (client AlertRulesClient) Delete(resourceGroupName string, ruleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AlertRulesClient) DeletePreparer(resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of +// the rule. +func (client AlertRulesClient) Get(resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { + req, err := client.GetPreparer(resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRulesClient) GetPreparer(resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list the alert rules within a resource group. +// +// resourceGroupName is the name of the resource group. +func (client AlertRulesClient) ListByResourceGroup(resourceGroupName string) (result AlertRuleResourceCollection, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AlertRulesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/autoscalesettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/autoscalesettings.go index 218e92ff17..1dd7077122 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/autoscalesettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/autoscalesettings.go @@ -1,341 +1,341 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AutoscaleSettingsClient is the composite Swagger for Monitor Management -// Client -type AutoscaleSettingsClient struct { - ManagementClient -} - -// NewAutoscaleSettingsClient creates an instance of the -// AutoscaleSettingsClient client. -func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { - return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAutoscaleSettingsClientWithBaseURI creates an instance of the -// AutoscaleSettingsClient client. -func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { - return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an autoscale setting. -// -// resourceGroupName is the name of the resource group. autoscaleSettingName is -// the autoscale setting name. parameters is parameters supplied to the -// operation. -func (client AutoscaleSettingsClient) CreateOrUpdate(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, autoscaleSettingName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes and autoscale setting -// -// resourceGroupName is the name of the resource group. autoscaleSettingName is -// the autoscale setting name. -func (client AutoscaleSettingsClient) Delete(resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AutoscaleSettingsClient) DeletePreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an autoscale setting -// -// resourceGroupName is the name of the resource group. autoscaleSettingName is -// the autoscale setting name. -func (client AutoscaleSettingsClient) Get(resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { - req, err := client.GetPreparer(resourceGroupName, autoscaleSettingName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AutoscaleSettingsClient) GetPreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists the autoscale settings for a resource group -// -// resourceGroupName is the name of the resource group. -func (client AutoscaleSettingsClient) ListByResourceGroup(resourceGroupName string) (result AutoscaleSettingResourceCollection, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AutoscaleSettingsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AutoscaleSettingsClient) ListByResourceGroupNextResults(lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { - req, err := lastResults.AutoscaleSettingResourceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AutoscaleSettingsClient is the composite Swagger for Monitor Management +// Client +type AutoscaleSettingsClient struct { + ManagementClient +} + +// NewAutoscaleSettingsClient creates an instance of the +// AutoscaleSettingsClient client. +func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { + return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAutoscaleSettingsClientWithBaseURI creates an instance of the +// AutoscaleSettingsClient client. +func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { + return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an autoscale setting. +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is +// the autoscale setting name. parameters is parameters supplied to the +// operation. +func (client AutoscaleSettingsClient) CreateOrUpdate(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, autoscaleSettingName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes and autoscale setting +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is +// the autoscale setting name. +func (client AutoscaleSettingsClient) Delete(resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutoscaleSettingsClient) DeletePreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an autoscale setting +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is +// the autoscale setting name. +func (client AutoscaleSettingsClient) Get(resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { + req, err := client.GetPreparer(resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutoscaleSettingsClient) GetPreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists the autoscale settings for a resource group +// +// resourceGroupName is the name of the resource group. +func (client AutoscaleSettingsClient) ListByResourceGroup(resourceGroupName string) (result AutoscaleSettingResourceCollection, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AutoscaleSettingsClient) ListByResourceGroupNextResults(lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { + req, err := lastResults.AutoscaleSettingResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/client.go index 395ee486c1..dc06b09f3c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/client.go @@ -1,52 +1,52 @@ -// Package monitor implements the Azure ARM Monitor service API version . -// -// Composite Swagger for Monitor Management Client -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Monitor - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Monitor. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package monitor implements the Azure ARM Monitor service API version . +// +// Composite Swagger for Monitor Management Client +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Monitor + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Monitor. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/logprofiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/logprofiles.go index 20be368818..0ed8686f10 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/logprofiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/logprofiles.go @@ -1,311 +1,311 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LogProfilesClient is the composite Swagger for Monitor Management Client -type LogProfilesClient struct { - ManagementClient -} - -// NewLogProfilesClient creates an instance of the LogProfilesClient client. -func NewLogProfilesClient(subscriptionID string) LogProfilesClient { - return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient -// client. -func NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { - return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. -// -// logProfileName is the name of the log profile. parameters is parameters -// supplied to the operation. -func (client LogProfilesClient) CreateOrUpdate(logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "monitor.LogProfilesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(logProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LogProfilesClient) CreateOrUpdatePreparer(logProfileName string, parameters LogProfileResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the log profile. -// -// logProfileName is the name of the log profile. -func (client LogProfilesClient) Delete(logProfileName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LogProfilesClient) DeletePreparer(logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the log profile. -// -// logProfileName is the name of the log profile. -func (client LogProfilesClient) Get(logProfileName string) (result LogProfileResource, err error) { - req, err := client.GetPreparer(logProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LogProfilesClient) GetPreparer(logProfileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "logProfileName": autorest.Encode("path", logProfileName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list the log profiles. -func (client LogProfilesClient) List() (result LogProfileCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client LogProfilesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LogProfilesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LogProfilesClient is the composite Swagger for Monitor Management Client +type LogProfilesClient struct { + ManagementClient +} + +// NewLogProfilesClient creates an instance of the LogProfilesClient client. +func NewLogProfilesClient(subscriptionID string) LogProfilesClient { + return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient +// client. +func NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { + return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. +// +// logProfileName is the name of the log profile. parameters is parameters +// supplied to the operation. +func (client LogProfilesClient) CreateOrUpdate(logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "monitor.LogProfilesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(logProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LogProfilesClient) CreateOrUpdatePreparer(logProfileName string, parameters LogProfileResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the log profile. +// +// logProfileName is the name of the log profile. +func (client LogProfilesClient) Delete(logProfileName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LogProfilesClient) DeletePreparer(logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the log profile. +// +// logProfileName is the name of the log profile. +func (client LogProfilesClient) Get(logProfileName string) (result LogProfileResource, err error) { + req, err := client.GetPreparer(logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LogProfilesClient) GetPreparer(logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the log profiles. +func (client LogProfilesClient) List() (result LogProfileCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client LogProfilesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/models.go index 756c539c14..d10b4457a1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/models.go @@ -1,586 +1,586 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ComparisonOperationType enumerates the values for comparison operation type. -type ComparisonOperationType string - -const ( - // Equals specifies the equals state for comparison operation type. - Equals ComparisonOperationType = "Equals" - // GreaterThan specifies the greater than state for comparison operation - // type. - GreaterThan ComparisonOperationType = "GreaterThan" - // GreaterThanOrEqual specifies the greater than or equal state for - // comparison operation type. - GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - // LessThan specifies the less than state for comparison operation type. - LessThan ComparisonOperationType = "LessThan" - // LessThanOrEqual specifies the less than or equal state for comparison - // operation type. - LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - // NotEquals specifies the not equals state for comparison operation type. - NotEquals ComparisonOperationType = "NotEquals" -) - -// ConditionOperator enumerates the values for condition operator. -type ConditionOperator string - -const ( - // ConditionOperatorGreaterThan specifies the condition operator greater - // than state for condition operator. - ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" - // ConditionOperatorGreaterThanOrEqual specifies the condition operator - // greater than or equal state for condition operator. - ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" - // ConditionOperatorLessThan specifies the condition operator less than - // state for condition operator. - ConditionOperatorLessThan ConditionOperator = "LessThan" - // ConditionOperatorLessThanOrEqual specifies the condition operator less - // than or equal state for condition operator. - ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" -) - -// MetricStatisticType enumerates the values for metric statistic type. -type MetricStatisticType string - -const ( - // Average specifies the average state for metric statistic type. - Average MetricStatisticType = "Average" - // Max specifies the max state for metric statistic type. - Max MetricStatisticType = "Max" - // Min specifies the min state for metric statistic type. - Min MetricStatisticType = "Min" - // Sum specifies the sum state for metric statistic type. - Sum MetricStatisticType = "Sum" -) - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // Day specifies the day state for recurrence frequency. - Day RecurrenceFrequency = "Day" - // Hour specifies the hour state for recurrence frequency. - Hour RecurrenceFrequency = "Hour" - // Minute specifies the minute state for recurrence frequency. - Minute RecurrenceFrequency = "Minute" - // Month specifies the month state for recurrence frequency. - Month RecurrenceFrequency = "Month" - // None specifies the none state for recurrence frequency. - None RecurrenceFrequency = "None" - // Second specifies the second state for recurrence frequency. - Second RecurrenceFrequency = "Second" - // Week specifies the week state for recurrence frequency. - Week RecurrenceFrequency = "Week" - // Year specifies the year state for recurrence frequency. - Year RecurrenceFrequency = "Year" -) - -// ScaleDirection enumerates the values for scale direction. -type ScaleDirection string - -const ( - // ScaleDirectionDecrease specifies the scale direction decrease state for - // scale direction. - ScaleDirectionDecrease ScaleDirection = "Decrease" - // ScaleDirectionIncrease specifies the scale direction increase state for - // scale direction. - ScaleDirectionIncrease ScaleDirection = "Increase" - // ScaleDirectionNone specifies the scale direction none state for scale - // direction. - ScaleDirectionNone ScaleDirection = "None" -) - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ChangeCount specifies the change count state for scale type. - ChangeCount ScaleType = "ChangeCount" - // ExactCount specifies the exact count state for scale type. - ExactCount ScaleType = "ExactCount" - // PercentChangeCount specifies the percent change count state for scale - // type. - PercentChangeCount ScaleType = "PercentChangeCount" -) - -// TimeAggregationOperator enumerates the values for time aggregation operator. -type TimeAggregationOperator string - -const ( - // TimeAggregationOperatorAverage specifies the time aggregation operator - // average state for time aggregation operator. - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - // TimeAggregationOperatorLast specifies the time aggregation operator last - // state for time aggregation operator. - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - // TimeAggregationOperatorMaximum specifies the time aggregation operator - // maximum state for time aggregation operator. - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - // TimeAggregationOperatorMinimum specifies the time aggregation operator - // minimum state for time aggregation operator. - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - // TimeAggregationOperatorTotal specifies the time aggregation operator - // total state for time aggregation operator. - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// TimeAggregationType enumerates the values for time aggregation type. -type TimeAggregationType string - -const ( - // TimeAggregationTypeAverage specifies the time aggregation type average - // state for time aggregation type. - TimeAggregationTypeAverage TimeAggregationType = "Average" - // TimeAggregationTypeCount specifies the time aggregation type count state - // for time aggregation type. - TimeAggregationTypeCount TimeAggregationType = "Count" - // TimeAggregationTypeMaximum specifies the time aggregation type maximum - // state for time aggregation type. - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - // TimeAggregationTypeMinimum specifies the time aggregation type minimum - // state for time aggregation type. - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - // TimeAggregationTypeTotal specifies the time aggregation type total state - // for time aggregation type. - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// ActivityLogAlert is an Azure activity log alert. -type ActivityLogAlert struct { - Scopes *[]string `json:"scopes,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` - Actions *ActivityLogAlertActionList `json:"actions,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ActivityLogAlertActionGroup is a pointer to an Azure Action Group. -type ActivityLogAlertActionGroup struct { - ActionGroupID *string `json:"actionGroupId,omitempty"` - WebhookProperties *map[string]*string `json:"webhookProperties,omitempty"` -} - -// ActivityLogAlertActionList is a list of activity log alert actions. -type ActivityLogAlertActionList struct { - ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` -} - -// ActivityLogAlertAllOfCondition is an Activity Log alert condition that is -// met when all its member conditions are met. -type ActivityLogAlertAllOfCondition struct { - AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` -} - -// ActivityLogAlertLeafCondition is an Activity Log alert condition that is met -// by comparing an activity log field and value. -type ActivityLogAlertLeafCondition struct { - Field *string `json:"field,omitempty"` - Equals *string `json:"equals,omitempty"` -} - -// ActivityLogAlertList is a list of activity log alerts. -type ActivityLogAlertList struct { - autorest.Response `json:"-"` - Value *[]ActivityLogAlertResource `json:"value,omitempty"` -} - -// ActivityLogAlertPatch is an Azure activity log alert for patch operations. -type ActivityLogAlertPatch struct { - Enabled *bool `json:"enabled,omitempty"` -} - -// ActivityLogAlertResource is an activity log alert resource. -type ActivityLogAlertResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ActivityLogAlert `json:"properties,omitempty"` -} - -// ActivityLogAlertResourcePatch is an activity log alert resource for patch -// operations. -type ActivityLogAlertResourcePatch struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ActivityLogAlertPatch `json:"properties,omitempty"` -} - -// AlertRule is an alert rule. -type AlertRule struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - IsEnabled *bool `json:"isEnabled,omitempty"` - Condition *RuleCondition `json:"condition,omitempty"` - Actions *[]RuleAction `json:"actions,omitempty"` - LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` -} - -// AlertRuleResource is the alert rule resource. -type AlertRuleResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AlertRule `json:"properties,omitempty"` -} - -// AlertRuleResourceCollection is represents a collection of alert rule -// resources. -type AlertRuleResourceCollection struct { - autorest.Response `json:"-"` - Value *[]AlertRuleResource `json:"value,omitempty"` -} - -// AutoscaleNotification is autoscale notification. -type AutoscaleNotification struct { - Operation *string `json:"operation,omitempty"` - Email *EmailNotification `json:"email,omitempty"` - Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` -} - -// AutoscaleProfile is autoscale profile. -type AutoscaleProfile struct { - Name *string `json:"name,omitempty"` - Capacity *ScaleCapacity `json:"capacity,omitempty"` - Rules *[]ScaleRule `json:"rules,omitempty"` - FixedDate *TimeWindow `json:"fixedDate,omitempty"` - Recurrence *Recurrence `json:"recurrence,omitempty"` -} - -// AutoscaleSetting is a setting that contains all of the configuration for the -// automatic scaling of a resource. -type AutoscaleSetting struct { - Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` - Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Name *string `json:"name,omitempty"` - TargetResourceURI *string `json:"targetResourceUri,omitempty"` -} - -// AutoscaleSettingResource is the autoscale setting resource. -type AutoscaleSettingResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AutoscaleSetting `json:"properties,omitempty"` -} - -// AutoscaleSettingResourceCollection is represents a collection of autoscale -// setting resources. -type AutoscaleSettingResourceCollection struct { - autorest.Response `json:"-"` - Value *[]AutoscaleSettingResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AutoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AutoscaleSettingResourceCollection) AutoscaleSettingResourceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// EmailNotification is email notification of an autoscale event. -type EmailNotification struct { - SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` - SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// ErrorResponse is describes the format of Error response. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// Incident is an alert incident indicates the activation status of an alert -// rule. -type Incident struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - RuleName *string `json:"ruleName,omitempty"` - IsActive *bool `json:"isActive,omitempty"` - ActivatedTime *date.Time `json:"activatedTime,omitempty"` - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` -} - -// IncidentListResult is the List incidents operation response. -type IncidentListResult struct { - autorest.Response `json:"-"` - Value *[]Incident `json:"value,omitempty"` -} - -// LocationThresholdRuleCondition is a rule condition based on a certain number -// of locations failing. -type LocationThresholdRuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` - FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` -} - -// LogProfileCollection is represents a collection of log profiles. -type LogProfileCollection struct { - autorest.Response `json:"-"` - Value *[]LogProfileResource `json:"value,omitempty"` -} - -// LogProfileProperties is the log profile properties. -type LogProfileProperties struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - Locations *[]string `json:"locations,omitempty"` - Categories *[]string `json:"categories,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// LogProfileResource is the log profile resource. -type LogProfileResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LogProfileProperties `json:"properties,omitempty"` -} - -// LogSettings is part of MultiTenantDiagnosticSettings. Specifies the settings -// for a particular log. -type LogSettings struct { - Category *string `json:"category,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// ManagementEventAggregationCondition is how the data that is collected should -// be combined over time. -type ManagementEventAggregationCondition struct { - Operator ConditionOperator `json:"operator,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` -} - -// ManagementEventRuleCondition is a management event rule condition. -type ManagementEventRuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` -} - -// MetricSettings is part of MultiTenantDiagnosticSettings. Specifies the -// settings for a particular metric. -type MetricSettings struct { - TimeGrain *string `json:"timeGrain,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MetricTrigger is the trigger that results in a scaling action. -type MetricTrigger struct { - MetricName *string `json:"metricName,omitempty"` - MetricResourceURI *string `json:"metricResourceUri,omitempty"` - TimeGrain *string `json:"timeGrain,omitempty"` - Statistic MetricStatisticType `json:"statistic,omitempty"` - TimeWindow *string `json:"timeWindow,omitempty"` - TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` - Operator ComparisonOperationType `json:"operator,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` -} - -// Recurrence is the repeating times at which this profile begins. This element -// is not used if the FixedDate element is used. -type Recurrence struct { - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - Schedule *RecurrentSchedule `json:"schedule,omitempty"` -} - -// RecurrentSchedule is the scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - TimeZone *string `json:"timeZone,omitempty"` - Days *[]string `json:"days,omitempty"` - Hours *[]int32 `json:"hours,omitempty"` - Minutes *[]int32 `json:"minutes,omitempty"` -} - -// Resource is an azure resource object -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RetentionPolicy is specifies the retention policy for the log. -type RetentionPolicy struct { - Enabled *bool `json:"enabled,omitempty"` - Days *int32 `json:"days,omitempty"` -} - -// RuleAction is the action that is performed when the alert rule becomes -// active, and when an alert condition is resolved. -type RuleAction struct { -} - -// RuleCondition is the condition that results in the alert rule being -// activated. -type RuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` -} - -// RuleDataSource is the resource from which the rule collects its data. -type RuleDataSource struct { - ResourceURI *string `json:"resourceUri,omitempty"` -} - -// RuleEmailAction is specifies the action to send email when the rule -// condition is evaluated. The discriminator is always RuleEmailAction in this -// case. -type RuleEmailAction struct { - SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` - CustomEmails *[]string `json:"customEmails,omitempty"` -} - -// RuleManagementEventClaimsDataSource is the claims for a rule management -// event data source. -type RuleManagementEventClaimsDataSource struct { - EmailAddress *string `json:"emailAddress,omitempty"` -} - -// RuleManagementEventDataSource is a rule management event data source. The -// discriminator fields is always RuleManagementEventDataSource in this case. -type RuleManagementEventDataSource struct { - ResourceURI *string `json:"resourceUri,omitempty"` - EventName *string `json:"eventName,omitempty"` - EventSource *string `json:"eventSource,omitempty"` - Level *string `json:"level,omitempty"` - OperationName *string `json:"operationName,omitempty"` - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - ResourceProviderName *string `json:"resourceProviderName,omitempty"` - Status *string `json:"status,omitempty"` - SubStatus *string `json:"subStatus,omitempty"` - Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` -} - -// RuleMetricDataSource is a rule metric data source. The discriminator value -// is always RuleMetricDataSource in this case. -type RuleMetricDataSource struct { - ResourceURI *string `json:"resourceUri,omitempty"` - MetricName *string `json:"metricName,omitempty"` -} - -// RuleWebhookAction is specifies the action to post to service when the rule -// condition is evaluated. The discriminator is always RuleWebhookAction in -// this case. -type RuleWebhookAction struct { - ServiceURI *string `json:"serviceUri,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} - -// ScaleAction is the parameters for the scaling action. -type ScaleAction struct { - Direction ScaleDirection `json:"direction,omitempty"` - Type ScaleType `json:"type,omitempty"` - Value *string `json:"value,omitempty"` - Cooldown *string `json:"cooldown,omitempty"` -} - -// ScaleCapacity is the number of instances that can be used during this -// profile. -type ScaleCapacity struct { - Minimum *string `json:"minimum,omitempty"` - Maximum *string `json:"maximum,omitempty"` - Default *string `json:"default,omitempty"` -} - -// ScaleRule is a rule that provide the triggers and parameters for the scaling -// action. -type ScaleRule struct { - MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` - ScaleAction *ScaleAction `json:"scaleAction,omitempty"` -} - -// ServiceDiagnosticSettings is the diagnostic settings for service. -type ServiceDiagnosticSettings struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` - ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` - EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` - Metrics *[]MetricSettings `json:"metrics,omitempty"` - Logs *[]LogSettings `json:"logs,omitempty"` - WorkspaceID *string `json:"workspaceId,omitempty"` -} - -// ServiceDiagnosticSettingsResource is description of a service diagnostic -// setting -type ServiceDiagnosticSettingsResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServiceDiagnosticSettings `json:"properties,omitempty"` -} - -// ThresholdRuleCondition is a rule condition based on a metric crossing a -// threshold. -type ThresholdRuleCondition struct { - DataSource *RuleDataSource `json:"dataSource,omitempty"` - Operator ConditionOperator `json:"operator,omitempty"` - Threshold *float64 `json:"threshold,omitempty"` - WindowSize *string `json:"windowSize,omitempty"` - TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` -} - -// TimeWindow is a specific date-time for the profile. -type TimeWindow struct { - TimeZone *string `json:"timeZone,omitempty"` - Start *date.Time `json:"start,omitempty"` - End *date.Time `json:"end,omitempty"` -} - -// WebhookNotification is webhook notification of an autoscale event. -type WebhookNotification struct { - ServiceURI *string `json:"serviceUri,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ComparisonOperationType enumerates the values for comparison operation type. +type ComparisonOperationType string + +const ( + // Equals specifies the equals state for comparison operation type. + Equals ComparisonOperationType = "Equals" + // GreaterThan specifies the greater than state for comparison operation + // type. + GreaterThan ComparisonOperationType = "GreaterThan" + // GreaterThanOrEqual specifies the greater than or equal state for + // comparison operation type. + GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" + // LessThan specifies the less than state for comparison operation type. + LessThan ComparisonOperationType = "LessThan" + // LessThanOrEqual specifies the less than or equal state for comparison + // operation type. + LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" + // NotEquals specifies the not equals state for comparison operation type. + NotEquals ComparisonOperationType = "NotEquals" +) + +// ConditionOperator enumerates the values for condition operator. +type ConditionOperator string + +const ( + // ConditionOperatorGreaterThan specifies the condition operator greater + // than state for condition operator. + ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" + // ConditionOperatorGreaterThanOrEqual specifies the condition operator + // greater than or equal state for condition operator. + ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" + // ConditionOperatorLessThan specifies the condition operator less than + // state for condition operator. + ConditionOperatorLessThan ConditionOperator = "LessThan" + // ConditionOperatorLessThanOrEqual specifies the condition operator less + // than or equal state for condition operator. + ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" +) + +// MetricStatisticType enumerates the values for metric statistic type. +type MetricStatisticType string + +const ( + // Average specifies the average state for metric statistic type. + Average MetricStatisticType = "Average" + // Max specifies the max state for metric statistic type. + Max MetricStatisticType = "Max" + // Min specifies the min state for metric statistic type. + Min MetricStatisticType = "Min" + // Sum specifies the sum state for metric statistic type. + Sum MetricStatisticType = "Sum" +) + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // Day specifies the day state for recurrence frequency. + Day RecurrenceFrequency = "Day" + // Hour specifies the hour state for recurrence frequency. + Hour RecurrenceFrequency = "Hour" + // Minute specifies the minute state for recurrence frequency. + Minute RecurrenceFrequency = "Minute" + // Month specifies the month state for recurrence frequency. + Month RecurrenceFrequency = "Month" + // None specifies the none state for recurrence frequency. + None RecurrenceFrequency = "None" + // Second specifies the second state for recurrence frequency. + Second RecurrenceFrequency = "Second" + // Week specifies the week state for recurrence frequency. + Week RecurrenceFrequency = "Week" + // Year specifies the year state for recurrence frequency. + Year RecurrenceFrequency = "Year" +) + +// ScaleDirection enumerates the values for scale direction. +type ScaleDirection string + +const ( + // ScaleDirectionDecrease specifies the scale direction decrease state for + // scale direction. + ScaleDirectionDecrease ScaleDirection = "Decrease" + // ScaleDirectionIncrease specifies the scale direction increase state for + // scale direction. + ScaleDirectionIncrease ScaleDirection = "Increase" + // ScaleDirectionNone specifies the scale direction none state for scale + // direction. + ScaleDirectionNone ScaleDirection = "None" +) + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ChangeCount specifies the change count state for scale type. + ChangeCount ScaleType = "ChangeCount" + // ExactCount specifies the exact count state for scale type. + ExactCount ScaleType = "ExactCount" + // PercentChangeCount specifies the percent change count state for scale + // type. + PercentChangeCount ScaleType = "PercentChangeCount" +) + +// TimeAggregationOperator enumerates the values for time aggregation operator. +type TimeAggregationOperator string + +const ( + // TimeAggregationOperatorAverage specifies the time aggregation operator + // average state for time aggregation operator. + TimeAggregationOperatorAverage TimeAggregationOperator = "Average" + // TimeAggregationOperatorLast specifies the time aggregation operator last + // state for time aggregation operator. + TimeAggregationOperatorLast TimeAggregationOperator = "Last" + // TimeAggregationOperatorMaximum specifies the time aggregation operator + // maximum state for time aggregation operator. + TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" + // TimeAggregationOperatorMinimum specifies the time aggregation operator + // minimum state for time aggregation operator. + TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" + // TimeAggregationOperatorTotal specifies the time aggregation operator + // total state for time aggregation operator. + TimeAggregationOperatorTotal TimeAggregationOperator = "Total" +) + +// TimeAggregationType enumerates the values for time aggregation type. +type TimeAggregationType string + +const ( + // TimeAggregationTypeAverage specifies the time aggregation type average + // state for time aggregation type. + TimeAggregationTypeAverage TimeAggregationType = "Average" + // TimeAggregationTypeCount specifies the time aggregation type count state + // for time aggregation type. + TimeAggregationTypeCount TimeAggregationType = "Count" + // TimeAggregationTypeMaximum specifies the time aggregation type maximum + // state for time aggregation type. + TimeAggregationTypeMaximum TimeAggregationType = "Maximum" + // TimeAggregationTypeMinimum specifies the time aggregation type minimum + // state for time aggregation type. + TimeAggregationTypeMinimum TimeAggregationType = "Minimum" + // TimeAggregationTypeTotal specifies the time aggregation type total state + // for time aggregation type. + TimeAggregationTypeTotal TimeAggregationType = "Total" +) + +// ActivityLogAlert is an Azure activity log alert. +type ActivityLogAlert struct { + Scopes *[]string `json:"scopes,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` + Actions *ActivityLogAlertActionList `json:"actions,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ActivityLogAlertActionGroup is a pointer to an Azure Action Group. +type ActivityLogAlertActionGroup struct { + ActionGroupID *string `json:"actionGroupId,omitempty"` + WebhookProperties *map[string]*string `json:"webhookProperties,omitempty"` +} + +// ActivityLogAlertActionList is a list of activity log alert actions. +type ActivityLogAlertActionList struct { + ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` +} + +// ActivityLogAlertAllOfCondition is an Activity Log alert condition that is +// met when all its member conditions are met. +type ActivityLogAlertAllOfCondition struct { + AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` +} + +// ActivityLogAlertLeafCondition is an Activity Log alert condition that is met +// by comparing an activity log field and value. +type ActivityLogAlertLeafCondition struct { + Field *string `json:"field,omitempty"` + Equals *string `json:"equals,omitempty"` +} + +// ActivityLogAlertList is a list of activity log alerts. +type ActivityLogAlertList struct { + autorest.Response `json:"-"` + Value *[]ActivityLogAlertResource `json:"value,omitempty"` +} + +// ActivityLogAlertPatch is an Azure activity log alert for patch operations. +type ActivityLogAlertPatch struct { + Enabled *bool `json:"enabled,omitempty"` +} + +// ActivityLogAlertResource is an activity log alert resource. +type ActivityLogAlertResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ActivityLogAlert `json:"properties,omitempty"` +} + +// ActivityLogAlertResourcePatch is an activity log alert resource for patch +// operations. +type ActivityLogAlertResourcePatch struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ActivityLogAlertPatch `json:"properties,omitempty"` +} + +// AlertRule is an alert rule. +type AlertRule struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + IsEnabled *bool `json:"isEnabled,omitempty"` + Condition *RuleCondition `json:"condition,omitempty"` + Actions *[]RuleAction `json:"actions,omitempty"` + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` +} + +// AlertRuleResource is the alert rule resource. +type AlertRuleResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AlertRule `json:"properties,omitempty"` +} + +// AlertRuleResourceCollection is represents a collection of alert rule +// resources. +type AlertRuleResourceCollection struct { + autorest.Response `json:"-"` + Value *[]AlertRuleResource `json:"value,omitempty"` +} + +// AutoscaleNotification is autoscale notification. +type AutoscaleNotification struct { + Operation *string `json:"operation,omitempty"` + Email *EmailNotification `json:"email,omitempty"` + Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` +} + +// AutoscaleProfile is autoscale profile. +type AutoscaleProfile struct { + Name *string `json:"name,omitempty"` + Capacity *ScaleCapacity `json:"capacity,omitempty"` + Rules *[]ScaleRule `json:"rules,omitempty"` + FixedDate *TimeWindow `json:"fixedDate,omitempty"` + Recurrence *Recurrence `json:"recurrence,omitempty"` +} + +// AutoscaleSetting is a setting that contains all of the configuration for the +// automatic scaling of a resource. +type AutoscaleSetting struct { + Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` + Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Name *string `json:"name,omitempty"` + TargetResourceURI *string `json:"targetResourceUri,omitempty"` +} + +// AutoscaleSettingResource is the autoscale setting resource. +type AutoscaleSettingResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AutoscaleSetting `json:"properties,omitempty"` +} + +// AutoscaleSettingResourceCollection is represents a collection of autoscale +// setting resources. +type AutoscaleSettingResourceCollection struct { + autorest.Response `json:"-"` + Value *[]AutoscaleSettingResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AutoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AutoscaleSettingResourceCollection) AutoscaleSettingResourceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// EmailNotification is email notification of an autoscale event. +type EmailNotification struct { + SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` + SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// ErrorResponse is describes the format of Error response. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Incident is an alert incident indicates the activation status of an alert +// rule. +type Incident struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + RuleName *string `json:"ruleName,omitempty"` + IsActive *bool `json:"isActive,omitempty"` + ActivatedTime *date.Time `json:"activatedTime,omitempty"` + ResolvedTime *date.Time `json:"resolvedTime,omitempty"` +} + +// IncidentListResult is the List incidents operation response. +type IncidentListResult struct { + autorest.Response `json:"-"` + Value *[]Incident `json:"value,omitempty"` +} + +// LocationThresholdRuleCondition is a rule condition based on a certain number +// of locations failing. +type LocationThresholdRuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` + FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` +} + +// LogProfileCollection is represents a collection of log profiles. +type LogProfileCollection struct { + autorest.Response `json:"-"` + Value *[]LogProfileResource `json:"value,omitempty"` +} + +// LogProfileProperties is the log profile properties. +type LogProfileProperties struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Categories *[]string `json:"categories,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// LogProfileResource is the log profile resource. +type LogProfileResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LogProfileProperties `json:"properties,omitempty"` +} + +// LogSettings is part of MultiTenantDiagnosticSettings. Specifies the settings +// for a particular log. +type LogSettings struct { + Category *string `json:"category,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// ManagementEventAggregationCondition is how the data that is collected should +// be combined over time. +type ManagementEventAggregationCondition struct { + Operator ConditionOperator `json:"operator,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` +} + +// ManagementEventRuleCondition is a management event rule condition. +type ManagementEventRuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` + Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` +} + +// MetricSettings is part of MultiTenantDiagnosticSettings. Specifies the +// settings for a particular metric. +type MetricSettings struct { + TimeGrain *string `json:"timeGrain,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// MetricTrigger is the trigger that results in a scaling action. +type MetricTrigger struct { + MetricName *string `json:"metricName,omitempty"` + MetricResourceURI *string `json:"metricResourceUri,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + Statistic MetricStatisticType `json:"statistic,omitempty"` + TimeWindow *string `json:"timeWindow,omitempty"` + TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` + Operator ComparisonOperationType `json:"operator,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` +} + +// Recurrence is the repeating times at which this profile begins. This element +// is not used if the FixedDate element is used. +type Recurrence struct { + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + Schedule *RecurrentSchedule `json:"schedule,omitempty"` +} + +// RecurrentSchedule is the scheduling constraints for when the profile begins. +type RecurrentSchedule struct { + TimeZone *string `json:"timeZone,omitempty"` + Days *[]string `json:"days,omitempty"` + Hours *[]int32 `json:"hours,omitempty"` + Minutes *[]int32 `json:"minutes,omitempty"` +} + +// Resource is an azure resource object +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RetentionPolicy is specifies the retention policy for the log. +type RetentionPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + Days *int32 `json:"days,omitempty"` +} + +// RuleAction is the action that is performed when the alert rule becomes +// active, and when an alert condition is resolved. +type RuleAction struct { +} + +// RuleCondition is the condition that results in the alert rule being +// activated. +type RuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` +} + +// RuleDataSource is the resource from which the rule collects its data. +type RuleDataSource struct { + ResourceURI *string `json:"resourceUri,omitempty"` +} + +// RuleEmailAction is specifies the action to send email when the rule +// condition is evaluated. The discriminator is always RuleEmailAction in this +// case. +type RuleEmailAction struct { + SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// RuleManagementEventClaimsDataSource is the claims for a rule management +// event data source. +type RuleManagementEventClaimsDataSource struct { + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// RuleManagementEventDataSource is a rule management event data source. The +// discriminator fields is always RuleManagementEventDataSource in this case. +type RuleManagementEventDataSource struct { + ResourceURI *string `json:"resourceUri,omitempty"` + EventName *string `json:"eventName,omitempty"` + EventSource *string `json:"eventSource,omitempty"` + Level *string `json:"level,omitempty"` + OperationName *string `json:"operationName,omitempty"` + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + ResourceProviderName *string `json:"resourceProviderName,omitempty"` + Status *string `json:"status,omitempty"` + SubStatus *string `json:"subStatus,omitempty"` + Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` +} + +// RuleMetricDataSource is a rule metric data source. The discriminator value +// is always RuleMetricDataSource in this case. +type RuleMetricDataSource struct { + ResourceURI *string `json:"resourceUri,omitempty"` + MetricName *string `json:"metricName,omitempty"` +} + +// RuleWebhookAction is specifies the action to post to service when the rule +// condition is evaluated. The discriminator is always RuleWebhookAction in +// this case. +type RuleWebhookAction struct { + ServiceURI *string `json:"serviceUri,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} + +// ScaleAction is the parameters for the scaling action. +type ScaleAction struct { + Direction ScaleDirection `json:"direction,omitempty"` + Type ScaleType `json:"type,omitempty"` + Value *string `json:"value,omitempty"` + Cooldown *string `json:"cooldown,omitempty"` +} + +// ScaleCapacity is the number of instances that can be used during this +// profile. +type ScaleCapacity struct { + Minimum *string `json:"minimum,omitempty"` + Maximum *string `json:"maximum,omitempty"` + Default *string `json:"default,omitempty"` +} + +// ScaleRule is a rule that provide the triggers and parameters for the scaling +// action. +type ScaleRule struct { + MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` + ScaleAction *ScaleAction `json:"scaleAction,omitempty"` +} + +// ServiceDiagnosticSettings is the diagnostic settings for service. +type ServiceDiagnosticSettings struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + Metrics *[]MetricSettings `json:"metrics,omitempty"` + Logs *[]LogSettings `json:"logs,omitempty"` + WorkspaceID *string `json:"workspaceId,omitempty"` +} + +// ServiceDiagnosticSettingsResource is description of a service diagnostic +// setting +type ServiceDiagnosticSettingsResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ServiceDiagnosticSettings `json:"properties,omitempty"` +} + +// ThresholdRuleCondition is a rule condition based on a metric crossing a +// threshold. +type ThresholdRuleCondition struct { + DataSource *RuleDataSource `json:"dataSource,omitempty"` + Operator ConditionOperator `json:"operator,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` + WindowSize *string `json:"windowSize,omitempty"` + TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` +} + +// TimeWindow is a specific date-time for the profile. +type TimeWindow struct { + TimeZone *string `json:"timeZone,omitempty"` + Start *date.Time `json:"start,omitempty"` + End *date.Time `json:"end,omitempty"` +} + +// WebhookNotification is webhook notification of an autoscale event. +type WebhookNotification struct { + ServiceURI *string `json:"serviceUri,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/servicediagnosticsettings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/servicediagnosticsettings.go index cac58d39c9..ead661a310 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/servicediagnosticsettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/servicediagnosticsettings.go @@ -1,242 +1,242 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ServiceDiagnosticSettingsClient is the composite Swagger for Monitor -// Management Client -type ServiceDiagnosticSettingsClient struct { - ManagementClient -} - -// NewServiceDiagnosticSettingsClient creates an instance of the -// ServiceDiagnosticSettingsClient client. -func NewServiceDiagnosticSettingsClient(subscriptionID string) ServiceDiagnosticSettingsClient { - return NewServiceDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceDiagnosticSettingsClientWithBaseURI creates an instance of the -// ServiceDiagnosticSettingsClient client. -func NewServiceDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ServiceDiagnosticSettingsClient { - return ServiceDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update new diagnostic settings for the specified -// resource. **WARNING**: This method will be deprecated in future releases. -// -// resourceURI is the identifier of the resource. parameters is parameters -// supplied to the operation. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdate(resourceURI string, parameters ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) { - req, err := client.CreateOrUpdatePreparer(resourceURI, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdatePreparer(resourceURI string, parameters ServiceDiagnosticSettingsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the active diagnostic settings for the specified resource. -// **WARNING**: This method will be deprecated in future releases. -// -// resourceURI is the identifier of the resource. -func (client ServiceDiagnosticSettingsClient) Get(resourceURI string) (result ServiceDiagnosticSettingsResource, err error) { - req, err := client.GetPreparer(resourceURI) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceDiagnosticSettingsClient) GetPreparer(resourceURI string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceDiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an existing ServiceDiagnosticSettingsResource. To update -// other fields use the CreateOrUpdate method. **WARNING**: This method will be -// deprecated in future releases. -// -// resourceURI is the identifier of the resource. -// serviceDiagnosticSettingsResource is parameters supplied to the operation. -func (client ServiceDiagnosticSettingsClient) Update(resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) { - req, err := client.UpdatePreparer(resourceURI, serviceDiagnosticSettingsResource) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceDiagnosticSettingsClient) UpdatePreparer(resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": autorest.Encode("path", resourceURI), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), - autorest.WithJSON(serviceDiagnosticSettingsResource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceDiagnosticSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServiceDiagnosticSettingsClient) UpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ServiceDiagnosticSettingsClient is the composite Swagger for Monitor +// Management Client +type ServiceDiagnosticSettingsClient struct { + ManagementClient +} + +// NewServiceDiagnosticSettingsClient creates an instance of the +// ServiceDiagnosticSettingsClient client. +func NewServiceDiagnosticSettingsClient(subscriptionID string) ServiceDiagnosticSettingsClient { + return NewServiceDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceDiagnosticSettingsClientWithBaseURI creates an instance of the +// ServiceDiagnosticSettingsClient client. +func NewServiceDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ServiceDiagnosticSettingsClient { + return ServiceDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update new diagnostic settings for the specified +// resource. **WARNING**: This method will be deprecated in future releases. +// +// resourceURI is the identifier of the resource. parameters is parameters +// supplied to the operation. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdate(resourceURI string, parameters ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) { + req, err := client.CreateOrUpdatePreparer(resourceURI, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdatePreparer(resourceURI string, parameters ServiceDiagnosticSettingsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServiceDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the active diagnostic settings for the specified resource. +// **WARNING**: This method will be deprecated in future releases. +// +// resourceURI is the identifier of the resource. +func (client ServiceDiagnosticSettingsClient) Get(resourceURI string) (result ServiceDiagnosticSettingsResource, err error) { + req, err := client.GetPreparer(resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceDiagnosticSettingsClient) GetPreparer(resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceDiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServiceDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing ServiceDiagnosticSettingsResource. To update +// other fields use the CreateOrUpdate method. **WARNING**: This method will be +// deprecated in future releases. +// +// resourceURI is the identifier of the resource. +// serviceDiagnosticSettingsResource is parameters supplied to the operation. +func (client ServiceDiagnosticSettingsClient) Update(resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) { + req, err := client.UpdatePreparer(resourceURI, serviceDiagnosticSettingsResource) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServiceDiagnosticSettingsClient) UpdatePreparer(resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": autorest.Encode("path", resourceURI), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters), + autorest.WithJSON(serviceDiagnosticSettingsResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceDiagnosticSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServiceDiagnosticSettingsClient) UpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/version.go index 4b86dc6aa5..2b23857278 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/monitor/version.go @@ -1,29 +1,29 @@ -package monitor - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-monitor/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package monitor + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-monitor/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go index 028af8185e..4ab4e07349 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go @@ -1,773 +1,773 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ApplicationGatewaysClient is the composite Swagger for Network Client -type ApplicationGatewaysClient struct { - ManagementClient -} - -// NewApplicationGatewaysClient creates an instance of the -// ApplicationGatewaysClient client. -func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient { - return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationGatewaysClientWithBaseURI creates an instance of the -// ApplicationGatewaysClient client. -func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient { - return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// BackendHealth gets the backend health of the specified application gateway -// in a resource group. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. applicationGatewayName -// is the name of the application gateway. expand is expands BackendAddressPool -// and BackendHttpSettings referenced in backend health. -func (client ApplicationGatewaysClient) BackendHealth(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (<-chan ApplicationGatewayBackendHealth, <-chan error) { - resultChan := make(chan ApplicationGatewayBackendHealth, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ApplicationGatewayBackendHealth - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.BackendHealthPreparer(resourceGroupName, applicationGatewayName, expand, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request") - return - } - - resp, err := client.BackendHealthSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure sending request") - return - } - - result, err = client.BackendHealthResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// BackendHealthPreparer prepares the BackendHealth request. -func (client ApplicationGatewaysClient) BackendHealthPreparer(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGatewayName": autorest.Encode("path", applicationGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// BackendHealthSender sends the BackendHealth request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// BackendHealthResponder handles the response to the BackendHealth request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result ApplicationGatewayBackendHealth, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates the specified application gateway. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. applicationGatewayName -// is the name of the application gateway. parameters is parameters supplied to -// the create or update application gateway operation. -func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (<-chan ApplicationGateway, <-chan error) { - resultChan := make(chan ApplicationGateway, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ApplicationGateway - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGatewayName": autorest.Encode("path", applicationGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified application gateway. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. applicationGatewayName -// is the name of the application gateway. -func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGatewayName": autorest.Encode("path", applicationGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified application gateway. -// -// resourceGroupName is the name of the resource group. applicationGatewayName -// is the name of the application gateway. -func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { - req, err := client.GetPreparer(resourceGroupName, applicationGatewayName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationGatewaysClient) GetPreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGatewayName": autorest.Encode("path", applicationGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all application gateways in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { - req, err := lastResults.ApplicationGatewayListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all the application gateways in a subscription. -func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client ApplicationGatewaysClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { - req, err := lastResults.ApplicationGatewayListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListAvailableWafRuleSets lists all available web application firewall rule -// sets. -func (client ApplicationGatewaysClient) ListAvailableWafRuleSets() (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { - req, err := client.ListAvailableWafRuleSetsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request") - return - } - - resp, err := client.ListAvailableWafRuleSetsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request") - return - } - - result, err = client.ListAvailableWafRuleSetsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request") - } - - return -} - -// ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request. -func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start starts the specified application gateway. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. applicationGatewayName -// is the name of the application gateway. -func (client ApplicationGatewaysClient) Start(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StartPreparer(resourceGroupName, applicationGatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StartPreparer prepares the Start request. -func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGatewayName": autorest.Encode("path", applicationGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops the specified application gateway in a resource group. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. applicationGatewayName -// is the name of the application gateway. -func (client ApplicationGatewaysClient) Stop(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StopPreparer(resourceGroupName, applicationGatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StopPreparer prepares the Stop request. -func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGatewayName": autorest.Encode("path", applicationGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGatewaysClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ApplicationGatewaysClient is the composite Swagger for Network Client +type ApplicationGatewaysClient struct { + ManagementClient +} + +// NewApplicationGatewaysClient creates an instance of the +// ApplicationGatewaysClient client. +func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient { + return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationGatewaysClientWithBaseURI creates an instance of the +// ApplicationGatewaysClient client. +func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient { + return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// BackendHealth gets the backend health of the specified application gateway +// in a resource group. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. applicationGatewayName +// is the name of the application gateway. expand is expands BackendAddressPool +// and BackendHttpSettings referenced in backend health. +func (client ApplicationGatewaysClient) BackendHealth(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (<-chan ApplicationGatewayBackendHealth, <-chan error) { + resultChan := make(chan ApplicationGatewayBackendHealth, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ApplicationGatewayBackendHealth + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.BackendHealthPreparer(resourceGroupName, applicationGatewayName, expand, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request") + return + } + + resp, err := client.BackendHealthSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure sending request") + return + } + + result, err = client.BackendHealthResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// BackendHealthPreparer prepares the BackendHealth request. +func (client ApplicationGatewaysClient) BackendHealthPreparer(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// BackendHealthSender sends the BackendHealth request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// BackendHealthResponder handles the response to the BackendHealth request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result ApplicationGatewayBackendHealth, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates the specified application gateway. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. applicationGatewayName +// is the name of the application gateway. parameters is parameters supplied to +// the create or update application gateway operation. +func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (<-chan ApplicationGateway, <-chan error) { + resultChan := make(chan ApplicationGateway, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ApplicationGateway + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified application gateway. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. applicationGatewayName +// is the name of the application gateway. +func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified application gateway. +// +// resourceGroupName is the name of the resource group. applicationGatewayName +// is the name of the application gateway. +func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { + req, err := client.GetPreparer(resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationGatewaysClient) GetPreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all application gateways in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { + req, err := lastResults.ApplicationGatewayListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all the application gateways in a subscription. +func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ApplicationGatewaysClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { + req, err := lastResults.ApplicationGatewayListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAvailableWafRuleSets lists all available web application firewall rule +// sets. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSets() (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { + req, err := client.ListAvailableWafRuleSetsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableWafRuleSetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableWafRuleSetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request") + } + + return +} + +// ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts the specified application gateway. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. applicationGatewayName +// is the name of the application gateway. +func (client ApplicationGatewaysClient) Start(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StartPreparer(resourceGroupName, applicationGatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StartPreparer prepares the Start request. +func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops the specified application gateway in a resource group. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. applicationGatewayName +// is the name of the application gateway. +func (client ApplicationGatewaysClient) Stop(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StopPreparer(resourceGroupName, applicationGatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StopPreparer prepares the Stop request. +func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/bgpservicecommunities.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/bgpservicecommunities.go index 4e9f4c2bfa..5024f51649 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/bgpservicecommunities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/bgpservicecommunities.go @@ -1,127 +1,127 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BgpServiceCommunitiesClient is the composite Swagger for Network Client -type BgpServiceCommunitiesClient struct { - ManagementClient -} - -// NewBgpServiceCommunitiesClient creates an instance of the -// BgpServiceCommunitiesClient client. -func NewBgpServiceCommunitiesClient(subscriptionID string) BgpServiceCommunitiesClient { - return NewBgpServiceCommunitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBgpServiceCommunitiesClientWithBaseURI creates an instance of the -// BgpServiceCommunitiesClient client. -func NewBgpServiceCommunitiesClientWithBaseURI(baseURI string, subscriptionID string) BgpServiceCommunitiesClient { - return BgpServiceCommunitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets all the available bgp service communities. -func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BgpServiceCommunitiesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BgpServiceCommunitiesClient) ListResponder(resp *http.Response) (result BgpServiceCommunityListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BgpServiceCommunitiesClient) ListNextResults(lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) { - req, err := lastResults.BgpServiceCommunityListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BgpServiceCommunitiesClient is the composite Swagger for Network Client +type BgpServiceCommunitiesClient struct { + ManagementClient +} + +// NewBgpServiceCommunitiesClient creates an instance of the +// BgpServiceCommunitiesClient client. +func NewBgpServiceCommunitiesClient(subscriptionID string) BgpServiceCommunitiesClient { + return NewBgpServiceCommunitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBgpServiceCommunitiesClientWithBaseURI creates an instance of the +// BgpServiceCommunitiesClient client. +func NewBgpServiceCommunitiesClientWithBaseURI(baseURI string, subscriptionID string) BgpServiceCommunitiesClient { + return BgpServiceCommunitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all the available bgp service communities. +func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BgpServiceCommunitiesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BgpServiceCommunitiesClient) ListResponder(resp *http.Response) (result BgpServiceCommunityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BgpServiceCommunitiesClient) ListNextResults(lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) { + req, err := lastResults.BgpServiceCommunityListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go index af02970f74..ec5bf7ced5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go @@ -1,124 +1,124 @@ -// Package network implements the Azure ARM Network service API version . -// -// Composite Swagger for Network Client -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Network - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Network. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CheckDNSNameAvailability checks whether a domain name in the cloudapp.net -// zone is available for use. -// -// location is the location of the domain name. domainNameLabel is the domain -// name to be verified. It must conform to the following regular expression: -// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. -func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { - req, err := client.CheckDNSNameAvailabilityPreparer(location, domainNameLabel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckDNSNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckDNSNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. -func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string, domainNameLabel string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(domainNameLabel) > 0 { - queryParameters["domainNameLabel"] = autorest.Encode("query", domainNameLabel) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always -// closes the http.Response Body. -func (client ManagementClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +// Package network implements the Azure ARM Network service API version . +// +// Composite Swagger for Network Client +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Network + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Network. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckDNSNameAvailability checks whether a domain name in the cloudapp.net +// zone is available for use. +// +// location is the location of the domain name. domainNameLabel is the domain +// name to be verified. It must conform to the following regular expression: +// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. +func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { + req, err := client.CheckDNSNameAvailabilityPreparer(location, domainNameLabel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckDNSNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckDNSNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. +func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string, domainNameLabel string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(domainNameLabel) > 0 { + queryParameters["domainNameLabel"] = autorest.Encode("query", domainNameLabel) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always +// closes the http.Response Body. +func (client ManagementClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitauthorizations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitauthorizations.go index a8d22f8216..feb974fb97 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitauthorizations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitauthorizations.go @@ -1,372 +1,372 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ExpressRouteCircuitAuthorizationsClient is the composite Swagger for Network -// Client -type ExpressRouteCircuitAuthorizationsClient struct { - ManagementClient -} - -// NewExpressRouteCircuitAuthorizationsClient creates an instance of the -// ExpressRouteCircuitAuthorizationsClient client. -func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string) ExpressRouteCircuitAuthorizationsClient { - return NewExpressRouteCircuitAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExpressRouteCircuitAuthorizationsClientWithBaseURI creates an instance of -// the ExpressRouteCircuitAuthorizationsClient client. -func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitAuthorizationsClient { - return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an authorization in the specified express -// route circuit. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. authorizationName is the name of the -// authorization. authorizationParameters is parameters supplied to the create -// or update express route circuit authorization operation. -func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (<-chan ExpressRouteCircuitAuthorization, <-chan error) { - resultChan := make(chan ExpressRouteCircuitAuthorization, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ExpressRouteCircuitAuthorization - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationName": autorest.Encode("path", authorizationName), - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), - autorest.WithJSON(authorizationParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified authorization from the specified express route -// circuit. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. authorizationName is the name of the -// authorization. -func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, circuitName, authorizationName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationName": autorest.Encode("path", authorizationName), - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified authorization from the specified express route -// circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. authorizationName is the name of the -// authorization. -func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) { - req, err := client.GetPreparer(resourceGroupName, circuitName, authorizationName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationName": autorest.Encode("path", authorizationName), - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all authorizations in an express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the circuit. -func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, circuitName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.Response) (result AuthorizationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) { - req, err := lastResults.AuthorizationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ExpressRouteCircuitAuthorizationsClient is the composite Swagger for Network +// Client +type ExpressRouteCircuitAuthorizationsClient struct { + ManagementClient +} + +// NewExpressRouteCircuitAuthorizationsClient creates an instance of the +// ExpressRouteCircuitAuthorizationsClient client. +func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string) ExpressRouteCircuitAuthorizationsClient { + return NewExpressRouteCircuitAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitAuthorizationsClientWithBaseURI creates an instance of +// the ExpressRouteCircuitAuthorizationsClient client. +func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitAuthorizationsClient { + return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an authorization in the specified express +// route circuit. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. authorizationName is the name of the +// authorization. authorizationParameters is parameters supplied to the create +// or update express route circuit authorization operation. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (<-chan ExpressRouteCircuitAuthorization, <-chan error) { + resultChan := make(chan ExpressRouteCircuitAuthorization, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ExpressRouteCircuitAuthorization + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), + autorest.WithJSON(authorizationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified authorization from the specified express route +// circuit. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. authorizationName is the name of the +// authorization. +func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, circuitName, authorizationName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified authorization from the specified express route +// circuit. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. authorizationName is the name of the +// authorization. +func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) { + req, err := client.GetPreparer(resourceGroupName, circuitName, authorizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all authorizations in an express route circuit. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the circuit. +func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.Response) (result AuthorizationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) { + req, err := lastResults.AuthorizationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go index 8805b8cbe6..28b926f244 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go @@ -1,370 +1,370 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ExpressRouteCircuitPeeringsClient is the composite Swagger for Network -// Client -type ExpressRouteCircuitPeeringsClient struct { - ManagementClient -} - -// NewExpressRouteCircuitPeeringsClient creates an instance of the -// ExpressRouteCircuitPeeringsClient client. -func NewExpressRouteCircuitPeeringsClient(subscriptionID string) ExpressRouteCircuitPeeringsClient { - return NewExpressRouteCircuitPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExpressRouteCircuitPeeringsClientWithBaseURI creates an instance of the -// ExpressRouteCircuitPeeringsClient client. -func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitPeeringsClient { - return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a peering in the specified express route -// circuits. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -// peeringParameters is parameters supplied to the create or update express -// route circuit peering operation. -func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (<-chan ExpressRouteCircuitPeering, <-chan error) { - resultChan := make(chan ExpressRouteCircuitPeering, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ExpressRouteCircuitPeering - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), - autorest.WithJSON(peeringParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified peering from the specified express route -// circuit. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, circuitName, peeringName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified authorization from the specified express route -// circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) { - req, err := client.GetPreparer(resourceGroupName, circuitName, peeringName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all peerings in a specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. -func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, circuitName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitPeeringListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) { - req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ExpressRouteCircuitPeeringsClient is the composite Swagger for Network +// Client +type ExpressRouteCircuitPeeringsClient struct { + ManagementClient +} + +// NewExpressRouteCircuitPeeringsClient creates an instance of the +// ExpressRouteCircuitPeeringsClient client. +func NewExpressRouteCircuitPeeringsClient(subscriptionID string) ExpressRouteCircuitPeeringsClient { + return NewExpressRouteCircuitPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitPeeringsClientWithBaseURI creates an instance of the +// ExpressRouteCircuitPeeringsClient client. +func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitPeeringsClient { + return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a peering in the specified express route +// circuits. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +// peeringParameters is parameters supplied to the create or update express +// route circuit peering operation. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (<-chan ExpressRouteCircuitPeering, <-chan error) { + resultChan := make(chan ExpressRouteCircuitPeering, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ExpressRouteCircuitPeering + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), + autorest.WithJSON(peeringParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified peering from the specified express route +// circuit. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, circuitName, peeringName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified authorization from the specified express route +// circuit. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) { + req, err := client.GetPreparer(resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all peerings in a specified express route circuit. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. +func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitPeeringListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) { + req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go index 669a5ecb41..b60aa10a4e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go @@ -1,840 +1,840 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ExpressRouteCircuitsClient is the composite Swagger for Network Client -type ExpressRouteCircuitsClient struct { - ManagementClient -} - -// NewExpressRouteCircuitsClient creates an instance of the -// ExpressRouteCircuitsClient client. -func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient { - return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the -// ExpressRouteCircuitsClient client. -func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient { - return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an express route circuit. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the circuit. parameters is parameters supplied to the create or update -// express route circuit operation. -func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (<-chan ExpressRouteCircuit, <-chan error) { - resultChan := make(chan ExpressRouteCircuit, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ExpressRouteCircuit - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified express route circuit. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. -func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified express route circuit. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of express route circuit. -func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { - req, err := client.GetPreparer(resourceGroupName, circuitName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPeeringStats gets all stats from an express route circuit in a resource -// group. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { - req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request") - return - } - - resp, err := client.GetPeeringStatsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure sending request") - return - } - - result, err = client.GetPeeringStatsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure responding to request") - } - - return -} - -// GetPeeringStatsPreparer prepares the GetPeeringStats request. -func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStats gets all the stats from an express route circuit in a resource -// group. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. -func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { - req, err := client.GetStatsPreparer(resourceGroupName, circuitName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request") - return - } - - resp, err := client.GetStatsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure sending request") - return - } - - result, err = client.GetStatsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure responding to request") - } - - return -} - -// GetStatsPreparer prepares the GetStats request. -func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetStatsSender sends the GetStats request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetStatsResponder handles the response to the GetStats request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the express route circuits in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { - req, err := lastResults.ExpressRouteCircuitListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all the express route circuits in a subscription. -func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { - req, err := lastResults.ExpressRouteCircuitListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListArpTable gets the currently advertised ARP table associated with the -// express route circuit in a resource group. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -// devicePath is the path of the device. -func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsArpTableListResult, <-chan error) { - resultChan := make(chan ExpressRouteCircuitsArpTableListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ExpressRouteCircuitsArpTableListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request") - return - } - - resp, err := client.ListArpTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request") - return - } - - result, err = client.ListArpTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ListArpTablePreparer prepares the ListArpTable request. -func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "devicePath": autorest.Encode("path", devicePath), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListArpTableSender sends the ListArpTable request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListArpTableResponder handles the response to the ListArpTable request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRoutesTable gets the currently advertised routes table associated with -// the express route circuit in a resource group. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -// devicePath is the path of the device. -func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableListResult, <-chan error) { - resultChan := make(chan ExpressRouteCircuitsRoutesTableListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ExpressRouteCircuitsRoutesTableListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request") - return - } - - resp, err := client.ListRoutesTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request") - return - } - - result, err = client.ListRoutesTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ListRoutesTablePreparer prepares the ListRoutesTable request. -func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "devicePath": autorest.Encode("path", devicePath), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListRoutesTableSender sends the ListRoutesTable request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRoutesTableSummary gets the currently advertised routes table summary -// associated with the express route circuit in a resource group. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. circuitName is the name -// of the express route circuit. peeringName is the name of the peering. -// devicePath is the path of the device. -func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableSummaryListResult, <-chan error) { - resultChan := make(chan ExpressRouteCircuitsRoutesTableSummaryListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ExpressRouteCircuitsRoutesTableSummaryListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request") - return - } - - resp, err := client.ListRoutesTableSummarySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure sending request") - return - } - - result, err = client.ListRoutesTableSummaryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. -func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "circuitName": autorest.Encode("path", circuitName), - "devicePath": autorest.Encode("path", devicePath), - "peeringName": autorest.Encode("path", peeringName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always -// closes the http.Response Body. -func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ExpressRouteCircuitsClient is the composite Swagger for Network Client +type ExpressRouteCircuitsClient struct { + ManagementClient +} + +// NewExpressRouteCircuitsClient creates an instance of the +// ExpressRouteCircuitsClient client. +func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient { + return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the +// ExpressRouteCircuitsClient client. +func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient { + return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an express route circuit. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the circuit. parameters is parameters supplied to the create or update +// express route circuit operation. +func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (<-chan ExpressRouteCircuit, <-chan error) { + resultChan := make(chan ExpressRouteCircuit, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ExpressRouteCircuit + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified express route circuit. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. +func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified express route circuit. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of express route circuit. +func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { + req, err := client.GetPreparer(resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPeeringStats gets all stats from an express route circuit in a resource +// group. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { + req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request") + return + } + + resp, err := client.GetPeeringStatsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure sending request") + return + } + + result, err = client.GetPeeringStatsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure responding to request") + } + + return +} + +// GetPeeringStatsPreparer prepares the GetPeeringStats request. +func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStats gets all the stats from an express route circuit in a resource +// group. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. +func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { + req, err := client.GetStatsPreparer(resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure sending request") + return + } + + result, err = client.GetStatsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure responding to request") + } + + return +} + +// GetStatsPreparer prepares the GetStats request. +func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetStatsSender sends the GetStats request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetStatsResponder handles the response to the GetStats request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the express route circuits in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { + req, err := lastResults.ExpressRouteCircuitListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all the express route circuits in a subscription. +func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { + req, err := lastResults.ExpressRouteCircuitListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListArpTable gets the currently advertised ARP table associated with the +// express route circuit in a resource group. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +// devicePath is the path of the device. +func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsArpTableListResult, <-chan error) { + resultChan := make(chan ExpressRouteCircuitsArpTableListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ExpressRouteCircuitsArpTableListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request") + return + } + + resp, err := client.ListArpTableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request") + return + } + + result, err = client.ListArpTableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ListArpTablePreparer prepares the ListArpTable request. +func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListArpTableSender sends the ListArpTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListArpTableResponder handles the response to the ListArpTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRoutesTable gets the currently advertised routes table associated with +// the express route circuit in a resource group. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +// devicePath is the path of the device. +func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableListResult, <-chan error) { + resultChan := make(chan ExpressRouteCircuitsRoutesTableListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ExpressRouteCircuitsRoutesTableListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request") + return + } + + resp, err := client.ListRoutesTableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request") + return + } + + result, err = client.ListRoutesTableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ListRoutesTablePreparer prepares the ListRoutesTable request. +func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListRoutesTableSender sends the ListRoutesTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRoutesTableSummary gets the currently advertised routes table summary +// associated with the express route circuit in a resource group. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. circuitName is the name +// of the express route circuit. peeringName is the name of the peering. +// devicePath is the path of the device. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableSummaryListResult, <-chan error) { + resultChan := make(chan ExpressRouteCircuitsRoutesTableSummaryListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ExpressRouteCircuitsRoutesTableSummaryListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request") + return + } + + resp, err := client.ListRoutesTableSummarySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure sending request") + return + } + + result, err = client.ListRoutesTableSummaryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go index d4b1a69215..94db9a4f61 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go @@ -1,128 +1,128 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ExpressRouteServiceProvidersClient is the composite Swagger for Network -// Client -type ExpressRouteServiceProvidersClient struct { - ManagementClient -} - -// NewExpressRouteServiceProvidersClient creates an instance of the -// ExpressRouteServiceProvidersClient client. -func NewExpressRouteServiceProvidersClient(subscriptionID string) ExpressRouteServiceProvidersClient { - return NewExpressRouteServiceProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExpressRouteServiceProvidersClientWithBaseURI creates an instance of the -// ExpressRouteServiceProvidersClient client. -func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteServiceProvidersClient { - return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets all the available express route service providers. -func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Response) (result ExpressRouteServiceProviderListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) { - req, err := lastResults.ExpressRouteServiceProviderListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ExpressRouteServiceProvidersClient is the composite Swagger for Network +// Client +type ExpressRouteServiceProvidersClient struct { + ManagementClient +} + +// NewExpressRouteServiceProvidersClient creates an instance of the +// ExpressRouteServiceProvidersClient client. +func NewExpressRouteServiceProvidersClient(subscriptionID string) ExpressRouteServiceProvidersClient { + return NewExpressRouteServiceProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteServiceProvidersClientWithBaseURI creates an instance of the +// ExpressRouteServiceProvidersClient client. +func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteServiceProvidersClient { + return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all the available express route service providers. +func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Response) (result ExpressRouteServiceProviderListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) { + req, err := lastResults.ExpressRouteServiceProviderListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go index 229a0983f1..8918c08b4b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go @@ -1,871 +1,871 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// InterfacesClient is the composite Swagger for Network Client -type InterfacesClient struct { - ManagementClient -} - -// NewInterfacesClient creates an instance of the InterfacesClient client. -func NewInterfacesClient(subscriptionID string) InterfacesClient { - return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient -// client. -func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient { - return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a network interface. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is -// the name of the network interface. parameters is parameters supplied to the -// create or update network interface operation. -func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (<-chan Interface, <-chan error) { - resultChan := make(chan Interface, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Interface - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkInterfaceName": autorest.Encode("path", networkInterfaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified network interface. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is -// the name of the network interface. -func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkInterfaceName": autorest.Encode("path", networkInterfaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about the specified network interface. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is -// the name of the network interface. expand is expands referenced resources. -func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) { - req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkInterfaceName": autorest.Encode("path", networkInterfaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetEffectiveRouteTable gets all route tables applied to a network interface. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is -// the name of the network interface. -func (client InterfacesClient) GetEffectiveRouteTable(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveRouteListResult, <-chan error) { - resultChan := make(chan EffectiveRouteListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result EffectiveRouteListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetEffectiveRouteTablePreparer(resourceGroupName, networkInterfaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request") - return - } - - resp, err := client.GetEffectiveRouteTableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure sending request") - return - } - - result, err = client.GetEffectiveRouteTableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request. -func (client InterfacesClient) GetEffectiveRouteTablePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkInterfaceName": autorest.Encode("path", networkInterfaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always -// closes the http.Response Body. -func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result EffectiveRouteListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVirtualMachineScaleSetNetworkInterface get the specified network -// interface in a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. -// virtualMachineScaleSetName is the name of the virtual machine scale set. -// virtualmachineIndex is the virtual machine index. networkInterfaceName is -// the name of the network interface. expand is expands referenced resources. -func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) { - req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request") - return - } - - resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request") - return - } - - result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request") - } - - return -} - -// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request. -func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkInterfaceName": autorest.Encode("path", networkInterfaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), - "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always -// closes the http.Response Body. -func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all network interfaces in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { - req, err := lastResults.InterfaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all network interfaces in a subscription. -func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client InterfacesClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { - req, err := lastResults.InterfaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListEffectiveNetworkSecurityGroups gets all network security groups applied -// to a network interface. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkInterfaceName is -// the name of the network interface. -func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveNetworkSecurityGroupListResult, <-chan error) { - resultChan := make(chan EffectiveNetworkSecurityGroupListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result EffectiveNetworkSecurityGroupListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName, networkInterfaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request") - return - } - - resp, err := client.ListEffectiveNetworkSecurityGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure sending request") - return - } - - result, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request. -func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkInterfaceName": autorest.Encode("path", networkInterfaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always -// closes the http.Response Body. -func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result EffectiveNetworkSecurityGroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a -// virtual machine scale set. -// -// resourceGroupName is the name of the resource group. -// virtualMachineScaleSetName is the name of the virtual machine scale set. -func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, err error) { - req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request") - return - } - - result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request") - } - - return -} - -// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request. -func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always -// closes the http.Response Body. -func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any. -func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { - req, err := lastResults.InterfaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request") - } - - result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request") - } - - return -} - -// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all -// network interfaces in a virtual machine in a virtual machine scale set. -// -// resourceGroupName is the name of the resource group. -// virtualMachineScaleSetName is the name of the virtual machine scale set. -// virtualmachineIndex is the virtual machine index. -func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, err error) { - req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request") - return - } - - resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request") - return - } - - result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request") - } - - return -} - -// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request. -func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), - "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the -// http.Response Body if it receives an error. -func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always -// closes the http.Response Body. -func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any. -func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { - req, err := lastResults.InterfaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request") - } - - result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// InterfacesClient is the composite Swagger for Network Client +type InterfacesClient struct { + ManagementClient +} + +// NewInterfacesClient creates an instance of the InterfacesClient client. +func NewInterfacesClient(subscriptionID string) InterfacesClient { + return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient +// client. +func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient { + return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network interface. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. networkInterfaceName is +// the name of the network interface. parameters is parameters supplied to the +// create or update network interface operation. +func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (<-chan Interface, <-chan error) { + resultChan := make(chan Interface, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Interface + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network interface. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. networkInterfaceName is +// the name of the network interface. +func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified network interface. +// +// resourceGroupName is the name of the resource group. networkInterfaceName is +// the name of the network interface. expand is expands referenced resources. +func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) { + req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEffectiveRouteTable gets all route tables applied to a network interface. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkInterfaceName is +// the name of the network interface. +func (client InterfacesClient) GetEffectiveRouteTable(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveRouteListResult, <-chan error) { + resultChan := make(chan EffectiveRouteListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result EffectiveRouteListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetEffectiveRouteTablePreparer(resourceGroupName, networkInterfaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request") + return + } + + resp, err := client.GetEffectiveRouteTableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure sending request") + return + } + + result, err = client.GetEffectiveRouteTableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request. +func (client InterfacesClient) GetEffectiveRouteTablePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result EffectiveRouteListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVirtualMachineScaleSetNetworkInterface get the specified network +// interface in a virtual machine scale set. +// +// resourceGroupName is the name of the resource group. +// virtualMachineScaleSetName is the name of the virtual machine scale set. +// virtualmachineIndex is the virtual machine index. networkInterfaceName is +// the name of the network interface. expand is expands referenced resources. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) { + req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request") + return + } + + resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request") + return + } + + result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request") + } + + return +} + +// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network interfaces in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.InterfaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all network interfaces in a subscription. +func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client InterfacesClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.InterfaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListEffectiveNetworkSecurityGroups gets all network security groups applied +// to a network interface. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkInterfaceName is +// the name of the network interface. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveNetworkSecurityGroupListResult, <-chan error) { + resultChan := make(chan EffectiveNetworkSecurityGroupListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result EffectiveNetworkSecurityGroupListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName, networkInterfaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request") + return + } + + resp, err := client.ListEffectiveNetworkSecurityGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure sending request") + return + } + + result, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result EffectiveNetworkSecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a +// virtual machine scale set. +// +// resourceGroupName is the name of the resource group. +// virtualMachineScaleSetName is the name of the virtual machine scale set. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, err error) { + req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request") + return + } + + result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request") + } + + return +} + +// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.InterfaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request") + } + + result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request") + } + + return +} + +// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all +// network interfaces in a virtual machine in a virtual machine scale set. +// +// resourceGroupName is the name of the resource group. +// virtualMachineScaleSetName is the name of the virtual machine scale set. +// virtualmachineIndex is the virtual machine index. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, err error) { + req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request") + return + } + + result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request") + } + + return +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.InterfaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request") + } + + result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go index 9dcce3c2f4..11d649b270 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go @@ -1,450 +1,450 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// LoadBalancersClient is the composite Swagger for Network Client -type LoadBalancersClient struct { - ManagementClient -} - -// NewLoadBalancersClient creates an instance of the LoadBalancersClient -// client. -func NewLoadBalancersClient(subscriptionID string) LoadBalancersClient { - return NewLoadBalancersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLoadBalancersClientWithBaseURI creates an instance of the -// LoadBalancersClient client. -func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancersClient { - return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a load balancer. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the -// name of the load balancer. parameters is parameters supplied to the create -// or update load balancer operation. -func (client LoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (<-chan LoadBalancer, <-chan error) { - resultChan := make(chan LoadBalancer, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result LoadBalancer - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loadBalancerName": autorest.Encode("path", loadBalancerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (result LoadBalancer, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified load balancer. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the -// name of the load balancer. -func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loadBalancerName": autorest.Encode("path", loadBalancerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LoadBalancersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified load balancer. -// -// resourceGroupName is the name of the resource group. loadBalancerName is the -// name of the load balancer. expand is expands referenced resources. -func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { - req, err := client.GetPreparer(resourceGroupName, loadBalancerName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LoadBalancersClient) GetPreparer(resourceGroupName string, loadBalancerName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "loadBalancerName": autorest.Encode("path", loadBalancerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LoadBalancersClient) GetResponder(resp *http.Response) (result LoadBalancer, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the load balancers in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client LoadBalancersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LoadBalancersClient) ListResponder(resp *http.Response) (result LoadBalancerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { - req, err := lastResults.LoadBalancerListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all the load balancers in a subscription. -func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client LoadBalancersClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client LoadBalancersClient) ListAllResponder(resp *http.Response) (result LoadBalancerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { - req, err := lastResults.LoadBalancerListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// LoadBalancersClient is the composite Swagger for Network Client +type LoadBalancersClient struct { + ManagementClient +} + +// NewLoadBalancersClient creates an instance of the LoadBalancersClient +// client. +func NewLoadBalancersClient(subscriptionID string) LoadBalancersClient { + return NewLoadBalancersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancersClientWithBaseURI creates an instance of the +// LoadBalancersClient client. +func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancersClient { + return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a load balancer. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. loadBalancerName is the +// name of the load balancer. parameters is parameters supplied to the create +// or update load balancer operation. +func (client LoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (<-chan LoadBalancer, <-chan error) { + resultChan := make(chan LoadBalancer, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result LoadBalancer + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (result LoadBalancer, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified load balancer. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. loadBalancerName is the +// name of the load balancer. +func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified load balancer. +// +// resourceGroupName is the name of the resource group. loadBalancerName is the +// name of the load balancer. expand is expands referenced resources. +func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { + req, err := client.GetPreparer(resourceGroupName, loadBalancerName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancersClient) GetPreparer(resourceGroupName string, loadBalancerName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) GetResponder(resp *http.Response) (result LoadBalancer, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the load balancers in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) ListResponder(resp *http.Response) (result LoadBalancerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { + req, err := lastResults.LoadBalancerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all the load balancers in a subscription. +func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client LoadBalancersClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) ListAllResponder(resp *http.Response) (result LoadBalancerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { + req, err := lastResults.LoadBalancerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go index 42237d0b2c..c1e66076e1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go @@ -1,389 +1,389 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LocalNetworkGatewaysClient is the composite Swagger for Network Client -type LocalNetworkGatewaysClient struct { - ManagementClient -} - -// NewLocalNetworkGatewaysClient creates an instance of the -// LocalNetworkGatewaysClient client. -func NewLocalNetworkGatewaysClient(subscriptionID string) LocalNetworkGatewaysClient { - return NewLocalNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocalNetworkGatewaysClientWithBaseURI creates an instance of the -// LocalNetworkGatewaysClient client. -func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) LocalNetworkGatewaysClient { - return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a local network gateway in the specified -// resource group. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName -// is the name of the local network gateway. parameters is parameters supplied -// to the create or update local network gateway operation. -func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (<-chan LocalNetworkGateway, <-chan error) { - resultChan := make(chan LocalNetworkGateway, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: localNetworkGatewayName, - Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result LocalNetworkGateway - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result LocalNetworkGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified local network gateway. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName -// is the name of the local network gateway. -func (client LocalNetworkGatewaysClient) Delete(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: localNetworkGatewayName, - Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, localNetworkGatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified local network gateway in a resource group. -// -// resourceGroupName is the name of the resource group. localNetworkGatewayName -// is the name of the local network gateway. -func (client LocalNetworkGatewaysClient) Get(resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: localNetworkGatewayName, - Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, localNetworkGatewayName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LocalNetworkGatewaysClient) GetPreparer(resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (result LocalNetworkGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the local network gateways in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client LocalNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (result LocalNetworkGatewayListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) { - req, err := lastResults.LocalNetworkGatewayListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LocalNetworkGatewaysClient is the composite Swagger for Network Client +type LocalNetworkGatewaysClient struct { + ManagementClient +} + +// NewLocalNetworkGatewaysClient creates an instance of the +// LocalNetworkGatewaysClient client. +func NewLocalNetworkGatewaysClient(subscriptionID string) LocalNetworkGatewaysClient { + return NewLocalNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocalNetworkGatewaysClientWithBaseURI creates an instance of the +// LocalNetworkGatewaysClient client. +func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) LocalNetworkGatewaysClient { + return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a local network gateway in the specified +// resource group. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. localNetworkGatewayName +// is the name of the local network gateway. parameters is parameters supplied +// to the create or update local network gateway operation. +func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (<-chan LocalNetworkGateway, <-chan error) { + resultChan := make(chan LocalNetworkGateway, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result LocalNetworkGateway + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result LocalNetworkGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified local network gateway. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. localNetworkGatewayName +// is the name of the local network gateway. +func (client LocalNetworkGatewaysClient) Delete(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, localNetworkGatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified local network gateway in a resource group. +// +// resourceGroupName is the name of the resource group. localNetworkGatewayName +// is the name of the local network gateway. +func (client LocalNetworkGatewaysClient) Get(resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, localNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LocalNetworkGatewaysClient) GetPreparer(resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (result LocalNetworkGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the local network gateways in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client LocalNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (result LocalNetworkGatewayListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) { + req, err := lastResults.LocalNetworkGatewayListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go index 352c958324..505691db01 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go @@ -1,2996 +1,2996 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// Access enumerates the values for access. -type Access string - -const ( - // Allow specifies the allow state for access. - Allow Access = "Allow" - // Deny specifies the deny state for access. - Deny Access = "Deny" -) - -// ApplicationGatewayBackendHealthServerHealth enumerates the values for -// application gateway backend health server health. -type ApplicationGatewayBackendHealthServerHealth string - -const ( - // Down specifies the down state for application gateway backend health - // server health. - Down ApplicationGatewayBackendHealthServerHealth = "Down" - // Draining specifies the draining state for application gateway backend - // health server health. - Draining ApplicationGatewayBackendHealthServerHealth = "Draining" - // Partial specifies the partial state for application gateway backend - // health server health. - Partial ApplicationGatewayBackendHealthServerHealth = "Partial" - // Unknown specifies the unknown state for application gateway backend - // health server health. - Unknown ApplicationGatewayBackendHealthServerHealth = "Unknown" - // Up specifies the up state for application gateway backend health server - // health. - Up ApplicationGatewayBackendHealthServerHealth = "Up" -) - -// ApplicationGatewayCookieBasedAffinity enumerates the values for application -// gateway cookie based affinity. -type ApplicationGatewayCookieBasedAffinity string - -const ( - // Disabled specifies the disabled state for application gateway cookie - // based affinity. - Disabled ApplicationGatewayCookieBasedAffinity = "Disabled" - // Enabled specifies the enabled state for application gateway cookie based - // affinity. - Enabled ApplicationGatewayCookieBasedAffinity = "Enabled" -) - -// ApplicationGatewayFirewallMode enumerates the values for application gateway -// firewall mode. -type ApplicationGatewayFirewallMode string - -const ( - // Detection specifies the detection state for application gateway firewall - // mode. - Detection ApplicationGatewayFirewallMode = "Detection" - // Prevention specifies the prevention state for application gateway - // firewall mode. - Prevention ApplicationGatewayFirewallMode = "Prevention" -) - -// ApplicationGatewayOperationalState enumerates the values for application -// gateway operational state. -type ApplicationGatewayOperationalState string - -const ( - // Running specifies the running state for application gateway operational - // state. - Running ApplicationGatewayOperationalState = "Running" - // Starting specifies the starting state for application gateway - // operational state. - Starting ApplicationGatewayOperationalState = "Starting" - // Stopped specifies the stopped state for application gateway operational - // state. - Stopped ApplicationGatewayOperationalState = "Stopped" - // Stopping specifies the stopping state for application gateway - // operational state. - Stopping ApplicationGatewayOperationalState = "Stopping" -) - -// ApplicationGatewayProtocol enumerates the values for application gateway -// protocol. -type ApplicationGatewayProtocol string - -const ( - // HTTP specifies the http state for application gateway protocol. - HTTP ApplicationGatewayProtocol = "Http" - // HTTPS specifies the https state for application gateway protocol. - HTTPS ApplicationGatewayProtocol = "Https" -) - -// ApplicationGatewayRequestRoutingRuleType enumerates the values for -// application gateway request routing rule type. -type ApplicationGatewayRequestRoutingRuleType string - -const ( - // Basic specifies the basic state for application gateway request routing - // rule type. - Basic ApplicationGatewayRequestRoutingRuleType = "Basic" - // PathBasedRouting specifies the path based routing state for application - // gateway request routing rule type. - PathBasedRouting ApplicationGatewayRequestRoutingRuleType = "PathBasedRouting" -) - -// ApplicationGatewaySkuName enumerates the values for application gateway sku -// name. -type ApplicationGatewaySkuName string - -const ( - // StandardLarge specifies the standard large state for application gateway - // sku name. - StandardLarge ApplicationGatewaySkuName = "Standard_Large" - // StandardMedium specifies the standard medium state for application - // gateway sku name. - StandardMedium ApplicationGatewaySkuName = "Standard_Medium" - // StandardSmall specifies the standard small state for application gateway - // sku name. - StandardSmall ApplicationGatewaySkuName = "Standard_Small" - // WAFLarge specifies the waf large state for application gateway sku name. - WAFLarge ApplicationGatewaySkuName = "WAF_Large" - // WAFMedium specifies the waf medium state for application gateway sku - // name. - WAFMedium ApplicationGatewaySkuName = "WAF_Medium" -) - -// ApplicationGatewaySslProtocol enumerates the values for application gateway -// ssl protocol. -type ApplicationGatewaySslProtocol string - -const ( - // TLSv10 specifies the tl sv 10 state for application gateway ssl - // protocol. - TLSv10 ApplicationGatewaySslProtocol = "TLSv1_0" - // TLSv11 specifies the tl sv 11 state for application gateway ssl - // protocol. - TLSv11 ApplicationGatewaySslProtocol = "TLSv1_1" - // TLSv12 specifies the tl sv 12 state for application gateway ssl - // protocol. - TLSv12 ApplicationGatewaySslProtocol = "TLSv1_2" -) - -// ApplicationGatewayTier enumerates the values for application gateway tier. -type ApplicationGatewayTier string - -const ( - // Standard specifies the standard state for application gateway tier. - Standard ApplicationGatewayTier = "Standard" - // WAF specifies the waf state for application gateway tier. - WAF ApplicationGatewayTier = "WAF" -) - -// AssociationType enumerates the values for association type. -type AssociationType string - -const ( - // Associated specifies the associated state for association type. - Associated AssociationType = "Associated" - // Contains specifies the contains state for association type. - Contains AssociationType = "Contains" -) - -// AuthorizationUseStatus enumerates the values for authorization use status. -type AuthorizationUseStatus string - -const ( - // Available specifies the available state for authorization use status. - Available AuthorizationUseStatus = "Available" - // InUse specifies the in use state for authorization use status. - InUse AuthorizationUseStatus = "InUse" -) - -// BgpPeerState enumerates the values for bgp peer state. -type BgpPeerState string - -const ( - // BgpPeerStateConnected specifies the bgp peer state connected state for - // bgp peer state. - BgpPeerStateConnected BgpPeerState = "Connected" - // BgpPeerStateConnecting specifies the bgp peer state connecting state for - // bgp peer state. - BgpPeerStateConnecting BgpPeerState = "Connecting" - // BgpPeerStateIdle specifies the bgp peer state idle state for bgp peer - // state. - BgpPeerStateIdle BgpPeerState = "Idle" - // BgpPeerStateStopped specifies the bgp peer state stopped state for bgp - // peer state. - BgpPeerStateStopped BgpPeerState = "Stopped" - // BgpPeerStateUnknown specifies the bgp peer state unknown state for bgp - // peer state. - BgpPeerStateUnknown BgpPeerState = "Unknown" -) - -// DhGroup enumerates the values for dh group. -type DhGroup string - -const ( - // DHGroup1 specifies the dh group 1 state for dh group. - DHGroup1 DhGroup = "DHGroup1" - // DHGroup14 specifies the dh group 14 state for dh group. - DHGroup14 DhGroup = "DHGroup14" - // DHGroup2 specifies the dh group 2 state for dh group. - DHGroup2 DhGroup = "DHGroup2" - // DHGroup2048 specifies the dh group 2048 state for dh group. - DHGroup2048 DhGroup = "DHGroup2048" - // DHGroup24 specifies the dh group 24 state for dh group. - DHGroup24 DhGroup = "DHGroup24" - // ECP256 specifies the ecp256 state for dh group. - ECP256 DhGroup = "ECP256" - // ECP384 specifies the ecp384 state for dh group. - ECP384 DhGroup = "ECP384" - // None specifies the none state for dh group. - None DhGroup = "None" -) - -// Direction enumerates the values for direction. -type Direction string - -const ( - // Inbound specifies the inbound state for direction. - Inbound Direction = "Inbound" - // Outbound specifies the outbound state for direction. - Outbound Direction = "Outbound" -) - -// EffectiveRouteSource enumerates the values for effective route source. -type EffectiveRouteSource string - -const ( - // EffectiveRouteSourceDefault specifies the effective route source default - // state for effective route source. - EffectiveRouteSourceDefault EffectiveRouteSource = "Default" - // EffectiveRouteSourceUnknown specifies the effective route source unknown - // state for effective route source. - EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown" - // EffectiveRouteSourceUser specifies the effective route source user state - // for effective route source. - EffectiveRouteSourceUser EffectiveRouteSource = "User" - // EffectiveRouteSourceVirtualNetworkGateway specifies the effective route - // source virtual network gateway state for effective route source. - EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway" -) - -// EffectiveRouteState enumerates the values for effective route state. -type EffectiveRouteState string - -const ( - // Active specifies the active state for effective route state. - Active EffectiveRouteState = "Active" - // Invalid specifies the invalid state for effective route state. - Invalid EffectiveRouteState = "Invalid" -) - -// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values -// for express route circuit peering advertised public prefix state. -type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string - -const ( - // Configured specifies the configured state for express route circuit - // peering advertised public prefix state. - Configured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configured" - // Configuring specifies the configuring state for express route circuit - // peering advertised public prefix state. - Configuring ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configuring" - // NotConfigured specifies the not configured state for express route - // circuit peering advertised public prefix state. - NotConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "NotConfigured" - // ValidationNeeded specifies the validation needed state for express route - // circuit peering advertised public prefix state. - ValidationNeeded ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "ValidationNeeded" -) - -// ExpressRouteCircuitPeeringState enumerates the values for express route -// circuit peering state. -type ExpressRouteCircuitPeeringState string - -const ( - // ExpressRouteCircuitPeeringStateDisabled specifies the express route - // circuit peering state disabled state for express route circuit peering - // state. - ExpressRouteCircuitPeeringStateDisabled ExpressRouteCircuitPeeringState = "Disabled" - // ExpressRouteCircuitPeeringStateEnabled specifies the express route - // circuit peering state enabled state for express route circuit peering - // state. - ExpressRouteCircuitPeeringStateEnabled ExpressRouteCircuitPeeringState = "Enabled" -) - -// ExpressRouteCircuitPeeringType enumerates the values for express route -// circuit peering type. -type ExpressRouteCircuitPeeringType string - -const ( - // AzurePrivatePeering specifies the azure private peering state for - // express route circuit peering type. - AzurePrivatePeering ExpressRouteCircuitPeeringType = "AzurePrivatePeering" - // AzurePublicPeering specifies the azure public peering state for express - // route circuit peering type. - AzurePublicPeering ExpressRouteCircuitPeeringType = "AzurePublicPeering" - // MicrosoftPeering specifies the microsoft peering state for express route - // circuit peering type. - MicrosoftPeering ExpressRouteCircuitPeeringType = "MicrosoftPeering" -) - -// ExpressRouteCircuitSkuFamily enumerates the values for express route circuit -// sku family. -type ExpressRouteCircuitSkuFamily string - -const ( - // MeteredData specifies the metered data state for express route circuit - // sku family. - MeteredData ExpressRouteCircuitSkuFamily = "MeteredData" - // UnlimitedData specifies the unlimited data state for express route - // circuit sku family. - UnlimitedData ExpressRouteCircuitSkuFamily = "UnlimitedData" -) - -// ExpressRouteCircuitSkuTier enumerates the values for express route circuit -// sku tier. -type ExpressRouteCircuitSkuTier string - -const ( - // ExpressRouteCircuitSkuTierPremium specifies the express route circuit - // sku tier premium state for express route circuit sku tier. - ExpressRouteCircuitSkuTierPremium ExpressRouteCircuitSkuTier = "Premium" - // ExpressRouteCircuitSkuTierStandard specifies the express route circuit - // sku tier standard state for express route circuit sku tier. - ExpressRouteCircuitSkuTierStandard ExpressRouteCircuitSkuTier = "Standard" -) - -// IkeEncryption enumerates the values for ike encryption. -type IkeEncryption string - -const ( - // AES128 specifies the aes128 state for ike encryption. - AES128 IkeEncryption = "AES128" - // AES192 specifies the aes192 state for ike encryption. - AES192 IkeEncryption = "AES192" - // AES256 specifies the aes256 state for ike encryption. - AES256 IkeEncryption = "AES256" - // DES specifies the des state for ike encryption. - DES IkeEncryption = "DES" - // DES3 specifies the des3 state for ike encryption. - DES3 IkeEncryption = "DES3" -) - -// IkeIntegrity enumerates the values for ike integrity. -type IkeIntegrity string - -const ( - // MD5 specifies the md5 state for ike integrity. - MD5 IkeIntegrity = "MD5" - // SHA1 specifies the sha1 state for ike integrity. - SHA1 IkeIntegrity = "SHA1" - // SHA256 specifies the sha256 state for ike integrity. - SHA256 IkeIntegrity = "SHA256" - // SHA384 specifies the sha384 state for ike integrity. - SHA384 IkeIntegrity = "SHA384" -) - -// IPAllocationMethod enumerates the values for ip allocation method. -type IPAllocationMethod string - -const ( - // Dynamic specifies the dynamic state for ip allocation method. - Dynamic IPAllocationMethod = "Dynamic" - // Static specifies the static state for ip allocation method. - Static IPAllocationMethod = "Static" -) - -// IpsecEncryption enumerates the values for ipsec encryption. -type IpsecEncryption string - -const ( - // IpsecEncryptionAES128 specifies the ipsec encryption aes128 state for - // ipsec encryption. - IpsecEncryptionAES128 IpsecEncryption = "AES128" - // IpsecEncryptionAES192 specifies the ipsec encryption aes192 state for - // ipsec encryption. - IpsecEncryptionAES192 IpsecEncryption = "AES192" - // IpsecEncryptionAES256 specifies the ipsec encryption aes256 state for - // ipsec encryption. - IpsecEncryptionAES256 IpsecEncryption = "AES256" - // IpsecEncryptionDES specifies the ipsec encryption des state for ipsec - // encryption. - IpsecEncryptionDES IpsecEncryption = "DES" - // IpsecEncryptionDES3 specifies the ipsec encryption des3 state for ipsec - // encryption. - IpsecEncryptionDES3 IpsecEncryption = "DES3" - // IpsecEncryptionGCMAES128 specifies the ipsec encryption gcmaes128 state - // for ipsec encryption. - IpsecEncryptionGCMAES128 IpsecEncryption = "GCMAES128" - // IpsecEncryptionGCMAES192 specifies the ipsec encryption gcmaes192 state - // for ipsec encryption. - IpsecEncryptionGCMAES192 IpsecEncryption = "GCMAES192" - // IpsecEncryptionGCMAES256 specifies the ipsec encryption gcmaes256 state - // for ipsec encryption. - IpsecEncryptionGCMAES256 IpsecEncryption = "GCMAES256" - // IpsecEncryptionNone specifies the ipsec encryption none state for ipsec - // encryption. - IpsecEncryptionNone IpsecEncryption = "None" -) - -// IpsecIntegrity enumerates the values for ipsec integrity. -type IpsecIntegrity string - -const ( - // IpsecIntegrityGCMAES128 specifies the ipsec integrity gcmaes128 state - // for ipsec integrity. - IpsecIntegrityGCMAES128 IpsecIntegrity = "GCMAES128" - // IpsecIntegrityGCMAES192 specifies the ipsec integrity gcmaes192 state - // for ipsec integrity. - IpsecIntegrityGCMAES192 IpsecIntegrity = "GCMAES192" - // IpsecIntegrityGCMAES256 specifies the ipsec integrity gcmaes256 state - // for ipsec integrity. - IpsecIntegrityGCMAES256 IpsecIntegrity = "GCMAES256" - // IpsecIntegrityMD5 specifies the ipsec integrity md5 state for ipsec - // integrity. - IpsecIntegrityMD5 IpsecIntegrity = "MD5" - // IpsecIntegritySHA1 specifies the ipsec integrity sha1 state for ipsec - // integrity. - IpsecIntegritySHA1 IpsecIntegrity = "SHA1" - // IpsecIntegritySHA256 specifies the ipsec integrity sha256 state for - // ipsec integrity. - IpsecIntegritySHA256 IpsecIntegrity = "SHA256" -) - -// IPVersion enumerates the values for ip version. -type IPVersion string - -const ( - // IPv4 specifies the i pv 4 state for ip version. - IPv4 IPVersion = "IPv4" - // IPv6 specifies the i pv 6 state for ip version. - IPv6 IPVersion = "IPv6" -) - -// LoadDistribution enumerates the values for load distribution. -type LoadDistribution string - -const ( - // Default specifies the default state for load distribution. - Default LoadDistribution = "Default" - // SourceIP specifies the source ip state for load distribution. - SourceIP LoadDistribution = "SourceIP" - // SourceIPProtocol specifies the source ip protocol state for load - // distribution. - SourceIPProtocol LoadDistribution = "SourceIPProtocol" -) - -// NextHopType enumerates the values for next hop type. -type NextHopType string - -const ( - // NextHopTypeHyperNetGateway specifies the next hop type hyper net gateway - // state for next hop type. - NextHopTypeHyperNetGateway NextHopType = "HyperNetGateway" - // NextHopTypeInternet specifies the next hop type internet state for next - // hop type. - NextHopTypeInternet NextHopType = "Internet" - // NextHopTypeNone specifies the next hop type none state for next hop - // type. - NextHopTypeNone NextHopType = "None" - // NextHopTypeVirtualAppliance specifies the next hop type virtual - // appliance state for next hop type. - NextHopTypeVirtualAppliance NextHopType = "VirtualAppliance" - // NextHopTypeVirtualNetworkGateway specifies the next hop type virtual - // network gateway state for next hop type. - NextHopTypeVirtualNetworkGateway NextHopType = "VirtualNetworkGateway" - // NextHopTypeVnetLocal specifies the next hop type vnet local state for - // next hop type. - NextHopTypeVnetLocal NextHopType = "VnetLocal" -) - -// OperationStatus enumerates the values for operation status. -type OperationStatus string - -const ( - // Failed specifies the failed state for operation status. - Failed OperationStatus = "Failed" - // InProgress specifies the in progress state for operation status. - InProgress OperationStatus = "InProgress" - // Succeeded specifies the succeeded state for operation status. - Succeeded OperationStatus = "Succeeded" -) - -// PcError enumerates the values for pc error. -type PcError string - -const ( - // AgentStopped specifies the agent stopped state for pc error. - AgentStopped PcError = "AgentStopped" - // CaptureFailed specifies the capture failed state for pc error. - CaptureFailed PcError = "CaptureFailed" - // InternalError specifies the internal error state for pc error. - InternalError PcError = "InternalError" - // LocalFileFailed specifies the local file failed state for pc error. - LocalFileFailed PcError = "LocalFileFailed" - // StorageFailed specifies the storage failed state for pc error. - StorageFailed PcError = "StorageFailed" -) - -// PcProtocol enumerates the values for pc protocol. -type PcProtocol string - -const ( - // Any specifies the any state for pc protocol. - Any PcProtocol = "Any" - // TCP specifies the tcp state for pc protocol. - TCP PcProtocol = "TCP" - // UDP specifies the udp state for pc protocol. - UDP PcProtocol = "UDP" -) - -// PcStatus enumerates the values for pc status. -type PcStatus string - -const ( - // PcStatusError specifies the pc status error state for pc status. - PcStatusError PcStatus = "Error" - // PcStatusNotStarted specifies the pc status not started state for pc - // status. - PcStatusNotStarted PcStatus = "NotStarted" - // PcStatusRunning specifies the pc status running state for pc status. - PcStatusRunning PcStatus = "Running" - // PcStatusStopped specifies the pc status stopped state for pc status. - PcStatusStopped PcStatus = "Stopped" - // PcStatusUnknown specifies the pc status unknown state for pc status. - PcStatusUnknown PcStatus = "Unknown" -) - -// PfsGroup enumerates the values for pfs group. -type PfsGroup string - -const ( - // PfsGroupECP256 specifies the pfs group ecp256 state for pfs group. - PfsGroupECP256 PfsGroup = "ECP256" - // PfsGroupECP384 specifies the pfs group ecp384 state for pfs group. - PfsGroupECP384 PfsGroup = "ECP384" - // PfsGroupNone specifies the pfs group none state for pfs group. - PfsGroupNone PfsGroup = "None" - // PfsGroupPFS1 specifies the pfs group pfs1 state for pfs group. - PfsGroupPFS1 PfsGroup = "PFS1" - // PfsGroupPFS2 specifies the pfs group pfs2 state for pfs group. - PfsGroupPFS2 PfsGroup = "PFS2" - // PfsGroupPFS2048 specifies the pfs group pfs2048 state for pfs group. - PfsGroupPFS2048 PfsGroup = "PFS2048" - // PfsGroupPFS24 specifies the pfs group pfs24 state for pfs group. - PfsGroupPFS24 PfsGroup = "PFS24" -) - -// ProbeProtocol enumerates the values for probe protocol. -type ProbeProtocol string - -const ( - // ProbeProtocolHTTP specifies the probe protocol http state for probe - // protocol. - ProbeProtocolHTTP ProbeProtocol = "Http" - // ProbeProtocolTCP specifies the probe protocol tcp state for probe - // protocol. - ProbeProtocolTCP ProbeProtocol = "Tcp" -) - -// ProcessorArchitecture enumerates the values for processor architecture. -type ProcessorArchitecture string - -const ( - // Amd64 specifies the amd 64 state for processor architecture. - Amd64 ProcessorArchitecture = "Amd64" - // X86 specifies the x86 state for processor architecture. - X86 ProcessorArchitecture = "X86" -) - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolTCP specifies the protocol tcp state for protocol. - ProtocolTCP Protocol = "TCP" - // ProtocolUDP specifies the protocol udp state for protocol. - ProtocolUDP Protocol = "UDP" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateDeleting specifies the provisioning state deleting - // state for provisioning state. - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed specifies the provisioning state failed state - // for provisioning state. - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded specifies the provisioning state succeeded - // state for provisioning state. - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating specifies the provisioning state updating - // state for provisioning state. - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// RouteNextHopType enumerates the values for route next hop type. -type RouteNextHopType string - -const ( - // RouteNextHopTypeInternet specifies the route next hop type internet - // state for route next hop type. - RouteNextHopTypeInternet RouteNextHopType = "Internet" - // RouteNextHopTypeNone specifies the route next hop type none state for - // route next hop type. - RouteNextHopTypeNone RouteNextHopType = "None" - // RouteNextHopTypeVirtualAppliance specifies the route next hop type - // virtual appliance state for route next hop type. - RouteNextHopTypeVirtualAppliance RouteNextHopType = "VirtualAppliance" - // RouteNextHopTypeVirtualNetworkGateway specifies the route next hop type - // virtual network gateway state for route next hop type. - RouteNextHopTypeVirtualNetworkGateway RouteNextHopType = "VirtualNetworkGateway" - // RouteNextHopTypeVnetLocal specifies the route next hop type vnet local - // state for route next hop type. - RouteNextHopTypeVnetLocal RouteNextHopType = "VnetLocal" -) - -// SecurityRuleAccess enumerates the values for security rule access. -type SecurityRuleAccess string - -const ( - // SecurityRuleAccessAllow specifies the security rule access allow state - // for security rule access. - SecurityRuleAccessAllow SecurityRuleAccess = "Allow" - // SecurityRuleAccessDeny specifies the security rule access deny state for - // security rule access. - SecurityRuleAccessDeny SecurityRuleAccess = "Deny" -) - -// SecurityRuleDirection enumerates the values for security rule direction. -type SecurityRuleDirection string - -const ( - // SecurityRuleDirectionInbound specifies the security rule direction - // inbound state for security rule direction. - SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" - // SecurityRuleDirectionOutbound specifies the security rule direction - // outbound state for security rule direction. - SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" -) - -// SecurityRuleProtocol enumerates the values for security rule protocol. -type SecurityRuleProtocol string - -const ( - // SecurityRuleProtocolAsterisk specifies the security rule protocol - // asterisk state for security rule protocol. - SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" - // SecurityRuleProtocolTCP specifies the security rule protocol tcp state - // for security rule protocol. - SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" - // SecurityRuleProtocolUDP specifies the security rule protocol udp state - // for security rule protocol. - SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" -) - -// ServiceProviderProvisioningState enumerates the values for service provider -// provisioning state. -type ServiceProviderProvisioningState string - -const ( - // Deprovisioning specifies the deprovisioning state for service provider - // provisioning state. - Deprovisioning ServiceProviderProvisioningState = "Deprovisioning" - // NotProvisioned specifies the not provisioned state for service provider - // provisioning state. - NotProvisioned ServiceProviderProvisioningState = "NotProvisioned" - // Provisioned specifies the provisioned state for service provider - // provisioning state. - Provisioned ServiceProviderProvisioningState = "Provisioned" - // Provisioning specifies the provisioning state for service provider - // provisioning state. - Provisioning ServiceProviderProvisioningState = "Provisioning" -) - -// TransportProtocol enumerates the values for transport protocol. -type TransportProtocol string - -const ( - // TransportProtocolTCP specifies the transport protocol tcp state for - // transport protocol. - TransportProtocolTCP TransportProtocol = "Tcp" - // TransportProtocolUDP specifies the transport protocol udp state for - // transport protocol. - TransportProtocolUDP TransportProtocol = "Udp" -) - -// VirtualNetworkGatewayConnectionStatus enumerates the values for virtual -// network gateway connection status. -type VirtualNetworkGatewayConnectionStatus string - -const ( - // VirtualNetworkGatewayConnectionStatusConnected specifies the virtual - // network gateway connection status connected state for virtual network - // gateway connection status. - VirtualNetworkGatewayConnectionStatusConnected VirtualNetworkGatewayConnectionStatus = "Connected" - // VirtualNetworkGatewayConnectionStatusConnecting specifies the virtual - // network gateway connection status connecting state for virtual network - // gateway connection status. - VirtualNetworkGatewayConnectionStatusConnecting VirtualNetworkGatewayConnectionStatus = "Connecting" - // VirtualNetworkGatewayConnectionStatusNotConnected specifies the virtual - // network gateway connection status not connected state for virtual - // network gateway connection status. - VirtualNetworkGatewayConnectionStatusNotConnected VirtualNetworkGatewayConnectionStatus = "NotConnected" - // VirtualNetworkGatewayConnectionStatusUnknown specifies the virtual - // network gateway connection status unknown state for virtual network - // gateway connection status. - VirtualNetworkGatewayConnectionStatusUnknown VirtualNetworkGatewayConnectionStatus = "Unknown" -) - -// VirtualNetworkGatewayConnectionType enumerates the values for virtual -// network gateway connection type. -type VirtualNetworkGatewayConnectionType string - -const ( - // ExpressRoute specifies the express route state for virtual network - // gateway connection type. - ExpressRoute VirtualNetworkGatewayConnectionType = "ExpressRoute" - // IPsec specifies the i psec state for virtual network gateway connection - // type. - IPsec VirtualNetworkGatewayConnectionType = "IPsec" - // Vnet2Vnet specifies the vnet 2 vnet state for virtual network gateway - // connection type. - Vnet2Vnet VirtualNetworkGatewayConnectionType = "Vnet2Vnet" - // VPNClient specifies the vpn client state for virtual network gateway - // connection type. - VPNClient VirtualNetworkGatewayConnectionType = "VPNClient" -) - -// VirtualNetworkGatewaySkuName enumerates the values for virtual network -// gateway sku name. -type VirtualNetworkGatewaySkuName string - -const ( - // VirtualNetworkGatewaySkuNameBasic specifies the virtual network gateway - // sku name basic state for virtual network gateway sku name. - VirtualNetworkGatewaySkuNameBasic VirtualNetworkGatewaySkuName = "Basic" - // VirtualNetworkGatewaySkuNameHighPerformance specifies the virtual - // network gateway sku name high performance state for virtual network - // gateway sku name. - VirtualNetworkGatewaySkuNameHighPerformance VirtualNetworkGatewaySkuName = "HighPerformance" - // VirtualNetworkGatewaySkuNameStandard specifies the virtual network - // gateway sku name standard state for virtual network gateway sku name. - VirtualNetworkGatewaySkuNameStandard VirtualNetworkGatewaySkuName = "Standard" - // VirtualNetworkGatewaySkuNameUltraPerformance specifies the virtual - // network gateway sku name ultra performance state for virtual network - // gateway sku name. - VirtualNetworkGatewaySkuNameUltraPerformance VirtualNetworkGatewaySkuName = "UltraPerformance" - // VirtualNetworkGatewaySkuNameVpnGw1 specifies the virtual network gateway - // sku name vpn gw 1 state for virtual network gateway sku name. - VirtualNetworkGatewaySkuNameVpnGw1 VirtualNetworkGatewaySkuName = "VpnGw1" - // VirtualNetworkGatewaySkuNameVpnGw2 specifies the virtual network gateway - // sku name vpn gw 2 state for virtual network gateway sku name. - VirtualNetworkGatewaySkuNameVpnGw2 VirtualNetworkGatewaySkuName = "VpnGw2" - // VirtualNetworkGatewaySkuNameVpnGw3 specifies the virtual network gateway - // sku name vpn gw 3 state for virtual network gateway sku name. - VirtualNetworkGatewaySkuNameVpnGw3 VirtualNetworkGatewaySkuName = "VpnGw3" -) - -// VirtualNetworkGatewaySkuTier enumerates the values for virtual network -// gateway sku tier. -type VirtualNetworkGatewaySkuTier string - -const ( - // VirtualNetworkGatewaySkuTierBasic specifies the virtual network gateway - // sku tier basic state for virtual network gateway sku tier. - VirtualNetworkGatewaySkuTierBasic VirtualNetworkGatewaySkuTier = "Basic" - // VirtualNetworkGatewaySkuTierHighPerformance specifies the virtual - // network gateway sku tier high performance state for virtual network - // gateway sku tier. - VirtualNetworkGatewaySkuTierHighPerformance VirtualNetworkGatewaySkuTier = "HighPerformance" - // VirtualNetworkGatewaySkuTierStandard specifies the virtual network - // gateway sku tier standard state for virtual network gateway sku tier. - VirtualNetworkGatewaySkuTierStandard VirtualNetworkGatewaySkuTier = "Standard" - // VirtualNetworkGatewaySkuTierUltraPerformance specifies the virtual - // network gateway sku tier ultra performance state for virtual network - // gateway sku tier. - VirtualNetworkGatewaySkuTierUltraPerformance VirtualNetworkGatewaySkuTier = "UltraPerformance" - // VirtualNetworkGatewaySkuTierVpnGw1 specifies the virtual network gateway - // sku tier vpn gw 1 state for virtual network gateway sku tier. - VirtualNetworkGatewaySkuTierVpnGw1 VirtualNetworkGatewaySkuTier = "VpnGw1" - // VirtualNetworkGatewaySkuTierVpnGw2 specifies the virtual network gateway - // sku tier vpn gw 2 state for virtual network gateway sku tier. - VirtualNetworkGatewaySkuTierVpnGw2 VirtualNetworkGatewaySkuTier = "VpnGw2" - // VirtualNetworkGatewaySkuTierVpnGw3 specifies the virtual network gateway - // sku tier vpn gw 3 state for virtual network gateway sku tier. - VirtualNetworkGatewaySkuTierVpnGw3 VirtualNetworkGatewaySkuTier = "VpnGw3" -) - -// VirtualNetworkGatewayType enumerates the values for virtual network gateway -// type. -type VirtualNetworkGatewayType string - -const ( - // VirtualNetworkGatewayTypeExpressRoute specifies the virtual network - // gateway type express route state for virtual network gateway type. - VirtualNetworkGatewayTypeExpressRoute VirtualNetworkGatewayType = "ExpressRoute" - // VirtualNetworkGatewayTypeVpn specifies the virtual network gateway type - // vpn state for virtual network gateway type. - VirtualNetworkGatewayTypeVpn VirtualNetworkGatewayType = "Vpn" -) - -// VirtualNetworkPeeringState enumerates the values for virtual network peering -// state. -type VirtualNetworkPeeringState string - -const ( - // Connected specifies the connected state for virtual network peering - // state. - Connected VirtualNetworkPeeringState = "Connected" - // Disconnected specifies the disconnected state for virtual network - // peering state. - Disconnected VirtualNetworkPeeringState = "Disconnected" - // Initiated specifies the initiated state for virtual network peering - // state. - Initiated VirtualNetworkPeeringState = "Initiated" -) - -// VpnType enumerates the values for vpn type. -type VpnType string - -const ( - // PolicyBased specifies the policy based state for vpn type. - PolicyBased VpnType = "PolicyBased" - // RouteBased specifies the route based state for vpn type. - RouteBased VpnType = "RouteBased" -) - -// AddressSpace is addressSpace contains an array of IP address ranges that can -// be used by subnets of the virtual network. -type AddressSpace struct { - AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` -} - -// ApplicationGateway is application gateway resource -type ApplicationGateway struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayAuthenticationCertificate is authentication certificates -// of an application gateway. -type ApplicationGatewayAuthenticationCertificate struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayAuthenticationCertificatePropertiesFormat is -// authentication certificates properties of an application gateway. -type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { - Data *string `json:"data,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayAvailableWafRuleSetsResult is response for -// ApplicationGatewayAvailableWafRuleSets API service call. -type ApplicationGatewayAvailableWafRuleSetsResult struct { - autorest.Response `json:"-"` - Value *[]ApplicationGatewayFirewallRuleSet `json:"value,omitempty"` -} - -// ApplicationGatewayBackendAddress is backend address of an application -// gateway. -type ApplicationGatewayBackendAddress struct { - Fqdn *string `json:"fqdn,omitempty"` - IPAddress *string `json:"ipAddress,omitempty"` -} - -// ApplicationGatewayBackendAddressPool is backend Address Pool of an -// application gateway. -type ApplicationGatewayBackendAddressPool struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayBackendAddressPoolPropertiesFormat is properties of -// Backend Address Pool of an application gateway. -type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { - BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` - BackendAddresses *[]ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayBackendHealth is list of -// ApplicationGatewayBackendHealthPool resources. -type ApplicationGatewayBackendHealth struct { - autorest.Response `json:"-"` - BackendAddressPools *[]ApplicationGatewayBackendHealthPool `json:"backendAddressPools,omitempty"` -} - -// ApplicationGatewayBackendHealthHTTPSettings is application gateway -// BackendHealthHttp settings. -type ApplicationGatewayBackendHealthHTTPSettings struct { - BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettings,omitempty"` - Servers *[]ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` -} - -// ApplicationGatewayBackendHealthPool is application gateway BackendHealth -// pool. -type ApplicationGatewayBackendHealthPool struct { - BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` - BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHealthHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` -} - -// ApplicationGatewayBackendHealthServer is application gateway backendhealth -// http settings. -type ApplicationGatewayBackendHealthServer struct { - Address *string `json:"address,omitempty"` - IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` - Health ApplicationGatewayBackendHealthServerHealth `json:"health,omitempty"` -} - -// ApplicationGatewayBackendHTTPSettings is backend address pool settings of an -// application gateway. -type ApplicationGatewayBackendHTTPSettings struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayBackendHTTPSettingsPropertiesFormat is properties of -// Backend address pool settings of an application gateway. -type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { - Port *int32 `json:"port,omitempty"` - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` - RequestTimeout *int32 `json:"requestTimeout,omitempty"` - Probe *SubResource `json:"probe,omitempty"` - AuthenticationCertificates *[]SubResource `json:"authenticationCertificates,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ConnectionDraining *ApplicationGatewayConnectionDraining `json:"connectionDraining,omitempty"` -} - -// ApplicationGatewayConnectionDraining is connection draining allows open -// connections to a backend server to be active for a specified time after the -// backend server got removed from the configuration. -type ApplicationGatewayConnectionDraining struct { - Enabled *bool `json:"enabled,omitempty"` - DrainTimeoutInSec *int32 `json:"drainTimeoutInSec,omitempty"` -} - -// ApplicationGatewayFirewallDisabledRuleGroup is allows to disable rules -// within a rule group or an entire rule group. -type ApplicationGatewayFirewallDisabledRuleGroup struct { - RuleGroupName *string `json:"ruleGroupName,omitempty"` - Rules *[]int32 `json:"rules,omitempty"` -} - -// ApplicationGatewayFirewallRule is a web application firewall rule. -type ApplicationGatewayFirewallRule struct { - RuleID *int32 `json:"ruleId,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ApplicationGatewayFirewallRuleGroup is a web application firewall rule -// group. -type ApplicationGatewayFirewallRuleGroup struct { - RuleGroupName *string `json:"ruleGroupName,omitempty"` - Description *string `json:"description,omitempty"` - Rules *[]ApplicationGatewayFirewallRule `json:"rules,omitempty"` -} - -// ApplicationGatewayFirewallRuleSet is a web application firewall rule set. -type ApplicationGatewayFirewallRuleSet struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ApplicationGatewayFirewallRuleSetPropertiesFormat `json:"properties,omitempty"` -} - -// ApplicationGatewayFirewallRuleSetPropertiesFormat is properties of the web -// application firewall rule set. -type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - RuleSetType *string `json:"ruleSetType,omitempty"` - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` -} - -// ApplicationGatewayFrontendIPConfiguration is frontend IP configuration of an -// application gateway. -type ApplicationGatewayFrontendIPConfiguration struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayFrontendIPConfigurationPropertiesFormat is properties of -// Frontend IP configuration of an application gateway. -type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - Subnet *SubResource `json:"subnet,omitempty"` - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayFrontendPort is frontend port of an application gateway. -type ApplicationGatewayFrontendPort struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayFrontendPortPropertiesFormat is properties of Frontend -// port of an application gateway. -type ApplicationGatewayFrontendPortPropertiesFormat struct { - Port *int32 `json:"port,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayHTTPListener is http listener of an application gateway. -type ApplicationGatewayHTTPListener struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayHTTPListenerPropertiesFormat is properties of HTTP -// listener of an application gateway. -type ApplicationGatewayHTTPListenerPropertiesFormat struct { - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - FrontendPort *SubResource `json:"frontendPort,omitempty"` - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - HostName *string `json:"hostName,omitempty"` - SslCertificate *SubResource `json:"sslCertificate,omitempty"` - RequireServerNameIndication *bool `json:"requireServerNameIndication,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayIPConfiguration is iP configuration of an application -// gateway. Currently 1 public and 1 private IP configuration is allowed. -type ApplicationGatewayIPConfiguration struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayIPConfigurationPropertiesFormat is properties of IP -// configuration of an application gateway. -type ApplicationGatewayIPConfigurationPropertiesFormat struct { - Subnet *SubResource `json:"subnet,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayListResult is response for ListApplicationGateways API -// service call. -type ApplicationGatewayListResult struct { - autorest.Response `json:"-"` - Value *[]ApplicationGateway `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationGatewayListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ApplicationGatewayListResult) ApplicationGatewayListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ApplicationGatewayPathRule is path rule of URL path map of an application -// gateway. -type ApplicationGatewayPathRule struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayPathRulePropertiesFormat is properties of probe of an -// application gateway. -type ApplicationGatewayPathRulePropertiesFormat struct { - Paths *[]string `json:"paths,omitempty"` - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayProbe is probe of the application gateway. -type ApplicationGatewayProbe struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayProbePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayProbePropertiesFormat is properties of probe of an -// application gateway. -type ApplicationGatewayProbePropertiesFormat struct { - Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` - Host *string `json:"host,omitempty"` - Path *string `json:"path,omitempty"` - Interval *int32 `json:"interval,omitempty"` - Timeout *int32 `json:"timeout,omitempty"` - UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayPropertiesFormat is properties of the application gateway. -type ApplicationGatewayPropertiesFormat struct { - Sku *ApplicationGatewaySku `json:"sku,omitempty"` - SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` - OperationalState ApplicationGatewayOperationalState `json:"operationalState,omitempty"` - GatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` - AuthenticationCertificates *[]ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"` - SslCertificates *[]ApplicationGatewaySslCertificate `json:"sslCertificates,omitempty"` - FrontendIPConfigurations *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` - FrontendPorts *[]ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` - Probes *[]ApplicationGatewayProbe `json:"probes,omitempty"` - BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` - BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` - HTTPListeners *[]ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` - URLPathMaps *[]ApplicationGatewayURLPathMap `json:"urlPathMaps,omitempty"` - RequestRoutingRules *[]ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` - WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayRequestRoutingRule is request routing rule of an -// application gateway. -type ApplicationGatewayRequestRoutingRule struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayRequestRoutingRulePropertiesFormat is properties of -// request routing rule of the application gateway. -type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { - RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` - HTTPListener *SubResource `json:"httpListener,omitempty"` - URLPathMap *SubResource `json:"urlPathMap,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewaySku is sKU of an application gateway -type ApplicationGatewaySku struct { - Name ApplicationGatewaySkuName `json:"name,omitempty"` - Tier ApplicationGatewayTier `json:"tier,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// ApplicationGatewaySslCertificate is sSL certificates of an application -// gateway. -type ApplicationGatewaySslCertificate struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewaySslCertificatePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewaySslCertificatePropertiesFormat is properties of SSL -// certificates of an application gateway. -type ApplicationGatewaySslCertificatePropertiesFormat struct { - Data *string `json:"data,omitempty"` - Password *string `json:"password,omitempty"` - PublicCertData *string `json:"publicCertData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewaySslPolicy is application gateway SSL policy. -type ApplicationGatewaySslPolicy struct { - DisabledSslProtocols *[]ApplicationGatewaySslProtocol `json:"disabledSslProtocols,omitempty"` -} - -// ApplicationGatewayURLPathMap is urlPathMaps give a url path to the backend -// mapping information for PathBasedRouting. -type ApplicationGatewayURLPathMap struct { - ID *string `json:"id,omitempty"` - *ApplicationGatewayURLPathMapPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ApplicationGatewayURLPathMapPropertiesFormat is properties of UrlPathMap of -// the application gateway. -type ApplicationGatewayURLPathMapPropertiesFormat struct { - DefaultBackendAddressPool *SubResource `json:"defaultBackendAddressPool,omitempty"` - DefaultBackendHTTPSettings *SubResource `json:"defaultBackendHttpSettings,omitempty"` - PathRules *[]ApplicationGatewayPathRule `json:"pathRules,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// ApplicationGatewayWebApplicationFirewallConfiguration is application gateway -// web application firewall configuration. -type ApplicationGatewayWebApplicationFirewallConfiguration struct { - Enabled *bool `json:"enabled,omitempty"` - FirewallMode ApplicationGatewayFirewallMode `json:"firewallMode,omitempty"` - RuleSetType *string `json:"ruleSetType,omitempty"` - RuleSetVersion *string `json:"ruleSetVersion,omitempty"` - DisabledRuleGroups *[]ApplicationGatewayFirewallDisabledRuleGroup `json:"disabledRuleGroups,omitempty"` -} - -// AuthorizationListResult is response for ListAuthorizations API service call -// retrieves all authorizations that belongs to an ExpressRouteCircuit. -type AuthorizationListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteCircuitAuthorization `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AuthorizationListResult) AuthorizationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AuthorizationPropertiesFormat is -type AuthorizationPropertiesFormat struct { - AuthorizationKey *string `json:"authorizationKey,omitempty"` - AuthorizationUseStatus AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// AzureAsyncOperationResult is the response body contains the status of the -// specified asynchronous operation, indicating whether it has succeeded, is in -// progress, or has failed. Note that this status is distinct from the HTTP -// status code returned for the Get Operation Status operation itself. If the -// asynchronous operation succeeded, the response body includes the HTTP status -// code for the successful request. If the asynchronous operation failed, the -// response body includes the HTTP status code for the failed request and error -// information regarding the failure. -type AzureAsyncOperationResult struct { - Status OperationStatus `json:"status,omitempty"` - Error *Error `json:"error,omitempty"` -} - -// BackendAddressPool is pool of backend IP addresses. -type BackendAddressPool struct { - ID *string `json:"id,omitempty"` - *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// BackendAddressPoolPropertiesFormat is properties of the backend address -// pool. -type BackendAddressPoolPropertiesFormat struct { - BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` - LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - OutboundNatRule *SubResource `json:"outboundNatRule,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// BGPCommunity is contains bgp community information offered in Service -// Community resources. -type BGPCommunity struct { - ServiceSupportedRegion *string `json:"serviceSupportedRegion,omitempty"` - CommunityName *string `json:"communityName,omitempty"` - CommunityValue *string `json:"communityValue,omitempty"` - CommunityPrefixes *[]string `json:"communityPrefixes,omitempty"` -} - -// BgpPeerStatus is bGP peer status details -type BgpPeerStatus struct { - LocalAddress *string `json:"localAddress,omitempty"` - Neighbor *string `json:"neighbor,omitempty"` - Asn *int32 `json:"asn,omitempty"` - State BgpPeerState `json:"state,omitempty"` - ConnectedDuration *string `json:"connectedDuration,omitempty"` - RoutesReceived *int64 `json:"routesReceived,omitempty"` - MessagesSent *int64 `json:"messagesSent,omitempty"` - MessagesReceived *int64 `json:"messagesReceived,omitempty"` -} - -// BgpPeerStatusListResult is response for list BGP peer status API service -// call -type BgpPeerStatusListResult struct { - autorest.Response `json:"-"` - Value *[]BgpPeerStatus `json:"value,omitempty"` -} - -// BgpServiceCommunity is service Community Properties. -type BgpServiceCommunity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *BgpServiceCommunityPropertiesFormat `json:"properties,omitempty"` -} - -// BgpServiceCommunityListResult is response for the ListServiceCommunity API -// service call. -type BgpServiceCommunityListResult struct { - autorest.Response `json:"-"` - Value *[]BgpServiceCommunity `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// BgpServiceCommunityListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client BgpServiceCommunityListResult) BgpServiceCommunityListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// BgpServiceCommunityPropertiesFormat is properties of Service Community. -type BgpServiceCommunityPropertiesFormat struct { - ServiceName *string `json:"serviceName,omitempty"` - BgpCommunities *[]BGPCommunity `json:"bgpCommunities,omitempty"` -} - -// BgpSettings is bGP settings details -type BgpSettings struct { - Asn *int64 `json:"asn,omitempty"` - BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` - PeerWeight *int32 `json:"peerWeight,omitempty"` -} - -// ConnectionResetSharedKey is the virtual network connection reset shared key -type ConnectionResetSharedKey struct { - autorest.Response `json:"-"` - KeyLength *int32 `json:"keyLength,omitempty"` -} - -// ConnectionSharedKey is response for GetConnectionSharedKey API service call -type ConnectionSharedKey struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// DhcpOptions is dhcpOptions contains an array of DNS servers available to VMs -// deployed in the virtual network. Standard DHCP option for a subnet overrides -// VNET DHCP options. -type DhcpOptions struct { - DNSServers *[]string `json:"dnsServers,omitempty"` -} - -// DNSNameAvailabilityResult is response for the CheckDnsNameAvailability API -// service call. -type DNSNameAvailabilityResult struct { - autorest.Response `json:"-"` - Available *bool `json:"available,omitempty"` -} - -// EffectiveNetworkSecurityGroup is effective network security group. -type EffectiveNetworkSecurityGroup struct { - NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` - Association *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"` - EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` -} - -// EffectiveNetworkSecurityGroupAssociation is the effective network security -// group association. -type EffectiveNetworkSecurityGroupAssociation struct { - Subnet *SubResource `json:"subnet,omitempty"` - NetworkInterface *SubResource `json:"networkInterface,omitempty"` -} - -// EffectiveNetworkSecurityGroupListResult is response for list effective -// network security groups API service call. -type EffectiveNetworkSecurityGroupListResult struct { - autorest.Response `json:"-"` - Value *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// EffectiveNetworkSecurityRule is effective network security rules. -type EffectiveNetworkSecurityRule struct { - Name *string `json:"name,omitempty"` - Protocol SecurityRuleProtocol `json:"protocol,omitempty"` - SourcePortRange *string `json:"sourcePortRange,omitempty"` - DestinationPortRange *string `json:"destinationPortRange,omitempty"` - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` - ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` - ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` - Access SecurityRuleAccess `json:"access,omitempty"` - Priority *int32 `json:"priority,omitempty"` - Direction SecurityRuleDirection `json:"direction,omitempty"` -} - -// EffectiveRoute is effective Route -type EffectiveRoute struct { - Name *string `json:"name,omitempty"` - Source EffectiveRouteSource `json:"source,omitempty"` - State EffectiveRouteState `json:"state,omitempty"` - AddressPrefix *[]string `json:"addressPrefix,omitempty"` - NextHopIPAddress *[]string `json:"nextHopIpAddress,omitempty"` - NextHopType RouteNextHopType `json:"nextHopType,omitempty"` -} - -// EffectiveRouteListResult is response for list effective route API service -// call. -type EffectiveRouteListResult struct { - autorest.Response `json:"-"` - Value *[]EffectiveRoute `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// Error is -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorDetails `json:"details,omitempty"` - InnerError *string `json:"innerError,omitempty"` -} - -// ErrorDetails is -type ErrorDetails struct { - Code *string `json:"code,omitempty"` - Target *string `json:"target,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ExpressRouteCircuit is expressRouteCircuit resource -type ExpressRouteCircuit struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` - *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ExpressRouteCircuitArpTable is the ARP table associated with the -// ExpressRouteCircuit. -type ExpressRouteCircuitArpTable struct { - Age *int32 `json:"age,omitempty"` - Interface *string `json:"interface,omitempty"` - IPAddress *string `json:"ipAddress,omitempty"` - MacAddress *string `json:"macAddress,omitempty"` -} - -// ExpressRouteCircuitAuthorization is authorization in an ExpressRouteCircuit -// resource. -type ExpressRouteCircuitAuthorization struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *AuthorizationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ExpressRouteCircuitListResult is response for ListExpressRouteCircuit API -// service call. -type ExpressRouteCircuitListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteCircuit `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ExpressRouteCircuitListResult) ExpressRouteCircuitListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ExpressRouteCircuitPeering is peering in an ExpressRouteCircuit resource. -type ExpressRouteCircuitPeering struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ExpressRouteCircuitPeeringConfig is specifies the peering configuration. -type ExpressRouteCircuitPeeringConfig struct { - AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` - AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"` - CustomerASN *int32 `json:"customerASN,omitempty"` - RoutingRegistryName *string `json:"routingRegistryName,omitempty"` -} - -// ExpressRouteCircuitPeeringListResult is response for ListPeering API service -// call retrieves all peerings that belong to an ExpressRouteCircuit. -type ExpressRouteCircuitPeeringListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ExpressRouteCircuitPeeringListResult) ExpressRouteCircuitPeeringListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ExpressRouteCircuitPeeringPropertiesFormat is -type ExpressRouteCircuitPeeringPropertiesFormat struct { - PeeringType ExpressRouteCircuitPeeringType `json:"peeringType,omitempty"` - State ExpressRouteCircuitPeeringState `json:"state,omitempty"` - AzureASN *int32 `json:"azureASN,omitempty"` - PeerASN *int32 `json:"peerASN,omitempty"` - PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` - SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` - PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` - SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` - SharedKey *string `json:"sharedKey,omitempty"` - VlanID *int32 `json:"vlanId,omitempty"` - MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` - Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - RouteFilter *RouteFilter `json:"routeFilter,omitempty"` -} - -// ExpressRouteCircuitPropertiesFormat is properties of ExpressRouteCircuit. -type ExpressRouteCircuitPropertiesFormat struct { - AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"` - CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` - ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` - Authorizations *[]ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` - Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` - ServiceKey *string `json:"serviceKey,omitempty"` - ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` - ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` -} - -// ExpressRouteCircuitRoutesTable is the routes table associated with the -// ExpressRouteCircuit -type ExpressRouteCircuitRoutesTable struct { - NetworkProperty *string `json:"network,omitempty"` - NextHop *string `json:"nextHop,omitempty"` - LocPrf *string `json:"locPrf,omitempty"` - Weight *int32 `json:"weight,omitempty"` - Path *string `json:"path,omitempty"` -} - -// ExpressRouteCircuitRoutesTableSummary is the routes table associated with -// the ExpressRouteCircuit. -type ExpressRouteCircuitRoutesTableSummary struct { - Neighbor *string `json:"neighbor,omitempty"` - V *int32 `json:"v,omitempty"` - As *int32 `json:"as,omitempty"` - UpDown *string `json:"upDown,omitempty"` - StatePfxRcd *string `json:"statePfxRcd,omitempty"` -} - -// ExpressRouteCircuitsArpTableListResult is response for ListArpTable -// associated with the Express Route Circuits API. -type ExpressRouteCircuitsArpTableListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitServiceProviderProperties is contains -// ServiceProviderProperties in an ExpressRouteCircuit. -type ExpressRouteCircuitServiceProviderProperties struct { - ServiceProviderName *string `json:"serviceProviderName,omitempty"` - PeeringLocation *string `json:"peeringLocation,omitempty"` - BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` -} - -// ExpressRouteCircuitSku is contains SKU in an ExpressRouteCircuit. -type ExpressRouteCircuitSku struct { - Name *string `json:"name,omitempty"` - Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` - Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` -} - -// ExpressRouteCircuitsRoutesTableListResult is response for ListRoutesTable -// associated with the Express Route Circuits API. -type ExpressRouteCircuitsRoutesTableListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteCircuitRoutesTable `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitsRoutesTableSummaryListResult is response for -// ListRoutesTable associated with the Express Route Circuits API. -type ExpressRouteCircuitsRoutesTableSummaryListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteCircuitStats is contains stats associated with the peering. -type ExpressRouteCircuitStats struct { - autorest.Response `json:"-"` - PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` - PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` - SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` - SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` -} - -// ExpressRouteServiceProvider is a ExpressRouteResourceProvider object. -type ExpressRouteServiceProvider struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` -} - -// ExpressRouteServiceProviderBandwidthsOffered is contains bandwidths offered -// in ExpressRouteServiceProvider resources. -type ExpressRouteServiceProviderBandwidthsOffered struct { - OfferName *string `json:"offerName,omitempty"` - ValueInMbps *int32 `json:"valueInMbps,omitempty"` -} - -// ExpressRouteServiceProviderListResult is response for the -// ListExpressRouteServiceProvider API service call. -type ExpressRouteServiceProviderListResult struct { - autorest.Response `json:"-"` - Value *[]ExpressRouteServiceProvider `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ExpressRouteServiceProviderListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ExpressRouteServiceProviderListResult) ExpressRouteServiceProviderListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ExpressRouteServiceProviderPropertiesFormat is properties of -// ExpressRouteServiceProvider. -type ExpressRouteServiceProviderPropertiesFormat struct { - PeeringLocations *[]string `json:"peeringLocations,omitempty"` - BandwidthsOffered *[]ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// FlowLogInformation is information on the configuration of flow log. -type FlowLogInformation struct { - autorest.Response `json:"-"` - TargetResourceID *string `json:"targetResourceId,omitempty"` - *FlowLogProperties `json:"properties,omitempty"` -} - -// FlowLogProperties is parameters that define the configuration of flow log. -type FlowLogProperties struct { - StorageID *string `json:"storageId,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` -} - -// FlowLogStatusParameters is parameters that define a resource to query flow -// log status. -type FlowLogStatusParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// FrontendIPConfiguration is frontend IP address of the load balancer. -type FrontendIPConfiguration struct { - ID *string `json:"id,omitempty"` - *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// FrontendIPConfigurationPropertiesFormat is properties of Frontend IP -// Configuration of the load balancer. -type FrontendIPConfigurationPropertiesFormat struct { - InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` - InboundNatPools *[]SubResource `json:"inboundNatPools,omitempty"` - OutboundNatRules *[]SubResource `json:"outboundNatRules,omitempty"` - LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - Subnet *Subnet `json:"subnet,omitempty"` - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// GatewayRoute is gateway routing details -type GatewayRoute struct { - LocalAddress *string `json:"localAddress,omitempty"` - NetworkProperty *string `json:"network,omitempty"` - NextHop *string `json:"nextHop,omitempty"` - SourcePeer *string `json:"sourcePeer,omitempty"` - Origin *string `json:"origin,omitempty"` - AsPath *string `json:"asPath,omitempty"` - Weight *int32 `json:"weight,omitempty"` -} - -// GatewayRouteListResult is list of virtual network gateway routes -type GatewayRouteListResult struct { - autorest.Response `json:"-"` - Value *[]GatewayRoute `json:"value,omitempty"` -} - -// InboundNatPool is inbound NAT pool of the load balancer. -type InboundNatPool struct { - ID *string `json:"id,omitempty"` - *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// InboundNatPoolPropertiesFormat is properties of Inbound NAT pool. -type InboundNatPoolPropertiesFormat struct { - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - Protocol TransportProtocol `json:"protocol,omitempty"` - FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` - FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// InboundNatRule is inbound NAT rule of the load balancer. -type InboundNatRule struct { - ID *string `json:"id,omitempty"` - *InboundNatRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// InboundNatRulePropertiesFormat is properties of the inbound NAT rule. -type InboundNatRulePropertiesFormat struct { - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty"` - Protocol TransportProtocol `json:"protocol,omitempty"` - FrontendPort *int32 `json:"frontendPort,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// Interface is a network interface in a resource group. -type Interface struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *InterfacePropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// InterfaceAssociation is network interface and its custom security rules. -type InterfaceAssociation struct { - ID *string `json:"id,omitempty"` - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` -} - -// InterfaceDNSSettings is dNS settings of a network interface. -type InterfaceDNSSettings struct { - DNSServers *[]string `json:"dnsServers,omitempty"` - AppliedDNSServers *[]string `json:"appliedDnsServers,omitempty"` - InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` - InternalFqdn *string `json:"internalFqdn,omitempty"` - InternalDomainNameSuffix *string `json:"internalDomainNameSuffix,omitempty"` -} - -// InterfaceIPConfiguration is iPConfiguration in a network interface. -type InterfaceIPConfiguration struct { - ID *string `json:"id,omitempty"` - *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// InterfaceIPConfigurationPropertiesFormat is properties of IP configuration. -type InterfaceIPConfigurationPropertiesFormat struct { - ApplicationGatewayBackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"applicationGatewayBackendAddressPools,omitempty"` - LoadBalancerBackendAddressPools *[]BackendAddressPool `json:"loadBalancerBackendAddressPools,omitempty"` - LoadBalancerInboundNatRules *[]InboundNatRule `json:"loadBalancerInboundNatRules,omitempty"` - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` - Subnet *Subnet `json:"subnet,omitempty"` - Primary *bool `json:"primary,omitempty"` - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// InterfaceListResult is response for the ListNetworkInterface API service -// call. -type InterfaceListResult struct { - autorest.Response `json:"-"` - Value *[]Interface `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// InterfaceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client InterfaceListResult) InterfaceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// InterfacePropertiesFormat is networkInterface properties. -type InterfacePropertiesFormat struct { - VirtualMachine *SubResource `json:"virtualMachine,omitempty"` - NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` - IPConfigurations *[]InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` - DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` - MacAddress *string `json:"macAddress,omitempty"` - Primary *bool `json:"primary,omitempty"` - EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` - EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// IPAddressAvailabilityResult is response for CheckIPAddressAvailability API -// service call -type IPAddressAvailabilityResult struct { - autorest.Response `json:"-"` - Available *bool `json:"available,omitempty"` - AvailableIPAddresses *[]string `json:"availableIPAddresses,omitempty"` -} - -// IPConfiguration is iPConfiguration -type IPConfiguration struct { - ID *string `json:"id,omitempty"` - *IPConfigurationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// IPConfigurationPropertiesFormat is properties of IP configuration. -type IPConfigurationPropertiesFormat struct { - PrivateIPAddress *string `json:"privateIPAddress,omitempty"` - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - Subnet *Subnet `json:"subnet,omitempty"` - PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// IpsecPolicy is an IPSec Policy configuration for a virtual network gateway -// connection -type IpsecPolicy struct { - SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` - SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` - IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` - IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` - IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` - IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` - DhGroup DhGroup `json:"dhGroup,omitempty"` - PfsGroup PfsGroup `json:"pfsGroup,omitempty"` -} - -// LoadBalancer is loadBalancer resource -type LoadBalancer struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LoadBalancerPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// LoadBalancerListResult is response for ListLoadBalancers API service call. -type LoadBalancerListResult struct { - autorest.Response `json:"-"` - Value *[]LoadBalancer `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// LoadBalancerListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client LoadBalancerListResult) LoadBalancerListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// LoadBalancerPropertiesFormat is properties of the load balancer. -type LoadBalancerPropertiesFormat struct { - FrontendIPConfigurations *[]FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` - BackendAddressPools *[]BackendAddressPool `json:"backendAddressPools,omitempty"` - LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` - Probes *[]Probe `json:"probes,omitempty"` - InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` - InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` - OutboundNatRules *[]OutboundNatRule `json:"outboundNatRules,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// LoadBalancingRule is a loag balancing rule for a load balancer. -type LoadBalancingRule struct { - ID *string `json:"id,omitempty"` - *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// LoadBalancingRulePropertiesFormat is properties of the load balancer. -type LoadBalancingRulePropertiesFormat struct { - FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - Probe *SubResource `json:"probe,omitempty"` - Protocol TransportProtocol `json:"protocol,omitempty"` - LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"` - FrontendPort *int32 `json:"frontendPort,omitempty"` - BackendPort *int32 `json:"backendPort,omitempty"` - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// LocalNetworkGateway is a common class for general resource information -type LocalNetworkGateway struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// LocalNetworkGatewayListResult is response for ListLocalNetworkGateways API -// service call. -type LocalNetworkGatewayListResult struct { - autorest.Response `json:"-"` - Value *[]LocalNetworkGateway `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// LocalNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client LocalNetworkGatewayListResult) LocalNetworkGatewayListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// LocalNetworkGatewayPropertiesFormat is localNetworkGateway properties -type LocalNetworkGatewayPropertiesFormat struct { - LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` - GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` - BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// NextHopParameters is parameters that define the source and destination -// endpoint. -type NextHopParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - SourceIPAddress *string `json:"sourceIPAddress,omitempty"` - DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` - TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` -} - -// NextHopResult is the information about next hop from the specified VM. -type NextHopResult struct { - autorest.Response `json:"-"` - NextHopType NextHopType `json:"nextHopType,omitempty"` - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` - RouteTableID *string `json:"routeTableId,omitempty"` -} - -// OutboundNatRule is outbound NAT pool of the load balancer. -type OutboundNatRule struct { - ID *string `json:"id,omitempty"` - *OutboundNatRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// OutboundNatRulePropertiesFormat is outbound NAT pool of the load balancer. -type OutboundNatRulePropertiesFormat struct { - AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` - FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"` - BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PacketCapture is parameters that define the create packet capture operation. -type PacketCapture struct { - *PacketCaptureParameters `json:"properties,omitempty"` -} - -// PacketCaptureFilter is filter that is applied to packet capture request. -// Multiple filters can be applied. -type PacketCaptureFilter struct { - Protocol PcProtocol `json:"protocol,omitempty"` - LocalIPAddress *string `json:"localIPAddress,omitempty"` - RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` - LocalPort *string `json:"localPort,omitempty"` - RemotePort *string `json:"remotePort,omitempty"` -} - -// PacketCaptureListResult is list of packet capture sessions. -type PacketCaptureListResult struct { - autorest.Response `json:"-"` - Value *[]PacketCaptureResult `json:"value,omitempty"` -} - -// PacketCaptureParameters is parameters that define the create packet capture -// operation. -type PacketCaptureParameters struct { - Target *string `json:"target,omitempty"` - BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` - TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` - TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` - StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` - Filters *[]PacketCaptureFilter `json:"filters,omitempty"` -} - -// PacketCaptureQueryStatusResult is status of packet capture session. -type PacketCaptureQueryStatusResult struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` - PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` - StopReason *string `json:"stopReason,omitempty"` - PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` -} - -// PacketCaptureResult is information about packet capture session. -type PacketCaptureResult struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Etag *string `json:"etag,omitempty"` - *PacketCaptureResultProperties `json:"properties,omitempty"` -} - -// PacketCaptureResultProperties is describes the properties of a packet -// capture session. -type PacketCaptureResultProperties struct { - Target *string `json:"target,omitempty"` - BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` - TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` - TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` - StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` - Filters *[]PacketCaptureFilter `json:"filters,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// PacketCaptureStorageLocation is describes the storage location for a packet -// capture session. -type PacketCaptureStorageLocation struct { - StorageID *string `json:"storageId,omitempty"` - StoragePath *string `json:"storagePath,omitempty"` - FilePath *string `json:"filePath,omitempty"` -} - -// PatchRouteFilter is route Filter Resource. -type PatchRouteFilter struct { - ID *string `json:"id,omitempty"` - *RouteFilterPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// PatchRouteFilterRule is route Filter Rule Resource -type PatchRouteFilterRule struct { - ID *string `json:"id,omitempty"` - *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Probe is a load balancer probe. -type Probe struct { - ID *string `json:"id,omitempty"` - *ProbePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ProbePropertiesFormat is -type ProbePropertiesFormat struct { - LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` - Protocol ProbeProtocol `json:"protocol,omitempty"` - Port *int32 `json:"port,omitempty"` - IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` - NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` - RequestPath *string `json:"requestPath,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// PublicIPAddress is public IP address resource. -type PublicIPAddress struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// PublicIPAddressDNSSettings is contains FQDN of the DNS record associated -// with the public IP address -type PublicIPAddressDNSSettings struct { - DomainNameLabel *string `json:"domainNameLabel,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` - ReverseFqdn *string `json:"reverseFqdn,omitempty"` -} - -// PublicIPAddressListResult is response for ListPublicIpAddresses API service -// call. -type PublicIPAddressListResult struct { - autorest.Response `json:"-"` - Value *[]PublicIPAddress `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PublicIPAddressListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PublicIPAddressListResult) PublicIPAddressListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PublicIPAddressPropertiesFormat is public IP address properties. -type PublicIPAddressPropertiesFormat struct { - PublicIPAllocationMethod IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` - PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` - IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"` - DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` - IPAddress *string `json:"ipAddress,omitempty"` - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// QueryTroubleshootingParameters is parameters that define the resource to -// query the troubleshooting result. -type QueryTroubleshootingParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceNavigationLink is resourceNavigationLink resource. -type ResourceNavigationLink struct { - ID *string `json:"id,omitempty"` - *ResourceNavigationLinkFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// ResourceNavigationLinkFormat is properties of ResourceNavigationLink. -type ResourceNavigationLinkFormat struct { - LinkedResourceType *string `json:"linkedResourceType,omitempty"` - Link *string `json:"link,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// RetentionPolicyParameters is parameters that define the retention policy for -// flow log. -type RetentionPolicyParameters struct { - Days *int32 `json:"days,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// Route is route resource -type Route struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *RoutePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// RouteFilter is route Filter Resource. -type RouteFilter struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RouteFilterPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// RouteFilterListResult is response for the ListRouteFilters API service call. -type RouteFilterListResult struct { - autorest.Response `json:"-"` - Value *[]RouteFilter `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteFilterListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RouteFilterListResult) RouteFilterListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RouteFilterPropertiesFormat is route Filter Resource -type RouteFilterPropertiesFormat struct { - Rules *[]RouteFilterRule `json:"rules,omitempty"` - Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// RouteFilterRule is route Filter Rule Resource -type RouteFilterRule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Etag *string `json:"etag,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RouteFilterRuleListResult is response for the ListRouteFilterRules API -// service call -type RouteFilterRuleListResult struct { - autorest.Response `json:"-"` - Value *[]RouteFilterRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteFilterRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RouteFilterRuleListResult) RouteFilterRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RouteFilterRulePropertiesFormat is route Filter Rule Resource -type RouteFilterRulePropertiesFormat struct { - Access Access `json:"access,omitempty"` - RouteFilterRuleType *string `json:"routeFilterRuleType,omitempty"` - Communities *[]string `json:"communities,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// RouteListResult is response for the ListRoute API service call -type RouteListResult struct { - autorest.Response `json:"-"` - Value *[]Route `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RouteListResult) RouteListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RoutePropertiesFormat is route resource -type RoutePropertiesFormat struct { - AddressPrefix *string `json:"addressPrefix,omitempty"` - NextHopType RouteNextHopType `json:"nextHopType,omitempty"` - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// RouteTable is route table resource. -type RouteTable struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RouteTablePropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// RouteTableListResult is response for the ListRouteTable API service call. -type RouteTableListResult struct { - autorest.Response `json:"-"` - Value *[]RouteTable `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// RouteTableListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RouteTableListResult) RouteTableListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RouteTablePropertiesFormat is route Table resource -type RouteTablePropertiesFormat struct { - Routes *[]Route `json:"routes,omitempty"` - Subnets *[]Subnet `json:"subnets,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// SecurityGroup is networkSecurityGroup resource. -type SecurityGroup struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SecurityGroupPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// SecurityGroupListResult is response for ListNetworkSecurityGroups API -// service call. -type SecurityGroupListResult struct { - autorest.Response `json:"-"` - Value *[]SecurityGroup `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SecurityGroupListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SecurityGroupListResult) SecurityGroupListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SecurityGroupNetworkInterface is network interface and all its associated -// security rules. -type SecurityGroupNetworkInterface struct { - ID *string `json:"id,omitempty"` - SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` -} - -// SecurityGroupPropertiesFormat is network Security Group resource. -type SecurityGroupPropertiesFormat struct { - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` - DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` - NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` - Subnets *[]Subnet `json:"subnets,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// SecurityGroupViewParameters is parameters that define the VM to check -// security groups for. -type SecurityGroupViewParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// SecurityGroupViewResult is the information about security rules applied to -// the specified VM. -type SecurityGroupViewResult struct { - autorest.Response `json:"-"` - NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` -} - -// SecurityRule is network security rule. -type SecurityRule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *SecurityRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// SecurityRuleAssociations is all security rules associated with the network -// interface. -type SecurityRuleAssociations struct { - NetworkInterfaceAssociation *InterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` - SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` - DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` - EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` -} - -// SecurityRuleListResult is response for ListSecurityRule API service call. -// Retrieves all security rules that belongs to a network security group. -type SecurityRuleListResult struct { - autorest.Response `json:"-"` - Value *[]SecurityRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SecurityRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SecurityRuleListResult) SecurityRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SecurityRulePropertiesFormat is -type SecurityRulePropertiesFormat struct { - Description *string `json:"description,omitempty"` - Protocol SecurityRuleProtocol `json:"protocol,omitempty"` - SourcePortRange *string `json:"sourcePortRange,omitempty"` - DestinationPortRange *string `json:"destinationPortRange,omitempty"` - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` - Access SecurityRuleAccess `json:"access,omitempty"` - Priority *int32 `json:"priority,omitempty"` - Direction SecurityRuleDirection `json:"direction,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// String is -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// Subnet is subnet in a virtual network resource. -type Subnet struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *SubnetPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// SubnetAssociation is network interface and its custom security rules. -type SubnetAssociation struct { - ID *string `json:"id,omitempty"` - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` -} - -// SubnetListResult is response for ListSubnets API service callRetrieves all -// subnet that belongs to a virtual network -type SubnetListResult struct { - autorest.Response `json:"-"` - Value *[]Subnet `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SubnetListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SubnetListResult) SubnetListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SubnetPropertiesFormat is -type SubnetPropertiesFormat struct { - AddressPrefix *string `json:"addressPrefix,omitempty"` - NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` - RouteTable *RouteTable `json:"routeTable,omitempty"` - IPConfigurations *[]IPConfiguration `json:"ipConfigurations,omitempty"` - ResourceNavigationLinks *[]ResourceNavigationLink `json:"resourceNavigationLinks,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// Topology is topology of the specified resource group. -type Topology struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - LastModified *date.Time `json:"lastModified,omitempty"` - Resources *[]TopologyResource `json:"resources,omitempty"` -} - -// TopologyAssociation is resources that have an association with the parent -// resource. -type TopologyAssociation struct { - Name *string `json:"name,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - AssociationType AssociationType `json:"associationType,omitempty"` -} - -// TopologyParameters is parameters that define the representation of topology. -type TopologyParameters struct { - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` -} - -// TopologyResource is the network resource topology information for the given -// resource group. -type TopologyResource struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Associations *[]TopologyAssociation `json:"associations,omitempty"` -} - -// TroubleshootingDetails is information gained from troubleshooting of -// specified resource. -type TroubleshootingDetails struct { - ID *string `json:"id,omitempty"` - ReasonType *string `json:"reasonType,omitempty"` - Summary *string `json:"summary,omitempty"` - Detail *string `json:"detail,omitempty"` - RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` -} - -// TroubleshootingParameters is parameters that define the resource to -// troubleshoot. -type TroubleshootingParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - *TroubleshootingProperties `json:"properties,omitempty"` -} - -// TroubleshootingProperties is storage location provided for troubleshoot. -type TroubleshootingProperties struct { - StorageID *string `json:"storageId,omitempty"` - StoragePath *string `json:"storagePath,omitempty"` -} - -// TroubleshootingRecommendedActions is recommended actions based on discovered -// issues. -type TroubleshootingRecommendedActions struct { - ActionID *string `json:"actionId,omitempty"` - ActionText *string `json:"actionText,omitempty"` - ActionURI *string `json:"actionUri,omitempty"` - ActionURIText *string `json:"actionUriText,omitempty"` -} - -// TroubleshootingResult is troubleshooting information gained from specified -// resource. -type TroubleshootingResult struct { - autorest.Response `json:"-"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Code *string `json:"code,omitempty"` - Results *[]TroubleshootingDetails `json:"results,omitempty"` -} - -// TunnelConnectionHealth is virtualNetworkGatewayConnection properties -type TunnelConnectionHealth struct { - Tunnel *string `json:"tunnel,omitempty"` - ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - LastConnectionEstablishedUtcTime *string `json:"lastConnectionEstablishedUtcTime,omitempty"` -} - -// Usage is describes network resource usage. -type Usage struct { - Unit *string `json:"unit,omitempty"` - CurrentValue *int64 `json:"currentValue,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Name *UsageName `json:"name,omitempty"` -} - -// UsageName is the usage names. -type UsageName struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// UsagesListResult is the list usages operation response. -type UsagesListResult struct { - autorest.Response `json:"-"` - Value *[]Usage `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// UsagesListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client UsagesListResult) UsagesListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VerificationIPFlowParameters is parameters that define the IP flow to be -// verified. -type VerificationIPFlowParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - Direction Direction `json:"direction,omitempty"` - Protocol Protocol `json:"protocol,omitempty"` - LocalPort *string `json:"localPort,omitempty"` - RemotePort *string `json:"remotePort,omitempty"` - LocalIPAddress *string `json:"localIPAddress,omitempty"` - RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` - TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` -} - -// VerificationIPFlowResult is results of IP flow verification on the target -// resource. -type VerificationIPFlowResult struct { - autorest.Response `json:"-"` - Access Access `json:"access,omitempty"` - RuleName *string `json:"ruleName,omitempty"` -} - -// VirtualNetwork is virtual Network resource. -type VirtualNetwork struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VirtualNetworkGateway is a common class for general resource information -type VirtualNetworkGateway struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VirtualNetworkGatewayConnection is a common class for general resource -// information -type VirtualNetworkGatewayConnection struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VirtualNetworkGatewayConnectionListResult is response for the -// ListVirtualNetworkGatewayConnections API service call -type VirtualNetworkGatewayConnectionListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualNetworkGatewayConnection `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkGatewayConnectionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualNetworkGatewayConnectionListResult) VirtualNetworkGatewayConnectionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualNetworkGatewayConnectionPropertiesFormat is -// virtualNetworkGatewayConnection properties -type VirtualNetworkGatewayConnectionPropertiesFormat struct { - AuthorizationKey *string `json:"authorizationKey,omitempty"` - VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` - VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` - LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` - ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` - RoutingWeight *int32 `json:"routingWeight,omitempty"` - SharedKey *string `json:"sharedKey,omitempty"` - ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` - TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` - EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` - IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` - Peer *SubResource `json:"peer,omitempty"` - EnableBgp *bool `json:"enableBgp,omitempty"` - UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` - IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VirtualNetworkGatewayIPConfiguration is iP configuration for virtual network -// gateway -type VirtualNetworkGatewayIPConfiguration struct { - ID *string `json:"id,omitempty"` - *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VirtualNetworkGatewayIPConfigurationPropertiesFormat is properties of -// VirtualNetworkGatewayIPConfiguration -type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { - PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` - Subnet *SubResource `json:"subnet,omitempty"` - PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VirtualNetworkGatewayListResult is response for the -// ListVirtualNetworkGateways API service call. -type VirtualNetworkGatewayListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualNetworkGateway `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualNetworkGatewayListResult) VirtualNetworkGatewayListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualNetworkGatewayPropertiesFormat is virtualNetworkGateway properties -type VirtualNetworkGatewayPropertiesFormat struct { - IPConfigurations *[]VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` - GatewayType VirtualNetworkGatewayType `json:"gatewayType,omitempty"` - VpnType VpnType `json:"vpnType,omitempty"` - EnableBgp *bool `json:"enableBgp,omitempty"` - ActiveActive *bool `json:"activeActive,omitempty"` - GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` - Sku *VirtualNetworkGatewaySku `json:"sku,omitempty"` - VpnClientConfiguration *VpnClientConfiguration `json:"vpnClientConfiguration,omitempty"` - BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VirtualNetworkGatewaySku is virtualNetworkGatewaySku details -type VirtualNetworkGatewaySku struct { - Name VirtualNetworkGatewaySkuName `json:"name,omitempty"` - Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// VirtualNetworkListResult is response for the ListVirtualNetworks API service -// call. -type VirtualNetworkListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualNetwork `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualNetworkListResult) VirtualNetworkListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualNetworkPeering is peerings in a virtual network resource. -type VirtualNetworkPeering struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VirtualNetworkPeeringListResult is response for ListSubnets API service -// call. Retrieves all subnets that belong to a virtual network. -type VirtualNetworkPeeringListResult struct { - autorest.Response `json:"-"` - Value *[]VirtualNetworkPeering `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VirtualNetworkPeeringListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client VirtualNetworkPeeringListResult) VirtualNetworkPeeringListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// VirtualNetworkPeeringPropertiesFormat is -type VirtualNetworkPeeringPropertiesFormat struct { - AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` - AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` - AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` - UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` - RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` - PeeringState VirtualNetworkPeeringState `json:"peeringState,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VirtualNetworkPropertiesFormat is -type VirtualNetworkPropertiesFormat struct { - AddressSpace *AddressSpace `json:"addressSpace,omitempty"` - DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` - Subnets *[]Subnet `json:"subnets,omitempty"` - VirtualNetworkPeerings *[]VirtualNetworkPeering `json:"virtualNetworkPeerings,omitempty"` - ResourceGUID *string `json:"resourceGuid,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VpnClientConfiguration is vpnClientConfiguration for P2S client. -type VpnClientConfiguration struct { - VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` - VpnClientRootCertificates *[]VpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` - VpnClientRevokedCertificates *[]VpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` -} - -// VpnClientParameters is vpn Client Parameters for package generation -type VpnClientParameters struct { - ProcessorArchitecture ProcessorArchitecture `json:"processorArchitecture,omitempty"` -} - -// VpnClientRevokedCertificate is vPN client revoked certificate of virtual -// network gateway. -type VpnClientRevokedCertificate struct { - ID *string `json:"id,omitempty"` - *VpnClientRevokedCertificatePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VpnClientRevokedCertificatePropertiesFormat is properties of the revoked VPN -// client certificate of virtual network gateway. -type VpnClientRevokedCertificatePropertiesFormat struct { - Thumbprint *string `json:"thumbprint,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// VpnClientRootCertificate is vPN client root certificate of virtual network -// gateway -type VpnClientRootCertificate struct { - ID *string `json:"id,omitempty"` - *VpnClientRootCertificatePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// VpnClientRootCertificatePropertiesFormat is properties of SSL certificates -// of application gateway -type VpnClientRootCertificatePropertiesFormat struct { - PublicCertData *string `json:"publicCertData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// Watcher is network watcher in a resource group. -type Watcher struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *WatcherPropertiesFormat `json:"properties,omitempty"` -} - -// WatcherListResult is list of network watcher resources. -type WatcherListResult struct { - autorest.Response `json:"-"` - Value *[]Watcher `json:"value,omitempty"` -} - -// WatcherPropertiesFormat is the network watcher properties. -type WatcherPropertiesFormat struct { - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// Access enumerates the values for access. +type Access string + +const ( + // Allow specifies the allow state for access. + Allow Access = "Allow" + // Deny specifies the deny state for access. + Deny Access = "Deny" +) + +// ApplicationGatewayBackendHealthServerHealth enumerates the values for +// application gateway backend health server health. +type ApplicationGatewayBackendHealthServerHealth string + +const ( + // Down specifies the down state for application gateway backend health + // server health. + Down ApplicationGatewayBackendHealthServerHealth = "Down" + // Draining specifies the draining state for application gateway backend + // health server health. + Draining ApplicationGatewayBackendHealthServerHealth = "Draining" + // Partial specifies the partial state for application gateway backend + // health server health. + Partial ApplicationGatewayBackendHealthServerHealth = "Partial" + // Unknown specifies the unknown state for application gateway backend + // health server health. + Unknown ApplicationGatewayBackendHealthServerHealth = "Unknown" + // Up specifies the up state for application gateway backend health server + // health. + Up ApplicationGatewayBackendHealthServerHealth = "Up" +) + +// ApplicationGatewayCookieBasedAffinity enumerates the values for application +// gateway cookie based affinity. +type ApplicationGatewayCookieBasedAffinity string + +const ( + // Disabled specifies the disabled state for application gateway cookie + // based affinity. + Disabled ApplicationGatewayCookieBasedAffinity = "Disabled" + // Enabled specifies the enabled state for application gateway cookie based + // affinity. + Enabled ApplicationGatewayCookieBasedAffinity = "Enabled" +) + +// ApplicationGatewayFirewallMode enumerates the values for application gateway +// firewall mode. +type ApplicationGatewayFirewallMode string + +const ( + // Detection specifies the detection state for application gateway firewall + // mode. + Detection ApplicationGatewayFirewallMode = "Detection" + // Prevention specifies the prevention state for application gateway + // firewall mode. + Prevention ApplicationGatewayFirewallMode = "Prevention" +) + +// ApplicationGatewayOperationalState enumerates the values for application +// gateway operational state. +type ApplicationGatewayOperationalState string + +const ( + // Running specifies the running state for application gateway operational + // state. + Running ApplicationGatewayOperationalState = "Running" + // Starting specifies the starting state for application gateway + // operational state. + Starting ApplicationGatewayOperationalState = "Starting" + // Stopped specifies the stopped state for application gateway operational + // state. + Stopped ApplicationGatewayOperationalState = "Stopped" + // Stopping specifies the stopping state for application gateway + // operational state. + Stopping ApplicationGatewayOperationalState = "Stopping" +) + +// ApplicationGatewayProtocol enumerates the values for application gateway +// protocol. +type ApplicationGatewayProtocol string + +const ( + // HTTP specifies the http state for application gateway protocol. + HTTP ApplicationGatewayProtocol = "Http" + // HTTPS specifies the https state for application gateway protocol. + HTTPS ApplicationGatewayProtocol = "Https" +) + +// ApplicationGatewayRequestRoutingRuleType enumerates the values for +// application gateway request routing rule type. +type ApplicationGatewayRequestRoutingRuleType string + +const ( + // Basic specifies the basic state for application gateway request routing + // rule type. + Basic ApplicationGatewayRequestRoutingRuleType = "Basic" + // PathBasedRouting specifies the path based routing state for application + // gateway request routing rule type. + PathBasedRouting ApplicationGatewayRequestRoutingRuleType = "PathBasedRouting" +) + +// ApplicationGatewaySkuName enumerates the values for application gateway sku +// name. +type ApplicationGatewaySkuName string + +const ( + // StandardLarge specifies the standard large state for application gateway + // sku name. + StandardLarge ApplicationGatewaySkuName = "Standard_Large" + // StandardMedium specifies the standard medium state for application + // gateway sku name. + StandardMedium ApplicationGatewaySkuName = "Standard_Medium" + // StandardSmall specifies the standard small state for application gateway + // sku name. + StandardSmall ApplicationGatewaySkuName = "Standard_Small" + // WAFLarge specifies the waf large state for application gateway sku name. + WAFLarge ApplicationGatewaySkuName = "WAF_Large" + // WAFMedium specifies the waf medium state for application gateway sku + // name. + WAFMedium ApplicationGatewaySkuName = "WAF_Medium" +) + +// ApplicationGatewaySslProtocol enumerates the values for application gateway +// ssl protocol. +type ApplicationGatewaySslProtocol string + +const ( + // TLSv10 specifies the tl sv 10 state for application gateway ssl + // protocol. + TLSv10 ApplicationGatewaySslProtocol = "TLSv1_0" + // TLSv11 specifies the tl sv 11 state for application gateway ssl + // protocol. + TLSv11 ApplicationGatewaySslProtocol = "TLSv1_1" + // TLSv12 specifies the tl sv 12 state for application gateway ssl + // protocol. + TLSv12 ApplicationGatewaySslProtocol = "TLSv1_2" +) + +// ApplicationGatewayTier enumerates the values for application gateway tier. +type ApplicationGatewayTier string + +const ( + // Standard specifies the standard state for application gateway tier. + Standard ApplicationGatewayTier = "Standard" + // WAF specifies the waf state for application gateway tier. + WAF ApplicationGatewayTier = "WAF" +) + +// AssociationType enumerates the values for association type. +type AssociationType string + +const ( + // Associated specifies the associated state for association type. + Associated AssociationType = "Associated" + // Contains specifies the contains state for association type. + Contains AssociationType = "Contains" +) + +// AuthorizationUseStatus enumerates the values for authorization use status. +type AuthorizationUseStatus string + +const ( + // Available specifies the available state for authorization use status. + Available AuthorizationUseStatus = "Available" + // InUse specifies the in use state for authorization use status. + InUse AuthorizationUseStatus = "InUse" +) + +// BgpPeerState enumerates the values for bgp peer state. +type BgpPeerState string + +const ( + // BgpPeerStateConnected specifies the bgp peer state connected state for + // bgp peer state. + BgpPeerStateConnected BgpPeerState = "Connected" + // BgpPeerStateConnecting specifies the bgp peer state connecting state for + // bgp peer state. + BgpPeerStateConnecting BgpPeerState = "Connecting" + // BgpPeerStateIdle specifies the bgp peer state idle state for bgp peer + // state. + BgpPeerStateIdle BgpPeerState = "Idle" + // BgpPeerStateStopped specifies the bgp peer state stopped state for bgp + // peer state. + BgpPeerStateStopped BgpPeerState = "Stopped" + // BgpPeerStateUnknown specifies the bgp peer state unknown state for bgp + // peer state. + BgpPeerStateUnknown BgpPeerState = "Unknown" +) + +// DhGroup enumerates the values for dh group. +type DhGroup string + +const ( + // DHGroup1 specifies the dh group 1 state for dh group. + DHGroup1 DhGroup = "DHGroup1" + // DHGroup14 specifies the dh group 14 state for dh group. + DHGroup14 DhGroup = "DHGroup14" + // DHGroup2 specifies the dh group 2 state for dh group. + DHGroup2 DhGroup = "DHGroup2" + // DHGroup2048 specifies the dh group 2048 state for dh group. + DHGroup2048 DhGroup = "DHGroup2048" + // DHGroup24 specifies the dh group 24 state for dh group. + DHGroup24 DhGroup = "DHGroup24" + // ECP256 specifies the ecp256 state for dh group. + ECP256 DhGroup = "ECP256" + // ECP384 specifies the ecp384 state for dh group. + ECP384 DhGroup = "ECP384" + // None specifies the none state for dh group. + None DhGroup = "None" +) + +// Direction enumerates the values for direction. +type Direction string + +const ( + // Inbound specifies the inbound state for direction. + Inbound Direction = "Inbound" + // Outbound specifies the outbound state for direction. + Outbound Direction = "Outbound" +) + +// EffectiveRouteSource enumerates the values for effective route source. +type EffectiveRouteSource string + +const ( + // EffectiveRouteSourceDefault specifies the effective route source default + // state for effective route source. + EffectiveRouteSourceDefault EffectiveRouteSource = "Default" + // EffectiveRouteSourceUnknown specifies the effective route source unknown + // state for effective route source. + EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown" + // EffectiveRouteSourceUser specifies the effective route source user state + // for effective route source. + EffectiveRouteSourceUser EffectiveRouteSource = "User" + // EffectiveRouteSourceVirtualNetworkGateway specifies the effective route + // source virtual network gateway state for effective route source. + EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway" +) + +// EffectiveRouteState enumerates the values for effective route state. +type EffectiveRouteState string + +const ( + // Active specifies the active state for effective route state. + Active EffectiveRouteState = "Active" + // Invalid specifies the invalid state for effective route state. + Invalid EffectiveRouteState = "Invalid" +) + +// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values +// for express route circuit peering advertised public prefix state. +type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string + +const ( + // Configured specifies the configured state for express route circuit + // peering advertised public prefix state. + Configured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configured" + // Configuring specifies the configuring state for express route circuit + // peering advertised public prefix state. + Configuring ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configuring" + // NotConfigured specifies the not configured state for express route + // circuit peering advertised public prefix state. + NotConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "NotConfigured" + // ValidationNeeded specifies the validation needed state for express route + // circuit peering advertised public prefix state. + ValidationNeeded ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "ValidationNeeded" +) + +// ExpressRouteCircuitPeeringState enumerates the values for express route +// circuit peering state. +type ExpressRouteCircuitPeeringState string + +const ( + // ExpressRouteCircuitPeeringStateDisabled specifies the express route + // circuit peering state disabled state for express route circuit peering + // state. + ExpressRouteCircuitPeeringStateDisabled ExpressRouteCircuitPeeringState = "Disabled" + // ExpressRouteCircuitPeeringStateEnabled specifies the express route + // circuit peering state enabled state for express route circuit peering + // state. + ExpressRouteCircuitPeeringStateEnabled ExpressRouteCircuitPeeringState = "Enabled" +) + +// ExpressRouteCircuitPeeringType enumerates the values for express route +// circuit peering type. +type ExpressRouteCircuitPeeringType string + +const ( + // AzurePrivatePeering specifies the azure private peering state for + // express route circuit peering type. + AzurePrivatePeering ExpressRouteCircuitPeeringType = "AzurePrivatePeering" + // AzurePublicPeering specifies the azure public peering state for express + // route circuit peering type. + AzurePublicPeering ExpressRouteCircuitPeeringType = "AzurePublicPeering" + // MicrosoftPeering specifies the microsoft peering state for express route + // circuit peering type. + MicrosoftPeering ExpressRouteCircuitPeeringType = "MicrosoftPeering" +) + +// ExpressRouteCircuitSkuFamily enumerates the values for express route circuit +// sku family. +type ExpressRouteCircuitSkuFamily string + +const ( + // MeteredData specifies the metered data state for express route circuit + // sku family. + MeteredData ExpressRouteCircuitSkuFamily = "MeteredData" + // UnlimitedData specifies the unlimited data state for express route + // circuit sku family. + UnlimitedData ExpressRouteCircuitSkuFamily = "UnlimitedData" +) + +// ExpressRouteCircuitSkuTier enumerates the values for express route circuit +// sku tier. +type ExpressRouteCircuitSkuTier string + +const ( + // ExpressRouteCircuitSkuTierPremium specifies the express route circuit + // sku tier premium state for express route circuit sku tier. + ExpressRouteCircuitSkuTierPremium ExpressRouteCircuitSkuTier = "Premium" + // ExpressRouteCircuitSkuTierStandard specifies the express route circuit + // sku tier standard state for express route circuit sku tier. + ExpressRouteCircuitSkuTierStandard ExpressRouteCircuitSkuTier = "Standard" +) + +// IkeEncryption enumerates the values for ike encryption. +type IkeEncryption string + +const ( + // AES128 specifies the aes128 state for ike encryption. + AES128 IkeEncryption = "AES128" + // AES192 specifies the aes192 state for ike encryption. + AES192 IkeEncryption = "AES192" + // AES256 specifies the aes256 state for ike encryption. + AES256 IkeEncryption = "AES256" + // DES specifies the des state for ike encryption. + DES IkeEncryption = "DES" + // DES3 specifies the des3 state for ike encryption. + DES3 IkeEncryption = "DES3" +) + +// IkeIntegrity enumerates the values for ike integrity. +type IkeIntegrity string + +const ( + // MD5 specifies the md5 state for ike integrity. + MD5 IkeIntegrity = "MD5" + // SHA1 specifies the sha1 state for ike integrity. + SHA1 IkeIntegrity = "SHA1" + // SHA256 specifies the sha256 state for ike integrity. + SHA256 IkeIntegrity = "SHA256" + // SHA384 specifies the sha384 state for ike integrity. + SHA384 IkeIntegrity = "SHA384" +) + +// IPAllocationMethod enumerates the values for ip allocation method. +type IPAllocationMethod string + +const ( + // Dynamic specifies the dynamic state for ip allocation method. + Dynamic IPAllocationMethod = "Dynamic" + // Static specifies the static state for ip allocation method. + Static IPAllocationMethod = "Static" +) + +// IpsecEncryption enumerates the values for ipsec encryption. +type IpsecEncryption string + +const ( + // IpsecEncryptionAES128 specifies the ipsec encryption aes128 state for + // ipsec encryption. + IpsecEncryptionAES128 IpsecEncryption = "AES128" + // IpsecEncryptionAES192 specifies the ipsec encryption aes192 state for + // ipsec encryption. + IpsecEncryptionAES192 IpsecEncryption = "AES192" + // IpsecEncryptionAES256 specifies the ipsec encryption aes256 state for + // ipsec encryption. + IpsecEncryptionAES256 IpsecEncryption = "AES256" + // IpsecEncryptionDES specifies the ipsec encryption des state for ipsec + // encryption. + IpsecEncryptionDES IpsecEncryption = "DES" + // IpsecEncryptionDES3 specifies the ipsec encryption des3 state for ipsec + // encryption. + IpsecEncryptionDES3 IpsecEncryption = "DES3" + // IpsecEncryptionGCMAES128 specifies the ipsec encryption gcmaes128 state + // for ipsec encryption. + IpsecEncryptionGCMAES128 IpsecEncryption = "GCMAES128" + // IpsecEncryptionGCMAES192 specifies the ipsec encryption gcmaes192 state + // for ipsec encryption. + IpsecEncryptionGCMAES192 IpsecEncryption = "GCMAES192" + // IpsecEncryptionGCMAES256 specifies the ipsec encryption gcmaes256 state + // for ipsec encryption. + IpsecEncryptionGCMAES256 IpsecEncryption = "GCMAES256" + // IpsecEncryptionNone specifies the ipsec encryption none state for ipsec + // encryption. + IpsecEncryptionNone IpsecEncryption = "None" +) + +// IpsecIntegrity enumerates the values for ipsec integrity. +type IpsecIntegrity string + +const ( + // IpsecIntegrityGCMAES128 specifies the ipsec integrity gcmaes128 state + // for ipsec integrity. + IpsecIntegrityGCMAES128 IpsecIntegrity = "GCMAES128" + // IpsecIntegrityGCMAES192 specifies the ipsec integrity gcmaes192 state + // for ipsec integrity. + IpsecIntegrityGCMAES192 IpsecIntegrity = "GCMAES192" + // IpsecIntegrityGCMAES256 specifies the ipsec integrity gcmaes256 state + // for ipsec integrity. + IpsecIntegrityGCMAES256 IpsecIntegrity = "GCMAES256" + // IpsecIntegrityMD5 specifies the ipsec integrity md5 state for ipsec + // integrity. + IpsecIntegrityMD5 IpsecIntegrity = "MD5" + // IpsecIntegritySHA1 specifies the ipsec integrity sha1 state for ipsec + // integrity. + IpsecIntegritySHA1 IpsecIntegrity = "SHA1" + // IpsecIntegritySHA256 specifies the ipsec integrity sha256 state for + // ipsec integrity. + IpsecIntegritySHA256 IpsecIntegrity = "SHA256" +) + +// IPVersion enumerates the values for ip version. +type IPVersion string + +const ( + // IPv4 specifies the i pv 4 state for ip version. + IPv4 IPVersion = "IPv4" + // IPv6 specifies the i pv 6 state for ip version. + IPv6 IPVersion = "IPv6" +) + +// LoadDistribution enumerates the values for load distribution. +type LoadDistribution string + +const ( + // Default specifies the default state for load distribution. + Default LoadDistribution = "Default" + // SourceIP specifies the source ip state for load distribution. + SourceIP LoadDistribution = "SourceIP" + // SourceIPProtocol specifies the source ip protocol state for load + // distribution. + SourceIPProtocol LoadDistribution = "SourceIPProtocol" +) + +// NextHopType enumerates the values for next hop type. +type NextHopType string + +const ( + // NextHopTypeHyperNetGateway specifies the next hop type hyper net gateway + // state for next hop type. + NextHopTypeHyperNetGateway NextHopType = "HyperNetGateway" + // NextHopTypeInternet specifies the next hop type internet state for next + // hop type. + NextHopTypeInternet NextHopType = "Internet" + // NextHopTypeNone specifies the next hop type none state for next hop + // type. + NextHopTypeNone NextHopType = "None" + // NextHopTypeVirtualAppliance specifies the next hop type virtual + // appliance state for next hop type. + NextHopTypeVirtualAppliance NextHopType = "VirtualAppliance" + // NextHopTypeVirtualNetworkGateway specifies the next hop type virtual + // network gateway state for next hop type. + NextHopTypeVirtualNetworkGateway NextHopType = "VirtualNetworkGateway" + // NextHopTypeVnetLocal specifies the next hop type vnet local state for + // next hop type. + NextHopTypeVnetLocal NextHopType = "VnetLocal" +) + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // Failed specifies the failed state for operation status. + Failed OperationStatus = "Failed" + // InProgress specifies the in progress state for operation status. + InProgress OperationStatus = "InProgress" + // Succeeded specifies the succeeded state for operation status. + Succeeded OperationStatus = "Succeeded" +) + +// PcError enumerates the values for pc error. +type PcError string + +const ( + // AgentStopped specifies the agent stopped state for pc error. + AgentStopped PcError = "AgentStopped" + // CaptureFailed specifies the capture failed state for pc error. + CaptureFailed PcError = "CaptureFailed" + // InternalError specifies the internal error state for pc error. + InternalError PcError = "InternalError" + // LocalFileFailed specifies the local file failed state for pc error. + LocalFileFailed PcError = "LocalFileFailed" + // StorageFailed specifies the storage failed state for pc error. + StorageFailed PcError = "StorageFailed" +) + +// PcProtocol enumerates the values for pc protocol. +type PcProtocol string + +const ( + // Any specifies the any state for pc protocol. + Any PcProtocol = "Any" + // TCP specifies the tcp state for pc protocol. + TCP PcProtocol = "TCP" + // UDP specifies the udp state for pc protocol. + UDP PcProtocol = "UDP" +) + +// PcStatus enumerates the values for pc status. +type PcStatus string + +const ( + // PcStatusError specifies the pc status error state for pc status. + PcStatusError PcStatus = "Error" + // PcStatusNotStarted specifies the pc status not started state for pc + // status. + PcStatusNotStarted PcStatus = "NotStarted" + // PcStatusRunning specifies the pc status running state for pc status. + PcStatusRunning PcStatus = "Running" + // PcStatusStopped specifies the pc status stopped state for pc status. + PcStatusStopped PcStatus = "Stopped" + // PcStatusUnknown specifies the pc status unknown state for pc status. + PcStatusUnknown PcStatus = "Unknown" +) + +// PfsGroup enumerates the values for pfs group. +type PfsGroup string + +const ( + // PfsGroupECP256 specifies the pfs group ecp256 state for pfs group. + PfsGroupECP256 PfsGroup = "ECP256" + // PfsGroupECP384 specifies the pfs group ecp384 state for pfs group. + PfsGroupECP384 PfsGroup = "ECP384" + // PfsGroupNone specifies the pfs group none state for pfs group. + PfsGroupNone PfsGroup = "None" + // PfsGroupPFS1 specifies the pfs group pfs1 state for pfs group. + PfsGroupPFS1 PfsGroup = "PFS1" + // PfsGroupPFS2 specifies the pfs group pfs2 state for pfs group. + PfsGroupPFS2 PfsGroup = "PFS2" + // PfsGroupPFS2048 specifies the pfs group pfs2048 state for pfs group. + PfsGroupPFS2048 PfsGroup = "PFS2048" + // PfsGroupPFS24 specifies the pfs group pfs24 state for pfs group. + PfsGroupPFS24 PfsGroup = "PFS24" +) + +// ProbeProtocol enumerates the values for probe protocol. +type ProbeProtocol string + +const ( + // ProbeProtocolHTTP specifies the probe protocol http state for probe + // protocol. + ProbeProtocolHTTP ProbeProtocol = "Http" + // ProbeProtocolTCP specifies the probe protocol tcp state for probe + // protocol. + ProbeProtocolTCP ProbeProtocol = "Tcp" +) + +// ProcessorArchitecture enumerates the values for processor architecture. +type ProcessorArchitecture string + +const ( + // Amd64 specifies the amd 64 state for processor architecture. + Amd64 ProcessorArchitecture = "Amd64" + // X86 specifies the x86 state for processor architecture. + X86 ProcessorArchitecture = "X86" +) + +// Protocol enumerates the values for protocol. +type Protocol string + +const ( + // ProtocolTCP specifies the protocol tcp state for protocol. + ProtocolTCP Protocol = "TCP" + // ProtocolUDP specifies the protocol udp state for protocol. + ProtocolUDP Protocol = "UDP" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateDeleting specifies the provisioning state deleting + // state for provisioning state. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed specifies the provisioning state failed state + // for provisioning state. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded specifies the provisioning state succeeded + // state for provisioning state. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating specifies the provisioning state updating + // state for provisioning state. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// RouteNextHopType enumerates the values for route next hop type. +type RouteNextHopType string + +const ( + // RouteNextHopTypeInternet specifies the route next hop type internet + // state for route next hop type. + RouteNextHopTypeInternet RouteNextHopType = "Internet" + // RouteNextHopTypeNone specifies the route next hop type none state for + // route next hop type. + RouteNextHopTypeNone RouteNextHopType = "None" + // RouteNextHopTypeVirtualAppliance specifies the route next hop type + // virtual appliance state for route next hop type. + RouteNextHopTypeVirtualAppliance RouteNextHopType = "VirtualAppliance" + // RouteNextHopTypeVirtualNetworkGateway specifies the route next hop type + // virtual network gateway state for route next hop type. + RouteNextHopTypeVirtualNetworkGateway RouteNextHopType = "VirtualNetworkGateway" + // RouteNextHopTypeVnetLocal specifies the route next hop type vnet local + // state for route next hop type. + RouteNextHopTypeVnetLocal RouteNextHopType = "VnetLocal" +) + +// SecurityRuleAccess enumerates the values for security rule access. +type SecurityRuleAccess string + +const ( + // SecurityRuleAccessAllow specifies the security rule access allow state + // for security rule access. + SecurityRuleAccessAllow SecurityRuleAccess = "Allow" + // SecurityRuleAccessDeny specifies the security rule access deny state for + // security rule access. + SecurityRuleAccessDeny SecurityRuleAccess = "Deny" +) + +// SecurityRuleDirection enumerates the values for security rule direction. +type SecurityRuleDirection string + +const ( + // SecurityRuleDirectionInbound specifies the security rule direction + // inbound state for security rule direction. + SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" + // SecurityRuleDirectionOutbound specifies the security rule direction + // outbound state for security rule direction. + SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" +) + +// SecurityRuleProtocol enumerates the values for security rule protocol. +type SecurityRuleProtocol string + +const ( + // SecurityRuleProtocolAsterisk specifies the security rule protocol + // asterisk state for security rule protocol. + SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" + // SecurityRuleProtocolTCP specifies the security rule protocol tcp state + // for security rule protocol. + SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" + // SecurityRuleProtocolUDP specifies the security rule protocol udp state + // for security rule protocol. + SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" +) + +// ServiceProviderProvisioningState enumerates the values for service provider +// provisioning state. +type ServiceProviderProvisioningState string + +const ( + // Deprovisioning specifies the deprovisioning state for service provider + // provisioning state. + Deprovisioning ServiceProviderProvisioningState = "Deprovisioning" + // NotProvisioned specifies the not provisioned state for service provider + // provisioning state. + NotProvisioned ServiceProviderProvisioningState = "NotProvisioned" + // Provisioned specifies the provisioned state for service provider + // provisioning state. + Provisioned ServiceProviderProvisioningState = "Provisioned" + // Provisioning specifies the provisioning state for service provider + // provisioning state. + Provisioning ServiceProviderProvisioningState = "Provisioning" +) + +// TransportProtocol enumerates the values for transport protocol. +type TransportProtocol string + +const ( + // TransportProtocolTCP specifies the transport protocol tcp state for + // transport protocol. + TransportProtocolTCP TransportProtocol = "Tcp" + // TransportProtocolUDP specifies the transport protocol udp state for + // transport protocol. + TransportProtocolUDP TransportProtocol = "Udp" +) + +// VirtualNetworkGatewayConnectionStatus enumerates the values for virtual +// network gateway connection status. +type VirtualNetworkGatewayConnectionStatus string + +const ( + // VirtualNetworkGatewayConnectionStatusConnected specifies the virtual + // network gateway connection status connected state for virtual network + // gateway connection status. + VirtualNetworkGatewayConnectionStatusConnected VirtualNetworkGatewayConnectionStatus = "Connected" + // VirtualNetworkGatewayConnectionStatusConnecting specifies the virtual + // network gateway connection status connecting state for virtual network + // gateway connection status. + VirtualNetworkGatewayConnectionStatusConnecting VirtualNetworkGatewayConnectionStatus = "Connecting" + // VirtualNetworkGatewayConnectionStatusNotConnected specifies the virtual + // network gateway connection status not connected state for virtual + // network gateway connection status. + VirtualNetworkGatewayConnectionStatusNotConnected VirtualNetworkGatewayConnectionStatus = "NotConnected" + // VirtualNetworkGatewayConnectionStatusUnknown specifies the virtual + // network gateway connection status unknown state for virtual network + // gateway connection status. + VirtualNetworkGatewayConnectionStatusUnknown VirtualNetworkGatewayConnectionStatus = "Unknown" +) + +// VirtualNetworkGatewayConnectionType enumerates the values for virtual +// network gateway connection type. +type VirtualNetworkGatewayConnectionType string + +const ( + // ExpressRoute specifies the express route state for virtual network + // gateway connection type. + ExpressRoute VirtualNetworkGatewayConnectionType = "ExpressRoute" + // IPsec specifies the i psec state for virtual network gateway connection + // type. + IPsec VirtualNetworkGatewayConnectionType = "IPsec" + // Vnet2Vnet specifies the vnet 2 vnet state for virtual network gateway + // connection type. + Vnet2Vnet VirtualNetworkGatewayConnectionType = "Vnet2Vnet" + // VPNClient specifies the vpn client state for virtual network gateway + // connection type. + VPNClient VirtualNetworkGatewayConnectionType = "VPNClient" +) + +// VirtualNetworkGatewaySkuName enumerates the values for virtual network +// gateway sku name. +type VirtualNetworkGatewaySkuName string + +const ( + // VirtualNetworkGatewaySkuNameBasic specifies the virtual network gateway + // sku name basic state for virtual network gateway sku name. + VirtualNetworkGatewaySkuNameBasic VirtualNetworkGatewaySkuName = "Basic" + // VirtualNetworkGatewaySkuNameHighPerformance specifies the virtual + // network gateway sku name high performance state for virtual network + // gateway sku name. + VirtualNetworkGatewaySkuNameHighPerformance VirtualNetworkGatewaySkuName = "HighPerformance" + // VirtualNetworkGatewaySkuNameStandard specifies the virtual network + // gateway sku name standard state for virtual network gateway sku name. + VirtualNetworkGatewaySkuNameStandard VirtualNetworkGatewaySkuName = "Standard" + // VirtualNetworkGatewaySkuNameUltraPerformance specifies the virtual + // network gateway sku name ultra performance state for virtual network + // gateway sku name. + VirtualNetworkGatewaySkuNameUltraPerformance VirtualNetworkGatewaySkuName = "UltraPerformance" + // VirtualNetworkGatewaySkuNameVpnGw1 specifies the virtual network gateway + // sku name vpn gw 1 state for virtual network gateway sku name. + VirtualNetworkGatewaySkuNameVpnGw1 VirtualNetworkGatewaySkuName = "VpnGw1" + // VirtualNetworkGatewaySkuNameVpnGw2 specifies the virtual network gateway + // sku name vpn gw 2 state for virtual network gateway sku name. + VirtualNetworkGatewaySkuNameVpnGw2 VirtualNetworkGatewaySkuName = "VpnGw2" + // VirtualNetworkGatewaySkuNameVpnGw3 specifies the virtual network gateway + // sku name vpn gw 3 state for virtual network gateway sku name. + VirtualNetworkGatewaySkuNameVpnGw3 VirtualNetworkGatewaySkuName = "VpnGw3" +) + +// VirtualNetworkGatewaySkuTier enumerates the values for virtual network +// gateway sku tier. +type VirtualNetworkGatewaySkuTier string + +const ( + // VirtualNetworkGatewaySkuTierBasic specifies the virtual network gateway + // sku tier basic state for virtual network gateway sku tier. + VirtualNetworkGatewaySkuTierBasic VirtualNetworkGatewaySkuTier = "Basic" + // VirtualNetworkGatewaySkuTierHighPerformance specifies the virtual + // network gateway sku tier high performance state for virtual network + // gateway sku tier. + VirtualNetworkGatewaySkuTierHighPerformance VirtualNetworkGatewaySkuTier = "HighPerformance" + // VirtualNetworkGatewaySkuTierStandard specifies the virtual network + // gateway sku tier standard state for virtual network gateway sku tier. + VirtualNetworkGatewaySkuTierStandard VirtualNetworkGatewaySkuTier = "Standard" + // VirtualNetworkGatewaySkuTierUltraPerformance specifies the virtual + // network gateway sku tier ultra performance state for virtual network + // gateway sku tier. + VirtualNetworkGatewaySkuTierUltraPerformance VirtualNetworkGatewaySkuTier = "UltraPerformance" + // VirtualNetworkGatewaySkuTierVpnGw1 specifies the virtual network gateway + // sku tier vpn gw 1 state for virtual network gateway sku tier. + VirtualNetworkGatewaySkuTierVpnGw1 VirtualNetworkGatewaySkuTier = "VpnGw1" + // VirtualNetworkGatewaySkuTierVpnGw2 specifies the virtual network gateway + // sku tier vpn gw 2 state for virtual network gateway sku tier. + VirtualNetworkGatewaySkuTierVpnGw2 VirtualNetworkGatewaySkuTier = "VpnGw2" + // VirtualNetworkGatewaySkuTierVpnGw3 specifies the virtual network gateway + // sku tier vpn gw 3 state for virtual network gateway sku tier. + VirtualNetworkGatewaySkuTierVpnGw3 VirtualNetworkGatewaySkuTier = "VpnGw3" +) + +// VirtualNetworkGatewayType enumerates the values for virtual network gateway +// type. +type VirtualNetworkGatewayType string + +const ( + // VirtualNetworkGatewayTypeExpressRoute specifies the virtual network + // gateway type express route state for virtual network gateway type. + VirtualNetworkGatewayTypeExpressRoute VirtualNetworkGatewayType = "ExpressRoute" + // VirtualNetworkGatewayTypeVpn specifies the virtual network gateway type + // vpn state for virtual network gateway type. + VirtualNetworkGatewayTypeVpn VirtualNetworkGatewayType = "Vpn" +) + +// VirtualNetworkPeeringState enumerates the values for virtual network peering +// state. +type VirtualNetworkPeeringState string + +const ( + // Connected specifies the connected state for virtual network peering + // state. + Connected VirtualNetworkPeeringState = "Connected" + // Disconnected specifies the disconnected state for virtual network + // peering state. + Disconnected VirtualNetworkPeeringState = "Disconnected" + // Initiated specifies the initiated state for virtual network peering + // state. + Initiated VirtualNetworkPeeringState = "Initiated" +) + +// VpnType enumerates the values for vpn type. +type VpnType string + +const ( + // PolicyBased specifies the policy based state for vpn type. + PolicyBased VpnType = "PolicyBased" + // RouteBased specifies the route based state for vpn type. + RouteBased VpnType = "RouteBased" +) + +// AddressSpace is addressSpace contains an array of IP address ranges that can +// be used by subnets of the virtual network. +type AddressSpace struct { + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` +} + +// ApplicationGateway is application gateway resource +type ApplicationGateway struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayAuthenticationCertificate is authentication certificates +// of an application gateway. +type ApplicationGatewayAuthenticationCertificate struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayAuthenticationCertificatePropertiesFormat is +// authentication certificates properties of an application gateway. +type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { + Data *string `json:"data,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayAvailableWafRuleSetsResult is response for +// ApplicationGatewayAvailableWafRuleSets API service call. +type ApplicationGatewayAvailableWafRuleSetsResult struct { + autorest.Response `json:"-"` + Value *[]ApplicationGatewayFirewallRuleSet `json:"value,omitempty"` +} + +// ApplicationGatewayBackendAddress is backend address of an application +// gateway. +type ApplicationGatewayBackendAddress struct { + Fqdn *string `json:"fqdn,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` +} + +// ApplicationGatewayBackendAddressPool is backend Address Pool of an +// application gateway. +type ApplicationGatewayBackendAddressPool struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayBackendAddressPoolPropertiesFormat is properties of +// Backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { + BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` + BackendAddresses *[]ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayBackendHealth is list of +// ApplicationGatewayBackendHealthPool resources. +type ApplicationGatewayBackendHealth struct { + autorest.Response `json:"-"` + BackendAddressPools *[]ApplicationGatewayBackendHealthPool `json:"backendAddressPools,omitempty"` +} + +// ApplicationGatewayBackendHealthHTTPSettings is application gateway +// BackendHealthHttp settings. +type ApplicationGatewayBackendHealthHTTPSettings struct { + BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettings,omitempty"` + Servers *[]ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` +} + +// ApplicationGatewayBackendHealthPool is application gateway BackendHealth +// pool. +type ApplicationGatewayBackendHealthPool struct { + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHealthHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` +} + +// ApplicationGatewayBackendHealthServer is application gateway backendhealth +// http settings. +type ApplicationGatewayBackendHealthServer struct { + Address *string `json:"address,omitempty"` + IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` + Health ApplicationGatewayBackendHealthServerHealth `json:"health,omitempty"` +} + +// ApplicationGatewayBackendHTTPSettings is backend address pool settings of an +// application gateway. +type ApplicationGatewayBackendHTTPSettings struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayBackendHTTPSettingsPropertiesFormat is properties of +// Backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { + Port *int32 `json:"port,omitempty"` + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` + RequestTimeout *int32 `json:"requestTimeout,omitempty"` + Probe *SubResource `json:"probe,omitempty"` + AuthenticationCertificates *[]SubResource `json:"authenticationCertificates,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ConnectionDraining *ApplicationGatewayConnectionDraining `json:"connectionDraining,omitempty"` +} + +// ApplicationGatewayConnectionDraining is connection draining allows open +// connections to a backend server to be active for a specified time after the +// backend server got removed from the configuration. +type ApplicationGatewayConnectionDraining struct { + Enabled *bool `json:"enabled,omitempty"` + DrainTimeoutInSec *int32 `json:"drainTimeoutInSec,omitempty"` +} + +// ApplicationGatewayFirewallDisabledRuleGroup is allows to disable rules +// within a rule group or an entire rule group. +type ApplicationGatewayFirewallDisabledRuleGroup struct { + RuleGroupName *string `json:"ruleGroupName,omitempty"` + Rules *[]int32 `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallRule is a web application firewall rule. +type ApplicationGatewayFirewallRule struct { + RuleID *int32 `json:"ruleId,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ApplicationGatewayFirewallRuleGroup is a web application firewall rule +// group. +type ApplicationGatewayFirewallRuleGroup struct { + RuleGroupName *string `json:"ruleGroupName,omitempty"` + Description *string `json:"description,omitempty"` + Rules *[]ApplicationGatewayFirewallRule `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallRuleSet is a web application firewall rule set. +type ApplicationGatewayFirewallRuleSet struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ApplicationGatewayFirewallRuleSetPropertiesFormat `json:"properties,omitempty"` +} + +// ApplicationGatewayFirewallRuleSetPropertiesFormat is properties of the web +// application firewall rule set. +type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + RuleSetType *string `json:"ruleSetType,omitempty"` + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` +} + +// ApplicationGatewayFrontendIPConfiguration is frontend IP configuration of an +// application gateway. +type ApplicationGatewayFrontendIPConfiguration struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayFrontendIPConfigurationPropertiesFormat is properties of +// Frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayFrontendPort is frontend port of an application gateway. +type ApplicationGatewayFrontendPort struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayFrontendPortPropertiesFormat is properties of Frontend +// port of an application gateway. +type ApplicationGatewayFrontendPortPropertiesFormat struct { + Port *int32 `json:"port,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayHTTPListener is http listener of an application gateway. +type ApplicationGatewayHTTPListener struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayHTTPListenerPropertiesFormat is properties of HTTP +// listener of an application gateway. +type ApplicationGatewayHTTPListenerPropertiesFormat struct { + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + FrontendPort *SubResource `json:"frontendPort,omitempty"` + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + HostName *string `json:"hostName,omitempty"` + SslCertificate *SubResource `json:"sslCertificate,omitempty"` + RequireServerNameIndication *bool `json:"requireServerNameIndication,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayIPConfiguration is iP configuration of an application +// gateway. Currently 1 public and 1 private IP configuration is allowed. +type ApplicationGatewayIPConfiguration struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayIPConfigurationPropertiesFormat is properties of IP +// configuration of an application gateway. +type ApplicationGatewayIPConfigurationPropertiesFormat struct { + Subnet *SubResource `json:"subnet,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayListResult is response for ListApplicationGateways API +// service call. +type ApplicationGatewayListResult struct { + autorest.Response `json:"-"` + Value *[]ApplicationGateway `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ApplicationGatewayListResult) ApplicationGatewayListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ApplicationGatewayPathRule is path rule of URL path map of an application +// gateway. +type ApplicationGatewayPathRule struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayPathRulePropertiesFormat is properties of probe of an +// application gateway. +type ApplicationGatewayPathRulePropertiesFormat struct { + Paths *[]string `json:"paths,omitempty"` + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayProbe is probe of the application gateway. +type ApplicationGatewayProbe struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayProbePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayProbePropertiesFormat is properties of probe of an +// application gateway. +type ApplicationGatewayProbePropertiesFormat struct { + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + Host *string `json:"host,omitempty"` + Path *string `json:"path,omitempty"` + Interval *int32 `json:"interval,omitempty"` + Timeout *int32 `json:"timeout,omitempty"` + UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayPropertiesFormat is properties of the application gateway. +type ApplicationGatewayPropertiesFormat struct { + Sku *ApplicationGatewaySku `json:"sku,omitempty"` + SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` + OperationalState ApplicationGatewayOperationalState `json:"operationalState,omitempty"` + GatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` + AuthenticationCertificates *[]ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"` + SslCertificates *[]ApplicationGatewaySslCertificate `json:"sslCertificates,omitempty"` + FrontendIPConfigurations *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + FrontendPorts *[]ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` + Probes *[]ApplicationGatewayProbe `json:"probes,omitempty"` + BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` + BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` + HTTPListeners *[]ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` + URLPathMaps *[]ApplicationGatewayURLPathMap `json:"urlPathMaps,omitempty"` + RequestRoutingRules *[]ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` + WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayRequestRoutingRule is request routing rule of an +// application gateway. +type ApplicationGatewayRequestRoutingRule struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayRequestRoutingRulePropertiesFormat is properties of +// request routing rule of the application gateway. +type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { + RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + HTTPListener *SubResource `json:"httpListener,omitempty"` + URLPathMap *SubResource `json:"urlPathMap,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewaySku is sKU of an application gateway +type ApplicationGatewaySku struct { + Name ApplicationGatewaySkuName `json:"name,omitempty"` + Tier ApplicationGatewayTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// ApplicationGatewaySslCertificate is sSL certificates of an application +// gateway. +type ApplicationGatewaySslCertificate struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewaySslCertificatePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewaySslCertificatePropertiesFormat is properties of SSL +// certificates of an application gateway. +type ApplicationGatewaySslCertificatePropertiesFormat struct { + Data *string `json:"data,omitempty"` + Password *string `json:"password,omitempty"` + PublicCertData *string `json:"publicCertData,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewaySslPolicy is application gateway SSL policy. +type ApplicationGatewaySslPolicy struct { + DisabledSslProtocols *[]ApplicationGatewaySslProtocol `json:"disabledSslProtocols,omitempty"` +} + +// ApplicationGatewayURLPathMap is urlPathMaps give a url path to the backend +// mapping information for PathBasedRouting. +type ApplicationGatewayURLPathMap struct { + ID *string `json:"id,omitempty"` + *ApplicationGatewayURLPathMapPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ApplicationGatewayURLPathMapPropertiesFormat is properties of UrlPathMap of +// the application gateway. +type ApplicationGatewayURLPathMapPropertiesFormat struct { + DefaultBackendAddressPool *SubResource `json:"defaultBackendAddressPool,omitempty"` + DefaultBackendHTTPSettings *SubResource `json:"defaultBackendHttpSettings,omitempty"` + PathRules *[]ApplicationGatewayPathRule `json:"pathRules,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// ApplicationGatewayWebApplicationFirewallConfiguration is application gateway +// web application firewall configuration. +type ApplicationGatewayWebApplicationFirewallConfiguration struct { + Enabled *bool `json:"enabled,omitempty"` + FirewallMode ApplicationGatewayFirewallMode `json:"firewallMode,omitempty"` + RuleSetType *string `json:"ruleSetType,omitempty"` + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + DisabledRuleGroups *[]ApplicationGatewayFirewallDisabledRuleGroup `json:"disabledRuleGroups,omitempty"` +} + +// AuthorizationListResult is response for ListAuthorizations API service call +// retrieves all authorizations that belongs to an ExpressRouteCircuit. +type AuthorizationListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteCircuitAuthorization `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AuthorizationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AuthorizationListResult) AuthorizationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AuthorizationPropertiesFormat is +type AuthorizationPropertiesFormat struct { + AuthorizationKey *string `json:"authorizationKey,omitempty"` + AuthorizationUseStatus AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// AzureAsyncOperationResult is the response body contains the status of the +// specified asynchronous operation, indicating whether it has succeeded, is in +// progress, or has failed. Note that this status is distinct from the HTTP +// status code returned for the Get Operation Status operation itself. If the +// asynchronous operation succeeded, the response body includes the HTTP status +// code for the successful request. If the asynchronous operation failed, the +// response body includes the HTTP status code for the failed request and error +// information regarding the failure. +type AzureAsyncOperationResult struct { + Status OperationStatus `json:"status,omitempty"` + Error *Error `json:"error,omitempty"` +} + +// BackendAddressPool is pool of backend IP addresses. +type BackendAddressPool struct { + ID *string `json:"id,omitempty"` + *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// BackendAddressPoolPropertiesFormat is properties of the backend address +// pool. +type BackendAddressPoolPropertiesFormat struct { + BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + OutboundNatRule *SubResource `json:"outboundNatRule,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// BGPCommunity is contains bgp community information offered in Service +// Community resources. +type BGPCommunity struct { + ServiceSupportedRegion *string `json:"serviceSupportedRegion,omitempty"` + CommunityName *string `json:"communityName,omitempty"` + CommunityValue *string `json:"communityValue,omitempty"` + CommunityPrefixes *[]string `json:"communityPrefixes,omitempty"` +} + +// BgpPeerStatus is bGP peer status details +type BgpPeerStatus struct { + LocalAddress *string `json:"localAddress,omitempty"` + Neighbor *string `json:"neighbor,omitempty"` + Asn *int32 `json:"asn,omitempty"` + State BgpPeerState `json:"state,omitempty"` + ConnectedDuration *string `json:"connectedDuration,omitempty"` + RoutesReceived *int64 `json:"routesReceived,omitempty"` + MessagesSent *int64 `json:"messagesSent,omitempty"` + MessagesReceived *int64 `json:"messagesReceived,omitempty"` +} + +// BgpPeerStatusListResult is response for list BGP peer status API service +// call +type BgpPeerStatusListResult struct { + autorest.Response `json:"-"` + Value *[]BgpPeerStatus `json:"value,omitempty"` +} + +// BgpServiceCommunity is service Community Properties. +type BgpServiceCommunity struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *BgpServiceCommunityPropertiesFormat `json:"properties,omitempty"` +} + +// BgpServiceCommunityListResult is response for the ListServiceCommunity API +// service call. +type BgpServiceCommunityListResult struct { + autorest.Response `json:"-"` + Value *[]BgpServiceCommunity `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// BgpServiceCommunityListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client BgpServiceCommunityListResult) BgpServiceCommunityListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// BgpServiceCommunityPropertiesFormat is properties of Service Community. +type BgpServiceCommunityPropertiesFormat struct { + ServiceName *string `json:"serviceName,omitempty"` + BgpCommunities *[]BGPCommunity `json:"bgpCommunities,omitempty"` +} + +// BgpSettings is bGP settings details +type BgpSettings struct { + Asn *int64 `json:"asn,omitempty"` + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` + PeerWeight *int32 `json:"peerWeight,omitempty"` +} + +// ConnectionResetSharedKey is the virtual network connection reset shared key +type ConnectionResetSharedKey struct { + autorest.Response `json:"-"` + KeyLength *int32 `json:"keyLength,omitempty"` +} + +// ConnectionSharedKey is response for GetConnectionSharedKey API service call +type ConnectionSharedKey struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// DhcpOptions is dhcpOptions contains an array of DNS servers available to VMs +// deployed in the virtual network. Standard DHCP option for a subnet overrides +// VNET DHCP options. +type DhcpOptions struct { + DNSServers *[]string `json:"dnsServers,omitempty"` +} + +// DNSNameAvailabilityResult is response for the CheckDnsNameAvailability API +// service call. +type DNSNameAvailabilityResult struct { + autorest.Response `json:"-"` + Available *bool `json:"available,omitempty"` +} + +// EffectiveNetworkSecurityGroup is effective network security group. +type EffectiveNetworkSecurityGroup struct { + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Association *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"` + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` +} + +// EffectiveNetworkSecurityGroupAssociation is the effective network security +// group association. +type EffectiveNetworkSecurityGroupAssociation struct { + Subnet *SubResource `json:"subnet,omitempty"` + NetworkInterface *SubResource `json:"networkInterface,omitempty"` +} + +// EffectiveNetworkSecurityGroupListResult is response for list effective +// network security groups API service call. +type EffectiveNetworkSecurityGroupListResult struct { + autorest.Response `json:"-"` + Value *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// EffectiveNetworkSecurityRule is effective network security rules. +type EffectiveNetworkSecurityRule struct { + Name *string `json:"name,omitempty"` + Protocol SecurityRuleProtocol `json:"protocol,omitempty"` + SourcePortRange *string `json:"sourcePortRange,omitempty"` + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` + ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` + Access SecurityRuleAccess `json:"access,omitempty"` + Priority *int32 `json:"priority,omitempty"` + Direction SecurityRuleDirection `json:"direction,omitempty"` +} + +// EffectiveRoute is effective Route +type EffectiveRoute struct { + Name *string `json:"name,omitempty"` + Source EffectiveRouteSource `json:"source,omitempty"` + State EffectiveRouteState `json:"state,omitempty"` + AddressPrefix *[]string `json:"addressPrefix,omitempty"` + NextHopIPAddress *[]string `json:"nextHopIpAddress,omitempty"` + NextHopType RouteNextHopType `json:"nextHopType,omitempty"` +} + +// EffectiveRouteListResult is response for list effective route API service +// call. +type EffectiveRouteListResult struct { + autorest.Response `json:"-"` + Value *[]EffectiveRoute `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// Error is +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ErrorDetails `json:"details,omitempty"` + InnerError *string `json:"innerError,omitempty"` +} + +// ErrorDetails is +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Target *string `json:"target,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ExpressRouteCircuit is expressRouteCircuit resource +type ExpressRouteCircuit struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` + *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ExpressRouteCircuitArpTable is the ARP table associated with the +// ExpressRouteCircuit. +type ExpressRouteCircuitArpTable struct { + Age *int32 `json:"age,omitempty"` + Interface *string `json:"interface,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` +} + +// ExpressRouteCircuitAuthorization is authorization in an ExpressRouteCircuit +// resource. +type ExpressRouteCircuitAuthorization struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *AuthorizationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ExpressRouteCircuitListResult is response for ListExpressRouteCircuit API +// service call. +type ExpressRouteCircuitListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteCircuit `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ExpressRouteCircuitListResult) ExpressRouteCircuitListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ExpressRouteCircuitPeering is peering in an ExpressRouteCircuit resource. +type ExpressRouteCircuitPeering struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ExpressRouteCircuitPeeringConfig is specifies the peering configuration. +type ExpressRouteCircuitPeeringConfig struct { + AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` + AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"` + CustomerASN *int32 `json:"customerASN,omitempty"` + RoutingRegistryName *string `json:"routingRegistryName,omitempty"` +} + +// ExpressRouteCircuitPeeringListResult is response for ListPeering API service +// call retrieves all peerings that belong to an ExpressRouteCircuit. +type ExpressRouteCircuitPeeringListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ExpressRouteCircuitPeeringListResult) ExpressRouteCircuitPeeringListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ExpressRouteCircuitPeeringPropertiesFormat is +type ExpressRouteCircuitPeeringPropertiesFormat struct { + PeeringType ExpressRouteCircuitPeeringType `json:"peeringType,omitempty"` + State ExpressRouteCircuitPeeringState `json:"state,omitempty"` + AzureASN *int32 `json:"azureASN,omitempty"` + PeerASN *int32 `json:"peerASN,omitempty"` + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + SharedKey *string `json:"sharedKey,omitempty"` + VlanID *int32 `json:"vlanId,omitempty"` + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + RouteFilter *RouteFilter `json:"routeFilter,omitempty"` +} + +// ExpressRouteCircuitPropertiesFormat is properties of ExpressRouteCircuit. +type ExpressRouteCircuitPropertiesFormat struct { + AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"` + CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` + ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + Authorizations *[]ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` + Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` + ServiceKey *string `json:"serviceKey,omitempty"` + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` +} + +// ExpressRouteCircuitRoutesTable is the routes table associated with the +// ExpressRouteCircuit +type ExpressRouteCircuitRoutesTable struct { + NetworkProperty *string `json:"network,omitempty"` + NextHop *string `json:"nextHop,omitempty"` + LocPrf *string `json:"locPrf,omitempty"` + Weight *int32 `json:"weight,omitempty"` + Path *string `json:"path,omitempty"` +} + +// ExpressRouteCircuitRoutesTableSummary is the routes table associated with +// the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTableSummary struct { + Neighbor *string `json:"neighbor,omitempty"` + V *int32 `json:"v,omitempty"` + As *int32 `json:"as,omitempty"` + UpDown *string `json:"upDown,omitempty"` + StatePfxRcd *string `json:"statePfxRcd,omitempty"` +} + +// ExpressRouteCircuitsArpTableListResult is response for ListArpTable +// associated with the Express Route Circuits API. +type ExpressRouteCircuitsArpTableListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitServiceProviderProperties is contains +// ServiceProviderProperties in an ExpressRouteCircuit. +type ExpressRouteCircuitServiceProviderProperties struct { + ServiceProviderName *string `json:"serviceProviderName,omitempty"` + PeeringLocation *string `json:"peeringLocation,omitempty"` + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` +} + +// ExpressRouteCircuitSku is contains SKU in an ExpressRouteCircuit. +type ExpressRouteCircuitSku struct { + Name *string `json:"name,omitempty"` + Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` + Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` +} + +// ExpressRouteCircuitsRoutesTableListResult is response for ListRoutesTable +// associated with the Express Route Circuits API. +type ExpressRouteCircuitsRoutesTableListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteCircuitRoutesTable `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitsRoutesTableSummaryListResult is response for +// ListRoutesTable associated with the Express Route Circuits API. +type ExpressRouteCircuitsRoutesTableSummaryListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitStats is contains stats associated with the peering. +type ExpressRouteCircuitStats struct { + autorest.Response `json:"-"` + PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` + PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` + SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` + SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` +} + +// ExpressRouteServiceProvider is a ExpressRouteResourceProvider object. +type ExpressRouteServiceProvider struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` +} + +// ExpressRouteServiceProviderBandwidthsOffered is contains bandwidths offered +// in ExpressRouteServiceProvider resources. +type ExpressRouteServiceProviderBandwidthsOffered struct { + OfferName *string `json:"offerName,omitempty"` + ValueInMbps *int32 `json:"valueInMbps,omitempty"` +} + +// ExpressRouteServiceProviderListResult is response for the +// ListExpressRouteServiceProvider API service call. +type ExpressRouteServiceProviderListResult struct { + autorest.Response `json:"-"` + Value *[]ExpressRouteServiceProvider `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteServiceProviderListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ExpressRouteServiceProviderListResult) ExpressRouteServiceProviderListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ExpressRouteServiceProviderPropertiesFormat is properties of +// ExpressRouteServiceProvider. +type ExpressRouteServiceProviderPropertiesFormat struct { + PeeringLocations *[]string `json:"peeringLocations,omitempty"` + BandwidthsOffered *[]ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// FlowLogInformation is information on the configuration of flow log. +type FlowLogInformation struct { + autorest.Response `json:"-"` + TargetResourceID *string `json:"targetResourceId,omitempty"` + *FlowLogProperties `json:"properties,omitempty"` +} + +// FlowLogProperties is parameters that define the configuration of flow log. +type FlowLogProperties struct { + StorageID *string `json:"storageId,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` +} + +// FlowLogStatusParameters is parameters that define a resource to query flow +// log status. +type FlowLogStatusParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// FrontendIPConfiguration is frontend IP address of the load balancer. +type FrontendIPConfiguration struct { + ID *string `json:"id,omitempty"` + *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// FrontendIPConfigurationPropertiesFormat is properties of Frontend IP +// Configuration of the load balancer. +type FrontendIPConfigurationPropertiesFormat struct { + InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` + InboundNatPools *[]SubResource `json:"inboundNatPools,omitempty"` + OutboundNatRules *[]SubResource `json:"outboundNatRules,omitempty"` + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + Subnet *Subnet `json:"subnet,omitempty"` + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// GatewayRoute is gateway routing details +type GatewayRoute struct { + LocalAddress *string `json:"localAddress,omitempty"` + NetworkProperty *string `json:"network,omitempty"` + NextHop *string `json:"nextHop,omitempty"` + SourcePeer *string `json:"sourcePeer,omitempty"` + Origin *string `json:"origin,omitempty"` + AsPath *string `json:"asPath,omitempty"` + Weight *int32 `json:"weight,omitempty"` +} + +// GatewayRouteListResult is list of virtual network gateway routes +type GatewayRouteListResult struct { + autorest.Response `json:"-"` + Value *[]GatewayRoute `json:"value,omitempty"` +} + +// InboundNatPool is inbound NAT pool of the load balancer. +type InboundNatPool struct { + ID *string `json:"id,omitempty"` + *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// InboundNatPoolPropertiesFormat is properties of Inbound NAT pool. +type InboundNatPoolPropertiesFormat struct { + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + Protocol TransportProtocol `json:"protocol,omitempty"` + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// InboundNatRule is inbound NAT rule of the load balancer. +type InboundNatRule struct { + ID *string `json:"id,omitempty"` + *InboundNatRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// InboundNatRulePropertiesFormat is properties of the inbound NAT rule. +type InboundNatRulePropertiesFormat struct { + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty"` + Protocol TransportProtocol `json:"protocol,omitempty"` + FrontendPort *int32 `json:"frontendPort,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// Interface is a network interface in a resource group. +type Interface struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *InterfacePropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// InterfaceAssociation is network interface and its custom security rules. +type InterfaceAssociation struct { + ID *string `json:"id,omitempty"` + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// InterfaceDNSSettings is dNS settings of a network interface. +type InterfaceDNSSettings struct { + DNSServers *[]string `json:"dnsServers,omitempty"` + AppliedDNSServers *[]string `json:"appliedDnsServers,omitempty"` + InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` + InternalFqdn *string `json:"internalFqdn,omitempty"` + InternalDomainNameSuffix *string `json:"internalDomainNameSuffix,omitempty"` +} + +// InterfaceIPConfiguration is iPConfiguration in a network interface. +type InterfaceIPConfiguration struct { + ID *string `json:"id,omitempty"` + *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// InterfaceIPConfigurationPropertiesFormat is properties of IP configuration. +type InterfaceIPConfigurationPropertiesFormat struct { + ApplicationGatewayBackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"applicationGatewayBackendAddressPools,omitempty"` + LoadBalancerBackendAddressPools *[]BackendAddressPool `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatRules *[]InboundNatRule `json:"loadBalancerInboundNatRules,omitempty"` + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + Subnet *Subnet `json:"subnet,omitempty"` + Primary *bool `json:"primary,omitempty"` + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// InterfaceListResult is response for the ListNetworkInterface API service +// call. +type InterfaceListResult struct { + autorest.Response `json:"-"` + Value *[]Interface `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// InterfaceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client InterfaceListResult) InterfaceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// InterfacePropertiesFormat is networkInterface properties. +type InterfacePropertiesFormat struct { + VirtualMachine *SubResource `json:"virtualMachine,omitempty"` + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + IPConfigurations *[]InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + Primary *bool `json:"primary,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// IPAddressAvailabilityResult is response for CheckIPAddressAvailability API +// service call +type IPAddressAvailabilityResult struct { + autorest.Response `json:"-"` + Available *bool `json:"available,omitempty"` + AvailableIPAddresses *[]string `json:"availableIPAddresses,omitempty"` +} + +// IPConfiguration is iPConfiguration +type IPConfiguration struct { + ID *string `json:"id,omitempty"` + *IPConfigurationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// IPConfigurationPropertiesFormat is properties of IP configuration. +type IPConfigurationPropertiesFormat struct { + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + Subnet *Subnet `json:"subnet,omitempty"` + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// IpsecPolicy is an IPSec Policy configuration for a virtual network gateway +// connection +type IpsecPolicy struct { + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` + IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` + IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` + IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` + DhGroup DhGroup `json:"dhGroup,omitempty"` + PfsGroup PfsGroup `json:"pfsGroup,omitempty"` +} + +// LoadBalancer is loadBalancer resource +type LoadBalancer struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LoadBalancerPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// LoadBalancerListResult is response for ListLoadBalancers API service call. +type LoadBalancerListResult struct { + autorest.Response `json:"-"` + Value *[]LoadBalancer `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// LoadBalancerListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client LoadBalancerListResult) LoadBalancerListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// LoadBalancerPropertiesFormat is properties of the load balancer. +type LoadBalancerPropertiesFormat struct { + FrontendIPConfigurations *[]FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + BackendAddressPools *[]BackendAddressPool `json:"backendAddressPools,omitempty"` + LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` + Probes *[]Probe `json:"probes,omitempty"` + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` + InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` + OutboundNatRules *[]OutboundNatRule `json:"outboundNatRules,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// LoadBalancingRule is a loag balancing rule for a load balancer. +type LoadBalancingRule struct { + ID *string `json:"id,omitempty"` + *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// LoadBalancingRulePropertiesFormat is properties of the load balancer. +type LoadBalancingRulePropertiesFormat struct { + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + Probe *SubResource `json:"probe,omitempty"` + Protocol TransportProtocol `json:"protocol,omitempty"` + LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"` + FrontendPort *int32 `json:"frontendPort,omitempty"` + BackendPort *int32 `json:"backendPort,omitempty"` + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// LocalNetworkGateway is a common class for general resource information +type LocalNetworkGateway struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// LocalNetworkGatewayListResult is response for ListLocalNetworkGateways API +// service call. +type LocalNetworkGatewayListResult struct { + autorest.Response `json:"-"` + Value *[]LocalNetworkGateway `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// LocalNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client LocalNetworkGatewayListResult) LocalNetworkGatewayListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// LocalNetworkGatewayPropertiesFormat is localNetworkGateway properties +type LocalNetworkGatewayPropertiesFormat struct { + LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` + GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// NextHopParameters is parameters that define the source and destination +// endpoint. +type NextHopParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + SourceIPAddress *string `json:"sourceIPAddress,omitempty"` + DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// NextHopResult is the information about next hop from the specified VM. +type NextHopResult struct { + autorest.Response `json:"-"` + NextHopType NextHopType `json:"nextHopType,omitempty"` + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + RouteTableID *string `json:"routeTableId,omitempty"` +} + +// OutboundNatRule is outbound NAT pool of the load balancer. +type OutboundNatRule struct { + ID *string `json:"id,omitempty"` + *OutboundNatRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// OutboundNatRulePropertiesFormat is outbound NAT pool of the load balancer. +type OutboundNatRulePropertiesFormat struct { + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"` + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// PacketCapture is parameters that define the create packet capture operation. +type PacketCapture struct { + *PacketCaptureParameters `json:"properties,omitempty"` +} + +// PacketCaptureFilter is filter that is applied to packet capture request. +// Multiple filters can be applied. +type PacketCaptureFilter struct { + Protocol PcProtocol `json:"protocol,omitempty"` + LocalIPAddress *string `json:"localIPAddress,omitempty"` + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + LocalPort *string `json:"localPort,omitempty"` + RemotePort *string `json:"remotePort,omitempty"` +} + +// PacketCaptureListResult is list of packet capture sessions. +type PacketCaptureListResult struct { + autorest.Response `json:"-"` + Value *[]PacketCaptureResult `json:"value,omitempty"` +} + +// PacketCaptureParameters is parameters that define the create packet capture +// operation. +type PacketCaptureParameters struct { + Target *string `json:"target,omitempty"` + BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` + TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` +} + +// PacketCaptureQueryStatusResult is status of packet capture session. +type PacketCaptureQueryStatusResult struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` + PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` + StopReason *string `json:"stopReason,omitempty"` + PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` +} + +// PacketCaptureResult is information about packet capture session. +type PacketCaptureResult struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Etag *string `json:"etag,omitempty"` + *PacketCaptureResultProperties `json:"properties,omitempty"` +} + +// PacketCaptureResultProperties is describes the properties of a packet +// capture session. +type PacketCaptureResultProperties struct { + Target *string `json:"target,omitempty"` + BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` + TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// PacketCaptureStorageLocation is describes the storage location for a packet +// capture session. +type PacketCaptureStorageLocation struct { + StorageID *string `json:"storageId,omitempty"` + StoragePath *string `json:"storagePath,omitempty"` + FilePath *string `json:"filePath,omitempty"` +} + +// PatchRouteFilter is route Filter Resource. +type PatchRouteFilter struct { + ID *string `json:"id,omitempty"` + *RouteFilterPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// PatchRouteFilterRule is route Filter Rule Resource +type PatchRouteFilterRule struct { + ID *string `json:"id,omitempty"` + *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Probe is a load balancer probe. +type Probe struct { + ID *string `json:"id,omitempty"` + *ProbePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ProbePropertiesFormat is +type ProbePropertiesFormat struct { + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + Protocol ProbeProtocol `json:"protocol,omitempty"` + Port *int32 `json:"port,omitempty"` + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` + RequestPath *string `json:"requestPath,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// PublicIPAddress is public IP address resource. +type PublicIPAddress struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// PublicIPAddressDNSSettings is contains FQDN of the DNS record associated +// with the public IP address +type PublicIPAddressDNSSettings struct { + DomainNameLabel *string `json:"domainNameLabel,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + ReverseFqdn *string `json:"reverseFqdn,omitempty"` +} + +// PublicIPAddressListResult is response for ListPublicIpAddresses API service +// call. +type PublicIPAddressListResult struct { + autorest.Response `json:"-"` + Value *[]PublicIPAddress `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PublicIPAddressListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PublicIPAddressListResult) PublicIPAddressListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PublicIPAddressPropertiesFormat is public IP address properties. +type PublicIPAddressPropertiesFormat struct { + PublicIPAllocationMethod IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` + IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"` + DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// QueryTroubleshootingParameters is parameters that define the resource to +// query the troubleshooting result. +type QueryTroubleshootingParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceNavigationLink is resourceNavigationLink resource. +type ResourceNavigationLink struct { + ID *string `json:"id,omitempty"` + *ResourceNavigationLinkFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// ResourceNavigationLinkFormat is properties of ResourceNavigationLink. +type ResourceNavigationLinkFormat struct { + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + Link *string `json:"link,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// RetentionPolicyParameters is parameters that define the retention policy for +// flow log. +type RetentionPolicyParameters struct { + Days *int32 `json:"days,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// Route is route resource +type Route struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *RoutePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// RouteFilter is route Filter Resource. +type RouteFilter struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RouteFilterPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// RouteFilterListResult is response for the ListRouteFilters API service call. +type RouteFilterListResult struct { + autorest.Response `json:"-"` + Value *[]RouteFilter `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteFilterListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RouteFilterListResult) RouteFilterListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RouteFilterPropertiesFormat is route Filter Resource +type RouteFilterPropertiesFormat struct { + Rules *[]RouteFilterRule `json:"rules,omitempty"` + Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// RouteFilterRule is route Filter Rule Resource +type RouteFilterRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Etag *string `json:"etag,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RouteFilterRuleListResult is response for the ListRouteFilterRules API +// service call +type RouteFilterRuleListResult struct { + autorest.Response `json:"-"` + Value *[]RouteFilterRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteFilterRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RouteFilterRuleListResult) RouteFilterRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RouteFilterRulePropertiesFormat is route Filter Rule Resource +type RouteFilterRulePropertiesFormat struct { + Access Access `json:"access,omitempty"` + RouteFilterRuleType *string `json:"routeFilterRuleType,omitempty"` + Communities *[]string `json:"communities,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// RouteListResult is response for the ListRoute API service call +type RouteListResult struct { + autorest.Response `json:"-"` + Value *[]Route `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RouteListResult) RouteListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RoutePropertiesFormat is route resource +type RoutePropertiesFormat struct { + AddressPrefix *string `json:"addressPrefix,omitempty"` + NextHopType RouteNextHopType `json:"nextHopType,omitempty"` + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// RouteTable is route table resource. +type RouteTable struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RouteTablePropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// RouteTableListResult is response for the ListRouteTable API service call. +type RouteTableListResult struct { + autorest.Response `json:"-"` + Value *[]RouteTable `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteTableListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RouteTableListResult) RouteTableListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RouteTablePropertiesFormat is route Table resource +type RouteTablePropertiesFormat struct { + Routes *[]Route `json:"routes,omitempty"` + Subnets *[]Subnet `json:"subnets,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// SecurityGroup is networkSecurityGroup resource. +type SecurityGroup struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SecurityGroupPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// SecurityGroupListResult is response for ListNetworkSecurityGroups API +// service call. +type SecurityGroupListResult struct { + autorest.Response `json:"-"` + Value *[]SecurityGroup `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityGroupListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SecurityGroupListResult) SecurityGroupListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SecurityGroupNetworkInterface is network interface and all its associated +// security rules. +type SecurityGroupNetworkInterface struct { + ID *string `json:"id,omitempty"` + SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` +} + +// SecurityGroupPropertiesFormat is network Security Group resource. +type SecurityGroupPropertiesFormat struct { + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + Subnets *[]Subnet `json:"subnets,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// SecurityGroupViewParameters is parameters that define the VM to check +// security groups for. +type SecurityGroupViewParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// SecurityGroupViewResult is the information about security rules applied to +// the specified VM. +type SecurityGroupViewResult struct { + autorest.Response `json:"-"` + NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` +} + +// SecurityRule is network security rule. +type SecurityRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *SecurityRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// SecurityRuleAssociations is all security rules associated with the network +// interface. +type SecurityRuleAssociations struct { + NetworkInterfaceAssociation *InterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` + SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` +} + +// SecurityRuleListResult is response for ListSecurityRule API service call. +// Retrieves all security rules that belongs to a network security group. +type SecurityRuleListResult struct { + autorest.Response `json:"-"` + Value *[]SecurityRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SecurityRuleListResult) SecurityRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SecurityRulePropertiesFormat is +type SecurityRulePropertiesFormat struct { + Description *string `json:"description,omitempty"` + Protocol SecurityRuleProtocol `json:"protocol,omitempty"` + SourcePortRange *string `json:"sourcePortRange,omitempty"` + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + Access SecurityRuleAccess `json:"access,omitempty"` + Priority *int32 `json:"priority,omitempty"` + Direction SecurityRuleDirection `json:"direction,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// String is +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// Subnet is subnet in a virtual network resource. +type Subnet struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *SubnetPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// SubnetAssociation is network interface and its custom security rules. +type SubnetAssociation struct { + ID *string `json:"id,omitempty"` + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// SubnetListResult is response for ListSubnets API service callRetrieves all +// subnet that belongs to a virtual network +type SubnetListResult struct { + autorest.Response `json:"-"` + Value *[]Subnet `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SubnetListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SubnetListResult) SubnetListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SubnetPropertiesFormat is +type SubnetPropertiesFormat struct { + AddressPrefix *string `json:"addressPrefix,omitempty"` + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + RouteTable *RouteTable `json:"routeTable,omitempty"` + IPConfigurations *[]IPConfiguration `json:"ipConfigurations,omitempty"` + ResourceNavigationLinks *[]ResourceNavigationLink `json:"resourceNavigationLinks,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// Topology is topology of the specified resource group. +type Topology struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + Resources *[]TopologyResource `json:"resources,omitempty"` +} + +// TopologyAssociation is resources that have an association with the parent +// resource. +type TopologyAssociation struct { + Name *string `json:"name,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + AssociationType AssociationType `json:"associationType,omitempty"` +} + +// TopologyParameters is parameters that define the representation of topology. +type TopologyParameters struct { + TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` +} + +// TopologyResource is the network resource topology information for the given +// resource group. +type TopologyResource struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Associations *[]TopologyAssociation `json:"associations,omitempty"` +} + +// TroubleshootingDetails is information gained from troubleshooting of +// specified resource. +type TroubleshootingDetails struct { + ID *string `json:"id,omitempty"` + ReasonType *string `json:"reasonType,omitempty"` + Summary *string `json:"summary,omitempty"` + Detail *string `json:"detail,omitempty"` + RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` +} + +// TroubleshootingParameters is parameters that define the resource to +// troubleshoot. +type TroubleshootingParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + *TroubleshootingProperties `json:"properties,omitempty"` +} + +// TroubleshootingProperties is storage location provided for troubleshoot. +type TroubleshootingProperties struct { + StorageID *string `json:"storageId,omitempty"` + StoragePath *string `json:"storagePath,omitempty"` +} + +// TroubleshootingRecommendedActions is recommended actions based on discovered +// issues. +type TroubleshootingRecommendedActions struct { + ActionID *string `json:"actionId,omitempty"` + ActionText *string `json:"actionText,omitempty"` + ActionURI *string `json:"actionUri,omitempty"` + ActionURIText *string `json:"actionUriText,omitempty"` +} + +// TroubleshootingResult is troubleshooting information gained from specified +// resource. +type TroubleshootingResult struct { + autorest.Response `json:"-"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Code *string `json:"code,omitempty"` + Results *[]TroubleshootingDetails `json:"results,omitempty"` +} + +// TunnelConnectionHealth is virtualNetworkGatewayConnection properties +type TunnelConnectionHealth struct { + Tunnel *string `json:"tunnel,omitempty"` + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + LastConnectionEstablishedUtcTime *string `json:"lastConnectionEstablishedUtcTime,omitempty"` +} + +// Usage is describes network resource usage. +type Usage struct { + Unit *string `json:"unit,omitempty"` + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *UsageName `json:"name,omitempty"` +} + +// UsageName is the usage names. +type UsageName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UsagesListResult is the list usages operation response. +type UsagesListResult struct { + autorest.Response `json:"-"` + Value *[]Usage `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// UsagesListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client UsagesListResult) UsagesListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VerificationIPFlowParameters is parameters that define the IP flow to be +// verified. +type VerificationIPFlowParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + Direction Direction `json:"direction,omitempty"` + Protocol Protocol `json:"protocol,omitempty"` + LocalPort *string `json:"localPort,omitempty"` + RemotePort *string `json:"remotePort,omitempty"` + LocalIPAddress *string `json:"localIPAddress,omitempty"` + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// VerificationIPFlowResult is results of IP flow verification on the target +// resource. +type VerificationIPFlowResult struct { + autorest.Response `json:"-"` + Access Access `json:"access,omitempty"` + RuleName *string `json:"ruleName,omitempty"` +} + +// VirtualNetwork is virtual Network resource. +type VirtualNetwork struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VirtualNetworkGateway is a common class for general resource information +type VirtualNetworkGateway struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VirtualNetworkGatewayConnection is a common class for general resource +// information +type VirtualNetworkGatewayConnection struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VirtualNetworkGatewayConnectionListResult is response for the +// ListVirtualNetworkGatewayConnections API service call +type VirtualNetworkGatewayConnectionListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualNetworkGatewayConnection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkGatewayConnectionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualNetworkGatewayConnectionListResult) VirtualNetworkGatewayConnectionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualNetworkGatewayConnectionPropertiesFormat is +// virtualNetworkGatewayConnection properties +type VirtualNetworkGatewayConnectionPropertiesFormat struct { + AuthorizationKey *string `json:"authorizationKey,omitempty"` + VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` + VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` + LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` + ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + RoutingWeight *int32 `json:"routingWeight,omitempty"` + SharedKey *string `json:"sharedKey,omitempty"` + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + Peer *SubResource `json:"peer,omitempty"` + EnableBgp *bool `json:"enableBgp,omitempty"` + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VirtualNetworkGatewayIPConfiguration is iP configuration for virtual network +// gateway +type VirtualNetworkGatewayIPConfiguration struct { + ID *string `json:"id,omitempty"` + *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VirtualNetworkGatewayIPConfigurationPropertiesFormat is properties of +// VirtualNetworkGatewayIPConfiguration +type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VirtualNetworkGatewayListResult is response for the +// ListVirtualNetworkGateways API service call. +type VirtualNetworkGatewayListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualNetworkGateway `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualNetworkGatewayListResult) VirtualNetworkGatewayListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualNetworkGatewayPropertiesFormat is virtualNetworkGateway properties +type VirtualNetworkGatewayPropertiesFormat struct { + IPConfigurations *[]VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` + GatewayType VirtualNetworkGatewayType `json:"gatewayType,omitempty"` + VpnType VpnType `json:"vpnType,omitempty"` + EnableBgp *bool `json:"enableBgp,omitempty"` + ActiveActive *bool `json:"activeActive,omitempty"` + GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` + Sku *VirtualNetworkGatewaySku `json:"sku,omitempty"` + VpnClientConfiguration *VpnClientConfiguration `json:"vpnClientConfiguration,omitempty"` + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VirtualNetworkGatewaySku is virtualNetworkGatewaySku details +type VirtualNetworkGatewaySku struct { + Name VirtualNetworkGatewaySkuName `json:"name,omitempty"` + Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// VirtualNetworkListResult is response for the ListVirtualNetworks API service +// call. +type VirtualNetworkListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualNetwork `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualNetworkListResult) VirtualNetworkListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualNetworkPeering is peerings in a virtual network resource. +type VirtualNetworkPeering struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VirtualNetworkPeeringListResult is response for ListSubnets API service +// call. Retrieves all subnets that belong to a virtual network. +type VirtualNetworkPeeringListResult struct { + autorest.Response `json:"-"` + Value *[]VirtualNetworkPeering `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkPeeringListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client VirtualNetworkPeeringListResult) VirtualNetworkPeeringListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// VirtualNetworkPeeringPropertiesFormat is +type VirtualNetworkPeeringPropertiesFormat struct { + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + PeeringState VirtualNetworkPeeringState `json:"peeringState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VirtualNetworkPropertiesFormat is +type VirtualNetworkPropertiesFormat struct { + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` + Subnets *[]Subnet `json:"subnets,omitempty"` + VirtualNetworkPeerings *[]VirtualNetworkPeering `json:"virtualNetworkPeerings,omitempty"` + ResourceGUID *string `json:"resourceGuid,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VpnClientConfiguration is vpnClientConfiguration for P2S client. +type VpnClientConfiguration struct { + VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + VpnClientRootCertificates *[]VpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + VpnClientRevokedCertificates *[]VpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` +} + +// VpnClientParameters is vpn Client Parameters for package generation +type VpnClientParameters struct { + ProcessorArchitecture ProcessorArchitecture `json:"processorArchitecture,omitempty"` +} + +// VpnClientRevokedCertificate is vPN client revoked certificate of virtual +// network gateway. +type VpnClientRevokedCertificate struct { + ID *string `json:"id,omitempty"` + *VpnClientRevokedCertificatePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VpnClientRevokedCertificatePropertiesFormat is properties of the revoked VPN +// client certificate of virtual network gateway. +type VpnClientRevokedCertificatePropertiesFormat struct { + Thumbprint *string `json:"thumbprint,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// VpnClientRootCertificate is vPN client root certificate of virtual network +// gateway +type VpnClientRootCertificate struct { + ID *string `json:"id,omitempty"` + *VpnClientRootCertificatePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// VpnClientRootCertificatePropertiesFormat is properties of SSL certificates +// of application gateway +type VpnClientRootCertificatePropertiesFormat struct { + PublicCertData *string `json:"publicCertData,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// Watcher is network watcher in a resource group. +type Watcher struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *WatcherPropertiesFormat `json:"properties,omitempty"` +} + +// WatcherListResult is list of network watcher resources. +type WatcherListResult struct { + autorest.Response `json:"-"` + Value *[]Watcher `json:"value,omitempty"` +} + +// WatcherPropertiesFormat is the network watcher properties. +type WatcherPropertiesFormat struct { + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/packetcaptures.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/packetcaptures.go index 2a58eb7286..fbeb0d9ef4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/packetcaptures.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/packetcaptures.go @@ -1,526 +1,526 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PacketCapturesClient is the composite Swagger for Network Client -type PacketCapturesClient struct { - ManagementClient -} - -// NewPacketCapturesClient creates an instance of the PacketCapturesClient -// client. -func NewPacketCapturesClient(subscriptionID string) PacketCapturesClient { - return NewPacketCapturesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPacketCapturesClientWithBaseURI creates an instance of the -// PacketCapturesClient client. -func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) PacketCapturesClient { - return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create and start a packet capture on the specified VM. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. parameters is parameters that define the create packet -// capture operation. -func (client PacketCapturesClient) Create(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (<-chan PacketCaptureResult, <-chan error) { - resultChan := make(chan PacketCaptureResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.PacketCapturesClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result PacketCaptureResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, networkWatcherName, packetCaptureName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result PacketCaptureResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified packet capture session. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. -func (client PacketCapturesClient) Delete(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a packet capture session by name. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. -func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { - req, err := client.GetPreparer(resourceGroupName, networkWatcherName, packetCaptureName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PacketCapturesClient) GetPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) GetResponder(resp *http.Response) (result PacketCaptureResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStatus query the status of a running packet capture session. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the Network Watcher resource. packetCaptureName is the name -// given to the packet capture session. -func (client PacketCapturesClient) GetStatus(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan PacketCaptureQueryStatusResult, <-chan error) { - resultChan := make(chan PacketCaptureQueryStatusResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result PacketCaptureQueryStatusResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetStatusPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", resp, "Failure sending request") - return - } - - result, err = client.GetStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetStatusPreparer prepares the GetStatus request. -func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetStatusSender sends the GetStatus request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) GetStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetStatusResponder handles the response to the GetStatus request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (result PacketCaptureQueryStatusResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all packet capture sessions within the specified resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the Network Watcher resource. -func (client PacketCapturesClient) List(resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, networkWatcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) ListResponder(resp *http.Response) (result PacketCaptureListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Stop stops a specified packet capture session. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. -func (client PacketCapturesClient) Stop(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.StopPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// StopPreparer prepares the Stop request. -func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PacketCapturesClient is the composite Swagger for Network Client +type PacketCapturesClient struct { + ManagementClient +} + +// NewPacketCapturesClient creates an instance of the PacketCapturesClient +// client. +func NewPacketCapturesClient(subscriptionID string) PacketCapturesClient { + return NewPacketCapturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPacketCapturesClientWithBaseURI creates an instance of the +// PacketCapturesClient client. +func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) PacketCapturesClient { + return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create and start a packet capture on the specified VM. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. parameters is parameters that define the create packet +// capture operation. +func (client PacketCapturesClient) Create(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (<-chan PacketCaptureResult, <-chan error) { + resultChan := make(chan PacketCaptureResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.PacketCapturesClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result PacketCaptureResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, networkWatcherName, packetCaptureName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result PacketCaptureResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified packet capture session. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. +func (client PacketCapturesClient) Delete(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a packet capture session by name. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. +func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { + req, err := client.GetPreparer(resourceGroupName, networkWatcherName, packetCaptureName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PacketCapturesClient) GetPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) GetResponder(resp *http.Response) (result PacketCaptureResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStatus query the status of a running packet capture session. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the Network Watcher resource. packetCaptureName is the name +// given to the packet capture session. +func (client PacketCapturesClient) GetStatus(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan PacketCaptureQueryStatusResult, <-chan error) { + resultChan := make(chan PacketCaptureQueryStatusResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result PacketCaptureQueryStatusResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetStatusPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", resp, "Failure sending request") + return + } + + result, err = client.GetStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetStatusPreparer prepares the GetStatus request. +func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetStatusSender sends the GetStatus request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) GetStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetStatusResponder handles the response to the GetStatus request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (result PacketCaptureQueryStatusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all packet capture sessions within the specified resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the Network Watcher resource. +func (client PacketCapturesClient) List(resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) ListResponder(resp *http.Response) (result PacketCaptureListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops a specified packet capture session. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. +func (client PacketCapturesClient) Stop(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.StopPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// StopPreparer prepares the Stop request. +func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go index 9cc6f4d1d8..896bc817d9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go @@ -1,465 +1,465 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PublicIPAddressesClient is the composite Swagger for Network Client -type PublicIPAddressesClient struct { - ManagementClient -} - -// NewPublicIPAddressesClient creates an instance of the -// PublicIPAddressesClient client. -func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient { - return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPublicIPAddressesClientWithBaseURI creates an instance of the -// PublicIPAddressesClient client. -func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient { - return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a static or dynamic public IP address. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is -// the name of the public IP address. parameters is parameters supplied to the -// create or update public IP address operation. -func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { - resultChan := make(chan PublicIPAddress, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result PublicIPAddress - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "publicIpAddressName": autorest.Encode("path", publicIPAddressName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPAddress, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified public IP address. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is -// the name of the subnet. -func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "publicIpAddressName": autorest.Encode("path", publicIPAddressName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified public IP address in a specified resource group. -// -// resourceGroupName is the name of the resource group. publicIPAddressName is -// the name of the subnet. expand is expands referenced resources. -func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { - req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publicIPAddressName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "publicIpAddressName": autorest.Encode("path", publicIPAddressName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result PublicIPAddress, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all public IP addresses in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { - req, err := lastResults.PublicIPAddressListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all the public IP addresses in a subscription. -func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { - req, err := lastResults.PublicIPAddressListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PublicIPAddressesClient is the composite Swagger for Network Client +type PublicIPAddressesClient struct { + ManagementClient +} + +// NewPublicIPAddressesClient creates an instance of the +// PublicIPAddressesClient client. +func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient { + return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPublicIPAddressesClientWithBaseURI creates an instance of the +// PublicIPAddressesClient client. +func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient { + return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a static or dynamic public IP address. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. publicIPAddressName is +// the name of the public IP address. parameters is parameters supplied to the +// create or update public IP address operation. +func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { + resultChan := make(chan PublicIPAddress, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result PublicIPAddress + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified public IP address. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. publicIPAddressName is +// the name of the subnet. +func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified public IP address in a specified resource group. +// +// resourceGroupName is the name of the resource group. publicIPAddressName is +// the name of the subnet. expand is expands referenced resources. +func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { + req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publicIPAddressName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all public IP addresses in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.PublicIPAddressListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all the public IP addresses in a subscription. +func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.PublicIPAddressListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilterrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilterrules.go index 29fcabf8c2..378a75bb2f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilterrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilterrules.go @@ -1,468 +1,468 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RouteFilterRulesClient is the composite Swagger for Network Client -type RouteFilterRulesClient struct { - ManagementClient -} - -// NewRouteFilterRulesClient creates an instance of the RouteFilterRulesClient -// client. -func NewRouteFilterRulesClient(subscriptionID string) RouteFilterRulesClient { - return NewRouteFilterRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRouteFilterRulesClientWithBaseURI creates an instance of the -// RouteFilterRulesClient client. -func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string) RouteFilterRulesClient { - return RouteFilterRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a route in the specified route filter. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. ruleName is the name of the route filter rule. -// routeFilterRuleParameters is parameters supplied to the create or update -// route filter rule operation. -func (client RouteFilterRulesClient) CreateOrUpdate(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) { - resultChan := make(chan RouteFilterRule, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: routeFilterRuleParameters, - Constraints: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.RouteFilterRulesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RouteFilterRule - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RouteFilterRulesClient) CreateOrUpdatePreparer(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), - autorest.WithJSON(routeFilterRuleParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteFilterRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified rule from a route filter. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. ruleName is the name of the rule. -func (client RouteFilterRulesClient) Delete(resourceGroupName string, routeFilterName string, ruleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, routeFilterName, ruleName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client RouteFilterRulesClient) DeletePreparer(resourceGroupName string, routeFilterName string, ruleName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified rule from a route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. ruleName is the name of the rule. -func (client RouteFilterRulesClient) Get(resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) { - req, err := client.GetPreparer(resourceGroupName, routeFilterName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RouteFilterRulesClient) GetPreparer(resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFilterRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RouteFilterRulesClient) GetResponder(resp *http.Response) (result RouteFilterRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByRouteFilter gets all RouteFilterRules in a route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. -func (client RouteFilterRulesClient) ListByRouteFilter(resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResult, err error) { - req, err := client.ListByRouteFilterPreparer(resourceGroupName, routeFilterName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing request") - return - } - - resp, err := client.ListByRouteFilterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending request") - return - } - - result, err = client.ListByRouteFilterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to request") - } - - return -} - -// ListByRouteFilterPreparer prepares the ListByRouteFilter request. -func (client RouteFilterRulesClient) ListByRouteFilterPreparer(resourceGroupName string, routeFilterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByRouteFilterSender sends the ListByRouteFilter request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFilterRulesClient) ListByRouteFilterSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByRouteFilterResponder handles the response to the ListByRouteFilter request. The method always -// closes the http.Response Body. -func (client RouteFilterRulesClient) ListByRouteFilterResponder(resp *http.Response) (result RouteFilterRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByRouteFilterNextResults retrieves the next set of results, if any. -func (client RouteFilterRulesClient) ListByRouteFilterNextResults(lastResults RouteFilterRuleListResult) (result RouteFilterRuleListResult, err error) { - req, err := lastResults.RouteFilterRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByRouteFilterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending next results request") - } - - result, err = client.ListByRouteFilterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to next results request") - } - - return -} - -// Update updates a route in the specified route filter. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. ruleName is the name of the route filter rule. -// routeFilterRuleParameters is parameters supplied to the update route filter -// rule operation. -func (client RouteFilterRulesClient) Update(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) { - resultChan := make(chan RouteFilterRule, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result RouteFilterRule - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client RouteFilterRulesClient) UpdatePreparer(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), - autorest.WithJSON(routeFilterRuleParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFilterRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RouteFilterRulesClient) UpdateResponder(resp *http.Response) (result RouteFilterRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RouteFilterRulesClient is the composite Swagger for Network Client +type RouteFilterRulesClient struct { + ManagementClient +} + +// NewRouteFilterRulesClient creates an instance of the RouteFilterRulesClient +// client. +func NewRouteFilterRulesClient(subscriptionID string) RouteFilterRulesClient { + return NewRouteFilterRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRouteFilterRulesClientWithBaseURI creates an instance of the +// RouteFilterRulesClient client. +func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string) RouteFilterRulesClient { + return RouteFilterRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a route in the specified route filter. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. ruleName is the name of the route filter rule. +// routeFilterRuleParameters is parameters supplied to the create or update +// route filter rule operation. +func (client RouteFilterRulesClient) CreateOrUpdate(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) { + resultChan := make(chan RouteFilterRule, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: routeFilterRuleParameters, + Constraints: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.RouteFilterRulesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RouteFilterRule + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RouteFilterRulesClient) CreateOrUpdatePreparer(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithJSON(routeFilterRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteFilterRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified rule from a route filter. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. ruleName is the name of the rule. +func (client RouteFilterRulesClient) Delete(resourceGroupName string, routeFilterName string, ruleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, routeFilterName, ruleName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client RouteFilterRulesClient) DeletePreparer(resourceGroupName string, routeFilterName string, ruleName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified rule from a route filter. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. ruleName is the name of the rule. +func (client RouteFilterRulesClient) Get(resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) { + req, err := client.GetPreparer(resourceGroupName, routeFilterName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RouteFilterRulesClient) GetPreparer(resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) GetResponder(resp *http.Response) (result RouteFilterRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByRouteFilter gets all RouteFilterRules in a route filter. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. +func (client RouteFilterRulesClient) ListByRouteFilter(resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResult, err error) { + req, err := client.ListByRouteFilterPreparer(resourceGroupName, routeFilterName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRouteFilterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending request") + return + } + + result, err = client.ListByRouteFilterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to request") + } + + return +} + +// ListByRouteFilterPreparer prepares the ListByRouteFilter request. +func (client RouteFilterRulesClient) ListByRouteFilterPreparer(resourceGroupName string, routeFilterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByRouteFilterSender sends the ListByRouteFilter request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) ListByRouteFilterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByRouteFilterResponder handles the response to the ListByRouteFilter request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) ListByRouteFilterResponder(resp *http.Response) (result RouteFilterRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByRouteFilterNextResults retrieves the next set of results, if any. +func (client RouteFilterRulesClient) ListByRouteFilterNextResults(lastResults RouteFilterRuleListResult) (result RouteFilterRuleListResult, err error) { + req, err := lastResults.RouteFilterRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByRouteFilterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending next results request") + } + + result, err = client.ListByRouteFilterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to next results request") + } + + return +} + +// Update updates a route in the specified route filter. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. ruleName is the name of the route filter rule. +// routeFilterRuleParameters is parameters supplied to the update route filter +// rule operation. +func (client RouteFilterRulesClient) Update(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) { + resultChan := make(chan RouteFilterRule, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RouteFilterRule + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client RouteFilterRulesClient) UpdatePreparer(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithJSON(routeFilterRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) UpdateResponder(resp *http.Response) (result RouteFilterRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilters.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilters.go index 599aed2974..860ccae5c3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilters.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routefilters.go @@ -1,535 +1,535 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RouteFiltersClient is the composite Swagger for Network Client -type RouteFiltersClient struct { - ManagementClient -} - -// NewRouteFiltersClient creates an instance of the RouteFiltersClient client. -func NewRouteFiltersClient(subscriptionID string) RouteFiltersClient { - return NewRouteFiltersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRouteFiltersClientWithBaseURI creates an instance of the -// RouteFiltersClient client. -func NewRouteFiltersClientWithBaseURI(baseURI string, subscriptionID string) RouteFiltersClient { - return RouteFiltersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a route filter in a specified resource -// group. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. routeFilterParameters is parameters supplied to -// the create or update route filter operation. -func (client RouteFiltersClient) CreateOrUpdate(resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) { - resultChan := make(chan RouteFilter, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result RouteFilter - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeFilterName, routeFilterParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RouteFiltersClient) CreateOrUpdatePreparer(resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), - autorest.WithJSON(routeFilterParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RouteFiltersClient) CreateOrUpdateResponder(resp *http.Response) (result RouteFilter, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified route filter. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. -func (client RouteFiltersClient) Delete(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, routeFilterName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client RouteFiltersClient) DeletePreparer(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFiltersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RouteFiltersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified route filter. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. expand is expands referenced express route bgp -// peering resources. -func (client RouteFiltersClient) Get(resourceGroupName string, routeFilterName string, expand string) (result RouteFilter, err error) { - req, err := client.GetPreparer(resourceGroupName, routeFilterName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RouteFiltersClient) GetPreparer(resourceGroupName string, routeFilterName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFiltersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RouteFiltersClient) GetResponder(resp *http.Response) (result RouteFilter, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all route filters in a subscription. -func (client RouteFiltersClient) List() (result RouteFilterListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RouteFiltersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFiltersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RouteFiltersClient) ListResponder(resp *http.Response) (result RouteFilterListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RouteFiltersClient) ListNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { - req, err := lastResults.RouteFilterListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets all route filters in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client RouteFiltersClient) ListByResourceGroup(resourceGroupName string) (result RouteFilterListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RouteFiltersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFiltersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client RouteFiltersClient) ListByResourceGroupResponder(resp *http.Response) (result RouteFilterListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client RouteFiltersClient) ListByResourceGroupNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { - req, err := lastResults.RouteFilterListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update updates a route filter in a specified resource group. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. routeFilterName is the -// name of the route filter. routeFilterParameters is parameters supplied to -// the update route filter operation. -func (client RouteFiltersClient) Update(resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) { - resultChan := make(chan RouteFilter, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result RouteFilter - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, routeFilterName, routeFilterParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client RouteFiltersClient) UpdatePreparer(resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeFilterName": autorest.Encode("path", routeFilterName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), - autorest.WithJSON(routeFilterParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RouteFiltersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RouteFiltersClient) UpdateResponder(resp *http.Response) (result RouteFilter, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RouteFiltersClient is the composite Swagger for Network Client +type RouteFiltersClient struct { + ManagementClient +} + +// NewRouteFiltersClient creates an instance of the RouteFiltersClient client. +func NewRouteFiltersClient(subscriptionID string) RouteFiltersClient { + return NewRouteFiltersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRouteFiltersClientWithBaseURI creates an instance of the +// RouteFiltersClient client. +func NewRouteFiltersClientWithBaseURI(baseURI string, subscriptionID string) RouteFiltersClient { + return RouteFiltersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a route filter in a specified resource +// group. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. routeFilterParameters is parameters supplied to +// the create or update route filter operation. +func (client RouteFiltersClient) CreateOrUpdate(resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) { + resultChan := make(chan RouteFilter, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RouteFilter + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeFilterName, routeFilterParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RouteFiltersClient) CreateOrUpdatePreparer(resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithJSON(routeFilterParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) CreateOrUpdateResponder(resp *http.Response) (result RouteFilter, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified route filter. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. +func (client RouteFiltersClient) Delete(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, routeFilterName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client RouteFiltersClient) DeletePreparer(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified route filter. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. expand is expands referenced express route bgp +// peering resources. +func (client RouteFiltersClient) Get(resourceGroupName string, routeFilterName string, expand string) (result RouteFilter, err error) { + req, err := client.GetPreparer(resourceGroupName, routeFilterName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RouteFiltersClient) GetPreparer(resourceGroupName string, routeFilterName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) GetResponder(resp *http.Response) (result RouteFilter, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all route filters in a subscription. +func (client RouteFiltersClient) List() (result RouteFilterListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RouteFiltersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) ListResponder(resp *http.Response) (result RouteFilterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RouteFiltersClient) ListNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { + req, err := lastResults.RouteFilterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets all route filters in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client RouteFiltersClient) ListByResourceGroup(resourceGroupName string) (result RouteFilterListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client RouteFiltersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) ListByResourceGroupResponder(resp *http.Response) (result RouteFilterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client RouteFiltersClient) ListByResourceGroupNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { + req, err := lastResults.RouteFilterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update updates a route filter in a specified resource group. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. routeFilterName is the +// name of the route filter. routeFilterParameters is parameters supplied to +// the update route filter operation. +func (client RouteFiltersClient) Update(resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) { + resultChan := make(chan RouteFilter, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RouteFilter + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, routeFilterName, routeFilterParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client RouteFiltersClient) UpdatePreparer(resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithJSON(routeFilterParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) UpdateResponder(resp *http.Response) (result RouteFilter, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go index dbe97996a0..1366d3c144 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go @@ -1,365 +1,365 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RoutesClient is the composite Swagger for Network Client -type RoutesClient struct { - ManagementClient -} - -// NewRoutesClient creates an instance of the RoutesClient client. -func NewRoutesClient(subscriptionID string) RoutesClient { - return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client. -func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient { - return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a route in the specified route table. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. routeName is the name of the route. routeParameters -// is parameters supplied to the create or update route operation. -func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (<-chan Route, <-chan error) { - resultChan := make(chan Route, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Route - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), - autorest.WithJSON(routeParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result Route, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified route from a route table. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. routeName is the name of the route. -func (client RoutesClient) Delete(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, routeTableName, routeName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RoutesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified route from a route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. routeName is the name of the route. -func (client RoutesClient) Get(resourceGroupName string, routeTableName string, routeName string) (result Route, err error) { - req, err := client.GetPreparer(resourceGroupName, routeTableName, routeName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RoutesClient) GetPreparer(resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all routes in a route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. -func (client RoutesClient) List(resourceGroupName string, routeTableName string) (result RouteListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, routeTableName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RoutesClient) ListPreparer(resourceGroupName string, routeTableName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, err error) { - req, err := lastResults.RouteListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RoutesClient is the composite Swagger for Network Client +type RoutesClient struct { + ManagementClient +} + +// NewRoutesClient creates an instance of the RoutesClient client. +func NewRoutesClient(subscriptionID string) RoutesClient { + return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client. +func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient { + return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a route in the specified route table. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. routeName is the name of the route. routeParameters +// is parameters supplied to the create or update route operation. +func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (<-chan Route, <-chan error) { + resultChan := make(chan Route, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Route + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), + autorest.WithJSON(routeParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified route from a route table. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. routeName is the name of the route. +func (client RoutesClient) Delete(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, routeTableName, routeName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified route from a route table. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. routeName is the name of the route. +func (client RoutesClient) Get(resourceGroupName string, routeTableName string, routeName string) (result Route, err error) { + req, err := client.GetPreparer(resourceGroupName, routeTableName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoutesClient) GetPreparer(resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all routes in a route table. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. +func (client RoutesClient) List(resourceGroupName string, routeTableName string) (result RouteListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RoutesClient) ListPreparer(resourceGroupName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, err error) { + req, err := lastResults.RouteListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go index 2dff130257..80339f2078 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go @@ -1,449 +1,449 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RouteTablesClient is the composite Swagger for Network Client -type RouteTablesClient struct { - ManagementClient -} - -// NewRouteTablesClient creates an instance of the RouteTablesClient client. -func NewRouteTablesClient(subscriptionID string) RouteTablesClient { - return NewRouteTablesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRouteTablesClientWithBaseURI creates an instance of the RouteTablesClient -// client. -func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) RouteTablesClient { - return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or updates a route table in a specified resource -// group. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. parameters is parameters supplied to the create or -// update route table operation. -func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (<-chan RouteTable, <-chan error) { - resultChan := make(chan RouteTable, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result RouteTable - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteTable, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified route table. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. -func (client RouteTablesClient) Delete(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, routeTableName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RouteTablesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified route table. -// -// resourceGroupName is the name of the resource group. routeTableName is the -// name of the route table. expand is expands referenced resources. -func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) { - req, err := client.GetPreparer(resourceGroupName, routeTableName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RouteTablesClient) GetPreparer(resourceGroupName string, routeTableName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeTableName": autorest.Encode("path", routeTableName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteTable, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all route tables in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RouteTablesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RouteTablesClient) ListResponder(resp *http.Response) (result RouteTableListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { - req, err := lastResults.RouteTableListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all route tables in a subscription. -func (client RouteTablesClient) ListAll() (result RouteTableListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client RouteTablesClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client RouteTablesClient) ListAllResponder(resp *http.Response) (result RouteTableListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { - req, err := lastResults.RouteTableListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RouteTablesClient is the composite Swagger for Network Client +type RouteTablesClient struct { + ManagementClient +} + +// NewRouteTablesClient creates an instance of the RouteTablesClient client. +func NewRouteTablesClient(subscriptionID string) RouteTablesClient { + return NewRouteTablesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRouteTablesClientWithBaseURI creates an instance of the RouteTablesClient +// client. +func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) RouteTablesClient { + return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or updates a route table in a specified resource +// group. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. parameters is parameters supplied to the create or +// update route table operation. +func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (<-chan RouteTable, <-chan error) { + resultChan := make(chan RouteTable, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result RouteTable + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteTable, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified route table. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. +func (client RouteTablesClient) Delete(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, routeTableName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified route table. +// +// resourceGroupName is the name of the resource group. routeTableName is the +// name of the route table. expand is expands referenced resources. +func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) { + req, err := client.GetPreparer(resourceGroupName, routeTableName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RouteTablesClient) GetPreparer(resourceGroupName string, routeTableName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteTable, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all route tables in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RouteTablesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) ListResponder(resp *http.Response) (result RouteTableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { + req, err := lastResults.RouteTableListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all route tables in a subscription. +func (client RouteTablesClient) ListAll() (result RouteTableListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client RouteTablesClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) ListAllResponder(resp *http.Response) (result RouteTableListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { + req, err := lastResults.RouteTableListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go index 367ccb3183..3faaf007ff 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go @@ -1,452 +1,452 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// SecurityGroupsClient is the composite Swagger for Network Client -type SecurityGroupsClient struct { - ManagementClient -} - -// NewSecurityGroupsClient creates an instance of the SecurityGroupsClient -// client. -func NewSecurityGroupsClient(subscriptionID string) SecurityGroupsClient { - return NewSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSecurityGroupsClientWithBaseURI creates an instance of the -// SecurityGroupsClient client. -func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) SecurityGroupsClient { - return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a network security group in the specified -// resource group. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. -// parameters is parameters supplied to the create or update network security -// group operation. -func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (<-chan SecurityGroup, <-chan error) { - resultChan := make(chan SecurityGroup, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result SecurityGroup - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified network security group. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. -func (client SecurityGroupsClient) Delete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified network security group. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. expand -// is expands referenced resources. -func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { - req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SecurityGroupsClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result SecurityGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all network security groups in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SecurityGroupsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SecurityGroupsClient) ListResponder(resp *http.Response) (result SecurityGroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { - req, err := lastResults.SecurityGroupListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all network security groups in a subscription. -func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client SecurityGroupsClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client SecurityGroupsClient) ListAllResponder(resp *http.Response) (result SecurityGroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { - req, err := lastResults.SecurityGroupListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// SecurityGroupsClient is the composite Swagger for Network Client +type SecurityGroupsClient struct { + ManagementClient +} + +// NewSecurityGroupsClient creates an instance of the SecurityGroupsClient +// client. +func NewSecurityGroupsClient(subscriptionID string) SecurityGroupsClient { + return NewSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityGroupsClientWithBaseURI creates an instance of the +// SecurityGroupsClient client. +func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) SecurityGroupsClient { + return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network security group in the specified +// resource group. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. +// parameters is parameters supplied to the create or update network security +// group operation. +func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (<-chan SecurityGroup, <-chan error) { + resultChan := make(chan SecurityGroup, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result SecurityGroup + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network security group. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. +func (client SecurityGroupsClient) Delete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified network security group. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. expand +// is expands referenced resources. +func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { + req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityGroupsClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result SecurityGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network security groups in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecurityGroupsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) ListResponder(resp *http.Response) (result SecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { + req, err := lastResults.SecurityGroupListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all network security groups in a subscription. +func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client SecurityGroupsClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) ListAllResponder(resp *http.Response) (result SecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { + req, err := lastResults.SecurityGroupListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go index b27450d437..2e2738605f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go @@ -1,383 +1,383 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SecurityRulesClient is the composite Swagger for Network Client -type SecurityRulesClient struct { - ManagementClient -} - -// NewSecurityRulesClient creates an instance of the SecurityRulesClient -// client. -func NewSecurityRulesClient(subscriptionID string) SecurityRulesClient { - return NewSecurityRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSecurityRulesClientWithBaseURI creates an instance of the -// SecurityRulesClient client. -func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) SecurityRulesClient { - return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a security rule in the specified network -// security group. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. -// securityRuleName is the name of the security rule. securityRuleParameters is -// parameters supplied to the create or update network security rule operation. -func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (<-chan SecurityRule, <-chan error) { - resultChan := make(chan SecurityRule, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: securityRuleParameters, - Constraints: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat.SourceAddressPrefix", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "securityRuleParameters.SecurityRulePropertiesFormat.DestinationAddressPrefix", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.SecurityRulesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result SecurityRule - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityRuleName": autorest.Encode("path", securityRuleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), - autorest.WithJSON(securityRuleParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified network security rule. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. -// securityRuleName is the name of the security rule. -func (client SecurityRulesClient) Delete(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityRuleName": autorest.Encode("path", securityRuleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the specified network security rule. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. -// securityRuleName is the name of the security rule. -func (client SecurityRulesClient) Get(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) { - req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, securityRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SecurityRulesClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityRuleName": autorest.Encode("path", securityRuleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SecurityRulesClient) GetResponder(resp *http.Response) (result SecurityRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all security rules in a network security group. -// -// resourceGroupName is the name of the resource group. -// networkSecurityGroupName is the name of the network security group. -func (client SecurityRulesClient) List(resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, networkSecurityGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SecurityRulesClient) ListPreparer(resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SecurityRulesClient) ListResponder(resp *http.Response) (result SecurityRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { - req, err := lastResults.SecurityRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SecurityRulesClient is the composite Swagger for Network Client +type SecurityRulesClient struct { + ManagementClient +} + +// NewSecurityRulesClient creates an instance of the SecurityRulesClient +// client. +func NewSecurityRulesClient(subscriptionID string) SecurityRulesClient { + return NewSecurityRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityRulesClientWithBaseURI creates an instance of the +// SecurityRulesClient client. +func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) SecurityRulesClient { + return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a security rule in the specified network +// security group. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. +// securityRuleName is the name of the security rule. securityRuleParameters is +// parameters supplied to the create or update network security rule operation. +func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (<-chan SecurityRule, <-chan error) { + resultChan := make(chan SecurityRule, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: securityRuleParameters, + Constraints: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat.SourceAddressPrefix", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "securityRuleParameters.SecurityRulePropertiesFormat.DestinationAddressPrefix", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.SecurityRulesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result SecurityRule + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityRuleName": autorest.Encode("path", securityRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), + autorest.WithJSON(securityRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network security rule. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. +// securityRuleName is the name of the security rule. +func (client SecurityRulesClient) Delete(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityRuleName": autorest.Encode("path", securityRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified network security rule. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. +// securityRuleName is the name of the security rule. +func (client SecurityRulesClient) Get(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) { + req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, securityRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityRulesClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityRuleName": autorest.Encode("path", securityRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) GetResponder(resp *http.Response) (result SecurityRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all security rules in a network security group. +// +// resourceGroupName is the name of the resource group. +// networkSecurityGroupName is the name of the network security group. +func (client SecurityRulesClient) List(resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, networkSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecurityRulesClient) ListPreparer(resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) ListResponder(resp *http.Response) (result SecurityRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { + req, err := lastResults.SecurityRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go index 2cea5b2ce8..7d6ff882ae 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go @@ -1,369 +1,369 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// SubnetsClient is the composite Swagger for Network Client -type SubnetsClient struct { - ManagementClient -} - -// NewSubnetsClient creates an instance of the SubnetsClient client. -func NewSubnetsClient(subscriptionID string) SubnetsClient { - return NewSubnetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubnetsClientWithBaseURI creates an instance of the SubnetsClient client. -func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsClient { - return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a subnet in the specified virtual network. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. subnetName is the name of the subnet. -// subnetParameters is parameters supplied to the create or update subnet -// operation. -func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (<-chan Subnet, <-chan error) { - resultChan := make(chan Subnet, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Subnet - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subnetName": autorest.Encode("path", subnetName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), - autorest.WithJSON(subnetParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result Subnet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified subnet. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. subnetName is the name of the subnet. -func (client SubnetsClient) Delete(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, subnetName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subnetName": autorest.Encode("path", subnetName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubnetsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified subnet by virtual network and resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. subnetName is the name of the subnet. -// expand is expands referenced resources. -func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) { - req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, subnetName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubnetsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subnetName": autorest.Encode("path", subnetName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all subnets in a virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. -func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, virtualNetworkName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SubnetsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SubnetsClient) ListResponder(resp *http.Response) (result SubnetListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) { - req, err := lastResults.SubnetListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// SubnetsClient is the composite Swagger for Network Client +type SubnetsClient struct { + ManagementClient +} + +// NewSubnetsClient creates an instance of the SubnetsClient client. +func NewSubnetsClient(subscriptionID string) SubnetsClient { + return NewSubnetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubnetsClientWithBaseURI creates an instance of the SubnetsClient client. +func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsClient { + return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a subnet in the specified virtual network. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. subnetName is the name of the subnet. +// subnetParameters is parameters supplied to the create or update subnet +// operation. +func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (<-chan Subnet, <-chan error) { + resultChan := make(chan Subnet, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Subnet + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), + autorest.WithJSON(subnetParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result Subnet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified subnet. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. subnetName is the name of the subnet. +func (client SubnetsClient) Delete(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, subnetName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified subnet by virtual network and resource group. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. subnetName is the name of the subnet. +// expand is expands referenced resources. +func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) { + req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, subnetName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubnetsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all subnets in a virtual network. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. +func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SubnetsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubnetsClient) ListResponder(resp *http.Response) (result SubnetListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) { + req, err := lastResults.SubnetListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go index 8050a797f9..34fa0df4b4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go @@ -1,135 +1,135 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// UsagesClient is the composite Swagger for Network Client -type UsagesClient struct { - ManagementClient -} - -// NewUsagesClient creates an instance of the UsagesClient client. -func NewUsagesClient(subscriptionID string) UsagesClient { - return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client. -func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { - return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists compute usages for a subscription. -// -// location is the location where resource usage is queried. -func (client UsagesClient) List(location string) (result UsagesListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "network.UsagesClient", "List") - } - - req, err := client.ListPreparer(location) - if err != nil { - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsagesClient) ListPreparer(location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) { - req, err := lastResults.UsagesListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// UsagesClient is the composite Swagger for Network Client +type UsagesClient struct { + ManagementClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client. +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists compute usages for a subscription. +// +// location is the location where resource usage is queried. +func (client UsagesClient) List(location string) (result UsagesListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "network.UsagesClient", "List") + } + + req, err := client.ListPreparer(location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.UsagesListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go index 789c471b86..50b836179f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go @@ -1,29 +1,29 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-network/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-network/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgatewayconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgatewayconnections.go index 5d1d8fbf1d..13e1392d28 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgatewayconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgatewayconnections.go @@ -1,652 +1,652 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualNetworkGatewayConnectionsClient is the composite Swagger for Network -// Client -type VirtualNetworkGatewayConnectionsClient struct { - ManagementClient -} - -// NewVirtualNetworkGatewayConnectionsClient creates an instance of the -// VirtualNetworkGatewayConnectionsClient client. -func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string) VirtualNetworkGatewayConnectionsClient { - return NewVirtualNetworkGatewayConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkGatewayConnectionsClientWithBaseURI creates an instance of -// the VirtualNetworkGatewayConnectionsClient client. -func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewayConnectionsClient { - return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a virtual network gateway connection in -// the specified resource group. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayConnectionName is the name of the virtual network -// gateway connection. parameters is parameters supplied to the create or -// update virtual network gateway connection operation. -func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (<-chan VirtualNetworkGatewayConnection, <-chan error) { - resultChan := make(chan VirtualNetworkGatewayConnection, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result VirtualNetworkGatewayConnection - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified virtual network Gateway connection. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayConnectionName is the name of the virtual network -// gateway connection. -func (client VirtualNetworkGatewayConnectionsClient) Delete(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified virtual network gateway connection by resource group. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayConnectionName is the name of the virtual network -// gateway connection. -func (client VirtualNetworkGatewayConnectionsClient) Get(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { - req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSharedKey the Get VirtualNetworkGatewayConnectionSharedKey operation -// retrieves information about the specified virtual network gateway connection -// shared key through Network resource provider. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayConnectionName is the virtual network gateway -// connection shared key name. -func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) { - req, err := client.GetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request") - return - } - - resp, err := client.GetSharedKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure sending request") - return - } - - result, err = client.GetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure responding to request") - } - - return -} - -// GetSharedKeyPreparer prepares the GetSharedKey request. -func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSharedKeySender sends the GetSharedKey request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSharedKeyResponder handles the response to the GetSharedKey request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the List VirtualNetworkGatewayConnections operation retrieves all the -// virtual network gateways connections created. -// -// resourceGroupName is the name of the resource group. -func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName string) (result VirtualNetworkGatewayConnectionListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayConnectionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) { - req, err := lastResults.VirtualNetworkGatewayConnectionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ResetSharedKey the VirtualNetworkGatewayConnectionResetSharedKey operation -// resets the virtual network gateway connection shared key for passed virtual -// network gateway connection in the specified resource group through Network -// resource provider. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayConnectionName is the virtual network gateway -// connection reset shared key Name. parameters is parameters supplied to the -// begin reset virtual network gateway connection shared key operation through -// network resource provider. -func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (<-chan ConnectionResetSharedKey, <-chan error) { - resultChan := make(chan ConnectionResetSharedKey, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil}, - {Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ConnectionResetSharedKey - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request") - return - } - - resp, err := client.ResetSharedKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure sending request") - return - } - - result, err = client.ResetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ResetSharedKeyPreparer prepares the ResetSharedKey request. -func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResetSharedKeySender sends the ResetSharedKey request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(resp *http.Response) (result ConnectionResetSharedKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetSharedKey the Put VirtualNetworkGatewayConnectionSharedKey operation sets -// the virtual network gateway connection shared key for passed virtual network -// gateway connection in the specified resource group through Network resource -// provider. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayConnectionName is the virtual network gateway -// connection name. parameters is parameters supplied to the Begin Set Virtual -// Network Gateway connection Shared key operation throughNetwork resource -// provider. -func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (<-chan ConnectionSharedKey, <-chan error) { - resultChan := make(chan ConnectionSharedKey, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ConnectionSharedKey - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request") - return - } - - resp, err := client.SetSharedKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure sending request") - return - } - - result, err = client.SetSharedKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// SetSharedKeyPreparer prepares the SetSharedKey request. -func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SetSharedKeySender sends the SetSharedKey request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SetSharedKeyResponder handles the response to the SetSharedKey request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualNetworkGatewayConnectionsClient is the composite Swagger for Network +// Client +type VirtualNetworkGatewayConnectionsClient struct { + ManagementClient +} + +// NewVirtualNetworkGatewayConnectionsClient creates an instance of the +// VirtualNetworkGatewayConnectionsClient client. +func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string) VirtualNetworkGatewayConnectionsClient { + return NewVirtualNetworkGatewayConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkGatewayConnectionsClientWithBaseURI creates an instance of +// the VirtualNetworkGatewayConnectionsClient client. +func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewayConnectionsClient { + return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a virtual network gateway connection in +// the specified resource group. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayConnectionName is the name of the virtual network +// gateway connection. parameters is parameters supplied to the create or +// update virtual network gateway connection operation. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (<-chan VirtualNetworkGatewayConnection, <-chan error) { + resultChan := make(chan VirtualNetworkGatewayConnection, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result VirtualNetworkGatewayConnection + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network Gateway connection. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayConnectionName is the name of the virtual network +// gateway connection. +func (client VirtualNetworkGatewayConnectionsClient) Delete(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network gateway connection by resource group. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayConnectionName is the name of the virtual network +// gateway connection. +func (client VirtualNetworkGatewayConnectionsClient) Get(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { + req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSharedKey the Get VirtualNetworkGatewayConnectionSharedKey operation +// retrieves information about the specified virtual network gateway connection +// shared key through Network resource provider. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayConnectionName is the virtual network gateway +// connection shared key name. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) { + req, err := client.GetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetSharedKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure sending request") + return + } + + result, err = client.GetSharedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure responding to request") + } + + return +} + +// GetSharedKeyPreparer prepares the GetSharedKey request. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSharedKeySender sends the GetSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSharedKeyResponder handles the response to the GetSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List VirtualNetworkGatewayConnections operation retrieves all the +// virtual network gateways connections created. +// +// resourceGroupName is the name of the resource group. +func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName string) (result VirtualNetworkGatewayConnectionListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayConnectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) { + req, err := lastResults.VirtualNetworkGatewayConnectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ResetSharedKey the VirtualNetworkGatewayConnectionResetSharedKey operation +// resets the virtual network gateway connection shared key for passed virtual +// network gateway connection in the specified resource group through Network +// resource provider. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayConnectionName is the virtual network gateway +// connection reset shared key Name. parameters is parameters supplied to the +// begin reset virtual network gateway connection shared key operation through +// network resource provider. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (<-chan ConnectionResetSharedKey, <-chan error) { + resultChan := make(chan ConnectionResetSharedKey, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil}, + {Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ConnectionResetSharedKey + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request") + return + } + + resp, err := client.ResetSharedKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure sending request") + return + } + + result, err = client.ResetSharedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ResetSharedKeyPreparer prepares the ResetSharedKey request. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResetSharedKeySender sends the ResetSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(resp *http.Response) (result ConnectionResetSharedKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetSharedKey the Put VirtualNetworkGatewayConnectionSharedKey operation sets +// the virtual network gateway connection shared key for passed virtual network +// gateway connection in the specified resource group through Network resource +// provider. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayConnectionName is the virtual network gateway +// connection name. parameters is parameters supplied to the Begin Set Virtual +// Network Gateway connection Shared key operation throughNetwork resource +// provider. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (<-chan ConnectionSharedKey, <-chan error) { + resultChan := make(chan ConnectionSharedKey, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ConnectionSharedKey + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request") + return + } + + resp, err := client.SetSharedKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure sending request") + return + } + + result, err = client.SetSharedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SetSharedKeyPreparer prepares the SetSharedKey request. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SetSharedKeySender sends the SetSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SetSharedKeyResponder handles the response to the SetSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go index e970604ff4..720978e83f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go @@ -1,785 +1,785 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// VirtualNetworkGatewaysClient is the composite Swagger for Network Client -type VirtualNetworkGatewaysClient struct { - ManagementClient -} - -// NewVirtualNetworkGatewaysClient creates an instance of the -// VirtualNetworkGatewaysClient client. -func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient { - return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the -// VirtualNetworkGatewaysClient client. -func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient { - return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a virtual network gateway in the specified -// resource group. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. -// parameters is parameters supplied to create or update virtual network -// gateway operation. -func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (<-chan VirtualNetworkGateway, <-chan error) { - resultChan := make(chan VirtualNetworkGateway, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result VirtualNetworkGateway - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified virtual network gateway. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. -func (client VirtualNetworkGatewaysClient) Delete(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Generatevpnclientpackage generates VPN client package for P2S client of the -// virtual network gateway in the specified resource group. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. -// parameters is parameters supplied to the generate virtual network gateway -// VPN client package operation. -func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) { - req, err := client.GeneratevpnclientpackagePreparer(resourceGroupName, virtualNetworkGatewayName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request") - return - } - - resp, err := client.GeneratevpnclientpackageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure sending request") - return - } - - result, err = client.GeneratevpnclientpackageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure responding to request") - } - - return -} - -// GeneratevpnclientpackagePreparer prepares the Generatevpnclientpackage request. -func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the specified virtual network gateway by resource group. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. -func (client VirtualNetworkGatewaysClient) Get(resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) { - req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkGatewaysClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAdvertisedRoutes this operation retrieves a list of routes the virtual -// network gateway is advertising to the specified peer. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. peer -// is the IP address of the peer -func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (<-chan GatewayRouteListResult, <-chan error) { - resultChan := make(chan GatewayRouteListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result GatewayRouteListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetAdvertisedRoutesPreparer(resourceGroupName, virtualNetworkGatewayName, peer, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure preparing request") - return - } - - resp, err := client.GetAdvertisedRoutesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", resp, "Failure sending request") - return - } - - result, err = client.GetAdvertisedRoutesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetAdvertisedRoutesPreparer prepares the GetAdvertisedRoutes request. -func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "peer": autorest.Encode("query", peer), - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetAdvertisedRoutesResponder handles the response to the GetAdvertisedRoutes request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all -// BGP peers. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. peer -// is the IP address of the peer to retrieve the status of. -func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (<-chan BgpPeerStatusListResult, <-chan error) { - resultChan := make(chan BgpPeerStatusListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result BgpPeerStatusListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetBgpPeerStatusPreparer(resourceGroupName, virtualNetworkGatewayName, peer, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetBgpPeerStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", resp, "Failure sending request") - return - } - - result, err = client.GetBgpPeerStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetBgpPeerStatusPreparer prepares the GetBgpPeerStatus request. -func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(peer) > 0 { - queryParameters["peer"] = autorest.Encode("query", peer) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetBgpPeerStatusResponder handles the response to the GetBgpPeerStatus request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http.Response) (result BgpPeerStatusListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLearnedRoutes this operation retrieves a list of routes the virtual -// network gateway has learned, including routes learned from BGP peers. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. -func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (<-chan GatewayRouteListResult, <-chan error) { - resultChan := make(chan GatewayRouteListResult, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result GatewayRouteListResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetLearnedRoutesPreparer(resourceGroupName, virtualNetworkGatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure preparing request") - return - } - - resp, err := client.GetLearnedRoutesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", resp, "Failure sending request") - return - } - - result, err = client.GetLearnedRoutesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetLearnedRoutesPreparer prepares the GetLearnedRoutes request. -func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetLearnedRoutesResponder handles the response to the GetLearnedRoutes request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all virtual network gateways by resource group. -// -// resourceGroupName is the name of the resource group. -func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) { - req, err := lastResults.VirtualNetworkGatewayListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Reset resets the primary of the virtual network gateway in the specified -// resource group. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. -// virtualNetworkGatewayName is the name of the virtual network gateway. -// gatewayVip is virtual network gateway vip address supplied to the begin -// reset of the active-active feature enabled gateway. -func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (<-chan VirtualNetworkGateway, <-chan error) { - resultChan := make(chan VirtualNetworkGateway, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result VirtualNetworkGateway - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, gatewayVip, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request") - return - } - - resp, err := client.ResetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure sending request") - return - } - - result, err = client.ResetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ResetPreparer prepares the Reset request. -func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(gatewayVip) > 0 { - queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResetSender sends the Reset request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResetResponder handles the response to the Reset request. The method always -// closes the http.Response Body. -func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// VirtualNetworkGatewaysClient is the composite Swagger for Network Client +type VirtualNetworkGatewaysClient struct { + ManagementClient +} + +// NewVirtualNetworkGatewaysClient creates an instance of the +// VirtualNetworkGatewaysClient client. +func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient { + return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the +// VirtualNetworkGatewaysClient client. +func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient { + return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a virtual network gateway in the specified +// resource group. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. +// parameters is parameters supplied to create or update virtual network +// gateway operation. +func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (<-chan VirtualNetworkGateway, <-chan error) { + resultChan := make(chan VirtualNetworkGateway, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result VirtualNetworkGateway + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network gateway. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) Delete(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Generatevpnclientpackage generates VPN client package for P2S client of the +// virtual network gateway in the specified resource group. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. +// parameters is parameters supplied to the generate virtual network gateway +// VPN client package operation. +func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) { + req, err := client.GeneratevpnclientpackagePreparer(resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request") + return + } + + resp, err := client.GeneratevpnclientpackageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure sending request") + return + } + + result, err = client.GeneratevpnclientpackageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure responding to request") + } + + return +} + +// GeneratevpnclientpackagePreparer prepares the Generatevpnclientpackage request. +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the specified virtual network gateway by resource group. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) Get(resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) { + req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkGatewaysClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAdvertisedRoutes this operation retrieves a list of routes the virtual +// network gateway is advertising to the specified peer. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. peer +// is the IP address of the peer +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (<-chan GatewayRouteListResult, <-chan error) { + resultChan := make(chan GatewayRouteListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result GatewayRouteListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetAdvertisedRoutesPreparer(resourceGroupName, virtualNetworkGatewayName, peer, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure preparing request") + return + } + + resp, err := client.GetAdvertisedRoutesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", resp, "Failure sending request") + return + } + + result, err = client.GetAdvertisedRoutesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetAdvertisedRoutesPreparer prepares the GetAdvertisedRoutes request. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "peer": autorest.Encode("query", peer), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetAdvertisedRoutesResponder handles the response to the GetAdvertisedRoutes request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all +// BGP peers. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. peer +// is the IP address of the peer to retrieve the status of. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (<-chan BgpPeerStatusListResult, <-chan error) { + resultChan := make(chan BgpPeerStatusListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result BgpPeerStatusListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetBgpPeerStatusPreparer(resourceGroupName, virtualNetworkGatewayName, peer, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetBgpPeerStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", resp, "Failure sending request") + return + } + + result, err = client.GetBgpPeerStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetBgpPeerStatusPreparer prepares the GetBgpPeerStatus request. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(peer) > 0 { + queryParameters["peer"] = autorest.Encode("query", peer) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetBgpPeerStatusResponder handles the response to the GetBgpPeerStatus request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http.Response) (result BgpPeerStatusListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLearnedRoutes this operation retrieves a list of routes the virtual +// network gateway has learned, including routes learned from BGP peers. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (<-chan GatewayRouteListResult, <-chan error) { + resultChan := make(chan GatewayRouteListResult, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result GatewayRouteListResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetLearnedRoutesPreparer(resourceGroupName, virtualNetworkGatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure preparing request") + return + } + + resp, err := client.GetLearnedRoutesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", resp, "Failure sending request") + return + } + + result, err = client.GetLearnedRoutesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetLearnedRoutesPreparer prepares the GetLearnedRoutes request. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetLearnedRoutesResponder handles the response to the GetLearnedRoutes request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual network gateways by resource group. +// +// resourceGroupName is the name of the resource group. +func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) { + req, err := lastResults.VirtualNetworkGatewayListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Reset resets the primary of the virtual network gateway in the specified +// resource group. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. +// virtualNetworkGatewayName is the name of the virtual network gateway. +// gatewayVip is virtual network gateway vip address supplied to the begin +// reset of the active-active feature enabled gateway. +func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (<-chan VirtualNetworkGateway, <-chan error) { + resultChan := make(chan VirtualNetworkGateway, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VirtualNetworkGateway + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, gatewayVip, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request") + return + } + + resp, err := client.ResetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure sending request") + return + } + + result, err = client.ResetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ResetPreparer prepares the Reset request. +func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(gatewayVip) > 0 { + queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResetSender sends the Reset request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResetResponder handles the response to the Reset request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go index 775b31cf7f..27fafdfd0a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go @@ -1,370 +1,370 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualNetworkPeeringsClient is the composite Swagger for Network Client -type VirtualNetworkPeeringsClient struct { - ManagementClient -} - -// NewVirtualNetworkPeeringsClient creates an instance of the -// VirtualNetworkPeeringsClient client. -func NewVirtualNetworkPeeringsClient(subscriptionID string) VirtualNetworkPeeringsClient { - return NewVirtualNetworkPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkPeeringsClientWithBaseURI creates an instance of the -// VirtualNetworkPeeringsClient client. -func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkPeeringsClient { - return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a peering in the specified virtual -// network. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. virtualNetworkPeeringName is the name of -// the peering. virtualNetworkPeeringParameters is parameters supplied to the -// create or update virtual network peering operation. -func (client VirtualNetworkPeeringsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (<-chan VirtualNetworkPeering, <-chan error) { - resultChan := make(chan VirtualNetworkPeering, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result VirtualNetworkPeering - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), - autorest.WithJSON(virtualNetworkPeeringParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified virtual network peering. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. virtualNetworkPeeringName is the name of -// the virtual network peering. -func (client VirtualNetworkPeeringsClient) Delete(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkPeeringsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified virtual network peering. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. virtualNetworkPeeringName is the name of -// the virtual network peering. -func (client VirtualNetworkPeeringsClient) Get(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) { - req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkPeeringsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all virtual network peerings in a virtual network. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. -func (client VirtualNetworkPeeringsClient) List(resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, virtualNetworkName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworkPeeringsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworkPeeringsClient) ListResponder(resp *http.Response) (result VirtualNetworkPeeringListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) { - req, err := lastResults.VirtualNetworkPeeringListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualNetworkPeeringsClient is the composite Swagger for Network Client +type VirtualNetworkPeeringsClient struct { + ManagementClient +} + +// NewVirtualNetworkPeeringsClient creates an instance of the +// VirtualNetworkPeeringsClient client. +func NewVirtualNetworkPeeringsClient(subscriptionID string) VirtualNetworkPeeringsClient { + return NewVirtualNetworkPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkPeeringsClientWithBaseURI creates an instance of the +// VirtualNetworkPeeringsClient client. +func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkPeeringsClient { + return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a peering in the specified virtual +// network. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. virtualNetworkPeeringName is the name of +// the peering. virtualNetworkPeeringParameters is parameters supplied to the +// create or update virtual network peering operation. +func (client VirtualNetworkPeeringsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (<-chan VirtualNetworkPeering, <-chan error) { + resultChan := make(chan VirtualNetworkPeering, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VirtualNetworkPeering + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), + autorest.WithJSON(virtualNetworkPeeringParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network peering. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. virtualNetworkPeeringName is the name of +// the virtual network peering. +func (client VirtualNetworkPeeringsClient) Delete(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkPeeringsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network peering. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. virtualNetworkPeeringName is the name of +// the virtual network peering. +func (client VirtualNetworkPeeringsClient) Get(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) { + req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkPeeringsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual network peerings in a virtual network. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. +func (client VirtualNetworkPeeringsClient) List(resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworkPeeringsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) ListResponder(resp *http.Response) (result VirtualNetworkPeeringListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) { + req, err := lastResults.VirtualNetworkPeeringListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go index 5e54d54617..eab048c725 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go @@ -1,521 +1,521 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VirtualNetworksClient is the composite Swagger for Network Client -type VirtualNetworksClient struct { - ManagementClient -} - -// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient -// client. -func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { - return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworksClientWithBaseURI creates an instance of the -// VirtualNetworksClient client. -func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { - return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckIPAddressAvailability checks whether a private IP address is available -// for use. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. IPAddress is the private IP address to be -// verified. -func (client VirtualNetworksClient) CheckIPAddressAvailability(resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { - req, err := client.CheckIPAddressAvailabilityPreparer(resourceGroupName, virtualNetworkName, IPAddress) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckIPAddressAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckIPAddressAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. -func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(IPAddress) > 0 { - queryParameters["ipAddress"] = autorest.Encode("query", IPAddress) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a virtual network in the specified -// resource group. This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. parameters is parameters supplied to the -// create or update virtual network operation -func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { - resultChan := make(chan VirtualNetwork, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result VirtualNetwork - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified virtual network. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. -func (client VirtualNetworksClient) Delete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified virtual network by resource group. -// -// resourceGroupName is the name of the resource group. virtualNetworkName is -// the name of the virtual network. expand is expands referenced resources. -func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { - req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkName": autorest.Encode("path", virtualNetworkName), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all virtual networks in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client VirtualNetworksClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { - req, err := lastResults.VirtualNetworkListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all virtual networks in a subscription. -func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client VirtualNetworksClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { - req, err := lastResults.VirtualNetworkListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VirtualNetworksClient is the composite Swagger for Network Client +type VirtualNetworksClient struct { + ManagementClient +} + +// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient +// client. +func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { + return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworksClientWithBaseURI creates an instance of the +// VirtualNetworksClient client. +func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { + return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckIPAddressAvailability checks whether a private IP address is available +// for use. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. IPAddress is the private IP address to be +// verified. +func (client VirtualNetworksClient) CheckIPAddressAvailability(resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { + req, err := client.CheckIPAddressAvailabilityPreparer(resourceGroupName, virtualNetworkName, IPAddress) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckIPAddressAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckIPAddressAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. +func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(IPAddress) > 0 { + queryParameters["ipAddress"] = autorest.Encode("query", IPAddress) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a virtual network in the specified +// resource group. This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. parameters is parameters supplied to the +// create or update virtual network operation +func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { + resultChan := make(chan VirtualNetwork, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result VirtualNetwork + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. +func (client VirtualNetworksClient) Delete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network by resource group. +// +// resourceGroupName is the name of the resource group. virtualNetworkName is +// the name of the virtual network. expand is expands referenced resources. +func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { + req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual networks in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { + req, err := lastResults.VirtualNetworkListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all virtual networks in a subscription. +func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualNetworksClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { + req, err := lastResults.VirtualNetworkListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/watchers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/watchers.go index 969435be6a..28febf8474 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/network/watchers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/network/watchers.go @@ -1,1131 +1,1131 @@ -package network - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WatchersClient is the composite Swagger for Network Client -type WatchersClient struct { - ManagementClient -} - -// NewWatchersClient creates an instance of the WatchersClient client. -func NewWatchersClient(subscriptionID string) WatchersClient { - return NewWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWatchersClientWithBaseURI creates an instance of the WatchersClient -// client. -func NewWatchersClientWithBaseURI(baseURI string, subscriptionID string) WatchersClient { - return WatchersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a network watcher in the specified -// resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the -// network watcher resource. -func (client WatchersClient) CreateOrUpdate(resourceGroupName string, networkWatcherName string, parameters Watcher) (result Watcher, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkWatcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WatchersClient) CreateOrUpdatePreparer(resourceGroupName string, networkWatcherName string, parameters Watcher) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WatchersClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified network watcher resource. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. -func (client WatchersClient) Delete(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client WatchersClient) DeletePreparer(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified network watcher by resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. -func (client WatchersClient) Get(resourceGroupName string, networkWatcherName string) (result Watcher, err error) { - req, err := client.GetPreparer(resourceGroupName, networkWatcherName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WatchersClient) GetPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetResponder(resp *http.Response) (result Watcher, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFlowLogStatus queries status of flow log on a specified resource. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the network watcher resource group. -// networkWatcherName is the name of the network watcher resource. parameters -// is parameters that define a resource to query flow log status. -func (client WatchersClient) GetFlowLogStatus(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (<-chan FlowLogInformation, <-chan error) { - resultChan := make(chan FlowLogInformation, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetFlowLogStatus") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result FlowLogInformation - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetFlowLogStatusPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetFlowLogStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", resp, "Failure sending request") - return - } - - result, err = client.GetFlowLogStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request. -func (client WatchersClient) GetFlowLogStatusPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result FlowLogInformation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetNextHop gets the next hop from the specified VM. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the -// source and destination endpoint. -func (client WatchersClient) GetNextHop(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (<-chan NextHopResult, <-chan error) { - resultChan := make(chan NextHopResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetNextHop") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result NextHopResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetNextHopPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", nil, "Failure preparing request") - return - } - - resp, err := client.GetNextHopSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", resp, "Failure sending request") - return - } - - result, err = client.GetNextHopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetNextHopPreparer prepares the GetNextHop request. -func (client WatchersClient) GetNextHopPreparer(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetNextHopSender sends the GetNextHop request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetNextHopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetNextHopResponder handles the response to the GetNextHop request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result NextHopResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTopology gets the current network topology by resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the -// representation of topology. -func (client WatchersClient) GetTopology(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceGroupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetTopology") - } - - req, err := client.GetTopologyPreparer(resourceGroupName, networkWatcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", nil, "Failure preparing request") - return - } - - resp, err := client.GetTopologySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure sending request") - return - } - - result, err = client.GetTopologyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure responding to request") - } - - return -} - -// GetTopologyPreparer prepares the GetTopology request. -func (client WatchersClient) GetTopologyPreparer(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetTopologySender sends the GetTopology request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetTopologyResponder handles the response to the GetTopology request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTroubleshooting initiate troubleshooting on a specified resource This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher resource. parameters is parameters that -// define the resource to troubleshoot. -func (client WatchersClient) GetTroubleshooting(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (<-chan TroubleshootingResult, <-chan error) { - resultChan := make(chan TroubleshootingResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TroubleshootingProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetTroubleshooting") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result TroubleshootingResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetTroubleshootingPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", nil, "Failure preparing request") - return - } - - resp, err := client.GetTroubleshootingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", resp, "Failure sending request") - return - } - - result, err = client.GetTroubleshootingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetTroubleshootingPreparer prepares the GetTroubleshooting request. -func (client WatchersClient) GetTroubleshootingPreparer(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetTroubleshootingResponder(resp *http.Response) (result TroubleshootingResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTroubleshootingResult get the last completed troubleshooting result on a -// specified resource This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher resource. parameters is parameters that -// define the resource to query the troubleshooting result. -func (client WatchersClient) GetTroubleshootingResult(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (<-chan TroubleshootingResult, <-chan error) { - resultChan := make(chan TroubleshootingResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetTroubleshootingResult") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result TroubleshootingResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetTroubleshootingResultPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request") - return - } - - resp, err := client.GetTroubleshootingResultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", resp, "Failure sending request") - return - } - - result, err = client.GetTroubleshootingResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request. -func (client WatchersClient) GetTroubleshootingResultPreparer(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result TroubleshootingResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVMSecurityRules gets the configured and effective security group rules on -// the specified VM. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the VM -// to check security groups for. -func (client WatchersClient) GetVMSecurityRules(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (<-chan SecurityGroupViewResult, <-chan error) { - resultChan := make(chan SecurityGroupViewResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetVMSecurityRules") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result SecurityGroupViewResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetVMSecurityRulesPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", nil, "Failure preparing request") - return - } - - resp, err := client.GetVMSecurityRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", resp, "Failure sending request") - return - } - - result, err = client.GetVMSecurityRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request. -func (client WatchersClient) GetVMSecurityRulesPreparer(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always -// closes the http.Response Body. -func (client WatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result SecurityGroupViewResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all network watchers by resource group. -// -// resourceGroupName is the name of the resource group. -func (client WatchersClient) List(resourceGroupName string) (result WatcherListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WatchersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WatchersClient) ListResponder(resp *http.Response) (result WatcherListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets all network watchers by subscription. -func (client WatchersClient) ListAll() (result WatcherListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client WatchersClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client WatchersClient) ListAllResponder(resp *http.Response) (result WatcherListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetFlowLogConfiguration configures flow log on a specified resource. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the network watcher resource group. -// networkWatcherName is the name of the network watcher resource. parameters -// is parameters that define the configuration of flow log. -func (client WatchersClient) SetFlowLogConfiguration(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (<-chan FlowLogInformation, <-chan error) { - resultChan := make(chan FlowLogInformation, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "SetFlowLogConfiguration") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result FlowLogInformation - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.SetFlowLogConfigurationPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.SetFlowLogConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", resp, "Failure sending request") - return - } - - result, err = client.SetFlowLogConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request. -func (client WatchersClient) SetFlowLogConfigurationPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always -// closes the http.Response Body. -func (client WatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result FlowLogInformation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// VerifyIPFlow verify IP flow from the specified VM to a location given the -// currently configured NSG rules. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the IP -// flow to be verified. -func (client WatchersClient) VerifyIPFlow(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (<-chan VerificationIPFlowResult, <-chan error) { - resultChan := make(chan VerificationIPFlowResult, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LocalPort", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "VerifyIPFlow") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result VerificationIPFlowResult - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.VerifyIPFlowPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", nil, "Failure preparing request") - return - } - - resp, err := client.VerifyIPFlowSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", resp, "Failure sending request") - return - } - - result, err = client.VerifyIPFlowResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// VerifyIPFlowPreparer prepares the VerifyIPFlow request. -func (client WatchersClient) VerifyIPFlowPreparer(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always -// closes the http.Response Body. -func (client WatchersClient) VerifyIPFlowResponder(resp *http.Response) (result VerificationIPFlowResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WatchersClient is the composite Swagger for Network Client +type WatchersClient struct { + ManagementClient +} + +// NewWatchersClient creates an instance of the WatchersClient client. +func NewWatchersClient(subscriptionID string) WatchersClient { + return NewWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWatchersClientWithBaseURI creates an instance of the WatchersClient +// client. +func NewWatchersClientWithBaseURI(baseURI string, subscriptionID string) WatchersClient { + return WatchersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network watcher in the specified +// resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the +// network watcher resource. +func (client WatchersClient) CreateOrUpdate(resourceGroupName string, networkWatcherName string, parameters Watcher) (result Watcher, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WatchersClient) CreateOrUpdatePreparer(resourceGroupName string, networkWatcherName string, parameters Watcher) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WatchersClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network watcher resource. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. +func (client WatchersClient) Delete(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client WatchersClient) DeletePreparer(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified network watcher by resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. +func (client WatchersClient) Get(resourceGroupName string, networkWatcherName string) (result Watcher, err error) { + req, err := client.GetPreparer(resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WatchersClient) GetPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFlowLogStatus queries status of flow log on a specified resource. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the network watcher resource group. +// networkWatcherName is the name of the network watcher resource. parameters +// is parameters that define a resource to query flow log status. +func (client WatchersClient) GetFlowLogStatus(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (<-chan FlowLogInformation, <-chan error) { + resultChan := make(chan FlowLogInformation, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetFlowLogStatus") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result FlowLogInformation + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetFlowLogStatusPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetFlowLogStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", resp, "Failure sending request") + return + } + + result, err = client.GetFlowLogStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request. +func (client WatchersClient) GetFlowLogStatusPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result FlowLogInformation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNextHop gets the next hop from the specified VM. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the +// source and destination endpoint. +func (client WatchersClient) GetNextHop(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (<-chan NextHopResult, <-chan error) { + resultChan := make(chan NextHopResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetNextHop") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result NextHopResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetNextHopPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", nil, "Failure preparing request") + return + } + + resp, err := client.GetNextHopSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", resp, "Failure sending request") + return + } + + result, err = client.GetNextHopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetNextHopPreparer prepares the GetNextHop request. +func (client WatchersClient) GetNextHopPreparer(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetNextHopSender sends the GetNextHop request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetNextHopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetNextHopResponder handles the response to the GetNextHop request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result NextHopResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTopology gets the current network topology by resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the +// representation of topology. +func (client WatchersClient) GetTopology(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceGroupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetTopology") + } + + req, err := client.GetTopologyPreparer(resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", nil, "Failure preparing request") + return + } + + resp, err := client.GetTopologySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure sending request") + return + } + + result, err = client.GetTopologyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure responding to request") + } + + return +} + +// GetTopologyPreparer prepares the GetTopology request. +func (client WatchersClient) GetTopologyPreparer(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetTopologySender sends the GetTopology request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetTopologyResponder handles the response to the GetTopology request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTroubleshooting initiate troubleshooting on a specified resource This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher resource. parameters is parameters that +// define the resource to troubleshoot. +func (client WatchersClient) GetTroubleshooting(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (<-chan TroubleshootingResult, <-chan error) { + resultChan := make(chan TroubleshootingResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.TroubleshootingProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetTroubleshooting") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result TroubleshootingResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetTroubleshootingPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", nil, "Failure preparing request") + return + } + + resp, err := client.GetTroubleshootingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", resp, "Failure sending request") + return + } + + result, err = client.GetTroubleshootingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetTroubleshootingPreparer prepares the GetTroubleshooting request. +func (client WatchersClient) GetTroubleshootingPreparer(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetTroubleshootingResponder(resp *http.Response) (result TroubleshootingResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTroubleshootingResult get the last completed troubleshooting result on a +// specified resource This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher resource. parameters is parameters that +// define the resource to query the troubleshooting result. +func (client WatchersClient) GetTroubleshootingResult(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (<-chan TroubleshootingResult, <-chan error) { + resultChan := make(chan TroubleshootingResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetTroubleshootingResult") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result TroubleshootingResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetTroubleshootingResultPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request") + return + } + + resp, err := client.GetTroubleshootingResultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", resp, "Failure sending request") + return + } + + result, err = client.GetTroubleshootingResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request. +func (client WatchersClient) GetTroubleshootingResultPreparer(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result TroubleshootingResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVMSecurityRules gets the configured and effective security group rules on +// the specified VM. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the VM +// to check security groups for. +func (client WatchersClient) GetVMSecurityRules(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (<-chan SecurityGroupViewResult, <-chan error) { + resultChan := make(chan SecurityGroupViewResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "GetVMSecurityRules") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result SecurityGroupViewResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetVMSecurityRulesPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", nil, "Failure preparing request") + return + } + + resp, err := client.GetVMSecurityRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", resp, "Failure sending request") + return + } + + result, err = client.GetVMSecurityRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request. +func (client WatchersClient) GetVMSecurityRulesPreparer(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result SecurityGroupViewResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network watchers by resource group. +// +// resourceGroupName is the name of the resource group. +func (client WatchersClient) List(resourceGroupName string) (result WatcherListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WatchersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WatchersClient) ListResponder(resp *http.Response) (result WatcherListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets all network watchers by subscription. +func (client WatchersClient) ListAll() (result WatcherListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client WatchersClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client WatchersClient) ListAllResponder(resp *http.Response) (result WatcherListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetFlowLogConfiguration configures flow log on a specified resource. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the network watcher resource group. +// networkWatcherName is the name of the network watcher resource. parameters +// is parameters that define the configuration of flow log. +func (client WatchersClient) SetFlowLogConfiguration(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (<-chan FlowLogInformation, <-chan error) { + resultChan := make(chan FlowLogInformation, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "SetFlowLogConfiguration") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result FlowLogInformation + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.SetFlowLogConfigurationPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.SetFlowLogConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", resp, "Failure sending request") + return + } + + result, err = client.SetFlowLogConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request. +func (client WatchersClient) SetFlowLogConfigurationPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always +// closes the http.Response Body. +func (client WatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result FlowLogInformation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// VerifyIPFlow verify IP flow from the specified VM to a location given the +// currently configured NSG rules. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the IP +// flow to be verified. +func (client WatchersClient) VerifyIPFlow(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (<-chan VerificationIPFlowResult, <-chan error) { + resultChan := make(chan VerificationIPFlowResult, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LocalPort", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "network.WatchersClient", "VerifyIPFlow") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result VerificationIPFlowResult + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.VerifyIPFlowPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", nil, "Failure preparing request") + return + } + + resp, err := client.VerifyIPFlowSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", resp, "Failure sending request") + return + } + + result, err = client.VerifyIPFlowResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// VerifyIPFlowPreparer prepares the VerifyIPFlow request. +func (client WatchersClient) VerifyIPFlowPreparer(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always +// closes the http.Response Body. +func (client WatchersClient) VerifyIPFlowResponder(resp *http.Response) (result VerificationIPFlowResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/client.go index f53ac2ffaf..415ef6d661 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/client.go @@ -1,61 +1,61 @@ -// Package networkwatcher implements the Azure ARM Networkwatcher service API -// version 2016-12-01. -// -// The Microsoft Azure Network management API provides a RESTful set of web -// services that interact with Microsoft Azure Networks service to manage your -// network resources. The API has entities that capture the relationship -// between an end user and the Microsoft Azure Networks service. -package networkwatcher - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // APIVersion is the version of the Networkwatcher - APIVersion = "2016-12-01" - - // DefaultBaseURI is the default URI used for the service Networkwatcher - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Networkwatcher. -type ManagementClient struct { - autorest.Client - BaseURI string - APIVersion string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - APIVersion: APIVersion, - SubscriptionID: subscriptionID, - } -} +// Package networkwatcher implements the Azure ARM Networkwatcher service API +// version 2016-12-01. +// +// The Microsoft Azure Network management API provides a RESTful set of web +// services that interact with Microsoft Azure Networks service to manage your +// network resources. The API has entities that capture the relationship +// between an end user and the Microsoft Azure Networks service. +package networkwatcher + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // APIVersion is the version of the Networkwatcher + APIVersion = "2016-12-01" + + // DefaultBaseURI is the default URI used for the service Networkwatcher + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Networkwatcher. +type ManagementClient struct { + autorest.Client + BaseURI string + APIVersion string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + APIVersion: APIVersion, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/models.go index d83cf22023..6ece95b239 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/models.go @@ -1,513 +1,513 @@ -package networkwatcher - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// Access enumerates the values for access. -type Access string - -const ( - // Allow specifies the allow state for access. - Allow Access = "Allow" - // Deny specifies the deny state for access. - Deny Access = "Deny" -) - -// AssociationType enumerates the values for association type. -type AssociationType string - -const ( - // Associated specifies the associated state for association type. - Associated AssociationType = "Associated" - // Contains specifies the contains state for association type. - Contains AssociationType = "Contains" -) - -// Direction enumerates the values for direction. -type Direction string - -const ( - // Inbound specifies the inbound state for direction. - Inbound Direction = "Inbound" - // Outbound specifies the outbound state for direction. - Outbound Direction = "Outbound" -) - -// NextHopType enumerates the values for next hop type. -type NextHopType string - -const ( - // HyperNetGateway specifies the hyper net gateway state for next hop type. - HyperNetGateway NextHopType = "HyperNetGateway" - // Internet specifies the internet state for next hop type. - Internet NextHopType = "Internet" - // None specifies the none state for next hop type. - None NextHopType = "None" - // VirtualAppliance specifies the virtual appliance state for next hop - // type. - VirtualAppliance NextHopType = "VirtualAppliance" - // VirtualNetworkGateway specifies the virtual network gateway state for - // next hop type. - VirtualNetworkGateway NextHopType = "VirtualNetworkGateway" - // VnetLocal specifies the vnet local state for next hop type. - VnetLocal NextHopType = "VnetLocal" -) - -// PcError enumerates the values for pc error. -type PcError string - -const ( - // AgentStopped specifies the agent stopped state for pc error. - AgentStopped PcError = "AgentStopped" - // CaptureFailed specifies the capture failed state for pc error. - CaptureFailed PcError = "CaptureFailed" - // InternalError specifies the internal error state for pc error. - InternalError PcError = "InternalError" - // LocalFileFailed specifies the local file failed state for pc error. - LocalFileFailed PcError = "LocalFileFailed" - // StorageFailed specifies the storage failed state for pc error. - StorageFailed PcError = "StorageFailed" -) - -// PcProtocol enumerates the values for pc protocol. -type PcProtocol string - -const ( - // Any specifies the any state for pc protocol. - Any PcProtocol = "Any" - // TCP specifies the tcp state for pc protocol. - TCP PcProtocol = "TCP" - // UDP specifies the udp state for pc protocol. - UDP PcProtocol = "UDP" -) - -// PcStatus enumerates the values for pc status. -type PcStatus string - -const ( - // Error specifies the error state for pc status. - Error PcStatus = "Error" - // NotStarted specifies the not started state for pc status. - NotStarted PcStatus = "NotStarted" - // Running specifies the running state for pc status. - Running PcStatus = "Running" - // Stopped specifies the stopped state for pc status. - Stopped PcStatus = "Stopped" - // Unknown specifies the unknown state for pc status. - Unknown PcStatus = "Unknown" -) - -// Protocol enumerates the values for protocol. -type Protocol string - -const ( - // ProtocolTCP specifies the protocol tcp state for protocol. - ProtocolTCP Protocol = "TCP" - // ProtocolUDP specifies the protocol udp state for protocol. - ProtocolUDP Protocol = "UDP" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Deleting specifies the deleting state for provisioning state. - Deleting ProvisioningState = "Deleting" - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "Failed" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" - // Updating specifies the updating state for provisioning state. - Updating ProvisioningState = "Updating" -) - -// SecurityRuleAccess enumerates the values for security rule access. -type SecurityRuleAccess string - -const ( - // SecurityRuleAccessAllow specifies the security rule access allow state - // for security rule access. - SecurityRuleAccessAllow SecurityRuleAccess = "Allow" - // SecurityRuleAccessDeny specifies the security rule access deny state for - // security rule access. - SecurityRuleAccessDeny SecurityRuleAccess = "Deny" -) - -// SecurityRuleDirection enumerates the values for security rule direction. -type SecurityRuleDirection string - -const ( - // SecurityRuleDirectionInbound specifies the security rule direction - // inbound state for security rule direction. - SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" - // SecurityRuleDirectionOutbound specifies the security rule direction - // outbound state for security rule direction. - SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" -) - -// SecurityRuleProtocol enumerates the values for security rule protocol. -type SecurityRuleProtocol string - -const ( - // SecurityRuleProtocolAsterisk specifies the security rule protocol - // asterisk state for security rule protocol. - SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" - // SecurityRuleProtocolTCP specifies the security rule protocol tcp state - // for security rule protocol. - SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" - // SecurityRuleProtocolUDP specifies the security rule protocol udp state - // for security rule protocol. - SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" -) - -// EffectiveNetworkSecurityRule is effective network security rules. -type EffectiveNetworkSecurityRule struct { - Name *string `json:"name,omitempty"` - Protocol SecurityRuleProtocol `json:"protocol,omitempty"` - SourcePortRange *string `json:"sourcePortRange,omitempty"` - DestinationPortRange *string `json:"destinationPortRange,omitempty"` - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` - ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` - ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` - Access SecurityRuleAccess `json:"access,omitempty"` - Priority *int32 `json:"priority,omitempty"` - Direction SecurityRuleDirection `json:"direction,omitempty"` -} - -// FlowLogInformation is information on the configuration of flow log. -type FlowLogInformation struct { - autorest.Response `json:"-"` - TargetResourceID *string `json:"targetResourceId,omitempty"` - *FlowLogProperties `json:"properties,omitempty"` -} - -// FlowLogProperties is parameters that define the configuration of flow log. -type FlowLogProperties struct { - StorageID *string `json:"storageId,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` -} - -// FlowLogStatusParameters is parameters that define a resource to query flow -// log status. -type FlowLogStatusParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// ListResult is list of network watcher resources. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]NetworkWatcher `json:"value,omitempty"` -} - -// NetworkInterfaceAssociation is network interface and its custom security -// rules. -type NetworkInterfaceAssociation struct { - ID *string `json:"id,omitempty"` - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` -} - -// NetworkWatcher is network watcher in a resource group. -type NetworkWatcher struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *PropertiesFormat `json:"properties,omitempty"` -} - -// NextHopParameters is parameters that define the source and destination -// endpoint. -type NextHopParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - SourceIPAddress *string `json:"sourceIPAddress,omitempty"` - DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` - TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` -} - -// NextHopResult is the information about next hop from the specified VM. -type NextHopResult struct { - autorest.Response `json:"-"` - NextHopType NextHopType `json:"nextHopType,omitempty"` - NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` - RouteTableID *string `json:"routeTableId,omitempty"` -} - -// PacketCapture is parameters that define the create packet capture operation. -type PacketCapture struct { - *PacketCaptureParameters `json:"properties,omitempty"` -} - -// PacketCaptureFilter is filter that is applied to packet capture request. -// Multiple filters can be applied. -type PacketCaptureFilter struct { - Protocol PcProtocol `json:"protocol,omitempty"` - LocalIPAddress *string `json:"localIPAddress,omitempty"` - RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` - LocalPort *string `json:"localPort,omitempty"` - RemotePort *string `json:"remotePort,omitempty"` -} - -// PacketCaptureListResult is list of packet capture sessions. -type PacketCaptureListResult struct { - autorest.Response `json:"-"` - Value *[]PacketCaptureResult `json:"value,omitempty"` -} - -// PacketCaptureParameters is parameters that define the create packet capture -// operation. -type PacketCaptureParameters struct { - Target *string `json:"target,omitempty"` - BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` - TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` - TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` - StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` - Filters *[]PacketCaptureFilter `json:"filters,omitempty"` -} - -// PacketCaptureQueryStatusResult is status of packet capture session. -type PacketCaptureQueryStatusResult struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` - PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` - StopReason *string `json:"stopReason,omitempty"` - PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` -} - -// PacketCaptureResult is information about packet capture session. -type PacketCaptureResult struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Etag *string `json:"etag,omitempty"` - *PacketCaptureResultProperties `json:"properties,omitempty"` -} - -// PacketCaptureResultProperties is describes the properties of a packet -// capture session. -type PacketCaptureResultProperties struct { - Target *string `json:"target,omitempty"` - BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` - TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` - TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` - StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` - Filters *[]PacketCaptureFilter `json:"filters,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// PacketCaptureStorageLocation is describes the storage location for a packet -// capture session. -type PacketCaptureStorageLocation struct { - StorageID *string `json:"storageId,omitempty"` - StoragePath *string `json:"storagePath,omitempty"` - FilePath *string `json:"filePath,omitempty"` -} - -// PropertiesFormat is the network watcher properties. -type PropertiesFormat struct { - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// QueryTroubleshootingParameters is parameters that define the resource to -// query the troubleshooting result. -type QueryTroubleshootingParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// RetentionPolicyParameters is parameters that define the retention policy for -// flow log. -type RetentionPolicyParameters struct { - Days *int32 `json:"days,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// SecurityGroupNetworkInterface is network interface and all its associated -// security rules. -type SecurityGroupNetworkInterface struct { - ID *string `json:"id,omitempty"` - SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` -} - -// SecurityGroupViewParameters is parameters that define the VM to check -// security groups for. -type SecurityGroupViewParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` -} - -// SecurityGroupViewResult is the information about security rules applied to -// the specified VM. -type SecurityGroupViewResult struct { - autorest.Response `json:"-"` - NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` -} - -// SecurityRule is network security rule. -type SecurityRule struct { - ID *string `json:"id,omitempty"` - *SecurityRulePropertiesFormat `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// SecurityRuleAssociations is all security rules associated with the network -// interface. -type SecurityRuleAssociations struct { - NetworkInterfaceAssociation *NetworkInterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` - SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` - DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` - EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` -} - -// SecurityRulePropertiesFormat is -type SecurityRulePropertiesFormat struct { - Description *string `json:"description,omitempty"` - Protocol SecurityRuleProtocol `json:"protocol,omitempty"` - SourcePortRange *string `json:"sourcePortRange,omitempty"` - DestinationPortRange *string `json:"destinationPortRange,omitempty"` - SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` - DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` - Access SecurityRuleAccess `json:"access,omitempty"` - Priority *int32 `json:"priority,omitempty"` - Direction SecurityRuleDirection `json:"direction,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// SubnetAssociation is network interface and its custom security rules. -type SubnetAssociation struct { - ID *string `json:"id,omitempty"` - SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// Topology is topology of the specified resource group. -type Topology struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` - LastModified *date.Time `json:"lastModified,omitempty"` - Resources *[]TopologyResource `json:"resources,omitempty"` -} - -// TopologyAssociation is resources that have an association with the parent -// resource. -type TopologyAssociation struct { - Name *string `json:"name,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - AssociationType AssociationType `json:"associationType,omitempty"` -} - -// TopologyParameters is parameters that define the representation of topology. -type TopologyParameters struct { - TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` -} - -// TopologyResource is the network resource topology information for the given -// resource group. -type TopologyResource struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Associations *[]TopologyAssociation `json:"associations,omitempty"` -} - -// TroubleshootingDetails is information gained from troubleshooting of -// specified resource. -type TroubleshootingDetails struct { - ID *string `json:"id,omitempty"` - ReasonType *string `json:"reasonType,omitempty"` - Summary *string `json:"summary,omitempty"` - Detail *string `json:"detail,omitempty"` - RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` -} - -// TroubleshootingParameters is parameters that define the resource to -// troubleshoot. -type TroubleshootingParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - *TroubleshootingProperties `json:"properties,omitempty"` -} - -// TroubleshootingProperties is storage location provided for troubleshoot. -type TroubleshootingProperties struct { - StorageID *string `json:"storageId,omitempty"` - StoragePath *string `json:"storagePath,omitempty"` -} - -// TroubleshootingRecommendedActions is recommended actions based on discovered -// issues. -type TroubleshootingRecommendedActions struct { - ActionID *string `json:"actionId,omitempty"` - ActionText *string `json:"actionText,omitempty"` - ActionURI *string `json:"actionUri,omitempty"` - ActionURIText *string `json:"actionUriText,omitempty"` -} - -// TroubleshootingResult is troubleshooting information gained from specified -// resource. -type TroubleshootingResult struct { - autorest.Response `json:"-"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Code *string `json:"code,omitempty"` - Results *[]TroubleshootingDetails `json:"results,omitempty"` -} - -// VerificationIPFlowParameters is parameters that define the IP flow to be -// verified. -type VerificationIPFlowParameters struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - Direction Direction `json:"direction,omitempty"` - Protocol Protocol `json:"protocol,omitempty"` - LocalPort *string `json:"localPort,omitempty"` - RemotePort *string `json:"remotePort,omitempty"` - LocalIPAddress *string `json:"localIPAddress,omitempty"` - RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` - TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` -} - -// VerificationIPFlowResult is results of IP flow verification on the target -// resource. -type VerificationIPFlowResult struct { - autorest.Response `json:"-"` - Access Access `json:"access,omitempty"` - RuleName *string `json:"ruleName,omitempty"` -} +package networkwatcher + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// Access enumerates the values for access. +type Access string + +const ( + // Allow specifies the allow state for access. + Allow Access = "Allow" + // Deny specifies the deny state for access. + Deny Access = "Deny" +) + +// AssociationType enumerates the values for association type. +type AssociationType string + +const ( + // Associated specifies the associated state for association type. + Associated AssociationType = "Associated" + // Contains specifies the contains state for association type. + Contains AssociationType = "Contains" +) + +// Direction enumerates the values for direction. +type Direction string + +const ( + // Inbound specifies the inbound state for direction. + Inbound Direction = "Inbound" + // Outbound specifies the outbound state for direction. + Outbound Direction = "Outbound" +) + +// NextHopType enumerates the values for next hop type. +type NextHopType string + +const ( + // HyperNetGateway specifies the hyper net gateway state for next hop type. + HyperNetGateway NextHopType = "HyperNetGateway" + // Internet specifies the internet state for next hop type. + Internet NextHopType = "Internet" + // None specifies the none state for next hop type. + None NextHopType = "None" + // VirtualAppliance specifies the virtual appliance state for next hop + // type. + VirtualAppliance NextHopType = "VirtualAppliance" + // VirtualNetworkGateway specifies the virtual network gateway state for + // next hop type. + VirtualNetworkGateway NextHopType = "VirtualNetworkGateway" + // VnetLocal specifies the vnet local state for next hop type. + VnetLocal NextHopType = "VnetLocal" +) + +// PcError enumerates the values for pc error. +type PcError string + +const ( + // AgentStopped specifies the agent stopped state for pc error. + AgentStopped PcError = "AgentStopped" + // CaptureFailed specifies the capture failed state for pc error. + CaptureFailed PcError = "CaptureFailed" + // InternalError specifies the internal error state for pc error. + InternalError PcError = "InternalError" + // LocalFileFailed specifies the local file failed state for pc error. + LocalFileFailed PcError = "LocalFileFailed" + // StorageFailed specifies the storage failed state for pc error. + StorageFailed PcError = "StorageFailed" +) + +// PcProtocol enumerates the values for pc protocol. +type PcProtocol string + +const ( + // Any specifies the any state for pc protocol. + Any PcProtocol = "Any" + // TCP specifies the tcp state for pc protocol. + TCP PcProtocol = "TCP" + // UDP specifies the udp state for pc protocol. + UDP PcProtocol = "UDP" +) + +// PcStatus enumerates the values for pc status. +type PcStatus string + +const ( + // Error specifies the error state for pc status. + Error PcStatus = "Error" + // NotStarted specifies the not started state for pc status. + NotStarted PcStatus = "NotStarted" + // Running specifies the running state for pc status. + Running PcStatus = "Running" + // Stopped specifies the stopped state for pc status. + Stopped PcStatus = "Stopped" + // Unknown specifies the unknown state for pc status. + Unknown PcStatus = "Unknown" +) + +// Protocol enumerates the values for protocol. +type Protocol string + +const ( + // ProtocolTCP specifies the protocol tcp state for protocol. + ProtocolTCP Protocol = "TCP" + // ProtocolUDP specifies the protocol udp state for protocol. + ProtocolUDP Protocol = "UDP" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Deleting specifies the deleting state for provisioning state. + Deleting ProvisioningState = "Deleting" + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" + // Updating specifies the updating state for provisioning state. + Updating ProvisioningState = "Updating" +) + +// SecurityRuleAccess enumerates the values for security rule access. +type SecurityRuleAccess string + +const ( + // SecurityRuleAccessAllow specifies the security rule access allow state + // for security rule access. + SecurityRuleAccessAllow SecurityRuleAccess = "Allow" + // SecurityRuleAccessDeny specifies the security rule access deny state for + // security rule access. + SecurityRuleAccessDeny SecurityRuleAccess = "Deny" +) + +// SecurityRuleDirection enumerates the values for security rule direction. +type SecurityRuleDirection string + +const ( + // SecurityRuleDirectionInbound specifies the security rule direction + // inbound state for security rule direction. + SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" + // SecurityRuleDirectionOutbound specifies the security rule direction + // outbound state for security rule direction. + SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" +) + +// SecurityRuleProtocol enumerates the values for security rule protocol. +type SecurityRuleProtocol string + +const ( + // SecurityRuleProtocolAsterisk specifies the security rule protocol + // asterisk state for security rule protocol. + SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" + // SecurityRuleProtocolTCP specifies the security rule protocol tcp state + // for security rule protocol. + SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" + // SecurityRuleProtocolUDP specifies the security rule protocol udp state + // for security rule protocol. + SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" +) + +// EffectiveNetworkSecurityRule is effective network security rules. +type EffectiveNetworkSecurityRule struct { + Name *string `json:"name,omitempty"` + Protocol SecurityRuleProtocol `json:"protocol,omitempty"` + SourcePortRange *string `json:"sourcePortRange,omitempty"` + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` + ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` + Access SecurityRuleAccess `json:"access,omitempty"` + Priority *int32 `json:"priority,omitempty"` + Direction SecurityRuleDirection `json:"direction,omitempty"` +} + +// FlowLogInformation is information on the configuration of flow log. +type FlowLogInformation struct { + autorest.Response `json:"-"` + TargetResourceID *string `json:"targetResourceId,omitempty"` + *FlowLogProperties `json:"properties,omitempty"` +} + +// FlowLogProperties is parameters that define the configuration of flow log. +type FlowLogProperties struct { + StorageID *string `json:"storageId,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` +} + +// FlowLogStatusParameters is parameters that define a resource to query flow +// log status. +type FlowLogStatusParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// ListResult is list of network watcher resources. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]NetworkWatcher `json:"value,omitempty"` +} + +// NetworkInterfaceAssociation is network interface and its custom security +// rules. +type NetworkInterfaceAssociation struct { + ID *string `json:"id,omitempty"` + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// NetworkWatcher is network watcher in a resource group. +type NetworkWatcher struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *PropertiesFormat `json:"properties,omitempty"` +} + +// NextHopParameters is parameters that define the source and destination +// endpoint. +type NextHopParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + SourceIPAddress *string `json:"sourceIPAddress,omitempty"` + DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// NextHopResult is the information about next hop from the specified VM. +type NextHopResult struct { + autorest.Response `json:"-"` + NextHopType NextHopType `json:"nextHopType,omitempty"` + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + RouteTableID *string `json:"routeTableId,omitempty"` +} + +// PacketCapture is parameters that define the create packet capture operation. +type PacketCapture struct { + *PacketCaptureParameters `json:"properties,omitempty"` +} + +// PacketCaptureFilter is filter that is applied to packet capture request. +// Multiple filters can be applied. +type PacketCaptureFilter struct { + Protocol PcProtocol `json:"protocol,omitempty"` + LocalIPAddress *string `json:"localIPAddress,omitempty"` + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + LocalPort *string `json:"localPort,omitempty"` + RemotePort *string `json:"remotePort,omitempty"` +} + +// PacketCaptureListResult is list of packet capture sessions. +type PacketCaptureListResult struct { + autorest.Response `json:"-"` + Value *[]PacketCaptureResult `json:"value,omitempty"` +} + +// PacketCaptureParameters is parameters that define the create packet capture +// operation. +type PacketCaptureParameters struct { + Target *string `json:"target,omitempty"` + BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` + TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` +} + +// PacketCaptureQueryStatusResult is status of packet capture session. +type PacketCaptureQueryStatusResult struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` + PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` + StopReason *string `json:"stopReason,omitempty"` + PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` +} + +// PacketCaptureResult is information about packet capture session. +type PacketCaptureResult struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Etag *string `json:"etag,omitempty"` + *PacketCaptureResultProperties `json:"properties,omitempty"` +} + +// PacketCaptureResultProperties is describes the properties of a packet +// capture session. +type PacketCaptureResultProperties struct { + Target *string `json:"target,omitempty"` + BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"` + TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"` + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// PacketCaptureStorageLocation is describes the storage location for a packet +// capture session. +type PacketCaptureStorageLocation struct { + StorageID *string `json:"storageId,omitempty"` + StoragePath *string `json:"storagePath,omitempty"` + FilePath *string `json:"filePath,omitempty"` +} + +// PropertiesFormat is the network watcher properties. +type PropertiesFormat struct { + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// QueryTroubleshootingParameters is parameters that define the resource to +// query the troubleshooting result. +type QueryTroubleshootingParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// RetentionPolicyParameters is parameters that define the retention policy for +// flow log. +type RetentionPolicyParameters struct { + Days *int32 `json:"days,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// SecurityGroupNetworkInterface is network interface and all its associated +// security rules. +type SecurityGroupNetworkInterface struct { + ID *string `json:"id,omitempty"` + SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` +} + +// SecurityGroupViewParameters is parameters that define the VM to check +// security groups for. +type SecurityGroupViewParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// SecurityGroupViewResult is the information about security rules applied to +// the specified VM. +type SecurityGroupViewResult struct { + autorest.Response `json:"-"` + NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` +} + +// SecurityRule is network security rule. +type SecurityRule struct { + ID *string `json:"id,omitempty"` + *SecurityRulePropertiesFormat `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// SecurityRuleAssociations is all security rules associated with the network +// interface. +type SecurityRuleAssociations struct { + NetworkInterfaceAssociation *NetworkInterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` + SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` +} + +// SecurityRulePropertiesFormat is +type SecurityRulePropertiesFormat struct { + Description *string `json:"description,omitempty"` + Protocol SecurityRuleProtocol `json:"protocol,omitempty"` + SourcePortRange *string `json:"sourcePortRange,omitempty"` + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + Access SecurityRuleAccess `json:"access,omitempty"` + Priority *int32 `json:"priority,omitempty"` + Direction SecurityRuleDirection `json:"direction,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// SubnetAssociation is network interface and its custom security rules. +type SubnetAssociation struct { + ID *string `json:"id,omitempty"` + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// Topology is topology of the specified resource group. +type Topology struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + Resources *[]TopologyResource `json:"resources,omitempty"` +} + +// TopologyAssociation is resources that have an association with the parent +// resource. +type TopologyAssociation struct { + Name *string `json:"name,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + AssociationType AssociationType `json:"associationType,omitempty"` +} + +// TopologyParameters is parameters that define the representation of topology. +type TopologyParameters struct { + TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` +} + +// TopologyResource is the network resource topology information for the given +// resource group. +type TopologyResource struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Associations *[]TopologyAssociation `json:"associations,omitempty"` +} + +// TroubleshootingDetails is information gained from troubleshooting of +// specified resource. +type TroubleshootingDetails struct { + ID *string `json:"id,omitempty"` + ReasonType *string `json:"reasonType,omitempty"` + Summary *string `json:"summary,omitempty"` + Detail *string `json:"detail,omitempty"` + RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` +} + +// TroubleshootingParameters is parameters that define the resource to +// troubleshoot. +type TroubleshootingParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + *TroubleshootingProperties `json:"properties,omitempty"` +} + +// TroubleshootingProperties is storage location provided for troubleshoot. +type TroubleshootingProperties struct { + StorageID *string `json:"storageId,omitempty"` + StoragePath *string `json:"storagePath,omitempty"` +} + +// TroubleshootingRecommendedActions is recommended actions based on discovered +// issues. +type TroubleshootingRecommendedActions struct { + ActionID *string `json:"actionId,omitempty"` + ActionText *string `json:"actionText,omitempty"` + ActionURI *string `json:"actionUri,omitempty"` + ActionURIText *string `json:"actionUriText,omitempty"` +} + +// TroubleshootingResult is troubleshooting information gained from specified +// resource. +type TroubleshootingResult struct { + autorest.Response `json:"-"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Code *string `json:"code,omitempty"` + Results *[]TroubleshootingDetails `json:"results,omitempty"` +} + +// VerificationIPFlowParameters is parameters that define the IP flow to be +// verified. +type VerificationIPFlowParameters struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + Direction Direction `json:"direction,omitempty"` + Protocol Protocol `json:"protocol,omitempty"` + LocalPort *string `json:"localPort,omitempty"` + RemotePort *string `json:"remotePort,omitempty"` + LocalIPAddress *string `json:"localIPAddress,omitempty"` + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// VerificationIPFlowResult is results of IP flow verification on the target +// resource. +type VerificationIPFlowResult struct { + autorest.Response `json:"-"` + Access Access `json:"access,omitempty"` + RuleName *string `json:"ruleName,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/networkwatchers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/networkwatchers.go index 72de731cef..9e6a89443a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/networkwatchers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/networkwatchers.go @@ -1,981 +1,981 @@ -package networkwatcher - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NetworkWatchersClient is the the Microsoft Azure Network management API -// provides a RESTful set of web services that interact with Microsoft Azure -// Networks service to manage your network resources. The API has entities that -// capture the relationship between an end user and the Microsoft Azure -// Networks service. -type NetworkWatchersClient struct { - ManagementClient -} - -// NewNetworkWatchersClient creates an instance of the NetworkWatchersClient -// client. -func NewNetworkWatchersClient(subscriptionID string) NetworkWatchersClient { - return NewNetworkWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNetworkWatchersClientWithBaseURI creates an instance of the -// NetworkWatchersClient client. -func NewNetworkWatchersClientWithBaseURI(baseURI string, subscriptionID string) NetworkWatchersClient { - return NetworkWatchersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a network watcher in the specified -// resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the -// network watcher resource. -func (client NetworkWatchersClient) CreateOrUpdate(resourceGroupName string, networkWatcherName string, parameters NetworkWatcher) (result NetworkWatcher, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkWatcherName, parameters) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", nil, "Failure preparing request") - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", resp, "Failure sending request") - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NetworkWatchersClient) CreateOrUpdatePreparer(resourceGroupName string, networkWatcherName string, parameters NetworkWatcher) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) CreateOrUpdateResponder(resp *http.Response) (result NetworkWatcher, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified network watcher resource. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. -func (client NetworkWatchersClient) Delete(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", nil, "Failure preparing request") - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", resp, "Failure sending request") - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NetworkWatchersClient) DeletePreparer(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified network watcher by resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. -func (client NetworkWatchersClient) Get(resourceGroupName string, networkWatcherName string) (result NetworkWatcher, err error) { - req, err := client.GetPreparer(resourceGroupName, networkWatcherName) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", nil, "Failure preparing request") - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", resp, "Failure sending request") - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NetworkWatchersClient) GetPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetResponder(resp *http.Response) (result NetworkWatcher, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFlowLogStatus queries status of flow log on a specified resource. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the network watcher resource group. -// networkWatcherName is the name of the network watcher resource. parameters -// is parameters that define a resource to query flow log status. -func (client NetworkWatchersClient) GetFlowLogStatus(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus") - } - - req, err := client.GetFlowLogStatusPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", nil, "Failure preparing request") - } - - resp, err := client.GetFlowLogStatusSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", resp, "Failure sending request") - } - - result, err = client.GetFlowLogStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", resp, "Failure responding to request") - } - - return -} - -// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request. -func (client NetworkWatchersClient) GetFlowLogStatusPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetFlowLogStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetNextHop gets the next hop from the specified VM. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the -// source and destination endpoint. -func (client NetworkWatchersClient) GetNextHop(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop") - } - - req, err := client.GetNextHopPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", nil, "Failure preparing request") - } - - resp, err := client.GetNextHopSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", resp, "Failure sending request") - } - - result, err = client.GetNextHopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", resp, "Failure responding to request") - } - - return -} - -// GetNextHopPreparer prepares the GetNextHop request. -func (client NetworkWatchersClient) GetNextHopPreparer(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetNextHopSender sends the GetNextHop request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetNextHopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetNextHopResponder handles the response to the GetNextHop request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetNextHopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetTopology gets the current network topology by resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the -// representation of topology. -func (client NetworkWatchersClient) GetTopology(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceGroupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTopology") - } - - req, err := client.GetTopologyPreparer(resourceGroupName, networkWatcherName, parameters) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", nil, "Failure preparing request") - } - - resp, err := client.GetTopologySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", resp, "Failure sending request") - } - - result, err = client.GetTopologyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", resp, "Failure responding to request") - } - - return -} - -// GetTopologyPreparer prepares the GetTopology request. -func (client NetworkWatchersClient) GetTopologyPreparer(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetTopologySender sends the GetTopology request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetTopologyResponder handles the response to the GetTopology request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTroubleshooting initiate troubleshooting on a specified resource This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher resource. parameters is parameters that -// define the resource to troubleshoot. -func (client NetworkWatchersClient) GetTroubleshooting(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TroubleshootingProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting") - } - - req, err := client.GetTroubleshootingPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", nil, "Failure preparing request") - } - - resp, err := client.GetTroubleshootingSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", resp, "Failure sending request") - } - - result, err = client.GetTroubleshootingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", resp, "Failure responding to request") - } - - return -} - -// GetTroubleshootingPreparer prepares the GetTroubleshooting request. -func (client NetworkWatchersClient) GetTroubleshootingPreparer(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetTroubleshootingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetTroubleshootingResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetTroubleshootingResult get the last completed troubleshooting result on a -// specified resource This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher resource. parameters is parameters that -// define the resource to query the troubleshooting result. -func (client NetworkWatchersClient) GetTroubleshootingResult(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult") - } - - req, err := client.GetTroubleshootingResultPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request") - } - - resp, err := client.GetTroubleshootingResultSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", resp, "Failure sending request") - } - - result, err = client.GetTroubleshootingResultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", resp, "Failure responding to request") - } - - return -} - -// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request. -func (client NetworkWatchersClient) GetTroubleshootingResultPreparer(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetTroubleshootingResultSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetVMSecurityRules gets the configured and effective security group rules on -// the specified VM. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the VM -// to check security groups for. -func (client NetworkWatchersClient) GetVMSecurityRules(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules") - } - - req, err := client.GetVMSecurityRulesPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", nil, "Failure preparing request") - } - - resp, err := client.GetVMSecurityRulesSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", resp, "Failure sending request") - } - - result, err = client.GetVMSecurityRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", resp, "Failure responding to request") - } - - return -} - -// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request. -func (client NetworkWatchersClient) GetVMSecurityRulesPreparer(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) GetVMSecurityRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List gets all network watchers by resource group. -// -// resourceGroupName is the name of the resource group. -func (client NetworkWatchersClient) List(resourceGroupName string) (result ListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", nil, "Failure preparing request") - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", resp, "Failure sending request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client NetworkWatchersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets all network watchers by subscription. -func (client NetworkWatchersClient) ListAll() (result ListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", nil, "Failure preparing request") - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", resp, "Failure sending request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client NetworkWatchersClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) ListAllResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetFlowLogConfiguration configures flow log on a specified resource. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the network watcher resource group. -// networkWatcherName is the name of the network watcher resource. parameters -// is parameters that define the configuration of flow log. -func (client NetworkWatchersClient) SetFlowLogConfiguration(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration") - } - - req, err := client.SetFlowLogConfigurationPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request") - } - - resp, err := client.SetFlowLogConfigurationSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", resp, "Failure sending request") - } - - result, err = client.SetFlowLogConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", resp, "Failure responding to request") - } - - return -} - -// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request. -func (client NetworkWatchersClient) SetFlowLogConfigurationPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) SetFlowLogConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// VerifyIPFlow verify IP flow from the specified VM to a location given the -// currently configured NSG rules. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. parameters is parameters that define the IP -// flow to be verified. -func (client NetworkWatchersClient) VerifyIPFlow(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LocalPort", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow") - } - - req, err := client.VerifyIPFlowPreparer(resourceGroupName, networkWatcherName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", nil, "Failure preparing request") - } - - resp, err := client.VerifyIPFlowSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", resp, "Failure sending request") - } - - result, err = client.VerifyIPFlowResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", resp, "Failure responding to request") - } - - return -} - -// VerifyIPFlowPreparer prepares the VerifyIPFlow request. -func (client NetworkWatchersClient) VerifyIPFlowPreparer(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the -// http.Response Body if it receives an error. -func (client NetworkWatchersClient) VerifyIPFlowSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always -// closes the http.Response Body. -func (client NetworkWatchersClient) VerifyIPFlowResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package networkwatcher + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NetworkWatchersClient is the the Microsoft Azure Network management API +// provides a RESTful set of web services that interact with Microsoft Azure +// Networks service to manage your network resources. The API has entities that +// capture the relationship between an end user and the Microsoft Azure +// Networks service. +type NetworkWatchersClient struct { + ManagementClient +} + +// NewNetworkWatchersClient creates an instance of the NetworkWatchersClient +// client. +func NewNetworkWatchersClient(subscriptionID string) NetworkWatchersClient { + return NewNetworkWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNetworkWatchersClientWithBaseURI creates an instance of the +// NetworkWatchersClient client. +func NewNetworkWatchersClientWithBaseURI(baseURI string, subscriptionID string) NetworkWatchersClient { + return NetworkWatchersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network watcher in the specified +// resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the +// network watcher resource. +func (client NetworkWatchersClient) CreateOrUpdate(resourceGroupName string, networkWatcherName string, parameters NetworkWatcher) (result NetworkWatcher, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkWatcherName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", nil, "Failure preparing request") + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", resp, "Failure sending request") + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NetworkWatchersClient) CreateOrUpdatePreparer(resourceGroupName string, networkWatcherName string, parameters NetworkWatcher) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) CreateOrUpdateResponder(resp *http.Response) (result NetworkWatcher, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network watcher resource. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. +func (client NetworkWatchersClient) Delete(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NetworkWatchersClient) DeletePreparer(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified network watcher by resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. +func (client NetworkWatchersClient) Get(resourceGroupName string, networkWatcherName string) (result NetworkWatcher, err error) { + req, err := client.GetPreparer(resourceGroupName, networkWatcherName) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NetworkWatchersClient) GetPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetResponder(resp *http.Response) (result NetworkWatcher, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFlowLogStatus queries status of flow log on a specified resource. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the network watcher resource group. +// networkWatcherName is the name of the network watcher resource. parameters +// is parameters that define a resource to query flow log status. +func (client NetworkWatchersClient) GetFlowLogStatus(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus") + } + + req, err := client.GetFlowLogStatusPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", nil, "Failure preparing request") + } + + resp, err := client.GetFlowLogStatusSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", resp, "Failure sending request") + } + + result, err = client.GetFlowLogStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", resp, "Failure responding to request") + } + + return +} + +// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request. +func (client NetworkWatchersClient) GetFlowLogStatusPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetFlowLogStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetNextHop gets the next hop from the specified VM. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the +// source and destination endpoint. +func (client NetworkWatchersClient) GetNextHop(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop") + } + + req, err := client.GetNextHopPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", nil, "Failure preparing request") + } + + resp, err := client.GetNextHopSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", resp, "Failure sending request") + } + + result, err = client.GetNextHopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", resp, "Failure responding to request") + } + + return +} + +// GetNextHopPreparer prepares the GetNextHop request. +func (client NetworkWatchersClient) GetNextHopPreparer(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetNextHopSender sends the GetNextHop request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetNextHopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetNextHopResponder handles the response to the GetNextHop request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetNextHopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetTopology gets the current network topology by resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the +// representation of topology. +func (client NetworkWatchersClient) GetTopology(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceGroupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTopology") + } + + req, err := client.GetTopologyPreparer(resourceGroupName, networkWatcherName, parameters) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", nil, "Failure preparing request") + } + + resp, err := client.GetTopologySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", resp, "Failure sending request") + } + + result, err = client.GetTopologyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", resp, "Failure responding to request") + } + + return +} + +// GetTopologyPreparer prepares the GetTopology request. +func (client NetworkWatchersClient) GetTopologyPreparer(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetTopologySender sends the GetTopology request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetTopologyResponder handles the response to the GetTopology request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTroubleshooting initiate troubleshooting on a specified resource This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher resource. parameters is parameters that +// define the resource to troubleshoot. +func (client NetworkWatchersClient) GetTroubleshooting(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.TroubleshootingProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting") + } + + req, err := client.GetTroubleshootingPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", nil, "Failure preparing request") + } + + resp, err := client.GetTroubleshootingSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", resp, "Failure sending request") + } + + result, err = client.GetTroubleshootingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", resp, "Failure responding to request") + } + + return +} + +// GetTroubleshootingPreparer prepares the GetTroubleshooting request. +func (client NetworkWatchersClient) GetTroubleshootingPreparer(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetTroubleshootingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetTroubleshootingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetTroubleshootingResult get the last completed troubleshooting result on a +// specified resource This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher resource. parameters is parameters that +// define the resource to query the troubleshooting result. +func (client NetworkWatchersClient) GetTroubleshootingResult(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult") + } + + req, err := client.GetTroubleshootingResultPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request") + } + + resp, err := client.GetTroubleshootingResultSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", resp, "Failure sending request") + } + + result, err = client.GetTroubleshootingResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", resp, "Failure responding to request") + } + + return +} + +// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request. +func (client NetworkWatchersClient) GetTroubleshootingResultPreparer(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetTroubleshootingResultSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetVMSecurityRules gets the configured and effective security group rules on +// the specified VM. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the VM +// to check security groups for. +func (client NetworkWatchersClient) GetVMSecurityRules(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules") + } + + req, err := client.GetVMSecurityRulesPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", nil, "Failure preparing request") + } + + resp, err := client.GetVMSecurityRulesSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", resp, "Failure sending request") + } + + result, err = client.GetVMSecurityRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", resp, "Failure responding to request") + } + + return +} + +// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request. +func (client NetworkWatchersClient) GetVMSecurityRulesPreparer(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) GetVMSecurityRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// List gets all network watchers by resource group. +// +// resourceGroupName is the name of the resource group. +func (client NetworkWatchersClient) List(resourceGroupName string) (result ListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client NetworkWatchersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets all network watchers by subscription. +func (client NetworkWatchersClient) ListAll() (result ListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", nil, "Failure preparing request") + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", resp, "Failure sending request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client NetworkWatchersClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) ListAllResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetFlowLogConfiguration configures flow log on a specified resource. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the network watcher resource group. +// networkWatcherName is the name of the network watcher resource. parameters +// is parameters that define the configuration of flow log. +func (client NetworkWatchersClient) SetFlowLogConfiguration(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowLogProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration") + } + + req, err := client.SetFlowLogConfigurationPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request") + } + + resp, err := client.SetFlowLogConfigurationSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", resp, "Failure sending request") + } + + result, err = client.SetFlowLogConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", resp, "Failure responding to request") + } + + return +} + +// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request. +func (client NetworkWatchersClient) SetFlowLogConfigurationPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) SetFlowLogConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// VerifyIPFlow verify IP flow from the specified VM to a location given the +// currently configured NSG rules. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. parameters is parameters that define the IP +// flow to be verified. +func (client NetworkWatchersClient) VerifyIPFlow(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LocalPort", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow") + } + + req, err := client.VerifyIPFlowPreparer(resourceGroupName, networkWatcherName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", nil, "Failure preparing request") + } + + resp, err := client.VerifyIPFlowSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", resp, "Failure sending request") + } + + result, err = client.VerifyIPFlowResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", resp, "Failure responding to request") + } + + return +} + +// VerifyIPFlowPreparer prepares the VerifyIPFlow request. +func (client NetworkWatchersClient) VerifyIPFlowPreparer(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the +// http.Response Body if it receives an error. +func (client NetworkWatchersClient) VerifyIPFlowSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always +// closes the http.Response Body. +func (client NetworkWatchersClient) VerifyIPFlowResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/packetcaptures.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/packetcaptures.go index 9d85fc0e43..4e6d351474 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/packetcaptures.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/packetcaptures.go @@ -1,463 +1,463 @@ -package networkwatcher - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PacketCapturesClient is the the Microsoft Azure Network management API -// provides a RESTful set of web services that interact with Microsoft Azure -// Networks service to manage your network resources. The API has entities that -// capture the relationship between an end user and the Microsoft Azure -// Networks service. -type PacketCapturesClient struct { - ManagementClient -} - -// NewPacketCapturesClient creates an instance of the PacketCapturesClient -// client. -func NewPacketCapturesClient(subscriptionID string) PacketCapturesClient { - return NewPacketCapturesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPacketCapturesClientWithBaseURI creates an instance of the -// PacketCapturesClient client. -func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) PacketCapturesClient { - return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create and start a packet capture on the specified VM. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. parameters is parameters that define the create packet -// capture operation. -func (client PacketCapturesClient) Create(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "networkwatcher.PacketCapturesClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, networkWatcherName, packetCaptureName, parameters, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", nil, "Failure preparing request") - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", resp, "Failure sending request") - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the specified packet capture session. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. -func (client PacketCapturesClient) Delete(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", nil, "Failure preparing request") - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", resp, "Failure sending request") - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a packet capture session by name. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. -func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { - req, err := client.GetPreparer(resourceGroupName, networkWatcherName, packetCaptureName) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", nil, "Failure preparing request") - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", resp, "Failure sending request") - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PacketCapturesClient) GetPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) GetResponder(resp *http.Response) (result PacketCaptureResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStatus query the status of a running packet capture session. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the Network Watcher resource. packetCaptureName is the name -// given to the packet capture session. -func (client PacketCapturesClient) GetStatus(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.GetStatusPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", nil, "Failure preparing request") - } - - resp, err := client.GetStatusSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", resp, "Failure sending request") - } - - result, err = client.GetStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", resp, "Failure responding to request") - } - - return -} - -// GetStatusPreparer prepares the GetStatus request. -func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetStatusSender sends the GetStatus request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) GetStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetStatusResponder handles the response to the GetStatus request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// List lists all packet capture sessions within the specified resource group. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the Network Watcher resource. -func (client PacketCapturesClient) List(resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, networkWatcherName) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", nil, "Failure preparing request") - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", resp, "Failure sending request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) ListResponder(resp *http.Response) (result PacketCaptureListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Stop stops a specified packet capture session. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. networkWatcherName is -// the name of the network watcher. packetCaptureName is the name of the packet -// capture session. -func (client PacketCapturesClient) Stop(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) { - req, err := client.StopPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) - if err != nil { - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", nil, "Failure preparing request") - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", resp, "Failure sending request") - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", resp, "Failure responding to request") - } - - return -} - -// StopPreparer prepares the Stop request. -func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "packetCaptureName": autorest.Encode("path", packetCaptureName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - queryParameters := map[string]interface{}{ - "api-version": client.APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client PacketCapturesClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client PacketCapturesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package networkwatcher + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PacketCapturesClient is the the Microsoft Azure Network management API +// provides a RESTful set of web services that interact with Microsoft Azure +// Networks service to manage your network resources. The API has entities that +// capture the relationship between an end user and the Microsoft Azure +// Networks service. +type PacketCapturesClient struct { + ManagementClient +} + +// NewPacketCapturesClient creates an instance of the PacketCapturesClient +// client. +func NewPacketCapturesClient(subscriptionID string) PacketCapturesClient { + return NewPacketCapturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPacketCapturesClientWithBaseURI creates an instance of the +// PacketCapturesClient client. +func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) PacketCapturesClient { + return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create and start a packet capture on the specified VM. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. parameters is parameters that define the create packet +// capture operation. +func (client PacketCapturesClient) Create(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "networkwatcher.PacketCapturesClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, networkWatcherName, packetCaptureName, parameters, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", nil, "Failure preparing request") + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", resp, "Failure sending request") + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the specified packet capture session. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. +func (client PacketCapturesClient) Delete(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", nil, "Failure preparing request") + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", resp, "Failure sending request") + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a packet capture session by name. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. +func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { + req, err := client.GetPreparer(resourceGroupName, networkWatcherName, packetCaptureName) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", nil, "Failure preparing request") + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", resp, "Failure sending request") + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PacketCapturesClient) GetPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) GetResponder(resp *http.Response) (result PacketCaptureResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStatus query the status of a running packet capture session. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the Network Watcher resource. packetCaptureName is the name +// given to the packet capture session. +func (client PacketCapturesClient) GetStatus(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.GetStatusPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", nil, "Failure preparing request") + } + + resp, err := client.GetStatusSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", resp, "Failure sending request") + } + + result, err = client.GetStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", resp, "Failure responding to request") + } + + return +} + +// GetStatusPreparer prepares the GetStatus request. +func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetStatusSender sends the GetStatus request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) GetStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetStatusResponder handles the response to the GetStatus request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// List lists all packet capture sessions within the specified resource group. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the Network Watcher resource. +func (client PacketCapturesClient) List(resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, networkWatcherName) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", nil, "Failure preparing request") + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", resp, "Failure sending request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) ListResponder(resp *http.Response) (result PacketCaptureListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops a specified packet capture session. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. networkWatcherName is +// the name of the network watcher. packetCaptureName is the name of the packet +// capture session. +func (client PacketCapturesClient) Stop(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) { + req, err := client.StopPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel) + if err != nil { + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", nil, "Failure preparing request") + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", resp, "Failure sending request") + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", resp, "Failure responding to request") + } + + return +} + +// StopPreparer prepares the Stop request. +func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "packetCaptureName": autorest.Encode("path", packetCaptureName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + queryParameters := map[string]interface{}{ + "api-version": client.APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client PacketCapturesClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/version.go index 0807e9310d..52b97c2ebd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/networkwatcher/version.go @@ -1,60 +1,60 @@ -package networkwatcher - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "bytes" - "fmt" - "strings" -) - -const ( - major = "8" - minor = "1" - patch = "0" - tag = "beta" - userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" -) - -// cached results of UserAgent and Version to prevent repeated operations. -var ( - userAgent string - version string -) - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - if userAgent == "" { - userAgent = fmt.Sprintf(userAgentFormat, Version(), "networkwatcher", "2016-12-01") - } - return userAgent -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - if version == "" { - versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) - if tag != "" { - versionBuilder.WriteRune('-') - versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) - } - version = string(versionBuilder.Bytes()) - } - return version -} +package networkwatcher + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "bytes" + "fmt" + "strings" +) + +const ( + major = "8" + minor = "1" + patch = "0" + tag = "beta" + userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s" +) + +// cached results of UserAgent and Version to prevent repeated operations. +var ( + userAgent string + version string +) + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + if userAgent == "" { + userAgent = fmt.Sprintf(userAgentFormat, Version(), "networkwatcher", "2016-12-01") + } + return userAgent +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + if version == "" { + versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch)) + if tag != "" { + versionBuilder.WriteRune('-') + versionBuilder.WriteString(strings.TrimPrefix(tag, "-")) + } + version = string(versionBuilder.Bytes()) + } + return version +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/client.go index 5254030fd3..f02acec65a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/client.go @@ -1,53 +1,53 @@ -// Package notificationhubs implements the Azure ARM Notificationhubs service -// API version 2017-04-01. -// -// Azure NotificationHub client -package notificationhubs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Notificationhubs - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Notificationhubs. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package notificationhubs implements the Azure ARM Notificationhubs service +// API version 2017-04-01. +// +// Azure NotificationHub client +package notificationhubs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Notificationhubs + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Notificationhubs. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/models.go index bb9c2db820..bca8ddd1f9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/models.go @@ -1,395 +1,395 @@ -package notificationhubs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // Listen specifies the listen state for access rights. - Listen AccessRights = "Listen" - // Manage specifies the manage state for access rights. - Manage AccessRights = "Manage" - // Send specifies the send state for access rights. - Send AccessRights = "Send" -) - -// NamespaceType enumerates the values for namespace type. -type NamespaceType string - -const ( - // Messaging specifies the messaging state for namespace type. - Messaging NamespaceType = "Messaging" - // NotificationHub specifies the notification hub state for namespace type. - NotificationHub NamespaceType = "NotificationHub" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic specifies the basic state for sku name. - Basic SkuName = "Basic" - // Free specifies the free state for sku name. - Free SkuName = "Free" - // Standard specifies the standard state for sku name. - Standard SkuName = "Standard" -) - -// AdmCredential is description of a NotificationHub AdmCredential. -type AdmCredential struct { - *AdmCredentialProperties `json:"properties,omitempty"` -} - -// AdmCredentialProperties is description of a NotificationHub AdmCredential. -type AdmCredentialProperties struct { - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - AuthTokenURL *string `json:"authTokenUrl,omitempty"` -} - -// ApnsCredential is description of a NotificationHub ApnsCredential. -type ApnsCredential struct { - *ApnsCredentialProperties `json:"properties,omitempty"` -} - -// ApnsCredentialProperties is description of a NotificationHub ApnsCredential. -type ApnsCredentialProperties struct { - ApnsCertificate *string `json:"apnsCertificate,omitempty"` - CertificateKey *string `json:"certificateKey,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - KeyID *string `json:"keyId,omitempty"` - AppName *string `json:"appName,omitempty"` - AppID *string `json:"appId,omitempty"` - Token *string `json:"token,omitempty"` -} - -// BaiduCredential is description of a NotificationHub BaiduCredential. -type BaiduCredential struct { - *BaiduCredentialProperties `json:"properties,omitempty"` -} - -// BaiduCredentialProperties is description of a NotificationHub -// BaiduCredential. -type BaiduCredentialProperties struct { - BaiduAPIKey *string `json:"baiduApiKey,omitempty"` - BaiduEndPoint *string `json:"baiduEndPoint,omitempty"` - BaiduSecretKey *string `json:"baiduSecretKey,omitempty"` -} - -// CheckAvailabilityParameters is parameters supplied to the Check Name -// Availability for Namespace and NotificationHubs. -type CheckAvailabilityParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - IsAvailiable *bool `json:"isAvailiable,omitempty"` -} - -// CheckAvailabilityResult is description of a CheckAvailibility resource. -type CheckAvailabilityResult struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - IsAvailiable *bool `json:"isAvailiable,omitempty"` -} - -// CreateOrUpdateParameters is parameters supplied to the CreateOrUpdate -// NotificationHub operation. -type CreateOrUpdateParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// GcmCredential is description of a NotificationHub GcmCredential. -type GcmCredential struct { - *GcmCredentialProperties `json:"properties,omitempty"` -} - -// GcmCredentialProperties is description of a NotificationHub GcmCredential. -type GcmCredentialProperties struct { - GcmEndpoint *string `json:"gcmEndpoint,omitempty"` - GoogleAPIKey *string `json:"googleApiKey,omitempty"` -} - -// ListResult is the response of the List NotificationHub operation. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]ResourceType `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MpnsCredential is description of a NotificationHub MpnsCredential. -type MpnsCredential struct { - *MpnsCredentialProperties `json:"properties,omitempty"` -} - -// MpnsCredentialProperties is description of a NotificationHub MpnsCredential. -type MpnsCredentialProperties struct { - MpnsCertificate *string `json:"mpnsCertificate,omitempty"` - CertificateKey *string `json:"certificateKey,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// NamespaceCreateOrUpdateParameters is parameters supplied to the -// CreateOrUpdate Namespace operation. -type NamespaceCreateOrUpdateParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// NamespaceListResult is the response of the List Namespace operation. -type NamespaceListResult struct { - autorest.Response `json:"-"` - Value *[]NamespaceResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NamespacePatchParameters is parameters supplied to the Patch Namespace -// operation. -type NamespacePatchParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// NamespaceProperties is namespace properties. -type NamespaceProperties struct { - Name *string `json:"name,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Region *string `json:"region,omitempty"` - Status *string `json:"status,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - ScaleUnit *string `json:"scaleUnit,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - Critical *bool `json:"critical,omitempty"` - NamespaceType NamespaceType `json:"namespaceType,omitempty"` -} - -// NamespaceResource is description of a Namespace resource. -type NamespaceResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// PnsCredentialsProperties is description of a NotificationHub PNS -// Credentials. -type PnsCredentialsProperties struct { - ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` - WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` - GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` - MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` - AdmCredential *AdmCredential `json:"admCredential,omitempty"` - BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` -} - -// PnsCredentialsResource is description of a NotificationHub PNS Credentials. -type PnsCredentialsResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *PnsCredentialsProperties `json:"properties,omitempty"` -} - -// PolicykeyResource is namespace/NotificationHub Regenerate Keys -type PolicykeyResource struct { - PolicyKey *string `json:"policyKey,omitempty"` -} - -// Properties is notificationHub properties. -type Properties struct { - Name *string `json:"name,omitempty"` - RegistrationTTL *string `json:"registrationTtl,omitempty"` - AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"` - ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` - WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` - GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` - MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` - AdmCredential *AdmCredential `json:"admCredential,omitempty"` - BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// ResourceListKeys is namespace/NotificationHub Connection String -type ResourceListKeys struct { - autorest.Response `json:"-"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - KeyName *string `json:"keyName,omitempty"` -} - -// ResourceType is description of a NotificationHub Resource. -type ResourceType struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *Properties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied -// to the CreateOrUpdate Namespace AuthorizationRules. -type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleListResult is the response of the List -// Namespace operation. -type SharedAccessAuthorizationRuleListResult struct { - autorest.Response `json:"-"` - Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SharedAccessAuthorizationRuleProperties is sharedAccessAuthorizationRule -// properties. -type SharedAccessAuthorizationRuleProperties struct { - Rights *[]AccessRights `json:"rights,omitempty"` -} - -// SharedAccessAuthorizationRuleResource is description of a Namespace -// AuthorizationRules. -type SharedAccessAuthorizationRuleResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// Sku is the Sku description for a namespace -type Sku struct { - Name SkuName `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` - Size *string `json:"size,omitempty"` - Family *string `json:"family,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// WnsCredential is description of a NotificationHub WnsCredential. -type WnsCredential struct { - *WnsCredentialProperties `json:"properties,omitempty"` -} - -// WnsCredentialProperties is description of a NotificationHub WnsCredential. -type WnsCredentialProperties struct { - PackageSid *string `json:"packageSid,omitempty"` - SecretKey *string `json:"secretKey,omitempty"` - WindowsLiveEndpoint *string `json:"windowsLiveEndpoint,omitempty"` -} +package notificationhubs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // Listen specifies the listen state for access rights. + Listen AccessRights = "Listen" + // Manage specifies the manage state for access rights. + Manage AccessRights = "Manage" + // Send specifies the send state for access rights. + Send AccessRights = "Send" +) + +// NamespaceType enumerates the values for namespace type. +type NamespaceType string + +const ( + // Messaging specifies the messaging state for namespace type. + Messaging NamespaceType = "Messaging" + // NotificationHub specifies the notification hub state for namespace type. + NotificationHub NamespaceType = "NotificationHub" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Basic specifies the basic state for sku name. + Basic SkuName = "Basic" + // Free specifies the free state for sku name. + Free SkuName = "Free" + // Standard specifies the standard state for sku name. + Standard SkuName = "Standard" +) + +// AdmCredential is description of a NotificationHub AdmCredential. +type AdmCredential struct { + *AdmCredentialProperties `json:"properties,omitempty"` +} + +// AdmCredentialProperties is description of a NotificationHub AdmCredential. +type AdmCredentialProperties struct { + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + AuthTokenURL *string `json:"authTokenUrl,omitempty"` +} + +// ApnsCredential is description of a NotificationHub ApnsCredential. +type ApnsCredential struct { + *ApnsCredentialProperties `json:"properties,omitempty"` +} + +// ApnsCredentialProperties is description of a NotificationHub ApnsCredential. +type ApnsCredentialProperties struct { + ApnsCertificate *string `json:"apnsCertificate,omitempty"` + CertificateKey *string `json:"certificateKey,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + KeyID *string `json:"keyId,omitempty"` + AppName *string `json:"appName,omitempty"` + AppID *string `json:"appId,omitempty"` + Token *string `json:"token,omitempty"` +} + +// BaiduCredential is description of a NotificationHub BaiduCredential. +type BaiduCredential struct { + *BaiduCredentialProperties `json:"properties,omitempty"` +} + +// BaiduCredentialProperties is description of a NotificationHub +// BaiduCredential. +type BaiduCredentialProperties struct { + BaiduAPIKey *string `json:"baiduApiKey,omitempty"` + BaiduEndPoint *string `json:"baiduEndPoint,omitempty"` + BaiduSecretKey *string `json:"baiduSecretKey,omitempty"` +} + +// CheckAvailabilityParameters is parameters supplied to the Check Name +// Availability for Namespace and NotificationHubs. +type CheckAvailabilityParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + IsAvailiable *bool `json:"isAvailiable,omitempty"` +} + +// CheckAvailabilityResult is description of a CheckAvailibility resource. +type CheckAvailabilityResult struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + IsAvailiable *bool `json:"isAvailiable,omitempty"` +} + +// CreateOrUpdateParameters is parameters supplied to the CreateOrUpdate +// NotificationHub operation. +type CreateOrUpdateParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// GcmCredential is description of a NotificationHub GcmCredential. +type GcmCredential struct { + *GcmCredentialProperties `json:"properties,omitempty"` +} + +// GcmCredentialProperties is description of a NotificationHub GcmCredential. +type GcmCredentialProperties struct { + GcmEndpoint *string `json:"gcmEndpoint,omitempty"` + GoogleAPIKey *string `json:"googleApiKey,omitempty"` +} + +// ListResult is the response of the List NotificationHub operation. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]ResourceType `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// MpnsCredential is description of a NotificationHub MpnsCredential. +type MpnsCredential struct { + *MpnsCredentialProperties `json:"properties,omitempty"` +} + +// MpnsCredentialProperties is description of a NotificationHub MpnsCredential. +type MpnsCredentialProperties struct { + MpnsCertificate *string `json:"mpnsCertificate,omitempty"` + CertificateKey *string `json:"certificateKey,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// NamespaceCreateOrUpdateParameters is parameters supplied to the +// CreateOrUpdate Namespace operation. +type NamespaceCreateOrUpdateParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceListResult is the response of the List Namespace operation. +type NamespaceListResult struct { + autorest.Response `json:"-"` + Value *[]NamespaceResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NamespacePatchParameters is parameters supplied to the Patch Namespace +// operation. +type NamespacePatchParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// NamespaceProperties is namespace properties. +type NamespaceProperties struct { + Name *string `json:"name,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Region *string `json:"region,omitempty"` + Status *string `json:"status,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + ScaleUnit *string `json:"scaleUnit,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Critical *bool `json:"critical,omitempty"` + NamespaceType NamespaceType `json:"namespaceType,omitempty"` +} + +// NamespaceResource is description of a Namespace resource. +type NamespaceResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// PnsCredentialsProperties is description of a NotificationHub PNS +// Credentials. +type PnsCredentialsProperties struct { + ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` + WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` + GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` + MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` + AdmCredential *AdmCredential `json:"admCredential,omitempty"` + BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` +} + +// PnsCredentialsResource is description of a NotificationHub PNS Credentials. +type PnsCredentialsResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *PnsCredentialsProperties `json:"properties,omitempty"` +} + +// PolicykeyResource is namespace/NotificationHub Regenerate Keys +type PolicykeyResource struct { + PolicyKey *string `json:"policyKey,omitempty"` +} + +// Properties is notificationHub properties. +type Properties struct { + Name *string `json:"name,omitempty"` + RegistrationTTL *string `json:"registrationTtl,omitempty"` + AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"` + ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` + WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` + GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` + MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` + AdmCredential *AdmCredential `json:"admCredential,omitempty"` + BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// ResourceListKeys is namespace/NotificationHub Connection String +type ResourceListKeys struct { + autorest.Response `json:"-"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + KeyName *string `json:"keyName,omitempty"` +} + +// ResourceType is description of a NotificationHub Resource. +type ResourceType struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *Properties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied +// to the CreateOrUpdate Namespace AuthorizationRules. +type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleListResult is the response of the List +// Namespace operation. +type SharedAccessAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SharedAccessAuthorizationRuleProperties is sharedAccessAuthorizationRule +// properties. +type SharedAccessAuthorizationRuleProperties struct { + Rights *[]AccessRights `json:"rights,omitempty"` +} + +// SharedAccessAuthorizationRuleResource is description of a Namespace +// AuthorizationRules. +type SharedAccessAuthorizationRuleResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// Sku is the Sku description for a namespace +type Sku struct { + Name SkuName `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// WnsCredential is description of a NotificationHub WnsCredential. +type WnsCredential struct { + *WnsCredentialProperties `json:"properties,omitempty"` +} + +// WnsCredentialProperties is description of a NotificationHub WnsCredential. +type WnsCredentialProperties struct { + PackageSid *string `json:"packageSid,omitempty"` + SecretKey *string `json:"secretKey,omitempty"` + WindowsLiveEndpoint *string `json:"windowsLiveEndpoint,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/namespaces.go index c10961d5c4..ff473d09f5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/namespaces.go @@ -1,1018 +1,1018 @@ -package notificationhubs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NamespacesClient is the azure NotificationHub client -type NamespacesClient struct { - ManagementClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient -// client. -func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckAvailability checks the availability of the given service namespace -// across all Azure subscriptions. This is useful because the domain name is -// created based on the service namespace name. -// -// parameters is the namespace name. -func (client NamespacesClient) CheckAvailability(parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.NamespacesClient", "CheckAvailability") - } - - req, err := client.CheckAvailabilityPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckAvailabilityPreparer prepares the CheckAvailability request. -func (client NamespacesClient) CheckAvailabilityPreparer(parameters CheckAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckAvailabilitySender sends the CheckAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates/Updates a service namespace. Once created, this -// namespace's resource manifest is immutable. This operation is idempotent. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. parameters is parameters supplied to create a Namespace -// Resource. -func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters) (result NamespaceResource, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates an authorization rule for a -// namespace -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is aauthorization Rule Name. -// parameters is the shared access authorization rule. -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing namespace. This operation also removes all -// associated notificationHubs under the namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. -func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a namespace authorization rule -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is authorization Rule Name. -func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the description for the specified namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. -func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { - req, err := client.GetPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a namespace by name. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name authorizationRuleName is authorization rule name. -func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the available namespaces within a resourceGroup. -// -// resourceGroupName is the name of the resource group. If resourceGroupName -// value is null the method lists all the namespaces within subscription -func (client NamespacesClient) List(resourceGroupName string) (result NamespaceListResult, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client NamespacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll lists all the available namespaces within the subscription -// irrespective of the resourceGroups. -func (client NamespacesClient) ListAll() (result NamespaceListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client NamespacesClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAllResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListAllNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListAuthorizationRules gets the authorization rules for a namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name -func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the Primary and Secondary ConnectionStrings to the namespace -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is the connection string of the -// namespace for the specified authorizationRule. -func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch patches the existing namespace -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. parameters is parameters supplied to patch a Namespace -// Resource. -func (client NamespacesClient) Patch(resourceGroupName string, namespaceName string, parameters NamespacePatchParameters) (result NamespaceResource, err error) { - req, err := client.PatchPreparer(resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", resp, "Failure responding to request") - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client NamespacesClient) PatchPreparer(resourceGroupName string, namespaceName string, parameters NamespacePatchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client NamespacesClient) PatchResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary/Secondary Keys to the Namespace -// Authorization Rule -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. authorizationRuleName is the connection string of the -// namespace for the specified authorizationRule. parameters is parameters -// supplied to regenerate the Namespace Authorization Rule Key. -func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package notificationhubs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NamespacesClient is the azure NotificationHub client +type NamespacesClient struct { + ManagementClient +} + +// NewNamespacesClient creates an instance of the NamespacesClient client. +func NewNamespacesClient(subscriptionID string) NamespacesClient { + return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient +// client. +func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { + return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckAvailability checks the availability of the given service namespace +// across all Azure subscriptions. This is useful because the domain name is +// created based on the service namespace name. +// +// parameters is the namespace name. +func (client NamespacesClient) CheckAvailability(parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "notificationhubs.NamespacesClient", "CheckAvailability") + } + + req, err := client.CheckAvailabilityPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckAvailabilityPreparer prepares the CheckAvailability request. +func (client NamespacesClient) CheckAvailabilityPreparer(parameters CheckAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckAvailabilitySender sends the CheckAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates/Updates a service namespace. Once created, this +// namespace's resource manifest is immutable. This operation is idempotent. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. parameters is parameters supplied to create a Namespace +// Resource. +func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters) (result NamespaceResource, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates an authorization rule for a +// namespace +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is aauthorization Rule Name. +// parameters is the shared access authorization rule. +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing namespace. This operation also removes all +// associated notificationHubs under the namespace. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. +func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a namespace authorization rule +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is authorization Rule Name. +func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the description for the specified namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. +func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { + req, err := client.GetPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an authorization rule for a namespace by name. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name authorizationRuleName is authorization rule name. +func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the available namespaces within a resourceGroup. +// +// resourceGroupName is the name of the resource group. If resourceGroupName +// value is null the method lists all the namespaces within subscription +func (client NamespacesClient) List(resourceGroupName string) (result NamespaceListResult, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client NamespacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll lists all the available namespaces within the subscription +// irrespective of the resourceGroups. +func (client NamespacesClient) ListAll() (result NamespaceListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client NamespacesClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAllResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListAllNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules gets the authorization rules for a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name +func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the Primary and Secondary ConnectionStrings to the namespace +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is the connection string of the +// namespace for the specified authorizationRule. +func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Patch patches the existing namespace +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. parameters is parameters supplied to patch a Namespace +// Resource. +func (client NamespacesClient) Patch(resourceGroupName string, namespaceName string, parameters NamespacePatchParameters) (result NamespaceResource, err error) { + req, err := client.PatchPreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client NamespacesClient) PatchPreparer(resourceGroupName string, namespaceName string, parameters NamespacePatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client NamespacesClient) PatchResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the Primary/Secondary Keys to the Namespace +// Authorization Rule +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. authorizationRuleName is the connection string of the +// namespace for the specified authorizationRule. parameters is parameters +// supplied to regenerate the Namespace Authorization Rule Key. +func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/notificationhubsgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/notificationhubsgroup.go index 1c7e73549b..cbdd1c1f80 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/notificationhubsgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/notificationhubsgroup.go @@ -1,937 +1,937 @@ -package notificationhubs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupClient is the azure NotificationHub client -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckAvailability checks the availability of the given notificationHub in a -// namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. parameters is the notificationHub name. -func (client GroupClient) CheckAvailability(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CheckAvailability") - } - - req, err := client.CheckAvailabilityPreparer(resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckAvailabilityPreparer prepares the CheckAvailability request. -func (client GroupClient) CheckAvailabilityPreparer(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckAvailabilitySender sends the CheckAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always -// closes the http.Response Body. -func (client GroupClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates/Update a NotificationHub in a namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. parameters -// is parameters supplied to the create/update a NotificationHub Resource. -func (client GroupClient) CreateOrUpdate(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, notificationHubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates/Updates an authorization rule for a -// NotificationHub -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -// authorizationRuleName is authorization Rule Name. parameters is the shared -// access authorization rule. -func (client GroupClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client GroupClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a notification hub associated with a namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -func (client GroupClient) Delete(resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a notificationHub authorization rule -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -// authorizationRuleName is authorization Rule Name. -func (client GroupClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) { - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client GroupClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get lists the notification hubs associated with a namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -func (client GroupClient) Get(resourceGroupName string, namespaceName string, notificationHubName string) (result ResourceType, err error) { - req, err := client.GetPreparer(resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a NotificationHub by -// name. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name notificationHubName is the notification hub name. -// authorizationRuleName is authorization rule name. -func (client GroupClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client GroupClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client GroupClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPnsCredentials lists the PNS Credentials associated with a notification -// hub . -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -func (client GroupClient) GetPnsCredentials(resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) { - req, err := client.GetPnsCredentialsPreparer(resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.GetPnsCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure sending request") - return - } - - result, err = client.GetPnsCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure responding to request") - } - - return -} - -// GetPnsCredentialsPreparer prepares the GetPnsCredentials request. -func (client GroupClient) GetPnsCredentialsPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPnsCredentialsSender sends the GetPnsCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPnsCredentialsResponder handles the response to the GetPnsCredentials request. The method always -// closes the http.Response Body. -func (client GroupClient) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the notification hubs associated with a namespace. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. -func (client GroupClient) List(resourceGroupName string, namespaceName string) (result ListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAuthorizationRules gets the authorization rules for a NotificationHub. -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name notificationHubName is the notification hub name. -func (client GroupClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client GroupClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client GroupClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client GroupClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the Primary and Secondary ConnectionStrings to the -// NotificationHub -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -// authorizationRuleName is the connection string of the NotificationHub for -// the specified authorizationRule. -func (client GroupClient) ListKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client GroupClient) ListKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client GroupClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary/Secondary Keys to the NotificationHub -// Authorization Rule -// -// resourceGroupName is the name of the resource group. namespaceName is the -// namespace name. notificationHubName is the notification hub name. -// authorizationRuleName is the connection string of the NotificationHub for -// the specified authorizationRule. parameters is parameters supplied to -// regenerate the NotificationHub Authorization Rule Key. -func (client GroupClient) RegenerateKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client GroupClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client GroupClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package notificationhubs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupClient is the azure NotificationHub client +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckAvailability checks the availability of the given notificationHub in a +// namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. parameters is the notificationHub name. +func (client GroupClient) CheckAvailability(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CheckAvailability") + } + + req, err := client.CheckAvailabilityPreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CheckAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckAvailabilityPreparer prepares the CheckAvailability request. +func (client GroupClient) CheckAvailabilityPreparer(resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckAvailabilitySender sends the CheckAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always +// closes the http.Response Body. +func (client GroupClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates/Update a NotificationHub in a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. parameters +// is parameters supplied to the create/update a NotificationHub Resource. +func (client GroupClient) CreateOrUpdate(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, notificationHubName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates/Updates an authorization rule for a +// NotificationHub +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +// authorizationRuleName is authorization Rule Name. parameters is the shared +// access authorization rule. +func (client GroupClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client GroupClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a notification hub associated with a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +func (client GroupClient) Delete(resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, namespaceName, notificationHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GroupClient) DeletePreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a notificationHub authorization rule +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +// authorizationRuleName is authorization Rule Name. +func (client GroupClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) { + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client GroupClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get lists the notification hubs associated with a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +func (client GroupClient) Get(resourceGroupName string, namespaceName string, notificationHubName string) (result ResourceType, err error) { + req, err := client.GetPreparer(resourceGroupName, namespaceName, notificationHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an authorization rule for a NotificationHub by +// name. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name notificationHubName is the notification hub name. +// authorizationRuleName is authorization rule name. +func (client GroupClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client GroupClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client GroupClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPnsCredentials lists the PNS Credentials associated with a notification +// hub . +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +func (client GroupClient) GetPnsCredentials(resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) { + req, err := client.GetPnsCredentialsPreparer(resourceGroupName, namespaceName, notificationHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.GetPnsCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure sending request") + return + } + + result, err = client.GetPnsCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "GetPnsCredentials", resp, "Failure responding to request") + } + + return +} + +// GetPnsCredentialsPreparer prepares the GetPnsCredentials request. +func (client GroupClient) GetPnsCredentialsPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPnsCredentialsSender sends the GetPnsCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPnsCredentialsResponder handles the response to the GetPnsCredentials request. The method always +// closes the http.Response Body. +func (client GroupClient) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the notification hubs associated with a namespace. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. +func (client GroupClient) List(resourceGroupName string, namespaceName string) (result ListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules gets the authorization rules for a NotificationHub. +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name notificationHubName is the notification hub name. +func (client GroupClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, notificationHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client GroupClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client GroupClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client GroupClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the Primary and Secondary ConnectionStrings to the +// NotificationHub +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +// authorizationRuleName is the connection string of the NotificationHub for +// the specified authorizationRule. +func (client GroupClient) ListKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client GroupClient) ListKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client GroupClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the Primary/Secondary Keys to the NotificationHub +// Authorization Rule +// +// resourceGroupName is the name of the resource group. namespaceName is the +// namespace name. notificationHubName is the notification hub name. +// authorizationRuleName is the connection string of the NotificationHub for +// the specified authorizationRule. parameters is parameters supplied to +// regenerate the NotificationHub Authorization Rule Key. +func (client GroupClient) RegenerateKeys(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.GroupClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client GroupClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "notificationHubName": autorest.Encode("path", notificationHubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client GroupClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/version.go index 7d753badf6..d1c5746f14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/notificationhubs/version.go @@ -1,29 +1,29 @@ -package notificationhubs - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-notificationhubs/2017-04-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package notificationhubs + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-notificationhubs/2017-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/client.go index d0a606255c..a42ac00b45 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/client.go @@ -1,53 +1,53 @@ -// Package operationalinsights implements the Azure ARM Operationalinsights -// service API version 2015-11-01-preview. -// -// Azure Log Analytics API reference -package operationalinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Operationalinsights - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Operationalinsights. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package operationalinsights implements the Azure ARM Operationalinsights +// service API version 2015-11-01-preview. +// +// Azure Log Analytics API reference +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Operationalinsights + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Operationalinsights. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/datasources.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/datasources.go index dc40d2f402..0a0653d0f7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/datasources.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/datasources.go @@ -1,380 +1,380 @@ -package operationalinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DataSourcesClient is the azure Log Analytics API reference -type DataSourcesClient struct { - ManagementClient -} - -// NewDataSourcesClient creates an instance of the DataSourcesClient client. -func NewDataSourcesClient(subscriptionID string) DataSourcesClient { - return NewDataSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataSourcesClientWithBaseURI creates an instance of the DataSourcesClient -// client. -func NewDataSourcesClientWithBaseURI(baseURI string, subscriptionID string) DataSourcesClient { - return DataSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a data source. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that will -// contain the datasource dataSourceName is the name of the datasource -// resource. parameters is the parameters required to create or update a -// datasource. -func (client DataSourcesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (result DataSource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, dataSourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataSourcesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataSourceName": autorest.Encode("path", dataSourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DataSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DataSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result DataSource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a data source instance. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that -// contains the datasource. dataSourceName is name of the datasource. -func (client DataSourcesClient) Delete(resourceGroupName string, workspaceName string, dataSourceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, workspaceName, dataSourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataSourcesClient) DeletePreparer(resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataSourceName": autorest.Encode("path", dataSourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DataSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a datasource instance. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that -// contains the datasource. dataSourceName is name of the datasource -func (client DataSourcesClient) Get(resourceGroupName string, workspaceName string, dataSourceName string) (result DataSource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, dataSourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataSourcesClient) GetPreparer(resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dataSourceName": autorest.Encode("path", dataSourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DataSourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DataSourcesClient) GetResponder(resp *http.Response) (result DataSource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace gets the first page of data source instances in a workspace -// with the link to the next page. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is the workspace that contains the data sources. -// filter is the filter to apply on the operation. skiptoken is starting point -// of the collection of data source instances. -func (client DataSourcesClient) ListByWorkspace(resourceGroupName string, workspaceName string, filter string, skiptoken string) (result DataSourceListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace") - } - - req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName, filter, skiptoken) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure responding to request") - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client DataSourcesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string, filter string, skiptoken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "$filter": autorest.Encode("query", filter), - "api-version": APIVersion, - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client DataSourcesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client DataSourcesClient) ListByWorkspaceResponder(resp *http.Response) (result DataSourceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspaceNextResults retrieves the next set of results, if any. -func (client DataSourcesClient) ListByWorkspaceNextResults(lastResults DataSourceListResult) (result DataSourceListResult, err error) { - req, err := lastResults.DataSourceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure sending next results request") - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure responding to next results request") - } - - return -} +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DataSourcesClient is the azure Log Analytics API reference +type DataSourcesClient struct { + ManagementClient +} + +// NewDataSourcesClient creates an instance of the DataSourcesClient client. +func NewDataSourcesClient(subscriptionID string) DataSourcesClient { + return NewDataSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataSourcesClientWithBaseURI creates an instance of the DataSourcesClient +// client. +func NewDataSourcesClientWithBaseURI(baseURI string, subscriptionID string) DataSourcesClient { + return DataSourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a data source. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that will +// contain the datasource dataSourceName is the name of the datasource +// resource. parameters is the parameters required to create or update a +// datasource. +func (client DataSourcesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (result DataSource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, dataSourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataSourcesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataSourceName": autorest.Encode("path", dataSourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result DataSource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a data source instance. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that +// contains the datasource. dataSourceName is name of the datasource. +func (client DataSourcesClient) Delete(resourceGroupName string, workspaceName string, dataSourceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, workspaceName, dataSourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataSourcesClient) DeletePreparer(resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataSourceName": autorest.Encode("path", dataSourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DataSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a datasource instance. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that +// contains the datasource. dataSourceName is name of the datasource +func (client DataSourcesClient) Get(resourceGroupName string, workspaceName string, dataSourceName string) (result DataSource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, dataSourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataSourcesClient) GetPreparer(resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataSourceName": autorest.Encode("path", dataSourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataSourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataSourcesClient) GetResponder(resp *http.Response) (result DataSource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace gets the first page of data source instances in a workspace +// with the link to the next page. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is the workspace that contains the data sources. +// filter is the filter to apply on the operation. skiptoken is starting point +// of the collection of data source instances. +func (client DataSourcesClient) ListByWorkspace(resourceGroupName string, workspaceName string, filter string, skiptoken string) (result DataSourceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace") + } + + req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName, filter, skiptoken) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure responding to request") + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client DataSourcesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string, filter string, skiptoken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", filter), + "api-version": APIVersion, + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client DataSourcesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client DataSourcesClient) ListByWorkspaceResponder(resp *http.Response) (result DataSourceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspaceNextResults retrieves the next set of results, if any. +func (client DataSourcesClient) ListByWorkspaceNextResults(lastResults DataSourceListResult) (result DataSourceListResult, err error) { + req, err := lastResults.DataSourceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure sending next results request") + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/linkedservices.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/linkedservices.go index b650a95472..c7ef675627 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/linkedservices.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/linkedservices.go @@ -1,354 +1,354 @@ -package operationalinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// LinkedServicesClient is the azure Log Analytics API reference -type LinkedServicesClient struct { - ManagementClient -} - -// NewLinkedServicesClient creates an instance of the LinkedServicesClient -// client. -func NewLinkedServicesClient(subscriptionID string) LinkedServicesClient { - return NewLinkedServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLinkedServicesClientWithBaseURI creates an instance of the -// LinkedServicesClient client. -func NewLinkedServicesClientWithBaseURI(baseURI string, subscriptionID string) LinkedServicesClient { - return LinkedServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a linked service. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that will -// contain the linkedServices resource linkedServiceName is name of the -// linkedServices resource parameters is the parameters required to create or -// update a linked service. -func (client LinkedServicesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (result LinkedService, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.LinkedServiceProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LinkedServiceProperties.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, linkedServiceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client LinkedServicesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkedServiceName": autorest.Encode("path", linkedServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client LinkedServicesClient) CreateOrUpdateResponder(resp *http.Response) (result LinkedService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a linked service instance. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that -// contains the linkedServices resource linkedServiceName is name of the linked -// service. -func (client LinkedServicesClient) Delete(resourceGroupName string, workspaceName string, linkedServiceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, workspaceName, linkedServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client LinkedServicesClient) DeletePreparer(resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkedServiceName": autorest.Encode("path", linkedServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client LinkedServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a linked service instance. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that -// contains the linkedServices resource linkedServiceName is name of the linked -// service. -func (client LinkedServicesClient) Get(resourceGroupName string, workspaceName string, linkedServiceName string) (result LinkedService, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, linkedServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client LinkedServicesClient) GetPreparer(resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkedServiceName": autorest.Encode("path", linkedServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LinkedServicesClient) GetResponder(resp *http.Response) (result LinkedService, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace gets the linked services instances in a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace that -// contains the linked services. -func (client LinkedServicesClient) ListByWorkspace(resourceGroupName string, workspaceName string) (result LinkedServiceListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace") - } - - req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", resp, "Failure responding to request") - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client LinkedServicesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client LinkedServicesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client LinkedServicesClient) ListByWorkspaceResponder(resp *http.Response) (result LinkedServiceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// LinkedServicesClient is the azure Log Analytics API reference +type LinkedServicesClient struct { + ManagementClient +} + +// NewLinkedServicesClient creates an instance of the LinkedServicesClient +// client. +func NewLinkedServicesClient(subscriptionID string) LinkedServicesClient { + return NewLinkedServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLinkedServicesClientWithBaseURI creates an instance of the +// LinkedServicesClient client. +func NewLinkedServicesClientWithBaseURI(baseURI string, subscriptionID string) LinkedServicesClient { + return LinkedServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a linked service. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that will +// contain the linkedServices resource linkedServiceName is name of the +// linkedServices resource parameters is the parameters required to create or +// update a linked service. +func (client LinkedServicesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (result LinkedService, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LinkedServiceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LinkedServiceProperties.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, linkedServiceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LinkedServicesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkedServiceName": autorest.Encode("path", linkedServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) CreateOrUpdateResponder(resp *http.Response) (result LinkedService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a linked service instance. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that +// contains the linkedServices resource linkedServiceName is name of the linked +// service. +func (client LinkedServicesClient) Delete(resourceGroupName string, workspaceName string, linkedServiceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, workspaceName, linkedServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LinkedServicesClient) DeletePreparer(resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkedServiceName": autorest.Encode("path", linkedServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a linked service instance. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that +// contains the linkedServices resource linkedServiceName is name of the linked +// service. +func (client LinkedServicesClient) Get(resourceGroupName string, workspaceName string, linkedServiceName string) (result LinkedService, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, linkedServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LinkedServicesClient) GetPreparer(resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkedServiceName": autorest.Encode("path", linkedServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) GetResponder(resp *http.Response) (result LinkedService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace gets the linked services instances in a workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace that +// contains the linked services. +func (client LinkedServicesClient) ListByWorkspace(resourceGroupName string, workspaceName string) (result LinkedServiceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace") + } + + req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", resp, "Failure responding to request") + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client LinkedServicesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) ListByWorkspaceResponder(resp *http.Response) (result LinkedServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/models.go index ed7185c4b2..b4057b90c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/models.go @@ -1,285 +1,285 @@ -package operationalinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DataSourceKind enumerates the values for data source kind. -type DataSourceKind string - -const ( - // AzureActivityLog specifies the azure activity log state for data source - // kind. - AzureActivityLog DataSourceKind = "AzureActivityLog" - // ChangeTrackingCustomRegistry specifies the change tracking custom - // registry state for data source kind. - ChangeTrackingCustomRegistry DataSourceKind = "ChangeTrackingCustomRegistry" - // ChangeTrackingDefaultPath specifies the change tracking default path - // state for data source kind. - ChangeTrackingDefaultPath DataSourceKind = "ChangeTrackingDefaultPath" - // ChangeTrackingDefaultRegistry specifies the change tracking default - // registry state for data source kind. - ChangeTrackingDefaultRegistry DataSourceKind = "ChangeTrackingDefaultRegistry" - // ChangeTrackingPath specifies the change tracking path state for data - // source kind. - ChangeTrackingPath DataSourceKind = "ChangeTrackingPath" - // CustomLog specifies the custom log state for data source kind. - CustomLog DataSourceKind = "CustomLog" - // CustomLogCollection specifies the custom log collection state for data - // source kind. - CustomLogCollection DataSourceKind = "CustomLogCollection" - // GenericDataSource specifies the generic data source state for data - // source kind. - GenericDataSource DataSourceKind = "GenericDataSource" - // IISLogs specifies the iis logs state for data source kind. - IISLogs DataSourceKind = "IISLogs" - // LinuxPerformanceCollection specifies the linux performance collection - // state for data source kind. - LinuxPerformanceCollection DataSourceKind = "LinuxPerformanceCollection" - // LinuxPerformanceObject specifies the linux performance object state for - // data source kind. - LinuxPerformanceObject DataSourceKind = "LinuxPerformanceObject" - // LinuxSyslog specifies the linux syslog state for data source kind. - LinuxSyslog DataSourceKind = "LinuxSyslog" - // LinuxSyslogCollection specifies the linux syslog collection state for - // data source kind. - LinuxSyslogCollection DataSourceKind = "LinuxSyslogCollection" - // WindowsEvent specifies the windows event state for data source kind. - WindowsEvent DataSourceKind = "WindowsEvent" - // WindowsPerformanceCounter specifies the windows performance counter - // state for data source kind. - WindowsPerformanceCounter DataSourceKind = "WindowsPerformanceCounter" -) - -// EntityStatus enumerates the values for entity status. -type EntityStatus string - -const ( - // Canceled specifies the canceled state for entity status. - Canceled EntityStatus = "Canceled" - // Creating specifies the creating state for entity status. - Creating EntityStatus = "Creating" - // Deleting specifies the deleting state for entity status. - Deleting EntityStatus = "Deleting" - // Failed specifies the failed state for entity status. - Failed EntityStatus = "Failed" - // ProvisioningAccount specifies the provisioning account state for entity - // status. - ProvisioningAccount EntityStatus = "ProvisioningAccount" - // Succeeded specifies the succeeded state for entity status. - Succeeded EntityStatus = "Succeeded" -) - -// SkuNameEnum enumerates the values for sku name enum. -type SkuNameEnum string - -const ( - // Free specifies the free state for sku name enum. - Free SkuNameEnum = "Free" - // PerNode specifies the per node state for sku name enum. - PerNode SkuNameEnum = "PerNode" - // Premium specifies the premium state for sku name enum. - Premium SkuNameEnum = "Premium" - // Standalone specifies the standalone state for sku name enum. - Standalone SkuNameEnum = "Standalone" - // Standard specifies the standard state for sku name enum. - Standard SkuNameEnum = "Standard" - // Unlimited specifies the unlimited state for sku name enum. - Unlimited SkuNameEnum = "Unlimited" -) - -// DataSource is datasources under OMS Workspace. -type DataSource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - ETag *string `json:"eTag,omitempty"` - Kind DataSourceKind `json:"kind,omitempty"` -} - -// DataSourceFilter is dataSource filter. Right now, only filter by kind is -// supported. -type DataSourceFilter struct { - Kind DataSourceKind `json:"kind,omitempty"` -} - -// DataSourceListResult is the list data source by workspace operation -// response. -type DataSourceListResult struct { - autorest.Response `json:"-"` - Value *[]DataSource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DataSourceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DataSourceListResult) DataSourceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IntelligencePack is intelligence Pack containing a string name and boolean -// indicating if it's enabled. -type IntelligencePack struct { - Name *string `json:"name,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// LinkedService is the top level Linked service resource container. -type LinkedService struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *LinkedServiceProperties `json:"properties,omitempty"` -} - -// LinkedServiceListResult is the list linked service operation response. -type LinkedServiceListResult struct { - autorest.Response `json:"-"` - Value *[]LinkedService `json:"value,omitempty"` -} - -// LinkedServiceProperties is linked service properties. -type LinkedServiceProperties struct { - ResourceID *string `json:"resourceId,omitempty"` -} - -// ListIntelligencePack is -type ListIntelligencePack struct { - autorest.Response `json:"-"` - Value *[]IntelligencePack `json:"value,omitempty"` -} - -// ManagementGroup is a management group that is connected to a workspace -type ManagementGroup struct { - *ManagementGroupProperties `json:"properties,omitempty"` -} - -// ManagementGroupProperties is management group properties. -type ManagementGroupProperties struct { - ServerCount *int32 `json:"serverCount,omitempty"` - IsGateway *bool `json:"isGateway,omitempty"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Created *date.Time `json:"created,omitempty"` - DataReceived *date.Time `json:"dataReceived,omitempty"` - Version *string `json:"version,omitempty"` - Sku *string `json:"sku,omitempty"` -} - -// MetricName is the name of a metric. -type MetricName struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// ProxyResource is common properties of proxy resource. -type ProxyResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Resource is the resource definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SharedKeys is the shared keys for a workspace. -type SharedKeys struct { - autorest.Response `json:"-"` - PrimarySharedKey *string `json:"primarySharedKey,omitempty"` - SecondarySharedKey *string `json:"secondarySharedKey,omitempty"` -} - -// Sku is the SKU (tier) of a workspace. -type Sku struct { - Name SkuNameEnum `json:"name,omitempty"` -} - -// UsageMetric is a metric describing the usage of a resource. -type UsageMetric struct { - Name *MetricName `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - CurrentValue *float64 `json:"currentValue,omitempty"` - Limit *float64 `json:"limit,omitempty"` - NextResetTime *date.Time `json:"nextResetTime,omitempty"` - QuotaPeriod *string `json:"quotaPeriod,omitempty"` -} - -// Workspace is the top level Workspace resource container. -type Workspace struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *WorkspaceProperties `json:"properties,omitempty"` - ETag *string `json:"eTag,omitempty"` -} - -// WorkspaceListManagementGroupsResult is the list workspace managmement groups -// operation response. -type WorkspaceListManagementGroupsResult struct { - autorest.Response `json:"-"` - Value *[]ManagementGroup `json:"value,omitempty"` -} - -// WorkspaceListResult is the list workspaces operation response. -type WorkspaceListResult struct { - autorest.Response `json:"-"` - Value *[]Workspace `json:"value,omitempty"` -} - -// WorkspaceListUsagesResult is the list workspace usages operation response. -type WorkspaceListUsagesResult struct { - autorest.Response `json:"-"` - Value *[]UsageMetric `json:"value,omitempty"` -} - -// WorkspaceProperties is workspace properties. -type WorkspaceProperties struct { - ProvisioningState EntityStatus `json:"provisioningState,omitempty"` - Source *string `json:"source,omitempty"` - CustomerID *string `json:"customerId,omitempty"` - PortalURL *string `json:"portalUrl,omitempty"` - Sku *Sku `json:"sku,omitempty"` - RetentionInDays *int32 `json:"retentionInDays,omitempty"` -} +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DataSourceKind enumerates the values for data source kind. +type DataSourceKind string + +const ( + // AzureActivityLog specifies the azure activity log state for data source + // kind. + AzureActivityLog DataSourceKind = "AzureActivityLog" + // ChangeTrackingCustomRegistry specifies the change tracking custom + // registry state for data source kind. + ChangeTrackingCustomRegistry DataSourceKind = "ChangeTrackingCustomRegistry" + // ChangeTrackingDefaultPath specifies the change tracking default path + // state for data source kind. + ChangeTrackingDefaultPath DataSourceKind = "ChangeTrackingDefaultPath" + // ChangeTrackingDefaultRegistry specifies the change tracking default + // registry state for data source kind. + ChangeTrackingDefaultRegistry DataSourceKind = "ChangeTrackingDefaultRegistry" + // ChangeTrackingPath specifies the change tracking path state for data + // source kind. + ChangeTrackingPath DataSourceKind = "ChangeTrackingPath" + // CustomLog specifies the custom log state for data source kind. + CustomLog DataSourceKind = "CustomLog" + // CustomLogCollection specifies the custom log collection state for data + // source kind. + CustomLogCollection DataSourceKind = "CustomLogCollection" + // GenericDataSource specifies the generic data source state for data + // source kind. + GenericDataSource DataSourceKind = "GenericDataSource" + // IISLogs specifies the iis logs state for data source kind. + IISLogs DataSourceKind = "IISLogs" + // LinuxPerformanceCollection specifies the linux performance collection + // state for data source kind. + LinuxPerformanceCollection DataSourceKind = "LinuxPerformanceCollection" + // LinuxPerformanceObject specifies the linux performance object state for + // data source kind. + LinuxPerformanceObject DataSourceKind = "LinuxPerformanceObject" + // LinuxSyslog specifies the linux syslog state for data source kind. + LinuxSyslog DataSourceKind = "LinuxSyslog" + // LinuxSyslogCollection specifies the linux syslog collection state for + // data source kind. + LinuxSyslogCollection DataSourceKind = "LinuxSyslogCollection" + // WindowsEvent specifies the windows event state for data source kind. + WindowsEvent DataSourceKind = "WindowsEvent" + // WindowsPerformanceCounter specifies the windows performance counter + // state for data source kind. + WindowsPerformanceCounter DataSourceKind = "WindowsPerformanceCounter" +) + +// EntityStatus enumerates the values for entity status. +type EntityStatus string + +const ( + // Canceled specifies the canceled state for entity status. + Canceled EntityStatus = "Canceled" + // Creating specifies the creating state for entity status. + Creating EntityStatus = "Creating" + // Deleting specifies the deleting state for entity status. + Deleting EntityStatus = "Deleting" + // Failed specifies the failed state for entity status. + Failed EntityStatus = "Failed" + // ProvisioningAccount specifies the provisioning account state for entity + // status. + ProvisioningAccount EntityStatus = "ProvisioningAccount" + // Succeeded specifies the succeeded state for entity status. + Succeeded EntityStatus = "Succeeded" +) + +// SkuNameEnum enumerates the values for sku name enum. +type SkuNameEnum string + +const ( + // Free specifies the free state for sku name enum. + Free SkuNameEnum = "Free" + // PerNode specifies the per node state for sku name enum. + PerNode SkuNameEnum = "PerNode" + // Premium specifies the premium state for sku name enum. + Premium SkuNameEnum = "Premium" + // Standalone specifies the standalone state for sku name enum. + Standalone SkuNameEnum = "Standalone" + // Standard specifies the standard state for sku name enum. + Standard SkuNameEnum = "Standard" + // Unlimited specifies the unlimited state for sku name enum. + Unlimited SkuNameEnum = "Unlimited" +) + +// DataSource is datasources under OMS Workspace. +type DataSource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` + ETag *string `json:"eTag,omitempty"` + Kind DataSourceKind `json:"kind,omitempty"` +} + +// DataSourceFilter is dataSource filter. Right now, only filter by kind is +// supported. +type DataSourceFilter struct { + Kind DataSourceKind `json:"kind,omitempty"` +} + +// DataSourceListResult is the list data source by workspace operation +// response. +type DataSourceListResult struct { + autorest.Response `json:"-"` + Value *[]DataSource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DataSourceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DataSourceListResult) DataSourceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IntelligencePack is intelligence Pack containing a string name and boolean +// indicating if it's enabled. +type IntelligencePack struct { + Name *string `json:"name,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// LinkedService is the top level Linked service resource container. +type LinkedService struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *LinkedServiceProperties `json:"properties,omitempty"` +} + +// LinkedServiceListResult is the list linked service operation response. +type LinkedServiceListResult struct { + autorest.Response `json:"-"` + Value *[]LinkedService `json:"value,omitempty"` +} + +// LinkedServiceProperties is linked service properties. +type LinkedServiceProperties struct { + ResourceID *string `json:"resourceId,omitempty"` +} + +// ListIntelligencePack is +type ListIntelligencePack struct { + autorest.Response `json:"-"` + Value *[]IntelligencePack `json:"value,omitempty"` +} + +// ManagementGroup is a management group that is connected to a workspace +type ManagementGroup struct { + *ManagementGroupProperties `json:"properties,omitempty"` +} + +// ManagementGroupProperties is management group properties. +type ManagementGroupProperties struct { + ServerCount *int32 `json:"serverCount,omitempty"` + IsGateway *bool `json:"isGateway,omitempty"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Created *date.Time `json:"created,omitempty"` + DataReceived *date.Time `json:"dataReceived,omitempty"` + Version *string `json:"version,omitempty"` + Sku *string `json:"sku,omitempty"` +} + +// MetricName is the name of a metric. +type MetricName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// ProxyResource is common properties of proxy resource. +type ProxyResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Resource is the resource definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SharedKeys is the shared keys for a workspace. +type SharedKeys struct { + autorest.Response `json:"-"` + PrimarySharedKey *string `json:"primarySharedKey,omitempty"` + SecondarySharedKey *string `json:"secondarySharedKey,omitempty"` +} + +// Sku is the SKU (tier) of a workspace. +type Sku struct { + Name SkuNameEnum `json:"name,omitempty"` +} + +// UsageMetric is a metric describing the usage of a resource. +type UsageMetric struct { + Name *MetricName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + CurrentValue *float64 `json:"currentValue,omitempty"` + Limit *float64 `json:"limit,omitempty"` + NextResetTime *date.Time `json:"nextResetTime,omitempty"` + QuotaPeriod *string `json:"quotaPeriod,omitempty"` +} + +// Workspace is the top level Workspace resource container. +type Workspace struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *WorkspaceProperties `json:"properties,omitempty"` + ETag *string `json:"eTag,omitempty"` +} + +// WorkspaceListManagementGroupsResult is the list workspace managmement groups +// operation response. +type WorkspaceListManagementGroupsResult struct { + autorest.Response `json:"-"` + Value *[]ManagementGroup `json:"value,omitempty"` +} + +// WorkspaceListResult is the list workspaces operation response. +type WorkspaceListResult struct { + autorest.Response `json:"-"` + Value *[]Workspace `json:"value,omitempty"` +} + +// WorkspaceListUsagesResult is the list workspace usages operation response. +type WorkspaceListUsagesResult struct { + autorest.Response `json:"-"` + Value *[]UsageMetric `json:"value,omitempty"` +} + +// WorkspaceProperties is workspace properties. +type WorkspaceProperties struct { + ProvisioningState EntityStatus `json:"provisioningState,omitempty"` + Source *string `json:"source,omitempty"` + CustomerID *string `json:"customerId,omitempty"` + PortalURL *string `json:"portalUrl,omitempty"` + Sku *Sku `json:"sku,omitempty"` + RetentionInDays *int32 `json:"retentionInDays,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/version.go index 6e632d4da5..ad6ad74e5a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/version.go @@ -1,29 +1,29 @@ -package operationalinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-operationalinsights/2015-11-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-operationalinsights/2015-11-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/workspaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/workspaces.go index a05c3698fb..be4d9c1f7b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/workspaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/operationalinsights/workspaces.go @@ -1,858 +1,858 @@ -package operationalinsights - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WorkspacesClient is the azure Log Analytics API reference -type WorkspacesClient struct { - ManagementClient -} - -// NewWorkspacesClient creates an instance of the WorkspacesClient client. -func NewWorkspacesClient(subscriptionID string) WorkspacesClient { - return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient -// client. -func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { - return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a workspace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the resource group name of the workspace. workspaceName -// is the name of the workspace. parameters is the parameters required to -// create or update a workspace. -func (client WorkspacesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, parameters Workspace, cancel <-chan struct{}) (<-chan Workspace, <-chan error) { - resultChan := make(chan Workspace, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 4, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WorkspaceProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.InclusiveMaximum, Rule: 730, Chain: nil}, - {Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.InclusiveMinimum, Rule: -1, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Workspace - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspacesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, parameters Workspace, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a workspace instance. -// -// resourceGroupName is the resource group name of the workspace. workspaceName -// is name of the Log Analytics Workspace. -func (client WorkspacesClient) Delete(resourceGroupName string, workspaceName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspacesClient) DeletePreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DisableIntelligencePack disables an intelligence pack for a given workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace. -// intelligencePackName is the name of the intelligence pack to be disabled. -func (client WorkspacesClient) DisableIntelligencePack(resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack") - } - - req, err := client.DisableIntelligencePackPreparer(resourceGroupName, workspaceName, intelligencePackName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", nil, "Failure preparing request") - return - } - - resp, err := client.DisableIntelligencePackSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", resp, "Failure sending request") - return - } - - result, err = client.DisableIntelligencePackResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", resp, "Failure responding to request") - } - - return -} - -// DisableIntelligencePackPreparer prepares the DisableIntelligencePack request. -func (client WorkspacesClient) DisableIntelligencePackPreparer(resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "intelligencePackName": autorest.Encode("path", intelligencePackName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DisableIntelligencePackSender sends the DisableIntelligencePack request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) DisableIntelligencePackSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DisableIntelligencePackResponder handles the response to the DisableIntelligencePack request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) DisableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// EnableIntelligencePack enables an intelligence pack for a given workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace. -// intelligencePackName is the name of the intelligence pack to be enabled. -func (client WorkspacesClient) EnableIntelligencePack(resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack") - } - - req, err := client.EnableIntelligencePackPreparer(resourceGroupName, workspaceName, intelligencePackName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", nil, "Failure preparing request") - return - } - - resp, err := client.EnableIntelligencePackSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", resp, "Failure sending request") - return - } - - result, err = client.EnableIntelligencePackResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", resp, "Failure responding to request") - } - - return -} - -// EnableIntelligencePackPreparer prepares the EnableIntelligencePack request. -func (client WorkspacesClient) EnableIntelligencePackPreparer(resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "intelligencePackName": autorest.Encode("path", intelligencePackName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// EnableIntelligencePackSender sends the EnableIntelligencePack request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) EnableIntelligencePackSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// EnableIntelligencePackResponder handles the response to the EnableIntelligencePack request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) EnableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a workspace instance. -// -// resourceGroupName is the resource group name of the workspace. workspaceName -// is name of the Log Analytics Workspace. -func (client WorkspacesClient) Get(resourceGroupName string, workspaceName string) (result Workspace, err error) { - req, err := client.GetPreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspacesClient) GetPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSharedKeys gets the shared keys for a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace. -func (client WorkspacesClient) GetSharedKeys(resourceGroupName string, workspaceName string) (result SharedKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys") - } - - req, err := client.GetSharedKeysPreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetSharedKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", resp, "Failure sending request") - return - } - - result, err = client.GetSharedKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", resp, "Failure responding to request") - } - - return -} - -// GetSharedKeysPreparer prepares the GetSharedKeys request. -func (client WorkspacesClient) GetSharedKeysPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSharedKeysSender sends the GetSharedKeys request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) GetSharedKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSharedKeysResponder handles the response to the GetSharedKeys request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) GetSharedKeysResponder(resp *http.Response) (result SharedKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the workspaces in a subscription. -func (client WorkspacesClient) List() (result WorkspaceListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspacesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets workspaces in a resource group. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. -func (client WorkspacesClient) ListByResourceGroup(resourceGroupName string) (result WorkspaceListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkspacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListIntelligencePacks lists all the intelligence packs possible and whether -// they are enabled or disabled for a given workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is name of the Log Analytics Workspace. -func (client WorkspacesClient) ListIntelligencePacks(resourceGroupName string, workspaceName string) (result ListIntelligencePack, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks") - } - - req, err := client.ListIntelligencePacksPreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", nil, "Failure preparing request") - return - } - - resp, err := client.ListIntelligencePacksSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", resp, "Failure sending request") - return - } - - result, err = client.ListIntelligencePacksResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", resp, "Failure responding to request") - } - - return -} - -// ListIntelligencePacksPreparer prepares the ListIntelligencePacks request. -func (client WorkspacesClient) ListIntelligencePacksPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListIntelligencePacksSender sends the ListIntelligencePacks request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListIntelligencePacksSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListIntelligencePacksResponder handles the response to the ListIntelligencePacks request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListIntelligencePacksResponder(resp *http.Response) (result ListIntelligencePack, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListManagementGroups gets a list of management groups connected to a -// workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is the name of the workspace. -func (client WorkspacesClient) ListManagementGroups(resourceGroupName string, workspaceName string) (result WorkspaceListManagementGroupsResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups") - } - - req, err := client.ListManagementGroupsPreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", nil, "Failure preparing request") - return - } - - resp, err := client.ListManagementGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", resp, "Failure sending request") - return - } - - result, err = client.ListManagementGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", resp, "Failure responding to request") - } - - return -} - -// ListManagementGroupsPreparer prepares the ListManagementGroups request. -func (client WorkspacesClient) ListManagementGroupsPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/managementGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListManagementGroupsSender sends the ListManagementGroups request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListManagementGroupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListManagementGroupsResponder handles the response to the ListManagementGroups request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListManagementGroupsResponder(resp *http.Response) (result WorkspaceListManagementGroupsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages gets a list of usage metrics for a workspace. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. workspaceName is the name of the workspace. -func (client WorkspacesClient) ListUsages(resourceGroupName string, workspaceName string) (result WorkspaceListUsagesResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListUsages") - } - - req, err := client.ListUsagesPreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", resp, "Failure responding to request") - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client WorkspacesClient) ListUsagesPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListUsagesResponder(resp *http.Response) (result WorkspaceListUsagesResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WorkspacesClient is the azure Log Analytics API reference +type WorkspacesClient struct { + ManagementClient +} + +// NewWorkspacesClient creates an instance of the WorkspacesClient client. +func NewWorkspacesClient(subscriptionID string) WorkspacesClient { + return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient +// client. +func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { + return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a workspace. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the resource group name of the workspace. workspaceName +// is the name of the workspace. parameters is the parameters required to +// create or update a workspace. +func (client WorkspacesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, parameters Workspace, cancel <-chan struct{}) (<-chan Workspace, <-chan error) { + resultChan := make(chan Workspace, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 4, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.WorkspaceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.InclusiveMaximum, Rule: 730, Chain: nil}, + {Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.InclusiveMinimum, Rule: -1, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Workspace + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkspacesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, parameters Workspace, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a workspace instance. +// +// resourceGroupName is the resource group name of the workspace. workspaceName +// is name of the Log Analytics Workspace. +func (client WorkspacesClient) Delete(resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkspacesClient) DeletePreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisableIntelligencePack disables an intelligence pack for a given workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace. +// intelligencePackName is the name of the intelligence pack to be disabled. +func (client WorkspacesClient) DisableIntelligencePack(resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack") + } + + req, err := client.DisableIntelligencePackPreparer(resourceGroupName, workspaceName, intelligencePackName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", nil, "Failure preparing request") + return + } + + resp, err := client.DisableIntelligencePackSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", resp, "Failure sending request") + return + } + + result, err = client.DisableIntelligencePackResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", resp, "Failure responding to request") + } + + return +} + +// DisableIntelligencePackPreparer prepares the DisableIntelligencePack request. +func (client WorkspacesClient) DisableIntelligencePackPreparer(resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "intelligencePackName": autorest.Encode("path", intelligencePackName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DisableIntelligencePackSender sends the DisableIntelligencePack request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DisableIntelligencePackSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DisableIntelligencePackResponder handles the response to the DisableIntelligencePack request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DisableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableIntelligencePack enables an intelligence pack for a given workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace. +// intelligencePackName is the name of the intelligence pack to be enabled. +func (client WorkspacesClient) EnableIntelligencePack(resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack") + } + + req, err := client.EnableIntelligencePackPreparer(resourceGroupName, workspaceName, intelligencePackName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", nil, "Failure preparing request") + return + } + + resp, err := client.EnableIntelligencePackSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", resp, "Failure sending request") + return + } + + result, err = client.EnableIntelligencePackResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", resp, "Failure responding to request") + } + + return +} + +// EnableIntelligencePackPreparer prepares the EnableIntelligencePack request. +func (client WorkspacesClient) EnableIntelligencePackPreparer(resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "intelligencePackName": autorest.Encode("path", intelligencePackName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EnableIntelligencePackSender sends the EnableIntelligencePack request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) EnableIntelligencePackSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EnableIntelligencePackResponder handles the response to the EnableIntelligencePack request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) EnableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a workspace instance. +// +// resourceGroupName is the resource group name of the workspace. workspaceName +// is name of the Log Analytics Workspace. +func (client WorkspacesClient) Get(resourceGroupName string, workspaceName string) (result Workspace, err error) { + req, err := client.GetPreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkspacesClient) GetPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSharedKeys gets the shared keys for a workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace. +func (client WorkspacesClient) GetSharedKeys(resourceGroupName string, workspaceName string) (result SharedKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys") + } + + req, err := client.GetSharedKeysPreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetSharedKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", resp, "Failure sending request") + return + } + + result, err = client.GetSharedKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", resp, "Failure responding to request") + } + + return +} + +// GetSharedKeysPreparer prepares the GetSharedKeys request. +func (client WorkspacesClient) GetSharedKeysPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSharedKeysSender sends the GetSharedKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) GetSharedKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSharedKeysResponder handles the response to the GetSharedKeys request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) GetSharedKeysResponder(resp *http.Response) (result SharedKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the workspaces in a subscription. +func (client WorkspacesClient) List() (result WorkspaceListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkspacesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets workspaces in a resource group. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. +func (client WorkspacesClient) ListByResourceGroup(resourceGroupName string) (result WorkspaceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkspacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListIntelligencePacks lists all the intelligence packs possible and whether +// they are enabled or disabled for a given workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is name of the Log Analytics Workspace. +func (client WorkspacesClient) ListIntelligencePacks(resourceGroupName string, workspaceName string) (result ListIntelligencePack, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks") + } + + req, err := client.ListIntelligencePacksPreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", nil, "Failure preparing request") + return + } + + resp, err := client.ListIntelligencePacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", resp, "Failure sending request") + return + } + + result, err = client.ListIntelligencePacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", resp, "Failure responding to request") + } + + return +} + +// ListIntelligencePacksPreparer prepares the ListIntelligencePacks request. +func (client WorkspacesClient) ListIntelligencePacksPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListIntelligencePacksSender sends the ListIntelligencePacks request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListIntelligencePacksSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListIntelligencePacksResponder handles the response to the ListIntelligencePacks request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListIntelligencePacksResponder(resp *http.Response) (result ListIntelligencePack, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListManagementGroups gets a list of management groups connected to a +// workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is the name of the workspace. +func (client WorkspacesClient) ListManagementGroups(resourceGroupName string, workspaceName string) (result WorkspaceListManagementGroupsResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups") + } + + req, err := client.ListManagementGroupsPreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", nil, "Failure preparing request") + return + } + + resp, err := client.ListManagementGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", resp, "Failure sending request") + return + } + + result, err = client.ListManagementGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", resp, "Failure responding to request") + } + + return +} + +// ListManagementGroupsPreparer prepares the ListManagementGroups request. +func (client WorkspacesClient) ListManagementGroupsPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/managementGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListManagementGroupsSender sends the ListManagementGroups request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListManagementGroupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListManagementGroupsResponder handles the response to the ListManagementGroups request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListManagementGroupsResponder(resp *http.Response) (result WorkspaceListManagementGroupsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages gets a list of usage metrics for a workspace. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. workspaceName is the name of the workspace. +func (client WorkspacesClient) ListUsages(resourceGroupName string, workspaceName string) (result WorkspaceListUsagesResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListUsages") + } + + req, err := client.ListUsagesPreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client WorkspacesClient) ListUsagesPreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListUsagesResponder(resp *http.Response) (result WorkspaceListUsagesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/client.go index d8b66e3fe6..25116e7e2b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/client.go @@ -1,114 +1,114 @@ -// Package powerbiembedded implements the Azure ARM Powerbiembedded service API -// version 2016-01-29. -// -// Client to manage your Power BI Embedded workspace collections and retrieve -// workspaces. -package powerbiembedded - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Powerbiembedded - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Powerbiembedded. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// GetAvailableOperations indicates which operations can be performed by the -// Power BI Resource Provider. -func (client ManagementClient) GetAvailableOperations() (result OperationList, err error) { - req, err := client.GetAvailableOperationsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.ManagementClient", "GetAvailableOperations", nil, "Failure preparing request") - return - } - - resp, err := client.GetAvailableOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.ManagementClient", "GetAvailableOperations", resp, "Failure sending request") - return - } - - result, err = client.GetAvailableOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.ManagementClient", "GetAvailableOperations", resp, "Failure responding to request") - } - - return -} - -// GetAvailableOperationsPreparer prepares the GetAvailableOperations request. -func (client ManagementClient) GetAvailableOperationsPreparer() (*http.Request, error) { - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.PowerBI/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAvailableOperationsSender sends the GetAvailableOperations request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetAvailableOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAvailableOperationsResponder handles the response to the GetAvailableOperations request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetAvailableOperationsResponder(resp *http.Response) (result OperationList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +// Package powerbiembedded implements the Azure ARM Powerbiembedded service API +// version 2016-01-29. +// +// Client to manage your Power BI Embedded workspace collections and retrieve +// workspaces. +package powerbiembedded + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Powerbiembedded + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Powerbiembedded. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// GetAvailableOperations indicates which operations can be performed by the +// Power BI Resource Provider. +func (client ManagementClient) GetAvailableOperations() (result OperationList, err error) { + req, err := client.GetAvailableOperationsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.ManagementClient", "GetAvailableOperations", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.ManagementClient", "GetAvailableOperations", resp, "Failure sending request") + return + } + + result, err = client.GetAvailableOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.ManagementClient", "GetAvailableOperations", resp, "Failure responding to request") + } + + return +} + +// GetAvailableOperationsPreparer prepares the GetAvailableOperations request. +func (client ManagementClient) GetAvailableOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.PowerBI/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAvailableOperationsSender sends the GetAvailableOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetAvailableOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAvailableOperationsResponder handles the response to the GetAvailableOperations request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetAvailableOperationsResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/models.go index ecf0c3516c..c89e648da2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/models.go @@ -1,162 +1,162 @@ -package powerbiembedded - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// AccessKeyName enumerates the values for access key name. -type AccessKeyName string - -const ( - // Key1 specifies the key 1 state for access key name. - Key1 AccessKeyName = "key1" - // Key2 specifies the key 2 state for access key name. - Key2 AccessKeyName = "key2" -) - -// CheckNameReason enumerates the values for check name reason. -type CheckNameReason string - -const ( - // Invalid specifies the invalid state for check name reason. - Invalid CheckNameReason = "Invalid" - // Unavailable specifies the unavailable state for check name reason. - Unavailable CheckNameReason = "Unavailable" -) - -// AzureSku is -type AzureSku struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` -} - -// CheckNameRequest is -type CheckNameRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// CheckNameResponse is -type CheckNameResponse struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason CheckNameReason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CreateWorkspaceCollectionRequest is -type CreateWorkspaceCollectionRequest struct { - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *AzureSku `json:"sku,omitempty"` -} - -// Display is -type Display struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` - Description *string `json:"description,omitempty"` - Origin *string `json:"origin,omitempty"` -} - -// Error is -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorDetail `json:"details,omitempty"` -} - -// ErrorDetail is -type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// MigrateWorkspaceCollectionRequest is -type MigrateWorkspaceCollectionRequest struct { - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` - Resources *[]string `json:"resources,omitempty"` -} - -// Operation is -type Operation struct { - Name *string `json:"name,omitempty"` - Display *Display `json:"display,omitempty"` -} - -// OperationList is -type OperationList struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` -} - -// UpdateWorkspaceCollectionRequest is -type UpdateWorkspaceCollectionRequest struct { - Tags *map[string]*string `json:"tags,omitempty"` - Sku *AzureSku `json:"sku,omitempty"` -} - -// Workspace is -type Workspace struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` -} - -// WorkspaceCollection is -type WorkspaceCollection struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *AzureSku `json:"sku,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` -} - -// WorkspaceCollectionAccessKey is -type WorkspaceCollectionAccessKey struct { - KeyName AccessKeyName `json:"keyName,omitempty"` -} - -// WorkspaceCollectionAccessKeys is -type WorkspaceCollectionAccessKeys struct { - autorest.Response `json:"-"` - Key1 *string `json:"key1,omitempty"` - Key2 *string `json:"key2,omitempty"` -} - -// WorkspaceCollectionList is -type WorkspaceCollectionList struct { - autorest.Response `json:"-"` - Value *[]WorkspaceCollection `json:"value,omitempty"` -} - -// WorkspaceList is -type WorkspaceList struct { - autorest.Response `json:"-"` - Value *[]Workspace `json:"value,omitempty"` -} +package powerbiembedded + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// AccessKeyName enumerates the values for access key name. +type AccessKeyName string + +const ( + // Key1 specifies the key 1 state for access key name. + Key1 AccessKeyName = "key1" + // Key2 specifies the key 2 state for access key name. + Key2 AccessKeyName = "key2" +) + +// CheckNameReason enumerates the values for check name reason. +type CheckNameReason string + +const ( + // Invalid specifies the invalid state for check name reason. + Invalid CheckNameReason = "Invalid" + // Unavailable specifies the unavailable state for check name reason. + Unavailable CheckNameReason = "Unavailable" +) + +// AzureSku is +type AzureSku struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} + +// CheckNameRequest is +type CheckNameRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// CheckNameResponse is +type CheckNameResponse struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason CheckNameReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CreateWorkspaceCollectionRequest is +type CreateWorkspaceCollectionRequest struct { + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *AzureSku `json:"sku,omitempty"` +} + +// Display is +type Display struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` + Origin *string `json:"origin,omitempty"` +} + +// Error is +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` +} + +// ErrorDetail is +type ErrorDetail struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} + +// MigrateWorkspaceCollectionRequest is +type MigrateWorkspaceCollectionRequest struct { + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + Resources *[]string `json:"resources,omitempty"` +} + +// Operation is +type Operation struct { + Name *string `json:"name,omitempty"` + Display *Display `json:"display,omitempty"` +} + +// OperationList is +type OperationList struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// UpdateWorkspaceCollectionRequest is +type UpdateWorkspaceCollectionRequest struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *AzureSku `json:"sku,omitempty"` +} + +// Workspace is +type Workspace struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// WorkspaceCollection is +type WorkspaceCollection struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *AzureSku `json:"sku,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` +} + +// WorkspaceCollectionAccessKey is +type WorkspaceCollectionAccessKey struct { + KeyName AccessKeyName `json:"keyName,omitempty"` +} + +// WorkspaceCollectionAccessKeys is +type WorkspaceCollectionAccessKeys struct { + autorest.Response `json:"-"` + Key1 *string `json:"key1,omitempty"` + Key2 *string `json:"key2,omitempty"` +} + +// WorkspaceCollectionList is +type WorkspaceCollectionList struct { + autorest.Response `json:"-"` + Value *[]WorkspaceCollection `json:"value,omitempty"` +} + +// WorkspaceList is +type WorkspaceList struct { + autorest.Response `json:"-"` + Value *[]Workspace `json:"value,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/version.go index 6a22139f88..83a32bd170 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/version.go @@ -1,29 +1,29 @@ -package powerbiembedded - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-powerbiembedded/2016-01-29" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package powerbiembedded + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-powerbiembedded/2016-01-29" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspacecollections.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspacecollections.go index 3958607f8c..77a3c749b9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspacecollections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspacecollections.go @@ -1,739 +1,739 @@ -package powerbiembedded - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WorkspaceCollectionsClient is the client to manage your Power BI Embedded -// workspace collections and retrieve workspaces. -type WorkspaceCollectionsClient struct { - ManagementClient -} - -// NewWorkspaceCollectionsClient creates an instance of the -// WorkspaceCollectionsClient client. -func NewWorkspaceCollectionsClient(subscriptionID string) WorkspaceCollectionsClient { - return NewWorkspaceCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspaceCollectionsClientWithBaseURI creates an instance of the -// WorkspaceCollectionsClient client. -func NewWorkspaceCollectionsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceCollectionsClient { - return WorkspaceCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability verify the specified Power BI Workspace Collection -// name is valid and not already in use. -// -// location is azure location body is check name availability request -func (client WorkspaceCollectionsClient) CheckNameAvailability(location string, body CheckNameRequest) (result CheckNameResponse, err error) { - req, err := client.CheckNameAvailabilityPreparer(location, body) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client WorkspaceCollectionsClient) CheckNameAvailabilityPreparer(location string, body CheckNameRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create creates a new Power BI Workspace Collection with the specified -// properties. A Power BI Workspace Collection contains one or more workspaces, -// and can be used to provision keys that provide API access to those -// workspaces. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name body is create workspace collection -// request -func (client WorkspaceCollectionsClient) Create(resourceGroupName string, workspaceCollectionName string, body CreateWorkspaceCollectionRequest) (result WorkspaceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.Sku.Tier", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, workspaceCollectionName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WorkspaceCollectionsClient) CreatePreparer(resourceGroupName string, workspaceCollectionName string, body CreateWorkspaceCollectionRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) CreateResponder(resp *http.Response) (result WorkspaceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Power BI Workspace Collection. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name -func (client WorkspaceCollectionsClient) Delete(resourceGroupName string, workspaceCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, workspaceCollectionName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client WorkspaceCollectionsClient) DeletePreparer(resourceGroupName string, workspaceCollectionName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetAccessKeys retrieves the primary and secondary access keys for the -// specified Power BI Workspace Collection. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name -func (client WorkspaceCollectionsClient) GetAccessKeys(resourceGroupName string, workspaceCollectionName string) (result WorkspaceCollectionAccessKeys, err error) { - req, err := client.GetAccessKeysPreparer(resourceGroupName, workspaceCollectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetAccessKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetAccessKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetAccessKeys", resp, "Failure sending request") - return - } - - result, err = client.GetAccessKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetAccessKeys", resp, "Failure responding to request") - } - - return -} - -// GetAccessKeysPreparer prepares the GetAccessKeys request. -func (client WorkspaceCollectionsClient) GetAccessKeysPreparer(resourceGroupName string, workspaceCollectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAccessKeysSender sends the GetAccessKeys request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) GetAccessKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAccessKeysResponder handles the response to the GetAccessKeys request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) GetAccessKeysResponder(resp *http.Response) (result WorkspaceCollectionAccessKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByName retrieves an existing Power BI Workspace Collection. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name -func (client WorkspaceCollectionsClient) GetByName(resourceGroupName string, workspaceCollectionName string) (result WorkspaceCollection, err error) { - req, err := client.GetByNamePreparer(resourceGroupName, workspaceCollectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetByName", nil, "Failure preparing request") - return - } - - resp, err := client.GetByNameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetByName", resp, "Failure sending request") - return - } - - result, err = client.GetByNameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetByName", resp, "Failure responding to request") - } - - return -} - -// GetByNamePreparer prepares the GetByName request. -func (client WorkspaceCollectionsClient) GetByNamePreparer(resourceGroupName string, workspaceCollectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByNameSender sends the GetByName request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) GetByNameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByNameResponder handles the response to the GetByName request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) GetByNameResponder(resp *http.Response) (result WorkspaceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieves all existing Power BI workspace collections in -// the specified resource group. -// -// resourceGroupName is azure resource group -func (client WorkspaceCollectionsClient) ListByResourceGroup(resourceGroupName string) (result WorkspaceCollectionList, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkspaceCollectionsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceCollectionList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription retrieves all existing Power BI workspace collections in -// the specified subscription. -func (client WorkspaceCollectionsClient) ListBySubscription() (result WorkspaceCollectionList, err error) { - req, err := client.ListBySubscriptionPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client WorkspaceCollectionsClient) ListBySubscriptionPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/workspaceCollections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceCollectionList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Migrate migrates an existing Power BI Workspace Collection to a different -// resource group and/or subscription. -// -// resourceGroupName is azure resource group body is workspace migration -// request -func (client WorkspaceCollectionsClient) Migrate(resourceGroupName string, body MigrateWorkspaceCollectionRequest) (result autorest.Response, err error) { - req, err := client.MigratePreparer(resourceGroupName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Migrate", nil, "Failure preparing request") - return - } - - resp, err := client.MigrateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Migrate", resp, "Failure sending request") - return - } - - result, err = client.MigrateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Migrate", resp, "Failure responding to request") - } - - return -} - -// MigratePreparer prepares the Migrate request. -func (client WorkspaceCollectionsClient) MigratePreparer(resourceGroupName string, body MigrateWorkspaceCollectionRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MigrateSender sends the Migrate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) MigrateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MigrateResponder handles the response to the Migrate request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) MigrateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RegenerateKey regenerates the primary or secondary access key for the -// specified Power BI Workspace Collection. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name body is access key to regenerate -func (client WorkspaceCollectionsClient) RegenerateKey(resourceGroupName string, workspaceCollectionName string, body WorkspaceCollectionAccessKey) (result WorkspaceCollectionAccessKeys, err error) { - req, err := client.RegenerateKeyPreparer(resourceGroupName, workspaceCollectionName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client WorkspaceCollectionsClient) RegenerateKeyPreparer(resourceGroupName string, workspaceCollectionName string, body WorkspaceCollectionAccessKey) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/regenerateKey", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) RegenerateKeyResponder(resp *http.Response) (result WorkspaceCollectionAccessKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an existing Power BI Workspace Collection with the specified -// properties. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name body is update workspace collection -// request -func (client WorkspaceCollectionsClient) Update(resourceGroupName string, workspaceCollectionName string, body UpdateWorkspaceCollectionRequest) (result WorkspaceCollection, err error) { - req, err := client.UpdatePreparer(resourceGroupName, workspaceCollectionName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkspaceCollectionsClient) UpdatePreparer(resourceGroupName string, workspaceCollectionName string, body UpdateWorkspaceCollectionRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspaceCollectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkspaceCollectionsClient) UpdateResponder(resp *http.Response) (result WorkspaceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package powerbiembedded + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WorkspaceCollectionsClient is the client to manage your Power BI Embedded +// workspace collections and retrieve workspaces. +type WorkspaceCollectionsClient struct { + ManagementClient +} + +// NewWorkspaceCollectionsClient creates an instance of the +// WorkspaceCollectionsClient client. +func NewWorkspaceCollectionsClient(subscriptionID string) WorkspaceCollectionsClient { + return NewWorkspaceCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspaceCollectionsClientWithBaseURI creates an instance of the +// WorkspaceCollectionsClient client. +func NewWorkspaceCollectionsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceCollectionsClient { + return WorkspaceCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability verify the specified Power BI Workspace Collection +// name is valid and not already in use. +// +// location is azure location body is check name availability request +func (client WorkspaceCollectionsClient) CheckNameAvailability(location string, body CheckNameRequest) (result CheckNameResponse, err error) { + req, err := client.CheckNameAvailabilityPreparer(location, body) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client WorkspaceCollectionsClient) CheckNameAvailabilityPreparer(location string, body CheckNameRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates a new Power BI Workspace Collection with the specified +// properties. A Power BI Workspace Collection contains one or more workspaces, +// and can be used to provision keys that provide API access to those +// workspaces. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name body is create workspace collection +// request +func (client WorkspaceCollectionsClient) Create(resourceGroupName string, workspaceCollectionName string, body CreateWorkspaceCollectionRequest) (result WorkspaceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku.Tier", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, workspaceCollectionName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client WorkspaceCollectionsClient) CreatePreparer(resourceGroupName string, workspaceCollectionName string, body CreateWorkspaceCollectionRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) CreateResponder(resp *http.Response) (result WorkspaceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a Power BI Workspace Collection. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name +func (client WorkspaceCollectionsClient) Delete(resourceGroupName string, workspaceCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, workspaceCollectionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client WorkspaceCollectionsClient) DeletePreparer(resourceGroupName string, workspaceCollectionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetAccessKeys retrieves the primary and secondary access keys for the +// specified Power BI Workspace Collection. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name +func (client WorkspaceCollectionsClient) GetAccessKeys(resourceGroupName string, workspaceCollectionName string) (result WorkspaceCollectionAccessKeys, err error) { + req, err := client.GetAccessKeysPreparer(resourceGroupName, workspaceCollectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetAccessKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetAccessKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetAccessKeys", resp, "Failure sending request") + return + } + + result, err = client.GetAccessKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetAccessKeys", resp, "Failure responding to request") + } + + return +} + +// GetAccessKeysPreparer prepares the GetAccessKeys request. +func (client WorkspaceCollectionsClient) GetAccessKeysPreparer(resourceGroupName string, workspaceCollectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAccessKeysSender sends the GetAccessKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) GetAccessKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAccessKeysResponder handles the response to the GetAccessKeys request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) GetAccessKeysResponder(resp *http.Response) (result WorkspaceCollectionAccessKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByName retrieves an existing Power BI Workspace Collection. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name +func (client WorkspaceCollectionsClient) GetByName(resourceGroupName string, workspaceCollectionName string) (result WorkspaceCollection, err error) { + req, err := client.GetByNamePreparer(resourceGroupName, workspaceCollectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetByName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetByName", resp, "Failure sending request") + return + } + + result, err = client.GetByNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "GetByName", resp, "Failure responding to request") + } + + return +} + +// GetByNamePreparer prepares the GetByName request. +func (client WorkspaceCollectionsClient) GetByNamePreparer(resourceGroupName string, workspaceCollectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByNameSender sends the GetByName request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) GetByNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByNameResponder handles the response to the GetByName request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) GetByNameResponder(resp *http.Response) (result WorkspaceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup retrieves all existing Power BI workspace collections in +// the specified resource group. +// +// resourceGroupName is azure resource group +func (client WorkspaceCollectionsClient) ListByResourceGroup(resourceGroupName string) (result WorkspaceCollectionList, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkspaceCollectionsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceCollectionList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription retrieves all existing Power BI workspace collections in +// the specified subscription. +func (client WorkspaceCollectionsClient) ListBySubscription() (result WorkspaceCollectionList, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WorkspaceCollectionsClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/workspaceCollections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceCollectionList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Migrate migrates an existing Power BI Workspace Collection to a different +// resource group and/or subscription. +// +// resourceGroupName is azure resource group body is workspace migration +// request +func (client WorkspaceCollectionsClient) Migrate(resourceGroupName string, body MigrateWorkspaceCollectionRequest) (result autorest.Response, err error) { + req, err := client.MigratePreparer(resourceGroupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Migrate", nil, "Failure preparing request") + return + } + + resp, err := client.MigrateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Migrate", resp, "Failure sending request") + return + } + + result, err = client.MigrateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Migrate", resp, "Failure responding to request") + } + + return +} + +// MigratePreparer prepares the Migrate request. +func (client WorkspaceCollectionsClient) MigratePreparer(resourceGroupName string, body MigrateWorkspaceCollectionRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MigrateSender sends the Migrate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) MigrateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MigrateResponder handles the response to the Migrate request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) MigrateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RegenerateKey regenerates the primary or secondary access key for the +// specified Power BI Workspace Collection. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name body is access key to regenerate +func (client WorkspaceCollectionsClient) RegenerateKey(resourceGroupName string, workspaceCollectionName string, body WorkspaceCollectionAccessKey) (result WorkspaceCollectionAccessKeys, err error) { + req, err := client.RegenerateKeyPreparer(resourceGroupName, workspaceCollectionName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client WorkspaceCollectionsClient) RegenerateKeyPreparer(resourceGroupName string, workspaceCollectionName string, body WorkspaceCollectionAccessKey) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/regenerateKey", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) RegenerateKeyResponder(resp *http.Response) (result WorkspaceCollectionAccessKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update an existing Power BI Workspace Collection with the specified +// properties. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name body is update workspace collection +// request +func (client WorkspaceCollectionsClient) Update(resourceGroupName string, workspaceCollectionName string, body UpdateWorkspaceCollectionRequest) (result WorkspaceCollection, err error) { + req, err := client.UpdatePreparer(resourceGroupName, workspaceCollectionName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspaceCollectionsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkspaceCollectionsClient) UpdatePreparer(resourceGroupName string, workspaceCollectionName string, body UpdateWorkspaceCollectionRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceCollectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkspaceCollectionsClient) UpdateResponder(resp *http.Response) (result WorkspaceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspaces.go index 65205c9908..a34b282a6a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/powerbiembedded/workspaces.go @@ -1,109 +1,109 @@ -package powerbiembedded - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// WorkspacesClient is the client to manage your Power BI Embedded workspace -// collections and retrieve workspaces. -type WorkspacesClient struct { - ManagementClient -} - -// NewWorkspacesClient creates an instance of the WorkspacesClient client. -func NewWorkspacesClient(subscriptionID string) WorkspacesClient { - return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient -// client. -func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { - return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List retrieves all existing Power BI workspaces in the specified workspace -// collection. -// -// resourceGroupName is azure resource group workspaceCollectionName is power -// BI Embedded Workspace Collection name -func (client WorkspacesClient) List(resourceGroupName string, workspaceCollectionName string) (result WorkspaceList, err error) { - req, err := client.ListPreparer(resourceGroupName, workspaceCollectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspacesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkspacesClient) ListPreparer(resourceGroupName string, workspaceCollectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), - } - - const APIVersion = "2016-01-29" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package powerbiembedded + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkspacesClient is the client to manage your Power BI Embedded workspace +// collections and retrieve workspaces. +type WorkspacesClient struct { + ManagementClient +} + +// NewWorkspacesClient creates an instance of the WorkspacesClient client. +func NewWorkspacesClient(subscriptionID string) WorkspacesClient { + return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient +// client. +func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { + return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List retrieves all existing Power BI workspaces in the specified workspace +// collection. +// +// resourceGroupName is azure resource group workspaceCollectionName is power +// BI Embedded Workspace Collection name +func (client WorkspacesClient) List(resourceGroupName string, workspaceCollectionName string) (result WorkspaceList, err error) { + req, err := client.ListPreparer(resourceGroupName, workspaceCollectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspacesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "powerbiembedded.WorkspacesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkspacesClient) ListPreparer(resourceGroupName string, workspaceCollectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceCollectionName": autorest.Encode("path", workspaceCollectionName), + } + + const APIVersion = "2016-01-29" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/client.go index e34893c5ab..98b156452f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/client.go @@ -1,53 +1,53 @@ -// Package recoveryservices implements the Azure ARM Recoveryservices service -// API version 2016-06-01. -// -// -package recoveryservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Recoveryservices - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Recoveryservices. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package recoveryservices implements the Azure ARM Recoveryservices service +// API version 2016-06-01. +// +// +package recoveryservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Recoveryservices + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Recoveryservices. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/models.go index 24c009ce4f..0117b9bf73 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/models.go @@ -1,192 +1,192 @@ -package recoveryservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // RS0 specifies the rs0 state for sku name. - RS0 SkuName = "RS0" - // Standard specifies the standard state for sku name. - Standard SkuName = "Standard" -) - -// TriggerType enumerates the values for trigger type. -type TriggerType string - -const ( - // ForcedUpgrade specifies the forced upgrade state for trigger type. - ForcedUpgrade TriggerType = "ForcedUpgrade" - // UserTriggered specifies the user triggered state for trigger type. - UserTriggered TriggerType = "UserTriggered" -) - -// VaultUpgradeState enumerates the values for vault upgrade state. -type VaultUpgradeState string - -const ( - // Failed specifies the failed state for vault upgrade state. - Failed VaultUpgradeState = "Failed" - // InProgress specifies the in progress state for vault upgrade state. - InProgress VaultUpgradeState = "InProgress" - // Unknown specifies the unknown state for vault upgrade state. - Unknown VaultUpgradeState = "Unknown" - // Upgraded specifies the upgraded state for vault upgrade state. - Upgraded VaultUpgradeState = "Upgraded" -) - -// ClientDiscoveryDisplay is localized display information of an operation. -type ClientDiscoveryDisplay struct { - Provider *string `json:"Provider,omitempty"` - Resource *string `json:"Resource,omitempty"` - Operation *string `json:"Operation,omitempty"` - Description *string `json:"Description,omitempty"` -} - -// ClientDiscoveryForLogSpecification is log specification for the operation. -type ClientDiscoveryForLogSpecification struct { - Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - BlobDuration *date.Time `json:"blobDuration,omitempty"` -} - -// ClientDiscoveryForServiceSpecification is operation properties. -type ClientDiscoveryForServiceSpecification struct { - LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` -} - -// ClientDiscoveryProperties is operation properties. -type ClientDiscoveryProperties struct { - ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// ClientDiscoveryResponse is list of available operations. -type ClientDiscoveryResponse struct { - autorest.Response `json:"-"` - Value *[]ClientDiscoveryValueForSingleAPI `json:"Value,omitempty"` - NextLink *string `json:"NextLink,omitempty"` -} - -// ClientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClientDiscoveryResponse) ClientDiscoveryResponsePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClientDiscoveryValueForSingleAPI is available operation details. -type ClientDiscoveryValueForSingleAPI struct { - Name *string `json:"Name,omitempty"` - Display *ClientDiscoveryDisplay `json:"Display,omitempty"` - Origin *string `json:"Origin,omitempty"` - *ClientDiscoveryProperties `json:"Properties,omitempty"` -} - -// Resource is aRM Resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - ETag *string `json:"eTag,omitempty"` -} - -// Sku is identifies the unique system identifier for each Azure resource. -type Sku struct { - Name SkuName `json:"name,omitempty"` -} - -// TrackedResource is tracked resource with location. -type TrackedResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - ETag *string `json:"eTag,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// UpgradeDetails is details for upgrading vault. -type UpgradeDetails struct { - OperationID *string `json:"operationId,omitempty"` - StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` - LastUpdatedTimeUtc *date.Time `json:"lastUpdatedTimeUtc,omitempty"` - EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` - Status VaultUpgradeState `json:"status,omitempty"` - Message *string `json:"message,omitempty"` - TriggerType TriggerType `json:"triggerType,omitempty"` - UpgradedResourceID *string `json:"upgradedResourceId,omitempty"` - PreviousResourceID *string `json:"previousResourceId,omitempty"` -} - -// Vault is resource information, as returned by the resource provider. -type Vault struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - ETag *string `json:"eTag,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *VaultProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// VaultExtendedInfo is vault extended information. -type VaultExtendedInfo struct { - IntegrityKey *string `json:"integrityKey,omitempty"` - EncryptionKey *string `json:"encryptionKey,omitempty"` - EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` - Algorithm *string `json:"algorithm,omitempty"` -} - -// VaultExtendedInfoResource is vault extended information. -type VaultExtendedInfoResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - ETag *string `json:"eTag,omitempty"` - *VaultExtendedInfo `json:"properties,omitempty"` -} - -// VaultList is the response model for a list of Vaults. -type VaultList struct { - autorest.Response `json:"-"` - Value *[]Vault `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// VaultProperties is properties of the vault. -type VaultProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` -} +package recoveryservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // RS0 specifies the rs0 state for sku name. + RS0 SkuName = "RS0" + // Standard specifies the standard state for sku name. + Standard SkuName = "Standard" +) + +// TriggerType enumerates the values for trigger type. +type TriggerType string + +const ( + // ForcedUpgrade specifies the forced upgrade state for trigger type. + ForcedUpgrade TriggerType = "ForcedUpgrade" + // UserTriggered specifies the user triggered state for trigger type. + UserTriggered TriggerType = "UserTriggered" +) + +// VaultUpgradeState enumerates the values for vault upgrade state. +type VaultUpgradeState string + +const ( + // Failed specifies the failed state for vault upgrade state. + Failed VaultUpgradeState = "Failed" + // InProgress specifies the in progress state for vault upgrade state. + InProgress VaultUpgradeState = "InProgress" + // Unknown specifies the unknown state for vault upgrade state. + Unknown VaultUpgradeState = "Unknown" + // Upgraded specifies the upgraded state for vault upgrade state. + Upgraded VaultUpgradeState = "Upgraded" +) + +// ClientDiscoveryDisplay is localized display information of an operation. +type ClientDiscoveryDisplay struct { + Provider *string `json:"Provider,omitempty"` + Resource *string `json:"Resource,omitempty"` + Operation *string `json:"Operation,omitempty"` + Description *string `json:"Description,omitempty"` +} + +// ClientDiscoveryForLogSpecification is log specification for the operation. +type ClientDiscoveryForLogSpecification struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + BlobDuration *date.Time `json:"blobDuration,omitempty"` +} + +// ClientDiscoveryForServiceSpecification is operation properties. +type ClientDiscoveryForServiceSpecification struct { + LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` +} + +// ClientDiscoveryProperties is operation properties. +type ClientDiscoveryProperties struct { + ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// ClientDiscoveryResponse is list of available operations. +type ClientDiscoveryResponse struct { + autorest.Response `json:"-"` + Value *[]ClientDiscoveryValueForSingleAPI `json:"Value,omitempty"` + NextLink *string `json:"NextLink,omitempty"` +} + +// ClientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClientDiscoveryResponse) ClientDiscoveryResponsePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClientDiscoveryValueForSingleAPI is available operation details. +type ClientDiscoveryValueForSingleAPI struct { + Name *string `json:"Name,omitempty"` + Display *ClientDiscoveryDisplay `json:"Display,omitempty"` + Origin *string `json:"Origin,omitempty"` + *ClientDiscoveryProperties `json:"Properties,omitempty"` +} + +// Resource is aRM Resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` +} + +// Sku is identifies the unique system identifier for each Azure resource. +type Sku struct { + Name SkuName `json:"name,omitempty"` +} + +// TrackedResource is tracked resource with location. +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// UpgradeDetails is details for upgrading vault. +type UpgradeDetails struct { + OperationID *string `json:"operationId,omitempty"` + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + LastUpdatedTimeUtc *date.Time `json:"lastUpdatedTimeUtc,omitempty"` + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + Status VaultUpgradeState `json:"status,omitempty"` + Message *string `json:"message,omitempty"` + TriggerType TriggerType `json:"triggerType,omitempty"` + UpgradedResourceID *string `json:"upgradedResourceId,omitempty"` + PreviousResourceID *string `json:"previousResourceId,omitempty"` +} + +// Vault is resource information, as returned by the resource provider. +type Vault struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// VaultExtendedInfo is vault extended information. +type VaultExtendedInfo struct { + IntegrityKey *string `json:"integrityKey,omitempty"` + EncryptionKey *string `json:"encryptionKey,omitempty"` + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + Algorithm *string `json:"algorithm,omitempty"` +} + +// VaultExtendedInfoResource is vault extended information. +type VaultExtendedInfoResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + ETag *string `json:"eTag,omitempty"` + *VaultExtendedInfo `json:"properties,omitempty"` +} + +// VaultList is the response model for a list of Vaults. +type VaultList struct { + autorest.Response `json:"-"` + Value *[]Vault `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// VaultProperties is properties of the vault. +type VaultProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/operations.go index 0daddc86d9..7e0a9cedc5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/operations.go @@ -1,131 +1,131 @@ -package recoveryservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the -// Recoveryservices service. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List returns the list of available operations. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. -func (client OperationsClient) List(resourceGroupName string) (result ClientDiscoveryResponse, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { - req, err := lastResults.ClientDiscoveryResponsePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the +// Recoveryservices service. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List returns the list of available operations. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. +func (client OperationsClient) List(resourceGroupName string) (result ClientDiscoveryResponse, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { + req, err := lastResults.ClientDiscoveryResponsePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaultextendedinfo.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaultextendedinfo.go index 21cbb51788..9c2ca76a43 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaultextendedinfo.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaultextendedinfo.go @@ -1,250 +1,250 @@ -package recoveryservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VaultExtendedInfoClient is the client for the VaultExtendedInfo methods of -// the Recoveryservices service. -type VaultExtendedInfoClient struct { - ManagementClient -} - -// NewVaultExtendedInfoClient creates an instance of the -// VaultExtendedInfoClient client. -func NewVaultExtendedInfoClient(subscriptionID string) VaultExtendedInfoClient { - return NewVaultExtendedInfoClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultExtendedInfoClientWithBaseURI creates an instance of the -// VaultExtendedInfoClient client. -func NewVaultExtendedInfoClientWithBaseURI(baseURI string, subscriptionID string) VaultExtendedInfoClient { - return VaultExtendedInfoClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create vault extended info. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. resourceResourceExtendedInfoDetails is -// resourceResourceExtendedInfoDetails -func (client VaultExtendedInfoClient) CreateOrUpdate(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultExtendedInfoClient) CreateOrUpdatePreparer(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithJSON(resourceResourceExtendedInfoDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) CreateOrUpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the vault extended info. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. -func (client VaultExtendedInfoClient) Get(resourceGroupName string, vaultName string) (result VaultExtendedInfoResource, err error) { - req, err := client.GetPreparer(resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultExtendedInfoClient) GetPreparer(resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) GetResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update vault extended info. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. resourceResourceExtendedInfoDetails is -// resourceResourceExtendedInfoDetails -func (client VaultExtendedInfoClient) Update(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { - req, err := client.UpdatePreparer(resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VaultExtendedInfoClient) UpdatePreparer(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), - autorest.WithJSON(resourceResourceExtendedInfoDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VaultExtendedInfoClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VaultExtendedInfoClient) UpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VaultExtendedInfoClient is the client for the VaultExtendedInfo methods of +// the Recoveryservices service. +type VaultExtendedInfoClient struct { + ManagementClient +} + +// NewVaultExtendedInfoClient creates an instance of the +// VaultExtendedInfoClient client. +func NewVaultExtendedInfoClient(subscriptionID string) VaultExtendedInfoClient { + return NewVaultExtendedInfoClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultExtendedInfoClientWithBaseURI creates an instance of the +// VaultExtendedInfoClient client. +func NewVaultExtendedInfoClientWithBaseURI(baseURI string, subscriptionID string) VaultExtendedInfoClient { + return VaultExtendedInfoClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create vault extended info. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. resourceResourceExtendedInfoDetails is +// resourceResourceExtendedInfoDetails +func (client VaultExtendedInfoClient) CreateOrUpdate(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VaultExtendedInfoClient) CreateOrUpdatePreparer(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithJSON(resourceResourceExtendedInfoDetails), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VaultExtendedInfoClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VaultExtendedInfoClient) CreateOrUpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the vault extended info. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. +func (client VaultExtendedInfoClient) Get(resourceGroupName string, vaultName string) (result VaultExtendedInfoResource, err error) { + req, err := client.GetPreparer(resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VaultExtendedInfoClient) GetPreparer(resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VaultExtendedInfoClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VaultExtendedInfoClient) GetResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update vault extended info. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. resourceResourceExtendedInfoDetails is +// resourceResourceExtendedInfoDetails +func (client VaultExtendedInfoClient) Update(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (result VaultExtendedInfoResource, err error) { + req, err := client.UpdatePreparer(resourceGroupName, vaultName, resourceResourceExtendedInfoDetails) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultExtendedInfoClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VaultExtendedInfoClient) UpdatePreparer(resourceGroupName string, vaultName string, resourceResourceExtendedInfoDetails VaultExtendedInfoResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo", pathParameters), + autorest.WithJSON(resourceResourceExtendedInfoDetails), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VaultExtendedInfoClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VaultExtendedInfoClient) UpdateResponder(resp *http.Response) (result VaultExtendedInfoResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaults.go index 0c2280ccb5..dbbd47d8c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/vaults.go @@ -1,439 +1,439 @@ -package recoveryservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// VaultsClient is the client for the Vaults methods of the Recoveryservices -// service. -type VaultsClient struct { - ManagementClient -} - -// NewVaultsClient creates an instance of the VaultsClient client. -func NewVaultsClient(subscriptionID string) VaultsClient { - return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client. -func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { - return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Recovery Services vault. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. vault is recovery Services Vault to be created. -func (client VaultsClient) CreateOrUpdate(resourceGroupName string, vaultName string, vault Vault) (result Vault, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, vaultName, vault) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VaultsClient) CreateOrUpdatePreparer(resourceGroupName string, vaultName string, vault Vault) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithJSON(vault), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a vault. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. -func (client VaultsClient) Delete(resourceGroupName string, vaultName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VaultsClient) DeletePreparer(resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the Vault details. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. -func (client VaultsClient) Get(resourceGroupName string, vaultName string) (result Vault, err error) { - req, err := client.GetPreparer(resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client VaultsClient) GetPreparer(resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup retrieve a list of Vaults. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. -func (client VaultsClient) ListByResourceGroup(resourceGroupName string) (result VaultList, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client VaultsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionID fetches all the resources of the specified type in the -// subscription. -func (client VaultsClient) ListBySubscriptionID() (result VaultList, err error) { - req, err := client.ListBySubscriptionIDPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client VaultsClient) ListBySubscriptionIDPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListBySubscriptionIDResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates the vault. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. vaultName is the name of the recovery services -// vault. vault is recovery Services Vault to be created. -func (client VaultsClient) Update(resourceGroupName string, vaultName string, vault Vault) (result Vault, err error) { - req, err := client.UpdatePreparer(resourceGroupName, vaultName, vault) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VaultsClient) UpdatePreparer(resourceGroupName string, vaultName string, vault Vault) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), - autorest.WithJSON(vault), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VaultsClient) UpdateResponder(resp *http.Response) (result Vault, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// VaultsClient is the client for the Vaults methods of the Recoveryservices +// service. +type VaultsClient struct { + ManagementClient +} + +// NewVaultsClient creates an instance of the VaultsClient client. +func NewVaultsClient(subscriptionID string) VaultsClient { + return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client. +func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { + return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Recovery Services vault. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. vault is recovery Services Vault to be created. +func (client VaultsClient) CreateOrUpdate(resourceGroupName string, vaultName string, vault Vault) (result Vault, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, vaultName, vault) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VaultsClient) CreateOrUpdatePreparer(resourceGroupName string, vaultName string, vault Vault) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), + autorest.WithJSON(vault), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a vault. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. +func (client VaultsClient) Delete(resourceGroupName string, vaultName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VaultsClient) DeletePreparer(resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Vault details. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. +func (client VaultsClient) Get(resourceGroupName string, vaultName string) (result Vault, err error) { + req, err := client.GetPreparer(resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client VaultsClient) GetPreparer(resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup retrieve a list of Vaults. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. +func (client VaultsClient) ListByResourceGroup(resourceGroupName string) (result VaultList, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VaultsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionID fetches all the resources of the specified type in the +// subscription. +func (client VaultsClient) ListBySubscriptionID() (result VaultList, err error) { + req, err := client.ListBySubscriptionIDPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "ListBySubscriptionID", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client VaultsClient) ListBySubscriptionIDPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListBySubscriptionIDResponder(resp *http.Response) (result VaultList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the vault. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. vaultName is the name of the recovery services +// vault. vault is recovery Services Vault to be created. +func (client VaultsClient) Update(resourceGroupName string, vaultName string, vault Vault) (result Vault, err error) { + req, err := client.UpdatePreparer(resourceGroupName, vaultName, vault) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservices.VaultsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VaultsClient) UpdatePreparer(resourceGroupName string, vaultName string, vault Vault) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}", pathParameters), + autorest.WithJSON(vault), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VaultsClient) UpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/version.go index 7d7c70341b..4299a0ef65 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservices/version.go @@ -1,29 +1,29 @@ -package recoveryservices - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-recoveryservices/2016-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package recoveryservices + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-recoveryservices/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupengines.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupengines.go index 340adbb910..4d3c2156f5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupengines.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupengines.go @@ -1,216 +1,216 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupEnginesClient is the client for the BackupEngines methods of the -// Recoveryservicesbackup service. -type BackupEnginesClient struct { - ManagementClient -} - -// NewBackupEnginesClient creates an instance of the BackupEnginesClient -// client. -func NewBackupEnginesClient(subscriptionID string) BackupEnginesClient { - return NewBackupEnginesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupEnginesClientWithBaseURI creates an instance of the -// BackupEnginesClient client. -func NewBackupEnginesClientWithBaseURI(baseURI string, subscriptionID string) BackupEnginesClient { - return BackupEnginesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns backup management server registered to Recovery Services Vault. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// backupEngineName is name of the backup management server. filter is oData -// filter options. skipToken is skipToken Filter. -func (client BackupEnginesClient) Get(vaultName string, resourceGroupName string, backupEngineName string, filter string, skipToken string) (result BackupEngineBaseResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, backupEngineName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupEnginesClient) GetPreparer(vaultName string, resourceGroupName string, backupEngineName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupEngineName": autorest.Encode("path", backupEngineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupEnginesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupEnginesClient) GetResponder(resp *http.Response) (result BackupEngineBaseResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List backup management servers registered to Recovery Services Vault. -// Returns a pageable list of servers. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. skipToken is skipToken Filter. -func (client BackupEnginesClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result BackupEngineBaseResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupEnginesClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupEnginesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupEnginesClient) ListResponder(resp *http.Response) (result BackupEngineBaseResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BackupEnginesClient) ListNextResults(lastResults BackupEngineBaseResourceList) (result BackupEngineBaseResourceList, err error) { - req, err := lastResults.BackupEngineBaseResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupEnginesClient is the client for the BackupEngines methods of the +// Recoveryservicesbackup service. +type BackupEnginesClient struct { + ManagementClient +} + +// NewBackupEnginesClient creates an instance of the BackupEnginesClient +// client. +func NewBackupEnginesClient(subscriptionID string) BackupEnginesClient { + return NewBackupEnginesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupEnginesClientWithBaseURI creates an instance of the +// BackupEnginesClient client. +func NewBackupEnginesClientWithBaseURI(baseURI string, subscriptionID string) BackupEnginesClient { + return BackupEnginesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns backup management server registered to Recovery Services Vault. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// backupEngineName is name of the backup management server. filter is oData +// filter options. skipToken is skipToken Filter. +func (client BackupEnginesClient) Get(vaultName string, resourceGroupName string, backupEngineName string, filter string, skipToken string) (result BackupEngineBaseResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, backupEngineName, filter, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupEnginesClient) GetPreparer(vaultName string, resourceGroupName string, backupEngineName string, filter string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupEngineName": autorest.Encode("path", backupEngineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupEnginesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupEnginesClient) GetResponder(resp *http.Response) (result BackupEngineBaseResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List backup management servers registered to Recovery Services Vault. +// Returns a pageable list of servers. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. skipToken is skipToken Filter. +func (client BackupEnginesClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result BackupEngineBaseResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupEnginesClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupEnginesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupEnginesClient) ListResponder(resp *http.Response) (result BackupEngineBaseResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BackupEnginesClient) ListNextResults(lastResults BackupEngineBaseResourceList) (result BackupEngineBaseResourceList, err error) { + req, err := lastResults.BackupEngineBaseResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupEnginesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupjobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupjobs.go index 25c835ed7c..636cd364d6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupjobs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupjobs.go @@ -1,139 +1,139 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupJobsClient is the client for the BackupJobs methods of the -// Recoveryservicesbackup service. -type BackupJobsClient struct { - ManagementClient -} - -// NewBackupJobsClient creates an instance of the BackupJobsClient client. -func NewBackupJobsClient(subscriptionID string) BackupJobsClient { - return NewBackupJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupJobsClientWithBaseURI creates an instance of the BackupJobsClient -// client. -func NewBackupJobsClientWithBaseURI(baseURI string, subscriptionID string) BackupJobsClient { - return BackupJobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides a pageable list of jobs. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. skipToken is skipToken Filter. -func (client BackupJobsClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result JobResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupJobsClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupJobsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupJobsClient) ListResponder(resp *http.Response) (result JobResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BackupJobsClient) ListNextResults(lastResults JobResourceList) (result JobResourceList, err error) { - req, err := lastResults.JobResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupJobsClient is the client for the BackupJobs methods of the +// Recoveryservicesbackup service. +type BackupJobsClient struct { + ManagementClient +} + +// NewBackupJobsClient creates an instance of the BackupJobsClient client. +func NewBackupJobsClient(subscriptionID string) BackupJobsClient { + return NewBackupJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupJobsClientWithBaseURI creates an instance of the BackupJobsClient +// client. +func NewBackupJobsClientWithBaseURI(baseURI string, subscriptionID string) BackupJobsClient { + return BackupJobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List provides a pageable list of jobs. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. skipToken is skipToken Filter. +func (client BackupJobsClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result JobResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupJobsClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupJobsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupJobsClient) ListResponder(resp *http.Response) (result JobResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BackupJobsClient) ListNextResults(lastResults JobResourceList) (result JobResourceList, err error) { + req, err := lastResults.JobResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupJobsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationresults.go index c2f6aedeca..8167c53b62 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationresults.go @@ -1,115 +1,115 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupOperationResultsClient is the client for the BackupOperationResults -// methods of the Recoveryservicesbackup service. -type BackupOperationResultsClient struct { - ManagementClient -} - -// NewBackupOperationResultsClient creates an instance of the -// BackupOperationResultsClient client. -func NewBackupOperationResultsClient(subscriptionID string) BackupOperationResultsClient { - return NewBackupOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupOperationResultsClientWithBaseURI creates an instance of the -// BackupOperationResultsClient client. -func NewBackupOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) BackupOperationResultsClient { - return BackupOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get provides the status of the delete operations such as deleting backed up -// item. Once the operation has started, the status code in the response would -// be Accepted. It will continue to be in this state till it reaches -// completion. On successful completion, the status code will be OK. This -// method expects OperationID as an argument. OperationID is part of the -// Location header of the operation response. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// operationID is operationID which represents the operation. -func (client BackupOperationResultsClient) Get(vaultName string, resourceGroupName string, operationID string) (result autorest.Response, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupOperationResultsClient is the client for the BackupOperationResults +// methods of the Recoveryservicesbackup service. +type BackupOperationResultsClient struct { + ManagementClient +} + +// NewBackupOperationResultsClient creates an instance of the +// BackupOperationResultsClient client. +func NewBackupOperationResultsClient(subscriptionID string) BackupOperationResultsClient { + return NewBackupOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupOperationResultsClientWithBaseURI creates an instance of the +// BackupOperationResultsClient client. +func NewBackupOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) BackupOperationResultsClient { + return BackupOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get provides the status of the delete operations such as deleting backed up +// item. Once the operation has started, the status code in the response would +// be Accepted. It will continue to be in this state till it reaches +// completion. On successful completion, the status code will be OK. This +// method expects OperationID as an argument. OperationID is part of the +// Location header of the operation response. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// operationID is operationID which represents the operation. +func (client BackupOperationResultsClient) Get(vaultName string, resourceGroupName string, operationID string) (result autorest.Response, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationstatuses.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationstatuses.go index d2c274bcaa..9a5f14ba36 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationstatuses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupoperationstatuses.go @@ -1,115 +1,115 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupOperationStatusesClient is the client for the BackupOperationStatuses -// methods of the Recoveryservicesbackup service. -type BackupOperationStatusesClient struct { - ManagementClient -} - -// NewBackupOperationStatusesClient creates an instance of the -// BackupOperationStatusesClient client. -func NewBackupOperationStatusesClient(subscriptionID string) BackupOperationStatusesClient { - return NewBackupOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupOperationStatusesClientWithBaseURI creates an instance of the -// BackupOperationStatusesClient client. -func NewBackupOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) BackupOperationStatusesClient { - return BackupOperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches the status of an operation such as triggering a backup, restore. -// The status can be in progress, completed or failed. You can refer to the -// OperationStatus enum for all the possible states of an operation. Some -// operations create jobs. This method returns the list of jobs when the -// operation is complete. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// operationID is operationID which represents the operation. -func (client BackupOperationStatusesClient) Get(vaultName string, resourceGroupName string, operationID string) (result OperationStatus, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationStatusesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationStatusesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationStatusesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupOperationStatusesClient) GetPreparer(vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupOperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupOperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupOperationStatusesClient is the client for the BackupOperationStatuses +// methods of the Recoveryservicesbackup service. +type BackupOperationStatusesClient struct { + ManagementClient +} + +// NewBackupOperationStatusesClient creates an instance of the +// BackupOperationStatusesClient client. +func NewBackupOperationStatusesClient(subscriptionID string) BackupOperationStatusesClient { + return NewBackupOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupOperationStatusesClientWithBaseURI creates an instance of the +// BackupOperationStatusesClient client. +func NewBackupOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) BackupOperationStatusesClient { + return BackupOperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches the status of an operation such as triggering a backup, restore. +// The status can be in progress, completed or failed. You can refer to the +// OperationStatus enum for all the possible states of an operation. Some +// operations create jobs. This method returns the list of jobs when the +// operation is complete. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// operationID is operationID which represents the operation. +func (client BackupOperationStatusesClient) Get(vaultName string, resourceGroupName string, operationID string) (result OperationStatus, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationStatusesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationStatusesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupOperationStatusesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupOperationStatusesClient) GetPreparer(vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupOperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupOperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backuppolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backuppolicies.go index 9786b34e11..2c81779a00 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backuppolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backuppolicies.go @@ -1,138 +1,138 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupPoliciesClient is the client for the BackupPolicies methods of the -// Recoveryservicesbackup service. -type BackupPoliciesClient struct { - ManagementClient -} - -// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient -// client. -func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { - return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupPoliciesClientWithBaseURI creates an instance of the -// BackupPoliciesClient client. -func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { - return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists of backup policies associated with Recovery Services Vault. API -// provides pagination parameters to fetch scoped results. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. -func (client BackupPoliciesClient) List(vaultName string, resourceGroupName string, filter string) (result ProtectionPolicyResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupPoliciesClient) ListPreparer(vaultName string, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result ProtectionPolicyResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BackupPoliciesClient) ListNextResults(lastResults ProtectionPolicyResourceList) (result ProtectionPolicyResourceList, err error) { - req, err := lastResults.ProtectionPolicyResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupPoliciesClient is the client for the BackupPolicies methods of the +// Recoveryservicesbackup service. +type BackupPoliciesClient struct { + ManagementClient +} + +// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient +// client. +func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { + return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupPoliciesClientWithBaseURI creates an instance of the +// BackupPoliciesClient client. +func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { + return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists of backup policies associated with Recovery Services Vault. API +// provides pagination parameters to fetch scoped results. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. +func (client BackupPoliciesClient) List(vaultName string, resourceGroupName string, filter string) (result ProtectionPolicyResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupPoliciesClient) ListPreparer(vaultName string, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result ProtectionPolicyResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BackupPoliciesClient) ListNextResults(lastResults ProtectionPolicyResourceList) (result ProtectionPolicyResourceList, err error) { + req, err := lastResults.ProtectionPolicyResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupPoliciesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectableitems.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectableitems.go index 116021f852..c8008db70b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectableitems.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectableitems.go @@ -1,141 +1,141 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupProtectableItemsClient is the client for the BackupProtectableItems -// methods of the Recoveryservicesbackup service. -type BackupProtectableItemsClient struct { - ManagementClient -} - -// NewBackupProtectableItemsClient creates an instance of the -// BackupProtectableItemsClient client. -func NewBackupProtectableItemsClient(subscriptionID string) BackupProtectableItemsClient { - return NewBackupProtectableItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupProtectableItemsClientWithBaseURI creates an instance of the -// BackupProtectableItemsClient client. -func NewBackupProtectableItemsClientWithBaseURI(baseURI string, subscriptionID string) BackupProtectableItemsClient { - return BackupProtectableItemsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides a pageable list of protectable objects within your -// subscription according to the query filter and the pagination parameters. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. skipToken is skipToken Filter. -func (client BackupProtectableItemsClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result WorkloadProtectableItemResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupProtectableItemsClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupProtectableItemsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupProtectableItemsClient) ListResponder(resp *http.Response) (result WorkloadProtectableItemResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BackupProtectableItemsClient) ListNextResults(lastResults WorkloadProtectableItemResourceList) (result WorkloadProtectableItemResourceList, err error) { - req, err := lastResults.WorkloadProtectableItemResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupProtectableItemsClient is the client for the BackupProtectableItems +// methods of the Recoveryservicesbackup service. +type BackupProtectableItemsClient struct { + ManagementClient +} + +// NewBackupProtectableItemsClient creates an instance of the +// BackupProtectableItemsClient client. +func NewBackupProtectableItemsClient(subscriptionID string) BackupProtectableItemsClient { + return NewBackupProtectableItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupProtectableItemsClientWithBaseURI creates an instance of the +// BackupProtectableItemsClient client. +func NewBackupProtectableItemsClientWithBaseURI(baseURI string, subscriptionID string) BackupProtectableItemsClient { + return BackupProtectableItemsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List provides a pageable list of protectable objects within your +// subscription according to the query filter and the pagination parameters. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. skipToken is skipToken Filter. +func (client BackupProtectableItemsClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result WorkloadProtectableItemResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupProtectableItemsClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupProtectableItemsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupProtectableItemsClient) ListResponder(resp *http.Response) (result WorkloadProtectableItemResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BackupProtectableItemsClient) ListNextResults(lastResults WorkloadProtectableItemResourceList) (result WorkloadProtectableItemResourceList, err error) { + req, err := lastResults.WorkloadProtectableItemResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectableItemsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotecteditems.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotecteditems.go index 76c7879ce6..171dd82b9d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotecteditems.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotecteditems.go @@ -1,141 +1,141 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupProtectedItemsClient is the client for the BackupProtectedItems -// methods of the Recoveryservicesbackup service. -type BackupProtectedItemsClient struct { - ManagementClient -} - -// NewBackupProtectedItemsClient creates an instance of the -// BackupProtectedItemsClient client. -func NewBackupProtectedItemsClient(subscriptionID string) BackupProtectedItemsClient { - return NewBackupProtectedItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupProtectedItemsClientWithBaseURI creates an instance of the -// BackupProtectedItemsClient client. -func NewBackupProtectedItemsClientWithBaseURI(baseURI string, subscriptionID string) BackupProtectedItemsClient { - return BackupProtectedItemsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List provides a pageable list of all items that can be backed up within a -// subscription. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. skipToken is skipToken Filter. -func (client BackupProtectedItemsClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result ProtectedItemResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupProtectedItemsClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupProtectedItemsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupProtectedItemsClient) ListResponder(resp *http.Response) (result ProtectedItemResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BackupProtectedItemsClient) ListNextResults(lastResults ProtectedItemResourceList) (result ProtectedItemResourceList, err error) { - req, err := lastResults.ProtectedItemResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupProtectedItemsClient is the client for the BackupProtectedItems +// methods of the Recoveryservicesbackup service. +type BackupProtectedItemsClient struct { + ManagementClient +} + +// NewBackupProtectedItemsClient creates an instance of the +// BackupProtectedItemsClient client. +func NewBackupProtectedItemsClient(subscriptionID string) BackupProtectedItemsClient { + return NewBackupProtectedItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupProtectedItemsClientWithBaseURI creates an instance of the +// BackupProtectedItemsClient client. +func NewBackupProtectedItemsClientWithBaseURI(baseURI string, subscriptionID string) BackupProtectedItemsClient { + return BackupProtectedItemsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List provides a pageable list of all items that can be backed up within a +// subscription. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. skipToken is skipToken Filter. +func (client BackupProtectedItemsClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result ProtectedItemResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupProtectedItemsClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupProtectedItemsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupProtectedItemsClient) ListResponder(resp *http.Response) (result ProtectedItemResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BackupProtectedItemsClient) ListNextResults(lastResults ProtectedItemResourceList) (result ProtectedItemResourceList, err error) { + req, err := lastResults.ProtectedItemResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectedItemsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectioncontainers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectioncontainers.go index d36100ec5f..73611a215d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectioncontainers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupprotectioncontainers.go @@ -1,137 +1,137 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupProtectionContainersClient is the client for the -// BackupProtectionContainers methods of the Recoveryservicesbackup service. -type BackupProtectionContainersClient struct { - ManagementClient -} - -// NewBackupProtectionContainersClient creates an instance of the -// BackupProtectionContainersClient client. -func NewBackupProtectionContainersClient(subscriptionID string) BackupProtectionContainersClient { - return NewBackupProtectionContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupProtectionContainersClientWithBaseURI creates an instance of the -// BackupProtectionContainersClient client. -func NewBackupProtectionContainersClientWithBaseURI(baseURI string, subscriptionID string) BackupProtectionContainersClient { - return BackupProtectionContainersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the containers registered to Recovery Services Vault. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. -func (client BackupProtectionContainersClient) List(vaultName string, resourceGroupName string, filter string) (result ProtectionContainerResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupProtectionContainersClient) ListPreparer(vaultName string, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupProtectionContainersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupProtectionContainersClient) ListResponder(resp *http.Response) (result ProtectionContainerResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client BackupProtectionContainersClient) ListNextResults(lastResults ProtectionContainerResourceList) (result ProtectionContainerResourceList, err error) { - req, err := lastResults.ProtectionContainerResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupProtectionContainersClient is the client for the +// BackupProtectionContainers methods of the Recoveryservicesbackup service. +type BackupProtectionContainersClient struct { + ManagementClient +} + +// NewBackupProtectionContainersClient creates an instance of the +// BackupProtectionContainersClient client. +func NewBackupProtectionContainersClient(subscriptionID string) BackupProtectionContainersClient { + return NewBackupProtectionContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupProtectionContainersClientWithBaseURI creates an instance of the +// BackupProtectionContainersClient client. +func NewBackupProtectionContainersClientWithBaseURI(baseURI string, subscriptionID string) BackupProtectionContainersClient { + return BackupProtectionContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the containers registered to Recovery Services Vault. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. +func (client BackupProtectionContainersClient) List(vaultName string, resourceGroupName string, filter string) (result ProtectionContainerResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupProtectionContainersClient) ListPreparer(vaultName string, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupProtectionContainersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupProtectionContainersClient) ListResponder(resp *http.Response) (result ProtectionContainerResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client BackupProtectionContainersClient) ListNextResults(lastResults ProtectionContainerResourceList) (result ProtectionContainerResourceList, err error) { + req, err := lastResults.ProtectionContainerResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupProtectionContainersClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcestorageconfigs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcestorageconfigs.go index d2ea4d2bae..0a495b1bd3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcestorageconfigs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcestorageconfigs.go @@ -1,174 +1,174 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupResourceStorageConfigsClient is the client for the -// BackupResourceStorageConfigs methods of the Recoveryservicesbackup service. -type BackupResourceStorageConfigsClient struct { - ManagementClient -} - -// NewBackupResourceStorageConfigsClient creates an instance of the -// BackupResourceStorageConfigsClient client. -func NewBackupResourceStorageConfigsClient(subscriptionID string) BackupResourceStorageConfigsClient { - return NewBackupResourceStorageConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupResourceStorageConfigsClientWithBaseURI creates an instance of the -// BackupResourceStorageConfigsClient client. -func NewBackupResourceStorageConfigsClientWithBaseURI(baseURI string, subscriptionID string) BackupResourceStorageConfigsClient { - return BackupResourceStorageConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches resource storage config. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -func (client BackupResourceStorageConfigsClient) Get(vaultName string, resourceGroupName string) (result BackupResourceConfigResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupResourceStorageConfigsClient) GetPreparer(vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupResourceStorageConfigsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupResourceStorageConfigsClient) GetResponder(resp *http.Response) (result BackupResourceConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates vault storage model type. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -func (client BackupResourceStorageConfigsClient) Update(vaultName string, resourceGroupName string) (result autorest.Response, err error) { - req, err := client.UpdatePreparer(vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupResourceStorageConfigsClient) UpdatePreparer(vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupResourceStorageConfigsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupResourceStorageConfigsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupResourceStorageConfigsClient is the client for the +// BackupResourceStorageConfigs methods of the Recoveryservicesbackup service. +type BackupResourceStorageConfigsClient struct { + ManagementClient +} + +// NewBackupResourceStorageConfigsClient creates an instance of the +// BackupResourceStorageConfigsClient client. +func NewBackupResourceStorageConfigsClient(subscriptionID string) BackupResourceStorageConfigsClient { + return NewBackupResourceStorageConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupResourceStorageConfigsClientWithBaseURI creates an instance of the +// BackupResourceStorageConfigsClient client. +func NewBackupResourceStorageConfigsClientWithBaseURI(baseURI string, subscriptionID string) BackupResourceStorageConfigsClient { + return BackupResourceStorageConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches resource storage config. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +func (client BackupResourceStorageConfigsClient) Get(vaultName string, resourceGroupName string) (result BackupResourceConfigResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupResourceStorageConfigsClient) GetPreparer(vaultName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupResourceStorageConfigsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupResourceStorageConfigsClient) GetResponder(resp *http.Response) (result BackupResourceConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates vault storage model type. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +func (client BackupResourceStorageConfigsClient) Update(vaultName string, resourceGroupName string) (result autorest.Response, err error) { + req, err := client.UpdatePreparer(vaultName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceStorageConfigsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackupResourceStorageConfigsClient) UpdatePreparer(vaultName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackupResourceStorageConfigsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackupResourceStorageConfigsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcevaultconfigs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcevaultconfigs.go index ac4bc20727..65c97f7aeb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcevaultconfigs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupresourcevaultconfigs.go @@ -1,178 +1,178 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupResourceVaultConfigsClient is the client for the -// BackupResourceVaultConfigs methods of the Recoveryservicesbackup service. -type BackupResourceVaultConfigsClient struct { - ManagementClient -} - -// NewBackupResourceVaultConfigsClient creates an instance of the -// BackupResourceVaultConfigsClient client. -func NewBackupResourceVaultConfigsClient(subscriptionID string) BackupResourceVaultConfigsClient { - return NewBackupResourceVaultConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupResourceVaultConfigsClientWithBaseURI creates an instance of the -// BackupResourceVaultConfigsClient client. -func NewBackupResourceVaultConfigsClientWithBaseURI(baseURI string, subscriptionID string) BackupResourceVaultConfigsClient { - return BackupResourceVaultConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches resource vault config. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -func (client BackupResourceVaultConfigsClient) Get(vaultName string, resourceGroupName string) (result BackupResourceVaultConfigResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupResourceVaultConfigsClient) GetPreparer(vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupResourceVaultConfigsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupResourceVaultConfigsClient) GetResponder(resp *http.Response) (result BackupResourceVaultConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates vault security config. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// parameters is resource config request -func (client BackupResourceVaultConfigsClient) Update(vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource) (result BackupResourceVaultConfigResource, err error) { - req, err := client.UpdatePreparer(vaultName, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupResourceVaultConfigsClient) UpdatePreparer(vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupResourceVaultConfigsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupResourceVaultConfigsClient) UpdateResponder(resp *http.Response) (result BackupResourceVaultConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupResourceVaultConfigsClient is the client for the +// BackupResourceVaultConfigs methods of the Recoveryservicesbackup service. +type BackupResourceVaultConfigsClient struct { + ManagementClient +} + +// NewBackupResourceVaultConfigsClient creates an instance of the +// BackupResourceVaultConfigsClient client. +func NewBackupResourceVaultConfigsClient(subscriptionID string) BackupResourceVaultConfigsClient { + return NewBackupResourceVaultConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupResourceVaultConfigsClientWithBaseURI creates an instance of the +// BackupResourceVaultConfigsClient client. +func NewBackupResourceVaultConfigsClientWithBaseURI(baseURI string, subscriptionID string) BackupResourceVaultConfigsClient { + return BackupResourceVaultConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches resource vault config. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +func (client BackupResourceVaultConfigsClient) Get(vaultName string, resourceGroupName string) (result BackupResourceVaultConfigResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client BackupResourceVaultConfigsClient) GetPreparer(vaultName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BackupResourceVaultConfigsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BackupResourceVaultConfigsClient) GetResponder(resp *http.Response) (result BackupResourceVaultConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates vault security config. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// parameters is resource config request +func (client BackupResourceVaultConfigsClient) Update(vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource) (result BackupResourceVaultConfigResource, err error) { + req, err := client.UpdatePreparer(vaultName, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupResourceVaultConfigsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BackupResourceVaultConfigsClient) UpdatePreparer(vaultName string, resourceGroupName string, parameters BackupResourceVaultConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BackupResourceVaultConfigsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BackupResourceVaultConfigsClient) UpdateResponder(resp *http.Response) (result BackupResourceVaultConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backups.go index a26084ae29..92587608de 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backups.go @@ -1,117 +1,117 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupsClient is the client for the Backups methods of the -// Recoveryservicesbackup service. -type BackupsClient struct { - ManagementClient -} - -// NewBackupsClient creates an instance of the BackupsClient client. -func NewBackupsClient(subscriptionID string) BackupsClient { - return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupsClientWithBaseURI creates an instance of the BackupsClient client. -func NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient { - return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Trigger triggers backup for specified backed up item. This is an -// asynchronous operation. To know the status of the operation, call -// GetProtectedItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backup item. containerName is -// container name associated with the backup item. protectedItemName is backup -// item for which backup needs to be triggered. parameters is resource backup -// request -func (client BackupsClient) Trigger(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters BackupRequestResource) (result autorest.Response, err error) { - req, err := client.TriggerPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupsClient", "Trigger", nil, "Failure preparing request") - return - } - - resp, err := client.TriggerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupsClient", "Trigger", resp, "Failure sending request") - return - } - - result, err = client.TriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupsClient", "Trigger", resp, "Failure responding to request") - } - - return -} - -// TriggerPreparer prepares the Trigger request. -func (client BackupsClient) TriggerPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters BackupRequestResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TriggerSender sends the Trigger request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) TriggerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TriggerResponder handles the response to the Trigger request. The method always -// closes the http.Response Body. -func (client BackupsClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupsClient is the client for the Backups methods of the +// Recoveryservicesbackup service. +type BackupsClient struct { + ManagementClient +} + +// NewBackupsClient creates an instance of the BackupsClient client. +func NewBackupsClient(subscriptionID string) BackupsClient { + return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupsClientWithBaseURI creates an instance of the BackupsClient client. +func NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient { + return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Trigger triggers backup for specified backed up item. This is an +// asynchronous operation. To know the status of the operation, call +// GetProtectedItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backup item. containerName is +// container name associated with the backup item. protectedItemName is backup +// item for which backup needs to be triggered. parameters is resource backup +// request +func (client BackupsClient) Trigger(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters BackupRequestResource) (result autorest.Response, err error) { + req, err := client.TriggerPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupsClient", "Trigger", nil, "Failure preparing request") + return + } + + resp, err := client.TriggerSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupsClient", "Trigger", resp, "Failure sending request") + return + } + + result, err = client.TriggerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupsClient", "Trigger", resp, "Failure responding to request") + } + + return +} + +// TriggerPreparer prepares the Trigger request. +func (client BackupsClient) TriggerPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters BackupRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TriggerSender sends the Trigger request. The method will close the +// http.Response Body if it receives an error. +func (client BackupsClient) TriggerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TriggerResponder handles the response to the Trigger request. The method always +// closes the http.Response Body. +func (client BackupsClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupusagesummaries.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupusagesummaries.go index fbfd5c4fd3..859a13680f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupusagesummaries.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/backupusagesummaries.go @@ -1,116 +1,116 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// BackupUsageSummariesClient is the client for the BackupUsageSummaries -// methods of the Recoveryservicesbackup service. -type BackupUsageSummariesClient struct { - ManagementClient -} - -// NewBackupUsageSummariesClient creates an instance of the -// BackupUsageSummariesClient client. -func NewBackupUsageSummariesClient(subscriptionID string) BackupUsageSummariesClient { - return NewBackupUsageSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupUsageSummariesClientWithBaseURI creates an instance of the -// BackupUsageSummariesClient client. -func NewBackupUsageSummariesClientWithBaseURI(baseURI string, subscriptionID string) BackupUsageSummariesClient { - return BackupUsageSummariesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List fetches the backup management usage summaries of the vault. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. skipToken is skipToken Filter. -func (client BackupUsageSummariesClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result BackupManagementUsageList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupUsageSummariesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupUsageSummariesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupUsageSummariesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupUsageSummariesClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupUsageSummariesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupUsageSummariesClient) ListResponder(resp *http.Response) (result BackupManagementUsageList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// BackupUsageSummariesClient is the client for the BackupUsageSummaries +// methods of the Recoveryservicesbackup service. +type BackupUsageSummariesClient struct { + ManagementClient +} + +// NewBackupUsageSummariesClient creates an instance of the +// BackupUsageSummariesClient client. +func NewBackupUsageSummariesClient(subscriptionID string) BackupUsageSummariesClient { + return NewBackupUsageSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBackupUsageSummariesClientWithBaseURI creates an instance of the +// BackupUsageSummariesClient client. +func NewBackupUsageSummariesClientWithBaseURI(baseURI string, subscriptionID string) BackupUsageSummariesClient { + return BackupUsageSummariesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List fetches the backup management usage summaries of the vault. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. skipToken is skipToken Filter. +func (client BackupUsageSummariesClient) List(vaultName string, resourceGroupName string, filter string, skipToken string) (result BackupManagementUsageList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, filter, skipToken) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupUsageSummariesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupUsageSummariesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.BackupUsageSummariesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client BackupUsageSummariesClient) ListPreparer(vaultName string, resourceGroupName string, filter string, skipToken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BackupUsageSummariesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BackupUsageSummariesClient) ListResponder(resp *http.Response) (result BackupManagementUsageList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/client.go index 08a54b9011..94e5c4045e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/client.go @@ -1,53 +1,53 @@ -// Package recoveryservicesbackup implements the Azure ARM -// Recoveryservicesbackup service API version 2016-12-01. -// -// -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Recoveryservicesbackup - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Recoveryservicesbackup. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package recoveryservicesbackup implements the Azure ARM +// Recoveryservicesbackup service API version 2016-12-01. +// +// +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Recoveryservicesbackup + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Recoveryservicesbackup. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/exportjobsoperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/exportjobsoperationresults.go index c2ee5652fb..e99b12c6c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/exportjobsoperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/exportjobsoperationresults.go @@ -1,114 +1,114 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ExportJobsOperationResultsClient is the client for the -// ExportJobsOperationResults methods of the Recoveryservicesbackup service. -type ExportJobsOperationResultsClient struct { - ManagementClient -} - -// NewExportJobsOperationResultsClient creates an instance of the -// ExportJobsOperationResultsClient client. -func NewExportJobsOperationResultsClient(subscriptionID string) ExportJobsOperationResultsClient { - return NewExportJobsOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportJobsOperationResultsClientWithBaseURI creates an instance of the -// ExportJobsOperationResultsClient client. -func NewExportJobsOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ExportJobsOperationResultsClient { - return ExportJobsOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the operation result of operation triggered by Export Jobs API. If -// the operation is successful, then it also contains URL of a Blob and a SAS -// key to access the same. The blob contains exported jobs in JSON serialized -// format. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// operationID is operationID which represents the export job. -func (client ExportJobsOperationResultsClient) Get(vaultName string, resourceGroupName string, operationID string) (result OperationResultInfoBaseResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ExportJobsOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ExportJobsOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ExportJobsOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportJobsOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExportJobsOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExportJobsOperationResultsClient) GetResponder(resp *http.Response) (result OperationResultInfoBaseResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ExportJobsOperationResultsClient is the client for the +// ExportJobsOperationResults methods of the Recoveryservicesbackup service. +type ExportJobsOperationResultsClient struct { + ManagementClient +} + +// NewExportJobsOperationResultsClient creates an instance of the +// ExportJobsOperationResultsClient client. +func NewExportJobsOperationResultsClient(subscriptionID string) ExportJobsOperationResultsClient { + return NewExportJobsOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExportJobsOperationResultsClientWithBaseURI creates an instance of the +// ExportJobsOperationResultsClient client. +func NewExportJobsOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ExportJobsOperationResultsClient { + return ExportJobsOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the operation result of operation triggered by Export Jobs API. If +// the operation is successful, then it also contains URL of a Blob and a SAS +// key to access the same. The blob contains exported jobs in JSON serialized +// format. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// operationID is operationID which represents the export job. +func (client ExportJobsOperationResultsClient) Get(vaultName string, resourceGroupName string, operationID string) (result OperationResultInfoBaseResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ExportJobsOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ExportJobsOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ExportJobsOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExportJobsOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExportJobsOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExportJobsOperationResultsClient) GetResponder(resp *http.Response) (result OperationResultInfoBaseResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/itemlevelrecoveryconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/itemlevelrecoveryconnections.go index 05a79ac074..4df44e0eeb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/itemlevelrecoveryconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/itemlevelrecoveryconnections.go @@ -1,198 +1,198 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ItemLevelRecoveryConnectionsClient is the client for the -// ItemLevelRecoveryConnections methods of the Recoveryservicesbackup service. -type ItemLevelRecoveryConnectionsClient struct { - ManagementClient -} - -// NewItemLevelRecoveryConnectionsClient creates an instance of the -// ItemLevelRecoveryConnectionsClient client. -func NewItemLevelRecoveryConnectionsClient(subscriptionID string) ItemLevelRecoveryConnectionsClient { - return NewItemLevelRecoveryConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewItemLevelRecoveryConnectionsClientWithBaseURI creates an instance of the -// ItemLevelRecoveryConnectionsClient client. -func NewItemLevelRecoveryConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ItemLevelRecoveryConnectionsClient { - return ItemLevelRecoveryConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Provision provisions a script which invokes an iSCSI connection to the -// backup data. Executing this script opens a file explorer displaying all the -// recoverable files and folders. This is an asynchronous operation. To know -// the status of provisioning, call GetProtectedItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backed up items. containerName -// is container name associated with the backed up items. protectedItemName is -// backed up item name whose files/folders are to be restored. recoveryPointID -// is recovery point ID which represents backed up data. iSCSI connection will -// be provisioned for this backed up data. parameters is resource ILR request -func (client ItemLevelRecoveryConnectionsClient) Provision(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters ILRRequestResource) (result autorest.Response, err error) { - req, err := client.ProvisionPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Provision", nil, "Failure preparing request") - return - } - - resp, err := client.ProvisionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Provision", resp, "Failure sending request") - return - } - - result, err = client.ProvisionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Provision", resp, "Failure responding to request") - } - - return -} - -// ProvisionPreparer prepares the Provision request. -func (client ItemLevelRecoveryConnectionsClient) ProvisionPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters ILRRequestResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "recoveryPointId": autorest.Encode("path", recoveryPointID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ProvisionSender sends the Provision request. The method will close the -// http.Response Body if it receives an error. -func (client ItemLevelRecoveryConnectionsClient) ProvisionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ProvisionResponder handles the response to the Provision request. The method always -// closes the http.Response Body. -func (client ItemLevelRecoveryConnectionsClient) ProvisionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Revoke revokes an iSCSI connection which can be used to download a script. -// Executing this script opens a file explorer displaying all recoverable files -// and folders. This is an asynchronous operation. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backed up items. containerName -// is container name associated with the backed up items. protectedItemName is -// backed up item name whose files/folders are to be restored. recoveryPointID -// is recovery point ID which represents backed up data. iSCSI connection will -// be revoked for this backed up data. -func (client ItemLevelRecoveryConnectionsClient) Revoke(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (result autorest.Response, err error) { - req, err := client.RevokePreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Revoke", nil, "Failure preparing request") - return - } - - resp, err := client.RevokeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Revoke", resp, "Failure sending request") - return - } - - result, err = client.RevokeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Revoke", resp, "Failure responding to request") - } - - return -} - -// RevokePreparer prepares the Revoke request. -func (client ItemLevelRecoveryConnectionsClient) RevokePreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "recoveryPointId": autorest.Encode("path", recoveryPointID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RevokeSender sends the Revoke request. The method will close the -// http.Response Body if it receives an error. -func (client ItemLevelRecoveryConnectionsClient) RevokeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RevokeResponder handles the response to the Revoke request. The method always -// closes the http.Response Body. -func (client ItemLevelRecoveryConnectionsClient) RevokeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ItemLevelRecoveryConnectionsClient is the client for the +// ItemLevelRecoveryConnections methods of the Recoveryservicesbackup service. +type ItemLevelRecoveryConnectionsClient struct { + ManagementClient +} + +// NewItemLevelRecoveryConnectionsClient creates an instance of the +// ItemLevelRecoveryConnectionsClient client. +func NewItemLevelRecoveryConnectionsClient(subscriptionID string) ItemLevelRecoveryConnectionsClient { + return NewItemLevelRecoveryConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewItemLevelRecoveryConnectionsClientWithBaseURI creates an instance of the +// ItemLevelRecoveryConnectionsClient client. +func NewItemLevelRecoveryConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ItemLevelRecoveryConnectionsClient { + return ItemLevelRecoveryConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Provision provisions a script which invokes an iSCSI connection to the +// backup data. Executing this script opens a file explorer displaying all the +// recoverable files and folders. This is an asynchronous operation. To know +// the status of provisioning, call GetProtectedItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backed up items. containerName +// is container name associated with the backed up items. protectedItemName is +// backed up item name whose files/folders are to be restored. recoveryPointID +// is recovery point ID which represents backed up data. iSCSI connection will +// be provisioned for this backed up data. parameters is resource ILR request +func (client ItemLevelRecoveryConnectionsClient) Provision(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters ILRRequestResource) (result autorest.Response, err error) { + req, err := client.ProvisionPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Provision", nil, "Failure preparing request") + return + } + + resp, err := client.ProvisionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Provision", resp, "Failure sending request") + return + } + + result, err = client.ProvisionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Provision", resp, "Failure responding to request") + } + + return +} + +// ProvisionPreparer prepares the Provision request. +func (client ItemLevelRecoveryConnectionsClient) ProvisionPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters ILRRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "recoveryPointId": autorest.Encode("path", recoveryPointID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ProvisionSender sends the Provision request. The method will close the +// http.Response Body if it receives an error. +func (client ItemLevelRecoveryConnectionsClient) ProvisionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ProvisionResponder handles the response to the Provision request. The method always +// closes the http.Response Body. +func (client ItemLevelRecoveryConnectionsClient) ProvisionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Revoke revokes an iSCSI connection which can be used to download a script. +// Executing this script opens a file explorer displaying all recoverable files +// and folders. This is an asynchronous operation. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backed up items. containerName +// is container name associated with the backed up items. protectedItemName is +// backed up item name whose files/folders are to be restored. recoveryPointID +// is recovery point ID which represents backed up data. iSCSI connection will +// be revoked for this backed up data. +func (client ItemLevelRecoveryConnectionsClient) Revoke(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (result autorest.Response, err error) { + req, err := client.RevokePreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Revoke", nil, "Failure preparing request") + return + } + + resp, err := client.RevokeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Revoke", resp, "Failure sending request") + return + } + + result, err = client.RevokeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ItemLevelRecoveryConnectionsClient", "Revoke", resp, "Failure responding to request") + } + + return +} + +// RevokePreparer prepares the Revoke request. +func (client ItemLevelRecoveryConnectionsClient) RevokePreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "recoveryPointId": autorest.Encode("path", recoveryPointID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RevokeSender sends the Revoke request. The method will close the +// http.Response Body if it receives an error. +func (client ItemLevelRecoveryConnectionsClient) RevokeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RevokeResponder handles the response to the Revoke request. The method always +// closes the http.Response Body. +func (client ItemLevelRecoveryConnectionsClient) RevokeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobcancellations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobcancellations.go index 3e940423fd..03f04be3c1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobcancellations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobcancellations.go @@ -1,111 +1,111 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// JobCancellationsClient is the client for the JobCancellations methods of the -// Recoveryservicesbackup service. -type JobCancellationsClient struct { - ManagementClient -} - -// NewJobCancellationsClient creates an instance of the JobCancellationsClient -// client. -func NewJobCancellationsClient(subscriptionID string) JobCancellationsClient { - return NewJobCancellationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobCancellationsClientWithBaseURI creates an instance of the -// JobCancellationsClient client. -func NewJobCancellationsClientWithBaseURI(baseURI string, subscriptionID string) JobCancellationsClient { - return JobCancellationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Trigger cancels a job. This is an asynchronous operation. To know the status -// of the cancellation, call GetCancelOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// jobName is name of the job to cancel. -func (client JobCancellationsClient) Trigger(vaultName string, resourceGroupName string, jobName string) (result autorest.Response, err error) { - req, err := client.TriggerPreparer(vaultName, resourceGroupName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobCancellationsClient", "Trigger", nil, "Failure preparing request") - return - } - - resp, err := client.TriggerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobCancellationsClient", "Trigger", resp, "Failure sending request") - return - } - - result, err = client.TriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobCancellationsClient", "Trigger", resp, "Failure responding to request") - } - - return -} - -// TriggerPreparer prepares the Trigger request. -func (client JobCancellationsClient) TriggerPreparer(vaultName string, resourceGroupName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TriggerSender sends the Trigger request. The method will close the -// http.Response Body if it receives an error. -func (client JobCancellationsClient) TriggerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TriggerResponder handles the response to the Trigger request. The method always -// closes the http.Response Body. -func (client JobCancellationsClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// JobCancellationsClient is the client for the JobCancellations methods of the +// Recoveryservicesbackup service. +type JobCancellationsClient struct { + ManagementClient +} + +// NewJobCancellationsClient creates an instance of the JobCancellationsClient +// client. +func NewJobCancellationsClient(subscriptionID string) JobCancellationsClient { + return NewJobCancellationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobCancellationsClientWithBaseURI creates an instance of the +// JobCancellationsClient client. +func NewJobCancellationsClientWithBaseURI(baseURI string, subscriptionID string) JobCancellationsClient { + return JobCancellationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Trigger cancels a job. This is an asynchronous operation. To know the status +// of the cancellation, call GetCancelOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// jobName is name of the job to cancel. +func (client JobCancellationsClient) Trigger(vaultName string, resourceGroupName string, jobName string) (result autorest.Response, err error) { + req, err := client.TriggerPreparer(vaultName, resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobCancellationsClient", "Trigger", nil, "Failure preparing request") + return + } + + resp, err := client.TriggerSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobCancellationsClient", "Trigger", resp, "Failure sending request") + return + } + + result, err = client.TriggerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobCancellationsClient", "Trigger", resp, "Failure responding to request") + } + + return +} + +// TriggerPreparer prepares the Trigger request. +func (client JobCancellationsClient) TriggerPreparer(vaultName string, resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TriggerSender sends the Trigger request. The method will close the +// http.Response Body if it receives an error. +func (client JobCancellationsClient) TriggerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TriggerResponder handles the response to the Trigger request. The method always +// closes the http.Response Body. +func (client JobCancellationsClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobdetails.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobdetails.go index 7c97f75cae..b7bd259c0c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobdetails.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobdetails.go @@ -1,110 +1,110 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// JobDetailsClient is the client for the JobDetails methods of the -// Recoveryservicesbackup service. -type JobDetailsClient struct { - ManagementClient -} - -// NewJobDetailsClient creates an instance of the JobDetailsClient client. -func NewJobDetailsClient(subscriptionID string) JobDetailsClient { - return NewJobDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobDetailsClientWithBaseURI creates an instance of the JobDetailsClient -// client. -func NewJobDetailsClientWithBaseURI(baseURI string, subscriptionID string) JobDetailsClient { - return JobDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets exteded information associated with the job. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// jobName is name of the job whose details are to be fetched. -func (client JobDetailsClient) Get(vaultName string, resourceGroupName string, jobName string) (result JobResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobDetailsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobDetailsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobDetailsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobDetailsClient) GetPreparer(vaultName string, resourceGroupName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobDetailsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobDetailsClient) GetResponder(resp *http.Response) (result JobResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// JobDetailsClient is the client for the JobDetails methods of the +// Recoveryservicesbackup service. +type JobDetailsClient struct { + ManagementClient +} + +// NewJobDetailsClient creates an instance of the JobDetailsClient client. +func NewJobDetailsClient(subscriptionID string) JobDetailsClient { + return NewJobDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobDetailsClientWithBaseURI creates an instance of the JobDetailsClient +// client. +func NewJobDetailsClientWithBaseURI(baseURI string, subscriptionID string) JobDetailsClient { + return JobDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets exteded information associated with the job. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// jobName is name of the job whose details are to be fetched. +func (client JobDetailsClient) Get(vaultName string, resourceGroupName string, jobName string) (result JobResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobDetailsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobDetailsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobDetailsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobDetailsClient) GetPreparer(vaultName string, resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobDetailsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobDetailsClient) GetResponder(resp *http.Response) (result JobResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/joboperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/joboperationresults.go index ad81471aa0..7e7c249658 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/joboperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/joboperationresults.go @@ -1,113 +1,113 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// JobOperationResultsClient is the client for the JobOperationResults methods -// of the Recoveryservicesbackup service. -type JobOperationResultsClient struct { - ManagementClient -} - -// NewJobOperationResultsClient creates an instance of the -// JobOperationResultsClient client. -func NewJobOperationResultsClient(subscriptionID string) JobOperationResultsClient { - return NewJobOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobOperationResultsClientWithBaseURI creates an instance of the -// JobOperationResultsClient client. -func NewJobOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) JobOperationResultsClient { - return JobOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches the result of any operation. -// the operation. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// jobName is job name whose operation result has to be fetched. operationID is -// operationID which represents the operation whose result has to be fetched. -func (client JobOperationResultsClient) Get(vaultName string, resourceGroupName string, jobName string, operationID string) (result autorest.Response, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, jobName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, jobName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// JobOperationResultsClient is the client for the JobOperationResults methods +// of the Recoveryservicesbackup service. +type JobOperationResultsClient struct { + ManagementClient +} + +// NewJobOperationResultsClient creates an instance of the +// JobOperationResultsClient client. +func NewJobOperationResultsClient(subscriptionID string) JobOperationResultsClient { + return NewJobOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobOperationResultsClientWithBaseURI creates an instance of the +// JobOperationResultsClient client. +func NewJobOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) JobOperationResultsClient { + return JobOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches the result of any operation. +// the operation. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// jobName is job name whose operation result has to be fetched. operationID is +// operationID which represents the operation whose result has to be fetched. +func (client JobOperationResultsClient) Get(vaultName string, resourceGroupName string, jobName string, operationID string) (result autorest.Response, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, jobName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, jobName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobs.go index 88d11b7766..e505fe3076 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/jobs.go @@ -1,111 +1,111 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// JobsClient is the client for the Jobs methods of the Recoveryservicesbackup -// service. -type JobsClient struct { - ManagementClient -} - -// NewJobsClient creates an instance of the JobsClient client. -func NewJobsClient(subscriptionID string) JobsClient { - return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobsClientWithBaseURI creates an instance of the JobsClient client. -func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { - return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Export triggers export of jobs specified by filters and returns an -// OperationID to track. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// filter is oData filter options. -func (client JobsClient) Export(vaultName string, resourceGroupName string, filter string) (result autorest.Response, err error) { - req, err := client.ExportPreparer(vaultName, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobsClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobsClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobsClient", "Export", resp, "Failure responding to request") - } - - return -} - -// ExportPreparer prepares the Export request. -func (client JobsClient) ExportPreparer(vaultName string, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ExportSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client JobsClient) ExportResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// JobsClient is the client for the Jobs methods of the Recoveryservicesbackup +// service. +type JobsClient struct { + ManagementClient +} + +// NewJobsClient creates an instance of the JobsClient client. +func NewJobsClient(subscriptionID string) JobsClient { + return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobsClientWithBaseURI creates an instance of the JobsClient client. +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Export triggers export of jobs specified by filters and returns an +// OperationID to track. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// filter is oData filter options. +func (client JobsClient) Export(vaultName string, resourceGroupName string, filter string) (result autorest.Response, err error) { + req, err := client.ExportPreparer(vaultName, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobsClient", "Export", nil, "Failure preparing request") + return + } + + resp, err := client.ExportSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobsClient", "Export", resp, "Failure sending request") + return + } + + result, err = client.ExportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.JobsClient", "Export", resp, "Failure responding to request") + } + + return +} + +// ExportPreparer prepares the Export request. +func (client JobsClient) ExportPreparer(vaultName string, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ExportSender sends the Export request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ExportSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ExportResponder handles the response to the Export request. The method always +// closes the http.Response Body. +func (client JobsClient) ExportResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/models.go index e757185d01..153523c88a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/models.go @@ -1,2113 +1,2113 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// BackupItemType enumerates the values for backup item type. -type BackupItemType string - -const ( - // AzureSQLDb specifies the azure sql db state for backup item type. - AzureSQLDb BackupItemType = "AzureSqlDb" - // Client specifies the client state for backup item type. - Client BackupItemType = "Client" - // Exchange specifies the exchange state for backup item type. - Exchange BackupItemType = "Exchange" - // FileFolder specifies the file folder state for backup item type. - FileFolder BackupItemType = "FileFolder" - // GenericDataSource specifies the generic data source state for backup - // item type. - GenericDataSource BackupItemType = "GenericDataSource" - // Invalid specifies the invalid state for backup item type. - Invalid BackupItemType = "Invalid" - // Sharepoint specifies the sharepoint state for backup item type. - Sharepoint BackupItemType = "Sharepoint" - // SQLDB specifies the sqldb state for backup item type. - SQLDB BackupItemType = "SQLDB" - // SystemState specifies the system state state for backup item type. - SystemState BackupItemType = "SystemState" - // VM specifies the vm state for backup item type. - VM BackupItemType = "VM" - // VMwareVM specifies the v mware vm state for backup item type. - VMwareVM BackupItemType = "VMwareVM" -) - -// BackupManagementType enumerates the values for backup management type. -type BackupManagementType string - -const ( - // BackupManagementTypeAzureBackupServer specifies the backup management - // type azure backup server state for backup management type. - BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" - // BackupManagementTypeAzureIaasVM specifies the backup management type - // azure iaas vm state for backup management type. - BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" - // BackupManagementTypeAzureSQL specifies the backup management type azure - // sql state for backup management type. - BackupManagementTypeAzureSQL BackupManagementType = "AzureSql" - // BackupManagementTypeDPM specifies the backup management type dpm state - // for backup management type. - BackupManagementTypeDPM BackupManagementType = "DPM" - // BackupManagementTypeInvalid specifies the backup management type invalid - // state for backup management type. - BackupManagementTypeInvalid BackupManagementType = "Invalid" - // BackupManagementTypeMAB specifies the backup management type mab state - // for backup management type. - BackupManagementTypeMAB BackupManagementType = "MAB" -) - -// ContainerType enumerates the values for container type. -type ContainerType string - -const ( - // ContainerTypeAzureBackupServerContainer specifies the container type - // azure backup server container state for container type. - ContainerTypeAzureBackupServerContainer ContainerType = "AzureBackupServerContainer" - // ContainerTypeAzureSQLContainer specifies the container type azure sql - // container state for container type. - ContainerTypeAzureSQLContainer ContainerType = "AzureSqlContainer" - // ContainerTypeCluster specifies the container type cluster state for - // container type. - ContainerTypeCluster ContainerType = "Cluster" - // ContainerTypeDPMContainer specifies the container type dpm container - // state for container type. - ContainerTypeDPMContainer ContainerType = "DPMContainer" - // ContainerTypeIaasVMContainer specifies the container type iaas vm - // container state for container type. - ContainerTypeIaasVMContainer ContainerType = "IaasVMContainer" - // ContainerTypeIaasVMServiceContainer specifies the container type iaas vm - // service container state for container type. - ContainerTypeIaasVMServiceContainer ContainerType = "IaasVMServiceContainer" - // ContainerTypeInvalid specifies the container type invalid state for - // container type. - ContainerTypeInvalid ContainerType = "Invalid" - // ContainerTypeMABContainer specifies the container type mab container - // state for container type. - ContainerTypeMABContainer ContainerType = "MABContainer" - // ContainerTypeUnknown specifies the container type unknown state for - // container type. - ContainerTypeUnknown ContainerType = "Unknown" - // ContainerTypeVCenter specifies the container type v center state for - // container type. - ContainerTypeVCenter ContainerType = "VCenter" - // ContainerTypeWindows specifies the container type windows state for - // container type. - ContainerTypeWindows ContainerType = "Windows" -) - -// DataSourceType enumerates the values for data source type. -type DataSourceType string - -const ( - // DataSourceTypeAzureSQLDb specifies the data source type azure sql db - // state for data source type. - DataSourceTypeAzureSQLDb DataSourceType = "AzureSqlDb" - // DataSourceTypeClient specifies the data source type client state for - // data source type. - DataSourceTypeClient DataSourceType = "Client" - // DataSourceTypeExchange specifies the data source type exchange state for - // data source type. - DataSourceTypeExchange DataSourceType = "Exchange" - // DataSourceTypeFileFolder specifies the data source type file folder - // state for data source type. - DataSourceTypeFileFolder DataSourceType = "FileFolder" - // DataSourceTypeGenericDataSource specifies the data source type generic - // data source state for data source type. - DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" - // DataSourceTypeInvalid specifies the data source type invalid state for - // data source type. - DataSourceTypeInvalid DataSourceType = "Invalid" - // DataSourceTypeSharepoint specifies the data source type sharepoint state - // for data source type. - DataSourceTypeSharepoint DataSourceType = "Sharepoint" - // DataSourceTypeSQLDB specifies the data source type sqldb state for data - // source type. - DataSourceTypeSQLDB DataSourceType = "SQLDB" - // DataSourceTypeSystemState specifies the data source type system state - // state for data source type. - DataSourceTypeSystemState DataSourceType = "SystemState" - // DataSourceTypeVM specifies the data source type vm state for data source - // type. - DataSourceTypeVM DataSourceType = "VM" - // DataSourceTypeVMwareVM specifies the data source type v mware vm state - // for data source type. - DataSourceTypeVMwareVM DataSourceType = "VMwareVM" -) - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // Friday specifies the friday state for day of week. - Friday DayOfWeek = "Friday" - // Monday specifies the monday state for day of week. - Monday DayOfWeek = "Monday" - // Saturday specifies the saturday state for day of week. - Saturday DayOfWeek = "Saturday" - // Sunday specifies the sunday state for day of week. - Sunday DayOfWeek = "Sunday" - // Thursday specifies the thursday state for day of week. - Thursday DayOfWeek = "Thursday" - // Tuesday specifies the tuesday state for day of week. - Tuesday DayOfWeek = "Tuesday" - // Wednesday specifies the wednesday state for day of week. - Wednesday DayOfWeek = "Wednesday" -) - -// EnhancedSecurityState enumerates the values for enhanced security state. -type EnhancedSecurityState string - -const ( - // EnhancedSecurityStateDisabled specifies the enhanced security state - // disabled state for enhanced security state. - EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" - // EnhancedSecurityStateEnabled specifies the enhanced security state - // enabled state for enhanced security state. - EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" - // EnhancedSecurityStateInvalid specifies the enhanced security state - // invalid state for enhanced security state. - EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" -) - -// HealthState enumerates the values for health state. -type HealthState string - -const ( - // HealthStateActionRequired specifies the health state action required - // state for health state. - HealthStateActionRequired HealthState = "ActionRequired" - // HealthStateActionSuggested specifies the health state action suggested - // state for health state. - HealthStateActionSuggested HealthState = "ActionSuggested" - // HealthStateInvalid specifies the health state invalid state for health - // state. - HealthStateInvalid HealthState = "Invalid" - // HealthStatePassed specifies the health state passed state for health - // state. - HealthStatePassed HealthState = "Passed" -) - -// HealthStatus enumerates the values for health status. -type HealthStatus string - -const ( - // HealthStatusActionRequired specifies the health status action required - // state for health status. - HealthStatusActionRequired HealthStatus = "ActionRequired" - // HealthStatusActionSuggested specifies the health status action suggested - // state for health status. - HealthStatusActionSuggested HealthStatus = "ActionSuggested" - // HealthStatusInvalid specifies the health status invalid state for health - // status. - HealthStatusInvalid HealthStatus = "Invalid" - // HealthStatusPassed specifies the health status passed state for health - // status. - HealthStatusPassed HealthStatus = "Passed" -) - -// HTTPStatusCode enumerates the values for http status code. -type HTTPStatusCode string - -const ( - // Accepted specifies the accepted state for http status code. - Accepted HTTPStatusCode = "Accepted" - // Ambiguous specifies the ambiguous state for http status code. - Ambiguous HTTPStatusCode = "Ambiguous" - // BadGateway specifies the bad gateway state for http status code. - BadGateway HTTPStatusCode = "BadGateway" - // BadRequest specifies the bad request state for http status code. - BadRequest HTTPStatusCode = "BadRequest" - // Conflict specifies the conflict state for http status code. - Conflict HTTPStatusCode = "Conflict" - // Continue specifies the continue state for http status code. - Continue HTTPStatusCode = "Continue" - // Created specifies the created state for http status code. - Created HTTPStatusCode = "Created" - // ExpectationFailed specifies the expectation failed state for http status - // code. - ExpectationFailed HTTPStatusCode = "ExpectationFailed" - // Forbidden specifies the forbidden state for http status code. - Forbidden HTTPStatusCode = "Forbidden" - // Found specifies the found state for http status code. - Found HTTPStatusCode = "Found" - // GatewayTimeout specifies the gateway timeout state for http status code. - GatewayTimeout HTTPStatusCode = "GatewayTimeout" - // Gone specifies the gone state for http status code. - Gone HTTPStatusCode = "Gone" - // HTTPVersionNotSupported specifies the http version not supported state - // for http status code. - HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" - // InternalServerError specifies the internal server error state for http - // status code. - InternalServerError HTTPStatusCode = "InternalServerError" - // LengthRequired specifies the length required state for http status code. - LengthRequired HTTPStatusCode = "LengthRequired" - // MethodNotAllowed specifies the method not allowed state for http status - // code. - MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" - // Moved specifies the moved state for http status code. - Moved HTTPStatusCode = "Moved" - // MovedPermanently specifies the moved permanently state for http status - // code. - MovedPermanently HTTPStatusCode = "MovedPermanently" - // MultipleChoices specifies the multiple choices state for http status - // code. - MultipleChoices HTTPStatusCode = "MultipleChoices" - // NoContent specifies the no content state for http status code. - NoContent HTTPStatusCode = "NoContent" - // NonAuthoritativeInformation specifies the non authoritative information - // state for http status code. - NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" - // NotAcceptable specifies the not acceptable state for http status code. - NotAcceptable HTTPStatusCode = "NotAcceptable" - // NotFound specifies the not found state for http status code. - NotFound HTTPStatusCode = "NotFound" - // NotImplemented specifies the not implemented state for http status code. - NotImplemented HTTPStatusCode = "NotImplemented" - // NotModified specifies the not modified state for http status code. - NotModified HTTPStatusCode = "NotModified" - // OK specifies the ok state for http status code. - OK HTTPStatusCode = "OK" - // PartialContent specifies the partial content state for http status code. - PartialContent HTTPStatusCode = "PartialContent" - // PaymentRequired specifies the payment required state for http status - // code. - PaymentRequired HTTPStatusCode = "PaymentRequired" - // PreconditionFailed specifies the precondition failed state for http - // status code. - PreconditionFailed HTTPStatusCode = "PreconditionFailed" - // ProxyAuthenticationRequired specifies the proxy authentication required - // state for http status code. - ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" - // Redirect specifies the redirect state for http status code. - Redirect HTTPStatusCode = "Redirect" - // RedirectKeepVerb specifies the redirect keep verb state for http status - // code. - RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" - // RedirectMethod specifies the redirect method state for http status code. - RedirectMethod HTTPStatusCode = "RedirectMethod" - // RequestedRangeNotSatisfiable specifies the requested range not - // satisfiable state for http status code. - RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" - // RequestEntityTooLarge specifies the request entity too large state for - // http status code. - RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" - // RequestTimeout specifies the request timeout state for http status code. - RequestTimeout HTTPStatusCode = "RequestTimeout" - // RequestURITooLong specifies the request uri too long state for http - // status code. - RequestURITooLong HTTPStatusCode = "RequestUriTooLong" - // ResetContent specifies the reset content state for http status code. - ResetContent HTTPStatusCode = "ResetContent" - // SeeOther specifies the see other state for http status code. - SeeOther HTTPStatusCode = "SeeOther" - // ServiceUnavailable specifies the service unavailable state for http - // status code. - ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" - // SwitchingProtocols specifies the switching protocols state for http - // status code. - SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" - // TemporaryRedirect specifies the temporary redirect state for http status - // code. - TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" - // Unauthorized specifies the unauthorized state for http status code. - Unauthorized HTTPStatusCode = "Unauthorized" - // UnsupportedMediaType specifies the unsupported media type state for http - // status code. - UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" - // Unused specifies the unused state for http status code. - Unused HTTPStatusCode = "Unused" - // UpgradeRequired specifies the upgrade required state for http status - // code. - UpgradeRequired HTTPStatusCode = "UpgradeRequired" - // UseProxy specifies the use proxy state for http status code. - UseProxy HTTPStatusCode = "UseProxy" -) - -// JobOperationType enumerates the values for job operation type. -type JobOperationType string - -const ( - // JobOperationTypeBackup specifies the job operation type backup state for - // job operation type. - JobOperationTypeBackup JobOperationType = "Backup" - // JobOperationTypeConfigureBackup specifies the job operation type - // configure backup state for job operation type. - JobOperationTypeConfigureBackup JobOperationType = "ConfigureBackup" - // JobOperationTypeDeleteBackupData specifies the job operation type delete - // backup data state for job operation type. - JobOperationTypeDeleteBackupData JobOperationType = "DeleteBackupData" - // JobOperationTypeDisableBackup specifies the job operation type disable - // backup state for job operation type. - JobOperationTypeDisableBackup JobOperationType = "DisableBackup" - // JobOperationTypeInvalid specifies the job operation type invalid state - // for job operation type. - JobOperationTypeInvalid JobOperationType = "Invalid" - // JobOperationTypeRegister specifies the job operation type register state - // for job operation type. - JobOperationTypeRegister JobOperationType = "Register" - // JobOperationTypeRestore specifies the job operation type restore state - // for job operation type. - JobOperationTypeRestore JobOperationType = "Restore" - // JobOperationTypeUnRegister specifies the job operation type un register - // state for job operation type. - JobOperationTypeUnRegister JobOperationType = "UnRegister" -) - -// JobStatus enumerates the values for job status. -type JobStatus string - -const ( - // JobStatusCancelled specifies the job status cancelled state for job - // status. - JobStatusCancelled JobStatus = "Cancelled" - // JobStatusCancelling specifies the job status cancelling state for job - // status. - JobStatusCancelling JobStatus = "Cancelling" - // JobStatusCompleted specifies the job status completed state for job - // status. - JobStatusCompleted JobStatus = "Completed" - // JobStatusCompletedWithWarnings specifies the job status completed with - // warnings state for job status. - JobStatusCompletedWithWarnings JobStatus = "CompletedWithWarnings" - // JobStatusFailed specifies the job status failed state for job status. - JobStatusFailed JobStatus = "Failed" - // JobStatusInProgress specifies the job status in progress state for job - // status. - JobStatusInProgress JobStatus = "InProgress" - // JobStatusInvalid specifies the job status invalid state for job status. - JobStatusInvalid JobStatus = "Invalid" -) - -// JobSupportedAction enumerates the values for job supported action. -type JobSupportedAction string - -const ( - // JobSupportedActionCancellable specifies the job supported action - // cancellable state for job supported action. - JobSupportedActionCancellable JobSupportedAction = "Cancellable" - // JobSupportedActionInvalid specifies the job supported action invalid - // state for job supported action. - JobSupportedActionInvalid JobSupportedAction = "Invalid" - // JobSupportedActionRetriable specifies the job supported action retriable - // state for job supported action. - JobSupportedActionRetriable JobSupportedAction = "Retriable" -) - -// MabServerType enumerates the values for mab server type. -type MabServerType string - -const ( - // MabServerTypeAzureBackupServerContainer specifies the mab server type - // azure backup server container state for mab server type. - MabServerTypeAzureBackupServerContainer MabServerType = "AzureBackupServerContainer" - // MabServerTypeAzureSQLContainer specifies the mab server type azure sql - // container state for mab server type. - MabServerTypeAzureSQLContainer MabServerType = "AzureSqlContainer" - // MabServerTypeCluster specifies the mab server type cluster state for mab - // server type. - MabServerTypeCluster MabServerType = "Cluster" - // MabServerTypeDPMContainer specifies the mab server type dpm container - // state for mab server type. - MabServerTypeDPMContainer MabServerType = "DPMContainer" - // MabServerTypeIaasVMContainer specifies the mab server type iaas vm - // container state for mab server type. - MabServerTypeIaasVMContainer MabServerType = "IaasVMContainer" - // MabServerTypeIaasVMServiceContainer specifies the mab server type iaas - // vm service container state for mab server type. - MabServerTypeIaasVMServiceContainer MabServerType = "IaasVMServiceContainer" - // MabServerTypeInvalid specifies the mab server type invalid state for mab - // server type. - MabServerTypeInvalid MabServerType = "Invalid" - // MabServerTypeMABContainer specifies the mab server type mab container - // state for mab server type. - MabServerTypeMABContainer MabServerType = "MABContainer" - // MabServerTypeUnknown specifies the mab server type unknown state for mab - // server type. - MabServerTypeUnknown MabServerType = "Unknown" - // MabServerTypeVCenter specifies the mab server type v center state for - // mab server type. - MabServerTypeVCenter MabServerType = "VCenter" - // MabServerTypeWindows specifies the mab server type windows state for mab - // server type. - MabServerTypeWindows MabServerType = "Windows" -) - -// MonthOfYear enumerates the values for month of year. -type MonthOfYear string - -const ( - // MonthOfYearApril specifies the month of year april state for month of - // year. - MonthOfYearApril MonthOfYear = "April" - // MonthOfYearAugust specifies the month of year august state for month of - // year. - MonthOfYearAugust MonthOfYear = "August" - // MonthOfYearDecember specifies the month of year december state for month - // of year. - MonthOfYearDecember MonthOfYear = "December" - // MonthOfYearFebruary specifies the month of year february state for month - // of year. - MonthOfYearFebruary MonthOfYear = "February" - // MonthOfYearInvalid specifies the month of year invalid state for month - // of year. - MonthOfYearInvalid MonthOfYear = "Invalid" - // MonthOfYearJanuary specifies the month of year january state for month - // of year. - MonthOfYearJanuary MonthOfYear = "January" - // MonthOfYearJuly specifies the month of year july state for month of - // year. - MonthOfYearJuly MonthOfYear = "July" - // MonthOfYearJune specifies the month of year june state for month of - // year. - MonthOfYearJune MonthOfYear = "June" - // MonthOfYearMarch specifies the month of year march state for month of - // year. - MonthOfYearMarch MonthOfYear = "March" - // MonthOfYearMay specifies the month of year may state for month of year. - MonthOfYearMay MonthOfYear = "May" - // MonthOfYearNovember specifies the month of year november state for month - // of year. - MonthOfYearNovember MonthOfYear = "November" - // MonthOfYearOctober specifies the month of year october state for month - // of year. - MonthOfYearOctober MonthOfYear = "October" - // MonthOfYearSeptember specifies the month of year september state for - // month of year. - MonthOfYearSeptember MonthOfYear = "September" -) - -// OperationStatusValues enumerates the values for operation status values. -type OperationStatusValues string - -const ( - // OperationStatusValuesCanceled specifies the operation status values - // canceled state for operation status values. - OperationStatusValuesCanceled OperationStatusValues = "Canceled" - // OperationStatusValuesFailed specifies the operation status values failed - // state for operation status values. - OperationStatusValuesFailed OperationStatusValues = "Failed" - // OperationStatusValuesInProgress specifies the operation status values in - // progress state for operation status values. - OperationStatusValuesInProgress OperationStatusValues = "InProgress" - // OperationStatusValuesInvalid specifies the operation status values - // invalid state for operation status values. - OperationStatusValuesInvalid OperationStatusValues = "Invalid" - // OperationStatusValuesSucceeded specifies the operation status values - // succeeded state for operation status values. - OperationStatusValuesSucceeded OperationStatusValues = "Succeeded" -) - -// ProtectedItemState enumerates the values for protected item state. -type ProtectedItemState string - -const ( - // ProtectedItemStateInvalid specifies the protected item state invalid - // state for protected item state. - ProtectedItemStateInvalid ProtectedItemState = "Invalid" - // ProtectedItemStateIRPending specifies the protected item state ir - // pending state for protected item state. - ProtectedItemStateIRPending ProtectedItemState = "IRPending" - // ProtectedItemStateProtected specifies the protected item state protected - // state for protected item state. - ProtectedItemStateProtected ProtectedItemState = "Protected" - // ProtectedItemStateProtectionError specifies the protected item state - // protection error state for protected item state. - ProtectedItemStateProtectionError ProtectedItemState = "ProtectionError" - // ProtectedItemStateProtectionPaused specifies the protected item state - // protection paused state for protected item state. - ProtectedItemStateProtectionPaused ProtectedItemState = "ProtectionPaused" - // ProtectedItemStateProtectionStopped specifies the protected item state - // protection stopped state for protected item state. - ProtectedItemStateProtectionStopped ProtectedItemState = "ProtectionStopped" -) - -// ProtectionState enumerates the values for protection state. -type ProtectionState string - -const ( - // ProtectionStateInvalid specifies the protection state invalid state for - // protection state. - ProtectionStateInvalid ProtectionState = "Invalid" - // ProtectionStateIRPending specifies the protection state ir pending state - // for protection state. - ProtectionStateIRPending ProtectionState = "IRPending" - // ProtectionStateProtected specifies the protection state protected state - // for protection state. - ProtectionStateProtected ProtectionState = "Protected" - // ProtectionStateProtectionError specifies the protection state protection - // error state for protection state. - ProtectionStateProtectionError ProtectionState = "ProtectionError" - // ProtectionStateProtectionPaused specifies the protection state - // protection paused state for protection state. - ProtectionStateProtectionPaused ProtectionState = "ProtectionPaused" - // ProtectionStateProtectionStopped specifies the protection state - // protection stopped state for protection state. - ProtectionStateProtectionStopped ProtectionState = "ProtectionStopped" -) - -// ProtectionStatus enumerates the values for protection status. -type ProtectionStatus string - -const ( - // ProtectionStatusInvalid specifies the protection status invalid state - // for protection status. - ProtectionStatusInvalid ProtectionStatus = "Invalid" - // ProtectionStatusNotProtected specifies the protection status not - // protected state for protection status. - ProtectionStatusNotProtected ProtectionStatus = "NotProtected" - // ProtectionStatusProtected specifies the protection status protected - // state for protection status. - ProtectionStatusProtected ProtectionStatus = "Protected" - // ProtectionStatusProtecting specifies the protection status protecting - // state for protection status. - ProtectionStatusProtecting ProtectionStatus = "Protecting" -) - -// RecoveryPointTierStatus enumerates the values for recovery point tier -// status. -type RecoveryPointTierStatus string - -const ( - // RecoveryPointTierStatusDeleted specifies the recovery point tier status - // deleted state for recovery point tier status. - RecoveryPointTierStatusDeleted RecoveryPointTierStatus = "Deleted" - // RecoveryPointTierStatusDisabled specifies the recovery point tier status - // disabled state for recovery point tier status. - RecoveryPointTierStatusDisabled RecoveryPointTierStatus = "Disabled" - // RecoveryPointTierStatusInvalid specifies the recovery point tier status - // invalid state for recovery point tier status. - RecoveryPointTierStatusInvalid RecoveryPointTierStatus = "Invalid" - // RecoveryPointTierStatusValid specifies the recovery point tier status - // valid state for recovery point tier status. - RecoveryPointTierStatusValid RecoveryPointTierStatus = "Valid" -) - -// RecoveryPointTierType enumerates the values for recovery point tier type. -type RecoveryPointTierType string - -const ( - // RecoveryPointTierTypeHardenedRP specifies the recovery point tier type - // hardened rp state for recovery point tier type. - RecoveryPointTierTypeHardenedRP RecoveryPointTierType = "HardenedRP" - // RecoveryPointTierTypeInstantRP specifies the recovery point tier type - // instant rp state for recovery point tier type. - RecoveryPointTierTypeInstantRP RecoveryPointTierType = "InstantRP" - // RecoveryPointTierTypeInvalid specifies the recovery point tier type - // invalid state for recovery point tier type. - RecoveryPointTierTypeInvalid RecoveryPointTierType = "Invalid" -) - -// RecoveryType enumerates the values for recovery type. -type RecoveryType string - -const ( - // RecoveryTypeAlternateLocation specifies the recovery type alternate - // location state for recovery type. - RecoveryTypeAlternateLocation RecoveryType = "AlternateLocation" - // RecoveryTypeInvalid specifies the recovery type invalid state for - // recovery type. - RecoveryTypeInvalid RecoveryType = "Invalid" - // RecoveryTypeOriginalLocation specifies the recovery type original - // location state for recovery type. - RecoveryTypeOriginalLocation RecoveryType = "OriginalLocation" - // RecoveryTypeRestoreDisks specifies the recovery type restore disks state - // for recovery type. - RecoveryTypeRestoreDisks RecoveryType = "RestoreDisks" -) - -// RetentionDurationType enumerates the values for retention duration type. -type RetentionDurationType string - -const ( - // RetentionDurationTypeDays specifies the retention duration type days - // state for retention duration type. - RetentionDurationTypeDays RetentionDurationType = "Days" - // RetentionDurationTypeInvalid specifies the retention duration type - // invalid state for retention duration type. - RetentionDurationTypeInvalid RetentionDurationType = "Invalid" - // RetentionDurationTypeMonths specifies the retention duration type months - // state for retention duration type. - RetentionDurationTypeMonths RetentionDurationType = "Months" - // RetentionDurationTypeWeeks specifies the retention duration type weeks - // state for retention duration type. - RetentionDurationTypeWeeks RetentionDurationType = "Weeks" - // RetentionDurationTypeYears specifies the retention duration type years - // state for retention duration type. - RetentionDurationTypeYears RetentionDurationType = "Years" -) - -// RetentionScheduleFormat enumerates the values for retention schedule format. -type RetentionScheduleFormat string - -const ( - // RetentionScheduleFormatDaily specifies the retention schedule format - // daily state for retention schedule format. - RetentionScheduleFormatDaily RetentionScheduleFormat = "Daily" - // RetentionScheduleFormatInvalid specifies the retention schedule format - // invalid state for retention schedule format. - RetentionScheduleFormatInvalid RetentionScheduleFormat = "Invalid" - // RetentionScheduleFormatWeekly specifies the retention schedule format - // weekly state for retention schedule format. - RetentionScheduleFormatWeekly RetentionScheduleFormat = "Weekly" -) - -// ScheduleRunType enumerates the values for schedule run type. -type ScheduleRunType string - -const ( - // ScheduleRunTypeDaily specifies the schedule run type daily state for - // schedule run type. - ScheduleRunTypeDaily ScheduleRunType = "Daily" - // ScheduleRunTypeInvalid specifies the schedule run type invalid state for - // schedule run type. - ScheduleRunTypeInvalid ScheduleRunType = "Invalid" - // ScheduleRunTypeWeekly specifies the schedule run type weekly state for - // schedule run type. - ScheduleRunTypeWeekly ScheduleRunType = "Weekly" -) - -// StorageType enumerates the values for storage type. -type StorageType string - -const ( - // StorageTypeGeoRedundant specifies the storage type geo redundant state - // for storage type. - StorageTypeGeoRedundant StorageType = "GeoRedundant" - // StorageTypeInvalid specifies the storage type invalid state for storage - // type. - StorageTypeInvalid StorageType = "Invalid" - // StorageTypeLocallyRedundant specifies the storage type locally redundant - // state for storage type. - StorageTypeLocallyRedundant StorageType = "LocallyRedundant" -) - -// StorageTypeState enumerates the values for storage type state. -type StorageTypeState string - -const ( - // StorageTypeStateInvalid specifies the storage type state invalid state - // for storage type state. - StorageTypeStateInvalid StorageTypeState = "Invalid" - // StorageTypeStateLocked specifies the storage type state locked state for - // storage type state. - StorageTypeStateLocked StorageTypeState = "Locked" - // StorageTypeStateUnlocked specifies the storage type state unlocked state - // for storage type state. - StorageTypeStateUnlocked StorageTypeState = "Unlocked" -) - -// Type enumerates the values for type. -type Type string - -const ( - // TypeBackupProtectedItemCountSummary specifies the type backup protected - // item count summary state for type. - TypeBackupProtectedItemCountSummary Type = "BackupProtectedItemCountSummary" - // TypeBackupProtectionContainerCountSummary specifies the type backup - // protection container count summary state for type. - TypeBackupProtectionContainerCountSummary Type = "BackupProtectionContainerCountSummary" - // TypeInvalid specifies the type invalid state for type. - TypeInvalid Type = "Invalid" -) - -// UsagesUnit enumerates the values for usages unit. -type UsagesUnit string - -const ( - // Bytes specifies the bytes state for usages unit. - Bytes UsagesUnit = "Bytes" - // BytesPerSecond specifies the bytes per second state for usages unit. - BytesPerSecond UsagesUnit = "BytesPerSecond" - // Count specifies the count state for usages unit. - Count UsagesUnit = "Count" - // CountPerSecond specifies the count per second state for usages unit. - CountPerSecond UsagesUnit = "CountPerSecond" - // Percent specifies the percent state for usages unit. - Percent UsagesUnit = "Percent" - // Seconds specifies the seconds state for usages unit. - Seconds UsagesUnit = "Seconds" -) - -// WeekOfMonth enumerates the values for week of month. -type WeekOfMonth string - -const ( - // First specifies the first state for week of month. - First WeekOfMonth = "First" - // Fourth specifies the fourth state for week of month. - Fourth WeekOfMonth = "Fourth" - // Last specifies the last state for week of month. - Last WeekOfMonth = "Last" - // Second specifies the second state for week of month. - Second WeekOfMonth = "Second" - // Third specifies the third state for week of month. - Third WeekOfMonth = "Third" -) - -// WorkloadType enumerates the values for workload type. -type WorkloadType string - -const ( - // WorkloadTypeAzureSQLDb specifies the workload type azure sql db state - // for workload type. - WorkloadTypeAzureSQLDb WorkloadType = "AzureSqlDb" - // WorkloadTypeClient specifies the workload type client state for workload - // type. - WorkloadTypeClient WorkloadType = "Client" - // WorkloadTypeExchange specifies the workload type exchange state for - // workload type. - WorkloadTypeExchange WorkloadType = "Exchange" - // WorkloadTypeFileFolder specifies the workload type file folder state for - // workload type. - WorkloadTypeFileFolder WorkloadType = "FileFolder" - // WorkloadTypeGenericDataSource specifies the workload type generic data - // source state for workload type. - WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" - // WorkloadTypeInvalid specifies the workload type invalid state for - // workload type. - WorkloadTypeInvalid WorkloadType = "Invalid" - // WorkloadTypeSharepoint specifies the workload type sharepoint state for - // workload type. - WorkloadTypeSharepoint WorkloadType = "Sharepoint" - // WorkloadTypeSQLDB specifies the workload type sqldb state for workload - // type. - WorkloadTypeSQLDB WorkloadType = "SQLDB" - // WorkloadTypeSystemState specifies the workload type system state state - // for workload type. - WorkloadTypeSystemState WorkloadType = "SystemState" - // WorkloadTypeVM specifies the workload type vm state for workload type. - WorkloadTypeVM WorkloadType = "VM" - // WorkloadTypeVMwareVM specifies the workload type v mware vm state for - // workload type. - WorkloadTypeVMwareVM WorkloadType = "VMwareVM" -) - -// AzureBackupServerContainer is azureBackupServer (DPMVenus) workload-specific -// protection container. -type AzureBackupServerContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - ContainerID *string `json:"containerId,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - DpmAgentVersion *string `json:"dpmAgentVersion,omitempty"` - DPMServers *[]string `json:"DPMServers,omitempty"` - UpgradeAvailable *bool `json:"UpgradeAvailable,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - ExtendedInfo *DPMContainerExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureBackupServerEngine is backup engine type when Azure Backup Server is -// used to manage the backups. -type AzureBackupServerEngine struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - BackupEngineState *string `json:"backupEngineState,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - BackupEngineID *string `json:"backupEngineId,omitempty"` - DpmVersion *string `json:"dpmVersion,omitempty"` - AzureBackupAgentVersion *string `json:"azureBackupAgentVersion,omitempty"` - IsAzureBackupAgentUpgradeAvailable *bool `json:"isAzureBackupAgentUpgradeAvailable,omitempty"` - IsDPMUpgradeAvailable *bool `json:"isDPMUpgradeAvailable,omitempty"` - ExtendedInfo *BackupEngineExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureIaaSClassicComputeVMContainer is iaaS VM workload-specific backup item -// representing a classic virtual machine. -type AzureIaaSClassicComputeVMContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// AzureIaaSClassicComputeVMProtectableItem is iaaS VM workload-specific backup -// item representing the Classic Compute VM. -type AzureIaaSClassicComputeVMProtectableItem struct { - BackupManagementType *string `json:"backupManagementType,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - ProtectionState ProtectionStatus `json:"protectionState,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` -} - -// AzureIaaSClassicComputeVMProtectedItem is iaaS VM workload-specific backup -// item representing the Classic Compute VM. -type AzureIaaSClassicComputeVMProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - ProtectionState ProtectionState `json:"protectionState,omitempty"` - HealthStatus HealthStatus `json:"healthStatus,omitempty"` - HealthDetails *[]AzureIaaSVMHealthDetails `json:"healthDetails,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` - LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` - ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` - ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureIaaSComputeVMContainer is iaaS VM workload-specific backup item -// representing an Azure Resource Manager virtual machine. -type AzureIaaSComputeVMContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// AzureIaaSComputeVMProtectableItem is iaaS VM workload-specific backup item -// representing the Azure Resource Manager VM. -type AzureIaaSComputeVMProtectableItem struct { - BackupManagementType *string `json:"backupManagementType,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - ProtectionState ProtectionStatus `json:"protectionState,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` -} - -// AzureIaaSComputeVMProtectedItem is iaaS VM workload-specific backup item -// representing the Azure Resource Manager VM. -type AzureIaaSComputeVMProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - ProtectionState ProtectionState `json:"protectionState,omitempty"` - HealthStatus HealthStatus `json:"healthStatus,omitempty"` - HealthDetails *[]AzureIaaSVMHealthDetails `json:"healthDetails,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` - LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` - ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` - ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureIaaSVMErrorInfo is azure IaaS VM workload-specific error information. -type AzureIaaSVMErrorInfo struct { - ErrorCode *int32 `json:"errorCode,omitempty"` - ErrorTitle *string `json:"errorTitle,omitempty"` - ErrorString *string `json:"errorString,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} - -// AzureIaaSVMHealthDetails is azure IaaS VM workload-specific Health Details. -type AzureIaaSVMHealthDetails struct { - Code *int32 `json:"code,omitempty"` - Title *string `json:"title,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} - -// AzureIaaSVMJob is azure IaaS VM workload-specifc job object. -type AzureIaaSVMJob struct { - EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - Operation *string `json:"operation,omitempty"` - Status *string `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ActivityID *string `json:"activityId,omitempty"` - Duration *string `json:"duration,omitempty"` - ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` - ErrorDetails *[]AzureIaaSVMErrorInfo `json:"errorDetails,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - ExtendedInfo *AzureIaaSVMJobExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureIaaSVMJobExtendedInfo is azure IaaS VM workload-specific additional -// information for job. -type AzureIaaSVMJobExtendedInfo struct { - TasksList *[]AzureIaaSVMJobTaskDetails `json:"tasksList,omitempty"` - PropertyBag *map[string]*string `json:"propertyBag,omitempty"` - ProgressPercentage *float64 `json:"progressPercentage,omitempty"` - DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` -} - -// AzureIaaSVMJobTaskDetails is azure IaaS VM workload-specific job task -// details. -type AzureIaaSVMJobTaskDetails struct { - TaskID *string `json:"taskId,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - InstanceID *string `json:"instanceId,omitempty"` - Duration *string `json:"duration,omitempty"` - Status *string `json:"status,omitempty"` - ProgressPercentage *float64 `json:"progressPercentage,omitempty"` -} - -// AzureIaaSVMProtectedItem is iaaS VM workload-specific backup item. -type AzureIaaSVMProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - ProtectionState ProtectionState `json:"protectionState,omitempty"` - HealthStatus HealthStatus `json:"healthStatus,omitempty"` - HealthDetails *[]AzureIaaSVMHealthDetails `json:"healthDetails,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` - LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` - ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` - ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureIaaSVMProtectedItemExtendedInfo is additional information on Azure IaaS -// VM specific backup item. -type AzureIaaSVMProtectedItemExtendedInfo struct { - OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` - RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` - PolicyInconsistent *bool `json:"policyInconsistent,omitempty"` -} - -// AzureIaaSVMProtectionPolicy is iaaS VM workload-specific backup policy. -type AzureIaaSVMProtectionPolicy struct { - ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` - SchedulePolicy *SchedulePolicy `json:"schedulePolicy,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` -} - -// AzureSQLContainer is azure Sql workload-specific container. -type AzureSQLContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` -} - -// AzureSQLProtectedItem is azure SQL workload-specific backup item. -type AzureSQLProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` - ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` - ProtectionState ProtectedItemState `json:"protectionState,omitempty"` - ExtendedInfo *AzureSQLProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` -} - -// AzureSQLProtectedItemExtendedInfo is additional information on Azure Sql -// specific protected item. -type AzureSQLProtectedItemExtendedInfo struct { - OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` - RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` - PolicyState *string `json:"policyState,omitempty"` -} - -// AzureSQLProtectionPolicy is azure SQL workload-specific backup policy. -type AzureSQLProtectionPolicy struct { - ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// BackupEngineBase is the base backup engine class. All workload specific -// backup engines derive from this class. -type BackupEngineBase struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - BackupEngineState *string `json:"backupEngineState,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - BackupEngineID *string `json:"backupEngineId,omitempty"` - DpmVersion *string `json:"dpmVersion,omitempty"` - AzureBackupAgentVersion *string `json:"azureBackupAgentVersion,omitempty"` - IsAzureBackupAgentUpgradeAvailable *bool `json:"isAzureBackupAgentUpgradeAvailable,omitempty"` - IsDPMUpgradeAvailable *bool `json:"isDPMUpgradeAvailable,omitempty"` - ExtendedInfo *BackupEngineExtendedInfo `json:"extendedInfo,omitempty"` -} - -// BackupEngineBaseResource is the base backup engine class. All workload -// specific backup engines derive from this class. -type BackupEngineBaseResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *BackupEngineBase `json:"properties,omitempty"` -} - -// BackupEngineBaseResourceList is list of BackupEngineBase resources -type BackupEngineBaseResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]BackupEngineBaseResource `json:"value,omitempty"` -} - -// BackupEngineBaseResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client BackupEngineBaseResourceList) BackupEngineBaseResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// BackupEngineExtendedInfo is additional information on backup engine. -type BackupEngineExtendedInfo struct { - DatabaseName *string `json:"databaseName,omitempty"` - ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` - ProtectedServersCount *int32 `json:"protectedServersCount,omitempty"` - DiskCount *int32 `json:"diskCount,omitempty"` - UsedDiskSpace *float64 `json:"usedDiskSpace,omitempty"` - AvailableDiskSpace *float64 `json:"availableDiskSpace,omitempty"` - RefreshedAt *date.Time `json:"refreshedAt,omitempty"` - AzureProtectedInstances *int32 `json:"azureProtectedInstances,omitempty"` -} - -// BackupManagementUsage is backup management usages of a vault. -type BackupManagementUsage struct { - Unit UsagesUnit `json:"unit,omitempty"` - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - NextResetTime *date.Time `json:"nextResetTime,omitempty"` - CurrentValue *int64 `json:"currentValue,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Name *NameInfo `json:"name,omitempty"` -} - -// BackupManagementUsageList is backup management usage for vault. -type BackupManagementUsageList struct { - autorest.Response `json:"-"` - Value *[]BackupManagementUsage `json:"value,omitempty"` -} - -// BackupRequest is base class for backup request. Workload-specific backup -// requests are derived from this class. -type BackupRequest struct { -} - -// BackupRequestResource is base class for backup request. Workload-specific -// backup requests are derived from this class. -type BackupRequestResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *BackupRequest `json:"properties,omitempty"` -} - -// BackupResourceConfig is the resource storage details. -type BackupResourceConfig struct { - StorageType StorageType `json:"storageType,omitempty"` - StorageTypeState StorageTypeState `json:"storageTypeState,omitempty"` -} - -// BackupResourceConfigResource is the resource storage details. -type BackupResourceConfigResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *BackupResourceConfig `json:"properties,omitempty"` -} - -// BackupResourceVaultConfig is backup resource vault config details. -type BackupResourceVaultConfig struct { - StorageType StorageType `json:"storageType,omitempty"` - StorageTypeState StorageTypeState `json:"storageTypeState,omitempty"` - EnhancedSecurityState EnhancedSecurityState `json:"enhancedSecurityState,omitempty"` -} - -// BackupResourceVaultConfigResource is backup resource vault config details. -type BackupResourceVaultConfigResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *BackupResourceVaultConfig `json:"properties,omitempty"` -} - -// BEKDetails is bEK is bitlocker encrpytion key. -type BEKDetails struct { - SecretURL *string `json:"secretUrl,omitempty"` - SecretVaultID *string `json:"secretVaultId,omitempty"` - SecretData *string `json:"secretData,omitempty"` -} - -// BMSBackupEngineQueryObject is query parameters to fetch list of backup -// engines. -type BMSBackupEngineQueryObject struct { - Expand *string `json:"expand,omitempty"` -} - -// BMSBackupEnginesQueryObject is query parameters to fetch list of backup -// engines. -type BMSBackupEnginesQueryObject struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - Expand *string `json:"expand,omitempty"` -} - -// BMSBackupSummariesQueryObject is query parameters to fetch backup summaries. -type BMSBackupSummariesQueryObject struct { - Type Type `json:"type,omitempty"` -} - -// BMSContainerQueryObject is the query filters that can be used with the list -// containers API. -type BMSContainerQueryObject struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - BackupEngineName *string `json:"backupEngineName,omitempty"` - Status *string `json:"status,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// BMSPOQueryObject is filters to list items that can be backed up. -type BMSPOQueryObject struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - Status *string `json:"status,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// BMSRPQueryObject is filters to list backup copies. -type BMSRPQueryObject struct { - StartDate *date.Time `json:"startDate,omitempty"` - EndDate *date.Time `json:"endDate,omitempty"` -} - -// ClientDiscoveryDisplay is localized display information of an operation. -type ClientDiscoveryDisplay struct { - Provider *string `json:"Provider,omitempty"` - Resource *string `json:"Resource,omitempty"` - Operation *string `json:"Operation,omitempty"` - Description *string `json:"Description,omitempty"` -} - -// ClientDiscoveryForLogSpecification is class to represent shoebox log -// specification in json client discovery. -type ClientDiscoveryForLogSpecification struct { - Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// ClientDiscoveryForProperties is class to represent shoebox properties in -// json client discovery. -type ClientDiscoveryForProperties struct { - ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// ClientDiscoveryForServiceSpecification is class to represent shoebox service -// specification in json client discovery. -type ClientDiscoveryForServiceSpecification struct { - LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` -} - -// ClientDiscoveryResponse is operations List response which contains list of -// available APIs. -type ClientDiscoveryResponse struct { - autorest.Response `json:"-"` - Value *[]ClientDiscoveryValueForSingleAPI `json:"Value,omitempty"` - NextLink *string `json:"NextLink,omitempty"` -} - -// ClientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClientDiscoveryResponse) ClientDiscoveryResponsePreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClientDiscoveryValueForSingleAPI is available operation details. -type ClientDiscoveryValueForSingleAPI struct { - Name *string `json:"Name,omitempty"` - Display *ClientDiscoveryDisplay `json:"Display,omitempty"` - Origin *string `json:"Origin,omitempty"` - Properties *ClientDiscoveryForProperties `json:"Properties,omitempty"` -} - -// ClientScriptForConnect is client script details for file / folder restore. -type ClientScriptForConnect struct { - ScriptContent *string `json:"scriptContent,omitempty"` - ScriptExtension *string `json:"scriptExtension,omitempty"` - OsType *string `json:"osType,omitempty"` - URL *string `json:"url,omitempty"` - ScriptNameSuffix *string `json:"scriptNameSuffix,omitempty"` -} - -// DailyRetentionFormat is daily retention format. -type DailyRetentionFormat struct { - DaysOfTheMonth *[]Day `json:"daysOfTheMonth,omitempty"` -} - -// DailyRetentionSchedule is daily retention schedule. -type DailyRetentionSchedule struct { - RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` - RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` -} - -// Day is day of the week. -type Day struct { - Date *int32 `json:"date,omitempty"` - IsLast *bool `json:"isLast,omitempty"` -} - -// DpmBackupEngine is data Protection Manager (DPM) specific backup engine. -type DpmBackupEngine struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - BackupEngineState *string `json:"backupEngineState,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - BackupEngineID *string `json:"backupEngineId,omitempty"` - DpmVersion *string `json:"dpmVersion,omitempty"` - AzureBackupAgentVersion *string `json:"azureBackupAgentVersion,omitempty"` - IsAzureBackupAgentUpgradeAvailable *bool `json:"isAzureBackupAgentUpgradeAvailable,omitempty"` - IsDPMUpgradeAvailable *bool `json:"isDPMUpgradeAvailable,omitempty"` - ExtendedInfo *BackupEngineExtendedInfo `json:"extendedInfo,omitempty"` -} - -// DpmContainer is dPM workload-specific protection container. -type DpmContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - ContainerID *string `json:"containerId,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - DpmAgentVersion *string `json:"dpmAgentVersion,omitempty"` - DPMServers *[]string `json:"DPMServers,omitempty"` - UpgradeAvailable *bool `json:"UpgradeAvailable,omitempty"` - ProtectionStatus *string `json:"protectionStatus,omitempty"` - ExtendedInfo *DPMContainerExtendedInfo `json:"extendedInfo,omitempty"` -} - -// DPMContainerExtendedInfo is additional information of the DPMContainer. -type DPMContainerExtendedInfo struct { - LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` -} - -// DpmErrorInfo is dPM workload-specific error information. -type DpmErrorInfo struct { - ErrorString *string `json:"errorString,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} - -// DpmJob is dPM workload-specifc job object. -type DpmJob struct { - EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - Operation *string `json:"operation,omitempty"` - Status *string `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ActivityID *string `json:"activityId,omitempty"` - Duration *string `json:"duration,omitempty"` - DpmServerName *string `json:"dpmServerName,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - ContainerType *string `json:"containerType,omitempty"` - WorkloadType *string `json:"workloadType,omitempty"` - ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` - ErrorDetails *[]DpmErrorInfo `json:"errorDetails,omitempty"` - ExtendedInfo *DpmJobExtendedInfo `json:"extendedInfo,omitempty"` -} - -// DpmJobExtendedInfo is additional information on the DPM workload-specific -// job. -type DpmJobExtendedInfo struct { - TasksList *[]DpmJobTaskDetails `json:"tasksList,omitempty"` - PropertyBag *map[string]*string `json:"propertyBag,omitempty"` - DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` -} - -// DpmJobTaskDetails is dPM workload-specific job task details. -type DpmJobTaskDetails struct { - TaskID *string `json:"taskId,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Duration *string `json:"duration,omitempty"` - Status *string `json:"status,omitempty"` -} - -// DPMProtectedItem is additional information on Backup engine specific backup -// item. -type DPMProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - BackupEngineName *string `json:"backupEngineName,omitempty"` - ProtectionState ProtectedItemState `json:"protectionState,omitempty"` - IsScheduledForDeferredDelete *bool `json:"isScheduledForDeferredDelete,omitempty"` - ExtendedInfo *DPMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` -} - -// DPMProtectedItemExtendedInfo is additional information of DPM Protected -// item. -type DPMProtectedItemExtendedInfo struct { - ProtectableObjectLoadPath *map[string]*string `json:"protectableObjectLoadPath,omitempty"` - Protected *bool `json:"protected,omitempty"` - IsPresentOnCloud *bool `json:"isPresentOnCloud,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` - LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` - OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` - RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` - OnPremiseOldestRecoveryPoint *date.Time `json:"onPremiseOldestRecoveryPoint,omitempty"` - OnPremiseLatestRecoveryPoint *date.Time `json:"onPremiseLatestRecoveryPoint,omitempty"` - OnPremiseRecoveryPointCount *int32 `json:"onPremiseRecoveryPointCount,omitempty"` - IsCollocated *bool `json:"isCollocated,omitempty"` - ProtectionGroupName *string `json:"protectionGroupName,omitempty"` - DiskStorageUsedInBytes *string `json:"diskStorageUsedInBytes,omitempty"` - TotalDiskStorageSizeInBytes *string `json:"totalDiskStorageSizeInBytes,omitempty"` -} - -// EncryptionDetails is details needed if the VM was encrypted at the time of -// backup. -type EncryptionDetails struct { - EncryptionEnabled *bool `json:"encryptionEnabled,omitempty"` - KekURL *string `json:"kekUrl,omitempty"` - SecretKeyURL *string `json:"secretKeyUrl,omitempty"` - KekVaultID *string `json:"kekVaultId,omitempty"` - SecretKeyVaultID *string `json:"secretKeyVaultId,omitempty"` -} - -// ExportJobsOperationResultInfo is this class is used to send blob details -// after exporting jobs. -type ExportJobsOperationResultInfo struct { - BlobURL *string `json:"blobUrl,omitempty"` - BlobSasKey *string `json:"blobSasKey,omitempty"` -} - -// GenericRecoveryPoint is generic backup copy. -type GenericRecoveryPoint struct { - FriendlyName *string `json:"friendlyName,omitempty"` - RecoveryPointType *string `json:"recoveryPointType,omitempty"` - RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` - RecoveryPointAdditionalInfo *string `json:"recoveryPointAdditionalInfo,omitempty"` -} - -// GetProtectedItemQueryObject is filters to list backup items. -type GetProtectedItemQueryObject struct { - Expand *string `json:"expand,omitempty"` -} - -// IaasVMBackupRequest is iaaS VM workload-specific backup request. -type IaasVMBackupRequest struct { - RecoveryPointExpiryTimeInUTC *date.Time `json:"recoveryPointExpiryTimeInUTC,omitempty"` -} - -// IaaSVMContainer is iaaS VM workload-specific container. -type IaaSVMContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// IaasVMILRRegistrationRequest is restore files/folders from a backup copy of -// IaaS VM. -type IaasVMILRRegistrationRequest struct { - RecoveryPointID *string `json:"recoveryPointId,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - InitiatorName *string `json:"initiatorName,omitempty"` - RenewExistingRegistration *bool `json:"renewExistingRegistration,omitempty"` -} - -// IaaSVMProtectableItem is iaaS VM workload-specific backup item. -type IaaSVMProtectableItem struct { - BackupManagementType *string `json:"backupManagementType,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - ProtectionState ProtectionStatus `json:"protectionState,omitempty"` - VirtualMachineID *string `json:"virtualMachineId,omitempty"` -} - -// IaasVMRecoveryPoint is iaaS VM workload specific backup copy. -type IaasVMRecoveryPoint struct { - RecoveryPointType *string `json:"recoveryPointType,omitempty"` - RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` - RecoveryPointAdditionalInfo *string `json:"recoveryPointAdditionalInfo,omitempty"` - SourceVMStorageType *string `json:"sourceVMStorageType,omitempty"` - IsSourceVMEncrypted *bool `json:"isSourceVMEncrypted,omitempty"` - KeyAndSecret *KeyAndSecretDetails `json:"keyAndSecret,omitempty"` - IsInstantILRSessionActive *bool `json:"isInstantILRSessionActive,omitempty"` - RecoveryPointTierDetails *[]RecoveryPointTierInformation `json:"recoveryPointTierDetails,omitempty"` - IsManagedVirtualMachine *bool `json:"isManagedVirtualMachine,omitempty"` - VirtualMachineSize *string `json:"virtualMachineSize,omitempty"` -} - -// IaasVMRestoreRequest is iaaS VM workload-specific restore. -type IaasVMRestoreRequest struct { - RecoveryPointID *string `json:"recoveryPointId,omitempty"` - RecoveryType RecoveryType `json:"recoveryType,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - TargetVirtualMachineID *string `json:"targetVirtualMachineId,omitempty"` - TargetResourceGroupID *string `json:"targetResourceGroupId,omitempty"` - StorageAccountID *string `json:"storageAccountId,omitempty"` - VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - TargetDomainNameID *string `json:"targetDomainNameId,omitempty"` - Region *string `json:"region,omitempty"` - AffinityGroup *string `json:"affinityGroup,omitempty"` - CreateNewCloudService *bool `json:"createNewCloudService,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryptionDetails,omitempty"` -} - -// ILRRequest is parameters to restore file/folders API. -type ILRRequest struct { -} - -// ILRRequestResource is parameters to restore file/folders API. -type ILRRequestResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *ILRRequest `json:"properties,omitempty"` -} - -// InstantItemRecoveryTarget is target details for file / folder restore. -type InstantItemRecoveryTarget struct { - ClientScripts *[]ClientScriptForConnect `json:"clientScripts,omitempty"` -} - -// Job is defines workload agnostic properties for a job. -type Job struct { - EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - Operation *string `json:"operation,omitempty"` - Status *string `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ActivityID *string `json:"activityId,omitempty"` -} - -// JobQueryObject is filters to list the jobs. -type JobQueryObject struct { - Status JobStatus `json:"status,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - Operation JobOperationType `json:"operation,omitempty"` - JobID *string `json:"jobId,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` -} - -// JobResource is defines workload agnostic properties for a job. -type JobResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *Job `json:"properties,omitempty"` -} - -// JobResourceList is list of Job resources -type JobResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]JobResource `json:"value,omitempty"` -} - -// JobResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobResourceList) JobResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// KEKDetails is kEK is encryption key for BEK. -type KEKDetails struct { - KeyURL *string `json:"keyUrl,omitempty"` - KeyVaultID *string `json:"keyVaultId,omitempty"` - KeyBackupData *string `json:"keyBackupData,omitempty"` -} - -// KeyAndSecretDetails is bEK is bitlocker key. -// KEK is encryption key for BEK -// If the VM was encrypted then we will store follwing details : -// 1. Secret(BEK) - Url + Backup Data + vaultId. -// 2. Key(KEK) - Url + Backup Data + vaultId. -// BEK and KEK can potentiallty have different vault ids. -type KeyAndSecretDetails struct { - KekDetails *KEKDetails `json:"kekDetails,omitempty"` - BekDetails *BEKDetails `json:"bekDetails,omitempty"` -} - -// LongTermRetentionPolicy is long term retention policy. -type LongTermRetentionPolicy struct { - DailySchedule *DailyRetentionSchedule `json:"dailySchedule,omitempty"` - WeeklySchedule *WeeklyRetentionSchedule `json:"weeklySchedule,omitempty"` - MonthlySchedule *MonthlyRetentionSchedule `json:"monthlySchedule,omitempty"` - YearlySchedule *YearlyRetentionSchedule `json:"yearlySchedule,omitempty"` -} - -// LongTermSchedulePolicy is long term policy schedule. -type LongTermSchedulePolicy struct { -} - -// MabContainer is container with items backed up using MAB backup engine. -type MabContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` - CanReRegister *bool `json:"canReRegister,omitempty"` - ContainerID *int64 `json:"containerId,omitempty"` - ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` - AgentVersion *string `json:"agentVersion,omitempty"` - ExtendedInfo *MabContainerExtendedInfo `json:"extendedInfo,omitempty"` -} - -// MabContainerExtendedInfo is additional information of the container. -type MabContainerExtendedInfo struct { - LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` - BackupItemType BackupItemType `json:"backupItemType,omitempty"` - BackupItems *[]string `json:"backupItems,omitempty"` - PolicyName *string `json:"policyName,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` -} - -// MabErrorInfo is mAB workload-specific error information. -type MabErrorInfo struct { - ErrorString *string `json:"errorString,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` -} - -// MabFileFolderProtectedItem is mAB workload-specific backup item. -type MabFileFolderProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - ComputerName *string `json:"computerName,omitempty"` - LastBackupStatus *string `json:"lastBackupStatus,omitempty"` - ProtectionState *string `json:"protectionState,omitempty"` - IsScheduledForDeferredDelete *bool `json:"isScheduledForDeferredDelete,omitempty"` - DeferredDeleteSyncTimeInUTC *int64 `json:"deferredDeleteSyncTimeInUTC,omitempty"` - ExtendedInfo *MabFileFolderProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` -} - -// MabFileFolderProtectedItemExtendedInfo is additional information on the -// backed up item. -type MabFileFolderProtectedItemExtendedInfo struct { - LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` - OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` - RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` -} - -// MabJob is mAB workload-specific job. -type MabJob struct { - EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - Operation *string `json:"operation,omitempty"` - Status *string `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ActivityID *string `json:"activityId,omitempty"` - Duration *string `json:"duration,omitempty"` - ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` - MabServerName *string `json:"mabServerName,omitempty"` - MabServerType MabServerType `json:"mabServerType,omitempty"` - WorkloadType WorkloadType `json:"workloadType,omitempty"` - ErrorDetails *[]MabErrorInfo `json:"errorDetails,omitempty"` - ExtendedInfo *MabJobExtendedInfo `json:"extendedInfo,omitempty"` -} - -// MabJobExtendedInfo is additional information for the MAB workload-specific -// job. -type MabJobExtendedInfo struct { - TasksList *[]MabJobTaskDetails `json:"tasksList,omitempty"` - PropertyBag *map[string]*string `json:"propertyBag,omitempty"` - DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` -} - -// MabJobTaskDetails is mAB workload-specific job task details. -type MabJobTaskDetails struct { - TaskID *string `json:"taskId,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Duration *string `json:"duration,omitempty"` - Status *string `json:"status,omitempty"` -} - -// MabProtectionPolicy is mab container-specific backup policy. -type MabProtectionPolicy struct { - ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` - SchedulePolicy *SchedulePolicy `json:"schedulePolicy,omitempty"` - RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` -} - -// MonthlyRetentionSchedule is monthly retention schedule. -type MonthlyRetentionSchedule struct { - RetentionScheduleFormatType RetentionScheduleFormat `json:"retentionScheduleFormatType,omitempty"` - RetentionScheduleDaily *DailyRetentionFormat `json:"retentionScheduleDaily,omitempty"` - RetentionScheduleWeekly *WeeklyRetentionFormat `json:"retentionScheduleWeekly,omitempty"` - RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` - RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` -} - -// NameInfo is the name of usage. -type NameInfo struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// OperationResultInfo is operation result info. -type OperationResultInfo struct { - JobList *[]string `json:"jobList,omitempty"` -} - -// OperationResultInfoBase is base class for operation result info. -type OperationResultInfoBase struct { -} - -// OperationResultInfoBaseResource is base class for operation result info. -type OperationResultInfoBaseResource struct { - autorest.Response `json:"-"` - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - Headers *map[string][]string `json:"Headers,omitempty"` - Operation *OperationResultInfoBase `json:"operation,omitempty"` -} - -// OperationStatus is operation status. -type OperationStatus struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Status OperationStatusValues `json:"status,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Error *OperationStatusError `json:"error,omitempty"` - Properties *OperationStatusExtendedInfo `json:"properties,omitempty"` -} - -// OperationStatusError is error information associated with operation status -// call. -type OperationStatusError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// OperationStatusExtendedInfo is base class for additional information of -// operation status. -type OperationStatusExtendedInfo struct { -} - -// OperationStatusJobExtendedInfo is operation status job extended info. -type OperationStatusJobExtendedInfo struct { - JobID *string `json:"jobId,omitempty"` -} - -// OperationStatusJobsExtendedInfo is operation status extended info for list -// of jobs. -type OperationStatusJobsExtendedInfo struct { - JobIds *[]string `json:"jobIds,omitempty"` - FailedJobsError *map[string]*string `json:"failedJobsError,omitempty"` -} - -// OperationStatusProvisionILRExtendedInfo is operation status extended info -// for ILR provision action. -type OperationStatusProvisionILRExtendedInfo struct { - RecoveryTarget *InstantItemRecoveryTarget `json:"recoveryTarget,omitempty"` -} - -// OperationWorkerResponse is this is the base class for operation result -// responses. -type OperationWorkerResponse struct { - StatusCode HTTPStatusCode `json:"statusCode,omitempty"` - Headers *map[string][]string `json:"Headers,omitempty"` -} - -// ProtectedItem is base class for backup items. -type ProtectedItem struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - WorkloadType DataSourceType `json:"workloadType,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - SourceResourceID *string `json:"sourceResourceId,omitempty"` - PolicyID *string `json:"policyId,omitempty"` - LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` -} - -// ProtectedItemQueryObject is filters to list backup items. -type ProtectedItemQueryObject struct { - HealthState HealthState `json:"healthState,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - ItemType DataSourceType `json:"itemType,omitempty"` - PolicyName *string `json:"policyName,omitempty"` - ContainerName *string `json:"containerName,omitempty"` - BackupEngineName *string `json:"backupEngineName,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// ProtectedItemResource is base class for backup items. -type ProtectedItemResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *ProtectedItem `json:"properties,omitempty"` -} - -// ProtectedItemResourceList is list of ProtectedItem resources -type ProtectedItemResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]ProtectedItemResource `json:"value,omitempty"` -} - -// ProtectedItemResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProtectedItemResourceList) ProtectedItemResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProtectionContainer is base class for container with backup items. -// Containers with specific workloads are derived from this class. -type ProtectionContainer struct { - FriendlyName *string `json:"friendlyName,omitempty"` - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` - RegistrationStatus *string `json:"registrationStatus,omitempty"` - HealthStatus *string `json:"healthStatus,omitempty"` - ContainerType ContainerType `json:"containerType,omitempty"` -} - -// ProtectionContainerResource is base class for container with backup items. -// Containers with specific workloads are derived from this class. -type ProtectionContainerResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *ProtectionContainer `json:"properties,omitempty"` -} - -// ProtectionContainerResourceList is list of ProtectionContainer resources -type ProtectionContainerResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]ProtectionContainerResource `json:"value,omitempty"` -} - -// ProtectionContainerResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProtectionContainerResourceList) ProtectionContainerResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProtectionPolicy is base class for backup policy. Workload-specific backup -// policies are derived from this class. -type ProtectionPolicy struct { - ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` -} - -// ProtectionPolicyQueryObject is filters the list backup policies API. -type ProtectionPolicyQueryObject struct { - BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` -} - -// ProtectionPolicyResource is base class for backup policy. Workload-specific -// backup policies are derived from this class. -type ProtectionPolicyResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *ProtectionPolicy `json:"properties,omitempty"` -} - -// ProtectionPolicyResourceList is list of ProtectionPolicy resources -type ProtectionPolicyResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]ProtectionPolicyResource `json:"value,omitempty"` -} - -// ProtectionPolicyResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProtectionPolicyResourceList) ProtectionPolicyResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RecoveryPoint is base class for backup copies. Workload-specific backup -// copies are derived from this class. -type RecoveryPoint struct { -} - -// RecoveryPointResource is base class for backup copies. Workload-specific -// backup copies are derived from this class. -type RecoveryPointResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *RecoveryPoint `json:"properties,omitempty"` -} - -// RecoveryPointResourceList is list of RecoveryPoint resources -type RecoveryPointResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]RecoveryPointResource `json:"value,omitempty"` -} - -// RecoveryPointResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client RecoveryPointResourceList) RecoveryPointResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RecoveryPointTierInformation is recovery point tier information. -type RecoveryPointTierInformation struct { - Type RecoveryPointTierType `json:"type,omitempty"` - Status RecoveryPointTierStatus `json:"status,omitempty"` -} - -// Resource is aRM Resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` -} - -// ResourceList is base for all lists of resources. -type ResourceList struct { - NextLink *string `json:"nextLink,omitempty"` -} - -// RestoreRequest is base class for restore request. Workload-specific restore -// requests are derived from this class. -type RestoreRequest struct { -} - -// RestoreRequestResource is base class for restore request. Workload-specific -// restore requests are derived from this class. -type RestoreRequestResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *RestoreRequest `json:"properties,omitempty"` -} - -// RetentionDuration is retention duration. -type RetentionDuration struct { - Count *int32 `json:"count,omitempty"` - DurationType RetentionDurationType `json:"durationType,omitempty"` -} - -// RetentionPolicy is base class for retention policy. -type RetentionPolicy struct { -} - -// SchedulePolicy is base class for backup schedule. -type SchedulePolicy struct { -} - -// SimpleRetentionPolicy is simple policy retention. -type SimpleRetentionPolicy struct { - RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` -} - -// SimpleSchedulePolicy is simple policy schedule. -type SimpleSchedulePolicy struct { - ScheduleRunFrequency ScheduleRunType `json:"scheduleRunFrequency,omitempty"` - ScheduleRunDays *[]DayOfWeek `json:"scheduleRunDays,omitempty"` - ScheduleRunTimes *[]date.Time `json:"scheduleRunTimes,omitempty"` - ScheduleWeeklyFrequency *int32 `json:"scheduleWeeklyFrequency,omitempty"` -} - -// TokenInformation is the token information details. -type TokenInformation struct { - autorest.Response `json:"-"` - Token *string `json:"token,omitempty"` - ExpiryTimeInUtcTicks *int64 `json:"expiryTimeInUtcTicks,omitempty"` - SecurityPIN *string `json:"securityPIN,omitempty"` -} - -// WeeklyRetentionFormat is weekly retention format. -type WeeklyRetentionFormat struct { - DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` - WeeksOfTheMonth *[]WeekOfMonth `json:"weeksOfTheMonth,omitempty"` -} - -// WeeklyRetentionSchedule is weekly retention schedule. -type WeeklyRetentionSchedule struct { - DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` - RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` - RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` -} - -// WorkloadProtectableItem is base class for backup item. Workload-specific -// backup items are derived from this class. -type WorkloadProtectableItem struct { - BackupManagementType *string `json:"backupManagementType,omitempty"` - FriendlyName *string `json:"friendlyName,omitempty"` - ProtectionState ProtectionStatus `json:"protectionState,omitempty"` -} - -// WorkloadProtectableItemResource is base class for backup item. -// Workload-specific backup items are derived from this class. -type WorkloadProtectableItemResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ETag *string `json:"eTag,omitempty"` - Properties *WorkloadProtectableItem `json:"properties,omitempty"` -} - -// WorkloadProtectableItemResourceList is list of WorkloadProtectableItem -// resources -type WorkloadProtectableItemResourceList struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]WorkloadProtectableItemResource `json:"value,omitempty"` -} - -// WorkloadProtectableItemResourceListPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkloadProtectableItemResourceList) WorkloadProtectableItemResourceListPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// YearlyRetentionSchedule is yearly retention schedule. -type YearlyRetentionSchedule struct { - RetentionScheduleFormatType RetentionScheduleFormat `json:"retentionScheduleFormatType,omitempty"` - MonthsOfYear *[]MonthOfYear `json:"monthsOfYear,omitempty"` - RetentionScheduleDaily *DailyRetentionFormat `json:"retentionScheduleDaily,omitempty"` - RetentionScheduleWeekly *WeeklyRetentionFormat `json:"retentionScheduleWeekly,omitempty"` - RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` - RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// BackupItemType enumerates the values for backup item type. +type BackupItemType string + +const ( + // AzureSQLDb specifies the azure sql db state for backup item type. + AzureSQLDb BackupItemType = "AzureSqlDb" + // Client specifies the client state for backup item type. + Client BackupItemType = "Client" + // Exchange specifies the exchange state for backup item type. + Exchange BackupItemType = "Exchange" + // FileFolder specifies the file folder state for backup item type. + FileFolder BackupItemType = "FileFolder" + // GenericDataSource specifies the generic data source state for backup + // item type. + GenericDataSource BackupItemType = "GenericDataSource" + // Invalid specifies the invalid state for backup item type. + Invalid BackupItemType = "Invalid" + // Sharepoint specifies the sharepoint state for backup item type. + Sharepoint BackupItemType = "Sharepoint" + // SQLDB specifies the sqldb state for backup item type. + SQLDB BackupItemType = "SQLDB" + // SystemState specifies the system state state for backup item type. + SystemState BackupItemType = "SystemState" + // VM specifies the vm state for backup item type. + VM BackupItemType = "VM" + // VMwareVM specifies the v mware vm state for backup item type. + VMwareVM BackupItemType = "VMwareVM" +) + +// BackupManagementType enumerates the values for backup management type. +type BackupManagementType string + +const ( + // BackupManagementTypeAzureBackupServer specifies the backup management + // type azure backup server state for backup management type. + BackupManagementTypeAzureBackupServer BackupManagementType = "AzureBackupServer" + // BackupManagementTypeAzureIaasVM specifies the backup management type + // azure iaas vm state for backup management type. + BackupManagementTypeAzureIaasVM BackupManagementType = "AzureIaasVM" + // BackupManagementTypeAzureSQL specifies the backup management type azure + // sql state for backup management type. + BackupManagementTypeAzureSQL BackupManagementType = "AzureSql" + // BackupManagementTypeDPM specifies the backup management type dpm state + // for backup management type. + BackupManagementTypeDPM BackupManagementType = "DPM" + // BackupManagementTypeInvalid specifies the backup management type invalid + // state for backup management type. + BackupManagementTypeInvalid BackupManagementType = "Invalid" + // BackupManagementTypeMAB specifies the backup management type mab state + // for backup management type. + BackupManagementTypeMAB BackupManagementType = "MAB" +) + +// ContainerType enumerates the values for container type. +type ContainerType string + +const ( + // ContainerTypeAzureBackupServerContainer specifies the container type + // azure backup server container state for container type. + ContainerTypeAzureBackupServerContainer ContainerType = "AzureBackupServerContainer" + // ContainerTypeAzureSQLContainer specifies the container type azure sql + // container state for container type. + ContainerTypeAzureSQLContainer ContainerType = "AzureSqlContainer" + // ContainerTypeCluster specifies the container type cluster state for + // container type. + ContainerTypeCluster ContainerType = "Cluster" + // ContainerTypeDPMContainer specifies the container type dpm container + // state for container type. + ContainerTypeDPMContainer ContainerType = "DPMContainer" + // ContainerTypeIaasVMContainer specifies the container type iaas vm + // container state for container type. + ContainerTypeIaasVMContainer ContainerType = "IaasVMContainer" + // ContainerTypeIaasVMServiceContainer specifies the container type iaas vm + // service container state for container type. + ContainerTypeIaasVMServiceContainer ContainerType = "IaasVMServiceContainer" + // ContainerTypeInvalid specifies the container type invalid state for + // container type. + ContainerTypeInvalid ContainerType = "Invalid" + // ContainerTypeMABContainer specifies the container type mab container + // state for container type. + ContainerTypeMABContainer ContainerType = "MABContainer" + // ContainerTypeUnknown specifies the container type unknown state for + // container type. + ContainerTypeUnknown ContainerType = "Unknown" + // ContainerTypeVCenter specifies the container type v center state for + // container type. + ContainerTypeVCenter ContainerType = "VCenter" + // ContainerTypeWindows specifies the container type windows state for + // container type. + ContainerTypeWindows ContainerType = "Windows" +) + +// DataSourceType enumerates the values for data source type. +type DataSourceType string + +const ( + // DataSourceTypeAzureSQLDb specifies the data source type azure sql db + // state for data source type. + DataSourceTypeAzureSQLDb DataSourceType = "AzureSqlDb" + // DataSourceTypeClient specifies the data source type client state for + // data source type. + DataSourceTypeClient DataSourceType = "Client" + // DataSourceTypeExchange specifies the data source type exchange state for + // data source type. + DataSourceTypeExchange DataSourceType = "Exchange" + // DataSourceTypeFileFolder specifies the data source type file folder + // state for data source type. + DataSourceTypeFileFolder DataSourceType = "FileFolder" + // DataSourceTypeGenericDataSource specifies the data source type generic + // data source state for data source type. + DataSourceTypeGenericDataSource DataSourceType = "GenericDataSource" + // DataSourceTypeInvalid specifies the data source type invalid state for + // data source type. + DataSourceTypeInvalid DataSourceType = "Invalid" + // DataSourceTypeSharepoint specifies the data source type sharepoint state + // for data source type. + DataSourceTypeSharepoint DataSourceType = "Sharepoint" + // DataSourceTypeSQLDB specifies the data source type sqldb state for data + // source type. + DataSourceTypeSQLDB DataSourceType = "SQLDB" + // DataSourceTypeSystemState specifies the data source type system state + // state for data source type. + DataSourceTypeSystemState DataSourceType = "SystemState" + // DataSourceTypeVM specifies the data source type vm state for data source + // type. + DataSourceTypeVM DataSourceType = "VM" + // DataSourceTypeVMwareVM specifies the data source type v mware vm state + // for data source type. + DataSourceTypeVMwareVM DataSourceType = "VMwareVM" +) + +// DayOfWeek enumerates the values for day of week. +type DayOfWeek string + +const ( + // Friday specifies the friday state for day of week. + Friday DayOfWeek = "Friday" + // Monday specifies the monday state for day of week. + Monday DayOfWeek = "Monday" + // Saturday specifies the saturday state for day of week. + Saturday DayOfWeek = "Saturday" + // Sunday specifies the sunday state for day of week. + Sunday DayOfWeek = "Sunday" + // Thursday specifies the thursday state for day of week. + Thursday DayOfWeek = "Thursday" + // Tuesday specifies the tuesday state for day of week. + Tuesday DayOfWeek = "Tuesday" + // Wednesday specifies the wednesday state for day of week. + Wednesday DayOfWeek = "Wednesday" +) + +// EnhancedSecurityState enumerates the values for enhanced security state. +type EnhancedSecurityState string + +const ( + // EnhancedSecurityStateDisabled specifies the enhanced security state + // disabled state for enhanced security state. + EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" + // EnhancedSecurityStateEnabled specifies the enhanced security state + // enabled state for enhanced security state. + EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" + // EnhancedSecurityStateInvalid specifies the enhanced security state + // invalid state for enhanced security state. + EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" +) + +// HealthState enumerates the values for health state. +type HealthState string + +const ( + // HealthStateActionRequired specifies the health state action required + // state for health state. + HealthStateActionRequired HealthState = "ActionRequired" + // HealthStateActionSuggested specifies the health state action suggested + // state for health state. + HealthStateActionSuggested HealthState = "ActionSuggested" + // HealthStateInvalid specifies the health state invalid state for health + // state. + HealthStateInvalid HealthState = "Invalid" + // HealthStatePassed specifies the health state passed state for health + // state. + HealthStatePassed HealthState = "Passed" +) + +// HealthStatus enumerates the values for health status. +type HealthStatus string + +const ( + // HealthStatusActionRequired specifies the health status action required + // state for health status. + HealthStatusActionRequired HealthStatus = "ActionRequired" + // HealthStatusActionSuggested specifies the health status action suggested + // state for health status. + HealthStatusActionSuggested HealthStatus = "ActionSuggested" + // HealthStatusInvalid specifies the health status invalid state for health + // status. + HealthStatusInvalid HealthStatus = "Invalid" + // HealthStatusPassed specifies the health status passed state for health + // status. + HealthStatusPassed HealthStatus = "Passed" +) + +// HTTPStatusCode enumerates the values for http status code. +type HTTPStatusCode string + +const ( + // Accepted specifies the accepted state for http status code. + Accepted HTTPStatusCode = "Accepted" + // Ambiguous specifies the ambiguous state for http status code. + Ambiguous HTTPStatusCode = "Ambiguous" + // BadGateway specifies the bad gateway state for http status code. + BadGateway HTTPStatusCode = "BadGateway" + // BadRequest specifies the bad request state for http status code. + BadRequest HTTPStatusCode = "BadRequest" + // Conflict specifies the conflict state for http status code. + Conflict HTTPStatusCode = "Conflict" + // Continue specifies the continue state for http status code. + Continue HTTPStatusCode = "Continue" + // Created specifies the created state for http status code. + Created HTTPStatusCode = "Created" + // ExpectationFailed specifies the expectation failed state for http status + // code. + ExpectationFailed HTTPStatusCode = "ExpectationFailed" + // Forbidden specifies the forbidden state for http status code. + Forbidden HTTPStatusCode = "Forbidden" + // Found specifies the found state for http status code. + Found HTTPStatusCode = "Found" + // GatewayTimeout specifies the gateway timeout state for http status code. + GatewayTimeout HTTPStatusCode = "GatewayTimeout" + // Gone specifies the gone state for http status code. + Gone HTTPStatusCode = "Gone" + // HTTPVersionNotSupported specifies the http version not supported state + // for http status code. + HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported" + // InternalServerError specifies the internal server error state for http + // status code. + InternalServerError HTTPStatusCode = "InternalServerError" + // LengthRequired specifies the length required state for http status code. + LengthRequired HTTPStatusCode = "LengthRequired" + // MethodNotAllowed specifies the method not allowed state for http status + // code. + MethodNotAllowed HTTPStatusCode = "MethodNotAllowed" + // Moved specifies the moved state for http status code. + Moved HTTPStatusCode = "Moved" + // MovedPermanently specifies the moved permanently state for http status + // code. + MovedPermanently HTTPStatusCode = "MovedPermanently" + // MultipleChoices specifies the multiple choices state for http status + // code. + MultipleChoices HTTPStatusCode = "MultipleChoices" + // NoContent specifies the no content state for http status code. + NoContent HTTPStatusCode = "NoContent" + // NonAuthoritativeInformation specifies the non authoritative information + // state for http status code. + NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation" + // NotAcceptable specifies the not acceptable state for http status code. + NotAcceptable HTTPStatusCode = "NotAcceptable" + // NotFound specifies the not found state for http status code. + NotFound HTTPStatusCode = "NotFound" + // NotImplemented specifies the not implemented state for http status code. + NotImplemented HTTPStatusCode = "NotImplemented" + // NotModified specifies the not modified state for http status code. + NotModified HTTPStatusCode = "NotModified" + // OK specifies the ok state for http status code. + OK HTTPStatusCode = "OK" + // PartialContent specifies the partial content state for http status code. + PartialContent HTTPStatusCode = "PartialContent" + // PaymentRequired specifies the payment required state for http status + // code. + PaymentRequired HTTPStatusCode = "PaymentRequired" + // PreconditionFailed specifies the precondition failed state for http + // status code. + PreconditionFailed HTTPStatusCode = "PreconditionFailed" + // ProxyAuthenticationRequired specifies the proxy authentication required + // state for http status code. + ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired" + // Redirect specifies the redirect state for http status code. + Redirect HTTPStatusCode = "Redirect" + // RedirectKeepVerb specifies the redirect keep verb state for http status + // code. + RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb" + // RedirectMethod specifies the redirect method state for http status code. + RedirectMethod HTTPStatusCode = "RedirectMethod" + // RequestedRangeNotSatisfiable specifies the requested range not + // satisfiable state for http status code. + RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable" + // RequestEntityTooLarge specifies the request entity too large state for + // http status code. + RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge" + // RequestTimeout specifies the request timeout state for http status code. + RequestTimeout HTTPStatusCode = "RequestTimeout" + // RequestURITooLong specifies the request uri too long state for http + // status code. + RequestURITooLong HTTPStatusCode = "RequestUriTooLong" + // ResetContent specifies the reset content state for http status code. + ResetContent HTTPStatusCode = "ResetContent" + // SeeOther specifies the see other state for http status code. + SeeOther HTTPStatusCode = "SeeOther" + // ServiceUnavailable specifies the service unavailable state for http + // status code. + ServiceUnavailable HTTPStatusCode = "ServiceUnavailable" + // SwitchingProtocols specifies the switching protocols state for http + // status code. + SwitchingProtocols HTTPStatusCode = "SwitchingProtocols" + // TemporaryRedirect specifies the temporary redirect state for http status + // code. + TemporaryRedirect HTTPStatusCode = "TemporaryRedirect" + // Unauthorized specifies the unauthorized state for http status code. + Unauthorized HTTPStatusCode = "Unauthorized" + // UnsupportedMediaType specifies the unsupported media type state for http + // status code. + UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType" + // Unused specifies the unused state for http status code. + Unused HTTPStatusCode = "Unused" + // UpgradeRequired specifies the upgrade required state for http status + // code. + UpgradeRequired HTTPStatusCode = "UpgradeRequired" + // UseProxy specifies the use proxy state for http status code. + UseProxy HTTPStatusCode = "UseProxy" +) + +// JobOperationType enumerates the values for job operation type. +type JobOperationType string + +const ( + // JobOperationTypeBackup specifies the job operation type backup state for + // job operation type. + JobOperationTypeBackup JobOperationType = "Backup" + // JobOperationTypeConfigureBackup specifies the job operation type + // configure backup state for job operation type. + JobOperationTypeConfigureBackup JobOperationType = "ConfigureBackup" + // JobOperationTypeDeleteBackupData specifies the job operation type delete + // backup data state for job operation type. + JobOperationTypeDeleteBackupData JobOperationType = "DeleteBackupData" + // JobOperationTypeDisableBackup specifies the job operation type disable + // backup state for job operation type. + JobOperationTypeDisableBackup JobOperationType = "DisableBackup" + // JobOperationTypeInvalid specifies the job operation type invalid state + // for job operation type. + JobOperationTypeInvalid JobOperationType = "Invalid" + // JobOperationTypeRegister specifies the job operation type register state + // for job operation type. + JobOperationTypeRegister JobOperationType = "Register" + // JobOperationTypeRestore specifies the job operation type restore state + // for job operation type. + JobOperationTypeRestore JobOperationType = "Restore" + // JobOperationTypeUnRegister specifies the job operation type un register + // state for job operation type. + JobOperationTypeUnRegister JobOperationType = "UnRegister" +) + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // JobStatusCancelled specifies the job status cancelled state for job + // status. + JobStatusCancelled JobStatus = "Cancelled" + // JobStatusCancelling specifies the job status cancelling state for job + // status. + JobStatusCancelling JobStatus = "Cancelling" + // JobStatusCompleted specifies the job status completed state for job + // status. + JobStatusCompleted JobStatus = "Completed" + // JobStatusCompletedWithWarnings specifies the job status completed with + // warnings state for job status. + JobStatusCompletedWithWarnings JobStatus = "CompletedWithWarnings" + // JobStatusFailed specifies the job status failed state for job status. + JobStatusFailed JobStatus = "Failed" + // JobStatusInProgress specifies the job status in progress state for job + // status. + JobStatusInProgress JobStatus = "InProgress" + // JobStatusInvalid specifies the job status invalid state for job status. + JobStatusInvalid JobStatus = "Invalid" +) + +// JobSupportedAction enumerates the values for job supported action. +type JobSupportedAction string + +const ( + // JobSupportedActionCancellable specifies the job supported action + // cancellable state for job supported action. + JobSupportedActionCancellable JobSupportedAction = "Cancellable" + // JobSupportedActionInvalid specifies the job supported action invalid + // state for job supported action. + JobSupportedActionInvalid JobSupportedAction = "Invalid" + // JobSupportedActionRetriable specifies the job supported action retriable + // state for job supported action. + JobSupportedActionRetriable JobSupportedAction = "Retriable" +) + +// MabServerType enumerates the values for mab server type. +type MabServerType string + +const ( + // MabServerTypeAzureBackupServerContainer specifies the mab server type + // azure backup server container state for mab server type. + MabServerTypeAzureBackupServerContainer MabServerType = "AzureBackupServerContainer" + // MabServerTypeAzureSQLContainer specifies the mab server type azure sql + // container state for mab server type. + MabServerTypeAzureSQLContainer MabServerType = "AzureSqlContainer" + // MabServerTypeCluster specifies the mab server type cluster state for mab + // server type. + MabServerTypeCluster MabServerType = "Cluster" + // MabServerTypeDPMContainer specifies the mab server type dpm container + // state for mab server type. + MabServerTypeDPMContainer MabServerType = "DPMContainer" + // MabServerTypeIaasVMContainer specifies the mab server type iaas vm + // container state for mab server type. + MabServerTypeIaasVMContainer MabServerType = "IaasVMContainer" + // MabServerTypeIaasVMServiceContainer specifies the mab server type iaas + // vm service container state for mab server type. + MabServerTypeIaasVMServiceContainer MabServerType = "IaasVMServiceContainer" + // MabServerTypeInvalid specifies the mab server type invalid state for mab + // server type. + MabServerTypeInvalid MabServerType = "Invalid" + // MabServerTypeMABContainer specifies the mab server type mab container + // state for mab server type. + MabServerTypeMABContainer MabServerType = "MABContainer" + // MabServerTypeUnknown specifies the mab server type unknown state for mab + // server type. + MabServerTypeUnknown MabServerType = "Unknown" + // MabServerTypeVCenter specifies the mab server type v center state for + // mab server type. + MabServerTypeVCenter MabServerType = "VCenter" + // MabServerTypeWindows specifies the mab server type windows state for mab + // server type. + MabServerTypeWindows MabServerType = "Windows" +) + +// MonthOfYear enumerates the values for month of year. +type MonthOfYear string + +const ( + // MonthOfYearApril specifies the month of year april state for month of + // year. + MonthOfYearApril MonthOfYear = "April" + // MonthOfYearAugust specifies the month of year august state for month of + // year. + MonthOfYearAugust MonthOfYear = "August" + // MonthOfYearDecember specifies the month of year december state for month + // of year. + MonthOfYearDecember MonthOfYear = "December" + // MonthOfYearFebruary specifies the month of year february state for month + // of year. + MonthOfYearFebruary MonthOfYear = "February" + // MonthOfYearInvalid specifies the month of year invalid state for month + // of year. + MonthOfYearInvalid MonthOfYear = "Invalid" + // MonthOfYearJanuary specifies the month of year january state for month + // of year. + MonthOfYearJanuary MonthOfYear = "January" + // MonthOfYearJuly specifies the month of year july state for month of + // year. + MonthOfYearJuly MonthOfYear = "July" + // MonthOfYearJune specifies the month of year june state for month of + // year. + MonthOfYearJune MonthOfYear = "June" + // MonthOfYearMarch specifies the month of year march state for month of + // year. + MonthOfYearMarch MonthOfYear = "March" + // MonthOfYearMay specifies the month of year may state for month of year. + MonthOfYearMay MonthOfYear = "May" + // MonthOfYearNovember specifies the month of year november state for month + // of year. + MonthOfYearNovember MonthOfYear = "November" + // MonthOfYearOctober specifies the month of year october state for month + // of year. + MonthOfYearOctober MonthOfYear = "October" + // MonthOfYearSeptember specifies the month of year september state for + // month of year. + MonthOfYearSeptember MonthOfYear = "September" +) + +// OperationStatusValues enumerates the values for operation status values. +type OperationStatusValues string + +const ( + // OperationStatusValuesCanceled specifies the operation status values + // canceled state for operation status values. + OperationStatusValuesCanceled OperationStatusValues = "Canceled" + // OperationStatusValuesFailed specifies the operation status values failed + // state for operation status values. + OperationStatusValuesFailed OperationStatusValues = "Failed" + // OperationStatusValuesInProgress specifies the operation status values in + // progress state for operation status values. + OperationStatusValuesInProgress OperationStatusValues = "InProgress" + // OperationStatusValuesInvalid specifies the operation status values + // invalid state for operation status values. + OperationStatusValuesInvalid OperationStatusValues = "Invalid" + // OperationStatusValuesSucceeded specifies the operation status values + // succeeded state for operation status values. + OperationStatusValuesSucceeded OperationStatusValues = "Succeeded" +) + +// ProtectedItemState enumerates the values for protected item state. +type ProtectedItemState string + +const ( + // ProtectedItemStateInvalid specifies the protected item state invalid + // state for protected item state. + ProtectedItemStateInvalid ProtectedItemState = "Invalid" + // ProtectedItemStateIRPending specifies the protected item state ir + // pending state for protected item state. + ProtectedItemStateIRPending ProtectedItemState = "IRPending" + // ProtectedItemStateProtected specifies the protected item state protected + // state for protected item state. + ProtectedItemStateProtected ProtectedItemState = "Protected" + // ProtectedItemStateProtectionError specifies the protected item state + // protection error state for protected item state. + ProtectedItemStateProtectionError ProtectedItemState = "ProtectionError" + // ProtectedItemStateProtectionPaused specifies the protected item state + // protection paused state for protected item state. + ProtectedItemStateProtectionPaused ProtectedItemState = "ProtectionPaused" + // ProtectedItemStateProtectionStopped specifies the protected item state + // protection stopped state for protected item state. + ProtectedItemStateProtectionStopped ProtectedItemState = "ProtectionStopped" +) + +// ProtectionState enumerates the values for protection state. +type ProtectionState string + +const ( + // ProtectionStateInvalid specifies the protection state invalid state for + // protection state. + ProtectionStateInvalid ProtectionState = "Invalid" + // ProtectionStateIRPending specifies the protection state ir pending state + // for protection state. + ProtectionStateIRPending ProtectionState = "IRPending" + // ProtectionStateProtected specifies the protection state protected state + // for protection state. + ProtectionStateProtected ProtectionState = "Protected" + // ProtectionStateProtectionError specifies the protection state protection + // error state for protection state. + ProtectionStateProtectionError ProtectionState = "ProtectionError" + // ProtectionStateProtectionPaused specifies the protection state + // protection paused state for protection state. + ProtectionStateProtectionPaused ProtectionState = "ProtectionPaused" + // ProtectionStateProtectionStopped specifies the protection state + // protection stopped state for protection state. + ProtectionStateProtectionStopped ProtectionState = "ProtectionStopped" +) + +// ProtectionStatus enumerates the values for protection status. +type ProtectionStatus string + +const ( + // ProtectionStatusInvalid specifies the protection status invalid state + // for protection status. + ProtectionStatusInvalid ProtectionStatus = "Invalid" + // ProtectionStatusNotProtected specifies the protection status not + // protected state for protection status. + ProtectionStatusNotProtected ProtectionStatus = "NotProtected" + // ProtectionStatusProtected specifies the protection status protected + // state for protection status. + ProtectionStatusProtected ProtectionStatus = "Protected" + // ProtectionStatusProtecting specifies the protection status protecting + // state for protection status. + ProtectionStatusProtecting ProtectionStatus = "Protecting" +) + +// RecoveryPointTierStatus enumerates the values for recovery point tier +// status. +type RecoveryPointTierStatus string + +const ( + // RecoveryPointTierStatusDeleted specifies the recovery point tier status + // deleted state for recovery point tier status. + RecoveryPointTierStatusDeleted RecoveryPointTierStatus = "Deleted" + // RecoveryPointTierStatusDisabled specifies the recovery point tier status + // disabled state for recovery point tier status. + RecoveryPointTierStatusDisabled RecoveryPointTierStatus = "Disabled" + // RecoveryPointTierStatusInvalid specifies the recovery point tier status + // invalid state for recovery point tier status. + RecoveryPointTierStatusInvalid RecoveryPointTierStatus = "Invalid" + // RecoveryPointTierStatusValid specifies the recovery point tier status + // valid state for recovery point tier status. + RecoveryPointTierStatusValid RecoveryPointTierStatus = "Valid" +) + +// RecoveryPointTierType enumerates the values for recovery point tier type. +type RecoveryPointTierType string + +const ( + // RecoveryPointTierTypeHardenedRP specifies the recovery point tier type + // hardened rp state for recovery point tier type. + RecoveryPointTierTypeHardenedRP RecoveryPointTierType = "HardenedRP" + // RecoveryPointTierTypeInstantRP specifies the recovery point tier type + // instant rp state for recovery point tier type. + RecoveryPointTierTypeInstantRP RecoveryPointTierType = "InstantRP" + // RecoveryPointTierTypeInvalid specifies the recovery point tier type + // invalid state for recovery point tier type. + RecoveryPointTierTypeInvalid RecoveryPointTierType = "Invalid" +) + +// RecoveryType enumerates the values for recovery type. +type RecoveryType string + +const ( + // RecoveryTypeAlternateLocation specifies the recovery type alternate + // location state for recovery type. + RecoveryTypeAlternateLocation RecoveryType = "AlternateLocation" + // RecoveryTypeInvalid specifies the recovery type invalid state for + // recovery type. + RecoveryTypeInvalid RecoveryType = "Invalid" + // RecoveryTypeOriginalLocation specifies the recovery type original + // location state for recovery type. + RecoveryTypeOriginalLocation RecoveryType = "OriginalLocation" + // RecoveryTypeRestoreDisks specifies the recovery type restore disks state + // for recovery type. + RecoveryTypeRestoreDisks RecoveryType = "RestoreDisks" +) + +// RetentionDurationType enumerates the values for retention duration type. +type RetentionDurationType string + +const ( + // RetentionDurationTypeDays specifies the retention duration type days + // state for retention duration type. + RetentionDurationTypeDays RetentionDurationType = "Days" + // RetentionDurationTypeInvalid specifies the retention duration type + // invalid state for retention duration type. + RetentionDurationTypeInvalid RetentionDurationType = "Invalid" + // RetentionDurationTypeMonths specifies the retention duration type months + // state for retention duration type. + RetentionDurationTypeMonths RetentionDurationType = "Months" + // RetentionDurationTypeWeeks specifies the retention duration type weeks + // state for retention duration type. + RetentionDurationTypeWeeks RetentionDurationType = "Weeks" + // RetentionDurationTypeYears specifies the retention duration type years + // state for retention duration type. + RetentionDurationTypeYears RetentionDurationType = "Years" +) + +// RetentionScheduleFormat enumerates the values for retention schedule format. +type RetentionScheduleFormat string + +const ( + // RetentionScheduleFormatDaily specifies the retention schedule format + // daily state for retention schedule format. + RetentionScheduleFormatDaily RetentionScheduleFormat = "Daily" + // RetentionScheduleFormatInvalid specifies the retention schedule format + // invalid state for retention schedule format. + RetentionScheduleFormatInvalid RetentionScheduleFormat = "Invalid" + // RetentionScheduleFormatWeekly specifies the retention schedule format + // weekly state for retention schedule format. + RetentionScheduleFormatWeekly RetentionScheduleFormat = "Weekly" +) + +// ScheduleRunType enumerates the values for schedule run type. +type ScheduleRunType string + +const ( + // ScheduleRunTypeDaily specifies the schedule run type daily state for + // schedule run type. + ScheduleRunTypeDaily ScheduleRunType = "Daily" + // ScheduleRunTypeInvalid specifies the schedule run type invalid state for + // schedule run type. + ScheduleRunTypeInvalid ScheduleRunType = "Invalid" + // ScheduleRunTypeWeekly specifies the schedule run type weekly state for + // schedule run type. + ScheduleRunTypeWeekly ScheduleRunType = "Weekly" +) + +// StorageType enumerates the values for storage type. +type StorageType string + +const ( + // StorageTypeGeoRedundant specifies the storage type geo redundant state + // for storage type. + StorageTypeGeoRedundant StorageType = "GeoRedundant" + // StorageTypeInvalid specifies the storage type invalid state for storage + // type. + StorageTypeInvalid StorageType = "Invalid" + // StorageTypeLocallyRedundant specifies the storage type locally redundant + // state for storage type. + StorageTypeLocallyRedundant StorageType = "LocallyRedundant" +) + +// StorageTypeState enumerates the values for storage type state. +type StorageTypeState string + +const ( + // StorageTypeStateInvalid specifies the storage type state invalid state + // for storage type state. + StorageTypeStateInvalid StorageTypeState = "Invalid" + // StorageTypeStateLocked specifies the storage type state locked state for + // storage type state. + StorageTypeStateLocked StorageTypeState = "Locked" + // StorageTypeStateUnlocked specifies the storage type state unlocked state + // for storage type state. + StorageTypeStateUnlocked StorageTypeState = "Unlocked" +) + +// Type enumerates the values for type. +type Type string + +const ( + // TypeBackupProtectedItemCountSummary specifies the type backup protected + // item count summary state for type. + TypeBackupProtectedItemCountSummary Type = "BackupProtectedItemCountSummary" + // TypeBackupProtectionContainerCountSummary specifies the type backup + // protection container count summary state for type. + TypeBackupProtectionContainerCountSummary Type = "BackupProtectionContainerCountSummary" + // TypeInvalid specifies the type invalid state for type. + TypeInvalid Type = "Invalid" +) + +// UsagesUnit enumerates the values for usages unit. +type UsagesUnit string + +const ( + // Bytes specifies the bytes state for usages unit. + Bytes UsagesUnit = "Bytes" + // BytesPerSecond specifies the bytes per second state for usages unit. + BytesPerSecond UsagesUnit = "BytesPerSecond" + // Count specifies the count state for usages unit. + Count UsagesUnit = "Count" + // CountPerSecond specifies the count per second state for usages unit. + CountPerSecond UsagesUnit = "CountPerSecond" + // Percent specifies the percent state for usages unit. + Percent UsagesUnit = "Percent" + // Seconds specifies the seconds state for usages unit. + Seconds UsagesUnit = "Seconds" +) + +// WeekOfMonth enumerates the values for week of month. +type WeekOfMonth string + +const ( + // First specifies the first state for week of month. + First WeekOfMonth = "First" + // Fourth specifies the fourth state for week of month. + Fourth WeekOfMonth = "Fourth" + // Last specifies the last state for week of month. + Last WeekOfMonth = "Last" + // Second specifies the second state for week of month. + Second WeekOfMonth = "Second" + // Third specifies the third state for week of month. + Third WeekOfMonth = "Third" +) + +// WorkloadType enumerates the values for workload type. +type WorkloadType string + +const ( + // WorkloadTypeAzureSQLDb specifies the workload type azure sql db state + // for workload type. + WorkloadTypeAzureSQLDb WorkloadType = "AzureSqlDb" + // WorkloadTypeClient specifies the workload type client state for workload + // type. + WorkloadTypeClient WorkloadType = "Client" + // WorkloadTypeExchange specifies the workload type exchange state for + // workload type. + WorkloadTypeExchange WorkloadType = "Exchange" + // WorkloadTypeFileFolder specifies the workload type file folder state for + // workload type. + WorkloadTypeFileFolder WorkloadType = "FileFolder" + // WorkloadTypeGenericDataSource specifies the workload type generic data + // source state for workload type. + WorkloadTypeGenericDataSource WorkloadType = "GenericDataSource" + // WorkloadTypeInvalid specifies the workload type invalid state for + // workload type. + WorkloadTypeInvalid WorkloadType = "Invalid" + // WorkloadTypeSharepoint specifies the workload type sharepoint state for + // workload type. + WorkloadTypeSharepoint WorkloadType = "Sharepoint" + // WorkloadTypeSQLDB specifies the workload type sqldb state for workload + // type. + WorkloadTypeSQLDB WorkloadType = "SQLDB" + // WorkloadTypeSystemState specifies the workload type system state state + // for workload type. + WorkloadTypeSystemState WorkloadType = "SystemState" + // WorkloadTypeVM specifies the workload type vm state for workload type. + WorkloadTypeVM WorkloadType = "VM" + // WorkloadTypeVMwareVM specifies the workload type v mware vm state for + // workload type. + WorkloadTypeVMwareVM WorkloadType = "VMwareVM" +) + +// AzureBackupServerContainer is azureBackupServer (DPMVenus) workload-specific +// protection container. +type AzureBackupServerContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + CanReRegister *bool `json:"canReRegister,omitempty"` + ContainerID *string `json:"containerId,omitempty"` + ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` + DpmAgentVersion *string `json:"dpmAgentVersion,omitempty"` + DPMServers *[]string `json:"DPMServers,omitempty"` + UpgradeAvailable *bool `json:"UpgradeAvailable,omitempty"` + ProtectionStatus *string `json:"protectionStatus,omitempty"` + ExtendedInfo *DPMContainerExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureBackupServerEngine is backup engine type when Azure Backup Server is +// used to manage the backups. +type AzureBackupServerEngine struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + BackupEngineState *string `json:"backupEngineState,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + CanReRegister *bool `json:"canReRegister,omitempty"` + BackupEngineID *string `json:"backupEngineId,omitempty"` + DpmVersion *string `json:"dpmVersion,omitempty"` + AzureBackupAgentVersion *string `json:"azureBackupAgentVersion,omitempty"` + IsAzureBackupAgentUpgradeAvailable *bool `json:"isAzureBackupAgentUpgradeAvailable,omitempty"` + IsDPMUpgradeAvailable *bool `json:"isDPMUpgradeAvailable,omitempty"` + ExtendedInfo *BackupEngineExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureIaaSClassicComputeVMContainer is iaaS VM workload-specific backup item +// representing a classic virtual machine. +type AzureIaaSClassicComputeVMContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// AzureIaaSClassicComputeVMProtectableItem is iaaS VM workload-specific backup +// item representing the Classic Compute VM. +type AzureIaaSClassicComputeVMProtectableItem struct { + BackupManagementType *string `json:"backupManagementType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ProtectionState ProtectionStatus `json:"protectionState,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` +} + +// AzureIaaSClassicComputeVMProtectedItem is iaaS VM workload-specific backup +// item representing the Classic Compute VM. +type AzureIaaSClassicComputeVMProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + ProtectionStatus *string `json:"protectionStatus,omitempty"` + ProtectionState ProtectionState `json:"protectionState,omitempty"` + HealthStatus HealthStatus `json:"healthStatus,omitempty"` + HealthDetails *[]AzureIaaSVMHealthDetails `json:"healthDetails,omitempty"` + LastBackupStatus *string `json:"lastBackupStatus,omitempty"` + LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` + ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` + ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureIaaSComputeVMContainer is iaaS VM workload-specific backup item +// representing an Azure Resource Manager virtual machine. +type AzureIaaSComputeVMContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// AzureIaaSComputeVMProtectableItem is iaaS VM workload-specific backup item +// representing the Azure Resource Manager VM. +type AzureIaaSComputeVMProtectableItem struct { + BackupManagementType *string `json:"backupManagementType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ProtectionState ProtectionStatus `json:"protectionState,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` +} + +// AzureIaaSComputeVMProtectedItem is iaaS VM workload-specific backup item +// representing the Azure Resource Manager VM. +type AzureIaaSComputeVMProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + ProtectionStatus *string `json:"protectionStatus,omitempty"` + ProtectionState ProtectionState `json:"protectionState,omitempty"` + HealthStatus HealthStatus `json:"healthStatus,omitempty"` + HealthDetails *[]AzureIaaSVMHealthDetails `json:"healthDetails,omitempty"` + LastBackupStatus *string `json:"lastBackupStatus,omitempty"` + LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` + ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` + ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureIaaSVMErrorInfo is azure IaaS VM workload-specific error information. +type AzureIaaSVMErrorInfo struct { + ErrorCode *int32 `json:"errorCode,omitempty"` + ErrorTitle *string `json:"errorTitle,omitempty"` + ErrorString *string `json:"errorString,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` +} + +// AzureIaaSVMHealthDetails is azure IaaS VM workload-specific Health Details. +type AzureIaaSVMHealthDetails struct { + Code *int32 `json:"code,omitempty"` + Title *string `json:"title,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` +} + +// AzureIaaSVMJob is azure IaaS VM workload-specifc job object. +type AzureIaaSVMJob struct { + EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + Operation *string `json:"operation,omitempty"` + Status *string `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ActivityID *string `json:"activityId,omitempty"` + Duration *string `json:"duration,omitempty"` + ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` + ErrorDetails *[]AzureIaaSVMErrorInfo `json:"errorDetails,omitempty"` + VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` + ExtendedInfo *AzureIaaSVMJobExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureIaaSVMJobExtendedInfo is azure IaaS VM workload-specific additional +// information for job. +type AzureIaaSVMJobExtendedInfo struct { + TasksList *[]AzureIaaSVMJobTaskDetails `json:"tasksList,omitempty"` + PropertyBag *map[string]*string `json:"propertyBag,omitempty"` + ProgressPercentage *float64 `json:"progressPercentage,omitempty"` + DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` +} + +// AzureIaaSVMJobTaskDetails is azure IaaS VM workload-specific job task +// details. +type AzureIaaSVMJobTaskDetails struct { + TaskID *string `json:"taskId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + InstanceID *string `json:"instanceId,omitempty"` + Duration *string `json:"duration,omitempty"` + Status *string `json:"status,omitempty"` + ProgressPercentage *float64 `json:"progressPercentage,omitempty"` +} + +// AzureIaaSVMProtectedItem is iaaS VM workload-specific backup item. +type AzureIaaSVMProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + ProtectionStatus *string `json:"protectionStatus,omitempty"` + ProtectionState ProtectionState `json:"protectionState,omitempty"` + HealthStatus HealthStatus `json:"healthStatus,omitempty"` + HealthDetails *[]AzureIaaSVMHealthDetails `json:"healthDetails,omitempty"` + LastBackupStatus *string `json:"lastBackupStatus,omitempty"` + LastBackupTime *date.Time `json:"lastBackupTime,omitempty"` + ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` + ExtendedInfo *AzureIaaSVMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureIaaSVMProtectedItemExtendedInfo is additional information on Azure IaaS +// VM specific backup item. +type AzureIaaSVMProtectedItemExtendedInfo struct { + OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` + RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` + PolicyInconsistent *bool `json:"policyInconsistent,omitempty"` +} + +// AzureIaaSVMProtectionPolicy is iaaS VM workload-specific backup policy. +type AzureIaaSVMProtectionPolicy struct { + ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` + SchedulePolicy *SchedulePolicy `json:"schedulePolicy,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} + +// AzureSQLContainer is azure Sql workload-specific container. +type AzureSQLContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` +} + +// AzureSQLProtectedItem is azure SQL workload-specific backup item. +type AzureSQLProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` + ProtectedItemDataID *string `json:"protectedItemDataId,omitempty"` + ProtectionState ProtectedItemState `json:"protectionState,omitempty"` + ExtendedInfo *AzureSQLProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` +} + +// AzureSQLProtectedItemExtendedInfo is additional information on Azure Sql +// specific protected item. +type AzureSQLProtectedItemExtendedInfo struct { + OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` + RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` + PolicyState *string `json:"policyState,omitempty"` +} + +// AzureSQLProtectionPolicy is azure SQL workload-specific backup policy. +type AzureSQLProtectionPolicy struct { + ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// BackupEngineBase is the base backup engine class. All workload specific +// backup engines derive from this class. +type BackupEngineBase struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + BackupEngineState *string `json:"backupEngineState,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + CanReRegister *bool `json:"canReRegister,omitempty"` + BackupEngineID *string `json:"backupEngineId,omitempty"` + DpmVersion *string `json:"dpmVersion,omitempty"` + AzureBackupAgentVersion *string `json:"azureBackupAgentVersion,omitempty"` + IsAzureBackupAgentUpgradeAvailable *bool `json:"isAzureBackupAgentUpgradeAvailable,omitempty"` + IsDPMUpgradeAvailable *bool `json:"isDPMUpgradeAvailable,omitempty"` + ExtendedInfo *BackupEngineExtendedInfo `json:"extendedInfo,omitempty"` +} + +// BackupEngineBaseResource is the base backup engine class. All workload +// specific backup engines derive from this class. +type BackupEngineBaseResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *BackupEngineBase `json:"properties,omitempty"` +} + +// BackupEngineBaseResourceList is list of BackupEngineBase resources +type BackupEngineBaseResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]BackupEngineBaseResource `json:"value,omitempty"` +} + +// BackupEngineBaseResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client BackupEngineBaseResourceList) BackupEngineBaseResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// BackupEngineExtendedInfo is additional information on backup engine. +type BackupEngineExtendedInfo struct { + DatabaseName *string `json:"databaseName,omitempty"` + ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` + ProtectedServersCount *int32 `json:"protectedServersCount,omitempty"` + DiskCount *int32 `json:"diskCount,omitempty"` + UsedDiskSpace *float64 `json:"usedDiskSpace,omitempty"` + AvailableDiskSpace *float64 `json:"availableDiskSpace,omitempty"` + RefreshedAt *date.Time `json:"refreshedAt,omitempty"` + AzureProtectedInstances *int32 `json:"azureProtectedInstances,omitempty"` +} + +// BackupManagementUsage is backup management usages of a vault. +type BackupManagementUsage struct { + Unit UsagesUnit `json:"unit,omitempty"` + QuotaPeriod *string `json:"quotaPeriod,omitempty"` + NextResetTime *date.Time `json:"nextResetTime,omitempty"` + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *NameInfo `json:"name,omitempty"` +} + +// BackupManagementUsageList is backup management usage for vault. +type BackupManagementUsageList struct { + autorest.Response `json:"-"` + Value *[]BackupManagementUsage `json:"value,omitempty"` +} + +// BackupRequest is base class for backup request. Workload-specific backup +// requests are derived from this class. +type BackupRequest struct { +} + +// BackupRequestResource is base class for backup request. Workload-specific +// backup requests are derived from this class. +type BackupRequestResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *BackupRequest `json:"properties,omitempty"` +} + +// BackupResourceConfig is the resource storage details. +type BackupResourceConfig struct { + StorageType StorageType `json:"storageType,omitempty"` + StorageTypeState StorageTypeState `json:"storageTypeState,omitempty"` +} + +// BackupResourceConfigResource is the resource storage details. +type BackupResourceConfigResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *BackupResourceConfig `json:"properties,omitempty"` +} + +// BackupResourceVaultConfig is backup resource vault config details. +type BackupResourceVaultConfig struct { + StorageType StorageType `json:"storageType,omitempty"` + StorageTypeState StorageTypeState `json:"storageTypeState,omitempty"` + EnhancedSecurityState EnhancedSecurityState `json:"enhancedSecurityState,omitempty"` +} + +// BackupResourceVaultConfigResource is backup resource vault config details. +type BackupResourceVaultConfigResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *BackupResourceVaultConfig `json:"properties,omitempty"` +} + +// BEKDetails is bEK is bitlocker encrpytion key. +type BEKDetails struct { + SecretURL *string `json:"secretUrl,omitempty"` + SecretVaultID *string `json:"secretVaultId,omitempty"` + SecretData *string `json:"secretData,omitempty"` +} + +// BMSBackupEngineQueryObject is query parameters to fetch list of backup +// engines. +type BMSBackupEngineQueryObject struct { + Expand *string `json:"expand,omitempty"` +} + +// BMSBackupEnginesQueryObject is query parameters to fetch list of backup +// engines. +type BMSBackupEnginesQueryObject struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Expand *string `json:"expand,omitempty"` +} + +// BMSBackupSummariesQueryObject is query parameters to fetch backup summaries. +type BMSBackupSummariesQueryObject struct { + Type Type `json:"type,omitempty"` +} + +// BMSContainerQueryObject is the query filters that can be used with the list +// containers API. +type BMSContainerQueryObject struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + BackupEngineName *string `json:"backupEngineName,omitempty"` + Status *string `json:"status,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// BMSPOQueryObject is filters to list items that can be backed up. +type BMSPOQueryObject struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + Status *string `json:"status,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// BMSRPQueryObject is filters to list backup copies. +type BMSRPQueryObject struct { + StartDate *date.Time `json:"startDate,omitempty"` + EndDate *date.Time `json:"endDate,omitempty"` +} + +// ClientDiscoveryDisplay is localized display information of an operation. +type ClientDiscoveryDisplay struct { + Provider *string `json:"Provider,omitempty"` + Resource *string `json:"Resource,omitempty"` + Operation *string `json:"Operation,omitempty"` + Description *string `json:"Description,omitempty"` +} + +// ClientDiscoveryForLogSpecification is class to represent shoebox log +// specification in json client discovery. +type ClientDiscoveryForLogSpecification struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ClientDiscoveryForProperties is class to represent shoebox properties in +// json client discovery. +type ClientDiscoveryForProperties struct { + ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// ClientDiscoveryForServiceSpecification is class to represent shoebox service +// specification in json client discovery. +type ClientDiscoveryForServiceSpecification struct { + LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` +} + +// ClientDiscoveryResponse is operations List response which contains list of +// available APIs. +type ClientDiscoveryResponse struct { + autorest.Response `json:"-"` + Value *[]ClientDiscoveryValueForSingleAPI `json:"Value,omitempty"` + NextLink *string `json:"NextLink,omitempty"` +} + +// ClientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClientDiscoveryResponse) ClientDiscoveryResponsePreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClientDiscoveryValueForSingleAPI is available operation details. +type ClientDiscoveryValueForSingleAPI struct { + Name *string `json:"Name,omitempty"` + Display *ClientDiscoveryDisplay `json:"Display,omitempty"` + Origin *string `json:"Origin,omitempty"` + Properties *ClientDiscoveryForProperties `json:"Properties,omitempty"` +} + +// ClientScriptForConnect is client script details for file / folder restore. +type ClientScriptForConnect struct { + ScriptContent *string `json:"scriptContent,omitempty"` + ScriptExtension *string `json:"scriptExtension,omitempty"` + OsType *string `json:"osType,omitempty"` + URL *string `json:"url,omitempty"` + ScriptNameSuffix *string `json:"scriptNameSuffix,omitempty"` +} + +// DailyRetentionFormat is daily retention format. +type DailyRetentionFormat struct { + DaysOfTheMonth *[]Day `json:"daysOfTheMonth,omitempty"` +} + +// DailyRetentionSchedule is daily retention schedule. +type DailyRetentionSchedule struct { + RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` + RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` +} + +// Day is day of the week. +type Day struct { + Date *int32 `json:"date,omitempty"` + IsLast *bool `json:"isLast,omitempty"` +} + +// DpmBackupEngine is data Protection Manager (DPM) specific backup engine. +type DpmBackupEngine struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + BackupEngineState *string `json:"backupEngineState,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + CanReRegister *bool `json:"canReRegister,omitempty"` + BackupEngineID *string `json:"backupEngineId,omitempty"` + DpmVersion *string `json:"dpmVersion,omitempty"` + AzureBackupAgentVersion *string `json:"azureBackupAgentVersion,omitempty"` + IsAzureBackupAgentUpgradeAvailable *bool `json:"isAzureBackupAgentUpgradeAvailable,omitempty"` + IsDPMUpgradeAvailable *bool `json:"isDPMUpgradeAvailable,omitempty"` + ExtendedInfo *BackupEngineExtendedInfo `json:"extendedInfo,omitempty"` +} + +// DpmContainer is dPM workload-specific protection container. +type DpmContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + CanReRegister *bool `json:"canReRegister,omitempty"` + ContainerID *string `json:"containerId,omitempty"` + ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` + DpmAgentVersion *string `json:"dpmAgentVersion,omitempty"` + DPMServers *[]string `json:"DPMServers,omitempty"` + UpgradeAvailable *bool `json:"UpgradeAvailable,omitempty"` + ProtectionStatus *string `json:"protectionStatus,omitempty"` + ExtendedInfo *DPMContainerExtendedInfo `json:"extendedInfo,omitempty"` +} + +// DPMContainerExtendedInfo is additional information of the DPMContainer. +type DPMContainerExtendedInfo struct { + LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` +} + +// DpmErrorInfo is dPM workload-specific error information. +type DpmErrorInfo struct { + ErrorString *string `json:"errorString,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` +} + +// DpmJob is dPM workload-specifc job object. +type DpmJob struct { + EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + Operation *string `json:"operation,omitempty"` + Status *string `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ActivityID *string `json:"activityId,omitempty"` + Duration *string `json:"duration,omitempty"` + DpmServerName *string `json:"dpmServerName,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + ContainerType *string `json:"containerType,omitempty"` + WorkloadType *string `json:"workloadType,omitempty"` + ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` + ErrorDetails *[]DpmErrorInfo `json:"errorDetails,omitempty"` + ExtendedInfo *DpmJobExtendedInfo `json:"extendedInfo,omitempty"` +} + +// DpmJobExtendedInfo is additional information on the DPM workload-specific +// job. +type DpmJobExtendedInfo struct { + TasksList *[]DpmJobTaskDetails `json:"tasksList,omitempty"` + PropertyBag *map[string]*string `json:"propertyBag,omitempty"` + DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` +} + +// DpmJobTaskDetails is dPM workload-specific job task details. +type DpmJobTaskDetails struct { + TaskID *string `json:"taskId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Duration *string `json:"duration,omitempty"` + Status *string `json:"status,omitempty"` +} + +// DPMProtectedItem is additional information on Backup engine specific backup +// item. +type DPMProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + BackupEngineName *string `json:"backupEngineName,omitempty"` + ProtectionState ProtectedItemState `json:"protectionState,omitempty"` + IsScheduledForDeferredDelete *bool `json:"isScheduledForDeferredDelete,omitempty"` + ExtendedInfo *DPMProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` +} + +// DPMProtectedItemExtendedInfo is additional information of DPM Protected +// item. +type DPMProtectedItemExtendedInfo struct { + ProtectableObjectLoadPath *map[string]*string `json:"protectableObjectLoadPath,omitempty"` + Protected *bool `json:"protected,omitempty"` + IsPresentOnCloud *bool `json:"isPresentOnCloud,omitempty"` + LastBackupStatus *string `json:"lastBackupStatus,omitempty"` + LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` + OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` + RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` + OnPremiseOldestRecoveryPoint *date.Time `json:"onPremiseOldestRecoveryPoint,omitempty"` + OnPremiseLatestRecoveryPoint *date.Time `json:"onPremiseLatestRecoveryPoint,omitempty"` + OnPremiseRecoveryPointCount *int32 `json:"onPremiseRecoveryPointCount,omitempty"` + IsCollocated *bool `json:"isCollocated,omitempty"` + ProtectionGroupName *string `json:"protectionGroupName,omitempty"` + DiskStorageUsedInBytes *string `json:"diskStorageUsedInBytes,omitempty"` + TotalDiskStorageSizeInBytes *string `json:"totalDiskStorageSizeInBytes,omitempty"` +} + +// EncryptionDetails is details needed if the VM was encrypted at the time of +// backup. +type EncryptionDetails struct { + EncryptionEnabled *bool `json:"encryptionEnabled,omitempty"` + KekURL *string `json:"kekUrl,omitempty"` + SecretKeyURL *string `json:"secretKeyUrl,omitempty"` + KekVaultID *string `json:"kekVaultId,omitempty"` + SecretKeyVaultID *string `json:"secretKeyVaultId,omitempty"` +} + +// ExportJobsOperationResultInfo is this class is used to send blob details +// after exporting jobs. +type ExportJobsOperationResultInfo struct { + BlobURL *string `json:"blobUrl,omitempty"` + BlobSasKey *string `json:"blobSasKey,omitempty"` +} + +// GenericRecoveryPoint is generic backup copy. +type GenericRecoveryPoint struct { + FriendlyName *string `json:"friendlyName,omitempty"` + RecoveryPointType *string `json:"recoveryPointType,omitempty"` + RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` + RecoveryPointAdditionalInfo *string `json:"recoveryPointAdditionalInfo,omitempty"` +} + +// GetProtectedItemQueryObject is filters to list backup items. +type GetProtectedItemQueryObject struct { + Expand *string `json:"expand,omitempty"` +} + +// IaasVMBackupRequest is iaaS VM workload-specific backup request. +type IaasVMBackupRequest struct { + RecoveryPointExpiryTimeInUTC *date.Time `json:"recoveryPointExpiryTimeInUTC,omitempty"` +} + +// IaaSVMContainer is iaaS VM workload-specific container. +type IaaSVMContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + VirtualMachineVersion *string `json:"virtualMachineVersion,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` +} + +// IaasVMILRRegistrationRequest is restore files/folders from a backup copy of +// IaaS VM. +type IaasVMILRRegistrationRequest struct { + RecoveryPointID *string `json:"recoveryPointId,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` + InitiatorName *string `json:"initiatorName,omitempty"` + RenewExistingRegistration *bool `json:"renewExistingRegistration,omitempty"` +} + +// IaaSVMProtectableItem is iaaS VM workload-specific backup item. +type IaaSVMProtectableItem struct { + BackupManagementType *string `json:"backupManagementType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ProtectionState ProtectionStatus `json:"protectionState,omitempty"` + VirtualMachineID *string `json:"virtualMachineId,omitempty"` +} + +// IaasVMRecoveryPoint is iaaS VM workload specific backup copy. +type IaasVMRecoveryPoint struct { + RecoveryPointType *string `json:"recoveryPointType,omitempty"` + RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` + RecoveryPointAdditionalInfo *string `json:"recoveryPointAdditionalInfo,omitempty"` + SourceVMStorageType *string `json:"sourceVMStorageType,omitempty"` + IsSourceVMEncrypted *bool `json:"isSourceVMEncrypted,omitempty"` + KeyAndSecret *KeyAndSecretDetails `json:"keyAndSecret,omitempty"` + IsInstantILRSessionActive *bool `json:"isInstantILRSessionActive,omitempty"` + RecoveryPointTierDetails *[]RecoveryPointTierInformation `json:"recoveryPointTierDetails,omitempty"` + IsManagedVirtualMachine *bool `json:"isManagedVirtualMachine,omitempty"` + VirtualMachineSize *string `json:"virtualMachineSize,omitempty"` +} + +// IaasVMRestoreRequest is iaaS VM workload-specific restore. +type IaasVMRestoreRequest struct { + RecoveryPointID *string `json:"recoveryPointId,omitempty"` + RecoveryType RecoveryType `json:"recoveryType,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + TargetVirtualMachineID *string `json:"targetVirtualMachineId,omitempty"` + TargetResourceGroupID *string `json:"targetResourceGroupId,omitempty"` + StorageAccountID *string `json:"storageAccountId,omitempty"` + VirtualNetworkID *string `json:"virtualNetworkId,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + TargetDomainNameID *string `json:"targetDomainNameId,omitempty"` + Region *string `json:"region,omitempty"` + AffinityGroup *string `json:"affinityGroup,omitempty"` + CreateNewCloudService *bool `json:"createNewCloudService,omitempty"` + EncryptionDetails *EncryptionDetails `json:"encryptionDetails,omitempty"` +} + +// ILRRequest is parameters to restore file/folders API. +type ILRRequest struct { +} + +// ILRRequestResource is parameters to restore file/folders API. +type ILRRequestResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *ILRRequest `json:"properties,omitempty"` +} + +// InstantItemRecoveryTarget is target details for file / folder restore. +type InstantItemRecoveryTarget struct { + ClientScripts *[]ClientScriptForConnect `json:"clientScripts,omitempty"` +} + +// Job is defines workload agnostic properties for a job. +type Job struct { + EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + Operation *string `json:"operation,omitempty"` + Status *string `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ActivityID *string `json:"activityId,omitempty"` +} + +// JobQueryObject is filters to list the jobs. +type JobQueryObject struct { + Status JobStatus `json:"status,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + Operation JobOperationType `json:"operation,omitempty"` + JobID *string `json:"jobId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` +} + +// JobResource is defines workload agnostic properties for a job. +type JobResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *Job `json:"properties,omitempty"` +} + +// JobResourceList is list of Job resources +type JobResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]JobResource `json:"value,omitempty"` +} + +// JobResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobResourceList) JobResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// KEKDetails is kEK is encryption key for BEK. +type KEKDetails struct { + KeyURL *string `json:"keyUrl,omitempty"` + KeyVaultID *string `json:"keyVaultId,omitempty"` + KeyBackupData *string `json:"keyBackupData,omitempty"` +} + +// KeyAndSecretDetails is bEK is bitlocker key. +// KEK is encryption key for BEK +// If the VM was encrypted then we will store follwing details : +// 1. Secret(BEK) - Url + Backup Data + vaultId. +// 2. Key(KEK) - Url + Backup Data + vaultId. +// BEK and KEK can potentiallty have different vault ids. +type KeyAndSecretDetails struct { + KekDetails *KEKDetails `json:"kekDetails,omitempty"` + BekDetails *BEKDetails `json:"bekDetails,omitempty"` +} + +// LongTermRetentionPolicy is long term retention policy. +type LongTermRetentionPolicy struct { + DailySchedule *DailyRetentionSchedule `json:"dailySchedule,omitempty"` + WeeklySchedule *WeeklyRetentionSchedule `json:"weeklySchedule,omitempty"` + MonthlySchedule *MonthlyRetentionSchedule `json:"monthlySchedule,omitempty"` + YearlySchedule *YearlyRetentionSchedule `json:"yearlySchedule,omitempty"` +} + +// LongTermSchedulePolicy is long term policy schedule. +type LongTermSchedulePolicy struct { +} + +// MabContainer is container with items backed up using MAB backup engine. +type MabContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` + CanReRegister *bool `json:"canReRegister,omitempty"` + ContainerID *int64 `json:"containerId,omitempty"` + ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` + AgentVersion *string `json:"agentVersion,omitempty"` + ExtendedInfo *MabContainerExtendedInfo `json:"extendedInfo,omitempty"` +} + +// MabContainerExtendedInfo is additional information of the container. +type MabContainerExtendedInfo struct { + LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` + BackupItemType BackupItemType `json:"backupItemType,omitempty"` + BackupItems *[]string `json:"backupItems,omitempty"` + PolicyName *string `json:"policyName,omitempty"` + LastBackupStatus *string `json:"lastBackupStatus,omitempty"` +} + +// MabErrorInfo is mAB workload-specific error information. +type MabErrorInfo struct { + ErrorString *string `json:"errorString,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` +} + +// MabFileFolderProtectedItem is mAB workload-specific backup item. +type MabFileFolderProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + LastBackupStatus *string `json:"lastBackupStatus,omitempty"` + ProtectionState *string `json:"protectionState,omitempty"` + IsScheduledForDeferredDelete *bool `json:"isScheduledForDeferredDelete,omitempty"` + DeferredDeleteSyncTimeInUTC *int64 `json:"deferredDeleteSyncTimeInUTC,omitempty"` + ExtendedInfo *MabFileFolderProtectedItemExtendedInfo `json:"extendedInfo,omitempty"` +} + +// MabFileFolderProtectedItemExtendedInfo is additional information on the +// backed up item. +type MabFileFolderProtectedItemExtendedInfo struct { + LastRefreshedAt *date.Time `json:"lastRefreshedAt,omitempty"` + OldestRecoveryPoint *date.Time `json:"oldestRecoveryPoint,omitempty"` + RecoveryPointCount *int32 `json:"recoveryPointCount,omitempty"` +} + +// MabJob is mAB workload-specific job. +type MabJob struct { + EntityFriendlyName *string `json:"entityFriendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + Operation *string `json:"operation,omitempty"` + Status *string `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ActivityID *string `json:"activityId,omitempty"` + Duration *string `json:"duration,omitempty"` + ActionsInfo *[]JobSupportedAction `json:"actionsInfo,omitempty"` + MabServerName *string `json:"mabServerName,omitempty"` + MabServerType MabServerType `json:"mabServerType,omitempty"` + WorkloadType WorkloadType `json:"workloadType,omitempty"` + ErrorDetails *[]MabErrorInfo `json:"errorDetails,omitempty"` + ExtendedInfo *MabJobExtendedInfo `json:"extendedInfo,omitempty"` +} + +// MabJobExtendedInfo is additional information for the MAB workload-specific +// job. +type MabJobExtendedInfo struct { + TasksList *[]MabJobTaskDetails `json:"tasksList,omitempty"` + PropertyBag *map[string]*string `json:"propertyBag,omitempty"` + DynamicErrorMessage *string `json:"dynamicErrorMessage,omitempty"` +} + +// MabJobTaskDetails is mAB workload-specific job task details. +type MabJobTaskDetails struct { + TaskID *string `json:"taskId,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Duration *string `json:"duration,omitempty"` + Status *string `json:"status,omitempty"` +} + +// MabProtectionPolicy is mab container-specific backup policy. +type MabProtectionPolicy struct { + ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` + SchedulePolicy *SchedulePolicy `json:"schedulePolicy,omitempty"` + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// MonthlyRetentionSchedule is monthly retention schedule. +type MonthlyRetentionSchedule struct { + RetentionScheduleFormatType RetentionScheduleFormat `json:"retentionScheduleFormatType,omitempty"` + RetentionScheduleDaily *DailyRetentionFormat `json:"retentionScheduleDaily,omitempty"` + RetentionScheduleWeekly *WeeklyRetentionFormat `json:"retentionScheduleWeekly,omitempty"` + RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` + RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` +} + +// NameInfo is the name of usage. +type NameInfo struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// OperationResultInfo is operation result info. +type OperationResultInfo struct { + JobList *[]string `json:"jobList,omitempty"` +} + +// OperationResultInfoBase is base class for operation result info. +type OperationResultInfoBase struct { +} + +// OperationResultInfoBaseResource is base class for operation result info. +type OperationResultInfoBaseResource struct { + autorest.Response `json:"-"` + StatusCode HTTPStatusCode `json:"statusCode,omitempty"` + Headers *map[string][]string `json:"Headers,omitempty"` + Operation *OperationResultInfoBase `json:"operation,omitempty"` +} + +// OperationStatus is operation status. +type OperationStatus struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Status OperationStatusValues `json:"status,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Error *OperationStatusError `json:"error,omitempty"` + Properties *OperationStatusExtendedInfo `json:"properties,omitempty"` +} + +// OperationStatusError is error information associated with operation status +// call. +type OperationStatusError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// OperationStatusExtendedInfo is base class for additional information of +// operation status. +type OperationStatusExtendedInfo struct { +} + +// OperationStatusJobExtendedInfo is operation status job extended info. +type OperationStatusJobExtendedInfo struct { + JobID *string `json:"jobId,omitempty"` +} + +// OperationStatusJobsExtendedInfo is operation status extended info for list +// of jobs. +type OperationStatusJobsExtendedInfo struct { + JobIds *[]string `json:"jobIds,omitempty"` + FailedJobsError *map[string]*string `json:"failedJobsError,omitempty"` +} + +// OperationStatusProvisionILRExtendedInfo is operation status extended info +// for ILR provision action. +type OperationStatusProvisionILRExtendedInfo struct { + RecoveryTarget *InstantItemRecoveryTarget `json:"recoveryTarget,omitempty"` +} + +// OperationWorkerResponse is this is the base class for operation result +// responses. +type OperationWorkerResponse struct { + StatusCode HTTPStatusCode `json:"statusCode,omitempty"` + Headers *map[string][]string `json:"Headers,omitempty"` +} + +// ProtectedItem is base class for backup items. +type ProtectedItem struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + WorkloadType DataSourceType `json:"workloadType,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + SourceResourceID *string `json:"sourceResourceId,omitempty"` + PolicyID *string `json:"policyId,omitempty"` + LastRecoveryPoint *date.Time `json:"lastRecoveryPoint,omitempty"` +} + +// ProtectedItemQueryObject is filters to list backup items. +type ProtectedItemQueryObject struct { + HealthState HealthState `json:"healthState,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + ItemType DataSourceType `json:"itemType,omitempty"` + PolicyName *string `json:"policyName,omitempty"` + ContainerName *string `json:"containerName,omitempty"` + BackupEngineName *string `json:"backupEngineName,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} + +// ProtectedItemResource is base class for backup items. +type ProtectedItemResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *ProtectedItem `json:"properties,omitempty"` +} + +// ProtectedItemResourceList is list of ProtectedItem resources +type ProtectedItemResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]ProtectedItemResource `json:"value,omitempty"` +} + +// ProtectedItemResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProtectedItemResourceList) ProtectedItemResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProtectionContainer is base class for container with backup items. +// Containers with specific workloads are derived from this class. +type ProtectionContainer struct { + FriendlyName *string `json:"friendlyName,omitempty"` + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` + RegistrationStatus *string `json:"registrationStatus,omitempty"` + HealthStatus *string `json:"healthStatus,omitempty"` + ContainerType ContainerType `json:"containerType,omitempty"` +} + +// ProtectionContainerResource is base class for container with backup items. +// Containers with specific workloads are derived from this class. +type ProtectionContainerResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *ProtectionContainer `json:"properties,omitempty"` +} + +// ProtectionContainerResourceList is list of ProtectionContainer resources +type ProtectionContainerResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]ProtectionContainerResource `json:"value,omitempty"` +} + +// ProtectionContainerResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProtectionContainerResourceList) ProtectionContainerResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProtectionPolicy is base class for backup policy. Workload-specific backup +// policies are derived from this class. +type ProtectionPolicy struct { + ProtectedItemsCount *int32 `json:"protectedItemsCount,omitempty"` +} + +// ProtectionPolicyQueryObject is filters the list backup policies API. +type ProtectionPolicyQueryObject struct { + BackupManagementType BackupManagementType `json:"backupManagementType,omitempty"` +} + +// ProtectionPolicyResource is base class for backup policy. Workload-specific +// backup policies are derived from this class. +type ProtectionPolicyResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *ProtectionPolicy `json:"properties,omitempty"` +} + +// ProtectionPolicyResourceList is list of ProtectionPolicy resources +type ProtectionPolicyResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]ProtectionPolicyResource `json:"value,omitempty"` +} + +// ProtectionPolicyResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProtectionPolicyResourceList) ProtectionPolicyResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecoveryPoint is base class for backup copies. Workload-specific backup +// copies are derived from this class. +type RecoveryPoint struct { +} + +// RecoveryPointResource is base class for backup copies. Workload-specific +// backup copies are derived from this class. +type RecoveryPointResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *RecoveryPoint `json:"properties,omitempty"` +} + +// RecoveryPointResourceList is list of RecoveryPoint resources +type RecoveryPointResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]RecoveryPointResource `json:"value,omitempty"` +} + +// RecoveryPointResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client RecoveryPointResourceList) RecoveryPointResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RecoveryPointTierInformation is recovery point tier information. +type RecoveryPointTierInformation struct { + Type RecoveryPointTierType `json:"type,omitempty"` + Status RecoveryPointTierStatus `json:"status,omitempty"` +} + +// Resource is aRM Resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` +} + +// ResourceList is base for all lists of resources. +type ResourceList struct { + NextLink *string `json:"nextLink,omitempty"` +} + +// RestoreRequest is base class for restore request. Workload-specific restore +// requests are derived from this class. +type RestoreRequest struct { +} + +// RestoreRequestResource is base class for restore request. Workload-specific +// restore requests are derived from this class. +type RestoreRequestResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *RestoreRequest `json:"properties,omitempty"` +} + +// RetentionDuration is retention duration. +type RetentionDuration struct { + Count *int32 `json:"count,omitempty"` + DurationType RetentionDurationType `json:"durationType,omitempty"` +} + +// RetentionPolicy is base class for retention policy. +type RetentionPolicy struct { +} + +// SchedulePolicy is base class for backup schedule. +type SchedulePolicy struct { +} + +// SimpleRetentionPolicy is simple policy retention. +type SimpleRetentionPolicy struct { + RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` +} + +// SimpleSchedulePolicy is simple policy schedule. +type SimpleSchedulePolicy struct { + ScheduleRunFrequency ScheduleRunType `json:"scheduleRunFrequency,omitempty"` + ScheduleRunDays *[]DayOfWeek `json:"scheduleRunDays,omitempty"` + ScheduleRunTimes *[]date.Time `json:"scheduleRunTimes,omitempty"` + ScheduleWeeklyFrequency *int32 `json:"scheduleWeeklyFrequency,omitempty"` +} + +// TokenInformation is the token information details. +type TokenInformation struct { + autorest.Response `json:"-"` + Token *string `json:"token,omitempty"` + ExpiryTimeInUtcTicks *int64 `json:"expiryTimeInUtcTicks,omitempty"` + SecurityPIN *string `json:"securityPIN,omitempty"` +} + +// WeeklyRetentionFormat is weekly retention format. +type WeeklyRetentionFormat struct { + DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` + WeeksOfTheMonth *[]WeekOfMonth `json:"weeksOfTheMonth,omitempty"` +} + +// WeeklyRetentionSchedule is weekly retention schedule. +type WeeklyRetentionSchedule struct { + DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` + RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` + RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` +} + +// WorkloadProtectableItem is base class for backup item. Workload-specific +// backup items are derived from this class. +type WorkloadProtectableItem struct { + BackupManagementType *string `json:"backupManagementType,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ProtectionState ProtectionStatus `json:"protectionState,omitempty"` +} + +// WorkloadProtectableItemResource is base class for backup item. +// Workload-specific backup items are derived from this class. +type WorkloadProtectableItemResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ETag *string `json:"eTag,omitempty"` + Properties *WorkloadProtectableItem `json:"properties,omitempty"` +} + +// WorkloadProtectableItemResourceList is list of WorkloadProtectableItem +// resources +type WorkloadProtectableItemResourceList struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]WorkloadProtectableItemResource `json:"value,omitempty"` +} + +// WorkloadProtectableItemResourceListPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkloadProtectableItemResourceList) WorkloadProtectableItemResourceListPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// YearlyRetentionSchedule is yearly retention schedule. +type YearlyRetentionSchedule struct { + RetentionScheduleFormatType RetentionScheduleFormat `json:"retentionScheduleFormatType,omitempty"` + MonthsOfYear *[]MonthOfYear `json:"monthsOfYear,omitempty"` + RetentionScheduleDaily *DailyRetentionFormat `json:"retentionScheduleDaily,omitempty"` + RetentionScheduleWeekly *WeeklyRetentionFormat `json:"retentionScheduleWeekly,omitempty"` + RetentionTimes *[]date.Time `json:"retentionTimes,omitempty"` + RetentionDuration *RetentionDuration `json:"retentionDuration,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/operations.go index a638bb253f..4c70df134b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/operations.go @@ -1,125 +1,125 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the -// Recoveryservicesbackup service. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List returns the list of available operations. -// -// resourceGroupName is the name of the resource group where the recovery -// services vault is present. -func (client OperationsClient) List(resourceGroupName string) (result ClientDiscoveryResponse, err error) { - req, err := client.ListPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", pathParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { - req, err := lastResults.ClientDiscoveryResponsePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the +// Recoveryservicesbackup service. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List returns the list of available operations. +// +// resourceGroupName is the name of the resource group where the recovery +// services vault is present. +func (client OperationsClient) List(resourceGroupName string) (result ClientDiscoveryResponse, err error) { + req, err := client.ListPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations", pathParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { + req, err := lastResults.ClientDiscoveryResponsePreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationresults.go index de4adf9892..e4c9f881ae 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationresults.go @@ -1,117 +1,117 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectedItemOperationResultsClient is the client for the -// ProtectedItemOperationResults methods of the Recoveryservicesbackup service. -type ProtectedItemOperationResultsClient struct { - ManagementClient -} - -// NewProtectedItemOperationResultsClient creates an instance of the -// ProtectedItemOperationResultsClient client. -func NewProtectedItemOperationResultsClient(subscriptionID string) ProtectedItemOperationResultsClient { - return NewProtectedItemOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectedItemOperationResultsClientWithBaseURI creates an instance of the -// ProtectedItemOperationResultsClient client. -func NewProtectedItemOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectedItemOperationResultsClient { - return ProtectedItemOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches the result of any operation on the backup item. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backup item. containerName is -// container name associated with the backup item. protectedItemName is backup -// item name whose details are to be fetched. operationID is operationID which -// represents the operation whose result needs to be fetched. -func (client ProtectedItemOperationResultsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (result ProtectedItemResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectedItemOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "operationId": autorest.Encode("path", operationID), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectedItemOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectedItemOperationResultsClient) GetResponder(resp *http.Response) (result ProtectedItemResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectedItemOperationResultsClient is the client for the +// ProtectedItemOperationResults methods of the Recoveryservicesbackup service. +type ProtectedItemOperationResultsClient struct { + ManagementClient +} + +// NewProtectedItemOperationResultsClient creates an instance of the +// ProtectedItemOperationResultsClient client. +func NewProtectedItemOperationResultsClient(subscriptionID string) ProtectedItemOperationResultsClient { + return NewProtectedItemOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectedItemOperationResultsClientWithBaseURI creates an instance of the +// ProtectedItemOperationResultsClient client. +func NewProtectedItemOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectedItemOperationResultsClient { + return ProtectedItemOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches the result of any operation on the backup item. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backup item. containerName is +// container name associated with the backup item. protectedItemName is backup +// item name whose details are to be fetched. operationID is operationID which +// represents the operation whose result needs to be fetched. +func (client ProtectedItemOperationResultsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (result ProtectedItemResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectedItemOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "operationId": autorest.Encode("path", operationID), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectedItemOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectedItemOperationResultsClient) GetResponder(resp *http.Response) (result ProtectedItemResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationstatuses.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationstatuses.go index 35b0a933f9..6e80f9b7ea 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationstatuses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditemoperationstatuses.go @@ -1,122 +1,122 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectedItemOperationStatusesClient is the client for the -// ProtectedItemOperationStatuses methods of the Recoveryservicesbackup -// service. -type ProtectedItemOperationStatusesClient struct { - ManagementClient -} - -// NewProtectedItemOperationStatusesClient creates an instance of the -// ProtectedItemOperationStatusesClient client. -func NewProtectedItemOperationStatusesClient(subscriptionID string) ProtectedItemOperationStatusesClient { - return NewProtectedItemOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectedItemOperationStatusesClientWithBaseURI creates an instance of -// the ProtectedItemOperationStatusesClient client. -func NewProtectedItemOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) ProtectedItemOperationStatusesClient { - return ProtectedItemOperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches the status of an operation such as triggering a backup, restore. -// The status can be in progress, completed or failed. You can refer to the -// OperationStatus enum for all the possible states of the operation. Some -// operations create jobs. This method returns the list of jobs associated with -// the operation. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backup item. containerName is -// container name associated with the backup item. protectedItemName is backup -// item name whose details are to be fetched. operationID is operationID -// represents the operation whose status needs to be fetched. -func (client ProtectedItemOperationStatusesClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (result OperationStatus, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationStatusesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationStatusesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationStatusesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectedItemOperationStatusesClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "operationId": autorest.Encode("path", operationID), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectedItemOperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectedItemOperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectedItemOperationStatusesClient is the client for the +// ProtectedItemOperationStatuses methods of the Recoveryservicesbackup +// service. +type ProtectedItemOperationStatusesClient struct { + ManagementClient +} + +// NewProtectedItemOperationStatusesClient creates an instance of the +// ProtectedItemOperationStatusesClient client. +func NewProtectedItemOperationStatusesClient(subscriptionID string) ProtectedItemOperationStatusesClient { + return NewProtectedItemOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectedItemOperationStatusesClientWithBaseURI creates an instance of +// the ProtectedItemOperationStatusesClient client. +func NewProtectedItemOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) ProtectedItemOperationStatusesClient { + return ProtectedItemOperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches the status of an operation such as triggering a backup, restore. +// The status can be in progress, completed or failed. You can refer to the +// OperationStatus enum for all the possible states of the operation. Some +// operations create jobs. This method returns the list of jobs associated with +// the operation. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backup item. containerName is +// container name associated with the backup item. protectedItemName is backup +// item name whose details are to be fetched. operationID is operationID +// represents the operation whose status needs to be fetched. +func (client ProtectedItemOperationStatusesClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (result OperationStatus, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationStatusesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationStatusesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemOperationStatusesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectedItemOperationStatusesClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "operationId": autorest.Encode("path", operationID), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectedItemOperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectedItemOperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditems.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditems.go index 127999ffc9..8edf293e73 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditems.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protecteditems.go @@ -1,269 +1,269 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectedItemsClient is the client for the ProtectedItems methods of the -// Recoveryservicesbackup service. -type ProtectedItemsClient struct { - ManagementClient -} - -// NewProtectedItemsClient creates an instance of the ProtectedItemsClient -// client. -func NewProtectedItemsClient(subscriptionID string) ProtectedItemsClient { - return NewProtectedItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectedItemsClientWithBaseURI creates an instance of the -// ProtectedItemsClient client. -func NewProtectedItemsClientWithBaseURI(baseURI string, subscriptionID string) ProtectedItemsClient { - return ProtectedItemsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate enables backup of an item or to modifies the backup policy -// information of an already backed up item. This is an asynchronous operation. -// To know the status of the operation, call the GetItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backup item. containerName is -// container name associated with the backup item. protectedItemName is item -// name to be backed up. parameters is resource backed up item -func (client ProtectedItemsClient) CreateOrUpdate(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ProtectedItemResource) (result autorest.Response, err error) { - req, err := client.CreateOrUpdatePreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProtectedItemsClient) CreateOrUpdatePreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ProtectedItemResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectedItemsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProtectedItemsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete used to disable backup of an item within a container. This is an -// asynchronous operation. To know the status of the request, call the -// GetItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backed up item. containerName -// is container name associated with the backed up item. protectedItemName is -// backed up item to be deleted. -func (client ProtectedItemsClient) Delete(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProtectedItemsClient) DeletePreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectedItemsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProtectedItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get provides the details of the backed up item. This is an asynchronous -// operation. To know the status of the operation, call the -// GetItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backed up item. containerName -// is container name associated with the backed up item. protectedItemName is -// backed up item name whose details are to be fetched. filter is oData filter -// options. -func (client ProtectedItemsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (result ProtectedItemResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectedItemsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectedItemsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectedItemsClient) GetResponder(resp *http.Response) (result ProtectedItemResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectedItemsClient is the client for the ProtectedItems methods of the +// Recoveryservicesbackup service. +type ProtectedItemsClient struct { + ManagementClient +} + +// NewProtectedItemsClient creates an instance of the ProtectedItemsClient +// client. +func NewProtectedItemsClient(subscriptionID string) ProtectedItemsClient { + return NewProtectedItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectedItemsClientWithBaseURI creates an instance of the +// ProtectedItemsClient client. +func NewProtectedItemsClientWithBaseURI(baseURI string, subscriptionID string) ProtectedItemsClient { + return ProtectedItemsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate enables backup of an item or to modifies the backup policy +// information of an already backed up item. This is an asynchronous operation. +// To know the status of the operation, call the GetItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backup item. containerName is +// container name associated with the backup item. protectedItemName is item +// name to be backed up. parameters is resource backed up item +func (client ProtectedItemsClient) CreateOrUpdate(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ProtectedItemResource) (result autorest.Response, err error) { + req, err := client.CreateOrUpdatePreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProtectedItemsClient) CreateOrUpdatePreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, parameters ProtectedItemResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectedItemsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProtectedItemsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete used to disable backup of an item within a container. This is an +// asynchronous operation. To know the status of the request, call the +// GetItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backed up item. containerName +// is container name associated with the backed up item. protectedItemName is +// backed up item to be deleted. +func (client ProtectedItemsClient) Delete(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProtectedItemsClient) DeletePreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectedItemsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProtectedItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get provides the details of the backed up item. This is an asynchronous +// operation. To know the status of the operation, call the +// GetItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backed up item. containerName +// is container name associated with the backed up item. protectedItemName is +// backed up item name whose details are to be fetched. filter is oData filter +// options. +func (client ProtectedItemsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (result ProtectedItemResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectedItemsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectedItemsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectedItemsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectedItemsClient) GetResponder(resp *http.Response) (result ProtectedItemResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontaineroperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontaineroperationresults.go index 5b6e0564ec..c1d16a743e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontaineroperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontaineroperationresults.go @@ -1,116 +1,116 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectionContainerOperationResultsClient is the client for the -// ProtectionContainerOperationResults methods of the Recoveryservicesbackup -// service. -type ProtectionContainerOperationResultsClient struct { - ManagementClient -} - -// NewProtectionContainerOperationResultsClient creates an instance of the -// ProtectionContainerOperationResultsClient client. -func NewProtectionContainerOperationResultsClient(subscriptionID string) ProtectionContainerOperationResultsClient { - return NewProtectionContainerOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectionContainerOperationResultsClientWithBaseURI creates an instance -// of the ProtectionContainerOperationResultsClient client. -func NewProtectionContainerOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainerOperationResultsClient { - return ProtectionContainerOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get fetches the result of any operation on the container. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the container. containerName is -// container name whose information should be fetched. operationID is operation -// ID which represents the operation whose result needs to be fetched. -func (client ProtectionContainerOperationResultsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string) (result ProtectionContainerResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectionContainerOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionContainerOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectionContainerOperationResultsClient) GetResponder(resp *http.Response) (result ProtectionContainerResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectionContainerOperationResultsClient is the client for the +// ProtectionContainerOperationResults methods of the Recoveryservicesbackup +// service. +type ProtectionContainerOperationResultsClient struct { + ManagementClient +} + +// NewProtectionContainerOperationResultsClient creates an instance of the +// ProtectionContainerOperationResultsClient client. +func NewProtectionContainerOperationResultsClient(subscriptionID string) ProtectionContainerOperationResultsClient { + return NewProtectionContainerOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectionContainerOperationResultsClientWithBaseURI creates an instance +// of the ProtectionContainerOperationResultsClient client. +func NewProtectionContainerOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainerOperationResultsClient { + return ProtectionContainerOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get fetches the result of any operation on the container. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the container. containerName is +// container name whose information should be fetched. operationID is operation +// ID which represents the operation whose result needs to be fetched. +func (client ProtectionContainerOperationResultsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string) (result ProtectionContainerResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectionContainerOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionContainerOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectionContainerOperationResultsClient) GetResponder(resp *http.Response) (result ProtectionContainerResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainerrefreshoperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainerrefreshoperationresults.go index 63ecb4efa1..e8ff5422a4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainerrefreshoperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainerrefreshoperationresults.go @@ -1,114 +1,114 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectionContainerRefreshOperationResultsClient is the client for the -// ProtectionContainerRefreshOperationResults methods of the -// Recoveryservicesbackup service. -type ProtectionContainerRefreshOperationResultsClient struct { - ManagementClient -} - -// NewProtectionContainerRefreshOperationResultsClient creates an instance of -// the ProtectionContainerRefreshOperationResultsClient client. -func NewProtectionContainerRefreshOperationResultsClient(subscriptionID string) ProtectionContainerRefreshOperationResultsClient { - return NewProtectionContainerRefreshOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectionContainerRefreshOperationResultsClientWithBaseURI creates an -// instance of the ProtectionContainerRefreshOperationResultsClient client. -func NewProtectionContainerRefreshOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainerRefreshOperationResultsClient { - return ProtectionContainerRefreshOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get provides the result of the refresh operation triggered by the -// BeginRefresh operation. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the container. operationID is -// operation ID associated with the operation whose result needs to be fetched. -func (client ProtectionContainerRefreshOperationResultsClient) Get(vaultName string, resourceGroupName string, fabricName string, operationID string) (result autorest.Response, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectionContainerRefreshOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "fabricName": autorest.Encode("path", fabricName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionContainerRefreshOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectionContainerRefreshOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectionContainerRefreshOperationResultsClient is the client for the +// ProtectionContainerRefreshOperationResults methods of the +// Recoveryservicesbackup service. +type ProtectionContainerRefreshOperationResultsClient struct { + ManagementClient +} + +// NewProtectionContainerRefreshOperationResultsClient creates an instance of +// the ProtectionContainerRefreshOperationResultsClient client. +func NewProtectionContainerRefreshOperationResultsClient(subscriptionID string) ProtectionContainerRefreshOperationResultsClient { + return NewProtectionContainerRefreshOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectionContainerRefreshOperationResultsClientWithBaseURI creates an +// instance of the ProtectionContainerRefreshOperationResultsClient client. +func NewProtectionContainerRefreshOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainerRefreshOperationResultsClient { + return ProtectionContainerRefreshOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get provides the result of the refresh operation triggered by the +// BeginRefresh operation. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the container. operationID is +// operation ID associated with the operation whose result needs to be fetched. +func (client ProtectionContainerRefreshOperationResultsClient) Get(vaultName string, resourceGroupName string, fabricName string, operationID string) (result autorest.Response, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainerRefreshOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectionContainerRefreshOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionContainerRefreshOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectionContainerRefreshOperationResultsClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainers.go index 1e19fc267b..0b04ff18c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectioncontainers.go @@ -1,183 +1,183 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectionContainersClient is the client for the ProtectionContainers -// methods of the Recoveryservicesbackup service. -type ProtectionContainersClient struct { - ManagementClient -} - -// NewProtectionContainersClient creates an instance of the -// ProtectionContainersClient client. -func NewProtectionContainersClient(subscriptionID string) ProtectionContainersClient { - return NewProtectionContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectionContainersClientWithBaseURI creates an instance of the -// ProtectionContainersClient client. -func NewProtectionContainersClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainersClient { - return ProtectionContainersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets details of the specific container registered to your Recovery -// Services Vault. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is name of the fabric where the container belongs. containerName -// is name of the container whose details need to be fetched. -func (client ProtectionContainersClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string) (result ProtectionContainerResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectionContainersClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionContainersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectionContainersClient) GetResponder(resp *http.Response) (result ProtectionContainerResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Refresh discovers all the containers in the subscription that can be backed -// up to Recovery Services Vault. This is an asynchronous operation. To know -// the status of the operation, call GetRefreshOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated the container. -func (client ProtectionContainersClient) Refresh(vaultName string, resourceGroupName string, fabricName string) (result autorest.Response, err error) { - req, err := client.RefreshPreparer(vaultName, resourceGroupName, fabricName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Refresh", nil, "Failure preparing request") - return - } - - resp, err := client.RefreshSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Refresh", resp, "Failure sending request") - return - } - - result, err = client.RefreshResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Refresh", resp, "Failure responding to request") - } - - return -} - -// RefreshPreparer prepares the Refresh request. -func (client ProtectionContainersClient) RefreshPreparer(vaultName string, resourceGroupName string, fabricName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "fabricName": autorest.Encode("path", fabricName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RefreshSender sends the Refresh request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionContainersClient) RefreshSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RefreshResponder handles the response to the Refresh request. The method always -// closes the http.Response Body. -func (client ProtectionContainersClient) RefreshResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectionContainersClient is the client for the ProtectionContainers +// methods of the Recoveryservicesbackup service. +type ProtectionContainersClient struct { + ManagementClient +} + +// NewProtectionContainersClient creates an instance of the +// ProtectionContainersClient client. +func NewProtectionContainersClient(subscriptionID string) ProtectionContainersClient { + return NewProtectionContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectionContainersClientWithBaseURI creates an instance of the +// ProtectionContainersClient client. +func NewProtectionContainersClientWithBaseURI(baseURI string, subscriptionID string) ProtectionContainersClient { + return ProtectionContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets details of the specific container registered to your Recovery +// Services Vault. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is name of the fabric where the container belongs. containerName +// is name of the container whose details need to be fetched. +func (client ProtectionContainersClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string) (result ProtectionContainerResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectionContainersClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectionContainersClient) GetResponder(resp *http.Response) (result ProtectionContainerResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Refresh discovers all the containers in the subscription that can be backed +// up to Recovery Services Vault. This is an asynchronous operation. To know +// the status of the operation, call GetRefreshOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated the container. +func (client ProtectionContainersClient) Refresh(vaultName string, resourceGroupName string, fabricName string) (result autorest.Response, err error) { + req, err := client.RefreshPreparer(vaultName, resourceGroupName, fabricName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Refresh", nil, "Failure preparing request") + return + } + + resp, err := client.RefreshSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Refresh", resp, "Failure sending request") + return + } + + result, err = client.RefreshResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionContainersClient", "Refresh", resp, "Failure responding to request") + } + + return +} + +// RefreshPreparer prepares the Refresh request. +func (client ProtectionContainersClient) RefreshPreparer(vaultName string, resourceGroupName string, fabricName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "fabricName": autorest.Encode("path", fabricName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RefreshSender sends the Refresh request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionContainersClient) RefreshSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RefreshResponder handles the response to the Refresh request. The method always +// closes the http.Response Body. +func (client ProtectionContainersClient) RefreshResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicies.go index 74994b3f96..21c790f82a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicies.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicies.go @@ -1,255 +1,255 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectionPoliciesClient is the client for the ProtectionPolicies methods of -// the Recoveryservicesbackup service. -type ProtectionPoliciesClient struct { - ManagementClient -} - -// NewProtectionPoliciesClient creates an instance of the -// ProtectionPoliciesClient client. -func NewProtectionPoliciesClient(subscriptionID string) ProtectionPoliciesClient { - return NewProtectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectionPoliciesClientWithBaseURI creates an instance of the -// ProtectionPoliciesClient client. -func NewProtectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ProtectionPoliciesClient { - return ProtectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or modifies a backup policy. This is an asynchronous -// operation. Status of the operation can be fetched using -// GetPolicyOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// policyName is backup policy to be created. parameters is resource backup -// policy -func (client ProtectionPoliciesClient) CreateOrUpdate(vaultName string, resourceGroupName string, policyName string, parameters ProtectionPolicyResource) (result ProtectionPolicyResource, err error) { - req, err := client.CreateOrUpdatePreparer(vaultName, resourceGroupName, policyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProtectionPoliciesClient) CreateOrUpdatePreparer(vaultName string, resourceGroupName string, policyName string, parameters ProtectionPolicyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProtectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ProtectionPolicyResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes specified backup policy from your Recovery Services Vault. -// This is an asynchronous operation. Status of the operation can be fetched -// using GetPolicyOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// policyName is backup policy to be deleted. -func (client ProtectionPoliciesClient) Delete(vaultName string, resourceGroupName string, policyName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(vaultName, resourceGroupName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProtectionPoliciesClient) DeletePreparer(vaultName string, resourceGroupName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionPoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProtectionPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get provides the details of the backup policies associated to Recovery -// Services Vault. This is an asynchronous operation. Status of the operation -// can be fetched using GetPolicyOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// policyName is backup policy information to be fetched. -func (client ProtectionPoliciesClient) Get(vaultName string, resourceGroupName string, policyName string) (result ProtectionPolicyResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, policyName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectionPoliciesClient) GetPreparer(vaultName string, resourceGroupName string, policyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectionPoliciesClient) GetResponder(resp *http.Response) (result ProtectionPolicyResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectionPoliciesClient is the client for the ProtectionPolicies methods of +// the Recoveryservicesbackup service. +type ProtectionPoliciesClient struct { + ManagementClient +} + +// NewProtectionPoliciesClient creates an instance of the +// ProtectionPoliciesClient client. +func NewProtectionPoliciesClient(subscriptionID string) ProtectionPoliciesClient { + return NewProtectionPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectionPoliciesClientWithBaseURI creates an instance of the +// ProtectionPoliciesClient client. +func NewProtectionPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ProtectionPoliciesClient { + return ProtectionPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or modifies a backup policy. This is an asynchronous +// operation. Status of the operation can be fetched using +// GetPolicyOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// policyName is backup policy to be created. parameters is resource backup +// policy +func (client ProtectionPoliciesClient) CreateOrUpdate(vaultName string, resourceGroupName string, policyName string, parameters ProtectionPolicyResource) (result ProtectionPolicyResource, err error) { + req, err := client.CreateOrUpdatePreparer(vaultName, resourceGroupName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProtectionPoliciesClient) CreateOrUpdatePreparer(vaultName string, resourceGroupName string, policyName string, parameters ProtectionPolicyResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProtectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ProtectionPolicyResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes specified backup policy from your Recovery Services Vault. +// This is an asynchronous operation. Status of the operation can be fetched +// using GetPolicyOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// policyName is backup policy to be deleted. +func (client ProtectionPoliciesClient) Delete(vaultName string, resourceGroupName string, policyName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(vaultName, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProtectionPoliciesClient) DeletePreparer(vaultName string, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionPoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProtectionPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get provides the details of the backup policies associated to Recovery +// Services Vault. This is an asynchronous operation. Status of the operation +// can be fetched using GetPolicyOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// policyName is backup policy information to be fetched. +func (client ProtectionPoliciesClient) Get(vaultName string, resourceGroupName string, policyName string) (result ProtectionPolicyResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPoliciesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectionPoliciesClient) GetPreparer(vaultName string, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectionPoliciesClient) GetResponder(resp *http.Response) (result ProtectionPolicyResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationresults.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationresults.go index a4af678daf..7fb4fe4e48 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationresults.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationresults.go @@ -1,115 +1,115 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectionPolicyOperationResultsClient is the client for the -// ProtectionPolicyOperationResults methods of the Recoveryservicesbackup -// service. -type ProtectionPolicyOperationResultsClient struct { - ManagementClient -} - -// NewProtectionPolicyOperationResultsClient creates an instance of the -// ProtectionPolicyOperationResultsClient client. -func NewProtectionPolicyOperationResultsClient(subscriptionID string) ProtectionPolicyOperationResultsClient { - return NewProtectionPolicyOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectionPolicyOperationResultsClientWithBaseURI creates an instance of -// the ProtectionPolicyOperationResultsClient client. -func NewProtectionPolicyOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionPolicyOperationResultsClient { - return ProtectionPolicyOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get provides the result of an operation. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// policyName is backup policy name whose operation's result needs to be -// fetched. operationID is operation ID which represents the operation whose -// result needs to be fetched. -func (client ProtectionPolicyOperationResultsClient) Get(vaultName string, resourceGroupName string, policyName string, operationID string) (result ProtectionPolicyResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, policyName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationResultsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectionPolicyOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, policyName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionPolicyOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectionPolicyOperationResultsClient) GetResponder(resp *http.Response) (result ProtectionPolicyResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectionPolicyOperationResultsClient is the client for the +// ProtectionPolicyOperationResults methods of the Recoveryservicesbackup +// service. +type ProtectionPolicyOperationResultsClient struct { + ManagementClient +} + +// NewProtectionPolicyOperationResultsClient creates an instance of the +// ProtectionPolicyOperationResultsClient client. +func NewProtectionPolicyOperationResultsClient(subscriptionID string) ProtectionPolicyOperationResultsClient { + return NewProtectionPolicyOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectionPolicyOperationResultsClientWithBaseURI creates an instance of +// the ProtectionPolicyOperationResultsClient client. +func NewProtectionPolicyOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) ProtectionPolicyOperationResultsClient { + return ProtectionPolicyOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get provides the result of an operation. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// policyName is backup policy name whose operation's result needs to be +// fetched. operationID is operation ID which represents the operation whose +// result needs to be fetched. +func (client ProtectionPolicyOperationResultsClient) Get(vaultName string, resourceGroupName string, policyName string, operationID string) (result ProtectionPolicyResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, policyName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationResultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationResultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationResultsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectionPolicyOperationResultsClient) GetPreparer(vaultName string, resourceGroupName string, policyName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionPolicyOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectionPolicyOperationResultsClient) GetResponder(resp *http.Response) (result ProtectionPolicyResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationstatuses.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationstatuses.go index 0f6423cdfa..6fdb8e9bfd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationstatuses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/protectionpolicyoperationstatuses.go @@ -1,119 +1,119 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProtectionPolicyOperationStatusesClient is the client for the -// ProtectionPolicyOperationStatuses methods of the Recoveryservicesbackup -// service. -type ProtectionPolicyOperationStatusesClient struct { - ManagementClient -} - -// NewProtectionPolicyOperationStatusesClient creates an instance of the -// ProtectionPolicyOperationStatusesClient client. -func NewProtectionPolicyOperationStatusesClient(subscriptionID string) ProtectionPolicyOperationStatusesClient { - return NewProtectionPolicyOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProtectionPolicyOperationStatusesClientWithBaseURI creates an instance of -// the ProtectionPolicyOperationStatusesClient client. -func NewProtectionPolicyOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) ProtectionPolicyOperationStatusesClient { - return ProtectionPolicyOperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get provides the status of the asynchronous operations like backup, restore. -// The status can be in progress, completed or failed. You can refer to the -// Operation Status enum for all the possible states of an operation. Some -// operations create jobs. This method returns the list of jobs associated with -// operation. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// policyName is backup policy name whose operation's status needs to be -// fetched. operationID is operation ID which represents an operation whose -// status needs to be fetched. -func (client ProtectionPolicyOperationStatusesClient) Get(vaultName string, resourceGroupName string, policyName string, operationID string) (result OperationStatus, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, policyName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationStatusesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationStatusesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationStatusesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProtectionPolicyOperationStatusesClient) GetPreparer(vaultName string, resourceGroupName string, policyName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "policyName": autorest.Encode("path", policyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProtectionPolicyOperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProtectionPolicyOperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProtectionPolicyOperationStatusesClient is the client for the +// ProtectionPolicyOperationStatuses methods of the Recoveryservicesbackup +// service. +type ProtectionPolicyOperationStatusesClient struct { + ManagementClient +} + +// NewProtectionPolicyOperationStatusesClient creates an instance of the +// ProtectionPolicyOperationStatusesClient client. +func NewProtectionPolicyOperationStatusesClient(subscriptionID string) ProtectionPolicyOperationStatusesClient { + return NewProtectionPolicyOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProtectionPolicyOperationStatusesClientWithBaseURI creates an instance of +// the ProtectionPolicyOperationStatusesClient client. +func NewProtectionPolicyOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) ProtectionPolicyOperationStatusesClient { + return ProtectionPolicyOperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get provides the status of the asynchronous operations like backup, restore. +// The status can be in progress, completed or failed. You can refer to the +// Operation Status enum for all the possible states of an operation. Some +// operations create jobs. This method returns the list of jobs associated with +// operation. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// policyName is backup policy name whose operation's status needs to be +// fetched. operationID is operation ID which represents an operation whose +// status needs to be fetched. +func (client ProtectionPolicyOperationStatusesClient) Get(vaultName string, resourceGroupName string, policyName string, operationID string) (result OperationStatus, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, policyName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationStatusesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationStatusesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.ProtectionPolicyOperationStatusesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProtectionPolicyOperationStatusesClient) GetPreparer(vaultName string, resourceGroupName string, policyName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProtectionPolicyOperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProtectionPolicyOperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/recoverypoints.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/recoverypoints.go index e40092bc40..185ed02240 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/recoverypoints.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/recoverypoints.go @@ -1,219 +1,219 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RecoveryPointsClient is the client for the RecoveryPoints methods of the -// Recoveryservicesbackup service. -type RecoveryPointsClient struct { - ManagementClient -} - -// NewRecoveryPointsClient creates an instance of the RecoveryPointsClient -// client. -func NewRecoveryPointsClient(subscriptionID string) RecoveryPointsClient { - return NewRecoveryPointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoveryPointsClientWithBaseURI creates an instance of the -// RecoveryPointsClient client. -func NewRecoveryPointsClientWithBaseURI(baseURI string, subscriptionID string) RecoveryPointsClient { - return RecoveryPointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get provides the information of the backed up data identified using -// RecoveryPointID. This is an asynchronous operation. To know the status of -// the operation, call the GetProtectedItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with backed up item. containerName is -// container name associated with backed up item. protectedItemName is backed -// up item name whose backup data needs to be fetched. recoveryPointID is -// recoveryPointID represents the backed up data to be fetched. -func (client RecoveryPointsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (result RecoveryPointResource, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoveryPointsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "recoveryPointId": autorest.Encode("path", recoveryPointID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecoveryPointsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecoveryPointsClient) GetResponder(resp *http.Response) (result RecoveryPointResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the backup copies for the backed up item. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backed up item. containerName -// is container name associated with the backed up item. protectedItemName is -// backed up item whose backup copies are to be fetched. filter is oData filter -// options. -func (client RecoveryPointsClient) List(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (result RecoveryPointResourceList, err error) { - req, err := client.ListPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RecoveryPointsClient) ListPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RecoveryPointsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RecoveryPointsClient) ListResponder(resp *http.Response) (result RecoveryPointResourceList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client RecoveryPointsClient) ListNextResults(lastResults RecoveryPointResourceList) (result RecoveryPointResourceList, err error) { - req, err := lastResults.RecoveryPointResourceListPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RecoveryPointsClient is the client for the RecoveryPoints methods of the +// Recoveryservicesbackup service. +type RecoveryPointsClient struct { + ManagementClient +} + +// NewRecoveryPointsClient creates an instance of the RecoveryPointsClient +// client. +func NewRecoveryPointsClient(subscriptionID string) RecoveryPointsClient { + return NewRecoveryPointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecoveryPointsClientWithBaseURI creates an instance of the +// RecoveryPointsClient client. +func NewRecoveryPointsClientWithBaseURI(baseURI string, subscriptionID string) RecoveryPointsClient { + return RecoveryPointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get provides the information of the backed up data identified using +// RecoveryPointID. This is an asynchronous operation. To know the status of +// the operation, call the GetProtectedItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with backed up item. containerName is +// container name associated with backed up item. protectedItemName is backed +// up item name whose backup data needs to be fetched. recoveryPointID is +// recoveryPointID represents the backed up data to be fetched. +func (client RecoveryPointsClient) Get(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (result RecoveryPointResource, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecoveryPointsClient) GetPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "recoveryPointId": autorest.Encode("path", recoveryPointID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RecoveryPointsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecoveryPointsClient) GetResponder(resp *http.Response) (result RecoveryPointResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the backup copies for the backed up item. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backed up item. containerName +// is container name associated with the backed up item. protectedItemName is +// backed up item whose backup copies are to be fetched. filter is oData filter +// options. +func (client RecoveryPointsClient) List(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (result RecoveryPointResourceList, err error) { + req, err := client.ListPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RecoveryPointsClient) ListPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RecoveryPointsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RecoveryPointsClient) ListResponder(resp *http.Response) (result RecoveryPointResourceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client RecoveryPointsClient) ListNextResults(lastResults RecoveryPointResourceList) (result RecoveryPointResourceList, err error) { + req, err := lastResults.RecoveryPointResourceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RecoveryPointsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/restores.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/restores.go index d1b8c4174e..17cb5c4be5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/restores.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/restores.go @@ -1,120 +1,120 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RestoresClient is the client for the Restores methods of the -// Recoveryservicesbackup service. -type RestoresClient struct { - ManagementClient -} - -// NewRestoresClient creates an instance of the RestoresClient client. -func NewRestoresClient(subscriptionID string) RestoresClient { - return NewRestoresClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestoresClientWithBaseURI creates an instance of the RestoresClient -// client. -func NewRestoresClientWithBaseURI(baseURI string, subscriptionID string) RestoresClient { - return RestoresClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Trigger restores the specified backed up data. This is an asynchronous -// operation. To know the status of this API call, use -// GetProtectedItemOperationResult API. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -// fabricName is fabric name associated with the backed up items. containerName -// is container name associated with the backed up items. protectedItemName is -// backed up item to be restored. recoveryPointID is recovery point ID which -// represents the backed up data to be restored. parameters is resource restore -// request -func (client RestoresClient) Trigger(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource) (result autorest.Response, err error) { - req, err := client.TriggerPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RestoresClient", "Trigger", nil, "Failure preparing request") - return - } - - resp, err := client.TriggerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RestoresClient", "Trigger", resp, "Failure sending request") - return - } - - result, err = client.TriggerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RestoresClient", "Trigger", resp, "Failure responding to request") - } - - return -} - -// TriggerPreparer prepares the Trigger request. -func (client RestoresClient) TriggerPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerName": autorest.Encode("path", containerName), - "fabricName": autorest.Encode("path", fabricName), - "protectedItemName": autorest.Encode("path", protectedItemName), - "recoveryPointId": autorest.Encode("path", recoveryPointID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TriggerSender sends the Trigger request. The method will close the -// http.Response Body if it receives an error. -func (client RestoresClient) TriggerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TriggerResponder handles the response to the Trigger request. The method always -// closes the http.Response Body. -func (client RestoresClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RestoresClient is the client for the Restores methods of the +// Recoveryservicesbackup service. +type RestoresClient struct { + ManagementClient +} + +// NewRestoresClient creates an instance of the RestoresClient client. +func NewRestoresClient(subscriptionID string) RestoresClient { + return NewRestoresClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRestoresClientWithBaseURI creates an instance of the RestoresClient +// client. +func NewRestoresClientWithBaseURI(baseURI string, subscriptionID string) RestoresClient { + return RestoresClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Trigger restores the specified backed up data. This is an asynchronous +// operation. To know the status of this API call, use +// GetProtectedItemOperationResult API. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +// fabricName is fabric name associated with the backed up items. containerName +// is container name associated with the backed up items. protectedItemName is +// backed up item to be restored. recoveryPointID is recovery point ID which +// represents the backed up data to be restored. parameters is resource restore +// request +func (client RestoresClient) Trigger(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource) (result autorest.Response, err error) { + req, err := client.TriggerPreparer(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RestoresClient", "Trigger", nil, "Failure preparing request") + return + } + + resp, err := client.TriggerSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RestoresClient", "Trigger", resp, "Failure sending request") + return + } + + result, err = client.TriggerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.RestoresClient", "Trigger", resp, "Failure responding to request") + } + + return +} + +// TriggerPreparer prepares the Trigger request. +func (client RestoresClient) TriggerPreparer(vaultName string, resourceGroupName string, fabricName string, containerName string, protectedItemName string, recoveryPointID string, parameters RestoreRequestResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "fabricName": autorest.Encode("path", fabricName), + "protectedItemName": autorest.Encode("path", protectedItemName), + "recoveryPointId": autorest.Encode("path", recoveryPointID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TriggerSender sends the Trigger request. The method will close the +// http.Response Body if it receives an error. +func (client RestoresClient) TriggerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TriggerResponder handles the response to the Trigger request. The method always +// closes the http.Response Body. +func (client RestoresClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/securitypins.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/securitypins.go index 7b6e9f36b2..78d89bdc9b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/securitypins.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/securitypins.go @@ -1,108 +1,108 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// SecurityPINsClient is the client for the SecurityPINs methods of the -// Recoveryservicesbackup service. -type SecurityPINsClient struct { - ManagementClient -} - -// NewSecurityPINsClient creates an instance of the SecurityPINsClient client. -func NewSecurityPINsClient(subscriptionID string) SecurityPINsClient { - return NewSecurityPINsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSecurityPINsClientWithBaseURI creates an instance of the -// SecurityPINsClient client. -func NewSecurityPINsClientWithBaseURI(baseURI string, subscriptionID string) SecurityPINsClient { - return SecurityPINsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the security PIN. -// -// vaultName is the name of the recovery services vault. resourceGroupName is -// the name of the resource group where the recovery services vault is present. -func (client SecurityPINsClient) Get(vaultName string, resourceGroupName string) (result TokenInformation, err error) { - req, err := client.GetPreparer(vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.SecurityPINsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.SecurityPINsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "recoveryservicesbackup.SecurityPINsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SecurityPINsClient) GetPreparer(vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SecurityPINsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SecurityPINsClient) GetResponder(resp *http.Response) (result TokenInformation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// SecurityPINsClient is the client for the SecurityPINs methods of the +// Recoveryservicesbackup service. +type SecurityPINsClient struct { + ManagementClient +} + +// NewSecurityPINsClient creates an instance of the SecurityPINsClient client. +func NewSecurityPINsClient(subscriptionID string) SecurityPINsClient { + return NewSecurityPINsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityPINsClientWithBaseURI creates an instance of the +// SecurityPINsClient client. +func NewSecurityPINsClientWithBaseURI(baseURI string, subscriptionID string) SecurityPINsClient { + return SecurityPINsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the security PIN. +// +// vaultName is the name of the recovery services vault. resourceGroupName is +// the name of the resource group where the recovery services vault is present. +func (client SecurityPINsClient) Get(vaultName string, resourceGroupName string) (result TokenInformation, err error) { + req, err := client.GetPreparer(vaultName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.SecurityPINsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.SecurityPINsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "recoveryservicesbackup.SecurityPINsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityPINsClient) GetPreparer(vaultName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPINsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityPINsClient) GetResponder(resp *http.Response) (result TokenInformation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/version.go index 19b036c080..9b084bb2f9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/recoveryservicesbackup/version.go @@ -1,29 +1,29 @@ -package recoveryservicesbackup - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-recoveryservicesbackup/2016-12-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package recoveryservicesbackup + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-recoveryservicesbackup/2016-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/client.go index 5470eb0415..a2fe3a6d68 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/client.go @@ -1,52 +1,52 @@ -// Package redis implements the Azure ARM Redis service API version 2016-04-01. -// -// REST API for Azure Redis Cache Service. -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Redis - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Redis. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package redis implements the Azure ARM Redis service API version 2016-04-01. +// +// REST API for Azure Redis Cache Service. +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Redis + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Redis. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrule.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrule.go index 4137356d6a..b1db865848 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrule.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrule.go @@ -1,254 +1,254 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// FirewallRuleClient is the rEST API for Azure Redis Cache Service. -type FirewallRuleClient struct { - ManagementClient -} - -// NewFirewallRuleClient creates an instance of the FirewallRuleClient client. -func NewFirewallRuleClient(subscriptionID string) FirewallRuleClient { - return NewFirewallRuleClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRuleClientWithBaseURI creates an instance of the -// FirewallRuleClient client. -func NewFirewallRuleClientWithBaseURI(baseURI string, subscriptionID string) FirewallRuleClient { - return FirewallRuleClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a redis cache firewall rule -// -// resourceGroupName is the name of the resource group. cacheName is the name -// of the Redis cache. ruleName is the name of the firewall rule. parameters is -// parameters supplied to the create or update redis firewall rule operation. -func (client FirewallRuleClient) CreateOrUpdate(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (result FirewallRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIP", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIP", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "redis.FirewallRuleClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, cacheName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRuleClient) CreateOrUpdatePreparer(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRuleClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a single firewall rule in a specified redis cache. -// -// resourceGroupName is the name of the resource group. cacheName is the name -// of the Redis cache. ruleName is the name of the firewall rule. -func (client FirewallRuleClient) Delete(resourceGroupName string, cacheName string, ruleName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, cacheName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRuleClient) DeletePreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRuleClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a single firewall rule in a specified redis cache. -// -// resourceGroupName is the name of the resource group. cacheName is the name -// of the Redis cache. ruleName is the name of the firewall rule. -func (client FirewallRuleClient) Get(resourceGroupName string, cacheName string, ruleName string) (result FirewallRule, err error) { - req, err := client.GetPreparer(resourceGroupName, cacheName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRuleClient) GetPreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRuleClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRuleClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FirewallRuleClient is the rEST API for Azure Redis Cache Service. +type FirewallRuleClient struct { + ManagementClient +} + +// NewFirewallRuleClient creates an instance of the FirewallRuleClient client. +func NewFirewallRuleClient(subscriptionID string) FirewallRuleClient { + return NewFirewallRuleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallRuleClientWithBaseURI creates an instance of the +// FirewallRuleClient client. +func NewFirewallRuleClientWithBaseURI(baseURI string, subscriptionID string) FirewallRuleClient { + return FirewallRuleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a redis cache firewall rule +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. ruleName is the name of the firewall rule. parameters is +// parameters supplied to the create or update redis firewall rule operation. +func (client FirewallRuleClient) CreateOrUpdate(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (result FirewallRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIP", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FirewallRuleProperties.EndIP", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "redis.FirewallRuleClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, cacheName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRuleClient) CreateOrUpdatePreparer(resourceGroupName string, cacheName string, ruleName string, parameters FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallRuleClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a single firewall rule in a specified redis cache. +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. ruleName is the name of the firewall rule. +func (client FirewallRuleClient) Delete(resourceGroupName string, cacheName string, ruleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, cacheName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRuleClient) DeletePreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRuleClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallRuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a single firewall rule in a specified redis cache. +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. ruleName is the name of the firewall rule. +func (client FirewallRuleClient) Get(resourceGroupName string, cacheName string, ruleName string) (result FirewallRule, err error) { + req, err := client.GetPreparer(resourceGroupName, cacheName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRuleClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallRuleClient) GetPreparer(resourceGroupName string, cacheName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRuleClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallRuleClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrules.go index 51ab965532..571d96bc7c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/firewallrules.go @@ -1,132 +1,132 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// FirewallRulesClient is the rEST API for Azure Redis Cache Service. -type FirewallRulesClient struct { - ManagementClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient -// client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the -// FirewallRulesClient client. -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets all firewall rules in the specified redis cache. -// -// resourceGroupName is the name of the resource group. cacheName is the name -// of the Redis cache. -func (client FirewallRulesClient) List(resourceGroupName string, cacheName string) (result FirewallRuleListResult, err error) { - req, err := client.ListPreparer(resourceGroupName, cacheName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client FirewallRulesClient) ListPreparer(resourceGroupName string, cacheName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "cacheName": autorest.Encode("path", cacheName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client FirewallRulesClient) ListNextResults(lastResults FirewallRuleListResult) (result FirewallRuleListResult, err error) { - req, err := lastResults.FirewallRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to next results request") - } - - return -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// FirewallRulesClient is the rEST API for Azure Redis Cache Service. +type FirewallRulesClient struct { + ManagementClient +} + +// NewFirewallRulesClient creates an instance of the FirewallRulesClient +// client. +func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { + return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallRulesClientWithBaseURI creates an instance of the +// FirewallRulesClient client. +func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { + return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all firewall rules in the specified redis cache. +// +// resourceGroupName is the name of the resource group. cacheName is the name +// of the Redis cache. +func (client FirewallRulesClient) List(resourceGroupName string, cacheName string) (result FirewallRuleListResult, err error) { + req, err := client.ListPreparer(resourceGroupName, cacheName) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallRulesClient) ListPreparer(resourceGroupName string, cacheName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cacheName": autorest.Encode("path", cacheName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/firewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) ListResponder(resp *http.Response) (result FirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client FirewallRulesClient) ListNextResults(lastResults FirewallRuleListResult) (result FirewallRuleListResult, err error) { + req, err := lastResults.FirewallRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.FirewallRulesClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/models.go index aadba42b21..f4ef80cc53 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/models.go @@ -1,335 +1,335 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // Everyday specifies the everyday state for day of week. - Everyday DayOfWeek = "Everyday" - // Friday specifies the friday state for day of week. - Friday DayOfWeek = "Friday" - // Monday specifies the monday state for day of week. - Monday DayOfWeek = "Monday" - // Saturday specifies the saturday state for day of week. - Saturday DayOfWeek = "Saturday" - // Sunday specifies the sunday state for day of week. - Sunday DayOfWeek = "Sunday" - // Thursday specifies the thursday state for day of week. - Thursday DayOfWeek = "Thursday" - // Tuesday specifies the tuesday state for day of week. - Tuesday DayOfWeek = "Tuesday" - // Wednesday specifies the wednesday state for day of week. - Wednesday DayOfWeek = "Wednesday" - // Weekend specifies the weekend state for day of week. - Weekend DayOfWeek = "Weekend" -) - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // Primary specifies the primary state for key type. - Primary KeyType = "Primary" - // Secondary specifies the secondary state for key type. - Secondary KeyType = "Secondary" -) - -// RebootType enumerates the values for reboot type. -type RebootType string - -const ( - // AllNodes specifies the all nodes state for reboot type. - AllNodes RebootType = "AllNodes" - // PrimaryNode specifies the primary node state for reboot type. - PrimaryNode RebootType = "PrimaryNode" - // SecondaryNode specifies the secondary node state for reboot type. - SecondaryNode RebootType = "SecondaryNode" -) - -// SkuFamily enumerates the values for sku family. -type SkuFamily string - -const ( - // C specifies the c state for sku family. - C SkuFamily = "C" - // P specifies the p state for sku family. - P SkuFamily = "P" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic specifies the basic state for sku name. - Basic SkuName = "Basic" - // Premium specifies the premium state for sku name. - Premium SkuName = "Premium" - // Standard specifies the standard state for sku name. - Standard SkuName = "Standard" -) - -// AccessKeys is redis cache access keys. -type AccessKeys struct { - autorest.Response `json:"-"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// CreateParameters is parameters supplied to the Create Redis operation. -type CreateParameters struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CreateProperties `json:"properties,omitempty"` -} - -// CreateProperties is properties supplied to Create Redis operation. -type CreateProperties struct { - RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` - ShardCount *int32 `json:"shardCount,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - StaticIP *string `json:"staticIP,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// ExportRDBParameters is parameters for Redis export operation. -type ExportRDBParameters struct { - Format *string `json:"format,omitempty"` - Prefix *string `json:"prefix,omitempty"` - Container *string `json:"container,omitempty"` -} - -// FirewallRule is a firewall rule on a redis cache has a name, and describes a -// contiguous range of IP addresses permitted to connect -type FirewallRule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *FirewallRuleProperties `json:"properties,omitempty"` -} - -// FirewallRuleListResult is the response of list firewall rules Redis -// operation. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - Value *[]FirewallRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// FirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client FirewallRuleListResult) FirewallRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// FirewallRuleProperties is specifies a range of IP addresses permitted to -// connect to the cache -type FirewallRuleProperties struct { - StartIP *string `json:"startIP,omitempty"` - EndIP *string `json:"endIP,omitempty"` -} - -// ForceRebootResponse is response to force reboot for Redis cache. -type ForceRebootResponse struct { - autorest.Response `json:"-"` - Message *string `json:"Message,omitempty"` -} - -// ImportRDBParameters is parameters for Redis import operation. -type ImportRDBParameters struct { - Format *string `json:"format,omitempty"` - Files *[]string `json:"files,omitempty"` -} - -// ListResult is the response of list Redis operation. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]ResourceType `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Operation is rEST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that describes the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Operation *string `json:"operation,omitempty"` - Resource *string `json:"resource,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult is result of the request to list REST API operations. It -// contains a list of operations and a URL nextLink to get the next set of -// results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PatchSchedule is response to put/get patch schedules for Redis cache. -type PatchSchedule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - *ScheduleEntries `json:"properties,omitempty"` -} - -// Properties is properties supplied to Create or Update Redis operation. -type Properties struct { - RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` - ShardCount *int32 `json:"shardCount,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - StaticIP *string `json:"staticIP,omitempty"` -} - -// RebootParameters is specifies which Redis node(s) to reboot. -type RebootParameters struct { - RebootType RebootType `json:"rebootType,omitempty"` - ShardID *int32 `json:"shardId,omitempty"` -} - -// RegenerateKeyParameters is specifies which Redis access keys to reset. -type RegenerateKeyParameters struct { - KeyType KeyType `json:"keyType,omitempty"` -} - -// Resource is the Resource definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceProperties is parameters describing a Redis instance. -type ResourceProperties struct { - RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` - ShardCount *int32 `json:"shardCount,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - StaticIP *string `json:"staticIP,omitempty"` - Sku *Sku `json:"sku,omitempty"` - RedisVersion *string `json:"redisVersion,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - HostName *string `json:"hostName,omitempty"` - Port *int32 `json:"port,omitempty"` - SslPort *int32 `json:"sslPort,omitempty"` - AccessKeys *AccessKeys `json:"accessKeys,omitempty"` -} - -// ResourceType is a single Redis item in List or Get Operation. -type ResourceType struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ResourceProperties `json:"properties,omitempty"` -} - -// ScheduleEntries is list of patch schedules for a Redis cache. -type ScheduleEntries struct { - ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"` -} - -// ScheduleEntry is patch schedule entry for a Premium Redis Cache. -type ScheduleEntry struct { - DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` - StartHourUtc *int32 `json:"startHourUtc,omitempty"` - MaintenanceWindow *string `json:"maintenanceWindow,omitempty"` -} - -// Sku is sKU parameters supplied to the create Redis operation. -type Sku struct { - Name SkuName `json:"name,omitempty"` - Family SkuFamily `json:"family,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// UpdateParameters is parameters supplied to the Update Redis operation. -type UpdateParameters struct { - *UpdateProperties `json:"properties,omitempty"` -} - -// UpdateProperties is properties supplied to Update Redis operation. -type UpdateProperties struct { - RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` - EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` - TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` - ShardCount *int32 `json:"shardCount,omitempty"` - SubnetID *string `json:"subnetId,omitempty"` - StaticIP *string `json:"staticIP,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DayOfWeek enumerates the values for day of week. +type DayOfWeek string + +const ( + // Everyday specifies the everyday state for day of week. + Everyday DayOfWeek = "Everyday" + // Friday specifies the friday state for day of week. + Friday DayOfWeek = "Friday" + // Monday specifies the monday state for day of week. + Monday DayOfWeek = "Monday" + // Saturday specifies the saturday state for day of week. + Saturday DayOfWeek = "Saturday" + // Sunday specifies the sunday state for day of week. + Sunday DayOfWeek = "Sunday" + // Thursday specifies the thursday state for day of week. + Thursday DayOfWeek = "Thursday" + // Tuesday specifies the tuesday state for day of week. + Tuesday DayOfWeek = "Tuesday" + // Wednesday specifies the wednesday state for day of week. + Wednesday DayOfWeek = "Wednesday" + // Weekend specifies the weekend state for day of week. + Weekend DayOfWeek = "Weekend" +) + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // Primary specifies the primary state for key type. + Primary KeyType = "Primary" + // Secondary specifies the secondary state for key type. + Secondary KeyType = "Secondary" +) + +// RebootType enumerates the values for reboot type. +type RebootType string + +const ( + // AllNodes specifies the all nodes state for reboot type. + AllNodes RebootType = "AllNodes" + // PrimaryNode specifies the primary node state for reboot type. + PrimaryNode RebootType = "PrimaryNode" + // SecondaryNode specifies the secondary node state for reboot type. + SecondaryNode RebootType = "SecondaryNode" +) + +// SkuFamily enumerates the values for sku family. +type SkuFamily string + +const ( + // C specifies the c state for sku family. + C SkuFamily = "C" + // P specifies the p state for sku family. + P SkuFamily = "P" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Basic specifies the basic state for sku name. + Basic SkuName = "Basic" + // Premium specifies the premium state for sku name. + Premium SkuName = "Premium" + // Standard specifies the standard state for sku name. + Standard SkuName = "Standard" +) + +// AccessKeys is redis cache access keys. +type AccessKeys struct { + autorest.Response `json:"-"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} + +// CreateParameters is parameters supplied to the Create Redis operation. +type CreateParameters struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CreateProperties `json:"properties,omitempty"` +} + +// CreateProperties is properties supplied to Create Redis operation. +type CreateProperties struct { + RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` + ShardCount *int32 `json:"shardCount,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + StaticIP *string `json:"staticIP,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// ExportRDBParameters is parameters for Redis export operation. +type ExportRDBParameters struct { + Format *string `json:"format,omitempty"` + Prefix *string `json:"prefix,omitempty"` + Container *string `json:"container,omitempty"` +} + +// FirewallRule is a firewall rule on a redis cache has a name, and describes a +// contiguous range of IP addresses permitted to connect +type FirewallRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *FirewallRuleProperties `json:"properties,omitempty"` +} + +// FirewallRuleListResult is the response of list firewall rules Redis +// operation. +type FirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// FirewallRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client FirewallRuleListResult) FirewallRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// FirewallRuleProperties is specifies a range of IP addresses permitted to +// connect to the cache +type FirewallRuleProperties struct { + StartIP *string `json:"startIP,omitempty"` + EndIP *string `json:"endIP,omitempty"` +} + +// ForceRebootResponse is response to force reboot for Redis cache. +type ForceRebootResponse struct { + autorest.Response `json:"-"` + Message *string `json:"Message,omitempty"` +} + +// ImportRDBParameters is parameters for Redis import operation. +type ImportRDBParameters struct { + Format *string `json:"format,omitempty"` + Files *[]string `json:"files,omitempty"` +} + +// ListResult is the response of list Redis operation. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]ResourceType `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Operation is rEST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that describes the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult is result of the request to list REST API operations. It +// contains a list of operations and a URL nextLink to get the next set of +// results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PatchSchedule is response to put/get patch schedules for Redis cache. +type PatchSchedule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + *ScheduleEntries `json:"properties,omitempty"` +} + +// Properties is properties supplied to Create or Update Redis operation. +type Properties struct { + RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` + ShardCount *int32 `json:"shardCount,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + StaticIP *string `json:"staticIP,omitempty"` +} + +// RebootParameters is specifies which Redis node(s) to reboot. +type RebootParameters struct { + RebootType RebootType `json:"rebootType,omitempty"` + ShardID *int32 `json:"shardId,omitempty"` +} + +// RegenerateKeyParameters is specifies which Redis access keys to reset. +type RegenerateKeyParameters struct { + KeyType KeyType `json:"keyType,omitempty"` +} + +// Resource is the Resource definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceProperties is parameters describing a Redis instance. +type ResourceProperties struct { + RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` + ShardCount *int32 `json:"shardCount,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + StaticIP *string `json:"staticIP,omitempty"` + Sku *Sku `json:"sku,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + HostName *string `json:"hostName,omitempty"` + Port *int32 `json:"port,omitempty"` + SslPort *int32 `json:"sslPort,omitempty"` + AccessKeys *AccessKeys `json:"accessKeys,omitempty"` +} + +// ResourceType is a single Redis item in List or Get Operation. +type ResourceType struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ResourceProperties `json:"properties,omitempty"` +} + +// ScheduleEntries is list of patch schedules for a Redis cache. +type ScheduleEntries struct { + ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"` +} + +// ScheduleEntry is patch schedule entry for a Premium Redis Cache. +type ScheduleEntry struct { + DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` + StartHourUtc *int32 `json:"startHourUtc,omitempty"` + MaintenanceWindow *string `json:"maintenanceWindow,omitempty"` +} + +// Sku is sKU parameters supplied to the create Redis operation. +type Sku struct { + Name SkuName `json:"name,omitempty"` + Family SkuFamily `json:"family,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// UpdateParameters is parameters supplied to the Update Redis operation. +type UpdateParameters struct { + *UpdateProperties `json:"properties,omitempty"` +} + +// UpdateProperties is properties supplied to Update Redis operation. +type UpdateProperties struct { + RedisConfiguration *map[string]*string `json:"redisConfiguration,omitempty"` + EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` + TenantSettings *map[string]*string `json:"tenantSettings,omitempty"` + ShardCount *int32 `json:"shardCount,omitempty"` + SubnetID *string `json:"subnetId,omitempty"` + StaticIP *string `json:"staticIP,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/operations.go index 774d1ecbb7..f0e825dd1f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/operations.go @@ -1,123 +1,123 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the rEST API for Azure Redis Cache Service. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the Microsoft.Cache -// provider. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Cache/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the rEST API for Azure Redis Cache Service. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.Cache +// provider. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Cache/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/patchschedules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/patchschedules.go index e54519ff1f..44661ec9a6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/patchschedules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/patchschedules.go @@ -1,252 +1,252 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PatchSchedulesClient is the rEST API for Azure Redis Cache Service. -type PatchSchedulesClient struct { - ManagementClient -} - -// NewPatchSchedulesClient creates an instance of the PatchSchedulesClient -// client. -func NewPatchSchedulesClient(subscriptionID string) PatchSchedulesClient { - return NewPatchSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPatchSchedulesClientWithBaseURI creates an instance of the -// PatchSchedulesClient client. -func NewPatchSchedulesClientWithBaseURI(baseURI string, subscriptionID string) PatchSchedulesClient { - return PatchSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or replace the patching schedule for Redis cache -// (requires Premium SKU). -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is parameters to set the patching schedule for Redis -// cache. -func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PatchSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters PatchSchedule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result PatchSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the patching schedule of a redis cache (requires Premium -// SKU). -// -// resourceGroupName is the name of the resource group. name is the name of the -// redis cache. -func (client PatchSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PatchSchedulesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the patching schedule of a redis cache (requires Premium SKU). -// -// resourceGroupName is the name of the resource group. name is the name of the -// redis cache. -func (client PatchSchedulesClient) Get(resourceGroupName string, name string) (result PatchSchedule, err error) { - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PatchSchedulesClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PatchSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PatchSchedulesClient) GetResponder(resp *http.Response) (result PatchSchedule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PatchSchedulesClient is the rEST API for Azure Redis Cache Service. +type PatchSchedulesClient struct { + ManagementClient +} + +// NewPatchSchedulesClient creates an instance of the PatchSchedulesClient +// client. +func NewPatchSchedulesClient(subscriptionID string) PatchSchedulesClient { + return NewPatchSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPatchSchedulesClientWithBaseURI creates an instance of the +// PatchSchedulesClient client. +func NewPatchSchedulesClientWithBaseURI(baseURI string, subscriptionID string) PatchSchedulesClient { + return PatchSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace the patching schedule for Redis cache +// (requires Premium SKU). +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is parameters to set the patching schedule for Redis +// cache. +func (client PatchSchedulesClient) CreateOrUpdate(resourceGroupName string, name string, parameters PatchSchedule) (result PatchSchedule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ScheduleEntries", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ScheduleEntries.ScheduleEntries", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "redis.PatchSchedulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PatchSchedulesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters PatchSchedule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PatchSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PatchSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result PatchSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the patching schedule of a redis cache (requires Premium +// SKU). +// +// resourceGroupName is the name of the resource group. name is the name of the +// redis cache. +func (client PatchSchedulesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PatchSchedulesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PatchSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PatchSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the patching schedule of a redis cache (requires Premium SKU). +// +// resourceGroupName is the name of the resource group. name is the name of the +// redis cache. +func (client PatchSchedulesClient) Get(resourceGroupName string, name string) (result PatchSchedule, err error) { + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.PatchSchedulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PatchSchedulesClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PatchSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PatchSchedulesClient) GetResponder(resp *http.Response) (result PatchSchedule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/redisgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/redisgroup.go index 4d591e32a7..af411bfaab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/redisgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/redisgroup.go @@ -1,916 +1,916 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupClient is the rEST API for Azure Redis Cache Service. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create or replace (overwrite/recreate, with potential downtime) an -// existing Redis cache. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is parameters supplied to the Create Redis -// operation. -func (client GroupClient) Create(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (<-chan ResourceType, <-chan error) { - resultChan := make(chan ResourceType, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CreateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ResourceType - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, name, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client GroupClient) CreatePreparer(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Redis cache. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. -func (client GroupClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportData export data from the redis cache to blobs in a container. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is parameters for Redis export operation. -func (client GroupClient) ExportData(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Prefix", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Container", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "ExportData") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExportDataPreparer(resourceGroupName, name, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", nil, "Failure preparing request") - return - } - - resp, err := client.ExportDataSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure sending request") - return - } - - result, err = client.ExportDataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExportDataPreparer prepares the ExportData request. -func (client GroupClient) ExportDataPreparer(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExportDataSender sends the ExportData request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ExportDataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExportDataResponder handles the response to the ExportData request. The method always -// closes the http.Response Body. -func (client GroupClient) ExportDataResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ForceReboot reboot specified Redis node(s). This operation requires write -// permission to the cache resource. There can be potential data loss. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is specifies which Redis node(s) to reboot. -func (client GroupClient) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result ForceRebootResponse, err error) { - req, err := client.ForceRebootPreparer(resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", nil, "Failure preparing request") - return - } - - resp, err := client.ForceRebootSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure sending request") - return - } - - result, err = client.ForceRebootResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure responding to request") - } - - return -} - -// ForceRebootPreparer prepares the ForceReboot request. -func (client GroupClient) ForceRebootPreparer(resourceGroupName string, name string, parameters RebootParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ForceRebootSender sends the ForceReboot request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ForceRebootSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ForceRebootResponder handles the response to the ForceReboot request. The method always -// closes the http.Response Body. -func (client GroupClient) ForceRebootResponder(resp *http.Response) (result ForceRebootResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a Redis cache (resource description). -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. -func (client GroupClient) Get(resourceGroupName string, name string) (result ResourceType, err error) { - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportData import data into Redis cache. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is parameters for Redis import operation. -func (client GroupClient) ImportData(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Files", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "ImportData") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ImportDataPreparer(resourceGroupName, name, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", nil, "Failure preparing request") - return - } - - resp, err := client.ImportDataSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure sending request") - return - } - - result, err = client.ImportDataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ImportDataPreparer prepares the ImportData request. -func (client GroupClient) ImportDataPreparer(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ImportDataSender sends the ImportData request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ImportDataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ImportDataResponder handles the response to the ImportData request. The method always -// closes the http.Response Body. -func (client GroupClient) ImportDataResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List gets all Redis caches in the specified subscription. -func (client GroupClient) List() (result ListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists all Redis caches in a resource group. -// -// resourceGroupName is the name of the resource group. -func (client GroupClient) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client GroupClient) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys retrieve a Redis cache's access keys. This operation requires write -// permission to the cache resource. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. -func (client GroupClient) ListKeys(resourceGroupName string, name string) (result AccessKeys, err error) { - req, err := client.ListKeysPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client GroupClient) ListKeysPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client GroupClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate Redis cache's access keys. This operation requires -// write permission to the cache resource. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is specifies which key to regenerate. -func (client GroupClient) RegenerateKey(resourceGroupName string, name string, parameters RegenerateKeyParameters) (result AccessKeys, err error) { - req, err := client.RegenerateKeyPreparer(resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client GroupClient) RegenerateKeyPreparer(resourceGroupName string, name string, parameters RegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client GroupClient) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update an existing Redis cache. -// -// resourceGroupName is the name of the resource group. name is the name of the -// Redis cache. parameters is parameters supplied to the Update Redis -// operation. -func (client GroupClient) Update(resourceGroupName string, name string, parameters UpdateParameters) (result ResourceType, err error) { - req, err := client.UpdatePreparer(resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, parameters UpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupClient) UpdateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupClient is the rEST API for Azure Redis Cache Service. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create or replace (overwrite/recreate, with potential downtime) an +// existing Redis cache. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is parameters supplied to the Create Redis +// operation. +func (client GroupClient) Create(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (<-chan ResourceType, <-chan error) { + resultChan := make(chan ResourceType, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CreateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.CreateProperties.Sku.Capacity", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ResourceType + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, name, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client GroupClient) CreatePreparer(resourceGroupName string, name string, parameters CreateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Redis cache. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. +func (client GroupClient) Delete(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client GroupClient) DeletePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportData export data from the redis cache to blobs in a container. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is parameters for Redis export operation. +func (client GroupClient) ExportData(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Prefix", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Container", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "ExportData") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExportDataPreparer(resourceGroupName, name, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", nil, "Failure preparing request") + return + } + + resp, err := client.ExportDataSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure sending request") + return + } + + result, err = client.ExportDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ExportData", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExportDataPreparer prepares the ExportData request. +func (client GroupClient) ExportDataPreparer(resourceGroupName string, name string, parameters ExportRDBParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExportDataSender sends the ExportData request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ExportDataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExportDataResponder handles the response to the ExportData request. The method always +// closes the http.Response Body. +func (client GroupClient) ExportDataResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ForceReboot reboot specified Redis node(s). This operation requires write +// permission to the cache resource. There can be potential data loss. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is specifies which Redis node(s) to reboot. +func (client GroupClient) ForceReboot(resourceGroupName string, name string, parameters RebootParameters) (result ForceRebootResponse, err error) { + req, err := client.ForceRebootPreparer(resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", nil, "Failure preparing request") + return + } + + resp, err := client.ForceRebootSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure sending request") + return + } + + result, err = client.ForceRebootResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ForceReboot", resp, "Failure responding to request") + } + + return +} + +// ForceRebootPreparer prepares the ForceReboot request. +func (client GroupClient) ForceRebootPreparer(resourceGroupName string, name string, parameters RebootParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ForceRebootSender sends the ForceReboot request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ForceRebootSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ForceRebootResponder handles the response to the ForceReboot request. The method always +// closes the http.Response Body. +func (client GroupClient) ForceRebootResponder(resp *http.Response) (result ForceRebootResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a Redis cache (resource description). +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. +func (client GroupClient) Get(resourceGroupName string, name string) (result ResourceType, err error) { + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ImportData import data into Redis cache. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is parameters for Redis import operation. +func (client GroupClient) ImportData(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Files", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "redis.GroupClient", "ImportData") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ImportDataPreparer(resourceGroupName, name, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", nil, "Failure preparing request") + return + } + + resp, err := client.ImportDataSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure sending request") + return + } + + result, err = client.ImportDataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ImportData", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ImportDataPreparer prepares the ImportData request. +func (client GroupClient) ImportDataPreparer(resourceGroupName string, name string, parameters ImportRDBParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ImportDataSender sends the ImportData request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ImportDataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ImportDataResponder handles the response to the ImportData request. The method always +// closes the http.Response Body. +func (client GroupClient) ImportDataResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// List gets all Redis caches in the specified subscription. +func (client GroupClient) List() (result ListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists all Redis caches in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client GroupClient) ListByResourceGroup(resourceGroupName string) (result ListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client GroupClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client GroupClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client GroupClient) ListByResourceGroupNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys retrieve a Redis cache's access keys. This operation requires write +// permission to the cache resource. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. +func (client GroupClient) ListKeys(resourceGroupName string, name string) (result AccessKeys, err error) { + req, err := client.ListKeysPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client GroupClient) ListKeysPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client GroupClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate Redis cache's access keys. This operation requires +// write permission to the cache resource. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is specifies which key to regenerate. +func (client GroupClient) RegenerateKey(resourceGroupName string, name string, parameters RegenerateKeyParameters) (result AccessKeys, err error) { + req, err := client.RegenerateKeyPreparer(resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client GroupClient) RegenerateKeyPreparer(resourceGroupName string, name string, parameters RegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client GroupClient) RegenerateKeyResponder(resp *http.Response) (result AccessKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update an existing Redis cache. +// +// resourceGroupName is the name of the resource group. name is the name of the +// Redis cache. parameters is parameters supplied to the Update Redis +// operation. +func (client GroupClient) Update(resourceGroupName string, name string, parameters UpdateParameters) (result ResourceType, err error) { + req, err := client.UpdatePreparer(resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redis.GroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GroupClient) UpdatePreparer(resourceGroupName string, name string, parameters UpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GroupClient) UpdateResponder(resp *http.Response) (result ResourceType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/version.go index 11b823ca55..c5a6a48ad7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/redis/version.go @@ -1,29 +1,29 @@ -package redis - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-redis/2016-04-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package redis + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-redis/2016-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/client.go index b5391733a8..ea5cfe545c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/client.go @@ -1,53 +1,53 @@ -// Package relay implements the Azure ARM Relay service API version 2016-07-01. -// -// Use these API to manage Azure Relay resources through Azure Resources -// Manager. -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Relay - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Relay. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package relay implements the Azure ARM Relay service API version 2016-07-01. +// +// Use these API to manage Azure Relay resources through Azure Resources +// Manager. +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Relay + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Relay. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/hybridconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/hybridconnections.go index ff7640350c..8812f00727 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/hybridconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/hybridconnections.go @@ -1,943 +1,943 @@ -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// HybridConnectionsClient is the use these API to manage Azure Relay resources -// through Azure Resources Manager. -type HybridConnectionsClient struct { - ManagementClient -} - -// NewHybridConnectionsClient creates an instance of the -// HybridConnectionsClient client. -func NewHybridConnectionsClient(subscriptionID string) HybridConnectionsClient { - return NewHybridConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHybridConnectionsClientWithBaseURI creates an instance of the -// HybridConnectionsClient client. -func NewHybridConnectionsClientWithBaseURI(baseURI string, subscriptionID string) HybridConnectionsClient { - return HybridConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a service HybridConnection. This operation -// is idempotent. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. parameters is parameters supplied to create a -// HybridConnection. -func (client HybridConnectionsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, hybridConnectionName string, parameters HybridConnection) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.HybridConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.HybridConnectionProperties.ListenerCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.HybridConnectionProperties.ListenerCount", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "parameters.HybridConnectionProperties.ListenerCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, hybridConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client HybridConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, parameters HybridConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or Updates an authorization rule for -// a HybridConnection -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. authorizationRuleName is the authorizationRule -// name. parameters is the authorization rule parameters -func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters AuthorizationRule) (result AuthorizationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a HybridConnection . -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. -func (client HybridConnectionsClient) Delete(resourceGroupName string, namespaceName string, hybridConnectionName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, hybridConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HybridConnectionsClient) DeletePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a HybridConnection authorization rule -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. authorizationRuleName is the authorizationRule -// name. -func (client HybridConnectionsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client HybridConnectionsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the description for the specified HybridConnection. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. -func (client HybridConnectionsClient) Get(resourceGroupName string, namespaceName string, hybridConnectionName string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, hybridConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client HybridConnectionsClient) GetPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) GetResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule hybridConnection authorizationRule for a -// HybridConnection by name. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. authorizationRuleName is the authorizationRule -// name. -func (client HybridConnectionsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (result AuthorizationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client HybridConnectionsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRules authorization rules for a HybridConnection. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. -func (client HybridConnectionsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, hybridConnectionName string) (result AuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, hybridConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client HybridConnectionsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client HybridConnectionsClient) ListAuthorizationRulesNextResults(lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { - req, err := lastResults.AuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListByNamespace lists the HybridConnection within the namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name -func (client HybridConnectionsClient) ListByNamespace(resourceGroupName string, namespaceName string) (result HybridConnectionListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "ListByNamespace") - } - - req, err := client.ListByNamespacePreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure sending request") - return - } - - result, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure responding to request") - } - - return -} - -// ListByNamespacePreparer prepares the ListByNamespace request. -func (client HybridConnectionsClient) ListByNamespacePreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByNamespaceSender sends the ListByNamespace request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) ListByNamespaceResponder(resp *http.Response) (result HybridConnectionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNamespaceNextResults retrieves the next set of results, if any. -func (client HybridConnectionsClient) ListByNamespaceNextResults(lastResults HybridConnectionListResult) (result HybridConnectionListResult, err error) { - req, err := lastResults.HybridConnectionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure sending next results request") - } - - result, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys primary and Secondary ConnectionStrings to the HybridConnection. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. authorizationRuleName is the authorizationRule -// name. -func (client HybridConnectionsClient) ListKeys(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (result AuthorizationRuleKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client HybridConnectionsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) ListKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary or Secondary ConnectionStrings to the -// HybridConnection -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name hybridConnectionName is -// the hybrid connection name. authorizationRuleName is the authorizationRule -// name. parameters is parameters supplied to regenerate Auth Rule. -func (client HybridConnectionsClient) RegenerateKeys(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result AuthorizationRuleKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: hybridConnectionName, - Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client HybridConnectionsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "hybridConnectionName": autorest.Encode("path", hybridConnectionName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client HybridConnectionsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client HybridConnectionsClient) RegenerateKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// HybridConnectionsClient is the use these API to manage Azure Relay resources +// through Azure Resources Manager. +type HybridConnectionsClient struct { + ManagementClient +} + +// NewHybridConnectionsClient creates an instance of the +// HybridConnectionsClient client. +func NewHybridConnectionsClient(subscriptionID string) HybridConnectionsClient { + return NewHybridConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHybridConnectionsClientWithBaseURI creates an instance of the +// HybridConnectionsClient client. +func NewHybridConnectionsClientWithBaseURI(baseURI string, subscriptionID string) HybridConnectionsClient { + return HybridConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a service HybridConnection. This operation +// is idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. parameters is parameters supplied to create a +// HybridConnection. +func (client HybridConnectionsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, hybridConnectionName string, parameters HybridConnection) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.HybridConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HybridConnectionProperties.ListenerCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HybridConnectionProperties.ListenerCount", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "parameters.HybridConnectionProperties.ListenerCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, hybridConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client HybridConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, parameters HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates or Updates an authorization rule for +// a HybridConnection +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. authorizationRuleName is the authorizationRule +// name. parameters is the authorization rule parameters +func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters AuthorizationRule) (result AuthorizationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a HybridConnection . +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. +func (client HybridConnectionsClient) Delete(resourceGroupName string, namespaceName string, hybridConnectionName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, hybridConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client HybridConnectionsClient) DeletePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a HybridConnection authorization rule +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. authorizationRuleName is the authorizationRule +// name. +func (client HybridConnectionsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client HybridConnectionsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the description for the specified HybridConnection. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. +func (client HybridConnectionsClient) Get(resourceGroupName string, namespaceName string, hybridConnectionName string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, hybridConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client HybridConnectionsClient) GetPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) GetResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule hybridConnection authorizationRule for a +// HybridConnection by name. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. authorizationRuleName is the authorizationRule +// name. +func (client HybridConnectionsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (result AuthorizationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client HybridConnectionsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules authorization rules for a HybridConnection. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. +func (client HybridConnectionsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, hybridConnectionName string) (result AuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, hybridConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client HybridConnectionsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client HybridConnectionsClient) ListAuthorizationRulesNextResults(lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { + req, err := lastResults.AuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListByNamespace lists the HybridConnection within the namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name +func (client HybridConnectionsClient) ListByNamespace(resourceGroupName string, namespaceName string) (result HybridConnectionListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "ListByNamespace") + } + + req, err := client.ListByNamespacePreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure sending request") + return + } + + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure responding to request") + } + + return +} + +// ListByNamespacePreparer prepares the ListByNamespace request. +func (client HybridConnectionsClient) ListByNamespacePreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByNamespaceSender sends the ListByNamespace request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) ListByNamespaceResponder(resp *http.Response) (result HybridConnectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByNamespaceNextResults retrieves the next set of results, if any. +func (client HybridConnectionsClient) ListByNamespaceNextResults(lastResults HybridConnectionListResult) (result HybridConnectionListResult, err error) { + req, err := lastResults.HybridConnectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure sending next results request") + } + + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListByNamespace", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys primary and Secondary ConnectionStrings to the HybridConnection. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. authorizationRuleName is the authorizationRule +// name. +func (client HybridConnectionsClient) ListKeys(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (result AuthorizationRuleKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client HybridConnectionsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) ListKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the Primary or Secondary ConnectionStrings to the +// HybridConnection +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name hybridConnectionName is +// the hybrid connection name. authorizationRuleName is the authorizationRule +// name. parameters is parameters supplied to regenerate Auth Rule. +func (client HybridConnectionsClient) RegenerateKeys(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result AuthorizationRuleKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: hybridConnectionName, + Constraints: []validation.Constraint{{Target: "hybridConnectionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "hybridConnectionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.HybridConnectionsClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.HybridConnectionsClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client HybridConnectionsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, hybridConnectionName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "hybridConnectionName": autorest.Encode("path", hybridConnectionName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client HybridConnectionsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client HybridConnectionsClient) RegenerateKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/models.go index f211658029..fb724b6ee9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/models.go @@ -1,330 +1,330 @@ -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // Listen specifies the listen state for access rights. - Listen AccessRights = "Listen" - // Manage specifies the manage state for access rights. - Manage AccessRights = "Manage" - // Send specifies the send state for access rights. - Send AccessRights = "Send" -) - -// PolicyKey enumerates the values for policy key. -type PolicyKey string - -const ( - // PrimaryKey specifies the primary key state for policy key. - PrimaryKey PolicyKey = "PrimaryKey" - // SecondaryKey specifies the secondary key state for policy key. - SecondaryKey PolicyKey = "SecondaryKey" -) - -// RelaytypeEnum enumerates the values for relaytype enum. -type RelaytypeEnum string - -const ( - // HTTP specifies the http state for relaytype enum. - HTTP RelaytypeEnum = "Http" - // NetTCP specifies the net tcp state for relaytype enum. - NetTCP RelaytypeEnum = "NetTcp" -) - -// UnavailableReason enumerates the values for unavailable reason. -type UnavailableReason string - -const ( - // InvalidName specifies the invalid name state for unavailable reason. - InvalidName UnavailableReason = "InvalidName" - // NameInLockdown specifies the name in lockdown state for unavailable - // reason. - NameInLockdown UnavailableReason = "NameInLockdown" - // NameInUse specifies the name in use state for unavailable reason. - NameInUse UnavailableReason = "NameInUse" - // None specifies the none state for unavailable reason. - None UnavailableReason = "None" - // SubscriptionIsDisabled specifies the subscription is disabled state for - // unavailable reason. - SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" - // TooManyNamespaceInCurrentSubscription specifies the too many namespace - // in current subscription state for unavailable reason. - TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" -) - -// AuthorizationRule is description of a Namespace AuthorizationRules. -type AuthorizationRule struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *AuthorizationRuleProperties `json:"properties,omitempty"` -} - -// AuthorizationRuleKeys is namespace/Relay Connection String -type AuthorizationRuleKeys struct { - autorest.Response `json:"-"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - KeyName *string `json:"keyName,omitempty"` -} - -// AuthorizationRuleListResult is the response of the List Namespace operation. -type AuthorizationRuleListResult struct { - autorest.Response `json:"-"` - Value *[]AuthorizationRule `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AuthorizationRuleListResult) AuthorizationRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AuthorizationRuleProperties is authorizationRule properties. -type AuthorizationRuleProperties struct { - Rights *[]AccessRights `json:"rights,omitempty"` -} - -// CheckNameAvailability is description of a Check Name availability request -// properties. -type CheckNameAvailability struct { - Name *string `json:"name,omitempty"` -} - -// CheckNameAvailabilityResult is description of a Check Name availability -// request properties. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason UnavailableReason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ErrorResponse is error reponse indicates Relay service is not able to -// process the incoming request. The reason is provided in the error message. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// HybridConnection is description of HybridConnection Resource. -type HybridConnection struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *HybridConnectionProperties `json:"properties,omitempty"` -} - -// HybridConnectionListResult is the response of the List HybridConnection -// operation. -type HybridConnectionListResult struct { - autorest.Response `json:"-"` - Value *[]HybridConnection `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// HybridConnectionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client HybridConnectionListResult) HybridConnectionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// HybridConnectionProperties is properties of the HybridConnection. -type HybridConnectionProperties struct { - CreatedAt *date.Time `json:"createdAt,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - ListenerCount *int32 `json:"listenerCount,omitempty"` - RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` - UserMetadata *string `json:"userMetadata,omitempty"` -} - -// Namespace is description of a Namespace resource. -type Namespace struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// NamespaceListResult is the response of the List Namespace operation. -type NamespaceListResult struct { - autorest.Response `json:"-"` - Value *[]Namespace `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NamespaceProperties is properties of the Namespace. -type NamespaceProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - MetricID *string `json:"metricId,omitempty"` -} - -// NamespaceUpdateParameter is parameters supplied to the Patch Namespace -// operation. -type NamespaceUpdateParameter struct { - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// Operation is a EventHub REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list EventHub operations. It -// contains a list of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// RegenerateKeysParameters is parameters supplied to the Regenerate -// Authorization Rule operation. -type RegenerateKeysParameters struct { - PolicyKey PolicyKey `json:"policyKey,omitempty"` -} - -// Resource is the Resource definition -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// Sku is sku of the Namespace. -type Sku struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` -} - -// TrackedResource is definition of Resource -type TrackedResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// WcfRelay is description of WcfRelays Resource. -type WcfRelay struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *WcfRelayProperties `json:"properties,omitempty"` -} - -// WcfRelayProperties is properties of the WcfRelay Properties. -type WcfRelayProperties struct { - RelayType RelaytypeEnum `json:"relayType,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - ListenerCount *int32 `json:"listenerCount,omitempty"` - RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` - RequiresTransportSecurity *bool `json:"requiresTransportSecurity,omitempty"` - IsDynamic *bool `json:"isDynamic,omitempty"` - UserMetadata *string `json:"userMetadata,omitempty"` -} - -// WcfRelaysListResult is the response of the List WcfRelays operation. -type WcfRelaysListResult struct { - autorest.Response `json:"-"` - Value *[]WcfRelay `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WcfRelaysListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WcfRelaysListResult) WcfRelaysListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // Listen specifies the listen state for access rights. + Listen AccessRights = "Listen" + // Manage specifies the manage state for access rights. + Manage AccessRights = "Manage" + // Send specifies the send state for access rights. + Send AccessRights = "Send" +) + +// PolicyKey enumerates the values for policy key. +type PolicyKey string + +const ( + // PrimaryKey specifies the primary key state for policy key. + PrimaryKey PolicyKey = "PrimaryKey" + // SecondaryKey specifies the secondary key state for policy key. + SecondaryKey PolicyKey = "SecondaryKey" +) + +// RelaytypeEnum enumerates the values for relaytype enum. +type RelaytypeEnum string + +const ( + // HTTP specifies the http state for relaytype enum. + HTTP RelaytypeEnum = "Http" + // NetTCP specifies the net tcp state for relaytype enum. + NetTCP RelaytypeEnum = "NetTcp" +) + +// UnavailableReason enumerates the values for unavailable reason. +type UnavailableReason string + +const ( + // InvalidName specifies the invalid name state for unavailable reason. + InvalidName UnavailableReason = "InvalidName" + // NameInLockdown specifies the name in lockdown state for unavailable + // reason. + NameInLockdown UnavailableReason = "NameInLockdown" + // NameInUse specifies the name in use state for unavailable reason. + NameInUse UnavailableReason = "NameInUse" + // None specifies the none state for unavailable reason. + None UnavailableReason = "None" + // SubscriptionIsDisabled specifies the subscription is disabled state for + // unavailable reason. + SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + // TooManyNamespaceInCurrentSubscription specifies the too many namespace + // in current subscription state for unavailable reason. + TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// AuthorizationRule is description of a Namespace AuthorizationRules. +type AuthorizationRule struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *AuthorizationRuleProperties `json:"properties,omitempty"` +} + +// AuthorizationRuleKeys is namespace/Relay Connection String +type AuthorizationRuleKeys struct { + autorest.Response `json:"-"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + KeyName *string `json:"keyName,omitempty"` +} + +// AuthorizationRuleListResult is the response of the List Namespace operation. +type AuthorizationRuleListResult struct { + autorest.Response `json:"-"` + Value *[]AuthorizationRule `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AuthorizationRuleListResult) AuthorizationRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AuthorizationRuleProperties is authorizationRule properties. +type AuthorizationRuleProperties struct { + Rights *[]AccessRights `json:"rights,omitempty"` +} + +// CheckNameAvailability is description of a Check Name availability request +// properties. +type CheckNameAvailability struct { + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult is description of a Check Name availability +// request properties. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason UnavailableReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ErrorResponse is error reponse indicates Relay service is not able to +// process the incoming request. The reason is provided in the error message. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// HybridConnection is description of HybridConnection Resource. +type HybridConnection struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *HybridConnectionProperties `json:"properties,omitempty"` +} + +// HybridConnectionListResult is the response of the List HybridConnection +// operation. +type HybridConnectionListResult struct { + autorest.Response `json:"-"` + Value *[]HybridConnection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// HybridConnectionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client HybridConnectionListResult) HybridConnectionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// HybridConnectionProperties is properties of the HybridConnection. +type HybridConnectionProperties struct { + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ListenerCount *int32 `json:"listenerCount,omitempty"` + RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` + UserMetadata *string `json:"userMetadata,omitempty"` +} + +// Namespace is description of a Namespace resource. +type Namespace struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceListResult is the response of the List Namespace operation. +type NamespaceListResult struct { + autorest.Response `json:"-"` + Value *[]Namespace `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NamespaceProperties is properties of the Namespace. +type NamespaceProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + MetricID *string `json:"metricId,omitempty"` +} + +// NamespaceUpdateParameter is parameters supplied to the Patch Namespace +// operation. +type NamespaceUpdateParameter struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// Operation is a EventHub REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list EventHub operations. It +// contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// RegenerateKeysParameters is parameters supplied to the Regenerate +// Authorization Rule operation. +type RegenerateKeysParameters struct { + PolicyKey PolicyKey `json:"policyKey,omitempty"` +} + +// Resource is the Resource definition +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// Sku is sku of the Namespace. +type Sku struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} + +// TrackedResource is definition of Resource +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// WcfRelay is description of WcfRelays Resource. +type WcfRelay struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *WcfRelayProperties `json:"properties,omitempty"` +} + +// WcfRelayProperties is properties of the WcfRelay Properties. +type WcfRelayProperties struct { + RelayType RelaytypeEnum `json:"relayType,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ListenerCount *int32 `json:"listenerCount,omitempty"` + RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` + RequiresTransportSecurity *bool `json:"requiresTransportSecurity,omitempty"` + IsDynamic *bool `json:"isDynamic,omitempty"` + UserMetadata *string `json:"userMetadata,omitempty"` +} + +// WcfRelaysListResult is the response of the List WcfRelays operation. +type WcfRelaysListResult struct { + autorest.Response `json:"-"` + Value *[]WcfRelay `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WcfRelaysListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WcfRelaysListResult) WcfRelaysListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/namespaces.go index ffb6cae5e9..1f3b4f05f9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/namespaces.go @@ -1,1167 +1,1167 @@ -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NamespacesClient is the use these API to manage Azure Relay resources -// through Azure Resources Manager. -type NamespacesClient struct { - ManagementClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient -// client. -func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailabilityMethod check the give namespace name availability. -// -// parameters is parameters to check availability of the given namespace name -func (client NamespacesClient) CheckNameAvailabilityMethod(parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod") - } - - req, err := client.CheckNameAvailabilityMethodPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilityMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. -func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(parameters CheckNameAvailability) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Relay/CheckNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create Azure Relay namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name parameters is parameters -// supplied to create a Namespace Resource. -func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters Namespace, cancel <-chan struct{}) (<-chan Namespace, <-chan error) { - resultChan := make(chan Namespace, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Sku.Tier", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Namespace - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters Namespace, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result Namespace, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or Updates an authorization rule for -// a namespace -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name authorizationRuleName is -// the authorizationRule name. parameters is the authorization rule parameters -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters AuthorizationRule) (result AuthorizationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing namespace. This operation also removes all -// associated resources under the namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name -func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a namespace authorization rule -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name authorizationRuleName is -// the authorizationRule name. -func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the description for the specified namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name -func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result Namespace, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result Namespace, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule authorization rule for a namespace by name. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name authorizationRuleName is -// the authorizationRule name. -func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result AuthorizationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the available namespaces within the subscription irrespective -// of the resourceGroups. -func (client NamespacesClient) List() (result NamespaceListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client NamespacesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Relay/Namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAuthorizationRules authorization rules for a namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name -func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result AuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { - req, err := lastResults.AuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists all the available namespaces within the -// ResourceGroup. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. -func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/Namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys primary and Secondary ConnectionStrings to the namespace -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name authorizationRuleName is -// the authorizationRule name. -func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result AuthorizationRuleKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary or Secondary ConnectionStrings to the -// namespace -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name authorizationRuleName is -// the authorizationRule name. parameters is parameters supplied to regenerate -// Auth Rule. -func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result AuthorizationRuleKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update creates or updates a namespace. Once created, this namespace's -// resource manifest is immutable. This operation is idempotent. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name parameters is parameters -// for updating a namespace resource. -func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (result Namespace, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NamespacesClient) UpdateResponder(resp *http.Response) (result Namespace, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NamespacesClient is the use these API to manage Azure Relay resources +// through Azure Resources Manager. +type NamespacesClient struct { + ManagementClient +} + +// NewNamespacesClient creates an instance of the NamespacesClient client. +func NewNamespacesClient(subscriptionID string) NamespacesClient { + return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient +// client. +func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { + return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailabilityMethod check the give namespace name availability. +// +// parameters is parameters to check availability of the given namespace name +func (client NamespacesClient) CheckNameAvailabilityMethod(parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod") + } + + req, err := client.CheckNameAvailabilityMethodPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilityMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. +func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(parameters CheckNameAvailability) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Relay/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create Azure Relay namespace. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name parameters is parameters +// supplied to create a Namespace Resource. +func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters Namespace, cancel <-chan struct{}) (<-chan Namespace, <-chan error) { + resultChan := make(chan Namespace, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Sku.Tier", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Namespace + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters Namespace, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result Namespace, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates or Updates an authorization rule for +// a namespace +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name authorizationRuleName is +// the authorizationRule name. parameters is the authorization rule parameters +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters AuthorizationRule) (result AuthorizationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing namespace. This operation also removes all +// associated resources under the namespace. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name +func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a namespace authorization rule +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name authorizationRuleName is +// the authorizationRule name. +func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the description for the specified namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name +func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result Namespace, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetResponder(resp *http.Response) (result Namespace, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule authorization rule for a namespace by name. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name authorizationRuleName is +// the authorizationRule name. +func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result AuthorizationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the available namespaces within the subscription irrespective +// of the resourceGroups. +func (client NamespacesClient) List() (result NamespaceListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client NamespacesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Relay/Namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules authorization rules for a namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name +func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result AuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { + req, err := lastResults.AuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists all the available namespaces within the +// ResourceGroup. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. +func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/Namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys primary and Secondary ConnectionStrings to the namespace +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name authorizationRuleName is +// the authorizationRule name. +func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result AuthorizationRuleKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the Primary or Secondary ConnectionStrings to the +// namespace +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name authorizationRuleName is +// the authorizationRule name. parameters is parameters supplied to regenerate +// Auth Rule. +func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result AuthorizationRuleKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update creates or updates a namespace. Once created, this namespace's +// resource manifest is immutable. This operation is idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name parameters is parameters +// for updating a namespace resource. +func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (result Namespace, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.NamespacesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.NamespacesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NamespacesClient) UpdateResponder(resp *http.Response) (result Namespace, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/operations.go index a5a1211126..d1273efe23 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/operations.go @@ -1,123 +1,123 @@ -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the use these API to manage Azure Relay resources -// through Azure Resources Manager. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Relay REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Relay/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the use these API to manage Azure Relay resources +// through Azure Resources Manager. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Relay REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Relay/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/version.go index 75adb20470..0dae982aa2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/version.go @@ -1,29 +1,29 @@ -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-relay/2016-07-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-relay/2016-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/wcfrelays.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/wcfrelays.go index 8c556a73d2..eb1a57661d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/wcfrelays.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/relay/wcfrelays.go @@ -1,929 +1,929 @@ -package relay - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WCFRelaysClient is the use these API to manage Azure Relay resources through -// Azure Resources Manager. -type WCFRelaysClient struct { - ManagementClient -} - -// NewWCFRelaysClient creates an instance of the WCFRelaysClient client. -func NewWCFRelaysClient(subscriptionID string) WCFRelaysClient { - return NewWCFRelaysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWCFRelaysClientWithBaseURI creates an instance of the WCFRelaysClient -// client. -func NewWCFRelaysClientWithBaseURI(baseURI string, subscriptionID string) WCFRelaysClient { - return WCFRelaysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or Updates a WCFRelay. This operation is idempotent. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name parameters is parameters supplied to create a WCFRelays. -func (client WCFRelaysClient) CreateOrUpdate(resourceGroupName string, namespaceName string, relayName string, parameters WcfRelay) (result WcfRelay, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, relayName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WCFRelaysClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, relayName string, parameters WcfRelay) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) CreateOrUpdateResponder(resp *http.Response) (result WcfRelay, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or Updates an authorization rule for -// a WCFRelays -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name authorizationRuleName is the authorizationRule name. parameters is the -// authorization rule parameters. -func (client WCFRelaysClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters AuthorizationRule) (result AuthorizationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client WCFRelaysClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a WCFRelays . -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name -func (client WCFRelaysClient) Delete(resourceGroupName string, namespaceName string, relayName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WCFRelaysClient) DeletePreparer(resourceGroupName string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a WCFRelays authorization rule -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name authorizationRuleName is the authorizationRule name. -func (client WCFRelaysClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client WCFRelaysClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the description for the specified WCFRelays. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name -func (client WCFRelaysClient) Get(resourceGroupName string, namespaceName string, relayName string) (result WcfRelay, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WCFRelaysClient) GetPreparer(resourceGroupName string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) GetResponder(resp *http.Response) (result WcfRelay, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule get authorizationRule for a WCFRelays by name. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name authorizationRuleName is the authorizationRule name. -func (client WCFRelaysClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (result AuthorizationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client WCFRelaysClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRules authorization rules for a WCFRelays. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name -func (client WCFRelaysClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, relayName string) (result AuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client WCFRelaysClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client WCFRelaysClient) ListAuthorizationRulesNextResults(lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { - req, err := lastResults.AuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListByNamespace lists the WCFRelays within the namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name -func (client WCFRelaysClient) ListByNamespace(resourceGroupName string, namespaceName string) (result WcfRelaysListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "ListByNamespace") - } - - req, err := client.ListByNamespacePreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure sending request") - return - } - - result, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure responding to request") - } - - return -} - -// ListByNamespacePreparer prepares the ListByNamespace request. -func (client WCFRelaysClient) ListByNamespacePreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByNamespaceSender sends the ListByNamespace request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) ListByNamespaceResponder(resp *http.Response) (result WcfRelaysListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNamespaceNextResults retrieves the next set of results, if any. -func (client WCFRelaysClient) ListByNamespaceNextResults(lastResults WcfRelaysListResult) (result WcfRelaysListResult, err error) { - req, err := lastResults.WcfRelaysListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure sending next results request") - } - - result, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys primary and Secondary ConnectionStrings to the WCFRelays. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name authorizationRuleName is the authorizationRule name. -func (client WCFRelaysClient) ListKeys(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (result AuthorizationRuleKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client WCFRelaysClient) ListKeysPreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) ListKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary or Secondary ConnectionStrings to the -// WCFRelays -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the Namespace Name relayName is the relay -// name authorizationRuleName is the authorizationRule name. parameters is -// parameters supplied to regenerate Auth Rule. -func (client WCFRelaysClient) RegenerateKeys(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result AuthorizationRuleKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: relayName, - Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client WCFRelaysClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client WCFRelaysClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client WCFRelaysClient) RegenerateKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package relay + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WCFRelaysClient is the use these API to manage Azure Relay resources through +// Azure Resources Manager. +type WCFRelaysClient struct { + ManagementClient +} + +// NewWCFRelaysClient creates an instance of the WCFRelaysClient client. +func NewWCFRelaysClient(subscriptionID string) WCFRelaysClient { + return NewWCFRelaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWCFRelaysClientWithBaseURI creates an instance of the WCFRelaysClient +// client. +func NewWCFRelaysClientWithBaseURI(baseURI string, subscriptionID string) WCFRelaysClient { + return WCFRelaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or Updates a WCFRelay. This operation is idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name parameters is parameters supplied to create a WCFRelays. +func (client WCFRelaysClient) CreateOrUpdate(resourceGroupName string, namespaceName string, relayName string, parameters WcfRelay) (result WcfRelay, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, relayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WCFRelaysClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, relayName string, parameters WcfRelay) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) CreateOrUpdateResponder(resp *http.Response) (result WcfRelay, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates or Updates an authorization rule for +// a WCFRelays +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name authorizationRuleName is the authorizationRule name. parameters is the +// authorization rule parameters. +func (client WCFRelaysClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters AuthorizationRule) (result AuthorizationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AuthorizationRuleProperties.Rights", Name: validation.UniqueItems, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client WCFRelaysClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters AuthorizationRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a WCFRelays . +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name +func (client WCFRelaysClient) Delete(resourceGroupName string, namespaceName string, relayName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WCFRelaysClient) DeletePreparer(resourceGroupName string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a WCFRelays authorization rule +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name authorizationRuleName is the authorizationRule name. +func (client WCFRelaysClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client WCFRelaysClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the description for the specified WCFRelays. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name +func (client WCFRelaysClient) Get(resourceGroupName string, namespaceName string, relayName string) (result WcfRelay, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WCFRelaysClient) GetPreparer(resourceGroupName string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) GetResponder(resp *http.Response) (result WcfRelay, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule get authorizationRule for a WCFRelays by name. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name authorizationRuleName is the authorizationRule name. +func (client WCFRelaysClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (result AuthorizationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client WCFRelaysClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) GetAuthorizationRuleResponder(resp *http.Response) (result AuthorizationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules authorization rules for a WCFRelays. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name +func (client WCFRelaysClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, relayName string) (result AuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client WCFRelaysClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) ListAuthorizationRulesResponder(resp *http.Response) (result AuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client WCFRelaysClient) ListAuthorizationRulesNextResults(lastResults AuthorizationRuleListResult) (result AuthorizationRuleListResult, err error) { + req, err := lastResults.AuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListByNamespace lists the WCFRelays within the namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name +func (client WCFRelaysClient) ListByNamespace(resourceGroupName string, namespaceName string) (result WcfRelaysListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "ListByNamespace") + } + + req, err := client.ListByNamespacePreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure sending request") + return + } + + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure responding to request") + } + + return +} + +// ListByNamespacePreparer prepares the ListByNamespace request. +func (client WCFRelaysClient) ListByNamespacePreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByNamespaceSender sends the ListByNamespace request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) ListByNamespaceResponder(resp *http.Response) (result WcfRelaysListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByNamespaceNextResults retrieves the next set of results, if any. +func (client WCFRelaysClient) ListByNamespaceNextResults(lastResults WcfRelaysListResult) (result WcfRelaysListResult, err error) { + req, err := lastResults.WcfRelaysListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure sending next results request") + } + + result, err = client.ListByNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListByNamespace", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys primary and Secondary ConnectionStrings to the WCFRelays. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name authorizationRuleName is the authorizationRule name. +func (client WCFRelaysClient) ListKeys(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (result AuthorizationRuleKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client WCFRelaysClient) ListKeysPreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) ListKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the Primary or Secondary ConnectionStrings to the +// WCFRelays +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the Namespace Name relayName is the relay +// name authorizationRuleName is the authorizationRule name. parameters is +// parameters supplied to regenerate Auth Rule. +func (client WCFRelaysClient) RegenerateKeys(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result AuthorizationRuleKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: relayName, + Constraints: []validation.Constraint{{Target: "relayName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "relayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "relay.WCFRelaysClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, relayName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "relay.WCFRelaysClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client WCFRelaysClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, relayName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/WcfRelays/{relayName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WCFRelaysClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client WCFRelaysClient) RegenerateKeysResponder(resp *http.Response) (result AuthorizationRuleKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/availabilitystatuses.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/availabilitystatuses.go index aa13429303..b8c8b7e010 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/availabilitystatuses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/availabilitystatuses.go @@ -1,425 +1,425 @@ -package resourcehealth - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// AvailabilityStatusesClient is the the Resource Health Client. -type AvailabilityStatusesClient struct { - ManagementClient -} - -// NewAvailabilityStatusesClient creates an instance of the -// AvailabilityStatusesClient client. -func NewAvailabilityStatusesClient(subscriptionID string, resourceType string) AvailabilityStatusesClient { - return NewAvailabilityStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceType) -} - -// NewAvailabilityStatusesClientWithBaseURI creates an instance of the -// AvailabilityStatusesClient client. -func NewAvailabilityStatusesClientWithBaseURI(baseURI string, subscriptionID string, resourceType string) AvailabilityStatusesClient { - return AvailabilityStatusesClient{NewWithBaseURI(baseURI, subscriptionID, resourceType)} -} - -// GetByResource gets current availability status for a single resource -// -// resourceURI is the fully qualified ID of the resource, including the -// resource name and resource type. Currently the API support not nested and -// one nesting level resource types : -// /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} -// and -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} -// filter is the filter to apply on the operation. For more information please -// see -// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN -// expand is setting $expand=recommendedactions in url query expands the -// recommendedactions in the response. -func (client AvailabilityStatusesClient) GetByResource(resourceURI string, filter string, expand string) (result AvailabilityStatus, err error) { - req, err := client.GetByResourcePreparer(resourceURI, filter, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "GetByResource", nil, "Failure preparing request") - return - } - - resp, err := client.GetByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "GetByResource", resp, "Failure sending request") - return - } - - result, err = client.GetByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "GetByResource", resp, "Failure responding to request") - } - - return -} - -// GetByResourcePreparer prepares the GetByResource request. -func (client AvailabilityStatusesClient) GetByResourcePreparer(resourceURI string, filter string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2015-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByResourceSender sends the GetByResource request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityStatusesClient) GetByResourceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByResourceResponder handles the response to the GetByResource request. The method always -// closes the http.Response Body. -func (client AvailabilityStatusesClient) GetByResourceResponder(resp *http.Response) (result AvailabilityStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the historical availability statuses for a single resource. Use -// the nextLink property in the response to get the next page of availability -// status -// -// resourceURI is the fully qualified ID of the resource, including the -// resource name and resource type. Currently the API support not nested and -// one nesting level resource types : -// /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} -// and -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} -// filter is the filter to apply on the operation. For more information please -// see -// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN -// expand is setting $expand=recommendedactions in url query expands the -// recommendedactions in the response. -func (client AvailabilityStatusesClient) List(resourceURI string, filter string, expand string) (result AvailabilityStatusListResult, err error) { - req, err := client.ListPreparer(resourceURI, filter, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AvailabilityStatusesClient) ListPreparer(resourceURI string, filter string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceUri": resourceURI, - } - - const APIVersion = "2015-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityStatusesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AvailabilityStatusesClient) ListResponder(resp *http.Response) (result AvailabilityStatusListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AvailabilityStatusesClient) ListNextResults(lastResults AvailabilityStatusListResult) (result AvailabilityStatusListResult, err error) { - req, err := lastResults.AvailabilityStatusListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup lists the current availability status for all the -// resources in the resource group. Use the nextLink property in the response -// to get the next page of availability statuses. -// -// resourceGroupName is the name of the resource group. filter is the filter to -// apply on the operation. For more information please see -// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN -// expand is setting $expand=recommendedactions in url query expands the -// recommendedactions in the response. -func (client AvailabilityStatusesClient) ListByResourceGroup(resourceGroupName string, filter string, expand string) (result AvailabilityStatusListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AvailabilityStatusesClient) ListByResourceGroupPreparer(resourceGroupName string, filter string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityStatusesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AvailabilityStatusesClient) ListByResourceGroupResponder(resp *http.Response) (result AvailabilityStatusListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AvailabilityStatusesClient) ListByResourceGroupNextResults(lastResults AvailabilityStatusListResult) (result AvailabilityStatusListResult, err error) { - req, err := lastResults.AvailabilityStatusListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscriptionID lists the current availability status for all the -// resources in the subscription. Use the nextLink property in the response to -// get the next page of availability statuses. -// -// filter is the filter to apply on the operation. For more information please -// see -// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN -// expand is setting $expand=recommendedactions in url query expands the -// recommendedactions in the response. -func (client AvailabilityStatusesClient) ListBySubscriptionID(filter string, expand string) (result AvailabilityStatusListResult, err error) { - req, err := client.ListBySubscriptionIDPreparer(filter, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. -func (client AvailabilityStatusesClient) ListBySubscriptionIDPreparer(filter string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityStatusesClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always -// closes the http.Response Body. -func (client AvailabilityStatusesClient) ListBySubscriptionIDResponder(resp *http.Response) (result AvailabilityStatusListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionIDNextResults retrieves the next set of results, if any. -func (client AvailabilityStatusesClient) ListBySubscriptionIDNextResults(lastResults AvailabilityStatusListResult) (result AvailabilityStatusListResult, err error) { - req, err := lastResults.AvailabilityStatusListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure responding to next results request") - } - - return -} +package resourcehealth + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AvailabilityStatusesClient is the the Resource Health Client. +type AvailabilityStatusesClient struct { + ManagementClient +} + +// NewAvailabilityStatusesClient creates an instance of the +// AvailabilityStatusesClient client. +func NewAvailabilityStatusesClient(subscriptionID string, resourceType string) AvailabilityStatusesClient { + return NewAvailabilityStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceType) +} + +// NewAvailabilityStatusesClientWithBaseURI creates an instance of the +// AvailabilityStatusesClient client. +func NewAvailabilityStatusesClientWithBaseURI(baseURI string, subscriptionID string, resourceType string) AvailabilityStatusesClient { + return AvailabilityStatusesClient{NewWithBaseURI(baseURI, subscriptionID, resourceType)} +} + +// GetByResource gets current availability status for a single resource +// +// resourceURI is the fully qualified ID of the resource, including the +// resource name and resource type. Currently the API support not nested and +// one nesting level resource types : +// /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} +// and +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} +// filter is the filter to apply on the operation. For more information please +// see +// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN +// expand is setting $expand=recommendedactions in url query expands the +// recommendedactions in the response. +func (client AvailabilityStatusesClient) GetByResource(resourceURI string, filter string, expand string) (result AvailabilityStatus, err error) { + req, err := client.GetByResourcePreparer(resourceURI, filter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "GetByResource", nil, "Failure preparing request") + return + } + + resp, err := client.GetByResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "GetByResource", resp, "Failure sending request") + return + } + + result, err = client.GetByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "GetByResource", resp, "Failure responding to request") + } + + return +} + +// GetByResourcePreparer prepares the GetByResource request. +func (client AvailabilityStatusesClient) GetByResourcePreparer(resourceURI string, filter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2015-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByResourceSender sends the GetByResource request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilityStatusesClient) GetByResourceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByResourceResponder handles the response to the GetByResource request. The method always +// closes the http.Response Body. +func (client AvailabilityStatusesClient) GetByResourceResponder(resp *http.Response) (result AvailabilityStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the historical availability statuses for a single resource. Use +// the nextLink property in the response to get the next page of availability +// status +// +// resourceURI is the fully qualified ID of the resource, including the +// resource name and resource type. Currently the API support not nested and +// one nesting level resource types : +// /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} +// and +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName} +// filter is the filter to apply on the operation. For more information please +// see +// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN +// expand is setting $expand=recommendedactions in url query expands the +// recommendedactions in the response. +func (client AvailabilityStatusesClient) List(resourceURI string, filter string, expand string) (result AvailabilityStatusListResult, err error) { + req, err := client.ListPreparer(resourceURI, filter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailabilityStatusesClient) ListPreparer(resourceURI string, filter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2015-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilityStatusesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailabilityStatusesClient) ListResponder(resp *http.Response) (result AvailabilityStatusListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AvailabilityStatusesClient) ListNextResults(lastResults AvailabilityStatusListResult) (result AvailabilityStatusListResult, err error) { + req, err := lastResults.AvailabilityStatusListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup lists the current availability status for all the +// resources in the resource group. Use the nextLink property in the response +// to get the next page of availability statuses. +// +// resourceGroupName is the name of the resource group. filter is the filter to +// apply on the operation. For more information please see +// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN +// expand is setting $expand=recommendedactions in url query expands the +// recommendedactions in the response. +func (client AvailabilityStatusesClient) ListByResourceGroup(resourceGroupName string, filter string, expand string) (result AvailabilityStatusListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, filter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AvailabilityStatusesClient) ListByResourceGroupPreparer(resourceGroupName string, filter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilityStatusesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AvailabilityStatusesClient) ListByResourceGroupResponder(resp *http.Response) (result AvailabilityStatusListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AvailabilityStatusesClient) ListByResourceGroupNextResults(lastResults AvailabilityStatusListResult) (result AvailabilityStatusListResult, err error) { + req, err := lastResults.AvailabilityStatusListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscriptionID lists the current availability status for all the +// resources in the subscription. Use the nextLink property in the response to +// get the next page of availability statuses. +// +// filter is the filter to apply on the operation. For more information please +// see +// https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN +// expand is setting $expand=recommendedactions in url query expands the +// recommendedactions in the response. +func (client AvailabilityStatusesClient) ListBySubscriptionID(filter string, expand string) (result AvailabilityStatusListResult, err error) { + req, err := client.ListBySubscriptionIDPreparer(filter, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client AvailabilityStatusesClient) ListBySubscriptionIDPreparer(filter string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client AvailabilityStatusesClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client AvailabilityStatusesClient) ListBySubscriptionIDResponder(resp *http.Response) (result AvailabilityStatusListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionIDNextResults retrieves the next set of results, if any. +func (client AvailabilityStatusesClient) ListBySubscriptionIDNextResults(lastResults AvailabilityStatusListResult) (result AvailabilityStatusListResult, err error) { + req, err := lastResults.AvailabilityStatusListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.AvailabilityStatusesClient", "ListBySubscriptionID", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/client.go index 89e89cfdb8..a5a18afe85 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/client.go @@ -1,55 +1,55 @@ -// Package resourcehealth implements the Azure ARM Resourcehealth service API -// version 2015-01-01. -// -// The Resource Health Client. -package resourcehealth - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Resourcehealth - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Resourcehealth. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string - ResourceType string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string, resourceType string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID, resourceType) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string, resourceType string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - ResourceType: resourceType, - } -} +// Package resourcehealth implements the Azure ARM Resourcehealth service API +// version 2015-01-01. +// +// The Resource Health Client. +package resourcehealth + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Resourcehealth + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Resourcehealth. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string + ResourceType string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string, resourceType string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID, resourceType) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string, resourceType string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + ResourceType: resourceType, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/models.go index db83272e79..25183369c6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/models.go @@ -1,163 +1,163 @@ -package resourcehealth - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AvailabilityStateValues enumerates the values for availability state values. -type AvailabilityStateValues string - -const ( - // Available specifies the available state for availability state values. - Available AvailabilityStateValues = "Available" - // Unavailable specifies the unavailable state for availability state - // values. - Unavailable AvailabilityStateValues = "Unavailable" - // Unknown specifies the unknown state for availability state values. - Unknown AvailabilityStateValues = "Unknown" -) - -// ReasonChronicityTypes enumerates the values for reason chronicity types. -type ReasonChronicityTypes string - -const ( - // Persistent specifies the persistent state for reason chronicity types. - Persistent ReasonChronicityTypes = "Persistent" - // Transient specifies the transient state for reason chronicity types. - Transient ReasonChronicityTypes = "Transient" -) - -// AvailabilityStatus is availabilityStatus of a resource. -type AvailabilityStatus struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Properties *AvailabilityStatusProperties `json:"properties,omitempty"` -} - -// AvailabilityStatusProperties is properties of availability state. -type AvailabilityStatusProperties struct { - AvailabilityState AvailabilityStateValues `json:"availabilityState,omitempty"` - Summary *string `json:"summary,omitempty"` - DetailedStatus *string `json:"detailedStatus,omitempty"` - ReasonType *string `json:"reasonType,omitempty"` - RootCauseAttributionTime *date.Time `json:"rootCauseAttributionTime,omitempty"` - ResolutionETA *date.Time `json:"resolutionETA,omitempty"` - OccuredTime *date.Time `json:"occuredTime,omitempty"` - ReasonChronicity ReasonChronicityTypes `json:"reasonChronicity,omitempty"` - ReportedTime *date.Time `json:"reportedTime,omitempty"` - RecentlyResolvedState *AvailabilityStatusPropertiesRecentlyResolvedState `json:"recentlyResolvedState,omitempty"` - RecommendedActions *[]RecommendedAction `json:"recommendedActions,omitempty"` - ServiceImpactingEvents *[]ServiceImpactingEvent `json:"serviceImpactingEvents,omitempty"` -} - -// AvailabilityStatusPropertiesRecentlyResolvedState is an annotation -// describing a change in the availabilityState to Available from Unavailable -// with a reasonType of type Unplanned -type AvailabilityStatusPropertiesRecentlyResolvedState struct { - UnavailableOccurredTime *date.Time `json:"unavailableOccurredTime,omitempty"` - ResolvedTime *date.Time `json:"resolvedTime,omitempty"` - UnavailabilitySummary *string `json:"unavailabilitySummary,omitempty"` -} - -// AvailabilityStatusListResult is the List availabilityStatus operation -// response. -type AvailabilityStatusListResult struct { - autorest.Response `json:"-"` - Value *[]AvailabilityStatus `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AvailabilityStatusListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AvailabilityStatusListResult) AvailabilityStatusListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ErrorResponse is error details. -type ErrorResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Details *string `json:"details,omitempty"` -} - -// Operation is operation available in the resourcehealth resource provider. -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is properties of the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult is lists the operations response. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` -} - -// RecommendedAction is lists actions the user can take based on the current -// availabilityState of the resource. -type RecommendedAction struct { - Action *string `json:"action,omitempty"` - ActionURL *string `json:"actionUrl,omitempty"` - ActionURLText *string `json:"actionUrlText,omitempty"` -} - -// ServiceImpactingEvent is lists the service impacting events that may be -// affecting the health of the resource. -type ServiceImpactingEvent struct { - EventStartTime *date.Time `json:"eventStartTime,omitempty"` - EventStatusLastModifiedTime *date.Time `json:"eventStatusLastModifiedTime,omitempty"` - CorrelationID *string `json:"correlationId,omitempty"` - Status *ServiceImpactingEventStatus `json:"status,omitempty"` - IncidentProperties *ServiceImpactingEventIncidentProperties `json:"incidentProperties,omitempty"` -} - -// ServiceImpactingEventIncidentProperties is properties of the service -// impacting event. -type ServiceImpactingEventIncidentProperties struct { - Title *string `json:"title,omitempty"` - Service *string `json:"service,omitempty"` - Region *string `json:"region,omitempty"` - IncidentType *string `json:"incidentType,omitempty"` -} - -// ServiceImpactingEventStatus is status of the service impacting event. -type ServiceImpactingEventStatus struct { - Value *string `json:"value,omitempty"` -} +package resourcehealth + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AvailabilityStateValues enumerates the values for availability state values. +type AvailabilityStateValues string + +const ( + // Available specifies the available state for availability state values. + Available AvailabilityStateValues = "Available" + // Unavailable specifies the unavailable state for availability state + // values. + Unavailable AvailabilityStateValues = "Unavailable" + // Unknown specifies the unknown state for availability state values. + Unknown AvailabilityStateValues = "Unknown" +) + +// ReasonChronicityTypes enumerates the values for reason chronicity types. +type ReasonChronicityTypes string + +const ( + // Persistent specifies the persistent state for reason chronicity types. + Persistent ReasonChronicityTypes = "Persistent" + // Transient specifies the transient state for reason chronicity types. + Transient ReasonChronicityTypes = "Transient" +) + +// AvailabilityStatus is availabilityStatus of a resource. +type AvailabilityStatus struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Properties *AvailabilityStatusProperties `json:"properties,omitempty"` +} + +// AvailabilityStatusProperties is properties of availability state. +type AvailabilityStatusProperties struct { + AvailabilityState AvailabilityStateValues `json:"availabilityState,omitempty"` + Summary *string `json:"summary,omitempty"` + DetailedStatus *string `json:"detailedStatus,omitempty"` + ReasonType *string `json:"reasonType,omitempty"` + RootCauseAttributionTime *date.Time `json:"rootCauseAttributionTime,omitempty"` + ResolutionETA *date.Time `json:"resolutionETA,omitempty"` + OccuredTime *date.Time `json:"occuredTime,omitempty"` + ReasonChronicity ReasonChronicityTypes `json:"reasonChronicity,omitempty"` + ReportedTime *date.Time `json:"reportedTime,omitempty"` + RecentlyResolvedState *AvailabilityStatusPropertiesRecentlyResolvedState `json:"recentlyResolvedState,omitempty"` + RecommendedActions *[]RecommendedAction `json:"recommendedActions,omitempty"` + ServiceImpactingEvents *[]ServiceImpactingEvent `json:"serviceImpactingEvents,omitempty"` +} + +// AvailabilityStatusPropertiesRecentlyResolvedState is an annotation +// describing a change in the availabilityState to Available from Unavailable +// with a reasonType of type Unplanned +type AvailabilityStatusPropertiesRecentlyResolvedState struct { + UnavailableOccurredTime *date.Time `json:"unavailableOccurredTime,omitempty"` + ResolvedTime *date.Time `json:"resolvedTime,omitempty"` + UnavailabilitySummary *string `json:"unavailabilitySummary,omitempty"` +} + +// AvailabilityStatusListResult is the List availabilityStatus operation +// response. +type AvailabilityStatusListResult struct { + autorest.Response `json:"-"` + Value *[]AvailabilityStatus `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailabilityStatusListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AvailabilityStatusListResult) AvailabilityStatusListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ErrorResponse is error details. +type ErrorResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Details *string `json:"details,omitempty"` +} + +// Operation is operation available in the resourcehealth resource provider. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is properties of the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult is lists the operations response. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// RecommendedAction is lists actions the user can take based on the current +// availabilityState of the resource. +type RecommendedAction struct { + Action *string `json:"action,omitempty"` + ActionURL *string `json:"actionUrl,omitempty"` + ActionURLText *string `json:"actionUrlText,omitempty"` +} + +// ServiceImpactingEvent is lists the service impacting events that may be +// affecting the health of the resource. +type ServiceImpactingEvent struct { + EventStartTime *date.Time `json:"eventStartTime,omitempty"` + EventStatusLastModifiedTime *date.Time `json:"eventStatusLastModifiedTime,omitempty"` + CorrelationID *string `json:"correlationId,omitempty"` + Status *ServiceImpactingEventStatus `json:"status,omitempty"` + IncidentProperties *ServiceImpactingEventIncidentProperties `json:"incidentProperties,omitempty"` +} + +// ServiceImpactingEventIncidentProperties is properties of the service +// impacting event. +type ServiceImpactingEventIncidentProperties struct { + Title *string `json:"title,omitempty"` + Service *string `json:"service,omitempty"` + Region *string `json:"region,omitempty"` + IncidentType *string `json:"incidentType,omitempty"` +} + +// ServiceImpactingEventStatus is status of the service impacting event. +type ServiceImpactingEventStatus struct { + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/operations.go index 56abf1cc2a..e103cf0fab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/operations.go @@ -1,98 +1,98 @@ -package resourcehealth - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the the Resource Health Client. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string, resourceType string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceType) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, resourceType string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, resourceType)} -} - -// List lists available operations for the resourcehealth resource provider -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resourcehealth.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resourcehealth.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2015-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ResourceHealth/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package resourcehealth + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the the Resource Health Client. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string, resourceType string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, resourceType) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, resourceType string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, resourceType)} +} + +// List lists available operations for the resourcehealth resource provider +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resourcehealth.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resourcehealth.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ResourceHealth/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/version.go index 5a76ac3ec0..fe1838892a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resourcehealth/version.go @@ -1,29 +1,29 @@ -package resourcehealth - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-resourcehealth/2015-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package resourcehealth + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-resourcehealth/2015-01-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/client.go index 0a9ed9d270..87d1267c39 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/client.go @@ -1,57 +1,57 @@ -// Package features implements the Azure ARM Features service API version -// 2015-12-01. -// -// Azure Feature Exposure Control (AFEC) provides a mechanism for the resource -// providers to control feature exposure to users. Resource providers typically -// use this mechanism to provide public/private preview for new features prior -// to making them generally available. Users need to explicitly register for -// AFEC features to get access to such functionality. -package features - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Features - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Features. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package features implements the Azure ARM Features service API version +// 2015-12-01. +// +// Azure Feature Exposure Control (AFEC) provides a mechanism for the resource +// providers to control feature exposure to users. Resource providers typically +// use this mechanism to provide public/private preview for new features prior +// to making them generally available. Users need to explicitly register for +// AFEC features to get access to such functionality. +package features + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Features + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Features. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/featuresgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/featuresgroup.go index 96d3738dec..8a12ca2374 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/featuresgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/featuresgroup.go @@ -1,353 +1,353 @@ -package features - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// GroupClient is the azure Feature Exposure Control (AFEC) provides a -// mechanism for the resource providers to control feature exposure to users. -// Resource providers typically use this mechanism to provide public/private -// preview for new features prior to making them generally available. Users -// need to explicitly register for AFEC features to get access to such -// functionality. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the preview feature with the specified name. -// -// resourceProviderNamespace is the resource provider namespace for the -// feature. featureName is the name of the feature to get. -func (client GroupClient) Get(resourceProviderNamespace string, featureName string) (result Result, err error) { - req, err := client.GetPreparer(resourceProviderNamespace, featureName) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "features.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceProviderNamespace string, featureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "featureName": autorest.Encode("path", featureName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result Result, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the preview features in a provider namespace that are -// available through AFEC for the subscription. -// -// resourceProviderNamespace is the namespace of the resource provider for -// getting features. -func (client GroupClient) List(resourceProviderNamespace string) (result OperationsListResult, err error) { - req, err := client.ListPreparer(resourceProviderNamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer(resourceProviderNamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults OperationsListResult) (result OperationsListResult, err error) { - req, err := lastResults.OperationsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "features.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAll gets all the preview features that are available through AFEC for -// the subscription. -func (client GroupClient) ListAll() (result OperationsListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client GroupClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/features", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client GroupClient) ListAllResponder(resp *http.Response) (result OperationsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client GroupClient) ListAllNextResults(lastResults OperationsListResult) (result OperationsListResult, err error) { - req, err := lastResults.OperationsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// Register registers the preview feature for the subscription. -// -// resourceProviderNamespace is the namespace of the resource provider. -// featureName is the name of the feature to register. -func (client GroupClient) Register(resourceProviderNamespace string, featureName string) (result Result, err error) { - req, err := client.RegisterPreparer(resourceProviderNamespace, featureName) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "Register", nil, "Failure preparing request") - return - } - - resp, err := client.RegisterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "features.GroupClient", "Register", resp, "Failure sending request") - return - } - - result, err = client.RegisterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "features.GroupClient", "Register", resp, "Failure responding to request") - } - - return -} - -// RegisterPreparer prepares the Register request. -func (client GroupClient) RegisterPreparer(resourceProviderNamespace string, featureName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "featureName": autorest.Encode("path", featureName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/register", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegisterSender sends the Register request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RegisterSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegisterResponder handles the response to the Register request. The method always -// closes the http.Response Body. -func (client GroupClient) RegisterResponder(resp *http.Response) (result Result, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package features + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// GroupClient is the azure Feature Exposure Control (AFEC) provides a +// mechanism for the resource providers to control feature exposure to users. +// Resource providers typically use this mechanism to provide public/private +// preview for new features prior to making them generally available. Users +// need to explicitly register for AFEC features to get access to such +// functionality. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the preview feature with the specified name. +// +// resourceProviderNamespace is the resource provider namespace for the +// feature. featureName is the name of the feature to get. +func (client GroupClient) Get(resourceProviderNamespace string, featureName string) (result Result, err error) { + req, err := client.GetPreparer(resourceProviderNamespace, featureName) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "features.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceProviderNamespace string, featureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "featureName": autorest.Encode("path", featureName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result Result, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the preview features in a provider namespace that are +// available through AFEC for the subscription. +// +// resourceProviderNamespace is the namespace of the resource provider for +// getting features. +func (client GroupClient) List(resourceProviderNamespace string) (result OperationsListResult, err error) { + req, err := client.ListPreparer(resourceProviderNamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer(resourceProviderNamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults OperationsListResult) (result OperationsListResult, err error) { + req, err := lastResults.OperationsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "features.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAll gets all the preview features that are available through AFEC for +// the subscription. +func (client GroupClient) ListAll() (result OperationsListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client GroupClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/features", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client GroupClient) ListAllResponder(resp *http.Response) (result OperationsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client GroupClient) ListAllNextResults(lastResults OperationsListResult) (result OperationsListResult, err error) { + req, err := lastResults.OperationsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// Register registers the preview feature for the subscription. +// +// resourceProviderNamespace is the namespace of the resource provider. +// featureName is the name of the feature to register. +func (client GroupClient) Register(resourceProviderNamespace string, featureName string) (result Result, err error) { + req, err := client.RegisterPreparer(resourceProviderNamespace, featureName) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "Register", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "features.GroupClient", "Register", resp, "Failure sending request") + return + } + + result, err = client.RegisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "features.GroupClient", "Register", resp, "Failure responding to request") + } + + return +} + +// RegisterPreparer prepares the Register request. +func (client GroupClient) RegisterPreparer(resourceProviderNamespace string, featureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "featureName": autorest.Encode("path", featureName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/register", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegisterSender sends the Register request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RegisterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegisterResponder handles the response to the Register request. The method always +// closes the http.Response Body. +func (client GroupClient) RegisterResponder(resp *http.Response) (result Result, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/models.go index a37b7c3f1d..18f4f5671e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/models.go @@ -1,58 +1,58 @@ -package features - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// OperationsListResult is list of previewed features. -type OperationsListResult struct { - autorest.Response `json:"-"` - Value *[]Result `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationsListResult) OperationsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Properties is information about feature. -type Properties struct { - State *string `json:"state,omitempty"` -} - -// Result is previewed feature information. -type Result struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Properties *Properties `json:"properties,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` -} +package features + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// OperationsListResult is list of previewed features. +type OperationsListResult struct { + autorest.Response `json:"-"` + Value *[]Result `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationsListResult) OperationsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Properties is information about feature. +type Properties struct { + State *string `json:"state,omitempty"` +} + +// Result is previewed feature information. +type Result struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Properties *Properties `json:"properties,omitempty"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/version.go index 5520639111..5dde5a3b31 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/features/version.go @@ -1,29 +1,29 @@ -package features - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-features/2015-12-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package features + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-features/2015-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/client.go index 5d0ea00a6e..7810b5bae4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/client.go @@ -1,57 +1,57 @@ -// Package links implements the Azure ARM Links service API version 2016-09-01. -// -// Azure resources can be linked together to form logical relationships. You -// can establish links between resources belonging to different resource -// groups. However, all the linked resources must belong to the same -// subscription. Each resource can be linked to 50 other resources. If any of -// the linked resources are deleted or moved, the link owner must clean up the -// remaining link. -package links - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Links - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Links. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package links implements the Azure ARM Links service API version 2016-09-01. +// +// Azure resources can be linked together to form logical relationships. You +// can establish links between resources belonging to different resource +// groups. However, all the linked resources must belong to the same +// subscription. Each resource can be linked to 50 other resources. If any of +// the linked resources are deleted or moved, the link owner must clean up the +// remaining link. +package links + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Links + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Links. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/models.go index cd3cdf76cf..2da9fd32e5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/models.go @@ -1,72 +1,72 @@ -package links - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// Filter enumerates the values for filter. -type Filter string - -const ( - // AtScope specifies the at scope state for filter. - AtScope Filter = "atScope()" -) - -// ResourceLink is the resource link. -type ResourceLink struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ResourceLinkProperties `json:"properties,omitempty"` -} - -// ResourceLinkFilter is resource link filter. -type ResourceLinkFilter struct { - TargetID *string `json:"targetId,omitempty"` -} - -// ResourceLinkProperties is the resource link properties. -type ResourceLinkProperties struct { - SourceID *string `json:"sourceId,omitempty"` - TargetID *string `json:"targetId,omitempty"` - Notes *string `json:"notes,omitempty"` -} - -// ResourceLinkResult is list of resource links. -type ResourceLinkResult struct { - autorest.Response `json:"-"` - Value *[]ResourceLink `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceLinkResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceLinkResult) ResourceLinkResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} +package links + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// Filter enumerates the values for filter. +type Filter string + +const ( + // AtScope specifies the at scope state for filter. + AtScope Filter = "atScope()" +) + +// ResourceLink is the resource link. +type ResourceLink struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ResourceLinkProperties `json:"properties,omitempty"` +} + +// ResourceLinkFilter is resource link filter. +type ResourceLinkFilter struct { + TargetID *string `json:"targetId,omitempty"` +} + +// ResourceLinkProperties is the resource link properties. +type ResourceLinkProperties struct { + SourceID *string `json:"sourceId,omitempty"` + TargetID *string `json:"targetId,omitempty"` + Notes *string `json:"notes,omitempty"` +} + +// ResourceLinkResult is list of resource links. +type ResourceLinkResult struct { + autorest.Response `json:"-"` + Value *[]ResourceLink `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceLinkResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceLinkResult) ResourceLinkResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/resourcelinks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/resourcelinks.go index 9e776ab42a..0e2e9359d4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/resourcelinks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/resourcelinks.go @@ -1,442 +1,442 @@ -package links - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ResourceLinksClient is the azure resources can be linked together to form -// logical relationships. You can establish links between resources belonging -// to different resource groups. However, all the linked resources must belong -// to the same subscription. Each resource can be linked to 50 other resources. -// If any of the linked resources are deleted or moved, the link owner must -// clean up the remaining link. -type ResourceLinksClient struct { - ManagementClient -} - -// NewResourceLinksClient creates an instance of the ResourceLinksClient -// client. -func NewResourceLinksClient(subscriptionID string) ResourceLinksClient { - return NewResourceLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceLinksClientWithBaseURI creates an instance of the -// ResourceLinksClient client. -func NewResourceLinksClientWithBaseURI(baseURI string, subscriptionID string) ResourceLinksClient { - return ResourceLinksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a resource link between the specified -// resources. -// -// linkID is the fully qualified ID of the resource link. Use the format, -// /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. -// For example, -// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink -// parameters is parameters for creating or updating a resource link. -func (client ResourceLinksClient) CreateOrUpdate(linkID string, parameters ResourceLink) (result ResourceLink, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TargetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "links.ResourceLinksClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(linkID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ResourceLinksClient) CreateOrUpdatePreparer(linkID string, parameters ResourceLink) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkId": linkID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{linkId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceLinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ResourceLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceLink, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a resource link with the specified ID. -// -// linkID is the fully qualified ID of the resource link. Use the format, -// /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. -// For example, -// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink -func (client ResourceLinksClient) Delete(linkID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ResourceLinksClient) DeletePreparer(linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkId": linkID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{linkId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ResourceLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a resource link with the specified ID. -// -// linkID is the fully qualified Id of the resource link. For example, -// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink -func (client ResourceLinksClient) Get(linkID string) (result ResourceLink, err error) { - req, err := client.GetPreparer(linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ResourceLinksClient) GetPreparer(linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "linkId": linkID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{linkId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceLinksClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ResourceLinksClient) GetResponder(resp *http.Response) (result ResourceLink, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSourceScope gets a list of resource links at and below the specified -// source scope. -// -// scope is the fully qualified ID of the scope for getting the resource links. -// For example, to list resource links at and under a resource group, set the -// scope to -// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. -// filter is the filter to apply when getting resource links. To get links only -// at the specified scope (not below the scope), use Filter.atScope(). -func (client ResourceLinksClient) ListAtSourceScope(scope string, filter Filter) (result ResourceLinkResult, err error) { - req, err := client.ListAtSourceScopePreparer(scope, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSourceScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure sending request") - return - } - - result, err = client.ListAtSourceScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure responding to request") - } - - return -} - -// ListAtSourceScopePreparer prepares the ListAtSourceScope request. -func (client ResourceLinksClient) ListAtSourceScopePreparer(scope string, filter Filter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(filter)) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/links", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAtSourceScopeSender sends the ListAtSourceScope request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceLinksClient) ListAtSourceScopeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAtSourceScopeResponder handles the response to the ListAtSourceScope request. The method always -// closes the http.Response Body. -func (client ResourceLinksClient) ListAtSourceScopeResponder(resp *http.Response) (result ResourceLinkResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSourceScopeNextResults retrieves the next set of results, if any. -func (client ResourceLinksClient) ListAtSourceScopeNextResults(lastResults ResourceLinkResult) (result ResourceLinkResult, err error) { - req, err := lastResults.ResourceLinkResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAtSourceScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure sending next results request") - } - - result, err = client.ListAtSourceScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure responding to next results request") - } - - return -} - -// ListAtSubscription gets all the linked resources for the subscription. -// -// filter is the filter to apply on the list resource links operation. The -// supported filter for list resource links is targetid. For example, -// $filter=targetid eq {value} -func (client ResourceLinksClient) ListAtSubscription(filter string) (result ResourceLinkResult, err error) { - req, err := client.ListAtSubscriptionPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure sending request") - return - } - - result, err = client.ListAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure responding to request") - } - - return -} - -// ListAtSubscriptionPreparer prepares the ListAtSubscription request. -func (client ResourceLinksClient) ListAtSubscriptionPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/links", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAtSubscriptionSender sends the ListAtSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceLinksClient) ListAtSubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAtSubscriptionResponder handles the response to the ListAtSubscription request. The method always -// closes the http.Response Body. -func (client ResourceLinksClient) ListAtSubscriptionResponder(resp *http.Response) (result ResourceLinkResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSubscriptionNextResults retrieves the next set of results, if any. -func (client ResourceLinksClient) ListAtSubscriptionNextResults(lastResults ResourceLinkResult) (result ResourceLinkResult, err error) { - req, err := lastResults.ResourceLinkResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure sending next results request") - } - - result, err = client.ListAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure responding to next results request") - } - - return -} +package links + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ResourceLinksClient is the azure resources can be linked together to form +// logical relationships. You can establish links between resources belonging +// to different resource groups. However, all the linked resources must belong +// to the same subscription. Each resource can be linked to 50 other resources. +// If any of the linked resources are deleted or moved, the link owner must +// clean up the remaining link. +type ResourceLinksClient struct { + ManagementClient +} + +// NewResourceLinksClient creates an instance of the ResourceLinksClient +// client. +func NewResourceLinksClient(subscriptionID string) ResourceLinksClient { + return NewResourceLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceLinksClientWithBaseURI creates an instance of the +// ResourceLinksClient client. +func NewResourceLinksClientWithBaseURI(baseURI string, subscriptionID string) ResourceLinksClient { + return ResourceLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a resource link between the specified +// resources. +// +// linkID is the fully qualified ID of the resource link. Use the format, +// /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. +// For example, +// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink +// parameters is parameters for creating or updating a resource link. +func (client ResourceLinksClient) CreateOrUpdate(linkID string, parameters ResourceLink) (result ResourceLink, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.TargetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "links.ResourceLinksClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(linkID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ResourceLinksClient) CreateOrUpdatePreparer(linkID string, parameters ResourceLink) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkId": linkID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{linkId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceLinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ResourceLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceLink, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a resource link with the specified ID. +// +// linkID is the fully qualified ID of the resource link. Use the format, +// /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}. +// For example, +// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink +func (client ResourceLinksClient) Delete(linkID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(linkID) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ResourceLinksClient) DeletePreparer(linkID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkId": linkID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{linkId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceLinksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ResourceLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a resource link with the specified ID. +// +// linkID is the fully qualified Id of the resource link. For example, +// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink +func (client ResourceLinksClient) Get(linkID string) (result ResourceLink, err error) { + req, err := client.GetPreparer(linkID) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ResourceLinksClient) GetPreparer(linkID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkId": linkID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{linkId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceLinksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ResourceLinksClient) GetResponder(resp *http.Response) (result ResourceLink, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSourceScope gets a list of resource links at and below the specified +// source scope. +// +// scope is the fully qualified ID of the scope for getting the resource links. +// For example, to list resource links at and under a resource group, set the +// scope to +// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. +// filter is the filter to apply when getting resource links. To get links only +// at the specified scope (not below the scope), use Filter.atScope(). +func (client ResourceLinksClient) ListAtSourceScope(scope string, filter Filter) (result ResourceLinkResult, err error) { + req, err := client.ListAtSourceScopePreparer(scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSourceScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure sending request") + return + } + + result, err = client.ListAtSourceScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure responding to request") + } + + return +} + +// ListAtSourceScopePreparer prepares the ListAtSourceScope request. +func (client ResourceLinksClient) ListAtSourceScopePreparer(scope string, filter Filter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(filter)) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/links", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAtSourceScopeSender sends the ListAtSourceScope request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceLinksClient) ListAtSourceScopeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAtSourceScopeResponder handles the response to the ListAtSourceScope request. The method always +// closes the http.Response Body. +func (client ResourceLinksClient) ListAtSourceScopeResponder(resp *http.Response) (result ResourceLinkResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSourceScopeNextResults retrieves the next set of results, if any. +func (client ResourceLinksClient) ListAtSourceScopeNextResults(lastResults ResourceLinkResult) (result ResourceLinkResult, err error) { + req, err := lastResults.ResourceLinkResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAtSourceScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure sending next results request") + } + + result, err = client.ListAtSourceScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure responding to next results request") + } + + return +} + +// ListAtSubscription gets all the linked resources for the subscription. +// +// filter is the filter to apply on the list resource links operation. The +// supported filter for list resource links is targetid. For example, +// $filter=targetid eq {value} +func (client ResourceLinksClient) ListAtSubscription(filter string) (result ResourceLinkResult, err error) { + req, err := client.ListAtSubscriptionPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure sending request") + return + } + + result, err = client.ListAtSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure responding to request") + } + + return +} + +// ListAtSubscriptionPreparer prepares the ListAtSubscription request. +func (client ResourceLinksClient) ListAtSubscriptionPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/links", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAtSubscriptionSender sends the ListAtSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceLinksClient) ListAtSubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAtSubscriptionResponder handles the response to the ListAtSubscription request. The method always +// closes the http.Response Body. +func (client ResourceLinksClient) ListAtSubscriptionResponder(resp *http.Response) (result ResourceLinkResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSubscriptionNextResults retrieves the next set of results, if any. +func (client ResourceLinksClient) ListAtSubscriptionNextResults(lastResults ResourceLinkResult) (result ResourceLinkResult, err error) { + req, err := lastResults.ResourceLinkResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAtSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure sending next results request") + } + + result, err = client.ListAtSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/version.go index 30f83a8308..6ef40f955c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/links/version.go @@ -1,29 +1,29 @@ -package links - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-links/2016-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package links + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-links/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/client.go index 7187469f93..fdcf88219c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/client.go @@ -1,53 +1,53 @@ -// Package locks implements the Azure ARM Locks service API version 2016-09-01. -// -// Azure resources can be locked to prevent other users in your organization -// from deleting or modifying resources. -package locks - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Locks - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Locks. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package locks implements the Azure ARM Locks service API version 2016-09-01. +// +// Azure resources can be locked to prevent other users in your organization +// from deleting or modifying resources. +package locks + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Locks + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Locks. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/managementlocks.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/managementlocks.go index 1bede641c4..5fef907fa7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/managementlocks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/managementlocks.go @@ -1,1248 +1,1248 @@ -package locks - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ManagementLocksClient is the azure resources can be locked to prevent other -// users in your organization from deleting or modifying resources. -type ManagementLocksClient struct { - ManagementClient -} - -// NewManagementLocksClient creates an instance of the ManagementLocksClient -// client. -func NewManagementLocksClient(subscriptionID string) ManagementLocksClient { - return NewManagementLocksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagementLocksClientWithBaseURI creates an instance of the -// ManagementLocksClient client. -func NewManagementLocksClientWithBaseURI(baseURI string, subscriptionID string) ManagementLocksClient { - return ManagementLocksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdateAtResourceGroupLevel when you apply a lock at a parent scope, -// all child resources inherit the same lock. To create management locks, you -// must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner -// and User Access Administrator are granted those actions. -// -// resourceGroupName is the name of the resource group to lock. lockName is the -// lock name. The lock name can be a maximum of 260 characters. It cannot -// contain <, > %, &, :, \, ?, /, or any control characters. parameters is the -// management lock parameters. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevel(resourceGroupName string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel") - } - - req, err := client.CreateOrUpdateAtResourceGroupLevelPreparer(resourceGroupName, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAtResourceGroupLevelPreparer prepares the CreateOrUpdateAtResourceGroupLevel request. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelPreparer(resourceGroupName string, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAtResourceGroupLevelSender sends the CreateOrUpdateAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAtResourceGroupLevelResponder handles the response to the CreateOrUpdateAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtResourceLevel when you apply a lock at a parent scope, all -// child resources inherit the same lock. To create management locks, you must -// have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* -// actions. Of the built-in roles, only Owner and User Access Administrator are -// granted those actions. -// -// resourceGroupName is the name of the resource group containing the resource -// to lock. resourceProviderNamespace is the resource provider namespace of the -// resource to lock. parentResourcePath is the parent resource identity. -// resourceType is the resource type of the resource to lock. resourceName is -// the name of the resource to lock. lockName is the name of lock. The lock -// name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, -// ?, /, or any control characters. parameters is parameters for creating or -// updating a management lock. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel") - } - - req, err := client.CreateOrUpdateAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAtResourceLevelPreparer prepares the CreateOrUpdateAtResourceLevel request. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAtResourceLevelSender sends the CreateOrUpdateAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAtResourceLevelResponder handles the response to the CreateOrUpdateAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtSubscriptionLevel when you apply a lock at a parent scope, -// all child resources inherit the same lock. To create management locks, you -// must have access to Microsoft.Authorization/* or -// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner -// and User Access Administrator are granted those actions. -// -// lockName is the name of lock. The lock name can be a maximum of 260 -// characters. It cannot contain <, > %, &, :, \, ?, /, or any control -// characters. parameters is the management lock parameters. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevel(lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel") - } - - req, err := client.CreateOrUpdateAtSubscriptionLevelPreparer(lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAtSubscriptionLevelPreparer prepares the CreateOrUpdateAtSubscriptionLevel request. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelPreparer(lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAtSubscriptionLevelSender sends the CreateOrUpdateAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAtSubscriptionLevelResponder handles the response to the CreateOrUpdateAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByScope create or update a management lock by scope. -// -// scope is the scope for the lock. When providing a scope for the assignment, -// use '/subscriptions/{subscriptionId}' for subscriptions, -// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for -// resource groups, and -// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' -// for resources. lockName is the name of lock. parameters is create or update -// management lock parameters. -func (client ManagementLocksClient) CreateOrUpdateByScope(scope string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope") - } - - req, err := client.CreateOrUpdateByScopePreparer(scope, lockName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateByScopePreparer prepares the CreateOrUpdateByScope request. -func (client ManagementLocksClient) CreateOrUpdateByScopePreparer(scope string, lockName string, parameters ManagementLockObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateByScopeSender sends the CreateOrUpdateByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) CreateOrUpdateByScopeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateByScopeResponder handles the response to the CreateOrUpdateByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) CreateOrUpdateByScopeResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAtResourceGroupLevel to delete management locks, you must have access -// to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of -// the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// -// resourceGroupName is the name of the resource group containing the lock. -// lockName is the name of lock to delete. -func (client ManagementLocksClient) DeleteAtResourceGroupLevel(resourceGroupName string, lockName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel") - } - - req, err := client.DeleteAtResourceGroupLevelPreparer(resourceGroupName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtResourceGroupLevelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", resp, "Failure responding to request") - } - - return -} - -// DeleteAtResourceGroupLevelPreparer prepares the DeleteAtResourceGroupLevel request. -func (client ManagementLocksClient) DeleteAtResourceGroupLevelPreparer(resourceGroupName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAtResourceGroupLevelSender sends the DeleteAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAtResourceGroupLevelResponder handles the response to the DeleteAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteAtResourceGroupLevelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAtResourceLevel to delete management locks, you must have access to -// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the -// built-in roles, only Owner and User Access Administrator are granted those -// actions. -// -// resourceGroupName is the name of the resource group containing the resource -// with the lock to delete. resourceProviderNamespace is the resource provider -// namespace of the resource with the lock to delete. parentResourcePath is the -// parent resource identity. resourceType is the resource type of the resource -// with the lock to delete. resourceName is the name of the resource with the -// lock to delete. lockName is the name of the lock to delete. -func (client ManagementLocksClient) DeleteAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel") - } - - req, err := client.DeleteAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtResourceLevelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", resp, "Failure responding to request") - } - - return -} - -// DeleteAtResourceLevelPreparer prepares the DeleteAtResourceLevel request. -func (client ManagementLocksClient) DeleteAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAtResourceLevelSender sends the DeleteAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAtResourceLevelResponder handles the response to the DeleteAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteAtResourceLevelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAtSubscriptionLevel to delete management locks, you must have access -// to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of -// the built-in roles, only Owner and User Access Administrator are granted -// those actions. -// -// lockName is the name of lock to delete. -func (client ManagementLocksClient) DeleteAtSubscriptionLevel(lockName string) (result autorest.Response, err error) { - req, err := client.DeleteAtSubscriptionLevelPreparer(lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtSubscriptionLevelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", resp, "Failure responding to request") - } - - return -} - -// DeleteAtSubscriptionLevelPreparer prepares the DeleteAtSubscriptionLevel request. -func (client ManagementLocksClient) DeleteAtSubscriptionLevelPreparer(lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAtSubscriptionLevelSender sends the DeleteAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAtSubscriptionLevelResponder handles the response to the DeleteAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteAtSubscriptionLevelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByScope delete a management lock by scope. -// -// scope is the scope for the lock. lockName is the name of lock. -func (client ManagementLocksClient) DeleteByScope(scope string, lockName string) (result autorest.Response, err error) { - req, err := client.DeleteByScopePreparer(scope, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByScopeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", resp, "Failure sending request") - return - } - - result, err = client.DeleteByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", resp, "Failure responding to request") - } - - return -} - -// DeleteByScopePreparer prepares the DeleteByScope request. -func (client ManagementLocksClient) DeleteByScopePreparer(scope string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteByScopeSender sends the DeleteByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) DeleteByScopeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteByScopeResponder handles the response to the DeleteByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) DeleteByScopeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetAtResourceGroupLevel gets a management lock at the resource group level. -// -// resourceGroupName is the name of the locked resource group. lockName is the -// name of the lock to get. -func (client ManagementLocksClient) GetAtResourceGroupLevel(resourceGroupName string, lockName string) (result ManagementLockObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel") - } - - req, err := client.GetAtResourceGroupLevelPreparer(resourceGroupName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.GetAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", resp, "Failure responding to request") - } - - return -} - -// GetAtResourceGroupLevelPreparer prepares the GetAtResourceGroupLevel request. -func (client ManagementLocksClient) GetAtResourceGroupLevelPreparer(resourceGroupName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAtResourceGroupLevelSender sends the GetAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAtResourceGroupLevelResponder handles the response to the GetAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtResourceLevel get the management lock of a resource or any level below -// resource. -// -// resourceGroupName is the name of the resource group. -// resourceProviderNamespace is the namespace of the resource provider. -// parentResourcePath is an extra path parameter needed in some services, like -// SQL Databases. resourceType is the type of the resource. resourceName is the -// name of the resource. lockName is the name of lock. -func (client ManagementLocksClient) GetAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result ManagementLockObject, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "GetAtResourceLevel") - } - - req, err := client.GetAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.GetAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", resp, "Failure responding to request") - } - - return -} - -// GetAtResourceLevelPreparer prepares the GetAtResourceLevel request. -func (client ManagementLocksClient) GetAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAtResourceLevelSender sends the GetAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAtResourceLevelResponder handles the response to the GetAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtSubscriptionLevel gets a management lock at the subscription level. -// -// lockName is the name of the lock to get. -func (client ManagementLocksClient) GetAtSubscriptionLevel(lockName string) (result ManagementLockObject, err error) { - req, err := client.GetAtSubscriptionLevelPreparer(lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.GetAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", resp, "Failure responding to request") - } - - return -} - -// GetAtSubscriptionLevelPreparer prepares the GetAtSubscriptionLevel request. -func (client ManagementLocksClient) GetAtSubscriptionLevelPreparer(lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAtSubscriptionLevelSender sends the GetAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAtSubscriptionLevelResponder handles the response to the GetAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByScope get a management lock by scope. -// -// scope is the scope for the lock. lockName is the name of lock. -func (client ManagementLocksClient) GetByScope(scope string, lockName string) (result ManagementLockObject, err error) { - req, err := client.GetByScopePreparer(scope, lockName) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", nil, "Failure preparing request") - return - } - - resp, err := client.GetByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", resp, "Failure sending request") - return - } - - result, err = client.GetByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", resp, "Failure responding to request") - } - - return -} - -// GetByScopePreparer prepares the GetByScope request. -func (client ManagementLocksClient) GetByScopePreparer(scope string, lockName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "lockName": autorest.Encode("path", lockName), - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByScopeSender sends the GetByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) GetByScopeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByScopeResponder handles the response to the GetByScope request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) GetByScopeResponder(resp *http.Response) (result ManagementLockObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtResourceGroupLevel gets all the management locks for a resource group. -// -// resourceGroupName is the name of the resource group containing the locks to -// get. filter is the filter to apply on the operation. -func (client ManagementLocksClient) ListAtResourceGroupLevel(resourceGroupName string, filter string) (result ManagementLockListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel") - } - - req, err := client.ListAtResourceGroupLevelPreparer(resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure sending request") - return - } - - result, err = client.ListAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure responding to request") - } - - return -} - -// ListAtResourceGroupLevelPreparer prepares the ListAtResourceGroupLevel request. -func (client ManagementLocksClient) ListAtResourceGroupLevelPreparer(resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAtResourceGroupLevelSender sends the ListAtResourceGroupLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAtResourceGroupLevelResponder handles the response to the ListAtResourceGroupLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtResourceGroupLevelNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) ListAtResourceGroupLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.ManagementLockListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAtResourceGroupLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure sending next results request") - } - - result, err = client.ListAtResourceGroupLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure responding to next results request") - } - - return -} - -// ListAtResourceLevel gets all the management locks for a resource or any -// level below resource. -// -// resourceGroupName is the name of the resource group containing the locked -// resource. The name is case insensitive. resourceProviderNamespace is the -// namespace of the resource provider. parentResourcePath is the parent -// resource identity. resourceType is the resource type of the locked resource. -// resourceName is the name of the locked resource. filter is the filter to -// apply on the operation. -func (client ManagementLocksClient) ListAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ManagementLockListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "ListAtResourceLevel") - } - - req, err := client.ListAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure sending request") - return - } - - result, err = client.ListAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure responding to request") - } - - return -} - -// ListAtResourceLevelPreparer prepares the ListAtResourceLevel request. -func (client ManagementLocksClient) ListAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAtResourceLevelSender sends the ListAtResourceLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListAtResourceLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAtResourceLevelResponder handles the response to the ListAtResourceLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListAtResourceLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtResourceLevelNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) ListAtResourceLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.ManagementLockListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAtResourceLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure sending next results request") - } - - result, err = client.ListAtResourceLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure responding to next results request") - } - - return -} - -// ListAtSubscriptionLevel gets all the management locks for a subscription. -// -// filter is the filter to apply on the operation. -func (client ManagementLocksClient) ListAtSubscriptionLevel(filter string) (result ManagementLockListResult, err error) { - req, err := client.ListAtSubscriptionLevelPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing request") - return - } - - resp, err := client.ListAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure sending request") - return - } - - result, err = client.ListAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure responding to request") - } - - return -} - -// ListAtSubscriptionLevelPreparer prepares the ListAtSubscriptionLevel request. -func (client ManagementLocksClient) ListAtSubscriptionLevelPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAtSubscriptionLevelSender sends the ListAtSubscriptionLevel request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementLocksClient) ListAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAtSubscriptionLevelResponder handles the response to the ListAtSubscriptionLevel request. The method always -// closes the http.Response Body. -func (client ManagementLocksClient) ListAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAtSubscriptionLevelNextResults retrieves the next set of results, if any. -func (client ManagementLocksClient) ListAtSubscriptionLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { - req, err := lastResults.ManagementLockListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAtSubscriptionLevelSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure sending next results request") - } - - result, err = client.ListAtSubscriptionLevelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure responding to next results request") - } - - return -} +package locks + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ManagementLocksClient is the azure resources can be locked to prevent other +// users in your organization from deleting or modifying resources. +type ManagementLocksClient struct { + ManagementClient +} + +// NewManagementLocksClient creates an instance of the ManagementLocksClient +// client. +func NewManagementLocksClient(subscriptionID string) ManagementLocksClient { + return NewManagementLocksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagementLocksClientWithBaseURI creates an instance of the +// ManagementLocksClient client. +func NewManagementLocksClientWithBaseURI(baseURI string, subscriptionID string) ManagementLocksClient { + return ManagementLocksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdateAtResourceGroupLevel when you apply a lock at a parent scope, +// all child resources inherit the same lock. To create management locks, you +// must have access to Microsoft.Authorization/* or +// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner +// and User Access Administrator are granted those actions. +// +// resourceGroupName is the name of the resource group to lock. lockName is the +// lock name. The lock name can be a maximum of 260 characters. It cannot +// contain <, > %, &, :, \, ?, /, or any control characters. parameters is the +// management lock parameters. +func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevel(resourceGroupName string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel") + } + + req, err := client.CreateOrUpdateAtResourceGroupLevelPreparer(resourceGroupName, lockName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAtResourceGroupLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAtResourceGroupLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceGroupLevel", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAtResourceGroupLevelPreparer prepares the CreateOrUpdateAtResourceGroupLevel request. +func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelPreparer(resourceGroupName string, lockName string, parameters ManagementLockObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAtResourceGroupLevelSender sends the CreateOrUpdateAtResourceGroupLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAtResourceGroupLevelResponder handles the response to the CreateOrUpdateAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) CreateOrUpdateAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtResourceLevel when you apply a lock at a parent scope, all +// child resources inherit the same lock. To create management locks, you must +// have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* +// actions. Of the built-in roles, only Owner and User Access Administrator are +// granted those actions. +// +// resourceGroupName is the name of the resource group containing the resource +// to lock. resourceProviderNamespace is the resource provider namespace of the +// resource to lock. parentResourcePath is the parent resource identity. +// resourceType is the resource type of the resource to lock. resourceName is +// the name of the resource to lock. lockName is the name of lock. The lock +// name can be a maximum of 260 characters. It cannot contain <, > %, &, :, \, +// ?, /, or any control characters. parameters is parameters for creating or +// updating a management lock. +func (client ManagementLocksClient) CreateOrUpdateAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel") + } + + req, err := client.CreateOrUpdateAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAtResourceLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAtResourceLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtResourceLevel", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAtResourceLevelPreparer prepares the CreateOrUpdateAtResourceLevel request. +func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string, parameters ManagementLockObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAtResourceLevelSender sends the CreateOrUpdateAtResourceLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAtResourceLevelResponder handles the response to the CreateOrUpdateAtResourceLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) CreateOrUpdateAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAtSubscriptionLevel when you apply a lock at a parent scope, +// all child resources inherit the same lock. To create management locks, you +// must have access to Microsoft.Authorization/* or +// Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner +// and User Access Administrator are granted those actions. +// +// lockName is the name of lock. The lock name can be a maximum of 260 +// characters. It cannot contain <, > %, &, :, \, ?, /, or any control +// characters. parameters is the management lock parameters. +func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevel(lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel") + } + + req, err := client.CreateOrUpdateAtSubscriptionLevelPreparer(lockName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAtSubscriptionLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAtSubscriptionLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateAtSubscriptionLevel", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAtSubscriptionLevelPreparer prepares the CreateOrUpdateAtSubscriptionLevel request. +func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelPreparer(lockName string, parameters ManagementLockObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAtSubscriptionLevelSender sends the CreateOrUpdateAtSubscriptionLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAtSubscriptionLevelResponder handles the response to the CreateOrUpdateAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) CreateOrUpdateAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateByScope create or update a management lock by scope. +// +// scope is the scope for the lock. When providing a scope for the assignment, +// use '/subscriptions/{subscriptionId}' for subscriptions, +// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for +// resource groups, and +// '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' +// for resources. lockName is the name of lock. parameters is create or update +// management lock parameters. +func (client ManagementLocksClient) CreateOrUpdateByScope(scope string, lockName string, parameters ManagementLockObject) (result ManagementLockObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagementLockProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope") + } + + req, err := client.CreateOrUpdateByScopePreparer(scope, lockName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateByScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateByScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "CreateOrUpdateByScope", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateByScopePreparer prepares the CreateOrUpdateByScope request. +func (client ManagementLocksClient) CreateOrUpdateByScopePreparer(scope string, lockName string, parameters ManagementLockObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateByScopeSender sends the CreateOrUpdateByScope request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) CreateOrUpdateByScopeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateByScopeResponder handles the response to the CreateOrUpdateByScope request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) CreateOrUpdateByScopeResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteAtResourceGroupLevel to delete management locks, you must have access +// to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of +// the built-in roles, only Owner and User Access Administrator are granted +// those actions. +// +// resourceGroupName is the name of the resource group containing the lock. +// lockName is the name of lock to delete. +func (client ManagementLocksClient) DeleteAtResourceGroupLevel(resourceGroupName string, lockName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel") + } + + req, err := client.DeleteAtResourceGroupLevelPreparer(resourceGroupName, lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAtResourceGroupLevelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", resp, "Failure sending request") + return + } + + result, err = client.DeleteAtResourceGroupLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceGroupLevel", resp, "Failure responding to request") + } + + return +} + +// DeleteAtResourceGroupLevelPreparer prepares the DeleteAtResourceGroupLevel request. +func (client ManagementLocksClient) DeleteAtResourceGroupLevelPreparer(resourceGroupName string, lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAtResourceGroupLevelSender sends the DeleteAtResourceGroupLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) DeleteAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAtResourceGroupLevelResponder handles the response to the DeleteAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) DeleteAtResourceGroupLevelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtResourceLevel to delete management locks, you must have access to +// Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the +// built-in roles, only Owner and User Access Administrator are granted those +// actions. +// +// resourceGroupName is the name of the resource group containing the resource +// with the lock to delete. resourceProviderNamespace is the resource provider +// namespace of the resource with the lock to delete. parentResourcePath is the +// parent resource identity. resourceType is the resource type of the resource +// with the lock to delete. resourceName is the name of the resource with the +// lock to delete. lockName is the name of the lock to delete. +func (client ManagementLocksClient) DeleteAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel") + } + + req, err := client.DeleteAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAtResourceLevelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", resp, "Failure sending request") + return + } + + result, err = client.DeleteAtResourceLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtResourceLevel", resp, "Failure responding to request") + } + + return +} + +// DeleteAtResourceLevelPreparer prepares the DeleteAtResourceLevel request. +func (client ManagementLocksClient) DeleteAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAtResourceLevelSender sends the DeleteAtResourceLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) DeleteAtResourceLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAtResourceLevelResponder handles the response to the DeleteAtResourceLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) DeleteAtResourceLevelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAtSubscriptionLevel to delete management locks, you must have access +// to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of +// the built-in roles, only Owner and User Access Administrator are granted +// those actions. +// +// lockName is the name of lock to delete. +func (client ManagementLocksClient) DeleteAtSubscriptionLevel(lockName string) (result autorest.Response, err error) { + req, err := client.DeleteAtSubscriptionLevelPreparer(lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAtSubscriptionLevelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", resp, "Failure sending request") + return + } + + result, err = client.DeleteAtSubscriptionLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteAtSubscriptionLevel", resp, "Failure responding to request") + } + + return +} + +// DeleteAtSubscriptionLevelPreparer prepares the DeleteAtSubscriptionLevel request. +func (client ManagementLocksClient) DeleteAtSubscriptionLevelPreparer(lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAtSubscriptionLevelSender sends the DeleteAtSubscriptionLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) DeleteAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAtSubscriptionLevelResponder handles the response to the DeleteAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) DeleteAtSubscriptionLevelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteByScope delete a management lock by scope. +// +// scope is the scope for the lock. lockName is the name of lock. +func (client ManagementLocksClient) DeleteByScope(scope string, lockName string) (result autorest.Response, err error) { + req, err := client.DeleteByScopePreparer(scope, lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByScopeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", resp, "Failure sending request") + return + } + + result, err = client.DeleteByScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "DeleteByScope", resp, "Failure responding to request") + } + + return +} + +// DeleteByScopePreparer prepares the DeleteByScope request. +func (client ManagementLocksClient) DeleteByScopePreparer(scope string, lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteByScopeSender sends the DeleteByScope request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) DeleteByScopeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteByScopeResponder handles the response to the DeleteByScope request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) DeleteByScopeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetAtResourceGroupLevel gets a management lock at the resource group level. +// +// resourceGroupName is the name of the locked resource group. lockName is the +// name of the lock to get. +func (client ManagementLocksClient) GetAtResourceGroupLevel(resourceGroupName string, lockName string) (result ManagementLockObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel") + } + + req, err := client.GetAtResourceGroupLevelPreparer(resourceGroupName, lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtResourceGroupLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", resp, "Failure sending request") + return + } + + result, err = client.GetAtResourceGroupLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceGroupLevel", resp, "Failure responding to request") + } + + return +} + +// GetAtResourceGroupLevelPreparer prepares the GetAtResourceGroupLevel request. +func (client ManagementLocksClient) GetAtResourceGroupLevelPreparer(resourceGroupName string, lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAtResourceGroupLevelSender sends the GetAtResourceGroupLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) GetAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAtResourceGroupLevelResponder handles the response to the GetAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) GetAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtResourceLevel get the management lock of a resource or any level below +// resource. +// +// resourceGroupName is the name of the resource group. +// resourceProviderNamespace is the namespace of the resource provider. +// parentResourcePath is an extra path parameter needed in some services, like +// SQL Databases. resourceType is the type of the resource. resourceName is the +// name of the resource. lockName is the name of lock. +func (client ManagementLocksClient) GetAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (result ManagementLockObject, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "GetAtResourceLevel") + } + + req, err := client.GetAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtResourceLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", resp, "Failure sending request") + return + } + + result, err = client.GetAtResourceLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtResourceLevel", resp, "Failure responding to request") + } + + return +} + +// GetAtResourceLevelPreparer prepares the GetAtResourceLevel request. +func (client ManagementLocksClient) GetAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAtResourceLevelSender sends the GetAtResourceLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) GetAtResourceLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAtResourceLevelResponder handles the response to the GetAtResourceLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) GetAtResourceLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAtSubscriptionLevel gets a management lock at the subscription level. +// +// lockName is the name of the lock to get. +func (client ManagementLocksClient) GetAtSubscriptionLevel(lockName string) (result ManagementLockObject, err error) { + req, err := client.GetAtSubscriptionLevelPreparer(lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + resp, err := client.GetAtSubscriptionLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", resp, "Failure sending request") + return + } + + result, err = client.GetAtSubscriptionLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetAtSubscriptionLevel", resp, "Failure responding to request") + } + + return +} + +// GetAtSubscriptionLevelPreparer prepares the GetAtSubscriptionLevel request. +func (client ManagementLocksClient) GetAtSubscriptionLevelPreparer(lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAtSubscriptionLevelSender sends the GetAtSubscriptionLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) GetAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAtSubscriptionLevelResponder handles the response to the GetAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) GetAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByScope get a management lock by scope. +// +// scope is the scope for the lock. lockName is the name of lock. +func (client ManagementLocksClient) GetByScope(scope string, lockName string) (result ManagementLockObject, err error) { + req, err := client.GetByScopePreparer(scope, lockName) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", nil, "Failure preparing request") + return + } + + resp, err := client.GetByScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", resp, "Failure sending request") + return + } + + result, err = client.GetByScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "GetByScope", resp, "Failure responding to request") + } + + return +} + +// GetByScopePreparer prepares the GetByScope request. +func (client ManagementLocksClient) GetByScopePreparer(scope string, lockName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "lockName": autorest.Encode("path", lockName), + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/locks/{lockName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByScopeSender sends the GetByScope request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) GetByScopeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByScopeResponder handles the response to the GetByScope request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) GetByScopeResponder(resp *http.Response) (result ManagementLockObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtResourceGroupLevel gets all the management locks for a resource group. +// +// resourceGroupName is the name of the resource group containing the locks to +// get. filter is the filter to apply on the operation. +func (client ManagementLocksClient) ListAtResourceGroupLevel(resourceGroupName string, filter string) (result ManagementLockListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel") + } + + req, err := client.ListAtResourceGroupLevelPreparer(resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtResourceGroupLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure sending request") + return + } + + result, err = client.ListAtResourceGroupLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure responding to request") + } + + return +} + +// ListAtResourceGroupLevelPreparer prepares the ListAtResourceGroupLevel request. +func (client ManagementLocksClient) ListAtResourceGroupLevelPreparer(resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAtResourceGroupLevelSender sends the ListAtResourceGroupLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) ListAtResourceGroupLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAtResourceGroupLevelResponder handles the response to the ListAtResourceGroupLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) ListAtResourceGroupLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtResourceGroupLevelNextResults retrieves the next set of results, if any. +func (client ManagementLocksClient) ListAtResourceGroupLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { + req, err := lastResults.ManagementLockListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAtResourceGroupLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure sending next results request") + } + + result, err = client.ListAtResourceGroupLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceGroupLevel", resp, "Failure responding to next results request") + } + + return +} + +// ListAtResourceLevel gets all the management locks for a resource or any +// level below resource. +// +// resourceGroupName is the name of the resource group containing the locked +// resource. The name is case insensitive. resourceProviderNamespace is the +// namespace of the resource provider. parentResourcePath is the parent +// resource identity. resourceType is the resource type of the locked resource. +// resourceName is the name of the locked resource. filter is the filter to +// apply on the operation. +func (client ManagementLocksClient) ListAtResourceLevel(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result ManagementLockListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "locks.ManagementLocksClient", "ListAtResourceLevel") + } + + req, err := client.ListAtResourceLevelPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtResourceLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure sending request") + return + } + + result, err = client.ListAtResourceLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure responding to request") + } + + return +} + +// ListAtResourceLevelPreparer prepares the ListAtResourceLevel request. +func (client ManagementLocksClient) ListAtResourceLevelPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAtResourceLevelSender sends the ListAtResourceLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) ListAtResourceLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAtResourceLevelResponder handles the response to the ListAtResourceLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) ListAtResourceLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtResourceLevelNextResults retrieves the next set of results, if any. +func (client ManagementLocksClient) ListAtResourceLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { + req, err := lastResults.ManagementLockListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAtResourceLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure sending next results request") + } + + result, err = client.ListAtResourceLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtResourceLevel", resp, "Failure responding to next results request") + } + + return +} + +// ListAtSubscriptionLevel gets all the management locks for a subscription. +// +// filter is the filter to apply on the operation. +func (client ManagementLocksClient) ListAtSubscriptionLevel(filter string) (result ManagementLockListResult, err error) { + req, err := client.ListAtSubscriptionLevelPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing request") + return + } + + resp, err := client.ListAtSubscriptionLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure sending request") + return + } + + result, err = client.ListAtSubscriptionLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure responding to request") + } + + return +} + +// ListAtSubscriptionLevelPreparer prepares the ListAtSubscriptionLevel request. +func (client ManagementLocksClient) ListAtSubscriptionLevelPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAtSubscriptionLevelSender sends the ListAtSubscriptionLevel request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementLocksClient) ListAtSubscriptionLevelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAtSubscriptionLevelResponder handles the response to the ListAtSubscriptionLevel request. The method always +// closes the http.Response Body. +func (client ManagementLocksClient) ListAtSubscriptionLevelResponder(resp *http.Response) (result ManagementLockListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAtSubscriptionLevelNextResults retrieves the next set of results, if any. +func (client ManagementLocksClient) ListAtSubscriptionLevelNextResults(lastResults ManagementLockListResult) (result ManagementLockListResult, err error) { + req, err := lastResults.ManagementLockListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAtSubscriptionLevelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure sending next results request") + } + + result, err = client.ListAtSubscriptionLevelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "locks.ManagementLocksClient", "ListAtSubscriptionLevel", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/models.go index 6b381a80c2..ec9d5be399 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/models.go @@ -1,77 +1,77 @@ -package locks - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// LockLevel enumerates the values for lock level. -type LockLevel string - -const ( - // CanNotDelete specifies the can not delete state for lock level. - CanNotDelete LockLevel = "CanNotDelete" - // NotSpecified specifies the not specified state for lock level. - NotSpecified LockLevel = "NotSpecified" - // ReadOnly specifies the read only state for lock level. - ReadOnly LockLevel = "ReadOnly" -) - -// ManagementLockListResult is the list of locks. -type ManagementLockListResult struct { - autorest.Response `json:"-"` - Value *[]ManagementLockObject `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ManagementLockListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ManagementLockListResult) ManagementLockListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ManagementLockObject is the lock information. -type ManagementLockObject struct { - autorest.Response `json:"-"` - *ManagementLockProperties `json:"properties,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// ManagementLockOwner is lock owner properties. -type ManagementLockOwner struct { - ApplicationID *string `json:"applicationId,omitempty"` -} - -// ManagementLockProperties is the lock properties. -type ManagementLockProperties struct { - Level LockLevel `json:"level,omitempty"` - Notes *string `json:"notes,omitempty"` - Owners *[]ManagementLockOwner `json:"owners,omitempty"` -} +package locks + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// LockLevel enumerates the values for lock level. +type LockLevel string + +const ( + // CanNotDelete specifies the can not delete state for lock level. + CanNotDelete LockLevel = "CanNotDelete" + // NotSpecified specifies the not specified state for lock level. + NotSpecified LockLevel = "NotSpecified" + // ReadOnly specifies the read only state for lock level. + ReadOnly LockLevel = "ReadOnly" +) + +// ManagementLockListResult is the list of locks. +type ManagementLockListResult struct { + autorest.Response `json:"-"` + Value *[]ManagementLockObject `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagementLockListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ManagementLockListResult) ManagementLockListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ManagementLockObject is the lock information. +type ManagementLockObject struct { + autorest.Response `json:"-"` + *ManagementLockProperties `json:"properties,omitempty"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// ManagementLockOwner is lock owner properties. +type ManagementLockOwner struct { + ApplicationID *string `json:"applicationId,omitempty"` +} + +// ManagementLockProperties is the lock properties. +type ManagementLockProperties struct { + Level LockLevel `json:"level,omitempty"` + Notes *string `json:"notes,omitempty"` + Owners *[]ManagementLockOwner `json:"owners,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/version.go index d8ab496b60..1647dac6ac 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/locks/version.go @@ -1,29 +1,29 @@ -package locks - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-locks/2016-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package locks + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-locks/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/assignments.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/assignments.go index 38913343aa..bf9ccc3f8d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/assignments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/assignments.go @@ -1,754 +1,754 @@ -package policy - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AssignmentsClient is the to manage and control access to your resources, you -// can define customized policies and assign them at a scope. -type AssignmentsClient struct { - ManagementClient -} - -// NewAssignmentsClient creates an instance of the AssignmentsClient client. -func NewAssignmentsClient(subscriptionID string) AssignmentsClient { - return NewAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAssignmentsClientWithBaseURI creates an instance of the AssignmentsClient -// client. -func NewAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) AssignmentsClient { - return AssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create policy assignments are inherited by child resources. For example, -// when you apply a policy to a resource group that policy is assigned to all -// resources in the group. -// -// scope is the scope of the policy assignment. policyAssignmentName is the -// name of the policy assignment. parameters is parameters for the policy -// assignment. -func (client AssignmentsClient) Create(scope string, policyAssignmentName string, parameters Assignment) (result Assignment, err error) { - req, err := client.CreatePreparer(scope, policyAssignmentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AssignmentsClient) CreatePreparer(scope string, policyAssignmentName string, parameters Assignment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "scope": scope, - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) CreateResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateByID policy assignments are inherited by child resources. For example, -// when you apply a policy to a resource group that policy is assigned to all -// resources in the group. When providing a scope for the assigment, use -// '/subscriptions/{subscription-id}/' for subscriptions, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for -// resource groups, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' -// for resources. -// -// policyAssignmentID is the ID of the policy assignment to create. Use the -// format -// '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. -// parameters is parameters for policy assignment. -func (client AssignmentsClient) CreateByID(policyAssignmentID string, parameters Assignment) (result Assignment, err error) { - req, err := client.CreateByIDPreparer(policyAssignmentID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "CreateByID", nil, "Failure preparing request") - return - } - - resp, err := client.CreateByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "CreateByID", resp, "Failure sending request") - return - } - - result, err = client.CreateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "CreateByID", resp, "Failure responding to request") - } - - return -} - -// CreateByIDPreparer prepares the CreateByID request. -func (client AssignmentsClient) CreateByIDPreparer(policyAssignmentID string, parameters Assignment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyAssignmentId": policyAssignmentID, - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{policyAssignmentId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateByIDSender sends the CreateByID request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateByIDResponder handles the response to the CreateByID request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) CreateByIDResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a policy assignment. -// -// scope is the scope of the policy assignment. policyAssignmentName is the -// name of the policy assignment to delete. -func (client AssignmentsClient) Delete(scope string, policyAssignmentName string) (result Assignment, err error) { - req, err := client.DeletePreparer(scope, policyAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AssignmentsClient) DeletePreparer(scope string, policyAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "scope": scope, - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) DeleteResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteByID when providing a scope for the assigment, use -// '/subscriptions/{subscription-id}/' for subscriptions, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for -// resource groups, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' -// for resources. -// -// policyAssignmentID is the ID of the policy assignment to delete. Use the -// format -// '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. -func (client AssignmentsClient) DeleteByID(policyAssignmentID string) (result Assignment, err error) { - req, err := client.DeleteByIDPreparer(policyAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "DeleteByID", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "DeleteByID", resp, "Failure sending request") - return - } - - result, err = client.DeleteByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "DeleteByID", resp, "Failure responding to request") - } - - return -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client AssignmentsClient) DeleteByIDPreparer(policyAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyAssignmentId": policyAssignmentID, - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{policyAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) DeleteByIDResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a policy assignment. -// -// scope is the scope of the policy assignment. policyAssignmentName is the -// name of the policy assignment to get. -func (client AssignmentsClient) Get(scope string, policyAssignmentName string) (result Assignment, err error) { - req, err := client.GetPreparer(scope, policyAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AssignmentsClient) GetPreparer(scope string, policyAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "scope": scope, - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) GetResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID when providing a scope for the assigment, use -// '/subscriptions/{subscription-id}/' for subscriptions, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for -// resource groups, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' -// for resources. -// -// policyAssignmentID is the ID of the policy assignment to get. Use the format -// '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. -func (client AssignmentsClient) GetByID(policyAssignmentID string) (result Assignment, err error) { - req, err := client.GetByIDPreparer(policyAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "GetByID", resp, "Failure responding to request") - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client AssignmentsClient) GetByIDPreparer(policyAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyAssignmentId": policyAssignmentID, - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{policyAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) GetByIDResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the policy assignments for a subscription. -// -// filter is the filter to apply on the operation. -func (client AssignmentsClient) List(filter string) (result AssignmentListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AssignmentsClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyassignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) ListResponder(resp *http.Response) (result AssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AssignmentsClient) ListNextResults(lastResults AssignmentListResult) (result AssignmentListResult, err error) { - req, err := lastResults.AssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListForResource gets policy assignments for a resource. -// -// resourceGroupName is the name of the resource group containing the resource. -// The name is case insensitive. resourceProviderNamespace is the namespace of -// the resource provider. parentResourcePath is the parent resource path. -// resourceType is the resource type. resourceName is the name of the resource -// with policy assignments. filter is the filter to apply on the operation. -func (client AssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result AssignmentListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "policy.AssignmentsClient", "ListForResource") - } - - req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure responding to request") - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client AssignmentsClient) ListForResourcePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) ListForResourceResponder(resp *http.Response) (result AssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceNextResults retrieves the next set of results, if any. -func (client AssignmentsClient) ListForResourceNextResults(lastResults AssignmentListResult) (result AssignmentListResult, err error) { - req, err := lastResults.AssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure responding to next results request") - } - - return -} - -// ListForResourceGroup gets policy assignments for the resource group. -// -// resourceGroupName is the name of the resource group that contains policy -// assignments. filter is the filter to apply on the operation. -func (client AssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result AssignmentListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "policy.AssignmentsClient", "ListForResourceGroup") - } - - req, err := client.ListForResourceGroupPreparer(resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client AssignmentsClient) ListForResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result AssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceGroupNextResults retrieves the next set of results, if any. -func (client AssignmentsClient) ListForResourceGroupNextResults(lastResults AssignmentListResult) (result AssignmentListResult, err error) { - req, err := lastResults.AssignmentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package policy + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AssignmentsClient is the to manage and control access to your resources, you +// can define customized policies and assign them at a scope. +type AssignmentsClient struct { + ManagementClient +} + +// NewAssignmentsClient creates an instance of the AssignmentsClient client. +func NewAssignmentsClient(subscriptionID string) AssignmentsClient { + return NewAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAssignmentsClientWithBaseURI creates an instance of the AssignmentsClient +// client. +func NewAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) AssignmentsClient { + return AssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create policy assignments are inherited by child resources. For example, +// when you apply a policy to a resource group that policy is assigned to all +// resources in the group. +// +// scope is the scope of the policy assignment. policyAssignmentName is the +// name of the policy assignment. parameters is parameters for the policy +// assignment. +func (client AssignmentsClient) Create(scope string, policyAssignmentName string, parameters Assignment) (result Assignment, err error) { + req, err := client.CreatePreparer(scope, policyAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AssignmentsClient) CreatePreparer(scope string, policyAssignmentName string, parameters Assignment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyAssignmentName": autorest.Encode("path", policyAssignmentName), + "scope": scope, + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) CreateResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateByID policy assignments are inherited by child resources. For example, +// when you apply a policy to a resource group that policy is assigned to all +// resources in the group. When providing a scope for the assigment, use +// '/subscriptions/{subscription-id}/' for subscriptions, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// resource groups, and +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' +// for resources. +// +// policyAssignmentID is the ID of the policy assignment to create. Use the +// format +// '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. +// parameters is parameters for policy assignment. +func (client AssignmentsClient) CreateByID(policyAssignmentID string, parameters Assignment) (result Assignment, err error) { + req, err := client.CreateByIDPreparer(policyAssignmentID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "CreateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "CreateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "CreateByID", resp, "Failure responding to request") + } + + return +} + +// CreateByIDPreparer prepares the CreateByID request. +func (client AssignmentsClient) CreateByIDPreparer(policyAssignmentID string, parameters Assignment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyAssignmentId": policyAssignmentID, + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{policyAssignmentId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateByIDSender sends the CreateByID request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateByIDResponder handles the response to the CreateByID request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) CreateByIDResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a policy assignment. +// +// scope is the scope of the policy assignment. policyAssignmentName is the +// name of the policy assignment to delete. +func (client AssignmentsClient) Delete(scope string, policyAssignmentName string) (result Assignment, err error) { + req, err := client.DeletePreparer(scope, policyAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AssignmentsClient) DeletePreparer(scope string, policyAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyAssignmentName": autorest.Encode("path", policyAssignmentName), + "scope": scope, + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) DeleteResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByID when providing a scope for the assigment, use +// '/subscriptions/{subscription-id}/' for subscriptions, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// resource groups, and +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' +// for resources. +// +// policyAssignmentID is the ID of the policy assignment to delete. Use the +// format +// '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. +func (client AssignmentsClient) DeleteByID(policyAssignmentID string) (result Assignment, err error) { + req, err := client.DeleteByIDPreparer(policyAssignmentID) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "DeleteByID", resp, "Failure responding to request") + } + + return +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client AssignmentsClient) DeleteByIDPreparer(policyAssignmentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyAssignmentId": policyAssignmentID, + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{policyAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteByIDSender sends the DeleteByID request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteByIDResponder handles the response to the DeleteByID request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) DeleteByIDResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a policy assignment. +// +// scope is the scope of the policy assignment. policyAssignmentName is the +// name of the policy assignment to get. +func (client AssignmentsClient) Get(scope string, policyAssignmentName string) (result Assignment, err error) { + req, err := client.GetPreparer(scope, policyAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AssignmentsClient) GetPreparer(scope string, policyAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyAssignmentName": autorest.Encode("path", policyAssignmentName), + "scope": scope, + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) GetResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID when providing a scope for the assigment, use +// '/subscriptions/{subscription-id}/' for subscriptions, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// resource groups, and +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' +// for resources. +// +// policyAssignmentID is the ID of the policy assignment to get. Use the format +// '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. +func (client AssignmentsClient) GetByID(policyAssignmentID string) (result Assignment, err error) { + req, err := client.GetByIDPreparer(policyAssignmentID) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "GetByID", resp, "Failure responding to request") + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client AssignmentsClient) GetByIDPreparer(policyAssignmentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyAssignmentId": policyAssignmentID, + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{policyAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) GetByIDResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the policy assignments for a subscription. +// +// filter is the filter to apply on the operation. +func (client AssignmentsClient) List(filter string) (result AssignmentListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AssignmentsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyassignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) ListResponder(resp *http.Response) (result AssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AssignmentsClient) ListNextResults(lastResults AssignmentListResult) (result AssignmentListResult, err error) { + req, err := lastResults.AssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListForResource gets policy assignments for a resource. +// +// resourceGroupName is the name of the resource group containing the resource. +// The name is case insensitive. resourceProviderNamespace is the namespace of +// the resource provider. parentResourcePath is the parent resource path. +// resourceType is the resource type. resourceName is the name of the resource +// with policy assignments. filter is the filter to apply on the operation. +func (client AssignmentsClient) ListForResource(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result AssignmentListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "policy.AssignmentsClient", "ListForResource") + } + + req, err := client.ListForResourcePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure responding to request") + } + + return +} + +// ListForResourcePreparer prepares the ListForResource request. +func (client AssignmentsClient) ListForResourcePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceSender sends the ListForResource request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceResponder handles the response to the ListForResource request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) ListForResourceResponder(resp *http.Response) (result AssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceNextResults retrieves the next set of results, if any. +func (client AssignmentsClient) ListForResourceNextResults(lastResults AssignmentListResult) (result AssignmentListResult, err error) { + req, err := lastResults.AssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResource", resp, "Failure responding to next results request") + } + + return +} + +// ListForResourceGroup gets policy assignments for the resource group. +// +// resourceGroupName is the name of the resource group that contains policy +// assignments. filter is the filter to apply on the operation. +func (client AssignmentsClient) ListForResourceGroup(resourceGroupName string, filter string) (result AssignmentListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "policy.AssignmentsClient", "ListForResourceGroup") + } + + req, err := client.ListForResourceGroupPreparer(resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client AssignmentsClient) ListForResourceGroupPreparer(resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result AssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceGroupNextResults retrieves the next set of results, if any. +func (client AssignmentsClient) ListForResourceGroupNextResults(lastResults AssignmentListResult) (result AssignmentListResult, err error) { + req, err := lastResults.AssignmentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.AssignmentsClient", "ListForResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/client.go index c0b6fea3ed..e3338811d6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/client.go @@ -1,54 +1,54 @@ -// Package policy implements the Azure ARM Policy service API version -// 2016-12-01. -// -// To manage and control access to your resources, you can define customized -// policies and assign them at a scope. -package policy - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Policy - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Policy. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package policy implements the Azure ARM Policy service API version +// 2016-12-01. +// +// To manage and control access to your resources, you can define customized +// policies and assign them at a scope. +package policy + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Policy + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Policy. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/definitions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/definitions.go index 079fe239a6..2a808a63da 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/definitions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/definitions.go @@ -1,326 +1,326 @@ -package policy - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// DefinitionsClient is the to manage and control access to your resources, you -// can define customized policies and assign them at a scope. -type DefinitionsClient struct { - ManagementClient -} - -// NewDefinitionsClient creates an instance of the DefinitionsClient client. -func NewDefinitionsClient(subscriptionID string) DefinitionsClient { - return NewDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDefinitionsClientWithBaseURI creates an instance of the DefinitionsClient -// client. -func NewDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) DefinitionsClient { - return DefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a policy definition. -// -// policyDefinitionName is the name of the policy definition to create. -// parameters is the policy definition properties. -func (client DefinitionsClient) CreateOrUpdate(policyDefinitionName string, parameters Definition) (result Definition, err error) { - req, err := client.CreateOrUpdatePreparer(policyDefinitionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DefinitionsClient) CreateOrUpdatePreparer(policyDefinitionName string, parameters Definition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result Definition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a policy definition. -// -// policyDefinitionName is the name of the policy definition to delete. -func (client DefinitionsClient) Delete(policyDefinitionName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(policyDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DefinitionsClient) DeletePreparer(policyDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the policy definition. -// -// policyDefinitionName is the name of the policy definition to get. -func (client DefinitionsClient) Get(policyDefinitionName string) (result Definition, err error) { - req, err := client.GetPreparer(policyDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DefinitionsClient) GetPreparer(policyDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DefinitionsClient) GetResponder(resp *http.Response) (result Definition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the policy definitions for a subscription. -// -// filter is the filter to apply on the operation. -func (client DefinitionsClient) List(filter string) (result DefinitionListResult, err error) { - req, err := client.ListPreparer(filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DefinitionsClient) ListPreparer(filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DefinitionsClient) ListResponder(resp *http.Response) (result DefinitionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DefinitionsClient) ListNextResults(lastResults DefinitionListResult) (result DefinitionListResult, err error) { - req, err := lastResults.DefinitionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package policy + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// DefinitionsClient is the to manage and control access to your resources, you +// can define customized policies and assign them at a scope. +type DefinitionsClient struct { + ManagementClient +} + +// NewDefinitionsClient creates an instance of the DefinitionsClient client. +func NewDefinitionsClient(subscriptionID string) DefinitionsClient { + return NewDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDefinitionsClientWithBaseURI creates an instance of the DefinitionsClient +// client. +func NewDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) DefinitionsClient { + return DefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a policy definition. +// +// policyDefinitionName is the name of the policy definition to create. +// parameters is the policy definition properties. +func (client DefinitionsClient) CreateOrUpdate(policyDefinitionName string, parameters Definition) (result Definition, err error) { + req, err := client.CreateOrUpdatePreparer(policyDefinitionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DefinitionsClient) CreateOrUpdatePreparer(policyDefinitionName string, parameters Definition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyDefinitionName": autorest.Encode("path", policyDefinitionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result Definition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a policy definition. +// +// policyDefinitionName is the name of the policy definition to delete. +func (client DefinitionsClient) Delete(policyDefinitionName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(policyDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DefinitionsClient) DeletePreparer(policyDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyDefinitionName": autorest.Encode("path", policyDefinitionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the policy definition. +// +// policyDefinitionName is the name of the policy definition to get. +func (client DefinitionsClient) Get(policyDefinitionName string) (result Definition, err error) { + req, err := client.GetPreparer(policyDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DefinitionsClient) GetPreparer(policyDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyDefinitionName": autorest.Encode("path", policyDefinitionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DefinitionsClient) GetResponder(resp *http.Response) (result Definition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the policy definitions for a subscription. +// +// filter is the filter to apply on the operation. +func (client DefinitionsClient) List(filter string) (result DefinitionListResult, err error) { + req, err := client.ListPreparer(filter) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DefinitionsClient) ListPreparer(filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DefinitionsClient) ListResponder(resp *http.Response) (result DefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DefinitionsClient) ListNextResults(lastResults DefinitionListResult) (result DefinitionListResult, err error) { + req, err := lastResults.DefinitionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "policy.DefinitionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/models.go index 581d71985d..69cd973b40 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/models.go @@ -1,110 +1,110 @@ -package policy - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// Type enumerates the values for type. -type Type string - -const ( - // BuiltIn specifies the built in state for type. - BuiltIn Type = "BuiltIn" - // Custom specifies the custom state for type. - Custom Type = "Custom" - // NotSpecified specifies the not specified state for type. - NotSpecified Type = "NotSpecified" -) - -// Assignment is the policy definition. -type Assignment struct { - autorest.Response `json:"-"` - *AssignmentProperties `json:"properties,omitempty"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// AssignmentListResult is list of policy assignments. -type AssignmentListResult struct { - autorest.Response `json:"-"` - Value *[]Assignment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AssignmentListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AssignmentListResult) AssignmentListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AssignmentProperties is the policy assignment properties. -type AssignmentProperties struct { - DisplayName *string `json:"displayName,omitempty"` - PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` - Scope *string `json:"scope,omitempty"` - Parameters *map[string]interface{} `json:"parameters,omitempty"` - Description *string `json:"description,omitempty"` -} - -// Definition is the policy definition. -type Definition struct { - autorest.Response `json:"-"` - *DefinitionProperties `json:"properties,omitempty"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` -} - -// DefinitionListResult is list of policy definitions. -type DefinitionListResult struct { - autorest.Response `json:"-"` - Value *[]Definition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DefinitionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DefinitionListResult) DefinitionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DefinitionProperties is the policy definition properties. -type DefinitionProperties struct { - PolicyType Type `json:"policyType,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Description *string `json:"description,omitempty"` - PolicyRule *map[string]interface{} `json:"policyRule,omitempty"` - Parameters *map[string]interface{} `json:"parameters,omitempty"` -} +package policy + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// Type enumerates the values for type. +type Type string + +const ( + // BuiltIn specifies the built in state for type. + BuiltIn Type = "BuiltIn" + // Custom specifies the custom state for type. + Custom Type = "Custom" + // NotSpecified specifies the not specified state for type. + NotSpecified Type = "NotSpecified" +) + +// Assignment is the policy definition. +type Assignment struct { + autorest.Response `json:"-"` + *AssignmentProperties `json:"properties,omitempty"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// AssignmentListResult is list of policy assignments. +type AssignmentListResult struct { + autorest.Response `json:"-"` + Value *[]Assignment `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AssignmentListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AssignmentListResult) AssignmentListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AssignmentProperties is the policy assignment properties. +type AssignmentProperties struct { + DisplayName *string `json:"displayName,omitempty"` + PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` + Scope *string `json:"scope,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` + Description *string `json:"description,omitempty"` +} + +// Definition is the policy definition. +type Definition struct { + autorest.Response `json:"-"` + *DefinitionProperties `json:"properties,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// DefinitionListResult is list of policy definitions. +type DefinitionListResult struct { + autorest.Response `json:"-"` + Value *[]Definition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DefinitionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DefinitionListResult) DefinitionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DefinitionProperties is the policy definition properties. +type DefinitionProperties struct { + PolicyType Type `json:"policyType,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Description *string `json:"description,omitempty"` + PolicyRule *map[string]interface{} `json:"policyRule,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/version.go index abf84a67bf..8b263f2468 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/policy/version.go @@ -1,29 +1,29 @@ -package policy - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-policy/2016-12-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package policy + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-policy/2016-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/client.go index ea77db1b4d..3e13c72f95 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/client.go @@ -1,53 +1,53 @@ -// Package resources implements the Azure ARM Resources service API version -// 2016-09-01. -// -// Provides operations for working with resources and resource groups. -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Resources - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Resources. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package resources implements the Azure ARM Resources service API version +// 2016-09-01. +// +// Provides operations for working with resources and resource groups. +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Resources + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Resources. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deploymentoperations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deploymentoperations.go index 744d48d010..34d12aac6e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deploymentoperations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deploymentoperations.go @@ -1,230 +1,230 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DeploymentOperationsClient is the provides operations for working with -// resources and resource groups. -type DeploymentOperationsClient struct { - ManagementClient -} - -// NewDeploymentOperationsClient creates an instance of the -// DeploymentOperationsClient client. -func NewDeploymentOperationsClient(subscriptionID string) DeploymentOperationsClient { - return NewDeploymentOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDeploymentOperationsClientWithBaseURI creates an instance of the -// DeploymentOperationsClient client. -func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentOperationsClient { - return DeploymentOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a deployments operation. -// -// resourceGroupName is the name of the resource group. The name is case -// insensitive. deploymentName is the name of the deployment. operationID is -// the ID of the operation to get. -func (client DeploymentOperationsClient) Get(resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentOperationsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, deploymentName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DeploymentOperationsClient) GetPreparer(resourceGroupName string, deploymentName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (result DeploymentOperation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all deployments operations for a deployment. -// -// resourceGroupName is the name of the resource group. The name is case -// insensitive. deploymentName is the name of the deployment with the operation -// to get. top is the number of results to return. -func (client DeploymentOperationsClient) List(resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentOperationsClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, deploymentName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DeploymentOperationsClient) ListPreparer(resourceGroupName string, deploymentName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DeploymentOperationsClient) ListNextResults(lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { - req, err := lastResults.DeploymentOperationsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DeploymentOperationsClient is the provides operations for working with +// resources and resource groups. +type DeploymentOperationsClient struct { + ManagementClient +} + +// NewDeploymentOperationsClient creates an instance of the +// DeploymentOperationsClient client. +func NewDeploymentOperationsClient(subscriptionID string) DeploymentOperationsClient { + return NewDeploymentOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentOperationsClientWithBaseURI creates an instance of the +// DeploymentOperationsClient client. +func NewDeploymentOperationsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentOperationsClient { + return DeploymentOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a deployments operation. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. deploymentName is the name of the deployment. operationID is +// the ID of the operation to get. +func (client DeploymentOperationsClient) Get(resourceGroupName string, deploymentName string, operationID string) (result DeploymentOperation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentOperationsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, deploymentName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentOperationsClient) GetPreparer(resourceGroupName string, deploymentName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (result DeploymentOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all deployments operations for a deployment. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. deploymentName is the name of the deployment with the operation +// to get. top is the number of results to return. +func (client DeploymentOperationsClient) List(resourceGroupName string, deploymentName string, top *int32) (result DeploymentOperationsListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentOperationsClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, deploymentName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentOperationsClient) ListPreparer(resourceGroupName string, deploymentName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DeploymentOperationsClient) ListNextResults(lastResults DeploymentOperationsListResult) (result DeploymentOperationsListResult, err error) { + req, err := lastResults.DeploymentOperationsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deployments.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deployments.go index 9c8b2a7514..7c3e19288d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deployments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/deployments.go @@ -1,767 +1,767 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DeploymentsClient is the provides operations for working with resources and -// resource groups. -type DeploymentsClient struct { - ManagementClient -} - -// NewDeploymentsClient creates an instance of the DeploymentsClient client. -func NewDeploymentsClient(subscriptionID string) DeploymentsClient { - return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient -// client. -func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { - return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Cancel you can cancel a deployment only if the provisioningState is Accepted -// or Running. After the deployment is canceled, the provisioningState is set -// to Canceled. Canceling a template deployment stops the currently running -// template deployment and leaves the resource group partially deployed. -// -// resourceGroupName is the name of the resource group. The name is case -// insensitive. deploymentName is the name of the deployment to cancel. -func (client DeploymentsClient) Cancel(resourceGroupName string, deploymentName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Cancel") - } - - req, err := client.CancelPreparer(resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", nil, "Failure preparing request") - return - } - - resp, err := client.CancelSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure sending request") - return - } - - result, err = client.CancelResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure responding to request") - } - - return -} - -// CancelPreparer prepares the Cancel request. -func (client DeploymentsClient) CancelPreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CancelSender sends the Cancel request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CancelResponder handles the response to the Cancel request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckExistence checks whether the deployment exists. -// -// resourceGroupName is the name of the resource group with the deployment to -// check. The name is case insensitive. deploymentName is the name of the -// deployment to check. -func (client DeploymentsClient) CheckExistence(resourceGroupName string, deploymentName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "CheckExistence") - } - - req, err := client.CheckExistencePreparer(resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure responding to request") - } - - return -} - -// CheckExistencePreparer prepares the CheckExistence request. -func (client DeploymentsClient) CheckExistencePreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckExistenceSender sends the CheckExistence request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckExistenceResponder handles the response to the CheckExistence request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate you can provide the template and parameters directly in the -// request or link to JSON files. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group to deploy the resources -// to. The name is case insensitive. The resource group must already exist. -// deploymentName is the name of the deployment. parameters is additional -// parameters supplied to the operation. -func (client DeploymentsClient) CreateOrUpdate(resourceGroupName string, deploymentName string, parameters Deployment, cancel <-chan struct{}) (<-chan DeploymentExtended, <-chan error) { - resultChan := make(chan DeploymentExtended, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result DeploymentExtended - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, deploymentName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string, deploymentName string, parameters Deployment, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete a template deployment that is currently running cannot be deleted. -// Deleting a template deployment removes the associated deployment operations. -// Deleting a template deployment does not affect the state of the resource -// group. This is an asynchronous operation that returns a status of 202 until -// the template deployment is successfully deleted. The Location response -// header contains the URI that is used to obtain the status of the process. -// While the process is running, a call to the URI in the Location header -// returns a status of 202. When the process finishes, the URI in the Location -// header returns a status of 204 on success. If the asynchronous request -// failed, the URI in the Location header returns an error-level status code. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group with the deployment to -// delete. The name is case insensitive. deploymentName is the name of the -// deployment to delete. -func (client DeploymentsClient) Delete(resourceGroupName string, deploymentName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, deploymentName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploymentName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportTemplate exports the template used for specified deployment. -// -// resourceGroupName is the name of the resource group. The name is case -// insensitive. deploymentName is the name of the deployment from which to get -// the template. -func (client DeploymentsClient) ExportTemplate(resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "ExportTemplate") - } - - req, err := client.ExportTemplatePreparer(resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", nil, "Failure preparing request") - return - } - - resp, err := client.ExportTemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure sending request") - return - } - - result, err = client.ExportTemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure responding to request") - } - - return -} - -// ExportTemplatePreparer prepares the ExportTemplate request. -func (client DeploymentsClient) ExportTemplatePreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ExportTemplateSender sends the ExportTemplate request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ExportTemplateResponder handles the response to the ExportTemplate request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (result DeploymentExportResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a deployment. -// -// resourceGroupName is the name of the resource group. The name is case -// insensitive. deploymentName is the name of the deployment to get. -func (client DeploymentsClient) Get(resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, deploymentName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DeploymentsClient) GetPreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentExtended, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all the deployments for a resource group. -// -// resourceGroupName is the name of the resource group with the deployments to -// get. The name is case insensitive. filter is the filter to apply on the -// operation. For example, you can use $filter=provisioningState eq '{state}'. -// top is the number of results to get. If null is passed, returns all -// deployments. -func (client DeploymentsClient) List(resourceGroupName string, filter string, top *int32) (result DeploymentListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DeploymentsClient) ListPreparer(resourceGroupName string, filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult) (result DeploymentListResult, err error) { - req, err := lastResults.DeploymentListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Validate validates whether the specified template is syntactically correct -// and will be accepted by Azure Resource Manager.. -// -// resourceGroupName is the name of the resource group the template will be -// deployed to. The name is case insensitive. deploymentName is the name of the -// deployment. parameters is parameters to validate. -func (client DeploymentsClient) Validate(resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: deploymentName, - Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Validate") - } - - req, err := client.ValidatePreparer(resourceGroupName, deploymentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure sending request") - return - } - - result, err = client.ValidateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure responding to request") - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client DeploymentsClient) ValidatePreparer(resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "deploymentName": autorest.Encode("path", deploymentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client DeploymentsClient) ValidateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client DeploymentsClient) ValidateResponder(resp *http.Response) (result DeploymentValidateResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DeploymentsClient is the provides operations for working with resources and +// resource groups. +type DeploymentsClient struct { + ManagementClient +} + +// NewDeploymentsClient creates an instance of the DeploymentsClient client. +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient +// client. +func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel you can cancel a deployment only if the provisioningState is Accepted +// or Running. After the deployment is canceled, the provisioningState is set +// to Canceled. Canceling a template deployment stops the currently running +// template deployment and leaves the resource group partially deployed. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. deploymentName is the name of the deployment to cancel. +func (client DeploymentsClient) Cancel(resourceGroupName string, deploymentName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Cancel") + } + + req, err := client.CancelPreparer(resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Cancel", resp, "Failure responding to request") + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client DeploymentsClient) CancelPreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistence checks whether the deployment exists. +// +// resourceGroupName is the name of the resource group with the deployment to +// check. The name is case insensitive. deploymentName is the name of the +// deployment to check. +func (client DeploymentsClient) CheckExistence(resourceGroupName string, deploymentName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "CheckExistence") + } + + req, err := client.CheckExistencePreparer(resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CheckExistence", resp, "Failure responding to request") + } + + return +} + +// CheckExistencePreparer prepares the CheckExistence request. +func (client DeploymentsClient) CheckExistencePreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckExistenceSender sends the CheckExistence request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckExistenceResponder handles the response to the CheckExistence request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate you can provide the template and parameters directly in the +// request or link to JSON files. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group to deploy the resources +// to. The name is case insensitive. The resource group must already exist. +// deploymentName is the name of the deployment. parameters is additional +// parameters supplied to the operation. +func (client DeploymentsClient) CreateOrUpdate(resourceGroupName string, deploymentName string, parameters Deployment, cancel <-chan struct{}) (<-chan DeploymentExtended, <-chan error) { + resultChan := make(chan DeploymentExtended, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result DeploymentExtended + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, deploymentName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeploymentsClient) CreateOrUpdatePreparer(resourceGroupName string, deploymentName string, parameters Deployment, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete a template deployment that is currently running cannot be deleted. +// Deleting a template deployment removes the associated deployment operations. +// Deleting a template deployment does not affect the state of the resource +// group. This is an asynchronous operation that returns a status of 202 until +// the template deployment is successfully deleted. The Location response +// header contains the URI that is used to obtain the status of the process. +// While the process is running, a call to the URI in the Location header +// returns a status of 202. When the process finishes, the URI in the Location +// header returns a status of 204 on success. If the asynchronous request +// failed, the URI in the Location header returns an error-level status code. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group with the deployment to +// delete. The name is case insensitive. deploymentName is the name of the +// deployment to delete. +func (client DeploymentsClient) Delete(resourceGroupName string, deploymentName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, deploymentName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client DeploymentsClient) DeletePreparer(resourceGroupName string, deploymentName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportTemplate exports the template used for specified deployment. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. deploymentName is the name of the deployment from which to get +// the template. +func (client DeploymentsClient) ExportTemplate(resourceGroupName string, deploymentName string) (result DeploymentExportResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "ExportTemplate") + } + + req, err := client.ExportTemplatePreparer(resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "ExportTemplate", resp, "Failure responding to request") + } + + return +} + +// ExportTemplatePreparer prepares the ExportTemplate request. +func (client DeploymentsClient) ExportTemplatePreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ExportTemplateSender sends the ExportTemplate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ExportTemplateResponder handles the response to the ExportTemplate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (result DeploymentExportResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a deployment. +// +// resourceGroupName is the name of the resource group. The name is case +// insensitive. deploymentName is the name of the deployment to get. +func (client DeploymentsClient) Get(resourceGroupName string, deploymentName string) (result DeploymentExtended, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentsClient) GetPreparer(resourceGroupName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentExtended, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all the deployments for a resource group. +// +// resourceGroupName is the name of the resource group with the deployments to +// get. The name is case insensitive. filter is the filter to apply on the +// operation. For example, you can use $filter=provisioningState eq '{state}'. +// top is the number of results to get. If null is passed, returns all +// deployments. +func (client DeploymentsClient) List(resourceGroupName string, filter string, top *int32) (result DeploymentListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentsClient) ListPreparer(resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) ListNextResults(lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.DeploymentListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Validate validates whether the specified template is syntactically correct +// and will be accepted by Azure Resource Manager.. +// +// resourceGroupName is the name of the resource group the template will be +// deployed to. The name is case insensitive. deploymentName is the name of the +// deployment. parameters is parameters to validate. +func (client DeploymentsClient) Validate(resourceGroupName string, deploymentName string, parameters Deployment) (result DeploymentValidateResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "deploymentName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "deploymentName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.TemplateLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Properties.ParametersLink", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Properties.ParametersLink.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.DeploymentsClient", "Validate") + } + + req, err := client.ValidatePreparer(resourceGroupName, deploymentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client DeploymentsClient) ValidatePreparer(resourceGroupName string, deploymentName string, parameters Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ValidateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ValidateResponder(resp *http.Response) (result DeploymentValidateResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/groups.go index 6af18060e8..13244a9ea6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/groups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/groups.go @@ -1,711 +1,711 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupsClient is the provides operations for working with resources and -// resource groups. -type GroupsClient struct { - ManagementClient -} - -// NewGroupsClient creates an instance of the GroupsClient client. -func NewGroupsClient(subscriptionID string) GroupsClient { - return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client. -func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { - return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckExistence checks whether a resource group exists. -// -// resourceGroupName is the name of the resource group to check. The name is -// case insensitive. -func (client GroupsClient) CheckExistence(resourceGroupName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "CheckExistence") - } - - req, err := client.CheckExistencePreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure responding to request") - } - - return -} - -// CheckExistencePreparer prepares the CheckExistence request. -func (client GroupsClient) CheckExistencePreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckExistenceSender sends the CheckExistence request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckExistenceResponder handles the response to the CheckExistence request. The method always -// closes the http.Response Body. -func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates a resource group. -// -// resourceGroupName is the name of the resource group to create or update. -// parameters is parameters supplied to the create or update a resource group. -func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters Group) (result Group, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, parameters Group) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete when you delete a resource group, all of its resources are also -// deleted. Deleting a resource group deletes all of its template deployments -// and currently stored operations. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group to delete. The name is -// case insensitive. -func (client GroupsClient) Delete(resourceGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(resourceGroupName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ExportTemplate captures the specified resource group as a template. -// -// resourceGroupName is the name of the resource group to export as a template. -// parameters is parameters for exporting the template. -func (client GroupsClient) ExportTemplate(resourceGroupName string, parameters ExportTemplateRequest) (result GroupExportResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "ExportTemplate") - } - - req, err := client.ExportTemplatePreparer(resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", nil, "Failure preparing request") - return - } - - resp, err := client.ExportTemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", resp, "Failure sending request") - return - } - - result, err = client.ExportTemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", resp, "Failure responding to request") - } - - return -} - -// ExportTemplatePreparer prepares the ExportTemplate request. -func (client GroupsClient) ExportTemplatePreparer(resourceGroupName string, parameters ExportTemplateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ExportTemplateSender sends the ExportTemplate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ExportTemplateResponder handles the response to the ExportTemplate request. The method always -// closes the http.Response Body. -func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result GroupExportResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a resource group. -// -// resourceGroupName is the name of the resource group to get. The name is case -// insensitive. -func (client GroupsClient) Get(resourceGroupName string) (result Group, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupsClient) GetPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the resource groups for a subscription. -// -// filter is the filter to apply on the operation. top is the number of results -// to return. If null is passed, returns all resource groups. -func (client GroupsClient) List(filter string, top *int32) (result GroupListResult, err error) { - req, err := client.ListPreparer(filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupsClient) ListPreparer(filter string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupsClient) ListNextResults(lastResults GroupListResult) (result GroupListResult, err error) { - req, err := lastResults.GroupListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListResources get all the resources for a resource group. -// -// resourceGroupName is the resource group with the resources to get. filter is -// the filter to apply on the operation. expand is the $expand query parameter -// top is the number of results to return. If null is passed, returns all -// resources. -func (client GroupsClient) ListResources(resourceGroupName string, filter string, expand string, top *int32) (result ListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "ListResources") - } - - req, err := client.ListResourcesPreparer(resourceGroupName, filter, expand, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing request") - return - } - - resp, err := client.ListResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure sending request") - return - } - - result, err = client.ListResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to request") - } - - return -} - -// ListResourcesPreparer prepares the ListResources request. -func (client GroupsClient) ListResourcesPreparer(resourceGroupName string, filter string, expand string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListResourcesSender sends the ListResources request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListResourcesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResourcesResponder handles the response to the ListResources request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListResourcesNextResults retrieves the next set of results, if any. -func (client GroupsClient) ListResourcesNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure sending next results request") - } - - result, err = client.ListResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to next results request") - } - - return -} - -// Patch resource groups can be updated through a simple PATCH operation to a -// group address. The format of the request is the same as that for creating a -// resource group. If a field is unspecified, the current value is retained. -// -// resourceGroupName is the name of the resource group to update. The name is -// case insensitive. parameters is parameters supplied to update a resource -// group. -func (client GroupsClient) Patch(resourceGroupName string, parameters Group) (result Group, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Patch") - } - - req, err := client.PatchPreparer(resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", resp, "Failure responding to request") - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client GroupsClient) PatchPreparer(resourceGroupName string, parameters Group) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client GroupsClient) PatchResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupsClient is the provides operations for working with resources and +// resource groups. +type GroupsClient struct { + ManagementClient +} + +// NewGroupsClient creates an instance of the GroupsClient client. +func NewGroupsClient(subscriptionID string) GroupsClient { + return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client. +func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { + return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckExistence checks whether a resource group exists. +// +// resourceGroupName is the name of the resource group to check. The name is +// case insensitive. +func (client GroupsClient) CheckExistence(resourceGroupName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "CheckExistence") + } + + req, err := client.CheckExistencePreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CheckExistence", resp, "Failure responding to request") + } + + return +} + +// CheckExistencePreparer prepares the CheckExistence request. +func (client GroupsClient) CheckExistencePreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckExistenceSender sends the CheckExistence request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckExistenceResponder handles the response to the CheckExistence request. The method always +// closes the http.Response Body. +func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate creates a resource group. +// +// resourceGroupName is the name of the resource group to create or update. +// parameters is parameters supplied to the create or update a resource group. +func (client GroupsClient) CreateOrUpdate(resourceGroupName string, parameters Group) (result Group, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupsClient) CreateOrUpdatePreparer(resourceGroupName string, parameters Group) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete when you delete a resource group, all of its resources are also +// deleted. Deleting a resource group deletes all of its template deployments +// and currently stored operations. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group to delete. The name is +// case insensitive. +func (client GroupsClient) Delete(resourceGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client GroupsClient) DeletePreparer(resourceGroupName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportTemplate captures the specified resource group as a template. +// +// resourceGroupName is the name of the resource group to export as a template. +// parameters is parameters for exporting the template. +func (client GroupsClient) ExportTemplate(resourceGroupName string, parameters ExportTemplateRequest) (result GroupExportResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "ExportTemplate") + } + + req, err := client.ExportTemplatePreparer(resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", nil, "Failure preparing request") + return + } + + resp, err := client.ExportTemplateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", resp, "Failure sending request") + return + } + + result, err = client.ExportTemplateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ExportTemplate", resp, "Failure responding to request") + } + + return +} + +// ExportTemplatePreparer prepares the ExportTemplate request. +func (client GroupsClient) ExportTemplatePreparer(resourceGroupName string, parameters ExportTemplateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ExportTemplateSender sends the ExportTemplate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ExportTemplateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ExportTemplateResponder handles the response to the ExportTemplate request. The method always +// closes the http.Response Body. +func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result GroupExportResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a resource group. +// +// resourceGroupName is the name of the resource group to get. The name is case +// insensitive. +func (client GroupsClient) Get(resourceGroupName string) (result Group, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupsClient) GetPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the resource groups for a subscription. +// +// filter is the filter to apply on the operation. top is the number of results +// to return. If null is passed, returns all resource groups. +func (client GroupsClient) List(filter string, top *int32) (result GroupListResult, err error) { + req, err := client.ListPreparer(filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupsClient) ListPreparer(filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupsClient) ListNextResults(lastResults GroupListResult) (result GroupListResult, err error) { + req, err := lastResults.GroupListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListResources get all the resources for a resource group. +// +// resourceGroupName is the resource group with the resources to get. filter is +// the filter to apply on the operation. expand is the $expand query parameter +// top is the number of results to return. If null is passed, returns all +// resources. +func (client GroupsClient) ListResources(resourceGroupName string, filter string, expand string, top *int32) (result ListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "ListResources") + } + + req, err := client.ListResourcesPreparer(resourceGroupName, filter, expand, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing request") + return + } + + resp, err := client.ListResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure sending request") + return + } + + result, err = client.ListResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to request") + } + + return +} + +// ListResourcesPreparer prepares the ListResources request. +func (client GroupsClient) ListResourcesPreparer(resourceGroupName string, filter string, expand string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListResourcesSender sends the ListResources request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) ListResourcesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResourcesResponder handles the response to the ListResources request. The method always +// closes the http.Response Body. +func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListResourcesNextResults retrieves the next set of results, if any. +func (client GroupsClient) ListResourcesNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure sending next results request") + } + + result, err = client.ListResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to next results request") + } + + return +} + +// Patch resource groups can be updated through a simple PATCH operation to a +// group address. The format of the request is the same as that for creating a +// resource group. If a field is unspecified, the current value is retained. +// +// resourceGroupName is the name of the resource group to update. The name is +// case insensitive. parameters is parameters supplied to update a resource +// group. +func (client GroupsClient) Patch(resourceGroupName string, parameters Group) (result Group, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupsClient", "Patch") + } + + req, err := client.PatchPreparer(resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client GroupsClient) PatchPreparer(resourceGroupName string, parameters Group) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client GroupsClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client GroupsClient) PatchResponder(resp *http.Response) (result Group, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/models.go index 02febb8d0e..dd0f06f5f1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/models.go @@ -1,457 +1,457 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DeploymentMode enumerates the values for deployment mode. -type DeploymentMode string - -const ( - // Complete specifies the complete state for deployment mode. - Complete DeploymentMode = "Complete" - // Incremental specifies the incremental state for deployment mode. - Incremental DeploymentMode = "Incremental" -) - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // SystemAssigned specifies the system assigned state for resource identity - // type. - SystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// AliasPathType is the type of the paths for alias. -type AliasPathType struct { - Path *string `json:"path,omitempty"` - APIVersions *[]string `json:"apiVersions,omitempty"` -} - -// AliasType is the alias type. -type AliasType struct { - Name *string `json:"name,omitempty"` - Paths *[]AliasPathType `json:"paths,omitempty"` -} - -// BasicDependency is deployment dependency information. -type BasicDependency struct { - ID *string `json:"id,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` -} - -// DebugSetting is -type DebugSetting struct { - DetailLevel *string `json:"detailLevel,omitempty"` -} - -// Dependency is deployment dependency information. -type Dependency struct { - DependsOn *[]BasicDependency `json:"dependsOn,omitempty"` - ID *string `json:"id,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` -} - -// Deployment is deployment operation parameters. -type Deployment struct { - Properties *DeploymentProperties `json:"properties,omitempty"` -} - -// DeploymentExportResult is the deployment export result. -type DeploymentExportResult struct { - autorest.Response `json:"-"` - Template *map[string]interface{} `json:"template,omitempty"` -} - -// DeploymentExtended is deployment information. -type DeploymentExtended struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` -} - -// DeploymentExtendedFilter is deployment filter. -type DeploymentExtendedFilter struct { - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// DeploymentListResult is list of deployments. -type DeploymentListResult struct { - autorest.Response `json:"-"` - Value *[]DeploymentExtended `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DeploymentListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DeploymentListResult) DeploymentListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DeploymentOperation is deployment operation information. -type DeploymentOperation struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - OperationID *string `json:"operationId,omitempty"` - Properties *DeploymentOperationProperties `json:"properties,omitempty"` -} - -// DeploymentOperationProperties is deployment operation properties. -type DeploymentOperationProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - Timestamp *date.Time `json:"timestamp,omitempty"` - ServiceRequestID *string `json:"serviceRequestId,omitempty"` - StatusCode *string `json:"statusCode,omitempty"` - StatusMessage *map[string]interface{} `json:"statusMessage,omitempty"` - TargetResource *TargetResource `json:"targetResource,omitempty"` - Request *HTTPMessage `json:"request,omitempty"` - Response *HTTPMessage `json:"response,omitempty"` -} - -// DeploymentOperationsListResult is list of deployment operations. -type DeploymentOperationsListResult struct { - autorest.Response `json:"-"` - Value *[]DeploymentOperation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DeploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DeploymentOperationsListResult) DeploymentOperationsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DeploymentProperties is deployment properties. -type DeploymentProperties struct { - Template *map[string]interface{} `json:"template,omitempty"` - TemplateLink *TemplateLink `json:"templateLink,omitempty"` - Parameters *map[string]interface{} `json:"parameters,omitempty"` - ParametersLink *ParametersLink `json:"parametersLink,omitempty"` - Mode DeploymentMode `json:"mode,omitempty"` - DebugSetting *DebugSetting `json:"debugSetting,omitempty"` -} - -// DeploymentPropertiesExtended is deployment properties with additional -// details. -type DeploymentPropertiesExtended struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - CorrelationID *string `json:"correlationId,omitempty"` - Timestamp *date.Time `json:"timestamp,omitempty"` - Outputs *map[string]interface{} `json:"outputs,omitempty"` - Providers *[]Provider `json:"providers,omitempty"` - Dependencies *[]Dependency `json:"dependencies,omitempty"` - Template *map[string]interface{} `json:"template,omitempty"` - TemplateLink *TemplateLink `json:"templateLink,omitempty"` - Parameters *map[string]interface{} `json:"parameters,omitempty"` - ParametersLink *ParametersLink `json:"parametersLink,omitempty"` - Mode DeploymentMode `json:"mode,omitempty"` - DebugSetting *DebugSetting `json:"debugSetting,omitempty"` -} - -// DeploymentValidateResult is information from validate template deployment -// response. -type DeploymentValidateResult struct { - autorest.Response `json:"-"` - Error *ManagementErrorWithDetails `json:"error,omitempty"` - Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` -} - -// ExportTemplateRequest is export resource group template request parameters. -type ExportTemplateRequest struct { - ResourcesProperty *[]string `json:"resources,omitempty"` - Options *string `json:"options,omitempty"` -} - -// GenericResource is resource information. -type GenericResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Plan *Plan `json:"plan,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Kind *string `json:"kind,omitempty"` - ManagedBy *string `json:"managedBy,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Identity *Identity `json:"identity,omitempty"` -} - -// GenericResourceFilter is resource filter. -type GenericResourceFilter struct { - ResourceType *string `json:"resourceType,omitempty"` - Tagname *string `json:"tagname,omitempty"` - Tagvalue *string `json:"tagvalue,omitempty"` -} - -// Group is resource group information. -type Group struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *GroupProperties `json:"properties,omitempty"` - Location *string `json:"location,omitempty"` - ManagedBy *string `json:"managedBy,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// GroupExportResult is -type GroupExportResult struct { - autorest.Response `json:"-"` - Template *map[string]interface{} `json:"template,omitempty"` - Error *ManagementErrorWithDetails `json:"error,omitempty"` -} - -// GroupFilter is resource group filter. -type GroupFilter struct { - TagName *string `json:"tagName,omitempty"` - TagValue *string `json:"tagValue,omitempty"` -} - -// GroupListResult is list of resource groups. -type GroupListResult struct { - autorest.Response `json:"-"` - Value *[]Group `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// GroupListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client GroupListResult) GroupListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// GroupProperties is the resource group properties. -type GroupProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// HTTPMessage is -type HTTPMessage struct { - Content *map[string]interface{} `json:"content,omitempty"` -} - -// Identity is identity for the resource. -type Identity struct { - PrincipalID *string `json:"principalId,omitempty"` - TenantID *string `json:"tenantId,omitempty"` - Type ResourceIdentityType `json:"type,omitempty"` -} - -// ListResult is list of resource groups. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]GenericResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ManagementErrorWithDetails is -type ManagementErrorWithDetails struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ManagementErrorWithDetails `json:"details,omitempty"` -} - -// MoveInfo is parameters of move resources. -type MoveInfo struct { - ResourcesProperty *[]string `json:"resources,omitempty"` - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` -} - -// ParametersLink is entity representing the reference to the deployment -// paramaters. -type ParametersLink struct { - URI *string `json:"uri,omitempty"` - ContentVersion *string `json:"contentVersion,omitempty"` -} - -// Plan is plan for the resource. -type Plan struct { - Name *string `json:"name,omitempty"` - Publisher *string `json:"publisher,omitempty"` - Product *string `json:"product,omitempty"` - PromotionCode *string `json:"promotionCode,omitempty"` -} - -// Provider is resource provider information. -type Provider struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Namespace *string `json:"namespace,omitempty"` - RegistrationState *string `json:"registrationState,omitempty"` - ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` -} - -// ProviderListResult is list of resource providers. -type ProviderListResult struct { - autorest.Response `json:"-"` - Value *[]Provider `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ProviderListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProviderListResult) ProviderListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProviderOperationDisplayProperties is resource provider operation's display -// properties. -type ProviderOperationDisplayProperties struct { - Publisher *string `json:"publisher,omitempty"` - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` - Description *string `json:"description,omitempty"` -} - -// ProviderResourceType is resource type managed by the resource provider. -type ProviderResourceType struct { - ResourceType *string `json:"resourceType,omitempty"` - Locations *[]string `json:"locations,omitempty"` - Aliases *[]AliasType `json:"aliases,omitempty"` - APIVersions *[]string `json:"apiVersions,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Sku is sKU for the resource. -type Sku struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` - Size *string `json:"size,omitempty"` - Family *string `json:"family,omitempty"` - Model *string `json:"model,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} - -// TagCount is tag count. -type TagCount struct { - Type *string `json:"type,omitempty"` - Value *int32 `json:"value,omitempty"` -} - -// TagDetails is tag details. -type TagDetails struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - TagName *string `json:"tagName,omitempty"` - Count *TagCount `json:"count,omitempty"` - Values *[]TagValue `json:"values,omitempty"` -} - -// TagsListResult is list of subscription tags. -type TagsListResult struct { - autorest.Response `json:"-"` - Value *[]TagDetails `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// TagsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client TagsListResult) TagsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// TagValue is tag information. -type TagValue struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - TagValue *string `json:"tagValue,omitempty"` - Count *TagCount `json:"count,omitempty"` -} - -// TargetResource is target resource. -type TargetResource struct { - ID *string `json:"id,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` -} - -// TemplateLink is entity representing the reference to the template. -type TemplateLink struct { - URI *string `json:"uri,omitempty"` - ContentVersion *string `json:"contentVersion,omitempty"` -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DeploymentMode enumerates the values for deployment mode. +type DeploymentMode string + +const ( + // Complete specifies the complete state for deployment mode. + Complete DeploymentMode = "Complete" + // Incremental specifies the incremental state for deployment mode. + Incremental DeploymentMode = "Incremental" +) + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned specifies the system assigned state for resource identity + // type. + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// AliasPathType is the type of the paths for alias. +type AliasPathType struct { + Path *string `json:"path,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` +} + +// AliasType is the alias type. +type AliasType struct { + Name *string `json:"name,omitempty"` + Paths *[]AliasPathType `json:"paths,omitempty"` +} + +// BasicDependency is deployment dependency information. +type BasicDependency struct { + ID *string `json:"id,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` +} + +// DebugSetting is +type DebugSetting struct { + DetailLevel *string `json:"detailLevel,omitempty"` +} + +// Dependency is deployment dependency information. +type Dependency struct { + DependsOn *[]BasicDependency `json:"dependsOn,omitempty"` + ID *string `json:"id,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` +} + +// Deployment is deployment operation parameters. +type Deployment struct { + Properties *DeploymentProperties `json:"properties,omitempty"` +} + +// DeploymentExportResult is the deployment export result. +type DeploymentExportResult struct { + autorest.Response `json:"-"` + Template *map[string]interface{} `json:"template,omitempty"` +} + +// DeploymentExtended is deployment information. +type DeploymentExtended struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` +} + +// DeploymentExtendedFilter is deployment filter. +type DeploymentExtendedFilter struct { + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// DeploymentListResult is list of deployments. +type DeploymentListResult struct { + autorest.Response `json:"-"` + Value *[]DeploymentExtended `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DeploymentListResult) DeploymentListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DeploymentOperation is deployment operation information. +type DeploymentOperation struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + OperationID *string `json:"operationId,omitempty"` + Properties *DeploymentOperationProperties `json:"properties,omitempty"` +} + +// DeploymentOperationProperties is deployment operation properties. +type DeploymentOperationProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + Timestamp *date.Time `json:"timestamp,omitempty"` + ServiceRequestID *string `json:"serviceRequestId,omitempty"` + StatusCode *string `json:"statusCode,omitempty"` + StatusMessage *map[string]interface{} `json:"statusMessage,omitempty"` + TargetResource *TargetResource `json:"targetResource,omitempty"` + Request *HTTPMessage `json:"request,omitempty"` + Response *HTTPMessage `json:"response,omitempty"` +} + +// DeploymentOperationsListResult is list of deployment operations. +type DeploymentOperationsListResult struct { + autorest.Response `json:"-"` + Value *[]DeploymentOperation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DeploymentOperationsListResult) DeploymentOperationsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DeploymentProperties is deployment properties. +type DeploymentProperties struct { + Template *map[string]interface{} `json:"template,omitempty"` + TemplateLink *TemplateLink `json:"templateLink,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + Mode DeploymentMode `json:"mode,omitempty"` + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` +} + +// DeploymentPropertiesExtended is deployment properties with additional +// details. +type DeploymentPropertiesExtended struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + CorrelationID *string `json:"correlationId,omitempty"` + Timestamp *date.Time `json:"timestamp,omitempty"` + Outputs *map[string]interface{} `json:"outputs,omitempty"` + Providers *[]Provider `json:"providers,omitempty"` + Dependencies *[]Dependency `json:"dependencies,omitempty"` + Template *map[string]interface{} `json:"template,omitempty"` + TemplateLink *TemplateLink `json:"templateLink,omitempty"` + Parameters *map[string]interface{} `json:"parameters,omitempty"` + ParametersLink *ParametersLink `json:"parametersLink,omitempty"` + Mode DeploymentMode `json:"mode,omitempty"` + DebugSetting *DebugSetting `json:"debugSetting,omitempty"` +} + +// DeploymentValidateResult is information from validate template deployment +// response. +type DeploymentValidateResult struct { + autorest.Response `json:"-"` + Error *ManagementErrorWithDetails `json:"error,omitempty"` + Properties *DeploymentPropertiesExtended `json:"properties,omitempty"` +} + +// ExportTemplateRequest is export resource group template request parameters. +type ExportTemplateRequest struct { + ResourcesProperty *[]string `json:"resources,omitempty"` + Options *string `json:"options,omitempty"` +} + +// GenericResource is resource information. +type GenericResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *map[string]interface{} `json:"properties,omitempty"` + Kind *string `json:"kind,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Identity *Identity `json:"identity,omitempty"` +} + +// GenericResourceFilter is resource filter. +type GenericResourceFilter struct { + ResourceType *string `json:"resourceType,omitempty"` + Tagname *string `json:"tagname,omitempty"` + Tagvalue *string `json:"tagvalue,omitempty"` +} + +// Group is resource group information. +type Group struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GroupProperties `json:"properties,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// GroupExportResult is +type GroupExportResult struct { + autorest.Response `json:"-"` + Template *map[string]interface{} `json:"template,omitempty"` + Error *ManagementErrorWithDetails `json:"error,omitempty"` +} + +// GroupFilter is resource group filter. +type GroupFilter struct { + TagName *string `json:"tagName,omitempty"` + TagValue *string `json:"tagValue,omitempty"` +} + +// GroupListResult is list of resource groups. +type GroupListResult struct { + autorest.Response `json:"-"` + Value *[]Group `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// GroupListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client GroupListResult) GroupListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// GroupProperties is the resource group properties. +type GroupProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// HTTPMessage is +type HTTPMessage struct { + Content *map[string]interface{} `json:"content,omitempty"` +} + +// Identity is identity for the resource. +type Identity struct { + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + Type ResourceIdentityType `json:"type,omitempty"` +} + +// ListResult is list of resource groups. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]GenericResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ManagementErrorWithDetails is +type ManagementErrorWithDetails struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ManagementErrorWithDetails `json:"details,omitempty"` +} + +// MoveInfo is parameters of move resources. +type MoveInfo struct { + ResourcesProperty *[]string `json:"resources,omitempty"` + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` +} + +// ParametersLink is entity representing the reference to the deployment +// paramaters. +type ParametersLink struct { + URI *string `json:"uri,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` +} + +// Plan is plan for the resource. +type Plan struct { + Name *string `json:"name,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` +} + +// Provider is resource provider information. +type Provider struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Namespace *string `json:"namespace,omitempty"` + RegistrationState *string `json:"registrationState,omitempty"` + ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"` +} + +// ProviderListResult is list of resource providers. +type ProviderListResult struct { + autorest.Response `json:"-"` + Value *[]Provider `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProviderListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProviderListResult) ProviderListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProviderOperationDisplayProperties is resource provider operation's display +// properties. +type ProviderOperationDisplayProperties struct { + Publisher *string `json:"publisher,omitempty"` + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ProviderResourceType is resource type managed by the resource provider. +type ProviderResourceType struct { + ResourceType *string `json:"resourceType,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Aliases *[]AliasType `json:"aliases,omitempty"` + APIVersions *[]string `json:"apiVersions,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Sku is sKU for the resource. +type Sku struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` + Model *string `json:"model,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} + +// TagCount is tag count. +type TagCount struct { + Type *string `json:"type,omitempty"` + Value *int32 `json:"value,omitempty"` +} + +// TagDetails is tag details. +type TagDetails struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + TagName *string `json:"tagName,omitempty"` + Count *TagCount `json:"count,omitempty"` + Values *[]TagValue `json:"values,omitempty"` +} + +// TagsListResult is list of subscription tags. +type TagsListResult struct { + autorest.Response `json:"-"` + Value *[]TagDetails `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// TagsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client TagsListResult) TagsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// TagValue is tag information. +type TagValue struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + TagValue *string `json:"tagValue,omitempty"` + Count *TagCount `json:"count,omitempty"` +} + +// TargetResource is target resource. +type TargetResource struct { + ID *string `json:"id,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` +} + +// TemplateLink is entity representing the reference to the template. +type TemplateLink struct { + URI *string `json:"uri,omitempty"` + ContentVersion *string `json:"contentVersion,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/providers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/providers.go index 25b5205ab9..7fd6dc158d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/providers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/providers.go @@ -1,338 +1,338 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProvidersClient is the provides operations for working with resources and -// resource groups. -type ProvidersClient struct { - ManagementClient -} - -// NewProvidersClient creates an instance of the ProvidersClient client. -func NewProvidersClient(subscriptionID string) ProvidersClient { - return NewProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProvidersClientWithBaseURI creates an instance of the ProvidersClient -// client. -func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) ProvidersClient { - return ProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the specified resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider. expand -// is the $expand query parameter. For example, to include property aliases in -// response, use $expand=resourceTypes/aliases. -func (client ProvidersClient) Get(resourceProviderNamespace string, expand string) (result Provider, err error) { - req, err := client.GetPreparer(resourceProviderNamespace, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProvidersClient) GetPreparer(resourceProviderNamespace string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all resource providers for a subscription. -// -// top is the number of results to return. If null is passed returns all -// deployments. expand is the properties to include in the results. For -// example, use &$expand=metadata in the query string to retrieve resource -// provider metadata. To include property aliases in response, use -// $expand=resourceTypes/aliases. -func (client ProvidersClient) List(top *int32, expand string) (result ProviderListResult, err error) { - req, err := client.ListPreparer(top, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProvidersClient) ListPreparer(top *int32, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProvidersClient) ListResponder(resp *http.Response) (result ProviderListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ProvidersClient) ListNextResults(lastResults ProviderListResult) (result ProviderListResult, err error) { - req, err := lastResults.ProviderListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// Register registers a subscription with a resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider to -// register. -func (client ProvidersClient) Register(resourceProviderNamespace string) (result Provider, err error) { - req, err := client.RegisterPreparer(resourceProviderNamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", nil, "Failure preparing request") - return - } - - resp, err := client.RegisterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure sending request") - return - } - - result, err = client.RegisterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure responding to request") - } - - return -} - -// RegisterPreparer prepares the Register request. -func (client ProvidersClient) RegisterPreparer(resourceProviderNamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegisterSender sends the Register request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) RegisterSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegisterResponder handles the response to the Register request. The method always -// closes the http.Response Body. -func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Provider, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Unregister unregisters a subscription from a resource provider. -// -// resourceProviderNamespace is the namespace of the resource provider to -// unregister. -func (client ProvidersClient) Unregister(resourceProviderNamespace string) (result Provider, err error) { - req, err := client.UnregisterPreparer(resourceProviderNamespace) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", nil, "Failure preparing request") - return - } - - resp, err := client.UnregisterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure sending request") - return - } - - result, err = client.UnregisterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure responding to request") - } - - return -} - -// UnregisterPreparer prepares the Unregister request. -func (client ProvidersClient) UnregisterPreparer(resourceProviderNamespace string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UnregisterSender sends the Unregister request. The method will close the -// http.Response Body if it receives an error. -func (client ProvidersClient) UnregisterSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UnregisterResponder handles the response to the Unregister request. The method always -// closes the http.Response Body. -func (client ProvidersClient) UnregisterResponder(resp *http.Response) (result Provider, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProvidersClient is the provides operations for working with resources and +// resource groups. +type ProvidersClient struct { + ManagementClient +} + +// NewProvidersClient creates an instance of the ProvidersClient client. +func NewProvidersClient(subscriptionID string) ProvidersClient { + return NewProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProvidersClientWithBaseURI creates an instance of the ProvidersClient +// client. +func NewProvidersClientWithBaseURI(baseURI string, subscriptionID string) ProvidersClient { + return ProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified resource provider. +// +// resourceProviderNamespace is the namespace of the resource provider. expand +// is the $expand query parameter. For example, to include property aliases in +// response, use $expand=resourceTypes/aliases. +func (client ProvidersClient) Get(resourceProviderNamespace string, expand string) (result Provider, err error) { + req, err := client.GetPreparer(resourceProviderNamespace, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProvidersClient) GetPreparer(resourceProviderNamespace string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all resource providers for a subscription. +// +// top is the number of results to return. If null is passed returns all +// deployments. expand is the properties to include in the results. For +// example, use &$expand=metadata in the query string to retrieve resource +// provider metadata. To include property aliases in response, use +// $expand=resourceTypes/aliases. +func (client ProvidersClient) List(top *int32, expand string) (result ProviderListResult, err error) { + req, err := client.ListPreparer(top, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ProvidersClient) ListPreparer(top *int32, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProvidersClient) ListResponder(resp *http.Response) (result ProviderListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ProvidersClient) ListNextResults(lastResults ProviderListResult) (result ProviderListResult, err error) { + req, err := lastResults.ProviderListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// Register registers a subscription with a resource provider. +// +// resourceProviderNamespace is the namespace of the resource provider to +// register. +func (client ProvidersClient) Register(resourceProviderNamespace string) (result Provider, err error) { + req, err := client.RegisterPreparer(resourceProviderNamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure sending request") + return + } + + result, err = client.RegisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Register", resp, "Failure responding to request") + } + + return +} + +// RegisterPreparer prepares the Register request. +func (client ProvidersClient) RegisterPreparer(resourceProviderNamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegisterSender sends the Register request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) RegisterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegisterResponder handles the response to the Register request. The method always +// closes the http.Response Body. +func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Unregister unregisters a subscription from a resource provider. +// +// resourceProviderNamespace is the namespace of the resource provider to +// unregister. +func (client ProvidersClient) Unregister(resourceProviderNamespace string) (result Provider, err error) { + req, err := client.UnregisterPreparer(resourceProviderNamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", nil, "Failure preparing request") + return + } + + resp, err := client.UnregisterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure sending request") + return + } + + result, err = client.UnregisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "Unregister", resp, "Failure responding to request") + } + + return +} + +// UnregisterPreparer prepares the Unregister request. +func (client ProvidersClient) UnregisterPreparer(resourceProviderNamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UnregisterSender sends the Unregister request. The method will close the +// http.Response Body if it receives an error. +func (client ProvidersClient) UnregisterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UnregisterResponder handles the response to the Unregister request. The method always +// closes the http.Response Body. +func (client ProvidersClient) UnregisterResponder(resp *http.Response) (result Provider, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go index a9dce223db..a7179dda81 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go @@ -1,898 +1,898 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GroupClient is the provides operations for working with resources and -// resource groups. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient(subscriptionID string) GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckExistence checks whether a resource exists. -// -// resourceGroupName is the name of the resource group containing the resource -// to check. The name is case insensitive. resourceProviderNamespace is the -// resource provider of the resource to check. parentResourcePath is the parent -// resource identity. resourceType is the resource type. resourceName is the -// name of the resource to check whether it exists. -func (client GroupClient) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CheckExistence") - } - - req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure responding to request") - } - - return -} - -// CheckExistencePreparer prepares the CheckExistence request. -func (client GroupClient) CheckExistencePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckExistenceSender sends the CheckExistence request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckExistenceResponder handles the response to the CheckExistence request. The method always -// closes the http.Response Body. -func (client GroupClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckExistenceByID checks by ID whether a resource exists. -// -// resourceID is the fully qualified ID of the resource, including the resource -// name and resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} -func (client GroupClient) CheckExistenceByID(resourceID string) (result autorest.Response, err error) { - req, err := client.CheckExistenceByIDPreparer(resourceID) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", nil, "Failure preparing request") - return - } - - resp, err := client.CheckExistenceByIDSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure sending request") - return - } - - result, err = client.CheckExistenceByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure responding to request") - } - - return -} - -// CheckExistenceByIDPreparer prepares the CheckExistenceByID request. -func (client GroupClient) CheckExistenceByIDPreparer(resourceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsHead(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always -// closes the http.Response Body. -func (client GroupClient) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate creates a resource. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group for the resource. The -// name is case insensitive. resourceProviderNamespace is the namespace of the -// resource provider. parentResourcePath is the parent resource identity. -// resourceType is the resource type of the resource to create. resourceName is -// the name of the resource to create. parameters is parameters for creating or -// updating the resource. -func (client GroupClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (<-chan GenericResource, <-chan error) { - resultChan := make(chan GenericResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result GenericResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByID create a resource by ID. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceID is the fully qualified ID of the resource, including the resource -// name and resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} -// parameters is create or update resource parameters. -func (client GroupClient) CreateOrUpdateByID(resourceID string, parameters GenericResource, cancel <-chan struct{}) (<-chan GenericResource, <-chan error) { - resultChan := make(chan GenericResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdateByID") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result GenericResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateByIDPreparer(resourceID, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. -func (client GroupClient) CreateOrUpdateByIDPreparer(resourceID string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateOrUpdateByIDResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a resource. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource to delete. The name is case insensitive. resourceProviderNamespace -// is the namespace of the resource provider. parentResourcePath is the parent -// resource identity. resourceType is the resource type. resourceName is the -// name of the resource to delete. -func (client GroupClient) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByID deletes a resource by ID. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceID is the fully qualified ID of the resource, including the resource -// name and resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} -func (client GroupClient) DeleteByID(resourceID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeleteByIDPreparer(resourceID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByIDSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure sending request") - return - } - - result, err = client.DeleteByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client GroupClient) DeleteByIDPreparer(resourceID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a resource. -// -// resourceGroupName is the name of the resource group containing the resource -// to get. The name is case insensitive. resourceProviderNamespace is the -// namespace of the resource provider. parentResourcePath is the parent -// resource identity. resourceType is the resource type of the resource. -// resourceName is the name of the resource to get. -func (client GroupClient) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result GenericResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a resource by ID. -// -// resourceID is the fully qualified ID of the resource, including the resource -// name and resource type. Use the format, -// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} -func (client GroupClient) GetByID(resourceID string) (result GenericResource, err error) { - req, err := client.GetByIDPreparer(resourceID) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure responding to request") - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client GroupClient) GetByIDPreparer(resourceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client GroupClient) GetByIDResponder(resp *http.Response) (result GenericResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all the resources in a subscription. -// -// filter is the filter to apply on the operation. expand is the $expand query -// parameter. top is the number of results to return. If null is passed, -// returns all resource groups. -func (client GroupClient) List(filter string, expand string, top *int32) (result ListResult, err error) { - req, err := client.ListPreparer(filter, expand, top) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer(filter string, expand string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// MoveResources the resources to move must be in the same source resource -// group. The target resource group may be in a different subscription. When -// moving resources, both the source group and the target group are locked for -// the duration of the operation. Write and delete operations are blocked on -// the groups until the move completes. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// sourceResourceGroupName is the name of the resource group containing the -// rsources to move. parameters is parameters for moving resources. -func (client GroupClient) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: sourceResourceGroupName, - Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "MoveResources") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", nil, "Failure preparing request") - return - } - - resp, err := client.MoveResourcesSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure sending request") - return - } - - result, err = client.MoveResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// MoveResourcesPreparer prepares the MoveResources request. -func (client GroupClient) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// MoveResourcesSender sends the MoveResources request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) MoveResourcesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// MoveResourcesResponder handles the response to the MoveResources request. The method always -// closes the http.Response Body. -func (client GroupClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GroupClient is the provides operations for working with resources and +// resource groups. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient(subscriptionID string) GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckExistence checks whether a resource exists. +// +// resourceGroupName is the name of the resource group containing the resource +// to check. The name is case insensitive. resourceProviderNamespace is the +// resource provider of the resource to check. parentResourcePath is the parent +// resource identity. resourceType is the resource type. resourceName is the +// name of the resource to check whether it exists. +func (client GroupClient) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CheckExistence") + } + + req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure responding to request") + } + + return +} + +// CheckExistencePreparer prepares the CheckExistence request. +func (client GroupClient) CheckExistencePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckExistenceSender sends the CheckExistence request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CheckExistenceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckExistenceResponder handles the response to the CheckExistence request. The method always +// closes the http.Response Body. +func (client GroupClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckExistenceByID checks by ID whether a resource exists. +// +// resourceID is the fully qualified ID of the resource, including the resource +// name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +func (client GroupClient) CheckExistenceByID(resourceID string) (result autorest.Response, err error) { + req, err := client.CheckExistenceByIDPreparer(resourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", nil, "Failure preparing request") + return + } + + resp, err := client.CheckExistenceByIDSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure sending request") + return + } + + result, err = client.CheckExistenceByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure responding to request") + } + + return +} + +// CheckExistenceByIDPreparer prepares the CheckExistenceByID request. +func (client GroupClient) CheckExistenceByIDPreparer(resourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsHead(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always +// closes the http.Response Body. +func (client GroupClient) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate creates a resource. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group for the resource. The +// name is case insensitive. resourceProviderNamespace is the namespace of the +// resource provider. parentResourcePath is the parent resource identity. +// resourceType is the resource type of the resource to create. resourceName is +// the name of the resource to create. parameters is parameters for creating or +// updating the resource. +func (client GroupClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (<-chan GenericResource, <-chan error) { + resultChan := make(chan GenericResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result GenericResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateByID create a resource by ID. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceID is the fully qualified ID of the resource, including the resource +// name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +// parameters is create or update resource parameters. +func (client GroupClient) CreateOrUpdateByID(resourceID string, parameters GenericResource, cancel <-chan struct{}) (<-chan GenericResource, <-chan error) { + resultChan := make(chan GenericResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdateByID") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result GenericResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateByIDPreparer(resourceID, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. +func (client GroupClient) CreateOrUpdateByIDPreparer(resourceID string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateOrUpdateByIDResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a resource. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource to delete. The name is case insensitive. resourceProviderNamespace +// is the namespace of the resource provider. parentResourcePath is the parent +// resource identity. resourceType is the resource type. resourceName is the +// name of the resource to delete. +func (client GroupClient) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client GroupClient) DeletePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteByID deletes a resource by ID. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceID is the fully qualified ID of the resource, including the resource +// name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +func (client GroupClient) DeleteByID(resourceID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeleteByIDPreparer(resourceID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client GroupClient) DeleteByIDPreparer(resourceID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteByIDSender sends the DeleteByID request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteByIDResponder handles the response to the DeleteByID request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a resource. +// +// resourceGroupName is the name of the resource group containing the resource +// to get. The name is case insensitive. resourceProviderNamespace is the +// namespace of the resource provider. parentResourcePath is the parent +// resource identity. resourceType is the resource type of the resource. +// resourceName is the name of the resource to get. +func (client GroupClient) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result GenericResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID gets a resource by ID. +// +// resourceID is the fully qualified ID of the resource, including the resource +// name and resource type. Use the format, +// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} +func (client GroupClient) GetByID(resourceID string) (result GenericResource, err error) { + req, err := client.GetByIDPreparer(resourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure responding to request") + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client GroupClient) GetByIDPreparer(resourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": resourceID, + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client GroupClient) GetByIDResponder(resp *http.Response) (result GenericResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all the resources in a subscription. +// +// filter is the filter to apply on the operation. expand is the $expand query +// parameter. top is the number of results to return. If null is passed, +// returns all resource groups. +func (client GroupClient) List(filter string, expand string, top *int32) (result ListResult, err error) { + req, err := client.ListPreparer(filter, expand, top) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer(filter string, expand string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// MoveResources the resources to move must be in the same source resource +// group. The target resource group may be in a different subscription. When +// moving resources, both the source group and the target group are locked for +// the duration of the operation. Write and delete operations are blocked on +// the groups until the move completes. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// sourceResourceGroupName is the name of the resource group containing the +// rsources to move. parameters is parameters for moving resources. +func (client GroupClient) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: sourceResourceGroupName, + Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "MoveResources") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", nil, "Failure preparing request") + return + } + + resp, err := client.MoveResourcesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure sending request") + return + } + + result, err = client.MoveResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// MoveResourcesPreparer prepares the MoveResources request. +func (client GroupClient) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// MoveResourcesSender sends the MoveResources request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) MoveResourcesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// MoveResourcesResponder handles the response to the MoveResources request. The method always +// closes the http.Response Body. +func (client GroupClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/tags.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/tags.go index cd597161e4..445fccf625 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/tags.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/tags.go @@ -1,387 +1,387 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// TagsClient is the provides operations for working with resources and -// resource groups. -type TagsClient struct { - ManagementClient -} - -// NewTagsClient creates an instance of the TagsClient client. -func NewTagsClient(subscriptionID string) TagsClient { - return NewTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTagsClientWithBaseURI creates an instance of the TagsClient client. -func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient { - return TagsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the tag name can have a maximum of 512 characters and is case -// insensitive. Tag names created by Azure have prefixes of microsoft, azure, -// or windows. You cannot create tags with one of these prefixes. -// -// tagName is the name of the tag to create. -func (client TagsClient) CreateOrUpdate(tagName string) (result TagDetails, err error) { - req, err := client.CreateOrUpdatePreparer(tagName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TagsClient) CreateOrUpdatePreparer(tagName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result TagDetails, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateValue creates a tag value. The name of the tag must already -// exist. -// -// tagName is the name of the tag. tagValue is the value of the tag to create. -func (client TagsClient) CreateOrUpdateValue(tagName string, tagValue string) (result TagValue, err error) { - req, err := client.CreateOrUpdateValuePreparer(tagName, tagValue) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateValueSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateValueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateValuePreparer prepares the CreateOrUpdateValue request. -func (client TagsClient) CreateOrUpdateValuePreparer(tagName string, tagValue string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - "tagValue": autorest.Encode("path", tagValue), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateValueSender sends the CreateOrUpdateValue request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) CreateOrUpdateValueSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateValueResponder handles the response to the CreateOrUpdateValue request. The method always -// closes the http.Response Body. -func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (result TagValue, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete you must remove all values from a resource tag before you can delete -// it. -// -// tagName is the name of the tag. -func (client TagsClient) Delete(tagName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(tagName) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TagsClient) DeletePreparer(tagName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteValue deletes a tag value. -// -// tagName is the name of the tag. tagValue is the value of the tag to delete. -func (client TagsClient) DeleteValue(tagName string, tagValue string) (result autorest.Response, err error) { - req, err := client.DeleteValuePreparer(tagName, tagValue) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteValueSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure sending request") - return - } - - result, err = client.DeleteValueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure responding to request") - } - - return -} - -// DeleteValuePreparer prepares the DeleteValue request. -func (client TagsClient) DeleteValuePreparer(tagName string, tagValue string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "tagName": autorest.Encode("path", tagName), - "tagValue": autorest.Encode("path", tagValue), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteValueSender sends the DeleteValue request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) DeleteValueSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteValueResponder handles the response to the DeleteValue request. The method always -// closes the http.Response Body. -func (client TagsClient) DeleteValueResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List gets the names and values of all resource tags that are defined in a -// subscription. -func (client TagsClient) List() (result TagsListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client TagsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TagsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TagsClient) ListResponder(resp *http.Response) (result TagsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client TagsClient) ListNextResults(lastResults TagsListResult) (result TagsListResult, err error) { - req, err := lastResults.TagsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// TagsClient is the provides operations for working with resources and +// resource groups. +type TagsClient struct { + ManagementClient +} + +// NewTagsClient creates an instance of the TagsClient client. +func NewTagsClient(subscriptionID string) TagsClient { + return NewTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTagsClientWithBaseURI creates an instance of the TagsClient client. +func NewTagsClientWithBaseURI(baseURI string, subscriptionID string) TagsClient { + return TagsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the tag name can have a maximum of 512 characters and is case +// insensitive. Tag names created by Azure have prefixes of microsoft, azure, +// or windows. You cannot create tags with one of these prefixes. +// +// tagName is the name of the tag to create. +func (client TagsClient) CreateOrUpdate(tagName string) (result TagDetails, err error) { + req, err := client.CreateOrUpdatePreparer(tagName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TagsClient) CreateOrUpdatePreparer(tagName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result TagDetails, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateValue creates a tag value. The name of the tag must already +// exist. +// +// tagName is the name of the tag. tagValue is the value of the tag to create. +func (client TagsClient) CreateOrUpdateValue(tagName string, tagValue string) (result TagValue, err error) { + req, err := client.CreateOrUpdateValuePreparer(tagName, tagValue) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateValueSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateValueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "CreateOrUpdateValue", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateValuePreparer prepares the CreateOrUpdateValue request. +func (client TagsClient) CreateOrUpdateValuePreparer(tagName string, tagValue string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + "tagValue": autorest.Encode("path", tagValue), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateValueSender sends the CreateOrUpdateValue request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) CreateOrUpdateValueSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateValueResponder handles the response to the CreateOrUpdateValue request. The method always +// closes the http.Response Body. +func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (result TagValue, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete you must remove all values from a resource tag before you can delete +// it. +// +// tagName is the name of the tag. +func (client TagsClient) Delete(tagName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(tagName) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TagsClient) DeletePreparer(tagName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteValue deletes a tag value. +// +// tagName is the name of the tag. tagValue is the value of the tag to delete. +func (client TagsClient) DeleteValue(tagName string, tagValue string) (result autorest.Response, err error) { + req, err := client.DeleteValuePreparer(tagName, tagValue) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteValueSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure sending request") + return + } + + result, err = client.DeleteValueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "DeleteValue", resp, "Failure responding to request") + } + + return +} + +// DeleteValuePreparer prepares the DeleteValue request. +func (client TagsClient) DeleteValuePreparer(tagName string, tagValue string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tagName": autorest.Encode("path", tagName), + "tagValue": autorest.Encode("path", tagValue), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteValueSender sends the DeleteValue request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) DeleteValueSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteValueResponder handles the response to the DeleteValue request. The method always +// closes the http.Response Body. +func (client TagsClient) DeleteValueResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// List gets the names and values of all resource tags that are defined in a +// subscription. +func (client TagsClient) List() (result TagsListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TagsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/tagNames", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TagsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TagsClient) ListResponder(resp *http.Response) (result TagsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client TagsClient) ListNextResults(lastResults TagsListResult) (result TagsListResult, err error) { + req, err := lastResults.TagsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/version.go index 01880e2a9d..9987888569 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/version.go @@ -1,29 +1,29 @@ -package resources - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-resources/2016-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package resources + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-resources/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/client.go index 77a0275b5a..31a6090910 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/client.go @@ -1,54 +1,54 @@ -// Package subscriptions implements the Azure ARM Subscriptions service API -// version 2016-06-01. -// -// All resource groups and resources exist within subscriptions. These -// operation enable you get information about your subscriptions and tenants. A -// tenant is a dedicated instance of Azure Active Directory (Azure AD) for your -// organization. -package subscriptions - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Subscriptions - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Subscriptions. -type ManagementClient struct { - autorest.Client - BaseURI string -} - -// New creates an instance of the ManagementClient client. -func New() ManagementClient { - return NewWithBaseURI(DefaultBaseURI) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - } -} +// Package subscriptions implements the Azure ARM Subscriptions service API +// version 2016-06-01. +// +// All resource groups and resources exist within subscriptions. These +// operation enable you get information about your subscriptions and tenants. A +// tenant is a dedicated instance of Azure Active Directory (Azure AD) for your +// organization. +package subscriptions + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Subscriptions + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Subscriptions. +type ManagementClient struct { + autorest.Client + BaseURI string +} + +// New creates an instance of the ManagementClient client. +func New() ManagementClient { + return NewWithBaseURI(DefaultBaseURI) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go index af76723b02..e2cf1743fe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go @@ -1,132 +1,132 @@ -package subscriptions - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// SpendingLimit enumerates the values for spending limit. -type SpendingLimit string - -const ( - // CurrentPeriodOff specifies the current period off state for spending - // limit. - CurrentPeriodOff SpendingLimit = "CurrentPeriodOff" - // Off specifies the off state for spending limit. - Off SpendingLimit = "Off" - // On specifies the on state for spending limit. - On SpendingLimit = "On" -) - -// State enumerates the values for state. -type State string - -const ( - // Deleted specifies the deleted state for state. - Deleted State = "Deleted" - // Disabled specifies the disabled state for state. - Disabled State = "Disabled" - // Enabled specifies the enabled state for state. - Enabled State = "Enabled" - // PastDue specifies the past due state for state. - PastDue State = "PastDue" - // Warned specifies the warned state for state. - Warned State = "Warned" -) - -// ListResult is subscription list operation response. -type ListResult struct { - autorest.Response `json:"-"` - Value *[]Subscription `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ListResult) ListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Location is location information. -type Location struct { - ID *string `json:"id,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Latitude *string `json:"latitude,omitempty"` - Longitude *string `json:"longitude,omitempty"` -} - -// LocationListResult is location list operation response. -type LocationListResult struct { - autorest.Response `json:"-"` - Value *[]Location `json:"value,omitempty"` -} - -// Policies is subscription policies. -type Policies struct { - LocationPlacementID *string `json:"locationPlacementId,omitempty"` - QuotaID *string `json:"quotaId,omitempty"` - SpendingLimit SpendingLimit `json:"spendingLimit,omitempty"` -} - -// Subscription is subscription information. -type Subscription struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - State State `json:"state,omitempty"` - SubscriptionPolicies *Policies `json:"subscriptionPolicies,omitempty"` - AuthorizationSource *string `json:"authorizationSource,omitempty"` -} - -// TenantIDDescription is tenant Id information. -type TenantIDDescription struct { - ID *string `json:"id,omitempty"` - TenantID *string `json:"tenantId,omitempty"` -} - -// TenantListResult is tenant Ids information. -type TenantListResult struct { - autorest.Response `json:"-"` - Value *[]TenantIDDescription `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// TenantListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client TenantListResult) TenantListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} +package subscriptions + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// SpendingLimit enumerates the values for spending limit. +type SpendingLimit string + +const ( + // CurrentPeriodOff specifies the current period off state for spending + // limit. + CurrentPeriodOff SpendingLimit = "CurrentPeriodOff" + // Off specifies the off state for spending limit. + Off SpendingLimit = "Off" + // On specifies the on state for spending limit. + On SpendingLimit = "On" +) + +// State enumerates the values for state. +type State string + +const ( + // Deleted specifies the deleted state for state. + Deleted State = "Deleted" + // Disabled specifies the disabled state for state. + Disabled State = "Disabled" + // Enabled specifies the enabled state for state. + Enabled State = "Enabled" + // PastDue specifies the past due state for state. + PastDue State = "PastDue" + // Warned specifies the warned state for state. + Warned State = "Warned" +) + +// ListResult is subscription list operation response. +type ListResult struct { + autorest.Response `json:"-"` + Value *[]Subscription `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ListResult) ListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Location is location information. +type Location struct { + ID *string `json:"id,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Latitude *string `json:"latitude,omitempty"` + Longitude *string `json:"longitude,omitempty"` +} + +// LocationListResult is location list operation response. +type LocationListResult struct { + autorest.Response `json:"-"` + Value *[]Location `json:"value,omitempty"` +} + +// Policies is subscription policies. +type Policies struct { + LocationPlacementID *string `json:"locationPlacementId,omitempty"` + QuotaID *string `json:"quotaId,omitempty"` + SpendingLimit SpendingLimit `json:"spendingLimit,omitempty"` +} + +// Subscription is subscription information. +type Subscription struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + State State `json:"state,omitempty"` + SubscriptionPolicies *Policies `json:"subscriptionPolicies,omitempty"` + AuthorizationSource *string `json:"authorizationSource,omitempty"` +} + +// TenantIDDescription is tenant Id information. +type TenantIDDescription struct { + ID *string `json:"id,omitempty"` + TenantID *string `json:"tenantId,omitempty"` +} + +// TenantListResult is tenant Ids information. +type TenantListResult struct { + autorest.Response `json:"-"` + Value *[]TenantIDDescription `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// TenantListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client TenantListResult) TenantListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/subscriptionsgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/subscriptionsgroup.go index a1f98f9ed0..b8042f65df 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/subscriptionsgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/subscriptionsgroup.go @@ -1,252 +1,252 @@ -package subscriptions - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// GroupClient is the all resource groups and resources exist within -// subscriptions. These operation enable you get information about your -// subscriptions and tenants. A tenant is a dedicated instance of Azure Active -// Directory (Azure AD) for your organization. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient() GroupClient { - return NewGroupClientWithBaseURI(DefaultBaseURI) -} - -// NewGroupClientWithBaseURI creates an instance of the GroupClient client. -func NewGroupClientWithBaseURI(baseURI string) GroupClient { - return GroupClient{NewWithBaseURI(baseURI)} -} - -// Get gets details about a specified subscription. -// -// subscriptionID is the ID of the target subscription. -func (client GroupClient) Get(subscriptionID string) (result Subscription, err error) { - req, err := client.GetPreparer(subscriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupClient) GetPreparer(subscriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupClient) GetResponder(resp *http.Response) (result Subscription, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all subscriptions for a tenant. -func (client GroupClient) List() (result ListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/subscriptions"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.ListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListLocations this operation provides all the locations that are available -// for resource providers; however, each resource provider may support a subset -// of this list. -// -// subscriptionID is the ID of the target subscription. -func (client GroupClient) ListLocations(subscriptionID string) (result LocationListResult, err error) { - req, err := client.ListLocationsPreparer(subscriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "ListLocations", nil, "Failure preparing request") - return - } - - resp, err := client.ListLocationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "ListLocations", resp, "Failure sending request") - return - } - - result, err = client.ListLocationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "ListLocations", resp, "Failure responding to request") - } - - return -} - -// ListLocationsPreparer prepares the ListLocations request. -func (client GroupClient) ListLocationsPreparer(subscriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/locations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListLocationsSender sends the ListLocations request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListLocationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListLocationsResponder handles the response to the ListLocations request. The method always -// closes the http.Response Body. -func (client GroupClient) ListLocationsResponder(resp *http.Response) (result LocationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package subscriptions + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// GroupClient is the all resource groups and resources exist within +// subscriptions. These operation enable you get information about your +// subscriptions and tenants. A tenant is a dedicated instance of Azure Active +// Directory (Azure AD) for your organization. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient() GroupClient { + return NewGroupClientWithBaseURI(DefaultBaseURI) +} + +// NewGroupClientWithBaseURI creates an instance of the GroupClient client. +func NewGroupClientWithBaseURI(baseURI string) GroupClient { + return GroupClient{NewWithBaseURI(baseURI)} +} + +// Get gets details about a specified subscription. +// +// subscriptionID is the ID of the target subscription. +func (client GroupClient) Get(subscriptionID string) (result Subscription, err error) { + req, err := client.GetPreparer(subscriptionID) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GroupClient) GetPreparer(subscriptionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GroupClient) GetResponder(resp *http.Response) (result Subscription, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all subscriptions for a tenant. +func (client GroupClient) List() (result ListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GroupClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/subscriptions"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.ListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListLocations this operation provides all the locations that are available +// for resource providers; however, each resource provider may support a subset +// of this list. +// +// subscriptionID is the ID of the target subscription. +func (client GroupClient) ListLocations(subscriptionID string) (result LocationListResult, err error) { + req, err := client.ListLocationsPreparer(subscriptionID) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "ListLocations", nil, "Failure preparing request") + return + } + + resp, err := client.ListLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "ListLocations", resp, "Failure sending request") + return + } + + result, err = client.ListLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.GroupClient", "ListLocations", resp, "Failure responding to request") + } + + return +} + +// ListLocationsPreparer prepares the ListLocations request. +func (client GroupClient) ListLocationsPreparer(subscriptionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/locations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListLocationsSender sends the ListLocations request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListLocationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListLocationsResponder handles the response to the ListLocations request. The method always +// closes the http.Response Body. +func (client GroupClient) ListLocationsResponder(resp *http.Response) (result LocationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/tenants.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/tenants.go index 44ddbef0ab..35b2cd26da 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/tenants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/tenants.go @@ -1,124 +1,124 @@ -package subscriptions - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// TenantsClient is the all resource groups and resources exist within -// subscriptions. These operation enable you get information about your -// subscriptions and tenants. A tenant is a dedicated instance of Azure Active -// Directory (Azure AD) for your organization. -type TenantsClient struct { - ManagementClient -} - -// NewTenantsClient creates an instance of the TenantsClient client. -func NewTenantsClient() TenantsClient { - return NewTenantsClientWithBaseURI(DefaultBaseURI) -} - -// NewTenantsClientWithBaseURI creates an instance of the TenantsClient client. -func NewTenantsClientWithBaseURI(baseURI string) TenantsClient { - return TenantsClient{NewWithBaseURI(baseURI)} -} - -// List gets the tenants for your account. -func (client TenantsClient) List() (result TenantListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/tenants"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TenantsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TenantsClient) ListResponder(resp *http.Response) (result TenantListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client TenantsClient) ListNextResults(lastResults TenantListResult) (result TenantListResult, err error) { - req, err := lastResults.TenantListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package subscriptions + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// TenantsClient is the all resource groups and resources exist within +// subscriptions. These operation enable you get information about your +// subscriptions and tenants. A tenant is a dedicated instance of Azure Active +// Directory (Azure AD) for your organization. +type TenantsClient struct { + ManagementClient +} + +// NewTenantsClient creates an instance of the TenantsClient client. +func NewTenantsClient() TenantsClient { + return NewTenantsClientWithBaseURI(DefaultBaseURI) +} + +// NewTenantsClientWithBaseURI creates an instance of the TenantsClient client. +func NewTenantsClientWithBaseURI(baseURI string) TenantsClient { + return TenantsClient{NewWithBaseURI(baseURI)} +} + +// List gets the tenants for your account. +func (client TenantsClient) List() (result TenantListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TenantsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/tenants"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TenantsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TenantsClient) ListResponder(resp *http.Response) (result TenantListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client TenantsClient) ListNextResults(lastResults TenantListResult) (result TenantListResult, err error) { + req, err := lastResults.TenantListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.TenantsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/version.go index aabe23f2c7..d624dd9808 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/version.go @@ -1,29 +1,29 @@ -package subscriptions - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-subscriptions/2016-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package subscriptions + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-subscriptions/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/client.go index 2e2f26c506..4d99f6f11d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/client.go @@ -1,53 +1,53 @@ -// Package scheduler implements the Azure ARM Scheduler service API version -// 2016-03-01. -// -// -package scheduler - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Scheduler - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Scheduler. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package scheduler implements the Azure ARM Scheduler service API version +// 2016-03-01. +// +// +package scheduler + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Scheduler + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Scheduler. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.go index 18394c070d..9e192dad78 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.go @@ -1,661 +1,661 @@ -package scheduler - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// JobCollectionsClient is the client for the JobCollections methods of the -// Scheduler service. -type JobCollectionsClient struct { - ManagementClient -} - -// NewJobCollectionsClient creates an instance of the JobCollectionsClient -// client. -func NewJobCollectionsClient(subscriptionID string) JobCollectionsClient { - return NewJobCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobCollectionsClientWithBaseURI creates an instance of the -// JobCollectionsClient client. -func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) JobCollectionsClient { - return JobCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate provisions a new job collection or updates an existing job -// collection. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobCollection is the job collection definition. -func (client JobCollectionsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobCollection) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobCollectionsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), - autorest.WithJSON(jobCollection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) CreateOrUpdateResponder(resp *http.Response) (result JobCollectionDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a job collection. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. -func (client JobCollectionsClient) Delete(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, jobCollectionName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client JobCollectionsClient) DeletePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Disable disables all of the jobs in the job collection. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. -func (client JobCollectionsClient) Disable(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DisablePreparer(resourceGroupName, jobCollectionName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", nil, "Failure preparing request") - return - } - - resp, err := client.DisableSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", resp, "Failure sending request") - return - } - - result, err = client.DisableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DisablePreparer prepares the Disable request. -func (client JobCollectionsClient) DisablePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DisableSender sends the Disable request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) DisableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DisableResponder handles the response to the Disable request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Enable enables all of the jobs in the job collection. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. -func (client JobCollectionsClient) Enable(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.EnablePreparer(resourceGroupName, jobCollectionName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", nil, "Failure preparing request") - return - } - - resp, err := client.EnableSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", resp, "Failure sending request") - return - } - - result, err = client.EnableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// EnablePreparer prepares the Enable request. -func (client JobCollectionsClient) EnablePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// EnableSender sends the Enable request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) EnableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// EnableResponder handles the response to the Enable request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a job collection. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. -func (client JobCollectionsClient) Get(resourceGroupName string, jobCollectionName string) (result JobCollectionDefinition, err error) { - req, err := client.GetPreparer(resourceGroupName, jobCollectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobCollectionsClient) GetPreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) GetResponder(resp *http.Response) (result JobCollectionDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all job collections under specified resource group. -// -// resourceGroupName is the resource group name. -func (client JobCollectionsClient) ListByResourceGroup(resourceGroupName string) (result JobCollectionListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client JobCollectionsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) ListByResourceGroupResponder(resp *http.Response) (result JobCollectionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client JobCollectionsClient) ListByResourceGroupNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, err error) { - req, err := lastResults.JobCollectionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription gets all job collections under specified subscription. -func (client JobCollectionsClient) ListBySubscription() (result JobCollectionListResult, err error) { - req, err := client.ListBySubscriptionPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client JobCollectionsClient) ListBySubscriptionPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) ListBySubscriptionResponder(resp *http.Response) (result JobCollectionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client JobCollectionsClient) ListBySubscriptionNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, err error) { - req, err := lastResults.JobCollectionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// Patch patches an existing job collection. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobCollection is the job collection definition. -func (client JobCollectionsClient) Patch(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) { - req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobCollection) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", resp, "Failure responding to request") - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client JobCollectionsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), - autorest.WithJSON(jobCollection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client JobCollectionsClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client JobCollectionsClient) PatchResponder(resp *http.Response) (result JobCollectionDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package scheduler + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// JobCollectionsClient is the client for the JobCollections methods of the +// Scheduler service. +type JobCollectionsClient struct { + ManagementClient +} + +// NewJobCollectionsClient creates an instance of the JobCollectionsClient +// client. +func NewJobCollectionsClient(subscriptionID string) JobCollectionsClient { + return NewJobCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobCollectionsClientWithBaseURI creates an instance of the +// JobCollectionsClient client. +func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) JobCollectionsClient { + return JobCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate provisions a new job collection or updates an existing job +// collection. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobCollection is the job collection definition. +func (client JobCollectionsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobCollection) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client JobCollectionsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), + autorest.WithJSON(jobCollection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) CreateOrUpdateResponder(resp *http.Response) (result JobCollectionDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a job collection. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. +func (client JobCollectionsClient) Delete(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, jobCollectionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client JobCollectionsClient) DeletePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Disable disables all of the jobs in the job collection. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. +func (client JobCollectionsClient) Disable(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DisablePreparer(resourceGroupName, jobCollectionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", nil, "Failure preparing request") + return + } + + resp, err := client.DisableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", resp, "Failure sending request") + return + } + + result, err = client.DisableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DisablePreparer prepares the Disable request. +func (client JobCollectionsClient) DisablePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DisableSender sends the Disable request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) DisableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DisableResponder handles the response to the Disable request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Enable enables all of the jobs in the job collection. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. +func (client JobCollectionsClient) Enable(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.EnablePreparer(resourceGroupName, jobCollectionName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", nil, "Failure preparing request") + return + } + + resp, err := client.EnableSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", resp, "Failure sending request") + return + } + + result, err = client.EnableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// EnablePreparer prepares the Enable request. +func (client JobCollectionsClient) EnablePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// EnableSender sends the Enable request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) EnableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// EnableResponder handles the response to the Enable request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a job collection. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. +func (client JobCollectionsClient) Get(resourceGroupName string, jobCollectionName string) (result JobCollectionDefinition, err error) { + req, err := client.GetPreparer(resourceGroupName, jobCollectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobCollectionsClient) GetPreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) GetResponder(resp *http.Response) (result JobCollectionDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all job collections under specified resource group. +// +// resourceGroupName is the resource group name. +func (client JobCollectionsClient) ListByResourceGroup(resourceGroupName string) (result JobCollectionListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client JobCollectionsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) ListByResourceGroupResponder(resp *http.Response) (result JobCollectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client JobCollectionsClient) ListByResourceGroupNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, err error) { + req, err := lastResults.JobCollectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription gets all job collections under specified subscription. +func (client JobCollectionsClient) ListBySubscription() (result JobCollectionListResult, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client JobCollectionsClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) ListBySubscriptionResponder(resp *http.Response) (result JobCollectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client JobCollectionsClient) ListBySubscriptionNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, err error) { + req, err := lastResults.JobCollectionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// Patch patches an existing job collection. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobCollection is the job collection definition. +func (client JobCollectionsClient) Patch(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) { + req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobCollection) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client JobCollectionsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters), + autorest.WithJSON(jobCollection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client JobCollectionsClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client JobCollectionsClient) PatchResponder(resp *http.Response) (result JobCollectionDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobs.go index ab5087372a..64eab66c52 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobs.go @@ -1,600 +1,600 @@ -package scheduler - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// JobsClient is the client for the Jobs methods of the Scheduler service. -type JobsClient struct { - ManagementClient -} - -// NewJobsClient creates an instance of the JobsClient client. -func NewJobsClient(subscriptionID string) JobsClient { - return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobsClientWithBaseURI creates an instance of the JobsClient client. -func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { - return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate provisions a new job or updates an existing job. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobName is the job name. job is the job definition. -func (client JobsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobName, job) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), - autorest.WithJSON(job), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client JobsClient) CreateOrUpdateResponder(resp *http.Response) (result JobDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a job. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobName is the job name. -func (client JobsClient) Delete(resourceGroupName string, jobCollectionName string, jobName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, jobCollectionName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobsClient) DeletePreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client JobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a job. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobName is the job name. -func (client JobsClient) Get(resourceGroupName string, jobCollectionName string, jobName string) (result JobDefinition, err error) { - req, err := client.GetPreparer(resourceGroupName, jobCollectionName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobsClient) GetPreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobsClient) GetResponder(resp *http.Response) (result JobDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all jobs under the specified job collection. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. top is the number of jobs to request, in the of range of -// [1..100]. skip is the (0-based) index of the job history list from which to -// begin requesting entries. filter is the filter to apply on the job state. -func (client JobsClient) List(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (result JobListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "List") - } - - req, err := client.ListPreparer(resourceGroupName, jobCollectionName, top, skip, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client JobsClient) ListPreparer(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client JobsClient) ListResponder(resp *http.Response) (result JobListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobListResult, err error) { - req, err := lastResults.JobListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListJobHistory lists job history. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobName is the job name. top is the number of job history -// to request, in the of range of [1..100]. skip is the (0-based) index of the -// job history list from which to begin requesting entries. filter is the -// filter to apply on the job state. -func (client JobsClient) ListJobHistory(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (result JobHistoryListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "ListJobHistory") - } - - req, err := client.ListJobHistoryPreparer(resourceGroupName, jobCollectionName, jobName, top, skip, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", nil, "Failure preparing request") - return - } - - resp, err := client.ListJobHistorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure sending request") - return - } - - result, err = client.ListJobHistoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure responding to request") - } - - return -} - -// ListJobHistoryPreparer prepares the ListJobHistory request. -func (client JobsClient) ListJobHistoryPreparer(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListJobHistorySender sends the ListJobHistory request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListJobHistorySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListJobHistoryResponder handles the response to the ListJobHistory request. The method always -// closes the http.Response Body. -func (client JobsClient) ListJobHistoryResponder(resp *http.Response) (result JobHistoryListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListJobHistoryNextResults retrieves the next set of results, if any. -func (client JobsClient) ListJobHistoryNextResults(lastResults JobHistoryListResult) (result JobHistoryListResult, err error) { - req, err := lastResults.JobHistoryListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListJobHistorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure sending next results request") - } - - result, err = client.ListJobHistoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure responding to next results request") - } - - return -} - -// Patch patches an existing job. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobName is the job name. job is the job definition. -func (client JobsClient) Patch(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) { - req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobName, job) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", resp, "Failure responding to request") - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client JobsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), - autorest.WithJSON(job), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) PatchSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client JobsClient) PatchResponder(resp *http.Response) (result JobDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Run runs a job. -// -// resourceGroupName is the resource group name. jobCollectionName is the job -// collection name. jobName is the job name. -func (client JobsClient) Run(resourceGroupName string, jobCollectionName string, jobName string) (result autorest.Response, err error) { - req, err := client.RunPreparer(resourceGroupName, jobCollectionName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", nil, "Failure preparing request") - return - } - - resp, err := client.RunSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", resp, "Failure sending request") - return - } - - result, err = client.RunResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", resp, "Failure responding to request") - } - - return -} - -// RunPreparer prepares the Run request. -func (client JobsClient) RunPreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobCollectionName": autorest.Encode("path", jobCollectionName), - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RunSender sends the Run request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) RunSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RunResponder handles the response to the Run request. The method always -// closes the http.Response Body. -func (client JobsClient) RunResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package scheduler + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// JobsClient is the client for the Jobs methods of the Scheduler service. +type JobsClient struct { + ManagementClient +} + +// NewJobsClient creates an instance of the JobsClient client. +func NewJobsClient(subscriptionID string) JobsClient { + return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobsClientWithBaseURI creates an instance of the JobsClient client. +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate provisions a new job or updates an existing job. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobName is the job name. job is the job definition. +func (client JobsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobName, job) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client JobsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), + autorest.WithJSON(job), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client JobsClient) CreateOrUpdateResponder(resp *http.Response) (result JobDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a job. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobName is the job name. +func (client JobsClient) Delete(resourceGroupName string, jobCollectionName string, jobName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, jobCollectionName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobsClient) DeletePreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a job. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobName is the job name. +func (client JobsClient) Get(resourceGroupName string, jobCollectionName string, jobName string) (result JobDefinition, err error) { + req, err := client.GetPreparer(resourceGroupName, jobCollectionName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobsClient) GetPreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobsClient) GetResponder(resp *http.Response) (result JobDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all jobs under the specified job collection. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. top is the number of jobs to request, in the of range of +// [1..100]. skip is the (0-based) index of the job history list from which to +// begin requesting entries. filter is the filter to apply on the job state. +func (client JobsClient) List(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (result JobListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "List") + } + + req, err := client.ListPreparer(resourceGroupName, jobCollectionName, top, skip, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client JobsClient) ListPreparer(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client JobsClient) ListResponder(resp *http.Response) (result JobListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobListResult, err error) { + req, err := lastResults.JobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListJobHistory lists job history. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobName is the job name. top is the number of job history +// to request, in the of range of [1..100]. skip is the (0-based) index of the +// job history list from which to begin requesting entries. filter is the +// filter to apply on the job state. +func (client JobsClient) ListJobHistory(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (result JobHistoryListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "ListJobHistory") + } + + req, err := client.ListJobHistoryPreparer(resourceGroupName, jobCollectionName, jobName, top, skip, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", nil, "Failure preparing request") + return + } + + resp, err := client.ListJobHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure sending request") + return + } + + result, err = client.ListJobHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure responding to request") + } + + return +} + +// ListJobHistoryPreparer prepares the ListJobHistory request. +func (client JobsClient) ListJobHistoryPreparer(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if skip != nil { + queryParameters["$skip"] = autorest.Encode("query", *skip) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListJobHistorySender sends the ListJobHistory request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListJobHistorySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListJobHistoryResponder handles the response to the ListJobHistory request. The method always +// closes the http.Response Body. +func (client JobsClient) ListJobHistoryResponder(resp *http.Response) (result JobHistoryListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListJobHistoryNextResults retrieves the next set of results, if any. +func (client JobsClient) ListJobHistoryNextResults(lastResults JobHistoryListResult) (result JobHistoryListResult, err error) { + req, err := lastResults.JobHistoryListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListJobHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure sending next results request") + } + + result, err = client.ListJobHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure responding to next results request") + } + + return +} + +// Patch patches an existing job. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobName is the job name. job is the job definition. +func (client JobsClient) Patch(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) { + req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobName, job) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client JobsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters), + autorest.WithJSON(job), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) PatchSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client JobsClient) PatchResponder(resp *http.Response) (result JobDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Run runs a job. +// +// resourceGroupName is the resource group name. jobCollectionName is the job +// collection name. jobName is the job name. +func (client JobsClient) Run(resourceGroupName string, jobCollectionName string, jobName string) (result autorest.Response, err error) { + req, err := client.RunPreparer(resourceGroupName, jobCollectionName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", nil, "Failure preparing request") + return + } + + resp, err := client.RunSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", resp, "Failure sending request") + return + } + + result, err = client.RunResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", resp, "Failure responding to request") + } + + return +} + +// RunPreparer prepares the Run request. +func (client JobsClient) RunPreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobCollectionName": autorest.Encode("path", jobCollectionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RunSender sends the Run request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) RunSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RunResponder handles the response to the Run request. The method always +// closes the http.Response Body. +func (client JobsClient) RunResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/models.go index 1a5af86ecb..d465de3bca 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/models.go @@ -1,536 +1,536 @@ -package scheduler - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // Friday specifies the friday state for day of week. - Friday DayOfWeek = "Friday" - // Monday specifies the monday state for day of week. - Monday DayOfWeek = "Monday" - // Saturday specifies the saturday state for day of week. - Saturday DayOfWeek = "Saturday" - // Sunday specifies the sunday state for day of week. - Sunday DayOfWeek = "Sunday" - // Thursday specifies the thursday state for day of week. - Thursday DayOfWeek = "Thursday" - // Tuesday specifies the tuesday state for day of week. - Tuesday DayOfWeek = "Tuesday" - // Wednesday specifies the wednesday state for day of week. - Wednesday DayOfWeek = "Wednesday" -) - -// HTTPAuthenticationType enumerates the values for http authentication type. -type HTTPAuthenticationType string - -const ( - // ActiveDirectoryOAuth specifies the active directory o auth state for - // http authentication type. - ActiveDirectoryOAuth HTTPAuthenticationType = "ActiveDirectoryOAuth" - // Basic specifies the basic state for http authentication type. - Basic HTTPAuthenticationType = "Basic" - // ClientCertificate specifies the client certificate state for http - // authentication type. - ClientCertificate HTTPAuthenticationType = "ClientCertificate" - // NotSpecified specifies the not specified state for http authentication - // type. - NotSpecified HTTPAuthenticationType = "NotSpecified" -) - -// JobActionType enumerates the values for job action type. -type JobActionType string - -const ( - // HTTP specifies the http state for job action type. - HTTP JobActionType = "Http" - // HTTPS specifies the https state for job action type. - HTTPS JobActionType = "Https" - // ServiceBusQueue specifies the service bus queue state for job action - // type. - ServiceBusQueue JobActionType = "ServiceBusQueue" - // ServiceBusTopic specifies the service bus topic state for job action - // type. - ServiceBusTopic JobActionType = "ServiceBusTopic" - // StorageQueue specifies the storage queue state for job action type. - StorageQueue JobActionType = "StorageQueue" -) - -// JobCollectionState enumerates the values for job collection state. -type JobCollectionState string - -const ( - // Deleted specifies the deleted state for job collection state. - Deleted JobCollectionState = "Deleted" - // Disabled specifies the disabled state for job collection state. - Disabled JobCollectionState = "Disabled" - // Enabled specifies the enabled state for job collection state. - Enabled JobCollectionState = "Enabled" - // Suspended specifies the suspended state for job collection state. - Suspended JobCollectionState = "Suspended" -) - -// JobExecutionStatus enumerates the values for job execution status. -type JobExecutionStatus string - -const ( - // Completed specifies the completed state for job execution status. - Completed JobExecutionStatus = "Completed" - // Failed specifies the failed state for job execution status. - Failed JobExecutionStatus = "Failed" - // Postponed specifies the postponed state for job execution status. - Postponed JobExecutionStatus = "Postponed" -) - -// JobHistoryActionName enumerates the values for job history action name. -type JobHistoryActionName string - -const ( - // ErrorAction specifies the error action state for job history action - // name. - ErrorAction JobHistoryActionName = "ErrorAction" - // MainAction specifies the main action state for job history action name. - MainAction JobHistoryActionName = "MainAction" -) - -// JobScheduleDay enumerates the values for job schedule day. -type JobScheduleDay string - -const ( - // JobScheduleDayFriday specifies the job schedule day friday state for job - // schedule day. - JobScheduleDayFriday JobScheduleDay = "Friday" - // JobScheduleDayMonday specifies the job schedule day monday state for job - // schedule day. - JobScheduleDayMonday JobScheduleDay = "Monday" - // JobScheduleDaySaturday specifies the job schedule day saturday state for - // job schedule day. - JobScheduleDaySaturday JobScheduleDay = "Saturday" - // JobScheduleDaySunday specifies the job schedule day sunday state for job - // schedule day. - JobScheduleDaySunday JobScheduleDay = "Sunday" - // JobScheduleDayThursday specifies the job schedule day thursday state for - // job schedule day. - JobScheduleDayThursday JobScheduleDay = "Thursday" - // JobScheduleDayTuesday specifies the job schedule day tuesday state for - // job schedule day. - JobScheduleDayTuesday JobScheduleDay = "Tuesday" - // JobScheduleDayWednesday specifies the job schedule day wednesday state - // for job schedule day. - JobScheduleDayWednesday JobScheduleDay = "Wednesday" -) - -// JobState enumerates the values for job state. -type JobState string - -const ( - // JobStateCompleted specifies the job state completed state for job state. - JobStateCompleted JobState = "Completed" - // JobStateDisabled specifies the job state disabled state for job state. - JobStateDisabled JobState = "Disabled" - // JobStateEnabled specifies the job state enabled state for job state. - JobStateEnabled JobState = "Enabled" - // JobStateFaulted specifies the job state faulted state for job state. - JobStateFaulted JobState = "Faulted" -) - -// RecurrenceFrequency enumerates the values for recurrence frequency. -type RecurrenceFrequency string - -const ( - // Day specifies the day state for recurrence frequency. - Day RecurrenceFrequency = "Day" - // Hour specifies the hour state for recurrence frequency. - Hour RecurrenceFrequency = "Hour" - // Minute specifies the minute state for recurrence frequency. - Minute RecurrenceFrequency = "Minute" - // Month specifies the month state for recurrence frequency. - Month RecurrenceFrequency = "Month" - // Week specifies the week state for recurrence frequency. - Week RecurrenceFrequency = "Week" -) - -// RetryType enumerates the values for retry type. -type RetryType string - -const ( - // Fixed specifies the fixed state for retry type. - Fixed RetryType = "Fixed" - // None specifies the none state for retry type. - None RetryType = "None" -) - -// ServiceBusAuthenticationType enumerates the values for service bus -// authentication type. -type ServiceBusAuthenticationType string - -const ( - // ServiceBusAuthenticationTypeNotSpecified specifies the service bus - // authentication type not specified state for service bus authentication - // type. - ServiceBusAuthenticationTypeNotSpecified ServiceBusAuthenticationType = "NotSpecified" - // ServiceBusAuthenticationTypeSharedAccessKey specifies the service bus - // authentication type shared access key state for service bus - // authentication type. - ServiceBusAuthenticationTypeSharedAccessKey ServiceBusAuthenticationType = "SharedAccessKey" -) - -// ServiceBusTransportType enumerates the values for service bus transport -// type. -type ServiceBusTransportType string - -const ( - // ServiceBusTransportTypeAMQP specifies the service bus transport type - // amqp state for service bus transport type. - ServiceBusTransportTypeAMQP ServiceBusTransportType = "AMQP" - // ServiceBusTransportTypeNetMessaging specifies the service bus transport - // type net messaging state for service bus transport type. - ServiceBusTransportTypeNetMessaging ServiceBusTransportType = "NetMessaging" - // ServiceBusTransportTypeNotSpecified specifies the service bus transport - // type not specified state for service bus transport type. - ServiceBusTransportTypeNotSpecified ServiceBusTransportType = "NotSpecified" -) - -// SkuDefinition enumerates the values for sku definition. -type SkuDefinition string - -const ( - // Free specifies the free state for sku definition. - Free SkuDefinition = "Free" - // P10Premium specifies the p10 premium state for sku definition. - P10Premium SkuDefinition = "P10Premium" - // P20Premium specifies the p20 premium state for sku definition. - P20Premium SkuDefinition = "P20Premium" - // Standard specifies the standard state for sku definition. - Standard SkuDefinition = "Standard" -) - -// BasicAuthentication is -type BasicAuthentication struct { - Type HTTPAuthenticationType `json:"type,omitempty"` - Username *string `json:"username,omitempty"` - Password *string `json:"password,omitempty"` -} - -// ClientCertAuthentication is -type ClientCertAuthentication struct { - Type HTTPAuthenticationType `json:"type,omitempty"` - Password *string `json:"password,omitempty"` - Pfx *string `json:"pfx,omitempty"` - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` - CertificateExpirationDate *date.Time `json:"certificateExpirationDate,omitempty"` - CertificateSubjectName *string `json:"certificateSubjectName,omitempty"` -} - -// HTTPAuthentication is -type HTTPAuthentication struct { - Type HTTPAuthenticationType `json:"type,omitempty"` -} - -// HTTPRequest is -type HTTPRequest struct { - Authentication *HTTPAuthentication `json:"authentication,omitempty"` - URI *string `json:"uri,omitempty"` - Method *string `json:"method,omitempty"` - Body *string `json:"body,omitempty"` - Headers *map[string]*string `json:"headers,omitempty"` -} - -// JobAction is -type JobAction struct { - Type JobActionType `json:"type,omitempty"` - Request *HTTPRequest `json:"request,omitempty"` - QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"` - ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"` - ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"` - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` - ErrorAction *JobErrorAction `json:"errorAction,omitempty"` -} - -// JobCollectionDefinition is -type JobCollectionDefinition struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *JobCollectionProperties `json:"properties,omitempty"` -} - -// JobCollectionListResult is -type JobCollectionListResult struct { - autorest.Response `json:"-"` - Value *[]JobCollectionDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobCollectionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobCollectionListResult) JobCollectionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobCollectionProperties is -type JobCollectionProperties struct { - Sku *Sku `json:"sku,omitempty"` - State JobCollectionState `json:"state,omitempty"` - Quota *JobCollectionQuota `json:"quota,omitempty"` -} - -// JobCollectionQuota is -type JobCollectionQuota struct { - MaxJobCount *int32 `json:"maxJobCount,omitempty"` - MaxJobOccurrence *int32 `json:"maxJobOccurrence,omitempty"` - MaxRecurrence *JobMaxRecurrence `json:"maxRecurrence,omitempty"` -} - -// JobDefinition is -type JobDefinition struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Properties *JobProperties `json:"properties,omitempty"` -} - -// JobErrorAction is -type JobErrorAction struct { - Type JobActionType `json:"type,omitempty"` - Request *HTTPRequest `json:"request,omitempty"` - QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"` - ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"` - ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"` - RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` -} - -// JobHistoryDefinition is -type JobHistoryDefinition struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Properties *JobHistoryDefinitionProperties `json:"properties,omitempty"` -} - -// JobHistoryDefinitionProperties is -type JobHistoryDefinitionProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ExpectedExecutionTime *date.Time `json:"expectedExecutionTime,omitempty"` - ActionName JobHistoryActionName `json:"actionName,omitempty"` - Status JobExecutionStatus `json:"status,omitempty"` - Message *string `json:"message,omitempty"` - RetryCount *int32 `json:"retryCount,omitempty"` - RepeatCount *int32 `json:"repeatCount,omitempty"` -} - -// JobHistoryFilter is -type JobHistoryFilter struct { - Status JobExecutionStatus `json:"status,omitempty"` -} - -// JobHistoryListResult is -type JobHistoryListResult struct { - autorest.Response `json:"-"` - Value *[]JobHistoryDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobHistoryListResult) JobHistoryListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobListResult is -type JobListResult struct { - autorest.Response `json:"-"` - Value *[]JobDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// JobListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobListResult) JobListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobMaxRecurrence is -type JobMaxRecurrence struct { - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - Interval *int32 `json:"interval,omitempty"` -} - -// JobProperties is -type JobProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - Action *JobAction `json:"action,omitempty"` - Recurrence *JobRecurrence `json:"recurrence,omitempty"` - State JobState `json:"state,omitempty"` - Status *JobStatus `json:"status,omitempty"` -} - -// JobRecurrence is -type JobRecurrence struct { - Frequency RecurrenceFrequency `json:"frequency,omitempty"` - Interval *int32 `json:"interval,omitempty"` - Count *int32 `json:"count,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Schedule *JobRecurrenceSchedule `json:"schedule,omitempty"` -} - -// JobRecurrenceSchedule is -type JobRecurrenceSchedule struct { - WeekDays *[]DayOfWeek `json:"weekDays,omitempty"` - Hours *[]int32 `json:"hours,omitempty"` - Minutes *[]int32 `json:"minutes,omitempty"` - MonthDays *[]int32 `json:"monthDays,omitempty"` - MonthlyOccurrences *[]JobRecurrenceScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` -} - -// JobRecurrenceScheduleMonthlyOccurrence is -type JobRecurrenceScheduleMonthlyOccurrence struct { - Day JobScheduleDay `json:"day,omitempty"` - Occurrence *int32 `json:"Occurrence,omitempty"` -} - -// JobStateFilter is -type JobStateFilter struct { - State JobState `json:"state,omitempty"` -} - -// JobStatus is -type JobStatus struct { - ExecutionCount *int32 `json:"executionCount,omitempty"` - FailureCount *int32 `json:"failureCount,omitempty"` - FaultedCount *int32 `json:"faultedCount,omitempty"` - LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` - NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"` -} - -// OAuthAuthentication is -type OAuthAuthentication struct { - Type HTTPAuthenticationType `json:"type,omitempty"` - Secret *string `json:"secret,omitempty"` - Tenant *string `json:"tenant,omitempty"` - Audience *string `json:"audience,omitempty"` - ClientID *string `json:"clientId,omitempty"` -} - -// RetryPolicy is -type RetryPolicy struct { - RetryType RetryType `json:"retryType,omitempty"` - RetryInterval *string `json:"retryInterval,omitempty"` - RetryCount *int32 `json:"retryCount,omitempty"` -} - -// ServiceBusAuthentication is -type ServiceBusAuthentication struct { - SasKey *string `json:"sasKey,omitempty"` - SasKeyName *string `json:"sasKeyName,omitempty"` - Type ServiceBusAuthenticationType `json:"type,omitempty"` -} - -// ServiceBusBrokeredMessageProperties is -type ServiceBusBrokeredMessageProperties struct { - ContentType *string `json:"contentType,omitempty"` - CorrelationID *string `json:"correlationId,omitempty"` - ForcePersistence *bool `json:"forcePersistence,omitempty"` - Label *string `json:"label,omitempty"` - MessageID *string `json:"messageId,omitempty"` - PartitionKey *string `json:"partitionKey,omitempty"` - ReplyTo *string `json:"replyTo,omitempty"` - ReplyToSessionID *string `json:"replyToSessionId,omitempty"` - ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"` - SessionID *string `json:"sessionId,omitempty"` - TimeToLive *string `json:"timeToLive,omitempty"` - To *string `json:"to,omitempty"` - ViaPartitionKey *string `json:"viaPartitionKey,omitempty"` -} - -// ServiceBusMessage is -type ServiceBusMessage struct { - Authentication *ServiceBusAuthentication `json:"authentication,omitempty"` - BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"` - CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"` - Message *string `json:"message,omitempty"` - Namespace *string `json:"namespace,omitempty"` - TransportType ServiceBusTransportType `json:"transportType,omitempty"` -} - -// ServiceBusQueueMessage is -type ServiceBusQueueMessage struct { - Authentication *ServiceBusAuthentication `json:"authentication,omitempty"` - BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"` - CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"` - Message *string `json:"message,omitempty"` - Namespace *string `json:"namespace,omitempty"` - TransportType ServiceBusTransportType `json:"transportType,omitempty"` - QueueName *string `json:"queueName,omitempty"` -} - -// ServiceBusTopicMessage is -type ServiceBusTopicMessage struct { - Authentication *ServiceBusAuthentication `json:"authentication,omitempty"` - BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"` - CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"` - Message *string `json:"message,omitempty"` - Namespace *string `json:"namespace,omitempty"` - TransportType ServiceBusTransportType `json:"transportType,omitempty"` - TopicPath *string `json:"topicPath,omitempty"` -} - -// Sku is -type Sku struct { - Name SkuDefinition `json:"name,omitempty"` -} - -// StorageQueueMessage is -type StorageQueueMessage struct { - StorageAccount *string `json:"storageAccount,omitempty"` - QueueName *string `json:"queueName,omitempty"` - SasToken *string `json:"sasToken,omitempty"` - Message *string `json:"message,omitempty"` -} +package scheduler + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DayOfWeek enumerates the values for day of week. +type DayOfWeek string + +const ( + // Friday specifies the friday state for day of week. + Friday DayOfWeek = "Friday" + // Monday specifies the monday state for day of week. + Monday DayOfWeek = "Monday" + // Saturday specifies the saturday state for day of week. + Saturday DayOfWeek = "Saturday" + // Sunday specifies the sunday state for day of week. + Sunday DayOfWeek = "Sunday" + // Thursday specifies the thursday state for day of week. + Thursday DayOfWeek = "Thursday" + // Tuesday specifies the tuesday state for day of week. + Tuesday DayOfWeek = "Tuesday" + // Wednesday specifies the wednesday state for day of week. + Wednesday DayOfWeek = "Wednesday" +) + +// HTTPAuthenticationType enumerates the values for http authentication type. +type HTTPAuthenticationType string + +const ( + // ActiveDirectoryOAuth specifies the active directory o auth state for + // http authentication type. + ActiveDirectoryOAuth HTTPAuthenticationType = "ActiveDirectoryOAuth" + // Basic specifies the basic state for http authentication type. + Basic HTTPAuthenticationType = "Basic" + // ClientCertificate specifies the client certificate state for http + // authentication type. + ClientCertificate HTTPAuthenticationType = "ClientCertificate" + // NotSpecified specifies the not specified state for http authentication + // type. + NotSpecified HTTPAuthenticationType = "NotSpecified" +) + +// JobActionType enumerates the values for job action type. +type JobActionType string + +const ( + // HTTP specifies the http state for job action type. + HTTP JobActionType = "Http" + // HTTPS specifies the https state for job action type. + HTTPS JobActionType = "Https" + // ServiceBusQueue specifies the service bus queue state for job action + // type. + ServiceBusQueue JobActionType = "ServiceBusQueue" + // ServiceBusTopic specifies the service bus topic state for job action + // type. + ServiceBusTopic JobActionType = "ServiceBusTopic" + // StorageQueue specifies the storage queue state for job action type. + StorageQueue JobActionType = "StorageQueue" +) + +// JobCollectionState enumerates the values for job collection state. +type JobCollectionState string + +const ( + // Deleted specifies the deleted state for job collection state. + Deleted JobCollectionState = "Deleted" + // Disabled specifies the disabled state for job collection state. + Disabled JobCollectionState = "Disabled" + // Enabled specifies the enabled state for job collection state. + Enabled JobCollectionState = "Enabled" + // Suspended specifies the suspended state for job collection state. + Suspended JobCollectionState = "Suspended" +) + +// JobExecutionStatus enumerates the values for job execution status. +type JobExecutionStatus string + +const ( + // Completed specifies the completed state for job execution status. + Completed JobExecutionStatus = "Completed" + // Failed specifies the failed state for job execution status. + Failed JobExecutionStatus = "Failed" + // Postponed specifies the postponed state for job execution status. + Postponed JobExecutionStatus = "Postponed" +) + +// JobHistoryActionName enumerates the values for job history action name. +type JobHistoryActionName string + +const ( + // ErrorAction specifies the error action state for job history action + // name. + ErrorAction JobHistoryActionName = "ErrorAction" + // MainAction specifies the main action state for job history action name. + MainAction JobHistoryActionName = "MainAction" +) + +// JobScheduleDay enumerates the values for job schedule day. +type JobScheduleDay string + +const ( + // JobScheduleDayFriday specifies the job schedule day friday state for job + // schedule day. + JobScheduleDayFriday JobScheduleDay = "Friday" + // JobScheduleDayMonday specifies the job schedule day monday state for job + // schedule day. + JobScheduleDayMonday JobScheduleDay = "Monday" + // JobScheduleDaySaturday specifies the job schedule day saturday state for + // job schedule day. + JobScheduleDaySaturday JobScheduleDay = "Saturday" + // JobScheduleDaySunday specifies the job schedule day sunday state for job + // schedule day. + JobScheduleDaySunday JobScheduleDay = "Sunday" + // JobScheduleDayThursday specifies the job schedule day thursday state for + // job schedule day. + JobScheduleDayThursday JobScheduleDay = "Thursday" + // JobScheduleDayTuesday specifies the job schedule day tuesday state for + // job schedule day. + JobScheduleDayTuesday JobScheduleDay = "Tuesday" + // JobScheduleDayWednesday specifies the job schedule day wednesday state + // for job schedule day. + JobScheduleDayWednesday JobScheduleDay = "Wednesday" +) + +// JobState enumerates the values for job state. +type JobState string + +const ( + // JobStateCompleted specifies the job state completed state for job state. + JobStateCompleted JobState = "Completed" + // JobStateDisabled specifies the job state disabled state for job state. + JobStateDisabled JobState = "Disabled" + // JobStateEnabled specifies the job state enabled state for job state. + JobStateEnabled JobState = "Enabled" + // JobStateFaulted specifies the job state faulted state for job state. + JobStateFaulted JobState = "Faulted" +) + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // Day specifies the day state for recurrence frequency. + Day RecurrenceFrequency = "Day" + // Hour specifies the hour state for recurrence frequency. + Hour RecurrenceFrequency = "Hour" + // Minute specifies the minute state for recurrence frequency. + Minute RecurrenceFrequency = "Minute" + // Month specifies the month state for recurrence frequency. + Month RecurrenceFrequency = "Month" + // Week specifies the week state for recurrence frequency. + Week RecurrenceFrequency = "Week" +) + +// RetryType enumerates the values for retry type. +type RetryType string + +const ( + // Fixed specifies the fixed state for retry type. + Fixed RetryType = "Fixed" + // None specifies the none state for retry type. + None RetryType = "None" +) + +// ServiceBusAuthenticationType enumerates the values for service bus +// authentication type. +type ServiceBusAuthenticationType string + +const ( + // ServiceBusAuthenticationTypeNotSpecified specifies the service bus + // authentication type not specified state for service bus authentication + // type. + ServiceBusAuthenticationTypeNotSpecified ServiceBusAuthenticationType = "NotSpecified" + // ServiceBusAuthenticationTypeSharedAccessKey specifies the service bus + // authentication type shared access key state for service bus + // authentication type. + ServiceBusAuthenticationTypeSharedAccessKey ServiceBusAuthenticationType = "SharedAccessKey" +) + +// ServiceBusTransportType enumerates the values for service bus transport +// type. +type ServiceBusTransportType string + +const ( + // ServiceBusTransportTypeAMQP specifies the service bus transport type + // amqp state for service bus transport type. + ServiceBusTransportTypeAMQP ServiceBusTransportType = "AMQP" + // ServiceBusTransportTypeNetMessaging specifies the service bus transport + // type net messaging state for service bus transport type. + ServiceBusTransportTypeNetMessaging ServiceBusTransportType = "NetMessaging" + // ServiceBusTransportTypeNotSpecified specifies the service bus transport + // type not specified state for service bus transport type. + ServiceBusTransportTypeNotSpecified ServiceBusTransportType = "NotSpecified" +) + +// SkuDefinition enumerates the values for sku definition. +type SkuDefinition string + +const ( + // Free specifies the free state for sku definition. + Free SkuDefinition = "Free" + // P10Premium specifies the p10 premium state for sku definition. + P10Premium SkuDefinition = "P10Premium" + // P20Premium specifies the p20 premium state for sku definition. + P20Premium SkuDefinition = "P20Premium" + // Standard specifies the standard state for sku definition. + Standard SkuDefinition = "Standard" +) + +// BasicAuthentication is +type BasicAuthentication struct { + Type HTTPAuthenticationType `json:"type,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` +} + +// ClientCertAuthentication is +type ClientCertAuthentication struct { + Type HTTPAuthenticationType `json:"type,omitempty"` + Password *string `json:"password,omitempty"` + Pfx *string `json:"pfx,omitempty"` + CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` + CertificateExpirationDate *date.Time `json:"certificateExpirationDate,omitempty"` + CertificateSubjectName *string `json:"certificateSubjectName,omitempty"` +} + +// HTTPAuthentication is +type HTTPAuthentication struct { + Type HTTPAuthenticationType `json:"type,omitempty"` +} + +// HTTPRequest is +type HTTPRequest struct { + Authentication *HTTPAuthentication `json:"authentication,omitempty"` + URI *string `json:"uri,omitempty"` + Method *string `json:"method,omitempty"` + Body *string `json:"body,omitempty"` + Headers *map[string]*string `json:"headers,omitempty"` +} + +// JobAction is +type JobAction struct { + Type JobActionType `json:"type,omitempty"` + Request *HTTPRequest `json:"request,omitempty"` + QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"` + ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"` + ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + ErrorAction *JobErrorAction `json:"errorAction,omitempty"` +} + +// JobCollectionDefinition is +type JobCollectionDefinition struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *JobCollectionProperties `json:"properties,omitempty"` +} + +// JobCollectionListResult is +type JobCollectionListResult struct { + autorest.Response `json:"-"` + Value *[]JobCollectionDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobCollectionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobCollectionListResult) JobCollectionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobCollectionProperties is +type JobCollectionProperties struct { + Sku *Sku `json:"sku,omitempty"` + State JobCollectionState `json:"state,omitempty"` + Quota *JobCollectionQuota `json:"quota,omitempty"` +} + +// JobCollectionQuota is +type JobCollectionQuota struct { + MaxJobCount *int32 `json:"maxJobCount,omitempty"` + MaxJobOccurrence *int32 `json:"maxJobOccurrence,omitempty"` + MaxRecurrence *JobMaxRecurrence `json:"maxRecurrence,omitempty"` +} + +// JobDefinition is +type JobDefinition struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Properties *JobProperties `json:"properties,omitempty"` +} + +// JobErrorAction is +type JobErrorAction struct { + Type JobActionType `json:"type,omitempty"` + Request *HTTPRequest `json:"request,omitempty"` + QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"` + ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"` + ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` +} + +// JobHistoryDefinition is +type JobHistoryDefinition struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Properties *JobHistoryDefinitionProperties `json:"properties,omitempty"` +} + +// JobHistoryDefinitionProperties is +type JobHistoryDefinitionProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ExpectedExecutionTime *date.Time `json:"expectedExecutionTime,omitempty"` + ActionName JobHistoryActionName `json:"actionName,omitempty"` + Status JobExecutionStatus `json:"status,omitempty"` + Message *string `json:"message,omitempty"` + RetryCount *int32 `json:"retryCount,omitempty"` + RepeatCount *int32 `json:"repeatCount,omitempty"` +} + +// JobHistoryFilter is +type JobHistoryFilter struct { + Status JobExecutionStatus `json:"status,omitempty"` +} + +// JobHistoryListResult is +type JobHistoryListResult struct { + autorest.Response `json:"-"` + Value *[]JobHistoryDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobHistoryListResult) JobHistoryListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobListResult is +type JobListResult struct { + autorest.Response `json:"-"` + Value *[]JobDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// JobListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobListResult) JobListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobMaxRecurrence is +type JobMaxRecurrence struct { + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + Interval *int32 `json:"interval,omitempty"` +} + +// JobProperties is +type JobProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + Action *JobAction `json:"action,omitempty"` + Recurrence *JobRecurrence `json:"recurrence,omitempty"` + State JobState `json:"state,omitempty"` + Status *JobStatus `json:"status,omitempty"` +} + +// JobRecurrence is +type JobRecurrence struct { + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + Interval *int32 `json:"interval,omitempty"` + Count *int32 `json:"count,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Schedule *JobRecurrenceSchedule `json:"schedule,omitempty"` +} + +// JobRecurrenceSchedule is +type JobRecurrenceSchedule struct { + WeekDays *[]DayOfWeek `json:"weekDays,omitempty"` + Hours *[]int32 `json:"hours,omitempty"` + Minutes *[]int32 `json:"minutes,omitempty"` + MonthDays *[]int32 `json:"monthDays,omitempty"` + MonthlyOccurrences *[]JobRecurrenceScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"` +} + +// JobRecurrenceScheduleMonthlyOccurrence is +type JobRecurrenceScheduleMonthlyOccurrence struct { + Day JobScheduleDay `json:"day,omitempty"` + Occurrence *int32 `json:"Occurrence,omitempty"` +} + +// JobStateFilter is +type JobStateFilter struct { + State JobState `json:"state,omitempty"` +} + +// JobStatus is +type JobStatus struct { + ExecutionCount *int32 `json:"executionCount,omitempty"` + FailureCount *int32 `json:"failureCount,omitempty"` + FaultedCount *int32 `json:"faultedCount,omitempty"` + LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` + NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"` +} + +// OAuthAuthentication is +type OAuthAuthentication struct { + Type HTTPAuthenticationType `json:"type,omitempty"` + Secret *string `json:"secret,omitempty"` + Tenant *string `json:"tenant,omitempty"` + Audience *string `json:"audience,omitempty"` + ClientID *string `json:"clientId,omitempty"` +} + +// RetryPolicy is +type RetryPolicy struct { + RetryType RetryType `json:"retryType,omitempty"` + RetryInterval *string `json:"retryInterval,omitempty"` + RetryCount *int32 `json:"retryCount,omitempty"` +} + +// ServiceBusAuthentication is +type ServiceBusAuthentication struct { + SasKey *string `json:"sasKey,omitempty"` + SasKeyName *string `json:"sasKeyName,omitempty"` + Type ServiceBusAuthenticationType `json:"type,omitempty"` +} + +// ServiceBusBrokeredMessageProperties is +type ServiceBusBrokeredMessageProperties struct { + ContentType *string `json:"contentType,omitempty"` + CorrelationID *string `json:"correlationId,omitempty"` + ForcePersistence *bool `json:"forcePersistence,omitempty"` + Label *string `json:"label,omitempty"` + MessageID *string `json:"messageId,omitempty"` + PartitionKey *string `json:"partitionKey,omitempty"` + ReplyTo *string `json:"replyTo,omitempty"` + ReplyToSessionID *string `json:"replyToSessionId,omitempty"` + ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"` + SessionID *string `json:"sessionId,omitempty"` + TimeToLive *string `json:"timeToLive,omitempty"` + To *string `json:"to,omitempty"` + ViaPartitionKey *string `json:"viaPartitionKey,omitempty"` +} + +// ServiceBusMessage is +type ServiceBusMessage struct { + Authentication *ServiceBusAuthentication `json:"authentication,omitempty"` + BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"` + CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"` + Message *string `json:"message,omitempty"` + Namespace *string `json:"namespace,omitempty"` + TransportType ServiceBusTransportType `json:"transportType,omitempty"` +} + +// ServiceBusQueueMessage is +type ServiceBusQueueMessage struct { + Authentication *ServiceBusAuthentication `json:"authentication,omitempty"` + BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"` + CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"` + Message *string `json:"message,omitempty"` + Namespace *string `json:"namespace,omitempty"` + TransportType ServiceBusTransportType `json:"transportType,omitempty"` + QueueName *string `json:"queueName,omitempty"` +} + +// ServiceBusTopicMessage is +type ServiceBusTopicMessage struct { + Authentication *ServiceBusAuthentication `json:"authentication,omitempty"` + BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"` + CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"` + Message *string `json:"message,omitempty"` + Namespace *string `json:"namespace,omitempty"` + TransportType ServiceBusTransportType `json:"transportType,omitempty"` + TopicPath *string `json:"topicPath,omitempty"` +} + +// Sku is +type Sku struct { + Name SkuDefinition `json:"name,omitempty"` +} + +// StorageQueueMessage is +type StorageQueueMessage struct { + StorageAccount *string `json:"storageAccount,omitempty"` + QueueName *string `json:"queueName,omitempty"` + SasToken *string `json:"sasToken,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/version.go index 3fcc01811f..9744571f62 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/scheduler/version.go @@ -1,29 +1,29 @@ -package scheduler - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-scheduler/2016-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package scheduler + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-scheduler/2016-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/adminkeys.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/adminkeys.go index 029aae79de..1f53128eeb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/adminkeys.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/adminkeys.go @@ -1,196 +1,196 @@ -package search - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/satori/uuid" - "net/http" -) - -// AdminKeysClient is the client that can be used to manage Azure Search -// services and API keys. -type AdminKeysClient struct { - ManagementClient -} - -// NewAdminKeysClient creates an instance of the AdminKeysClient client. -func NewAdminKeysClient(subscriptionID string) AdminKeysClient { - return NewAdminKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAdminKeysClientWithBaseURI creates an instance of the AdminKeysClient -// client. -func NewAdminKeysClientWithBaseURI(baseURI string, subscriptionID string) AdminKeysClient { - return AdminKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the primary and secondary admin API keys for the specified Azure -// Search service. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. clientRequestID is a -// client-generated GUID value that identifies this request. If specified, this -// will be included in response information as a way to track the request. -func (client AdminKeysClient) Get(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result AdminKeyResult, err error) { - req, err := client.GetPreparer(resourceGroupName, searchServiceName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AdminKeysClient) GetPreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AdminKeysClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AdminKeysClient) GetResponder(resp *http.Response) (result AdminKeyResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Regenerate regenerates either the primary or secondary admin API key. You -// can only regenerate one key at a time. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. keyKind is specifies which key -// to regenerate. Valid values include 'primary' and 'secondary'. -// clientRequestID is a client-generated GUID value that identifies this -// request. If specified, this will be included in response information as a -// way to track the request. -func (client AdminKeysClient) Regenerate(resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, clientRequestID *uuid.UUID) (result AdminKeyResult, err error) { - req, err := client.RegeneratePreparer(resourceGroupName, searchServiceName, keyKind, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", resp, "Failure sending request") - return - } - - result, err = client.RegenerateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", resp, "Failure responding to request") - } - - return -} - -// RegeneratePreparer prepares the Regenerate request. -func (client AdminKeysClient) RegeneratePreparer(resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyKind": autorest.Encode("path", keyKind), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// RegenerateSender sends the Regenerate request. The method will close the -// http.Response Body if it receives an error. -func (client AdminKeysClient) RegenerateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateResponder handles the response to the Regenerate request. The method always -// closes the http.Response Body. -func (client AdminKeysClient) RegenerateResponder(resp *http.Response) (result AdminKeyResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package search + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/satori/uuid" + "net/http" +) + +// AdminKeysClient is the client that can be used to manage Azure Search +// services and API keys. +type AdminKeysClient struct { + ManagementClient +} + +// NewAdminKeysClient creates an instance of the AdminKeysClient client. +func NewAdminKeysClient(subscriptionID string) AdminKeysClient { + return NewAdminKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAdminKeysClientWithBaseURI creates an instance of the AdminKeysClient +// client. +func NewAdminKeysClientWithBaseURI(baseURI string, subscriptionID string) AdminKeysClient { + return AdminKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the primary and secondary admin API keys for the specified Azure +// Search service. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. clientRequestID is a +// client-generated GUID value that identifies this request. If specified, this +// will be included in response information as a way to track the request. +func (client AdminKeysClient) Get(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result AdminKeyResult, err error) { + req, err := client.GetPreparer(resourceGroupName, searchServiceName, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AdminKeysClient) GetPreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AdminKeysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AdminKeysClient) GetResponder(resp *http.Response) (result AdminKeyResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Regenerate regenerates either the primary or secondary admin API key. You +// can only regenerate one key at a time. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. keyKind is specifies which key +// to regenerate. Valid values include 'primary' and 'secondary'. +// clientRequestID is a client-generated GUID value that identifies this +// request. If specified, this will be included in response information as a +// way to track the request. +func (client AdminKeysClient) Regenerate(resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, clientRequestID *uuid.UUID) (result AdminKeyResult, err error) { + req, err := client.RegeneratePreparer(resourceGroupName, searchServiceName, keyKind, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", resp, "Failure sending request") + return + } + + result, err = client.RegenerateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", resp, "Failure responding to request") + } + + return +} + +// RegeneratePreparer prepares the Regenerate request. +func (client AdminKeysClient) RegeneratePreparer(resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyKind": autorest.Encode("path", keyKind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// RegenerateSender sends the Regenerate request. The method will close the +// http.Response Body if it receives an error. +func (client AdminKeysClient) RegenerateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateResponder handles the response to the Regenerate request. The method always +// closes the http.Response Body. +func (client AdminKeysClient) RegenerateResponder(resp *http.Response) (result AdminKeyResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/client.go index d86c30086f..06993d4934 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/client.go @@ -1,53 +1,53 @@ -// Package search implements the Azure ARM Search service API version -// 2015-08-19. -// -// Client that can be used to manage Azure Search services and API keys. -package search - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Search - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Search. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package search implements the Azure ARM Search service API version +// 2015-08-19. +// +// Client that can be used to manage Azure Search services and API keys. +package search + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Search + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Search. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/models.go index f0330a3244..7716a21f73 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/models.go @@ -1,200 +1,200 @@ -package search - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// AdminKeyKind enumerates the values for admin key kind. -type AdminKeyKind string - -const ( - // Primary specifies the primary state for admin key kind. - Primary AdminKeyKind = "primary" - // Secondary specifies the secondary state for admin key kind. - Secondary AdminKeyKind = "secondary" -) - -// HostingMode enumerates the values for hosting mode. -type HostingMode string - -const ( - // Default specifies the default state for hosting mode. - Default HostingMode = "default" - // HighDensity specifies the high density state for hosting mode. - HighDensity HostingMode = "highDensity" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "failed" - // Provisioning specifies the provisioning state for provisioning state. - Provisioning ProvisioningState = "provisioning" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "succeeded" -) - -// ServiceStatus enumerates the values for service status. -type ServiceStatus string - -const ( - // ServiceStatusDegraded specifies the service status degraded state for - // service status. - ServiceStatusDegraded ServiceStatus = "degraded" - // ServiceStatusDeleting specifies the service status deleting state for - // service status. - ServiceStatusDeleting ServiceStatus = "deleting" - // ServiceStatusDisabled specifies the service status disabled state for - // service status. - ServiceStatusDisabled ServiceStatus = "disabled" - // ServiceStatusError specifies the service status error state for service - // status. - ServiceStatusError ServiceStatus = "error" - // ServiceStatusProvisioning specifies the service status provisioning - // state for service status. - ServiceStatusProvisioning ServiceStatus = "provisioning" - // ServiceStatusRunning specifies the service status running state for - // service status. - ServiceStatusRunning ServiceStatus = "running" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic specifies the basic state for sku name. - Basic SkuName = "basic" - // Free specifies the free state for sku name. - Free SkuName = "free" - // Standard specifies the standard state for sku name. - Standard SkuName = "standard" - // Standard2 specifies the standard 2 state for sku name. - Standard2 SkuName = "standard2" - // Standard3 specifies the standard 3 state for sku name. - Standard3 SkuName = "standard3" -) - -// UnavailableNameReason enumerates the values for unavailable name reason. -type UnavailableNameReason string - -const ( - // AlreadyExists specifies the already exists state for unavailable name - // reason. - AlreadyExists UnavailableNameReason = "AlreadyExists" - // Invalid specifies the invalid state for unavailable name reason. - Invalid UnavailableNameReason = "Invalid" -) - -// AdminKeyResult is response containing the primary and secondary admin API -// keys for a given Azure Search service. -type AdminKeyResult struct { - autorest.Response `json:"-"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// CheckNameAvailabilityInput is input of check name availability API. -type CheckNameAvailabilityInput struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityOutput is output of check name availability API. -type CheckNameAvailabilityOutput struct { - autorest.Response `json:"-"` - IsNameAvailable *bool `json:"nameAvailable,omitempty"` - Reason UnavailableNameReason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CloudError is contains information about an API error. -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody is describes a particular API error with an error code and a -// message. -type CloudErrorBody struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ListQueryKeysResult is response containing the query API keys for a given -// Azure Search service. -type ListQueryKeysResult struct { - autorest.Response `json:"-"` - Value *[]QueryKey `json:"value,omitempty"` -} - -// QueryKey is describes an API key for a given Azure Search service that has -// permissions for query operations only. -type QueryKey struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Key *string `json:"key,omitempty"` -} - -// Resource is base type for all Azure resources. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Service is describes an Azure Search service and its current state. -type Service struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ServiceProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// ServiceListResult is response containing a list of Azure Search services. -type ServiceListResult struct { - autorest.Response `json:"-"` - Value *[]Service `json:"value,omitempty"` -} - -// ServiceProperties is properties of the Search service. -type ServiceProperties struct { - ReplicaCount *int32 `json:"replicaCount,omitempty"` - PartitionCount *int32 `json:"partitionCount,omitempty"` - HostingMode HostingMode `json:"hostingMode,omitempty"` - Status ServiceStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// Sku is defines the SKU of an Azure Search Service, which determines price -// tier and capacity limits. -type Sku struct { - Name SkuName `json:"name,omitempty"` -} +package search + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// AdminKeyKind enumerates the values for admin key kind. +type AdminKeyKind string + +const ( + // Primary specifies the primary state for admin key kind. + Primary AdminKeyKind = "primary" + // Secondary specifies the secondary state for admin key kind. + Secondary AdminKeyKind = "secondary" +) + +// HostingMode enumerates the values for hosting mode. +type HostingMode string + +const ( + // Default specifies the default state for hosting mode. + Default HostingMode = "default" + // HighDensity specifies the high density state for hosting mode. + HighDensity HostingMode = "highDensity" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "failed" + // Provisioning specifies the provisioning state for provisioning state. + Provisioning ProvisioningState = "provisioning" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "succeeded" +) + +// ServiceStatus enumerates the values for service status. +type ServiceStatus string + +const ( + // ServiceStatusDegraded specifies the service status degraded state for + // service status. + ServiceStatusDegraded ServiceStatus = "degraded" + // ServiceStatusDeleting specifies the service status deleting state for + // service status. + ServiceStatusDeleting ServiceStatus = "deleting" + // ServiceStatusDisabled specifies the service status disabled state for + // service status. + ServiceStatusDisabled ServiceStatus = "disabled" + // ServiceStatusError specifies the service status error state for service + // status. + ServiceStatusError ServiceStatus = "error" + // ServiceStatusProvisioning specifies the service status provisioning + // state for service status. + ServiceStatusProvisioning ServiceStatus = "provisioning" + // ServiceStatusRunning specifies the service status running state for + // service status. + ServiceStatusRunning ServiceStatus = "running" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Basic specifies the basic state for sku name. + Basic SkuName = "basic" + // Free specifies the free state for sku name. + Free SkuName = "free" + // Standard specifies the standard state for sku name. + Standard SkuName = "standard" + // Standard2 specifies the standard 2 state for sku name. + Standard2 SkuName = "standard2" + // Standard3 specifies the standard 3 state for sku name. + Standard3 SkuName = "standard3" +) + +// UnavailableNameReason enumerates the values for unavailable name reason. +type UnavailableNameReason string + +const ( + // AlreadyExists specifies the already exists state for unavailable name + // reason. + AlreadyExists UnavailableNameReason = "AlreadyExists" + // Invalid specifies the invalid state for unavailable name reason. + Invalid UnavailableNameReason = "Invalid" +) + +// AdminKeyResult is response containing the primary and secondary admin API +// keys for a given Azure Search service. +type AdminKeyResult struct { + autorest.Response `json:"-"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} + +// CheckNameAvailabilityInput is input of check name availability API. +type CheckNameAvailabilityInput struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityOutput is output of check name availability API. +type CheckNameAvailabilityOutput struct { + autorest.Response `json:"-"` + IsNameAvailable *bool `json:"nameAvailable,omitempty"` + Reason UnavailableNameReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CloudError is contains information about an API error. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody is describes a particular API error with an error code and a +// message. +type CloudErrorBody struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ListQueryKeysResult is response containing the query API keys for a given +// Azure Search service. +type ListQueryKeysResult struct { + autorest.Response `json:"-"` + Value *[]QueryKey `json:"value,omitempty"` +} + +// QueryKey is describes an API key for a given Azure Search service that has +// permissions for query operations only. +type QueryKey struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Key *string `json:"key,omitempty"` +} + +// Resource is base type for all Azure resources. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Service is describes an Azure Search service and its current state. +type Service struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ServiceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// ServiceListResult is response containing a list of Azure Search services. +type ServiceListResult struct { + autorest.Response `json:"-"` + Value *[]Service `json:"value,omitempty"` +} + +// ServiceProperties is properties of the Search service. +type ServiceProperties struct { + ReplicaCount *int32 `json:"replicaCount,omitempty"` + PartitionCount *int32 `json:"partitionCount,omitempty"` + HostingMode HostingMode `json:"hostingMode,omitempty"` + Status ServiceStatus `json:"status,omitempty"` + StatusDetails *string `json:"statusDetails,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// Sku is defines the SKU of an Azure Search Service, which determines price +// tier and capacity limits. +type Sku struct { + Name SkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/querykeys.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/querykeys.go index 62fd16e559..087fd21db8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/querykeys.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/querykeys.go @@ -1,272 +1,272 @@ -package search - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/satori/uuid" - "net/http" -) - -// QueryKeysClient is the client that can be used to manage Azure Search -// services and API keys. -type QueryKeysClient struct { - ManagementClient -} - -// NewQueryKeysClient creates an instance of the QueryKeysClient client. -func NewQueryKeysClient(subscriptionID string) QueryKeysClient { - return NewQueryKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueryKeysClientWithBaseURI creates an instance of the QueryKeysClient -// client. -func NewQueryKeysClientWithBaseURI(baseURI string, subscriptionID string) QueryKeysClient { - return QueryKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create generates a new query key for the specified Search service. You can -// create up to 50 query keys per service. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. name is the name of the new -// query API key. clientRequestID is a client-generated GUID value that -// identifies this request. If specified, this will be included in response -// information as a way to track the request. -func (client QueryKeysClient) Create(resourceGroupName string, searchServiceName string, name string, clientRequestID *uuid.UUID) (result QueryKey, err error) { - req, err := client.CreatePreparer(resourceGroupName, searchServiceName, name, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client QueryKeysClient) CreatePreparer(resourceGroupName string, searchServiceName string, name string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client QueryKeysClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client QueryKeysClient) CreateResponder(resp *http.Response) (result QueryKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified query key. Unlike admin keys, query keys are -// not regenerated. The process for regenerating a query key is to delete and -// then recreate it. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. key is the query key to be -// deleted. Query keys are identified by value, not by name. clientRequestID is -// a client-generated GUID value that identifies this request. If specified, -// this will be included in response information as a way to track the request. -func (client QueryKeysClient) Delete(resourceGroupName string, searchServiceName string, key string, clientRequestID *uuid.UUID) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, searchServiceName, key, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client QueryKeysClient) DeletePreparer(resourceGroupName string, searchServiceName string, key string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "key": autorest.Encode("path", key), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client QueryKeysClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client QueryKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// ListBySearchService returns the list of query API keys for the given Azure -// Search service. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. clientRequestID is a -// client-generated GUID value that identifies this request. If specified, this -// will be included in response information as a way to track the request. -func (client QueryKeysClient) ListBySearchService(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result ListQueryKeysResult, err error) { - req, err := client.ListBySearchServicePreparer(resourceGroupName, searchServiceName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySearchServiceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", resp, "Failure sending request") - return - } - - result, err = client.ListBySearchServiceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", resp, "Failure responding to request") - } - - return -} - -// ListBySearchServicePreparer prepares the ListBySearchService request. -func (client QueryKeysClient) ListBySearchServicePreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// ListBySearchServiceSender sends the ListBySearchService request. The method will close the -// http.Response Body if it receives an error. -func (client QueryKeysClient) ListBySearchServiceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySearchServiceResponder handles the response to the ListBySearchService request. The method always -// closes the http.Response Body. -func (client QueryKeysClient) ListBySearchServiceResponder(resp *http.Response) (result ListQueryKeysResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package search + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/satori/uuid" + "net/http" +) + +// QueryKeysClient is the client that can be used to manage Azure Search +// services and API keys. +type QueryKeysClient struct { + ManagementClient +} + +// NewQueryKeysClient creates an instance of the QueryKeysClient client. +func NewQueryKeysClient(subscriptionID string) QueryKeysClient { + return NewQueryKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueryKeysClientWithBaseURI creates an instance of the QueryKeysClient +// client. +func NewQueryKeysClientWithBaseURI(baseURI string, subscriptionID string) QueryKeysClient { + return QueryKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create generates a new query key for the specified Search service. You can +// create up to 50 query keys per service. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. name is the name of the new +// query API key. clientRequestID is a client-generated GUID value that +// identifies this request. If specified, this will be included in response +// information as a way to track the request. +func (client QueryKeysClient) Create(resourceGroupName string, searchServiceName string, name string, clientRequestID *uuid.UUID) (result QueryKey, err error) { + req, err := client.CreatePreparer(resourceGroupName, searchServiceName, name, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client QueryKeysClient) CreatePreparer(resourceGroupName string, searchServiceName string, name string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client QueryKeysClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client QueryKeysClient) CreateResponder(resp *http.Response) (result QueryKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified query key. Unlike admin keys, query keys are +// not regenerated. The process for regenerating a query key is to delete and +// then recreate it. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. key is the query key to be +// deleted. Query keys are identified by value, not by name. clientRequestID is +// a client-generated GUID value that identifies this request. If specified, +// this will be included in response information as a way to track the request. +func (client QueryKeysClient) Delete(resourceGroupName string, searchServiceName string, key string, clientRequestID *uuid.UUID) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, searchServiceName, key, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client QueryKeysClient) DeletePreparer(resourceGroupName string, searchServiceName string, key string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "key": autorest.Encode("path", key), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client QueryKeysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client QueryKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListBySearchService returns the list of query API keys for the given Azure +// Search service. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. clientRequestID is a +// client-generated GUID value that identifies this request. If specified, this +// will be included in response information as a way to track the request. +func (client QueryKeysClient) ListBySearchService(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result ListQueryKeysResult, err error) { + req, err := client.ListBySearchServicePreparer(resourceGroupName, searchServiceName, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySearchServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", resp, "Failure sending request") + return + } + + result, err = client.ListBySearchServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", resp, "Failure responding to request") + } + + return +} + +// ListBySearchServicePreparer prepares the ListBySearchService request. +func (client QueryKeysClient) ListBySearchServicePreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// ListBySearchServiceSender sends the ListBySearchService request. The method will close the +// http.Response Body if it receives an error. +func (client QueryKeysClient) ListBySearchServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySearchServiceResponder handles the response to the ListBySearchService request. The method always +// closes the http.Response Body. +func (client QueryKeysClient) ListBySearchServiceResponder(resp *http.Response) (result ListQueryKeysResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/services.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/services.go index f10262ac2f..eaa4896b9e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/services.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/services.go @@ -1,446 +1,446 @@ -package search - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/uuid" - "net/http" -) - -// ServicesClient is the client that can be used to manage Azure Search -// services and API keys. -type ServicesClient struct { - ManagementClient -} - -// NewServicesClient creates an instance of the ServicesClient client. -func NewServicesClient(subscriptionID string) ServicesClient { - return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServicesClientWithBaseURI creates an instance of the ServicesClient -// client. -func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { - return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks whether or not the given Search service name is -// available for use. Search service names must be globally unique since they -// are part of the service URI (https://.search.windows.net). -// -// checkNameAvailabilityInput is the resource name and type to check. -// clientRequestID is a client-generated GUID value that identifies this -// request. If specified, this will be included in response information as a -// way to track the request. -func (client ServicesClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput, clientRequestID *uuid.UUID) (result CheckNameAvailabilityOutput, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: checkNameAvailabilityInput, - Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "search.ServicesClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServicesClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability", pathParameters), - autorest.WithJSON(checkNameAvailabilityInput), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a Search service in the given resource -// group. If the Search service already exists, all properties will be updated -// with the given values. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service to -// create or update. Search service names must only contain lowercase letters, -// digits or dashes, cannot use dash as the first two or last one characters, -// cannot contain consecutive dashes, and must be between 2 and 60 characters -// in length. Search service names must be globally unique since they are part -// of the service URI (https://.search.windows.net). You cannot change -// the service name after the service is created. service is the definition of -// the Search service to create or update. clientRequestID is a -// client-generated GUID value that identifies this request. If specified, this -// will be included in response information as a way to track the request. -func (client ServicesClient) CreateOrUpdate(resourceGroupName string, searchServiceName string, service Service, clientRequestID *uuid.UUID) (result Service, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: service, - Constraints: []validation.Constraint{{Target: "service.ServiceProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "service.ServiceProperties.ReplicaCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "service.ServiceProperties.ReplicaCount", Name: validation.InclusiveMaximum, Rule: 12, Chain: nil}, - {Target: "service.ServiceProperties.ReplicaCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - {Target: "service.ServiceProperties.PartitionCount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "service.ServiceProperties.PartitionCount", Name: validation.InclusiveMaximum, Rule: 12, Chain: nil}, - {Target: "service.ServiceProperties.PartitionCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}, - {Target: "service.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "search.ServicesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, searchServiceName, service, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServicesClient) CreateOrUpdatePreparer(resourceGroupName string, searchServiceName string, service Service, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters), - autorest.WithJSON(service), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result Service, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Search service in the given resource group, along with its -// associated resources. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. clientRequestID is a -// client-generated GUID value that identifies this request. If specified, this -// will be included in response information as a way to track the request. -func (client ServicesClient) Delete(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, searchServiceName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicesClient) DeletePreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the Search service with the given name in the given resource group. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. searchServiceName is the name of the Azure Search service -// associated with the specified resource group. clientRequestID is a -// client-generated GUID value that identifies this request. If specified, this -// will be included in response information as a way to track the request. -func (client ServicesClient) Get(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result Service, err error) { - req, err := client.GetPreparer(resourceGroupName, searchServiceName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicesClient) GetPreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "searchServiceName": autorest.Encode("path", searchServiceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicesClient) GetResponder(resp *http.Response) (result Service, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets a list of all Search services in the given resource -// group. -// -// resourceGroupName is the name of the resource group within the current -// subscription. You can obtain this value from the Azure Resource Manager API -// or the portal. clientRequestID is a client-generated GUID value that -// identifies this request. If specified, this will be included in response -// information as a way to track the request. -func (client ServicesClient) ListByResourceGroup(resourceGroupName string, clientRequestID *uuid.UUID) (result ServiceListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName, clientRequestID) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServicesClient) ListByResourceGroupPreparer(resourceGroupName string, clientRequestID *uuid.UUID) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-19" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if clientRequestID != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) - } - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package search + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/satori/uuid" + "net/http" +) + +// ServicesClient is the client that can be used to manage Azure Search +// services and API keys. +type ServicesClient struct { + ManagementClient +} + +// NewServicesClient creates an instance of the ServicesClient client. +func NewServicesClient(subscriptionID string) ServicesClient { + return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicesClientWithBaseURI creates an instance of the ServicesClient +// client. +func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { + return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks whether or not the given Search service name is +// available for use. Search service names must be globally unique since they +// are part of the service URI (https://.search.windows.net). +// +// checkNameAvailabilityInput is the resource name and type to check. +// clientRequestID is a client-generated GUID value that identifies this +// request. If specified, this will be included in response information as a +// way to track the request. +func (client ServicesClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput, clientRequestID *uuid.UUID) (result CheckNameAvailabilityOutput, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: checkNameAvailabilityInput, + Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "search.ServicesClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ServicesClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability", pathParameters), + autorest.WithJSON(checkNameAvailabilityInput), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a Search service in the given resource +// group. If the Search service already exists, all properties will be updated +// with the given values. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service to +// create or update. Search service names must only contain lowercase letters, +// digits or dashes, cannot use dash as the first two or last one characters, +// cannot contain consecutive dashes, and must be between 2 and 60 characters +// in length. Search service names must be globally unique since they are part +// of the service URI (https://.search.windows.net). You cannot change +// the service name after the service is created. service is the definition of +// the Search service to create or update. clientRequestID is a +// client-generated GUID value that identifies this request. If specified, this +// will be included in response information as a way to track the request. +func (client ServicesClient) CreateOrUpdate(resourceGroupName string, searchServiceName string, service Service, clientRequestID *uuid.UUID) (result Service, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: service, + Constraints: []validation.Constraint{{Target: "service.ServiceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "service.ServiceProperties.ReplicaCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "service.ServiceProperties.ReplicaCount", Name: validation.InclusiveMaximum, Rule: 12, Chain: nil}, + {Target: "service.ServiceProperties.ReplicaCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + {Target: "service.ServiceProperties.PartitionCount", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "service.ServiceProperties.PartitionCount", Name: validation.InclusiveMaximum, Rule: 12, Chain: nil}, + {Target: "service.ServiceProperties.PartitionCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}, + {Target: "service.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "search.ServicesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, searchServiceName, service, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServicesClient) CreateOrUpdatePreparer(resourceGroupName string, searchServiceName string, service Service, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters), + autorest.WithJSON(service), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result Service, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Search service in the given resource group, along with its +// associated resources. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. clientRequestID is a +// client-generated GUID value that identifies this request. If specified, this +// will be included in response information as a way to track the request. +func (client ServicesClient) Delete(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, searchServiceName, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicesClient) DeletePreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the Search service with the given name in the given resource group. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. searchServiceName is the name of the Azure Search service +// associated with the specified resource group. clientRequestID is a +// client-generated GUID value that identifies this request. If specified, this +// will be included in response information as a way to track the request. +func (client ServicesClient) Get(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result Service, err error) { + req, err := client.GetPreparer(resourceGroupName, searchServiceName, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicesClient) GetPreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "searchServiceName": autorest.Encode("path", searchServiceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServicesClient) GetResponder(resp *http.Response) (result Service, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets a list of all Search services in the given resource +// group. +// +// resourceGroupName is the name of the resource group within the current +// subscription. You can obtain this value from the Azure Resource Manager API +// or the portal. clientRequestID is a client-generated GUID value that +// identifies this request. If specified, this will be included in response +// information as a way to track the request. +func (client ServicesClient) ListByResourceGroup(resourceGroupName string, clientRequestID *uuid.UUID) (result ServiceListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName, clientRequestID) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServicesClient) ListByResourceGroupPreparer(resourceGroupName string, clientRequestID *uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-19" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if clientRequestID != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID))) + } + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/version.go index 8a7e4f9079..8045337d8a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/search/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/search/version.go @@ -1,29 +1,29 @@ -package search - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-search/2015-08-19" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package search + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-search/2015-08-19" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/client.go index c7336d23f4..ab6f67d753 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/client.go @@ -1,53 +1,53 @@ -// Package servermanagement implements the Azure ARM Servermanagement service -// API version 2016-07-01-preview. -// -// REST API for Azure Server Management Service. -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Servermanagement - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Servermanagement. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package servermanagement implements the Azure ARM Servermanagement service +// API version 2016-07-01-preview. +// +// REST API for Azure Server Management Service. +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Servermanagement + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Servermanagement. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/gateway.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/gateway.go index 854a87623f..4219f1bb58 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/gateway.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/gateway.go @@ -1,869 +1,869 @@ -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// GatewayClient is the rEST API for Azure Server Management Service. -type GatewayClient struct { - ManagementClient -} - -// NewGatewayClient creates an instance of the GatewayClient client. -func NewGatewayClient(subscriptionID string) GatewayClient { - return NewGatewayClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGatewayClientWithBaseURI creates an instance of the GatewayClient client. -func NewGatewayClientWithBaseURI(baseURI string, subscriptionID string) GatewayClient { - return GatewayClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates or updates a ManagementService gateway. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum). gatewayParameters is parameters supplied to -// the CreateOrUpdate operation. -func (client GatewayClient) Create(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (<-chan GatewayResource, <-chan error) { - resultChan := make(chan GatewayResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result GatewayResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, gatewayName, gatewayParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client GatewayClient) CreatePreparer(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(gatewayParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GatewayClient) CreateResponder(resp *http.Response) (result GatewayResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a gateway from a resource group. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum). -func (client GatewayClient) Delete(resourceGroupName string, gatewayName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, gatewayName) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GatewayClient) DeletePreparer(resourceGroupName string, gatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GatewayClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a gateway. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum) expand is gets subscription credentials which -// uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -func (client GatewayClient) Get(resourceGroupName string, gatewayName string, expand GatewayExpandOption) (result GatewayResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, gatewayName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client GatewayClient) GetPreparer(resourceGroupName string, gatewayName string, expand GatewayExpandOption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(expand)) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GatewayClient) GetResponder(resp *http.Response) (result GatewayResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetProfile gets a gateway profile. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum). -func (client GatewayClient) GetProfile(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (<-chan GatewayProfile, <-chan error) { - resultChan := make(chan GatewayProfile, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "GetProfile") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result GatewayProfile - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.GetProfilePreparer(resourceGroupName, gatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "GetProfile", nil, "Failure preparing request") - return - } - - resp, err := client.GetProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "GetProfile", resp, "Failure sending request") - return - } - - result, err = client.GetProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "GetProfile", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// GetProfilePreparer prepares the GetProfile request. -func (client GatewayClient) GetProfilePreparer(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/profile", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// GetProfileSender sends the GetProfile request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) GetProfileSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// GetProfileResponder handles the response to the GetProfile request. The method always -// closes the http.Response Body. -func (client GatewayClient) GetProfileResponder(resp *http.Response) (result GatewayProfile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns gateways in a subscription. -func (client GatewayClient) List() (result GatewayResources, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client GatewayClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServerManagement/gateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GatewayClient) ListResponder(resp *http.Response) (result GatewayResources, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client GatewayClient) ListNextResults(lastResults GatewayResources) (result GatewayResources, err error) { - req, err := lastResults.GatewayResourcesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListForResourceGroup returns gateways in a resource group. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. -func (client GatewayClient) ListForResourceGroup(resourceGroupName string) (result GatewayResources, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "ListForResourceGroup") - } - - req, err := client.ListForResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client GatewayClient) ListForResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client GatewayClient) ListForResourceGroupResponder(resp *http.Response) (result GatewayResources, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceGroupNextResults retrieves the next set of results, if any. -func (client GatewayClient) ListForResourceGroupNextResults(lastResults GatewayResources) (result GatewayResources, err error) { - req, err := lastResults.GatewayResourcesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// RegenerateProfile regenerate a gateway's profile This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum). -func (client GatewayClient) RegenerateProfile(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "RegenerateProfile") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RegenerateProfilePreparer(resourceGroupName, gatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "RegenerateProfile", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateProfileSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "RegenerateProfile", resp, "Failure sending request") - return - } - - result, err = client.RegenerateProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "RegenerateProfile", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RegenerateProfilePreparer prepares the RegenerateProfile request. -func (client GatewayClient) RegenerateProfilePreparer(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/regenerateprofile", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RegenerateProfileSender sends the RegenerateProfile request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) RegenerateProfileSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RegenerateProfileResponder handles the response to the RegenerateProfile request. The method always -// closes the http.Response Body. -func (client GatewayClient) RegenerateProfileResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a gateway belonging to a resource group. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum). gatewayParameters is parameters supplied to -// the Update operation. -func (client GatewayClient) Update(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (<-chan GatewayResource, <-chan error) { - resultChan := make(chan GatewayResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Update") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result GatewayResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, gatewayName, gatewayParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client GatewayClient) UpdatePreparer(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(gatewayParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GatewayClient) UpdateResponder(resp *http.Response) (result GatewayResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Upgrade upgrades a gateway. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. gatewayName is the gateway -// name (256 characters maximum). -func (client GatewayClient) Upgrade(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: gatewayName, - Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Upgrade") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpgradePreparer(resourceGroupName, gatewayName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Upgrade", nil, "Failure preparing request") - return - } - - resp, err := client.UpgradeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Upgrade", resp, "Failure sending request") - return - } - - result, err = client.UpgradeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Upgrade", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpgradePreparer prepares the Upgrade request. -func (client GatewayClient) UpgradePreparer(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/upgradetolatest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpgradeSender sends the Upgrade request. The method will close the -// http.Response Body if it receives an error. -func (client GatewayClient) UpgradeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpgradeResponder handles the response to the Upgrade request. The method always -// closes the http.Response Body. -func (client GatewayClient) UpgradeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// GatewayClient is the rEST API for Azure Server Management Service. +type GatewayClient struct { + ManagementClient +} + +// NewGatewayClient creates an instance of the GatewayClient client. +func NewGatewayClient(subscriptionID string) GatewayClient { + return NewGatewayClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGatewayClientWithBaseURI creates an instance of the GatewayClient client. +func NewGatewayClientWithBaseURI(baseURI string, subscriptionID string) GatewayClient { + return GatewayClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates or updates a ManagementService gateway. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum). gatewayParameters is parameters supplied to +// the CreateOrUpdate operation. +func (client GatewayClient) Create(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (<-chan GatewayResource, <-chan error) { + resultChan := make(chan GatewayResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result GatewayResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, gatewayName, gatewayParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client GatewayClient) CreatePreparer(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(gatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GatewayClient) CreateResponder(resp *http.Response) (result GatewayResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a gateway from a resource group. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum). +func (client GatewayClient) Delete(resourceGroupName string, gatewayName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GatewayClient) DeletePreparer(resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GatewayClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a gateway. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum) expand is gets subscription credentials which +// uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +func (client GatewayClient) Get(resourceGroupName string, gatewayName string, expand GatewayExpandOption) (result GatewayResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, gatewayName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GatewayClient) GetPreparer(resourceGroupName string, gatewayName string, expand GatewayExpandOption) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GatewayClient) GetResponder(resp *http.Response) (result GatewayResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetProfile gets a gateway profile. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum). +func (client GatewayClient) GetProfile(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (<-chan GatewayProfile, <-chan error) { + resultChan := make(chan GatewayProfile, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "GetProfile") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result GatewayProfile + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.GetProfilePreparer(resourceGroupName, gatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "GetProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "GetProfile", resp, "Failure sending request") + return + } + + result, err = client.GetProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "GetProfile", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// GetProfilePreparer prepares the GetProfile request. +func (client GatewayClient) GetProfilePreparer(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/profile", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// GetProfileSender sends the GetProfile request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) GetProfileSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// GetProfileResponder handles the response to the GetProfile request. The method always +// closes the http.Response Body. +func (client GatewayClient) GetProfileResponder(resp *http.Response) (result GatewayProfile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns gateways in a subscription. +func (client GatewayClient) List() (result GatewayResources, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GatewayClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServerManagement/gateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GatewayClient) ListResponder(resp *http.Response) (result GatewayResources, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client GatewayClient) ListNextResults(lastResults GatewayResources) (result GatewayResources, err error) { + req, err := lastResults.GatewayResourcesPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListForResourceGroup returns gateways in a resource group. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. +func (client GatewayClient) ListForResourceGroup(resourceGroupName string) (result GatewayResources, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "ListForResourceGroup") + } + + req, err := client.ListForResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client GatewayClient) ListForResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client GatewayClient) ListForResourceGroupResponder(resp *http.Response) (result GatewayResources, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceGroupNextResults retrieves the next set of results, if any. +func (client GatewayClient) ListForResourceGroupNextResults(lastResults GatewayResources) (result GatewayResources, err error) { + req, err := lastResults.GatewayResourcesPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "ListForResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// RegenerateProfile regenerate a gateway's profile This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum). +func (client GatewayClient) RegenerateProfile(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "RegenerateProfile") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RegenerateProfilePreparer(resourceGroupName, gatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "RegenerateProfile", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateProfileSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "RegenerateProfile", resp, "Failure sending request") + return + } + + result, err = client.RegenerateProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "RegenerateProfile", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RegenerateProfilePreparer prepares the RegenerateProfile request. +func (client GatewayClient) RegenerateProfilePreparer(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/regenerateprofile", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RegenerateProfileSender sends the RegenerateProfile request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) RegenerateProfileSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RegenerateProfileResponder handles the response to the RegenerateProfile request. The method always +// closes the http.Response Body. +func (client GatewayClient) RegenerateProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a gateway belonging to a resource group. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum). gatewayParameters is parameters supplied to +// the Update operation. +func (client GatewayClient) Update(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (<-chan GatewayResource, <-chan error) { + resultChan := make(chan GatewayResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Update") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result GatewayResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, gatewayName, gatewayParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client GatewayClient) UpdatePreparer(resourceGroupName string, gatewayName string, gatewayParameters GatewayParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(gatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GatewayClient) UpdateResponder(resp *http.Response) (result GatewayResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Upgrade upgrades a gateway. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. gatewayName is the gateway +// name (256 characters maximum). +func (client GatewayClient) Upgrade(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: gatewayName, + Constraints: []validation.Constraint{{Target: "gatewayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "gatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "gatewayName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.GatewayClient", "Upgrade") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpgradePreparer(resourceGroupName, gatewayName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Upgrade", nil, "Failure preparing request") + return + } + + resp, err := client.UpgradeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Upgrade", resp, "Failure sending request") + return + } + + result, err = client.UpgradeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.GatewayClient", "Upgrade", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpgradePreparer prepares the Upgrade request. +func (client GatewayClient) UpgradePreparer(resourceGroupName string, gatewayName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/upgradetolatest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpgradeSender sends the Upgrade request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayClient) UpgradeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpgradeResponder handles the response to the Upgrade request. The method always +// closes the http.Response Body. +func (client GatewayClient) UpgradeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/models.go index 7e9fc8c173..8c91d39b3e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/models.go @@ -1,413 +1,413 @@ -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// CredentialDataFormat enumerates the values for credential data format. -type CredentialDataFormat string - -const ( - // RsaEncrypted specifies the rsa encrypted state for credential data - // format. - RsaEncrypted CredentialDataFormat = "RsaEncrypted" -) - -// GatewayExpandOption enumerates the values for gateway expand option. -type GatewayExpandOption string - -const ( - // Download specifies the download state for gateway expand option. - Download GatewayExpandOption = "download" - // Status specifies the status state for gateway expand option. - Status GatewayExpandOption = "status" -) - -// PowerShellExpandOption enumerates the values for power shell expand option. -type PowerShellExpandOption string - -const ( - // Output specifies the output state for power shell expand option. - Output PowerShellExpandOption = "output" -) - -// PromptFieldType enumerates the values for prompt field type. -type PromptFieldType string - -const ( - // Credential specifies the credential state for prompt field type. - Credential PromptFieldType = "Credential" - // SecureString specifies the secure string state for prompt field type. - SecureString PromptFieldType = "SecureString" - // String specifies the string state for prompt field type. - String PromptFieldType = "String" -) - -// RetentionPeriod enumerates the values for retention period. -type RetentionPeriod string - -const ( - // Persistent specifies the persistent state for retention period. - Persistent RetentionPeriod = "Persistent" - // Session specifies the session state for retention period. - Session RetentionPeriod = "Session" -) - -// UpgradeMode enumerates the values for upgrade mode. -type UpgradeMode string - -const ( - // Automatic specifies the automatic state for upgrade mode. - Automatic UpgradeMode = "Automatic" - // Manual specifies the manual state for upgrade mode. - Manual UpgradeMode = "Manual" -) - -// EncryptionJwkResource is the public key of the gateway. -type EncryptionJwkResource struct { - Kty *string `json:"kty,omitempty"` - Alg *string `json:"alg,omitempty"` - E *string `json:"e,omitempty"` - N *string `json:"n,omitempty"` -} - -// Error is error message. -type Error struct { - Code *int32 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Fields *string `json:"fields,omitempty"` -} - -// GatewayParameters is collection of parameters for operations on a gateway -// resource. -type GatewayParameters struct { - Location *string `json:"location,omitempty"` - Tags *map[string]interface{} `json:"tags,omitempty"` - *GatewayParametersProperties `json:"properties,omitempty"` -} - -// GatewayParametersProperties is collection of properties. -type GatewayParametersProperties struct { - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` -} - -// GatewayProfile is jSON properties that the gateway service uses know how to -// communicate with the resource. -type GatewayProfile struct { - autorest.Response `json:"-"` - DataPlaneServiceBaseAddress *string `json:"dataPlaneServiceBaseAddress,omitempty"` - GatewayID *string `json:"gatewayId,omitempty"` - Environment *string `json:"environment,omitempty"` - UpgradeManifestURL *string `json:"upgradeManifestUrl,omitempty"` - MessagingNamespace *string `json:"messagingNamespace,omitempty"` - MessagingAccount *string `json:"messagingAccount,omitempty"` - MessagingKey *string `json:"messagingKey,omitempty"` - RequestQueue *string `json:"requestQueue,omitempty"` - ResponseTopic *string `json:"responseTopic,omitempty"` - StatusBlobSignature *string `json:"statusBlobSignature,omitempty"` -} - -// GatewayResource is data model for an arm gateway resource. -type GatewayResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *GatewayResourceProperties `json:"properties,omitempty"` -} - -// GatewayResourceProperties is collection of properties. -type GatewayResourceProperties struct { - Created *date.Time `json:"created,omitempty"` - Updated *date.Time `json:"updated,omitempty"` - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - DesiredVersion *string `json:"desiredVersion,omitempty"` - Instances *[]GatewayStatus `json:"instances,omitempty"` - ActiveMessageCount *int32 `json:"activeMessageCount,omitempty"` - LatestPublishedMsiVersion *string `json:"latestPublishedMsiVersion,omitempty"` - PublishedTimeUtc *date.Time `json:"publishedTimeUtc,omitempty"` - InstallerDownload *string `json:"installerDownload,omitempty"` - MinimumVersion *string `json:"minimumVersion,omitempty"` -} - -// GatewayResources is collection of Gateway Resources. -type GatewayResources struct { - autorest.Response `json:"-"` - Value *[]GatewayResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// GatewayResourcesPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client GatewayResources) GatewayResourcesPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// GatewayStatus is expanded gateway status information. -type GatewayStatus struct { - AvailableMemoryMByte *float64 `json:"availableMemoryMByte,omitempty"` - GatewayCPUUtilizationPercent *float64 `json:"gatewayCpuUtilizationPercent,omitempty"` - TotalCPUUtilizationPercent *float64 `json:"totalCpuUtilizationPercent,omitempty"` - GatewayVersion *string `json:"gatewayVersion,omitempty"` - FriendlyOsName *string `json:"friendlyOsName,omitempty"` - InstalledDate *date.Time `json:"installedDate,omitempty"` - LogicalProcessorCount *int32 `json:"logicalProcessorCount,omitempty"` - Name *string `json:"name,omitempty"` - GatewayID *string `json:"gatewayId,omitempty"` - GatewayWorkingSetMByte *float64 `json:"gatewayWorkingSetMByte,omitempty"` - StatusUpdated *date.Time `json:"statusUpdated,omitempty"` - GroupPolicyError *string `json:"groupPolicyError,omitempty"` - AllowGatewayGroupPolicyStatus *bool `json:"allowGatewayGroupPolicyStatus,omitempty"` - RequireMfaGroupPolicyStatus *bool `json:"requireMfaGroupPolicyStatus,omitempty"` - EncryptionCertificateThumbprint *string `json:"encryptionCertificateThumbprint,omitempty"` - SecondaryEncryptionCertificateThumbprint *string `json:"secondaryEncryptionCertificateThumbprint,omitempty"` - EncryptionJwk *EncryptionJwkResource `json:"encryptionJwk,omitempty"` - SecondaryEncryptionJwk *EncryptionJwkResource `json:"secondaryEncryptionJwk,omitempty"` - ActiveMessageCount *int32 `json:"activeMessageCount,omitempty"` - LatestPublishedMsiVersion *string `json:"latestPublishedMsiVersion,omitempty"` - PublishedTimeUtc *date.Time `json:"publishedTimeUtc,omitempty"` -} - -// NodeParameters is parameter collection for operations on arm node resource. -type NodeParameters struct { - Location *string `json:"location,omitempty"` - Tags *map[string]interface{} `json:"tags,omitempty"` - *NodeParametersProperties `json:"properties,omitempty"` -} - -// NodeParametersProperties is collection of properties. -type NodeParametersProperties struct { - GatewayID *string `json:"gatewayId,omitempty"` - ConnectionName *string `json:"connectionName,omitempty"` - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` -} - -// NodeResource is a Node Resource. -type NodeResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *NodeResourceProperties `json:"properties,omitempty"` -} - -// NodeResourceProperties is collection of properties. -type NodeResourceProperties struct { - GatewayID *string `json:"gatewayId,omitempty"` - ConnectionName *string `json:"connectionName,omitempty"` - Created *date.Time `json:"created,omitempty"` - Updated *date.Time `json:"updated,omitempty"` -} - -// NodeResources is a collection of node resource objects. -type NodeResources struct { - autorest.Response `json:"-"` - Value *[]NodeResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NodeResourcesPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NodeResources) NodeResourcesPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PowerShellCommandParameters is the parameters to a PowerShell script -// execution command. -type PowerShellCommandParameters struct { - *PowerShellCommandParametersProperties `json:"properties,omitempty"` -} - -// PowerShellCommandParametersProperties is collection of properties. -type PowerShellCommandParametersProperties struct { - Command *string `json:"command,omitempty"` -} - -// PowerShellCommandResult is results from invoking a PowerShell command. -type PowerShellCommandResult struct { - MessageType *int32 `json:"messageType,omitempty"` - ForegroundColor *string `json:"foregroundColor,omitempty"` - BackgroundColor *string `json:"backgroundColor,omitempty"` - Value *string `json:"value,omitempty"` - Prompt *string `json:"prompt,omitempty"` - ExitCode *int32 `json:"exitCode,omitempty"` - ID *int32 `json:"id,omitempty"` - Caption *string `json:"caption,omitempty"` - Message *string `json:"message,omitempty"` - Descriptions *[]PromptFieldDescription `json:"descriptions,omitempty"` -} - -// PowerShellCommandResults is a collection of results from a PowerShell -// command. -type PowerShellCommandResults struct { - autorest.Response `json:"-"` - Results *[]PowerShellCommandResult `json:"results,omitempty"` - Pssession *string `json:"pssession,omitempty"` - Command *string `json:"command,omitempty"` - Completed *bool `json:"completed,omitempty"` -} - -// PowerShellCommandStatus is result status from invoking a PowerShell command. -type PowerShellCommandStatus struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *PowerShellCommandResults `json:"properties,omitempty"` -} - -// PowerShellSessionResource is a PowerShell session resource (practically -// equivalent to a runspace instance). -type PowerShellSessionResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *PowerShellSessionResourceProperties `json:"properties,omitempty"` -} - -// PowerShellSessionResourceProperties is collection of properties. -type PowerShellSessionResourceProperties struct { - SessionID *string `json:"sessionId,omitempty"` - State *string `json:"state,omitempty"` - RunspaceAvailability *string `json:"runspaceAvailability,omitempty"` - DisconnectedOn *date.Time `json:"disconnectedOn,omitempty"` - ExpiresOn *date.Time `json:"expiresOn,omitempty"` - Version *VersionServermanagement `json:"version,omitempty"` - Name *string `json:"name,omitempty"` -} - -// PowerShellSessionResources is a collection of PowerShell session resources -type PowerShellSessionResources struct { - autorest.Response `json:"-"` - Value *[]PowerShellSessionResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PowerShellTabCompletionParameters is collection of parameters for PowerShell -// tab completion. -type PowerShellTabCompletionParameters struct { - Command *string `json:"command,omitempty"` -} - -// PowerShellTabCompletionResults is an array of strings representing the -// different values that can be selected through. -type PowerShellTabCompletionResults struct { - autorest.Response `json:"-"` - Results *[]string `json:"results,omitempty"` -} - -// PromptFieldDescription is field description for the implementation of -// PSHostUserInterface.Prompt -type PromptFieldDescription struct { - Name *string `json:"name,omitempty"` - Label *string `json:"label,omitempty"` - HelpMessage *string `json:"helpMessage,omitempty"` - PromptFieldTypeIsList *bool `json:"promptFieldTypeIsList,omitempty"` - PromptFieldType PromptFieldType `json:"promptFieldType,omitempty"` -} - -// PromptMessageResponse is the response to a prompt message. -type PromptMessageResponse struct { - Response *[]string `json:"response,omitempty"` -} - -// Resource is resource Manager Resource Information. -type Resource struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// SessionParameters is parameter collection for creation and other operations -// on sessions. -type SessionParameters struct { - *SessionParametersProperties `json:"properties,omitempty"` -} - -// SessionParametersProperties is collection of properties -type SessionParametersProperties struct { - UserName *string `json:"userName,omitempty"` - Password *string `json:"password,omitempty"` - RetentionPeriod RetentionPeriod `json:"retentionPeriod,omitempty"` - CredentialDataFormat CredentialDataFormat `json:"credentialDataFormat,omitempty"` - EncryptionCertificateThumbprint *string `json:"EncryptionCertificateThumbprint,omitempty"` -} - -// SessionResource is the session object. -type SessionResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Etag *string `json:"etag,omitempty"` - *SessionResourceProperties `json:"properties,omitempty"` -} - -// SessionResourceProperties is collection of properties. -type SessionResourceProperties struct { - UserName *string `json:"userName,omitempty"` - Created *date.Time `json:"created,omitempty"` - Updated *date.Time `json:"updated,omitempty"` -} - -// VersionServermanagement is a multipart-numeric version number. -type VersionServermanagement struct { - Major *int32 `json:"major,omitempty"` - Minor *int32 `json:"minor,omitempty"` - Build *int32 `json:"build,omitempty"` - Revision *int32 `json:"revision,omitempty"` - MajorRevision *int32 `json:"majorRevision,omitempty"` - MinorRevision *int32 `json:"minorRevision,omitempty"` -} +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// CredentialDataFormat enumerates the values for credential data format. +type CredentialDataFormat string + +const ( + // RsaEncrypted specifies the rsa encrypted state for credential data + // format. + RsaEncrypted CredentialDataFormat = "RsaEncrypted" +) + +// GatewayExpandOption enumerates the values for gateway expand option. +type GatewayExpandOption string + +const ( + // Download specifies the download state for gateway expand option. + Download GatewayExpandOption = "download" + // Status specifies the status state for gateway expand option. + Status GatewayExpandOption = "status" +) + +// PowerShellExpandOption enumerates the values for power shell expand option. +type PowerShellExpandOption string + +const ( + // Output specifies the output state for power shell expand option. + Output PowerShellExpandOption = "output" +) + +// PromptFieldType enumerates the values for prompt field type. +type PromptFieldType string + +const ( + // Credential specifies the credential state for prompt field type. + Credential PromptFieldType = "Credential" + // SecureString specifies the secure string state for prompt field type. + SecureString PromptFieldType = "SecureString" + // String specifies the string state for prompt field type. + String PromptFieldType = "String" +) + +// RetentionPeriod enumerates the values for retention period. +type RetentionPeriod string + +const ( + // Persistent specifies the persistent state for retention period. + Persistent RetentionPeriod = "Persistent" + // Session specifies the session state for retention period. + Session RetentionPeriod = "Session" +) + +// UpgradeMode enumerates the values for upgrade mode. +type UpgradeMode string + +const ( + // Automatic specifies the automatic state for upgrade mode. + Automatic UpgradeMode = "Automatic" + // Manual specifies the manual state for upgrade mode. + Manual UpgradeMode = "Manual" +) + +// EncryptionJwkResource is the public key of the gateway. +type EncryptionJwkResource struct { + Kty *string `json:"kty,omitempty"` + Alg *string `json:"alg,omitempty"` + E *string `json:"e,omitempty"` + N *string `json:"n,omitempty"` +} + +// Error is error message. +type Error struct { + Code *int32 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Fields *string `json:"fields,omitempty"` +} + +// GatewayParameters is collection of parameters for operations on a gateway +// resource. +type GatewayParameters struct { + Location *string `json:"location,omitempty"` + Tags *map[string]interface{} `json:"tags,omitempty"` + *GatewayParametersProperties `json:"properties,omitempty"` +} + +// GatewayParametersProperties is collection of properties. +type GatewayParametersProperties struct { + UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` +} + +// GatewayProfile is jSON properties that the gateway service uses know how to +// communicate with the resource. +type GatewayProfile struct { + autorest.Response `json:"-"` + DataPlaneServiceBaseAddress *string `json:"dataPlaneServiceBaseAddress,omitempty"` + GatewayID *string `json:"gatewayId,omitempty"` + Environment *string `json:"environment,omitempty"` + UpgradeManifestURL *string `json:"upgradeManifestUrl,omitempty"` + MessagingNamespace *string `json:"messagingNamespace,omitempty"` + MessagingAccount *string `json:"messagingAccount,omitempty"` + MessagingKey *string `json:"messagingKey,omitempty"` + RequestQueue *string `json:"requestQueue,omitempty"` + ResponseTopic *string `json:"responseTopic,omitempty"` + StatusBlobSignature *string `json:"statusBlobSignature,omitempty"` +} + +// GatewayResource is data model for an arm gateway resource. +type GatewayResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *GatewayResourceProperties `json:"properties,omitempty"` +} + +// GatewayResourceProperties is collection of properties. +type GatewayResourceProperties struct { + Created *date.Time `json:"created,omitempty"` + Updated *date.Time `json:"updated,omitempty"` + UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` + DesiredVersion *string `json:"desiredVersion,omitempty"` + Instances *[]GatewayStatus `json:"instances,omitempty"` + ActiveMessageCount *int32 `json:"activeMessageCount,omitempty"` + LatestPublishedMsiVersion *string `json:"latestPublishedMsiVersion,omitempty"` + PublishedTimeUtc *date.Time `json:"publishedTimeUtc,omitempty"` + InstallerDownload *string `json:"installerDownload,omitempty"` + MinimumVersion *string `json:"minimumVersion,omitempty"` +} + +// GatewayResources is collection of Gateway Resources. +type GatewayResources struct { + autorest.Response `json:"-"` + Value *[]GatewayResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayResourcesPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client GatewayResources) GatewayResourcesPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// GatewayStatus is expanded gateway status information. +type GatewayStatus struct { + AvailableMemoryMByte *float64 `json:"availableMemoryMByte,omitempty"` + GatewayCPUUtilizationPercent *float64 `json:"gatewayCpuUtilizationPercent,omitempty"` + TotalCPUUtilizationPercent *float64 `json:"totalCpuUtilizationPercent,omitempty"` + GatewayVersion *string `json:"gatewayVersion,omitempty"` + FriendlyOsName *string `json:"friendlyOsName,omitempty"` + InstalledDate *date.Time `json:"installedDate,omitempty"` + LogicalProcessorCount *int32 `json:"logicalProcessorCount,omitempty"` + Name *string `json:"name,omitempty"` + GatewayID *string `json:"gatewayId,omitempty"` + GatewayWorkingSetMByte *float64 `json:"gatewayWorkingSetMByte,omitempty"` + StatusUpdated *date.Time `json:"statusUpdated,omitempty"` + GroupPolicyError *string `json:"groupPolicyError,omitempty"` + AllowGatewayGroupPolicyStatus *bool `json:"allowGatewayGroupPolicyStatus,omitempty"` + RequireMfaGroupPolicyStatus *bool `json:"requireMfaGroupPolicyStatus,omitempty"` + EncryptionCertificateThumbprint *string `json:"encryptionCertificateThumbprint,omitempty"` + SecondaryEncryptionCertificateThumbprint *string `json:"secondaryEncryptionCertificateThumbprint,omitempty"` + EncryptionJwk *EncryptionJwkResource `json:"encryptionJwk,omitempty"` + SecondaryEncryptionJwk *EncryptionJwkResource `json:"secondaryEncryptionJwk,omitempty"` + ActiveMessageCount *int32 `json:"activeMessageCount,omitempty"` + LatestPublishedMsiVersion *string `json:"latestPublishedMsiVersion,omitempty"` + PublishedTimeUtc *date.Time `json:"publishedTimeUtc,omitempty"` +} + +// NodeParameters is parameter collection for operations on arm node resource. +type NodeParameters struct { + Location *string `json:"location,omitempty"` + Tags *map[string]interface{} `json:"tags,omitempty"` + *NodeParametersProperties `json:"properties,omitempty"` +} + +// NodeParametersProperties is collection of properties. +type NodeParametersProperties struct { + GatewayID *string `json:"gatewayId,omitempty"` + ConnectionName *string `json:"connectionName,omitempty"` + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` +} + +// NodeResource is a Node Resource. +type NodeResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *NodeResourceProperties `json:"properties,omitempty"` +} + +// NodeResourceProperties is collection of properties. +type NodeResourceProperties struct { + GatewayID *string `json:"gatewayId,omitempty"` + ConnectionName *string `json:"connectionName,omitempty"` + Created *date.Time `json:"created,omitempty"` + Updated *date.Time `json:"updated,omitempty"` +} + +// NodeResources is a collection of node resource objects. +type NodeResources struct { + autorest.Response `json:"-"` + Value *[]NodeResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NodeResourcesPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NodeResources) NodeResourcesPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PowerShellCommandParameters is the parameters to a PowerShell script +// execution command. +type PowerShellCommandParameters struct { + *PowerShellCommandParametersProperties `json:"properties,omitempty"` +} + +// PowerShellCommandParametersProperties is collection of properties. +type PowerShellCommandParametersProperties struct { + Command *string `json:"command,omitempty"` +} + +// PowerShellCommandResult is results from invoking a PowerShell command. +type PowerShellCommandResult struct { + MessageType *int32 `json:"messageType,omitempty"` + ForegroundColor *string `json:"foregroundColor,omitempty"` + BackgroundColor *string `json:"backgroundColor,omitempty"` + Value *string `json:"value,omitempty"` + Prompt *string `json:"prompt,omitempty"` + ExitCode *int32 `json:"exitCode,omitempty"` + ID *int32 `json:"id,omitempty"` + Caption *string `json:"caption,omitempty"` + Message *string `json:"message,omitempty"` + Descriptions *[]PromptFieldDescription `json:"descriptions,omitempty"` +} + +// PowerShellCommandResults is a collection of results from a PowerShell +// command. +type PowerShellCommandResults struct { + autorest.Response `json:"-"` + Results *[]PowerShellCommandResult `json:"results,omitempty"` + Pssession *string `json:"pssession,omitempty"` + Command *string `json:"command,omitempty"` + Completed *bool `json:"completed,omitempty"` +} + +// PowerShellCommandStatus is result status from invoking a PowerShell command. +type PowerShellCommandStatus struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *PowerShellCommandResults `json:"properties,omitempty"` +} + +// PowerShellSessionResource is a PowerShell session resource (practically +// equivalent to a runspace instance). +type PowerShellSessionResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *PowerShellSessionResourceProperties `json:"properties,omitempty"` +} + +// PowerShellSessionResourceProperties is collection of properties. +type PowerShellSessionResourceProperties struct { + SessionID *string `json:"sessionId,omitempty"` + State *string `json:"state,omitempty"` + RunspaceAvailability *string `json:"runspaceAvailability,omitempty"` + DisconnectedOn *date.Time `json:"disconnectedOn,omitempty"` + ExpiresOn *date.Time `json:"expiresOn,omitempty"` + Version *VersionServermanagement `json:"version,omitempty"` + Name *string `json:"name,omitempty"` +} + +// PowerShellSessionResources is a collection of PowerShell session resources +type PowerShellSessionResources struct { + autorest.Response `json:"-"` + Value *[]PowerShellSessionResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PowerShellTabCompletionParameters is collection of parameters for PowerShell +// tab completion. +type PowerShellTabCompletionParameters struct { + Command *string `json:"command,omitempty"` +} + +// PowerShellTabCompletionResults is an array of strings representing the +// different values that can be selected through. +type PowerShellTabCompletionResults struct { + autorest.Response `json:"-"` + Results *[]string `json:"results,omitempty"` +} + +// PromptFieldDescription is field description for the implementation of +// PSHostUserInterface.Prompt +type PromptFieldDescription struct { + Name *string `json:"name,omitempty"` + Label *string `json:"label,omitempty"` + HelpMessage *string `json:"helpMessage,omitempty"` + PromptFieldTypeIsList *bool `json:"promptFieldTypeIsList,omitempty"` + PromptFieldType PromptFieldType `json:"promptFieldType,omitempty"` +} + +// PromptMessageResponse is the response to a prompt message. +type PromptMessageResponse struct { + Response *[]string `json:"response,omitempty"` +} + +// Resource is resource Manager Resource Information. +type Resource struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// SessionParameters is parameter collection for creation and other operations +// on sessions. +type SessionParameters struct { + *SessionParametersProperties `json:"properties,omitempty"` +} + +// SessionParametersProperties is collection of properties +type SessionParametersProperties struct { + UserName *string `json:"userName,omitempty"` + Password *string `json:"password,omitempty"` + RetentionPeriod RetentionPeriod `json:"retentionPeriod,omitempty"` + CredentialDataFormat CredentialDataFormat `json:"credentialDataFormat,omitempty"` + EncryptionCertificateThumbprint *string `json:"EncryptionCertificateThumbprint,omitempty"` +} + +// SessionResource is the session object. +type SessionResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Etag *string `json:"etag,omitempty"` + *SessionResourceProperties `json:"properties,omitempty"` +} + +// SessionResourceProperties is collection of properties. +type SessionResourceProperties struct { + UserName *string `json:"userName,omitempty"` + Created *date.Time `json:"created,omitempty"` + Updated *date.Time `json:"updated,omitempty"` +} + +// VersionServermanagement is a multipart-numeric version number. +type VersionServermanagement struct { + Major *int32 `json:"major,omitempty"` + Minor *int32 `json:"minor,omitempty"` + Build *int32 `json:"build,omitempty"` + Revision *int32 `json:"revision,omitempty"` + MajorRevision *int32 `json:"majorRevision,omitempty"` + MinorRevision *int32 `json:"minorRevision,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/node.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/node.go index ac592e8529..7970bb70a2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/node.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/node.go @@ -1,576 +1,576 @@ -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NodeClient is the rEST API for Azure Server Management Service. -type NodeClient struct { - ManagementClient -} - -// NewNodeClient creates an instance of the NodeClient client. -func NewNodeClient(subscriptionID string) NodeClient { - return NewNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNodeClientWithBaseURI creates an instance of the NodeClient client. -func NewNodeClientWithBaseURI(baseURI string, subscriptionID string) NodeClient { - return NodeClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates or updates a management node. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). gatewayParameters is parameters supplied to the -// CreateOrUpdate operation. -func (client NodeClient) Create(resourceGroupName string, nodeName string, gatewayParameters NodeParameters, cancel <-chan struct{}) (<-chan NodeResource, <-chan error) { - resultChan := make(chan NodeResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result NodeResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, nodeName, gatewayParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client NodeClient) CreatePreparer(resourceGroupName string, nodeName string, gatewayParameters NodeParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), - autorest.WithJSON(gatewayParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client NodeClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client NodeClient) CreateResponder(resp *http.Response) (result NodeResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a management node -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). -func (client NodeClient) Delete(resourceGroupName string, nodeName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NodeClient) DeletePreparer(resourceGroupName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NodeClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NodeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a management node. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). -func (client NodeClient) Get(resourceGroupName string, nodeName string) (result NodeResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, nodeName) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NodeClient) GetPreparer(resourceGroupName string, nodeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NodeClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NodeClient) GetResponder(resp *http.Response) (result NodeResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists nodes in a subscription. -func (client NodeClient) List() (result NodeResources, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client NodeClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServerManagement/nodes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NodeClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NodeClient) ListResponder(resp *http.Response) (result NodeResources, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client NodeClient) ListNextResults(lastResults NodeResources) (result NodeResources, err error) { - req, err := lastResults.NodeResourcesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListForResourceGroup lists nodes in a resource group. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. -func (client NodeClient) ListForResourceGroup(resourceGroupName string) (result NodeResources, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "ListForResourceGroup") - } - - req, err := client.ListForResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client NodeClient) ListForResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NodeClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client NodeClient) ListForResourceGroupResponder(resp *http.Response) (result NodeResources, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListForResourceGroupNextResults retrieves the next set of results, if any. -func (client NodeClient) ListForResourceGroupNextResults(lastResults NodeResources) (result NodeResources, err error) { - req, err := lastResults.NodeResourcesPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update updates a management node. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). nodeParameters is parameters supplied to the -// CreateOrUpdate operation. -func (client NodeClient) Update(resourceGroupName string, nodeName string, nodeParameters NodeParameters, cancel <-chan struct{}) (<-chan NodeResource, <-chan error) { - resultChan := make(chan NodeResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Update") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result NodeResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, nodeName, nodeParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client NodeClient) UpdatePreparer(resourceGroupName string, nodeName string, nodeParameters NodeParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), - autorest.WithJSON(nodeParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NodeClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NodeClient) UpdateResponder(resp *http.Response) (result NodeResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NodeClient is the rEST API for Azure Server Management Service. +type NodeClient struct { + ManagementClient +} + +// NewNodeClient creates an instance of the NodeClient client. +func NewNodeClient(subscriptionID string) NodeClient { + return NewNodeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNodeClientWithBaseURI creates an instance of the NodeClient client. +func NewNodeClientWithBaseURI(baseURI string, subscriptionID string) NodeClient { + return NodeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates or updates a management node. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). gatewayParameters is parameters supplied to the +// CreateOrUpdate operation. +func (client NodeClient) Create(resourceGroupName string, nodeName string, gatewayParameters NodeParameters, cancel <-chan struct{}) (<-chan NodeResource, <-chan error) { + resultChan := make(chan NodeResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result NodeResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, nodeName, gatewayParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client NodeClient) CreatePreparer(resourceGroupName string, nodeName string, gatewayParameters NodeParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), + autorest.WithJSON(gatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client NodeClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client NodeClient) CreateResponder(resp *http.Response) (result NodeResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a management node +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). +func (client NodeClient) Delete(resourceGroupName string, nodeName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, nodeName) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NodeClient) DeletePreparer(resourceGroupName string, nodeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NodeClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NodeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a management node. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). +func (client NodeClient) Get(resourceGroupName string, nodeName string) (result NodeResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, nodeName) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NodeClient) GetPreparer(resourceGroupName string, nodeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NodeClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NodeClient) GetResponder(resp *http.Response) (result NodeResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists nodes in a subscription. +func (client NodeClient) List() (result NodeResources, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client NodeClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServerManagement/nodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NodeClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NodeClient) ListResponder(resp *http.Response) (result NodeResources, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client NodeClient) ListNextResults(lastResults NodeResources) (result NodeResources, err error) { + req, err := lastResults.NodeResourcesPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListForResourceGroup lists nodes in a resource group. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. +func (client NodeClient) ListForResourceGroup(resourceGroupName string) (result NodeResources, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "ListForResourceGroup") + } + + req, err := client.ListForResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client NodeClient) ListForResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client NodeClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client NodeClient) ListForResourceGroupResponder(resp *http.Response) (result NodeResources, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResourceGroupNextResults retrieves the next set of results, if any. +func (client NodeClient) ListForResourceGroupNextResults(lastResults NodeResources) (result NodeResources, err error) { + req, err := lastResults.NodeResourcesPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "ListForResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update updates a management node. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). nodeParameters is parameters supplied to the +// CreateOrUpdate operation. +func (client NodeClient) Update(resourceGroupName string, nodeName string, nodeParameters NodeParameters, cancel <-chan struct{}) (<-chan NodeResource, <-chan error) { + resultChan := make(chan NodeResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.NodeClient", "Update") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result NodeResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, nodeName, nodeParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.NodeClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client NodeClient) UpdatePreparer(resourceGroupName string, nodeName string, nodeParameters NodeParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", pathParameters), + autorest.WithJSON(nodeParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NodeClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NodeClient) UpdateResponder(resp *http.Response) (result NodeResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/powershell.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/powershell.go index c5fab522d7..f9653b15d5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/powershell.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/powershell.go @@ -1,693 +1,693 @@ -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PowerShellClient is the rEST API for Azure Server Management Service. -type PowerShellClient struct { - ManagementClient -} - -// NewPowerShellClient creates an instance of the PowerShellClient client. -func NewPowerShellClient(subscriptionID string) PowerShellClient { - return NewPowerShellClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPowerShellClientWithBaseURI creates an instance of the PowerShellClient -// client. -func NewPowerShellClientWithBaseURI(baseURI string, subscriptionID string) PowerShellClient { - return PowerShellClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CancelCommand cancels a PowerShell command. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. pssession -// is the PowerShell sessionId from the user. -func (client PowerShellClient) CancelCommand(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (<-chan PowerShellCommandResults, <-chan error) { - resultChan := make(chan PowerShellCommandResults, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "CancelCommand") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result PowerShellCommandResults - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CancelCommandPreparer(resourceGroupName, nodeName, session, pssession, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CancelCommand", nil, "Failure preparing request") - return - } - - resp, err := client.CancelCommandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CancelCommand", resp, "Failure sending request") - return - } - - result, err = client.CancelCommandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CancelCommand", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CancelCommandPreparer prepares the CancelCommand request. -func (client PowerShellClient) CancelCommandPreparer(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "pssession": autorest.Encode("path", pssession), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CancelCommandSender sends the CancelCommand request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) CancelCommandSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CancelCommandResponder handles the response to the CancelCommand request. The method always -// closes the http.Response Body. -func (client PowerShellClient) CancelCommandResponder(resp *http.Response) (result PowerShellCommandResults, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateSession creates a PowerShell session. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. pssession -// is the PowerShell sessionId from the user. -func (client PowerShellClient) CreateSession(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (<-chan PowerShellSessionResource, <-chan error) { - resultChan := make(chan PowerShellSessionResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "CreateSession") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result PowerShellSessionResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateSessionPreparer(resourceGroupName, nodeName, session, pssession, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CreateSession", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSessionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CreateSession", resp, "Failure sending request") - return - } - - result, err = client.CreateSessionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CreateSession", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateSessionPreparer prepares the CreateSession request. -func (client PowerShellClient) CreateSessionPreparer(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "pssession": autorest.Encode("path", pssession), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSessionSender sends the CreateSession request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) CreateSessionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateSessionResponder handles the response to the CreateSession request. The method always -// closes the http.Response Body. -func (client PowerShellClient) CreateSessionResponder(resp *http.Response) (result PowerShellSessionResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCommandStatus gets the status of a command. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. pssession -// is the PowerShell sessionId from the user. expand is gets current output -// from an ongoing call. -func (client PowerShellClient) GetCommandStatus(resourceGroupName string, nodeName string, session string, pssession string, expand PowerShellExpandOption) (result PowerShellCommandStatus, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "GetCommandStatus") - } - - req, err := client.GetCommandStatusPreparer(resourceGroupName, nodeName, session, pssession, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "GetCommandStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetCommandStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "GetCommandStatus", resp, "Failure sending request") - return - } - - result, err = client.GetCommandStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "GetCommandStatus", resp, "Failure responding to request") - } - - return -} - -// GetCommandStatusPreparer prepares the GetCommandStatus request. -func (client PowerShellClient) GetCommandStatusPreparer(resourceGroupName string, nodeName string, session string, pssession string, expand PowerShellExpandOption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "pssession": autorest.Encode("path", pssession), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(expand)) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCommandStatusSender sends the GetCommandStatus request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) GetCommandStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCommandStatusResponder handles the response to the GetCommandStatus request. The method always -// closes the http.Response Body. -func (client PowerShellClient) GetCommandStatusResponder(resp *http.Response) (result PowerShellCommandStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// InvokeCommand creates a PowerShell script and invokes it. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. pssession -// is the PowerShell sessionId from the user. powerShellCommandParameters is -// parameters supplied to the Invoke PowerShell Command operation. -func (client PowerShellClient) InvokeCommand(resourceGroupName string, nodeName string, session string, pssession string, powerShellCommandParameters PowerShellCommandParameters, cancel <-chan struct{}) (<-chan PowerShellCommandResults, <-chan error) { - resultChan := make(chan PowerShellCommandResults, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "InvokeCommand") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result PowerShellCommandResults - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.InvokeCommandPreparer(resourceGroupName, nodeName, session, pssession, powerShellCommandParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "InvokeCommand", nil, "Failure preparing request") - return - } - - resp, err := client.InvokeCommandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "InvokeCommand", resp, "Failure sending request") - return - } - - result, err = client.InvokeCommandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "InvokeCommand", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// InvokeCommandPreparer prepares the InvokeCommand request. -func (client PowerShellClient) InvokeCommandPreparer(resourceGroupName string, nodeName string, session string, pssession string, powerShellCommandParameters PowerShellCommandParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "pssession": autorest.Encode("path", pssession), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/invokeCommand", pathParameters), - autorest.WithJSON(powerShellCommandParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// InvokeCommandSender sends the InvokeCommand request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) InvokeCommandSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// InvokeCommandResponder handles the response to the InvokeCommand request. The method always -// closes the http.Response Body. -func (client PowerShellClient) InvokeCommandResponder(resp *http.Response) (result PowerShellCommandResults, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSession gets a list of the active sessions. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. -func (client PowerShellClient) ListSession(resourceGroupName string, nodeName string, session string) (result PowerShellSessionResources, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "ListSession") - } - - req, err := client.ListSessionPreparer(resourceGroupName, nodeName, session) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "ListSession", nil, "Failure preparing request") - return - } - - resp, err := client.ListSessionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "ListSession", resp, "Failure sending request") - return - } - - result, err = client.ListSessionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "ListSession", resp, "Failure responding to request") - } - - return -} - -// ListSessionPreparer prepares the ListSession request. -func (client PowerShellClient) ListSessionPreparer(resourceGroupName string, nodeName string, session string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSessionSender sends the ListSession request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) ListSessionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSessionResponder handles the response to the ListSession request. The method always -// closes the http.Response Body. -func (client PowerShellClient) ListSessionResponder(resp *http.Response) (result PowerShellSessionResources, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// TabCompletion gets tab completion values for a command. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. pssession -// is the PowerShell sessionId from the user. powerShellTabCompletionParamters -// is parameters supplied to the tab completion call. -func (client PowerShellClient) TabCompletion(resourceGroupName string, nodeName string, session string, pssession string, powerShellTabCompletionParamters PowerShellTabCompletionParameters) (result PowerShellTabCompletionResults, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "TabCompletion") - } - - req, err := client.TabCompletionPreparer(resourceGroupName, nodeName, session, pssession, powerShellTabCompletionParamters) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "TabCompletion", nil, "Failure preparing request") - return - } - - resp, err := client.TabCompletionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "TabCompletion", resp, "Failure sending request") - return - } - - result, err = client.TabCompletionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "TabCompletion", resp, "Failure responding to request") - } - - return -} - -// TabCompletionPreparer prepares the TabCompletion request. -func (client PowerShellClient) TabCompletionPreparer(resourceGroupName string, nodeName string, session string, pssession string, powerShellTabCompletionParamters PowerShellTabCompletionParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "pssession": autorest.Encode("path", pssession), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/tab", pathParameters), - autorest.WithJSON(powerShellTabCompletionParamters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// TabCompletionSender sends the TabCompletion request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) TabCompletionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// TabCompletionResponder handles the response to the TabCompletion request. The method always -// closes the http.Response Body. -func (client PowerShellClient) TabCompletionResponder(resp *http.Response) (result PowerShellTabCompletionResults, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCommand updates a running PowerShell command with more data. This -// method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. pssession -// is the PowerShell sessionId from the user. -func (client PowerShellClient) UpdateCommand(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (<-chan PowerShellCommandResults, <-chan error) { - resultChan := make(chan PowerShellCommandResults, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "UpdateCommand") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result PowerShellCommandResults - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdateCommandPreparer(resourceGroupName, nodeName, session, pssession, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "UpdateCommand", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateCommandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "UpdateCommand", resp, "Failure sending request") - return - } - - result, err = client.UpdateCommandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "UpdateCommand", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdateCommandPreparer prepares the UpdateCommand request. -func (client PowerShellClient) UpdateCommandPreparer(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "pssession": autorest.Encode("path", pssession), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateCommandSender sends the UpdateCommand request. The method will close the -// http.Response Body if it receives an error. -func (client PowerShellClient) UpdateCommandSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateCommandResponder handles the response to the UpdateCommand request. The method always -// closes the http.Response Body. -func (client PowerShellClient) UpdateCommandResponder(resp *http.Response) (result PowerShellCommandResults, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PowerShellClient is the rEST API for Azure Server Management Service. +type PowerShellClient struct { + ManagementClient +} + +// NewPowerShellClient creates an instance of the PowerShellClient client. +func NewPowerShellClient(subscriptionID string) PowerShellClient { + return NewPowerShellClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPowerShellClientWithBaseURI creates an instance of the PowerShellClient +// client. +func NewPowerShellClientWithBaseURI(baseURI string, subscriptionID string) PowerShellClient { + return PowerShellClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CancelCommand cancels a PowerShell command. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. pssession +// is the PowerShell sessionId from the user. +func (client PowerShellClient) CancelCommand(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (<-chan PowerShellCommandResults, <-chan error) { + resultChan := make(chan PowerShellCommandResults, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "CancelCommand") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result PowerShellCommandResults + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CancelCommandPreparer(resourceGroupName, nodeName, session, pssession, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CancelCommand", nil, "Failure preparing request") + return + } + + resp, err := client.CancelCommandSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CancelCommand", resp, "Failure sending request") + return + } + + result, err = client.CancelCommandResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CancelCommand", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CancelCommandPreparer prepares the CancelCommand request. +func (client PowerShellClient) CancelCommandPreparer(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "pssession": autorest.Encode("path", pssession), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CancelCommandSender sends the CancelCommand request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) CancelCommandSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CancelCommandResponder handles the response to the CancelCommand request. The method always +// closes the http.Response Body. +func (client PowerShellClient) CancelCommandResponder(resp *http.Response) (result PowerShellCommandResults, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateSession creates a PowerShell session. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. pssession +// is the PowerShell sessionId from the user. +func (client PowerShellClient) CreateSession(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (<-chan PowerShellSessionResource, <-chan error) { + resultChan := make(chan PowerShellSessionResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "CreateSession") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result PowerShellSessionResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateSessionPreparer(resourceGroupName, nodeName, session, pssession, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CreateSession", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSessionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CreateSession", resp, "Failure sending request") + return + } + + result, err = client.CreateSessionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "CreateSession", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateSessionPreparer prepares the CreateSession request. +func (client PowerShellClient) CreateSessionPreparer(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "pssession": autorest.Encode("path", pssession), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSessionSender sends the CreateSession request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) CreateSessionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateSessionResponder handles the response to the CreateSession request. The method always +// closes the http.Response Body. +func (client PowerShellClient) CreateSessionResponder(resp *http.Response) (result PowerShellSessionResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCommandStatus gets the status of a command. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. pssession +// is the PowerShell sessionId from the user. expand is gets current output +// from an ongoing call. +func (client PowerShellClient) GetCommandStatus(resourceGroupName string, nodeName string, session string, pssession string, expand PowerShellExpandOption) (result PowerShellCommandStatus, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "GetCommandStatus") + } + + req, err := client.GetCommandStatusPreparer(resourceGroupName, nodeName, session, pssession, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "GetCommandStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetCommandStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "GetCommandStatus", resp, "Failure sending request") + return + } + + result, err = client.GetCommandStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "GetCommandStatus", resp, "Failure responding to request") + } + + return +} + +// GetCommandStatusPreparer prepares the GetCommandStatus request. +func (client PowerShellClient) GetCommandStatusPreparer(resourceGroupName string, nodeName string, session string, pssession string, expand PowerShellExpandOption) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "pssession": autorest.Encode("path", pssession), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCommandStatusSender sends the GetCommandStatus request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) GetCommandStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCommandStatusResponder handles the response to the GetCommandStatus request. The method always +// closes the http.Response Body. +func (client PowerShellClient) GetCommandStatusResponder(resp *http.Response) (result PowerShellCommandStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// InvokeCommand creates a PowerShell script and invokes it. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. pssession +// is the PowerShell sessionId from the user. powerShellCommandParameters is +// parameters supplied to the Invoke PowerShell Command operation. +func (client PowerShellClient) InvokeCommand(resourceGroupName string, nodeName string, session string, pssession string, powerShellCommandParameters PowerShellCommandParameters, cancel <-chan struct{}) (<-chan PowerShellCommandResults, <-chan error) { + resultChan := make(chan PowerShellCommandResults, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "InvokeCommand") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result PowerShellCommandResults + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.InvokeCommandPreparer(resourceGroupName, nodeName, session, pssession, powerShellCommandParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "InvokeCommand", nil, "Failure preparing request") + return + } + + resp, err := client.InvokeCommandSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "InvokeCommand", resp, "Failure sending request") + return + } + + result, err = client.InvokeCommandResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "InvokeCommand", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// InvokeCommandPreparer prepares the InvokeCommand request. +func (client PowerShellClient) InvokeCommandPreparer(resourceGroupName string, nodeName string, session string, pssession string, powerShellCommandParameters PowerShellCommandParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "pssession": autorest.Encode("path", pssession), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/invokeCommand", pathParameters), + autorest.WithJSON(powerShellCommandParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// InvokeCommandSender sends the InvokeCommand request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) InvokeCommandSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// InvokeCommandResponder handles the response to the InvokeCommand request. The method always +// closes the http.Response Body. +func (client PowerShellClient) InvokeCommandResponder(resp *http.Response) (result PowerShellCommandResults, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSession gets a list of the active sessions. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. +func (client PowerShellClient) ListSession(resourceGroupName string, nodeName string, session string) (result PowerShellSessionResources, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "ListSession") + } + + req, err := client.ListSessionPreparer(resourceGroupName, nodeName, session) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "ListSession", nil, "Failure preparing request") + return + } + + resp, err := client.ListSessionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "ListSession", resp, "Failure sending request") + return + } + + result, err = client.ListSessionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "ListSession", resp, "Failure responding to request") + } + + return +} + +// ListSessionPreparer prepares the ListSession request. +func (client PowerShellClient) ListSessionPreparer(resourceGroupName string, nodeName string, session string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSessionSender sends the ListSession request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) ListSessionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSessionResponder handles the response to the ListSession request. The method always +// closes the http.Response Body. +func (client PowerShellClient) ListSessionResponder(resp *http.Response) (result PowerShellSessionResources, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// TabCompletion gets tab completion values for a command. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. pssession +// is the PowerShell sessionId from the user. powerShellTabCompletionParamters +// is parameters supplied to the tab completion call. +func (client PowerShellClient) TabCompletion(resourceGroupName string, nodeName string, session string, pssession string, powerShellTabCompletionParamters PowerShellTabCompletionParameters) (result PowerShellTabCompletionResults, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "TabCompletion") + } + + req, err := client.TabCompletionPreparer(resourceGroupName, nodeName, session, pssession, powerShellTabCompletionParamters) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "TabCompletion", nil, "Failure preparing request") + return + } + + resp, err := client.TabCompletionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "TabCompletion", resp, "Failure sending request") + return + } + + result, err = client.TabCompletionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "TabCompletion", resp, "Failure responding to request") + } + + return +} + +// TabCompletionPreparer prepares the TabCompletion request. +func (client PowerShellClient) TabCompletionPreparer(resourceGroupName string, nodeName string, session string, pssession string, powerShellTabCompletionParamters PowerShellTabCompletionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "pssession": autorest.Encode("path", pssession), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/tab", pathParameters), + autorest.WithJSON(powerShellTabCompletionParamters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// TabCompletionSender sends the TabCompletion request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) TabCompletionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// TabCompletionResponder handles the response to the TabCompletion request. The method always +// closes the http.Response Body. +func (client PowerShellClient) TabCompletionResponder(resp *http.Response) (result PowerShellTabCompletionResults, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCommand updates a running PowerShell command with more data. This +// method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. pssession +// is the PowerShell sessionId from the user. +func (client PowerShellClient) UpdateCommand(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (<-chan PowerShellCommandResults, <-chan error) { + resultChan := make(chan PowerShellCommandResults, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.PowerShellClient", "UpdateCommand") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result PowerShellCommandResults + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdateCommandPreparer(resourceGroupName, nodeName, session, pssession, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "UpdateCommand", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCommandSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "UpdateCommand", resp, "Failure sending request") + return + } + + result, err = client.UpdateCommandResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.PowerShellClient", "UpdateCommand", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdateCommandPreparer prepares the UpdateCommand request. +func (client PowerShellClient) UpdateCommandPreparer(resourceGroupName string, nodeName string, session string, pssession string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "pssession": autorest.Encode("path", pssession), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateCommandSender sends the UpdateCommand request. The method will close the +// http.Response Body if it receives an error. +func (client PowerShellClient) UpdateCommandSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateCommandResponder handles the response to the UpdateCommand request. The method always +// closes the http.Response Body. +func (client PowerShellClient) UpdateCommandResponder(resp *http.Response) (result PowerShellCommandResults, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/session.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/session.go index ea5c074915..9c825e67ac 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/session.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/session.go @@ -1,298 +1,298 @@ -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SessionClient is the rEST API for Azure Server Management Service. -type SessionClient struct { - ManagementClient -} - -// NewSessionClient creates an instance of the SessionClient client. -func NewSessionClient(subscriptionID string) SessionClient { - return NewSessionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSessionClientWithBaseURI creates an instance of the SessionClient client. -func NewSessionClientWithBaseURI(baseURI string, subscriptionID string) SessionClient { - return SessionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a session for a node. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. -// sessionParameters is parameters supplied to the CreateOrUpdate operation. -func (client SessionClient) Create(resourceGroupName string, nodeName string, session string, sessionParameters SessionParameters, cancel <-chan struct{}) (<-chan SessionResource, <-chan error) { - resultChan := make(chan SessionResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servermanagement.SessionClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result SessionResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, nodeName, session, sessionParameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client SessionClient) CreatePreparer(resourceGroupName string, nodeName string, session string, sessionParameters SessionParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", pathParameters), - autorest.WithJSON(sessionParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SessionClient) CreateResponder(resp *http.Response) (result SessionResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a session for a node. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. -func (client SessionClient) Delete(resourceGroupName string, nodeName string, session string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.SessionClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, nodeName, session) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SessionClient) DeletePreparer(resourceGroupName string, nodeName string, session string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SessionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a session for a node. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscriptionId. nodeName is the node name -// (256 characters maximum). session is the sessionId from the user. -func (client SessionClient) Get(resourceGroupName string, nodeName string, session string) (result SessionResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, - {TargetValue: nodeName, - Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servermanagement.SessionClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, nodeName, session) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SessionClient) GetPreparer(resourceGroupName string, nodeName string, session string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nodeName": autorest.Encode("path", nodeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "session": autorest.Encode("path", session), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SessionClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SessionClient) GetResponder(resp *http.Response) (result SessionResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SessionClient is the rEST API for Azure Server Management Service. +type SessionClient struct { + ManagementClient +} + +// NewSessionClient creates an instance of the SessionClient client. +func NewSessionClient(subscriptionID string) SessionClient { + return NewSessionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSessionClientWithBaseURI creates an instance of the SessionClient client. +func NewSessionClientWithBaseURI(baseURI string, subscriptionID string) SessionClient { + return SessionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a session for a node. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. +// sessionParameters is parameters supplied to the CreateOrUpdate operation. +func (client SessionClient) Create(resourceGroupName string, nodeName string, session string, sessionParameters SessionParameters, cancel <-chan struct{}) (<-chan SessionResource, <-chan error) { + resultChan := make(chan SessionResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servermanagement.SessionClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result SessionResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, nodeName, session, sessionParameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client SessionClient) CreatePreparer(resourceGroupName string, nodeName string, session string, sessionParameters SessionParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", pathParameters), + autorest.WithJSON(sessionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SessionClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SessionClient) CreateResponder(resp *http.Response) (result SessionResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a session for a node. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. +func (client SessionClient) Delete(resourceGroupName string, nodeName string, session string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.SessionClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, nodeName, session) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SessionClient) DeletePreparer(resourceGroupName string, nodeName string, session string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SessionClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SessionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a session for a node. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscriptionId. nodeName is the node name +// (256 characters maximum). session is the sessionId from the user. +func (client SessionClient) Get(resourceGroupName string, nodeName string, session string) (result SessionResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9]+`, Chain: nil}}}, + {TargetValue: nodeName, + Constraints: []validation.Constraint{{Target: "nodeName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "nodeName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "nodeName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servermanagement.SessionClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, nodeName, session) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servermanagement.SessionClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SessionClient) GetPreparer(resourceGroupName string, nodeName string, session string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "nodeName": autorest.Encode("path", nodeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "session": autorest.Encode("path", session), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SessionClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SessionClient) GetResponder(resp *http.Response) (result SessionResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/version.go index e70da96475..4ee4f34583 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servermanagement/version.go @@ -1,29 +1,29 @@ -package servermanagement - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-servermanagement/2016-07-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package servermanagement + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-servermanagement/2016-07-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/client.go index dd8459dfdf..040182d51f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/client.go @@ -1,53 +1,53 @@ -// Package servicemap implements the Azure ARM Servicemap service API version -// 2015-11-01-preview. -// -// Service Map API Reference -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Servicemap - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Servicemap. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package servicemap implements the Azure ARM Servicemap service API version +// 2015-11-01-preview. +// +// Service Map API Reference +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Servicemap + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Servicemap. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/clientgroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/clientgroups.go index f00e0565e1..ffaaabf29f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/clientgroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/clientgroups.go @@ -1,357 +1,357 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ClientGroupsClient is the service Map API Reference -type ClientGroupsClient struct { - ManagementClient -} - -// NewClientGroupsClient creates an instance of the ClientGroupsClient client. -func NewClientGroupsClient(subscriptionID string) ClientGroupsClient { - return NewClientGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientGroupsClientWithBaseURI creates an instance of the -// ClientGroupsClient client. -func NewClientGroupsClientWithBaseURI(baseURI string, subscriptionID string) ClientGroupsClient { - return ClientGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieves the specified client group -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. clientGroupName is client Group resource name. startTime is uTC -// date and time specifying the start time of an interval. When not specified -// the service uses DateTime.UtcNow - 10m endTime is uTC date and time -// specifying the end time of an interval. When not specified the service uses -// DateTime.UtcNow -func (client ClientGroupsClient) Get(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (result ClientGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: clientGroupName, - Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClientGroupsClient) GetPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clientGroupName": autorest.Encode("path", clientGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClientGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClientGroupsClient) GetResponder(resp *http.Response) (result ClientGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMembersCount returns the approximate number of members in the client -// group. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. clientGroupName is client Group resource name. startTime is uTC -// date and time specifying the start time of an interval. When not specified -// the service uses DateTime.UtcNow - 10m endTime is uTC date and time -// specifying the end time of an interval. When not specified the service uses -// DateTime.UtcNow -func (client ClientGroupsClient) GetMembersCount(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (result ClientGroupMembersCount, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: clientGroupName, - Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "GetMembersCount") - } - - req, err := client.GetMembersCountPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", nil, "Failure preparing request") - return - } - - resp, err := client.GetMembersCountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", resp, "Failure sending request") - return - } - - result, err = client.GetMembersCountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", resp, "Failure responding to request") - } - - return -} - -// GetMembersCountPreparer prepares the GetMembersCount request. -func (client ClientGroupsClient) GetMembersCountPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clientGroupName": autorest.Encode("path", clientGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/membersCount", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMembersCountSender sends the GetMembersCount request. The method will close the -// http.Response Body if it receives an error. -func (client ClientGroupsClient) GetMembersCountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMembersCountResponder handles the response to the GetMembersCount request. The method always -// closes the http.Response Body. -func (client ClientGroupsClient) GetMembersCountResponder(resp *http.Response) (result ClientGroupMembersCount, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMembers returns the members of the client group during the specified -// time interval. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. clientGroupName is client Group resource name. startTime is uTC -// date and time specifying the start time of an interval. When not specified -// the service uses DateTime.UtcNow - 10m endTime is uTC date and time -// specifying the end time of an interval. When not specified the service uses -// DateTime.UtcNow top is page size to use. When not specified, the default -// page size is 100 records. -func (client ClientGroupsClient) ListMembers(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time, top *int32) (result ClientGroupMembersCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: clientGroupName, - Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "ListMembers") - } - - req, err := client.ListMembersPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime, top) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", nil, "Failure preparing request") - return - } - - resp, err := client.ListMembersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure sending request") - return - } - - result, err = client.ListMembersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure responding to request") - } - - return -} - -// ListMembersPreparer prepares the ListMembers request. -func (client ClientGroupsClient) ListMembersPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clientGroupName": autorest.Encode("path", clientGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/members", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMembersSender sends the ListMembers request. The method will close the -// http.Response Body if it receives an error. -func (client ClientGroupsClient) ListMembersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMembersResponder handles the response to the ListMembers request. The method always -// closes the http.Response Body. -func (client ClientGroupsClient) ListMembersResponder(resp *http.Response) (result ClientGroupMembersCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMembersNextResults retrieves the next set of results, if any. -func (client ClientGroupsClient) ListMembersNextResults(lastResults ClientGroupMembersCollection) (result ClientGroupMembersCollection, err error) { - req, err := lastResults.ClientGroupMembersCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMembersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure sending next results request") - } - - result, err = client.ListMembersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure responding to next results request") - } - - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ClientGroupsClient is the service Map API Reference +type ClientGroupsClient struct { + ManagementClient +} + +// NewClientGroupsClient creates an instance of the ClientGroupsClient client. +func NewClientGroupsClient(subscriptionID string) ClientGroupsClient { + return NewClientGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientGroupsClientWithBaseURI creates an instance of the +// ClientGroupsClient client. +func NewClientGroupsClientWithBaseURI(baseURI string, subscriptionID string) ClientGroupsClient { + return ClientGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieves the specified client group +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. clientGroupName is client Group resource name. startTime is uTC +// date and time specifying the start time of an interval. When not specified +// the service uses DateTime.UtcNow - 10m endTime is uTC date and time +// specifying the end time of an interval. When not specified the service uses +// DateTime.UtcNow +func (client ClientGroupsClient) Get(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (result ClientGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: clientGroupName, + Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClientGroupsClient) GetPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clientGroupName": autorest.Encode("path", clientGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClientGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClientGroupsClient) GetResponder(resp *http.Response) (result ClientGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMembersCount returns the approximate number of members in the client +// group. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. clientGroupName is client Group resource name. startTime is uTC +// date and time specifying the start time of an interval. When not specified +// the service uses DateTime.UtcNow - 10m endTime is uTC date and time +// specifying the end time of an interval. When not specified the service uses +// DateTime.UtcNow +func (client ClientGroupsClient) GetMembersCount(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (result ClientGroupMembersCount, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: clientGroupName, + Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "GetMembersCount") + } + + req, err := client.GetMembersCountPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", nil, "Failure preparing request") + return + } + + resp, err := client.GetMembersCountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", resp, "Failure sending request") + return + } + + result, err = client.GetMembersCountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", resp, "Failure responding to request") + } + + return +} + +// GetMembersCountPreparer prepares the GetMembersCount request. +func (client ClientGroupsClient) GetMembersCountPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clientGroupName": autorest.Encode("path", clientGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/membersCount", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMembersCountSender sends the GetMembersCount request. The method will close the +// http.Response Body if it receives an error. +func (client ClientGroupsClient) GetMembersCountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMembersCountResponder handles the response to the GetMembersCount request. The method always +// closes the http.Response Body. +func (client ClientGroupsClient) GetMembersCountResponder(resp *http.Response) (result ClientGroupMembersCount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMembers returns the members of the client group during the specified +// time interval. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. clientGroupName is client Group resource name. startTime is uTC +// date and time specifying the start time of an interval. When not specified +// the service uses DateTime.UtcNow - 10m endTime is uTC date and time +// specifying the end time of an interval. When not specified the service uses +// DateTime.UtcNow top is page size to use. When not specified, the default +// page size is 100 records. +func (client ClientGroupsClient) ListMembers(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time, top *int32) (result ClientGroupMembersCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: clientGroupName, + Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "ListMembers") + } + + req, err := client.ListMembersPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime, top) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", nil, "Failure preparing request") + return + } + + resp, err := client.ListMembersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure sending request") + return + } + + result, err = client.ListMembersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure responding to request") + } + + return +} + +// ListMembersPreparer prepares the ListMembers request. +func (client ClientGroupsClient) ListMembersPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clientGroupName": autorest.Encode("path", clientGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/members", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMembersSender sends the ListMembers request. The method will close the +// http.Response Body if it receives an error. +func (client ClientGroupsClient) ListMembersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMembersResponder handles the response to the ListMembers request. The method always +// closes the http.Response Body. +func (client ClientGroupsClient) ListMembersResponder(resp *http.Response) (result ClientGroupMembersCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMembersNextResults retrieves the next set of results, if any. +func (client ClientGroupsClient) ListMembersNextResults(lastResults ClientGroupMembersCollection) (result ClientGroupMembersCollection, err error) { + req, err := lastResults.ClientGroupMembersCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMembersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure sending next results request") + } + + result, err = client.ListMembersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machinegroups.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machinegroups.go index 609397f98f..9ed8c12cc5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machinegroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machinegroups.go @@ -1,492 +1,492 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// MachineGroupsClient is the service Map API Reference -type MachineGroupsClient struct { - ManagementClient -} - -// NewMachineGroupsClient creates an instance of the MachineGroupsClient -// client. -func NewMachineGroupsClient(subscriptionID string) MachineGroupsClient { - return NewMachineGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMachineGroupsClientWithBaseURI creates an instance of the -// MachineGroupsClient client. -func NewMachineGroupsClientWithBaseURI(baseURI string, subscriptionID string) MachineGroupsClient { - return MachineGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new machine group. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineGroup is machine Group resource to create. -func (client MachineGroupsClient) Create(resourceGroupName string, workspaceName string, machineGroup MachineGroup) (result MachineGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineGroup, - Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Create") - } - - req, err := client.CreatePreparer(resourceGroupName, workspaceName, machineGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client MachineGroupsClient) CreatePreparer(resourceGroupName string, workspaceName string, machineGroup MachineGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters), - autorest.WithJSON(machineGroup), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client MachineGroupsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client MachineGroupsClient) CreateResponder(resp *http.Response) (result MachineGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Machine Group. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineGroupName is machine Group resource name. -func (client MachineGroupsClient) Delete(resourceGroupName string, workspaceName string, machineGroupName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineGroupName, - Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, workspaceName, machineGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MachineGroupsClient) DeletePreparer(resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineGroupName": autorest.Encode("path", machineGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client MachineGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client MachineGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the specified machine group. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineGroupName is machine Group resource name. -func (client MachineGroupsClient) Get(resourceGroupName string, workspaceName string, machineGroupName string) (result MachineGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineGroupName, - Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, machineGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client MachineGroupsClient) GetPreparer(resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineGroupName": autorest.Encode("path", machineGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MachineGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MachineGroupsClient) GetResponder(resp *http.Response) (result MachineGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace returns all machine groups. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. -func (client MachineGroupsClient) ListByWorkspace(resourceGroupName string, workspaceName string) (result MachineGroupCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "ListByWorkspace") - } - - req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to request") - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client MachineGroupsClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client MachineGroupsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client MachineGroupsClient) ListByWorkspaceResponder(resp *http.Response) (result MachineGroupCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspaceNextResults retrieves the next set of results, if any. -func (client MachineGroupsClient) ListByWorkspaceNextResults(lastResults MachineGroupCollection) (result MachineGroupCollection, err error) { - req, err := lastResults.MachineGroupCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending next results request") - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to next results request") - } - - return -} - -// Update updates a machine group. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineGroupName is machine Group resource name. machineGroup is -// machine Group resource to update. -func (client MachineGroupsClient) Update(resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (result MachineGroup, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineGroupName, - Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}, - {TargetValue: machineGroup, - Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, - {Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, workspaceName, machineGroupName, machineGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MachineGroupsClient) UpdatePreparer(resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineGroupName": autorest.Encode("path", machineGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters), - autorest.WithJSON(machineGroup), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client MachineGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client MachineGroupsClient) UpdateResponder(resp *http.Response) (result MachineGroup, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// MachineGroupsClient is the service Map API Reference +type MachineGroupsClient struct { + ManagementClient +} + +// NewMachineGroupsClient creates an instance of the MachineGroupsClient +// client. +func NewMachineGroupsClient(subscriptionID string) MachineGroupsClient { + return NewMachineGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMachineGroupsClientWithBaseURI creates an instance of the +// MachineGroupsClient client. +func NewMachineGroupsClientWithBaseURI(baseURI string, subscriptionID string) MachineGroupsClient { + return MachineGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new machine group. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineGroup is machine Group resource to create. +func (client MachineGroupsClient) Create(resourceGroupName string, workspaceName string, machineGroup MachineGroup) (result MachineGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineGroup, + Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Create") + } + + req, err := client.CreatePreparer(resourceGroupName, workspaceName, machineGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client MachineGroupsClient) CreatePreparer(resourceGroupName string, workspaceName string, machineGroup MachineGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters), + autorest.WithJSON(machineGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client MachineGroupsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client MachineGroupsClient) CreateResponder(resp *http.Response) (result MachineGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Machine Group. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineGroupName is machine Group resource name. +func (client MachineGroupsClient) Delete(resourceGroupName string, workspaceName string, machineGroupName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineGroupName, + Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, workspaceName, machineGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MachineGroupsClient) DeletePreparer(resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineGroupName": autorest.Encode("path", machineGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MachineGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MachineGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the specified machine group. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineGroupName is machine Group resource name. +func (client MachineGroupsClient) Get(resourceGroupName string, workspaceName string, machineGroupName string) (result MachineGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineGroupName, + Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, machineGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client MachineGroupsClient) GetPreparer(resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineGroupName": autorest.Encode("path", machineGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MachineGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MachineGroupsClient) GetResponder(resp *http.Response) (result MachineGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace returns all machine groups. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. +func (client MachineGroupsClient) ListByWorkspace(resourceGroupName string, workspaceName string) (result MachineGroupCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "ListByWorkspace") + } + + req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to request") + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client MachineGroupsClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client MachineGroupsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client MachineGroupsClient) ListByWorkspaceResponder(resp *http.Response) (result MachineGroupCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspaceNextResults retrieves the next set of results, if any. +func (client MachineGroupsClient) ListByWorkspaceNextResults(lastResults MachineGroupCollection) (result MachineGroupCollection, err error) { + req, err := lastResults.MachineGroupCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending next results request") + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to next results request") + } + + return +} + +// Update updates a machine group. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineGroupName is machine Group resource name. machineGroup is +// machine Group resource to update. +func (client MachineGroupsClient) Update(resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (result MachineGroup, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineGroupName, + Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil}, + {Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}, + {TargetValue: machineGroup, + Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil}, + {Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, workspaceName, machineGroupName, machineGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MachineGroupsClient) UpdatePreparer(resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineGroupName": autorest.Encode("path", machineGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters), + autorest.WithJSON(machineGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MachineGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MachineGroupsClient) UpdateResponder(resp *http.Response) (result MachineGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machines.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machines.go index 9b08359259..ca1fa113f3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machines.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/machines.go @@ -1,846 +1,846 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// MachinesClient is the service Map API Reference -type MachinesClient struct { - ManagementClient -} - -// NewMachinesClient creates an instance of the MachinesClient client. -func NewMachinesClient(subscriptionID string) MachinesClient { - return NewMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMachinesClientWithBaseURI creates an instance of the MachinesClient -// client. -func NewMachinesClientWithBaseURI(baseURI string, subscriptionID string) MachinesClient { - return MachinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns the specified machine. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. timestamp is uTC date and -// time specifying a time instance relative to which to evaluate the machine -// resource. When not specified, the service uses DateTime.UtcNow. -func (client MachinesClient) Get(resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (result Machine, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, timestamp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client MachinesClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if timestamp != nil { - queryParameters["timestamp"] = autorest.Encode("query", *timestamp) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MachinesClient) GetResponder(resp *http.Response) (result Machine, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLiveness obtains the liveness status of the machine during the specified -// time interval. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. startTime is uTC date and -// time specifying the start time of an interval. When not specified the -// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying -// the end time of an interval. When not specified the service uses -// DateTime.UtcNow -func (client MachinesClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "GetLiveness") - } - - req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", nil, "Failure preparing request") - return - } - - resp, err := client.GetLivenessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", resp, "Failure sending request") - return - } - - result, err = client.GetLivenessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", resp, "Failure responding to request") - } - - return -} - -// GetLivenessPreparer prepares the GetLiveness request. -func (client MachinesClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/liveness", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetLivenessSender sends the GetLiveness request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) GetLivenessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLivenessResponder handles the response to the GetLiveness request. The method always -// closes the http.Response Body. -func (client MachinesClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspace returns a collection of machines matching the specified -// conditions. The returned collection represents either machines that are -// active/live during the specified interval of time (`live=true` and -// `startTime`/`endTime` are specified) or that are known to have existed at or -// some time prior to the specified point in time (`live=false` and `timestamp` -// is specified). -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. live is specifies whether to return live resources (true) or -// inventory resources (false). Defaults to **true**. When retrieving live -// resources, the start time (`startTime`) and end time (`endTime`) of the -// desired interval should be included. When retrieving inventory resources, an -// optional timestamp (`timestamp`) parameter can be specified to return the -// version of each resource closest (not-after) that timestamp. startTime is -// uTC date and time specifying the start time of an interval. When not -// specified the service uses DateTime.UtcNow - 10m endTime is uTC date and -// time specifying the end time of an interval. When not specified the service -// uses DateTime.UtcNow timestamp is uTC date and time specifying a time -// instance relative to which to evaluate each machine resource. Only applies -// when `live=false`. When not specified, the service uses DateTime.UtcNow. top -// is page size to use. When not specified, the default page size is 100 -// records. -func (client MachinesClient) ListByWorkspace(resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (result MachineCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListByWorkspace") - } - - req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName, live, startTime, endTime, timestamp, top) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to request") - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client MachinesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if live != nil { - queryParameters["live"] = autorest.Encode("query", *live) - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - if timestamp != nil { - queryParameters["timestamp"] = autorest.Encode("query", *timestamp) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client MachinesClient) ListByWorkspaceResponder(resp *http.Response) (result MachineCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByWorkspaceNextResults retrieves the next set of results, if any. -func (client MachinesClient) ListByWorkspaceNextResults(lastResults MachineCollection) (result MachineCollection, err error) { - req, err := lastResults.MachineCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending next results request") - } - - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to next results request") - } - - return -} - -// ListConnections returns a collection of connections terminating or -// originating at the specified machine -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. startTime is uTC date and -// time specifying the start time of an interval. When not specified the -// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying -// the end time of an interval. When not specified the service uses -// DateTime.UtcNow -func (client MachinesClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListConnections") - } - - req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to request") - } - - return -} - -// ListConnectionsPreparer prepares the ListConnections request. -func (client MachinesClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConnectionsSender sends the ListConnections request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConnectionsResponder handles the response to the ListConnections request. The method always -// closes the http.Response Body. -func (client MachinesClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionsNextResults retrieves the next set of results, if any. -func (client MachinesClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) { - req, err := lastResults.ConnectionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending next results request") - } - - result, err = client.ListConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to next results request") - } - - return -} - -// ListMachineGroupMembership returns a collection of machine groups this -// machine belongs to. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. -func (client MachinesClient) ListMachineGroupMembership(resourceGroupName string, workspaceName string, machineName string) (result MachineGroupCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListMachineGroupMembership") - } - - req, err := client.ListMachineGroupMembershipPreparer(resourceGroupName, workspaceName, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing request") - return - } - - resp, err := client.ListMachineGroupMembershipSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending request") - return - } - - result, err = client.ListMachineGroupMembershipResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to request") - } - - return -} - -// ListMachineGroupMembershipPreparer prepares the ListMachineGroupMembership request. -func (client MachinesClient) ListMachineGroupMembershipPreparer(resourceGroupName string, workspaceName string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/machineGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMachineGroupMembershipSender sends the ListMachineGroupMembership request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) ListMachineGroupMembershipSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMachineGroupMembershipResponder handles the response to the ListMachineGroupMembership request. The method always -// closes the http.Response Body. -func (client MachinesClient) ListMachineGroupMembershipResponder(resp *http.Response) (result MachineGroupCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMachineGroupMembershipNextResults retrieves the next set of results, if any. -func (client MachinesClient) ListMachineGroupMembershipNextResults(lastResults MachineGroupCollection) (result MachineGroupCollection, err error) { - req, err := lastResults.MachineGroupCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMachineGroupMembershipSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending next results request") - } - - result, err = client.ListMachineGroupMembershipResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to next results request") - } - - return -} - -// ListPorts returns a collection of live ports on the specified machine during -// the specified time interval. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. startTime is uTC date and -// time specifying the start time of an interval. When not specified the -// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying -// the end time of an interval. When not specified the service uses -// DateTime.UtcNow -func (client MachinesClient) ListPorts(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result PortCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListPorts") - } - - req, err := client.ListPortsPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", nil, "Failure preparing request") - return - } - - resp, err := client.ListPortsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending request") - return - } - - result, err = client.ListPortsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to request") - } - - return -} - -// ListPortsPreparer prepares the ListPorts request. -func (client MachinesClient) ListPortsPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPortsSender sends the ListPorts request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) ListPortsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPortsResponder handles the response to the ListPorts request. The method always -// closes the http.Response Body. -func (client MachinesClient) ListPortsResponder(resp *http.Response) (result PortCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPortsNextResults retrieves the next set of results, if any. -func (client MachinesClient) ListPortsNextResults(lastResults PortCollection) (result PortCollection, err error) { - req, err := lastResults.PortCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListPortsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending next results request") - } - - result, err = client.ListPortsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to next results request") - } - - return -} - -// ListProcesses returns a collection of processes on the specified machine -// matching the specified conditions. The returned collection represents either -// processes that are active/live during the specified interval of time -// (`live=true` and `startTime`/`endTime` are specified) or that are known to -// have existed at or some time prior to the specified point in time -// (`live=false` and `timestamp` is specified). -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. live is specifies whether to -// return live resources (true) or inventory resources (false). Defaults to -// **true**. When retrieving live resources, the start time (`startTime`) and -// end time (`endTime`) of the desired interval should be included. When -// retrieving inventory resources, an optional timestamp (`timestamp`) -// parameter can be specified to return the version of each resource closest -// (not-after) that timestamp. startTime is uTC date and time specifying the -// start time of an interval. When not specified the service uses -// DateTime.UtcNow - 10m endTime is uTC date and time specifying the end time -// of an interval. When not specified the service uses DateTime.UtcNow -// timestamp is uTC date and time specifying a time instance relative to which -// to evaluate all process resource. Only applies when `live=false`. When not -// specified, the service uses DateTime.UtcNow. -func (client MachinesClient) ListProcesses(resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (result ProcessCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListProcesses") - } - - req, err := client.ListProcessesPreparer(resourceGroupName, workspaceName, machineName, live, startTime, endTime, timestamp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", nil, "Failure preparing request") - return - } - - resp, err := client.ListProcessesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending request") - return - } - - result, err = client.ListProcessesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to request") - } - - return -} - -// ListProcessesPreparer prepares the ListProcesses request. -func (client MachinesClient) ListProcessesPreparer(resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if live != nil { - queryParameters["live"] = autorest.Encode("query", *live) - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - if timestamp != nil { - queryParameters["timestamp"] = autorest.Encode("query", *timestamp) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListProcessesSender sends the ListProcesses request. The method will close the -// http.Response Body if it receives an error. -func (client MachinesClient) ListProcessesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListProcessesResponder handles the response to the ListProcesses request. The method always -// closes the http.Response Body. -func (client MachinesClient) ListProcessesResponder(resp *http.Response) (result ProcessCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListProcessesNextResults retrieves the next set of results, if any. -func (client MachinesClient) ListProcessesNextResults(lastResults ProcessCollection) (result ProcessCollection, err error) { - req, err := lastResults.ProcessCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListProcessesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending next results request") - } - - result, err = client.ListProcessesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to next results request") - } - - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// MachinesClient is the service Map API Reference +type MachinesClient struct { + ManagementClient +} + +// NewMachinesClient creates an instance of the MachinesClient client. +func NewMachinesClient(subscriptionID string) MachinesClient { + return NewMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMachinesClientWithBaseURI creates an instance of the MachinesClient +// client. +func NewMachinesClientWithBaseURI(baseURI string, subscriptionID string) MachinesClient { + return MachinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns the specified machine. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. timestamp is uTC date and +// time specifying a time instance relative to which to evaluate the machine +// resource. When not specified, the service uses DateTime.UtcNow. +func (client MachinesClient) Get(resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (result Machine, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, timestamp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client MachinesClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timestamp != nil { + queryParameters["timestamp"] = autorest.Encode("query", *timestamp) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MachinesClient) GetResponder(resp *http.Response) (result Machine, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLiveness obtains the liveness status of the machine during the specified +// time interval. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. startTime is uTC date and +// time specifying the start time of an interval. When not specified the +// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying +// the end time of an interval. When not specified the service uses +// DateTime.UtcNow +func (client MachinesClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "GetLiveness") + } + + req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", nil, "Failure preparing request") + return + } + + resp, err := client.GetLivenessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", resp, "Failure sending request") + return + } + + result, err = client.GetLivenessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", resp, "Failure responding to request") + } + + return +} + +// GetLivenessPreparer prepares the GetLiveness request. +func (client MachinesClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/liveness", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetLivenessSender sends the GetLiveness request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) GetLivenessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLivenessResponder handles the response to the GetLiveness request. The method always +// closes the http.Response Body. +func (client MachinesClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace returns a collection of machines matching the specified +// conditions. The returned collection represents either machines that are +// active/live during the specified interval of time (`live=true` and +// `startTime`/`endTime` are specified) or that are known to have existed at or +// some time prior to the specified point in time (`live=false` and `timestamp` +// is specified). +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. live is specifies whether to return live resources (true) or +// inventory resources (false). Defaults to **true**. When retrieving live +// resources, the start time (`startTime`) and end time (`endTime`) of the +// desired interval should be included. When retrieving inventory resources, an +// optional timestamp (`timestamp`) parameter can be specified to return the +// version of each resource closest (not-after) that timestamp. startTime is +// uTC date and time specifying the start time of an interval. When not +// specified the service uses DateTime.UtcNow - 10m endTime is uTC date and +// time specifying the end time of an interval. When not specified the service +// uses DateTime.UtcNow timestamp is uTC date and time specifying a time +// instance relative to which to evaluate each machine resource. Only applies +// when `live=false`. When not specified, the service uses DateTime.UtcNow. top +// is page size to use. When not specified, the default page size is 100 +// records. +func (client MachinesClient) ListByWorkspace(resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (result MachineCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListByWorkspace") + } + + req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName, live, startTime, endTime, timestamp, top) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to request") + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client MachinesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if live != nil { + queryParameters["live"] = autorest.Encode("query", *live) + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if timestamp != nil { + queryParameters["timestamp"] = autorest.Encode("query", *timestamp) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client MachinesClient) ListByWorkspaceResponder(resp *http.Response) (result MachineCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspaceNextResults retrieves the next set of results, if any. +func (client MachinesClient) ListByWorkspaceNextResults(lastResults MachineCollection) (result MachineCollection, err error) { + req, err := lastResults.MachineCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending next results request") + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to next results request") + } + + return +} + +// ListConnections returns a collection of connections terminating or +// originating at the specified machine +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. startTime is uTC date and +// time specifying the start time of an interval. When not specified the +// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying +// the end time of an interval. When not specified the service uses +// DateTime.UtcNow +func (client MachinesClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListConnections") + } + + req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to request") + } + + return +} + +// ListConnectionsPreparer prepares the ListConnections request. +func (client MachinesClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionsSender sends the ListConnections request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionsResponder handles the response to the ListConnections request. The method always +// closes the http.Response Body. +func (client MachinesClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionsNextResults retrieves the next set of results, if any. +func (client MachinesClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) { + req, err := lastResults.ConnectionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending next results request") + } + + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to next results request") + } + + return +} + +// ListMachineGroupMembership returns a collection of machine groups this +// machine belongs to. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. +func (client MachinesClient) ListMachineGroupMembership(resourceGroupName string, workspaceName string, machineName string) (result MachineGroupCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListMachineGroupMembership") + } + + req, err := client.ListMachineGroupMembershipPreparer(resourceGroupName, workspaceName, machineName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing request") + return + } + + resp, err := client.ListMachineGroupMembershipSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending request") + return + } + + result, err = client.ListMachineGroupMembershipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to request") + } + + return +} + +// ListMachineGroupMembershipPreparer prepares the ListMachineGroupMembership request. +func (client MachinesClient) ListMachineGroupMembershipPreparer(resourceGroupName string, workspaceName string, machineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/machineGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMachineGroupMembershipSender sends the ListMachineGroupMembership request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) ListMachineGroupMembershipSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMachineGroupMembershipResponder handles the response to the ListMachineGroupMembership request. The method always +// closes the http.Response Body. +func (client MachinesClient) ListMachineGroupMembershipResponder(resp *http.Response) (result MachineGroupCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMachineGroupMembershipNextResults retrieves the next set of results, if any. +func (client MachinesClient) ListMachineGroupMembershipNextResults(lastResults MachineGroupCollection) (result MachineGroupCollection, err error) { + req, err := lastResults.MachineGroupCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMachineGroupMembershipSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending next results request") + } + + result, err = client.ListMachineGroupMembershipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to next results request") + } + + return +} + +// ListPorts returns a collection of live ports on the specified machine during +// the specified time interval. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. startTime is uTC date and +// time specifying the start time of an interval. When not specified the +// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying +// the end time of an interval. When not specified the service uses +// DateTime.UtcNow +func (client MachinesClient) ListPorts(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result PortCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListPorts") + } + + req, err := client.ListPortsPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", nil, "Failure preparing request") + return + } + + resp, err := client.ListPortsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending request") + return + } + + result, err = client.ListPortsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to request") + } + + return +} + +// ListPortsPreparer prepares the ListPorts request. +func (client MachinesClient) ListPortsPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPortsSender sends the ListPorts request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) ListPortsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPortsResponder handles the response to the ListPorts request. The method always +// closes the http.Response Body. +func (client MachinesClient) ListPortsResponder(resp *http.Response) (result PortCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPortsNextResults retrieves the next set of results, if any. +func (client MachinesClient) ListPortsNextResults(lastResults PortCollection) (result PortCollection, err error) { + req, err := lastResults.PortCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPortsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending next results request") + } + + result, err = client.ListPortsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to next results request") + } + + return +} + +// ListProcesses returns a collection of processes on the specified machine +// matching the specified conditions. The returned collection represents either +// processes that are active/live during the specified interval of time +// (`live=true` and `startTime`/`endTime` are specified) or that are known to +// have existed at or some time prior to the specified point in time +// (`live=false` and `timestamp` is specified). +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. live is specifies whether to +// return live resources (true) or inventory resources (false). Defaults to +// **true**. When retrieving live resources, the start time (`startTime`) and +// end time (`endTime`) of the desired interval should be included. When +// retrieving inventory resources, an optional timestamp (`timestamp`) +// parameter can be specified to return the version of each resource closest +// (not-after) that timestamp. startTime is uTC date and time specifying the +// start time of an interval. When not specified the service uses +// DateTime.UtcNow - 10m endTime is uTC date and time specifying the end time +// of an interval. When not specified the service uses DateTime.UtcNow +// timestamp is uTC date and time specifying a time instance relative to which +// to evaluate all process resource. Only applies when `live=false`. When not +// specified, the service uses DateTime.UtcNow. +func (client MachinesClient) ListProcesses(resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (result ProcessCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListProcesses") + } + + req, err := client.ListProcessesPreparer(resourceGroupName, workspaceName, machineName, live, startTime, endTime, timestamp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", nil, "Failure preparing request") + return + } + + resp, err := client.ListProcessesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending request") + return + } + + result, err = client.ListProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to request") + } + + return +} + +// ListProcessesPreparer prepares the ListProcesses request. +func (client MachinesClient) ListProcessesPreparer(resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if live != nil { + queryParameters["live"] = autorest.Encode("query", *live) + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + if timestamp != nil { + queryParameters["timestamp"] = autorest.Encode("query", *timestamp) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListProcessesSender sends the ListProcesses request. The method will close the +// http.Response Body if it receives an error. +func (client MachinesClient) ListProcessesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListProcessesResponder handles the response to the ListProcesses request. The method always +// closes the http.Response Body. +func (client MachinesClient) ListProcessesResponder(resp *http.Response) (result ProcessCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListProcessesNextResults retrieves the next set of results, if any. +func (client MachinesClient) ListProcessesNextResults(lastResults ProcessCollection) (result ProcessCollection, err error) { + req, err := lastResults.ProcessCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListProcessesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending next results request") + } + + result, err = client.ListProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/maps.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/maps.go index 648f339474..1b5844b598 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/maps.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/maps.go @@ -1,122 +1,122 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// MapsClient is the service Map API Reference -type MapsClient struct { - ManagementClient -} - -// NewMapsClient creates an instance of the MapsClient client. -func NewMapsClient(subscriptionID string) MapsClient { - return NewMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMapsClientWithBaseURI creates an instance of the MapsClient client. -func NewMapsClientWithBaseURI(baseURI string, subscriptionID string) MapsClient { - return MapsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Generate generates the specified map. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. request is request options. -func (client MapsClient) Generate(resourceGroupName string, workspaceName string, request MapRequest) (result MapResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.MapsClient", "Generate") - } - - req, err := client.GeneratePreparer(resourceGroupName, workspaceName, request) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", resp, "Failure sending request") - return - } - - result, err = client.GenerateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", resp, "Failure responding to request") - } - - return -} - -// GeneratePreparer prepares the Generate request. -func (client MapsClient) GeneratePreparer(resourceGroupName string, workspaceName string, request MapRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/generateMap", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateSender sends the Generate request. The method will close the -// http.Response Body if it receives an error. -func (client MapsClient) GenerateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateResponder handles the response to the Generate request. The method always -// closes the http.Response Body. -func (client MapsClient) GenerateResponder(resp *http.Response) (result MapResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// MapsClient is the service Map API Reference +type MapsClient struct { + ManagementClient +} + +// NewMapsClient creates an instance of the MapsClient client. +func NewMapsClient(subscriptionID string) MapsClient { + return NewMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMapsClientWithBaseURI creates an instance of the MapsClient client. +func NewMapsClientWithBaseURI(baseURI string, subscriptionID string) MapsClient { + return MapsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Generate generates the specified map. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. request is request options. +func (client MapsClient) Generate(resourceGroupName string, workspaceName string, request MapRequest) (result MapResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.MapsClient", "Generate") + } + + req, err := client.GeneratePreparer(resourceGroupName, workspaceName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", resp, "Failure sending request") + return + } + + result, err = client.GenerateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", resp, "Failure responding to request") + } + + return +} + +// GeneratePreparer prepares the Generate request. +func (client MapsClient) GeneratePreparer(resourceGroupName string, workspaceName string, request MapRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/generateMap", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateSender sends the Generate request. The method will close the +// http.Response Body if it receives an error. +func (client MapsClient) GenerateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateResponder handles the response to the Generate request. The method always +// closes the http.Response Body. +func (client MapsClient) GenerateResponder(resp *http.Response) (result MapResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go index a7360bbd2a..0b72e45b83 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/models.go @@ -1,759 +1,759 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// Accuracy enumerates the values for accuracy. -type Accuracy string - -const ( - // Actual specifies the actual state for accuracy. - Actual Accuracy = "actual" - // Estimated specifies the estimated state for accuracy. - Estimated Accuracy = "estimated" -) - -// Bitness enumerates the values for bitness. -type Bitness string - -const ( - // SixFourbit specifies the six fourbit state for bitness. - SixFourbit Bitness = "64bit" - // ThreeTwobit specifies the three twobit state for bitness. - ThreeTwobit Bitness = "32bit" -) - -// ConnectionFailureState enumerates the values for connection failure state. -type ConnectionFailureState string - -const ( - // Failed specifies the failed state for connection failure state. - Failed ConnectionFailureState = "failed" - // Mixed specifies the mixed state for connection failure state. - Mixed ConnectionFailureState = "mixed" - // Ok specifies the ok state for connection failure state. - Ok ConnectionFailureState = "ok" -) - -// HypervisorType enumerates the values for hypervisor type. -type HypervisorType string - -const ( - // Hyperv specifies the hyperv state for hypervisor type. - Hyperv HypervisorType = "hyperv" - // Unknown specifies the unknown state for hypervisor type. - Unknown HypervisorType = "unknown" -) - -// MachineRebootStatus enumerates the values for machine reboot status. -type MachineRebootStatus string - -const ( - // MachineRebootStatusNotRebooted specifies the machine reboot status not - // rebooted state for machine reboot status. - MachineRebootStatusNotRebooted MachineRebootStatus = "notRebooted" - // MachineRebootStatusRebooted specifies the machine reboot status rebooted - // state for machine reboot status. - MachineRebootStatusRebooted MachineRebootStatus = "rebooted" - // MachineRebootStatusUnknown specifies the machine reboot status unknown - // state for machine reboot status. - MachineRebootStatusUnknown MachineRebootStatus = "unknown" -) - -// MonitoringState enumerates the values for monitoring state. -type MonitoringState string - -const ( - // Discovered specifies the discovered state for monitoring state. - Discovered MonitoringState = "discovered" - // Monitored specifies the monitored state for monitoring state. - Monitored MonitoringState = "monitored" -) - -// OperatingSystemFamily enumerates the values for operating system family. -type OperatingSystemFamily string - -const ( - // OperatingSystemFamilyAix specifies the operating system family aix state - // for operating system family. - OperatingSystemFamilyAix OperatingSystemFamily = "aix" - // OperatingSystemFamilyLinux specifies the operating system family linux - // state for operating system family. - OperatingSystemFamilyLinux OperatingSystemFamily = "linux" - // OperatingSystemFamilySolaris specifies the operating system family - // solaris state for operating system family. - OperatingSystemFamilySolaris OperatingSystemFamily = "solaris" - // OperatingSystemFamilyUnknown specifies the operating system family - // unknown state for operating system family. - OperatingSystemFamilyUnknown OperatingSystemFamily = "unknown" - // OperatingSystemFamilyWindows specifies the operating system family - // windows state for operating system family. - OperatingSystemFamilyWindows OperatingSystemFamily = "windows" -) - -// ProcessRole enumerates the values for process role. -type ProcessRole string - -const ( - // AppServer specifies the app server state for process role. - AppServer ProcessRole = "appServer" - // DatabaseServer specifies the database server state for process role. - DatabaseServer ProcessRole = "databaseServer" - // LdapServer specifies the ldap server state for process role. - LdapServer ProcessRole = "ldapServer" - // SmbServer specifies the smb server state for process role. - SmbServer ProcessRole = "smbServer" - // WebServer specifies the web server state for process role. - WebServer ProcessRole = "webServer" -) - -// VirtualizationState enumerates the values for virtualization state. -type VirtualizationState string - -const ( - // VirtualizationStateHypervisor specifies the virtualization state - // hypervisor state for virtualization state. - VirtualizationStateHypervisor VirtualizationState = "hypervisor" - // VirtualizationStatePhysical specifies the virtualization state physical - // state for virtualization state. - VirtualizationStatePhysical VirtualizationState = "physical" - // VirtualizationStateUnknown specifies the virtualization state unknown - // state for virtualization state. - VirtualizationStateUnknown VirtualizationState = "unknown" - // VirtualizationStateVirtual specifies the virtualization state virtual - // state for virtualization state. - VirtualizationStateVirtual VirtualizationState = "virtual" -) - -// VirtualMachineType enumerates the values for virtual machine type. -type VirtualMachineType string - -const ( - // VirtualMachineTypeHyperv specifies the virtual machine type hyperv state - // for virtual machine type. - VirtualMachineTypeHyperv VirtualMachineType = "hyperv" - // VirtualMachineTypeLdom specifies the virtual machine type ldom state for - // virtual machine type. - VirtualMachineTypeLdom VirtualMachineType = "ldom" - // VirtualMachineTypeLpar specifies the virtual machine type lpar state for - // virtual machine type. - VirtualMachineTypeLpar VirtualMachineType = "lpar" - // VirtualMachineTypeUnknown specifies the virtual machine type unknown - // state for virtual machine type. - VirtualMachineTypeUnknown VirtualMachineType = "unknown" - // VirtualMachineTypeVirtualPc specifies the virtual machine type virtual - // pc state for virtual machine type. - VirtualMachineTypeVirtualPc VirtualMachineType = "virtualPc" - // VirtualMachineTypeVmware specifies the virtual machine type vmware state - // for virtual machine type. - VirtualMachineTypeVmware VirtualMachineType = "vmware" - // VirtualMachineTypeXen specifies the virtual machine type xen state for - // virtual machine type. - VirtualMachineTypeXen VirtualMachineType = "xen" -) - -// Acceptor is a process accepting on a port. -type Acceptor struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *AcceptorProperties `json:"properties,omitempty"` -} - -// AcceptorProperties is properties for an acceptor relationship. -type AcceptorProperties struct { - Source *PortReference `json:"source,omitempty"` - Destination *ProcessReference `json:"destination,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` -} - -// AgentConfiguration is describes the configuration of the Dependency Agent -// installed on a machine. -type AgentConfiguration struct { - AgentID *string `json:"agentId,omitempty"` - DependencyAgentID *string `json:"dependencyAgentId,omitempty"` - DependencyAgentVersion *string `json:"dependencyAgentVersion,omitempty"` - DependencyAgentRevision *string `json:"dependencyAgentRevision,omitempty"` - RebootStatus MachineRebootStatus `json:"rebootStatus,omitempty"` - ClockGranularity *int32 `json:"clockGranularity,omitempty"` -} - -// ClientGroup is represents a collection of clients of a resource. A client -// group can represent the clients of a port, process, or a machine. -type ClientGroup struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - *ClientGroupProperties `json:"properties,omitempty"` -} - -// ClientGroupProperties is resource properties. -type ClientGroupProperties struct { - ClientsOf *ResourceReference `json:"clientsOf,omitempty"` -} - -// ClientGroupMember is represents a member of a client group -type ClientGroupMember struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *ClientGroupMemberProperties `json:"properties,omitempty"` -} - -// ClientGroupMemberProperties is resource properties. -type ClientGroupMemberProperties struct { - IPAddress *string `json:"ipAddress,omitempty"` - Port *PortReference `json:"port,omitempty"` - Processes *[]ProcessReference `json:"processes,omitempty"` -} - -// ClientGroupMembersCollection is collection of ClientGroupMember resources. -type ClientGroupMembersCollection struct { - autorest.Response `json:"-"` - Value *[]ClientGroupMember `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClientGroupMembersCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClientGroupMembersCollection) ClientGroupMembersCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClientGroupMembersCount is specifies the number of members in a client -// group. -type ClientGroupMembersCount struct { - autorest.Response `json:"-"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - GroupID *string `json:"groupId,omitempty"` - Count *int32 `json:"count,omitempty"` - Accuracy Accuracy `json:"accuracy,omitempty"` -} - -// Connection is a network connection. -type Connection struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *ConnectionProperties `json:"properties,omitempty"` -} - -// ConnectionCollection is collection of Connection resources. -type ConnectionCollection struct { - autorest.Response `json:"-"` - Value *[]Connection `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ConnectionCollection) ConnectionCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ConnectionProperties is properties for a connection resource. -type ConnectionProperties struct { - Source *ResourceReference `json:"source,omitempty"` - Destination *ResourceReference `json:"destination,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ServerPort *PortReference `json:"serverPort,omitempty"` - FailureState ConnectionFailureState `json:"failureState,omitempty"` -} - -// CoreResource is marker resource for the core Service Map resources -type CoreResource struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` -} - -// Error is error details. -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ErrorResponse is an error response from the API. -type ErrorResponse struct { - Error *Error `json:"error,omitempty"` -} - -// HypervisorConfiguration is describes the hypervisor configuration of a -// machine. -type HypervisorConfiguration struct { - HypervisorType HypervisorType `json:"hypervisorType,omitempty"` - NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"` -} - -// Ipv4NetworkInterface is describes an IPv4 network interface. -type Ipv4NetworkInterface struct { - IPAddress *string `json:"ipAddress,omitempty"` - SubnetMask *string `json:"subnetMask,omitempty"` -} - -// Ipv6NetworkInterface is describes an IPv6 network interface. -type Ipv6NetworkInterface struct { - IPAddress *string `json:"ipAddress,omitempty"` -} - -// Liveness is specifies the contents of a check liveness response. -type Liveness struct { - autorest.Response `json:"-"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Live *bool `json:"live,omitempty"` -} - -// Machine is a machine resource represents a discovered computer system. It -// can be *monitored*, i.e., a Dependency Agent is running on it, or -// *discovered*, i.e., its existence was inferred by observing the data stream -// from monitored machines. As machines change, prior versions of the machine -// resource are preserved and available for access. A machine is live during an -// interval of time, if either its Dependency Agent has reported data during -// (parts) of that interval, or a Dependency agent running on other machines -// has reported activity associated with the machine. -type Machine struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - *MachineProperties `json:"properties,omitempty"` -} - -// MachineProperties is resource properties. -type MachineProperties struct { - Timestamp *date.Time `json:"timestamp,omitempty"` - MonitoringState MonitoringState `json:"monitoringState,omitempty"` - VirtualizationState VirtualizationState `json:"virtualizationState,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - ComputerName *string `json:"computerName,omitempty"` - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - BootTime *date.Time `json:"bootTime,omitempty"` - Timezone *Timezone `json:"timezone,omitempty"` - Agent *AgentConfiguration `json:"agent,omitempty"` - Resources *MachineResourcesConfiguration `json:"resources,omitempty"` - Networking *NetworkConfiguration `json:"networking,omitempty"` - OperatingSystem *OperatingSystemConfiguration `json:"operatingSystem,omitempty"` - VirtualMachine *VirtualMachineConfiguration `json:"virtualMachine,omitempty"` - Hypervisor *HypervisorConfiguration `json:"hypervisor,omitempty"` -} - -// MachineCollection is collection of Machine resources. -type MachineCollection struct { - autorest.Response `json:"-"` - Value *[]Machine `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// MachineCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client MachineCollection) MachineCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MachineCountsByOperatingSystem is machines by operating system. -type MachineCountsByOperatingSystem struct { - Windows *int32 `json:"windows,omitempty"` - Linux *int32 `json:"linux,omitempty"` -} - -// MachineGroup is a user-defined logical grouping of machines. -type MachineGroup struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - *MachineGroupProperties `json:"properties,omitempty"` -} - -// MachineGroupProperties is resource properties. -type MachineGroupProperties struct { - DisplayName *string `json:"displayName,omitempty"` - Machines *[]MachineReferenceWithHints `json:"machines,omitempty"` -} - -// MachineGroupCollection is collection of Machine Group resources. -type MachineGroupCollection struct { - autorest.Response `json:"-"` - Value *[]MachineGroup `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// MachineGroupCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client MachineGroupCollection) MachineGroupCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// MachineGroupMapRequest is specifies the computation of a machine group -// dependency map. A machine group dependency map includes all direct -// dependencies of a group of machines. -type MachineGroupMapRequest struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - MachineGroupID *string `json:"machineGroupId,omitempty"` - FilterProcesses *bool `json:"filterProcesses,omitempty"` -} - -// MachineReference is reference to a machine. -type MachineReference struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// MachineReferenceWithHints is a machine reference with a hint of the -// machine's name and operating system. -type MachineReferenceWithHints struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *MachineReferenceWithHintsProperties `json:"properties,omitempty"` -} - -// MachineReferenceWithHintsProperties is machine reference with name and os -// hints. -type MachineReferenceWithHintsProperties struct { - DisplayNameHint *string `json:"displayNameHint,omitempty"` - OsFamilyHint OperatingSystemFamily `json:"osFamilyHint,omitempty"` -} - -// MachineResourcesConfiguration is describes the resources of a machine. -type MachineResourcesConfiguration struct { - PhysicalMemory *int32 `json:"physicalMemory,omitempty"` - Cpus *int32 `json:"cpus,omitempty"` - CPUSpeed *int32 `json:"cpuSpeed,omitempty"` - CPUSpeedAccuracy Accuracy `json:"cpuSpeedAccuracy,omitempty"` -} - -// MachinesSummary is a summary of the machines in the workspace. -type MachinesSummary struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *MachinesSummaryProperties `json:"properties,omitempty"` -} - -// MachinesSummaryProperties is summarizes machines in the workspace. -type MachinesSummaryProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Total *int32 `json:"total,omitempty"` - Live *int32 `json:"live,omitempty"` - Os *MachineCountsByOperatingSystem `json:"os,omitempty"` -} - -// Map is a map of resources and relationships between them. -type Map struct { - Nodes *MapNodes `json:"nodes,omitempty"` - Edges *MapEdges `json:"edges,omitempty"` -} - -// MapEdges is the edges (relationships) of a map. -type MapEdges struct { - Connections *[]Connection `json:"connections,omitempty"` - Acceptors *[]Acceptor `json:"acceptors,omitempty"` -} - -// MapNodes is the nodes (entities) of a map. -type MapNodes struct { - Machines *[]Machine `json:"machines,omitempty"` - Processes *[]Process `json:"processes,omitempty"` - Ports *[]Port `json:"Ports,omitempty"` - ClientGroups *[]ClientGroup `json:"ClientGroups,omitempty"` -} - -// MapRequest is specifies the contents of request to generate a map. -type MapRequest struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` -} - -// MapResponse is specified the contents of a map response. -type MapResponse struct { - autorest.Response `json:"-"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Map *Map `json:"map,omitempty"` -} - -// NetworkConfiguration is describes the network configuration of a machine. -type NetworkConfiguration struct { - Ipv4Interfaces *[]Ipv4NetworkInterface `json:"ipv4Interfaces,omitempty"` - Ipv6Interfaces *[]Ipv6NetworkInterface `json:"ipv6Interfaces,omitempty"` - DefaultIpv4Gateways *[]string `json:"defaultIpv4Gateways,omitempty"` - MacAddresses *[]string `json:"macAddresses,omitempty"` - DNSNames *[]string `json:"dnsNames,omitempty"` -} - -// OperatingSystemConfiguration is describes the configuration of the operating -// system of a machine. -type OperatingSystemConfiguration struct { - Family OperatingSystemFamily `json:"family,omitempty"` - FullName *string `json:"fullName,omitempty"` - Bitness Bitness `json:"bitness,omitempty"` -} - -// Port is a port resource represents a server port on a machine. The port may -// be actively *monitored*, i.e., a Dependency Agent is running on its machine, -// or *discovered*, i.e., its existence was inferred by observing the data -// stream from monitored machines. A port is live during an interval of time, -// if that port had associated activity during (parts) of that interval. -type Port struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - *PortProperties `json:"properties,omitempty"` -} - -// PortProperties is resource properties. -type PortProperties struct { - MonitoringState MonitoringState `json:"monitoringState,omitempty"` - Machine *ResourceReference `json:"machine,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - IPAddress *string `json:"ipAddress,omitempty"` - PortNumber *int32 `json:"portNumber,omitempty"` -} - -// PortCollection is collection of Port resources. -type PortCollection struct { - autorest.Response `json:"-"` - Value *[]Port `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PortCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PortCollection) PortCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PortReference is reference to a port. -type PortReference struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *PortReferenceProperties `json:"properties,omitempty"` -} - -// PortReferenceProperties is resource properties. -type PortReferenceProperties struct { - Machine *MachineReference `json:"machine,omitempty"` - IPAddress *string `json:"ipAddress,omitempty"` - PortNumber *int32 `json:"portNumber,omitempty"` -} - -// Process is a process resource represents a process running on a machine. The -// process may be actively *monitored*, i.e., a Dependency Agent is running on -// its machine, or *discovered*, i.e., its existence was inferred by observing -// the data stream from monitored machines. A process resource represents a -// pool of actual operating system resources that share command lines and -// metadata. As the process pool evolves over time, prior versions of the -// process resource are preserved and available for access. A process is live -// during an interval of time, if that process is executing during (parts) of -// that interval -type Process struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - Etag *string `json:"etag,omitempty"` - *ProcessProperties `json:"properties,omitempty"` -} - -// ProcessProperties is resource properties. -type ProcessProperties struct { - Timestamp *date.Time `json:"timestamp,omitempty"` - MonitoringState MonitoringState `json:"monitoringState,omitempty"` - Machine *ResourceReference `json:"machine,omitempty"` - ExecutableName *string `json:"executableName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - Role ProcessRole `json:"role,omitempty"` - Details *ProcessDetails `json:"details,omitempty"` - User *ProcessUser `json:"user,omitempty"` - ClientOf *ResourceReference `json:"clientOf,omitempty"` - AcceptorOf *ResourceReference `json:"acceptorOf,omitempty"` -} - -// ProcessCollection is collection of Process resources. -type ProcessCollection struct { - autorest.Response `json:"-"` - Value *[]Process `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ProcessCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ProcessCollection) ProcessCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ProcessDetails is describes process metadata. -type ProcessDetails struct { - PersistentKey *string `json:"persistentKey,omitempty"` - PoolID *int32 `json:"poolId,omitempty"` - FirstPid *int32 `json:"firstPid,omitempty"` - Description *string `json:"description,omitempty"` - CompanyName *string `json:"companyName,omitempty"` - InternalName *string `json:"internalName,omitempty"` - ProductName *string `json:"productName,omitempty"` - ProductVersion *string `json:"productVersion,omitempty"` - FileVersion *string `json:"fileVersion,omitempty"` - CommandLine *string `json:"commandLine,omitempty"` - ExecutablePath *string `json:"executablePath,omitempty"` - WorkingDirectory *string `json:"workingDirectory,omitempty"` -} - -// ProcessReference is reference to a process. -type ProcessReference struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - *ProcessReferenceProperties `json:"properties,omitempty"` -} - -// ProcessReferenceProperties is resource properties. -type ProcessReferenceProperties struct { - Machine *MachineReference `json:"machine,omitempty"` -} - -// ProcessUser is describes the user under which a process is running. -type ProcessUser struct { - UserName *string `json:"userName,omitempty"` - UserDomain *string `json:"userDomain,omitempty"` -} - -// Relationship is a typed relationship between two entities. -type Relationship struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// RelationshipProperties is relationship properties. -type RelationshipProperties struct { - Source *ResourceReference `json:"source,omitempty"` - Destination *ResourceReference `json:"destination,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` -} - -// Resource is resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// ResourceReference is represents a reference to another resource. -type ResourceReference struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// SingleMachineDependencyMapRequest is specifies the computation of a single -// server dependency map. A single server dependency map includes all direct -// dependencies of a given machine. -type SingleMachineDependencyMapRequest struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - MachineID *string `json:"machineId,omitempty"` -} - -// Summary is base for all resource summaries. -type Summary struct { - ID *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` -} - -// SummaryProperties is base for all summaries. -type SummaryProperties struct { - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` -} - -// Timezone is describes a timezone. -type Timezone struct { - FullName *string `json:"fullName,omitempty"` -} - -// VirtualMachineConfiguration is describes the virtualizaton-related -// configuration of a machine. -type VirtualMachineConfiguration struct { - VirtualMachineType VirtualMachineType `json:"virtualMachineType,omitempty"` - NativeMachineID *string `json:"nativeMachineId,omitempty"` - VirtualMachineName *string `json:"virtualMachineName,omitempty"` - NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"` -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// Accuracy enumerates the values for accuracy. +type Accuracy string + +const ( + // Actual specifies the actual state for accuracy. + Actual Accuracy = "actual" + // Estimated specifies the estimated state for accuracy. + Estimated Accuracy = "estimated" +) + +// Bitness enumerates the values for bitness. +type Bitness string + +const ( + // SixFourbit specifies the six fourbit state for bitness. + SixFourbit Bitness = "64bit" + // ThreeTwobit specifies the three twobit state for bitness. + ThreeTwobit Bitness = "32bit" +) + +// ConnectionFailureState enumerates the values for connection failure state. +type ConnectionFailureState string + +const ( + // Failed specifies the failed state for connection failure state. + Failed ConnectionFailureState = "failed" + // Mixed specifies the mixed state for connection failure state. + Mixed ConnectionFailureState = "mixed" + // Ok specifies the ok state for connection failure state. + Ok ConnectionFailureState = "ok" +) + +// HypervisorType enumerates the values for hypervisor type. +type HypervisorType string + +const ( + // Hyperv specifies the hyperv state for hypervisor type. + Hyperv HypervisorType = "hyperv" + // Unknown specifies the unknown state for hypervisor type. + Unknown HypervisorType = "unknown" +) + +// MachineRebootStatus enumerates the values for machine reboot status. +type MachineRebootStatus string + +const ( + // MachineRebootStatusNotRebooted specifies the machine reboot status not + // rebooted state for machine reboot status. + MachineRebootStatusNotRebooted MachineRebootStatus = "notRebooted" + // MachineRebootStatusRebooted specifies the machine reboot status rebooted + // state for machine reboot status. + MachineRebootStatusRebooted MachineRebootStatus = "rebooted" + // MachineRebootStatusUnknown specifies the machine reboot status unknown + // state for machine reboot status. + MachineRebootStatusUnknown MachineRebootStatus = "unknown" +) + +// MonitoringState enumerates the values for monitoring state. +type MonitoringState string + +const ( + // Discovered specifies the discovered state for monitoring state. + Discovered MonitoringState = "discovered" + // Monitored specifies the monitored state for monitoring state. + Monitored MonitoringState = "monitored" +) + +// OperatingSystemFamily enumerates the values for operating system family. +type OperatingSystemFamily string + +const ( + // OperatingSystemFamilyAix specifies the operating system family aix state + // for operating system family. + OperatingSystemFamilyAix OperatingSystemFamily = "aix" + // OperatingSystemFamilyLinux specifies the operating system family linux + // state for operating system family. + OperatingSystemFamilyLinux OperatingSystemFamily = "linux" + // OperatingSystemFamilySolaris specifies the operating system family + // solaris state for operating system family. + OperatingSystemFamilySolaris OperatingSystemFamily = "solaris" + // OperatingSystemFamilyUnknown specifies the operating system family + // unknown state for operating system family. + OperatingSystemFamilyUnknown OperatingSystemFamily = "unknown" + // OperatingSystemFamilyWindows specifies the operating system family + // windows state for operating system family. + OperatingSystemFamilyWindows OperatingSystemFamily = "windows" +) + +// ProcessRole enumerates the values for process role. +type ProcessRole string + +const ( + // AppServer specifies the app server state for process role. + AppServer ProcessRole = "appServer" + // DatabaseServer specifies the database server state for process role. + DatabaseServer ProcessRole = "databaseServer" + // LdapServer specifies the ldap server state for process role. + LdapServer ProcessRole = "ldapServer" + // SmbServer specifies the smb server state for process role. + SmbServer ProcessRole = "smbServer" + // WebServer specifies the web server state for process role. + WebServer ProcessRole = "webServer" +) + +// VirtualizationState enumerates the values for virtualization state. +type VirtualizationState string + +const ( + // VirtualizationStateHypervisor specifies the virtualization state + // hypervisor state for virtualization state. + VirtualizationStateHypervisor VirtualizationState = "hypervisor" + // VirtualizationStatePhysical specifies the virtualization state physical + // state for virtualization state. + VirtualizationStatePhysical VirtualizationState = "physical" + // VirtualizationStateUnknown specifies the virtualization state unknown + // state for virtualization state. + VirtualizationStateUnknown VirtualizationState = "unknown" + // VirtualizationStateVirtual specifies the virtualization state virtual + // state for virtualization state. + VirtualizationStateVirtual VirtualizationState = "virtual" +) + +// VirtualMachineType enumerates the values for virtual machine type. +type VirtualMachineType string + +const ( + // VirtualMachineTypeHyperv specifies the virtual machine type hyperv state + // for virtual machine type. + VirtualMachineTypeHyperv VirtualMachineType = "hyperv" + // VirtualMachineTypeLdom specifies the virtual machine type ldom state for + // virtual machine type. + VirtualMachineTypeLdom VirtualMachineType = "ldom" + // VirtualMachineTypeLpar specifies the virtual machine type lpar state for + // virtual machine type. + VirtualMachineTypeLpar VirtualMachineType = "lpar" + // VirtualMachineTypeUnknown specifies the virtual machine type unknown + // state for virtual machine type. + VirtualMachineTypeUnknown VirtualMachineType = "unknown" + // VirtualMachineTypeVirtualPc specifies the virtual machine type virtual + // pc state for virtual machine type. + VirtualMachineTypeVirtualPc VirtualMachineType = "virtualPc" + // VirtualMachineTypeVmware specifies the virtual machine type vmware state + // for virtual machine type. + VirtualMachineTypeVmware VirtualMachineType = "vmware" + // VirtualMachineTypeXen specifies the virtual machine type xen state for + // virtual machine type. + VirtualMachineTypeXen VirtualMachineType = "xen" +) + +// Acceptor is a process accepting on a port. +type Acceptor struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *AcceptorProperties `json:"properties,omitempty"` +} + +// AcceptorProperties is properties for an acceptor relationship. +type AcceptorProperties struct { + Source *PortReference `json:"source,omitempty"` + Destination *ProcessReference `json:"destination,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` +} + +// AgentConfiguration is describes the configuration of the Dependency Agent +// installed on a machine. +type AgentConfiguration struct { + AgentID *string `json:"agentId,omitempty"` + DependencyAgentID *string `json:"dependencyAgentId,omitempty"` + DependencyAgentVersion *string `json:"dependencyAgentVersion,omitempty"` + DependencyAgentRevision *string `json:"dependencyAgentRevision,omitempty"` + RebootStatus MachineRebootStatus `json:"rebootStatus,omitempty"` + ClockGranularity *int32 `json:"clockGranularity,omitempty"` +} + +// ClientGroup is represents a collection of clients of a resource. A client +// group can represent the clients of a port, process, or a machine. +type ClientGroup struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + *ClientGroupProperties `json:"properties,omitempty"` +} + +// ClientGroupProperties is resource properties. +type ClientGroupProperties struct { + ClientsOf *ResourceReference `json:"clientsOf,omitempty"` +} + +// ClientGroupMember is represents a member of a client group +type ClientGroupMember struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *ClientGroupMemberProperties `json:"properties,omitempty"` +} + +// ClientGroupMemberProperties is resource properties. +type ClientGroupMemberProperties struct { + IPAddress *string `json:"ipAddress,omitempty"` + Port *PortReference `json:"port,omitempty"` + Processes *[]ProcessReference `json:"processes,omitempty"` +} + +// ClientGroupMembersCollection is collection of ClientGroupMember resources. +type ClientGroupMembersCollection struct { + autorest.Response `json:"-"` + Value *[]ClientGroupMember `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClientGroupMembersCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClientGroupMembersCollection) ClientGroupMembersCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClientGroupMembersCount is specifies the number of members in a client +// group. +type ClientGroupMembersCount struct { + autorest.Response `json:"-"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + GroupID *string `json:"groupId,omitempty"` + Count *int32 `json:"count,omitempty"` + Accuracy Accuracy `json:"accuracy,omitempty"` +} + +// Connection is a network connection. +type Connection struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *ConnectionProperties `json:"properties,omitempty"` +} + +// ConnectionCollection is collection of Connection resources. +type ConnectionCollection struct { + autorest.Response `json:"-"` + Value *[]Connection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ConnectionCollection) ConnectionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ConnectionProperties is properties for a connection resource. +type ConnectionProperties struct { + Source *ResourceReference `json:"source,omitempty"` + Destination *ResourceReference `json:"destination,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ServerPort *PortReference `json:"serverPort,omitempty"` + FailureState ConnectionFailureState `json:"failureState,omitempty"` +} + +// CoreResource is marker resource for the core Service Map resources +type CoreResource struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` +} + +// Error is error details. +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ErrorResponse is an error response from the API. +type ErrorResponse struct { + Error *Error `json:"error,omitempty"` +} + +// HypervisorConfiguration is describes the hypervisor configuration of a +// machine. +type HypervisorConfiguration struct { + HypervisorType HypervisorType `json:"hypervisorType,omitempty"` + NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"` +} + +// Ipv4NetworkInterface is describes an IPv4 network interface. +type Ipv4NetworkInterface struct { + IPAddress *string `json:"ipAddress,omitempty"` + SubnetMask *string `json:"subnetMask,omitempty"` +} + +// Ipv6NetworkInterface is describes an IPv6 network interface. +type Ipv6NetworkInterface struct { + IPAddress *string `json:"ipAddress,omitempty"` +} + +// Liveness is specifies the contents of a check liveness response. +type Liveness struct { + autorest.Response `json:"-"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Live *bool `json:"live,omitempty"` +} + +// Machine is a machine resource represents a discovered computer system. It +// can be *monitored*, i.e., a Dependency Agent is running on it, or +// *discovered*, i.e., its existence was inferred by observing the data stream +// from monitored machines. As machines change, prior versions of the machine +// resource are preserved and available for access. A machine is live during an +// interval of time, if either its Dependency Agent has reported data during +// (parts) of that interval, or a Dependency agent running on other machines +// has reported activity associated with the machine. +type Machine struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + *MachineProperties `json:"properties,omitempty"` +} + +// MachineProperties is resource properties. +type MachineProperties struct { + Timestamp *date.Time `json:"timestamp,omitempty"` + MonitoringState MonitoringState `json:"monitoringState,omitempty"` + VirtualizationState VirtualizationState `json:"virtualizationState,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + BootTime *date.Time `json:"bootTime,omitempty"` + Timezone *Timezone `json:"timezone,omitempty"` + Agent *AgentConfiguration `json:"agent,omitempty"` + Resources *MachineResourcesConfiguration `json:"resources,omitempty"` + Networking *NetworkConfiguration `json:"networking,omitempty"` + OperatingSystem *OperatingSystemConfiguration `json:"operatingSystem,omitempty"` + VirtualMachine *VirtualMachineConfiguration `json:"virtualMachine,omitempty"` + Hypervisor *HypervisorConfiguration `json:"hypervisor,omitempty"` +} + +// MachineCollection is collection of Machine resources. +type MachineCollection struct { + autorest.Response `json:"-"` + Value *[]Machine `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// MachineCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client MachineCollection) MachineCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// MachineCountsByOperatingSystem is machines by operating system. +type MachineCountsByOperatingSystem struct { + Windows *int32 `json:"windows,omitempty"` + Linux *int32 `json:"linux,omitempty"` +} + +// MachineGroup is a user-defined logical grouping of machines. +type MachineGroup struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + *MachineGroupProperties `json:"properties,omitempty"` +} + +// MachineGroupProperties is resource properties. +type MachineGroupProperties struct { + DisplayName *string `json:"displayName,omitempty"` + Machines *[]MachineReferenceWithHints `json:"machines,omitempty"` +} + +// MachineGroupCollection is collection of Machine Group resources. +type MachineGroupCollection struct { + autorest.Response `json:"-"` + Value *[]MachineGroup `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// MachineGroupCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client MachineGroupCollection) MachineGroupCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// MachineGroupMapRequest is specifies the computation of a machine group +// dependency map. A machine group dependency map includes all direct +// dependencies of a group of machines. +type MachineGroupMapRequest struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + MachineGroupID *string `json:"machineGroupId,omitempty"` + FilterProcesses *bool `json:"filterProcesses,omitempty"` +} + +// MachineReference is reference to a machine. +type MachineReference struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// MachineReferenceWithHints is a machine reference with a hint of the +// machine's name and operating system. +type MachineReferenceWithHints struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *MachineReferenceWithHintsProperties `json:"properties,omitempty"` +} + +// MachineReferenceWithHintsProperties is machine reference with name and os +// hints. +type MachineReferenceWithHintsProperties struct { + DisplayNameHint *string `json:"displayNameHint,omitempty"` + OsFamilyHint OperatingSystemFamily `json:"osFamilyHint,omitempty"` +} + +// MachineResourcesConfiguration is describes the resources of a machine. +type MachineResourcesConfiguration struct { + PhysicalMemory *int32 `json:"physicalMemory,omitempty"` + Cpus *int32 `json:"cpus,omitempty"` + CPUSpeed *int32 `json:"cpuSpeed,omitempty"` + CPUSpeedAccuracy Accuracy `json:"cpuSpeedAccuracy,omitempty"` +} + +// MachinesSummary is a summary of the machines in the workspace. +type MachinesSummary struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *MachinesSummaryProperties `json:"properties,omitempty"` +} + +// MachinesSummaryProperties is summarizes machines in the workspace. +type MachinesSummaryProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Total *int32 `json:"total,omitempty"` + Live *int32 `json:"live,omitempty"` + Os *MachineCountsByOperatingSystem `json:"os,omitempty"` +} + +// Map is a map of resources and relationships between them. +type Map struct { + Nodes *MapNodes `json:"nodes,omitempty"` + Edges *MapEdges `json:"edges,omitempty"` +} + +// MapEdges is the edges (relationships) of a map. +type MapEdges struct { + Connections *[]Connection `json:"connections,omitempty"` + Acceptors *[]Acceptor `json:"acceptors,omitempty"` +} + +// MapNodes is the nodes (entities) of a map. +type MapNodes struct { + Machines *[]Machine `json:"machines,omitempty"` + Processes *[]Process `json:"processes,omitempty"` + Ports *[]Port `json:"Ports,omitempty"` + ClientGroups *[]ClientGroup `json:"ClientGroups,omitempty"` +} + +// MapRequest is specifies the contents of request to generate a map. +type MapRequest struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` +} + +// MapResponse is specified the contents of a map response. +type MapResponse struct { + autorest.Response `json:"-"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Map *Map `json:"map,omitempty"` +} + +// NetworkConfiguration is describes the network configuration of a machine. +type NetworkConfiguration struct { + Ipv4Interfaces *[]Ipv4NetworkInterface `json:"ipv4Interfaces,omitempty"` + Ipv6Interfaces *[]Ipv6NetworkInterface `json:"ipv6Interfaces,omitempty"` + DefaultIpv4Gateways *[]string `json:"defaultIpv4Gateways,omitempty"` + MacAddresses *[]string `json:"macAddresses,omitempty"` + DNSNames *[]string `json:"dnsNames,omitempty"` +} + +// OperatingSystemConfiguration is describes the configuration of the operating +// system of a machine. +type OperatingSystemConfiguration struct { + Family OperatingSystemFamily `json:"family,omitempty"` + FullName *string `json:"fullName,omitempty"` + Bitness Bitness `json:"bitness,omitempty"` +} + +// Port is a port resource represents a server port on a machine. The port may +// be actively *monitored*, i.e., a Dependency Agent is running on its machine, +// or *discovered*, i.e., its existence was inferred by observing the data +// stream from monitored machines. A port is live during an interval of time, +// if that port had associated activity during (parts) of that interval. +type Port struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + *PortProperties `json:"properties,omitempty"` +} + +// PortProperties is resource properties. +type PortProperties struct { + MonitoringState MonitoringState `json:"monitoringState,omitempty"` + Machine *ResourceReference `json:"machine,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + PortNumber *int32 `json:"portNumber,omitempty"` +} + +// PortCollection is collection of Port resources. +type PortCollection struct { + autorest.Response `json:"-"` + Value *[]Port `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PortCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PortCollection) PortCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PortReference is reference to a port. +type PortReference struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *PortReferenceProperties `json:"properties,omitempty"` +} + +// PortReferenceProperties is resource properties. +type PortReferenceProperties struct { + Machine *MachineReference `json:"machine,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + PortNumber *int32 `json:"portNumber,omitempty"` +} + +// Process is a process resource represents a process running on a machine. The +// process may be actively *monitored*, i.e., a Dependency Agent is running on +// its machine, or *discovered*, i.e., its existence was inferred by observing +// the data stream from monitored machines. A process resource represents a +// pool of actual operating system resources that share command lines and +// metadata. As the process pool evolves over time, prior versions of the +// process resource are preserved and available for access. A process is live +// during an interval of time, if that process is executing during (parts) of +// that interval +type Process struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Etag *string `json:"etag,omitempty"` + *ProcessProperties `json:"properties,omitempty"` +} + +// ProcessProperties is resource properties. +type ProcessProperties struct { + Timestamp *date.Time `json:"timestamp,omitempty"` + MonitoringState MonitoringState `json:"monitoringState,omitempty"` + Machine *ResourceReference `json:"machine,omitempty"` + ExecutableName *string `json:"executableName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + Role ProcessRole `json:"role,omitempty"` + Details *ProcessDetails `json:"details,omitempty"` + User *ProcessUser `json:"user,omitempty"` + ClientOf *ResourceReference `json:"clientOf,omitempty"` + AcceptorOf *ResourceReference `json:"acceptorOf,omitempty"` +} + +// ProcessCollection is collection of Process resources. +type ProcessCollection struct { + autorest.Response `json:"-"` + Value *[]Process `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ProcessCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ProcessCollection) ProcessCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ProcessDetails is describes process metadata. +type ProcessDetails struct { + PersistentKey *string `json:"persistentKey,omitempty"` + PoolID *int32 `json:"poolId,omitempty"` + FirstPid *int32 `json:"firstPid,omitempty"` + Description *string `json:"description,omitempty"` + CompanyName *string `json:"companyName,omitempty"` + InternalName *string `json:"internalName,omitempty"` + ProductName *string `json:"productName,omitempty"` + ProductVersion *string `json:"productVersion,omitempty"` + FileVersion *string `json:"fileVersion,omitempty"` + CommandLine *string `json:"commandLine,omitempty"` + ExecutablePath *string `json:"executablePath,omitempty"` + WorkingDirectory *string `json:"workingDirectory,omitempty"` +} + +// ProcessReference is reference to a process. +type ProcessReference struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + *ProcessReferenceProperties `json:"properties,omitempty"` +} + +// ProcessReferenceProperties is resource properties. +type ProcessReferenceProperties struct { + Machine *MachineReference `json:"machine,omitempty"` +} + +// ProcessUser is describes the user under which a process is running. +type ProcessUser struct { + UserName *string `json:"userName,omitempty"` + UserDomain *string `json:"userDomain,omitempty"` +} + +// Relationship is a typed relationship between two entities. +type Relationship struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// RelationshipProperties is relationship properties. +type RelationshipProperties struct { + Source *ResourceReference `json:"source,omitempty"` + Destination *ResourceReference `json:"destination,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` +} + +// Resource is resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// ResourceReference is represents a reference to another resource. +type ResourceReference struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// SingleMachineDependencyMapRequest is specifies the computation of a single +// server dependency map. A single server dependency map includes all direct +// dependencies of a given machine. +type SingleMachineDependencyMapRequest struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + MachineID *string `json:"machineId,omitempty"` +} + +// Summary is base for all resource summaries. +type Summary struct { + ID *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// SummaryProperties is base for all summaries. +type SummaryProperties struct { + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` +} + +// Timezone is describes a timezone. +type Timezone struct { + FullName *string `json:"fullName,omitempty"` +} + +// VirtualMachineConfiguration is describes the virtualizaton-related +// configuration of a machine. +type VirtualMachineConfiguration struct { + VirtualMachineType VirtualMachineType `json:"virtualMachineType,omitempty"` + NativeMachineID *string `json:"nativeMachineId,omitempty"` + VirtualMachineName *string `json:"virtualMachineName,omitempty"` + NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/ports.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/ports.go index 6eda39e2b5..3834e2f9c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/ports.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/ports.go @@ -1,483 +1,483 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// PortsClient is the service Map API Reference -type PortsClient struct { - ManagementClient -} - -// NewPortsClient creates an instance of the PortsClient client. -func NewPortsClient(subscriptionID string) PortsClient { - return NewPortsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPortsClientWithBaseURI creates an instance of the PortsClient client. -func NewPortsClientWithBaseURI(baseURI string, subscriptionID string) PortsClient { - return PortsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns the specified port. The port must be live during the specified -// time interval. If the port is not live during the interval, status 404 (Not -// Found) is returned. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. portName is port resource -// name. startTime is uTC date and time specifying the start time of an -// interval. When not specified the service uses DateTime.UtcNow - 10m endTime -// is uTC date and time specifying the end time of an interval. When not -// specified the service uses DateTime.UtcNow -func (client PortsClient) Get(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result Port, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: portName, - Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client PortsClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "portName": autorest.Encode("path", portName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PortsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PortsClient) GetResponder(resp *http.Response) (result Port, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLiveness obtains the liveness status of the port during the specified -// time interval. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. portName is port resource -// name. startTime is uTC date and time specifying the start time of an -// interval. When not specified the service uses DateTime.UtcNow - 10m endTime -// is uTC date and time specifying the end time of an interval. When not -// specified the service uses DateTime.UtcNow -func (client PortsClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: portName, - Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "GetLiveness") - } - - req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", nil, "Failure preparing request") - return - } - - resp, err := client.GetLivenessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", resp, "Failure sending request") - return - } - - result, err = client.GetLivenessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", resp, "Failure responding to request") - } - - return -} - -// GetLivenessPreparer prepares the GetLiveness request. -func (client PortsClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "portName": autorest.Encode("path", portName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/liveness", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetLivenessSender sends the GetLiveness request. The method will close the -// http.Response Body if it receives an error. -func (client PortsClient) GetLivenessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLivenessResponder handles the response to the GetLiveness request. The method always -// closes the http.Response Body. -func (client PortsClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAcceptingProcesses returns a collection of processes accepting on the -// specified port -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. portName is port resource -// name. startTime is uTC date and time specifying the start time of an -// interval. When not specified the service uses DateTime.UtcNow - 10m endTime -// is uTC date and time specifying the end time of an interval. When not -// specified the service uses DateTime.UtcNow -func (client PortsClient) ListAcceptingProcesses(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result ProcessCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: portName, - Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "ListAcceptingProcesses") - } - - req, err := client.ListAcceptingProcessesPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", nil, "Failure preparing request") - return - } - - resp, err := client.ListAcceptingProcessesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure sending request") - return - } - - result, err = client.ListAcceptingProcessesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure responding to request") - } - - return -} - -// ListAcceptingProcessesPreparer prepares the ListAcceptingProcesses request. -func (client PortsClient) ListAcceptingProcessesPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "portName": autorest.Encode("path", portName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/acceptingProcesses", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAcceptingProcessesSender sends the ListAcceptingProcesses request. The method will close the -// http.Response Body if it receives an error. -func (client PortsClient) ListAcceptingProcessesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAcceptingProcessesResponder handles the response to the ListAcceptingProcesses request. The method always -// closes the http.Response Body. -func (client PortsClient) ListAcceptingProcessesResponder(resp *http.Response) (result ProcessCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAcceptingProcessesNextResults retrieves the next set of results, if any. -func (client PortsClient) ListAcceptingProcessesNextResults(lastResults ProcessCollection) (result ProcessCollection, err error) { - req, err := lastResults.ProcessCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAcceptingProcessesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure sending next results request") - } - - result, err = client.ListAcceptingProcessesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure responding to next results request") - } - - return -} - -// ListConnections returns a collection of connections established via the -// specified port. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. portName is port resource -// name. startTime is uTC date and time specifying the start time of an -// interval. When not specified the service uses DateTime.UtcNow - 10m endTime -// is uTC date and time specifying the end time of an interval. When not -// specified the service uses DateTime.UtcNow -func (client PortsClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: portName, - Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "ListConnections") - } - - req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure responding to request") - } - - return -} - -// ListConnectionsPreparer prepares the ListConnections request. -func (client PortsClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "portName": autorest.Encode("path", portName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConnectionsSender sends the ListConnections request. The method will close the -// http.Response Body if it receives an error. -func (client PortsClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConnectionsResponder handles the response to the ListConnections request. The method always -// closes the http.Response Body. -func (client PortsClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionsNextResults retrieves the next set of results, if any. -func (client PortsClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) { - req, err := lastResults.ConnectionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure sending next results request") - } - - result, err = client.ListConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure responding to next results request") - } - - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// PortsClient is the service Map API Reference +type PortsClient struct { + ManagementClient +} + +// NewPortsClient creates an instance of the PortsClient client. +func NewPortsClient(subscriptionID string) PortsClient { + return NewPortsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPortsClientWithBaseURI creates an instance of the PortsClient client. +func NewPortsClientWithBaseURI(baseURI string, subscriptionID string) PortsClient { + return PortsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns the specified port. The port must be live during the specified +// time interval. If the port is not live during the interval, status 404 (Not +// Found) is returned. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. portName is port resource +// name. startTime is uTC date and time specifying the start time of an +// interval. When not specified the service uses DateTime.UtcNow - 10m endTime +// is uTC date and time specifying the end time of an interval. When not +// specified the service uses DateTime.UtcNow +func (client PortsClient) Get(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result Port, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: portName, + Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PortsClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "portName": autorest.Encode("path", portName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PortsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PortsClient) GetResponder(resp *http.Response) (result Port, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLiveness obtains the liveness status of the port during the specified +// time interval. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. portName is port resource +// name. startTime is uTC date and time specifying the start time of an +// interval. When not specified the service uses DateTime.UtcNow - 10m endTime +// is uTC date and time specifying the end time of an interval. When not +// specified the service uses DateTime.UtcNow +func (client PortsClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: portName, + Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "GetLiveness") + } + + req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", nil, "Failure preparing request") + return + } + + resp, err := client.GetLivenessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", resp, "Failure sending request") + return + } + + result, err = client.GetLivenessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", resp, "Failure responding to request") + } + + return +} + +// GetLivenessPreparer prepares the GetLiveness request. +func (client PortsClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "portName": autorest.Encode("path", portName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/liveness", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetLivenessSender sends the GetLiveness request. The method will close the +// http.Response Body if it receives an error. +func (client PortsClient) GetLivenessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLivenessResponder handles the response to the GetLiveness request. The method always +// closes the http.Response Body. +func (client PortsClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAcceptingProcesses returns a collection of processes accepting on the +// specified port +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. portName is port resource +// name. startTime is uTC date and time specifying the start time of an +// interval. When not specified the service uses DateTime.UtcNow - 10m endTime +// is uTC date and time specifying the end time of an interval. When not +// specified the service uses DateTime.UtcNow +func (client PortsClient) ListAcceptingProcesses(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result ProcessCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: portName, + Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "ListAcceptingProcesses") + } + + req, err := client.ListAcceptingProcessesPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", nil, "Failure preparing request") + return + } + + resp, err := client.ListAcceptingProcessesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure sending request") + return + } + + result, err = client.ListAcceptingProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure responding to request") + } + + return +} + +// ListAcceptingProcessesPreparer prepares the ListAcceptingProcesses request. +func (client PortsClient) ListAcceptingProcessesPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "portName": autorest.Encode("path", portName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/acceptingProcesses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAcceptingProcessesSender sends the ListAcceptingProcesses request. The method will close the +// http.Response Body if it receives an error. +func (client PortsClient) ListAcceptingProcessesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAcceptingProcessesResponder handles the response to the ListAcceptingProcesses request. The method always +// closes the http.Response Body. +func (client PortsClient) ListAcceptingProcessesResponder(resp *http.Response) (result ProcessCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAcceptingProcessesNextResults retrieves the next set of results, if any. +func (client PortsClient) ListAcceptingProcessesNextResults(lastResults ProcessCollection) (result ProcessCollection, err error) { + req, err := lastResults.ProcessCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAcceptingProcessesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure sending next results request") + } + + result, err = client.ListAcceptingProcessesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure responding to next results request") + } + + return +} + +// ListConnections returns a collection of connections established via the +// specified port. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. portName is port resource +// name. startTime is uTC date and time specifying the start time of an +// interval. When not specified the service uses DateTime.UtcNow - 10m endTime +// is uTC date and time specifying the end time of an interval. When not +// specified the service uses DateTime.UtcNow +func (client PortsClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: portName, + Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "ListConnections") + } + + req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure responding to request") + } + + return +} + +// ListConnectionsPreparer prepares the ListConnections request. +func (client PortsClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "portName": autorest.Encode("path", portName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionsSender sends the ListConnections request. The method will close the +// http.Response Body if it receives an error. +func (client PortsClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionsResponder handles the response to the ListConnections request. The method always +// closes the http.Response Body. +func (client PortsClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionsNextResults retrieves the next set of results, if any. +func (client PortsClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) { + req, err := lastResults.ConnectionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure sending next results request") + } + + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/processes.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/processes.go index adfac3e59c..f36e4b888e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/processes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/processes.go @@ -1,478 +1,478 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ProcessesClient is the service Map API Reference -type ProcessesClient struct { - ManagementClient -} - -// NewProcessesClient creates an instance of the ProcessesClient client. -func NewProcessesClient(subscriptionID string) ProcessesClient { - return NewProcessesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProcessesClientWithBaseURI creates an instance of the ProcessesClient -// client. -func NewProcessesClientWithBaseURI(baseURI string, subscriptionID string) ProcessesClient { - return ProcessesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns the specified process. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. processName is process -// resource name. timestamp is uTC date and time specifying a time instance -// relative to which to evaluate a resource. When not specified, the service -// uses DateTime.UtcNow. -func (client ProcessesClient) Get(resourceGroupName string, workspaceName string, machineName string, processName string, timestamp *date.Time) (result Process, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: processName, - Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, processName, timestamp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProcessesClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, timestamp *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "processName": autorest.Encode("path", processName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if timestamp != nil { - queryParameters["timestamp"] = autorest.Encode("query", *timestamp) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProcessesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProcessesClient) GetResponder(resp *http.Response) (result Process, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetLiveness obtains the liveness status of the process during the specified -// time interval. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. processName is process -// resource name. startTime is uTC date and time specifying the start time of -// an interval. When not specified the service uses DateTime.UtcNow - 10m -// endTime is uTC date and time specifying the end time of an interval. When -// not specified the service uses DateTime.UtcNow -func (client ProcessesClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: processName, - Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "GetLiveness") - } - - req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", nil, "Failure preparing request") - return - } - - resp, err := client.GetLivenessSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", resp, "Failure sending request") - return - } - - result, err = client.GetLivenessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", resp, "Failure responding to request") - } - - return -} - -// GetLivenessPreparer prepares the GetLiveness request. -func (client ProcessesClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "processName": autorest.Encode("path", processName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/liveness", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetLivenessSender sends the GetLiveness request. The method will close the -// http.Response Body if it receives an error. -func (client ProcessesClient) GetLivenessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLivenessResponder handles the response to the GetLiveness request. The method always -// closes the http.Response Body. -func (client ProcessesClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAcceptingPorts returns a collection of ports on which this process is -// accepting -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. processName is process -// resource name. startTime is uTC date and time specifying the start time of -// an interval. When not specified the service uses DateTime.UtcNow - 10m -// endTime is uTC date and time specifying the end time of an interval. When -// not specified the service uses DateTime.UtcNow -func (client ProcessesClient) ListAcceptingPorts(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result PortCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: processName, - Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "ListAcceptingPorts") - } - - req, err := client.ListAcceptingPortsPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", nil, "Failure preparing request") - return - } - - resp, err := client.ListAcceptingPortsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure sending request") - return - } - - result, err = client.ListAcceptingPortsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure responding to request") - } - - return -} - -// ListAcceptingPortsPreparer prepares the ListAcceptingPorts request. -func (client ProcessesClient) ListAcceptingPortsPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "processName": autorest.Encode("path", processName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/acceptingPorts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAcceptingPortsSender sends the ListAcceptingPorts request. The method will close the -// http.Response Body if it receives an error. -func (client ProcessesClient) ListAcceptingPortsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAcceptingPortsResponder handles the response to the ListAcceptingPorts request. The method always -// closes the http.Response Body. -func (client ProcessesClient) ListAcceptingPortsResponder(resp *http.Response) (result PortCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAcceptingPortsNextResults retrieves the next set of results, if any. -func (client ProcessesClient) ListAcceptingPortsNextResults(lastResults PortCollection) (result PortCollection, err error) { - req, err := lastResults.PortCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAcceptingPortsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure sending next results request") - } - - result, err = client.ListAcceptingPortsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure responding to next results request") - } - - return -} - -// ListConnections returns a collection of connections terminating or -// originating at the specified process -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. machineName is machine resource name. processName is process -// resource name. startTime is uTC date and time specifying the start time of -// an interval. When not specified the service uses DateTime.UtcNow - 10m -// endTime is uTC date and time specifying the end time of an interval. When -// not specified the service uses DateTime.UtcNow -func (client ProcessesClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, - {TargetValue: machineName, - Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: processName, - Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, - {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "ListConnections") - } - - req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure responding to request") - } - - return -} - -// ListConnectionsPreparer prepares the ListConnections request. -func (client ProcessesClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "processName": autorest.Encode("path", processName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/connections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConnectionsSender sends the ListConnections request. The method will close the -// http.Response Body if it receives an error. -func (client ProcessesClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConnectionsResponder handles the response to the ListConnections request. The method always -// closes the http.Response Body. -func (client ProcessesClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionsNextResults retrieves the next set of results, if any. -func (client ProcessesClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) { - req, err := lastResults.ConnectionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure sending next results request") - } - - result, err = client.ListConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure responding to next results request") - } - - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ProcessesClient is the service Map API Reference +type ProcessesClient struct { + ManagementClient +} + +// NewProcessesClient creates an instance of the ProcessesClient client. +func NewProcessesClient(subscriptionID string) ProcessesClient { + return NewProcessesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProcessesClientWithBaseURI creates an instance of the ProcessesClient +// client. +func NewProcessesClientWithBaseURI(baseURI string, subscriptionID string) ProcessesClient { + return ProcessesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns the specified process. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. processName is process +// resource name. timestamp is uTC date and time specifying a time instance +// relative to which to evaluate a resource. When not specified, the service +// uses DateTime.UtcNow. +func (client ProcessesClient) Get(resourceGroupName string, workspaceName string, machineName string, processName string, timestamp *date.Time) (result Process, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: processName, + Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, processName, timestamp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProcessesClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, timestamp *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "processName": autorest.Encode("path", processName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if timestamp != nil { + queryParameters["timestamp"] = autorest.Encode("query", *timestamp) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProcessesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProcessesClient) GetResponder(resp *http.Response) (result Process, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLiveness obtains the liveness status of the process during the specified +// time interval. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. processName is process +// resource name. startTime is uTC date and time specifying the start time of +// an interval. When not specified the service uses DateTime.UtcNow - 10m +// endTime is uTC date and time specifying the end time of an interval. When +// not specified the service uses DateTime.UtcNow +func (client ProcessesClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: processName, + Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "GetLiveness") + } + + req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", nil, "Failure preparing request") + return + } + + resp, err := client.GetLivenessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", resp, "Failure sending request") + return + } + + result, err = client.GetLivenessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", resp, "Failure responding to request") + } + + return +} + +// GetLivenessPreparer prepares the GetLiveness request. +func (client ProcessesClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "processName": autorest.Encode("path", processName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/liveness", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetLivenessSender sends the GetLiveness request. The method will close the +// http.Response Body if it receives an error. +func (client ProcessesClient) GetLivenessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLivenessResponder handles the response to the GetLiveness request. The method always +// closes the http.Response Body. +func (client ProcessesClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAcceptingPorts returns a collection of ports on which this process is +// accepting +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. processName is process +// resource name. startTime is uTC date and time specifying the start time of +// an interval. When not specified the service uses DateTime.UtcNow - 10m +// endTime is uTC date and time specifying the end time of an interval. When +// not specified the service uses DateTime.UtcNow +func (client ProcessesClient) ListAcceptingPorts(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result PortCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: processName, + Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "ListAcceptingPorts") + } + + req, err := client.ListAcceptingPortsPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", nil, "Failure preparing request") + return + } + + resp, err := client.ListAcceptingPortsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure sending request") + return + } + + result, err = client.ListAcceptingPortsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure responding to request") + } + + return +} + +// ListAcceptingPortsPreparer prepares the ListAcceptingPorts request. +func (client ProcessesClient) ListAcceptingPortsPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "processName": autorest.Encode("path", processName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/acceptingPorts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAcceptingPortsSender sends the ListAcceptingPorts request. The method will close the +// http.Response Body if it receives an error. +func (client ProcessesClient) ListAcceptingPortsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAcceptingPortsResponder handles the response to the ListAcceptingPorts request. The method always +// closes the http.Response Body. +func (client ProcessesClient) ListAcceptingPortsResponder(resp *http.Response) (result PortCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAcceptingPortsNextResults retrieves the next set of results, if any. +func (client ProcessesClient) ListAcceptingPortsNextResults(lastResults PortCollection) (result PortCollection, err error) { + req, err := lastResults.PortCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAcceptingPortsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure sending next results request") + } + + result, err = client.ListAcceptingPortsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure responding to next results request") + } + + return +} + +// ListConnections returns a collection of connections terminating or +// originating at the specified process +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. machineName is machine resource name. processName is process +// resource name. startTime is uTC date and time specifying the start time of +// an interval. When not specified the service uses DateTime.UtcNow - 10m +// endTime is uTC date and time specifying the end time of an interval. When +// not specified the service uses DateTime.UtcNow +func (client ProcessesClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}, + {TargetValue: machineName, + Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: processName, + Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil}, + {Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "ListConnections") + } + + req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure responding to request") + } + + return +} + +// ListConnectionsPreparer prepares the ListConnections request. +func (client ProcessesClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "processName": autorest.Encode("path", processName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionsSender sends the ListConnections request. The method will close the +// http.Response Body if it receives an error. +func (client ProcessesClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionsResponder handles the response to the ListConnections request. The method always +// closes the http.Response Body. +func (client ProcessesClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionsNextResults retrieves the next set of results, if any. +func (client ProcessesClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) { + req, err := lastResults.ConnectionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure sending next results request") + } + + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/summaries.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/summaries.go index c4848b4b22..fa099ea9b1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/summaries.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/summaries.go @@ -1,131 +1,131 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SummariesClient is the service Map API Reference -type SummariesClient struct { - ManagementClient -} - -// NewSummariesClient creates an instance of the SummariesClient client. -func NewSummariesClient(subscriptionID string) SummariesClient { - return NewSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSummariesClientWithBaseURI creates an instance of the SummariesClient -// client. -func NewSummariesClientWithBaseURI(baseURI string, subscriptionID string) SummariesClient { - return SummariesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetMachines returns summary information about the machines in the workspace. -// -// resourceGroupName is resource group name within the specified -// subscriptionId. workspaceName is oMS workspace containing the resources of -// interest. startTime is uTC date and time specifying the start time of an -// interval. When not specified the service uses DateTime.UtcNow - 10m endTime -// is uTC date and time specifying the end time of an interval. When not -// specified the service uses DateTime.UtcNow -func (client SummariesClient) GetMachines(resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (result MachinesSummary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, - {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicemap.SummariesClient", "GetMachines") - } - - req, err := client.GetMachinesPreparer(resourceGroupName, workspaceName, startTime, endTime) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", nil, "Failure preparing request") - return - } - - resp, err := client.GetMachinesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", resp, "Failure sending request") - return - } - - result, err = client.GetMachinesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", resp, "Failure responding to request") - } - - return -} - -// GetMachinesPreparer prepares the GetMachines request. -func (client SummariesClient) GetMachinesPreparer(resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2015-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if startTime != nil { - queryParameters["startTime"] = autorest.Encode("query", *startTime) - } - if endTime != nil { - queryParameters["endTime"] = autorest.Encode("query", *endTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/summaries/machines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMachinesSender sends the GetMachines request. The method will close the -// http.Response Body if it receives an error. -func (client SummariesClient) GetMachinesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMachinesResponder handles the response to the GetMachines request. The method always -// closes the http.Response Body. -func (client SummariesClient) GetMachinesResponder(resp *http.Response) (result MachinesSummary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SummariesClient is the service Map API Reference +type SummariesClient struct { + ManagementClient +} + +// NewSummariesClient creates an instance of the SummariesClient client. +func NewSummariesClient(subscriptionID string) SummariesClient { + return NewSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSummariesClientWithBaseURI creates an instance of the SummariesClient +// client. +func NewSummariesClientWithBaseURI(baseURI string, subscriptionID string) SummariesClient { + return SummariesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetMachines returns summary information about the machines in the workspace. +// +// resourceGroupName is resource group name within the specified +// subscriptionId. workspaceName is oMS workspace containing the resources of +// interest. startTime is uTC date and time specifying the start time of an +// interval. When not specified the service uses DateTime.UtcNow - 10m endTime +// is uTC date and time specifying the end time of an interval. When not +// specified the service uses DateTime.UtcNow +func (client SummariesClient) GetMachines(resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (result MachinesSummary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicemap.SummariesClient", "GetMachines") + } + + req, err := client.GetMachinesPreparer(resourceGroupName, workspaceName, startTime, endTime) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", nil, "Failure preparing request") + return + } + + resp, err := client.GetMachinesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", resp, "Failure sending request") + return + } + + result, err = client.GetMachinesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", resp, "Failure responding to request") + } + + return +} + +// GetMachinesPreparer prepares the GetMachines request. +func (client SummariesClient) GetMachinesPreparer(resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if startTime != nil { + queryParameters["startTime"] = autorest.Encode("query", *startTime) + } + if endTime != nil { + queryParameters["endTime"] = autorest.Encode("query", *endTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/summaries/machines", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMachinesSender sends the GetMachines request. The method will close the +// http.Response Body if it receives an error. +func (client SummariesClient) GetMachinesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMachinesResponder handles the response to the GetMachines request. The method always +// closes the http.Response Body. +func (client SummariesClient) GetMachinesResponder(resp *http.Response) (result MachinesSummary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/version.go index 53e6cdf777..92fbab1cce 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/service-map/version.go @@ -1,29 +1,29 @@ -package servicemap - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-servicemap/2015-11-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package servicemap + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-servicemap/2015-11-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/client.go index e3ae8533ca..446baff176 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/client.go @@ -1,53 +1,53 @@ -// Package servicebus implements the Azure ARM Servicebus service API version -// 2015-08-01. -// -// Azure Service Bus client -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Servicebus - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Servicebus. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package servicebus implements the Azure ARM Servicebus service API version +// 2015-08-01. +// +// Azure Service Bus client +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Servicebus + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Servicebus. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/models.go index eba584932b..1cb4882ff6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/models.go @@ -1,571 +1,571 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // Listen specifies the listen state for access rights. - Listen AccessRights = "Listen" - // Manage specifies the manage state for access rights. - Manage AccessRights = "Manage" - // Send specifies the send state for access rights. - Send AccessRights = "Send" -) - -// EntityAvailabilityStatus enumerates the values for entity availability -// status. -type EntityAvailabilityStatus string - -const ( - // Available specifies the available state for entity availability status. - Available EntityAvailabilityStatus = "Available" - // Limited specifies the limited state for entity availability status. - Limited EntityAvailabilityStatus = "Limited" - // Renaming specifies the renaming state for entity availability status. - Renaming EntityAvailabilityStatus = "Renaming" - // Restoring specifies the restoring state for entity availability status. - Restoring EntityAvailabilityStatus = "Restoring" - // Unknown specifies the unknown state for entity availability status. - Unknown EntityAvailabilityStatus = "Unknown" -) - -// EntityStatus enumerates the values for entity status. -type EntityStatus string - -const ( - // EntityStatusActive specifies the entity status active state for entity - // status. - EntityStatusActive EntityStatus = "Active" - // EntityStatusCreating specifies the entity status creating state for - // entity status. - EntityStatusCreating EntityStatus = "Creating" - // EntityStatusDeleting specifies the entity status deleting state for - // entity status. - EntityStatusDeleting EntityStatus = "Deleting" - // EntityStatusDisabled specifies the entity status disabled state for - // entity status. - EntityStatusDisabled EntityStatus = "Disabled" - // EntityStatusReceiveDisabled specifies the entity status receive disabled - // state for entity status. - EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" - // EntityStatusRenaming specifies the entity status renaming state for - // entity status. - EntityStatusRenaming EntityStatus = "Renaming" - // EntityStatusRestoring specifies the entity status restoring state for - // entity status. - EntityStatusRestoring EntityStatus = "Restoring" - // EntityStatusSendDisabled specifies the entity status send disabled state - // for entity status. - EntityStatusSendDisabled EntityStatus = "SendDisabled" - // EntityStatusUnknown specifies the entity status unknown state for entity - // status. - EntityStatusUnknown EntityStatus = "Unknown" -) - -// NamespaceState enumerates the values for namespace state. -type NamespaceState string - -const ( - // NamespaceStateActivating specifies the namespace state activating state - // for namespace state. - NamespaceStateActivating NamespaceState = "Activating" - // NamespaceStateActive specifies the namespace state active state for - // namespace state. - NamespaceStateActive NamespaceState = "Active" - // NamespaceStateCreated specifies the namespace state created state for - // namespace state. - NamespaceStateCreated NamespaceState = "Created" - // NamespaceStateCreating specifies the namespace state creating state for - // namespace state. - NamespaceStateCreating NamespaceState = "Creating" - // NamespaceStateDisabled specifies the namespace state disabled state for - // namespace state. - NamespaceStateDisabled NamespaceState = "Disabled" - // NamespaceStateDisabling specifies the namespace state disabling state - // for namespace state. - NamespaceStateDisabling NamespaceState = "Disabling" - // NamespaceStateEnabling specifies the namespace state enabling state for - // namespace state. - NamespaceStateEnabling NamespaceState = "Enabling" - // NamespaceStateFailed specifies the namespace state failed state for - // namespace state. - NamespaceStateFailed NamespaceState = "Failed" - // NamespaceStateRemoved specifies the namespace state removed state for - // namespace state. - NamespaceStateRemoved NamespaceState = "Removed" - // NamespaceStateRemoving specifies the namespace state removing state for - // namespace state. - NamespaceStateRemoving NamespaceState = "Removing" - // NamespaceStateSoftDeleted specifies the namespace state soft deleted - // state for namespace state. - NamespaceStateSoftDeleted NamespaceState = "SoftDeleted" - // NamespaceStateSoftDeleting specifies the namespace state soft deleting - // state for namespace state. - NamespaceStateSoftDeleting NamespaceState = "SoftDeleting" - // NamespaceStateUnknown specifies the namespace state unknown state for - // namespace state. - NamespaceStateUnknown NamespaceState = "Unknown" -) - -// Policykey enumerates the values for policykey. -type Policykey string - -const ( - // PrimaryKey specifies the primary key state for policykey. - PrimaryKey Policykey = "PrimaryKey" - // SecondaryKey specifies the secondary key state for policykey. - SecondaryKey Policykey = "SecondaryKey" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // Basic specifies the basic state for sku name. - Basic SkuName = "Basic" - // Premium specifies the premium state for sku name. - Premium SkuName = "Premium" - // Standard specifies the standard state for sku name. - Standard SkuName = "Standard" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic specifies the sku tier basic state for sku tier. - SkuTierBasic SkuTier = "Basic" - // SkuTierPremium specifies the sku tier premium state for sku tier. - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard specifies the sku tier standard state for sku tier. - SkuTierStandard SkuTier = "Standard" -) - -// UnavailableReason enumerates the values for unavailable reason. -type UnavailableReason string - -const ( - // InvalidName specifies the invalid name state for unavailable reason. - InvalidName UnavailableReason = "InvalidName" - // NameInLockdown specifies the name in lockdown state for unavailable - // reason. - NameInLockdown UnavailableReason = "NameInLockdown" - // NameInUse specifies the name in use state for unavailable reason. - NameInUse UnavailableReason = "NameInUse" - // None specifies the none state for unavailable reason. - None UnavailableReason = "None" - // SubscriptionIsDisabled specifies the subscription is disabled state for - // unavailable reason. - SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" - // TooManyNamespaceInCurrentSubscription specifies the too many namespace - // in current subscription state for unavailable reason. - TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" -) - -// CheckNameAvailability is description of a Check Name availability request -// properties. -type CheckNameAvailability struct { - Name *string `json:"name,omitempty"` -} - -// CheckNameAvailabilityResult is description of a Check Name availability -// request properties. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason UnavailableReason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// MessageCountDetails is message Count Details. -type MessageCountDetails struct { - ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` - DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` - ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` - TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` - TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` -} - -// NamespaceCreateOrUpdateParameters is parameters supplied to the Create Or -// Update Namespace operation. -type NamespaceCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// NamespaceListResult is the response of the List Namespace operation. -type NamespaceListResult struct { - autorest.Response `json:"-"` - Value *[]NamespaceResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NamespaceProperties is properties of the namespace. -type NamespaceProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - Status NamespaceState `json:"status,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - CreateACSNamespace *bool `json:"createACSNamespace,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// NamespaceResource is description of a namespace resource. -type NamespaceResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - *NamespaceProperties `json:"properties,omitempty"` -} - -// NamespaceUpdateParameters is parameters supplied to the Patch Namespace -// operation. -type NamespaceUpdateParameters struct { - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} - -// Operation is a ServiceBus REST API operation -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is the object that represents the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult is result of the request to list ServiceBus operations. -// It contains a list of operations and a URL link to get the next set of -// results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// QueueCreateOrUpdateParameters is parameters supplied to the Create Or Update -// Queue operation. -type QueueCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - *QueueProperties `json:"properties,omitempty"` -} - -// QueueListResult is the response to the List Queues operation. -type QueueListResult struct { - autorest.Response `json:"-"` - Value *[]QueueResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// QueueListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client QueueListResult) QueueListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// QueueProperties is the Queue Properties definition. -type QueueProperties struct { - LockDuration *string `json:"lockDuration,omitempty"` - AccessedAt *date.Time `json:"accessedAt,omitempty"` - AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` - EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` - DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` - EnableExpress *bool `json:"enableExpress,omitempty"` - EnablePartitioning *bool `json:"enablePartitioning,omitempty"` - IsAnonymousAccessible *bool `json:"isAnonymousAccessible,omitempty"` - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` - MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` - MessageCount *int64 `json:"messageCount,omitempty"` - CountDetails *MessageCountDetails `json:"countDetails,omitempty"` - RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` - RequiresSession *bool `json:"requiresSession,omitempty"` - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - Status EntityStatus `json:"status,omitempty"` - SupportOrdering *bool `json:"supportOrdering,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` -} - -// QueueResource is description of queue Resource. -type QueueResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *QueueProperties `json:"properties,omitempty"` -} - -// RegenerateKeysParameters is parameters supplied to the Regenerate -// Authorization Rule operation. -type RegenerateKeysParameters struct { - Policykey Policykey `json:"Policykey,omitempty"` -} - -// Resource is the Resource definition for other than namespace. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` -} - -// ResourceListKeys is namespace/ServiceBus Connection String -type ResourceListKeys struct { - autorest.Response `json:"-"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - KeyName *string `json:"keyName,omitempty"` -} - -// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied -// to the Create Or Update Authorization Rules operation. -type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleListResult is the response to the List -// Namespace operation. -type SharedAccessAuthorizationRuleListResult struct { - autorest.Response `json:"-"` - Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SharedAccessAuthorizationRuleProperties is sharedAccessAuthorizationRule -// properties. -type SharedAccessAuthorizationRuleProperties struct { - Rights *[]AccessRights `json:"rights,omitempty"` -} - -// SharedAccessAuthorizationRuleResource is description of a namespace -// authorization rule. -type SharedAccessAuthorizationRuleResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// Sku is sKU of the namespace. -type Sku struct { - Name SkuName `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` -} - -// SubscriptionCreateOrUpdateParameters is parameters supplied to the Create Or -// Update Subscription operation. -type SubscriptionCreateOrUpdateParameters struct { - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *SubscriptionProperties `json:"properties,omitempty"` -} - -// SubscriptionListResult is the response to the List Subscriptions operation. -type SubscriptionListResult struct { - autorest.Response `json:"-"` - Value *[]SubscriptionResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SubscriptionListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SubscriptionListResult) SubscriptionListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SubscriptionProperties is description of Subscription Resource. -type SubscriptionProperties struct { - AccessedAt *date.Time `json:"accessedAt,omitempty"` - AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - CountDetails *MessageCountDetails `json:"countDetails,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"` - DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` - EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` - EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` - IsReadOnly *bool `json:"isReadOnly,omitempty"` - LockDuration *string `json:"lockDuration,omitempty"` - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` - MessageCount *int64 `json:"messageCount,omitempty"` - RequiresSession *bool `json:"requiresSession,omitempty"` - Status EntityStatus `json:"status,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` -} - -// SubscriptionResource is description of subscription resource. -type SubscriptionResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *SubscriptionProperties `json:"properties,omitempty"` -} - -// TopicCreateOrUpdateParameters is parameters supplied to the Create Or Update -// Topic operation. -type TopicCreateOrUpdateParameters struct { - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - *TopicProperties `json:"properties,omitempty"` -} - -// TopicListResult is the response to the List Topics operation. -type TopicListResult struct { - autorest.Response `json:"-"` - Value *[]TopicResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// TopicListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client TopicListResult) TopicListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// TopicProperties is the Tpoic Properties definition. -type TopicProperties struct { - AccessedAt *date.Time `json:"accessedAt,omitempty"` - AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` - CountDetails *MessageCountDetails `json:"countDetails,omitempty"` - DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` - EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` - EnableExpress *bool `json:"enableExpress,omitempty"` - EnablePartitioning *bool `json:"enablePartitioning,omitempty"` - EnableSubscriptionPartitioning *bool `json:"enableSubscriptionPartitioning,omitempty"` - FilteringMessagesBeforePublishing *bool `json:"filteringMessagesBeforePublishing,omitempty"` - IsAnonymousAccessible *bool `json:"isAnonymousAccessible,omitempty"` - IsExpress *bool `json:"isExpress,omitempty"` - MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` - RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - Status EntityStatus `json:"status,omitempty"` - SubscriptionCount *int32 `json:"subscriptionCount,omitempty"` - SupportOrdering *bool `json:"supportOrdering,omitempty"` - UpdatedAt *date.Time `json:"updatedAt,omitempty"` -} - -// TopicResource is description of topic resource. -type TopicResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *TopicProperties `json:"properties,omitempty"` -} - -// TrackedResource is the Resource definition. -type TrackedResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AccessRights enumerates the values for access rights. +type AccessRights string + +const ( + // Listen specifies the listen state for access rights. + Listen AccessRights = "Listen" + // Manage specifies the manage state for access rights. + Manage AccessRights = "Manage" + // Send specifies the send state for access rights. + Send AccessRights = "Send" +) + +// EntityAvailabilityStatus enumerates the values for entity availability +// status. +type EntityAvailabilityStatus string + +const ( + // Available specifies the available state for entity availability status. + Available EntityAvailabilityStatus = "Available" + // Limited specifies the limited state for entity availability status. + Limited EntityAvailabilityStatus = "Limited" + // Renaming specifies the renaming state for entity availability status. + Renaming EntityAvailabilityStatus = "Renaming" + // Restoring specifies the restoring state for entity availability status. + Restoring EntityAvailabilityStatus = "Restoring" + // Unknown specifies the unknown state for entity availability status. + Unknown EntityAvailabilityStatus = "Unknown" +) + +// EntityStatus enumerates the values for entity status. +type EntityStatus string + +const ( + // EntityStatusActive specifies the entity status active state for entity + // status. + EntityStatusActive EntityStatus = "Active" + // EntityStatusCreating specifies the entity status creating state for + // entity status. + EntityStatusCreating EntityStatus = "Creating" + // EntityStatusDeleting specifies the entity status deleting state for + // entity status. + EntityStatusDeleting EntityStatus = "Deleting" + // EntityStatusDisabled specifies the entity status disabled state for + // entity status. + EntityStatusDisabled EntityStatus = "Disabled" + // EntityStatusReceiveDisabled specifies the entity status receive disabled + // state for entity status. + EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" + // EntityStatusRenaming specifies the entity status renaming state for + // entity status. + EntityStatusRenaming EntityStatus = "Renaming" + // EntityStatusRestoring specifies the entity status restoring state for + // entity status. + EntityStatusRestoring EntityStatus = "Restoring" + // EntityStatusSendDisabled specifies the entity status send disabled state + // for entity status. + EntityStatusSendDisabled EntityStatus = "SendDisabled" + // EntityStatusUnknown specifies the entity status unknown state for entity + // status. + EntityStatusUnknown EntityStatus = "Unknown" +) + +// NamespaceState enumerates the values for namespace state. +type NamespaceState string + +const ( + // NamespaceStateActivating specifies the namespace state activating state + // for namespace state. + NamespaceStateActivating NamespaceState = "Activating" + // NamespaceStateActive specifies the namespace state active state for + // namespace state. + NamespaceStateActive NamespaceState = "Active" + // NamespaceStateCreated specifies the namespace state created state for + // namespace state. + NamespaceStateCreated NamespaceState = "Created" + // NamespaceStateCreating specifies the namespace state creating state for + // namespace state. + NamespaceStateCreating NamespaceState = "Creating" + // NamespaceStateDisabled specifies the namespace state disabled state for + // namespace state. + NamespaceStateDisabled NamespaceState = "Disabled" + // NamespaceStateDisabling specifies the namespace state disabling state + // for namespace state. + NamespaceStateDisabling NamespaceState = "Disabling" + // NamespaceStateEnabling specifies the namespace state enabling state for + // namespace state. + NamespaceStateEnabling NamespaceState = "Enabling" + // NamespaceStateFailed specifies the namespace state failed state for + // namespace state. + NamespaceStateFailed NamespaceState = "Failed" + // NamespaceStateRemoved specifies the namespace state removed state for + // namespace state. + NamespaceStateRemoved NamespaceState = "Removed" + // NamespaceStateRemoving specifies the namespace state removing state for + // namespace state. + NamespaceStateRemoving NamespaceState = "Removing" + // NamespaceStateSoftDeleted specifies the namespace state soft deleted + // state for namespace state. + NamespaceStateSoftDeleted NamespaceState = "SoftDeleted" + // NamespaceStateSoftDeleting specifies the namespace state soft deleting + // state for namespace state. + NamespaceStateSoftDeleting NamespaceState = "SoftDeleting" + // NamespaceStateUnknown specifies the namespace state unknown state for + // namespace state. + NamespaceStateUnknown NamespaceState = "Unknown" +) + +// Policykey enumerates the values for policykey. +type Policykey string + +const ( + // PrimaryKey specifies the primary key state for policykey. + PrimaryKey Policykey = "PrimaryKey" + // SecondaryKey specifies the secondary key state for policykey. + SecondaryKey Policykey = "SecondaryKey" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Basic specifies the basic state for sku name. + Basic SkuName = "Basic" + // Premium specifies the premium state for sku name. + Premium SkuName = "Premium" + // Standard specifies the standard state for sku name. + Standard SkuName = "Standard" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierBasic specifies the sku tier basic state for sku tier. + SkuTierBasic SkuTier = "Basic" + // SkuTierPremium specifies the sku tier premium state for sku tier. + SkuTierPremium SkuTier = "Premium" + // SkuTierStandard specifies the sku tier standard state for sku tier. + SkuTierStandard SkuTier = "Standard" +) + +// UnavailableReason enumerates the values for unavailable reason. +type UnavailableReason string + +const ( + // InvalidName specifies the invalid name state for unavailable reason. + InvalidName UnavailableReason = "InvalidName" + // NameInLockdown specifies the name in lockdown state for unavailable + // reason. + NameInLockdown UnavailableReason = "NameInLockdown" + // NameInUse specifies the name in use state for unavailable reason. + NameInUse UnavailableReason = "NameInUse" + // None specifies the none state for unavailable reason. + None UnavailableReason = "None" + // SubscriptionIsDisabled specifies the subscription is disabled state for + // unavailable reason. + SubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + // TooManyNamespaceInCurrentSubscription specifies the too many namespace + // in current subscription state for unavailable reason. + TooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +// CheckNameAvailability is description of a Check Name availability request +// properties. +type CheckNameAvailability struct { + Name *string `json:"name,omitempty"` +} + +// CheckNameAvailabilityResult is description of a Check Name availability +// request properties. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason UnavailableReason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// MessageCountDetails is message Count Details. +type MessageCountDetails struct { + ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` + DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` + ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` + TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` + TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` +} + +// NamespaceCreateOrUpdateParameters is parameters supplied to the Create Or +// Update Namespace operation. +type NamespaceCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceListResult is the response of the List Namespace operation. +type NamespaceListResult struct { + autorest.Response `json:"-"` + Value *[]NamespaceResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NamespaceListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NamespaceListResult) NamespaceListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NamespaceProperties is properties of the namespace. +type NamespaceProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + Status NamespaceState `json:"status,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + CreateACSNamespace *bool `json:"createACSNamespace,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// NamespaceResource is description of a namespace resource. +type NamespaceResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + *NamespaceProperties `json:"properties,omitempty"` +} + +// NamespaceUpdateParameters is parameters supplied to the Patch Namespace +// operation. +type NamespaceUpdateParameters struct { + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} + +// Operation is a ServiceBus REST API operation +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is the object that represents the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult is result of the request to list ServiceBus operations. +// It contains a list of operations and a URL link to get the next set of +// results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// QueueCreateOrUpdateParameters is parameters supplied to the Create Or Update +// Queue operation. +type QueueCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + *QueueProperties `json:"properties,omitempty"` +} + +// QueueListResult is the response to the List Queues operation. +type QueueListResult struct { + autorest.Response `json:"-"` + Value *[]QueueResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// QueueListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client QueueListResult) QueueListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// QueueProperties is the Queue Properties definition. +type QueueProperties struct { + LockDuration *string `json:"lockDuration,omitempty"` + AccessedAt *date.Time `json:"accessedAt,omitempty"` + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` + EnableExpress *bool `json:"enableExpress,omitempty"` + EnablePartitioning *bool `json:"enablePartitioning,omitempty"` + IsAnonymousAccessible *bool `json:"isAnonymousAccessible,omitempty"` + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` + MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` + MessageCount *int64 `json:"messageCount,omitempty"` + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` + RequiresSession *bool `json:"requiresSession,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + Status EntityStatus `json:"status,omitempty"` + SupportOrdering *bool `json:"supportOrdering,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` +} + +// QueueResource is description of queue Resource. +type QueueResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *QueueProperties `json:"properties,omitempty"` +} + +// RegenerateKeysParameters is parameters supplied to the Regenerate +// Authorization Rule operation. +type RegenerateKeysParameters struct { + Policykey Policykey `json:"Policykey,omitempty"` +} + +// Resource is the Resource definition for other than namespace. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` +} + +// ResourceListKeys is namespace/ServiceBus Connection String +type ResourceListKeys struct { + autorest.Response `json:"-"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + KeyName *string `json:"keyName,omitempty"` +} + +// SharedAccessAuthorizationRuleCreateOrUpdateParameters is parameters supplied +// to the Create Or Update Authorization Rules operation. +type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// SharedAccessAuthorizationRuleListResult is the response to the List +// Namespace operation. +type SharedAccessAuthorizationRuleListResult struct { + autorest.Response `json:"-"` + Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SharedAccessAuthorizationRuleListResult) SharedAccessAuthorizationRuleListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SharedAccessAuthorizationRuleProperties is sharedAccessAuthorizationRule +// properties. +type SharedAccessAuthorizationRuleProperties struct { + Rights *[]AccessRights `json:"rights,omitempty"` +} + +// SharedAccessAuthorizationRuleResource is description of a namespace +// authorization rule. +type SharedAccessAuthorizationRuleResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` +} + +// Sku is sKU of the namespace. +type Sku struct { + Name SkuName `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` +} + +// SubscriptionCreateOrUpdateParameters is parameters supplied to the Create Or +// Update Subscription operation. +type SubscriptionCreateOrUpdateParameters struct { + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *SubscriptionProperties `json:"properties,omitempty"` +} + +// SubscriptionListResult is the response to the List Subscriptions operation. +type SubscriptionListResult struct { + autorest.Response `json:"-"` + Value *[]SubscriptionResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SubscriptionListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SubscriptionListResult) SubscriptionListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SubscriptionProperties is description of Subscription Resource. +type SubscriptionProperties struct { + AccessedAt *date.Time `json:"accessedAt,omitempty"` + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"` + DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` + IsReadOnly *bool `json:"isReadOnly,omitempty"` + LockDuration *string `json:"lockDuration,omitempty"` + MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` + MessageCount *int64 `json:"messageCount,omitempty"` + RequiresSession *bool `json:"requiresSession,omitempty"` + Status EntityStatus `json:"status,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` +} + +// SubscriptionResource is description of subscription resource. +type SubscriptionResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *SubscriptionProperties `json:"properties,omitempty"` +} + +// TopicCreateOrUpdateParameters is parameters supplied to the Create Or Update +// Topic operation. +type TopicCreateOrUpdateParameters struct { + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + *TopicProperties `json:"properties,omitempty"` +} + +// TopicListResult is the response to the List Topics operation. +type TopicListResult struct { + autorest.Response `json:"-"` + Value *[]TopicResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// TopicListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client TopicListResult) TopicListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// TopicProperties is the Tpoic Properties definition. +type TopicProperties struct { + AccessedAt *date.Time `json:"accessedAt,omitempty"` + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + EntityAvailabilityStatus EntityAvailabilityStatus `json:"entityAvailabilityStatus,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + EnableExpress *bool `json:"enableExpress,omitempty"` + EnablePartitioning *bool `json:"enablePartitioning,omitempty"` + EnableSubscriptionPartitioning *bool `json:"enableSubscriptionPartitioning,omitempty"` + FilteringMessagesBeforePublishing *bool `json:"filteringMessagesBeforePublishing,omitempty"` + IsAnonymousAccessible *bool `json:"isAnonymousAccessible,omitempty"` + IsExpress *bool `json:"isExpress,omitempty"` + MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` + RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + Status EntityStatus `json:"status,omitempty"` + SubscriptionCount *int32 `json:"subscriptionCount,omitempty"` + SupportOrdering *bool `json:"supportOrdering,omitempty"` + UpdatedAt *date.Time `json:"updatedAt,omitempty"` +} + +// TopicResource is description of topic resource. +type TopicResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *TopicProperties `json:"properties,omitempty"` +} + +// TrackedResource is the Resource definition. +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/namespaces.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/namespaces.go index e83ae48ee8..efdf329f1e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/namespaces.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/namespaces.go @@ -1,1161 +1,1161 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// NamespacesClient is the azure Service Bus client -type NamespacesClient struct { - ManagementClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient -// client. -func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailabilityMethod check the give namespace name availability. -// -// parameters is parameters to check availability of the given namespace name -func (client NamespacesClient) CheckNameAvailabilityMethod(parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod") - } - - req, err := client.CheckNameAvailabilityMethodPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilityMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. -func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(parameters CheckNameAvailability) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a service namespace. Once created, this -// namespace's resource manifest is immutable. This operation is idempotent. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name. parameters is parameters -// supplied to create a namespace resource. -func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (<-chan NamespaceResource, <-chan error) { - resultChan := make(chan NamespaceResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result NamespaceResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for -// a namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name authorizationRuleName is -// the authorizationrule name. parameters is the shared access authorization -// rule. -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing namespace. This operation also removes all -// associated resources under the namespace. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name -func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a namespace authorization rule. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name authorizationRuleName is -// the authorizationrule name. -func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a description for the specified namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name -func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a namespace by rule -// name. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name authorizationRuleName is -// the authorizationrule name. -func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRules gets the authorization rules for a namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name -func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets the available namespaces within a resource group. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. -func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListBySubscription gets all the available namespaces within the -// subscription, irrespective of the resource groups. -func (client NamespacesClient) ListBySubscription() (result NamespaceListResult, err error) { - req, err := client.ListBySubscriptionPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure responding to request") - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptionNextResults retrieves the next set of results, if any. -func (client NamespacesClient) ListBySubscriptionNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.NamespaceListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure sending next results request") - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the primary and secondary connection strings for the -// namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name authorizationRuleName is -// the authorizationrule name. -func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the primary or secondary connection strings for -// the namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name authorizationRuleName is -// the authorizationrule name. parameters is parameters supplied to regenerate -// the authorization rule. -func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a service namespace. Once created, this namespace's resource -// manifest is immutable. This operation is idempotent. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name parameters is parameters -// supplied to update a namespace resource. -func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameters) (result NamespaceResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NamespacesClient) UpdateResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// NamespacesClient is the azure Service Bus client +type NamespacesClient struct { + ManagementClient +} + +// NewNamespacesClient creates an instance of the NamespacesClient client. +func NewNamespacesClient(subscriptionID string) NamespacesClient { + return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient +// client. +func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { + return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailabilityMethod check the give namespace name availability. +// +// parameters is parameters to check availability of the given namespace name +func (client NamespacesClient) CheckNameAvailabilityMethod(parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod") + } + + req, err := client.CheckNameAvailabilityMethodPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilityMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. +func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(parameters CheckNameAvailability) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a service namespace. Once created, this +// namespace's resource manifest is immutable. This operation is idempotent. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name. parameters is parameters +// supplied to create a namespace resource. +func (client NamespacesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (<-chan NamespaceResource, <-chan error) { + resultChan := make(chan NamespaceResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result NamespaceResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NamespacesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for +// a namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. parameters is the shared access authorization +// rule. +func (client NamespacesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing namespace. This operation also removes all +// associated resources under the namespace. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client NamespacesClient) Delete(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, namespaceName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client NamespacesClient) DeletePreparer(resourceGroupName string, namespaceName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a namespace authorization rule. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. +func (client NamespacesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client NamespacesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a description for the specified namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client NamespacesClient) Get(resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client NamespacesClient) GetPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an authorization rule for a namespace by rule +// name. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. +func (client NamespacesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client NamespacesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRules gets the authorization rules for a namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client NamespacesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client NamespacesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets the available namespaces within a resource group. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. +func (client NamespacesClient) ListByResourceGroup(resourceGroupName string) (result NamespaceListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client NamespacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListByResourceGroupNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListBySubscription gets all the available namespaces within the +// subscription, irrespective of the resource groups. +func (client NamespacesClient) ListBySubscription() (result NamespaceListResult, err error) { + req, err := client.ListBySubscriptionPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client NamespacesClient) ListBySubscriptionPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result NamespaceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionNextResults retrieves the next set of results, if any. +func (client NamespacesClient) ListBySubscriptionNextResults(lastResults NamespaceListResult) (result NamespaceListResult, err error) { + req, err := lastResults.NamespaceListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure sending next results request") + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListBySubscription", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the primary and secondary connection strings for the +// namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. +func (client NamespacesClient) ListKeys(resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client NamespacesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the primary or secondary connection strings for +// the namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name authorizationRuleName is +// the authorizationrule name. parameters is parameters supplied to regenerate +// the authorization rule. +func (client NamespacesClient) RegenerateKeys(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client NamespacesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a service namespace. Once created, this namespace's resource +// manifest is immutable. This operation is idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name parameters is parameters +// supplied to update a namespace resource. +func (client NamespacesClient) Update(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameters) (result NamespaceResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.NamespacesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, namespaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client NamespacesClient) UpdatePreparer(resourceGroupName string, namespaceName string, parameters NamespaceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client NamespacesClient) UpdateResponder(resp *http.Response) (result NamespaceResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/operations.go index 3e2d8aeb04..3f7b127e55 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/operations.go @@ -1,122 +1,122 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the azure Service Bus client -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available ServiceBus REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ServiceBus/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the azure Service Bus client +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available ServiceBus REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ServiceBus/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/queues.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/queues.go index ef9f4934a5..9d52011dd4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/queues.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/queues.go @@ -1,928 +1,928 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// QueuesClient is the azure Service Bus client -type QueuesClient struct { - ManagementClient -} - -// NewQueuesClient creates an instance of the QueuesClient client. -func NewQueuesClient(subscriptionID string) QueuesClient { - return NewQueuesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueuesClientWithBaseURI creates an instance of the QueuesClient client. -func NewQueuesClientWithBaseURI(baseURI string, subscriptionID string) QueuesClient { - return QueuesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Service Bus queue. This operation is -// idempotent. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. parameters is parameters supplied to create or update a queue -// resource. -func (client QueuesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, queueName string, parameters QueueCreateOrUpdateParameters) (result QueueResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, queueName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client QueuesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, queueName string, parameters QueueCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result QueueResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates an authorization rule for a queue. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. authorizationRuleName is the authorizationrule name. parameters is the -// shared access authorization rule. -func (client QueuesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client QueuesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client QueuesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a queue from the specified namespace in a resource group. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. -func (client QueuesClient) Delete(resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client QueuesClient) DeletePreparer(resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client QueuesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a queue authorization rule. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. authorizationRuleName is the authorizationrule name. -func (client QueuesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client QueuesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client QueuesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a description for the specified queue. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. -func (client QueuesClient) Get(resourceGroupName string, namespaceName string, queueName string) (result QueueResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client QueuesClient) GetPreparer(resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QueuesClient) GetResponder(resp *http.Response) (result QueueResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a queue by rule name. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. authorizationRuleName is the authorizationrule name. -func (client QueuesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client QueuesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client QueuesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets the queues within a namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name -func (client QueuesClient) ListAll(resourceGroupName string, namespaceName string) (result QueueListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListAll") - } - - req, err := client.ListAllPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client QueuesClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client QueuesClient) ListAllResponder(resp *http.Response) (result QueueListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client QueuesClient) ListAllNextResults(lastResults QueueListResult) (result QueueListResult, err error) { - req, err := lastResults.QueueListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListAuthorizationRules gets all authorization rules for a queue. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. -func (client QueuesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, queueName string) (result SharedAccessAuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client QueuesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client QueuesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client QueuesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys primary and secondary connection strings to the queue. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. authorizationRuleName is the authorizationrule name. -func (client QueuesClient) ListKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client QueuesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client QueuesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the primary or secondary connection strings to -// the queue. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name queueName is the queue -// name. authorizationRuleName is the authorizationrule name. parameters is -// parameters supplied to regenerate the authorization rule. -func (client QueuesClient) RegenerateKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client QueuesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client QueuesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// QueuesClient is the azure Service Bus client +type QueuesClient struct { + ManagementClient +} + +// NewQueuesClient creates an instance of the QueuesClient client. +func NewQueuesClient(subscriptionID string) QueuesClient { + return NewQueuesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueuesClientWithBaseURI creates an instance of the QueuesClient client. +func NewQueuesClientWithBaseURI(baseURI string, subscriptionID string) QueuesClient { + return QueuesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Service Bus queue. This operation is +// idempotent. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. parameters is parameters supplied to create or update a queue +// resource. +func (client QueuesClient) CreateOrUpdate(resourceGroupName string, namespaceName string, queueName string, parameters QueueCreateOrUpdateParameters) (result QueueResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, queueName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client QueuesClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, queueName string, parameters QueueCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result QueueResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates an authorization rule for a queue. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. parameters is the +// shared access authorization rule. +func (client QueuesClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client QueuesClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client QueuesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a queue from the specified namespace in a resource group. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. +func (client QueuesClient) Delete(resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client QueuesClient) DeletePreparer(resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client QueuesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a queue authorization rule. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. +func (client QueuesClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client QueuesClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client QueuesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a description for the specified queue. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. +func (client QueuesClient) Get(resourceGroupName string, namespaceName string, queueName string) (result QueueResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client QueuesClient) GetPreparer(resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client QueuesClient) GetResponder(resp *http.Response) (result QueueResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule gets an authorization rule for a queue by rule name. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. +func (client QueuesClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client QueuesClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client QueuesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets the queues within a namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client QueuesClient) ListAll(resourceGroupName string, namespaceName string) (result QueueListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListAll") + } + + req, err := client.ListAllPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client QueuesClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client QueuesClient) ListAllResponder(resp *http.Response) (result QueueListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client QueuesClient) ListAllNextResults(lastResults QueueListResult) (result QueueListResult, err error) { + req, err := lastResults.QueueListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules gets all authorization rules for a queue. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. +func (client QueuesClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, queueName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client QueuesClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client QueuesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client QueuesClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys primary and secondary connection strings to the queue. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. +func (client QueuesClient) ListKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client QueuesClient) ListKeysPreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client QueuesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates the primary or secondary connection strings to +// the queue. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name queueName is the queue +// name. authorizationRuleName is the authorizationrule name. parameters is +// parameters supplied to regenerate the authorization rule. +func (client QueuesClient) RegenerateKeys(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.QueuesClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client QueuesClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client QueuesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client QueuesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/subscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/subscriptions.go index 5270f9d26c..83799ec0bc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/subscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/subscriptions.go @@ -1,407 +1,407 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// SubscriptionsClient is the azure Service Bus client -type SubscriptionsClient struct { - ManagementClient -} - -// NewSubscriptionsClient creates an instance of the SubscriptionsClient -// client. -func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { - return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionsClientWithBaseURI creates an instance of the -// SubscriptionsClient client. -func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { - return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a topic subscription. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. subscriptionName is the subscription name. parameters is parameters -// supplied to create a subscription resource. -func (client SubscriptionsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SubscriptionCreateOrUpdateParameters) (result SubscriptionResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, topicName, subscriptionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SubscriptionCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a subscription from the specified topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. subscriptionName is the subscription name. -func (client SubscriptionsClient) Delete(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, topicName, subscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionsClient) DeletePreparer(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a subscription description for the specified topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. subscriptionName is the subscription name. -func (client SubscriptionsClient) Get(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result SubscriptionResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, topicName, subscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionsClient) GetPreparer(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) GetResponder(resp *http.Response) (result SubscriptionResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll list all the subscriptions under a specified topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. -func (client SubscriptionsClient) ListAll(resourceGroupName string, namespaceName string, topicName string) (result SubscriptionListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "ListAll") - } - - req, err := client.ListAllPreparer(resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client SubscriptionsClient) ListAllPreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) ListAllResponder(resp *http.Response) (result SubscriptionListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client SubscriptionsClient) ListAllNextResults(lastResults SubscriptionListResult) (result SubscriptionListResult, err error) { - req, err := lastResults.SubscriptionListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// SubscriptionsClient is the azure Service Bus client +type SubscriptionsClient struct { + ManagementClient +} + +// NewSubscriptionsClient creates an instance of the SubscriptionsClient +// client. +func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { + return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionsClientWithBaseURI creates an instance of the +// SubscriptionsClient client. +func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { + return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a topic subscription. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. subscriptionName is the subscription name. parameters is parameters +// supplied to create a subscription resource. +func (client SubscriptionsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SubscriptionCreateOrUpdateParameters) (result SubscriptionResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, topicName, subscriptionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubscriptionsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SubscriptionCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result SubscriptionResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a subscription from the specified topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. subscriptionName is the subscription name. +func (client SubscriptionsClient) Delete(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, topicName, subscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubscriptionsClient) DeletePreparer(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a subscription description for the specified topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. subscriptionName is the subscription name. +func (client SubscriptionsClient) Get(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result SubscriptionResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: subscriptionName, + Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, topicName, subscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubscriptionsClient) GetPreparer(resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionName": autorest.Encode("path", subscriptionName), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) GetResponder(resp *http.Response) (result SubscriptionResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll list all the subscriptions under a specified topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. +func (client SubscriptionsClient) ListAll(resourceGroupName string, namespaceName string, topicName string) (result SubscriptionListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.SubscriptionsClient", "ListAll") + } + + req, err := client.ListAllPreparer(resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client SubscriptionsClient) ListAllPreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListAllResponder(resp *http.Response) (result SubscriptionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client SubscriptionsClient) ListAllNextResults(lastResults SubscriptionListResult) (result SubscriptionListResult, err error) { + req, err := lastResults.SubscriptionListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/topics.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/topics.go index 75afeee2db..02938927eb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/topics.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/topics.go @@ -1,927 +1,927 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// TopicsClient is the azure Service Bus client -type TopicsClient struct { - ManagementClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient client. -func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a topic in the specified namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. parameters is parameters supplied to create a topic resource. -func (client TopicsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, topicName string, parameters TopicCreateOrUpdateParameters) (result TopicResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, topicName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, topicName string, parameters TopicCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result TopicResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates an authorizatio rule for the -// specified topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. authorizationRuleName is the authorizationrule name. parameters is the -// shared access authorization rule. -func (client TopicsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule") - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client TopicsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client TopicsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a topic from the specified namespace and resource group. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. -func (client TopicsClient) Delete(resourceGroupName string, namespaceName string, topicName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TopicsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a topic authorization rule. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. authorizationRuleName is the authorizationrule name. -func (client TopicsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule") - } - - req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client TopicsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client TopicsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a description for the specified topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. -func (client TopicsClient) Get(resourceGroupName string, namespaceName string, topicName string) (result TopicResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TopicsClient) GetResponder(resp *http.Response) (result TopicResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule returns the specified authorization rule. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. authorizationRuleName is the authorizationrule name. -func (client TopicsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "GetAuthorizationRule") - } - - req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure responding to request") - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client TopicsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client TopicsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll gets all the topics in a namespace. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name -func (client TopicsClient) ListAll(resourceGroupName string, namespaceName string) (result TopicListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListAll") - } - - req, err := client.ListAllPreparer(resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client TopicsClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListAllResponder(resp *http.Response) (result TopicListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllNextResults retrieves the next set of results, if any. -func (client TopicsClient) ListAllNextResults(lastResults TopicListResult) (result TopicListResult, err error) { - req, err := lastResults.TopicListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure sending next results request") - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure responding to next results request") - } - - return -} - -// ListAuthorizationRules gets authorization rules for a topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. -func (client TopicsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, topicName string) (result SharedAccessAuthorizationRuleListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListAuthorizationRules") - } - - req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure responding to request") - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client TopicsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client TopicsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure sending next results request") - } - - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") - } - - return -} - -// ListKeys gets the primary and secondary connection strings for the topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. authorizationRuleName is the authorizationrule name. -func (client TopicsClient) ListKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client TopicsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates primary or secondary connection strings for the -// topic. -// -// resourceGroupName is name of the Resource group within the Azure -// subscription. namespaceName is the namespace name topicName is the topic -// name. authorizationRuleName is the authorizationrule name. parameters is -// parameters supplied to regenerate the authorization rule. -func (client TopicsClient) RegenerateKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "RegenerateKeys") - } - - req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client TopicsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// TopicsClient is the azure Service Bus client +type TopicsClient struct { + ManagementClient +} + +// NewTopicsClient creates an instance of the TopicsClient client. +func NewTopicsClient(subscriptionID string) TopicsClient { + return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTopicsClientWithBaseURI creates an instance of the TopicsClient client. +func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { + return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a topic in the specified namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. parameters is parameters supplied to create a topic resource. +func (client TopicsClient) CreateOrUpdate(resourceGroupName string, namespaceName string, topicName string, parameters TopicCreateOrUpdateParameters) (result TopicResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, namespaceName, topicName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TopicsClient) CreateOrUpdatePreparer(resourceGroupName string, namespaceName string, topicName string, parameters TopicCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result TopicResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateAuthorizationRule creates an authorizatio rule for the +// specified topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. parameters is the +// shared access authorization rule. +func (client TopicsClient) CreateOrUpdateAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SharedAccessAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule") + } + + req, err := client.CreateOrUpdateAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. +func (client TopicsClient) CreateOrUpdateAuthorizationRulePreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (client TopicsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a topic from the specified namespace and resource group. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. +func (client TopicsClient) Delete(resourceGroupName string, namespaceName string, topicName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TopicsClient) DeletePreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TopicsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteAuthorizationRule deletes a topic authorization rule. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. +func (client TopicsClient) DeleteAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule") + } + + req, err := client.DeleteAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteAuthorizationRuleSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.DeleteAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. +func (client TopicsClient) DeleteAuthorizationRulePreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (client TopicsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a description for the specified topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. +func (client TopicsClient) Get(resourceGroupName string, namespaceName string, topicName string) (result TopicResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TopicsClient) GetPreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TopicsClient) GetResponder(resp *http.Response) (result TopicResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthorizationRule returns the specified authorization rule. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. +func (client TopicsClient) GetAuthorizationRule(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "GetAuthorizationRule") + } + + req, err := client.GetAuthorizationRulePreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthorizationRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure sending request") + return + } + + result, err = client.GetAuthorizationRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure responding to request") + } + + return +} + +// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. +func (client TopicsClient) GetAuthorizationRulePreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (client TopicsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets all the topics in a namespace. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name +func (client TopicsClient) ListAll(resourceGroupName string, namespaceName string) (result TopicListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListAll") + } + + req, err := client.ListAllPreparer(resourceGroupName, namespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client TopicsClient) ListAllPreparer(resourceGroupName string, namespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListAllResponder(resp *http.Response) (result TopicListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllNextResults retrieves the next set of results, if any. +func (client TopicsClient) ListAllNextResults(lastResults TopicListResult) (result TopicListResult, err error) { + req, err := lastResults.TopicListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure sending next results request") + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAll", resp, "Failure responding to next results request") + } + + return +} + +// ListAuthorizationRules gets authorization rules for a topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. +func (client TopicsClient) ListAuthorizationRules(resourceGroupName string, namespaceName string, topicName string) (result SharedAccessAuthorizationRuleListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListAuthorizationRules") + } + + req, err := client.ListAuthorizationRulesPreparer(resourceGroupName, namespaceName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure sending request") + return + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure responding to request") + } + + return +} + +// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. +func (client TopicsClient) ListAuthorizationRulesPreparer(resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAuthorizationRulesNextResults retrieves the next set of results, if any. +func (client TopicsClient) ListAuthorizationRulesNextResults(lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { + req, err := lastResults.SharedAccessAuthorizationRuleListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAuthorizationRulesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure sending next results request") + } + + result, err = client.ListAuthorizationRulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure responding to next results request") + } + + return +} + +// ListKeys gets the primary and secondary connection strings for the topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. +func (client TopicsClient) ListKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client TopicsClient) ListKeysPreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys regenerates primary or secondary connection strings for the +// topic. +// +// resourceGroupName is name of the Resource group within the Azure +// subscription. namespaceName is the namespace name topicName is the topic +// name. authorizationRuleName is the authorizationrule name. parameters is +// parameters supplied to regenerate the authorization rule. +func (client TopicsClient) RegenerateKeys(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (result ResourceListKeys, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: namespaceName, + Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, + {TargetValue: topicName, + Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: authorizationRuleName, + Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "servicebus.TopicsClient", "RegenerateKeys") + } + + req, err := client.RegenerateKeysPreparer(resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client TopicsClient) RegenerateKeysPreparer(resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateKeysParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationRuleName": autorest.Encode("path", authorizationRuleName), + "namespaceName": autorest.Encode("path", namespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client TopicsClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/version.go index 61fd539a0c..163910ee4a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicebus/version.go @@ -1,29 +1,29 @@ -package servicebus - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-servicebus/2015-08-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package servicebus + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-servicebus/2015-08-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/client.go index 400f2f74a9..271143e261 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/client.go @@ -1,53 +1,53 @@ -// Package servicefabric implements the Azure ARM Servicefabric service API -// version 2016-09-01. -// -// -package servicefabric - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Servicefabric - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Servicefabric. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package servicefabric implements the Azure ARM Servicefabric service API +// version 2016-09-01. +// +// +package servicefabric + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Servicefabric + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Servicefabric. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusters.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusters.go index 0fe898f43b..fda64c3012 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusters.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusters.go @@ -1,572 +1,572 @@ -package servicefabric - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// ClustersClient is the client for the Clusters methods of the Servicefabric -// service. -type ClustersClient struct { - ManagementClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient -// client. -func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create cluster resource This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group to which the resource -// belongs or get created clusterName is the name of the cluster resource -// parameters is put Request -func (client ClustersClient) Create(resourceGroupName string, clusterName string, parameters Cluster, cancel <-chan struct{}) (<-chan Cluster, <-chan error) { - resultChan := make(chan Cluster, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ClusterProperties.ReverseProxyCertificate", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ReverseProxyCertificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.ClusterProperties.ManagementEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.NodeTypes", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.StorageAccountName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.ProtectedAccountKeyName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.BlobEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.QueueEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.TableEndpoint", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeReplicaSetCheckTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckWaitDuration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckStableDuration", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckRetryTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeDomainTimeout", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "servicefabric.ClustersClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Cluster - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client ClustersClient) CreatePreparer(resourceGroupName string, clusterName string, parameters Cluster, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete cluster resource -// -// resourceGroupName is the name of the resource group to which the resource -// belongs or get created clusterName is the name of the cluster resource -func (client ClustersClient) Delete(resourceGroupName string, clusterName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get cluster resource -// -// resourceGroupName is the name of the resource group to which the resource -// belongs or get created clusterName is the name of the cluster resource -func (client ClustersClient) Get(resourceGroupName string, clusterName string) (result Cluster, err error) { - req, err := client.GetPreparer(resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list cluster resource -func (client ClustersClient) List() (result ClusterListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ClustersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ClustersClient) ListNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { - req, err := lastResults.ClusterListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup list cluster resource by resource group -// -// resourceGroupName is the name of the resource group to which the resource -// belongs or get created -func (client ClustersClient) ListByResourceGroup(resourceGroupName string) (result ClusterListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client ClustersClient) ListByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { - req, err := lastResults.ClusterListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update update cluster configuration This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group to which the resource -// belongs or get created clusterName is the name of the cluster resource -// parameters is the parameters which contains the property value and property -// name which used to update the cluster configuration -func (client ClustersClient) Update(resourceGroupName string, clusterName string, parameters ClusterUpdateParameters, cancel <-chan struct{}) (<-chan Cluster, <-chan error) { - resultChan := make(chan Cluster, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Cluster - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.UpdatePreparer(resourceGroupName, clusterName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(resourceGroupName string, clusterName string, parameters ClusterUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package servicefabric + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ClustersClient is the client for the Clusters methods of the Servicefabric +// service. +type ClustersClient struct { + ManagementClient +} + +// NewClustersClient creates an instance of the ClustersClient client. +func NewClustersClient(subscriptionID string) ClustersClient { + return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClustersClientWithBaseURI creates an instance of the ClustersClient +// client. +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create cluster resource This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group to which the resource +// belongs or get created clusterName is the name of the cluster resource +// parameters is put Request +func (client ClustersClient) Create(resourceGroupName string, clusterName string, parameters Cluster, cancel <-chan struct{}) (<-chan Cluster, <-chan error) { + resultChan := make(chan Cluster, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.Certificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ClusterProperties.ReverseProxyCertificate", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.ReverseProxyCertificate.Thumbprint", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ClusterProperties.ManagementEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.NodeTypes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.StorageAccountName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.ProtectedAccountKeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.BlobEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.QueueEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.DiagnosticsStorageAccountConfig.TableEndpoint", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.ClusterProperties.UpgradeDescription", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeReplicaSetCheckTimeout", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckWaitDuration", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckStableDuration", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthCheckRetryTimeout", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeTimeout", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.UpgradeDomainTimeout", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}, + }}, + {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}, + {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentUpgradeDomainDeltaUnhealthyNodes", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}, + {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "parameters.ClusterProperties.UpgradeDescription.DeltaHealthPolicy.MaxPercentDeltaUnhealthyApplications", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "servicefabric.ClustersClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Cluster + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client ClustersClient) CreatePreparer(resourceGroupName string, clusterName string, parameters Cluster, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete cluster resource +// +// resourceGroupName is the name of the resource group to which the resource +// belongs or get created clusterName is the name of the cluster resource +func (client ClustersClient) Delete(resourceGroupName string, clusterName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get cluster resource +// +// resourceGroupName is the name of the resource group to which the resource +// belongs or get created clusterName is the name of the cluster resource +func (client ClustersClient) Get(resourceGroupName string, clusterName string) (result Cluster, err error) { + req, err := client.GetPreparer(resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list cluster resource +func (client ClustersClient) List() (result ClusterListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ClustersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ClustersClient) ListNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.ClusterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup list cluster resource by resource group +// +// resourceGroupName is the name of the resource group to which the resource +// belongs or get created +func (client ClustersClient) ListByResourceGroup(resourceGroupName string) (result ClusterListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client ClustersClient) ListByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.ClusterListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update update cluster configuration This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group to which the resource +// belongs or get created clusterName is the name of the cluster resource +// parameters is the parameters which contains the property value and property +// name which used to update the cluster configuration +func (client ClustersClient) Update(resourceGroupName string, clusterName string, parameters ClusterUpdateParameters, cancel <-chan struct{}) (<-chan Cluster, <-chan error) { + resultChan := make(chan Cluster, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Cluster + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.UpdatePreparer(resourceGroupName, clusterName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClustersClient", "Update", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(resourceGroupName string, clusterName string, parameters ClusterUpdateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusterversions.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusterversions.go index f05bd88c71..496d6f89ba 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusterversions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/clusterversions.go @@ -1,134 +1,134 @@ -package servicefabric - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ClusterVersionsClient is the client for the ClusterVersions methods of the -// Servicefabric service. -type ClusterVersionsClient struct { - ManagementClient -} - -// NewClusterVersionsClient creates an instance of the ClusterVersionsClient -// client. -func NewClusterVersionsClient(subscriptionID string) ClusterVersionsClient { - return NewClusterVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClusterVersionsClientWithBaseURI creates an instance of the -// ClusterVersionsClient client. -func NewClusterVersionsClientWithBaseURI(baseURI string, subscriptionID string) ClusterVersionsClient { - return ClusterVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list cluster code versions by location -// -// location is the location for the cluster code versions, this is different -// from cluster location environment is cluster operating system, the default -// means all -func (client ClusterVersionsClient) List(location string, environment string) (result ClusterCodeVersionsListResult, err error) { - req, err := client.ListPreparer(location, environment) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ClusterVersionsClient) ListPreparer(location string, environment string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "environment": autorest.Encode("path", environment), - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClusterVersionsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClusterVersionsClient) ListResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client ClusterVersionsClient) ListNextResults(lastResults ClusterCodeVersionsListResult) (result ClusterCodeVersionsListResult, err error) { - req, err := lastResults.ClusterCodeVersionsListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package servicefabric + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ClusterVersionsClient is the client for the ClusterVersions methods of the +// Servicefabric service. +type ClusterVersionsClient struct { + ManagementClient +} + +// NewClusterVersionsClient creates an instance of the ClusterVersionsClient +// client. +func NewClusterVersionsClient(subscriptionID string) ClusterVersionsClient { + return NewClusterVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterVersionsClientWithBaseURI creates an instance of the +// ClusterVersionsClient client. +func NewClusterVersionsClientWithBaseURI(baseURI string, subscriptionID string) ClusterVersionsClient { + return ClusterVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list cluster code versions by location +// +// location is the location for the cluster code versions, this is different +// from cluster location environment is cluster operating system, the default +// means all +func (client ClusterVersionsClient) List(location string, environment string) (result ClusterCodeVersionsListResult, err error) { + req, err := client.ListPreparer(location, environment) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterVersionsClient) ListPreparer(location string, environment string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environment": autorest.Encode("path", environment), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClusterVersionsClient) ListResponder(resp *http.Response) (result ClusterCodeVersionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client ClusterVersionsClient) ListNextResults(lastResults ClusterCodeVersionsListResult) (result ClusterCodeVersionsListResult, err error) { + req, err := lastResults.ClusterCodeVersionsListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.ClusterVersionsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/models.go index 14a36bf48a..044756515c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/models.go @@ -1,439 +1,439 @@ -package servicefabric - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ClusterState enumerates the values for cluster state. -type ClusterState string - -const ( - // AutoScale specifies the auto scale state for cluster state. - AutoScale ClusterState = "AutoScale" - // BaselineUpgrade specifies the baseline upgrade state for cluster state. - BaselineUpgrade ClusterState = "BaselineUpgrade" - // Deploying specifies the deploying state for cluster state. - Deploying ClusterState = "Deploying" - // EnforcingClusterVersion specifies the enforcing cluster version state - // for cluster state. - EnforcingClusterVersion ClusterState = "EnforcingClusterVersion" - // Ready specifies the ready state for cluster state. - Ready ClusterState = "Ready" - // UpdatingInfrastructure specifies the updating infrastructure state for - // cluster state. - UpdatingInfrastructure ClusterState = "UpdatingInfrastructure" - // UpdatingUserCertificate specifies the updating user certificate state - // for cluster state. - UpdatingUserCertificate ClusterState = "UpdatingUserCertificate" - // UpdatingUserConfiguration specifies the updating user configuration - // state for cluster state. - UpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration" - // UpgradeServiceUnreachable specifies the upgrade service unreachable - // state for cluster state. - UpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable" - // WaitingForNodes specifies the waiting for nodes state for cluster state. - WaitingForNodes ClusterState = "WaitingForNodes" -) - -// DurabilityLevel enumerates the values for durability level. -type DurabilityLevel string - -const ( - // Bronze specifies the bronze state for durability level. - Bronze DurabilityLevel = "Bronze" - // Gold specifies the gold state for durability level. - Gold DurabilityLevel = "Gold" - // Silver specifies the silver state for durability level. - Silver DurabilityLevel = "Silver" -) - -// Environment enumerates the values for environment. -type Environment string - -const ( - // Linux specifies the linux state for environment. - Linux Environment = "Linux" - // Windows specifies the windows state for environment. - Windows Environment = "Windows" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled specifies the canceled state for provisioning state. - Canceled ProvisioningState = "Canceled" - // Failed specifies the failed state for provisioning state. - Failed ProvisioningState = "Failed" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" - // Updating specifies the updating state for provisioning state. - Updating ProvisioningState = "Updating" -) - -// ReliabilityLevel enumerates the values for reliability level. -type ReliabilityLevel string - -const ( - // ReliabilityLevelBronze specifies the reliability level bronze state for - // reliability level. - ReliabilityLevelBronze ReliabilityLevel = "Bronze" - // ReliabilityLevelGold specifies the reliability level gold state for - // reliability level. - ReliabilityLevelGold ReliabilityLevel = "Gold" - // ReliabilityLevelSilver specifies the reliability level silver state for - // reliability level. - ReliabilityLevelSilver ReliabilityLevel = "Silver" -) - -// ReliabilityLevel1 enumerates the values for reliability level 1. -type ReliabilityLevel1 string - -const ( - // ReliabilityLevel1Bronze specifies the reliability level 1 bronze state - // for reliability level 1. - ReliabilityLevel1Bronze ReliabilityLevel1 = "Bronze" - // ReliabilityLevel1Gold specifies the reliability level 1 gold state for - // reliability level 1. - ReliabilityLevel1Gold ReliabilityLevel1 = "Gold" - // ReliabilityLevel1Platinum specifies the reliability level 1 platinum - // state for reliability level 1. - ReliabilityLevel1Platinum ReliabilityLevel1 = "Platinum" - // ReliabilityLevel1Silver specifies the reliability level 1 silver state - // for reliability level 1. - ReliabilityLevel1Silver ReliabilityLevel1 = "Silver" -) - -// UpgradeMode enumerates the values for upgrade mode. -type UpgradeMode string - -const ( - // Automatic specifies the automatic state for upgrade mode. - Automatic UpgradeMode = "Automatic" - // Manual specifies the manual state for upgrade mode. - Manual UpgradeMode = "Manual" -) - -// UpgradeMode1 enumerates the values for upgrade mode 1. -type UpgradeMode1 string - -const ( - // UpgradeMode1Automatic specifies the upgrade mode 1 automatic state for - // upgrade mode 1. - UpgradeMode1Automatic UpgradeMode1 = "Automatic" - // UpgradeMode1Manual specifies the upgrade mode 1 manual state for upgrade - // mode 1. - UpgradeMode1Manual UpgradeMode1 = "Manual" -) - -// X509StoreName enumerates the values for x509 store name. -type X509StoreName string - -const ( - // AddressBook specifies the address book state for x509 store name. - AddressBook X509StoreName = "AddressBook" - // AuthRoot specifies the auth root state for x509 store name. - AuthRoot X509StoreName = "AuthRoot" - // CertificateAuthority specifies the certificate authority state for x509 - // store name. - CertificateAuthority X509StoreName = "CertificateAuthority" - // Disallowed specifies the disallowed state for x509 store name. - Disallowed X509StoreName = "Disallowed" - // My specifies the my state for x509 store name. - My X509StoreName = "My" - // Root specifies the root state for x509 store name. - Root X509StoreName = "Root" - // TrustedPeople specifies the trusted people state for x509 store name. - TrustedPeople X509StoreName = "TrustedPeople" - // TrustedPublisher specifies the trusted publisher state for x509 store - // name. - TrustedPublisher X509StoreName = "TrustedPublisher" -) - -// AvailableOperationDisplay is operation supported by ServiceFabric resource -// provider -type AvailableOperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` - Description *string `json:"description,omitempty"` -} - -// AzureActiveDirectory is the settings to enable AAD authentication on the -// cluster -type AzureActiveDirectory struct { - TenantID *string `json:"tenantId,omitempty"` - ClusterApplication *string `json:"clusterApplication,omitempty"` - ClientApplication *string `json:"clientApplication,omitempty"` -} - -// CertificateDescription is certificate details -type CertificateDescription struct { - Thumbprint *string `json:"thumbprint,omitempty"` - ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"` - X509StoreName X509StoreName `json:"x509StoreName,omitempty"` -} - -// ClientCertificateCommonName is client certificate details using common name -type ClientCertificateCommonName struct { - IsAdmin *bool `json:"isAdmin,omitempty"` - CertificateCommonName *string `json:"certificateCommonName,omitempty"` - CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"` -} - -// ClientCertificateThumbprint is client certificate details using thumbprint -type ClientCertificateThumbprint struct { - IsAdmin *bool `json:"isAdmin,omitempty"` - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` -} - -// Cluster is the cluster resource -type Cluster struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ClusterProperties `json:"properties,omitempty"` -} - -// ClusterCodeVersionsListResult is the list results of the ServiceFabric -// runtime versions -type ClusterCodeVersionsListResult struct { - autorest.Response `json:"-"` - Value *[]ClusterCodeVersionsResult `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterCodeVersionsListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClusterCodeVersionsListResult) ClusterCodeVersionsListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClusterCodeVersionsResult is the result of the ServiceFabric runtime -// versions -type ClusterCodeVersionsResult struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *ClusterVersionDetails `json:"properties,omitempty"` -} - -// ClusterHealthPolicy is defines a health policy used to evaluate the health -// of the cluster or of a cluster node. -type ClusterHealthPolicy struct { - MaxPercentUnhealthyNodes *int32 `json:"maxPercentUnhealthyNodes,omitempty"` - MaxPercentUnhealthyApplications *int32 `json:"maxPercentUnhealthyApplications,omitempty"` -} - -// ClusterListResult is cluster list results -type ClusterListResult struct { - autorest.Response `json:"-"` - Value *[]Cluster `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ClusterListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ClusterListResult) ClusterListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ClusterProperties is the cluster resource properties -type ClusterProperties struct { - AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"` - ClusterID *string `json:"clusterId,omitempty"` - ClusterState ClusterState `json:"clusterState,omitempty"` - ClusterEndpoint *string `json:"clusterEndpoint,omitempty"` - ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` - Certificate *CertificateDescription `json:"certificate,omitempty"` - ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"` - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` - ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` - FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` - ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` - ManagementEndpoint *string `json:"managementEndpoint,omitempty"` - NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` - AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - VMImage *string `json:"vmImage,omitempty"` - DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"` - UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` -} - -// ClusterPropertiesUpdateParameters is the cluster resource properties can be -// updated -type ClusterPropertiesUpdateParameters struct { - ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"` - UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` - ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` - Certificate *CertificateDescription `json:"certificate,omitempty"` - ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` - ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` - FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` - ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` - NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` - UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` -} - -// ClusterUpdateParameters is cluster update request -type ClusterUpdateParameters struct { - *ClusterPropertiesUpdateParameters `json:"properties,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ClusterUpgradeDeltaHealthPolicy is delta health policy for the cluster -type ClusterUpgradeDeltaHealthPolicy struct { - MaxPercentDeltaUnhealthyNodes *int32 `json:"maxPercentDeltaUnhealthyNodes,omitempty"` - MaxPercentUpgradeDomainDeltaUnhealthyNodes *int32 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes,omitempty"` - MaxPercentDeltaUnhealthyApplications *int32 `json:"maxPercentDeltaUnhealthyApplications,omitempty"` -} - -// ClusterUpgradePolicy is cluster upgrade policy -type ClusterUpgradePolicy struct { - OverrideUserUpgradePolicy *bool `json:"overrideUserUpgradePolicy,omitempty"` - ForceRestart *bool `json:"forceRestart,omitempty"` - UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"` - HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"` - HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"` - HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"` - UpgradeTimeout *string `json:"upgradeTimeout,omitempty"` - UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"` - HealthPolicy *ClusterHealthPolicy `json:"healthPolicy,omitempty"` - DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"` -} - -// ClusterVersionDetails is the detail of the ServiceFabric runtime version -// result -type ClusterVersionDetails struct { - CodeVersion *string `json:"codeVersion,omitempty"` - SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"` - Environment Environment `json:"environment,omitempty"` -} - -// DiagnosticsStorageAccountConfig is diagnostics storage account config -type DiagnosticsStorageAccountConfig struct { - StorageAccountName *string `json:"storageAccountName,omitempty"` - ProtectedAccountKeyName *string `json:"protectedAccountKeyName,omitempty"` - BlobEndpoint *string `json:"blobEndpoint,omitempty"` - QueueEndpoint *string `json:"queueEndpoint,omitempty"` - TableEndpoint *string `json:"tableEndpoint,omitempty"` -} - -// EndpointRangeDescription is port range details -type EndpointRangeDescription struct { - StartPort *int32 `json:"startPort,omitempty"` - EndPort *int32 `json:"endPort,omitempty"` -} - -// ErrorModel is the structure of the error -type ErrorModel struct { - Error *ErrorModelError `json:"error,omitempty"` -} - -// ErrorModelError is the error detail -type ErrorModelError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// NodeTypeDescription is describes a node type in the cluster, each node type -// represents sub set of nodes in the cluster -type NodeTypeDescription struct { - Name *string `json:"name,omitempty"` - PlacementProperties *map[string]*string `json:"placementProperties,omitempty"` - Capacities *map[string]*string `json:"capacities,omitempty"` - ClientConnectionEndpointPort *int32 `json:"clientConnectionEndpointPort,omitempty"` - HTTPGatewayEndpointPort *int32 `json:"httpGatewayEndpointPort,omitempty"` - DurabilityLevel DurabilityLevel `json:"durabilityLevel,omitempty"` - ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` - EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` - IsPrimary *bool `json:"isPrimary,omitempty"` - VMInstanceCount *int32 `json:"vmInstanceCount,omitempty"` - ReverseProxyEndpointPort *int32 `json:"reverseProxyEndpointPort,omitempty"` -} - -// OperationListResult is result of the request to list ServiceFabric -// operations. It contains a list of operations and a URL link to get the next -// set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]OperationResult `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// OperationResult is available operation list result -type OperationResult struct { - Name *string `json:"name,omitempty"` - Display *AvailableOperationDisplay `json:"display,omitempty"` - Origin *string `json:"origin,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// Resource is the resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SettingsParameterDescription is serviceFabric settings under sections -type SettingsParameterDescription struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// SettingsSectionDescription is serviceFabric section settings -type SettingsSectionDescription struct { - Name *string `json:"name,omitempty"` - Parameters *[]SettingsParameterDescription `json:"parameters,omitempty"` -} +package servicefabric + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ClusterState enumerates the values for cluster state. +type ClusterState string + +const ( + // AutoScale specifies the auto scale state for cluster state. + AutoScale ClusterState = "AutoScale" + // BaselineUpgrade specifies the baseline upgrade state for cluster state. + BaselineUpgrade ClusterState = "BaselineUpgrade" + // Deploying specifies the deploying state for cluster state. + Deploying ClusterState = "Deploying" + // EnforcingClusterVersion specifies the enforcing cluster version state + // for cluster state. + EnforcingClusterVersion ClusterState = "EnforcingClusterVersion" + // Ready specifies the ready state for cluster state. + Ready ClusterState = "Ready" + // UpdatingInfrastructure specifies the updating infrastructure state for + // cluster state. + UpdatingInfrastructure ClusterState = "UpdatingInfrastructure" + // UpdatingUserCertificate specifies the updating user certificate state + // for cluster state. + UpdatingUserCertificate ClusterState = "UpdatingUserCertificate" + // UpdatingUserConfiguration specifies the updating user configuration + // state for cluster state. + UpdatingUserConfiguration ClusterState = "UpdatingUserConfiguration" + // UpgradeServiceUnreachable specifies the upgrade service unreachable + // state for cluster state. + UpgradeServiceUnreachable ClusterState = "UpgradeServiceUnreachable" + // WaitingForNodes specifies the waiting for nodes state for cluster state. + WaitingForNodes ClusterState = "WaitingForNodes" +) + +// DurabilityLevel enumerates the values for durability level. +type DurabilityLevel string + +const ( + // Bronze specifies the bronze state for durability level. + Bronze DurabilityLevel = "Bronze" + // Gold specifies the gold state for durability level. + Gold DurabilityLevel = "Gold" + // Silver specifies the silver state for durability level. + Silver DurabilityLevel = "Silver" +) + +// Environment enumerates the values for environment. +type Environment string + +const ( + // Linux specifies the linux state for environment. + Linux Environment = "Linux" + // Windows specifies the windows state for environment. + Windows Environment = "Windows" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Canceled specifies the canceled state for provisioning state. + Canceled ProvisioningState = "Canceled" + // Failed specifies the failed state for provisioning state. + Failed ProvisioningState = "Failed" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" + // Updating specifies the updating state for provisioning state. + Updating ProvisioningState = "Updating" +) + +// ReliabilityLevel enumerates the values for reliability level. +type ReliabilityLevel string + +const ( + // ReliabilityLevelBronze specifies the reliability level bronze state for + // reliability level. + ReliabilityLevelBronze ReliabilityLevel = "Bronze" + // ReliabilityLevelGold specifies the reliability level gold state for + // reliability level. + ReliabilityLevelGold ReliabilityLevel = "Gold" + // ReliabilityLevelSilver specifies the reliability level silver state for + // reliability level. + ReliabilityLevelSilver ReliabilityLevel = "Silver" +) + +// ReliabilityLevel1 enumerates the values for reliability level 1. +type ReliabilityLevel1 string + +const ( + // ReliabilityLevel1Bronze specifies the reliability level 1 bronze state + // for reliability level 1. + ReliabilityLevel1Bronze ReliabilityLevel1 = "Bronze" + // ReliabilityLevel1Gold specifies the reliability level 1 gold state for + // reliability level 1. + ReliabilityLevel1Gold ReliabilityLevel1 = "Gold" + // ReliabilityLevel1Platinum specifies the reliability level 1 platinum + // state for reliability level 1. + ReliabilityLevel1Platinum ReliabilityLevel1 = "Platinum" + // ReliabilityLevel1Silver specifies the reliability level 1 silver state + // for reliability level 1. + ReliabilityLevel1Silver ReliabilityLevel1 = "Silver" +) + +// UpgradeMode enumerates the values for upgrade mode. +type UpgradeMode string + +const ( + // Automatic specifies the automatic state for upgrade mode. + Automatic UpgradeMode = "Automatic" + // Manual specifies the manual state for upgrade mode. + Manual UpgradeMode = "Manual" +) + +// UpgradeMode1 enumerates the values for upgrade mode 1. +type UpgradeMode1 string + +const ( + // UpgradeMode1Automatic specifies the upgrade mode 1 automatic state for + // upgrade mode 1. + UpgradeMode1Automatic UpgradeMode1 = "Automatic" + // UpgradeMode1Manual specifies the upgrade mode 1 manual state for upgrade + // mode 1. + UpgradeMode1Manual UpgradeMode1 = "Manual" +) + +// X509StoreName enumerates the values for x509 store name. +type X509StoreName string + +const ( + // AddressBook specifies the address book state for x509 store name. + AddressBook X509StoreName = "AddressBook" + // AuthRoot specifies the auth root state for x509 store name. + AuthRoot X509StoreName = "AuthRoot" + // CertificateAuthority specifies the certificate authority state for x509 + // store name. + CertificateAuthority X509StoreName = "CertificateAuthority" + // Disallowed specifies the disallowed state for x509 store name. + Disallowed X509StoreName = "Disallowed" + // My specifies the my state for x509 store name. + My X509StoreName = "My" + // Root specifies the root state for x509 store name. + Root X509StoreName = "Root" + // TrustedPeople specifies the trusted people state for x509 store name. + TrustedPeople X509StoreName = "TrustedPeople" + // TrustedPublisher specifies the trusted publisher state for x509 store + // name. + TrustedPublisher X509StoreName = "TrustedPublisher" +) + +// AvailableOperationDisplay is operation supported by ServiceFabric resource +// provider +type AvailableOperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// AzureActiveDirectory is the settings to enable AAD authentication on the +// cluster +type AzureActiveDirectory struct { + TenantID *string `json:"tenantId,omitempty"` + ClusterApplication *string `json:"clusterApplication,omitempty"` + ClientApplication *string `json:"clientApplication,omitempty"` +} + +// CertificateDescription is certificate details +type CertificateDescription struct { + Thumbprint *string `json:"thumbprint,omitempty"` + ThumbprintSecondary *string `json:"thumbprintSecondary,omitempty"` + X509StoreName X509StoreName `json:"x509StoreName,omitempty"` +} + +// ClientCertificateCommonName is client certificate details using common name +type ClientCertificateCommonName struct { + IsAdmin *bool `json:"isAdmin,omitempty"` + CertificateCommonName *string `json:"certificateCommonName,omitempty"` + CertificateIssuerThumbprint *string `json:"certificateIssuerThumbprint,omitempty"` +} + +// ClientCertificateThumbprint is client certificate details using thumbprint +type ClientCertificateThumbprint struct { + IsAdmin *bool `json:"isAdmin,omitempty"` + CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` +} + +// Cluster is the cluster resource +type Cluster struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ClusterProperties `json:"properties,omitempty"` +} + +// ClusterCodeVersionsListResult is the list results of the ServiceFabric +// runtime versions +type ClusterCodeVersionsListResult struct { + autorest.Response `json:"-"` + Value *[]ClusterCodeVersionsResult `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterCodeVersionsListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClusterCodeVersionsListResult) ClusterCodeVersionsListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClusterCodeVersionsResult is the result of the ServiceFabric runtime +// versions +type ClusterCodeVersionsResult struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ClusterVersionDetails `json:"properties,omitempty"` +} + +// ClusterHealthPolicy is defines a health policy used to evaluate the health +// of the cluster or of a cluster node. +type ClusterHealthPolicy struct { + MaxPercentUnhealthyNodes *int32 `json:"maxPercentUnhealthyNodes,omitempty"` + MaxPercentUnhealthyApplications *int32 `json:"maxPercentUnhealthyApplications,omitempty"` +} + +// ClusterListResult is cluster list results +type ClusterListResult struct { + autorest.Response `json:"-"` + Value *[]Cluster `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ClusterListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ClusterListResult) ClusterListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ClusterProperties is the cluster resource properties +type ClusterProperties struct { + AvailableClusterVersions *[]ClusterVersionDetails `json:"availableClusterVersions,omitempty"` + ClusterID *string `json:"clusterId,omitempty"` + ClusterState ClusterState `json:"clusterState,omitempty"` + ClusterEndpoint *string `json:"clusterEndpoint,omitempty"` + ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` + Certificate *CertificateDescription `json:"certificate,omitempty"` + ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"` + UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` + ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` + ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` + FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` + ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` + ManagementEndpoint *string `json:"managementEndpoint,omitempty"` + NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` + AzureActiveDirectory *AzureActiveDirectory `json:"azureActiveDirectory,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + VMImage *string `json:"vmImage,omitempty"` + DiagnosticsStorageAccountConfig *DiagnosticsStorageAccountConfig `json:"diagnosticsStorageAccountConfig,omitempty"` + UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` +} + +// ClusterPropertiesUpdateParameters is the cluster resource properties can be +// updated +type ClusterPropertiesUpdateParameters struct { + ReliabilityLevel ReliabilityLevel `json:"reliabilityLevel,omitempty"` + UpgradeMode UpgradeMode `json:"upgradeMode,omitempty"` + ClusterCodeVersion *string `json:"clusterCodeVersion,omitempty"` + Certificate *CertificateDescription `json:"certificate,omitempty"` + ClientCertificateThumbprints *[]ClientCertificateThumbprint `json:"clientCertificateThumbprints,omitempty"` + ClientCertificateCommonNames *[]ClientCertificateCommonName `json:"clientCertificateCommonNames,omitempty"` + FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` + ReverseProxyCertificate *CertificateDescription `json:"reverseProxyCertificate,omitempty"` + NodeTypes *[]NodeTypeDescription `json:"nodeTypes,omitempty"` + UpgradeDescription *ClusterUpgradePolicy `json:"upgradeDescription,omitempty"` +} + +// ClusterUpdateParameters is cluster update request +type ClusterUpdateParameters struct { + *ClusterPropertiesUpdateParameters `json:"properties,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ClusterUpgradeDeltaHealthPolicy is delta health policy for the cluster +type ClusterUpgradeDeltaHealthPolicy struct { + MaxPercentDeltaUnhealthyNodes *int32 `json:"maxPercentDeltaUnhealthyNodes,omitempty"` + MaxPercentUpgradeDomainDeltaUnhealthyNodes *int32 `json:"maxPercentUpgradeDomainDeltaUnhealthyNodes,omitempty"` + MaxPercentDeltaUnhealthyApplications *int32 `json:"maxPercentDeltaUnhealthyApplications,omitempty"` +} + +// ClusterUpgradePolicy is cluster upgrade policy +type ClusterUpgradePolicy struct { + OverrideUserUpgradePolicy *bool `json:"overrideUserUpgradePolicy,omitempty"` + ForceRestart *bool `json:"forceRestart,omitempty"` + UpgradeReplicaSetCheckTimeout *string `json:"upgradeReplicaSetCheckTimeout,omitempty"` + HealthCheckWaitDuration *string `json:"healthCheckWaitDuration,omitempty"` + HealthCheckStableDuration *string `json:"healthCheckStableDuration,omitempty"` + HealthCheckRetryTimeout *string `json:"healthCheckRetryTimeout,omitempty"` + UpgradeTimeout *string `json:"upgradeTimeout,omitempty"` + UpgradeDomainTimeout *string `json:"upgradeDomainTimeout,omitempty"` + HealthPolicy *ClusterHealthPolicy `json:"healthPolicy,omitempty"` + DeltaHealthPolicy *ClusterUpgradeDeltaHealthPolicy `json:"deltaHealthPolicy,omitempty"` +} + +// ClusterVersionDetails is the detail of the ServiceFabric runtime version +// result +type ClusterVersionDetails struct { + CodeVersion *string `json:"codeVersion,omitempty"` + SupportExpiryUtc *string `json:"supportExpiryUtc,omitempty"` + Environment Environment `json:"environment,omitempty"` +} + +// DiagnosticsStorageAccountConfig is diagnostics storage account config +type DiagnosticsStorageAccountConfig struct { + StorageAccountName *string `json:"storageAccountName,omitempty"` + ProtectedAccountKeyName *string `json:"protectedAccountKeyName,omitempty"` + BlobEndpoint *string `json:"blobEndpoint,omitempty"` + QueueEndpoint *string `json:"queueEndpoint,omitempty"` + TableEndpoint *string `json:"tableEndpoint,omitempty"` +} + +// EndpointRangeDescription is port range details +type EndpointRangeDescription struct { + StartPort *int32 `json:"startPort,omitempty"` + EndPort *int32 `json:"endPort,omitempty"` +} + +// ErrorModel is the structure of the error +type ErrorModel struct { + Error *ErrorModelError `json:"error,omitempty"` +} + +// ErrorModelError is the error detail +type ErrorModelError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// NodeTypeDescription is describes a node type in the cluster, each node type +// represents sub set of nodes in the cluster +type NodeTypeDescription struct { + Name *string `json:"name,omitempty"` + PlacementProperties *map[string]*string `json:"placementProperties,omitempty"` + Capacities *map[string]*string `json:"capacities,omitempty"` + ClientConnectionEndpointPort *int32 `json:"clientConnectionEndpointPort,omitempty"` + HTTPGatewayEndpointPort *int32 `json:"httpGatewayEndpointPort,omitempty"` + DurabilityLevel DurabilityLevel `json:"durabilityLevel,omitempty"` + ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` + EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` + IsPrimary *bool `json:"isPrimary,omitempty"` + VMInstanceCount *int32 `json:"vmInstanceCount,omitempty"` + ReverseProxyEndpointPort *int32 `json:"reverseProxyEndpointPort,omitempty"` +} + +// OperationListResult is result of the request to list ServiceFabric +// operations. It contains a list of operations and a URL link to get the next +// set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]OperationResult `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// OperationResult is available operation list result +type OperationResult struct { + Name *string `json:"name,omitempty"` + Display *AvailableOperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// Resource is the resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SettingsParameterDescription is serviceFabric settings under sections +type SettingsParameterDescription struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// SettingsSectionDescription is serviceFabric section settings +type SettingsSectionDescription struct { + Name *string `json:"name,omitempty"` + Parameters *[]SettingsParameterDescription `json:"parameters,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/operations.go index eaf0146618..5024912b7e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/operations.go @@ -1,123 +1,123 @@ -package servicefabric - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the -// Servicefabric service. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available ServiceFabric REST API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ServiceFabric/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.OperationListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to next results request") - } - - return -} +package servicefabric + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the +// Servicefabric service. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available ServiceFabric REST API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ServiceFabric/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.OperationListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "servicefabric.OperationsClient", "List", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/version.go index 6b7d6bfc0d..585f817586 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/servicefabric/version.go @@ -1,29 +1,29 @@ -package servicefabric - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-servicefabric/2016-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package servicefabric + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-servicefabric/2016-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/capabilities.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/capabilities.go index 376c8966be..ec8aca224b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/capabilities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/capabilities.go @@ -1,108 +1,108 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// CapabilitiesClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services -// to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type CapabilitiesClient struct { - ManagementClient -} - -// NewCapabilitiesClient creates an instance of the CapabilitiesClient client. -func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { - return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCapabilitiesClientWithBaseURI creates an instance of the -// CapabilitiesClient client. -func NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { - return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByLocation gets the capabilities available for the specified location. -// -// locationID is the location id whose capabilities are retrieved. -func (client CapabilitiesClient) ListByLocation(locationID string) (result LocationCapabilities, err error) { - req, err := client.ListByLocationPreparer(locationID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", nil, "Failure preparing request") - return - } - - resp, err := client.ListByLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure sending request") - return - } - - result, err = client.ListByLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure responding to request") - } - - return -} - -// ListByLocationPreparer prepares the ListByLocation request. -func (client CapabilitiesClient) ListByLocationPreparer(locationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationId": autorest.Encode("path", locationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByLocationSender sends the ListByLocation request. The method will close the -// http.Response Body if it receives an error. -func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByLocationResponder handles the response to the ListByLocation request. The method always -// closes the http.Response Body. -func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// CapabilitiesClient is the the Azure SQL Database management API provides a +// RESTful set of web services that interact with Azure SQL Database services +// to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type CapabilitiesClient struct { + ManagementClient +} + +// NewCapabilitiesClient creates an instance of the CapabilitiesClient client. +func NewCapabilitiesClient(subscriptionID string) CapabilitiesClient { + return NewCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCapabilitiesClientWithBaseURI creates an instance of the +// CapabilitiesClient client. +func NewCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) CapabilitiesClient { + return CapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByLocation gets the capabilities available for the specified location. +// +// locationID is the location id whose capabilities are retrieved. +func (client CapabilitiesClient) ListByLocation(locationID string) (result LocationCapabilities, err error) { + req, err := client.ListByLocationPreparer(locationID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", nil, "Failure preparing request") + return + } + + resp, err := client.ListByLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure sending request") + return + } + + result, err = client.ListByLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.CapabilitiesClient", "ListByLocation", resp, "Failure responding to request") + } + + return +} + +// ListByLocationPreparer prepares the ListByLocation request. +func (client CapabilitiesClient) ListByLocationPreparer(locationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationId": autorest.Encode("path", locationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByLocationSender sends the ListByLocation request. The method will close the +// http.Response Body if it receives an error. +func (client CapabilitiesClient) ListByLocationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByLocationResponder handles the response to the ListByLocation request. The method always +// closes the http.Response Body. +func (client CapabilitiesClient) ListByLocationResponder(resp *http.Response) (result LocationCapabilities, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/client.go index 37988c4848..dbc1dfaa29 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/client.go @@ -1,54 +1,54 @@ -// Package sql implements the Azure ARM Sql service API version . -// -// The Azure SQL Database management API provides a RESTful set of web services -// that interact with Azure SQL Database services to manage your databases. The -// API enables you to create, retrieve, update, and delete databases. -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Sql - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Sql. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package sql implements the Azure ARM Sql service API version . +// +// The Azure SQL Database management API provides a RESTful set of web services +// that interact with Azure SQL Database services to manage your databases. The +// API enables you to create, retrieve, update, and delete databases. +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Sql + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Sql. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/databases.go index 3aacd0ffd8..c0d36034f9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/databases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/databases.go @@ -1,1973 +1,1973 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DatabasesClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services -// to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type DatabasesClient struct { - ManagementClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient -// client. -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateImportOperation creates an import operation that imports a bacpac into -// an existing database. The existing database must be empty. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to import into parameters is the required parameters for -// importing a Bacpac into a database. -func (client DatabasesClient) CreateImportOperation(resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest, cancel <-chan struct{}) (<-chan ImportExportResponse, <-chan error) { - resultChan := make(chan ImportExportResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ImportExtensionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ImportExtensionProperties.OperationMode", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "sql.DatabasesClient", "CreateImportOperation") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ImportExportResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateImportOperationPreparer(resourceGroupName, serverName, databaseName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", nil, "Failure preparing request") - return - } - - resp, err := client.CreateImportOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", resp, "Failure sending request") - return - } - - result, err = client.CreateImportOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateImportOperationPreparer prepares the CreateImportOperation request. -func (client DatabasesClient) CreateImportOperationPreparer(resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateImportOperationSender sends the CreateImportOperation request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateImportOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateImportOperationResponder handles the response to the CreateImportOperation request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateImportOperationResponder(resp *http.Response) (result ImportExportResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Location is a required property in the request body, and it must be the same -// as the location of the SQL server. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to be operated on (updated or created). parameters is the -// required parameters for creating or updating a database. -func (client DatabasesClient) CreateOrUpdate(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (<-chan Database, <-chan error) { - resultChan := make(chan Database, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result Database - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, databaseName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateBlobAuditingPolicy creates or updates a database's blob -// auditing policy. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which database blob audit policy will be defined. -// parameters is the database blob auditing policy. -func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicy(resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (result DatabaseBlobAuditingPolicy, err error) { - req, err := client.CreateOrUpdateBlobAuditingPolicyPreparer(resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateBlobAuditingPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateBlobAuditingPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateBlobAuditingPolicy", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateBlobAuditingPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateBlobAuditingPolicy", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateBlobAuditingPolicyPreparer prepares the CreateOrUpdateBlobAuditingPolicy request. -func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicyPreparer(resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateBlobAuditingPolicySender sends the CreateOrUpdateBlobAuditingPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateBlobAuditingPolicyResponder handles the response to the CreateOrUpdateBlobAuditingPolicy request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicyResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateThreatDetectionPolicy creates or updates a database's threat -// detection policy. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which database Threat Detection policy is defined. -// parameters is the database Threat Detection policy. -func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicy(resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (result DatabaseSecurityAlertPolicy, err error) { - req, err := client.CreateOrUpdateThreatDetectionPolicyPreparer(resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateThreatDetectionPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateThreatDetectionPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateThreatDetectionPolicy", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateThreatDetectionPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateThreatDetectionPolicy", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateThreatDetectionPolicyPreparer prepares the CreateOrUpdateThreatDetectionPolicy request. -func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicyPreparer(resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/default", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateThreatDetectionPolicySender sends the CreateOrUpdateThreatDetectionPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateThreatDetectionPolicyResponder handles the response to the CreateOrUpdateThreatDetectionPolicy request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicyResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateTransparentDataEncryptionConfiguration creates or updates a -// database's transparent data encryption configuration. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which setting the transparent data encryption applies. -// parameters is the required parameters for creating or updating transparent -// data encryption. -func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { - req, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateTransparentDataEncryptionConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateTransparentDataEncryptionConfigurationPreparer prepares the CreateOrUpdateTransparentDataEncryptionConfiguration request. -func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateTransparentDataEncryptionConfigurationSender sends the CreateOrUpdateTransparentDataEncryptionConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateTransparentDataEncryptionConfigurationResponder handles the response to the CreateOrUpdateTransparentDataEncryptionConfiguration request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a database. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to be deleted. -func (client DatabasesClient) Delete(resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteReplicationLink deletes a database replication link. Cannot be done -// during failover. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database that has the replication link to be dropped. linkID is the -// ID of the replication link to be deleted. -func (client DatabasesClient) DeleteReplicationLink(resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) { - req, err := client.DeleteReplicationLinkPreparer(resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "DeleteReplicationLink", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteReplicationLinkSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "DeleteReplicationLink", resp, "Failure sending request") - return - } - - result, err = client.DeleteReplicationLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "DeleteReplicationLink", resp, "Failure responding to request") - } - - return -} - -// DeleteReplicationLinkPreparer prepares the DeleteReplicationLink request. -func (client DatabasesClient) DeleteReplicationLinkPreparer(resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteReplicationLinkSender sends the DeleteReplicationLink request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteReplicationLinkSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteReplicationLinkResponder handles the response to the DeleteReplicationLink request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteReplicationLinkResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Export exports a database to a bacpac. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to be exported. parameters is the required parameters for -// exporting a database. -func (client DatabasesClient) Export(resourceGroupName string, serverName string, databaseName string, parameters ExportRequest, cancel <-chan struct{}) (<-chan ImportExportResponse, <-chan error) { - resultChan := make(chan ImportExportResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "sql.DatabasesClient", "Export") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ImportExportResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ExportPreparer(resourceGroupName, serverName, databaseName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", nil, "Failure preparing request") - return - } - - resp, err := client.ExportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", resp, "Failure sending request") - return - } - - result, err = client.ExportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ExportPreparer prepares the Export request. -func (client DatabasesClient) ExportPreparer(resourceGroupName string, serverName string, databaseName string, parameters ExportRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ExportSender sends the Export request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ExportSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ExportResponder handles the response to the Export request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// FailoverReplicationLink sets which replica database is primary by failing -// over from the current primary replica database. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database that has the replication link to be failed over. linkID is -// the ID of the replication link to be failed over. -func (client DatabasesClient) FailoverReplicationLink(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.FailoverReplicationLinkPreparer(resourceGroupName, serverName, databaseName, linkID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLink", nil, "Failure preparing request") - return - } - - resp, err := client.FailoverReplicationLinkSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLink", resp, "Failure sending request") - return - } - - result, err = client.FailoverReplicationLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLink", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// FailoverReplicationLinkPreparer prepares the FailoverReplicationLink request. -func (client DatabasesClient) FailoverReplicationLinkPreparer(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// FailoverReplicationLinkSender sends the FailoverReplicationLink request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) FailoverReplicationLinkSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// FailoverReplicationLinkResponder handles the response to the FailoverReplicationLink request. The method always -// closes the http.Response Body. -func (client DatabasesClient) FailoverReplicationLinkResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// FailoverReplicationLinkAllowDataLoss sets which replica database is primary -// by failing over from the current primary replica database. This operation -// might result in data loss. This method may poll for completion. Polling can -// be canceled by passing the cancel channel argument. The channel will be used -// to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database that has the replication link to be failed over. linkID is -// the ID of the replication link to be failed over. -func (client DatabasesClient) FailoverReplicationLinkAllowDataLoss(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.FailoverReplicationLinkAllowDataLossPreparer(resourceGroupName, serverName, databaseName, linkID, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLinkAllowDataLoss", nil, "Failure preparing request") - return - } - - resp, err := client.FailoverReplicationLinkAllowDataLossSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLinkAllowDataLoss", resp, "Failure sending request") - return - } - - result, err = client.FailoverReplicationLinkAllowDataLossResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLinkAllowDataLoss", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// FailoverReplicationLinkAllowDataLossPreparer prepares the FailoverReplicationLinkAllowDataLoss request. -func (client DatabasesClient) FailoverReplicationLinkAllowDataLossPreparer(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// FailoverReplicationLinkAllowDataLossSender sends the FailoverReplicationLinkAllowDataLoss request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) FailoverReplicationLinkAllowDataLossSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// FailoverReplicationLinkAllowDataLossResponder handles the response to the FailoverReplicationLinkAllowDataLoss request. The method always -// closes the http.Response Body. -func (client DatabasesClient) FailoverReplicationLinkAllowDataLossResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a database. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to be retrieved. expand is a comma separated list of child -// objects to expand in the response. Possible properties: serviceTierAdvisors, -// transparentDataEncryption. -func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) { - req, err := client.GetPreparer(resourceGroupName, serverName, databaseName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(resourceGroupName string, serverName string, databaseName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBlobAuditingPolicy gets a database's blob auditing policy. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which database blob audit policy is defined. -func (client DatabasesClient) GetBlobAuditingPolicy(resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicy, err error) { - req, err := client.GetBlobAuditingPolicyPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetBlobAuditingPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetBlobAuditingPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetBlobAuditingPolicy", resp, "Failure sending request") - return - } - - result, err = client.GetBlobAuditingPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetBlobAuditingPolicy", resp, "Failure responding to request") - } - - return -} - -// GetBlobAuditingPolicyPreparer prepares the GetBlobAuditingPolicy request. -func (client DatabasesClient) GetBlobAuditingPolicyPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetBlobAuditingPolicySender sends the GetBlobAuditingPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetBlobAuditingPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetBlobAuditingPolicyResponder handles the response to the GetBlobAuditingPolicy request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetBlobAuditingPolicyResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetReplicationLink gets a database replication link. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to get the link for. linkID is the replication link ID to be -// retrieved. -func (client DatabasesClient) GetReplicationLink(resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLink, err error) { - req, err := client.GetReplicationLinkPreparer(resourceGroupName, serverName, databaseName, linkID) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetReplicationLink", nil, "Failure preparing request") - return - } - - resp, err := client.GetReplicationLinkSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetReplicationLink", resp, "Failure sending request") - return - } - - result, err = client.GetReplicationLinkResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetReplicationLink", resp, "Failure responding to request") - } - - return -} - -// GetReplicationLinkPreparer prepares the GetReplicationLink request. -func (client DatabasesClient) GetReplicationLinkPreparer(resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "linkId": autorest.Encode("path", linkID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetReplicationLinkSender sends the GetReplicationLink request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetReplicationLinkSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetReplicationLinkResponder handles the response to the GetReplicationLink request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetReplicationLinkResponder(resp *http.Response) (result ReplicationLink, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServiceTierAdvisor gets a service tier advisor. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of database. serviceTierAdvisorName is the name of service tier advisor. -func (client DatabasesClient) GetServiceTierAdvisor(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) { - req, err := client.GetServiceTierAdvisorPreparer(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", nil, "Failure preparing request") - return - } - - resp, err := client.GetServiceTierAdvisorSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", resp, "Failure sending request") - return - } - - result, err = client.GetServiceTierAdvisorResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", resp, "Failure responding to request") - } - - return -} - -// GetServiceTierAdvisorPreparer prepares the GetServiceTierAdvisor request. -func (client DatabasesClient) GetServiceTierAdvisorPreparer(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "serviceTierAdvisorName": autorest.Encode("path", serviceTierAdvisorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServiceTierAdvisorSender sends the GetServiceTierAdvisor request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetServiceTierAdvisorSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServiceTierAdvisorResponder handles the response to the GetServiceTierAdvisor request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetServiceTierAdvisorResponder(resp *http.Response) (result ServiceTierAdvisor, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetThreatDetectionPolicy gets a database's threat detection policy. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which database Threat Detection policy is defined. -func (client DatabasesClient) GetThreatDetectionPolicy(resourceGroupName string, serverName string, databaseName string) (result DatabaseSecurityAlertPolicy, err error) { - req, err := client.GetThreatDetectionPolicyPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetThreatDetectionPolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetThreatDetectionPolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetThreatDetectionPolicy", resp, "Failure sending request") - return - } - - result, err = client.GetThreatDetectionPolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetThreatDetectionPolicy", resp, "Failure responding to request") - } - - return -} - -// GetThreatDetectionPolicyPreparer prepares the GetThreatDetectionPolicy request. -func (client DatabasesClient) GetThreatDetectionPolicyPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetThreatDetectionPolicySender sends the GetThreatDetectionPolicy request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetThreatDetectionPolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetThreatDetectionPolicyResponder handles the response to the GetThreatDetectionPolicy request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetThreatDetectionPolicyResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetTransparentDataEncryptionConfiguration gets a database's transparent data -// encryption configuration. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which the transparent data encryption applies. -func (client DatabasesClient) GetTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { - req, err := client.GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.GetTransparentDataEncryptionConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", resp, "Failure sending request") - return - } - - result, err = client.GetTransparentDataEncryptionConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", resp, "Failure responding to request") - } - - return -} - -// GetTransparentDataEncryptionConfigurationPreparer prepares the GetTransparentDataEncryptionConfiguration request. -func (client DatabasesClient) GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetTransparentDataEncryptionConfigurationSender sends the GetTransparentDataEncryptionConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetTransparentDataEncryptionConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetTransparentDataEncryptionConfigurationResponder handles the response to the GetTransparentDataEncryptionConfiguration request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetTransparentDataEncryptionConfigurationResponder(resp *http.Response) (result TransparentDataEncryption, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Import imports a bacpac into a new database. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. parameters is the required -// parameters for importing a Bacpac into a database. -func (client DatabasesClient) Import(resourceGroupName string, serverName string, parameters ImportRequest, cancel <-chan struct{}) (<-chan ImportExportResponse, <-chan error) { - resultChan := make(chan ImportExportResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MaxSizeBytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "sql.DatabasesClient", "Import") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result ImportExportResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ImportPreparer(resourceGroupName, serverName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", nil, "Failure preparing request") - return - } - - resp, err := client.ImportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", resp, "Failure sending request") - return - } - - result, err = client.ImportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ImportPreparer prepares the Import request. -func (client DatabasesClient) ImportPreparer(resourceGroupName string, serverName string, parameters ImportRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ImportSender sends the Import request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ImportSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ImportResponder handles the response to the Import request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ImportResponder(resp *http.Response) (result ImportExportResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of databases in a server. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. expand is a comma -// separated list of child objects to expand in the response. Possible -// properties: serviceTierAdvisors, transparentDataEncryption. filter is an -// OData filter expression that describes a subset of databases to return. -func (client DatabasesClient) ListByServer(resourceGroupName string, serverName string, expand string, filter string) (result DatabaseListResult, err error) { - req, err := client.ListByServerPreparer(resourceGroupName, serverName, expand, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure responding to request") - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(resourceGroupName string, serverName string, expand string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListReplicationLinks lists a database's replication links. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database to retrieve links for. -func (client DatabasesClient) ListReplicationLinks(resourceGroupName string, serverName string, databaseName string) (result ReplicationLinkListResult, err error) { - req, err := client.ListReplicationLinksPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListReplicationLinks", nil, "Failure preparing request") - return - } - - resp, err := client.ListReplicationLinksSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListReplicationLinks", resp, "Failure sending request") - return - } - - result, err = client.ListReplicationLinksResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListReplicationLinks", resp, "Failure responding to request") - } - - return -} - -// ListReplicationLinksPreparer prepares the ListReplicationLinks request. -func (client DatabasesClient) ListReplicationLinksPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListReplicationLinksSender sends the ListReplicationLinks request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListReplicationLinksSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListReplicationLinksResponder handles the response to the ListReplicationLinks request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListReplicationLinksResponder(resp *http.Response) (result ReplicationLinkListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRestorePoints returns a list of database restore points. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database from which to retrieve available restore points. -func (client DatabasesClient) ListRestorePoints(resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { - req, err := client.ListRestorePointsPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", nil, "Failure preparing request") - return - } - - resp, err := client.ListRestorePointsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", resp, "Failure sending request") - return - } - - result, err = client.ListRestorePointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", resp, "Failure responding to request") - } - - return -} - -// ListRestorePointsPreparer prepares the ListRestorePoints request. -func (client DatabasesClient) ListRestorePointsPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListRestorePointsSender sends the ListRestorePoints request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListRestorePointsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListRestorePointsResponder handles the response to the ListRestorePoints request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListRestorePointsResponder(resp *http.Response) (result RestorePointListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListServiceTierAdvisors returns service tier advisors for specified -// database. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of database. -func (client DatabasesClient) ListServiceTierAdvisors(resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) { - req, err := client.ListServiceTierAdvisorsPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", nil, "Failure preparing request") - return - } - - resp, err := client.ListServiceTierAdvisorsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", resp, "Failure sending request") - return - } - - result, err = client.ListServiceTierAdvisorsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", resp, "Failure responding to request") - } - - return -} - -// ListServiceTierAdvisorsPreparer prepares the ListServiceTierAdvisors request. -func (client DatabasesClient) ListServiceTierAdvisorsPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListServiceTierAdvisorsSender sends the ListServiceTierAdvisors request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListServiceTierAdvisorsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListServiceTierAdvisorsResponder handles the response to the ListServiceTierAdvisors request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListServiceTierAdvisorsResponder(resp *http.Response) (result ServiceTierAdvisorListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListTransparentDataEncryptionActivity returns a database's transparent data -// encryption operation result. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database for which the transparent data encryption applies. -func (client DatabasesClient) ListTransparentDataEncryptionActivity(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { - req, err := client.ListTransparentDataEncryptionActivityPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", nil, "Failure preparing request") - return - } - - resp, err := client.ListTransparentDataEncryptionActivitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", resp, "Failure sending request") - return - } - - result, err = client.ListTransparentDataEncryptionActivityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", resp, "Failure responding to request") - } - - return -} - -// ListTransparentDataEncryptionActivityPreparer prepares the ListTransparentDataEncryptionActivity request. -func (client DatabasesClient) ListTransparentDataEncryptionActivityPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current/operationResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListTransparentDataEncryptionActivitySender sends the ListTransparentDataEncryptionActivity request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListTransparentDataEncryptionActivitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListTransparentDataEncryptionActivityResponder handles the response to the ListTransparentDataEncryptionActivity request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListTransparentDataEncryptionActivityResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages returns database usages. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the database. -func (client DatabasesClient) ListUsages(resourceGroupName string, serverName string, databaseName string) (result DatabaseMetricListResult, err error) { - req, err := client.ListUsagesPreparer(resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", resp, "Failure responding to request") - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client DatabasesClient) ListUsagesPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListUsagesResponder(resp *http.Response) (result DatabaseMetricListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Pause pauses a data warehouse. This method may poll for completion. Polling -// can be canceled by passing the cancel channel argument. The channel will be -// used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the data warehouse to pause. -func (client DatabasesClient) Pause(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.PausePreparer(resourceGroupName, serverName, databaseName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", nil, "Failure preparing request") - return - } - - resp, err := client.PauseSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", resp, "Failure sending request") - return - } - - result, err = client.PauseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// PausePreparer prepares the Pause request. -func (client DatabasesClient) PausePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// PauseSender sends the Pause request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) PauseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// PauseResponder handles the response to the Pause request. The method always -// closes the http.Response Body. -func (client DatabasesClient) PauseResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resume resumes a data warehouse. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. databaseName is the name -// of the data warehouse to resume. -func (client DatabasesClient) Resume(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ResumePreparer(resourceGroupName, serverName, databaseName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ResumePreparer prepares the Resume request. -func (client DatabasesClient) ResumePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResumeSender sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ResumeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DatabasesClient is the the Azure SQL Database management API provides a +// RESTful set of web services that interact with Azure SQL Database services +// to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type DatabasesClient struct { + ManagementClient +} + +// NewDatabasesClient creates an instance of the DatabasesClient client. +func NewDatabasesClient(subscriptionID string) DatabasesClient { + return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient +// client. +func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { + return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateImportOperation creates an import operation that imports a bacpac into +// an existing database. The existing database must be empty. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to import into parameters is the required parameters for +// importing a Bacpac into a database. +func (client DatabasesClient) CreateImportOperation(resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest, cancel <-chan struct{}) (<-chan ImportExportResponse, <-chan error) { + resultChan := make(chan ImportExportResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ImportExtensionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImportExtensionProperties.OperationMode", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "sql.DatabasesClient", "CreateImportOperation") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ImportExportResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateImportOperationPreparer(resourceGroupName, serverName, databaseName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", nil, "Failure preparing request") + return + } + + resp, err := client.CreateImportOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", resp, "Failure sending request") + return + } + + result, err = client.CreateImportOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateImportOperation", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateImportOperationPreparer prepares the CreateImportOperation request. +func (client DatabasesClient) CreateImportOperationPreparer(resourceGroupName string, serverName string, databaseName string, parameters ImportExtensionRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateImportOperationSender sends the CreateImportOperation request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateImportOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateImportOperationResponder handles the response to the CreateImportOperation request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateImportOperationResponder(resp *http.Response) (result ImportExportResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates a new database or updates an existing database. +// Location is a required property in the request body, and it must be the same +// as the location of the SQL server. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be operated on (updated or created). parameters is the +// required parameters for creating or updating a database. +func (client DatabasesClient) CreateOrUpdate(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (<-chan Database, <-chan error) { + resultChan := make(chan Database, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result Database + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, databaseName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabasesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, databaseName string, parameters Database, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateBlobAuditingPolicy creates or updates a database's blob +// auditing policy. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which database blob audit policy will be defined. +// parameters is the database blob auditing policy. +func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicy(resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (result DatabaseBlobAuditingPolicy, err error) { + req, err := client.CreateOrUpdateBlobAuditingPolicyPreparer(resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateBlobAuditingPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateBlobAuditingPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateBlobAuditingPolicy", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateBlobAuditingPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateBlobAuditingPolicy", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateBlobAuditingPolicyPreparer prepares the CreateOrUpdateBlobAuditingPolicy request. +func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicyPreparer(resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateBlobAuditingPolicySender sends the CreateOrUpdateBlobAuditingPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateBlobAuditingPolicyResponder handles the response to the CreateOrUpdateBlobAuditingPolicy request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateOrUpdateBlobAuditingPolicyResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateThreatDetectionPolicy creates or updates a database's threat +// detection policy. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which database Threat Detection policy is defined. +// parameters is the database Threat Detection policy. +func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicy(resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (result DatabaseSecurityAlertPolicy, err error) { + req, err := client.CreateOrUpdateThreatDetectionPolicyPreparer(resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateThreatDetectionPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateThreatDetectionPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateThreatDetectionPolicy", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateThreatDetectionPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateThreatDetectionPolicy", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateThreatDetectionPolicyPreparer prepares the CreateOrUpdateThreatDetectionPolicy request. +func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicyPreparer(resourceGroupName string, serverName string, databaseName string, parameters DatabaseSecurityAlertPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateThreatDetectionPolicySender sends the CreateOrUpdateThreatDetectionPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateThreatDetectionPolicyResponder handles the response to the CreateOrUpdateThreatDetectionPolicy request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateOrUpdateThreatDetectionPolicyResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateTransparentDataEncryptionConfiguration creates or updates a +// database's transparent data encryption configuration. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which setting the transparent data encryption applies. +// parameters is the required parameters for creating or updating transparent +// data encryption. +func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (result TransparentDataEncryption, err error) { + req, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateTransparentDataEncryptionConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateTransparentDataEncryptionConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "CreateOrUpdateTransparentDataEncryptionConfiguration", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateTransparentDataEncryptionConfigurationPreparer prepares the CreateOrUpdateTransparentDataEncryptionConfiguration request. +func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationPreparer(resourceGroupName string, serverName string, databaseName string, parameters TransparentDataEncryption) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateTransparentDataEncryptionConfigurationSender sends the CreateOrUpdateTransparentDataEncryptionConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateTransparentDataEncryptionConfigurationResponder handles the response to the CreateOrUpdateTransparentDataEncryptionConfiguration request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateOrUpdateTransparentDataEncryptionConfigurationResponder(resp *http.Response) (result TransparentDataEncryption, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a database. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be deleted. +func (client DatabasesClient) Delete(resourceGroupName string, serverName string, databaseName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DatabasesClient) DeletePreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteReplicationLink deletes a database replication link. Cannot be done +// during failover. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database that has the replication link to be dropped. linkID is the +// ID of the replication link to be deleted. +func (client DatabasesClient) DeleteReplicationLink(resourceGroupName string, serverName string, databaseName string, linkID string) (result autorest.Response, err error) { + req, err := client.DeleteReplicationLinkPreparer(resourceGroupName, serverName, databaseName, linkID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "DeleteReplicationLink", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteReplicationLinkSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "DeleteReplicationLink", resp, "Failure sending request") + return + } + + result, err = client.DeleteReplicationLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "DeleteReplicationLink", resp, "Failure responding to request") + } + + return +} + +// DeleteReplicationLinkPreparer prepares the DeleteReplicationLink request. +func (client DatabasesClient) DeleteReplicationLinkPreparer(resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "linkId": autorest.Encode("path", linkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteReplicationLinkSender sends the DeleteReplicationLink request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) DeleteReplicationLinkSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteReplicationLinkResponder handles the response to the DeleteReplicationLink request. The method always +// closes the http.Response Body. +func (client DatabasesClient) DeleteReplicationLinkResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Export exports a database to a bacpac. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be exported. parameters is the required parameters for +// exporting a database. +func (client DatabasesClient) Export(resourceGroupName string, serverName string, databaseName string, parameters ExportRequest, cancel <-chan struct{}) (<-chan ImportExportResponse, <-chan error) { + resultChan := make(chan ImportExportResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.StorageKey", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.StorageURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AdministratorLogin", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AdministratorLoginPassword", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "sql.DatabasesClient", "Export") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ImportExportResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ExportPreparer(resourceGroupName, serverName, databaseName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", nil, "Failure preparing request") + return + } + + resp, err := client.ExportSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", resp, "Failure sending request") + return + } + + result, err = client.ExportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Export", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ExportPreparer prepares the Export request. +func (client DatabasesClient) ExportPreparer(resourceGroupName string, serverName string, databaseName string, parameters ExportRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ExportSender sends the Export request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ExportSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ExportResponder handles the response to the Export request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ExportResponder(resp *http.Response) (result ImportExportResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// FailoverReplicationLink sets which replica database is primary by failing +// over from the current primary replica database. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database that has the replication link to be failed over. linkID is +// the ID of the replication link to be failed over. +func (client DatabasesClient) FailoverReplicationLink(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.FailoverReplicationLinkPreparer(resourceGroupName, serverName, databaseName, linkID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLink", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverReplicationLinkSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLink", resp, "Failure sending request") + return + } + + result, err = client.FailoverReplicationLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLink", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// FailoverReplicationLinkPreparer prepares the FailoverReplicationLink request. +func (client DatabasesClient) FailoverReplicationLinkPreparer(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "linkId": autorest.Encode("path", linkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// FailoverReplicationLinkSender sends the FailoverReplicationLink request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) FailoverReplicationLinkSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// FailoverReplicationLinkResponder handles the response to the FailoverReplicationLink request. The method always +// closes the http.Response Body. +func (client DatabasesClient) FailoverReplicationLinkResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// FailoverReplicationLinkAllowDataLoss sets which replica database is primary +// by failing over from the current primary replica database. This operation +// might result in data loss. This method may poll for completion. Polling can +// be canceled by passing the cancel channel argument. The channel will be used +// to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database that has the replication link to be failed over. linkID is +// the ID of the replication link to be failed over. +func (client DatabasesClient) FailoverReplicationLinkAllowDataLoss(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.FailoverReplicationLinkAllowDataLossPreparer(resourceGroupName, serverName, databaseName, linkID, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLinkAllowDataLoss", nil, "Failure preparing request") + return + } + + resp, err := client.FailoverReplicationLinkAllowDataLossSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLinkAllowDataLoss", resp, "Failure sending request") + return + } + + result, err = client.FailoverReplicationLinkAllowDataLossResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "FailoverReplicationLinkAllowDataLoss", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// FailoverReplicationLinkAllowDataLossPreparer prepares the FailoverReplicationLinkAllowDataLoss request. +func (client DatabasesClient) FailoverReplicationLinkAllowDataLossPreparer(resourceGroupName string, serverName string, databaseName string, linkID string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "linkId": autorest.Encode("path", linkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// FailoverReplicationLinkAllowDataLossSender sends the FailoverReplicationLinkAllowDataLoss request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) FailoverReplicationLinkAllowDataLossSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// FailoverReplicationLinkAllowDataLossResponder handles the response to the FailoverReplicationLinkAllowDataLoss request. The method always +// closes the http.Response Body. +func (client DatabasesClient) FailoverReplicationLinkAllowDataLossResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a database. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to be retrieved. expand is a comma separated list of child +// objects to expand in the response. Possible properties: serviceTierAdvisors, +// transparentDataEncryption. +func (client DatabasesClient) Get(resourceGroupName string, serverName string, databaseName string, expand string) (result Database, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, databaseName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabasesClient) GetPreparer(resourceGroupName string, serverName string, databaseName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBlobAuditingPolicy gets a database's blob auditing policy. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which database blob audit policy is defined. +func (client DatabasesClient) GetBlobAuditingPolicy(resourceGroupName string, serverName string, databaseName string) (result DatabaseBlobAuditingPolicy, err error) { + req, err := client.GetBlobAuditingPolicyPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetBlobAuditingPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetBlobAuditingPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetBlobAuditingPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetBlobAuditingPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetBlobAuditingPolicy", resp, "Failure responding to request") + } + + return +} + +// GetBlobAuditingPolicyPreparer prepares the GetBlobAuditingPolicy request. +func (client DatabasesClient) GetBlobAuditingPolicyPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBlobAuditingPolicySender sends the GetBlobAuditingPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetBlobAuditingPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBlobAuditingPolicyResponder handles the response to the GetBlobAuditingPolicy request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetBlobAuditingPolicyResponder(resp *http.Response) (result DatabaseBlobAuditingPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetReplicationLink gets a database replication link. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to get the link for. linkID is the replication link ID to be +// retrieved. +func (client DatabasesClient) GetReplicationLink(resourceGroupName string, serverName string, databaseName string, linkID string) (result ReplicationLink, err error) { + req, err := client.GetReplicationLinkPreparer(resourceGroupName, serverName, databaseName, linkID) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetReplicationLink", nil, "Failure preparing request") + return + } + + resp, err := client.GetReplicationLinkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetReplicationLink", resp, "Failure sending request") + return + } + + result, err = client.GetReplicationLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetReplicationLink", resp, "Failure responding to request") + } + + return +} + +// GetReplicationLinkPreparer prepares the GetReplicationLink request. +func (client DatabasesClient) GetReplicationLinkPreparer(resourceGroupName string, serverName string, databaseName string, linkID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "linkId": autorest.Encode("path", linkID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetReplicationLinkSender sends the GetReplicationLink request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetReplicationLinkSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetReplicationLinkResponder handles the response to the GetReplicationLink request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetReplicationLinkResponder(resp *http.Response) (result ReplicationLink, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetServiceTierAdvisor gets a service tier advisor. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of database. serviceTierAdvisorName is the name of service tier advisor. +func (client DatabasesClient) GetServiceTierAdvisor(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (result ServiceTierAdvisor, err error) { + req, err := client.GetServiceTierAdvisorPreparer(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", nil, "Failure preparing request") + return + } + + resp, err := client.GetServiceTierAdvisorSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", resp, "Failure sending request") + return + } + + result, err = client.GetServiceTierAdvisorResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetServiceTierAdvisor", resp, "Failure responding to request") + } + + return +} + +// GetServiceTierAdvisorPreparer prepares the GetServiceTierAdvisor request. +func (client DatabasesClient) GetServiceTierAdvisorPreparer(resourceGroupName string, serverName string, databaseName string, serviceTierAdvisorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "serviceTierAdvisorName": autorest.Encode("path", serviceTierAdvisorName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetServiceTierAdvisorSender sends the GetServiceTierAdvisor request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetServiceTierAdvisorSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetServiceTierAdvisorResponder handles the response to the GetServiceTierAdvisor request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetServiceTierAdvisorResponder(resp *http.Response) (result ServiceTierAdvisor, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetThreatDetectionPolicy gets a database's threat detection policy. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which database Threat Detection policy is defined. +func (client DatabasesClient) GetThreatDetectionPolicy(resourceGroupName string, serverName string, databaseName string) (result DatabaseSecurityAlertPolicy, err error) { + req, err := client.GetThreatDetectionPolicyPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetThreatDetectionPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetThreatDetectionPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetThreatDetectionPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetThreatDetectionPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetThreatDetectionPolicy", resp, "Failure responding to request") + } + + return +} + +// GetThreatDetectionPolicyPreparer prepares the GetThreatDetectionPolicy request. +func (client DatabasesClient) GetThreatDetectionPolicyPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetThreatDetectionPolicySender sends the GetThreatDetectionPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetThreatDetectionPolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetThreatDetectionPolicyResponder handles the response to the GetThreatDetectionPolicy request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetThreatDetectionPolicyResponder(resp *http.Response) (result DatabaseSecurityAlertPolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTransparentDataEncryptionConfiguration gets a database's transparent data +// encryption configuration. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which the transparent data encryption applies. +func (client DatabasesClient) GetTransparentDataEncryptionConfiguration(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryption, err error) { + req, err := client.GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetTransparentDataEncryptionConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetTransparentDataEncryptionConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "GetTransparentDataEncryptionConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetTransparentDataEncryptionConfigurationPreparer prepares the GetTransparentDataEncryptionConfiguration request. +func (client DatabasesClient) GetTransparentDataEncryptionConfigurationPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetTransparentDataEncryptionConfigurationSender sends the GetTransparentDataEncryptionConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetTransparentDataEncryptionConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetTransparentDataEncryptionConfigurationResponder handles the response to the GetTransparentDataEncryptionConfiguration request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetTransparentDataEncryptionConfigurationResponder(resp *http.Response) (result TransparentDataEncryption, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Import imports a bacpac into a new database. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. parameters is the required +// parameters for importing a Bacpac into a database. +func (client DatabasesClient) Import(resourceGroupName string, serverName string, parameters ImportRequest, cancel <-chan struct{}) (<-chan ImportExportResponse, <-chan error) { + resultChan := make(chan ImportExportResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MaxSizeBytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "sql.DatabasesClient", "Import") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result ImportExportResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ImportPreparer(resourceGroupName, serverName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", nil, "Failure preparing request") + return + } + + resp, err := client.ImportSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", resp, "Failure sending request") + return + } + + result, err = client.ImportResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Import", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ImportPreparer prepares the Import request. +func (client DatabasesClient) ImportPreparer(resourceGroupName string, serverName string, parameters ImportRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ImportSender sends the Import request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ImportSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ImportResponder handles the response to the Import request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ImportResponder(resp *http.Response) (result ImportExportResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer returns a list of databases in a server. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. expand is a comma +// separated list of child objects to expand in the response. Possible +// properties: serviceTierAdvisors, transparentDataEncryption. filter is an +// OData filter expression that describes a subset of databases to return. +func (client DatabasesClient) ListByServer(resourceGroupName string, serverName string, expand string, filter string) (result DatabaseListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName, expand, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client DatabasesClient) ListByServerPreparer(resourceGroupName string, serverName string, expand string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListReplicationLinks lists a database's replication links. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database to retrieve links for. +func (client DatabasesClient) ListReplicationLinks(resourceGroupName string, serverName string, databaseName string) (result ReplicationLinkListResult, err error) { + req, err := client.ListReplicationLinksPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListReplicationLinks", nil, "Failure preparing request") + return + } + + resp, err := client.ListReplicationLinksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListReplicationLinks", resp, "Failure sending request") + return + } + + result, err = client.ListReplicationLinksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListReplicationLinks", resp, "Failure responding to request") + } + + return +} + +// ListReplicationLinksPreparer prepares the ListReplicationLinks request. +func (client DatabasesClient) ListReplicationLinksPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListReplicationLinksSender sends the ListReplicationLinks request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListReplicationLinksSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListReplicationLinksResponder handles the response to the ListReplicationLinks request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListReplicationLinksResponder(resp *http.Response) (result ReplicationLinkListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRestorePoints returns a list of database restore points. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database from which to retrieve available restore points. +func (client DatabasesClient) ListRestorePoints(resourceGroupName string, serverName string, databaseName string) (result RestorePointListResult, err error) { + req, err := client.ListRestorePointsPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListRestorePointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", resp, "Failure sending request") + return + } + + result, err = client.ListRestorePointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListRestorePoints", resp, "Failure responding to request") + } + + return +} + +// ListRestorePointsPreparer prepares the ListRestorePoints request. +func (client DatabasesClient) ListRestorePointsPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRestorePointsSender sends the ListRestorePoints request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListRestorePointsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRestorePointsResponder handles the response to the ListRestorePoints request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListRestorePointsResponder(resp *http.Response) (result RestorePointListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListServiceTierAdvisors returns service tier advisors for specified +// database. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of database. +func (client DatabasesClient) ListServiceTierAdvisors(resourceGroupName string, serverName string, databaseName string) (result ServiceTierAdvisorListResult, err error) { + req, err := client.ListServiceTierAdvisorsPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", nil, "Failure preparing request") + return + } + + resp, err := client.ListServiceTierAdvisorsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", resp, "Failure sending request") + return + } + + result, err = client.ListServiceTierAdvisorsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListServiceTierAdvisors", resp, "Failure responding to request") + } + + return +} + +// ListServiceTierAdvisorsPreparer prepares the ListServiceTierAdvisors request. +func (client DatabasesClient) ListServiceTierAdvisorsPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListServiceTierAdvisorsSender sends the ListServiceTierAdvisors request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListServiceTierAdvisorsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListServiceTierAdvisorsResponder handles the response to the ListServiceTierAdvisors request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListServiceTierAdvisorsResponder(resp *http.Response) (result ServiceTierAdvisorListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListTransparentDataEncryptionActivity returns a database's transparent data +// encryption operation result. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database for which the transparent data encryption applies. +func (client DatabasesClient) ListTransparentDataEncryptionActivity(resourceGroupName string, serverName string, databaseName string) (result TransparentDataEncryptionActivityListResult, err error) { + req, err := client.ListTransparentDataEncryptionActivityPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", nil, "Failure preparing request") + return + } + + resp, err := client.ListTransparentDataEncryptionActivitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", resp, "Failure sending request") + return + } + + result, err = client.ListTransparentDataEncryptionActivityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListTransparentDataEncryptionActivity", resp, "Failure responding to request") + } + + return +} + +// ListTransparentDataEncryptionActivityPreparer prepares the ListTransparentDataEncryptionActivity request. +func (client DatabasesClient) ListTransparentDataEncryptionActivityPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current/operationResults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListTransparentDataEncryptionActivitySender sends the ListTransparentDataEncryptionActivity request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListTransparentDataEncryptionActivitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListTransparentDataEncryptionActivityResponder handles the response to the ListTransparentDataEncryptionActivity request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListTransparentDataEncryptionActivityResponder(resp *http.Response) (result TransparentDataEncryptionActivityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages returns database usages. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the database. +func (client DatabasesClient) ListUsages(resourceGroupName string, serverName string, databaseName string) (result DatabaseMetricListResult, err error) { + req, err := client.ListUsagesPreparer(resourceGroupName, serverName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client DatabasesClient) ListUsagesPreparer(resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListUsagesResponder(resp *http.Response) (result DatabaseMetricListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Pause pauses a data warehouse. This method may poll for completion. Polling +// can be canceled by passing the cancel channel argument. The channel will be +// used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the data warehouse to pause. +func (client DatabasesClient) Pause(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.PausePreparer(resourceGroupName, serverName, databaseName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", nil, "Failure preparing request") + return + } + + resp, err := client.PauseSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", resp, "Failure sending request") + return + } + + result, err = client.PauseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Pause", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// PausePreparer prepares the Pause request. +func (client DatabasesClient) PausePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// PauseSender sends the Pause request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) PauseSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// PauseResponder handles the response to the Pause request. The method always +// closes the http.Response Body. +func (client DatabasesClient) PauseResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resume resumes a data warehouse. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. databaseName is the name +// of the data warehouse to resume. +func (client DatabasesClient) Resume(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ResumePreparer(resourceGroupName, serverName, databaseName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", nil, "Failure preparing request") + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", resp, "Failure sending request") + return + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.DatabasesClient", "Resume", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ResumePreparer prepares the Resume request. +func (client DatabasesClient) ResumePreparer(resourceGroupName string, serverName string, databaseName string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ResumeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/elasticpools.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/elasticpools.go index 5eef3d0e68..e195ada6bc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/elasticpools.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/elasticpools.go @@ -1,615 +1,615 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ElasticPoolsClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services -// to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ElasticPoolsClient struct { - ManagementClient -} - -// NewElasticPoolsClient creates an instance of the ElasticPoolsClient client. -func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { - return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewElasticPoolsClientWithBaseURI creates an instance of the -// ElasticPoolsClient client. -func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { - return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new elastic pool or updates an existing elastic -// pool. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool to be operated on (updated or created). parameters -// is the required parameters for creating or updating an elastic pool. -func (client ElasticPoolsClient) CreateOrUpdate(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (<-chan ElasticPool, <-chan error) { - resultChan := make(chan ElasticPool, 1) - errChan := make(chan error, 1) - go func() { - var err error - var result ElasticPool - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, elasticPoolName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ElasticPoolsClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result ElasticPool, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool to be deleted. -func (client ElasticPoolsClient) Delete(resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ElasticPoolsClient) DeletePreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool to be retrieved. -func (client ElasticPoolsClient) Get(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { - req, err := client.GetPreparer(resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ElasticPoolsClient) GetPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDatabase gets a database inside of an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool to be retrieved. databaseName is the name of the -// database to be retrieved. -func (client ElasticPoolsClient) GetDatabase(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result Database, err error) { - req, err := client.GetDatabasePreparer(resourceGroupName, serverName, elasticPoolName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.GetDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", resp, "Failure sending request") - return - } - - result, err = client.GetDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", resp, "Failure responding to request") - } - - return -} - -// GetDatabasePreparer prepares the GetDatabase request. -func (client ElasticPoolsClient) GetDatabasePreparer(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDatabaseSender sends the GetDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) GetDatabaseSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDatabaseResponder handles the response to the GetDatabase request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) GetDatabaseResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListActivity returns elastic pool activities. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool for which to get the current activity. -func (client ElasticPoolsClient) ListActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) { - req, err := client.ListActivityPreparer(resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", nil, "Failure preparing request") - return - } - - resp, err := client.ListActivitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", resp, "Failure sending request") - return - } - - result, err = client.ListActivityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", resp, "Failure responding to request") - } - - return -} - -// ListActivityPreparer prepares the ListActivity request. -func (client ElasticPoolsClient) ListActivityPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListActivitySender sends the ListActivity request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListActivitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListActivityResponder handles the response to the ListActivity request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListActivityResponder(resp *http.Response) (result ElasticPoolActivityListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of elastic pools in a server. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client ElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result ElasticPoolListResult, err error) { - req, err := client.ListByServerPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ElasticPoolsClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDatabaseActivity returns activity on databases inside of an elastic -// pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool. -func (client ElasticPoolsClient) ListDatabaseActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolDatabaseActivityListResult, err error) { - req, err := client.ListDatabaseActivityPreparer(resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", nil, "Failure preparing request") - return - } - - resp, err := client.ListDatabaseActivitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", resp, "Failure sending request") - return - } - - result, err = client.ListDatabaseActivityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", resp, "Failure responding to request") - } - - return -} - -// ListDatabaseActivityPreparer prepares the ListDatabaseActivity request. -func (client ElasticPoolsClient) ListDatabaseActivityPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDatabaseActivitySender sends the ListDatabaseActivity request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListDatabaseActivitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDatabaseActivityResponder handles the response to the ListDatabaseActivity request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListDatabaseActivityResponder(resp *http.Response) (result ElasticPoolDatabaseActivityListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDatabases returns a list of databases in an elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. elasticPoolName is the -// name of the elastic pool to be retrieved. -func (client ElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResult, err error) { - req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, elasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", resp, "Failure responding to request") - } - - return -} - -// ListDatabasesPreparer prepares the ListDatabases request. -func (client ElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "elasticPoolName": autorest.Encode("path", elasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDatabasesSender sends the ListDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client ElasticPoolsClient) ListDatabasesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDatabasesResponder handles the response to the ListDatabases request. The method always -// closes the http.Response Body. -func (client ElasticPoolsClient) ListDatabasesResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ElasticPoolsClient is the the Azure SQL Database management API provides a +// RESTful set of web services that interact with Azure SQL Database services +// to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type ElasticPoolsClient struct { + ManagementClient +} + +// NewElasticPoolsClient creates an instance of the ElasticPoolsClient client. +func NewElasticPoolsClient(subscriptionID string) ElasticPoolsClient { + return NewElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewElasticPoolsClientWithBaseURI creates an instance of the +// ElasticPoolsClient client. +func NewElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) ElasticPoolsClient { + return ElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new elastic pool or updates an existing elastic +// pool. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be operated on (updated or created). parameters +// is the required parameters for creating or updating an elastic pool. +func (client ElasticPoolsClient) CreateOrUpdate(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (<-chan ElasticPool, <-chan error) { + resultChan := make(chan ElasticPool, 1) + errChan := make(chan error, 1) + go func() { + var err error + var result ElasticPool + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, elasticPoolName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ElasticPoolsClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result ElasticPool, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be deleted. +func (client ElasticPoolsClient) Delete(resourceGroupName string, serverName string, elasticPoolName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, serverName, elasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ElasticPoolsClient) DeletePreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be retrieved. +func (client ElasticPoolsClient) Get(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPool, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, elasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ElasticPoolsClient) GetPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) GetResponder(resp *http.Response) (result ElasticPool, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDatabase gets a database inside of an elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be retrieved. databaseName is the name of the +// database to be retrieved. +func (client ElasticPoolsClient) GetDatabase(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (result Database, err error) { + req, err := client.GetDatabasePreparer(resourceGroupName, serverName, elasticPoolName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", nil, "Failure preparing request") + return + } + + resp, err := client.GetDatabaseSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", resp, "Failure sending request") + return + } + + result, err = client.GetDatabaseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "GetDatabase", resp, "Failure responding to request") + } + + return +} + +// GetDatabasePreparer prepares the GetDatabase request. +func (client ElasticPoolsClient) GetDatabasePreparer(resourceGroupName string, serverName string, elasticPoolName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDatabaseSender sends the GetDatabase request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) GetDatabaseSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDatabaseResponder handles the response to the GetDatabase request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) GetDatabaseResponder(resp *http.Response) (result Database, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListActivity returns elastic pool activities. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool for which to get the current activity. +func (client ElasticPoolsClient) ListActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolActivityListResult, err error) { + req, err := client.ListActivityPreparer(resourceGroupName, serverName, elasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", nil, "Failure preparing request") + return + } + + resp, err := client.ListActivitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", resp, "Failure sending request") + return + } + + result, err = client.ListActivityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListActivity", resp, "Failure responding to request") + } + + return +} + +// ListActivityPreparer prepares the ListActivity request. +func (client ElasticPoolsClient) ListActivityPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListActivitySender sends the ListActivity request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) ListActivitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListActivityResponder handles the response to the ListActivity request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) ListActivityResponder(resp *http.Response) (result ElasticPoolActivityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer returns a list of elastic pools in a server. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client ElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result ElasticPoolListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client ElasticPoolsClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) ListByServerResponder(resp *http.Response) (result ElasticPoolListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDatabaseActivity returns activity on databases inside of an elastic +// pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool. +func (client ElasticPoolsClient) ListDatabaseActivity(resourceGroupName string, serverName string, elasticPoolName string) (result ElasticPoolDatabaseActivityListResult, err error) { + req, err := client.ListDatabaseActivityPreparer(resourceGroupName, serverName, elasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", nil, "Failure preparing request") + return + } + + resp, err := client.ListDatabaseActivitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", resp, "Failure sending request") + return + } + + result, err = client.ListDatabaseActivityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabaseActivity", resp, "Failure responding to request") + } + + return +} + +// ListDatabaseActivityPreparer prepares the ListDatabaseActivity request. +func (client ElasticPoolsClient) ListDatabaseActivityPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDatabaseActivitySender sends the ListDatabaseActivity request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) ListDatabaseActivitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDatabaseActivityResponder handles the response to the ListDatabaseActivity request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) ListDatabaseActivityResponder(resp *http.Response) (result ElasticPoolDatabaseActivityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDatabases returns a list of databases in an elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. elasticPoolName is the +// name of the elastic pool to be retrieved. +func (client ElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, elasticPoolName string) (result DatabaseListResult, err error) { + req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, elasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.ListDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", resp, "Failure sending request") + return + } + + result, err = client.ListDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ElasticPoolsClient", "ListDatabases", resp, "Failure responding to request") + } + + return +} + +// ListDatabasesPreparer prepares the ListDatabases request. +func (client ElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, serverName string, elasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "elasticPoolName": autorest.Encode("path", elasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDatabasesSender sends the ListDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ElasticPoolsClient) ListDatabasesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDatabasesResponder handles the response to the ListDatabases request. The method always +// closes the http.Response Body. +func (client ElasticPoolsClient) ListDatabasesResponder(resp *http.Response) (result DatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/firewallrules.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/firewallrules.go index ed7d4251ca..e4f3fa4c05 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/firewallrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/firewallrules.go @@ -1,331 +1,331 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// FirewallRulesClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services -// to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type FirewallRulesClient struct { - ManagementClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient -// client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the -// FirewallRulesClient client. -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a firewall rule. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. firewallRuleName is the -// name of the firewall rule. parameters is the required parameters for -// creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "sql.FirewallRulesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a firewall rule. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. firewallRuleName is the -// name of the firewall rule. -func (client FirewallRulesClient) Delete(resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a firewall rule. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. firewallRuleName is the -// name of the firewall rule. -func (client FirewallRulesClient) Get(resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - req, err := client.GetPreparer(resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns a list of firewall rules. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client FirewallRulesClient) ListByServer(resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { - req, err := client.ListByServerPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// FirewallRulesClient is the the Azure SQL Database management API provides a +// RESTful set of web services that interact with Azure SQL Database services +// to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type FirewallRulesClient struct { + ManagementClient +} + +// NewFirewallRulesClient creates an instance of the FirewallRulesClient +// client. +func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { + return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallRulesClientWithBaseURI creates an instance of the +// FirewallRulesClient client. +func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { + return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a firewall rule. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. firewallRuleName is the +// name of the firewall rule. parameters is the required parameters for +// creating or updating a firewall rule. +func (client FirewallRulesClient) CreateOrUpdate(resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "sql.FirewallRulesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, firewallRuleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallRulesClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a firewall rule. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. firewallRuleName is the +// name of the firewall rule. +func (client FirewallRulesClient) Delete(resourceGroupName string, serverName string, firewallRuleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, serverName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallRulesClient) DeletePreparer(resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a firewall rule. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. firewallRuleName is the +// name of the firewall rule. +func (client FirewallRulesClient) Get(resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, firewallRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallRulesClient) GetPreparer(resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallRuleName": autorest.Encode("path", firewallRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer returns a list of firewall rules. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client FirewallRulesClient) ListByServer(resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client FirewallRulesClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/models.go index dc961bca06..6f42dca75c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/models.go @@ -1,1180 +1,1180 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/satori/uuid" -) - -// AuthenticationType enumerates the values for authentication type. -type AuthenticationType string - -const ( - // ADPassword specifies the ad password state for authentication type. - ADPassword AuthenticationType = "ADPassword" - // SQL specifies the sql state for authentication type. - SQL AuthenticationType = "SQL" -) - -// BlobAuditingPolicyState enumerates the values for blob auditing policy -// state. -type BlobAuditingPolicyState string - -const ( - // Disabled specifies the disabled state for blob auditing policy state. - Disabled BlobAuditingPolicyState = "Disabled" - // Enabled specifies the enabled state for blob auditing policy state. - Enabled BlobAuditingPolicyState = "Enabled" -) - -// CapabilityStatus enumerates the values for capability status. -type CapabilityStatus string - -const ( - // CapabilityStatusAvailable specifies the capability status available - // state for capability status. - CapabilityStatusAvailable CapabilityStatus = "Available" - // CapabilityStatusDefault specifies the capability status default state - // for capability status. - CapabilityStatusDefault CapabilityStatus = "Default" - // CapabilityStatusDisabled specifies the capability status disabled state - // for capability status. - CapabilityStatusDisabled CapabilityStatus = "Disabled" - // CapabilityStatusVisible specifies the capability status visible state - // for capability status. - CapabilityStatusVisible CapabilityStatus = "Visible" -) - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // Copy specifies the copy state for create mode. - Copy CreateMode = "Copy" - // Default specifies the default state for create mode. - Default CreateMode = "Default" - // NonReadableSecondary specifies the non readable secondary state for - // create mode. - NonReadableSecondary CreateMode = "NonReadableSecondary" - // OnlineSecondary specifies the online secondary state for create mode. - OnlineSecondary CreateMode = "OnlineSecondary" - // PointInTimeRestore specifies the point in time restore state for create - // mode. - PointInTimeRestore CreateMode = "PointInTimeRestore" - // Recovery specifies the recovery state for create mode. - Recovery CreateMode = "Recovery" - // Restore specifies the restore state for create mode. - Restore CreateMode = "Restore" - // RestoreLongTermRetentionBackup specifies the restore long term retention - // backup state for create mode. - RestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" -) - -// DatabaseEdition enumerates the values for database edition. -type DatabaseEdition string - -const ( - // Basic specifies the basic state for database edition. - Basic DatabaseEdition = "Basic" - // Business specifies the business state for database edition. - Business DatabaseEdition = "Business" - // DataWarehouse specifies the data warehouse state for database edition. - DataWarehouse DatabaseEdition = "DataWarehouse" - // Free specifies the free state for database edition. - Free DatabaseEdition = "Free" - // Premium specifies the premium state for database edition. - Premium DatabaseEdition = "Premium" - // Standard specifies the standard state for database edition. - Standard DatabaseEdition = "Standard" - // Stretch specifies the stretch state for database edition. - Stretch DatabaseEdition = "Stretch" - // System specifies the system state for database edition. - System DatabaseEdition = "System" - // System2 specifies the system 2 state for database edition. - System2 DatabaseEdition = "System2" - // Web specifies the web state for database edition. - Web DatabaseEdition = "Web" -) - -// ElasticPoolEdition enumerates the values for elastic pool edition. -type ElasticPoolEdition string - -const ( - // ElasticPoolEditionBasic specifies the elastic pool edition basic state - // for elastic pool edition. - ElasticPoolEditionBasic ElasticPoolEdition = "Basic" - // ElasticPoolEditionPremium specifies the elastic pool edition premium - // state for elastic pool edition. - ElasticPoolEditionPremium ElasticPoolEdition = "Premium" - // ElasticPoolEditionStandard specifies the elastic pool edition standard - // state for elastic pool edition. - ElasticPoolEditionStandard ElasticPoolEdition = "Standard" -) - -// ElasticPoolState enumerates the values for elastic pool state. -type ElasticPoolState string - -const ( - // ElasticPoolStateCreating specifies the elastic pool state creating state - // for elastic pool state. - ElasticPoolStateCreating ElasticPoolState = "Creating" - // ElasticPoolStateDisabled specifies the elastic pool state disabled state - // for elastic pool state. - ElasticPoolStateDisabled ElasticPoolState = "Disabled" - // ElasticPoolStateReady specifies the elastic pool state ready state for - // elastic pool state. - ElasticPoolStateReady ElasticPoolState = "Ready" -) - -// MaxSizeUnits enumerates the values for max size units. -type MaxSizeUnits string - -const ( - // Gigabytes specifies the gigabytes state for max size units. - Gigabytes MaxSizeUnits = "Gigabytes" - // Megabytes specifies the megabytes state for max size units. - Megabytes MaxSizeUnits = "Megabytes" - // Petabytes specifies the petabytes state for max size units. - Petabytes MaxSizeUnits = "Petabytes" - // Terabytes specifies the terabytes state for max size units. - Terabytes MaxSizeUnits = "Terabytes" -) - -// PerformanceLevelUnit enumerates the values for performance level unit. -type PerformanceLevelUnit string - -const ( - // DTU specifies the dtu state for performance level unit. - DTU PerformanceLevelUnit = "DTU" -) - -// ReadScale enumerates the values for read scale. -type ReadScale string - -const ( - // ReadScaleDisabled specifies the read scale disabled state for read - // scale. - ReadScaleDisabled ReadScale = "Disabled" - // ReadScaleEnabled specifies the read scale enabled state for read scale. - ReadScaleEnabled ReadScale = "Enabled" -) - -// RecommendedIndexAction enumerates the values for recommended index action. -type RecommendedIndexAction string - -const ( - // Create specifies the create state for recommended index action. - Create RecommendedIndexAction = "Create" - // Drop specifies the drop state for recommended index action. - Drop RecommendedIndexAction = "Drop" - // Rebuild specifies the rebuild state for recommended index action. - Rebuild RecommendedIndexAction = "Rebuild" -) - -// RecommendedIndexState enumerates the values for recommended index state. -type RecommendedIndexState string - -const ( - // Active specifies the active state for recommended index state. - Active RecommendedIndexState = "Active" - // Blocked specifies the blocked state for recommended index state. - Blocked RecommendedIndexState = "Blocked" - // Executing specifies the executing state for recommended index state. - Executing RecommendedIndexState = "Executing" - // Expired specifies the expired state for recommended index state. - Expired RecommendedIndexState = "Expired" - // Ignored specifies the ignored state for recommended index state. - Ignored RecommendedIndexState = "Ignored" - // Pending specifies the pending state for recommended index state. - Pending RecommendedIndexState = "Pending" - // PendingRevert specifies the pending revert state for recommended index - // state. - PendingRevert RecommendedIndexState = "Pending Revert" - // Reverted specifies the reverted state for recommended index state. - Reverted RecommendedIndexState = "Reverted" - // Reverting specifies the reverting state for recommended index state. - Reverting RecommendedIndexState = "Reverting" - // Success specifies the success state for recommended index state. - Success RecommendedIndexState = "Success" - // Verifying specifies the verifying state for recommended index state. - Verifying RecommendedIndexState = "Verifying" -) - -// RecommendedIndexType enumerates the values for recommended index type. -type RecommendedIndexType string - -const ( - // CLUSTERED specifies the clustered state for recommended index type. - CLUSTERED RecommendedIndexType = "CLUSTERED" - // CLUSTEREDCOLUMNSTORE specifies the clusteredcolumnstore state for - // recommended index type. - CLUSTEREDCOLUMNSTORE RecommendedIndexType = "CLUSTERED COLUMNSTORE" - // COLUMNSTORE specifies the columnstore state for recommended index type. - COLUMNSTORE RecommendedIndexType = "COLUMNSTORE" - // NONCLUSTERED specifies the nonclustered state for recommended index - // type. - NONCLUSTERED RecommendedIndexType = "NONCLUSTERED" -) - -// ReplicationRole enumerates the values for replication role. -type ReplicationRole string - -const ( - // ReplicationRoleCopy specifies the replication role copy state for - // replication role. - ReplicationRoleCopy ReplicationRole = "Copy" - // ReplicationRoleNonReadableSecondary specifies the replication role non - // readable secondary state for replication role. - ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" - // ReplicationRolePrimary specifies the replication role primary state for - // replication role. - ReplicationRolePrimary ReplicationRole = "Primary" - // ReplicationRoleSecondary specifies the replication role secondary state - // for replication role. - ReplicationRoleSecondary ReplicationRole = "Secondary" - // ReplicationRoleSource specifies the replication role source state for - // replication role. - ReplicationRoleSource ReplicationRole = "Source" -) - -// ReplicationState enumerates the values for replication state. -type ReplicationState string - -const ( - // CATCHUP specifies the catchup state for replication state. - CATCHUP ReplicationState = "CATCH_UP" - // PENDING specifies the pending state for replication state. - PENDING ReplicationState = "PENDING" - // SEEDING specifies the seeding state for replication state. - SEEDING ReplicationState = "SEEDING" - // SUSPENDED specifies the suspended state for replication state. - SUSPENDED ReplicationState = "SUSPENDED" -) - -// RestorePointTypes enumerates the values for restore point types. -type RestorePointTypes string - -const ( - // CONTINUOUS specifies the continuous state for restore point types. - CONTINUOUS RestorePointTypes = "CONTINUOUS" - // DISCRETE specifies the discrete state for restore point types. - DISCRETE RestorePointTypes = "DISCRETE" -) - -// SampleName enumerates the values for sample name. -type SampleName string - -const ( - // AdventureWorksLT specifies the adventure works lt state for sample name. - AdventureWorksLT SampleName = "AdventureWorksLT" -) - -// SecurityAlertPolicyEmailAccountAdmins enumerates the values for security -// alert policy email account admins. -type SecurityAlertPolicyEmailAccountAdmins string - -const ( - // SecurityAlertPolicyEmailAccountAdminsDisabled specifies the security - // alert policy email account admins disabled state for security alert - // policy email account admins. - SecurityAlertPolicyEmailAccountAdminsDisabled SecurityAlertPolicyEmailAccountAdmins = "Disabled" - // SecurityAlertPolicyEmailAccountAdminsEnabled specifies the security - // alert policy email account admins enabled state for security alert - // policy email account admins. - SecurityAlertPolicyEmailAccountAdminsEnabled SecurityAlertPolicyEmailAccountAdmins = "Enabled" -) - -// SecurityAlertPolicyState enumerates the values for security alert policy -// state. -type SecurityAlertPolicyState string - -const ( - // SecurityAlertPolicyStateDisabled specifies the security alert policy - // state disabled state for security alert policy state. - SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" - // SecurityAlertPolicyStateEnabled specifies the security alert policy - // state enabled state for security alert policy state. - SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" - // SecurityAlertPolicyStateNew specifies the security alert policy state - // new state for security alert policy state. - SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" -) - -// SecurityAlertPolicyUseServerDefault enumerates the values for security alert -// policy use server default. -type SecurityAlertPolicyUseServerDefault string - -const ( - // SecurityAlertPolicyUseServerDefaultDisabled specifies the security alert - // policy use server default disabled state for security alert policy use - // server default. - SecurityAlertPolicyUseServerDefaultDisabled SecurityAlertPolicyUseServerDefault = "Disabled" - // SecurityAlertPolicyUseServerDefaultEnabled specifies the security alert - // policy use server default enabled state for security alert policy use - // server default. - SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = "Enabled" -) - -// ServerState enumerates the values for server state. -type ServerState string - -const ( - // ServerStateDisabled specifies the server state disabled state for server - // state. - ServerStateDisabled ServerState = "Disabled" - // ServerStateReady specifies the server state ready state for server - // state. - ServerStateReady ServerState = "Ready" -) - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // OneTwoFullStopZero specifies the one two full stop zero state for server - // version. - OneTwoFullStopZero ServerVersion = "12.0" - // TwoFullStopZero specifies the two full stop zero state for server - // version. - TwoFullStopZero ServerVersion = "2.0" -) - -// ServiceObjectiveName enumerates the values for service objective name. -type ServiceObjectiveName string - -const ( - // ServiceObjectiveNameBasic specifies the service objective name basic - // state for service objective name. - ServiceObjectiveNameBasic ServiceObjectiveName = "Basic" - // ServiceObjectiveNameElasticPool specifies the service objective name - // elastic pool state for service objective name. - ServiceObjectiveNameElasticPool ServiceObjectiveName = "ElasticPool" - // ServiceObjectiveNameP1 specifies the service objective name p1 state for - // service objective name. - ServiceObjectiveNameP1 ServiceObjectiveName = "P1" - // ServiceObjectiveNameP11 specifies the service objective name p11 state - // for service objective name. - ServiceObjectiveNameP11 ServiceObjectiveName = "P11" - // ServiceObjectiveNameP15 specifies the service objective name p15 state - // for service objective name. - ServiceObjectiveNameP15 ServiceObjectiveName = "P15" - // ServiceObjectiveNameP2 specifies the service objective name p2 state for - // service objective name. - ServiceObjectiveNameP2 ServiceObjectiveName = "P2" - // ServiceObjectiveNameP3 specifies the service objective name p3 state for - // service objective name. - ServiceObjectiveNameP3 ServiceObjectiveName = "P3" - // ServiceObjectiveNameP4 specifies the service objective name p4 state for - // service objective name. - ServiceObjectiveNameP4 ServiceObjectiveName = "P4" - // ServiceObjectiveNameP6 specifies the service objective name p6 state for - // service objective name. - ServiceObjectiveNameP6 ServiceObjectiveName = "P6" - // ServiceObjectiveNameS0 specifies the service objective name s0 state for - // service objective name. - ServiceObjectiveNameS0 ServiceObjectiveName = "S0" - // ServiceObjectiveNameS1 specifies the service objective name s1 state for - // service objective name. - ServiceObjectiveNameS1 ServiceObjectiveName = "S1" - // ServiceObjectiveNameS2 specifies the service objective name s2 state for - // service objective name. - ServiceObjectiveNameS2 ServiceObjectiveName = "S2" - // ServiceObjectiveNameS3 specifies the service objective name s3 state for - // service objective name. - ServiceObjectiveNameS3 ServiceObjectiveName = "S3" - // ServiceObjectiveNameSystem specifies the service objective name system - // state for service objective name. - ServiceObjectiveNameSystem ServiceObjectiveName = "System" - // ServiceObjectiveNameSystem2 specifies the service objective name system - // 2 state for service objective name. - ServiceObjectiveNameSystem2 ServiceObjectiveName = "System2" -) - -// StorageKeyType enumerates the values for storage key type. -type StorageKeyType string - -const ( - // SharedAccessKey specifies the shared access key state for storage key - // type. - SharedAccessKey StorageKeyType = "SharedAccessKey" - // StorageAccessKey specifies the storage access key state for storage key - // type. - StorageAccessKey StorageKeyType = "StorageAccessKey" -) - -// TransparentDataEncryptionActivityStatus enumerates the values for -// transparent data encryption activity status. -type TransparentDataEncryptionActivityStatus string - -const ( - // Decrypting specifies the decrypting state for transparent data - // encryption activity status. - Decrypting TransparentDataEncryptionActivityStatus = "Decrypting" - // Encrypting specifies the encrypting state for transparent data - // encryption activity status. - Encrypting TransparentDataEncryptionActivityStatus = "Encrypting" -) - -// TransparentDataEncryptionStatus enumerates the values for transparent data -// encryption status. -type TransparentDataEncryptionStatus string - -const ( - // TransparentDataEncryptionStatusDisabled specifies the transparent data - // encryption status disabled state for transparent data encryption status. - TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" - // TransparentDataEncryptionStatusEnabled specifies the transparent data - // encryption status enabled state for transparent data encryption status. - TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" -) - -// Database is represents a database. -type Database struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - Kind *string `json:"kind,omitempty"` - *DatabaseProperties `json:"properties,omitempty"` -} - -// DatabaseBlobAuditingPolicy is contains information about a database Blob -// Auditing policy. -type DatabaseBlobAuditingPolicy struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Kind *string `json:"kind,omitempty"` - *DatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` -} - -// DatabaseBlobAuditingPolicyProperties is properties for a database Blob -// Auditing policy. -type DatabaseBlobAuditingPolicyProperties struct { - State BlobAuditingPolicyState `json:"state,omitempty"` - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - RetentionDays *int32 `json:"retentionDays,omitempty"` - AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` - StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` -} - -// DatabaseListResult is represents the response to a list database request. -type DatabaseListResult struct { - autorest.Response `json:"-"` - Value *[]Database `json:"value,omitempty"` -} - -// DatabaseMetric is represents database metrics. -type DatabaseMetric struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - CurrentValue *float64 `json:"currentValue,omitempty"` - Limit *float64 `json:"limit,omitempty"` - Unit *string `json:"unit,omitempty"` - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// DatabaseMetricListResult is represents the response to a list database -// metrics request. -type DatabaseMetricListResult struct { - autorest.Response `json:"-"` - Value *[]DatabaseMetric `json:"value,omitempty"` -} - -// DatabaseProperties is represents the properties of a database. -type DatabaseProperties struct { - Collation *string `json:"collation,omitempty"` - CreationDate *date.Time `json:"creationDate,omitempty"` - ContainmentState *int64 `json:"containmentState,omitempty"` - CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` - DatabaseID *uuid.UUID `json:"databaseId,omitempty"` - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - CreateMode CreateMode `json:"createMode,omitempty"` - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` - SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - RecoveryServicesRecoveryPointResourceID *string `json:"recoveryServicesRecoveryPointResourceId,omitempty"` - Edition DatabaseEdition `json:"edition,omitempty"` - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` - RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` - RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - Status *string `json:"status,omitempty"` - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` - ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` - TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` - RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` - FailoverGroupID *uuid.UUID `json:"failoverGroupId,omitempty"` - ReadScale ReadScale `json:"readScale,omitempty"` - SampleName SampleName `json:"sampleName,omitempty"` -} - -// DatabaseSecurityAlertPolicy is contains information about a database Threat -// Detection policy. -type DatabaseSecurityAlertPolicy struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Kind *string `json:"kind,omitempty"` - *DatabaseSecurityAlertPolicyProperties `json:"properties,omitempty"` -} - -// DatabaseSecurityAlertPolicyProperties is properties for a database Threat -// Detection policy. -type DatabaseSecurityAlertPolicyProperties struct { - State SecurityAlertPolicyState `json:"state,omitempty"` - DisabledAlerts *string `json:"disabledAlerts,omitempty"` - EmailAddresses *string `json:"emailAddresses,omitempty"` - EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - RetentionDays *int32 `json:"retentionDays,omitempty"` - UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` -} - -// EditionCapability is the database edition capabilities. -type EditionCapability struct { - Name *string `json:"name,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` -} - -// ElasticPool is represents a database elastic pool. -type ElasticPool struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - *ElasticPoolProperties `json:"properties,omitempty"` - Kind *string `json:"kind,omitempty"` -} - -// ElasticPoolActivity is represents the activity on an elastic pool. -type ElasticPoolActivity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - *ElasticPoolActivityProperties `json:"properties,omitempty"` -} - -// ElasticPoolActivityListResult is represents the response to a list elastic -// pool activity request. -type ElasticPoolActivityListResult struct { - autorest.Response `json:"-"` - Value *[]ElasticPoolActivity `json:"value,omitempty"` -} - -// ElasticPoolActivityProperties is represents the properties of an elastic -// pool. -type ElasticPoolActivityProperties struct { - EndTime *date.Time `json:"endTime,omitempty"` - ErrorCode *int32 `json:"errorCode,omitempty"` - ErrorMessage *string `json:"errorMessage,omitempty"` - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - Operation *string `json:"operation,omitempty"` - OperationID *uuid.UUID `json:"operationId,omitempty"` - PercentComplete *int32 `json:"percentComplete,omitempty"` - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` - RequestedDtu *int32 `json:"requestedDtu,omitempty"` - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` - ElasticPoolName *string `json:"elasticPoolName,omitempty"` - ServerName *string `json:"serverName,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - State *string `json:"state,omitempty"` - RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` - RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` - RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` - RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` -} - -// ElasticPoolDatabaseActivity is represents the activity on an elastic pool. -type ElasticPoolDatabaseActivity struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` -} - -// ElasticPoolDatabaseActivityListResult is represents the response to a list -// elastic pool database activity request. -type ElasticPoolDatabaseActivityListResult struct { - autorest.Response `json:"-"` - Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` -} - -// ElasticPoolDatabaseActivityProperties is represents the properties of an -// elastic pool database activity. -type ElasticPoolDatabaseActivityProperties struct { - DatabaseName *string `json:"databaseName,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ErrorCode *int32 `json:"errorCode,omitempty"` - ErrorMessage *string `json:"errorMessage,omitempty"` - ErrorSeverity *int32 `json:"errorSeverity,omitempty"` - Operation *string `json:"operation,omitempty"` - OperationID *uuid.UUID `json:"operationId,omitempty"` - PercentComplete *int32 `json:"percentComplete,omitempty"` - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` - CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` - CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` - RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` - ServerName *string `json:"serverName,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - State *string `json:"state,omitempty"` -} - -// ElasticPoolDtuCapability is the Elastic Pool DTU capability. -type ElasticPoolDtuCapability struct { - Limit *int64 `json:"limit,omitempty"` - MaxDatabaseCount *int64 `json:"maxDatabaseCount,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` - SupportedPerDatabaseMaxSizes *[]MaxSizeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` - SupportedPerDatabaseMaxDtus *[]ElasticPoolPerDatabaseMaxDtuCapability `json:"supportedPerDatabaseMaxDtus,omitempty"` -} - -// ElasticPoolEditionCapability is the elastic pool edition capabilities. -type ElasticPoolEditionCapability struct { - Name *string `json:"name,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - SupportedElasticPoolDtus *[]ElasticPoolDtuCapability `json:"supportedElasticPoolDtus,omitempty"` -} - -// ElasticPoolListResult is represents the response to a list elastic pool -// request. -type ElasticPoolListResult struct { - autorest.Response `json:"-"` - Value *[]ElasticPool `json:"value,omitempty"` -} - -// ElasticPoolPerDatabaseMaxDtuCapability is the max per-database DTU -// capability. -type ElasticPoolPerDatabaseMaxDtuCapability struct { - Limit *int64 `json:"limit,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - SupportedPerDatabaseMinDtus *[]ElasticPoolPerDatabaseMinDtuCapability `json:"supportedPerDatabaseMinDtus,omitempty"` -} - -// ElasticPoolPerDatabaseMinDtuCapability is the minimum per-database DTU -// capability. -type ElasticPoolPerDatabaseMinDtuCapability struct { - Limit *int64 `json:"limit,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` -} - -// ElasticPoolProperties is represents the properties of an elastic pool. -type ElasticPoolProperties struct { - CreationDate *date.Time `json:"creationDate,omitempty"` - State ElasticPoolState `json:"state,omitempty"` - Edition ElasticPoolEdition `json:"edition,omitempty"` - Dtu *int32 `json:"dtu,omitempty"` - DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` - DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` - StorageMB *int32 `json:"storageMB,omitempty"` -} - -// ExportRequest is export database parameters. -type ExportRequest struct { - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - StorageKey *string `json:"storageKey,omitempty"` - StorageURI *string `json:"storageUri,omitempty"` - AdministratorLogin *string `json:"administratorLogin,omitempty"` - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` -} - -// FirewallRule is represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *FirewallRuleProperties `json:"properties,omitempty"` -} - -// FirewallRuleListResult is represents the response to a List Firewall Rules -// request. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - Value *[]FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties is represents the properties of a server firewall -// rule. -type FirewallRuleProperties struct { - StartIPAddress *string `json:"startIpAddress,omitempty"` - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// ImportExportResponse is response for Import/Export Get operation. -type ImportExportResponse struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *ImportExportResponseProperties `json:"properties,omitempty"` -} - -// ImportExportResponseProperties is response for Import/Export Status -// operation. -type ImportExportResponseProperties struct { - RequestType *string `json:"requestType,omitempty"` - RequestID *uuid.UUID `json:"requestId,omitempty"` - ServerName *string `json:"serverName,omitempty"` - DatabaseName *string `json:"databaseName,omitempty"` - Status *string `json:"status,omitempty"` - LastModifiedTime *string `json:"lastModifiedTime,omitempty"` - QueuedTime *string `json:"queuedTime,omitempty"` - BlobURI *string `json:"blobUri,omitempty"` - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// ImportExtensionProperties is represents the properties for an import -// operation -type ImportExtensionProperties struct { - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - StorageKey *string `json:"storageKey,omitempty"` - StorageURI *string `json:"storageUri,omitempty"` - AdministratorLogin *string `json:"administratorLogin,omitempty"` - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` - OperationMode *string `json:"operationMode,omitempty"` -} - -// ImportExtensionRequest is import database parameters. -type ImportExtensionRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *ImportExtensionProperties `json:"properties,omitempty"` -} - -// ImportRequest is import database parameters. -type ImportRequest struct { - StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` - StorageKey *string `json:"storageKey,omitempty"` - StorageURI *string `json:"storageUri,omitempty"` - AdministratorLogin *string `json:"administratorLogin,omitempty"` - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` - DatabaseName *string `json:"databaseName,omitempty"` - Edition DatabaseEdition `json:"edition,omitempty"` - ServiceObjectiveName ServiceObjectiveName `json:"serviceObjectiveName,omitempty"` - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` -} - -// LocationCapabilities is the capabilities for a location. -type LocationCapabilities struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` -} - -// MaxSizeCapability is the maximum size limits for a database. -type MaxSizeCapability struct { - Limit *int64 `json:"limit,omitempty"` - Unit MaxSizeUnits `json:"unit,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` -} - -// Operation is sQL REST API operation definition. -type Operation struct { - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay is display metadata associated with the operation. -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` -} - -// OperationImpact is represents impact of an operation, both in absolute and -// relative terms. -type OperationImpact struct { - Name *string `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` -} - -// OperationListResult is result of the request to list SQL operations. It -// contains a list of operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PerformanceLevel is a possible performance level of a service objective -// capability. -type PerformanceLevel struct { - Unit PerformanceLevelUnit `json:"unit,omitempty"` - Value *int32 `json:"value,omitempty"` -} - -// ProxyResource is aRM proxy resource. -type ProxyResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// RecommendedElasticPool is represents a recommented elastic pool. -type RecommendedElasticPool struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RecommendedElasticPoolProperties `json:"properties,omitempty"` -} - -// RecommendedElasticPoolListMetricsResult is represents the response to a list -// recommended elastic pool metrics request. -type RecommendedElasticPoolListMetricsResult struct { - autorest.Response `json:"-"` - Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` -} - -// RecommendedElasticPoolListResult is represents the response to a list -// recommended elastic pool request. -type RecommendedElasticPoolListResult struct { - autorest.Response `json:"-"` - Value *[]RecommendedElasticPool `json:"value,omitempty"` -} - -// RecommendedElasticPoolMetric is represents recommended elastic pool metric. -type RecommendedElasticPoolMetric struct { - DateTime *date.Time `json:"dateTime,omitempty"` - Dtu *float64 `json:"dtu,omitempty"` - SizeGB *float64 `json:"sizeGB,omitempty"` -} - -// RecommendedElasticPoolProperties is represents the properties of a -// recommented elastic pool. -type RecommendedElasticPoolProperties struct { - DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` - Dtu *float64 `json:"dtu,omitempty"` - DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` - DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` - StorageMB *float64 `json:"storageMB,omitempty"` - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` - MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` - Databases *[]Database `json:"databases,omitempty"` - Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` -} - -// RecommendedIndex is represents a database recommended index. -type RecommendedIndex struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RecommendedIndexProperties `json:"properties,omitempty"` -} - -// RecommendedIndexProperties is represents the properties of a database -// recommended index. -type RecommendedIndexProperties struct { - Action RecommendedIndexAction `json:"action,omitempty"` - State RecommendedIndexState `json:"state,omitempty"` - Created *date.Time `json:"created,omitempty"` - LastModified *date.Time `json:"lastModified,omitempty"` - IndexType RecommendedIndexType `json:"indexType,omitempty"` - Schema *string `json:"schema,omitempty"` - Table *string `json:"table,omitempty"` - Columns *[]string `json:"columns,omitempty"` - IncludedColumns *[]string `json:"includedColumns,omitempty"` - IndexScript *string `json:"indexScript,omitempty"` - EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` - ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` -} - -// ReplicationLink is represents a database replication link. -type ReplicationLink struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - *ReplicationLinkProperties `json:"properties,omitempty"` -} - -// ReplicationLinkListResult is represents the response to a List database -// replication link request. -type ReplicationLinkListResult struct { - autorest.Response `json:"-"` - Value *[]ReplicationLink `json:"value,omitempty"` -} - -// ReplicationLinkProperties is represents the properties of a database -// replication link. -type ReplicationLinkProperties struct { - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` - ReplicationMode *string `json:"replicationMode,omitempty"` - PartnerServer *string `json:"partnerServer,omitempty"` - PartnerDatabase *string `json:"partnerDatabase,omitempty"` - PartnerLocation *string `json:"partnerLocation,omitempty"` - Role ReplicationRole `json:"role,omitempty"` - PartnerRole ReplicationRole `json:"partnerRole,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - PercentComplete *int32 `json:"percentComplete,omitempty"` - ReplicationState ReplicationState `json:"replicationState,omitempty"` -} - -// Resource is aRM resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// RestorePoint is represents a database restore point. -type RestorePoint struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *RestorePointProperties `json:"properties,omitempty"` -} - -// RestorePointListResult is represents the response to a list database restore -// points request. -type RestorePointListResult struct { - autorest.Response `json:"-"` - Value *[]RestorePoint `json:"value,omitempty"` -} - -// RestorePointProperties is represents the properties of a database restore -// point. -type RestorePointProperties struct { - RestorePointType RestorePointTypes `json:"restorePointType,omitempty"` - RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// Server is represents a server. -type Server struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` - Kind *string `json:"kind,omitempty"` - *ServerProperties `json:"properties,omitempty"` -} - -// ServerListResult is represents the response to a get server request. -type ServerListResult struct { - autorest.Response `json:"-"` - Value *[]Server `json:"value,omitempty"` -} - -// ServerMetric is represents server metrics. -type ServerMetric struct { - Name *string `json:"name,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - CurrentValue *float64 `json:"currentValue,omitempty"` - Limit *float64 `json:"limit,omitempty"` - Unit *string `json:"unit,omitempty"` - NextResetTime *date.Time `json:"nextResetTime,omitempty"` -} - -// ServerMetricListResult is represents the response to a list server metrics -// request. -type ServerMetricListResult struct { - autorest.Response `json:"-"` - Value *[]ServerMetric `json:"value,omitempty"` -} - -// ServerProperties is represents the properties of a server. -type ServerProperties struct { - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - Version ServerVersion `json:"version,omitempty"` - AdministratorLogin *string `json:"administratorLogin,omitempty"` - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - ExternalAdministratorSid *uuid.UUID `json:"externalAdministratorSid,omitempty"` - ExternalAdministratorLogin *string `json:"externalAdministratorLogin,omitempty"` - State ServerState `json:"state,omitempty"` -} - -// ServerVersionCapability is the server capabilities. -type ServerVersionCapability struct { - Name *string `json:"name,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` - SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` -} - -// ServiceObjective is represents a database service objective. -type ServiceObjective struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - *ServiceObjectiveProperties `json:"properties,omitempty"` -} - -// ServiceObjectiveCapability is the service objectives capability. -type ServiceObjectiveCapability struct { - Name *string `json:"name,omitempty"` - Status CapabilityStatus `json:"status,omitempty"` - *PerformanceLevel `json:"performanceLevel,omitempty"` - ID *uuid.UUID `json:"id,omitempty"` - SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` -} - -// ServiceObjectiveListResult is represents the response to a get database -// service objectives request. -type ServiceObjectiveListResult struct { - autorest.Response `json:"-"` - Value *[]ServiceObjective `json:"value,omitempty"` -} - -// ServiceObjectiveProperties is represents the properties of a database -// service objective. -type ServiceObjectiveProperties struct { - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` - IsDefault *bool `json:"isDefault,omitempty"` - IsSystem *bool `json:"isSystem,omitempty"` - Description *string `json:"description,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// ServiceTierAdvisor is represents a Service Tier Advisor. -type ServiceTierAdvisor struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - *ServiceTierAdvisorProperties `json:"properties,omitempty"` -} - -// ServiceTierAdvisorListResult is represents the response to a list service -// tier advisor request. -type ServiceTierAdvisorListResult struct { - autorest.Response `json:"-"` - Value *[]ServiceTierAdvisor `json:"value,omitempty"` -} - -// ServiceTierAdvisorProperties is represents the properties of a Service Tier -// Advisor. -type ServiceTierAdvisorProperties struct { - ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` - ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` - ActiveTimeRatio *float64 `json:"activeTimeRatio,omitempty"` - MinDtu *float64 `json:"minDtu,omitempty"` - AvgDtu *float64 `json:"avgDtu,omitempty"` - MaxDtu *float64 `json:"maxDtu,omitempty"` - MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"` - ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"` - CurrentServiceLevelObjective *string `json:"currentServiceLevelObjective,omitempty"` - CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"` - UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"` - UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"` - DatabaseSizeBasedRecommendationServiceLevelObjective *string `json:"databaseSizeBasedRecommendationServiceLevelObjective,omitempty"` - DatabaseSizeBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"databaseSizeBasedRecommendationServiceLevelObjectiveId,omitempty"` - DisasterPlanBasedRecommendationServiceLevelObjective *string `json:"disasterPlanBasedRecommendationServiceLevelObjective,omitempty"` - DisasterPlanBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"disasterPlanBasedRecommendationServiceLevelObjectiveId,omitempty"` - OverallRecommendationServiceLevelObjective *string `json:"overallRecommendationServiceLevelObjective,omitempty"` - OverallRecommendationServiceLevelObjectiveID *uuid.UUID `json:"overallRecommendationServiceLevelObjectiveId,omitempty"` - Confidence *float64 `json:"confidence,omitempty"` -} - -// SloUsageMetric is represents a Slo Usage Metric. -type SloUsageMetric struct { - ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` - ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"` - InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` -} - -// SubResource is subresource properties -type SubResource struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` -} - -// TrackedResource is aRM tracked top level resource. -type TrackedResource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Location *string `json:"location,omitempty"` -} - -// TransparentDataEncryption is represents a database transparent data -// encryption . -type TransparentDataEncryption struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - *TransparentDataEncryptionProperties `json:"properties,omitempty"` -} - -// TransparentDataEncryptionActivity is represents a database transparent data -// encryption Scan. -type TransparentDataEncryptionActivity struct { - Name *string `json:"name,omitempty"` - ID *string `json:"id,omitempty"` - *TransparentDataEncryptionActivityProperties `json:"properties,omitempty"` -} - -// TransparentDataEncryptionActivityListResult is represents the response to a -// list database transparent data encryption activity request. -type TransparentDataEncryptionActivityListResult struct { - autorest.Response `json:"-"` - Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` -} - -// TransparentDataEncryptionActivityProperties is represents the properties of -// a database transparent data encryption Scan. -type TransparentDataEncryptionActivityProperties struct { - Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` - PercentComplete *float64 `json:"percentComplete,omitempty"` -} - -// TransparentDataEncryptionProperties is represents the properties of a -// database transparent data encryption. -type TransparentDataEncryptionProperties struct { - Status TransparentDataEncryptionStatus `json:"status,omitempty"` -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/satori/uuid" +) + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // ADPassword specifies the ad password state for authentication type. + ADPassword AuthenticationType = "ADPassword" + // SQL specifies the sql state for authentication type. + SQL AuthenticationType = "SQL" +) + +// BlobAuditingPolicyState enumerates the values for blob auditing policy +// state. +type BlobAuditingPolicyState string + +const ( + // Disabled specifies the disabled state for blob auditing policy state. + Disabled BlobAuditingPolicyState = "Disabled" + // Enabled specifies the enabled state for blob auditing policy state. + Enabled BlobAuditingPolicyState = "Enabled" +) + +// CapabilityStatus enumerates the values for capability status. +type CapabilityStatus string + +const ( + // CapabilityStatusAvailable specifies the capability status available + // state for capability status. + CapabilityStatusAvailable CapabilityStatus = "Available" + // CapabilityStatusDefault specifies the capability status default state + // for capability status. + CapabilityStatusDefault CapabilityStatus = "Default" + // CapabilityStatusDisabled specifies the capability status disabled state + // for capability status. + CapabilityStatusDisabled CapabilityStatus = "Disabled" + // CapabilityStatusVisible specifies the capability status visible state + // for capability status. + CapabilityStatusVisible CapabilityStatus = "Visible" +) + +// CreateMode enumerates the values for create mode. +type CreateMode string + +const ( + // Copy specifies the copy state for create mode. + Copy CreateMode = "Copy" + // Default specifies the default state for create mode. + Default CreateMode = "Default" + // NonReadableSecondary specifies the non readable secondary state for + // create mode. + NonReadableSecondary CreateMode = "NonReadableSecondary" + // OnlineSecondary specifies the online secondary state for create mode. + OnlineSecondary CreateMode = "OnlineSecondary" + // PointInTimeRestore specifies the point in time restore state for create + // mode. + PointInTimeRestore CreateMode = "PointInTimeRestore" + // Recovery specifies the recovery state for create mode. + Recovery CreateMode = "Recovery" + // Restore specifies the restore state for create mode. + Restore CreateMode = "Restore" + // RestoreLongTermRetentionBackup specifies the restore long term retention + // backup state for create mode. + RestoreLongTermRetentionBackup CreateMode = "RestoreLongTermRetentionBackup" +) + +// DatabaseEdition enumerates the values for database edition. +type DatabaseEdition string + +const ( + // Basic specifies the basic state for database edition. + Basic DatabaseEdition = "Basic" + // Business specifies the business state for database edition. + Business DatabaseEdition = "Business" + // DataWarehouse specifies the data warehouse state for database edition. + DataWarehouse DatabaseEdition = "DataWarehouse" + // Free specifies the free state for database edition. + Free DatabaseEdition = "Free" + // Premium specifies the premium state for database edition. + Premium DatabaseEdition = "Premium" + // Standard specifies the standard state for database edition. + Standard DatabaseEdition = "Standard" + // Stretch specifies the stretch state for database edition. + Stretch DatabaseEdition = "Stretch" + // System specifies the system state for database edition. + System DatabaseEdition = "System" + // System2 specifies the system 2 state for database edition. + System2 DatabaseEdition = "System2" + // Web specifies the web state for database edition. + Web DatabaseEdition = "Web" +) + +// ElasticPoolEdition enumerates the values for elastic pool edition. +type ElasticPoolEdition string + +const ( + // ElasticPoolEditionBasic specifies the elastic pool edition basic state + // for elastic pool edition. + ElasticPoolEditionBasic ElasticPoolEdition = "Basic" + // ElasticPoolEditionPremium specifies the elastic pool edition premium + // state for elastic pool edition. + ElasticPoolEditionPremium ElasticPoolEdition = "Premium" + // ElasticPoolEditionStandard specifies the elastic pool edition standard + // state for elastic pool edition. + ElasticPoolEditionStandard ElasticPoolEdition = "Standard" +) + +// ElasticPoolState enumerates the values for elastic pool state. +type ElasticPoolState string + +const ( + // ElasticPoolStateCreating specifies the elastic pool state creating state + // for elastic pool state. + ElasticPoolStateCreating ElasticPoolState = "Creating" + // ElasticPoolStateDisabled specifies the elastic pool state disabled state + // for elastic pool state. + ElasticPoolStateDisabled ElasticPoolState = "Disabled" + // ElasticPoolStateReady specifies the elastic pool state ready state for + // elastic pool state. + ElasticPoolStateReady ElasticPoolState = "Ready" +) + +// MaxSizeUnits enumerates the values for max size units. +type MaxSizeUnits string + +const ( + // Gigabytes specifies the gigabytes state for max size units. + Gigabytes MaxSizeUnits = "Gigabytes" + // Megabytes specifies the megabytes state for max size units. + Megabytes MaxSizeUnits = "Megabytes" + // Petabytes specifies the petabytes state for max size units. + Petabytes MaxSizeUnits = "Petabytes" + // Terabytes specifies the terabytes state for max size units. + Terabytes MaxSizeUnits = "Terabytes" +) + +// PerformanceLevelUnit enumerates the values for performance level unit. +type PerformanceLevelUnit string + +const ( + // DTU specifies the dtu state for performance level unit. + DTU PerformanceLevelUnit = "DTU" +) + +// ReadScale enumerates the values for read scale. +type ReadScale string + +const ( + // ReadScaleDisabled specifies the read scale disabled state for read + // scale. + ReadScaleDisabled ReadScale = "Disabled" + // ReadScaleEnabled specifies the read scale enabled state for read scale. + ReadScaleEnabled ReadScale = "Enabled" +) + +// RecommendedIndexAction enumerates the values for recommended index action. +type RecommendedIndexAction string + +const ( + // Create specifies the create state for recommended index action. + Create RecommendedIndexAction = "Create" + // Drop specifies the drop state for recommended index action. + Drop RecommendedIndexAction = "Drop" + // Rebuild specifies the rebuild state for recommended index action. + Rebuild RecommendedIndexAction = "Rebuild" +) + +// RecommendedIndexState enumerates the values for recommended index state. +type RecommendedIndexState string + +const ( + // Active specifies the active state for recommended index state. + Active RecommendedIndexState = "Active" + // Blocked specifies the blocked state for recommended index state. + Blocked RecommendedIndexState = "Blocked" + // Executing specifies the executing state for recommended index state. + Executing RecommendedIndexState = "Executing" + // Expired specifies the expired state for recommended index state. + Expired RecommendedIndexState = "Expired" + // Ignored specifies the ignored state for recommended index state. + Ignored RecommendedIndexState = "Ignored" + // Pending specifies the pending state for recommended index state. + Pending RecommendedIndexState = "Pending" + // PendingRevert specifies the pending revert state for recommended index + // state. + PendingRevert RecommendedIndexState = "Pending Revert" + // Reverted specifies the reverted state for recommended index state. + Reverted RecommendedIndexState = "Reverted" + // Reverting specifies the reverting state for recommended index state. + Reverting RecommendedIndexState = "Reverting" + // Success specifies the success state for recommended index state. + Success RecommendedIndexState = "Success" + // Verifying specifies the verifying state for recommended index state. + Verifying RecommendedIndexState = "Verifying" +) + +// RecommendedIndexType enumerates the values for recommended index type. +type RecommendedIndexType string + +const ( + // CLUSTERED specifies the clustered state for recommended index type. + CLUSTERED RecommendedIndexType = "CLUSTERED" + // CLUSTEREDCOLUMNSTORE specifies the clusteredcolumnstore state for + // recommended index type. + CLUSTEREDCOLUMNSTORE RecommendedIndexType = "CLUSTERED COLUMNSTORE" + // COLUMNSTORE specifies the columnstore state for recommended index type. + COLUMNSTORE RecommendedIndexType = "COLUMNSTORE" + // NONCLUSTERED specifies the nonclustered state for recommended index + // type. + NONCLUSTERED RecommendedIndexType = "NONCLUSTERED" +) + +// ReplicationRole enumerates the values for replication role. +type ReplicationRole string + +const ( + // ReplicationRoleCopy specifies the replication role copy state for + // replication role. + ReplicationRoleCopy ReplicationRole = "Copy" + // ReplicationRoleNonReadableSecondary specifies the replication role non + // readable secondary state for replication role. + ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" + // ReplicationRolePrimary specifies the replication role primary state for + // replication role. + ReplicationRolePrimary ReplicationRole = "Primary" + // ReplicationRoleSecondary specifies the replication role secondary state + // for replication role. + ReplicationRoleSecondary ReplicationRole = "Secondary" + // ReplicationRoleSource specifies the replication role source state for + // replication role. + ReplicationRoleSource ReplicationRole = "Source" +) + +// ReplicationState enumerates the values for replication state. +type ReplicationState string + +const ( + // CATCHUP specifies the catchup state for replication state. + CATCHUP ReplicationState = "CATCH_UP" + // PENDING specifies the pending state for replication state. + PENDING ReplicationState = "PENDING" + // SEEDING specifies the seeding state for replication state. + SEEDING ReplicationState = "SEEDING" + // SUSPENDED specifies the suspended state for replication state. + SUSPENDED ReplicationState = "SUSPENDED" +) + +// RestorePointTypes enumerates the values for restore point types. +type RestorePointTypes string + +const ( + // CONTINUOUS specifies the continuous state for restore point types. + CONTINUOUS RestorePointTypes = "CONTINUOUS" + // DISCRETE specifies the discrete state for restore point types. + DISCRETE RestorePointTypes = "DISCRETE" +) + +// SampleName enumerates the values for sample name. +type SampleName string + +const ( + // AdventureWorksLT specifies the adventure works lt state for sample name. + AdventureWorksLT SampleName = "AdventureWorksLT" +) + +// SecurityAlertPolicyEmailAccountAdmins enumerates the values for security +// alert policy email account admins. +type SecurityAlertPolicyEmailAccountAdmins string + +const ( + // SecurityAlertPolicyEmailAccountAdminsDisabled specifies the security + // alert policy email account admins disabled state for security alert + // policy email account admins. + SecurityAlertPolicyEmailAccountAdminsDisabled SecurityAlertPolicyEmailAccountAdmins = "Disabled" + // SecurityAlertPolicyEmailAccountAdminsEnabled specifies the security + // alert policy email account admins enabled state for security alert + // policy email account admins. + SecurityAlertPolicyEmailAccountAdminsEnabled SecurityAlertPolicyEmailAccountAdmins = "Enabled" +) + +// SecurityAlertPolicyState enumerates the values for security alert policy +// state. +type SecurityAlertPolicyState string + +const ( + // SecurityAlertPolicyStateDisabled specifies the security alert policy + // state disabled state for security alert policy state. + SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" + // SecurityAlertPolicyStateEnabled specifies the security alert policy + // state enabled state for security alert policy state. + SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" + // SecurityAlertPolicyStateNew specifies the security alert policy state + // new state for security alert policy state. + SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" +) + +// SecurityAlertPolicyUseServerDefault enumerates the values for security alert +// policy use server default. +type SecurityAlertPolicyUseServerDefault string + +const ( + // SecurityAlertPolicyUseServerDefaultDisabled specifies the security alert + // policy use server default disabled state for security alert policy use + // server default. + SecurityAlertPolicyUseServerDefaultDisabled SecurityAlertPolicyUseServerDefault = "Disabled" + // SecurityAlertPolicyUseServerDefaultEnabled specifies the security alert + // policy use server default enabled state for security alert policy use + // server default. + SecurityAlertPolicyUseServerDefaultEnabled SecurityAlertPolicyUseServerDefault = "Enabled" +) + +// ServerState enumerates the values for server state. +type ServerState string + +const ( + // ServerStateDisabled specifies the server state disabled state for server + // state. + ServerStateDisabled ServerState = "Disabled" + // ServerStateReady specifies the server state ready state for server + // state. + ServerStateReady ServerState = "Ready" +) + +// ServerVersion enumerates the values for server version. +type ServerVersion string + +const ( + // OneTwoFullStopZero specifies the one two full stop zero state for server + // version. + OneTwoFullStopZero ServerVersion = "12.0" + // TwoFullStopZero specifies the two full stop zero state for server + // version. + TwoFullStopZero ServerVersion = "2.0" +) + +// ServiceObjectiveName enumerates the values for service objective name. +type ServiceObjectiveName string + +const ( + // ServiceObjectiveNameBasic specifies the service objective name basic + // state for service objective name. + ServiceObjectiveNameBasic ServiceObjectiveName = "Basic" + // ServiceObjectiveNameElasticPool specifies the service objective name + // elastic pool state for service objective name. + ServiceObjectiveNameElasticPool ServiceObjectiveName = "ElasticPool" + // ServiceObjectiveNameP1 specifies the service objective name p1 state for + // service objective name. + ServiceObjectiveNameP1 ServiceObjectiveName = "P1" + // ServiceObjectiveNameP11 specifies the service objective name p11 state + // for service objective name. + ServiceObjectiveNameP11 ServiceObjectiveName = "P11" + // ServiceObjectiveNameP15 specifies the service objective name p15 state + // for service objective name. + ServiceObjectiveNameP15 ServiceObjectiveName = "P15" + // ServiceObjectiveNameP2 specifies the service objective name p2 state for + // service objective name. + ServiceObjectiveNameP2 ServiceObjectiveName = "P2" + // ServiceObjectiveNameP3 specifies the service objective name p3 state for + // service objective name. + ServiceObjectiveNameP3 ServiceObjectiveName = "P3" + // ServiceObjectiveNameP4 specifies the service objective name p4 state for + // service objective name. + ServiceObjectiveNameP4 ServiceObjectiveName = "P4" + // ServiceObjectiveNameP6 specifies the service objective name p6 state for + // service objective name. + ServiceObjectiveNameP6 ServiceObjectiveName = "P6" + // ServiceObjectiveNameS0 specifies the service objective name s0 state for + // service objective name. + ServiceObjectiveNameS0 ServiceObjectiveName = "S0" + // ServiceObjectiveNameS1 specifies the service objective name s1 state for + // service objective name. + ServiceObjectiveNameS1 ServiceObjectiveName = "S1" + // ServiceObjectiveNameS2 specifies the service objective name s2 state for + // service objective name. + ServiceObjectiveNameS2 ServiceObjectiveName = "S2" + // ServiceObjectiveNameS3 specifies the service objective name s3 state for + // service objective name. + ServiceObjectiveNameS3 ServiceObjectiveName = "S3" + // ServiceObjectiveNameSystem specifies the service objective name system + // state for service objective name. + ServiceObjectiveNameSystem ServiceObjectiveName = "System" + // ServiceObjectiveNameSystem2 specifies the service objective name system + // 2 state for service objective name. + ServiceObjectiveNameSystem2 ServiceObjectiveName = "System2" +) + +// StorageKeyType enumerates the values for storage key type. +type StorageKeyType string + +const ( + // SharedAccessKey specifies the shared access key state for storage key + // type. + SharedAccessKey StorageKeyType = "SharedAccessKey" + // StorageAccessKey specifies the storage access key state for storage key + // type. + StorageAccessKey StorageKeyType = "StorageAccessKey" +) + +// TransparentDataEncryptionActivityStatus enumerates the values for +// transparent data encryption activity status. +type TransparentDataEncryptionActivityStatus string + +const ( + // Decrypting specifies the decrypting state for transparent data + // encryption activity status. + Decrypting TransparentDataEncryptionActivityStatus = "Decrypting" + // Encrypting specifies the encrypting state for transparent data + // encryption activity status. + Encrypting TransparentDataEncryptionActivityStatus = "Encrypting" +) + +// TransparentDataEncryptionStatus enumerates the values for transparent data +// encryption status. +type TransparentDataEncryptionStatus string + +const ( + // TransparentDataEncryptionStatusDisabled specifies the transparent data + // encryption status disabled state for transparent data encryption status. + TransparentDataEncryptionStatusDisabled TransparentDataEncryptionStatus = "Disabled" + // TransparentDataEncryptionStatusEnabled specifies the transparent data + // encryption status enabled state for transparent data encryption status. + TransparentDataEncryptionStatusEnabled TransparentDataEncryptionStatus = "Enabled" +) + +// Database is represents a database. +type Database struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + Kind *string `json:"kind,omitempty"` + *DatabaseProperties `json:"properties,omitempty"` +} + +// DatabaseBlobAuditingPolicy is contains information about a database Blob +// Auditing policy. +type DatabaseBlobAuditingPolicy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Kind *string `json:"kind,omitempty"` + *DatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` +} + +// DatabaseBlobAuditingPolicyProperties is properties for a database Blob +// Auditing policy. +type DatabaseBlobAuditingPolicyProperties struct { + State BlobAuditingPolicyState `json:"state,omitempty"` + StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + RetentionDays *int32 `json:"retentionDays,omitempty"` + AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` + StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` + IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` +} + +// DatabaseListResult is represents the response to a list database request. +type DatabaseListResult struct { + autorest.Response `json:"-"` + Value *[]Database `json:"value,omitempty"` +} + +// DatabaseMetric is represents database metrics. +type DatabaseMetric struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + CurrentValue *float64 `json:"currentValue,omitempty"` + Limit *float64 `json:"limit,omitempty"` + Unit *string `json:"unit,omitempty"` + NextResetTime *date.Time `json:"nextResetTime,omitempty"` +} + +// DatabaseMetricListResult is represents the response to a list database +// metrics request. +type DatabaseMetricListResult struct { + autorest.Response `json:"-"` + Value *[]DatabaseMetric `json:"value,omitempty"` +} + +// DatabaseProperties is represents the properties of a database. +type DatabaseProperties struct { + Collation *string `json:"collation,omitempty"` + CreationDate *date.Time `json:"creationDate,omitempty"` + ContainmentState *int64 `json:"containmentState,omitempty"` + CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` + DatabaseID *uuid.UUID `json:"databaseId,omitempty"` + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` + CreateMode CreateMode `json:"createMode,omitempty"` + SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` + RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` + RecoveryServicesRecoveryPointResourceID *string `json:"recoveryServicesRecoveryPointResourceId,omitempty"` + Edition DatabaseEdition `json:"edition,omitempty"` + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` + RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` + ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` + Status *string `json:"status,omitempty"` + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` + ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` + TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` + RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` + FailoverGroupID *uuid.UUID `json:"failoverGroupId,omitempty"` + ReadScale ReadScale `json:"readScale,omitempty"` + SampleName SampleName `json:"sampleName,omitempty"` +} + +// DatabaseSecurityAlertPolicy is contains information about a database Threat +// Detection policy. +type DatabaseSecurityAlertPolicy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Kind *string `json:"kind,omitempty"` + *DatabaseSecurityAlertPolicyProperties `json:"properties,omitempty"` +} + +// DatabaseSecurityAlertPolicyProperties is properties for a database Threat +// Detection policy. +type DatabaseSecurityAlertPolicyProperties struct { + State SecurityAlertPolicyState `json:"state,omitempty"` + DisabledAlerts *string `json:"disabledAlerts,omitempty"` + EmailAddresses *string `json:"emailAddresses,omitempty"` + EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` + StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + RetentionDays *int32 `json:"retentionDays,omitempty"` + UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` +} + +// EditionCapability is the database edition capabilities. +type EditionCapability struct { + Name *string `json:"name,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` +} + +// ElasticPool is represents a database elastic pool. +type ElasticPool struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + *ElasticPoolProperties `json:"properties,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// ElasticPoolActivity is represents the activity on an elastic pool. +type ElasticPoolActivity struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + *ElasticPoolActivityProperties `json:"properties,omitempty"` +} + +// ElasticPoolActivityListResult is represents the response to a list elastic +// pool activity request. +type ElasticPoolActivityListResult struct { + autorest.Response `json:"-"` + Value *[]ElasticPoolActivity `json:"value,omitempty"` +} + +// ElasticPoolActivityProperties is represents the properties of an elastic +// pool. +type ElasticPoolActivityProperties struct { + EndTime *date.Time `json:"endTime,omitempty"` + ErrorCode *int32 `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + Operation *string `json:"operation,omitempty"` + OperationID *uuid.UUID `json:"operationId,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` + RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` + RequestedDtu *int32 `json:"requestedDtu,omitempty"` + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` + ElasticPoolName *string `json:"elasticPoolName,omitempty"` + ServerName *string `json:"serverName,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + State *string `json:"state,omitempty"` + RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` + RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` + RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` + RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` +} + +// ElasticPoolDatabaseActivity is represents the activity on an elastic pool. +type ElasticPoolDatabaseActivity struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` +} + +// ElasticPoolDatabaseActivityListResult is represents the response to a list +// elastic pool database activity request. +type ElasticPoolDatabaseActivityListResult struct { + autorest.Response `json:"-"` + Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` +} + +// ElasticPoolDatabaseActivityProperties is represents the properties of an +// elastic pool database activity. +type ElasticPoolDatabaseActivityProperties struct { + DatabaseName *string `json:"databaseName,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ErrorCode *int32 `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + ErrorSeverity *int32 `json:"errorSeverity,omitempty"` + Operation *string `json:"operation,omitempty"` + OperationID *uuid.UUID `json:"operationId,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` + CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` + CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` + RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` + ServerName *string `json:"serverName,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + State *string `json:"state,omitempty"` +} + +// ElasticPoolDtuCapability is the Elastic Pool DTU capability. +type ElasticPoolDtuCapability struct { + Limit *int64 `json:"limit,omitempty"` + MaxDatabaseCount *int64 `json:"maxDatabaseCount,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` + IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` + SupportedPerDatabaseMaxSizes *[]MaxSizeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` + SupportedPerDatabaseMaxDtus *[]ElasticPoolPerDatabaseMaxDtuCapability `json:"supportedPerDatabaseMaxDtus,omitempty"` +} + +// ElasticPoolEditionCapability is the elastic pool edition capabilities. +type ElasticPoolEditionCapability struct { + Name *string `json:"name,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + SupportedElasticPoolDtus *[]ElasticPoolDtuCapability `json:"supportedElasticPoolDtus,omitempty"` +} + +// ElasticPoolListResult is represents the response to a list elastic pool +// request. +type ElasticPoolListResult struct { + autorest.Response `json:"-"` + Value *[]ElasticPool `json:"value,omitempty"` +} + +// ElasticPoolPerDatabaseMaxDtuCapability is the max per-database DTU +// capability. +type ElasticPoolPerDatabaseMaxDtuCapability struct { + Limit *int64 `json:"limit,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + SupportedPerDatabaseMinDtus *[]ElasticPoolPerDatabaseMinDtuCapability `json:"supportedPerDatabaseMinDtus,omitempty"` +} + +// ElasticPoolPerDatabaseMinDtuCapability is the minimum per-database DTU +// capability. +type ElasticPoolPerDatabaseMinDtuCapability struct { + Limit *int64 `json:"limit,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` +} + +// ElasticPoolProperties is represents the properties of an elastic pool. +type ElasticPoolProperties struct { + CreationDate *date.Time `json:"creationDate,omitempty"` + State ElasticPoolState `json:"state,omitempty"` + Edition ElasticPoolEdition `json:"edition,omitempty"` + Dtu *int32 `json:"dtu,omitempty"` + DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` + DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` + StorageMB *int32 `json:"storageMB,omitempty"` +} + +// ExportRequest is export database parameters. +type ExportRequest struct { + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + StorageKey *string `json:"storageKey,omitempty"` + StorageURI *string `json:"storageUri,omitempty"` + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// FirewallRule is represents a server firewall rule. +type FirewallRule struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *FirewallRuleProperties `json:"properties,omitempty"` +} + +// FirewallRuleListResult is represents the response to a List Firewall Rules +// request. +type FirewallRuleListResult struct { + autorest.Response `json:"-"` + Value *[]FirewallRule `json:"value,omitempty"` +} + +// FirewallRuleProperties is represents the properties of a server firewall +// rule. +type FirewallRuleProperties struct { + StartIPAddress *string `json:"startIpAddress,omitempty"` + EndIPAddress *string `json:"endIpAddress,omitempty"` +} + +// ImportExportResponse is response for Import/Export Get operation. +type ImportExportResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ImportExportResponseProperties `json:"properties,omitempty"` +} + +// ImportExportResponseProperties is response for Import/Export Status +// operation. +type ImportExportResponseProperties struct { + RequestType *string `json:"requestType,omitempty"` + RequestID *uuid.UUID `json:"requestId,omitempty"` + ServerName *string `json:"serverName,omitempty"` + DatabaseName *string `json:"databaseName,omitempty"` + Status *string `json:"status,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + QueuedTime *string `json:"queuedTime,omitempty"` + BlobURI *string `json:"blobUri,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// ImportExtensionProperties is represents the properties for an import +// operation +type ImportExtensionProperties struct { + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + StorageKey *string `json:"storageKey,omitempty"` + StorageURI *string `json:"storageUri,omitempty"` + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + OperationMode *string `json:"operationMode,omitempty"` +} + +// ImportExtensionRequest is import database parameters. +type ImportExtensionRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *ImportExtensionProperties `json:"properties,omitempty"` +} + +// ImportRequest is import database parameters. +type ImportRequest struct { + StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` + StorageKey *string `json:"storageKey,omitempty"` + StorageURI *string `json:"storageUri,omitempty"` + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + DatabaseName *string `json:"databaseName,omitempty"` + Edition DatabaseEdition `json:"edition,omitempty"` + ServiceObjectiveName ServiceObjectiveName `json:"serviceObjectiveName,omitempty"` + MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` +} + +// LocationCapabilities is the capabilities for a location. +type LocationCapabilities struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` +} + +// MaxSizeCapability is the maximum size limits for a database. +type MaxSizeCapability struct { + Limit *int64 `json:"limit,omitempty"` + Unit MaxSizeUnits `json:"unit,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` +} + +// Operation is sQL REST API operation definition. +type Operation struct { + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay is display metadata associated with the operation. +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` +} + +// OperationImpact is represents impact of an operation, both in absolute and +// relative terms. +type OperationImpact struct { + Name *string `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` + ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` +} + +// OperationListResult is result of the request to list SQL operations. It +// contains a list of operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PerformanceLevel is a possible performance level of a service objective +// capability. +type PerformanceLevel struct { + Unit PerformanceLevelUnit `json:"unit,omitempty"` + Value *int32 `json:"value,omitempty"` +} + +// ProxyResource is aRM proxy resource. +type ProxyResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RecommendedElasticPool is represents a recommented elastic pool. +type RecommendedElasticPool struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RecommendedElasticPoolProperties `json:"properties,omitempty"` +} + +// RecommendedElasticPoolListMetricsResult is represents the response to a list +// recommended elastic pool metrics request. +type RecommendedElasticPoolListMetricsResult struct { + autorest.Response `json:"-"` + Value *[]RecommendedElasticPoolMetric `json:"value,omitempty"` +} + +// RecommendedElasticPoolListResult is represents the response to a list +// recommended elastic pool request. +type RecommendedElasticPoolListResult struct { + autorest.Response `json:"-"` + Value *[]RecommendedElasticPool `json:"value,omitempty"` +} + +// RecommendedElasticPoolMetric is represents recommended elastic pool metric. +type RecommendedElasticPoolMetric struct { + DateTime *date.Time `json:"dateTime,omitempty"` + Dtu *float64 `json:"dtu,omitempty"` + SizeGB *float64 `json:"sizeGB,omitempty"` +} + +// RecommendedElasticPoolProperties is represents the properties of a +// recommented elastic pool. +type RecommendedElasticPoolProperties struct { + DatabaseEdition ElasticPoolEdition `json:"databaseEdition,omitempty"` + Dtu *float64 `json:"dtu,omitempty"` + DatabaseDtuMin *float64 `json:"databaseDtuMin,omitempty"` + DatabaseDtuMax *float64 `json:"databaseDtuMax,omitempty"` + StorageMB *float64 `json:"storageMB,omitempty"` + ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` + ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` + MaxObservedDtu *float64 `json:"maxObservedDtu,omitempty"` + MaxObservedStorageMB *float64 `json:"maxObservedStorageMB,omitempty"` + Databases *[]Database `json:"databases,omitempty"` + Metrics *[]RecommendedElasticPoolMetric `json:"metrics,omitempty"` +} + +// RecommendedIndex is represents a database recommended index. +type RecommendedIndex struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RecommendedIndexProperties `json:"properties,omitempty"` +} + +// RecommendedIndexProperties is represents the properties of a database +// recommended index. +type RecommendedIndexProperties struct { + Action RecommendedIndexAction `json:"action,omitempty"` + State RecommendedIndexState `json:"state,omitempty"` + Created *date.Time `json:"created,omitempty"` + LastModified *date.Time `json:"lastModified,omitempty"` + IndexType RecommendedIndexType `json:"indexType,omitempty"` + Schema *string `json:"schema,omitempty"` + Table *string `json:"table,omitempty"` + Columns *[]string `json:"columns,omitempty"` + IncludedColumns *[]string `json:"includedColumns,omitempty"` + IndexScript *string `json:"indexScript,omitempty"` + EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` + ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` +} + +// ReplicationLink is represents a database replication link. +type ReplicationLink struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + *ReplicationLinkProperties `json:"properties,omitempty"` +} + +// ReplicationLinkListResult is represents the response to a List database +// replication link request. +type ReplicationLinkListResult struct { + autorest.Response `json:"-"` + Value *[]ReplicationLink `json:"value,omitempty"` +} + +// ReplicationLinkProperties is represents the properties of a database +// replication link. +type ReplicationLinkProperties struct { + IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` + ReplicationMode *string `json:"replicationMode,omitempty"` + PartnerServer *string `json:"partnerServer,omitempty"` + PartnerDatabase *string `json:"partnerDatabase,omitempty"` + PartnerLocation *string `json:"partnerLocation,omitempty"` + Role ReplicationRole `json:"role,omitempty"` + PartnerRole ReplicationRole `json:"partnerRole,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + ReplicationState ReplicationState `json:"replicationState,omitempty"` +} + +// Resource is aRM resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RestorePoint is represents a database restore point. +type RestorePoint struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *RestorePointProperties `json:"properties,omitempty"` +} + +// RestorePointListResult is represents the response to a list database restore +// points request. +type RestorePointListResult struct { + autorest.Response `json:"-"` + Value *[]RestorePoint `json:"value,omitempty"` +} + +// RestorePointProperties is represents the properties of a database restore +// point. +type RestorePointProperties struct { + RestorePointType RestorePointTypes `json:"restorePointType,omitempty"` + RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` + EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` +} + +// Server is represents a server. +type Server struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` + Kind *string `json:"kind,omitempty"` + *ServerProperties `json:"properties,omitempty"` +} + +// ServerListResult is represents the response to a get server request. +type ServerListResult struct { + autorest.Response `json:"-"` + Value *[]Server `json:"value,omitempty"` +} + +// ServerMetric is represents server metrics. +type ServerMetric struct { + Name *string `json:"name,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + CurrentValue *float64 `json:"currentValue,omitempty"` + Limit *float64 `json:"limit,omitempty"` + Unit *string `json:"unit,omitempty"` + NextResetTime *date.Time `json:"nextResetTime,omitempty"` +} + +// ServerMetricListResult is represents the response to a list server metrics +// request. +type ServerMetricListResult struct { + autorest.Response `json:"-"` + Value *[]ServerMetric `json:"value,omitempty"` +} + +// ServerProperties is represents the properties of a server. +type ServerProperties struct { + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + Version ServerVersion `json:"version,omitempty"` + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + ExternalAdministratorSid *uuid.UUID `json:"externalAdministratorSid,omitempty"` + ExternalAdministratorLogin *string `json:"externalAdministratorLogin,omitempty"` + State ServerState `json:"state,omitempty"` +} + +// ServerVersionCapability is the server capabilities. +type ServerVersionCapability struct { + Name *string `json:"name,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` + SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` +} + +// ServiceObjective is represents a database service objective. +type ServiceObjective struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + *ServiceObjectiveProperties `json:"properties,omitempty"` +} + +// ServiceObjectiveCapability is the service objectives capability. +type ServiceObjectiveCapability struct { + Name *string `json:"name,omitempty"` + Status CapabilityStatus `json:"status,omitempty"` + *PerformanceLevel `json:"performanceLevel,omitempty"` + ID *uuid.UUID `json:"id,omitempty"` + SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` + IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` +} + +// ServiceObjectiveListResult is represents the response to a get database +// service objectives request. +type ServiceObjectiveListResult struct { + autorest.Response `json:"-"` + Value *[]ServiceObjective `json:"value,omitempty"` +} + +// ServiceObjectiveProperties is represents the properties of a database +// service objective. +type ServiceObjectiveProperties struct { + ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` + IsDefault *bool `json:"isDefault,omitempty"` + IsSystem *bool `json:"isSystem,omitempty"` + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// ServiceTierAdvisor is represents a Service Tier Advisor. +type ServiceTierAdvisor struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + *ServiceTierAdvisorProperties `json:"properties,omitempty"` +} + +// ServiceTierAdvisorListResult is represents the response to a list service +// tier advisor request. +type ServiceTierAdvisorListResult struct { + autorest.Response `json:"-"` + Value *[]ServiceTierAdvisor `json:"value,omitempty"` +} + +// ServiceTierAdvisorProperties is represents the properties of a Service Tier +// Advisor. +type ServiceTierAdvisorProperties struct { + ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` + ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` + ActiveTimeRatio *float64 `json:"activeTimeRatio,omitempty"` + MinDtu *float64 `json:"minDtu,omitempty"` + AvgDtu *float64 `json:"avgDtu,omitempty"` + MaxDtu *float64 `json:"maxDtu,omitempty"` + MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"` + ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"` + CurrentServiceLevelObjective *string `json:"currentServiceLevelObjective,omitempty"` + CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"` + UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"` + UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"` + DatabaseSizeBasedRecommendationServiceLevelObjective *string `json:"databaseSizeBasedRecommendationServiceLevelObjective,omitempty"` + DatabaseSizeBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"databaseSizeBasedRecommendationServiceLevelObjectiveId,omitempty"` + DisasterPlanBasedRecommendationServiceLevelObjective *string `json:"disasterPlanBasedRecommendationServiceLevelObjective,omitempty"` + DisasterPlanBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"disasterPlanBasedRecommendationServiceLevelObjectiveId,omitempty"` + OverallRecommendationServiceLevelObjective *string `json:"overallRecommendationServiceLevelObjective,omitempty"` + OverallRecommendationServiceLevelObjectiveID *uuid.UUID `json:"overallRecommendationServiceLevelObjectiveId,omitempty"` + Confidence *float64 `json:"confidence,omitempty"` +} + +// SloUsageMetric is represents a Slo Usage Metric. +type SloUsageMetric struct { + ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` + ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"` + InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` +} + +// SubResource is subresource properties +type SubResource struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` +} + +// TrackedResource is aRM tracked top level resource. +type TrackedResource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Location *string `json:"location,omitempty"` +} + +// TransparentDataEncryption is represents a database transparent data +// encryption . +type TransparentDataEncryption struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + *TransparentDataEncryptionProperties `json:"properties,omitempty"` +} + +// TransparentDataEncryptionActivity is represents a database transparent data +// encryption Scan. +type TransparentDataEncryptionActivity struct { + Name *string `json:"name,omitempty"` + ID *string `json:"id,omitempty"` + *TransparentDataEncryptionActivityProperties `json:"properties,omitempty"` +} + +// TransparentDataEncryptionActivityListResult is represents the response to a +// list database transparent data encryption activity request. +type TransparentDataEncryptionActivityListResult struct { + autorest.Response `json:"-"` + Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` +} + +// TransparentDataEncryptionActivityProperties is represents the properties of +// a database transparent data encryption Scan. +type TransparentDataEncryptionActivityProperties struct { + Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` + PercentComplete *float64 `json:"percentComplete,omitempty"` +} + +// TransparentDataEncryptionProperties is represents the properties of a +// database transparent data encryption. +type TransparentDataEncryptionProperties struct { + Status TransparentDataEncryptionStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/operations.go index 0e34565709..510869b74e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/operations.go @@ -1,101 +1,101 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// OperationsClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services -// to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type OperationsClient struct { - ManagementClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient -// client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available SQL Rest API operations. -func (client OperationsClient) List() (result OperationListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer() (*http.Request, error) { - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Sql/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the the Azure SQL Database management API provides a +// RESTful set of web services that interact with Azure SQL Database services +// to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type OperationsClient struct { + ManagementClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient +// client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available SQL Rest API operations. +func (client OperationsClient) List() (result OperationListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer() (*http.Request, error) { + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Sql/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/recommendedelasticpools.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/recommendedelasticpools.go index 422b592555..6beccb801b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/recommendedelasticpools.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/recommendedelasticpools.go @@ -1,390 +1,390 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// RecommendedElasticPoolsClient is the the Azure SQL Database management API -// provides a RESTful set of web services that interact with Azure SQL Database -// services to manage your databases. The API enables you to create, retrieve, -// update, and delete databases. -type RecommendedElasticPoolsClient struct { - ManagementClient -} - -// NewRecommendedElasticPoolsClient creates an instance of the -// RecommendedElasticPoolsClient client. -func NewRecommendedElasticPoolsClient(subscriptionID string) RecommendedElasticPoolsClient { - return NewRecommendedElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecommendedElasticPoolsClientWithBaseURI creates an instance of the -// RecommendedElasticPoolsClient client. -func NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedElasticPoolsClient { - return RecommendedElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recommented elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) Get(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) { - req, err := client.GetPreparer(resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecommendedElasticPoolsClient) GetPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) GetResponder(resp *http.Response) (result RecommendedElasticPool, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDatabases gets a database inside of a recommented elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. recommendedElasticPoolName -// is the name of the elastic pool to be retrieved. databaseName is the name of -// the database to be retrieved. -func (client RecommendedElasticPoolsClient) GetDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result Database, err error) { - req, err := client.GetDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.GetDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", resp, "Failure sending request") - return - } - - result, err = client.GetDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", resp, "Failure responding to request") - } - - return -} - -// GetDatabasesPreparer prepares the GetDatabases request. -func (client RecommendedElasticPoolsClient) GetDatabasesPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDatabasesSender sends the GetDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) GetDatabasesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDatabasesResponder handles the response to the GetDatabases request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) GetDatabasesResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer returns recommended elastic pools. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client RecommendedElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { - req, err := client.ListByServerPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure responding to request") - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecommendedElasticPoolsClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListByServerResponder(resp *http.Response) (result RecommendedElasticPoolListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDatabases returns a list of databases inside a recommented elastic pool. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result DatabaseListResult, err error) { - req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", resp, "Failure responding to request") - } - - return -} - -// ListDatabasesPreparer prepares the ListDatabases request. -func (client RecommendedElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDatabasesSender sends the ListDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListDatabasesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDatabasesResponder handles the response to the ListDatabases request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListDatabasesResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics returns a recommented elastic pool metrics. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. recommendedElasticPoolName -// is the name of the recommended elastic pool to be retrieved. -func (client RecommendedElasticPoolsClient) ListMetrics(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) { - req, err := client.ListMetricsPreparer(resourceGroupName, serverName, recommendedElasticPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client RecommendedElasticPoolsClient) ListMetricsPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client RecommendedElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result RecommendedElasticPoolListMetricsResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// RecommendedElasticPoolsClient is the the Azure SQL Database management API +// provides a RESTful set of web services that interact with Azure SQL Database +// services to manage your databases. The API enables you to create, retrieve, +// update, and delete databases. +type RecommendedElasticPoolsClient struct { + ManagementClient +} + +// NewRecommendedElasticPoolsClient creates an instance of the +// RecommendedElasticPoolsClient client. +func NewRecommendedElasticPoolsClient(subscriptionID string) RecommendedElasticPoolsClient { + return NewRecommendedElasticPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecommendedElasticPoolsClientWithBaseURI creates an instance of the +// RecommendedElasticPoolsClient client. +func NewRecommendedElasticPoolsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedElasticPoolsClient { + return RecommendedElasticPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a recommented elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the recommended elastic pool to be retrieved. +func (client RecommendedElasticPoolsClient) Get(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPool, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName, recommendedElasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client RecommendedElasticPoolsClient) GetPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendedElasticPoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RecommendedElasticPoolsClient) GetResponder(resp *http.Response) (result RecommendedElasticPool, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDatabases gets a database inside of a recommented elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the elastic pool to be retrieved. databaseName is the name of +// the database to be retrieved. +func (client RecommendedElasticPoolsClient) GetDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (result Database, err error) { + req, err := client.GetDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.GetDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", resp, "Failure sending request") + return + } + + result, err = client.GetDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "GetDatabases", resp, "Failure responding to request") + } + + return +} + +// GetDatabasesPreparer prepares the GetDatabases request. +func (client RecommendedElasticPoolsClient) GetDatabasesPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "databaseName": autorest.Encode("path", databaseName), + "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDatabasesSender sends the GetDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendedElasticPoolsClient) GetDatabasesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDatabasesResponder handles the response to the GetDatabases request. The method always +// closes the http.Response Body. +func (client RecommendedElasticPoolsClient) GetDatabasesResponder(resp *http.Response) (result Database, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByServer returns recommended elastic pools. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client RecommendedElasticPoolsClient) ListByServer(resourceGroupName string, serverName string) (result RecommendedElasticPoolListResult, err error) { + req, err := client.ListByServerPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp, err := client.ListByServerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure sending request") + return + } + + result, err = client.ListByServerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListByServer", resp, "Failure responding to request") + } + + return +} + +// ListByServerPreparer prepares the ListByServer request. +func (client RecommendedElasticPoolsClient) ListByServerPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByServerSender sends the ListByServer request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendedElasticPoolsClient) ListByServerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByServerResponder handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (client RecommendedElasticPoolsClient) ListByServerResponder(resp *http.Response) (result RecommendedElasticPoolListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDatabases returns a list of databases inside a recommented elastic pool. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the recommended elastic pool to be retrieved. +func (client RecommendedElasticPoolsClient) ListDatabases(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result DatabaseListResult, err error) { + req, err := client.ListDatabasesPreparer(resourceGroupName, serverName, recommendedElasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.ListDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", resp, "Failure sending request") + return + } + + result, err = client.ListDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListDatabases", resp, "Failure responding to request") + } + + return +} + +// ListDatabasesPreparer prepares the ListDatabases request. +func (client RecommendedElasticPoolsClient) ListDatabasesPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDatabasesSender sends the ListDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendedElasticPoolsClient) ListDatabasesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDatabasesResponder handles the response to the ListDatabases request. The method always +// closes the http.Response Body. +func (client RecommendedElasticPoolsClient) ListDatabasesResponder(resp *http.Response) (result DatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetrics returns a recommented elastic pool metrics. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. recommendedElasticPoolName +// is the name of the recommended elastic pool to be retrieved. +func (client RecommendedElasticPoolsClient) ListMetrics(resourceGroupName string, serverName string, recommendedElasticPoolName string) (result RecommendedElasticPoolListMetricsResult, err error) { + req, err := client.ListMetricsPreparer(resourceGroupName, serverName, recommendedElasticPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.RecommendedElasticPoolsClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client RecommendedElasticPoolsClient) ListMetricsPreparer(resourceGroupName string, serverName string, recommendedElasticPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "recommendedElasticPoolName": autorest.Encode("path", recommendedElasticPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendedElasticPoolsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client RecommendedElasticPoolsClient) ListMetricsResponder(resp *http.Response) (result RecommendedElasticPoolListMetricsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/servers.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/servers.go index d0ce202916..83290fa93f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/servers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/servers.go @@ -1,576 +1,576 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ServersClient is the the Azure SQL Database management API provides a -// RESTful set of web services that interact with Azure SQL Database services -// to manage your databases. The API enables you to create, retrieve, update, -// and delete databases. -type ServersClient struct { - ManagementClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient client. -func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a new server. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. parameters is the required -// parameters for creating or updating a server. -func (client ServersClient) CreateOrUpdate(resourceGroupName string, serverName string, parameters Server) (result Server, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServersClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a SQL server. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client ServersClient) Delete(resourceGroupName string, serverName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a server. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client ServersClient) Get(resourceGroupName string, serverName string) (result Server, err error) { - req, err := client.GetPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServiceObjective gets a database service objective. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. serviceObjectiveName is -// the name of the service objective to retrieve. -func (client ServersClient) GetServiceObjective(resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { - req, err := client.GetServiceObjectivePreparer(resourceGroupName, serverName, serviceObjectiveName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", nil, "Failure preparing request") - return - } - - resp, err := client.GetServiceObjectiveSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", resp, "Failure sending request") - return - } - - result, err = client.GetServiceObjectiveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", resp, "Failure responding to request") - } - - return -} - -// GetServiceObjectivePreparer prepares the GetServiceObjective request. -func (client ServersClient) GetServiceObjectivePreparer(resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "serviceObjectiveName": autorest.Encode("path", serviceObjectiveName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetServiceObjectiveSender sends the GetServiceObjective request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetServiceObjectiveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetServiceObjectiveResponder handles the response to the GetServiceObjective request. The method always -// closes the http.Response Body. -func (client ServersClient) GetServiceObjectiveResponder(resp *http.Response) (result ServiceObjective, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of servers. -func (client ServersClient) List() (result ServerListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup returns a list of servers in a resource group. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. -func (client ServersClient) ListByResourceGroup(resourceGroupName string) (result ServerListResult, err error) { - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListServiceObjectives returns database service objectives. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client ServersClient) ListServiceObjectives(resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { - req, err := client.ListServiceObjectivesPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", nil, "Failure preparing request") - return - } - - resp, err := client.ListServiceObjectivesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", resp, "Failure sending request") - return - } - - result, err = client.ListServiceObjectivesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", resp, "Failure responding to request") - } - - return -} - -// ListServiceObjectivesPreparer prepares the ListServiceObjectives request. -func (client ServersClient) ListServiceObjectivesPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListServiceObjectivesSender sends the ListServiceObjectives request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListServiceObjectivesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListServiceObjectivesResponder handles the response to the ListServiceObjectives request. The method always -// closes the http.Response Body. -func (client ServersClient) ListServiceObjectivesResponder(resp *http.Response) (result ServiceObjectiveListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages returns server usages. -// -// resourceGroupName is the name of the resource group that contains the -// resource. You can obtain this value from the Azure Resource Manager API or -// the portal. serverName is the name of the server. -func (client ServersClient) ListUsages(resourceGroupName string, serverName string) (result ServerMetricListResult, err error) { - req, err := client.ListUsagesPreparer(resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", resp, "Failure responding to request") - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client ServersClient) ListUsagesPreparer(resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2014-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client ServersClient) ListUsagesResponder(resp *http.Response) (result ServerMetricListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ServersClient is the the Azure SQL Database management API provides a +// RESTful set of web services that interact with Azure SQL Database services +// to manage your databases. The API enables you to create, retrieve, update, +// and delete databases. +type ServersClient struct { + ManagementClient +} + +// NewServersClient creates an instance of the ServersClient client. +func NewServersClient(subscriptionID string) ServersClient { + return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServersClientWithBaseURI creates an instance of the ServersClient client. +func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { + return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a new server. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. parameters is the required +// parameters for creating or updating a server. +func (client ServersClient) CreateOrUpdate(resourceGroupName string, serverName string, parameters Server) (result Server, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, serverName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServersClient) CreateOrUpdatePreparer(resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServersClient) CreateOrUpdateResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a SQL server. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client ServersClient) Delete(resourceGroupName string, serverName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServersClient) DeletePreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a server. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client ServersClient) Get(resourceGroupName string, serverName string) (result Server, err error) { + req, err := client.GetPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServersClient) GetPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetServiceObjective gets a database service objective. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. serviceObjectiveName is +// the name of the service objective to retrieve. +func (client ServersClient) GetServiceObjective(resourceGroupName string, serverName string, serviceObjectiveName string) (result ServiceObjective, err error) { + req, err := client.GetServiceObjectivePreparer(resourceGroupName, serverName, serviceObjectiveName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", nil, "Failure preparing request") + return + } + + resp, err := client.GetServiceObjectiveSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", resp, "Failure sending request") + return + } + + result, err = client.GetServiceObjectiveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "GetServiceObjective", resp, "Failure responding to request") + } + + return +} + +// GetServiceObjectivePreparer prepares the GetServiceObjective request. +func (client ServersClient) GetServiceObjectivePreparer(resourceGroupName string, serverName string, serviceObjectiveName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "serviceObjectiveName": autorest.Encode("path", serviceObjectiveName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetServiceObjectiveSender sends the GetServiceObjective request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) GetServiceObjectiveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetServiceObjectiveResponder handles the response to the GetServiceObjective request. The method always +// closes the http.Response Body. +func (client ServersClient) GetServiceObjectiveResponder(resp *http.Response) (result ServiceObjective, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns a list of servers. +func (client ServersClient) List() (result ServerListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns a list of servers in a resource group. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. +func (client ServersClient) ListByResourceGroup(resourceGroupName string) (result ServerListResult, err error) { + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListServiceObjectives returns database service objectives. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client ServersClient) ListServiceObjectives(resourceGroupName string, serverName string) (result ServiceObjectiveListResult, err error) { + req, err := client.ListServiceObjectivesPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", nil, "Failure preparing request") + return + } + + resp, err := client.ListServiceObjectivesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", resp, "Failure sending request") + return + } + + result, err = client.ListServiceObjectivesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListServiceObjectives", resp, "Failure responding to request") + } + + return +} + +// ListServiceObjectivesPreparer prepares the ListServiceObjectives request. +func (client ServersClient) ListServiceObjectivesPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListServiceObjectivesSender sends the ListServiceObjectives request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListServiceObjectivesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListServiceObjectivesResponder handles the response to the ListServiceObjectives request. The method always +// closes the http.Response Body. +func (client ServersClient) ListServiceObjectivesResponder(resp *http.Response) (result ServiceObjectiveListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages returns server usages. +// +// resourceGroupName is the name of the resource group that contains the +// resource. You can obtain this value from the Azure Resource Manager API or +// the portal. serverName is the name of the server. +func (client ServersClient) ListUsages(resourceGroupName string, serverName string) (result ServerMetricListResult, err error) { + req, err := client.ListUsagesPreparer(resourceGroupName, serverName) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "sql.ServersClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client ServersClient) ListUsagesPreparer(resourceGroupName string, serverName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serverName": autorest.Encode("path", serverName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2014-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client ServersClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client ServersClient) ListUsagesResponder(resp *http.Response) (result ServerMetricListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/version.go index ce8a5f649d..37edb97165 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/sql/version.go @@ -1,29 +1,29 @@ -package sql - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-sql/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package sql + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-sql/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go index f1c45a1f30..f0606ac133 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go @@ -1,960 +1,960 @@ -package storage - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AccountsClient is the the Azure Storage Management API. -type AccountsClient struct { - ManagementClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient -// client. -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the storage account name is valid and is -// not already in use. -// -// accountName is the name of the storage account within the specified resource -// group. Storage account names must be between 3 and 24 characters in length -// and use numbers and lower-case letters only. -func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "accountName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client AccountsClient) CheckNameAvailabilityPreparer(accountName AccountCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability", pathParameters), - autorest.WithJSON(accountName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create asynchronously creates a new storage account with the specified -// parameters. If an account is already created and a subsequent create request -// is issued with different properties, the account properties will be updated. -// If an account is already created and a subsequent create or update request -// is issued with the exact same set of properties, the request will succeed. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. parameters is the parameters to provide for the created -// account. -func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (<-chan Account, <-chan error) { - resultChan := make(chan Account, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.AccountPropertiesCreateParameters.Encryption", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.KeySource", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Create") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Account - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreatePreparer prepares the Create request. -func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a storage account in Microsoft Azure. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetProperties returns the properties for the specified storage account -// including but not limited to name, SKU name, location, and account status. -// The ListKeys operation should be used to retrieve storage keys. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "GetProperties") - } - - req, err := client.GetPropertiesPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", nil, "Failure preparing request") - return - } - - resp, err := client.GetPropertiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure sending request") - return - } - - result, err = client.GetPropertiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure responding to request") - } - - return -} - -// GetPropertiesPreparer prepares the GetProperties request. -func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPropertiesSender sends the GetProperties request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPropertiesResponder handles the response to the GetProperties request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the storage accounts available under the subscription. Note -// that storage keys are not returned; use the ListKeys operation for this. -func (client AccountsClient) List() (result AccountListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAccountSAS list SAS credentials of a storage account. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. parameters is the parameters to provide to list SAS -// credentials for the storage account. -func (client AccountsClient) ListAccountSAS(resourceGroupName string, accountName string, parameters AccountSasParameters) (result ListAccountSasResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessExpiryTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListAccountSAS") - } - - req, err := client.ListAccountSASPreparer(resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", nil, "Failure preparing request") - return - } - - resp, err := client.ListAccountSASSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure sending request") - return - } - - result, err = client.ListAccountSASResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure responding to request") - } - - return -} - -// ListAccountSASPreparer prepares the ListAccountSAS request. -func (client AccountsClient) ListAccountSASPreparer(resourceGroupName string, accountName string, parameters AccountSasParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAccountSASSender sends the ListAccountSAS request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListAccountSASSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAccountSASResponder handles the response to the ListAccountSAS request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListAccountSASResponder(resp *http.Response) (result ListAccountSasResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the storage accounts available under the given -// resource group. Note that storage keys are not returned; use the ListKeys -// operation for this. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. -func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListKeys lists the access keys for the specified storage account. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. -func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountListKeysResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListKeys") - } - - req, err := client.ListKeysPreparer(resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure responding to request") - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountListKeysResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListServiceSAS list service SAS credentials of a specific resource. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. parameters is the parameters to provide to list service SAS -// credentials. -func (client AccountsClient) ListServiceSAS(resourceGroupName string, accountName string, parameters ServiceSasParameters) (result ListServiceSasResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CanonicalizedResource", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Identifier", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Identifier", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListServiceSAS") - } - - req, err := client.ListServiceSASPreparer(resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", nil, "Failure preparing request") - return - } - - resp, err := client.ListServiceSASSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure sending request") - return - } - - result, err = client.ListServiceSASResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure responding to request") - } - - return -} - -// ListServiceSASPreparer prepares the ListServiceSAS request. -func (client AccountsClient) ListServiceSASPreparer(resourceGroupName string, accountName string, parameters ServiceSasParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListServiceSASSender sends the ListServiceSAS request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListServiceSASSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListServiceSASResponder handles the response to the ListServiceSAS request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListServiceSASResponder(resp *http.Response) (result ListServiceSasResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates one of the access keys for the specified storage -// account. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. regenerateKey is specifies name of the key which should be -// regenerated -- key1 or key2. -func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: regenerateKey, - Constraints: []validation.Constraint{{Target: "regenerateKey.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "RegenerateKey") - } - - req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure responding to request") - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKey), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountListKeysResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update the update operation can be used to update the SKU, encryption, -// access tier, or tags for a storage account. It can also be used to map the -// account to a custom domain. Only one custom domain is supported per storage -// account; the replacement/change of custom domain is not supported. In order -// to replace an old custom domain, the old value must be cleared/unregistered -// before a new value can be set. The update of multiple properties is -// supported. This call does not change the storage keys for the account. If -// you want to change the storage account keys, use the regenerate keys -// operation. The location and name of the storage account cannot be changed -// after creation. -// -// resourceGroupName is the name of the resource group within the user's -// subscription. The name is case insensitive. accountName is the name of the -// storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case -// letters only. parameters is the parameters to provide for the updated -// account. -func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package storage + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AccountsClient is the the Azure Storage Management API. +type AccountsClient struct { + ManagementClient +} + +// NewAccountsClient creates an instance of the AccountsClient client. +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountsClientWithBaseURI creates an instance of the AccountsClient +// client. +func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the storage account name is valid and is +// not already in use. +// +// accountName is the name of the storage account within the specified resource +// group. Storage account names must be between 3 and 24 characters in length +// and use numbers and lower-case letters only. +func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "accountName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client AccountsClient) CheckNameAvailabilityPreparer(accountName AccountCheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability", pathParameters), + autorest.WithJSON(accountName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create asynchronously creates a new storage account with the specified +// parameters. If an account is already created and a subsequent create request +// is issued with different properties, the account properties will be updated. +// If an account is already created and a subsequent create or update request +// is issued with the exact same set of properties, the request will succeed. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. parameters is the parameters to provide for the created +// account. +func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (<-chan Account, <-chan error) { + resultChan := make(chan Account, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountPropertiesCreateParameters.Encryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.Encryption.KeySource", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Create") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Account + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreatePreparer prepares the Create request. +func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a storage account in Microsoft Azure. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountsClient) DeletePreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetProperties returns the properties for the specified storage account +// including but not limited to name, SKU name, location, and account status. +// The ListKeys operation should be used to retrieve storage keys. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "GetProperties") + } + + req, err := client.GetPropertiesPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", nil, "Failure preparing request") + return + } + + resp, err := client.GetPropertiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure sending request") + return + } + + result, err = client.GetPropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure responding to request") + } + + return +} + +// GetPropertiesPreparer prepares the GetProperties request. +func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPropertiesSender sends the GetProperties request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPropertiesResponder handles the response to the GetProperties request. The method always +// closes the http.Response Body. +func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the storage accounts available under the subscription. Note +// that storage keys are not returned; use the ListKeys operation for this. +func (client AccountsClient) List() (result AccountListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAccountSAS list SAS credentials of a storage account. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. parameters is the parameters to provide to list SAS +// credentials for the storage account. +func (client AccountsClient) ListAccountSAS(resourceGroupName string, accountName string, parameters AccountSasParameters) (result ListAccountSasResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessExpiryTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListAccountSAS") + } + + req, err := client.ListAccountSASPreparer(resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", nil, "Failure preparing request") + return + } + + resp, err := client.ListAccountSASSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure sending request") + return + } + + result, err = client.ListAccountSASResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure responding to request") + } + + return +} + +// ListAccountSASPreparer prepares the ListAccountSAS request. +func (client AccountsClient) ListAccountSASPreparer(resourceGroupName string, accountName string, parameters AccountSasParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAccountSASSender sends the ListAccountSAS request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListAccountSASSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAccountSASResponder handles the response to the ListAccountSAS request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListAccountSASResponder(resp *http.Response) (result ListAccountSasResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all the storage accounts available under the given +// resource group. Note that storage keys are not returned; use the ListKeys +// operation for this. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. +func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeys lists the access keys for the specified storage account. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. +func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountListKeysResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListKeys") + } + + req, err := client.ListKeysPreparer(resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure responding to request") + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountListKeysResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListServiceSAS list service SAS credentials of a specific resource. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. parameters is the parameters to provide to list service SAS +// credentials. +func (client AccountsClient) ListServiceSAS(resourceGroupName string, accountName string, parameters ServiceSasParameters) (result ListServiceSasResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CanonicalizedResource", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Identifier", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Identifier", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "ListServiceSAS") + } + + req, err := client.ListServiceSASPreparer(resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", nil, "Failure preparing request") + return + } + + resp, err := client.ListServiceSASSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure sending request") + return + } + + result, err = client.ListServiceSASResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure responding to request") + } + + return +} + +// ListServiceSASPreparer prepares the ListServiceSAS request. +func (client AccountsClient) ListServiceSASPreparer(resourceGroupName string, accountName string, parameters ServiceSasParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListServiceSASSender sends the ListServiceSAS request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListServiceSASSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListServiceSASResponder handles the response to the ListServiceSAS request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListServiceSASResponder(resp *http.Response) (result ListServiceSasResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerates one of the access keys for the specified storage +// account. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. regenerateKey is specifies name of the key which should be +// regenerated -- key1 or key2. +func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: regenerateKey, + Constraints: []validation.Constraint{{Target: "regenerateKey.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "RegenerateKey") + } + + req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKey), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountListKeysResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update the update operation can be used to update the SKU, encryption, +// access tier, or tags for a storage account. It can also be used to map the +// account to a custom domain. Only one custom domain is supported per storage +// account; the replacement/change of custom domain is not supported. In order +// to replace an old custom domain, the old value must be cleared/unregistered +// before a new value can be set. The update of multiple properties is +// supported. This call does not change the storage keys for the account. If +// you want to change the storage account keys, use the regenerate keys +// operation. The location and name of the storage account cannot be changed +// after creation. +// +// resourceGroupName is the name of the resource group within the user's +// subscription. The name is case insensitive. accountName is the name of the +// storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case +// letters only. parameters is the parameters to provide for the updated +// account. +func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storage.AccountsClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go index f0348b33b7..a537bdd25e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go @@ -1,53 +1,53 @@ -// Package storage implements the Azure ARM Storage service API version -// 2016-12-01. -// -// The Azure Storage Management API. -package storage - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Storage - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Storage. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package storage implements the Azure ARM Storage service API version +// 2016-12-01. +// +// The Azure Storage Management API. +package storage + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Storage + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Storage. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go index 852e99e9b7..2e20301842 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go @@ -1,452 +1,452 @@ -package storage - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// AccessTier enumerates the values for access tier. -type AccessTier string - -const ( - // Cool specifies the cool state for access tier. - Cool AccessTier = "Cool" - // Hot specifies the hot state for access tier. - Hot AccessTier = "Hot" -) - -// AccountStatus enumerates the values for account status. -type AccountStatus string - -const ( - // Available specifies the available state for account status. - Available AccountStatus = "available" - // Unavailable specifies the unavailable state for account status. - Unavailable AccountStatus = "unavailable" -) - -// HTTPProtocol enumerates the values for http protocol. -type HTTPProtocol string - -const ( - // HTTPS specifies the https state for http protocol. - HTTPS HTTPProtocol = "https" - // Httpshttp specifies the httpshttp state for http protocol. - Httpshttp HTTPProtocol = "https,http" -) - -// KeyPermission enumerates the values for key permission. -type KeyPermission string - -const ( - // Full specifies the full state for key permission. - Full KeyPermission = "Full" - // Read specifies the read state for key permission. - Read KeyPermission = "Read" -) - -// Kind enumerates the values for kind. -type Kind string - -const ( - // BlobStorage specifies the blob storage state for kind. - BlobStorage Kind = "BlobStorage" - // Storage specifies the storage state for kind. - Storage Kind = "Storage" -) - -// Permissions enumerates the values for permissions. -type Permissions string - -const ( - // A specifies the a state for permissions. - A Permissions = "a" - // C specifies the c state for permissions. - C Permissions = "c" - // D specifies the d state for permissions. - D Permissions = "d" - // L specifies the l state for permissions. - L Permissions = "l" - // P specifies the p state for permissions. - P Permissions = "p" - // R specifies the r state for permissions. - R Permissions = "r" - // U specifies the u state for permissions. - U Permissions = "u" - // W specifies the w state for permissions. - W Permissions = "w" -) - -// Permissions1 enumerates the values for permissions 1. -type Permissions1 string - -const ( - // Permissions1A specifies the permissions 1a state for permissions 1. - Permissions1A Permissions1 = "a" - // Permissions1C specifies the permissions 1c state for permissions 1. - Permissions1C Permissions1 = "c" - // Permissions1D specifies the permissions 1d state for permissions 1. - Permissions1D Permissions1 = "d" - // Permissions1L specifies the permissions 1l state for permissions 1. - Permissions1L Permissions1 = "l" - // Permissions1P specifies the permissions 1p state for permissions 1. - Permissions1P Permissions1 = "p" - // Permissions1R specifies the permissions 1r state for permissions 1. - Permissions1R Permissions1 = "r" - // Permissions1U specifies the permissions 1u state for permissions 1. - Permissions1U Permissions1 = "u" - // Permissions1W specifies the permissions 1w state for permissions 1. - Permissions1W Permissions1 = "w" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Creating specifies the creating state for provisioning state. - Creating ProvisioningState = "Creating" - // ResolvingDNS specifies the resolving dns state for provisioning state. - ResolvingDNS ProvisioningState = "ResolvingDNS" - // Succeeded specifies the succeeded state for provisioning state. - Succeeded ProvisioningState = "Succeeded" -) - -// Reason enumerates the values for reason. -type Reason string - -const ( - // AccountNameInvalid specifies the account name invalid state for reason. - AccountNameInvalid Reason = "AccountNameInvalid" - // AlreadyExists specifies the already exists state for reason. - AlreadyExists Reason = "AlreadyExists" -) - -// ResourceEnum enumerates the values for resource enum. -type ResourceEnum string - -const ( - // ResourceEnumB specifies the resource enum b state for resource enum. - ResourceEnumB ResourceEnum = "b" - // ResourceEnumC specifies the resource enum c state for resource enum. - ResourceEnumC ResourceEnum = "c" - // ResourceEnumF specifies the resource enum f state for resource enum. - ResourceEnumF ResourceEnum = "f" - // ResourceEnumS specifies the resource enum s state for resource enum. - ResourceEnumS ResourceEnum = "s" -) - -// ResourceTypes enumerates the values for resource types. -type ResourceTypes string - -const ( - // ResourceTypesC specifies the resource types c state for resource types. - ResourceTypesC ResourceTypes = "c" - // ResourceTypesO specifies the resource types o state for resource types. - ResourceTypesO ResourceTypes = "o" - // ResourceTypesS specifies the resource types s state for resource types. - ResourceTypesS ResourceTypes = "s" -) - -// Services enumerates the values for services. -type Services string - -const ( - // B specifies the b state for services. - B Services = "b" - // F specifies the f state for services. - F Services = "f" - // Q specifies the q state for services. - Q Services = "q" - // T specifies the t state for services. - T Services = "t" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // PremiumLRS specifies the premium lrs state for sku name. - PremiumLRS SkuName = "Premium_LRS" - // StandardGRS specifies the standard grs state for sku name. - StandardGRS SkuName = "Standard_GRS" - // StandardLRS specifies the standard lrs state for sku name. - StandardLRS SkuName = "Standard_LRS" - // StandardRAGRS specifies the standard ragrs state for sku name. - StandardRAGRS SkuName = "Standard_RAGRS" - // StandardZRS specifies the standard zrs state for sku name. - StandardZRS SkuName = "Standard_ZRS" -) - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Premium specifies the premium state for sku tier. - Premium SkuTier = "Premium" - // Standard specifies the standard state for sku tier. - Standard SkuTier = "Standard" -) - -// UsageUnit enumerates the values for usage unit. -type UsageUnit string - -const ( - // Bytes specifies the bytes state for usage unit. - Bytes UsageUnit = "Bytes" - // BytesPerSecond specifies the bytes per second state for usage unit. - BytesPerSecond UsageUnit = "BytesPerSecond" - // Count specifies the count state for usage unit. - Count UsageUnit = "Count" - // CountsPerSecond specifies the counts per second state for usage unit. - CountsPerSecond UsageUnit = "CountsPerSecond" - // Percent specifies the percent state for usage unit. - Percent UsageUnit = "Percent" - // Seconds specifies the seconds state for usage unit. - Seconds UsageUnit = "Seconds" -) - -// Account is the storage account. -type Account struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Kind Kind `json:"kind,omitempty"` - *AccountProperties `json:"properties,omitempty"` -} - -// AccountCheckNameAvailabilityParameters is the parameters used to check the -// availabity of the storage account name. -type AccountCheckNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// AccountCreateParameters is the parameters used when creating a storage -// account. -type AccountCreateParameters struct { - Sku *Sku `json:"sku,omitempty"` - Kind Kind `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AccountPropertiesCreateParameters `json:"properties,omitempty"` -} - -// AccountKey is an access key for the storage account. -type AccountKey struct { - KeyName *string `json:"keyName,omitempty"` - Value *string `json:"value,omitempty"` - Permissions KeyPermission `json:"permissions,omitempty"` -} - -// AccountListKeysResult is the response from the ListKeys operation. -type AccountListKeysResult struct { - autorest.Response `json:"-"` - Keys *[]AccountKey `json:"keys,omitempty"` -} - -// AccountListResult is the response from the List Storage Accounts operation. -type AccountListResult struct { - autorest.Response `json:"-"` - Value *[]Account `json:"value,omitempty"` -} - -// AccountProperties is properties of the storage account. -type AccountProperties struct { - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - PrimaryEndpoints *Endpoints `json:"primaryEndpoints,omitempty"` - PrimaryLocation *string `json:"primaryLocation,omitempty"` - StatusOfPrimary AccountStatus `json:"statusOfPrimary,omitempty"` - LastGeoFailoverTime *date.Time `json:"lastGeoFailoverTime,omitempty"` - SecondaryLocation *string `json:"secondaryLocation,omitempty"` - StatusOfSecondary AccountStatus `json:"statusOfSecondary,omitempty"` - CreationTime *date.Time `json:"creationTime,omitempty"` - CustomDomain *CustomDomain `json:"customDomain,omitempty"` - SecondaryEndpoints *Endpoints `json:"secondaryEndpoints,omitempty"` - Encryption *Encryption `json:"encryption,omitempty"` - AccessTier AccessTier `json:"accessTier,omitempty"` - EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` -} - -// AccountPropertiesCreateParameters is the parameters used to create the -// storage account. -type AccountPropertiesCreateParameters struct { - CustomDomain *CustomDomain `json:"customDomain,omitempty"` - Encryption *Encryption `json:"encryption,omitempty"` - AccessTier AccessTier `json:"accessTier,omitempty"` - EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` -} - -// AccountPropertiesUpdateParameters is the parameters used when updating a -// storage account. -type AccountPropertiesUpdateParameters struct { - CustomDomain *CustomDomain `json:"customDomain,omitempty"` - Encryption *Encryption `json:"encryption,omitempty"` - AccessTier AccessTier `json:"accessTier,omitempty"` - EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` -} - -// AccountRegenerateKeyParameters is the parameters used to regenerate the -// storage account key. -type AccountRegenerateKeyParameters struct { - KeyName *string `json:"keyName,omitempty"` -} - -// AccountSasParameters is the parameters to list SAS credentials of a storage -// account. -type AccountSasParameters struct { - Services Services `json:"signedServices,omitempty"` - ResourceTypes ResourceTypes `json:"signedResourceTypes,omitempty"` - Permissions Permissions `json:"signedPermission,omitempty"` - IPAddressOrRange *string `json:"signedIp,omitempty"` - Protocols HTTPProtocol `json:"signedProtocol,omitempty"` - SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` - SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` - KeyToSign *string `json:"keyToSign,omitempty"` -} - -// AccountUpdateParameters is the parameters that can be provided when updating -// the storage account properties. -type AccountUpdateParameters struct { - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AccountPropertiesUpdateParameters `json:"properties,omitempty"` -} - -// CheckNameAvailabilityResult is the CheckNameAvailability operation response. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason Reason `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CustomDomain is the custom domain assigned to this storage account. This can -// be set via Update. -type CustomDomain struct { - Name *string `json:"name,omitempty"` - UseSubDomain *bool `json:"useSubDomain,omitempty"` -} - -// Encryption is the encryption settings on the storage account. -type Encryption struct { - Services *EncryptionServices `json:"services,omitempty"` - KeySource *string `json:"keySource,omitempty"` -} - -// EncryptionService is a service that allows server-side encryption to be -// used. -type EncryptionService struct { - Enabled *bool `json:"enabled,omitempty"` - LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` -} - -// EncryptionServices is a list of services that support encryption. -type EncryptionServices struct { - Blob *EncryptionService `json:"blob,omitempty"` - File *EncryptionService `json:"file,omitempty"` - Table *EncryptionService `json:"table,omitempty"` - Queue *EncryptionService `json:"queue,omitempty"` -} - -// Endpoints is the URIs that are used to perform a retrieval of a public blob, -// queue, or table object. -type Endpoints struct { - Blob *string `json:"blob,omitempty"` - Queue *string `json:"queue,omitempty"` - Table *string `json:"table,omitempty"` - File *string `json:"file,omitempty"` -} - -// ListAccountSasResponse is the List SAS credentials operation response. -type ListAccountSasResponse struct { - autorest.Response `json:"-"` - AccountSasToken *string `json:"accountSasToken,omitempty"` -} - -// ListServiceSasResponse is the List service SAS credentials operation -// response. -type ListServiceSasResponse struct { - autorest.Response `json:"-"` - ServiceSasToken *string `json:"serviceSasToken,omitempty"` -} - -// Resource is describes a storage resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ServiceSasParameters is the parameters to list service SAS credentials of a -// speicific resource. -type ServiceSasParameters struct { - CanonicalizedResource *string `json:"canonicalizedResource,omitempty"` - Resource Resource `json:"signedResource,omitempty"` - Permissions Permissions `json:"signedPermission,omitempty"` - IPAddressOrRange *string `json:"signedIp,omitempty"` - Protocols HTTPProtocol `json:"signedProtocol,omitempty"` - SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` - SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` - Identifier *string `json:"signedIdentifier,omitempty"` - PartitionKeyStart *string `json:"startPk,omitempty"` - PartitionKeyEnd *string `json:"endPk,omitempty"` - RowKeyStart *string `json:"startRk,omitempty"` - RowKeyEnd *string `json:"endRk,omitempty"` - KeyToSign *string `json:"keyToSign,omitempty"` - CacheControl *string `json:"rscc,omitempty"` - ContentDisposition *string `json:"rscd,omitempty"` - ContentEncoding *string `json:"rsce,omitempty"` - ContentLanguage *string `json:"rscl,omitempty"` - ContentType *string `json:"rsct,omitempty"` -} - -// Sku is the SKU of the storage account. -type Sku struct { - Name SkuName `json:"name,omitempty"` - Tier SkuTier `json:"tier,omitempty"` -} - -// Usage is describes Storage Resource Usage. -type Usage struct { - Unit UsageUnit `json:"unit,omitempty"` - CurrentValue *int32 `json:"currentValue,omitempty"` - Limit *int32 `json:"limit,omitempty"` - Name *UsageName `json:"name,omitempty"` -} - -// UsageListResult is the response from the List Usages operation. -type UsageListResult struct { - autorest.Response `json:"-"` - Value *[]Usage `json:"value,omitempty"` -} - -// UsageName is the usage names that can be used; currently limited to -// StorageAccount. -type UsageName struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} +package storage + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// AccessTier enumerates the values for access tier. +type AccessTier string + +const ( + // Cool specifies the cool state for access tier. + Cool AccessTier = "Cool" + // Hot specifies the hot state for access tier. + Hot AccessTier = "Hot" +) + +// AccountStatus enumerates the values for account status. +type AccountStatus string + +const ( + // Available specifies the available state for account status. + Available AccountStatus = "available" + // Unavailable specifies the unavailable state for account status. + Unavailable AccountStatus = "unavailable" +) + +// HTTPProtocol enumerates the values for http protocol. +type HTTPProtocol string + +const ( + // HTTPS specifies the https state for http protocol. + HTTPS HTTPProtocol = "https" + // Httpshttp specifies the httpshttp state for http protocol. + Httpshttp HTTPProtocol = "https,http" +) + +// KeyPermission enumerates the values for key permission. +type KeyPermission string + +const ( + // Full specifies the full state for key permission. + Full KeyPermission = "Full" + // Read specifies the read state for key permission. + Read KeyPermission = "Read" +) + +// Kind enumerates the values for kind. +type Kind string + +const ( + // BlobStorage specifies the blob storage state for kind. + BlobStorage Kind = "BlobStorage" + // Storage specifies the storage state for kind. + Storage Kind = "Storage" +) + +// Permissions enumerates the values for permissions. +type Permissions string + +const ( + // A specifies the a state for permissions. + A Permissions = "a" + // C specifies the c state for permissions. + C Permissions = "c" + // D specifies the d state for permissions. + D Permissions = "d" + // L specifies the l state for permissions. + L Permissions = "l" + // P specifies the p state for permissions. + P Permissions = "p" + // R specifies the r state for permissions. + R Permissions = "r" + // U specifies the u state for permissions. + U Permissions = "u" + // W specifies the w state for permissions. + W Permissions = "w" +) + +// Permissions1 enumerates the values for permissions 1. +type Permissions1 string + +const ( + // Permissions1A specifies the permissions 1a state for permissions 1. + Permissions1A Permissions1 = "a" + // Permissions1C specifies the permissions 1c state for permissions 1. + Permissions1C Permissions1 = "c" + // Permissions1D specifies the permissions 1d state for permissions 1. + Permissions1D Permissions1 = "d" + // Permissions1L specifies the permissions 1l state for permissions 1. + Permissions1L Permissions1 = "l" + // Permissions1P specifies the permissions 1p state for permissions 1. + Permissions1P Permissions1 = "p" + // Permissions1R specifies the permissions 1r state for permissions 1. + Permissions1R Permissions1 = "r" + // Permissions1U specifies the permissions 1u state for permissions 1. + Permissions1U Permissions1 = "u" + // Permissions1W specifies the permissions 1w state for permissions 1. + Permissions1W Permissions1 = "w" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Creating specifies the creating state for provisioning state. + Creating ProvisioningState = "Creating" + // ResolvingDNS specifies the resolving dns state for provisioning state. + ResolvingDNS ProvisioningState = "ResolvingDNS" + // Succeeded specifies the succeeded state for provisioning state. + Succeeded ProvisioningState = "Succeeded" +) + +// Reason enumerates the values for reason. +type Reason string + +const ( + // AccountNameInvalid specifies the account name invalid state for reason. + AccountNameInvalid Reason = "AccountNameInvalid" + // AlreadyExists specifies the already exists state for reason. + AlreadyExists Reason = "AlreadyExists" +) + +// ResourceEnum enumerates the values for resource enum. +type ResourceEnum string + +const ( + // ResourceEnumB specifies the resource enum b state for resource enum. + ResourceEnumB ResourceEnum = "b" + // ResourceEnumC specifies the resource enum c state for resource enum. + ResourceEnumC ResourceEnum = "c" + // ResourceEnumF specifies the resource enum f state for resource enum. + ResourceEnumF ResourceEnum = "f" + // ResourceEnumS specifies the resource enum s state for resource enum. + ResourceEnumS ResourceEnum = "s" +) + +// ResourceTypes enumerates the values for resource types. +type ResourceTypes string + +const ( + // ResourceTypesC specifies the resource types c state for resource types. + ResourceTypesC ResourceTypes = "c" + // ResourceTypesO specifies the resource types o state for resource types. + ResourceTypesO ResourceTypes = "o" + // ResourceTypesS specifies the resource types s state for resource types. + ResourceTypesS ResourceTypes = "s" +) + +// Services enumerates the values for services. +type Services string + +const ( + // B specifies the b state for services. + B Services = "b" + // F specifies the f state for services. + F Services = "f" + // Q specifies the q state for services. + Q Services = "q" + // T specifies the t state for services. + T Services = "t" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // PremiumLRS specifies the premium lrs state for sku name. + PremiumLRS SkuName = "Premium_LRS" + // StandardGRS specifies the standard grs state for sku name. + StandardGRS SkuName = "Standard_GRS" + // StandardLRS specifies the standard lrs state for sku name. + StandardLRS SkuName = "Standard_LRS" + // StandardRAGRS specifies the standard ragrs state for sku name. + StandardRAGRS SkuName = "Standard_RAGRS" + // StandardZRS specifies the standard zrs state for sku name. + StandardZRS SkuName = "Standard_ZRS" +) + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Premium specifies the premium state for sku tier. + Premium SkuTier = "Premium" + // Standard specifies the standard state for sku tier. + Standard SkuTier = "Standard" +) + +// UsageUnit enumerates the values for usage unit. +type UsageUnit string + +const ( + // Bytes specifies the bytes state for usage unit. + Bytes UsageUnit = "Bytes" + // BytesPerSecond specifies the bytes per second state for usage unit. + BytesPerSecond UsageUnit = "BytesPerSecond" + // Count specifies the count state for usage unit. + Count UsageUnit = "Count" + // CountsPerSecond specifies the counts per second state for usage unit. + CountsPerSecond UsageUnit = "CountsPerSecond" + // Percent specifies the percent state for usage unit. + Percent UsageUnit = "Percent" + // Seconds specifies the seconds state for usage unit. + Seconds UsageUnit = "Seconds" +) + +// Account is the storage account. +type Account struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Kind Kind `json:"kind,omitempty"` + *AccountProperties `json:"properties,omitempty"` +} + +// AccountCheckNameAvailabilityParameters is the parameters used to check the +// availabity of the storage account name. +type AccountCheckNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// AccountCreateParameters is the parameters used when creating a storage +// account. +type AccountCreateParameters struct { + Sku *Sku `json:"sku,omitempty"` + Kind Kind `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AccountPropertiesCreateParameters `json:"properties,omitempty"` +} + +// AccountKey is an access key for the storage account. +type AccountKey struct { + KeyName *string `json:"keyName,omitempty"` + Value *string `json:"value,omitempty"` + Permissions KeyPermission `json:"permissions,omitempty"` +} + +// AccountListKeysResult is the response from the ListKeys operation. +type AccountListKeysResult struct { + autorest.Response `json:"-"` + Keys *[]AccountKey `json:"keys,omitempty"` +} + +// AccountListResult is the response from the List Storage Accounts operation. +type AccountListResult struct { + autorest.Response `json:"-"` + Value *[]Account `json:"value,omitempty"` +} + +// AccountProperties is properties of the storage account. +type AccountProperties struct { + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + PrimaryEndpoints *Endpoints `json:"primaryEndpoints,omitempty"` + PrimaryLocation *string `json:"primaryLocation,omitempty"` + StatusOfPrimary AccountStatus `json:"statusOfPrimary,omitempty"` + LastGeoFailoverTime *date.Time `json:"lastGeoFailoverTime,omitempty"` + SecondaryLocation *string `json:"secondaryLocation,omitempty"` + StatusOfSecondary AccountStatus `json:"statusOfSecondary,omitempty"` + CreationTime *date.Time `json:"creationTime,omitempty"` + CustomDomain *CustomDomain `json:"customDomain,omitempty"` + SecondaryEndpoints *Endpoints `json:"secondaryEndpoints,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + AccessTier AccessTier `json:"accessTier,omitempty"` + EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` +} + +// AccountPropertiesCreateParameters is the parameters used to create the +// storage account. +type AccountPropertiesCreateParameters struct { + CustomDomain *CustomDomain `json:"customDomain,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + AccessTier AccessTier `json:"accessTier,omitempty"` + EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` +} + +// AccountPropertiesUpdateParameters is the parameters used when updating a +// storage account. +type AccountPropertiesUpdateParameters struct { + CustomDomain *CustomDomain `json:"customDomain,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + AccessTier AccessTier `json:"accessTier,omitempty"` + EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` +} + +// AccountRegenerateKeyParameters is the parameters used to regenerate the +// storage account key. +type AccountRegenerateKeyParameters struct { + KeyName *string `json:"keyName,omitempty"` +} + +// AccountSasParameters is the parameters to list SAS credentials of a storage +// account. +type AccountSasParameters struct { + Services Services `json:"signedServices,omitempty"` + ResourceTypes ResourceTypes `json:"signedResourceTypes,omitempty"` + Permissions Permissions `json:"signedPermission,omitempty"` + IPAddressOrRange *string `json:"signedIp,omitempty"` + Protocols HTTPProtocol `json:"signedProtocol,omitempty"` + SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` + SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` + KeyToSign *string `json:"keyToSign,omitempty"` +} + +// AccountUpdateParameters is the parameters that can be provided when updating +// the storage account properties. +type AccountUpdateParameters struct { + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AccountPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// CheckNameAvailabilityResult is the CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason Reason `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// CustomDomain is the custom domain assigned to this storage account. This can +// be set via Update. +type CustomDomain struct { + Name *string `json:"name,omitempty"` + UseSubDomain *bool `json:"useSubDomain,omitempty"` +} + +// Encryption is the encryption settings on the storage account. +type Encryption struct { + Services *EncryptionServices `json:"services,omitempty"` + KeySource *string `json:"keySource,omitempty"` +} + +// EncryptionService is a service that allows server-side encryption to be +// used. +type EncryptionService struct { + Enabled *bool `json:"enabled,omitempty"` + LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` +} + +// EncryptionServices is a list of services that support encryption. +type EncryptionServices struct { + Blob *EncryptionService `json:"blob,omitempty"` + File *EncryptionService `json:"file,omitempty"` + Table *EncryptionService `json:"table,omitempty"` + Queue *EncryptionService `json:"queue,omitempty"` +} + +// Endpoints is the URIs that are used to perform a retrieval of a public blob, +// queue, or table object. +type Endpoints struct { + Blob *string `json:"blob,omitempty"` + Queue *string `json:"queue,omitempty"` + Table *string `json:"table,omitempty"` + File *string `json:"file,omitempty"` +} + +// ListAccountSasResponse is the List SAS credentials operation response. +type ListAccountSasResponse struct { + autorest.Response `json:"-"` + AccountSasToken *string `json:"accountSasToken,omitempty"` +} + +// ListServiceSasResponse is the List service SAS credentials operation +// response. +type ListServiceSasResponse struct { + autorest.Response `json:"-"` + ServiceSasToken *string `json:"serviceSasToken,omitempty"` +} + +// Resource is describes a storage resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ServiceSasParameters is the parameters to list service SAS credentials of a +// speicific resource. +type ServiceSasParameters struct { + CanonicalizedResource *string `json:"canonicalizedResource,omitempty"` + Resource Resource `json:"signedResource,omitempty"` + Permissions Permissions `json:"signedPermission,omitempty"` + IPAddressOrRange *string `json:"signedIp,omitempty"` + Protocols HTTPProtocol `json:"signedProtocol,omitempty"` + SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` + SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` + Identifier *string `json:"signedIdentifier,omitempty"` + PartitionKeyStart *string `json:"startPk,omitempty"` + PartitionKeyEnd *string `json:"endPk,omitempty"` + RowKeyStart *string `json:"startRk,omitempty"` + RowKeyEnd *string `json:"endRk,omitempty"` + KeyToSign *string `json:"keyToSign,omitempty"` + CacheControl *string `json:"rscc,omitempty"` + ContentDisposition *string `json:"rscd,omitempty"` + ContentEncoding *string `json:"rsce,omitempty"` + ContentLanguage *string `json:"rscl,omitempty"` + ContentType *string `json:"rsct,omitempty"` +} + +// Sku is the SKU of the storage account. +type Sku struct { + Name SkuName `json:"name,omitempty"` + Tier SkuTier `json:"tier,omitempty"` +} + +// Usage is describes Storage Resource Usage. +type Usage struct { + Unit UsageUnit `json:"unit,omitempty"` + CurrentValue *int32 `json:"currentValue,omitempty"` + Limit *int32 `json:"limit,omitempty"` + Name *UsageName `json:"name,omitempty"` +} + +// UsageListResult is the response from the List Usages operation. +type UsageListResult struct { + autorest.Response `json:"-"` + Value *[]Usage `json:"value,omitempty"` +} + +// UsageName is the usage names that can be used; currently limited to +// StorageAccount. +type UsageName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usage.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usage.go index 1bad411e36..b12a6d315f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usage.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usage.go @@ -1,102 +1,102 @@ -package storage - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// UsageClient is the the Azure Storage Management API. -type UsageClient struct { - ManagementClient -} - -// NewUsageClient creates an instance of the UsageClient client. -func NewUsageClient(subscriptionID string) UsageClient { - return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUsageClientWithBaseURI creates an instance of the UsageClient client. -func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { - return UsageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets the current usage count and the limit for the resources under the -// subscription. -func (client UsageClient) List() (result UsageListResult, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client UsageClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsageClient) ListResponder(resp *http.Response) (result UsageListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package storage + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// UsageClient is the the Azure Storage Management API. +type UsageClient struct { + ManagementClient +} + +// NewUsageClient creates an instance of the UsageClient client. +func NewUsageClient(subscriptionID string) UsageClient { + return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsageClientWithBaseURI creates an instance of the UsageClient client. +func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient { + return UsageClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the current usage count and the limit for the resources under the +// subscription. +func (client UsageClient) List() (result UsageListResult, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.UsageClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsageClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsageClient) ListResponder(resp *http.Response) (result UsageListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go index 870a1d5897..ac97c159fa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go @@ -1,29 +1,29 @@ -package storage - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-storage/2016-12-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package storage + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-storage/2016-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/client.go index fd41aa700f..b5de7c2e65 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/client.go @@ -1,244 +1,244 @@ -// Package storageimportexport implements the Azure ARM Storageimportexport -// service API version 2016-11-01. -// -// The Microsoft Azure Storage Import/Export Resource Provider API. -package storageimportexport - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Storageimportexport - DefaultBaseURI = "https://management.azure.com" - // DefaultAcceptLanguage is the default value for accept language - DefaultAcceptLanguage = "en-us" -) - -// ManagementClient is the base client for Storageimportexport. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string - AcceptLanguage string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - AcceptLanguage: DefaultAcceptLanguage, - } -} - -// GetLocation gets a location to which you can ship the disks associated with -// an import or export job. A location is an Azure region. -// -// locationName is the name of the location. For example, 'West US' or -// 'westus'. -func (client ManagementClient) GetLocation(locationName string) (result Location, err error) { - req, err := client.GetLocationPreparer(locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "GetLocation", nil, "Failure preparing request") - return - } - - resp, err := client.GetLocationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "GetLocation", resp, "Failure sending request") - return - } - - result, err = client.GetLocationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "GetLocation", resp, "Failure responding to request") - } - - return -} - -// GetLocationPreparer prepares the GetLocation request. -func (client ManagementClient) GetLocationPreparer(locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.ImportExport/locations/{locationName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// GetLocationSender sends the GetLocation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetLocationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetLocationResponder handles the response to the GetLocation request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetLocationResponder(resp *http.Response) (result Location, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListLocations returns a list of locations to which you can ship the disks -// associated with an import or export job. A location is a Microsoft data -// center region. -func (client ManagementClient) ListLocations() (result LocationsListResult, err error) { - req, err := client.ListLocationsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListLocations", nil, "Failure preparing request") - return - } - - resp, err := client.ListLocationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListLocations", resp, "Failure sending request") - return - } - - result, err = client.ListLocationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListLocations", resp, "Failure responding to request") - } - - return -} - -// ListLocationsPreparer prepares the ListLocations request. -func (client ManagementClient) ListLocationsPreparer() (*http.Request, error) { - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ImportExport/locations"), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// ListLocationsSender sends the ListLocations request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListLocationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListLocationsResponder handles the response to the ListLocations request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListLocationsResponder(resp *http.Response) (result LocationsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSupportedOperations returns the list of operations supported by the -// import/export resource provider. -func (client ManagementClient) ListSupportedOperations() (result SupportedOperationsListResult, err error) { - req, err := client.ListSupportedOperationsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListSupportedOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListSupportedOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListSupportedOperations", resp, "Failure sending request") - return - } - - result, err = client.ListSupportedOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListSupportedOperations", resp, "Failure responding to request") - } - - return -} - -// ListSupportedOperationsPreparer prepares the ListSupportedOperations request. -func (client ManagementClient) ListSupportedOperationsPreparer() (*http.Request, error) { - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ImportExport/operations"), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// ListSupportedOperationsSender sends the ListSupportedOperations request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListSupportedOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSupportedOperationsResponder handles the response to the ListSupportedOperations request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListSupportedOperationsResponder(resp *http.Response) (result SupportedOperationsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +// Package storageimportexport implements the Azure ARM Storageimportexport +// service API version 2016-11-01. +// +// The Microsoft Azure Storage Import/Export Resource Provider API. +package storageimportexport + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Storageimportexport + DefaultBaseURI = "https://management.azure.com" + // DefaultAcceptLanguage is the default value for accept language + DefaultAcceptLanguage = "en-us" +) + +// ManagementClient is the base client for Storageimportexport. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string + AcceptLanguage string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + AcceptLanguage: DefaultAcceptLanguage, + } +} + +// GetLocation gets a location to which you can ship the disks associated with +// an import or export job. A location is an Azure region. +// +// locationName is the name of the location. For example, 'West US' or +// 'westus'. +func (client ManagementClient) GetLocation(locationName string) (result Location, err error) { + req, err := client.GetLocationPreparer(locationName) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "GetLocation", nil, "Failure preparing request") + return + } + + resp, err := client.GetLocationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "GetLocation", resp, "Failure sending request") + return + } + + result, err = client.GetLocationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "GetLocation", resp, "Failure responding to request") + } + + return +} + +// GetLocationPreparer prepares the GetLocation request. +func (client ManagementClient) GetLocationPreparer(locationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ImportExport/locations/{locationName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// GetLocationSender sends the GetLocation request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetLocationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetLocationResponder handles the response to the GetLocation request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetLocationResponder(resp *http.Response) (result Location, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListLocations returns a list of locations to which you can ship the disks +// associated with an import or export job. A location is a Microsoft data +// center region. +func (client ManagementClient) ListLocations() (result LocationsListResult, err error) { + req, err := client.ListLocationsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListLocations", nil, "Failure preparing request") + return + } + + resp, err := client.ListLocationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListLocations", resp, "Failure sending request") + return + } + + result, err = client.ListLocationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListLocations", resp, "Failure responding to request") + } + + return +} + +// ListLocationsPreparer prepares the ListLocations request. +func (client ManagementClient) ListLocationsPreparer() (*http.Request, error) { + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ImportExport/locations"), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// ListLocationsSender sends the ListLocations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListLocationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListLocationsResponder handles the response to the ListLocations request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListLocationsResponder(resp *http.Response) (result LocationsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSupportedOperations returns the list of operations supported by the +// import/export resource provider. +func (client ManagementClient) ListSupportedOperations() (result SupportedOperationsListResult, err error) { + req, err := client.ListSupportedOperationsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListSupportedOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListSupportedOperations", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.ManagementClient", "ListSupportedOperations", resp, "Failure responding to request") + } + + return +} + +// ListSupportedOperationsPreparer prepares the ListSupportedOperations request. +func (client ManagementClient) ListSupportedOperationsPreparer() (*http.Request, error) { + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ImportExport/operations"), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// ListSupportedOperationsSender sends the ListSupportedOperations request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListSupportedOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSupportedOperationsResponder handles the response to the ListSupportedOperations request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListSupportedOperationsResponder(resp *http.Response) (result SupportedOperationsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/jobs.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/jobs.go index 2ca7d73b47..a7a8450334 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/jobs.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/jobs.go @@ -1,737 +1,737 @@ -package storageimportexport - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// JobsClient is the the Microsoft Azure Storage Import/Export Resource -// Provider API. -type JobsClient struct { - ManagementClient -} - -// NewJobsClient creates an instance of the JobsClient client. -func NewJobsClient(subscriptionID string) JobsClient { - return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobsClientWithBaseURI creates an instance of the JobsClient client. -func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { - return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new import/export job or updates an existing -// import/export job in the specified subscription. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. jobName is the name of the -// import/export job. jobProperties is properties of the import/export job that -// need to be specified during creation. -func (client JobsClient) CreateOrUpdate(resourceGroupName string, jobName string, jobProperties Job) (result Job, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: jobProperties, - Constraints: []validation.Constraint{{Target: "jobProperties.JobProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ReturnAddress.RecipientName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress.StreetAddress1", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress.City", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress.CountryOrRegion", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress.Phone", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnAddress.Email", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "jobProperties.JobProperties.ReturnShipping", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ReturnShipping.CarrierName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnShipping.CarrierAccountNumber", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "jobProperties.JobProperties.ShippingInformation", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ShippingInformation.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ShippingInformation.Address", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "jobProperties.JobProperties.DeliveryPackage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.DeliveryPackage.CarrierName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.DeliveryPackage.TrackingNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.DeliveryPackage.DriveCount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.DeliveryPackage.ShipDate", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "jobProperties.JobProperties.ReturnPackage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ReturnPackage.CarrierName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnPackage.TrackingNumber", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnPackage.DriveCount", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.ReturnPackage.ShipDate", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "jobProperties.JobProperties.DiagnosticsPath", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "jobProperties.JobProperties.DriveList", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.DriveList", Name: validation.MaxItems, Rule: 10, Chain: nil}, - {Target: "jobProperties.JobProperties.DriveList", Name: validation.MinItems, Rule: 0, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobName, jobProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client JobsClient) CreateOrUpdatePreparer(resourceGroupName string, jobName string, jobProperties Job) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), - autorest.WithJSON(jobProperties), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client JobsClient) CreateOrUpdateResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing import/export job. Only import/export jobs in the -// Creating or Completed states can be deleted. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. jobName is the name of the -// import/export job. -func (client JobsClient) Delete(resourceGroupName string, jobName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client JobsClient) DeletePreparer(resourceGroupName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client JobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about an existing import/export job. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. jobName is the name of the -// import/export job. -func (client JobsClient) Get(resourceGroupName string, jobName string) (result Job, err error) { - req, err := client.GetPreparer(resourceGroupName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobsClient) GetPreparer(resourceGroupName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobsClient) GetResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the active and completed import/export jobs in a subscription. -// -// top is an integer value that specifies how many jobs at most should be -// returned. The value cannot exceed 100. filter is can be used to restrict the -// results to certain conditions. The following possible values can be used -// with $filter: 1) $filter=type eq '{type}'; 2) $filter=trackingnumber eq -// '{trackingnumber}'; 3) $filter=state eq '{state}'; 4) Logical and -// combination of the above, for example: $filter=type eq 'Import' and state eq -// 'Transferring'. Valid values for type are Import and Export. Valid values -// for state are Creating, Shipping, Received, Transferring, Packaging, Closed, -// and Completed. -func (client JobsClient) List(top *int32, filter string) (result JobListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "List") - } - - req, err := client.ListPreparer(top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client JobsClient) ListPreparer(top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client JobsClient) ListResponder(resp *http.Response) (result JobListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobListResult, err error) { - req, err := lastResults.JobListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListBitLockerKeys lists the BitLocker keys for all drives in the specified -// import/export job. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. jobName is the name of the -// import/export job. -func (client JobsClient) ListBitLockerKeys(resourceGroupName string, jobName string) (result BitLockerKeysListResult, err error) { - req, err := client.ListBitLockerKeysPreparer(resourceGroupName, jobName) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListBitLockerKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListBitLockerKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListBitLockerKeys", resp, "Failure sending request") - return - } - - result, err = client.ListBitLockerKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListBitLockerKeys", resp, "Failure responding to request") - } - - return -} - -// ListBitLockerKeysPreparer prepares the ListBitLockerKeys request. -func (client JobsClient) ListBitLockerKeysPreparer(resourceGroupName string, jobName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// ListBitLockerKeysSender sends the ListBitLockerKeys request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListBitLockerKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBitLockerKeysResponder handles the response to the ListBitLockerKeys request. The method always -// closes the http.Response Body. -func (client JobsClient) ListBitLockerKeysResponder(resp *http.Response) (result BitLockerKeysListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup returns all active and completed import/export jobs in a -// resource group. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. top is an integer value that -// specifies how many jobs at most should be returned. The value cannot exceed -// 100. filter is can be used to restrict the results to certain conditions. -// The following possible values can be used with $filter: 1) $filter=type eq -// '{type}'; 2) $filter=trackingnumber eq '{trackingnumber}'; 3) $filter=state -// eq '{state}'; 4) Logical and combination of the above, for example: -// $filter=type eq 'Import' and state eq 'Transferring'. Valid values for type -// are Import and Export. Valid values for state are Creating, Shipping, -// Received, Transferring, Packaging, Closed, and Completed. -func (client JobsClient) ListByResourceGroup(resourceGroupName string, top *int32, filter string) (result JobListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client JobsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs", pathParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client JobsClient) ListByResourceGroupResponder(resp *http.Response) (result JobListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client JobsClient) ListByResourceGroupNextResults(lastResults JobListResult) (result JobListResult, err error) { - req, err := lastResults.JobListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Move moves the specified import/export jobs from the resource group to a -// target resource group. The target resource group may be in a different -// subscription. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. moveJobsParameters is -// parameters to be provided to move a job from one resource group to another. -func (client JobsClient) Move(resourceGroupName string, moveJobsParameters MoveJobParameters) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: moveJobsParameters, - Constraints: []validation.Constraint{{Target: "moveJobsParameters.TargetResourceGroup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "moveJobsParameters.Resources", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "Move") - } - - req, err := client.MovePreparer(resourceGroupName, moveJobsParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Move", nil, "Failure preparing request") - return - } - - resp, err := client.MoveSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Move", resp, "Failure sending request") - return - } - - result, err = client.MoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Move", resp, "Failure responding to request") - } - - return -} - -// MovePreparer prepares the Move request. -func (client JobsClient) MovePreparer(resourceGroupName string, moveJobsParameters MoveJobParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/moveResources", pathParameters), - autorest.WithJSON(moveJobsParameters), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// MoveSender sends the Move request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) MoveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MoveResponder handles the response to the Move request. The method always -// closes the http.Response Body. -func (client JobsClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates specific properties of the import/export job. You can call -// this operation to notify the Import/Export service that the hard drives -// comprising the import or export job have been shipped to the Microsoft data -// center. It can also be used to cancel an existing job. -// -// resourceGroupName is the resource group name uniquely identifies the -// resource group within the user subscription. jobName is the name of the -// import/export job. jobProperties is import/export job properties that need -// to be updated. -func (client JobsClient) Update(resourceGroupName string, jobName string, jobProperties MutableJob) (result Job, err error) { - req, err := client.UpdatePreparer(resourceGroupName, jobName, jobProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client JobsClient) UpdatePreparer(resourceGroupName string, jobName string, jobProperties MutableJob) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobName": autorest.Encode("path", jobName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), - autorest.WithJSON(jobProperties), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Accept-Language", client.AcceptLanguage)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client JobsClient) UpdateResponder(resp *http.Response) (result Job, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package storageimportexport + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// JobsClient is the the Microsoft Azure Storage Import/Export Resource +// Provider API. +type JobsClient struct { + ManagementClient +} + +// NewJobsClient creates an instance of the JobsClient client. +func NewJobsClient(subscriptionID string) JobsClient { + return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobsClientWithBaseURI creates an instance of the JobsClient client. +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new import/export job or updates an existing +// import/export job in the specified subscription. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. jobName is the name of the +// import/export job. jobProperties is properties of the import/export job that +// need to be specified during creation. +func (client JobsClient) CreateOrUpdate(resourceGroupName string, jobName string, jobProperties Job) (result Job, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: jobProperties, + Constraints: []validation.Constraint{{Target: "jobProperties.JobProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.StorageAccountID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ReturnAddress.RecipientName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress.StreetAddress1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress.CountryOrRegion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress.Phone", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnAddress.Email", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobProperties.JobProperties.ReturnShipping", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ReturnShipping.CarrierName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnShipping.CarrierAccountNumber", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobProperties.JobProperties.ShippingInformation", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ShippingInformation.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ShippingInformation.Address", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobProperties.JobProperties.DeliveryPackage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.DeliveryPackage.CarrierName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.DeliveryPackage.TrackingNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.DeliveryPackage.DriveCount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.DeliveryPackage.ShipDate", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobProperties.JobProperties.ReturnPackage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.ReturnPackage.CarrierName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnPackage.TrackingNumber", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnPackage.DriveCount", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.ReturnPackage.ShipDate", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "jobProperties.JobProperties.DiagnosticsPath", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobProperties.JobProperties.DriveList", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "jobProperties.JobProperties.DriveList", Name: validation.MaxItems, Rule: 10, Chain: nil}, + {Target: "jobProperties.JobProperties.DriveList", Name: validation.MinItems, Rule: 0, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobName, jobProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client JobsClient) CreateOrUpdatePreparer(resourceGroupName string, jobName string, jobProperties Job) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), + autorest.WithJSON(jobProperties), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client JobsClient) CreateOrUpdateResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an existing import/export job. Only import/export jobs in the +// Creating or Completed states can be deleted. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. jobName is the name of the +// import/export job. +func (client JobsClient) Delete(resourceGroupName string, jobName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobsClient) DeletePreparer(resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about an existing import/export job. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. jobName is the name of the +// import/export job. +func (client JobsClient) Get(resourceGroupName string, jobName string) (result Job, err error) { + req, err := client.GetPreparer(resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobsClient) GetPreparer(resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobsClient) GetResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the active and completed import/export jobs in a subscription. +// +// top is an integer value that specifies how many jobs at most should be +// returned. The value cannot exceed 100. filter is can be used to restrict the +// results to certain conditions. The following possible values can be used +// with $filter: 1) $filter=type eq '{type}'; 2) $filter=trackingnumber eq +// '{trackingnumber}'; 3) $filter=state eq '{state}'; 4) Logical and +// combination of the above, for example: $filter=type eq 'Import' and state eq +// 'Transferring'. Valid values for type are Import and Export. Valid values +// for state are Creating, Shipping, Received, Transferring, Packaging, Closed, +// and Completed. +func (client JobsClient) List(top *int32, filter string) (result JobListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "List") + } + + req, err := client.ListPreparer(top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client JobsClient) ListPreparer(top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client JobsClient) ListResponder(resp *http.Response) (result JobListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobListResult, err error) { + req, err := lastResults.JobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListBitLockerKeys lists the BitLocker keys for all drives in the specified +// import/export job. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. jobName is the name of the +// import/export job. +func (client JobsClient) ListBitLockerKeys(resourceGroupName string, jobName string) (result BitLockerKeysListResult, err error) { + req, err := client.ListBitLockerKeysPreparer(resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListBitLockerKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListBitLockerKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListBitLockerKeys", resp, "Failure sending request") + return + } + + result, err = client.ListBitLockerKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListBitLockerKeys", resp, "Failure responding to request") + } + + return +} + +// ListBitLockerKeysPreparer prepares the ListBitLockerKeys request. +func (client JobsClient) ListBitLockerKeysPreparer(resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// ListBitLockerKeysSender sends the ListBitLockerKeys request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListBitLockerKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBitLockerKeysResponder handles the response to the ListBitLockerKeys request. The method always +// closes the http.Response Body. +func (client JobsClient) ListBitLockerKeysResponder(resp *http.Response) (result BitLockerKeysListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup returns all active and completed import/export jobs in a +// resource group. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. top is an integer value that +// specifies how many jobs at most should be returned. The value cannot exceed +// 100. filter is can be used to restrict the results to certain conditions. +// The following possible values can be used with $filter: 1) $filter=type eq +// '{type}'; 2) $filter=trackingnumber eq '{trackingnumber}'; 3) $filter=state +// eq '{state}'; 4) Logical and combination of the above, for example: +// $filter=type eq 'Import' and state eq 'Transferring'. Valid values for type +// are Import and Export. Valid values for state are Creating, Shipping, +// Received, Transferring, Packaging, Closed, and Completed. +func (client JobsClient) ListByResourceGroup(resourceGroupName string, top *int32, filter string) (result JobListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName, top, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client JobsClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client JobsClient) ListByResourceGroupResponder(resp *http.Response) (result JobListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client JobsClient) ListByResourceGroupNextResults(lastResults JobListResult) (result JobListResult, err error) { + req, err := lastResults.JobListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Move moves the specified import/export jobs from the resource group to a +// target resource group. The target resource group may be in a different +// subscription. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. moveJobsParameters is +// parameters to be provided to move a job from one resource group to another. +func (client JobsClient) Move(resourceGroupName string, moveJobsParameters MoveJobParameters) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: moveJobsParameters, + Constraints: []validation.Constraint{{Target: "moveJobsParameters.TargetResourceGroup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "moveJobsParameters.Resources", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "storageimportexport.JobsClient", "Move") + } + + req, err := client.MovePreparer(resourceGroupName, moveJobsParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Move", nil, "Failure preparing request") + return + } + + resp, err := client.MoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Move", resp, "Failure sending request") + return + } + + result, err = client.MoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Move", resp, "Failure responding to request") + } + + return +} + +// MovePreparer prepares the Move request. +func (client JobsClient) MovePreparer(resourceGroupName string, moveJobsParameters MoveJobParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/moveResources", pathParameters), + autorest.WithJSON(moveJobsParameters), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// MoveSender sends the Move request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) MoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MoveResponder handles the response to the Move request. The method always +// closes the http.Response Body. +func (client JobsClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates specific properties of the import/export job. You can call +// this operation to notify the Import/Export service that the hard drives +// comprising the import or export job have been shipped to the Microsoft data +// center. It can also be used to cancel an existing job. +// +// resourceGroupName is the resource group name uniquely identifies the +// resource group within the user subscription. jobName is the name of the +// import/export job. jobProperties is import/export job properties that need +// to be updated. +func (client JobsClient) Update(resourceGroupName string, jobName string, jobProperties MutableJob) (result Job, err error) { + req, err := client.UpdatePreparer(resourceGroupName, jobName, jobProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storageimportexport.JobsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client JobsClient) UpdatePreparer(resourceGroupName string, jobName string, jobProperties MutableJob) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}", pathParameters), + autorest.WithJSON(jobProperties), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Accept-Language", client.AcceptLanguage)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client JobsClient) UpdateResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/models.go index fadb1ac107..6df5d0ed18 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/models.go @@ -1,331 +1,331 @@ -package storageimportexport - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// DriveState enumerates the values for drive state. -type DriveState string - -const ( - // Completed specifies the completed state for drive state. - Completed DriveState = "Completed" - // CompletedMoreInfo specifies the completed more info state for drive - // state. - CompletedMoreInfo DriveState = "CompletedMoreInfo" - // NeverReceived specifies the never received state for drive state. - NeverReceived DriveState = "NeverReceived" - // Received specifies the received state for drive state. - Received DriveState = "Received" - // ShippedBack specifies the shipped back state for drive state. - ShippedBack DriveState = "ShippedBack" - // Specified specifies the specified state for drive state. - Specified DriveState = "Specified" - // Transferring specifies the transferring state for drive state. - Transferring DriveState = "Transferring" -) - -// JobState enumerates the values for job state. -type JobState string - -const ( - // JobStateClosed specifies the job state closed state for job state. - JobStateClosed JobState = "Closed" - // JobStateCompleted specifies the job state completed state for job state. - JobStateCompleted JobState = "Completed" - // JobStateCreating specifies the job state creating state for job state. - JobStateCreating JobState = "Creating" - // JobStatePackaging specifies the job state packaging state for job state. - JobStatePackaging JobState = "Packaging" - // JobStateReceived specifies the job state received state for job state. - JobStateReceived JobState = "Received" - // JobStateShipping specifies the job state shipping state for job state. - JobStateShipping JobState = "Shipping" - // JobStateTransferring specifies the job state transferring state for job - // state. - JobStateTransferring JobState = "Transferring" -) - -// JobType enumerates the values for job type. -type JobType string - -const ( - // JobTypeExport specifies the job type export state for job type. - JobTypeExport JobType = "Export" - // JobTypeImport specifies the job type import state for job type. - JobTypeImport JobType = "Import" -) - -// LogLevel enumerates the values for log level. -type LogLevel string - -const ( - // Error specifies the error state for log level. - Error LogLevel = "Error" - // Verbose specifies the verbose state for log level. - Verbose LogLevel = "Verbose" -) - -// MutableJobState enumerates the values for mutable job state. -type MutableJobState string - -const ( - // Shipping specifies the shipping state for mutable job state. - Shipping MutableJobState = "Shipping" -) - -// BitLockerKeysListResult is list of BitLocker keys for the specified -// import/export job. -type BitLockerKeysListResult struct { - autorest.Response `json:"-"` - Value *[]DriveStatus `json:"value,omitempty"` -} - -// Drive is provides information about the drive that contains information -// about the import/export jobs. -type Drive struct { - DriveID *string `json:"driveId,omitempty"` - BitLockerKey *string `json:"bitLockerKey,omitempty"` - ManifestFile *string `json:"manifestFile,omitempty"` - ManifestHash *string `json:"manifestHash,omitempty"` -} - -// DriveStatus is provides information about the drive's status. -type DriveStatus struct { - DriveID *string `json:"driveId,omitempty"` - BitLockerKey *string `json:"bitLockerKey,omitempty"` - ManifestFile *string `json:"manifestFile,omitempty"` - ManifestHash *string `json:"manifestHash,omitempty"` - State DriveState `json:"state,omitempty"` - CopyStatus *string `json:"copyStatus,omitempty"` - PercentComplete *int32 `json:"percentComplete,omitempty"` - VerboseLogURI *string `json:"verboseLogUri,omitempty"` - ErrorLogURI *string `json:"errorLogUri,omitempty"` - ManifestURI *string `json:"manifestUri,omitempty"` -} - -// ErrorBase is describes the common properties of the Error object -type ErrorBase struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` -} - -// ErrorInfo is describes the error information. -type ErrorInfo struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Target *string `json:"target,omitempty"` - Details *[]ErrorBase `json:"details,omitempty"` -} - -// ErrorResponse is describes the model for Error Response. -type ErrorResponse struct { - Error *ErrorInfo `json:"error,omitempty"` -} - -// Export is a property containing information about the blobs to be exported -// for an export job. This property is required for export jobs, but must not -// be specified for import jobs. -type Export struct { - *ExportBlobList `json:"blobList,omitempty"` - BlobListblobPath *string `json:"blobListblobPath,omitempty"` -} - -// ExportBlobList is a list of the blobs to be exported. -type ExportBlobList struct { - BlobPath *[]string `json:"blobPath,omitempty"` - BlobPathPrefix *[]string `json:"blobPathPrefix,omitempty"` -} - -// Job is describes an import/export job. -type Job struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]interface{} `json:"tags,omitempty"` - *JobProperties `json:"properties,omitempty"` -} - -// JobListResult is list of import/export jobs. -type JobListResult struct { - autorest.Response `json:"-"` - NextLink *string `json:"nextLink,omitempty"` - Value *[]Job `json:"value,omitempty"` -} - -// JobListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client JobListResult) JobListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// JobProperties is import/export job specific properties. -type JobProperties struct { - StorageAccountID *string `json:"storageAccountId,omitempty"` - ContainerSas *string `json:"containerSas,omitempty"` - JobType JobType `json:"jobType,omitempty"` - ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"` - ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"` - ShippingInformation *ShippingInformation `json:"shippingInformation,omitempty"` - DeliveryPackage *PackageInfomation `json:"deliveryPackage,omitempty"` - ReturnPackage *PackageInfomation `json:"returnPackage,omitempty"` - DiagnosticsPath *string `json:"diagnosticsPath,omitempty"` - LogLevel LogLevel `json:"logLevel,omitempty"` - BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"` - State JobState `json:"state,omitempty"` - CancelRequested *bool `json:"cancelRequested,omitempty"` - PercentComplete *int32 `json:"percentComplete,omitempty"` - IncompleteBlobListURI *string `json:"incompleteBlobListUri,omitempty"` - DriveList *[]DriveStatus `json:"driveList,omitempty"` - Export *Export `json:"export,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// Location is provides information about an Azure data center location. -type Location struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *LocationProperties `json:"properties,omitempty"` -} - -// LocationProperties is describes the properties of a location. -type LocationProperties struct { - RecipientName *string `json:"recipientName,omitempty"` - StreetAddress1 *string `json:"streetAddress1,omitempty"` - StreetAddress2 *string `json:"streetAddress2,omitempty"` - City *string `json:"city,omitempty"` - StateOrProvince *string `json:"stateOrProvince,omitempty"` - PostalCode *string `json:"postalCode,omitempty"` - CountryOrRegion *string `json:"countryOrRegion,omitempty"` - Phone *string `json:"phone,omitempty"` - SupportedCarriers *[]string `json:"supportedCarriers,omitempty"` - AlternateLocations *[]string `json:"alternateLocations,omitempty"` -} - -// LocationsListResult is list of locations. -type LocationsListResult struct { - autorest.Response `json:"-"` - Value *[]Location `json:"value,omitempty"` -} - -// MoveJobParameters is defines the parameters that need to be provided for -// moving an import/export job from one reesource group to another. -type MoveJobParameters struct { - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` - Resources *[]string `json:"resources,omitempty"` -} - -// MutableJob is describes the updatable properties of the job -type MutableJob struct { - Tags *map[string]interface{} `json:"tags,omitempty"` - *MutableJobProperties `json:"properties,omitempty"` -} - -// MutableJobProperties is properties of the job that can be updated. -type MutableJobProperties struct { - CancelRequested *bool `json:"cancelRequested,omitempty"` - State MutableJobState `json:"state,omitempty"` - ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"` - ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"` - DeliveryPackage *PackageInfomation `json:"deliveryPackage,omitempty"` - LogLevel *string `json:"logLevel,omitempty"` - BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"` -} - -// Operation is describes a supported operation by the Storage Import/Export -// job API. -type Operation struct { - Name *string `json:"name,omitempty"` - *OperationDisplayInformation `json:"display,omitempty"` -} - -// OperationDisplayInformation is display information about the operation. -type OperationDisplayInformation struct { - Provider *string `json:"provider,omitempty"` - Resource *string `json:"resource,omitempty"` - Operation *string `json:"operation,omitempty"` - Description *string `json:"description,omitempty"` -} - -// PackageInfomation is provides information about the package being shipped by -// the customer to the Microsoft data center. -type PackageInfomation struct { - CarrierName *string `json:"carrierName,omitempty"` - TrackingNumber *string `json:"trackingNumber,omitempty"` - DriveCount *int32 `json:"driveCount,omitempty"` - ShipDate *string `json:"shipDate,omitempty"` -} - -// Resource is the Resource model definition. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]interface{} `json:"tags,omitempty"` -} - -// ReturnAddress is specifies the return address information for the job. -type ReturnAddress struct { - RecipientName *string `json:"recipientName,omitempty"` - StreetAddress1 *string `json:"streetAddress1,omitempty"` - StreetAddress2 *string `json:"streetAddress2,omitempty"` - City *string `json:"city,omitempty"` - StateOrProvince *string `json:"stateOrProvince,omitempty"` - PostalCode *string `json:"postalCode,omitempty"` - CountryOrRegion *string `json:"countryOrRegion,omitempty"` - Phone *string `json:"phone,omitempty"` - Email *string `json:"email,omitempty"` -} - -// ReturnShipping is specifies the return carrier and customer's account with -// the carrier. -type ReturnShipping struct { - CarrierName *string `json:"carrierName,omitempty"` - CarrierAccountNumber *string `json:"carrierAccountNumber,omitempty"` -} - -// ShippingInformation is provides information about the Microsoft datacenter -// to which the drives should be shipped. -type ShippingInformation struct { - Name *string `json:"name,omitempty"` - Address *string `json:"address,omitempty"` -} - -// SupportedOperationsListResult is list of supported operations by the -// import/export resource provider. -type SupportedOperationsListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` -} +package storageimportexport + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// DriveState enumerates the values for drive state. +type DriveState string + +const ( + // Completed specifies the completed state for drive state. + Completed DriveState = "Completed" + // CompletedMoreInfo specifies the completed more info state for drive + // state. + CompletedMoreInfo DriveState = "CompletedMoreInfo" + // NeverReceived specifies the never received state for drive state. + NeverReceived DriveState = "NeverReceived" + // Received specifies the received state for drive state. + Received DriveState = "Received" + // ShippedBack specifies the shipped back state for drive state. + ShippedBack DriveState = "ShippedBack" + // Specified specifies the specified state for drive state. + Specified DriveState = "Specified" + // Transferring specifies the transferring state for drive state. + Transferring DriveState = "Transferring" +) + +// JobState enumerates the values for job state. +type JobState string + +const ( + // JobStateClosed specifies the job state closed state for job state. + JobStateClosed JobState = "Closed" + // JobStateCompleted specifies the job state completed state for job state. + JobStateCompleted JobState = "Completed" + // JobStateCreating specifies the job state creating state for job state. + JobStateCreating JobState = "Creating" + // JobStatePackaging specifies the job state packaging state for job state. + JobStatePackaging JobState = "Packaging" + // JobStateReceived specifies the job state received state for job state. + JobStateReceived JobState = "Received" + // JobStateShipping specifies the job state shipping state for job state. + JobStateShipping JobState = "Shipping" + // JobStateTransferring specifies the job state transferring state for job + // state. + JobStateTransferring JobState = "Transferring" +) + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeExport specifies the job type export state for job type. + JobTypeExport JobType = "Export" + // JobTypeImport specifies the job type import state for job type. + JobTypeImport JobType = "Import" +) + +// LogLevel enumerates the values for log level. +type LogLevel string + +const ( + // Error specifies the error state for log level. + Error LogLevel = "Error" + // Verbose specifies the verbose state for log level. + Verbose LogLevel = "Verbose" +) + +// MutableJobState enumerates the values for mutable job state. +type MutableJobState string + +const ( + // Shipping specifies the shipping state for mutable job state. + Shipping MutableJobState = "Shipping" +) + +// BitLockerKeysListResult is list of BitLocker keys for the specified +// import/export job. +type BitLockerKeysListResult struct { + autorest.Response `json:"-"` + Value *[]DriveStatus `json:"value,omitempty"` +} + +// Drive is provides information about the drive that contains information +// about the import/export jobs. +type Drive struct { + DriveID *string `json:"driveId,omitempty"` + BitLockerKey *string `json:"bitLockerKey,omitempty"` + ManifestFile *string `json:"manifestFile,omitempty"` + ManifestHash *string `json:"manifestHash,omitempty"` +} + +// DriveStatus is provides information about the drive's status. +type DriveStatus struct { + DriveID *string `json:"driveId,omitempty"` + BitLockerKey *string `json:"bitLockerKey,omitempty"` + ManifestFile *string `json:"manifestFile,omitempty"` + ManifestHash *string `json:"manifestHash,omitempty"` + State DriveState `json:"state,omitempty"` + CopyStatus *string `json:"copyStatus,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + VerboseLogURI *string `json:"verboseLogUri,omitempty"` + ErrorLogURI *string `json:"errorLogUri,omitempty"` + ManifestURI *string `json:"manifestUri,omitempty"` +} + +// ErrorBase is describes the common properties of the Error object +type ErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} + +// ErrorInfo is describes the error information. +type ErrorInfo struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + Details *[]ErrorBase `json:"details,omitempty"` +} + +// ErrorResponse is describes the model for Error Response. +type ErrorResponse struct { + Error *ErrorInfo `json:"error,omitempty"` +} + +// Export is a property containing information about the blobs to be exported +// for an export job. This property is required for export jobs, but must not +// be specified for import jobs. +type Export struct { + *ExportBlobList `json:"blobList,omitempty"` + BlobListblobPath *string `json:"blobListblobPath,omitempty"` +} + +// ExportBlobList is a list of the blobs to be exported. +type ExportBlobList struct { + BlobPath *[]string `json:"blobPath,omitempty"` + BlobPathPrefix *[]string `json:"blobPathPrefix,omitempty"` +} + +// Job is describes an import/export job. +type Job struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]interface{} `json:"tags,omitempty"` + *JobProperties `json:"properties,omitempty"` +} + +// JobListResult is list of import/export jobs. +type JobListResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + Value *[]Job `json:"value,omitempty"` +} + +// JobListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client JobListResult) JobListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// JobProperties is import/export job specific properties. +type JobProperties struct { + StorageAccountID *string `json:"storageAccountId,omitempty"` + ContainerSas *string `json:"containerSas,omitempty"` + JobType JobType `json:"jobType,omitempty"` + ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"` + ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"` + ShippingInformation *ShippingInformation `json:"shippingInformation,omitempty"` + DeliveryPackage *PackageInfomation `json:"deliveryPackage,omitempty"` + ReturnPackage *PackageInfomation `json:"returnPackage,omitempty"` + DiagnosticsPath *string `json:"diagnosticsPath,omitempty"` + LogLevel LogLevel `json:"logLevel,omitempty"` + BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"` + State JobState `json:"state,omitempty"` + CancelRequested *bool `json:"cancelRequested,omitempty"` + PercentComplete *int32 `json:"percentComplete,omitempty"` + IncompleteBlobListURI *string `json:"incompleteBlobListUri,omitempty"` + DriveList *[]DriveStatus `json:"driveList,omitempty"` + Export *Export `json:"export,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// Location is provides information about an Azure data center location. +type Location struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *LocationProperties `json:"properties,omitempty"` +} + +// LocationProperties is describes the properties of a location. +type LocationProperties struct { + RecipientName *string `json:"recipientName,omitempty"` + StreetAddress1 *string `json:"streetAddress1,omitempty"` + StreetAddress2 *string `json:"streetAddress2,omitempty"` + City *string `json:"city,omitempty"` + StateOrProvince *string `json:"stateOrProvince,omitempty"` + PostalCode *string `json:"postalCode,omitempty"` + CountryOrRegion *string `json:"countryOrRegion,omitempty"` + Phone *string `json:"phone,omitempty"` + SupportedCarriers *[]string `json:"supportedCarriers,omitempty"` + AlternateLocations *[]string `json:"alternateLocations,omitempty"` +} + +// LocationsListResult is list of locations. +type LocationsListResult struct { + autorest.Response `json:"-"` + Value *[]Location `json:"value,omitempty"` +} + +// MoveJobParameters is defines the parameters that need to be provided for +// moving an import/export job from one reesource group to another. +type MoveJobParameters struct { + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + Resources *[]string `json:"resources,omitempty"` +} + +// MutableJob is describes the updatable properties of the job +type MutableJob struct { + Tags *map[string]interface{} `json:"tags,omitempty"` + *MutableJobProperties `json:"properties,omitempty"` +} + +// MutableJobProperties is properties of the job that can be updated. +type MutableJobProperties struct { + CancelRequested *bool `json:"cancelRequested,omitempty"` + State MutableJobState `json:"state,omitempty"` + ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"` + ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"` + DeliveryPackage *PackageInfomation `json:"deliveryPackage,omitempty"` + LogLevel *string `json:"logLevel,omitempty"` + BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"` +} + +// Operation is describes a supported operation by the Storage Import/Export +// job API. +type Operation struct { + Name *string `json:"name,omitempty"` + *OperationDisplayInformation `json:"display,omitempty"` +} + +// OperationDisplayInformation is display information about the operation. +type OperationDisplayInformation struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// PackageInfomation is provides information about the package being shipped by +// the customer to the Microsoft data center. +type PackageInfomation struct { + CarrierName *string `json:"carrierName,omitempty"` + TrackingNumber *string `json:"trackingNumber,omitempty"` + DriveCount *int32 `json:"driveCount,omitempty"` + ShipDate *string `json:"shipDate,omitempty"` +} + +// Resource is the Resource model definition. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]interface{} `json:"tags,omitempty"` +} + +// ReturnAddress is specifies the return address information for the job. +type ReturnAddress struct { + RecipientName *string `json:"recipientName,omitempty"` + StreetAddress1 *string `json:"streetAddress1,omitempty"` + StreetAddress2 *string `json:"streetAddress2,omitempty"` + City *string `json:"city,omitempty"` + StateOrProvince *string `json:"stateOrProvince,omitempty"` + PostalCode *string `json:"postalCode,omitempty"` + CountryOrRegion *string `json:"countryOrRegion,omitempty"` + Phone *string `json:"phone,omitempty"` + Email *string `json:"email,omitempty"` +} + +// ReturnShipping is specifies the return carrier and customer's account with +// the carrier. +type ReturnShipping struct { + CarrierName *string `json:"carrierName,omitempty"` + CarrierAccountNumber *string `json:"carrierAccountNumber,omitempty"` +} + +// ShippingInformation is provides information about the Microsoft datacenter +// to which the drives should be shipped. +type ShippingInformation struct { + Name *string `json:"name,omitempty"` + Address *string `json:"address,omitempty"` +} + +// SupportedOperationsListResult is list of supported operations by the +// import/export resource provider. +type SupportedOperationsListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/version.go index 6692fad053..cfe538a84b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/storageimportexport/version.go @@ -1,29 +1,29 @@ -package storageimportexport - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-storageimportexport/2016-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package storageimportexport + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-storageimportexport/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/client.go index 0578e9db6b..332f0addca 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/client.go @@ -1,53 +1,53 @@ -// Package trafficmanager implements the Azure ARM Trafficmanager service API -// version 2015-11-01. -// -// -package trafficmanager - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Trafficmanager - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Trafficmanager. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} +// Package trafficmanager implements the Azure ARM Trafficmanager service API +// version 2015-11-01. +// +// +package trafficmanager + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Trafficmanager + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Trafficmanager. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/endpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/endpoints.go index b6ee0ad0e8..cb88fa57c1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/endpoints.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/endpoints.go @@ -1,330 +1,330 @@ -package trafficmanager - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// EndpointsClient is the client for the Endpoints methods of the -// Trafficmanager service. -type EndpointsClient struct { - ManagementClient -} - -// NewEndpointsClient creates an instance of the EndpointsClient client. -func NewEndpointsClient(subscriptionID string) EndpointsClient { - return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient -// client. -func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { - return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Traffic Manager endpoint. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager endpoint to be created or updated. profileName is the name of the -// Traffic Manager profile. endpointType is the type of the Traffic Manager -// endpoint to be created or updated. endpointName is the name of the Traffic -// Manager endpoint to be created or updated. parameters is the Traffic Manager -// endpoint parameters supplied to the CreateOrUpdate operation. -func (client EndpointsClient) CreateOrUpdate(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client EndpointsClient) CreateOrUpdatePreparer(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "endpointType": autorest.Encode("path", endpointType), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client EndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Traffic Manager endpoint. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager endpoint to be deleted. profileName is the name of the Traffic -// Manager profile. endpointType is the type of the Traffic Manager endpoint to -// be deleted. endpointName is the name of the Traffic Manager endpoint to be -// deleted. -func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointType string, endpointName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, profileName, endpointType, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileName string, endpointType string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "endpointType": autorest.Encode("path", endpointType), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Traffic Manager endpoint. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager endpoint. profileName is the name of the Traffic Manager profile. -// endpointType is the type of the Traffic Manager endpoint. endpointName is -// the name of the Traffic Manager endpoint. -func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointType string, endpointName string) (result Endpoint, err error) { - req, err := client.GetPreparer(resourceGroupName, profileName, endpointType, endpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName string, endpointType string, endpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "endpointType": autorest.Encode("path", endpointType), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a Traffic Manager endpoint. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager endpoint to be updated. profileName is the name of the Traffic -// Manager profile. endpointType is the type of the Traffic Manager endpoint to -// be updated. endpointName is the name of the Traffic Manager endpoint to be -// updated. parameters is the Traffic Manager endpoint parameters supplied to -// the Update operation. -func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { - req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "endpointName": autorest.Encode("path", endpointName), - "endpointType": autorest.Encode("path", endpointType), - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client EndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package trafficmanager + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// EndpointsClient is the client for the Endpoints methods of the +// Trafficmanager service. +type EndpointsClient struct { + ManagementClient +} + +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient +// client. +func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Traffic Manager endpoint. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager endpoint to be created or updated. profileName is the name of the +// Traffic Manager profile. endpointType is the type of the Traffic Manager +// endpoint to be created or updated. endpointName is the name of the Traffic +// Manager endpoint to be created or updated. parameters is the Traffic Manager +// endpoint parameters supplied to the CreateOrUpdate operation. +func (client EndpointsClient) CreateOrUpdate(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EndpointsClient) CreateOrUpdatePreparer(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Traffic Manager endpoint. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager endpoint to be deleted. profileName is the name of the Traffic +// Manager profile. endpointType is the type of the Traffic Manager endpoint to +// be deleted. endpointName is the name of the Traffic Manager endpoint to be +// deleted. +func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointType string, endpointName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, profileName, endpointType, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileName string, endpointType string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Traffic Manager endpoint. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager endpoint. profileName is the name of the Traffic Manager profile. +// endpointType is the type of the Traffic Manager endpoint. endpointName is +// the name of the Traffic Manager endpoint. +func (client EndpointsClient) Get(resourceGroupName string, profileName string, endpointType string, endpointName string) (result Endpoint, err error) { + req, err := client.GetPreparer(resourceGroupName, profileName, endpointType, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName string, endpointType string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update a Traffic Manager endpoint. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager endpoint to be updated. profileName is the name of the Traffic +// Manager profile. endpointType is the type of the Traffic Manager endpoint to +// be updated. endpointName is the name of the Traffic Manager endpoint to be +// updated. parameters is the Traffic Manager endpoint parameters supplied to +// the Update operation. +func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { + req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointType, endpointName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/models.go index e667750699..a70d070360 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/models.go @@ -1,120 +1,120 @@ -package trafficmanager - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -// CheckTrafficManagerRelativeDNSNameAvailabilityParameters is parameters -// supplied to check Traffic Manager name operation. -type CheckTrafficManagerRelativeDNSNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// DNSConfig is class containing DNS settings in a Traffic Manager profile. -type DNSConfig struct { - RelativeName *string `json:"relativeName,omitempty"` - Fqdn *string `json:"fqdn,omitempty"` - TTL *int64 `json:"ttl,omitempty"` -} - -// Endpoint is class representing a Traffic Manager endpoint. -type Endpoint struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - *EndpointProperties `json:"properties,omitempty"` -} - -// EndpointProperties is class representing a Traffic Manager endpoint -// properties. -type EndpointProperties struct { - TargetResourceID *string `json:"targetResourceId,omitempty"` - Target *string `json:"target,omitempty"` - EndpointStatus *string `json:"endpointStatus,omitempty"` - Weight *int64 `json:"weight,omitempty"` - Priority *int64 `json:"priority,omitempty"` - EndpointLocation *string `json:"endpointLocation,omitempty"` - EndpointMonitorStatus *string `json:"endpointMonitorStatus,omitempty"` - MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` -} - -// MonitorConfig is class containing endpoint monitoring settings in a Traffic -// Manager profile. -type MonitorConfig struct { - ProfileMonitorStatus *string `json:"profileMonitorStatus,omitempty"` - Protocol *string `json:"protocol,omitempty"` - Port *int64 `json:"port,omitempty"` - Path *string `json:"path,omitempty"` -} - -// NameAvailability is class representing a Traffic Manager Name Availability -// response. -type NameAvailability struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// Profile is class representing a Traffic Manager profile. -type Profile struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ProfileProperties `json:"properties,omitempty"` -} - -// ProfileListResult is the list Traffic Manager profiles operation response. -type ProfileListResult struct { - autorest.Response `json:"-"` - Value *[]Profile `json:"value,omitempty"` -} - -// ProfileProperties is class representing the Traffic Manager profile -// properties. -type ProfileProperties struct { - ProfileStatus *string `json:"profileStatus,omitempty"` - TrafficRoutingMethod *string `json:"trafficRoutingMethod,omitempty"` - DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` - MonitorConfig *MonitorConfig `json:"monitorConfig,omitempty"` - Endpoints *[]Endpoint `json:"endpoints,omitempty"` -} - -// Resource is -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SubResource is -type SubResource struct { - ID *string `json:"id,omitempty"` -} +package trafficmanager + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// CheckTrafficManagerRelativeDNSNameAvailabilityParameters is parameters +// supplied to check Traffic Manager name operation. +type CheckTrafficManagerRelativeDNSNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// DNSConfig is class containing DNS settings in a Traffic Manager profile. +type DNSConfig struct { + RelativeName *string `json:"relativeName,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + TTL *int64 `json:"ttl,omitempty"` +} + +// Endpoint is class representing a Traffic Manager endpoint. +type Endpoint struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + *EndpointProperties `json:"properties,omitempty"` +} + +// EndpointProperties is class representing a Traffic Manager endpoint +// properties. +type EndpointProperties struct { + TargetResourceID *string `json:"targetResourceId,omitempty"` + Target *string `json:"target,omitempty"` + EndpointStatus *string `json:"endpointStatus,omitempty"` + Weight *int64 `json:"weight,omitempty"` + Priority *int64 `json:"priority,omitempty"` + EndpointLocation *string `json:"endpointLocation,omitempty"` + EndpointMonitorStatus *string `json:"endpointMonitorStatus,omitempty"` + MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` +} + +// MonitorConfig is class containing endpoint monitoring settings in a Traffic +// Manager profile. +type MonitorConfig struct { + ProfileMonitorStatus *string `json:"profileMonitorStatus,omitempty"` + Protocol *string `json:"protocol,omitempty"` + Port *int64 `json:"port,omitempty"` + Path *string `json:"path,omitempty"` +} + +// NameAvailability is class representing a Traffic Manager Name Availability +// response. +type NameAvailability struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Profile is class representing a Traffic Manager profile. +type Profile struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ProfileProperties `json:"properties,omitempty"` +} + +// ProfileListResult is the list Traffic Manager profiles operation response. +type ProfileListResult struct { + autorest.Response `json:"-"` + Value *[]Profile `json:"value,omitempty"` +} + +// ProfileProperties is class representing the Traffic Manager profile +// properties. +type ProfileProperties struct { + ProfileStatus *string `json:"profileStatus,omitempty"` + TrafficRoutingMethod *string `json:"trafficRoutingMethod,omitempty"` + DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` + MonitorConfig *MonitorConfig `json:"monitorConfig,omitempty"` + Endpoints *[]Endpoint `json:"endpoints,omitempty"` +} + +// Resource is +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SubResource is +type SubResource struct { + ID *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/profiles.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/profiles.go index c8de930104..b1e2859d95 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/profiles.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/profiles.go @@ -1,508 +1,508 @@ -package trafficmanager - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProfilesClient is the client for the Profiles methods of the Trafficmanager -// service. -type ProfilesClient struct { - ManagementClient -} - -// NewProfilesClient creates an instance of the ProfilesClient client. -func NewProfilesClient(subscriptionID string) ProfilesClient { - return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient -// client. -func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { - return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckTrafficManagerRelativeDNSNameAvailability checks the availability of a -// Traffic Manager Relative DNS name. -// -// parameters is the Traffic Manager name parameters supplied to the -// CheckTrafficManagerNameAvailability operation. -func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailability(parameters CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (result NameAvailability, err error) { - req, err := client.CheckTrafficManagerRelativeDNSNameAvailabilityPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckTrafficManagerRelativeDNSNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckTrafficManagerRelativeDNSNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckTrafficManagerRelativeDNSNameAvailabilityPreparer prepares the CheckTrafficManagerRelativeDNSNameAvailability request. -func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityPreparer(parameters CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Network/checkTrafficManagerNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckTrafficManagerRelativeDNSNameAvailabilitySender sends the CheckTrafficManagerRelativeDNSNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckTrafficManagerRelativeDNSNameAvailabilityResponder handles the response to the CheckTrafficManagerRelativeDNSNameAvailability request. The method always -// closes the http.Response Body. -func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update a Traffic Manager profile. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager profile. profileName is the name of the Traffic Manager profile. -// parameters is the Traffic Manager profile parameters supplied to the -// CreateOrUpdate operation. -func (client ProfilesClient) CreateOrUpdate(resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) { - req, err := client.CreateOrUpdatePreparer(resourceGroupName, profileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ProfilesClient) CreateOrUpdatePreparer(resourceGroupName string, profileName string, parameters Profile) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Traffic Manager profile. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager profile to be deleted. profileName is the name of the Traffic -// Manager profile to be deleted. -func (client ProfilesClient) Delete(resourceGroupName string, profileName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Traffic Manager profile. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager profile. profileName is the name of the Traffic Manager profile. -func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) { - req, err := client.GetPreparer(resourceGroupName, profileName) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAll lists all Traffic Manager profiles within a subscription. -func (client ProfilesClient) ListAll() (result ProfileListResult, err error) { - req, err := client.ListAllPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAll", resp, "Failure sending request") - return - } - - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAll", resp, "Failure responding to request") - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client ProfilesClient) ListAllPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client ProfilesClient) ListAllResponder(resp *http.Response) (result ProfileListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllInResourceGroup lists all Traffic Manager profiles within a resource -// group. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager profiles to be listed. -func (client ProfilesClient) ListAllInResourceGroup(resourceGroupName string) (result ProfileListResult, err error) { - req, err := client.ListAllInResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAllInResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllInResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAllInResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListAllInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAllInResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListAllInResourceGroupPreparer prepares the ListAllInResourceGroup request. -func (client ProfilesClient) ListAllInResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAllInResourceGroupSender sends the ListAllInResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) ListAllInResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAllInResourceGroupResponder handles the response to the ListAllInResourceGroup request. The method always -// closes the http.Response Body. -func (client ProfilesClient) ListAllInResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a Traffic Manager profile. -// -// resourceGroupName is the name of the resource group containing the Traffic -// Manager profile. profileName is the name of the Traffic Manager profile. -// parameters is the Traffic Manager profile parameters supplied to the Update -// operation. -func (client ProfilesClient) Update(resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) { - req, err := client.UpdatePreparer(resourceGroupName, profileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileName string, parameters Profile) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "profileName": autorest.Encode("path", profileName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ProfilesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package trafficmanager + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProfilesClient is the client for the Profiles methods of the Trafficmanager +// service. +type ProfilesClient struct { + ManagementClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient +// client. +func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckTrafficManagerRelativeDNSNameAvailability checks the availability of a +// Traffic Manager Relative DNS name. +// +// parameters is the Traffic Manager name parameters supplied to the +// CheckTrafficManagerNameAvailability operation. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailability(parameters CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (result NameAvailability, err error) { + req, err := client.CheckTrafficManagerRelativeDNSNameAvailabilityPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckTrafficManagerRelativeDNSNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckTrafficManagerRelativeDNSNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckTrafficManagerRelativeDNSNameAvailabilityPreparer prepares the CheckTrafficManagerRelativeDNSNameAvailability request. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityPreparer(parameters CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Network/checkTrafficManagerNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckTrafficManagerRelativeDNSNameAvailabilitySender sends the CheckTrafficManagerRelativeDNSNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckTrafficManagerRelativeDNSNameAvailabilityResponder handles the response to the CheckTrafficManagerRelativeDNSNameAvailability request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a Traffic Manager profile. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager profile. profileName is the name of the Traffic Manager profile. +// parameters is the Traffic Manager profile parameters supplied to the +// CreateOrUpdate operation. +func (client ProfilesClient) CreateOrUpdate(resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) { + req, err := client.CreateOrUpdatePreparer(resourceGroupName, profileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProfilesClient) CreateOrUpdatePreparer(resourceGroupName string, profileName string, parameters Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Traffic Manager profile. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager profile to be deleted. profileName is the name of the Traffic +// Manager profile to be deleted. +func (client ProfilesClient) Delete(resourceGroupName string, profileName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Traffic Manager profile. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager profile. profileName is the name of the Traffic Manager profile. +func (client ProfilesClient) Get(resourceGroupName string, profileName string) (result Profile, err error) { + req, err := client.GetPreparer(resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll lists all Traffic Manager profiles within a subscription. +func (client ProfilesClient) ListAll() (result ProfileListResult, err error) { + req, err := client.ListAllPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ProfilesClient) ListAllPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListAllResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAllInResourceGroup lists all Traffic Manager profiles within a resource +// group. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager profiles to be listed. +func (client ProfilesClient) ListAllInResourceGroup(resourceGroupName string) (result ProfileListResult, err error) { + req, err := client.ListAllInResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAllInResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllInResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAllInResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListAllInResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListAllInResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListAllInResourceGroupPreparer prepares the ListAllInResourceGroup request. +func (client ProfilesClient) ListAllInResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAllInResourceGroupSender sends the ListAllInResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListAllInResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAllInResourceGroupResponder handles the response to the ListAllInResourceGroup request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListAllInResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update a Traffic Manager profile. +// +// resourceGroupName is the name of the resource group containing the Traffic +// Manager profile. profileName is the name of the Traffic Manager profile. +// parameters is the Traffic Manager profile parameters supplied to the Update +// operation. +func (client ProfilesClient) Update(resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) { + req, err := client.UpdatePreparer(resourceGroupName, profileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileName string, parameters Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/version.go index 33e0f1632f..eeb14d3fc2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/trafficmanager/version.go @@ -1,29 +1,29 @@ -package trafficmanager - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-trafficmanager/2015-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package trafficmanager + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-trafficmanager/2015-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/apps.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/apps.go index 13751d624c..4515b48bc3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/apps.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/apps.go @@ -1,17607 +1,17607 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AppsClient is the composite Swagger for WebSite Management Client -type AppsClient struct { - ManagementClient -} - -// NewAppsClient creates an instance of the AppsClient client. -func NewAppsClient(subscriptionID string) AppsClient { - return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppsClientWithBaseURI creates an instance of the AppsClient client. -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddPremierAddOn updates a named add-on of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. premierAddOnName is add-on name. -// premierAddOn is a JSON representation of the edited premier add-on. -func (client AppsClient) AddPremierAddOn(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (result PremierAddOn, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AddPremierAddOn") - } - - req, err := client.AddPremierAddOnPreparer(resourceGroupName, name, premierAddOnName, premierAddOn) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", nil, "Failure preparing request") - return - } - - resp, err := client.AddPremierAddOnSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure sending request") - return - } - - result, err = client.AddPremierAddOnResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure responding to request") - } - - return -} - -// AddPremierAddOnPreparer prepares the AddPremierAddOn request. -func (client AppsClient) AddPremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithJSON(premierAddOn), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddPremierAddOnSender sends the AddPremierAddOn request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) AddPremierAddOnSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddPremierAddOnResponder handles the response to the AddPremierAddOn request. The method always -// closes the http.Response Body. -func (client AppsClient) AddPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AddPremierAddOnSlot updates a named add-on of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. premierAddOnName is add-on name. -// premierAddOn is a JSON representation of the edited premier add-on. slot is -// name of the deployment slot. If a slot is not specified, the API will update -// the named add-on for the production slot. -func (client AppsClient) AddPremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (result PremierAddOn, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AddPremierAddOnSlot") - } - - req, err := client.AddPremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, premierAddOn, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", nil, "Failure preparing request") - return - } - - resp, err := client.AddPremierAddOnSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure sending request") - return - } - - result, err = client.AddPremierAddOnSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure responding to request") - } - - return -} - -// AddPremierAddOnSlotPreparer prepares the AddPremierAddOnSlot request. -func (client AppsClient) AddPremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithJSON(premierAddOn), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AddPremierAddOnSlotSender sends the AddPremierAddOnSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) AddPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AddPremierAddOnSlotResponder handles the response to the AddPremierAddOnSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) AddPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AnalyzeCustomHostname analyze a custom hostname. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app hostName is custom hostname -func (client AppsClient) AnalyzeCustomHostname(resourceGroupName string, name string, hostName string) (result CustomHostnameAnalysisResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AnalyzeCustomHostname") - } - - req, err := client.AnalyzeCustomHostnamePreparer(resourceGroupName, name, hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", nil, "Failure preparing request") - return - } - - resp, err := client.AnalyzeCustomHostnameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure sending request") - return - } - - result, err = client.AnalyzeCustomHostnameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure responding to request") - } - - return -} - -// AnalyzeCustomHostnamePreparer prepares the AnalyzeCustomHostname request. -func (client AppsClient) AnalyzeCustomHostnamePreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(hostName) > 0 { - queryParameters["hostName"] = autorest.Encode("query", hostName) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AnalyzeCustomHostnameSender sends the AnalyzeCustomHostname request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) AnalyzeCustomHostnameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AnalyzeCustomHostnameResponder handles the response to the AnalyzeCustomHostname request. The method always -// closes the http.Response Body. -func (client AppsClient) AnalyzeCustomHostnameResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// AnalyzeCustomHostnameSlot analyze a custom hostname. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of web app slot. If not -// specified then will default to production slot. hostName is custom hostname -func (client AppsClient) AnalyzeCustomHostnameSlot(resourceGroupName string, name string, slot string, hostName string) (result CustomHostnameAnalysisResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot") - } - - req, err := client.AnalyzeCustomHostnameSlotPreparer(resourceGroupName, name, slot, hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", nil, "Failure preparing request") - return - } - - resp, err := client.AnalyzeCustomHostnameSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure sending request") - return - } - - result, err = client.AnalyzeCustomHostnameSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure responding to request") - } - - return -} - -// AnalyzeCustomHostnameSlotPreparer prepares the AnalyzeCustomHostnameSlot request. -func (client AppsClient) AnalyzeCustomHostnameSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(hostName) > 0 { - queryParameters["hostName"] = autorest.Encode("query", hostName) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AnalyzeCustomHostnameSlotSender sends the AnalyzeCustomHostnameSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) AnalyzeCustomHostnameSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AnalyzeCustomHostnameSlotResponder handles the response to the AnalyzeCustomHostnameSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) AnalyzeCustomHostnameSlotResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ApplySlotConfigToProduction applies the configuration settings from the -// target slot onto the current slot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotSwapEntity is jSON object that -// contains the target slot name. See example. -func (client AppsClient) ApplySlotConfigToProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: slotSwapEntity, - Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ApplySlotConfigToProduction") - } - - req, err := client.ApplySlotConfigToProductionPreparer(resourceGroupName, name, slotSwapEntity) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", nil, "Failure preparing request") - return - } - - resp, err := client.ApplySlotConfigToProductionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure sending request") - return - } - - result, err = client.ApplySlotConfigToProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure responding to request") - } - - return -} - -// ApplySlotConfigToProductionPreparer prepares the ApplySlotConfigToProduction request. -func (client AppsClient) ApplySlotConfigToProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ApplySlotConfigToProductionSender sends the ApplySlotConfigToProduction request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ApplySlotConfigToProductionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ApplySlotConfigToProductionResponder handles the response to the ApplySlotConfigToProduction request. The method always -// closes the http.Response Body. -func (client AppsClient) ApplySlotConfigToProductionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ApplySlotConfigurationSlot applies the configuration settings from the -// target slot onto the current slot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotSwapEntity is jSON object that -// contains the target slot name. See example. slot is name of the source slot. -// If a slot is not specified, the production slot is used as the source slot. -func (client AppsClient) ApplySlotConfigurationSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: slotSwapEntity, - Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ApplySlotConfigurationSlot") - } - - req, err := client.ApplySlotConfigurationSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ApplySlotConfigurationSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.ApplySlotConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// ApplySlotConfigurationSlotPreparer prepares the ApplySlotConfigurationSlot request. -func (client AppsClient) ApplySlotConfigurationSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ApplySlotConfigurationSlotSender sends the ApplySlotConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ApplySlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ApplySlotConfigurationSlotResponder handles the response to the ApplySlotConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ApplySlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Backup creates a backup of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. request is backup configuration. You can -// use the JSON response from the POST action as input here. -func (client AppsClient) Backup(resourceGroupName string, name string, request BackupRequest) (result BackupItem, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Backup") - } - - req, err := client.BackupPreparer(resourceGroupName, name, request) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", nil, "Failure preparing request") - return - } - - resp, err := client.BackupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure sending request") - return - } - - result, err = client.BackupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure responding to request") - } - - return -} - -// BackupPreparer prepares the Backup request. -func (client AppsClient) BackupPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// BackupSender sends the Backup request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) BackupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// BackupResponder handles the response to the Backup request. The method always -// closes the http.Response Body. -func (client AppsClient) BackupResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// BackupSlot creates a backup of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. request is backup configuration. You can -// use the JSON response from the POST action as input here. slot is name of -// the deployment slot. If a slot is not specified, the API will create a -// backup for the production slot. -func (client AppsClient) BackupSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupItem, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "BackupSlot") - } - - req, err := client.BackupSlotPreparer(resourceGroupName, name, request, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", nil, "Failure preparing request") - return - } - - resp, err := client.BackupSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure sending request") - return - } - - result, err = client.BackupSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure responding to request") - } - - return -} - -// BackupSlotPreparer prepares the BackupSlot request. -func (client AppsClient) BackupSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// BackupSlotSender sends the BackupSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) BackupSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// BackupSlotResponder handles the response to the BackupSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) BackupSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateDeployment create a deployment for an app, a specific deployment slot, -// and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is iD of an existing deployment. -// deployment is deployment details. -func (client AppsClient) CreateDeployment(resourceGroupName string, name string, ID string, deployment Deployment) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateDeployment") - } - - req, err := client.CreateDeploymentPreparer(resourceGroupName, name, ID, deployment) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", nil, "Failure preparing request") - return - } - - resp, err := client.CreateDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure sending request") - return - } - - result, err = client.CreateDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure responding to request") - } - - return -} - -// CreateDeploymentPreparer prepares the CreateDeployment request. -func (client AppsClient) CreateDeploymentPreparer(resourceGroupName string, name string, ID string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateDeploymentSender sends the CreateDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateDeploymentResponder handles the response to the CreateDeployment request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateDeploymentSlot create a deployment for an app, a specific deployment -// slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is iD of an existing deployment. slot -// is name of the deployment slot. If a slot is not specified, the API creates -// a deployment for the production slot. deployment is deployment details. -func (client AppsClient) CreateDeploymentSlot(resourceGroupName string, name string, ID string, slot string, deployment Deployment) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateDeploymentSlot") - } - - req, err := client.CreateDeploymentSlotPreparer(resourceGroupName, name, ID, slot, deployment) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// CreateDeploymentSlotPreparer prepares the CreateDeploymentSlot request. -func (client AppsClient) CreateDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateDeploymentSlotSender sends the CreateDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateDeploymentSlotResponder handles the response to the CreateDeploymentSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateInstanceDeployment create a deployment for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is iD of an existing deployment. -// instanceID is iD of a specific scaled-out instance. This is the value of the -// name property in the JSON response from "GET api/sites/{siteName}/instances" -// deployment is deployment details. -func (client AppsClient) CreateInstanceDeployment(resourceGroupName string, name string, ID string, instanceID string, deployment Deployment) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateInstanceDeployment") - } - - req, err := client.CreateInstanceDeploymentPreparer(resourceGroupName, name, ID, instanceID, deployment) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", nil, "Failure preparing request") - return - } - - resp, err := client.CreateInstanceDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", resp, "Failure sending request") - return - } - - result, err = client.CreateInstanceDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", resp, "Failure responding to request") - } - - return -} - -// CreateInstanceDeploymentPreparer prepares the CreateInstanceDeployment request. -func (client AppsClient) CreateInstanceDeploymentPreparer(resourceGroupName string, name string, ID string, instanceID string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateInstanceDeploymentSender sends the CreateInstanceDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateInstanceDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateInstanceDeploymentResponder handles the response to the CreateInstanceDeployment request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateInstanceDeploymentSlot create a deployment for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is iD of an existing deployment. slot -// is name of the deployment slot. If a slot is not specified, the API creates -// a deployment for the production slot. instanceID is iD of a specific -// scaled-out instance. This is the value of the name property in the JSON -// response from "GET api/sites/{siteName}/instances" deployment is deployment -// details. -func (client AppsClient) CreateInstanceDeploymentSlot(resourceGroupName string, name string, ID string, slot string, instanceID string, deployment Deployment) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateInstanceDeploymentSlot") - } - - req, err := client.CreateInstanceDeploymentSlotPreparer(resourceGroupName, name, ID, slot, instanceID, deployment) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateInstanceDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateInstanceDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// CreateInstanceDeploymentSlotPreparer prepares the CreateInstanceDeploymentSlot request. -func (client AppsClient) CreateInstanceDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, instanceID string, deployment Deployment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithJSON(deployment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateInstanceDeploymentSlotSender sends the CreateInstanceDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateInstanceDeploymentSlotResponder handles the response to the CreateInstanceDeploymentSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a new web, mobile, or API app in an existing resource -// group, or updates an existing app. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is unique name of the app to create or update. To create or -// update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON -// representation of the app properties. See example. skipDNSRegistration is if -// true web app hostname is not registered with DNS on creation. This parameter -// is -// only used for app creation skipCustomDomainVerification is if true, custom -// (non *.azurewebsites.net) domains associated with web app are not verified. -// forceDNSRegistration is if true, web app hostname is force registered with -// DNS TTLInSeconds is time to live in seconds for web app's default domain -// name -func (client AppsClient) CreateOrUpdate(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (<-chan Site, <-chan error) { - resultChan := make(chan Site, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: siteEnvelope, - Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Site - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } - if skipCustomDomainVerification != nil { - queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) - } - if forceDNSRegistration != nil { - queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) - } - if len(TTLInSeconds) > 0 { - queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), - autorest.WithJSON(siteEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result Site, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateConfiguration updates the configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteConfig is jSON representation of a -// SiteConfig object. See example. -func (client AppsClient) CreateOrUpdateConfiguration(resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: siteConfig, - Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateConfiguration") - } - - req, err := client.CreateOrUpdateConfigurationPreparer(resourceGroupName, name, siteConfig) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateConfigurationPreparer prepares the CreateOrUpdateConfiguration request. -func (client AppsClient) CreateOrUpdateConfigurationPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateConfigurationSender sends the CreateOrUpdateConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateConfigurationResponder handles the response to the CreateOrUpdateConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateConfigurationSlot updates the configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteConfig is jSON representation of a -// SiteConfig object. See example. slot is name of the deployment slot. If a -// slot is not specified, the API will update configuration for the production -// slot. -func (client AppsClient) CreateOrUpdateConfigurationSlot(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: siteConfig, - Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot") - } - - req, err := client.CreateOrUpdateConfigurationSlotPreparer(resourceGroupName, name, siteConfig, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateConfigurationSlotPreparer prepares the CreateOrUpdateConfigurationSlot request. -func (client AppsClient) CreateOrUpdateConfigurationSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateConfigurationSlotSender sends the CreateOrUpdateConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateConfigurationSlotResponder handles the response to the CreateOrUpdateConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateDomainOwnershipIdentifier creates a domain ownership -// identifier for web app, or updates an existing ownership identifier. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. domainOwnershipIdentifier is a JSON -// representation of the domain ownership properties. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier") - } - - req, err := client.CreateOrUpdateDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateDomainOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateDomainOwnershipIdentifierPreparer prepares the CreateOrUpdateDomainOwnershipIdentifier request. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithJSON(domainOwnershipIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateDomainOwnershipIdentifierSender sends the CreateOrUpdateDomainOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateDomainOwnershipIdentifierResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateDomainOwnershipIdentifierSlot creates a domain ownership -// identifier for web app, or updates an existing ownership identifier. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. domainOwnershipIdentifier is a JSON -// representation of the domain ownership properties. slot is name of the -// deployment slot. If a slot is not specified, the API will delete the binding -// for the production slot. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot") - } - - req, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateDomainOwnershipIdentifierSlotPreparer prepares the CreateOrUpdateDomainOwnershipIdentifierSlot request. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithJSON(domainOwnershipIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateDomainOwnershipIdentifierSlotSender sends the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateDomainOwnershipIdentifierSlotResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateHostNameBinding creates a hostname binding for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. hostName is hostname in the hostname -// binding. hostNameBinding is binding details. This is the JSON representation -// of a HostNameBinding object. -func (client AppsClient) CreateOrUpdateHostNameBinding(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (result HostNameBinding, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding") - } - - req, err := client.CreateOrUpdateHostNameBindingPreparer(resourceGroupName, name, hostName, hostNameBinding) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateHostNameBindingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateHostNameBindingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateHostNameBindingPreparer prepares the CreateOrUpdateHostNameBinding request. -func (client AppsClient) CreateOrUpdateHostNameBindingPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), - autorest.WithJSON(hostNameBinding), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateHostNameBindingSender sends the CreateOrUpdateHostNameBinding request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateHostNameBindingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateHostNameBindingResponder handles the response to the CreateOrUpdateHostNameBinding request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateHostNameBindingSlot creates a hostname binding for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. hostName is hostname in the hostname -// binding. hostNameBinding is binding details. This is the JSON representation -// of a HostNameBinding object. slot is name of the deployment slot. If a slot -// is not specified, the API will create a binding for the production slot. -func (client AppsClient) CreateOrUpdateHostNameBindingSlot(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (result HostNameBinding, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot") - } - - req, err := client.CreateOrUpdateHostNameBindingSlotPreparer(resourceGroupName, name, hostName, hostNameBinding, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateHostNameBindingSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateHostNameBindingSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateHostNameBindingSlotPreparer prepares the CreateOrUpdateHostNameBindingSlot request. -func (client AppsClient) CreateOrUpdateHostNameBindingSlotPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), - autorest.WithJSON(hostNameBinding), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateHostNameBindingSlotSender sends the CreateOrUpdateHostNameBindingSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateHostNameBindingSlotResponder handles the response to the CreateOrUpdateHostNameBindingSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateHybridConnection creates a new Hybrid Connection using a -// Service Bus relay. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection connectionEnvelope is the details of the hybrid connection -func (client AppsClient) CreateOrUpdateHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHybridConnection") - } - - req, err := client.CreateOrUpdateHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateHybridConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateHybridConnectionPreparer prepares the CreateOrUpdateHybridConnection request. -func (client AppsClient) CreateOrUpdateHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateHybridConnectionSender sends the CreateOrUpdateHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateHybridConnectionResponder handles the response to the CreateOrUpdateHybridConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateHybridConnectionSlot creates a new Hybrid Connection using a -// Service Bus relay. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection connectionEnvelope is the details of the hybrid connection slot -// is the name of the slot for the web app. -func (client AppsClient) CreateOrUpdateHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot") - } - - req, err := client.CreateOrUpdateHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateHybridConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateHybridConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateHybridConnectionSlotPreparer prepares the CreateOrUpdateHybridConnectionSlot request. -func (client AppsClient) CreateOrUpdateHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateHybridConnectionSlotSender sends the CreateOrUpdateHybridConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateHybridConnectionSlotResponder handles the response to the CreateOrUpdateHybridConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateRelayServiceConnection creates a new hybrid connection -// configuration (PUT), or updates an existing one (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection configuration. connectionEnvelope is details of the hybrid -// connection configuration. -func (client AppsClient) CreateOrUpdateRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection") - } - - req, err := client.CreateOrUpdateRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateRelayServiceConnectionPreparer prepares the CreateOrUpdateRelayServiceConnection request. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateRelayServiceConnectionSender sends the CreateOrUpdateRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateRelayServiceConnectionResponder handles the response to the CreateOrUpdateRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateRelayServiceConnectionSlot creates a new hybrid connection -// configuration (PUT), or updates an existing one (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection configuration. connectionEnvelope is details of the hybrid -// connection configuration. slot is name of the deployment slot. If a slot is -// not specified, the API will create or update a hybrid connection for the -// production slot. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot") - } - - req, err := client.CreateOrUpdateRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateRelayServiceConnectionSlotPreparer prepares the CreateOrUpdateRelayServiceConnectionSlot request. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateRelayServiceConnectionSlotSender sends the CreateOrUpdateRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateRelayServiceConnectionSlotResponder handles the response to the CreateOrUpdateRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSlot creates a new web, mobile, or API app in an existing -// resource group, or updates an existing app. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is unique name of the app to create or update. To create or -// update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON -// representation of the app properties. See example. slot is name of the -// deployment slot to create or update. By default, this API attempts to create -// or modify the production slot. skipDNSRegistration is if true web app -// hostname is not registered with DNS on creation. This parameter is -// only used for app creation skipCustomDomainVerification is if true, custom -// (non *.azurewebsites.net) domains associated with web app are not verified. -// forceDNSRegistration is if true, web app hostname is force registered with -// DNS TTLInSeconds is time to live in seconds for web app's default domain -// name -func (client AppsClient) CreateOrUpdateSlot(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (<-chan Site, <-chan error) { - resultChan := make(chan Site, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: siteEnvelope, - Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSlot") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Site - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateSlotPreparer(resourceGroupName, name, siteEnvelope, slot, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateSlotPreparer prepares the CreateOrUpdateSlot request. -func (client AppsClient) CreateOrUpdateSlotPreparer(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } - if skipCustomDomainVerification != nil { - queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) - } - if forceDNSRegistration != nil { - queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) - } - if len(TTLInSeconds) > 0 { - queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), - autorest.WithJSON(siteEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSlotSender sends the CreateOrUpdateSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateSlotResponder handles the response to the CreateOrUpdateSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateSlotResponder(resp *http.Response) (result Site, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSourceControl updates the source control configuration of an -// app. This method may poll for completion. Polling can be canceled by passing -// the cancel channel argument. The channel will be used to cancel polling and -// any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteSourceControl is jSON representation -// of a SiteSourceControl object. See example. -func (client AppsClient) CreateOrUpdateSourceControl(resourceGroupName string, name string, siteSourceControl SiteSourceControl, cancel <-chan struct{}) (<-chan SiteSourceControl, <-chan error) { - resultChan := make(chan SiteSourceControl, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSourceControl") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result SiteSourceControl - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateSourceControlPreparer(resourceGroupName, name, siteSourceControl, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateSourceControlPreparer prepares the CreateOrUpdateSourceControl request. -func (client AppsClient) CreateOrUpdateSourceControlPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithJSON(siteSourceControl), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSourceControlSender sends the CreateOrUpdateSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateSourceControlResponder handles the response to the CreateOrUpdateSourceControl request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateSourceControlSlot updates the source control configuration of -// an app. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteSourceControl is jSON representation -// of a SiteSourceControl object. See example. slot is name of the deployment -// slot. If a slot is not specified, the API will update the source control -// configuration for the production slot. -func (client AppsClient) CreateOrUpdateSourceControlSlot(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string, cancel <-chan struct{}) (<-chan SiteSourceControl, <-chan error) { - resultChan := make(chan SiteSourceControl, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result SiteSourceControl - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateSourceControlSlotPreparer(resourceGroupName, name, siteSourceControl, slot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSourceControlSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateSourceControlSlotPreparer prepares the CreateOrUpdateSourceControlSlot request. -func (client AppsClient) CreateOrUpdateSourceControlSlotPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithJSON(siteSourceControl), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSourceControlSlotSender sends the CreateOrUpdateSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateSourceControlSlotResponder handles the response to the CreateOrUpdateSourceControlSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateVnetConnection adds a Virtual Network connection to an app or -// slot (PUT) or updates the connection properties (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of an existing Virtual -// Network. connectionEnvelope is properties of the Virtual Network connection. -// See example. -func (client AppsClient) CreateOrUpdateVnetConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnection") - } - - req, err := client.CreateOrUpdateVnetConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateVnetConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateVnetConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateVnetConnectionPreparer prepares the CreateOrUpdateVnetConnection request. -func (client AppsClient) CreateOrUpdateVnetConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateVnetConnectionSender sends the CreateOrUpdateVnetConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateVnetConnectionResponder handles the response to the CreateOrUpdateVnetConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateVnetConnectionGateway adds a gateway to a connected Virtual -// Network (PUT) or updates it (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the Virtual Network. -// gatewayName is name of the gateway. Currently, the only supported string is -// "primary". connectionEnvelope is the properties to update this gateway with. -func (client AppsClient) CreateOrUpdateVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway") - } - - req, err := client.CreateOrUpdateVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateVnetConnectionGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateVnetConnectionGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateVnetConnectionGatewayPreparer prepares the CreateOrUpdateVnetConnectionGateway request. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateVnetConnectionGatewaySender sends the CreateOrUpdateVnetConnectionGateway request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateVnetConnectionGatewayResponder handles the response to the CreateOrUpdateVnetConnectionGateway request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateVnetConnectionGatewaySlot adds a gateway to a connected -// Virtual Network (PUT) or updates it (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the Virtual Network. -// gatewayName is name of the gateway. Currently, the only supported string is -// "primary". connectionEnvelope is the properties to update this gateway with. -// slot is name of the deployment slot. If a slot is not specified, the API -// will add or update a gateway for the production slot's Virtual Network. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot") - } - - req, err := client.CreateOrUpdateVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateVnetConnectionGatewaySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateVnetConnectionGatewaySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateVnetConnectionGatewaySlotPreparer prepares the CreateOrUpdateVnetConnectionGatewaySlot request. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateVnetConnectionGatewaySlotSender sends the CreateOrUpdateVnetConnectionGatewaySlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateVnetConnectionGatewaySlotResponder handles the response to the CreateOrUpdateVnetConnectionGatewaySlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateVnetConnectionSlot adds a Virtual Network connection to an app -// or slot (PUT) or updates the connection properties (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of an existing Virtual -// Network. connectionEnvelope is properties of the Virtual Network connection. -// See example. slot is name of the deployment slot. If a slot is not -// specified, the API will add or update connections for the production slot. -func (client AppsClient) CreateOrUpdateVnetConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot") - } - - req, err := client.CreateOrUpdateVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateVnetConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateVnetConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateVnetConnectionSlotPreparer prepares the CreateOrUpdateVnetConnectionSlot request. -func (client AppsClient) CreateOrUpdateVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateVnetConnectionSlotSender sends the CreateOrUpdateVnetConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateVnetConnectionSlotResponder handles the response to the CreateOrUpdateVnetConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a web, mobile, or API app, or one of the deployment slots. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app to delete. deleteMetrics is if true, web -// app metrics are also deleted deleteEmptyServerFarm is specify true if the -// App Service plan will be empty after app deletion and you want to delete the -// empty App Service plan. By default, the empty App Service plan is not -// deleted. skipDNSRegistration is if true, DNS registration is skipped -func (client AppsClient) Delete(resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AppsClient) DeletePreparer(resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteMetrics != nil { - queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) - } - if deleteEmptyServerFarm != nil { - queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) - } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteBackup deletes a backup of an app by its ID. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. backupID is iD of the backup. -func (client AppsClient) DeleteBackup(resourceGroupName string, name string, backupID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackup") - } - - req, err := client.DeleteBackupPreparer(resourceGroupName, name, backupID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteBackupSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure sending request") - return - } - - result, err = client.DeleteBackupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure responding to request") - } - - return -} - -// DeleteBackupPreparer prepares the DeleteBackup request. -func (client AppsClient) DeleteBackupPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteBackupSender sends the DeleteBackup request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteBackupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteBackupResponder handles the response to the DeleteBackup request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteBackupResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteBackupConfiguration deletes the backup configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) DeleteBackupConfiguration(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupConfiguration") - } - - req, err := client.DeleteBackupConfigurationPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteBackupConfigurationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure sending request") - return - } - - result, err = client.DeleteBackupConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure responding to request") - } - - return -} - -// DeleteBackupConfigurationPreparer prepares the DeleteBackupConfiguration request. -func (client AppsClient) DeleteBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteBackupConfigurationSender sends the DeleteBackupConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteBackupConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteBackupConfigurationResponder handles the response to the DeleteBackupConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteBackupConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteBackupConfigurationSlot deletes the backup configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will delete the backup configuration for the -// production slot. -func (client AppsClient) DeleteBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupConfigurationSlot") - } - - req, err := client.DeleteBackupConfigurationSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteBackupConfigurationSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteBackupConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteBackupConfigurationSlotPreparer prepares the DeleteBackupConfigurationSlot request. -func (client AppsClient) DeleteBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteBackupConfigurationSlotSender sends the DeleteBackupConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteBackupConfigurationSlotResponder handles the response to the DeleteBackupConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteBackupConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteBackupSlot deletes a backup of an app by its ID. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. backupID is iD of the backup. slot is name -// of the deployment slot. If a slot is not specified, the API will delete a -// backup of the production slot. -func (client AppsClient) DeleteBackupSlot(resourceGroupName string, name string, backupID string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupSlot") - } - - req, err := client.DeleteBackupSlotPreparer(resourceGroupName, name, backupID, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteBackupSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteBackupSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteBackupSlotPreparer prepares the DeleteBackupSlot request. -func (client AppsClient) DeleteBackupSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteBackupSlotSender sends the DeleteBackupSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteBackupSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteBackupSlotResponder handles the response to the DeleteBackupSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteBackupSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteDeployment delete a deployment by its ID for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. -func (client AppsClient) DeleteDeployment(resourceGroupName string, name string, ID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDeployment") - } - - req, err := client.DeleteDeploymentPreparer(resourceGroupName, name, ID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteDeploymentSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure sending request") - return - } - - result, err = client.DeleteDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure responding to request") - } - - return -} - -// DeleteDeploymentPreparer prepares the DeleteDeployment request. -func (client AppsClient) DeleteDeploymentPreparer(resourceGroupName string, name string, ID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteDeploymentSender sends the DeleteDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteDeploymentResponder handles the response to the DeleteDeployment request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteDeploymentSlot delete a deployment by its ID for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. slot is name of the -// deployment slot. If a slot is not specified, the API deletes a deployment -// for the production slot. -func (client AppsClient) DeleteDeploymentSlot(resourceGroupName string, name string, ID string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDeploymentSlot") - } - - req, err := client.DeleteDeploymentSlotPreparer(resourceGroupName, name, ID, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteDeploymentSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteDeploymentSlotPreparer prepares the DeleteDeploymentSlot request. -func (client AppsClient) DeleteDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteDeploymentSlotSender sends the DeleteDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteDeploymentSlotResponder handles the response to the DeleteDeploymentSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteDomainOwnershipIdentifier deletes a domain ownership identifier for a -// web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. -func (client AppsClient) DeleteDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier") - } - - req, err := client.DeleteDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteDomainOwnershipIdentifierSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.DeleteDomainOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// DeleteDomainOwnershipIdentifierPreparer prepares the DeleteDomainOwnershipIdentifier request. -func (client AppsClient) DeleteDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteDomainOwnershipIdentifierSender sends the DeleteDomainOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteDomainOwnershipIdentifierResponder handles the response to the DeleteDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteDomainOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteDomainOwnershipIdentifierSlot deletes a domain ownership identifier -// for a web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. slot is name of the deployment slot. If a slot -// is not specified, the API will delete the binding for the production slot. -func (client AppsClient) DeleteDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot") - } - - req, err := client.DeleteDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteDomainOwnershipIdentifierSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteDomainOwnershipIdentifierSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteDomainOwnershipIdentifierSlotPreparer prepares the DeleteDomainOwnershipIdentifierSlot request. -func (client AppsClient) DeleteDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteDomainOwnershipIdentifierSlotSender sends the DeleteDomainOwnershipIdentifierSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteDomainOwnershipIdentifierSlotResponder handles the response to the DeleteDomainOwnershipIdentifierSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteHostNameBinding deletes a hostname binding for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. hostName is hostname in the hostname -// binding. -func (client AppsClient) DeleteHostNameBinding(resourceGroupName string, name string, hostName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHostNameBinding") - } - - req, err := client.DeleteHostNameBindingPreparer(resourceGroupName, name, hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteHostNameBindingSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure sending request") - return - } - - result, err = client.DeleteHostNameBindingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure responding to request") - } - - return -} - -// DeleteHostNameBindingPreparer prepares the DeleteHostNameBinding request. -func (client AppsClient) DeleteHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteHostNameBindingSender sends the DeleteHostNameBinding request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteHostNameBindingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteHostNameBindingResponder handles the response to the DeleteHostNameBinding request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteHostNameBindingResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteHostNameBindingSlot deletes a hostname binding for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will delete the binding for the production -// slot. hostName is hostname in the hostname binding. -func (client AppsClient) DeleteHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHostNameBindingSlot") - } - - req, err := client.DeleteHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteHostNameBindingSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteHostNameBindingSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteHostNameBindingSlotPreparer prepares the DeleteHostNameBindingSlot request. -func (client AppsClient) DeleteHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteHostNameBindingSlotSender sends the DeleteHostNameBindingSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteHostNameBindingSlotResponder handles the response to the DeleteHostNameBindingSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteHostNameBindingSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteHybridConnection removes a Hybrid Connection from this site. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection -func (client AppsClient) DeleteHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHybridConnection") - } - - req, err := client.DeleteHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteHybridConnectionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.DeleteHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure responding to request") - } - - return -} - -// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. -func (client AppsClient) DeleteHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteHybridConnectionSlot removes a Hybrid Connection from this site. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection slot is the name of the slot for the web app. -func (client AppsClient) DeleteHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHybridConnectionSlot") - } - - req, err := client.DeleteHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteHybridConnectionSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteHybridConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteHybridConnectionSlotPreparer prepares the DeleteHybridConnectionSlot request. -func (client AppsClient) DeleteHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteHybridConnectionSlotSender sends the DeleteHybridConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteHybridConnectionSlotResponder handles the response to the DeleteHybridConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteHybridConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteInstanceDeployment delete a deployment by its ID for an app, a -// specific deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. instanceID is iD of a -// specific scaled-out instance. This is the value of the name property in the -// JSON response from "GET api/sites/{siteName}/instances" -func (client AppsClient) DeleteInstanceDeployment(resourceGroupName string, name string, ID string, instanceID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteInstanceDeployment") - } - - req, err := client.DeleteInstanceDeploymentPreparer(resourceGroupName, name, ID, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteInstanceDeploymentSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", resp, "Failure sending request") - return - } - - result, err = client.DeleteInstanceDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", resp, "Failure responding to request") - } - - return -} - -// DeleteInstanceDeploymentPreparer prepares the DeleteInstanceDeployment request. -func (client AppsClient) DeleteInstanceDeploymentPreparer(resourceGroupName string, name string, ID string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteInstanceDeploymentSender sends the DeleteInstanceDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteInstanceDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteInstanceDeploymentResponder handles the response to the DeleteInstanceDeployment request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteInstanceDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteInstanceDeploymentSlot delete a deployment by its ID for an app, a -// specific deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. slot is name of the -// deployment slot. If a slot is not specified, the API deletes a deployment -// for the production slot. instanceID is iD of a specific scaled-out instance. -// This is the value of the name property in the JSON response from "GET -// api/sites/{siteName}/instances" -func (client AppsClient) DeleteInstanceDeploymentSlot(resourceGroupName string, name string, ID string, slot string, instanceID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot") - } - - req, err := client.DeleteInstanceDeploymentSlotPreparer(resourceGroupName, name, ID, slot, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteInstanceDeploymentSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteInstanceDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteInstanceDeploymentSlotPreparer prepares the DeleteInstanceDeploymentSlot request. -func (client AppsClient) DeleteInstanceDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteInstanceDeploymentSlotSender sends the DeleteInstanceDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteInstanceDeploymentSlotResponder handles the response to the DeleteInstanceDeploymentSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteInstanceDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeletePremierAddOn delete a premier add-on from an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. premierAddOnName is add-on name. -func (client AppsClient) DeletePremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeletePremierAddOn") - } - - req, err := client.DeletePremierAddOnPreparer(resourceGroupName, name, premierAddOnName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", nil, "Failure preparing request") - return - } - - resp, err := client.DeletePremierAddOnSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure sending request") - return - } - - result, err = client.DeletePremierAddOnResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure responding to request") - } - - return -} - -// DeletePremierAddOnPreparer prepares the DeletePremierAddOn request. -func (client AppsClient) DeletePremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeletePremierAddOnSender sends the DeletePremierAddOn request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeletePremierAddOnSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeletePremierAddOnResponder handles the response to the DeletePremierAddOn request. The method always -// closes the http.Response Body. -func (client AppsClient) DeletePremierAddOnResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeletePremierAddOnSlot delete a premier add-on from an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. premierAddOnName is add-on name. slot is -// name of the deployment slot. If a slot is not specified, the API will delete -// the named add-on for the production slot. -func (client AppsClient) DeletePremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeletePremierAddOnSlot") - } - - req, err := client.DeletePremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeletePremierAddOnSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure sending request") - return - } - - result, err = client.DeletePremierAddOnSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure responding to request") - } - - return -} - -// DeletePremierAddOnSlotPreparer prepares the DeletePremierAddOnSlot request. -func (client AppsClient) DeletePremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeletePremierAddOnSlotSender sends the DeletePremierAddOnSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeletePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeletePremierAddOnSlotResponder handles the response to the DeletePremierAddOnSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeletePremierAddOnSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteRelayServiceConnection deletes a relay service connection by its name. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection configuration. -func (client AppsClient) DeleteRelayServiceConnection(resourceGroupName string, name string, entityName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteRelayServiceConnection") - } - - req, err := client.DeleteRelayServiceConnectionPreparer(resourceGroupName, name, entityName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteRelayServiceConnectionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure sending request") - return - } - - result, err = client.DeleteRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// DeleteRelayServiceConnectionPreparer prepares the DeleteRelayServiceConnection request. -func (client AppsClient) DeleteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteRelayServiceConnectionSender sends the DeleteRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteRelayServiceConnectionResponder handles the response to the DeleteRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteRelayServiceConnectionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteRelayServiceConnectionSlot deletes a relay service connection by its -// name. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection configuration. slot is name of the deployment slot. If a slot is -// not specified, the API will delete a hybrid connection for the production -// slot. -func (client AppsClient) DeleteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot") - } - - req, err := client.DeleteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteRelayServiceConnectionSlotPreparer prepares the DeleteRelayServiceConnectionSlot request. -func (client AppsClient) DeleteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteRelayServiceConnectionSlotSender sends the DeleteRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteRelayServiceConnectionSlotResponder handles the response to the DeleteRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteRelayServiceConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteSlot deletes a web, mobile, or API app, or one of the deployment -// slots. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app to delete. slot is name of the deployment -// slot to delete. By default, the API deletes the production slot. -// deleteMetrics is if true, web app metrics are also deleted -// deleteEmptyServerFarm is specify true if the App Service plan will be empty -// after app deletion and you want to delete the empty App Service plan. By -// default, the empty App Service plan is not deleted. skipDNSRegistration is -// if true, DNS registration is skipped -func (client AppsClient) DeleteSlot(resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSlot") - } - - req, err := client.DeleteSlotPreparer(resourceGroupName, name, slot, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSlotPreparer prepares the DeleteSlot request. -func (client AppsClient) DeleteSlotPreparer(resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if deleteMetrics != nil { - queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) - } - if deleteEmptyServerFarm != nil { - queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) - } - if skipDNSRegistration != nil { - queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSlotSender sends the DeleteSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSlotResponder handles the response to the DeleteSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteSourceControl deletes the source control configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) DeleteSourceControl(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSourceControl") - } - - req, err := client.DeleteSourceControlPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSourceControlSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure sending request") - return - } - - result, err = client.DeleteSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure responding to request") - } - - return -} - -// DeleteSourceControlPreparer prepares the DeleteSourceControl request. -func (client AppsClient) DeleteSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSourceControlSender sends the DeleteSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSourceControlResponder handles the response to the DeleteSourceControl request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteSourceControlResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteSourceControlSlot deletes the source control configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will delete the source control configuration -// for the production slot. -func (client AppsClient) DeleteSourceControlSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSourceControlSlot") - } - - req, err := client.DeleteSourceControlSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSourceControlSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteSourceControlSlotPreparer prepares the DeleteSourceControlSlot request. -func (client AppsClient) DeleteSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSourceControlSlotSender sends the DeleteSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSourceControlSlotResponder handles the response to the DeleteSourceControlSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteSourceControlSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteVnetConnection deletes a connection from an app (or deployment slot to -// a named virtual network. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the virtual network. -func (client AppsClient) DeleteVnetConnection(resourceGroupName string, name string, vnetName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteVnetConnection") - } - - req, err := client.DeleteVnetConnectionPreparer(resourceGroupName, name, vnetName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteVnetConnectionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure sending request") - return - } - - result, err = client.DeleteVnetConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure responding to request") - } - - return -} - -// DeleteVnetConnectionPreparer prepares the DeleteVnetConnection request. -func (client AppsClient) DeleteVnetConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteVnetConnectionSender sends the DeleteVnetConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteVnetConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteVnetConnectionResponder handles the response to the DeleteVnetConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteVnetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteVnetConnectionSlot deletes a connection from an app (or deployment -// slot to a named virtual network. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the virtual network. -// slot is name of the deployment slot. If a slot is not specified, the API -// will delete the connection for the production slot. -func (client AppsClient) DeleteVnetConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteVnetConnectionSlot") - } - - req, err := client.DeleteVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteVnetConnectionSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.DeleteVnetConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// DeleteVnetConnectionSlotPreparer prepares the DeleteVnetConnectionSlot request. -func (client AppsClient) DeleteVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteVnetConnectionSlotSender sends the DeleteVnetConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteVnetConnectionSlotResponder handles the response to the DeleteVnetConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteVnetConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// DiscoverRestore discovers an existing app backup that can be restored from a -// blob in Azure storage. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. request is a RestoreRequest object that -// includes Azure storage URL and blog name for discovery of backup. -func (client AppsClient) DiscoverRestore(resourceGroupName string, name string, request RestoreRequest) (result RestoreRequest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DiscoverRestore") - } - - req, err := client.DiscoverRestorePreparer(resourceGroupName, name, request) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", nil, "Failure preparing request") - return - } - - resp, err := client.DiscoverRestoreSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", resp, "Failure sending request") - return - } - - result, err = client.DiscoverRestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", resp, "Failure responding to request") - } - - return -} - -// DiscoverRestorePreparer prepares the DiscoverRestore request. -func (client AppsClient) DiscoverRestorePreparer(resourceGroupName string, name string, request RestoreRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DiscoverRestoreSender sends the DiscoverRestore request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DiscoverRestoreSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DiscoverRestoreResponder handles the response to the DiscoverRestore request. The method always -// closes the http.Response Body. -func (client AppsClient) DiscoverRestoreResponder(resp *http.Response) (result RestoreRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DiscoverRestoreSlot discovers an existing app backup that can be restored -// from a blob in Azure storage. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. request is a RestoreRequest object that -// includes Azure storage URL and blog name for discovery of backup. slot is -// name of the deployment slot. If a slot is not specified, the API will -// perform discovery for the production slot. -func (client AppsClient) DiscoverRestoreSlot(resourceGroupName string, name string, request RestoreRequest, slot string) (result RestoreRequest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DiscoverRestoreSlot") - } - - req, err := client.DiscoverRestoreSlotPreparer(resourceGroupName, name, request, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", nil, "Failure preparing request") - return - } - - resp, err := client.DiscoverRestoreSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", resp, "Failure sending request") - return - } - - result, err = client.DiscoverRestoreSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", resp, "Failure responding to request") - } - - return -} - -// DiscoverRestoreSlotPreparer prepares the DiscoverRestoreSlot request. -func (client AppsClient) DiscoverRestoreSlotPreparer(resourceGroupName string, name string, request RestoreRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DiscoverRestoreSlotSender sends the DiscoverRestoreSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DiscoverRestoreSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DiscoverRestoreSlotResponder handles the response to the DiscoverRestoreSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) DiscoverRestoreSlotResponder(resp *http.Response) (result RestoreRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GenerateNewSitePublishingPassword generates a new publishing password for an -// app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) GenerateNewSitePublishingPassword(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GenerateNewSitePublishingPassword") - } - - req, err := client.GenerateNewSitePublishingPasswordPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateNewSitePublishingPasswordSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure sending request") - return - } - - result, err = client.GenerateNewSitePublishingPasswordResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure responding to request") - } - - return -} - -// GenerateNewSitePublishingPasswordPreparer prepares the GenerateNewSitePublishingPassword request. -func (client AppsClient) GenerateNewSitePublishingPasswordPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateNewSitePublishingPasswordSender sends the GenerateNewSitePublishingPassword request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GenerateNewSitePublishingPasswordSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateNewSitePublishingPasswordResponder handles the response to the GenerateNewSitePublishingPassword request. The method always -// closes the http.Response Body. -func (client AppsClient) GenerateNewSitePublishingPasswordResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GenerateNewSitePublishingPasswordSlot generates a new publishing password -// for an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API generate a new publishing password for the -// production slot. -func (client AppsClient) GenerateNewSitePublishingPasswordSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot") - } - - req, err := client.GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GenerateNewSitePublishingPasswordSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure sending request") - return - } - - result, err = client.GenerateNewSitePublishingPasswordSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure responding to request") - } - - return -} - -// GenerateNewSitePublishingPasswordSlotPreparer prepares the GenerateNewSitePublishingPasswordSlot request. -func (client AppsClient) GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GenerateNewSitePublishingPasswordSlotSender sends the GenerateNewSitePublishingPasswordSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GenerateNewSitePublishingPasswordSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GenerateNewSitePublishingPasswordSlotResponder handles the response to the GenerateNewSitePublishingPasswordSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GenerateNewSitePublishingPasswordSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of a web, mobile, or API app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) Get(resourceGroupName string, name string) (result Site, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AppsClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AppsClient) GetResponder(resp *http.Response) (result Site, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthSettings gets the Authentication/Authorization settings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) GetAuthSettings(resourceGroupName string, name string) (result SiteAuthSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetAuthSettings") - } - - req, err := client.GetAuthSettingsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure sending request") - return - } - - result, err = client.GetAuthSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure responding to request") - } - - return -} - -// GetAuthSettingsPreparer prepares the GetAuthSettings request. -func (client AppsClient) GetAuthSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthSettingsSender sends the GetAuthSettings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetAuthSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthSettingsResponder handles the response to the GetAuthSettings request. The method always -// closes the http.Response Body. -func (client AppsClient) GetAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthSettingsSlot gets the Authentication/Authorization settings of an -// app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the settings for the production -// slot. -func (client AppsClient) GetAuthSettingsSlot(resourceGroupName string, name string, slot string) (result SiteAuthSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetAuthSettingsSlot") - } - - req, err := client.GetAuthSettingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure sending request") - return - } - - result, err = client.GetAuthSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// GetAuthSettingsSlotPreparer prepares the GetAuthSettingsSlot request. -func (client AppsClient) GetAuthSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAuthSettingsSlotSender sends the GetAuthSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAuthSettingsSlotResponder handles the response to the GetAuthSettingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBackupConfiguration gets the backup configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) GetBackupConfiguration(resourceGroupName string, name string) (result BackupRequest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupConfiguration") - } - - req, err := client.GetBackupConfigurationPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.GetBackupConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure sending request") - return - } - - result, err = client.GetBackupConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure responding to request") - } - - return -} - -// GetBackupConfigurationPreparer prepares the GetBackupConfiguration request. -func (client AppsClient) GetBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetBackupConfigurationSender sends the GetBackupConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetBackupConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetBackupConfigurationResponder handles the response to the GetBackupConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) GetBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBackupConfigurationSlot gets the backup configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the backup configuration for the -// production slot. -func (client AppsClient) GetBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result BackupRequest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupConfigurationSlot") - } - - req, err := client.GetBackupConfigurationSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetBackupConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.GetBackupConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// GetBackupConfigurationSlotPreparer prepares the GetBackupConfigurationSlot request. -func (client AppsClient) GetBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetBackupConfigurationSlotSender sends the GetBackupConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetBackupConfigurationSlotResponder handles the response to the GetBackupConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBackupStatus gets a backup of an app by its ID. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. backupID is iD of the backup. -func (client AppsClient) GetBackupStatus(resourceGroupName string, name string, backupID string) (result BackupItem, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupStatus") - } - - req, err := client.GetBackupStatusPreparer(resourceGroupName, name, backupID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetBackupStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure sending request") - return - } - - result, err = client.GetBackupStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure responding to request") - } - - return -} - -// GetBackupStatusPreparer prepares the GetBackupStatus request. -func (client AppsClient) GetBackupStatusPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetBackupStatusSender sends the GetBackupStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetBackupStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetBackupStatusResponder handles the response to the GetBackupStatus request. The method always -// closes the http.Response Body. -func (client AppsClient) GetBackupStatusResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBackupStatusSlot gets a backup of an app by its ID. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. backupID is iD of the backup. slot is name -// of the deployment slot. If a slot is not specified, the API will get a -// backup of the production slot. -func (client AppsClient) GetBackupStatusSlot(resourceGroupName string, name string, backupID string, slot string) (result BackupItem, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupStatusSlot") - } - - req, err := client.GetBackupStatusSlotPreparer(resourceGroupName, name, backupID, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetBackupStatusSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure sending request") - return - } - - result, err = client.GetBackupStatusSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure responding to request") - } - - return -} - -// GetBackupStatusSlotPreparer prepares the GetBackupStatusSlot request. -func (client AppsClient) GetBackupStatusSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetBackupStatusSlotSender sends the GetBackupStatusSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetBackupStatusSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetBackupStatusSlotResponder handles the response to the GetBackupStatusSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetBackupStatusSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetConfiguration gets the configuration of an app, such as platform version -// and bitness, default documents, virtual applications, Always On, etc. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) GetConfiguration(resourceGroupName string, name string) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfiguration") - } - - req, err := client.GetConfigurationPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.GetConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure sending request") - return - } - - result, err = client.GetConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure responding to request") - } - - return -} - -// GetConfigurationPreparer prepares the GetConfiguration request. -func (client AppsClient) GetConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetConfigurationSender sends the GetConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetConfigurationResponder handles the response to the GetConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) GetConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetConfigurationSlot gets the configuration of an app, such as platform -// version and bitness, default documents, virtual applications, Always On, -// etc. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will return configuration for the production -// slot. -func (client AppsClient) GetConfigurationSlot(resourceGroupName string, name string, slot string) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSlot") - } - - req, err := client.GetConfigurationSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.GetConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// GetConfigurationSlotPreparer prepares the GetConfigurationSlot request. -func (client AppsClient) GetConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetConfigurationSlotSender sends the GetConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetConfigurationSlotResponder handles the response to the GetConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetConfigurationSnapshot gets a snapshot of the configuration of an app at a -// previous point in time. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. snapshotID is the ID of the snapshot to -// read. -func (client AppsClient) GetConfigurationSnapshot(resourceGroupName string, name string, snapshotID string) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSnapshot") - } - - req, err := client.GetConfigurationSnapshotPreparer(resourceGroupName, name, snapshotID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", nil, "Failure preparing request") - return - } - - resp, err := client.GetConfigurationSnapshotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure sending request") - return - } - - result, err = client.GetConfigurationSnapshotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure responding to request") - } - - return -} - -// GetConfigurationSnapshotPreparer prepares the GetConfigurationSnapshot request. -func (client AppsClient) GetConfigurationSnapshotPreparer(resourceGroupName string, name string, snapshotID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotId": autorest.Encode("path", snapshotID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetConfigurationSnapshotSender sends the GetConfigurationSnapshot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetConfigurationSnapshotResponder handles the response to the GetConfigurationSnapshot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetConfigurationSnapshotResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetConfigurationSnapshotSlot gets a snapshot of the configuration of an app -// at a previous point in time. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. snapshotID is the ID of the snapshot to -// read. slot is name of the deployment slot. If a slot is not specified, the -// API will return configuration for the production slot. -func (client AppsClient) GetConfigurationSnapshotSlot(resourceGroupName string, name string, snapshotID string, slot string) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSnapshotSlot") - } - - req, err := client.GetConfigurationSnapshotSlotPreparer(resourceGroupName, name, snapshotID, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetConfigurationSnapshotSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure sending request") - return - } - - result, err = client.GetConfigurationSnapshotSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure responding to request") - } - - return -} - -// GetConfigurationSnapshotSlotPreparer prepares the GetConfigurationSnapshotSlot request. -func (client AppsClient) GetConfigurationSnapshotSlotPreparer(resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "snapshotId": autorest.Encode("path", snapshotID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetConfigurationSnapshotSlotSender sends the GetConfigurationSnapshotSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetConfigurationSnapshotSlotResponder handles the response to the GetConfigurationSnapshotSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetConfigurationSnapshotSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeployment get a deployment by its ID for an app, a specific deployment -// slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. -func (client AppsClient) GetDeployment(resourceGroupName string, name string, ID string) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDeployment") - } - - req, err := client.GetDeploymentPreparer(resourceGroupName, name, ID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure sending request") - return - } - - result, err = client.GetDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure responding to request") - } - - return -} - -// GetDeploymentPreparer prepares the GetDeployment request. -func (client AppsClient) GetDeploymentPreparer(resourceGroupName string, name string, ID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeploymentSender sends the GetDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeploymentResponder handles the response to the GetDeployment request. The method always -// closes the http.Response Body. -func (client AppsClient) GetDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeploymentSlot get a deployment by its ID for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. slot is name of the -// deployment slot. If a slot is not specified, the API gets a deployment for -// the production slot. -func (client AppsClient) GetDeploymentSlot(resourceGroupName string, name string, ID string, slot string) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDeploymentSlot") - } - - req, err := client.GetDeploymentSlotPreparer(resourceGroupName, name, ID, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure sending request") - return - } - - result, err = client.GetDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// GetDeploymentSlotPreparer prepares the GetDeploymentSlot request. -func (client AppsClient) GetDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDeploymentSlotSender sends the GetDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDeploymentSlotResponder handles the response to the GetDeploymentSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDiagnosticLogsConfiguration gets the logging configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) GetDiagnosticLogsConfiguration(resourceGroupName string, name string) (result SiteLogsConfig, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration") - } - - req, err := client.GetDiagnosticLogsConfigurationPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.GetDiagnosticLogsConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure sending request") - return - } - - result, err = client.GetDiagnosticLogsConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure responding to request") - } - - return -} - -// GetDiagnosticLogsConfigurationPreparer prepares the GetDiagnosticLogsConfiguration request. -func (client AppsClient) GetDiagnosticLogsConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDiagnosticLogsConfigurationSender sends the GetDiagnosticLogsConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetDiagnosticLogsConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDiagnosticLogsConfigurationResponder handles the response to the GetDiagnosticLogsConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) GetDiagnosticLogsConfigurationResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDiagnosticLogsConfigurationSlot gets the logging configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the logging configuration for the -// production slot. -func (client AppsClient) GetDiagnosticLogsConfigurationSlot(resourceGroupName string, name string, slot string) (result SiteLogsConfig, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot") - } - - req, err := client.GetDiagnosticLogsConfigurationSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetDiagnosticLogsConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.GetDiagnosticLogsConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// GetDiagnosticLogsConfigurationSlotPreparer prepares the GetDiagnosticLogsConfigurationSlot request. -func (client AppsClient) GetDiagnosticLogsConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDiagnosticLogsConfigurationSlotSender sends the GetDiagnosticLogsConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetDiagnosticLogsConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDiagnosticLogsConfigurationSlotResponder handles the response to the GetDiagnosticLogsConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetDiagnosticLogsConfigurationSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDomainOwnershipIdentifier get domain ownership identifier for web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. -func (client AppsClient) GetDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string) (result Identifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDomainOwnershipIdentifier") - } - - req, err := client.GetDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.GetDomainOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.GetDomainOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// GetDomainOwnershipIdentifierPreparer prepares the GetDomainOwnershipIdentifier request. -func (client AppsClient) GetDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDomainOwnershipIdentifierSender sends the GetDomainOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDomainOwnershipIdentifierResponder handles the response to the GetDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client AppsClient) GetDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDomainOwnershipIdentifierSlot get domain ownership identifier for web -// app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. slot is name of the deployment slot. If a slot -// is not specified, the API will delete the binding for the production slot. -func (client AppsClient) GetDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result Identifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot") - } - - req, err := client.GetDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetDomainOwnershipIdentifierSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure sending request") - return - } - - result, err = client.GetDomainOwnershipIdentifierSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure responding to request") - } - - return -} - -// GetDomainOwnershipIdentifierSlotPreparer prepares the GetDomainOwnershipIdentifierSlot request. -func (client AppsClient) GetDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDomainOwnershipIdentifierSlotSender sends the GetDomainOwnershipIdentifierSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDomainOwnershipIdentifierSlotResponder handles the response to the GetDomainOwnershipIdentifierSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostNameBinding get the named hostname binding for an app (or deployment -// slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. hostName is hostname in the hostname -// binding. -func (client AppsClient) GetHostNameBinding(resourceGroupName string, name string, hostName string) (result HostNameBinding, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHostNameBinding") - } - - req, err := client.GetHostNameBindingPreparer(resourceGroupName, name, hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", nil, "Failure preparing request") - return - } - - resp, err := client.GetHostNameBindingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure sending request") - return - } - - result, err = client.GetHostNameBindingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure responding to request") - } - - return -} - -// GetHostNameBindingPreparer prepares the GetHostNameBinding request. -func (client AppsClient) GetHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostNameBindingSender sends the GetHostNameBinding request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetHostNameBindingSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostNameBindingResponder handles the response to the GetHostNameBinding request. The method always -// closes the http.Response Body. -func (client AppsClient) GetHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHostNameBindingSlot get the named hostname binding for an app (or -// deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API the named binding for the production slot. -// hostName is hostname in the hostname binding. -func (client AppsClient) GetHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result HostNameBinding, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHostNameBindingSlot") - } - - req, err := client.GetHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetHostNameBindingSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure sending request") - return - } - - result, err = client.GetHostNameBindingSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure responding to request") - } - - return -} - -// GetHostNameBindingSlotPreparer prepares the GetHostNameBindingSlot request. -func (client AppsClient) GetHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostName": autorest.Encode("path", hostName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHostNameBindingSlotSender sends the GetHostNameBindingSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHostNameBindingSlotResponder handles the response to the GetHostNameBindingSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHybridConnection retrieves a specific Service Bus Hybrid Connection used -// by this Web App. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection -func (client AppsClient) GetHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHybridConnection") - } - - req, err := client.GetHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.GetHybridConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.GetHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure responding to request") - } - - return -} - -// GetHybridConnectionPreparer prepares the GetHybridConnection request. -func (client AppsClient) GetHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHybridConnectionSlot retrieves a specific Service Bus Hybrid Connection -// used by this Web App. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection slot is the name of the slot for the web app. -func (client AppsClient) GetHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHybridConnectionSlot") - } - - req, err := client.GetHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetHybridConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.GetHybridConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// GetHybridConnectionSlotPreparer prepares the GetHybridConnectionSlot request. -func (client AppsClient) GetHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHybridConnectionSlotSender sends the GetHybridConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHybridConnectionSlotResponder handles the response to the GetHybridConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceDeployment get a deployment by its ID for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. instanceID is iD of a -// specific scaled-out instance. This is the value of the name property in the -// JSON response from "GET api/sites/{siteName}/instances" -func (client AppsClient) GetInstanceDeployment(resourceGroupName string, name string, ID string, instanceID string) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetInstanceDeployment") - } - - req, err := client.GetInstanceDeploymentPreparer(resourceGroupName, name, ID, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", nil, "Failure preparing request") - return - } - - resp, err := client.GetInstanceDeploymentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", resp, "Failure sending request") - return - } - - result, err = client.GetInstanceDeploymentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", resp, "Failure responding to request") - } - - return -} - -// GetInstanceDeploymentPreparer prepares the GetInstanceDeployment request. -func (client AppsClient) GetInstanceDeploymentPreparer(resourceGroupName string, name string, ID string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceDeploymentSender sends the GetInstanceDeployment request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetInstanceDeploymentSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceDeploymentResponder handles the response to the GetInstanceDeployment request. The method always -// closes the http.Response Body. -func (client AppsClient) GetInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInstanceDeploymentSlot get a deployment by its ID for an app, a specific -// deployment slot, and/or a specific scaled-out instance. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. ID is deployment ID. slot is name of the -// deployment slot. If a slot is not specified, the API gets a deployment for -// the production slot. instanceID is iD of a specific scaled-out instance. -// This is the value of the name property in the JSON response from "GET -// api/sites/{siteName}/instances" -func (client AppsClient) GetInstanceDeploymentSlot(resourceGroupName string, name string, ID string, slot string, instanceID string) (result Deployment, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetInstanceDeploymentSlot") - } - - req, err := client.GetInstanceDeploymentSlotPreparer(resourceGroupName, name, ID, slot, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetInstanceDeploymentSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", resp, "Failure sending request") - return - } - - result, err = client.GetInstanceDeploymentSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", resp, "Failure responding to request") - } - - return -} - -// GetInstanceDeploymentSlotPreparer prepares the GetInstanceDeploymentSlot request. -func (client AppsClient) GetInstanceDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "id": autorest.Encode("path", ID), - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetInstanceDeploymentSlotSender sends the GetInstanceDeploymentSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetInstanceDeploymentSlotResponder handles the response to the GetInstanceDeploymentSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMigrateMySQLStatus returns the status of MySql in app migration, if one -// is active, and whether or not MySql in app is enabled -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app -func (client AppsClient) GetMigrateMySQLStatus(resourceGroupName string, name string) (result MigrateMySQLStatus, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetMigrateMySQLStatus") - } - - req, err := client.GetMigrateMySQLStatusPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetMigrateMySQLStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure sending request") - return - } - - result, err = client.GetMigrateMySQLStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure responding to request") - } - - return -} - -// GetMigrateMySQLStatusPreparer prepares the GetMigrateMySQLStatus request. -func (client AppsClient) GetMigrateMySQLStatusPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMigrateMySQLStatusSender sends the GetMigrateMySQLStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetMigrateMySQLStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMigrateMySQLStatusResponder handles the response to the GetMigrateMySQLStatus request. The method always -// closes the http.Response Body. -func (client AppsClient) GetMigrateMySQLStatusResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMigrateMySQLStatusSlot returns the status of MySql in app migration, if -// one is active, and whether or not MySql in app is enabled -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of the deployment slot -func (client AppsClient) GetMigrateMySQLStatusSlot(resourceGroupName string, name string, slot string) (result MigrateMySQLStatus, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot") - } - - req, err := client.GetMigrateMySQLStatusSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetMigrateMySQLStatusSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure sending request") - return - } - - result, err = client.GetMigrateMySQLStatusSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure responding to request") - } - - return -} - -// GetMigrateMySQLStatusSlotPreparer prepares the GetMigrateMySQLStatusSlot request. -func (client AppsClient) GetMigrateMySQLStatusSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMigrateMySQLStatusSlotSender sends the GetMigrateMySQLStatusSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetMigrateMySQLStatusSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMigrateMySQLStatusSlotResponder handles the response to the GetMigrateMySQLStatusSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetMigrateMySQLStatusSlotResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPremierAddOn gets a named add-on of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. premierAddOnName is add-on name. -func (client AppsClient) GetPremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result PremierAddOn, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetPremierAddOn") - } - - req, err := client.GetPremierAddOnPreparer(resourceGroupName, name, premierAddOnName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", nil, "Failure preparing request") - return - } - - resp, err := client.GetPremierAddOnSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure sending request") - return - } - - result, err = client.GetPremierAddOnResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure responding to request") - } - - return -} - -// GetPremierAddOnPreparer prepares the GetPremierAddOn request. -func (client AppsClient) GetPremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPremierAddOnSender sends the GetPremierAddOn request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetPremierAddOnSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPremierAddOnResponder handles the response to the GetPremierAddOn request. The method always -// closes the http.Response Body. -func (client AppsClient) GetPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPremierAddOnSlot gets a named add-on of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. premierAddOnName is add-on name. slot is -// name of the deployment slot. If a slot is not specified, the API will get -// the named add-on for the production slot. -func (client AppsClient) GetPremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result PremierAddOn, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetPremierAddOnSlot") - } - - req, err := client.GetPremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetPremierAddOnSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure sending request") - return - } - - result, err = client.GetPremierAddOnSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure responding to request") - } - - return -} - -// GetPremierAddOnSlotPreparer prepares the GetPremierAddOnSlot request. -func (client AppsClient) GetPremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "premierAddOnName": autorest.Encode("path", premierAddOnName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPremierAddOnSlotSender sends the GetPremierAddOnSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPremierAddOnSlotResponder handles the response to the GetPremierAddOnSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRelayServiceConnection gets a hybrid connection configuration by its -// name. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection. -func (client AppsClient) GetRelayServiceConnection(resourceGroupName string, name string, entityName string) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetRelayServiceConnection") - } - - req, err := client.GetRelayServiceConnectionPreparer(resourceGroupName, name, entityName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", nil, "Failure preparing request") - return - } - - resp, err := client.GetRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure sending request") - return - } - - result, err = client.GetRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// GetRelayServiceConnectionPreparer prepares the GetRelayServiceConnection request. -func (client AppsClient) GetRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRelayServiceConnectionSender sends the GetRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRelayServiceConnectionResponder handles the response to the GetRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) GetRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRelayServiceConnectionSlot gets a hybrid connection configuration by its -// name. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection. slot is name of the deployment slot. If a slot is not specified, -// the API will get a hybrid connection for the production slot. -func (client AppsClient) GetRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetRelayServiceConnectionSlot") - } - - req, err := client.GetRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.GetRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// GetRelayServiceConnectionSlotPreparer prepares the GetRelayServiceConnectionSlot request. -func (client AppsClient) GetRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRelayServiceConnectionSlotSender sends the GetRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRelayServiceConnectionSlotResponder handles the response to the GetRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetResourceHealthMetadata gets the category of ResourceHealthMetadata to use -// for the given site -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app -func (client AppsClient) GetResourceHealthMetadata(resourceGroupName string, name string) (result ResourceHealthMetadata, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetResourceHealthMetadata") - } - - req, err := client.GetResourceHealthMetadataPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadata", nil, "Failure preparing request") - return - } - - resp, err := client.GetResourceHealthMetadataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadata", resp, "Failure sending request") - return - } - - result, err = client.GetResourceHealthMetadataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadata", resp, "Failure responding to request") - } - - return -} - -// GetResourceHealthMetadataPreparer prepares the GetResourceHealthMetadata request. -func (client AppsClient) GetResourceHealthMetadataPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetResourceHealthMetadataSender sends the GetResourceHealthMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetResourceHealthMetadataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResourceHealthMetadataResponder handles the response to the GetResourceHealthMetadata request. The method always -// closes the http.Response Body. -func (client AppsClient) GetResourceHealthMetadataResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetResourceHealthMetadataSlot gets the category of ResourceHealthMetadata to -// use for the given site -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of web app slot. If not -// specified then will default to production slot. -func (client AppsClient) GetResourceHealthMetadataSlot(resourceGroupName string, name string, slot string) (result ResourceHealthMetadata, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetResourceHealthMetadataSlot") - } - - req, err := client.GetResourceHealthMetadataSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadataSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetResourceHealthMetadataSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadataSlot", resp, "Failure sending request") - return - } - - result, err = client.GetResourceHealthMetadataSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadataSlot", resp, "Failure responding to request") - } - - return -} - -// GetResourceHealthMetadataSlotPreparer prepares the GetResourceHealthMetadataSlot request. -func (client AppsClient) GetResourceHealthMetadataSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetResourceHealthMetadataSlotSender sends the GetResourceHealthMetadataSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetResourceHealthMetadataSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResourceHealthMetadataSlotResponder handles the response to the GetResourceHealthMetadataSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetResourceHealthMetadataSlotResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSitePhpErrorLogFlag gets web app's event logs. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app -func (client AppsClient) GetSitePhpErrorLogFlag(resourceGroupName string, name string) (result SitePhpErrorLogFlag, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSitePhpErrorLogFlag") - } - - req, err := client.GetSitePhpErrorLogFlagPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", nil, "Failure preparing request") - return - } - - resp, err := client.GetSitePhpErrorLogFlagSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure sending request") - return - } - - result, err = client.GetSitePhpErrorLogFlagResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure responding to request") - } - - return -} - -// GetSitePhpErrorLogFlagPreparer prepares the GetSitePhpErrorLogFlag request. -func (client AppsClient) GetSitePhpErrorLogFlagPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSitePhpErrorLogFlagSender sends the GetSitePhpErrorLogFlag request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSitePhpErrorLogFlagSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSitePhpErrorLogFlagResponder handles the response to the GetSitePhpErrorLogFlag request. The method always -// closes the http.Response Body. -func (client AppsClient) GetSitePhpErrorLogFlagResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSitePhpErrorLogFlagSlot gets web app's event logs. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of web app slot. If not -// specified then will default to production slot. -func (client AppsClient) GetSitePhpErrorLogFlagSlot(resourceGroupName string, name string, slot string) (result SitePhpErrorLogFlag, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot") - } - - req, err := client.GetSitePhpErrorLogFlagSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetSitePhpErrorLogFlagSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure sending request") - return - } - - result, err = client.GetSitePhpErrorLogFlagSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure responding to request") - } - - return -} - -// GetSitePhpErrorLogFlagSlotPreparer prepares the GetSitePhpErrorLogFlagSlot request. -func (client AppsClient) GetSitePhpErrorLogFlagSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSitePhpErrorLogFlagSlotSender sends the GetSitePhpErrorLogFlagSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSitePhpErrorLogFlagSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSitePhpErrorLogFlagSlotResponder handles the response to the GetSitePhpErrorLogFlagSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetSitePhpErrorLogFlagSlotResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSlot gets the details of a web, mobile, or API app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. By -// default, this API returns the production slot. -func (client AppsClient) GetSlot(resourceGroupName string, name string, slot string) (result Site, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSlot") - } - - req, err := client.GetSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure sending request") - return - } - - result, err = client.GetSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure responding to request") - } - - return -} - -// GetSlotPreparer prepares the GetSlot request. -func (client AppsClient) GetSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSlotSender sends the GetSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSlotResponder handles the response to the GetSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetSlotResponder(resp *http.Response) (result Site, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSourceControl gets the source control configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) GetSourceControl(resourceGroupName string, name string) (result SiteSourceControl, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSourceControl") - } - - req, err := client.GetSourceControlPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", nil, "Failure preparing request") - return - } - - resp, err := client.GetSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure sending request") - return - } - - result, err = client.GetSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure responding to request") - } - - return -} - -// GetSourceControlPreparer prepares the GetSourceControl request. -func (client AppsClient) GetSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSourceControlSender sends the GetSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSourceControlResponder handles the response to the GetSourceControl request. The method always -// closes the http.Response Body. -func (client AppsClient) GetSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSourceControlSlot gets the source control configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the source control configuration for -// the production slot. -func (client AppsClient) GetSourceControlSlot(resourceGroupName string, name string, slot string) (result SiteSourceControl, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSourceControlSlot") - } - - req, err := client.GetSourceControlSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetSourceControlSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure sending request") - return - } - - result, err = client.GetSourceControlSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure responding to request") - } - - return -} - -// GetSourceControlSlotPreparer prepares the GetSourceControlSlot request. -func (client AppsClient) GetSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSourceControlSlotSender sends the GetSourceControlSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSourceControlSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSourceControlSlotResponder handles the response to the GetSourceControlSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetConnection gets a virtual network the app (or deployment slot) is -// connected to by name. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the virtual network. -func (client AppsClient) GetVnetConnection(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnection") - } - - req, err := client.GetVnetConnectionPreparer(resourceGroupName, name, vnetName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", nil, "Failure preparing request") - return - } - - resp, err := client.GetVnetConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure sending request") - return - } - - result, err = client.GetVnetConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure responding to request") - } - - return -} - -// GetVnetConnectionPreparer prepares the GetVnetConnection request. -func (client AppsClient) GetVnetConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetConnectionSender sends the GetVnetConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetVnetConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetConnectionResponder handles the response to the GetVnetConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) GetVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetConnectionGateway gets an app's Virtual Network gateway. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the Virtual Network. -// gatewayName is name of the gateway. Currently, the only supported string is -// "primary". -func (client AppsClient) GetVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionGateway") - } - - req, err := client.GetVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", nil, "Failure preparing request") - return - } - - resp, err := client.GetVnetConnectionGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure sending request") - return - } - - result, err = client.GetVnetConnectionGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure responding to request") - } - - return -} - -// GetVnetConnectionGatewayPreparer prepares the GetVnetConnectionGateway request. -func (client AppsClient) GetVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetConnectionGatewaySender sends the GetVnetConnectionGateway request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetConnectionGatewayResponder handles the response to the GetVnetConnectionGateway request. The method always -// closes the http.Response Body. -func (client AppsClient) GetVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetConnectionGatewaySlot gets an app's Virtual Network gateway. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the Virtual Network. -// gatewayName is name of the gateway. Currently, the only supported string is -// "primary". slot is name of the deployment slot. If a slot is not specified, -// the API will get a gateway for the production slot's Virtual Network. -func (client AppsClient) GetVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot") - } - - req, err := client.GetVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetVnetConnectionGatewaySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure sending request") - return - } - - result, err = client.GetVnetConnectionGatewaySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure responding to request") - } - - return -} - -// GetVnetConnectionGatewaySlotPreparer prepares the GetVnetConnectionGatewaySlot request. -func (client AppsClient) GetVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetConnectionGatewaySlotSender sends the GetVnetConnectionGatewaySlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetConnectionGatewaySlotResponder handles the response to the GetVnetConnectionGatewaySlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetConnectionSlot gets a virtual network the app (or deployment slot) is -// connected to by name. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the virtual network. -// slot is name of the deployment slot. If a slot is not specified, the API -// will get the named virtual network for the production slot. -func (client AppsClient) GetVnetConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionSlot") - } - - req, err := client.GetVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.GetVnetConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.GetVnetConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// GetVnetConnectionSlotPreparer prepares the GetVnetConnectionSlot request. -func (client AppsClient) GetVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetConnectionSlotSender sends the GetVnetConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetConnectionSlotResponder handles the response to the GetVnetConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) GetVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsCloneable shows whether an app can be cloned to another resource group or -// subscription. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) IsCloneable(resourceGroupName string, name string) (result SiteCloneability, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "IsCloneable") - } - - req, err := client.IsCloneablePreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", nil, "Failure preparing request") - return - } - - resp, err := client.IsCloneableSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure sending request") - return - } - - result, err = client.IsCloneableResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure responding to request") - } - - return -} - -// IsCloneablePreparer prepares the IsCloneable request. -func (client AppsClient) IsCloneablePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsCloneableSender sends the IsCloneable request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) IsCloneableSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsCloneableResponder handles the response to the IsCloneable request. The method always -// closes the http.Response Body. -func (client AppsClient) IsCloneableResponder(resp *http.Response) (result SiteCloneability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsCloneableSlot shows whether an app can be cloned to another resource group -// or subscription. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. By -// default, this API returns information on the production slot. -func (client AppsClient) IsCloneableSlot(resourceGroupName string, name string, slot string) (result SiteCloneability, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "IsCloneableSlot") - } - - req, err := client.IsCloneableSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", nil, "Failure preparing request") - return - } - - resp, err := client.IsCloneableSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure sending request") - return - } - - result, err = client.IsCloneableSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure responding to request") - } - - return -} - -// IsCloneableSlotPreparer prepares the IsCloneableSlot request. -func (client AppsClient) IsCloneableSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// IsCloneableSlotSender sends the IsCloneableSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) IsCloneableSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// IsCloneableSlotResponder handles the response to the IsCloneableSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) IsCloneableSlotResponder(resp *http.Response) (result SiteCloneability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all apps for a subscription. -func (client AppsClient) List() (result AppCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AppsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppsClient) ListResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AppsClient) ListNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListApplicationSettings gets the application settings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListApplicationSettings(resourceGroupName string, name string) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListApplicationSettings") - } - - req, err := client.ListApplicationSettingsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicationSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure sending request") - return - } - - result, err = client.ListApplicationSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure responding to request") - } - - return -} - -// ListApplicationSettingsPreparer prepares the ListApplicationSettings request. -func (client AppsClient) ListApplicationSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListApplicationSettingsSender sends the ListApplicationSettings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListApplicationSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListApplicationSettingsResponder handles the response to the ListApplicationSettings request. The method always -// closes the http.Response Body. -func (client AppsClient) ListApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListApplicationSettingsSlot gets the application settings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the application settings for the -// production slot. -func (client AppsClient) ListApplicationSettingsSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListApplicationSettingsSlot") - } - - req, err := client.ListApplicationSettingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListApplicationSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListApplicationSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// ListApplicationSettingsSlotPreparer prepares the ListApplicationSettingsSlot request. -func (client AppsClient) ListApplicationSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListApplicationSettingsSlotSender sends the ListApplicationSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListApplicationSettingsSlotResponder handles the response to the ListApplicationSettingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBackups gets existing backups of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListBackups(resourceGroupName string, name string) (result BackupItemCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackups") - } - - req, err := client.ListBackupsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing request") - return - } - - resp, err := client.ListBackupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending request") - return - } - - result, err = client.ListBackupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to request") - } - - return -} - -// ListBackupsPreparer prepares the ListBackups request. -func (client AppsClient) ListBackupsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBackupsSender sends the ListBackups request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListBackupsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBackupsResponder handles the response to the ListBackups request. The method always -// closes the http.Response Body. -func (client AppsClient) ListBackupsResponder(resp *http.Response) (result BackupItemCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBackupsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListBackupsNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { - req, err := lastResults.BackupItemCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBackupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending next results request") - } - - result, err = client.ListBackupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to next results request") - } - - return -} - -// ListBackupsSlot gets existing backups of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get backups of the production slot. -func (client AppsClient) ListBackupsSlot(resourceGroupName string, name string, slot string) (result BackupItemCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupsSlot") - } - - req, err := client.ListBackupsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListBackupsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListBackupsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to request") - } - - return -} - -// ListBackupsSlotPreparer prepares the ListBackupsSlot request. -func (client AppsClient) ListBackupsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBackupsSlotSender sends the ListBackupsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListBackupsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBackupsSlotResponder handles the response to the ListBackupsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListBackupsSlotResponder(resp *http.Response) (result BackupItemCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBackupsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListBackupsSlotNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { - req, err := lastResults.BackupItemCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListBackupsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListBackupsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListBackupStatusSecrets gets status of a web app backup that may be in -// progress, including secrets associated with the backup, such as the Azure -// Storage SAS URL. Also can be used to update the SAS URL for the backup if a -// new URL is passed in the request body. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app backupID is id of backup request is -// information on backup request -func (client AppsClient) ListBackupStatusSecrets(resourceGroupName string, name string, backupID string, request BackupRequest) (result BackupItem, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupStatusSecrets") - } - - req, err := client.ListBackupStatusSecretsPreparer(resourceGroupName, name, backupID, request) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListBackupStatusSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListBackupStatusSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure responding to request") - } - - return -} - -// ListBackupStatusSecretsPreparer prepares the ListBackupStatusSecrets request. -func (client AppsClient) ListBackupStatusSecretsPreparer(resourceGroupName string, name string, backupID string, request BackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBackupStatusSecretsSender sends the ListBackupStatusSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListBackupStatusSecretsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBackupStatusSecretsResponder handles the response to the ListBackupStatusSecrets request. The method always -// closes the http.Response Body. -func (client AppsClient) ListBackupStatusSecretsResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBackupStatusSecretsSlot gets status of a web app backup that may be in -// progress, including secrets associated with the backup, such as the Azure -// Storage SAS URL. Also can be used to update the SAS URL for the backup if a -// new URL is passed in the request body. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app backupID is id of backup request is -// information on backup request slot is name of web app slot. If not specified -// then will default to production slot. -func (client AppsClient) ListBackupStatusSecretsSlot(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (result BackupItem, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupStatusSecretsSlot") - } - - req, err := client.ListBackupStatusSecretsSlotPreparer(resourceGroupName, name, backupID, request, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListBackupStatusSecretsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListBackupStatusSecretsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure responding to request") - } - - return -} - -// ListBackupStatusSecretsSlotPreparer prepares the ListBackupStatusSecretsSlot request. -func (client AppsClient) ListBackupStatusSecretsSlotPreparer(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListBackupStatusSecretsSlotSender sends the ListBackupStatusSecretsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListBackupStatusSecretsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListBackupStatusSecretsSlotResponder handles the response to the ListBackupStatusSecretsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListBackupStatusSecretsSlotResponder(resp *http.Response) (result BackupItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all web, mobile, and API apps in the specified -// resource group. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. includeSlots is specify true to include deployment -// slots in results. The default is false, which only gives you the production -// slot of all apps. -func (client AppsClient) ListByResourceGroup(resourceGroupName string, includeSlots *bool) (result AppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName, includeSlots) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AppsClient) ListByResourceGroupPreparer(resourceGroupName string, includeSlots *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if includeSlots != nil { - queryParameters["includeSlots"] = autorest.Encode("query", *includeSlots) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AppsClient) ListByResourceGroupResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AppsClient) ListByResourceGroupNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListConfigurations list the configurations of an app -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListConfigurations(resourceGroupName string, name string) (result SiteConfigResourceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurations") - } - - req, err := client.ListConfigurationsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", nil, "Failure preparing request") - return - } - - resp, err := client.ListConfigurationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure sending request") - return - } - - result, err = client.ListConfigurationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure responding to request") - } - - return -} - -// ListConfigurationsPreparer prepares the ListConfigurations request. -func (client AppsClient) ListConfigurationsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConfigurationsSender sends the ListConfigurations request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListConfigurationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConfigurationsResponder handles the response to the ListConfigurations request. The method always -// closes the http.Response Body. -func (client AppsClient) ListConfigurationsResponder(resp *http.Response) (result SiteConfigResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConfigurationsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListConfigurationsNextResults(lastResults SiteConfigResourceCollection) (result SiteConfigResourceCollection, err error) { - req, err := lastResults.SiteConfigResourceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListConfigurationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure sending next results request") - } - - result, err = client.ListConfigurationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure responding to next results request") - } - - return -} - -// ListConfigurationSnapshotInfo gets a list of web app configuration snapshots -// identifiers. Each element of the list contains a timestamp and the ID of the -// snapshot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListConfigurationSnapshotInfo(resourceGroupName string, name string) (result ListSiteConfigurationSnapshotInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationSnapshotInfo") - } - - req, err := client.ListConfigurationSnapshotInfoPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", nil, "Failure preparing request") - return - } - - resp, err := client.ListConfigurationSnapshotInfoSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure sending request") - return - } - - result, err = client.ListConfigurationSnapshotInfoResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure responding to request") - } - - return -} - -// ListConfigurationSnapshotInfoPreparer prepares the ListConfigurationSnapshotInfo request. -func (client AppsClient) ListConfigurationSnapshotInfoPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConfigurationSnapshotInfoSender sends the ListConfigurationSnapshotInfo request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListConfigurationSnapshotInfoSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConfigurationSnapshotInfoResponder handles the response to the ListConfigurationSnapshotInfo request. The method always -// closes the http.Response Body. -func (client AppsClient) ListConfigurationSnapshotInfoResponder(resp *http.Response) (result ListSiteConfigurationSnapshotInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConfigurationSnapshotInfoSlot gets a list of web app configuration -// snapshots identifiers. Each element of the list contains a timestamp and the -// ID of the snapshot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will return configuration for the production -// slot. -func (client AppsClient) ListConfigurationSnapshotInfoSlot(resourceGroupName string, name string, slot string) (result ListSiteConfigurationSnapshotInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot") - } - - req, err := client.ListConfigurationSnapshotInfoSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListConfigurationSnapshotInfoSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure sending request") - return - } - - result, err = client.ListConfigurationSnapshotInfoSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure responding to request") - } - - return -} - -// ListConfigurationSnapshotInfoSlotPreparer prepares the ListConfigurationSnapshotInfoSlot request. -func (client AppsClient) ListConfigurationSnapshotInfoSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConfigurationSnapshotInfoSlotSender sends the ListConfigurationSnapshotInfoSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListConfigurationSnapshotInfoSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConfigurationSnapshotInfoSlotResponder handles the response to the ListConfigurationSnapshotInfoSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListConfigurationSnapshotInfoSlotResponder(resp *http.Response) (result ListSiteConfigurationSnapshotInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConfigurationsSlot list the configurations of an app -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will return configuration for the production -// slot. -func (client AppsClient) ListConfigurationsSlot(resourceGroupName string, name string, slot string) (result SiteConfigResourceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationsSlot") - } - - req, err := client.ListConfigurationsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListConfigurationsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListConfigurationsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure responding to request") - } - - return -} - -// ListConfigurationsSlotPreparer prepares the ListConfigurationsSlot request. -func (client AppsClient) ListConfigurationsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConfigurationsSlotSender sends the ListConfigurationsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListConfigurationsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConfigurationsSlotResponder handles the response to the ListConfigurationsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListConfigurationsSlotResponder(resp *http.Response) (result SiteConfigResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConfigurationsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListConfigurationsSlotNextResults(lastResults SiteConfigResourceCollection) (result SiteConfigResourceCollection, err error) { - req, err := lastResults.SiteConfigResourceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListConfigurationsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListConfigurationsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListConnectionStrings gets the connection strings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListConnectionStrings(resourceGroupName string, name string) (result ConnectionStringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConnectionStrings") - } - - req, err := client.ListConnectionStringsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure responding to request") - } - - return -} - -// ListConnectionStringsPreparer prepares the ListConnectionStrings request. -func (client AppsClient) ListConnectionStringsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always -// closes the http.Response Body. -func (client AppsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListConnectionStringsSlot gets the connection strings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the connection settings for the -// production slot. -func (client AppsClient) ListConnectionStringsSlot(resourceGroupName string, name string, slot string) (result ConnectionStringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConnectionStringsSlot") - } - - req, err := client.ListConnectionStringsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListConnectionStringsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListConnectionStringsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure responding to request") - } - - return -} - -// ListConnectionStringsSlotPreparer prepares the ListConnectionStringsSlot request. -func (client AppsClient) ListConnectionStringsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListConnectionStringsSlotSender sends the ListConnectionStringsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListConnectionStringsSlotResponder handles the response to the ListConnectionStringsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDeployments list deployments for an app, or a deployment slot, or for an -// instance of a scaled-out app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListDeployments(resourceGroupName string, name string) (result DeploymentCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDeployments") - } - - req, err := client.ListDeploymentsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing request") - return - } - - resp, err := client.ListDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending request") - return - } - - result, err = client.ListDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to request") - } - - return -} - -// ListDeploymentsPreparer prepares the ListDeployments request. -func (client AppsClient) ListDeploymentsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDeploymentsSender sends the ListDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListDeploymentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDeploymentsResponder handles the response to the ListDeployments request. The method always -// closes the http.Response Body. -func (client AppsClient) ListDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDeploymentsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending next results request") - } - - result, err = client.ListDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to next results request") - } - - return -} - -// ListDeploymentsSlot list deployments for an app, or a deployment slot, or -// for an instance of a scaled-out app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API returns deployments for the production slot. -func (client AppsClient) ListDeploymentsSlot(resourceGroupName string, name string, slot string) (result DeploymentCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDeploymentsSlot") - } - - req, err := client.ListDeploymentsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to request") - } - - return -} - -// ListDeploymentsSlotPreparer prepares the ListDeploymentsSlot request. -func (client AppsClient) ListDeploymentsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDeploymentsSlotSender sends the ListDeploymentsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListDeploymentsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDeploymentsSlotResponder handles the response to the ListDeploymentsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDeploymentsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListDomainOwnershipIdentifiers lists ownership identifiers for domain -// associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListDomainOwnershipIdentifiers(resourceGroupName string, name string) (result IdentifierCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers") - } - - req, err := client.ListDomainOwnershipIdentifiersPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing request") - return - } - - resp, err := client.ListDomainOwnershipIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending request") - return - } - - result, err = client.ListDomainOwnershipIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to request") - } - - return -} - -// ListDomainOwnershipIdentifiersPreparer prepares the ListDomainOwnershipIdentifiers request. -func (client AppsClient) ListDomainOwnershipIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDomainOwnershipIdentifiersSender sends the ListDomainOwnershipIdentifiers request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListDomainOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDomainOwnershipIdentifiersResponder handles the response to the ListDomainOwnershipIdentifiers request. The method always -// closes the http.Response Body. -func (client AppsClient) ListDomainOwnershipIdentifiersResponder(resp *http.Response) (result IdentifierCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDomainOwnershipIdentifiersNextResults retrieves the next set of results, if any. -func (client AppsClient) ListDomainOwnershipIdentifiersNextResults(lastResults IdentifierCollection) (result IdentifierCollection, err error) { - req, err := lastResults.IdentifierCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListDomainOwnershipIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending next results request") - } - - result, err = client.ListDomainOwnershipIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to next results request") - } - - return -} - -// ListDomainOwnershipIdentifiersSlot lists ownership identifiers for domain -// associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will delete the binding for the production -// slot. -func (client AppsClient) ListDomainOwnershipIdentifiersSlot(resourceGroupName string, name string, slot string) (result IdentifierCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot") - } - - req, err := client.ListDomainOwnershipIdentifiersSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending request") - return - } - - result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to request") - } - - return -} - -// ListDomainOwnershipIdentifiersSlotPreparer prepares the ListDomainOwnershipIdentifiersSlot request. -func (client AppsClient) ListDomainOwnershipIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDomainOwnershipIdentifiersSlotSender sends the ListDomainOwnershipIdentifiersSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListDomainOwnershipIdentifiersSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDomainOwnershipIdentifiersSlotResponder handles the response to the ListDomainOwnershipIdentifiersSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListDomainOwnershipIdentifiersSlotResponder(resp *http.Response) (result IdentifierCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDomainOwnershipIdentifiersSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListDomainOwnershipIdentifiersSlotNextResults(lastResults IdentifierCollection) (result IdentifierCollection, err error) { - req, err := lastResults.IdentifierCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending next results request") - } - - result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListHostNameBindings get hostname bindings for an app or a deployment slot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListHostNameBindings(resourceGroupName string, name string) (result HostNameBindingCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHostNameBindings") - } - - req, err := client.ListHostNameBindingsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing request") - return - } - - resp, err := client.ListHostNameBindingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending request") - return - } - - result, err = client.ListHostNameBindingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to request") - } - - return -} - -// ListHostNameBindingsPreparer prepares the ListHostNameBindings request. -func (client AppsClient) ListHostNameBindingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHostNameBindingsSender sends the ListHostNameBindings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListHostNameBindingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHostNameBindingsResponder handles the response to the ListHostNameBindings request. The method always -// closes the http.Response Body. -func (client AppsClient) ListHostNameBindingsResponder(resp *http.Response) (result HostNameBindingCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHostNameBindingsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListHostNameBindingsNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { - req, err := lastResults.HostNameBindingCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListHostNameBindingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending next results request") - } - - result, err = client.ListHostNameBindingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to next results request") - } - - return -} - -// ListHostNameBindingsSlot get hostname bindings for an app or a deployment -// slot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API gets hostname bindings for the production -// slot. -func (client AppsClient) ListHostNameBindingsSlot(resourceGroupName string, name string, slot string) (result HostNameBindingCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHostNameBindingsSlot") - } - - req, err := client.ListHostNameBindingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListHostNameBindingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListHostNameBindingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to request") - } - - return -} - -// ListHostNameBindingsSlotPreparer prepares the ListHostNameBindingsSlot request. -func (client AppsClient) ListHostNameBindingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHostNameBindingsSlotSender sends the ListHostNameBindingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListHostNameBindingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHostNameBindingsSlotResponder handles the response to the ListHostNameBindingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListHostNameBindingsSlotResponder(resp *http.Response) (result HostNameBindingCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHostNameBindingsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListHostNameBindingsSlotNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { - req, err := lastResults.HostNameBindingCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListHostNameBindingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListHostNameBindingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListHybridConnectionKeys gets the send key name and value for a Hybrid -// Connection. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection -func (client AppsClient) ListHybridConnectionKeys(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionKeys") - } - - req, err := client.ListHybridConnectionKeysPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListHybridConnectionKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", resp, "Failure sending request") - return - } - - result, err = client.ListHybridConnectionKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", resp, "Failure responding to request") - } - - return -} - -// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. -func (client AppsClient) ListHybridConnectionKeysPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always -// closes the http.Response Body. -func (client AppsClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHybridConnectionKeysSlot gets the send key name and value for a Hybrid -// Connection. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection slot is the name of the slot for the web app. -func (client AppsClient) ListHybridConnectionKeysSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnectionKey, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionKeysSlot") - } - - req, err := client.ListHybridConnectionKeysSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListHybridConnectionKeysSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", resp, "Failure sending request") - return - } - - result, err = client.ListHybridConnectionKeysSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", resp, "Failure responding to request") - } - - return -} - -// ListHybridConnectionKeysSlotPreparer prepares the ListHybridConnectionKeysSlot request. -func (client AppsClient) ListHybridConnectionKeysSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHybridConnectionKeysSlotSender sends the ListHybridConnectionKeysSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListHybridConnectionKeysSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHybridConnectionKeysSlotResponder handles the response to the ListHybridConnectionKeysSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListHybridConnectionKeysSlotResponder(resp *http.Response) (result HybridConnectionKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHybridConnections retrieves all Service Bus Hybrid Connections used by -// this Web App. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app -func (client AppsClient) ListHybridConnections(resourceGroupName string, name string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnections") - } - - req, err := client.ListHybridConnectionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListHybridConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure sending request") - return - } - - result, err = client.ListHybridConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure responding to request") - } - - return -} - -// ListHybridConnectionsPreparer prepares the ListHybridConnections request. -func (client AppsClient) ListHybridConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always -// closes the http.Response Body. -func (client AppsClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHybridConnectionsSlot retrieves all Service Bus Hybrid Connections used -// by this Web App. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app slot is the name of the slot for -// the web app. -func (client AppsClient) ListHybridConnectionsSlot(resourceGroupName string, name string, slot string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionsSlot") - } - - req, err := client.ListHybridConnectionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListHybridConnectionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListHybridConnectionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure responding to request") - } - - return -} - -// ListHybridConnectionsSlotPreparer prepares the ListHybridConnectionsSlot request. -func (client AppsClient) ListHybridConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHybridConnectionsSlotSender sends the ListHybridConnectionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListHybridConnectionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHybridConnectionsSlotResponder handles the response to the ListHybridConnectionsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListHybridConnectionsSlotResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInstanceDeployments list deployments for an app, or a deployment slot, -// or for an instance of a scaled-out app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. instanceID is the ID of a specific -// scaled-out instance. This is the value of the name property in the JSON -// response from "GET api/sites/{siteName}/instances" -func (client AppsClient) ListInstanceDeployments(resourceGroupName string, name string, instanceID string) (result DeploymentCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceDeployments") - } - - req, err := client.ListInstanceDeploymentsPreparer(resourceGroupName, name, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", nil, "Failure preparing request") - return - } - - resp, err := client.ListInstanceDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure sending request") - return - } - - result, err = client.ListInstanceDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure responding to request") - } - - return -} - -// ListInstanceDeploymentsPreparer prepares the ListInstanceDeployments request. -func (client AppsClient) ListInstanceDeploymentsPreparer(resourceGroupName string, name string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListInstanceDeploymentsSender sends the ListInstanceDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListInstanceDeploymentsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListInstanceDeploymentsResponder handles the response to the ListInstanceDeployments request. The method always -// closes the http.Response Body. -func (client AppsClient) ListInstanceDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInstanceDeploymentsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListInstanceDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListInstanceDeploymentsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure sending next results request") - } - - result, err = client.ListInstanceDeploymentsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure responding to next results request") - } - - return -} - -// ListInstanceDeploymentsSlot list deployments for an app, or a deployment -// slot, or for an instance of a scaled-out app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API returns deployments for the production slot. -// instanceID is the ID of a specific scaled-out instance. This is the value of -// the name property in the JSON response from "GET -// api/sites/{siteName}/instances" -func (client AppsClient) ListInstanceDeploymentsSlot(resourceGroupName string, name string, slot string, instanceID string) (result DeploymentCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceDeploymentsSlot") - } - - req, err := client.ListInstanceDeploymentsSlotPreparer(resourceGroupName, name, slot, instanceID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListInstanceDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListInstanceDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure responding to request") - } - - return -} - -// ListInstanceDeploymentsSlotPreparer prepares the ListInstanceDeploymentsSlot request. -func (client AppsClient) ListInstanceDeploymentsSlotPreparer(resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instanceId": autorest.Encode("path", instanceID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListInstanceDeploymentsSlotSender sends the ListInstanceDeploymentsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListInstanceDeploymentsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListInstanceDeploymentsSlotResponder handles the response to the ListInstanceDeploymentsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListInstanceDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInstanceDeploymentsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListInstanceDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { - req, err := lastResults.DeploymentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListInstanceDeploymentsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListInstanceDeploymentsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListInstanceIdentifiers gets all scale-out instances of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListInstanceIdentifiers(resourceGroupName string, name string) (result AppInstanceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceIdentifiers") - } - - req, err := client.ListInstanceIdentifiersPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing request") - return - } - - resp, err := client.ListInstanceIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending request") - return - } - - result, err = client.ListInstanceIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to request") - } - - return -} - -// ListInstanceIdentifiersPreparer prepares the ListInstanceIdentifiers request. -func (client AppsClient) ListInstanceIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListInstanceIdentifiersSender sends the ListInstanceIdentifiers request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListInstanceIdentifiersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListInstanceIdentifiersResponder handles the response to the ListInstanceIdentifiers request. The method always -// closes the http.Response Body. -func (client AppsClient) ListInstanceIdentifiersResponder(resp *http.Response) (result AppInstanceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInstanceIdentifiersNextResults retrieves the next set of results, if any. -func (client AppsClient) ListInstanceIdentifiersNextResults(lastResults AppInstanceCollection) (result AppInstanceCollection, err error) { - req, err := lastResults.AppInstanceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListInstanceIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending next results request") - } - - result, err = client.ListInstanceIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to next results request") - } - - return -} - -// ListInstanceIdentifiersSlot gets all scale-out instances of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API gets the production slot instances. -func (client AppsClient) ListInstanceIdentifiersSlot(resourceGroupName string, name string, slot string) (result AppInstanceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceIdentifiersSlot") - } - - req, err := client.ListInstanceIdentifiersSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListInstanceIdentifiersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending request") - return - } - - result, err = client.ListInstanceIdentifiersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to request") - } - - return -} - -// ListInstanceIdentifiersSlotPreparer prepares the ListInstanceIdentifiersSlot request. -func (client AppsClient) ListInstanceIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListInstanceIdentifiersSlotSender sends the ListInstanceIdentifiersSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListInstanceIdentifiersSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListInstanceIdentifiersSlotResponder handles the response to the ListInstanceIdentifiersSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListInstanceIdentifiersSlotResponder(resp *http.Response) (result AppInstanceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListInstanceIdentifiersSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListInstanceIdentifiersSlotNextResults(lastResults AppInstanceCollection) (result AppInstanceCollection, err error) { - req, err := lastResults.AppInstanceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListInstanceIdentifiersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending next results request") - } - - result, err = client.ListInstanceIdentifiersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListMetadata gets the metadata of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListMetadata(resourceGroupName string, name string) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetadata") - } - - req, err := client.ListMetadataPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetadataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure sending request") - return - } - - result, err = client.ListMetadataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure responding to request") - } - - return -} - -// ListMetadataPreparer prepares the ListMetadata request. -func (client AppsClient) ListMetadataPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetadataSender sends the ListMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListMetadataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetadataResponder handles the response to the ListMetadata request. The method always -// closes the http.Response Body. -func (client AppsClient) ListMetadataResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetadataSlot gets the metadata of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the metadata for the production -// slot. -func (client AppsClient) ListMetadataSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetadataSlot") - } - - req, err := client.ListMetadataSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetadataSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure sending request") - return - } - - result, err = client.ListMetadataSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure responding to request") - } - - return -} - -// ListMetadataSlotPreparer prepares the ListMetadataSlot request. -func (client AppsClient) ListMetadataSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetadataSlotSender sends the ListMetadataSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListMetadataSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetadataSlotResponder handles the response to the ListMetadataSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions gets all metric definitions of an app (or deployment -// slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListMetricDefinitions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricDefinitions") - } - - req, err := client.ListMetricDefinitionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client AppsClient) ListMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client AppsClient) ListMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// ListMetricDefinitionsSlot gets all metric definitions of an app (or -// deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get metric definitions of the production -// slot. -func (client AppsClient) ListMetricDefinitionsSlot(resourceGroupName string, name string, slot string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricDefinitionsSlot") - } - - req, err := client.ListMetricDefinitionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure responding to request") - } - - return -} - -// ListMetricDefinitionsSlotPreparer prepares the ListMetricDefinitionsSlot request. -func (client AppsClient) ListMetricDefinitionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricDefinitionsSlotSender sends the ListMetricDefinitionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListMetricDefinitionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricDefinitionsSlotResponder handles the response to the ListMetricDefinitionsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListMetricDefinitionsSlotResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitionsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListMetricDefinitionsSlotNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricDefinitionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListMetricDefinitionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListMetrics gets performance metrics of an app (or deployment slot, if -// specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. details is specify "true" to include -// metric details in the response. It is "false" by default. filter is return -// only metrics specified in the filter (using OData syntax). For example: -// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime -// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and -// timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppsClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetrics") - } - - req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client AppsClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client AppsClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListMetricsSlot gets performance metrics of an app (or deployment slot, if -// specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get metrics of the production slot. -// details is specify "true" to include metric details in the response. It is -// "false" by default. filter is return only metrics specified in the filter -// (using OData syntax). For example: $filter=(name.value eq 'Metric1' or -// name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime -// eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppsClient) ListMetricsSlot(resourceGroupName string, name string, slot string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricsSlot") - } - - req, err := client.ListMetricsSlotPreparer(resourceGroupName, name, slot, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure responding to request") - } - - return -} - -// ListMetricsSlotPreparer prepares the ListMetricsSlot request. -func (client AppsClient) ListMetricsSlotPreparer(resourceGroupName string, name string, slot string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricsSlotSender sends the ListMetricsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListMetricsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricsSlotResponder handles the response to the ListMetricsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListMetricsSlotResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListMetricsSlotNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListMetricsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListNetworkFeatures gets all network features used by the app (or deployment -// slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. view is the type of view. This can either -// be "summary" or "detailed". -func (client AppsClient) ListNetworkFeatures(resourceGroupName string, name string, view string) (result NetworkFeatures, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListNetworkFeatures") - } - - req, err := client.ListNetworkFeaturesPreparer(resourceGroupName, name, view) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", nil, "Failure preparing request") - return - } - - resp, err := client.ListNetworkFeaturesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure sending request") - return - } - - result, err = client.ListNetworkFeaturesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure responding to request") - } - - return -} - -// ListNetworkFeaturesPreparer prepares the ListNetworkFeatures request. -func (client AppsClient) ListNetworkFeaturesPreparer(resourceGroupName string, name string, view string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "view": autorest.Encode("path", view), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListNetworkFeaturesSender sends the ListNetworkFeatures request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListNetworkFeaturesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListNetworkFeaturesResponder handles the response to the ListNetworkFeatures request. The method always -// closes the http.Response Body. -func (client AppsClient) ListNetworkFeaturesResponder(resp *http.Response) (result NetworkFeatures, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNetworkFeaturesSlot gets all network features used by the app (or -// deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. view is the type of view. This can either -// be "summary" or "detailed". slot is name of the deployment slot. If a slot -// is not specified, the API will get network features for the production slot. -func (client AppsClient) ListNetworkFeaturesSlot(resourceGroupName string, name string, view string, slot string) (result NetworkFeatures, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListNetworkFeaturesSlot") - } - - req, err := client.ListNetworkFeaturesSlotPreparer(resourceGroupName, name, view, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListNetworkFeaturesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure sending request") - return - } - - result, err = client.ListNetworkFeaturesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure responding to request") - } - - return -} - -// ListNetworkFeaturesSlotPreparer prepares the ListNetworkFeaturesSlot request. -func (client AppsClient) ListNetworkFeaturesSlotPreparer(resourceGroupName string, name string, view string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "view": autorest.Encode("path", view), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListNetworkFeaturesSlotSender sends the ListNetworkFeaturesSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListNetworkFeaturesSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListNetworkFeaturesSlotResponder handles the response to the ListNetworkFeaturesSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListNetworkFeaturesSlotResponder(resp *http.Response) (result NetworkFeatures, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPerfMonCounters gets perfmon counters for web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app filter is return only usages/metrics -// specified in the filter. Filter conforms to odata syntax. Example: -// $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppsClient) ListPerfMonCounters(resourceGroupName string, name string, filter string) (result PerfMonCounterCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPerfMonCounters") - } - - req, err := client.ListPerfMonCountersPreparer(resourceGroupName, name, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing request") - return - } - - resp, err := client.ListPerfMonCountersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending request") - return - } - - result, err = client.ListPerfMonCountersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to request") - } - - return -} - -// ListPerfMonCountersPreparer prepares the ListPerfMonCounters request. -func (client AppsClient) ListPerfMonCountersPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPerfMonCountersSender sends the ListPerfMonCounters request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPerfMonCountersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPerfMonCountersResponder handles the response to the ListPerfMonCounters request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPerfMonCountersResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPerfMonCountersNextResults retrieves the next set of results, if any. -func (client AppsClient) ListPerfMonCountersNextResults(lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { - req, err := lastResults.PerfMonCounterCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListPerfMonCountersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending next results request") - } - - result, err = client.ListPerfMonCountersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to next results request") - } - - return -} - -// ListPerfMonCountersSlot gets perfmon counters for web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of web app slot. If not -// specified then will default to production slot. **** CURRENTLY UNUSED ***** -// filter is return only usages/metrics specified in the filter. Filter -// conforms to odata syntax. Example: $filter=(startTime eq -// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain -// eq duration'[Hour|Minute|Day]'. -func (client AppsClient) ListPerfMonCountersSlot(resourceGroupName string, name string, slot string, filter string) (result PerfMonCounterCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPerfMonCountersSlot") - } - - req, err := client.ListPerfMonCountersSlotPreparer(resourceGroupName, name, slot, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListPerfMonCountersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending request") - return - } - - result, err = client.ListPerfMonCountersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to request") - } - - return -} - -// ListPerfMonCountersSlotPreparer prepares the ListPerfMonCountersSlot request. -func (client AppsClient) ListPerfMonCountersSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPerfMonCountersSlotSender sends the ListPerfMonCountersSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPerfMonCountersSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPerfMonCountersSlotResponder handles the response to the ListPerfMonCountersSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPerfMonCountersSlotResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPerfMonCountersSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListPerfMonCountersSlotNextResults(lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { - req, err := lastResults.PerfMonCounterCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListPerfMonCountersSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending next results request") - } - - result, err = client.ListPerfMonCountersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListPremierAddOns gets the premier add-ons of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListPremierAddOns(resourceGroupName string, name string) (result PremierAddOn, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPremierAddOns") - } - - req, err := client.ListPremierAddOnsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", nil, "Failure preparing request") - return - } - - resp, err := client.ListPremierAddOnsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure sending request") - return - } - - result, err = client.ListPremierAddOnsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure responding to request") - } - - return -} - -// ListPremierAddOnsPreparer prepares the ListPremierAddOns request. -func (client AppsClient) ListPremierAddOnsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPremierAddOnsSender sends the ListPremierAddOns request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPremierAddOnsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPremierAddOnsResponder handles the response to the ListPremierAddOns request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPremierAddOnsResponder(resp *http.Response) (result PremierAddOn, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPremierAddOnsSlot gets the premier add-ons of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the premier add-ons for the -// production slot. -func (client AppsClient) ListPremierAddOnsSlot(resourceGroupName string, name string, slot string) (result PremierAddOn, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPremierAddOnsSlot") - } - - req, err := client.ListPremierAddOnsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListPremierAddOnsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListPremierAddOnsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure responding to request") - } - - return -} - -// ListPremierAddOnsSlotPreparer prepares the ListPremierAddOnsSlot request. -func (client AppsClient) ListPremierAddOnsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPremierAddOnsSlotSender sends the ListPremierAddOnsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPremierAddOnsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPremierAddOnsSlotResponder handles the response to the ListPremierAddOnsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPremierAddOnsSlotResponder(resp *http.Response) (result PremierAddOn, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPublishingCredentials gets the Git/FTP publishing credentials of an app. -// This method may poll for completion. Polling can be canceled by passing the -// cancel channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListPublishingCredentials(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan User, <-chan error) { - resultChan := make(chan User, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingCredentials") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result User - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ListPublishingCredentialsPreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListPublishingCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListPublishingCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ListPublishingCredentialsPreparer prepares the ListPublishingCredentials request. -func (client AppsClient) ListPublishingCredentialsPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListPublishingCredentialsSender sends the ListPublishingCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPublishingCredentialsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListPublishingCredentialsResponder handles the response to the ListPublishingCredentials request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPublishingCredentialsResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPublishingCredentialsSlot gets the Git/FTP publishing credentials of an -// app. This method may poll for completion. Polling can be canceled by passing -// the cancel channel argument. The channel will be used to cancel polling and -// any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get the publishing credentials for the -// production slot. -func (client AppsClient) ListPublishingCredentialsSlot(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (<-chan User, <-chan error) { - resultChan := make(chan User, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingCredentialsSlot") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result User - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.ListPublishingCredentialsSlotPreparer(resourceGroupName, name, slot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListPublishingCredentialsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListPublishingCredentialsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// ListPublishingCredentialsSlotPreparer prepares the ListPublishingCredentialsSlot request. -func (client AppsClient) ListPublishingCredentialsSlotPreparer(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ListPublishingCredentialsSlotSender sends the ListPublishingCredentialsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPublishingCredentialsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ListPublishingCredentialsSlotResponder handles the response to the ListPublishingCredentialsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPublishingCredentialsSlotResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPublishingProfileXMLWithSecrets gets the publishing profile for an app -// (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. publishingProfileOptions is specifies -// publishingProfileOptions for publishing profile. For example, use {"format": -// "FileZilla3"} to get a FileZilla publishing profile. -func (client AppsClient) ListPublishingProfileXMLWithSecrets(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets") - } - - req, err := client.ListPublishingProfileXMLWithSecretsPreparer(resourceGroupName, name, publishingProfileOptions) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.ListPublishingProfileXMLWithSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure sending request") - return - } - - result, err = client.ListPublishingProfileXMLWithSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure responding to request") - } - - return -} - -// ListPublishingProfileXMLWithSecretsPreparer prepares the ListPublishingProfileXMLWithSecrets request. -func (client AppsClient) ListPublishingProfileXMLWithSecretsPreparer(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml", pathParameters), - autorest.WithJSON(publishingProfileOptions), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPublishingProfileXMLWithSecretsSender sends the ListPublishingProfileXMLWithSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPublishingProfileXMLWithSecretsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPublishingProfileXMLWithSecretsResponder handles the response to the ListPublishingProfileXMLWithSecrets request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPublishingProfileXMLWithSecretsResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPublishingProfileXMLWithSecretsSlot gets the publishing profile for an -// app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. publishingProfileOptions is specifies -// publishingProfileOptions for publishing profile. For example, use {"format": -// "FileZilla3"} to get a FileZilla publishing profile. slot is name of the -// deployment slot. If a slot is not specified, the API will get the publishing -// profile for the production slot. -func (client AppsClient) ListPublishingProfileXMLWithSecretsSlot(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (result ReadCloser, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot") - } - - req, err := client.ListPublishingProfileXMLWithSecretsSlotPreparer(resourceGroupName, name, publishingProfileOptions, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListPublishingProfileXMLWithSecretsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListPublishingProfileXMLWithSecretsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure responding to request") - } - - return -} - -// ListPublishingProfileXMLWithSecretsSlotPreparer prepares the ListPublishingProfileXMLWithSecretsSlot request. -func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotPreparer(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml", pathParameters), - autorest.WithJSON(publishingProfileOptions), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPublishingProfileXMLWithSecretsSlotSender sends the ListPublishingProfileXMLWithSecretsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPublishingProfileXMLWithSecretsSlotResponder handles the response to the ListPublishingProfileXMLWithSecretsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRelayServiceConnections gets hybrid connections configured for an app -// (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListRelayServiceConnections(resourceGroupName string, name string) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListRelayServiceConnections") - } - - req, err := client.ListRelayServiceConnectionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListRelayServiceConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure sending request") - return - } - - result, err = client.ListRelayServiceConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure responding to request") - } - - return -} - -// ListRelayServiceConnectionsPreparer prepares the ListRelayServiceConnections request. -func (client AppsClient) ListRelayServiceConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListRelayServiceConnectionsSender sends the ListRelayServiceConnections request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListRelayServiceConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListRelayServiceConnectionsResponder handles the response to the ListRelayServiceConnections request. The method always -// closes the http.Response Body. -func (client AppsClient) ListRelayServiceConnectionsResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRelayServiceConnectionsSlot gets hybrid connections configured for an -// app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get hybrid connections for the -// production slot. -func (client AppsClient) ListRelayServiceConnectionsSlot(resourceGroupName string, name string, slot string) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot") - } - - req, err := client.ListRelayServiceConnectionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListRelayServiceConnectionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListRelayServiceConnectionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure responding to request") - } - - return -} - -// ListRelayServiceConnectionsSlotPreparer prepares the ListRelayServiceConnectionsSlot request. -func (client AppsClient) ListRelayServiceConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListRelayServiceConnectionsSlotSender sends the ListRelayServiceConnectionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListRelayServiceConnectionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListRelayServiceConnectionsSlotResponder handles the response to the ListRelayServiceConnectionsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListRelayServiceConnectionsSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSitePushSettings gets the Push settings associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app -func (client AppsClient) ListSitePushSettings(resourceGroupName string, name string) (result PushSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSitePushSettings") - } - - req, err := client.ListSitePushSettingsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", nil, "Failure preparing request") - return - } - - resp, err := client.ListSitePushSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure sending request") - return - } - - result, err = client.ListSitePushSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure responding to request") - } - - return -} - -// ListSitePushSettingsPreparer prepares the ListSitePushSettings request. -func (client AppsClient) ListSitePushSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSitePushSettingsSender sends the ListSitePushSettings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSitePushSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSitePushSettingsResponder handles the response to the ListSitePushSettings request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSitePushSettingsSlot gets the Push settings associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of web app slot. If not -// specified then will default to production slot. -func (client AppsClient) ListSitePushSettingsSlot(resourceGroupName string, name string, slot string) (result PushSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSitePushSettingsSlot") - } - - req, err := client.ListSitePushSettingsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListSitePushSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListSitePushSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSitePushSettingsSlotPreparer prepares the ListSitePushSettingsSlot request. -func (client AppsClient) ListSitePushSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSitePushSettingsSlotSender sends the ListSitePushSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSitePushSettingsSlotResponder handles the response to the ListSitePushSettingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSlotConfigurationNames gets the names of app settings and connection -// strings that stick to the slot (not swapped). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListSlotConfigurationNames(resourceGroupName string, name string) (result SlotConfigNamesResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotConfigurationNames") - } - - req, err := client.ListSlotConfigurationNamesPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", nil, "Failure preparing request") - return - } - - resp, err := client.ListSlotConfigurationNamesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure sending request") - return - } - - result, err = client.ListSlotConfigurationNamesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure responding to request") - } - - return -} - -// ListSlotConfigurationNamesPreparer prepares the ListSlotConfigurationNames request. -func (client AppsClient) ListSlotConfigurationNamesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSlotConfigurationNamesSender sends the ListSlotConfigurationNames request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSlotConfigurationNamesResponder handles the response to the ListSlotConfigurationNames request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSlotDifferencesFromProduction get the difference in configuration -// settings between two web app slots. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotSwapEntity is jSON object that -// contains the target slot name. See example. -func (client AppsClient) ListSlotDifferencesFromProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SlotDifferenceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: slotSwapEntity, - Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotDifferencesFromProduction") - } - - req, err := client.ListSlotDifferencesFromProductionPreparer(resourceGroupName, name, slotSwapEntity) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing request") - return - } - - resp, err := client.ListSlotDifferencesFromProductionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending request") - return - } - - result, err = client.ListSlotDifferencesFromProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to request") - } - - return -} - -// ListSlotDifferencesFromProductionPreparer prepares the ListSlotDifferencesFromProduction request. -func (client AppsClient) ListSlotDifferencesFromProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSlotDifferencesFromProductionSender sends the ListSlotDifferencesFromProduction request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSlotDifferencesFromProductionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSlotDifferencesFromProductionResponder handles the response to the ListSlotDifferencesFromProduction request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSlotDifferencesFromProductionResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSlotDifferencesFromProductionNextResults retrieves the next set of results, if any. -func (client AppsClient) ListSlotDifferencesFromProductionNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { - req, err := lastResults.SlotDifferenceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSlotDifferencesFromProductionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending next results request") - } - - result, err = client.ListSlotDifferencesFromProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to next results request") - } - - return -} - -// ListSlotDifferencesSlot get the difference in configuration settings between -// two web app slots. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotSwapEntity is jSON object that -// contains the target slot name. See example. slot is name of the source slot. -// If a slot is not specified, the production slot is used as the source slot. -func (client AppsClient) ListSlotDifferencesSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SlotDifferenceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: slotSwapEntity, - Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotDifferencesSlot") - } - - req, err := client.ListSlotDifferencesSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListSlotDifferencesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending request") - return - } - - result, err = client.ListSlotDifferencesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to request") - } - - return -} - -// ListSlotDifferencesSlotPreparer prepares the ListSlotDifferencesSlot request. -func (client AppsClient) ListSlotDifferencesSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSlotDifferencesSlotSender sends the ListSlotDifferencesSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSlotDifferencesSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSlotDifferencesSlotResponder handles the response to the ListSlotDifferencesSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSlotDifferencesSlotResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSlotDifferencesSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListSlotDifferencesSlotNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { - req, err := lastResults.SlotDifferenceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSlotDifferencesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending next results request") - } - - result, err = client.ListSlotDifferencesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListSlots gets an app's deployment slots. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListSlots(resourceGroupName string, name string) (result AppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlots") - } - - req, err := client.ListSlotsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing request") - return - } - - resp, err := client.ListSlotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending request") - return - } - - result, err = client.ListSlotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to request") - } - - return -} - -// ListSlotsPreparer prepares the ListSlots request. -func (client AppsClient) ListSlotsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSlotsSender sends the ListSlots request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSlotsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSlotsResponder handles the response to the ListSlots request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSlotsResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSlotsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListSlotsNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSlotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending next results request") - } - - result, err = client.ListSlotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to next results request") - } - - return -} - -// ListSnapshots returns all Snapshots to the user. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is website Name -func (client AppsClient) ListSnapshots(resourceGroupName string, name string) (result SnapshotCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSnapshots") - } - - req, err := client.ListSnapshotsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing request") - return - } - - resp, err := client.ListSnapshotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending request") - return - } - - result, err = client.ListSnapshotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to request") - } - - return -} - -// ListSnapshotsPreparer prepares the ListSnapshots request. -func (client AppsClient) ListSnapshotsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSnapshotsSender sends the ListSnapshots request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSnapshotsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSnapshotsResponder handles the response to the ListSnapshots request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSnapshotsResponder(resp *http.Response) (result SnapshotCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSnapshotsNextResults retrieves the next set of results, if any. -func (client AppsClient) ListSnapshotsNextResults(lastResults SnapshotCollection) (result SnapshotCollection, err error) { - req, err := lastResults.SnapshotCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSnapshotsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending next results request") - } - - result, err = client.ListSnapshotsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to next results request") - } - - return -} - -// ListSnapshotsSlot returns all Snapshots to the user. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is website Name slot is website Slot -func (client AppsClient) ListSnapshotsSlot(resourceGroupName string, name string, slot string) (result SnapshotCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSnapshotsSlot") - } - - req, err := client.ListSnapshotsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListSnapshotsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListSnapshotsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to request") - } - - return -} - -// ListSnapshotsSlotPreparer prepares the ListSnapshotsSlot request. -func (client AppsClient) ListSnapshotsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSnapshotsSlotSender sends the ListSnapshotsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSnapshotsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSnapshotsSlotResponder handles the response to the ListSnapshotsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListSnapshotsSlotResponder(resp *http.Response) (result SnapshotCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSnapshotsSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListSnapshotsSlotNextResults(lastResults SnapshotCollection) (result SnapshotCollection, err error) { - req, err := lastResults.SnapshotCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSnapshotsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending next results request") - } - - result, err = client.ListSnapshotsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListUsages gets the quota usage information of an app (or deployment slot, -// if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. filter is return only information -// specified in the filter (using OData syntax). For example: -// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime -// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and -// timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppsClient) ListUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListUsages") - } - - req, err := client.ListUsagesPreparer(resourceGroupName, name, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to request") - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client AppsClient) ListUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client AppsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsagesNextResults retrieves the next set of results, if any. -func (client AppsClient) ListUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { - req, err := lastResults.CsmUsageQuotaCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending next results request") - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to next results request") - } - - return -} - -// ListUsagesSlot gets the quota usage information of an app (or deployment -// slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get quota information of the production -// slot. filter is return only information specified in the filter (using OData -// syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq -// 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppsClient) ListUsagesSlot(resourceGroupName string, name string, slot string, filter string) (result CsmUsageQuotaCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListUsagesSlot") - } - - req, err := client.ListUsagesSlotPreparer(resourceGroupName, name, slot, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to request") - } - - return -} - -// ListUsagesSlotPreparer prepares the ListUsagesSlot request. -func (client AppsClient) ListUsagesSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListUsagesSlotSender sends the ListUsagesSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListUsagesSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListUsagesSlotResponder handles the response to the ListUsagesSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListUsagesSlotResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsagesSlotNextResults retrieves the next set of results, if any. -func (client AppsClient) ListUsagesSlotNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { - req, err := lastResults.CsmUsageQuotaCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListUsagesSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending next results request") - } - - result, err = client.ListUsagesSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to next results request") - } - - return -} - -// ListVnetConnections gets the virtual networks the app (or deployment slot) -// is connected to. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ListVnetConnections(resourceGroupName string, name string) (result ListVnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListVnetConnections") - } - - req, err := client.ListVnetConnectionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListVnetConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure sending request") - return - } - - result, err = client.ListVnetConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure responding to request") - } - - return -} - -// ListVnetConnectionsPreparer prepares the ListVnetConnections request. -func (client AppsClient) ListVnetConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVnetConnectionsSender sends the ListVnetConnections request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListVnetConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVnetConnectionsResponder handles the response to the ListVnetConnections request. The method always -// closes the http.Response Body. -func (client AppsClient) ListVnetConnectionsResponder(resp *http.Response) (result ListVnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVnetConnectionsSlot gets the virtual networks the app (or deployment -// slot) is connected to. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will get virtual network connections for the -// production slot. -func (client AppsClient) ListVnetConnectionsSlot(resourceGroupName string, name string, slot string) (result ListVnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListVnetConnectionsSlot") - } - - req, err := client.ListVnetConnectionsSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ListVnetConnectionsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure sending request") - return - } - - result, err = client.ListVnetConnectionsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure responding to request") - } - - return -} - -// ListVnetConnectionsSlotPreparer prepares the ListVnetConnectionsSlot request. -func (client AppsClient) ListVnetConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVnetConnectionsSlotSender sends the ListVnetConnectionsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListVnetConnectionsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVnetConnectionsSlotResponder handles the response to the ListVnetConnectionsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ListVnetConnectionsSlotResponder(resp *http.Response) (result ListVnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateMySQL migrates a local (in-app) MySql database to a remote MySql -// database. This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app migrationRequestEnvelope is mySql migration -// options -func (client AppsClient) MigrateMySQL(resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest, cancel <-chan struct{}) (<-chan Operation, <-chan error) { - resultChan := make(chan Operation, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "MigrateMySQL") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Operation - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.MigrateMySQLPreparer(resourceGroupName, name, migrationRequestEnvelope, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", nil, "Failure preparing request") - return - } - - resp, err := client.MigrateMySQLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", resp, "Failure sending request") - return - } - - result, err = client.MigrateMySQLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// MigrateMySQLPreparer prepares the MigrateMySQL request. -func (client AppsClient) MigrateMySQLPreparer(resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql", pathParameters), - autorest.WithJSON(migrationRequestEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// MigrateMySQLSender sends the MigrateMySQL request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) MigrateMySQLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// MigrateMySQLResponder handles the response to the MigrateMySQL request. The method always -// closes the http.Response Body. -func (client AppsClient) MigrateMySQLResponder(resp *http.Response) (result Operation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MigrateStorage restores a web app. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// subscriptionName is azure subscription resourceGroupName is name of the -// resource group to which the resource belongs. name is name of web app -// migrationOptions is migration migrationOptions -func (client AppsClient) MigrateStorage(subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions, cancel <-chan struct{}) (<-chan StorageMigrationResponse, <-chan error) { - resultChan := make(chan StorageMigrationResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "MigrateStorage") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result StorageMigrationResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.MigrateStoragePreparer(subscriptionName, resourceGroupName, name, migrationOptions, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", nil, "Failure preparing request") - return - } - - resp, err := client.MigrateStorageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", resp, "Failure sending request") - return - } - - result, err = client.MigrateStorageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// MigrateStoragePreparer prepares the MigrateStorage request. -func (client AppsClient) MigrateStoragePreparer(subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "subscriptionName": autorest.Encode("query", subscriptionName), - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate", pathParameters), - autorest.WithJSON(migrationOptions), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// MigrateStorageSender sends the MigrateStorage request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) MigrateStorageSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// MigrateStorageResponder handles the response to the MigrateStorage request. The method always -// closes the http.Response Body. -func (client AppsClient) MigrateStorageResponder(resp *http.Response) (result StorageMigrationResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Recover recovers a deleted web app. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app recoveryEntity is snapshot data used for -// web app recovery. Snapshot information can be obtained by calling -// GetDeletedSites or GetSiteSnapshots API. -func (client AppsClient) Recover(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (<-chan RecoverResponse, <-chan error) { - resultChan := make(chan RecoverResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "Recover") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RecoverResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RecoverPreparer(resourceGroupName, name, recoveryEntity, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", nil, "Failure preparing request") - return - } - - resp, err := client.RecoverSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", resp, "Failure sending request") - return - } - - result, err = client.RecoverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RecoverPreparer prepares the Recover request. -func (client AppsClient) RecoverPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover", pathParameters), - autorest.WithJSON(recoveryEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RecoverSender sends the Recover request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RecoverSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RecoverResponder handles the response to the Recover request. The method always -// closes the http.Response Body. -func (client AppsClient) RecoverResponder(resp *http.Response) (result RecoverResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RecoverSiteConfigurationSnapshot reverts the configuration of an app to a -// previous snapshot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. snapshotID is the ID of the snapshot to -// read. -func (client AppsClient) RecoverSiteConfigurationSnapshot(resourceGroupName string, name string, snapshotID string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot") - } - - req, err := client.RecoverSiteConfigurationSnapshotPreparer(resourceGroupName, name, snapshotID) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", nil, "Failure preparing request") - return - } - - resp, err := client.RecoverSiteConfigurationSnapshotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure sending request") - return - } - - result, err = client.RecoverSiteConfigurationSnapshotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure responding to request") - } - - return -} - -// RecoverSiteConfigurationSnapshotPreparer prepares the RecoverSiteConfigurationSnapshot request. -func (client AppsClient) RecoverSiteConfigurationSnapshotPreparer(resourceGroupName string, name string, snapshotID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotId": autorest.Encode("path", snapshotID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RecoverSiteConfigurationSnapshotSender sends the RecoverSiteConfigurationSnapshot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RecoverSiteConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RecoverSiteConfigurationSnapshotResponder handles the response to the RecoverSiteConfigurationSnapshot request. The method always -// closes the http.Response Body. -func (client AppsClient) RecoverSiteConfigurationSnapshotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RecoverSiteConfigurationSnapshotSlot reverts the configuration of an app to -// a previous snapshot. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. snapshotID is the ID of the snapshot to -// read. slot is name of the deployment slot. If a slot is not specified, the -// API will return configuration for the production slot. -func (client AppsClient) RecoverSiteConfigurationSnapshotSlot(resourceGroupName string, name string, snapshotID string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot") - } - - req, err := client.RecoverSiteConfigurationSnapshotSlotPreparer(resourceGroupName, name, snapshotID, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", nil, "Failure preparing request") - return - } - - resp, err := client.RecoverSiteConfigurationSnapshotSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure sending request") - return - } - - result, err = client.RecoverSiteConfigurationSnapshotSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure responding to request") - } - - return -} - -// RecoverSiteConfigurationSnapshotSlotPreparer prepares the RecoverSiteConfigurationSnapshotSlot request. -func (client AppsClient) RecoverSiteConfigurationSnapshotSlotPreparer(resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "snapshotId": autorest.Encode("path", snapshotID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RecoverSiteConfigurationSnapshotSlotSender sends the RecoverSiteConfigurationSnapshotSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RecoverSiteConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RecoverSiteConfigurationSnapshotSlotResponder handles the response to the RecoverSiteConfigurationSnapshotSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) RecoverSiteConfigurationSnapshotSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RecoverSlot recovers a deleted web app. This method may poll for completion. -// Polling can be canceled by passing the cancel channel argument. The channel -// will be used to cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app recoveryEntity is snapshot data used for -// web app recovery. Snapshot information can be obtained by calling -// GetDeletedSites or GetSiteSnapshots API. slot is name of web app slot. If -// not specified then will default to production slot. -func (client AppsClient) RecoverSlot(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (<-chan RecoverResponse, <-chan error) { - resultChan := make(chan RecoverResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSlot") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RecoverResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RecoverSlotPreparer(resourceGroupName, name, recoveryEntity, slot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", nil, "Failure preparing request") - return - } - - resp, err := client.RecoverSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", resp, "Failure sending request") - return - } - - result, err = client.RecoverSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RecoverSlotPreparer prepares the RecoverSlot request. -func (client AppsClient) RecoverSlotPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover", pathParameters), - autorest.WithJSON(recoveryEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RecoverSlotSender sends the RecoverSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RecoverSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RecoverSlotResponder handles the response to the RecoverSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) RecoverSlotResponder(resp *http.Response) (result RecoverResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResetProductionSlotConfig resets the configuration settings of the current -// slot if they were previously modified by calling the API with POST. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) ResetProductionSlotConfig(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ResetProductionSlotConfig") - } - - req, err := client.ResetProductionSlotConfigPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", nil, "Failure preparing request") - return - } - - resp, err := client.ResetProductionSlotConfigSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure sending request") - return - } - - result, err = client.ResetProductionSlotConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure responding to request") - } - - return -} - -// ResetProductionSlotConfigPreparer prepares the ResetProductionSlotConfig request. -func (client AppsClient) ResetProductionSlotConfigPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResetProductionSlotConfigSender sends the ResetProductionSlotConfig request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ResetProductionSlotConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResetProductionSlotConfigResponder handles the response to the ResetProductionSlotConfig request. The method always -// closes the http.Response Body. -func (client AppsClient) ResetProductionSlotConfigResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResetSlotConfigurationSlot resets the configuration settings of the current -// slot if they were previously modified by calling the API with POST. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API resets configuration settings for the -// production slot. -func (client AppsClient) ResetSlotConfigurationSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ResetSlotConfigurationSlot") - } - - req, err := client.ResetSlotConfigurationSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.ResetSlotConfigurationSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.ResetSlotConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// ResetSlotConfigurationSlotPreparer prepares the ResetSlotConfigurationSlot request. -func (client AppsClient) ResetSlotConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResetSlotConfigurationSlotSender sends the ResetSlotConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ResetSlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResetSlotConfigurationSlotResponder handles the response to the ResetSlotConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) ResetSlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Restart restarts an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. softRestart is specify true to apply the -// configuration settings and restarts the app only if necessary. By default, -// the API always restarts and reprovisions the app. synchronous is specify -// true to block until the app is restarted. By default, it is set to false, -// and the API responds immediately (asynchronous). -func (client AppsClient) Restart(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Restart") - } - - req, err := client.RestartPreparer(resourceGroupName, name, softRestart, synchronous) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", nil, "Failure preparing request") - return - } - - resp, err := client.RestartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure sending request") - return - } - - result, err = client.RestartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure responding to request") - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client AppsClient) RestartPreparer(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if softRestart != nil { - queryParameters["softRestart"] = autorest.Encode("query", *softRestart) - } - if synchronous != nil { - queryParameters["synchronous"] = autorest.Encode("query", *synchronous) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RestartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client AppsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RestartSlot restarts an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will restart the production slot. softRestart -// is specify true to apply the configuration settings and restarts the app -// only if necessary. By default, the API always restarts and reprovisions the -// app. synchronous is specify true to block until the app is restarted. By -// default, it is set to false, and the API responds immediately -// (asynchronous). -func (client AppsClient) RestartSlot(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RestartSlot") - } - - req, err := client.RestartSlotPreparer(resourceGroupName, name, slot, softRestart, synchronous) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", nil, "Failure preparing request") - return - } - - resp, err := client.RestartSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure sending request") - return - } - - result, err = client.RestartSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure responding to request") - } - - return -} - -// RestartSlotPreparer prepares the RestartSlot request. -func (client AppsClient) RestartSlotPreparer(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if softRestart != nil { - queryParameters["softRestart"] = autorest.Encode("query", *softRestart) - } - if synchronous != nil { - queryParameters["synchronous"] = autorest.Encode("query", *synchronous) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestartSlotSender sends the RestartSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RestartSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestartSlotResponder handles the response to the RestartSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) RestartSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Restore restores a specific backup to another app (or deployment slot, if -// specified). This method may poll for completion. Polling can be canceled by -// passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. backupID is iD of the backup. request is -// information on restore request -func (client AppsClient) Restore(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (<-chan RestoreResponse, <-chan error) { - resultChan := make(chan RestoreResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "Restore") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RestoreResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RestorePreparer(resourceGroupName, name, backupID, request, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", nil, "Failure preparing request") - return - } - - resp, err := client.RestoreSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", resp, "Failure sending request") - return - } - - result, err = client.RestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RestorePreparer prepares the Restore request. -func (client AppsClient) RestorePreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RestoreSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client AppsClient) RestoreResponder(resp *http.Response) (result RestoreResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestoreSlot restores a specific backup to another app (or deployment slot, -// if specified). This method may poll for completion. Polling can be canceled -// by passing the cancel channel argument. The channel will be used to cancel -// polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. backupID is iD of the backup. request is -// information on restore request slot is name of the deployment slot. If a -// slot is not specified, the API will restore a backup of the production slot. -func (client AppsClient) RestoreSlot(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (<-chan RestoreResponse, <-chan error) { - resultChan := make(chan RestoreResponse, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "RestoreSlot") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result RestoreResponse - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.RestoreSlotPreparer(resourceGroupName, name, backupID, request, slot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", nil, "Failure preparing request") - return - } - - resp, err := client.RestoreSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", resp, "Failure sending request") - return - } - - result, err = client.RestoreSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// RestoreSlotPreparer prepares the RestoreSlot request. -func (client AppsClient) RestoreSlotPreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupId": autorest.Encode("path", backupID), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// RestoreSlotSender sends the RestoreSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) RestoreSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// RestoreSlotResponder handles the response to the RestoreSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) RestoreSlotResponder(resp *http.Response) (result RestoreResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Start starts an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) Start(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Start") - } - - req, err := client.StartPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", nil, "Failure preparing request") - return - } - - resp, err := client.StartSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure sending request") - return - } - - result, err = client.StartResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure responding to request") - } - - return -} - -// StartPreparer prepares the Start request. -func (client AppsClient) StartPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StartSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client AppsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// StartSlot starts an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will start the production slot. -func (client AppsClient) StartSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartSlot") - } - - req, err := client.StartSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", nil, "Failure preparing request") - return - } - - resp, err := client.StartSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure sending request") - return - } - - result, err = client.StartSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure responding to request") - } - - return -} - -// StartSlotPreparer prepares the StartSlot request. -func (client AppsClient) StartSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StartSlotSender sends the StartSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StartSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StartSlotResponder handles the response to the StartSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) StartSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// StartWebSiteNetworkTrace start capturing network packets for the site. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app. durationInSeconds is the duration -// to keep capturing in seconds. maxFrameLength is the maximum frame length in -// bytes (Optional). sasURL is the Blob URL to store capture file. -func (client AppsClient) StartWebSiteNetworkTrace(resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartWebSiteNetworkTrace") - } - - req, err := client.StartWebSiteNetworkTracePreparer(resourceGroupName, name, durationInSeconds, maxFrameLength, sasURL) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", nil, "Failure preparing request") - return - } - - resp, err := client.StartWebSiteNetworkTraceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure sending request") - return - } - - result, err = client.StartWebSiteNetworkTraceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure responding to request") - } - - return -} - -// StartWebSiteNetworkTracePreparer prepares the StartWebSiteNetworkTrace request. -func (client AppsClient) StartWebSiteNetworkTracePreparer(resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if durationInSeconds != nil { - queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) - } - if maxFrameLength != nil { - queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) - } - if len(sasURL) > 0 { - queryParameters["sasUrl"] = autorest.Encode("query", sasURL) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StartWebSiteNetworkTraceSender sends the StartWebSiteNetworkTrace request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StartWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StartWebSiteNetworkTraceResponder handles the response to the StartWebSiteNetworkTrace request. The method always -// closes the http.Response Body. -func (client AppsClient) StartWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// StartWebSiteNetworkTraceSlot start capturing network packets for the site. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app. slot is the name of the slot for -// this web app. durationInSeconds is the duration to keep capturing in -// seconds. maxFrameLength is the maximum frame length in bytes (Optional). -// sasURL is the Blob URL to store capture file. -func (client AppsClient) StartWebSiteNetworkTraceSlot(resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot") - } - - req, err := client.StartWebSiteNetworkTraceSlotPreparer(resourceGroupName, name, slot, durationInSeconds, maxFrameLength, sasURL) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", nil, "Failure preparing request") - return - } - - resp, err := client.StartWebSiteNetworkTraceSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure sending request") - return - } - - result, err = client.StartWebSiteNetworkTraceSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure responding to request") - } - - return -} - -// StartWebSiteNetworkTraceSlotPreparer prepares the StartWebSiteNetworkTraceSlot request. -func (client AppsClient) StartWebSiteNetworkTraceSlotPreparer(resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if durationInSeconds != nil { - queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) - } - if maxFrameLength != nil { - queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) - } - if len(sasURL) > 0 { - queryParameters["sasUrl"] = autorest.Encode("query", sasURL) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StartWebSiteNetworkTraceSlotSender sends the StartWebSiteNetworkTraceSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StartWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StartWebSiteNetworkTraceSlotResponder handles the response to the StartWebSiteNetworkTraceSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) StartWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Stop stops an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) Stop(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Stop") - } - - req, err := client.StopPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure responding to request") - } - - return -} - -// StopPreparer prepares the Stop request. -func (client AppsClient) StopPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StopSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client AppsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// StopSlot stops an app (or deployment slot, if specified). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will stop the production slot. -func (client AppsClient) StopSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopSlot") - } - - req, err := client.StopSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", nil, "Failure preparing request") - return - } - - resp, err := client.StopSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure sending request") - return - } - - result, err = client.StopSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure responding to request") - } - - return -} - -// StopSlotPreparer prepares the StopSlot request. -func (client AppsClient) StopSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopSlotSender sends the StopSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StopSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopSlotResponder handles the response to the StopSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) StopSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// StopWebSiteNetworkTrace stop ongoing capturing network packets for the site. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app. -func (client AppsClient) StopWebSiteNetworkTrace(resourceGroupName string, name string) (result String, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopWebSiteNetworkTrace") - } - - req, err := client.StopWebSiteNetworkTracePreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", nil, "Failure preparing request") - return - } - - resp, err := client.StopWebSiteNetworkTraceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure sending request") - return - } - - result, err = client.StopWebSiteNetworkTraceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure responding to request") - } - - return -} - -// StopWebSiteNetworkTracePreparer prepares the StopWebSiteNetworkTrace request. -func (client AppsClient) StopWebSiteNetworkTracePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopWebSiteNetworkTraceSender sends the StopWebSiteNetworkTrace request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StopWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopWebSiteNetworkTraceResponder handles the response to the StopWebSiteNetworkTrace request. The method always -// closes the http.Response Body. -func (client AppsClient) StopWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// StopWebSiteNetworkTraceSlot stop ongoing capturing network packets for the -// site. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app. slot is the name of the slot for -// this web app. -func (client AppsClient) StopWebSiteNetworkTraceSlot(resourceGroupName string, name string, slot string) (result String, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot") - } - - req, err := client.StopWebSiteNetworkTraceSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", nil, "Failure preparing request") - return - } - - resp, err := client.StopWebSiteNetworkTraceSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure sending request") - return - } - - result, err = client.StopWebSiteNetworkTraceSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure responding to request") - } - - return -} - -// StopWebSiteNetworkTraceSlotPreparer prepares the StopWebSiteNetworkTraceSlot request. -func (client AppsClient) StopWebSiteNetworkTraceSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// StopWebSiteNetworkTraceSlotSender sends the StopWebSiteNetworkTraceSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) StopWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// StopWebSiteNetworkTraceSlotResponder handles the response to the StopWebSiteNetworkTraceSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) StopWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SwapSlotSlot swaps two deployment slots of an app. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotSwapEntity is jSON object that -// contains the target slot name. See example. slot is name of the source slot. -// If a slot is not specified, the production slot is used as the source slot. -func (client AppsClient) SwapSlotSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: slotSwapEntity, - Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "SwapSlotSlot") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.SwapSlotSlotPreparer(resourceGroupName, name, slotSwapEntity, slot, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", nil, "Failure preparing request") - return - } - - resp, err := client.SwapSlotSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", resp, "Failure sending request") - return - } - - result, err = client.SwapSlotSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// SwapSlotSlotPreparer prepares the SwapSlotSlot request. -func (client AppsClient) SwapSlotSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SwapSlotSlotSender sends the SwapSlotSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SwapSlotSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SwapSlotSlotResponder handles the response to the SwapSlotSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) SwapSlotSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// SwapSlotWithProduction swaps two deployment slots of an app. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotSwapEntity is jSON object that -// contains the target slot name. See example. -func (client AppsClient) SwapSlotWithProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: slotSwapEntity, - Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "SwapSlotWithProduction") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.SwapSlotWithProductionPreparer(resourceGroupName, name, slotSwapEntity, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", nil, "Failure preparing request") - return - } - - resp, err := client.SwapSlotWithProductionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", resp, "Failure sending request") - return - } - - result, err = client.SwapSlotWithProductionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// SwapSlotWithProductionPreparer prepares the SwapSlotWithProduction request. -func (client AppsClient) SwapSlotWithProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap", pathParameters), - autorest.WithJSON(slotSwapEntity), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SwapSlotWithProductionSender sends the SwapSlotWithProduction request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SwapSlotWithProductionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SwapSlotWithProductionResponder handles the response to the SwapSlotWithProduction request. The method always -// closes the http.Response Body. -func (client AppsClient) SwapSlotWithProductionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// SyncFunctionTriggers syncs function trigger metadata to the scale controller -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. -func (client AppsClient) SyncFunctionTriggers(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncFunctionTriggers") - } - - req, err := client.SyncFunctionTriggersPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", nil, "Failure preparing request") - return - } - - resp, err := client.SyncFunctionTriggersSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", resp, "Failure sending request") - return - } - - result, err = client.SyncFunctionTriggersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", resp, "Failure responding to request") - } - - return -} - -// SyncFunctionTriggersPreparer prepares the SyncFunctionTriggers request. -func (client AppsClient) SyncFunctionTriggersPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncFunctionTriggersSender sends the SyncFunctionTriggers request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SyncFunctionTriggersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncFunctionTriggersResponder handles the response to the SyncFunctionTriggers request. The method always -// closes the http.Response Body. -func (client AppsClient) SyncFunctionTriggersResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// SyncFunctionTriggersSlot syncs function trigger metadata to the scale -// controller -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slot is name of the deployment slot. If a -// slot is not specified, the API will restore a backup of the production slot. -func (client AppsClient) SyncFunctionTriggersSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncFunctionTriggersSlot") - } - - req, err := client.SyncFunctionTriggersSlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", nil, "Failure preparing request") - return - } - - resp, err := client.SyncFunctionTriggersSlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", resp, "Failure sending request") - return - } - - result, err = client.SyncFunctionTriggersSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", resp, "Failure responding to request") - } - - return -} - -// SyncFunctionTriggersSlotPreparer prepares the SyncFunctionTriggersSlot request. -func (client AppsClient) SyncFunctionTriggersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncFunctionTriggersSlotSender sends the SyncFunctionTriggersSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SyncFunctionTriggersSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncFunctionTriggersSlotResponder handles the response to the SyncFunctionTriggersSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) SyncFunctionTriggersSlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// SyncRepository sync web app repository. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app -func (client AppsClient) SyncRepository(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncRepository") - } - - req, err := client.SyncRepositoryPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", nil, "Failure preparing request") - return - } - - resp, err := client.SyncRepositorySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure sending request") - return - } - - result, err = client.SyncRepositoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure responding to request") - } - - return -} - -// SyncRepositoryPreparer prepares the SyncRepository request. -func (client AppsClient) SyncRepositoryPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncRepositorySender sends the SyncRepository request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SyncRepositorySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncRepositoryResponder handles the response to the SyncRepository request. The method always -// closes the http.Response Body. -func (client AppsClient) SyncRepositoryResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// SyncRepositorySlot sync web app repository. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app slot is name of web app slot. If not -// specified then will default to production slot. -func (client AppsClient) SyncRepositorySlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncRepositorySlot") - } - - req, err := client.SyncRepositorySlotPreparer(resourceGroupName, name, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", nil, "Failure preparing request") - return - } - - resp, err := client.SyncRepositorySlotSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure sending request") - return - } - - result, err = client.SyncRepositorySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure responding to request") - } - - return -} - -// SyncRepositorySlotPreparer prepares the SyncRepositorySlot request. -func (client AppsClient) SyncRepositorySlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SyncRepositorySlotSender sends the SyncRepositorySlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SyncRepositorySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SyncRepositorySlotResponder handles the response to the SyncRepositorySlot request. The method always -// closes the http.Response Body. -func (client AppsClient) SyncRepositorySlotResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateApplicationSettings replaces the application settings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. appSettings is application settings of the -// app. -func (client AppsClient) UpdateApplicationSettings(resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateApplicationSettings") - } - - req, err := client.UpdateApplicationSettingsPreparer(resourceGroupName, name, appSettings) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateApplicationSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure sending request") - return - } - - result, err = client.UpdateApplicationSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure responding to request") - } - - return -} - -// UpdateApplicationSettingsPreparer prepares the UpdateApplicationSettings request. -func (client AppsClient) UpdateApplicationSettingsPreparer(resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings", pathParameters), - autorest.WithJSON(appSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateApplicationSettingsSender sends the UpdateApplicationSettings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateApplicationSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateApplicationSettingsResponder handles the response to the UpdateApplicationSettings request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateApplicationSettingsSlot replaces the application settings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. appSettings is application settings of the -// app. slot is name of the deployment slot. If a slot is not specified, the -// API will update the application settings for the production slot. -func (client AppsClient) UpdateApplicationSettingsSlot(resourceGroupName string, name string, appSettings StringDictionary, slot string) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateApplicationSettingsSlot") - } - - req, err := client.UpdateApplicationSettingsSlotPreparer(resourceGroupName, name, appSettings, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateApplicationSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateApplicationSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateApplicationSettingsSlotPreparer prepares the UpdateApplicationSettingsSlot request. -func (client AppsClient) UpdateApplicationSettingsSlotPreparer(resourceGroupName string, name string, appSettings StringDictionary, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings", pathParameters), - autorest.WithJSON(appSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateApplicationSettingsSlotSender sends the UpdateApplicationSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateApplicationSettingsSlotResponder handles the response to the UpdateApplicationSettingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateAuthSettings updates the Authentication / Authorization settings -// associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app siteAuthSettings is auth settings -// associated with web app -func (client AppsClient) UpdateAuthSettings(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (result SiteAuthSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateAuthSettings") - } - - req, err := client.UpdateAuthSettingsPreparer(resourceGroupName, name, siteAuthSettings) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAuthSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure sending request") - return - } - - result, err = client.UpdateAuthSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure responding to request") - } - - return -} - -// UpdateAuthSettingsPreparer prepares the UpdateAuthSettings request. -func (client AppsClient) UpdateAuthSettingsPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings", pathParameters), - autorest.WithJSON(siteAuthSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateAuthSettingsSender sends the UpdateAuthSettings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateAuthSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateAuthSettingsResponder handles the response to the UpdateAuthSettings request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateAuthSettingsSlot updates the Authentication / Authorization settings -// associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app siteAuthSettings is auth settings -// associated with web app slot is name of web app slot. If not specified then -// will default to production slot. -func (client AppsClient) UpdateAuthSettingsSlot(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (result SiteAuthSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateAuthSettingsSlot") - } - - req, err := client.UpdateAuthSettingsSlotPreparer(resourceGroupName, name, siteAuthSettings, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAuthSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateAuthSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateAuthSettingsSlotPreparer prepares the UpdateAuthSettingsSlot request. -func (client AppsClient) UpdateAuthSettingsSlotPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings", pathParameters), - autorest.WithJSON(siteAuthSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateAuthSettingsSlotSender sends the UpdateAuthSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateAuthSettingsSlotResponder handles the response to the UpdateAuthSettingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateBackupConfiguration updates the backup configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. request is edited backup configuration. -func (client AppsClient) UpdateBackupConfiguration(resourceGroupName string, name string, request BackupRequest) (result BackupRequest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateBackupConfiguration") - } - - req, err := client.UpdateBackupConfigurationPreparer(resourceGroupName, name, request) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateBackupConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure sending request") - return - } - - result, err = client.UpdateBackupConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure responding to request") - } - - return -} - -// UpdateBackupConfigurationPreparer prepares the UpdateBackupConfiguration request. -func (client AppsClient) UpdateBackupConfigurationPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateBackupConfigurationSender sends the UpdateBackupConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateBackupConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateBackupConfigurationResponder handles the response to the UpdateBackupConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateBackupConfigurationSlot updates the backup configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. request is edited backup configuration. -// slot is name of the deployment slot. If a slot is not specified, the API -// will update the backup configuration for the production slot. -func (client AppsClient) UpdateBackupConfigurationSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupRequest, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateBackupConfigurationSlot") - } - - req, err := client.UpdateBackupConfigurationSlotPreparer(resourceGroupName, name, request, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateBackupConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateBackupConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateBackupConfigurationSlotPreparer prepares the UpdateBackupConfigurationSlot request. -func (client AppsClient) UpdateBackupConfigurationSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateBackupConfigurationSlotSender sends the UpdateBackupConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateBackupConfigurationSlotResponder handles the response to the UpdateBackupConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateConfiguration updates the configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteConfig is jSON representation of a -// SiteConfig object. See example. -func (client AppsClient) UpdateConfiguration(resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConfiguration") - } - - req, err := client.UpdateConfigurationPreparer(resourceGroupName, name, siteConfig) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateConfigurationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure sending request") - return - } - - result, err = client.UpdateConfigurationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure responding to request") - } - - return -} - -// UpdateConfigurationPreparer prepares the UpdateConfiguration request. -func (client AppsClient) UpdateConfigurationPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateConfigurationSender sends the UpdateConfiguration request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateConfigurationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateConfigurationResponder handles the response to the UpdateConfiguration request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateConfigurationSlot updates the configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteConfig is jSON representation of a -// SiteConfig object. See example. slot is name of the deployment slot. If a -// slot is not specified, the API will update configuration for the production -// slot. -func (client AppsClient) UpdateConfigurationSlot(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConfigurationSlot") - } - - req, err := client.UpdateConfigurationSlotPreparer(resourceGroupName, name, siteConfig, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateConfigurationSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateConfigurationSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateConfigurationSlotPreparer prepares the UpdateConfigurationSlot request. -func (client AppsClient) UpdateConfigurationSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), - autorest.WithJSON(siteConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateConfigurationSlotSender sends the UpdateConfigurationSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateConfigurationSlotResponder handles the response to the UpdateConfigurationSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateConnectionStrings replaces the connection strings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. connectionStrings is connection strings of -// the app or deployment slot. See example. -func (client AppsClient) UpdateConnectionStrings(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (result ConnectionStringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConnectionStrings") - } - - req, err := client.UpdateConnectionStringsPreparer(resourceGroupName, name, connectionStrings) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateConnectionStringsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure sending request") - return - } - - result, err = client.UpdateConnectionStringsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure responding to request") - } - - return -} - -// UpdateConnectionStringsPreparer prepares the UpdateConnectionStrings request. -func (client AppsClient) UpdateConnectionStringsPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings", pathParameters), - autorest.WithJSON(connectionStrings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateConnectionStringsSender sends the UpdateConnectionStrings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateConnectionStringsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateConnectionStringsResponder handles the response to the UpdateConnectionStrings request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateConnectionStringsSlot replaces the connection strings of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. connectionStrings is connection strings of -// the app or deployment slot. See example. slot is name of the deployment -// slot. If a slot is not specified, the API will update the connection -// settings for the production slot. -func (client AppsClient) UpdateConnectionStringsSlot(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (result ConnectionStringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConnectionStringsSlot") - } - - req, err := client.UpdateConnectionStringsSlotPreparer(resourceGroupName, name, connectionStrings, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateConnectionStringsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateConnectionStringsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateConnectionStringsSlotPreparer prepares the UpdateConnectionStringsSlot request. -func (client AppsClient) UpdateConnectionStringsSlotPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings", pathParameters), - autorest.WithJSON(connectionStrings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateConnectionStringsSlotSender sends the UpdateConnectionStringsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateConnectionStringsSlotResponder handles the response to the UpdateConnectionStringsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateDiagnosticLogsConfig updates the logging configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteLogsConfig is a SiteLogsConfig JSON -// object that contains the logging configuration to change in the "properties" -// property. -func (client AppsClient) UpdateDiagnosticLogsConfig(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (result SiteLogsConfig, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: siteLogsConfig, - Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: 25, Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig") - } - - req, err := client.UpdateDiagnosticLogsConfigPreparer(resourceGroupName, name, siteLogsConfig) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateDiagnosticLogsConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure sending request") - return - } - - result, err = client.UpdateDiagnosticLogsConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure responding to request") - } - - return -} - -// UpdateDiagnosticLogsConfigPreparer prepares the UpdateDiagnosticLogsConfig request. -func (client AppsClient) UpdateDiagnosticLogsConfigPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), - autorest.WithJSON(siteLogsConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateDiagnosticLogsConfigSender sends the UpdateDiagnosticLogsConfig request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateDiagnosticLogsConfigSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateDiagnosticLogsConfigResponder handles the response to the UpdateDiagnosticLogsConfig request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateDiagnosticLogsConfigResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateDiagnosticLogsConfigSlot updates the logging configuration of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. siteLogsConfig is a SiteLogsConfig JSON -// object that contains the logging configuration to change in the "properties" -// property. slot is name of the deployment slot. If a slot is not specified, -// the API will update the logging configuration for the production slot. -func (client AppsClient) UpdateDiagnosticLogsConfigSlot(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (result SiteLogsConfig, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: siteLogsConfig, - Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, - {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: 25, Chain: nil}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot") - } - - req, err := client.UpdateDiagnosticLogsConfigSlotPreparer(resourceGroupName, name, siteLogsConfig, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateDiagnosticLogsConfigSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateDiagnosticLogsConfigSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateDiagnosticLogsConfigSlotPreparer prepares the UpdateDiagnosticLogsConfigSlot request. -func (client AppsClient) UpdateDiagnosticLogsConfigSlotPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), - autorest.WithJSON(siteLogsConfig), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateDiagnosticLogsConfigSlotSender sends the UpdateDiagnosticLogsConfigSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateDiagnosticLogsConfigSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateDiagnosticLogsConfigSlotResponder handles the response to the UpdateDiagnosticLogsConfigSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateDiagnosticLogsConfigSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateDomainOwnershipIdentifier creates a domain ownership identifier for -// web app, or updates an existing ownership identifier. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. domainOwnershipIdentifier is a JSON -// representation of the domain ownership properties. -func (client AppsClient) UpdateDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier") - } - - req, err := client.UpdateDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateDomainOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.UpdateDomainOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// UpdateDomainOwnershipIdentifierPreparer prepares the UpdateDomainOwnershipIdentifier request. -func (client AppsClient) UpdateDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithJSON(domainOwnershipIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateDomainOwnershipIdentifierSender sends the UpdateDomainOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateDomainOwnershipIdentifierResponder handles the response to the UpdateDomainOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateDomainOwnershipIdentifierSlot creates a domain ownership identifier -// for web app, or updates an existing ownership identifier. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. domainOwnershipIdentifierName is name of -// domain ownership identifier. domainOwnershipIdentifier is a JSON -// representation of the domain ownership properties. slot is name of the -// deployment slot. If a slot is not specified, the API will delete the binding -// for the production slot. -func (client AppsClient) UpdateDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot") - } - - req, err := client.UpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateDomainOwnershipIdentifierSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateDomainOwnershipIdentifierSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateDomainOwnershipIdentifierSlotPreparer prepares the UpdateDomainOwnershipIdentifierSlot request. -func (client AppsClient) UpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), - autorest.WithJSON(domainOwnershipIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateDomainOwnershipIdentifierSlotSender sends the UpdateDomainOwnershipIdentifierSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateDomainOwnershipIdentifierSlotResponder handles the response to the UpdateDomainOwnershipIdentifierSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateHybridConnection creates a new Hybrid Connection using a Service Bus -// relay. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection connectionEnvelope is the details of the hybrid connection -func (client AppsClient) UpdateHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateHybridConnection") - } - - req, err := client.UpdateHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateHybridConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.UpdateHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure responding to request") - } - - return -} - -// UpdateHybridConnectionPreparer prepares the UpdateHybridConnection request. -func (client AppsClient) UpdateHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateHybridConnectionSender sends the UpdateHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateHybridConnectionResponder handles the response to the UpdateHybridConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateHybridConnectionSlot creates a new Hybrid Connection using a Service -// Bus relay. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is the name of the web app namespaceName is the namespace for -// this hybrid connection relayName is the relay name for this hybrid -// connection connectionEnvelope is the details of the hybrid connection slot -// is the name of the slot for the web app. -func (client AppsClient) UpdateHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateHybridConnectionSlot") - } - - req, err := client.UpdateHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateHybridConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateHybridConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateHybridConnectionSlotPreparer prepares the UpdateHybridConnectionSlot request. -func (client AppsClient) UpdateHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateHybridConnectionSlotSender sends the UpdateHybridConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateHybridConnectionSlotResponder handles the response to the UpdateHybridConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMetadata replaces the metadata of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. metadata is edited metadata of the app or -// deployment slot. See example. -func (client AppsClient) UpdateMetadata(resourceGroupName string, name string, metadata StringDictionary) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateMetadata") - } - - req, err := client.UpdateMetadataPreparer(resourceGroupName, name, metadata) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateMetadataSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure sending request") - return - } - - result, err = client.UpdateMetadataResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure responding to request") - } - - return -} - -// UpdateMetadataPreparer prepares the UpdateMetadata request. -func (client AppsClient) UpdateMetadataPreparer(resourceGroupName string, name string, metadata StringDictionary) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata", pathParameters), - autorest.WithJSON(metadata), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateMetadataSender sends the UpdateMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateMetadataSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateMetadataResponder handles the response to the UpdateMetadata request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateMetadataResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMetadataSlot replaces the metadata of an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. metadata is edited metadata of the app or -// deployment slot. See example. slot is name of the deployment slot. If a slot -// is not specified, the API will update the metadata for the production slot. -func (client AppsClient) UpdateMetadataSlot(resourceGroupName string, name string, metadata StringDictionary, slot string) (result StringDictionary, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateMetadataSlot") - } - - req, err := client.UpdateMetadataSlotPreparer(resourceGroupName, name, metadata, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateMetadataSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateMetadataSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateMetadataSlotPreparer prepares the UpdateMetadataSlot request. -func (client AppsClient) UpdateMetadataSlotPreparer(resourceGroupName string, name string, metadata StringDictionary, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata", pathParameters), - autorest.WithJSON(metadata), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateMetadataSlotSender sends the UpdateMetadataSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateMetadataSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateMetadataSlotResponder handles the response to the UpdateMetadataSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateRelayServiceConnection creates a new hybrid connection configuration -// (PUT), or updates an existing one (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection configuration. connectionEnvelope is details of the hybrid -// connection configuration. -func (client AppsClient) UpdateRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateRelayServiceConnection") - } - - req, err := client.UpdateRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateRelayServiceConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure sending request") - return - } - - result, err = client.UpdateRelayServiceConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure responding to request") - } - - return -} - -// UpdateRelayServiceConnectionPreparer prepares the UpdateRelayServiceConnection request. -func (client AppsClient) UpdateRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateRelayServiceConnectionSender sends the UpdateRelayServiceConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateRelayServiceConnectionResponder handles the response to the UpdateRelayServiceConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateRelayServiceConnectionSlot creates a new hybrid connection -// configuration (PUT), or updates an existing one (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. entityName is name of the hybrid -// connection configuration. connectionEnvelope is details of the hybrid -// connection configuration. slot is name of the deployment slot. If a slot is -// not specified, the API will create or update a hybrid connection for the -// production slot. -func (client AppsClient) UpdateRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot") - } - - req, err := client.UpdateRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateRelayServiceConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateRelayServiceConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateRelayServiceConnectionSlotPreparer prepares the UpdateRelayServiceConnectionSlot request. -func (client AppsClient) UpdateRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "entityName": autorest.Encode("path", entityName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateRelayServiceConnectionSlotSender sends the UpdateRelayServiceConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateRelayServiceConnectionSlotResponder handles the response to the UpdateRelayServiceConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSitePushSettings updates the Push settings associated with web app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app pushSettings is push settings associated -// with web app -func (client AppsClient) UpdateSitePushSettings(resourceGroupName string, name string, pushSettings PushSettings) (result PushSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: pushSettings, - Constraints: []validation.Constraint{{Target: "pushSettings.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSitePushSettings") - } - - req, err := client.UpdateSitePushSettingsPreparer(resourceGroupName, name, pushSettings) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSitePushSettingsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure sending request") - return - } - - result, err = client.UpdateSitePushSettingsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure responding to request") - } - - return -} - -// UpdateSitePushSettingsPreparer prepares the UpdateSitePushSettings request. -func (client AppsClient) UpdateSitePushSettingsPreparer(resourceGroupName string, name string, pushSettings PushSettings) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings", pathParameters), - autorest.WithJSON(pushSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSitePushSettingsSender sends the UpdateSitePushSettings request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateSitePushSettingsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSitePushSettingsResponder handles the response to the UpdateSitePushSettings request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSitePushSettingsSlot updates the Push settings associated with web -// app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of web app pushSettings is push settings associated -// with web app slot is name of web app slot. If not specified then will -// default to production slot. -func (client AppsClient) UpdateSitePushSettingsSlot(resourceGroupName string, name string, pushSettings PushSettings, slot string) (result PushSettings, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: pushSettings, - Constraints: []validation.Constraint{{Target: "pushSettings.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSitePushSettingsSlot") - } - - req, err := client.UpdateSitePushSettingsSlotPreparer(resourceGroupName, name, pushSettings, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSitePushSettingsSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateSitePushSettingsSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateSitePushSettingsSlotPreparer prepares the UpdateSitePushSettingsSlot request. -func (client AppsClient) UpdateSitePushSettingsSlotPreparer(resourceGroupName string, name string, pushSettings PushSettings, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings", pathParameters), - autorest.WithJSON(pushSettings), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSitePushSettingsSlotSender sends the UpdateSitePushSettingsSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSitePushSettingsSlotResponder handles the response to the UpdateSitePushSettingsSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSlotConfigurationNames updates the names of application settings and -// connection string that remain with the slot during swap operation. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. slotConfigNames is names of application -// settings and connection strings. See example. -func (client AppsClient) UpdateSlotConfigurationNames(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (result SlotConfigNamesResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSlotConfigurationNames") - } - - req, err := client.UpdateSlotConfigurationNamesPreparer(resourceGroupName, name, slotConfigNames) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSlotConfigurationNamesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure sending request") - return - } - - result, err = client.UpdateSlotConfigurationNamesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure responding to request") - } - - return -} - -// UpdateSlotConfigurationNamesPreparer prepares the UpdateSlotConfigurationNames request. -func (client AppsClient) UpdateSlotConfigurationNamesPreparer(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), - autorest.WithJSON(slotConfigNames), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSlotConfigurationNamesSender sends the UpdateSlotConfigurationNames request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSlotConfigurationNamesResponder handles the response to the UpdateSlotConfigurationNames request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateVnetConnection adds a Virtual Network connection to an app or slot -// (PUT) or updates the connection properties (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of an existing Virtual -// Network. connectionEnvelope is properties of the Virtual Network connection. -// See example. -func (client AppsClient) UpdateVnetConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnection") - } - - req, err := client.UpdateVnetConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateVnetConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure sending request") - return - } - - result, err = client.UpdateVnetConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetConnectionPreparer prepares the UpdateVnetConnection request. -func (client AppsClient) UpdateVnetConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetConnectionSender sends the UpdateVnetConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetConnectionResponder handles the response to the UpdateVnetConnection request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateVnetConnectionGateway adds a gateway to a connected Virtual Network -// (PUT) or updates it (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the Virtual Network. -// gatewayName is name of the gateway. Currently, the only supported string is -// "primary". connectionEnvelope is the properties to update this gateway with. -func (client AppsClient) UpdateVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionGateway") - } - - req, err := client.UpdateVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateVnetConnectionGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure sending request") - return - } - - result, err = client.UpdateVnetConnectionGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetConnectionGatewayPreparer prepares the UpdateVnetConnectionGateway request. -func (client AppsClient) UpdateVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetConnectionGatewaySender sends the UpdateVnetConnectionGateway request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetConnectionGatewayResponder handles the response to the UpdateVnetConnectionGateway request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateVnetConnectionGatewaySlot adds a gateway to a connected Virtual -// Network (PUT) or updates it (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of the Virtual Network. -// gatewayName is name of the gateway. Currently, the only supported string is -// "primary". connectionEnvelope is the properties to update this gateway with. -// slot is name of the deployment slot. If a slot is not specified, the API -// will add or update a gateway for the production slot's Virtual Network. -func (client AppsClient) UpdateVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot") - } - - req, err := client.UpdateVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateVnetConnectionGatewaySlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateVnetConnectionGatewaySlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetConnectionGatewaySlotPreparer prepares the UpdateVnetConnectionGatewaySlot request. -func (client AppsClient) UpdateVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetConnectionGatewaySlotSender sends the UpdateVnetConnectionGatewaySlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetConnectionGatewaySlotResponder handles the response to the UpdateVnetConnectionGatewaySlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateVnetConnectionSlot adds a Virtual Network connection to an app or slot -// (PUT) or updates the connection properties (PATCH). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the app. vnetName is name of an existing Virtual -// Network. connectionEnvelope is properties of the Virtual Network connection. -// See example. slot is name of the deployment slot. If a slot is not -// specified, the API will add or update connections for the production slot. -func (client AppsClient) UpdateVnetConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionSlot") - } - - req, err := client.UpdateVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateVnetConnectionSlotSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure sending request") - return - } - - result, err = client.UpdateVnetConnectionSlotResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetConnectionSlotPreparer prepares the UpdateVnetConnectionSlot request. -func (client AppsClient) UpdateVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "slot": autorest.Encode("path", slot), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetConnectionSlotSender sends the UpdateVnetConnectionSlot request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetConnectionSlotResponder handles the response to the UpdateVnetConnectionSlot request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppsClient is the composite Swagger for WebSite Management Client +type AppsClient struct { + ManagementClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient client. +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddPremierAddOn updates a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +// premierAddOn is a JSON representation of the edited premier add-on. +func (client AppsClient) AddPremierAddOn(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AddPremierAddOn") + } + + req, err := client.AddPremierAddOnPreparer(resourceGroupName, name, premierAddOnName, premierAddOn) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.AddPremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.AddPremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOn", resp, "Failure responding to request") + } + + return +} + +// AddPremierAddOnPreparer prepares the AddPremierAddOn request. +func (client AppsClient) AddPremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddPremierAddOnSender sends the AddPremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddPremierAddOnSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddPremierAddOnResponder handles the response to the AddPremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) AddPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddPremierAddOnSlot updates a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +// premierAddOn is a JSON representation of the edited premier add-on. slot is +// name of the deployment slot. If a slot is not specified, the API will update +// the named add-on for the production slot. +func (client AppsClient) AddPremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AddPremierAddOnSlot") + } + + req, err := client.AddPremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, premierAddOn, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.AddPremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.AddPremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AddPremierAddOnSlot", resp, "Failure responding to request") + } + + return +} + +// AddPremierAddOnSlotPreparer prepares the AddPremierAddOnSlot request. +func (client AppsClient) AddPremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, premierAddOn PremierAddOn, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithJSON(premierAddOn), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AddPremierAddOnSlotSender sends the AddPremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AddPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AddPremierAddOnSlotResponder handles the response to the AddPremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) AddPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AnalyzeCustomHostname analyze a custom hostname. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app hostName is custom hostname +func (client AppsClient) AnalyzeCustomHostname(resourceGroupName string, name string, hostName string) (result CustomHostnameAnalysisResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AnalyzeCustomHostname") + } + + req, err := client.AnalyzeCustomHostnamePreparer(resourceGroupName, name, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", nil, "Failure preparing request") + return + } + + resp, err := client.AnalyzeCustomHostnameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure sending request") + return + } + + result, err = client.AnalyzeCustomHostnameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostname", resp, "Failure responding to request") + } + + return +} + +// AnalyzeCustomHostnamePreparer prepares the AnalyzeCustomHostname request. +func (client AppsClient) AnalyzeCustomHostnamePreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(hostName) > 0 { + queryParameters["hostName"] = autorest.Encode("query", hostName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AnalyzeCustomHostnameSender sends the AnalyzeCustomHostname request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AnalyzeCustomHostnameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AnalyzeCustomHostnameResponder handles the response to the AnalyzeCustomHostname request. The method always +// closes the http.Response Body. +func (client AppsClient) AnalyzeCustomHostnameResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AnalyzeCustomHostnameSlot analyze a custom hostname. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. hostName is custom hostname +func (client AppsClient) AnalyzeCustomHostnameSlot(resourceGroupName string, name string, slot string, hostName string) (result CustomHostnameAnalysisResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot") + } + + req, err := client.AnalyzeCustomHostnameSlotPreparer(resourceGroupName, name, slot, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", nil, "Failure preparing request") + return + } + + resp, err := client.AnalyzeCustomHostnameSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure sending request") + return + } + + result, err = client.AnalyzeCustomHostnameSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "AnalyzeCustomHostnameSlot", resp, "Failure responding to request") + } + + return +} + +// AnalyzeCustomHostnameSlotPreparer prepares the AnalyzeCustomHostnameSlot request. +func (client AppsClient) AnalyzeCustomHostnameSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(hostName) > 0 { + queryParameters["hostName"] = autorest.Encode("query", hostName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/analyzeCustomHostname", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AnalyzeCustomHostnameSlotSender sends the AnalyzeCustomHostnameSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) AnalyzeCustomHostnameSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AnalyzeCustomHostnameSlotResponder handles the response to the AnalyzeCustomHostnameSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) AnalyzeCustomHostnameSlotResponder(resp *http.Response) (result CustomHostnameAnalysisResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ApplySlotConfigToProduction applies the configuration settings from the +// target slot onto the current slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. +func (client AppsClient) ApplySlotConfigToProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ApplySlotConfigToProduction") + } + + req, err := client.ApplySlotConfigToProductionPreparer(resourceGroupName, name, slotSwapEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", nil, "Failure preparing request") + return + } + + resp, err := client.ApplySlotConfigToProductionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure sending request") + return + } + + result, err = client.ApplySlotConfigToProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigToProduction", resp, "Failure responding to request") + } + + return +} + +// ApplySlotConfigToProductionPreparer prepares the ApplySlotConfigToProduction request. +func (client AppsClient) ApplySlotConfigToProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/applySlotConfig", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ApplySlotConfigToProductionSender sends the ApplySlotConfigToProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApplySlotConfigToProductionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ApplySlotConfigToProductionResponder handles the response to the ApplySlotConfigToProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) ApplySlotConfigToProductionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApplySlotConfigurationSlot applies the configuration settings from the +// target slot onto the current slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. slot is name of the source slot. +// If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) ApplySlotConfigurationSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ApplySlotConfigurationSlot") + } + + req, err := client.ApplySlotConfigurationSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ApplySlotConfigurationSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.ApplySlotConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ApplySlotConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// ApplySlotConfigurationSlotPreparer prepares the ApplySlotConfigurationSlot request. +func (client AppsClient) ApplySlotConfigurationSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/applySlotConfig", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ApplySlotConfigurationSlotSender sends the ApplySlotConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ApplySlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ApplySlotConfigurationSlotResponder handles the response to the ApplySlotConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ApplySlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Backup creates a backup of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is backup configuration. You can +// use the JSON response from the POST action as input here. +func (client AppsClient) Backup(resourceGroupName string, name string, request BackupRequest) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Backup") + } + + req, err := client.BackupPreparer(resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", nil, "Failure preparing request") + return + } + + resp, err := client.BackupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure sending request") + return + } + + result, err = client.BackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Backup", resp, "Failure responding to request") + } + + return +} + +// BackupPreparer prepares the Backup request. +func (client AppsClient) BackupPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// BackupSender sends the Backup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) BackupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// BackupResponder handles the response to the Backup request. The method always +// closes the http.Response Body. +func (client AppsClient) BackupResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackupSlot creates a backup of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is backup configuration. You can +// use the JSON response from the POST action as input here. slot is name of +// the deployment slot. If a slot is not specified, the API will create a +// backup for the production slot. +func (client AppsClient) BackupSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "BackupSlot") + } + + req, err := client.BackupSlotPreparer(resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", nil, "Failure preparing request") + return + } + + resp, err := client.BackupSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure sending request") + return + } + + result, err = client.BackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "BackupSlot", resp, "Failure responding to request") + } + + return +} + +// BackupSlotPreparer prepares the BackupSlot request. +func (client AppsClient) BackupSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// BackupSlotSender sends the BackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) BackupSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// BackupSlotResponder handles the response to the BackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) BackupSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateDeployment create a deployment for an app, a specific deployment slot, +// and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is iD of an existing deployment. +// deployment is deployment details. +func (client AppsClient) CreateDeployment(resourceGroupName string, name string, ID string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateDeployment") + } + + req, err := client.CreateDeploymentPreparer(resourceGroupName, name, ID, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.CreateDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure sending request") + return + } + + result, err = client.CreateDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeployment", resp, "Failure responding to request") + } + + return +} + +// CreateDeploymentPreparer prepares the CreateDeployment request. +func (client AppsClient) CreateDeploymentPreparer(resourceGroupName string, name string, ID string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateDeploymentSender sends the CreateDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateDeploymentResponder handles the response to the CreateDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateDeploymentSlot create a deployment for an app, a specific deployment +// slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is iD of an existing deployment. slot +// is name of the deployment slot. If a slot is not specified, the API creates +// a deployment for the production slot. deployment is deployment details. +func (client AppsClient) CreateDeploymentSlot(resourceGroupName string, name string, ID string, slot string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateDeploymentSlot") + } + + req, err := client.CreateDeploymentSlotPreparer(resourceGroupName, name, ID, slot, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// CreateDeploymentSlotPreparer prepares the CreateDeploymentSlot request. +func (client AppsClient) CreateDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateDeploymentSlotSender sends the CreateDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateDeploymentSlotResponder handles the response to the CreateDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceDeployment create a deployment for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is iD of an existing deployment. +// instanceID is iD of a specific scaled-out instance. This is the value of the +// name property in the JSON response from "GET api/sites/{siteName}/instances" +// deployment is deployment details. +func (client AppsClient) CreateInstanceDeployment(resourceGroupName string, name string, ID string, instanceID string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateInstanceDeployment") + } + + req, err := client.CreateInstanceDeploymentPreparer(resourceGroupName, name, ID, instanceID, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.CreateInstanceDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", resp, "Failure sending request") + return + } + + result, err = client.CreateInstanceDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeployment", resp, "Failure responding to request") + } + + return +} + +// CreateInstanceDeploymentPreparer prepares the CreateInstanceDeployment request. +func (client AppsClient) CreateInstanceDeploymentPreparer(resourceGroupName string, name string, ID string, instanceID string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateInstanceDeploymentSender sends the CreateInstanceDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateInstanceDeploymentResponder handles the response to the CreateInstanceDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateInstanceDeploymentSlot create a deployment for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is iD of an existing deployment. slot +// is name of the deployment slot. If a slot is not specified, the API creates +// a deployment for the production slot. instanceID is iD of a specific +// scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances" deployment is deployment +// details. +func (client AppsClient) CreateInstanceDeploymentSlot(resourceGroupName string, name string, ID string, slot string, instanceID string, deployment Deployment) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateInstanceDeploymentSlot") + } + + req, err := client.CreateInstanceDeploymentSlotPreparer(resourceGroupName, name, ID, slot, instanceID, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateInstanceDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateInstanceDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateInstanceDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// CreateInstanceDeploymentSlotPreparer prepares the CreateInstanceDeploymentSlot request. +func (client AppsClient) CreateInstanceDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, instanceID string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithJSON(deployment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateInstanceDeploymentSlotSender sends the CreateInstanceDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateInstanceDeploymentSlotResponder handles the response to the CreateInstanceDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates a new web, mobile, or API app in an existing resource +// group, or updates an existing app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is unique name of the app to create or update. To create or +// update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON +// representation of the app properties. See example. skipDNSRegistration is if +// true web app hostname is not registered with DNS on creation. This parameter +// is +// only used for app creation skipCustomDomainVerification is if true, custom +// (non *.azurewebsites.net) domains associated with web app are not verified. +// forceDNSRegistration is if true, web app hostname is force registered with +// DNS TTLInSeconds is time to live in seconds for web app's default domain +// name +func (client AppsClient) CreateOrUpdate(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (<-chan Site, <-chan error) { + resultChan := make(chan Site, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteEnvelope, + Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Site + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, siteEnvelope, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, siteEnvelope Site, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + if skipCustomDomainVerification != nil { + queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) + } + if forceDNSRegistration != nil { + queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) + } + if len(TTLInSeconds) > 0 { + queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateConfiguration updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. +func (client AppsClient) CreateOrUpdateConfiguration(resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteConfig, + Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateConfiguration") + } + + req, err := client.CreateOrUpdateConfigurationPreparer(resourceGroupName, name, siteConfig) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfiguration", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateConfigurationPreparer prepares the CreateOrUpdateConfiguration request. +func (client AppsClient) CreateOrUpdateConfigurationPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateConfigurationSender sends the CreateOrUpdateConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateConfigurationResponder handles the response to the CreateOrUpdateConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateConfigurationSlot updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. slot is name of the deployment slot. If a +// slot is not specified, the API will update configuration for the production +// slot. +func (client AppsClient) CreateOrUpdateConfigurationSlot(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteConfig, + Constraints: []validation.Constraint{{Target: "siteConfig.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteConfig.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot") + } + + req, err := client.CreateOrUpdateConfigurationSlotPreparer(resourceGroupName, name, siteConfig, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateConfigurationSlotPreparer prepares the CreateOrUpdateConfigurationSlot request. +func (client AppsClient) CreateOrUpdateConfigurationSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateConfigurationSlotSender sends the CreateOrUpdateConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateConfigurationSlotResponder handles the response to the CreateOrUpdateConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateDomainOwnershipIdentifier creates a domain ownership +// identifier for web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier") + } + + req, err := client.CreateOrUpdateDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateDomainOwnershipIdentifierPreparer prepares the CreateOrUpdateDomainOwnershipIdentifier request. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateDomainOwnershipIdentifierSender sends the CreateOrUpdateDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateDomainOwnershipIdentifierResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateDomainOwnershipIdentifierSlot creates a domain ownership +// identifier for web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. slot is name of the +// deployment slot. If a slot is not specified, the API will delete the binding +// for the production slot. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot") + } + + req, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotPreparer prepares the CreateOrUpdateDomainOwnershipIdentifierSlot request. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotSender sends the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateDomainOwnershipIdentifierSlotResponder handles the response to the CreateOrUpdateDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostNameBinding creates a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. hostNameBinding is binding details. This is the JSON representation +// of a HostNameBinding object. +func (client AppsClient) CreateOrUpdateHostNameBinding(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding") + } + + req, err := client.CreateOrUpdateHostNameBindingPreparer(resourceGroupName, name, hostName, hostNameBinding) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHostNameBindingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBinding", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHostNameBindingPreparer prepares the CreateOrUpdateHostNameBinding request. +func (client AppsClient) CreateOrUpdateHostNameBindingPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithJSON(hostNameBinding), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHostNameBindingSender sends the CreateOrUpdateHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostNameBindingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHostNameBindingResponder handles the response to the CreateOrUpdateHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHostNameBindingSlot creates a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. hostNameBinding is binding details. This is the JSON representation +// of a HostNameBinding object. slot is name of the deployment slot. If a slot +// is not specified, the API will create a binding for the production slot. +func (client AppsClient) CreateOrUpdateHostNameBindingSlot(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot") + } + + req, err := client.CreateOrUpdateHostNameBindingSlotPreparer(resourceGroupName, name, hostName, hostNameBinding, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHostNameBindingSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHostNameBindingSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHostNameBindingSlotPreparer prepares the CreateOrUpdateHostNameBindingSlot request. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotPreparer(resourceGroupName string, name string, hostName string, hostNameBinding HostNameBinding, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithJSON(hostNameBinding), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHostNameBindingSlotSender sends the CreateOrUpdateHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHostNameBindingSlotResponder handles the response to the CreateOrUpdateHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHybridConnection creates a new Hybrid Connection using a +// Service Bus relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection +func (client AppsClient) CreateOrUpdateHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHybridConnection") + } + + req, err := client.CreateOrUpdateHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnection", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHybridConnectionPreparer prepares the CreateOrUpdateHybridConnection request. +func (client AppsClient) CreateOrUpdateHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHybridConnectionSender sends the CreateOrUpdateHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHybridConnectionResponder handles the response to the CreateOrUpdateHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateHybridConnectionSlot creates a new Hybrid Connection using a +// Service Bus relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection slot +// is the name of the slot for the web app. +func (client AppsClient) CreateOrUpdateHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot") + } + + req, err := client.CreateOrUpdateHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateHybridConnectionSlotPreparer prepares the CreateOrUpdateHybridConnectionSlot request. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateHybridConnectionSlotSender sends the CreateOrUpdateHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateHybridConnectionSlotResponder handles the response to the CreateOrUpdateHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateRelayServiceConnection creates a new hybrid connection +// configuration (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. +func (client AppsClient) CreateOrUpdateRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection") + } + + req, err := client.CreateOrUpdateRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateRelayServiceConnectionPreparer prepares the CreateOrUpdateRelayServiceConnection request. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateRelayServiceConnectionSender sends the CreateOrUpdateRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateRelayServiceConnectionResponder handles the response to the CreateOrUpdateRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateRelayServiceConnectionSlot creates a new hybrid connection +// configuration (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. slot is name of the deployment slot. If a slot is +// not specified, the API will create or update a hybrid connection for the +// production slot. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot") + } + + req, err := client.CreateOrUpdateRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateRelayServiceConnectionSlotPreparer prepares the CreateOrUpdateRelayServiceConnectionSlot request. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateRelayServiceConnectionSlotSender sends the CreateOrUpdateRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateRelayServiceConnectionSlotResponder handles the response to the CreateOrUpdateRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSlot creates a new web, mobile, or API app in an existing +// resource group, or updates an existing app. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is unique name of the app to create or update. To create or +// update a deployment slot, use the {slot} parameter. siteEnvelope is a JSON +// representation of the app properties. See example. slot is name of the +// deployment slot to create or update. By default, this API attempts to create +// or modify the production slot. skipDNSRegistration is if true web app +// hostname is not registered with DNS on creation. This parameter is +// only used for app creation skipCustomDomainVerification is if true, custom +// (non *.azurewebsites.net) domains associated with web app are not verified. +// forceDNSRegistration is if true, web app hostname is force registered with +// DNS TTLInSeconds is time to live in seconds for web app's default domain +// name +func (client AppsClient) CreateOrUpdateSlot(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (<-chan Site, <-chan error) { + resultChan := make(chan Site, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteEnvelope, + Constraints: []validation.Constraint{{Target: "siteEnvelope.SiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.SiteConfig.Push.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteEnvelope.SiteProperties.CloningInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteEnvelope.SiteProperties.CloningInfo.SourceWebAppID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSlot") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Site + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateSlotPreparer(resourceGroupName, name, siteEnvelope, slot, skipDNSRegistration, skipCustomDomainVerification, forceDNSRegistration, TTLInSeconds, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSlot", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateSlotPreparer prepares the CreateOrUpdateSlot request. +func (client AppsClient) CreateOrUpdateSlotPreparer(resourceGroupName string, name string, siteEnvelope Site, slot string, skipDNSRegistration *bool, skipCustomDomainVerification *bool, forceDNSRegistration *bool, TTLInSeconds string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + if skipCustomDomainVerification != nil { + queryParameters["skipCustomDomainVerification"] = autorest.Encode("query", *skipCustomDomainVerification) + } + if forceDNSRegistration != nil { + queryParameters["forceDnsRegistration"] = autorest.Encode("query", *forceDNSRegistration) + } + if len(TTLInSeconds) > 0 { + queryParameters["ttlInSeconds"] = autorest.Encode("query", TTLInSeconds) + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithJSON(siteEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSlotSender sends the CreateOrUpdateSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateSlotResponder handles the response to the CreateOrUpdateSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSlotResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSourceControl updates the source control configuration of an +// app. This method may poll for completion. Polling can be canceled by passing +// the cancel channel argument. The channel will be used to cancel polling and +// any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteSourceControl is jSON representation +// of a SiteSourceControl object. See example. +func (client AppsClient) CreateOrUpdateSourceControl(resourceGroupName string, name string, siteSourceControl SiteSourceControl, cancel <-chan struct{}) (<-chan SiteSourceControl, <-chan error) { + resultChan := make(chan SiteSourceControl, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSourceControl") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result SiteSourceControl + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateSourceControlPreparer(resourceGroupName, name, siteSourceControl, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControl", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateSourceControlPreparer prepares the CreateOrUpdateSourceControl request. +func (client AppsClient) CreateOrUpdateSourceControlPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSourceControlSender sends the CreateOrUpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateSourceControlResponder handles the response to the CreateOrUpdateSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSourceControlSlot updates the source control configuration of +// an app. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteSourceControl is jSON representation +// of a SiteSourceControl object. See example. slot is name of the deployment +// slot. If a slot is not specified, the API will update the source control +// configuration for the production slot. +func (client AppsClient) CreateOrUpdateSourceControlSlot(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string, cancel <-chan struct{}) (<-chan SiteSourceControl, <-chan error) { + resultChan := make(chan SiteSourceControl, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result SiteSourceControl + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateSourceControlSlotPreparer(resourceGroupName, name, siteSourceControl, slot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSourceControlSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateSourceControlSlot", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateSourceControlSlotPreparer prepares the CreateOrUpdateSourceControlSlot request. +func (client AppsClient) CreateOrUpdateSourceControlSlotPreparer(resourceGroupName string, name string, siteSourceControl SiteSourceControl, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithJSON(siteSourceControl), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSourceControlSlotSender sends the CreateOrUpdateSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateSourceControlSlotResponder handles the response to the CreateOrUpdateSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnection adds a Virtual Network connection to an app or +// slot (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. +func (client AppsClient) CreateOrUpdateVnetConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnection") + } + + req, err := client.CreateOrUpdateVnetConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnection", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionPreparer prepares the CreateOrUpdateVnetConnection request. +func (client AppsClient) CreateOrUpdateVnetConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionSender sends the CreateOrUpdateVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionResponder handles the response to the CreateOrUpdateVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionGateway adds a gateway to a connected Virtual +// Network (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +func (client AppsClient) CreateOrUpdateVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway") + } + + req, err := client.CreateOrUpdateVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGateway", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionGatewayPreparer prepares the CreateOrUpdateVnetConnectionGateway request. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionGatewaySender sends the CreateOrUpdateVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionGatewayResponder handles the response to the CreateOrUpdateVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionGatewaySlot adds a gateway to a connected +// Virtual Network (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +// slot is name of the deployment slot. If a slot is not specified, the API +// will add or update a gateway for the production slot's Virtual Network. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot") + } + + req, err := client.CreateOrUpdateVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionGatewaySlotPreparer prepares the CreateOrUpdateVnetConnectionGatewaySlot request. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionGatewaySlotSender sends the CreateOrUpdateVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionGatewaySlotResponder handles the response to the CreateOrUpdateVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetConnectionSlot adds a Virtual Network connection to an app +// or slot (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. slot is name of the deployment slot. If a slot is not +// specified, the API will add or update connections for the production slot. +func (client AppsClient) CreateOrUpdateVnetConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot") + } + + req, err := client.CreateOrUpdateVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "CreateOrUpdateVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetConnectionSlotPreparer prepares the CreateOrUpdateVnetConnectionSlot request. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetConnectionSlotSender sends the CreateOrUpdateVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetConnectionSlotResponder handles the response to the CreateOrUpdateVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a web, mobile, or API app, or one of the deployment slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app to delete. deleteMetrics is if true, web +// app metrics are also deleted deleteEmptyServerFarm is specify true if the +// App Service plan will be empty after app deletion and you want to delete the +// empty App Service plan. By default, the empty App Service plan is not +// deleted. skipDNSRegistration is if true, DNS registration is skipped +func (client AppsClient) Delete(resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(resourceGroupName string, name string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteMetrics != nil { + queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) + } + if deleteEmptyServerFarm != nil { + queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackup deletes a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. +func (client AppsClient) DeleteBackup(resourceGroupName string, name string, backupID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackup") + } + + req, err := client.DeleteBackupPreparer(resourceGroupName, name, backupID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackup", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupPreparer prepares the DeleteBackup request. +func (client AppsClient) DeleteBackupPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupSender sends the DeleteBackup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupResponder handles the response to the DeleteBackup request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupConfiguration deletes the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) DeleteBackupConfiguration(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupConfiguration") + } + + req, err := client.DeleteBackupConfigurationPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupConfigurationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfiguration", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupConfigurationPreparer prepares the DeleteBackupConfiguration request. +func (client AppsClient) DeleteBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupConfigurationSender sends the DeleteBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupConfigurationResponder handles the response to the DeleteBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupConfigurationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupConfigurationSlot deletes the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the backup configuration for the +// production slot. +func (client AppsClient) DeleteBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupConfigurationSlot") + } + + req, err := client.DeleteBackupConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupConfigurationSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupConfigurationSlotPreparer prepares the DeleteBackupConfigurationSlot request. +func (client AppsClient) DeleteBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupConfigurationSlotSender sends the DeleteBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupConfigurationSlotResponder handles the response to the DeleteBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteBackupSlot deletes a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. slot is name +// of the deployment slot. If a slot is not specified, the API will delete a +// backup of the production slot. +func (client AppsClient) DeleteBackupSlot(resourceGroupName string, name string, backupID string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteBackupSlot") + } + + req, err := client.DeleteBackupSlotPreparer(resourceGroupName, name, backupID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteBackupSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteBackupSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteBackupSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteBackupSlotPreparer prepares the DeleteBackupSlot request. +func (client AppsClient) DeleteBackupSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteBackupSlotSender sends the DeleteBackupSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteBackupSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteBackupSlotResponder handles the response to the DeleteBackupSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteBackupSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDeployment delete a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. +func (client AppsClient) DeleteDeployment(resourceGroupName string, name string, ID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDeployment") + } + + req, err := client.DeleteDeploymentPreparer(resourceGroupName, name, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDeploymentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure sending request") + return + } + + result, err = client.DeleteDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeployment", resp, "Failure responding to request") + } + + return +} + +// DeleteDeploymentPreparer prepares the DeleteDeployment request. +func (client AppsClient) DeleteDeploymentPreparer(resourceGroupName string, name string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDeploymentSender sends the DeleteDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDeploymentResponder handles the response to the DeleteDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDeploymentSlot delete a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API deletes a deployment +// for the production slot. +func (client AppsClient) DeleteDeploymentSlot(resourceGroupName string, name string, ID string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDeploymentSlot") + } + + req, err := client.DeleteDeploymentSlotPreparer(resourceGroupName, name, ID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDeploymentSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteDeploymentSlotPreparer prepares the DeleteDeploymentSlot request. +func (client AppsClient) DeleteDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDeploymentSlotSender sends the DeleteDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDeploymentSlotResponder handles the response to the DeleteDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDomainOwnershipIdentifier deletes a domain ownership identifier for a +// web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. +func (client AppsClient) DeleteDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier") + } + + req, err := client.DeleteDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.DeleteDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// DeleteDomainOwnershipIdentifierPreparer prepares the DeleteDomainOwnershipIdentifier request. +func (client AppsClient) DeleteDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDomainOwnershipIdentifierSender sends the DeleteDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDomainOwnershipIdentifierResponder handles the response to the DeleteDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDomainOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteDomainOwnershipIdentifierSlot deletes a domain ownership identifier +// for a web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. slot is name of the deployment slot. If a slot +// is not specified, the API will delete the binding for the production slot. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot") + } + + req, err := client.DeleteDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteDomainOwnershipIdentifierSlotPreparer prepares the DeleteDomainOwnershipIdentifierSlot request. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteDomainOwnershipIdentifierSlotSender sends the DeleteDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteDomainOwnershipIdentifierSlotResponder handles the response to the DeleteDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostNameBinding deletes a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. +func (client AppsClient) DeleteHostNameBinding(resourceGroupName string, name string, hostName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHostNameBinding") + } + + req, err := client.DeleteHostNameBindingPreparer(resourceGroupName, name, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHostNameBindingSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure sending request") + return + } + + result, err = client.DeleteHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBinding", resp, "Failure responding to request") + } + + return +} + +// DeleteHostNameBindingPreparer prepares the DeleteHostNameBinding request. +func (client AppsClient) DeleteHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHostNameBindingSender sends the DeleteHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostNameBindingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHostNameBindingResponder handles the response to the DeleteHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostNameBindingResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHostNameBindingSlot deletes a hostname binding for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the binding for the production +// slot. hostName is hostname in the hostname binding. +func (client AppsClient) DeleteHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHostNameBindingSlot") + } + + req, err := client.DeleteHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHostNameBindingSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHostNameBindingSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteHostNameBindingSlotPreparer prepares the DeleteHostNameBindingSlot request. +func (client AppsClient) DeleteHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHostNameBindingSlotSender sends the DeleteHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHostNameBindingSlotResponder handles the response to the DeleteHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHostNameBindingSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnection removes a Hybrid Connection from this site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection +func (client AppsClient) DeleteHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHybridConnection") + } + + req, err := client.DeleteHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHybridConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. +func (client AppsClient) DeleteHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnectionSlot removes a Hybrid Connection from this site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection slot is the name of the slot for the web app. +func (client AppsClient) DeleteHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteHybridConnectionSlot") + } + + req, err := client.DeleteHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHybridConnectionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteHybridConnectionSlotPreparer prepares the DeleteHybridConnectionSlot request. +func (client AppsClient) DeleteHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHybridConnectionSlotSender sends the DeleteHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHybridConnectionSlotResponder handles the response to the DeleteHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteHybridConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceDeployment delete a deployment by its ID for an app, a +// specific deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. instanceID is iD of a +// specific scaled-out instance. This is the value of the name property in the +// JSON response from "GET api/sites/{siteName}/instances" +func (client AppsClient) DeleteInstanceDeployment(resourceGroupName string, name string, ID string, instanceID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteInstanceDeployment") + } + + req, err := client.DeleteInstanceDeploymentPreparer(resourceGroupName, name, ID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteInstanceDeploymentSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", resp, "Failure sending request") + return + } + + result, err = client.DeleteInstanceDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeployment", resp, "Failure responding to request") + } + + return +} + +// DeleteInstanceDeploymentPreparer prepares the DeleteInstanceDeployment request. +func (client AppsClient) DeleteInstanceDeploymentPreparer(resourceGroupName string, name string, ID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteInstanceDeploymentSender sends the DeleteInstanceDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteInstanceDeploymentResponder handles the response to the DeleteInstanceDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceDeploymentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteInstanceDeploymentSlot delete a deployment by its ID for an app, a +// specific deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API deletes a deployment +// for the production slot. instanceID is iD of a specific scaled-out instance. +// This is the value of the name property in the JSON response from "GET +// api/sites/{siteName}/instances" +func (client AppsClient) DeleteInstanceDeploymentSlot(resourceGroupName string, name string, ID string, slot string, instanceID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot") + } + + req, err := client.DeleteInstanceDeploymentSlotPreparer(resourceGroupName, name, ID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteInstanceDeploymentSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteInstanceDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteInstanceDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteInstanceDeploymentSlotPreparer prepares the DeleteInstanceDeploymentSlot request. +func (client AppsClient) DeleteInstanceDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteInstanceDeploymentSlotSender sends the DeleteInstanceDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteInstanceDeploymentSlotResponder handles the response to the DeleteInstanceDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteInstanceDeploymentSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePremierAddOn delete a premier add-on from an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +func (client AppsClient) DeletePremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeletePremierAddOn") + } + + req, err := client.DeletePremierAddOnPreparer(resourceGroupName, name, premierAddOnName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePremierAddOnSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.DeletePremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOn", resp, "Failure responding to request") + } + + return +} + +// DeletePremierAddOnPreparer prepares the DeletePremierAddOn request. +func (client AppsClient) DeletePremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeletePremierAddOnSender sends the DeletePremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePremierAddOnSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeletePremierAddOnResponder handles the response to the DeletePremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePremierAddOnResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePremierAddOnSlot delete a premier add-on from an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. slot is +// name of the deployment slot. If a slot is not specified, the API will delete +// the named add-on for the production slot. +func (client AppsClient) DeletePremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeletePremierAddOnSlot") + } + + req, err := client.DeletePremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeletePremierAddOnSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.DeletePremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeletePremierAddOnSlot", resp, "Failure responding to request") + } + + return +} + +// DeletePremierAddOnSlotPreparer prepares the DeletePremierAddOnSlot request. +func (client AppsClient) DeletePremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeletePremierAddOnSlotSender sends the DeletePremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeletePremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeletePremierAddOnSlotResponder handles the response to the DeletePremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeletePremierAddOnSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteRelayServiceConnection deletes a relay service connection by its name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. +func (client AppsClient) DeleteRelayServiceConnection(resourceGroupName string, name string, entityName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteRelayServiceConnection") + } + + req, err := client.DeleteRelayServiceConnectionPreparer(resourceGroupName, name, entityName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteRelayServiceConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteRelayServiceConnectionPreparer prepares the DeleteRelayServiceConnection request. +func (client AppsClient) DeleteRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteRelayServiceConnectionSender sends the DeleteRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteRelayServiceConnectionResponder handles the response to the DeleteRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteRelayServiceConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteRelayServiceConnectionSlot deletes a relay service connection by its +// name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. slot is name of the deployment slot. If a slot is +// not specified, the API will delete a hybrid connection for the production +// slot. +func (client AppsClient) DeleteRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot") + } + + req, err := client.DeleteRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteRelayServiceConnectionSlotPreparer prepares the DeleteRelayServiceConnectionSlot request. +func (client AppsClient) DeleteRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteRelayServiceConnectionSlotSender sends the DeleteRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteRelayServiceConnectionSlotResponder handles the response to the DeleteRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteRelayServiceConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSlot deletes a web, mobile, or API app, or one of the deployment +// slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app to delete. slot is name of the deployment +// slot to delete. By default, the API deletes the production slot. +// deleteMetrics is if true, web app metrics are also deleted +// deleteEmptyServerFarm is specify true if the App Service plan will be empty +// after app deletion and you want to delete the empty App Service plan. By +// default, the empty App Service plan is not deleted. skipDNSRegistration is +// if true, DNS registration is skipped +func (client AppsClient) DeleteSlot(resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSlot") + } + + req, err := client.DeleteSlotPreparer(resourceGroupName, name, slot, deleteMetrics, deleteEmptyServerFarm, skipDNSRegistration) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteSlotPreparer prepares the DeleteSlot request. +func (client AppsClient) DeleteSlotPreparer(resourceGroupName string, name string, slot string, deleteMetrics *bool, deleteEmptyServerFarm *bool, skipDNSRegistration *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteMetrics != nil { + queryParameters["deleteMetrics"] = autorest.Encode("query", *deleteMetrics) + } + if deleteEmptyServerFarm != nil { + queryParameters["deleteEmptyServerFarm"] = autorest.Encode("query", *deleteEmptyServerFarm) + } + if skipDNSRegistration != nil { + queryParameters["skipDnsRegistration"] = autorest.Encode("query", *skipDNSRegistration) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSlotSender sends the DeleteSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSlotResponder handles the response to the DeleteSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSourceControl deletes the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) DeleteSourceControl(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSourceControl") + } + + req, err := client.DeleteSourceControlPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSourceControlSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure sending request") + return + } + + result, err = client.DeleteSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControl", resp, "Failure responding to request") + } + + return +} + +// DeleteSourceControlPreparer prepares the DeleteSourceControl request. +func (client AppsClient) DeleteSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSourceControlSender sends the DeleteSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSourceControlResponder handles the response to the DeleteSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSourceControlResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteSourceControlSlot deletes the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the source control configuration +// for the production slot. +func (client AppsClient) DeleteSourceControlSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteSourceControlSlot") + } + + req, err := client.DeleteSourceControlSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSourceControlSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteSourceControlSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteSourceControlSlotPreparer prepares the DeleteSourceControlSlot request. +func (client AppsClient) DeleteSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSourceControlSlotSender sends the DeleteSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSourceControlSlotResponder handles the response to the DeleteSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteSourceControlSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetConnection deletes a connection from an app (or deployment slot to +// a named virtual network. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +func (client AppsClient) DeleteVnetConnection(resourceGroupName string, name string, vnetName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteVnetConnection") + } + + req, err := client.DeleteVnetConnectionPreparer(resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteVnetConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteVnetConnectionPreparer prepares the DeleteVnetConnection request. +func (client AppsClient) DeleteVnetConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteVnetConnectionSender sends the DeleteVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteVnetConnectionResponder handles the response to the DeleteVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteVnetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetConnectionSlot deletes a connection from an app (or deployment +// slot to a named virtual network. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +// slot is name of the deployment slot. If a slot is not specified, the API +// will delete the connection for the production slot. +func (client AppsClient) DeleteVnetConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DeleteVnetConnectionSlot") + } + + req, err := client.DeleteVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteVnetConnectionSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.DeleteVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DeleteVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// DeleteVnetConnectionSlotPreparer prepares the DeleteVnetConnectionSlot request. +func (client AppsClient) DeleteVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteVnetConnectionSlotSender sends the DeleteVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteVnetConnectionSlotResponder handles the response to the DeleteVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteVnetConnectionSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// DiscoverRestore discovers an existing app backup that can be restored from a +// blob in Azure storage. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is a RestoreRequest object that +// includes Azure storage URL and blog name for discovery of backup. +func (client AppsClient) DiscoverRestore(resourceGroupName string, name string, request RestoreRequest) (result RestoreRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DiscoverRestore") + } + + req, err := client.DiscoverRestorePreparer(resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", nil, "Failure preparing request") + return + } + + resp, err := client.DiscoverRestoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", resp, "Failure sending request") + return + } + + result, err = client.DiscoverRestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestore", resp, "Failure responding to request") + } + + return +} + +// DiscoverRestorePreparer prepares the DiscoverRestore request. +func (client AppsClient) DiscoverRestorePreparer(resourceGroupName string, name string, request RestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/discover", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DiscoverRestoreSender sends the DiscoverRestore request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DiscoverRestoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DiscoverRestoreResponder handles the response to the DiscoverRestore request. The method always +// closes the http.Response Body. +func (client AppsClient) DiscoverRestoreResponder(resp *http.Response) (result RestoreRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DiscoverRestoreSlot discovers an existing app backup that can be restored +// from a blob in Azure storage. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is a RestoreRequest object that +// includes Azure storage URL and blog name for discovery of backup. slot is +// name of the deployment slot. If a slot is not specified, the API will +// perform discovery for the production slot. +func (client AppsClient) DiscoverRestoreSlot(resourceGroupName string, name string, request RestoreRequest, slot string) (result RestoreRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "DiscoverRestoreSlot") + } + + req, err := client.DiscoverRestoreSlotPreparer(resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", nil, "Failure preparing request") + return + } + + resp, err := client.DiscoverRestoreSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", resp, "Failure sending request") + return + } + + result, err = client.DiscoverRestoreSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "DiscoverRestoreSlot", resp, "Failure responding to request") + } + + return +} + +// DiscoverRestoreSlotPreparer prepares the DiscoverRestoreSlot request. +func (client AppsClient) DiscoverRestoreSlotPreparer(resourceGroupName string, name string, request RestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/discover", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DiscoverRestoreSlotSender sends the DiscoverRestoreSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DiscoverRestoreSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DiscoverRestoreSlotResponder handles the response to the DiscoverRestoreSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) DiscoverRestoreSlotResponder(resp *http.Response) (result RestoreRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GenerateNewSitePublishingPassword generates a new publishing password for an +// app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GenerateNewSitePublishingPassword(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GenerateNewSitePublishingPassword") + } + + req, err := client.GenerateNewSitePublishingPasswordPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateNewSitePublishingPasswordSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure sending request") + return + } + + result, err = client.GenerateNewSitePublishingPasswordResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPassword", resp, "Failure responding to request") + } + + return +} + +// GenerateNewSitePublishingPasswordPreparer prepares the GenerateNewSitePublishingPassword request. +func (client AppsClient) GenerateNewSitePublishingPasswordPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/newpassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateNewSitePublishingPasswordSender sends the GenerateNewSitePublishingPassword request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GenerateNewSitePublishingPasswordSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateNewSitePublishingPasswordResponder handles the response to the GenerateNewSitePublishingPassword request. The method always +// closes the http.Response Body. +func (client AppsClient) GenerateNewSitePublishingPasswordResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateNewSitePublishingPasswordSlot generates a new publishing password +// for an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API generate a new publishing password for the +// production slot. +func (client AppsClient) GenerateNewSitePublishingPasswordSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot") + } + + req, err := client.GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateNewSitePublishingPasswordSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure sending request") + return + } + + result, err = client.GenerateNewSitePublishingPasswordSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GenerateNewSitePublishingPasswordSlot", resp, "Failure responding to request") + } + + return +} + +// GenerateNewSitePublishingPasswordSlotPreparer prepares the GenerateNewSitePublishingPasswordSlot request. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/newpassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GenerateNewSitePublishingPasswordSlotSender sends the GenerateNewSitePublishingPasswordSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GenerateNewSitePublishingPasswordSlotResponder handles the response to the GenerateNewSitePublishingPasswordSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GenerateNewSitePublishingPasswordSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of a web, mobile, or API app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) Get(resourceGroupName string, name string) (result Site, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettings gets the Authentication/Authorization settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetAuthSettings(resourceGroupName string, name string) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetAuthSettings") + } + + req, err := client.GetAuthSettingsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettings", resp, "Failure responding to request") + } + + return +} + +// GetAuthSettingsPreparer prepares the GetAuthSettings request. +func (client AppsClient) GetAuthSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthSettingsSender sends the GetAuthSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthSettingsResponder handles the response to the GetAuthSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAuthSettingsSlot gets the Authentication/Authorization settings of an +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the settings for the production +// slot. +func (client AppsClient) GetAuthSettingsSlot(resourceGroupName string, name string, slot string) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetAuthSettingsSlot") + } + + req, err := client.GetAuthSettingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetAuthSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.GetAuthSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetAuthSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// GetAuthSettingsSlotPreparer prepares the GetAuthSettingsSlot request. +func (client AppsClient) GetAuthSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAuthSettingsSlotSender sends the GetAuthSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAuthSettingsSlotResponder handles the response to the GetAuthSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupConfiguration gets the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetBackupConfiguration(resourceGroupName string, name string) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupConfiguration") + } + + req, err := client.GetBackupConfigurationPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetBackupConfigurationPreparer prepares the GetBackupConfiguration request. +func (client AppsClient) GetBackupConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupConfigurationSender sends the GetBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupConfigurationResponder handles the response to the GetBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupConfigurationSlot gets the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the backup configuration for the +// production slot. +func (client AppsClient) GetBackupConfigurationSlot(resourceGroupName string, name string, slot string) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupConfigurationSlot") + } + + req, err := client.GetBackupConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// GetBackupConfigurationSlotPreparer prepares the GetBackupConfigurationSlot request. +func (client AppsClient) GetBackupConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupConfigurationSlotSender sends the GetBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupConfigurationSlotResponder handles the response to the GetBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupStatus gets a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. +func (client AppsClient) GetBackupStatus(resourceGroupName string, name string, backupID string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupStatus") + } + + req, err := client.GetBackupStatusPreparer(resourceGroupName, name, backupID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure sending request") + return + } + + result, err = client.GetBackupStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatus", resp, "Failure responding to request") + } + + return +} + +// GetBackupStatusPreparer prepares the GetBackupStatus request. +func (client AppsClient) GetBackupStatusPreparer(resourceGroupName string, name string, backupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupStatusSender sends the GetBackupStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupStatusResponder handles the response to the GetBackupStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupStatusResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBackupStatusSlot gets a backup of an app by its ID. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. slot is name +// of the deployment slot. If a slot is not specified, the API will get a +// backup of the production slot. +func (client AppsClient) GetBackupStatusSlot(resourceGroupName string, name string, backupID string, slot string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetBackupStatusSlot") + } + + req, err := client.GetBackupStatusSlotPreparer(resourceGroupName, name, backupID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetBackupStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.GetBackupStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetBackupStatusSlot", resp, "Failure responding to request") + } + + return +} + +// GetBackupStatusSlotPreparer prepares the GetBackupStatusSlot request. +func (client AppsClient) GetBackupStatusSlotPreparer(resourceGroupName string, name string, backupID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetBackupStatusSlotSender sends the GetBackupStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetBackupStatusSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetBackupStatusSlotResponder handles the response to the GetBackupStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetBackupStatusSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfiguration gets the configuration of an app, such as platform version +// and bitness, default documents, virtual applications, Always On, etc. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetConfiguration(resourceGroupName string, name string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfiguration") + } + + req, err := client.GetConfigurationPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationPreparer prepares the GetConfiguration request. +func (client AppsClient) GetConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSender sends the GetConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationResponder handles the response to the GetConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSlot gets the configuration of an app, such as platform +// version and bitness, default documents, virtual applications, Always On, +// etc. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will return configuration for the production +// slot. +func (client AppsClient) GetConfigurationSlot(resourceGroupName string, name string, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSlot") + } + + req, err := client.GetConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationSlotPreparer prepares the GetConfigurationSlot request. +func (client AppsClient) GetConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSlotSender sends the GetConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationSlotResponder handles the response to the GetConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSnapshot gets a snapshot of the configuration of an app at a +// previous point in time. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. +func (client AppsClient) GetConfigurationSnapshot(resourceGroupName string, name string, snapshotID string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSnapshot") + } + + req, err := client.GetConfigurationSnapshotPreparer(resourceGroupName, name, snapshotID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSnapshotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationSnapshotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshot", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationSnapshotPreparer prepares the GetConfigurationSnapshot request. +func (client AppsClient) GetConfigurationSnapshotPreparer(resourceGroupName string, name string, snapshotID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSnapshotSender sends the GetConfigurationSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationSnapshotResponder handles the response to the GetConfigurationSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSnapshotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetConfigurationSnapshotSlot gets a snapshot of the configuration of an app +// at a previous point in time. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. slot is name of the deployment slot. If a slot is not specified, the +// API will return configuration for the production slot. +func (client AppsClient) GetConfigurationSnapshotSlot(resourceGroupName string, name string, snapshotID string, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetConfigurationSnapshotSlot") + } + + req, err := client.GetConfigurationSnapshotSlotPreparer(resourceGroupName, name, snapshotID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetConfigurationSnapshotSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure sending request") + return + } + + result, err = client.GetConfigurationSnapshotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetConfigurationSnapshotSlot", resp, "Failure responding to request") + } + + return +} + +// GetConfigurationSnapshotSlotPreparer prepares the GetConfigurationSnapshotSlot request. +func (client AppsClient) GetConfigurationSnapshotSlotPreparer(resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetConfigurationSnapshotSlotSender sends the GetConfigurationSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetConfigurationSnapshotSlotResponder handles the response to the GetConfigurationSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetConfigurationSnapshotSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeployment get a deployment by its ID for an app, a specific deployment +// slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. +func (client AppsClient) GetDeployment(resourceGroupName string, name string, ID string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDeployment") + } + + req, err := client.GetDeploymentPreparer(resourceGroupName, name, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure sending request") + return + } + + result, err = client.GetDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeployment", resp, "Failure responding to request") + } + + return +} + +// GetDeploymentPreparer prepares the GetDeployment request. +func (client AppsClient) GetDeploymentPreparer(resourceGroupName string, name string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDeploymentSender sends the GetDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDeploymentResponder handles the response to the GetDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeploymentSlot get a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API gets a deployment for +// the production slot. +func (client AppsClient) GetDeploymentSlot(resourceGroupName string, name string, ID string, slot string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDeploymentSlot") + } + + req, err := client.GetDeploymentSlotPreparer(resourceGroupName, name, ID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.GetDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// GetDeploymentSlotPreparer prepares the GetDeploymentSlot request. +func (client AppsClient) GetDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDeploymentSlotSender sends the GetDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDeploymentSlotResponder handles the response to the GetDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticLogsConfiguration gets the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetDiagnosticLogsConfiguration(resourceGroupName string, name string) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration") + } + + req, err := client.GetDiagnosticLogsConfigurationPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetDiagnosticLogsConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetDiagnosticLogsConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfiguration", resp, "Failure responding to request") + } + + return +} + +// GetDiagnosticLogsConfigurationPreparer prepares the GetDiagnosticLogsConfiguration request. +func (client AppsClient) GetDiagnosticLogsConfigurationPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDiagnosticLogsConfigurationSender sends the GetDiagnosticLogsConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDiagnosticLogsConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDiagnosticLogsConfigurationResponder handles the response to the GetDiagnosticLogsConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDiagnosticLogsConfigurationResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticLogsConfigurationSlot gets the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the logging configuration for the +// production slot. +func (client AppsClient) GetDiagnosticLogsConfigurationSlot(resourceGroupName string, name string, slot string) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot") + } + + req, err := client.GetDiagnosticLogsConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetDiagnosticLogsConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.GetDiagnosticLogsConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDiagnosticLogsConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// GetDiagnosticLogsConfigurationSlotPreparer prepares the GetDiagnosticLogsConfigurationSlot request. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDiagnosticLogsConfigurationSlotSender sends the GetDiagnosticLogsConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDiagnosticLogsConfigurationSlotResponder handles the response to the GetDiagnosticLogsConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDiagnosticLogsConfigurationSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDomainOwnershipIdentifier get domain ownership identifier for web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. +func (client AppsClient) GetDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDomainOwnershipIdentifier") + } + + req, err := client.GetDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.GetDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.GetDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// GetDomainOwnershipIdentifierPreparer prepares the GetDomainOwnershipIdentifier request. +func (client AppsClient) GetDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDomainOwnershipIdentifierSender sends the GetDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDomainOwnershipIdentifierResponder handles the response to the GetDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDomainOwnershipIdentifierSlot get domain ownership identifier for web +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. slot is name of the deployment slot. If a slot +// is not specified, the API will delete the binding for the production slot. +func (client AppsClient) GetDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot") + } + + req, err := client.GetDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.GetDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// GetDomainOwnershipIdentifierSlotPreparer prepares the GetDomainOwnershipIdentifierSlot request. +func (client AppsClient) GetDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDomainOwnershipIdentifierSlotSender sends the GetDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDomainOwnershipIdentifierSlotResponder handles the response to the GetDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostNameBinding get the named hostname binding for an app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. hostName is hostname in the hostname +// binding. +func (client AppsClient) GetHostNameBinding(resourceGroupName string, name string, hostName string) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHostNameBinding") + } + + req, err := client.GetHostNameBindingPreparer(resourceGroupName, name, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", nil, "Failure preparing request") + return + } + + resp, err := client.GetHostNameBindingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure sending request") + return + } + + result, err = client.GetHostNameBindingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBinding", resp, "Failure responding to request") + } + + return +} + +// GetHostNameBindingPreparer prepares the GetHostNameBinding request. +func (client AppsClient) GetHostNameBindingPreparer(resourceGroupName string, name string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHostNameBindingSender sends the GetHostNameBinding request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHostNameBindingSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHostNameBindingResponder handles the response to the GetHostNameBinding request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHostNameBindingResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHostNameBindingSlot get the named hostname binding for an app (or +// deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API the named binding for the production slot. +// hostName is hostname in the hostname binding. +func (client AppsClient) GetHostNameBindingSlot(resourceGroupName string, name string, slot string, hostName string) (result HostNameBinding, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHostNameBindingSlot") + } + + req, err := client.GetHostNameBindingSlotPreparer(resourceGroupName, name, slot, hostName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetHostNameBindingSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure sending request") + return + } + + result, err = client.GetHostNameBindingSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHostNameBindingSlot", resp, "Failure responding to request") + } + + return +} + +// GetHostNameBindingSlotPreparer prepares the GetHostNameBindingSlot request. +func (client AppsClient) GetHostNameBindingSlotPreparer(resourceGroupName string, name string, slot string, hostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "hostName": autorest.Encode("path", hostName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHostNameBindingSlotSender sends the GetHostNameBindingSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHostNameBindingSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHostNameBindingSlotResponder handles the response to the GetHostNameBindingSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHostNameBindingSlotResponder(resp *http.Response) (result HostNameBinding, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnection retrieves a specific Service Bus Hybrid Connection used +// by this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection +func (client AppsClient) GetHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHybridConnection") + } + + req, err := client.GetHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnection", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionPreparer prepares the GetHybridConnection request. +func (client AppsClient) GetHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnectionSlot retrieves a specific Service Bus Hybrid Connection +// used by this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection slot is the name of the slot for the web app. +func (client AppsClient) GetHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetHybridConnectionSlot") + } + + req, err := client.GetHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionSlotPreparer prepares the GetHybridConnectionSlot request. +func (client AppsClient) GetHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionSlotSender sends the GetHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionSlotResponder handles the response to the GetHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceDeployment get a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. instanceID is iD of a +// specific scaled-out instance. This is the value of the name property in the +// JSON response from "GET api/sites/{siteName}/instances" +func (client AppsClient) GetInstanceDeployment(resourceGroupName string, name string, ID string, instanceID string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetInstanceDeployment") + } + + req, err := client.GetInstanceDeploymentPreparer(resourceGroupName, name, ID, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceDeploymentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceDeploymentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeployment", resp, "Failure responding to request") + } + + return +} + +// GetInstanceDeploymentPreparer prepares the GetInstanceDeployment request. +func (client AppsClient) GetInstanceDeploymentPreparer(resourceGroupName string, name string, ID string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetInstanceDeploymentSender sends the GetInstanceDeployment request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceDeploymentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetInstanceDeploymentResponder handles the response to the GetInstanceDeployment request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceDeploymentResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetInstanceDeploymentSlot get a deployment by its ID for an app, a specific +// deployment slot, and/or a specific scaled-out instance. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. ID is deployment ID. slot is name of the +// deployment slot. If a slot is not specified, the API gets a deployment for +// the production slot. instanceID is iD of a specific scaled-out instance. +// This is the value of the name property in the JSON response from "GET +// api/sites/{siteName}/instances" +func (client AppsClient) GetInstanceDeploymentSlot(resourceGroupName string, name string, ID string, slot string, instanceID string) (result Deployment, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetInstanceDeploymentSlot") + } + + req, err := client.GetInstanceDeploymentSlotPreparer(resourceGroupName, name, ID, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetInstanceDeploymentSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", resp, "Failure sending request") + return + } + + result, err = client.GetInstanceDeploymentSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetInstanceDeploymentSlot", resp, "Failure responding to request") + } + + return +} + +// GetInstanceDeploymentSlotPreparer prepares the GetInstanceDeploymentSlot request. +func (client AppsClient) GetInstanceDeploymentSlotPreparer(resourceGroupName string, name string, ID string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetInstanceDeploymentSlotSender sends the GetInstanceDeploymentSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetInstanceDeploymentSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetInstanceDeploymentSlotResponder handles the response to the GetInstanceDeploymentSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetInstanceDeploymentSlotResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMigrateMySQLStatus returns the status of MySql in app migration, if one +// is active, and whether or not MySql in app is enabled +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) GetMigrateMySQLStatus(resourceGroupName string, name string) (result MigrateMySQLStatus, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetMigrateMySQLStatus") + } + + req, err := client.GetMigrateMySQLStatusPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetMigrateMySQLStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure sending request") + return + } + + result, err = client.GetMigrateMySQLStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatus", resp, "Failure responding to request") + } + + return +} + +// GetMigrateMySQLStatusPreparer prepares the GetMigrateMySQLStatus request. +func (client AppsClient) GetMigrateMySQLStatusPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql/status", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMigrateMySQLStatusSender sends the GetMigrateMySQLStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMigrateMySQLStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMigrateMySQLStatusResponder handles the response to the GetMigrateMySQLStatus request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMigrateMySQLStatusResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMigrateMySQLStatusSlot returns the status of MySql in app migration, if +// one is active, and whether or not MySql in app is enabled +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of the deployment slot +func (client AppsClient) GetMigrateMySQLStatusSlot(resourceGroupName string, name string, slot string) (result MigrateMySQLStatus, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot") + } + + req, err := client.GetMigrateMySQLStatusSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetMigrateMySQLStatusSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure sending request") + return + } + + result, err = client.GetMigrateMySQLStatusSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetMigrateMySQLStatusSlot", resp, "Failure responding to request") + } + + return +} + +// GetMigrateMySQLStatusSlotPreparer prepares the GetMigrateMySQLStatusSlot request. +func (client AppsClient) GetMigrateMySQLStatusSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMigrateMySQLStatusSlotSender sends the GetMigrateMySQLStatusSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetMigrateMySQLStatusSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMigrateMySQLStatusSlotResponder handles the response to the GetMigrateMySQLStatusSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetMigrateMySQLStatusSlotResponder(resp *http.Response) (result MigrateMySQLStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPremierAddOn gets a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. +func (client AppsClient) GetPremierAddOn(resourceGroupName string, name string, premierAddOnName string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetPremierAddOn") + } + + req, err := client.GetPremierAddOnPreparer(resourceGroupName, name, premierAddOnName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", nil, "Failure preparing request") + return + } + + resp, err := client.GetPremierAddOnSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure sending request") + return + } + + result, err = client.GetPremierAddOnResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOn", resp, "Failure responding to request") + } + + return +} + +// GetPremierAddOnPreparer prepares the GetPremierAddOn request. +func (client AppsClient) GetPremierAddOnPreparer(resourceGroupName string, name string, premierAddOnName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPremierAddOnSender sends the GetPremierAddOn request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPremierAddOnSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPremierAddOnResponder handles the response to the GetPremierAddOn request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPremierAddOnResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPremierAddOnSlot gets a named add-on of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. premierAddOnName is add-on name. slot is +// name of the deployment slot. If a slot is not specified, the API will get +// the named add-on for the production slot. +func (client AppsClient) GetPremierAddOnSlot(resourceGroupName string, name string, premierAddOnName string, slot string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetPremierAddOnSlot") + } + + req, err := client.GetPremierAddOnSlotPreparer(resourceGroupName, name, premierAddOnName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetPremierAddOnSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure sending request") + return + } + + result, err = client.GetPremierAddOnSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetPremierAddOnSlot", resp, "Failure responding to request") + } + + return +} + +// GetPremierAddOnSlotPreparer prepares the GetPremierAddOnSlot request. +func (client AppsClient) GetPremierAddOnSlotPreparer(resourceGroupName string, name string, premierAddOnName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "premierAddOnName": autorest.Encode("path", premierAddOnName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPremierAddOnSlotSender sends the GetPremierAddOnSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetPremierAddOnSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPremierAddOnSlotResponder handles the response to the GetPremierAddOnSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetPremierAddOnSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRelayServiceConnection gets a hybrid connection configuration by its +// name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection. +func (client AppsClient) GetRelayServiceConnection(resourceGroupName string, name string, entityName string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetRelayServiceConnection") + } + + req, err := client.GetRelayServiceConnectionPreparer(resourceGroupName, name, entityName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.GetRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// GetRelayServiceConnectionPreparer prepares the GetRelayServiceConnection request. +func (client AppsClient) GetRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRelayServiceConnectionSender sends the GetRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRelayServiceConnectionResponder handles the response to the GetRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRelayServiceConnectionSlot gets a hybrid connection configuration by its +// name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection. slot is name of the deployment slot. If a slot is not specified, +// the API will get a hybrid connection for the production slot. +func (client AppsClient) GetRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetRelayServiceConnectionSlot") + } + + req, err := client.GetRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// GetRelayServiceConnectionSlotPreparer prepares the GetRelayServiceConnectionSlot request. +func (client AppsClient) GetRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRelayServiceConnectionSlotSender sends the GetRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRelayServiceConnectionSlotResponder handles the response to the GetRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceHealthMetadata gets the category of ResourceHealthMetadata to use +// for the given site +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) GetResourceHealthMetadata(resourceGroupName string, name string) (result ResourceHealthMetadata, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetResourceHealthMetadata") + } + + req, err := client.GetResourceHealthMetadataPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadata", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceHealthMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadata", resp, "Failure sending request") + return + } + + result, err = client.GetResourceHealthMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadata", resp, "Failure responding to request") + } + + return +} + +// GetResourceHealthMetadataPreparer prepares the GetResourceHealthMetadata request. +func (client AppsClient) GetResourceHealthMetadataPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetResourceHealthMetadataSender sends the GetResourceHealthMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetResourceHealthMetadataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResourceHealthMetadataResponder handles the response to the GetResourceHealthMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResourceHealthMetadataResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceHealthMetadataSlot gets the category of ResourceHealthMetadata to +// use for the given site +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) GetResourceHealthMetadataSlot(resourceGroupName string, name string, slot string) (result ResourceHealthMetadata, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetResourceHealthMetadataSlot") + } + + req, err := client.GetResourceHealthMetadataSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadataSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceHealthMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadataSlot", resp, "Failure sending request") + return + } + + result, err = client.GetResourceHealthMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetResourceHealthMetadataSlot", resp, "Failure responding to request") + } + + return +} + +// GetResourceHealthMetadataSlotPreparer prepares the GetResourceHealthMetadataSlot request. +func (client AppsClient) GetResourceHealthMetadataSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetResourceHealthMetadataSlotSender sends the GetResourceHealthMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetResourceHealthMetadataSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResourceHealthMetadataSlotResponder handles the response to the GetResourceHealthMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResourceHealthMetadataSlotResponder(resp *http.Response) (result ResourceHealthMetadata, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSitePhpErrorLogFlag gets web app's event logs. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) GetSitePhpErrorLogFlag(resourceGroupName string, name string) (result SitePhpErrorLogFlag, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSitePhpErrorLogFlag") + } + + req, err := client.GetSitePhpErrorLogFlagPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", nil, "Failure preparing request") + return + } + + resp, err := client.GetSitePhpErrorLogFlagSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure sending request") + return + } + + result, err = client.GetSitePhpErrorLogFlagResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlag", resp, "Failure responding to request") + } + + return +} + +// GetSitePhpErrorLogFlagPreparer prepares the GetSitePhpErrorLogFlag request. +func (client AppsClient) GetSitePhpErrorLogFlagPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/phplogging", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSitePhpErrorLogFlagSender sends the GetSitePhpErrorLogFlag request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSitePhpErrorLogFlagSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSitePhpErrorLogFlagResponder handles the response to the GetSitePhpErrorLogFlag request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSitePhpErrorLogFlagResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSitePhpErrorLogFlagSlot gets web app's event logs. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) GetSitePhpErrorLogFlagSlot(resourceGroupName string, name string, slot string) (result SitePhpErrorLogFlag, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot") + } + + req, err := client.GetSitePhpErrorLogFlagSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSitePhpErrorLogFlagSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSitePhpErrorLogFlagSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSitePhpErrorLogFlagSlot", resp, "Failure responding to request") + } + + return +} + +// GetSitePhpErrorLogFlagSlotPreparer prepares the GetSitePhpErrorLogFlagSlot request. +func (client AppsClient) GetSitePhpErrorLogFlagSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/phplogging", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSitePhpErrorLogFlagSlotSender sends the GetSitePhpErrorLogFlagSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSitePhpErrorLogFlagSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSitePhpErrorLogFlagSlotResponder handles the response to the GetSitePhpErrorLogFlagSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSitePhpErrorLogFlagSlotResponder(resp *http.Response) (result SitePhpErrorLogFlag, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSlot gets the details of a web, mobile, or API app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. By +// default, this API returns the production slot. +func (client AppsClient) GetSlot(resourceGroupName string, name string, slot string) (result Site, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSlot") + } + + req, err := client.GetSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSlot", resp, "Failure responding to request") + } + + return +} + +// GetSlotPreparer prepares the GetSlot request. +func (client AppsClient) GetSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSlotSender sends the GetSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSlotResponder handles the response to the GetSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSlotResponder(resp *http.Response) (result Site, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControl gets the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) GetSourceControl(resourceGroupName string, name string) (result SiteSourceControl, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSourceControl") + } + + req, err := client.GetSourceControlPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.GetSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure sending request") + return + } + + result, err = client.GetSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControl", resp, "Failure responding to request") + } + + return +} + +// GetSourceControlPreparer prepares the GetSourceControl request. +func (client AppsClient) GetSourceControlPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSourceControlSender sends the GetSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSourceControlResponder handles the response to the GetSourceControl request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSourceControlResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSourceControlSlot gets the source control configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the source control configuration for +// the production slot. +func (client AppsClient) GetSourceControlSlot(resourceGroupName string, name string, slot string) (result SiteSourceControl, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetSourceControlSlot") + } + + req, err := client.GetSourceControlSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetSourceControlSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure sending request") + return + } + + result, err = client.GetSourceControlSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetSourceControlSlot", resp, "Failure responding to request") + } + + return +} + +// GetSourceControlSlotPreparer prepares the GetSourceControlSlot request. +func (client AppsClient) GetSourceControlSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSourceControlSlotSender sends the GetSourceControlSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSourceControlSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSourceControlSlotResponder handles the response to the GetSourceControlSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetSourceControlSlotResponder(resp *http.Response) (result SiteSourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnection gets a virtual network the app (or deployment slot) is +// connected to by name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +func (client AppsClient) GetVnetConnection(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnection") + } + + req, err := client.GetVnetConnectionPreparer(resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnection", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionPreparer prepares the GetVnetConnection request. +func (client AppsClient) GetVnetConnectionPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionSender sends the GetVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionResponder handles the response to the GetVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionGateway gets an app's Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". +func (client AppsClient) GetVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionGateway") + } + + req, err := client.GetVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGateway", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionGatewayPreparer prepares the GetVnetConnectionGateway request. +func (client AppsClient) GetVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionGatewaySender sends the GetVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionGatewayResponder handles the response to the GetVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionGatewaySlot gets an app's Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". slot is name of the deployment slot. If a slot is not specified, +// the API will get a gateway for the production slot's Virtual Network. +func (client AppsClient) GetVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot") + } + + req, err := client.GetVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionGatewaySlot", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionGatewaySlotPreparer prepares the GetVnetConnectionGatewaySlot request. +func (client AppsClient) GetVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionGatewaySlotSender sends the GetVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionGatewaySlotResponder handles the response to the GetVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetConnectionSlot gets a virtual network the app (or deployment slot) is +// connected to by name. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the virtual network. +// slot is name of the deployment slot. If a slot is not specified, the API +// will get the named virtual network for the production slot. +func (client AppsClient) GetVnetConnectionSlot(resourceGroupName string, name string, vnetName string, slot string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "GetVnetConnectionSlot") + } + + req, err := client.GetVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.GetVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "GetVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// GetVnetConnectionSlotPreparer prepares the GetVnetConnectionSlot request. +func (client AppsClient) GetVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetConnectionSlotSender sends the GetVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetConnectionSlotResponder handles the response to the GetVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) GetVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsCloneable shows whether an app can be cloned to another resource group or +// subscription. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) IsCloneable(resourceGroupName string, name string) (result SiteCloneability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "IsCloneable") + } + + req, err := client.IsCloneablePreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", nil, "Failure preparing request") + return + } + + resp, err := client.IsCloneableSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure sending request") + return + } + + result, err = client.IsCloneableResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneable", resp, "Failure responding to request") + } + + return +} + +// IsCloneablePreparer prepares the IsCloneable request. +func (client AppsClient) IsCloneablePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/iscloneable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// IsCloneableSender sends the IsCloneable request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) IsCloneableSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// IsCloneableResponder handles the response to the IsCloneable request. The method always +// closes the http.Response Body. +func (client AppsClient) IsCloneableResponder(resp *http.Response) (result SiteCloneability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// IsCloneableSlot shows whether an app can be cloned to another resource group +// or subscription. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. By +// default, this API returns information on the production slot. +func (client AppsClient) IsCloneableSlot(resourceGroupName string, name string, slot string) (result SiteCloneability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "IsCloneableSlot") + } + + req, err := client.IsCloneableSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", nil, "Failure preparing request") + return + } + + resp, err := client.IsCloneableSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure sending request") + return + } + + result, err = client.IsCloneableSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "IsCloneableSlot", resp, "Failure responding to request") + } + + return +} + +// IsCloneableSlotPreparer prepares the IsCloneableSlot request. +func (client AppsClient) IsCloneableSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/iscloneable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// IsCloneableSlotSender sends the IsCloneableSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) IsCloneableSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// IsCloneableSlotResponder handles the response to the IsCloneableSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) IsCloneableSlotResponder(resp *http.Response) (result SiteCloneability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all apps for a subscription. +func (client AppsClient) List() (result AppCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AppsClient) ListNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListApplicationSettings gets the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListApplicationSettings(resourceGroupName string, name string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListApplicationSettings") + } + + req, err := client.ListApplicationSettingsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicationSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure sending request") + return + } + + result, err = client.ListApplicationSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettings", resp, "Failure responding to request") + } + + return +} + +// ListApplicationSettingsPreparer prepares the ListApplicationSettings request. +func (client AppsClient) ListApplicationSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListApplicationSettingsSender sends the ListApplicationSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListApplicationSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListApplicationSettingsResponder handles the response to the ListApplicationSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListApplicationSettingsSlot gets the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the application settings for the +// production slot. +func (client AppsClient) ListApplicationSettingsSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListApplicationSettingsSlot") + } + + req, err := client.ListApplicationSettingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListApplicationSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListApplicationSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListApplicationSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// ListApplicationSettingsSlotPreparer prepares the ListApplicationSettingsSlot request. +func (client AppsClient) ListApplicationSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListApplicationSettingsSlotSender sends the ListApplicationSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListApplicationSettingsSlotResponder handles the response to the ListApplicationSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackups gets existing backups of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListBackups(resourceGroupName string, name string) (result BackupItemCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackups") + } + + req, err := client.ListBackupsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending request") + return + } + + result, err = client.ListBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to request") + } + + return +} + +// ListBackupsPreparer prepares the ListBackups request. +func (client AppsClient) ListBackupsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupsSender sends the ListBackups request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupsResponder handles the response to the ListBackups request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupsResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListBackupsNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.BackupItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBackupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure sending next results request") + } + + result, err = client.ListBackupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackups", resp, "Failure responding to next results request") + } + + return +} + +// ListBackupsSlot gets existing backups of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get backups of the production slot. +func (client AppsClient) ListBackupsSlot(resourceGroupName string, name string, slot string) (result BackupItemCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupsSlot") + } + + req, err := client.ListBackupsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to request") + } + + return +} + +// ListBackupsSlotPreparer prepares the ListBackupsSlot request. +func (client AppsClient) ListBackupsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupsSlotSender sends the ListBackupsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupsSlotResponder handles the response to the ListBackupsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupsSlotResponder(resp *http.Response) (result BackupItemCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListBackupsSlotNextResults(lastResults BackupItemCollection) (result BackupItemCollection, err error) { + req, err := lastResults.BackupItemCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListBackupsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListBackupsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListBackupStatusSecrets gets status of a web app backup that may be in +// progress, including secrets associated with the backup, such as the Azure +// Storage SAS URL. Also can be used to update the SAS URL for the backup if a +// new URL is passed in the request body. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app backupID is id of backup request is +// information on backup request +func (client AppsClient) ListBackupStatusSecrets(resourceGroupName string, name string, backupID string, request BackupRequest) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupStatusSecrets") + } + + req, err := client.ListBackupStatusSecretsPreparer(resourceGroupName, name, backupID, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupStatusSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListBackupStatusSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecrets", resp, "Failure responding to request") + } + + return +} + +// ListBackupStatusSecretsPreparer prepares the ListBackupStatusSecrets request. +func (client AppsClient) ListBackupStatusSecretsPreparer(resourceGroupName string, name string, backupID string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/list", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupStatusSecretsSender sends the ListBackupStatusSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupStatusSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupStatusSecretsResponder handles the response to the ListBackupStatusSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupStatusSecretsResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBackupStatusSecretsSlot gets status of a web app backup that may be in +// progress, including secrets associated with the backup, such as the Azure +// Storage SAS URL. Also can be used to update the SAS URL for the backup if a +// new URL is passed in the request body. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app backupID is id of backup request is +// information on backup request slot is name of web app slot. If not specified +// then will default to production slot. +func (client AppsClient) ListBackupStatusSecretsSlot(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (result BackupItem, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListBackupStatusSecretsSlot") + } + + req, err := client.ListBackupStatusSecretsSlotPreparer(resourceGroupName, name, backupID, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListBackupStatusSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListBackupStatusSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListBackupStatusSecretsSlot", resp, "Failure responding to request") + } + + return +} + +// ListBackupStatusSecretsSlotPreparer prepares the ListBackupStatusSecretsSlot request. +func (client AppsClient) ListBackupStatusSecretsSlotPreparer(resourceGroupName string, name string, backupID string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/list", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListBackupStatusSecretsSlotSender sends the ListBackupStatusSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListBackupStatusSecretsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListBackupStatusSecretsSlotResponder handles the response to the ListBackupStatusSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListBackupStatusSecretsSlotResponder(resp *http.Response) (result BackupItem, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all web, mobile, and API apps in the specified +// resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. includeSlots is specify true to include deployment +// slots in results. The default is false, which only gives you the production +// slot of all apps. +func (client AppsClient) ListByResourceGroup(resourceGroupName string, includeSlots *bool) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName, includeSlots) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppsClient) ListByResourceGroupPreparer(resourceGroupName string, includeSlots *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includeSlots != nil { + queryParameters["includeSlots"] = autorest.Encode("query", *includeSlots) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppsClient) ListByResourceGroupResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppsClient) ListByResourceGroupNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListConfigurations list the configurations of an app +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListConfigurations(resourceGroupName string, name string) (result SiteConfigResourceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurations") + } + + req, err := client.ListConfigurationsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure sending request") + return + } + + result, err = client.ListConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure responding to request") + } + + return +} + +// ListConfigurationsPreparer prepares the ListConfigurations request. +func (client AppsClient) ListConfigurationsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConfigurationsSender sends the ListConfigurations request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConfigurationsResponder handles the response to the ListConfigurations request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationsResponder(resp *http.Response) (result SiteConfigResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConfigurationsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListConfigurationsNextResults(lastResults SiteConfigResourceCollection) (result SiteConfigResourceCollection, err error) { + req, err := lastResults.SiteConfigResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure sending next results request") + } + + result, err = client.ListConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurations", resp, "Failure responding to next results request") + } + + return +} + +// ListConfigurationSnapshotInfo gets a list of web app configuration snapshots +// identifiers. Each element of the list contains a timestamp and the ID of the +// snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListConfigurationSnapshotInfo(resourceGroupName string, name string) (result ListSiteConfigurationSnapshotInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationSnapshotInfo") + } + + req, err := client.ListConfigurationSnapshotInfoPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationSnapshotInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure sending request") + return + } + + result, err = client.ListConfigurationSnapshotInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfo", resp, "Failure responding to request") + } + + return +} + +// ListConfigurationSnapshotInfoPreparer prepares the ListConfigurationSnapshotInfo request. +func (client AppsClient) ListConfigurationSnapshotInfoPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConfigurationSnapshotInfoSender sends the ListConfigurationSnapshotInfo request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationSnapshotInfoSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConfigurationSnapshotInfoResponder handles the response to the ListConfigurationSnapshotInfo request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationSnapshotInfoResponder(resp *http.Response) (result ListSiteConfigurationSnapshotInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConfigurationSnapshotInfoSlot gets a list of web app configuration +// snapshots identifiers. Each element of the list contains a timestamp and the +// ID of the snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will return configuration for the production +// slot. +func (client AppsClient) ListConfigurationSnapshotInfoSlot(resourceGroupName string, name string, slot string) (result ListSiteConfigurationSnapshotInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot") + } + + req, err := client.ListConfigurationSnapshotInfoSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationSnapshotInfoSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure sending request") + return + } + + result, err = client.ListConfigurationSnapshotInfoSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationSnapshotInfoSlot", resp, "Failure responding to request") + } + + return +} + +// ListConfigurationSnapshotInfoSlotPreparer prepares the ListConfigurationSnapshotInfoSlot request. +func (client AppsClient) ListConfigurationSnapshotInfoSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConfigurationSnapshotInfoSlotSender sends the ListConfigurationSnapshotInfoSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationSnapshotInfoSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConfigurationSnapshotInfoSlotResponder handles the response to the ListConfigurationSnapshotInfoSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationSnapshotInfoSlotResponder(resp *http.Response) (result ListSiteConfigurationSnapshotInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConfigurationsSlot list the configurations of an app +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will return configuration for the production +// slot. +func (client AppsClient) ListConfigurationsSlot(resourceGroupName string, name string, slot string) (result SiteConfigResourceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConfigurationsSlot") + } + + req, err := client.ListConfigurationsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListConfigurationsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListConfigurationsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure responding to request") + } + + return +} + +// ListConfigurationsSlotPreparer prepares the ListConfigurationsSlot request. +func (client AppsClient) ListConfigurationsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConfigurationsSlotSender sends the ListConfigurationsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConfigurationsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConfigurationsSlotResponder handles the response to the ListConfigurationsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConfigurationsSlotResponder(resp *http.Response) (result SiteConfigResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConfigurationsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListConfigurationsSlotNextResults(lastResults SiteConfigResourceCollection) (result SiteConfigResourceCollection, err error) { + req, err := lastResults.SiteConfigResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListConfigurationsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListConfigurationsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConfigurationsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListConnectionStrings gets the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListConnectionStrings(resourceGroupName string, name string) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConnectionStrings") + } + + req, err := client.ListConnectionStringsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStrings", resp, "Failure responding to request") + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client AppsClient) ListConnectionStringsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListConnectionStringsSlot gets the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the connection settings for the +// production slot. +func (client AppsClient) ListConnectionStringsSlot(resourceGroupName string, name string, slot string) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListConnectionStringsSlot") + } + + req, err := client.ListConnectionStringsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListConnectionStringsSlot", resp, "Failure responding to request") + } + + return +} + +// ListConnectionStringsSlotPreparer prepares the ListConnectionStringsSlot request. +func (client AppsClient) ListConnectionStringsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListConnectionStringsSlotSender sends the ListConnectionStringsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListConnectionStringsSlotResponder handles the response to the ListConnectionStringsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeployments list deployments for an app, or a deployment slot, or for an +// instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListDeployments(resourceGroupName string, name string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDeployments") + } + + req, err := client.ListDeploymentsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending request") + return + } + + result, err = client.ListDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to request") + } + + return +} + +// ListDeploymentsPreparer prepares the ListDeployments request. +func (client AppsClient) ListDeploymentsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDeploymentsSender sends the ListDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDeploymentsResponder handles the response to the ListDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeploymentsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure sending next results request") + } + + result, err = client.ListDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeployments", resp, "Failure responding to next results request") + } + + return +} + +// ListDeploymentsSlot list deployments for an app, or a deployment slot, or +// for an instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API returns deployments for the production slot. +func (client AppsClient) ListDeploymentsSlot(resourceGroupName string, name string, slot string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDeploymentsSlot") + } + + req, err := client.ListDeploymentsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to request") + } + + return +} + +// ListDeploymentsSlotPreparer prepares the ListDeploymentsSlot request. +func (client AppsClient) ListDeploymentsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDeploymentsSlotSender sends the ListDeploymentsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDeploymentsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDeploymentsSlotResponder handles the response to the ListDeploymentsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDeploymentsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDeploymentsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListDomainOwnershipIdentifiers lists ownership identifiers for domain +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListDomainOwnershipIdentifiers(resourceGroupName string, name string) (result IdentifierCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers") + } + + req, err := client.ListDomainOwnershipIdentifiersPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing request") + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending request") + return + } + + result, err = client.ListDomainOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to request") + } + + return +} + +// ListDomainOwnershipIdentifiersPreparer prepares the ListDomainOwnershipIdentifiers request. +func (client AppsClient) ListDomainOwnershipIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDomainOwnershipIdentifiersSender sends the ListDomainOwnershipIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDomainOwnershipIdentifiersResponder handles the response to the ListDomainOwnershipIdentifiers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainOwnershipIdentifiersResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDomainOwnershipIdentifiersNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDomainOwnershipIdentifiersNextResults(lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.IdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure sending next results request") + } + + result, err = client.ListDomainOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiers", resp, "Failure responding to next results request") + } + + return +} + +// ListDomainOwnershipIdentifiersSlot lists ownership identifiers for domain +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will delete the binding for the production +// slot. +func (client AppsClient) ListDomainOwnershipIdentifiersSlot(resourceGroupName string, name string, slot string) (result IdentifierCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot") + } + + req, err := client.ListDomainOwnershipIdentifiersSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending request") + return + } + + result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to request") + } + + return +} + +// ListDomainOwnershipIdentifiersSlotPreparer prepares the ListDomainOwnershipIdentifiersSlot request. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDomainOwnershipIdentifiersSlotSender sends the ListDomainOwnershipIdentifiersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDomainOwnershipIdentifiersSlotResponder handles the response to the ListDomainOwnershipIdentifiersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotResponder(resp *http.Response) (result IdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListDomainOwnershipIdentifiersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListDomainOwnershipIdentifiersSlotNextResults(lastResults IdentifierCollection) (result IdentifierCollection, err error) { + req, err := lastResults.IdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListDomainOwnershipIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure sending next results request") + } + + result, err = client.ListDomainOwnershipIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListDomainOwnershipIdentifiersSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListHostNameBindings get hostname bindings for an app or a deployment slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListHostNameBindings(resourceGroupName string, name string) (result HostNameBindingCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHostNameBindings") + } + + req, err := client.ListHostNameBindingsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostNameBindingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending request") + return + } + + result, err = client.ListHostNameBindingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to request") + } + + return +} + +// ListHostNameBindingsPreparer prepares the ListHostNameBindings request. +func (client AppsClient) ListHostNameBindingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHostNameBindingsSender sends the ListHostNameBindings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostNameBindingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHostNameBindingsResponder handles the response to the ListHostNameBindings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostNameBindingsResponder(resp *http.Response) (result HostNameBindingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostNameBindingsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListHostNameBindingsNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { + req, err := lastResults.HostNameBindingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListHostNameBindingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure sending next results request") + } + + result, err = client.ListHostNameBindingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindings", resp, "Failure responding to next results request") + } + + return +} + +// ListHostNameBindingsSlot get hostname bindings for an app or a deployment +// slot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API gets hostname bindings for the production +// slot. +func (client AppsClient) ListHostNameBindingsSlot(resourceGroupName string, name string, slot string) (result HostNameBindingCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHostNameBindingsSlot") + } + + req, err := client.ListHostNameBindingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostNameBindingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListHostNameBindingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to request") + } + + return +} + +// ListHostNameBindingsSlotPreparer prepares the ListHostNameBindingsSlot request. +func (client AppsClient) ListHostNameBindingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHostNameBindingsSlotSender sends the ListHostNameBindingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHostNameBindingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHostNameBindingsSlotResponder handles the response to the ListHostNameBindingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHostNameBindingsSlotResponder(resp *http.Response) (result HostNameBindingCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHostNameBindingsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListHostNameBindingsSlotNextResults(lastResults HostNameBindingCollection) (result HostNameBindingCollection, err error) { + req, err := lastResults.HostNameBindingCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListHostNameBindingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListHostNameBindingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHostNameBindingsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListHybridConnectionKeys gets the send key name and value for a Hybrid +// Connection. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection +func (client AppsClient) ListHybridConnectionKeys(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionKeys") + } + + req, err := client.ListHybridConnectionKeysPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeys", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. +func (client AppsClient) ListHybridConnectionKeysPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionKeysSlot gets the send key name and value for a Hybrid +// Connection. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection slot is the name of the slot for the web app. +func (client AppsClient) ListHybridConnectionKeysSlot(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (result HybridConnectionKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionKeysSlot") + } + + req, err := client.ListHybridConnectionKeysSlotPreparer(resourceGroupName, name, namespaceName, relayName, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionKeysSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionKeysSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionKeysSlot", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionKeysSlotPreparer prepares the ListHybridConnectionKeysSlot request. +func (client AppsClient) ListHybridConnectionKeysSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionKeysSlotSender sends the ListHybridConnectionKeysSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionKeysSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionKeysSlotResponder handles the response to the ListHybridConnectionKeysSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionKeysSlotResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnections retrieves all Service Bus Hybrid Connections used by +// this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app +func (client AppsClient) ListHybridConnections(resourceGroupName string, name string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnections") + } + + req, err := client.ListHybridConnectionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnections", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionsPreparer prepares the ListHybridConnections request. +func (client AppsClient) ListHybridConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionsSlot retrieves all Service Bus Hybrid Connections used +// by this Web App. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app slot is the name of the slot for +// the web app. +func (client AppsClient) ListHybridConnectionsSlot(resourceGroupName string, name string, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListHybridConnectionsSlot") + } + + req, err := client.ListHybridConnectionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListHybridConnectionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionsSlotPreparer prepares the ListHybridConnectionsSlot request. +func (client AppsClient) ListHybridConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionsSlotSender sends the ListHybridConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListHybridConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionsSlotResponder handles the response to the ListHybridConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListHybridConnectionsSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceDeployments list deployments for an app, or a deployment slot, +// or for an instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. instanceID is the ID of a specific +// scaled-out instance. This is the value of the name property in the JSON +// response from "GET api/sites/{siteName}/instances" +func (client AppsClient) ListInstanceDeployments(resourceGroupName string, name string, instanceID string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceDeployments") + } + + req, err := client.ListInstanceDeploymentsPreparer(resourceGroupName, name, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure sending request") + return + } + + result, err = client.ListInstanceDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure responding to request") + } + + return +} + +// ListInstanceDeploymentsPreparer prepares the ListInstanceDeployments request. +func (client AppsClient) ListInstanceDeploymentsPreparer(resourceGroupName string, name string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceDeploymentsSender sends the ListInstanceDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceDeploymentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceDeploymentsResponder handles the response to the ListInstanceDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceDeploymentsResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceDeploymentsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceDeploymentsNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceDeploymentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceDeploymentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeployments", resp, "Failure responding to next results request") + } + + return +} + +// ListInstanceDeploymentsSlot list deployments for an app, or a deployment +// slot, or for an instance of a scaled-out app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API returns deployments for the production slot. +// instanceID is the ID of a specific scaled-out instance. This is the value of +// the name property in the JSON response from "GET +// api/sites/{siteName}/instances" +func (client AppsClient) ListInstanceDeploymentsSlot(resourceGroupName string, name string, slot string, instanceID string) (result DeploymentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceDeploymentsSlot") + } + + req, err := client.ListInstanceDeploymentsSlotPreparer(resourceGroupName, name, slot, instanceID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListInstanceDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure responding to request") + } + + return +} + +// ListInstanceDeploymentsSlotPreparer prepares the ListInstanceDeploymentsSlot request. +func (client AppsClient) ListInstanceDeploymentsSlotPreparer(resourceGroupName string, name string, slot string, instanceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instanceId": autorest.Encode("path", instanceID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceDeploymentsSlotSender sends the ListInstanceDeploymentsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceDeploymentsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceDeploymentsSlotResponder handles the response to the ListInstanceDeploymentsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceDeploymentsSlotResponder(resp *http.Response) (result DeploymentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceDeploymentsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceDeploymentsSlotNextResults(lastResults DeploymentCollection) (result DeploymentCollection, err error) { + req, err := lastResults.DeploymentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceDeploymentsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceDeploymentsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceDeploymentsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListInstanceIdentifiers gets all scale-out instances of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListInstanceIdentifiers(resourceGroupName string, name string) (result AppInstanceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceIdentifiers") + } + + req, err := client.ListInstanceIdentifiersPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending request") + return + } + + result, err = client.ListInstanceIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to request") + } + + return +} + +// ListInstanceIdentifiersPreparer prepares the ListInstanceIdentifiers request. +func (client AppsClient) ListInstanceIdentifiersPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceIdentifiersSender sends the ListInstanceIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceIdentifiersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceIdentifiersResponder handles the response to the ListInstanceIdentifiers request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceIdentifiersResponder(resp *http.Response) (result AppInstanceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceIdentifiersNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceIdentifiersNextResults(lastResults AppInstanceCollection) (result AppInstanceCollection, err error) { + req, err := lastResults.AppInstanceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiers", resp, "Failure responding to next results request") + } + + return +} + +// ListInstanceIdentifiersSlot gets all scale-out instances of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API gets the production slot instances. +func (client AppsClient) ListInstanceIdentifiersSlot(resourceGroupName string, name string, slot string) (result AppInstanceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListInstanceIdentifiersSlot") + } + + req, err := client.ListInstanceIdentifiersSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListInstanceIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending request") + return + } + + result, err = client.ListInstanceIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to request") + } + + return +} + +// ListInstanceIdentifiersSlotPreparer prepares the ListInstanceIdentifiersSlot request. +func (client AppsClient) ListInstanceIdentifiersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListInstanceIdentifiersSlotSender sends the ListInstanceIdentifiersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListInstanceIdentifiersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListInstanceIdentifiersSlotResponder handles the response to the ListInstanceIdentifiersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListInstanceIdentifiersSlotResponder(resp *http.Response) (result AppInstanceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListInstanceIdentifiersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListInstanceIdentifiersSlotNextResults(lastResults AppInstanceCollection) (result AppInstanceCollection, err error) { + req, err := lastResults.AppInstanceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListInstanceIdentifiersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure sending next results request") + } + + result, err = client.ListInstanceIdentifiersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListInstanceIdentifiersSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListMetadata gets the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListMetadata(resourceGroupName string, name string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetadata") + } + + req, err := client.ListMetadataPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure sending request") + return + } + + result, err = client.ListMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadata", resp, "Failure responding to request") + } + + return +} + +// ListMetadataPreparer prepares the ListMetadata request. +func (client AppsClient) ListMetadataPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetadataSender sends the ListMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetadataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetadataResponder handles the response to the ListMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetadataResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetadataSlot gets the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the metadata for the production +// slot. +func (client AppsClient) ListMetadataSlot(resourceGroupName string, name string, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetadataSlot") + } + + req, err := client.ListMetadataSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure sending request") + return + } + + result, err = client.ListMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetadataSlot", resp, "Failure responding to request") + } + + return +} + +// ListMetadataSlotPreparer prepares the ListMetadataSlot request. +func (client AppsClient) ListMetadataSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetadataSlotSender sends the ListMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetadataSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetadataSlotResponder handles the response to the ListMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitions gets all metric definitions of an app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListMetricDefinitions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricDefinitions") + } + + req, err := client.ListMetricDefinitionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. +func (client AppsClient) ListMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListMetricDefinitionsSlot gets all metric definitions of an app (or +// deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get metric definitions of the production +// slot. +func (client AppsClient) ListMetricDefinitionsSlot(resourceGroupName string, name string, slot string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricDefinitionsSlot") + } + + req, err := client.ListMetricDefinitionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsSlotPreparer prepares the ListMetricDefinitionsSlot request. +func (client AppsClient) ListMetricDefinitionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionsSlotSender sends the ListMetricDefinitionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricDefinitionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionsSlotResponder handles the response to the ListMetricDefinitionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricDefinitionsSlotResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitionsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricDefinitionsSlotNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricDefinitionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListMetricDefinitionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricDefinitionsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListMetrics gets performance metrics of an app (or deployment slot, if +// specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. details is specify "true" to include +// metric details in the response. It is "false" by default. filter is return +// only metrics specified in the filter (using OData syntax). For example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime +// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and +// timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client AppsClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMetricsSlot gets performance metrics of an app (or deployment slot, if +// specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get metrics of the production slot. +// details is specify "true" to include metric details in the response. It is +// "false" by default. filter is return only metrics specified in the filter +// (using OData syntax). For example: $filter=(name.value eq 'Metric1' or +// name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime +// eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListMetricsSlot(resourceGroupName string, name string, slot string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListMetricsSlot") + } + + req, err := client.ListMetricsSlotPreparer(resourceGroupName, name, slot, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure responding to request") + } + + return +} + +// ListMetricsSlotPreparer prepares the ListMetricsSlot request. +func (client AppsClient) ListMetricsSlotPreparer(resourceGroupName string, name string, slot string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSlotSender sends the ListMetricsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListMetricsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsSlotResponder handles the response to the ListMetricsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListMetricsSlotResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListMetricsSlotNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListMetricsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListNetworkFeatures gets all network features used by the app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. view is the type of view. This can either +// be "summary" or "detailed". +func (client AppsClient) ListNetworkFeatures(resourceGroupName string, name string, view string) (result NetworkFeatures, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListNetworkFeatures") + } + + req, err := client.ListNetworkFeaturesPreparer(resourceGroupName, name, view) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkFeaturesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure sending request") + return + } + + result, err = client.ListNetworkFeaturesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeatures", resp, "Failure responding to request") + } + + return +} + +// ListNetworkFeaturesPreparer prepares the ListNetworkFeatures request. +func (client AppsClient) ListNetworkFeaturesPreparer(resourceGroupName string, name string, view string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "view": autorest.Encode("path", view), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkFeatures/{view}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNetworkFeaturesSender sends the ListNetworkFeatures request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListNetworkFeaturesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNetworkFeaturesResponder handles the response to the ListNetworkFeatures request. The method always +// closes the http.Response Body. +func (client AppsClient) ListNetworkFeaturesResponder(resp *http.Response) (result NetworkFeatures, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNetworkFeaturesSlot gets all network features used by the app (or +// deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. view is the type of view. This can either +// be "summary" or "detailed". slot is name of the deployment slot. If a slot +// is not specified, the API will get network features for the production slot. +func (client AppsClient) ListNetworkFeaturesSlot(resourceGroupName string, name string, view string, slot string) (result NetworkFeatures, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListNetworkFeaturesSlot") + } + + req, err := client.ListNetworkFeaturesSlotPreparer(resourceGroupName, name, view, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListNetworkFeaturesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure sending request") + return + } + + result, err = client.ListNetworkFeaturesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListNetworkFeaturesSlot", resp, "Failure responding to request") + } + + return +} + +// ListNetworkFeaturesSlotPreparer prepares the ListNetworkFeaturesSlot request. +func (client AppsClient) ListNetworkFeaturesSlotPreparer(resourceGroupName string, name string, view string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "view": autorest.Encode("path", view), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListNetworkFeaturesSlotSender sends the ListNetworkFeaturesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListNetworkFeaturesSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListNetworkFeaturesSlotResponder handles the response to the ListNetworkFeaturesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListNetworkFeaturesSlotResponder(resp *http.Response) (result NetworkFeatures, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCounters gets perfmon counters for web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app filter is return only usages/metrics +// specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(startTime eq '2014-01-01T00:00:00Z' and endTime eq +// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListPerfMonCounters(resourceGroupName string, name string, filter string) (result PerfMonCounterCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPerfMonCounters") + } + + req, err := client.ListPerfMonCountersPreparer(resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing request") + return + } + + resp, err := client.ListPerfMonCountersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending request") + return + } + + result, err = client.ListPerfMonCountersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to request") + } + + return +} + +// ListPerfMonCountersPreparer prepares the ListPerfMonCounters request. +func (client AppsClient) ListPerfMonCountersPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/perfcounters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPerfMonCountersSender sends the ListPerfMonCounters request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPerfMonCountersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPerfMonCountersResponder handles the response to the ListPerfMonCounters request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPerfMonCountersResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCountersNextResults retrieves the next set of results, if any. +func (client AppsClient) ListPerfMonCountersNextResults(lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { + req, err := lastResults.PerfMonCounterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPerfMonCountersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure sending next results request") + } + + result, err = client.ListPerfMonCountersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCounters", resp, "Failure responding to next results request") + } + + return +} + +// ListPerfMonCountersSlot gets perfmon counters for web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. **** CURRENTLY UNUSED ***** +// filter is return only usages/metrics specified in the filter. Filter +// conforms to odata syntax. Example: $filter=(startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListPerfMonCountersSlot(resourceGroupName string, name string, slot string, filter string) (result PerfMonCounterCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPerfMonCountersSlot") + } + + req, err := client.ListPerfMonCountersSlotPreparer(resourceGroupName, name, slot, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPerfMonCountersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending request") + return + } + + result, err = client.ListPerfMonCountersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to request") + } + + return +} + +// ListPerfMonCountersSlotPreparer prepares the ListPerfMonCountersSlot request. +func (client AppsClient) ListPerfMonCountersSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/perfcounters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPerfMonCountersSlotSender sends the ListPerfMonCountersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPerfMonCountersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPerfMonCountersSlotResponder handles the response to the ListPerfMonCountersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPerfMonCountersSlotResponder(resp *http.Response) (result PerfMonCounterCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPerfMonCountersSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListPerfMonCountersSlotNextResults(lastResults PerfMonCounterCollection) (result PerfMonCounterCollection, err error) { + req, err := lastResults.PerfMonCounterCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPerfMonCountersSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure sending next results request") + } + + result, err = client.ListPerfMonCountersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPerfMonCountersSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListPremierAddOns gets the premier add-ons of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListPremierAddOns(resourceGroupName string, name string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPremierAddOns") + } + + req, err := client.ListPremierAddOnsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", nil, "Failure preparing request") + return + } + + resp, err := client.ListPremierAddOnsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure sending request") + return + } + + result, err = client.ListPremierAddOnsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOns", resp, "Failure responding to request") + } + + return +} + +// ListPremierAddOnsPreparer prepares the ListPremierAddOns request. +func (client AppsClient) ListPremierAddOnsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPremierAddOnsSender sends the ListPremierAddOns request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPremierAddOnsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPremierAddOnsResponder handles the response to the ListPremierAddOns request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPremierAddOnsResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPremierAddOnsSlot gets the premier add-ons of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the premier add-ons for the +// production slot. +func (client AppsClient) ListPremierAddOnsSlot(resourceGroupName string, name string, slot string) (result PremierAddOn, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPremierAddOnsSlot") + } + + req, err := client.ListPremierAddOnsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPremierAddOnsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListPremierAddOnsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPremierAddOnsSlot", resp, "Failure responding to request") + } + + return +} + +// ListPremierAddOnsSlotPreparer prepares the ListPremierAddOnsSlot request. +func (client AppsClient) ListPremierAddOnsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPremierAddOnsSlotSender sends the ListPremierAddOnsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPremierAddOnsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPremierAddOnsSlotResponder handles the response to the ListPremierAddOnsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPremierAddOnsSlotResponder(resp *http.Response) (result PremierAddOn, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingCredentials gets the Git/FTP publishing credentials of an app. +// This method may poll for completion. Polling can be canceled by passing the +// cancel channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListPublishingCredentials(resourceGroupName string, name string, cancel <-chan struct{}) (<-chan User, <-chan error) { + resultChan := make(chan User, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingCredentials") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result User + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ListPublishingCredentialsPreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishingCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListPublishingCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentials", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ListPublishingCredentialsPreparer prepares the ListPublishingCredentials request. +func (client AppsClient) ListPublishingCredentialsPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/publishingcredentials/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListPublishingCredentialsSender sends the ListPublishingCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListPublishingCredentialsResponder handles the response to the ListPublishingCredentials request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingCredentialsResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingCredentialsSlot gets the Git/FTP publishing credentials of an +// app. This method may poll for completion. Polling can be canceled by passing +// the cancel channel argument. The channel will be used to cancel polling and +// any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get the publishing credentials for the +// production slot. +func (client AppsClient) ListPublishingCredentialsSlot(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (<-chan User, <-chan error) { + resultChan := make(chan User, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingCredentialsSlot") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result User + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.ListPublishingCredentialsSlotPreparer(resourceGroupName, name, slot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishingCredentialsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListPublishingCredentialsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingCredentialsSlot", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// ListPublishingCredentialsSlotPreparer prepares the ListPublishingCredentialsSlot request. +func (client AppsClient) ListPublishingCredentialsSlotPreparer(resourceGroupName string, name string, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/publishingcredentials/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ListPublishingCredentialsSlotSender sends the ListPublishingCredentialsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingCredentialsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ListPublishingCredentialsSlotResponder handles the response to the ListPublishingCredentialsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingCredentialsSlotResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingProfileXMLWithSecrets gets the publishing profile for an app +// (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. publishingProfileOptions is specifies +// publishingProfileOptions for publishing profile. For example, use {"format": +// "FileZilla3"} to get a FileZilla publishing profile. +func (client AppsClient) ListPublishingProfileXMLWithSecrets(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets") + } + + req, err := client.ListPublishingProfileXMLWithSecretsPreparer(resourceGroupName, name, publishingProfileOptions) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishingProfileXMLWithSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListPublishingProfileXMLWithSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecrets", resp, "Failure responding to request") + } + + return +} + +// ListPublishingProfileXMLWithSecretsPreparer prepares the ListPublishingProfileXMLWithSecrets request. +func (client AppsClient) ListPublishingProfileXMLWithSecretsPreparer(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publishxml", pathParameters), + autorest.WithJSON(publishingProfileOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPublishingProfileXMLWithSecretsSender sends the ListPublishingProfileXMLWithSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPublishingProfileXMLWithSecretsResponder handles the response to the ListPublishingProfileXMLWithSecrets request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingProfileXMLWithSecretsResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPublishingProfileXMLWithSecretsSlot gets the publishing profile for an +// app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. publishingProfileOptions is specifies +// publishingProfileOptions for publishing profile. For example, use {"format": +// "FileZilla3"} to get a FileZilla publishing profile. slot is name of the +// deployment slot. If a slot is not specified, the API will get the publishing +// profile for the production slot. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlot(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (result ReadCloser, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot") + } + + req, err := client.ListPublishingProfileXMLWithSecretsSlotPreparer(resourceGroupName, name, publishingProfileOptions, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListPublishingProfileXMLWithSecretsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListPublishingProfileXMLWithSecretsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListPublishingProfileXMLWithSecretsSlot", resp, "Failure responding to request") + } + + return +} + +// ListPublishingProfileXMLWithSecretsSlotPreparer prepares the ListPublishingProfileXMLWithSecretsSlot request. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotPreparer(resourceGroupName string, name string, publishingProfileOptions CsmPublishingProfileOptions, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publishxml", pathParameters), + autorest.WithJSON(publishingProfileOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPublishingProfileXMLWithSecretsSlotSender sends the ListPublishingProfileXMLWithSecretsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPublishingProfileXMLWithSecretsSlotResponder handles the response to the ListPublishingProfileXMLWithSecretsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListPublishingProfileXMLWithSecretsSlotResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRelayServiceConnections gets hybrid connections configured for an app +// (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListRelayServiceConnections(resourceGroupName string, name string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListRelayServiceConnections") + } + + req, err := client.ListRelayServiceConnectionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListRelayServiceConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure sending request") + return + } + + result, err = client.ListRelayServiceConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnections", resp, "Failure responding to request") + } + + return +} + +// ListRelayServiceConnectionsPreparer prepares the ListRelayServiceConnections request. +func (client AppsClient) ListRelayServiceConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRelayServiceConnectionsSender sends the ListRelayServiceConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListRelayServiceConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRelayServiceConnectionsResponder handles the response to the ListRelayServiceConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListRelayServiceConnectionsResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRelayServiceConnectionsSlot gets hybrid connections configured for an +// app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get hybrid connections for the +// production slot. +func (client AppsClient) ListRelayServiceConnectionsSlot(resourceGroupName string, name string, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot") + } + + req, err := client.ListRelayServiceConnectionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListRelayServiceConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListRelayServiceConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListRelayServiceConnectionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListRelayServiceConnectionsSlotPreparer prepares the ListRelayServiceConnectionsSlot request. +func (client AppsClient) ListRelayServiceConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRelayServiceConnectionsSlotSender sends the ListRelayServiceConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListRelayServiceConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRelayServiceConnectionsSlotResponder handles the response to the ListRelayServiceConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListRelayServiceConnectionsSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSitePushSettings gets the Push settings associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) ListSitePushSettings(resourceGroupName string, name string) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSitePushSettings") + } + + req, err := client.ListSitePushSettingsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", nil, "Failure preparing request") + return + } + + resp, err := client.ListSitePushSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure sending request") + return + } + + result, err = client.ListSitePushSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettings", resp, "Failure responding to request") + } + + return +} + +// ListSitePushSettingsPreparer prepares the ListSitePushSettings request. +func (client AppsClient) ListSitePushSettingsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSitePushSettingsSender sends the ListSitePushSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSitePushSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSitePushSettingsResponder handles the response to the ListSitePushSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSitePushSettingsSlot gets the Push settings associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) ListSitePushSettingsSlot(resourceGroupName string, name string, slot string) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSitePushSettingsSlot") + } + + req, err := client.ListSitePushSettingsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSitePushSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListSitePushSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSitePushSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// ListSitePushSettingsSlotPreparer prepares the ListSitePushSettingsSlot request. +func (client AppsClient) ListSitePushSettingsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings/list", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSitePushSettingsSlotSender sends the ListSitePushSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSitePushSettingsSlotResponder handles the response to the ListSitePushSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotConfigurationNames gets the names of app settings and connection +// strings that stick to the slot (not swapped). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListSlotConfigurationNames(resourceGroupName string, name string) (result SlotConfigNamesResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotConfigurationNames") + } + + req, err := client.ListSlotConfigurationNamesPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotConfigurationNamesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure sending request") + return + } + + result, err = client.ListSlotConfigurationNamesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotConfigurationNames", resp, "Failure responding to request") + } + + return +} + +// ListSlotConfigurationNamesPreparer prepares the ListSlotConfigurationNames request. +func (client AppsClient) ListSlotConfigurationNamesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotConfigurationNamesSender sends the ListSlotConfigurationNames request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotConfigurationNamesResponder handles the response to the ListSlotConfigurationNames request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesFromProduction get the difference in configuration +// settings between two web app slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. +func (client AppsClient) ListSlotDifferencesFromProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (result SlotDifferenceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotDifferencesFromProduction") + } + + req, err := client.ListSlotDifferencesFromProductionPreparer(resourceGroupName, name, slotSwapEntity) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotDifferencesFromProductionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending request") + return + } + + result, err = client.ListSlotDifferencesFromProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to request") + } + + return +} + +// ListSlotDifferencesFromProductionPreparer prepares the ListSlotDifferencesFromProduction request. +func (client AppsClient) ListSlotDifferencesFromProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsdiffs", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotDifferencesFromProductionSender sends the ListSlotDifferencesFromProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotDifferencesFromProductionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotDifferencesFromProductionResponder handles the response to the ListSlotDifferencesFromProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotDifferencesFromProductionResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesFromProductionNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSlotDifferencesFromProductionNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { + req, err := lastResults.SlotDifferenceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSlotDifferencesFromProductionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure sending next results request") + } + + result, err = client.ListSlotDifferencesFromProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesFromProduction", resp, "Failure responding to next results request") + } + + return +} + +// ListSlotDifferencesSlot get the difference in configuration settings between +// two web app slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. slot is name of the source slot. +// If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) ListSlotDifferencesSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (result SlotDifferenceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlotDifferencesSlot") + } + + req, err := client.ListSlotDifferencesSlotPreparer(resourceGroupName, name, slotSwapEntity, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotDifferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending request") + return + } + + result, err = client.ListSlotDifferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to request") + } + + return +} + +// ListSlotDifferencesSlotPreparer prepares the ListSlotDifferencesSlot request. +func (client AppsClient) ListSlotDifferencesSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsdiffs", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotDifferencesSlotSender sends the ListSlotDifferencesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotDifferencesSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotDifferencesSlotResponder handles the response to the ListSlotDifferencesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotDifferencesSlotResponder(resp *http.Response) (result SlotDifferenceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotDifferencesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSlotDifferencesSlotNextResults(lastResults SlotDifferenceCollection) (result SlotDifferenceCollection, err error) { + req, err := lastResults.SlotDifferenceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSlotDifferencesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure sending next results request") + } + + result, err = client.ListSlotDifferencesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlotDifferencesSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListSlots gets an app's deployment slots. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListSlots(resourceGroupName string, name string) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSlots") + } + + req, err := client.ListSlotsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing request") + return + } + + resp, err := client.ListSlotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending request") + return + } + + result, err = client.ListSlotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to request") + } + + return +} + +// ListSlotsPreparer prepares the ListSlots request. +func (client AppsClient) ListSlotsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSlotsSender sends the ListSlots request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSlotsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSlotsResponder handles the response to the ListSlots request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSlotsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSlotsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSlotsNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSlotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure sending next results request") + } + + result, err = client.ListSlotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSlots", resp, "Failure responding to next results request") + } + + return +} + +// ListSnapshots returns all Snapshots to the user. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is website Name +func (client AppsClient) ListSnapshots(resourceGroupName string, name string) (result SnapshotCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSnapshots") + } + + req, err := client.ListSnapshotsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing request") + return + } + + resp, err := client.ListSnapshotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending request") + return + } + + result, err = client.ListSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to request") + } + + return +} + +// ListSnapshotsPreparer prepares the ListSnapshots request. +func (client AppsClient) ListSnapshotsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSnapshotsSender sends the ListSnapshots request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSnapshotsResponder handles the response to the ListSnapshots request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSnapshotsNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSnapshotsNextResults(lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.SnapshotCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSnapshotsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure sending next results request") + } + + result, err = client.ListSnapshotsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshots", resp, "Failure responding to next results request") + } + + return +} + +// ListSnapshotsSlot returns all Snapshots to the user. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is website Name slot is website Slot +func (client AppsClient) ListSnapshotsSlot(resourceGroupName string, name string, slot string) (result SnapshotCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListSnapshotsSlot") + } + + req, err := client.ListSnapshotsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListSnapshotsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListSnapshotsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to request") + } + + return +} + +// ListSnapshotsSlotPreparer prepares the ListSnapshotsSlot request. +func (client AppsClient) ListSnapshotsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSnapshotsSlotSender sends the ListSnapshotsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSnapshotsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSnapshotsSlotResponder handles the response to the ListSnapshotsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListSnapshotsSlotResponder(resp *http.Response) (result SnapshotCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSnapshotsSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListSnapshotsSlotNextResults(lastResults SnapshotCollection) (result SnapshotCollection, err error) { + req, err := lastResults.SnapshotCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSnapshotsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure sending next results request") + } + + result, err = client.ListSnapshotsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListSnapshotsSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListUsages gets the quota usage information of an app (or deployment slot, +// if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. filter is return only information +// specified in the filter (using OData syntax). For example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime +// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and +// timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListUsages") + } + + req, err := client.ListUsagesPreparer(resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppsClient) ListUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsagesNextResults retrieves the next set of results, if any. +func (client AppsClient) ListUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.CsmUsageQuotaCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure sending next results request") + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListUsagesSlot gets the quota usage information of an app (or deployment +// slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get quota information of the production +// slot. filter is return only information specified in the filter (using OData +// syntax). For example: $filter=(name.value eq 'Metric1' or name.value eq +// 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq +// '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppsClient) ListUsagesSlot(resourceGroupName string, name string, slot string, filter string) (result CsmUsageQuotaCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListUsagesSlot") + } + + req, err := client.ListUsagesSlotPreparer(resourceGroupName, name, slot, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to request") + } + + return +} + +// ListUsagesSlotPreparer prepares the ListUsagesSlot request. +func (client AppsClient) ListUsagesSlotPreparer(resourceGroupName string, name string, slot string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSlotSender sends the ListUsagesSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListUsagesSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesSlotResponder handles the response to the ListUsagesSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListUsagesSlotResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsagesSlotNextResults retrieves the next set of results, if any. +func (client AppsClient) ListUsagesSlotNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.CsmUsageQuotaCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListUsagesSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure sending next results request") + } + + result, err = client.ListUsagesSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListUsagesSlot", resp, "Failure responding to next results request") + } + + return +} + +// ListVnetConnections gets the virtual networks the app (or deployment slot) +// is connected to. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ListVnetConnections(resourceGroupName string, name string) (result ListVnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListVnetConnections") + } + + req, err := client.ListVnetConnectionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListVnetConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure sending request") + return + } + + result, err = client.ListVnetConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnections", resp, "Failure responding to request") + } + + return +} + +// ListVnetConnectionsPreparer prepares the ListVnetConnections request. +func (client AppsClient) ListVnetConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVnetConnectionsSender sends the ListVnetConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListVnetConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVnetConnectionsResponder handles the response to the ListVnetConnections request. The method always +// closes the http.Response Body. +func (client AppsClient) ListVnetConnectionsResponder(resp *http.Response) (result ListVnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVnetConnectionsSlot gets the virtual networks the app (or deployment +// slot) is connected to. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will get virtual network connections for the +// production slot. +func (client AppsClient) ListVnetConnectionsSlot(resourceGroupName string, name string, slot string) (result ListVnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ListVnetConnectionsSlot") + } + + req, err := client.ListVnetConnectionsSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ListVnetConnectionsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure sending request") + return + } + + result, err = client.ListVnetConnectionsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ListVnetConnectionsSlot", resp, "Failure responding to request") + } + + return +} + +// ListVnetConnectionsSlotPreparer prepares the ListVnetConnectionsSlot request. +func (client AppsClient) ListVnetConnectionsSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVnetConnectionsSlotSender sends the ListVnetConnectionsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListVnetConnectionsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVnetConnectionsSlotResponder handles the response to the ListVnetConnectionsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ListVnetConnectionsSlotResponder(resp *http.Response) (result ListVnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// MigrateMySQL migrates a local (in-app) MySql database to a remote MySql +// database. This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app migrationRequestEnvelope is mySql migration +// options +func (client AppsClient) MigrateMySQL(resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest, cancel <-chan struct{}) (<-chan Operation, <-chan error) { + resultChan := make(chan Operation, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "MigrateMySQL") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Operation + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.MigrateMySQLPreparer(resourceGroupName, name, migrationRequestEnvelope, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", nil, "Failure preparing request") + return + } + + resp, err := client.MigrateMySQLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", resp, "Failure sending request") + return + } + + result, err = client.MigrateMySQLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateMySQL", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// MigrateMySQLPreparer prepares the MigrateMySQL request. +func (client AppsClient) MigrateMySQLPreparer(resourceGroupName string, name string, migrationRequestEnvelope MigrateMySQLRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migratemysql", pathParameters), + autorest.WithJSON(migrationRequestEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// MigrateMySQLSender sends the MigrateMySQL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) MigrateMySQLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// MigrateMySQLResponder handles the response to the MigrateMySQL request. The method always +// closes the http.Response Body. +func (client AppsClient) MigrateMySQLResponder(resp *http.Response) (result Operation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// MigrateStorage restores a web app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// subscriptionName is azure subscription resourceGroupName is name of the +// resource group to which the resource belongs. name is name of web app +// migrationOptions is migration migrationOptions +func (client AppsClient) MigrateStorage(subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions, cancel <-chan struct{}) (<-chan StorageMigrationResponse, <-chan error) { + resultChan := make(chan StorageMigrationResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "MigrateStorage") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result StorageMigrationResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.MigrateStoragePreparer(subscriptionName, resourceGroupName, name, migrationOptions, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", nil, "Failure preparing request") + return + } + + resp, err := client.MigrateStorageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", resp, "Failure sending request") + return + } + + result, err = client.MigrateStorageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "MigrateStorage", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// MigrateStoragePreparer prepares the MigrateStorage request. +func (client AppsClient) MigrateStoragePreparer(subscriptionName string, resourceGroupName string, name string, migrationOptions StorageMigrationOptions, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "subscriptionName": autorest.Encode("query", subscriptionName), + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/migrate", pathParameters), + autorest.WithJSON(migrationOptions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// MigrateStorageSender sends the MigrateStorage request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) MigrateStorageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// MigrateStorageResponder handles the response to the MigrateStorage request. The method always +// closes the http.Response Body. +func (client AppsClient) MigrateStorageResponder(resp *http.Response) (result StorageMigrationResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Recover recovers a deleted web app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app recoveryEntity is snapshot data used for +// web app recovery. Snapshot information can be obtained by calling +// GetDeletedSites or GetSiteSnapshots API. +func (client AppsClient) Recover(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (<-chan RecoverResponse, <-chan error) { + resultChan := make(chan RecoverResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "Recover") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoverResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RecoverPreparer(resourceGroupName, name, recoveryEntity, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", resp, "Failure sending request") + return + } + + result, err = client.RecoverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Recover", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RecoverPreparer prepares the Recover request. +func (client AppsClient) RecoverPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/recover", pathParameters), + autorest.WithJSON(recoveryEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RecoverSender sends the Recover request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RecoverResponder handles the response to the Recover request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverResponder(resp *http.Response) (result RecoverResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RecoverSiteConfigurationSnapshot reverts the configuration of an app to a +// previous snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. +func (client AppsClient) RecoverSiteConfigurationSnapshot(resourceGroupName string, name string, snapshotID string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot") + } + + req, err := client.RecoverSiteConfigurationSnapshotPreparer(resourceGroupName, name, snapshotID) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverSiteConfigurationSnapshotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure sending request") + return + } + + result, err = client.RecoverSiteConfigurationSnapshotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshot", resp, "Failure responding to request") + } + + return +} + +// RecoverSiteConfigurationSnapshotPreparer prepares the RecoverSiteConfigurationSnapshot request. +func (client AppsClient) RecoverSiteConfigurationSnapshotPreparer(resourceGroupName string, name string, snapshotID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RecoverSiteConfigurationSnapshotSender sends the RecoverSiteConfigurationSnapshot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSiteConfigurationSnapshotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RecoverSiteConfigurationSnapshotResponder handles the response to the RecoverSiteConfigurationSnapshot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSiteConfigurationSnapshotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverSiteConfigurationSnapshotSlot reverts the configuration of an app to +// a previous snapshot. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. snapshotID is the ID of the snapshot to +// read. slot is name of the deployment slot. If a slot is not specified, the +// API will return configuration for the production slot. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlot(resourceGroupName string, name string, snapshotID string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot") + } + + req, err := client.RecoverSiteConfigurationSnapshotSlotPreparer(resourceGroupName, name, snapshotID, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverSiteConfigurationSnapshotSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure sending request") + return + } + + result, err = client.RecoverSiteConfigurationSnapshotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSiteConfigurationSnapshotSlot", resp, "Failure responding to request") + } + + return +} + +// RecoverSiteConfigurationSnapshotSlotPreparer prepares the RecoverSiteConfigurationSnapshotSlot request. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotPreparer(resourceGroupName string, name string, snapshotID string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "snapshotId": autorest.Encode("path", snapshotID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}/recover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RecoverSiteConfigurationSnapshotSlotSender sends the RecoverSiteConfigurationSnapshotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RecoverSiteConfigurationSnapshotSlotResponder handles the response to the RecoverSiteConfigurationSnapshotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSiteConfigurationSnapshotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RecoverSlot recovers a deleted web app. This method may poll for completion. +// Polling can be canceled by passing the cancel channel argument. The channel +// will be used to cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app recoveryEntity is snapshot data used for +// web app recovery. Snapshot information can be obtained by calling +// GetDeletedSites or GetSiteSnapshots API. slot is name of web app slot. If +// not specified then will default to production slot. +func (client AppsClient) RecoverSlot(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (<-chan RecoverResponse, <-chan error) { + resultChan := make(chan RecoverResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "RecoverSlot") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RecoverResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RecoverSlotPreparer(resourceGroupName, name, recoveryEntity, slot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RecoverSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", resp, "Failure sending request") + return + } + + result, err = client.RecoverSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RecoverSlot", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RecoverSlotPreparer prepares the RecoverSlot request. +func (client AppsClient) RecoverSlotPreparer(resourceGroupName string, name string, recoveryEntity CsmSiteRecoveryEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/recover", pathParameters), + autorest.WithJSON(recoveryEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RecoverSlotSender sends the RecoverSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RecoverSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RecoverSlotResponder handles the response to the RecoverSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RecoverSlotResponder(resp *http.Response) (result RecoverResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResetProductionSlotConfig resets the configuration settings of the current +// slot if they were previously modified by calling the API with POST. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) ResetProductionSlotConfig(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ResetProductionSlotConfig") + } + + req, err := client.ResetProductionSlotConfigPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", nil, "Failure preparing request") + return + } + + resp, err := client.ResetProductionSlotConfigSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure sending request") + return + } + + result, err = client.ResetProductionSlotConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetProductionSlotConfig", resp, "Failure responding to request") + } + + return +} + +// ResetProductionSlotConfigPreparer prepares the ResetProductionSlotConfig request. +func (client AppsClient) ResetProductionSlotConfigPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resetSlotConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetProductionSlotConfigSender sends the ResetProductionSlotConfig request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ResetProductionSlotConfigSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetProductionSlotConfigResponder handles the response to the ResetProductionSlotConfig request. The method always +// closes the http.Response Body. +func (client AppsClient) ResetProductionSlotConfigResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetSlotConfigurationSlot resets the configuration settings of the current +// slot if they were previously modified by calling the API with POST. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API resets configuration settings for the +// production slot. +func (client AppsClient) ResetSlotConfigurationSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "ResetSlotConfigurationSlot") + } + + req, err := client.ResetSlotConfigurationSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.ResetSlotConfigurationSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.ResetSlotConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "ResetSlotConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// ResetSlotConfigurationSlotPreparer prepares the ResetSlotConfigurationSlot request. +func (client AppsClient) ResetSlotConfigurationSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resetSlotConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetSlotConfigurationSlotSender sends the ResetSlotConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ResetSlotConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetSlotConfigurationSlotResponder handles the response to the ResetSlotConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) ResetSlotConfigurationSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restart restarts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. softRestart is specify true to apply the +// configuration settings and restarts the app only if necessary. By default, +// the API always restarts and reprovisions the app. synchronous is specify +// true to block until the app is restarted. By default, it is set to false, +// and the API responds immediately (asynchronous). +func (client AppsClient) Restart(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Restart") + } + + req, err := client.RestartPreparer(resourceGroupName, name, softRestart, synchronous) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restart", resp, "Failure responding to request") + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client AppsClient) RestartPreparer(resourceGroupName string, name string, softRestart *bool, synchronous *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + if synchronous != nil { + queryParameters["synchronous"] = autorest.Encode("query", *synchronous) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client AppsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestartSlot restarts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will restart the production slot. softRestart +// is specify true to apply the configuration settings and restarts the app +// only if necessary. By default, the API always restarts and reprovisions the +// app. synchronous is specify true to block until the app is restarted. By +// default, it is set to false, and the API responds immediately +// (asynchronous). +func (client AppsClient) RestartSlot(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "RestartSlot") + } + + req, err := client.RestartSlotPreparer(resourceGroupName, name, slot, softRestart, synchronous) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure sending request") + return + } + + result, err = client.RestartSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestartSlot", resp, "Failure responding to request") + } + + return +} + +// RestartSlotPreparer prepares the RestartSlot request. +func (client AppsClient) RestartSlotPreparer(resourceGroupName string, name string, slot string, softRestart *bool, synchronous *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + if synchronous != nil { + queryParameters["synchronous"] = autorest.Encode("query", *synchronous) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestartSlotSender sends the RestartSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestartSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestartSlotResponder handles the response to the RestartSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestartSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Restore restores a specific backup to another app (or deployment slot, if +// specified). This method may poll for completion. Polling can be canceled by +// passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. request is +// information on restore request +func (client AppsClient) Restore(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (<-chan RestoreResponse, <-chan error) { + resultChan := make(chan RestoreResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "Restore") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RestoreResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RestorePreparer(resourceGroupName, name, backupID, request, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", resp, "Failure sending request") + return + } + + result, err = client.RestoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Restore", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestorePreparer prepares the Restore request. +func (client AppsClient) RestorePreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestoreSender sends the Restore request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestoreResponder handles the response to the Restore request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreResponder(resp *http.Response) (result RestoreResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreSlot restores a specific backup to another app (or deployment slot, +// if specified). This method may poll for completion. Polling can be canceled +// by passing the cancel channel argument. The channel will be used to cancel +// polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. backupID is iD of the backup. request is +// information on restore request slot is name of the deployment slot. If a +// slot is not specified, the API will restore a backup of the production slot. +func (client AppsClient) RestoreSlot(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (<-chan RestoreResponse, <-chan error) { + resultChan := make(chan RestoreResponse, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "RestoreSlot") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result RestoreResponse + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.RestoreSlotPreparer(resourceGroupName, name, backupID, request, slot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", resp, "Failure sending request") + return + } + + result, err = client.RestoreSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreSlot", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// RestoreSlotPreparer prepares the RestoreSlot request. +func (client AppsClient) RestoreSlotPreparer(resourceGroupName string, name string, backupID string, request RestoreRequest, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backupId": autorest.Encode("path", backupID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}/restore", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// RestoreSlotSender sends the RestoreSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// RestoreSlotResponder handles the response to the RestoreSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreSlotResponder(resp *http.Response) (result RestoreResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) Start(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Start") + } + + req, err := client.StartPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Start", resp, "Failure responding to request") + } + + return +} + +// StartPreparer prepares the Start request. +func (client AppsClient) StartPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client AppsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartSlot starts an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will start the production slot. +func (client AppsClient) StartSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartSlot") + } + + req, err := client.StartSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StartSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure sending request") + return + } + + result, err = client.StartSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartSlot", resp, "Failure responding to request") + } + + return +} + +// StartSlotPreparer prepares the StartSlot request. +func (client AppsClient) StartSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartSlotSender sends the StartSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartSlotResponder handles the response to the StartSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartWebSiteNetworkTrace start capturing network packets for the site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. durationInSeconds is the duration +// to keep capturing in seconds. maxFrameLength is the maximum frame length in +// bytes (Optional). sasURL is the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTrace(resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartWebSiteNetworkTrace") + } + + req, err := client.StartWebSiteNetworkTracePreparer(resourceGroupName, name, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", nil, "Failure preparing request") + return + } + + resp, err := client.StartWebSiteNetworkTraceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure sending request") + return + } + + result, err = client.StartWebSiteNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTrace", resp, "Failure responding to request") + } + + return +} + +// StartWebSiteNetworkTracePreparer prepares the StartWebSiteNetworkTrace request. +func (client AppsClient) StartWebSiteNetworkTracePreparer(resourceGroupName string, name string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartWebSiteNetworkTraceSender sends the StartWebSiteNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartWebSiteNetworkTraceResponder handles the response to the StartWebSiteNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartWebSiteNetworkTraceSlot start capturing network packets for the site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. slot is the name of the slot for +// this web app. durationInSeconds is the duration to keep capturing in +// seconds. maxFrameLength is the maximum frame length in bytes (Optional). +// sasURL is the Blob URL to store capture file. +func (client AppsClient) StartWebSiteNetworkTraceSlot(resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot") + } + + req, err := client.StartWebSiteNetworkTraceSlotPreparer(resourceGroupName, name, slot, durationInSeconds, maxFrameLength, sasURL) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StartWebSiteNetworkTraceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure sending request") + return + } + + result, err = client.StartWebSiteNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StartWebSiteNetworkTraceSlot", resp, "Failure responding to request") + } + + return +} + +// StartWebSiteNetworkTraceSlotPreparer prepares the StartWebSiteNetworkTraceSlot request. +func (client AppsClient) StartWebSiteNetworkTraceSlotPreparer(resourceGroupName string, name string, slot string, durationInSeconds *int32, maxFrameLength *int32, sasURL string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if durationInSeconds != nil { + queryParameters["durationInSeconds"] = autorest.Encode("query", *durationInSeconds) + } + if maxFrameLength != nil { + queryParameters["maxFrameLength"] = autorest.Encode("query", *maxFrameLength) + } + if len(sasURL) > 0 { + queryParameters["sasUrl"] = autorest.Encode("query", sasURL) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StartWebSiteNetworkTraceSlotSender sends the StartWebSiteNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StartWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StartWebSiteNetworkTraceSlotResponder handles the response to the StartWebSiteNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StartWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) Stop(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "Stop") + } + + req, err := client.StopPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "Stop", resp, "Failure responding to request") + } + + return +} + +// StopPreparer prepares the Stop request. +func (client AppsClient) StopPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client AppsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopSlot stops an app (or deployment slot, if specified). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will stop the production slot. +func (client AppsClient) StopSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopSlot") + } + + req, err := client.StopSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StopSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure sending request") + return + } + + result, err = client.StopSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopSlot", resp, "Failure responding to request") + } + + return +} + +// StopSlotPreparer prepares the StopSlot request. +func (client AppsClient) StopSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopSlotSender sends the StopSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopSlotResponder handles the response to the StopSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopWebSiteNetworkTrace stop ongoing capturing network packets for the site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. +func (client AppsClient) StopWebSiteNetworkTrace(resourceGroupName string, name string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopWebSiteNetworkTrace") + } + + req, err := client.StopWebSiteNetworkTracePreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", nil, "Failure preparing request") + return + } + + resp, err := client.StopWebSiteNetworkTraceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure sending request") + return + } + + result, err = client.StopWebSiteNetworkTraceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTrace", resp, "Failure responding to request") + } + + return +} + +// StopWebSiteNetworkTracePreparer prepares the StopWebSiteNetworkTrace request. +func (client AppsClient) StopWebSiteNetworkTracePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkTrace/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopWebSiteNetworkTraceSender sends the StopWebSiteNetworkTrace request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopWebSiteNetworkTraceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopWebSiteNetworkTraceResponder handles the response to the StopWebSiteNetworkTrace request. The method always +// closes the http.Response Body. +func (client AppsClient) StopWebSiteNetworkTraceResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StopWebSiteNetworkTraceSlot stop ongoing capturing network packets for the +// site. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app. slot is the name of the slot for +// this web app. +func (client AppsClient) StopWebSiteNetworkTraceSlot(resourceGroupName string, name string, slot string) (result String, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot") + } + + req, err := client.StopWebSiteNetworkTraceSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", nil, "Failure preparing request") + return + } + + resp, err := client.StopWebSiteNetworkTraceSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure sending request") + return + } + + result, err = client.StopWebSiteNetworkTraceSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "StopWebSiteNetworkTraceSlot", resp, "Failure responding to request") + } + + return +} + +// StopWebSiteNetworkTraceSlotPreparer prepares the StopWebSiteNetworkTraceSlot request. +func (client AppsClient) StopWebSiteNetworkTraceSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkTrace/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// StopWebSiteNetworkTraceSlotSender sends the StopWebSiteNetworkTraceSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) StopWebSiteNetworkTraceSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// StopWebSiteNetworkTraceSlotResponder handles the response to the StopWebSiteNetworkTraceSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) StopWebSiteNetworkTraceSlotResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SwapSlotSlot swaps two deployment slots of an app. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. slot is name of the source slot. +// If a slot is not specified, the production slot is used as the source slot. +func (client AppsClient) SwapSlotSlot(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "SwapSlotSlot") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.SwapSlotSlotPreparer(resourceGroupName, name, slotSwapEntity, slot, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", nil, "Failure preparing request") + return + } + + resp, err := client.SwapSlotSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", resp, "Failure sending request") + return + } + + result, err = client.SwapSlotSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotSlot", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SwapSlotSlotPreparer prepares the SwapSlotSlot request. +func (client AppsClient) SwapSlotSlotPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, slot string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/slotsswap", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SwapSlotSlotSender sends the SwapSlotSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SwapSlotSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SwapSlotSlotResponder handles the response to the SwapSlotSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SwapSlotSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SwapSlotWithProduction swaps two deployment slots of an app. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotSwapEntity is jSON object that +// contains the target slot name. See example. +func (client AppsClient) SwapSlotWithProduction(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: slotSwapEntity, + Constraints: []validation.Constraint{{Target: "slotSwapEntity.TargetSlot", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "slotSwapEntity.PreserveVnet", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppsClient", "SwapSlotWithProduction") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.SwapSlotWithProductionPreparer(resourceGroupName, name, slotSwapEntity, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", nil, "Failure preparing request") + return + } + + resp, err := client.SwapSlotWithProductionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", resp, "Failure sending request") + return + } + + result, err = client.SwapSlotWithProductionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SwapSlotWithProduction", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// SwapSlotWithProductionPreparer prepares the SwapSlotWithProduction request. +func (client AppsClient) SwapSlotWithProductionPreparer(resourceGroupName string, name string, slotSwapEntity CsmSlotEntity, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slotsswap", pathParameters), + autorest.WithJSON(slotSwapEntity), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SwapSlotWithProductionSender sends the SwapSlotWithProduction request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SwapSlotWithProductionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SwapSlotWithProductionResponder handles the response to the SwapSlotWithProduction request. The method always +// closes the http.Response Body. +func (client AppsClient) SwapSlotWithProductionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncFunctionTriggers syncs function trigger metadata to the scale controller +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. +func (client AppsClient) SyncFunctionTriggers(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncFunctionTriggers") + } + + req, err := client.SyncFunctionTriggersPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", nil, "Failure preparing request") + return + } + + resp, err := client.SyncFunctionTriggersSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", resp, "Failure sending request") + return + } + + result, err = client.SyncFunctionTriggersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggers", resp, "Failure responding to request") + } + + return +} + +// SyncFunctionTriggersPreparer prepares the SyncFunctionTriggers request. +func (client AppsClient) SyncFunctionTriggersPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/syncfunctiontriggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncFunctionTriggersSender sends the SyncFunctionTriggers request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncFunctionTriggersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncFunctionTriggersResponder handles the response to the SyncFunctionTriggers request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncFunctionTriggersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncFunctionTriggersSlot syncs function trigger metadata to the scale +// controller +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slot is name of the deployment slot. If a +// slot is not specified, the API will restore a backup of the production slot. +func (client AppsClient) SyncFunctionTriggersSlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncFunctionTriggersSlot") + } + + req, err := client.SyncFunctionTriggersSlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", nil, "Failure preparing request") + return + } + + resp, err := client.SyncFunctionTriggersSlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", resp, "Failure sending request") + return + } + + result, err = client.SyncFunctionTriggersSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncFunctionTriggersSlot", resp, "Failure responding to request") + } + + return +} + +// SyncFunctionTriggersSlotPreparer prepares the SyncFunctionTriggersSlot request. +func (client AppsClient) SyncFunctionTriggersSlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/syncfunctiontriggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncFunctionTriggersSlotSender sends the SyncFunctionTriggersSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncFunctionTriggersSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncFunctionTriggersSlotResponder handles the response to the SyncFunctionTriggersSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncFunctionTriggersSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncRepository sync web app repository. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app +func (client AppsClient) SyncRepository(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncRepository") + } + + req, err := client.SyncRepositoryPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", nil, "Failure preparing request") + return + } + + resp, err := client.SyncRepositorySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure sending request") + return + } + + result, err = client.SyncRepositoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepository", resp, "Failure responding to request") + } + + return +} + +// SyncRepositoryPreparer prepares the SyncRepository request. +func (client AppsClient) SyncRepositoryPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncRepositorySender sends the SyncRepository request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncRepositorySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncRepositoryResponder handles the response to the SyncRepository request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncRepositoryResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SyncRepositorySlot sync web app repository. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app slot is name of web app slot. If not +// specified then will default to production slot. +func (client AppsClient) SyncRepositorySlot(resourceGroupName string, name string, slot string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "SyncRepositorySlot") + } + + req, err := client.SyncRepositorySlotPreparer(resourceGroupName, name, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", nil, "Failure preparing request") + return + } + + resp, err := client.SyncRepositorySlotSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure sending request") + return + } + + result, err = client.SyncRepositorySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "SyncRepositorySlot", resp, "Failure responding to request") + } + + return +} + +// SyncRepositorySlotPreparer prepares the SyncRepositorySlot request. +func (client AppsClient) SyncRepositorySlotPreparer(resourceGroupName string, name string, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sync", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SyncRepositorySlotSender sends the SyncRepositorySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SyncRepositorySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SyncRepositorySlotResponder handles the response to the SyncRepositorySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) SyncRepositorySlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateApplicationSettings replaces the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. appSettings is application settings of the +// app. +func (client AppsClient) UpdateApplicationSettings(resourceGroupName string, name string, appSettings StringDictionary) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateApplicationSettings") + } + + req, err := client.UpdateApplicationSettingsPreparer(resourceGroupName, name, appSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateApplicationSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateApplicationSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateApplicationSettingsPreparer prepares the UpdateApplicationSettings request. +func (client AppsClient) UpdateApplicationSettingsPreparer(resourceGroupName string, name string, appSettings StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateApplicationSettingsSender sends the UpdateApplicationSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateApplicationSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateApplicationSettingsResponder handles the response to the UpdateApplicationSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateApplicationSettingsResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateApplicationSettingsSlot replaces the application settings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. appSettings is application settings of the +// app. slot is name of the deployment slot. If a slot is not specified, the +// API will update the application settings for the production slot. +func (client AppsClient) UpdateApplicationSettingsSlot(resourceGroupName string, name string, appSettings StringDictionary, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateApplicationSettingsSlot") + } + + req, err := client.UpdateApplicationSettingsSlotPreparer(resourceGroupName, name, appSettings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateApplicationSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateApplicationSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateApplicationSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateApplicationSettingsSlotPreparer prepares the UpdateApplicationSettingsSlot request. +func (client AppsClient) UpdateApplicationSettingsSlotPreparer(resourceGroupName string, name string, appSettings StringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/appsettings", pathParameters), + autorest.WithJSON(appSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateApplicationSettingsSlotSender sends the UpdateApplicationSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateApplicationSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateApplicationSettingsSlotResponder handles the response to the UpdateApplicationSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateApplicationSettingsSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettings updates the Authentication / Authorization settings +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app siteAuthSettings is auth settings +// associated with web app +func (client AppsClient) UpdateAuthSettings(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateAuthSettings") + } + + req, err := client.UpdateAuthSettingsPreparer(resourceGroupName, name, siteAuthSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAuthSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateAuthSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateAuthSettingsPreparer prepares the UpdateAuthSettings request. +func (client AppsClient) UpdateAuthSettingsPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings", pathParameters), + autorest.WithJSON(siteAuthSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateAuthSettingsSender sends the UpdateAuthSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateAuthSettingsResponder handles the response to the UpdateAuthSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAuthSettingsSlot updates the Authentication / Authorization settings +// associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app siteAuthSettings is auth settings +// associated with web app slot is name of web app slot. If not specified then +// will default to production slot. +func (client AppsClient) UpdateAuthSettingsSlot(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (result SiteAuthSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateAuthSettingsSlot") + } + + req, err := client.UpdateAuthSettingsSlotPreparer(resourceGroupName, name, siteAuthSettings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAuthSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateAuthSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateAuthSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateAuthSettingsSlotPreparer prepares the UpdateAuthSettingsSlot request. +func (client AppsClient) UpdateAuthSettingsSlotPreparer(resourceGroupName string, name string, siteAuthSettings SiteAuthSettings, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettings", pathParameters), + autorest.WithJSON(siteAuthSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateAuthSettingsSlotSender sends the UpdateAuthSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateAuthSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateAuthSettingsSlotResponder handles the response to the UpdateAuthSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateAuthSettingsSlotResponder(resp *http.Response) (result SiteAuthSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateBackupConfiguration updates the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is edited backup configuration. +func (client AppsClient) UpdateBackupConfiguration(resourceGroupName string, name string, request BackupRequest) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateBackupConfiguration") + } + + req, err := client.UpdateBackupConfigurationPreparer(resourceGroupName, name, request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateBackupConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure sending request") + return + } + + result, err = client.UpdateBackupConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfiguration", resp, "Failure responding to request") + } + + return +} + +// UpdateBackupConfigurationPreparer prepares the UpdateBackupConfiguration request. +func (client AppsClient) UpdateBackupConfigurationPreparer(resourceGroupName string, name string, request BackupRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateBackupConfigurationSender sends the UpdateBackupConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateBackupConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateBackupConfigurationResponder handles the response to the UpdateBackupConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateBackupConfigurationResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateBackupConfigurationSlot updates the backup configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. request is edited backup configuration. +// slot is name of the deployment slot. If a slot is not specified, the API +// will update the backup configuration for the production slot. +func (client AppsClient) UpdateBackupConfigurationSlot(resourceGroupName string, name string, request BackupRequest, slot string) (result BackupRequest, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.BackupRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "request.BackupRequestProperties.BackupSchedule.FrequencyInterval", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.KeepAtLeastOneBackup", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "request.BackupRequestProperties.BackupSchedule.RetentionPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateBackupConfigurationSlot") + } + + req, err := client.UpdateBackupConfigurationSlotPreparer(resourceGroupName, name, request, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateBackupConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateBackupConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateBackupConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateBackupConfigurationSlotPreparer prepares the UpdateBackupConfigurationSlot request. +func (client AppsClient) UpdateBackupConfigurationSlotPreparer(resourceGroupName string, name string, request BackupRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/backup", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateBackupConfigurationSlotSender sends the UpdateBackupConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateBackupConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateBackupConfigurationSlotResponder handles the response to the UpdateBackupConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateBackupConfigurationSlotResponder(resp *http.Response) (result BackupRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConfiguration updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. +func (client AppsClient) UpdateConfiguration(resourceGroupName string, name string, siteConfig SiteConfigResource) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConfiguration") + } + + req, err := client.UpdateConfigurationPreparer(resourceGroupName, name, siteConfig) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure sending request") + return + } + + result, err = client.UpdateConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfiguration", resp, "Failure responding to request") + } + + return +} + +// UpdateConfigurationPreparer prepares the UpdateConfiguration request. +func (client AppsClient) UpdateConfigurationPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConfigurationSender sends the UpdateConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConfigurationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConfigurationResponder handles the response to the UpdateConfiguration request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConfigurationResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConfigurationSlot updates the configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteConfig is jSON representation of a +// SiteConfig object. See example. slot is name of the deployment slot. If a +// slot is not specified, the API will update configuration for the production +// slot. +func (client AppsClient) UpdateConfigurationSlot(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (result SiteConfigResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConfigurationSlot") + } + + req, err := client.UpdateConfigurationSlotPreparer(resourceGroupName, name, siteConfig, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConfigurationSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateConfigurationSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConfigurationSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateConfigurationSlotPreparer prepares the UpdateConfigurationSlot request. +func (client AppsClient) UpdateConfigurationSlotPreparer(resourceGroupName string, name string, siteConfig SiteConfigResource, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web", pathParameters), + autorest.WithJSON(siteConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConfigurationSlotSender sends the UpdateConfigurationSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConfigurationSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConfigurationSlotResponder handles the response to the UpdateConfigurationSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConfigurationSlotResponder(resp *http.Response) (result SiteConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConnectionStrings replaces the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. connectionStrings is connection strings of +// the app or deployment slot. See example. +func (client AppsClient) UpdateConnectionStrings(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConnectionStrings") + } + + req, err := client.UpdateConnectionStringsPreparer(resourceGroupName, name, connectionStrings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.UpdateConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStrings", resp, "Failure responding to request") + } + + return +} + +// UpdateConnectionStringsPreparer prepares the UpdateConnectionStrings request. +func (client AppsClient) UpdateConnectionStringsPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/connectionstrings", pathParameters), + autorest.WithJSON(connectionStrings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConnectionStringsSender sends the UpdateConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConnectionStringsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConnectionStringsResponder handles the response to the UpdateConnectionStrings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConnectionStringsResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateConnectionStringsSlot replaces the connection strings of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. connectionStrings is connection strings of +// the app or deployment slot. See example. slot is name of the deployment +// slot. If a slot is not specified, the API will update the connection +// settings for the production slot. +func (client AppsClient) UpdateConnectionStringsSlot(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (result ConnectionStringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateConnectionStringsSlot") + } + + req, err := client.UpdateConnectionStringsSlotPreparer(resourceGroupName, name, connectionStrings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateConnectionStringsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateConnectionStringsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateConnectionStringsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateConnectionStringsSlotPreparer prepares the UpdateConnectionStringsSlot request. +func (client AppsClient) UpdateConnectionStringsSlotPreparer(resourceGroupName string, name string, connectionStrings ConnectionStringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/connectionstrings", pathParameters), + autorest.WithJSON(connectionStrings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateConnectionStringsSlotSender sends the UpdateConnectionStringsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateConnectionStringsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateConnectionStringsSlotResponder handles the response to the UpdateConnectionStringsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateConnectionStringsSlotResponder(resp *http.Response) (result ConnectionStringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDiagnosticLogsConfig updates the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteLogsConfig is a SiteLogsConfig JSON +// object that contains the logging configuration to change in the "properties" +// property. +func (client AppsClient) UpdateDiagnosticLogsConfig(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteLogsConfig, + Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: 25, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig") + } + + req, err := client.UpdateDiagnosticLogsConfigPreparer(resourceGroupName, name, siteLogsConfig) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDiagnosticLogsConfigSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure sending request") + return + } + + result, err = client.UpdateDiagnosticLogsConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfig", resp, "Failure responding to request") + } + + return +} + +// UpdateDiagnosticLogsConfigPreparer prepares the UpdateDiagnosticLogsConfig request. +func (client AppsClient) UpdateDiagnosticLogsConfigPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs", pathParameters), + autorest.WithJSON(siteLogsConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDiagnosticLogsConfigSender sends the UpdateDiagnosticLogsConfig request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDiagnosticLogsConfigSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDiagnosticLogsConfigResponder handles the response to the UpdateDiagnosticLogsConfig request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDiagnosticLogsConfigResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDiagnosticLogsConfigSlot updates the logging configuration of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. siteLogsConfig is a SiteLogsConfig JSON +// object that contains the logging configuration to change in the "properties" +// property. slot is name of the deployment slot. If a slot is not specified, +// the API will update the logging configuration for the production slot. +func (client AppsClient) UpdateDiagnosticLogsConfigSlot(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (result SiteLogsConfig, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: siteLogsConfig, + Constraints: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.ApplicationLogs.AzureTableStorage.SasURL", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil}, + {Target: "siteLogsConfig.SiteLogsConfigProperties.HTTPLogs.FileSystem.RetentionInMb", Name: validation.InclusiveMinimum, Rule: 25, Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot") + } + + req, err := client.UpdateDiagnosticLogsConfigSlotPreparer(resourceGroupName, name, siteLogsConfig, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDiagnosticLogsConfigSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateDiagnosticLogsConfigSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDiagnosticLogsConfigSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateDiagnosticLogsConfigSlotPreparer prepares the UpdateDiagnosticLogsConfigSlot request. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotPreparer(resourceGroupName string, name string, siteLogsConfig SiteLogsConfig, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs", pathParameters), + autorest.WithJSON(siteLogsConfig), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDiagnosticLogsConfigSlotSender sends the UpdateDiagnosticLogsConfigSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDiagnosticLogsConfigSlotResponder handles the response to the UpdateDiagnosticLogsConfigSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDiagnosticLogsConfigSlotResponder(resp *http.Response) (result SiteLogsConfig, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDomainOwnershipIdentifier creates a domain ownership identifier for +// web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. +func (client AppsClient) UpdateDomainOwnershipIdentifier(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier") + } + + req, err := client.UpdateDomainOwnershipIdentifierPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDomainOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.UpdateDomainOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// UpdateDomainOwnershipIdentifierPreparer prepares the UpdateDomainOwnershipIdentifier request. +func (client AppsClient) UpdateDomainOwnershipIdentifierPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDomainOwnershipIdentifierSender sends the UpdateDomainOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDomainOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDomainOwnershipIdentifierResponder handles the response to the UpdateDomainOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDomainOwnershipIdentifierResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateDomainOwnershipIdentifierSlot creates a domain ownership identifier +// for web app, or updates an existing ownership identifier. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. domainOwnershipIdentifierName is name of +// domain ownership identifier. domainOwnershipIdentifier is a JSON +// representation of the domain ownership properties. slot is name of the +// deployment slot. If a slot is not specified, the API will delete the binding +// for the production slot. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlot(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (result Identifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot") + } + + req, err := client.UpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName, name, domainOwnershipIdentifierName, domainOwnershipIdentifier, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateDomainOwnershipIdentifierSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateDomainOwnershipIdentifierSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateDomainOwnershipIdentifierSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateDomainOwnershipIdentifierSlotPreparer prepares the UpdateDomainOwnershipIdentifierSlot request. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotPreparer(resourceGroupName string, name string, domainOwnershipIdentifierName string, domainOwnershipIdentifier Identifier, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainOwnershipIdentifierName": autorest.Encode("path", domainOwnershipIdentifierName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateDomainOwnershipIdentifierSlotSender sends the UpdateDomainOwnershipIdentifierSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateDomainOwnershipIdentifierSlotResponder handles the response to the UpdateDomainOwnershipIdentifierSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateDomainOwnershipIdentifierSlotResponder(resp *http.Response) (result Identifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHybridConnection creates a new Hybrid Connection using a Service Bus +// relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection +func (client AppsClient) UpdateHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateHybridConnection") + } + + req, err := client.UpdateHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdateHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnection", resp, "Failure responding to request") + } + + return +} + +// UpdateHybridConnectionPreparer prepares the UpdateHybridConnection request. +func (client AppsClient) UpdateHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateHybridConnectionSender sends the UpdateHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateHybridConnectionResponder handles the response to the UpdateHybridConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateHybridConnectionSlot creates a new Hybrid Connection using a Service +// Bus relay. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is the name of the web app namespaceName is the namespace for +// this hybrid connection relayName is the relay name for this hybrid +// connection connectionEnvelope is the details of the hybrid connection slot +// is the name of the slot for the web app. +func (client AppsClient) UpdateHybridConnectionSlot(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateHybridConnectionSlot") + } + + req, err := client.UpdateHybridConnectionSlotPreparer(resourceGroupName, name, namespaceName, relayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateHybridConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateHybridConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateHybridConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateHybridConnectionSlotPreparer prepares the UpdateHybridConnectionSlot request. +func (client AppsClient) UpdateHybridConnectionSlotPreparer(resourceGroupName string, name string, namespaceName string, relayName string, connectionEnvelope HybridConnection, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateHybridConnectionSlotSender sends the UpdateHybridConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateHybridConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateHybridConnectionSlotResponder handles the response to the UpdateHybridConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateHybridConnectionSlotResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMetadata replaces the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. metadata is edited metadata of the app or +// deployment slot. See example. +func (client AppsClient) UpdateMetadata(resourceGroupName string, name string, metadata StringDictionary) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateMetadata") + } + + req, err := client.UpdateMetadataPreparer(resourceGroupName, name, metadata) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure sending request") + return + } + + result, err = client.UpdateMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadata", resp, "Failure responding to request") + } + + return +} + +// UpdateMetadataPreparer prepares the UpdateMetadata request. +func (client AppsClient) UpdateMetadataPreparer(resourceGroupName string, name string, metadata StringDictionary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/metadata", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateMetadataSender sends the UpdateMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateMetadataSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateMetadataResponder handles the response to the UpdateMetadata request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateMetadataResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateMetadataSlot replaces the metadata of an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. metadata is edited metadata of the app or +// deployment slot. See example. slot is name of the deployment slot. If a slot +// is not specified, the API will update the metadata for the production slot. +func (client AppsClient) UpdateMetadataSlot(resourceGroupName string, name string, metadata StringDictionary, slot string) (result StringDictionary, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateMetadataSlot") + } + + req, err := client.UpdateMetadataSlotPreparer(resourceGroupName, name, metadata, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateMetadataSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateMetadataSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateMetadataSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateMetadataSlotPreparer prepares the UpdateMetadataSlot request. +func (client AppsClient) UpdateMetadataSlotPreparer(resourceGroupName string, name string, metadata StringDictionary, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/metadata", pathParameters), + autorest.WithJSON(metadata), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateMetadataSlotSender sends the UpdateMetadataSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateMetadataSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateMetadataSlotResponder handles the response to the UpdateMetadataSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateMetadataSlotResponder(resp *http.Response) (result StringDictionary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRelayServiceConnection creates a new hybrid connection configuration +// (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. +func (client AppsClient) UpdateRelayServiceConnection(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateRelayServiceConnection") + } + + req, err := client.UpdateRelayServiceConnectionPreparer(resourceGroupName, name, entityName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateRelayServiceConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdateRelayServiceConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnection", resp, "Failure responding to request") + } + + return +} + +// UpdateRelayServiceConnectionPreparer prepares the UpdateRelayServiceConnection request. +func (client AppsClient) UpdateRelayServiceConnectionPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateRelayServiceConnectionSender sends the UpdateRelayServiceConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateRelayServiceConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateRelayServiceConnectionResponder handles the response to the UpdateRelayServiceConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateRelayServiceConnectionResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateRelayServiceConnectionSlot creates a new hybrid connection +// configuration (PUT), or updates an existing one (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. entityName is name of the hybrid +// connection configuration. connectionEnvelope is details of the hybrid +// connection configuration. slot is name of the deployment slot. If a slot is +// not specified, the API will create or update a hybrid connection for the +// production slot. +func (client AppsClient) UpdateRelayServiceConnectionSlot(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (result RelayServiceConnectionEntity, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot") + } + + req, err := client.UpdateRelayServiceConnectionSlotPreparer(resourceGroupName, name, entityName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateRelayServiceConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateRelayServiceConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateRelayServiceConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateRelayServiceConnectionSlotPreparer prepares the UpdateRelayServiceConnectionSlot request. +func (client AppsClient) UpdateRelayServiceConnectionSlotPreparer(resourceGroupName string, name string, entityName string, connectionEnvelope RelayServiceConnectionEntity, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "entityName": autorest.Encode("path", entityName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateRelayServiceConnectionSlotSender sends the UpdateRelayServiceConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateRelayServiceConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateRelayServiceConnectionSlotResponder handles the response to the UpdateRelayServiceConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateRelayServiceConnectionSlotResponder(resp *http.Response) (result RelayServiceConnectionEntity, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSitePushSettings updates the Push settings associated with web app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app pushSettings is push settings associated +// with web app +func (client AppsClient) UpdateSitePushSettings(resourceGroupName string, name string, pushSettings PushSettings) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: pushSettings, + Constraints: []validation.Constraint{{Target: "pushSettings.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSitePushSettings") + } + + req, err := client.UpdateSitePushSettingsPreparer(resourceGroupName, name, pushSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSitePushSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure sending request") + return + } + + result, err = client.UpdateSitePushSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettings", resp, "Failure responding to request") + } + + return +} + +// UpdateSitePushSettingsPreparer prepares the UpdateSitePushSettings request. +func (client AppsClient) UpdateSitePushSettingsPreparer(resourceGroupName string, name string, pushSettings PushSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/pushsettings", pathParameters), + autorest.WithJSON(pushSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSitePushSettingsSender sends the UpdateSitePushSettings request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSitePushSettingsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSitePushSettingsResponder handles the response to the UpdateSitePushSettings request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSitePushSettingsResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSitePushSettingsSlot updates the Push settings associated with web +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of web app pushSettings is push settings associated +// with web app slot is name of web app slot. If not specified then will +// default to production slot. +func (client AppsClient) UpdateSitePushSettingsSlot(resourceGroupName string, name string, pushSettings PushSettings, slot string) (result PushSettings, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: pushSettings, + Constraints: []validation.Constraint{{Target: "pushSettings.IsPushEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSitePushSettingsSlot") + } + + req, err := client.UpdateSitePushSettingsSlotPreparer(resourceGroupName, name, pushSettings, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSitePushSettingsSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateSitePushSettingsSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSitePushSettingsSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateSitePushSettingsSlotPreparer prepares the UpdateSitePushSettingsSlot request. +func (client AppsClient) UpdateSitePushSettingsSlotPreparer(resourceGroupName string, name string, pushSettings PushSettings, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/pushsettings", pathParameters), + autorest.WithJSON(pushSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSitePushSettingsSlotSender sends the UpdateSitePushSettingsSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSitePushSettingsSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSitePushSettingsSlotResponder handles the response to the UpdateSitePushSettingsSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSitePushSettingsSlotResponder(resp *http.Response) (result PushSettings, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSlotConfigurationNames updates the names of application settings and +// connection string that remain with the slot during swap operation. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. slotConfigNames is names of application +// settings and connection strings. See example. +func (client AppsClient) UpdateSlotConfigurationNames(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (result SlotConfigNamesResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateSlotConfigurationNames") + } + + req, err := client.UpdateSlotConfigurationNamesPreparer(resourceGroupName, name, slotConfigNames) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSlotConfigurationNamesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure sending request") + return + } + + result, err = client.UpdateSlotConfigurationNamesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateSlotConfigurationNames", resp, "Failure responding to request") + } + + return +} + +// UpdateSlotConfigurationNamesPreparer prepares the UpdateSlotConfigurationNames request. +func (client AppsClient) UpdateSlotConfigurationNamesPreparer(resourceGroupName string, name string, slotConfigNames SlotConfigNamesResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames", pathParameters), + autorest.WithJSON(slotConfigNames), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSlotConfigurationNamesSender sends the UpdateSlotConfigurationNames request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSlotConfigurationNamesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSlotConfigurationNamesResponder handles the response to the UpdateSlotConfigurationNames request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateSlotConfigurationNamesResponder(resp *http.Response) (result SlotConfigNamesResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnection adds a Virtual Network connection to an app or slot +// (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. +func (client AppsClient) UpdateVnetConnection(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnection") + } + + req, err := client.UpdateVnetConnectionPreparer(resourceGroupName, name, vnetName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnection", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionPreparer prepares the UpdateVnetConnection request. +func (client AppsClient) UpdateVnetConnectionPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionSender sends the UpdateVnetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionResponder handles the response to the UpdateVnetConnection request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionGateway adds a gateway to a connected Virtual Network +// (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +func (client AppsClient) UpdateVnetConnectionGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionGateway") + } + + req, err := client.UpdateVnetConnectionGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGateway", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionGatewayPreparer prepares the UpdateVnetConnectionGateway request. +func (client AppsClient) UpdateVnetConnectionGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionGatewaySender sends the UpdateVnetConnectionGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionGatewayResponder handles the response to the UpdateVnetConnectionGateway request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionGatewaySlot adds a gateway to a connected Virtual +// Network (PUT) or updates it (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of the Virtual Network. +// gatewayName is name of the gateway. Currently, the only supported string is +// "primary". connectionEnvelope is the properties to update this gateway with. +// slot is name of the deployment slot. If a slot is not specified, the API +// will add or update a gateway for the production slot's Virtual Network. +func (client AppsClient) UpdateVnetConnectionGatewaySlot(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot") + } + + req, err := client.UpdateVnetConnectionGatewaySlotPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionGatewaySlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionGatewaySlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionGatewaySlot", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionGatewaySlotPreparer prepares the UpdateVnetConnectionGatewaySlot request. +func (client AppsClient) UpdateVnetConnectionGatewaySlotPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionGatewaySlotSender sends the UpdateVnetConnectionGatewaySlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionGatewaySlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionGatewaySlotResponder handles the response to the UpdateVnetConnectionGatewaySlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionGatewaySlotResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetConnectionSlot adds a Virtual Network connection to an app or slot +// (PUT) or updates the connection properties (PATCH). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the app. vnetName is name of an existing Virtual +// Network. connectionEnvelope is properties of the Virtual Network connection. +// See example. slot is name of the deployment slot. If a slot is not +// specified, the API will add or update connections for the production slot. +func (client AppsClient) UpdateVnetConnectionSlot(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppsClient", "UpdateVnetConnectionSlot") + } + + req, err := client.UpdateVnetConnectionSlotPreparer(resourceGroupName, name, vnetName, connectionEnvelope, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetConnectionSlotSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetConnectionSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "UpdateVnetConnectionSlot", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetConnectionSlotPreparer prepares the UpdateVnetConnectionSlot request. +func (client AppsClient) UpdateVnetConnectionSlotPreparer(resourceGroupName string, name string, vnetName string, connectionEnvelope VnetInfo, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetConnectionSlotSender sends the UpdateVnetConnectionSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateVnetConnectionSlotSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetConnectionSlotResponder handles the response to the UpdateVnetConnectionSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateVnetConnectionSlotResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appservicecertificateorders.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appservicecertificateorders.go index d66d7bc410..c6a681b095 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appservicecertificateorders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appservicecertificateorders.go @@ -1,1499 +1,1499 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AppServiceCertificateOrdersClient is the composite Swagger for WebSite -// Management Client -type AppServiceCertificateOrdersClient struct { - ManagementClient -} - -// NewAppServiceCertificateOrdersClient creates an instance of the -// AppServiceCertificateOrdersClient client. -func NewAppServiceCertificateOrdersClient(subscriptionID string) AppServiceCertificateOrdersClient { - return NewAppServiceCertificateOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppServiceCertificateOrdersClientWithBaseURI creates an instance of the -// AppServiceCertificateOrdersClient client. -func NewAppServiceCertificateOrdersClientWithBaseURI(baseURI string, subscriptionID string) AppServiceCertificateOrdersClient { - return AppServiceCertificateOrdersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a certificate purchase order. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -// certificateDistinguishedName is distinguished name to to use for the -// certificate order. -func (client AppServiceCertificateOrdersClient) CreateOrUpdate(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (<-chan AppServiceCertificateOrder, <-chan error) { - resultChan := make(chan AppServiceCertificateOrder, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: certificateDistinguishedName, - Constraints: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMaximum, Rule: 3, Chain: nil}, - {Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result AppServiceCertificateOrder - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, certificateOrderName, certificateDistinguishedName, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppServiceCertificateOrdersClient) CreateOrUpdatePreparer(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), - autorest.WithJSON(certificateDistinguishedName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) CreateOrUpdateResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateCertificate creates or updates a certificate and associates -// with key vault secret. This method may poll for completion. Polling can be -// canceled by passing the cancel channel argument. The channel will be used to -// cancel polling and any outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. name is name -// of the certificate. keyVaultCertificate is key vault certificate resource -// Id. -func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificate(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (<-chan AppServiceCertificateResource, <-chan error) { - resultChan := make(chan AppServiceCertificateResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result AppServiceCertificateResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateCertificatePreparer(resourceGroupName, certificateOrderName, name, keyVaultCertificate, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request. -func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificatePreparer(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithJSON(keyVaultCertificate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an existing certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -func (client AppServiceCertificateOrdersClient) Delete(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, certificateOrderName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AppServiceCertificateOrdersClient) DeletePreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteCertificate delete the certificate associated with a certificate -// order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. name is name -// of the certificate. -func (client AppServiceCertificateOrdersClient) DeleteCertificate(resourceGroupName string, certificateOrderName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate") - } - - req, err := client.DeleteCertificatePreparer(resourceGroupName, certificateOrderName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteCertificateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure sending request") - return - } - - result, err = client.DeleteCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificatePreparer prepares the DeleteCertificate request. -func (client AppServiceCertificateOrdersClient) DeleteCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateSender sends the DeleteCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order.. -func (client AppServiceCertificateOrdersClient) Get(resourceGroupName string, certificateOrderName string) (result AppServiceCertificateOrder, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, certificateOrderName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AppServiceCertificateOrdersClient) GetPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) GetResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificate get the certificate associated with a certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. name is name -// of the certificate. -func (client AppServiceCertificateOrdersClient) GetCertificate(resourceGroupName string, certificateOrderName string, name string) (result AppServiceCertificateResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate") - } - - req, err := client.GetCertificatePreparer(resourceGroupName, certificateOrderName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure responding to request") - } - - return -} - -// GetCertificatePreparer prepares the GetCertificate request. -func (client AppServiceCertificateOrdersClient) GetCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateSender sends the GetCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) GetCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateResponder handles the response to the GetCertificate request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) GetCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all certificate orders in a subscription. -func (client AppServiceCertificateOrdersClient) List() (result AppServiceCertificateOrderCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AppServiceCertificateOrdersClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ListResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AppServiceCertificateOrdersClient) ListNextResults(lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { - req, err := lastResults.AppServiceCertificateOrderCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup get certificate orders in a resource group. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. -func (client AppServiceCertificateOrdersClient) ListByResourceGroup(resourceGroupName string) (result AppServiceCertificateOrderCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AppServiceCertificateOrdersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AppServiceCertificateOrdersClient) ListByResourceGroupNextResults(lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { - req, err := lastResults.AppServiceCertificateOrderCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListCertificates list all certificates associated with a certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -func (client AppServiceCertificateOrdersClient) ListCertificates(resourceGroupName string, certificateOrderName string) (result AppServiceCertificateCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates") - } - - req, err := client.ListCertificatesPreparer(resourceGroupName, certificateOrderName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing request") - return - } - - resp, err := client.ListCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending request") - return - } - - result, err = client.ListCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to request") - } - - return -} - -// ListCertificatesPreparer prepares the ListCertificates request. -func (client AppServiceCertificateOrdersClient) ListCertificatesPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListCertificatesSender sends the ListCertificates request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ListCertificatesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListCertificatesResponder handles the response to the ListCertificates request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ListCertificatesResponder(resp *http.Response) (result AppServiceCertificateCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCertificatesNextResults retrieves the next set of results, if any. -func (client AppServiceCertificateOrdersClient) ListCertificatesNextResults(lastResults AppServiceCertificateCollection) (result AppServiceCertificateCollection, err error) { - req, err := lastResults.AppServiceCertificateCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending next results request") - } - - result, err = client.ListCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to next results request") - } - - return -} - -// Reissue reissue an existing certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -// reissueCertificateOrderRequest is parameters for the reissue. -func (client AppServiceCertificateOrdersClient) Reissue(resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Reissue") - } - - req, err := client.ReissuePreparer(resourceGroupName, certificateOrderName, reissueCertificateOrderRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", nil, "Failure preparing request") - return - } - - resp, err := client.ReissueSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure sending request") - return - } - - result, err = client.ReissueResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure responding to request") - } - - return -} - -// ReissuePreparer prepares the Reissue request. -func (client AppServiceCertificateOrdersClient) ReissuePreparer(resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue", pathParameters), - autorest.WithJSON(reissueCertificateOrderRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ReissueSender sends the Reissue request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ReissueSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ReissueResponder handles the response to the Reissue request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ReissueResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Renew renew an existing certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -// renewCertificateOrderRequest is renew parameters -func (client AppServiceCertificateOrdersClient) Renew(resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Renew") - } - - req, err := client.RenewPreparer(resourceGroupName, certificateOrderName, renewCertificateOrderRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", nil, "Failure preparing request") - return - } - - resp, err := client.RenewSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure sending request") - return - } - - result, err = client.RenewResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure responding to request") - } - - return -} - -// RenewPreparer prepares the Renew request. -func (client AppServiceCertificateOrdersClient) RenewPreparer(resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew", pathParameters), - autorest.WithJSON(renewCertificateOrderRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RenewSender sends the Renew request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) RenewSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RenewResponder handles the response to the Renew request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) RenewResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResendEmail resend certificate email. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -func (client AppServiceCertificateOrdersClient) ResendEmail(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail") - } - - req, err := client.ResendEmailPreparer(resourceGroupName, certificateOrderName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", nil, "Failure preparing request") - return - } - - resp, err := client.ResendEmailSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure sending request") - return - } - - result, err = client.ResendEmailResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure responding to request") - } - - return -} - -// ResendEmailPreparer prepares the ResendEmail request. -func (client AppServiceCertificateOrdersClient) ResendEmailPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResendEmailSender sends the ResendEmail request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ResendEmailSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResendEmailResponder handles the response to the ResendEmail request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ResendEmailResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResendRequestEmails verify domain ownership for this certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -// nameIdentifier is email address -func (client AppServiceCertificateOrdersClient) ResendRequestEmails(resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails") - } - - req, err := client.ResendRequestEmailsPreparer(resourceGroupName, certificateOrderName, nameIdentifier) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", nil, "Failure preparing request") - return - } - - resp, err := client.ResendRequestEmailsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure sending request") - return - } - - result, err = client.ResendRequestEmailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure responding to request") - } - - return -} - -// ResendRequestEmailsPreparer prepares the ResendRequestEmails request. -func (client AppServiceCertificateOrdersClient) ResendRequestEmailsPreparer(resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails", pathParameters), - autorest.WithJSON(nameIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResendRequestEmailsSender sends the ResendRequestEmails request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ResendRequestEmailsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResendRequestEmailsResponder handles the response to the ResendRequestEmails request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ResendRequestEmailsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RetrieveCertificateActions retrieve the list of certificate actions. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the certificate order. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateActions(resourceGroupName string, name string) (result ListCertificateOrderAction, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions") - } - - req, err := client.RetrieveCertificateActionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", nil, "Failure preparing request") - return - } - - resp, err := client.RetrieveCertificateActionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure sending request") - return - } - - result, err = client.RetrieveCertificateActionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure responding to request") - } - - return -} - -// RetrieveCertificateActionsPreparer prepares the RetrieveCertificateActions request. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RetrieveCertificateActionsSender sends the RetrieveCertificateActions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RetrieveCertificateActionsResponder handles the response to the RetrieveCertificateActions request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsResponder(resp *http.Response) (result ListCertificateOrderAction, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RetrieveCertificateEmailHistory retrieve email history. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the certificate order. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistory(resourceGroupName string, name string) (result ListCertificateEmail, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory") - } - - req, err := client.RetrieveCertificateEmailHistoryPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", nil, "Failure preparing request") - return - } - - resp, err := client.RetrieveCertificateEmailHistorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure sending request") - return - } - - result, err = client.RetrieveCertificateEmailHistoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure responding to request") - } - - return -} - -// RetrieveCertificateEmailHistoryPreparer prepares the RetrieveCertificateEmailHistory request. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RetrieveCertificateEmailHistorySender sends the RetrieveCertificateEmailHistory request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistorySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RetrieveCertificateEmailHistoryResponder handles the response to the RetrieveCertificateEmailHistory request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryResponder(resp *http.Response) (result ListCertificateEmail, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RetrieveSiteSeal verify domain ownership for this certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -// siteSealRequest is site seal request. -func (client AppServiceCertificateOrdersClient) RetrieveSiteSeal(resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (result SiteSeal, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal") - } - - req, err := client.RetrieveSiteSealPreparer(resourceGroupName, certificateOrderName, siteSealRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", nil, "Failure preparing request") - return - } - - resp, err := client.RetrieveSiteSealSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure sending request") - return - } - - result, err = client.RetrieveSiteSealResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure responding to request") - } - - return -} - -// RetrieveSiteSealPreparer prepares the RetrieveSiteSeal request. -func (client AppServiceCertificateOrdersClient) RetrieveSiteSealPreparer(resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal", pathParameters), - autorest.WithJSON(siteSealRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RetrieveSiteSealSender sends the RetrieveSiteSeal request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) RetrieveSiteSealSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RetrieveSiteSealResponder handles the response to the RetrieveSiteSeal request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) RetrieveSiteSealResponder(resp *http.Response) (result SiteSeal, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidatePurchaseInformation validate information for a certificate order. -// -// appServiceCertificateOrder is information for a certificate order. -func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformation(appServiceCertificateOrder AppServiceCertificateOrder) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: appServiceCertificateOrder, - Constraints: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMaximum, Rule: 3, Chain: nil}, - {Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation") - } - - req, err := client.ValidatePurchaseInformationPreparer(appServiceCertificateOrder) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", nil, "Failure preparing request") - return - } - - resp, err := client.ValidatePurchaseInformationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure sending request") - return - } - - result, err = client.ValidatePurchaseInformationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure responding to request") - } - - return -} - -// ValidatePurchaseInformationPreparer prepares the ValidatePurchaseInformation request. -func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationPreparer(appServiceCertificateOrder AppServiceCertificateOrder) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation", pathParameters), - autorest.WithJSON(appServiceCertificateOrder), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidatePurchaseInformationSender sends the ValidatePurchaseInformation request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidatePurchaseInformationResponder handles the response to the ValidatePurchaseInformation request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// VerifyDomainOwnership verify domain ownership for this certificate order. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. certificateOrderName is name of the certificate order. -func (client AppServiceCertificateOrdersClient) VerifyDomainOwnership(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership") - } - - req, err := client.VerifyDomainOwnershipPreparer(resourceGroupName, certificateOrderName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", nil, "Failure preparing request") - return - } - - resp, err := client.VerifyDomainOwnershipSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure sending request") - return - } - - result, err = client.VerifyDomainOwnershipResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure responding to request") - } - - return -} - -// VerifyDomainOwnershipPreparer prepares the VerifyDomainOwnership request. -func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "certificateOrderName": autorest.Encode("path", certificateOrderName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// VerifyDomainOwnershipSender sends the VerifyDomainOwnership request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// VerifyDomainOwnershipResponder handles the response to the VerifyDomainOwnership request. The method always -// closes the http.Response Body. -func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppServiceCertificateOrdersClient is the composite Swagger for WebSite +// Management Client +type AppServiceCertificateOrdersClient struct { + ManagementClient +} + +// NewAppServiceCertificateOrdersClient creates an instance of the +// AppServiceCertificateOrdersClient client. +func NewAppServiceCertificateOrdersClient(subscriptionID string) AppServiceCertificateOrdersClient { + return NewAppServiceCertificateOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServiceCertificateOrdersClientWithBaseURI creates an instance of the +// AppServiceCertificateOrdersClient client. +func NewAppServiceCertificateOrdersClientWithBaseURI(baseURI string, subscriptionID string) AppServiceCertificateOrdersClient { + return AppServiceCertificateOrdersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a certificate purchase order. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// certificateDistinguishedName is distinguished name to to use for the +// certificate order. +func (client AppServiceCertificateOrdersClient) CreateOrUpdate(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (<-chan AppServiceCertificateOrder, <-chan error) { + resultChan := make(chan AppServiceCertificateOrder, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: certificateDistinguishedName, + Constraints: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMaximum, Rule: 3, Chain: nil}, + {Target: "certificateDistinguishedName.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AppServiceCertificateOrder + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, certificateOrderName, certificateDistinguishedName, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServiceCertificateOrdersClient) CreateOrUpdatePreparer(resourceGroupName string, certificateOrderName string, certificateDistinguishedName AppServiceCertificateOrder, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithJSON(certificateDistinguishedName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateCertificate creates or updates a certificate and associates +// with key vault secret. This method may poll for completion. Polling can be +// canceled by passing the cancel channel argument. The channel will be used to +// cancel polling and any outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. name is name +// of the certificate. keyVaultCertificate is key vault certificate resource +// Id. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificate(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (<-chan AppServiceCertificateResource, <-chan error) { + resultChan := make(chan AppServiceCertificateResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AppServiceCertificateResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateCertificatePreparer(resourceGroupName, certificateOrderName, name, keyVaultCertificate, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "CreateOrUpdateCertificate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateCertificatePreparer prepares the CreateOrUpdateCertificate request. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificatePreparer(resourceGroupName string, certificateOrderName string, name string, keyVaultCertificate AppServiceCertificateResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithJSON(keyVaultCertificate), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateCertificateSender sends the CreateOrUpdateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateCertificateResponder handles the response to the CreateOrUpdateCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) CreateOrUpdateCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an existing certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) Delete(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServiceCertificateOrdersClient) DeletePreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteCertificate delete the certificate associated with a certificate +// order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. name is name +// of the certificate. +func (client AppServiceCertificateOrdersClient) DeleteCertificate(resourceGroupName string, certificateOrderName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate") + } + + req, err := client.DeleteCertificatePreparer(resourceGroupName, certificateOrderName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "DeleteCertificate", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificatePreparer prepares the DeleteCertificate request. +func (client AppServiceCertificateOrdersClient) DeleteCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteCertificateSender sends the DeleteCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) DeleteCertificateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order.. +func (client AppServiceCertificateOrdersClient) Get(resourceGroupName string, certificateOrderName string) (result AppServiceCertificateOrder, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServiceCertificateOrdersClient) GetPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) GetResponder(resp *http.Response) (result AppServiceCertificateOrder, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificate get the certificate associated with a certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. name is name +// of the certificate. +func (client AppServiceCertificateOrdersClient) GetCertificate(resourceGroupName string, certificateOrderName string, name string) (result AppServiceCertificateResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate") + } + + req, err := client.GetCertificatePreparer(resourceGroupName, certificateOrderName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "GetCertificate", resp, "Failure responding to request") + } + + return +} + +// GetCertificatePreparer prepares the GetCertificate request. +func (client AppServiceCertificateOrdersClient) GetCertificatePreparer(resourceGroupName string, certificateOrderName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateSender sends the GetCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) GetCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateResponder handles the response to the GetCertificate request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) GetCertificateResponder(resp *http.Response) (result AppServiceCertificateResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all certificate orders in a subscription. +func (client AppServiceCertificateOrdersClient) List() (result AppServiceCertificateOrderCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServiceCertificateOrdersClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) ListNextResults(lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { + req, err := lastResults.AppServiceCertificateOrderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get certificate orders in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client AppServiceCertificateOrdersClient) ListByResourceGroup(resourceGroupName string) (result AppServiceCertificateOrderCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceCertificateOrderCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) ListByResourceGroupNextResults(lastResults AppServiceCertificateOrderCollection) (result AppServiceCertificateOrderCollection, err error) { + req, err := lastResults.AppServiceCertificateOrderCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCertificates list all certificates associated with a certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) ListCertificates(resourceGroupName string, certificateOrderName string) (result AppServiceCertificateCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates") + } + + req, err := client.ListCertificatesPreparer(resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing request") + return + } + + resp, err := client.ListCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending request") + return + } + + result, err = client.ListCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to request") + } + + return +} + +// ListCertificatesPreparer prepares the ListCertificates request. +func (client AppServiceCertificateOrdersClient) ListCertificatesPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCertificatesSender sends the ListCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ListCertificatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCertificatesResponder handles the response to the ListCertificates request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ListCertificatesResponder(resp *http.Response) (result AppServiceCertificateCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCertificatesNextResults retrieves the next set of results, if any. +func (client AppServiceCertificateOrdersClient) ListCertificatesNextResults(lastResults AppServiceCertificateCollection) (result AppServiceCertificateCollection, err error) { + req, err := lastResults.AppServiceCertificateCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure sending next results request") + } + + result, err = client.ListCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ListCertificates", resp, "Failure responding to next results request") + } + + return +} + +// Reissue reissue an existing certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// reissueCertificateOrderRequest is parameters for the reissue. +func (client AppServiceCertificateOrdersClient) Reissue(resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Reissue") + } + + req, err := client.ReissuePreparer(resourceGroupName, certificateOrderName, reissueCertificateOrderRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", nil, "Failure preparing request") + return + } + + resp, err := client.ReissueSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure sending request") + return + } + + result, err = client.ReissueResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Reissue", resp, "Failure responding to request") + } + + return +} + +// ReissuePreparer prepares the Reissue request. +func (client AppServiceCertificateOrdersClient) ReissuePreparer(resourceGroupName string, certificateOrderName string, reissueCertificateOrderRequest ReissueCertificateOrderRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/reissue", pathParameters), + autorest.WithJSON(reissueCertificateOrderRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ReissueSender sends the Reissue request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ReissueSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ReissueResponder handles the response to the Reissue request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ReissueResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Renew renew an existing certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// renewCertificateOrderRequest is renew parameters +func (client AppServiceCertificateOrdersClient) Renew(resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "Renew") + } + + req, err := client.RenewPreparer(resourceGroupName, certificateOrderName, renewCertificateOrderRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", nil, "Failure preparing request") + return + } + + resp, err := client.RenewSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure sending request") + return + } + + result, err = client.RenewResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "Renew", resp, "Failure responding to request") + } + + return +} + +// RenewPreparer prepares the Renew request. +func (client AppServiceCertificateOrdersClient) RenewPreparer(resourceGroupName string, certificateOrderName string, renewCertificateOrderRequest RenewCertificateOrderRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/renew", pathParameters), + autorest.WithJSON(renewCertificateOrderRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RenewSender sends the Renew request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RenewSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RenewResponder handles the response to the Renew request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RenewResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResendEmail resend certificate email. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) ResendEmail(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail") + } + + req, err := client.ResendEmailPreparer(resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", nil, "Failure preparing request") + return + } + + resp, err := client.ResendEmailSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure sending request") + return + } + + result, err = client.ResendEmailResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendEmail", resp, "Failure responding to request") + } + + return +} + +// ResendEmailPreparer prepares the ResendEmail request. +func (client AppServiceCertificateOrdersClient) ResendEmailPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendEmail", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResendEmailSender sends the ResendEmail request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ResendEmailSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResendEmailResponder handles the response to the ResendEmail request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ResendEmailResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResendRequestEmails verify domain ownership for this certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// nameIdentifier is email address +func (client AppServiceCertificateOrdersClient) ResendRequestEmails(resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails") + } + + req, err := client.ResendRequestEmailsPreparer(resourceGroupName, certificateOrderName, nameIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", nil, "Failure preparing request") + return + } + + resp, err := client.ResendRequestEmailsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure sending request") + return + } + + result, err = client.ResendRequestEmailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ResendRequestEmails", resp, "Failure responding to request") + } + + return +} + +// ResendRequestEmailsPreparer prepares the ResendRequestEmails request. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsPreparer(resourceGroupName string, certificateOrderName string, nameIdentifier NameIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/resendRequestEmails", pathParameters), + autorest.WithJSON(nameIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResendRequestEmailsSender sends the ResendRequestEmails request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResendRequestEmailsResponder handles the response to the ResendRequestEmails request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ResendRequestEmailsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RetrieveCertificateActions retrieve the list of certificate actions. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate order. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActions(resourceGroupName string, name string) (result ListCertificateOrderAction, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions") + } + + req, err := client.RetrieveCertificateActionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveCertificateActionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure sending request") + return + } + + result, err = client.RetrieveCertificateActionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateActions", resp, "Failure responding to request") + } + + return +} + +// RetrieveCertificateActionsPreparer prepares the RetrieveCertificateActions request. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveCertificateActions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RetrieveCertificateActionsSender sends the RetrieveCertificateActions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveCertificateActionsResponder handles the response to the RetrieveCertificateActions request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateActionsResponder(resp *http.Response) (result ListCertificateOrderAction, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RetrieveCertificateEmailHistory retrieve email history. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate order. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistory(resourceGroupName string, name string) (result ListCertificateEmail, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory") + } + + req, err := client.RetrieveCertificateEmailHistoryPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveCertificateEmailHistorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure sending request") + return + } + + result, err = client.RetrieveCertificateEmailHistoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveCertificateEmailHistory", resp, "Failure responding to request") + } + + return +} + +// RetrieveCertificateEmailHistoryPreparer prepares the RetrieveCertificateEmailHistory request. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{name}/retrieveEmailHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RetrieveCertificateEmailHistorySender sends the RetrieveCertificateEmailHistory request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistorySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveCertificateEmailHistoryResponder handles the response to the RetrieveCertificateEmailHistory request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveCertificateEmailHistoryResponder(resp *http.Response) (result ListCertificateEmail, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RetrieveSiteSeal verify domain ownership for this certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +// siteSealRequest is site seal request. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSeal(resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (result SiteSeal, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal") + } + + req, err := client.RetrieveSiteSealPreparer(resourceGroupName, certificateOrderName, siteSealRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveSiteSealSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure sending request") + return + } + + result, err = client.RetrieveSiteSealResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "RetrieveSiteSeal", resp, "Failure responding to request") + } + + return +} + +// RetrieveSiteSealPreparer prepares the RetrieveSiteSeal request. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealPreparer(resourceGroupName string, certificateOrderName string, siteSealRequest SiteSealRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/retrieveSiteSeal", pathParameters), + autorest.WithJSON(siteSealRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RetrieveSiteSealSender sends the RetrieveSiteSeal request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RetrieveSiteSealResponder handles the response to the RetrieveSiteSeal request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) RetrieveSiteSealResponder(resp *http.Response) (result SiteSeal, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidatePurchaseInformation validate information for a certificate order. +// +// appServiceCertificateOrder is information for a certificate order. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformation(appServiceCertificateOrder AppServiceCertificateOrder) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: appServiceCertificateOrder, + Constraints: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMaximum, Rule: 3, Chain: nil}, + {Target: "appServiceCertificateOrder.AppServiceCertificateOrderProperties.ValidityInYears", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation") + } + + req, err := client.ValidatePurchaseInformationPreparer(appServiceCertificateOrder) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", nil, "Failure preparing request") + return + } + + resp, err := client.ValidatePurchaseInformationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure sending request") + return + } + + result, err = client.ValidatePurchaseInformationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "ValidatePurchaseInformation", resp, "Failure responding to request") + } + + return +} + +// ValidatePurchaseInformationPreparer prepares the ValidatePurchaseInformation request. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationPreparer(appServiceCertificateOrder AppServiceCertificateOrder) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation", pathParameters), + autorest.WithJSON(appServiceCertificateOrder), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidatePurchaseInformationSender sends the ValidatePurchaseInformation request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidatePurchaseInformationResponder handles the response to the ValidatePurchaseInformation request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) ValidatePurchaseInformationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// VerifyDomainOwnership verify domain ownership for this certificate order. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. certificateOrderName is name of the certificate order. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnership(resourceGroupName string, certificateOrderName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership") + } + + req, err := client.VerifyDomainOwnershipPreparer(resourceGroupName, certificateOrderName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", nil, "Failure preparing request") + return + } + + resp, err := client.VerifyDomainOwnershipSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure sending request") + return + } + + result, err = client.VerifyDomainOwnershipResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceCertificateOrdersClient", "VerifyDomainOwnership", resp, "Failure responding to request") + } + + return +} + +// VerifyDomainOwnershipPreparer prepares the VerifyDomainOwnership request. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipPreparer(resourceGroupName string, certificateOrderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateOrderName": autorest.Encode("path", certificateOrderName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/verifyDomainOwnership", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// VerifyDomainOwnershipSender sends the VerifyDomainOwnership request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// VerifyDomainOwnershipResponder handles the response to the VerifyDomainOwnership request. The method always +// closes the http.Response Body. +func (client AppServiceCertificateOrdersClient) VerifyDomainOwnershipResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceenvironments.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceenvironments.go index c9597ae936..54f9f9bcb5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceenvironments.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceenvironments.go @@ -1,3461 +1,3461 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AppServiceEnvironmentsClient is the composite Swagger for WebSite Management -// Client -type AppServiceEnvironmentsClient struct { - ManagementClient -} - -// NewAppServiceEnvironmentsClient creates an instance of the -// AppServiceEnvironmentsClient client. -func NewAppServiceEnvironmentsClient(subscriptionID string) AppServiceEnvironmentsClient { - return NewAppServiceEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppServiceEnvironmentsClientWithBaseURI creates an instance of the -// AppServiceEnvironmentsClient client. -func NewAppServiceEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) AppServiceEnvironmentsClient { - return AppServiceEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an App Service Environment. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -// hostingEnvironmentEnvelope is configuration details of the App Service -// Environment. -func (client AppServiceEnvironmentsClient) CreateOrUpdate(resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource, cancel <-chan struct{}) (<-chan AppServiceEnvironmentResource, <-chan error) { - resultChan := make(chan AppServiceEnvironmentResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: hostingEnvironmentEnvelope, - Constraints: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.VirtualNetwork", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.WorkerPools", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result AppServiceEnvironmentResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, hostingEnvironmentEnvelope, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppServiceEnvironmentsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), - autorest.WithJSON(hostingEnvironmentEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateMultiRolePool create or update a multi-role pool. This method -// may poll for completion. Polling can be canceled by passing the cancel -// channel argument. The channel will be used to cancel polling and any -// outstanding HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. multiRolePoolEnvelope -// is properties of the multi-role pool. -func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePool(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (<-chan WorkerPoolResource, <-chan error) { - resultChan := make(chan WorkerPoolResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result WorkerPoolResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateMultiRolePoolPreparer(resourceGroupName, name, multiRolePoolEnvelope, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateMultiRolePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateMultiRolePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateMultiRolePoolPreparer prepares the CreateOrUpdateMultiRolePool request. -func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolPreparer(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), - autorest.WithJSON(multiRolePoolEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateMultiRolePoolSender sends the CreateOrUpdateMultiRolePool request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateMultiRolePoolResponder handles the response to the CreateOrUpdateMultiRolePool request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateWorkerPool create or update a worker pool. This method may -// poll for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. workerPoolEnvelope is properties of the worker pool. -func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPool(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (<-chan WorkerPoolResource, <-chan error) { - resultChan := make(chan WorkerPoolResource, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result WorkerPoolResource - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdateWorkerPoolPreparer(resourceGroupName, name, workerPoolName, workerPoolEnvelope, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateWorkerPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateWorkerPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdateWorkerPoolPreparer prepares the CreateOrUpdateWorkerPool request. -func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), - autorest.WithJSON(workerPoolEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateWorkerPoolSender sends the CreateOrUpdateWorkerPool request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateWorkerPoolResponder handles the response to the CreateOrUpdateWorkerPool request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an App Service Environment. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. forceDelete is specify -// true to force the deletion even if the App Service Environment -// contains resources. The default is false. -func (client AppServiceEnvironmentsClient) Delete(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { - resultChan := make(chan autorest.Response, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Delete") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result autorest.Response - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.DeletePreparer(resourceGroupName, name, forceDelete, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// DeletePreparer prepares the Delete request. -func (client AppServiceEnvironmentsClient) DeletePreparer(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if forceDelete != nil { - queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the properties of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) Get(resourceGroupName string, name string) (result AppServiceEnvironmentResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AppServiceEnvironmentsClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) GetResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDiagnosticsItem get a diagnostics item for an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. diagnosticsName is -// name of the diagnostics item. -func (client AppServiceEnvironmentsClient) GetDiagnosticsItem(resourceGroupName string, name string, diagnosticsName string) (result HostingEnvironmentDiagnostics, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem") - } - - req, err := client.GetDiagnosticsItemPreparer(resourceGroupName, name, diagnosticsName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", nil, "Failure preparing request") - return - } - - resp, err := client.GetDiagnosticsItemSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure sending request") - return - } - - result, err = client.GetDiagnosticsItemResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure responding to request") - } - - return -} - -// GetDiagnosticsItemPreparer prepares the GetDiagnosticsItem request. -func (client AppServiceEnvironmentsClient) GetDiagnosticsItemPreparer(resourceGroupName string, name string, diagnosticsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "diagnosticsName": autorest.Encode("path", diagnosticsName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetDiagnosticsItemSender sends the GetDiagnosticsItem request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) GetDiagnosticsItemSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetDiagnosticsItemResponder handles the response to the GetDiagnosticsItem request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) GetDiagnosticsItemResponder(resp *http.Response) (result HostingEnvironmentDiagnostics, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMultiRolePool get properties of a multi-role pool. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) GetMultiRolePool(resourceGroupName string, name string) (result WorkerPoolResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool") - } - - req, err := client.GetMultiRolePoolPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", nil, "Failure preparing request") - return - } - - resp, err := client.GetMultiRolePoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure sending request") - return - } - - result, err = client.GetMultiRolePoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure responding to request") - } - - return -} - -// GetMultiRolePoolPreparer prepares the GetMultiRolePool request. -func (client AppServiceEnvironmentsClient) GetMultiRolePoolPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetMultiRolePoolSender sends the GetMultiRolePool request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) GetMultiRolePoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetMultiRolePoolResponder handles the response to the GetMultiRolePool request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) GetMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetWorkerPool get properties of a worker pool. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. -func (client AppServiceEnvironmentsClient) GetWorkerPool(resourceGroupName string, name string, workerPoolName string) (result WorkerPoolResource, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool") - } - - req, err := client.GetWorkerPoolPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", nil, "Failure preparing request") - return - } - - resp, err := client.GetWorkerPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure sending request") - return - } - - result, err = client.GetWorkerPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure responding to request") - } - - return -} - -// GetWorkerPoolPreparer prepares the GetWorkerPool request. -func (client AppServiceEnvironmentsClient) GetWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetWorkerPoolSender sends the GetWorkerPool request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) GetWorkerPoolSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetWorkerPoolResponder handles the response to the GetWorkerPool request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) GetWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all App Service Environments for a subscription. -func (client AppServiceEnvironmentsClient) List() (result AppServiceEnvironmentCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AppServiceEnvironmentsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListNextResults(lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { - req, err := lastResults.AppServiceEnvironmentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAppServicePlans get all App Service plans in an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListAppServicePlans(resourceGroupName string, name string) (result AppServicePlanCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans") - } - - req, err := client.ListAppServicePlansPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing request") - return - } - - resp, err := client.ListAppServicePlansSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending request") - return - } - - result, err = client.ListAppServicePlansResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to request") - } - - return -} - -// ListAppServicePlansPreparer prepares the ListAppServicePlans request. -func (client AppServiceEnvironmentsClient) ListAppServicePlansPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAppServicePlansSender sends the ListAppServicePlans request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListAppServicePlansSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAppServicePlansResponder handles the response to the ListAppServicePlans request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListAppServicePlansResponder(resp *http.Response) (result AppServicePlanCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAppServicePlansNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListAppServicePlansNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { - req, err := lastResults.AppServicePlanCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAppServicePlansSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending next results request") - } - - result, err = client.ListAppServicePlansResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup get all App Service Environments in a resource group. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. -func (client AppServiceEnvironmentsClient) ListByResourceGroup(resourceGroupName string) (result AppServiceEnvironmentCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AppServiceEnvironmentsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListByResourceGroupNextResults(lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { - req, err := lastResults.AppServiceEnvironmentCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListCapacities get the used, available, and total worker capacity an App -// Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListCapacities(resourceGroupName string, name string) (result StampCapacityCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListCapacities") - } - - req, err := client.ListCapacitiesPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing request") - return - } - - resp, err := client.ListCapacitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending request") - return - } - - result, err = client.ListCapacitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to request") - } - - return -} - -// ListCapacitiesPreparer prepares the ListCapacities request. -func (client AppServiceEnvironmentsClient) ListCapacitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListCapacitiesSender sends the ListCapacities request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListCapacitiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListCapacitiesResponder handles the response to the ListCapacities request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListCapacitiesResponder(resp *http.Response) (result StampCapacityCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListCapacitiesNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListCapacitiesNextResults(lastResults StampCapacityCollection) (result StampCapacityCollection, err error) { - req, err := lastResults.StampCapacityCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListCapacitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending next results request") - } - - result, err = client.ListCapacitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to next results request") - } - - return -} - -// ListDiagnostics get diagnostic information for an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListDiagnostics(resourceGroupName string, name string) (result ListHostingEnvironmentDiagnostics, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics") - } - - req, err := client.ListDiagnosticsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", nil, "Failure preparing request") - return - } - - resp, err := client.ListDiagnosticsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure sending request") - return - } - - result, err = client.ListDiagnosticsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure responding to request") - } - - return -} - -// ListDiagnosticsPreparer prepares the ListDiagnostics request. -func (client AppServiceEnvironmentsClient) ListDiagnosticsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListDiagnosticsSender sends the ListDiagnostics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListDiagnosticsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListDiagnosticsResponder handles the response to the ListDiagnostics request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListDiagnosticsResponder(resp *http.Response) (result ListHostingEnvironmentDiagnostics, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefinitions get global metric definitions of an App Service -// Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListMetricDefinitions(resourceGroupName string, name string) (result MetricDefinition, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions") - } - - req, err := client.ListMetricDefinitionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. -func (client AppServiceEnvironmentsClient) ListMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinition, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetrics get global metrics of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. details is specify -// true to include instance details. The default is -// false. filter is return only usages/metrics specified in the -// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq -// 'Metric1' or name.value eq 'Metric2') and startTime eq -// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain -// eq duration'[Hour|Minute|Day]'. -func (client AppServiceEnvironmentsClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMetrics") - } - - req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client AppServiceEnvironmentsClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRoleMetricDefinitions get metric definitions for a multi-role pool -// of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions") - } - - req, err := client.ListMultiRoleMetricDefinitionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRoleMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// ListMultiRoleMetricDefinitionsPreparer prepares the ListMultiRoleMetricDefinitions request. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRoleMetricDefinitionsSender sends the ListMultiRoleMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRoleMetricDefinitionsResponder handles the response to the ListMultiRoleMetricDefinitions request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRoleMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRoleMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRoleMetrics get metrics for a multi-role pool of an App Service -// Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. startTime is beginning -// time of the metrics query. endTime is end time of the metrics query. -// timeGrain is time granularity of the metrics query. details is specify -// true to include instance details. The default is -// false. filter is return only usages/metrics specified in the -// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq -// 'Metric1' or name.value eq 'Metric2') and startTime eq -// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain -// eq duration'[Hour|Minute|Day]'. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetrics(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics") - } - - req, err := client.ListMultiRoleMetricsPreparer(resourceGroupName, name, startTime, endTime, timeGrain, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRoleMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRoleMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMultiRoleMetricsPreparer prepares the ListMultiRoleMetrics request. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsPreparer(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(startTime) > 0 { - queryParameters["startTime"] = autorest.Encode("query", startTime) - } - if len(endTime) > 0 { - queryParameters["endTime"] = autorest.Encode("query", endTime) - } - if len(timeGrain) > 0 { - queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRoleMetricsSender sends the ListMultiRoleMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRoleMetricsResponder handles the response to the ListMultiRoleMetrics request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRoleMetricsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRoleMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRoleMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRolePoolInstanceMetricDefinitions get metric definitions for a -// specific instance of a multi-role pool of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. instance is name of -// the instance in the multi-role pool. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitions(resourceGroupName string, name string, instance string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions") - } - - req, err := client.ListMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, instance) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// ListMultiRolePoolInstanceMetricDefinitionsPreparer prepares the ListMultiRolePoolInstanceMetricDefinitions request. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, instance string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRolePoolInstanceMetricDefinitionsSender sends the ListMultiRolePoolInstanceMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRolePoolInstanceMetricDefinitionsResponder handles the response to the ListMultiRolePoolInstanceMetricDefinitions request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRolePoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRolePoolInstanceMetrics get metrics for a specific instance of a -// multi-role pool of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. instance is name of -// the instance in the multi-role pool. details is specify true to -// include instance details. The default is false. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetrics(resourceGroupName string, name string, instance string, details *bool) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics") - } - - req, err := client.ListMultiRolePoolInstanceMetricsPreparer(resourceGroupName, name, instance, details) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRolePoolInstanceMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRolePoolInstanceMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMultiRolePoolInstanceMetricsPreparer prepares the ListMultiRolePoolInstanceMetrics request. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsPreparer(resourceGroupName string, name string, instance string, details *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRolePoolInstanceMetricsSender sends the ListMultiRolePoolInstanceMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRolePoolInstanceMetricsResponder handles the response to the ListMultiRolePoolInstanceMetrics request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRolePoolInstanceMetricsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRolePoolInstanceMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRolePoolInstanceMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRolePools get all multi-role pools. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListMultiRolePools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools") - } - - req, err := client.ListMultiRolePoolsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRolePoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRolePoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to request") - } - - return -} - -// ListMultiRolePoolsPreparer prepares the ListMultiRolePools request. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRolePoolsSender sends the ListMultiRolePools request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRolePoolsResponder handles the response to the ListMultiRolePools request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRolePoolsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { - req, err := lastResults.WorkerPoolCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRolePoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRolePoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRolePoolSkus get available SKUs for scaling a multi-role pool. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkus(resourceGroupName string, name string) (result SkuInfoCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus") - } - - req, err := client.ListMultiRolePoolSkusPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRolePoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRolePoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to request") - } - - return -} - -// ListMultiRolePoolSkusPreparer prepares the ListMultiRolePoolSkus request. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRolePoolSkusSender sends the ListMultiRolePoolSkus request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRolePoolSkusResponder handles the response to the ListMultiRolePoolSkus request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRolePoolSkusNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { - req, err := lastResults.SkuInfoCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRolePoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRolePoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to next results request") - } - - return -} - -// ListMultiRoleUsages get usage metrics for a multi-role pool of an App -// Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListMultiRoleUsages(resourceGroupName string, name string) (result UsageCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages") - } - - req, err := client.ListMultiRoleUsagesPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListMultiRoleUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending request") - return - } - - result, err = client.ListMultiRoleUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to request") - } - - return -} - -// ListMultiRoleUsagesPreparer prepares the ListMultiRoleUsages request. -func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMultiRoleUsagesSender sends the ListMultiRoleUsages request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMultiRoleUsagesResponder handles the response to the ListMultiRoleUsages request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesResponder(resp *http.Response) (result UsageCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMultiRoleUsagesNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { - req, err := lastResults.UsageCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMultiRoleUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending next results request") - } - - result, err = client.ListMultiRoleUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to next results request") - } - - return -} - -// ListOperations list all currently running operations on the App Service -// Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListOperations(resourceGroupName string, name string) (result ListOperation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListOperations") - } - - req, err := client.ListOperationsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure sending request") - return - } - - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure responding to request") - } - - return -} - -// ListOperationsPreparer prepares the ListOperations request. -func (client AppServiceEnvironmentsClient) ListOperationsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListOperationsSender sends the ListOperations request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListOperationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListOperationsResponder handles the response to the ListOperations request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListOperationsResponder(resp *http.Response) (result ListOperation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsages get global usage metrics of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. filter is return only -// usages/metrics specified in the filter. Filter conforms to odata syntax. -// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and -// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' -// and timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppServiceEnvironmentsClient) ListUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListUsages") - } - - req, err := client.ListUsagesPreparer(resourceGroupName, name, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending request") - return - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to request") - } - - return -} - -// ListUsagesPreparer prepares the ListUsages request. -func (client AppServiceEnvironmentsClient) ListUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListUsagesSender sends the ListUsages request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListUsagesResponder handles the response to the ListUsages request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListUsagesNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { - req, err := lastResults.CsmUsageQuotaCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending next results request") - } - - result, err = client.ListUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to next results request") - } - - return -} - -// ListVips get IP addresses assigned to an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListVips(resourceGroupName string, name string) (result AddressResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListVips") - } - - req, err := client.ListVipsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", nil, "Failure preparing request") - return - } - - resp, err := client.ListVipsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", resp, "Failure sending request") - return - } - - result, err = client.ListVipsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", resp, "Failure responding to request") - } - - return -} - -// ListVipsPreparer prepares the ListVips request. -func (client AppServiceEnvironmentsClient) ListVipsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVipsSender sends the ListVips request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListVipsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVipsResponder handles the response to the ListVips request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListVipsResponder(resp *http.Response) (result AddressResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebApps get all apps in an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. propertiesToInclude is -// comma separated list of app properties to include. -func (client AppServiceEnvironmentsClient) ListWebApps(resourceGroupName string, name string, propertiesToInclude string) (result AppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebApps") - } - - req, err := client.ListWebAppsPreparer(resourceGroupName, name, propertiesToInclude) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing request") - return - } - - resp, err := client.ListWebAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending request") - return - } - - result, err = client.ListWebAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to request") - } - - return -} - -// ListWebAppsPreparer prepares the ListWebApps request. -func (client AppServiceEnvironmentsClient) ListWebAppsPreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(propertiesToInclude) > 0 { - queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWebAppsSender sends the ListWebApps request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWebAppsResponder handles the response to the ListWebApps request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebAppsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWebAppsNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWebAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending next results request") - } - - result, err = client.ListWebAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to next results request") - } - - return -} - -// ListWebWorkerMetricDefinitions get metric definitions for a worker pool of -// an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitions(resourceGroupName string, name string, workerPoolName string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions") - } - - req, err := client.ListWebWorkerMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListWebWorkerMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// ListWebWorkerMetricDefinitionsPreparer prepares the ListWebWorkerMetricDefinitions request. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWebWorkerMetricDefinitionsSender sends the ListWebWorkerMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWebWorkerMetricDefinitionsResponder handles the response to the ListWebWorkerMetricDefinitions request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebWorkerMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWebWorkerMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// ListWebWorkerMetrics get metrics for a worker pool of a -// AppServiceEnvironment (App Service Environment). -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of worker pool details is specify true to include instance -// details. The default is false. filter is return only -// usages/metrics specified in the filter. Filter conforms to odata syntax. -// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and -// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' -// and timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetrics(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics") - } - - req, err := client.ListWebWorkerMetricsPreparer(resourceGroupName, name, workerPoolName, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListWebWorkerMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListWebWorkerMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure responding to request") - } - - return -} - -// ListWebWorkerMetricsPreparer prepares the ListWebWorkerMetrics request. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsPreparer(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWebWorkerMetricsSender sends the ListWebWorkerMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWebWorkerMetricsResponder handles the response to the ListWebWorkerMetrics request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebWorkerMetricsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWebWorkerMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListWebWorkerMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListWebWorkerUsages get usage metrics for a worker pool of an App Service -// Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. -func (client AppServiceEnvironmentsClient) ListWebWorkerUsages(resourceGroupName string, name string, workerPoolName string) (result UsageCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages") - } - - req, err := client.ListWebWorkerUsagesPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing request") - return - } - - resp, err := client.ListWebWorkerUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending request") - return - } - - result, err = client.ListWebWorkerUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to request") - } - - return -} - -// ListWebWorkerUsagesPreparer prepares the ListWebWorkerUsages request. -func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWebWorkerUsagesSender sends the ListWebWorkerUsages request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWebWorkerUsagesResponder handles the response to the ListWebWorkerUsages request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesResponder(resp *http.Response) (result UsageCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebWorkerUsagesNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { - req, err := lastResults.UsageCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWebWorkerUsagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending next results request") - } - - result, err = client.ListWebWorkerUsagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to next results request") - } - - return -} - -// ListWorkerPoolInstanceMetricDefinitions get metric definitions for a -// specific instance of a worker pool of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. instance is name of the instance in the worker pool. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitions(resourceGroupName string, name string, workerPoolName string, instance string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions") - } - - req, err := client.ListWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName, instance) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing request") - return - } - - resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending request") - return - } - - result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to request") - } - - return -} - -// ListWorkerPoolInstanceMetricDefinitionsPreparer prepares the ListWorkerPoolInstanceMetricDefinitions request. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string, instance string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWorkerPoolInstanceMetricDefinitionsSender sends the ListWorkerPoolInstanceMetricDefinitions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWorkerPoolInstanceMetricDefinitionsResponder handles the response to the ListWorkerPoolInstanceMetricDefinitions request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWorkerPoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending next results request") - } - - result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to next results request") - } - - return -} - -// ListWorkerPoolInstanceMetrics get metrics for a specific instance of a -// worker pool of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. instance is name of the instance in the worker pool. -// details is specify true to include instance details. The -// default is false. filter is return only usages/metrics -// specified in the filter. Filter conforms to odata syntax. Example: -// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime -// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and -// timeGrain eq duration'[Hour|Minute|Day]'. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetrics(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics") - } - - req, err := client.ListWorkerPoolInstanceMetricsPreparer(resourceGroupName, name, workerPoolName, instance, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListWorkerPoolInstanceMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListWorkerPoolInstanceMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure responding to request") - } - - return -} - -// ListWorkerPoolInstanceMetricsPreparer prepares the ListWorkerPoolInstanceMetrics request. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsPreparer(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "instance": autorest.Encode("path", instance), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWorkerPoolInstanceMetricsSender sends the ListWorkerPoolInstanceMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWorkerPoolInstanceMetricsResponder handles the response to the ListWorkerPoolInstanceMetrics request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWorkerPoolInstanceMetricsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWorkerPoolInstanceMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListWorkerPoolInstanceMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListWorkerPools get all worker pools of an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) ListWorkerPools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools") - } - - req, err := client.ListWorkerPoolsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing request") - return - } - - resp, err := client.ListWorkerPoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending request") - return - } - - result, err = client.ListWorkerPoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to request") - } - - return -} - -// ListWorkerPoolsPreparer prepares the ListWorkerPools request. -func (client AppServiceEnvironmentsClient) ListWorkerPoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWorkerPoolsSender sends the ListWorkerPools request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWorkerPoolsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWorkerPoolsResponder handles the response to the ListWorkerPools request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWorkerPoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWorkerPoolsNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWorkerPoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { - req, err := lastResults.WorkerPoolCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWorkerPoolsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending next results request") - } - - result, err = client.ListWorkerPoolsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to next results request") - } - - return -} - -// ListWorkerPoolSkus get available SKUs for scaling a worker pool. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. workerPoolName is name -// of the worker pool. -func (client AppServiceEnvironmentsClient) ListWorkerPoolSkus(resourceGroupName string, name string, workerPoolName string) (result SkuInfoCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus") - } - - req, err := client.ListWorkerPoolSkusPreparer(resourceGroupName, name, workerPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListWorkerPoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending request") - return - } - - result, err = client.ListWorkerPoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to request") - } - - return -} - -// ListWorkerPoolSkusPreparer prepares the ListWorkerPoolSkus request. -func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerPoolName": autorest.Encode("path", workerPoolName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWorkerPoolSkusSender sends the ListWorkerPoolSkus request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWorkerPoolSkusResponder handles the response to the ListWorkerPoolSkus request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWorkerPoolSkusNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { - req, err := lastResults.SkuInfoCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWorkerPoolSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending next results request") - } - - result, err = client.ListWorkerPoolSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to next results request") - } - - return -} - -// Reboot reboot all machines in an App Service Environment. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) Reboot(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Reboot") - } - - req, err := client.RebootPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", nil, "Failure preparing request") - return - } - - resp, err := client.RebootSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure sending request") - return - } - - result, err = client.RebootResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure responding to request") - } - - return -} - -// RebootPreparer prepares the Reboot request. -func (client AppServiceEnvironmentsClient) RebootPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RebootSender sends the Reboot request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) RebootSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RebootResponder handles the response to the Reboot request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), - autorest.ByClosing()) - result.Response = resp - return -} - -// Resume resume an App Service Environment. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) Resume(resourceGroupName string, name string, cancel <-chan struct{}) (result AppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Resume") - } - - req, err := client.ResumePreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing request") - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure sending request") - return - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure responding to request") - } - - return -} - -// ResumePreparer prepares the Resume request. -func (client AppServiceEnvironmentsClient) ResumePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// ResumeSender sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) ResumeSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// ResumeResponder handles the response to the Resume request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) ResumeResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResumeNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) ResumeNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ResumeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure sending next results request") - } - - result, err = client.ResumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure responding to next results request") - } - - return -} - -// Suspend suspend an App Service Environment. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service Environment. -func (client AppServiceEnvironmentsClient) Suspend(resourceGroupName string, name string, cancel <-chan struct{}) (result AppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Suspend") - } - - req, err := client.SuspendPreparer(resourceGroupName, name, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing request") - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure sending request") - return - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure responding to request") - } - - return -} - -// SuspendPreparer prepares the Suspend request. -func (client AppServiceEnvironmentsClient) SuspendPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// SuspendSender sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (client AppServiceEnvironmentsClient) SuspendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// SuspendResponder handles the response to the Suspend request. The method always -// closes the http.Response Body. -func (client AppServiceEnvironmentsClient) SuspendResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SuspendNextResults retrieves the next set of results, if any. -func (client AppServiceEnvironmentsClient) SuspendNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.SuspendSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure sending next results request") - } - - result, err = client.SuspendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure responding to next results request") - } - - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppServiceEnvironmentsClient is the composite Swagger for WebSite Management +// Client +type AppServiceEnvironmentsClient struct { + ManagementClient +} + +// NewAppServiceEnvironmentsClient creates an instance of the +// AppServiceEnvironmentsClient client. +func NewAppServiceEnvironmentsClient(subscriptionID string) AppServiceEnvironmentsClient { + return NewAppServiceEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServiceEnvironmentsClientWithBaseURI creates an instance of the +// AppServiceEnvironmentsClient client. +func NewAppServiceEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) AppServiceEnvironmentsClient { + return AppServiceEnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an App Service Environment. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +// hostingEnvironmentEnvelope is configuration details of the App Service +// Environment. +func (client AppServiceEnvironmentsClient) CreateOrUpdate(resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource, cancel <-chan struct{}) (<-chan AppServiceEnvironmentResource, <-chan error) { + resultChan := make(chan AppServiceEnvironmentResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: hostingEnvironmentEnvelope, + Constraints: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.VirtualNetwork", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "hostingEnvironmentEnvelope.AppServiceEnvironment.WorkerPools", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AppServiceEnvironmentResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, hostingEnvironmentEnvelope, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServiceEnvironmentsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, hostingEnvironmentEnvelope AppServiceEnvironmentResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithJSON(hostingEnvironmentEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateMultiRolePool create or update a multi-role pool. This method +// may poll for completion. Polling can be canceled by passing the cancel +// channel argument. The channel will be used to cancel polling and any +// outstanding HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. multiRolePoolEnvelope +// is properties of the multi-role pool. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePool(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (<-chan WorkerPoolResource, <-chan error) { + resultChan := make(chan WorkerPoolResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result WorkerPoolResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateMultiRolePoolPreparer(resourceGroupName, name, multiRolePoolEnvelope, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateMultiRolePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateMultiRolePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateMultiRolePool", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateMultiRolePoolPreparer prepares the CreateOrUpdateMultiRolePool request. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolPreparer(resourceGroupName string, name string, multiRolePoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithJSON(multiRolePoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateMultiRolePoolSender sends the CreateOrUpdateMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateMultiRolePoolResponder handles the response to the CreateOrUpdateMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateWorkerPool create or update a worker pool. This method may +// poll for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. workerPoolEnvelope is properties of the worker pool. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPool(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (<-chan WorkerPoolResource, <-chan error) { + resultChan := make(chan WorkerPoolResource, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result WorkerPoolResource + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdateWorkerPoolPreparer(resourceGroupName, name, workerPoolName, workerPoolEnvelope, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateWorkerPoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateWorkerPoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "CreateOrUpdateWorkerPool", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdateWorkerPoolPreparer prepares the CreateOrUpdateWorkerPool request. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string, workerPoolEnvelope WorkerPoolResource, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithJSON(workerPoolEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateWorkerPoolSender sends the CreateOrUpdateWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateWorkerPoolResponder handles the response to the CreateOrUpdateWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) CreateOrUpdateWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an App Service Environment. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. forceDelete is specify +// true to force the deletion even if the App Service Environment +// contains resources. The default is false. +func (client AppServiceEnvironmentsClient) Delete(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { + resultChan := make(chan autorest.Response, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Delete") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result autorest.Response + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.DeletePreparer(resourceGroupName, name, forceDelete, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Delete", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// DeletePreparer prepares the Delete request. +func (client AppServiceEnvironmentsClient) DeletePreparer(resourceGroupName string, name string, forceDelete *bool, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the properties of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Get(resourceGroupName string, name string) (result AppServiceEnvironmentResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServiceEnvironmentsClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetResponder(resp *http.Response) (result AppServiceEnvironmentResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDiagnosticsItem get a diagnostics item for an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. diagnosticsName is +// name of the diagnostics item. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItem(resourceGroupName string, name string, diagnosticsName string) (result HostingEnvironmentDiagnostics, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem") + } + + req, err := client.GetDiagnosticsItemPreparer(resourceGroupName, name, diagnosticsName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", nil, "Failure preparing request") + return + } + + resp, err := client.GetDiagnosticsItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure sending request") + return + } + + result, err = client.GetDiagnosticsItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetDiagnosticsItem", resp, "Failure responding to request") + } + + return +} + +// GetDiagnosticsItemPreparer prepares the GetDiagnosticsItem request. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemPreparer(resourceGroupName string, name string, diagnosticsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "diagnosticsName": autorest.Encode("path", diagnosticsName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetDiagnosticsItemSender sends the GetDiagnosticsItem request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetDiagnosticsItemResponder handles the response to the GetDiagnosticsItem request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetDiagnosticsItemResponder(resp *http.Response) (result HostingEnvironmentDiagnostics, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetMultiRolePool get properties of a multi-role pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) GetMultiRolePool(resourceGroupName string, name string) (result WorkerPoolResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool") + } + + req, err := client.GetMultiRolePoolPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", nil, "Failure preparing request") + return + } + + resp, err := client.GetMultiRolePoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure sending request") + return + } + + result, err = client.GetMultiRolePoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetMultiRolePool", resp, "Failure responding to request") + } + + return +} + +// GetMultiRolePoolPreparer prepares the GetMultiRolePool request. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetMultiRolePoolSender sends the GetMultiRolePool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetMultiRolePoolResponder handles the response to the GetMultiRolePool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetMultiRolePoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetWorkerPool get properties of a worker pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) GetWorkerPool(resourceGroupName string, name string, workerPoolName string) (result WorkerPoolResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool") + } + + req, err := client.GetWorkerPoolPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", nil, "Failure preparing request") + return + } + + resp, err := client.GetWorkerPoolSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure sending request") + return + } + + result, err = client.GetWorkerPoolResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "GetWorkerPool", resp, "Failure responding to request") + } + + return +} + +// GetWorkerPoolPreparer prepares the GetWorkerPool request. +func (client AppServiceEnvironmentsClient) GetWorkerPoolPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetWorkerPoolSender sends the GetWorkerPool request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) GetWorkerPoolSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetWorkerPoolResponder handles the response to the GetWorkerPool request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) GetWorkerPoolResponder(resp *http.Response) (result WorkerPoolResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all App Service Environments for a subscription. +func (client AppServiceEnvironmentsClient) List() (result AppServiceEnvironmentCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServiceEnvironmentsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListNextResults(lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { + req, err := lastResults.AppServiceEnvironmentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAppServicePlans get all App Service plans in an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListAppServicePlans(resourceGroupName string, name string) (result AppServicePlanCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans") + } + + req, err := client.ListAppServicePlansPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing request") + return + } + + resp, err := client.ListAppServicePlansSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending request") + return + } + + result, err = client.ListAppServicePlansResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to request") + } + + return +} + +// ListAppServicePlansPreparer prepares the ListAppServicePlans request. +func (client AppServiceEnvironmentsClient) ListAppServicePlansPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAppServicePlansSender sends the ListAppServicePlans request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListAppServicePlansSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAppServicePlansResponder handles the response to the ListAppServicePlans request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListAppServicePlansResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAppServicePlansNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListAppServicePlansNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.AppServicePlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAppServicePlansSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure sending next results request") + } + + result, err = client.ListAppServicePlansResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListAppServicePlans", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all App Service Environments in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client AppServiceEnvironmentsClient) ListByResourceGroup(resourceGroupName string) (result AppServiceEnvironmentCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServiceEnvironmentsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListByResourceGroupResponder(resp *http.Response) (result AppServiceEnvironmentCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListByResourceGroupNextResults(lastResults AppServiceEnvironmentCollection) (result AppServiceEnvironmentCollection, err error) { + req, err := lastResults.AppServiceEnvironmentCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCapacities get the used, available, and total worker capacity an App +// Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListCapacities(resourceGroupName string, name string) (result StampCapacityCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListCapacities") + } + + req, err := client.ListCapacitiesPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCapacitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending request") + return + } + + result, err = client.ListCapacitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to request") + } + + return +} + +// ListCapacitiesPreparer prepares the ListCapacities request. +func (client AppServiceEnvironmentsClient) ListCapacitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCapacitiesSender sends the ListCapacities request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListCapacitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCapacitiesResponder handles the response to the ListCapacities request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListCapacitiesResponder(resp *http.Response) (result StampCapacityCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCapacitiesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListCapacitiesNextResults(lastResults StampCapacityCollection) (result StampCapacityCollection, err error) { + req, err := lastResults.StampCapacityCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListCapacitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure sending next results request") + } + + result, err = client.ListCapacitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListCapacities", resp, "Failure responding to next results request") + } + + return +} + +// ListDiagnostics get diagnostic information for an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListDiagnostics(resourceGroupName string, name string) (result ListHostingEnvironmentDiagnostics, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics") + } + + req, err := client.ListDiagnosticsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", nil, "Failure preparing request") + return + } + + resp, err := client.ListDiagnosticsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure sending request") + return + } + + result, err = client.ListDiagnosticsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListDiagnostics", resp, "Failure responding to request") + } + + return +} + +// ListDiagnosticsPreparer prepares the ListDiagnostics request. +func (client AppServiceEnvironmentsClient) ListDiagnosticsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListDiagnosticsSender sends the ListDiagnostics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListDiagnosticsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListDiagnosticsResponder handles the response to the ListDiagnostics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListDiagnosticsResponder(resp *http.Response) (result ListHostingEnvironmentDiagnostics, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefinitions get global metric definitions of an App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMetricDefinitions(resourceGroupName string, name string) (result MetricDefinition, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions") + } + + req, err := client.ListMetricDefinitionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefinitionsPreparer prepares the ListMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefinitionsSender sends the ListMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefinitionsResponder handles the response to the ListMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMetricDefinitionsResponder(resp *http.Response) (result MetricDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetrics get global metrics of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. details is specify +// true to include instance details. The default is +// false. filter is return only usages/metrics specified in the +// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq +// 'Metric1' or name.value eq 'Metric2') and startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client AppServiceEnvironmentsClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRoleMetricDefinitions get metric definitions for a multi-role pool +// of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions") + } + + req, err := client.ListMultiRoleMetricDefinitionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRoleMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMultiRoleMetricDefinitionsPreparer prepares the ListMultiRoleMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRoleMetricDefinitionsSender sends the ListMultiRoleMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRoleMetricDefinitionsResponder handles the response to the ListMultiRoleMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRoleMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRoleMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRoleMetrics get metrics for a multi-role pool of an App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. startTime is beginning +// time of the metrics query. endTime is end time of the metrics query. +// timeGrain is time granularity of the metrics query. details is specify +// true to include instance details. The default is +// false. filter is return only usages/metrics specified in the +// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq +// 'Metric1' or name.value eq 'Metric2') and startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetrics(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics") + } + + req, err := client.ListMultiRoleMetricsPreparer(resourceGroupName, name, startTime, endTime, timeGrain, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRoleMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRoleMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMultiRoleMetricsPreparer prepares the ListMultiRoleMetrics request. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsPreparer(resourceGroupName string, name string, startTime string, endTime string, timeGrain string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(startTime) > 0 { + queryParameters["startTime"] = autorest.Encode("query", startTime) + } + if len(endTime) > 0 { + queryParameters["endTime"] = autorest.Encode("query", endTime) + } + if len(timeGrain) > 0 { + queryParameters["timeGrain"] = autorest.Encode("query", timeGrain) + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRoleMetricsSender sends the ListMultiRoleMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRoleMetricsResponder handles the response to the ListMultiRoleMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRoleMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRoleMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRoleMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePoolInstanceMetricDefinitions get metric definitions for a +// specific instance of a multi-role pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. instance is name of +// the instance in the multi-role pool. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitions(resourceGroupName string, name string, instance string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions") + } + + req, err := client.ListMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, instance) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolInstanceMetricDefinitionsPreparer prepares the ListMultiRolePoolInstanceMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, instance string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolInstanceMetricDefinitionsSender sends the ListMultiRolePoolInstanceMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolInstanceMetricDefinitionsResponder handles the response to the ListMultiRolePoolInstanceMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePoolInstanceMetrics get metrics for a specific instance of a +// multi-role pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. instance is name of +// the instance in the multi-role pool. details is specify true to +// include instance details. The default is false. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetrics(resourceGroupName string, name string, instance string, details *bool) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics") + } + + req, err := client.ListMultiRolePoolInstanceMetricsPreparer(resourceGroupName, name, instance, details) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRolePoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolInstanceMetricsPreparer prepares the ListMultiRolePoolInstanceMetrics request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsPreparer(resourceGroupName string, name string, instance string, details *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolInstanceMetricsSender sends the ListMultiRolePoolInstanceMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolInstanceMetricsResponder handles the response to the ListMultiRolePoolInstanceMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolInstanceMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolInstanceMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolInstanceMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePools get all multi-role pools. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRolePools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools") + } + + req, err := client.ListMultiRolePoolsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRolePoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolsPreparer prepares the ListMultiRolePools request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolsSender sends the ListMultiRolePools request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolsResponder handles the response to the ListMultiRolePools request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { + req, err := lastResults.WorkerPoolCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePools", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRolePoolSkus get available SKUs for scaling a multi-role pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkus(resourceGroupName string, name string) (result SkuInfoCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus") + } + + req, err := client.ListMultiRolePoolSkusPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRolePoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRolePoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to request") + } + + return +} + +// ListMultiRolePoolSkusPreparer prepares the ListMultiRolePoolSkus request. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRolePoolSkusSender sends the ListMultiRolePoolSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRolePoolSkusResponder handles the response to the ListMultiRolePoolSkus request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRolePoolSkusNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRolePoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { + req, err := lastResults.SkuInfoCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRolePoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRolePoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRolePoolSkus", resp, "Failure responding to next results request") + } + + return +} + +// ListMultiRoleUsages get usage metrics for a multi-role pool of an App +// Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsages(resourceGroupName string, name string) (result UsageCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages") + } + + req, err := client.ListMultiRoleUsagesPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListMultiRoleUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending request") + return + } + + result, err = client.ListMultiRoleUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to request") + } + + return +} + +// ListMultiRoleUsagesPreparer prepares the ListMultiRoleUsages request. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMultiRoleUsagesSender sends the ListMultiRoleUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMultiRoleUsagesResponder handles the response to the ListMultiRoleUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesResponder(resp *http.Response) (result UsageCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMultiRoleUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListMultiRoleUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { + req, err := lastResults.UsageCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMultiRoleUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure sending next results request") + } + + result, err = client.ListMultiRoleUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListMultiRoleUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListOperations list all currently running operations on the App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListOperations(resourceGroupName string, name string) (result ListOperation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListOperations") + } + + req, err := client.ListOperationsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", nil, "Failure preparing request") + return + } + + resp, err := client.ListOperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure sending request") + return + } + + result, err = client.ListOperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListOperations", resp, "Failure responding to request") + } + + return +} + +// ListOperationsPreparer prepares the ListOperations request. +func (client AppServiceEnvironmentsClient) ListOperationsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOperationsSender sends the ListOperations request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListOperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOperationsResponder handles the response to the ListOperations request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListOperationsResponder(resp *http.Response) (result ListOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages get global usage metrics of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. filter is return only +// usages/metrics specified in the filter. Filter conforms to odata syntax. +// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and +// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' +// and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListUsages(resourceGroupName string, name string, filter string) (result CsmUsageQuotaCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListUsages") + } + + req, err := client.ListUsagesPreparer(resourceGroupName, name, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to request") + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AppServiceEnvironmentsClient) ListUsagesPreparer(resourceGroupName string, name string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListUsagesResponder(resp *http.Response) (result CsmUsageQuotaCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListUsagesNextResults(lastResults CsmUsageQuotaCollection) (result CsmUsageQuotaCollection, err error) { + req, err := lastResults.CsmUsageQuotaCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure sending next results request") + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListVips get IP addresses assigned to an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListVips(resourceGroupName string, name string) (result AddressResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListVips") + } + + req, err := client.ListVipsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", nil, "Failure preparing request") + return + } + + resp, err := client.ListVipsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", resp, "Failure sending request") + return + } + + result, err = client.ListVipsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListVips", resp, "Failure responding to request") + } + + return +} + +// ListVipsPreparer prepares the ListVips request. +func (client AppServiceEnvironmentsClient) ListVipsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVipsSender sends the ListVips request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListVipsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVipsResponder handles the response to the ListVips request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListVipsResponder(resp *http.Response) (result AddressResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebApps get all apps in an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. propertiesToInclude is +// comma separated list of app properties to include. +func (client AppServiceEnvironmentsClient) ListWebApps(resourceGroupName string, name string, propertiesToInclude string) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebApps") + } + + req, err := client.ListWebAppsPreparer(resourceGroupName, name, propertiesToInclude) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending request") + return + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to request") + } + + return +} + +// ListWebAppsPreparer prepares the ListWebApps request. +func (client AppServiceEnvironmentsClient) ListWebAppsPreparer(resourceGroupName string, name string, propertiesToInclude string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(propertiesToInclude) > 0 { + queryParameters["propertiesToInclude"] = autorest.Encode("query", propertiesToInclude) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebAppsSender sends the ListWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebAppsResponder handles the response to the ListWebApps request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebAppsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebAppsNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure sending next results request") + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebApps", resp, "Failure responding to next results request") + } + + return +} + +// ListWebWorkerMetricDefinitions get metric definitions for a worker pool of +// an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitions(resourceGroupName string, name string, workerPoolName string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions") + } + + req, err := client.ListWebWorkerMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebWorkerMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListWebWorkerMetricDefinitionsPreparer prepares the ListWebWorkerMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebWorkerMetricDefinitionsSender sends the ListWebWorkerMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebWorkerMetricDefinitionsResponder handles the response to the ListWebWorkerMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebWorkerMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebWorkerMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListWebWorkerMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListWebWorkerMetrics get metrics for a worker pool of a +// AppServiceEnvironment (App Service Environment). +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of worker pool details is specify true to include instance +// details. The default is false. filter is return only +// usages/metrics specified in the filter. Filter conforms to odata syntax. +// Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and +// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' +// and timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetrics(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics") + } + + req, err := client.ListWebWorkerMetricsPreparer(resourceGroupName, name, workerPoolName, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebWorkerMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListWebWorkerMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure responding to request") + } + + return +} + +// ListWebWorkerMetricsPreparer prepares the ListWebWorkerMetrics request. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsPreparer(resourceGroupName string, name string, workerPoolName string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebWorkerMetricsSender sends the ListWebWorkerMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebWorkerMetricsResponder handles the response to the ListWebWorkerMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebWorkerMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebWorkerMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebWorkerMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListWebWorkerMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListWebWorkerUsages get usage metrics for a worker pool of an App Service +// Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsages(resourceGroupName string, name string, workerPoolName string) (result UsageCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages") + } + + req, err := client.ListWebWorkerUsagesPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebWorkerUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending request") + return + } + + result, err = client.ListWebWorkerUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to request") + } + + return +} + +// ListWebWorkerUsagesPreparer prepares the ListWebWorkerUsages request. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebWorkerUsagesSender sends the ListWebWorkerUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebWorkerUsagesResponder handles the response to the ListWebWorkerUsages request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesResponder(resp *http.Response) (result UsageCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebWorkerUsagesNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWebWorkerUsagesNextResults(lastResults UsageCollection) (result UsageCollection, err error) { + req, err := lastResults.UsageCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebWorkerUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure sending next results request") + } + + result, err = client.ListWebWorkerUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWebWorkerUsages", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPoolInstanceMetricDefinitions get metric definitions for a +// specific instance of a worker pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. instance is name of the instance in the worker pool. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitions(resourceGroupName string, name string, workerPoolName string, instance string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions") + } + + req, err := client.ListWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName, name, workerPoolName, instance) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolInstanceMetricDefinitionsPreparer prepares the ListWorkerPoolInstanceMetricDefinitions request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsPreparer(resourceGroupName string, name string, workerPoolName string, instance string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolInstanceMetricDefinitionsSender sends the ListWorkerPoolInstanceMetricDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolInstanceMetricDefinitionsResponder handles the response to the ListWorkerPoolInstanceMetricDefinitions request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolInstanceMetricDefinitionsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricDefinitionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolInstanceMetricDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolInstanceMetricDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetricDefinitions", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPoolInstanceMetrics get metrics for a specific instance of a +// worker pool of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. instance is name of the instance in the worker pool. +// details is specify true to include instance details. The +// default is false. filter is return only usages/metrics +// specified in the filter. Filter conforms to odata syntax. Example: +// $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime +// eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and +// timeGrain eq duration'[Hour|Minute|Day]'. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetrics(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics") + } + + req, err := client.ListWorkerPoolInstanceMetricsPreparer(resourceGroupName, name, workerPoolName, instance, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListWorkerPoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolInstanceMetricsPreparer prepares the ListWorkerPoolInstanceMetrics request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsPreparer(resourceGroupName string, name string, workerPoolName string, instance string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "instance": autorest.Encode("path", instance), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolInstanceMetricsSender sends the ListWorkerPoolInstanceMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolInstanceMetricsResponder handles the response to the ListWorkerPoolInstanceMetrics request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolInstanceMetricsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolInstanceMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolInstanceMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolInstanceMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolInstanceMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPools get all worker pools of an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) ListWorkerPools(resourceGroupName string, name string) (result WorkerPoolCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools") + } + + req, err := client.ListWorkerPoolsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending request") + return + } + + result, err = client.ListWorkerPoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolsPreparer prepares the ListWorkerPools request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolsSender sends the ListWorkerPools request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolsResponder handles the response to the ListWorkerPools request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsResponder(resp *http.Response) (result WorkerPoolCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolsNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolsNextResults(lastResults WorkerPoolCollection) (result WorkerPoolCollection, err error) { + req, err := lastResults.WorkerPoolCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPools", resp, "Failure responding to next results request") + } + + return +} + +// ListWorkerPoolSkus get available SKUs for scaling a worker pool. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. workerPoolName is name +// of the worker pool. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkus(resourceGroupName string, name string, workerPoolName string) (result SkuInfoCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus") + } + + req, err := client.ListWorkerPoolSkusPreparer(resourceGroupName, name, workerPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListWorkerPoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending request") + return + } + + result, err = client.ListWorkerPoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to request") + } + + return +} + +// ListWorkerPoolSkusPreparer prepares the ListWorkerPoolSkus request. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusPreparer(resourceGroupName string, name string, workerPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerPoolName": autorest.Encode("path", workerPoolName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWorkerPoolSkusSender sends the ListWorkerPoolSkus request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWorkerPoolSkusResponder handles the response to the ListWorkerPoolSkus request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusResponder(resp *http.Response) (result SkuInfoCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWorkerPoolSkusNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ListWorkerPoolSkusNextResults(lastResults SkuInfoCollection) (result SkuInfoCollection, err error) { + req, err := lastResults.SkuInfoCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWorkerPoolSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure sending next results request") + } + + result, err = client.ListWorkerPoolSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "ListWorkerPoolSkus", resp, "Failure responding to next results request") + } + + return +} + +// Reboot reboot all machines in an App Service Environment. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Reboot(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Reboot") + } + + req, err := client.RebootPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", nil, "Failure preparing request") + return + } + + resp, err := client.RebootSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure sending request") + return + } + + result, err = client.RebootResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Reboot", resp, "Failure responding to request") + } + + return +} + +// RebootPreparer prepares the Reboot request. +func (client AppServiceEnvironmentsClient) RebootPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RebootSender sends the Reboot request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) RebootSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RebootResponder handles the response to the Reboot request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) RebootResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusBadRequest, http.StatusNotFound, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resume resume an App Service Environment. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Resume(resourceGroupName string, name string, cancel <-chan struct{}) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Resume") + } + + req, err := client.ResumePreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing request") + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure sending request") + return + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure responding to request") + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client AppServiceEnvironmentsClient) ResumePreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) ResumeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) ResumeResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResumeNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) ResumeNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ResumeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure sending next results request") + } + + result, err = client.ResumeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Resume", resp, "Failure responding to next results request") + } + + return +} + +// Suspend suspend an App Service Environment. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service Environment. +func (client AppServiceEnvironmentsClient) Suspend(resourceGroupName string, name string, cancel <-chan struct{}) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServiceEnvironmentsClient", "Suspend") + } + + req, err := client.SuspendPreparer(resourceGroupName, name, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing request") + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure sending request") + return + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure responding to request") + } + + return +} + +// SuspendPreparer prepares the Suspend request. +func (client AppServiceEnvironmentsClient) SuspendPreparer(resourceGroupName string, name string, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// SuspendSender sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (client AppServiceEnvironmentsClient) SuspendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// SuspendResponder handles the response to the Suspend request. The method always +// closes the http.Response Body. +func (client AppServiceEnvironmentsClient) SuspendResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SuspendNextResults retrieves the next set of results, if any. +func (client AppServiceEnvironmentsClient) SuspendNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.SuspendSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure sending next results request") + } + + result, err = client.SuspendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServiceEnvironmentsClient", "Suspend", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceplans.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceplans.go index 36d0e64898..d4e3628757 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceplans.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/appserviceplans.go @@ -1,2237 +1,2237 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// AppServicePlansClient is the composite Swagger for WebSite Management Client -type AppServicePlansClient struct { - ManagementClient -} - -// NewAppServicePlansClient creates an instance of the AppServicePlansClient -// client. -func NewAppServicePlansClient(subscriptionID string) AppServicePlansClient { - return NewAppServicePlansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppServicePlansClientWithBaseURI creates an instance of the -// AppServicePlansClient client. -func NewAppServicePlansClientWithBaseURI(baseURI string, subscriptionID string) AppServicePlansClient { - return AppServicePlansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an App Service Plan. This method may poll -// for completion. Polling can be canceled by passing the cancel channel -// argument. The channel will be used to cancel polling and any outstanding -// HTTP requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. appServicePlan is details of -// the App Service plan. -func (client AppServicePlansClient) CreateOrUpdate(resourceGroupName string, name string, appServicePlan AppServicePlan, cancel <-chan struct{}) (<-chan AppServicePlan, <-chan error) { - resultChan := make(chan AppServicePlan, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result AppServicePlan - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, appServicePlan, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppServicePlansClient) CreateOrUpdatePreparer(resourceGroupName string, name string, appServicePlan AppServicePlan, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), - autorest.WithJSON(appServicePlan), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) CreateOrUpdateResponder(resp *http.Response) (result AppServicePlan, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateVnetRoute create or update a Virtual Network route in an App -// Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. routeName is name of the Virtual Network route. route is -// definition of the Virtual Network route. -func (client AppServicePlansClient) CreateOrUpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute") - } - - req, err := client.CreateOrUpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateVnetRouteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateVnetRouteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateVnetRoutePreparer prepares the CreateOrUpdateVnetRoute request. -func (client AppServicePlansClient) CreateOrUpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithJSON(route), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateVnetRouteSender sends the CreateOrUpdateVnetRoute request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) CreateOrUpdateVnetRouteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateVnetRouteResponder handles the response to the CreateOrUpdateVnetRoute request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) CreateOrUpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AppServicePlansClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteHybridConnection delete a Hybrid Connection in use in an App Service -// plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. namespaceName is name of the -// Service Bus namespace. relayName is name of the Service Bus relay. -func (client AppServicePlansClient) DeleteHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "DeleteHybridConnection") - } - - req, err := client.DeleteHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteHybridConnectionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.DeleteHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure responding to request") - } - - return -} - -// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. -func (client AppServicePlansClient) DeleteHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteVnetRoute delete a Virtual Network route in an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. routeName is name of the Virtual Network route. -func (client AppServicePlansClient) DeleteVnetRoute(resourceGroupName string, name string, vnetName string, routeName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "DeleteVnetRoute") - } - - req, err := client.DeleteVnetRoutePreparer(resourceGroupName, name, vnetName, routeName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteVnetRouteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure sending request") - return - } - - result, err = client.DeleteVnetRouteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure responding to request") - } - - return -} - -// DeleteVnetRoutePreparer prepares the DeleteVnetRoute request. -func (client AppServicePlansClient) DeleteVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteVnetRouteSender sends the DeleteVnetRoute request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) DeleteVnetRouteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteVnetRouteResponder handles the response to the DeleteVnetRoute request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) DeleteVnetRouteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) Get(resourceGroupName string, name string) (result AppServicePlan, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AppServicePlansClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) GetResponder(resp *http.Response) (result AppServicePlan, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHybridConnection retrieve a Hybrid Connection in use in an App Service -// plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. namespaceName is name of the -// Service Bus namespace. relayName is name of the Service Bus relay. -func (client AppServicePlansClient) GetHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetHybridConnection") - } - - req, err := client.GetHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.GetHybridConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.GetHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure responding to request") - } - - return -} - -// GetHybridConnectionPreparer prepares the GetHybridConnection request. -func (client AppServicePlansClient) GetHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetHybridConnectionPlanLimit get the maximum number of Hybrid Connections -// allowed in an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) GetHybridConnectionPlanLimit(resourceGroupName string, name string) (result HybridConnectionLimits, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit") - } - - req, err := client.GetHybridConnectionPlanLimitPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", nil, "Failure preparing request") - return - } - - resp, err := client.GetHybridConnectionPlanLimitSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure sending request") - return - } - - result, err = client.GetHybridConnectionPlanLimitResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure responding to request") - } - - return -} - -// GetHybridConnectionPlanLimitPreparer prepares the GetHybridConnectionPlanLimit request. -func (client AppServicePlansClient) GetHybridConnectionPlanLimitPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetHybridConnectionPlanLimitSender sends the GetHybridConnectionPlanLimit request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) GetHybridConnectionPlanLimitSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetHybridConnectionPlanLimitResponder handles the response to the GetHybridConnectionPlanLimit request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) GetHybridConnectionPlanLimitResponder(resp *http.Response) (result HybridConnectionLimits, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetRouteForVnet get a Virtual Network route in an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. routeName is name of the Virtual Network route. -func (client AppServicePlansClient) GetRouteForVnet(resourceGroupName string, name string, vnetName string, routeName string) (result ListVnetRoute, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetRouteForVnet") - } - - req, err := client.GetRouteForVnetPreparer(resourceGroupName, name, vnetName, routeName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", nil, "Failure preparing request") - return - } - - resp, err := client.GetRouteForVnetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure sending request") - return - } - - result, err = client.GetRouteForVnetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure responding to request") - } - - return -} - -// GetRouteForVnetPreparer prepares the GetRouteForVnet request. -func (client AppServicePlansClient) GetRouteForVnetPreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRouteForVnetSender sends the GetRouteForVnet request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) GetRouteForVnetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRouteForVnetResponder handles the response to the GetRouteForVnet request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) GetRouteForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetFromServerFarm get a Virtual Network associated with an App Service -// plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. -func (client AppServicePlansClient) GetVnetFromServerFarm(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm") - } - - req, err := client.GetVnetFromServerFarmPreparer(resourceGroupName, name, vnetName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", nil, "Failure preparing request") - return - } - - resp, err := client.GetVnetFromServerFarmSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure sending request") - return - } - - result, err = client.GetVnetFromServerFarmResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure responding to request") - } - - return -} - -// GetVnetFromServerFarmPreparer prepares the GetVnetFromServerFarm request. -func (client AppServicePlansClient) GetVnetFromServerFarmPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetFromServerFarmSender sends the GetVnetFromServerFarm request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) GetVnetFromServerFarmSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetFromServerFarmResponder handles the response to the GetVnetFromServerFarm request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) GetVnetFromServerFarmResponder(resp *http.Response) (result VnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVnetGateway get a Virtual Network gateway. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. gatewayName is name of the gateway. Only the 'primary' -// gateway is supported. -func (client AppServicePlansClient) GetVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetVnetGateway") - } - - req, err := client.GetVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", nil, "Failure preparing request") - return - } - - resp, err := client.GetVnetGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure sending request") - return - } - - result, err = client.GetVnetGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure responding to request") - } - - return -} - -// GetVnetGatewayPreparer prepares the GetVnetGateway request. -func (client AppServicePlansClient) GetVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetVnetGatewaySender sends the GetVnetGateway request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) GetVnetGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetVnetGatewayResponder handles the response to the GetVnetGateway request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) GetVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all App Service plans for a subcription. -// -// detailed is specify true to return all App Service plan -// properties. The default is false, which returns a subset of the -// properties. -// Retrieval of all properties may increase the API latency. -func (client AppServicePlansClient) List(detailed *bool) (result AppServicePlanCollection, err error) { - req, err := client.ListPreparer(detailed) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AppServicePlansClient) ListPreparer(detailed *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if detailed != nil { - queryParameters["detailed"] = autorest.Encode("query", *detailed) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListResponder(resp *http.Response) (result AppServicePlanCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { - req, err := lastResults.AppServicePlanCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup get all App Service plans in a resource group. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. -func (client AppServicePlansClient) ListByResourceGroup(resourceGroupName string) (result AppServicePlanCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AppServicePlansClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListByResourceGroupResponder(resp *http.Response) (result AppServicePlanCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListByResourceGroupNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { - req, err := lastResults.AppServicePlanCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListCapabilities list all capabilities of an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) ListCapabilities(resourceGroupName string, name string) (result ListCapability, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListCapabilities") - } - - req, err := client.ListCapabilitiesPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", nil, "Failure preparing request") - return - } - - resp, err := client.ListCapabilitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure sending request") - return - } - - result, err = client.ListCapabilitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure responding to request") - } - - return -} - -// ListCapabilitiesPreparer prepares the ListCapabilities request. -func (client AppServicePlansClient) ListCapabilitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListCapabilitiesSender sends the ListCapabilities request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListCapabilitiesResponder(resp *http.Response) (result ListCapability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHybridConnectionKeys get the send key name and value of a Hybrid -// Connection. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. namespaceName is the name of -// the Service Bus namespace. relayName is the name of the Service Bus relay. -func (client AppServicePlansClient) ListHybridConnectionKeys(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys") - } - - req, err := client.ListHybridConnectionKeysPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListHybridConnectionKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure sending request") - return - } - - result, err = client.ListHybridConnectionKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure responding to request") - } - - return -} - -// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. -func (client AppServicePlansClient) ListHybridConnectionKeysPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHybridConnections retrieve all Hybrid Connections in use in an App -// Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) ListHybridConnections(resourceGroupName string, name string) (result HybridConnectionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListHybridConnections") - } - - req, err := client.ListHybridConnectionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing request") - return - } - - resp, err := client.ListHybridConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending request") - return - } - - result, err = client.ListHybridConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to request") - } - - return -} - -// ListHybridConnectionsPreparer prepares the ListHybridConnections request. -func (client AppServicePlansClient) ListHybridConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnectionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHybridConnectionsNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListHybridConnectionsNextResults(lastResults HybridConnectionCollection) (result HybridConnectionCollection, err error) { - req, err := lastResults.HybridConnectionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListHybridConnectionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending next results request") - } - - result, err = client.ListHybridConnectionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to next results request") - } - - return -} - -// ListMetricDefintions get metrics that can be queried for an App Service -// plan, and their definitions. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) ListMetricDefintions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListMetricDefintions") - } - - req, err := client.ListMetricDefintionsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricDefintionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure sending request") - return - } - - result, err = client.ListMetricDefintionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure responding to request") - } - - return -} - -// ListMetricDefintionsPreparer prepares the ListMetricDefintions request. -func (client AppServicePlansClient) ListMetricDefintionsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricDefintionsSender sends the ListMetricDefintions request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListMetricDefintionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricDefintionsResponder handles the response to the ListMetricDefintions request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListMetricDefintionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricDefintionsNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListMetricDefintionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { - req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricDefintionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure sending next results request") - } - - result, err = client.ListMetricDefintionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure responding to next results request") - } - - return -} - -// ListMetrics get metrics for an App Serice plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. details is specify -// true to include instance details. The default is -// false. filter is return only usages/metrics specified in the -// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq -// 'Metric1' or name.value eq 'Metric2') and startTime eq -// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain -// eq duration'[Hour|Minute|Day]'. -func (client AppServicePlansClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListMetrics") - } - - req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client AppServicePlansClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if details != nil { - queryParameters["details"] = autorest.Encode("query", *details) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListMetricsNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { - req, err := lastResults.ResourceMetricCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure sending next results request") - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure responding to next results request") - } - - return -} - -// ListRoutesForVnet get all routes that are associated with a Virtual Network -// in an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. -func (client AppServicePlansClient) ListRoutesForVnet(resourceGroupName string, name string, vnetName string) (result ListVnetRoute, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListRoutesForVnet") - } - - req, err := client.ListRoutesForVnetPreparer(resourceGroupName, name, vnetName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", nil, "Failure preparing request") - return - } - - resp, err := client.ListRoutesForVnetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure sending request") - return - } - - result, err = client.ListRoutesForVnetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure responding to request") - } - - return -} - -// ListRoutesForVnetPreparer prepares the ListRoutesForVnet request. -func (client AppServicePlansClient) ListRoutesForVnetPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListRoutesForVnetSender sends the ListRoutesForVnet request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListRoutesForVnetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListRoutesForVnetResponder handles the response to the ListRoutesForVnet request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListRoutesForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVnets get all Virtual Networks associated with an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. -func (client AppServicePlansClient) ListVnets(resourceGroupName string, name string) (result ListVnetInfo, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListVnets") - } - - req, err := client.ListVnetsPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", nil, "Failure preparing request") - return - } - - resp, err := client.ListVnetsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure sending request") - return - } - - result, err = client.ListVnetsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure responding to request") - } - - return -} - -// ListVnetsPreparer prepares the ListVnets request. -func (client AppServicePlansClient) ListVnetsPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListVnetsSender sends the ListVnets request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListVnetsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListVnetsResponder handles the response to the ListVnets request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListVnetsResponder(resp *http.Response) (result ListVnetInfo, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebApps get all apps associated with an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. skipToken is skip to a web -// app in the list of webapps associated with app service plan. If specified, -// the resulting list will contain web apps starting from (including) the -// skipToken. Otherwise, the resulting list contains web apps from the start of -// the list filter is supported filter: $filter=state eq running. Returns only -// web apps that are currently running top is list page size. If specified, -// results are paged. -func (client AppServicePlansClient) ListWebApps(resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListWebApps") - } - - req, err := client.ListWebAppsPreparer(resourceGroupName, name, skipToken, filter, top) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing request") - return - } - - resp, err := client.ListWebAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending request") - return - } - - result, err = client.ListWebAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to request") - } - - return -} - -// ListWebAppsPreparer prepares the ListWebApps request. -func (client AppServicePlansClient) ListWebAppsPreparer(resourceGroupName string, name string, skipToken string, filter string, top string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - if len(top) > 0 { - queryParameters["$top"] = autorest.Encode("query", top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWebAppsSender sends the ListWebApps request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWebAppsResponder handles the response to the ListWebApps request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebAppsNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListWebAppsNextResults(lastResults AppCollection) (result AppCollection, err error) { - req, err := lastResults.AppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWebAppsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending next results request") - } - - result, err = client.ListWebAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to next results request") - } - - return -} - -// ListWebAppsByHybridConnection get all apps that use a Hybrid Connection in -// an App Service Plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. namespaceName is name of the -// Hybrid Connection namespace. relayName is name of the Hybrid Connection -// relay. -func (client AppServicePlansClient) ListWebAppsByHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection") - } - - req, err := client.ListWebAppsByHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing request") - return - } - - resp, err := client.ListWebAppsByHybridConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending request") - return - } - - result, err = client.ListWebAppsByHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to request") - } - - return -} - -// ListWebAppsByHybridConnectionPreparer prepares the ListWebAppsByHybridConnection request. -func (client AppServicePlansClient) ListWebAppsByHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "namespaceName": autorest.Encode("path", namespaceName), - "relayName": autorest.Encode("path", relayName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListWebAppsByHybridConnectionSender sends the ListWebAppsByHybridConnection request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) ListWebAppsByHybridConnectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListWebAppsByHybridConnectionResponder handles the response to the ListWebAppsByHybridConnection request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) ListWebAppsByHybridConnectionResponder(resp *http.Response) (result ResourceCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListWebAppsByHybridConnectionNextResults retrieves the next set of results, if any. -func (client AppServicePlansClient) ListWebAppsByHybridConnectionNextResults(lastResults ResourceCollection) (result ResourceCollection, err error) { - req, err := lastResults.ResourceCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListWebAppsByHybridConnectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending next results request") - } - - result, err = client.ListWebAppsByHybridConnectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to next results request") - } - - return -} - -// RebootWorker reboot a worker machine in an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. workerName is name of worker -// machine, which typically starts with RD. -func (client AppServicePlansClient) RebootWorker(resourceGroupName string, name string, workerName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "RebootWorker") - } - - req, err := client.RebootWorkerPreparer(resourceGroupName, name, workerName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", nil, "Failure preparing request") - return - } - - resp, err := client.RebootWorkerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure sending request") - return - } - - result, err = client.RebootWorkerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure responding to request") - } - - return -} - -// RebootWorkerPreparer prepares the RebootWorker request. -func (client AppServicePlansClient) RebootWorkerPreparer(resourceGroupName string, name string, workerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workerName": autorest.Encode("path", workerName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RebootWorkerSender sends the RebootWorker request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) RebootWorkerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RebootWorkerResponder handles the response to the RebootWorker request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) RebootWorkerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RestartWebApps restart all apps in an App Service plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. softRestart is specify -// true to performa a soft restart, applies the configuration -// settings and restarts the apps if necessary. The default is -// false, which always restarts and reprovisions the apps -func (client AppServicePlansClient) RestartWebApps(resourceGroupName string, name string, softRestart *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "RestartWebApps") - } - - req, err := client.RestartWebAppsPreparer(resourceGroupName, name, softRestart) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", nil, "Failure preparing request") - return - } - - resp, err := client.RestartWebAppsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure sending request") - return - } - - result, err = client.RestartWebAppsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure responding to request") - } - - return -} - -// RestartWebAppsPreparer prepares the RestartWebApps request. -func (client AppServicePlansClient) RestartWebAppsPreparer(resourceGroupName string, name string, softRestart *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if softRestart != nil { - queryParameters["softRestart"] = autorest.Encode("query", *softRestart) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestartWebAppsSender sends the RestartWebApps request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) RestartWebAppsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestartWebAppsResponder handles the response to the RestartWebApps request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) RestartWebAppsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateVnetGateway update a Virtual Network gateway. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. gatewayName is name of the gateway. Only the 'primary' -// gateway is supported. connectionEnvelope is definition of the gateway. -func (client AppServicePlansClient) UpdateVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "UpdateVnetGateway") - } - - req, err := client.UpdateVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateVnetGatewaySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure sending request") - return - } - - result, err = client.UpdateVnetGatewayResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetGatewayPreparer prepares the UpdateVnetGateway request. -func (client AppServicePlansClient) UpdateVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "gatewayName": autorest.Encode("path", gatewayName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), - autorest.WithJSON(connectionEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetGatewaySender sends the UpdateVnetGateway request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) UpdateVnetGatewaySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetGatewayResponder handles the response to the UpdateVnetGateway request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) UpdateVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateVnetRoute create or update a Virtual Network route in an App Service -// plan. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the App Service plan. vnetName is name of the -// Virtual Network. routeName is name of the Virtual Network route. route is -// definition of the Virtual Network route. -func (client AppServicePlansClient) UpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "UpdateVnetRoute") - } - - req, err := client.UpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateVnetRouteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure sending request") - return - } - - result, err = client.UpdateVnetRouteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure responding to request") - } - - return -} - -// UpdateVnetRoutePreparer prepares the UpdateVnetRoute request. -func (client AppServicePlansClient) UpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "routeName": autorest.Encode("path", routeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vnetName": autorest.Encode("path", vnetName), - } - - const APIVersion = "2016-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), - autorest.WithJSON(route), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateVnetRouteSender sends the UpdateVnetRoute request. The method will close the -// http.Response Body if it receives an error. -func (client AppServicePlansClient) UpdateVnetRouteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateVnetRouteResponder handles the response to the UpdateVnetRoute request. The method always -// closes the http.Response Body. -func (client AppServicePlansClient) UpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// AppServicePlansClient is the composite Swagger for WebSite Management Client +type AppServicePlansClient struct { + ManagementClient +} + +// NewAppServicePlansClient creates an instance of the AppServicePlansClient +// client. +func NewAppServicePlansClient(subscriptionID string) AppServicePlansClient { + return NewAppServicePlansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppServicePlansClientWithBaseURI creates an instance of the +// AppServicePlansClient client. +func NewAppServicePlansClientWithBaseURI(baseURI string, subscriptionID string) AppServicePlansClient { + return AppServicePlansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an App Service Plan. This method may poll +// for completion. Polling can be canceled by passing the cancel channel +// argument. The channel will be used to cancel polling and any outstanding +// HTTP requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. appServicePlan is details of +// the App Service plan. +func (client AppServicePlansClient) CreateOrUpdate(resourceGroupName string, name string, appServicePlan AppServicePlan, cancel <-chan struct{}) (<-chan AppServicePlan, <-chan error) { + resultChan := make(chan AppServicePlan, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result AppServicePlan + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, appServicePlan, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppServicePlansClient) CreateOrUpdatePreparer(resourceGroupName string, name string, appServicePlan AppServicePlan, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithJSON(appServicePlan), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) CreateOrUpdateResponder(resp *http.Response) (result AppServicePlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateVnetRoute create or update a Virtual Network route in an App +// Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. route is +// definition of the Virtual Network route. +func (client AppServicePlansClient) CreateOrUpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute") + } + + req, err := client.CreateOrUpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateVnetRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "CreateOrUpdateVnetRoute", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateVnetRoutePreparer prepares the CreateOrUpdateVnetRoute request. +func (client AppServicePlansClient) CreateOrUpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateVnetRouteSender sends the CreateOrUpdateVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) CreateOrUpdateVnetRouteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateVnetRouteResponder handles the response to the CreateOrUpdateVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) CreateOrUpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppServicePlansClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteHybridConnection delete a Hybrid Connection in use in an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is name of the +// Service Bus namespace. relayName is name of the Service Bus relay. +func (client AppServicePlansClient) DeleteHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "DeleteHybridConnection") + } + + req, err := client.DeleteHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteHybridConnectionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.DeleteHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteHybridConnection", resp, "Failure responding to request") + } + + return +} + +// DeleteHybridConnectionPreparer prepares the DeleteHybridConnection request. +func (client AppServicePlansClient) DeleteHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteHybridConnectionSender sends the DeleteHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteHybridConnectionResponder handles the response to the DeleteHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteHybridConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteVnetRoute delete a Virtual Network route in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. +func (client AppServicePlansClient) DeleteVnetRoute(resourceGroupName string, name string, vnetName string, routeName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "DeleteVnetRoute") + } + + req, err := client.DeleteVnetRoutePreparer(resourceGroupName, name, vnetName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteVnetRouteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure sending request") + return + } + + result, err = client.DeleteVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "DeleteVnetRoute", resp, "Failure responding to request") + } + + return +} + +// DeleteVnetRoutePreparer prepares the DeleteVnetRoute request. +func (client AppServicePlansClient) DeleteVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteVnetRouteSender sends the DeleteVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) DeleteVnetRouteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteVnetRouteResponder handles the response to the DeleteVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) DeleteVnetRouteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) Get(resourceGroupName string, name string) (result AppServicePlan, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppServicePlansClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetResponder(resp *http.Response) (result AppServicePlan, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnection retrieve a Hybrid Connection in use in an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is name of the +// Service Bus namespace. relayName is name of the Service Bus relay. +func (client AppServicePlansClient) GetHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetHybridConnection") + } + + req, err := client.GetHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnection", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionPreparer prepares the GetHybridConnection request. +func (client AppServicePlansClient) GetHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionSender sends the GetHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionResponder handles the response to the GetHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetHybridConnectionResponder(resp *http.Response) (result HybridConnection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetHybridConnectionPlanLimit get the maximum number of Hybrid Connections +// allowed in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) GetHybridConnectionPlanLimit(resourceGroupName string, name string) (result HybridConnectionLimits, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit") + } + + req, err := client.GetHybridConnectionPlanLimitPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", nil, "Failure preparing request") + return + } + + resp, err := client.GetHybridConnectionPlanLimitSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure sending request") + return + } + + result, err = client.GetHybridConnectionPlanLimitResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetHybridConnectionPlanLimit", resp, "Failure responding to request") + } + + return +} + +// GetHybridConnectionPlanLimitPreparer prepares the GetHybridConnectionPlanLimit request. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetHybridConnectionPlanLimitSender sends the GetHybridConnectionPlanLimit request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetHybridConnectionPlanLimitResponder handles the response to the GetHybridConnectionPlanLimit request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetHybridConnectionPlanLimitResponder(resp *http.Response) (result HybridConnectionLimits, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRouteForVnet get a Virtual Network route in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. +func (client AppServicePlansClient) GetRouteForVnet(resourceGroupName string, name string, vnetName string, routeName string) (result ListVnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetRouteForVnet") + } + + req, err := client.GetRouteForVnetPreparer(resourceGroupName, name, vnetName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", nil, "Failure preparing request") + return + } + + resp, err := client.GetRouteForVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure sending request") + return + } + + result, err = client.GetRouteForVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetRouteForVnet", resp, "Failure responding to request") + } + + return +} + +// GetRouteForVnetPreparer prepares the GetRouteForVnet request. +func (client AppServicePlansClient) GetRouteForVnetPreparer(resourceGroupName string, name string, vnetName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRouteForVnetSender sends the GetRouteForVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetRouteForVnetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRouteForVnetResponder handles the response to the GetRouteForVnet request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetRouteForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetFromServerFarm get a Virtual Network associated with an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. +func (client AppServicePlansClient) GetVnetFromServerFarm(resourceGroupName string, name string, vnetName string) (result VnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm") + } + + req, err := client.GetVnetFromServerFarmPreparer(resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetFromServerFarmSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure sending request") + return + } + + result, err = client.GetVnetFromServerFarmResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetFromServerFarm", resp, "Failure responding to request") + } + + return +} + +// GetVnetFromServerFarmPreparer prepares the GetVnetFromServerFarm request. +func (client AppServicePlansClient) GetVnetFromServerFarmPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetFromServerFarmSender sends the GetVnetFromServerFarm request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetVnetFromServerFarmSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetFromServerFarmResponder handles the response to the GetVnetFromServerFarm request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetVnetFromServerFarmResponder(resp *http.Response) (result VnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVnetGateway get a Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. gatewayName is name of the gateway. Only the 'primary' +// gateway is supported. +func (client AppServicePlansClient) GetVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "GetVnetGateway") + } + + req, err := client.GetVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", nil, "Failure preparing request") + return + } + + resp, err := client.GetVnetGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure sending request") + return + } + + result, err = client.GetVnetGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "GetVnetGateway", resp, "Failure responding to request") + } + + return +} + +// GetVnetGatewayPreparer prepares the GetVnetGateway request. +func (client AppServicePlansClient) GetVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetVnetGatewaySender sends the GetVnetGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) GetVnetGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetVnetGatewayResponder handles the response to the GetVnetGateway request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) GetVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all App Service plans for a subcription. +// +// detailed is specify true to return all App Service plan +// properties. The default is false, which returns a subset of the +// properties. +// Retrieval of all properties may increase the API latency. +func (client AppServicePlansClient) List(detailed *bool) (result AppServicePlanCollection, err error) { + req, err := client.ListPreparer(detailed) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AppServicePlansClient) ListPreparer(detailed *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if detailed != nil { + queryParameters["detailed"] = autorest.Encode("query", *detailed) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.AppServicePlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all App Service plans in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client AppServicePlansClient) ListByResourceGroup(resourceGroupName string) (result AppServicePlanCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AppServicePlansClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListByResourceGroupResponder(resp *http.Response) (result AppServicePlanCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListByResourceGroupNextResults(lastResults AppServicePlanCollection) (result AppServicePlanCollection, err error) { + req, err := lastResults.AppServicePlanCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListCapabilities list all capabilities of an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListCapabilities(resourceGroupName string, name string) (result ListCapability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListCapabilities") + } + + req, err := client.ListCapabilitiesPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure sending request") + return + } + + result, err = client.ListCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListCapabilities", resp, "Failure responding to request") + } + + return +} + +// ListCapabilitiesPreparer prepares the ListCapabilities request. +func (client AppServicePlansClient) ListCapabilitiesPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListCapabilitiesSender sends the ListCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListCapabilitiesResponder(resp *http.Response) (result ListCapability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionKeys get the send key name and value of a Hybrid +// Connection. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is the name of +// the Service Bus namespace. relayName is the name of the Service Bus relay. +func (client AppServicePlansClient) ListHybridConnectionKeys(resourceGroupName string, name string, namespaceName string, relayName string) (result HybridConnectionKey, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys") + } + + req, err := client.ListHybridConnectionKeysPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnectionKeys", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionKeysPreparer prepares the ListHybridConnectionKeys request. +func (client AppServicePlansClient) ListHybridConnectionKeysPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionKeysSender sends the ListHybridConnectionKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListHybridConnectionKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionKeysResponder handles the response to the ListHybridConnectionKeys request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListHybridConnectionKeysResponder(resp *http.Response) (result HybridConnectionKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnections retrieve all Hybrid Connections in use in an App +// Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListHybridConnections(resourceGroupName string, name string) (result HybridConnectionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListHybridConnections") + } + + req, err := client.ListHybridConnectionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending request") + return + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to request") + } + + return +} + +// ListHybridConnectionsPreparer prepares the ListHybridConnections request. +func (client AppServicePlansClient) ListHybridConnectionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHybridConnectionsSender sends the ListHybridConnections request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListHybridConnectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHybridConnectionsResponder handles the response to the ListHybridConnections request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListHybridConnectionsResponder(resp *http.Response) (result HybridConnectionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHybridConnectionsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListHybridConnectionsNextResults(lastResults HybridConnectionCollection) (result HybridConnectionCollection, err error) { + req, err := lastResults.HybridConnectionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListHybridConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure sending next results request") + } + + result, err = client.ListHybridConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListHybridConnections", resp, "Failure responding to next results request") + } + + return +} + +// ListMetricDefintions get metrics that can be queried for an App Service +// plan, and their definitions. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListMetricDefintions(resourceGroupName string, name string) (result ResourceMetricDefinitionCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListMetricDefintions") + } + + req, err := client.ListMetricDefintionsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricDefintionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure sending request") + return + } + + result, err = client.ListMetricDefintionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure responding to request") + } + + return +} + +// ListMetricDefintionsPreparer prepares the ListMetricDefintions request. +func (client AppServicePlansClient) ListMetricDefintionsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricDefintionsSender sends the ListMetricDefintions request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListMetricDefintionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricDefintionsResponder handles the response to the ListMetricDefintions request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListMetricDefintionsResponder(resp *http.Response) (result ResourceMetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricDefintionsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListMetricDefintionsNextResults(lastResults ResourceMetricDefinitionCollection) (result ResourceMetricDefinitionCollection, err error) { + req, err := lastResults.ResourceMetricDefinitionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricDefintionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure sending next results request") + } + + result, err = client.ListMetricDefintionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetricDefintions", resp, "Failure responding to next results request") + } + + return +} + +// ListMetrics get metrics for an App Serice plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. details is specify +// true to include instance details. The default is +// false. filter is return only usages/metrics specified in the +// filter. Filter conforms to odata syntax. Example: $filter=(name.value eq +// 'Metric1' or name.value eq 'Metric2') and startTime eq +// '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain +// eq duration'[Hour|Minute|Day]'. +func (client AppServicePlansClient) ListMetrics(resourceGroupName string, name string, details *bool, filter string) (result ResourceMetricCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListMetrics") + } + + req, err := client.ListMetricsPreparer(resourceGroupName, name, details, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure sending request") + return + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure responding to request") + } + + return +} + +// ListMetricsPreparer prepares the ListMetrics request. +func (client AppServicePlansClient) ListMetricsPreparer(resourceGroupName string, name string, details *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if details != nil { + queryParameters["details"] = autorest.Encode("query", *details) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListMetricsSender sends the ListMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListMetricsResponder handles the response to the ListMetrics request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListMetricsResponder(resp *http.Response) (result ResourceMetricCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListMetricsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListMetricsNextResults(lastResults ResourceMetricCollection) (result ResourceMetricCollection, err error) { + req, err := lastResults.ResourceMetricCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure sending next results request") + } + + result, err = client.ListMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListMetrics", resp, "Failure responding to next results request") + } + + return +} + +// ListRoutesForVnet get all routes that are associated with a Virtual Network +// in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. +func (client AppServicePlansClient) ListRoutesForVnet(resourceGroupName string, name string, vnetName string) (result ListVnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListRoutesForVnet") + } + + req, err := client.ListRoutesForVnetPreparer(resourceGroupName, name, vnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", nil, "Failure preparing request") + return + } + + resp, err := client.ListRoutesForVnetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure sending request") + return + } + + result, err = client.ListRoutesForVnetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListRoutesForVnet", resp, "Failure responding to request") + } + + return +} + +// ListRoutesForVnetPreparer prepares the ListRoutesForVnet request. +func (client AppServicePlansClient) ListRoutesForVnetPreparer(resourceGroupName string, name string, vnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRoutesForVnetSender sends the ListRoutesForVnet request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListRoutesForVnetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRoutesForVnetResponder handles the response to the ListRoutesForVnet request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListRoutesForVnetResponder(resp *http.Response) (result ListVnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVnets get all Virtual Networks associated with an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. +func (client AppServicePlansClient) ListVnets(resourceGroupName string, name string) (result ListVnetInfo, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListVnets") + } + + req, err := client.ListVnetsPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", nil, "Failure preparing request") + return + } + + resp, err := client.ListVnetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure sending request") + return + } + + result, err = client.ListVnetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListVnets", resp, "Failure responding to request") + } + + return +} + +// ListVnetsPreparer prepares the ListVnets request. +func (client AppServicePlansClient) ListVnetsPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListVnetsSender sends the ListVnets request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListVnetsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListVnetsResponder handles the response to the ListVnets request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListVnetsResponder(resp *http.Response) (result ListVnetInfo, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebApps get all apps associated with an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. skipToken is skip to a web +// app in the list of webapps associated with app service plan. If specified, +// the resulting list will contain web apps starting from (including) the +// skipToken. Otherwise, the resulting list contains web apps from the start of +// the list filter is supported filter: $filter=state eq running. Returns only +// web apps that are currently running top is list page size. If specified, +// results are paged. +func (client AppServicePlansClient) ListWebApps(resourceGroupName string, name string, skipToken string, filter string, top string) (result AppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListWebApps") + } + + req, err := client.ListWebAppsPreparer(resourceGroupName, name, skipToken, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending request") + return + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to request") + } + + return +} + +// ListWebAppsPreparer prepares the ListWebApps request. +func (client AppServicePlansClient) ListWebAppsPreparer(resourceGroupName string, name string, skipToken string, filter string, top string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skipToken) > 0 { + queryParameters["$skipToken"] = autorest.Encode("query", skipToken) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + if len(top) > 0 { + queryParameters["$top"] = autorest.Encode("query", top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebAppsSender sends the ListWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListWebAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebAppsResponder handles the response to the ListWebApps request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListWebAppsResponder(resp *http.Response) (result AppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebAppsNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListWebAppsNextResults(lastResults AppCollection) (result AppCollection, err error) { + req, err := lastResults.AppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebAppsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure sending next results request") + } + + result, err = client.ListWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebApps", resp, "Failure responding to next results request") + } + + return +} + +// ListWebAppsByHybridConnection get all apps that use a Hybrid Connection in +// an App Service Plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. namespaceName is name of the +// Hybrid Connection namespace. relayName is name of the Hybrid Connection +// relay. +func (client AppServicePlansClient) ListWebAppsByHybridConnection(resourceGroupName string, name string, namespaceName string, relayName string) (result ResourceCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection") + } + + req, err := client.ListWebAppsByHybridConnectionPreparer(resourceGroupName, name, namespaceName, relayName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing request") + return + } + + resp, err := client.ListWebAppsByHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending request") + return + } + + result, err = client.ListWebAppsByHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to request") + } + + return +} + +// ListWebAppsByHybridConnectionPreparer prepares the ListWebAppsByHybridConnection request. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionPreparer(resourceGroupName string, name string, namespaceName string, relayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "namespaceName": autorest.Encode("path", namespaceName), + "relayName": autorest.Encode("path", relayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListWebAppsByHybridConnectionSender sends the ListWebAppsByHybridConnection request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListWebAppsByHybridConnectionResponder handles the response to the ListWebAppsByHybridConnection request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionResponder(resp *http.Response) (result ResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListWebAppsByHybridConnectionNextResults retrieves the next set of results, if any. +func (client AppServicePlansClient) ListWebAppsByHybridConnectionNextResults(lastResults ResourceCollection) (result ResourceCollection, err error) { + req, err := lastResults.ResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListWebAppsByHybridConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure sending next results request") + } + + result, err = client.ListWebAppsByHybridConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "ListWebAppsByHybridConnection", resp, "Failure responding to next results request") + } + + return +} + +// RebootWorker reboot a worker machine in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. workerName is name of worker +// machine, which typically starts with RD. +func (client AppServicePlansClient) RebootWorker(resourceGroupName string, name string, workerName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "RebootWorker") + } + + req, err := client.RebootWorkerPreparer(resourceGroupName, name, workerName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", nil, "Failure preparing request") + return + } + + resp, err := client.RebootWorkerSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure sending request") + return + } + + result, err = client.RebootWorkerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RebootWorker", resp, "Failure responding to request") + } + + return +} + +// RebootWorkerPreparer prepares the RebootWorker request. +func (client AppServicePlansClient) RebootWorkerPreparer(resourceGroupName string, name string, workerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workerName": autorest.Encode("path", workerName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RebootWorkerSender sends the RebootWorker request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) RebootWorkerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RebootWorkerResponder handles the response to the RebootWorker request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) RebootWorkerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestartWebApps restart all apps in an App Service plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. softRestart is specify +// true to performa a soft restart, applies the configuration +// settings and restarts the apps if necessary. The default is +// false, which always restarts and reprovisions the apps +func (client AppServicePlansClient) RestartWebApps(resourceGroupName string, name string, softRestart *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "RestartWebApps") + } + + req, err := client.RestartWebAppsPreparer(resourceGroupName, name, softRestart) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", nil, "Failure preparing request") + return + } + + resp, err := client.RestartWebAppsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure sending request") + return + } + + result, err = client.RestartWebAppsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "RestartWebApps", resp, "Failure responding to request") + } + + return +} + +// RestartWebAppsPreparer prepares the RestartWebApps request. +func (client AppServicePlansClient) RestartWebAppsPreparer(resourceGroupName string, name string, softRestart *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if softRestart != nil { + queryParameters["softRestart"] = autorest.Encode("query", *softRestart) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestartWebAppsSender sends the RestartWebApps request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) RestartWebAppsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestartWebAppsResponder handles the response to the RestartWebApps request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) RestartWebAppsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateVnetGateway update a Virtual Network gateway. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. gatewayName is name of the gateway. Only the 'primary' +// gateway is supported. connectionEnvelope is definition of the gateway. +func (client AppServicePlansClient) UpdateVnetGateway(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (result VnetGateway, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "UpdateVnetGateway") + } + + req, err := client.UpdateVnetGatewayPreparer(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetGateway", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetGatewayPreparer prepares the UpdateVnetGateway request. +func (client AppServicePlansClient) UpdateVnetGatewayPreparer(resourceGroupName string, name string, vnetName string, gatewayName string, connectionEnvelope VnetGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(connectionEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetGatewaySender sends the UpdateVnetGateway request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateVnetGatewaySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetGatewayResponder handles the response to the UpdateVnetGateway request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateVnetGatewayResponder(resp *http.Response) (result VnetGateway, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateVnetRoute create or update a Virtual Network route in an App Service +// plan. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the App Service plan. vnetName is name of the +// Virtual Network. routeName is name of the Virtual Network route. route is +// definition of the Virtual Network route. +func (client AppServicePlansClient) UpdateVnetRoute(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (result VnetRoute, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.AppServicePlansClient", "UpdateVnetRoute") + } + + req, err := client.UpdateVnetRoutePreparer(resourceGroupName, name, vnetName, routeName, route) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateVnetRouteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure sending request") + return + } + + result, err = client.UpdateVnetRouteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppServicePlansClient", "UpdateVnetRoute", resp, "Failure responding to request") + } + + return +} + +// UpdateVnetRoutePreparer prepares the UpdateVnetRoute request. +func (client AppServicePlansClient) UpdateVnetRoutePreparer(resourceGroupName string, name string, vnetName string, routeName string, route VnetRoute) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vnetName": autorest.Encode("path", vnetName), + } + + const APIVersion = "2016-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", pathParameters), + autorest.WithJSON(route), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateVnetRouteSender sends the UpdateVnetRoute request. The method will close the +// http.Response Body if it receives an error. +func (client AppServicePlansClient) UpdateVnetRouteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateVnetRouteResponder handles the response to the UpdateVnetRoute request. The method always +// closes the http.Response Body. +func (client AppServicePlansClient) UpdateVnetRouteResponder(resp *http.Response) (result VnetRoute, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/certificates.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/certificates.go index da4812bd01..19628ccd82 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/certificates.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/certificates.go @@ -1,525 +1,525 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// CertificatesClient is the composite Swagger for WebSite Management Client -type CertificatesClient struct { - ManagementClient -} - -// NewCertificatesClient creates an instance of the CertificatesClient client. -func NewCertificatesClient(subscriptionID string) CertificatesClient { - return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCertificatesClientWithBaseURI creates an instance of the -// CertificatesClient client. -func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { - return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a certificate. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the certificate. certificateEnvelope is details of -// certificate, if it exists already. -func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "CreateOrUpdate") - } - - req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, certificateEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), - autorest.WithJSON(certificateEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a certificate. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the certificate. -func (client CertificatesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CertificatesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a certificate. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the certificate. -func (client CertificatesClient) Get(resourceGroupName string, name string) (result Certificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client CertificatesClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CertificatesClient) GetResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all certificates for a subscription. -func (client CertificatesClient) List() (result CertificateCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client CertificatesClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client CertificatesClient) ListResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client CertificatesClient) ListNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.CertificateCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup get all certificates in a resource group. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. -func (client CertificatesClient) ListByResourceGroup(resourceGroupName string) (result CertificateCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client CertificatesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client CertificatesClient) ListByResourceGroupResponder(resp *http.Response) (result CertificateCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client CertificatesClient) ListByResourceGroupNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { - req, err := lastResults.CertificateCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// Update create or update a certificate. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. name is name of the certificate. certificateEnvelope is details of -// certificate, if it exists already. -func (client CertificatesClient) Update(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Update") - } - - req, err := client.UpdatePreparer(resourceGroupName, name, certificateEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CertificatesClient) UpdatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), - autorest.WithJSON(certificateEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CertificatesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CertificatesClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// CertificatesClient is the composite Swagger for WebSite Management Client +type CertificatesClient struct { + ManagementClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the +// CertificatesClient client. +func NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a certificate. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. certificateEnvelope is details of +// certificate, if it exists already. +func (client CertificatesClient) CreateOrUpdate(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "CreateOrUpdate") + } + + req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, certificateEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithJSON(certificateEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a certificate. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. +func (client CertificatesClient) Delete(resourceGroupName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a certificate. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. +func (client CertificatesClient) Get(resourceGroupName string, name string) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CertificatesClient) GetResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all certificates for a subscription. +func (client CertificatesClient) List() (result CertificateCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificatesClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListResponder(resp *http.Response) (result CertificateCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { + req, err := lastResults.CertificateCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all certificates in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client CertificatesClient) ListByResourceGroup(resourceGroupName string) (result CertificateCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client CertificatesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client CertificatesClient) ListByResourceGroupResponder(resp *http.Response) (result CertificateCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client CertificatesClient) ListByResourceGroupNextResults(lastResults CertificateCollection) (result CertificateCollection, err error) { + req, err := lastResults.CertificateCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// Update create or update a certificate. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. name is name of the certificate. certificateEnvelope is details of +// certificate, if it exists already. +func (client CertificatesClient) Update(resourceGroupName string, name string, certificateEnvelope Certificate) (result Certificate, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.CertificatesClient", "Update") + } + + req, err := client.UpdatePreparer(resourceGroupName, name, certificateEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.CertificatesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CertificatesClient) UpdatePreparer(resourceGroupName string, name string, certificateEnvelope Certificate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}", pathParameters), + autorest.WithJSON(certificateEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client CertificatesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client CertificatesClient) UpdateResponder(resp *http.Response) (result Certificate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/client.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/client.go index 6c8e115791..379919c744 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/client.go @@ -1,876 +1,876 @@ -// Package web implements the Azure ARM Web service API version . -// -// Composite Swagger for WebSite Management Client -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Web - DefaultBaseURI = "https://management.azure.com" -) - -// ManagementClient is the base client for Web. -type ManagementClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the ManagementClient client. -func New(subscriptionID string) ManagementClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the ManagementClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CheckNameAvailability check if a resource name is available. -// -// request is name availability request. -func (client ManagementClient) CheckNameAvailability(request ResourceNameAvailabilityRequest) (result ResourceNameAvailability, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: request, - Constraints: []validation.Constraint{{Target: "request.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "CheckNameAvailability") - } - - req, err := client.CheckNameAvailabilityPreparer(request) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ManagementClient) CheckNameAvailabilityPreparer(request ResourceNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPublishingUser gets publishing user -func (client ManagementClient) GetPublishingUser() (result User, err error) { - req, err := client.GetPublishingUserPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", nil, "Failure preparing request") - return - } - - resp, err := client.GetPublishingUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure sending request") - return - } - - result, err = client.GetPublishingUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure responding to request") - } - - return -} - -// GetPublishingUserPreparer prepares the GetPublishingUser request. -func (client ManagementClient) GetPublishingUserPreparer() (*http.Request, error) { - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetPublishingUserSender sends the GetPublishingUser request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGeoRegions get a list of available geographical regions. -// -// sku is name of SKU used to filter the regions. linuxWorkersEnabled is -// specify true if you want to filter to only regions that support -// Linux workers. -func (client ManagementClient) ListGeoRegions(sku SkuName, linuxWorkersEnabled *bool) (result GeoRegionCollection, err error) { - req, err := client.ListGeoRegionsPreparer(sku, linuxWorkersEnabled) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing request") - return - } - - resp, err := client.ListGeoRegionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending request") - return - } - - result, err = client.ListGeoRegionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to request") - } - - return -} - -// ListGeoRegionsPreparer prepares the ListGeoRegions request. -func (client ManagementClient) ListGeoRegionsPreparer(sku SkuName, linuxWorkersEnabled *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(sku)) > 0 { - queryParameters["sku"] = autorest.Encode("query", sku) - } - if linuxWorkersEnabled != nil { - queryParameters["linuxWorkersEnabled"] = autorest.Encode("query", *linuxWorkersEnabled) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListGeoRegionsSender sends the ListGeoRegions request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListGeoRegionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListGeoRegionsResponder handles the response to the ListGeoRegions request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListGeoRegionsResponder(resp *http.Response) (result GeoRegionCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListGeoRegionsNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListGeoRegionsNextResults(lastResults GeoRegionCollection) (result GeoRegionCollection, err error) { - req, err := lastResults.GeoRegionCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListGeoRegionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending next results request") - } - - result, err = client.ListGeoRegionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to next results request") - } - - return -} - -// ListPremierAddOnOffers list all premier add-on offers. -func (client ManagementClient) ListPremierAddOnOffers() (result PremierAddOnOfferCollection, err error) { - req, err := client.ListPremierAddOnOffersPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing request") - return - } - - resp, err := client.ListPremierAddOnOffersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending request") - return - } - - result, err = client.ListPremierAddOnOffersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to request") - } - - return -} - -// ListPremierAddOnOffersPreparer prepares the ListPremierAddOnOffers request. -func (client ManagementClient) ListPremierAddOnOffersPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListPremierAddOnOffersSender sends the ListPremierAddOnOffers request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListPremierAddOnOffersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListPremierAddOnOffersResponder handles the response to the ListPremierAddOnOffers request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListPremierAddOnOffersResponder(resp *http.Response) (result PremierAddOnOfferCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPremierAddOnOffersNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListPremierAddOnOffersNextResults(lastResults PremierAddOnOfferCollection) (result PremierAddOnOfferCollection, err error) { - req, err := lastResults.PremierAddOnOfferCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListPremierAddOnOffersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending next results request") - } - - result, err = client.ListPremierAddOnOffersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to next results request") - } - - return -} - -// ListSkus list all SKUs. -func (client ManagementClient) ListSkus() (result SkuInfos, err error) { - req, err := client.ListSkusPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure sending request") - return - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure responding to request") - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client ManagementClient) ListSkusPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListSkusResponder(resp *http.Response) (result SkuInfos, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSourceControls gets the source controls available for Azure websites. -func (client ManagementClient) ListSourceControls() (result SourceControlCollection, err error) { - req, err := client.ListSourceControlsPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing request") - return - } - - resp, err := client.ListSourceControlsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending request") - return - } - - result, err = client.ListSourceControlsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to request") - } - - return -} - -// ListSourceControlsPreparer prepares the ListSourceControls request. -func (client ManagementClient) ListSourceControlsPreparer() (*http.Request, error) { - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSourceControlsSender sends the ListSourceControls request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ListSourceControlsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListSourceControlsResponder handles the response to the ListSourceControls request. The method always -// closes the http.Response Body. -func (client ManagementClient) ListSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSourceControlsNextResults retrieves the next set of results, if any. -func (client ManagementClient) ListSourceControlsNextResults(lastResults SourceControlCollection) (result SourceControlCollection, err error) { - req, err := lastResults.SourceControlCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSourceControlsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending next results request") - } - - result, err = client.ListSourceControlsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to next results request") - } - - return -} - -// Move move resources between resource groups. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. moveResourceEnvelope is object that represents the resource to -// move. -func (client ManagementClient) Move(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: moveResourceEnvelope, - Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Move") - } - - req, err := client.MovePreparer(resourceGroupName, moveResourceEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", nil, "Failure preparing request") - return - } - - resp, err := client.MoveSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure sending request") - return - } - - result, err = client.MoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure responding to request") - } - - return -} - -// MovePreparer prepares the Move request. -func (client ManagementClient) MovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), - autorest.WithJSON(moveResourceEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MoveSender sends the Move request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) MoveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MoveResponder handles the response to the Move request. The method always -// closes the http.Response Body. -func (client ManagementClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdatePublishingUser updates publishing user -// -// userDetails is details of publishing user -func (client ManagementClient) UpdatePublishingUser(userDetails User) (result User, err error) { - req, err := client.UpdatePublishingUserPreparer(userDetails) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", nil, "Failure preparing request") - return - } - - resp, err := client.UpdatePublishingUserSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure sending request") - return - } - - result, err = client.UpdatePublishingUserResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure responding to request") - } - - return -} - -// UpdatePublishingUserPreparer prepares the UpdatePublishingUser request. -func (client ManagementClient) UpdatePublishingUserPreparer(userDetails User) (*http.Request, error) { - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), - autorest.WithJSON(userDetails), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSourceControl updates source control token -// -// sourceControlType is type of source control requestMessage is source control -// token information -func (client ManagementClient) UpdateSourceControl(sourceControlType string, requestMessage SourceControl) (result SourceControl, err error) { - req, err := client.UpdateSourceControlPreparer(sourceControlType, requestMessage) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSourceControlSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure sending request") - return - } - - result, err = client.UpdateSourceControlResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure responding to request") - } - - return -} - -// UpdateSourceControlPreparer prepares the UpdateSourceControl request. -func (client ManagementClient) UpdateSourceControlPreparer(sourceControlType string, requestMessage SourceControl) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "sourceControlType": autorest.Encode("path", sourceControlType), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), - autorest.WithJSON(requestMessage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Validate validate if a resource can be created. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. validateRequest is request with the resources to validate. -func (client ManagementClient) Validate(resourceGroupName string, validateRequest ValidateRequest) (result ValidateResponse, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: validateRequest, - Constraints: []validation.Constraint{{Target: "validateRequest.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "validateRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "validateRequest.ValidateProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Validate") - } - - req, err := client.ValidatePreparer(resourceGroupName, validateRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure sending request") - return - } - - result, err = client.ValidateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure responding to request") - } - - return -} - -// ValidatePreparer prepares the Validate request. -func (client ManagementClient) ValidatePreparer(resourceGroupName string, validateRequest ValidateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate", pathParameters), - autorest.WithJSON(validateRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateSender sends the Validate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ValidateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateResponder handles the response to the Validate request. The method always -// closes the http.Response Body. -func (client ManagementClient) ValidateResponder(resp *http.Response) (result ValidateResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateMove validate whether a resource can be moved. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. moveResourceEnvelope is object that represents the resource to -// move. -func (client ManagementClient) ValidateMove(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: moveResourceEnvelope, - Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "ValidateMove") - } - - req, err := client.ValidateMovePreparer(resourceGroupName, moveResourceEnvelope) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateMoveSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure sending request") - return - } - - result, err = client.ValidateMoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure responding to request") - } - - return -} - -// ValidateMovePreparer prepares the ValidateMove request. -func (client ManagementClient) ValidateMovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources", pathParameters), - autorest.WithJSON(moveResourceEnvelope), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ValidateMoveSender sends the ValidateMove request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ValidateMoveSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ValidateMoveResponder handles the response to the ValidateMove request. The method always -// closes the http.Response Body. -func (client ManagementClient) ValidateMoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +// Package web implements the Azure ARM Web service API version . +// +// Composite Swagger for WebSite Management Client +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Web + DefaultBaseURI = "https://management.azure.com" +) + +// ManagementClient is the base client for Web. +type ManagementClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the ManagementClient client. +func New(subscriptionID string) ManagementClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the ManagementClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckNameAvailability check if a resource name is available. +// +// request is name availability request. +func (client ManagementClient) CheckNameAvailability(request ResourceNameAvailabilityRequest) (result ResourceNameAvailability, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "CheckNameAvailability") + } + + req, err := client.CheckNameAvailabilityPreparer(request) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ManagementClient) CheckNameAvailabilityPreparer(request ResourceNameAvailabilityRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Response) (result ResourceNameAvailability, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPublishingUser gets publishing user +func (client ManagementClient) GetPublishingUser() (result User, err error) { + req, err := client.GetPublishingUserPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", nil, "Failure preparing request") + return + } + + resp, err := client.GetPublishingUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure sending request") + return + } + + result, err = client.GetPublishingUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "GetPublishingUser", resp, "Failure responding to request") + } + + return +} + +// GetPublishingUserPreparer prepares the GetPublishingUser request. +func (client ManagementClient) GetPublishingUserPreparer() (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetPublishingUserSender sends the GetPublishingUser request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetPublishingUserSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetPublishingUserResponder handles the response to the GetPublishingUser request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetPublishingUserResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListGeoRegions get a list of available geographical regions. +// +// sku is name of SKU used to filter the regions. linuxWorkersEnabled is +// specify true if you want to filter to only regions that support +// Linux workers. +func (client ManagementClient) ListGeoRegions(sku SkuName, linuxWorkersEnabled *bool) (result GeoRegionCollection, err error) { + req, err := client.ListGeoRegionsPreparer(sku, linuxWorkersEnabled) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing request") + return + } + + resp, err := client.ListGeoRegionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending request") + return + } + + result, err = client.ListGeoRegionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to request") + } + + return +} + +// ListGeoRegionsPreparer prepares the ListGeoRegions request. +func (client ManagementClient) ListGeoRegionsPreparer(sku SkuName, linuxWorkersEnabled *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(sku)) > 0 { + queryParameters["sku"] = autorest.Encode("query", sku) + } + if linuxWorkersEnabled != nil { + queryParameters["linuxWorkersEnabled"] = autorest.Encode("query", *linuxWorkersEnabled) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListGeoRegionsSender sends the ListGeoRegions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListGeoRegionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListGeoRegionsResponder handles the response to the ListGeoRegions request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListGeoRegionsResponder(resp *http.Response) (result GeoRegionCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListGeoRegionsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListGeoRegionsNextResults(lastResults GeoRegionCollection) (result GeoRegionCollection, err error) { + req, err := lastResults.GeoRegionCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListGeoRegionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure sending next results request") + } + + result, err = client.ListGeoRegionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListGeoRegions", resp, "Failure responding to next results request") + } + + return +} + +// ListPremierAddOnOffers list all premier add-on offers. +func (client ManagementClient) ListPremierAddOnOffers() (result PremierAddOnOfferCollection, err error) { + req, err := client.ListPremierAddOnOffersPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing request") + return + } + + resp, err := client.ListPremierAddOnOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending request") + return + } + + result, err = client.ListPremierAddOnOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to request") + } + + return +} + +// ListPremierAddOnOffersPreparer prepares the ListPremierAddOnOffers request. +func (client ManagementClient) ListPremierAddOnOffersPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListPremierAddOnOffersSender sends the ListPremierAddOnOffers request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListPremierAddOnOffersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListPremierAddOnOffersResponder handles the response to the ListPremierAddOnOffers request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListPremierAddOnOffersResponder(resp *http.Response) (result PremierAddOnOfferCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPremierAddOnOffersNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListPremierAddOnOffersNextResults(lastResults PremierAddOnOfferCollection) (result PremierAddOnOfferCollection, err error) { + req, err := lastResults.PremierAddOnOfferCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListPremierAddOnOffersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure sending next results request") + } + + result, err = client.ListPremierAddOnOffersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListPremierAddOnOffers", resp, "Failure responding to next results request") + } + + return +} + +// ListSkus list all SKUs. +func (client ManagementClient) ListSkus() (result SkuInfos, err error) { + req, err := client.ListSkusPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client ManagementClient) ListSkusPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListSkusResponder(resp *http.Response) (result SkuInfos, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSourceControls gets the source controls available for Azure websites. +func (client ManagementClient) ListSourceControls() (result SourceControlCollection, err error) { + req, err := client.ListSourceControlsPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing request") + return + } + + resp, err := client.ListSourceControlsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending request") + return + } + + result, err = client.ListSourceControlsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to request") + } + + return +} + +// ListSourceControlsPreparer prepares the ListSourceControls request. +func (client ManagementClient) ListSourceControlsPreparer() (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/sourcecontrols"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSourceControlsSender sends the ListSourceControls request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ListSourceControlsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListSourceControlsResponder handles the response to the ListSourceControls request. The method always +// closes the http.Response Body. +func (client ManagementClient) ListSourceControlsResponder(resp *http.Response) (result SourceControlCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSourceControlsNextResults retrieves the next set of results, if any. +func (client ManagementClient) ListSourceControlsNextResults(lastResults SourceControlCollection) (result SourceControlCollection, err error) { + req, err := lastResults.SourceControlCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSourceControlsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure sending next results request") + } + + result, err = client.ListSourceControlsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ListSourceControls", resp, "Failure responding to next results request") + } + + return +} + +// Move move resources between resource groups. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. moveResourceEnvelope is object that represents the resource to +// move. +func (client ManagementClient) Move(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: moveResourceEnvelope, + Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Move") + } + + req, err := client.MovePreparer(resourceGroupName, moveResourceEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", nil, "Failure preparing request") + return + } + + resp, err := client.MoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure sending request") + return + } + + result, err = client.MoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Move", resp, "Failure responding to request") + } + + return +} + +// MovePreparer prepares the Move request. +func (client ManagementClient) MovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources", pathParameters), + autorest.WithJSON(moveResourceEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MoveSender sends the Move request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) MoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MoveResponder handles the response to the Move request. The method always +// closes the http.Response Body. +func (client ManagementClient) MoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdatePublishingUser updates publishing user +// +// userDetails is details of publishing user +func (client ManagementClient) UpdatePublishingUser(userDetails User) (result User, err error) { + req, err := client.UpdatePublishingUserPreparer(userDetails) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePublishingUserSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure sending request") + return + } + + result, err = client.UpdatePublishingUserResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdatePublishingUser", resp, "Failure responding to request") + } + + return +} + +// UpdatePublishingUserPreparer prepares the UpdatePublishingUser request. +func (client ManagementClient) UpdatePublishingUserPreparer(userDetails User) (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/publishingUsers/web"), + autorest.WithJSON(userDetails), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdatePublishingUserSender sends the UpdatePublishingUser request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdatePublishingUserSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdatePublishingUserResponder handles the response to the UpdatePublishingUser request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdatePublishingUserResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSourceControl updates source control token +// +// sourceControlType is type of source control requestMessage is source control +// token information +func (client ManagementClient) UpdateSourceControl(sourceControlType string, requestMessage SourceControl) (result SourceControl, err error) { + req, err := client.UpdateSourceControlPreparer(sourceControlType, requestMessage) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSourceControlSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure sending request") + return + } + + result, err = client.UpdateSourceControlResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "UpdateSourceControl", resp, "Failure responding to request") + } + + return +} + +// UpdateSourceControlPreparer prepares the UpdateSourceControl request. +func (client ManagementClient) UpdateSourceControlPreparer(sourceControlType string, requestMessage SourceControl) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "sourceControlType": autorest.Encode("path", sourceControlType), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Web/sourcecontrols/{sourceControlType}", pathParameters), + autorest.WithJSON(requestMessage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSourceControlSender sends the UpdateSourceControl request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateSourceControlSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSourceControlResponder handles the response to the UpdateSourceControl request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateSourceControlResponder(resp *http.Response) (result SourceControl, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate validate if a resource can be created. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. validateRequest is request with the resources to validate. +func (client ManagementClient) Validate(resourceGroupName string, validateRequest ValidateRequest) (result ValidateResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: validateRequest, + Constraints: []validation.Constraint{{Target: "validateRequest.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "validateRequest.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "validateRequest.ValidateProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "validateRequest.ValidateProperties.Capacity", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "Validate") + } + + req, err := client.ValidatePreparer(resourceGroupName, validateRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client ManagementClient) ValidatePreparer(resourceGroupName string, validateRequest ValidateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate", pathParameters), + autorest.WithJSON(validateRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ValidateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client ManagementClient) ValidateResponder(resp *http.Response) (result ValidateResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateMove validate whether a resource can be moved. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. moveResourceEnvelope is object that represents the resource to +// move. +func (client ManagementClient) ValidateMove(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: moveResourceEnvelope, + Constraints: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "moveResourceEnvelope.TargetResourceGroup", Name: validation.Pattern, Rule: ` ^[-\w\._\(\)]+[^\.]$`, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.ManagementClient", "ValidateMove") + } + + req, err := client.ValidateMovePreparer(resourceGroupName, moveResourceEnvelope) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateMoveSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure sending request") + return + } + + result, err = client.ValidateMoveResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ManagementClient", "ValidateMove", resp, "Failure responding to request") + } + + return +} + +// ValidateMovePreparer prepares the ValidateMove request. +func (client ManagementClient) ValidateMovePreparer(resourceGroupName string, moveResourceEnvelope CsmMoveResourceEnvelope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/validateMoveResources", pathParameters), + autorest.WithJSON(moveResourceEnvelope), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ValidateMoveSender sends the ValidateMove request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ValidateMoveSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ValidateMoveResponder handles the response to the ValidateMove request. The method always +// closes the http.Response Body. +func (client ManagementClient) ValidateMoveResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/deletedwebapps.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/deletedwebapps.go index 4579533b9e..7ea24e8ab6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/deletedwebapps.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/deletedwebapps.go @@ -1,225 +1,225 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DeletedWebAppsClient is the composite Swagger for WebSite Management Client -type DeletedWebAppsClient struct { - ManagementClient -} - -// NewDeletedWebAppsClient creates an instance of the DeletedWebAppsClient -// client. -func NewDeletedWebAppsClient(subscriptionID string) DeletedWebAppsClient { - return NewDeletedWebAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDeletedWebAppsClientWithBaseURI creates an instance of the -// DeletedWebAppsClient client. -func NewDeletedWebAppsClientWithBaseURI(baseURI string, subscriptionID string) DeletedWebAppsClient { - return DeletedWebAppsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get all deleted apps for a subscription. -func (client DeletedWebAppsClient) List() (result DeletedWebAppCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DeletedWebAppsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedWebAppsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DeletedWebAppsClient) ListResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DeletedWebAppsClient) ListNextResults(lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { - req, err := lastResults.DeletedWebAppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup gets deleted web apps in subscription. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. -func (client DeletedWebAppsClient) ListByResourceGroup(resourceGroupName string) (result DeletedWebAppCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DeletedWebAppsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DeletedWebAppsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/deletedSites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedWebAppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DeletedWebAppsClient) ListByResourceGroupResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client DeletedWebAppsClient) ListByResourceGroupNextResults(lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { - req, err := lastResults.DeletedWebAppCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DeletedWebAppsClient is the composite Swagger for WebSite Management Client +type DeletedWebAppsClient struct { + ManagementClient +} + +// NewDeletedWebAppsClient creates an instance of the DeletedWebAppsClient +// client. +func NewDeletedWebAppsClient(subscriptionID string) DeletedWebAppsClient { + return NewDeletedWebAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeletedWebAppsClientWithBaseURI creates an instance of the +// DeletedWebAppsClient client. +func NewDeletedWebAppsClientWithBaseURI(baseURI string, subscriptionID string) DeletedWebAppsClient { + return DeletedWebAppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get all deleted apps for a subscription. +func (client DeletedWebAppsClient) List() (result DeletedWebAppCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DeletedWebAppsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DeletedWebAppsClient) ListNextResults(lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.DeletedWebAppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup gets deleted web apps in subscription. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client DeletedWebAppsClient) ListByResourceGroup(resourceGroupName string) (result DeletedWebAppCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DeletedWebAppsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DeletedWebAppsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/deletedSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedWebAppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DeletedWebAppsClient) ListByResourceGroupResponder(resp *http.Response) (result DeletedWebAppCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client DeletedWebAppsClient) ListByResourceGroupNextResults(lastResults DeletedWebAppCollection) (result DeletedWebAppCollection, err error) { + req, err := lastResults.DeletedWebAppCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DeletedWebAppsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/domains.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/domains.go index d0aa6aaaa0..fba3c1d1fe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/domains.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/domains.go @@ -1,1151 +1,1151 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// DomainsClient is the composite Swagger for WebSite Management Client -type DomainsClient struct { - ManagementClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(subscriptionID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient client. -func NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckAvailability check if a domain is available for registration. -// -// identifier is name of the domain. -func (client DomainsClient) CheckAvailability(identifier NameIdentifier) (result DomainAvailablilityCheckResult, err error) { - req, err := client.CheckAvailabilityPreparer(identifier) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure responding to request") - } - - return -} - -// CheckAvailabilityPreparer prepares the CheckAvailability request. -func (client DomainsClient) CheckAvailabilityPreparer(identifier NameIdentifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability", pathParameters), - autorest.WithJSON(identifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckAvailabilitySender sends the CheckAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always -// closes the http.Response Body. -func (client DomainsClient) CheckAvailabilityResponder(resp *http.Response) (result DomainAvailablilityCheckResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a domain. This method may poll for -// completion. Polling can be canceled by passing the cancel channel argument. -// The channel will be used to cancel polling and any outstanding HTTP -// requests. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of the domain. domain is domain registration -// information. -func (client DomainsClient) CreateOrUpdate(resourceGroupName string, domainName string, domain Domain, cancel <-chan struct{}) (<-chan Domain, <-chan error) { - resultChan := make(chan Domain, 1) - errChan := make(chan error, 1) - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, - {TargetValue: domainName, - Constraints: []validation.Constraint{{Target: "domainName", Name: validation.Pattern, Rule: `[a-zA-Z0-9][a-zA-Z0-9\.-]+`, Chain: nil}}}, - {TargetValue: domain, - Constraints: []validation.Constraint{{Target: "domain.DomainProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactAdmin.Email", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.NameLast", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactAdmin.Phone", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactBilling", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactBilling.Email", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.NameLast", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactBilling.Phone", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactRegistrant", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactRegistrant.Email", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.NameLast", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactRegistrant.Phone", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactTech", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "domain.DomainProperties.ContactTech.Email", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.NameLast", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "domain.DomainProperties.ContactTech.Phone", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - errChan <- validation.NewErrorWithValidationError(err, "web.DomainsClient", "CreateOrUpdate") - close(errChan) - close(resultChan) - return resultChan, errChan - } - - go func() { - var err error - var result Domain - defer func() { - resultChan <- result - errChan <- err - close(resultChan) - close(errChan) - }() - req, err := client.CreateOrUpdatePreparer(resourceGroupName, domainName, domain, cancel) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", resp, "Failure responding to request") - } - }() - return resultChan, errChan -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainsClient) CreateOrUpdatePreparer(resourceGroupName string, domainName string, domain Domain, cancel <-chan struct{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), - autorest.WithJSON(domain), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{Cancel: cancel}) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, - req, - azure.DoPollForAsynchronous(client.PollingDelay)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateOwnershipIdentifier creates an ownership identifier for a -// domain or updates identifier details for an existing identifer -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of domain. name is name of identifier. -// domainOwnershipIdentifier is a JSON representation of the domain ownership -// properties. -func (client DomainsClient) CreateOrUpdateOwnershipIdentifier(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier") - } - - req, err := client.CreateOrUpdateOwnershipIdentifierPreparer(resourceGroupName, domainName, name, domainOwnershipIdentifier) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdateOwnershipIdentifierPreparer prepares the CreateOrUpdateOwnershipIdentifier request. -func (client DomainsClient) CreateOrUpdateOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), - autorest.WithJSON(domainOwnershipIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateOrUpdateOwnershipIdentifierSender sends the CreateOrUpdateOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) CreateOrUpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateOrUpdateOwnershipIdentifierResponder handles the response to the CreateOrUpdateOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client DomainsClient) CreateOrUpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a domain. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of the domain. forceHardDeleteDomain is specify -// true to delete the domain immediately. The default is -// false which deletes the domain after 24 hours. -func (client DomainsClient) Delete(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "Delete") - } - - req, err := client.DeletePreparer(resourceGroupName, domainName, forceHardDeleteDomain) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainsClient) DeletePreparer(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if forceHardDeleteDomain != nil { - queryParameters["forceHardDeleteDomain"] = autorest.Encode("query", *forceHardDeleteDomain) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteOwnershipIdentifier delete ownership identifier for domain -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of domain. name is name of identifier. -func (client DomainsClient) DeleteOwnershipIdentifier(resourceGroupName string, domainName string, name string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "DeleteOwnershipIdentifier") - } - - req, err := client.DeleteOwnershipIdentifierPreparer(resourceGroupName, domainName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteOwnershipIdentifierSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.DeleteOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// DeleteOwnershipIdentifierPreparer prepares the DeleteOwnershipIdentifier request. -func (client DomainsClient) DeleteOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteOwnershipIdentifierSender sends the DeleteOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) DeleteOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteOwnershipIdentifierResponder handles the response to the DeleteOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client DomainsClient) DeleteOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a domain. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of the domain. -func (client DomainsClient) Get(resourceGroupName string, domainName string) (result Domain, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "Get") - } - - req, err := client.GetPreparer(resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetControlCenterSsoRequest generate a single sign-on request for the domain -// management portal. -func (client DomainsClient) GetControlCenterSsoRequest() (result DomainControlCenterSsoRequest, err error) { - req, err := client.GetControlCenterSsoRequestPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", nil, "Failure preparing request") - return - } - - resp, err := client.GetControlCenterSsoRequestSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure sending request") - return - } - - result, err = client.GetControlCenterSsoRequestResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure responding to request") - } - - return -} - -// GetControlCenterSsoRequestPreparer prepares the GetControlCenterSsoRequest request. -func (client DomainsClient) GetControlCenterSsoRequestPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetControlCenterSsoRequestSender sends the GetControlCenterSsoRequest request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) GetControlCenterSsoRequestSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetControlCenterSsoRequestResponder handles the response to the GetControlCenterSsoRequest request. The method always -// closes the http.Response Body. -func (client DomainsClient) GetControlCenterSsoRequestResponder(resp *http.Response) (result DomainControlCenterSsoRequest, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetOwnershipIdentifier get ownership identifier for domain -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of domain. name is name of identifier. -func (client DomainsClient) GetOwnershipIdentifier(resourceGroupName string, domainName string, name string) (result DomainOwnershipIdentifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "GetOwnershipIdentifier") - } - - req, err := client.GetOwnershipIdentifierPreparer(resourceGroupName, domainName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.GetOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.GetOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// GetOwnershipIdentifierPreparer prepares the GetOwnershipIdentifier request. -func (client DomainsClient) GetOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetOwnershipIdentifierSender sends the GetOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) GetOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetOwnershipIdentifierResponder handles the response to the GetOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client DomainsClient) GetOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all domains in a subscription. -func (client DomainsClient) List() (result DomainCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DomainsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListResponder(resp *http.Response) (result DomainCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client DomainsClient) ListNextResults(lastResults DomainCollection) (result DomainCollection, err error) { - req, err := lastResults.DomainCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListByResourceGroup get all domains in a resource group. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. -func (client DomainsClient) ListByResourceGroup(resourceGroupName string) (result DomainCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "ListByResourceGroup") - } - - req, err := client.ListByResourceGroupPreparer(resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroupNextResults retrieves the next set of results, if any. -func (client DomainsClient) ListByResourceGroupNextResults(lastResults DomainCollection) (result DomainCollection, err error) { - req, err := lastResults.DomainCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending next results request") - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to next results request") - } - - return -} - -// ListOwnershipIdentifiers lists domain ownership identifiers. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of domain. -func (client DomainsClient) ListOwnershipIdentifiers(resourceGroupName string, domainName string) (result DomainOwnershipIdentifierCollection, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "ListOwnershipIdentifiers") - } - - req, err := client.ListOwnershipIdentifiersPreparer(resourceGroupName, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing request") - return - } - - resp, err := client.ListOwnershipIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending request") - return - } - - result, err = client.ListOwnershipIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to request") - } - - return -} - -// ListOwnershipIdentifiersPreparer prepares the ListOwnershipIdentifiers request. -func (client DomainsClient) ListOwnershipIdentifiersPreparer(resourceGroupName string, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListOwnershipIdentifiersSender sends the ListOwnershipIdentifiers request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListOwnershipIdentifiersResponder handles the response to the ListOwnershipIdentifiers request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListOwnershipIdentifiersResponder(resp *http.Response) (result DomainOwnershipIdentifierCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOwnershipIdentifiersNextResults retrieves the next set of results, if any. -func (client DomainsClient) ListOwnershipIdentifiersNextResults(lastResults DomainOwnershipIdentifierCollection) (result DomainOwnershipIdentifierCollection, err error) { - req, err := lastResults.DomainOwnershipIdentifierCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListOwnershipIdentifiersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending next results request") - } - - result, err = client.ListOwnershipIdentifiersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to next results request") - } - - return -} - -// ListRecommendations get domain name recommendations based on keywords. -// -// parameters is search parameters for domain name recommendations. -func (client DomainsClient) ListRecommendations(parameters DomainRecommendationSearchParameters) (result NameIdentifierCollection, err error) { - req, err := client.ListRecommendationsPreparer(parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing request") - return - } - - resp, err := client.ListRecommendationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending request") - return - } - - result, err = client.ListRecommendationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to request") - } - - return -} - -// ListRecommendationsPreparer prepares the ListRecommendations request. -func (client DomainsClient) ListRecommendationsPreparer(parameters DomainRecommendationSearchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListRecommendationsSender sends the ListRecommendations request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListRecommendationsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListRecommendationsResponder handles the response to the ListRecommendations request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListRecommendationsResponder(resp *http.Response) (result NameIdentifierCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRecommendationsNextResults retrieves the next set of results, if any. -func (client DomainsClient) ListRecommendationsNextResults(lastResults NameIdentifierCollection) (result NameIdentifierCollection, err error) { - req, err := lastResults.NameIdentifierCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListRecommendationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending next results request") - } - - result, err = client.ListRecommendationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to next results request") - } - - return -} - -// UpdateOwnershipIdentifier creates an ownership identifier for a domain or -// updates identifier details for an existing identifer -// -// resourceGroupName is name of the resource group to which the resource -// belongs. domainName is name of domain. name is name of identifier. -// domainOwnershipIdentifier is a JSON representation of the domain ownership -// properties. -func (client DomainsClient) UpdateOwnershipIdentifier(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "UpdateOwnershipIdentifier") - } - - req, err := client.UpdateOwnershipIdentifierPreparer(resourceGroupName, domainName, name, domainOwnershipIdentifier) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateOwnershipIdentifierSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure sending request") - return - } - - result, err = client.UpdateOwnershipIdentifierResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure responding to request") - } - - return -} - -// UpdateOwnershipIdentifierPreparer prepares the UpdateOwnershipIdentifier request. -func (client DomainsClient) UpdateOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), - autorest.WithJSON(domainOwnershipIdentifier), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateOwnershipIdentifierSender sends the UpdateOwnershipIdentifier request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) UpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateOwnershipIdentifierResponder handles the response to the UpdateOwnershipIdentifier request. The method always -// closes the http.Response Body. -func (client DomainsClient) UpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// DomainsClient is the composite Swagger for WebSite Management Client +type DomainsClient struct { + ManagementClient +} + +// NewDomainsClient creates an instance of the DomainsClient client. +func NewDomainsClient(subscriptionID string) DomainsClient { + return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainsClientWithBaseURI creates an instance of the DomainsClient client. +func NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { + return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckAvailability check if a domain is available for registration. +// +// identifier is name of the domain. +func (client DomainsClient) CheckAvailability(identifier NameIdentifier) (result DomainAvailablilityCheckResult, err error) { + req, err := client.CheckAvailabilityPreparer(identifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CheckAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckAvailabilityPreparer prepares the CheckAvailability request. +func (client DomainsClient) CheckAvailabilityPreparer(identifier NameIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability", pathParameters), + autorest.WithJSON(identifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckAvailabilitySender sends the CheckAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always +// closes the http.Response Body. +func (client DomainsClient) CheckAvailabilityResponder(resp *http.Response) (result DomainAvailablilityCheckResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a domain. This method may poll for +// completion. Polling can be canceled by passing the cancel channel argument. +// The channel will be used to cancel polling and any outstanding HTTP +// requests. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of the domain. domain is domain registration +// information. +func (client DomainsClient) CreateOrUpdate(resourceGroupName string, domainName string, domain Domain, cancel <-chan struct{}) (<-chan Domain, <-chan error) { + resultChan := make(chan Domain, 1) + errChan := make(chan error, 1) + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}, + {TargetValue: domainName, + Constraints: []validation.Constraint{{Target: "domainName", Name: validation.Pattern, Rule: `[a-zA-Z0-9][a-zA-Z0-9\.-]+`, Chain: nil}}}, + {TargetValue: domain, + Constraints: []validation.Constraint{{Target: "domain.DomainProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactAdmin.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactAdmin.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactBilling", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactBilling.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactBilling.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactBilling.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactRegistrant", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactRegistrant.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactRegistrant.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactTech", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "domain.DomainProperties.ContactTech.AddressMailing.Address1", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.City", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.Country", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.PostalCode", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.AddressMailing.State", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "domain.DomainProperties.ContactTech.Email", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.NameFirst", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.NameLast", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "domain.DomainProperties.ContactTech.Phone", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + errChan <- validation.NewErrorWithValidationError(err, "web.DomainsClient", "CreateOrUpdate") + close(errChan) + close(resultChan) + return resultChan, errChan + } + + go func() { + var err error + var result Domain + defer func() { + resultChan <- result + errChan <- err + close(resultChan) + close(errChan) + }() + req, err := client.CreateOrUpdatePreparer(resourceGroupName, domainName, domain, cancel) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + }() + return resultChan, errChan +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainsClient) CreateOrUpdatePreparer(resourceGroupName string, domainName string, domain Domain, cancel <-chan struct{}) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithJSON(domain), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{Cancel: cancel}) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, + req, + azure.DoPollForAsynchronous(client.PollingDelay)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateOwnershipIdentifier creates an ownership identifier for a +// domain or updates identifier details for an existing identifer +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +// domainOwnershipIdentifier is a JSON representation of the domain ownership +// properties. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifier(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier") + } + + req, err := client.CreateOrUpdateOwnershipIdentifierPreparer(resourceGroupName, domainName, name, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "CreateOrUpdateOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdateOwnershipIdentifierPreparer prepares the CreateOrUpdateOwnershipIdentifier request. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateOrUpdateOwnershipIdentifierSender sends the CreateOrUpdateOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateOrUpdateOwnershipIdentifierResponder handles the response to the CreateOrUpdateOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a domain. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of the domain. forceHardDeleteDomain is specify +// true to delete the domain immediately. The default is +// false which deletes the domain after 24 hours. +func (client DomainsClient) Delete(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "Delete") + } + + req, err := client.DeletePreparer(resourceGroupName, domainName, forceHardDeleteDomain) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DomainsClient) DeletePreparer(resourceGroupName string, domainName string, forceHardDeleteDomain *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceHardDeleteDomain != nil { + queryParameters["forceHardDeleteDomain"] = autorest.Encode("query", *forceHardDeleteDomain) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeleteOwnershipIdentifier delete ownership identifier for domain +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +func (client DomainsClient) DeleteOwnershipIdentifier(resourceGroupName string, domainName string, name string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "DeleteOwnershipIdentifier") + } + + req, err := client.DeleteOwnershipIdentifierPreparer(resourceGroupName, domainName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteOwnershipIdentifierSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.DeleteOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "DeleteOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// DeleteOwnershipIdentifierPreparer prepares the DeleteOwnershipIdentifier request. +func (client DomainsClient) DeleteOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteOwnershipIdentifierSender sends the DeleteOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) DeleteOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteOwnershipIdentifierResponder handles the response to the DeleteOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) DeleteOwnershipIdentifierResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a domain. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of the domain. +func (client DomainsClient) Get(resourceGroupName string, domainName string) (result Domain, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "Get") + } + + req, err := client.GetPreparer(resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainsClient) GetPreparer(resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetControlCenterSsoRequest generate a single sign-on request for the domain +// management portal. +func (client DomainsClient) GetControlCenterSsoRequest() (result DomainControlCenterSsoRequest, err error) { + req, err := client.GetControlCenterSsoRequestPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", nil, "Failure preparing request") + return + } + + resp, err := client.GetControlCenterSsoRequestSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure sending request") + return + } + + result, err = client.GetControlCenterSsoRequestResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetControlCenterSsoRequest", resp, "Failure responding to request") + } + + return +} + +// GetControlCenterSsoRequestPreparer prepares the GetControlCenterSsoRequest request. +func (client DomainsClient) GetControlCenterSsoRequestPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetControlCenterSsoRequestSender sends the GetControlCenterSsoRequest request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetControlCenterSsoRequestSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetControlCenterSsoRequestResponder handles the response to the GetControlCenterSsoRequest request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetControlCenterSsoRequestResponder(resp *http.Response) (result DomainControlCenterSsoRequest, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOwnershipIdentifier get ownership identifier for domain +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +func (client DomainsClient) GetOwnershipIdentifier(resourceGroupName string, domainName string, name string) (result DomainOwnershipIdentifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "GetOwnershipIdentifier") + } + + req, err := client.GetOwnershipIdentifierPreparer(resourceGroupName, domainName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.GetOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.GetOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "GetOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// GetOwnershipIdentifierPreparer prepares the GetOwnershipIdentifier request. +func (client DomainsClient) GetOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetOwnershipIdentifierSender sends the GetOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetOwnershipIdentifierResponder handles the response to the GetOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all domains in a subscription. +func (client DomainsClient) List() (result DomainCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DomainsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListResponder(resp *http.Response) (result DomainCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListNextResults(lastResults DomainCollection) (result DomainCollection, err error) { + req, err := lastResults.DomainCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListByResourceGroup get all domains in a resource group. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. +func (client DomainsClient) ListByResourceGroup(resourceGroupName string) (result DomainCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "ListByResourceGroup") + } + + req, err := client.ListByResourceGroupPreparer(resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DomainsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroupNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListByResourceGroupNextResults(lastResults DomainCollection) (result DomainCollection, err error) { + req, err := lastResults.DomainCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure sending next results request") + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListByResourceGroup", resp, "Failure responding to next results request") + } + + return +} + +// ListOwnershipIdentifiers lists domain ownership identifiers. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. +func (client DomainsClient) ListOwnershipIdentifiers(resourceGroupName string, domainName string) (result DomainOwnershipIdentifierCollection, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "ListOwnershipIdentifiers") + } + + req, err := client.ListOwnershipIdentifiersPreparer(resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing request") + return + } + + resp, err := client.ListOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending request") + return + } + + result, err = client.ListOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to request") + } + + return +} + +// ListOwnershipIdentifiersPreparer prepares the ListOwnershipIdentifiers request. +func (client DomainsClient) ListOwnershipIdentifiersPreparer(resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListOwnershipIdentifiersSender sends the ListOwnershipIdentifiers request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListOwnershipIdentifiersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListOwnershipIdentifiersResponder handles the response to the ListOwnershipIdentifiers request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListOwnershipIdentifiersResponder(resp *http.Response) (result DomainOwnershipIdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOwnershipIdentifiersNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListOwnershipIdentifiersNextResults(lastResults DomainOwnershipIdentifierCollection) (result DomainOwnershipIdentifierCollection, err error) { + req, err := lastResults.DomainOwnershipIdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListOwnershipIdentifiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure sending next results request") + } + + result, err = client.ListOwnershipIdentifiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListOwnershipIdentifiers", resp, "Failure responding to next results request") + } + + return +} + +// ListRecommendations get domain name recommendations based on keywords. +// +// parameters is search parameters for domain name recommendations. +func (client DomainsClient) ListRecommendations(parameters DomainRecommendationSearchParameters) (result NameIdentifierCollection, err error) { + req, err := client.ListRecommendationsPreparer(parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing request") + return + } + + resp, err := client.ListRecommendationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending request") + return + } + + result, err = client.ListRecommendationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to request") + } + + return +} + +// ListRecommendationsPreparer prepares the ListRecommendations request. +func (client DomainsClient) ListRecommendationsPreparer(parameters DomainRecommendationSearchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRecommendationsSender sends the ListRecommendations request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListRecommendationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRecommendationsResponder handles the response to the ListRecommendations request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListRecommendationsResponder(resp *http.Response) (result NameIdentifierCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRecommendationsNextResults retrieves the next set of results, if any. +func (client DomainsClient) ListRecommendationsNextResults(lastResults NameIdentifierCollection) (result NameIdentifierCollection, err error) { + req, err := lastResults.NameIdentifierCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListRecommendationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure sending next results request") + } + + result, err = client.ListRecommendationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "ListRecommendations", resp, "Failure responding to next results request") + } + + return +} + +// UpdateOwnershipIdentifier creates an ownership identifier for a domain or +// updates identifier details for an existing identifer +// +// resourceGroupName is name of the resource group to which the resource +// belongs. domainName is name of domain. name is name of identifier. +// domainOwnershipIdentifier is a JSON representation of the domain ownership +// properties. +func (client DomainsClient) UpdateOwnershipIdentifier(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (result DomainOwnershipIdentifier, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.DomainsClient", "UpdateOwnershipIdentifier") + } + + req, err := client.UpdateOwnershipIdentifierPreparer(resourceGroupName, domainName, name, domainOwnershipIdentifier) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateOwnershipIdentifierSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure sending request") + return + } + + result, err = client.UpdateOwnershipIdentifierResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.DomainsClient", "UpdateOwnershipIdentifier", resp, "Failure responding to request") + } + + return +} + +// UpdateOwnershipIdentifierPreparer prepares the UpdateOwnershipIdentifier request. +func (client DomainsClient) UpdateOwnershipIdentifierPreparer(resourceGroupName string, domainName string, name string, domainOwnershipIdentifier DomainOwnershipIdentifier) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}", pathParameters), + autorest.WithJSON(domainOwnershipIdentifier), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateOwnershipIdentifierSender sends the UpdateOwnershipIdentifier request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) UpdateOwnershipIdentifierSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateOwnershipIdentifierResponder handles the response to the UpdateOwnershipIdentifier request. The method always +// closes the http.Response Body. +func (client DomainsClient) UpdateOwnershipIdentifierResponder(resp *http.Response) (result DomainOwnershipIdentifier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/models.go index 500e712fe6..005ade8c65 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/models.go @@ -1,3673 +1,3673 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/satori/uuid" - "io" - "net/http" -) - -// AccessControlEntryAction enumerates the values for access control entry -// action. -type AccessControlEntryAction string - -const ( - // Deny specifies the deny state for access control entry action. - Deny AccessControlEntryAction = "Deny" - // Permit specifies the permit state for access control entry action. - Permit AccessControlEntryAction = "Permit" -) - -// AppServicePlanRestrictions enumerates the values for app service plan -// restrictions. -type AppServicePlanRestrictions string - -const ( - // Basic specifies the basic state for app service plan restrictions. - Basic AppServicePlanRestrictions = "Basic" - // Free specifies the free state for app service plan restrictions. - Free AppServicePlanRestrictions = "Free" - // None specifies the none state for app service plan restrictions. - None AppServicePlanRestrictions = "None" - // Premium specifies the premium state for app service plan restrictions. - Premium AppServicePlanRestrictions = "Premium" - // Shared specifies the shared state for app service plan restrictions. - Shared AppServicePlanRestrictions = "Shared" - // Standard specifies the standard state for app service plan restrictions. - Standard AppServicePlanRestrictions = "Standard" -) - -// AutoHealActionType enumerates the values for auto heal action type. -type AutoHealActionType string - -const ( - // CustomAction specifies the custom action state for auto heal action - // type. - CustomAction AutoHealActionType = "CustomAction" - // LogEvent specifies the log event state for auto heal action type. - LogEvent AutoHealActionType = "LogEvent" - // Recycle specifies the recycle state for auto heal action type. - Recycle AutoHealActionType = "Recycle" -) - -// AzureResourceType enumerates the values for azure resource type. -type AzureResourceType string - -const ( - // TrafficManager specifies the traffic manager state for azure resource - // type. - TrafficManager AzureResourceType = "TrafficManager" - // Website specifies the website state for azure resource type. - Website AzureResourceType = "Website" -) - -// BackupItemStatus enumerates the values for backup item status. -type BackupItemStatus string - -const ( - // Created specifies the created state for backup item status. - Created BackupItemStatus = "Created" - // Deleted specifies the deleted state for backup item status. - Deleted BackupItemStatus = "Deleted" - // DeleteFailed specifies the delete failed state for backup item status. - DeleteFailed BackupItemStatus = "DeleteFailed" - // DeleteInProgress specifies the delete in progress state for backup item - // status. - DeleteInProgress BackupItemStatus = "DeleteInProgress" - // Failed specifies the failed state for backup item status. - Failed BackupItemStatus = "Failed" - // InProgress specifies the in progress state for backup item status. - InProgress BackupItemStatus = "InProgress" - // PartiallySucceeded specifies the partially succeeded state for backup - // item status. - PartiallySucceeded BackupItemStatus = "PartiallySucceeded" - // Skipped specifies the skipped state for backup item status. - Skipped BackupItemStatus = "Skipped" - // Succeeded specifies the succeeded state for backup item status. - Succeeded BackupItemStatus = "Succeeded" - // TimedOut specifies the timed out state for backup item status. - TimedOut BackupItemStatus = "TimedOut" -) - -// BackupRestoreOperationType enumerates the values for backup restore -// operation type. -type BackupRestoreOperationType string - -const ( - // Clone specifies the clone state for backup restore operation type. - Clone BackupRestoreOperationType = "Clone" - // Default specifies the default state for backup restore operation type. - Default BackupRestoreOperationType = "Default" - // Relocation specifies the relocation state for backup restore operation - // type. - Relocation BackupRestoreOperationType = "Relocation" -) - -// BuiltInAuthenticationProvider enumerates the values for built in -// authentication provider. -type BuiltInAuthenticationProvider string - -const ( - // AzureActiveDirectory specifies the azure active directory state for - // built in authentication provider. - AzureActiveDirectory BuiltInAuthenticationProvider = "AzureActiveDirectory" - // Facebook specifies the facebook state for built in authentication - // provider. - Facebook BuiltInAuthenticationProvider = "Facebook" - // Google specifies the google state for built in authentication provider. - Google BuiltInAuthenticationProvider = "Google" - // MicrosoftAccount specifies the microsoft account state for built in - // authentication provider. - MicrosoftAccount BuiltInAuthenticationProvider = "MicrosoftAccount" - // Twitter specifies the twitter state for built in authentication - // provider. - Twitter BuiltInAuthenticationProvider = "Twitter" -) - -// CertificateOrderActionType enumerates the values for certificate order -// action type. -type CertificateOrderActionType string - -const ( - // CertificateExpirationWarning specifies the certificate expiration - // warning state for certificate order action type. - CertificateExpirationWarning CertificateOrderActionType = "CertificateExpirationWarning" - // CertificateExpired specifies the certificate expired state for - // certificate order action type. - CertificateExpired CertificateOrderActionType = "CertificateExpired" - // CertificateIssued specifies the certificate issued state for certificate - // order action type. - CertificateIssued CertificateOrderActionType = "CertificateIssued" - // CertificateOrderCanceled specifies the certificate order canceled state - // for certificate order action type. - CertificateOrderCanceled CertificateOrderActionType = "CertificateOrderCanceled" - // CertificateOrderCreated specifies the certificate order created state - // for certificate order action type. - CertificateOrderCreated CertificateOrderActionType = "CertificateOrderCreated" - // CertificateRevoked specifies the certificate revoked state for - // certificate order action type. - CertificateRevoked CertificateOrderActionType = "CertificateRevoked" - // DomainValidationComplete specifies the domain validation complete state - // for certificate order action type. - DomainValidationComplete CertificateOrderActionType = "DomainValidationComplete" - // FraudCleared specifies the fraud cleared state for certificate order - // action type. - FraudCleared CertificateOrderActionType = "FraudCleared" - // FraudDetected specifies the fraud detected state for certificate order - // action type. - FraudDetected CertificateOrderActionType = "FraudDetected" - // FraudDocumentationRequired specifies the fraud documentation required - // state for certificate order action type. - FraudDocumentationRequired CertificateOrderActionType = "FraudDocumentationRequired" - // OrgNameChange specifies the org name change state for certificate order - // action type. - OrgNameChange CertificateOrderActionType = "OrgNameChange" - // OrgValidationComplete specifies the org validation complete state for - // certificate order action type. - OrgValidationComplete CertificateOrderActionType = "OrgValidationComplete" - // SanDrop specifies the san drop state for certificate order action type. - SanDrop CertificateOrderActionType = "SanDrop" - // Unknown specifies the unknown state for certificate order action type. - Unknown CertificateOrderActionType = "Unknown" -) - -// CertificateOrderStatus enumerates the values for certificate order status. -type CertificateOrderStatus string - -const ( - // Canceled specifies the canceled state for certificate order status. - Canceled CertificateOrderStatus = "Canceled" - // Denied specifies the denied state for certificate order status. - Denied CertificateOrderStatus = "Denied" - // Expired specifies the expired state for certificate order status. - Expired CertificateOrderStatus = "Expired" - // Issued specifies the issued state for certificate order status. - Issued CertificateOrderStatus = "Issued" - // NotSubmitted specifies the not submitted state for certificate order - // status. - NotSubmitted CertificateOrderStatus = "NotSubmitted" - // Pendingissuance specifies the pendingissuance state for certificate - // order status. - Pendingissuance CertificateOrderStatus = "Pendingissuance" - // PendingRekey specifies the pending rekey state for certificate order - // status. - PendingRekey CertificateOrderStatus = "PendingRekey" - // Pendingrevocation specifies the pendingrevocation state for certificate - // order status. - Pendingrevocation CertificateOrderStatus = "Pendingrevocation" - // Revoked specifies the revoked state for certificate order status. - Revoked CertificateOrderStatus = "Revoked" - // Unused specifies the unused state for certificate order status. - Unused CertificateOrderStatus = "Unused" -) - -// CertificateProductType enumerates the values for certificate product type. -type CertificateProductType string - -const ( - // StandardDomainValidatedSsl specifies the standard domain validated ssl - // state for certificate product type. - StandardDomainValidatedSsl CertificateProductType = "StandardDomainValidatedSsl" - // StandardDomainValidatedWildCardSsl specifies the standard domain - // validated wild card ssl state for certificate product type. - StandardDomainValidatedWildCardSsl CertificateProductType = "StandardDomainValidatedWildCardSsl" -) - -// Channels enumerates the values for channels. -type Channels string - -const ( - // All specifies the all state for channels. - All Channels = "All" - // API specifies the api state for channels. - API Channels = "Api" - // Email specifies the email state for channels. - Email Channels = "Email" - // Notification specifies the notification state for channels. - Notification Channels = "Notification" - // Webhook specifies the webhook state for channels. - Webhook Channels = "Webhook" -) - -// CheckNameResourceTypes enumerates the values for check name resource types. -type CheckNameResourceTypes string - -const ( - // CheckNameResourceTypesHostingEnvironment specifies the check name - // resource types hosting environment state for check name resource types. - CheckNameResourceTypesHostingEnvironment CheckNameResourceTypes = "HostingEnvironment" - // CheckNameResourceTypesSite specifies the check name resource types site - // state for check name resource types. - CheckNameResourceTypesSite CheckNameResourceTypes = "Site" - // CheckNameResourceTypesSlot specifies the check name resource types slot - // state for check name resource types. - CheckNameResourceTypesSlot CheckNameResourceTypes = "Slot" -) - -// CloneAbilityResult enumerates the values for clone ability result. -type CloneAbilityResult string - -const ( - // Cloneable specifies the cloneable state for clone ability result. - Cloneable CloneAbilityResult = "Cloneable" - // NotCloneable specifies the not cloneable state for clone ability result. - NotCloneable CloneAbilityResult = "NotCloneable" - // PartiallyCloneable specifies the partially cloneable state for clone - // ability result. - PartiallyCloneable CloneAbilityResult = "PartiallyCloneable" -) - -// ComputeModeOptions enumerates the values for compute mode options. -type ComputeModeOptions string - -const ( - // ComputeModeOptionsDedicated specifies the compute mode options dedicated - // state for compute mode options. - ComputeModeOptionsDedicated ComputeModeOptions = "Dedicated" - // ComputeModeOptionsDynamic specifies the compute mode options dynamic - // state for compute mode options. - ComputeModeOptionsDynamic ComputeModeOptions = "Dynamic" - // ComputeModeOptionsShared specifies the compute mode options shared state - // for compute mode options. - ComputeModeOptionsShared ComputeModeOptions = "Shared" -) - -// ConnectionStringType enumerates the values for connection string type. -type ConnectionStringType string - -const ( - // APIHub specifies the api hub state for connection string type. - APIHub ConnectionStringType = "ApiHub" - // Custom specifies the custom state for connection string type. - Custom ConnectionStringType = "Custom" - // DocDb specifies the doc db state for connection string type. - DocDb ConnectionStringType = "DocDb" - // EventHub specifies the event hub state for connection string type. - EventHub ConnectionStringType = "EventHub" - // MySQL specifies the my sql state for connection string type. - MySQL ConnectionStringType = "MySql" - // NotificationHub specifies the notification hub state for connection - // string type. - NotificationHub ConnectionStringType = "NotificationHub" - // PostgreSQL specifies the postgre sql state for connection string type. - PostgreSQL ConnectionStringType = "PostgreSQL" - // RedisCache specifies the redis cache state for connection string type. - RedisCache ConnectionStringType = "RedisCache" - // ServiceBus specifies the service bus state for connection string type. - ServiceBus ConnectionStringType = "ServiceBus" - // SQLAzure specifies the sql azure state for connection string type. - SQLAzure ConnectionStringType = "SQLAzure" - // SQLServer specifies the sql server state for connection string type. - SQLServer ConnectionStringType = "SQLServer" -) - -// CustomHostNameDNSRecordType enumerates the values for custom host name dns -// record type. -type CustomHostNameDNSRecordType string - -const ( - // A specifies the a state for custom host name dns record type. - A CustomHostNameDNSRecordType = "A" - // CName specifies the c name state for custom host name dns record type. - CName CustomHostNameDNSRecordType = "CName" -) - -// DatabaseType enumerates the values for database type. -type DatabaseType string - -const ( - // DatabaseTypeLocalMySQL specifies the database type local my sql state - // for database type. - DatabaseTypeLocalMySQL DatabaseType = "LocalMySql" - // DatabaseTypeMySQL specifies the database type my sql state for database - // type. - DatabaseTypeMySQL DatabaseType = "MySql" - // DatabaseTypePostgreSQL specifies the database type postgre sql state for - // database type. - DatabaseTypePostgreSQL DatabaseType = "PostgreSql" - // DatabaseTypeSQLAzure specifies the database type sql azure state for - // database type. - DatabaseTypeSQLAzure DatabaseType = "SqlAzure" -) - -// DNSType enumerates the values for dns type. -type DNSType string - -const ( - // AzureDNS specifies the azure dns state for dns type. - AzureDNS DNSType = "AzureDns" - // DefaultDomainRegistrarDNS specifies the default domain registrar dns - // state for dns type. - DefaultDomainRegistrarDNS DNSType = "DefaultDomainRegistrarDns" -) - -// DNSVerificationTestResult enumerates the values for dns verification test -// result. -type DNSVerificationTestResult string - -const ( - // DNSVerificationTestResultFailed specifies the dns verification test - // result failed state for dns verification test result. - DNSVerificationTestResultFailed DNSVerificationTestResult = "Failed" - // DNSVerificationTestResultPassed specifies the dns verification test - // result passed state for dns verification test result. - DNSVerificationTestResultPassed DNSVerificationTestResult = "Passed" - // DNSVerificationTestResultSkipped specifies the dns verification test - // result skipped state for dns verification test result. - DNSVerificationTestResultSkipped DNSVerificationTestResult = "Skipped" -) - -// DomainStatus enumerates the values for domain status. -type DomainStatus string - -const ( - // DomainStatusActive specifies the domain status active state for domain - // status. - DomainStatusActive DomainStatus = "Active" - // DomainStatusAwaiting specifies the domain status awaiting state for - // domain status. - DomainStatusAwaiting DomainStatus = "Awaiting" - // DomainStatusCancelled specifies the domain status cancelled state for - // domain status. - DomainStatusCancelled DomainStatus = "Cancelled" - // DomainStatusConfiscated specifies the domain status confiscated state - // for domain status. - DomainStatusConfiscated DomainStatus = "Confiscated" - // DomainStatusDisabled specifies the domain status disabled state for - // domain status. - DomainStatusDisabled DomainStatus = "Disabled" - // DomainStatusExcluded specifies the domain status excluded state for - // domain status. - DomainStatusExcluded DomainStatus = "Excluded" - // DomainStatusExpired specifies the domain status expired state for domain - // status. - DomainStatusExpired DomainStatus = "Expired" - // DomainStatusFailed specifies the domain status failed state for domain - // status. - DomainStatusFailed DomainStatus = "Failed" - // DomainStatusHeld specifies the domain status held state for domain - // status. - DomainStatusHeld DomainStatus = "Held" - // DomainStatusJSONConverterFailed specifies the domain status json - // converter failed state for domain status. - DomainStatusJSONConverterFailed DomainStatus = "JsonConverterFailed" - // DomainStatusLocked specifies the domain status locked state for domain - // status. - DomainStatusLocked DomainStatus = "Locked" - // DomainStatusParked specifies the domain status parked state for domain - // status. - DomainStatusParked DomainStatus = "Parked" - // DomainStatusPending specifies the domain status pending state for domain - // status. - DomainStatusPending DomainStatus = "Pending" - // DomainStatusReserved specifies the domain status reserved state for - // domain status. - DomainStatusReserved DomainStatus = "Reserved" - // DomainStatusReverted specifies the domain status reverted state for - // domain status. - DomainStatusReverted DomainStatus = "Reverted" - // DomainStatusSuspended specifies the domain status suspended state for - // domain status. - DomainStatusSuspended DomainStatus = "Suspended" - // DomainStatusTransferred specifies the domain status transferred state - // for domain status. - DomainStatusTransferred DomainStatus = "Transferred" - // DomainStatusUnknown specifies the domain status unknown state for domain - // status. - DomainStatusUnknown DomainStatus = "Unknown" - // DomainStatusUnlocked specifies the domain status unlocked state for - // domain status. - DomainStatusUnlocked DomainStatus = "Unlocked" - // DomainStatusUnparked specifies the domain status unparked state for - // domain status. - DomainStatusUnparked DomainStatus = "Unparked" - // DomainStatusUpdated specifies the domain status updated state for domain - // status. - DomainStatusUpdated DomainStatus = "Updated" -) - -// DomainType enumerates the values for domain type. -type DomainType string - -const ( - // Regular specifies the regular state for domain type. - Regular DomainType = "Regular" - // SoftDeleted specifies the soft deleted state for domain type. - SoftDeleted DomainType = "SoftDeleted" -) - -// FrequencyUnit enumerates the values for frequency unit. -type FrequencyUnit string - -const ( - // Day specifies the day state for frequency unit. - Day FrequencyUnit = "Day" - // Hour specifies the hour state for frequency unit. - Hour FrequencyUnit = "Hour" -) - -// HostingEnvironmentStatus enumerates the values for hosting environment -// status. -type HostingEnvironmentStatus string - -const ( - // Deleting specifies the deleting state for hosting environment status. - Deleting HostingEnvironmentStatus = "Deleting" - // Preparing specifies the preparing state for hosting environment status. - Preparing HostingEnvironmentStatus = "Preparing" - // Ready specifies the ready state for hosting environment status. - Ready HostingEnvironmentStatus = "Ready" - // Scaling specifies the scaling state for hosting environment status. - Scaling HostingEnvironmentStatus = "Scaling" -) - -// HostNameType enumerates the values for host name type. -type HostNameType string - -const ( - // Managed specifies the managed state for host name type. - Managed HostNameType = "Managed" - // Verified specifies the verified state for host name type. - Verified HostNameType = "Verified" -) - -// HostType enumerates the values for host type. -type HostType string - -const ( - // HostTypeRepository specifies the host type repository state for host - // type. - HostTypeRepository HostType = "Repository" - // HostTypeStandard specifies the host type standard state for host type. - HostTypeStandard HostType = "Standard" -) - -// InAvailabilityReasonType enumerates the values for in availability reason -// type. -type InAvailabilityReasonType string - -const ( - // AlreadyExists specifies the already exists state for in availability - // reason type. - AlreadyExists InAvailabilityReasonType = "AlreadyExists" - // Invalid specifies the invalid state for in availability reason type. - Invalid InAvailabilityReasonType = "Invalid" -) - -// InternalLoadBalancingMode enumerates the values for internal load balancing -// mode. -type InternalLoadBalancingMode string - -const ( - // InternalLoadBalancingModeNone specifies the internal load balancing mode - // none state for internal load balancing mode. - InternalLoadBalancingModeNone InternalLoadBalancingMode = "None" - // InternalLoadBalancingModePublishing specifies the internal load - // balancing mode publishing state for internal load balancing mode. - InternalLoadBalancingModePublishing InternalLoadBalancingMode = "Publishing" - // InternalLoadBalancingModeWeb specifies the internal load balancing mode - // web state for internal load balancing mode. - InternalLoadBalancingModeWeb InternalLoadBalancingMode = "Web" -) - -// KeyVaultSecretStatus enumerates the values for key vault secret status. -type KeyVaultSecretStatus string - -const ( - // KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault specifies - // the key vault secret status azure service unauthorized to access key - // vault state for key vault secret status. - KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault KeyVaultSecretStatus = "AzureServiceUnauthorizedToAccessKeyVault" - // KeyVaultSecretStatusCertificateOrderFailed specifies the key vault - // secret status certificate order failed state for key vault secret - // status. - KeyVaultSecretStatusCertificateOrderFailed KeyVaultSecretStatus = "CertificateOrderFailed" - // KeyVaultSecretStatusExternalPrivateKey specifies the key vault secret - // status external private key state for key vault secret status. - KeyVaultSecretStatusExternalPrivateKey KeyVaultSecretStatus = "ExternalPrivateKey" - // KeyVaultSecretStatusInitialized specifies the key vault secret status - // initialized state for key vault secret status. - KeyVaultSecretStatusInitialized KeyVaultSecretStatus = "Initialized" - // KeyVaultSecretStatusKeyVaultDoesNotExist specifies the key vault secret - // status key vault does not exist state for key vault secret status. - KeyVaultSecretStatusKeyVaultDoesNotExist KeyVaultSecretStatus = "KeyVaultDoesNotExist" - // KeyVaultSecretStatusKeyVaultSecretDoesNotExist specifies the key vault - // secret status key vault secret does not exist state for key vault secret - // status. - KeyVaultSecretStatusKeyVaultSecretDoesNotExist KeyVaultSecretStatus = "KeyVaultSecretDoesNotExist" - // KeyVaultSecretStatusOperationNotPermittedOnKeyVault specifies the key - // vault secret status operation not permitted on key vault state for key - // vault secret status. - KeyVaultSecretStatusOperationNotPermittedOnKeyVault KeyVaultSecretStatus = "OperationNotPermittedOnKeyVault" - // KeyVaultSecretStatusSucceeded specifies the key vault secret status - // succeeded state for key vault secret status. - KeyVaultSecretStatusSucceeded KeyVaultSecretStatus = "Succeeded" - // KeyVaultSecretStatusUnknown specifies the key vault secret status - // unknown state for key vault secret status. - KeyVaultSecretStatusUnknown KeyVaultSecretStatus = "Unknown" - // KeyVaultSecretStatusUnknownError specifies the key vault secret status - // unknown error state for key vault secret status. - KeyVaultSecretStatusUnknownError KeyVaultSecretStatus = "UnknownError" - // KeyVaultSecretStatusWaitingOnCertificateOrder specifies the key vault - // secret status waiting on certificate order state for key vault secret - // status. - KeyVaultSecretStatusWaitingOnCertificateOrder KeyVaultSecretStatus = "WaitingOnCertificateOrder" -) - -// LogLevel enumerates the values for log level. -type LogLevel string - -const ( - // Error specifies the error state for log level. - Error LogLevel = "Error" - // Information specifies the information state for log level. - Information LogLevel = "Information" - // Off specifies the off state for log level. - Off LogLevel = "Off" - // Verbose specifies the verbose state for log level. - Verbose LogLevel = "Verbose" - // Warning specifies the warning state for log level. - Warning LogLevel = "Warning" -) - -// ManagedPipelineMode enumerates the values for managed pipeline mode. -type ManagedPipelineMode string - -const ( - // Classic specifies the classic state for managed pipeline mode. - Classic ManagedPipelineMode = "Classic" - // Integrated specifies the integrated state for managed pipeline mode. - Integrated ManagedPipelineMode = "Integrated" -) - -// NotificationLevel enumerates the values for notification level. -type NotificationLevel string - -const ( - // NotificationLevelCritical specifies the notification level critical - // state for notification level. - NotificationLevelCritical NotificationLevel = "Critical" - // NotificationLevelInformation specifies the notification level - // information state for notification level. - NotificationLevelInformation NotificationLevel = "Information" - // NotificationLevelNonUrgentSuggestion specifies the notification level - // non urgent suggestion state for notification level. - NotificationLevelNonUrgentSuggestion NotificationLevel = "NonUrgentSuggestion" - // NotificationLevelWarning specifies the notification level warning state - // for notification level. - NotificationLevelWarning NotificationLevel = "Warning" -) - -// OperationStatus enumerates the values for operation status. -type OperationStatus string - -const ( - // OperationStatusCreated specifies the operation status created state for - // operation status. - OperationStatusCreated OperationStatus = "Created" - // OperationStatusFailed specifies the operation status failed state for - // operation status. - OperationStatusFailed OperationStatus = "Failed" - // OperationStatusInProgress specifies the operation status in progress - // state for operation status. - OperationStatusInProgress OperationStatus = "InProgress" - // OperationStatusSucceeded specifies the operation status succeeded state - // for operation status. - OperationStatusSucceeded OperationStatus = "Succeeded" - // OperationStatusTimedOut specifies the operation status timed out state - // for operation status. - OperationStatusTimedOut OperationStatus = "TimedOut" -) - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled specifies the provisioning state canceled - // state for provisioning state. - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateDeleting specifies the provisioning state deleting - // state for provisioning state. - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed specifies the provisioning state failed state - // for provisioning state. - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateInProgress specifies the provisioning state in progress - // state for provisioning state. - ProvisioningStateInProgress ProvisioningState = "InProgress" - // ProvisioningStateSucceeded specifies the provisioning state succeeded - // state for provisioning state. - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PublishingProfileFormat enumerates the values for publishing profile format. -type PublishingProfileFormat string - -const ( - // FileZilla3 specifies the file zilla 3 state for publishing profile - // format. - FileZilla3 PublishingProfileFormat = "FileZilla3" - // Ftp specifies the ftp state for publishing profile format. - Ftp PublishingProfileFormat = "Ftp" - // WebDeploy specifies the web deploy state for publishing profile format. - WebDeploy PublishingProfileFormat = "WebDeploy" -) - -// ResourceScopeType enumerates the values for resource scope type. -type ResourceScopeType string - -const ( - // ServerFarm specifies the server farm state for resource scope type. - ServerFarm ResourceScopeType = "ServerFarm" - // Subscription specifies the subscription state for resource scope type. - Subscription ResourceScopeType = "Subscription" - // WebSite specifies the web site state for resource scope type. - WebSite ResourceScopeType = "WebSite" -) - -// RouteType enumerates the values for route type. -type RouteType string - -const ( - // DEFAULT specifies the default state for route type. - DEFAULT RouteType = "DEFAULT" - // INHERITED specifies the inherited state for route type. - INHERITED RouteType = "INHERITED" - // STATIC specifies the static state for route type. - STATIC RouteType = "STATIC" -) - -// ScmType enumerates the values for scm type. -type ScmType string - -const ( - // ScmTypeBitbucketGit specifies the scm type bitbucket git state for scm - // type. - ScmTypeBitbucketGit ScmType = "BitbucketGit" - // ScmTypeBitbucketHg specifies the scm type bitbucket hg state for scm - // type. - ScmTypeBitbucketHg ScmType = "BitbucketHg" - // ScmTypeCodePlexGit specifies the scm type code plex git state for scm - // type. - ScmTypeCodePlexGit ScmType = "CodePlexGit" - // ScmTypeCodePlexHg specifies the scm type code plex hg state for scm - // type. - ScmTypeCodePlexHg ScmType = "CodePlexHg" - // ScmTypeDropbox specifies the scm type dropbox state for scm type. - ScmTypeDropbox ScmType = "Dropbox" - // ScmTypeExternalGit specifies the scm type external git state for scm - // type. - ScmTypeExternalGit ScmType = "ExternalGit" - // ScmTypeExternalHg specifies the scm type external hg state for scm type. - ScmTypeExternalHg ScmType = "ExternalHg" - // ScmTypeGitHub specifies the scm type git hub state for scm type. - ScmTypeGitHub ScmType = "GitHub" - // ScmTypeLocalGit specifies the scm type local git state for scm type. - ScmTypeLocalGit ScmType = "LocalGit" - // ScmTypeNone specifies the scm type none state for scm type. - ScmTypeNone ScmType = "None" - // ScmTypeOneDrive specifies the scm type one drive state for scm type. - ScmTypeOneDrive ScmType = "OneDrive" - // ScmTypeTfs specifies the scm type tfs state for scm type. - ScmTypeTfs ScmType = "Tfs" - // ScmTypeVSO specifies the scm type vso state for scm type. - ScmTypeVSO ScmType = "VSO" -) - -// SiteAvailabilityState enumerates the values for site availability state. -type SiteAvailabilityState string - -const ( - // DisasterRecoveryMode specifies the disaster recovery mode state for site - // availability state. - DisasterRecoveryMode SiteAvailabilityState = "DisasterRecoveryMode" - // Limited specifies the limited state for site availability state. - Limited SiteAvailabilityState = "Limited" - // Normal specifies the normal state for site availability state. - Normal SiteAvailabilityState = "Normal" -) - -// SiteLoadBalancing enumerates the values for site load balancing. -type SiteLoadBalancing string - -const ( - // LeastRequests specifies the least requests state for site load - // balancing. - LeastRequests SiteLoadBalancing = "LeastRequests" - // LeastResponseTime specifies the least response time state for site load - // balancing. - LeastResponseTime SiteLoadBalancing = "LeastResponseTime" - // RequestHash specifies the request hash state for site load balancing. - RequestHash SiteLoadBalancing = "RequestHash" - // WeightedRoundRobin specifies the weighted round robin state for site - // load balancing. - WeightedRoundRobin SiteLoadBalancing = "WeightedRoundRobin" - // WeightedTotalTraffic specifies the weighted total traffic state for site - // load balancing. - WeightedTotalTraffic SiteLoadBalancing = "WeightedTotalTraffic" -) - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic specifies the sku name basic state for sku name. - SkuNameBasic SkuName = "Basic" - // SkuNameDynamic specifies the sku name dynamic state for sku name. - SkuNameDynamic SkuName = "Dynamic" - // SkuNameFree specifies the sku name free state for sku name. - SkuNameFree SkuName = "Free" - // SkuNameIsolated specifies the sku name isolated state for sku name. - SkuNameIsolated SkuName = "Isolated" - // SkuNamePremium specifies the sku name premium state for sku name. - SkuNamePremium SkuName = "Premium" - // SkuNameShared specifies the sku name shared state for sku name. - SkuNameShared SkuName = "Shared" - // SkuNameStandard specifies the sku name standard state for sku name. - SkuNameStandard SkuName = "Standard" -) - -// SslState enumerates the values for ssl state. -type SslState string - -const ( - // Disabled specifies the disabled state for ssl state. - Disabled SslState = "Disabled" - // IPBasedEnabled specifies the ip based enabled state for ssl state. - IPBasedEnabled SslState = "IpBasedEnabled" - // SniEnabled specifies the sni enabled state for ssl state. - SniEnabled SslState = "SniEnabled" -) - -// StatusOptions enumerates the values for status options. -type StatusOptions string - -const ( - // StatusOptionsPending specifies the status options pending state for - // status options. - StatusOptionsPending StatusOptions = "Pending" - // StatusOptionsReady specifies the status options ready state for status - // options. - StatusOptionsReady StatusOptions = "Ready" -) - -// UnauthenticatedClientAction enumerates the values for unauthenticated client -// action. -type UnauthenticatedClientAction string - -const ( - // AllowAnonymous specifies the allow anonymous state for unauthenticated - // client action. - AllowAnonymous UnauthenticatedClientAction = "AllowAnonymous" - // RedirectToLoginPage specifies the redirect to login page state for - // unauthenticated client action. - RedirectToLoginPage UnauthenticatedClientAction = "RedirectToLoginPage" -) - -// UsageState enumerates the values for usage state. -type UsageState string - -const ( - // UsageStateExceeded specifies the usage state exceeded state for usage - // state. - UsageStateExceeded UsageState = "Exceeded" - // UsageStateNormal specifies the usage state normal state for usage state. - UsageStateNormal UsageState = "Normal" -) - -// ValidateResourceTypes enumerates the values for validate resource types. -type ValidateResourceTypes string - -const ( - // ValidateResourceTypesServerFarm specifies the validate resource types - // server farm state for validate resource types. - ValidateResourceTypesServerFarm ValidateResourceTypes = "ServerFarm" - // ValidateResourceTypesSite specifies the validate resource types site - // state for validate resource types. - ValidateResourceTypesSite ValidateResourceTypes = "Site" -) - -// WorkerSizeOptions enumerates the values for worker size options. -type WorkerSizeOptions string - -const ( - // WorkerSizeOptionsDefault specifies the worker size options default state - // for worker size options. - WorkerSizeOptionsDefault WorkerSizeOptions = "Default" - // WorkerSizeOptionsLarge specifies the worker size options large state for - // worker size options. - WorkerSizeOptionsLarge WorkerSizeOptions = "Large" - // WorkerSizeOptionsMedium specifies the worker size options medium state - // for worker size options. - WorkerSizeOptionsMedium WorkerSizeOptions = "Medium" - // WorkerSizeOptionsSmall specifies the worker size options small state for - // worker size options. - WorkerSizeOptionsSmall WorkerSizeOptions = "Small" -) - -// Address is address information for domain registration. -type Address struct { - Address1 *string `json:"address1,omitempty"` - Address2 *string `json:"address2,omitempty"` - City *string `json:"city,omitempty"` - Country *string `json:"country,omitempty"` - PostalCode *string `json:"postalCode,omitempty"` - State *string `json:"state,omitempty"` -} - -// AddressResponse is describes main public IP address and any extra virtual -// IPs. -type AddressResponse struct { - autorest.Response `json:"-"` - ServiceIPAddress *string `json:"serviceIpAddress,omitempty"` - InternalIPAddress *string `json:"internalIpAddress,omitempty"` - OutboundIPAddresses *[]string `json:"outboundIpAddresses,omitempty"` - VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` -} - -// APIDefinitionInfo is information about the formal API definition for the -// app. -type APIDefinitionInfo struct { - URL *string `json:"url,omitempty"` -} - -// AppCollection is collection of App Service apps. -type AppCollection struct { - autorest.Response `json:"-"` - Value *[]Site `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppCollection) AppCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AppInstanceCollection is collection of app instances. -type AppInstanceCollection struct { - autorest.Response `json:"-"` - Value *[]SiteInstance `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppInstanceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppInstanceCollection) AppInstanceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ApplicationLogsConfig is application logs configuration. -type ApplicationLogsConfig struct { - FileSystem *FileSystemApplicationLogsConfig `json:"fileSystem,omitempty"` - AzureTableStorage *AzureTableStorageApplicationLogsConfig `json:"azureTableStorage,omitempty"` - AzureBlobStorage *AzureBlobStorageApplicationLogsConfig `json:"azureBlobStorage,omitempty"` -} - -// AppServiceCertificate is key Vault container for a certificate that is -// purchased through Azure. -type AppServiceCertificate struct { - KeyVaultID *string `json:"keyVaultId,omitempty"` - KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` - ProvisioningState KeyVaultSecretStatus `json:"provisioningState,omitempty"` -} - -// AppServiceCertificateCollection is collection of certitificateorder -// certificates. -type AppServiceCertificateCollection struct { - autorest.Response `json:"-"` - Value *[]AppServiceCertificateResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppServiceCertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppServiceCertificateCollection) AppServiceCertificateCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AppServiceCertificateOrder is sSL certificate purchase order. -type AppServiceCertificateOrder struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AppServiceCertificateOrderProperties `json:"properties,omitempty"` -} - -// AppServiceCertificateOrderProperties is appServiceCertificateOrder resource -// specific properties -type AppServiceCertificateOrderProperties struct { - Certificates *map[string]*AppServiceCertificate `json:"certificates,omitempty"` - DistinguishedName *string `json:"distinguishedName,omitempty"` - DomainVerificationToken *string `json:"domainVerificationToken,omitempty"` - ValidityInYears *int32 `json:"validityInYears,omitempty"` - KeySize *int32 `json:"keySize,omitempty"` - ProductType CertificateProductType `json:"productType,omitempty"` - AutoRenew *bool `json:"autoRenew,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Status CertificateOrderStatus `json:"status,omitempty"` - SignedCertificate *CertificateDetails `json:"signedCertificate,omitempty"` - Csr *string `json:"csr,omitempty"` - Intermediate *CertificateDetails `json:"intermediate,omitempty"` - Root *CertificateDetails `json:"root,omitempty"` - SerialNumber *string `json:"serialNumber,omitempty"` - LastCertificateIssuanceTime *date.Time `json:"lastCertificateIssuanceTime,omitempty"` - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` - AppServiceCertificateNotRenewableReasons *[]string `json:"appServiceCertificateNotRenewableReasons,omitempty"` - NextAutoRenewalTimeStamp *date.Time `json:"nextAutoRenewalTimeStamp,omitempty"` -} - -// AppServiceCertificateOrderCollection is collection of certitificate orders. -type AppServiceCertificateOrderCollection struct { - autorest.Response `json:"-"` - Value *[]AppServiceCertificateOrder `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppServiceCertificateOrderCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppServiceCertificateOrderCollection) AppServiceCertificateOrderCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AppServiceCertificateResource is key Vault container ARM resource for a -// certificate that is purchased through Azure. -type AppServiceCertificateResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AppServiceCertificate `json:"properties,omitempty"` -} - -// AppServiceEnvironment is description of an App Service Environment. -type AppServiceEnvironment struct { - Name *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - Status HostingEnvironmentStatus `json:"status,omitempty"` - VnetName *string `json:"vnetName,omitempty"` - VnetResourceGroupName *string `json:"vnetResourceGroupName,omitempty"` - VnetSubnetName *string `json:"vnetSubnetName,omitempty"` - VirtualNetwork *VirtualNetworkProfile `json:"virtualNetwork,omitempty"` - InternalLoadBalancingMode InternalLoadBalancingMode `json:"internalLoadBalancingMode,omitempty"` - MultiSize *string `json:"multiSize,omitempty"` - MultiRoleCount *int32 `json:"multiRoleCount,omitempty"` - WorkerPools *[]WorkerPool `json:"workerPools,omitempty"` - IpsslAddressCount *int32 `json:"ipsslAddressCount,omitempty"` - DatabaseEdition *string `json:"databaseEdition,omitempty"` - DatabaseServiceObjective *string `json:"databaseServiceObjective,omitempty"` - UpgradeDomains *int32 `json:"upgradeDomains,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - DNSSuffix *string `json:"dnsSuffix,omitempty"` - LastAction *string `json:"lastAction,omitempty"` - LastActionResult *string `json:"lastActionResult,omitempty"` - AllowedMultiSizes *string `json:"allowedMultiSizes,omitempty"` - AllowedWorkerSizes *string `json:"allowedWorkerSizes,omitempty"` - MaximumNumberOfMachines *int32 `json:"maximumNumberOfMachines,omitempty"` - VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` - EnvironmentCapacities *[]StampCapacity `json:"environmentCapacities,omitempty"` - NetworkAccessControlList *[]NetworkAccessControlEntry `json:"networkAccessControlList,omitempty"` - EnvironmentIsHealthy *bool `json:"environmentIsHealthy,omitempty"` - EnvironmentStatus *string `json:"environmentStatus,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - FrontEndScaleFactor *int32 `json:"frontEndScaleFactor,omitempty"` - DefaultFrontEndScaleFactor *int32 `json:"defaultFrontEndScaleFactor,omitempty"` - APIManagementAccountID *string `json:"apiManagementAccountId,omitempty"` - Suspended *bool `json:"suspended,omitempty"` - DynamicCacheEnabled *bool `json:"dynamicCacheEnabled,omitempty"` - ClusterSettings *[]NameValuePair `json:"clusterSettings,omitempty"` -} - -// AppServiceEnvironmentCollection is collection of App Service Environments. -type AppServiceEnvironmentCollection struct { - autorest.Response `json:"-"` - Value *[]AppServiceEnvironment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppServiceEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppServiceEnvironmentCollection) AppServiceEnvironmentCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AppServiceEnvironmentResource is app Service Environment ARM resource. -type AppServiceEnvironmentResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AppServiceEnvironment `json:"properties,omitempty"` -} - -// AppServicePlan is app Service plan. -type AppServicePlan struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *AppServicePlanProperties `json:"properties,omitempty"` - Sku *SkuDescription `json:"sku,omitempty"` -} - -// AppServicePlanProperties is appServicePlan resource specific properties -type AppServicePlanProperties struct { - Name *string `json:"name,omitempty"` - WorkerTierName *string `json:"workerTierName,omitempty"` - Status StatusOptions `json:"status,omitempty"` - Subscription *string `json:"subscription,omitempty"` - AdminSiteName *string `json:"adminSiteName,omitempty"` - HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` - MaximumNumberOfWorkers *int32 `json:"maximumNumberOfWorkers,omitempty"` - GeoRegion *string `json:"geoRegion,omitempty"` - PerSiteScaling *bool `json:"perSiteScaling,omitempty"` - NumberOfSites *int32 `json:"numberOfSites,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - Reserved *bool `json:"reserved,omitempty"` - TargetWorkerCount *int32 `json:"targetWorkerCount,omitempty"` - TargetWorkerSizeID *int32 `json:"targetWorkerSizeId,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// AppServicePlanCollection is collection of App Service plans. -type AppServicePlanCollection struct { - autorest.Response `json:"-"` - Value *[]AppServicePlan `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// AppServicePlanCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client AppServicePlanCollection) AppServicePlanCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// AutoHealActions is actions which to take by the auto-heal module when a rule -// is triggered. -type AutoHealActions struct { - ActionType AutoHealActionType `json:"actionType,omitempty"` - CustomAction *AutoHealCustomAction `json:"customAction,omitempty"` - MinProcessExecutionTime *string `json:"minProcessExecutionTime,omitempty"` -} - -// AutoHealCustomAction is custom action to be executed -// when an auto heal rule is triggered. -type AutoHealCustomAction struct { - Exe *string `json:"exe,omitempty"` - Parameters *string `json:"parameters,omitempty"` -} - -// AutoHealRules is rules that can be defined for auto-heal. -type AutoHealRules struct { - Triggers *AutoHealTriggers `json:"triggers,omitempty"` - Actions *AutoHealActions `json:"actions,omitempty"` -} - -// AutoHealTriggers is triggers for auto-heal. -type AutoHealTriggers struct { - Requests *RequestsBasedTrigger `json:"requests,omitempty"` - PrivateBytesInKB *int32 `json:"privateBytesInKB,omitempty"` - StatusCodes *[]StatusCodesBasedTrigger `json:"statusCodes,omitempty"` - SlowRequests *SlowRequestsBasedTrigger `json:"slowRequests,omitempty"` -} - -// AzureBlobStorageApplicationLogsConfig is application logs azure blob storage -// configuration. -type AzureBlobStorageApplicationLogsConfig struct { - Level LogLevel `json:"level,omitempty"` - SasURL *string `json:"sasUrl,omitempty"` - RetentionInDays *int32 `json:"retentionInDays,omitempty"` -} - -// AzureBlobStorageHTTPLogsConfig is http logs to azure blob storage -// configuration. -type AzureBlobStorageHTTPLogsConfig struct { - SasURL *string `json:"sasUrl,omitempty"` - RetentionInDays *int32 `json:"retentionInDays,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// AzureTableStorageApplicationLogsConfig is application logs to Azure table -// storage configuration. -type AzureTableStorageApplicationLogsConfig struct { - Level LogLevel `json:"level,omitempty"` - SasURL *string `json:"sasUrl,omitempty"` -} - -// BackupItem is backup description. -type BackupItem struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *BackupItemProperties `json:"properties,omitempty"` -} - -// BackupItemProperties is backupItem resource specific properties -type BackupItemProperties struct { - BackupID *int32 `json:"id,omitempty"` - StorageAccountURL *string `json:"storageAccountUrl,omitempty"` - BlobName *string `json:"blobName,omitempty"` - Name *string `json:"name,omitempty"` - Status BackupItemStatus `json:"status,omitempty"` - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - Created *date.Time `json:"created,omitempty"` - Log *string `json:"log,omitempty"` - Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` - Scheduled *bool `json:"scheduled,omitempty"` - LastRestoreTimeStamp *date.Time `json:"lastRestoreTimeStamp,omitempty"` - FinishedTimeStamp *date.Time `json:"finishedTimeStamp,omitempty"` - CorrelationID *string `json:"correlationId,omitempty"` - WebsiteSizeInBytes *int64 `json:"websiteSizeInBytes,omitempty"` -} - -// BackupItemCollection is collection of backup items. -type BackupItemCollection struct { - autorest.Response `json:"-"` - Value *[]BackupItem `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// BackupItemCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client BackupItemCollection) BackupItemCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// BackupRequest is description of a backup which will be performed. -type BackupRequest struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *BackupRequestProperties `json:"properties,omitempty"` -} - -// BackupRequestProperties is backupRequest resource specific properties -type BackupRequestProperties struct { - BackupRequestName *string `json:"name,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - StorageAccountURL *string `json:"storageAccountUrl,omitempty"` - BackupSchedule *BackupSchedule `json:"backupSchedule,omitempty"` - Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` - Type BackupRestoreOperationType `json:"type,omitempty"` -} - -// BackupSchedule is description of a backup schedule. Describes how often -// should be the backup performed and what should be the retention policy. -type BackupSchedule struct { - FrequencyInterval *int32 `json:"frequencyInterval,omitempty"` - FrequencyUnit FrequencyUnit `json:"frequencyUnit,omitempty"` - KeepAtLeastOneBackup *bool `json:"keepAtLeastOneBackup,omitempty"` - RetentionPeriodInDays *int32 `json:"retentionPeriodInDays,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` -} - -// Capability is describes the capabilities/features allowed for a specific -// SKU. -type Capability struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` - Reason *string `json:"reason,omitempty"` -} - -// Certificate is sSL certificate for an app. -type Certificate struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CertificateProperties `json:"properties,omitempty"` -} - -// CertificateProperties is certificate resource specific properties -type CertificateProperties struct { - FriendlyName *string `json:"friendlyName,omitempty"` - SubjectName *string `json:"subjectName,omitempty"` - HostNames *[]string `json:"hostNames,omitempty"` - PfxBlob *[]byte `json:"pfxBlob,omitempty"` - SiteName *string `json:"siteName,omitempty"` - SelfLink *string `json:"selfLink,omitempty"` - Issuer *string `json:"issuer,omitempty"` - IssueDate *date.Time `json:"issueDate,omitempty"` - ExpirationDate *date.Time `json:"expirationDate,omitempty"` - Password *string `json:"password,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - Valid *bool `json:"valid,omitempty"` - CerBlob *string `json:"cerBlob,omitempty"` - PublicKeyHash *string `json:"publicKeyHash,omitempty"` - HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` - KeyVaultID *string `json:"keyVaultId,omitempty"` - KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` - KeyVaultSecretStatus KeyVaultSecretStatus `json:"keyVaultSecretStatus,omitempty"` - GeoRegion *string `json:"geoRegion,omitempty"` - Name *string `json:"name,omitempty"` - ServerFarmID *string `json:"serverFarmId,omitempty"` -} - -// CertificateCollection is collection of certificates. -type CertificateCollection struct { - autorest.Response `json:"-"` - Value *[]Certificate `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateCollection) CertificateCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CertificateDetails is sSL certificate details. -type CertificateDetails struct { - Version *int32 `json:"version,omitempty"` - SerialNumber *string `json:"serialNumber,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - Subject *string `json:"subject,omitempty"` - NotBefore *date.Time `json:"notBefore,omitempty"` - NotAfter *date.Time `json:"notAfter,omitempty"` - SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"` - Issuer *string `json:"issuer,omitempty"` - RawData *string `json:"rawData,omitempty"` -} - -// CertificateEmail is sSL certificate email. -type CertificateEmail struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CertificateEmailProperties `json:"properties,omitempty"` -} - -// CertificateEmailProperties is certificateEmail resource specific properties -type CertificateEmailProperties struct { - EmailID *string `json:"emailId,omitempty"` - TimeStamp *date.Time `json:"timeStamp,omitempty"` -} - -// CertificateOrderAction is certificate order action. -type CertificateOrderAction struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CertificateOrderActionProperties `json:"properties,omitempty"` -} - -// CertificateOrderActionProperties is certificateOrderAction resource specific -// properties -type CertificateOrderActionProperties struct { - Type CertificateOrderActionType `json:"type,omitempty"` - CreatedAt *date.Time `json:"createdAt,omitempty"` -} - -// CloningInfo is information needed for cloning operation. -type CloningInfo struct { - CorrelationID *string `json:"correlationId,omitempty"` - Overwrite *bool `json:"overwrite,omitempty"` - CloneCustomHostNames *bool `json:"cloneCustomHostNames,omitempty"` - CloneSourceControl *bool `json:"cloneSourceControl,omitempty"` - SourceWebAppID *string `json:"sourceWebAppId,omitempty"` - HostingEnvironment *string `json:"hostingEnvironment,omitempty"` - AppSettingsOverrides *map[string]*string `json:"appSettingsOverrides,omitempty"` - ConfigureLoadBalancing *bool `json:"configureLoadBalancing,omitempty"` - TrafficManagerProfileID *string `json:"trafficManagerProfileId,omitempty"` - TrafficManagerProfileName *string `json:"trafficManagerProfileName,omitempty"` - IgnoreQuotas *bool `json:"ignoreQuotas,omitempty"` -} - -// ConnectionStringDictionary is string dictionary resource. -type ConnectionStringDictionary struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *map[string]*ConnStringValueTypePair `json:"properties,omitempty"` -} - -// ConnStringInfo is database connection string information. -type ConnStringInfo struct { - Name *string `json:"name,omitempty"` - ConnectionString *string `json:"connectionString,omitempty"` - Type ConnectionStringType `json:"type,omitempty"` -} - -// ConnStringValueTypePair is database connection string value to type pair. -type ConnStringValueTypePair struct { - Value *string `json:"value,omitempty"` - Type ConnectionStringType `json:"type,omitempty"` -} - -// Contact is contact information for domain registration. If 'Domain Privacy' -// option is not selected then the contact information is made publicly -// available through the Whois -// directories as per ICANN requirements. -type Contact struct { - AddressMailing *Address `json:"addressMailing,omitempty"` - Email *string `json:"email,omitempty"` - Fax *string `json:"fax,omitempty"` - JobTitle *string `json:"jobTitle,omitempty"` - NameFirst *string `json:"nameFirst,omitempty"` - NameLast *string `json:"nameLast,omitempty"` - NameMiddle *string `json:"nameMiddle,omitempty"` - Organization *string `json:"organization,omitempty"` - Phone *string `json:"phone,omitempty"` -} - -// CorsSettings is cross-Origin Resource Sharing (CORS) settings for the app. -type CorsSettings struct { - AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` -} - -// CsmMoveResourceEnvelope is object with a list of the resources that need to -// be moved and the resource group they should be moved to. -type CsmMoveResourceEnvelope struct { - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` - Resources *[]string `json:"resources,omitempty"` -} - -// CsmPublishingProfileOptions is publishing options for requested profile. -type CsmPublishingProfileOptions struct { - Format PublishingProfileFormat `json:"format,omitempty"` -} - -// CsmSiteRecoveryEntity is details about app recovery operation. -type CsmSiteRecoveryEntity struct { - SnapshotTime *date.Time `json:"snapshotTime,omitempty"` - SiteName *string `json:"siteName,omitempty"` - SlotName *string `json:"slotName,omitempty"` -} - -// CsmSlotEntity is deployment slot parameters. -type CsmSlotEntity struct { - TargetSlot *string `json:"targetSlot,omitempty"` - PreserveVnet *bool `json:"preserveVnet,omitempty"` -} - -// CsmUsageQuota is usage of the quota resource. -type CsmUsageQuota struct { - Unit *string `json:"unit,omitempty"` - NextResetTime *date.Time `json:"nextResetTime,omitempty"` - CurrentValue *int64 `json:"currentValue,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Name *LocalizableString `json:"name,omitempty"` -} - -// CsmUsageQuotaCollection is collection of CSM usage quotas. -type CsmUsageQuotaCollection struct { - autorest.Response `json:"-"` - Value *[]CsmUsageQuota `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CsmUsageQuotaCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CsmUsageQuotaCollection) CsmUsageQuotaCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CustomHostnameAnalysisResult is custom domain analysis. -type CustomHostnameAnalysisResult struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *CustomHostnameAnalysisResultProperties `json:"properties,omitempty"` -} - -// CustomHostnameAnalysisResultProperties is customHostnameAnalysisResult -// resource specific properties -type CustomHostnameAnalysisResultProperties struct { - IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty"` - CustomDomainVerificationTest DNSVerificationTestResult `json:"customDomainVerificationTest,omitempty"` - CustomDomainVerificationFailureInfo *ErrorEntity `json:"customDomainVerificationFailureInfo,omitempty"` - HasConflictOnScaleUnit *bool `json:"hasConflictOnScaleUnit,omitempty"` - HasConflictAcrossSubscription *bool `json:"hasConflictAcrossSubscription,omitempty"` - ConflictingAppResourceID *string `json:"conflictingAppResourceId,omitempty"` - CNameRecords *[]string `json:"cNameRecords,omitempty"` - TxtRecords *[]string `json:"txtRecords,omitempty"` - ARecords *[]string `json:"aRecords,omitempty"` - AlternateCNameRecords *[]string `json:"alternateCNameRecords,omitempty"` - AlternateTxtRecords *[]string `json:"alternateTxtRecords,omitempty"` -} - -// DatabaseBackupSetting is database backup settings. -type DatabaseBackupSetting struct { - DatabaseType DatabaseType `json:"databaseType,omitempty"` - Name *string `json:"name,omitempty"` - ConnectionStringName *string `json:"connectionStringName,omitempty"` - ConnectionString *string `json:"connectionString,omitempty"` -} - -// DeletedSite is a deleted app. -type DeletedSite struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DeletedSiteProperties `json:"properties,omitempty"` -} - -// DeletedSiteProperties is deletedSite resource specific properties -type DeletedSiteProperties struct { - DeletedTimestamp *date.Time `json:"deletedTimestamp,omitempty"` - State *string `json:"state,omitempty"` - HostNames *[]string `json:"hostNames,omitempty"` - RepositorySiteName *string `json:"repositorySiteName,omitempty"` - UsageState UsageState `json:"usageState,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - EnabledHostNames *[]string `json:"enabledHostNames,omitempty"` - AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` - HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` - ServerFarmID *string `json:"serverFarmId,omitempty"` - Reserved *bool `json:"reserved,omitempty"` - LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` - SiteConfig *SiteConfig `json:"siteConfig,omitempty"` - TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` - PremiumAppDeployed *bool `json:"premiumAppDeployed,omitempty"` - ScmSiteAlsoStopped *bool `json:"scmSiteAlsoStopped,omitempty"` - TargetSwapSlot *string `json:"targetSwapSlot,omitempty"` - HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` - MicroService *string `json:"microService,omitempty"` - GatewaySiteName *string `json:"gatewaySiteName,omitempty"` - ClientAffinityEnabled *bool `json:"clientAffinityEnabled,omitempty"` - ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` - HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` - OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` - ContainerSize *int32 `json:"containerSize,omitempty"` - DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` - SuspendedTill *date.Time `json:"suspendedTill,omitempty"` - MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` - CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` - DefaultHostName *string `json:"defaultHostName,omitempty"` - SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` -} - -// DeletedWebAppCollection is collection of deleted apps. -type DeletedWebAppCollection struct { - autorest.Response `json:"-"` - Value *[]DeletedSite `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DeletedWebAppCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DeletedWebAppCollection) DeletedWebAppCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Deployment is user crendentials used for publishing activity. -type Deployment struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DeploymentProperties `json:"properties,omitempty"` -} - -// DeploymentProperties is deployment resource specific properties -type DeploymentProperties struct { - ID *string `json:"id,omitempty"` - Status *int32 `json:"status,omitempty"` - Message *string `json:"message,omitempty"` - Author *string `json:"author,omitempty"` - Deployer *string `json:"deployer,omitempty"` - AuthorEmail *string `json:"authorEmail,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - Active *bool `json:"active,omitempty"` - Details *string `json:"details,omitempty"` -} - -// DeploymentCollection is collection of app deployments. -type DeploymentCollection struct { - autorest.Response `json:"-"` - Value *[]Deployment `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DeploymentCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DeploymentCollection) DeploymentCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Domain is information about a domain. -type Domain struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DomainProperties `json:"properties,omitempty"` -} - -// DomainProperties is domain resource specific properties -type DomainProperties struct { - ContactAdmin *Contact `json:"contactAdmin,omitempty"` - ContactBilling *Contact `json:"contactBilling,omitempty"` - ContactRegistrant *Contact `json:"contactRegistrant,omitempty"` - ContactTech *Contact `json:"contactTech,omitempty"` - RegistrationStatus DomainStatus `json:"registrationStatus,omitempty"` - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - NameServers *[]string `json:"nameServers,omitempty"` - Privacy *bool `json:"privacy,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - LastRenewedTime *date.Time `json:"lastRenewedTime,omitempty"` - AutoRenew *bool `json:"autoRenew,omitempty"` - ReadyForDNSRecordManagement *bool `json:"readyForDnsRecordManagement,omitempty"` - ManagedHostNames *[]HostName `json:"managedHostNames,omitempty"` - Consent *DomainPurchaseConsent `json:"consent,omitempty"` - DomainNotRenewableReasons *[]string `json:"domainNotRenewableReasons,omitempty"` - DNSType DNSType `json:"dnsType,omitempty"` - DNSZoneID *string `json:"dnsZoneId,omitempty"` - TargetDNSType DNSType `json:"targetDnsType,omitempty"` - AuthCode *string `json:"authCode,omitempty"` -} - -// DomainAvailablilityCheckResult is domain availablility check result. -type DomainAvailablilityCheckResult struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - Available *bool `json:"available,omitempty"` - DomainType DomainType `json:"domainType,omitempty"` -} - -// DomainCollection is collection of domains. -type DomainCollection struct { - autorest.Response `json:"-"` - Value *[]Domain `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DomainCollection) DomainCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DomainControlCenterSsoRequest is single sign-on request information for -// domain management. -type DomainControlCenterSsoRequest struct { - autorest.Response `json:"-"` - URL *string `json:"url,omitempty"` - PostParameterKey *string `json:"postParameterKey,omitempty"` - PostParameterValue *string `json:"postParameterValue,omitempty"` -} - -// DomainOwnershipIdentifier is domain ownership Identifier. -type DomainOwnershipIdentifier struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *DomainOwnershipIdentifierProperties `json:"properties,omitempty"` -} - -// DomainOwnershipIdentifierProperties is domainOwnershipIdentifier resource -// specific properties -type DomainOwnershipIdentifierProperties struct { - OwnershipID *string `json:"ownershipId,omitempty"` -} - -// DomainOwnershipIdentifierCollection is collection of domain ownership -// identifiers. -type DomainOwnershipIdentifierCollection struct { - autorest.Response `json:"-"` - Value *[]DomainOwnershipIdentifier `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// DomainOwnershipIdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client DomainOwnershipIdentifierCollection) DomainOwnershipIdentifierCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// DomainPurchaseConsent is domain purchase consent object, representing -// acceptance of applicable legal agreements. -type DomainPurchaseConsent struct { - AgreementKeys *[]string `json:"agreementKeys,omitempty"` - AgreedBy *string `json:"agreedBy,omitempty"` - AgreedAt *date.Time `json:"agreedAt,omitempty"` -} - -// DomainRecommendationSearchParameters is domain recommendation search -// parameters. -type DomainRecommendationSearchParameters struct { - Keywords *string `json:"keywords,omitempty"` - MaxDomainRecommendations *int32 `json:"maxDomainRecommendations,omitempty"` -} - -// EnabledConfig is enabled configuration. -type EnabledConfig struct { - Enabled *bool `json:"enabled,omitempty"` -} - -// ErrorEntity is body of the error response returned from the API. -type ErrorEntity struct { - ExtendedCode *string `json:"extendedCode,omitempty"` - MessageTemplate *string `json:"messageTemplate,omitempty"` - Parameters *[]string `json:"parameters,omitempty"` - InnerErrors *[]ErrorEntity `json:"innerErrors,omitempty"` - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// Experiments is routing rules in production experiments. -type Experiments struct { - RampUpRules *[]RampUpRule `json:"rampUpRules,omitempty"` -} - -// FileSystemApplicationLogsConfig is application logs to file system -// configuration. -type FileSystemApplicationLogsConfig struct { - Level LogLevel `json:"level,omitempty"` -} - -// FileSystemHTTPLogsConfig is http logs to file system configuration. -type FileSystemHTTPLogsConfig struct { - RetentionInMb *int32 `json:"retentionInMb,omitempty"` - RetentionInDays *int32 `json:"retentionInDays,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// GeoRegion is geographical region. -type GeoRegion struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *GeoRegionProperties `json:"properties,omitempty"` -} - -// GeoRegionProperties is geoRegion resource specific properties -type GeoRegionProperties struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - DisplayName *string `json:"displayName,omitempty"` -} - -// GeoRegionCollection is collection of geographical regions. -type GeoRegionCollection struct { - autorest.Response `json:"-"` - Value *[]GeoRegion `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// GeoRegionCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client GeoRegionCollection) GeoRegionCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// GlobalCsmSkuDescription is a Global SKU Description. -type GlobalCsmSkuDescription struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` - Capacity *SkuCapacity `json:"capacity,omitempty"` - Locations *[]string `json:"locations,omitempty"` - Capabilities *[]Capability `json:"capabilities,omitempty"` -} - -// HandlerMapping is the IIS handler mappings used to define which handler -// processes HTTP requests with certain extension. -// For example, it is used to configure php-cgi.exe process to handle all HTTP -// requests with *.php extension. -type HandlerMapping struct { - Extension *string `json:"extension,omitempty"` - ScriptProcessor *string `json:"scriptProcessor,omitempty"` - Arguments *string `json:"arguments,omitempty"` -} - -// HostingEnvironmentDiagnostics is diagnostics for an App Service Environment. -type HostingEnvironmentDiagnostics struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - DiagnosicsOutput *string `json:"diagnosicsOutput,omitempty"` -} - -// HostingEnvironmentProfile is specification for an App Service Environment to -// use for this resource. -type HostingEnvironmentProfile struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} - -// HostName is details of a hostname derived from a domain. -type HostName struct { - Name *string `json:"name,omitempty"` - SiteNames *[]string `json:"siteNames,omitempty"` - AzureResourceName *string `json:"azureResourceName,omitempty"` - AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` - CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` - HostNameType HostNameType `json:"hostNameType,omitempty"` -} - -// HostNameBinding is a hostname binding object. -type HostNameBinding struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *HostNameBindingProperties `json:"properties,omitempty"` -} - -// HostNameBindingProperties is hostNameBinding resource specific properties -type HostNameBindingProperties struct { - Name *string `json:"name,omitempty"` - SiteName *string `json:"siteName,omitempty"` - DomainID *string `json:"domainId,omitempty"` - AzureResourceName *string `json:"azureResourceName,omitempty"` - AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` - CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` - HostNameType HostNameType `json:"hostNameType,omitempty"` - SslState SslState `json:"sslState,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - VirtualIP *string `json:"virtualIP,omitempty"` -} - -// HostNameBindingCollection is collection of hostname bindings. -type HostNameBindingCollection struct { - autorest.Response `json:"-"` - Value *[]HostNameBinding `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// HostNameBindingCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client HostNameBindingCollection) HostNameBindingCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// HostNameSslState is sSL-enabled hostname. -type HostNameSslState struct { - Name *string `json:"name,omitempty"` - SslState SslState `json:"sslState,omitempty"` - VirtualIP *string `json:"virtualIP,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` - ToUpdate *bool `json:"toUpdate,omitempty"` - HostType HostType `json:"hostType,omitempty"` -} - -// HTTPLogsConfig is http logs configuration. -type HTTPLogsConfig struct { - FileSystem *FileSystemHTTPLogsConfig `json:"fileSystem,omitempty"` - AzureBlobStorage *AzureBlobStorageHTTPLogsConfig `json:"azureBlobStorage,omitempty"` -} - -// HybridConnection is hybrid Connection contract. This is used to configure a -// Hybrid Connection. -type HybridConnection struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *HybridConnectionProperties `json:"properties,omitempty"` -} - -// HybridConnectionProperties is hybridConnection resource specific properties -type HybridConnectionProperties struct { - ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` - RelayName *string `json:"relayName,omitempty"` - RelayArmURI *string `json:"relayArmUri,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Port *int32 `json:"port,omitempty"` - SendKeyName *string `json:"sendKeyName,omitempty"` - SendKeyValue *string `json:"sendKeyValue,omitempty"` -} - -// HybridConnectionCollection is collection of hostname bindings. -type HybridConnectionCollection struct { - autorest.Response `json:"-"` - Value *[]HybridConnection `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// HybridConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client HybridConnectionCollection) HybridConnectionCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// HybridConnectionKey is hybrid Connection key contract. This has the send key -// name and value for a Hybrid Connection. -type HybridConnectionKey struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *HybridConnectionKeyProperties `json:"properties,omitempty"` -} - -// HybridConnectionKeyProperties is hybridConnectionKey resource specific -// properties -type HybridConnectionKeyProperties struct { - SendKeyName *string `json:"sendKeyName,omitempty"` - SendKeyValue *string `json:"sendKeyValue,omitempty"` -} - -// HybridConnectionLimits is hybrid Connection limits contract. This is used to -// return the plan limits of Hybrid Connections. -type HybridConnectionLimits struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *HybridConnectionLimitsProperties `json:"properties,omitempty"` -} - -// HybridConnectionLimitsProperties is hybridConnectionLimits resource specific -// properties -type HybridConnectionLimitsProperties struct { - Current *int32 `json:"current,omitempty"` - Maximum *int32 `json:"maximum,omitempty"` -} - -// Identifier is identifier. -type Identifier struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *IdentifierProperties `json:"properties,omitempty"` -} - -// IdentifierProperties is identifier resource specific properties -type IdentifierProperties struct { - ID *string `json:"id,omitempty"` -} - -// IdentifierCollection is collection of identifiers. -type IdentifierCollection struct { - autorest.Response `json:"-"` - Value *[]Identifier `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// IdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client IdentifierCollection) IdentifierCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// IPSecurityRestriction is iP security restriction on an app. -type IPSecurityRestriction struct { - IPAddress *string `json:"ipAddress,omitempty"` - SubnetMask *string `json:"subnetMask,omitempty"` -} - -// ListCapability is -type ListCapability struct { - autorest.Response `json:"-"` - Value *[]Capability `json:"value,omitempty"` -} - -// ListCertificateEmail is -type ListCertificateEmail struct { - autorest.Response `json:"-"` - Value *[]CertificateEmail `json:"value,omitempty"` -} - -// ListCertificateOrderAction is -type ListCertificateOrderAction struct { - autorest.Response `json:"-"` - Value *[]CertificateOrderAction `json:"value,omitempty"` -} - -// ListHostingEnvironmentDiagnostics is -type ListHostingEnvironmentDiagnostics struct { - autorest.Response `json:"-"` - Value *[]HostingEnvironmentDiagnostics `json:"value,omitempty"` -} - -// ListOperation is -type ListOperation struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` -} - -// ListRecommendation is -type ListRecommendation struct { - autorest.Response `json:"-"` - Value *[]Recommendation `json:"value,omitempty"` -} - -// ListSiteConfigurationSnapshotInfo is -type ListSiteConfigurationSnapshotInfo struct { - autorest.Response `json:"-"` - Value *[]SiteConfigurationSnapshotInfo `json:"value,omitempty"` -} - -// ListVnetInfo is -type ListVnetInfo struct { - autorest.Response `json:"-"` - Value *[]VnetInfo `json:"value,omitempty"` -} - -// ListVnetRoute is -type ListVnetRoute struct { - autorest.Response `json:"-"` - Value *[]VnetRoute `json:"value,omitempty"` -} - -// LocalizableString is localizable string object containing the name and a -// localized value. -type LocalizableString struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MetricAvailabilily is metric availability and retention. -type MetricAvailabilily struct { - TimeGrain *string `json:"timeGrain,omitempty"` - Retention *string `json:"retention,omitempty"` -} - -// MetricDefinition is metadata for a metric. -type MetricDefinition struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *MetricDefinitionProperties `json:"properties,omitempty"` -} - -// MetricDefinitionProperties is metricDefinition resource specific properties -type MetricDefinitionProperties struct { - Name *string `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - PrimaryAggregationType *string `json:"primaryAggregationType,omitempty"` - MetricAvailabilities *[]MetricAvailabilily `json:"metricAvailabilities,omitempty"` - DisplayName *string `json:"displayName,omitempty"` -} - -// MigrateMySQLRequest is mySQL migration request. -type MigrateMySQLRequest struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *MigrateMySQLRequestProperties `json:"properties,omitempty"` -} - -// MigrateMySQLRequestProperties is migrateMySqlRequest resource specific -// properties -type MigrateMySQLRequestProperties struct { - ConnectionString *string `json:"connectionString,omitempty"` -} - -// MigrateMySQLStatus is mySQL migration status. -type MigrateMySQLStatus struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *MigrateMySQLStatusProperties `json:"properties,omitempty"` -} - -// MigrateMySQLStatusProperties is migrateMySqlStatus resource specific -// properties -type MigrateMySQLStatusProperties struct { - MigrationOperationStatus OperationStatus `json:"migrationOperationStatus,omitempty"` - OperationID *string `json:"operationId,omitempty"` - LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` -} - -// NameIdentifier is identifies an object. -type NameIdentifier struct { - Name *string `json:"name,omitempty"` -} - -// NameIdentifierCollection is collection of domain name identifiers. -type NameIdentifierCollection struct { - autorest.Response `json:"-"` - Value *[]NameIdentifier `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// NameIdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client NameIdentifierCollection) NameIdentifierCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// NameValuePair is name value pair. -type NameValuePair struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} - -// NetworkAccessControlEntry is network access control entry. -type NetworkAccessControlEntry struct { - Action AccessControlEntryAction `json:"action,omitempty"` - Description *string `json:"description,omitempty"` - Order *int32 `json:"order,omitempty"` - RemoteSubnet *string `json:"remoteSubnet,omitempty"` -} - -// NetworkFeatures is full view of network features for an app (presently VNET -// integration and Hybrid Connections). -type NetworkFeatures struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *NetworkFeaturesProperties `json:"properties,omitempty"` -} - -// NetworkFeaturesProperties is networkFeatures resource specific properties -type NetworkFeaturesProperties struct { - VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` - VirtualNetworkConnection *VnetInfo `json:"virtualNetworkConnection,omitempty"` - HybridConnections *[]RelayServiceConnectionEntity `json:"hybridConnections,omitempty"` - HybridConnectionsV2 *[]HybridConnection `json:"hybridConnectionsV2,omitempty"` -} - -// Operation is operation. -type Operation struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Status OperationStatus `json:"status,omitempty"` - Errors *[]ErrorEntity `json:"errors,omitempty"` - CreatedTime *date.Time `json:"createdTime,omitempty"` - ModifiedTime *date.Time `json:"modifiedTime,omitempty"` - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - GeoMasterOperationID *string `json:"geoMasterOperationId,omitempty"` -} - -// PerfMonCounterCollection is collection of performance monitor counters. -type PerfMonCounterCollection struct { - autorest.Response `json:"-"` - Value *[]PerfMonResponse `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PerfMonCounterCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PerfMonCounterCollection) PerfMonCounterCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PerfMonResponse is performance monitor API response. -type PerfMonResponse struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Data *PerfMonSet `json:"data,omitempty"` -} - -// PerfMonSample is performance monitor sample in a set. -type PerfMonSample struct { - Time *date.Time `json:"time,omitempty"` - InstanceName *string `json:"instanceName,omitempty"` - Value *float64 `json:"value,omitempty"` -} - -// PerfMonSet is metric information. -type PerfMonSet struct { - Name *string `json:"name,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - TimeGrain *string `json:"timeGrain,omitempty"` - Values *[]PerfMonSample `json:"values,omitempty"` -} - -// PremierAddOn is premier add-on. -type PremierAddOn struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *PremierAddOnProperties `json:"properties,omitempty"` -} - -// PremierAddOnProperties is premierAddOn resource specific properties -type PremierAddOnProperties struct { - Sku *string `json:"sku,omitempty"` - Product *string `json:"product,omitempty"` - Vendor *string `json:"vendor,omitempty"` - PremierAddOnName *string `json:"name,omitempty"` - Location *string `json:"location,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` - MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` -} - -// PremierAddOnOffer is premier add-on offer. -type PremierAddOnOffer struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *PremierAddOnOfferProperties `json:"properties,omitempty"` -} - -// PremierAddOnOfferProperties is premierAddOnOffer resource specific -// properties -type PremierAddOnOfferProperties struct { - Sku *string `json:"sku,omitempty"` - Product *string `json:"product,omitempty"` - Vendor *string `json:"vendor,omitempty"` - Name *string `json:"name,omitempty"` - PromoCodeRequired *bool `json:"promoCodeRequired,omitempty"` - Quota *int32 `json:"quota,omitempty"` - WebHostingPlanRestrictions AppServicePlanRestrictions `json:"webHostingPlanRestrictions,omitempty"` - PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` - LegalTermsURL *string `json:"legalTermsUrl,omitempty"` - MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` - MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` -} - -// PremierAddOnOfferCollection is collection of premier add-on offers. -type PremierAddOnOfferCollection struct { - autorest.Response `json:"-"` - Value *[]PremierAddOnOffer `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// PremierAddOnOfferCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client PremierAddOnOfferCollection) PremierAddOnOfferCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// PushSettings is push settings for the App. -type PushSettings struct { - autorest.Response `json:"-"` - IsPushEnabled *bool `json:"isPushEnabled,omitempty"` - TagWhitelistJSON *string `json:"tagWhitelistJson,omitempty"` - TagsRequiringAuth *string `json:"tagsRequiringAuth,omitempty"` - DynamicTagsJSON *string `json:"dynamicTagsJson,omitempty"` -} - -// RampUpRule is routing rules for ramp up testing. This rule allows to -// redirect static traffic % to a slot or to gradually change routing % based -// on performance. -type RampUpRule struct { - ActionHostName *string `json:"actionHostName,omitempty"` - ReroutePercentage *float64 `json:"reroutePercentage,omitempty"` - ChangeStep *float64 `json:"changeStep,omitempty"` - ChangeIntervalInMinutes *int32 `json:"changeIntervalInMinutes,omitempty"` - MinReroutePercentage *float64 `json:"minReroutePercentage,omitempty"` - MaxReroutePercentage *float64 `json:"maxReroutePercentage,omitempty"` - ChangeDecisionCallbackURL *string `json:"changeDecisionCallbackUrl,omitempty"` - Name *string `json:"name,omitempty"` -} - -// ReadCloser is -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} - -// Recommendation is represents a recommendation result generated by the -// recommendation engine. -type Recommendation struct { - CreationTime *date.Time `json:"creationTime,omitempty"` - RecommendationID *string `json:"recommendationId,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - ResourceScope ResourceScopeType `json:"resourceScope,omitempty"` - RuleName *string `json:"ruleName,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Message *string `json:"message,omitempty"` - Level NotificationLevel `json:"level,omitempty"` - Channels Channels `json:"channels,omitempty"` - Tags *[]string `json:"tags,omitempty"` - ActionName *string `json:"actionName,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - NextNotificationTime *date.Time `json:"nextNotificationTime,omitempty"` - NotificationExpirationTime *date.Time `json:"notificationExpirationTime,omitempty"` - NotifiedTime *date.Time `json:"notifiedTime,omitempty"` - Score *float64 `json:"score,omitempty"` - IsDynamic *bool `json:"isDynamic,omitempty"` - ExtensionName *string `json:"extensionName,omitempty"` - BladeName *string `json:"bladeName,omitempty"` - ForwardLink *string `json:"forwardLink,omitempty"` -} - -// RecommendationRule is represents a recommendation rule that the -// recommendation engine can perform. -type RecommendationRule struct { - autorest.Response `json:"-"` - Name *string `json:"name,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - Message *string `json:"message,omitempty"` - RecommendationID *uuid.UUID `json:"recommendationId,omitempty"` - Description *string `json:"description,omitempty"` - ActionName *string `json:"actionName,omitempty"` - Level NotificationLevel `json:"level,omitempty"` - Channels Channels `json:"channels,omitempty"` - Tags *[]string `json:"tags,omitempty"` - IsDynamic *bool `json:"isDynamic,omitempty"` - ExtensionName *string `json:"extensionName,omitempty"` - BladeName *string `json:"bladeName,omitempty"` - ForwardLink *string `json:"forwardLink,omitempty"` -} - -// RecoverResponse is response for an app recovery request. -type RecoverResponse struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RecoverResponseProperties `json:"properties,omitempty"` -} - -// RecoverResponseProperties is recoverResponse resource specific properties -type RecoverResponseProperties struct { - OperationID *string `json:"operationId,omitempty"` -} - -// ReissueCertificateOrderRequest is class representing certificate reissue -// request. -type ReissueCertificateOrderRequest struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ReissueCertificateOrderRequestProperties `json:"properties,omitempty"` -} - -// ReissueCertificateOrderRequestProperties is reissueCertificateOrderRequest -// resource specific properties -type ReissueCertificateOrderRequestProperties struct { - KeySize *int32 `json:"keySize,omitempty"` - DelayExistingRevokeInHours *int32 `json:"delayExistingRevokeInHours,omitempty"` - Csr *string `json:"csr,omitempty"` - IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` -} - -// RelayServiceConnectionEntity is hybrid Connection for an App Service app. -type RelayServiceConnectionEntity struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RelayServiceConnectionEntityProperties `json:"properties,omitempty"` -} - -// RelayServiceConnectionEntityProperties is relayServiceConnectionEntity -// resource specific properties -type RelayServiceConnectionEntityProperties struct { - EntityName *string `json:"entityName,omitempty"` - EntityConnectionString *string `json:"entityConnectionString,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` - ResourceConnectionString *string `json:"resourceConnectionString,omitempty"` - Hostname *string `json:"hostname,omitempty"` - Port *int32 `json:"port,omitempty"` - BiztalkURI *string `json:"biztalkUri,omitempty"` -} - -// RenewCertificateOrderRequest is class representing certificate renew -// request. -type RenewCertificateOrderRequest struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RenewCertificateOrderRequestProperties `json:"properties,omitempty"` -} - -// RenewCertificateOrderRequestProperties is renewCertificateOrderRequest -// resource specific properties -type RenewCertificateOrderRequestProperties struct { - KeySize *int32 `json:"keySize,omitempty"` - Csr *string `json:"csr,omitempty"` - IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` -} - -// RequestsBasedTrigger is trigger based on total requests. -type RequestsBasedTrigger struct { - Count *int32 `json:"count,omitempty"` - TimeInterval *string `json:"timeInterval,omitempty"` -} - -// Resource is azure resource. -type Resource struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// ResourceCollection is collection of resources. -type ResourceCollection struct { - autorest.Response `json:"-"` - Value *[]string `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceCollection) ResourceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResourceHealthMetadata is used for getting ResourceHealthCheck settings. -type ResourceHealthMetadata struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ResourceHealthMetadataProperties `json:"properties,omitempty"` -} - -// ResourceHealthMetadataProperties is resourceHealthMetadata resource specific -// properties -type ResourceHealthMetadataProperties struct { - ID *string `json:"id,omitempty"` - Category *string `json:"category,omitempty"` - SignalAvailability *bool `json:"signalAvailability,omitempty"` -} - -// ResourceMetric is object representing a metric for any resource . -type ResourceMetric struct { - Name *ResourceMetricName `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - TimeGrain *string `json:"timeGrain,omitempty"` - StartTime *date.Time `json:"startTime,omitempty"` - EndTime *date.Time `json:"endTime,omitempty"` - ResourceID *string `json:"resourceId,omitempty"` - ID *string `json:"id,omitempty"` - MetricValues *[]ResourceMetricValue `json:"metricValues,omitempty"` - Properties *[]ResourceMetricProperty `json:"properties,omitempty"` -} - -// ResourceMetricAvailability is metrics availability and retention. -type ResourceMetricAvailability struct { - TimeGrain *string `json:"timeGrain,omitempty"` - Retention *string `json:"retention,omitempty"` -} - -// ResourceMetricCollection is collection of metric responses. -type ResourceMetricCollection struct { - autorest.Response `json:"-"` - Value *[]ResourceMetric `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceMetricCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceMetricCollection) ResourceMetricCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResourceMetricDefinition is metadata for the metrics. -type ResourceMetricDefinition struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *ResourceMetricDefinitionProperties `json:"properties,omitempty"` -} - -// ResourceMetricDefinitionProperties is resourceMetricDefinition resource -// specific properties -type ResourceMetricDefinitionProperties struct { - Name *ResourceMetricName `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` - PrimaryAggregationType *string `json:"primaryAggregationType,omitempty"` - MetricAvailabilities *[]ResourceMetricAvailability `json:"metricAvailabilities,omitempty"` - ResourceURI *string `json:"resourceUri,omitempty"` - ID *string `json:"id,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} - -// ResourceMetricDefinitionCollection is collection of metric definitions. -type ResourceMetricDefinitionCollection struct { - autorest.Response `json:"-"` - Value *[]ResourceMetricDefinition `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceMetricDefinitionCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client ResourceMetricDefinitionCollection) ResourceMetricDefinitionCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// ResourceMetricName is name of a metric for any resource . -type ResourceMetricName struct { - Value *string `json:"value,omitempty"` - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// ResourceMetricProperty is resource metric property. -type ResourceMetricProperty struct { - Key *string `json:"key,omitempty"` - Value *string `json:"value,omitempty"` -} - -// ResourceMetricValue is value of resource metric. -type ResourceMetricValue struct { - Timestamp *string `json:"timestamp,omitempty"` - Average *float64 `json:"average,omitempty"` - Minimum *float64 `json:"minimum,omitempty"` - Maximum *float64 `json:"maximum,omitempty"` - Total *float64 `json:"total,omitempty"` - Count *float64 `json:"count,omitempty"` - Properties *[]ResourceMetricProperty `json:"properties,omitempty"` -} - -// ResourceNameAvailability is information regarding availbility of a resource -// name. -type ResourceNameAvailability struct { - autorest.Response `json:"-"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason InAvailabilityReasonType `json:"reason,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ResourceNameAvailabilityRequest is resource name availability request -// content. -type ResourceNameAvailabilityRequest struct { - Name *string `json:"name,omitempty"` - Type CheckNameResourceTypes `json:"type,omitempty"` - IsFqdn *bool `json:"isFqdn,omitempty"` -} - -// RestoreRequest is description of a restore request. -type RestoreRequest struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RestoreRequestProperties `json:"properties,omitempty"` -} - -// RestoreRequestProperties is restoreRequest resource specific properties -type RestoreRequestProperties struct { - StorageAccountURL *string `json:"storageAccountUrl,omitempty"` - BlobName *string `json:"blobName,omitempty"` - Overwrite *bool `json:"overwrite,omitempty"` - SiteName *string `json:"siteName,omitempty"` - Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` - IgnoreConflictingHostNames *bool `json:"ignoreConflictingHostNames,omitempty"` - OperationType BackupRestoreOperationType `json:"operationType,omitempty"` - AdjustConnectionStrings *bool `json:"adjustConnectionStrings,omitempty"` - HostingEnvironment *string `json:"hostingEnvironment,omitempty"` -} - -// RestoreResponse is response for an app restore request. -type RestoreResponse struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *RestoreResponseProperties `json:"properties,omitempty"` -} - -// RestoreResponseProperties is restoreResponse resource specific properties -type RestoreResponseProperties struct { - OperationID *string `json:"operationId,omitempty"` -} - -// SetObject is -type SetObject struct { - autorest.Response `json:"-"` - Value *map[string]interface{} `json:"value,omitempty"` -} - -// Site is a web app, a mobile app backend, or an API app. -type Site struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteProperties `json:"properties,omitempty"` -} - -// SiteProperties is site resource specific properties -type SiteProperties struct { - State *string `json:"state,omitempty"` - HostNames *[]string `json:"hostNames,omitempty"` - RepositorySiteName *string `json:"repositorySiteName,omitempty"` - UsageState UsageState `json:"usageState,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - EnabledHostNames *[]string `json:"enabledHostNames,omitempty"` - AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` - HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` - ServerFarmID *string `json:"serverFarmId,omitempty"` - Reserved *bool `json:"reserved,omitempty"` - LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` - SiteConfig *SiteConfig `json:"siteConfig,omitempty"` - TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` - PremiumAppDeployed *bool `json:"premiumAppDeployed,omitempty"` - ScmSiteAlsoStopped *bool `json:"scmSiteAlsoStopped,omitempty"` - TargetSwapSlot *string `json:"targetSwapSlot,omitempty"` - HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` - MicroService *string `json:"microService,omitempty"` - GatewaySiteName *string `json:"gatewaySiteName,omitempty"` - ClientAffinityEnabled *bool `json:"clientAffinityEnabled,omitempty"` - ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` - HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` - OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` - ContainerSize *int32 `json:"containerSize,omitempty"` - DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` - SuspendedTill *date.Time `json:"suspendedTill,omitempty"` - MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` - CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` - ResourceGroup *string `json:"resourceGroup,omitempty"` - IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` - DefaultHostName *string `json:"defaultHostName,omitempty"` - SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` -} - -// SiteAuthSettings is configuration settings for the Azure App Service -// Authentication / Authorization feature. -type SiteAuthSettings struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteAuthSettingsProperties `json:"properties,omitempty"` -} - -// SiteAuthSettingsProperties is siteAuthSettings resource specific properties -type SiteAuthSettingsProperties struct { - Enabled *bool `json:"enabled,omitempty"` - RuntimeVersion *string `json:"runtimeVersion,omitempty"` - UnauthenticatedClientAction UnauthenticatedClientAction `json:"unauthenticatedClientAction,omitempty"` - TokenStoreEnabled *bool `json:"tokenStoreEnabled,omitempty"` - AllowedExternalRedirectUrls *[]string `json:"allowedExternalRedirectUrls,omitempty"` - DefaultProvider BuiltInAuthenticationProvider `json:"defaultProvider,omitempty"` - TokenRefreshExtensionHours *float64 `json:"tokenRefreshExtensionHours,omitempty"` - ClientID *string `json:"clientId,omitempty"` - ClientSecret *string `json:"clientSecret,omitempty"` - Issuer *string `json:"issuer,omitempty"` - AllowedAudiences *[]string `json:"allowedAudiences,omitempty"` - AdditionalLoginParams *[]string `json:"additionalLoginParams,omitempty"` - GoogleClientID *string `json:"googleClientId,omitempty"` - GoogleClientSecret *string `json:"googleClientSecret,omitempty"` - GoogleOAuthScopes *[]string `json:"googleOAuthScopes,omitempty"` - FacebookAppID *string `json:"facebookAppId,omitempty"` - FacebookAppSecret *string `json:"facebookAppSecret,omitempty"` - FacebookOAuthScopes *[]string `json:"facebookOAuthScopes,omitempty"` - TwitterConsumerKey *string `json:"twitterConsumerKey,omitempty"` - TwitterConsumerSecret *string `json:"twitterConsumerSecret,omitempty"` - MicrosoftAccountClientID *string `json:"microsoftAccountClientId,omitempty"` - MicrosoftAccountClientSecret *string `json:"microsoftAccountClientSecret,omitempty"` - MicrosoftAccountOAuthScopes *[]string `json:"microsoftAccountOAuthScopes,omitempty"` -} - -// SiteCloneability is represents whether or not an app is cloneable. -type SiteCloneability struct { - autorest.Response `json:"-"` - Result CloneAbilityResult `json:"result,omitempty"` - BlockingFeatures *[]SiteCloneabilityCriterion `json:"blockingFeatures,omitempty"` - UnsupportedFeatures *[]SiteCloneabilityCriterion `json:"unsupportedFeatures,omitempty"` - BlockingCharacteristics *[]SiteCloneabilityCriterion `json:"blockingCharacteristics,omitempty"` -} - -// SiteCloneabilityCriterion is an app cloneability criterion. -type SiteCloneabilityCriterion struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` -} - -// SiteConfig is configuration of an App Service app. -type SiteConfig struct { - NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` - DefaultDocuments *[]string `json:"defaultDocuments,omitempty"` - NetFrameworkVersion *string `json:"netFrameworkVersion,omitempty"` - PhpVersion *string `json:"phpVersion,omitempty"` - PythonVersion *string `json:"pythonVersion,omitempty"` - NodeVersion *string `json:"nodeVersion,omitempty"` - LinuxFxVersion *string `json:"linuxFxVersion,omitempty"` - RequestTracingEnabled *bool `json:"requestTracingEnabled,omitempty"` - RequestTracingExpirationTime *date.Time `json:"requestTracingExpirationTime,omitempty"` - RemoteDebuggingEnabled *bool `json:"remoteDebuggingEnabled,omitempty"` - RemoteDebuggingVersion *string `json:"remoteDebuggingVersion,omitempty"` - HTTPLoggingEnabled *bool `json:"httpLoggingEnabled,omitempty"` - LogsDirectorySizeLimit *int32 `json:"logsDirectorySizeLimit,omitempty"` - DetailedErrorLoggingEnabled *bool `json:"detailedErrorLoggingEnabled,omitempty"` - PublishingUsername *string `json:"publishingUsername,omitempty"` - AppSettings *[]NameValuePair `json:"appSettings,omitempty"` - ConnectionStrings *[]ConnStringInfo `json:"connectionStrings,omitempty"` - MachineKey *SiteMachineKey `json:"machineKey,omitempty"` - HandlerMappings *[]HandlerMapping `json:"handlerMappings,omitempty"` - DocumentRoot *string `json:"documentRoot,omitempty"` - ScmType ScmType `json:"scmType,omitempty"` - Use32BitWorkerProcess *bool `json:"use32BitWorkerProcess,omitempty"` - WebSocketsEnabled *bool `json:"webSocketsEnabled,omitempty"` - AlwaysOn *bool `json:"alwaysOn,omitempty"` - JavaVersion *string `json:"javaVersion,omitempty"` - JavaContainer *string `json:"javaContainer,omitempty"` - JavaContainerVersion *string `json:"javaContainerVersion,omitempty"` - AppCommandLine *string `json:"appCommandLine,omitempty"` - ManagedPipelineMode ManagedPipelineMode `json:"managedPipelineMode,omitempty"` - VirtualApplications *[]VirtualApplication `json:"virtualApplications,omitempty"` - LoadBalancing SiteLoadBalancing `json:"loadBalancing,omitempty"` - Experiments *Experiments `json:"experiments,omitempty"` - Limits *SiteLimits `json:"limits,omitempty"` - AutoHealEnabled *bool `json:"autoHealEnabled,omitempty"` - AutoHealRules *AutoHealRules `json:"autoHealRules,omitempty"` - TracingOptions *string `json:"tracingOptions,omitempty"` - VnetName *string `json:"vnetName,omitempty"` - Cors *CorsSettings `json:"cors,omitempty"` - Push *PushSettings `json:"push,omitempty"` - APIDefinition *APIDefinitionInfo `json:"apiDefinition,omitempty"` - AutoSwapSlotName *string `json:"autoSwapSlotName,omitempty"` - LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` - IPSecurityRestrictions *[]IPSecurityRestriction `json:"ipSecurityRestrictions,omitempty"` -} - -// SiteConfigResource is web app configuration ARM resource. -type SiteConfigResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteConfig `json:"properties,omitempty"` -} - -// SiteConfigResourceCollection is collection of site configurations. -type SiteConfigResourceCollection struct { - autorest.Response `json:"-"` - Value *[]SiteConfigResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SiteConfigResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SiteConfigResourceCollection) SiteConfigResourceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SiteConfigurationSnapshotInfo is a snapshot of a web app configuration. -type SiteConfigurationSnapshotInfo struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteConfigurationSnapshotInfoProperties `json:"properties,omitempty"` -} - -// SiteConfigurationSnapshotInfoProperties is siteConfigurationSnapshotInfo -// resource specific properties -type SiteConfigurationSnapshotInfoProperties struct { - Time *date.Time `json:"time,omitempty"` - ID *int32 `json:"id,omitempty"` -} - -// SiteInstance is instance of an app. -type SiteInstance struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteInstanceProperties `json:"properties,omitempty"` -} - -// SiteInstanceProperties is siteInstance resource specific properties -type SiteInstanceProperties struct { - Name *string `json:"name,omitempty"` -} - -// SiteLimits is metric limits set on an app. -type SiteLimits struct { - MaxPercentageCPU *float64 `json:"maxPercentageCpu,omitempty"` - MaxMemoryInMb *int64 `json:"maxMemoryInMb,omitempty"` - MaxDiskSizeInMb *int64 `json:"maxDiskSizeInMb,omitempty"` -} - -// SiteLogsConfig is configuration of App Service site logs. -type SiteLogsConfig struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteLogsConfigProperties `json:"properties,omitempty"` -} - -// SiteLogsConfigProperties is siteLogsConfig resource specific properties -type SiteLogsConfigProperties struct { - ApplicationLogs *ApplicationLogsConfig `json:"applicationLogs,omitempty"` - HTTPLogs *HTTPLogsConfig `json:"httpLogs,omitempty"` - FailedRequestsTracing *EnabledConfig `json:"failedRequestsTracing,omitempty"` - DetailedErrorMessages *EnabledConfig `json:"detailedErrorMessages,omitempty"` -} - -// SiteMachineKey is machineKey of an app. -type SiteMachineKey struct { - Validation *string `json:"validation,omitempty"` - ValidationKey *string `json:"validationKey,omitempty"` - Decryption *string `json:"decryption,omitempty"` - DecryptionKey *string `json:"decryptionKey,omitempty"` -} - -// SitePhpErrorLogFlag is used for getting PHP error logging flag. -type SitePhpErrorLogFlag struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SitePhpErrorLogFlagProperties `json:"properties,omitempty"` -} - -// SitePhpErrorLogFlagProperties is sitePhpErrorLogFlag resource specific -// properties -type SitePhpErrorLogFlagProperties struct { - LocalLogErrors *string `json:"localLogErrors,omitempty"` - MasterLogErrors *string `json:"masterLogErrors,omitempty"` - LocalLogErrorsMaxLength *string `json:"localLogErrorsMaxLength,omitempty"` - MasterLogErrorsMaxLength *string `json:"masterLogErrorsMaxLength,omitempty"` -} - -// SiteSeal is site seal -type SiteSeal struct { - autorest.Response `json:"-"` - *string `json:"html,omitempty"` -} - -// SiteSealRequest is site seal request. -type SiteSealRequest struct { - LightTheme *bool `json:"lightTheme,omitempty"` - Locale *string `json:"locale,omitempty"` -} - -// SiteSourceControl is source control configuration for an app. -type SiteSourceControl struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SiteSourceControlProperties `json:"properties,omitempty"` -} - -// SiteSourceControlProperties is siteSourceControl resource specific -// properties -type SiteSourceControlProperties struct { - RepoURL *string `json:"repoUrl,omitempty"` - Branch *string `json:"branch,omitempty"` - IsManualIntegration *bool `json:"isManualIntegration,omitempty"` - DeploymentRollbackEnabled *bool `json:"deploymentRollbackEnabled,omitempty"` - IsMercurial *bool `json:"isMercurial,omitempty"` -} - -// SkuCapacity is description of the App Service plan scale options. -type SkuCapacity struct { - Minimum *int32 `json:"minimum,omitempty"` - Maximum *int32 `json:"maximum,omitempty"` - Default *int32 `json:"default,omitempty"` - ScaleType *string `json:"scaleType,omitempty"` -} - -// SkuDescription is description of a SKU for a scalable resource. -type SkuDescription struct { - Name *string `json:"name,omitempty"` - Tier *string `json:"tier,omitempty"` - Size *string `json:"size,omitempty"` - Family *string `json:"family,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` - SkuCapacity *SkuCapacity `json:"skuCapacity,omitempty"` - Locations *[]string `json:"locations,omitempty"` - Capabilities *[]Capability `json:"capabilities,omitempty"` -} - -// SkuInfo is sKU discovery information. -type SkuInfo struct { - ResourceType *string `json:"resourceType,omitempty"` - Sku *SkuDescription `json:"sku,omitempty"` - Capacity *SkuCapacity `json:"capacity,omitempty"` -} - -// SkuInfoCollection is collection of SKU information. -type SkuInfoCollection struct { - autorest.Response `json:"-"` - Value *[]SkuInfo `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SkuInfoCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SkuInfoCollection) SkuInfoCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SkuInfos is collection of SKU information. -type SkuInfos struct { - autorest.Response `json:"-"` - ResourceType *string `json:"resourceType,omitempty"` - Skus *[]GlobalCsmSkuDescription `json:"skus,omitempty"` -} - -// SlotConfigNames is names for connection strings and application settings to -// be marked as sticky to the deployment slot and not moved during a swap -// operation. -// This is valid for all deployment slots in an app. -type SlotConfigNames struct { - ConnectionStringNames *[]string `json:"connectionStringNames,omitempty"` - AppSettingNames *[]string `json:"appSettingNames,omitempty"` -} - -// SlotConfigNamesResource is slot Config names azure resource. -type SlotConfigNamesResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SlotConfigNames `json:"properties,omitempty"` -} - -// SlotDifference is a setting difference between two deployment slots of an -// app. -type SlotDifference struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SlotDifferenceProperties `json:"properties,omitempty"` -} - -// SlotDifferenceProperties is slotDifference resource specific properties -type SlotDifferenceProperties struct { - Type *string `json:"type,omitempty"` - SettingType *string `json:"settingType,omitempty"` - DiffRule *string `json:"diffRule,omitempty"` - SettingName *string `json:"settingName,omitempty"` - ValueInCurrentSlot *string `json:"valueInCurrentSlot,omitempty"` - ValueInTargetSlot *string `json:"valueInTargetSlot,omitempty"` - Description *string `json:"description,omitempty"` -} - -// SlotDifferenceCollection is collection of slot differences. -type SlotDifferenceCollection struct { - autorest.Response `json:"-"` - Value *[]SlotDifference `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SlotDifferenceCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SlotDifferenceCollection) SlotDifferenceCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SlotSwapStatus is the status of the last successfull slot swap operation. -type SlotSwapStatus struct { - TimestampUtc *date.Time `json:"timestampUtc,omitempty"` - SourceSlotName *string `json:"sourceSlotName,omitempty"` - DestinationSlotName *string `json:"destinationSlotName,omitempty"` -} - -// SlowRequestsBasedTrigger is trigger based on request execution time. -type SlowRequestsBasedTrigger struct { - TimeTaken *string `json:"timeTaken,omitempty"` - Count *int32 `json:"count,omitempty"` - TimeInterval *string `json:"timeInterval,omitempty"` -} - -// Snapshot is a snapshot of an app. -type Snapshot struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SnapshotProperties `json:"properties,omitempty"` -} - -// SnapshotProperties is snapshot resource specific properties -type SnapshotProperties struct { - Time *date.Time `json:"time,omitempty"` -} - -// SnapshotCollection is collection of snapshots which can be used to revert an -// app to a previous time. -type SnapshotCollection struct { - autorest.Response `json:"-"` - Value *[]Snapshot `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SnapshotCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SnapshotCollection) SnapshotCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SourceControl is the source control OAuth token. -type SourceControl struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *SourceControlProperties `json:"properties,omitempty"` -} - -// SourceControlProperties is sourceControl resource specific properties -type SourceControlProperties struct { - Name *string `json:"name,omitempty"` - Token *string `json:"token,omitempty"` - TokenSecret *string `json:"tokenSecret,omitempty"` - RefreshToken *string `json:"refreshToken,omitempty"` - ExpirationTime *date.Time `json:"expirationTime,omitempty"` -} - -// SourceControlCollection is collection of source controls. -type SourceControlCollection struct { - autorest.Response `json:"-"` - Value *[]SourceControl `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SourceControlCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SourceControlCollection) SourceControlCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// StampCapacity is stamp capacity information. -type StampCapacity struct { - Name *string `json:"name,omitempty"` - AvailableCapacity *int64 `json:"availableCapacity,omitempty"` - TotalCapacity *int64 `json:"totalCapacity,omitempty"` - Unit *string `json:"unit,omitempty"` - ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` - WorkerSize WorkerSizeOptions `json:"workerSize,omitempty"` - WorkerSizeID *int32 `json:"workerSizeId,omitempty"` - ExcludeFromCapacityAllocation *bool `json:"excludeFromCapacityAllocation,omitempty"` - IsApplicableForAllComputeModes *bool `json:"isApplicableForAllComputeModes,omitempty"` - SiteMode *string `json:"siteMode,omitempty"` -} - -// StampCapacityCollection is collection of stamp capacities. -type StampCapacityCollection struct { - autorest.Response `json:"-"` - Value *[]StampCapacity `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// StampCapacityCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client StampCapacityCollection) StampCapacityCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// StatusCodesBasedTrigger is trigger based on status code. -type StatusCodesBasedTrigger struct { - Status *int32 `json:"status,omitempty"` - SubStatus *int32 `json:"subStatus,omitempty"` - Win32Status *int32 `json:"win32Status,omitempty"` - Count *int32 `json:"count,omitempty"` - TimeInterval *string `json:"timeInterval,omitempty"` -} - -// StorageMigrationOptions is options for app content migration. -type StorageMigrationOptions struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *StorageMigrationOptionsProperties `json:"properties,omitempty"` -} - -// StorageMigrationOptionsProperties is storageMigrationOptions resource -// specific properties -type StorageMigrationOptionsProperties struct { - AzurefilesConnectionString *string `json:"azurefilesConnectionString,omitempty"` - AzurefilesShare *string `json:"azurefilesShare,omitempty"` - SwitchSiteAfterMigration *bool `json:"switchSiteAfterMigration,omitempty"` - BlockWriteAccessToSite *bool `json:"blockWriteAccessToSite,omitempty"` -} - -// StorageMigrationResponse is response for a migration of app content request. -type StorageMigrationResponse struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *StorageMigrationResponseProperties `json:"properties,omitempty"` -} - -// StorageMigrationResponseProperties is storageMigrationResponse resource -// specific properties -type StorageMigrationResponseProperties struct { - OperationID *string `json:"operationId,omitempty"` -} - -// String is -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// StringDictionary is string dictionary resource. -type StringDictionary struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Properties *map[string]*string `json:"properties,omitempty"` -} - -// TldLegalAgreement is legal agreement for a top level domain. -type TldLegalAgreement struct { - AgreementKey *string `json:"agreementKey,omitempty"` - Title *string `json:"title,omitempty"` - Content *string `json:"content,omitempty"` - URL *string `json:"url,omitempty"` -} - -// TldLegalAgreementCollection is collection of top-level domain legal -// agreements. -type TldLegalAgreementCollection struct { - autorest.Response `json:"-"` - Value *[]TldLegalAgreement `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// TldLegalAgreementCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client TldLegalAgreementCollection) TldLegalAgreementCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// TopLevelDomain is a top level domain object. -type TopLevelDomain struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *TopLevelDomainProperties `json:"properties,omitempty"` -} - -// TopLevelDomainProperties is topLevelDomain resource specific properties -type TopLevelDomainProperties struct { - DomainName *string `json:"name,omitempty"` - Privacy *bool `json:"privacy,omitempty"` -} - -// TopLevelDomainAgreementOption is options for retrieving the list of top -// level domain legal agreements. -type TopLevelDomainAgreementOption struct { - IncludePrivacy *bool `json:"includePrivacy,omitempty"` - ForTransfer *bool `json:"forTransfer,omitempty"` -} - -// TopLevelDomainCollection is collection of Top-level domains. -type TopLevelDomainCollection struct { - autorest.Response `json:"-"` - Value *[]TopLevelDomain `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// TopLevelDomainCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client TopLevelDomainCollection) TopLevelDomainCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// Usage is usage of the quota resource. -type Usage struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *UsageProperties `json:"properties,omitempty"` -} - -// UsageProperties is usage resource specific properties -type UsageProperties struct { - DisplayName *string `json:"displayName,omitempty"` - Name *string `json:"name,omitempty"` - ResourceName *string `json:"resourceName,omitempty"` - Unit *string `json:"unit,omitempty"` - CurrentValue *int64 `json:"currentValue,omitempty"` - Limit *int64 `json:"limit,omitempty"` - NextResetTime *date.Time `json:"nextResetTime,omitempty"` - ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` - SiteMode *string `json:"siteMode,omitempty"` -} - -// UsageCollection is collection of usages. -type UsageCollection struct { - autorest.Response `json:"-"` - Value *[]Usage `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// UsageCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client UsageCollection) UsageCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// User is user crendentials used for publishing activity. -type User struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *UserProperties `json:"properties,omitempty"` -} - -// UserProperties is user resource specific properties -type UserProperties struct { - UserName *string `json:"name,omitempty"` - PublishingUserName *string `json:"publishingUserName,omitempty"` - PublishingPassword *string `json:"publishingPassword,omitempty"` - PublishingPasswordHash *string `json:"publishingPasswordHash,omitempty"` - PublishingPasswordHashSalt *string `json:"publishingPasswordHashSalt,omitempty"` -} - -// ValidateProperties is app properties used for validation. -type ValidateProperties struct { - ServerFarmID *string `json:"serverFarmId,omitempty"` - SkuName *string `json:"skuName,omitempty"` - NeedLinuxWorkers *bool `json:"needLinuxWorkers,omitempty"` - Capacity *int32 `json:"capacity,omitempty"` - HostingEnvironment *string `json:"hostingEnvironment,omitempty"` -} - -// ValidateRequest is resource validation request content. -type ValidateRequest struct { - Name *string `json:"name,omitempty"` - Type ValidateResourceTypes `json:"type,omitempty"` - Location *string `json:"location,omitempty"` - *ValidateProperties `json:"properties,omitempty"` -} - -// ValidateResponse is describes the result of resource validation. -type ValidateResponse struct { - autorest.Response `json:"-"` - Status *string `json:"status,omitempty"` - Error *ValidateResponseError `json:"error,omitempty"` -} - -// ValidateResponseError is error details for when validation fails. -type ValidateResponseError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - -// VirtualApplication is virtual application in an app. -type VirtualApplication struct { - VirtualPath *string `json:"virtualPath,omitempty"` - PhysicalPath *string `json:"physicalPath,omitempty"` - PreloadEnabled *bool `json:"preloadEnabled,omitempty"` - VirtualDirectories *[]VirtualDirectory `json:"virtualDirectories,omitempty"` -} - -// VirtualDirectory is directory for virtual application. -type VirtualDirectory struct { - VirtualPath *string `json:"virtualPath,omitempty"` - PhysicalPath *string `json:"physicalPath,omitempty"` -} - -// VirtualIPMapping is virtual IP mapping. -type VirtualIPMapping struct { - VirtualIP *string `json:"virtualIP,omitempty"` - InternalHTTPPort *int32 `json:"internalHttpPort,omitempty"` - InternalHTTPSPort *int32 `json:"internalHttpsPort,omitempty"` - InUse *bool `json:"inUse,omitempty"` -} - -// VirtualNetworkProfile is specification for using a Virtual Network. -type VirtualNetworkProfile struct { - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - Subnet *string `json:"subnet,omitempty"` -} - -// VnetGateway is the Virtual Network gateway contract. This is used to give -// the Virtual Network gateway access to the VPN package. -type VnetGateway struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VnetGatewayProperties `json:"properties,omitempty"` -} - -// VnetGatewayProperties is vnetGateway resource specific properties -type VnetGatewayProperties struct { - VnetName *string `json:"vnetName,omitempty"` - VpnPackageURI *string `json:"vpnPackageUri,omitempty"` -} - -// VnetInfo is virtual Network information contract. -type VnetInfo struct { - autorest.Response `json:"-"` - VnetResourceID *string `json:"vnetResourceId,omitempty"` - CertThumbprint *string `json:"certThumbprint,omitempty"` - CertBlob *string `json:"certBlob,omitempty"` - Routes *[]VnetRoute `json:"routes,omitempty"` - ResyncRequired *bool `json:"resyncRequired,omitempty"` - DNSServers *string `json:"dnsServers,omitempty"` -} - -// VnetRoute is virtual Network route contract used to pass routing information -// for a Virtual Network. -type VnetRoute struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *VnetRouteProperties `json:"properties,omitempty"` -} - -// VnetRouteProperties is vnetRoute resource specific properties -type VnetRouteProperties struct { - VnetRouteName *string `json:"name,omitempty"` - StartAddress *string `json:"startAddress,omitempty"` - EndAddress *string `json:"endAddress,omitempty"` - RouteType RouteType `json:"routeType,omitempty"` -} - -// WorkerPool is worker pool of an App Service Environment. -type WorkerPool struct { - WorkerSizeID *int32 `json:"workerSizeId,omitempty"` - ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` - WorkerSize *string `json:"workerSize,omitempty"` - WorkerCount *int32 `json:"workerCount,omitempty"` - InstanceNames *[]string `json:"instanceNames,omitempty"` -} - -// WorkerPoolCollection is collection of worker pools. -type WorkerPoolCollection struct { - autorest.Response `json:"-"` - Value *[]WorkerPoolResource `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// WorkerPoolCollectionPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client WorkerPoolCollection) WorkerPoolCollectionPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// WorkerPoolResource is worker pool of an App Service Environment ARM -// resource. -type WorkerPoolResource struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Type *string `json:"type,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - *WorkerPool `json:"properties,omitempty"` - Sku *SkuDescription `json:"sku,omitempty"` -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/satori/uuid" + "io" + "net/http" +) + +// AccessControlEntryAction enumerates the values for access control entry +// action. +type AccessControlEntryAction string + +const ( + // Deny specifies the deny state for access control entry action. + Deny AccessControlEntryAction = "Deny" + // Permit specifies the permit state for access control entry action. + Permit AccessControlEntryAction = "Permit" +) + +// AppServicePlanRestrictions enumerates the values for app service plan +// restrictions. +type AppServicePlanRestrictions string + +const ( + // Basic specifies the basic state for app service plan restrictions. + Basic AppServicePlanRestrictions = "Basic" + // Free specifies the free state for app service plan restrictions. + Free AppServicePlanRestrictions = "Free" + // None specifies the none state for app service plan restrictions. + None AppServicePlanRestrictions = "None" + // Premium specifies the premium state for app service plan restrictions. + Premium AppServicePlanRestrictions = "Premium" + // Shared specifies the shared state for app service plan restrictions. + Shared AppServicePlanRestrictions = "Shared" + // Standard specifies the standard state for app service plan restrictions. + Standard AppServicePlanRestrictions = "Standard" +) + +// AutoHealActionType enumerates the values for auto heal action type. +type AutoHealActionType string + +const ( + // CustomAction specifies the custom action state for auto heal action + // type. + CustomAction AutoHealActionType = "CustomAction" + // LogEvent specifies the log event state for auto heal action type. + LogEvent AutoHealActionType = "LogEvent" + // Recycle specifies the recycle state for auto heal action type. + Recycle AutoHealActionType = "Recycle" +) + +// AzureResourceType enumerates the values for azure resource type. +type AzureResourceType string + +const ( + // TrafficManager specifies the traffic manager state for azure resource + // type. + TrafficManager AzureResourceType = "TrafficManager" + // Website specifies the website state for azure resource type. + Website AzureResourceType = "Website" +) + +// BackupItemStatus enumerates the values for backup item status. +type BackupItemStatus string + +const ( + // Created specifies the created state for backup item status. + Created BackupItemStatus = "Created" + // Deleted specifies the deleted state for backup item status. + Deleted BackupItemStatus = "Deleted" + // DeleteFailed specifies the delete failed state for backup item status. + DeleteFailed BackupItemStatus = "DeleteFailed" + // DeleteInProgress specifies the delete in progress state for backup item + // status. + DeleteInProgress BackupItemStatus = "DeleteInProgress" + // Failed specifies the failed state for backup item status. + Failed BackupItemStatus = "Failed" + // InProgress specifies the in progress state for backup item status. + InProgress BackupItemStatus = "InProgress" + // PartiallySucceeded specifies the partially succeeded state for backup + // item status. + PartiallySucceeded BackupItemStatus = "PartiallySucceeded" + // Skipped specifies the skipped state for backup item status. + Skipped BackupItemStatus = "Skipped" + // Succeeded specifies the succeeded state for backup item status. + Succeeded BackupItemStatus = "Succeeded" + // TimedOut specifies the timed out state for backup item status. + TimedOut BackupItemStatus = "TimedOut" +) + +// BackupRestoreOperationType enumerates the values for backup restore +// operation type. +type BackupRestoreOperationType string + +const ( + // Clone specifies the clone state for backup restore operation type. + Clone BackupRestoreOperationType = "Clone" + // Default specifies the default state for backup restore operation type. + Default BackupRestoreOperationType = "Default" + // Relocation specifies the relocation state for backup restore operation + // type. + Relocation BackupRestoreOperationType = "Relocation" +) + +// BuiltInAuthenticationProvider enumerates the values for built in +// authentication provider. +type BuiltInAuthenticationProvider string + +const ( + // AzureActiveDirectory specifies the azure active directory state for + // built in authentication provider. + AzureActiveDirectory BuiltInAuthenticationProvider = "AzureActiveDirectory" + // Facebook specifies the facebook state for built in authentication + // provider. + Facebook BuiltInAuthenticationProvider = "Facebook" + // Google specifies the google state for built in authentication provider. + Google BuiltInAuthenticationProvider = "Google" + // MicrosoftAccount specifies the microsoft account state for built in + // authentication provider. + MicrosoftAccount BuiltInAuthenticationProvider = "MicrosoftAccount" + // Twitter specifies the twitter state for built in authentication + // provider. + Twitter BuiltInAuthenticationProvider = "Twitter" +) + +// CertificateOrderActionType enumerates the values for certificate order +// action type. +type CertificateOrderActionType string + +const ( + // CertificateExpirationWarning specifies the certificate expiration + // warning state for certificate order action type. + CertificateExpirationWarning CertificateOrderActionType = "CertificateExpirationWarning" + // CertificateExpired specifies the certificate expired state for + // certificate order action type. + CertificateExpired CertificateOrderActionType = "CertificateExpired" + // CertificateIssued specifies the certificate issued state for certificate + // order action type. + CertificateIssued CertificateOrderActionType = "CertificateIssued" + // CertificateOrderCanceled specifies the certificate order canceled state + // for certificate order action type. + CertificateOrderCanceled CertificateOrderActionType = "CertificateOrderCanceled" + // CertificateOrderCreated specifies the certificate order created state + // for certificate order action type. + CertificateOrderCreated CertificateOrderActionType = "CertificateOrderCreated" + // CertificateRevoked specifies the certificate revoked state for + // certificate order action type. + CertificateRevoked CertificateOrderActionType = "CertificateRevoked" + // DomainValidationComplete specifies the domain validation complete state + // for certificate order action type. + DomainValidationComplete CertificateOrderActionType = "DomainValidationComplete" + // FraudCleared specifies the fraud cleared state for certificate order + // action type. + FraudCleared CertificateOrderActionType = "FraudCleared" + // FraudDetected specifies the fraud detected state for certificate order + // action type. + FraudDetected CertificateOrderActionType = "FraudDetected" + // FraudDocumentationRequired specifies the fraud documentation required + // state for certificate order action type. + FraudDocumentationRequired CertificateOrderActionType = "FraudDocumentationRequired" + // OrgNameChange specifies the org name change state for certificate order + // action type. + OrgNameChange CertificateOrderActionType = "OrgNameChange" + // OrgValidationComplete specifies the org validation complete state for + // certificate order action type. + OrgValidationComplete CertificateOrderActionType = "OrgValidationComplete" + // SanDrop specifies the san drop state for certificate order action type. + SanDrop CertificateOrderActionType = "SanDrop" + // Unknown specifies the unknown state for certificate order action type. + Unknown CertificateOrderActionType = "Unknown" +) + +// CertificateOrderStatus enumerates the values for certificate order status. +type CertificateOrderStatus string + +const ( + // Canceled specifies the canceled state for certificate order status. + Canceled CertificateOrderStatus = "Canceled" + // Denied specifies the denied state for certificate order status. + Denied CertificateOrderStatus = "Denied" + // Expired specifies the expired state for certificate order status. + Expired CertificateOrderStatus = "Expired" + // Issued specifies the issued state for certificate order status. + Issued CertificateOrderStatus = "Issued" + // NotSubmitted specifies the not submitted state for certificate order + // status. + NotSubmitted CertificateOrderStatus = "NotSubmitted" + // Pendingissuance specifies the pendingissuance state for certificate + // order status. + Pendingissuance CertificateOrderStatus = "Pendingissuance" + // PendingRekey specifies the pending rekey state for certificate order + // status. + PendingRekey CertificateOrderStatus = "PendingRekey" + // Pendingrevocation specifies the pendingrevocation state for certificate + // order status. + Pendingrevocation CertificateOrderStatus = "Pendingrevocation" + // Revoked specifies the revoked state for certificate order status. + Revoked CertificateOrderStatus = "Revoked" + // Unused specifies the unused state for certificate order status. + Unused CertificateOrderStatus = "Unused" +) + +// CertificateProductType enumerates the values for certificate product type. +type CertificateProductType string + +const ( + // StandardDomainValidatedSsl specifies the standard domain validated ssl + // state for certificate product type. + StandardDomainValidatedSsl CertificateProductType = "StandardDomainValidatedSsl" + // StandardDomainValidatedWildCardSsl specifies the standard domain + // validated wild card ssl state for certificate product type. + StandardDomainValidatedWildCardSsl CertificateProductType = "StandardDomainValidatedWildCardSsl" +) + +// Channels enumerates the values for channels. +type Channels string + +const ( + // All specifies the all state for channels. + All Channels = "All" + // API specifies the api state for channels. + API Channels = "Api" + // Email specifies the email state for channels. + Email Channels = "Email" + // Notification specifies the notification state for channels. + Notification Channels = "Notification" + // Webhook specifies the webhook state for channels. + Webhook Channels = "Webhook" +) + +// CheckNameResourceTypes enumerates the values for check name resource types. +type CheckNameResourceTypes string + +const ( + // CheckNameResourceTypesHostingEnvironment specifies the check name + // resource types hosting environment state for check name resource types. + CheckNameResourceTypesHostingEnvironment CheckNameResourceTypes = "HostingEnvironment" + // CheckNameResourceTypesSite specifies the check name resource types site + // state for check name resource types. + CheckNameResourceTypesSite CheckNameResourceTypes = "Site" + // CheckNameResourceTypesSlot specifies the check name resource types slot + // state for check name resource types. + CheckNameResourceTypesSlot CheckNameResourceTypes = "Slot" +) + +// CloneAbilityResult enumerates the values for clone ability result. +type CloneAbilityResult string + +const ( + // Cloneable specifies the cloneable state for clone ability result. + Cloneable CloneAbilityResult = "Cloneable" + // NotCloneable specifies the not cloneable state for clone ability result. + NotCloneable CloneAbilityResult = "NotCloneable" + // PartiallyCloneable specifies the partially cloneable state for clone + // ability result. + PartiallyCloneable CloneAbilityResult = "PartiallyCloneable" +) + +// ComputeModeOptions enumerates the values for compute mode options. +type ComputeModeOptions string + +const ( + // ComputeModeOptionsDedicated specifies the compute mode options dedicated + // state for compute mode options. + ComputeModeOptionsDedicated ComputeModeOptions = "Dedicated" + // ComputeModeOptionsDynamic specifies the compute mode options dynamic + // state for compute mode options. + ComputeModeOptionsDynamic ComputeModeOptions = "Dynamic" + // ComputeModeOptionsShared specifies the compute mode options shared state + // for compute mode options. + ComputeModeOptionsShared ComputeModeOptions = "Shared" +) + +// ConnectionStringType enumerates the values for connection string type. +type ConnectionStringType string + +const ( + // APIHub specifies the api hub state for connection string type. + APIHub ConnectionStringType = "ApiHub" + // Custom specifies the custom state for connection string type. + Custom ConnectionStringType = "Custom" + // DocDb specifies the doc db state for connection string type. + DocDb ConnectionStringType = "DocDb" + // EventHub specifies the event hub state for connection string type. + EventHub ConnectionStringType = "EventHub" + // MySQL specifies the my sql state for connection string type. + MySQL ConnectionStringType = "MySql" + // NotificationHub specifies the notification hub state for connection + // string type. + NotificationHub ConnectionStringType = "NotificationHub" + // PostgreSQL specifies the postgre sql state for connection string type. + PostgreSQL ConnectionStringType = "PostgreSQL" + // RedisCache specifies the redis cache state for connection string type. + RedisCache ConnectionStringType = "RedisCache" + // ServiceBus specifies the service bus state for connection string type. + ServiceBus ConnectionStringType = "ServiceBus" + // SQLAzure specifies the sql azure state for connection string type. + SQLAzure ConnectionStringType = "SQLAzure" + // SQLServer specifies the sql server state for connection string type. + SQLServer ConnectionStringType = "SQLServer" +) + +// CustomHostNameDNSRecordType enumerates the values for custom host name dns +// record type. +type CustomHostNameDNSRecordType string + +const ( + // A specifies the a state for custom host name dns record type. + A CustomHostNameDNSRecordType = "A" + // CName specifies the c name state for custom host name dns record type. + CName CustomHostNameDNSRecordType = "CName" +) + +// DatabaseType enumerates the values for database type. +type DatabaseType string + +const ( + // DatabaseTypeLocalMySQL specifies the database type local my sql state + // for database type. + DatabaseTypeLocalMySQL DatabaseType = "LocalMySql" + // DatabaseTypeMySQL specifies the database type my sql state for database + // type. + DatabaseTypeMySQL DatabaseType = "MySql" + // DatabaseTypePostgreSQL specifies the database type postgre sql state for + // database type. + DatabaseTypePostgreSQL DatabaseType = "PostgreSql" + // DatabaseTypeSQLAzure specifies the database type sql azure state for + // database type. + DatabaseTypeSQLAzure DatabaseType = "SqlAzure" +) + +// DNSType enumerates the values for dns type. +type DNSType string + +const ( + // AzureDNS specifies the azure dns state for dns type. + AzureDNS DNSType = "AzureDns" + // DefaultDomainRegistrarDNS specifies the default domain registrar dns + // state for dns type. + DefaultDomainRegistrarDNS DNSType = "DefaultDomainRegistrarDns" +) + +// DNSVerificationTestResult enumerates the values for dns verification test +// result. +type DNSVerificationTestResult string + +const ( + // DNSVerificationTestResultFailed specifies the dns verification test + // result failed state for dns verification test result. + DNSVerificationTestResultFailed DNSVerificationTestResult = "Failed" + // DNSVerificationTestResultPassed specifies the dns verification test + // result passed state for dns verification test result. + DNSVerificationTestResultPassed DNSVerificationTestResult = "Passed" + // DNSVerificationTestResultSkipped specifies the dns verification test + // result skipped state for dns verification test result. + DNSVerificationTestResultSkipped DNSVerificationTestResult = "Skipped" +) + +// DomainStatus enumerates the values for domain status. +type DomainStatus string + +const ( + // DomainStatusActive specifies the domain status active state for domain + // status. + DomainStatusActive DomainStatus = "Active" + // DomainStatusAwaiting specifies the domain status awaiting state for + // domain status. + DomainStatusAwaiting DomainStatus = "Awaiting" + // DomainStatusCancelled specifies the domain status cancelled state for + // domain status. + DomainStatusCancelled DomainStatus = "Cancelled" + // DomainStatusConfiscated specifies the domain status confiscated state + // for domain status. + DomainStatusConfiscated DomainStatus = "Confiscated" + // DomainStatusDisabled specifies the domain status disabled state for + // domain status. + DomainStatusDisabled DomainStatus = "Disabled" + // DomainStatusExcluded specifies the domain status excluded state for + // domain status. + DomainStatusExcluded DomainStatus = "Excluded" + // DomainStatusExpired specifies the domain status expired state for domain + // status. + DomainStatusExpired DomainStatus = "Expired" + // DomainStatusFailed specifies the domain status failed state for domain + // status. + DomainStatusFailed DomainStatus = "Failed" + // DomainStatusHeld specifies the domain status held state for domain + // status. + DomainStatusHeld DomainStatus = "Held" + // DomainStatusJSONConverterFailed specifies the domain status json + // converter failed state for domain status. + DomainStatusJSONConverterFailed DomainStatus = "JsonConverterFailed" + // DomainStatusLocked specifies the domain status locked state for domain + // status. + DomainStatusLocked DomainStatus = "Locked" + // DomainStatusParked specifies the domain status parked state for domain + // status. + DomainStatusParked DomainStatus = "Parked" + // DomainStatusPending specifies the domain status pending state for domain + // status. + DomainStatusPending DomainStatus = "Pending" + // DomainStatusReserved specifies the domain status reserved state for + // domain status. + DomainStatusReserved DomainStatus = "Reserved" + // DomainStatusReverted specifies the domain status reverted state for + // domain status. + DomainStatusReverted DomainStatus = "Reverted" + // DomainStatusSuspended specifies the domain status suspended state for + // domain status. + DomainStatusSuspended DomainStatus = "Suspended" + // DomainStatusTransferred specifies the domain status transferred state + // for domain status. + DomainStatusTransferred DomainStatus = "Transferred" + // DomainStatusUnknown specifies the domain status unknown state for domain + // status. + DomainStatusUnknown DomainStatus = "Unknown" + // DomainStatusUnlocked specifies the domain status unlocked state for + // domain status. + DomainStatusUnlocked DomainStatus = "Unlocked" + // DomainStatusUnparked specifies the domain status unparked state for + // domain status. + DomainStatusUnparked DomainStatus = "Unparked" + // DomainStatusUpdated specifies the domain status updated state for domain + // status. + DomainStatusUpdated DomainStatus = "Updated" +) + +// DomainType enumerates the values for domain type. +type DomainType string + +const ( + // Regular specifies the regular state for domain type. + Regular DomainType = "Regular" + // SoftDeleted specifies the soft deleted state for domain type. + SoftDeleted DomainType = "SoftDeleted" +) + +// FrequencyUnit enumerates the values for frequency unit. +type FrequencyUnit string + +const ( + // Day specifies the day state for frequency unit. + Day FrequencyUnit = "Day" + // Hour specifies the hour state for frequency unit. + Hour FrequencyUnit = "Hour" +) + +// HostingEnvironmentStatus enumerates the values for hosting environment +// status. +type HostingEnvironmentStatus string + +const ( + // Deleting specifies the deleting state for hosting environment status. + Deleting HostingEnvironmentStatus = "Deleting" + // Preparing specifies the preparing state for hosting environment status. + Preparing HostingEnvironmentStatus = "Preparing" + // Ready specifies the ready state for hosting environment status. + Ready HostingEnvironmentStatus = "Ready" + // Scaling specifies the scaling state for hosting environment status. + Scaling HostingEnvironmentStatus = "Scaling" +) + +// HostNameType enumerates the values for host name type. +type HostNameType string + +const ( + // Managed specifies the managed state for host name type. + Managed HostNameType = "Managed" + // Verified specifies the verified state for host name type. + Verified HostNameType = "Verified" +) + +// HostType enumerates the values for host type. +type HostType string + +const ( + // HostTypeRepository specifies the host type repository state for host + // type. + HostTypeRepository HostType = "Repository" + // HostTypeStandard specifies the host type standard state for host type. + HostTypeStandard HostType = "Standard" +) + +// InAvailabilityReasonType enumerates the values for in availability reason +// type. +type InAvailabilityReasonType string + +const ( + // AlreadyExists specifies the already exists state for in availability + // reason type. + AlreadyExists InAvailabilityReasonType = "AlreadyExists" + // Invalid specifies the invalid state for in availability reason type. + Invalid InAvailabilityReasonType = "Invalid" +) + +// InternalLoadBalancingMode enumerates the values for internal load balancing +// mode. +type InternalLoadBalancingMode string + +const ( + // InternalLoadBalancingModeNone specifies the internal load balancing mode + // none state for internal load balancing mode. + InternalLoadBalancingModeNone InternalLoadBalancingMode = "None" + // InternalLoadBalancingModePublishing specifies the internal load + // balancing mode publishing state for internal load balancing mode. + InternalLoadBalancingModePublishing InternalLoadBalancingMode = "Publishing" + // InternalLoadBalancingModeWeb specifies the internal load balancing mode + // web state for internal load balancing mode. + InternalLoadBalancingModeWeb InternalLoadBalancingMode = "Web" +) + +// KeyVaultSecretStatus enumerates the values for key vault secret status. +type KeyVaultSecretStatus string + +const ( + // KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault specifies + // the key vault secret status azure service unauthorized to access key + // vault state for key vault secret status. + KeyVaultSecretStatusAzureServiceUnauthorizedToAccessKeyVault KeyVaultSecretStatus = "AzureServiceUnauthorizedToAccessKeyVault" + // KeyVaultSecretStatusCertificateOrderFailed specifies the key vault + // secret status certificate order failed state for key vault secret + // status. + KeyVaultSecretStatusCertificateOrderFailed KeyVaultSecretStatus = "CertificateOrderFailed" + // KeyVaultSecretStatusExternalPrivateKey specifies the key vault secret + // status external private key state for key vault secret status. + KeyVaultSecretStatusExternalPrivateKey KeyVaultSecretStatus = "ExternalPrivateKey" + // KeyVaultSecretStatusInitialized specifies the key vault secret status + // initialized state for key vault secret status. + KeyVaultSecretStatusInitialized KeyVaultSecretStatus = "Initialized" + // KeyVaultSecretStatusKeyVaultDoesNotExist specifies the key vault secret + // status key vault does not exist state for key vault secret status. + KeyVaultSecretStatusKeyVaultDoesNotExist KeyVaultSecretStatus = "KeyVaultDoesNotExist" + // KeyVaultSecretStatusKeyVaultSecretDoesNotExist specifies the key vault + // secret status key vault secret does not exist state for key vault secret + // status. + KeyVaultSecretStatusKeyVaultSecretDoesNotExist KeyVaultSecretStatus = "KeyVaultSecretDoesNotExist" + // KeyVaultSecretStatusOperationNotPermittedOnKeyVault specifies the key + // vault secret status operation not permitted on key vault state for key + // vault secret status. + KeyVaultSecretStatusOperationNotPermittedOnKeyVault KeyVaultSecretStatus = "OperationNotPermittedOnKeyVault" + // KeyVaultSecretStatusSucceeded specifies the key vault secret status + // succeeded state for key vault secret status. + KeyVaultSecretStatusSucceeded KeyVaultSecretStatus = "Succeeded" + // KeyVaultSecretStatusUnknown specifies the key vault secret status + // unknown state for key vault secret status. + KeyVaultSecretStatusUnknown KeyVaultSecretStatus = "Unknown" + // KeyVaultSecretStatusUnknownError specifies the key vault secret status + // unknown error state for key vault secret status. + KeyVaultSecretStatusUnknownError KeyVaultSecretStatus = "UnknownError" + // KeyVaultSecretStatusWaitingOnCertificateOrder specifies the key vault + // secret status waiting on certificate order state for key vault secret + // status. + KeyVaultSecretStatusWaitingOnCertificateOrder KeyVaultSecretStatus = "WaitingOnCertificateOrder" +) + +// LogLevel enumerates the values for log level. +type LogLevel string + +const ( + // Error specifies the error state for log level. + Error LogLevel = "Error" + // Information specifies the information state for log level. + Information LogLevel = "Information" + // Off specifies the off state for log level. + Off LogLevel = "Off" + // Verbose specifies the verbose state for log level. + Verbose LogLevel = "Verbose" + // Warning specifies the warning state for log level. + Warning LogLevel = "Warning" +) + +// ManagedPipelineMode enumerates the values for managed pipeline mode. +type ManagedPipelineMode string + +const ( + // Classic specifies the classic state for managed pipeline mode. + Classic ManagedPipelineMode = "Classic" + // Integrated specifies the integrated state for managed pipeline mode. + Integrated ManagedPipelineMode = "Integrated" +) + +// NotificationLevel enumerates the values for notification level. +type NotificationLevel string + +const ( + // NotificationLevelCritical specifies the notification level critical + // state for notification level. + NotificationLevelCritical NotificationLevel = "Critical" + // NotificationLevelInformation specifies the notification level + // information state for notification level. + NotificationLevelInformation NotificationLevel = "Information" + // NotificationLevelNonUrgentSuggestion specifies the notification level + // non urgent suggestion state for notification level. + NotificationLevelNonUrgentSuggestion NotificationLevel = "NonUrgentSuggestion" + // NotificationLevelWarning specifies the notification level warning state + // for notification level. + NotificationLevelWarning NotificationLevel = "Warning" +) + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusCreated specifies the operation status created state for + // operation status. + OperationStatusCreated OperationStatus = "Created" + // OperationStatusFailed specifies the operation status failed state for + // operation status. + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress specifies the operation status in progress + // state for operation status. + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusSucceeded specifies the operation status succeeded state + // for operation status. + OperationStatusSucceeded OperationStatus = "Succeeded" + // OperationStatusTimedOut specifies the operation status timed out state + // for operation status. + OperationStatusTimedOut OperationStatus = "TimedOut" +) + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled specifies the provisioning state canceled + // state for provisioning state. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting specifies the provisioning state deleting + // state for provisioning state. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed specifies the provisioning state failed state + // for provisioning state. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateInProgress specifies the provisioning state in progress + // state for provisioning state. + ProvisioningStateInProgress ProvisioningState = "InProgress" + // ProvisioningStateSucceeded specifies the provisioning state succeeded + // state for provisioning state. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PublishingProfileFormat enumerates the values for publishing profile format. +type PublishingProfileFormat string + +const ( + // FileZilla3 specifies the file zilla 3 state for publishing profile + // format. + FileZilla3 PublishingProfileFormat = "FileZilla3" + // Ftp specifies the ftp state for publishing profile format. + Ftp PublishingProfileFormat = "Ftp" + // WebDeploy specifies the web deploy state for publishing profile format. + WebDeploy PublishingProfileFormat = "WebDeploy" +) + +// ResourceScopeType enumerates the values for resource scope type. +type ResourceScopeType string + +const ( + // ServerFarm specifies the server farm state for resource scope type. + ServerFarm ResourceScopeType = "ServerFarm" + // Subscription specifies the subscription state for resource scope type. + Subscription ResourceScopeType = "Subscription" + // WebSite specifies the web site state for resource scope type. + WebSite ResourceScopeType = "WebSite" +) + +// RouteType enumerates the values for route type. +type RouteType string + +const ( + // DEFAULT specifies the default state for route type. + DEFAULT RouteType = "DEFAULT" + // INHERITED specifies the inherited state for route type. + INHERITED RouteType = "INHERITED" + // STATIC specifies the static state for route type. + STATIC RouteType = "STATIC" +) + +// ScmType enumerates the values for scm type. +type ScmType string + +const ( + // ScmTypeBitbucketGit specifies the scm type bitbucket git state for scm + // type. + ScmTypeBitbucketGit ScmType = "BitbucketGit" + // ScmTypeBitbucketHg specifies the scm type bitbucket hg state for scm + // type. + ScmTypeBitbucketHg ScmType = "BitbucketHg" + // ScmTypeCodePlexGit specifies the scm type code plex git state for scm + // type. + ScmTypeCodePlexGit ScmType = "CodePlexGit" + // ScmTypeCodePlexHg specifies the scm type code plex hg state for scm + // type. + ScmTypeCodePlexHg ScmType = "CodePlexHg" + // ScmTypeDropbox specifies the scm type dropbox state for scm type. + ScmTypeDropbox ScmType = "Dropbox" + // ScmTypeExternalGit specifies the scm type external git state for scm + // type. + ScmTypeExternalGit ScmType = "ExternalGit" + // ScmTypeExternalHg specifies the scm type external hg state for scm type. + ScmTypeExternalHg ScmType = "ExternalHg" + // ScmTypeGitHub specifies the scm type git hub state for scm type. + ScmTypeGitHub ScmType = "GitHub" + // ScmTypeLocalGit specifies the scm type local git state for scm type. + ScmTypeLocalGit ScmType = "LocalGit" + // ScmTypeNone specifies the scm type none state for scm type. + ScmTypeNone ScmType = "None" + // ScmTypeOneDrive specifies the scm type one drive state for scm type. + ScmTypeOneDrive ScmType = "OneDrive" + // ScmTypeTfs specifies the scm type tfs state for scm type. + ScmTypeTfs ScmType = "Tfs" + // ScmTypeVSO specifies the scm type vso state for scm type. + ScmTypeVSO ScmType = "VSO" +) + +// SiteAvailabilityState enumerates the values for site availability state. +type SiteAvailabilityState string + +const ( + // DisasterRecoveryMode specifies the disaster recovery mode state for site + // availability state. + DisasterRecoveryMode SiteAvailabilityState = "DisasterRecoveryMode" + // Limited specifies the limited state for site availability state. + Limited SiteAvailabilityState = "Limited" + // Normal specifies the normal state for site availability state. + Normal SiteAvailabilityState = "Normal" +) + +// SiteLoadBalancing enumerates the values for site load balancing. +type SiteLoadBalancing string + +const ( + // LeastRequests specifies the least requests state for site load + // balancing. + LeastRequests SiteLoadBalancing = "LeastRequests" + // LeastResponseTime specifies the least response time state for site load + // balancing. + LeastResponseTime SiteLoadBalancing = "LeastResponseTime" + // RequestHash specifies the request hash state for site load balancing. + RequestHash SiteLoadBalancing = "RequestHash" + // WeightedRoundRobin specifies the weighted round robin state for site + // load balancing. + WeightedRoundRobin SiteLoadBalancing = "WeightedRoundRobin" + // WeightedTotalTraffic specifies the weighted total traffic state for site + // load balancing. + WeightedTotalTraffic SiteLoadBalancing = "WeightedTotalTraffic" +) + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameBasic specifies the sku name basic state for sku name. + SkuNameBasic SkuName = "Basic" + // SkuNameDynamic specifies the sku name dynamic state for sku name. + SkuNameDynamic SkuName = "Dynamic" + // SkuNameFree specifies the sku name free state for sku name. + SkuNameFree SkuName = "Free" + // SkuNameIsolated specifies the sku name isolated state for sku name. + SkuNameIsolated SkuName = "Isolated" + // SkuNamePremium specifies the sku name premium state for sku name. + SkuNamePremium SkuName = "Premium" + // SkuNameShared specifies the sku name shared state for sku name. + SkuNameShared SkuName = "Shared" + // SkuNameStandard specifies the sku name standard state for sku name. + SkuNameStandard SkuName = "Standard" +) + +// SslState enumerates the values for ssl state. +type SslState string + +const ( + // Disabled specifies the disabled state for ssl state. + Disabled SslState = "Disabled" + // IPBasedEnabled specifies the ip based enabled state for ssl state. + IPBasedEnabled SslState = "IpBasedEnabled" + // SniEnabled specifies the sni enabled state for ssl state. + SniEnabled SslState = "SniEnabled" +) + +// StatusOptions enumerates the values for status options. +type StatusOptions string + +const ( + // StatusOptionsPending specifies the status options pending state for + // status options. + StatusOptionsPending StatusOptions = "Pending" + // StatusOptionsReady specifies the status options ready state for status + // options. + StatusOptionsReady StatusOptions = "Ready" +) + +// UnauthenticatedClientAction enumerates the values for unauthenticated client +// action. +type UnauthenticatedClientAction string + +const ( + // AllowAnonymous specifies the allow anonymous state for unauthenticated + // client action. + AllowAnonymous UnauthenticatedClientAction = "AllowAnonymous" + // RedirectToLoginPage specifies the redirect to login page state for + // unauthenticated client action. + RedirectToLoginPage UnauthenticatedClientAction = "RedirectToLoginPage" +) + +// UsageState enumerates the values for usage state. +type UsageState string + +const ( + // UsageStateExceeded specifies the usage state exceeded state for usage + // state. + UsageStateExceeded UsageState = "Exceeded" + // UsageStateNormal specifies the usage state normal state for usage state. + UsageStateNormal UsageState = "Normal" +) + +// ValidateResourceTypes enumerates the values for validate resource types. +type ValidateResourceTypes string + +const ( + // ValidateResourceTypesServerFarm specifies the validate resource types + // server farm state for validate resource types. + ValidateResourceTypesServerFarm ValidateResourceTypes = "ServerFarm" + // ValidateResourceTypesSite specifies the validate resource types site + // state for validate resource types. + ValidateResourceTypesSite ValidateResourceTypes = "Site" +) + +// WorkerSizeOptions enumerates the values for worker size options. +type WorkerSizeOptions string + +const ( + // WorkerSizeOptionsDefault specifies the worker size options default state + // for worker size options. + WorkerSizeOptionsDefault WorkerSizeOptions = "Default" + // WorkerSizeOptionsLarge specifies the worker size options large state for + // worker size options. + WorkerSizeOptionsLarge WorkerSizeOptions = "Large" + // WorkerSizeOptionsMedium specifies the worker size options medium state + // for worker size options. + WorkerSizeOptionsMedium WorkerSizeOptions = "Medium" + // WorkerSizeOptionsSmall specifies the worker size options small state for + // worker size options. + WorkerSizeOptionsSmall WorkerSizeOptions = "Small" +) + +// Address is address information for domain registration. +type Address struct { + Address1 *string `json:"address1,omitempty"` + Address2 *string `json:"address2,omitempty"` + City *string `json:"city,omitempty"` + Country *string `json:"country,omitempty"` + PostalCode *string `json:"postalCode,omitempty"` + State *string `json:"state,omitempty"` +} + +// AddressResponse is describes main public IP address and any extra virtual +// IPs. +type AddressResponse struct { + autorest.Response `json:"-"` + ServiceIPAddress *string `json:"serviceIpAddress,omitempty"` + InternalIPAddress *string `json:"internalIpAddress,omitempty"` + OutboundIPAddresses *[]string `json:"outboundIpAddresses,omitempty"` + VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` +} + +// APIDefinitionInfo is information about the formal API definition for the +// app. +type APIDefinitionInfo struct { + URL *string `json:"url,omitempty"` +} + +// AppCollection is collection of App Service apps. +type AppCollection struct { + autorest.Response `json:"-"` + Value *[]Site `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppCollection) AppCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppInstanceCollection is collection of app instances. +type AppInstanceCollection struct { + autorest.Response `json:"-"` + Value *[]SiteInstance `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppInstanceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppInstanceCollection) AppInstanceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ApplicationLogsConfig is application logs configuration. +type ApplicationLogsConfig struct { + FileSystem *FileSystemApplicationLogsConfig `json:"fileSystem,omitempty"` + AzureTableStorage *AzureTableStorageApplicationLogsConfig `json:"azureTableStorage,omitempty"` + AzureBlobStorage *AzureBlobStorageApplicationLogsConfig `json:"azureBlobStorage,omitempty"` +} + +// AppServiceCertificate is key Vault container for a certificate that is +// purchased through Azure. +type AppServiceCertificate struct { + KeyVaultID *string `json:"keyVaultId,omitempty"` + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + ProvisioningState KeyVaultSecretStatus `json:"provisioningState,omitempty"` +} + +// AppServiceCertificateCollection is collection of certitificateorder +// certificates. +type AppServiceCertificateCollection struct { + autorest.Response `json:"-"` + Value *[]AppServiceCertificateResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceCertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServiceCertificateCollection) AppServiceCertificateCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppServiceCertificateOrder is sSL certificate purchase order. +type AppServiceCertificateOrder struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServiceCertificateOrderProperties `json:"properties,omitempty"` +} + +// AppServiceCertificateOrderProperties is appServiceCertificateOrder resource +// specific properties +type AppServiceCertificateOrderProperties struct { + Certificates *map[string]*AppServiceCertificate `json:"certificates,omitempty"` + DistinguishedName *string `json:"distinguishedName,omitempty"` + DomainVerificationToken *string `json:"domainVerificationToken,omitempty"` + ValidityInYears *int32 `json:"validityInYears,omitempty"` + KeySize *int32 `json:"keySize,omitempty"` + ProductType CertificateProductType `json:"productType,omitempty"` + AutoRenew *bool `json:"autoRenew,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Status CertificateOrderStatus `json:"status,omitempty"` + SignedCertificate *CertificateDetails `json:"signedCertificate,omitempty"` + Csr *string `json:"csr,omitempty"` + Intermediate *CertificateDetails `json:"intermediate,omitempty"` + Root *CertificateDetails `json:"root,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + LastCertificateIssuanceTime *date.Time `json:"lastCertificateIssuanceTime,omitempty"` + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` + AppServiceCertificateNotRenewableReasons *[]string `json:"appServiceCertificateNotRenewableReasons,omitempty"` + NextAutoRenewalTimeStamp *date.Time `json:"nextAutoRenewalTimeStamp,omitempty"` +} + +// AppServiceCertificateOrderCollection is collection of certitificate orders. +type AppServiceCertificateOrderCollection struct { + autorest.Response `json:"-"` + Value *[]AppServiceCertificateOrder `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceCertificateOrderCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServiceCertificateOrderCollection) AppServiceCertificateOrderCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppServiceCertificateResource is key Vault container ARM resource for a +// certificate that is purchased through Azure. +type AppServiceCertificateResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServiceCertificate `json:"properties,omitempty"` +} + +// AppServiceEnvironment is description of an App Service Environment. +type AppServiceEnvironment struct { + Name *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + Status HostingEnvironmentStatus `json:"status,omitempty"` + VnetName *string `json:"vnetName,omitempty"` + VnetResourceGroupName *string `json:"vnetResourceGroupName,omitempty"` + VnetSubnetName *string `json:"vnetSubnetName,omitempty"` + VirtualNetwork *VirtualNetworkProfile `json:"virtualNetwork,omitempty"` + InternalLoadBalancingMode InternalLoadBalancingMode `json:"internalLoadBalancingMode,omitempty"` + MultiSize *string `json:"multiSize,omitempty"` + MultiRoleCount *int32 `json:"multiRoleCount,omitempty"` + WorkerPools *[]WorkerPool `json:"workerPools,omitempty"` + IpsslAddressCount *int32 `json:"ipsslAddressCount,omitempty"` + DatabaseEdition *string `json:"databaseEdition,omitempty"` + DatabaseServiceObjective *string `json:"databaseServiceObjective,omitempty"` + UpgradeDomains *int32 `json:"upgradeDomains,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + DNSSuffix *string `json:"dnsSuffix,omitempty"` + LastAction *string `json:"lastAction,omitempty"` + LastActionResult *string `json:"lastActionResult,omitempty"` + AllowedMultiSizes *string `json:"allowedMultiSizes,omitempty"` + AllowedWorkerSizes *string `json:"allowedWorkerSizes,omitempty"` + MaximumNumberOfMachines *int32 `json:"maximumNumberOfMachines,omitempty"` + VipMappings *[]VirtualIPMapping `json:"vipMappings,omitempty"` + EnvironmentCapacities *[]StampCapacity `json:"environmentCapacities,omitempty"` + NetworkAccessControlList *[]NetworkAccessControlEntry `json:"networkAccessControlList,omitempty"` + EnvironmentIsHealthy *bool `json:"environmentIsHealthy,omitempty"` + EnvironmentStatus *string `json:"environmentStatus,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + FrontEndScaleFactor *int32 `json:"frontEndScaleFactor,omitempty"` + DefaultFrontEndScaleFactor *int32 `json:"defaultFrontEndScaleFactor,omitempty"` + APIManagementAccountID *string `json:"apiManagementAccountId,omitempty"` + Suspended *bool `json:"suspended,omitempty"` + DynamicCacheEnabled *bool `json:"dynamicCacheEnabled,omitempty"` + ClusterSettings *[]NameValuePair `json:"clusterSettings,omitempty"` +} + +// AppServiceEnvironmentCollection is collection of App Service Environments. +type AppServiceEnvironmentCollection struct { + autorest.Response `json:"-"` + Value *[]AppServiceEnvironment `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceEnvironmentCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServiceEnvironmentCollection) AppServiceEnvironmentCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AppServiceEnvironmentResource is app Service Environment ARM resource. +type AppServiceEnvironmentResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServiceEnvironment `json:"properties,omitempty"` +} + +// AppServicePlan is app Service plan. +type AppServicePlan struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *AppServicePlanProperties `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` +} + +// AppServicePlanProperties is appServicePlan resource specific properties +type AppServicePlanProperties struct { + Name *string `json:"name,omitempty"` + WorkerTierName *string `json:"workerTierName,omitempty"` + Status StatusOptions `json:"status,omitempty"` + Subscription *string `json:"subscription,omitempty"` + AdminSiteName *string `json:"adminSiteName,omitempty"` + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + MaximumNumberOfWorkers *int32 `json:"maximumNumberOfWorkers,omitempty"` + GeoRegion *string `json:"geoRegion,omitempty"` + PerSiteScaling *bool `json:"perSiteScaling,omitempty"` + NumberOfSites *int32 `json:"numberOfSites,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + Reserved *bool `json:"reserved,omitempty"` + TargetWorkerCount *int32 `json:"targetWorkerCount,omitempty"` + TargetWorkerSizeID *int32 `json:"targetWorkerSizeId,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// AppServicePlanCollection is collection of App Service plans. +type AppServicePlanCollection struct { + autorest.Response `json:"-"` + Value *[]AppServicePlan `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServicePlanCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client AppServicePlanCollection) AppServicePlanCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// AutoHealActions is actions which to take by the auto-heal module when a rule +// is triggered. +type AutoHealActions struct { + ActionType AutoHealActionType `json:"actionType,omitempty"` + CustomAction *AutoHealCustomAction `json:"customAction,omitempty"` + MinProcessExecutionTime *string `json:"minProcessExecutionTime,omitempty"` +} + +// AutoHealCustomAction is custom action to be executed +// when an auto heal rule is triggered. +type AutoHealCustomAction struct { + Exe *string `json:"exe,omitempty"` + Parameters *string `json:"parameters,omitempty"` +} + +// AutoHealRules is rules that can be defined for auto-heal. +type AutoHealRules struct { + Triggers *AutoHealTriggers `json:"triggers,omitempty"` + Actions *AutoHealActions `json:"actions,omitempty"` +} + +// AutoHealTriggers is triggers for auto-heal. +type AutoHealTriggers struct { + Requests *RequestsBasedTrigger `json:"requests,omitempty"` + PrivateBytesInKB *int32 `json:"privateBytesInKB,omitempty"` + StatusCodes *[]StatusCodesBasedTrigger `json:"statusCodes,omitempty"` + SlowRequests *SlowRequestsBasedTrigger `json:"slowRequests,omitempty"` +} + +// AzureBlobStorageApplicationLogsConfig is application logs azure blob storage +// configuration. +type AzureBlobStorageApplicationLogsConfig struct { + Level LogLevel `json:"level,omitempty"` + SasURL *string `json:"sasUrl,omitempty"` + RetentionInDays *int32 `json:"retentionInDays,omitempty"` +} + +// AzureBlobStorageHTTPLogsConfig is http logs to azure blob storage +// configuration. +type AzureBlobStorageHTTPLogsConfig struct { + SasURL *string `json:"sasUrl,omitempty"` + RetentionInDays *int32 `json:"retentionInDays,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// AzureTableStorageApplicationLogsConfig is application logs to Azure table +// storage configuration. +type AzureTableStorageApplicationLogsConfig struct { + Level LogLevel `json:"level,omitempty"` + SasURL *string `json:"sasUrl,omitempty"` +} + +// BackupItem is backup description. +type BackupItem struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *BackupItemProperties `json:"properties,omitempty"` +} + +// BackupItemProperties is backupItem resource specific properties +type BackupItemProperties struct { + BackupID *int32 `json:"id,omitempty"` + StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + BlobName *string `json:"blobName,omitempty"` + Name *string `json:"name,omitempty"` + Status BackupItemStatus `json:"status,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + Created *date.Time `json:"created,omitempty"` + Log *string `json:"log,omitempty"` + Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` + Scheduled *bool `json:"scheduled,omitempty"` + LastRestoreTimeStamp *date.Time `json:"lastRestoreTimeStamp,omitempty"` + FinishedTimeStamp *date.Time `json:"finishedTimeStamp,omitempty"` + CorrelationID *string `json:"correlationId,omitempty"` + WebsiteSizeInBytes *int64 `json:"websiteSizeInBytes,omitempty"` +} + +// BackupItemCollection is collection of backup items. +type BackupItemCollection struct { + autorest.Response `json:"-"` + Value *[]BackupItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// BackupItemCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client BackupItemCollection) BackupItemCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// BackupRequest is description of a backup which will be performed. +type BackupRequest struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *BackupRequestProperties `json:"properties,omitempty"` +} + +// BackupRequestProperties is backupRequest resource specific properties +type BackupRequestProperties struct { + BackupRequestName *string `json:"name,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + BackupSchedule *BackupSchedule `json:"backupSchedule,omitempty"` + Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` + Type BackupRestoreOperationType `json:"type,omitempty"` +} + +// BackupSchedule is description of a backup schedule. Describes how often +// should be the backup performed and what should be the retention policy. +type BackupSchedule struct { + FrequencyInterval *int32 `json:"frequencyInterval,omitempty"` + FrequencyUnit FrequencyUnit `json:"frequencyUnit,omitempty"` + KeepAtLeastOneBackup *bool `json:"keepAtLeastOneBackup,omitempty"` + RetentionPeriodInDays *int32 `json:"retentionPeriodInDays,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"` +} + +// Capability is describes the capabilities/features allowed for a specific +// SKU. +type Capability struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + Reason *string `json:"reason,omitempty"` +} + +// Certificate is sSL certificate for an app. +type Certificate struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CertificateProperties `json:"properties,omitempty"` +} + +// CertificateProperties is certificate resource specific properties +type CertificateProperties struct { + FriendlyName *string `json:"friendlyName,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + HostNames *[]string `json:"hostNames,omitempty"` + PfxBlob *[]byte `json:"pfxBlob,omitempty"` + SiteName *string `json:"siteName,omitempty"` + SelfLink *string `json:"selfLink,omitempty"` + Issuer *string `json:"issuer,omitempty"` + IssueDate *date.Time `json:"issueDate,omitempty"` + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + Password *string `json:"password,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Valid *bool `json:"valid,omitempty"` + CerBlob *string `json:"cerBlob,omitempty"` + PublicKeyHash *string `json:"publicKeyHash,omitempty"` + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + KeyVaultID *string `json:"keyVaultId,omitempty"` + KeyVaultSecretName *string `json:"keyVaultSecretName,omitempty"` + KeyVaultSecretStatus KeyVaultSecretStatus `json:"keyVaultSecretStatus,omitempty"` + GeoRegion *string `json:"geoRegion,omitempty"` + Name *string `json:"name,omitempty"` + ServerFarmID *string `json:"serverFarmId,omitempty"` +} + +// CertificateCollection is collection of certificates. +type CertificateCollection struct { + autorest.Response `json:"-"` + Value *[]Certificate `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CertificateCollection) CertificateCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CertificateDetails is sSL certificate details. +type CertificateDetails struct { + Version *int32 `json:"version,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Subject *string `json:"subject,omitempty"` + NotBefore *date.Time `json:"notBefore,omitempty"` + NotAfter *date.Time `json:"notAfter,omitempty"` + SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"` + Issuer *string `json:"issuer,omitempty"` + RawData *string `json:"rawData,omitempty"` +} + +// CertificateEmail is sSL certificate email. +type CertificateEmail struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CertificateEmailProperties `json:"properties,omitempty"` +} + +// CertificateEmailProperties is certificateEmail resource specific properties +type CertificateEmailProperties struct { + EmailID *string `json:"emailId,omitempty"` + TimeStamp *date.Time `json:"timeStamp,omitempty"` +} + +// CertificateOrderAction is certificate order action. +type CertificateOrderAction struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CertificateOrderActionProperties `json:"properties,omitempty"` +} + +// CertificateOrderActionProperties is certificateOrderAction resource specific +// properties +type CertificateOrderActionProperties struct { + Type CertificateOrderActionType `json:"type,omitempty"` + CreatedAt *date.Time `json:"createdAt,omitempty"` +} + +// CloningInfo is information needed for cloning operation. +type CloningInfo struct { + CorrelationID *string `json:"correlationId,omitempty"` + Overwrite *bool `json:"overwrite,omitempty"` + CloneCustomHostNames *bool `json:"cloneCustomHostNames,omitempty"` + CloneSourceControl *bool `json:"cloneSourceControl,omitempty"` + SourceWebAppID *string `json:"sourceWebAppId,omitempty"` + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` + AppSettingsOverrides *map[string]*string `json:"appSettingsOverrides,omitempty"` + ConfigureLoadBalancing *bool `json:"configureLoadBalancing,omitempty"` + TrafficManagerProfileID *string `json:"trafficManagerProfileId,omitempty"` + TrafficManagerProfileName *string `json:"trafficManagerProfileName,omitempty"` + IgnoreQuotas *bool `json:"ignoreQuotas,omitempty"` +} + +// ConnectionStringDictionary is string dictionary resource. +type ConnectionStringDictionary struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]*ConnStringValueTypePair `json:"properties,omitempty"` +} + +// ConnStringInfo is database connection string information. +type ConnStringInfo struct { + Name *string `json:"name,omitempty"` + ConnectionString *string `json:"connectionString,omitempty"` + Type ConnectionStringType `json:"type,omitempty"` +} + +// ConnStringValueTypePair is database connection string value to type pair. +type ConnStringValueTypePair struct { + Value *string `json:"value,omitempty"` + Type ConnectionStringType `json:"type,omitempty"` +} + +// Contact is contact information for domain registration. If 'Domain Privacy' +// option is not selected then the contact information is made publicly +// available through the Whois +// directories as per ICANN requirements. +type Contact struct { + AddressMailing *Address `json:"addressMailing,omitempty"` + Email *string `json:"email,omitempty"` + Fax *string `json:"fax,omitempty"` + JobTitle *string `json:"jobTitle,omitempty"` + NameFirst *string `json:"nameFirst,omitempty"` + NameLast *string `json:"nameLast,omitempty"` + NameMiddle *string `json:"nameMiddle,omitempty"` + Organization *string `json:"organization,omitempty"` + Phone *string `json:"phone,omitempty"` +} + +// CorsSettings is cross-Origin Resource Sharing (CORS) settings for the app. +type CorsSettings struct { + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` +} + +// CsmMoveResourceEnvelope is object with a list of the resources that need to +// be moved and the resource group they should be moved to. +type CsmMoveResourceEnvelope struct { + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + Resources *[]string `json:"resources,omitempty"` +} + +// CsmPublishingProfileOptions is publishing options for requested profile. +type CsmPublishingProfileOptions struct { + Format PublishingProfileFormat `json:"format,omitempty"` +} + +// CsmSiteRecoveryEntity is details about app recovery operation. +type CsmSiteRecoveryEntity struct { + SnapshotTime *date.Time `json:"snapshotTime,omitempty"` + SiteName *string `json:"siteName,omitempty"` + SlotName *string `json:"slotName,omitempty"` +} + +// CsmSlotEntity is deployment slot parameters. +type CsmSlotEntity struct { + TargetSlot *string `json:"targetSlot,omitempty"` + PreserveVnet *bool `json:"preserveVnet,omitempty"` +} + +// CsmUsageQuota is usage of the quota resource. +type CsmUsageQuota struct { + Unit *string `json:"unit,omitempty"` + NextResetTime *date.Time `json:"nextResetTime,omitempty"` + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *LocalizableString `json:"name,omitempty"` +} + +// CsmUsageQuotaCollection is collection of CSM usage quotas. +type CsmUsageQuotaCollection struct { + autorest.Response `json:"-"` + Value *[]CsmUsageQuota `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CsmUsageQuotaCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CsmUsageQuotaCollection) CsmUsageQuotaCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CustomHostnameAnalysisResult is custom domain analysis. +type CustomHostnameAnalysisResult struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *CustomHostnameAnalysisResultProperties `json:"properties,omitempty"` +} + +// CustomHostnameAnalysisResultProperties is customHostnameAnalysisResult +// resource specific properties +type CustomHostnameAnalysisResultProperties struct { + IsHostnameAlreadyVerified *bool `json:"isHostnameAlreadyVerified,omitempty"` + CustomDomainVerificationTest DNSVerificationTestResult `json:"customDomainVerificationTest,omitempty"` + CustomDomainVerificationFailureInfo *ErrorEntity `json:"customDomainVerificationFailureInfo,omitempty"` + HasConflictOnScaleUnit *bool `json:"hasConflictOnScaleUnit,omitempty"` + HasConflictAcrossSubscription *bool `json:"hasConflictAcrossSubscription,omitempty"` + ConflictingAppResourceID *string `json:"conflictingAppResourceId,omitempty"` + CNameRecords *[]string `json:"cNameRecords,omitempty"` + TxtRecords *[]string `json:"txtRecords,omitempty"` + ARecords *[]string `json:"aRecords,omitempty"` + AlternateCNameRecords *[]string `json:"alternateCNameRecords,omitempty"` + AlternateTxtRecords *[]string `json:"alternateTxtRecords,omitempty"` +} + +// DatabaseBackupSetting is database backup settings. +type DatabaseBackupSetting struct { + DatabaseType DatabaseType `json:"databaseType,omitempty"` + Name *string `json:"name,omitempty"` + ConnectionStringName *string `json:"connectionStringName,omitempty"` + ConnectionString *string `json:"connectionString,omitempty"` +} + +// DeletedSite is a deleted app. +type DeletedSite struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DeletedSiteProperties `json:"properties,omitempty"` +} + +// DeletedSiteProperties is deletedSite resource specific properties +type DeletedSiteProperties struct { + DeletedTimestamp *date.Time `json:"deletedTimestamp,omitempty"` + State *string `json:"state,omitempty"` + HostNames *[]string `json:"hostNames,omitempty"` + RepositorySiteName *string `json:"repositorySiteName,omitempty"` + UsageState UsageState `json:"usageState,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EnabledHostNames *[]string `json:"enabledHostNames,omitempty"` + AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` + HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` + ServerFarmID *string `json:"serverFarmId,omitempty"` + Reserved *bool `json:"reserved,omitempty"` + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + SiteConfig *SiteConfig `json:"siteConfig,omitempty"` + TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` + PremiumAppDeployed *bool `json:"premiumAppDeployed,omitempty"` + ScmSiteAlsoStopped *bool `json:"scmSiteAlsoStopped,omitempty"` + TargetSwapSlot *string `json:"targetSwapSlot,omitempty"` + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + MicroService *string `json:"microService,omitempty"` + GatewaySiteName *string `json:"gatewaySiteName,omitempty"` + ClientAffinityEnabled *bool `json:"clientAffinityEnabled,omitempty"` + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` + HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` + OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` + ContainerSize *int32 `json:"containerSize,omitempty"` + DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` + SuspendedTill *date.Time `json:"suspendedTill,omitempty"` + MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` + CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` + DefaultHostName *string `json:"defaultHostName,omitempty"` + SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` +} + +// DeletedWebAppCollection is collection of deleted apps. +type DeletedWebAppCollection struct { + autorest.Response `json:"-"` + Value *[]DeletedSite `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedWebAppCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DeletedWebAppCollection) DeletedWebAppCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Deployment is user crendentials used for publishing activity. +type Deployment struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DeploymentProperties `json:"properties,omitempty"` +} + +// DeploymentProperties is deployment resource specific properties +type DeploymentProperties struct { + ID *string `json:"id,omitempty"` + Status *int32 `json:"status,omitempty"` + Message *string `json:"message,omitempty"` + Author *string `json:"author,omitempty"` + Deployer *string `json:"deployer,omitempty"` + AuthorEmail *string `json:"authorEmail,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + Active *bool `json:"active,omitempty"` + Details *string `json:"details,omitempty"` +} + +// DeploymentCollection is collection of app deployments. +type DeploymentCollection struct { + autorest.Response `json:"-"` + Value *[]Deployment `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DeploymentCollection) DeploymentCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Domain is information about a domain. +type Domain struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DomainProperties `json:"properties,omitempty"` +} + +// DomainProperties is domain resource specific properties +type DomainProperties struct { + ContactAdmin *Contact `json:"contactAdmin,omitempty"` + ContactBilling *Contact `json:"contactBilling,omitempty"` + ContactRegistrant *Contact `json:"contactRegistrant,omitempty"` + ContactTech *Contact `json:"contactTech,omitempty"` + RegistrationStatus DomainStatus `json:"registrationStatus,omitempty"` + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + NameServers *[]string `json:"nameServers,omitempty"` + Privacy *bool `json:"privacy,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + LastRenewedTime *date.Time `json:"lastRenewedTime,omitempty"` + AutoRenew *bool `json:"autoRenew,omitempty"` + ReadyForDNSRecordManagement *bool `json:"readyForDnsRecordManagement,omitempty"` + ManagedHostNames *[]HostName `json:"managedHostNames,omitempty"` + Consent *DomainPurchaseConsent `json:"consent,omitempty"` + DomainNotRenewableReasons *[]string `json:"domainNotRenewableReasons,omitempty"` + DNSType DNSType `json:"dnsType,omitempty"` + DNSZoneID *string `json:"dnsZoneId,omitempty"` + TargetDNSType DNSType `json:"targetDnsType,omitempty"` + AuthCode *string `json:"authCode,omitempty"` +} + +// DomainAvailablilityCheckResult is domain availablility check result. +type DomainAvailablilityCheckResult struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + Available *bool `json:"available,omitempty"` + DomainType DomainType `json:"domainType,omitempty"` +} + +// DomainCollection is collection of domains. +type DomainCollection struct { + autorest.Response `json:"-"` + Value *[]Domain `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DomainCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DomainCollection) DomainCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DomainControlCenterSsoRequest is single sign-on request information for +// domain management. +type DomainControlCenterSsoRequest struct { + autorest.Response `json:"-"` + URL *string `json:"url,omitempty"` + PostParameterKey *string `json:"postParameterKey,omitempty"` + PostParameterValue *string `json:"postParameterValue,omitempty"` +} + +// DomainOwnershipIdentifier is domain ownership Identifier. +type DomainOwnershipIdentifier struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *DomainOwnershipIdentifierProperties `json:"properties,omitempty"` +} + +// DomainOwnershipIdentifierProperties is domainOwnershipIdentifier resource +// specific properties +type DomainOwnershipIdentifierProperties struct { + OwnershipID *string `json:"ownershipId,omitempty"` +} + +// DomainOwnershipIdentifierCollection is collection of domain ownership +// identifiers. +type DomainOwnershipIdentifierCollection struct { + autorest.Response `json:"-"` + Value *[]DomainOwnershipIdentifier `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// DomainOwnershipIdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client DomainOwnershipIdentifierCollection) DomainOwnershipIdentifierCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// DomainPurchaseConsent is domain purchase consent object, representing +// acceptance of applicable legal agreements. +type DomainPurchaseConsent struct { + AgreementKeys *[]string `json:"agreementKeys,omitempty"` + AgreedBy *string `json:"agreedBy,omitempty"` + AgreedAt *date.Time `json:"agreedAt,omitempty"` +} + +// DomainRecommendationSearchParameters is domain recommendation search +// parameters. +type DomainRecommendationSearchParameters struct { + Keywords *string `json:"keywords,omitempty"` + MaxDomainRecommendations *int32 `json:"maxDomainRecommendations,omitempty"` +} + +// EnabledConfig is enabled configuration. +type EnabledConfig struct { + Enabled *bool `json:"enabled,omitempty"` +} + +// ErrorEntity is body of the error response returned from the API. +type ErrorEntity struct { + ExtendedCode *string `json:"extendedCode,omitempty"` + MessageTemplate *string `json:"messageTemplate,omitempty"` + Parameters *[]string `json:"parameters,omitempty"` + InnerErrors *[]ErrorEntity `json:"innerErrors,omitempty"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// Experiments is routing rules in production experiments. +type Experiments struct { + RampUpRules *[]RampUpRule `json:"rampUpRules,omitempty"` +} + +// FileSystemApplicationLogsConfig is application logs to file system +// configuration. +type FileSystemApplicationLogsConfig struct { + Level LogLevel `json:"level,omitempty"` +} + +// FileSystemHTTPLogsConfig is http logs to file system configuration. +type FileSystemHTTPLogsConfig struct { + RetentionInMb *int32 `json:"retentionInMb,omitempty"` + RetentionInDays *int32 `json:"retentionInDays,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// GeoRegion is geographical region. +type GeoRegion struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *GeoRegionProperties `json:"properties,omitempty"` +} + +// GeoRegionProperties is geoRegion resource specific properties +type GeoRegionProperties struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` +} + +// GeoRegionCollection is collection of geographical regions. +type GeoRegionCollection struct { + autorest.Response `json:"-"` + Value *[]GeoRegion `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// GeoRegionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client GeoRegionCollection) GeoRegionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// GlobalCsmSkuDescription is a Global SKU Description. +type GlobalCsmSkuDescription struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Capacity *SkuCapacity `json:"capacity,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Capabilities *[]Capability `json:"capabilities,omitempty"` +} + +// HandlerMapping is the IIS handler mappings used to define which handler +// processes HTTP requests with certain extension. +// For example, it is used to configure php-cgi.exe process to handle all HTTP +// requests with *.php extension. +type HandlerMapping struct { + Extension *string `json:"extension,omitempty"` + ScriptProcessor *string `json:"scriptProcessor,omitempty"` + Arguments *string `json:"arguments,omitempty"` +} + +// HostingEnvironmentDiagnostics is diagnostics for an App Service Environment. +type HostingEnvironmentDiagnostics struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + DiagnosicsOutput *string `json:"diagnosicsOutput,omitempty"` +} + +// HostingEnvironmentProfile is specification for an App Service Environment to +// use for this resource. +type HostingEnvironmentProfile struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +// HostName is details of a hostname derived from a domain. +type HostName struct { + Name *string `json:"name,omitempty"` + SiteNames *[]string `json:"siteNames,omitempty"` + AzureResourceName *string `json:"azureResourceName,omitempty"` + AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` + CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` + HostNameType HostNameType `json:"hostNameType,omitempty"` +} + +// HostNameBinding is a hostname binding object. +type HostNameBinding struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HostNameBindingProperties `json:"properties,omitempty"` +} + +// HostNameBindingProperties is hostNameBinding resource specific properties +type HostNameBindingProperties struct { + Name *string `json:"name,omitempty"` + SiteName *string `json:"siteName,omitempty"` + DomainID *string `json:"domainId,omitempty"` + AzureResourceName *string `json:"azureResourceName,omitempty"` + AzureResourceType AzureResourceType `json:"azureResourceType,omitempty"` + CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` + HostNameType HostNameType `json:"hostNameType,omitempty"` + SslState SslState `json:"sslState,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + VirtualIP *string `json:"virtualIP,omitempty"` +} + +// HostNameBindingCollection is collection of hostname bindings. +type HostNameBindingCollection struct { + autorest.Response `json:"-"` + Value *[]HostNameBinding `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// HostNameBindingCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client HostNameBindingCollection) HostNameBindingCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// HostNameSslState is sSL-enabled hostname. +type HostNameSslState struct { + Name *string `json:"name,omitempty"` + SslState SslState `json:"sslState,omitempty"` + VirtualIP *string `json:"virtualIP,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ToUpdate *bool `json:"toUpdate,omitempty"` + HostType HostType `json:"hostType,omitempty"` +} + +// HTTPLogsConfig is http logs configuration. +type HTTPLogsConfig struct { + FileSystem *FileSystemHTTPLogsConfig `json:"fileSystem,omitempty"` + AzureBlobStorage *AzureBlobStorageHTTPLogsConfig `json:"azureBlobStorage,omitempty"` +} + +// HybridConnection is hybrid Connection contract. This is used to configure a +// Hybrid Connection. +type HybridConnection struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HybridConnectionProperties `json:"properties,omitempty"` +} + +// HybridConnectionProperties is hybridConnection resource specific properties +type HybridConnectionProperties struct { + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + RelayName *string `json:"relayName,omitempty"` + RelayArmURI *string `json:"relayArmUri,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Port *int32 `json:"port,omitempty"` + SendKeyName *string `json:"sendKeyName,omitempty"` + SendKeyValue *string `json:"sendKeyValue,omitempty"` +} + +// HybridConnectionCollection is collection of hostname bindings. +type HybridConnectionCollection struct { + autorest.Response `json:"-"` + Value *[]HybridConnection `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// HybridConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client HybridConnectionCollection) HybridConnectionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// HybridConnectionKey is hybrid Connection key contract. This has the send key +// name and value for a Hybrid Connection. +type HybridConnectionKey struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HybridConnectionKeyProperties `json:"properties,omitempty"` +} + +// HybridConnectionKeyProperties is hybridConnectionKey resource specific +// properties +type HybridConnectionKeyProperties struct { + SendKeyName *string `json:"sendKeyName,omitempty"` + SendKeyValue *string `json:"sendKeyValue,omitempty"` +} + +// HybridConnectionLimits is hybrid Connection limits contract. This is used to +// return the plan limits of Hybrid Connections. +type HybridConnectionLimits struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *HybridConnectionLimitsProperties `json:"properties,omitempty"` +} + +// HybridConnectionLimitsProperties is hybridConnectionLimits resource specific +// properties +type HybridConnectionLimitsProperties struct { + Current *int32 `json:"current,omitempty"` + Maximum *int32 `json:"maximum,omitempty"` +} + +// Identifier is identifier. +type Identifier struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *IdentifierProperties `json:"properties,omitempty"` +} + +// IdentifierProperties is identifier resource specific properties +type IdentifierProperties struct { + ID *string `json:"id,omitempty"` +} + +// IdentifierCollection is collection of identifiers. +type IdentifierCollection struct { + autorest.Response `json:"-"` + Value *[]Identifier `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// IdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client IdentifierCollection) IdentifierCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// IPSecurityRestriction is iP security restriction on an app. +type IPSecurityRestriction struct { + IPAddress *string `json:"ipAddress,omitempty"` + SubnetMask *string `json:"subnetMask,omitempty"` +} + +// ListCapability is +type ListCapability struct { + autorest.Response `json:"-"` + Value *[]Capability `json:"value,omitempty"` +} + +// ListCertificateEmail is +type ListCertificateEmail struct { + autorest.Response `json:"-"` + Value *[]CertificateEmail `json:"value,omitempty"` +} + +// ListCertificateOrderAction is +type ListCertificateOrderAction struct { + autorest.Response `json:"-"` + Value *[]CertificateOrderAction `json:"value,omitempty"` +} + +// ListHostingEnvironmentDiagnostics is +type ListHostingEnvironmentDiagnostics struct { + autorest.Response `json:"-"` + Value *[]HostingEnvironmentDiagnostics `json:"value,omitempty"` +} + +// ListOperation is +type ListOperation struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` +} + +// ListRecommendation is +type ListRecommendation struct { + autorest.Response `json:"-"` + Value *[]Recommendation `json:"value,omitempty"` +} + +// ListSiteConfigurationSnapshotInfo is +type ListSiteConfigurationSnapshotInfo struct { + autorest.Response `json:"-"` + Value *[]SiteConfigurationSnapshotInfo `json:"value,omitempty"` +} + +// ListVnetInfo is +type ListVnetInfo struct { + autorest.Response `json:"-"` + Value *[]VnetInfo `json:"value,omitempty"` +} + +// ListVnetRoute is +type ListVnetRoute struct { + autorest.Response `json:"-"` + Value *[]VnetRoute `json:"value,omitempty"` +} + +// LocalizableString is localizable string object containing the name and a +// localized value. +type LocalizableString struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MetricAvailabilily is metric availability and retention. +type MetricAvailabilily struct { + TimeGrain *string `json:"timeGrain,omitempty"` + Retention *string `json:"retention,omitempty"` +} + +// MetricDefinition is metadata for a metric. +type MetricDefinition struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *MetricDefinitionProperties `json:"properties,omitempty"` +} + +// MetricDefinitionProperties is metricDefinition resource specific properties +type MetricDefinitionProperties struct { + Name *string `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + PrimaryAggregationType *string `json:"primaryAggregationType,omitempty"` + MetricAvailabilities *[]MetricAvailabilily `json:"metricAvailabilities,omitempty"` + DisplayName *string `json:"displayName,omitempty"` +} + +// MigrateMySQLRequest is mySQL migration request. +type MigrateMySQLRequest struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *MigrateMySQLRequestProperties `json:"properties,omitempty"` +} + +// MigrateMySQLRequestProperties is migrateMySqlRequest resource specific +// properties +type MigrateMySQLRequestProperties struct { + ConnectionString *string `json:"connectionString,omitempty"` +} + +// MigrateMySQLStatus is mySQL migration status. +type MigrateMySQLStatus struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *MigrateMySQLStatusProperties `json:"properties,omitempty"` +} + +// MigrateMySQLStatusProperties is migrateMySqlStatus resource specific +// properties +type MigrateMySQLStatusProperties struct { + MigrationOperationStatus OperationStatus `json:"migrationOperationStatus,omitempty"` + OperationID *string `json:"operationId,omitempty"` + LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` +} + +// NameIdentifier is identifies an object. +type NameIdentifier struct { + Name *string `json:"name,omitempty"` +} + +// NameIdentifierCollection is collection of domain name identifiers. +type NameIdentifierCollection struct { + autorest.Response `json:"-"` + Value *[]NameIdentifier `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// NameIdentifierCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client NameIdentifierCollection) NameIdentifierCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// NameValuePair is name value pair. +type NameValuePair struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NetworkAccessControlEntry is network access control entry. +type NetworkAccessControlEntry struct { + Action AccessControlEntryAction `json:"action,omitempty"` + Description *string `json:"description,omitempty"` + Order *int32 `json:"order,omitempty"` + RemoteSubnet *string `json:"remoteSubnet,omitempty"` +} + +// NetworkFeatures is full view of network features for an app (presently VNET +// integration and Hybrid Connections). +type NetworkFeatures struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *NetworkFeaturesProperties `json:"properties,omitempty"` +} + +// NetworkFeaturesProperties is networkFeatures resource specific properties +type NetworkFeaturesProperties struct { + VirtualNetworkName *string `json:"virtualNetworkName,omitempty"` + VirtualNetworkConnection *VnetInfo `json:"virtualNetworkConnection,omitempty"` + HybridConnections *[]RelayServiceConnectionEntity `json:"hybridConnections,omitempty"` + HybridConnectionsV2 *[]HybridConnection `json:"hybridConnectionsV2,omitempty"` +} + +// Operation is operation. +type Operation struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Status OperationStatus `json:"status,omitempty"` + Errors *[]ErrorEntity `json:"errors,omitempty"` + CreatedTime *date.Time `json:"createdTime,omitempty"` + ModifiedTime *date.Time `json:"modifiedTime,omitempty"` + ExpirationTime *date.Time `json:"expirationTime,omitempty"` + GeoMasterOperationID *string `json:"geoMasterOperationId,omitempty"` +} + +// PerfMonCounterCollection is collection of performance monitor counters. +type PerfMonCounterCollection struct { + autorest.Response `json:"-"` + Value *[]PerfMonResponse `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PerfMonCounterCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PerfMonCounterCollection) PerfMonCounterCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PerfMonResponse is performance monitor API response. +type PerfMonResponse struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Data *PerfMonSet `json:"data,omitempty"` +} + +// PerfMonSample is performance monitor sample in a set. +type PerfMonSample struct { + Time *date.Time `json:"time,omitempty"` + InstanceName *string `json:"instanceName,omitempty"` + Value *float64 `json:"value,omitempty"` +} + +// PerfMonSet is metric information. +type PerfMonSet struct { + Name *string `json:"name,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + Values *[]PerfMonSample `json:"values,omitempty"` +} + +// PremierAddOn is premier add-on. +type PremierAddOn struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PremierAddOnProperties `json:"properties,omitempty"` +} + +// PremierAddOnProperties is premierAddOn resource specific properties +type PremierAddOnProperties struct { + Sku *string `json:"sku,omitempty"` + Product *string `json:"product,omitempty"` + Vendor *string `json:"vendor,omitempty"` + PremierAddOnName *string `json:"name,omitempty"` + Location *string `json:"location,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PremierAddOnOffer is premier add-on offer. +type PremierAddOnOffer struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *PremierAddOnOfferProperties `json:"properties,omitempty"` +} + +// PremierAddOnOfferProperties is premierAddOnOffer resource specific +// properties +type PremierAddOnOfferProperties struct { + Sku *string `json:"sku,omitempty"` + Product *string `json:"product,omitempty"` + Vendor *string `json:"vendor,omitempty"` + Name *string `json:"name,omitempty"` + PromoCodeRequired *bool `json:"promoCodeRequired,omitempty"` + Quota *int32 `json:"quota,omitempty"` + WebHostingPlanRestrictions AppServicePlanRestrictions `json:"webHostingPlanRestrictions,omitempty"` + PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` + LegalTermsURL *string `json:"legalTermsUrl,omitempty"` + MarketplacePublisher *string `json:"marketplacePublisher,omitempty"` + MarketplaceOffer *string `json:"marketplaceOffer,omitempty"` +} + +// PremierAddOnOfferCollection is collection of premier add-on offers. +type PremierAddOnOfferCollection struct { + autorest.Response `json:"-"` + Value *[]PremierAddOnOffer `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// PremierAddOnOfferCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client PremierAddOnOfferCollection) PremierAddOnOfferCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// PushSettings is push settings for the App. +type PushSettings struct { + autorest.Response `json:"-"` + IsPushEnabled *bool `json:"isPushEnabled,omitempty"` + TagWhitelistJSON *string `json:"tagWhitelistJson,omitempty"` + TagsRequiringAuth *string `json:"tagsRequiringAuth,omitempty"` + DynamicTagsJSON *string `json:"dynamicTagsJson,omitempty"` +} + +// RampUpRule is routing rules for ramp up testing. This rule allows to +// redirect static traffic % to a slot or to gradually change routing % based +// on performance. +type RampUpRule struct { + ActionHostName *string `json:"actionHostName,omitempty"` + ReroutePercentage *float64 `json:"reroutePercentage,omitempty"` + ChangeStep *float64 `json:"changeStep,omitempty"` + ChangeIntervalInMinutes *int32 `json:"changeIntervalInMinutes,omitempty"` + MinReroutePercentage *float64 `json:"minReroutePercentage,omitempty"` + MaxReroutePercentage *float64 `json:"maxReroutePercentage,omitempty"` + ChangeDecisionCallbackURL *string `json:"changeDecisionCallbackUrl,omitempty"` + Name *string `json:"name,omitempty"` +} + +// ReadCloser is +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + +// Recommendation is represents a recommendation result generated by the +// recommendation engine. +type Recommendation struct { + CreationTime *date.Time `json:"creationTime,omitempty"` + RecommendationID *string `json:"recommendationId,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + ResourceScope ResourceScopeType `json:"resourceScope,omitempty"` + RuleName *string `json:"ruleName,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Message *string `json:"message,omitempty"` + Level NotificationLevel `json:"level,omitempty"` + Channels Channels `json:"channels,omitempty"` + Tags *[]string `json:"tags,omitempty"` + ActionName *string `json:"actionName,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + NextNotificationTime *date.Time `json:"nextNotificationTime,omitempty"` + NotificationExpirationTime *date.Time `json:"notificationExpirationTime,omitempty"` + NotifiedTime *date.Time `json:"notifiedTime,omitempty"` + Score *float64 `json:"score,omitempty"` + IsDynamic *bool `json:"isDynamic,omitempty"` + ExtensionName *string `json:"extensionName,omitempty"` + BladeName *string `json:"bladeName,omitempty"` + ForwardLink *string `json:"forwardLink,omitempty"` +} + +// RecommendationRule is represents a recommendation rule that the +// recommendation engine can perform. +type RecommendationRule struct { + autorest.Response `json:"-"` + Name *string `json:"name,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Message *string `json:"message,omitempty"` + RecommendationID *uuid.UUID `json:"recommendationId,omitempty"` + Description *string `json:"description,omitempty"` + ActionName *string `json:"actionName,omitempty"` + Level NotificationLevel `json:"level,omitempty"` + Channels Channels `json:"channels,omitempty"` + Tags *[]string `json:"tags,omitempty"` + IsDynamic *bool `json:"isDynamic,omitempty"` + ExtensionName *string `json:"extensionName,omitempty"` + BladeName *string `json:"bladeName,omitempty"` + ForwardLink *string `json:"forwardLink,omitempty"` +} + +// RecoverResponse is response for an app recovery request. +type RecoverResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RecoverResponseProperties `json:"properties,omitempty"` +} + +// RecoverResponseProperties is recoverResponse resource specific properties +type RecoverResponseProperties struct { + OperationID *string `json:"operationId,omitempty"` +} + +// ReissueCertificateOrderRequest is class representing certificate reissue +// request. +type ReissueCertificateOrderRequest struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ReissueCertificateOrderRequestProperties `json:"properties,omitempty"` +} + +// ReissueCertificateOrderRequestProperties is reissueCertificateOrderRequest +// resource specific properties +type ReissueCertificateOrderRequestProperties struct { + KeySize *int32 `json:"keySize,omitempty"` + DelayExistingRevokeInHours *int32 `json:"delayExistingRevokeInHours,omitempty"` + Csr *string `json:"csr,omitempty"` + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` +} + +// RelayServiceConnectionEntity is hybrid Connection for an App Service app. +type RelayServiceConnectionEntity struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RelayServiceConnectionEntityProperties `json:"properties,omitempty"` +} + +// RelayServiceConnectionEntityProperties is relayServiceConnectionEntity +// resource specific properties +type RelayServiceConnectionEntityProperties struct { + EntityName *string `json:"entityName,omitempty"` + EntityConnectionString *string `json:"entityConnectionString,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceConnectionString *string `json:"resourceConnectionString,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Port *int32 `json:"port,omitempty"` + BiztalkURI *string `json:"biztalkUri,omitempty"` +} + +// RenewCertificateOrderRequest is class representing certificate renew +// request. +type RenewCertificateOrderRequest struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RenewCertificateOrderRequestProperties `json:"properties,omitempty"` +} + +// RenewCertificateOrderRequestProperties is renewCertificateOrderRequest +// resource specific properties +type RenewCertificateOrderRequestProperties struct { + KeySize *int32 `json:"keySize,omitempty"` + Csr *string `json:"csr,omitempty"` + IsPrivateKeyExternal *bool `json:"isPrivateKeyExternal,omitempty"` +} + +// RequestsBasedTrigger is trigger based on total requests. +type RequestsBasedTrigger struct { + Count *int32 `json:"count,omitempty"` + TimeInterval *string `json:"timeInterval,omitempty"` +} + +// Resource is azure resource. +type Resource struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// ResourceCollection is collection of resources. +type ResourceCollection struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceCollection) ResourceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResourceHealthMetadata is used for getting ResourceHealthCheck settings. +type ResourceHealthMetadata struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ResourceHealthMetadataProperties `json:"properties,omitempty"` +} + +// ResourceHealthMetadataProperties is resourceHealthMetadata resource specific +// properties +type ResourceHealthMetadataProperties struct { + ID *string `json:"id,omitempty"` + Category *string `json:"category,omitempty"` + SignalAvailability *bool `json:"signalAvailability,omitempty"` +} + +// ResourceMetric is object representing a metric for any resource . +type ResourceMetric struct { + Name *ResourceMetricName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + TimeGrain *string `json:"timeGrain,omitempty"` + StartTime *date.Time `json:"startTime,omitempty"` + EndTime *date.Time `json:"endTime,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` + ID *string `json:"id,omitempty"` + MetricValues *[]ResourceMetricValue `json:"metricValues,omitempty"` + Properties *[]ResourceMetricProperty `json:"properties,omitempty"` +} + +// ResourceMetricAvailability is metrics availability and retention. +type ResourceMetricAvailability struct { + TimeGrain *string `json:"timeGrain,omitempty"` + Retention *string `json:"retention,omitempty"` +} + +// ResourceMetricCollection is collection of metric responses. +type ResourceMetricCollection struct { + autorest.Response `json:"-"` + Value *[]ResourceMetric `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceMetricCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceMetricCollection) ResourceMetricCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResourceMetricDefinition is metadata for the metrics. +type ResourceMetricDefinition struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *ResourceMetricDefinitionProperties `json:"properties,omitempty"` +} + +// ResourceMetricDefinitionProperties is resourceMetricDefinition resource +// specific properties +type ResourceMetricDefinitionProperties struct { + Name *ResourceMetricName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` + PrimaryAggregationType *string `json:"primaryAggregationType,omitempty"` + MetricAvailabilities *[]ResourceMetricAvailability `json:"metricAvailabilities,omitempty"` + ResourceURI *string `json:"resourceUri,omitempty"` + ID *string `json:"id,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} + +// ResourceMetricDefinitionCollection is collection of metric definitions. +type ResourceMetricDefinitionCollection struct { + autorest.Response `json:"-"` + Value *[]ResourceMetricDefinition `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceMetricDefinitionCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client ResourceMetricDefinitionCollection) ResourceMetricDefinitionCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// ResourceMetricName is name of a metric for any resource . +type ResourceMetricName struct { + Value *string `json:"value,omitempty"` + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// ResourceMetricProperty is resource metric property. +type ResourceMetricProperty struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ResourceMetricValue is value of resource metric. +type ResourceMetricValue struct { + Timestamp *string `json:"timestamp,omitempty"` + Average *float64 `json:"average,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + Total *float64 `json:"total,omitempty"` + Count *float64 `json:"count,omitempty"` + Properties *[]ResourceMetricProperty `json:"properties,omitempty"` +} + +// ResourceNameAvailability is information regarding availbility of a resource +// name. +type ResourceNameAvailability struct { + autorest.Response `json:"-"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason InAvailabilityReasonType `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ResourceNameAvailabilityRequest is resource name availability request +// content. +type ResourceNameAvailabilityRequest struct { + Name *string `json:"name,omitempty"` + Type CheckNameResourceTypes `json:"type,omitempty"` + IsFqdn *bool `json:"isFqdn,omitempty"` +} + +// RestoreRequest is description of a restore request. +type RestoreRequest struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RestoreRequestProperties `json:"properties,omitempty"` +} + +// RestoreRequestProperties is restoreRequest resource specific properties +type RestoreRequestProperties struct { + StorageAccountURL *string `json:"storageAccountUrl,omitempty"` + BlobName *string `json:"blobName,omitempty"` + Overwrite *bool `json:"overwrite,omitempty"` + SiteName *string `json:"siteName,omitempty"` + Databases *[]DatabaseBackupSetting `json:"databases,omitempty"` + IgnoreConflictingHostNames *bool `json:"ignoreConflictingHostNames,omitempty"` + OperationType BackupRestoreOperationType `json:"operationType,omitempty"` + AdjustConnectionStrings *bool `json:"adjustConnectionStrings,omitempty"` + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` +} + +// RestoreResponse is response for an app restore request. +type RestoreResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *RestoreResponseProperties `json:"properties,omitempty"` +} + +// RestoreResponseProperties is restoreResponse resource specific properties +type RestoreResponseProperties struct { + OperationID *string `json:"operationId,omitempty"` +} + +// SetObject is +type SetObject struct { + autorest.Response `json:"-"` + Value *map[string]interface{} `json:"value,omitempty"` +} + +// Site is a web app, a mobile app backend, or an API app. +type Site struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteProperties `json:"properties,omitempty"` +} + +// SiteProperties is site resource specific properties +type SiteProperties struct { + State *string `json:"state,omitempty"` + HostNames *[]string `json:"hostNames,omitempty"` + RepositorySiteName *string `json:"repositorySiteName,omitempty"` + UsageState UsageState `json:"usageState,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EnabledHostNames *[]string `json:"enabledHostNames,omitempty"` + AvailabilityState SiteAvailabilityState `json:"availabilityState,omitempty"` + HostNameSslStates *[]HostNameSslState `json:"hostNameSslStates,omitempty"` + ServerFarmID *string `json:"serverFarmId,omitempty"` + Reserved *bool `json:"reserved,omitempty"` + LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` + SiteConfig *SiteConfig `json:"siteConfig,omitempty"` + TrafficManagerHostNames *[]string `json:"trafficManagerHostNames,omitempty"` + PremiumAppDeployed *bool `json:"premiumAppDeployed,omitempty"` + ScmSiteAlsoStopped *bool `json:"scmSiteAlsoStopped,omitempty"` + TargetSwapSlot *string `json:"targetSwapSlot,omitempty"` + HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"` + MicroService *string `json:"microService,omitempty"` + GatewaySiteName *string `json:"gatewaySiteName,omitempty"` + ClientAffinityEnabled *bool `json:"clientAffinityEnabled,omitempty"` + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` + HostNamesDisabled *bool `json:"hostNamesDisabled,omitempty"` + OutboundIPAddresses *string `json:"outboundIpAddresses,omitempty"` + ContainerSize *int32 `json:"containerSize,omitempty"` + DailyMemoryTimeQuota *int32 `json:"dailyMemoryTimeQuota,omitempty"` + SuspendedTill *date.Time `json:"suspendedTill,omitempty"` + MaxNumberOfWorkers *int32 `json:"maxNumberOfWorkers,omitempty"` + CloningInfo *CloningInfo `json:"cloningInfo,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + IsDefaultContainer *bool `json:"isDefaultContainer,omitempty"` + DefaultHostName *string `json:"defaultHostName,omitempty"` + SlotSwapStatus *SlotSwapStatus `json:"slotSwapStatus,omitempty"` +} + +// SiteAuthSettings is configuration settings for the Azure App Service +// Authentication / Authorization feature. +type SiteAuthSettings struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteAuthSettingsProperties `json:"properties,omitempty"` +} + +// SiteAuthSettingsProperties is siteAuthSettings resource specific properties +type SiteAuthSettingsProperties struct { + Enabled *bool `json:"enabled,omitempty"` + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + UnauthenticatedClientAction UnauthenticatedClientAction `json:"unauthenticatedClientAction,omitempty"` + TokenStoreEnabled *bool `json:"tokenStoreEnabled,omitempty"` + AllowedExternalRedirectUrls *[]string `json:"allowedExternalRedirectUrls,omitempty"` + DefaultProvider BuiltInAuthenticationProvider `json:"defaultProvider,omitempty"` + TokenRefreshExtensionHours *float64 `json:"tokenRefreshExtensionHours,omitempty"` + ClientID *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` + Issuer *string `json:"issuer,omitempty"` + AllowedAudiences *[]string `json:"allowedAudiences,omitempty"` + AdditionalLoginParams *[]string `json:"additionalLoginParams,omitempty"` + GoogleClientID *string `json:"googleClientId,omitempty"` + GoogleClientSecret *string `json:"googleClientSecret,omitempty"` + GoogleOAuthScopes *[]string `json:"googleOAuthScopes,omitempty"` + FacebookAppID *string `json:"facebookAppId,omitempty"` + FacebookAppSecret *string `json:"facebookAppSecret,omitempty"` + FacebookOAuthScopes *[]string `json:"facebookOAuthScopes,omitempty"` + TwitterConsumerKey *string `json:"twitterConsumerKey,omitempty"` + TwitterConsumerSecret *string `json:"twitterConsumerSecret,omitempty"` + MicrosoftAccountClientID *string `json:"microsoftAccountClientId,omitempty"` + MicrosoftAccountClientSecret *string `json:"microsoftAccountClientSecret,omitempty"` + MicrosoftAccountOAuthScopes *[]string `json:"microsoftAccountOAuthScopes,omitempty"` +} + +// SiteCloneability is represents whether or not an app is cloneable. +type SiteCloneability struct { + autorest.Response `json:"-"` + Result CloneAbilityResult `json:"result,omitempty"` + BlockingFeatures *[]SiteCloneabilityCriterion `json:"blockingFeatures,omitempty"` + UnsupportedFeatures *[]SiteCloneabilityCriterion `json:"unsupportedFeatures,omitempty"` + BlockingCharacteristics *[]SiteCloneabilityCriterion `json:"blockingCharacteristics,omitempty"` +} + +// SiteCloneabilityCriterion is an app cloneability criterion. +type SiteCloneabilityCriterion struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` +} + +// SiteConfig is configuration of an App Service app. +type SiteConfig struct { + NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` + DefaultDocuments *[]string `json:"defaultDocuments,omitempty"` + NetFrameworkVersion *string `json:"netFrameworkVersion,omitempty"` + PhpVersion *string `json:"phpVersion,omitempty"` + PythonVersion *string `json:"pythonVersion,omitempty"` + NodeVersion *string `json:"nodeVersion,omitempty"` + LinuxFxVersion *string `json:"linuxFxVersion,omitempty"` + RequestTracingEnabled *bool `json:"requestTracingEnabled,omitempty"` + RequestTracingExpirationTime *date.Time `json:"requestTracingExpirationTime,omitempty"` + RemoteDebuggingEnabled *bool `json:"remoteDebuggingEnabled,omitempty"` + RemoteDebuggingVersion *string `json:"remoteDebuggingVersion,omitempty"` + HTTPLoggingEnabled *bool `json:"httpLoggingEnabled,omitempty"` + LogsDirectorySizeLimit *int32 `json:"logsDirectorySizeLimit,omitempty"` + DetailedErrorLoggingEnabled *bool `json:"detailedErrorLoggingEnabled,omitempty"` + PublishingUsername *string `json:"publishingUsername,omitempty"` + AppSettings *[]NameValuePair `json:"appSettings,omitempty"` + ConnectionStrings *[]ConnStringInfo `json:"connectionStrings,omitempty"` + MachineKey *SiteMachineKey `json:"machineKey,omitempty"` + HandlerMappings *[]HandlerMapping `json:"handlerMappings,omitempty"` + DocumentRoot *string `json:"documentRoot,omitempty"` + ScmType ScmType `json:"scmType,omitempty"` + Use32BitWorkerProcess *bool `json:"use32BitWorkerProcess,omitempty"` + WebSocketsEnabled *bool `json:"webSocketsEnabled,omitempty"` + AlwaysOn *bool `json:"alwaysOn,omitempty"` + JavaVersion *string `json:"javaVersion,omitempty"` + JavaContainer *string `json:"javaContainer,omitempty"` + JavaContainerVersion *string `json:"javaContainerVersion,omitempty"` + AppCommandLine *string `json:"appCommandLine,omitempty"` + ManagedPipelineMode ManagedPipelineMode `json:"managedPipelineMode,omitempty"` + VirtualApplications *[]VirtualApplication `json:"virtualApplications,omitempty"` + LoadBalancing SiteLoadBalancing `json:"loadBalancing,omitempty"` + Experiments *Experiments `json:"experiments,omitempty"` + Limits *SiteLimits `json:"limits,omitempty"` + AutoHealEnabled *bool `json:"autoHealEnabled,omitempty"` + AutoHealRules *AutoHealRules `json:"autoHealRules,omitempty"` + TracingOptions *string `json:"tracingOptions,omitempty"` + VnetName *string `json:"vnetName,omitempty"` + Cors *CorsSettings `json:"cors,omitempty"` + Push *PushSettings `json:"push,omitempty"` + APIDefinition *APIDefinitionInfo `json:"apiDefinition,omitempty"` + AutoSwapSlotName *string `json:"autoSwapSlotName,omitempty"` + LocalMySQLEnabled *bool `json:"localMySqlEnabled,omitempty"` + IPSecurityRestrictions *[]IPSecurityRestriction `json:"ipSecurityRestrictions,omitempty"` +} + +// SiteConfigResource is web app configuration ARM resource. +type SiteConfigResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteConfig `json:"properties,omitempty"` +} + +// SiteConfigResourceCollection is collection of site configurations. +type SiteConfigResourceCollection struct { + autorest.Response `json:"-"` + Value *[]SiteConfigResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SiteConfigResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SiteConfigResourceCollection) SiteConfigResourceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SiteConfigurationSnapshotInfo is a snapshot of a web app configuration. +type SiteConfigurationSnapshotInfo struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteConfigurationSnapshotInfoProperties `json:"properties,omitempty"` +} + +// SiteConfigurationSnapshotInfoProperties is siteConfigurationSnapshotInfo +// resource specific properties +type SiteConfigurationSnapshotInfoProperties struct { + Time *date.Time `json:"time,omitempty"` + ID *int32 `json:"id,omitempty"` +} + +// SiteInstance is instance of an app. +type SiteInstance struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteInstanceProperties `json:"properties,omitempty"` +} + +// SiteInstanceProperties is siteInstance resource specific properties +type SiteInstanceProperties struct { + Name *string `json:"name,omitempty"` +} + +// SiteLimits is metric limits set on an app. +type SiteLimits struct { + MaxPercentageCPU *float64 `json:"maxPercentageCpu,omitempty"` + MaxMemoryInMb *int64 `json:"maxMemoryInMb,omitempty"` + MaxDiskSizeInMb *int64 `json:"maxDiskSizeInMb,omitempty"` +} + +// SiteLogsConfig is configuration of App Service site logs. +type SiteLogsConfig struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteLogsConfigProperties `json:"properties,omitempty"` +} + +// SiteLogsConfigProperties is siteLogsConfig resource specific properties +type SiteLogsConfigProperties struct { + ApplicationLogs *ApplicationLogsConfig `json:"applicationLogs,omitempty"` + HTTPLogs *HTTPLogsConfig `json:"httpLogs,omitempty"` + FailedRequestsTracing *EnabledConfig `json:"failedRequestsTracing,omitempty"` + DetailedErrorMessages *EnabledConfig `json:"detailedErrorMessages,omitempty"` +} + +// SiteMachineKey is machineKey of an app. +type SiteMachineKey struct { + Validation *string `json:"validation,omitempty"` + ValidationKey *string `json:"validationKey,omitempty"` + Decryption *string `json:"decryption,omitempty"` + DecryptionKey *string `json:"decryptionKey,omitempty"` +} + +// SitePhpErrorLogFlag is used for getting PHP error logging flag. +type SitePhpErrorLogFlag struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SitePhpErrorLogFlagProperties `json:"properties,omitempty"` +} + +// SitePhpErrorLogFlagProperties is sitePhpErrorLogFlag resource specific +// properties +type SitePhpErrorLogFlagProperties struct { + LocalLogErrors *string `json:"localLogErrors,omitempty"` + MasterLogErrors *string `json:"masterLogErrors,omitempty"` + LocalLogErrorsMaxLength *string `json:"localLogErrorsMaxLength,omitempty"` + MasterLogErrorsMaxLength *string `json:"masterLogErrorsMaxLength,omitempty"` +} + +// SiteSeal is site seal +type SiteSeal struct { + autorest.Response `json:"-"` + *string `json:"html,omitempty"` +} + +// SiteSealRequest is site seal request. +type SiteSealRequest struct { + LightTheme *bool `json:"lightTheme,omitempty"` + Locale *string `json:"locale,omitempty"` +} + +// SiteSourceControl is source control configuration for an app. +type SiteSourceControl struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SiteSourceControlProperties `json:"properties,omitempty"` +} + +// SiteSourceControlProperties is siteSourceControl resource specific +// properties +type SiteSourceControlProperties struct { + RepoURL *string `json:"repoUrl,omitempty"` + Branch *string `json:"branch,omitempty"` + IsManualIntegration *bool `json:"isManualIntegration,omitempty"` + DeploymentRollbackEnabled *bool `json:"deploymentRollbackEnabled,omitempty"` + IsMercurial *bool `json:"isMercurial,omitempty"` +} + +// SkuCapacity is description of the App Service plan scale options. +type SkuCapacity struct { + Minimum *int32 `json:"minimum,omitempty"` + Maximum *int32 `json:"maximum,omitempty"` + Default *int32 `json:"default,omitempty"` + ScaleType *string `json:"scaleType,omitempty"` +} + +// SkuDescription is description of a SKU for a scalable resource. +type SkuDescription struct { + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` + Size *string `json:"size,omitempty"` + Family *string `json:"family,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` + SkuCapacity *SkuCapacity `json:"skuCapacity,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Capabilities *[]Capability `json:"capabilities,omitempty"` +} + +// SkuInfo is sKU discovery information. +type SkuInfo struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` + Capacity *SkuCapacity `json:"capacity,omitempty"` +} + +// SkuInfoCollection is collection of SKU information. +type SkuInfoCollection struct { + autorest.Response `json:"-"` + Value *[]SkuInfo `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SkuInfoCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SkuInfoCollection) SkuInfoCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SkuInfos is collection of SKU information. +type SkuInfos struct { + autorest.Response `json:"-"` + ResourceType *string `json:"resourceType,omitempty"` + Skus *[]GlobalCsmSkuDescription `json:"skus,omitempty"` +} + +// SlotConfigNames is names for connection strings and application settings to +// be marked as sticky to the deployment slot and not moved during a swap +// operation. +// This is valid for all deployment slots in an app. +type SlotConfigNames struct { + ConnectionStringNames *[]string `json:"connectionStringNames,omitempty"` + AppSettingNames *[]string `json:"appSettingNames,omitempty"` +} + +// SlotConfigNamesResource is slot Config names azure resource. +type SlotConfigNamesResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SlotConfigNames `json:"properties,omitempty"` +} + +// SlotDifference is a setting difference between two deployment slots of an +// app. +type SlotDifference struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SlotDifferenceProperties `json:"properties,omitempty"` +} + +// SlotDifferenceProperties is slotDifference resource specific properties +type SlotDifferenceProperties struct { + Type *string `json:"type,omitempty"` + SettingType *string `json:"settingType,omitempty"` + DiffRule *string `json:"diffRule,omitempty"` + SettingName *string `json:"settingName,omitempty"` + ValueInCurrentSlot *string `json:"valueInCurrentSlot,omitempty"` + ValueInTargetSlot *string `json:"valueInTargetSlot,omitempty"` + Description *string `json:"description,omitempty"` +} + +// SlotDifferenceCollection is collection of slot differences. +type SlotDifferenceCollection struct { + autorest.Response `json:"-"` + Value *[]SlotDifference `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SlotDifferenceCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SlotDifferenceCollection) SlotDifferenceCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SlotSwapStatus is the status of the last successfull slot swap operation. +type SlotSwapStatus struct { + TimestampUtc *date.Time `json:"timestampUtc,omitempty"` + SourceSlotName *string `json:"sourceSlotName,omitempty"` + DestinationSlotName *string `json:"destinationSlotName,omitempty"` +} + +// SlowRequestsBasedTrigger is trigger based on request execution time. +type SlowRequestsBasedTrigger struct { + TimeTaken *string `json:"timeTaken,omitempty"` + Count *int32 `json:"count,omitempty"` + TimeInterval *string `json:"timeInterval,omitempty"` +} + +// Snapshot is a snapshot of an app. +type Snapshot struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SnapshotProperties `json:"properties,omitempty"` +} + +// SnapshotProperties is snapshot resource specific properties +type SnapshotProperties struct { + Time *date.Time `json:"time,omitempty"` +} + +// SnapshotCollection is collection of snapshots which can be used to revert an +// app to a previous time. +type SnapshotCollection struct { + autorest.Response `json:"-"` + Value *[]Snapshot `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SnapshotCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SnapshotCollection) SnapshotCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SourceControl is the source control OAuth token. +type SourceControl struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *SourceControlProperties `json:"properties,omitempty"` +} + +// SourceControlProperties is sourceControl resource specific properties +type SourceControlProperties struct { + Name *string `json:"name,omitempty"` + Token *string `json:"token,omitempty"` + TokenSecret *string `json:"tokenSecret,omitempty"` + RefreshToken *string `json:"refreshToken,omitempty"` + ExpirationTime *date.Time `json:"expirationTime,omitempty"` +} + +// SourceControlCollection is collection of source controls. +type SourceControlCollection struct { + autorest.Response `json:"-"` + Value *[]SourceControl `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SourceControlCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SourceControlCollection) SourceControlCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// StampCapacity is stamp capacity information. +type StampCapacity struct { + Name *string `json:"name,omitempty"` + AvailableCapacity *int64 `json:"availableCapacity,omitempty"` + TotalCapacity *int64 `json:"totalCapacity,omitempty"` + Unit *string `json:"unit,omitempty"` + ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` + WorkerSize WorkerSizeOptions `json:"workerSize,omitempty"` + WorkerSizeID *int32 `json:"workerSizeId,omitempty"` + ExcludeFromCapacityAllocation *bool `json:"excludeFromCapacityAllocation,omitempty"` + IsApplicableForAllComputeModes *bool `json:"isApplicableForAllComputeModes,omitempty"` + SiteMode *string `json:"siteMode,omitempty"` +} + +// StampCapacityCollection is collection of stamp capacities. +type StampCapacityCollection struct { + autorest.Response `json:"-"` + Value *[]StampCapacity `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// StampCapacityCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client StampCapacityCollection) StampCapacityCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// StatusCodesBasedTrigger is trigger based on status code. +type StatusCodesBasedTrigger struct { + Status *int32 `json:"status,omitempty"` + SubStatus *int32 `json:"subStatus,omitempty"` + Win32Status *int32 `json:"win32Status,omitempty"` + Count *int32 `json:"count,omitempty"` + TimeInterval *string `json:"timeInterval,omitempty"` +} + +// StorageMigrationOptions is options for app content migration. +type StorageMigrationOptions struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *StorageMigrationOptionsProperties `json:"properties,omitempty"` +} + +// StorageMigrationOptionsProperties is storageMigrationOptions resource +// specific properties +type StorageMigrationOptionsProperties struct { + AzurefilesConnectionString *string `json:"azurefilesConnectionString,omitempty"` + AzurefilesShare *string `json:"azurefilesShare,omitempty"` + SwitchSiteAfterMigration *bool `json:"switchSiteAfterMigration,omitempty"` + BlockWriteAccessToSite *bool `json:"blockWriteAccessToSite,omitempty"` +} + +// StorageMigrationResponse is response for a migration of app content request. +type StorageMigrationResponse struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *StorageMigrationResponseProperties `json:"properties,omitempty"` +} + +// StorageMigrationResponseProperties is storageMigrationResponse resource +// specific properties +type StorageMigrationResponseProperties struct { + OperationID *string `json:"operationId,omitempty"` +} + +// String is +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// StringDictionary is string dictionary resource. +type StringDictionary struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Properties *map[string]*string `json:"properties,omitempty"` +} + +// TldLegalAgreement is legal agreement for a top level domain. +type TldLegalAgreement struct { + AgreementKey *string `json:"agreementKey,omitempty"` + Title *string `json:"title,omitempty"` + Content *string `json:"content,omitempty"` + URL *string `json:"url,omitempty"` +} + +// TldLegalAgreementCollection is collection of top-level domain legal +// agreements. +type TldLegalAgreementCollection struct { + autorest.Response `json:"-"` + Value *[]TldLegalAgreement `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// TldLegalAgreementCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client TldLegalAgreementCollection) TldLegalAgreementCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// TopLevelDomain is a top level domain object. +type TopLevelDomain struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *TopLevelDomainProperties `json:"properties,omitempty"` +} + +// TopLevelDomainProperties is topLevelDomain resource specific properties +type TopLevelDomainProperties struct { + DomainName *string `json:"name,omitempty"` + Privacy *bool `json:"privacy,omitempty"` +} + +// TopLevelDomainAgreementOption is options for retrieving the list of top +// level domain legal agreements. +type TopLevelDomainAgreementOption struct { + IncludePrivacy *bool `json:"includePrivacy,omitempty"` + ForTransfer *bool `json:"forTransfer,omitempty"` +} + +// TopLevelDomainCollection is collection of Top-level domains. +type TopLevelDomainCollection struct { + autorest.Response `json:"-"` + Value *[]TopLevelDomain `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// TopLevelDomainCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client TopLevelDomainCollection) TopLevelDomainCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// Usage is usage of the quota resource. +type Usage struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *UsageProperties `json:"properties,omitempty"` +} + +// UsageProperties is usage resource specific properties +type UsageProperties struct { + DisplayName *string `json:"displayName,omitempty"` + Name *string `json:"name,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + Unit *string `json:"unit,omitempty"` + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + NextResetTime *date.Time `json:"nextResetTime,omitempty"` + ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` + SiteMode *string `json:"siteMode,omitempty"` +} + +// UsageCollection is collection of usages. +type UsageCollection struct { + autorest.Response `json:"-"` + Value *[]Usage `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// UsageCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client UsageCollection) UsageCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// User is user crendentials used for publishing activity. +type User struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *UserProperties `json:"properties,omitempty"` +} + +// UserProperties is user resource specific properties +type UserProperties struct { + UserName *string `json:"name,omitempty"` + PublishingUserName *string `json:"publishingUserName,omitempty"` + PublishingPassword *string `json:"publishingPassword,omitempty"` + PublishingPasswordHash *string `json:"publishingPasswordHash,omitempty"` + PublishingPasswordHashSalt *string `json:"publishingPasswordHashSalt,omitempty"` +} + +// ValidateProperties is app properties used for validation. +type ValidateProperties struct { + ServerFarmID *string `json:"serverFarmId,omitempty"` + SkuName *string `json:"skuName,omitempty"` + NeedLinuxWorkers *bool `json:"needLinuxWorkers,omitempty"` + Capacity *int32 `json:"capacity,omitempty"` + HostingEnvironment *string `json:"hostingEnvironment,omitempty"` +} + +// ValidateRequest is resource validation request content. +type ValidateRequest struct { + Name *string `json:"name,omitempty"` + Type ValidateResourceTypes `json:"type,omitempty"` + Location *string `json:"location,omitempty"` + *ValidateProperties `json:"properties,omitempty"` +} + +// ValidateResponse is describes the result of resource validation. +type ValidateResponse struct { + autorest.Response `json:"-"` + Status *string `json:"status,omitempty"` + Error *ValidateResponseError `json:"error,omitempty"` +} + +// ValidateResponseError is error details for when validation fails. +type ValidateResponseError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// VirtualApplication is virtual application in an app. +type VirtualApplication struct { + VirtualPath *string `json:"virtualPath,omitempty"` + PhysicalPath *string `json:"physicalPath,omitempty"` + PreloadEnabled *bool `json:"preloadEnabled,omitempty"` + VirtualDirectories *[]VirtualDirectory `json:"virtualDirectories,omitempty"` +} + +// VirtualDirectory is directory for virtual application. +type VirtualDirectory struct { + VirtualPath *string `json:"virtualPath,omitempty"` + PhysicalPath *string `json:"physicalPath,omitempty"` +} + +// VirtualIPMapping is virtual IP mapping. +type VirtualIPMapping struct { + VirtualIP *string `json:"virtualIP,omitempty"` + InternalHTTPPort *int32 `json:"internalHttpPort,omitempty"` + InternalHTTPSPort *int32 `json:"internalHttpsPort,omitempty"` + InUse *bool `json:"inUse,omitempty"` +} + +// VirtualNetworkProfile is specification for using a Virtual Network. +type VirtualNetworkProfile struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + Subnet *string `json:"subnet,omitempty"` +} + +// VnetGateway is the Virtual Network gateway contract. This is used to give +// the Virtual Network gateway access to the VPN package. +type VnetGateway struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VnetGatewayProperties `json:"properties,omitempty"` +} + +// VnetGatewayProperties is vnetGateway resource specific properties +type VnetGatewayProperties struct { + VnetName *string `json:"vnetName,omitempty"` + VpnPackageURI *string `json:"vpnPackageUri,omitempty"` +} + +// VnetInfo is virtual Network information contract. +type VnetInfo struct { + autorest.Response `json:"-"` + VnetResourceID *string `json:"vnetResourceId,omitempty"` + CertThumbprint *string `json:"certThumbprint,omitempty"` + CertBlob *string `json:"certBlob,omitempty"` + Routes *[]VnetRoute `json:"routes,omitempty"` + ResyncRequired *bool `json:"resyncRequired,omitempty"` + DNSServers *string `json:"dnsServers,omitempty"` +} + +// VnetRoute is virtual Network route contract used to pass routing information +// for a Virtual Network. +type VnetRoute struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *VnetRouteProperties `json:"properties,omitempty"` +} + +// VnetRouteProperties is vnetRoute resource specific properties +type VnetRouteProperties struct { + VnetRouteName *string `json:"name,omitempty"` + StartAddress *string `json:"startAddress,omitempty"` + EndAddress *string `json:"endAddress,omitempty"` + RouteType RouteType `json:"routeType,omitempty"` +} + +// WorkerPool is worker pool of an App Service Environment. +type WorkerPool struct { + WorkerSizeID *int32 `json:"workerSizeId,omitempty"` + ComputeMode ComputeModeOptions `json:"computeMode,omitempty"` + WorkerSize *string `json:"workerSize,omitempty"` + WorkerCount *int32 `json:"workerCount,omitempty"` + InstanceNames *[]string `json:"instanceNames,omitempty"` +} + +// WorkerPoolCollection is collection of worker pools. +type WorkerPoolCollection struct { + autorest.Response `json:"-"` + Value *[]WorkerPoolResource `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkerPoolCollectionPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client WorkerPoolCollection) WorkerPoolCollectionPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// WorkerPoolResource is worker pool of an App Service Environment ARM +// resource. +type WorkerPoolResource struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Type *string `json:"type,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + *WorkerPool `json:"properties,omitempty"` + Sku *SkuDescription `json:"sku,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/provider.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/provider.go index 0bfffe9c84..b2c75d21f3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/provider.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/provider.go @@ -1,160 +1,160 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// ProviderClient is the composite Swagger for WebSite Management Client -type ProviderClient struct { - ManagementClient -} - -// NewProviderClient creates an instance of the ProviderClient client. -func NewProviderClient(subscriptionID string) ProviderClient { - return NewProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProviderClientWithBaseURI creates an instance of the ProviderClient -// client. -func NewProviderClientWithBaseURI(baseURI string, subscriptionID string) ProviderClient { - return ProviderClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetAvailableStacks get available application frameworks and their versions -func (client ProviderClient) GetAvailableStacks() (result SetObject, err error) { - req, err := client.GetAvailableStacksPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", nil, "Failure preparing request") - return - } - - resp, err := client.GetAvailableStacksSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", resp, "Failure sending request") - return - } - - result, err = client.GetAvailableStacksResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", resp, "Failure responding to request") - } - - return -} - -// GetAvailableStacksPreparer prepares the GetAvailableStacks request. -func (client ProviderClient) GetAvailableStacksPreparer() (*http.Request, error) { - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Web/availableStacks"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAvailableStacksSender sends the GetAvailableStacks request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) GetAvailableStacksSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAvailableStacksResponder handles the response to the GetAvailableStacks request. The method always -// closes the http.Response Body. -func (client ProviderClient) GetAvailableStacksResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAvailableStacksOnPrem get available application frameworks and their -// versions -func (client ProviderClient) GetAvailableStacksOnPrem() (result SetObject, err error) { - req, err := client.GetAvailableStacksOnPremPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", nil, "Failure preparing request") - return - } - - resp, err := client.GetAvailableStacksOnPremSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", resp, "Failure sending request") - return - } - - result, err = client.GetAvailableStacksOnPremResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", resp, "Failure responding to request") - } - - return -} - -// GetAvailableStacksOnPremPreparer prepares the GetAvailableStacksOnPrem request. -func (client ProviderClient) GetAvailableStacksOnPremPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetAvailableStacksOnPremSender sends the GetAvailableStacksOnPrem request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderClient) GetAvailableStacksOnPremSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetAvailableStacksOnPremResponder handles the response to the GetAvailableStacksOnPrem request. The method always -// closes the http.Response Body. -func (client ProviderClient) GetAvailableStacksOnPremResponder(resp *http.Response) (result SetObject, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProviderClient is the composite Swagger for WebSite Management Client +type ProviderClient struct { + ManagementClient +} + +// NewProviderClient creates an instance of the ProviderClient client. +func NewProviderClient(subscriptionID string) ProviderClient { + return NewProviderClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderClientWithBaseURI creates an instance of the ProviderClient +// client. +func NewProviderClientWithBaseURI(baseURI string, subscriptionID string) ProviderClient { + return ProviderClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetAvailableStacks get available application frameworks and their versions +func (client ProviderClient) GetAvailableStacks() (result SetObject, err error) { + req, err := client.GetAvailableStacksPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableStacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", resp, "Failure sending request") + return + } + + result, err = client.GetAvailableStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacks", resp, "Failure responding to request") + } + + return +} + +// GetAvailableStacksPreparer prepares the GetAvailableStacks request. +func (client ProviderClient) GetAvailableStacksPreparer() (*http.Request, error) { + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Web/availableStacks"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAvailableStacksSender sends the GetAvailableStacks request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetAvailableStacksSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAvailableStacksResponder handles the response to the GetAvailableStacks request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetAvailableStacksResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAvailableStacksOnPrem get available application frameworks and their +// versions +func (client ProviderClient) GetAvailableStacksOnPrem() (result SetObject, err error) { + req, err := client.GetAvailableStacksOnPremPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableStacksOnPremSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", resp, "Failure sending request") + return + } + + result, err = client.GetAvailableStacksOnPremResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.ProviderClient", "GetAvailableStacksOnPrem", resp, "Failure responding to request") + } + + return +} + +// GetAvailableStacksOnPremPreparer prepares the GetAvailableStacksOnPrem request. +func (client ProviderClient) GetAvailableStacksOnPremPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetAvailableStacksOnPremSender sends the GetAvailableStacksOnPrem request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderClient) GetAvailableStacksOnPremSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetAvailableStacksOnPremResponder handles the response to the GetAvailableStacksOnPrem request. The method always +// closes the http.Response Body. +func (client ProviderClient) GetAvailableStacksOnPremResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/recommendations.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/recommendations.go index ed910b170a..3cd70e2f88 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/recommendations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/recommendations.go @@ -1,570 +1,570 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// RecommendationsClient is the composite Swagger for WebSite Management Client -type RecommendationsClient struct { - ManagementClient -} - -// NewRecommendationsClient creates an instance of the RecommendationsClient -// client. -func NewRecommendationsClient(subscriptionID string) RecommendationsClient { - return NewRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecommendationsClientWithBaseURI creates an instance of the -// RecommendationsClient client. -func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) RecommendationsClient { - return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// DisableAllForWebApp disable all recommendations for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. siteName is name of the app. -func (client RecommendationsClient) DisableAllForWebApp(resourceGroupName string, siteName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "DisableAllForWebApp") - } - - req, err := client.DisableAllForWebAppPreparer(resourceGroupName, siteName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", nil, "Failure preparing request") - return - } - - resp, err := client.DisableAllForWebAppSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure sending request") - return - } - - result, err = client.DisableAllForWebAppResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure responding to request") - } - - return -} - -// DisableAllForWebAppPreparer prepares the DisableAllForWebApp request. -func (client RecommendationsClient) DisableAllForWebAppPreparer(resourceGroupName string, siteName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "siteName": autorest.Encode("path", siteName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DisableAllForWebAppSender sends the DisableAllForWebApp request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) DisableAllForWebAppSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DisableAllForWebAppResponder handles the response to the DisableAllForWebApp request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) DisableAllForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetRuleDetailsByWebApp get a recommendation rule for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. siteName is name of the app. name is name of the recommendation. -// updateSeen is specify true to update the last-seen timestamp of -// the recommendation object. -func (client RecommendationsClient) GetRuleDetailsByWebApp(resourceGroupName string, siteName string, name string, updateSeen *bool) (result RecommendationRule, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp") - } - - req, err := client.GetRuleDetailsByWebAppPreparer(resourceGroupName, siteName, name, updateSeen) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", nil, "Failure preparing request") - return - } - - resp, err := client.GetRuleDetailsByWebAppSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure sending request") - return - } - - result, err = client.GetRuleDetailsByWebAppResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure responding to request") - } - - return -} - -// GetRuleDetailsByWebAppPreparer prepares the GetRuleDetailsByWebApp request. -func (client RecommendationsClient) GetRuleDetailsByWebAppPreparer(resourceGroupName string, siteName string, name string, updateSeen *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "siteName": autorest.Encode("path", siteName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if updateSeen != nil { - queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetRuleDetailsByWebAppSender sends the GetRuleDetailsByWebApp request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) GetRuleDetailsByWebAppSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetRuleDetailsByWebAppResponder handles the response to the GetRuleDetailsByWebApp request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) GetRuleDetailsByWebAppResponder(resp *http.Response) (result RecommendationRule, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all recommendations for a subscription. -// -// featured is specify true to return only the most critical -// recommendations. The default is false, which returns all -// recommendations. filter is filter is specified by using OData syntax. -// Example: $filter=channels eq 'Api' or channel eq 'Notification' and -// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' -// and timeGrain eq duration'[PT1H|PT1M|P1D] -func (client RecommendationsClient) List(featured *bool, filter string) (result ListRecommendation, err error) { - req, err := client.ListPreparer(featured, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client RecommendationsClient) ListPreparer(featured *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if featured != nil { - queryParameters["featured"] = autorest.Encode("query", *featured) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) ListResponder(resp *http.Response) (result ListRecommendation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListHistoryForWebApp get past recommendations for an app, optionally -// specified by the time range. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. siteName is name of the app. filter is filter is specified by using -// OData syntax. Example: $filter=channels eq 'Api' or channel eq -// 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq -// '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] -func (client RecommendationsClient) ListHistoryForWebApp(resourceGroupName string, siteName string, filter string) (result ListRecommendation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ListHistoryForWebApp") - } - - req, err := client.ListHistoryForWebAppPreparer(resourceGroupName, siteName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", nil, "Failure preparing request") - return - } - - resp, err := client.ListHistoryForWebAppSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure sending request") - return - } - - result, err = client.ListHistoryForWebAppResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure responding to request") - } - - return -} - -// ListHistoryForWebAppPreparer prepares the ListHistoryForWebApp request. -func (client RecommendationsClient) ListHistoryForWebAppPreparer(resourceGroupName string, siteName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "siteName": autorest.Encode("path", siteName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListHistoryForWebAppSender sends the ListHistoryForWebApp request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) ListHistoryForWebAppSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListHistoryForWebAppResponder handles the response to the ListHistoryForWebApp request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) ListHistoryForWebAppResponder(resp *http.Response) (result ListRecommendation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListRecommendedRulesForWebApp get all recommendations for an app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. siteName is name of the app. featured is specify true -// to return only the most critical recommendations. The default is -// false, which returns all recommendations. filter is return only -// channels specified in the filter. Filter is specified by using OData syntax. -// Example: $filter=channels eq 'Api' or channel eq 'Notification' -func (client RecommendationsClient) ListRecommendedRulesForWebApp(resourceGroupName string, siteName string, featured *bool, filter string) (result ListRecommendation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp") - } - - req, err := client.ListRecommendedRulesForWebAppPreparer(resourceGroupName, siteName, featured, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", nil, "Failure preparing request") - return - } - - resp, err := client.ListRecommendedRulesForWebAppSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure sending request") - return - } - - result, err = client.ListRecommendedRulesForWebAppResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure responding to request") - } - - return -} - -// ListRecommendedRulesForWebAppPreparer prepares the ListRecommendedRulesForWebApp request. -func (client RecommendationsClient) ListRecommendedRulesForWebAppPreparer(resourceGroupName string, siteName string, featured *bool, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "siteName": autorest.Encode("path", siteName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if featured != nil { - queryParameters["featured"] = autorest.Encode("query", *featured) - } - if len(filter) > 0 { - queryParameters["$filter"] = filter - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListRecommendedRulesForWebAppSender sends the ListRecommendedRulesForWebApp request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) ListRecommendedRulesForWebAppSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListRecommendedRulesForWebAppResponder handles the response to the ListRecommendedRulesForWebApp request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) ListRecommendedRulesForWebAppResponder(resp *http.Response) (result ListRecommendation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResetAllFilters reset all recommendation opt-out settings for a -// subscription. -func (client RecommendationsClient) ResetAllFilters() (result autorest.Response, err error) { - req, err := client.ResetAllFiltersPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", nil, "Failure preparing request") - return - } - - resp, err := client.ResetAllFiltersSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure sending request") - return - } - - result, err = client.ResetAllFiltersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure responding to request") - } - - return -} - -// ResetAllFiltersPreparer prepares the ResetAllFilters request. -func (client RecommendationsClient) ResetAllFiltersPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResetAllFiltersSender sends the ResetAllFilters request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) ResetAllFiltersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResetAllFiltersResponder handles the response to the ResetAllFilters request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) ResetAllFiltersResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// ResetAllFiltersForWebApp reset all recommendation opt-out settings for an -// app. -// -// resourceGroupName is name of the resource group to which the resource -// belongs. siteName is name of the app. -func (client RecommendationsClient) ResetAllFiltersForWebApp(resourceGroupName string, siteName string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp") - } - - req, err := client.ResetAllFiltersForWebAppPreparer(resourceGroupName, siteName) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", nil, "Failure preparing request") - return - } - - resp, err := client.ResetAllFiltersForWebAppSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure sending request") - return - } - - result, err = client.ResetAllFiltersForWebAppResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure responding to request") - } - - return -} - -// ResetAllFiltersForWebAppPreparer prepares the ResetAllFiltersForWebApp request. -func (client RecommendationsClient) ResetAllFiltersForWebAppPreparer(resourceGroupName string, siteName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "siteName": autorest.Encode("path", siteName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2016-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ResetAllFiltersForWebAppSender sends the ResetAllFiltersForWebApp request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendationsClient) ResetAllFiltersForWebAppSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ResetAllFiltersForWebAppResponder handles the response to the ResetAllFiltersForWebApp request. The method always -// closes the http.Response Body. -func (client RecommendationsClient) ResetAllFiltersForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// RecommendationsClient is the composite Swagger for WebSite Management Client +type RecommendationsClient struct { + ManagementClient +} + +// NewRecommendationsClient creates an instance of the RecommendationsClient +// client. +func NewRecommendationsClient(subscriptionID string) RecommendationsClient { + return NewRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRecommendationsClientWithBaseURI creates an instance of the +// RecommendationsClient client. +func NewRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) RecommendationsClient { + return RecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// DisableAllForWebApp disable all recommendations for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. +func (client RecommendationsClient) DisableAllForWebApp(resourceGroupName string, siteName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "DisableAllForWebApp") + } + + req, err := client.DisableAllForWebAppPreparer(resourceGroupName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.DisableAllForWebAppSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure sending request") + return + } + + result, err = client.DisableAllForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "DisableAllForWebApp", resp, "Failure responding to request") + } + + return +} + +// DisableAllForWebAppPreparer prepares the DisableAllForWebApp request. +func (client RecommendationsClient) DisableAllForWebAppPreparer(resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DisableAllForWebAppSender sends the DisableAllForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) DisableAllForWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DisableAllForWebAppResponder handles the response to the DisableAllForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) DisableAllForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetRuleDetailsByWebApp get a recommendation rule for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. name is name of the recommendation. +// updateSeen is specify true to update the last-seen timestamp of +// the recommendation object. +func (client RecommendationsClient) GetRuleDetailsByWebApp(resourceGroupName string, siteName string, name string, updateSeen *bool) (result RecommendationRule, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp") + } + + req, err := client.GetRuleDetailsByWebAppPreparer(resourceGroupName, siteName, name, updateSeen) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.GetRuleDetailsByWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure sending request") + return + } + + result, err = client.GetRuleDetailsByWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "GetRuleDetailsByWebApp", resp, "Failure responding to request") + } + + return +} + +// GetRuleDetailsByWebAppPreparer prepares the GetRuleDetailsByWebApp request. +func (client RecommendationsClient) GetRuleDetailsByWebAppPreparer(resourceGroupName string, siteName string, name string, updateSeen *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if updateSeen != nil { + queryParameters["updateSeen"] = autorest.Encode("query", *updateSeen) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetRuleDetailsByWebAppSender sends the GetRuleDetailsByWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) GetRuleDetailsByWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetRuleDetailsByWebAppResponder handles the response to the GetRuleDetailsByWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) GetRuleDetailsByWebAppResponder(resp *http.Response) (result RecommendationRule, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all recommendations for a subscription. +// +// featured is specify true to return only the most critical +// recommendations. The default is false, which returns all +// recommendations. filter is filter is specified by using OData syntax. +// Example: $filter=channels eq 'Api' or channel eq 'Notification' and +// startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' +// and timeGrain eq duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) List(featured *bool, filter string) (result ListRecommendation, err error) { + req, err := client.ListPreparer(featured, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client RecommendationsClient) ListPreparer(featured *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if featured != nil { + queryParameters["featured"] = autorest.Encode("query", *featured) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListResponder(resp *http.Response) (result ListRecommendation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListHistoryForWebApp get past recommendations for an app, optionally +// specified by the time range. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. filter is filter is specified by using +// OData syntax. Example: $filter=channels eq 'Api' or channel eq +// 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq +// '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] +func (client RecommendationsClient) ListHistoryForWebApp(resourceGroupName string, siteName string, filter string) (result ListRecommendation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ListHistoryForWebApp") + } + + req, err := client.ListHistoryForWebAppPreparer(resourceGroupName, siteName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.ListHistoryForWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure sending request") + return + } + + result, err = client.ListHistoryForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListHistoryForWebApp", resp, "Failure responding to request") + } + + return +} + +// ListHistoryForWebAppPreparer prepares the ListHistoryForWebApp request. +func (client RecommendationsClient) ListHistoryForWebAppPreparer(resourceGroupName string, siteName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListHistoryForWebAppSender sends the ListHistoryForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListHistoryForWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListHistoryForWebAppResponder handles the response to the ListHistoryForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListHistoryForWebAppResponder(resp *http.Response) (result ListRecommendation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRecommendedRulesForWebApp get all recommendations for an app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. featured is specify true +// to return only the most critical recommendations. The default is +// false, which returns all recommendations. filter is return only +// channels specified in the filter. Filter is specified by using OData syntax. +// Example: $filter=channels eq 'Api' or channel eq 'Notification' +func (client RecommendationsClient) ListRecommendedRulesForWebApp(resourceGroupName string, siteName string, featured *bool, filter string) (result ListRecommendation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp") + } + + req, err := client.ListRecommendedRulesForWebAppPreparer(resourceGroupName, siteName, featured, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.ListRecommendedRulesForWebAppSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure sending request") + return + } + + result, err = client.ListRecommendedRulesForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ListRecommendedRulesForWebApp", resp, "Failure responding to request") + } + + return +} + +// ListRecommendedRulesForWebAppPreparer prepares the ListRecommendedRulesForWebApp request. +func (client RecommendationsClient) ListRecommendedRulesForWebAppPreparer(resourceGroupName string, siteName string, featured *bool, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if featured != nil { + queryParameters["featured"] = autorest.Encode("query", *featured) + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListRecommendedRulesForWebAppSender sends the ListRecommendedRulesForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ListRecommendedRulesForWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListRecommendedRulesForWebAppResponder handles the response to the ListRecommendedRulesForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ListRecommendedRulesForWebAppResponder(resp *http.Response) (result ListRecommendation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResetAllFilters reset all recommendation opt-out settings for a +// subscription. +func (client RecommendationsClient) ResetAllFilters() (result autorest.Response, err error) { + req, err := client.ResetAllFiltersPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", nil, "Failure preparing request") + return + } + + resp, err := client.ResetAllFiltersSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure sending request") + return + } + + result, err = client.ResetAllFiltersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFilters", resp, "Failure responding to request") + } + + return +} + +// ResetAllFiltersPreparer prepares the ResetAllFilters request. +func (client RecommendationsClient) ResetAllFiltersPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetAllFiltersSender sends the ResetAllFilters request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ResetAllFiltersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetAllFiltersResponder handles the response to the ResetAllFilters request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ResetAllFiltersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetAllFiltersForWebApp reset all recommendation opt-out settings for an +// app. +// +// resourceGroupName is name of the resource group to which the resource +// belongs. siteName is name of the app. +func (client RecommendationsClient) ResetAllFiltersForWebApp(resourceGroupName string, siteName string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp") + } + + req, err := client.ResetAllFiltersForWebAppPreparer(resourceGroupName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", nil, "Failure preparing request") + return + } + + resp, err := client.ResetAllFiltersForWebAppSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure sending request") + return + } + + result, err = client.ResetAllFiltersForWebAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.RecommendationsClient", "ResetAllFiltersForWebApp", resp, "Failure responding to request") + } + + return +} + +// ResetAllFiltersForWebAppPreparer prepares the ResetAllFiltersForWebApp request. +func (client RecommendationsClient) ResetAllFiltersForWebAppPreparer(resourceGroupName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ResetAllFiltersForWebAppSender sends the ResetAllFiltersForWebApp request. The method will close the +// http.Response Body if it receives an error. +func (client RecommendationsClient) ResetAllFiltersForWebAppSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ResetAllFiltersForWebAppResponder handles the response to the ResetAllFiltersForWebApp request. The method always +// closes the http.Response Body. +func (client RecommendationsClient) ResetAllFiltersForWebAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/topleveldomains.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/topleveldomains.go index 0c0a7a249b..ea9b2ff91b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/topleveldomains.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/topleveldomains.go @@ -1,283 +1,283 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// TopLevelDomainsClient is the composite Swagger for WebSite Management Client -type TopLevelDomainsClient struct { - ManagementClient -} - -// NewTopLevelDomainsClient creates an instance of the TopLevelDomainsClient -// client. -func NewTopLevelDomainsClient(subscriptionID string) TopLevelDomainsClient { - return NewTopLevelDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopLevelDomainsClientWithBaseURI creates an instance of the -// TopLevelDomainsClient client. -func NewTopLevelDomainsClientWithBaseURI(baseURI string, subscriptionID string) TopLevelDomainsClient { - return TopLevelDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get details of a top-level domain. -// -// name is name of the top-level domain. -func (client TopLevelDomainsClient) Get(name string) (result TopLevelDomain, err error) { - req, err := client.GetPreparer(name) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopLevelDomainsClient) GetPreparer(name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TopLevelDomainsClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TopLevelDomainsClient) GetResponder(resp *http.Response) (result TopLevelDomain, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all top-level domains supported for registration. -func (client TopLevelDomainsClient) List() (result TopLevelDomainCollection, err error) { - req, err := client.ListPreparer() - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client TopLevelDomainsClient) ListPreparer() (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TopLevelDomainsClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TopLevelDomainsClient) ListResponder(resp *http.Response) (result TopLevelDomainCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNextResults retrieves the next set of results, if any. -func (client TopLevelDomainsClient) ListNextResults(lastResults TopLevelDomainCollection) (result TopLevelDomainCollection, err error) { - req, err := lastResults.TopLevelDomainCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure sending next results request") - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to next results request") - } - - return -} - -// ListAgreements gets all legal agreements that user needs to accept before -// purchasing a domain. -// -// name is name of the top-level domain. agreementOption is domain agreement -// options. -func (client TopLevelDomainsClient) ListAgreements(name string, agreementOption TopLevelDomainAgreementOption) (result TldLegalAgreementCollection, err error) { - req, err := client.ListAgreementsPreparer(name, agreementOption) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing request") - return - } - - resp, err := client.ListAgreementsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending request") - return - } - - result, err = client.ListAgreementsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to request") - } - - return -} - -// ListAgreementsPreparer prepares the ListAgreements request. -func (client TopLevelDomainsClient) ListAgreementsPreparer(name string, agreementOption TopLevelDomainAgreementOption) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements", pathParameters), - autorest.WithJSON(agreementOption), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListAgreementsSender sends the ListAgreements request. The method will close the -// http.Response Body if it receives an error. -func (client TopLevelDomainsClient) ListAgreementsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListAgreementsResponder handles the response to the ListAgreements request. The method always -// closes the http.Response Body. -func (client TopLevelDomainsClient) ListAgreementsResponder(resp *http.Response) (result TldLegalAgreementCollection, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAgreementsNextResults retrieves the next set of results, if any. -func (client TopLevelDomainsClient) ListAgreementsNextResults(lastResults TldLegalAgreementCollection) (result TldLegalAgreementCollection, err error) { - req, err := lastResults.TldLegalAgreementCollectionPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.ListAgreementsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending next results request") - } - - result, err = client.ListAgreementsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to next results request") - } - - return -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// TopLevelDomainsClient is the composite Swagger for WebSite Management Client +type TopLevelDomainsClient struct { + ManagementClient +} + +// NewTopLevelDomainsClient creates an instance of the TopLevelDomainsClient +// client. +func NewTopLevelDomainsClient(subscriptionID string) TopLevelDomainsClient { + return NewTopLevelDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTopLevelDomainsClientWithBaseURI creates an instance of the +// TopLevelDomainsClient client. +func NewTopLevelDomainsClientWithBaseURI(baseURI string, subscriptionID string) TopLevelDomainsClient { + return TopLevelDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get details of a top-level domain. +// +// name is name of the top-level domain. +func (client TopLevelDomainsClient) Get(name string) (result TopLevelDomain, err error) { + req, err := client.GetPreparer(name) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TopLevelDomainsClient) GetPreparer(name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TopLevelDomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TopLevelDomainsClient) GetResponder(resp *http.Response) (result TopLevelDomain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all top-level domains supported for registration. +func (client TopLevelDomainsClient) List() (result TopLevelDomainCollection, err error) { + req, err := client.ListPreparer() + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TopLevelDomainsClient) ListPreparer() (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TopLevelDomainsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TopLevelDomainsClient) ListResponder(resp *http.Response) (result TopLevelDomainCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNextResults retrieves the next set of results, if any. +func (client TopLevelDomainsClient) ListNextResults(lastResults TopLevelDomainCollection) (result TopLevelDomainCollection, err error) { + req, err := lastResults.TopLevelDomainCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure sending next results request") + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "List", resp, "Failure responding to next results request") + } + + return +} + +// ListAgreements gets all legal agreements that user needs to accept before +// purchasing a domain. +// +// name is name of the top-level domain. agreementOption is domain agreement +// options. +func (client TopLevelDomainsClient) ListAgreements(name string, agreementOption TopLevelDomainAgreementOption) (result TldLegalAgreementCollection, err error) { + req, err := client.ListAgreementsPreparer(name, agreementOption) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing request") + return + } + + resp, err := client.ListAgreementsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending request") + return + } + + result, err = client.ListAgreementsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to request") + } + + return +} + +// ListAgreementsPreparer prepares the ListAgreements request. +func (client TopLevelDomainsClient) ListAgreementsPreparer(name string, agreementOption TopLevelDomainAgreementOption) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements", pathParameters), + autorest.WithJSON(agreementOption), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListAgreementsSender sends the ListAgreements request. The method will close the +// http.Response Body if it receives an error. +func (client TopLevelDomainsClient) ListAgreementsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListAgreementsResponder handles the response to the ListAgreements request. The method always +// closes the http.Response Body. +func (client TopLevelDomainsClient) ListAgreementsResponder(resp *http.Response) (result TldLegalAgreementCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAgreementsNextResults retrieves the next set of results, if any. +func (client TopLevelDomainsClient) ListAgreementsNextResults(lastResults TldLegalAgreementCollection) (result TldLegalAgreementCollection, err error) { + req, err := lastResults.TldLegalAgreementCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.ListAgreementsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure sending next results request") + } + + result, err = client.ListAgreementsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.TopLevelDomainsClient", "ListAgreements", resp, "Failure responding to next results request") + } + + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/version.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/version.go index 7fbe970599..4593788bed 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/arm/web/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/arm/web/version.go @@ -1,29 +1,29 @@ -package web - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-web/" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package web + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-web/" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/client.go b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/client.go index 1346e518e6..4648982f08 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/client.go @@ -1,51 +1,51 @@ -// Package filesystem implements the Azure ARM Filesystem service API version -// 2016-11-01. -// -// Creates an Azure Data Lake Store filesystem client. -package filesystem - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultAdlsFileSystemDNSSuffix is the default value for adls file system dns suffix - DefaultAdlsFileSystemDNSSuffix = "azuredatalakestore.net" -) - -// ManagementClient is the base client for Filesystem. -type ManagementClient struct { - autorest.Client - AdlsFileSystemDNSSuffix string -} - -// New creates an instance of the ManagementClient client. -func New() ManagementClient { - return NewWithoutDefaults(DefaultAdlsFileSystemDNSSuffix) -} - -// NewWithoutDefaults creates an instance of the ManagementClient client. -func NewWithoutDefaults(adlsFileSystemDNSSuffix string) ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - AdlsFileSystemDNSSuffix: adlsFileSystemDNSSuffix, - } -} +// Package filesystem implements the Azure ARM Filesystem service API version +// 2016-11-01. +// +// Creates an Azure Data Lake Store filesystem client. +package filesystem + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultAdlsFileSystemDNSSuffix is the default value for adls file system dns suffix + DefaultAdlsFileSystemDNSSuffix = "azuredatalakestore.net" +) + +// ManagementClient is the base client for Filesystem. +type ManagementClient struct { + autorest.Client + AdlsFileSystemDNSSuffix string +} + +// New creates an instance of the ManagementClient client. +func New() ManagementClient { + return NewWithoutDefaults(DefaultAdlsFileSystemDNSSuffix) +} + +// NewWithoutDefaults creates an instance of the ManagementClient client. +func NewWithoutDefaults(adlsFileSystemDNSSuffix string) ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + AdlsFileSystemDNSSuffix: adlsFileSystemDNSSuffix, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/filesystemgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/filesystemgroup.go index ae9bd28fcb..a7f559c686 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/filesystemgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/filesystemgroup.go @@ -1,1833 +1,1833 @@ -package filesystem - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/satori/uuid" - "io" - "net/http" -) - -// GroupClient is the creates an Azure Data Lake Store filesystem client. -type GroupClient struct { - ManagementClient -} - -// NewGroupClient creates an instance of the GroupClient client. -func NewGroupClient() GroupClient { - return GroupClient{New()} -} - -// Append used for serial appends to the specified file. NOTE: The target must -// not contain data added by ConcurrentAppend. ConcurrentAppend and Append -// cannot be used interchangeably; once a target file has been modified using -// either of these append options, the other append option cannot be used on -// the target file. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. directFilePath is the Data Lake Store path (starting with -// '/') of the file to which to append. streamContents is the file contents to -// include when appending to the file. streamContents will be closed upon -// successful return. Callers should ensure closure when receiving an error.op -// is the constant value for the operation. appendParameter is flag to skip -// redirection. When append=false or not specified, the request is redirected. -// Submit another HTTP PUT request using the URL in the Location header with -// the file data to be written. When append=true, this redirection is skipped. -// offset is the optional offset in the stream to begin the append operation. -// Default is to append at the end of the stream. syncFlag is optionally -// indicates what to do after completion of the append. DATA indicates more -// data is coming so no sync takes place, METADATA indicates a sync should be -// done to refresh metadata of the file only. CLOSE indicates that both the -// stream and metadata should be refreshed upon append completion. leaseID is -// optional unique GUID per file to ensure single writer semantics, meaning -// that only clients that append to the file with the same leaseId will be -// allowed to do so. fileSessionID is optional unique GUID per file indicating -// all the appends with the same fileSessionId are from the same client and -// same session. This will give a performance benefit when syncFlag is DATA or -// METADATA. -func (client GroupClient) Append(accountName string, directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag, leaseID *uuid.UUID, fileSessionID *uuid.UUID) (result autorest.Response, err error) { - req, err := client.AppendPreparer(accountName, directFilePath, streamContents, op, appendParameter, offset, syncFlag, leaseID, fileSessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", nil, "Failure preparing request") - return - } - - resp, err := client.AppendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", resp, "Failure sending request") - return - } - - result, err = client.AppendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", resp, "Failure responding to request") - } - - return -} - -// AppendPreparer prepares the Append request. -func (client GroupClient) AppendPreparer(accountName string, directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag, leaseID *uuid.UUID, fileSessionID *uuid.UUID) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "directFilePath": autorest.Encode("path", directFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "append": autorest.Encode("query", appendParameter), - "op": autorest.Encode("query", op), - } - if offset != nil { - queryParameters["offset"] = autorest.Encode("query", *offset) - } - if len(string(syncFlag)) > 0 { - queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) - } - if leaseID != nil { - queryParameters["leaseId"] = autorest.Encode("query", *leaseID) - } - if fileSessionID != nil { - queryParameters["fileSessionId"] = autorest.Encode("query", *fileSessionID) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), - autorest.WithFile(streamContents), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// AppendSender sends the Append request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) AppendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// AppendResponder handles the response to the Append request. The method always -// closes the http.Response Body. -func (client GroupClient) AppendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckAccess checks if the specified access is available at the given path. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. pathParameter is the Data Lake Store path (starting with '/') -// of the file or directory for which to check access. fsaction is file system -// operation read/write/execute in string form, matching regex pattern -// '[rwx-]{3}' op is the constant value for the operation. -func (client GroupClient) CheckAccess(accountName string, pathParameter string, fsaction string, op string) (result autorest.Response, err error) { - req, err := client.CheckAccessPreparer(accountName, pathParameter, fsaction, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", nil, "Failure preparing request") - return - } - - resp, err := client.CheckAccessSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", resp, "Failure sending request") - return - } - - result, err = client.CheckAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", resp, "Failure responding to request") - } - - return -} - -// CheckAccessPreparer prepares the CheckAccess request. -func (client GroupClient) CheckAccessPreparer(accountName string, pathParameter string, fsaction string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "path": autorest.Encode("path", pathParameter), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "fsaction": autorest.Encode("query", fsaction), - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CheckAccessSender sends the CheckAccess request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CheckAccessSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CheckAccessResponder handles the response to the CheckAccess request. The method always -// closes the http.Response Body. -func (client GroupClient) CheckAccessResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Concat concatenates the list of source files into the destination file, -// removing all source files upon success. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. destinationPath is the Data Lake Store path (starting with -// '/') of the destination file resulting from the concatenation. sources is a -// list of comma separated Data Lake Store paths (starting with '/') of the -// files to concatenate, in the order in which they should be concatenated. op -// is the constant value for the operation. -func (client GroupClient) Concat(accountName string, destinationPath string, sources []string, op string) (result autorest.Response, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: sources, - Constraints: []validation.Constraint{{Target: "sources", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "filesystem.GroupClient", "Concat") - } - - req, err := client.ConcatPreparer(accountName, destinationPath, sources, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", nil, "Failure preparing request") - return - } - - resp, err := client.ConcatSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", resp, "Failure sending request") - return - } - - result, err = client.ConcatResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", resp, "Failure responding to request") - } - - return -} - -// ConcatPreparer prepares the Concat request. -func (client GroupClient) ConcatPreparer(accountName string, destinationPath string, sources []string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "destinationPath": autorest.Encode("path", destinationPath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - "sources": autorest.Encode("query", sources, ","), - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{destinationPath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ConcatSender sends the Concat request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ConcatSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ConcatResponder handles the response to the Concat request. The method always -// closes the http.Response Body. -func (client GroupClient) ConcatResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// ConcurrentAppend appends to the specified file, optionally first creating -// the file if it does not yet exist. This method supports multiple concurrent -// appends to the file. NOTE: The target must not contain data added by Create -// or normal (serial) Append. ConcurrentAppend and Append cannot be used -// interchangeably; once a target file has been modified using either of these -// append options, the other append option cannot be used on the target file. -// ConcurrentAppend does not guarantee order and can result in duplicated data -// landing in the target file. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. filePath is the Data Lake Store path (starting with '/') of -// the file to which to append using concurrent append. streamContents is the -// file contents to include when appending to the file. streamContents will be -// closed upon successful return. Callers should ensure closure when receiving -// an error.op is the constant value for the operation. transferEncoding is -// indicates the data being sent to the server is being streamed in chunks. -// appendMode is indicates the concurrent append call should create the file if -// it doesn't exist or just open the existing file for append syncFlag is -// optionally indicates what to do after completion of the concurrent append. -// DATA indicates more data is coming so no sync takes place, METADATA -// indicates a sync should be done to refresh metadata of the file only. CLOSE -// indicates that both the stream and metadata should be refreshed upon append -// completion. -func (client GroupClient) ConcurrentAppend(accountName string, filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (result autorest.Response, err error) { - req, err := client.ConcurrentAppendPreparer(accountName, filePath, streamContents, op, transferEncoding, appendMode, syncFlag) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", nil, "Failure preparing request") - return - } - - resp, err := client.ConcurrentAppendSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", resp, "Failure sending request") - return - } - - result, err = client.ConcurrentAppendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", resp, "Failure responding to request") - } - - return -} - -// ConcurrentAppendPreparer prepares the ConcurrentAppend request. -func (client GroupClient) ConcurrentAppendPreparer(accountName string, filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "filePath": autorest.Encode("path", filePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if len(string(appendMode)) > 0 { - queryParameters["appendMode"] = autorest.Encode("query", appendMode) - } - if len(string(syncFlag)) > 0 { - queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters), - autorest.WithFile(streamContents), - autorest.WithQueryParameters(queryParameters), - autorest.WithHeader("Transfer-Encoding", autorest.String(transferEncoding))) - return preparer.Prepare(&http.Request{}) -} - -// ConcurrentAppendSender sends the ConcurrentAppend request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ConcurrentAppendSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ConcurrentAppendResponder handles the response to the ConcurrentAppend request. The method always -// closes the http.Response Body. -func (client GroupClient) ConcurrentAppendResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create creates a file with optionally specified content. NOTE: If content is -// provided, the resulting file cannot be modified using ConcurrentAppend. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. directFilePath is the Data Lake Store path (starting with -// '/') of the file to create. op is the constant value for the operation. -// write is flag to skip redirection. When write=false or not specified, the -// request is redirected. Submit another HTTP PUT request using the URL in the -// Location header with the file data to be written. When write=true, this -// redirection is skipped. streamContents is the file contents to include when -// creating the file. This parameter is optional, resulting in an empty file if -// not specified. streamContents will be closed upon successful return. Callers -// should ensure closure when receiving an error.overwrite is the indication of -// if the file should be overwritten. syncFlag is optionally indicates what to -// do after completion of the append. DATA indicates more data is coming so no -// sync takes place, METADATA indicates a sync should be done to refresh -// metadata of the file only. CLOSE indicates that both the stream and metadata -// should be refreshed upon create completion. leaseID is optional unique GUID -// per file to ensure single writer semantics, meaning that only clients that -// append to the file with the same leaseId will be allowed to do so. -// permission is the octal representation of the unnamed user, mask and other -// permissions that should be set for the file when created. If not specified, -// it inherits these from the container. -func (client GroupClient) Create(accountName string, directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (result autorest.Response, err error) { - req, err := client.CreatePreparer(accountName, directFilePath, op, write, streamContents, overwrite, syncFlag, leaseID, permission) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", resp, "Failure responding to request") - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupClient) CreatePreparer(accountName string, directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "directFilePath": autorest.Encode("path", directFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - "write": autorest.Encode("query", write), - } - if overwrite != nil { - queryParameters["overwrite"] = autorest.Encode("query", *overwrite) - } - if len(string(syncFlag)) > 0 { - queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) - } - if leaseID != nil { - queryParameters["leaseId"] = autorest.Encode("query", *leaseID) - } - if permission != nil { - queryParameters["permission"] = autorest.Encode("query", *permission) - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if streamContents != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(streamContents)) - } - return preparer.Prepare(&http.Request{}) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByClosing()) - result.Response = resp - return -} - -// Delete deletes the requested file or directory, optionally recursively. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. filePath is the Data Lake Store path (starting with '/') of -// the file or directory to delete. op is the constant value for the operation. -// recursive is the optional switch indicating if the delete should be -// recursive -func (client GroupClient) Delete(accountName string, filePath string, op string, recursive *bool) (result FileOperationResult, err error) { - req, err := client.DeletePreparer(accountName, filePath, op, recursive) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupClient) DeletePreparer(accountName string, filePath string, op string, recursive *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "filePath": autorest.Encode("path", filePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if recursive != nil { - queryParameters["recursive"] = autorest.Encode("query", *recursive) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{filePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupClient) DeleteResponder(resp *http.Response) (result FileOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetACLStatus gets Access Control List (ACL) entries for the specified file -// or directory. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. ACLFilePath is the Data Lake Store path (starting with '/') -// of the file or directory for which to get the ACL. op is the constant value -// for the operation. tooID is an optional switch to return friendly names in -// place of object ID for ACL entries. tooid=false returns friendly names -// instead of the AAD Object ID. Default value is true, returning AAD object -// IDs. -func (client GroupClient) GetACLStatus(accountName string, ACLFilePath string, op string, tooID *bool) (result ACLStatusResult, err error) { - req, err := client.GetACLStatusPreparer(accountName, ACLFilePath, op, tooID) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetACLStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", resp, "Failure sending request") - return - } - - result, err = client.GetACLStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", resp, "Failure responding to request") - } - - return -} - -// GetACLStatusPreparer prepares the GetACLStatus request. -func (client GroupClient) GetACLStatusPreparer(accountName string, ACLFilePath string, op string, tooID *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "aclFilePath": autorest.Encode("path", ACLFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if tooID != nil { - queryParameters["tooId"] = autorest.Encode("query", *tooID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetACLStatusSender sends the GetACLStatus request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetACLStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetACLStatusResponder handles the response to the GetACLStatus request. The method always -// closes the http.Response Body. -func (client GroupClient) GetACLStatusResponder(resp *http.Response) (result ACLStatusResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetContentSummary gets the file content summary object specified by the file -// path. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. getContentSummaryFilePath is the Data Lake Store path -// (starting with '/') of the file for which to retrieve the summary. op is the -// constant value for the operation. -func (client GroupClient) GetContentSummary(accountName string, getContentSummaryFilePath string, op string) (result ContentSummaryResult, err error) { - req, err := client.GetContentSummaryPreparer(accountName, getContentSummaryFilePath, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", nil, "Failure preparing request") - return - } - - resp, err := client.GetContentSummarySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", resp, "Failure sending request") - return - } - - result, err = client.GetContentSummaryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", resp, "Failure responding to request") - } - - return -} - -// GetContentSummaryPreparer prepares the GetContentSummary request. -func (client GroupClient) GetContentSummaryPreparer(accountName string, getContentSummaryFilePath string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "getContentSummaryFilePath": autorest.Encode("path", getContentSummaryFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{getContentSummaryFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetContentSummarySender sends the GetContentSummary request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetContentSummarySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetContentSummaryResponder handles the response to the GetContentSummary request. The method always -// closes the http.Response Body. -func (client GroupClient) GetContentSummaryResponder(resp *http.Response) (result ContentSummaryResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetFileStatus get the file status object specified by the file path. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. getFilePath is the Data Lake Store path (starting with '/') -// of the file or directory for which to retrieve the status. op is the -// constant value for the operation. tooID is an optional switch to return -// friendly names in place of owner and group. tooid=false returns friendly -// names instead of the AAD Object ID. Default value is true, returning AAD -// object IDs. -func (client GroupClient) GetFileStatus(accountName string, getFilePath string, op string, tooID *bool) (result FileStatusResult, err error) { - req, err := client.GetFileStatusPreparer(accountName, getFilePath, op, tooID) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetFileStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", resp, "Failure sending request") - return - } - - result, err = client.GetFileStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", resp, "Failure responding to request") - } - - return -} - -// GetFileStatusPreparer prepares the GetFileStatus request. -func (client GroupClient) GetFileStatusPreparer(accountName string, getFilePath string, op string, tooID *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "getFilePath": autorest.Encode("path", getFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if tooID != nil { - queryParameters["tooId"] = autorest.Encode("query", *tooID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{getFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetFileStatusSender sends the GetFileStatus request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) GetFileStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetFileStatusResponder handles the response to the GetFileStatus request. The method always -// closes the http.Response Body. -func (client GroupClient) GetFileStatusResponder(resp *http.Response) (result FileStatusResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListFileStatus get the list of file status objects specified by the file -// path, with optional pagination parameters -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. listFilePath is the Data Lake Store path (starting with '/') -// of the directory to list. op is the constant value for the operation. -// listSize is gets or sets the number of items to return. Optional. listAfter -// is gets or sets the item or lexographical index after which to begin -// returning results. For example, a file list of 'a','b','d' and listAfter='b' -// will return 'd', and a listAfter='c' will also return 'd'. Optional. -// listBefore is gets or sets the item or lexographical index before which to -// begin returning results. For example, a file list of 'a','b','d' and -// listBefore='d' will return 'a','b', and a listBefore='c' will also return -// 'a','b'. Optional. tooID is an optional switch to return friendly names in -// place of owner and group. tooid=false returns friendly names instead of the -// AAD Object ID. Default value is true, returning AAD object IDs. -func (client GroupClient) ListFileStatus(accountName string, listFilePath string, op string, listSize *int32, listAfter string, listBefore string, tooID *bool) (result FileStatusesResult, err error) { - req, err := client.ListFileStatusPreparer(accountName, listFilePath, op, listSize, listAfter, listBefore, tooID) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", nil, "Failure preparing request") - return - } - - resp, err := client.ListFileStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", resp, "Failure sending request") - return - } - - result, err = client.ListFileStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", resp, "Failure responding to request") - } - - return -} - -// ListFileStatusPreparer prepares the ListFileStatus request. -func (client GroupClient) ListFileStatusPreparer(accountName string, listFilePath string, op string, listSize *int32, listAfter string, listBefore string, tooID *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "listFilePath": autorest.Encode("path", listFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if listSize != nil { - queryParameters["listSize"] = autorest.Encode("query", *listSize) - } - if len(listAfter) > 0 { - queryParameters["listAfter"] = autorest.Encode("query", listAfter) - } - if len(listBefore) > 0 { - queryParameters["listBefore"] = autorest.Encode("query", listBefore) - } - if tooID != nil { - queryParameters["tooId"] = autorest.Encode("query", *tooID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{listFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ListFileStatusSender sends the ListFileStatus request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ListFileStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ListFileStatusResponder handles the response to the ListFileStatus request. The method always -// closes the http.Response Body. -func (client GroupClient) ListFileStatusResponder(resp *http.Response) (result FileStatusesResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Mkdirs creates a directory. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. pathParameter is the Data Lake Store path (starting with '/') -// of the directory to create. op is the constant value for the operation. -// permission is optional octal permission with which the directory should be -// created. -func (client GroupClient) Mkdirs(accountName string, pathParameter string, op string, permission *int32) (result FileOperationResult, err error) { - req, err := client.MkdirsPreparer(accountName, pathParameter, op, permission) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", nil, "Failure preparing request") - return - } - - resp, err := client.MkdirsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", resp, "Failure sending request") - return - } - - result, err = client.MkdirsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", resp, "Failure responding to request") - } - - return -} - -// MkdirsPreparer prepares the Mkdirs request. -func (client GroupClient) MkdirsPreparer(accountName string, pathParameter string, op string, permission *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "path": autorest.Encode("path", pathParameter), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if permission != nil { - queryParameters["permission"] = autorest.Encode("query", *permission) - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MkdirsSender sends the Mkdirs request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) MkdirsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MkdirsResponder handles the response to the Mkdirs request. The method always -// closes the http.Response Body. -func (client GroupClient) MkdirsResponder(resp *http.Response) (result FileOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ModifyACLEntries modifies existing Access Control List (ACL) entries on a -// file or folder. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. modifyACLFilePath is the Data Lake Store path (starting with -// '/') of the file or directory with the ACL being modified. aclspec is the -// ACL specification included in ACL modification operations in the format -// '[default:]user|group|other::r|-w|-x|-' op is the constant value for the -// operation. -func (client GroupClient) ModifyACLEntries(accountName string, modifyACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { - req, err := client.ModifyACLEntriesPreparer(accountName, modifyACLFilePath, aclspec, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", nil, "Failure preparing request") - return - } - - resp, err := client.ModifyACLEntriesSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", resp, "Failure sending request") - return - } - - result, err = client.ModifyACLEntriesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", resp, "Failure responding to request") - } - - return -} - -// ModifyACLEntriesPreparer prepares the ModifyACLEntries request. -func (client GroupClient) ModifyACLEntriesPreparer(accountName string, modifyACLFilePath string, aclspec string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "modifyAclFilePath": autorest.Encode("path", modifyACLFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "aclspec": autorest.Encode("query", aclspec), - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{modifyAclFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ModifyACLEntriesSender sends the ModifyACLEntries request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) ModifyACLEntriesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ModifyACLEntriesResponder handles the response to the ModifyACLEntries request. The method always -// closes the http.Response Body. -func (client GroupClient) ModifyACLEntriesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// MsConcat concatenates the list of source files into the destination file, -// deleting all source files upon success. This method accepts more source file -// paths than the Concat method. This method and the parameters it accepts are -// subject to change for usability in an upcoming version. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. msConcatDestinationPath is the Data Lake Store path (starting -// with '/') of the destination file resulting from the concatenation. -// streamContents is a list of Data Lake Store paths (starting with '/') of the -// source files. Must be a comma-separated path list in the format: -// sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv -// streamContents will be closed upon successful return. Callers should ensure -// closure when receiving an error.op is the constant value for the operation. -// deleteSourceDirectory is indicates that as an optimization instead of -// deleting each individual source stream, delete the source stream folder if -// all streams are in the same folder instead. This results in a substantial -// performance improvement when the only streams in the folder are part of the -// concatenation operation. WARNING: This includes the deletion of any other -// files that are not source files. Only set this to true when source files are -// the only files in the source directory. -func (client GroupClient) MsConcat(accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (result autorest.Response, err error) { - req, err := client.MsConcatPreparer(accountName, msConcatDestinationPath, streamContents, op, deleteSourceDirectory) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", nil, "Failure preparing request") - return - } - - resp, err := client.MsConcatSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", resp, "Failure sending request") - return - } - - result, err = client.MsConcatResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", resp, "Failure responding to request") - } - - return -} - -// MsConcatPreparer prepares the MsConcat request. -func (client GroupClient) MsConcatPreparer(accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "msConcatDestinationPath": autorest.Encode("path", msConcatDestinationPath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if deleteSourceDirectory != nil { - queryParameters["deleteSourceDirectory"] = autorest.Encode("query", *deleteSourceDirectory) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{msConcatDestinationPath}", pathParameters), - autorest.WithFile(streamContents), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MsConcatSender sends the MsConcat request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) MsConcatSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MsConcatResponder handles the response to the MsConcat request. The method always -// closes the http.Response Body. -func (client GroupClient) MsConcatResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Open opens and reads from the specified file. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. directFilePath is the Data Lake Store path (starting with -// '/') of the file to open. op is the constant value for the operation. read -// is flag to skip redirection. When read=false or not specified, the request -// is redirected. Submit another HTTP PUT request using the URL in the Location -// header with the file data to be read. When read=true, this redirection is -// skipped. length is the number of bytes that the server will attempt to -// retrieve. It will retrieve <= length bytes. offset is the byte offset to -// start reading data from. fileSessionID is optional unique GUID per file -// indicating all the reads with the same fileSessionId are from the same -// client and same session. This will give a performance benefit. -func (client GroupClient) Open(accountName string, directFilePath string, op string, read string, length *int64, offset *int64, fileSessionID *uuid.UUID) (result ReadCloser, err error) { - req, err := client.OpenPreparer(accountName, directFilePath, op, read, length, offset, fileSessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", nil, "Failure preparing request") - return - } - - resp, err := client.OpenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", resp, "Failure sending request") - return - } - - result, err = client.OpenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", resp, "Failure responding to request") - } - - return -} - -// OpenPreparer prepares the Open request. -func (client GroupClient) OpenPreparer(accountName string, directFilePath string, op string, read string, length *int64, offset *int64, fileSessionID *uuid.UUID) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "directFilePath": autorest.Encode("path", directFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - "read": autorest.Encode("query", read), - } - if length != nil { - queryParameters["length"] = autorest.Encode("query", *length) - } - if offset != nil { - queryParameters["offset"] = autorest.Encode("query", *offset) - } - if fileSessionID != nil { - queryParameters["fileSessionId"] = autorest.Encode("query", *fileSessionID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// OpenSender sends the Open request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) OpenSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// OpenResponder handles the response to the Open request. The method always -// closes the http.Response Body. -func (client GroupClient) OpenResponder(resp *http.Response) (result ReadCloser, err error) { - result.Value = &resp.Body - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK)) - result.Response = autorest.Response{Response: resp} - return -} - -// RemoveACL removes the existing Access Control List (ACL) of the specified -// file or directory. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. ACLFilePath is the Data Lake Store path (starting with '/') -// of the file or directory with the ACL being removed. op is the constant -// value for the operation. -func (client GroupClient) RemoveACL(accountName string, ACLFilePath string, op string) (result autorest.Response, err error) { - req, err := client.RemoveACLPreparer(accountName, ACLFilePath, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveACLSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", resp, "Failure sending request") - return - } - - result, err = client.RemoveACLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", resp, "Failure responding to request") - } - - return -} - -// RemoveACLPreparer prepares the RemoveACL request. -func (client GroupClient) RemoveACLPreparer(accountName string, ACLFilePath string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "aclFilePath": autorest.Encode("path", ACLFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RemoveACLSender sends the RemoveACL request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RemoveACLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RemoveACLResponder handles the response to the RemoveACL request. The method always -// closes the http.Response Body. -func (client GroupClient) RemoveACLResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RemoveACLEntries removes existing Access Control List (ACL) entries for a -// file or folder. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. removeACLFilePath is the Data Lake Store path (starting with -// '/') of the file or directory with the ACL being removed. aclspec is the ACL -// spec included in ACL removal operations in the format -// '[default:]user|group|other' op is the constant value for the operation. -func (client GroupClient) RemoveACLEntries(accountName string, removeACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { - req, err := client.RemoveACLEntriesPreparer(accountName, removeACLFilePath, aclspec, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveACLEntriesSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", resp, "Failure sending request") - return - } - - result, err = client.RemoveACLEntriesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", resp, "Failure responding to request") - } - - return -} - -// RemoveACLEntriesPreparer prepares the RemoveACLEntries request. -func (client GroupClient) RemoveACLEntriesPreparer(accountName string, removeACLFilePath string, aclspec string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "removeAclFilePath": autorest.Encode("path", removeACLFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "aclspec": autorest.Encode("query", aclspec), - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{removeAclFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RemoveACLEntriesSender sends the RemoveACLEntries request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RemoveACLEntriesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RemoveACLEntriesResponder handles the response to the RemoveACLEntries request. The method always -// closes the http.Response Body. -func (client GroupClient) RemoveACLEntriesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// RemoveDefaultACL removes the existing Default Access Control List (ACL) of -// the specified directory. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. defaultACLFilePath is the Data Lake Store path (starting with -// '/') of the directory with the default ACL being removed. op is the constant -// value for the operation. -func (client GroupClient) RemoveDefaultACL(accountName string, defaultACLFilePath string, op string) (result autorest.Response, err error) { - req, err := client.RemoveDefaultACLPreparer(accountName, defaultACLFilePath, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveDefaultACLSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", resp, "Failure sending request") - return - } - - result, err = client.RemoveDefaultACLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", resp, "Failure responding to request") - } - - return -} - -// RemoveDefaultACLPreparer prepares the RemoveDefaultACL request. -func (client GroupClient) RemoveDefaultACLPreparer(accountName string, defaultACLFilePath string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "defaultAclFilePath": autorest.Encode("path", defaultACLFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{defaultAclFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RemoveDefaultACLSender sends the RemoveDefaultACL request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RemoveDefaultACLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RemoveDefaultACLResponder handles the response to the RemoveDefaultACL request. The method always -// closes the http.Response Body. -func (client GroupClient) RemoveDefaultACLResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Rename rename a file or directory. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. renameFilePath is the Data Lake Store path (starting with -// '/') of the file or directory to move/rename. destination is the path to -// move/rename the file or folder to op is the constant value for the -// operation. -func (client GroupClient) Rename(accountName string, renameFilePath string, destination string, op string) (result FileOperationResult, err error) { - req, err := client.RenamePreparer(accountName, renameFilePath, destination, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", nil, "Failure preparing request") - return - } - - resp, err := client.RenameSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", resp, "Failure sending request") - return - } - - result, err = client.RenameResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", resp, "Failure responding to request") - } - - return -} - -// RenamePreparer prepares the Rename request. -func (client GroupClient) RenamePreparer(accountName string, renameFilePath string, destination string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "renameFilePath": autorest.Encode("path", renameFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "destination": autorest.Encode("query", destination), - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{renameFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RenameSender sends the Rename request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) RenameSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RenameResponder handles the response to the Rename request. The method always -// closes the http.Response Body. -func (client GroupClient) RenameResponder(resp *http.Response) (result FileOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetACL sets the Access Control List (ACL) for a file or folder. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. setACLFilePath is the Data Lake Store path (starting with -// '/') of the file or directory on which to set the ACL. aclspec is the ACL -// spec included in ACL creation operations in the format -// '[default:]user|group|other::r|-w|-x|-' op is the constant value for the -// operation. -func (client GroupClient) SetACL(accountName string, setACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { - req, err := client.SetACLPreparer(accountName, setACLFilePath, aclspec, op) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", nil, "Failure preparing request") - return - } - - resp, err := client.SetACLSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", resp, "Failure sending request") - return - } - - result, err = client.SetACLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", resp, "Failure responding to request") - } - - return -} - -// SetACLPreparer prepares the SetACL request. -func (client GroupClient) SetACLPreparer(accountName string, setACLFilePath string, aclspec string, op string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "setAclFilePath": autorest.Encode("path", setACLFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "aclspec": autorest.Encode("query", aclspec), - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{setAclFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetACLSender sends the SetACL request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) SetACLSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetACLResponder handles the response to the SetACL request. The method always -// closes the http.Response Body. -func (client GroupClient) SetACLResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// SetFileExpiry sets or removes the expiration time on the specified file. -// This operation can only be executed against files. Folders are not -// supported. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. filePath is the Data Lake Store path (starting with '/') of -// the file on which to set or remove the expiration time. expiryOption is -// indicates the type of expiration to use for the file: 1. NeverExpire: -// ExpireTime is ignored. 2. RelativeToNow: ExpireTime is an integer in -// milliseconds representing the expiration date relative to when file -// expiration is updated. 3. RelativeToCreationDate: ExpireTime is an integer -// in milliseconds representing the expiration date relative to file creation. -// 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix timestamp -// relative to 1/1/1970 00:00:00. op is the constant value for the operation. -// expireTime is the time that the file will expire, corresponding to the -// ExpiryOption that was set. -func (client GroupClient) SetFileExpiry(accountName string, filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (result autorest.Response, err error) { - req, err := client.SetFileExpiryPreparer(accountName, filePath, expiryOption, op, expireTime) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", nil, "Failure preparing request") - return - } - - resp, err := client.SetFileExpirySender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", resp, "Failure sending request") - return - } - - result, err = client.SetFileExpiryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", resp, "Failure responding to request") - } - - return -} - -// SetFileExpiryPreparer prepares the SetFileExpiry request. -func (client GroupClient) SetFileExpiryPreparer(accountName string, filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "filePath": autorest.Encode("path", filePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "expiryOption": autorest.Encode("query", expiryOption), - "op": autorest.Encode("query", op), - } - if expireTime != nil { - queryParameters["expireTime"] = autorest.Encode("query", *expireTime) - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetFileExpirySender sends the SetFileExpiry request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) SetFileExpirySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetFileExpiryResponder handles the response to the SetFileExpiry request. The method always -// closes the http.Response Body. -func (client GroupClient) SetFileExpiryResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// SetOwner sets the owner of a file or directory. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. setOwnerFilePath is the Data Lake Store path (starting with -// '/') of the file or directory for which to set the owner. op is the constant -// value for the operation. owner is the AAD Object ID of the user owner of the -// file or directory. If empty, the property will remain unchanged. group is -// the AAD Object ID of the group owner of the file or directory. If empty, the -// property will remain unchanged. -func (client GroupClient) SetOwner(accountName string, setOwnerFilePath string, op string, owner string, group string) (result autorest.Response, err error) { - req, err := client.SetOwnerPreparer(accountName, setOwnerFilePath, op, owner, group) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", nil, "Failure preparing request") - return - } - - resp, err := client.SetOwnerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", resp, "Failure sending request") - return - } - - result, err = client.SetOwnerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", resp, "Failure responding to request") - } - - return -} - -// SetOwnerPreparer prepares the SetOwner request. -func (client GroupClient) SetOwnerPreparer(accountName string, setOwnerFilePath string, op string, owner string, group string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "setOwnerFilePath": autorest.Encode("path", setOwnerFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if len(owner) > 0 { - queryParameters["owner"] = autorest.Encode("query", owner) - } - if len(group) > 0 { - queryParameters["group"] = autorest.Encode("query", group) - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{setOwnerFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetOwnerSender sends the SetOwner request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) SetOwnerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetOwnerResponder handles the response to the SetOwner request. The method always -// closes the http.Response Body. -func (client GroupClient) SetOwnerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// SetPermission sets the permission of the file or folder. -// -// accountName is the Azure Data Lake Store account to execute filesystem -// operations on. setPermissionFilePath is the Data Lake Store path (starting -// with '/') of the file or directory for which to set the permission. op is -// the constant value for the operation. permission is a string representation -// of the permission (i.e 'rwx'). If empty, this property remains unchanged. -func (client GroupClient) SetPermission(accountName string, setPermissionFilePath string, op string, permission string) (result autorest.Response, err error) { - req, err := client.SetPermissionPreparer(accountName, setPermissionFilePath, op, permission) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", nil, "Failure preparing request") - return - } - - resp, err := client.SetPermissionSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", resp, "Failure sending request") - return - } - - result, err = client.SetPermissionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", resp, "Failure responding to request") - } - - return -} - -// SetPermissionPreparer prepares the SetPermission request. -func (client GroupClient) SetPermissionPreparer(accountName string, setPermissionFilePath string, op string, permission string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "accountName": accountName, - "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, - } - - pathParameters := map[string]interface{}{ - "setPermissionFilePath": autorest.Encode("path", setPermissionFilePath), - } - - const APIVersion = "2016-11-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "op": autorest.Encode("query", op), - } - if len(permission) > 0 { - queryParameters["permission"] = autorest.Encode("query", permission) - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), - autorest.WithPathParameters("/webhdfs/v1/{setPermissionFilePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetPermissionSender sends the SetPermission request. The method will close the -// http.Response Body if it receives an error. -func (client GroupClient) SetPermissionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetPermissionResponder handles the response to the SetPermission request. The method always -// closes the http.Response Body. -func (client GroupClient) SetPermissionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} +package filesystem + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/satori/uuid" + "io" + "net/http" +) + +// GroupClient is the creates an Azure Data Lake Store filesystem client. +type GroupClient struct { + ManagementClient +} + +// NewGroupClient creates an instance of the GroupClient client. +func NewGroupClient() GroupClient { + return GroupClient{New()} +} + +// Append used for serial appends to the specified file. NOTE: The target must +// not contain data added by ConcurrentAppend. ConcurrentAppend and Append +// cannot be used interchangeably; once a target file has been modified using +// either of these append options, the other append option cannot be used on +// the target file. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. directFilePath is the Data Lake Store path (starting with +// '/') of the file to which to append. streamContents is the file contents to +// include when appending to the file. streamContents will be closed upon +// successful return. Callers should ensure closure when receiving an error.op +// is the constant value for the operation. appendParameter is flag to skip +// redirection. When append=false or not specified, the request is redirected. +// Submit another HTTP PUT request using the URL in the Location header with +// the file data to be written. When append=true, this redirection is skipped. +// offset is the optional offset in the stream to begin the append operation. +// Default is to append at the end of the stream. syncFlag is optionally +// indicates what to do after completion of the append. DATA indicates more +// data is coming so no sync takes place, METADATA indicates a sync should be +// done to refresh metadata of the file only. CLOSE indicates that both the +// stream and metadata should be refreshed upon append completion. leaseID is +// optional unique GUID per file to ensure single writer semantics, meaning +// that only clients that append to the file with the same leaseId will be +// allowed to do so. fileSessionID is optional unique GUID per file indicating +// all the appends with the same fileSessionId are from the same client and +// same session. This will give a performance benefit when syncFlag is DATA or +// METADATA. +func (client GroupClient) Append(accountName string, directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag, leaseID *uuid.UUID, fileSessionID *uuid.UUID) (result autorest.Response, err error) { + req, err := client.AppendPreparer(accountName, directFilePath, streamContents, op, appendParameter, offset, syncFlag, leaseID, fileSessionID) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", nil, "Failure preparing request") + return + } + + resp, err := client.AppendSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", resp, "Failure sending request") + return + } + + result, err = client.AppendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Append", resp, "Failure responding to request") + } + + return +} + +// AppendPreparer prepares the Append request. +func (client GroupClient) AppendPreparer(accountName string, directFilePath string, streamContents io.ReadCloser, op string, appendParameter string, offset *int64, syncFlag SyncFlag, leaseID *uuid.UUID, fileSessionID *uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "directFilePath": autorest.Encode("path", directFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "append": autorest.Encode("query", appendParameter), + "op": autorest.Encode("query", op), + } + if offset != nil { + queryParameters["offset"] = autorest.Encode("query", *offset) + } + if len(string(syncFlag)) > 0 { + queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) + } + if leaseID != nil { + queryParameters["leaseId"] = autorest.Encode("query", *leaseID) + } + if fileSessionID != nil { + queryParameters["fileSessionId"] = autorest.Encode("query", *fileSessionID) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), + autorest.WithFile(streamContents), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// AppendSender sends the Append request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) AppendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// AppendResponder handles the response to the Append request. The method always +// closes the http.Response Body. +func (client GroupClient) AppendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckAccess checks if the specified access is available at the given path. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. pathParameter is the Data Lake Store path (starting with '/') +// of the file or directory for which to check access. fsaction is file system +// operation read/write/execute in string form, matching regex pattern +// '[rwx-]{3}' op is the constant value for the operation. +func (client GroupClient) CheckAccess(accountName string, pathParameter string, fsaction string, op string) (result autorest.Response, err error) { + req, err := client.CheckAccessPreparer(accountName, pathParameter, fsaction, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", nil, "Failure preparing request") + return + } + + resp, err := client.CheckAccessSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", resp, "Failure sending request") + return + } + + result, err = client.CheckAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "CheckAccess", resp, "Failure responding to request") + } + + return +} + +// CheckAccessPreparer prepares the CheckAccess request. +func (client GroupClient) CheckAccessPreparer(accountName string, pathParameter string, fsaction string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "path": autorest.Encode("path", pathParameter), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "fsaction": autorest.Encode("query", fsaction), + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CheckAccessSender sends the CheckAccess request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CheckAccessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CheckAccessResponder handles the response to the CheckAccess request. The method always +// closes the http.Response Body. +func (client GroupClient) CheckAccessResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Concat concatenates the list of source files into the destination file, +// removing all source files upon success. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. destinationPath is the Data Lake Store path (starting with +// '/') of the destination file resulting from the concatenation. sources is a +// list of comma separated Data Lake Store paths (starting with '/') of the +// files to concatenate, in the order in which they should be concatenated. op +// is the constant value for the operation. +func (client GroupClient) Concat(accountName string, destinationPath string, sources []string, op string) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: sources, + Constraints: []validation.Constraint{{Target: "sources", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "filesystem.GroupClient", "Concat") + } + + req, err := client.ConcatPreparer(accountName, destinationPath, sources, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", nil, "Failure preparing request") + return + } + + resp, err := client.ConcatSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", resp, "Failure sending request") + return + } + + result, err = client.ConcatResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Concat", resp, "Failure responding to request") + } + + return +} + +// ConcatPreparer prepares the Concat request. +func (client GroupClient) ConcatPreparer(accountName string, destinationPath string, sources []string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "destinationPath": autorest.Encode("path", destinationPath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + "sources": autorest.Encode("query", sources, ","), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{destinationPath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ConcatSender sends the Concat request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ConcatSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ConcatResponder handles the response to the Concat request. The method always +// closes the http.Response Body. +func (client GroupClient) ConcatResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ConcurrentAppend appends to the specified file, optionally first creating +// the file if it does not yet exist. This method supports multiple concurrent +// appends to the file. NOTE: The target must not contain data added by Create +// or normal (serial) Append. ConcurrentAppend and Append cannot be used +// interchangeably; once a target file has been modified using either of these +// append options, the other append option cannot be used on the target file. +// ConcurrentAppend does not guarantee order and can result in duplicated data +// landing in the target file. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. filePath is the Data Lake Store path (starting with '/') of +// the file to which to append using concurrent append. streamContents is the +// file contents to include when appending to the file. streamContents will be +// closed upon successful return. Callers should ensure closure when receiving +// an error.op is the constant value for the operation. transferEncoding is +// indicates the data being sent to the server is being streamed in chunks. +// appendMode is indicates the concurrent append call should create the file if +// it doesn't exist or just open the existing file for append syncFlag is +// optionally indicates what to do after completion of the concurrent append. +// DATA indicates more data is coming so no sync takes place, METADATA +// indicates a sync should be done to refresh metadata of the file only. CLOSE +// indicates that both the stream and metadata should be refreshed upon append +// completion. +func (client GroupClient) ConcurrentAppend(accountName string, filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (result autorest.Response, err error) { + req, err := client.ConcurrentAppendPreparer(accountName, filePath, streamContents, op, transferEncoding, appendMode, syncFlag) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", nil, "Failure preparing request") + return + } + + resp, err := client.ConcurrentAppendSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", resp, "Failure sending request") + return + } + + result, err = client.ConcurrentAppendResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ConcurrentAppend", resp, "Failure responding to request") + } + + return +} + +// ConcurrentAppendPreparer prepares the ConcurrentAppend request. +func (client GroupClient) ConcurrentAppendPreparer(accountName string, filePath string, streamContents io.ReadCloser, op string, transferEncoding string, appendMode AppendModeType, syncFlag SyncFlag) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if len(string(appendMode)) > 0 { + queryParameters["appendMode"] = autorest.Encode("query", appendMode) + } + if len(string(syncFlag)) > 0 { + queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters), + autorest.WithFile(streamContents), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Transfer-Encoding", autorest.String(transferEncoding))) + return preparer.Prepare(&http.Request{}) +} + +// ConcurrentAppendSender sends the ConcurrentAppend request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ConcurrentAppendSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ConcurrentAppendResponder handles the response to the ConcurrentAppend request. The method always +// closes the http.Response Body. +func (client GroupClient) ConcurrentAppendResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create creates a file with optionally specified content. NOTE: If content is +// provided, the resulting file cannot be modified using ConcurrentAppend. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. directFilePath is the Data Lake Store path (starting with +// '/') of the file to create. op is the constant value for the operation. +// write is flag to skip redirection. When write=false or not specified, the +// request is redirected. Submit another HTTP PUT request using the URL in the +// Location header with the file data to be written. When write=true, this +// redirection is skipped. streamContents is the file contents to include when +// creating the file. This parameter is optional, resulting in an empty file if +// not specified. streamContents will be closed upon successful return. Callers +// should ensure closure when receiving an error.overwrite is the indication of +// if the file should be overwritten. syncFlag is optionally indicates what to +// do after completion of the append. DATA indicates more data is coming so no +// sync takes place, METADATA indicates a sync should be done to refresh +// metadata of the file only. CLOSE indicates that both the stream and metadata +// should be refreshed upon create completion. leaseID is optional unique GUID +// per file to ensure single writer semantics, meaning that only clients that +// append to the file with the same leaseId will be allowed to do so. +// permission is the octal representation of the unnamed user, mask and other +// permissions that should be set for the file when created. If not specified, +// it inherits these from the container. +func (client GroupClient) Create(accountName string, directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (result autorest.Response, err error) { + req, err := client.CreatePreparer(accountName, directFilePath, op, write, streamContents, overwrite, syncFlag, leaseID, permission) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client GroupClient) CreatePreparer(accountName string, directFilePath string, op string, write string, streamContents io.ReadCloser, overwrite *bool, syncFlag SyncFlag, leaseID *uuid.UUID, permission *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "directFilePath": autorest.Encode("path", directFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + "write": autorest.Encode("query", write), + } + if overwrite != nil { + queryParameters["overwrite"] = autorest.Encode("query", *overwrite) + } + if len(string(syncFlag)) > 0 { + queryParameters["syncFlag"] = autorest.Encode("query", syncFlag) + } + if leaseID != nil { + queryParameters["leaseId"] = autorest.Encode("query", *leaseID) + } + if permission != nil { + queryParameters["permission"] = autorest.Encode("query", *permission) + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if streamContents != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(streamContents)) + } + return preparer.Prepare(&http.Request{}) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client GroupClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the requested file or directory, optionally recursively. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. filePath is the Data Lake Store path (starting with '/') of +// the file or directory to delete. op is the constant value for the operation. +// recursive is the optional switch indicating if the delete should be +// recursive +func (client GroupClient) Delete(accountName string, filePath string, op string, recursive *bool) (result FileOperationResult, err error) { + req, err := client.DeletePreparer(accountName, filePath, op, recursive) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GroupClient) DeletePreparer(accountName string, filePath string, op string, recursive *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if recursive != nil { + queryParameters["recursive"] = autorest.Encode("query", *recursive) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GroupClient) DeleteResponder(resp *http.Response) (result FileOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetACLStatus gets Access Control List (ACL) entries for the specified file +// or directory. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. ACLFilePath is the Data Lake Store path (starting with '/') +// of the file or directory for which to get the ACL. op is the constant value +// for the operation. tooID is an optional switch to return friendly names in +// place of object ID for ACL entries. tooid=false returns friendly names +// instead of the AAD Object ID. Default value is true, returning AAD object +// IDs. +func (client GroupClient) GetACLStatus(accountName string, ACLFilePath string, op string, tooID *bool) (result ACLStatusResult, err error) { + req, err := client.GetACLStatusPreparer(accountName, ACLFilePath, op, tooID) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetACLStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", resp, "Failure sending request") + return + } + + result, err = client.GetACLStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetACLStatus", resp, "Failure responding to request") + } + + return +} + +// GetACLStatusPreparer prepares the GetACLStatus request. +func (client GroupClient) GetACLStatusPreparer(accountName string, ACLFilePath string, op string, tooID *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "aclFilePath": autorest.Encode("path", ACLFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if tooID != nil { + queryParameters["tooId"] = autorest.Encode("query", *tooID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetACLStatusSender sends the GetACLStatus request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetACLStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetACLStatusResponder handles the response to the GetACLStatus request. The method always +// closes the http.Response Body. +func (client GroupClient) GetACLStatusResponder(resp *http.Response) (result ACLStatusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetContentSummary gets the file content summary object specified by the file +// path. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. getContentSummaryFilePath is the Data Lake Store path +// (starting with '/') of the file for which to retrieve the summary. op is the +// constant value for the operation. +func (client GroupClient) GetContentSummary(accountName string, getContentSummaryFilePath string, op string) (result ContentSummaryResult, err error) { + req, err := client.GetContentSummaryPreparer(accountName, getContentSummaryFilePath, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", nil, "Failure preparing request") + return + } + + resp, err := client.GetContentSummarySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", resp, "Failure sending request") + return + } + + result, err = client.GetContentSummaryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetContentSummary", resp, "Failure responding to request") + } + + return +} + +// GetContentSummaryPreparer prepares the GetContentSummary request. +func (client GroupClient) GetContentSummaryPreparer(accountName string, getContentSummaryFilePath string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "getContentSummaryFilePath": autorest.Encode("path", getContentSummaryFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{getContentSummaryFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetContentSummarySender sends the GetContentSummary request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetContentSummarySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetContentSummaryResponder handles the response to the GetContentSummary request. The method always +// closes the http.Response Body. +func (client GroupClient) GetContentSummaryResponder(resp *http.Response) (result ContentSummaryResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFileStatus get the file status object specified by the file path. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. getFilePath is the Data Lake Store path (starting with '/') +// of the file or directory for which to retrieve the status. op is the +// constant value for the operation. tooID is an optional switch to return +// friendly names in place of owner and group. tooid=false returns friendly +// names instead of the AAD Object ID. Default value is true, returning AAD +// object IDs. +func (client GroupClient) GetFileStatus(accountName string, getFilePath string, op string, tooID *bool) (result FileStatusResult, err error) { + req, err := client.GetFileStatusPreparer(accountName, getFilePath, op, tooID) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetFileStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", resp, "Failure sending request") + return + } + + result, err = client.GetFileStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "GetFileStatus", resp, "Failure responding to request") + } + + return +} + +// GetFileStatusPreparer prepares the GetFileStatus request. +func (client GroupClient) GetFileStatusPreparer(accountName string, getFilePath string, op string, tooID *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "getFilePath": autorest.Encode("path", getFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if tooID != nil { + queryParameters["tooId"] = autorest.Encode("query", *tooID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{getFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetFileStatusSender sends the GetFileStatus request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) GetFileStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetFileStatusResponder handles the response to the GetFileStatus request. The method always +// closes the http.Response Body. +func (client GroupClient) GetFileStatusResponder(resp *http.Response) (result FileStatusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFileStatus get the list of file status objects specified by the file +// path, with optional pagination parameters +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. listFilePath is the Data Lake Store path (starting with '/') +// of the directory to list. op is the constant value for the operation. +// listSize is gets or sets the number of items to return. Optional. listAfter +// is gets or sets the item or lexographical index after which to begin +// returning results. For example, a file list of 'a','b','d' and listAfter='b' +// will return 'd', and a listAfter='c' will also return 'd'. Optional. +// listBefore is gets or sets the item or lexographical index before which to +// begin returning results. For example, a file list of 'a','b','d' and +// listBefore='d' will return 'a','b', and a listBefore='c' will also return +// 'a','b'. Optional. tooID is an optional switch to return friendly names in +// place of owner and group. tooid=false returns friendly names instead of the +// AAD Object ID. Default value is true, returning AAD object IDs. +func (client GroupClient) ListFileStatus(accountName string, listFilePath string, op string, listSize *int32, listAfter string, listBefore string, tooID *bool) (result FileStatusesResult, err error) { + req, err := client.ListFileStatusPreparer(accountName, listFilePath, op, listSize, listAfter, listBefore, tooID) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", nil, "Failure preparing request") + return + } + + resp, err := client.ListFileStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", resp, "Failure sending request") + return + } + + result, err = client.ListFileStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ListFileStatus", resp, "Failure responding to request") + } + + return +} + +// ListFileStatusPreparer prepares the ListFileStatus request. +func (client GroupClient) ListFileStatusPreparer(accountName string, listFilePath string, op string, listSize *int32, listAfter string, listBefore string, tooID *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "listFilePath": autorest.Encode("path", listFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if listSize != nil { + queryParameters["listSize"] = autorest.Encode("query", *listSize) + } + if len(listAfter) > 0 { + queryParameters["listAfter"] = autorest.Encode("query", listAfter) + } + if len(listBefore) > 0 { + queryParameters["listBefore"] = autorest.Encode("query", listBefore) + } + if tooID != nil { + queryParameters["tooId"] = autorest.Encode("query", *tooID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{listFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ListFileStatusSender sends the ListFileStatus request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ListFileStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ListFileStatusResponder handles the response to the ListFileStatus request. The method always +// closes the http.Response Body. +func (client GroupClient) ListFileStatusResponder(resp *http.Response) (result FileStatusesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Mkdirs creates a directory. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. pathParameter is the Data Lake Store path (starting with '/') +// of the directory to create. op is the constant value for the operation. +// permission is optional octal permission with which the directory should be +// created. +func (client GroupClient) Mkdirs(accountName string, pathParameter string, op string, permission *int32) (result FileOperationResult, err error) { + req, err := client.MkdirsPreparer(accountName, pathParameter, op, permission) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", nil, "Failure preparing request") + return + } + + resp, err := client.MkdirsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", resp, "Failure sending request") + return + } + + result, err = client.MkdirsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Mkdirs", resp, "Failure responding to request") + } + + return +} + +// MkdirsPreparer prepares the Mkdirs request. +func (client GroupClient) MkdirsPreparer(accountName string, pathParameter string, op string, permission *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "path": autorest.Encode("path", pathParameter), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if permission != nil { + queryParameters["permission"] = autorest.Encode("query", *permission) + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{path}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MkdirsSender sends the Mkdirs request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) MkdirsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MkdirsResponder handles the response to the Mkdirs request. The method always +// closes the http.Response Body. +func (client GroupClient) MkdirsResponder(resp *http.Response) (result FileOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ModifyACLEntries modifies existing Access Control List (ACL) entries on a +// file or folder. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. modifyACLFilePath is the Data Lake Store path (starting with +// '/') of the file or directory with the ACL being modified. aclspec is the +// ACL specification included in ACL modification operations in the format +// '[default:]user|group|other::r|-w|-x|-' op is the constant value for the +// operation. +func (client GroupClient) ModifyACLEntries(accountName string, modifyACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { + req, err := client.ModifyACLEntriesPreparer(accountName, modifyACLFilePath, aclspec, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", nil, "Failure preparing request") + return + } + + resp, err := client.ModifyACLEntriesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", resp, "Failure sending request") + return + } + + result, err = client.ModifyACLEntriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "ModifyACLEntries", resp, "Failure responding to request") + } + + return +} + +// ModifyACLEntriesPreparer prepares the ModifyACLEntries request. +func (client GroupClient) ModifyACLEntriesPreparer(accountName string, modifyACLFilePath string, aclspec string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "modifyAclFilePath": autorest.Encode("path", modifyACLFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "aclspec": autorest.Encode("query", aclspec), + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{modifyAclFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ModifyACLEntriesSender sends the ModifyACLEntries request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) ModifyACLEntriesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ModifyACLEntriesResponder handles the response to the ModifyACLEntries request. The method always +// closes the http.Response Body. +func (client GroupClient) ModifyACLEntriesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// MsConcat concatenates the list of source files into the destination file, +// deleting all source files upon success. This method accepts more source file +// paths than the Concat method. This method and the parameters it accepts are +// subject to change for usability in an upcoming version. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. msConcatDestinationPath is the Data Lake Store path (starting +// with '/') of the destination file resulting from the concatenation. +// streamContents is a list of Data Lake Store paths (starting with '/') of the +// source files. Must be a comma-separated path list in the format: +// sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv +// streamContents will be closed upon successful return. Callers should ensure +// closure when receiving an error.op is the constant value for the operation. +// deleteSourceDirectory is indicates that as an optimization instead of +// deleting each individual source stream, delete the source stream folder if +// all streams are in the same folder instead. This results in a substantial +// performance improvement when the only streams in the folder are part of the +// concatenation operation. WARNING: This includes the deletion of any other +// files that are not source files. Only set this to true when source files are +// the only files in the source directory. +func (client GroupClient) MsConcat(accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (result autorest.Response, err error) { + req, err := client.MsConcatPreparer(accountName, msConcatDestinationPath, streamContents, op, deleteSourceDirectory) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", nil, "Failure preparing request") + return + } + + resp, err := client.MsConcatSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", resp, "Failure sending request") + return + } + + result, err = client.MsConcatResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "MsConcat", resp, "Failure responding to request") + } + + return +} + +// MsConcatPreparer prepares the MsConcat request. +func (client GroupClient) MsConcatPreparer(accountName string, msConcatDestinationPath string, streamContents io.ReadCloser, op string, deleteSourceDirectory *bool) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "msConcatDestinationPath": autorest.Encode("path", msConcatDestinationPath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if deleteSourceDirectory != nil { + queryParameters["deleteSourceDirectory"] = autorest.Encode("query", *deleteSourceDirectory) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{msConcatDestinationPath}", pathParameters), + autorest.WithFile(streamContents), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MsConcatSender sends the MsConcat request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) MsConcatSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MsConcatResponder handles the response to the MsConcat request. The method always +// closes the http.Response Body. +func (client GroupClient) MsConcatResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Open opens and reads from the specified file. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. directFilePath is the Data Lake Store path (starting with +// '/') of the file to open. op is the constant value for the operation. read +// is flag to skip redirection. When read=false or not specified, the request +// is redirected. Submit another HTTP PUT request using the URL in the Location +// header with the file data to be read. When read=true, this redirection is +// skipped. length is the number of bytes that the server will attempt to +// retrieve. It will retrieve <= length bytes. offset is the byte offset to +// start reading data from. fileSessionID is optional unique GUID per file +// indicating all the reads with the same fileSessionId are from the same +// client and same session. This will give a performance benefit. +func (client GroupClient) Open(accountName string, directFilePath string, op string, read string, length *int64, offset *int64, fileSessionID *uuid.UUID) (result ReadCloser, err error) { + req, err := client.OpenPreparer(accountName, directFilePath, op, read, length, offset, fileSessionID) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", nil, "Failure preparing request") + return + } + + resp, err := client.OpenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", resp, "Failure sending request") + return + } + + result, err = client.OpenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Open", resp, "Failure responding to request") + } + + return +} + +// OpenPreparer prepares the Open request. +func (client GroupClient) OpenPreparer(accountName string, directFilePath string, op string, read string, length *int64, offset *int64, fileSessionID *uuid.UUID) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "directFilePath": autorest.Encode("path", directFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + "read": autorest.Encode("query", read), + } + if length != nil { + queryParameters["length"] = autorest.Encode("query", *length) + } + if offset != nil { + queryParameters["offset"] = autorest.Encode("query", *offset) + } + if fileSessionID != nil { + queryParameters["fileSessionId"] = autorest.Encode("query", *fileSessionID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{directFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// OpenSender sends the Open request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) OpenSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// OpenResponder handles the response to the Open request. The method always +// closes the http.Response Body. +func (client GroupClient) OpenResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK)) + result.Response = autorest.Response{Response: resp} + return +} + +// RemoveACL removes the existing Access Control List (ACL) of the specified +// file or directory. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. ACLFilePath is the Data Lake Store path (starting with '/') +// of the file or directory with the ACL being removed. op is the constant +// value for the operation. +func (client GroupClient) RemoveACL(accountName string, ACLFilePath string, op string) (result autorest.Response, err error) { + req, err := client.RemoveACLPreparer(accountName, ACLFilePath, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveACLSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", resp, "Failure sending request") + return + } + + result, err = client.RemoveACLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACL", resp, "Failure responding to request") + } + + return +} + +// RemoveACLPreparer prepares the RemoveACL request. +func (client GroupClient) RemoveACLPreparer(accountName string, ACLFilePath string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "aclFilePath": autorest.Encode("path", ACLFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{aclFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RemoveACLSender sends the RemoveACL request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RemoveACLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RemoveACLResponder handles the response to the RemoveACL request. The method always +// closes the http.Response Body. +func (client GroupClient) RemoveACLResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RemoveACLEntries removes existing Access Control List (ACL) entries for a +// file or folder. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. removeACLFilePath is the Data Lake Store path (starting with +// '/') of the file or directory with the ACL being removed. aclspec is the ACL +// spec included in ACL removal operations in the format +// '[default:]user|group|other' op is the constant value for the operation. +func (client GroupClient) RemoveACLEntries(accountName string, removeACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { + req, err := client.RemoveACLEntriesPreparer(accountName, removeACLFilePath, aclspec, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveACLEntriesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", resp, "Failure sending request") + return + } + + result, err = client.RemoveACLEntriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveACLEntries", resp, "Failure responding to request") + } + + return +} + +// RemoveACLEntriesPreparer prepares the RemoveACLEntries request. +func (client GroupClient) RemoveACLEntriesPreparer(accountName string, removeACLFilePath string, aclspec string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "removeAclFilePath": autorest.Encode("path", removeACLFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "aclspec": autorest.Encode("query", aclspec), + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{removeAclFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RemoveACLEntriesSender sends the RemoveACLEntries request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RemoveACLEntriesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RemoveACLEntriesResponder handles the response to the RemoveACLEntries request. The method always +// closes the http.Response Body. +func (client GroupClient) RemoveACLEntriesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// RemoveDefaultACL removes the existing Default Access Control List (ACL) of +// the specified directory. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. defaultACLFilePath is the Data Lake Store path (starting with +// '/') of the directory with the default ACL being removed. op is the constant +// value for the operation. +func (client GroupClient) RemoveDefaultACL(accountName string, defaultACLFilePath string, op string) (result autorest.Response, err error) { + req, err := client.RemoveDefaultACLPreparer(accountName, defaultACLFilePath, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", nil, "Failure preparing request") + return + } + + resp, err := client.RemoveDefaultACLSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", resp, "Failure sending request") + return + } + + result, err = client.RemoveDefaultACLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "RemoveDefaultACL", resp, "Failure responding to request") + } + + return +} + +// RemoveDefaultACLPreparer prepares the RemoveDefaultACL request. +func (client GroupClient) RemoveDefaultACLPreparer(accountName string, defaultACLFilePath string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "defaultAclFilePath": autorest.Encode("path", defaultACLFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{defaultAclFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RemoveDefaultACLSender sends the RemoveDefaultACL request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RemoveDefaultACLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RemoveDefaultACLResponder handles the response to the RemoveDefaultACL request. The method always +// closes the http.Response Body. +func (client GroupClient) RemoveDefaultACLResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Rename rename a file or directory. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. renameFilePath is the Data Lake Store path (starting with +// '/') of the file or directory to move/rename. destination is the path to +// move/rename the file or folder to op is the constant value for the +// operation. +func (client GroupClient) Rename(accountName string, renameFilePath string, destination string, op string) (result FileOperationResult, err error) { + req, err := client.RenamePreparer(accountName, renameFilePath, destination, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", nil, "Failure preparing request") + return + } + + resp, err := client.RenameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", resp, "Failure sending request") + return + } + + result, err = client.RenameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "Rename", resp, "Failure responding to request") + } + + return +} + +// RenamePreparer prepares the Rename request. +func (client GroupClient) RenamePreparer(accountName string, renameFilePath string, destination string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "renameFilePath": autorest.Encode("path", renameFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "destination": autorest.Encode("query", destination), + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{renameFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RenameSender sends the Rename request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) RenameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RenameResponder handles the response to the Rename request. The method always +// closes the http.Response Body. +func (client GroupClient) RenameResponder(resp *http.Response) (result FileOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetACL sets the Access Control List (ACL) for a file or folder. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. setACLFilePath is the Data Lake Store path (starting with +// '/') of the file or directory on which to set the ACL. aclspec is the ACL +// spec included in ACL creation operations in the format +// '[default:]user|group|other::r|-w|-x|-' op is the constant value for the +// operation. +func (client GroupClient) SetACL(accountName string, setACLFilePath string, aclspec string, op string) (result autorest.Response, err error) { + req, err := client.SetACLPreparer(accountName, setACLFilePath, aclspec, op) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", nil, "Failure preparing request") + return + } + + resp, err := client.SetACLSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", resp, "Failure sending request") + return + } + + result, err = client.SetACLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetACL", resp, "Failure responding to request") + } + + return +} + +// SetACLPreparer prepares the SetACL request. +func (client GroupClient) SetACLPreparer(accountName string, setACLFilePath string, aclspec string, op string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "setAclFilePath": autorest.Encode("path", setACLFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "aclspec": autorest.Encode("query", aclspec), + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{setAclFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetACLSender sends the SetACL request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) SetACLSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetACLResponder handles the response to the SetACL request. The method always +// closes the http.Response Body. +func (client GroupClient) SetACLResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// SetFileExpiry sets or removes the expiration time on the specified file. +// This operation can only be executed against files. Folders are not +// supported. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. filePath is the Data Lake Store path (starting with '/') of +// the file on which to set or remove the expiration time. expiryOption is +// indicates the type of expiration to use for the file: 1. NeverExpire: +// ExpireTime is ignored. 2. RelativeToNow: ExpireTime is an integer in +// milliseconds representing the expiration date relative to when file +// expiration is updated. 3. RelativeToCreationDate: ExpireTime is an integer +// in milliseconds representing the expiration date relative to file creation. +// 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix timestamp +// relative to 1/1/1970 00:00:00. op is the constant value for the operation. +// expireTime is the time that the file will expire, corresponding to the +// ExpiryOption that was set. +func (client GroupClient) SetFileExpiry(accountName string, filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (result autorest.Response, err error) { + req, err := client.SetFileExpiryPreparer(accountName, filePath, expiryOption, op, expireTime) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", nil, "Failure preparing request") + return + } + + resp, err := client.SetFileExpirySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", resp, "Failure sending request") + return + } + + result, err = client.SetFileExpiryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetFileExpiry", resp, "Failure responding to request") + } + + return +} + +// SetFileExpiryPreparer prepares the SetFileExpiry request. +func (client GroupClient) SetFileExpiryPreparer(accountName string, filePath string, expiryOption ExpiryOptionType, op string, expireTime *int64) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "filePath": autorest.Encode("path", filePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "expiryOption": autorest.Encode("query", expiryOption), + "op": autorest.Encode("query", op), + } + if expireTime != nil { + queryParameters["expireTime"] = autorest.Encode("query", *expireTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/WebHdfsExt/{filePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetFileExpirySender sends the SetFileExpiry request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) SetFileExpirySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetFileExpiryResponder handles the response to the SetFileExpiry request. The method always +// closes the http.Response Body. +func (client GroupClient) SetFileExpiryResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// SetOwner sets the owner of a file or directory. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. setOwnerFilePath is the Data Lake Store path (starting with +// '/') of the file or directory for which to set the owner. op is the constant +// value for the operation. owner is the AAD Object ID of the user owner of the +// file or directory. If empty, the property will remain unchanged. group is +// the AAD Object ID of the group owner of the file or directory. If empty, the +// property will remain unchanged. +func (client GroupClient) SetOwner(accountName string, setOwnerFilePath string, op string, owner string, group string) (result autorest.Response, err error) { + req, err := client.SetOwnerPreparer(accountName, setOwnerFilePath, op, owner, group) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", nil, "Failure preparing request") + return + } + + resp, err := client.SetOwnerSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", resp, "Failure sending request") + return + } + + result, err = client.SetOwnerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetOwner", resp, "Failure responding to request") + } + + return +} + +// SetOwnerPreparer prepares the SetOwner request. +func (client GroupClient) SetOwnerPreparer(accountName string, setOwnerFilePath string, op string, owner string, group string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "setOwnerFilePath": autorest.Encode("path", setOwnerFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if len(owner) > 0 { + queryParameters["owner"] = autorest.Encode("query", owner) + } + if len(group) > 0 { + queryParameters["group"] = autorest.Encode("query", group) + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{setOwnerFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetOwnerSender sends the SetOwner request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) SetOwnerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetOwnerResponder handles the response to the SetOwner request. The method always +// closes the http.Response Body. +func (client GroupClient) SetOwnerResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// SetPermission sets the permission of the file or folder. +// +// accountName is the Azure Data Lake Store account to execute filesystem +// operations on. setPermissionFilePath is the Data Lake Store path (starting +// with '/') of the file or directory for which to set the permission. op is +// the constant value for the operation. permission is a string representation +// of the permission (i.e 'rwx'). If empty, this property remains unchanged. +func (client GroupClient) SetPermission(accountName string, setPermissionFilePath string, op string, permission string) (result autorest.Response, err error) { + req, err := client.SetPermissionPreparer(accountName, setPermissionFilePath, op, permission) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", nil, "Failure preparing request") + return + } + + resp, err := client.SetPermissionSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", resp, "Failure sending request") + return + } + + result, err = client.SetPermissionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "filesystem.GroupClient", "SetPermission", resp, "Failure responding to request") + } + + return +} + +// SetPermissionPreparer prepares the SetPermission request. +func (client GroupClient) SetPermissionPreparer(accountName string, setPermissionFilePath string, op string, permission string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "accountName": accountName, + "adlsFileSystemDnsSuffix": client.AdlsFileSystemDNSSuffix, + } + + pathParameters := map[string]interface{}{ + "setPermissionFilePath": autorest.Encode("path", setPermissionFilePath), + } + + const APIVersion = "2016-11-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "op": autorest.Encode("query", op), + } + if len(permission) > 0 { + queryParameters["permission"] = autorest.Encode("query", permission) + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithCustomBaseURL("https://{accountName}.{adlsFileSystemDnsSuffix}", urlParameters), + autorest.WithPathParameters("/webhdfs/v1/{setPermissionFilePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetPermissionSender sends the SetPermission request. The method will close the +// http.Response Body if it receives an error. +func (client GroupClient) SetPermissionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetPermissionResponder handles the response to the SetPermission request. The method always +// closes the http.Response Body. +func (client GroupClient) SetPermissionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/models.go b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/models.go index 00f49d4260..517f86119c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/models.go @@ -1,242 +1,242 @@ -package filesystem - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "io" -) - -// AppendModeType enumerates the values for append mode type. -type AppendModeType string - -const ( - // Autocreate specifies the autocreate state for append mode type. - Autocreate AppendModeType = "autocreate" -) - -// ExpiryOptionType enumerates the values for expiry option type. -type ExpiryOptionType string - -const ( - // Absolute specifies the absolute state for expiry option type. - Absolute ExpiryOptionType = "Absolute" - // NeverExpire specifies the never expire state for expiry option type. - NeverExpire ExpiryOptionType = "NeverExpire" - // RelativeToCreationDate specifies the relative to creation date state for - // expiry option type. - RelativeToCreationDate ExpiryOptionType = "RelativeToCreationDate" - // RelativeToNow specifies the relative to now state for expiry option - // type. - RelativeToNow ExpiryOptionType = "RelativeToNow" -) - -// FileType enumerates the values for file type. -type FileType string - -const ( - // DIRECTORY specifies the directory state for file type. - DIRECTORY FileType = "DIRECTORY" - // FILE specifies the file state for file type. - FILE FileType = "FILE" -) - -// SyncFlag enumerates the values for sync flag. -type SyncFlag string - -const ( - // CLOSE specifies the close state for sync flag. - CLOSE SyncFlag = "CLOSE" - // DATA specifies the data state for sync flag. - DATA SyncFlag = "DATA" - // METADATA specifies the metadata state for sync flag. - METADATA SyncFlag = "METADATA" -) - -// ACLStatus is data Lake Store file or directory Access Control List -// information. -type ACLStatus struct { - Entries *[]string `json:"entries,omitempty"` - Group *string `json:"group,omitempty"` - Owner *string `json:"owner,omitempty"` - Permission *int32 `json:"permission,omitempty"` - StickyBit *bool `json:"stickyBit,omitempty"` -} - -// ACLStatusResult is data Lake Store file or directory Access Control List -// information. -type ACLStatusResult struct { - autorest.Response `json:"-"` - ACLStatus *ACLStatus `json:"AclStatus,omitempty"` -} - -// AdlsAccessControlException is a WebHDFS exception thrown indicating that -// access is denied due to insufficient permissions. Thrown when a 403 error -// response code is returned (forbidden). -type AdlsAccessControlException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsBadOffsetException is a WebHDFS exception thrown indicating the append -// or read is from a bad offset. Thrown when a 400 error response code is -// returned for append and open operations (Bad request). -type AdlsBadOffsetException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsError is data Lake Store filesystem error containing a specific WebHDFS -// exception. -type AdlsError struct { - RemoteException *AdlsRemoteException `json:"RemoteException,omitempty"` -} - -// AdlsFileAlreadyExistsException is a WebHDFS exception thrown indicating the -// file or folder already exists. Thrown when a 403 error response code is -// returned (forbidden). -type AdlsFileAlreadyExistsException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsFileNotFoundException is a WebHDFS exception thrown indicating the file -// or folder could not be found. Thrown when a 404 error response code is -// returned (not found). -type AdlsFileNotFoundException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsIllegalArgumentException is a WebHDFS exception thrown indicating that -// one more arguments is incorrect. Thrown when a 400 error response code is -// returned (bad request). -type AdlsIllegalArgumentException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsIOException is a WebHDFS exception thrown indicating there was an IO -// (read or write) error. Thrown when a 403 error response code is returned -// (forbidden). -type AdlsIOException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsRemoteException is data Lake Store filesystem exception based on the -// WebHDFS definition for RemoteExceptions. This is a WebHDFS 'catch all' -// exception -type AdlsRemoteException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsRuntimeException is a WebHDFS exception thrown when an unexpected error -// occurs during an operation. Thrown when a 500 error response code is -// returned (Internal server error). -type AdlsRuntimeException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsSecurityException is a WebHDFS exception thrown indicating that access -// is denied. Thrown when a 401 error response code is returned (Unauthorized). -type AdlsSecurityException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsThrottledException is a WebHDFS exception thrown indicating that the -// request is being throttled. Reducing the number of requests or request size -// helps to mitigate this error. -type AdlsThrottledException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// AdlsUnsupportedOperationException is a WebHDFS exception thrown indicating -// that the requested operation is not supported. Thrown when a 400 error -// response code is returned (bad request). -type AdlsUnsupportedOperationException struct { - JavaClassName *string `json:"javaClassName,omitempty"` - Message *string `json:"message,omitempty"` -} - -// ContentSummary is data Lake Store content summary information -type ContentSummary struct { - DirectoryCount *int64 `json:"directoryCount,omitempty"` - FileCount *int64 `json:"fileCount,omitempty"` - Length *int64 `json:"length,omitempty"` - SpaceConsumed *int64 `json:"spaceConsumed,omitempty"` -} - -// ContentSummaryResult is data Lake Store filesystem content summary -// information response. -type ContentSummaryResult struct { - autorest.Response `json:"-"` - ContentSummary *ContentSummary `json:"ContentSummary,omitempty"` -} - -// FileOperationResult is the result of the request or operation. -type FileOperationResult struct { - autorest.Response `json:"-"` - OperationResult *bool `json:"boolean,omitempty"` -} - -// FileStatuses is data Lake Store file status list information. -type FileStatuses struct { - FileStatus *[]FileStatusProperties `json:"FileStatus,omitempty"` -} - -// FileStatusesResult is data Lake Store filesystem file status list -// information response. -type FileStatusesResult struct { - autorest.Response `json:"-"` - FileStatuses *FileStatuses `json:"FileStatuses,omitempty"` -} - -// FileStatusProperties is data Lake Store file or directory information. -type FileStatusProperties struct { - AccessTime *int64 `json:"accessTime,omitempty"` - BlockSize *int64 `json:"blockSize,omitempty"` - ChildrenNum *int64 `json:"childrenNum,omitempty"` - ExpirationTime *int64 `json:"msExpirationTime,omitempty"` - Group *string `json:"group,omitempty"` - Length *int64 `json:"length,omitempty"` - ModificationTime *int64 `json:"modificationTime,omitempty"` - Owner *string `json:"owner,omitempty"` - PathSuffix *string `json:"pathSuffix,omitempty"` - Permission *string `json:"permission,omitempty"` - Type FileType `json:"type,omitempty"` - ACLBit *bool `json:"aclBit,omitempty"` -} - -// FileStatusResult is data Lake Store filesystem file status information -// response. -type FileStatusResult struct { - autorest.Response `json:"-"` - FileStatus *FileStatusProperties `json:"FileStatus,omitempty"` -} - -// ReadCloser is -type ReadCloser struct { - autorest.Response `json:"-"` - Value *io.ReadCloser `json:"value,omitempty"` -} +package filesystem + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "io" +) + +// AppendModeType enumerates the values for append mode type. +type AppendModeType string + +const ( + // Autocreate specifies the autocreate state for append mode type. + Autocreate AppendModeType = "autocreate" +) + +// ExpiryOptionType enumerates the values for expiry option type. +type ExpiryOptionType string + +const ( + // Absolute specifies the absolute state for expiry option type. + Absolute ExpiryOptionType = "Absolute" + // NeverExpire specifies the never expire state for expiry option type. + NeverExpire ExpiryOptionType = "NeverExpire" + // RelativeToCreationDate specifies the relative to creation date state for + // expiry option type. + RelativeToCreationDate ExpiryOptionType = "RelativeToCreationDate" + // RelativeToNow specifies the relative to now state for expiry option + // type. + RelativeToNow ExpiryOptionType = "RelativeToNow" +) + +// FileType enumerates the values for file type. +type FileType string + +const ( + // DIRECTORY specifies the directory state for file type. + DIRECTORY FileType = "DIRECTORY" + // FILE specifies the file state for file type. + FILE FileType = "FILE" +) + +// SyncFlag enumerates the values for sync flag. +type SyncFlag string + +const ( + // CLOSE specifies the close state for sync flag. + CLOSE SyncFlag = "CLOSE" + // DATA specifies the data state for sync flag. + DATA SyncFlag = "DATA" + // METADATA specifies the metadata state for sync flag. + METADATA SyncFlag = "METADATA" +) + +// ACLStatus is data Lake Store file or directory Access Control List +// information. +type ACLStatus struct { + Entries *[]string `json:"entries,omitempty"` + Group *string `json:"group,omitempty"` + Owner *string `json:"owner,omitempty"` + Permission *int32 `json:"permission,omitempty"` + StickyBit *bool `json:"stickyBit,omitempty"` +} + +// ACLStatusResult is data Lake Store file or directory Access Control List +// information. +type ACLStatusResult struct { + autorest.Response `json:"-"` + ACLStatus *ACLStatus `json:"AclStatus,omitempty"` +} + +// AdlsAccessControlException is a WebHDFS exception thrown indicating that +// access is denied due to insufficient permissions. Thrown when a 403 error +// response code is returned (forbidden). +type AdlsAccessControlException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsBadOffsetException is a WebHDFS exception thrown indicating the append +// or read is from a bad offset. Thrown when a 400 error response code is +// returned for append and open operations (Bad request). +type AdlsBadOffsetException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsError is data Lake Store filesystem error containing a specific WebHDFS +// exception. +type AdlsError struct { + RemoteException *AdlsRemoteException `json:"RemoteException,omitempty"` +} + +// AdlsFileAlreadyExistsException is a WebHDFS exception thrown indicating the +// file or folder already exists. Thrown when a 403 error response code is +// returned (forbidden). +type AdlsFileAlreadyExistsException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsFileNotFoundException is a WebHDFS exception thrown indicating the file +// or folder could not be found. Thrown when a 404 error response code is +// returned (not found). +type AdlsFileNotFoundException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsIllegalArgumentException is a WebHDFS exception thrown indicating that +// one more arguments is incorrect. Thrown when a 400 error response code is +// returned (bad request). +type AdlsIllegalArgumentException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsIOException is a WebHDFS exception thrown indicating there was an IO +// (read or write) error. Thrown when a 403 error response code is returned +// (forbidden). +type AdlsIOException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsRemoteException is data Lake Store filesystem exception based on the +// WebHDFS definition for RemoteExceptions. This is a WebHDFS 'catch all' +// exception +type AdlsRemoteException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsRuntimeException is a WebHDFS exception thrown when an unexpected error +// occurs during an operation. Thrown when a 500 error response code is +// returned (Internal server error). +type AdlsRuntimeException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsSecurityException is a WebHDFS exception thrown indicating that access +// is denied. Thrown when a 401 error response code is returned (Unauthorized). +type AdlsSecurityException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsThrottledException is a WebHDFS exception thrown indicating that the +// request is being throttled. Reducing the number of requests or request size +// helps to mitigate this error. +type AdlsThrottledException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// AdlsUnsupportedOperationException is a WebHDFS exception thrown indicating +// that the requested operation is not supported. Thrown when a 400 error +// response code is returned (bad request). +type AdlsUnsupportedOperationException struct { + JavaClassName *string `json:"javaClassName,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ContentSummary is data Lake Store content summary information +type ContentSummary struct { + DirectoryCount *int64 `json:"directoryCount,omitempty"` + FileCount *int64 `json:"fileCount,omitempty"` + Length *int64 `json:"length,omitempty"` + SpaceConsumed *int64 `json:"spaceConsumed,omitempty"` +} + +// ContentSummaryResult is data Lake Store filesystem content summary +// information response. +type ContentSummaryResult struct { + autorest.Response `json:"-"` + ContentSummary *ContentSummary `json:"ContentSummary,omitempty"` +} + +// FileOperationResult is the result of the request or operation. +type FileOperationResult struct { + autorest.Response `json:"-"` + OperationResult *bool `json:"boolean,omitempty"` +} + +// FileStatuses is data Lake Store file status list information. +type FileStatuses struct { + FileStatus *[]FileStatusProperties `json:"FileStatus,omitempty"` +} + +// FileStatusesResult is data Lake Store filesystem file status list +// information response. +type FileStatusesResult struct { + autorest.Response `json:"-"` + FileStatuses *FileStatuses `json:"FileStatuses,omitempty"` +} + +// FileStatusProperties is data Lake Store file or directory information. +type FileStatusProperties struct { + AccessTime *int64 `json:"accessTime,omitempty"` + BlockSize *int64 `json:"blockSize,omitempty"` + ChildrenNum *int64 `json:"childrenNum,omitempty"` + ExpirationTime *int64 `json:"msExpirationTime,omitempty"` + Group *string `json:"group,omitempty"` + Length *int64 `json:"length,omitempty"` + ModificationTime *int64 `json:"modificationTime,omitempty"` + Owner *string `json:"owner,omitempty"` + PathSuffix *string `json:"pathSuffix,omitempty"` + Permission *string `json:"permission,omitempty"` + Type FileType `json:"type,omitempty"` + ACLBit *bool `json:"aclBit,omitempty"` +} + +// FileStatusResult is data Lake Store filesystem file status information +// response. +type FileStatusResult struct { + autorest.Response `json:"-"` + FileStatus *FileStatusProperties `json:"FileStatus,omitempty"` +} + +// ReadCloser is +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/version.go b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/version.go index 08ef286318..261b26561b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/datalake-store/filesystem/version.go @@ -1,29 +1,29 @@ -package filesystem - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-filesystem/2016-11-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package filesystem + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-filesystem/2016-11-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/client.go b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/client.go index b7f1a924df..c20b4e4c81 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/client.go @@ -1,3410 +1,3410 @@ -// Package keyvault implements the Azure ARM Keyvault service API version -// 2016-10-01. -// -// The key vault client performs cryptographic key operations and vault -// operations against the Key Vault service. -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -const () - -// ManagementClient is the base client for Keyvault. -type ManagementClient struct { - autorest.Client -} - -// New creates an instance of the ManagementClient client. -func New() ManagementClient { - return NewWithoutDefaults() -} - -// NewWithoutDefaults creates an instance of the ManagementClient client. -func NewWithoutDefaults() ManagementClient { - return ManagementClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - } -} - -// BackupKey the Key Backup operation exports a key from Azure Key Vault in a -// protected form. Note that this operation does NOT return key material in a -// form that can be used outside the Azure Key Vault system, the returned key -// material is either protected to a Azure Key Vault HSM or to Azure Key Vault -// itself. The intent of this operation is to allow a client to GENERATE a key -// in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into -// another Azure Key Vault instance. The BACKUP operation may be used to -// export, in protected form, any key type from Azure Key Vault. Individual -// versions of a key cannot be backed up. BACKUP / RESTORE can be performed -// within geographical boundaries only; meaning that a BACKUP from one -// geographical area cannot be restored to another geographical area. For -// example, a backup from the US geographical area cannot be restored in an EU -// geographical area. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. -func (client ManagementClient) BackupKey(vaultBaseURL string, keyName string) (result BackupKeyResult, err error) { - req, err := client.BackupKeyPreparer(vaultBaseURL, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "BackupKey", nil, "Failure preparing request") - return - } - - resp, err := client.BackupKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "BackupKey", resp, "Failure sending request") - return - } - - result, err = client.BackupKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "BackupKey", resp, "Failure responding to request") - } - - return -} - -// BackupKeyPreparer prepares the BackupKey request. -func (client ManagementClient) BackupKeyPreparer(vaultBaseURL string, keyName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/backup", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// BackupKeySender sends the BackupKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) BackupKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// BackupKeyResponder handles the response to the BackupKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) BackupKeyResponder(resp *http.Response) (result BackupKeyResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateCertificate if this is the first version, the certificate resource is -// created. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. parameters is the parameters -// to create a certificate. -func (client ManagementClient) CreateCertificate(vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (result CertificateOperation, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "CreateCertificate") - } - - req, err := client.CreateCertificatePreparer(vaultBaseURL, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateCertificate", resp, "Failure sending request") - return - } - - result, err = client.CreateCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateCertificate", resp, "Failure responding to request") - } - - return -} - -// CreateCertificatePreparer prepares the CreateCertificate request. -func (client ManagementClient) CreateCertificatePreparer(vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/create", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateCertificateSender sends the CreateCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) CreateCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateCertificateResponder handles the response to the CreateCertificate request. The method always -// closes the http.Response Body. -func (client ManagementClient) CreateCertificateResponder(resp *http.Response) (result CertificateOperation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateKey the create key operation can be used to create any key type in -// Azure Key Vault. If the named key already exists, Azure Key Vault creates a -// new version of the key. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name for the new key. The system will generate the version -// name for the new key. parameters is the parameters to create a key. -func (client ManagementClient) CreateKey(vaultBaseURL string, keyName string, parameters KeyCreateParameters) (result KeyBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: keyName, - Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "CreateKey") - } - - req, err := client.CreateKeyPreparer(vaultBaseURL, keyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateKey", nil, "Failure preparing request") - return - } - - resp, err := client.CreateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateKey", resp, "Failure sending request") - return - } - - result, err = client.CreateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateKey", resp, "Failure responding to request") - } - - return -} - -// CreateKeyPreparer prepares the CreateKey request. -func (client ManagementClient) CreateKeyPreparer(vaultBaseURL string, keyName string, parameters KeyCreateParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/create", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// CreateKeySender sends the CreateKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) CreateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// CreateKeyResponder handles the response to the CreateKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) CreateKeyResponder(resp *http.Response) (result KeyBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Decrypt the DECRYPT operation decrypts a well-formed block of ciphertext -// using the target encryption key and specified algorithm. This operation is -// the reverse of the ENCRYPT operation; only a single block of data may be -// decrypted, the size of this block is dependent on the target key and the -// algorithm to be used. The DECRYPT operation applies to asymmetric and -// symmetric keys stored in Azure Key Vault since it uses the private portion -// of the key. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. keyVersion is the version of the key. -// parameters is the parameters for the decryption operation. -func (client ManagementClient) Decrypt(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Decrypt") - } - - req, err := client.DecryptPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Decrypt", nil, "Failure preparing request") - return - } - - resp, err := client.DecryptSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Decrypt", resp, "Failure sending request") - return - } - - result, err = client.DecryptResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Decrypt", resp, "Failure responding to request") - } - - return -} - -// DecryptPreparer prepares the Decrypt request. -func (client ManagementClient) DecryptPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}/decrypt", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DecryptSender sends the Decrypt request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DecryptSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DecryptResponder handles the response to the Decrypt request. The method always -// closes the http.Response Body. -func (client ManagementClient) DecryptResponder(resp *http.Response) (result KeyOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCertificate deletes all versions of a certificate object along with -// its associated policy. Delete certificate cannot be used to remove -// individual versions of a certificate object. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. -func (client ManagementClient) DeleteCertificate(vaultBaseURL string, certificateName string) (result CertificateBundle, err error) { - req, err := client.DeleteCertificatePreparer(vaultBaseURL, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificate", resp, "Failure sending request") - return - } - - result, err = client.DeleteCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificate", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificatePreparer prepares the DeleteCertificate request. -func (client ManagementClient) DeleteCertificatePreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateSender sends the DeleteCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always -// closes the http.Response Body. -func (client ManagementClient) DeleteCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCertificateContacts -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -func (client ManagementClient) DeleteCertificateContacts(vaultBaseURL string) (result Contacts, err error) { - req, err := client.DeleteCertificateContactsPreparer(vaultBaseURL) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateContacts", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteCertificateContactsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateContacts", resp, "Failure sending request") - return - } - - result, err = client.DeleteCertificateContactsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateContacts", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificateContactsPreparer prepares the DeleteCertificateContacts request. -func (client ManagementClient) DeleteCertificateContactsPreparer(vaultBaseURL string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/certificates/contacts"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateContactsSender sends the DeleteCertificateContacts request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DeleteCertificateContactsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateContactsResponder handles the response to the DeleteCertificateContacts request. The method always -// closes the http.Response Body. -func (client ManagementClient) DeleteCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCertificateIssuer -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// issuerName is the name of the issuer. -func (client ManagementClient) DeleteCertificateIssuer(vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { - req, err := client.DeleteCertificateIssuerPreparer(vaultBaseURL, issuerName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateIssuer", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteCertificateIssuerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateIssuer", resp, "Failure sending request") - return - } - - result, err = client.DeleteCertificateIssuerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateIssuer", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificateIssuerPreparer prepares the DeleteCertificateIssuer request. -func (client ManagementClient) DeleteCertificateIssuerPreparer(vaultBaseURL string, issuerName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "issuer-name": autorest.Encode("path", issuerName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateIssuerSender sends the DeleteCertificateIssuer request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DeleteCertificateIssuerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateIssuerResponder handles the response to the DeleteCertificateIssuer request. The method always -// closes the http.Response Body. -func (client ManagementClient) DeleteCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteCertificateOperation -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. -func (client ManagementClient) DeleteCertificateOperation(vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { - req, err := client.DeleteCertificateOperationPreparer(vaultBaseURL, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateOperation", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteCertificateOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateOperation", resp, "Failure sending request") - return - } - - result, err = client.DeleteCertificateOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateOperation", resp, "Failure responding to request") - } - - return -} - -// DeleteCertificateOperationPreparer prepares the DeleteCertificateOperation request. -func (client ManagementClient) DeleteCertificateOperationPreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteCertificateOperationSender sends the DeleteCertificateOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DeleteCertificateOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteCertificateOperationResponder handles the response to the DeleteCertificateOperation request. The method always -// closes the http.Response Body. -func (client ManagementClient) DeleteCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteKey the delete key operation cannot be used to remove individual -// versions of a key. This operation removes the cryptographic material -// associated with the key, which means the key is not usable for Sign/Verify, -// Wrap/Unwrap or Encrypt/Decrypt operations. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key to delete. -func (client ManagementClient) DeleteKey(vaultBaseURL string, keyName string) (result KeyBundle, err error) { - req, err := client.DeleteKeyPreparer(vaultBaseURL, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteKey", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteKey", resp, "Failure sending request") - return - } - - result, err = client.DeleteKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteKey", resp, "Failure responding to request") - } - - return -} - -// DeleteKeyPreparer prepares the DeleteKey request. -func (client ManagementClient) DeleteKeyPreparer(vaultBaseURL string, keyName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteKeySender sends the DeleteKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DeleteKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteKeyResponder handles the response to the DeleteKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) DeleteKeyResponder(resp *http.Response) (result KeyBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteSecret the DELETE operation applies to any secret stored in Azure Key -// Vault. DELETE cannot be applied to an individual version of a secret. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// secretName is the name of the secret. -func (client ManagementClient) DeleteSecret(vaultBaseURL string, secretName string) (result SecretBundle, err error) { - req, err := client.DeleteSecretPreparer(vaultBaseURL, secretName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteSecret", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSecretSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteSecret", resp, "Failure sending request") - return - } - - result, err = client.DeleteSecretResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteSecret", resp, "Failure responding to request") - } - - return -} - -// DeleteSecretPreparer prepares the DeleteSecret request. -func (client ManagementClient) DeleteSecretPreparer(vaultBaseURL string, secretName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "secret-name": autorest.Encode("path", secretName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// DeleteSecretSender sends the DeleteSecret request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) DeleteSecretSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// DeleteSecretResponder handles the response to the DeleteSecret request. The method always -// closes the http.Response Body. -func (client ManagementClient) DeleteSecretResponder(resp *http.Response) (result SecretBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Encrypt the ENCRYPT operation encrypts an arbitrary sequence of bytes using -// an encryption key that is stored in Azure Key Vault. Note that the ENCRYPT -// operation only supports a single block of data, the size of which is -// dependent on the target key and the encryption algorithm to be used. The -// ENCRYPT operation is only strictly necessary for symmetric keys stored in -// Azure Key Vault since protection with an asymmetric key can be performed -// using public portion of the key. This operation is supported for asymmetric -// keys as a convenience for callers that have a key-reference but do not have -// access to the public key material. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. keyVersion is the version of the key. -// parameters is the parameters for the encryption operation. -func (client ManagementClient) Encrypt(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Encrypt") - } - - req, err := client.EncryptPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Encrypt", nil, "Failure preparing request") - return - } - - resp, err := client.EncryptSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Encrypt", resp, "Failure sending request") - return - } - - result, err = client.EncryptResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Encrypt", resp, "Failure responding to request") - } - - return -} - -// EncryptPreparer prepares the Encrypt request. -func (client ManagementClient) EncryptPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}/encrypt", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// EncryptSender sends the Encrypt request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) EncryptSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// EncryptResponder handles the response to the Encrypt request. The method always -// closes the http.Response Body. -func (client ManagementClient) EncryptResponder(resp *http.Response) (result KeyOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificate the GetCertificate operation returns information about a -// specific certificate in the specified key vault -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate in the given vault. -// certificateVersion is the version of the certificate. -func (client ManagementClient) GetCertificate(vaultBaseURL string, certificateName string, certificateVersion string) (result CertificateBundle, err error) { - req, err := client.GetCertificatePreparer(vaultBaseURL, certificateName, certificateVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificate", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificate", resp, "Failure responding to request") - } - - return -} - -// GetCertificatePreparer prepares the GetCertificate request. -func (client ManagementClient) GetCertificatePreparer(vaultBaseURL string, certificateName string, certificateVersion string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - "certificate-version": autorest.Encode("path", certificateVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateSender sends the GetCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateResponder handles the response to the GetCertificate request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateContacts the GetCertificateContacts operation returns the set -// of certificate contact resources in the specified key vault. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -func (client ManagementClient) GetCertificateContacts(vaultBaseURL string) (result Contacts, err error) { - req, err := client.GetCertificateContactsPreparer(vaultBaseURL) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateContacts", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateContactsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateContacts", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateContactsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateContacts", resp, "Failure responding to request") - } - - return -} - -// GetCertificateContactsPreparer prepares the GetCertificateContacts request. -func (client ManagementClient) GetCertificateContactsPreparer(vaultBaseURL string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/certificates/contacts"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateContactsSender sends the GetCertificateContacts request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificateContactsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateContactsResponder handles the response to the GetCertificateContacts request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateIssuer the GetCertificateIssuer operation returns the -// specified certificate issuer resources in the specified key vault -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// issuerName is the name of the issuer. -func (client ManagementClient) GetCertificateIssuer(vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { - req, err := client.GetCertificateIssuerPreparer(vaultBaseURL, issuerName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuer", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateIssuerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuer", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateIssuerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuer", resp, "Failure responding to request") - } - - return -} - -// GetCertificateIssuerPreparer prepares the GetCertificateIssuer request. -func (client ManagementClient) GetCertificateIssuerPreparer(vaultBaseURL string, issuerName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "issuer-name": autorest.Encode("path", issuerName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateIssuerSender sends the GetCertificateIssuer request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificateIssuerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateIssuerResponder handles the response to the GetCertificateIssuer request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateIssuers the GetCertificateIssuers operation returns the set of -// certificate issuer resources in the specified key vault -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// maxresults is maximum number of results to return in a page. If not -// specified the service will return up to 25 results. -func (client ManagementClient) GetCertificateIssuers(vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetCertificateIssuers") - } - - req, err := client.GetCertificateIssuersPreparer(vaultBaseURL, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateIssuersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateIssuersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure responding to request") - } - - return -} - -// GetCertificateIssuersPreparer prepares the GetCertificateIssuers request. -func (client ManagementClient) GetCertificateIssuersPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/certificates/issuers"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateIssuersSender sends the GetCertificateIssuers request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificateIssuersSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateIssuersResponder handles the response to the GetCertificateIssuers request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificateIssuersResponder(resp *http.Response) (result CertificateIssuerListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateIssuersNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetCertificateIssuersNextResults(lastResults CertificateIssuerListResult) (result CertificateIssuerListResult, err error) { - req, err := lastResults.CertificateIssuerListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetCertificateIssuersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure sending next results request") - } - - result, err = client.GetCertificateIssuersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure responding to next results request") - } - - return -} - -// GetCertificateOperation the GetCertificateOperation operation returns the -// certificate operation associated with the certificate. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. -func (client ManagementClient) GetCertificateOperation(vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { - req, err := client.GetCertificateOperationPreparer(vaultBaseURL, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateOperation", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateOperation", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateOperation", resp, "Failure responding to request") - } - - return -} - -// GetCertificateOperationPreparer prepares the GetCertificateOperation request. -func (client ManagementClient) GetCertificateOperationPreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateOperationSender sends the GetCertificateOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificateOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateOperationResponder handles the response to the GetCertificateOperation request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificatePolicy the GetCertificatePolicy operation returns the -// specified certificate policy resources in the specified key vault -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate in a given key vault. -func (client ManagementClient) GetCertificatePolicy(vaultBaseURL string, certificateName string) (result CertificatePolicy, err error) { - req, err := client.GetCertificatePolicyPreparer(vaultBaseURL, certificateName) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificatePolicy", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificatePolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificatePolicy", resp, "Failure sending request") - return - } - - result, err = client.GetCertificatePolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificatePolicy", resp, "Failure responding to request") - } - - return -} - -// GetCertificatePolicyPreparer prepares the GetCertificatePolicy request. -func (client ManagementClient) GetCertificatePolicyPreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificatePolicySender sends the GetCertificatePolicy request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificatePolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificatePolicyResponder handles the response to the GetCertificatePolicy request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificates the GetCertificates operation returns the set of -// certificates resources in the specified key vault. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// maxresults is maximum number of results to return in a page. If not -// specified the service will return up to 25 results. -func (client ManagementClient) GetCertificates(vaultBaseURL string, maxresults *int32) (result CertificateListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetCertificates") - } - - req, err := client.GetCertificatesPreparer(vaultBaseURL, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure sending request") - return - } - - result, err = client.GetCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure responding to request") - } - - return -} - -// GetCertificatesPreparer prepares the GetCertificates request. -func (client ManagementClient) GetCertificatesPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/certificates"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificatesSender sends the GetCertificates request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificatesSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificatesResponder handles the response to the GetCertificates request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificatesResponder(resp *http.Response) (result CertificateListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificatesNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetCertificatesNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.CertificateListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetCertificatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure sending next results request") - } - - result, err = client.GetCertificatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure responding to next results request") - } - - return -} - -// GetCertificateVersions the GetCertificateVersions operation returns the -// versions of a certificate in the specified key vault -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. maxresults is maximum number -// of results to return in a page. If not specified the service will return up -// to 25 results. -func (client ManagementClient) GetCertificateVersions(vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetCertificateVersions") - } - - req, err := client.GetCertificateVersionsPreparer(vaultBaseURL, certificateName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", nil, "Failure preparing request") - return - } - - resp, err := client.GetCertificateVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure sending request") - return - } - - result, err = client.GetCertificateVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure responding to request") - } - - return -} - -// GetCertificateVersionsPreparer prepares the GetCertificateVersions request. -func (client ManagementClient) GetCertificateVersionsPreparer(vaultBaseURL string, certificateName string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetCertificateVersionsSender sends the GetCertificateVersions request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetCertificateVersionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetCertificateVersionsResponder handles the response to the GetCertificateVersions request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetCertificateVersionsResponder(resp *http.Response) (result CertificateListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCertificateVersionsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetCertificateVersionsNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { - req, err := lastResults.CertificateListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetCertificateVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure sending next results request") - } - - result, err = client.GetCertificateVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure responding to next results request") - } - - return -} - -// GetKey the get key operation is applicable to all key types. If the -// requested key is symmetric, then no key material is released in the -// response. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key to get. keyVersion is adding the version -// parameter retrieves a specific version of a key. -func (client ManagementClient) GetKey(vaultBaseURL string, keyName string, keyVersion string) (result KeyBundle, err error) { - req, err := client.GetKeyPreparer(vaultBaseURL, keyName, keyVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKey", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKey", resp, "Failure sending request") - return - } - - result, err = client.GetKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKey", resp, "Failure responding to request") - } - - return -} - -// GetKeyPreparer prepares the GetKey request. -func (client ManagementClient) GetKeyPreparer(vaultBaseURL string, keyName string, keyVersion string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetKeySender sends the GetKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetKeyResponder handles the response to the GetKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetKeyResponder(resp *http.Response) (result KeyBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeys retrieves a list of the keys in the Key Vault as JSON Web Key -// structures that contain the public part of a stored key. The LIST operation -// is applicable to all key types, however only the base key -// identifier,attributes, and tags are provided in the response. Individual -// versions of a key are not listed in the response. Authorization: Requires -// the keys/list permission. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// maxresults is maximum number of results to return in a page. If not -// specified the service will return up to 25 results. -func (client ManagementClient) GetKeys(vaultBaseURL string, maxresults *int32) (result KeyListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetKeys") - } - - req, err := client.GetKeysPreparer(vaultBaseURL, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure sending request") - return - } - - result, err = client.GetKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure responding to request") - } - - return -} - -// GetKeysPreparer prepares the GetKeys request. -func (client ManagementClient) GetKeysPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/keys"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetKeysSender sends the GetKeys request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetKeysSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetKeysResponder handles the response to the GetKeys request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetKeysResponder(resp *http.Response) (result KeyListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeysNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetKeysNextResults(lastResults KeyListResult) (result KeyListResult, err error) { - req, err := lastResults.KeyListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure sending next results request") - } - - result, err = client.GetKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure responding to next results request") - } - - return -} - -// GetKeyVersions the full key identifier, attributes, and tags are provided in -// the response. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. maxresults is maximum number of results to -// return in a page. If not specified the service will return up to 25 results. -func (client ManagementClient) GetKeyVersions(vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetKeyVersions") - } - - req, err := client.GetKeyVersionsPreparer(vaultBaseURL, keyName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", nil, "Failure preparing request") - return - } - - resp, err := client.GetKeyVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure sending request") - return - } - - result, err = client.GetKeyVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure responding to request") - } - - return -} - -// GetKeyVersionsPreparer prepares the GetKeyVersions request. -func (client ManagementClient) GetKeyVersionsPreparer(vaultBaseURL string, keyName string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetKeyVersionsSender sends the GetKeyVersions request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetKeyVersionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetKeyVersionsResponder handles the response to the GetKeyVersions request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetKeyVersionsResponder(resp *http.Response) (result KeyListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetKeyVersionsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetKeyVersionsNextResults(lastResults KeyListResult) (result KeyListResult, err error) { - req, err := lastResults.KeyListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetKeyVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure sending next results request") - } - - result, err = client.GetKeyVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure responding to next results request") - } - - return -} - -// GetSecret the GET operation is applicable to any secret stored in Azure Key -// Vault. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// secretName is the name of the secret. secretVersion is the version of the -// secret. -func (client ManagementClient) GetSecret(vaultBaseURL string, secretName string, secretVersion string) (result SecretBundle, err error) { - req, err := client.GetSecretPreparer(vaultBaseURL, secretName, secretVersion) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecret", nil, "Failure preparing request") - return - } - - resp, err := client.GetSecretSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecret", resp, "Failure sending request") - return - } - - result, err = client.GetSecretResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecret", resp, "Failure responding to request") - } - - return -} - -// GetSecretPreparer prepares the GetSecret request. -func (client ManagementClient) GetSecretPreparer(vaultBaseURL string, secretName string, secretVersion string) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "secret-name": autorest.Encode("path", secretName), - "secret-version": autorest.Encode("path", secretVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSecretSender sends the GetSecret request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetSecretSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSecretResponder handles the response to the GetSecret request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetSecretResponder(resp *http.Response) (result SecretBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSecrets the LIST operation is applicable to the entire vault, however -// only the base secret identifier and attributes are provided in the response. -// Individual secret versions are not listed in the response. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// maxresults is maximum number of results to return in a page. If not -// specified the service will return up to 25 results. -func (client ManagementClient) GetSecrets(vaultBaseURL string, maxresults *int32) (result SecretListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetSecrets") - } - - req, err := client.GetSecretsPreparer(vaultBaseURL, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", nil, "Failure preparing request") - return - } - - resp, err := client.GetSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure sending request") - return - } - - result, err = client.GetSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure responding to request") - } - - return -} - -// GetSecretsPreparer prepares the GetSecrets request. -func (client ManagementClient) GetSecretsPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/secrets"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSecretsSender sends the GetSecrets request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetSecretsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSecretsResponder handles the response to the GetSecrets request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetSecretsResponder(resp *http.Response) (result SecretListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSecretsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetSecretsNextResults(lastResults SecretListResult) (result SecretListResult, err error) { - req, err := lastResults.SecretListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSecretsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure sending next results request") - } - - result, err = client.GetSecretsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure responding to next results request") - } - - return -} - -// GetSecretVersions the LIST VERSIONS operation can be applied to all versions -// having the same secret name in the same key vault. The full secret -// identifier and attributes are provided in the response. No values are -// returned for the secrets and only current versions of a secret are listed. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// secretName is the name of the secret. maxresults is maximum number of -// results to return in a page. If not specified the service will return up to -// 25 results. -func (client ManagementClient) GetSecretVersions(vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: maxresults, - Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, - {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetSecretVersions") - } - - req, err := client.GetSecretVersionsPreparer(vaultBaseURL, secretName, maxresults) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", nil, "Failure preparing request") - return - } - - resp, err := client.GetSecretVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure sending request") - return - } - - result, err = client.GetSecretVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure responding to request") - } - - return -} - -// GetSecretVersionsPreparer prepares the GetSecretVersions request. -func (client ManagementClient) GetSecretVersionsPreparer(vaultBaseURL string, secretName string, maxresults *int32) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "secret-name": autorest.Encode("path", secretName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if maxresults != nil { - queryParameters["maxresults"] = autorest.Encode("query", *maxresults) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/secrets/{secret-name}/versions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// GetSecretVersionsSender sends the GetSecretVersions request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) GetSecretVersionsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// GetSecretVersionsResponder handles the response to the GetSecretVersions request. The method always -// closes the http.Response Body. -func (client ManagementClient) GetSecretVersionsResponder(resp *http.Response) (result SecretListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetSecretVersionsNextResults retrieves the next set of results, if any. -func (client ManagementClient) GetSecretVersionsNextResults(lastResults SecretListResult) (result SecretListResult, err error) { - req, err := lastResults.SecretListResultPreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", nil, "Failure preparing next results request") - } - if req == nil { - return - } - - resp, err := client.GetSecretVersionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure sending next results request") - } - - result, err = client.GetSecretVersionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure responding to next results request") - } - - return -} - -// ImportCertificate imports an existing valid certificate, containing a -// private key, into Azure Key Vault. The certificate to be imported can be in -// either PFX or PEM format. If the certificate is in PEM format the PEM file -// must contain the key as well as x509 certificates. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. parameters is the parameters -// to import the certificate. -func (client ManagementClient) ImportCertificate(vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (result CertificateBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: certificateName, - Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Base64EncodedCertificate", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "ImportCertificate") - } - - req, err := client.ImportCertificatePreparer(vaultBaseURL, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.ImportCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportCertificate", resp, "Failure sending request") - return - } - - result, err = client.ImportCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportCertificate", resp, "Failure responding to request") - } - - return -} - -// ImportCertificatePreparer prepares the ImportCertificate request. -func (client ManagementClient) ImportCertificatePreparer(vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/import", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ImportCertificateSender sends the ImportCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ImportCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ImportCertificateResponder handles the response to the ImportCertificate request. The method always -// closes the http.Response Body. -func (client ManagementClient) ImportCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ImportKey the import key operation may be used to import any key type into -// an Azure Key Vault. If the named key already exists, Azure Key Vault creates -// a new version of the key. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is name for the imported key. parameters is the parameters to import -// a key. -func (client ManagementClient) ImportKey(vaultBaseURL string, keyName string, parameters KeyImportParameters) (result KeyBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: keyName, - Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Key", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "ImportKey") - } - - req, err := client.ImportKeyPreparer(vaultBaseURL, keyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportKey", nil, "Failure preparing request") - return - } - - resp, err := client.ImportKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportKey", resp, "Failure sending request") - return - } - - result, err = client.ImportKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportKey", resp, "Failure responding to request") - } - - return -} - -// ImportKeyPreparer prepares the ImportKey request. -func (client ManagementClient) ImportKeyPreparer(vaultBaseURL string, keyName string, parameters KeyImportParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// ImportKeySender sends the ImportKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) ImportKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// ImportKeyResponder handles the response to the ImportKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) ImportKeyResponder(resp *http.Response) (result KeyBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// MergeCertificate -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. parameters is the parameters -// to merge certificate. -func (client ManagementClient) MergeCertificate(vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (result CertificateBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.X509Certificates", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "MergeCertificate") - } - - req, err := client.MergeCertificatePreparer(vaultBaseURL, certificateName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "MergeCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.MergeCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "MergeCertificate", resp, "Failure sending request") - return - } - - result, err = client.MergeCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "MergeCertificate", resp, "Failure responding to request") - } - - return -} - -// MergeCertificatePreparer prepares the MergeCertificate request. -func (client ManagementClient) MergeCertificatePreparer(vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/pending/merge", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// MergeCertificateSender sends the MergeCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) MergeCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// MergeCertificateResponder handles the response to the MergeCertificate request. The method always -// closes the http.Response Body. -func (client ManagementClient) MergeCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestoreKey imports a previously backed up key into Azure Key Vault, -// restoring the key, its key identifier, attributes and access control -// policies. The RESTORE operation may be used to import a previously backed up -// key. Individual versions of a key cannot be restored. The key is restored in -// its entirety with the same key name as it had when it was backed up. If the -// key name is not available in the target Key Vault, the RESTORE operation -// will be rejected. While the key name is retained during restore, the final -// key identifier will change if the key is restored to a different vault. -// Restore will restore all versions and preserve version identifiers. The -// RESTORE operation is subject to security constraints: The target Key Vault -// must be owned by the same Microsoft Azure Subscription as the source Key -// Vault The user must have RESTORE permission in the target Key Vault. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// parameters is the parameters to restore the key. -func (client ManagementClient) RestoreKey(vaultBaseURL string, parameters KeyRestoreParameters) (result KeyBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.KeyBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "RestoreKey") - } - - req, err := client.RestoreKeyPreparer(vaultBaseURL, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "RestoreKey", nil, "Failure preparing request") - return - } - - resp, err := client.RestoreKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "RestoreKey", resp, "Failure sending request") - return - } - - result, err = client.RestoreKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "RestoreKey", resp, "Failure responding to request") - } - - return -} - -// RestoreKeyPreparer prepares the RestoreKey request. -func (client ManagementClient) RestoreKeyPreparer(vaultBaseURL string, parameters KeyRestoreParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/keys/restore"), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// RestoreKeySender sends the RestoreKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) RestoreKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// RestoreKeyResponder handles the response to the RestoreKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) RestoreKeyResponder(resp *http.Response) (result KeyBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetCertificateContacts -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// contacts is the contacts for the key vault certificate. -func (client ManagementClient) SetCertificateContacts(vaultBaseURL string, contacts Contacts) (result Contacts, err error) { - req, err := client.SetCertificateContactsPreparer(vaultBaseURL, contacts) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateContacts", nil, "Failure preparing request") - return - } - - resp, err := client.SetCertificateContactsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateContacts", resp, "Failure sending request") - return - } - - result, err = client.SetCertificateContactsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateContacts", resp, "Failure responding to request") - } - - return -} - -// SetCertificateContactsPreparer prepares the SetCertificateContacts request. -func (client ManagementClient) SetCertificateContactsPreparer(vaultBaseURL string, contacts Contacts) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPath("/certificates/contacts"), - autorest.WithJSON(contacts), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetCertificateContactsSender sends the SetCertificateContacts request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) SetCertificateContactsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetCertificateContactsResponder handles the response to the SetCertificateContacts request. The method always -// closes the http.Response Body. -func (client ManagementClient) SetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetCertificateIssuer -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// issuerName is the name of the issuer. parameter is certificate issuer set -// parameter. -func (client ManagementClient) SetCertificateIssuer(vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (result IssuerBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameter, - Constraints: []validation.Constraint{{Target: "parameter.Provider", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "SetCertificateIssuer") - } - - req, err := client.SetCertificateIssuerPreparer(vaultBaseURL, issuerName, parameter) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateIssuer", nil, "Failure preparing request") - return - } - - resp, err := client.SetCertificateIssuerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateIssuer", resp, "Failure sending request") - return - } - - result, err = client.SetCertificateIssuerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateIssuer", resp, "Failure responding to request") - } - - return -} - -// SetCertificateIssuerPreparer prepares the SetCertificateIssuer request. -func (client ManagementClient) SetCertificateIssuerPreparer(vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "issuer-name": autorest.Encode("path", issuerName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), - autorest.WithJSON(parameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetCertificateIssuerSender sends the SetCertificateIssuer request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) SetCertificateIssuerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetCertificateIssuerResponder handles the response to the SetCertificateIssuer request. The method always -// closes the http.Response Body. -func (client ManagementClient) SetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SetSecret the SET operation adds a secret to the Azure Key Vault. If the -// named secret already exists, Azure Key Vault creates a new version of that -// secret. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// secretName is the name of the secret. parameters is the parameters for -// setting the secret. -func (client ManagementClient) SetSecret(vaultBaseURL string, secretName string, parameters SecretSetParameters) (result SecretBundle, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: secretName, - Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "SetSecret") - } - - req, err := client.SetSecretPreparer(vaultBaseURL, secretName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetSecret", nil, "Failure preparing request") - return - } - - resp, err := client.SetSecretSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetSecret", resp, "Failure sending request") - return - } - - result, err = client.SetSecretResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetSecret", resp, "Failure responding to request") - } - - return -} - -// SetSecretPreparer prepares the SetSecret request. -func (client ManagementClient) SetSecretPreparer(vaultBaseURL string, secretName string, parameters SecretSetParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "secret-name": autorest.Encode("path", secretName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPut(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SetSecretSender sends the SetSecret request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) SetSecretSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SetSecretResponder handles the response to the SetSecret request. The method always -// closes the http.Response Body. -func (client ManagementClient) SetSecretResponder(resp *http.Response) (result SecretBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Sign the SIGN operation is applicable to asymmetric and symmetric keys -// stored in Azure Key Vault since this operation uses the private portion of -// the key. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. keyVersion is the version of the key. -// parameters is the parameters for the signing operation. -func (client ManagementClient) Sign(vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (result KeyOperationResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Sign") - } - - req, err := client.SignPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Sign", nil, "Failure preparing request") - return - } - - resp, err := client.SignSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Sign", resp, "Failure sending request") - return - } - - result, err = client.SignResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Sign", resp, "Failure responding to request") - } - - return -} - -// SignPreparer prepares the Sign request. -func (client ManagementClient) SignPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}/sign", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// SignSender sends the Sign request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) SignSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// SignResponder handles the response to the Sign request. The method always -// closes the http.Response Body. -func (client ManagementClient) SignResponder(resp *http.Response) (result KeyOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UnwrapKey the UNWRAP operation supports decryption of a symmetric key using -// the target key encryption key. This operation is the reverse of the WRAP -// operation. The UNWRAP operation applies to asymmetric and symmetric keys -// stored in Azure Key Vault since it uses the private portion of the key. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. keyVersion is the version of the key. -// parameters is the parameters for the key operation. -func (client ManagementClient) UnwrapKey(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "UnwrapKey") - } - - req, err := client.UnwrapKeyPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UnwrapKey", nil, "Failure preparing request") - return - } - - resp, err := client.UnwrapKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UnwrapKey", resp, "Failure sending request") - return - } - - result, err = client.UnwrapKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UnwrapKey", resp, "Failure responding to request") - } - - return -} - -// UnwrapKeyPreparer prepares the UnwrapKey request. -func (client ManagementClient) UnwrapKeyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}/unwrapkey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UnwrapKeySender sends the UnwrapKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UnwrapKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UnwrapKeyResponder handles the response to the UnwrapKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) UnwrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCertificate -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate in the given key vault. -// certificateVersion is the version of the certificate. parameters is the -// parameters for certificate update. -func (client ManagementClient) UpdateCertificate(vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (result CertificateBundle, err error) { - req, err := client.UpdateCertificatePreparer(vaultBaseURL, certificateName, certificateVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificate", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateCertificateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificate", resp, "Failure sending request") - return - } - - result, err = client.UpdateCertificateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificate", resp, "Failure responding to request") - } - - return -} - -// UpdateCertificatePreparer prepares the UpdateCertificate request. -func (client ManagementClient) UpdateCertificatePreparer(vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - "certificate-version": autorest.Encode("path", certificateVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateCertificateSender sends the UpdateCertificate request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCertificateIssuer -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// issuerName is the name of the issuer. parameter is certificate issuer update -// parameter. -func (client ManagementClient) UpdateCertificateIssuer(vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (result IssuerBundle, err error) { - req, err := client.UpdateCertificateIssuerPreparer(vaultBaseURL, issuerName, parameter) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateIssuer", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateCertificateIssuerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateIssuer", resp, "Failure sending request") - return - } - - result, err = client.UpdateCertificateIssuerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateIssuer", resp, "Failure responding to request") - } - - return -} - -// UpdateCertificateIssuerPreparer prepares the UpdateCertificateIssuer request. -func (client ManagementClient) UpdateCertificateIssuerPreparer(vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "issuer-name": autorest.Encode("path", issuerName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), - autorest.WithJSON(parameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateCertificateIssuerSender sends the UpdateCertificateIssuer request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateCertificateIssuerSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateCertificateIssuerResponder handles the response to the UpdateCertificateIssuer request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCertificateOperation -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate. certificateOperation is the -// certificate operation response. -func (client ManagementClient) UpdateCertificateOperation(vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (result CertificateOperation, err error) { - req, err := client.UpdateCertificateOperationPreparer(vaultBaseURL, certificateName, certificateOperation) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateOperation", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateCertificateOperationSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateOperation", resp, "Failure sending request") - return - } - - result, err = client.UpdateCertificateOperationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateOperation", resp, "Failure responding to request") - } - - return -} - -// UpdateCertificateOperationPreparer prepares the UpdateCertificateOperation request. -func (client ManagementClient) UpdateCertificateOperationPreparer(vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), - autorest.WithJSON(certificateOperation), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateCertificateOperationSender sends the UpdateCertificateOperation request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateCertificateOperationSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateCertificateOperationResponder handles the response to the UpdateCertificateOperation request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateCertificatePolicy set specified members in the certificate policy. -// Leave others as null. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// certificateName is the name of the certificate in the given vault. -// certificatePolicy is the policy for the certificate. -func (client ManagementClient) UpdateCertificatePolicy(vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (result CertificatePolicy, err error) { - req, err := client.UpdateCertificatePolicyPreparer(vaultBaseURL, certificateName, certificatePolicy) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificatePolicy", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateCertificatePolicySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificatePolicy", resp, "Failure sending request") - return - } - - result, err = client.UpdateCertificatePolicyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificatePolicy", resp, "Failure responding to request") - } - - return -} - -// UpdateCertificatePolicyPreparer prepares the UpdateCertificatePolicy request. -func (client ManagementClient) UpdateCertificatePolicyPreparer(vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "certificate-name": autorest.Encode("path", certificateName), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), - autorest.WithJSON(certificatePolicy), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateCertificatePolicySender sends the UpdateCertificatePolicy request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateCertificatePolicySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateCertificatePolicyResponder handles the response to the UpdateCertificatePolicy request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateKey in order to perform this operation, the key must already exist in -// the Key Vault. Note: The cryptographic material of a key itself cannot be -// changed. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of key to update. keyVersion is the version of the key -// to update. parameters is the parameters of the key to update. -func (client ManagementClient) UpdateKey(vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (result KeyBundle, err error) { - req, err := client.UpdateKeyPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateKey", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateKey", resp, "Failure sending request") - return - } - - result, err = client.UpdateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateKey", resp, "Failure responding to request") - } - - return -} - -// UpdateKeyPreparer prepares the UpdateKey request. -func (client ManagementClient) UpdateKeyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateKeySender sends the UpdateKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateKeyResponder handles the response to the UpdateKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateKeyResponder(resp *http.Response) (result KeyBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateSecret the UPDATE operation changes specified attributes of an -// existing stored secret. Attributes that are not specified in the request are -// left unchanged. The value of a secret itself cannot be changed. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// secretName is the name of the secret. secretVersion is the version of the -// secret. parameters is the parameters for update secret operation. -func (client ManagementClient) UpdateSecret(vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (result SecretBundle, err error) { - req, err := client.UpdateSecretPreparer(vaultBaseURL, secretName, secretVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateSecret", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSecretSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateSecret", resp, "Failure sending request") - return - } - - result, err = client.UpdateSecretResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateSecret", resp, "Failure responding to request") - } - - return -} - -// UpdateSecretPreparer prepares the UpdateSecret request. -func (client ManagementClient) UpdateSecretPreparer(vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "secret-name": autorest.Encode("path", secretName), - "secret-version": autorest.Encode("path", secretVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPatch(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// UpdateSecretSender sends the UpdateSecret request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) UpdateSecretSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// UpdateSecretResponder handles the response to the UpdateSecret request. The method always -// closes the http.Response Body. -func (client ManagementClient) UpdateSecretResponder(resp *http.Response) (result SecretBundle, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Verify the VERIFY operation is applicable to symmetric keys stored in Azure -// Key Vault. VERIFY is not strictly necessary for asymmetric keys stored in -// Azure Key Vault since signature verification can be performed using the -// public portion of the key but this operation is supported as a convenience -// for callers that only have a key-reference and not the public portion of the -// key. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. keyVersion is the version of the key. -// parameters is the parameters for verify operations. -func (client ManagementClient) Verify(vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (result KeyVerifyResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Digest", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Signature", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Verify") - } - - req, err := client.VerifyPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Verify", nil, "Failure preparing request") - return - } - - resp, err := client.VerifySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Verify", resp, "Failure sending request") - return - } - - result, err = client.VerifyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Verify", resp, "Failure responding to request") - } - - return -} - -// VerifyPreparer prepares the Verify request. -func (client ManagementClient) VerifyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}/verify", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// VerifySender sends the Verify request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) VerifySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// VerifyResponder handles the response to the Verify request. The method always -// closes the http.Response Body. -func (client ManagementClient) VerifyResponder(resp *http.Response) (result KeyVerifyResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// WrapKey the WRAP operation supports encryption of a symmetric key using a -// key encryption key that has previously been stored in an Azure Key Vault. -// The WRAP operation is only strictly necessary for symmetric keys stored in -// Azure Key Vault since protection with an asymmetric key can be performed -// using the public portion of the key. This operation is supported for -// asymmetric keys as a convenience for callers that have a key-reference but -// do not have access to the public key material. -// -// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. -// keyName is the name of the key. keyVersion is the version of the key. -// parameters is the parameters for wrap operation. -func (client ManagementClient) WrapKey(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "WrapKey") - } - - req, err := client.WrapKeyPreparer(vaultBaseURL, keyName, keyVersion, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "WrapKey", nil, "Failure preparing request") - return - } - - resp, err := client.WrapKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "WrapKey", resp, "Failure sending request") - return - } - - result, err = client.WrapKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "WrapKey", resp, "Failure responding to request") - } - - return -} - -// WrapKeyPreparer prepares the WrapKey request. -func (client ManagementClient) WrapKeyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { - urlParameters := map[string]interface{}{ - "vaultBaseUrl": vaultBaseURL, - } - - pathParameters := map[string]interface{}{ - "key-name": autorest.Encode("path", keyName), - "key-version": autorest.Encode("path", keyVersion), - } - - const APIVersion = "2016-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsJSON(), - autorest.AsPost(), - autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), - autorest.WithPathParameters("/keys/{key-name}/{key-version}/wrapkey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare(&http.Request{}) -} - -// WrapKeySender sends the WrapKey request. The method will close the -// http.Response Body if it receives an error. -func (client ManagementClient) WrapKeySender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req) -} - -// WrapKeyResponder handles the response to the WrapKey request. The method always -// closes the http.Response Body. -func (client ManagementClient) WrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} +// Package keyvault implements the Azure ARM Keyvault service API version +// 2016-10-01. +// +// The key vault client performs cryptographic key operations and vault +// operations against the Key Vault service. +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +const () + +// ManagementClient is the base client for Keyvault. +type ManagementClient struct { + autorest.Client +} + +// New creates an instance of the ManagementClient client. +func New() ManagementClient { + return NewWithoutDefaults() +} + +// NewWithoutDefaults creates an instance of the ManagementClient client. +func NewWithoutDefaults() ManagementClient { + return ManagementClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + } +} + +// BackupKey the Key Backup operation exports a key from Azure Key Vault in a +// protected form. Note that this operation does NOT return key material in a +// form that can be used outside the Azure Key Vault system, the returned key +// material is either protected to a Azure Key Vault HSM or to Azure Key Vault +// itself. The intent of this operation is to allow a client to GENERATE a key +// in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into +// another Azure Key Vault instance. The BACKUP operation may be used to +// export, in protected form, any key type from Azure Key Vault. Individual +// versions of a key cannot be backed up. BACKUP / RESTORE can be performed +// within geographical boundaries only; meaning that a BACKUP from one +// geographical area cannot be restored to another geographical area. For +// example, a backup from the US geographical area cannot be restored in an EU +// geographical area. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. +func (client ManagementClient) BackupKey(vaultBaseURL string, keyName string) (result BackupKeyResult, err error) { + req, err := client.BackupKeyPreparer(vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "BackupKey", nil, "Failure preparing request") + return + } + + resp, err := client.BackupKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "BackupKey", resp, "Failure sending request") + return + } + + result, err = client.BackupKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "BackupKey", resp, "Failure responding to request") + } + + return +} + +// BackupKeyPreparer prepares the BackupKey request. +func (client ManagementClient) BackupKeyPreparer(vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/backup", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// BackupKeySender sends the BackupKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) BackupKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// BackupKeyResponder handles the response to the BackupKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) BackupKeyResponder(resp *http.Response) (result BackupKeyResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateCertificate if this is the first version, the certificate resource is +// created. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. parameters is the parameters +// to create a certificate. +func (client ManagementClient) CreateCertificate(vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (result CertificateOperation, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "CreateCertificate") + } + + req, err := client.CreateCertificatePreparer(vaultBaseURL, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateCertificate", resp, "Failure sending request") + return + } + + result, err = client.CreateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateCertificate", resp, "Failure responding to request") + } + + return +} + +// CreateCertificatePreparer prepares the CreateCertificate request. +func (client ManagementClient) CreateCertificatePreparer(vaultBaseURL string, certificateName string, parameters CertificateCreateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/create", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateCertificateSender sends the CreateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) CreateCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateCertificateResponder handles the response to the CreateCertificate request. The method always +// closes the http.Response Body. +func (client ManagementClient) CreateCertificateResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateKey the create key operation can be used to create any key type in +// Azure Key Vault. If the named key already exists, Azure Key Vault creates a +// new version of the key. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name for the new key. The system will generate the version +// name for the new key. parameters is the parameters to create a key. +func (client ManagementClient) CreateKey(vaultBaseURL string, keyName string, parameters KeyCreateParameters) (result KeyBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "CreateKey") + } + + req, err := client.CreateKeyPreparer(vaultBaseURL, keyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateKey", nil, "Failure preparing request") + return + } + + resp, err := client.CreateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateKey", resp, "Failure sending request") + return + } + + result, err = client.CreateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "CreateKey", resp, "Failure responding to request") + } + + return +} + +// CreateKeyPreparer prepares the CreateKey request. +func (client ManagementClient) CreateKeyPreparer(vaultBaseURL string, keyName string, parameters KeyCreateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/create", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// CreateKeySender sends the CreateKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) CreateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// CreateKeyResponder handles the response to the CreateKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) CreateKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Decrypt the DECRYPT operation decrypts a well-formed block of ciphertext +// using the target encryption key and specified algorithm. This operation is +// the reverse of the ENCRYPT operation; only a single block of data may be +// decrypted, the size of this block is dependent on the target key and the +// algorithm to be used. The DECRYPT operation applies to asymmetric and +// symmetric keys stored in Azure Key Vault since it uses the private portion +// of the key. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. keyVersion is the version of the key. +// parameters is the parameters for the decryption operation. +func (client ManagementClient) Decrypt(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Decrypt") + } + + req, err := client.DecryptPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Decrypt", nil, "Failure preparing request") + return + } + + resp, err := client.DecryptSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Decrypt", resp, "Failure sending request") + return + } + + result, err = client.DecryptResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Decrypt", resp, "Failure responding to request") + } + + return +} + +// DecryptPreparer prepares the Decrypt request. +func (client ManagementClient) DecryptPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/decrypt", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DecryptSender sends the Decrypt request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DecryptSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DecryptResponder handles the response to the Decrypt request. The method always +// closes the http.Response Body. +func (client ManagementClient) DecryptResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificate deletes all versions of a certificate object along with +// its associated policy. Delete certificate cannot be used to remove +// individual versions of a certificate object. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. +func (client ManagementClient) DeleteCertificate(vaultBaseURL string, certificateName string) (result CertificateBundle, err error) { + req, err := client.DeleteCertificatePreparer(vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificate", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificate", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificatePreparer prepares the DeleteCertificate request. +func (client ManagementClient) DeleteCertificatePreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteCertificateSender sends the DeleteCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DeleteCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteCertificateResponder handles the response to the DeleteCertificate request. The method always +// closes the http.Response Body. +func (client ManagementClient) DeleteCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificateContacts +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +func (client ManagementClient) DeleteCertificateContacts(vaultBaseURL string) (result Contacts, err error) { + req, err := client.DeleteCertificateContactsPreparer(vaultBaseURL) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateContacts", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateContactsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateContacts", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateContactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateContacts", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificateContactsPreparer prepares the DeleteCertificateContacts request. +func (client ManagementClient) DeleteCertificateContactsPreparer(vaultBaseURL string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/contacts"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteCertificateContactsSender sends the DeleteCertificateContacts request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DeleteCertificateContactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteCertificateContactsResponder handles the response to the DeleteCertificateContacts request. The method always +// closes the http.Response Body. +func (client ManagementClient) DeleteCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificateIssuer +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// issuerName is the name of the issuer. +func (client ManagementClient) DeleteCertificateIssuer(vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { + req, err := client.DeleteCertificateIssuerPreparer(vaultBaseURL, issuerName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificateIssuerPreparer prepares the DeleteCertificateIssuer request. +func (client ManagementClient) DeleteCertificateIssuerPreparer(vaultBaseURL string, issuerName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteCertificateIssuerSender sends the DeleteCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DeleteCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteCertificateIssuerResponder handles the response to the DeleteCertificateIssuer request. The method always +// closes the http.Response Body. +func (client ManagementClient) DeleteCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteCertificateOperation +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. +func (client ManagementClient) DeleteCertificateOperation(vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { + req, err := client.DeleteCertificateOperationPreparer(vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateOperation", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteCertificateOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateOperation", resp, "Failure sending request") + return + } + + result, err = client.DeleteCertificateOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteCertificateOperation", resp, "Failure responding to request") + } + + return +} + +// DeleteCertificateOperationPreparer prepares the DeleteCertificateOperation request. +func (client ManagementClient) DeleteCertificateOperationPreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteCertificateOperationSender sends the DeleteCertificateOperation request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DeleteCertificateOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteCertificateOperationResponder handles the response to the DeleteCertificateOperation request. The method always +// closes the http.Response Body. +func (client ManagementClient) DeleteCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteKey the delete key operation cannot be used to remove individual +// versions of a key. This operation removes the cryptographic material +// associated with the key, which means the key is not usable for Sign/Verify, +// Wrap/Unwrap or Encrypt/Decrypt operations. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key to delete. +func (client ManagementClient) DeleteKey(vaultBaseURL string, keyName string) (result KeyBundle, err error) { + req, err := client.DeleteKeyPreparer(vaultBaseURL, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteKey", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteKey", resp, "Failure sending request") + return + } + + result, err = client.DeleteKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteKey", resp, "Failure responding to request") + } + + return +} + +// DeleteKeyPreparer prepares the DeleteKey request. +func (client ManagementClient) DeleteKeyPreparer(vaultBaseURL string, keyName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteKeySender sends the DeleteKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DeleteKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteKeyResponder handles the response to the DeleteKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) DeleteKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteSecret the DELETE operation applies to any secret stored in Azure Key +// Vault. DELETE cannot be applied to an individual version of a secret. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// secretName is the name of the secret. +func (client ManagementClient) DeleteSecret(vaultBaseURL string, secretName string) (result SecretBundle, err error) { + req, err := client.DeleteSecretPreparer(vaultBaseURL, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteSecret", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteSecret", resp, "Failure sending request") + return + } + + result, err = client.DeleteSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "DeleteSecret", resp, "Failure responding to request") + } + + return +} + +// DeleteSecretPreparer prepares the DeleteSecret request. +func (client ManagementClient) DeleteSecretPreparer(vaultBaseURL string, secretName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// DeleteSecretSender sends the DeleteSecret request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) DeleteSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// DeleteSecretResponder handles the response to the DeleteSecret request. The method always +// closes the http.Response Body. +func (client ManagementClient) DeleteSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Encrypt the ENCRYPT operation encrypts an arbitrary sequence of bytes using +// an encryption key that is stored in Azure Key Vault. Note that the ENCRYPT +// operation only supports a single block of data, the size of which is +// dependent on the target key and the encryption algorithm to be used. The +// ENCRYPT operation is only strictly necessary for symmetric keys stored in +// Azure Key Vault since protection with an asymmetric key can be performed +// using public portion of the key. This operation is supported for asymmetric +// keys as a convenience for callers that have a key-reference but do not have +// access to the public key material. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. keyVersion is the version of the key. +// parameters is the parameters for the encryption operation. +func (client ManagementClient) Encrypt(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Encrypt") + } + + req, err := client.EncryptPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Encrypt", nil, "Failure preparing request") + return + } + + resp, err := client.EncryptSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Encrypt", resp, "Failure sending request") + return + } + + result, err = client.EncryptResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Encrypt", resp, "Failure responding to request") + } + + return +} + +// EncryptPreparer prepares the Encrypt request. +func (client ManagementClient) EncryptPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/encrypt", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// EncryptSender sends the Encrypt request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) EncryptSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// EncryptResponder handles the response to the Encrypt request. The method always +// closes the http.Response Body. +func (client ManagementClient) EncryptResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificate the GetCertificate operation returns information about a +// specific certificate in the specified key vault +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate in the given vault. +// certificateVersion is the version of the certificate. +func (client ManagementClient) GetCertificate(vaultBaseURL string, certificateName string, certificateVersion string) (result CertificateBundle, err error) { + req, err := client.GetCertificatePreparer(vaultBaseURL, certificateName, certificateVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificate", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificate", resp, "Failure responding to request") + } + + return +} + +// GetCertificatePreparer prepares the GetCertificate request. +func (client ManagementClient) GetCertificatePreparer(vaultBaseURL string, certificateName string, certificateVersion string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + "certificate-version": autorest.Encode("path", certificateVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateSender sends the GetCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateResponder handles the response to the GetCertificate request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateContacts the GetCertificateContacts operation returns the set +// of certificate contact resources in the specified key vault. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +func (client ManagementClient) GetCertificateContacts(vaultBaseURL string) (result Contacts, err error) { + req, err := client.GetCertificateContactsPreparer(vaultBaseURL) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateContacts", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateContactsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateContacts", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateContactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateContacts", resp, "Failure responding to request") + } + + return +} + +// GetCertificateContactsPreparer prepares the GetCertificateContacts request. +func (client ManagementClient) GetCertificateContactsPreparer(vaultBaseURL string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/contacts"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateContactsSender sends the GetCertificateContacts request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificateContactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateContactsResponder handles the response to the GetCertificateContacts request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateIssuer the GetCertificateIssuer operation returns the +// specified certificate issuer resources in the specified key vault +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// issuerName is the name of the issuer. +func (client ManagementClient) GetCertificateIssuer(vaultBaseURL string, issuerName string) (result IssuerBundle, err error) { + req, err := client.GetCertificateIssuerPreparer(vaultBaseURL, issuerName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// GetCertificateIssuerPreparer prepares the GetCertificateIssuer request. +func (client ManagementClient) GetCertificateIssuerPreparer(vaultBaseURL string, issuerName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateIssuerSender sends the GetCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateIssuerResponder handles the response to the GetCertificateIssuer request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateIssuers the GetCertificateIssuers operation returns the set of +// certificate issuer resources in the specified key vault +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// maxresults is maximum number of results to return in a page. If not +// specified the service will return up to 25 results. +func (client ManagementClient) GetCertificateIssuers(vaultBaseURL string, maxresults *int32) (result CertificateIssuerListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetCertificateIssuers") + } + + req, err := client.GetCertificateIssuersPreparer(vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateIssuersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateIssuersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure responding to request") + } + + return +} + +// GetCertificateIssuersPreparer prepares the GetCertificateIssuers request. +func (client ManagementClient) GetCertificateIssuersPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/issuers"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateIssuersSender sends the GetCertificateIssuers request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificateIssuersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateIssuersResponder handles the response to the GetCertificateIssuers request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificateIssuersResponder(resp *http.Response) (result CertificateIssuerListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateIssuersNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetCertificateIssuersNextResults(lastResults CertificateIssuerListResult) (result CertificateIssuerListResult, err error) { + req, err := lastResults.CertificateIssuerListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetCertificateIssuersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure sending next results request") + } + + result, err = client.GetCertificateIssuersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateIssuers", resp, "Failure responding to next results request") + } + + return +} + +// GetCertificateOperation the GetCertificateOperation operation returns the +// certificate operation associated with the certificate. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. +func (client ManagementClient) GetCertificateOperation(vaultBaseURL string, certificateName string) (result CertificateOperation, err error) { + req, err := client.GetCertificateOperationPreparer(vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateOperation", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateOperation", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateOperation", resp, "Failure responding to request") + } + + return +} + +// GetCertificateOperationPreparer prepares the GetCertificateOperation request. +func (client ManagementClient) GetCertificateOperationPreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateOperationSender sends the GetCertificateOperation request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificateOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateOperationResponder handles the response to the GetCertificateOperation request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificatePolicy the GetCertificatePolicy operation returns the +// specified certificate policy resources in the specified key vault +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate in a given key vault. +func (client ManagementClient) GetCertificatePolicy(vaultBaseURL string, certificateName string) (result CertificatePolicy, err error) { + req, err := client.GetCertificatePolicyPreparer(vaultBaseURL, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificatePolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificatePolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificatePolicy", resp, "Failure sending request") + return + } + + result, err = client.GetCertificatePolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificatePolicy", resp, "Failure responding to request") + } + + return +} + +// GetCertificatePolicyPreparer prepares the GetCertificatePolicy request. +func (client ManagementClient) GetCertificatePolicyPreparer(vaultBaseURL string, certificateName string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificatePolicySender sends the GetCertificatePolicy request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificatePolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificatePolicyResponder handles the response to the GetCertificatePolicy request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificates the GetCertificates operation returns the set of +// certificates resources in the specified key vault. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// maxresults is maximum number of results to return in a page. If not +// specified the service will return up to 25 results. +func (client ManagementClient) GetCertificates(vaultBaseURL string, maxresults *int32) (result CertificateListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetCertificates") + } + + req, err := client.GetCertificatesPreparer(vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure sending request") + return + } + + result, err = client.GetCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure responding to request") + } + + return +} + +// GetCertificatesPreparer prepares the GetCertificates request. +func (client ManagementClient) GetCertificatesPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificatesSender sends the GetCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificatesResponder handles the response to the GetCertificates request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificatesResponder(resp *http.Response) (result CertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificatesNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetCertificatesNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.CertificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetCertificatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure sending next results request") + } + + result, err = client.GetCertificatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificates", resp, "Failure responding to next results request") + } + + return +} + +// GetCertificateVersions the GetCertificateVersions operation returns the +// versions of a certificate in the specified key vault +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. maxresults is maximum number +// of results to return in a page. If not specified the service will return up +// to 25 results. +func (client ManagementClient) GetCertificateVersions(vaultBaseURL string, certificateName string, maxresults *int32) (result CertificateListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetCertificateVersions") + } + + req, err := client.GetCertificateVersionsPreparer(vaultBaseURL, certificateName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetCertificateVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure sending request") + return + } + + result, err = client.GetCertificateVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure responding to request") + } + + return +} + +// GetCertificateVersionsPreparer prepares the GetCertificateVersions request. +func (client ManagementClient) GetCertificateVersionsPreparer(vaultBaseURL string, certificateName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetCertificateVersionsSender sends the GetCertificateVersions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetCertificateVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetCertificateVersionsResponder handles the response to the GetCertificateVersions request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetCertificateVersionsResponder(resp *http.Response) (result CertificateListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCertificateVersionsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetCertificateVersionsNextResults(lastResults CertificateListResult) (result CertificateListResult, err error) { + req, err := lastResults.CertificateListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetCertificateVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure sending next results request") + } + + result, err = client.GetCertificateVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetCertificateVersions", resp, "Failure responding to next results request") + } + + return +} + +// GetKey the get key operation is applicable to all key types. If the +// requested key is symmetric, then no key material is released in the +// response. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key to get. keyVersion is adding the version +// parameter retrieves a specific version of a key. +func (client ManagementClient) GetKey(vaultBaseURL string, keyName string, keyVersion string) (result KeyBundle, err error) { + req, err := client.GetKeyPreparer(vaultBaseURL, keyName, keyVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKey", resp, "Failure sending request") + return + } + + result, err = client.GetKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKey", resp, "Failure responding to request") + } + + return +} + +// GetKeyPreparer prepares the GetKey request. +func (client ManagementClient) GetKeyPreparer(vaultBaseURL string, keyName string, keyVersion string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetKeySender sends the GetKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetKeyResponder handles the response to the GetKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeys retrieves a list of the keys in the Key Vault as JSON Web Key +// structures that contain the public part of a stored key. The LIST operation +// is applicable to all key types, however only the base key +// identifier,attributes, and tags are provided in the response. Individual +// versions of a key are not listed in the response. Authorization: Requires +// the keys/list permission. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// maxresults is maximum number of results to return in a page. If not +// specified the service will return up to 25 results. +func (client ManagementClient) GetKeys(vaultBaseURL string, maxresults *int32) (result KeyListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetKeys") + } + + req, err := client.GetKeysPreparer(vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure sending request") + return + } + + result, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure responding to request") + } + + return +} + +// GetKeysPreparer prepares the GetKeys request. +func (client ManagementClient) GetKeysPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/keys"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetKeysSender sends the GetKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetKeysResponder handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetKeysResponder(resp *http.Response) (result KeyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeysNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetKeysNextResults(lastResults KeyListResult) (result KeyListResult, err error) { + req, err := lastResults.KeyListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure sending next results request") + } + + result, err = client.GetKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeys", resp, "Failure responding to next results request") + } + + return +} + +// GetKeyVersions the full key identifier, attributes, and tags are provided in +// the response. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. maxresults is maximum number of results to +// return in a page. If not specified the service will return up to 25 results. +func (client ManagementClient) GetKeyVersions(vaultBaseURL string, keyName string, maxresults *int32) (result KeyListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetKeyVersions") + } + + req, err := client.GetKeyVersionsPreparer(vaultBaseURL, keyName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetKeyVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure sending request") + return + } + + result, err = client.GetKeyVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure responding to request") + } + + return +} + +// GetKeyVersionsPreparer prepares the GetKeyVersions request. +func (client ManagementClient) GetKeyVersionsPreparer(vaultBaseURL string, keyName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetKeyVersionsSender sends the GetKeyVersions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetKeyVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetKeyVersionsResponder handles the response to the GetKeyVersions request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetKeyVersionsResponder(resp *http.Response) (result KeyListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetKeyVersionsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetKeyVersionsNextResults(lastResults KeyListResult) (result KeyListResult, err error) { + req, err := lastResults.KeyListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetKeyVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure sending next results request") + } + + result, err = client.GetKeyVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetKeyVersions", resp, "Failure responding to next results request") + } + + return +} + +// GetSecret the GET operation is applicable to any secret stored in Azure Key +// Vault. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// secretName is the name of the secret. secretVersion is the version of the +// secret. +func (client ManagementClient) GetSecret(vaultBaseURL string, secretName string, secretVersion string) (result SecretBundle, err error) { + req, err := client.GetSecretPreparer(vaultBaseURL, secretName, secretVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecret", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecret", resp, "Failure sending request") + return + } + + result, err = client.GetSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecret", resp, "Failure responding to request") + } + + return +} + +// GetSecretPreparer prepares the GetSecret request. +func (client ManagementClient) GetSecretPreparer(vaultBaseURL string, secretName string, secretVersion string) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + "secret-version": autorest.Encode("path", secretVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSecretSender sends the GetSecret request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSecretResponder handles the response to the GetSecret request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSecrets the LIST operation is applicable to the entire vault, however +// only the base secret identifier and attributes are provided in the response. +// Individual secret versions are not listed in the response. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// maxresults is maximum number of results to return in a page. If not +// specified the service will return up to 25 results. +func (client ManagementClient) GetSecrets(vaultBaseURL string, maxresults *int32) (result SecretListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetSecrets") + } + + req, err := client.GetSecretsPreparer(vaultBaseURL, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure sending request") + return + } + + result, err = client.GetSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure responding to request") + } + + return +} + +// GetSecretsPreparer prepares the GetSecrets request. +func (client ManagementClient) GetSecretsPreparer(vaultBaseURL string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/secrets"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSecretsSender sends the GetSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetSecretsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSecretsResponder handles the response to the GetSecrets request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetSecretsResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSecretsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetSecretsNextResults(lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.SecretListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure sending next results request") + } + + result, err = client.GetSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecrets", resp, "Failure responding to next results request") + } + + return +} + +// GetSecretVersions the LIST VERSIONS operation can be applied to all versions +// having the same secret name in the same key vault. The full secret +// identifier and attributes are provided in the response. No values are +// returned for the secrets and only current versions of a secret are listed. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// secretName is the name of the secret. maxresults is maximum number of +// results to return in a page. If not specified the service will return up to +// 25 results. +func (client ManagementClient) GetSecretVersions(vaultBaseURL string, secretName string, maxresults *int32) (result SecretListResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: maxresults, + Constraints: []validation.Constraint{{Target: "maxresults", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "maxresults", Name: validation.InclusiveMaximum, Rule: 25, Chain: nil}, + {Target: "maxresults", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "GetSecretVersions") + } + + req, err := client.GetSecretVersionsPreparer(vaultBaseURL, secretName, maxresults) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetSecretVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure sending request") + return + } + + result, err = client.GetSecretVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure responding to request") + } + + return +} + +// GetSecretVersionsPreparer prepares the GetSecretVersions request. +func (client ManagementClient) GetSecretVersionsPreparer(vaultBaseURL string, secretName string, maxresults *int32) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if maxresults != nil { + queryParameters["maxresults"] = autorest.Encode("query", *maxresults) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// GetSecretVersionsSender sends the GetSecretVersions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) GetSecretVersionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// GetSecretVersionsResponder handles the response to the GetSecretVersions request. The method always +// closes the http.Response Body. +func (client ManagementClient) GetSecretVersionsResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSecretVersionsNextResults retrieves the next set of results, if any. +func (client ManagementClient) GetSecretVersionsNextResults(lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.SecretListResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", nil, "Failure preparing next results request") + } + if req == nil { + return + } + + resp, err := client.GetSecretVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure sending next results request") + } + + result, err = client.GetSecretVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "GetSecretVersions", resp, "Failure responding to next results request") + } + + return +} + +// ImportCertificate imports an existing valid certificate, containing a +// private key, into Azure Key Vault. The certificate to be imported can be in +// either PFX or PEM format. If the certificate is in PEM format the PEM file +// must contain the key as well as x509 certificates. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. parameters is the parameters +// to import the certificate. +func (client ManagementClient) ImportCertificate(vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (result CertificateBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: certificateName, + Constraints: []validation.Constraint{{Target: "certificateName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Base64EncodedCertificate", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.CertificatePolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.CertificatePolicy.X509CertificateProperties.ValidityInMonths", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "ImportCertificate") + } + + req, err := client.ImportCertificatePreparer(vaultBaseURL, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.ImportCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportCertificate", resp, "Failure sending request") + return + } + + result, err = client.ImportCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportCertificate", resp, "Failure responding to request") + } + + return +} + +// ImportCertificatePreparer prepares the ImportCertificate request. +func (client ManagementClient) ImportCertificatePreparer(vaultBaseURL string, certificateName string, parameters CertificateImportParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/import", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ImportCertificateSender sends the ImportCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ImportCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ImportCertificateResponder handles the response to the ImportCertificate request. The method always +// closes the http.Response Body. +func (client ManagementClient) ImportCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ImportKey the import key operation may be used to import any key type into +// an Azure Key Vault. If the named key already exists, Azure Key Vault creates +// a new version of the key. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is name for the imported key. parameters is the parameters to import +// a key. +func (client ManagementClient) ImportKey(vaultBaseURL string, keyName string, parameters KeyImportParameters) (result KeyBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Key", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "ImportKey") + } + + req, err := client.ImportKeyPreparer(vaultBaseURL, keyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportKey", nil, "Failure preparing request") + return + } + + resp, err := client.ImportKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportKey", resp, "Failure sending request") + return + } + + result, err = client.ImportKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "ImportKey", resp, "Failure responding to request") + } + + return +} + +// ImportKeyPreparer prepares the ImportKey request. +func (client ManagementClient) ImportKeyPreparer(vaultBaseURL string, keyName string, parameters KeyImportParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// ImportKeySender sends the ImportKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) ImportKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// ImportKeyResponder handles the response to the ImportKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) ImportKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// MergeCertificate +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. parameters is the parameters +// to merge certificate. +func (client ManagementClient) MergeCertificate(vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (result CertificateBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.X509Certificates", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "MergeCertificate") + } + + req, err := client.MergeCertificatePreparer(vaultBaseURL, certificateName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "MergeCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.MergeCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "MergeCertificate", resp, "Failure sending request") + return + } + + result, err = client.MergeCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "MergeCertificate", resp, "Failure responding to request") + } + + return +} + +// MergeCertificatePreparer prepares the MergeCertificate request. +func (client ManagementClient) MergeCertificatePreparer(vaultBaseURL string, certificateName string, parameters CertificateMergeParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending/merge", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// MergeCertificateSender sends the MergeCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) MergeCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// MergeCertificateResponder handles the response to the MergeCertificate request. The method always +// closes the http.Response Body. +func (client ManagementClient) MergeCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreKey imports a previously backed up key into Azure Key Vault, +// restoring the key, its key identifier, attributes and access control +// policies. The RESTORE operation may be used to import a previously backed up +// key. Individual versions of a key cannot be restored. The key is restored in +// its entirety with the same key name as it had when it was backed up. If the +// key name is not available in the target Key Vault, the RESTORE operation +// will be rejected. While the key name is retained during restore, the final +// key identifier will change if the key is restored to a different vault. +// Restore will restore all versions and preserve version identifiers. The +// RESTORE operation is subject to security constraints: The target Key Vault +// must be owned by the same Microsoft Azure Subscription as the source Key +// Vault The user must have RESTORE permission in the target Key Vault. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// parameters is the parameters to restore the key. +func (client ManagementClient) RestoreKey(vaultBaseURL string, parameters KeyRestoreParameters) (result KeyBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.KeyBundleBackup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "RestoreKey") + } + + req, err := client.RestoreKeyPreparer(vaultBaseURL, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "RestoreKey", nil, "Failure preparing request") + return + } + + resp, err := client.RestoreKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "RestoreKey", resp, "Failure sending request") + return + } + + result, err = client.RestoreKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "RestoreKey", resp, "Failure responding to request") + } + + return +} + +// RestoreKeyPreparer prepares the RestoreKey request. +func (client ManagementClient) RestoreKeyPreparer(vaultBaseURL string, parameters KeyRestoreParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/keys/restore"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// RestoreKeySender sends the RestoreKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) RestoreKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// RestoreKeyResponder handles the response to the RestoreKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) RestoreKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetCertificateContacts +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// contacts is the contacts for the key vault certificate. +func (client ManagementClient) SetCertificateContacts(vaultBaseURL string, contacts Contacts) (result Contacts, err error) { + req, err := client.SetCertificateContactsPreparer(vaultBaseURL, contacts) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateContacts", nil, "Failure preparing request") + return + } + + resp, err := client.SetCertificateContactsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateContacts", resp, "Failure sending request") + return + } + + result, err = client.SetCertificateContactsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateContacts", resp, "Failure responding to request") + } + + return +} + +// SetCertificateContactsPreparer prepares the SetCertificateContacts request. +func (client ManagementClient) SetCertificateContactsPreparer(vaultBaseURL string, contacts Contacts) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPath("/certificates/contacts"), + autorest.WithJSON(contacts), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetCertificateContactsSender sends the SetCertificateContacts request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) SetCertificateContactsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetCertificateContactsResponder handles the response to the SetCertificateContacts request. The method always +// closes the http.Response Body. +func (client ManagementClient) SetCertificateContactsResponder(resp *http.Response) (result Contacts, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetCertificateIssuer +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// issuerName is the name of the issuer. parameter is certificate issuer set +// parameter. +func (client ManagementClient) SetCertificateIssuer(vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (result IssuerBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameter, + Constraints: []validation.Constraint{{Target: "parameter.Provider", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "SetCertificateIssuer") + } + + req, err := client.SetCertificateIssuerPreparer(vaultBaseURL, issuerName, parameter) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.SetCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.SetCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// SetCertificateIssuerPreparer prepares the SetCertificateIssuer request. +func (client ManagementClient) SetCertificateIssuerPreparer(vaultBaseURL string, issuerName string, parameter CertificateIssuerSetParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithJSON(parameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetCertificateIssuerSender sends the SetCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) SetCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetCertificateIssuerResponder handles the response to the SetCertificateIssuer request. The method always +// closes the http.Response Body. +func (client ManagementClient) SetCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetSecret the SET operation adds a secret to the Azure Key Vault. If the +// named secret already exists, Azure Key Vault creates a new version of that +// secret. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// secretName is the name of the secret. parameters is the parameters for +// setting the secret. +func (client ManagementClient) SetSecret(vaultBaseURL string, secretName string, parameters SecretSetParameters) (result SecretBundle, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: secretName, + Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z-]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "SetSecret") + } + + req, err := client.SetSecretPreparer(vaultBaseURL, secretName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetSecret", nil, "Failure preparing request") + return + } + + resp, err := client.SetSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetSecret", resp, "Failure sending request") + return + } + + result, err = client.SetSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "SetSecret", resp, "Failure responding to request") + } + + return +} + +// SetSecretPreparer prepares the SetSecret request. +func (client ManagementClient) SetSecretPreparer(vaultBaseURL string, secretName string, parameters SecretSetParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SetSecretSender sends the SetSecret request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) SetSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SetSecretResponder handles the response to the SetSecret request. The method always +// closes the http.Response Body. +func (client ManagementClient) SetSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Sign the SIGN operation is applicable to asymmetric and symmetric keys +// stored in Azure Key Vault since this operation uses the private portion of +// the key. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. keyVersion is the version of the key. +// parameters is the parameters for the signing operation. +func (client ManagementClient) Sign(vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Sign") + } + + req, err := client.SignPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Sign", nil, "Failure preparing request") + return + } + + resp, err := client.SignSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Sign", resp, "Failure sending request") + return + } + + result, err = client.SignResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Sign", resp, "Failure responding to request") + } + + return +} + +// SignPreparer prepares the Sign request. +func (client ManagementClient) SignPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeySignParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/sign", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// SignSender sends the Sign request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) SignSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// SignResponder handles the response to the Sign request. The method always +// closes the http.Response Body. +func (client ManagementClient) SignResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UnwrapKey the UNWRAP operation supports decryption of a symmetric key using +// the target key encryption key. This operation is the reverse of the WRAP +// operation. The UNWRAP operation applies to asymmetric and symmetric keys +// stored in Azure Key Vault since it uses the private portion of the key. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. keyVersion is the version of the key. +// parameters is the parameters for the key operation. +func (client ManagementClient) UnwrapKey(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "UnwrapKey") + } + + req, err := client.UnwrapKeyPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UnwrapKey", nil, "Failure preparing request") + return + } + + resp, err := client.UnwrapKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UnwrapKey", resp, "Failure sending request") + return + } + + result, err = client.UnwrapKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UnwrapKey", resp, "Failure responding to request") + } + + return +} + +// UnwrapKeyPreparer prepares the UnwrapKey request. +func (client ManagementClient) UnwrapKeyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/unwrapkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UnwrapKeySender sends the UnwrapKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UnwrapKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UnwrapKeyResponder handles the response to the UnwrapKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) UnwrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificate +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate in the given key vault. +// certificateVersion is the version of the certificate. parameters is the +// parameters for certificate update. +func (client ManagementClient) UpdateCertificate(vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (result CertificateBundle, err error) { + req, err := client.UpdateCertificatePreparer(vaultBaseURL, certificateName, certificateVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificate", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificate", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificatePreparer prepares the UpdateCertificate request. +func (client ManagementClient) UpdateCertificatePreparer(vaultBaseURL string, certificateName string, certificateVersion string, parameters CertificateUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + "certificate-version": autorest.Encode("path", certificateVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/{certificate-version}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateCertificateSender sends the UpdateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateCertificateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateCertificateResponder handles the response to the UpdateCertificate request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateCertificateResponder(resp *http.Response) (result CertificateBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificateIssuer +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// issuerName is the name of the issuer. parameter is certificate issuer update +// parameter. +func (client ManagementClient) UpdateCertificateIssuer(vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (result IssuerBundle, err error) { + req, err := client.UpdateCertificateIssuerPreparer(vaultBaseURL, issuerName, parameter) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateIssuer", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateIssuerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateIssuer", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateIssuerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateIssuer", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificateIssuerPreparer prepares the UpdateCertificateIssuer request. +func (client ManagementClient) UpdateCertificateIssuerPreparer(vaultBaseURL string, issuerName string, parameter CertificateIssuerUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "issuer-name": autorest.Encode("path", issuerName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/issuers/{issuer-name}", pathParameters), + autorest.WithJSON(parameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateCertificateIssuerSender sends the UpdateCertificateIssuer request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateCertificateIssuerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateCertificateIssuerResponder handles the response to the UpdateCertificateIssuer request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateCertificateIssuerResponder(resp *http.Response) (result IssuerBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificateOperation +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate. certificateOperation is the +// certificate operation response. +func (client ManagementClient) UpdateCertificateOperation(vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (result CertificateOperation, err error) { + req, err := client.UpdateCertificateOperationPreparer(vaultBaseURL, certificateName, certificateOperation) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateOperation", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificateOperationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateOperation", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificateOperationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificateOperation", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificateOperationPreparer prepares the UpdateCertificateOperation request. +func (client ManagementClient) UpdateCertificateOperationPreparer(vaultBaseURL string, certificateName string, certificateOperation CertificateOperationUpdateParameter) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/pending", pathParameters), + autorest.WithJSON(certificateOperation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateCertificateOperationSender sends the UpdateCertificateOperation request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateCertificateOperationSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateCertificateOperationResponder handles the response to the UpdateCertificateOperation request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateCertificateOperationResponder(resp *http.Response) (result CertificateOperation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateCertificatePolicy set specified members in the certificate policy. +// Leave others as null. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// certificateName is the name of the certificate in the given vault. +// certificatePolicy is the policy for the certificate. +func (client ManagementClient) UpdateCertificatePolicy(vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (result CertificatePolicy, err error) { + req, err := client.UpdateCertificatePolicyPreparer(vaultBaseURL, certificateName, certificatePolicy) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificatePolicy", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateCertificatePolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificatePolicy", resp, "Failure sending request") + return + } + + result, err = client.UpdateCertificatePolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateCertificatePolicy", resp, "Failure responding to request") + } + + return +} + +// UpdateCertificatePolicyPreparer prepares the UpdateCertificatePolicy request. +func (client ManagementClient) UpdateCertificatePolicyPreparer(vaultBaseURL string, certificateName string, certificatePolicy CertificatePolicy) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "certificate-name": autorest.Encode("path", certificateName), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/certificates/{certificate-name}/policy", pathParameters), + autorest.WithJSON(certificatePolicy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateCertificatePolicySender sends the UpdateCertificatePolicy request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateCertificatePolicySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateCertificatePolicyResponder handles the response to the UpdateCertificatePolicy request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateCertificatePolicyResponder(resp *http.Response) (result CertificatePolicy, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateKey in order to perform this operation, the key must already exist in +// the Key Vault. Note: The cryptographic material of a key itself cannot be +// changed. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of key to update. keyVersion is the version of the key +// to update. parameters is the parameters of the key to update. +func (client ManagementClient) UpdateKey(vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (result KeyBundle, err error) { + req, err := client.UpdateKeyPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateKey", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateKey", resp, "Failure sending request") + return + } + + result, err = client.UpdateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateKey", resp, "Failure responding to request") + } + + return +} + +// UpdateKeyPreparer prepares the UpdateKey request. +func (client ManagementClient) UpdateKeyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateKeySender sends the UpdateKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateKeyResponder handles the response to the UpdateKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateKeyResponder(resp *http.Response) (result KeyBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSecret the UPDATE operation changes specified attributes of an +// existing stored secret. Attributes that are not specified in the request are +// left unchanged. The value of a secret itself cannot be changed. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// secretName is the name of the secret. secretVersion is the version of the +// secret. parameters is the parameters for update secret operation. +func (client ManagementClient) UpdateSecret(vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (result SecretBundle, err error) { + req, err := client.UpdateSecretPreparer(vaultBaseURL, secretName, secretVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateSecret", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSecretSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateSecret", resp, "Failure sending request") + return + } + + result, err = client.UpdateSecretResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "UpdateSecret", resp, "Failure responding to request") + } + + return +} + +// UpdateSecretPreparer prepares the UpdateSecret request. +func (client ManagementClient) UpdateSecretPreparer(vaultBaseURL string, secretName string, secretVersion string, parameters SecretUpdateParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "secret-name": autorest.Encode("path", secretName), + "secret-version": autorest.Encode("path", secretVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/secrets/{secret-name}/{secret-version}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// UpdateSecretSender sends the UpdateSecret request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) UpdateSecretSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// UpdateSecretResponder handles the response to the UpdateSecret request. The method always +// closes the http.Response Body. +func (client ManagementClient) UpdateSecretResponder(resp *http.Response) (result SecretBundle, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Verify the VERIFY operation is applicable to symmetric keys stored in Azure +// Key Vault. VERIFY is not strictly necessary for asymmetric keys stored in +// Azure Key Vault since signature verification can be performed using the +// public portion of the key but this operation is supported as a convenience +// for callers that only have a key-reference and not the public portion of the +// key. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. keyVersion is the version of the key. +// parameters is the parameters for verify operations. +func (client ManagementClient) Verify(vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (result KeyVerifyResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Digest", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Signature", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "Verify") + } + + req, err := client.VerifyPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Verify", nil, "Failure preparing request") + return + } + + resp, err := client.VerifySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Verify", resp, "Failure sending request") + return + } + + result, err = client.VerifyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "Verify", resp, "Failure responding to request") + } + + return +} + +// VerifyPreparer prepares the Verify request. +func (client ManagementClient) VerifyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyVerifyParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/verify", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// VerifySender sends the Verify request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) VerifySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// VerifyResponder handles the response to the Verify request. The method always +// closes the http.Response Body. +func (client ManagementClient) VerifyResponder(resp *http.Response) (result KeyVerifyResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// WrapKey the WRAP operation supports encryption of a symmetric key using a +// key encryption key that has previously been stored in an Azure Key Vault. +// The WRAP operation is only strictly necessary for symmetric keys stored in +// Azure Key Vault since protection with an asymmetric key can be performed +// using the public portion of the key. This operation is supported for +// asymmetric keys as a convenience for callers that have a key-reference but +// do not have access to the public key material. +// +// vaultBaseURL is the vault name, for example https://myvault.vault.azure.net. +// keyName is the name of the key. keyVersion is the version of the key. +// parameters is the parameters for wrap operation. +func (client ManagementClient) WrapKey(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (result KeyOperationResult, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewErrorWithValidationError(err, "keyvault.ManagementClient", "WrapKey") + } + + req, err := client.WrapKeyPreparer(vaultBaseURL, keyName, keyVersion, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "WrapKey", nil, "Failure preparing request") + return + } + + resp, err := client.WrapKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "WrapKey", resp, "Failure sending request") + return + } + + result, err = client.WrapKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagementClient", "WrapKey", resp, "Failure responding to request") + } + + return +} + +// WrapKeyPreparer prepares the WrapKey request. +func (client ManagementClient) WrapKeyPreparer(vaultBaseURL string, keyName string, keyVersion string, parameters KeyOperationsParameters) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "vaultBaseUrl": vaultBaseURL, + } + + pathParameters := map[string]interface{}{ + "key-name": autorest.Encode("path", keyName), + "key-version": autorest.Encode("path", keyVersion), + } + + const APIVersion = "2016-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithCustomBaseURL("{vaultBaseUrl}", urlParameters), + autorest.WithPathParameters("/keys/{key-name}/{key-version}/wrapkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare(&http.Request{}) +} + +// WrapKeySender sends the WrapKey request. The method will close the +// http.Response Body if it receives an error. +func (client ManagementClient) WrapKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req) +} + +// WrapKeyResponder handles the response to the WrapKey request. The method always +// closes the http.Response Body. +func (client ManagementClient) WrapKeyResponder(resp *http.Response) (result KeyOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/models.go b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/models.go index 8268333a9b..8422462275 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/models.go @@ -1,608 +1,608 @@ -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "net/http" -) - -// ActionType enumerates the values for action type. -type ActionType string - -const ( - // AutoRenew specifies the auto renew state for action type. - AutoRenew ActionType = "AutoRenew" - // EmailContacts specifies the email contacts state for action type. - EmailContacts ActionType = "EmailContacts" -) - -// JSONWebKeyEncryptionAlgorithm enumerates the values for json web key -// encryption algorithm. -type JSONWebKeyEncryptionAlgorithm string - -const ( - // RSA15 specifies the rsa15 state for json web key encryption algorithm. - RSA15 JSONWebKeyEncryptionAlgorithm = "RSA1_5" - // RSAOAEP specifies the rsaoaep state for json web key encryption - // algorithm. - RSAOAEP JSONWebKeyEncryptionAlgorithm = "RSA-OAEP" -) - -// JSONWebKeyOperation enumerates the values for json web key operation. -type JSONWebKeyOperation string - -const ( - // Decrypt specifies the decrypt state for json web key operation. - Decrypt JSONWebKeyOperation = "decrypt" - // Encrypt specifies the encrypt state for json web key operation. - Encrypt JSONWebKeyOperation = "encrypt" - // Sign specifies the sign state for json web key operation. - Sign JSONWebKeyOperation = "sign" - // UnwrapKey specifies the unwrap key state for json web key operation. - UnwrapKey JSONWebKeyOperation = "unwrapKey" - // Verify specifies the verify state for json web key operation. - Verify JSONWebKeyOperation = "verify" - // WrapKey specifies the wrap key state for json web key operation. - WrapKey JSONWebKeyOperation = "wrapKey" -) - -// JSONWebKeySignatureAlgorithm enumerates the values for json web key -// signature algorithm. -type JSONWebKeySignatureAlgorithm string - -const ( - // RS256 specifies the rs256 state for json web key signature algorithm. - RS256 JSONWebKeySignatureAlgorithm = "RS256" - // RS384 specifies the rs384 state for json web key signature algorithm. - RS384 JSONWebKeySignatureAlgorithm = "RS384" - // RS512 specifies the rs512 state for json web key signature algorithm. - RS512 JSONWebKeySignatureAlgorithm = "RS512" - // RSNULL specifies the rsnull state for json web key signature algorithm. - RSNULL JSONWebKeySignatureAlgorithm = "RSNULL" -) - -// JSONWebKeyType enumerates the values for json web key type. -type JSONWebKeyType string - -const ( - // EC specifies the ec state for json web key type. - EC JSONWebKeyType = "EC" - // Oct specifies the oct state for json web key type. - Oct JSONWebKeyType = "oct" - // RSA specifies the rsa state for json web key type. - RSA JSONWebKeyType = "RSA" - // RSAHSM specifies the rsahsm state for json web key type. - RSAHSM JSONWebKeyType = "RSA-HSM" -) - -// KeyUsageType enumerates the values for key usage type. -type KeyUsageType string - -const ( - // CRLSign specifies the crl sign state for key usage type. - CRLSign KeyUsageType = "cRLSign" - // DataEncipherment specifies the data encipherment state for key usage - // type. - DataEncipherment KeyUsageType = "dataEncipherment" - // DecipherOnly specifies the decipher only state for key usage type. - DecipherOnly KeyUsageType = "decipherOnly" - // DigitalSignature specifies the digital signature state for key usage - // type. - DigitalSignature KeyUsageType = "digitalSignature" - // EncipherOnly specifies the encipher only state for key usage type. - EncipherOnly KeyUsageType = "encipherOnly" - // KeyAgreement specifies the key agreement state for key usage type. - KeyAgreement KeyUsageType = "keyAgreement" - // KeyCertSign specifies the key cert sign state for key usage type. - KeyCertSign KeyUsageType = "keyCertSign" - // KeyEncipherment specifies the key encipherment state for key usage type. - KeyEncipherment KeyUsageType = "keyEncipherment" - // NonRepudiation specifies the non repudiation state for key usage type. - NonRepudiation KeyUsageType = "nonRepudiation" -) - -// Action is the action that will be executed. -type Action struct { - ActionType ActionType `json:"action_type,omitempty"` -} - -// AdministratorDetails is details of the organization administrator of the -// certificate issuer. -type AdministratorDetails struct { - FirstName *string `json:"first_name,omitempty"` - LastName *string `json:"last_name,omitempty"` - EmailAddress *string `json:"email,omitempty"` - Phone *string `json:"phone,omitempty"` -} - -// Attributes is the object attributes managed by the KeyVault service. -type Attributes struct { - Enabled *bool `json:"enabled,omitempty"` - NotBefore *date.UnixTime `json:"nbf,omitempty"` - Expires *date.UnixTime `json:"exp,omitempty"` - Created *date.UnixTime `json:"created,omitempty"` - Updated *date.UnixTime `json:"updated,omitempty"` -} - -// BackupKeyResult is the backup key result, containing the backup blob. -type BackupKeyResult struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// CertificateAttributes is the certificate management attributes. -type CertificateAttributes struct { - Enabled *bool `json:"enabled,omitempty"` - NotBefore *date.UnixTime `json:"nbf,omitempty"` - Expires *date.UnixTime `json:"exp,omitempty"` - Created *date.UnixTime `json:"created,omitempty"` - Updated *date.UnixTime `json:"updated,omitempty"` -} - -// CertificateBundle is a certificate bundle consists of a certificate (X509) -// plus its attributes. -type CertificateBundle struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Kid *string `json:"kid,omitempty"` - Sid *string `json:"sid,omitempty"` - X509Thumbprint *string `json:"x5t,omitempty"` - Policy *CertificatePolicy `json:"policy,omitempty"` - Cer *[]byte `json:"cer,omitempty"` - ContentType *string `json:"contentType,omitempty"` - Attributes *CertificateAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// CertificateCreateParameters is the certificate create parameters. -type CertificateCreateParameters struct { - CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` - CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// CertificateImportParameters is the certificate import parameters. -type CertificateImportParameters struct { - Base64EncodedCertificate *string `json:"value,omitempty"` - Password *string `json:"pwd,omitempty"` - CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` - CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// CertificateIssuerItem is the certificate issuer item containing certificate -// issuer metadata. -type CertificateIssuerItem struct { - ID *string `json:"id,omitempty"` - Provider *string `json:"provider,omitempty"` -} - -// CertificateIssuerListResult is the certificate issuer list result. -type CertificateIssuerListResult struct { - autorest.Response `json:"-"` - Value *[]CertificateIssuerItem `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateIssuerListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateIssuerListResult) CertificateIssuerListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CertificateIssuerSetParameters is the certificate issuer set parameters. -type CertificateIssuerSetParameters struct { - Provider *string `json:"provider,omitempty"` - Credentials *IssuerCredentials `json:"credentials,omitempty"` - OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` - Attributes *IssuerAttributes `json:"attributes,omitempty"` -} - -// CertificateIssuerUpdateParameters is the certificate issuer update -// parameters. -type CertificateIssuerUpdateParameters struct { - Provider *string `json:"provider,omitempty"` - Credentials *IssuerCredentials `json:"credentials,omitempty"` - OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` - Attributes *IssuerAttributes `json:"attributes,omitempty"` -} - -// CertificateItem is the certificate item containing certificate metadata. -type CertificateItem struct { - ID *string `json:"id,omitempty"` - Attributes *CertificateAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - X509Thumbprint *string `json:"x5t,omitempty"` -} - -// CertificateListResult is the certificate list result. -type CertificateListResult struct { - autorest.Response `json:"-"` - Value *[]CertificateItem `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client CertificateListResult) CertificateListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// CertificateMergeParameters is the certificate merge parameters -type CertificateMergeParameters struct { - X509Certificates *[][]byte `json:"x5c,omitempty"` - CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// CertificateOperation is a certificate operation is returned in case of -// asynchronous requests. -type CertificateOperation struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - IssuerParameters *IssuerParameters `json:"issuer,omitempty"` - Csr *[]byte `json:"csr,omitempty"` - CancellationRequested *bool `json:"cancellation_requested,omitempty"` - Status *string `json:"status,omitempty"` - StatusDetails *string `json:"status_details,omitempty"` - Error *Error `json:"error,omitempty"` - Target *string `json:"target,omitempty"` - RequestID *string `json:"request_id,omitempty"` -} - -// CertificateOperationUpdateParameter is the certificate operation update -// parameters. -type CertificateOperationUpdateParameter struct { - CancellationRequested *bool `json:"cancellation_requested,omitempty"` -} - -// CertificatePolicy is management policy for a certificate. -type CertificatePolicy struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - KeyProperties *KeyProperties `json:"key_props,omitempty"` - SecretProperties *SecretProperties `json:"secret_props,omitempty"` - X509CertificateProperties *X509CertificateProperties `json:"x509_props,omitempty"` - LifetimeActions *[]LifetimeAction `json:"lifetime_actions,omitempty"` - IssuerParameters *IssuerParameters `json:"issuer,omitempty"` - Attributes *CertificateAttributes `json:"attributes,omitempty"` -} - -// CertificateUpdateParameters is the certificate update parameters. -type CertificateUpdateParameters struct { - CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` - CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// Contact is the contact information for the vault certificates. -type Contact struct { - EmailAddress *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` - Phone *string `json:"phone,omitempty"` -} - -// Contacts is the contacts for the vault certificates. -type Contacts struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - ContactList *[]Contact `json:"contacts,omitempty"` -} - -// Error is the key vault server error. -type Error struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - InnerError *Error `json:"innererror,omitempty"` -} - -// ErrorType is the key vault error exception. -type ErrorType struct { - Error *Error `json:"error,omitempty"` -} - -// IssuerAttributes is the attributes of an issuer managed by the Key Vault -// service. -type IssuerAttributes struct { - Enabled *bool `json:"enabled,omitempty"` - Created *date.UnixTime `json:"created,omitempty"` - Updated *date.UnixTime `json:"updated,omitempty"` -} - -// IssuerBundle is the issuer for Key Vault certificate. -type IssuerBundle struct { - autorest.Response `json:"-"` - ID *string `json:"id,omitempty"` - Provider *string `json:"provider,omitempty"` - Credentials *IssuerCredentials `json:"credentials,omitempty"` - OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` - Attributes *IssuerAttributes `json:"attributes,omitempty"` -} - -// IssuerCredentials is the credentials to be used for the certificate issuer. -type IssuerCredentials struct { - AccountID *string `json:"account_id,omitempty"` - Password *string `json:"pwd,omitempty"` -} - -// IssuerParameters is parameters for the issuer of the X509 component of a -// certificate. -type IssuerParameters struct { - Name *string `json:"name,omitempty"` - CertificateType *string `json:"cty,omitempty"` -} - -// JSONWebKey is as of -// http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 -type JSONWebKey struct { - Kid *string `json:"kid,omitempty"` - Kty JSONWebKeyType `json:"kty,omitempty"` - KeyOps *[]string `json:"key_ops,omitempty"` - N *string `json:"n,omitempty"` - E *string `json:"e,omitempty"` - D *string `json:"d,omitempty"` - DP *string `json:"dp,omitempty"` - DQ *string `json:"dq,omitempty"` - QI *string `json:"qi,omitempty"` - P *string `json:"p,omitempty"` - Q *string `json:"q,omitempty"` - K *string `json:"k,omitempty"` - T *string `json:"key_hsm,omitempty"` -} - -// KeyAttributes is the attributes of a key managed by the key vault service. -type KeyAttributes struct { - Enabled *bool `json:"enabled,omitempty"` - NotBefore *date.UnixTime `json:"nbf,omitempty"` - Expires *date.UnixTime `json:"exp,omitempty"` - Created *date.UnixTime `json:"created,omitempty"` - Updated *date.UnixTime `json:"updated,omitempty"` -} - -// KeyBundle is a KeyBundle consisting of a WebKey plus its attributes. -type KeyBundle struct { - autorest.Response `json:"-"` - Key *JSONWebKey `json:"key,omitempty"` - Attributes *KeyAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Managed *bool `json:"managed,omitempty"` -} - -// KeyCreateParameters is the key create parameters. -type KeyCreateParameters struct { - Kty JSONWebKeyType `json:"kty,omitempty"` - KeySize *int32 `json:"key_size,omitempty"` - KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` - KeyAttributes *KeyAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// KeyImportParameters is the key import parameters. -type KeyImportParameters struct { - Hsm *bool `json:"Hsm,omitempty"` - Key *JSONWebKey `json:"key,omitempty"` - KeyAttributes *KeyAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// KeyItem is the key item containing key metadata. -type KeyItem struct { - Kid *string `json:"kid,omitempty"` - Attributes *KeyAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Managed *bool `json:"managed,omitempty"` -} - -// KeyListResult is the key list result. -type KeyListResult struct { - autorest.Response `json:"-"` - Value *[]KeyItem `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// KeyListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client KeyListResult) KeyListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// KeyOperationResult is the key operation result. -type KeyOperationResult struct { - autorest.Response `json:"-"` - Kid *string `json:"kid,omitempty"` - Result *string `json:"value,omitempty"` -} - -// KeyOperationsParameters is the key operations parameters. -type KeyOperationsParameters struct { - Algorithm JSONWebKeyEncryptionAlgorithm `json:"alg,omitempty"` - Value *string `json:"value,omitempty"` -} - -// KeyProperties is properties of the key pair backing a certificate. -type KeyProperties struct { - Exportable *bool `json:"exportable,omitempty"` - KeyType *string `json:"kty,omitempty"` - KeySize *int32 `json:"key_size,omitempty"` - ReuseKey *bool `json:"reuse_key,omitempty"` -} - -// KeyRestoreParameters is the key restore parameters. -type KeyRestoreParameters struct { - KeyBundleBackup *string `json:"value,omitempty"` -} - -// KeySignParameters is the key operations parameters. -type KeySignParameters struct { - Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` - Value *string `json:"value,omitempty"` -} - -// KeyUpdateParameters is the key update parameters. -type KeyUpdateParameters struct { - KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` - KeyAttributes *KeyAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// KeyVerifyParameters is the key verify parameters. -type KeyVerifyParameters struct { - Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` - Digest *string `json:"digest,omitempty"` - Signature *string `json:"value,omitempty"` -} - -// KeyVerifyResult is the key verify result. -type KeyVerifyResult struct { - autorest.Response `json:"-"` - Value *bool `json:"value,omitempty"` -} - -// LifetimeAction is action and its trigger that will be performed by Key Vault -// over the lifetime of a certificate. -type LifetimeAction struct { - Trigger *Trigger `json:"trigger,omitempty"` - Action *Action `json:"action,omitempty"` -} - -// OrganizationDetails is details of the organization of the certificate -// issuer. -type OrganizationDetails struct { - ID *string `json:"id,omitempty"` - AdminDetails *[]AdministratorDetails `json:"admin_details,omitempty"` -} - -// PendingCertificateSigningRequestResult is the pending certificate signing -// request result. -type PendingCertificateSigningRequestResult struct { - Value *string `json:"value,omitempty"` -} - -// SecretAttributes is the secret management attributes. -type SecretAttributes struct { - Enabled *bool `json:"enabled,omitempty"` - NotBefore *date.UnixTime `json:"nbf,omitempty"` - Expires *date.UnixTime `json:"exp,omitempty"` - Created *date.UnixTime `json:"created,omitempty"` - Updated *date.UnixTime `json:"updated,omitempty"` -} - -// SecretBundle is a secret consisting of a value, id and its attributes. -type SecretBundle struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` - ID *string `json:"id,omitempty"` - ContentType *string `json:"contentType,omitempty"` - Attributes *SecretAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - Kid *string `json:"kid,omitempty"` - Managed *bool `json:"managed,omitempty"` -} - -// SecretItem is the secret item containing secret metadata. -type SecretItem struct { - ID *string `json:"id,omitempty"` - Attributes *SecretAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ContentType *string `json:"contentType,omitempty"` - Managed *bool `json:"managed,omitempty"` -} - -// SecretListResult is the secret list result. -type SecretListResult struct { - autorest.Response `json:"-"` - Value *[]SecretItem `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// SecretListResultPreparer prepares a request to retrieve the next set of results. It returns -// nil if no more results exist. -func (client SecretListResult) SecretListResultPreparer() (*http.Request, error) { - if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(client.NextLink))) -} - -// SecretProperties is properties of the key backing a certificate. -type SecretProperties struct { - ContentType *string `json:"contentType,omitempty"` -} - -// SecretSetParameters is the secret set parameters. -type SecretSetParameters struct { - Value *string `json:"value,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` - ContentType *string `json:"contentType,omitempty"` - SecretAttributes *SecretAttributes `json:"attributes,omitempty"` -} - -// SecretUpdateParameters is the secret update parameters. -type SecretUpdateParameters struct { - ContentType *string `json:"contentType,omitempty"` - SecretAttributes *SecretAttributes `json:"attributes,omitempty"` - Tags *map[string]*string `json:"tags,omitempty"` -} - -// SubjectAlternativeNames is the subject alternate names of a X509 object. -type SubjectAlternativeNames struct { - Emails *[]string `json:"emails,omitempty"` - DNSNames *[]string `json:"dns_names,omitempty"` - Upns *[]string `json:"upns,omitempty"` -} - -// Trigger is a condition to be satisfied for an action to be executed. -type Trigger struct { - LifetimePercentage *int32 `json:"lifetime_percentage,omitempty"` - DaysBeforeExpiry *int32 `json:"days_before_expiry,omitempty"` -} - -// X509CertificateProperties is properties of the X509 component of a -// certificate. -type X509CertificateProperties struct { - Subject *string `json:"subject,omitempty"` - Ekus *[]string `json:"ekus,omitempty"` - SubjectAlternativeNames *SubjectAlternativeNames `json:"sans,omitempty"` - KeyUsage *[]KeyUsageType `json:"key_usage,omitempty"` - ValidityInMonths *int32 `json:"validity_months,omitempty"` -} +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // AutoRenew specifies the auto renew state for action type. + AutoRenew ActionType = "AutoRenew" + // EmailContacts specifies the email contacts state for action type. + EmailContacts ActionType = "EmailContacts" +) + +// JSONWebKeyEncryptionAlgorithm enumerates the values for json web key +// encryption algorithm. +type JSONWebKeyEncryptionAlgorithm string + +const ( + // RSA15 specifies the rsa15 state for json web key encryption algorithm. + RSA15 JSONWebKeyEncryptionAlgorithm = "RSA1_5" + // RSAOAEP specifies the rsaoaep state for json web key encryption + // algorithm. + RSAOAEP JSONWebKeyEncryptionAlgorithm = "RSA-OAEP" +) + +// JSONWebKeyOperation enumerates the values for json web key operation. +type JSONWebKeyOperation string + +const ( + // Decrypt specifies the decrypt state for json web key operation. + Decrypt JSONWebKeyOperation = "decrypt" + // Encrypt specifies the encrypt state for json web key operation. + Encrypt JSONWebKeyOperation = "encrypt" + // Sign specifies the sign state for json web key operation. + Sign JSONWebKeyOperation = "sign" + // UnwrapKey specifies the unwrap key state for json web key operation. + UnwrapKey JSONWebKeyOperation = "unwrapKey" + // Verify specifies the verify state for json web key operation. + Verify JSONWebKeyOperation = "verify" + // WrapKey specifies the wrap key state for json web key operation. + WrapKey JSONWebKeyOperation = "wrapKey" +) + +// JSONWebKeySignatureAlgorithm enumerates the values for json web key +// signature algorithm. +type JSONWebKeySignatureAlgorithm string + +const ( + // RS256 specifies the rs256 state for json web key signature algorithm. + RS256 JSONWebKeySignatureAlgorithm = "RS256" + // RS384 specifies the rs384 state for json web key signature algorithm. + RS384 JSONWebKeySignatureAlgorithm = "RS384" + // RS512 specifies the rs512 state for json web key signature algorithm. + RS512 JSONWebKeySignatureAlgorithm = "RS512" + // RSNULL specifies the rsnull state for json web key signature algorithm. + RSNULL JSONWebKeySignatureAlgorithm = "RSNULL" +) + +// JSONWebKeyType enumerates the values for json web key type. +type JSONWebKeyType string + +const ( + // EC specifies the ec state for json web key type. + EC JSONWebKeyType = "EC" + // Oct specifies the oct state for json web key type. + Oct JSONWebKeyType = "oct" + // RSA specifies the rsa state for json web key type. + RSA JSONWebKeyType = "RSA" + // RSAHSM specifies the rsahsm state for json web key type. + RSAHSM JSONWebKeyType = "RSA-HSM" +) + +// KeyUsageType enumerates the values for key usage type. +type KeyUsageType string + +const ( + // CRLSign specifies the crl sign state for key usage type. + CRLSign KeyUsageType = "cRLSign" + // DataEncipherment specifies the data encipherment state for key usage + // type. + DataEncipherment KeyUsageType = "dataEncipherment" + // DecipherOnly specifies the decipher only state for key usage type. + DecipherOnly KeyUsageType = "decipherOnly" + // DigitalSignature specifies the digital signature state for key usage + // type. + DigitalSignature KeyUsageType = "digitalSignature" + // EncipherOnly specifies the encipher only state for key usage type. + EncipherOnly KeyUsageType = "encipherOnly" + // KeyAgreement specifies the key agreement state for key usage type. + KeyAgreement KeyUsageType = "keyAgreement" + // KeyCertSign specifies the key cert sign state for key usage type. + KeyCertSign KeyUsageType = "keyCertSign" + // KeyEncipherment specifies the key encipherment state for key usage type. + KeyEncipherment KeyUsageType = "keyEncipherment" + // NonRepudiation specifies the non repudiation state for key usage type. + NonRepudiation KeyUsageType = "nonRepudiation" +) + +// Action is the action that will be executed. +type Action struct { + ActionType ActionType `json:"action_type,omitempty"` +} + +// AdministratorDetails is details of the organization administrator of the +// certificate issuer. +type AdministratorDetails struct { + FirstName *string `json:"first_name,omitempty"` + LastName *string `json:"last_name,omitempty"` + EmailAddress *string `json:"email,omitempty"` + Phone *string `json:"phone,omitempty"` +} + +// Attributes is the object attributes managed by the KeyVault service. +type Attributes struct { + Enabled *bool `json:"enabled,omitempty"` + NotBefore *date.UnixTime `json:"nbf,omitempty"` + Expires *date.UnixTime `json:"exp,omitempty"` + Created *date.UnixTime `json:"created,omitempty"` + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// BackupKeyResult is the backup key result, containing the backup blob. +type BackupKeyResult struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// CertificateAttributes is the certificate management attributes. +type CertificateAttributes struct { + Enabled *bool `json:"enabled,omitempty"` + NotBefore *date.UnixTime `json:"nbf,omitempty"` + Expires *date.UnixTime `json:"exp,omitempty"` + Created *date.UnixTime `json:"created,omitempty"` + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// CertificateBundle is a certificate bundle consists of a certificate (X509) +// plus its attributes. +type CertificateBundle struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Kid *string `json:"kid,omitempty"` + Sid *string `json:"sid,omitempty"` + X509Thumbprint *string `json:"x5t,omitempty"` + Policy *CertificatePolicy `json:"policy,omitempty"` + Cer *[]byte `json:"cer,omitempty"` + ContentType *string `json:"contentType,omitempty"` + Attributes *CertificateAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// CertificateCreateParameters is the certificate create parameters. +type CertificateCreateParameters struct { + CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// CertificateImportParameters is the certificate import parameters. +type CertificateImportParameters struct { + Base64EncodedCertificate *string `json:"value,omitempty"` + Password *string `json:"pwd,omitempty"` + CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// CertificateIssuerItem is the certificate issuer item containing certificate +// issuer metadata. +type CertificateIssuerItem struct { + ID *string `json:"id,omitempty"` + Provider *string `json:"provider,omitempty"` +} + +// CertificateIssuerListResult is the certificate issuer list result. +type CertificateIssuerListResult struct { + autorest.Response `json:"-"` + Value *[]CertificateIssuerItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateIssuerListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CertificateIssuerListResult) CertificateIssuerListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CertificateIssuerSetParameters is the certificate issuer set parameters. +type CertificateIssuerSetParameters struct { + Provider *string `json:"provider,omitempty"` + Credentials *IssuerCredentials `json:"credentials,omitempty"` + OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` + Attributes *IssuerAttributes `json:"attributes,omitempty"` +} + +// CertificateIssuerUpdateParameters is the certificate issuer update +// parameters. +type CertificateIssuerUpdateParameters struct { + Provider *string `json:"provider,omitempty"` + Credentials *IssuerCredentials `json:"credentials,omitempty"` + OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` + Attributes *IssuerAttributes `json:"attributes,omitempty"` +} + +// CertificateItem is the certificate item containing certificate metadata. +type CertificateItem struct { + ID *string `json:"id,omitempty"` + Attributes *CertificateAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + X509Thumbprint *string `json:"x5t,omitempty"` +} + +// CertificateListResult is the certificate list result. +type CertificateListResult struct { + autorest.Response `json:"-"` + Value *[]CertificateItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client CertificateListResult) CertificateListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// CertificateMergeParameters is the certificate merge parameters +type CertificateMergeParameters struct { + X509Certificates *[][]byte `json:"x5c,omitempty"` + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// CertificateOperation is a certificate operation is returned in case of +// asynchronous requests. +type CertificateOperation struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + IssuerParameters *IssuerParameters `json:"issuer,omitempty"` + Csr *[]byte `json:"csr,omitempty"` + CancellationRequested *bool `json:"cancellation_requested,omitempty"` + Status *string `json:"status,omitempty"` + StatusDetails *string `json:"status_details,omitempty"` + Error *Error `json:"error,omitempty"` + Target *string `json:"target,omitempty"` + RequestID *string `json:"request_id,omitempty"` +} + +// CertificateOperationUpdateParameter is the certificate operation update +// parameters. +type CertificateOperationUpdateParameter struct { + CancellationRequested *bool `json:"cancellation_requested,omitempty"` +} + +// CertificatePolicy is management policy for a certificate. +type CertificatePolicy struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + KeyProperties *KeyProperties `json:"key_props,omitempty"` + SecretProperties *SecretProperties `json:"secret_props,omitempty"` + X509CertificateProperties *X509CertificateProperties `json:"x509_props,omitempty"` + LifetimeActions *[]LifetimeAction `json:"lifetime_actions,omitempty"` + IssuerParameters *IssuerParameters `json:"issuer,omitempty"` + Attributes *CertificateAttributes `json:"attributes,omitempty"` +} + +// CertificateUpdateParameters is the certificate update parameters. +type CertificateUpdateParameters struct { + CertificatePolicy *CertificatePolicy `json:"policy,omitempty"` + CertificateAttributes *CertificateAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// Contact is the contact information for the vault certificates. +type Contact struct { + EmailAddress *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + Phone *string `json:"phone,omitempty"` +} + +// Contacts is the contacts for the vault certificates. +type Contacts struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + ContactList *[]Contact `json:"contacts,omitempty"` +} + +// Error is the key vault server error. +type Error struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + InnerError *Error `json:"innererror,omitempty"` +} + +// ErrorType is the key vault error exception. +type ErrorType struct { + Error *Error `json:"error,omitempty"` +} + +// IssuerAttributes is the attributes of an issuer managed by the Key Vault +// service. +type IssuerAttributes struct { + Enabled *bool `json:"enabled,omitempty"` + Created *date.UnixTime `json:"created,omitempty"` + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// IssuerBundle is the issuer for Key Vault certificate. +type IssuerBundle struct { + autorest.Response `json:"-"` + ID *string `json:"id,omitempty"` + Provider *string `json:"provider,omitempty"` + Credentials *IssuerCredentials `json:"credentials,omitempty"` + OrganizationDetails *OrganizationDetails `json:"org_details,omitempty"` + Attributes *IssuerAttributes `json:"attributes,omitempty"` +} + +// IssuerCredentials is the credentials to be used for the certificate issuer. +type IssuerCredentials struct { + AccountID *string `json:"account_id,omitempty"` + Password *string `json:"pwd,omitempty"` +} + +// IssuerParameters is parameters for the issuer of the X509 component of a +// certificate. +type IssuerParameters struct { + Name *string `json:"name,omitempty"` + CertificateType *string `json:"cty,omitempty"` +} + +// JSONWebKey is as of +// http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 +type JSONWebKey struct { + Kid *string `json:"kid,omitempty"` + Kty JSONWebKeyType `json:"kty,omitempty"` + KeyOps *[]string `json:"key_ops,omitempty"` + N *string `json:"n,omitempty"` + E *string `json:"e,omitempty"` + D *string `json:"d,omitempty"` + DP *string `json:"dp,omitempty"` + DQ *string `json:"dq,omitempty"` + QI *string `json:"qi,omitempty"` + P *string `json:"p,omitempty"` + Q *string `json:"q,omitempty"` + K *string `json:"k,omitempty"` + T *string `json:"key_hsm,omitempty"` +} + +// KeyAttributes is the attributes of a key managed by the key vault service. +type KeyAttributes struct { + Enabled *bool `json:"enabled,omitempty"` + NotBefore *date.UnixTime `json:"nbf,omitempty"` + Expires *date.UnixTime `json:"exp,omitempty"` + Created *date.UnixTime `json:"created,omitempty"` + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// KeyBundle is a KeyBundle consisting of a WebKey plus its attributes. +type KeyBundle struct { + autorest.Response `json:"-"` + Key *JSONWebKey `json:"key,omitempty"` + Attributes *KeyAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Managed *bool `json:"managed,omitempty"` +} + +// KeyCreateParameters is the key create parameters. +type KeyCreateParameters struct { + Kty JSONWebKeyType `json:"kty,omitempty"` + KeySize *int32 `json:"key_size,omitempty"` + KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` + KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// KeyImportParameters is the key import parameters. +type KeyImportParameters struct { + Hsm *bool `json:"Hsm,omitempty"` + Key *JSONWebKey `json:"key,omitempty"` + KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// KeyItem is the key item containing key metadata. +type KeyItem struct { + Kid *string `json:"kid,omitempty"` + Attributes *KeyAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Managed *bool `json:"managed,omitempty"` +} + +// KeyListResult is the key list result. +type KeyListResult struct { + autorest.Response `json:"-"` + Value *[]KeyItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// KeyListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client KeyListResult) KeyListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// KeyOperationResult is the key operation result. +type KeyOperationResult struct { + autorest.Response `json:"-"` + Kid *string `json:"kid,omitempty"` + Result *string `json:"value,omitempty"` +} + +// KeyOperationsParameters is the key operations parameters. +type KeyOperationsParameters struct { + Algorithm JSONWebKeyEncryptionAlgorithm `json:"alg,omitempty"` + Value *string `json:"value,omitempty"` +} + +// KeyProperties is properties of the key pair backing a certificate. +type KeyProperties struct { + Exportable *bool `json:"exportable,omitempty"` + KeyType *string `json:"kty,omitempty"` + KeySize *int32 `json:"key_size,omitempty"` + ReuseKey *bool `json:"reuse_key,omitempty"` +} + +// KeyRestoreParameters is the key restore parameters. +type KeyRestoreParameters struct { + KeyBundleBackup *string `json:"value,omitempty"` +} + +// KeySignParameters is the key operations parameters. +type KeySignParameters struct { + Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` + Value *string `json:"value,omitempty"` +} + +// KeyUpdateParameters is the key update parameters. +type KeyUpdateParameters struct { + KeyOps *[]JSONWebKeyOperation `json:"key_ops,omitempty"` + KeyAttributes *KeyAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// KeyVerifyParameters is the key verify parameters. +type KeyVerifyParameters struct { + Algorithm JSONWebKeySignatureAlgorithm `json:"alg,omitempty"` + Digest *string `json:"digest,omitempty"` + Signature *string `json:"value,omitempty"` +} + +// KeyVerifyResult is the key verify result. +type KeyVerifyResult struct { + autorest.Response `json:"-"` + Value *bool `json:"value,omitempty"` +} + +// LifetimeAction is action and its trigger that will be performed by Key Vault +// over the lifetime of a certificate. +type LifetimeAction struct { + Trigger *Trigger `json:"trigger,omitempty"` + Action *Action `json:"action,omitempty"` +} + +// OrganizationDetails is details of the organization of the certificate +// issuer. +type OrganizationDetails struct { + ID *string `json:"id,omitempty"` + AdminDetails *[]AdministratorDetails `json:"admin_details,omitempty"` +} + +// PendingCertificateSigningRequestResult is the pending certificate signing +// request result. +type PendingCertificateSigningRequestResult struct { + Value *string `json:"value,omitempty"` +} + +// SecretAttributes is the secret management attributes. +type SecretAttributes struct { + Enabled *bool `json:"enabled,omitempty"` + NotBefore *date.UnixTime `json:"nbf,omitempty"` + Expires *date.UnixTime `json:"exp,omitempty"` + Created *date.UnixTime `json:"created,omitempty"` + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// SecretBundle is a secret consisting of a value, id and its attributes. +type SecretBundle struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` + ID *string `json:"id,omitempty"` + ContentType *string `json:"contentType,omitempty"` + Attributes *SecretAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + Kid *string `json:"kid,omitempty"` + Managed *bool `json:"managed,omitempty"` +} + +// SecretItem is the secret item containing secret metadata. +type SecretItem struct { + ID *string `json:"id,omitempty"` + Attributes *SecretAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ContentType *string `json:"contentType,omitempty"` + Managed *bool `json:"managed,omitempty"` +} + +// SecretListResult is the secret list result. +type SecretListResult struct { + autorest.Response `json:"-"` + Value *[]SecretItem `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// SecretListResultPreparer prepares a request to retrieve the next set of results. It returns +// nil if no more results exist. +func (client SecretListResult) SecretListResultPreparer() (*http.Request, error) { + if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(client.NextLink))) +} + +// SecretProperties is properties of the key backing a certificate. +type SecretProperties struct { + ContentType *string `json:"contentType,omitempty"` +} + +// SecretSetParameters is the secret set parameters. +type SecretSetParameters struct { + Value *string `json:"value,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` + ContentType *string `json:"contentType,omitempty"` + SecretAttributes *SecretAttributes `json:"attributes,omitempty"` +} + +// SecretUpdateParameters is the secret update parameters. +type SecretUpdateParameters struct { + ContentType *string `json:"contentType,omitempty"` + SecretAttributes *SecretAttributes `json:"attributes,omitempty"` + Tags *map[string]*string `json:"tags,omitempty"` +} + +// SubjectAlternativeNames is the subject alternate names of a X509 object. +type SubjectAlternativeNames struct { + Emails *[]string `json:"emails,omitempty"` + DNSNames *[]string `json:"dns_names,omitempty"` + Upns *[]string `json:"upns,omitempty"` +} + +// Trigger is a condition to be satisfied for an action to be executed. +type Trigger struct { + LifetimePercentage *int32 `json:"lifetime_percentage,omitempty"` + DaysBeforeExpiry *int32 `json:"days_before_expiry,omitempty"` +} + +// X509CertificateProperties is properties of the X509 component of a +// certificate. +type X509CertificateProperties struct { + Subject *string `json:"subject,omitempty"` + Ekus *[]string `json:"ekus,omitempty"` + SubjectAlternativeNames *SubjectAlternativeNames `json:"sans,omitempty"` + KeyUsage *[]KeyUsageType `json:"key_usage,omitempty"` + ValidityInMonths *int32 `json:"validity_months,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/version.go b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/version.go index b7e81ebd4f..05d3b354fa 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/dataplane/keyvault/version.go @@ -1,29 +1,29 @@ -package keyvault - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// 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. -// -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/v10.0.2-beta arm-keyvault/2016-10-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return "v10.0.2-beta" -} +package keyvault + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// 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. +// +// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/v10.0.2-beta arm-keyvault/2016-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "v10.0.2-beta" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/glide.lock b/vendor/github.com/Azure/azure-sdk-for-go/glide.lock index 8f986816c4..3ed83e2e7c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/glide.lock +++ b/vendor/github.com/Azure/azure-sdk-for-go/glide.lock @@ -1,63 +1,63 @@ -hash: fc11c273a4bfae9a077f2238a4693fa3af3d815dfc1b1e9ec75d9eb8e6428993 -updated: 2017-05-04T15:24:51.52099-07:00 -imports: -- name: github.com/Azure/go-autorest - version: 58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d - subpackages: - - autorest - - autorest/azure - - autorest/date - - autorest/to - - autorest/validation - - autorest/adal -- name: github.com/dgrijalva/jwt-go - version: 2268707a8f0843315e2004ee4f1d021dc08baedf -- name: github.com/howeyc/gopass - version: bf9dde6d0d2c004a008c27aaee91170c786f6db8 -- name: github.com/mattn/go-colorable - version: ded68f7a9561c023e790de24279db7ebf473ea80 -- name: github.com/mattn/go-isatty - version: fc9e8d8ef48496124e79ae0df75490096eccf6fe -- name: github.com/mgutz/ansi - version: 9520e82c474b0a04dd04f8a40959027271bab992 -- name: github.com/mgutz/minimist - version: 39eb8cf573ca29344bd7d7e6ba4d7febdebd37a9 -- name: github.com/mgutz/str - version: 968bf66e3da857419e4f6e71b2d5c9ae95682dc4 -- name: github.com/mgutz/to - version: 00c06406c2dd2e011f153a6502a21473676db33f -- name: github.com/MichaelTJones/walk - version: 4748e29d5718c2df4028a6543edf86fd8cc0f881 -- name: github.com/nozzle/throttler - version: d9b45f19996c645d38c9266d1f5cf1990e930119 -- name: github.com/satori/uuid - version: 5bf94b69c6b68ee1b541973bb8e1144db23a194b -- name: github.com/shopspring/decimal - version: 3526cd0bdb7f64e1178943b7dee81a0cc3d86a69 -- name: golang.org/x/crypto - version: 5a033cc77e57eca05bdb50522851d29e03569cbe - subpackages: - - pkcs12 - - pkcs12/internal/rc2 - - ssh/terminal -- name: golang.org/x/sys - version: 9ccfe848b9db8435a24c424abbc07a921adf1df5 - subpackages: - - unix -- name: gopkg.in/check.v1 - version: 20d25e2804050c1cd24a7eea1e7a6447dd0e74ec -- name: gopkg.in/godo.v2 - version: b5fd2f0bef1ebe832e628cfad18ab1cc707f65a1 - subpackages: - - glob - - util - - watcher - - watcher/fswatch -testImports: -- name: github.com/dnaeon/go-vcr - version: 87d4990451a858cc210399285be976e63bc3c364 - subpackages: - - cassette - - recorder -- name: gopkg.in/yaml.v2 - version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b +hash: fc11c273a4bfae9a077f2238a4693fa3af3d815dfc1b1e9ec75d9eb8e6428993 +updated: 2017-05-04T15:24:51.52099-07:00 +imports: +- name: github.com/Azure/go-autorest + version: 58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d + subpackages: + - autorest + - autorest/azure + - autorest/date + - autorest/to + - autorest/validation + - autorest/adal +- name: github.com/dgrijalva/jwt-go + version: 2268707a8f0843315e2004ee4f1d021dc08baedf +- name: github.com/howeyc/gopass + version: bf9dde6d0d2c004a008c27aaee91170c786f6db8 +- name: github.com/mattn/go-colorable + version: ded68f7a9561c023e790de24279db7ebf473ea80 +- name: github.com/mattn/go-isatty + version: fc9e8d8ef48496124e79ae0df75490096eccf6fe +- name: github.com/mgutz/ansi + version: 9520e82c474b0a04dd04f8a40959027271bab992 +- name: github.com/mgutz/minimist + version: 39eb8cf573ca29344bd7d7e6ba4d7febdebd37a9 +- name: github.com/mgutz/str + version: 968bf66e3da857419e4f6e71b2d5c9ae95682dc4 +- name: github.com/mgutz/to + version: 00c06406c2dd2e011f153a6502a21473676db33f +- name: github.com/MichaelTJones/walk + version: 4748e29d5718c2df4028a6543edf86fd8cc0f881 +- name: github.com/nozzle/throttler + version: d9b45f19996c645d38c9266d1f5cf1990e930119 +- name: github.com/satori/uuid + version: 5bf94b69c6b68ee1b541973bb8e1144db23a194b +- name: github.com/shopspring/decimal + version: 3526cd0bdb7f64e1178943b7dee81a0cc3d86a69 +- name: golang.org/x/crypto + version: 5a033cc77e57eca05bdb50522851d29e03569cbe + subpackages: + - pkcs12 + - pkcs12/internal/rc2 + - ssh/terminal +- name: golang.org/x/sys + version: 9ccfe848b9db8435a24c424abbc07a921adf1df5 + subpackages: + - unix +- name: gopkg.in/check.v1 + version: 20d25e2804050c1cd24a7eea1e7a6447dd0e74ec +- name: gopkg.in/godo.v2 + version: b5fd2f0bef1ebe832e628cfad18ab1cc707f65a1 + subpackages: + - glob + - util + - watcher + - watcher/fswatch +testImports: +- name: github.com/dnaeon/go-vcr + version: 87d4990451a858cc210399285be976e63bc3c364 + subpackages: + - cassette + - recorder +- name: gopkg.in/yaml.v2 + version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b diff --git a/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml b/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml index 17983149f2..efd3da4aad 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/glide.yaml @@ -1,13 +1,13 @@ -package: github.com/Azure/azure-sdk-for-go -import: -- package: github.com/Azure/go-autorest - version: ~8.0.0 - subpackages: - - /autorest - - autorest/azure - - autorest/date - - autorest/to -- package: golang.org/x/crypto - subpackages: - - /pkcs12 -- package: gopkg.in/check.v1 +package: github.com/Azure/azure-sdk-for-go +import: +- package: github.com/Azure/go-autorest + version: ~8.0.0 + subpackages: + - /autorest + - autorest/azure + - autorest/date + - autorest/to +- package: golang.org/x/crypto + subpackages: + - /pkcs12 +- package: gopkg.in/check.v1 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/README.md b/vendor/github.com/Azure/azure-sdk-for-go/management/README.md index 86bf362e08..7a1abb35a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/README.md @@ -1,10 +1,10 @@ -# Azure Service Management packages for Go - -The `github.com/Azure/azure-sdk-for-go/management` packages are used to perform operations using the Azure Service Management (ASM), aka classic deployment model. Read more about [Azure Resource Manager vs. classic deployment](https://azure.microsoft.com/documentation/articles/resource-manager-deployment-model/). Packages for Azure Resource Manager are in the [arm](../arm) folder. - -## First a Sidenote: Authentication and the Azure Service Manager - -The client currently supports authentication to the Service Management -API with certificates or Azure `.publishSettings` file. You can -download the `.publishSettings` file for your subscriptions -[here](https://manage.windowsazure.com/publishsettings). +# Azure Service Management packages for Go + +The `github.com/Azure/azure-sdk-for-go/management` packages are used to perform operations using the Azure Service Management (ASM), aka classic deployment model. Read more about [Azure Resource Manager vs. classic deployment](https://azure.microsoft.com/documentation/articles/resource-manager-deployment-model/). Packages for Azure Resource Manager are in the [arm](../arm) folder. + +## First a Sidenote: Authentication and the Azure Service Manager + +The client currently supports authentication to the Service Management +API with certificates or Azure `.publishSettings` file. You can +download the `.publishSettings` file for your subscriptions +[here](https://manage.windowsazure.com/publishsettings). diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/client.go index 0b6d9a3173..3f6f240a39 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/client.go @@ -1,131 +1,131 @@ -package affinitygroup - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureCreateAffinityGroupURL = "/affinitygroups" - azureGetAffinityGroupURL = "/affinitygroups/%s" - azureListAffinityGroupsURL = "/affinitygroups" - azureUpdateAffinityGroupURL = "/affinitygroups/%s" - azureDeleteAffinityGroupURL = "/affinitygroups/%s" - - errParameterNotSpecified = "Parameter %s not specified." -) - -// AffinityGroupClient simply contains a management.Client and has -// methods for doing all affinity group-related API calls to Azure. -type AffinityGroupClient struct { - mgmtClient management.Client -} - -// NewClient returns an AffinityGroupClient with the given management.Client. -func NewClient(mgmtClient management.Client) AffinityGroupClient { - return AffinityGroupClient{mgmtClient} -} - -// CreateAffinityGroup creates a new affinity group. -// -// https://msdn.microsoft.com/en-us/library/azure/gg715317.aspx -func (c AffinityGroupClient) CreateAffinityGroup(params CreateAffinityGroupParams) error { - params.Label = encodeLabel(params.Label) - - req, err := xml.Marshal(params) - if err != nil { - return err - } - - _, err = c.mgmtClient.SendAzurePostRequest(azureCreateAffinityGroupURL, req) - return err -} - -// GetAffinityGroup returns the system properties that are associated with the -// specified affinity group. -// -// https://msdn.microsoft.com/en-us/library/azure/ee460789.aspx -func (c AffinityGroupClient) GetAffinityGroup(name string) (AffinityGroup, error) { - var affgroup AffinityGroup - if name == "" { - return affgroup, fmt.Errorf(errParameterNotSpecified, "name") - } - - url := fmt.Sprintf(azureGetAffinityGroupURL, name) - resp, err := c.mgmtClient.SendAzureGetRequest(url) - if err != nil { - return affgroup, err - } - - err = xml.Unmarshal(resp, &affgroup) - affgroup.Label = decodeLabel(affgroup.Label) - return affgroup, err -} - -// ListAffinityGroups lists the affinity groups off Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/ee460797.aspx -func (c AffinityGroupClient) ListAffinityGroups() (ListAffinityGroupsResponse, error) { - var affinitygroups ListAffinityGroupsResponse - - resp, err := c.mgmtClient.SendAzureGetRequest(azureListAffinityGroupsURL) - if err != nil { - return affinitygroups, err - } - - err = xml.Unmarshal(resp, &affinitygroups) - - for i, grp := range affinitygroups.AffinityGroups { - affinitygroups.AffinityGroups[i].Label = decodeLabel(grp.Label) - } - - return affinitygroups, err -} - -// UpdateAffinityGroup updates the label or description for an the group. -// -// https://msdn.microsoft.com/en-us/library/azure/gg715316.aspx -func (c AffinityGroupClient) UpdateAffinityGroup(name string, params UpdateAffinityGroupParams) error { - if name == "" { - return fmt.Errorf(errParameterNotSpecified, "name") - } - - params.Label = encodeLabel(params.Label) - req, err := xml.Marshal(params) - if err != nil { - return err - } - - url := fmt.Sprintf(azureUpdateAffinityGroupURL, name) - _, err = c.mgmtClient.SendAzurePutRequest(url, "text/xml", req) - return err -} - -// DeleteAffinityGroup deletes the given affinity group. -// -// https://msdn.microsoft.com/en-us/library/azure/gg715314.aspx -func (c AffinityGroupClient) DeleteAffinityGroup(name string) error { - if name == "" { - return fmt.Errorf(errParameterNotSpecified, name) - } - - url := fmt.Sprintf(azureDeleteAffinityGroupURL, name) - _, err := c.mgmtClient.SendAzureDeleteRequest(url) - return err -} - -// encodeLabel is a helper function which encodes the given string -// to the base64 string which will be sent to Azure as a Label. -func encodeLabel(label string) string { - return base64.StdEncoding.EncodeToString([]byte(label)) -} - -// decodeLabel is a helper function which decodes the base64 encoded -// label received from Azure into standard encoding. -func decodeLabel(label string) string { - res, _ := base64.StdEncoding.DecodeString(label) - return string(res) -} +package affinitygroup + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureCreateAffinityGroupURL = "/affinitygroups" + azureGetAffinityGroupURL = "/affinitygroups/%s" + azureListAffinityGroupsURL = "/affinitygroups" + azureUpdateAffinityGroupURL = "/affinitygroups/%s" + azureDeleteAffinityGroupURL = "/affinitygroups/%s" + + errParameterNotSpecified = "Parameter %s not specified." +) + +// AffinityGroupClient simply contains a management.Client and has +// methods for doing all affinity group-related API calls to Azure. +type AffinityGroupClient struct { + mgmtClient management.Client +} + +// NewClient returns an AffinityGroupClient with the given management.Client. +func NewClient(mgmtClient management.Client) AffinityGroupClient { + return AffinityGroupClient{mgmtClient} +} + +// CreateAffinityGroup creates a new affinity group. +// +// https://msdn.microsoft.com/en-us/library/azure/gg715317.aspx +func (c AffinityGroupClient) CreateAffinityGroup(params CreateAffinityGroupParams) error { + params.Label = encodeLabel(params.Label) + + req, err := xml.Marshal(params) + if err != nil { + return err + } + + _, err = c.mgmtClient.SendAzurePostRequest(azureCreateAffinityGroupURL, req) + return err +} + +// GetAffinityGroup returns the system properties that are associated with the +// specified affinity group. +// +// https://msdn.microsoft.com/en-us/library/azure/ee460789.aspx +func (c AffinityGroupClient) GetAffinityGroup(name string) (AffinityGroup, error) { + var affgroup AffinityGroup + if name == "" { + return affgroup, fmt.Errorf(errParameterNotSpecified, "name") + } + + url := fmt.Sprintf(azureGetAffinityGroupURL, name) + resp, err := c.mgmtClient.SendAzureGetRequest(url) + if err != nil { + return affgroup, err + } + + err = xml.Unmarshal(resp, &affgroup) + affgroup.Label = decodeLabel(affgroup.Label) + return affgroup, err +} + +// ListAffinityGroups lists the affinity groups off Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/ee460797.aspx +func (c AffinityGroupClient) ListAffinityGroups() (ListAffinityGroupsResponse, error) { + var affinitygroups ListAffinityGroupsResponse + + resp, err := c.mgmtClient.SendAzureGetRequest(azureListAffinityGroupsURL) + if err != nil { + return affinitygroups, err + } + + err = xml.Unmarshal(resp, &affinitygroups) + + for i, grp := range affinitygroups.AffinityGroups { + affinitygroups.AffinityGroups[i].Label = decodeLabel(grp.Label) + } + + return affinitygroups, err +} + +// UpdateAffinityGroup updates the label or description for an the group. +// +// https://msdn.microsoft.com/en-us/library/azure/gg715316.aspx +func (c AffinityGroupClient) UpdateAffinityGroup(name string, params UpdateAffinityGroupParams) error { + if name == "" { + return fmt.Errorf(errParameterNotSpecified, "name") + } + + params.Label = encodeLabel(params.Label) + req, err := xml.Marshal(params) + if err != nil { + return err + } + + url := fmt.Sprintf(azureUpdateAffinityGroupURL, name) + _, err = c.mgmtClient.SendAzurePutRequest(url, "text/xml", req) + return err +} + +// DeleteAffinityGroup deletes the given affinity group. +// +// https://msdn.microsoft.com/en-us/library/azure/gg715314.aspx +func (c AffinityGroupClient) DeleteAffinityGroup(name string) error { + if name == "" { + return fmt.Errorf(errParameterNotSpecified, name) + } + + url := fmt.Sprintf(azureDeleteAffinityGroupURL, name) + _, err := c.mgmtClient.SendAzureDeleteRequest(url) + return err +} + +// encodeLabel is a helper function which encodes the given string +// to the base64 string which will be sent to Azure as a Label. +func encodeLabel(label string) string { + return base64.StdEncoding.EncodeToString([]byte(label)) +} + +// decodeLabel is a helper function which decodes the base64 encoded +// label received from Azure into standard encoding. +func decodeLabel(label string) string { + res, _ := base64.StdEncoding.DecodeString(label) + return string(res) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/entities.go index e308995f1f..7ce5882647 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/affinitygroup/entities.go @@ -1,80 +1,80 @@ -package affinitygroup - -import ( - "encoding/xml" -) - -// CreateAffinityGroupParams respresents the set of parameters required for -// creating an affinity group creation request to Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/gg715317.aspx -type CreateAffinityGroupParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CreateAffinityGroup"` - Name string - Label string - Description string `xml:",omitempty"` - Location string -} - -// HostedService is a struct containing details about a hosted service that is -// part of an affinity group on Azure. -type HostedService struct { - URL string `xml:"Url"` - ServiceName string -} - -// StorageService is a struct containing details about a storage service that is -// part of an affinity group on Azure. -type StorageService struct { - URL string `xml:"Url"` - ServiceName string -} - -// AffinityGroup respresents the properties of an affinity group on Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/ee460789.aspx -type AffinityGroup struct { - Name string - Label string - Description string - Location string - HostedServices []HostedService - StorageServices []StorageService - Capabilities []string -} - -// ComputeCapabilities represents the sets of capabilities of an affinity group -// obtained from an affinity group list call to Azure. -type ComputeCapabilities struct { - VirtualMachineRoleSizes []string - WebWorkerRoleSizes []string -} - -// AffinityGroupListResponse represents the properties obtained for each -// affinity group listed off Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/ee460797.aspx -type AffinityGroupListResponse struct { - Name string - Label string - Description string - Location string - Capabilities []string - ComputeCapabilities ComputeCapabilities -} - -// ListAffinityGroupsResponse contains all the affinity groups obtained from a -// call to the Azure API to list all affinity groups. -type ListAffinityGroupsResponse struct { - AffinityGroups []AffinityGroupListResponse `xml:"AffinityGroup"` -} - -// UpdateAffinityGroupParams if the set of parameters required to update an -// affinity group on Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/gg715316.aspx -type UpdateAffinityGroupParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure UpdateAffinityGroup"` - Label string `xml:",omitempty"` - Description string `xml:",omitempty"` -} +package affinitygroup + +import ( + "encoding/xml" +) + +// CreateAffinityGroupParams respresents the set of parameters required for +// creating an affinity group creation request to Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/gg715317.aspx +type CreateAffinityGroupParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CreateAffinityGroup"` + Name string + Label string + Description string `xml:",omitempty"` + Location string +} + +// HostedService is a struct containing details about a hosted service that is +// part of an affinity group on Azure. +type HostedService struct { + URL string `xml:"Url"` + ServiceName string +} + +// StorageService is a struct containing details about a storage service that is +// part of an affinity group on Azure. +type StorageService struct { + URL string `xml:"Url"` + ServiceName string +} + +// AffinityGroup respresents the properties of an affinity group on Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/ee460789.aspx +type AffinityGroup struct { + Name string + Label string + Description string + Location string + HostedServices []HostedService + StorageServices []StorageService + Capabilities []string +} + +// ComputeCapabilities represents the sets of capabilities of an affinity group +// obtained from an affinity group list call to Azure. +type ComputeCapabilities struct { + VirtualMachineRoleSizes []string + WebWorkerRoleSizes []string +} + +// AffinityGroupListResponse represents the properties obtained for each +// affinity group listed off Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/ee460797.aspx +type AffinityGroupListResponse struct { + Name string + Label string + Description string + Location string + Capabilities []string + ComputeCapabilities ComputeCapabilities +} + +// ListAffinityGroupsResponse contains all the affinity groups obtained from a +// call to the Azure API to list all affinity groups. +type ListAffinityGroupsResponse struct { + AffinityGroups []AffinityGroupListResponse `xml:"AffinityGroup"` +} + +// UpdateAffinityGroupParams if the set of parameters required to update an +// affinity group on Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/gg715316.aspx +type UpdateAffinityGroupParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure UpdateAffinityGroup"` + Label string `xml:",omitempty"` + Description string `xml:",omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/client.go index c99f251a5a..155674a685 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/client.go @@ -1,152 +1,152 @@ -// Package management provides the main API client to construct other clients -// and make requests to the Microsoft Azure Service Management REST API. -package management - -import ( - "errors" - "fmt" - "runtime" - "time" -) - -var ( - DefaultUserAgent = userAgent() -) - -const ( - DefaultAzureManagementURL = "https://management.core.windows.net" - DefaultOperationPollInterval = time.Second * 30 - DefaultAPIVersion = "2014-10-01" - - errPublishSettingsConfiguration = "PublishSettingsFilePath is set. Consequently ManagementCertificatePath and SubscriptionId must not be set." - errManagementCertificateConfiguration = "Both ManagementCertificatePath and SubscriptionId should be set, and PublishSettingsFilePath must not be set." - errParamNotSpecified = "Parameter %s is not specified." -) - -type client struct { - publishSettings publishSettings - config ClientConfig -} - -// Client is the base Azure Service Management API client instance that -// can be used to construct client instances for various services. -type Client interface { - // SendAzureGetRequest sends a request to the management API using the HTTP GET method - // and returns the response body or an error. - SendAzureGetRequest(url string) ([]byte, error) - - // SendAzurePostRequest sends a request to the management API using the HTTP POST method - // and returns the request ID or an error. - SendAzurePostRequest(url string, data []byte) (OperationID, error) - - // SendAzurePostRequestWithReturnedResponse sends a request to the management API using - // the HTTP POST method and returns the response body or an error. - SendAzurePostRequestWithReturnedResponse(url string, data []byte) ([]byte, error) - - // SendAzurePutRequest sends a request to the management API using the HTTP PUT method - // and returns the request ID or an error. The content type can be specified, however - // if an empty string is passed, the default of "application/xml" will be used. - SendAzurePutRequest(url, contentType string, data []byte) (OperationID, error) - - // SendAzureDeleteRequest sends a request to the management API using the HTTP DELETE method - // and returns the request ID or an error. - SendAzureDeleteRequest(url string) (OperationID, error) - - // GetOperationStatus gets the status of operation with given Operation ID. - // WaitForOperation utility method can be used for polling for operation status. - GetOperationStatus(operationID OperationID) (GetOperationStatusResponse, error) - - // WaitForOperation polls the Azure API for given operation ID indefinitely - // until the operation is completed with either success or failure. - // It is meant to be used for waiting for the result of the methods that - // return an OperationID value (meaning a long running operation has started). - // - // Cancellation of the polling loop (for instance, timing out) is done through - // cancel channel. If the user does not want to cancel, a nil chan can be provided. - // To cancel the method, it is recommended to close the channel provided to this - // method. - // - // If the operation was not successful or cancelling is signaled, an error - // is returned. - WaitForOperation(operationID OperationID, cancel chan struct{}) error -} - -// ClientConfig provides a configuration for use by a Client. -type ClientConfig struct { - ManagementURL string - OperationPollInterval time.Duration - UserAgent string - APIVersion string -} - -// NewAnonymousClient creates a new azure.Client with no credentials set. -func NewAnonymousClient() Client { - return client{} -} - -// DefaultConfig returns the default client configuration used to construct -// a client. This value can be used to make modifications on the default API -// configuration. -func DefaultConfig() ClientConfig { - return ClientConfig{ - ManagementURL: DefaultAzureManagementURL, - OperationPollInterval: DefaultOperationPollInterval, - APIVersion: DefaultAPIVersion, - UserAgent: DefaultUserAgent, - } -} - -// NewClient creates a new Client using the given subscription ID and -// management certificate. -func NewClient(subscriptionID string, managementCert []byte) (Client, error) { - return NewClientFromConfig(subscriptionID, managementCert, DefaultConfig()) -} - -// NewClientFromConfig creates a new Client using a given ClientConfig. -func NewClientFromConfig(subscriptionID string, managementCert []byte, config ClientConfig) (Client, error) { - return makeClient(subscriptionID, managementCert, config) -} - -func makeClient(subscriptionID string, managementCert []byte, config ClientConfig) (Client, error) { - var c client - - if subscriptionID == "" { - return c, errors.New("azure: subscription ID required") - } - - if len(managementCert) == 0 { - return c, errors.New("azure: management certificate required") - } - - publishSettings := publishSettings{ - SubscriptionID: subscriptionID, - SubscriptionCert: managementCert, - SubscriptionKey: managementCert, - } - - // Validate client configuration - switch { - case config.ManagementURL == "": - return c, errors.New("azure: base URL required") - case config.OperationPollInterval <= 0: - return c, errors.New("azure: operation polling interval must be a positive duration") - case config.APIVersion == "": - return c, errors.New("azure: client configuration must specify an API version") - case config.UserAgent == "": - config.UserAgent = DefaultUserAgent - } - - return client{ - publishSettings: publishSettings, - config: config, - }, nil -} - -func userAgent() string { - return fmt.Sprintf("Go/%s (%s-%s) Azure-SDK-For-Go/%s asm/%s", - runtime.Version(), - runtime.GOARCH, - runtime.GOOS, - sdkVersion, - DefaultAPIVersion) -} +// Package management provides the main API client to construct other clients +// and make requests to the Microsoft Azure Service Management REST API. +package management + +import ( + "errors" + "fmt" + "runtime" + "time" +) + +var ( + DefaultUserAgent = userAgent() +) + +const ( + DefaultAzureManagementURL = "https://management.core.windows.net" + DefaultOperationPollInterval = time.Second * 30 + DefaultAPIVersion = "2014-10-01" + + errPublishSettingsConfiguration = "PublishSettingsFilePath is set. Consequently ManagementCertificatePath and SubscriptionId must not be set." + errManagementCertificateConfiguration = "Both ManagementCertificatePath and SubscriptionId should be set, and PublishSettingsFilePath must not be set." + errParamNotSpecified = "Parameter %s is not specified." +) + +type client struct { + publishSettings publishSettings + config ClientConfig +} + +// Client is the base Azure Service Management API client instance that +// can be used to construct client instances for various services. +type Client interface { + // SendAzureGetRequest sends a request to the management API using the HTTP GET method + // and returns the response body or an error. + SendAzureGetRequest(url string) ([]byte, error) + + // SendAzurePostRequest sends a request to the management API using the HTTP POST method + // and returns the request ID or an error. + SendAzurePostRequest(url string, data []byte) (OperationID, error) + + // SendAzurePostRequestWithReturnedResponse sends a request to the management API using + // the HTTP POST method and returns the response body or an error. + SendAzurePostRequestWithReturnedResponse(url string, data []byte) ([]byte, error) + + // SendAzurePutRequest sends a request to the management API using the HTTP PUT method + // and returns the request ID or an error. The content type can be specified, however + // if an empty string is passed, the default of "application/xml" will be used. + SendAzurePutRequest(url, contentType string, data []byte) (OperationID, error) + + // SendAzureDeleteRequest sends a request to the management API using the HTTP DELETE method + // and returns the request ID or an error. + SendAzureDeleteRequest(url string) (OperationID, error) + + // GetOperationStatus gets the status of operation with given Operation ID. + // WaitForOperation utility method can be used for polling for operation status. + GetOperationStatus(operationID OperationID) (GetOperationStatusResponse, error) + + // WaitForOperation polls the Azure API for given operation ID indefinitely + // until the operation is completed with either success or failure. + // It is meant to be used for waiting for the result of the methods that + // return an OperationID value (meaning a long running operation has started). + // + // Cancellation of the polling loop (for instance, timing out) is done through + // cancel channel. If the user does not want to cancel, a nil chan can be provided. + // To cancel the method, it is recommended to close the channel provided to this + // method. + // + // If the operation was not successful or cancelling is signaled, an error + // is returned. + WaitForOperation(operationID OperationID, cancel chan struct{}) error +} + +// ClientConfig provides a configuration for use by a Client. +type ClientConfig struct { + ManagementURL string + OperationPollInterval time.Duration + UserAgent string + APIVersion string +} + +// NewAnonymousClient creates a new azure.Client with no credentials set. +func NewAnonymousClient() Client { + return client{} +} + +// DefaultConfig returns the default client configuration used to construct +// a client. This value can be used to make modifications on the default API +// configuration. +func DefaultConfig() ClientConfig { + return ClientConfig{ + ManagementURL: DefaultAzureManagementURL, + OperationPollInterval: DefaultOperationPollInterval, + APIVersion: DefaultAPIVersion, + UserAgent: DefaultUserAgent, + } +} + +// NewClient creates a new Client using the given subscription ID and +// management certificate. +func NewClient(subscriptionID string, managementCert []byte) (Client, error) { + return NewClientFromConfig(subscriptionID, managementCert, DefaultConfig()) +} + +// NewClientFromConfig creates a new Client using a given ClientConfig. +func NewClientFromConfig(subscriptionID string, managementCert []byte, config ClientConfig) (Client, error) { + return makeClient(subscriptionID, managementCert, config) +} + +func makeClient(subscriptionID string, managementCert []byte, config ClientConfig) (Client, error) { + var c client + + if subscriptionID == "" { + return c, errors.New("azure: subscription ID required") + } + + if len(managementCert) == 0 { + return c, errors.New("azure: management certificate required") + } + + publishSettings := publishSettings{ + SubscriptionID: subscriptionID, + SubscriptionCert: managementCert, + SubscriptionKey: managementCert, + } + + // Validate client configuration + switch { + case config.ManagementURL == "": + return c, errors.New("azure: base URL required") + case config.OperationPollInterval <= 0: + return c, errors.New("azure: operation polling interval must be a positive duration") + case config.APIVersion == "": + return c, errors.New("azure: client configuration must specify an API version") + case config.UserAgent == "": + config.UserAgent = DefaultUserAgent + } + + return client{ + publishSettings: publishSettings, + config: config, + }, nil +} + +func userAgent() string { + return fmt.Sprintf("Go/%s (%s-%s) Azure-SDK-For-Go/%s asm/%s", + runtime.Version(), + runtime.GOARCH, + runtime.GOOS, + sdkVersion, + DefaultAPIVersion) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/errors.go b/vendor/github.com/Azure/azure-sdk-for-go/management/errors.go index 578d846d80..7985945433 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/errors.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/errors.go @@ -1,36 +1,36 @@ -package management - -import ( - "encoding/xml" - "fmt" -) - -// AzureError represents an error returned by the management API. It has an error -// code (for example, ResourceNotFound) and a descriptive message. -type AzureError struct { - Code string - Message string -} - -//Error implements the error interface for the AzureError type. -func (e AzureError) Error() string { - return fmt.Sprintf("Error response from Azure. Code: %s, Message: %s", e.Code, e.Message) -} - -// IsResourceNotFoundError returns true if the provided error is an AzureError -// reporting that a given resource has not been found. -func IsResourceNotFoundError(err error) bool { - azureErr, ok := err.(AzureError) - return ok && azureErr.Code == "ResourceNotFound" -} - -// getAzureError converts an error response body into an AzureError instance. -func getAzureError(responseBody []byte) error { - var azErr AzureError - err := xml.Unmarshal(responseBody, &azErr) - if err != nil { - return fmt.Errorf("Failed parsing contents to AzureError format: %v", err) - } - return azErr - -} +package management + +import ( + "encoding/xml" + "fmt" +) + +// AzureError represents an error returned by the management API. It has an error +// code (for example, ResourceNotFound) and a descriptive message. +type AzureError struct { + Code string + Message string +} + +//Error implements the error interface for the AzureError type. +func (e AzureError) Error() string { + return fmt.Sprintf("Error response from Azure. Code: %s, Message: %s", e.Code, e.Message) +} + +// IsResourceNotFoundError returns true if the provided error is an AzureError +// reporting that a given resource has not been found. +func IsResourceNotFoundError(err error) bool { + azureErr, ok := err.(AzureError) + return ok && azureErr.Code == "ResourceNotFound" +} + +// getAzureError converts an error response body into an AzureError instance. +func getAzureError(responseBody []byte) error { + var azErr AzureError + err := xml.Unmarshal(responseBody, &azErr) + if err != nil { + return fmt.Errorf("Failed parsing contents to AzureError format: %v", err) + } + return azErr + +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go index c6b6c81cab..9ee32be4ea 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/errors_test.go @@ -1,30 +1,30 @@ -package management_test - -import ( - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// TestIsResourceNotFoundError tests IsResourceNotFoundError with the -// set of given test cases. -func TestIsResourceNotFoundError(t *testing.T) { - // isResourceNotFoundTestCases is a set of structs comprising of the error - // IsResourceNotFoundError should test and the expected result. - var isResourceNotFoundTestCases = []struct { - err error - expected bool - }{ - {nil, false}, - {fmt.Errorf("Some other random error."), false}, - {management.AzureError{Code: "ResourceNotFound"}, true}, - {management.AzureError{Code: "NotAResourceNotFound"}, false}, - } - - for i, testCase := range isResourceNotFoundTestCases { - if res := management.IsResourceNotFoundError(testCase.err); res != testCase.expected { - t.Fatalf("Test %d: error %s - expected %t - got %t", i+1, testCase.err, testCase.expected, res) - } - } -} +package management_test + +import ( + "fmt" + "testing" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// TestIsResourceNotFoundError tests IsResourceNotFoundError with the +// set of given test cases. +func TestIsResourceNotFoundError(t *testing.T) { + // isResourceNotFoundTestCases is a set of structs comprising of the error + // IsResourceNotFoundError should test and the expected result. + var isResourceNotFoundTestCases = []struct { + err error + expected bool + }{ + {nil, false}, + {fmt.Errorf("Some other random error."), false}, + {management.AzureError{Code: "ResourceNotFound"}, true}, + {management.AzureError{Code: "NotAResourceNotFound"}, false}, + } + + for i, testCase := range isResourceNotFoundTestCases { + if res := management.IsResourceNotFoundError(testCase.err); res != testCase.expected { + t.Fatalf("Test %d: error %s - expected %t - got %t", i+1, testCase.err, testCase.expected, res) + } + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/client.go index bd20361d55..a9c7063a26 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/client.go @@ -1,125 +1,125 @@ -// Package hostedservice provides a client for Hosted Services. -package hostedservice - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureXmlns = "http://schemas.microsoft.com/windowsazure" - azureDeploymentListURL = "services/hostedservices/%s/deployments" - azureHostedServiceListURL = "services/hostedservices" - azureHostedServiceAvailabilityURL = "services/hostedservices/operations/isavailable/%s" - azureDeploymentURL = "services/hostedservices/%s/deployments/%s" - deleteAzureDeploymentURL = "services/hostedservices/%s/deployments/%s" - getHostedServicePropertiesURL = "services/hostedservices/%s" - azureServiceCertificateURL = "services/hostedservices/%s/certificates" - - errParamNotSpecified = "Parameter %s is not specified." -) - -//NewClient is used to return a handle to the HostedService API -func NewClient(client management.Client) HostedServiceClient { - return HostedServiceClient{client: client} -} - -func (h HostedServiceClient) CreateHostedService(params CreateHostedServiceParameters) error { - req, err := xml.Marshal(params) - if err != nil { - return err - } - - _, err = h.client.SendAzurePostRequest(azureHostedServiceListURL, req) // not a long running operation - return err -} - -func (h HostedServiceClient) CheckHostedServiceNameAvailability(dnsName string) (AvailabilityResponse, error) { - var r AvailabilityResponse - if dnsName == "" { - return r, fmt.Errorf(errParamNotSpecified, "dnsName") - } - - requestURL := fmt.Sprintf(azureHostedServiceAvailabilityURL, dnsName) - response, err := h.client.SendAzureGetRequest(requestURL) - if err != nil { - return r, err - } - - err = xml.Unmarshal(response, &r) - return r, err -} - -func (h HostedServiceClient) DeleteHostedService(dnsName string, deleteDisksAndBlobs bool) (management.OperationID, error) { - if dnsName == "" { - return "", fmt.Errorf(errParamNotSpecified, "dnsName") - } - - requestURL := fmt.Sprintf(getHostedServicePropertiesURL, dnsName) - if deleteDisksAndBlobs { - requestURL += "?comp=media" - } - return h.client.SendAzureDeleteRequest(requestURL) -} - -func (h HostedServiceClient) GetHostedService(name string) (HostedService, error) { - hostedService := HostedService{} - if name == "" { - return hostedService, fmt.Errorf(errParamNotSpecified, "name") - } - - requestURL := fmt.Sprintf(getHostedServicePropertiesURL, name) - response, err := h.client.SendAzureGetRequest(requestURL) - if err != nil { - return hostedService, err - } - - err = xml.Unmarshal(response, &hostedService) - if err != nil { - return hostedService, err - } - - decodedLabel, err := base64.StdEncoding.DecodeString(hostedService.LabelBase64) - if err != nil { - return hostedService, err - } - hostedService.Label = string(decodedLabel) - return hostedService, nil -} - -func (h HostedServiceClient) ListHostedServices() (ListHostedServicesResponse, error) { - var response ListHostedServicesResponse - - data, err := h.client.SendAzureGetRequest(azureHostedServiceListURL) - if err != nil { - return response, err - } - - err = xml.Unmarshal(data, &response) - return response, err -} - -func (h HostedServiceClient) AddCertificate(dnsName string, certData []byte, certificateFormat CertificateFormat, password string) (management.OperationID, error) { - if dnsName == "" { - return "", fmt.Errorf(errParamNotSpecified, "dnsName") - } - - certBase64 := base64.StdEncoding.EncodeToString(certData) - - addCertificate := CertificateFile{ - Data: certBase64, - CertificateFormat: certificateFormat, - Password: password, - Xmlns: azureXmlns, - } - buffer, err := xml.Marshal(addCertificate) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureServiceCertificateURL, dnsName) - return h.client.SendAzurePostRequest(requestURL, buffer) -} +// Package hostedservice provides a client for Hosted Services. +package hostedservice + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureXmlns = "http://schemas.microsoft.com/windowsazure" + azureDeploymentListURL = "services/hostedservices/%s/deployments" + azureHostedServiceListURL = "services/hostedservices" + azureHostedServiceAvailabilityURL = "services/hostedservices/operations/isavailable/%s" + azureDeploymentURL = "services/hostedservices/%s/deployments/%s" + deleteAzureDeploymentURL = "services/hostedservices/%s/deployments/%s" + getHostedServicePropertiesURL = "services/hostedservices/%s" + azureServiceCertificateURL = "services/hostedservices/%s/certificates" + + errParamNotSpecified = "Parameter %s is not specified." +) + +//NewClient is used to return a handle to the HostedService API +func NewClient(client management.Client) HostedServiceClient { + return HostedServiceClient{client: client} +} + +func (h HostedServiceClient) CreateHostedService(params CreateHostedServiceParameters) error { + req, err := xml.Marshal(params) + if err != nil { + return err + } + + _, err = h.client.SendAzurePostRequest(azureHostedServiceListURL, req) // not a long running operation + return err +} + +func (h HostedServiceClient) CheckHostedServiceNameAvailability(dnsName string) (AvailabilityResponse, error) { + var r AvailabilityResponse + if dnsName == "" { + return r, fmt.Errorf(errParamNotSpecified, "dnsName") + } + + requestURL := fmt.Sprintf(azureHostedServiceAvailabilityURL, dnsName) + response, err := h.client.SendAzureGetRequest(requestURL) + if err != nil { + return r, err + } + + err = xml.Unmarshal(response, &r) + return r, err +} + +func (h HostedServiceClient) DeleteHostedService(dnsName string, deleteDisksAndBlobs bool) (management.OperationID, error) { + if dnsName == "" { + return "", fmt.Errorf(errParamNotSpecified, "dnsName") + } + + requestURL := fmt.Sprintf(getHostedServicePropertiesURL, dnsName) + if deleteDisksAndBlobs { + requestURL += "?comp=media" + } + return h.client.SendAzureDeleteRequest(requestURL) +} + +func (h HostedServiceClient) GetHostedService(name string) (HostedService, error) { + hostedService := HostedService{} + if name == "" { + return hostedService, fmt.Errorf(errParamNotSpecified, "name") + } + + requestURL := fmt.Sprintf(getHostedServicePropertiesURL, name) + response, err := h.client.SendAzureGetRequest(requestURL) + if err != nil { + return hostedService, err + } + + err = xml.Unmarshal(response, &hostedService) + if err != nil { + return hostedService, err + } + + decodedLabel, err := base64.StdEncoding.DecodeString(hostedService.LabelBase64) + if err != nil { + return hostedService, err + } + hostedService.Label = string(decodedLabel) + return hostedService, nil +} + +func (h HostedServiceClient) ListHostedServices() (ListHostedServicesResponse, error) { + var response ListHostedServicesResponse + + data, err := h.client.SendAzureGetRequest(azureHostedServiceListURL) + if err != nil { + return response, err + } + + err = xml.Unmarshal(data, &response) + return response, err +} + +func (h HostedServiceClient) AddCertificate(dnsName string, certData []byte, certificateFormat CertificateFormat, password string) (management.OperationID, error) { + if dnsName == "" { + return "", fmt.Errorf(errParamNotSpecified, "dnsName") + } + + certBase64 := base64.StdEncoding.EncodeToString(certData) + + addCertificate := CertificateFile{ + Data: certBase64, + CertificateFormat: certificateFormat, + Password: password, + Xmlns: azureXmlns, + } + buffer, err := xml.Marshal(addCertificate) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureServiceCertificateURL, dnsName) + return h.client.SendAzurePostRequest(requestURL, buffer) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/entities.go index 7956a79665..f540fa9f40 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/hostedservice/entities.go @@ -1,58 +1,58 @@ -package hostedservice - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -//HostedServiceClient is used to perform operations on Azure Hosted Services -type HostedServiceClient struct { - client management.Client -} - -type CreateHostedServiceParameters struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CreateHostedService"` - ServiceName string - Label string - Description string - Location string - ReverseDNSFqdn string `xml:"ReverseDnsFqdn,omitempty"` -} - -type AvailabilityResponse struct { - Xmlns string `xml:"xmlns,attr"` - Result bool - Reason string -} - -type HostedService struct { - URL string `xml:"Url"` - ServiceName string - Description string `xml:"HostedServiceProperties>Description"` - AffinityGroup string `xml:"HostedServiceProperties>AffinityGroup"` - Location string `xml:"HostedServiceProperties>Location"` - LabelBase64 string `xml:"HostedServiceProperties>Label"` - Label string - Status string `xml:"HostedServiceProperties>Status"` - ReverseDNSFqdn string `xml:"HostedServiceProperties>ReverseDnsFqdn"` - DefaultWinRmCertificateThumbprint string -} - -type CertificateFile struct { - Xmlns string `xml:"xmlns,attr"` - Data string - CertificateFormat CertificateFormat - Password string `xml:",omitempty"` -} - -type CertificateFormat string - -const ( - CertificateFormatPfx = CertificateFormat("pfx") - CertificateFormatCer = CertificateFormat("cer") -) - -type ListHostedServicesResponse struct { - HostedServices []HostedService `xml:"HostedService"` -} +package hostedservice + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +//HostedServiceClient is used to perform operations on Azure Hosted Services +type HostedServiceClient struct { + client management.Client +} + +type CreateHostedServiceParameters struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CreateHostedService"` + ServiceName string + Label string + Description string + Location string + ReverseDNSFqdn string `xml:"ReverseDnsFqdn,omitempty"` +} + +type AvailabilityResponse struct { + Xmlns string `xml:"xmlns,attr"` + Result bool + Reason string +} + +type HostedService struct { + URL string `xml:"Url"` + ServiceName string + Description string `xml:"HostedServiceProperties>Description"` + AffinityGroup string `xml:"HostedServiceProperties>AffinityGroup"` + Location string `xml:"HostedServiceProperties>Location"` + LabelBase64 string `xml:"HostedServiceProperties>Label"` + Label string + Status string `xml:"HostedServiceProperties>Status"` + ReverseDNSFqdn string `xml:"HostedServiceProperties>ReverseDnsFqdn"` + DefaultWinRmCertificateThumbprint string +} + +type CertificateFile struct { + Xmlns string `xml:"xmlns,attr"` + Data string + CertificateFormat CertificateFormat + Password string `xml:",omitempty"` +} + +type CertificateFormat string + +const ( + CertificateFormatPfx = CertificateFormat("pfx") + CertificateFormatCer = CertificateFormat("cer") +) + +type ListHostedServicesResponse struct { + HostedServices []HostedService `xml:"HostedService"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/http.go b/vendor/github.com/Azure/azure-sdk-for-go/management/http.go index 598e8515f0..5760f51ee2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/http.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/http.go @@ -1,190 +1,190 @@ -package management - -import ( - "bytes" - "crypto/tls" - "fmt" - "net/http" -) - -const ( - msVersionHeader = "x-ms-version" - requestIDHeader = "x-ms-request-id" - uaHeader = "User-Agent" - contentHeader = "Content-Type" - defaultContentHeaderValue = "application/xml" -) - -func (client client) SendAzureGetRequest(url string) ([]byte, error) { - resp, err := client.sendAzureRequest("GET", url, "", nil) - if err != nil { - return nil, err - } - return getResponseBody(resp) -} - -func (client client) SendAzurePostRequest(url string, data []byte) (OperationID, error) { - return client.doAzureOperation("POST", url, "", data) -} - -func (client client) SendAzurePostRequestWithReturnedResponse(url string, data []byte) ([]byte, error) { - resp, err := client.sendAzureRequest("POST", url, "", data) - if err != nil { - return nil, err - } - - return getResponseBody(resp) -} - -func (client client) SendAzurePutRequest(url, contentType string, data []byte) (OperationID, error) { - return client.doAzureOperation("PUT", url, contentType, data) -} - -func (client client) SendAzureDeleteRequest(url string) (OperationID, error) { - return client.doAzureOperation("DELETE", url, "", nil) -} - -func (client client) doAzureOperation(method, url, contentType string, data []byte) (OperationID, error) { - response, err := client.sendAzureRequest(method, url, contentType, data) - if err != nil { - return "", err - } - return getOperationID(response) -} - -func getOperationID(response *http.Response) (OperationID, error) { - requestID := response.Header.Get(requestIDHeader) - if requestID == "" { - return "", fmt.Errorf("Could not retrieve operation id from %q header", requestIDHeader) - } - return OperationID(requestID), nil -} - -// sendAzureRequest constructs an HTTP client for the request, sends it to the -// management API and returns the response or an error. -func (client client) sendAzureRequest(method, url, contentType string, data []byte) (*http.Response, error) { - if method == "" { - return nil, fmt.Errorf(errParamNotSpecified, "method") - } - if url == "" { - return nil, fmt.Errorf(errParamNotSpecified, "url") - } - - httpClient, err := client.createHTTPClient() - if err != nil { - return nil, err - } - - response, err := client.sendRequest(httpClient, url, method, contentType, data, 5) - if err != nil { - return nil, err - } - - return response, nil -} - -// createHTTPClient creates an HTTP Client configured with the key pair for -// the subscription for this client. -func (client client) createHTTPClient() (*http.Client, error) { - cert, err := tls.X509KeyPair(client.publishSettings.SubscriptionCert, client.publishSettings.SubscriptionKey) - if err != nil { - return nil, err - } - - return &http.Client{ - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - TLSClientConfig: &tls.Config{ - Renegotiation: tls.RenegotiateOnceAsClient, - Certificates: []tls.Certificate{cert}, - }, - }, - }, nil -} - -// sendRequest sends a request to the Azure management API using the given -// HTTP client and parameters. It returns the response from the call or an -// error. -func (client client) sendRequest(httpClient *http.Client, url, requestType, contentType string, data []byte, numberOfRetries int) (*http.Response, error) { - - absURI := client.createAzureRequestURI(url) - - for { - request, reqErr := client.createAzureRequest(absURI, requestType, contentType, data) - if reqErr != nil { - return nil, reqErr - } - - response, err := httpClient.Do(request) - if err != nil { - if numberOfRetries == 0 { - return nil, err - } - - return client.sendRequest(httpClient, url, requestType, contentType, data, numberOfRetries-1) - } - if response.StatusCode == http.StatusTemporaryRedirect { - // ASM's way of moving traffic around, see https://msdn.microsoft.com/en-us/library/azure/ee460801.aspx - // Only handled automatically for GET/HEAD requests. This is for the rest of the http verbs. - u, err := response.Location() - if err != nil { - return response, fmt.Errorf("Redirect requested but location header could not be retrieved: %v", err) - } - absURI = u.String() - continue // re-issue request - } - - if response.StatusCode >= http.StatusBadRequest { - body, err := getResponseBody(response) - if err != nil { - // Failed to read the response body - return nil, err - } - azureErr := getAzureError(body) - if azureErr != nil { - if numberOfRetries == 0 { - return nil, azureErr - } - - return client.sendRequest(httpClient, url, requestType, contentType, data, numberOfRetries-1) - } - } - - return response, nil - } -} - -// createAzureRequestURI constructs the request uri using the management API endpoint and -// subscription ID associated with the client. -func (client client) createAzureRequestURI(url string) string { - return fmt.Sprintf("%s/%s/%s", client.config.ManagementURL, client.publishSettings.SubscriptionID, url) -} - -// createAzureRequest packages up the request with the correct set of headers and returns -// the request object or an error. -func (client client) createAzureRequest(url string, requestType string, contentType string, data []byte) (*http.Request, error) { - var request *http.Request - var err error - - if data != nil { - body := bytes.NewBuffer(data) - request, err = http.NewRequest(requestType, url, body) - } else { - request, err = http.NewRequest(requestType, url, nil) - } - - if err != nil { - return nil, err - } - - request.Header.Set(msVersionHeader, client.config.APIVersion) - request.Header.Set(uaHeader, client.config.UserAgent) - - if contentType != "" { - request.Header.Set(contentHeader, contentType) - } else { - request.Header.Set(contentHeader, defaultContentHeaderValue) - } - - return request, nil -} +package management + +import ( + "bytes" + "crypto/tls" + "fmt" + "net/http" +) + +const ( + msVersionHeader = "x-ms-version" + requestIDHeader = "x-ms-request-id" + uaHeader = "User-Agent" + contentHeader = "Content-Type" + defaultContentHeaderValue = "application/xml" +) + +func (client client) SendAzureGetRequest(url string) ([]byte, error) { + resp, err := client.sendAzureRequest("GET", url, "", nil) + if err != nil { + return nil, err + } + return getResponseBody(resp) +} + +func (client client) SendAzurePostRequest(url string, data []byte) (OperationID, error) { + return client.doAzureOperation("POST", url, "", data) +} + +func (client client) SendAzurePostRequestWithReturnedResponse(url string, data []byte) ([]byte, error) { + resp, err := client.sendAzureRequest("POST", url, "", data) + if err != nil { + return nil, err + } + + return getResponseBody(resp) +} + +func (client client) SendAzurePutRequest(url, contentType string, data []byte) (OperationID, error) { + return client.doAzureOperation("PUT", url, contentType, data) +} + +func (client client) SendAzureDeleteRequest(url string) (OperationID, error) { + return client.doAzureOperation("DELETE", url, "", nil) +} + +func (client client) doAzureOperation(method, url, contentType string, data []byte) (OperationID, error) { + response, err := client.sendAzureRequest(method, url, contentType, data) + if err != nil { + return "", err + } + return getOperationID(response) +} + +func getOperationID(response *http.Response) (OperationID, error) { + requestID := response.Header.Get(requestIDHeader) + if requestID == "" { + return "", fmt.Errorf("Could not retrieve operation id from %q header", requestIDHeader) + } + return OperationID(requestID), nil +} + +// sendAzureRequest constructs an HTTP client for the request, sends it to the +// management API and returns the response or an error. +func (client client) sendAzureRequest(method, url, contentType string, data []byte) (*http.Response, error) { + if method == "" { + return nil, fmt.Errorf(errParamNotSpecified, "method") + } + if url == "" { + return nil, fmt.Errorf(errParamNotSpecified, "url") + } + + httpClient, err := client.createHTTPClient() + if err != nil { + return nil, err + } + + response, err := client.sendRequest(httpClient, url, method, contentType, data, 5) + if err != nil { + return nil, err + } + + return response, nil +} + +// createHTTPClient creates an HTTP Client configured with the key pair for +// the subscription for this client. +func (client client) createHTTPClient() (*http.Client, error) { + cert, err := tls.X509KeyPair(client.publishSettings.SubscriptionCert, client.publishSettings.SubscriptionKey) + if err != nil { + return nil, err + } + + return &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + TLSClientConfig: &tls.Config{ + Renegotiation: tls.RenegotiateOnceAsClient, + Certificates: []tls.Certificate{cert}, + }, + }, + }, nil +} + +// sendRequest sends a request to the Azure management API using the given +// HTTP client and parameters. It returns the response from the call or an +// error. +func (client client) sendRequest(httpClient *http.Client, url, requestType, contentType string, data []byte, numberOfRetries int) (*http.Response, error) { + + absURI := client.createAzureRequestURI(url) + + for { + request, reqErr := client.createAzureRequest(absURI, requestType, contentType, data) + if reqErr != nil { + return nil, reqErr + } + + response, err := httpClient.Do(request) + if err != nil { + if numberOfRetries == 0 { + return nil, err + } + + return client.sendRequest(httpClient, url, requestType, contentType, data, numberOfRetries-1) + } + if response.StatusCode == http.StatusTemporaryRedirect { + // ASM's way of moving traffic around, see https://msdn.microsoft.com/en-us/library/azure/ee460801.aspx + // Only handled automatically for GET/HEAD requests. This is for the rest of the http verbs. + u, err := response.Location() + if err != nil { + return response, fmt.Errorf("Redirect requested but location header could not be retrieved: %v", err) + } + absURI = u.String() + continue // re-issue request + } + + if response.StatusCode >= http.StatusBadRequest { + body, err := getResponseBody(response) + if err != nil { + // Failed to read the response body + return nil, err + } + azureErr := getAzureError(body) + if azureErr != nil { + if numberOfRetries == 0 { + return nil, azureErr + } + + return client.sendRequest(httpClient, url, requestType, contentType, data, numberOfRetries-1) + } + } + + return response, nil + } +} + +// createAzureRequestURI constructs the request uri using the management API endpoint and +// subscription ID associated with the client. +func (client client) createAzureRequestURI(url string) string { + return fmt.Sprintf("%s/%s/%s", client.config.ManagementURL, client.publishSettings.SubscriptionID, url) +} + +// createAzureRequest packages up the request with the correct set of headers and returns +// the request object or an error. +func (client client) createAzureRequest(url string, requestType string, contentType string, data []byte) (*http.Request, error) { + var request *http.Request + var err error + + if data != nil { + body := bytes.NewBuffer(data) + request, err = http.NewRequest(requestType, url, body) + } else { + request, err = http.NewRequest(requestType, url, nil) + } + + if err != nil { + return nil, err + } + + request.Header.Set(msVersionHeader, client.config.APIVersion) + request.Header.Set(uaHeader, client.config.UserAgent) + + if contentType != "" { + request.Header.Set(contentHeader, contentType) + } else { + request.Header.Set(contentHeader, defaultContentHeaderValue) + } + + return request, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/location/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/location/client.go index 40c8074a7c..721f3f6075 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/location/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/location/client.go @@ -1,30 +1,30 @@ -// Package location provides a client for Locations. -package location - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureLocationListURL = "locations" - errParamNotSpecified = "Parameter %s is not specified." -) - -//NewClient is used to instantiate a new LocationClient from an Azure client -func NewClient(client management.Client) LocationClient { - return LocationClient{client: client} -} - -func (c LocationClient) ListLocations() (ListLocationsResponse, error) { - var l ListLocationsResponse - - response, err := c.client.SendAzureGetRequest(azureLocationListURL) - if err != nil { - return l, err - } - - err = xml.Unmarshal(response, &l) - return l, err -} +// Package location provides a client for Locations. +package location + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureLocationListURL = "locations" + errParamNotSpecified = "Parameter %s is not specified." +) + +//NewClient is used to instantiate a new LocationClient from an Azure client +func NewClient(client management.Client) LocationClient { + return LocationClient{client: client} +} + +func (c LocationClient) ListLocations() (ListLocationsResponse, error) { + var l ListLocationsResponse + + response, err := c.client.SendAzureGetRequest(azureLocationListURL) + if err != nil { + return l, err + } + + err = xml.Unmarshal(response, &l) + return l, err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/location/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/location/entities.go index bdc68af2ca..8a25015836 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/location/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/location/entities.go @@ -1,37 +1,37 @@ -package location - -import ( - "bytes" - "encoding/xml" - "fmt" - "strings" - - "github.com/Azure/azure-sdk-for-go/management" -) - -//LocationClient is used to perform operations on Azure Locations -type LocationClient struct { - client management.Client -} - -type ListLocationsResponse struct { - XMLName xml.Name `xml:"Locations"` - Locations []Location `xml:"Location"` -} - -type Location struct { - Name string - DisplayName string - AvailableServices []string `xml:"AvailableServices>AvailableService"` - WebWorkerRoleSizes []string `xml:"ComputeCapabilities>WebWorkerRoleSizes>RoleSize"` - VirtualMachineRoleSizes []string `xml:"ComputeCapabilities>VirtualMachinesRoleSizes>RoleSize"` -} - -func (ll ListLocationsResponse) String() string { - var buf bytes.Buffer - for _, l := range ll.Locations { - fmt.Fprintf(&buf, "%s, ", l.Name) - } - - return strings.Trim(buf.String(), ", ") -} +package location + +import ( + "bytes" + "encoding/xml" + "fmt" + "strings" + + "github.com/Azure/azure-sdk-for-go/management" +) + +//LocationClient is used to perform operations on Azure Locations +type LocationClient struct { + client management.Client +} + +type ListLocationsResponse struct { + XMLName xml.Name `xml:"Locations"` + Locations []Location `xml:"Location"` +} + +type Location struct { + Name string + DisplayName string + AvailableServices []string `xml:"AvailableServices>AvailableService"` + WebWorkerRoleSizes []string `xml:"ComputeCapabilities>WebWorkerRoleSizes>RoleSize"` + VirtualMachineRoleSizes []string `xml:"ComputeCapabilities>VirtualMachinesRoleSizes>RoleSize"` +} + +func (ll ListLocationsResponse) String() string { + var buf bytes.Buffer + for _, l := range ll.Locations { + fmt.Fprintf(&buf, "%s, ", l.Name) + } + + return strings.Trim(buf.String(), ", ") +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/client.go index c975123883..8e8eea4da0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/client.go @@ -1,245 +1,245 @@ -// Package networksecuritygroup provides a client for Network Security Groups. -package networksecuritygroup - -import ( - "encoding/xml" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - createSecurityGroupURL = "services/networking/networksecuritygroups" - deleteSecurityGroupURL = "services/networking/networksecuritygroups/%s" - getSecurityGroupURL = "services/networking/networksecuritygroups/%s?detaillevel=full" - listSecurityGroupsURL = "services/networking/networksecuritygroups" - addSecurityGroupToSubnetURL = "services/networking/virtualnetwork/%s/subnets/%s/networksecuritygroups" - getSecurityGroupForSubnetURL = "services/networking/virtualnetwork/%s/subnets/%s/networksecuritygroups" - removeSecurityGroupFromSubnetURL = "services/networking/virtualnetwork/%s/subnets/%s/networksecuritygroups/%s" - setSecurityGroupRuleURL = "services/networking/networksecuritygroups/%s/rules/%s" - deleteSecurityGroupRuleURL = "services/networking/networksecuritygroups/%s/rules/%s" - - errParamNotSpecified = "Parameter %s is not specified." -) - -// NewClient is used to instantiate a new SecurityGroupClient from an Azure client -func NewClient(client management.Client) SecurityGroupClient { - return SecurityGroupClient{client: client} -} - -// CreateNetworkSecurityGroup creates a new network security group within -// the context of the specified subscription -// -// https://msdn.microsoft.com/en-us/library/azure/dn913818.aspx -func (sg SecurityGroupClient) CreateNetworkSecurityGroup( - name string, - label string, - location string) (management.OperationID, error) { - if name == "" { - return "", fmt.Errorf(errParamNotSpecified, "name") - } - if location == "" { - return "", fmt.Errorf(errParamNotSpecified, "location") - } - - data, err := xml.Marshal(SecurityGroupRequest{ - Name: name, - Label: label, - Location: location, - }) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(createSecurityGroupURL) - return sg.client.SendAzurePostRequest(requestURL, data) -} - -// DeleteNetworkSecurityGroup deletes the specified network security group from the subscription -// -// https://msdn.microsoft.com/en-us/library/azure/dn913825.aspx -func (sg SecurityGroupClient) DeleteNetworkSecurityGroup( - name string) (management.OperationID, error) { - if name == "" { - return "", fmt.Errorf(errParamNotSpecified, "name") - } - - requestURL := fmt.Sprintf(deleteSecurityGroupURL, name) - return sg.client.SendAzureDeleteRequest(requestURL) -} - -// GetNetworkSecurityGroup returns information about the specified network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx -func (sg SecurityGroupClient) GetNetworkSecurityGroup(name string) (SecurityGroupResponse, error) { - if name == "" { - return SecurityGroupResponse{}, fmt.Errorf(errParamNotSpecified, "name") - } - - var securityGroup SecurityGroupResponse - - requestURL := fmt.Sprintf(getSecurityGroupURL, name) - response, err := sg.client.SendAzureGetRequest(requestURL) - if err != nil { - return securityGroup, err - } - - err = xml.Unmarshal(response, &securityGroup) - return securityGroup, err -} - -// ListNetworkSecurityGroups returns a list of the network security groups -// in the specified subscription -// -// https://msdn.microsoft.com/en-us/library/azure/dn913815.aspx -func (sg SecurityGroupClient) ListNetworkSecurityGroups() (SecurityGroupList, error) { - var securityGroups SecurityGroupList - - response, err := sg.client.SendAzureGetRequest(listSecurityGroupsURL) - if err != nil { - return securityGroups, err - } - - err = xml.Unmarshal(response, &securityGroups) - return securityGroups, err -} - -// AddNetworkSecurityToSubnet associates the network security group with -// specified subnet in a virtual network -// -// https://msdn.microsoft.com/en-us/library/azure/dn913822.aspx -func (sg SecurityGroupClient) AddNetworkSecurityToSubnet( - name string, - subnet string, - virtualNetwork string) (management.OperationID, error) { - if name == "" { - return "", fmt.Errorf(errParamNotSpecified, "name") - } - if subnet == "" { - return "", fmt.Errorf(errParamNotSpecified, "subnet") - } - if virtualNetwork == "" { - return "", fmt.Errorf(errParamNotSpecified, "virtualNetwork") - } - - data, err := xml.Marshal(SecurityGroupRequest{Name: name}) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(addSecurityGroupToSubnetURL, virtualNetwork, subnet) - return sg.client.SendAzurePostRequest(requestURL, data) -} - -// GetNetworkSecurityGroupForSubnet returns information about the network -// security group associated with a subnet -// -// https://msdn.microsoft.com/en-us/library/azure/dn913817.aspx -func (sg SecurityGroupClient) GetNetworkSecurityGroupForSubnet( - subnet string, - virtualNetwork string) (SecurityGroupResponse, error) { - if subnet == "" { - return SecurityGroupResponse{}, fmt.Errorf(errParamNotSpecified, "subnet") - } - if virtualNetwork == "" { - return SecurityGroupResponse{}, fmt.Errorf(errParamNotSpecified, "virtualNetwork") - } - - var securityGroup SecurityGroupResponse - - requestURL := fmt.Sprintf(getSecurityGroupForSubnetURL, virtualNetwork, subnet) - response, err := sg.client.SendAzureGetRequest(requestURL) - if err != nil { - return securityGroup, err - } - - err = xml.Unmarshal(response, &securityGroup) - return securityGroup, err -} - -// RemoveNetworkSecurityGroupFromSubnet removes the association of the -// specified network security group from the specified subnet -// -// https://msdn.microsoft.com/en-us/library/azure/dn913820.aspx -func (sg SecurityGroupClient) RemoveNetworkSecurityGroupFromSubnet( - name string, - subnet string, - virtualNetwork string) (management.OperationID, error) { - if name == "" { - return "", fmt.Errorf(errParamNotSpecified, "name") - } - if subnet == "" { - return "", fmt.Errorf(errParamNotSpecified, "subnet") - } - if virtualNetwork == "" { - return "", fmt.Errorf(errParamNotSpecified, "virtualNetwork") - } - - requestURL := fmt.Sprintf(removeSecurityGroupFromSubnetURL, virtualNetwork, subnet, name) - return sg.client.SendAzureDeleteRequest(requestURL) -} - -// SetNetworkSecurityGroupRule adds or updates a network security rule that -// is associated with the specified network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913819.aspx -func (sg SecurityGroupClient) SetNetworkSecurityGroupRule( - securityGroup string, - rule RuleRequest) (management.OperationID, error) { - if securityGroup == "" { - return "", fmt.Errorf(errParamNotSpecified, "securityGroup") - } - if rule.Name == "" { - return "", fmt.Errorf(errParamNotSpecified, "Name") - } - if rule.Type == "" { - return "", fmt.Errorf(errParamNotSpecified, "Type") - } - if rule.Priority == 0 { - return "", fmt.Errorf(errParamNotSpecified, "Priority") - } - if rule.Action == "" { - return "", fmt.Errorf(errParamNotSpecified, "Action") - } - if rule.SourceAddressPrefix == "" { - return "", fmt.Errorf(errParamNotSpecified, "SourceAddressPrefix") - } - if rule.SourcePortRange == "" { - return "", fmt.Errorf(errParamNotSpecified, "SourcePortRange") - } - if rule.DestinationAddressPrefix == "" { - return "", fmt.Errorf(errParamNotSpecified, "DestinationAddressPrefix") - } - if rule.DestinationPortRange == "" { - return "", fmt.Errorf(errParamNotSpecified, "DestinationPortRange") - } - if rule.Protocol == "" { - return "", fmt.Errorf(errParamNotSpecified, "Protocol") - } - - data, err := xml.Marshal(rule) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(setSecurityGroupRuleURL, securityGroup, rule.Name) - return sg.client.SendAzurePutRequest(requestURL, "", data) -} - -// DeleteNetworkSecurityGroupRule deletes a network security group rule from -// the specified network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913816.aspx -func (sg SecurityGroupClient) DeleteNetworkSecurityGroupRule( - securityGroup string, - rule string) (management.OperationID, error) { - if securityGroup == "" { - return "", fmt.Errorf(errParamNotSpecified, "securityGroup") - } - if rule == "" { - return "", fmt.Errorf(errParamNotSpecified, "rule") - } - - requestURL := fmt.Sprintf(deleteSecurityGroupRuleURL, securityGroup, rule) - return sg.client.SendAzureDeleteRequest(requestURL) -} +// Package networksecuritygroup provides a client for Network Security Groups. +package networksecuritygroup + +import ( + "encoding/xml" + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + createSecurityGroupURL = "services/networking/networksecuritygroups" + deleteSecurityGroupURL = "services/networking/networksecuritygroups/%s" + getSecurityGroupURL = "services/networking/networksecuritygroups/%s?detaillevel=full" + listSecurityGroupsURL = "services/networking/networksecuritygroups" + addSecurityGroupToSubnetURL = "services/networking/virtualnetwork/%s/subnets/%s/networksecuritygroups" + getSecurityGroupForSubnetURL = "services/networking/virtualnetwork/%s/subnets/%s/networksecuritygroups" + removeSecurityGroupFromSubnetURL = "services/networking/virtualnetwork/%s/subnets/%s/networksecuritygroups/%s" + setSecurityGroupRuleURL = "services/networking/networksecuritygroups/%s/rules/%s" + deleteSecurityGroupRuleURL = "services/networking/networksecuritygroups/%s/rules/%s" + + errParamNotSpecified = "Parameter %s is not specified." +) + +// NewClient is used to instantiate a new SecurityGroupClient from an Azure client +func NewClient(client management.Client) SecurityGroupClient { + return SecurityGroupClient{client: client} +} + +// CreateNetworkSecurityGroup creates a new network security group within +// the context of the specified subscription +// +// https://msdn.microsoft.com/en-us/library/azure/dn913818.aspx +func (sg SecurityGroupClient) CreateNetworkSecurityGroup( + name string, + label string, + location string) (management.OperationID, error) { + if name == "" { + return "", fmt.Errorf(errParamNotSpecified, "name") + } + if location == "" { + return "", fmt.Errorf(errParamNotSpecified, "location") + } + + data, err := xml.Marshal(SecurityGroupRequest{ + Name: name, + Label: label, + Location: location, + }) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(createSecurityGroupURL) + return sg.client.SendAzurePostRequest(requestURL, data) +} + +// DeleteNetworkSecurityGroup deletes the specified network security group from the subscription +// +// https://msdn.microsoft.com/en-us/library/azure/dn913825.aspx +func (sg SecurityGroupClient) DeleteNetworkSecurityGroup( + name string) (management.OperationID, error) { + if name == "" { + return "", fmt.Errorf(errParamNotSpecified, "name") + } + + requestURL := fmt.Sprintf(deleteSecurityGroupURL, name) + return sg.client.SendAzureDeleteRequest(requestURL) +} + +// GetNetworkSecurityGroup returns information about the specified network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx +func (sg SecurityGroupClient) GetNetworkSecurityGroup(name string) (SecurityGroupResponse, error) { + if name == "" { + return SecurityGroupResponse{}, fmt.Errorf(errParamNotSpecified, "name") + } + + var securityGroup SecurityGroupResponse + + requestURL := fmt.Sprintf(getSecurityGroupURL, name) + response, err := sg.client.SendAzureGetRequest(requestURL) + if err != nil { + return securityGroup, err + } + + err = xml.Unmarshal(response, &securityGroup) + return securityGroup, err +} + +// ListNetworkSecurityGroups returns a list of the network security groups +// in the specified subscription +// +// https://msdn.microsoft.com/en-us/library/azure/dn913815.aspx +func (sg SecurityGroupClient) ListNetworkSecurityGroups() (SecurityGroupList, error) { + var securityGroups SecurityGroupList + + response, err := sg.client.SendAzureGetRequest(listSecurityGroupsURL) + if err != nil { + return securityGroups, err + } + + err = xml.Unmarshal(response, &securityGroups) + return securityGroups, err +} + +// AddNetworkSecurityToSubnet associates the network security group with +// specified subnet in a virtual network +// +// https://msdn.microsoft.com/en-us/library/azure/dn913822.aspx +func (sg SecurityGroupClient) AddNetworkSecurityToSubnet( + name string, + subnet string, + virtualNetwork string) (management.OperationID, error) { + if name == "" { + return "", fmt.Errorf(errParamNotSpecified, "name") + } + if subnet == "" { + return "", fmt.Errorf(errParamNotSpecified, "subnet") + } + if virtualNetwork == "" { + return "", fmt.Errorf(errParamNotSpecified, "virtualNetwork") + } + + data, err := xml.Marshal(SecurityGroupRequest{Name: name}) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(addSecurityGroupToSubnetURL, virtualNetwork, subnet) + return sg.client.SendAzurePostRequest(requestURL, data) +} + +// GetNetworkSecurityGroupForSubnet returns information about the network +// security group associated with a subnet +// +// https://msdn.microsoft.com/en-us/library/azure/dn913817.aspx +func (sg SecurityGroupClient) GetNetworkSecurityGroupForSubnet( + subnet string, + virtualNetwork string) (SecurityGroupResponse, error) { + if subnet == "" { + return SecurityGroupResponse{}, fmt.Errorf(errParamNotSpecified, "subnet") + } + if virtualNetwork == "" { + return SecurityGroupResponse{}, fmt.Errorf(errParamNotSpecified, "virtualNetwork") + } + + var securityGroup SecurityGroupResponse + + requestURL := fmt.Sprintf(getSecurityGroupForSubnetURL, virtualNetwork, subnet) + response, err := sg.client.SendAzureGetRequest(requestURL) + if err != nil { + return securityGroup, err + } + + err = xml.Unmarshal(response, &securityGroup) + return securityGroup, err +} + +// RemoveNetworkSecurityGroupFromSubnet removes the association of the +// specified network security group from the specified subnet +// +// https://msdn.microsoft.com/en-us/library/azure/dn913820.aspx +func (sg SecurityGroupClient) RemoveNetworkSecurityGroupFromSubnet( + name string, + subnet string, + virtualNetwork string) (management.OperationID, error) { + if name == "" { + return "", fmt.Errorf(errParamNotSpecified, "name") + } + if subnet == "" { + return "", fmt.Errorf(errParamNotSpecified, "subnet") + } + if virtualNetwork == "" { + return "", fmt.Errorf(errParamNotSpecified, "virtualNetwork") + } + + requestURL := fmt.Sprintf(removeSecurityGroupFromSubnetURL, virtualNetwork, subnet, name) + return sg.client.SendAzureDeleteRequest(requestURL) +} + +// SetNetworkSecurityGroupRule adds or updates a network security rule that +// is associated with the specified network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913819.aspx +func (sg SecurityGroupClient) SetNetworkSecurityGroupRule( + securityGroup string, + rule RuleRequest) (management.OperationID, error) { + if securityGroup == "" { + return "", fmt.Errorf(errParamNotSpecified, "securityGroup") + } + if rule.Name == "" { + return "", fmt.Errorf(errParamNotSpecified, "Name") + } + if rule.Type == "" { + return "", fmt.Errorf(errParamNotSpecified, "Type") + } + if rule.Priority == 0 { + return "", fmt.Errorf(errParamNotSpecified, "Priority") + } + if rule.Action == "" { + return "", fmt.Errorf(errParamNotSpecified, "Action") + } + if rule.SourceAddressPrefix == "" { + return "", fmt.Errorf(errParamNotSpecified, "SourceAddressPrefix") + } + if rule.SourcePortRange == "" { + return "", fmt.Errorf(errParamNotSpecified, "SourcePortRange") + } + if rule.DestinationAddressPrefix == "" { + return "", fmt.Errorf(errParamNotSpecified, "DestinationAddressPrefix") + } + if rule.DestinationPortRange == "" { + return "", fmt.Errorf(errParamNotSpecified, "DestinationPortRange") + } + if rule.Protocol == "" { + return "", fmt.Errorf(errParamNotSpecified, "Protocol") + } + + data, err := xml.Marshal(rule) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(setSecurityGroupRuleURL, securityGroup, rule.Name) + return sg.client.SendAzurePutRequest(requestURL, "", data) +} + +// DeleteNetworkSecurityGroupRule deletes a network security group rule from +// the specified network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913816.aspx +func (sg SecurityGroupClient) DeleteNetworkSecurityGroupRule( + securityGroup string, + rule string) (management.OperationID, error) { + if securityGroup == "" { + return "", fmt.Errorf(errParamNotSpecified, "securityGroup") + } + if rule == "" { + return "", fmt.Errorf(errParamNotSpecified, "rule") + } + + requestURL := fmt.Sprintf(deleteSecurityGroupRuleURL, securityGroup, rule) + return sg.client.SendAzureDeleteRequest(requestURL) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/entities.go index 1a06cf2637..2c6f75757c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/networksecuritygroup/entities.go @@ -1,115 +1,115 @@ -// Package networksecuritygroup implements operations for managing network security groups -// using the Service Management REST API -// -// https://msdn.microsoft.com/en-us/library/azure/dn913824.aspx -package networksecuritygroup - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// SecurityGroupClient is used to perform operations on network security groups -type SecurityGroupClient struct { - client management.Client -} - -// SecurityGroupRequest represents a network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx -type SecurityGroupRequest struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure NetworkSecurityGroup"` - Name string - Label string `xml:",omitempty"` - Location string `xml:",omitempty"` -} - -// SecurityGroupResponse represents a network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx -type SecurityGroupResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure NetworkSecurityGroup"` - Name string - Label string `xml:",omitempty"` - Location string `xml:",omitempty"` - State SecurityGroupState `xml:",omitempty"` - Rules []RuleResponse `xml:">Rule,omitempty"` -} - -// SecurityGroupList represents a list of security groups -type SecurityGroupList []SecurityGroupResponse - -// SecurityGroupState represents a security group state -type SecurityGroupState string - -// These constants represent the possible security group states -const ( - SecurityGroupStateCreated SecurityGroupState = "Created" - SecurityGroupStateCreating SecurityGroupState = "Creating" - SecurityGroupStateUpdating SecurityGroupState = "Updating" - SecurityGroupStateDeleting SecurityGroupState = "Deleting" - SecurityGroupStateUnavailable SecurityGroupState = "Unavailable" -) - -// RuleRequest represents a single rule of a network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx#bk_rules -type RuleRequest struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Rule"` - Name string - Type RuleType - Priority int - Action RuleAction - SourceAddressPrefix string - SourcePortRange string - DestinationAddressPrefix string - DestinationPortRange string - Protocol RuleProtocol -} - -// RuleResponse represents a single rule of a network security group -// -// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx#bk_rules -type RuleResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Rule"` - Name string - Type RuleType - Priority int - Action RuleAction - SourceAddressPrefix string - SourcePortRange string - DestinationAddressPrefix string - DestinationPortRange string - Protocol RuleProtocol - State string `xml:",omitempty"` - IsDefault bool `xml:",omitempty"` -} - -// RuleType represents a rule type -type RuleType string - -// These constants represent the possible rule types -const ( - RuleTypeInbound RuleType = "Inbound" - RuleTypeOutbound RuleType = "Outbound" -) - -// RuleAction represents a rule action -type RuleAction string - -// These constants represent the possible rule actions -const ( - RuleActionAllow RuleAction = "Allow" - RuleActionDeny RuleAction = "Deny" -) - -// RuleProtocol represents a rule protocol -type RuleProtocol string - -// These constants represent the possible rule types -const ( - RuleProtocolTCP RuleProtocol = "TCP" - RuleProtocolUDP RuleProtocol = "UDP" - RuleProtocolAll RuleProtocol = "*" -) +// Package networksecuritygroup implements operations for managing network security groups +// using the Service Management REST API +// +// https://msdn.microsoft.com/en-us/library/azure/dn913824.aspx +package networksecuritygroup + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// SecurityGroupClient is used to perform operations on network security groups +type SecurityGroupClient struct { + client management.Client +} + +// SecurityGroupRequest represents a network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx +type SecurityGroupRequest struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure NetworkSecurityGroup"` + Name string + Label string `xml:",omitempty"` + Location string `xml:",omitempty"` +} + +// SecurityGroupResponse represents a network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx +type SecurityGroupResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure NetworkSecurityGroup"` + Name string + Label string `xml:",omitempty"` + Location string `xml:",omitempty"` + State SecurityGroupState `xml:",omitempty"` + Rules []RuleResponse `xml:">Rule,omitempty"` +} + +// SecurityGroupList represents a list of security groups +type SecurityGroupList []SecurityGroupResponse + +// SecurityGroupState represents a security group state +type SecurityGroupState string + +// These constants represent the possible security group states +const ( + SecurityGroupStateCreated SecurityGroupState = "Created" + SecurityGroupStateCreating SecurityGroupState = "Creating" + SecurityGroupStateUpdating SecurityGroupState = "Updating" + SecurityGroupStateDeleting SecurityGroupState = "Deleting" + SecurityGroupStateUnavailable SecurityGroupState = "Unavailable" +) + +// RuleRequest represents a single rule of a network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx#bk_rules +type RuleRequest struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Rule"` + Name string + Type RuleType + Priority int + Action RuleAction + SourceAddressPrefix string + SourcePortRange string + DestinationAddressPrefix string + DestinationPortRange string + Protocol RuleProtocol +} + +// RuleResponse represents a single rule of a network security group +// +// https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx#bk_rules +type RuleResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Rule"` + Name string + Type RuleType + Priority int + Action RuleAction + SourceAddressPrefix string + SourcePortRange string + DestinationAddressPrefix string + DestinationPortRange string + Protocol RuleProtocol + State string `xml:",omitempty"` + IsDefault bool `xml:",omitempty"` +} + +// RuleType represents a rule type +type RuleType string + +// These constants represent the possible rule types +const ( + RuleTypeInbound RuleType = "Inbound" + RuleTypeOutbound RuleType = "Outbound" +) + +// RuleAction represents a rule action +type RuleAction string + +// These constants represent the possible rule actions +const ( + RuleActionAllow RuleAction = "Allow" + RuleActionDeny RuleAction = "Deny" +) + +// RuleProtocol represents a rule protocol +type RuleProtocol string + +// These constants represent the possible rule types +const ( + RuleProtocolTCP RuleProtocol = "TCP" + RuleProtocolUDP RuleProtocol = "UDP" + RuleProtocolAll RuleProtocol = "*" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/management/operations.go index 7043ad2cd1..4f6acb217a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/operations.go @@ -1,92 +1,92 @@ -package management - -import ( - "encoding/xml" - "errors" - "fmt" - "time" -) - -var ( - // ErrOperationCancelled from WaitForOperation when the polling loop is - // cancelled through signaling the channel. - ErrOperationCancelled = errors.New("Polling for operation status cancelled") -) - -// GetOperationStatusResponse represents an in-flight operation. Use -// client.GetOperationStatus() to get the operation given the operation ID, or -// use WaitForOperation() to poll and wait until the operation has completed. -// See https://msdn.microsoft.com/en-us/library/azure/ee460783.aspx -type GetOperationStatusResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Operation"` - ID string - Status OperationStatus - HTTPStatusCode string - Error *AzureError -} - -// OperationStatus describes the states an Microsoft Azure Service Management -// operation an be in. -type OperationStatus string - -// List of states an operation can be reported as -const ( - OperationStatusInProgress OperationStatus = "InProgress" - OperationStatusSucceeded OperationStatus = "Succeeded" - OperationStatusFailed OperationStatus = "Failed" -) - -// OperationID is assigned by Azure API and can be used to look up the status of -// an operation -type OperationID string - -func (c client) GetOperationStatus(operationID OperationID) (GetOperationStatusResponse, error) { - operation := GetOperationStatusResponse{} - if operationID == "" { - return operation, fmt.Errorf(errParamNotSpecified, "operationID") - } - - url := fmt.Sprintf("operations/%s", operationID) - response, azureErr := c.SendAzureGetRequest(url) - if azureErr != nil { - return operation, azureErr - } - - err := xml.Unmarshal(response, &operation) - return operation, err -} - -func (c client) WaitForOperation(operationID OperationID, cancel chan struct{}) error { - for { - done, err := c.checkOperationStatus(operationID) - if err != nil || done { - return err - } - select { - case <-time.After(c.config.OperationPollInterval): - case <-cancel: - return ErrOperationCancelled - } - } -} - -func (c client) checkOperationStatus(id OperationID) (done bool, err error) { - op, err := c.GetOperationStatus(id) - if err != nil { - return false, fmt.Errorf("Failed to get operation status '%s': %v", id, err) - } - - switch op.Status { - case OperationStatusSucceeded: - return true, nil - case OperationStatusFailed: - if op.Error != nil { - return true, op.Error - } - return true, fmt.Errorf("Azure Operation (x-ms-request-id=%s) has failed", id) - case OperationStatusInProgress: - return false, nil - default: - return false, fmt.Errorf("Unknown operation status returned from API: %s (x-ms-request-id=%s)", op.Status, id) - } -} +package management + +import ( + "encoding/xml" + "errors" + "fmt" + "time" +) + +var ( + // ErrOperationCancelled from WaitForOperation when the polling loop is + // cancelled through signaling the channel. + ErrOperationCancelled = errors.New("Polling for operation status cancelled") +) + +// GetOperationStatusResponse represents an in-flight operation. Use +// client.GetOperationStatus() to get the operation given the operation ID, or +// use WaitForOperation() to poll and wait until the operation has completed. +// See https://msdn.microsoft.com/en-us/library/azure/ee460783.aspx +type GetOperationStatusResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Operation"` + ID string + Status OperationStatus + HTTPStatusCode string + Error *AzureError +} + +// OperationStatus describes the states an Microsoft Azure Service Management +// operation an be in. +type OperationStatus string + +// List of states an operation can be reported as +const ( + OperationStatusInProgress OperationStatus = "InProgress" + OperationStatusSucceeded OperationStatus = "Succeeded" + OperationStatusFailed OperationStatus = "Failed" +) + +// OperationID is assigned by Azure API and can be used to look up the status of +// an operation +type OperationID string + +func (c client) GetOperationStatus(operationID OperationID) (GetOperationStatusResponse, error) { + operation := GetOperationStatusResponse{} + if operationID == "" { + return operation, fmt.Errorf(errParamNotSpecified, "operationID") + } + + url := fmt.Sprintf("operations/%s", operationID) + response, azureErr := c.SendAzureGetRequest(url) + if azureErr != nil { + return operation, azureErr + } + + err := xml.Unmarshal(response, &operation) + return operation, err +} + +func (c client) WaitForOperation(operationID OperationID, cancel chan struct{}) error { + for { + done, err := c.checkOperationStatus(operationID) + if err != nil || done { + return err + } + select { + case <-time.After(c.config.OperationPollInterval): + case <-cancel: + return ErrOperationCancelled + } + } +} + +func (c client) checkOperationStatus(id OperationID) (done bool, err error) { + op, err := c.GetOperationStatus(id) + if err != nil { + return false, fmt.Errorf("Failed to get operation status '%s': %v", id, err) + } + + switch op.Status { + case OperationStatusSucceeded: + return true, nil + case OperationStatusFailed: + if op.Error != nil { + return true, op.Error + } + return true, fmt.Errorf("Azure Operation (x-ms-request-id=%s) has failed", id) + case OperationStatusInProgress: + return false, nil + default: + return false, fmt.Errorf("Unknown operation status returned from API: %s (x-ms-request-id=%s)", op.Status, id) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/client.go index 01a7a46517..e9af16e9b3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/client.go @@ -1,44 +1,44 @@ -// Package osimage provides a client for Operating System Images. -package osimage - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureImageListURL = "services/images" - errInvalidImage = "Can not find image %s in specified subscription, please specify another image name." - errParamNotSpecified = "Parameter %s is not specified." -) - -// NewClient is used to instantiate a new OSImageClient from an Azure client. -func NewClient(client management.Client) OSImageClient { - return OSImageClient{client: client} -} - -func (c OSImageClient) ListOSImages() (ListOSImagesResponse, error) { - var l ListOSImagesResponse - - response, err := c.client.SendAzureGetRequest(azureImageListURL) - if err != nil { - return l, err - } - - err = xml.Unmarshal(response, &l) - return l, err -} - -// AddOSImage adds an operating system image to the image repository that is associated with the specified subscription. -// -// See https://msdn.microsoft.com/en-us/library/azure/jj157192.aspx for details. -func (c OSImageClient) AddOSImage(osi *OSImage) (management.OperationID, error) { - data, err := xml.Marshal(osi) - if err != nil { - return "", err - } - - return c.client.SendAzurePostRequest(azureImageListURL, data) - -} +// Package osimage provides a client for Operating System Images. +package osimage + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureImageListURL = "services/images" + errInvalidImage = "Can not find image %s in specified subscription, please specify another image name." + errParamNotSpecified = "Parameter %s is not specified." +) + +// NewClient is used to instantiate a new OSImageClient from an Azure client. +func NewClient(client management.Client) OSImageClient { + return OSImageClient{client: client} +} + +func (c OSImageClient) ListOSImages() (ListOSImagesResponse, error) { + var l ListOSImagesResponse + + response, err := c.client.SendAzureGetRequest(azureImageListURL) + if err != nil { + return l, err + } + + err = xml.Unmarshal(response, &l) + return l, err +} + +// AddOSImage adds an operating system image to the image repository that is associated with the specified subscription. +// +// See https://msdn.microsoft.com/en-us/library/azure/jj157192.aspx for details. +func (c OSImageClient) AddOSImage(osi *OSImage) (management.OperationID, error) { + data, err := xml.Marshal(osi) + if err != nil { + return "", err + } + + return c.client.SendAzurePostRequest(azureImageListURL, data) + +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/entities.go index 1b3fb2de74..25577c16ee 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/osimage/entities.go @@ -1,49 +1,49 @@ -package osimage - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// OSImageClient is used to perform operations on Azure Locations -type OSImageClient struct { - client management.Client -} - -type ListOSImagesResponse struct { - XMLName xml.Name `xml:"Images"` - OSImages []OSImage `xml:"OSImage"` -} - -type OSImage struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure OSImage"` - Category string // Public || Private || MSDN - Label string // Specifies an identifier for the image. - LogicalSizeInGB float64 //Specifies the size, in GB, of the image. - Name string // Specifies the name of the operating system image. This is the name that is used when creating one or more virtual machines using the image. - OS string // Linux || Windows - Eula string // Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA. - Description string // Specifies the description of the image. - Location string // The geo-location in which this media is located. The Location value is derived from storage account that contains the blob in which the media is located. If the storage account belongs to an affinity group the value is NULL. - AffinityGroup string // Specifies the affinity in which the media is located. The AffinityGroup value is derived from storage account that contains the blob in which the media is located. If the storage account does not belong to an affinity group the value is NULL and the element is not displayed in the response. This value is NULL for platform images. - MediaLink string // Specifies the location of the vhd file for the image. The storage account where the vhd is located must be associated with the specified subscription. - ImageFamily string // Specifies a value that can be used to group images. - PublishedDate string // Specifies the date when the image was added to the image repository. - IsPremium string // Indicates whether the image contains software or associated services that will incur charges above the core price for the virtual machine. For additional details, see the PricingDetailLink element. - PrivacyURI string `xml:"PrivacyUri"` // Specifies the URI that points to a document that contains the privacy policy related to the image. - RecommendedVMSize string // Specifies the size to use for the virtual machine that is created from the image. - PublisherName string // The name of the publisher of the image. All user images have a publisher name of User. - PricingDetailLink string // Specifies a URL for an image with IsPremium set to true, which contains the pricing details for a virtual machine that is created from the image. - IconURI string `xml:"IconUri"` // Specifies the Uri to the icon that is displayed for the image in the Management Portal. - SmallIconURI string `xml:"SmallIconUri"` // Specifies the URI to the small icon that is displayed when the image is presented in the Microsoft Azure Management Portal. - Language string // Specifies the language of the image. - IOType IOType // Provisioned || Standard -} - -type IOType string - -const ( - IOTypeProvisioned IOType = "Provisioned" - IOTypeStandard IOType = "Standard" -) +package osimage + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// OSImageClient is used to perform operations on Azure Locations +type OSImageClient struct { + client management.Client +} + +type ListOSImagesResponse struct { + XMLName xml.Name `xml:"Images"` + OSImages []OSImage `xml:"OSImage"` +} + +type OSImage struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure OSImage"` + Category string // Public || Private || MSDN + Label string // Specifies an identifier for the image. + LogicalSizeInGB float64 //Specifies the size, in GB, of the image. + Name string // Specifies the name of the operating system image. This is the name that is used when creating one or more virtual machines using the image. + OS string // Linux || Windows + Eula string // Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA. + Description string // Specifies the description of the image. + Location string // The geo-location in which this media is located. The Location value is derived from storage account that contains the blob in which the media is located. If the storage account belongs to an affinity group the value is NULL. + AffinityGroup string // Specifies the affinity in which the media is located. The AffinityGroup value is derived from storage account that contains the blob in which the media is located. If the storage account does not belong to an affinity group the value is NULL and the element is not displayed in the response. This value is NULL for platform images. + MediaLink string // Specifies the location of the vhd file for the image. The storage account where the vhd is located must be associated with the specified subscription. + ImageFamily string // Specifies a value that can be used to group images. + PublishedDate string // Specifies the date when the image was added to the image repository. + IsPremium string // Indicates whether the image contains software or associated services that will incur charges above the core price for the virtual machine. For additional details, see the PricingDetailLink element. + PrivacyURI string `xml:"PrivacyUri"` // Specifies the URI that points to a document that contains the privacy policy related to the image. + RecommendedVMSize string // Specifies the size to use for the virtual machine that is created from the image. + PublisherName string // The name of the publisher of the image. All user images have a publisher name of User. + PricingDetailLink string // Specifies a URL for an image with IsPremium set to true, which contains the pricing details for a virtual machine that is created from the image. + IconURI string `xml:"IconUri"` // Specifies the Uri to the icon that is displayed for the image in the Management Portal. + SmallIconURI string `xml:"SmallIconUri"` // Specifies the URI to the small icon that is displayed when the image is presented in the Microsoft Azure Management Portal. + Language string // Specifies the language of the image. + IOType IOType // Provisioned || Standard +} + +type IOType string + +const ( + IOTypeProvisioned IOType = "Provisioned" + IOTypeStandard IOType = "Standard" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/publishSettings.go b/vendor/github.com/Azure/azure-sdk-for-go/management/publishSettings.go index 9394082e86..17505536c2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/publishSettings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/publishSettings.go @@ -1,108 +1,108 @@ -package management - -import ( - "encoding/base64" - "encoding/pem" - "encoding/xml" - "fmt" - "io/ioutil" - - "golang.org/x/crypto/pkcs12" -) - -// ClientFromPublishSettingsData unmarshalls the contents of a publish settings file -// from https://manage.windowsazure.com/publishsettings. -// If subscriptionID is left empty, the first subscription in the file is used. -func ClientFromPublishSettingsData(settingsData []byte, subscriptionID string) (client Client, err error) { - return ClientFromPublishSettingsDataWithConfig(settingsData, subscriptionID, DefaultConfig()) -} - -// ClientFromPublishSettingsFile reads a publish settings file downloaded from https://manage.windowsazure.com/publishsettings. -// If subscriptionID is left empty, the first subscription in the file is used. -func ClientFromPublishSettingsFile(filePath, subscriptionID string) (client Client, err error) { - return ClientFromPublishSettingsFileWithConfig(filePath, subscriptionID, DefaultConfig()) -} - -// ClientFromPublishSettingsFileWithConfig reads a publish settings file downloaded from https://manage.windowsazure.com/publishsettings. -// If subscriptionID is left empty, the first subscription in the file is used. -func ClientFromPublishSettingsFileWithConfig(filePath, subscriptionID string, config ClientConfig) (client Client, err error) { - if filePath == "" { - return client, fmt.Errorf(errParamNotSpecified, "filePath") - } - - publishSettingsContent, err := ioutil.ReadFile(filePath) - if err != nil { - return client, err - } - - return ClientFromPublishSettingsDataWithConfig(publishSettingsContent, subscriptionID, config) -} - -// ClientFromPublishSettingsDataWithConfig unmarshalls the contents of a publish settings file -// from https://manage.windowsazure.com/publishsettings. -// If subscriptionID is left empty, the first subscription in the string is used. -func ClientFromPublishSettingsDataWithConfig(data []byte, subscriptionID string, config ClientConfig) (client Client, err error) { - publishData := publishData{} - if err = xml.Unmarshal(data, &publishData); err != nil { - return client, err - } - - for _, profile := range publishData.PublishProfiles { - for _, sub := range profile.Subscriptions { - if sub.ID == subscriptionID || subscriptionID == "" { - base64Cert := sub.ManagementCertificate - if base64Cert == "" { - base64Cert = profile.ManagementCertificate - } - - pfxData, err := base64.StdEncoding.DecodeString(base64Cert) - if err != nil { - return client, err - } - - pems, err := pkcs12.ToPEM(pfxData, "") - if err != nil { - return client, err - } - - cert := []byte{} - for _, b := range pems { - cert = append(cert, pem.EncodeToMemory(b)...) - } - - config.ManagementURL = sub.ServiceManagementURL - return makeClient(sub.ID, cert, config) - } - } - } - - return client, fmt.Errorf("could not find subscription '%s' in settings provided", subscriptionID) -} - -type publishSettings struct { - SubscriptionID string - SubscriptionCert []byte - SubscriptionKey []byte -} - -type publishData struct { - XMLName xml.Name `xml:"PublishData"` - PublishProfiles []publishProfile `xml:"PublishProfile"` -} - -type publishProfile struct { - XMLName xml.Name `xml:"PublishProfile"` - SchemaVersion string `xml:",attr"` - PublishMethod string `xml:",attr"` - URL string `xml:"Url,attr"` - ManagementCertificate string `xml:",attr"` - Subscriptions []subscription `xml:"Subscription"` -} - -type subscription struct { - XMLName xml.Name `xml:"Subscription"` - ServiceManagementURL string `xml:"ServiceManagementUrl,attr"` - ID string `xml:"Id,attr"` - Name string `xml:",attr"` - ManagementCertificate string `xml:",attr"` -} +package management + +import ( + "encoding/base64" + "encoding/pem" + "encoding/xml" + "fmt" + "io/ioutil" + + "golang.org/x/crypto/pkcs12" +) + +// ClientFromPublishSettingsData unmarshalls the contents of a publish settings file +// from https://manage.windowsazure.com/publishsettings. +// If subscriptionID is left empty, the first subscription in the file is used. +func ClientFromPublishSettingsData(settingsData []byte, subscriptionID string) (client Client, err error) { + return ClientFromPublishSettingsDataWithConfig(settingsData, subscriptionID, DefaultConfig()) +} + +// ClientFromPublishSettingsFile reads a publish settings file downloaded from https://manage.windowsazure.com/publishsettings. +// If subscriptionID is left empty, the first subscription in the file is used. +func ClientFromPublishSettingsFile(filePath, subscriptionID string) (client Client, err error) { + return ClientFromPublishSettingsFileWithConfig(filePath, subscriptionID, DefaultConfig()) +} + +// ClientFromPublishSettingsFileWithConfig reads a publish settings file downloaded from https://manage.windowsazure.com/publishsettings. +// If subscriptionID is left empty, the first subscription in the file is used. +func ClientFromPublishSettingsFileWithConfig(filePath, subscriptionID string, config ClientConfig) (client Client, err error) { + if filePath == "" { + return client, fmt.Errorf(errParamNotSpecified, "filePath") + } + + publishSettingsContent, err := ioutil.ReadFile(filePath) + if err != nil { + return client, err + } + + return ClientFromPublishSettingsDataWithConfig(publishSettingsContent, subscriptionID, config) +} + +// ClientFromPublishSettingsDataWithConfig unmarshalls the contents of a publish settings file +// from https://manage.windowsazure.com/publishsettings. +// If subscriptionID is left empty, the first subscription in the string is used. +func ClientFromPublishSettingsDataWithConfig(data []byte, subscriptionID string, config ClientConfig) (client Client, err error) { + publishData := publishData{} + if err = xml.Unmarshal(data, &publishData); err != nil { + return client, err + } + + for _, profile := range publishData.PublishProfiles { + for _, sub := range profile.Subscriptions { + if sub.ID == subscriptionID || subscriptionID == "" { + base64Cert := sub.ManagementCertificate + if base64Cert == "" { + base64Cert = profile.ManagementCertificate + } + + pfxData, err := base64.StdEncoding.DecodeString(base64Cert) + if err != nil { + return client, err + } + + pems, err := pkcs12.ToPEM(pfxData, "") + if err != nil { + return client, err + } + + cert := []byte{} + for _, b := range pems { + cert = append(cert, pem.EncodeToMemory(b)...) + } + + config.ManagementURL = sub.ServiceManagementURL + return makeClient(sub.ID, cert, config) + } + } + } + + return client, fmt.Errorf("could not find subscription '%s' in settings provided", subscriptionID) +} + +type publishSettings struct { + SubscriptionID string + SubscriptionCert []byte + SubscriptionKey []byte +} + +type publishData struct { + XMLName xml.Name `xml:"PublishData"` + PublishProfiles []publishProfile `xml:"PublishProfile"` +} + +type publishProfile struct { + XMLName xml.Name `xml:"PublishProfile"` + SchemaVersion string `xml:",attr"` + PublishMethod string `xml:",attr"` + URL string `xml:"Url,attr"` + ManagementCertificate string `xml:",attr"` + Subscriptions []subscription `xml:"Subscription"` +} + +type subscription struct { + XMLName xml.Name `xml:"Subscription"` + ServiceManagementURL string `xml:"ServiceManagementUrl,attr"` + ID string `xml:"Id,attr"` + Name string `xml:",attr"` + ManagementCertificate string `xml:",attr"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/sql/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/sql/client.go index 1b0a09eb76..970c3f6449 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/sql/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/sql/client.go @@ -1,316 +1,316 @@ -package sql - -import ( - "encoding/xml" - "fmt" - "time" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// Definitions of numerous constants representing API endpoints. -const ( - azureCreateDatabaseServerURL = "services/sqlservers/servers" - azureListDatabaseServersURL = "services/sqlservers/servers" - azureDeleteDatabaseServerURL = "services/sqlservers/servers/%s" - - azureCreateFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules" - azureGetFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules/%s" - azureListFirewallRulesURL = "services/sqlservers/servers/%s/firewallrules" - azureUpdateFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules/%s" - azureDeleteFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules/%s" - - azureCreateDatabaseURL = "services/sqlservers/servers/%s/databases" - azureGetDatabaseURL = "services/sqlservers/servers/%s/databases/%s" - azureListDatabasesURL = "services/sqlservers/servers/%s/databases?contentview=generic" - azureUpdateDatabaseURL = "services/sqlservers/servers/%s/databases/%s" - azureDeleteDatabaseURL = "services/sqlservers/servers/%s/databases/%s" - - errParamNotSpecified = "Parameter %s was not specified." - - DatabaseStateCreating = "Creating" -) - -// SQLDatabaseClient defines various database CRUD operations. -// It contains a management.Client for making the actual http calls. -type SQLDatabaseClient struct { - mgmtClient management.Client -} - -// NewClient returns a new SQLDatabaseClient struct with the provided -// management.Client as the underlying client. -func NewClient(mgmtClient management.Client) SQLDatabaseClient { - return SQLDatabaseClient{mgmtClient} -} - -// CreateServer creates a new Azure SQL Database server and return its name. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505699.aspx -func (c SQLDatabaseClient) CreateServer(params DatabaseServerCreateParams) (string, error) { - req, err := xml.Marshal(params) - if err != nil { - return "", err - } - - resp, err := c.mgmtClient.SendAzurePostRequestWithReturnedResponse(azureCreateDatabaseServerURL, req) - if err != nil { - return "", err - } - - var name string - err = xml.Unmarshal(resp, &name) - - return name, err -} - -// ListServers retrieves the Azure SQL Database servers for this subscription. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx -func (c SQLDatabaseClient) ListServers() (ListServersResponse, error) { - var resp ListServersResponse - - data, err := c.mgmtClient.SendAzureGetRequest(azureListDatabaseServersURL) - if err != nil { - return resp, err - } - - err = xml.Unmarshal(data, &resp) - return resp, err -} - -// DeleteServer deletes an Azure SQL Database server (including all its databases). -// -// https://msdn.microsoft.com/en-us/library/azure/dn505695.aspx -func (c SQLDatabaseClient) DeleteServer(name string) error { - if name == "" { - return fmt.Errorf(errParamNotSpecified, "name") - } - - url := fmt.Sprintf(azureDeleteDatabaseServerURL, name) - _, err := c.mgmtClient.SendAzureDeleteRequest(url) - return err -} - -// CreateFirewallRule creates an Azure SQL Database server -// firewall rule. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx -func (c SQLDatabaseClient) CreateFirewallRule(server string, params FirewallRuleCreateParams) error { - if server == "" { - return fmt.Errorf(errParamNotSpecified, "server") - } - - req, err := xml.Marshal(params) - if err != nil { - return err - } - - url := fmt.Sprintf(azureCreateFirewallRuleURL, server) - - _, err = c.mgmtClient.SendAzurePostRequest(url, req) - return err -} - -// GetFirewallRule gets the details of an Azure SQL Database Server firewall rule. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx -func (c SQLDatabaseClient) GetFirewallRule(server, ruleName string) (FirewallRuleResponse, error) { - var rule FirewallRuleResponse - - if server == "" { - return rule, fmt.Errorf(errParamNotSpecified, "server") - } - if ruleName == "" { - return rule, fmt.Errorf(errParamNotSpecified, "ruleName") - } - - url := fmt.Sprintf(azureGetFirewallRuleURL, server, ruleName) - resp, err := c.mgmtClient.SendAzureGetRequest(url) - if err != nil { - return rule, err - } - - err = xml.Unmarshal(resp, &rule) - return rule, err -} - -// ListFirewallRules retrieves the set of firewall rules for an Azure SQL -// Database Server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505715.aspx -func (c SQLDatabaseClient) ListFirewallRules(server string) (ListFirewallRulesResponse, error) { - var rules ListFirewallRulesResponse - - if server == "" { - return rules, fmt.Errorf(errParamNotSpecified, "server") - } - - url := fmt.Sprintf(azureListFirewallRulesURL, server) - resp, err := c.mgmtClient.SendAzureGetRequest(url) - if err != nil { - return rules, err - } - - err = xml.Unmarshal(resp, &rules) - return rules, err -} - -// UpdateFirewallRule update a firewall rule for an Azure SQL Database server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505707.aspx -func (c SQLDatabaseClient) UpdateFirewallRule(server, ruleName string, params FirewallRuleUpdateParams) error { - if server == "" { - return fmt.Errorf(errParamNotSpecified, "server") - } - if ruleName == "" { - return fmt.Errorf(errParamNotSpecified, "ruleName") - } - - req, err := xml.Marshal(params) - if err != nil { - return err - } - - url := fmt.Sprintf(azureUpdateFirewallRuleURL, server, ruleName) - _, err = c.mgmtClient.SendAzurePutRequest(url, "text/xml", req) - return err -} - -// DeleteFirewallRule deletes an Azure SQL Database server firewall rule. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505706.aspx -func (c SQLDatabaseClient) DeleteFirewallRule(server, ruleName string) error { - if server == "" { - return fmt.Errorf(errParamNotSpecified, "server") - } - if ruleName == "" { - return fmt.Errorf(errParamNotSpecified, "ruleName") - } - - url := fmt.Sprintf(azureDeleteFirewallRuleURL, server, ruleName) - - _, err := c.mgmtClient.SendAzureDeleteRequest(url) - return err -} - -// CreateDatabase creates a new Microsoft Azure SQL Database on the given database server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505701.aspx -func (c SQLDatabaseClient) CreateDatabase(server string, params DatabaseCreateParams) error { - if server == "" { - return fmt.Errorf(errParamNotSpecified, "server") - } - - req, err := xml.Marshal(params) - if err != nil { - return err - } - - target := fmt.Sprintf(azureCreateDatabaseURL, server) - _, err = c.mgmtClient.SendAzurePostRequest(target, req) - return err -} - -// WaitForDatabaseCreation is a helper method which waits -// for the creation of the database on the given server. -func (c SQLDatabaseClient) WaitForDatabaseCreation( - server, database string, - cancel chan struct{}) error { - for { - stat, err := c.GetDatabase(server, database) - if err != nil { - return err - } - if stat.State != DatabaseStateCreating { - return nil - } - - select { - case <-time.After(management.DefaultOperationPollInterval): - case <-cancel: - return management.ErrOperationCancelled - } - } -} - -// GetDatabase gets the details for an Azure SQL Database. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505708.aspx -func (c SQLDatabaseClient) GetDatabase(server, database string) (ServiceResource, error) { - var db ServiceResource - - if database == "" { - return db, fmt.Errorf(errParamNotSpecified, "database") - } - if server == "" { - return db, fmt.Errorf(errParamNotSpecified, "server") - } - - url := fmt.Sprintf(azureGetDatabaseURL, server, database) - resp, err := c.mgmtClient.SendAzureGetRequest(url) - if err != nil { - return db, err - } - - err = xml.Unmarshal(resp, &db) - return db, err -} - -// ListDatabases returns a list of Azure SQL Databases on the given server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505711.aspx -func (c SQLDatabaseClient) ListDatabases(server string) (ListDatabasesResponse, error) { - var databases ListDatabasesResponse - if server == "" { - return databases, fmt.Errorf(errParamNotSpecified, "server name") - } - - url := fmt.Sprintf(azureListDatabasesURL, server) - resp, err := c.mgmtClient.SendAzureGetRequest(url) - if err != nil { - return databases, err - } - - err = xml.Unmarshal(resp, &databases) - return databases, err -} - -// UpdateDatabase updates the details of the given Database off the given server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505718.aspx -func (c SQLDatabaseClient) UpdateDatabase( - server, database string, - params ServiceResourceUpdateParams) (management.OperationID, error) { - if database == "" { - return "", fmt.Errorf(errParamNotSpecified, "database") - } - if server == "" { - return "", fmt.Errorf(errParamNotSpecified, "server") - } - - url := fmt.Sprintf(azureUpdateDatabaseURL, server, database) - req, err := xml.Marshal(params) - if err != nil { - return "", err - } - - return c.mgmtClient.SendAzurePutRequest(url, "text/xml", req) -} - -// DeleteDatabase deletes the Azure SQL Database off the given server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505705.aspx -func (c SQLDatabaseClient) DeleteDatabase(server, database string) error { - if database == "" { - return fmt.Errorf(errParamNotSpecified, "database") - } - if server == "" { - return fmt.Errorf(errParamNotSpecified, "server") - } - - url := fmt.Sprintf(azureDeleteDatabaseURL, server, database) - - _, err := c.mgmtClient.SendAzureDeleteRequest(url) - - return err -} +package sql + +import ( + "encoding/xml" + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// Definitions of numerous constants representing API endpoints. +const ( + azureCreateDatabaseServerURL = "services/sqlservers/servers" + azureListDatabaseServersURL = "services/sqlservers/servers" + azureDeleteDatabaseServerURL = "services/sqlservers/servers/%s" + + azureCreateFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules" + azureGetFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules/%s" + azureListFirewallRulesURL = "services/sqlservers/servers/%s/firewallrules" + azureUpdateFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules/%s" + azureDeleteFirewallRuleURL = "services/sqlservers/servers/%s/firewallrules/%s" + + azureCreateDatabaseURL = "services/sqlservers/servers/%s/databases" + azureGetDatabaseURL = "services/sqlservers/servers/%s/databases/%s" + azureListDatabasesURL = "services/sqlservers/servers/%s/databases?contentview=generic" + azureUpdateDatabaseURL = "services/sqlservers/servers/%s/databases/%s" + azureDeleteDatabaseURL = "services/sqlservers/servers/%s/databases/%s" + + errParamNotSpecified = "Parameter %s was not specified." + + DatabaseStateCreating = "Creating" +) + +// SQLDatabaseClient defines various database CRUD operations. +// It contains a management.Client for making the actual http calls. +type SQLDatabaseClient struct { + mgmtClient management.Client +} + +// NewClient returns a new SQLDatabaseClient struct with the provided +// management.Client as the underlying client. +func NewClient(mgmtClient management.Client) SQLDatabaseClient { + return SQLDatabaseClient{mgmtClient} +} + +// CreateServer creates a new Azure SQL Database server and return its name. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505699.aspx +func (c SQLDatabaseClient) CreateServer(params DatabaseServerCreateParams) (string, error) { + req, err := xml.Marshal(params) + if err != nil { + return "", err + } + + resp, err := c.mgmtClient.SendAzurePostRequestWithReturnedResponse(azureCreateDatabaseServerURL, req) + if err != nil { + return "", err + } + + var name string + err = xml.Unmarshal(resp, &name) + + return name, err +} + +// ListServers retrieves the Azure SQL Database servers for this subscription. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx +func (c SQLDatabaseClient) ListServers() (ListServersResponse, error) { + var resp ListServersResponse + + data, err := c.mgmtClient.SendAzureGetRequest(azureListDatabaseServersURL) + if err != nil { + return resp, err + } + + err = xml.Unmarshal(data, &resp) + return resp, err +} + +// DeleteServer deletes an Azure SQL Database server (including all its databases). +// +// https://msdn.microsoft.com/en-us/library/azure/dn505695.aspx +func (c SQLDatabaseClient) DeleteServer(name string) error { + if name == "" { + return fmt.Errorf(errParamNotSpecified, "name") + } + + url := fmt.Sprintf(azureDeleteDatabaseServerURL, name) + _, err := c.mgmtClient.SendAzureDeleteRequest(url) + return err +} + +// CreateFirewallRule creates an Azure SQL Database server +// firewall rule. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx +func (c SQLDatabaseClient) CreateFirewallRule(server string, params FirewallRuleCreateParams) error { + if server == "" { + return fmt.Errorf(errParamNotSpecified, "server") + } + + req, err := xml.Marshal(params) + if err != nil { + return err + } + + url := fmt.Sprintf(azureCreateFirewallRuleURL, server) + + _, err = c.mgmtClient.SendAzurePostRequest(url, req) + return err +} + +// GetFirewallRule gets the details of an Azure SQL Database Server firewall rule. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx +func (c SQLDatabaseClient) GetFirewallRule(server, ruleName string) (FirewallRuleResponse, error) { + var rule FirewallRuleResponse + + if server == "" { + return rule, fmt.Errorf(errParamNotSpecified, "server") + } + if ruleName == "" { + return rule, fmt.Errorf(errParamNotSpecified, "ruleName") + } + + url := fmt.Sprintf(azureGetFirewallRuleURL, server, ruleName) + resp, err := c.mgmtClient.SendAzureGetRequest(url) + if err != nil { + return rule, err + } + + err = xml.Unmarshal(resp, &rule) + return rule, err +} + +// ListFirewallRules retrieves the set of firewall rules for an Azure SQL +// Database Server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505715.aspx +func (c SQLDatabaseClient) ListFirewallRules(server string) (ListFirewallRulesResponse, error) { + var rules ListFirewallRulesResponse + + if server == "" { + return rules, fmt.Errorf(errParamNotSpecified, "server") + } + + url := fmt.Sprintf(azureListFirewallRulesURL, server) + resp, err := c.mgmtClient.SendAzureGetRequest(url) + if err != nil { + return rules, err + } + + err = xml.Unmarshal(resp, &rules) + return rules, err +} + +// UpdateFirewallRule update a firewall rule for an Azure SQL Database server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505707.aspx +func (c SQLDatabaseClient) UpdateFirewallRule(server, ruleName string, params FirewallRuleUpdateParams) error { + if server == "" { + return fmt.Errorf(errParamNotSpecified, "server") + } + if ruleName == "" { + return fmt.Errorf(errParamNotSpecified, "ruleName") + } + + req, err := xml.Marshal(params) + if err != nil { + return err + } + + url := fmt.Sprintf(azureUpdateFirewallRuleURL, server, ruleName) + _, err = c.mgmtClient.SendAzurePutRequest(url, "text/xml", req) + return err +} + +// DeleteFirewallRule deletes an Azure SQL Database server firewall rule. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505706.aspx +func (c SQLDatabaseClient) DeleteFirewallRule(server, ruleName string) error { + if server == "" { + return fmt.Errorf(errParamNotSpecified, "server") + } + if ruleName == "" { + return fmt.Errorf(errParamNotSpecified, "ruleName") + } + + url := fmt.Sprintf(azureDeleteFirewallRuleURL, server, ruleName) + + _, err := c.mgmtClient.SendAzureDeleteRequest(url) + return err +} + +// CreateDatabase creates a new Microsoft Azure SQL Database on the given database server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505701.aspx +func (c SQLDatabaseClient) CreateDatabase(server string, params DatabaseCreateParams) error { + if server == "" { + return fmt.Errorf(errParamNotSpecified, "server") + } + + req, err := xml.Marshal(params) + if err != nil { + return err + } + + target := fmt.Sprintf(azureCreateDatabaseURL, server) + _, err = c.mgmtClient.SendAzurePostRequest(target, req) + return err +} + +// WaitForDatabaseCreation is a helper method which waits +// for the creation of the database on the given server. +func (c SQLDatabaseClient) WaitForDatabaseCreation( + server, database string, + cancel chan struct{}) error { + for { + stat, err := c.GetDatabase(server, database) + if err != nil { + return err + } + if stat.State != DatabaseStateCreating { + return nil + } + + select { + case <-time.After(management.DefaultOperationPollInterval): + case <-cancel: + return management.ErrOperationCancelled + } + } +} + +// GetDatabase gets the details for an Azure SQL Database. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505708.aspx +func (c SQLDatabaseClient) GetDatabase(server, database string) (ServiceResource, error) { + var db ServiceResource + + if database == "" { + return db, fmt.Errorf(errParamNotSpecified, "database") + } + if server == "" { + return db, fmt.Errorf(errParamNotSpecified, "server") + } + + url := fmt.Sprintf(azureGetDatabaseURL, server, database) + resp, err := c.mgmtClient.SendAzureGetRequest(url) + if err != nil { + return db, err + } + + err = xml.Unmarshal(resp, &db) + return db, err +} + +// ListDatabases returns a list of Azure SQL Databases on the given server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505711.aspx +func (c SQLDatabaseClient) ListDatabases(server string) (ListDatabasesResponse, error) { + var databases ListDatabasesResponse + if server == "" { + return databases, fmt.Errorf(errParamNotSpecified, "server name") + } + + url := fmt.Sprintf(azureListDatabasesURL, server) + resp, err := c.mgmtClient.SendAzureGetRequest(url) + if err != nil { + return databases, err + } + + err = xml.Unmarshal(resp, &databases) + return databases, err +} + +// UpdateDatabase updates the details of the given Database off the given server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505718.aspx +func (c SQLDatabaseClient) UpdateDatabase( + server, database string, + params ServiceResourceUpdateParams) (management.OperationID, error) { + if database == "" { + return "", fmt.Errorf(errParamNotSpecified, "database") + } + if server == "" { + return "", fmt.Errorf(errParamNotSpecified, "server") + } + + url := fmt.Sprintf(azureUpdateDatabaseURL, server, database) + req, err := xml.Marshal(params) + if err != nil { + return "", err + } + + return c.mgmtClient.SendAzurePutRequest(url, "text/xml", req) +} + +// DeleteDatabase deletes the Azure SQL Database off the given server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505705.aspx +func (c SQLDatabaseClient) DeleteDatabase(server, database string) error { + if database == "" { + return fmt.Errorf(errParamNotSpecified, "database") + } + if server == "" { + return fmt.Errorf(errParamNotSpecified, "server") + } + + url := fmt.Sprintf(azureDeleteDatabaseURL, server, database) + + _, err := c.mgmtClient.SendAzureDeleteRequest(url) + + return err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/sql/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/sql/entities.go index ab2cb6d107..bed6a05bd3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/sql/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/sql/entities.go @@ -1,124 +1,124 @@ -package sql - -import ( - "encoding/xml" -) - -// DatabaseServerCreateParams represents the set of possible parameters -// when issuing a database server creation request to Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505699.aspx -type DatabaseServerCreateParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/sqlazure/2010/12/ Server"` - AdministratorLogin string - AdministratorLoginPassword string - Location string - Version string -} - -// DatabaseServerCreateResponse represents the response following the creation of -// a database server on Azure. -type DatabaseServerCreateResponse struct { - ServerName string -} - -const ( - DatabaseServerVersion11 = "2.0" - DatabaseServerVersion12 = "12.0" -) - -// DatabaseServer represents the set of data received from -// a database server list operation. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx -type DatabaseServer struct { - Name string - AdministratorLogin string - Location string - FullyQualifiedDomainName string - Version string - State string -} - -type ListServersResponse struct { - DatabaseServers []DatabaseServer `xml:"Server"` -} - -// FirewallRuleCreateParams represents the set of possible -// parameters when creating a firewall rule on an Azure database server. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx -type FirewallRuleCreateParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` - Name string - StartIPAddress string - EndIPAddress string -} - -// FirewallRuleResponse represents the set of data received from -// an Azure database server firewall rule get response. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx -type FirewallRuleResponse struct { - Name string - StartIPAddress string - EndIPAddress string -} - -type ListFirewallRulesResponse struct { - FirewallRules []FirewallRuleResponse `xml:"ServiceResource"` -} - -// FirewallRuleUpdateParams represents the set of possible -// parameters when issuing an update of a database server firewall rule. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505707.aspx -type FirewallRuleUpdateParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` - Name string - StartIPAddress string - EndIPAddress string -} - -// DatabaseCreateParams represents the set of possible parameters when issuing -// a database creation to Azure, and reading a list response from Azure. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505701.aspx -type DatabaseCreateParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` - Name string - Edition string `xml:",omitempty"` - CollationName string `xml:",omitempty"` - MaxSizeBytes int64 `xml:",omitempty"` - ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"` -} - -// ServiceResource represents the set of parameters obtained from a database -// get or list call. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505708.aspx -type ServiceResource struct { - Name string - State string - SelfLink string - Edition string - CollationName string - MaxSizeBytes int64 - ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"` -} - -type ListDatabasesResponse struct { - ServiceResources []ServiceResource `xml:"ServiceResource"` -} - -// ServiceResourceUpdateParams represents the set of parameters available -// for a database service update operation. -// -// https://msdn.microsoft.com/en-us/library/azure/dn505718.aspx -type ServiceResourceUpdateParams struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` - Name string - Edition string `xml:",omitempty"` - MaxSizeBytes int64 `xml:",omitempty"` - ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"` -} +package sql + +import ( + "encoding/xml" +) + +// DatabaseServerCreateParams represents the set of possible parameters +// when issuing a database server creation request to Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505699.aspx +type DatabaseServerCreateParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/sqlazure/2010/12/ Server"` + AdministratorLogin string + AdministratorLoginPassword string + Location string + Version string +} + +// DatabaseServerCreateResponse represents the response following the creation of +// a database server on Azure. +type DatabaseServerCreateResponse struct { + ServerName string +} + +const ( + DatabaseServerVersion11 = "2.0" + DatabaseServerVersion12 = "12.0" +) + +// DatabaseServer represents the set of data received from +// a database server list operation. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505702.aspx +type DatabaseServer struct { + Name string + AdministratorLogin string + Location string + FullyQualifiedDomainName string + Version string + State string +} + +type ListServersResponse struct { + DatabaseServers []DatabaseServer `xml:"Server"` +} + +// FirewallRuleCreateParams represents the set of possible +// parameters when creating a firewall rule on an Azure database server. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505712.aspx +type FirewallRuleCreateParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` + Name string + StartIPAddress string + EndIPAddress string +} + +// FirewallRuleResponse represents the set of data received from +// an Azure database server firewall rule get response. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505698.aspx +type FirewallRuleResponse struct { + Name string + StartIPAddress string + EndIPAddress string +} + +type ListFirewallRulesResponse struct { + FirewallRules []FirewallRuleResponse `xml:"ServiceResource"` +} + +// FirewallRuleUpdateParams represents the set of possible +// parameters when issuing an update of a database server firewall rule. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505707.aspx +type FirewallRuleUpdateParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` + Name string + StartIPAddress string + EndIPAddress string +} + +// DatabaseCreateParams represents the set of possible parameters when issuing +// a database creation to Azure, and reading a list response from Azure. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505701.aspx +type DatabaseCreateParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` + Name string + Edition string `xml:",omitempty"` + CollationName string `xml:",omitempty"` + MaxSizeBytes int64 `xml:",omitempty"` + ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"` +} + +// ServiceResource represents the set of parameters obtained from a database +// get or list call. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505708.aspx +type ServiceResource struct { + Name string + State string + SelfLink string + Edition string + CollationName string + MaxSizeBytes int64 + ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"` +} + +type ListDatabasesResponse struct { + ServiceResources []ServiceResource `xml:"ServiceResource"` +} + +// ServiceResourceUpdateParams represents the set of parameters available +// for a database service update operation. +// +// https://msdn.microsoft.com/en-us/library/azure/dn505718.aspx +type ServiceResourceUpdateParams struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ServiceResource"` + Name string + Edition string `xml:",omitempty"` + MaxSizeBytes int64 `xml:",omitempty"` + ServiceObjectiveID string `xml:"ServiceObjectiveId,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/client.go index 5c7ab21796..dad87e6dbf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/client.go @@ -1,108 +1,108 @@ -// Package storageservice provides a client for Storage Services. -package storageservice - -import ( - "encoding/xml" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureStorageServiceListURL = "services/storageservices" - azureStorageServiceURL = "services/storageservices/%s" - azureStorageServiceKeysURL = "services/storageservices/%s/keys" - azureStorageAccountAvailabilityURL = "services/storageservices/operations/isavailable/%s" - - azureXmlns = "http://schemas.microsoft.com/windowsazure" - - errParamNotSpecified = "Parameter %s is not specified." -) - -// NewClient is used to instantiate a new StorageServiceClient from an Azure -// client. -func NewClient(s management.Client) StorageServiceClient { - return StorageServiceClient{client: s} -} - -func (s StorageServiceClient) ListStorageServices() (ListStorageServicesResponse, error) { - var l ListStorageServicesResponse - response, err := s.client.SendAzureGetRequest(azureStorageServiceListURL) - if err != nil { - return l, err - } - - err = xml.Unmarshal(response, &l) - return l, err -} - -func (s StorageServiceClient) GetStorageService(serviceName string) (StorageServiceResponse, error) { - var svc StorageServiceResponse - if serviceName == "" { - return svc, fmt.Errorf(errParamNotSpecified, "serviceName") - } - - requestURL := fmt.Sprintf(azureStorageServiceURL, serviceName) - response, err := s.client.SendAzureGetRequest(requestURL) - if err != nil { - return svc, err - } - - err = xml.Unmarshal(response, &svc) - return svc, err -} - -func (s StorageServiceClient) GetStorageServiceKeys(serviceName string) (GetStorageServiceKeysResponse, error) { - var r GetStorageServiceKeysResponse - if serviceName == "" { - return r, fmt.Errorf(errParamNotSpecified, "serviceName") - } - - requestURL := fmt.Sprintf(azureStorageServiceKeysURL, serviceName) - data, err := s.client.SendAzureGetRequest(requestURL) - if err != nil { - return r, err - } - - err = xml.Unmarshal(data, &r) - return r, err -} - -func (s StorageServiceClient) CreateStorageService(parameters StorageAccountCreateParameters) (management.OperationID, error) { - data, err := xml.Marshal(CreateStorageServiceInput{ - StorageAccountCreateParameters: parameters}) - if err != nil { - return "", err - } - - return s.client.SendAzurePostRequest(azureStorageServiceListURL, data) -} - -func (s StorageServiceClient) DeleteStorageService(serviceName string) (management.OperationID, error) { - if serviceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "serviceName") - } - - requestURL := fmt.Sprintf(azureStorageServiceURL, serviceName) - return s.client.SendAzureDeleteRequest(requestURL) -} - -// CheckStorageAccountNameAvailability checks to if the specified storage account -// name is available. -// -// See https://msdn.microsoft.com/en-us/library/azure/jj154125.aspx -func (s StorageServiceClient) CheckStorageAccountNameAvailability(name string) (AvailabilityResponse, error) { - var r AvailabilityResponse - if name == "" { - return r, fmt.Errorf(errParamNotSpecified, "name") - } - - requestURL := fmt.Sprintf(azureStorageAccountAvailabilityURL, name) - response, err := s.client.SendAzureGetRequest(requestURL) - if err != nil { - return r, err - } - - err = xml.Unmarshal(response, &r) - return r, err -} +// Package storageservice provides a client for Storage Services. +package storageservice + +import ( + "encoding/xml" + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureStorageServiceListURL = "services/storageservices" + azureStorageServiceURL = "services/storageservices/%s" + azureStorageServiceKeysURL = "services/storageservices/%s/keys" + azureStorageAccountAvailabilityURL = "services/storageservices/operations/isavailable/%s" + + azureXmlns = "http://schemas.microsoft.com/windowsazure" + + errParamNotSpecified = "Parameter %s is not specified." +) + +// NewClient is used to instantiate a new StorageServiceClient from an Azure +// client. +func NewClient(s management.Client) StorageServiceClient { + return StorageServiceClient{client: s} +} + +func (s StorageServiceClient) ListStorageServices() (ListStorageServicesResponse, error) { + var l ListStorageServicesResponse + response, err := s.client.SendAzureGetRequest(azureStorageServiceListURL) + if err != nil { + return l, err + } + + err = xml.Unmarshal(response, &l) + return l, err +} + +func (s StorageServiceClient) GetStorageService(serviceName string) (StorageServiceResponse, error) { + var svc StorageServiceResponse + if serviceName == "" { + return svc, fmt.Errorf(errParamNotSpecified, "serviceName") + } + + requestURL := fmt.Sprintf(azureStorageServiceURL, serviceName) + response, err := s.client.SendAzureGetRequest(requestURL) + if err != nil { + return svc, err + } + + err = xml.Unmarshal(response, &svc) + return svc, err +} + +func (s StorageServiceClient) GetStorageServiceKeys(serviceName string) (GetStorageServiceKeysResponse, error) { + var r GetStorageServiceKeysResponse + if serviceName == "" { + return r, fmt.Errorf(errParamNotSpecified, "serviceName") + } + + requestURL := fmt.Sprintf(azureStorageServiceKeysURL, serviceName) + data, err := s.client.SendAzureGetRequest(requestURL) + if err != nil { + return r, err + } + + err = xml.Unmarshal(data, &r) + return r, err +} + +func (s StorageServiceClient) CreateStorageService(parameters StorageAccountCreateParameters) (management.OperationID, error) { + data, err := xml.Marshal(CreateStorageServiceInput{ + StorageAccountCreateParameters: parameters}) + if err != nil { + return "", err + } + + return s.client.SendAzurePostRequest(azureStorageServiceListURL, data) +} + +func (s StorageServiceClient) DeleteStorageService(serviceName string) (management.OperationID, error) { + if serviceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "serviceName") + } + + requestURL := fmt.Sprintf(azureStorageServiceURL, serviceName) + return s.client.SendAzureDeleteRequest(requestURL) +} + +// CheckStorageAccountNameAvailability checks to if the specified storage account +// name is available. +// +// See https://msdn.microsoft.com/en-us/library/azure/jj154125.aspx +func (s StorageServiceClient) CheckStorageAccountNameAvailability(name string) (AvailabilityResponse, error) { + var r AvailabilityResponse + if name == "" { + return r, fmt.Errorf(errParamNotSpecified, "name") + } + + requestURL := fmt.Sprintf(azureStorageAccountAvailabilityURL, name) + response, err := s.client.SendAzureGetRequest(requestURL) + if err != nil { + return r, err + } + + err = xml.Unmarshal(response, &r) + return r, err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities.go index fa3c3742f3..2401298aa5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities.go @@ -1,79 +1,79 @@ -package storageservice - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// StorageServiceClient is used to perform operations on Azure Storage -type StorageServiceClient struct { - client management.Client -} - -type ListStorageServicesResponse struct { - StorageServices []StorageServiceResponse `xml:"StorageService"` -} - -type StorageServiceResponse struct { - URL string `xml:"Url"` - ServiceName string - StorageServiceProperties StorageServiceProperties -} - -type StorageServiceProperties struct { - Description string - Location string - Label string - Status string - Endpoints []string `xml:"Endpoints>Endpoint"` - GeoReplicationEnabled string - GeoPrimaryRegion string -} - -type GetStorageServiceKeysResponse struct { - URL string `xml:"Url"` - PrimaryKey string `xml:"StorageServiceKeys>Primary"` - SecondaryKey string `xml:"StorageServiceKeys>Secondary"` -} - -type CreateStorageServiceInput struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CreateStorageServiceInput"` - StorageAccountCreateParameters -} - -type StorageAccountCreateParameters struct { - ServiceName string - Description string `xml:",omitempty"` - Label string - AffinityGroup string `xml:",omitempty"` - Location string `xml:",omitempty"` - ExtendedProperties ExtendedPropertyList - AccountType AccountType -} - -type AccountType string - -const ( - AccountTypeStandardLRS AccountType = "Standard_LRS" - AccountTypeStandardZRS AccountType = "Standard_ZRS" - AccountTypeStandardGRS AccountType = "Standard_GRS" - AccountTypeStandardRAGRS AccountType = "Standard_RAGRS" - AccountTypePremiumLRS AccountType = "Premium_LRS" -) - -type ExtendedPropertyList struct { - ExtendedProperty []ExtendedProperty -} - -type ExtendedProperty struct { - Name string - Value string -} - -type AvailabilityResponse struct { - XMLName xml.Name `xml:"AvailabilityResponse"` - Xmlns string `xml:"xmlns,attr"` - Result bool - Reason string -} +package storageservice + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// StorageServiceClient is used to perform operations on Azure Storage +type StorageServiceClient struct { + client management.Client +} + +type ListStorageServicesResponse struct { + StorageServices []StorageServiceResponse `xml:"StorageService"` +} + +type StorageServiceResponse struct { + URL string `xml:"Url"` + ServiceName string + StorageServiceProperties StorageServiceProperties +} + +type StorageServiceProperties struct { + Description string + Location string + Label string + Status string + Endpoints []string `xml:"Endpoints>Endpoint"` + GeoReplicationEnabled string + GeoPrimaryRegion string +} + +type GetStorageServiceKeysResponse struct { + URL string `xml:"Url"` + PrimaryKey string `xml:"StorageServiceKeys>Primary"` + SecondaryKey string `xml:"StorageServiceKeys>Secondary"` +} + +type CreateStorageServiceInput struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CreateStorageServiceInput"` + StorageAccountCreateParameters +} + +type StorageAccountCreateParameters struct { + ServiceName string + Description string `xml:",omitempty"` + Label string + AffinityGroup string `xml:",omitempty"` + Location string `xml:",omitempty"` + ExtendedProperties ExtendedPropertyList + AccountType AccountType +} + +type AccountType string + +const ( + AccountTypeStandardLRS AccountType = "Standard_LRS" + AccountTypeStandardZRS AccountType = "Standard_ZRS" + AccountTypeStandardGRS AccountType = "Standard_GRS" + AccountTypeStandardRAGRS AccountType = "Standard_RAGRS" + AccountTypePremiumLRS AccountType = "Premium_LRS" +) + +type ExtendedPropertyList struct { + ExtendedProperty []ExtendedProperty +} + +type ExtendedProperty struct { + Name string + Value string +} + +type AvailabilityResponse struct { + XMLName xml.Name `xml:"AvailabilityResponse"` + Xmlns string `xml:"xmlns,attr"` + Result bool + Reason string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go index 92d86fef7c..3f02f5beb8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/storageservice/entities_test.go @@ -1,31 +1,31 @@ -package storageservice - -import ( - "encoding/xml" - "testing" -) - -func Test_StorageServiceKeysResponse_Unmarshal(t *testing.T) { - // from https://msdn.microsoft.com/en-us/library/azure/ee460785.aspx - response := []byte(` - - storage-service-url - - primary-key - secondary-key - - `) - - keysResponse := GetStorageServiceKeysResponse{} - err := xml.Unmarshal(response, &keysResponse) - if err != nil { - t.Fatal(err) - } - - if expected := "primary-key"; keysResponse.PrimaryKey != expected { - t.Fatalf("Expected %q but got %q", expected, keysResponse.PrimaryKey) - } - if expected := "secondary-key"; keysResponse.SecondaryKey != expected { - t.Fatalf("Expected %q but got %q", expected, keysResponse.SecondaryKey) - } -} +package storageservice + +import ( + "encoding/xml" + "testing" +) + +func Test_StorageServiceKeysResponse_Unmarshal(t *testing.T) { + // from https://msdn.microsoft.com/en-us/library/azure/ee460785.aspx + response := []byte(` + + storage-service-url + + primary-key + secondary-key + + `) + + keysResponse := GetStorageServiceKeysResponse{} + err := xml.Unmarshal(response, &keysResponse) + if err != nil { + t.Fatal(err) + } + + if expected := "primary-key"; keysResponse.PrimaryKey != expected { + t.Fatalf("Expected %q but got %q", expected, keysResponse.PrimaryKey) + } + if expected := "secondary-key"; keysResponse.SecondaryKey != expected { + t.Fatalf("Expected %q but got %q", expected, keysResponse.SecondaryKey) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/testutils/managementclient.go b/vendor/github.com/Azure/azure-sdk-for-go/management/testutils/managementclient.go index b6a97c5b23..426e20dccf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/testutils/managementclient.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/testutils/managementclient.go @@ -1,87 +1,87 @@ -// Package testutils contains some test utilities for the Azure SDK -package testutils - -import ( - "encoding/base64" - "os" - "testing" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// GetTestClient returns a management Client for testing. Expects -// AZSUBSCRIPTIONID and AZCERTDATA to be present in the environment. AZCERTDATA -// is the base64encoded binary representation of the PEM certificate data. -func GetTestClient(t *testing.T) management.Client { - subid := os.Getenv("AZSUBSCRIPTIONID") - certdata := os.Getenv("AZCERTDATA") - if subid == "" || certdata == "" { - t.Skip("AZSUBSCRIPTIONID or AZCERTDATA not set, skipping test") - } - cert, err := base64.StdEncoding.DecodeString(certdata) - if err != nil { - t.Fatal(err) - } - - client, err := management.NewClient(subid, cert) - if err != nil { - t.Fatal(err) - } - return testClient{client, t} -} - -type testClient struct { - management.Client - t *testing.T -} - -func chop(d []byte) string { - const maxlen = 5000 - - s := string(d) - - if len(s) > maxlen { - return s[:maxlen] + "..." - } - return s -} - -func (l testClient) SendAzureGetRequest(url string) ([]byte, error) { - d, err := l.Client.SendAzureGetRequest(url) - logOperation(l.t, "GET", url, nil, d, "", err) - return d, err -} - -func (l testClient) SendAzurePostRequest(url string, data []byte) (management.OperationID, error) { - oid, err := l.Client.SendAzurePostRequest(url, data) - logOperation(l.t, "POST", url, data, nil, oid, err) - return oid, err -} - -func (l testClient) SendAzurePutRequest(url string, contentType string, data []byte) (management.OperationID, error) { - oid, err := l.Client.SendAzurePutRequest(url, contentType, data) - logOperation(l.t, "PUT", url, data, nil, oid, err) - return oid, err -} - -func (l testClient) SendAzureDeleteRequest(url string) (management.OperationID, error) { - oid, err := l.Client.SendAzureDeleteRequest(url) - logOperation(l.t, "DELETE", url, nil, nil, oid, err) - return oid, err -} - -func logOperation(t *testing.T, method, url string, requestData, responseData []byte, oid management.OperationID, err error) { - t.Logf("AZURE> %s %s\n", method, url) - if requestData != nil { - t.Logf(" >>> %s\n", chop(requestData)) - } - if err != nil { - t.Logf(" <<< ERROR: %+v\n", err) - } else { - if responseData != nil { - t.Logf(" <<< %s\n", chop(responseData)) - } else { - t.Logf(" <<< OperationID: %s\n", oid) - } - } -} +// Package testutils contains some test utilities for the Azure SDK +package testutils + +import ( + "encoding/base64" + "os" + "testing" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// GetTestClient returns a management Client for testing. Expects +// AZSUBSCRIPTIONID and AZCERTDATA to be present in the environment. AZCERTDATA +// is the base64encoded binary representation of the PEM certificate data. +func GetTestClient(t *testing.T) management.Client { + subid := os.Getenv("AZSUBSCRIPTIONID") + certdata := os.Getenv("AZCERTDATA") + if subid == "" || certdata == "" { + t.Skip("AZSUBSCRIPTIONID or AZCERTDATA not set, skipping test") + } + cert, err := base64.StdEncoding.DecodeString(certdata) + if err != nil { + t.Fatal(err) + } + + client, err := management.NewClient(subid, cert) + if err != nil { + t.Fatal(err) + } + return testClient{client, t} +} + +type testClient struct { + management.Client + t *testing.T +} + +func chop(d []byte) string { + const maxlen = 5000 + + s := string(d) + + if len(s) > maxlen { + return s[:maxlen] + "..." + } + return s +} + +func (l testClient) SendAzureGetRequest(url string) ([]byte, error) { + d, err := l.Client.SendAzureGetRequest(url) + logOperation(l.t, "GET", url, nil, d, "", err) + return d, err +} + +func (l testClient) SendAzurePostRequest(url string, data []byte) (management.OperationID, error) { + oid, err := l.Client.SendAzurePostRequest(url, data) + logOperation(l.t, "POST", url, data, nil, oid, err) + return oid, err +} + +func (l testClient) SendAzurePutRequest(url string, contentType string, data []byte) (management.OperationID, error) { + oid, err := l.Client.SendAzurePutRequest(url, contentType, data) + logOperation(l.t, "PUT", url, data, nil, oid, err) + return oid, err +} + +func (l testClient) SendAzureDeleteRequest(url string) (management.OperationID, error) { + oid, err := l.Client.SendAzureDeleteRequest(url) + logOperation(l.t, "DELETE", url, nil, nil, oid, err) + return oid, err +} + +func logOperation(t *testing.T, method, url string, requestData, responseData []byte, oid management.OperationID, err error) { + t.Logf("AZURE> %s %s\n", method, url) + if requestData != nil { + t.Logf(" >>> %s\n", chop(requestData)) + } + if err != nil { + t.Logf(" <<< ERROR: %+v\n", err) + } else { + if responseData != nil { + t.Logf(" <<< %s\n", chop(responseData)) + } else { + t.Logf(" <<< OperationID: %s\n", oid) + } + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/util.go b/vendor/github.com/Azure/azure-sdk-for-go/management/util.go index dc61c8837f..72601757e5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/util.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/util.go @@ -1,11 +1,11 @@ -package management - -import ( - "io/ioutil" - "net/http" -) - -func getResponseBody(response *http.Response) ([]byte, error) { - defer response.Body.Close() - return ioutil.ReadAll(response.Body) -} +package management + +import ( + "io/ioutil" + "net/http" +) + +func getResponseBody(response *http.Response) ([]byte, error) { + defer response.Body.Close() + return ioutil.ReadAll(response.Body) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/version.go b/vendor/github.com/Azure/azure-sdk-for-go/management/version.go index 85503ecd7e..a1035e189a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/version.go @@ -1,5 +1,5 @@ -package management - -var ( - sdkVersion = "10.0.2-beta" -) +package management + +var ( + sdkVersion = "10.0.2-beta" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/client.go index d6d4e8a7d1..a9fe827551 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/client.go @@ -1,328 +1,328 @@ -// Package virtualmachine provides a client for Virtual Machines. -package virtualmachine - -import ( - "encoding/xml" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureDeploymentListURL = "services/hostedservices/%s/deployments" - azureDeploymentURL = "services/hostedservices/%s/deployments/%s" - azureListDeploymentsInSlotURL = "services/hostedservices/%s/deploymentslots/Production" - deleteAzureDeploymentURL = "services/hostedservices/%s/deployments/%s?comp=media" - azureAddRoleURL = "services/hostedservices/%s/deployments/%s/roles" - azureRoleURL = "services/hostedservices/%s/deployments/%s/roles/%s" - azureOperationsURL = "services/hostedservices/%s/deployments/%s/roleinstances/%s/Operations" - azureRoleSizeListURL = "rolesizes" - - errParamNotSpecified = "Parameter %s is not specified." -) - -//NewClient is used to instantiate a new VirtualMachineClient from an Azure client -func NewClient(client management.Client) VirtualMachineClient { - return VirtualMachineClient{client: client} -} - -// CreateDeploymentOptions can be used to create a customized deployement request -type CreateDeploymentOptions struct { - DNSServers []DNSServer - LoadBalancers []LoadBalancer - ReservedIPName string - VirtualNetworkName string -} - -// CreateDeployment creates a deployment and then creates a virtual machine -// in the deployment based on the specified configuration. -// -// https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx -func (vm VirtualMachineClient) CreateDeployment( - role Role, - cloudServiceName string, - options CreateDeploymentOptions) (management.OperationID, error) { - - req := DeploymentRequest{ - Name: role.RoleName, - DeploymentSlot: "Production", - Label: role.RoleName, - RoleList: []Role{role}, - DNSServers: options.DNSServers, - LoadBalancers: options.LoadBalancers, - ReservedIPName: options.ReservedIPName, - VirtualNetworkName: options.VirtualNetworkName, - } - - data, err := xml.Marshal(req) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureDeploymentListURL, cloudServiceName) - return vm.client.SendAzurePostRequest(requestURL, data) -} - -// GetDeploymentName queries an existing Azure cloud service for the name of the Deployment, -// if any, in its 'Production' slot (the only slot possible). If none exists, it returns empty -// string but no error -// -//https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx -func (vm VirtualMachineClient) GetDeploymentName(cloudServiceName string) (string, error) { - var deployment DeploymentResponse - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - requestURL := fmt.Sprintf(azureListDeploymentsInSlotURL, cloudServiceName) - response, err := vm.client.SendAzureGetRequest(requestURL) - if err != nil { - if management.IsResourceNotFoundError(err) { - return "", nil - } - return "", err - } - err = xml.Unmarshal(response, &deployment) - if err != nil { - return "", err - } - - return deployment.Name, nil -} - -func (vm VirtualMachineClient) GetDeployment(cloudServiceName, deploymentName string) (DeploymentResponse, error) { - var deployment DeploymentResponse - if cloudServiceName == "" { - return deployment, fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return deployment, fmt.Errorf(errParamNotSpecified, "deploymentName") - } - requestURL := fmt.Sprintf(azureDeploymentURL, cloudServiceName, deploymentName) - response, azureErr := vm.client.SendAzureGetRequest(requestURL) - if azureErr != nil { - return deployment, azureErr - } - - err := xml.Unmarshal(response, &deployment) - return deployment, err -} - -func (vm VirtualMachineClient) DeleteDeployment(cloudServiceName, deploymentName string) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - - requestURL := fmt.Sprintf(deleteAzureDeploymentURL, cloudServiceName, deploymentName) - return vm.client.SendAzureDeleteRequest(requestURL) -} - -func (vm VirtualMachineClient) GetRole(cloudServiceName, deploymentName, roleName string) (*Role, error) { - if cloudServiceName == "" { - return nil, fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return nil, fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return nil, fmt.Errorf(errParamNotSpecified, "roleName") - } - - role := new(Role) - - requestURL := fmt.Sprintf(azureRoleURL, cloudServiceName, deploymentName, roleName) - response, azureErr := vm.client.SendAzureGetRequest(requestURL) - if azureErr != nil { - return nil, azureErr - } - - err := xml.Unmarshal(response, role) - if err != nil { - return nil, err - } - - return role, nil -} - -// AddRole adds a Virtual Machine to a deployment of Virtual Machines, where role name = VM name -// See https://msdn.microsoft.com/en-us/library/azure/jj157186.aspx -func (vm VirtualMachineClient) AddRole(cloudServiceName string, deploymentName string, role Role) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - - data, err := xml.Marshal(PersistentVMRole{Role: role}) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureAddRoleURL, cloudServiceName, deploymentName) - return vm.client.SendAzurePostRequest(requestURL, data) -} - -// UpdateRole updates the configuration of the specified virtual machine -// See https://msdn.microsoft.com/en-us/library/azure/jj157187.aspx -func (vm VirtualMachineClient) UpdateRole(cloudServiceName, deploymentName, roleName string, role Role) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - data, err := xml.Marshal(PersistentVMRole{Role: role}) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureRoleURL, cloudServiceName, deploymentName, roleName) - return vm.client.SendAzurePutRequest(requestURL, "text/xml", data) -} - -func (vm VirtualMachineClient) StartRole(cloudServiceName, deploymentName, roleName string) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - startRoleOperationBytes, err := xml.Marshal(StartRoleOperation{ - OperationType: "StartRoleOperation", - }) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName) - return vm.client.SendAzurePostRequest(requestURL, startRoleOperationBytes) -} - -func (vm VirtualMachineClient) ShutdownRole(cloudServiceName, deploymentName, roleName string, postaction PostShutdownAction) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - shutdownRoleOperationBytes, err := xml.Marshal(ShutdownRoleOperation{ - OperationType: "ShutdownRoleOperation", - PostShutdownAction: postaction, - }) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName) - return vm.client.SendAzurePostRequest(requestURL, shutdownRoleOperationBytes) -} - -func (vm VirtualMachineClient) RestartRole(cloudServiceName, deploymentName, roleName string) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - restartRoleOperationBytes, err := xml.Marshal(RestartRoleOperation{ - OperationType: "RestartRoleOperation", - }) - if err != nil { - return "", err - } - - requestURL := fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName) - return vm.client.SendAzurePostRequest(requestURL, restartRoleOperationBytes) -} - -func (vm VirtualMachineClient) DeleteRole(cloudServiceName, deploymentName, roleName string, deleteVHD bool) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - requestURL := fmt.Sprintf(azureRoleURL, cloudServiceName, deploymentName, roleName) - if deleteVHD { - requestURL += "?comp=media" - } - return vm.client.SendAzureDeleteRequest(requestURL) -} - -func (vm VirtualMachineClient) GetRoleSizeList() (RoleSizeList, error) { - roleSizeList := RoleSizeList{} - - response, err := vm.client.SendAzureGetRequest(azureRoleSizeListURL) - if err != nil { - return roleSizeList, err - } - - err = xml.Unmarshal(response, &roleSizeList) - return roleSizeList, err -} - -// CaptureRole captures a VM role. If reprovisioningConfigurationSet is non-nil, -// the VM role is redeployed after capturing the image, otherwise, the original -// VM role is deleted. -// -// NOTE: an image resulting from this operation shows up in -// osimage.GetImageList() as images with Category "User". -func (vm VirtualMachineClient) CaptureRole(cloudServiceName, deploymentName, roleName, imageName, imageLabel string, - reprovisioningConfigurationSet *ConfigurationSet) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - if reprovisioningConfigurationSet != nil && - !(reprovisioningConfigurationSet.ConfigurationSetType == ConfigurationSetTypeLinuxProvisioning || - reprovisioningConfigurationSet.ConfigurationSetType == ConfigurationSetTypeWindowsProvisioning) { - return "", fmt.Errorf("ConfigurationSet type can only be WindowsProvisioningConfiguration or LinuxProvisioningConfiguration") - } - - operation := CaptureRoleOperation{ - OperationType: "CaptureRoleOperation", - PostCaptureAction: PostCaptureActionReprovision, - ProvisioningConfiguration: reprovisioningConfigurationSet, - TargetImageLabel: imageLabel, - TargetImageName: imageName, - } - if reprovisioningConfigurationSet == nil { - operation.PostCaptureAction = PostCaptureActionDelete - } - - data, err := xml.Marshal(operation) - if err != nil { - return "", err - } - - return vm.client.SendAzurePostRequest(fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName), data) -} +// Package virtualmachine provides a client for Virtual Machines. +package virtualmachine + +import ( + "encoding/xml" + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureDeploymentListURL = "services/hostedservices/%s/deployments" + azureDeploymentURL = "services/hostedservices/%s/deployments/%s" + azureListDeploymentsInSlotURL = "services/hostedservices/%s/deploymentslots/Production" + deleteAzureDeploymentURL = "services/hostedservices/%s/deployments/%s?comp=media" + azureAddRoleURL = "services/hostedservices/%s/deployments/%s/roles" + azureRoleURL = "services/hostedservices/%s/deployments/%s/roles/%s" + azureOperationsURL = "services/hostedservices/%s/deployments/%s/roleinstances/%s/Operations" + azureRoleSizeListURL = "rolesizes" + + errParamNotSpecified = "Parameter %s is not specified." +) + +//NewClient is used to instantiate a new VirtualMachineClient from an Azure client +func NewClient(client management.Client) VirtualMachineClient { + return VirtualMachineClient{client: client} +} + +// CreateDeploymentOptions can be used to create a customized deployement request +type CreateDeploymentOptions struct { + DNSServers []DNSServer + LoadBalancers []LoadBalancer + ReservedIPName string + VirtualNetworkName string +} + +// CreateDeployment creates a deployment and then creates a virtual machine +// in the deployment based on the specified configuration. +// +// https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx +func (vm VirtualMachineClient) CreateDeployment( + role Role, + cloudServiceName string, + options CreateDeploymentOptions) (management.OperationID, error) { + + req := DeploymentRequest{ + Name: role.RoleName, + DeploymentSlot: "Production", + Label: role.RoleName, + RoleList: []Role{role}, + DNSServers: options.DNSServers, + LoadBalancers: options.LoadBalancers, + ReservedIPName: options.ReservedIPName, + VirtualNetworkName: options.VirtualNetworkName, + } + + data, err := xml.Marshal(req) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureDeploymentListURL, cloudServiceName) + return vm.client.SendAzurePostRequest(requestURL, data) +} + +// GetDeploymentName queries an existing Azure cloud service for the name of the Deployment, +// if any, in its 'Production' slot (the only slot possible). If none exists, it returns empty +// string but no error +// +//https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx +func (vm VirtualMachineClient) GetDeploymentName(cloudServiceName string) (string, error) { + var deployment DeploymentResponse + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + requestURL := fmt.Sprintf(azureListDeploymentsInSlotURL, cloudServiceName) + response, err := vm.client.SendAzureGetRequest(requestURL) + if err != nil { + if management.IsResourceNotFoundError(err) { + return "", nil + } + return "", err + } + err = xml.Unmarshal(response, &deployment) + if err != nil { + return "", err + } + + return deployment.Name, nil +} + +func (vm VirtualMachineClient) GetDeployment(cloudServiceName, deploymentName string) (DeploymentResponse, error) { + var deployment DeploymentResponse + if cloudServiceName == "" { + return deployment, fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return deployment, fmt.Errorf(errParamNotSpecified, "deploymentName") + } + requestURL := fmt.Sprintf(azureDeploymentURL, cloudServiceName, deploymentName) + response, azureErr := vm.client.SendAzureGetRequest(requestURL) + if azureErr != nil { + return deployment, azureErr + } + + err := xml.Unmarshal(response, &deployment) + return deployment, err +} + +func (vm VirtualMachineClient) DeleteDeployment(cloudServiceName, deploymentName string) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + + requestURL := fmt.Sprintf(deleteAzureDeploymentURL, cloudServiceName, deploymentName) + return vm.client.SendAzureDeleteRequest(requestURL) +} + +func (vm VirtualMachineClient) GetRole(cloudServiceName, deploymentName, roleName string) (*Role, error) { + if cloudServiceName == "" { + return nil, fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return nil, fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return nil, fmt.Errorf(errParamNotSpecified, "roleName") + } + + role := new(Role) + + requestURL := fmt.Sprintf(azureRoleURL, cloudServiceName, deploymentName, roleName) + response, azureErr := vm.client.SendAzureGetRequest(requestURL) + if azureErr != nil { + return nil, azureErr + } + + err := xml.Unmarshal(response, role) + if err != nil { + return nil, err + } + + return role, nil +} + +// AddRole adds a Virtual Machine to a deployment of Virtual Machines, where role name = VM name +// See https://msdn.microsoft.com/en-us/library/azure/jj157186.aspx +func (vm VirtualMachineClient) AddRole(cloudServiceName string, deploymentName string, role Role) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + + data, err := xml.Marshal(PersistentVMRole{Role: role}) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureAddRoleURL, cloudServiceName, deploymentName) + return vm.client.SendAzurePostRequest(requestURL, data) +} + +// UpdateRole updates the configuration of the specified virtual machine +// See https://msdn.microsoft.com/en-us/library/azure/jj157187.aspx +func (vm VirtualMachineClient) UpdateRole(cloudServiceName, deploymentName, roleName string, role Role) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + data, err := xml.Marshal(PersistentVMRole{Role: role}) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureRoleURL, cloudServiceName, deploymentName, roleName) + return vm.client.SendAzurePutRequest(requestURL, "text/xml", data) +} + +func (vm VirtualMachineClient) StartRole(cloudServiceName, deploymentName, roleName string) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + startRoleOperationBytes, err := xml.Marshal(StartRoleOperation{ + OperationType: "StartRoleOperation", + }) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName) + return vm.client.SendAzurePostRequest(requestURL, startRoleOperationBytes) +} + +func (vm VirtualMachineClient) ShutdownRole(cloudServiceName, deploymentName, roleName string, postaction PostShutdownAction) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + shutdownRoleOperationBytes, err := xml.Marshal(ShutdownRoleOperation{ + OperationType: "ShutdownRoleOperation", + PostShutdownAction: postaction, + }) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName) + return vm.client.SendAzurePostRequest(requestURL, shutdownRoleOperationBytes) +} + +func (vm VirtualMachineClient) RestartRole(cloudServiceName, deploymentName, roleName string) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + restartRoleOperationBytes, err := xml.Marshal(RestartRoleOperation{ + OperationType: "RestartRoleOperation", + }) + if err != nil { + return "", err + } + + requestURL := fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName) + return vm.client.SendAzurePostRequest(requestURL, restartRoleOperationBytes) +} + +func (vm VirtualMachineClient) DeleteRole(cloudServiceName, deploymentName, roleName string, deleteVHD bool) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + requestURL := fmt.Sprintf(azureRoleURL, cloudServiceName, deploymentName, roleName) + if deleteVHD { + requestURL += "?comp=media" + } + return vm.client.SendAzureDeleteRequest(requestURL) +} + +func (vm VirtualMachineClient) GetRoleSizeList() (RoleSizeList, error) { + roleSizeList := RoleSizeList{} + + response, err := vm.client.SendAzureGetRequest(azureRoleSizeListURL) + if err != nil { + return roleSizeList, err + } + + err = xml.Unmarshal(response, &roleSizeList) + return roleSizeList, err +} + +// CaptureRole captures a VM role. If reprovisioningConfigurationSet is non-nil, +// the VM role is redeployed after capturing the image, otherwise, the original +// VM role is deleted. +// +// NOTE: an image resulting from this operation shows up in +// osimage.GetImageList() as images with Category "User". +func (vm VirtualMachineClient) CaptureRole(cloudServiceName, deploymentName, roleName, imageName, imageLabel string, + reprovisioningConfigurationSet *ConfigurationSet) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + if reprovisioningConfigurationSet != nil && + !(reprovisioningConfigurationSet.ConfigurationSetType == ConfigurationSetTypeLinuxProvisioning || + reprovisioningConfigurationSet.ConfigurationSetType == ConfigurationSetTypeWindowsProvisioning) { + return "", fmt.Errorf("ConfigurationSet type can only be WindowsProvisioningConfiguration or LinuxProvisioningConfiguration") + } + + operation := CaptureRoleOperation{ + OperationType: "CaptureRoleOperation", + PostCaptureAction: PostCaptureActionReprovision, + ProvisioningConfiguration: reprovisioningConfigurationSet, + TargetImageLabel: imageLabel, + TargetImageName: imageName, + } + if reprovisioningConfigurationSet == nil { + operation.PostCaptureAction = PostCaptureActionDelete + } + + data, err := xml.Marshal(operation) + if err != nil { + return "", err + } + + return vm.client.SendAzurePostRequest(fmt.Sprintf(azureOperationsURL, cloudServiceName, deploymentName, roleName), data) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities.go index c319c2098f..a826541a78 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities.go @@ -1,579 +1,579 @@ -package virtualmachine - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" - vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" -) - -// VirtualMachineClient is used to perform operations on Azure Virtual Machines -type VirtualMachineClient struct { - client management.Client -} - -// DeploymentRequest is the type for creating a deployment and Virtual Machine -// in the deployment based on the specified configuration. See -// https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx -type DeploymentRequest struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Deployment"` - // Required parameters: - Name string `` // Specifies a name for the deployment. The deployment name must be unique among other deployments for the cloud service. - DeploymentSlot string `` // Specifies the environment in which the Virtual Machine is to be deployed. The only allowable value is Production. - Label string `` // Specifies an identifier for the deployment. The label can be up to 100 characters long. The label can be used for tracking purposes. - RoleList []Role `xml:">Role"` // Contains information about the Virtual Machines that are to be deployed. - // Optional parameters: - VirtualNetworkName string `xml:",omitempty"` // Specifies the name of an existing virtual network to which the deployment will belong. - DNSServers []DNSServer `xml:"Dns>DnsServers>DnsServer,omitempty"` // Contains a list of DNS servers to associate with the Virtual Machine. - LoadBalancers []LoadBalancer `xml:">LoadBalancer,omitempty"` // Contains a list of internal load balancers that can be assigned to input endpoints. - ReservedIPName string `xml:",omitempty"` // Specifies the name of a reserved IP address that is to be assigned to the deployment. -} - -// DeploymentResponse is the type for receiving deployment information -// See https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx -type DeploymentResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Deployment"` - - Name string - DeploymentSlot string - Status DeploymentStatus - Label string - URL string `xml:"Url"` - Configuration string - RoleInstanceList []RoleInstance `xml:">RoleInstance"` - UpgradeStatus UpgradeStatus - UpgradeDomainCount int - RoleList []Role `xml:">Role"` - SdkVersion string - Locked bool - RollbackAllowed bool - CreatedTime string - LastModifiedTime string - VirtualNetworkName string - DNSServers []DNSServer `xml:"Dns>DnsServers>DnsServer"` - LoadBalancers []LoadBalancer `xml:">LoadBalancer"` - ExtendedProperties []ExtendedProperty `xml:">ExtendedProperty"` - PersistentVMDowntime PersistentVMDowntime - VirtualIPs []VirtualIP `xml:">VirtualIP"` - ExtensionConfiguration string // cloud service extensions not fully implemented - ReservedIPName string - InternalDNSSuffix string `xml:"InternalDnsSuffix"` -} - -type DeploymentStatus string - -const ( - DeploymentStatusRunning DeploymentStatus = "Running" - DeploymentStatusSuspended DeploymentStatus = "Suspended" - DeploymentStatusRunningTransitioning DeploymentStatus = "RunningTransitioning" - DeploymentStatusSuspendedTransitioning DeploymentStatus = "SuspendedTransitioning" - DeploymentStatusStarting DeploymentStatus = "Starting" - DeploymentStatusSuspending DeploymentStatus = "Suspending" - DeploymentStatusDeploying DeploymentStatus = "Deploying" - DeploymentStatusDeleting DeploymentStatus = "Deleting" -) - -type RoleInstance struct { - RoleName string - InstanceName string - InstanceStatus InstanceStatus - ExtendedInstanceStatus string - InstanceUpgradeDomain int - InstanceFaultDomain int - InstanceSize string - InstanceStateDetails string - InstanceErrorCode string - IPAddress string `xml:"IpAddress"` - InstanceEndpoints []InstanceEndpoint `xml:">InstanceEndpoint"` - PowerState PowerState - HostName string - RemoteAccessCertificateThumbprint string - GuestAgentStatus string // todo: implement - ResourceExtensionStatusList []ResourceExtensionStatus `xml:">ResourceExtensionStatus"` - PublicIPs []PublicIP `xml:">PublicIP"` -} - -type InstanceStatus string - -const ( - InstanceStatusUnknown = "Unknown" - InstanceStatusCreatingVM = "CreatingVM" - InstanceStatusStartingVM = "StartingVM" - InstanceStatusCreatingRole = "CreatingRole" - InstanceStatusStartingRole = "StartingRole" - InstanceStatusReadyRole = "ReadyRole" - InstanceStatusBusyRole = "BusyRole" - InstanceStatusStoppingRole = "StoppingRole" - InstanceStatusStoppingVM = "StoppingVM" - InstanceStatusDeletingVM = "DeletingVM" - InstanceStatusStoppedVM = "StoppedVM" - InstanceStatusRestartingRole = "RestartingRole" - InstanceStatusCyclingRole = "CyclingRole" - InstanceStatusFailedStartingRole = "FailedStartingRole" - InstanceStatusFailedStartingVM = "FailedStartingVM" - InstanceStatusUnresponsiveRole = "UnresponsiveRole" - InstanceStatusStoppedDeallocated = "StoppedDeallocated" - InstanceStatusPreparing = "Preparing" -) - -type InstanceEndpoint struct { - Name string - Vip string - PublicPort int - LocalPort int - Protocol InputEndpointProtocol -} - -type PowerState string - -const ( - PowerStateStarting PowerState = "Starting" - PowerStateStarted PowerState = "Started" - PowerStateStopping PowerState = "Stopping" - PowerStateStopped PowerState = "Stopped" - PowerStateUnknown PowerState = "Unknown" -) - -type ResourceExtensionStatus struct { - HandlerName string - Version string - Status ResourceExtensionState - Code string - FormattedMessage FormattedMessage - ExtensionSettingStatus ExtensionSettingStatus -} - -type ResourceExtensionState string - -const ( - ResourceExtensionStateInstalling ResourceExtensionState = "Installing" - ResourceExtensionStateReady ResourceExtensionState = "Ready" - ResourceExtensionStateNotReady ResourceExtensionState = "NotReady" - ResourceExtensionStateUnresponsive ResourceExtensionState = "Unresponsive" -) - -type FormattedMessage struct { - Language string - Message string -} - -type ExtensionSettingStatus struct { - Timestamp string - Name string - Operation string - Status ExtensionSettingState - Code string - FormattedMessage FormattedMessage - SubStatusList []SubStatus `xml:">SubStatus"` -} - -type ExtensionSettingState string - -const ( - ExtensionSettingStateTransitioning ExtensionSettingState = "transitioning" - ExtensionSettingStateError ExtensionSettingState = "error" - ExtensionSettingStateSuccess ExtensionSettingState = "success" - ExtensionSettingStateWarning ExtensionSettingState = "warning" -) - -type SubStatus struct { - Name string - Status ExtensionSettingState - FormattedMessage FormattedMessage -} - -type UpgradeStatus struct { - UpgradeType UpgradeType - CurrentUpgradeDomainState CurrentUpgradeDomainState - CurrentUpgradeDomain int -} - -type UpgradeType string - -const ( - UpgradeTypeAuto UpgradeType = "Auto" - UpgradeTypeManual UpgradeType = "Manual" - UpgradeTypeSimultaneous UpgradeType = "Simultaneous" -) - -type CurrentUpgradeDomainState string - -const ( - CurrentUpgradeDomainStateBefore CurrentUpgradeDomainState = "Before" - CurrentUpgradeDomainStateDuring CurrentUpgradeDomainState = "During" -) - -type ExtendedProperty struct { - Name string - Value string -} - -type PersistentVMDowntime struct { - StartTime string - EndTime string - Status string -} - -type VirtualIP struct { - Address string - IsReserved bool - ReservedIPName string - Type IPAddressType -} - -// Role contains the configuration sets that are used to create virtual -// machines. -type Role struct { - RoleName string `xml:",omitempty"` // Specifies the name for the Virtual Machine. - RoleType string `xml:",omitempty"` // Specifies the type of role to use. For Virtual Machines, this must be PersistentVMRole. - ConfigurationSets []ConfigurationSet `xml:"ConfigurationSets>ConfigurationSet,omitempty"` - ResourceExtensionReferences *[]ResourceExtensionReference `xml:"ResourceExtensionReferences>ResourceExtensionReference,omitempty"` - VMImageName string `xml:",omitempty"` // Specifies the name of the VM Image that is to be used to create the Virtual Machine. If this element is used, the ConfigurationSets element is not used. - MediaLocation string `xml:",omitempty"` // Required if the Virtual Machine is being created from a published VM Image. Specifies the location of the VHD file that is created when VMImageName specifies a published VM Image. - AvailabilitySetName string `xml:",omitempty"` // Specifies the name of a collection of Virtual Machines. Virtual Machines specified in the same availability set are allocated to different nodes to maximize availability. - DataVirtualHardDisks []DataVirtualHardDisk `xml:"DataVirtualHardDisks>DataVirtualHardDisk,omitempty"` // Contains the parameters that are used to add a data disk to a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used. - OSVirtualHardDisk *OSVirtualHardDisk `xml:",omitempty"` // Contains the parameters that are used to create the operating system disk for a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used. - RoleSize string `xml:",omitempty"` // Specifies the size of the Virtual Machine. The default size is Small. - ProvisionGuestAgent bool `xml:",omitempty"` // Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed. - VMImageInput *VMImageInput `xml:",omitempty"` // When a VM Image is used to create a new PersistentVMRole, the DiskConfigurations in the VM Image are used to create new Disks for the new VM. This parameter can be used to resize the newly created Disks to a larger size than the underlying DiskConfigurations in the VM Image. - - UseCertAuth bool `xml:"-"` - CertPath string `xml:"-"` -} - -// VMImageInput is for when a VM Image is used to create a new PersistantVMRole, -// the DiskConfigurations in the VM Image are used to create new Disks for the -// new VM. This parameter can be used to resize the newly created Disks to a -// larger size than the underlying DiskConfigurations in the VM Image. -type VMImageInput struct { - OSDiskConfiguration *OSDiskConfiguration `xml:",omitempty"` // This corresponds to the OSDiskConfiguration of the VM Image used to create a new role. The OSDiskConfiguration element is only available using version 2014-10-01 or higher. - DataDiskConfigurations []DataDiskConfiguration `xml:">DataDiskConfiguration,omitempty"` // This corresponds to the DataDiskConfigurations of the VM Image used to create a new role. The DataDiskConfigurations element is only available using version 2014-10-01 or higher. -} - -// OSDiskConfiguration is used to resize the OS disk of a new VM created from a -// previously saved VM image. -type OSDiskConfiguration struct { - ResizedSizeInGB int -} - -// DataDiskConfiguration is used to resize the data disks of a new VM created -// from a previously saved VM image. -type DataDiskConfiguration struct { - OSDiskConfiguration - Name string // The Name of the DataDiskConfiguration being referenced to. - -} - -// ResourceExtensionReference contains a collection of resource extensions that -// are to be installed on the Virtual Machine. The VM Agent must be installed on -// the Virtual Machine to install resource extensions. For more information, see -// Manage Extensions: -// -// https://msdn.microsoft.com/en-us/library/dn606311.aspx. -type ResourceExtensionReference struct { - ReferenceName string - Publisher string - Name string - Version string - ParameterValues []ResourceExtensionParameter `xml:"ResourceExtensionParameterValues>ResourceExtensionParameterValue,omitempty"` - State string -} - -// ResourceExtensionParameter specifies the key, value, and type of a parameter that is passed to the -// resource extension when it is installed. -type ResourceExtensionParameter struct { - Key string - Value string - Type ResourceExtensionParameterType // If this value is set to Private, the parameter will not be returned by Get Deployment (). -} - -type ResourceExtensionParameterType string - -// Enum values for ResourceExtensionParameterType -const ( - ResourceExtensionParameterTypePublic ResourceExtensionParameterType = "Public" - ResourceExtensionParameterTypePrivate ResourceExtensionParameterType = "Private" -) - -// DataVirtualHardDisk specifies the properties that are used to create a data -// disk. -type DataVirtualHardDisk struct { - HostCaching vmdisk.HostCachingType `xml:",omitempty"` // Specifies the caching mode of the data disk. The default value is None. - DiskLabel string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal. - DiskName string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD are being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number. The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash. - Lun int `xml:",omitempty"` // Specifies the Logical Unit Number (LUN) for the data disk. If the disk is the first disk that is added, this element is optional and the default value of 0 is used. If more than one disk is being added, this element is required. Valid LUN values are 0 through 31. - LogicalDiskSizeInGB int `xml:",omitempty"` // Specifies the size, in GB, of an empty disk to be attached to the Virtual Machine. If the disk that is being added is already registered in the subscription, this element is ignored. If the disk and VHD is being created by Azure as it is added, this element defines the size of the new disk. - MediaLink string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added. - SourceMediaLink string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk does not exist in blob storage, this element is ignored. If the VHD file exists in blob storage, this element defines the path to the VHD and a disk is registered from it and attached to the virtual machine. -} - -// OSVirtualHardDisk specifies the properties that are used to create an OS -// disk. -type OSVirtualHardDisk struct { - HostCaching vmdisk.HostCachingType `xml:",omitempty"` // Specifies the caching mode of the data disk. The default value is None. - DiskLabel string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal. - DiskName string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD are being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number. The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash. - MediaLink string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added. - SourceImageName string `xml:",omitempty"` - OS string `xml:",omitempty"` - RemoteSourceImageLink string `xml:",omitempty"` // Specifies a publicly accessible URI or a SAS URI to the location where an OS image is stored that is used to create the Virtual Machine. This location can be a different location than the user or platform image repositories in Azure. An image is always associated with a VHD, which is a .vhd file stored as a page blob in a storage account in Azure. If you specify the path to an image with this element, an associated VHD is created and you must use the MediaLink element to specify the location in storage where the VHD will be located. If this element is used, SourceImageName is not used. - ResizedSizeInGB int `xml:",omitempty"` -} - -// ConfigurationSet specifies the configuration elements of the Virtual Machine. -// The type attribute is required to prevent the administrator password from -// being written to the operation history file. -type ConfigurationSet struct { - ConfigurationSetType ConfigurationSetType - - // Windows provisioning: - ComputerName string `xml:",omitempty"` // Optional. Specifies the computer name for the Virtual Machine. If you do not specify a computer name, one is assigned that is a combination of the deployment name, role name, and identifying number. Computer names must be 1 to 15 characters long. - AdminPassword string `xml:",omitempty"` // Optional. Specifies the password to use for an administrator account on the Virtual Machine that is being created. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created on the machine using the AdminUsername element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk. - EnableAutomaticUpdates bool `xml:",omitempty"` // Optional. Specifies whether automatic updates are enabled for the Virtual Machine. The default value is true. - TimeZone string `xml:",omitempty"` // Optional. Specifies the time zone for the Virtual Machine. - DomainJoin *DomainJoin `xml:",omitempty"` // Optional. Contains properties that define a domain to which the Virtual Machine will be joined. - StoredCertificateSettings []CertificateSetting `xml:">StoredCertificateSetting,omitempty"` // Optional. Contains a list of service certificates with which to provision to the new Virtual Machine. - WinRMListeners *[]WinRMListener `xml:"WinRM>Listeners>Listener,omitempty"` // Optional. Contains configuration settings for the Windows Remote Management service on the Virtual Machine. This enables remote Windows PowerShell. - AdminUsername string `xml:",omitempty"` // Optional. Specifies the name of the administrator account that is created to access the Virtual Machine. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created by using this element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk. - AdditionalUnattendContent string `xml:",omitempty"` // Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. - - // Linux provisioning: - HostName string `xml:",omitempty"` // Required. Specifies the host name for the Virtual Machine. Host names must be 1 to 64 characters long. - UserName string `xml:",omitempty"` // Required. Specifies the name of a user account to be created in the sudoer group of the Virtual Machine. User account names must be 1 to 32 characters long. - UserPassword string `xml:",omitempty"` // Required. Specifies the password for the user account. Passwords must be 6 to 72 characters long. - DisableSSHPasswordAuthentication string `xml:"DisableSshPasswordAuthentication,omitempty"` // Optional. Specifies whether SSH password authentication is disabled. By default this value is set to true. - SSH *SSH `xml:",omitempty"` // Optional. Specifies the SSH public keys and key pairs to use with the Virtual Machine. - - // In WindowsProvisioningConfiguration: The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. The file is saved to %SYSTEMDRIVE%\AzureData\CustomData.bin. If the file exists, it is overwritten. The security on directory is set to System:Full Control and Administrators:Full Control. - // In LinuxProvisioningConfiguration: The base-64 encoded string is located in the ovf-env.xml file on the ISO of the Virtual Machine. The file is copied to /var/lib/waagent/ovf-env.xml by the Azure Linux Agent. The Azure Linux Agent will also place the base-64 encoded data in /var/lib/waagent/CustomData during provisioning. The maximum length of the binary array is 65535 bytes. - CustomData string `xml:",omitempty"` // Specifies a base-64 encoded string of custom data. - - // Network configuration: - InputEndpoints []InputEndpoint `xml:">InputEndpoint,omitempty"` // Optional in NetworkConfiguration. Contains a collection of external endpoints for the Virtual Machine. - SubnetNames []string `xml:">SubnetName,omitempty"` // Required if StaticVirtualNetworkIPAddress is specified; otherwise, optional in NetworkConfiguration. Contains a list of subnets to which the Virtual Machine will belong. - StaticVirtualNetworkIPAddress string `xml:",omitempty"` // Specifies the internal IP address for the Virtual Machine in a Virtual Network. If you specify this element, you must also specify the SubnetNames element with only one subnet defined. The IP address specified in this element must belong to the subnet that is defined in SubnetNames and it should not be the one of the first four IP addresses or the last IP address in the subnet. Deploying web roles or worker roles into a subnet that has Virtual Machines with StaticVirtualNetworkIPAddress defined is not supported. - NetworkSecurityGroup string `xml:",omitempty"` // Optional in NetworkConfiguration. Represents the name of the Network Security Group that will be associated with the Virtual Machine. Network Security Group must exist in the context of subscription and be created in same region to which the virtual machine will be deployed. - PublicIPs []PublicIP `xml:">PublicIP,omitempty"` // Contains a public IP address that can be used in addition to the default virtual IP address for the Virtual Machine. -} - -type ConfigurationSetType string - -// Enum values for ConfigurationSetType -const ( - ConfigurationSetTypeWindowsProvisioning ConfigurationSetType = "WindowsProvisioningConfiguration" - ConfigurationSetTypeLinuxProvisioning ConfigurationSetType = "LinuxProvisioningConfiguration" - ConfigurationSetTypeNetwork ConfigurationSetType = "NetworkConfiguration" -) - -// DomainJoin contains properties that define a domain to which the Virtual -// Machine will be joined. -type DomainJoin struct { - Credentials Credentials `xml:",omitempty"` // Specifies the credentials to use to join the Virtual Machine to the domain. - JoinDomain string `xml:",omitempty"` // Specifies the domain to join. - MachineObjectOU string `xml:",omitempty"` // Specifies the Lightweight Directory Access Protocol (LDAP) X 500-distinguished name of the organizational unit (OU) in which the computer account is created. This account is in Active Directory on a domain controller in the domain to which the computer is being joined. -} - -// Credentials specifies the credentials to use to join the Virtual Machine to -// the domain. If Domain is not specified, Username must specify the user -// principal name (UPN) format (user@fully-qualified-DNS-domain) or the fully- -// qualified-DNS-domain\username format. -type Credentials struct { - Domain string // Specifies the name of the domain used to authenticate an account. The value is a fully qualified DNS domain. - Username string // Specifies a user name in the domain that can be used to join the domain. - Password string // Specifies the password to use to join the domain. -} - -// CertificateSetting specifies the parameters for the certificate which to -// provision to the new Virtual Machine. -type CertificateSetting struct { - StoreLocation string // Required. Specifies the certificate store location on the Virtual Machine. The only supported value is "LocalMachine". - StoreName string // Required. Specifies the name of the certificate store from which the certificate is retrieved. For example, "My". - Thumbprint string // Required. Specifies the thumbprint of the certificate. The thumbprint must specify an existing service certificate. -} - -// WinRMListener specifies the protocol and certificate information for a WinRM -// listener. -type WinRMListener struct { - Protocol WinRMProtocol // Specifies the protocol of listener. - CertificateThumbprint string `xml:",omitempty"` // Specifies the certificate thumbprint for the secure connection. If this value is not specified, a self-signed certificate is generated and used for the Virtual Machine. -} - -type WinRMProtocol string - -// Enum values for WinRMProtocol -const ( - WinRMProtocolHTTP WinRMProtocol = "Http" - WinRMProtocolHTTPS WinRMProtocol = "Https" -) - -// SSH specifies the SSH public keys and key pairs to use with the Virtual Machine. -type SSH struct { - PublicKeys []PublicKey `xml:">PublicKey"` - KeyPairs []KeyPair `xml:">KeyPair"` -} - -// PublicKey specifies a public SSH key. -type PublicKey struct { - Fingerprint string // Specifies the SHA1 fingerprint of an X509 certificate associated with the cloud service and includes the SSH public key. - // Specifies the full path of a file, on the Virtual Machine, where the SSH public key is stored. If - // the file already exists, the specified key is appended to the file. - Path string // Usually /home/username/.ssh/authorized_keys -} - -// KeyPair specifies an SSH keypair. -type KeyPair struct { - Fingerprint string // Specifies the SHA1 fingerprint of an X509 certificate that is associated with the cloud service and includes the SSH keypair. - // Specifies the full path of a file, on the virtual machine, which stores the SSH private key. The - // file is overwritten when multiple keys are written to it. The SSH public key is stored in the same - // directory and has the same name as the private key file with .pub suffix. - Path string // Usually /home/username/.ssh/id_rsa -} - -// InputEndpoint specifies the properties that define an external endpoint for -// the Virtual Machine. -type InputEndpoint struct { - LocalPort int // Specifies the internal port on which the Virtual Machine is listening. - Name string // Specifies the name of the external endpoint. - Port int // Specifies the external port to use for the endpoint. - Protocol InputEndpointProtocol //Specifies the transport protocol for the endpoint. - Vip string `xml:",omitempty"` -} - -type InputEndpointProtocol string - -// Enum values for InputEndpointProtocol -const ( - InputEndpointProtocolTCP InputEndpointProtocol = "TCP" - InputEndpointProtocolUDP InputEndpointProtocol = "UDP" -) - -// PublicIP contains a public IP address that can be used in addition to default -// virtual IP address for the Virtual Machine. -type PublicIP struct { - Name string // Specifies the name of the public IP address. - Address string // Specifies the IP address. - IdleTimeoutInMinutes int `xml:",omitempty"` // Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. -} - -// ServiceCertificate contains a certificate for adding it to a hosted service -type ServiceCertificate struct { - XMLName xml.Name `xml:"CertificateFile"` - Data string - CertificateFormat string - Password string `xml:",omitempty"` -} - -// StartRoleOperation contains the information for starting a Role. -type StartRoleOperation struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure StartRoleOperation"` - OperationType string -} - -type PostShutdownAction string - -// Enum values for PostShutdownAction -const ( - PostShutdownActionStopped PostShutdownAction = "Stopped" - PostShutdownActionStoppedDeallocated PostShutdownAction = "StoppedDeallocated" -) - -// ShutdownRoleOperation contains the information for shutting down a Role. -type ShutdownRoleOperation struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ShutdownRoleOperation"` - OperationType string - PostShutdownAction PostShutdownAction -} - -// RestartRoleOperation contains the information for restarting a Role. -type RestartRoleOperation struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure RestartRoleOperation"` - OperationType string -} - -// CaptureRoleOperation contains the information for capturing a Role -type CaptureRoleOperation struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CaptureRoleOperation"` - OperationType string - PostCaptureAction PostCaptureAction - ProvisioningConfiguration *ConfigurationSet `xml:",omitempty"` - TargetImageLabel string - TargetImageName string -} - -type PostCaptureAction string - -// Enum values for PostCaptureAction -const ( - PostCaptureActionDelete PostCaptureAction = "Delete" - PostCaptureActionReprovision PostCaptureAction = "Reprovision" -) - -// RoleSizeList contains a list of the available role sizes -type RoleSizeList struct { - XMLName xml.Name `xml:"RoleSizes"` - RoleSizes []RoleSize `xml:"RoleSize"` -} - -// RoleSize contains a detailed explanation of a role size -type RoleSize struct { - Name string - Label string - Cores int - MemoryInMb int - SupportedByWebWorkerRoles bool - SupportedByVirtualMachines bool - MaxDataDiskCount int - WebWorkerResourceDiskSizeInMb int - VirtualMachineResourceDiskSizeInMb int -} - -// DNSServer contains the definition of a DNS server for virtual machine deployment -type DNSServer struct { - Name string - Address string -} - -// LoadBalancer contains the definition of a load balancer for virtual machine deployment -type LoadBalancer struct { - Name string // Specifies the name of the internal load balancer. - Type IPAddressType `xml:"FrontendIpConfiguration>Type"` // Specifies the type of virtual IP address that is provided by the load balancer. The only allowable value is Private. - SubnetName string `xml:"FrontendIpConfiguration>SubnetName,omitempty"` // Required if the deployment exists in a virtual network and a StaticVirtualNetworkIPAddress is assigned. Specifies the subnet of the virtual network that the load balancer uses. The virtual IP address that is managed by the load balancer is contained in this subnet. - StaticVirtualNetworkIPAddress string `xml:"FrontendIpConfiguration>StaticVirtualNetworkIPAddress,omitempty"` // Specifies a specific virtual IP address that the load balancer uses from the subnet in the virtual network. -} - -type IPAddressType string - -// Enum values for IPAddressType -const ( - IPAddressTypePrivate IPAddressType = "Private" // Only allowed value (currently) for IPAddressType -) - -type ResourceExtensions struct { - List []ResourceExtension `xml:"ResourceExtension"` -} - -type ResourceExtension struct { - Publisher string - Name string - Version string - Label string - Description string - PublicConfigurationSchema string - PrivateConfigurationSchema string - SampleConfig string - ReplicationCompleted string - Eula string - PrivacyURI string `xml:"PrivacyUri"` - HomepageURI string `xml:"HomepageUri"` - IsJSONExtension bool `xml:"IsJsonExtension"` - IsInternalExtension bool - DisallowMajorVersionUpgrade bool - CompanyName string - SupportedOS string - PublishedDate string -} - -type PersistentVMRole struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure PersistentVMRole"` - Role -} +package virtualmachine + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" + vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" +) + +// VirtualMachineClient is used to perform operations on Azure Virtual Machines +type VirtualMachineClient struct { + client management.Client +} + +// DeploymentRequest is the type for creating a deployment and Virtual Machine +// in the deployment based on the specified configuration. See +// https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx +type DeploymentRequest struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Deployment"` + // Required parameters: + Name string `` // Specifies a name for the deployment. The deployment name must be unique among other deployments for the cloud service. + DeploymentSlot string `` // Specifies the environment in which the Virtual Machine is to be deployed. The only allowable value is Production. + Label string `` // Specifies an identifier for the deployment. The label can be up to 100 characters long. The label can be used for tracking purposes. + RoleList []Role `xml:">Role"` // Contains information about the Virtual Machines that are to be deployed. + // Optional parameters: + VirtualNetworkName string `xml:",omitempty"` // Specifies the name of an existing virtual network to which the deployment will belong. + DNSServers []DNSServer `xml:"Dns>DnsServers>DnsServer,omitempty"` // Contains a list of DNS servers to associate with the Virtual Machine. + LoadBalancers []LoadBalancer `xml:">LoadBalancer,omitempty"` // Contains a list of internal load balancers that can be assigned to input endpoints. + ReservedIPName string `xml:",omitempty"` // Specifies the name of a reserved IP address that is to be assigned to the deployment. +} + +// DeploymentResponse is the type for receiving deployment information +// See https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx +type DeploymentResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Deployment"` + + Name string + DeploymentSlot string + Status DeploymentStatus + Label string + URL string `xml:"Url"` + Configuration string + RoleInstanceList []RoleInstance `xml:">RoleInstance"` + UpgradeStatus UpgradeStatus + UpgradeDomainCount int + RoleList []Role `xml:">Role"` + SdkVersion string + Locked bool + RollbackAllowed bool + CreatedTime string + LastModifiedTime string + VirtualNetworkName string + DNSServers []DNSServer `xml:"Dns>DnsServers>DnsServer"` + LoadBalancers []LoadBalancer `xml:">LoadBalancer"` + ExtendedProperties []ExtendedProperty `xml:">ExtendedProperty"` + PersistentVMDowntime PersistentVMDowntime + VirtualIPs []VirtualIP `xml:">VirtualIP"` + ExtensionConfiguration string // cloud service extensions not fully implemented + ReservedIPName string + InternalDNSSuffix string `xml:"InternalDnsSuffix"` +} + +type DeploymentStatus string + +const ( + DeploymentStatusRunning DeploymentStatus = "Running" + DeploymentStatusSuspended DeploymentStatus = "Suspended" + DeploymentStatusRunningTransitioning DeploymentStatus = "RunningTransitioning" + DeploymentStatusSuspendedTransitioning DeploymentStatus = "SuspendedTransitioning" + DeploymentStatusStarting DeploymentStatus = "Starting" + DeploymentStatusSuspending DeploymentStatus = "Suspending" + DeploymentStatusDeploying DeploymentStatus = "Deploying" + DeploymentStatusDeleting DeploymentStatus = "Deleting" +) + +type RoleInstance struct { + RoleName string + InstanceName string + InstanceStatus InstanceStatus + ExtendedInstanceStatus string + InstanceUpgradeDomain int + InstanceFaultDomain int + InstanceSize string + InstanceStateDetails string + InstanceErrorCode string + IPAddress string `xml:"IpAddress"` + InstanceEndpoints []InstanceEndpoint `xml:">InstanceEndpoint"` + PowerState PowerState + HostName string + RemoteAccessCertificateThumbprint string + GuestAgentStatus string // todo: implement + ResourceExtensionStatusList []ResourceExtensionStatus `xml:">ResourceExtensionStatus"` + PublicIPs []PublicIP `xml:">PublicIP"` +} + +type InstanceStatus string + +const ( + InstanceStatusUnknown = "Unknown" + InstanceStatusCreatingVM = "CreatingVM" + InstanceStatusStartingVM = "StartingVM" + InstanceStatusCreatingRole = "CreatingRole" + InstanceStatusStartingRole = "StartingRole" + InstanceStatusReadyRole = "ReadyRole" + InstanceStatusBusyRole = "BusyRole" + InstanceStatusStoppingRole = "StoppingRole" + InstanceStatusStoppingVM = "StoppingVM" + InstanceStatusDeletingVM = "DeletingVM" + InstanceStatusStoppedVM = "StoppedVM" + InstanceStatusRestartingRole = "RestartingRole" + InstanceStatusCyclingRole = "CyclingRole" + InstanceStatusFailedStartingRole = "FailedStartingRole" + InstanceStatusFailedStartingVM = "FailedStartingVM" + InstanceStatusUnresponsiveRole = "UnresponsiveRole" + InstanceStatusStoppedDeallocated = "StoppedDeallocated" + InstanceStatusPreparing = "Preparing" +) + +type InstanceEndpoint struct { + Name string + Vip string + PublicPort int + LocalPort int + Protocol InputEndpointProtocol +} + +type PowerState string + +const ( + PowerStateStarting PowerState = "Starting" + PowerStateStarted PowerState = "Started" + PowerStateStopping PowerState = "Stopping" + PowerStateStopped PowerState = "Stopped" + PowerStateUnknown PowerState = "Unknown" +) + +type ResourceExtensionStatus struct { + HandlerName string + Version string + Status ResourceExtensionState + Code string + FormattedMessage FormattedMessage + ExtensionSettingStatus ExtensionSettingStatus +} + +type ResourceExtensionState string + +const ( + ResourceExtensionStateInstalling ResourceExtensionState = "Installing" + ResourceExtensionStateReady ResourceExtensionState = "Ready" + ResourceExtensionStateNotReady ResourceExtensionState = "NotReady" + ResourceExtensionStateUnresponsive ResourceExtensionState = "Unresponsive" +) + +type FormattedMessage struct { + Language string + Message string +} + +type ExtensionSettingStatus struct { + Timestamp string + Name string + Operation string + Status ExtensionSettingState + Code string + FormattedMessage FormattedMessage + SubStatusList []SubStatus `xml:">SubStatus"` +} + +type ExtensionSettingState string + +const ( + ExtensionSettingStateTransitioning ExtensionSettingState = "transitioning" + ExtensionSettingStateError ExtensionSettingState = "error" + ExtensionSettingStateSuccess ExtensionSettingState = "success" + ExtensionSettingStateWarning ExtensionSettingState = "warning" +) + +type SubStatus struct { + Name string + Status ExtensionSettingState + FormattedMessage FormattedMessage +} + +type UpgradeStatus struct { + UpgradeType UpgradeType + CurrentUpgradeDomainState CurrentUpgradeDomainState + CurrentUpgradeDomain int +} + +type UpgradeType string + +const ( + UpgradeTypeAuto UpgradeType = "Auto" + UpgradeTypeManual UpgradeType = "Manual" + UpgradeTypeSimultaneous UpgradeType = "Simultaneous" +) + +type CurrentUpgradeDomainState string + +const ( + CurrentUpgradeDomainStateBefore CurrentUpgradeDomainState = "Before" + CurrentUpgradeDomainStateDuring CurrentUpgradeDomainState = "During" +) + +type ExtendedProperty struct { + Name string + Value string +} + +type PersistentVMDowntime struct { + StartTime string + EndTime string + Status string +} + +type VirtualIP struct { + Address string + IsReserved bool + ReservedIPName string + Type IPAddressType +} + +// Role contains the configuration sets that are used to create virtual +// machines. +type Role struct { + RoleName string `xml:",omitempty"` // Specifies the name for the Virtual Machine. + RoleType string `xml:",omitempty"` // Specifies the type of role to use. For Virtual Machines, this must be PersistentVMRole. + ConfigurationSets []ConfigurationSet `xml:"ConfigurationSets>ConfigurationSet,omitempty"` + ResourceExtensionReferences *[]ResourceExtensionReference `xml:"ResourceExtensionReferences>ResourceExtensionReference,omitempty"` + VMImageName string `xml:",omitempty"` // Specifies the name of the VM Image that is to be used to create the Virtual Machine. If this element is used, the ConfigurationSets element is not used. + MediaLocation string `xml:",omitempty"` // Required if the Virtual Machine is being created from a published VM Image. Specifies the location of the VHD file that is created when VMImageName specifies a published VM Image. + AvailabilitySetName string `xml:",omitempty"` // Specifies the name of a collection of Virtual Machines. Virtual Machines specified in the same availability set are allocated to different nodes to maximize availability. + DataVirtualHardDisks []DataVirtualHardDisk `xml:"DataVirtualHardDisks>DataVirtualHardDisk,omitempty"` // Contains the parameters that are used to add a data disk to a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used. + OSVirtualHardDisk *OSVirtualHardDisk `xml:",omitempty"` // Contains the parameters that are used to create the operating system disk for a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used. + RoleSize string `xml:",omitempty"` // Specifies the size of the Virtual Machine. The default size is Small. + ProvisionGuestAgent bool `xml:",omitempty"` // Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed. + VMImageInput *VMImageInput `xml:",omitempty"` // When a VM Image is used to create a new PersistentVMRole, the DiskConfigurations in the VM Image are used to create new Disks for the new VM. This parameter can be used to resize the newly created Disks to a larger size than the underlying DiskConfigurations in the VM Image. + + UseCertAuth bool `xml:"-"` + CertPath string `xml:"-"` +} + +// VMImageInput is for when a VM Image is used to create a new PersistantVMRole, +// the DiskConfigurations in the VM Image are used to create new Disks for the +// new VM. This parameter can be used to resize the newly created Disks to a +// larger size than the underlying DiskConfigurations in the VM Image. +type VMImageInput struct { + OSDiskConfiguration *OSDiskConfiguration `xml:",omitempty"` // This corresponds to the OSDiskConfiguration of the VM Image used to create a new role. The OSDiskConfiguration element is only available using version 2014-10-01 or higher. + DataDiskConfigurations []DataDiskConfiguration `xml:">DataDiskConfiguration,omitempty"` // This corresponds to the DataDiskConfigurations of the VM Image used to create a new role. The DataDiskConfigurations element is only available using version 2014-10-01 or higher. +} + +// OSDiskConfiguration is used to resize the OS disk of a new VM created from a +// previously saved VM image. +type OSDiskConfiguration struct { + ResizedSizeInGB int +} + +// DataDiskConfiguration is used to resize the data disks of a new VM created +// from a previously saved VM image. +type DataDiskConfiguration struct { + OSDiskConfiguration + Name string // The Name of the DataDiskConfiguration being referenced to. + +} + +// ResourceExtensionReference contains a collection of resource extensions that +// are to be installed on the Virtual Machine. The VM Agent must be installed on +// the Virtual Machine to install resource extensions. For more information, see +// Manage Extensions: +// +// https://msdn.microsoft.com/en-us/library/dn606311.aspx. +type ResourceExtensionReference struct { + ReferenceName string + Publisher string + Name string + Version string + ParameterValues []ResourceExtensionParameter `xml:"ResourceExtensionParameterValues>ResourceExtensionParameterValue,omitempty"` + State string +} + +// ResourceExtensionParameter specifies the key, value, and type of a parameter that is passed to the +// resource extension when it is installed. +type ResourceExtensionParameter struct { + Key string + Value string + Type ResourceExtensionParameterType // If this value is set to Private, the parameter will not be returned by Get Deployment (). +} + +type ResourceExtensionParameterType string + +// Enum values for ResourceExtensionParameterType +const ( + ResourceExtensionParameterTypePublic ResourceExtensionParameterType = "Public" + ResourceExtensionParameterTypePrivate ResourceExtensionParameterType = "Private" +) + +// DataVirtualHardDisk specifies the properties that are used to create a data +// disk. +type DataVirtualHardDisk struct { + HostCaching vmdisk.HostCachingType `xml:",omitempty"` // Specifies the caching mode of the data disk. The default value is None. + DiskLabel string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal. + DiskName string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD are being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number. The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash. + Lun int `xml:",omitempty"` // Specifies the Logical Unit Number (LUN) for the data disk. If the disk is the first disk that is added, this element is optional and the default value of 0 is used. If more than one disk is being added, this element is required. Valid LUN values are 0 through 31. + LogicalDiskSizeInGB int `xml:",omitempty"` // Specifies the size, in GB, of an empty disk to be attached to the Virtual Machine. If the disk that is being added is already registered in the subscription, this element is ignored. If the disk and VHD is being created by Azure as it is added, this element defines the size of the new disk. + MediaLink string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added. + SourceMediaLink string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk does not exist in blob storage, this element is ignored. If the VHD file exists in blob storage, this element defines the path to the VHD and a disk is registered from it and attached to the virtual machine. +} + +// OSVirtualHardDisk specifies the properties that are used to create an OS +// disk. +type OSVirtualHardDisk struct { + HostCaching vmdisk.HostCachingType `xml:",omitempty"` // Specifies the caching mode of the data disk. The default value is None. + DiskLabel string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal. + DiskName string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD are being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number. The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash. + MediaLink string `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added. + SourceImageName string `xml:",omitempty"` + OS string `xml:",omitempty"` + RemoteSourceImageLink string `xml:",omitempty"` // Specifies a publicly accessible URI or a SAS URI to the location where an OS image is stored that is used to create the Virtual Machine. This location can be a different location than the user or platform image repositories in Azure. An image is always associated with a VHD, which is a .vhd file stored as a page blob in a storage account in Azure. If you specify the path to an image with this element, an associated VHD is created and you must use the MediaLink element to specify the location in storage where the VHD will be located. If this element is used, SourceImageName is not used. + ResizedSizeInGB int `xml:",omitempty"` +} + +// ConfigurationSet specifies the configuration elements of the Virtual Machine. +// The type attribute is required to prevent the administrator password from +// being written to the operation history file. +type ConfigurationSet struct { + ConfigurationSetType ConfigurationSetType + + // Windows provisioning: + ComputerName string `xml:",omitempty"` // Optional. Specifies the computer name for the Virtual Machine. If you do not specify a computer name, one is assigned that is a combination of the deployment name, role name, and identifying number. Computer names must be 1 to 15 characters long. + AdminPassword string `xml:",omitempty"` // Optional. Specifies the password to use for an administrator account on the Virtual Machine that is being created. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created on the machine using the AdminUsername element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk. + EnableAutomaticUpdates bool `xml:",omitempty"` // Optional. Specifies whether automatic updates are enabled for the Virtual Machine. The default value is true. + TimeZone string `xml:",omitempty"` // Optional. Specifies the time zone for the Virtual Machine. + DomainJoin *DomainJoin `xml:",omitempty"` // Optional. Contains properties that define a domain to which the Virtual Machine will be joined. + StoredCertificateSettings []CertificateSetting `xml:">StoredCertificateSetting,omitempty"` // Optional. Contains a list of service certificates with which to provision to the new Virtual Machine. + WinRMListeners *[]WinRMListener `xml:"WinRM>Listeners>Listener,omitempty"` // Optional. Contains configuration settings for the Windows Remote Management service on the Virtual Machine. This enables remote Windows PowerShell. + AdminUsername string `xml:",omitempty"` // Optional. Specifies the name of the administrator account that is created to access the Virtual Machine. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created by using this element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk. + AdditionalUnattendContent string `xml:",omitempty"` // Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. + + // Linux provisioning: + HostName string `xml:",omitempty"` // Required. Specifies the host name for the Virtual Machine. Host names must be 1 to 64 characters long. + UserName string `xml:",omitempty"` // Required. Specifies the name of a user account to be created in the sudoer group of the Virtual Machine. User account names must be 1 to 32 characters long. + UserPassword string `xml:",omitempty"` // Required. Specifies the password for the user account. Passwords must be 6 to 72 characters long. + DisableSSHPasswordAuthentication string `xml:"DisableSshPasswordAuthentication,omitempty"` // Optional. Specifies whether SSH password authentication is disabled. By default this value is set to true. + SSH *SSH `xml:",omitempty"` // Optional. Specifies the SSH public keys and key pairs to use with the Virtual Machine. + + // In WindowsProvisioningConfiguration: The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. The file is saved to %SYSTEMDRIVE%\AzureData\CustomData.bin. If the file exists, it is overwritten. The security on directory is set to System:Full Control and Administrators:Full Control. + // In LinuxProvisioningConfiguration: The base-64 encoded string is located in the ovf-env.xml file on the ISO of the Virtual Machine. The file is copied to /var/lib/waagent/ovf-env.xml by the Azure Linux Agent. The Azure Linux Agent will also place the base-64 encoded data in /var/lib/waagent/CustomData during provisioning. The maximum length of the binary array is 65535 bytes. + CustomData string `xml:",omitempty"` // Specifies a base-64 encoded string of custom data. + + // Network configuration: + InputEndpoints []InputEndpoint `xml:">InputEndpoint,omitempty"` // Optional in NetworkConfiguration. Contains a collection of external endpoints for the Virtual Machine. + SubnetNames []string `xml:">SubnetName,omitempty"` // Required if StaticVirtualNetworkIPAddress is specified; otherwise, optional in NetworkConfiguration. Contains a list of subnets to which the Virtual Machine will belong. + StaticVirtualNetworkIPAddress string `xml:",omitempty"` // Specifies the internal IP address for the Virtual Machine in a Virtual Network. If you specify this element, you must also specify the SubnetNames element with only one subnet defined. The IP address specified in this element must belong to the subnet that is defined in SubnetNames and it should not be the one of the first four IP addresses or the last IP address in the subnet. Deploying web roles or worker roles into a subnet that has Virtual Machines with StaticVirtualNetworkIPAddress defined is not supported. + NetworkSecurityGroup string `xml:",omitempty"` // Optional in NetworkConfiguration. Represents the name of the Network Security Group that will be associated with the Virtual Machine. Network Security Group must exist in the context of subscription and be created in same region to which the virtual machine will be deployed. + PublicIPs []PublicIP `xml:">PublicIP,omitempty"` // Contains a public IP address that can be used in addition to the default virtual IP address for the Virtual Machine. +} + +type ConfigurationSetType string + +// Enum values for ConfigurationSetType +const ( + ConfigurationSetTypeWindowsProvisioning ConfigurationSetType = "WindowsProvisioningConfiguration" + ConfigurationSetTypeLinuxProvisioning ConfigurationSetType = "LinuxProvisioningConfiguration" + ConfigurationSetTypeNetwork ConfigurationSetType = "NetworkConfiguration" +) + +// DomainJoin contains properties that define a domain to which the Virtual +// Machine will be joined. +type DomainJoin struct { + Credentials Credentials `xml:",omitempty"` // Specifies the credentials to use to join the Virtual Machine to the domain. + JoinDomain string `xml:",omitempty"` // Specifies the domain to join. + MachineObjectOU string `xml:",omitempty"` // Specifies the Lightweight Directory Access Protocol (LDAP) X 500-distinguished name of the organizational unit (OU) in which the computer account is created. This account is in Active Directory on a domain controller in the domain to which the computer is being joined. +} + +// Credentials specifies the credentials to use to join the Virtual Machine to +// the domain. If Domain is not specified, Username must specify the user +// principal name (UPN) format (user@fully-qualified-DNS-domain) or the fully- +// qualified-DNS-domain\username format. +type Credentials struct { + Domain string // Specifies the name of the domain used to authenticate an account. The value is a fully qualified DNS domain. + Username string // Specifies a user name in the domain that can be used to join the domain. + Password string // Specifies the password to use to join the domain. +} + +// CertificateSetting specifies the parameters for the certificate which to +// provision to the new Virtual Machine. +type CertificateSetting struct { + StoreLocation string // Required. Specifies the certificate store location on the Virtual Machine. The only supported value is "LocalMachine". + StoreName string // Required. Specifies the name of the certificate store from which the certificate is retrieved. For example, "My". + Thumbprint string // Required. Specifies the thumbprint of the certificate. The thumbprint must specify an existing service certificate. +} + +// WinRMListener specifies the protocol and certificate information for a WinRM +// listener. +type WinRMListener struct { + Protocol WinRMProtocol // Specifies the protocol of listener. + CertificateThumbprint string `xml:",omitempty"` // Specifies the certificate thumbprint for the secure connection. If this value is not specified, a self-signed certificate is generated and used for the Virtual Machine. +} + +type WinRMProtocol string + +// Enum values for WinRMProtocol +const ( + WinRMProtocolHTTP WinRMProtocol = "Http" + WinRMProtocolHTTPS WinRMProtocol = "Https" +) + +// SSH specifies the SSH public keys and key pairs to use with the Virtual Machine. +type SSH struct { + PublicKeys []PublicKey `xml:">PublicKey"` + KeyPairs []KeyPair `xml:">KeyPair"` +} + +// PublicKey specifies a public SSH key. +type PublicKey struct { + Fingerprint string // Specifies the SHA1 fingerprint of an X509 certificate associated with the cloud service and includes the SSH public key. + // Specifies the full path of a file, on the Virtual Machine, where the SSH public key is stored. If + // the file already exists, the specified key is appended to the file. + Path string // Usually /home/username/.ssh/authorized_keys +} + +// KeyPair specifies an SSH keypair. +type KeyPair struct { + Fingerprint string // Specifies the SHA1 fingerprint of an X509 certificate that is associated with the cloud service and includes the SSH keypair. + // Specifies the full path of a file, on the virtual machine, which stores the SSH private key. The + // file is overwritten when multiple keys are written to it. The SSH public key is stored in the same + // directory and has the same name as the private key file with .pub suffix. + Path string // Usually /home/username/.ssh/id_rsa +} + +// InputEndpoint specifies the properties that define an external endpoint for +// the Virtual Machine. +type InputEndpoint struct { + LocalPort int // Specifies the internal port on which the Virtual Machine is listening. + Name string // Specifies the name of the external endpoint. + Port int // Specifies the external port to use for the endpoint. + Protocol InputEndpointProtocol //Specifies the transport protocol for the endpoint. + Vip string `xml:",omitempty"` +} + +type InputEndpointProtocol string + +// Enum values for InputEndpointProtocol +const ( + InputEndpointProtocolTCP InputEndpointProtocol = "TCP" + InputEndpointProtocolUDP InputEndpointProtocol = "UDP" +) + +// PublicIP contains a public IP address that can be used in addition to default +// virtual IP address for the Virtual Machine. +type PublicIP struct { + Name string // Specifies the name of the public IP address. + Address string // Specifies the IP address. + IdleTimeoutInMinutes int `xml:",omitempty"` // Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. +} + +// ServiceCertificate contains a certificate for adding it to a hosted service +type ServiceCertificate struct { + XMLName xml.Name `xml:"CertificateFile"` + Data string + CertificateFormat string + Password string `xml:",omitempty"` +} + +// StartRoleOperation contains the information for starting a Role. +type StartRoleOperation struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure StartRoleOperation"` + OperationType string +} + +type PostShutdownAction string + +// Enum values for PostShutdownAction +const ( + PostShutdownActionStopped PostShutdownAction = "Stopped" + PostShutdownActionStoppedDeallocated PostShutdownAction = "StoppedDeallocated" +) + +// ShutdownRoleOperation contains the information for shutting down a Role. +type ShutdownRoleOperation struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure ShutdownRoleOperation"` + OperationType string + PostShutdownAction PostShutdownAction +} + +// RestartRoleOperation contains the information for restarting a Role. +type RestartRoleOperation struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure RestartRoleOperation"` + OperationType string +} + +// CaptureRoleOperation contains the information for capturing a Role +type CaptureRoleOperation struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CaptureRoleOperation"` + OperationType string + PostCaptureAction PostCaptureAction + ProvisioningConfiguration *ConfigurationSet `xml:",omitempty"` + TargetImageLabel string + TargetImageName string +} + +type PostCaptureAction string + +// Enum values for PostCaptureAction +const ( + PostCaptureActionDelete PostCaptureAction = "Delete" + PostCaptureActionReprovision PostCaptureAction = "Reprovision" +) + +// RoleSizeList contains a list of the available role sizes +type RoleSizeList struct { + XMLName xml.Name `xml:"RoleSizes"` + RoleSizes []RoleSize `xml:"RoleSize"` +} + +// RoleSize contains a detailed explanation of a role size +type RoleSize struct { + Name string + Label string + Cores int + MemoryInMb int + SupportedByWebWorkerRoles bool + SupportedByVirtualMachines bool + MaxDataDiskCount int + WebWorkerResourceDiskSizeInMb int + VirtualMachineResourceDiskSizeInMb int +} + +// DNSServer contains the definition of a DNS server for virtual machine deployment +type DNSServer struct { + Name string + Address string +} + +// LoadBalancer contains the definition of a load balancer for virtual machine deployment +type LoadBalancer struct { + Name string // Specifies the name of the internal load balancer. + Type IPAddressType `xml:"FrontendIpConfiguration>Type"` // Specifies the type of virtual IP address that is provided by the load balancer. The only allowable value is Private. + SubnetName string `xml:"FrontendIpConfiguration>SubnetName,omitempty"` // Required if the deployment exists in a virtual network and a StaticVirtualNetworkIPAddress is assigned. Specifies the subnet of the virtual network that the load balancer uses. The virtual IP address that is managed by the load balancer is contained in this subnet. + StaticVirtualNetworkIPAddress string `xml:"FrontendIpConfiguration>StaticVirtualNetworkIPAddress,omitempty"` // Specifies a specific virtual IP address that the load balancer uses from the subnet in the virtual network. +} + +type IPAddressType string + +// Enum values for IPAddressType +const ( + IPAddressTypePrivate IPAddressType = "Private" // Only allowed value (currently) for IPAddressType +) + +type ResourceExtensions struct { + List []ResourceExtension `xml:"ResourceExtension"` +} + +type ResourceExtension struct { + Publisher string + Name string + Version string + Label string + Description string + PublicConfigurationSchema string + PrivateConfigurationSchema string + SampleConfig string + ReplicationCompleted string + Eula string + PrivacyURI string `xml:"PrivacyUri"` + HomepageURI string `xml:"HomepageUri"` + IsJSONExtension bool `xml:"IsJsonExtension"` + IsInternalExtension bool + DisallowMajorVersionUpgrade bool + CompanyName string + SupportedOS string + PublishedDate string +} + +type PersistentVMRole struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure PersistentVMRole"` + Role +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go index a4c3e793d1..3118e6c5af 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/entities_test.go @@ -1,299 +1,299 @@ -package virtualmachine - -import ( - "encoding/xml" - "testing" -) - -func TestDocumentedDeploymentRequest(t *testing.T) { - // xml based on https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx - // fixed typos, replaced strongly typed fields with values of correct type - xmlString := ` - name-of-deployment - deployment-environment - - - - name-of-the-virtual-machine - PersistentVMRole - - - WindowsProvisioningConfiguration - name-of-computer - administrator-password - true - time-zone - - - domain-to-join - user-name-in-the-domain - password-for-the-user-name - - domain-to-join - distinguished-name-of-the-ou - - - - LocalMachine - name-of-store-on-the-machine - certificate-thumbprint - - - - - - listener-protocol - - - certificate-thumbprint - listener-protocol - - - - name-of-administrator-account - base-64-encoded-data - - - - name-of-pass - - - name-of-component - - - name-of-setting - base-64-encoded-XML-content - - - - - - - - - - LinuxProvisioningConfiguration - host-name-for-the-virtual-machine - new-user-name - password-for-the-new-user - true - - - - certificate-fingerprint - SSH-public-key-storage-location - - - - - certificate-fingerprint - SSH-public-key-storage-location - - - - base-64-encoded-data - - - NetworkConfiguration - - - name-of-load-balanced-set - 22 - ZZH - 33 - - /probe/me - 80 - http - 30 - 5 - - endpoint-protocol - enable-direct-server-return - - - - priority-of-the-rule - permit-rule - subnet-of-the-rule - description-of-the-rule - - - - name-of-internal-loadbalancer - 9 - - - - name-of-subnet - - ip-address - - - name-of-public-ip - 11 - - - - - - - name-of-reference - name-of-publisher - name-of-extension - version-of-extension - - - name-of-parameter-key - parameter-value - type-of-parameter - - - state-of-resource - - - certificate-thumbprint - certificate-algorithm - - - - - name-of-vm-image - path-to-vhd - name-of-availability-set - - - caching-mode - label-of-data-disk - name-of-disk - 0 - 50 - path-to-vhd - - - - caching-mode - label-of-operating-system-disk - name-of-disk - path-to-vhd - name-of-source-image - operating-system-of-image - path-to-source-image - 125 - - size-of-virtual-machine - true - - - 126 - - - - disk-name - 127 - - - - - - name-of-virtual-network - - - - dns-name -
dns-ip-address
-
-
-
- name-of-reserved-ip - - - name-of-internal-load-balancer - - Private - name-of-subnet - static-ip-address - - - -
` - - deployment := DeploymentRequest{} - if err := xml.Unmarshal([]byte(xmlString), &deployment); err != nil { - t.Fatal(err) - } - - if deployment.Name != "name-of-deployment" { - t.Fatalf("Expected deployment.Name=\"name-of-deployment\", but got \"%s\"", - deployment.Name) - } - - // ====== - - t.Logf("deployment.RoleList[0]: %+v", deployment.RoleList[0]) - if expected := "name-of-the-virtual-machine"; deployment.RoleList[0].RoleName != expected { - t.Fatalf("Expected deployment.RoleList[0].RoleName=%v, but got %v", expected, deployment.RoleList[0].RoleName) - } - - // ====== - - t.Logf("deployment.DNSServers[0]: %+v", deployment.DNSServers[0]) - if deployment.DNSServers[0].Name != "dns-name" { - t.Fatalf("Expected deployment.DNSServers[0].Name=\"dns-name\", but got \"%s\"", - deployment.DNSServers[0].Name) - } - - // ====== - - t.Logf("deployment.LoadBalancers[0]: %+v", deployment.LoadBalancers[0]) - if deployment.LoadBalancers[0].Name != "name-of-internal-load-balancer" { - t.Fatalf("Expected deployment.LoadBalancers[0].Name=\"name-of-internal-load-balancer\", but got \"%s\"", - deployment.LoadBalancers[0].Name) - } - - if deployment.LoadBalancers[0].Type != IPAddressTypePrivate { - t.Fatalf("Expected deployment.LoadBalancers[0].Type=IPAddressTypePrivate, but got \"%s\"", - deployment.LoadBalancers[0].Type) - } - - if deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress != "static-ip-address" { - t.Fatalf("Expected deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress=\"static-ip-address\", but got \"%s\"", - deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress) - } - - // ====== - - extensionReferences := (*deployment.RoleList[0].ResourceExtensionReferences) - t.Logf("(*deployment.RoleList[0].ResourceExtensionReferences)[0]: %+v", extensionReferences[0]) - if extensionReferences[0].Name != "name-of-extension" { - t.Fatalf("Expected (*deployment.RoleList[0].ResourceExtensionReferences)[0].Name=\"name-of-extension\", but got \"%s\"", - extensionReferences[0].Name) - } - - if extensionReferences[0].ParameterValues[0].Key != "name-of-parameter-key" { - t.Fatalf("Expected (*deployment.RoleList[0].ResourceExtensionReferences)[0].ParameterValues[0].Key=\"name-of-parameter-key\", but got %v", - extensionReferences[0].ParameterValues[0].Key) - } - - // ====== - - if deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB != 127 { - t.Fatalf("Expected deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB=127, but got %v", - deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB) - } - - // ====== - - winRMlisteners := *deployment.RoleList[0].ConfigurationSets[0].WinRMListeners - if string(winRMlisteners[0].Protocol) != "listener-protocol" { - t.Fatalf("Expected winRMlisteners[0].Protocol to be listener-protocol, but got %s", - string(winRMlisteners[0].Protocol)) - } - - winRMlisteners2 := *deployment.RoleList[0].ConfigurationSets[0].WinRMListeners - if winRMlisteners2[1].CertificateThumbprint != "certificate-thumbprint" { - t.Fatalf("Expected winRMlisteners2[1].CertificateThumbprint to be certificate-thumbprint, but got %s", - winRMlisteners2[1].CertificateThumbprint) - } - -} +package virtualmachine + +import ( + "encoding/xml" + "testing" +) + +func TestDocumentedDeploymentRequest(t *testing.T) { + // xml based on https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx + // fixed typos, replaced strongly typed fields with values of correct type + xmlString := ` + name-of-deployment + deployment-environment + + + + name-of-the-virtual-machine + PersistentVMRole + + + WindowsProvisioningConfiguration + name-of-computer + administrator-password + true + time-zone + + + domain-to-join + user-name-in-the-domain + password-for-the-user-name + + domain-to-join + distinguished-name-of-the-ou + + + + LocalMachine + name-of-store-on-the-machine + certificate-thumbprint + + + + + + listener-protocol + + + certificate-thumbprint + listener-protocol + + + + name-of-administrator-account + base-64-encoded-data + + + + name-of-pass + + + name-of-component + + + name-of-setting + base-64-encoded-XML-content + + + + + + + + + + LinuxProvisioningConfiguration + host-name-for-the-virtual-machine + new-user-name + password-for-the-new-user + true + + + + certificate-fingerprint + SSH-public-key-storage-location + + + + + certificate-fingerprint + SSH-public-key-storage-location + + + + base-64-encoded-data + + + NetworkConfiguration + + + name-of-load-balanced-set + 22 + ZZH + 33 + + /probe/me + 80 + http + 30 + 5 + + endpoint-protocol + enable-direct-server-return + + + + priority-of-the-rule + permit-rule + subnet-of-the-rule + description-of-the-rule + + + + name-of-internal-loadbalancer + 9 + + + + name-of-subnet + + ip-address + + + name-of-public-ip + 11 + + + + + + + name-of-reference + name-of-publisher + name-of-extension + version-of-extension + + + name-of-parameter-key + parameter-value + type-of-parameter + + + state-of-resource + + + certificate-thumbprint + certificate-algorithm + + + + + name-of-vm-image + path-to-vhd + name-of-availability-set + + + caching-mode + label-of-data-disk + name-of-disk + 0 + 50 + path-to-vhd + + + + caching-mode + label-of-operating-system-disk + name-of-disk + path-to-vhd + name-of-source-image + operating-system-of-image + path-to-source-image + 125 + + size-of-virtual-machine + true + + + 126 + + + + disk-name + 127 + + + + + + name-of-virtual-network + + + + dns-name +
dns-ip-address
+
+
+
+ name-of-reserved-ip + + + name-of-internal-load-balancer + + Private + name-of-subnet + static-ip-address + + + +
` + + deployment := DeploymentRequest{} + if err := xml.Unmarshal([]byte(xmlString), &deployment); err != nil { + t.Fatal(err) + } + + if deployment.Name != "name-of-deployment" { + t.Fatalf("Expected deployment.Name=\"name-of-deployment\", but got \"%s\"", + deployment.Name) + } + + // ====== + + t.Logf("deployment.RoleList[0]: %+v", deployment.RoleList[0]) + if expected := "name-of-the-virtual-machine"; deployment.RoleList[0].RoleName != expected { + t.Fatalf("Expected deployment.RoleList[0].RoleName=%v, but got %v", expected, deployment.RoleList[0].RoleName) + } + + // ====== + + t.Logf("deployment.DNSServers[0]: %+v", deployment.DNSServers[0]) + if deployment.DNSServers[0].Name != "dns-name" { + t.Fatalf("Expected deployment.DNSServers[0].Name=\"dns-name\", but got \"%s\"", + deployment.DNSServers[0].Name) + } + + // ====== + + t.Logf("deployment.LoadBalancers[0]: %+v", deployment.LoadBalancers[0]) + if deployment.LoadBalancers[0].Name != "name-of-internal-load-balancer" { + t.Fatalf("Expected deployment.LoadBalancers[0].Name=\"name-of-internal-load-balancer\", but got \"%s\"", + deployment.LoadBalancers[0].Name) + } + + if deployment.LoadBalancers[0].Type != IPAddressTypePrivate { + t.Fatalf("Expected deployment.LoadBalancers[0].Type=IPAddressTypePrivate, but got \"%s\"", + deployment.LoadBalancers[0].Type) + } + + if deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress != "static-ip-address" { + t.Fatalf("Expected deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress=\"static-ip-address\", but got \"%s\"", + deployment.LoadBalancers[0].StaticVirtualNetworkIPAddress) + } + + // ====== + + extensionReferences := (*deployment.RoleList[0].ResourceExtensionReferences) + t.Logf("(*deployment.RoleList[0].ResourceExtensionReferences)[0]: %+v", extensionReferences[0]) + if extensionReferences[0].Name != "name-of-extension" { + t.Fatalf("Expected (*deployment.RoleList[0].ResourceExtensionReferences)[0].Name=\"name-of-extension\", but got \"%s\"", + extensionReferences[0].Name) + } + + if extensionReferences[0].ParameterValues[0].Key != "name-of-parameter-key" { + t.Fatalf("Expected (*deployment.RoleList[0].ResourceExtensionReferences)[0].ParameterValues[0].Key=\"name-of-parameter-key\", but got %v", + extensionReferences[0].ParameterValues[0].Key) + } + + // ====== + + if deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB != 127 { + t.Fatalf("Expected deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB=127, but got %v", + deployment.RoleList[0].VMImageInput.DataDiskConfigurations[0].ResizedSizeInGB) + } + + // ====== + + winRMlisteners := *deployment.RoleList[0].ConfigurationSets[0].WinRMListeners + if string(winRMlisteners[0].Protocol) != "listener-protocol" { + t.Fatalf("Expected winRMlisteners[0].Protocol to be listener-protocol, but got %s", + string(winRMlisteners[0].Protocol)) + } + + winRMlisteners2 := *deployment.RoleList[0].ConfigurationSets[0].WinRMListeners + if winRMlisteners2[1].CertificateThumbprint != "certificate-thumbprint" { + t.Fatalf("Expected winRMlisteners2[1].CertificateThumbprint to be certificate-thumbprint, but got %s", + winRMlisteners2[1].CertificateThumbprint) + } + +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions.go index 07c37d15de..25320447e8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions.go @@ -1,25 +1,25 @@ -package virtualmachine - -import ( - "encoding/xml" -) - -const ( - azureResourceExtensionsURL = "services/resourceextensions" -) - -// GetResourceExtensions lists the resource extensions that are available to add -// to a virtual machine. -// -// See https://msdn.microsoft.com/en-us/library/azure/dn495441.aspx -func (c VirtualMachineClient) GetResourceExtensions() (extensions []ResourceExtension, err error) { - data, err := c.client.SendAzureGetRequest(azureResourceExtensionsURL) - if err != nil { - return extensions, err - } - - var response ResourceExtensions - err = xml.Unmarshal(data, &response) - extensions = response.List - return -} +package virtualmachine + +import ( + "encoding/xml" +) + +const ( + azureResourceExtensionsURL = "services/resourceextensions" +) + +// GetResourceExtensions lists the resource extensions that are available to add +// to a virtual machine. +// +// See https://msdn.microsoft.com/en-us/library/azure/dn495441.aspx +func (c VirtualMachineClient) GetResourceExtensions() (extensions []ResourceExtension, err error) { + data, err := c.client.SendAzureGetRequest(azureResourceExtensionsURL) + if err != nil { + return extensions, err + } + + var response ResourceExtensions + err = xml.Unmarshal(data, &response) + extensions = response.List + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go index 2f3c587367..b4ec2a7692 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachine/resourceextensions_test.go @@ -1,27 +1,27 @@ -package virtualmachine - -import ( - "testing" - - "github.com/Azure/azure-sdk-for-go/management/testutils" -) - -func TestAzureGetResourceExtensions(t *testing.T) { - client := testutils.GetTestClient(t) - - list, err := NewClient(client).GetResourceExtensions() - if err != nil { - t.Fatal(err) - } - - t.Logf("Found %d extensions", len(list)) - if len(list) == 0 { - t.Fatal("Huh, no resource extensions at all? Something must be wrong.") - } - - for _, extension := range list { - if extension.Name == "" { - t.Fatalf("Resource with empty name? Something must have gone wrong with serialization: %+v", extension) - } - } -} +package virtualmachine + +import ( + "testing" + + "github.com/Azure/azure-sdk-for-go/management/testutils" +) + +func TestAzureGetResourceExtensions(t *testing.T) { + client := testutils.GetTestClient(t) + + list, err := NewClient(client).GetResourceExtensions() + if err != nil { + t.Fatal(err) + } + + t.Logf("Found %d extensions", len(list)) + if len(list) == 0 { + t.Fatal("Huh, no resource extensions at all? Something must be wrong.") + } + + for _, extension := range list { + if extension.Name == "" { + t.Fatalf("Resource with empty name? Something must have gone wrong with serialization: %+v", extension) + } + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/client.go index 45fe52f25a..90f8d6561a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/client.go @@ -1,230 +1,230 @@ -// Package virtualmachinedisk provides a client for Virtual Machine Disks. -package virtualmachinedisk - -import ( - "encoding/xml" - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - addDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks" - addDiskURL = "services/disks" - deleteDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks/%d" - deleteDiskURL = "services/disks/%s" - getDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks/%d" - getDiskURL = "services/disks/%s" - listDisksURL = "services/disks" - updateDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks/%d" - updateDiskURL = "services/disks/%s" - - errParamNotSpecified = "Parameter %s is not specified." -) - -//NewClient is used to instantiate a new DiskClient from an Azure client -func NewClient(client management.Client) DiskClient { - return DiskClient{client: client} -} - -// AddDataDisk adds a data disk to a Virtual Machine -// -// https://msdn.microsoft.com/en-us/library/azure/jj157199.aspx -func (c DiskClient) AddDataDisk( - service string, - deployment string, - role string, - params CreateDataDiskParameters) (management.OperationID, error) { - if service == "" { - return "", fmt.Errorf(errParamNotSpecified, "service") - } - if deployment == "" { - return "", fmt.Errorf(errParamNotSpecified, "deployment") - } - if role == "" { - return "", fmt.Errorf(errParamNotSpecified, "role") - } - - requestURL := fmt.Sprintf(addDataDiskURL, service, deployment, role) - - req, err := xml.Marshal(params) - if err != nil { - return "", err - } - - return c.client.SendAzurePostRequest(requestURL, req) -} - -// AddDisk adds an operating system disk or data disk to the user image repository -// -// https://msdn.microsoft.com/en-us/library/azure/jj157178.aspx -func (c DiskClient) AddDisk(params CreateDiskParameters) (management.OperationID, error) { - req, err := xml.Marshal(params) - if err != nil { - return "", err - } - - return c.client.SendAzurePostRequest(addDiskURL, req) -} - -// DeleteDataDisk removes the specified data disk from a Virtual Machine -// -// https://msdn.microsoft.com/en-us/library/azure/jj157179.aspx -func (c DiskClient) DeleteDataDisk( - service string, - deployment string, - role string, - lun int, - deleteVHD bool) (management.OperationID, error) { - if service == "" { - return "", fmt.Errorf(errParamNotSpecified, "service") - } - if deployment == "" { - return "", fmt.Errorf(errParamNotSpecified, "deployment") - } - if role == "" { - return "", fmt.Errorf(errParamNotSpecified, "role") - } - - requestURL := fmt.Sprintf(deleteDataDiskURL, service, deployment, role, lun) - if deleteVHD { - requestURL += "?comp=media" - } - - return c.client.SendAzureDeleteRequest(requestURL) -} - -// DeleteDisk deletes the specified data or operating system disk from the image -// repository that is associated with the specified subscription -// -// https://msdn.microsoft.com/en-us/library/azure/jj157200.aspx -func (c DiskClient) DeleteDisk(name string, deleteVHD bool) error { - if name == "" { - return fmt.Errorf(errParamNotSpecified, "name") - } - - requestURL := fmt.Sprintf(deleteDiskURL, name) - if deleteVHD { - requestURL += "?comp=media" - } - - _, err := c.client.SendAzureDeleteRequest(requestURL) // request is handled synchronously - return err -} - -// GetDataDisk retrieves the specified data disk from a Virtual Machine -// -// https://msdn.microsoft.com/en-us/library/azure/jj157180.aspx -func (c DiskClient) GetDataDisk( - service string, - deployment string, - role string, - lun int) (DataDiskResponse, error) { - var response DataDiskResponse - if service == "" { - return response, fmt.Errorf(errParamNotSpecified, "service") - } - if deployment == "" { - return response, fmt.Errorf(errParamNotSpecified, "deployment") - } - if role == "" { - return response, fmt.Errorf(errParamNotSpecified, "role") - } - - requestURL := fmt.Sprintf(getDataDiskURL, service, deployment, role, lun) - - data, err := c.client.SendAzureGetRequest(requestURL) - if err != nil { - return response, err - } - - err = xml.Unmarshal(data, &response) - return response, err -} - -// GetDisk retrieves information about the specified disk -// -// https://msdn.microsoft.com/en-us/library/azure/dn775053.aspx -func (c DiskClient) GetDisk(name string) (DiskResponse, error) { - var response DiskResponse - if name == "" { - return response, fmt.Errorf(errParamNotSpecified, "name") - } - - requestURL := fmt.Sprintf(getDiskURL, name) - - data, err := c.client.SendAzureGetRequest(requestURL) - if err != nil { - return response, err - } - - err = xml.Unmarshal(data, &response) - return response, err -} - -// ListDisks retrieves a list of the disks in the image repository that is associated -// with the specified subscription -// -// https://msdn.microsoft.com/en-us/library/azure/jj157176.aspx -func (c DiskClient) ListDisks() (ListDiskResponse, error) { - var response ListDiskResponse - - data, err := c.client.SendAzureGetRequest(listDisksURL) - if err != nil { - return response, err - } - - err = xml.Unmarshal(data, &response) - return response, err -} - -// UpdateDataDisk updates the configuration of the specified data disk that is -// attached to the specified Virtual Machine -// -// https://msdn.microsoft.com/en-us/library/azure/jj157190.aspx -func (c DiskClient) UpdateDataDisk( - service string, - deployment string, - role string, - lun int, - params UpdateDataDiskParameters) (management.OperationID, error) { - if service == "" { - return "", fmt.Errorf(errParamNotSpecified, "service") - } - if deployment == "" { - return "", fmt.Errorf(errParamNotSpecified, "deployment") - } - if role == "" { - return "", fmt.Errorf(errParamNotSpecified, "role") - } - - requestURL := fmt.Sprintf(updateDataDiskURL, service, deployment, role, lun) - - req, err := xml.Marshal(params) - if err != nil { - return "", err - } - - return c.client.SendAzurePutRequest(requestURL, "", req) -} - -// UpdateDisk updates the label of an existing disk in the image repository that is -// associated with the specified subscription -// -// https://msdn.microsoft.com/en-us/library/azure/jj157205.aspx -func (c DiskClient) UpdateDisk( - name string, - params UpdateDiskParameters) (management.OperationID, error) { - if name == "" { - return "", fmt.Errorf(errParamNotSpecified, "name") - } - - requestURL := fmt.Sprintf(updateDiskURL, name) - - req, err := xml.Marshal(params) - if err != nil { - return "", err - } - - return c.client.SendAzurePutRequest(requestURL, "", req) -} +// Package virtualmachinedisk provides a client for Virtual Machine Disks. +package virtualmachinedisk + +import ( + "encoding/xml" + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + addDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks" + addDiskURL = "services/disks" + deleteDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks/%d" + deleteDiskURL = "services/disks/%s" + getDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks/%d" + getDiskURL = "services/disks/%s" + listDisksURL = "services/disks" + updateDataDiskURL = "services/hostedservices/%s/deployments/%s/roles/%s/DataDisks/%d" + updateDiskURL = "services/disks/%s" + + errParamNotSpecified = "Parameter %s is not specified." +) + +//NewClient is used to instantiate a new DiskClient from an Azure client +func NewClient(client management.Client) DiskClient { + return DiskClient{client: client} +} + +// AddDataDisk adds a data disk to a Virtual Machine +// +// https://msdn.microsoft.com/en-us/library/azure/jj157199.aspx +func (c DiskClient) AddDataDisk( + service string, + deployment string, + role string, + params CreateDataDiskParameters) (management.OperationID, error) { + if service == "" { + return "", fmt.Errorf(errParamNotSpecified, "service") + } + if deployment == "" { + return "", fmt.Errorf(errParamNotSpecified, "deployment") + } + if role == "" { + return "", fmt.Errorf(errParamNotSpecified, "role") + } + + requestURL := fmt.Sprintf(addDataDiskURL, service, deployment, role) + + req, err := xml.Marshal(params) + if err != nil { + return "", err + } + + return c.client.SendAzurePostRequest(requestURL, req) +} + +// AddDisk adds an operating system disk or data disk to the user image repository +// +// https://msdn.microsoft.com/en-us/library/azure/jj157178.aspx +func (c DiskClient) AddDisk(params CreateDiskParameters) (management.OperationID, error) { + req, err := xml.Marshal(params) + if err != nil { + return "", err + } + + return c.client.SendAzurePostRequest(addDiskURL, req) +} + +// DeleteDataDisk removes the specified data disk from a Virtual Machine +// +// https://msdn.microsoft.com/en-us/library/azure/jj157179.aspx +func (c DiskClient) DeleteDataDisk( + service string, + deployment string, + role string, + lun int, + deleteVHD bool) (management.OperationID, error) { + if service == "" { + return "", fmt.Errorf(errParamNotSpecified, "service") + } + if deployment == "" { + return "", fmt.Errorf(errParamNotSpecified, "deployment") + } + if role == "" { + return "", fmt.Errorf(errParamNotSpecified, "role") + } + + requestURL := fmt.Sprintf(deleteDataDiskURL, service, deployment, role, lun) + if deleteVHD { + requestURL += "?comp=media" + } + + return c.client.SendAzureDeleteRequest(requestURL) +} + +// DeleteDisk deletes the specified data or operating system disk from the image +// repository that is associated with the specified subscription +// +// https://msdn.microsoft.com/en-us/library/azure/jj157200.aspx +func (c DiskClient) DeleteDisk(name string, deleteVHD bool) error { + if name == "" { + return fmt.Errorf(errParamNotSpecified, "name") + } + + requestURL := fmt.Sprintf(deleteDiskURL, name) + if deleteVHD { + requestURL += "?comp=media" + } + + _, err := c.client.SendAzureDeleteRequest(requestURL) // request is handled synchronously + return err +} + +// GetDataDisk retrieves the specified data disk from a Virtual Machine +// +// https://msdn.microsoft.com/en-us/library/azure/jj157180.aspx +func (c DiskClient) GetDataDisk( + service string, + deployment string, + role string, + lun int) (DataDiskResponse, error) { + var response DataDiskResponse + if service == "" { + return response, fmt.Errorf(errParamNotSpecified, "service") + } + if deployment == "" { + return response, fmt.Errorf(errParamNotSpecified, "deployment") + } + if role == "" { + return response, fmt.Errorf(errParamNotSpecified, "role") + } + + requestURL := fmt.Sprintf(getDataDiskURL, service, deployment, role, lun) + + data, err := c.client.SendAzureGetRequest(requestURL) + if err != nil { + return response, err + } + + err = xml.Unmarshal(data, &response) + return response, err +} + +// GetDisk retrieves information about the specified disk +// +// https://msdn.microsoft.com/en-us/library/azure/dn775053.aspx +func (c DiskClient) GetDisk(name string) (DiskResponse, error) { + var response DiskResponse + if name == "" { + return response, fmt.Errorf(errParamNotSpecified, "name") + } + + requestURL := fmt.Sprintf(getDiskURL, name) + + data, err := c.client.SendAzureGetRequest(requestURL) + if err != nil { + return response, err + } + + err = xml.Unmarshal(data, &response) + return response, err +} + +// ListDisks retrieves a list of the disks in the image repository that is associated +// with the specified subscription +// +// https://msdn.microsoft.com/en-us/library/azure/jj157176.aspx +func (c DiskClient) ListDisks() (ListDiskResponse, error) { + var response ListDiskResponse + + data, err := c.client.SendAzureGetRequest(listDisksURL) + if err != nil { + return response, err + } + + err = xml.Unmarshal(data, &response) + return response, err +} + +// UpdateDataDisk updates the configuration of the specified data disk that is +// attached to the specified Virtual Machine +// +// https://msdn.microsoft.com/en-us/library/azure/jj157190.aspx +func (c DiskClient) UpdateDataDisk( + service string, + deployment string, + role string, + lun int, + params UpdateDataDiskParameters) (management.OperationID, error) { + if service == "" { + return "", fmt.Errorf(errParamNotSpecified, "service") + } + if deployment == "" { + return "", fmt.Errorf(errParamNotSpecified, "deployment") + } + if role == "" { + return "", fmt.Errorf(errParamNotSpecified, "role") + } + + requestURL := fmt.Sprintf(updateDataDiskURL, service, deployment, role, lun) + + req, err := xml.Marshal(params) + if err != nil { + return "", err + } + + return c.client.SendAzurePutRequest(requestURL, "", req) +} + +// UpdateDisk updates the label of an existing disk in the image repository that is +// associated with the specified subscription +// +// https://msdn.microsoft.com/en-us/library/azure/jj157205.aspx +func (c DiskClient) UpdateDisk( + name string, + params UpdateDiskParameters) (management.OperationID, error) { + if name == "" { + return "", fmt.Errorf(errParamNotSpecified, "name") + } + + requestURL := fmt.Sprintf(updateDiskURL, name) + + req, err := xml.Marshal(params) + if err != nil { + return "", err + } + + return c.client.SendAzurePutRequest(requestURL, "", req) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/entities.go index e3db7aa7a7..1359381b89 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk/entities.go @@ -1,134 +1,134 @@ -package virtualmachinedisk - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -// DiskClient is used to perform operations on Azure Disks -type DiskClient struct { - client management.Client -} - -// CreateDiskParameters represents a disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type CreateDiskParameters struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disk"` - OS OperatingSystemType `xml:",omitempty"` - Label string - MediaLink string `xml:",omitempty"` - Name string -} - -// UpdateDiskParameters represents a disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type UpdateDiskParameters struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disk"` - Label string `xml:",omitempty"` - Name string - ResizedSizeInGB int `xml:",omitempty"` -} - -// ListDiskResponse represents a disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type ListDiskResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disks"` - Disk []DiskResponse -} - -// DiskResponse represents a disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type DiskResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disk"` - AffinityGroup string - AttachedTo Resource - IsCorrupted bool - OS OperatingSystemType - Location string - LogicalDiskSizeInGB int - MediaLink string - Name string - SourceImageName string - CreatedTime string - IOType IOType -} - -// Resource describes the resource details a disk is currently attached to -type Resource struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure AttachedTo"` - DeploymentName string - HostedServiceName string - RoleName string -} - -// IOType represents an IO type -type IOType string - -// These constants represent the possible IO types -const ( - IOTypeProvisioned IOType = "Provisioned" - IOTypeStandard IOType = "Standard" -) - -// OperatingSystemType represents an operating system type -type OperatingSystemType string - -// These constants represent the valid operating system types -const ( - OperatingSystemTypeNull OperatingSystemType = "NULL" - OperatingSystemTypeLinux OperatingSystemType = "Linux" - OperatingSystemTypeWindows OperatingSystemType = "Windows" -) - -// CreateDataDiskParameters represents a data disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type CreateDataDiskParameters struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure DataVirtualHardDisk"` - HostCaching HostCachingType `xml:",omitempty"` - DiskLabel string `xml:",omitempty"` - DiskName string `xml:",omitempty"` - Lun int `xml:",omitempty"` - LogicalDiskSizeInGB int `xml:",omitempty"` - MediaLink string - SourceMediaLink string `xml:",omitempty"` -} - -// UpdateDataDiskParameters represents a data disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type UpdateDataDiskParameters struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure DataVirtualHardDisk"` - HostCaching HostCachingType `xml:",omitempty"` - DiskName string - Lun int - MediaLink string -} - -// DataDiskResponse represents a data disk -// -// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx -type DataDiskResponse struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure DataVirtualHardDisk"` - HostCaching HostCachingType - DiskLabel string - DiskName string - Lun int - LogicalDiskSizeInGB int - MediaLink string -} - -// HostCachingType represents a host caching type -type HostCachingType string - -// These constants represent the valid host caching types -const ( - HostCachingTypeNone HostCachingType = "None" - HostCachingTypeReadOnly HostCachingType = "ReadOnly" - HostCachingTypeReadWrite HostCachingType = "ReadWrite" -) +package virtualmachinedisk + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +// DiskClient is used to perform operations on Azure Disks +type DiskClient struct { + client management.Client +} + +// CreateDiskParameters represents a disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type CreateDiskParameters struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disk"` + OS OperatingSystemType `xml:",omitempty"` + Label string + MediaLink string `xml:",omitempty"` + Name string +} + +// UpdateDiskParameters represents a disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type UpdateDiskParameters struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disk"` + Label string `xml:",omitempty"` + Name string + ResizedSizeInGB int `xml:",omitempty"` +} + +// ListDiskResponse represents a disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type ListDiskResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disks"` + Disk []DiskResponse +} + +// DiskResponse represents a disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type DiskResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Disk"` + AffinityGroup string + AttachedTo Resource + IsCorrupted bool + OS OperatingSystemType + Location string + LogicalDiskSizeInGB int + MediaLink string + Name string + SourceImageName string + CreatedTime string + IOType IOType +} + +// Resource describes the resource details a disk is currently attached to +type Resource struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure AttachedTo"` + DeploymentName string + HostedServiceName string + RoleName string +} + +// IOType represents an IO type +type IOType string + +// These constants represent the possible IO types +const ( + IOTypeProvisioned IOType = "Provisioned" + IOTypeStandard IOType = "Standard" +) + +// OperatingSystemType represents an operating system type +type OperatingSystemType string + +// These constants represent the valid operating system types +const ( + OperatingSystemTypeNull OperatingSystemType = "NULL" + OperatingSystemTypeLinux OperatingSystemType = "Linux" + OperatingSystemTypeWindows OperatingSystemType = "Windows" +) + +// CreateDataDiskParameters represents a data disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type CreateDataDiskParameters struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure DataVirtualHardDisk"` + HostCaching HostCachingType `xml:",omitempty"` + DiskLabel string `xml:",omitempty"` + DiskName string `xml:",omitempty"` + Lun int `xml:",omitempty"` + LogicalDiskSizeInGB int `xml:",omitempty"` + MediaLink string + SourceMediaLink string `xml:",omitempty"` +} + +// UpdateDataDiskParameters represents a data disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type UpdateDataDiskParameters struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure DataVirtualHardDisk"` + HostCaching HostCachingType `xml:",omitempty"` + DiskName string + Lun int + MediaLink string +} + +// DataDiskResponse represents a data disk +// +// https://msdn.microsoft.com/en-us/library/azure/jj157188.aspx +type DataDiskResponse struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure DataVirtualHardDisk"` + HostCaching HostCachingType + DiskLabel string + DiskName string + Lun int + LogicalDiskSizeInGB int + MediaLink string +} + +// HostCachingType represents a host caching type +type HostCachingType string + +// These constants represent the valid host caching types +const ( + HostCachingTypeNone HostCachingType = "None" + HostCachingTypeReadOnly HostCachingType = "ReadOnly" + HostCachingTypeReadWrite HostCachingType = "ReadWrite" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/client.go index 3c81a87e03..11c8848a7f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/client.go @@ -1,110 +1,110 @@ -// Package virtualmachineimage provides a client for Virtual Machine Images. -package virtualmachineimage - -import ( - "encoding/xml" - "fmt" - "net/url" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureImageListURL = "services/vmimages" - azureImageDeleteURLformat = "services/vmimages/%s" - azureRoleOperationsURL = "services/hostedservices/%s/deployments/%s/roleinstances/%s/operations" - errParamNotSpecified = "Parameter %s is not specified." -) - -//NewClient is used to instantiate a new Client from an Azure client -func NewClient(client management.Client) Client { - return Client{client} -} - -//ListVirtualMachineImages lists the available VM images, filtered by the optional parameters. -//See https://msdn.microsoft.com/en-us/library/azure/dn499770.aspx -func (c Client) ListVirtualMachineImages(parameters ListParameters) (ListVirtualMachineImagesResponse, error) { - var imageList ListVirtualMachineImagesResponse - - listURL := azureImageListURL - - v := url.Values{} - if parameters.Location != "" { - v.Add("location", parameters.Location) - } - - if parameters.Publisher != "" { - v.Add("publisher", parameters.Publisher) - } - - if parameters.Category != "" { - v.Add("category", parameters.Category) - } - - query := v.Encode() - if query != "" { - listURL = listURL + "?" + query - } - - response, err := c.SendAzureGetRequest(listURL) - if err != nil { - return imageList, err - } - err = xml.Unmarshal(response, &imageList) - return imageList, err -} - -//DeleteVirtualMachineImage deletes the named VM image. If deleteVHDs is specified, -//the referenced OS and data disks are also deleted. -//See https://msdn.microsoft.com/en-us/library/azure/dn499769.aspx -func (c Client) DeleteVirtualMachineImage(name string, deleteVHDs bool) error { - if name == "" { - return fmt.Errorf(errParamNotSpecified, "name") - } - - uri := fmt.Sprintf(azureImageDeleteURLformat, name) - - if deleteVHDs { - uri = uri + "?comp=media" - } - - _, err := c.SendAzureDeleteRequest(uri) // delete is synchronous for this operation - return err -} - -type ListParameters struct { - Location string - Publisher string - Category string -} - -const CategoryUser = "User" - -//Capture captures a VM into a VM image. The VM has to be shut down previously. -//See https://msdn.microsoft.com/en-us/library/azure/dn499768.aspx -func (c Client) Capture(cloudServiceName, deploymentName, roleName string, - name, label string, osState OSState, parameters CaptureParameters) (management.OperationID, error) { - if cloudServiceName == "" { - return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") - } - if deploymentName == "" { - return "", fmt.Errorf(errParamNotSpecified, "deploymentName") - } - if roleName == "" { - return "", fmt.Errorf(errParamNotSpecified, "roleName") - } - - request := CaptureRoleAsVMImageOperation{ - VMImageName: name, - VMImageLabel: label, - OSState: osState, - CaptureParameters: parameters, - } - data, err := xml.Marshal(request) - if err != nil { - return "", err - } - - return c.SendAzurePostRequest(fmt.Sprintf(azureRoleOperationsURL, - cloudServiceName, deploymentName, roleName), data) -} +// Package virtualmachineimage provides a client for Virtual Machine Images. +package virtualmachineimage + +import ( + "encoding/xml" + "fmt" + "net/url" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureImageListURL = "services/vmimages" + azureImageDeleteURLformat = "services/vmimages/%s" + azureRoleOperationsURL = "services/hostedservices/%s/deployments/%s/roleinstances/%s/operations" + errParamNotSpecified = "Parameter %s is not specified." +) + +//NewClient is used to instantiate a new Client from an Azure client +func NewClient(client management.Client) Client { + return Client{client} +} + +//ListVirtualMachineImages lists the available VM images, filtered by the optional parameters. +//See https://msdn.microsoft.com/en-us/library/azure/dn499770.aspx +func (c Client) ListVirtualMachineImages(parameters ListParameters) (ListVirtualMachineImagesResponse, error) { + var imageList ListVirtualMachineImagesResponse + + listURL := azureImageListURL + + v := url.Values{} + if parameters.Location != "" { + v.Add("location", parameters.Location) + } + + if parameters.Publisher != "" { + v.Add("publisher", parameters.Publisher) + } + + if parameters.Category != "" { + v.Add("category", parameters.Category) + } + + query := v.Encode() + if query != "" { + listURL = listURL + "?" + query + } + + response, err := c.SendAzureGetRequest(listURL) + if err != nil { + return imageList, err + } + err = xml.Unmarshal(response, &imageList) + return imageList, err +} + +//DeleteVirtualMachineImage deletes the named VM image. If deleteVHDs is specified, +//the referenced OS and data disks are also deleted. +//See https://msdn.microsoft.com/en-us/library/azure/dn499769.aspx +func (c Client) DeleteVirtualMachineImage(name string, deleteVHDs bool) error { + if name == "" { + return fmt.Errorf(errParamNotSpecified, "name") + } + + uri := fmt.Sprintf(azureImageDeleteURLformat, name) + + if deleteVHDs { + uri = uri + "?comp=media" + } + + _, err := c.SendAzureDeleteRequest(uri) // delete is synchronous for this operation + return err +} + +type ListParameters struct { + Location string + Publisher string + Category string +} + +const CategoryUser = "User" + +//Capture captures a VM into a VM image. The VM has to be shut down previously. +//See https://msdn.microsoft.com/en-us/library/azure/dn499768.aspx +func (c Client) Capture(cloudServiceName, deploymentName, roleName string, + name, label string, osState OSState, parameters CaptureParameters) (management.OperationID, error) { + if cloudServiceName == "" { + return "", fmt.Errorf(errParamNotSpecified, "cloudServiceName") + } + if deploymentName == "" { + return "", fmt.Errorf(errParamNotSpecified, "deploymentName") + } + if roleName == "" { + return "", fmt.Errorf(errParamNotSpecified, "roleName") + } + + request := CaptureRoleAsVMImageOperation{ + VMImageName: name, + VMImageLabel: label, + OSState: osState, + CaptureParameters: parameters, + } + data, err := xml.Marshal(request) + if err != nil { + return "", err + } + + return c.SendAzurePostRequest(fmt.Sprintf(azureRoleOperationsURL, + cloudServiceName, deploymentName, roleName), data) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities.go index 23de6082a5..4a1df3119b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities.go @@ -1,95 +1,95 @@ -package virtualmachineimage - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" - vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" -) - -// Client is used to perform operations on Azure VM Images. -type Client struct { - management.Client -} - -type ListVirtualMachineImagesResponse struct { - VMImages []VMImage `xml:"VMImage"` -} - -type VMImage struct { - Name string // Specifies the name of the image. - Label string // Specifies an identifier for the image. - Category string // Specifies the repository classification of the image. All user images have the category User. - Description string // Specifies the description of the image. - OSDiskConfiguration OSDiskConfiguration // Specifies configuration information for the operating system disk that is associated with the image. - DataDiskConfigurations []DataDiskConfiguration `xml:">DataDiskConfiguration"` // Specifies configuration information for the data disks that are associated with the image. A VM Image might not have data disks associated with it. - ServiceName string // Specifies the name of the cloud service that contained the Virtual Machine from which the image was created. - DeploymentName string // Specifies the name of the deployment that contained the Virtual Machine from which the image was created. - RoleName string // Specifies the name of the Virtual Machine from which the image was created. - Location string // Specifies the geo-location in which the media is located. The Location value is derived from the storage account that contains the blob in which the media is located. If the storage account belongs to an affinity group the value is NULL and the element is not displayed in the response. - AffinityGroup string // Specifies the affinity group in which the media is located. The AffinityGroup value is derived from the storage account that contains the blob in which the media is located. If the storage account does not belong to an affinity group the value is NULL and the element is not displayed in the response. - CreatedTime string // Specifies the time that the image was created. - ModifiedTime string // Specifies the time that the image was last updated. - Language string // Specifies the language of the image. - ImageFamily string // Specifies a value that can be used to group VM Images. - RecommendedVMSize string // Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image. - IsPremium string // Indicates whether the image contains software or associated services that will incur charges above the core price for the virtual machine. For additional details, see the PricingDetailLink element. - Eula string // Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA. - IconURI string `xml:"IconUri"` // Specifies the URI to the icon that is displayed for the image in the Management Portal. - SmallIconURI string `xml:"SmallIconUri"` // Specifies the URI to the small icon that is displayed for the image in the Management Portal. - PrivacyURI string `xml:"PrivacyUri"` // Specifies the URI that points to a document that contains the privacy policy related to the image. - PublishedDate string // Specifies the date when the image was added to the image repository. -} - -type OSState string - -const ( - OSStateGeneralized OSState = "Generalized" - OSStateSpecialized OSState = "Specialized" -) - -type IOType string - -const ( - IOTypeProvisioned IOType = "Provisioned" - IOTypeStandard IOType = "Standard" -) - -// OSDiskConfiguration specifies configuration information for the operating -// system disk that is associated with the image. -type OSDiskConfiguration struct { - Name string // Specifies the name of the operating system disk. - HostCaching vmdisk.HostCachingType // Specifies the caching behavior of the operating system disk. - OSState OSState // Specifies the state of the operating system in the image. - OS string // Specifies the operating system type of the image. - MediaLink string // Specifies the location of the blob in Azure storage. The blob location belongs to a storage account in the subscription specified by the value in the operation call. - LogicalSizeInGB float64 // Specifies the size, in GB, of the operating system disk. - IOType IOType // Identifies the type of the storage account for the backing VHD. If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned. -} - -// DataDiskConfiguration specifies configuration information for the data disks -// that are associated with the image. -type DataDiskConfiguration struct { - Name string // Specifies the name of the data disk. - HostCaching vmdisk.HostCachingType // Specifies the caching behavior of the data disk. - Lun string // Specifies the Logical Unit Number (LUN) for the data disk. - MediaLink string // Specifies the location of the blob in Azure storage. The blob location belongs to a storage account in the subscription specified by the value in the operation call. - LogicalSizeInGB float64 // Specifies the size, in GB, of the data disk. - IOType IOType // Identifies the type of the storage account for the backing VHD. If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned. -} - -type CaptureRoleAsVMImageOperation struct { - XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CaptureRoleAsVMImageOperation"` - OperationType string //CaptureRoleAsVMImageOperation - OSState OSState - VMImageName string - VMImageLabel string - CaptureParameters -} - -type CaptureParameters struct { - Description string `xml:",omitempty"` - Language string `xml:",omitempty"` - ImageFamily string `xml:",omitempty"` - RecommendedVMSize string `xml:",omitempty"` -} +package virtualmachineimage + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" + vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" +) + +// Client is used to perform operations on Azure VM Images. +type Client struct { + management.Client +} + +type ListVirtualMachineImagesResponse struct { + VMImages []VMImage `xml:"VMImage"` +} + +type VMImage struct { + Name string // Specifies the name of the image. + Label string // Specifies an identifier for the image. + Category string // Specifies the repository classification of the image. All user images have the category User. + Description string // Specifies the description of the image. + OSDiskConfiguration OSDiskConfiguration // Specifies configuration information for the operating system disk that is associated with the image. + DataDiskConfigurations []DataDiskConfiguration `xml:">DataDiskConfiguration"` // Specifies configuration information for the data disks that are associated with the image. A VM Image might not have data disks associated with it. + ServiceName string // Specifies the name of the cloud service that contained the Virtual Machine from which the image was created. + DeploymentName string // Specifies the name of the deployment that contained the Virtual Machine from which the image was created. + RoleName string // Specifies the name of the Virtual Machine from which the image was created. + Location string // Specifies the geo-location in which the media is located. The Location value is derived from the storage account that contains the blob in which the media is located. If the storage account belongs to an affinity group the value is NULL and the element is not displayed in the response. + AffinityGroup string // Specifies the affinity group in which the media is located. The AffinityGroup value is derived from the storage account that contains the blob in which the media is located. If the storage account does not belong to an affinity group the value is NULL and the element is not displayed in the response. + CreatedTime string // Specifies the time that the image was created. + ModifiedTime string // Specifies the time that the image was last updated. + Language string // Specifies the language of the image. + ImageFamily string // Specifies a value that can be used to group VM Images. + RecommendedVMSize string // Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image. + IsPremium string // Indicates whether the image contains software or associated services that will incur charges above the core price for the virtual machine. For additional details, see the PricingDetailLink element. + Eula string // Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA. + IconURI string `xml:"IconUri"` // Specifies the URI to the icon that is displayed for the image in the Management Portal. + SmallIconURI string `xml:"SmallIconUri"` // Specifies the URI to the small icon that is displayed for the image in the Management Portal. + PrivacyURI string `xml:"PrivacyUri"` // Specifies the URI that points to a document that contains the privacy policy related to the image. + PublishedDate string // Specifies the date when the image was added to the image repository. +} + +type OSState string + +const ( + OSStateGeneralized OSState = "Generalized" + OSStateSpecialized OSState = "Specialized" +) + +type IOType string + +const ( + IOTypeProvisioned IOType = "Provisioned" + IOTypeStandard IOType = "Standard" +) + +// OSDiskConfiguration specifies configuration information for the operating +// system disk that is associated with the image. +type OSDiskConfiguration struct { + Name string // Specifies the name of the operating system disk. + HostCaching vmdisk.HostCachingType // Specifies the caching behavior of the operating system disk. + OSState OSState // Specifies the state of the operating system in the image. + OS string // Specifies the operating system type of the image. + MediaLink string // Specifies the location of the blob in Azure storage. The blob location belongs to a storage account in the subscription specified by the value in the operation call. + LogicalSizeInGB float64 // Specifies the size, in GB, of the operating system disk. + IOType IOType // Identifies the type of the storage account for the backing VHD. If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned. +} + +// DataDiskConfiguration specifies configuration information for the data disks +// that are associated with the image. +type DataDiskConfiguration struct { + Name string // Specifies the name of the data disk. + HostCaching vmdisk.HostCachingType // Specifies the caching behavior of the data disk. + Lun string // Specifies the Logical Unit Number (LUN) for the data disk. + MediaLink string // Specifies the location of the blob in Azure storage. The blob location belongs to a storage account in the subscription specified by the value in the operation call. + LogicalSizeInGB float64 // Specifies the size, in GB, of the data disk. + IOType IOType // Identifies the type of the storage account for the backing VHD. If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned. +} + +type CaptureRoleAsVMImageOperation struct { + XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CaptureRoleAsVMImageOperation"` + OperationType string //CaptureRoleAsVMImageOperation + OSState OSState + VMImageName string + VMImageLabel string + CaptureParameters +} + +type CaptureParameters struct { + Description string `xml:",omitempty"` + Language string `xml:",omitempty"` + ImageFamily string `xml:",omitempty"` + RecommendedVMSize string `xml:",omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go index 1653226a04..b0d5bbe6f2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualmachineimage/entities_test.go @@ -1,110 +1,110 @@ -package virtualmachineimage - -import ( - "encoding/xml" - "testing" -) - -const xml1 = ` - - imgName - - User - packer made image - - OSDisk - ReadWrite - Generalized - Linux - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12.vhd - 30 - Standard - - - PkrSrvf3mz03u4mi - PkrVMf3mz03u4mi - PkrVMf3mz03u4mi - Central US - 2015-12-12T08:59:29.1936858Z - 2015-12-12T08:59:29.1936858Z - PackerMade - Small - false - VMImageReadyForUse - StoppedVM - Small -` -const xml2 = ` - - imgName - - User - packer made image - - OSDisk - ReadWrite - Generalized - Linux - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12.vhd - 30 - Standard - - - - DataDisk1 - ReadWrite - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12-dd1.vhd - 31 - Standard - - - DataDisk2 - ReadWrite - https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12-dd2.vhd - 32 - Standard - - - PkrSrvf3mz03u4mi - PkrVMf3mz03u4mi - PkrVMf3mz03u4mi - Central US - 2015-12-12T08:59:29.1936858Z - 2015-12-12T08:59:29.1936858Z - PackerMade - Small - false - VMImageReadyForUse - StoppedVM - Small -` - -func Test_NoDataDisksUnmarshal(t *testing.T) { - var image VMImage - if err := xml.Unmarshal([]byte(xml1), &image); err != nil { - t.Fatal(err) - } - - check := checker{t} - check.Equal(0, len(image.DataDiskConfigurations)) -} - -func Test_DataDiskCountUnmarshal(t *testing.T) { - var image VMImage - if err := xml.Unmarshal([]byte(xml2), &image); err != nil { - t.Fatal(err) - } - - check := checker{t} - check.Equal(2, len(image.DataDiskConfigurations)) - check.Equal("DataDisk1", image.DataDiskConfigurations[0].Name) - check.Equal("DataDisk2", image.DataDiskConfigurations[1].Name) -} - -type checker struct{ *testing.T } - -func (a *checker) Equal(expected, actual interface{}) { - if expected != actual { - a.T.Fatalf("Expected %q, but got %q", expected, actual) - } -} +package virtualmachineimage + +import ( + "encoding/xml" + "testing" +) + +const xml1 = ` + + imgName + + User + packer made image + + OSDisk + ReadWrite + Generalized + Linux + https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12.vhd + 30 + Standard + + + PkrSrvf3mz03u4mi + PkrVMf3mz03u4mi + PkrVMf3mz03u4mi + Central US + 2015-12-12T08:59:29.1936858Z + 2015-12-12T08:59:29.1936858Z + PackerMade + Small + false + VMImageReadyForUse + StoppedVM + Small +` +const xml2 = ` + + imgName + + User + packer made image + + OSDisk + ReadWrite + Generalized + Linux + https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12.vhd + 30 + Standard + + + + DataDisk1 + ReadWrite + https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12-dd1.vhd + 31 + Standard + + + DataDisk2 + ReadWrite + https://sa.blob.core.windows.net/images/PackerMade_Ubuntu_Serv14_2015-12-12-dd2.vhd + 32 + Standard + + + PkrSrvf3mz03u4mi + PkrVMf3mz03u4mi + PkrVMf3mz03u4mi + Central US + 2015-12-12T08:59:29.1936858Z + 2015-12-12T08:59:29.1936858Z + PackerMade + Small + false + VMImageReadyForUse + StoppedVM + Small +` + +func Test_NoDataDisksUnmarshal(t *testing.T) { + var image VMImage + if err := xml.Unmarshal([]byte(xml1), &image); err != nil { + t.Fatal(err) + } + + check := checker{t} + check.Equal(0, len(image.DataDiskConfigurations)) +} + +func Test_DataDiskCountUnmarshal(t *testing.T) { + var image VMImage + if err := xml.Unmarshal([]byte(xml2), &image); err != nil { + t.Fatal(err) + } + + check := checker{t} + check.Equal(2, len(image.DataDiskConfigurations)) + check.Equal("DataDisk1", image.DataDiskConfigurations[0].Name) + check.Equal("DataDisk2", image.DataDiskConfigurations[1].Name) +} + +type checker struct{ *testing.T } + +func (a *checker) Equal(expected, actual interface{}) { + if expected != actual { + a.T.Fatalf("Expected %q, but got %q", expected, actual) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/client.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/client.go index eb88c91103..9d27ab7fd1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/client.go @@ -1,47 +1,47 @@ -// Package virtualnetwork provides a client for Virtual Networks. -package virtualnetwork - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const ( - azureNetworkConfigurationURL = "services/networking/media" -) - -// NewClient is used to return new VirtualNetworkClient instance -func NewClient(client management.Client) VirtualNetworkClient { - return VirtualNetworkClient{client: client} -} - -// GetVirtualNetworkConfiguration retreives the current virtual network -// configuration for the currently active subscription. Note that the -// underlying Azure API means that network related operations are not safe -// for running concurrently. -func (c VirtualNetworkClient) GetVirtualNetworkConfiguration() (NetworkConfiguration, error) { - networkConfiguration := c.NewNetworkConfiguration() - response, err := c.client.SendAzureGetRequest(azureNetworkConfigurationURL) - if err != nil { - return networkConfiguration, err - } - - err = xml.Unmarshal(response, &networkConfiguration) - return networkConfiguration, err - -} - -// SetVirtualNetworkConfiguration configures the virtual networks for the -// currently active subscription according to the NetworkConfiguration given. -// Note that the underlying Azure API means that network related operations -// are not safe for running concurrently. -func (c VirtualNetworkClient) SetVirtualNetworkConfiguration(networkConfiguration NetworkConfiguration) (management.OperationID, error) { - networkConfiguration.setXMLNamespaces() - networkConfigurationBytes, err := xml.Marshal(networkConfiguration) - if err != nil { - return "", err - } - - return c.client.SendAzurePutRequest(azureNetworkConfigurationURL, "text/plain", networkConfigurationBytes) -} +// Package virtualnetwork provides a client for Virtual Networks. +package virtualnetwork + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const ( + azureNetworkConfigurationURL = "services/networking/media" +) + +// NewClient is used to return new VirtualNetworkClient instance +func NewClient(client management.Client) VirtualNetworkClient { + return VirtualNetworkClient{client: client} +} + +// GetVirtualNetworkConfiguration retreives the current virtual network +// configuration for the currently active subscription. Note that the +// underlying Azure API means that network related operations are not safe +// for running concurrently. +func (c VirtualNetworkClient) GetVirtualNetworkConfiguration() (NetworkConfiguration, error) { + networkConfiguration := c.NewNetworkConfiguration() + response, err := c.client.SendAzureGetRequest(azureNetworkConfigurationURL) + if err != nil { + return networkConfiguration, err + } + + err = xml.Unmarshal(response, &networkConfiguration) + return networkConfiguration, err + +} + +// SetVirtualNetworkConfiguration configures the virtual networks for the +// currently active subscription according to the NetworkConfiguration given. +// Note that the underlying Azure API means that network related operations +// are not safe for running concurrently. +func (c VirtualNetworkClient) SetVirtualNetworkConfiguration(networkConfiguration NetworkConfiguration) (management.OperationID, error) { + networkConfiguration.setXMLNamespaces() + networkConfigurationBytes, err := xml.Marshal(networkConfiguration) + if err != nil { + return "", err + } + + return c.client.SendAzurePutRequest(azureNetworkConfigurationURL, "text/plain", networkConfigurationBytes) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/entities.go b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/entities.go index ab3b77f54b..0cb8913e7b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/entities.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/virtualnetwork/entities.go @@ -1,90 +1,90 @@ -package virtualnetwork - -import ( - "encoding/xml" - - "github.com/Azure/azure-sdk-for-go/management" -) - -const xmlNamespace = "http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration" -const xmlNamespaceXsd = "http://www.w3.org/2001/XMLSchema" -const xmlNamespaceXsi = "http://www.w3.org/2001/XMLSchema-instance" - -// VirtualNetworkClient is used to perform operations on Virtual Networks. -type VirtualNetworkClient struct { - client management.Client -} - -// NetworkConfiguration represents the network configuration for an entire Azure -// subscription. -type NetworkConfiguration struct { - XMLName xml.Name `xml:"NetworkConfiguration"` - XMLNamespaceXsd string `xml:"xmlns:xsd,attr"` - XMLNamespaceXsi string `xml:"xmlns:xsi,attr"` - XMLNs string `xml:"xmlns,attr"` - Configuration VirtualNetworkConfiguration `xml:"VirtualNetworkConfiguration"` - - // TODO: Nicer builder methods for these that abstract away the - // underlying structure. -} - -// NewNetworkConfiguration creates a new empty NetworkConfiguration structure -// for further configuration. The XML namespaces are already set correctly. -func (client *VirtualNetworkClient) NewNetworkConfiguration() NetworkConfiguration { - networkConfiguration := NetworkConfiguration{} - networkConfiguration.setXMLNamespaces() - return networkConfiguration -} - -// setXMLNamespaces ensure that all of the required namespaces are set. It -// should be called prior to marshalling the structure to XML for use with the -// Azure REST endpoint. It is used internally prior to submitting requests, but -// since it is idempotent there is no harm in repeat calls. -func (n *NetworkConfiguration) setXMLNamespaces() { - n.XMLNamespaceXsd = xmlNamespaceXsd - n.XMLNamespaceXsi = xmlNamespaceXsi - n.XMLNs = xmlNamespace -} - -type VirtualNetworkConfiguration struct { - DNS DNS `xml:"Dns,omitempty"` - LocalNetworkSites []LocalNetworkSite `xml:"LocalNetworkSites>LocalNetworkSite"` - VirtualNetworkSites []VirtualNetworkSite `xml:"VirtualNetworkSites>VirtualNetworkSite"` -} - -type DNS struct { - DNSServers []DNSServer `xml:"DnsServers>DnsServer,omitempty"` -} - -type DNSServer struct { - XMLName xml.Name `xml:"DnsServer"` - Name string `xml:"name,attr"` - IPAddress string `xml:"IPAddress,attr"` -} - -type DNSServerRef struct { - Name string `xml:"name,attr"` -} - -type VirtualNetworkSite struct { - Name string `xml:"name,attr"` - Location string `xml:"Location,attr"` - AddressSpace AddressSpace `xml:"AddressSpace"` - Subnets []Subnet `xml:"Subnets>Subnet"` - DNSServersRef []DNSServerRef `xml:"DnsServersRef>DnsServerRef,omitempty"` -} - -type LocalNetworkSite struct { - Name string `xml:"name,attr"` - VPNGatewayAddress string - AddressSpace AddressSpace -} - -type AddressSpace struct { - AddressPrefix []string -} - -type Subnet struct { - Name string `xml:"name,attr"` - AddressPrefix string -} +package virtualnetwork + +import ( + "encoding/xml" + + "github.com/Azure/azure-sdk-for-go/management" +) + +const xmlNamespace = "http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration" +const xmlNamespaceXsd = "http://www.w3.org/2001/XMLSchema" +const xmlNamespaceXsi = "http://www.w3.org/2001/XMLSchema-instance" + +// VirtualNetworkClient is used to perform operations on Virtual Networks. +type VirtualNetworkClient struct { + client management.Client +} + +// NetworkConfiguration represents the network configuration for an entire Azure +// subscription. +type NetworkConfiguration struct { + XMLName xml.Name `xml:"NetworkConfiguration"` + XMLNamespaceXsd string `xml:"xmlns:xsd,attr"` + XMLNamespaceXsi string `xml:"xmlns:xsi,attr"` + XMLNs string `xml:"xmlns,attr"` + Configuration VirtualNetworkConfiguration `xml:"VirtualNetworkConfiguration"` + + // TODO: Nicer builder methods for these that abstract away the + // underlying structure. +} + +// NewNetworkConfiguration creates a new empty NetworkConfiguration structure +// for further configuration. The XML namespaces are already set correctly. +func (client *VirtualNetworkClient) NewNetworkConfiguration() NetworkConfiguration { + networkConfiguration := NetworkConfiguration{} + networkConfiguration.setXMLNamespaces() + return networkConfiguration +} + +// setXMLNamespaces ensure that all of the required namespaces are set. It +// should be called prior to marshalling the structure to XML for use with the +// Azure REST endpoint. It is used internally prior to submitting requests, but +// since it is idempotent there is no harm in repeat calls. +func (n *NetworkConfiguration) setXMLNamespaces() { + n.XMLNamespaceXsd = xmlNamespaceXsd + n.XMLNamespaceXsi = xmlNamespaceXsi + n.XMLNs = xmlNamespace +} + +type VirtualNetworkConfiguration struct { + DNS DNS `xml:"Dns,omitempty"` + LocalNetworkSites []LocalNetworkSite `xml:"LocalNetworkSites>LocalNetworkSite"` + VirtualNetworkSites []VirtualNetworkSite `xml:"VirtualNetworkSites>VirtualNetworkSite"` +} + +type DNS struct { + DNSServers []DNSServer `xml:"DnsServers>DnsServer,omitempty"` +} + +type DNSServer struct { + XMLName xml.Name `xml:"DnsServer"` + Name string `xml:"name,attr"` + IPAddress string `xml:"IPAddress,attr"` +} + +type DNSServerRef struct { + Name string `xml:"name,attr"` +} + +type VirtualNetworkSite struct { + Name string `xml:"name,attr"` + Location string `xml:"Location,attr"` + AddressSpace AddressSpace `xml:"AddressSpace"` + Subnets []Subnet `xml:"Subnets>Subnet"` + DNSServersRef []DNSServerRef `xml:"DnsServersRef>DnsServerRef,omitempty"` +} + +type LocalNetworkSite struct { + Name string `xml:"name,attr"` + VPNGatewayAddress string + AddressSpace AddressSpace +} + +type AddressSpace struct { + AddressPrefix []string +} + +type Subnet struct { + Name string `xml:"name,attr"` + AddressPrefix string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/configurationset.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/configurationset.go index 86092ee33d..0ed3bd0180 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/configurationset.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/configurationset.go @@ -1,28 +1,28 @@ -package vmutils - -import ( - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -func updateOrAddConfig(configs []vm.ConfigurationSet, configType vm.ConfigurationSetType, update func(*vm.ConfigurationSet)) []vm.ConfigurationSet { - config := findConfig(configs, configType) - if config == nil { - configs = append(configs, vm.ConfigurationSet{ConfigurationSetType: configType}) - config = findConfig(configs, configType) - } - update(config) - - return configs -} - -func findConfig(configs []vm.ConfigurationSet, configType vm.ConfigurationSetType) *vm.ConfigurationSet { - for i, config := range configs { - if config.ConfigurationSetType == configType { - // need to return a pointer to the original set in configs, - // not the copy made by the range iterator - return &configs[i] - } - } - - return nil -} +package vmutils + +import ( + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +func updateOrAddConfig(configs []vm.ConfigurationSet, configType vm.ConfigurationSetType, update func(*vm.ConfigurationSet)) []vm.ConfigurationSet { + config := findConfig(configs, configType) + if config == nil { + configs = append(configs, vm.ConfigurationSet{ConfigurationSetType: configType}) + config = findConfig(configs, configType) + } + update(config) + + return configs +} + +func findConfig(configs []vm.ConfigurationSet, configType vm.ConfigurationSetType) *vm.ConfigurationSet { + for i, config := range configs { + if config.ConfigurationSetType == configType { + // need to return a pointer to the original set in configs, + // not the copy made by the range iterator + return &configs[i] + } + } + + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/datadisks.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/datadisks.go index 3640a784af..06fcf852db 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/datadisks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/datadisks.go @@ -1,58 +1,58 @@ -package vmutils - -import ( - "fmt" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" - vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" -) - -// ConfigureWithNewDataDisk adds configuration for a new (empty) data disk -func ConfigureWithNewDataDisk(role *vm.Role, label, destinationVhdStorageURL string, sizeInGB int, cachingType vmdisk.HostCachingType) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - appendDataDisk(role, vm.DataVirtualHardDisk{ - DiskLabel: label, - HostCaching: cachingType, - LogicalDiskSizeInGB: sizeInGB, - MediaLink: destinationVhdStorageURL, - }) - - return nil -} - -// ConfigureWithExistingDataDisk adds configuration for an existing data disk -func ConfigureWithExistingDataDisk(role *vm.Role, diskName string, cachingType vmdisk.HostCachingType) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - appendDataDisk(role, vm.DataVirtualHardDisk{ - DiskName: diskName, - HostCaching: cachingType, - }) - - return nil -} - -// ConfigureWithVhdDataDisk adds configuration for adding a vhd in a storage -// account as a data disk -func ConfigureWithVhdDataDisk(role *vm.Role, sourceVhdStorageURL string, cachingType vmdisk.HostCachingType) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - appendDataDisk(role, vm.DataVirtualHardDisk{ - SourceMediaLink: sourceVhdStorageURL, - HostCaching: cachingType, - }) - - return nil -} - -func appendDataDisk(role *vm.Role, disk vm.DataVirtualHardDisk) { - disk.Lun = len(role.DataVirtualHardDisks) - role.DataVirtualHardDisks = append(role.DataVirtualHardDisks, disk) -} +package vmutils + +import ( + "fmt" + + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" + vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" +) + +// ConfigureWithNewDataDisk adds configuration for a new (empty) data disk +func ConfigureWithNewDataDisk(role *vm.Role, label, destinationVhdStorageURL string, sizeInGB int, cachingType vmdisk.HostCachingType) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + appendDataDisk(role, vm.DataVirtualHardDisk{ + DiskLabel: label, + HostCaching: cachingType, + LogicalDiskSizeInGB: sizeInGB, + MediaLink: destinationVhdStorageURL, + }) + + return nil +} + +// ConfigureWithExistingDataDisk adds configuration for an existing data disk +func ConfigureWithExistingDataDisk(role *vm.Role, diskName string, cachingType vmdisk.HostCachingType) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + appendDataDisk(role, vm.DataVirtualHardDisk{ + DiskName: diskName, + HostCaching: cachingType, + }) + + return nil +} + +// ConfigureWithVhdDataDisk adds configuration for adding a vhd in a storage +// account as a data disk +func ConfigureWithVhdDataDisk(role *vm.Role, sourceVhdStorageURL string, cachingType vmdisk.HostCachingType) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + appendDataDisk(role, vm.DataVirtualHardDisk{ + SourceMediaLink: sourceVhdStorageURL, + HostCaching: cachingType, + }) + + return nil +} + +func appendDataDisk(role *vm.Role, disk vm.DataVirtualHardDisk) { + disk.Lun = len(role.DataVirtualHardDisks) + role.DataVirtualHardDisks = append(role.DataVirtualHardDisks, disk) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/deployment.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/deployment.go index c090027be4..8ac5398de4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/deployment.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/deployment.go @@ -1,91 +1,91 @@ -package vmutils - -import ( - "fmt" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -// ConfigureDeploymentFromRemoteImage configures VM Role to deploy from a remote -// image source. "remoteImageSourceURL" can be any publically accessible URL to -// a VHD file, including but not limited to a SAS Azure Storage blob url. "os" -// needs to be either "Linux" or "Windows". "label" is optional. -func ConfigureDeploymentFromRemoteImage( - role *vm.Role, - remoteImageSourceURL string, - os string, - newDiskName string, - destinationVhdStorageURL string, - label string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{ - RemoteSourceImageLink: remoteImageSourceURL, - MediaLink: destinationVhdStorageURL, - DiskName: newDiskName, - OS: os, - DiskLabel: label, - } - return nil -} - -// ConfigureDeploymentFromPlatformImage configures VM Role to deploy from a -// platform image. See osimage package for methods to retrieve a list of the -// available platform images. "label" is optional. -func ConfigureDeploymentFromPlatformImage( - role *vm.Role, - imageName string, - mediaLink string, - label string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{ - SourceImageName: imageName, - MediaLink: mediaLink, - } - return nil -} - -// ConfigureDeploymentFromPublishedVMImage configures VM Role to deploy from -// a published (public) VM image. -func ConfigureDeploymentFromPublishedVMImage( - role *vm.Role, - vmImageName string, - mediaLocation string, - provisionGuestAgent bool) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.VMImageName = vmImageName - role.MediaLocation = mediaLocation - role.ProvisionGuestAgent = provisionGuestAgent - return nil -} - -// ConfigureDeploymentFromUserVMImage configures VM Role to deploy from a previously -// captured (user generated) VM image. -func ConfigureDeploymentFromUserVMImage( - role *vm.Role, - vmImageName string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.VMImageName = vmImageName - return nil -} - -// ConfigureDeploymentFromExistingOSDisk configures VM Role to deploy from an -// existing disk. 'label' is optional. -func ConfigureDeploymentFromExistingOSDisk(role *vm.Role, osDiskName, label string) error { - role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{ - DiskName: osDiskName, - DiskLabel: label, - } - return nil -} +package vmutils + +import ( + "fmt" + + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +// ConfigureDeploymentFromRemoteImage configures VM Role to deploy from a remote +// image source. "remoteImageSourceURL" can be any publically accessible URL to +// a VHD file, including but not limited to a SAS Azure Storage blob url. "os" +// needs to be either "Linux" or "Windows". "label" is optional. +func ConfigureDeploymentFromRemoteImage( + role *vm.Role, + remoteImageSourceURL string, + os string, + newDiskName string, + destinationVhdStorageURL string, + label string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{ + RemoteSourceImageLink: remoteImageSourceURL, + MediaLink: destinationVhdStorageURL, + DiskName: newDiskName, + OS: os, + DiskLabel: label, + } + return nil +} + +// ConfigureDeploymentFromPlatformImage configures VM Role to deploy from a +// platform image. See osimage package for methods to retrieve a list of the +// available platform images. "label" is optional. +func ConfigureDeploymentFromPlatformImage( + role *vm.Role, + imageName string, + mediaLink string, + label string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{ + SourceImageName: imageName, + MediaLink: mediaLink, + } + return nil +} + +// ConfigureDeploymentFromPublishedVMImage configures VM Role to deploy from +// a published (public) VM image. +func ConfigureDeploymentFromPublishedVMImage( + role *vm.Role, + vmImageName string, + mediaLocation string, + provisionGuestAgent bool) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.VMImageName = vmImageName + role.MediaLocation = mediaLocation + role.ProvisionGuestAgent = provisionGuestAgent + return nil +} + +// ConfigureDeploymentFromUserVMImage configures VM Role to deploy from a previously +// captured (user generated) VM image. +func ConfigureDeploymentFromUserVMImage( + role *vm.Role, + vmImageName string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.VMImageName = vmImageName + return nil +} + +// ConfigureDeploymentFromExistingOSDisk configures VM Role to deploy from an +// existing disk. 'label' is optional. +func ConfigureDeploymentFromExistingOSDisk(role *vm.Role, osDiskName, label string) error { + role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{ + DiskName: osDiskName, + DiskLabel: label, + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions.go index 8edca933f2..751fd6a6cd 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions.go @@ -1,90 +1,90 @@ -package vmutils - -import ( - "encoding/base64" - "encoding/json" - "fmt" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -const ( - dockerPublicConfigVersion = 2 -) - -func AddAzureVMExtensionConfiguration(role *vm.Role, name, publisher, version, referenceName, state string, - publicConfigurationValue, privateConfigurationValue []byte) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - extension := vm.ResourceExtensionReference{ - Name: name, - Publisher: publisher, - Version: version, - ReferenceName: referenceName, - State: state, - } - - if len(privateConfigurationValue) != 0 { - extension.ParameterValues = append(extension.ParameterValues, vm.ResourceExtensionParameter{ - Key: "ignored", - Value: base64.StdEncoding.EncodeToString(privateConfigurationValue), - Type: "Private", - }) - } - - if len(publicConfigurationValue) != 0 { - extension.ParameterValues = append(extension.ParameterValues, vm.ResourceExtensionParameter{ - Key: "ignored", - Value: base64.StdEncoding.EncodeToString(publicConfigurationValue), - Type: "Public", - }) - } - - if role.ResourceExtensionReferences == nil { - role.ResourceExtensionReferences = &[]vm.ResourceExtensionReference{} - } - extensionList := append(*role.ResourceExtensionReferences, extension) - role.ResourceExtensionReferences = &extensionList - return nil -} - -// AddAzureDockerVMExtensionConfiguration adds the DockerExtension to the role -// configuratioon and opens a port "dockerPort" -// TODO(ahmetalpbalkan) Deprecate this and move to 'docker-machine' codebase. -func AddAzureDockerVMExtensionConfiguration(role *vm.Role, dockerPort int, version string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - if err := ConfigureWithExternalPort(role, "docker", dockerPort, dockerPort, vm.InputEndpointProtocolTCP); err != nil { - return err - } - - publicConfiguration, err := createDockerPublicConfig(dockerPort) - if err != nil { - return err - } - - privateConfiguration, err := json.Marshal(dockerPrivateConfig{}) - if err != nil { - return err - } - - return AddAzureVMExtensionConfiguration(role, - "DockerExtension", "MSOpenTech.Extensions", - version, "DockerExtension", "enable", - publicConfiguration, privateConfiguration) -} - -func createDockerPublicConfig(dockerPort int) ([]byte, error) { - return json.Marshal(dockerPublicConfig{DockerPort: dockerPort, Version: dockerPublicConfigVersion}) -} - -type dockerPublicConfig struct { - DockerPort int `json:"dockerport"` - Version int `json:"version"` -} - -type dockerPrivateConfig struct{} +package vmutils + +import ( + "encoding/base64" + "encoding/json" + "fmt" + + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +const ( + dockerPublicConfigVersion = 2 +) + +func AddAzureVMExtensionConfiguration(role *vm.Role, name, publisher, version, referenceName, state string, + publicConfigurationValue, privateConfigurationValue []byte) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + extension := vm.ResourceExtensionReference{ + Name: name, + Publisher: publisher, + Version: version, + ReferenceName: referenceName, + State: state, + } + + if len(privateConfigurationValue) != 0 { + extension.ParameterValues = append(extension.ParameterValues, vm.ResourceExtensionParameter{ + Key: "ignored", + Value: base64.StdEncoding.EncodeToString(privateConfigurationValue), + Type: "Private", + }) + } + + if len(publicConfigurationValue) != 0 { + extension.ParameterValues = append(extension.ParameterValues, vm.ResourceExtensionParameter{ + Key: "ignored", + Value: base64.StdEncoding.EncodeToString(publicConfigurationValue), + Type: "Public", + }) + } + + if role.ResourceExtensionReferences == nil { + role.ResourceExtensionReferences = &[]vm.ResourceExtensionReference{} + } + extensionList := append(*role.ResourceExtensionReferences, extension) + role.ResourceExtensionReferences = &extensionList + return nil +} + +// AddAzureDockerVMExtensionConfiguration adds the DockerExtension to the role +// configuratioon and opens a port "dockerPort" +// TODO(ahmetalpbalkan) Deprecate this and move to 'docker-machine' codebase. +func AddAzureDockerVMExtensionConfiguration(role *vm.Role, dockerPort int, version string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + if err := ConfigureWithExternalPort(role, "docker", dockerPort, dockerPort, vm.InputEndpointProtocolTCP); err != nil { + return err + } + + publicConfiguration, err := createDockerPublicConfig(dockerPort) + if err != nil { + return err + } + + privateConfiguration, err := json.Marshal(dockerPrivateConfig{}) + if err != nil { + return err + } + + return AddAzureVMExtensionConfiguration(role, + "DockerExtension", "MSOpenTech.Extensions", + version, "DockerExtension", "enable", + publicConfiguration, privateConfiguration) +} + +func createDockerPublicConfig(dockerPort int) ([]byte, error) { + return json.Marshal(dockerPublicConfig{DockerPort: dockerPort, Version: dockerPublicConfigVersion}) +} + +type dockerPublicConfig struct { + DockerPort int `json:"dockerport"` + Version int `json:"version"` +} + +type dockerPrivateConfig struct{} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go index dbf7b6086e..17a46563db 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/extensions_test.go @@ -1,42 +1,42 @@ -package vmutils - -import ( - "encoding/xml" - "testing" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -func Test_AddAzureVMExtensionConfiguration(t *testing.T) { - - role := vm.Role{} - AddAzureVMExtensionConfiguration(&role, - "nameOfExtension", "nameOfPublisher", "versionOfExtension", "nameOfReference", "state", []byte{1, 2, 3}, []byte{}) - - data, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - if expected := ` - - - - nameOfReference - nameOfPublisher - nameOfExtension - versionOfExtension - - - ignored - AQID - Public - - - state - - - -`; string(data) != expected { - t.Fatalf("Expected %q, but got %q", expected, string(data)) - } -} +package vmutils + +import ( + "encoding/xml" + "testing" + + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +func Test_AddAzureVMExtensionConfiguration(t *testing.T) { + + role := vm.Role{} + AddAzureVMExtensionConfiguration(&role, + "nameOfExtension", "nameOfPublisher", "versionOfExtension", "nameOfReference", "state", []byte{1, 2, 3}, []byte{}) + + data, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + if expected := ` + + + + nameOfReference + nameOfPublisher + nameOfExtension + versionOfExtension + + + ignored + AQID + Public + + + state + + + +`; string(data) != expected { + t.Fatalf("Expected %q, but got %q", expected, string(data)) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go index ff678304c1..a0e79065a8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/integration_test.go @@ -1,458 +1,458 @@ -package vmutils - -import ( - "encoding/base64" - "fmt" - "math/rand" - "testing" - "time" - - "github.com/Azure/azure-sdk-for-go/management" - "github.com/Azure/azure-sdk-for-go/management/hostedservice" - "github.com/Azure/azure-sdk-for-go/management/location" - "github.com/Azure/azure-sdk-for-go/management/osimage" - storage "github.com/Azure/azure-sdk-for-go/management/storageservice" - "github.com/Azure/azure-sdk-for-go/management/testutils" - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" - vmimage "github.com/Azure/azure-sdk-for-go/management/virtualmachineimage" -) - -func TestDeployPlatformImage(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - testRoleConfiguration(t, client, role, location) -} - -func TestDeployPlatformWindowsImage(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetWindowsTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForWindows(&role, vmname, "azureuser", GeneratePassword(), true, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTPS(&role, "") - - testRoleConfiguration(t, client, role, location) -} - -func TestVMImageList(t *testing.T) { - client := testutils.GetTestClient(t) - vmic := vmimage.NewClient(client) - il, _ := vmic.ListVirtualMachineImages(vmimage.ListParameters{}) - for _, im := range il.VMImages { - t.Logf("%s -%s", im.Name, im.Description) - } -} - -func TestDeployPlatformOSImageCaptureRedeploy(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying VM: %s", vmname) - createRoleConfiguration(t, client, role, location) - - t.Logf("Wait for deployment to enter running state") - vmc := vm.NewClient(client) - status := vm.DeploymentStatusDeploying - for status != vm.DeploymentStatusRunning { - deployment, err := vmc.GetDeployment(vmname, vmname) - if err != nil { - t.Error(err) - break - } - status = deployment.Status - } - - t.Logf("Shutting down VM: %s", vmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.ShutdownRole(vmname, vmname, vmname, vm.PostShutdownActionStopped) - }); err != nil { - t.Error(err) - } - - if err := WaitForDeploymentPowerState(client, vmname, vmname, vm.PowerStateStopped); err != nil { - t.Fatal(err) - } - - imagename := GenerateName() - t.Logf("Capturing OSImage: %s", imagename) - if err := Await(client, func() (management.OperationID, error) { - return vmc.CaptureRole(vmname, vmname, vmname, imagename, imagename, nil) - }); err != nil { - t.Error(err) - } - - im := GetUserOSImage(t, client, imagename) - t.Logf("Found image: %+v", im) - - newvmname := GenerateName() - role = NewVMConfiguration(newvmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - im.Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, newvmname), - GenerateName()) - ConfigureForLinux(&role, newvmname, "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying new VM from freshly captured OS image: %s", newvmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) - }); err != nil { - t.Error(err) - } - - deleteHostedService(t, client, vmname) -} - -func TestDeployPlatformVMImageCaptureRedeploy(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying VM: %s", vmname) - createRoleConfiguration(t, client, role, location) - - t.Logf("Wait for deployment to enter running state") - vmc := vm.NewClient(client) - status := vm.DeploymentStatusDeploying - for status != vm.DeploymentStatusRunning { - deployment, err := vmc.GetDeployment(vmname, vmname) - if err != nil { - t.Error(err) - break - } - status = deployment.Status - } - - t.Logf("Shutting down VM: %s", vmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.ShutdownRole(vmname, vmname, vmname, vm.PostShutdownActionStopped) - }); err != nil { - t.Error(err) - } - - if err := WaitForDeploymentInstanceStatus(client, vmname, vmname, vm.InstanceStatusStoppedVM); err != nil { - t.Fatal(err) - } - - imagename := GenerateName() - t.Logf("Capturing VMImage: %s", imagename) - if err := Await(client, func() (management.OperationID, error) { - return vmimage.NewClient(client).Capture(vmname, vmname, vmname, imagename, imagename, vmimage.OSStateGeneralized, vmimage.CaptureParameters{}) - }); err != nil { - t.Error(err) - } - - im := GetUserVMImage(t, client, imagename) - t.Logf("Found image: %+v", im) - - newvmname := GenerateName() - role = NewVMConfiguration(newvmname, "Standard_D3") - ConfigureDeploymentFromUserVMImage(&role, im.Name) - ConfigureForLinux(&role, newvmname, "azureuser", GeneratePassword()) - ConfigureWithPublicSSH(&role) - - t.Logf("Deploying new VM from freshly captured VM image: %s", newvmname) - if err := Await(client, func() (management.OperationID, error) { - return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) - }); err != nil { - t.Error(err) - } - - deleteHostedService(t, client, vmname) -} - -func TestDeployFromPublishedVmImage(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - im := GetVMImage(t, client, func(im vmimage.VMImage) bool { - return im.Name == - "fb83b3509582419d99629ce476bcb5c8__SQL-Server-2014-RTM-12.0.2430.0-OLTP-ENU-Win2012R2-cy14su11" - }) - - role := NewVMConfiguration(vmname, "Standard_D4") - ConfigureDeploymentFromPublishedVMImage(&role, im.Name, - fmt.Sprintf("http://%s.blob.core.windows.net/%s", sa.ServiceName, vmname), false) - ConfigureForWindows(&role, vmname, "azureuser", GeneratePassword(), true, "") - ConfigureWithPublicSSH(&role) - - testRoleConfiguration(t, client, role, location) -} - -func TestRoleStateOperations(t *testing.T) { - client := testutils.GetTestClient(t) - vmname := GenerateName() - sa := GetTestStorageAccount(t, client) - location := sa.StorageServiceProperties.Location - - role := NewVMConfiguration(vmname, "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - GetLinuxTestImage(t, client).Name, - fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), - GenerateName()) - ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) - - createRoleConfiguration(t, client, role, location) - - vmc := vm.NewClient(client) - if err := Await(client, func() (management.OperationID, error) { - return vmc.ShutdownRole(vmname, vmname, vmname, vm.PostShutdownActionStopped) - }); err != nil { - t.Error(err) - } - if err := Await(client, func() (management.OperationID, error) { - return vmc.StartRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - if err := Await(client, func() (management.OperationID, error) { - return vmc.RestartRole(vmname, vmname, vmname) - }); err != nil { - t.Error(err) - } - - deleteHostedService(t, client, vmname) -} - -func testRoleConfiguration(t *testing.T, client management.Client, role vm.Role, location string) { - createRoleConfiguration(t, client, role, location) - - deleteHostedService(t, client, role.RoleName) -} - -func createRoleConfiguration(t *testing.T, client management.Client, role vm.Role, location string) { - vmc := vm.NewClient(client) - hsc := hostedservice.NewClient(client) - vmname := role.RoleName - - if err := hsc.CreateHostedService(hostedservice.CreateHostedServiceParameters{ - ServiceName: vmname, Location: location, - Label: base64.StdEncoding.EncodeToString([]byte(vmname))}); err != nil { - t.Error(err) - } - - if err := Await(client, func() (management.OperationID, error) { - return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) - }); err != nil { - t.Error(err) - } -} - -func deleteHostedService(t *testing.T, client management.Client, vmname string) { - t.Logf("Deleting hosted service: %s", vmname) - if err := Await(client, func() (management.OperationID, error) { - return hostedservice.NewClient(client).DeleteHostedService(vmname, true) - }); err != nil { - t.Error(err) - } -} - -// === utility funcs === - -func GetTestStorageAccount(t *testing.T, client management.Client) storage.StorageServiceResponse { - t.Log("Retrieving storage account") - sc := storage.NewClient(client) - var sa storage.StorageServiceResponse - ssl, err := sc.ListStorageServices() - if err != nil { - t.Fatal(err) - } - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - - if len(ssl.StorageServices) == 0 { - t.Log("No storage accounts found, creating a new one") - lc := location.NewClient(client) - ll, err := lc.ListLocations() - if err != nil { - t.Fatal(err) - } - loc := ll.Locations[rnd.Intn(len(ll.Locations))].Name - - t.Logf("Location for new storage account: %s", loc) - name := GenerateName() - op, err := sc.CreateStorageService(storage.StorageAccountCreateParameters{ - ServiceName: name, - Label: base64.StdEncoding.EncodeToString([]byte(name)), - Location: loc, - AccountType: storage.AccountTypeStandardLRS}) - if err != nil { - t.Fatal(err) - } - if err := client.WaitForOperation(op, nil); err != nil { - t.Fatal(err) - } - sa, err = sc.GetStorageService(name) - if err != nil { - t.Fatal(err) - } - } else { - - sa = ssl.StorageServices[rnd.Intn(len(ssl.StorageServices))] - } - - t.Logf("Selected storage account '%s' in location '%s'", - sa.ServiceName, sa.StorageServiceProperties.Location) - - return sa -} - -func GetLinuxTestImage(t *testing.T, client management.Client) osimage.OSImage { - return GetOSImage(t, client, func(im osimage.OSImage) bool { - return im.Category == "Public" && im.ImageFamily == "Ubuntu Server 14.04 LTS" - }) -} - -func GetWindowsTestImage(t *testing.T, client management.Client) osimage.OSImage { - return GetOSImage(t, client, func(im osimage.OSImage) bool { - return im.Category == "Public" && im.ImageFamily == "Windows Server 2012 R2 Datacenter" - }) -} - -func GetUserOSImage(t *testing.T, client management.Client, name string) osimage.OSImage { - return GetOSImage(t, client, func(im osimage.OSImage) bool { - return im.Category == "User" && im.Name == name - }) -} - -func GetOSImage( - t *testing.T, - client management.Client, - filter func(osimage.OSImage) bool) osimage.OSImage { - t.Log("Selecting OS image") - osc := osimage.NewClient(client) - allimages, err := osc.ListOSImages() - if err != nil { - t.Fatal(err) - } - filtered := []osimage.OSImage{} - for _, im := range allimages.OSImages { - if filter(im) { - filtered = append(filtered, im) - } - } - if len(filtered) == 0 { - t.Fatal("Filter too restrictive, no images left?") - } - - image := filtered[0] - for _, im := range filtered { - if im.PublishedDate > image.PublishedDate { - image = im - } - } - - t.Logf("Selecting image '%s'", image.Name) - return image -} - -func GetUserVMImage(t *testing.T, client management.Client, name string) vmimage.VMImage { - return GetVMImage(t, client, func(im vmimage.VMImage) bool { - return im.Category == "User" && im.Name == name - }) -} - -func GetVMImage( - t *testing.T, - client management.Client, - filter func(vmimage.VMImage) bool) vmimage.VMImage { - t.Log("Selecting VM image") - allimages, err := vmimage.NewClient(client).ListVirtualMachineImages(vmimage.ListParameters{}) - if err != nil { - t.Fatal(err) - } - filtered := []vmimage.VMImage{} - for _, im := range allimages.VMImages { - if filter(im) { - filtered = append(filtered, im) - } - } - if len(filtered) == 0 { - t.Fatal("Filter too restrictive, no images left?") - } - - image := filtered[0] - for _, im := range filtered { - if im.PublishedDate > image.PublishedDate { - image = im - } - } - - t.Logf("Selecting image '%s'", image.Name) - return image -} - -func GenerateName() string { - from := "1234567890abcdefghijklmnopqrstuvwxyz" - return "sdk" + GenerateString(12, from) -} - -func GeneratePassword() string { - pw := GenerateString(20, "1234567890") + - GenerateString(20, "abcdefghijklmnopqrstuvwxyz") + - GenerateString(20, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") - - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - i := rnd.Intn(len(pw)-2) + 1 - - pw = string(append([]uint8(pw[i:]), pw[:i-1]...)) - - return pw -} - -func GenerateString(length int, from string) string { - str := "" - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - for len(str) < length { - str += string(from[rnd.Intn(len(from))]) - } - return str -} - -type asyncFunc func() (operationId management.OperationID, err error) - -func Await(client management.Client, async asyncFunc) error { - requestID, err := async() - if err != nil { - return err - } - return client.WaitForOperation(requestID, nil) -} +package vmutils + +import ( + "encoding/base64" + "fmt" + "math/rand" + "testing" + "time" + + "github.com/Azure/azure-sdk-for-go/management" + "github.com/Azure/azure-sdk-for-go/management/hostedservice" + "github.com/Azure/azure-sdk-for-go/management/location" + "github.com/Azure/azure-sdk-for-go/management/osimage" + storage "github.com/Azure/azure-sdk-for-go/management/storageservice" + "github.com/Azure/azure-sdk-for-go/management/testutils" + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" + vmimage "github.com/Azure/azure-sdk-for-go/management/virtualmachineimage" +) + +func TestDeployPlatformImage(t *testing.T) { + client := testutils.GetTestClient(t) + vmname := GenerateName() + sa := GetTestStorageAccount(t, client) + location := sa.StorageServiceProperties.Location + + role := NewVMConfiguration(vmname, "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + GetLinuxTestImage(t, client).Name, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), + GenerateName()) + ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) + ConfigureWithPublicSSH(&role) + + testRoleConfiguration(t, client, role, location) +} + +func TestDeployPlatformWindowsImage(t *testing.T) { + client := testutils.GetTestClient(t) + vmname := GenerateName() + sa := GetTestStorageAccount(t, client) + location := sa.StorageServiceProperties.Location + + role := NewVMConfiguration(vmname, "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + GetWindowsTestImage(t, client).Name, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), + GenerateName()) + ConfigureForWindows(&role, vmname, "azureuser", GeneratePassword(), true, "") + ConfigureWinRMOverHTTP(&role) + ConfigureWinRMOverHTTPS(&role, "") + + testRoleConfiguration(t, client, role, location) +} + +func TestVMImageList(t *testing.T) { + client := testutils.GetTestClient(t) + vmic := vmimage.NewClient(client) + il, _ := vmic.ListVirtualMachineImages(vmimage.ListParameters{}) + for _, im := range il.VMImages { + t.Logf("%s -%s", im.Name, im.Description) + } +} + +func TestDeployPlatformOSImageCaptureRedeploy(t *testing.T) { + client := testutils.GetTestClient(t) + vmname := GenerateName() + sa := GetTestStorageAccount(t, client) + location := sa.StorageServiceProperties.Location + + role := NewVMConfiguration(vmname, "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + GetLinuxTestImage(t, client).Name, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), + GenerateName()) + ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) + ConfigureWithPublicSSH(&role) + + t.Logf("Deploying VM: %s", vmname) + createRoleConfiguration(t, client, role, location) + + t.Logf("Wait for deployment to enter running state") + vmc := vm.NewClient(client) + status := vm.DeploymentStatusDeploying + for status != vm.DeploymentStatusRunning { + deployment, err := vmc.GetDeployment(vmname, vmname) + if err != nil { + t.Error(err) + break + } + status = deployment.Status + } + + t.Logf("Shutting down VM: %s", vmname) + if err := Await(client, func() (management.OperationID, error) { + return vmc.ShutdownRole(vmname, vmname, vmname, vm.PostShutdownActionStopped) + }); err != nil { + t.Error(err) + } + + if err := WaitForDeploymentPowerState(client, vmname, vmname, vm.PowerStateStopped); err != nil { + t.Fatal(err) + } + + imagename := GenerateName() + t.Logf("Capturing OSImage: %s", imagename) + if err := Await(client, func() (management.OperationID, error) { + return vmc.CaptureRole(vmname, vmname, vmname, imagename, imagename, nil) + }); err != nil { + t.Error(err) + } + + im := GetUserOSImage(t, client, imagename) + t.Logf("Found image: %+v", im) + + newvmname := GenerateName() + role = NewVMConfiguration(newvmname, "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + im.Name, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, newvmname), + GenerateName()) + ConfigureForLinux(&role, newvmname, "azureuser", GeneratePassword()) + ConfigureWithPublicSSH(&role) + + t.Logf("Deploying new VM from freshly captured OS image: %s", newvmname) + if err := Await(client, func() (management.OperationID, error) { + return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) + }); err != nil { + t.Error(err) + } + + deleteHostedService(t, client, vmname) +} + +func TestDeployPlatformVMImageCaptureRedeploy(t *testing.T) { + client := testutils.GetTestClient(t) + vmname := GenerateName() + sa := GetTestStorageAccount(t, client) + location := sa.StorageServiceProperties.Location + + role := NewVMConfiguration(vmname, "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + GetLinuxTestImage(t, client).Name, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), + GenerateName()) + ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) + ConfigureWithPublicSSH(&role) + + t.Logf("Deploying VM: %s", vmname) + createRoleConfiguration(t, client, role, location) + + t.Logf("Wait for deployment to enter running state") + vmc := vm.NewClient(client) + status := vm.DeploymentStatusDeploying + for status != vm.DeploymentStatusRunning { + deployment, err := vmc.GetDeployment(vmname, vmname) + if err != nil { + t.Error(err) + break + } + status = deployment.Status + } + + t.Logf("Shutting down VM: %s", vmname) + if err := Await(client, func() (management.OperationID, error) { + return vmc.ShutdownRole(vmname, vmname, vmname, vm.PostShutdownActionStopped) + }); err != nil { + t.Error(err) + } + + if err := WaitForDeploymentInstanceStatus(client, vmname, vmname, vm.InstanceStatusStoppedVM); err != nil { + t.Fatal(err) + } + + imagename := GenerateName() + t.Logf("Capturing VMImage: %s", imagename) + if err := Await(client, func() (management.OperationID, error) { + return vmimage.NewClient(client).Capture(vmname, vmname, vmname, imagename, imagename, vmimage.OSStateGeneralized, vmimage.CaptureParameters{}) + }); err != nil { + t.Error(err) + } + + im := GetUserVMImage(t, client, imagename) + t.Logf("Found image: %+v", im) + + newvmname := GenerateName() + role = NewVMConfiguration(newvmname, "Standard_D3") + ConfigureDeploymentFromUserVMImage(&role, im.Name) + ConfigureForLinux(&role, newvmname, "azureuser", GeneratePassword()) + ConfigureWithPublicSSH(&role) + + t.Logf("Deploying new VM from freshly captured VM image: %s", newvmname) + if err := Await(client, func() (management.OperationID, error) { + return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) + }); err != nil { + t.Error(err) + } + + deleteHostedService(t, client, vmname) +} + +func TestDeployFromPublishedVmImage(t *testing.T) { + client := testutils.GetTestClient(t) + vmname := GenerateName() + sa := GetTestStorageAccount(t, client) + location := sa.StorageServiceProperties.Location + + im := GetVMImage(t, client, func(im vmimage.VMImage) bool { + return im.Name == + "fb83b3509582419d99629ce476bcb5c8__SQL-Server-2014-RTM-12.0.2430.0-OLTP-ENU-Win2012R2-cy14su11" + }) + + role := NewVMConfiguration(vmname, "Standard_D4") + ConfigureDeploymentFromPublishedVMImage(&role, im.Name, + fmt.Sprintf("http://%s.blob.core.windows.net/%s", sa.ServiceName, vmname), false) + ConfigureForWindows(&role, vmname, "azureuser", GeneratePassword(), true, "") + ConfigureWithPublicSSH(&role) + + testRoleConfiguration(t, client, role, location) +} + +func TestRoleStateOperations(t *testing.T) { + client := testutils.GetTestClient(t) + vmname := GenerateName() + sa := GetTestStorageAccount(t, client) + location := sa.StorageServiceProperties.Location + + role := NewVMConfiguration(vmname, "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + GetLinuxTestImage(t, client).Name, + fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", sa.ServiceName, vmname), + GenerateName()) + ConfigureForLinux(&role, "myvm", "azureuser", GeneratePassword()) + + createRoleConfiguration(t, client, role, location) + + vmc := vm.NewClient(client) + if err := Await(client, func() (management.OperationID, error) { + return vmc.ShutdownRole(vmname, vmname, vmname, vm.PostShutdownActionStopped) + }); err != nil { + t.Error(err) + } + if err := Await(client, func() (management.OperationID, error) { + return vmc.StartRole(vmname, vmname, vmname) + }); err != nil { + t.Error(err) + } + if err := Await(client, func() (management.OperationID, error) { + return vmc.RestartRole(vmname, vmname, vmname) + }); err != nil { + t.Error(err) + } + + deleteHostedService(t, client, vmname) +} + +func testRoleConfiguration(t *testing.T, client management.Client, role vm.Role, location string) { + createRoleConfiguration(t, client, role, location) + + deleteHostedService(t, client, role.RoleName) +} + +func createRoleConfiguration(t *testing.T, client management.Client, role vm.Role, location string) { + vmc := vm.NewClient(client) + hsc := hostedservice.NewClient(client) + vmname := role.RoleName + + if err := hsc.CreateHostedService(hostedservice.CreateHostedServiceParameters{ + ServiceName: vmname, Location: location, + Label: base64.StdEncoding.EncodeToString([]byte(vmname))}); err != nil { + t.Error(err) + } + + if err := Await(client, func() (management.OperationID, error) { + return vmc.CreateDeployment(role, vmname, vm.CreateDeploymentOptions{}) + }); err != nil { + t.Error(err) + } +} + +func deleteHostedService(t *testing.T, client management.Client, vmname string) { + t.Logf("Deleting hosted service: %s", vmname) + if err := Await(client, func() (management.OperationID, error) { + return hostedservice.NewClient(client).DeleteHostedService(vmname, true) + }); err != nil { + t.Error(err) + } +} + +// === utility funcs === + +func GetTestStorageAccount(t *testing.T, client management.Client) storage.StorageServiceResponse { + t.Log("Retrieving storage account") + sc := storage.NewClient(client) + var sa storage.StorageServiceResponse + ssl, err := sc.ListStorageServices() + if err != nil { + t.Fatal(err) + } + rnd := rand.New(rand.NewSource(time.Now().UnixNano())) + + if len(ssl.StorageServices) == 0 { + t.Log("No storage accounts found, creating a new one") + lc := location.NewClient(client) + ll, err := lc.ListLocations() + if err != nil { + t.Fatal(err) + } + loc := ll.Locations[rnd.Intn(len(ll.Locations))].Name + + t.Logf("Location for new storage account: %s", loc) + name := GenerateName() + op, err := sc.CreateStorageService(storage.StorageAccountCreateParameters{ + ServiceName: name, + Label: base64.StdEncoding.EncodeToString([]byte(name)), + Location: loc, + AccountType: storage.AccountTypeStandardLRS}) + if err != nil { + t.Fatal(err) + } + if err := client.WaitForOperation(op, nil); err != nil { + t.Fatal(err) + } + sa, err = sc.GetStorageService(name) + if err != nil { + t.Fatal(err) + } + } else { + + sa = ssl.StorageServices[rnd.Intn(len(ssl.StorageServices))] + } + + t.Logf("Selected storage account '%s' in location '%s'", + sa.ServiceName, sa.StorageServiceProperties.Location) + + return sa +} + +func GetLinuxTestImage(t *testing.T, client management.Client) osimage.OSImage { + return GetOSImage(t, client, func(im osimage.OSImage) bool { + return im.Category == "Public" && im.ImageFamily == "Ubuntu Server 14.04 LTS" + }) +} + +func GetWindowsTestImage(t *testing.T, client management.Client) osimage.OSImage { + return GetOSImage(t, client, func(im osimage.OSImage) bool { + return im.Category == "Public" && im.ImageFamily == "Windows Server 2012 R2 Datacenter" + }) +} + +func GetUserOSImage(t *testing.T, client management.Client, name string) osimage.OSImage { + return GetOSImage(t, client, func(im osimage.OSImage) bool { + return im.Category == "User" && im.Name == name + }) +} + +func GetOSImage( + t *testing.T, + client management.Client, + filter func(osimage.OSImage) bool) osimage.OSImage { + t.Log("Selecting OS image") + osc := osimage.NewClient(client) + allimages, err := osc.ListOSImages() + if err != nil { + t.Fatal(err) + } + filtered := []osimage.OSImage{} + for _, im := range allimages.OSImages { + if filter(im) { + filtered = append(filtered, im) + } + } + if len(filtered) == 0 { + t.Fatal("Filter too restrictive, no images left?") + } + + image := filtered[0] + for _, im := range filtered { + if im.PublishedDate > image.PublishedDate { + image = im + } + } + + t.Logf("Selecting image '%s'", image.Name) + return image +} + +func GetUserVMImage(t *testing.T, client management.Client, name string) vmimage.VMImage { + return GetVMImage(t, client, func(im vmimage.VMImage) bool { + return im.Category == "User" && im.Name == name + }) +} + +func GetVMImage( + t *testing.T, + client management.Client, + filter func(vmimage.VMImage) bool) vmimage.VMImage { + t.Log("Selecting VM image") + allimages, err := vmimage.NewClient(client).ListVirtualMachineImages(vmimage.ListParameters{}) + if err != nil { + t.Fatal(err) + } + filtered := []vmimage.VMImage{} + for _, im := range allimages.VMImages { + if filter(im) { + filtered = append(filtered, im) + } + } + if len(filtered) == 0 { + t.Fatal("Filter too restrictive, no images left?") + } + + image := filtered[0] + for _, im := range filtered { + if im.PublishedDate > image.PublishedDate { + image = im + } + } + + t.Logf("Selecting image '%s'", image.Name) + return image +} + +func GenerateName() string { + from := "1234567890abcdefghijklmnopqrstuvwxyz" + return "sdk" + GenerateString(12, from) +} + +func GeneratePassword() string { + pw := GenerateString(20, "1234567890") + + GenerateString(20, "abcdefghijklmnopqrstuvwxyz") + + GenerateString(20, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") + + rnd := rand.New(rand.NewSource(time.Now().UnixNano())) + i := rnd.Intn(len(pw)-2) + 1 + + pw = string(append([]uint8(pw[i:]), pw[:i-1]...)) + + return pw +} + +func GenerateString(length int, from string) string { + str := "" + rnd := rand.New(rand.NewSource(time.Now().UnixNano())) + for len(str) < length { + str += string(from[rnd.Intn(len(from))]) + } + return str +} + +type asyncFunc func() (operationId management.OperationID, err error) + +func Await(client management.Client, async asyncFunc) error { + requestID, err := async() + if err != nil { + return err + } + return client.WaitForOperation(requestID, nil) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/network.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/network.go index d2c7eb95a0..bf2331c7b3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/network.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/network.go @@ -1,83 +1,83 @@ -package vmutils - -import ( - "fmt" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -// ConfigureWithPublicSSH adds configuration exposing port 22 externally -func ConfigureWithPublicSSH(role *vm.Role) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - return ConfigureWithExternalPort(role, "SSH", 22, 22, vm.InputEndpointProtocolTCP) -} - -// ConfigureWithPublicRDP adds configuration exposing port 3389 externally -func ConfigureWithPublicRDP(role *vm.Role) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - return ConfigureWithExternalPort(role, "RDP", 3389, 3389, vm.InputEndpointProtocolTCP) -} - -// ConfigureWithPublicPowerShell adds configuration exposing port 5986 -// externally -func ConfigureWithPublicPowerShell(role *vm.Role) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - return ConfigureWithExternalPort(role, "PowerShell", 5986, 5986, vm.InputEndpointProtocolTCP) -} - -// ConfigureWithExternalPort adds a new InputEndpoint to the Role, exposing a -// port externally -func ConfigureWithExternalPort(role *vm.Role, name string, localport, externalport int, protocol vm.InputEndpointProtocol) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeNetwork, - func(config *vm.ConfigurationSet) { - config.InputEndpoints = append(config.InputEndpoints, vm.InputEndpoint{ - LocalPort: localport, - Name: name, - Port: externalport, - Protocol: protocol, - }) - }) - - return nil -} - -// ConfigureWithSecurityGroup associates the Role with a specific network security group -func ConfigureWithSecurityGroup(role *vm.Role, networkSecurityGroup string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeNetwork, - func(config *vm.ConfigurationSet) { - config.NetworkSecurityGroup = networkSecurityGroup - }) - - return nil -} - -// ConfigureWithSubnet associates the Role with a specific subnet -func ConfigureWithSubnet(role *vm.Role, subnet string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeNetwork, - func(config *vm.ConfigurationSet) { - config.SubnetNames = append(config.SubnetNames, subnet) - }) - - return nil -} +package vmutils + +import ( + "fmt" + + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +// ConfigureWithPublicSSH adds configuration exposing port 22 externally +func ConfigureWithPublicSSH(role *vm.Role) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + return ConfigureWithExternalPort(role, "SSH", 22, 22, vm.InputEndpointProtocolTCP) +} + +// ConfigureWithPublicRDP adds configuration exposing port 3389 externally +func ConfigureWithPublicRDP(role *vm.Role) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + return ConfigureWithExternalPort(role, "RDP", 3389, 3389, vm.InputEndpointProtocolTCP) +} + +// ConfigureWithPublicPowerShell adds configuration exposing port 5986 +// externally +func ConfigureWithPublicPowerShell(role *vm.Role) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + return ConfigureWithExternalPort(role, "PowerShell", 5986, 5986, vm.InputEndpointProtocolTCP) +} + +// ConfigureWithExternalPort adds a new InputEndpoint to the Role, exposing a +// port externally +func ConfigureWithExternalPort(role *vm.Role, name string, localport, externalport int, protocol vm.InputEndpointProtocol) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeNetwork, + func(config *vm.ConfigurationSet) { + config.InputEndpoints = append(config.InputEndpoints, vm.InputEndpoint{ + LocalPort: localport, + Name: name, + Port: externalport, + Protocol: protocol, + }) + }) + + return nil +} + +// ConfigureWithSecurityGroup associates the Role with a specific network security group +func ConfigureWithSecurityGroup(role *vm.Role, networkSecurityGroup string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeNetwork, + func(config *vm.ConfigurationSet) { + config.NetworkSecurityGroup = networkSecurityGroup + }) + + return nil +} + +// ConfigureWithSubnet associates the Role with a specific subnet +func ConfigureWithSubnet(role *vm.Role, subnet string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeNetwork, + func(config *vm.ConfigurationSet) { + config.SubnetNames = append(config.SubnetNames, subnet) + }) + + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolesize.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolesize.go index e2c2779524..bedd702fb5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolesize.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolesize.go @@ -1,76 +1,76 @@ -package vmutils - -import ( - "fmt" - - "github.com/Azure/azure-sdk-for-go/management" - lc "github.com/Azure/azure-sdk-for-go/management/location" - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -// IsRoleSizeValid retrieves the available rolesizes using -// vmclient.GetRoleSizeList() and returns whether that the provided roleSizeName -// is part of that list -func IsRoleSizeValid(vmclient vm.VirtualMachineClient, roleSizeName string) (bool, error) { - if roleSizeName == "" { - return false, fmt.Errorf(errParamNotSpecified, "roleSizeName") - } - - roleSizeList, err := vmclient.GetRoleSizeList() - if err != nil { - return false, err - } - - for _, roleSize := range roleSizeList.RoleSizes { - if roleSize.Name == roleSizeName { - return true, nil - } - } - - return false, nil -} - -// IsRoleSizeAvailableInLocation retrieves all available sizes in the specified -// location and returns whether that the provided roleSizeName is part of that list. -func IsRoleSizeAvailableInLocation(managementclient management.Client, location, roleSizeName string) (bool, error) { - if location == "" { - return false, fmt.Errorf(errParamNotSpecified, "location") - } - if roleSizeName == "" { - return false, fmt.Errorf(errParamNotSpecified, "roleSizeName") - } - - locationClient := lc.NewClient(managementclient) - locationInfo, err := getLocation(locationClient, location) - if err != nil { - return false, err - } - - for _, availableRoleSize := range locationInfo.VirtualMachineRoleSizes { - if availableRoleSize == roleSizeName { - return true, nil - } - } - - return false, nil -} - -func getLocation(c lc.LocationClient, location string) (*lc.Location, error) { - if location == "" { - return nil, fmt.Errorf(errParamNotSpecified, "location") - } - - locations, err := c.ListLocations() - if err != nil { - return nil, err - } - - for _, existingLocation := range locations.Locations { - if existingLocation.Name != location { - continue - } - - return &existingLocation, nil - } - return nil, fmt.Errorf("Invalid location: %s. Available locations: %s", location, locations) -} +package vmutils + +import ( + "fmt" + + "github.com/Azure/azure-sdk-for-go/management" + lc "github.com/Azure/azure-sdk-for-go/management/location" + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +// IsRoleSizeValid retrieves the available rolesizes using +// vmclient.GetRoleSizeList() and returns whether that the provided roleSizeName +// is part of that list +func IsRoleSizeValid(vmclient vm.VirtualMachineClient, roleSizeName string) (bool, error) { + if roleSizeName == "" { + return false, fmt.Errorf(errParamNotSpecified, "roleSizeName") + } + + roleSizeList, err := vmclient.GetRoleSizeList() + if err != nil { + return false, err + } + + for _, roleSize := range roleSizeList.RoleSizes { + if roleSize.Name == roleSizeName { + return true, nil + } + } + + return false, nil +} + +// IsRoleSizeAvailableInLocation retrieves all available sizes in the specified +// location and returns whether that the provided roleSizeName is part of that list. +func IsRoleSizeAvailableInLocation(managementclient management.Client, location, roleSizeName string) (bool, error) { + if location == "" { + return false, fmt.Errorf(errParamNotSpecified, "location") + } + if roleSizeName == "" { + return false, fmt.Errorf(errParamNotSpecified, "roleSizeName") + } + + locationClient := lc.NewClient(managementclient) + locationInfo, err := getLocation(locationClient, location) + if err != nil { + return false, err + } + + for _, availableRoleSize := range locationInfo.VirtualMachineRoleSizes { + if availableRoleSize == roleSizeName { + return true, nil + } + } + + return false, nil +} + +func getLocation(c lc.LocationClient, location string) (*lc.Location, error) { + if location == "" { + return nil, fmt.Errorf(errParamNotSpecified, "location") + } + + locations, err := c.ListLocations() + if err != nil { + return nil, err + } + + for _, existingLocation := range locations.Locations { + if existingLocation.Name != location { + continue + } + + return &existingLocation, nil + } + return nil, fmt.Errorf("Invalid location: %s. Available locations: %s", location, locations) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolestate.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolestate.go index c26832648c..e3f21285c6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolestate.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/rolestate.go @@ -1,58 +1,58 @@ -package vmutils - -import ( - "time" - - "github.com/Azure/azure-sdk-for-go/management" - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -// WaitForDeploymentPowerState blocks until all role instances in deployment -// reach desired power state. -func WaitForDeploymentPowerState(client management.Client, cloudServiceName, deploymentName string, desiredPowerstate vm.PowerState) error { - for { - deployment, err := vm.NewClient(client).GetDeployment(cloudServiceName, deploymentName) - if err != nil { - return err - } - if allInstancesInPowerState(deployment.RoleInstanceList, desiredPowerstate) { - return nil - } - time.Sleep(2 * time.Second) - } -} - -func allInstancesInPowerState(instances []vm.RoleInstance, desiredPowerstate vm.PowerState) bool { - for _, r := range instances { - if r.PowerState != desiredPowerstate { - return false - } - } - - return true -} - -// WaitForDeploymentInstanceStatus blocks until all role instances in deployment -// reach desired InstanceStatus. -func WaitForDeploymentInstanceStatus(client management.Client, cloudServiceName, deploymentName string, desiredInstanceStatus vm.InstanceStatus) error { - for { - deployment, err := vm.NewClient(client).GetDeployment(cloudServiceName, deploymentName) - if err != nil { - return err - } - if allInstancesInInstanceStatus(deployment.RoleInstanceList, desiredInstanceStatus) { - return nil - } - time.Sleep(2 * time.Second) - } -} - -func allInstancesInInstanceStatus(instances []vm.RoleInstance, desiredInstancestatus vm.InstanceStatus) bool { - for _, r := range instances { - if r.InstanceStatus != desiredInstancestatus { - return false - } - } - - return true -} +package vmutils + +import ( + "time" + + "github.com/Azure/azure-sdk-for-go/management" + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +// WaitForDeploymentPowerState blocks until all role instances in deployment +// reach desired power state. +func WaitForDeploymentPowerState(client management.Client, cloudServiceName, deploymentName string, desiredPowerstate vm.PowerState) error { + for { + deployment, err := vm.NewClient(client).GetDeployment(cloudServiceName, deploymentName) + if err != nil { + return err + } + if allInstancesInPowerState(deployment.RoleInstanceList, desiredPowerstate) { + return nil + } + time.Sleep(2 * time.Second) + } +} + +func allInstancesInPowerState(instances []vm.RoleInstance, desiredPowerstate vm.PowerState) bool { + for _, r := range instances { + if r.PowerState != desiredPowerstate { + return false + } + } + + return true +} + +// WaitForDeploymentInstanceStatus blocks until all role instances in deployment +// reach desired InstanceStatus. +func WaitForDeploymentInstanceStatus(client management.Client, cloudServiceName, deploymentName string, desiredInstanceStatus vm.InstanceStatus) error { + for { + deployment, err := vm.NewClient(client).GetDeployment(cloudServiceName, deploymentName) + if err != nil { + return err + } + if allInstancesInInstanceStatus(deployment.RoleInstanceList, desiredInstanceStatus) { + return nil + } + time.Sleep(2 * time.Second) + } +} + +func allInstancesInInstanceStatus(instances []vm.RoleInstance, desiredInstancestatus vm.InstanceStatus) bool { + for _, r := range instances { + if r.InstanceStatus != desiredInstancestatus { + return false + } + } + + return true +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils.go index 9f45b717d8..1845663c8d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils.go @@ -1,177 +1,177 @@ -// Package vmutils provides convenience methods for creating Virtual -// Machine Role configurations. -package vmutils - -import ( - "fmt" - - vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" -) - -const ( - errParamNotSpecified = "Parameter %s is not specified." -) - -// NewVMConfiguration creates configuration for a new virtual machine Role. -func NewVMConfiguration(name string, roleSize string) vm.Role { - return vm.Role{ - RoleName: name, - RoleType: "PersistentVMRole", - RoleSize: roleSize, - ProvisionGuestAgent: true, - } -} - -// ConfigureForLinux adds configuration when deploying a generalized Linux -// image. If "password" is left empty, SSH password security will be disabled by -// default. Certificates with SSH public keys should already be uploaded to the -// cloud service where the VM will be deployed and referenced here only by their -// thumbprint. -func ConfigureForLinux(role *vm.Role, hostname, user, password string, sshPubkeyCertificateThumbprint ...string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeLinuxProvisioning, - func(config *vm.ConfigurationSet) { - config.HostName = hostname - config.UserName = user - config.UserPassword = password - if password != "" { - config.DisableSSHPasswordAuthentication = "false" - } - if len(sshPubkeyCertificateThumbprint) != 0 { - config.SSH = &vm.SSH{} - for _, k := range sshPubkeyCertificateThumbprint { - config.SSH.PublicKeys = append(config.SSH.PublicKeys, - vm.PublicKey{ - Fingerprint: k, - Path: "/home/" + user + "/.ssh/authorized_keys", - }, - ) - } - } - }, - ) - - return nil -} - -// ConfigureForWindows adds configuration when deploying a generalized -// Windows image. timeZone can be left empty. For a complete list of supported -// time zone entries, you can either refer to the values listed in the registry -// entry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time -// Zones" or you can use the tzutil command-line tool to list the valid time. -func ConfigureForWindows(role *vm.Role, hostname, user, password string, enableAutomaticUpdates bool, timeZone string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeWindowsProvisioning, - func(config *vm.ConfigurationSet) { - config.ComputerName = hostname - config.AdminUsername = user - config.AdminPassword = password - config.EnableAutomaticUpdates = enableAutomaticUpdates - config.TimeZone = timeZone - }, - ) - - return nil -} - -// ConfigureWithCustomDataForLinux configures custom data for Linux-based images. -// The customData contains either cloud-init or shell script to be executed upon start. -// -// The function expects the customData to be base64-encoded. -func ConfigureWithCustomDataForLinux(role *vm.Role, customData string) error { - return configureWithCustomData(role, customData, vm.ConfigurationSetTypeLinuxProvisioning) -} - -// ConfigureWithCustomDataForWindows configures custom data for Windows-based images. -// The customData contains either cloud-init or shell script to be executed upon start. -// -// The function expects the customData to be base64-encoded. -func ConfigureWithCustomDataForWindows(role *vm.Role, customData string) error { - return configureWithCustomData(role, customData, vm.ConfigurationSetTypeWindowsProvisioning) -} - -func configureWithCustomData(role *vm.Role, customData string, typ vm.ConfigurationSetType) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, typ, - func(config *vm.ConfigurationSet) { - config.CustomData = customData - }) - - return nil -} - -// ConfigureWindowsToJoinDomain adds configuration to join a new Windows vm to a -// domain. "username" must be in UPN form (user@domain.com), "machineOU" can be -// left empty -func ConfigureWindowsToJoinDomain(role *vm.Role, username, password, domainToJoin, machineOU string) error { - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - winconfig := findConfig(role.ConfigurationSets, vm.ConfigurationSetTypeWindowsProvisioning) - if winconfig != nil { - winconfig.DomainJoin = &vm.DomainJoin{ - Credentials: vm.Credentials{Username: username, Password: password}, - JoinDomain: domainToJoin, - MachineObjectOU: machineOU, - } - } - - return nil -} - -func ConfigureWinRMListener(role *vm.Role, protocol vm.WinRMProtocol, certificateThumbprint string) error { - - if role == nil { - return fmt.Errorf(errParamNotSpecified, "role") - } - - winconfig := findConfig(role.ConfigurationSets, vm.ConfigurationSetTypeWindowsProvisioning) - - if winconfig != nil { - - listener := vm.WinRMListener{ - Protocol: protocol, - CertificateThumbprint: certificateThumbprint, - } - - if winconfig.WinRMListeners == nil { - winconfig.WinRMListeners = &[]vm.WinRMListener{} - } - - currentListeners := *winconfig.WinRMListeners - - // replace existing listener if it's already configured - for i, existingListener := range currentListeners { - if existingListener.Protocol == protocol { - currentListeners[i] = listener - return nil - } - } - - // otherwise append to list of listeners - newListeners := append(currentListeners, listener) - winconfig.WinRMListeners = &newListeners - - return nil - } - - return fmt.Errorf("WindowsProvisioningConfigurationSet not found in 'role'") -} - -func ConfigureWinRMOverHTTP(role *vm.Role) error { - return ConfigureWinRMListener(role, vm.WinRMProtocolHTTP, "") -} - -func ConfigureWinRMOverHTTPS(role *vm.Role, certificateThumbprint string) error { - return ConfigureWinRMListener(role, vm.WinRMProtocolHTTPS, certificateThumbprint) -} +// Package vmutils provides convenience methods for creating Virtual +// Machine Role configurations. +package vmutils + +import ( + "fmt" + + vm "github.com/Azure/azure-sdk-for-go/management/virtualmachine" +) + +const ( + errParamNotSpecified = "Parameter %s is not specified." +) + +// NewVMConfiguration creates configuration for a new virtual machine Role. +func NewVMConfiguration(name string, roleSize string) vm.Role { + return vm.Role{ + RoleName: name, + RoleType: "PersistentVMRole", + RoleSize: roleSize, + ProvisionGuestAgent: true, + } +} + +// ConfigureForLinux adds configuration when deploying a generalized Linux +// image. If "password" is left empty, SSH password security will be disabled by +// default. Certificates with SSH public keys should already be uploaded to the +// cloud service where the VM will be deployed and referenced here only by their +// thumbprint. +func ConfigureForLinux(role *vm.Role, hostname, user, password string, sshPubkeyCertificateThumbprint ...string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeLinuxProvisioning, + func(config *vm.ConfigurationSet) { + config.HostName = hostname + config.UserName = user + config.UserPassword = password + if password != "" { + config.DisableSSHPasswordAuthentication = "false" + } + if len(sshPubkeyCertificateThumbprint) != 0 { + config.SSH = &vm.SSH{} + for _, k := range sshPubkeyCertificateThumbprint { + config.SSH.PublicKeys = append(config.SSH.PublicKeys, + vm.PublicKey{ + Fingerprint: k, + Path: "/home/" + user + "/.ssh/authorized_keys", + }, + ) + } + } + }, + ) + + return nil +} + +// ConfigureForWindows adds configuration when deploying a generalized +// Windows image. timeZone can be left empty. For a complete list of supported +// time zone entries, you can either refer to the values listed in the registry +// entry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time +// Zones" or you can use the tzutil command-line tool to list the valid time. +func ConfigureForWindows(role *vm.Role, hostname, user, password string, enableAutomaticUpdates bool, timeZone string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, vm.ConfigurationSetTypeWindowsProvisioning, + func(config *vm.ConfigurationSet) { + config.ComputerName = hostname + config.AdminUsername = user + config.AdminPassword = password + config.EnableAutomaticUpdates = enableAutomaticUpdates + config.TimeZone = timeZone + }, + ) + + return nil +} + +// ConfigureWithCustomDataForLinux configures custom data for Linux-based images. +// The customData contains either cloud-init or shell script to be executed upon start. +// +// The function expects the customData to be base64-encoded. +func ConfigureWithCustomDataForLinux(role *vm.Role, customData string) error { + return configureWithCustomData(role, customData, vm.ConfigurationSetTypeLinuxProvisioning) +} + +// ConfigureWithCustomDataForWindows configures custom data for Windows-based images. +// The customData contains either cloud-init or shell script to be executed upon start. +// +// The function expects the customData to be base64-encoded. +func ConfigureWithCustomDataForWindows(role *vm.Role, customData string) error { + return configureWithCustomData(role, customData, vm.ConfigurationSetTypeWindowsProvisioning) +} + +func configureWithCustomData(role *vm.Role, customData string, typ vm.ConfigurationSetType) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + role.ConfigurationSets = updateOrAddConfig(role.ConfigurationSets, typ, + func(config *vm.ConfigurationSet) { + config.CustomData = customData + }) + + return nil +} + +// ConfigureWindowsToJoinDomain adds configuration to join a new Windows vm to a +// domain. "username" must be in UPN form (user@domain.com), "machineOU" can be +// left empty +func ConfigureWindowsToJoinDomain(role *vm.Role, username, password, domainToJoin, machineOU string) error { + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + winconfig := findConfig(role.ConfigurationSets, vm.ConfigurationSetTypeWindowsProvisioning) + if winconfig != nil { + winconfig.DomainJoin = &vm.DomainJoin{ + Credentials: vm.Credentials{Username: username, Password: password}, + JoinDomain: domainToJoin, + MachineObjectOU: machineOU, + } + } + + return nil +} + +func ConfigureWinRMListener(role *vm.Role, protocol vm.WinRMProtocol, certificateThumbprint string) error { + + if role == nil { + return fmt.Errorf(errParamNotSpecified, "role") + } + + winconfig := findConfig(role.ConfigurationSets, vm.ConfigurationSetTypeWindowsProvisioning) + + if winconfig != nil { + + listener := vm.WinRMListener{ + Protocol: protocol, + CertificateThumbprint: certificateThumbprint, + } + + if winconfig.WinRMListeners == nil { + winconfig.WinRMListeners = &[]vm.WinRMListener{} + } + + currentListeners := *winconfig.WinRMListeners + + // replace existing listener if it's already configured + for i, existingListener := range currentListeners { + if existingListener.Protocol == protocol { + currentListeners[i] = listener + return nil + } + } + + // otherwise append to list of listeners + newListeners := append(currentListeners, listener) + winconfig.WinRMListeners = &newListeners + + return nil + } + + return fmt.Errorf("WindowsProvisioningConfigurationSet not found in 'role'") +} + +func ConfigureWinRMOverHTTP(role *vm.Role) error { + return ConfigureWinRMListener(role, vm.WinRMProtocolHTTP, "") +} + +func ConfigureWinRMOverHTTPS(role *vm.Role, certificateThumbprint string) error { + return ConfigureWinRMListener(role, vm.WinRMProtocolHTTPS, certificateThumbprint) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go index 3ba41b658d..6755940200 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/management/vmutils/vmutils_test.go @@ -1,440 +1,440 @@ -package vmutils - -import ( - "encoding/xml" - "testing" - - vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" -) - -func TestNewLinuxVmRemoteImage(t *testing.T) { - role := NewVMConfiguration("myvm", "Standard_D3") - ConfigureDeploymentFromRemoteImage(&role, - "http://remote.host/some.vhd?sv=12&sig=ukhfiuwef78687", "Linux", - "myvm-os-disk", "http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd", - "OSDisk") - ConfigureForLinux(&role, "myvm", "azureuser", "P@ssword", "2398yyKJGd78e2389ydfncuirowebhf89yh3IUOBY") - ConfigureWithPublicSSH(&role) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - myvm - PersistentVMRole - - - LinuxProvisioningConfiguration - - myvm - azureuser - P@ssword - false - - - - 2398yyKJGd78e2389ydfncuirowebhf89yh3IUOBY - /home/azureuser/.ssh/authorized_keys - - - - - - - - - - NetworkConfiguration - - - - 22 - SSH - 22 - TCP - - - - - - - - - OSDisk - myvm-os-disk - http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd - Linux - http://remote.host/some.vhd?sv=12&sig=ukhfiuwef78687 - - Standard_D3 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestNewLinuxVmPlatformImage(t *testing.T) { - role := NewVMConfiguration("myplatformvm", "Standard_D3") - ConfigureDeploymentFromPlatformImage(&role, - "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2_LTS-amd64-server-20150309-en-us-30GB", - "http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd", "mydisklabel") - ConfigureForLinux(&role, "myvm", "azureuser", "", "2398yyKJGd78e2389ydfncuirdebhf89yh3IUOBY") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - myplatformvm - PersistentVMRole - - - LinuxProvisioningConfiguration - - myvm - azureuser - - - - 2398yyKJGd78e2389ydfncuirdebhf89yh3IUOBY - /home/azureuser/.ssh/authorized_keys - - - - - - - - - - - - http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd - b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2_LTS-amd64-server-20150309-en-us-30GB - - Standard_D3 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestNewVmFromVMImage(t *testing.T) { - role := NewVMConfiguration("restoredbackup", "Standard_D1") - ConfigureDeploymentFromPublishedVMImage(&role, "myvm-backup-20150209", - "http://mystorageacct.blob.core.windows.net/vhds/myoldnewvm.vhd", false) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - restoredbackup - PersistentVMRole - - myvm-backup-20150209 - http://mystorageacct.blob.core.windows.net/vhds/myoldnewvm.vhd - - Standard_D1 -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestNewVmFromExistingDisk(t *testing.T) { - role := NewVMConfiguration("blobvm", "Standard_D14") - ConfigureDeploymentFromExistingOSDisk(&role, "myvm-backup-20150209", "OSDisk") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWindowsToJoinDomain(&role, "user@domain.com", "youReN3verG0nnaGu3ss", "redmond.corp.contoso.com", "") - ConfigureWithNewDataDisk(&role, "my-brand-new-disk", "http://account.blob.core.windows.net/vhds/newdatadisk.vhd", - 30, vmdisk.HostCachingTypeReadWrite) - ConfigureWithExistingDataDisk(&role, "data-disk", vmdisk.HostCachingTypeReadOnly) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - blobvm - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - user@domain.com - youReN3verG0nnaGu3ss - - redmond.corp.contoso.com - - - azuser - - - - - - - - ReadWrite - my-brand-new-disk - 30 - http://account.blob.core.windows.net/vhds/newdatadisk.vhd - - - ReadOnly - data-disk - 1 - - - - OSDisk - myvm-backup-20150209 - - Standard_D14 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestWinRMOverHttps(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTPS(&role, "abcdef") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Https - abcdef - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestWinRMOverHttpsWithNoThumbprint(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTPS(&role, "") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Https - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestWinRMOverHttp(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTP(&role) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Http - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestSettingWinRMOverHttpTwice(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTP(&role) - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Http - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} - -func TestSettingWinRMOverHttpAndHttpsTwice(t *testing.T) { - role := NewVMConfiguration("winrmoverhttp", "Standard_D1") - ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTPS(&role, "") - ConfigureWinRMOverHTTP(&role) - ConfigureWinRMOverHTTPS(&role, "abcdef") - - bytes, err := xml.MarshalIndent(role, "", " ") - if err != nil { - t.Fatal(err) - } - - expected := ` - winrmoverhttp - PersistentVMRole - - - WindowsProvisioningConfiguration - WINVM - P2ssw@rd - true - - - - - Http - - - Https - abcdef - - - - azuser - - - - - - - Standard_D1 - true -` - - if string(bytes) != expected { - t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) - } -} +package vmutils + +import ( + "encoding/xml" + "testing" + + vmdisk "github.com/Azure/azure-sdk-for-go/management/virtualmachinedisk" +) + +func TestNewLinuxVmRemoteImage(t *testing.T) { + role := NewVMConfiguration("myvm", "Standard_D3") + ConfigureDeploymentFromRemoteImage(&role, + "http://remote.host/some.vhd?sv=12&sig=ukhfiuwef78687", "Linux", + "myvm-os-disk", "http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd", + "OSDisk") + ConfigureForLinux(&role, "myvm", "azureuser", "P@ssword", "2398yyKJGd78e2389ydfncuirowebhf89yh3IUOBY") + ConfigureWithPublicSSH(&role) + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + myvm + PersistentVMRole + + + LinuxProvisioningConfiguration + + myvm + azureuser + P@ssword + false + + + + 2398yyKJGd78e2389ydfncuirowebhf89yh3IUOBY + /home/azureuser/.ssh/authorized_keys + + + + + + + + + + NetworkConfiguration + + + + 22 + SSH + 22 + TCP + + + + + + + + + OSDisk + myvm-os-disk + http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd + Linux + http://remote.host/some.vhd?sv=12&sig=ukhfiuwef78687 + + Standard_D3 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestNewLinuxVmPlatformImage(t *testing.T) { + role := NewVMConfiguration("myplatformvm", "Standard_D3") + ConfigureDeploymentFromPlatformImage(&role, + "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2_LTS-amd64-server-20150309-en-us-30GB", + "http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd", "mydisklabel") + ConfigureForLinux(&role, "myvm", "azureuser", "", "2398yyKJGd78e2389ydfncuirdebhf89yh3IUOBY") + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + myplatformvm + PersistentVMRole + + + LinuxProvisioningConfiguration + + myvm + azureuser + + + + 2398yyKJGd78e2389ydfncuirdebhf89yh3IUOBY + /home/azureuser/.ssh/authorized_keys + + + + + + + + + + + + http://mystorageacct.blob.core.windows.net/vhds/mybrandnewvm.vhd + b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2_LTS-amd64-server-20150309-en-us-30GB + + Standard_D3 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestNewVmFromVMImage(t *testing.T) { + role := NewVMConfiguration("restoredbackup", "Standard_D1") + ConfigureDeploymentFromPublishedVMImage(&role, "myvm-backup-20150209", + "http://mystorageacct.blob.core.windows.net/vhds/myoldnewvm.vhd", false) + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + restoredbackup + PersistentVMRole + + myvm-backup-20150209 + http://mystorageacct.blob.core.windows.net/vhds/myoldnewvm.vhd + + Standard_D1 +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestNewVmFromExistingDisk(t *testing.T) { + role := NewVMConfiguration("blobvm", "Standard_D14") + ConfigureDeploymentFromExistingOSDisk(&role, "myvm-backup-20150209", "OSDisk") + ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") + ConfigureWindowsToJoinDomain(&role, "user@domain.com", "youReN3verG0nnaGu3ss", "redmond.corp.contoso.com", "") + ConfigureWithNewDataDisk(&role, "my-brand-new-disk", "http://account.blob.core.windows.net/vhds/newdatadisk.vhd", + 30, vmdisk.HostCachingTypeReadWrite) + ConfigureWithExistingDataDisk(&role, "data-disk", vmdisk.HostCachingTypeReadOnly) + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + blobvm + PersistentVMRole + + + WindowsProvisioningConfiguration + WINVM + P2ssw@rd + true + + + + user@domain.com + youReN3verG0nnaGu3ss + + redmond.corp.contoso.com + + + azuser + + + + + + + + ReadWrite + my-brand-new-disk + 30 + http://account.blob.core.windows.net/vhds/newdatadisk.vhd + + + ReadOnly + data-disk + 1 + + + + OSDisk + myvm-backup-20150209 + + Standard_D14 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestWinRMOverHttps(t *testing.T) { + role := NewVMConfiguration("winrmoverhttp", "Standard_D1") + ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") + ConfigureWinRMOverHTTPS(&role, "abcdef") + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + winrmoverhttp + PersistentVMRole + + + WindowsProvisioningConfiguration + WINVM + P2ssw@rd + true + + + + + Https + abcdef + + + + azuser + + + + + + + Standard_D1 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestWinRMOverHttpsWithNoThumbprint(t *testing.T) { + role := NewVMConfiguration("winrmoverhttp", "Standard_D1") + ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") + ConfigureWinRMOverHTTPS(&role, "") + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + winrmoverhttp + PersistentVMRole + + + WindowsProvisioningConfiguration + WINVM + P2ssw@rd + true + + + + + Https + + + + azuser + + + + + + + Standard_D1 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestWinRMOverHttp(t *testing.T) { + role := NewVMConfiguration("winrmoverhttp", "Standard_D1") + ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") + ConfigureWinRMOverHTTP(&role) + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + winrmoverhttp + PersistentVMRole + + + WindowsProvisioningConfiguration + WINVM + P2ssw@rd + true + + + + + Http + + + + azuser + + + + + + + Standard_D1 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestSettingWinRMOverHttpTwice(t *testing.T) { + role := NewVMConfiguration("winrmoverhttp", "Standard_D1") + ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") + ConfigureWinRMOverHTTP(&role) + ConfigureWinRMOverHTTP(&role) + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + winrmoverhttp + PersistentVMRole + + + WindowsProvisioningConfiguration + WINVM + P2ssw@rd + true + + + + + Http + + + + azuser + + + + + + + Standard_D1 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} + +func TestSettingWinRMOverHttpAndHttpsTwice(t *testing.T) { + role := NewVMConfiguration("winrmoverhttp", "Standard_D1") + ConfigureForWindows(&role, "WINVM", "azuser", "P2ssw@rd", true, "") + ConfigureWinRMOverHTTP(&role) + ConfigureWinRMOverHTTPS(&role, "") + ConfigureWinRMOverHTTP(&role) + ConfigureWinRMOverHTTPS(&role, "abcdef") + + bytes, err := xml.MarshalIndent(role, "", " ") + if err != nil { + t.Fatal(err) + } + + expected := ` + winrmoverhttp + PersistentVMRole + + + WindowsProvisioningConfiguration + WINVM + P2ssw@rd + true + + + + + Http + + + Https + abcdef + + + + azuser + + + + + + + Standard_D1 + true +` + + if string(bytes) != expected { + t.Fatalf("Expected marshalled xml to be %q, but got %q", expected, string(bytes)) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh b/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh index 64c2beabe6..92e3d4df86 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh +++ b/vendor/github.com/Azure/azure-sdk-for-go/rungas.sh @@ -1,15 +1,15 @@ -#!/bin/bash -GITBRANCH=`git rev-parse --abbrev-ref HEAD` -#We intend to only run gas on release branches. -if [ "master" != $GITBRANCH ]; then - exit 0 -fi -REALEXITSTATUS=0 -go get -u github.com/HewlettPackard/gas -gas -skip=*/arm/*/models.go -skip=*/management/examples/*.go -skip=*vendor* -skip=*/Gododir/* ./... | tee /dev/stderr -REALEXITSTATUS=$(($REALEXITSTATUS+$?)) -gas -exclude=G101 ./arm/... ./management/examples/... | tee /dev/stderr -REALEXITSTATUS=$(($REALEXITSTATUS+$?)) -gas -exclude=G204 ./Gododir/... | tee /dev/stderr -REALEXITSTATUS=$(($REALEXITSTATUS+$?)) +#!/bin/bash +GITBRANCH=`git rev-parse --abbrev-ref HEAD` +#We intend to only run gas on release branches. +if [ "master" != $GITBRANCH ]; then + exit 0 +fi +REALEXITSTATUS=0 +go get -u github.com/HewlettPackard/gas +gas -skip=*/arm/*/models.go -skip=*/management/examples/*.go -skip=*vendor* -skip=*/Gododir/* ./... | tee /dev/stderr +REALEXITSTATUS=$(($REALEXITSTATUS+$?)) +gas -exclude=G101 ./arm/... ./management/examples/... | tee /dev/stderr +REALEXITSTATUS=$(($REALEXITSTATUS+$?)) +gas -exclude=G204 ./Gododir/... | tee /dev/stderr +REALEXITSTATUS=$(($REALEXITSTATUS+$?)) exit $REALEXITSTATUS \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go index 5756928416..3292cb5569 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go @@ -1,70 +1,70 @@ -package storage - -import ( - "bytes" - "fmt" - "net/http" - "net/url" - "time" -) - -// PutAppendBlob initializes an empty append blob with specified name. An -// append blob must be created using this method before appending blocks. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob -func (b *Blob) PutAppendBlob(options *PutBlobOptions) error { - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeAppend) - headers = mergeHeaders(headers, headersFromStruct(b.Properties)) - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// AppendBlockOptions includes the options for an append block operation -type AppendBlockOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - MaxSize *uint `header:"x-ms-blob-condition-maxsize"` - AppendPosition *uint `header:"x-ms-blob-condition-appendpos"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// AppendBlock appends a block to an append blob. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Append-Block -func (b *Blob) AppendBlock(chunk []byte, options *AppendBlockOptions) error { - params := url.Values{"comp": {"appendblock"}} - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeAppend) - headers["Content-Length"] = fmt.Sprintf("%v", len(chunk)) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} +package storage + +import ( + "bytes" + "fmt" + "net/http" + "net/url" + "time" +) + +// PutAppendBlob initializes an empty append blob with specified name. An +// append blob must be created using this method before appending blocks. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob +func (b *Blob) PutAppendBlob(options *PutBlobOptions) error { + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-blob-type"] = string(BlobTypeAppend) + headers = mergeHeaders(headers, headersFromStruct(b.Properties)) + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// AppendBlockOptions includes the options for an append block operation +type AppendBlockOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + MaxSize *uint `header:"x-ms-blob-condition-maxsize"` + AppendPosition *uint `header:"x-ms-blob-condition-appendpos"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// AppendBlock appends a block to an append blob. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Append-Block +func (b *Blob) AppendBlock(chunk []byte, options *AppendBlockOptions) error { + params := url.Values{"comp": {"appendblock"}} + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-blob-type"] = string(BlobTypeAppend) + headers["Content-Length"] = fmt.Sprintf("%v", len(chunk)) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob_test.go index 747300e85e..23f2a6e08a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob_test.go @@ -1,126 +1,126 @@ -package storage - -import ( - "io/ioutil" - - chk "gopkg.in/check.v1" -) - -type AppendBlobSuite struct{} - -var _ = chk.Suite(&AppendBlobSuite{}) - -func (s *AppendBlobSuite) TestPutAppendBlob(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.PutAppendBlob(nil), chk.IsNil) - - // Verify - err := b.GetProperties(nil) - c.Assert(err, chk.IsNil) - c.Assert(b.Properties.ContentLength, chk.Equals, int64(0)) - c.Assert(b.Properties.BlobType, chk.Equals, BlobTypeAppend) -} - -func (s *AppendBlobSuite) TestPutAppendBlobAppendBlocks(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.PutAppendBlob(nil), chk.IsNil) - - chunk1 := content(1024) - chunk2 := content(512) - - // Append first block - c.Assert(b.AppendBlock(chunk1, nil), chk.IsNil) - - // Verify contents - options := GetBlobRangeOptions{ - Range: &BlobRange{ - Start: 0, - End: uint64(len(chunk1) - 1), - }, - } - out, err := b.GetRange(&options) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, chunk1) - - // Append second block - c.Assert(b.AppendBlock(chunk2, nil), chk.IsNil) - - // Verify contents - options.Range.End = uint64(len(chunk1) + len(chunk2) - 1) - out, err = b.GetRange(&options) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) -} - -func (s *StorageBlobSuite) TestPutAppendBlobSpecialChars(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.PutAppendBlob(nil), chk.IsNil) - - // Verify metadata - err := b.GetProperties(nil) - c.Assert(err, chk.IsNil) - c.Assert(b.Properties.ContentLength, chk.Equals, int64(0)) - c.Assert(b.Properties.BlobType, chk.Equals, BlobTypeAppend) - - chunk1 := content(1024) - chunk2 := content(512) - - // Append first block - c.Assert(b.AppendBlock(chunk1, nil), chk.IsNil) - - // Verify contents - options := GetBlobRangeOptions{ - Range: &BlobRange{ - Start: 0, - End: uint64(len(chunk1) - 1), - }, - } - out, err := b.GetRange(&options) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, chunk1) - - // Append second block - c.Assert(b.AppendBlock(chunk2, nil), chk.IsNil) - - // Verify contents - options.Range.End = uint64(len(chunk1) + len(chunk2) - 1) - out, err = b.GetRange(&options) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) -} +package storage + +import ( + "io/ioutil" + + chk "gopkg.in/check.v1" +) + +type AppendBlobSuite struct{} + +var _ = chk.Suite(&AppendBlobSuite{}) + +func (s *AppendBlobSuite) TestPutAppendBlob(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.PutAppendBlob(nil), chk.IsNil) + + // Verify + err := b.GetProperties(nil) + c.Assert(err, chk.IsNil) + c.Assert(b.Properties.ContentLength, chk.Equals, int64(0)) + c.Assert(b.Properties.BlobType, chk.Equals, BlobTypeAppend) +} + +func (s *AppendBlobSuite) TestPutAppendBlobAppendBlocks(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.PutAppendBlob(nil), chk.IsNil) + + chunk1 := content(1024) + chunk2 := content(512) + + // Append first block + c.Assert(b.AppendBlock(chunk1, nil), chk.IsNil) + + // Verify contents + options := GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 0, + End: uint64(len(chunk1) - 1), + }, + } + out, err := b.GetRange(&options) + c.Assert(err, chk.IsNil) + defer out.Close() + blobContents, err := ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + c.Assert(blobContents, chk.DeepEquals, chunk1) + + // Append second block + c.Assert(b.AppendBlock(chunk2, nil), chk.IsNil) + + // Verify contents + options.Range.End = uint64(len(chunk1) + len(chunk2) - 1) + out, err = b.GetRange(&options) + c.Assert(err, chk.IsNil) + defer out.Close() + blobContents, err = ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) +} + +func (s *StorageBlobSuite) TestPutAppendBlobSpecialChars(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.PutAppendBlob(nil), chk.IsNil) + + // Verify metadata + err := b.GetProperties(nil) + c.Assert(err, chk.IsNil) + c.Assert(b.Properties.ContentLength, chk.Equals, int64(0)) + c.Assert(b.Properties.BlobType, chk.Equals, BlobTypeAppend) + + chunk1 := content(1024) + chunk2 := content(512) + + // Append first block + c.Assert(b.AppendBlock(chunk1, nil), chk.IsNil) + + // Verify contents + options := GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 0, + End: uint64(len(chunk1) - 1), + }, + } + out, err := b.GetRange(&options) + c.Assert(err, chk.IsNil) + defer out.Close() + blobContents, err := ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + c.Assert(blobContents, chk.DeepEquals, chunk1) + + // Append second block + c.Assert(b.AppendBlock(chunk2, nil), chk.IsNil) + + // Verify contents + options.Range.End = uint64(len(chunk1) + len(chunk2) - 1) + out, err = b.GetRange(&options) + c.Assert(err, chk.IsNil) + defer out.Close() + blobContents, err = ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go index 15391b9334..608bf31338 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go @@ -1,227 +1,227 @@ -// Package storage provides clients for Microsoft Azure Storage Services. -package storage - -import ( - "bytes" - "fmt" - "net/url" - "sort" - "strings" -) - -// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services - -type authentication string - -const ( - sharedKey authentication = "sharedKey" - sharedKeyForTable authentication = "sharedKeyTable" - sharedKeyLite authentication = "sharedKeyLite" - sharedKeyLiteForTable authentication = "sharedKeyLiteTable" - - // headers - headerAcceptCharset = "Accept-Charset" - headerAuthorization = "Authorization" - headerContentLength = "Content-Length" - headerDate = "Date" - headerXmsDate = "x-ms-date" - headerXmsVersion = "x-ms-version" - headerContentEncoding = "Content-Encoding" - headerContentLanguage = "Content-Language" - headerContentType = "Content-Type" - headerContentMD5 = "Content-MD5" - headerIfModifiedSince = "If-Modified-Since" - headerIfMatch = "If-Match" - headerIfNoneMatch = "If-None-Match" - headerIfUnmodifiedSince = "If-Unmodified-Since" - headerRange = "Range" - headerDataServiceVersion = "DataServiceVersion" - headerMaxDataServiceVersion = "MaxDataServiceVersion" - headerContentTransferEncoding = "Content-Transfer-Encoding" -) - -func (c *Client) addAuthorizationHeader(verb, url string, headers map[string]string, auth authentication) (map[string]string, error) { - authHeader, err := c.getSharedKey(verb, url, headers, auth) - if err != nil { - return nil, err - } - headers[headerAuthorization] = authHeader - return headers, nil -} - -func (c *Client) getSharedKey(verb, url string, headers map[string]string, auth authentication) (string, error) { - canRes, err := c.buildCanonicalizedResource(url, auth) - if err != nil { - return "", err - } - - canString, err := buildCanonicalizedString(verb, headers, canRes, auth) - if err != nil { - return "", err - } - return c.createAuthorizationHeader(canString, auth), nil -} - -func (c *Client) buildCanonicalizedResource(uri string, auth authentication) (string, error) { - errMsg := "buildCanonicalizedResource error: %s" - u, err := url.Parse(uri) - if err != nil { - return "", fmt.Errorf(errMsg, err.Error()) - } - - cr := bytes.NewBufferString("/") - cr.WriteString(c.getCanonicalizedAccountName()) - - if len(u.Path) > 0 { - // Any portion of the CanonicalizedResource string that is derived from - // the resource's URI should be encoded exactly as it is in the URI. - // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx - cr.WriteString(u.EscapedPath()) - } - - params, err := url.ParseQuery(u.RawQuery) - if err != nil { - return "", fmt.Errorf(errMsg, err.Error()) - } - - // See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277 - if auth == sharedKey { - if len(params) > 0 { - cr.WriteString("\n") - - keys := []string{} - for key := range params { - keys = append(keys, key) - } - sort.Strings(keys) - - completeParams := []string{} - for _, key := range keys { - if len(params[key]) > 1 { - sort.Strings(params[key]) - } - - completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))) - } - cr.WriteString(strings.Join(completeParams, "\n")) - } - } else { - // search for "comp" parameter, if exists then add it to canonicalizedresource - if v, ok := params["comp"]; ok { - cr.WriteString("?comp=" + v[0]) - } - } - - return string(cr.Bytes()), nil -} - -func (c *Client) getCanonicalizedAccountName() string { - // since we may be trying to access a secondary storage account, we need to - // remove the -secondary part of the storage name - return strings.TrimSuffix(c.accountName, "-secondary") -} - -func buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string, auth authentication) (string, error) { - contentLength := headers[headerContentLength] - if contentLength == "0" { - contentLength = "" - } - date := headers[headerDate] - if v, ok := headers[headerXmsDate]; ok { - if auth == sharedKey || auth == sharedKeyLite { - date = "" - } else { - date = v - } - } - var canString string - switch auth { - case sharedKey: - canString = strings.Join([]string{ - verb, - headers[headerContentEncoding], - headers[headerContentLanguage], - contentLength, - headers[headerContentMD5], - headers[headerContentType], - date, - headers[headerIfModifiedSince], - headers[headerIfMatch], - headers[headerIfNoneMatch], - headers[headerIfUnmodifiedSince], - headers[headerRange], - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - case sharedKeyForTable: - canString = strings.Join([]string{ - verb, - headers[headerContentMD5], - headers[headerContentType], - date, - canonicalizedResource, - }, "\n") - case sharedKeyLite: - canString = strings.Join([]string{ - verb, - headers[headerContentMD5], - headers[headerContentType], - date, - buildCanonicalizedHeader(headers), - canonicalizedResource, - }, "\n") - case sharedKeyLiteForTable: - canString = strings.Join([]string{ - date, - canonicalizedResource, - }, "\n") - default: - return "", fmt.Errorf("%s authentication is not supported yet", auth) - } - return canString, nil -} - -func buildCanonicalizedHeader(headers map[string]string) string { - cm := make(map[string]string) - - for k, v := range headers { - headerName := strings.TrimSpace(strings.ToLower(k)) - if strings.HasPrefix(headerName, "x-ms-") { - cm[headerName] = v - } - } - - if len(cm) == 0 { - return "" - } - - keys := []string{} - for key := range cm { - keys = append(keys, key) - } - - sort.Strings(keys) - - ch := bytes.NewBufferString("") - - for _, key := range keys { - ch.WriteString(key) - ch.WriteRune(':') - ch.WriteString(cm[key]) - ch.WriteRune('\n') - } - - return strings.TrimSuffix(string(ch.Bytes()), "\n") -} - -func (c *Client) createAuthorizationHeader(canonicalizedString string, auth authentication) string { - signature := c.computeHmac256(canonicalizedString) - var key string - switch auth { - case sharedKey, sharedKeyForTable: - key = "SharedKey" - case sharedKeyLite, sharedKeyLiteForTable: - key = "SharedKeyLite" - } - return fmt.Sprintf("%s %s:%s", key, c.getCanonicalizedAccountName(), signature) -} +// Package storage provides clients for Microsoft Azure Storage Services. +package storage + +import ( + "bytes" + "fmt" + "net/url" + "sort" + "strings" +) + +// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services + +type authentication string + +const ( + sharedKey authentication = "sharedKey" + sharedKeyForTable authentication = "sharedKeyTable" + sharedKeyLite authentication = "sharedKeyLite" + sharedKeyLiteForTable authentication = "sharedKeyLiteTable" + + // headers + headerAcceptCharset = "Accept-Charset" + headerAuthorization = "Authorization" + headerContentLength = "Content-Length" + headerDate = "Date" + headerXmsDate = "x-ms-date" + headerXmsVersion = "x-ms-version" + headerContentEncoding = "Content-Encoding" + headerContentLanguage = "Content-Language" + headerContentType = "Content-Type" + headerContentMD5 = "Content-MD5" + headerIfModifiedSince = "If-Modified-Since" + headerIfMatch = "If-Match" + headerIfNoneMatch = "If-None-Match" + headerIfUnmodifiedSince = "If-Unmodified-Since" + headerRange = "Range" + headerDataServiceVersion = "DataServiceVersion" + headerMaxDataServiceVersion = "MaxDataServiceVersion" + headerContentTransferEncoding = "Content-Transfer-Encoding" +) + +func (c *Client) addAuthorizationHeader(verb, url string, headers map[string]string, auth authentication) (map[string]string, error) { + authHeader, err := c.getSharedKey(verb, url, headers, auth) + if err != nil { + return nil, err + } + headers[headerAuthorization] = authHeader + return headers, nil +} + +func (c *Client) getSharedKey(verb, url string, headers map[string]string, auth authentication) (string, error) { + canRes, err := c.buildCanonicalizedResource(url, auth) + if err != nil { + return "", err + } + + canString, err := buildCanonicalizedString(verb, headers, canRes, auth) + if err != nil { + return "", err + } + return c.createAuthorizationHeader(canString, auth), nil +} + +func (c *Client) buildCanonicalizedResource(uri string, auth authentication) (string, error) { + errMsg := "buildCanonicalizedResource error: %s" + u, err := url.Parse(uri) + if err != nil { + return "", fmt.Errorf(errMsg, err.Error()) + } + + cr := bytes.NewBufferString("/") + cr.WriteString(c.getCanonicalizedAccountName()) + + if len(u.Path) > 0 { + // Any portion of the CanonicalizedResource string that is derived from + // the resource's URI should be encoded exactly as it is in the URI. + // -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx + cr.WriteString(u.EscapedPath()) + } + + params, err := url.ParseQuery(u.RawQuery) + if err != nil { + return "", fmt.Errorf(errMsg, err.Error()) + } + + // See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277 + if auth == sharedKey { + if len(params) > 0 { + cr.WriteString("\n") + + keys := []string{} + for key := range params { + keys = append(keys, key) + } + sort.Strings(keys) + + completeParams := []string{} + for _, key := range keys { + if len(params[key]) > 1 { + sort.Strings(params[key]) + } + + completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))) + } + cr.WriteString(strings.Join(completeParams, "\n")) + } + } else { + // search for "comp" parameter, if exists then add it to canonicalizedresource + if v, ok := params["comp"]; ok { + cr.WriteString("?comp=" + v[0]) + } + } + + return string(cr.Bytes()), nil +} + +func (c *Client) getCanonicalizedAccountName() string { + // since we may be trying to access a secondary storage account, we need to + // remove the -secondary part of the storage name + return strings.TrimSuffix(c.accountName, "-secondary") +} + +func buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string, auth authentication) (string, error) { + contentLength := headers[headerContentLength] + if contentLength == "0" { + contentLength = "" + } + date := headers[headerDate] + if v, ok := headers[headerXmsDate]; ok { + if auth == sharedKey || auth == sharedKeyLite { + date = "" + } else { + date = v + } + } + var canString string + switch auth { + case sharedKey: + canString = strings.Join([]string{ + verb, + headers[headerContentEncoding], + headers[headerContentLanguage], + contentLength, + headers[headerContentMD5], + headers[headerContentType], + date, + headers[headerIfModifiedSince], + headers[headerIfMatch], + headers[headerIfNoneMatch], + headers[headerIfUnmodifiedSince], + headers[headerRange], + buildCanonicalizedHeader(headers), + canonicalizedResource, + }, "\n") + case sharedKeyForTable: + canString = strings.Join([]string{ + verb, + headers[headerContentMD5], + headers[headerContentType], + date, + canonicalizedResource, + }, "\n") + case sharedKeyLite: + canString = strings.Join([]string{ + verb, + headers[headerContentMD5], + headers[headerContentType], + date, + buildCanonicalizedHeader(headers), + canonicalizedResource, + }, "\n") + case sharedKeyLiteForTable: + canString = strings.Join([]string{ + date, + canonicalizedResource, + }, "\n") + default: + return "", fmt.Errorf("%s authentication is not supported yet", auth) + } + return canString, nil +} + +func buildCanonicalizedHeader(headers map[string]string) string { + cm := make(map[string]string) + + for k, v := range headers { + headerName := strings.TrimSpace(strings.ToLower(k)) + if strings.HasPrefix(headerName, "x-ms-") { + cm[headerName] = v + } + } + + if len(cm) == 0 { + return "" + } + + keys := []string{} + for key := range cm { + keys = append(keys, key) + } + + sort.Strings(keys) + + ch := bytes.NewBufferString("") + + for _, key := range keys { + ch.WriteString(key) + ch.WriteRune(':') + ch.WriteString(cm[key]) + ch.WriteRune('\n') + } + + return strings.TrimSuffix(string(ch.Bytes()), "\n") +} + +func (c *Client) createAuthorizationHeader(canonicalizedString string, auth authentication) string { + signature := c.computeHmac256(canonicalizedString) + var key string + switch auth { + case sharedKey, sharedKeyForTable: + key = "SharedKey" + case sharedKeyLite, sharedKeyLiteForTable: + key = "SharedKeyLite" + } + return fmt.Sprintf("%s %s:%s", key, c.getCanonicalizedAccountName(), signature) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization_test.go index 1411fae05a..420868acfb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization_test.go @@ -1,230 +1,230 @@ -package storage - -import ( - "encoding/base64" - "net/http" - - chk "gopkg.in/check.v1" -) - -type AuthorizationSuite struct{} - -var _ = chk.Suite(&AuthorizationSuite{}) - -func (a *AuthorizationSuite) Test_addAuthorizationHeader(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) - c.Assert(err, chk.IsNil) - cli.UseSharedKeyLite = true - tableCli := cli.GetTableService() - - headers := map[string]string{ - "Accept-Charset": "UTF-8", - headerContentType: "application/json", - headerXmsDate: "Wed, 23 Sep 2015 16:40:05 GMT", - headerContentLength: "0", - headerXmsVersion: "2015-02-21", - "Accept": "application/json;odata=nometadata", - } - url := "https://golangrocksonazure.table.core.windows.net/tquery()" - headers, err = tableCli.client.addAuthorizationHeader("", url, headers, tableCli.auth) - c.Assert(err, chk.IsNil) - - c.Assert(headers[headerAuthorization], chk.Equals, "SharedKeyLite golangrocksonazure:NusXSFXAvHqr6EQNXnZZ50CvU1sX0iP/FFDHehnixLc=") -} - -func (a *AuthorizationSuite) Test_getSharedKey(c *chk.C) { - // Shared Key Lite for Tables - cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) - c.Assert(err, chk.IsNil) - - headers := map[string]string{ - "Accept-Charset": "UTF-8", - headerContentType: "application/json", - headerXmsDate: "Wed, 23 Sep 2015 16:40:05 GMT", - headerContentLength: "0", - headerXmsVersion: "2015-02-21", - "Accept": "application/json;odata=nometadata", - } - url := "https://golangrocksonazure.table.core.windows.net/tquery()" - - key, err := cli.getSharedKey("", url, headers, sharedKeyLiteForTable) - c.Assert(err, chk.IsNil) - c.Assert(key, chk.Equals, "SharedKeyLite golangrocksonazure:NusXSFXAvHqr6EQNXnZZ50CvU1sX0iP/FFDHehnixLc=") -} - -func (a *AuthorizationSuite) Test_buildCanonicalizedResource(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) - c.Assert(err, chk.IsNil) - - type test struct { - url string - auth authentication - expected string - } - tests := []test{ - // Shared Key - {"https://golangrocksonazure.blob.core.windows.net/path?a=b&c=d", sharedKey, "/golangrocksonazure/path\na:b\nc:d"}, - {"https://golangrocksonazure.blob.core.windows.net/?comp=list", sharedKey, "/golangrocksonazure/\ncomp:list"}, - {"https://golangrocksonazure.blob.core.windows.net/cnt/blob", sharedKey, "/golangrocksonazure/cnt/blob"}, - {"https://golangrocksonazure.blob.core.windows.net/cnt/bl ob", sharedKey, "/golangrocksonazure/cnt/bl%20ob"}, - {"https://golangrocksonazure.blob.core.windows.net/c nt/blob", sharedKey, "/golangrocksonazure/c%20nt/blob"}, - {"https://golangrocksonazure.blob.core.windows.net/cnt/blob%3F%23%5B%5D%21$&%27%28%29%2A blob", sharedKey, "/golangrocksonazure/cnt/blob%3F%23%5B%5D%21$&%27%28%29%2A%20blob"}, - {"https://golangrocksonazure.blob.core.windows.net/cnt/blob-._~:,@;+=blob", sharedKey, "/golangrocksonazure/cnt/blob-._~:,@;+=blob"}, - {"https://golangrocksonazure.blob.core.windows.net/c nt/blob-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=/blob", sharedKey, "/golangrocksonazure/c%20nt/blob-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=/blob"}, - // Shared Key Lite for Table - {"https://golangrocksonazure.table.core.windows.net/mytable", sharedKeyLiteForTable, "/golangrocksonazure/mytable"}, - {"https://golangrocksonazure.table.core.windows.net/mytable?comp=acl", sharedKeyLiteForTable, "/golangrocksonazure/mytable?comp=acl"}, - {"https://golangrocksonazure.table.core.windows.net/mytable?comp=acl&timeout=10", sharedKeyForTable, "/golangrocksonazure/mytable?comp=acl"}, - {"https://golangrocksonazure.table.core.windows.net/mytable(PartitionKey='pkey',RowKey='rowkey%3D')", sharedKeyForTable, "/golangrocksonazure/mytable(PartitionKey='pkey',RowKey='rowkey%3D')"}, - } - - for _, t := range tests { - out, err := cli.buildCanonicalizedResource(t.url, t.auth) - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, t.expected) - } -} - -func (a *AuthorizationSuite) Test_buildCanonicalizedString(c *chk.C) { - var tests = []struct { - verb string - headers map[string]string - canonicalizedResource string - auth authentication - out string - }{ - { - // Shared Key - verb: http.MethodGet, - headers: map[string]string{ - headerXmsDate: "Sun, 11 Oct 2009 21:49:13 GMT", - headerXmsVersion: "2009-09-19", - }, - canonicalizedResource: "/myaccount/ mycontainer\ncomp:metadata\nrestype:container\ntimeout:20", - auth: sharedKey, - out: "GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 11 Oct 2009 21:49:13 GMT\nx-ms-version:2009-09-19\n/myaccount/ mycontainer\ncomp:metadata\nrestype:container\ntimeout:20", - }, - { - // Shared Key for Tables - verb: http.MethodPut, - headers: map[string]string{ - headerContentType: "text/plain; charset=UTF-8", - headerDate: "Sun, 11 Oct 2009 19:52:39 GMT", - }, - canonicalizedResource: "/testaccount1/Tables", - auth: sharedKeyForTable, - out: "PUT\n\ntext/plain; charset=UTF-8\nSun, 11 Oct 2009 19:52:39 GMT\n/testaccount1/Tables", - }, - { - // Shared Key Lite - verb: http.MethodPut, - headers: map[string]string{ - headerContentType: "text/plain; charset=UTF-8", - headerXmsDate: "Sun, 20 Sep 2009 20:36:40 GMT", - "x-ms-meta-m1": "v1", - "x-ms-meta-m2": "v2", - }, - canonicalizedResource: "/testaccount1/mycontainer/hello.txt", - auth: sharedKeyLite, - out: "PUT\n\ntext/plain; charset=UTF-8\n\nx-ms-date:Sun, 20 Sep 2009 20:36:40 GMT\nx-ms-meta-m1:v1\nx-ms-meta-m2:v2\n/testaccount1/mycontainer/hello.txt", - }, - { - // Shared Key Lite for Tables - verb: "", - headers: map[string]string{ - headerDate: "Sun, 11 Oct 2009 19:52:39 GMT", - }, - canonicalizedResource: "/testaccount1/Tables", - auth: sharedKeyLiteForTable, - out: "Sun, 11 Oct 2009 19:52:39 GMT\n/testaccount1/Tables", - }, - } - - for _, t := range tests { - canonicalizedString, err := buildCanonicalizedString(t.verb, t.headers, t.canonicalizedResource, t.auth) - c.Assert(err, chk.IsNil) - c.Assert(canonicalizedString, chk.Equals, t.out) - } -} - -func (a *AuthorizationSuite) Test_buildCanonicalizedHeader(c *chk.C) { - type test struct { - headers map[string]string - expected string - } - tests := []test{ - {map[string]string{}, - ""}, - {map[string]string{ - "x-ms-lol": "rofl"}, - "x-ms-lol:rofl"}, - {map[string]string{ - "lol:": "rofl"}, - ""}, - {map[string]string{ - "lol:": "rofl", - "x-ms-lol": "rofl"}, - "x-ms-lol:rofl"}, - {map[string]string{ - "x-ms-version": "9999-99-99", - "x-ms-blob-type": "BlockBlob"}, - "x-ms-blob-type:BlockBlob\nx-ms-version:9999-99-99"}} - - for _, i := range tests { - c.Assert(buildCanonicalizedHeader(i.headers), chk.Equals, i.expected) - } -} - -func (a *AuthorizationSuite) Test_createAuthorizationHeader(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, base64.StdEncoding.EncodeToString([]byte("bar"))) - c.Assert(err, chk.IsNil) - - canonicalizedString := `foobarzoo` - - c.Assert(cli.createAuthorizationHeader(canonicalizedString, sharedKey), - chk.Equals, `SharedKey golangrocksonazure:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=`) - c.Assert(cli.createAuthorizationHeader(canonicalizedString, sharedKeyLite), - chk.Equals, `SharedKeyLite golangrocksonazure:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=`) -} - -func (a *AuthorizationSuite) Test_allSharedKeys(c *chk.C) { - cli := getBasicClient(c) - rec := cli.appendRecorder(c) - defer rec.Stop() - - blobCli := cli.GetBlobService() - tableCli := cli.GetTableService() - - cnt1 := blobCli.GetContainerReference(containerName(c, "1")) - cnt2 := blobCli.GetContainerReference(containerName(c, "2")) - - // Shared Key - c.Assert(blobCli.auth, chk.Equals, sharedKey) - c.Assert(cnt1.Create(nil), chk.IsNil) - c.Assert(cnt1.Delete(nil), chk.IsNil) - - // Shared Key for Tables - c.Assert(tableCli.auth, chk.Equals, sharedKeyForTable) - table1 := tableCli.GetTableReference(tableName(c, "1")) - c.Assert(table1.tsc.auth, chk.Equals, sharedKeyForTable) - c.Assert(table1.Create(30, EmptyPayload, nil), chk.IsNil) - c.Assert(table1.Delete(30, nil), chk.IsNil) - - // Change to Lite - cli.UseSharedKeyLite = true - blobCli = cli.GetBlobService() - tableCli = cli.GetTableService() - - // Shared Key Lite - c.Assert(blobCli.auth, chk.Equals, sharedKeyLite) - c.Assert(cnt2.Create(nil), chk.IsNil) - c.Assert(cnt2.Delete(nil), chk.IsNil) - - // Shared Key Lite for Tables - tableCli = cli.GetTableService() - c.Assert(tableCli.auth, chk.Equals, sharedKeyLiteForTable) - table2 := tableCli.GetTableReference(tableName(c, "2")) - c.Assert(table2.tsc.auth, chk.Equals, sharedKeyLiteForTable) - c.Assert(table2.Create(30, EmptyPayload, nil), chk.IsNil) - c.Assert(table2.Delete(30, nil), chk.IsNil) -} +package storage + +import ( + "encoding/base64" + "net/http" + + chk "gopkg.in/check.v1" +) + +type AuthorizationSuite struct{} + +var _ = chk.Suite(&AuthorizationSuite{}) + +func (a *AuthorizationSuite) Test_addAuthorizationHeader(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) + c.Assert(err, chk.IsNil) + cli.UseSharedKeyLite = true + tableCli := cli.GetTableService() + + headers := map[string]string{ + "Accept-Charset": "UTF-8", + headerContentType: "application/json", + headerXmsDate: "Wed, 23 Sep 2015 16:40:05 GMT", + headerContentLength: "0", + headerXmsVersion: "2015-02-21", + "Accept": "application/json;odata=nometadata", + } + url := "https://golangrocksonazure.table.core.windows.net/tquery()" + headers, err = tableCli.client.addAuthorizationHeader("", url, headers, tableCli.auth) + c.Assert(err, chk.IsNil) + + c.Assert(headers[headerAuthorization], chk.Equals, "SharedKeyLite golangrocksonazure:NusXSFXAvHqr6EQNXnZZ50CvU1sX0iP/FFDHehnixLc=") +} + +func (a *AuthorizationSuite) Test_getSharedKey(c *chk.C) { + // Shared Key Lite for Tables + cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) + c.Assert(err, chk.IsNil) + + headers := map[string]string{ + "Accept-Charset": "UTF-8", + headerContentType: "application/json", + headerXmsDate: "Wed, 23 Sep 2015 16:40:05 GMT", + headerContentLength: "0", + headerXmsVersion: "2015-02-21", + "Accept": "application/json;odata=nometadata", + } + url := "https://golangrocksonazure.table.core.windows.net/tquery()" + + key, err := cli.getSharedKey("", url, headers, sharedKeyLiteForTable) + c.Assert(err, chk.IsNil) + c.Assert(key, chk.Equals, "SharedKeyLite golangrocksonazure:NusXSFXAvHqr6EQNXnZZ50CvU1sX0iP/FFDHehnixLc=") +} + +func (a *AuthorizationSuite) Test_buildCanonicalizedResource(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) + c.Assert(err, chk.IsNil) + + type test struct { + url string + auth authentication + expected string + } + tests := []test{ + // Shared Key + {"https://golangrocksonazure.blob.core.windows.net/path?a=b&c=d", sharedKey, "/golangrocksonazure/path\na:b\nc:d"}, + {"https://golangrocksonazure.blob.core.windows.net/?comp=list", sharedKey, "/golangrocksonazure/\ncomp:list"}, + {"https://golangrocksonazure.blob.core.windows.net/cnt/blob", sharedKey, "/golangrocksonazure/cnt/blob"}, + {"https://golangrocksonazure.blob.core.windows.net/cnt/bl ob", sharedKey, "/golangrocksonazure/cnt/bl%20ob"}, + {"https://golangrocksonazure.blob.core.windows.net/c nt/blob", sharedKey, "/golangrocksonazure/c%20nt/blob"}, + {"https://golangrocksonazure.blob.core.windows.net/cnt/blob%3F%23%5B%5D%21$&%27%28%29%2A blob", sharedKey, "/golangrocksonazure/cnt/blob%3F%23%5B%5D%21$&%27%28%29%2A%20blob"}, + {"https://golangrocksonazure.blob.core.windows.net/cnt/blob-._~:,@;+=blob", sharedKey, "/golangrocksonazure/cnt/blob-._~:,@;+=blob"}, + {"https://golangrocksonazure.blob.core.windows.net/c nt/blob-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=/blob", sharedKey, "/golangrocksonazure/c%20nt/blob-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=/blob"}, + // Shared Key Lite for Table + {"https://golangrocksonazure.table.core.windows.net/mytable", sharedKeyLiteForTable, "/golangrocksonazure/mytable"}, + {"https://golangrocksonazure.table.core.windows.net/mytable?comp=acl", sharedKeyLiteForTable, "/golangrocksonazure/mytable?comp=acl"}, + {"https://golangrocksonazure.table.core.windows.net/mytable?comp=acl&timeout=10", sharedKeyForTable, "/golangrocksonazure/mytable?comp=acl"}, + {"https://golangrocksonazure.table.core.windows.net/mytable(PartitionKey='pkey',RowKey='rowkey%3D')", sharedKeyForTable, "/golangrocksonazure/mytable(PartitionKey='pkey',RowKey='rowkey%3D')"}, + } + + for _, t := range tests { + out, err := cli.buildCanonicalizedResource(t.url, t.auth) + c.Assert(err, chk.IsNil) + c.Assert(out, chk.Equals, t.expected) + } +} + +func (a *AuthorizationSuite) Test_buildCanonicalizedString(c *chk.C) { + var tests = []struct { + verb string + headers map[string]string + canonicalizedResource string + auth authentication + out string + }{ + { + // Shared Key + verb: http.MethodGet, + headers: map[string]string{ + headerXmsDate: "Sun, 11 Oct 2009 21:49:13 GMT", + headerXmsVersion: "2009-09-19", + }, + canonicalizedResource: "/myaccount/ mycontainer\ncomp:metadata\nrestype:container\ntimeout:20", + auth: sharedKey, + out: "GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 11 Oct 2009 21:49:13 GMT\nx-ms-version:2009-09-19\n/myaccount/ mycontainer\ncomp:metadata\nrestype:container\ntimeout:20", + }, + { + // Shared Key for Tables + verb: http.MethodPut, + headers: map[string]string{ + headerContentType: "text/plain; charset=UTF-8", + headerDate: "Sun, 11 Oct 2009 19:52:39 GMT", + }, + canonicalizedResource: "/testaccount1/Tables", + auth: sharedKeyForTable, + out: "PUT\n\ntext/plain; charset=UTF-8\nSun, 11 Oct 2009 19:52:39 GMT\n/testaccount1/Tables", + }, + { + // Shared Key Lite + verb: http.MethodPut, + headers: map[string]string{ + headerContentType: "text/plain; charset=UTF-8", + headerXmsDate: "Sun, 20 Sep 2009 20:36:40 GMT", + "x-ms-meta-m1": "v1", + "x-ms-meta-m2": "v2", + }, + canonicalizedResource: "/testaccount1/mycontainer/hello.txt", + auth: sharedKeyLite, + out: "PUT\n\ntext/plain; charset=UTF-8\n\nx-ms-date:Sun, 20 Sep 2009 20:36:40 GMT\nx-ms-meta-m1:v1\nx-ms-meta-m2:v2\n/testaccount1/mycontainer/hello.txt", + }, + { + // Shared Key Lite for Tables + verb: "", + headers: map[string]string{ + headerDate: "Sun, 11 Oct 2009 19:52:39 GMT", + }, + canonicalizedResource: "/testaccount1/Tables", + auth: sharedKeyLiteForTable, + out: "Sun, 11 Oct 2009 19:52:39 GMT\n/testaccount1/Tables", + }, + } + + for _, t := range tests { + canonicalizedString, err := buildCanonicalizedString(t.verb, t.headers, t.canonicalizedResource, t.auth) + c.Assert(err, chk.IsNil) + c.Assert(canonicalizedString, chk.Equals, t.out) + } +} + +func (a *AuthorizationSuite) Test_buildCanonicalizedHeader(c *chk.C) { + type test struct { + headers map[string]string + expected string + } + tests := []test{ + {map[string]string{}, + ""}, + {map[string]string{ + "x-ms-lol": "rofl"}, + "x-ms-lol:rofl"}, + {map[string]string{ + "lol:": "rofl"}, + ""}, + {map[string]string{ + "lol:": "rofl", + "x-ms-lol": "rofl"}, + "x-ms-lol:rofl"}, + {map[string]string{ + "x-ms-version": "9999-99-99", + "x-ms-blob-type": "BlockBlob"}, + "x-ms-blob-type:BlockBlob\nx-ms-version:9999-99-99"}} + + for _, i := range tests { + c.Assert(buildCanonicalizedHeader(i.headers), chk.Equals, i.expected) + } +} + +func (a *AuthorizationSuite) Test_createAuthorizationHeader(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, base64.StdEncoding.EncodeToString([]byte("bar"))) + c.Assert(err, chk.IsNil) + + canonicalizedString := `foobarzoo` + + c.Assert(cli.createAuthorizationHeader(canonicalizedString, sharedKey), + chk.Equals, `SharedKey golangrocksonazure:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=`) + c.Assert(cli.createAuthorizationHeader(canonicalizedString, sharedKeyLite), + chk.Equals, `SharedKeyLite golangrocksonazure:h5U0ATVX6SpbFX1H6GNuxIMeXXCILLoIvhflPtuQZ30=`) +} + +func (a *AuthorizationSuite) Test_allSharedKeys(c *chk.C) { + cli := getBasicClient(c) + rec := cli.appendRecorder(c) + defer rec.Stop() + + blobCli := cli.GetBlobService() + tableCli := cli.GetTableService() + + cnt1 := blobCli.GetContainerReference(containerName(c, "1")) + cnt2 := blobCli.GetContainerReference(containerName(c, "2")) + + // Shared Key + c.Assert(blobCli.auth, chk.Equals, sharedKey) + c.Assert(cnt1.Create(nil), chk.IsNil) + c.Assert(cnt1.Delete(nil), chk.IsNil) + + // Shared Key for Tables + c.Assert(tableCli.auth, chk.Equals, sharedKeyForTable) + table1 := tableCli.GetTableReference(tableName(c, "1")) + c.Assert(table1.tsc.auth, chk.Equals, sharedKeyForTable) + c.Assert(table1.Create(30, EmptyPayload, nil), chk.IsNil) + c.Assert(table1.Delete(30, nil), chk.IsNil) + + // Change to Lite + cli.UseSharedKeyLite = true + blobCli = cli.GetBlobService() + tableCli = cli.GetTableService() + + // Shared Key Lite + c.Assert(blobCli.auth, chk.Equals, sharedKeyLite) + c.Assert(cnt2.Create(nil), chk.IsNil) + c.Assert(cnt2.Delete(nil), chk.IsNil) + + // Shared Key Lite for Tables + tableCli = cli.GetTableService() + c.Assert(tableCli.auth, chk.Equals, sharedKeyLiteForTable) + table2 := tableCli.GetTableReference(tableName(c, "2")) + c.Assert(table2.tsc.auth, chk.Equals, sharedKeyLiteForTable) + c.Assert(table2.Create(30, EmptyPayload, nil), chk.IsNil) + c.Assert(table2.Delete(30, nil), chk.IsNil) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go index d497e66667..dd9eb386cb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go @@ -1,617 +1,617 @@ -package storage - -import ( - "encoding/xml" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "strings" - "time" -) - -// A Blob is an entry in BlobListResponse. -type Blob struct { - Container *Container - Name string `xml:"Name"` - Snapshot time.Time `xml:"Snapshot"` - Properties BlobProperties `xml:"Properties"` - Metadata BlobMetadata `xml:"Metadata"` -} - -// PutBlobOptions includes the options any put blob operation -// (page, block, append) -type PutBlobOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - Origin string `header:"Origin"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// BlobMetadata is a set of custom name/value pairs. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179404.aspx -type BlobMetadata map[string]string - -type blobMetadataEntries struct { - Entries []blobMetadataEntry `xml:",any"` -} -type blobMetadataEntry struct { - XMLName xml.Name - Value string `xml:",chardata"` -} - -// UnmarshalXML converts the xml:Metadata into Metadata map -func (bm *BlobMetadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var entries blobMetadataEntries - if err := d.DecodeElement(&entries, &start); err != nil { - return err - } - for _, entry := range entries.Entries { - if *bm == nil { - *bm = make(BlobMetadata) - } - (*bm)[strings.ToLower(entry.XMLName.Local)] = entry.Value - } - return nil -} - -// MarshalXML implements the xml.Marshaler interface. It encodes -// metadata name/value pairs as they would appear in an Azure -// ListBlobs response. -func (bm BlobMetadata) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { - entries := make([]blobMetadataEntry, 0, len(bm)) - for k, v := range bm { - entries = append(entries, blobMetadataEntry{ - XMLName: xml.Name{Local: http.CanonicalHeaderKey(k)}, - Value: v, - }) - } - return enc.EncodeElement(blobMetadataEntries{ - Entries: entries, - }, start) -} - -// BlobProperties contains various properties of a blob -// returned in various endpoints like ListBlobs or GetBlobProperties. -type BlobProperties struct { - LastModified TimeRFC1123 `xml:"Last-Modified"` - Etag string `xml:"Etag"` - ContentMD5 string `xml:"Content-MD5" header:"x-ms-blob-content-md5"` - ContentLength int64 `xml:"Content-Length"` - ContentType string `xml:"Content-Type" header:"x-ms-blob-content-type"` - ContentEncoding string `xml:"Content-Encoding" header:"x-ms-blob-content-encoding"` - CacheControl string `xml:"Cache-Control" header:"x-ms-blob-cache-control"` - ContentLanguage string `xml:"Cache-Language" header:"x-ms-blob-content-language"` - ContentDisposition string `xml:"Content-Disposition" header:"x-ms-blob-content-disposition"` - BlobType BlobType `xml:"x-ms-blob-blob-type"` - SequenceNumber int64 `xml:"x-ms-blob-sequence-number"` - CopyID string `xml:"CopyId"` - CopyStatus string `xml:"CopyStatus"` - CopySource string `xml:"CopySource"` - CopyProgress string `xml:"CopyProgress"` - CopyCompletionTime TimeRFC1123 `xml:"CopyCompletionTime"` - CopyStatusDescription string `xml:"CopyStatusDescription"` - LeaseStatus string `xml:"LeaseStatus"` - LeaseState string `xml:"LeaseState"` - LeaseDuration string `xml:"LeaseDuration"` - ServerEncrypted bool `xml:"ServerEncrypted"` - IncrementalCopy bool `xml:"IncrementalCopy"` -} - -// BlobType defines the type of the Azure Blob. -type BlobType string - -// Types of page blobs -const ( - BlobTypeBlock BlobType = "BlockBlob" - BlobTypePage BlobType = "PageBlob" - BlobTypeAppend BlobType = "AppendBlob" -) - -func (b *Blob) buildPath() string { - return b.Container.buildPath() + "/" + b.Name -} - -// Exists returns true if a blob with given name exists on the specified -// container of the storage account. -func (b *Blob) Exists() (bool, error) { - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), nil) - headers := b.Container.bsc.client.getStandardHeaders() - resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, nil - } - } - return false, err -} - -// GetURL gets the canonical URL to the blob with the specified name in the -// specified container. If name is not specified, the canonical URL for the entire -// container is obtained. -// This method does not create a publicly accessible URL if the blob or container -// is private and this method does not check if the blob exists. -func (b *Blob) GetURL() string { - container := b.Container.Name - if container == "" { - container = "$root" - } - return b.Container.bsc.client.getEndpoint(blobServiceName, pathForResource(container, b.Name), nil) -} - -// GetBlobRangeOptions includes the options for a get blob range operation -type GetBlobRangeOptions struct { - Range *BlobRange - GetRangeContentMD5 bool - *GetBlobOptions -} - -// GetBlobOptions includes the options for a get blob operation -type GetBlobOptions struct { - Timeout uint - Snapshot *time.Time - LeaseID string `header:"x-ms-lease-id"` - Origin string `header:"Origin"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// BlobRange represents the bytes range to be get -type BlobRange struct { - Start uint64 - End uint64 -} - -func (br BlobRange) String() string { - return fmt.Sprintf("bytes=%d-%d", br.Start, br.End) -} - -// Get returns a stream to read the blob. Caller must call both Read and Close() -// to correctly close the underlying connection. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob -func (b *Blob) Get(options *GetBlobOptions) (io.ReadCloser, error) { - rangeOptions := GetBlobRangeOptions{ - GetBlobOptions: options, - } - resp, err := b.getRange(&rangeOptions) - if err != nil { - return nil, err - } - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - if err := b.writePropoerties(resp.headers); err != nil { - return resp.body, err - } - return resp.body, nil -} - -// GetRange reads the specified range of a blob to a stream. The bytesRange -// string must be in a format like "0-", "10-100" as defined in HTTP 1.1 spec. -// Caller must call both Read and Close()// to correctly close the underlying -// connection. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob -func (b *Blob) GetRange(options *GetBlobRangeOptions) (io.ReadCloser, error) { - resp, err := b.getRange(options) - if err != nil { - return nil, err - } - - if err := checkRespCode(resp.statusCode, []int{http.StatusPartialContent}); err != nil { - return nil, err - } - if err := b.writePropoerties(resp.headers); err != nil { - return resp.body, err - } - return resp.body, nil -} - -func (b *Blob) getRange(options *GetBlobRangeOptions) (*storageResponse, error) { - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - - if options != nil { - if options.Range != nil { - headers["Range"] = options.Range.String() - headers["x-ms-range-get-content-md5"] = fmt.Sprintf("%v", options.GetRangeContentMD5) - } - if options.GetBlobOptions != nil { - headers = mergeHeaders(headers, headersFromStruct(*options.GetBlobOptions)) - params = addTimeout(params, options.Timeout) - params = addSnapshot(params, options.Snapshot) - } - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return nil, err - } - return resp, err -} - -// SnapshotOptions includes the options for a snapshot blob operation -type SnapshotOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// CreateSnapshot creates a snapshot for a blob -// See https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx -func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time.Time, err error) { - params := url.Values{"comp": {"snapshot"}} - headers := b.Container.bsc.client.getStandardHeaders() - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil || resp == nil { - return nil, err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { - return nil, err - } - - snapshotResponse := resp.headers.Get(http.CanonicalHeaderKey("x-ms-snapshot")) - if snapshotResponse != "" { - snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse) - if err != nil { - return nil, err - } - return &snapshotTimestamp, nil - } - - return nil, errors.New("Snapshot not created") -} - -// GetBlobPropertiesOptions includes the options for a get blob properties operation -type GetBlobPropertiesOptions struct { - Timeout uint - Snapshot *time.Time - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// GetProperties provides various information about the specified blob. -// See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx -func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error { - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - params = addSnapshot(params, options.Snapshot) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return err - } - return b.writePropoerties(resp.headers) -} - -func (b *Blob) writePropoerties(h http.Header) error { - var err error - - var contentLength int64 - contentLengthStr := h.Get("Content-Length") - if contentLengthStr != "" { - contentLength, err = strconv.ParseInt(contentLengthStr, 0, 64) - if err != nil { - return err - } - } - - var sequenceNum int64 - sequenceNumStr := h.Get("x-ms-blob-sequence-number") - if sequenceNumStr != "" { - sequenceNum, err = strconv.ParseInt(sequenceNumStr, 0, 64) - if err != nil { - return err - } - } - - lastModified, err := getTimeFromHeaders(h, "Last-Modified") - if err != nil { - return err - } - - copyCompletionTime, err := getTimeFromHeaders(h, "x-ms-copy-completion-time") - if err != nil { - return err - } - - b.Properties = BlobProperties{ - LastModified: TimeRFC1123(*lastModified), - Etag: h.Get("Etag"), - ContentMD5: h.Get("Content-MD5"), - ContentLength: contentLength, - ContentEncoding: h.Get("Content-Encoding"), - ContentType: h.Get("Content-Type"), - ContentDisposition: h.Get("Content-Disposition"), - CacheControl: h.Get("Cache-Control"), - ContentLanguage: h.Get("Content-Language"), - SequenceNumber: sequenceNum, - CopyCompletionTime: TimeRFC1123(*copyCompletionTime), - CopyStatusDescription: h.Get("x-ms-copy-status-description"), - CopyID: h.Get("x-ms-copy-id"), - CopyProgress: h.Get("x-ms-copy-progress"), - CopySource: h.Get("x-ms-copy-source"), - CopyStatus: h.Get("x-ms-copy-status"), - BlobType: BlobType(h.Get("x-ms-blob-type")), - LeaseStatus: h.Get("x-ms-lease-status"), - LeaseState: h.Get("x-ms-lease-state"), - } - b.writeMetadata(h) - return nil -} - -// SetBlobPropertiesOptions contains various properties of a blob and is an entry -// in SetProperties -type SetBlobPropertiesOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - Origin string `header:"Origin"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - SequenceNumberAction *SequenceNumberAction - RequestID string `header:"x-ms-client-request-id"` -} - -// SequenceNumberAction defines how the blob's sequence number should be modified -type SequenceNumberAction string - -// Options for sequence number action -const ( - SequenceNumberActionMax SequenceNumberAction = "max" - SequenceNumberActionUpdate SequenceNumberAction = "update" - SequenceNumberActionIncrement SequenceNumberAction = "increment" -) - -// SetProperties replaces the BlobHeaders for the specified blob. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetBlobProperties. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Blob-Properties -func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error { - params := url.Values{"comp": {"properties"}} - headers := b.Container.bsc.client.getStandardHeaders() - headers = mergeHeaders(headers, headersFromStruct(b.Properties)) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - if b.Properties.BlobType == BlobTypePage { - headers = addToHeaders(headers, "x-ms-blob-content-length", fmt.Sprintf("byte %v", b.Properties.ContentLength)) - if options != nil || options.SequenceNumberAction != nil { - headers = addToHeaders(headers, "x-ms-sequence-number-action", string(*options.SequenceNumberAction)) - if *options.SequenceNumberAction != SequenceNumberActionIncrement { - headers = addToHeaders(headers, "x-ms-blob-sequence-number", fmt.Sprintf("%v", b.Properties.SequenceNumber)) - } - } - } - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -// SetBlobMetadataOptions includes the options for a set blob metadata operation -type SetBlobMetadataOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// SetMetadata replaces the metadata for the specified blob. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetBlobMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx -func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error { - params := url.Values{"comp": {"metadata"}} - headers := b.Container.bsc.client.getStandardHeaders() - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -// GetBlobMetadataOptions includes the options for a get blob metadata operation -type GetBlobMetadataOptions struct { - Timeout uint - Snapshot *time.Time - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// GetMetadata returns all user-defined metadata for the specified blob. -// -// All metadata keys will be returned in lower case. (HTTP header -// names are case-insensitive.) -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx -func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error { - params := url.Values{"comp": {"metadata"}} - headers := b.Container.bsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - params = addSnapshot(params, options.Snapshot) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return err - } - - b.writeMetadata(resp.headers) - return nil -} - -func (b *Blob) writeMetadata(h http.Header) { - metadata := make(map[string]string) - for k, v := range h { - // Can't trust CanonicalHeaderKey() to munge case - // reliably. "_" is allowed in identifiers: - // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx - // https://msdn.microsoft.com/library/aa664670(VS.71).aspx - // http://tools.ietf.org/html/rfc7230#section-3.2 - // ...but "_" is considered invalid by - // CanonicalMIMEHeaderKey in - // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542 - // so k can be "X-Ms-Meta-Lol" or "x-ms-meta-lol_rofl". - k = strings.ToLower(k) - if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) { - continue - } - // metadata["lol"] = content of the last X-Ms-Meta-Lol header - k = k[len(userDefinedMetadataHeaderPrefix):] - metadata[k] = v[len(v)-1] - } - - b.Metadata = BlobMetadata(metadata) -} - -// DeleteBlobOptions includes the options for a delete blob operation -type DeleteBlobOptions struct { - Timeout uint - Snapshot *time.Time - LeaseID string `header:"x-ms-lease-id"` - DeleteSnapshots *bool - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// Delete deletes the given blob from the specified container. -// If the blob does not exists at the time of the Delete Blob operation, it -// returns error. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob -func (b *Blob) Delete(options *DeleteBlobOptions) error { - resp, err := b.delete(options) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} - -// DeleteIfExists deletes the given blob from the specified container If the -// blob is deleted with this call, returns true. Otherwise returns false. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob -func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error) { - resp, err := b.delete(options) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -func (b *Blob) delete(options *DeleteBlobOptions) (*storageResponse, error) { - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - params = addSnapshot(params, options.Snapshot) - headers = mergeHeaders(headers, headersFromStruct(*options)) - if options.DeleteSnapshots != nil { - if *options.DeleteSnapshots { - headers["x-ms-delete-snapshots"] = "include" - } else { - headers["x-ms-delete-snapshots"] = "only" - } - } - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - return b.Container.bsc.client.exec(http.MethodDelete, uri, headers, nil, b.Container.bsc.auth) -} - -// helper method to construct the path to either a blob or container -func pathForResource(container, name string) string { - if name != "" { - return fmt.Sprintf("/%s/%s", container, name) - } - return fmt.Sprintf("/%s", container) -} +package storage + +import ( + "encoding/xml" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strconv" + "strings" + "time" +) + +// A Blob is an entry in BlobListResponse. +type Blob struct { + Container *Container + Name string `xml:"Name"` + Snapshot time.Time `xml:"Snapshot"` + Properties BlobProperties `xml:"Properties"` + Metadata BlobMetadata `xml:"Metadata"` +} + +// PutBlobOptions includes the options any put blob operation +// (page, block, append) +type PutBlobOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + Origin string `header:"Origin"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// BlobMetadata is a set of custom name/value pairs. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179404.aspx +type BlobMetadata map[string]string + +type blobMetadataEntries struct { + Entries []blobMetadataEntry `xml:",any"` +} +type blobMetadataEntry struct { + XMLName xml.Name + Value string `xml:",chardata"` +} + +// UnmarshalXML converts the xml:Metadata into Metadata map +func (bm *BlobMetadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + var entries blobMetadataEntries + if err := d.DecodeElement(&entries, &start); err != nil { + return err + } + for _, entry := range entries.Entries { + if *bm == nil { + *bm = make(BlobMetadata) + } + (*bm)[strings.ToLower(entry.XMLName.Local)] = entry.Value + } + return nil +} + +// MarshalXML implements the xml.Marshaler interface. It encodes +// metadata name/value pairs as they would appear in an Azure +// ListBlobs response. +func (bm BlobMetadata) MarshalXML(enc *xml.Encoder, start xml.StartElement) error { + entries := make([]blobMetadataEntry, 0, len(bm)) + for k, v := range bm { + entries = append(entries, blobMetadataEntry{ + XMLName: xml.Name{Local: http.CanonicalHeaderKey(k)}, + Value: v, + }) + } + return enc.EncodeElement(blobMetadataEntries{ + Entries: entries, + }, start) +} + +// BlobProperties contains various properties of a blob +// returned in various endpoints like ListBlobs or GetBlobProperties. +type BlobProperties struct { + LastModified TimeRFC1123 `xml:"Last-Modified"` + Etag string `xml:"Etag"` + ContentMD5 string `xml:"Content-MD5" header:"x-ms-blob-content-md5"` + ContentLength int64 `xml:"Content-Length"` + ContentType string `xml:"Content-Type" header:"x-ms-blob-content-type"` + ContentEncoding string `xml:"Content-Encoding" header:"x-ms-blob-content-encoding"` + CacheControl string `xml:"Cache-Control" header:"x-ms-blob-cache-control"` + ContentLanguage string `xml:"Cache-Language" header:"x-ms-blob-content-language"` + ContentDisposition string `xml:"Content-Disposition" header:"x-ms-blob-content-disposition"` + BlobType BlobType `xml:"x-ms-blob-blob-type"` + SequenceNumber int64 `xml:"x-ms-blob-sequence-number"` + CopyID string `xml:"CopyId"` + CopyStatus string `xml:"CopyStatus"` + CopySource string `xml:"CopySource"` + CopyProgress string `xml:"CopyProgress"` + CopyCompletionTime TimeRFC1123 `xml:"CopyCompletionTime"` + CopyStatusDescription string `xml:"CopyStatusDescription"` + LeaseStatus string `xml:"LeaseStatus"` + LeaseState string `xml:"LeaseState"` + LeaseDuration string `xml:"LeaseDuration"` + ServerEncrypted bool `xml:"ServerEncrypted"` + IncrementalCopy bool `xml:"IncrementalCopy"` +} + +// BlobType defines the type of the Azure Blob. +type BlobType string + +// Types of page blobs +const ( + BlobTypeBlock BlobType = "BlockBlob" + BlobTypePage BlobType = "PageBlob" + BlobTypeAppend BlobType = "AppendBlob" +) + +func (b *Blob) buildPath() string { + return b.Container.buildPath() + "/" + b.Name +} + +// Exists returns true if a blob with given name exists on the specified +// container of the storage account. +func (b *Blob) Exists() (bool, error) { + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), nil) + headers := b.Container.bsc.client.getStandardHeaders() + resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusOK, nil + } + } + return false, err +} + +// GetURL gets the canonical URL to the blob with the specified name in the +// specified container. If name is not specified, the canonical URL for the entire +// container is obtained. +// This method does not create a publicly accessible URL if the blob or container +// is private and this method does not check if the blob exists. +func (b *Blob) GetURL() string { + container := b.Container.Name + if container == "" { + container = "$root" + } + return b.Container.bsc.client.getEndpoint(blobServiceName, pathForResource(container, b.Name), nil) +} + +// GetBlobRangeOptions includes the options for a get blob range operation +type GetBlobRangeOptions struct { + Range *BlobRange + GetRangeContentMD5 bool + *GetBlobOptions +} + +// GetBlobOptions includes the options for a get blob operation +type GetBlobOptions struct { + Timeout uint + Snapshot *time.Time + LeaseID string `header:"x-ms-lease-id"` + Origin string `header:"Origin"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// BlobRange represents the bytes range to be get +type BlobRange struct { + Start uint64 + End uint64 +} + +func (br BlobRange) String() string { + return fmt.Sprintf("bytes=%d-%d", br.Start, br.End) +} + +// Get returns a stream to read the blob. Caller must call both Read and Close() +// to correctly close the underlying connection. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob +func (b *Blob) Get(options *GetBlobOptions) (io.ReadCloser, error) { + rangeOptions := GetBlobRangeOptions{ + GetBlobOptions: options, + } + resp, err := b.getRange(&rangeOptions) + if err != nil { + return nil, err + } + + if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return nil, err + } + if err := b.writePropoerties(resp.headers); err != nil { + return resp.body, err + } + return resp.body, nil +} + +// GetRange reads the specified range of a blob to a stream. The bytesRange +// string must be in a format like "0-", "10-100" as defined in HTTP 1.1 spec. +// Caller must call both Read and Close()// to correctly close the underlying +// connection. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob +func (b *Blob) GetRange(options *GetBlobRangeOptions) (io.ReadCloser, error) { + resp, err := b.getRange(options) + if err != nil { + return nil, err + } + + if err := checkRespCode(resp.statusCode, []int{http.StatusPartialContent}); err != nil { + return nil, err + } + if err := b.writePropoerties(resp.headers); err != nil { + return resp.body, err + } + return resp.body, nil +} + +func (b *Blob) getRange(options *GetBlobRangeOptions) (*storageResponse, error) { + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + + if options != nil { + if options.Range != nil { + headers["Range"] = options.Range.String() + headers["x-ms-range-get-content-md5"] = fmt.Sprintf("%v", options.GetRangeContentMD5) + } + if options.GetBlobOptions != nil { + headers = mergeHeaders(headers, headersFromStruct(*options.GetBlobOptions)) + params = addTimeout(params, options.Timeout) + params = addSnapshot(params, options.Snapshot) + } + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return nil, err + } + return resp, err +} + +// SnapshotOptions includes the options for a snapshot blob operation +type SnapshotOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// CreateSnapshot creates a snapshot for a blob +// See https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx +func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time.Time, err error) { + params := url.Values{"comp": {"snapshot"}} + headers := b.Container.bsc.client.getStandardHeaders() + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil || resp == nil { + return nil, err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { + return nil, err + } + + snapshotResponse := resp.headers.Get(http.CanonicalHeaderKey("x-ms-snapshot")) + if snapshotResponse != "" { + snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse) + if err != nil { + return nil, err + } + return &snapshotTimestamp, nil + } + + return nil, errors.New("Snapshot not created") +} + +// GetBlobPropertiesOptions includes the options for a get blob properties operation +type GetBlobPropertiesOptions struct { + Timeout uint + Snapshot *time.Time + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// GetProperties provides various information about the specified blob. +// See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx +func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error { + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + params = addSnapshot(params, options.Snapshot) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return err + } + return b.writePropoerties(resp.headers) +} + +func (b *Blob) writePropoerties(h http.Header) error { + var err error + + var contentLength int64 + contentLengthStr := h.Get("Content-Length") + if contentLengthStr != "" { + contentLength, err = strconv.ParseInt(contentLengthStr, 0, 64) + if err != nil { + return err + } + } + + var sequenceNum int64 + sequenceNumStr := h.Get("x-ms-blob-sequence-number") + if sequenceNumStr != "" { + sequenceNum, err = strconv.ParseInt(sequenceNumStr, 0, 64) + if err != nil { + return err + } + } + + lastModified, err := getTimeFromHeaders(h, "Last-Modified") + if err != nil { + return err + } + + copyCompletionTime, err := getTimeFromHeaders(h, "x-ms-copy-completion-time") + if err != nil { + return err + } + + b.Properties = BlobProperties{ + LastModified: TimeRFC1123(*lastModified), + Etag: h.Get("Etag"), + ContentMD5: h.Get("Content-MD5"), + ContentLength: contentLength, + ContentEncoding: h.Get("Content-Encoding"), + ContentType: h.Get("Content-Type"), + ContentDisposition: h.Get("Content-Disposition"), + CacheControl: h.Get("Cache-Control"), + ContentLanguage: h.Get("Content-Language"), + SequenceNumber: sequenceNum, + CopyCompletionTime: TimeRFC1123(*copyCompletionTime), + CopyStatusDescription: h.Get("x-ms-copy-status-description"), + CopyID: h.Get("x-ms-copy-id"), + CopyProgress: h.Get("x-ms-copy-progress"), + CopySource: h.Get("x-ms-copy-source"), + CopyStatus: h.Get("x-ms-copy-status"), + BlobType: BlobType(h.Get("x-ms-blob-type")), + LeaseStatus: h.Get("x-ms-lease-status"), + LeaseState: h.Get("x-ms-lease-state"), + } + b.writeMetadata(h) + return nil +} + +// SetBlobPropertiesOptions contains various properties of a blob and is an entry +// in SetProperties +type SetBlobPropertiesOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + Origin string `header:"Origin"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + SequenceNumberAction *SequenceNumberAction + RequestID string `header:"x-ms-client-request-id"` +} + +// SequenceNumberAction defines how the blob's sequence number should be modified +type SequenceNumberAction string + +// Options for sequence number action +const ( + SequenceNumberActionMax SequenceNumberAction = "max" + SequenceNumberActionUpdate SequenceNumberAction = "update" + SequenceNumberActionIncrement SequenceNumberAction = "increment" +) + +// SetProperties replaces the BlobHeaders for the specified blob. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by GetBlobProperties. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Blob-Properties +func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error { + params := url.Values{"comp": {"properties"}} + headers := b.Container.bsc.client.getStandardHeaders() + headers = mergeHeaders(headers, headersFromStruct(b.Properties)) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + if b.Properties.BlobType == BlobTypePage { + headers = addToHeaders(headers, "x-ms-blob-content-length", fmt.Sprintf("byte %v", b.Properties.ContentLength)) + if options != nil || options.SequenceNumberAction != nil { + headers = addToHeaders(headers, "x-ms-sequence-number-action", string(*options.SequenceNumberAction)) + if *options.SequenceNumberAction != SequenceNumberActionIncrement { + headers = addToHeaders(headers, "x-ms-blob-sequence-number", fmt.Sprintf("%v", b.Properties.SequenceNumber)) + } + } + } + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusOK}) +} + +// SetBlobMetadataOptions includes the options for a set blob metadata operation +type SetBlobMetadataOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// SetMetadata replaces the metadata for the specified blob. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by GetBlobMetadata. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx +func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error { + params := url.Values{"comp": {"metadata"}} + headers := b.Container.bsc.client.getStandardHeaders() + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusOK}) +} + +// GetBlobMetadataOptions includes the options for a get blob metadata operation +type GetBlobMetadataOptions struct { + Timeout uint + Snapshot *time.Time + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// GetMetadata returns all user-defined metadata for the specified blob. +// +// All metadata keys will be returned in lower case. (HTTP header +// names are case-insensitive.) +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx +func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error { + params := url.Values{"comp": {"metadata"}} + headers := b.Container.bsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + params = addSnapshot(params, options.Snapshot) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return err + } + + b.writeMetadata(resp.headers) + return nil +} + +func (b *Blob) writeMetadata(h http.Header) { + metadata := make(map[string]string) + for k, v := range h { + // Can't trust CanonicalHeaderKey() to munge case + // reliably. "_" is allowed in identifiers: + // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx + // https://msdn.microsoft.com/library/aa664670(VS.71).aspx + // http://tools.ietf.org/html/rfc7230#section-3.2 + // ...but "_" is considered invalid by + // CanonicalMIMEHeaderKey in + // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542 + // so k can be "X-Ms-Meta-Lol" or "x-ms-meta-lol_rofl". + k = strings.ToLower(k) + if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) { + continue + } + // metadata["lol"] = content of the last X-Ms-Meta-Lol header + k = k[len(userDefinedMetadataHeaderPrefix):] + metadata[k] = v[len(v)-1] + } + + b.Metadata = BlobMetadata(metadata) +} + +// DeleteBlobOptions includes the options for a delete blob operation +type DeleteBlobOptions struct { + Timeout uint + Snapshot *time.Time + LeaseID string `header:"x-ms-lease-id"` + DeleteSnapshots *bool + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// Delete deletes the given blob from the specified container. +// If the blob does not exists at the time of the Delete Blob operation, it +// returns error. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob +func (b *Blob) Delete(options *DeleteBlobOptions) error { + resp, err := b.delete(options) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) +} + +// DeleteIfExists deletes the given blob from the specified container If the +// blob is deleted with this call, returns true. Otherwise returns false. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob +func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error) { + resp, err := b.delete(options) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusAccepted, nil + } + } + return false, err +} + +func (b *Blob) delete(options *DeleteBlobOptions) (*storageResponse, error) { + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + params = addSnapshot(params, options.Snapshot) + headers = mergeHeaders(headers, headersFromStruct(*options)) + if options.DeleteSnapshots != nil { + if *options.DeleteSnapshots { + headers["x-ms-delete-snapshots"] = "include" + } else { + headers["x-ms-delete-snapshots"] = "only" + } + } + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + return b.Container.bsc.client.exec(http.MethodDelete, uri, headers, nil, b.Container.bsc.auth) +} + +// helper method to construct the path to either a blob or container +func pathForResource(container, name string) string { + if name != "" { + return fmt.Sprintf("/%s/%s", container, name) + } + return fmt.Sprintf("/%s", container) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go index b58a4ecf27..a70b518bf4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob_test.go @@ -1,524 +1,524 @@ -package storage - -import ( - "bytes" - "encoding/xml" - "fmt" - "io/ioutil" - "net/http" - "strconv" - "strings" - - chk "gopkg.in/check.v1" -) - -type StorageBlobSuite struct{} - -var _ = chk.Suite(&StorageBlobSuite{}) - -func getBlobClient(c *chk.C) BlobStorageClient { - return getBasicClient(c).GetBlobService() -} - -func (s *StorageBlobSuite) Test_buildPath(c *chk.C) { - cli := getBlobClient(c) - cnt := cli.GetContainerReference("lol") - b := cnt.GetBlobReference("rofl") - c.Assert(b.buildPath(), chk.Equals, "/lol/rofl") -} - -func (s *StorageBlobSuite) Test_pathForResource(c *chk.C) { - c.Assert(pathForResource("lol", ""), chk.Equals, "/lol") - c.Assert(pathForResource("lol", "blob"), chk.Equals, "/lol/blob") -} - -func (s *StorageBlobSuite) TestBlobExists(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - b := cnt.GetBlobReference(blobName(c)) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - defer b.Delete(nil) - - ok, err := b.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - b.Name += ".lol" - ok, err = b.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - -} - -func (s *StorageBlobSuite) TestGetBlobURL(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) - c.Assert(err, chk.IsNil) - blobCli := cli.GetBlobService() - - cnt := blobCli.GetContainerReference("c") - b := cnt.GetBlobReference("nested/blob") - c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/c/nested/blob") - - cnt.Name = "" - c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/$root/nested/blob") - - b.Name = "blob" - c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/$root/blob") - -} - -func (s *StorageBlobSuite) TestGetBlobContainerURL(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) - c.Assert(err, chk.IsNil) - blobCli := cli.GetBlobService() - - cnt := blobCli.GetContainerReference("c") - b := cnt.GetBlobReference("") - c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/c") - - cnt.Name = "" - c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/$root") -} - -func (s *StorageBlobSuite) TestDeleteBlobIfExists(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.Delete(nil), chk.NotNil) - - ok, err := b.DeleteIfExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageBlobSuite) TestDeleteBlobWithConditions(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.CreateBlockBlob(nil), chk.IsNil) - err := b.GetProperties(nil) - c.Assert(err, chk.IsNil) - etag := b.Properties.Etag - - // "Delete if matches incorrect or old Etag" should fail without deleting. - options := DeleteBlobOptions{ - IfMatch: "GolangRocksOnAzure", - } - err = b.Delete(&options) - c.Assert(err, chk.FitsTypeOf, AzureStorageServiceError{}) - c.Assert(err.(AzureStorageServiceError).StatusCode, chk.Equals, http.StatusPreconditionFailed) - ok, err := b.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - - // "Delete if matches new Etag" should succeed. - options.IfMatch = etag - ok, err = b.DeleteIfExists(&options) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageBlobSuite) TestGetBlobProperties(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - // try to get properties on a nonexisting blob - blob1 := cnt.GetBlobReference(blobName(c, "1")) - err := blob1.GetProperties(nil) - c.Assert(err, chk.NotNil) - - // Put a blob - blob2 := cnt.GetBlobReference(blobName(c, "2")) - contents := content(64) - c.Assert(blob2.putSingleBlockBlob(contents), chk.IsNil) - - // Get blob properties - err = blob2.GetProperties(nil) - c.Assert(err, chk.IsNil) - - c.Assert(blob2.Properties.ContentLength, chk.Equals, int64(len(contents))) - c.Assert(blob2.Properties.ContentType, chk.Equals, "application/octet-stream") - c.Assert(blob2.Properties.BlobType, chk.Equals, BlobTypeBlock) -} - -// Ensure it's possible to generate a ListBlobs response with -// metadata, e.g., for a stub server. -func (s *StorageBlobSuite) TestMarshalBlobMetadata(c *chk.C) { - buf, err := xml.Marshal(Blob{ - Name: blobName(c), - Properties: BlobProperties{}, - Metadata: map[string]string{ - "lol": "baz < waz", - }, - }) - c.Assert(err, chk.IsNil) - c.Assert(string(buf), chk.Matches, `.*baz < waz.*`) -} - -func (s *StorageBlobSuite) TestGetAndSetBlobMetadata(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - // Get empty metadata - blob1 := cnt.GetBlobReference(blobName(c, "1")) - c.Assert(blob1.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - err := blob1.GetMetadata(nil) - c.Assert(err, chk.IsNil) - c.Assert(blob1.Metadata, chk.HasLen, 0) - - // Get and set the metadata - blob2 := cnt.GetBlobReference(blobName(c, "2")) - c.Assert(blob2.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - metaPut := BlobMetadata{ - "lol": "rofl", - "rofl_baz": "waz qux", - } - blob2.Metadata = metaPut - - err = blob2.SetMetadata(nil) - c.Assert(err, chk.IsNil) - - err = blob2.GetMetadata(nil) - c.Assert(err, chk.IsNil) - c.Check(blob2.Metadata, chk.DeepEquals, metaPut) -} - -func (s *StorageBlobSuite) TestMetadataCaseMunging(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - b := cnt.GetBlobReference(blobName(c)) - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - // Case munging - metaPutUpper := BlobMetadata{ - "Lol": "different rofl", - "rofl_BAZ": "different waz qux", - } - metaExpectLower := BlobMetadata{ - "lol": "different rofl", - "rofl_baz": "different waz qux", - } - - b.Metadata = metaPutUpper - err := b.SetMetadata(nil) - c.Assert(err, chk.IsNil) - - err = b.GetMetadata(nil) - c.Assert(err, chk.IsNil) - c.Check(b.Metadata, chk.DeepEquals, metaExpectLower) -} - -func (s *StorageBlobSuite) TestSetMetadataWithExtraHeaders(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - meta := BlobMetadata{ - "lol": "rofl", - "rofl_baz": "waz qux", - } - b.Metadata = meta - - options := SetBlobMetadataOptions{ - IfMatch: "incorrect-etag", - } - - // Set with incorrect If-Match in extra headers should result in error - err := b.SetMetadata(&options) - c.Assert(err, chk.NotNil) - - err = b.GetProperties(nil) - c.Assert(err, chk.IsNil) - - // Set with matching If-Match in extra headers should succeed - options.IfMatch = b.Properties.Etag - b.Metadata = meta - err = b.SetMetadata(&options) - c.Assert(err, chk.IsNil) -} - -func (s *StorageBlobSuite) TestSetBlobProperties(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - input := BlobProperties{ - CacheControl: "private, max-age=0, no-cache", - ContentMD5: "oBATU+oaDduHWbVZLuzIJw==", - ContentType: "application/json", - ContentEncoding: "gzip", - ContentLanguage: "de-DE", - } - b.Properties = input - - err := b.SetProperties(nil) - c.Assert(err, chk.IsNil) - - err = b.GetProperties(nil) - c.Assert(err, chk.IsNil) - - c.Check(b.Properties.CacheControl, chk.Equals, input.CacheControl) - c.Check(b.Properties.ContentType, chk.Equals, input.ContentType) - c.Check(b.Properties.ContentMD5, chk.Equals, input.ContentMD5) - c.Check(b.Properties.ContentEncoding, chk.Equals, input.ContentEncoding) - c.Check(b.Properties.ContentLanguage, chk.Equals, input.ContentLanguage) -} - -func (s *StorageBlobSuite) TestSnapshotBlob(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - snapshotTime, err := b.CreateSnapshot(nil) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSnapshotBlobWithTimeout(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - options := SnapshotOptions{ - Timeout: 0, - } - snapshotTime, err := b.CreateSnapshot(&options) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSnapshotBlobWithValidLease(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - // generate lease. - currentLeaseID, err := b.AcquireLease(30, "", nil) - c.Assert(err, chk.IsNil) - - options := SnapshotOptions{ - LeaseID: currentLeaseID, - } - snapshotTime, err := b.CreateSnapshot(&options) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) -} - -func (s *StorageBlobSuite) TestSnapshotBlobWithInvalidLease(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - // generate lease. - leaseID, err := b.AcquireLease(30, "", nil) - c.Assert(err, chk.IsNil) - c.Assert(leaseID, chk.Not(chk.Equals), "") - - options := SnapshotOptions{ - LeaseID: "GolangRocksOnAzure", - } - snapshotTime, err := b.CreateSnapshot(&options) - c.Assert(err, chk.NotNil) - c.Assert(snapshotTime, chk.IsNil) -} - -func (s *StorageBlobSuite) TestGetBlobRange(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - body := "0123456789" - c.Assert(b.putSingleBlockBlob([]byte(body)), chk.IsNil) - defer b.Delete(nil) - - cases := []struct { - options GetBlobRangeOptions - expected string - }{ - { - options: GetBlobRangeOptions{ - Range: &BlobRange{ - Start: 0, - End: uint64(len(body)), - }, - }, - expected: body, - }, - { - options: GetBlobRangeOptions{ - Range: &BlobRange{ - Start: 1, - End: 3, - }, - }, - expected: body[1 : 3+1], - }, - { - options: GetBlobRangeOptions{ - Range: &BlobRange{ - Start: 3, - End: uint64(len(body)), - }, - }, - expected: body[3:], - }, - } - - // Read 1-3 - for _, r := range cases { - resp, err := b.GetRange(&(r.options)) - c.Assert(err, chk.IsNil) - blobBody, err := ioutil.ReadAll(resp) - c.Assert(err, chk.IsNil) - - str := string(blobBody) - c.Assert(str, chk.Equals, r.expected) - - // Was content lenght properly updated...? - c.Assert(b.Properties.ContentLength, chk.Equals, int64(len(r.expected))) - } -} - -func (b *Blob) putSingleBlockBlob(chunk []byte) error { - if len(chunk) > MaxBlobBlockSize { - return fmt.Errorf("storage: provided chunk (%d bytes) cannot fit into single-block blob (max %d bytes)", len(chunk), MaxBlobBlockSize) - } - - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), nil) - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeBlock) - headers["Content-Length"] = strconv.Itoa(len(chunk)) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.Container.bsc.auth) - if err != nil { - return err - } - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -func blobName(c *chk.C, extras ...string) string { - return nameGenerator(1024, "blob/", alphanum, c, extras) - -} - -func contentWithSpecialChars(n int) string { - name := string(content(n)) + "/" + string(content(n)) + "-._~:?#[]@!$&'()*,;+= " + string(content(n)) - return name -} - -func nameGenerator(maxLen int, prefix, valid string, c *chk.C, extras []string) string { - extra := strings.Join(extras, "") - name := prefix + extra + removeInvalidCharacters(c.TestName(), valid) - if len(name) > maxLen { - return name[:maxLen] - } - return name -} - -func removeInvalidCharacters(unformatted string, valid string) string { - unformatted = strings.ToLower(unformatted) - buffer := bytes.NewBufferString(strconv.Itoa((len(unformatted)))) - runes := []rune(unformatted) - for _, r := range runes { - if strings.ContainsRune(valid, r) { - buffer.WriteRune(r) - } - } - return string(buffer.Bytes()) -} - -func content(n int) []byte { - buffer := bytes.NewBufferString("") - rep := (n / len(veryLongString)) + 1 - for i := 0; i < rep; i++ { - buffer.WriteString(veryLongString) - } - return buffer.Bytes()[:n] -} - -const ( - alphanum = "0123456789abcdefghijklmnopqrstuvwxyz" - alpha = "abcdefghijklmnopqrstuvwxyz" - veryLongString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse platea dictumst." -) +package storage + +import ( + "bytes" + "encoding/xml" + "fmt" + "io/ioutil" + "net/http" + "strconv" + "strings" + + chk "gopkg.in/check.v1" +) + +type StorageBlobSuite struct{} + +var _ = chk.Suite(&StorageBlobSuite{}) + +func getBlobClient(c *chk.C) BlobStorageClient { + return getBasicClient(c).GetBlobService() +} + +func (s *StorageBlobSuite) Test_buildPath(c *chk.C) { + cli := getBlobClient(c) + cnt := cli.GetContainerReference("lol") + b := cnt.GetBlobReference("rofl") + c.Assert(b.buildPath(), chk.Equals, "/lol/rofl") +} + +func (s *StorageBlobSuite) Test_pathForResource(c *chk.C) { + c.Assert(pathForResource("lol", ""), chk.Equals, "/lol") + c.Assert(pathForResource("lol", "blob"), chk.Equals, "/lol/blob") +} + +func (s *StorageBlobSuite) TestBlobExists(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + b := cnt.GetBlobReference(blobName(c)) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + defer b.Delete(nil) + + ok, err := b.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) + b.Name += ".lol" + ok, err = b.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + +} + +func (s *StorageBlobSuite) TestGetBlobURL(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) + c.Assert(err, chk.IsNil) + blobCli := cli.GetBlobService() + + cnt := blobCli.GetContainerReference("c") + b := cnt.GetBlobReference("nested/blob") + c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/c/nested/blob") + + cnt.Name = "" + c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/$root/nested/blob") + + b.Name = "blob" + c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/$root/blob") + +} + +func (s *StorageBlobSuite) TestGetBlobContainerURL(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) + c.Assert(err, chk.IsNil) + blobCli := cli.GetBlobService() + + cnt := blobCli.GetContainerReference("c") + b := cnt.GetBlobReference("") + c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/c") + + cnt.Name = "" + c.Assert(b.GetURL(), chk.Equals, "https://golangrocksonazure.blob.core.windows.net/$root") +} + +func (s *StorageBlobSuite) TestDeleteBlobIfExists(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.Delete(nil), chk.NotNil) + + ok, err := b.DeleteIfExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) +} + +func (s *StorageBlobSuite) TestDeleteBlobWithConditions(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.CreateBlockBlob(nil), chk.IsNil) + err := b.GetProperties(nil) + c.Assert(err, chk.IsNil) + etag := b.Properties.Etag + + // "Delete if matches incorrect or old Etag" should fail without deleting. + options := DeleteBlobOptions{ + IfMatch: "GolangRocksOnAzure", + } + err = b.Delete(&options) + c.Assert(err, chk.FitsTypeOf, AzureStorageServiceError{}) + c.Assert(err.(AzureStorageServiceError).StatusCode, chk.Equals, http.StatusPreconditionFailed) + ok, err := b.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) + + // "Delete if matches new Etag" should succeed. + options.IfMatch = etag + ok, err = b.DeleteIfExists(&options) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) +} + +func (s *StorageBlobSuite) TestGetBlobProperties(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + // try to get properties on a nonexisting blob + blob1 := cnt.GetBlobReference(blobName(c, "1")) + err := blob1.GetProperties(nil) + c.Assert(err, chk.NotNil) + + // Put a blob + blob2 := cnt.GetBlobReference(blobName(c, "2")) + contents := content(64) + c.Assert(blob2.putSingleBlockBlob(contents), chk.IsNil) + + // Get blob properties + err = blob2.GetProperties(nil) + c.Assert(err, chk.IsNil) + + c.Assert(blob2.Properties.ContentLength, chk.Equals, int64(len(contents))) + c.Assert(blob2.Properties.ContentType, chk.Equals, "application/octet-stream") + c.Assert(blob2.Properties.BlobType, chk.Equals, BlobTypeBlock) +} + +// Ensure it's possible to generate a ListBlobs response with +// metadata, e.g., for a stub server. +func (s *StorageBlobSuite) TestMarshalBlobMetadata(c *chk.C) { + buf, err := xml.Marshal(Blob{ + Name: blobName(c), + Properties: BlobProperties{}, + Metadata: map[string]string{ + "lol": "baz < waz", + }, + }) + c.Assert(err, chk.IsNil) + c.Assert(string(buf), chk.Matches, `.*baz < waz.*`) +} + +func (s *StorageBlobSuite) TestGetAndSetBlobMetadata(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + // Get empty metadata + blob1 := cnt.GetBlobReference(blobName(c, "1")) + c.Assert(blob1.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + err := blob1.GetMetadata(nil) + c.Assert(err, chk.IsNil) + c.Assert(blob1.Metadata, chk.HasLen, 0) + + // Get and set the metadata + blob2 := cnt.GetBlobReference(blobName(c, "2")) + c.Assert(blob2.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + metaPut := BlobMetadata{ + "lol": "rofl", + "rofl_baz": "waz qux", + } + blob2.Metadata = metaPut + + err = blob2.SetMetadata(nil) + c.Assert(err, chk.IsNil) + + err = blob2.GetMetadata(nil) + c.Assert(err, chk.IsNil) + c.Check(blob2.Metadata, chk.DeepEquals, metaPut) +} + +func (s *StorageBlobSuite) TestMetadataCaseMunging(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + b := cnt.GetBlobReference(blobName(c)) + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + // Case munging + metaPutUpper := BlobMetadata{ + "Lol": "different rofl", + "rofl_BAZ": "different waz qux", + } + metaExpectLower := BlobMetadata{ + "lol": "different rofl", + "rofl_baz": "different waz qux", + } + + b.Metadata = metaPutUpper + err := b.SetMetadata(nil) + c.Assert(err, chk.IsNil) + + err = b.GetMetadata(nil) + c.Assert(err, chk.IsNil) + c.Check(b.Metadata, chk.DeepEquals, metaExpectLower) +} + +func (s *StorageBlobSuite) TestSetMetadataWithExtraHeaders(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + meta := BlobMetadata{ + "lol": "rofl", + "rofl_baz": "waz qux", + } + b.Metadata = meta + + options := SetBlobMetadataOptions{ + IfMatch: "incorrect-etag", + } + + // Set with incorrect If-Match in extra headers should result in error + err := b.SetMetadata(&options) + c.Assert(err, chk.NotNil) + + err = b.GetProperties(nil) + c.Assert(err, chk.IsNil) + + // Set with matching If-Match in extra headers should succeed + options.IfMatch = b.Properties.Etag + b.Metadata = meta + err = b.SetMetadata(&options) + c.Assert(err, chk.IsNil) +} + +func (s *StorageBlobSuite) TestSetBlobProperties(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + input := BlobProperties{ + CacheControl: "private, max-age=0, no-cache", + ContentMD5: "oBATU+oaDduHWbVZLuzIJw==", + ContentType: "application/json", + ContentEncoding: "gzip", + ContentLanguage: "de-DE", + } + b.Properties = input + + err := b.SetProperties(nil) + c.Assert(err, chk.IsNil) + + err = b.GetProperties(nil) + c.Assert(err, chk.IsNil) + + c.Check(b.Properties.CacheControl, chk.Equals, input.CacheControl) + c.Check(b.Properties.ContentType, chk.Equals, input.ContentType) + c.Check(b.Properties.ContentMD5, chk.Equals, input.ContentMD5) + c.Check(b.Properties.ContentEncoding, chk.Equals, input.ContentEncoding) + c.Check(b.Properties.ContentLanguage, chk.Equals, input.ContentLanguage) +} + +func (s *StorageBlobSuite) TestSnapshotBlob(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + snapshotTime, err := b.CreateSnapshot(nil) + c.Assert(err, chk.IsNil) + c.Assert(snapshotTime, chk.NotNil) +} + +func (s *StorageBlobSuite) TestSnapshotBlobWithTimeout(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + options := SnapshotOptions{ + Timeout: 0, + } + snapshotTime, err := b.CreateSnapshot(&options) + c.Assert(err, chk.IsNil) + c.Assert(snapshotTime, chk.NotNil) +} + +func (s *StorageBlobSuite) TestSnapshotBlobWithValidLease(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + // generate lease. + currentLeaseID, err := b.AcquireLease(30, "", nil) + c.Assert(err, chk.IsNil) + + options := SnapshotOptions{ + LeaseID: currentLeaseID, + } + snapshotTime, err := b.CreateSnapshot(&options) + c.Assert(err, chk.IsNil) + c.Assert(snapshotTime, chk.NotNil) +} + +func (s *StorageBlobSuite) TestSnapshotBlobWithInvalidLease(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + // generate lease. + leaseID, err := b.AcquireLease(30, "", nil) + c.Assert(err, chk.IsNil) + c.Assert(leaseID, chk.Not(chk.Equals), "") + + options := SnapshotOptions{ + LeaseID: "GolangRocksOnAzure", + } + snapshotTime, err := b.CreateSnapshot(&options) + c.Assert(err, chk.NotNil) + c.Assert(snapshotTime, chk.IsNil) +} + +func (s *StorageBlobSuite) TestGetBlobRange(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + body := "0123456789" + c.Assert(b.putSingleBlockBlob([]byte(body)), chk.IsNil) + defer b.Delete(nil) + + cases := []struct { + options GetBlobRangeOptions + expected string + }{ + { + options: GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 0, + End: uint64(len(body)), + }, + }, + expected: body, + }, + { + options: GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 1, + End: 3, + }, + }, + expected: body[1 : 3+1], + }, + { + options: GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 3, + End: uint64(len(body)), + }, + }, + expected: body[3:], + }, + } + + // Read 1-3 + for _, r := range cases { + resp, err := b.GetRange(&(r.options)) + c.Assert(err, chk.IsNil) + blobBody, err := ioutil.ReadAll(resp) + c.Assert(err, chk.IsNil) + + str := string(blobBody) + c.Assert(str, chk.Equals, r.expected) + + // Was content lenght properly updated...? + c.Assert(b.Properties.ContentLength, chk.Equals, int64(len(r.expected))) + } +} + +func (b *Blob) putSingleBlockBlob(chunk []byte) error { + if len(chunk) > MaxBlobBlockSize { + return fmt.Errorf("storage: provided chunk (%d bytes) cannot fit into single-block blob (max %d bytes)", len(chunk), MaxBlobBlockSize) + } + + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), nil) + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-blob-type"] = string(BlobTypeBlock) + headers["Content-Length"] = strconv.Itoa(len(chunk)) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.Container.bsc.auth) + if err != nil { + return err + } + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +func blobName(c *chk.C, extras ...string) string { + return nameGenerator(1024, "blob/", alphanum, c, extras) + +} + +func contentWithSpecialChars(n int) string { + name := string(content(n)) + "/" + string(content(n)) + "-._~:?#[]@!$&'()*,;+= " + string(content(n)) + return name +} + +func nameGenerator(maxLen int, prefix, valid string, c *chk.C, extras []string) string { + extra := strings.Join(extras, "") + name := prefix + extra + removeInvalidCharacters(c.TestName(), valid) + if len(name) > maxLen { + return name[:maxLen] + } + return name +} + +func removeInvalidCharacters(unformatted string, valid string) string { + unformatted = strings.ToLower(unformatted) + buffer := bytes.NewBufferString(strconv.Itoa((len(unformatted)))) + runes := []rune(unformatted) + for _, r := range runes { + if strings.ContainsRune(valid, r) { + buffer.WriteRune(r) + } + } + return string(buffer.Bytes()) +} + +func content(n int) []byte { + buffer := bytes.NewBufferString("") + rep := (n / len(veryLongString)) + 1 + for i := 0; i < rep; i++ { + buffer.WriteString(veryLongString) + } + return buffer.Bytes()[:n] +} + +const ( + alphanum = "0123456789abcdefghijklmnopqrstuvwxyz" + alpha = "abcdefghijklmnopqrstuvwxyz" + veryLongString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse platea dictumst." +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go index aeb4ae2dea..43173d3a41 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go @@ -1,106 +1,106 @@ -package storage - -import ( - "errors" - "fmt" - "net/url" - "strings" - "time" -) - -// GetSASURIWithSignedIPAndProtocol creates an URL to the specified blob which contains the Shared -// Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed protocols. -// If old API version is used but no signedIP is passed (ie empty string) then this should still work. -// We only populate the signedIP when it non-empty. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx -func (b *Blob) GetSASURIWithSignedIPAndProtocol(expiry time.Time, permissions string, signedIPRange string, HTTPSOnly bool) (string, error) { - var ( - signedPermissions = permissions - blobURL = b.GetURL() - ) - canonicalizedResource, err := b.Container.bsc.client.buildCanonicalizedResource(blobURL, b.Container.bsc.auth) - if err != nil { - return "", err - } - - // "The canonicalizedresouce portion of the string is a canonical path to the signed resource. - // It must include the service name (blob, table, queue or file) for version 2015-02-21 or - // later, the storage account name, and the resource name, and must be URL-decoded. - // -- https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx - - // We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component). - canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1) - canonicalizedResource, err = url.QueryUnescape(canonicalizedResource) - if err != nil { - return "", err - } - - signedExpiry := expiry.UTC().Format(time.RFC3339) - - //If blob name is missing, resource is a container - signedResource := "c" - if len(b.Name) > 0 { - signedResource = "b" - } - - protocols := "https,http" - if HTTPSOnly { - protocols = "https" - } - stringToSign, err := blobSASStringToSign(b.Container.bsc.client.apiVersion, canonicalizedResource, signedExpiry, signedPermissions, signedIPRange, protocols) - if err != nil { - return "", err - } - - sig := b.Container.bsc.client.computeHmac256(stringToSign) - sasParams := url.Values{ - "sv": {b.Container.bsc.client.apiVersion}, - "se": {signedExpiry}, - "sr": {signedResource}, - "sp": {signedPermissions}, - "sig": {sig}, - } - - if b.Container.bsc.client.apiVersion >= "2015-04-05" { - sasParams.Add("spr", protocols) - if signedIPRange != "" { - sasParams.Add("sip", signedIPRange) - } - } - - sasURL, err := url.Parse(blobURL) - if err != nil { - return "", err - } - sasURL.RawQuery = sasParams.Encode() - return sasURL.String(), nil -} - -// GetSASURI creates an URL to the specified blob which contains the Shared -// Access Signature with specified permissions and expiration time. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx -func (b *Blob) GetSASURI(expiry time.Time, permissions string) (string, error) { - return b.GetSASURIWithSignedIPAndProtocol(expiry, permissions, "", false) -} - -func blobSASStringToSign(signedVersion, canonicalizedResource, signedExpiry, signedPermissions string, signedIP string, protocols string) (string, error) { - var signedStart, signedIdentifier, rscc, rscd, rsce, rscl, rsct string - - if signedVersion >= "2015-02-21" { - canonicalizedResource = "/blob" + canonicalizedResource - } - - // https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx#Anchor_12 - if signedVersion >= "2015-04-05" { - return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, rscc, rscd, rsce, rscl, rsct), nil - } - - // reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx - if signedVersion >= "2013-08-15" { - return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion, rscc, rscd, rsce, rscl, rsct), nil - } - - return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15") -} +package storage + +import ( + "errors" + "fmt" + "net/url" + "strings" + "time" +) + +// GetSASURIWithSignedIPAndProtocol creates an URL to the specified blob which contains the Shared +// Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed protocols. +// If old API version is used but no signedIP is passed (ie empty string) then this should still work. +// We only populate the signedIP when it non-empty. +// +// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx +func (b *Blob) GetSASURIWithSignedIPAndProtocol(expiry time.Time, permissions string, signedIPRange string, HTTPSOnly bool) (string, error) { + var ( + signedPermissions = permissions + blobURL = b.GetURL() + ) + canonicalizedResource, err := b.Container.bsc.client.buildCanonicalizedResource(blobURL, b.Container.bsc.auth) + if err != nil { + return "", err + } + + // "The canonicalizedresouce portion of the string is a canonical path to the signed resource. + // It must include the service name (blob, table, queue or file) for version 2015-02-21 or + // later, the storage account name, and the resource name, and must be URL-decoded. + // -- https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx + + // We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component). + canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1) + canonicalizedResource, err = url.QueryUnescape(canonicalizedResource) + if err != nil { + return "", err + } + + signedExpiry := expiry.UTC().Format(time.RFC3339) + + //If blob name is missing, resource is a container + signedResource := "c" + if len(b.Name) > 0 { + signedResource = "b" + } + + protocols := "https,http" + if HTTPSOnly { + protocols = "https" + } + stringToSign, err := blobSASStringToSign(b.Container.bsc.client.apiVersion, canonicalizedResource, signedExpiry, signedPermissions, signedIPRange, protocols) + if err != nil { + return "", err + } + + sig := b.Container.bsc.client.computeHmac256(stringToSign) + sasParams := url.Values{ + "sv": {b.Container.bsc.client.apiVersion}, + "se": {signedExpiry}, + "sr": {signedResource}, + "sp": {signedPermissions}, + "sig": {sig}, + } + + if b.Container.bsc.client.apiVersion >= "2015-04-05" { + sasParams.Add("spr", protocols) + if signedIPRange != "" { + sasParams.Add("sip", signedIPRange) + } + } + + sasURL, err := url.Parse(blobURL) + if err != nil { + return "", err + } + sasURL.RawQuery = sasParams.Encode() + return sasURL.String(), nil +} + +// GetSASURI creates an URL to the specified blob which contains the Shared +// Access Signature with specified permissions and expiration time. +// +// See https://msdn.microsoft.com/en-us/library/azure/ee395415.aspx +func (b *Blob) GetSASURI(expiry time.Time, permissions string) (string, error) { + return b.GetSASURIWithSignedIPAndProtocol(expiry, permissions, "", false) +} + +func blobSASStringToSign(signedVersion, canonicalizedResource, signedExpiry, signedPermissions string, signedIP string, protocols string) (string, error) { + var signedStart, signedIdentifier, rscc, rscd, rsce, rscl, rsct string + + if signedVersion >= "2015-02-21" { + canonicalizedResource = "/blob" + canonicalizedResource + } + + // https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx#Anchor_12 + if signedVersion >= "2015-04-05" { + return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, rscc, rscd, rsce, rscl, rsct), nil + } + + // reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx + if signedVersion >= "2013-08-15" { + return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion, rscc, rscd, rsce, rscl, rsct), nil + } + + return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15") +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri_test.go index c55ab91ed7..ac2b6b1c58 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri_test.go @@ -1,185 +1,185 @@ -package storage - -import ( - "io/ioutil" - "net/http" - "net/url" - "time" - - chk "gopkg.in/check.v1" -) - -type BlobSASURISuite struct{} - -var _ = chk.Suite(&BlobSASURISuite{}) - -var oldAPIVer = "2013-08-15" -var newerAPIVer = "2015-04-05" - -func (s *BlobSASURISuite) TestGetBlobSASURI(c *chk.C) { - api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, oldAPIVer, true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - cnt := cli.GetContainerReference("container") - b := cnt.GetBlobReference("name") - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "container/name", - RawQuery: url.Values{ - "sv": {oldAPIVer}, - "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, - "sr": {"b"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - }.Encode()} - - u, err := b.GetSASURI(expiry, "r") - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) - c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) -} - -//Gets a SASURI for the entire container -func (s *BlobSASURISuite) TestGetBlobSASURIContainer(c *chk.C) { - api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, oldAPIVer, true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - cnt := cli.GetContainerReference("container") - b := cnt.GetBlobReference("") - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "container", - RawQuery: url.Values{ - "sv": {oldAPIVer}, - "sig": {"KMjYyQODKp6uK9EKR3yGhO2M84e1LfoztypU32kHj4s="}, - "sr": {"c"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - }.Encode()} - - u, err := b.GetSASURI(expiry, "r") - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) - c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) -} - -func (s *BlobSASURISuite) TestGetBlobSASURIWithSignedIPAndProtocolValidAPIVersionPassed(c *chk.C) { - api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, newerAPIVer, true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - cnt := cli.GetContainerReference("container") - b := cnt.GetBlobReference("name") - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "/container/name", - RawQuery: url.Values{ - "sv": {newerAPIVer}, - "sig": {"VBOYJmt89UuBRXrxNzmsCMoC+8PXX2yklV71QcL1BfM="}, - "sr": {"b"}, - "sip": {"127.0.0.1"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - "spr": {"https"}, - }.Encode()} - - u, err := b.GetSASURIWithSignedIPAndProtocol(expiry, "r", "127.0.0.1", true) - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(sasParts.Query(), chk.DeepEquals, expectedParts.Query()) -} - -// Trying to use SignedIP and Protocol but using an older version of the API. -// Should ignore the signedIP/protocol and just use what the older version requires. -func (s *BlobSASURISuite) TestGetBlobSASURIWithSignedIPAndProtocolUsingOldAPIVersion(c *chk.C) { - api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, oldAPIVer, true) - c.Assert(err, chk.IsNil) - cli := api.GetBlobService() - cnt := cli.GetContainerReference("container") - b := cnt.GetBlobReference("name") - expiry := time.Time{} - - expectedParts := url.URL{ - Scheme: "https", - Host: "foo.blob.core.windows.net", - Path: "/container/name", - RawQuery: url.Values{ - "sv": {oldAPIVer}, - "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, - "sr": {"b"}, - "sp": {"r"}, - "se": {"0001-01-01T00:00:00Z"}, - }.Encode()} - - u, err := b.GetSASURIWithSignedIPAndProtocol(expiry, "r", "", true) - c.Assert(err, chk.IsNil) - sasParts, err := url.Parse(u) - c.Assert(err, chk.IsNil) - c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) - c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) -} - -func (s *BlobSASURISuite) TestBlobSASURICorrectness(c *chk.C) { - cli := getBlobClient(c) - - if cli.client.usesDummies() { - c.Skip("As GetSASURI result depends on the account key, it is not practical to test it with a dummy key.") - } - - simpleClient := &http.Client{} - rec := cli.client.appendRecorder(c) - simpleClient.Transport = rec - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - b := cnt.GetBlobReference(contentWithSpecialChars(5)) - defer cnt.Delete(nil) - - body := content(100) - expiry := fixedTime.UTC().Add(time.Hour) - permissions := "r" - - c.Assert(b.putSingleBlockBlob(body), chk.IsNil) - - sasURI, err := b.GetSASURI(expiry, permissions) - c.Assert(err, chk.IsNil) - - resp, err := simpleClient.Get(sasURI) - c.Assert(err, chk.IsNil) - - blobResp, err := ioutil.ReadAll(resp.Body) - defer resp.Body.Close() - c.Assert(err, chk.IsNil) - - c.Assert(resp.StatusCode, chk.Equals, http.StatusOK) - c.Assert(string(blobResp), chk.Equals, string(body)) - -} - -func (s *BlobSASURISuite) Test_blobSASStringToSign(c *chk.C) { - _, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP", "", "") - c.Assert(err, chk.NotNil) // not implemented SAS for versions earlier than 2013-08-15 - - out, err := blobSASStringToSign(oldAPIVer, "CS", "SE", "SP", "", "") - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, "SP\n\nSE\nCS\n\n2013-08-15\n\n\n\n\n") - - // check format for 2015-04-05 version - out, err = blobSASStringToSign(newerAPIVer, "CS", "SE", "SP", "127.0.0.1", "https,http") - c.Assert(err, chk.IsNil) - c.Assert(out, chk.Equals, "SP\n\nSE\n/blobCS\n\n127.0.0.1\nhttps,http\n2015-04-05\n\n\n\n\n") -} +package storage + +import ( + "io/ioutil" + "net/http" + "net/url" + "time" + + chk "gopkg.in/check.v1" +) + +type BlobSASURISuite struct{} + +var _ = chk.Suite(&BlobSASURISuite{}) + +var oldAPIVer = "2013-08-15" +var newerAPIVer = "2015-04-05" + +func (s *BlobSASURISuite) TestGetBlobSASURI(c *chk.C) { + api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, oldAPIVer, true) + c.Assert(err, chk.IsNil) + cli := api.GetBlobService() + cnt := cli.GetContainerReference("container") + b := cnt.GetBlobReference("name") + expiry := time.Time{} + + expectedParts := url.URL{ + Scheme: "https", + Host: "foo.blob.core.windows.net", + Path: "container/name", + RawQuery: url.Values{ + "sv": {oldAPIVer}, + "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, + "sr": {"b"}, + "sp": {"r"}, + "se": {"0001-01-01T00:00:00Z"}, + }.Encode()} + + u, err := b.GetSASURI(expiry, "r") + c.Assert(err, chk.IsNil) + sasParts, err := url.Parse(u) + c.Assert(err, chk.IsNil) + c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) + c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) +} + +//Gets a SASURI for the entire container +func (s *BlobSASURISuite) TestGetBlobSASURIContainer(c *chk.C) { + api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, oldAPIVer, true) + c.Assert(err, chk.IsNil) + cli := api.GetBlobService() + cnt := cli.GetContainerReference("container") + b := cnt.GetBlobReference("") + expiry := time.Time{} + + expectedParts := url.URL{ + Scheme: "https", + Host: "foo.blob.core.windows.net", + Path: "container", + RawQuery: url.Values{ + "sv": {oldAPIVer}, + "sig": {"KMjYyQODKp6uK9EKR3yGhO2M84e1LfoztypU32kHj4s="}, + "sr": {"c"}, + "sp": {"r"}, + "se": {"0001-01-01T00:00:00Z"}, + }.Encode()} + + u, err := b.GetSASURI(expiry, "r") + c.Assert(err, chk.IsNil) + sasParts, err := url.Parse(u) + c.Assert(err, chk.IsNil) + c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) + c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) +} + +func (s *BlobSASURISuite) TestGetBlobSASURIWithSignedIPAndProtocolValidAPIVersionPassed(c *chk.C) { + api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, newerAPIVer, true) + c.Assert(err, chk.IsNil) + cli := api.GetBlobService() + cnt := cli.GetContainerReference("container") + b := cnt.GetBlobReference("name") + expiry := time.Time{} + + expectedParts := url.URL{ + Scheme: "https", + Host: "foo.blob.core.windows.net", + Path: "/container/name", + RawQuery: url.Values{ + "sv": {newerAPIVer}, + "sig": {"VBOYJmt89UuBRXrxNzmsCMoC+8PXX2yklV71QcL1BfM="}, + "sr": {"b"}, + "sip": {"127.0.0.1"}, + "sp": {"r"}, + "se": {"0001-01-01T00:00:00Z"}, + "spr": {"https"}, + }.Encode()} + + u, err := b.GetSASURIWithSignedIPAndProtocol(expiry, "r", "127.0.0.1", true) + c.Assert(err, chk.IsNil) + sasParts, err := url.Parse(u) + c.Assert(err, chk.IsNil) + c.Assert(sasParts.Query(), chk.DeepEquals, expectedParts.Query()) +} + +// Trying to use SignedIP and Protocol but using an older version of the API. +// Should ignore the signedIP/protocol and just use what the older version requires. +func (s *BlobSASURISuite) TestGetBlobSASURIWithSignedIPAndProtocolUsingOldAPIVersion(c *chk.C) { + api, err := NewClient("foo", dummyMiniStorageKey, DefaultBaseURL, oldAPIVer, true) + c.Assert(err, chk.IsNil) + cli := api.GetBlobService() + cnt := cli.GetContainerReference("container") + b := cnt.GetBlobReference("name") + expiry := time.Time{} + + expectedParts := url.URL{ + Scheme: "https", + Host: "foo.blob.core.windows.net", + Path: "/container/name", + RawQuery: url.Values{ + "sv": {oldAPIVer}, + "sig": {"/OXG7rWh08jYwtU03GzJM0DHZtidRGpC6g69rSGm3I0="}, + "sr": {"b"}, + "sp": {"r"}, + "se": {"0001-01-01T00:00:00Z"}, + }.Encode()} + + u, err := b.GetSASURIWithSignedIPAndProtocol(expiry, "r", "", true) + c.Assert(err, chk.IsNil) + sasParts, err := url.Parse(u) + c.Assert(err, chk.IsNil) + c.Assert(expectedParts.String(), chk.Equals, sasParts.String()) + c.Assert(expectedParts.Query(), chk.DeepEquals, sasParts.Query()) +} + +func (s *BlobSASURISuite) TestBlobSASURICorrectness(c *chk.C) { + cli := getBlobClient(c) + + if cli.client.usesDummies() { + c.Skip("As GetSASURI result depends on the account key, it is not practical to test it with a dummy key.") + } + + simpleClient := &http.Client{} + rec := cli.client.appendRecorder(c) + simpleClient.Transport = rec + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + b := cnt.GetBlobReference(contentWithSpecialChars(5)) + defer cnt.Delete(nil) + + body := content(100) + expiry := fixedTime.UTC().Add(time.Hour) + permissions := "r" + + c.Assert(b.putSingleBlockBlob(body), chk.IsNil) + + sasURI, err := b.GetSASURI(expiry, permissions) + c.Assert(err, chk.IsNil) + + resp, err := simpleClient.Get(sasURI) + c.Assert(err, chk.IsNil) + + blobResp, err := ioutil.ReadAll(resp.Body) + defer resp.Body.Close() + c.Assert(err, chk.IsNil) + + c.Assert(resp.StatusCode, chk.Equals, http.StatusOK) + c.Assert(string(blobResp), chk.Equals, string(body)) + +} + +func (s *BlobSASURISuite) Test_blobSASStringToSign(c *chk.C) { + _, err := blobSASStringToSign("2012-02-12", "CS", "SE", "SP", "", "") + c.Assert(err, chk.NotNil) // not implemented SAS for versions earlier than 2013-08-15 + + out, err := blobSASStringToSign(oldAPIVer, "CS", "SE", "SP", "", "") + c.Assert(err, chk.IsNil) + c.Assert(out, chk.Equals, "SP\n\nSE\nCS\n\n2013-08-15\n\n\n\n\n") + + // check format for 2015-04-05 version + out, err = blobSASStringToSign(newerAPIVer, "CS", "SE", "SP", "127.0.0.1", "https,http") + c.Assert(err, chk.IsNil) + c.Assert(out, chk.Equals, "SP\n\nSE\n/blobCS\n\n127.0.0.1\nhttps,http\n2015-04-05\n\n\n\n\n") +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go index 93128d06a3..450b20f967 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go @@ -1,95 +1,95 @@ -package storage - -import ( - "net/http" - "net/url" - "strconv" -) - -// BlobStorageClient contains operations for Microsoft Azure Blob Storage -// Service. -type BlobStorageClient struct { - client Client - auth authentication -} - -// GetServiceProperties gets the properties of your storage account's blob service. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-service-properties -func (b *BlobStorageClient) GetServiceProperties() (*ServiceProperties, error) { - return b.client.getServiceProperties(blobServiceName, b.auth) -} - -// SetServiceProperties sets the properties of your storage account's blob service. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-blob-service-properties -func (b *BlobStorageClient) SetServiceProperties(props ServiceProperties) error { - return b.client.setServiceProperties(props, blobServiceName, b.auth) -} - -// ListContainersParameters defines the set of customizable parameters to make a -// List Containers call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -type ListContainersParameters struct { - Prefix string - Marker string - Include string - MaxResults uint - Timeout uint -} - -// GetContainerReference returns a Container object for the specified container name. -func (b *BlobStorageClient) GetContainerReference(name string) *Container { - return &Container{ - bsc: b, - Name: name, - } -} - -// ListContainers returns the list of containers in a storage account along with -// pagination token and other response details. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -func (b BlobStorageClient) ListContainers(params ListContainersParameters) (*ContainerListResponse, error) { - q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}}) - uri := b.client.getEndpoint(blobServiceName, "", q) - headers := b.client.getStandardHeaders() - - var out ContainerListResponse - resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - err = xmlUnmarshal(resp.body, &out) - if err != nil { - return nil, err - } - - // assign our client to the newly created Container objects - for i := range out.Containers { - out.Containers[i].bsc = &b - } - return &out, err -} - -func (p ListContainersParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.Include != "" { - out.Set("include", p.Include) - } - if p.MaxResults != 0 { - out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) - } - if p.Timeout != 0 { - out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10)) - } - - return out -} +package storage + +import ( + "net/http" + "net/url" + "strconv" +) + +// BlobStorageClient contains operations for Microsoft Azure Blob Storage +// Service. +type BlobStorageClient struct { + client Client + auth authentication +} + +// GetServiceProperties gets the properties of your storage account's blob service. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-service-properties +func (b *BlobStorageClient) GetServiceProperties() (*ServiceProperties, error) { + return b.client.getServiceProperties(blobServiceName, b.auth) +} + +// SetServiceProperties sets the properties of your storage account's blob service. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-blob-service-properties +func (b *BlobStorageClient) SetServiceProperties(props ServiceProperties) error { + return b.client.setServiceProperties(props, blobServiceName, b.auth) +} + +// ListContainersParameters defines the set of customizable parameters to make a +// List Containers call. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx +type ListContainersParameters struct { + Prefix string + Marker string + Include string + MaxResults uint + Timeout uint +} + +// GetContainerReference returns a Container object for the specified container name. +func (b *BlobStorageClient) GetContainerReference(name string) *Container { + return &Container{ + bsc: b, + Name: name, + } +} + +// ListContainers returns the list of containers in a storage account along with +// pagination token and other response details. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx +func (b BlobStorageClient) ListContainers(params ListContainersParameters) (*ContainerListResponse, error) { + q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}}) + uri := b.client.getEndpoint(blobServiceName, "", q) + headers := b.client.getStandardHeaders() + + var out ContainerListResponse + resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + err = xmlUnmarshal(resp.body, &out) + if err != nil { + return nil, err + } + + // assign our client to the newly created Container objects + for i := range out.Containers { + out.Containers[i].bsc = &b + } + return &out, err +} + +func (p ListContainersParameters) getParameters() url.Values { + out := url.Values{} + + if p.Prefix != "" { + out.Set("prefix", p.Prefix) + } + if p.Marker != "" { + out.Set("marker", p.Marker) + } + if p.Include != "" { + out.Set("include", p.Include) + } + if p.MaxResults != 0 { + out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) + } + if p.Timeout != 0 { + out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10)) + } + + return out +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go index ec4da7caec..09b13cc185 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go @@ -1,225 +1,225 @@ -package storage - -import ( - "bytes" - "encoding/xml" - "fmt" - "io" - "net/http" - "net/url" - "strings" - "time" -) - -// BlockListType is used to filter out types of blocks in a Get Blocks List call -// for a block blob. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx for all -// block types. -type BlockListType string - -// Filters for listing blocks in block blobs -const ( - BlockListTypeAll BlockListType = "all" - BlockListTypeCommitted BlockListType = "committed" - BlockListTypeUncommitted BlockListType = "uncommitted" -) - -// Maximum sizes (per REST API) for various concepts -const ( - MaxBlobBlockSize = 100 * 1024 * 1024 - MaxBlobPageSize = 4 * 1024 * 1024 -) - -// BlockStatus defines states a block for a block blob can -// be in. -type BlockStatus string - -// List of statuses that can be used to refer to a block in a block list -const ( - BlockStatusUncommitted BlockStatus = "Uncommitted" - BlockStatusCommitted BlockStatus = "Committed" - BlockStatusLatest BlockStatus = "Latest" -) - -// Block is used to create Block entities for Put Block List -// call. -type Block struct { - ID string - Status BlockStatus -} - -// BlockListResponse contains the response fields from Get Block List call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx -type BlockListResponse struct { - XMLName xml.Name `xml:"BlockList"` - CommittedBlocks []BlockResponse `xml:"CommittedBlocks>Block"` - UncommittedBlocks []BlockResponse `xml:"UncommittedBlocks>Block"` -} - -// BlockResponse contains the block information returned -// in the GetBlockListCall. -type BlockResponse struct { - Name string `xml:"Name"` - Size int64 `xml:"Size"` -} - -// CreateBlockBlob initializes an empty block blob with no blocks. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob -func (b *Blob) CreateBlockBlob(options *PutBlobOptions) error { - return b.CreateBlockBlobFromReader(nil, options) -} - -// CreateBlockBlobFromReader initializes a block blob using data from -// reader. Size must be the number of bytes read from reader. To -// create an empty blob, use size==0 and reader==nil. -// -// The API rejects requests with size > 256 MiB (but this limit is not -// checked by the SDK). To write a larger blob, use CreateBlockBlob, -// PutBlock, and PutBlockList. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob -func (b *Blob) CreateBlockBlobFromReader(blob io.Reader, options *PutBlobOptions) error { - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypeBlock) - headers["Content-Length"] = fmt.Sprintf("%d", b.Properties.ContentLength) - headers = mergeHeaders(headers, headersFromStruct(b.Properties)) - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, blob, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// PutBlockOptions includes the options for a put block operation -type PutBlockOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - ContentMD5 string `header:"Content-MD5"` - RequestID string `header:"x-ms-client-request-id"` -} - -// PutBlock saves the given data chunk to the specified block blob with -// given ID. -// -// The API rejects chunks larger than 100 MiB (but this limit is not -// checked by the SDK). -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block -func (b *Blob) PutBlock(blockID string, chunk []byte, options *PutBlockOptions) error { - return b.PutBlockWithLength(blockID, uint64(len(chunk)), bytes.NewReader(chunk), options) -} - -// PutBlockWithLength saves the given data stream of exactly specified size to -// the block blob with given ID. It is an alternative to PutBlocks where data -// comes as stream but the length is known in advance. -// -// The API rejects requests with size > 100 MiB (but this limit is not -// checked by the SDK). -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block -func (b *Blob) PutBlockWithLength(blockID string, size uint64, blob io.Reader, options *PutBlockOptions) error { - query := url.Values{ - "comp": {"block"}, - "blockid": {blockID}, - } - headers := b.Container.bsc.client.getStandardHeaders() - headers["Content-Length"] = fmt.Sprintf("%v", size) - - if options != nil { - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), query) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, blob, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// PutBlockListOptions includes the options for a put block list operation -type PutBlockListOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// PutBlockList saves list of blocks to the specified block blob. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block-List -func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error { - params := url.Values{"comp": {"blocklist"}} - blockListXML := prepareBlockListRequest(blocks) - headers := b.Container.bsc.client.getStandardHeaders() - headers["Content-Length"] = fmt.Sprintf("%v", len(blockListXML)) - headers = mergeHeaders(headers, headersFromStruct(b.Properties)) - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, strings.NewReader(blockListXML), b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// GetBlockListOptions includes the options for a get block list operation -type GetBlockListOptions struct { - Timeout uint - Snapshot *time.Time - LeaseID string `header:"x-ms-lease-id"` - RequestID string `header:"x-ms-client-request-id"` -} - -// GetBlockList retrieves list of blocks in the specified block blob. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Block-List -func (b *Blob) GetBlockList(blockType BlockListType, options *GetBlockListOptions) (BlockListResponse, error) { - params := url.Values{ - "comp": {"blocklist"}, - "blocklisttype": {string(blockType)}, - } - headers := b.Container.bsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - params = addSnapshot(params, options.Snapshot) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - var out BlockListResponse - resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - err = xmlUnmarshal(resp.body, &out) - return out, err -} +package storage + +import ( + "bytes" + "encoding/xml" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" +) + +// BlockListType is used to filter out types of blocks in a Get Blocks List call +// for a block blob. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx for all +// block types. +type BlockListType string + +// Filters for listing blocks in block blobs +const ( + BlockListTypeAll BlockListType = "all" + BlockListTypeCommitted BlockListType = "committed" + BlockListTypeUncommitted BlockListType = "uncommitted" +) + +// Maximum sizes (per REST API) for various concepts +const ( + MaxBlobBlockSize = 100 * 1024 * 1024 + MaxBlobPageSize = 4 * 1024 * 1024 +) + +// BlockStatus defines states a block for a block blob can +// be in. +type BlockStatus string + +// List of statuses that can be used to refer to a block in a block list +const ( + BlockStatusUncommitted BlockStatus = "Uncommitted" + BlockStatusCommitted BlockStatus = "Committed" + BlockStatusLatest BlockStatus = "Latest" +) + +// Block is used to create Block entities for Put Block List +// call. +type Block struct { + ID string + Status BlockStatus +} + +// BlockListResponse contains the response fields from Get Block List call. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx +type BlockListResponse struct { + XMLName xml.Name `xml:"BlockList"` + CommittedBlocks []BlockResponse `xml:"CommittedBlocks>Block"` + UncommittedBlocks []BlockResponse `xml:"UncommittedBlocks>Block"` +} + +// BlockResponse contains the block information returned +// in the GetBlockListCall. +type BlockResponse struct { + Name string `xml:"Name"` + Size int64 `xml:"Size"` +} + +// CreateBlockBlob initializes an empty block blob with no blocks. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob +func (b *Blob) CreateBlockBlob(options *PutBlobOptions) error { + return b.CreateBlockBlobFromReader(nil, options) +} + +// CreateBlockBlobFromReader initializes a block blob using data from +// reader. Size must be the number of bytes read from reader. To +// create an empty blob, use size==0 and reader==nil. +// +// The API rejects requests with size > 256 MiB (but this limit is not +// checked by the SDK). To write a larger blob, use CreateBlockBlob, +// PutBlock, and PutBlockList. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob +func (b *Blob) CreateBlockBlobFromReader(blob io.Reader, options *PutBlobOptions) error { + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-blob-type"] = string(BlobTypeBlock) + headers["Content-Length"] = fmt.Sprintf("%d", b.Properties.ContentLength) + headers = mergeHeaders(headers, headersFromStruct(b.Properties)) + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, blob, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// PutBlockOptions includes the options for a put block operation +type PutBlockOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + ContentMD5 string `header:"Content-MD5"` + RequestID string `header:"x-ms-client-request-id"` +} + +// PutBlock saves the given data chunk to the specified block blob with +// given ID. +// +// The API rejects chunks larger than 100 MiB (but this limit is not +// checked by the SDK). +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block +func (b *Blob) PutBlock(blockID string, chunk []byte, options *PutBlockOptions) error { + return b.PutBlockWithLength(blockID, uint64(len(chunk)), bytes.NewReader(chunk), options) +} + +// PutBlockWithLength saves the given data stream of exactly specified size to +// the block blob with given ID. It is an alternative to PutBlocks where data +// comes as stream but the length is known in advance. +// +// The API rejects requests with size > 100 MiB (but this limit is not +// checked by the SDK). +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block +func (b *Blob) PutBlockWithLength(blockID string, size uint64, blob io.Reader, options *PutBlockOptions) error { + query := url.Values{ + "comp": {"block"}, + "blockid": {blockID}, + } + headers := b.Container.bsc.client.getStandardHeaders() + headers["Content-Length"] = fmt.Sprintf("%v", size) + + if options != nil { + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), query) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, blob, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// PutBlockListOptions includes the options for a put block list operation +type PutBlockListOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// PutBlockList saves list of blocks to the specified block blob. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block-List +func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error { + params := url.Values{"comp": {"blocklist"}} + blockListXML := prepareBlockListRequest(blocks) + headers := b.Container.bsc.client.getStandardHeaders() + headers["Content-Length"] = fmt.Sprintf("%v", len(blockListXML)) + headers = mergeHeaders(headers, headersFromStruct(b.Properties)) + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, strings.NewReader(blockListXML), b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// GetBlockListOptions includes the options for a get block list operation +type GetBlockListOptions struct { + Timeout uint + Snapshot *time.Time + LeaseID string `header:"x-ms-lease-id"` + RequestID string `header:"x-ms-client-request-id"` +} + +// GetBlockList retrieves list of blocks in the specified block blob. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Block-List +func (b *Blob) GetBlockList(blockType BlockListType, options *GetBlockListOptions) (BlockListResponse, error) { + params := url.Values{ + "comp": {"blocklist"}, + "blocklisttype": {string(blockType)}, + } + headers := b.Container.bsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + params = addSnapshot(params, options.Snapshot) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + var out BlockListResponse + resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return out, err + } + defer resp.body.Close() + + err = xmlUnmarshal(resp.body, &out) + return out, err +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob_test.go index af5ae89cc4..b639fc7a65 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob_test.go @@ -1,152 +1,152 @@ -package storage - -import ( - "bytes" - "encoding/base64" - "io/ioutil" - - chk "gopkg.in/check.v1" -) - -type BlockBlobSuite struct{} - -var _ = chk.Suite(&BlockBlobSuite{}) - -func (s *BlockBlobSuite) TestCreateBlockBlobFromReader(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - data := content(8888) - b.Properties.ContentLength = int64(len(data)) - c.Assert(b.CreateBlockBlobFromReader(bytes.NewReader(data), nil), chk.IsNil) - - resp, err := b.Get(nil) - c.Assert(err, chk.IsNil) - gotData, err := ioutil.ReadAll(resp) - defer resp.Close() - - c.Assert(err, chk.IsNil) - c.Assert(gotData, chk.DeepEquals, data) -} - -func (s *BlockBlobSuite) TestCreateBlockBlobFromReaderWithShortData(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - data := content(8888) - b.Properties.ContentLength = 9999 - err := b.CreateBlockBlobFromReader(bytes.NewReader(data), nil) - c.Assert(err, chk.NotNil) - - _, err = b.Get(nil) - // Upload was incomplete: blob should not have been created. - c.Assert(err, chk.NotNil) -} - -func (s *BlockBlobSuite) TestPutBlock(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - chunk := content(1024) - blockID := base64.StdEncoding.EncodeToString([]byte("lol")) - c.Assert(b.PutBlock(blockID, chunk, nil), chk.IsNil) -} - -func (s *BlockBlobSuite) TestGetBlockList_PutBlockList(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - chunk := content(1024) - blockID := base64.StdEncoding.EncodeToString([]byte("lol")) - - // Put one block - c.Assert(b.PutBlock(blockID, chunk, nil), chk.IsNil) - defer b.Delete(nil) - - // Get committed blocks - committed, err := b.GetBlockList(BlockListTypeCommitted, nil) - c.Assert(err, chk.IsNil) - - if len(committed.CommittedBlocks) > 0 { - c.Fatal("There are committed blocks") - } - - // Get uncommitted blocks - uncommitted, err := b.GetBlockList(BlockListTypeUncommitted, nil) - c.Assert(err, chk.IsNil) - - c.Assert(len(uncommitted.UncommittedBlocks), chk.Equals, 1) - // Commit block list - c.Assert(b.PutBlockList([]Block{{blockID, BlockStatusUncommitted}}, nil), chk.IsNil) - - // Get all blocks - all, err := b.GetBlockList(BlockListTypeAll, nil) - c.Assert(err, chk.IsNil) - c.Assert(len(all.CommittedBlocks), chk.Equals, 1) - c.Assert(len(all.UncommittedBlocks), chk.Equals, 0) - - // Verify the block - thatBlock := all.CommittedBlocks[0] - c.Assert(thatBlock.Name, chk.Equals, blockID) - c.Assert(thatBlock.Size, chk.Equals, int64(len(chunk))) -} - -func (s *BlockBlobSuite) TestCreateBlockBlob(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.CreateBlockBlob(nil), chk.IsNil) - - // Verify - blocks, err := b.GetBlockList(BlockListTypeAll, nil) - c.Assert(err, chk.IsNil) - c.Assert(len(blocks.CommittedBlocks), chk.Equals, 0) - c.Assert(len(blocks.UncommittedBlocks), chk.Equals, 0) -} - -func (s *BlockBlobSuite) TestPutEmptyBlockBlob(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - err := b.GetProperties(nil) - c.Assert(err, chk.IsNil) - c.Assert(b.Properties.ContentLength, chk.Not(chk.Equals), 0) -} +package storage + +import ( + "bytes" + "encoding/base64" + "io/ioutil" + + chk "gopkg.in/check.v1" +) + +type BlockBlobSuite struct{} + +var _ = chk.Suite(&BlockBlobSuite{}) + +func (s *BlockBlobSuite) TestCreateBlockBlobFromReader(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + data := content(8888) + b.Properties.ContentLength = int64(len(data)) + c.Assert(b.CreateBlockBlobFromReader(bytes.NewReader(data), nil), chk.IsNil) + + resp, err := b.Get(nil) + c.Assert(err, chk.IsNil) + gotData, err := ioutil.ReadAll(resp) + defer resp.Close() + + c.Assert(err, chk.IsNil) + c.Assert(gotData, chk.DeepEquals, data) +} + +func (s *BlockBlobSuite) TestCreateBlockBlobFromReaderWithShortData(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + data := content(8888) + b.Properties.ContentLength = 9999 + err := b.CreateBlockBlobFromReader(bytes.NewReader(data), nil) + c.Assert(err, chk.NotNil) + + _, err = b.Get(nil) + // Upload was incomplete: blob should not have been created. + c.Assert(err, chk.NotNil) +} + +func (s *BlockBlobSuite) TestPutBlock(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + chunk := content(1024) + blockID := base64.StdEncoding.EncodeToString([]byte("lol")) + c.Assert(b.PutBlock(blockID, chunk, nil), chk.IsNil) +} + +func (s *BlockBlobSuite) TestGetBlockList_PutBlockList(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + chunk := content(1024) + blockID := base64.StdEncoding.EncodeToString([]byte("lol")) + + // Put one block + c.Assert(b.PutBlock(blockID, chunk, nil), chk.IsNil) + defer b.Delete(nil) + + // Get committed blocks + committed, err := b.GetBlockList(BlockListTypeCommitted, nil) + c.Assert(err, chk.IsNil) + + if len(committed.CommittedBlocks) > 0 { + c.Fatal("There are committed blocks") + } + + // Get uncommitted blocks + uncommitted, err := b.GetBlockList(BlockListTypeUncommitted, nil) + c.Assert(err, chk.IsNil) + + c.Assert(len(uncommitted.UncommittedBlocks), chk.Equals, 1) + // Commit block list + c.Assert(b.PutBlockList([]Block{{blockID, BlockStatusUncommitted}}, nil), chk.IsNil) + + // Get all blocks + all, err := b.GetBlockList(BlockListTypeAll, nil) + c.Assert(err, chk.IsNil) + c.Assert(len(all.CommittedBlocks), chk.Equals, 1) + c.Assert(len(all.UncommittedBlocks), chk.Equals, 0) + + // Verify the block + thatBlock := all.CommittedBlocks[0] + c.Assert(thatBlock.Name, chk.Equals, blockID) + c.Assert(thatBlock.Size, chk.Equals, int64(len(chunk))) +} + +func (s *BlockBlobSuite) TestCreateBlockBlob(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.CreateBlockBlob(nil), chk.IsNil) + + // Verify + blocks, err := b.GetBlockList(BlockListTypeAll, nil) + c.Assert(err, chk.IsNil) + c.Assert(len(blocks.CommittedBlocks), chk.Equals, 0) + c.Assert(len(blocks.UncommittedBlocks), chk.Equals, 0) +} + +func (s *BlockBlobSuite) TestPutEmptyBlockBlob(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + err := b.GetProperties(nil) + c.Assert(err, chk.IsNil) + c.Assert(b.Properties.ContentLength, chk.Not(chk.Equals), 0) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go index b6eba6d241..b4ac22d825 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go @@ -1,652 +1,652 @@ -// Package storage provides clients for Microsoft Azure Storage Services. -package storage - -import ( - "bufio" - "bytes" - "encoding/base64" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "io/ioutil" - "mime" - "mime/multipart" - "net/http" - "net/url" - "regexp" - "runtime" - "strconv" - "strings" - "time" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -const ( - // DefaultBaseURL is the domain name used for storage requests in the - // public cloud when a default client is created. - DefaultBaseURL = "core.windows.net" - - // DefaultAPIVersion is the Azure Storage API version string used when a - // basic client is created. - DefaultAPIVersion = "2016-05-31" - - defaultUseHTTPS = true - - // StorageEmulatorAccountName is the fixed storage account used by Azure Storage Emulator - StorageEmulatorAccountName = "devstoreaccount1" - - // StorageEmulatorAccountKey is the the fixed storage account used by Azure Storage Emulator - StorageEmulatorAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" - - blobServiceName = "blob" - tableServiceName = "table" - queueServiceName = "queue" - fileServiceName = "file" - - storageEmulatorBlob = "127.0.0.1:10000" - storageEmulatorTable = "127.0.0.1:10002" - storageEmulatorQueue = "127.0.0.1:10001" - - userAgentHeader = "User-Agent" - - userDefinedMetadataHeaderPrefix = "x-ms-meta-" -) - -var ( - validStorageAccount = regexp.MustCompile("^[0-9a-z]{3,24}$") -) - -// Sender sends a request -type Sender interface { - Send(*Client, *http.Request) (*http.Response, error) -} - -// DefaultSender is the default sender for the client. It implements -// an automatic retry strategy. -type DefaultSender struct { - RetryAttempts int - RetryDuration time.Duration - ValidStatusCodes []int - attempts int // used for testing -} - -// Send is the default retry strategy in the client -func (ds *DefaultSender) Send(c *Client, req *http.Request) (resp *http.Response, err error) { - b := []byte{} - if req.Body != nil { - b, err = ioutil.ReadAll(req.Body) - if err != nil { - return resp, err - } - } - - for attempts := 0; attempts < ds.RetryAttempts; attempts++ { - if len(b) > 0 { - req.Body = ioutil.NopCloser(bytes.NewBuffer(b)) - } - resp, err = c.HTTPClient.Do(req) - if err != nil || !autorest.ResponseHasStatusCode(resp, ds.ValidStatusCodes...) { - return resp, err - } - autorest.DelayForBackoff(ds.RetryDuration, attempts, req.Cancel) - ds.attempts = attempts - } - ds.attempts++ - return resp, err -} - -// Client is the object that needs to be constructed to perform -// operations on the storage account. -type Client struct { - // HTTPClient is the http.Client used to initiate API - // requests. http.DefaultClient is used when creating a - // client. - HTTPClient *http.Client - - // Sender is an interface that sends the request. Clients are - // created with a DefaultSender. The DefaultSender has an - // automatic retry strategy built in. The Sender can be customized. - Sender Sender - - accountName string - accountKey []byte - useHTTPS bool - UseSharedKeyLite bool - baseURL string - apiVersion string - userAgent string -} - -type storageResponse struct { - statusCode int - headers http.Header - body io.ReadCloser -} - -type odataResponse struct { - storageResponse - odata odataErrorMessage -} - -// AzureStorageServiceError contains fields of the error response from -// Azure Storage Service REST API. See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx -// Some fields might be specific to certain calls. -type AzureStorageServiceError struct { - Code string `xml:"Code"` - Message string `xml:"Message"` - AuthenticationErrorDetail string `xml:"AuthenticationErrorDetail"` - QueryParameterName string `xml:"QueryParameterName"` - QueryParameterValue string `xml:"QueryParameterValue"` - Reason string `xml:"Reason"` - StatusCode int - RequestID string - Date string - APIVersion string -} - -type odataErrorMessageMessage struct { - Lang string `json:"lang"` - Value string `json:"value"` -} - -type odataErrorMessageInternal struct { - Code string `json:"code"` - Message odataErrorMessageMessage `json:"message"` -} - -type odataErrorMessage struct { - Err odataErrorMessageInternal `json:"odata.error"` -} - -// UnexpectedStatusCodeError is returned when a storage service responds with neither an error -// nor with an HTTP status code indicating success. -type UnexpectedStatusCodeError struct { - allowed []int - got int -} - -func (e UnexpectedStatusCodeError) Error() string { - s := func(i int) string { return fmt.Sprintf("%d %s", i, http.StatusText(i)) } - - got := s(e.got) - expected := []string{} - for _, v := range e.allowed { - expected = append(expected, s(v)) - } - return fmt.Sprintf("storage: status code from service response is %s; was expecting %s", got, strings.Join(expected, " or ")) -} - -// Got is the actual status code returned by Azure. -func (e UnexpectedStatusCodeError) Got() int { - return e.got -} - -// NewBasicClient constructs a Client with given storage service name and -// key. -func NewBasicClient(accountName, accountKey string) (Client, error) { - if accountName == StorageEmulatorAccountName { - return NewEmulatorClient() - } - return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS) -} - -// NewBasicClientOnSovereignCloud constructs a Client with given storage service name and -// key in the referenced cloud. -func NewBasicClientOnSovereignCloud(accountName, accountKey string, env azure.Environment) (Client, error) { - if accountName == StorageEmulatorAccountName { - return NewEmulatorClient() - } - return NewClient(accountName, accountKey, env.StorageEndpointSuffix, DefaultAPIVersion, defaultUseHTTPS) -} - -//NewEmulatorClient contructs a Client intended to only work with Azure -//Storage Emulator -func NewEmulatorClient() (Client, error) { - return NewClient(StorageEmulatorAccountName, StorageEmulatorAccountKey, DefaultBaseURL, DefaultAPIVersion, false) -} - -// NewClient constructs a Client. This should be used if the caller wants -// to specify whether to use HTTPS, a specific REST API version or a custom -// storage endpoint than Azure Public Cloud. -func NewClient(accountName, accountKey, blobServiceBaseURL, apiVersion string, useHTTPS bool) (Client, error) { - var c Client - if !IsValidStorageAccount(accountName) { - return c, fmt.Errorf("azure: account name is not valid: it must be between 3 and 24 characters, and only may contain numbers and lowercase letters: %v", accountName) - } else if accountKey == "" { - return c, fmt.Errorf("azure: account key required") - } else if blobServiceBaseURL == "" { - return c, fmt.Errorf("azure: base storage service url required") - } - - key, err := base64.StdEncoding.DecodeString(accountKey) - if err != nil { - return c, fmt.Errorf("azure: malformed storage account key: %v", err) - } - - c = Client{ - HTTPClient: http.DefaultClient, - accountName: accountName, - accountKey: key, - useHTTPS: useHTTPS, - baseURL: blobServiceBaseURL, - apiVersion: apiVersion, - UseSharedKeyLite: false, - Sender: &DefaultSender{ - RetryAttempts: 5, - ValidStatusCodes: []int{ - http.StatusRequestTimeout, // 408 - http.StatusInternalServerError, // 500 - http.StatusBadGateway, // 502 - http.StatusServiceUnavailable, // 503 - http.StatusGatewayTimeout, // 504 - }, - RetryDuration: time.Second * 5, - }, - } - c.userAgent = c.getDefaultUserAgent() - return c, nil -} - -// IsValidStorageAccount checks if the storage account name is valid. -// See https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account -func IsValidStorageAccount(account string) bool { - return validStorageAccount.MatchString(account) -} - -func (c Client) getDefaultUserAgent() string { - return fmt.Sprintf("Go/%s (%s-%s) azure-storage-go/%s api-version/%s", - runtime.Version(), - runtime.GOARCH, - runtime.GOOS, - sdkVersion, - c.apiVersion, - ) -} - -// AddToUserAgent adds an extension to the current user agent -func (c *Client) AddToUserAgent(extension string) error { - if extension != "" { - c.userAgent = fmt.Sprintf("%s %s", c.userAgent, extension) - return nil - } - return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.userAgent) -} - -// protectUserAgent is used in funcs that include extraheaders as a parameter. -// It prevents the User-Agent header to be overwritten, instead if it happens to -// be present, it gets added to the current User-Agent. Use it before getStandardHeaders -func (c *Client) protectUserAgent(extraheaders map[string]string) map[string]string { - if v, ok := extraheaders[userAgentHeader]; ok { - c.AddToUserAgent(v) - delete(extraheaders, userAgentHeader) - } - return extraheaders -} - -func (c Client) getBaseURL(service string) *url.URL { - scheme := "http" - if c.useHTTPS { - scheme = "https" - } - host := "" - if c.accountName == StorageEmulatorAccountName { - switch service { - case blobServiceName: - host = storageEmulatorBlob - case tableServiceName: - host = storageEmulatorTable - case queueServiceName: - host = storageEmulatorQueue - } - } else { - host = fmt.Sprintf("%s.%s.%s", c.accountName, service, c.baseURL) - } - - return &url.URL{ - Scheme: scheme, - Host: host, - } -} - -func (c Client) getEndpoint(service, path string, params url.Values) string { - u := c.getBaseURL(service) - - // API doesn't accept path segments not starting with '/' - if !strings.HasPrefix(path, "/") { - path = fmt.Sprintf("/%v", path) - } - - if c.accountName == StorageEmulatorAccountName { - path = fmt.Sprintf("/%v%v", StorageEmulatorAccountName, path) - } - - u.Path = path - u.RawQuery = params.Encode() - return u.String() -} - -// GetBlobService returns a BlobStorageClient which can operate on the blob -// service of the storage account. -func (c Client) GetBlobService() BlobStorageClient { - b := BlobStorageClient{ - client: c, - } - b.client.AddToUserAgent(blobServiceName) - b.auth = sharedKey - if c.UseSharedKeyLite { - b.auth = sharedKeyLite - } - return b -} - -// GetQueueService returns a QueueServiceClient which can operate on the queue -// service of the storage account. -func (c Client) GetQueueService() QueueServiceClient { - q := QueueServiceClient{ - client: c, - } - q.client.AddToUserAgent(queueServiceName) - q.auth = sharedKey - if c.UseSharedKeyLite { - q.auth = sharedKeyLite - } - return q -} - -// GetTableService returns a TableServiceClient which can operate on the table -// service of the storage account. -func (c Client) GetTableService() TableServiceClient { - t := TableServiceClient{ - client: c, - } - t.client.AddToUserAgent(tableServiceName) - t.auth = sharedKeyForTable - if c.UseSharedKeyLite { - t.auth = sharedKeyLiteForTable - } - return t -} - -// GetFileService returns a FileServiceClient which can operate on the file -// service of the storage account. -func (c Client) GetFileService() FileServiceClient { - f := FileServiceClient{ - client: c, - } - f.client.AddToUserAgent(fileServiceName) - f.auth = sharedKey - if c.UseSharedKeyLite { - f.auth = sharedKeyLite - } - return f -} - -func (c Client) getStandardHeaders() map[string]string { - return map[string]string{ - userAgentHeader: c.userAgent, - "x-ms-version": c.apiVersion, - "x-ms-date": currentTimeRfc1123Formatted(), - } -} - -func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*storageResponse, error) { - headers, err := c.addAuthorizationHeader(verb, url, headers, auth) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(verb, url, body) - if err != nil { - return nil, errors.New("azure/storage: error creating request: " + err.Error()) - } - - if clstr, ok := headers["Content-Length"]; ok { - // content length header is being signed, but completely ignored by golang. - // instead we have to use the ContentLength property on the request struct - // (see https://golang.org/src/net/http/request.go?s=18140:18370#L536 and - // https://golang.org/src/net/http/transfer.go?s=1739:2467#L49) - req.ContentLength, err = strconv.ParseInt(clstr, 10, 64) - if err != nil { - return nil, err - } - } - for k, v := range headers { - req.Header.Add(k, v) - } - - resp, err := c.Sender.Send(&c, req) - if err != nil { - return nil, err - } - - statusCode := resp.StatusCode - if statusCode >= 400 && statusCode <= 505 { - var respBody []byte - respBody, err = readAndCloseBody(resp.Body) - if err != nil { - return nil, err - } - - requestID, date, version := getDebugHeaders(resp.Header) - if len(respBody) == 0 { - // no error in response body, might happen in HEAD requests - err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version) - } else { - // response contains storage service error object, unmarshal - storageErr, errIn := serviceErrFromXML(respBody, resp.StatusCode, requestID, date, version) - if err != nil { // error unmarshaling the error response - err = errIn - } - err = storageErr - } - return &storageResponse{ - statusCode: resp.StatusCode, - headers: resp.Header, - body: ioutil.NopCloser(bytes.NewReader(respBody)), /* restore the body */ - }, err - } - - return &storageResponse{ - statusCode: resp.StatusCode, - headers: resp.Header, - body: resp.Body}, nil -} - -func (c Client) execInternalJSONCommon(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, *http.Request, *http.Response, error) { - headers, err := c.addAuthorizationHeader(verb, url, headers, auth) - if err != nil { - return nil, nil, nil, err - } - - req, err := http.NewRequest(verb, url, body) - for k, v := range headers { - req.Header.Add(k, v) - } - - resp, err := c.Sender.Send(&c, req) - if err != nil { - return nil, nil, nil, err - } - - respToRet := &odataResponse{} - respToRet.body = resp.Body - respToRet.statusCode = resp.StatusCode - respToRet.headers = resp.Header - - statusCode := resp.StatusCode - if statusCode >= 400 && statusCode <= 505 { - var respBody []byte - respBody, err = readAndCloseBody(resp.Body) - if err != nil { - return nil, nil, nil, err - } - - requestID, date, version := getDebugHeaders(resp.Header) - if len(respBody) == 0 { - // no error in response body, might happen in HEAD requests - err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version) - return respToRet, req, resp, err - } - // try unmarshal as odata.error json - err = json.Unmarshal(respBody, &respToRet.odata) - } - - return respToRet, req, resp, err -} - -func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) { - respToRet, _, _, err := c.execInternalJSONCommon(verb, url, headers, body, auth) - return respToRet, err -} - -func (c Client) execBatchOperationJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) { - // execute common query, get back generated request, response etc... for more processing. - respToRet, req, resp, err := c.execInternalJSONCommon(verb, url, headers, body, auth) - if err != nil { - return nil, err - } - - // return the OData in the case of executing batch commands. - // In this case we need to read the outer batch boundary and contents. - // Then we read the changeset information within the batch - var respBody []byte - respBody, err = readAndCloseBody(resp.Body) - if err != nil { - return nil, err - } - - // outer multipart body - _, batchHeader, err := mime.ParseMediaType(resp.Header["Content-Type"][0]) - if err != nil { - return nil, err - } - - // batch details. - batchBoundary := batchHeader["boundary"] - batchPartBuf, changesetBoundary, err := genBatchReader(batchBoundary, respBody) - if err != nil { - return nil, err - } - - // changeset details. - err = genChangesetReader(req, respToRet, batchPartBuf, changesetBoundary) - if err != nil { - return nil, err - } - - return respToRet, nil -} - -func genChangesetReader(req *http.Request, respToRet *odataResponse, batchPartBuf io.Reader, changesetBoundary string) error { - changesetMultiReader := multipart.NewReader(batchPartBuf, changesetBoundary) - changesetPart, err := changesetMultiReader.NextPart() - if err != nil { - return err - } - - changesetPartBufioReader := bufio.NewReader(changesetPart) - changesetResp, err := http.ReadResponse(changesetPartBufioReader, req) - if err != nil { - return err - } - - if changesetResp.StatusCode != http.StatusNoContent { - changesetBody, err := readAndCloseBody(changesetResp.Body) - err = json.Unmarshal(changesetBody, &respToRet.odata) - if err != nil { - return err - } - respToRet.statusCode = changesetResp.StatusCode - } - - return nil -} - -func genBatchReader(batchBoundary string, respBody []byte) (io.Reader, string, error) { - respBodyString := string(respBody) - respBodyReader := strings.NewReader(respBodyString) - - // reading batchresponse - batchMultiReader := multipart.NewReader(respBodyReader, batchBoundary) - batchPart, err := batchMultiReader.NextPart() - if err != nil { - return nil, "", err - } - batchPartBufioReader := bufio.NewReader(batchPart) - - _, changesetHeader, err := mime.ParseMediaType(batchPart.Header.Get("Content-Type")) - if err != nil { - return nil, "", err - } - changesetBoundary := changesetHeader["boundary"] - return batchPartBufioReader, changesetBoundary, nil -} - -func readAndCloseBody(body io.ReadCloser) ([]byte, error) { - defer body.Close() - out, err := ioutil.ReadAll(body) - if err == io.EOF { - err = nil - } - return out, err -} - -func serviceErrFromXML(body []byte, statusCode int, requestID, date, version string) (AzureStorageServiceError, error) { - storageErr := AzureStorageServiceError{ - StatusCode: statusCode, - RequestID: requestID, - Date: date, - APIVersion: version, - } - if err := xml.Unmarshal(body, &storageErr); err != nil { - storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(body)) - return storageErr, err - } - return storageErr, nil -} - -func serviceErrFromStatusCode(code int, status string, requestID, date, version string) AzureStorageServiceError { - return AzureStorageServiceError{ - StatusCode: code, - Code: status, - RequestID: requestID, - Date: date, - APIVersion: version, - Message: "no response body was available for error status code", - } -} - -func (e AzureStorageServiceError) Error() string { - return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestInitiated=%s, RequestId=%s, API Version=%s, QueryParameterName=%s, QueryParameterValue=%s", - e.StatusCode, e.Code, e.Message, e.Date, e.RequestID, e.APIVersion, e.QueryParameterName, e.QueryParameterValue) -} - -// checkRespCode returns UnexpectedStatusError if the given response code is not -// one of the allowed status codes; otherwise nil. -func checkRespCode(respCode int, allowed []int) error { - for _, v := range allowed { - if respCode == v { - return nil - } - } - return UnexpectedStatusCodeError{allowed, respCode} -} - -func (c Client) addMetadataToHeaders(h map[string]string, metadata map[string]string) map[string]string { - metadata = c.protectUserAgent(metadata) - for k, v := range metadata { - h[userDefinedMetadataHeaderPrefix+k] = v - } - return h -} - -func getDebugHeaders(h http.Header) (requestID, date, version string) { - requestID = h.Get("x-ms-request-id") - version = h.Get("x-ms-version") - date = h.Get("Date") - return -} +// Package storage provides clients for Microsoft Azure Storage Services. +package storage + +import ( + "bufio" + "bytes" + "encoding/base64" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "mime" + "mime/multipart" + "net/http" + "net/url" + "regexp" + "runtime" + "strconv" + "strings" + "time" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +const ( + // DefaultBaseURL is the domain name used for storage requests in the + // public cloud when a default client is created. + DefaultBaseURL = "core.windows.net" + + // DefaultAPIVersion is the Azure Storage API version string used when a + // basic client is created. + DefaultAPIVersion = "2016-05-31" + + defaultUseHTTPS = true + + // StorageEmulatorAccountName is the fixed storage account used by Azure Storage Emulator + StorageEmulatorAccountName = "devstoreaccount1" + + // StorageEmulatorAccountKey is the the fixed storage account used by Azure Storage Emulator + StorageEmulatorAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" + + blobServiceName = "blob" + tableServiceName = "table" + queueServiceName = "queue" + fileServiceName = "file" + + storageEmulatorBlob = "127.0.0.1:10000" + storageEmulatorTable = "127.0.0.1:10002" + storageEmulatorQueue = "127.0.0.1:10001" + + userAgentHeader = "User-Agent" + + userDefinedMetadataHeaderPrefix = "x-ms-meta-" +) + +var ( + validStorageAccount = regexp.MustCompile("^[0-9a-z]{3,24}$") +) + +// Sender sends a request +type Sender interface { + Send(*Client, *http.Request) (*http.Response, error) +} + +// DefaultSender is the default sender for the client. It implements +// an automatic retry strategy. +type DefaultSender struct { + RetryAttempts int + RetryDuration time.Duration + ValidStatusCodes []int + attempts int // used for testing +} + +// Send is the default retry strategy in the client +func (ds *DefaultSender) Send(c *Client, req *http.Request) (resp *http.Response, err error) { + b := []byte{} + if req.Body != nil { + b, err = ioutil.ReadAll(req.Body) + if err != nil { + return resp, err + } + } + + for attempts := 0; attempts < ds.RetryAttempts; attempts++ { + if len(b) > 0 { + req.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + } + resp, err = c.HTTPClient.Do(req) + if err != nil || !autorest.ResponseHasStatusCode(resp, ds.ValidStatusCodes...) { + return resp, err + } + autorest.DelayForBackoff(ds.RetryDuration, attempts, req.Cancel) + ds.attempts = attempts + } + ds.attempts++ + return resp, err +} + +// Client is the object that needs to be constructed to perform +// operations on the storage account. +type Client struct { + // HTTPClient is the http.Client used to initiate API + // requests. http.DefaultClient is used when creating a + // client. + HTTPClient *http.Client + + // Sender is an interface that sends the request. Clients are + // created with a DefaultSender. The DefaultSender has an + // automatic retry strategy built in. The Sender can be customized. + Sender Sender + + accountName string + accountKey []byte + useHTTPS bool + UseSharedKeyLite bool + baseURL string + apiVersion string + userAgent string +} + +type storageResponse struct { + statusCode int + headers http.Header + body io.ReadCloser +} + +type odataResponse struct { + storageResponse + odata odataErrorMessage +} + +// AzureStorageServiceError contains fields of the error response from +// Azure Storage Service REST API. See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx +// Some fields might be specific to certain calls. +type AzureStorageServiceError struct { + Code string `xml:"Code"` + Message string `xml:"Message"` + AuthenticationErrorDetail string `xml:"AuthenticationErrorDetail"` + QueryParameterName string `xml:"QueryParameterName"` + QueryParameterValue string `xml:"QueryParameterValue"` + Reason string `xml:"Reason"` + StatusCode int + RequestID string + Date string + APIVersion string +} + +type odataErrorMessageMessage struct { + Lang string `json:"lang"` + Value string `json:"value"` +} + +type odataErrorMessageInternal struct { + Code string `json:"code"` + Message odataErrorMessageMessage `json:"message"` +} + +type odataErrorMessage struct { + Err odataErrorMessageInternal `json:"odata.error"` +} + +// UnexpectedStatusCodeError is returned when a storage service responds with neither an error +// nor with an HTTP status code indicating success. +type UnexpectedStatusCodeError struct { + allowed []int + got int +} + +func (e UnexpectedStatusCodeError) Error() string { + s := func(i int) string { return fmt.Sprintf("%d %s", i, http.StatusText(i)) } + + got := s(e.got) + expected := []string{} + for _, v := range e.allowed { + expected = append(expected, s(v)) + } + return fmt.Sprintf("storage: status code from service response is %s; was expecting %s", got, strings.Join(expected, " or ")) +} + +// Got is the actual status code returned by Azure. +func (e UnexpectedStatusCodeError) Got() int { + return e.got +} + +// NewBasicClient constructs a Client with given storage service name and +// key. +func NewBasicClient(accountName, accountKey string) (Client, error) { + if accountName == StorageEmulatorAccountName { + return NewEmulatorClient() + } + return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS) +} + +// NewBasicClientOnSovereignCloud constructs a Client with given storage service name and +// key in the referenced cloud. +func NewBasicClientOnSovereignCloud(accountName, accountKey string, env azure.Environment) (Client, error) { + if accountName == StorageEmulatorAccountName { + return NewEmulatorClient() + } + return NewClient(accountName, accountKey, env.StorageEndpointSuffix, DefaultAPIVersion, defaultUseHTTPS) +} + +//NewEmulatorClient contructs a Client intended to only work with Azure +//Storage Emulator +func NewEmulatorClient() (Client, error) { + return NewClient(StorageEmulatorAccountName, StorageEmulatorAccountKey, DefaultBaseURL, DefaultAPIVersion, false) +} + +// NewClient constructs a Client. This should be used if the caller wants +// to specify whether to use HTTPS, a specific REST API version or a custom +// storage endpoint than Azure Public Cloud. +func NewClient(accountName, accountKey, blobServiceBaseURL, apiVersion string, useHTTPS bool) (Client, error) { + var c Client + if !IsValidStorageAccount(accountName) { + return c, fmt.Errorf("azure: account name is not valid: it must be between 3 and 24 characters, and only may contain numbers and lowercase letters: %v", accountName) + } else if accountKey == "" { + return c, fmt.Errorf("azure: account key required") + } else if blobServiceBaseURL == "" { + return c, fmt.Errorf("azure: base storage service url required") + } + + key, err := base64.StdEncoding.DecodeString(accountKey) + if err != nil { + return c, fmt.Errorf("azure: malformed storage account key: %v", err) + } + + c = Client{ + HTTPClient: http.DefaultClient, + accountName: accountName, + accountKey: key, + useHTTPS: useHTTPS, + baseURL: blobServiceBaseURL, + apiVersion: apiVersion, + UseSharedKeyLite: false, + Sender: &DefaultSender{ + RetryAttempts: 5, + ValidStatusCodes: []int{ + http.StatusRequestTimeout, // 408 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + }, + RetryDuration: time.Second * 5, + }, + } + c.userAgent = c.getDefaultUserAgent() + return c, nil +} + +// IsValidStorageAccount checks if the storage account name is valid. +// See https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account +func IsValidStorageAccount(account string) bool { + return validStorageAccount.MatchString(account) +} + +func (c Client) getDefaultUserAgent() string { + return fmt.Sprintf("Go/%s (%s-%s) azure-storage-go/%s api-version/%s", + runtime.Version(), + runtime.GOARCH, + runtime.GOOS, + sdkVersion, + c.apiVersion, + ) +} + +// AddToUserAgent adds an extension to the current user agent +func (c *Client) AddToUserAgent(extension string) error { + if extension != "" { + c.userAgent = fmt.Sprintf("%s %s", c.userAgent, extension) + return nil + } + return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.userAgent) +} + +// protectUserAgent is used in funcs that include extraheaders as a parameter. +// It prevents the User-Agent header to be overwritten, instead if it happens to +// be present, it gets added to the current User-Agent. Use it before getStandardHeaders +func (c *Client) protectUserAgent(extraheaders map[string]string) map[string]string { + if v, ok := extraheaders[userAgentHeader]; ok { + c.AddToUserAgent(v) + delete(extraheaders, userAgentHeader) + } + return extraheaders +} + +func (c Client) getBaseURL(service string) *url.URL { + scheme := "http" + if c.useHTTPS { + scheme = "https" + } + host := "" + if c.accountName == StorageEmulatorAccountName { + switch service { + case blobServiceName: + host = storageEmulatorBlob + case tableServiceName: + host = storageEmulatorTable + case queueServiceName: + host = storageEmulatorQueue + } + } else { + host = fmt.Sprintf("%s.%s.%s", c.accountName, service, c.baseURL) + } + + return &url.URL{ + Scheme: scheme, + Host: host, + } +} + +func (c Client) getEndpoint(service, path string, params url.Values) string { + u := c.getBaseURL(service) + + // API doesn't accept path segments not starting with '/' + if !strings.HasPrefix(path, "/") { + path = fmt.Sprintf("/%v", path) + } + + if c.accountName == StorageEmulatorAccountName { + path = fmt.Sprintf("/%v%v", StorageEmulatorAccountName, path) + } + + u.Path = path + u.RawQuery = params.Encode() + return u.String() +} + +// GetBlobService returns a BlobStorageClient which can operate on the blob +// service of the storage account. +func (c Client) GetBlobService() BlobStorageClient { + b := BlobStorageClient{ + client: c, + } + b.client.AddToUserAgent(blobServiceName) + b.auth = sharedKey + if c.UseSharedKeyLite { + b.auth = sharedKeyLite + } + return b +} + +// GetQueueService returns a QueueServiceClient which can operate on the queue +// service of the storage account. +func (c Client) GetQueueService() QueueServiceClient { + q := QueueServiceClient{ + client: c, + } + q.client.AddToUserAgent(queueServiceName) + q.auth = sharedKey + if c.UseSharedKeyLite { + q.auth = sharedKeyLite + } + return q +} + +// GetTableService returns a TableServiceClient which can operate on the table +// service of the storage account. +func (c Client) GetTableService() TableServiceClient { + t := TableServiceClient{ + client: c, + } + t.client.AddToUserAgent(tableServiceName) + t.auth = sharedKeyForTable + if c.UseSharedKeyLite { + t.auth = sharedKeyLiteForTable + } + return t +} + +// GetFileService returns a FileServiceClient which can operate on the file +// service of the storage account. +func (c Client) GetFileService() FileServiceClient { + f := FileServiceClient{ + client: c, + } + f.client.AddToUserAgent(fileServiceName) + f.auth = sharedKey + if c.UseSharedKeyLite { + f.auth = sharedKeyLite + } + return f +} + +func (c Client) getStandardHeaders() map[string]string { + return map[string]string{ + userAgentHeader: c.userAgent, + "x-ms-version": c.apiVersion, + "x-ms-date": currentTimeRfc1123Formatted(), + } +} + +func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*storageResponse, error) { + headers, err := c.addAuthorizationHeader(verb, url, headers, auth) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(verb, url, body) + if err != nil { + return nil, errors.New("azure/storage: error creating request: " + err.Error()) + } + + if clstr, ok := headers["Content-Length"]; ok { + // content length header is being signed, but completely ignored by golang. + // instead we have to use the ContentLength property on the request struct + // (see https://golang.org/src/net/http/request.go?s=18140:18370#L536 and + // https://golang.org/src/net/http/transfer.go?s=1739:2467#L49) + req.ContentLength, err = strconv.ParseInt(clstr, 10, 64) + if err != nil { + return nil, err + } + } + for k, v := range headers { + req.Header.Add(k, v) + } + + resp, err := c.Sender.Send(&c, req) + if err != nil { + return nil, err + } + + statusCode := resp.StatusCode + if statusCode >= 400 && statusCode <= 505 { + var respBody []byte + respBody, err = readAndCloseBody(resp.Body) + if err != nil { + return nil, err + } + + requestID, date, version := getDebugHeaders(resp.Header) + if len(respBody) == 0 { + // no error in response body, might happen in HEAD requests + err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version) + } else { + // response contains storage service error object, unmarshal + storageErr, errIn := serviceErrFromXML(respBody, resp.StatusCode, requestID, date, version) + if err != nil { // error unmarshaling the error response + err = errIn + } + err = storageErr + } + return &storageResponse{ + statusCode: resp.StatusCode, + headers: resp.Header, + body: ioutil.NopCloser(bytes.NewReader(respBody)), /* restore the body */ + }, err + } + + return &storageResponse{ + statusCode: resp.StatusCode, + headers: resp.Header, + body: resp.Body}, nil +} + +func (c Client) execInternalJSONCommon(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, *http.Request, *http.Response, error) { + headers, err := c.addAuthorizationHeader(verb, url, headers, auth) + if err != nil { + return nil, nil, nil, err + } + + req, err := http.NewRequest(verb, url, body) + for k, v := range headers { + req.Header.Add(k, v) + } + + resp, err := c.Sender.Send(&c, req) + if err != nil { + return nil, nil, nil, err + } + + respToRet := &odataResponse{} + respToRet.body = resp.Body + respToRet.statusCode = resp.StatusCode + respToRet.headers = resp.Header + + statusCode := resp.StatusCode + if statusCode >= 400 && statusCode <= 505 { + var respBody []byte + respBody, err = readAndCloseBody(resp.Body) + if err != nil { + return nil, nil, nil, err + } + + requestID, date, version := getDebugHeaders(resp.Header) + if len(respBody) == 0 { + // no error in response body, might happen in HEAD requests + err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version) + return respToRet, req, resp, err + } + // try unmarshal as odata.error json + err = json.Unmarshal(respBody, &respToRet.odata) + } + + return respToRet, req, resp, err +} + +func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) { + respToRet, _, _, err := c.execInternalJSONCommon(verb, url, headers, body, auth) + return respToRet, err +} + +func (c Client) execBatchOperationJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) { + // execute common query, get back generated request, response etc... for more processing. + respToRet, req, resp, err := c.execInternalJSONCommon(verb, url, headers, body, auth) + if err != nil { + return nil, err + } + + // return the OData in the case of executing batch commands. + // In this case we need to read the outer batch boundary and contents. + // Then we read the changeset information within the batch + var respBody []byte + respBody, err = readAndCloseBody(resp.Body) + if err != nil { + return nil, err + } + + // outer multipart body + _, batchHeader, err := mime.ParseMediaType(resp.Header["Content-Type"][0]) + if err != nil { + return nil, err + } + + // batch details. + batchBoundary := batchHeader["boundary"] + batchPartBuf, changesetBoundary, err := genBatchReader(batchBoundary, respBody) + if err != nil { + return nil, err + } + + // changeset details. + err = genChangesetReader(req, respToRet, batchPartBuf, changesetBoundary) + if err != nil { + return nil, err + } + + return respToRet, nil +} + +func genChangesetReader(req *http.Request, respToRet *odataResponse, batchPartBuf io.Reader, changesetBoundary string) error { + changesetMultiReader := multipart.NewReader(batchPartBuf, changesetBoundary) + changesetPart, err := changesetMultiReader.NextPart() + if err != nil { + return err + } + + changesetPartBufioReader := bufio.NewReader(changesetPart) + changesetResp, err := http.ReadResponse(changesetPartBufioReader, req) + if err != nil { + return err + } + + if changesetResp.StatusCode != http.StatusNoContent { + changesetBody, err := readAndCloseBody(changesetResp.Body) + err = json.Unmarshal(changesetBody, &respToRet.odata) + if err != nil { + return err + } + respToRet.statusCode = changesetResp.StatusCode + } + + return nil +} + +func genBatchReader(batchBoundary string, respBody []byte) (io.Reader, string, error) { + respBodyString := string(respBody) + respBodyReader := strings.NewReader(respBodyString) + + // reading batchresponse + batchMultiReader := multipart.NewReader(respBodyReader, batchBoundary) + batchPart, err := batchMultiReader.NextPart() + if err != nil { + return nil, "", err + } + batchPartBufioReader := bufio.NewReader(batchPart) + + _, changesetHeader, err := mime.ParseMediaType(batchPart.Header.Get("Content-Type")) + if err != nil { + return nil, "", err + } + changesetBoundary := changesetHeader["boundary"] + return batchPartBufioReader, changesetBoundary, nil +} + +func readAndCloseBody(body io.ReadCloser) ([]byte, error) { + defer body.Close() + out, err := ioutil.ReadAll(body) + if err == io.EOF { + err = nil + } + return out, err +} + +func serviceErrFromXML(body []byte, statusCode int, requestID, date, version string) (AzureStorageServiceError, error) { + storageErr := AzureStorageServiceError{ + StatusCode: statusCode, + RequestID: requestID, + Date: date, + APIVersion: version, + } + if err := xml.Unmarshal(body, &storageErr); err != nil { + storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(body)) + return storageErr, err + } + return storageErr, nil +} + +func serviceErrFromStatusCode(code int, status string, requestID, date, version string) AzureStorageServiceError { + return AzureStorageServiceError{ + StatusCode: code, + Code: status, + RequestID: requestID, + Date: date, + APIVersion: version, + Message: "no response body was available for error status code", + } +} + +func (e AzureStorageServiceError) Error() string { + return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestInitiated=%s, RequestId=%s, API Version=%s, QueryParameterName=%s, QueryParameterValue=%s", + e.StatusCode, e.Code, e.Message, e.Date, e.RequestID, e.APIVersion, e.QueryParameterName, e.QueryParameterValue) +} + +// checkRespCode returns UnexpectedStatusError if the given response code is not +// one of the allowed status codes; otherwise nil. +func checkRespCode(respCode int, allowed []int) error { + for _, v := range allowed { + if respCode == v { + return nil + } + } + return UnexpectedStatusCodeError{allowed, respCode} +} + +func (c Client) addMetadataToHeaders(h map[string]string, metadata map[string]string) map[string]string { + metadata = c.protectUserAgent(metadata) + for k, v := range metadata { + h[userDefinedMetadataHeaderPrefix+k] = v + } + return h +} + +func getDebugHeaders(h http.Header) (requestID, date, version string) { + requestID = h.Get("x-ms-request-id") + version = h.Get("x-ms-version") + date = h.Get("Date") + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go index d4fe5dad14..73c1e6c61d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/client_test.go @@ -1,472 +1,472 @@ -package storage - -import ( - "bytes" - "encoding/base64" - "io/ioutil" - "math" - "net/http" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "testing" - "time" - - "github.com/Azure/go-autorest/autorest/azure" - "github.com/dnaeon/go-vcr/cassette" - "github.com/dnaeon/go-vcr/recorder" - chk "gopkg.in/check.v1" -) - -// Hook up gocheck to testing -func Test(t *testing.T) { chk.TestingT(t) } - -type StorageClientSuite struct{} - -var _ = chk.Suite(&StorageClientSuite{}) - -// getBasicClient returns a test client from storage credentials in the env -func getBasicClient(c *chk.C) *Client { - name := os.Getenv("ACCOUNT_NAME") - if name == "" { - name = dummyStorageAccount - } - key := os.Getenv("ACCOUNT_KEY") - if key == "" { - key = dummyMiniStorageKey - } - cli, err := NewBasicClient(name, key) - c.Assert(err, chk.IsNil) - - return &cli -} - -func (client *Client) appendRecorder(c *chk.C) *recorder.Recorder { - tests := strings.Split(c.TestName(), ".") - path := filepath.Join(recordingsFolder, tests[0], tests[1]) - rec, err := recorder.New(path) - c.Assert(err, chk.IsNil) - client.HTTPClient = &http.Client{ - Transport: rec, - } - rec.SetMatcher(func(r *http.Request, i cassette.Request) bool { - return compareMethods(r, i) && - compareURLs(r, i) && - compareHeaders(r, i) && - compareBodies(r, i) - }) - return rec -} - -func (client *Client) usesDummies() bool { - key, err := base64.StdEncoding.DecodeString(dummyMiniStorageKey) - if err != nil { - return false - } - if string(client.accountKey) == string(key) && - client.accountName == dummyStorageAccount { - return true - } - return false -} - -func compareMethods(r *http.Request, i cassette.Request) bool { - return r.Method == i.Method -} - -func compareURLs(r *http.Request, i cassette.Request) bool { - newURL := modifyURL(r.URL) - return newURL.String() == i.URL -} - -func modifyURL(url *url.URL) *url.URL { - // The URL host looks like this... - // accountname.service.storageEndpointSuffix - parts := strings.Split(url.Host, ".") - // parts[0] corresponds to the storage account name, so it can be (almost) any string - // parts[1] corresponds to the service name (table, blob, etc.). - if !(parts[1] == blobServiceName || - parts[1] == tableServiceName || - parts[1] == queueServiceName || - parts[1] == fileServiceName) { - return nil - } - // The rest of the host depends on which Azure cloud is used - storageEndpointSuffix := strings.Join(parts[2:], ".") - if !(storageEndpointSuffix == azure.PublicCloud.StorageEndpointSuffix || - storageEndpointSuffix == azure.USGovernmentCloud.StorageEndpointSuffix || - storageEndpointSuffix == azure.ChinaCloud.StorageEndpointSuffix || - storageEndpointSuffix == azure.GermanCloud.StorageEndpointSuffix) { - return nil - } - - host := dummyStorageAccount + "." + parts[1] + "." + azure.PublicCloud.StorageEndpointSuffix - newURL := url - newURL.Host = host - return newURL -} - -func compareHeaders(r *http.Request, i cassette.Request) bool { - requestHeaders := r.Header - cassetteHeaders := i.Headers - // Some headers shall not be compared... - requestHeaders.Del("User-Agent") - requestHeaders.Del("Authorization") - requestHeaders.Del("X-Ms-Date") - - cassetteHeaders.Del("User-Agent") - cassetteHeaders.Del("Authorization") - cassetteHeaders.Del("X-Ms-Date") - - srcURLstr := requestHeaders.Get("X-Ms-Copy-Source") - if srcURLstr != "" { - srcURL, err := url.Parse(srcURLstr) - if err != nil { - return false - } - modifiedURL := modifyURL(srcURL) - requestHeaders.Set("X-Ms-Copy-Source", modifiedURL.String()) - } - - // Do not compare the complete Content-Type header in table batch requests - if isBatchOp(r.URL.String()) { - // They all start like this, but then they have a UUID... - ctPrefixBatch := "multipart/mixed; boundary=batch_" - contentTypeRequest := requestHeaders.Get("Content-Type") - contentTypeCassette := cassetteHeaders.Get("Content-Type") - if !(strings.HasPrefix(contentTypeRequest, ctPrefixBatch) && - strings.HasPrefix(contentTypeCassette, ctPrefixBatch)) { - return false - } - requestHeaders.Del("Content-Type") - cassetteHeaders.Del("Content-Type") - } - - return reflect.DeepEqual(requestHeaders, cassetteHeaders) -} - -func compareBodies(r *http.Request, i cassette.Request) bool { - body := bytes.Buffer{} - if r.Body != nil { - _, err := body.ReadFrom(r.Body) - if err != nil { - return false - } - r.Body = ioutil.NopCloser(&body) - } - // Comparing bodies in table batch operations is trickier, because the bodies include UUIDs - if isBatchOp(r.URL.String()) { - return compareBatchBodies(body.String(), i.Body) - } - return body.String() == i.Body -} - -func compareBatchBodies(rBody, cBody string) bool { - // UUIDs in the batch body look like this... - // 2d7f2323-1e42-11e7-8c6c-6451064d81e8 - exp, err := regexp.Compile("[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}") - if err != nil { - return false - } - rBody = replaceStorageAccount(replaceUUIDs(rBody, exp)) - cBody = replaceUUIDs(cBody, exp) - return rBody == cBody -} - -func replaceUUIDs(body string, exp *regexp.Regexp) string { - indexes := exp.FindAllStringIndex(body, -1) - for _, pair := range indexes { - body = strings.Replace(body, body[pair[0]:pair[1]], "00000000-0000-0000-0000-000000000000", -1) - } - return body -} - -func isBatchOp(url string) bool { - return url == "https://golangrocksonazure.table.core.windows.net/$batch" -} - -//getEmulatorClient returns a test client for Azure Storeage Emulator -func getEmulatorClient(c *chk.C) Client { - cli, err := NewBasicClient(StorageEmulatorAccountName, "") - c.Assert(err, chk.IsNil) - return cli -} - -func (s *StorageClientSuite) TestNewEmulatorClient(c *chk.C) { - cli, err := NewBasicClient(StorageEmulatorAccountName, "") - c.Assert(err, chk.IsNil) - c.Assert(cli.accountName, chk.Equals, StorageEmulatorAccountName) - expectedKey, err := base64.StdEncoding.DecodeString(StorageEmulatorAccountKey) - c.Assert(err, chk.IsNil) - c.Assert(cli.accountKey, chk.DeepEquals, expectedKey) -} - -func (s *StorageClientSuite) TestIsValidStorageAccount(c *chk.C) { - type test struct { - account string - expected bool - } - testCases := []test{ - {"name1", true}, - {"Name2", false}, - {"reallyLongName1234567891011", false}, - {"", false}, - {"concated&name", false}, - {"formatted name", false}, - } - - for _, tc := range testCases { - c.Assert(IsValidStorageAccount(tc.account), chk.Equals, tc.expected) - } -} - -func (s *StorageClientSuite) TestMalformedKeyError(c *chk.C) { - _, err := NewBasicClient(dummyStorageAccount, "malformed") - c.Assert(err, chk.ErrorMatches, "azure: malformed storage account key: .*") -} - -func (s *StorageClientSuite) TestGetBaseURL_Basic_Https(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) - c.Assert(err, chk.IsNil) - c.Assert(cli.apiVersion, chk.Equals, DefaultAPIVersion) - c.Assert(err, chk.IsNil) - c.Assert(cli.getBaseURL("table").String(), chk.Equals, "https://golangrocksonazure.table.core.windows.net") -} - -func (s *StorageClientSuite) TestGetBaseURL_Custom_NoHttps(c *chk.C) { - apiVersion := "2015-01-01" // a non existing one - cli, err := NewClient(dummyStorageAccount, dummyMiniStorageKey, "core.chinacloudapi.cn", apiVersion, false) - c.Assert(err, chk.IsNil) - c.Assert(cli.apiVersion, chk.Equals, apiVersion) - c.Assert(cli.getBaseURL("table").String(), chk.Equals, "http://golangrocksonazure.table.core.chinacloudapi.cn") -} - -func (s *StorageClientSuite) TestGetBaseURL_StorageEmulator(c *chk.C) { - cli, err := NewBasicClient(StorageEmulatorAccountName, StorageEmulatorAccountKey) - c.Assert(err, chk.IsNil) - - type test struct{ service, expected string } - tests := []test{ - {blobServiceName, "http://127.0.0.1:10000"}, - {tableServiceName, "http://127.0.0.1:10002"}, - {queueServiceName, "http://127.0.0.1:10001"}, - } - for _, i := range tests { - baseURL := cli.getBaseURL(i.service) - c.Assert(baseURL.String(), chk.Equals, i.expected) - } -} - -func (s *StorageClientSuite) TestGetEndpoint_None(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - output := cli.getEndpoint(blobServiceName, "", url.Values{}) - c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/") -} - -func (s *StorageClientSuite) TestGetEndpoint_PathOnly(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - output := cli.getEndpoint(blobServiceName, "path", url.Values{}) - c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/path") -} - -func (s *StorageClientSuite) TestGetEndpoint_ParamsOnly(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - params := url.Values{} - params.Set("a", "b") - params.Set("c", "d") - output := cli.getEndpoint(blobServiceName, "", params) - c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/?a=b&c=d") -} - -func (s *StorageClientSuite) TestGetEndpoint_Mixed(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - params := url.Values{} - params.Set("a", "b") - params.Set("c", "d") - output := cli.getEndpoint(blobServiceName, "path", params) - c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/path?a=b&c=d") -} - -func (s *StorageClientSuite) TestGetEndpoint_StorageEmulator(c *chk.C) { - cli, err := NewBasicClient(StorageEmulatorAccountName, StorageEmulatorAccountKey) - c.Assert(err, chk.IsNil) - - type test struct{ service, expected string } - tests := []test{ - {blobServiceName, "http://127.0.0.1:10000/devstoreaccount1/"}, - {tableServiceName, "http://127.0.0.1:10002/devstoreaccount1/"}, - {queueServiceName, "http://127.0.0.1:10001/devstoreaccount1/"}, - } - for _, i := range tests { - endpoint := cli.getEndpoint(i.service, "", url.Values{}) - c.Assert(endpoint, chk.Equals, i.expected) - } -} - -func (s *StorageClientSuite) Test_getStandardHeaders(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - - headers := cli.getStandardHeaders() - c.Assert(len(headers), chk.Equals, 3) - c.Assert(headers["x-ms-version"], chk.Equals, cli.apiVersion) - if _, ok := headers["x-ms-date"]; !ok { - c.Fatal("Missing date header") - } - c.Assert(headers[userAgentHeader], chk.Equals, cli.getDefaultUserAgent()) -} - -func (s *StorageClientSuite) TestReturnsStorageServiceError(c *chk.C) { - // attempt to delete a nonexisting container - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - _, err := cnt.delete(nil) - c.Assert(err, chk.NotNil) - - v, ok := err.(AzureStorageServiceError) - c.Check(ok, chk.Equals, true) - c.Assert(v.StatusCode, chk.Equals, 404) - c.Assert(v.Code, chk.Equals, "ContainerNotFound") - c.Assert(v.Code, chk.Not(chk.Equals), "") - c.Assert(v.RequestID, chk.Not(chk.Equals), "") -} - -func (s *StorageClientSuite) TestReturnsStorageServiceError_withoutResponseBody(c *chk.C) { - // HEAD on non-existing blob - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference("non-existing-container") - b := cnt.GetBlobReference("non-existing-blob") - err := b.GetProperties(nil) - - c.Assert(err, chk.NotNil) - c.Assert(err, chk.FitsTypeOf, AzureStorageServiceError{}) - - v, ok := err.(AzureStorageServiceError) - c.Check(ok, chk.Equals, true) - c.Assert(v.StatusCode, chk.Equals, http.StatusNotFound) - c.Assert(v.Code, chk.Equals, "404 The specified container does not exist.") - c.Assert(v.RequestID, chk.Not(chk.Equals), "") - c.Assert(v.Message, chk.Equals, "no response body was available for error status code") -} - -func (s *StorageClientSuite) Test_createServiceClients(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - - ua := cli.getDefaultUserAgent() - - headers := cli.getStandardHeaders() - c.Assert(headers[userAgentHeader], chk.Equals, ua) - c.Assert(cli.userAgent, chk.Equals, ua) - - b := cli.GetBlobService() - c.Assert(b.client.userAgent, chk.Equals, ua+" "+blobServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) - - t := cli.GetTableService() - c.Assert(t.client.userAgent, chk.Equals, ua+" "+tableServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) - - q := cli.GetQueueService() - c.Assert(q.client.userAgent, chk.Equals, ua+" "+queueServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) - - f := cli.GetFileService() - c.Assert(f.client.userAgent, chk.Equals, ua+" "+fileServiceName) - c.Assert(cli.userAgent, chk.Equals, ua) -} - -func (s *StorageClientSuite) TestAddToUserAgent(c *chk.C) { - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - - ua := cli.getDefaultUserAgent() - - err = cli.AddToUserAgent("rofl") - c.Assert(err, chk.IsNil) - c.Assert(cli.userAgent, chk.Equals, ua+" rofl") - - err = cli.AddToUserAgent("") - c.Assert(err, chk.NotNil) -} - -func (s *StorageClientSuite) Test_protectUserAgent(c *chk.C) { - extraheaders := map[string]string{ - "1": "one", - "2": "two", - "3": "three", - userAgentHeader: "four", - } - - cli, err := NewBasicClient(dummyStorageAccount, "YmFy") - c.Assert(err, chk.IsNil) - - ua := cli.getDefaultUserAgent() - - got := cli.protectUserAgent(extraheaders) - c.Assert(cli.userAgent, chk.Equals, ua+" four") - c.Assert(got, chk.HasLen, 3) - c.Assert(got, chk.DeepEquals, map[string]string{ - "1": "one", - "2": "two", - "3": "three", - }) -} - -func (s *StorageClientSuite) Test_doRetry(c *chk.C) { - cli := getBasicClient(c) - rec := cli.appendRecorder(c) - defer rec.Stop() - - // Prepare request that will fail with 404 (delete non extising table) - uri, err := url.Parse(cli.getEndpoint(tableServiceName, "(retry)", url.Values{"timeout": {strconv.Itoa(30)}})) - c.Assert(err, chk.IsNil) - req := http.Request{ - Method: http.MethodDelete, - URL: uri, - Header: http.Header{ - "Accept": {"application/json;odata=nometadata"}, - "Prefer": {"return-no-content"}, - "X-Ms-Version": {"2016-05-31"}, - }, - } - - ds, ok := cli.Sender.(*DefaultSender) - c.Assert(ok, chk.Equals, true) - // Modify sender so it retries quickly - ds.RetryAttempts = 3 - ds.RetryDuration = time.Second - // include 404 as a valid status code for retries - ds.ValidStatusCodes = []int{http.StatusNotFound} - cli.Sender = ds - - now := time.Now() - resp, err := cli.Sender.Send(cli, &req) - afterRetries := time.Since(now) - c.Assert(err, chk.IsNil) - c.Assert(resp.StatusCode, chk.Equals, http.StatusNotFound) - - // Was it the correct amount of retries... ? - c.Assert(cli.Sender.(*DefaultSender).attempts, chk.Equals, cli.Sender.(*DefaultSender).RetryAttempts) - // What about time... ? - // Note, seconds are rounded - sum := 0 - for i := 0; i < ds.RetryAttempts; i++ { - sum += int(ds.RetryDuration.Seconds() * math.Pow(2, float64(i))) // same formula used in autorest.DelayForBackoff - } - c.Assert(int(afterRetries.Seconds()), chk.Equals, sum) -} +package storage + +import ( + "bytes" + "encoding/base64" + "io/ioutil" + "math" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest/azure" + "github.com/dnaeon/go-vcr/cassette" + "github.com/dnaeon/go-vcr/recorder" + chk "gopkg.in/check.v1" +) + +// Hook up gocheck to testing +func Test(t *testing.T) { chk.TestingT(t) } + +type StorageClientSuite struct{} + +var _ = chk.Suite(&StorageClientSuite{}) + +// getBasicClient returns a test client from storage credentials in the env +func getBasicClient(c *chk.C) *Client { + name := os.Getenv("ACCOUNT_NAME") + if name == "" { + name = dummyStorageAccount + } + key := os.Getenv("ACCOUNT_KEY") + if key == "" { + key = dummyMiniStorageKey + } + cli, err := NewBasicClient(name, key) + c.Assert(err, chk.IsNil) + + return &cli +} + +func (client *Client) appendRecorder(c *chk.C) *recorder.Recorder { + tests := strings.Split(c.TestName(), ".") + path := filepath.Join(recordingsFolder, tests[0], tests[1]) + rec, err := recorder.New(path) + c.Assert(err, chk.IsNil) + client.HTTPClient = &http.Client{ + Transport: rec, + } + rec.SetMatcher(func(r *http.Request, i cassette.Request) bool { + return compareMethods(r, i) && + compareURLs(r, i) && + compareHeaders(r, i) && + compareBodies(r, i) + }) + return rec +} + +func (client *Client) usesDummies() bool { + key, err := base64.StdEncoding.DecodeString(dummyMiniStorageKey) + if err != nil { + return false + } + if string(client.accountKey) == string(key) && + client.accountName == dummyStorageAccount { + return true + } + return false +} + +func compareMethods(r *http.Request, i cassette.Request) bool { + return r.Method == i.Method +} + +func compareURLs(r *http.Request, i cassette.Request) bool { + newURL := modifyURL(r.URL) + return newURL.String() == i.URL +} + +func modifyURL(url *url.URL) *url.URL { + // The URL host looks like this... + // accountname.service.storageEndpointSuffix + parts := strings.Split(url.Host, ".") + // parts[0] corresponds to the storage account name, so it can be (almost) any string + // parts[1] corresponds to the service name (table, blob, etc.). + if !(parts[1] == blobServiceName || + parts[1] == tableServiceName || + parts[1] == queueServiceName || + parts[1] == fileServiceName) { + return nil + } + // The rest of the host depends on which Azure cloud is used + storageEndpointSuffix := strings.Join(parts[2:], ".") + if !(storageEndpointSuffix == azure.PublicCloud.StorageEndpointSuffix || + storageEndpointSuffix == azure.USGovernmentCloud.StorageEndpointSuffix || + storageEndpointSuffix == azure.ChinaCloud.StorageEndpointSuffix || + storageEndpointSuffix == azure.GermanCloud.StorageEndpointSuffix) { + return nil + } + + host := dummyStorageAccount + "." + parts[1] + "." + azure.PublicCloud.StorageEndpointSuffix + newURL := url + newURL.Host = host + return newURL +} + +func compareHeaders(r *http.Request, i cassette.Request) bool { + requestHeaders := r.Header + cassetteHeaders := i.Headers + // Some headers shall not be compared... + requestHeaders.Del("User-Agent") + requestHeaders.Del("Authorization") + requestHeaders.Del("X-Ms-Date") + + cassetteHeaders.Del("User-Agent") + cassetteHeaders.Del("Authorization") + cassetteHeaders.Del("X-Ms-Date") + + srcURLstr := requestHeaders.Get("X-Ms-Copy-Source") + if srcURLstr != "" { + srcURL, err := url.Parse(srcURLstr) + if err != nil { + return false + } + modifiedURL := modifyURL(srcURL) + requestHeaders.Set("X-Ms-Copy-Source", modifiedURL.String()) + } + + // Do not compare the complete Content-Type header in table batch requests + if isBatchOp(r.URL.String()) { + // They all start like this, but then they have a UUID... + ctPrefixBatch := "multipart/mixed; boundary=batch_" + contentTypeRequest := requestHeaders.Get("Content-Type") + contentTypeCassette := cassetteHeaders.Get("Content-Type") + if !(strings.HasPrefix(contentTypeRequest, ctPrefixBatch) && + strings.HasPrefix(contentTypeCassette, ctPrefixBatch)) { + return false + } + requestHeaders.Del("Content-Type") + cassetteHeaders.Del("Content-Type") + } + + return reflect.DeepEqual(requestHeaders, cassetteHeaders) +} + +func compareBodies(r *http.Request, i cassette.Request) bool { + body := bytes.Buffer{} + if r.Body != nil { + _, err := body.ReadFrom(r.Body) + if err != nil { + return false + } + r.Body = ioutil.NopCloser(&body) + } + // Comparing bodies in table batch operations is trickier, because the bodies include UUIDs + if isBatchOp(r.URL.String()) { + return compareBatchBodies(body.String(), i.Body) + } + return body.String() == i.Body +} + +func compareBatchBodies(rBody, cBody string) bool { + // UUIDs in the batch body look like this... + // 2d7f2323-1e42-11e7-8c6c-6451064d81e8 + exp, err := regexp.Compile("[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}") + if err != nil { + return false + } + rBody = replaceStorageAccount(replaceUUIDs(rBody, exp)) + cBody = replaceUUIDs(cBody, exp) + return rBody == cBody +} + +func replaceUUIDs(body string, exp *regexp.Regexp) string { + indexes := exp.FindAllStringIndex(body, -1) + for _, pair := range indexes { + body = strings.Replace(body, body[pair[0]:pair[1]], "00000000-0000-0000-0000-000000000000", -1) + } + return body +} + +func isBatchOp(url string) bool { + return url == "https://golangrocksonazure.table.core.windows.net/$batch" +} + +//getEmulatorClient returns a test client for Azure Storeage Emulator +func getEmulatorClient(c *chk.C) Client { + cli, err := NewBasicClient(StorageEmulatorAccountName, "") + c.Assert(err, chk.IsNil) + return cli +} + +func (s *StorageClientSuite) TestNewEmulatorClient(c *chk.C) { + cli, err := NewBasicClient(StorageEmulatorAccountName, "") + c.Assert(err, chk.IsNil) + c.Assert(cli.accountName, chk.Equals, StorageEmulatorAccountName) + expectedKey, err := base64.StdEncoding.DecodeString(StorageEmulatorAccountKey) + c.Assert(err, chk.IsNil) + c.Assert(cli.accountKey, chk.DeepEquals, expectedKey) +} + +func (s *StorageClientSuite) TestIsValidStorageAccount(c *chk.C) { + type test struct { + account string + expected bool + } + testCases := []test{ + {"name1", true}, + {"Name2", false}, + {"reallyLongName1234567891011", false}, + {"", false}, + {"concated&name", false}, + {"formatted name", false}, + } + + for _, tc := range testCases { + c.Assert(IsValidStorageAccount(tc.account), chk.Equals, tc.expected) + } +} + +func (s *StorageClientSuite) TestMalformedKeyError(c *chk.C) { + _, err := NewBasicClient(dummyStorageAccount, "malformed") + c.Assert(err, chk.ErrorMatches, "azure: malformed storage account key: .*") +} + +func (s *StorageClientSuite) TestGetBaseURL_Basic_Https(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, dummyMiniStorageKey) + c.Assert(err, chk.IsNil) + c.Assert(cli.apiVersion, chk.Equals, DefaultAPIVersion) + c.Assert(err, chk.IsNil) + c.Assert(cli.getBaseURL("table").String(), chk.Equals, "https://golangrocksonazure.table.core.windows.net") +} + +func (s *StorageClientSuite) TestGetBaseURL_Custom_NoHttps(c *chk.C) { + apiVersion := "2015-01-01" // a non existing one + cli, err := NewClient(dummyStorageAccount, dummyMiniStorageKey, "core.chinacloudapi.cn", apiVersion, false) + c.Assert(err, chk.IsNil) + c.Assert(cli.apiVersion, chk.Equals, apiVersion) + c.Assert(cli.getBaseURL("table").String(), chk.Equals, "http://golangrocksonazure.table.core.chinacloudapi.cn") +} + +func (s *StorageClientSuite) TestGetBaseURL_StorageEmulator(c *chk.C) { + cli, err := NewBasicClient(StorageEmulatorAccountName, StorageEmulatorAccountKey) + c.Assert(err, chk.IsNil) + + type test struct{ service, expected string } + tests := []test{ + {blobServiceName, "http://127.0.0.1:10000"}, + {tableServiceName, "http://127.0.0.1:10002"}, + {queueServiceName, "http://127.0.0.1:10001"}, + } + for _, i := range tests { + baseURL := cli.getBaseURL(i.service) + c.Assert(baseURL.String(), chk.Equals, i.expected) + } +} + +func (s *StorageClientSuite) TestGetEndpoint_None(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + output := cli.getEndpoint(blobServiceName, "", url.Values{}) + c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/") +} + +func (s *StorageClientSuite) TestGetEndpoint_PathOnly(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + output := cli.getEndpoint(blobServiceName, "path", url.Values{}) + c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/path") +} + +func (s *StorageClientSuite) TestGetEndpoint_ParamsOnly(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + params := url.Values{} + params.Set("a", "b") + params.Set("c", "d") + output := cli.getEndpoint(blobServiceName, "", params) + c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/?a=b&c=d") +} + +func (s *StorageClientSuite) TestGetEndpoint_Mixed(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + params := url.Values{} + params.Set("a", "b") + params.Set("c", "d") + output := cli.getEndpoint(blobServiceName, "path", params) + c.Assert(output, chk.Equals, "https://golangrocksonazure.blob.core.windows.net/path?a=b&c=d") +} + +func (s *StorageClientSuite) TestGetEndpoint_StorageEmulator(c *chk.C) { + cli, err := NewBasicClient(StorageEmulatorAccountName, StorageEmulatorAccountKey) + c.Assert(err, chk.IsNil) + + type test struct{ service, expected string } + tests := []test{ + {blobServiceName, "http://127.0.0.1:10000/devstoreaccount1/"}, + {tableServiceName, "http://127.0.0.1:10002/devstoreaccount1/"}, + {queueServiceName, "http://127.0.0.1:10001/devstoreaccount1/"}, + } + for _, i := range tests { + endpoint := cli.getEndpoint(i.service, "", url.Values{}) + c.Assert(endpoint, chk.Equals, i.expected) + } +} + +func (s *StorageClientSuite) Test_getStandardHeaders(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + + headers := cli.getStandardHeaders() + c.Assert(len(headers), chk.Equals, 3) + c.Assert(headers["x-ms-version"], chk.Equals, cli.apiVersion) + if _, ok := headers["x-ms-date"]; !ok { + c.Fatal("Missing date header") + } + c.Assert(headers[userAgentHeader], chk.Equals, cli.getDefaultUserAgent()) +} + +func (s *StorageClientSuite) TestReturnsStorageServiceError(c *chk.C) { + // attempt to delete a nonexisting container + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + _, err := cnt.delete(nil) + c.Assert(err, chk.NotNil) + + v, ok := err.(AzureStorageServiceError) + c.Check(ok, chk.Equals, true) + c.Assert(v.StatusCode, chk.Equals, 404) + c.Assert(v.Code, chk.Equals, "ContainerNotFound") + c.Assert(v.Code, chk.Not(chk.Equals), "") + c.Assert(v.RequestID, chk.Not(chk.Equals), "") +} + +func (s *StorageClientSuite) TestReturnsStorageServiceError_withoutResponseBody(c *chk.C) { + // HEAD on non-existing blob + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference("non-existing-container") + b := cnt.GetBlobReference("non-existing-blob") + err := b.GetProperties(nil) + + c.Assert(err, chk.NotNil) + c.Assert(err, chk.FitsTypeOf, AzureStorageServiceError{}) + + v, ok := err.(AzureStorageServiceError) + c.Check(ok, chk.Equals, true) + c.Assert(v.StatusCode, chk.Equals, http.StatusNotFound) + c.Assert(v.Code, chk.Equals, "404 The specified container does not exist.") + c.Assert(v.RequestID, chk.Not(chk.Equals), "") + c.Assert(v.Message, chk.Equals, "no response body was available for error status code") +} + +func (s *StorageClientSuite) Test_createServiceClients(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + + ua := cli.getDefaultUserAgent() + + headers := cli.getStandardHeaders() + c.Assert(headers[userAgentHeader], chk.Equals, ua) + c.Assert(cli.userAgent, chk.Equals, ua) + + b := cli.GetBlobService() + c.Assert(b.client.userAgent, chk.Equals, ua+" "+blobServiceName) + c.Assert(cli.userAgent, chk.Equals, ua) + + t := cli.GetTableService() + c.Assert(t.client.userAgent, chk.Equals, ua+" "+tableServiceName) + c.Assert(cli.userAgent, chk.Equals, ua) + + q := cli.GetQueueService() + c.Assert(q.client.userAgent, chk.Equals, ua+" "+queueServiceName) + c.Assert(cli.userAgent, chk.Equals, ua) + + f := cli.GetFileService() + c.Assert(f.client.userAgent, chk.Equals, ua+" "+fileServiceName) + c.Assert(cli.userAgent, chk.Equals, ua) +} + +func (s *StorageClientSuite) TestAddToUserAgent(c *chk.C) { + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + + ua := cli.getDefaultUserAgent() + + err = cli.AddToUserAgent("rofl") + c.Assert(err, chk.IsNil) + c.Assert(cli.userAgent, chk.Equals, ua+" rofl") + + err = cli.AddToUserAgent("") + c.Assert(err, chk.NotNil) +} + +func (s *StorageClientSuite) Test_protectUserAgent(c *chk.C) { + extraheaders := map[string]string{ + "1": "one", + "2": "two", + "3": "three", + userAgentHeader: "four", + } + + cli, err := NewBasicClient(dummyStorageAccount, "YmFy") + c.Assert(err, chk.IsNil) + + ua := cli.getDefaultUserAgent() + + got := cli.protectUserAgent(extraheaders) + c.Assert(cli.userAgent, chk.Equals, ua+" four") + c.Assert(got, chk.HasLen, 3) + c.Assert(got, chk.DeepEquals, map[string]string{ + "1": "one", + "2": "two", + "3": "three", + }) +} + +func (s *StorageClientSuite) Test_doRetry(c *chk.C) { + cli := getBasicClient(c) + rec := cli.appendRecorder(c) + defer rec.Stop() + + // Prepare request that will fail with 404 (delete non extising table) + uri, err := url.Parse(cli.getEndpoint(tableServiceName, "(retry)", url.Values{"timeout": {strconv.Itoa(30)}})) + c.Assert(err, chk.IsNil) + req := http.Request{ + Method: http.MethodDelete, + URL: uri, + Header: http.Header{ + "Accept": {"application/json;odata=nometadata"}, + "Prefer": {"return-no-content"}, + "X-Ms-Version": {"2016-05-31"}, + }, + } + + ds, ok := cli.Sender.(*DefaultSender) + c.Assert(ok, chk.Equals, true) + // Modify sender so it retries quickly + ds.RetryAttempts = 3 + ds.RetryDuration = time.Second + // include 404 as a valid status code for retries + ds.ValidStatusCodes = []int{http.StatusNotFound} + cli.Sender = ds + + now := time.Now() + resp, err := cli.Sender.Send(cli, &req) + afterRetries := time.Since(now) + c.Assert(err, chk.IsNil) + c.Assert(resp.StatusCode, chk.Equals, http.StatusNotFound) + + // Was it the correct amount of retries... ? + c.Assert(cli.Sender.(*DefaultSender).attempts, chk.Equals, cli.Sender.(*DefaultSender).RetryAttempts) + // What about time... ? + // Note, seconds are rounded + sum := 0 + for i := 0; i < ds.RetryAttempts; i++ { + sum += int(ds.RetryDuration.Seconds() * math.Pow(2, float64(i))) // same formula used in autorest.DelayForBackoff + } + c.Assert(int(afterRetries.Seconds()), chk.Equals, sum) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go index 5d5fd38781..b20dfcf350 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go @@ -1,450 +1,450 @@ -package storage - -import ( - "encoding/xml" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "strings" - "time" -) - -// Container represents an Azure container. -type Container struct { - bsc *BlobStorageClient - Name string `xml:"Name"` - Properties ContainerProperties `xml:"Properties"` - Metadata map[string]string -} - -func (c *Container) buildPath() string { - return fmt.Sprintf("/%s", c.Name) -} - -// ContainerProperties contains various properties of a container returned from -// various endpoints like ListContainers. -type ContainerProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` - LeaseStatus string `xml:"LeaseStatus"` - LeaseState string `xml:"LeaseState"` - LeaseDuration string `xml:"LeaseDuration"` -} - -// ContainerListResponse contains the response fields from -// ListContainers call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx -type ContainerListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Prefix string `xml:"Prefix"` - Marker string `xml:"Marker"` - NextMarker string `xml:"NextMarker"` - MaxResults int64 `xml:"MaxResults"` - Containers []Container `xml:"Containers>Container"` -} - -// BlobListResponse contains the response fields from ListBlobs call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx -type BlobListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Prefix string `xml:"Prefix"` - Marker string `xml:"Marker"` - NextMarker string `xml:"NextMarker"` - MaxResults int64 `xml:"MaxResults"` - Blobs []Blob `xml:"Blobs>Blob"` - - // BlobPrefix is used to traverse blobs as if it were a file system. - // It is returned if ListBlobsParameters.Delimiter is specified. - // The list here can be thought of as "folders" that may contain - // other folders or blobs. - BlobPrefixes []string `xml:"Blobs>BlobPrefix>Name"` - - // Delimiter is used to traverse blobs as if it were a file system. - // It is returned if ListBlobsParameters.Delimiter is specified. - Delimiter string `xml:"Delimiter"` -} - -// IncludeBlobDataset has options to include in a list blobs operation -type IncludeBlobDataset struct { - Snapshots bool - Metadata bool - UncommittedBlobs bool - Copy bool -} - -// ListBlobsParameters defines the set of customizable -// parameters to make a List Blobs call. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx -type ListBlobsParameters struct { - Prefix string - Delimiter string - Marker string - Include *IncludeBlobDataset - MaxResults uint - Timeout uint - RequestID string -} - -func (p ListBlobsParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Delimiter != "" { - out.Set("delimiter", p.Delimiter) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.Include != nil { - include := []string{} - include = addString(include, p.Include.Snapshots, "snapshots") - include = addString(include, p.Include.Metadata, "metadata") - include = addString(include, p.Include.UncommittedBlobs, "uncommittedblobs") - include = addString(include, p.Include.Copy, "copy") - fullInclude := strings.Join(include, ",") - out.Set("include", fullInclude) - } - if p.MaxResults != 0 { - out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) - } - if p.Timeout != 0 { - out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10)) - } - - return out -} - -func addString(datasets []string, include bool, text string) []string { - if include { - datasets = append(datasets, text) - } - return datasets -} - -// ContainerAccessType defines the access level to the container from a public -// request. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx and "x-ms- -// blob-public-access" header. -type ContainerAccessType string - -// Access options for containers -const ( - ContainerAccessTypePrivate ContainerAccessType = "" - ContainerAccessTypeBlob ContainerAccessType = "blob" - ContainerAccessTypeContainer ContainerAccessType = "container" -) - -// ContainerAccessPolicy represents each access policy in the container ACL. -type ContainerAccessPolicy struct { - ID string - StartTime time.Time - ExpiryTime time.Time - CanRead bool - CanWrite bool - CanDelete bool -} - -// ContainerPermissions represents the container ACLs. -type ContainerPermissions struct { - AccessType ContainerAccessType - AccessPolicies []ContainerAccessPolicy -} - -// ContainerAccessHeader references header used when setting/getting container ACL -const ( - ContainerAccessHeader string = "x-ms-blob-public-access" -) - -// GetBlobReference returns a Blob object for the specified blob name. -func (c *Container) GetBlobReference(name string) *Blob { - return &Blob{ - Container: c, - Name: name, - } -} - -// CreateContainerOptions includes the options for a create container operation -type CreateContainerOptions struct { - Timeout uint - Access ContainerAccessType `header:"x-ms-blob-public-access"` - RequestID string `header:"x-ms-client-request-id"` -} - -// Create creates a blob container within the storage account -// with given name and access level. Returns error if container already exists. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Container -func (c *Container) Create(options *CreateContainerOptions) error { - resp, err := c.create(options) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// CreateIfNotExists creates a blob container if it does not exist. Returns -// true if container is newly created or false if container already exists. -func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error) { - resp, err := c.create(options) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { - return resp.statusCode == http.StatusCreated, nil - } - } - return false, err -} - -func (c *Container) create(options *CreateContainerOptions) (*storageResponse, error) { - query := url.Values{"restype": {"container"}} - headers := c.bsc.client.getStandardHeaders() - headers = c.bsc.client.addMetadataToHeaders(headers, c.Metadata) - - if options != nil { - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), query) - - return c.bsc.client.exec(http.MethodPut, uri, headers, nil, c.bsc.auth) -} - -// Exists returns true if a container with given name exists -// on the storage account, otherwise returns false. -func (c *Container) Exists() (bool, error) { - uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), url.Values{"restype": {"container"}}) - headers := c.bsc.client.getStandardHeaders() - - resp, err := c.bsc.client.exec(http.MethodHead, uri, headers, nil, c.bsc.auth) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, nil - } - } - return false, err -} - -// SetContainerPermissionOptions includes options for a set container permissions operation -type SetContainerPermissionOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - RequestID string `header:"x-ms-client-request-id"` -} - -// SetPermissions sets up container permissions -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Container-ACL -func (c *Container) SetPermissions(permissions ContainerPermissions, options *SetContainerPermissionOptions) error { - body, length, err := generateContainerACLpayload(permissions.AccessPolicies) - if err != nil { - return err - } - params := url.Values{ - "restype": {"container"}, - "comp": {"acl"}, - } - headers := c.bsc.client.getStandardHeaders() - headers = addToHeaders(headers, ContainerAccessHeader, string(permissions.AccessType)) - headers["Content-Length"] = strconv.Itoa(length) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params) - - resp, err := c.bsc.client.exec(http.MethodPut, uri, headers, body, c.bsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return errors.New("Unable to set permissions") - } - - return nil -} - -// GetContainerPermissionOptions includes options for a get container permissions operation -type GetContainerPermissionOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - RequestID string `header:"x-ms-client-request-id"` -} - -// GetPermissions gets the container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179469.aspx -// If timeout is 0 then it will not be passed to Azure -// leaseID will only be passed to Azure if populated -func (c *Container) GetPermissions(options *GetContainerPermissionOptions) (*ContainerPermissions, error) { - params := url.Values{ - "restype": {"container"}, - "comp": {"acl"}, - } - headers := c.bsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params) - - resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - var ap AccessPolicy - err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) - if err != nil { - return nil, err - } - return buildAccessPolicy(ap, &resp.headers), nil -} - -func buildAccessPolicy(ap AccessPolicy, headers *http.Header) *ContainerPermissions { - // containerAccess. Blob, Container, empty - containerAccess := headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader)) - permissions := ContainerPermissions{ - AccessType: ContainerAccessType(containerAccess), - AccessPolicies: []ContainerAccessPolicy{}, - } - - for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { - capd := ContainerAccessPolicy{ - ID: policy.ID, - StartTime: policy.AccessPolicy.StartTime, - ExpiryTime: policy.AccessPolicy.ExpiryTime, - } - capd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") - capd.CanWrite = updatePermissions(policy.AccessPolicy.Permission, "w") - capd.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d") - - permissions.AccessPolicies = append(permissions.AccessPolicies, capd) - } - return &permissions -} - -// DeleteContainerOptions includes options for a delete container operation -type DeleteContainerOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - RequestID string `header:"x-ms-client-request-id"` -} - -// Delete deletes the container with given name on the storage -// account. If the container does not exist returns error. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container -func (c *Container) Delete(options *DeleteContainerOptions) error { - resp, err := c.delete(options) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} - -// DeleteIfExists deletes the container with given name on the storage -// account if it exists. Returns true if container is deleted with this call, or -// false if the container did not exist at the time of the Delete Container -// operation. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container -func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error) { - resp, err := c.delete(options) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -func (c *Container) delete(options *DeleteContainerOptions) (*storageResponse, error) { - query := url.Values{"restype": {"container"}} - headers := c.bsc.client.getStandardHeaders() - - if options != nil { - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), query) - - return c.bsc.client.exec(http.MethodDelete, uri, headers, nil, c.bsc.auth) -} - -// ListBlobs returns an object that contains list of blobs in the container, -// pagination token and other information in the response of List Blobs call. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Blobs -func (c *Container) ListBlobs(params ListBlobsParameters) (BlobListResponse, error) { - q := mergeParams(params.getParameters(), url.Values{ - "restype": {"container"}, - "comp": {"list"}}, - ) - uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), q) - - headers := c.bsc.client.getStandardHeaders() - headers = addToHeaders(headers, "x-ms-client-request-id", params.RequestID) - - var out BlobListResponse - resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - err = xmlUnmarshal(resp.body, &out) - return out, err -} - -func generateContainerACLpayload(policies []ContainerAccessPolicy) (io.Reader, int, error) { - sil := SignedIdentifiers{ - SignedIdentifiers: []SignedIdentifier{}, - } - for _, capd := range policies { - permission := capd.generateContainerPermissions() - signedIdentifier := convertAccessPolicyToXMLStructs(capd.ID, capd.StartTime, capd.ExpiryTime, permission) - sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) - } - return xmlMarshal(sil) -} - -func (capd *ContainerAccessPolicy) generateContainerPermissions() (permissions string) { - // generate the permissions string (rwd). - // still want the end user API to have bool flags. - permissions = "" - - if capd.CanRead { - permissions += "r" - } - - if capd.CanWrite { - permissions += "w" - } - - if capd.CanDelete { - permissions += "d" - } - - return permissions -} +package storage + +import ( + "encoding/xml" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strconv" + "strings" + "time" +) + +// Container represents an Azure container. +type Container struct { + bsc *BlobStorageClient + Name string `xml:"Name"` + Properties ContainerProperties `xml:"Properties"` + Metadata map[string]string +} + +func (c *Container) buildPath() string { + return fmt.Sprintf("/%s", c.Name) +} + +// ContainerProperties contains various properties of a container returned from +// various endpoints like ListContainers. +type ContainerProperties struct { + LastModified string `xml:"Last-Modified"` + Etag string `xml:"Etag"` + LeaseStatus string `xml:"LeaseStatus"` + LeaseState string `xml:"LeaseState"` + LeaseDuration string `xml:"LeaseDuration"` +} + +// ContainerListResponse contains the response fields from +// ListContainers call. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx +type ContainerListResponse struct { + XMLName xml.Name `xml:"EnumerationResults"` + Xmlns string `xml:"xmlns,attr"` + Prefix string `xml:"Prefix"` + Marker string `xml:"Marker"` + NextMarker string `xml:"NextMarker"` + MaxResults int64 `xml:"MaxResults"` + Containers []Container `xml:"Containers>Container"` +} + +// BlobListResponse contains the response fields from ListBlobs call. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx +type BlobListResponse struct { + XMLName xml.Name `xml:"EnumerationResults"` + Xmlns string `xml:"xmlns,attr"` + Prefix string `xml:"Prefix"` + Marker string `xml:"Marker"` + NextMarker string `xml:"NextMarker"` + MaxResults int64 `xml:"MaxResults"` + Blobs []Blob `xml:"Blobs>Blob"` + + // BlobPrefix is used to traverse blobs as if it were a file system. + // It is returned if ListBlobsParameters.Delimiter is specified. + // The list here can be thought of as "folders" that may contain + // other folders or blobs. + BlobPrefixes []string `xml:"Blobs>BlobPrefix>Name"` + + // Delimiter is used to traverse blobs as if it were a file system. + // It is returned if ListBlobsParameters.Delimiter is specified. + Delimiter string `xml:"Delimiter"` +} + +// IncludeBlobDataset has options to include in a list blobs operation +type IncludeBlobDataset struct { + Snapshots bool + Metadata bool + UncommittedBlobs bool + Copy bool +} + +// ListBlobsParameters defines the set of customizable +// parameters to make a List Blobs call. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx +type ListBlobsParameters struct { + Prefix string + Delimiter string + Marker string + Include *IncludeBlobDataset + MaxResults uint + Timeout uint + RequestID string +} + +func (p ListBlobsParameters) getParameters() url.Values { + out := url.Values{} + + if p.Prefix != "" { + out.Set("prefix", p.Prefix) + } + if p.Delimiter != "" { + out.Set("delimiter", p.Delimiter) + } + if p.Marker != "" { + out.Set("marker", p.Marker) + } + if p.Include != nil { + include := []string{} + include = addString(include, p.Include.Snapshots, "snapshots") + include = addString(include, p.Include.Metadata, "metadata") + include = addString(include, p.Include.UncommittedBlobs, "uncommittedblobs") + include = addString(include, p.Include.Copy, "copy") + fullInclude := strings.Join(include, ",") + out.Set("include", fullInclude) + } + if p.MaxResults != 0 { + out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) + } + if p.Timeout != 0 { + out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10)) + } + + return out +} + +func addString(datasets []string, include bool, text string) []string { + if include { + datasets = append(datasets, text) + } + return datasets +} + +// ContainerAccessType defines the access level to the container from a public +// request. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx and "x-ms- +// blob-public-access" header. +type ContainerAccessType string + +// Access options for containers +const ( + ContainerAccessTypePrivate ContainerAccessType = "" + ContainerAccessTypeBlob ContainerAccessType = "blob" + ContainerAccessTypeContainer ContainerAccessType = "container" +) + +// ContainerAccessPolicy represents each access policy in the container ACL. +type ContainerAccessPolicy struct { + ID string + StartTime time.Time + ExpiryTime time.Time + CanRead bool + CanWrite bool + CanDelete bool +} + +// ContainerPermissions represents the container ACLs. +type ContainerPermissions struct { + AccessType ContainerAccessType + AccessPolicies []ContainerAccessPolicy +} + +// ContainerAccessHeader references header used when setting/getting container ACL +const ( + ContainerAccessHeader string = "x-ms-blob-public-access" +) + +// GetBlobReference returns a Blob object for the specified blob name. +func (c *Container) GetBlobReference(name string) *Blob { + return &Blob{ + Container: c, + Name: name, + } +} + +// CreateContainerOptions includes the options for a create container operation +type CreateContainerOptions struct { + Timeout uint + Access ContainerAccessType `header:"x-ms-blob-public-access"` + RequestID string `header:"x-ms-client-request-id"` +} + +// Create creates a blob container within the storage account +// with given name and access level. Returns error if container already exists. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Container +func (c *Container) Create(options *CreateContainerOptions) error { + resp, err := c.create(options) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// CreateIfNotExists creates a blob container if it does not exist. Returns +// true if container is newly created or false if container already exists. +func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error) { + resp, err := c.create(options) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { + return resp.statusCode == http.StatusCreated, nil + } + } + return false, err +} + +func (c *Container) create(options *CreateContainerOptions) (*storageResponse, error) { + query := url.Values{"restype": {"container"}} + headers := c.bsc.client.getStandardHeaders() + headers = c.bsc.client.addMetadataToHeaders(headers, c.Metadata) + + if options != nil { + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), query) + + return c.bsc.client.exec(http.MethodPut, uri, headers, nil, c.bsc.auth) +} + +// Exists returns true if a container with given name exists +// on the storage account, otherwise returns false. +func (c *Container) Exists() (bool, error) { + uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), url.Values{"restype": {"container"}}) + headers := c.bsc.client.getStandardHeaders() + + resp, err := c.bsc.client.exec(http.MethodHead, uri, headers, nil, c.bsc.auth) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusOK, nil + } + } + return false, err +} + +// SetContainerPermissionOptions includes options for a set container permissions operation +type SetContainerPermissionOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + RequestID string `header:"x-ms-client-request-id"` +} + +// SetPermissions sets up container permissions +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Container-ACL +func (c *Container) SetPermissions(permissions ContainerPermissions, options *SetContainerPermissionOptions) error { + body, length, err := generateContainerACLpayload(permissions.AccessPolicies) + if err != nil { + return err + } + params := url.Values{ + "restype": {"container"}, + "comp": {"acl"}, + } + headers := c.bsc.client.getStandardHeaders() + headers = addToHeaders(headers, ContainerAccessHeader, string(permissions.AccessType)) + headers["Content-Length"] = strconv.Itoa(length) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params) + + resp, err := c.bsc.client.exec(http.MethodPut, uri, headers, body, c.bsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return errors.New("Unable to set permissions") + } + + return nil +} + +// GetContainerPermissionOptions includes options for a get container permissions operation +type GetContainerPermissionOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + RequestID string `header:"x-ms-client-request-id"` +} + +// GetPermissions gets the container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179469.aspx +// If timeout is 0 then it will not be passed to Azure +// leaseID will only be passed to Azure if populated +func (c *Container) GetPermissions(options *GetContainerPermissionOptions) (*ContainerPermissions, error) { + params := url.Values{ + "restype": {"container"}, + "comp": {"acl"}, + } + headers := c.bsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params) + + resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + + var ap AccessPolicy + err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) + if err != nil { + return nil, err + } + return buildAccessPolicy(ap, &resp.headers), nil +} + +func buildAccessPolicy(ap AccessPolicy, headers *http.Header) *ContainerPermissions { + // containerAccess. Blob, Container, empty + containerAccess := headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader)) + permissions := ContainerPermissions{ + AccessType: ContainerAccessType(containerAccess), + AccessPolicies: []ContainerAccessPolicy{}, + } + + for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { + capd := ContainerAccessPolicy{ + ID: policy.ID, + StartTime: policy.AccessPolicy.StartTime, + ExpiryTime: policy.AccessPolicy.ExpiryTime, + } + capd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") + capd.CanWrite = updatePermissions(policy.AccessPolicy.Permission, "w") + capd.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d") + + permissions.AccessPolicies = append(permissions.AccessPolicies, capd) + } + return &permissions +} + +// DeleteContainerOptions includes options for a delete container operation +type DeleteContainerOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + RequestID string `header:"x-ms-client-request-id"` +} + +// Delete deletes the container with given name on the storage +// account. If the container does not exist returns error. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container +func (c *Container) Delete(options *DeleteContainerOptions) error { + resp, err := c.delete(options) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) +} + +// DeleteIfExists deletes the container with given name on the storage +// account if it exists. Returns true if container is deleted with this call, or +// false if the container did not exist at the time of the Delete Container +// operation. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container +func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error) { + resp, err := c.delete(options) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusAccepted, nil + } + } + return false, err +} + +func (c *Container) delete(options *DeleteContainerOptions) (*storageResponse, error) { + query := url.Values{"restype": {"container"}} + headers := c.bsc.client.getStandardHeaders() + + if options != nil { + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), query) + + return c.bsc.client.exec(http.MethodDelete, uri, headers, nil, c.bsc.auth) +} + +// ListBlobs returns an object that contains list of blobs in the container, +// pagination token and other information in the response of List Blobs call. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Blobs +func (c *Container) ListBlobs(params ListBlobsParameters) (BlobListResponse, error) { + q := mergeParams(params.getParameters(), url.Values{ + "restype": {"container"}, + "comp": {"list"}}, + ) + uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), q) + + headers := c.bsc.client.getStandardHeaders() + headers = addToHeaders(headers, "x-ms-client-request-id", params.RequestID) + + var out BlobListResponse + resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth) + if err != nil { + return out, err + } + defer resp.body.Close() + + err = xmlUnmarshal(resp.body, &out) + return out, err +} + +func generateContainerACLpayload(policies []ContainerAccessPolicy) (io.Reader, int, error) { + sil := SignedIdentifiers{ + SignedIdentifiers: []SignedIdentifier{}, + } + for _, capd := range policies { + permission := capd.generateContainerPermissions() + signedIdentifier := convertAccessPolicyToXMLStructs(capd.ID, capd.StartTime, capd.ExpiryTime, permission) + sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) + } + return xmlMarshal(sil) +} + +func (capd *ContainerAccessPolicy) generateContainerPermissions() (permissions string) { + // generate the permissions string (rwd). + // still want the end user API to have bool flags. + permissions = "" + + if capd.CanRead { + permissions += "r" + } + + if capd.CanWrite { + permissions += "w" + } + + if capd.CanDelete { + permissions += "d" + } + + return permissions +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/container_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/container_test.go index fd039210b8..17a3c3be21 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/container_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/container_test.go @@ -1,553 +1,553 @@ -package storage - -import ( - "sort" - "strconv" - "time" - - chk "gopkg.in/check.v1" -) - -type ContainerSuite struct{} - -var _ = chk.Suite(&ContainerSuite{}) - -func (s *ContainerSuite) Test_containerBuildPath(c *chk.C) { - cli := getBlobClient(c) - cnt := cli.GetContainerReference("lol") - c.Assert(cnt.buildPath(), chk.Equals, "/lol") -} - -func (s *ContainerSuite) TestListContainersPagination(c *chk.C) { - cli := getBlobClient(c) - cli.deleteTestContainers(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - const n = 5 - const pageSize = 2 - - cntNames := []string{} - for i := 0; i < n; i++ { - cntNames = append(cntNames, containerName(c, strconv.Itoa(i))) - } - sort.Strings(cntNames) - - // Create test containers - created := []*Container{} - for i := 0; i < n; i++ { - cnt := cli.GetContainerReference(cntNames[i]) - c.Assert(cnt.Create(nil), chk.IsNil) - created = append(created, cnt) - defer cnt.Delete(nil) - } - - // Paginate results - seen := []Container{} - marker := "" - for { - resp, err := cli.ListContainers(ListContainersParameters{ - MaxResults: pageSize, - Marker: marker}) - - c.Assert(err, chk.IsNil) - - if len(resp.Containers) > pageSize { - c.Fatalf("Got a bigger page. Expected: %d, got: %d", pageSize, len(resp.Containers)) - } - - for _, c := range resp.Containers { - seen = append(seen, c) - } - - marker = resp.NextMarker - if marker == "" || len(resp.Containers) == 0 { - break - } - } - - for i := range created { - c.Assert(seen[i].Name, chk.DeepEquals, created[i].Name) - } -} - -func (s *ContainerSuite) TestContainerExists(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // Container does not exist - cnt1 := cli.GetContainerReference(containerName(c, "1")) - ok, err := cnt1.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // COntainer exists - cnt2 := cli.GetContainerReference(containerName(c, "2")) - c.Assert(cnt2.Create(nil), chk.IsNil) - defer cnt2.Delete(nil) - ok, err = cnt2.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *ContainerSuite) TestCreateContainerDeleteContainer(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - c.Assert(cnt.Delete(nil), chk.IsNil) -} - -func (s *ContainerSuite) TestCreateContainerIfNotExists(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // Create non exisiting container - cnt := cli.GetContainerReference(containerName(c)) - ok, err := cnt.CreateIfNotExists(nil) - defer cnt.Delete(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - -} - -func (s *ContainerSuite) TestCreateContainerIfExists(c *chk.C) { - cli := getBlobClient(c) - cnt := cli.GetContainerReference(containerName(c)) - cnt.Create(nil) - defer cnt.Delete(nil) - rec := cli.client.appendRecorder(c) - cnt.bsc = &cli - defer rec.Stop() - - // Try to create already exisiting container - ok, err := cnt.CreateIfNotExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *ContainerSuite) TestDeleteContainerIfExists(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // Nonexisting container - cnt1 := cli.GetContainerReference(containerName(c, "1")) - ok, err := cnt1.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - ok, err = cnt1.DeleteIfExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // Existing container - cnt2 := cli.GetContainerReference(containerName(c, "2")) - c.Assert(cnt2.Create(nil), chk.IsNil) - ok, err = cnt2.DeleteIfExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *ContainerSuite) TestListBlobsPagination(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - cnt := cli.GetContainerReference(containerName(c)) - - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - blobs := []string{} - const n = 5 - const pageSize = 2 - for i := 0; i < n; i++ { - name := blobName(c, strconv.Itoa(i)) - b := cnt.GetBlobReference(name) - c.Assert(b.putSingleBlockBlob([]byte("Hello, world!")), chk.IsNil) - blobs = append(blobs, name) - } - sort.Strings(blobs) - - // Paginate - seen := []string{} - marker := "" - for { - resp, err := cnt.ListBlobs(ListBlobsParameters{ - MaxResults: pageSize, - Marker: marker}) - c.Assert(err, chk.IsNil) - - for _, v := range resp.Blobs { - seen = append(seen, v.Name) - } - - marker = resp.NextMarker - if marker == "" || len(resp.Blobs) == 0 { - break - } - } - - // Compare - c.Assert(seen, chk.DeepEquals, blobs) -} - -// listBlobsAsFiles is a helper function to list blobs as "folders" and "files". -func listBlobsAsFiles(cli BlobStorageClient, cnt *Container, parentDir string) (folders []string, files []string, err error) { - var blobParams ListBlobsParameters - var blobListResponse BlobListResponse - - // Top level "folders" - blobParams = ListBlobsParameters{ - Delimiter: "/", - Prefix: parentDir, - } - - blobListResponse, err = cnt.ListBlobs(blobParams) - if err != nil { - return nil, nil, err - } - - // These are treated as "folders" under the parentDir. - folders = blobListResponse.BlobPrefixes - - // "Files"" are blobs which are under the parentDir. - files = make([]string, len(blobListResponse.Blobs)) - for i := range blobListResponse.Blobs { - files[i] = blobListResponse.Blobs[i].Name - } - - return folders, files, nil -} - -// TestListBlobsTraversal tests that we can correctly traverse -// blobs in blob storage as if it were a file system by using -// a combination of Prefix, Delimiter, and BlobPrefixes. -// -// Blob storage is flat, but we can *simulate* the file -// system with folders and files using conventions in naming. -// With the blob namedd "/usr/bin/ls", when we use delimiter '/', -// the "ls" would be a "file"; with "/", /usr" and "/usr/bin" being -// the "folders" -// -// NOTE: The use of delimiter (eg forward slash) is extremely fiddly -// and difficult to get right so some discipline in naming and rules -// when using the API is required to get everything to work as expected. -// -// Assuming our delimiter is a forward slash, the rules are: -// -// - Do use a leading forward slash in blob names to make things -// consistent and simpler (see further). -// Note that doing so will show "" as the only top-level -// folder in the container in Azure portal, which may look strange. -// -// - The "folder names" are returned *with trailing forward slash* as per MSDN. -// -// - The "folder names" will be "absolute paths", e.g. listing things under "/usr/" -// will return folder names "/usr/bin/". -// -// - The "file names" are returned as full blob names, e.g. when listing -// things under "/usr/bin/", the file names will be "/usr/bin/ls" and -// "/usr/bin/cat". -// -// - Everything is returned with case-sensitive order as expected in real file system -// as per MSDN. -// -// - To list things under a "folder" always use trailing forward slash. -// -// Example: to list top level folders we use root folder named "" with -// trailing forward slash, so we use "/". -// -// Example: to list folders under "/usr", we again append forward slash and -// so we use "/usr/". -// -// Because we use leading forward slash we don't need to have different -// treatment of "get top-level folders" and "get non-top-level folders" -// scenarios. -func (s *ContainerSuite) TestListBlobsTraversal(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - // Note use of leading forward slash as per naming rules. - blobsToCreate := []string{ - "/usr/bin/ls", - "/usr/bin/cat", - "/usr/lib64/libc.so", - "/etc/hosts", - "/etc/init.d/iptables", - } - - // Create the above blobs - for _, blobName := range blobsToCreate { - b := cnt.GetBlobReference(blobName) - err := b.CreateBlockBlob(nil) - c.Assert(err, chk.IsNil) - } - - var folders []string - var files []string - var err error - - // Top level folders and files. - folders, files, err = listBlobsAsFiles(cli, cnt, "/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string{"/etc/", "/usr/"}) - c.Assert(files, chk.DeepEquals, []string{}) - - // Things under /etc/. Note use of trailing forward slash here as per rules. - folders, files, err = listBlobsAsFiles(cli, cnt, "/etc/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string{"/etc/init.d/"}) - c.Assert(files, chk.DeepEquals, []string{"/etc/hosts"}) - - // Things under /etc/init.d/ - folders, files, err = listBlobsAsFiles(cli, cnt, "/etc/init.d/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string(nil)) - c.Assert(files, chk.DeepEquals, []string{"/etc/init.d/iptables"}) - - // Things under /usr/ - folders, files, err = listBlobsAsFiles(cli, cnt, "/usr/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string{"/usr/bin/", "/usr/lib64/"}) - c.Assert(files, chk.DeepEquals, []string{}) - - // Things under /usr/bin/ - folders, files, err = listBlobsAsFiles(cli, cnt, "/usr/bin/") - c.Assert(err, chk.IsNil) - c.Assert(folders, chk.DeepEquals, []string(nil)) - c.Assert(files, chk.DeepEquals, []string{"/usr/bin/cat", "/usr/bin/ls"}) -} - -func (s *ContainerSuite) TestListBlobsWithMetadata(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - expectMeta := make(map[string]BlobMetadata) - - // Put 4 blobs with metadata - for i := 0; i < 4; i++ { - name := blobName(c, strconv.Itoa(i)) - b := cnt.GetBlobReference(name) - c.Assert(b.putSingleBlockBlob([]byte("Hello, world!")), chk.IsNil) - b.Metadata = BlobMetadata{ - "Lol": name, - "Rofl_BAZ": "Waz Qux", - } - c.Assert(b.SetMetadata(nil), chk.IsNil) - expectMeta[name] = BlobMetadata{ - "lol": name, - "rofl_baz": "Waz Qux", - } - _, err := b.CreateSnapshot(nil) - c.Assert(err, chk.IsNil) - } - - // Put one more blob with no metadata - b := cnt.GetBlobReference(blobName(c, "nometa")) - c.Assert(b.putSingleBlockBlob([]byte("Hello, world!")), chk.IsNil) - expectMeta[b.Name] = nil - - // Get ListBlobs with include: metadata and snapshots - resp, err := cnt.ListBlobs(ListBlobsParameters{ - Include: &IncludeBlobDataset{ - Metadata: true, - Snapshots: true, - }, - }) - c.Assert(err, chk.IsNil) - - originalBlobs := make(map[string]Blob) - snapshotBlobs := make(map[string]Blob) - for _, v := range resp.Blobs { - if v.Snapshot == (time.Time{}) { - originalBlobs[v.Name] = v - } else { - snapshotBlobs[v.Name] = v - - } - } - c.Assert(originalBlobs, chk.HasLen, 5) - c.Assert(snapshotBlobs, chk.HasLen, 4) - - // Verify the metadata is as expected - for name := range expectMeta { - c.Check(originalBlobs[name].Metadata, chk.DeepEquals, expectMeta[name]) - c.Check(snapshotBlobs[name].Metadata, chk.DeepEquals, expectMeta[name]) - } -} - -func appendContainerPermission(perms ContainerPermissions, accessType ContainerAccessType, - ID string, start time.Time, expiry time.Time, - canRead bool, canWrite bool, canDelete bool) ContainerPermissions { - - perms.AccessType = accessType - - if ID != "" { - capd := ContainerAccessPolicy{ - ID: ID, - StartTime: start, - ExpiryTime: expiry, - CanRead: canRead, - CanWrite: canWrite, - CanDelete: canDelete, - } - perms.AccessPolicies = append(perms.AccessPolicies, capd) - } - return perms -} - -func (s *ContainerSuite) TestSetContainerPermissionsWithTimeoutSuccessfully(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) - - options := SetContainerPermissionOptions{ - Timeout: 30, - } - err := cnt.SetPermissions(perms, &options) - c.Assert(err, chk.IsNil) -} - -func (s *ContainerSuite) TestSetContainerPermissionsSuccessfully(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) - - err := cnt.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) -} - -func (s *ContainerSuite) TestSetThenGetContainerPermissionsSuccessfully(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.delete(nil) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "AutoRestIsSuperCool", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime.Add(20*time.Hour), fixedTime.Add(30*time.Hour), true, false, false) - c.Assert(perms.AccessPolicies, chk.HasLen, 2) - - err := cnt.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) - - newPerms, err := cnt.GetPermissions(nil) - c.Assert(err, chk.IsNil) - - // check container permissions itself. - c.Assert(newPerms.AccessType, chk.Equals, perms.AccessType) - - // fixedTime check policy set. - c.Assert(newPerms.AccessPolicies, chk.HasLen, 2) - - for i := range perms.AccessPolicies { - c.Assert(newPerms.AccessPolicies[i].ID, chk.Equals, perms.AccessPolicies[i].ID) - - // test timestamps down the second - // rounding start/expiry time original perms since the returned perms would have been rounded. - // so need rounded vs rounded. - c.Assert(newPerms.AccessPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, perms.AccessPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(newPerms.AccessPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, perms.AccessPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(newPerms.AccessPolicies[i].CanRead, chk.Equals, perms.AccessPolicies[i].CanRead) - c.Assert(newPerms.AccessPolicies[i].CanWrite, chk.Equals, perms.AccessPolicies[i].CanWrite) - c.Assert(newPerms.AccessPolicies[i].CanDelete, chk.Equals, perms.AccessPolicies[i].CanDelete) - } -} - -func (s *ContainerSuite) TestSetContainerPermissionsOnlySuccessfully(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) - - err := cnt.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) -} - -func (s *ContainerSuite) TestSetThenGetContainerPermissionsOnlySuccessfully(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - perms := ContainerPermissions{} - perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) - - err := cnt.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) - - newPerms, err := cnt.GetPermissions(nil) - c.Assert(err, chk.IsNil) - - // check container permissions itself. - c.Assert(newPerms.AccessType, chk.Equals, perms.AccessType) - - // fixedTime check there are NO policies set - c.Assert(newPerms.AccessPolicies, chk.HasLen, 0) -} - -func (cli *BlobStorageClient) deleteTestContainers(c *chk.C) error { - for { - resp, err := cli.ListContainers(ListContainersParameters{}) - if err != nil { - return err - } - if len(resp.Containers) == 0 { - break - } - for _, c := range resp.Containers { - err = c.Delete(nil) - if err != nil { - return err - } - } - } - return nil -} - -func containerName(c *chk.C, extras ...string) string { - return nameGenerator(32, "cnt-", alphanum, c, extras) -} +package storage + +import ( + "sort" + "strconv" + "time" + + chk "gopkg.in/check.v1" +) + +type ContainerSuite struct{} + +var _ = chk.Suite(&ContainerSuite{}) + +func (s *ContainerSuite) Test_containerBuildPath(c *chk.C) { + cli := getBlobClient(c) + cnt := cli.GetContainerReference("lol") + c.Assert(cnt.buildPath(), chk.Equals, "/lol") +} + +func (s *ContainerSuite) TestListContainersPagination(c *chk.C) { + cli := getBlobClient(c) + cli.deleteTestContainers(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + const n = 5 + const pageSize = 2 + + cntNames := []string{} + for i := 0; i < n; i++ { + cntNames = append(cntNames, containerName(c, strconv.Itoa(i))) + } + sort.Strings(cntNames) + + // Create test containers + created := []*Container{} + for i := 0; i < n; i++ { + cnt := cli.GetContainerReference(cntNames[i]) + c.Assert(cnt.Create(nil), chk.IsNil) + created = append(created, cnt) + defer cnt.Delete(nil) + } + + // Paginate results + seen := []Container{} + marker := "" + for { + resp, err := cli.ListContainers(ListContainersParameters{ + MaxResults: pageSize, + Marker: marker}) + + c.Assert(err, chk.IsNil) + + if len(resp.Containers) > pageSize { + c.Fatalf("Got a bigger page. Expected: %d, got: %d", pageSize, len(resp.Containers)) + } + + for _, c := range resp.Containers { + seen = append(seen, c) + } + + marker = resp.NextMarker + if marker == "" || len(resp.Containers) == 0 { + break + } + } + + for i := range created { + c.Assert(seen[i].Name, chk.DeepEquals, created[i].Name) + } +} + +func (s *ContainerSuite) TestContainerExists(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // Container does not exist + cnt1 := cli.GetContainerReference(containerName(c, "1")) + ok, err := cnt1.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + + // COntainer exists + cnt2 := cli.GetContainerReference(containerName(c, "2")) + c.Assert(cnt2.Create(nil), chk.IsNil) + defer cnt2.Delete(nil) + ok, err = cnt2.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) +} + +func (s *ContainerSuite) TestCreateContainerDeleteContainer(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + c.Assert(cnt.Delete(nil), chk.IsNil) +} + +func (s *ContainerSuite) TestCreateContainerIfNotExists(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // Create non exisiting container + cnt := cli.GetContainerReference(containerName(c)) + ok, err := cnt.CreateIfNotExists(nil) + defer cnt.Delete(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) + +} + +func (s *ContainerSuite) TestCreateContainerIfExists(c *chk.C) { + cli := getBlobClient(c) + cnt := cli.GetContainerReference(containerName(c)) + cnt.Create(nil) + defer cnt.Delete(nil) + rec := cli.client.appendRecorder(c) + cnt.bsc = &cli + defer rec.Stop() + + // Try to create already exisiting container + ok, err := cnt.CreateIfNotExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) +} + +func (s *ContainerSuite) TestDeleteContainerIfExists(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // Nonexisting container + cnt1 := cli.GetContainerReference(containerName(c, "1")) + ok, err := cnt1.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + ok, err = cnt1.DeleteIfExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + + // Existing container + cnt2 := cli.GetContainerReference(containerName(c, "2")) + c.Assert(cnt2.Create(nil), chk.IsNil) + ok, err = cnt2.DeleteIfExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) +} + +func (s *ContainerSuite) TestListBlobsPagination(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + cnt := cli.GetContainerReference(containerName(c)) + + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + blobs := []string{} + const n = 5 + const pageSize = 2 + for i := 0; i < n; i++ { + name := blobName(c, strconv.Itoa(i)) + b := cnt.GetBlobReference(name) + c.Assert(b.putSingleBlockBlob([]byte("Hello, world!")), chk.IsNil) + blobs = append(blobs, name) + } + sort.Strings(blobs) + + // Paginate + seen := []string{} + marker := "" + for { + resp, err := cnt.ListBlobs(ListBlobsParameters{ + MaxResults: pageSize, + Marker: marker}) + c.Assert(err, chk.IsNil) + + for _, v := range resp.Blobs { + seen = append(seen, v.Name) + } + + marker = resp.NextMarker + if marker == "" || len(resp.Blobs) == 0 { + break + } + } + + // Compare + c.Assert(seen, chk.DeepEquals, blobs) +} + +// listBlobsAsFiles is a helper function to list blobs as "folders" and "files". +func listBlobsAsFiles(cli BlobStorageClient, cnt *Container, parentDir string) (folders []string, files []string, err error) { + var blobParams ListBlobsParameters + var blobListResponse BlobListResponse + + // Top level "folders" + blobParams = ListBlobsParameters{ + Delimiter: "/", + Prefix: parentDir, + } + + blobListResponse, err = cnt.ListBlobs(blobParams) + if err != nil { + return nil, nil, err + } + + // These are treated as "folders" under the parentDir. + folders = blobListResponse.BlobPrefixes + + // "Files"" are blobs which are under the parentDir. + files = make([]string, len(blobListResponse.Blobs)) + for i := range blobListResponse.Blobs { + files[i] = blobListResponse.Blobs[i].Name + } + + return folders, files, nil +} + +// TestListBlobsTraversal tests that we can correctly traverse +// blobs in blob storage as if it were a file system by using +// a combination of Prefix, Delimiter, and BlobPrefixes. +// +// Blob storage is flat, but we can *simulate* the file +// system with folders and files using conventions in naming. +// With the blob namedd "/usr/bin/ls", when we use delimiter '/', +// the "ls" would be a "file"; with "/", /usr" and "/usr/bin" being +// the "folders" +// +// NOTE: The use of delimiter (eg forward slash) is extremely fiddly +// and difficult to get right so some discipline in naming and rules +// when using the API is required to get everything to work as expected. +// +// Assuming our delimiter is a forward slash, the rules are: +// +// - Do use a leading forward slash in blob names to make things +// consistent and simpler (see further). +// Note that doing so will show "" as the only top-level +// folder in the container in Azure portal, which may look strange. +// +// - The "folder names" are returned *with trailing forward slash* as per MSDN. +// +// - The "folder names" will be "absolute paths", e.g. listing things under "/usr/" +// will return folder names "/usr/bin/". +// +// - The "file names" are returned as full blob names, e.g. when listing +// things under "/usr/bin/", the file names will be "/usr/bin/ls" and +// "/usr/bin/cat". +// +// - Everything is returned with case-sensitive order as expected in real file system +// as per MSDN. +// +// - To list things under a "folder" always use trailing forward slash. +// +// Example: to list top level folders we use root folder named "" with +// trailing forward slash, so we use "/". +// +// Example: to list folders under "/usr", we again append forward slash and +// so we use "/usr/". +// +// Because we use leading forward slash we don't need to have different +// treatment of "get top-level folders" and "get non-top-level folders" +// scenarios. +func (s *ContainerSuite) TestListBlobsTraversal(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + // Note use of leading forward slash as per naming rules. + blobsToCreate := []string{ + "/usr/bin/ls", + "/usr/bin/cat", + "/usr/lib64/libc.so", + "/etc/hosts", + "/etc/init.d/iptables", + } + + // Create the above blobs + for _, blobName := range blobsToCreate { + b := cnt.GetBlobReference(blobName) + err := b.CreateBlockBlob(nil) + c.Assert(err, chk.IsNil) + } + + var folders []string + var files []string + var err error + + // Top level folders and files. + folders, files, err = listBlobsAsFiles(cli, cnt, "/") + c.Assert(err, chk.IsNil) + c.Assert(folders, chk.DeepEquals, []string{"/etc/", "/usr/"}) + c.Assert(files, chk.DeepEquals, []string{}) + + // Things under /etc/. Note use of trailing forward slash here as per rules. + folders, files, err = listBlobsAsFiles(cli, cnt, "/etc/") + c.Assert(err, chk.IsNil) + c.Assert(folders, chk.DeepEquals, []string{"/etc/init.d/"}) + c.Assert(files, chk.DeepEquals, []string{"/etc/hosts"}) + + // Things under /etc/init.d/ + folders, files, err = listBlobsAsFiles(cli, cnt, "/etc/init.d/") + c.Assert(err, chk.IsNil) + c.Assert(folders, chk.DeepEquals, []string(nil)) + c.Assert(files, chk.DeepEquals, []string{"/etc/init.d/iptables"}) + + // Things under /usr/ + folders, files, err = listBlobsAsFiles(cli, cnt, "/usr/") + c.Assert(err, chk.IsNil) + c.Assert(folders, chk.DeepEquals, []string{"/usr/bin/", "/usr/lib64/"}) + c.Assert(files, chk.DeepEquals, []string{}) + + // Things under /usr/bin/ + folders, files, err = listBlobsAsFiles(cli, cnt, "/usr/bin/") + c.Assert(err, chk.IsNil) + c.Assert(folders, chk.DeepEquals, []string(nil)) + c.Assert(files, chk.DeepEquals, []string{"/usr/bin/cat", "/usr/bin/ls"}) +} + +func (s *ContainerSuite) TestListBlobsWithMetadata(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + expectMeta := make(map[string]BlobMetadata) + + // Put 4 blobs with metadata + for i := 0; i < 4; i++ { + name := blobName(c, strconv.Itoa(i)) + b := cnt.GetBlobReference(name) + c.Assert(b.putSingleBlockBlob([]byte("Hello, world!")), chk.IsNil) + b.Metadata = BlobMetadata{ + "Lol": name, + "Rofl_BAZ": "Waz Qux", + } + c.Assert(b.SetMetadata(nil), chk.IsNil) + expectMeta[name] = BlobMetadata{ + "lol": name, + "rofl_baz": "Waz Qux", + } + _, err := b.CreateSnapshot(nil) + c.Assert(err, chk.IsNil) + } + + // Put one more blob with no metadata + b := cnt.GetBlobReference(blobName(c, "nometa")) + c.Assert(b.putSingleBlockBlob([]byte("Hello, world!")), chk.IsNil) + expectMeta[b.Name] = nil + + // Get ListBlobs with include: metadata and snapshots + resp, err := cnt.ListBlobs(ListBlobsParameters{ + Include: &IncludeBlobDataset{ + Metadata: true, + Snapshots: true, + }, + }) + c.Assert(err, chk.IsNil) + + originalBlobs := make(map[string]Blob) + snapshotBlobs := make(map[string]Blob) + for _, v := range resp.Blobs { + if v.Snapshot == (time.Time{}) { + originalBlobs[v.Name] = v + } else { + snapshotBlobs[v.Name] = v + + } + } + c.Assert(originalBlobs, chk.HasLen, 5) + c.Assert(snapshotBlobs, chk.HasLen, 4) + + // Verify the metadata is as expected + for name := range expectMeta { + c.Check(originalBlobs[name].Metadata, chk.DeepEquals, expectMeta[name]) + c.Check(snapshotBlobs[name].Metadata, chk.DeepEquals, expectMeta[name]) + } +} + +func appendContainerPermission(perms ContainerPermissions, accessType ContainerAccessType, + ID string, start time.Time, expiry time.Time, + canRead bool, canWrite bool, canDelete bool) ContainerPermissions { + + perms.AccessType = accessType + + if ID != "" { + capd := ContainerAccessPolicy{ + ID: ID, + StartTime: start, + ExpiryTime: expiry, + CanRead: canRead, + CanWrite: canWrite, + CanDelete: canDelete, + } + perms.AccessPolicies = append(perms.AccessPolicies, capd) + } + return perms +} + +func (s *ContainerSuite) TestSetContainerPermissionsWithTimeoutSuccessfully(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + perms := ContainerPermissions{} + perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) + + options := SetContainerPermissionOptions{ + Timeout: 30, + } + err := cnt.SetPermissions(perms, &options) + c.Assert(err, chk.IsNil) +} + +func (s *ContainerSuite) TestSetContainerPermissionsSuccessfully(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + perms := ContainerPermissions{} + perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) + + err := cnt.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) +} + +func (s *ContainerSuite) TestSetThenGetContainerPermissionsSuccessfully(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.delete(nil) + + perms := ContainerPermissions{} + perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "AutoRestIsSuperCool", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) + perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime.Add(20*time.Hour), fixedTime.Add(30*time.Hour), true, false, false) + c.Assert(perms.AccessPolicies, chk.HasLen, 2) + + err := cnt.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) + + newPerms, err := cnt.GetPermissions(nil) + c.Assert(err, chk.IsNil) + + // check container permissions itself. + c.Assert(newPerms.AccessType, chk.Equals, perms.AccessType) + + // fixedTime check policy set. + c.Assert(newPerms.AccessPolicies, chk.HasLen, 2) + + for i := range perms.AccessPolicies { + c.Assert(newPerms.AccessPolicies[i].ID, chk.Equals, perms.AccessPolicies[i].ID) + + // test timestamps down the second + // rounding start/expiry time original perms since the returned perms would have been rounded. + // so need rounded vs rounded. + c.Assert(newPerms.AccessPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123), + chk.Equals, perms.AccessPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123)) + + c.Assert(newPerms.AccessPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123), + chk.Equals, perms.AccessPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123)) + + c.Assert(newPerms.AccessPolicies[i].CanRead, chk.Equals, perms.AccessPolicies[i].CanRead) + c.Assert(newPerms.AccessPolicies[i].CanWrite, chk.Equals, perms.AccessPolicies[i].CanWrite) + c.Assert(newPerms.AccessPolicies[i].CanDelete, chk.Equals, perms.AccessPolicies[i].CanDelete) + } +} + +func (s *ContainerSuite) TestSetContainerPermissionsOnlySuccessfully(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + perms := ContainerPermissions{} + perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "GolangRocksOnAzure", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) + + err := cnt.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) +} + +func (s *ContainerSuite) TestSetThenGetContainerPermissionsOnlySuccessfully(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + perms := ContainerPermissions{} + perms = appendContainerPermission(perms, ContainerAccessTypeBlob, "", fixedTime, fixedTime.Add(10*time.Hour), true, true, true) + + err := cnt.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) + + newPerms, err := cnt.GetPermissions(nil) + c.Assert(err, chk.IsNil) + + // check container permissions itself. + c.Assert(newPerms.AccessType, chk.Equals, perms.AccessType) + + // fixedTime check there are NO policies set + c.Assert(newPerms.AccessPolicies, chk.HasLen, 0) +} + +func (cli *BlobStorageClient) deleteTestContainers(c *chk.C) error { + for { + resp, err := cli.ListContainers(ListContainersParameters{}) + if err != nil { + return err + } + if len(resp.Containers) == 0 { + break + } + for _, c := range resp.Containers { + err = c.Delete(nil) + if err != nil { + return err + } + } + } + return nil +} + +func containerName(c *chk.C, extras ...string) string { + return nameGenerator(32, "cnt-", alphanum, c, extras) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go index 050aebd65f..377a3c622e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go @@ -1,223 +1,223 @@ -package storage - -import ( - "errors" - "fmt" - "net/http" - "net/url" - "strings" - "time" -) - -const ( - blobCopyStatusPending = "pending" - blobCopyStatusSuccess = "success" - blobCopyStatusAborted = "aborted" - blobCopyStatusFailed = "failed" -) - -// CopyOptions includes the options for a copy blob operation -type CopyOptions struct { - Timeout uint - Source CopyOptionsConditions - Destiny CopyOptionsConditions - RequestID string -} - -// IncrementalCopyOptions includes the options for an incremental copy blob operation -type IncrementalCopyOptions struct { - Timeout uint - Destination IncrementalCopyOptionsConditions - RequestID string -} - -// CopyOptionsConditions includes some conditional options in a copy blob operation -type CopyOptionsConditions struct { - LeaseID string - IfModifiedSince *time.Time - IfUnmodifiedSince *time.Time - IfMatch string - IfNoneMatch string -} - -// IncrementalCopyOptionsConditions includes some conditional options in a copy blob operation -type IncrementalCopyOptionsConditions struct { - IfModifiedSince *time.Time - IfUnmodifiedSince *time.Time - IfMatch string - IfNoneMatch string -} - -// Copy starts a blob copy operation and waits for the operation to -// complete. sourceBlob parameter must be a canonical URL to the blob (can be -// obtained using GetBlobURL method.) There is no SLA on blob copy and therefore -// this helper method works faster on smaller files. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob -func (b *Blob) Copy(sourceBlob string, options *CopyOptions) error { - copyID, err := b.StartCopy(sourceBlob, options) - if err != nil { - return err - } - - return b.WaitForCopy(copyID) -} - -// StartCopy starts a blob copy operation. -// sourceBlob parameter must be a canonical URL to the blob (can be -// obtained using GetBlobURL method.) -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob -func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error) { - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-copy-source"] = sourceBlob - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) - // source - headers = addToHeaders(headers, "x-ms-source-lease-id", options.Source.LeaseID) - headers = addTimeToHeaders(headers, "x-ms-source-if-modified-since", options.Source.IfModifiedSince) - headers = addTimeToHeaders(headers, "x-ms-source-if-unmodified-since", options.Source.IfUnmodifiedSince) - headers = addToHeaders(headers, "x-ms-source-if-match", options.Source.IfMatch) - headers = addToHeaders(headers, "x-ms-source-if-none-match", options.Source.IfNoneMatch) - //destiny - headers = addToHeaders(headers, "x-ms-lease-id", options.Destiny.LeaseID) - headers = addTimeToHeaders(headers, "x-ms-if-modified-since", options.Destiny.IfModifiedSince) - headers = addTimeToHeaders(headers, "x-ms-if-unmodified-since", options.Destiny.IfUnmodifiedSince) - headers = addToHeaders(headers, "x-ms-if-match", options.Destiny.IfMatch) - headers = addToHeaders(headers, "x-ms-if-none-match", options.Destiny.IfNoneMatch) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return "", err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted, http.StatusCreated}); err != nil { - return "", err - } - - copyID := resp.headers.Get("x-ms-copy-id") - if copyID == "" { - return "", errors.New("Got empty copy id header") - } - return copyID, nil -} - -// AbortCopyOptions includes the options for an abort blob operation -type AbortCopyOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - RequestID string `header:"x-ms-client-request-id"` -} - -// AbortCopy aborts a BlobCopy which has already been triggered by the StartBlobCopy function. -// copyID is generated from StartBlobCopy function. -// currentLeaseID is required IF the destination blob has an active lease on it. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Abort-Copy-Blob -func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error { - params := url.Values{ - "comp": {"copy"}, - "copyid": {copyID}, - } - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-copy-action"] = "abort" - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// WaitForCopy loops until a BlobCopy operation is completed (or fails with error) -func (b *Blob) WaitForCopy(copyID string) error { - for { - err := b.GetProperties(nil) - if err != nil { - return err - } - - if b.Properties.CopyID != copyID { - return errBlobCopyIDMismatch - } - - switch b.Properties.CopyStatus { - case blobCopyStatusSuccess: - return nil - case blobCopyStatusPending: - continue - case blobCopyStatusAborted: - return errBlobCopyAborted - case blobCopyStatusFailed: - return fmt.Errorf("storage: blob copy failed. Id=%s Description=%s", b.Properties.CopyID, b.Properties.CopyStatusDescription) - default: - return fmt.Errorf("storage: unhandled blob copy status: '%s'", b.Properties.CopyStatus) - } - } -} - -// IncrementalCopyBlob copies a snapshot of a source blob and copies to referring blob -// sourceBlob parameter must be a valid snapshot URL of the original blob. -// THe original blob mut be public, or use a Shared Access Signature. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/incremental-copy-blob . -func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time, options *IncrementalCopyOptions) (string, error) { - params := url.Values{"comp": {"incrementalcopy"}} - - // need formatting to 7 decimal places so it's friendly to Windows and *nix - snapshotTimeFormatted := snapshotTime.Format("2006-01-02T15:04:05.0000000Z") - u, err := url.Parse(sourceBlobURL) - if err != nil { - return "", err - } - query := u.Query() - query.Add("snapshot", snapshotTimeFormatted) - encodedQuery := query.Encode() - encodedQuery = strings.Replace(encodedQuery, "%3A", ":", -1) - u.RawQuery = encodedQuery - snapshotURL := u.String() - - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-copy-source"] = snapshotURL - - if options != nil { - addTimeout(params, options.Timeout) - headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) - headers = addTimeToHeaders(headers, "x-ms-if-modified-since", options.Destination.IfModifiedSince) - headers = addTimeToHeaders(headers, "x-ms-if-unmodified-since", options.Destination.IfUnmodifiedSince) - headers = addToHeaders(headers, "x-ms-if-match", options.Destination.IfMatch) - headers = addToHeaders(headers, "x-ms-if-none-match", options.Destination.IfNoneMatch) - } - - // get URI of destination blob - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return "", err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted}); err != nil { - return "", err - } - - copyID := resp.headers.Get("x-ms-copy-id") - if copyID == "" { - return "", errors.New("Got empty copy id header") - } - return copyID, nil -} +package storage + +import ( + "errors" + "fmt" + "net/http" + "net/url" + "strings" + "time" +) + +const ( + blobCopyStatusPending = "pending" + blobCopyStatusSuccess = "success" + blobCopyStatusAborted = "aborted" + blobCopyStatusFailed = "failed" +) + +// CopyOptions includes the options for a copy blob operation +type CopyOptions struct { + Timeout uint + Source CopyOptionsConditions + Destiny CopyOptionsConditions + RequestID string +} + +// IncrementalCopyOptions includes the options for an incremental copy blob operation +type IncrementalCopyOptions struct { + Timeout uint + Destination IncrementalCopyOptionsConditions + RequestID string +} + +// CopyOptionsConditions includes some conditional options in a copy blob operation +type CopyOptionsConditions struct { + LeaseID string + IfModifiedSince *time.Time + IfUnmodifiedSince *time.Time + IfMatch string + IfNoneMatch string +} + +// IncrementalCopyOptionsConditions includes some conditional options in a copy blob operation +type IncrementalCopyOptionsConditions struct { + IfModifiedSince *time.Time + IfUnmodifiedSince *time.Time + IfMatch string + IfNoneMatch string +} + +// Copy starts a blob copy operation and waits for the operation to +// complete. sourceBlob parameter must be a canonical URL to the blob (can be +// obtained using GetBlobURL method.) There is no SLA on blob copy and therefore +// this helper method works faster on smaller files. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob +func (b *Blob) Copy(sourceBlob string, options *CopyOptions) error { + copyID, err := b.StartCopy(sourceBlob, options) + if err != nil { + return err + } + + return b.WaitForCopy(copyID) +} + +// StartCopy starts a blob copy operation. +// sourceBlob parameter must be a canonical URL to the blob (can be +// obtained using GetBlobURL method.) +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob +func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error) { + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-copy-source"] = sourceBlob + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) + // source + headers = addToHeaders(headers, "x-ms-source-lease-id", options.Source.LeaseID) + headers = addTimeToHeaders(headers, "x-ms-source-if-modified-since", options.Source.IfModifiedSince) + headers = addTimeToHeaders(headers, "x-ms-source-if-unmodified-since", options.Source.IfUnmodifiedSince) + headers = addToHeaders(headers, "x-ms-source-if-match", options.Source.IfMatch) + headers = addToHeaders(headers, "x-ms-source-if-none-match", options.Source.IfNoneMatch) + //destiny + headers = addToHeaders(headers, "x-ms-lease-id", options.Destiny.LeaseID) + headers = addTimeToHeaders(headers, "x-ms-if-modified-since", options.Destiny.IfModifiedSince) + headers = addTimeToHeaders(headers, "x-ms-if-unmodified-since", options.Destiny.IfUnmodifiedSince) + headers = addToHeaders(headers, "x-ms-if-match", options.Destiny.IfMatch) + headers = addToHeaders(headers, "x-ms-if-none-match", options.Destiny.IfNoneMatch) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return "", err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted, http.StatusCreated}); err != nil { + return "", err + } + + copyID := resp.headers.Get("x-ms-copy-id") + if copyID == "" { + return "", errors.New("Got empty copy id header") + } + return copyID, nil +} + +// AbortCopyOptions includes the options for an abort blob operation +type AbortCopyOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + RequestID string `header:"x-ms-client-request-id"` +} + +// AbortCopy aborts a BlobCopy which has already been triggered by the StartBlobCopy function. +// copyID is generated from StartBlobCopy function. +// currentLeaseID is required IF the destination blob has an active lease on it. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Abort-Copy-Blob +func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error { + params := url.Values{ + "comp": {"copy"}, + "copyid": {copyID}, + } + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-copy-action"] = "abort" + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) +} + +// WaitForCopy loops until a BlobCopy operation is completed (or fails with error) +func (b *Blob) WaitForCopy(copyID string) error { + for { + err := b.GetProperties(nil) + if err != nil { + return err + } + + if b.Properties.CopyID != copyID { + return errBlobCopyIDMismatch + } + + switch b.Properties.CopyStatus { + case blobCopyStatusSuccess: + return nil + case blobCopyStatusPending: + continue + case blobCopyStatusAborted: + return errBlobCopyAborted + case blobCopyStatusFailed: + return fmt.Errorf("storage: blob copy failed. Id=%s Description=%s", b.Properties.CopyID, b.Properties.CopyStatusDescription) + default: + return fmt.Errorf("storage: unhandled blob copy status: '%s'", b.Properties.CopyStatus) + } + } +} + +// IncrementalCopyBlob copies a snapshot of a source blob and copies to referring blob +// sourceBlob parameter must be a valid snapshot URL of the original blob. +// THe original blob mut be public, or use a Shared Access Signature. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/incremental-copy-blob . +func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time, options *IncrementalCopyOptions) (string, error) { + params := url.Values{"comp": {"incrementalcopy"}} + + // need formatting to 7 decimal places so it's friendly to Windows and *nix + snapshotTimeFormatted := snapshotTime.Format("2006-01-02T15:04:05.0000000Z") + u, err := url.Parse(sourceBlobURL) + if err != nil { + return "", err + } + query := u.Query() + query.Add("snapshot", snapshotTimeFormatted) + encodedQuery := query.Encode() + encodedQuery = strings.Replace(encodedQuery, "%3A", ":", -1) + u.RawQuery = encodedQuery + snapshotURL := u.String() + + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-copy-source"] = snapshotURL + + if options != nil { + addTimeout(params, options.Timeout) + headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) + headers = addTimeToHeaders(headers, "x-ms-if-modified-since", options.Destination.IfModifiedSince) + headers = addTimeToHeaders(headers, "x-ms-if-unmodified-since", options.Destination.IfUnmodifiedSince) + headers = addToHeaders(headers, "x-ms-if-match", options.Destination.IfMatch) + headers = addToHeaders(headers, "x-ms-if-none-match", options.Destination.IfNoneMatch) + } + + // get URI of destination blob + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return "", err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusAccepted}); err != nil { + return "", err + } + + copyID := resp.headers.Get("x-ms-copy-id") + if copyID == "" { + return "", errors.New("Got empty copy id header") + } + return copyID, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob_test.go index 364a9cee60..60a50c8b7b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob_test.go @@ -1,171 +1,171 @@ -package storage - -import ( - "io/ioutil" - "net/http" - "testing" - - chk "gopkg.in/check.v1" -) - -type CopyBlobSuite struct{} - -var _ = chk.Suite(&CopyBlobSuite{}) - -func (s *CopyBlobSuite) TestBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - srcBlob := cnt.GetBlobReference(blobName(c, "src")) - dstBlob := cnt.GetBlobReference(blobName(c, "dst")) - body := content(1024) - - c.Assert(srcBlob.putSingleBlockBlob(body), chk.IsNil) - defer srcBlob.Delete(nil) - - c.Assert(dstBlob.Copy(srcBlob.GetURL(), nil), chk.IsNil) - defer dstBlob.Delete(nil) - - resp, err := dstBlob.Get(nil) - c.Assert(err, chk.IsNil) - - b, err := ioutil.ReadAll(resp) - defer resp.Close() - c.Assert(err, chk.IsNil) - c.Assert(b, chk.DeepEquals, body) -} - -func (s *CopyBlobSuite) TestStartBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - srcBlob := cnt.GetBlobReference(blobName(c, "src")) - dstBlob := cnt.GetBlobReference(blobName(c, "dst")) - body := content(1024) - - c.Assert(srcBlob.putSingleBlockBlob(body), chk.IsNil) - defer srcBlob.Delete(nil) - - // given we dont know when it will start, can we even test destination creation? - // will just test that an error wasn't thrown for now. - copyID, err := dstBlob.StartCopy(srcBlob.GetURL(), nil) - c.Assert(copyID, chk.NotNil) - c.Assert(err, chk.IsNil) -} - -// Tests abort of blobcopy. Given the blobcopy is usually over before we can actually trigger an abort -// it is agreed that we perform a copy then try and perform an abort. It should result in a HTTP status of 409. -// So basically we're testing negative scenario (as good as we can do for now) -func (s *CopyBlobSuite) TestAbortBlobCopy(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - srcBlob := cnt.GetBlobReference(blobName(c, "src")) - dstBlob := cnt.GetBlobReference(blobName(c, "dst")) - body := content(1024) - - c.Assert(srcBlob.putSingleBlockBlob(body), chk.IsNil) - defer srcBlob.Delete(nil) - - // given we dont know when it will start, can we even test destination creation? - // will just test that an error wasn't thrown for now. - copyID, err := dstBlob.StartCopy(srcBlob.GetURL(), nil) - c.Assert(copyID, chk.NotNil) - c.Assert(err, chk.IsNil) - - err = dstBlob.WaitForCopy(copyID) - c.Assert(err, chk.IsNil) - - // abort abort abort, but we *know* its already completed. - err = dstBlob.AbortCopy(copyID, nil) - - // abort should fail (over already) - c.Assert(err.(AzureStorageServiceError).StatusCode, chk.Equals, http.StatusConflict) -} - -func (s *CopyBlobSuite) TestIncrementalCopyBlobNoTimeout(c *chk.C) { - if testing.Short() { - c.Skip("skipping blob copy in short mode, no SLA on async operation") - } - - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - options := CreateContainerOptions{ - Access: ContainerAccessTypeBlob, - } - c.Assert(cnt.Create(&options), chk.IsNil) - defer cnt.Delete(nil) - - b := cnt.GetBlobReference(blobName(c, "src")) - size := int64(10 * 1024 * 1024) - b.Properties.ContentLength = size - c.Assert(b.PutPageBlob(nil), chk.IsNil) - - snapshotTime, err := b.CreateSnapshot(nil) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) - - u := b.GetURL() - destBlob := cnt.GetBlobReference(blobName(c, "dst")) - copyID, err := destBlob.IncrementalCopyBlob(u, *snapshotTime, nil) - c.Assert(copyID, chk.NotNil) - c.Assert(err, chk.IsNil) -} - -func (s *CopyBlobSuite) TestIncrementalCopyBlobWithTimeout(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - options := CreateContainerOptions{ - Access: ContainerAccessTypeBlob, - } - c.Assert(cnt.Create(&options), chk.IsNil) - defer cnt.Delete(nil) - - b := cnt.GetBlobReference(blobName(c, "src")) - size := int64(10 * 1024 * 1024) - b.Properties.ContentLength = size - c.Assert(b.PutPageBlob(nil), chk.IsNil) - - snapshotTime, err := b.CreateSnapshot(nil) - c.Assert(err, chk.IsNil) - c.Assert(snapshotTime, chk.NotNil) - - u := b.GetURL() - destBlob := cnt.GetBlobReference(blobName(c, "dst")) - copyID, err := destBlob.IncrementalCopyBlob(u, *snapshotTime, &IncrementalCopyOptions{Timeout: 30}) - c.Assert(copyID, chk.NotNil) - c.Assert(err, chk.IsNil) -} +package storage + +import ( + "io/ioutil" + "net/http" + "testing" + + chk "gopkg.in/check.v1" +) + +type CopyBlobSuite struct{} + +var _ = chk.Suite(&CopyBlobSuite{}) + +func (s *CopyBlobSuite) TestBlobCopy(c *chk.C) { + if testing.Short() { + c.Skip("skipping blob copy in short mode, no SLA on async operation") + } + + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + srcBlob := cnt.GetBlobReference(blobName(c, "src")) + dstBlob := cnt.GetBlobReference(blobName(c, "dst")) + body := content(1024) + + c.Assert(srcBlob.putSingleBlockBlob(body), chk.IsNil) + defer srcBlob.Delete(nil) + + c.Assert(dstBlob.Copy(srcBlob.GetURL(), nil), chk.IsNil) + defer dstBlob.Delete(nil) + + resp, err := dstBlob.Get(nil) + c.Assert(err, chk.IsNil) + + b, err := ioutil.ReadAll(resp) + defer resp.Close() + c.Assert(err, chk.IsNil) + c.Assert(b, chk.DeepEquals, body) +} + +func (s *CopyBlobSuite) TestStartBlobCopy(c *chk.C) { + if testing.Short() { + c.Skip("skipping blob copy in short mode, no SLA on async operation") + } + + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + srcBlob := cnt.GetBlobReference(blobName(c, "src")) + dstBlob := cnt.GetBlobReference(blobName(c, "dst")) + body := content(1024) + + c.Assert(srcBlob.putSingleBlockBlob(body), chk.IsNil) + defer srcBlob.Delete(nil) + + // given we dont know when it will start, can we even test destination creation? + // will just test that an error wasn't thrown for now. + copyID, err := dstBlob.StartCopy(srcBlob.GetURL(), nil) + c.Assert(copyID, chk.NotNil) + c.Assert(err, chk.IsNil) +} + +// Tests abort of blobcopy. Given the blobcopy is usually over before we can actually trigger an abort +// it is agreed that we perform a copy then try and perform an abort. It should result in a HTTP status of 409. +// So basically we're testing negative scenario (as good as we can do for now) +func (s *CopyBlobSuite) TestAbortBlobCopy(c *chk.C) { + if testing.Short() { + c.Skip("skipping blob copy in short mode, no SLA on async operation") + } + + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + srcBlob := cnt.GetBlobReference(blobName(c, "src")) + dstBlob := cnt.GetBlobReference(blobName(c, "dst")) + body := content(1024) + + c.Assert(srcBlob.putSingleBlockBlob(body), chk.IsNil) + defer srcBlob.Delete(nil) + + // given we dont know when it will start, can we even test destination creation? + // will just test that an error wasn't thrown for now. + copyID, err := dstBlob.StartCopy(srcBlob.GetURL(), nil) + c.Assert(copyID, chk.NotNil) + c.Assert(err, chk.IsNil) + + err = dstBlob.WaitForCopy(copyID) + c.Assert(err, chk.IsNil) + + // abort abort abort, but we *know* its already completed. + err = dstBlob.AbortCopy(copyID, nil) + + // abort should fail (over already) + c.Assert(err.(AzureStorageServiceError).StatusCode, chk.Equals, http.StatusConflict) +} + +func (s *CopyBlobSuite) TestIncrementalCopyBlobNoTimeout(c *chk.C) { + if testing.Short() { + c.Skip("skipping blob copy in short mode, no SLA on async operation") + } + + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + options := CreateContainerOptions{ + Access: ContainerAccessTypeBlob, + } + c.Assert(cnt.Create(&options), chk.IsNil) + defer cnt.Delete(nil) + + b := cnt.GetBlobReference(blobName(c, "src")) + size := int64(10 * 1024 * 1024) + b.Properties.ContentLength = size + c.Assert(b.PutPageBlob(nil), chk.IsNil) + + snapshotTime, err := b.CreateSnapshot(nil) + c.Assert(err, chk.IsNil) + c.Assert(snapshotTime, chk.NotNil) + + u := b.GetURL() + destBlob := cnt.GetBlobReference(blobName(c, "dst")) + copyID, err := destBlob.IncrementalCopyBlob(u, *snapshotTime, nil) + c.Assert(copyID, chk.NotNil) + c.Assert(err, chk.IsNil) +} + +func (s *CopyBlobSuite) TestIncrementalCopyBlobWithTimeout(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + options := CreateContainerOptions{ + Access: ContainerAccessTypeBlob, + } + c.Assert(cnt.Create(&options), chk.IsNil) + defer cnt.Delete(nil) + + b := cnt.GetBlobReference(blobName(c, "src")) + size := int64(10 * 1024 * 1024) + b.Properties.ContentLength = size + c.Assert(b.PutPageBlob(nil), chk.IsNil) + + snapshotTime, err := b.CreateSnapshot(nil) + c.Assert(err, chk.IsNil) + c.Assert(snapshotTime, chk.NotNil) + + u := b.GetURL() + destBlob := cnt.GetBlobReference(blobName(c, "dst")) + copyID, err := destBlob.IncrementalCopyBlob(u, *snapshotTime, &IncrementalCopyOptions{Timeout: 30}) + c.Assert(copyID, chk.NotNil) + c.Assert(err, chk.IsNil) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go index e1d9be6acd..29610329ec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go @@ -1,222 +1,222 @@ -package storage - -import ( - "encoding/xml" - "net/http" - "net/url" -) - -// Directory represents a directory on a share. -type Directory struct { - fsc *FileServiceClient - Metadata map[string]string - Name string `xml:"Name"` - parent *Directory - Properties DirectoryProperties - share *Share -} - -// DirectoryProperties contains various properties of a directory. -type DirectoryProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` -} - -// ListDirsAndFilesParameters defines the set of customizable parameters to -// make a List Files and Directories call. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files -type ListDirsAndFilesParameters struct { - Prefix string - Marker string - MaxResults uint - Timeout uint -} - -// DirsAndFilesListResponse contains the response fields from -// a List Files and Directories call. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files -type DirsAndFilesListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Marker string `xml:"Marker"` - MaxResults int64 `xml:"MaxResults"` - Directories []Directory `xml:"Entries>Directory"` - Files []File `xml:"Entries>File"` - NextMarker string `xml:"NextMarker"` -} - -// builds the complete directory path for this directory object. -func (d *Directory) buildPath() string { - path := "" - current := d - for current.Name != "" { - path = "/" + current.Name + path - current = current.parent - } - return d.share.buildPath() + path -} - -// Create this directory in the associated share. -// If a directory with the same name already exists, the operation fails. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory -func (d *Directory) Create(options *FileRequestOptions) error { - // if this is the root directory exit early - if d.parent == nil { - return nil - } - - params := prepareOptions(options) - headers, err := d.fsc.createResource(d.buildPath(), resourceDirectory, params, mergeMDIntoExtraHeaders(d.Metadata, nil), []int{http.StatusCreated}) - if err != nil { - return err - } - - d.updateEtagAndLastModified(headers) - return nil -} - -// CreateIfNotExists creates this directory under the associated share if the -// directory does not exists. Returns true if the directory is newly created or -// false if the directory already exists. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory -func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error) { - // if this is the root directory exit early - if d.parent == nil { - return false, nil - } - - params := prepareOptions(options) - resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, params, nil) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { - if resp.statusCode == http.StatusCreated { - d.updateEtagAndLastModified(resp.headers) - return true, nil - } - - return false, d.FetchAttributes(nil) - } - } - - return false, err -} - -// Delete removes this directory. It must be empty in order to be deleted. -// If the directory does not exist the operation fails. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory -func (d *Directory) Delete(options *FileRequestOptions) error { - return d.fsc.deleteResource(d.buildPath(), resourceDirectory, options) -} - -// DeleteIfExists removes this directory if it exists. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory -func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error) { - resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory, options) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -// Exists returns true if this directory exists. -func (d *Directory) Exists() (bool, error) { - exists, headers, err := d.fsc.resourceExists(d.buildPath(), resourceDirectory) - if exists { - d.updateEtagAndLastModified(headers) - } - return exists, err -} - -// FetchAttributes retrieves metadata for this directory. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-properties -func (d *Directory) FetchAttributes(options *FileRequestOptions) error { - params := prepareOptions(options) - headers, err := d.fsc.getResourceHeaders(d.buildPath(), compNone, resourceDirectory, params, http.MethodHead) - if err != nil { - return err - } - - d.updateEtagAndLastModified(headers) - d.Metadata = getMetadataFromHeaders(headers) - - return nil -} - -// GetDirectoryReference returns a child Directory object for this directory. -func (d *Directory) GetDirectoryReference(name string) *Directory { - return &Directory{ - fsc: d.fsc, - Name: name, - parent: d, - share: d.share, - } -} - -// GetFileReference returns a child File object for this directory. -func (d *Directory) GetFileReference(name string) *File { - return &File{ - fsc: d.fsc, - Name: name, - parent: d, - share: d.share, - } -} - -// ListDirsAndFiles returns a list of files and directories under this directory. -// It also contains a pagination token and other response details. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files -func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAndFilesListResponse, error) { - q := mergeParams(params.getParameters(), getURLInitValues(compList, resourceDirectory)) - - resp, err := d.fsc.listContent(d.buildPath(), q, nil) - if err != nil { - return nil, err - } - - defer resp.body.Close() - var out DirsAndFilesListResponse - err = xmlUnmarshal(resp.body, &out) - return &out, err -} - -// SetMetadata replaces the metadata for this directory. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetDirectoryMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Directory-Metadata -func (d *Directory) SetMetadata(options *FileRequestOptions) error { - headers, err := d.fsc.setResourceHeaders(d.buildPath(), compMetadata, resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil), options) - if err != nil { - return err - } - - d.updateEtagAndLastModified(headers) - return nil -} - -// updates Etag and last modified date -func (d *Directory) updateEtagAndLastModified(headers http.Header) { - d.Properties.Etag = headers.Get("Etag") - d.Properties.LastModified = headers.Get("Last-Modified") -} - -// URL gets the canonical URL to this directory. -// This method does not create a publicly accessible URL if the directory -// is private and this method does not check if the directory exists. -func (d *Directory) URL() string { - return d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{}) -} +package storage + +import ( + "encoding/xml" + "net/http" + "net/url" +) + +// Directory represents a directory on a share. +type Directory struct { + fsc *FileServiceClient + Metadata map[string]string + Name string `xml:"Name"` + parent *Directory + Properties DirectoryProperties + share *Share +} + +// DirectoryProperties contains various properties of a directory. +type DirectoryProperties struct { + LastModified string `xml:"Last-Modified"` + Etag string `xml:"Etag"` +} + +// ListDirsAndFilesParameters defines the set of customizable parameters to +// make a List Files and Directories call. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files +type ListDirsAndFilesParameters struct { + Prefix string + Marker string + MaxResults uint + Timeout uint +} + +// DirsAndFilesListResponse contains the response fields from +// a List Files and Directories call. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files +type DirsAndFilesListResponse struct { + XMLName xml.Name `xml:"EnumerationResults"` + Xmlns string `xml:"xmlns,attr"` + Marker string `xml:"Marker"` + MaxResults int64 `xml:"MaxResults"` + Directories []Directory `xml:"Entries>Directory"` + Files []File `xml:"Entries>File"` + NextMarker string `xml:"NextMarker"` +} + +// builds the complete directory path for this directory object. +func (d *Directory) buildPath() string { + path := "" + current := d + for current.Name != "" { + path = "/" + current.Name + path + current = current.parent + } + return d.share.buildPath() + path +} + +// Create this directory in the associated share. +// If a directory with the same name already exists, the operation fails. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory +func (d *Directory) Create(options *FileRequestOptions) error { + // if this is the root directory exit early + if d.parent == nil { + return nil + } + + params := prepareOptions(options) + headers, err := d.fsc.createResource(d.buildPath(), resourceDirectory, params, mergeMDIntoExtraHeaders(d.Metadata, nil), []int{http.StatusCreated}) + if err != nil { + return err + } + + d.updateEtagAndLastModified(headers) + return nil +} + +// CreateIfNotExists creates this directory under the associated share if the +// directory does not exists. Returns true if the directory is newly created or +// false if the directory already exists. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory +func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error) { + // if this is the root directory exit early + if d.parent == nil { + return false, nil + } + + params := prepareOptions(options) + resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, params, nil) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { + if resp.statusCode == http.StatusCreated { + d.updateEtagAndLastModified(resp.headers) + return true, nil + } + + return false, d.FetchAttributes(nil) + } + } + + return false, err +} + +// Delete removes this directory. It must be empty in order to be deleted. +// If the directory does not exist the operation fails. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory +func (d *Directory) Delete(options *FileRequestOptions) error { + return d.fsc.deleteResource(d.buildPath(), resourceDirectory, options) +} + +// DeleteIfExists removes this directory if it exists. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory +func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error) { + resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory, options) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusAccepted, nil + } + } + return false, err +} + +// Exists returns true if this directory exists. +func (d *Directory) Exists() (bool, error) { + exists, headers, err := d.fsc.resourceExists(d.buildPath(), resourceDirectory) + if exists { + d.updateEtagAndLastModified(headers) + } + return exists, err +} + +// FetchAttributes retrieves metadata for this directory. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-properties +func (d *Directory) FetchAttributes(options *FileRequestOptions) error { + params := prepareOptions(options) + headers, err := d.fsc.getResourceHeaders(d.buildPath(), compNone, resourceDirectory, params, http.MethodHead) + if err != nil { + return err + } + + d.updateEtagAndLastModified(headers) + d.Metadata = getMetadataFromHeaders(headers) + + return nil +} + +// GetDirectoryReference returns a child Directory object for this directory. +func (d *Directory) GetDirectoryReference(name string) *Directory { + return &Directory{ + fsc: d.fsc, + Name: name, + parent: d, + share: d.share, + } +} + +// GetFileReference returns a child File object for this directory. +func (d *Directory) GetFileReference(name string) *File { + return &File{ + fsc: d.fsc, + Name: name, + parent: d, + share: d.share, + } +} + +// ListDirsAndFiles returns a list of files and directories under this directory. +// It also contains a pagination token and other response details. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files +func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAndFilesListResponse, error) { + q := mergeParams(params.getParameters(), getURLInitValues(compList, resourceDirectory)) + + resp, err := d.fsc.listContent(d.buildPath(), q, nil) + if err != nil { + return nil, err + } + + defer resp.body.Close() + var out DirsAndFilesListResponse + err = xmlUnmarshal(resp.body, &out) + return &out, err +} + +// SetMetadata replaces the metadata for this directory. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by GetDirectoryMetadata. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Directory-Metadata +func (d *Directory) SetMetadata(options *FileRequestOptions) error { + headers, err := d.fsc.setResourceHeaders(d.buildPath(), compMetadata, resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil), options) + if err != nil { + return err + } + + d.updateEtagAndLastModified(headers) + return nil +} + +// updates Etag and last modified date +func (d *Directory) updateEtagAndLastModified(headers http.Header) { + d.Properties.Etag = headers.Get("Etag") + d.Properties.LastModified = headers.Get("Last-Modified") +} + +// URL gets the canonical URL to this directory. +// This method does not create a publicly accessible URL if the directory +// is private and this method does not check if the directory exists. +func (d *Directory) URL() string { + return d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{}) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory_test.go index 9a7ec0c4b1..ffe5f25c6e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory_test.go @@ -1,170 +1,170 @@ -package storage - -import chk "gopkg.in/check.v1" - -type StorageDirSuite struct{} - -var _ = chk.Suite(&StorageDirSuite{}) - -func (s *StorageDirSuite) TestListZeroDirsAndFiles(c *chk.C) { - // create share - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - - // list contents, should be empty - root := share.GetRootDirectoryReference() - resp, err := root.ListDirsAndFiles(ListDirsAndFilesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(resp.Directories, chk.IsNil) - c.Assert(resp.Files, chk.IsNil) -} - -func (s *StorageDirSuite) TestListDirsAndFiles(c *chk.C) { - // create share - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - - // create a directory and a file - root := share.GetRootDirectoryReference() - dir := root.GetDirectoryReference("SomeDirectory") - file := root.GetFileReference("lol.file") - c.Assert(dir.Create(nil), chk.IsNil) - c.Assert(file.Create(512, nil), chk.IsNil) - - // list contents - resp, err := root.ListDirsAndFiles(ListDirsAndFilesParameters{}) - c.Assert(err, chk.IsNil) - c.Assert(len(resp.Directories), chk.Equals, 1) - c.Assert(len(resp.Files), chk.Equals, 1) - c.Assert(resp.Directories[0].Name, chk.Equals, dir.Name) - c.Assert(resp.Files[0].Name, chk.Equals, file.Name) - - // delete file - del, err := file.DeleteIfExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(del, chk.Equals, true) - - ok, err := file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageDirSuite) TestCreateDirectory(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - - root := share.GetRootDirectoryReference() - dir := root.GetDirectoryReference("dir") - err := dir.Create(nil) - c.Assert(err, chk.IsNil) - - // check properties - c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") - c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") - - // delete directory and verify - c.Assert(dir.Delete(nil), chk.IsNil) - exists, err := dir.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) -} - -func (s *StorageDirSuite) TestCreateDirectoryIfNotExists(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - share.Create(nil) - defer share.Delete(nil) - - // create non exisiting directory - root := share.GetRootDirectoryReference() - dir := root.GetDirectoryReference("dir") - exists, err := dir.CreateIfNotExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, true) - - c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") - c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") - - c.Assert(dir.Delete(nil), chk.IsNil) - exists, err = dir.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) -} - -func (s *StorageDirSuite) TestCreateDirectoryIfExists(c *chk.C) { - // create share - cli := getFileClient(c) - share := cli.GetShareReference(shareName(c)) - share.Create(nil) - defer share.Delete(nil) - - // create directory - root := share.GetRootDirectoryReference() - dir := root.GetDirectoryReference("dir") - dir.Create(nil) - - rec := cli.client.appendRecorder(c) - dir.fsc = &cli - defer rec.Stop() - - // try to create directory - exists, err := dir.CreateIfNotExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) - - // check properties - c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") - c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") - - // delete directory - c.Assert(dir.Delete(nil), chk.IsNil) -} - -func (s *StorageDirSuite) TestDirectoryMetadata(c *chk.C) { - // create share - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - dir := root.GetDirectoryReference("testdir") - c.Assert(dir.Create(nil), chk.IsNil) - - // get metadata, shouldn't be any - c.Assert(dir.Metadata, chk.IsNil) - - // set some custom metadata - md := map[string]string{ - "something": "somethingvalue", - "another": "anothervalue", - } - dir.Metadata = md - c.Assert(dir.SetMetadata(nil), chk.IsNil) - - // retrieve and verify - c.Assert(dir.FetchAttributes(nil), chk.IsNil) - c.Assert(dir.Metadata, chk.DeepEquals, md) -} +package storage + +import chk "gopkg.in/check.v1" + +type StorageDirSuite struct{} + +var _ = chk.Suite(&StorageDirSuite{}) + +func (s *StorageDirSuite) TestListZeroDirsAndFiles(c *chk.C) { + // create share + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + + // list contents, should be empty + root := share.GetRootDirectoryReference() + resp, err := root.ListDirsAndFiles(ListDirsAndFilesParameters{}) + c.Assert(err, chk.IsNil) + c.Assert(resp.Directories, chk.IsNil) + c.Assert(resp.Files, chk.IsNil) +} + +func (s *StorageDirSuite) TestListDirsAndFiles(c *chk.C) { + // create share + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + + // create a directory and a file + root := share.GetRootDirectoryReference() + dir := root.GetDirectoryReference("SomeDirectory") + file := root.GetFileReference("lol.file") + c.Assert(dir.Create(nil), chk.IsNil) + c.Assert(file.Create(512, nil), chk.IsNil) + + // list contents + resp, err := root.ListDirsAndFiles(ListDirsAndFilesParameters{}) + c.Assert(err, chk.IsNil) + c.Assert(len(resp.Directories), chk.Equals, 1) + c.Assert(len(resp.Files), chk.Equals, 1) + c.Assert(resp.Directories[0].Name, chk.Equals, dir.Name) + c.Assert(resp.Files[0].Name, chk.Equals, file.Name) + + // delete file + del, err := file.DeleteIfExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(del, chk.Equals, true) + + ok, err := file.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) +} + +func (s *StorageDirSuite) TestCreateDirectory(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + + root := share.GetRootDirectoryReference() + dir := root.GetDirectoryReference("dir") + err := dir.Create(nil) + c.Assert(err, chk.IsNil) + + // check properties + c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") + c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") + + // delete directory and verify + c.Assert(dir.Delete(nil), chk.IsNil) + exists, err := dir.Exists() + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, false) +} + +func (s *StorageDirSuite) TestCreateDirectoryIfNotExists(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + share.Create(nil) + defer share.Delete(nil) + + // create non exisiting directory + root := share.GetRootDirectoryReference() + dir := root.GetDirectoryReference("dir") + exists, err := dir.CreateIfNotExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, true) + + c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") + c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") + + c.Assert(dir.Delete(nil), chk.IsNil) + exists, err = dir.Exists() + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, false) +} + +func (s *StorageDirSuite) TestCreateDirectoryIfExists(c *chk.C) { + // create share + cli := getFileClient(c) + share := cli.GetShareReference(shareName(c)) + share.Create(nil) + defer share.Delete(nil) + + // create directory + root := share.GetRootDirectoryReference() + dir := root.GetDirectoryReference("dir") + dir.Create(nil) + + rec := cli.client.appendRecorder(c) + dir.fsc = &cli + defer rec.Stop() + + // try to create directory + exists, err := dir.CreateIfNotExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, false) + + // check properties + c.Assert(dir.Properties.Etag, chk.Not(chk.Equals), "") + c.Assert(dir.Properties.LastModified, chk.Not(chk.Equals), "") + + // delete directory + c.Assert(dir.Delete(nil), chk.IsNil) +} + +func (s *StorageDirSuite) TestDirectoryMetadata(c *chk.C) { + // create share + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + dir := root.GetDirectoryReference("testdir") + c.Assert(dir.Create(nil), chk.IsNil) + + // get metadata, shouldn't be any + c.Assert(dir.Metadata, chk.IsNil) + + // set some custom metadata + md := map[string]string{ + "something": "somethingvalue", + "another": "anothervalue", + } + dir.Metadata = md + c.Assert(dir.SetMetadata(nil), chk.IsNil) + + // retrieve and verify + c.Assert(dir.FetchAttributes(nil), chk.IsNil) + c.Assert(dir.Metadata, chk.DeepEquals, md) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go index 6eedf9395c..13e9475073 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go @@ -1,439 +1,439 @@ -package storage - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "strings" - "time" - - "github.com/satori/uuid" -) - -// Annotating as secure for gas scanning -/* #nosec */ -const ( - partitionKeyNode = "PartitionKey" - rowKeyNode = "RowKey" - etagErrorTemplate = "Etag didn't match: %v" -) - -var ( - errEmptyPayload = errors.New("Empty payload is not a valid metadata level for this operation") - errNilPreviousResult = errors.New("The previous results page is nil") - errNilNextLink = errors.New("There are no more pages in this query results") -) - -// Entity represents an entity inside an Azure table. -type Entity struct { - Table *Table - PartitionKey string - RowKey string - TimeStamp time.Time - OdataMetadata string - OdataType string - OdataID string - OdataEtag string - OdataEditLink string - Properties map[string]interface{} -} - -// GetEntityReference returns an Entity object with the specified -// partition key and row key. -func (t *Table) GetEntityReference(partitionKey, rowKey string) *Entity { - return &Entity{ - PartitionKey: partitionKey, - RowKey: rowKey, - Table: t, - } -} - -// EntityOptions includes options for entity operations. -type EntityOptions struct { - Timeout uint - RequestID string `header:"x-ms-client-request-id"` -} - -// GetEntityOptions includes options for a get entity operation -type GetEntityOptions struct { - Select []string - RequestID string `header:"x-ms-client-request-id"` -} - -// Get gets the referenced entity. Which properties to get can be -// specified using the select option. -// See: -// https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities -// https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities -func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions) error { - if ml == EmptyPayload { - return errEmptyPayload - } - // RowKey and PartitionKey could be lost if not included in the query - // As those are the entity identifiers, it is best if they are not lost - rk := e.RowKey - pk := e.PartitionKey - - query := url.Values{ - "timeout": {strconv.FormatUint(uint64(timeout), 10)}, - } - headers := e.Table.tsc.client.getStandardHeaders() - headers[headerAccept] = string(ml) - - if options != nil { - if len(options.Select) > 0 { - query.Add("$select", strings.Join(options.Select, ",")) - } - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - - uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) - resp, err := e.Table.tsc.client.exec(http.MethodGet, uri, headers, nil, e.Table.tsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return err - } - - respBody, err := ioutil.ReadAll(resp.body) - if err != nil { - return err - } - err = json.Unmarshal(respBody, e) - if err != nil { - return err - } - e.PartitionKey = pk - e.RowKey = rk - - return nil -} - -// Insert inserts the referenced entity in its table. -// The function fails if there is an entity with the same -// PartitionKey and RowKey in the table. -// ml determines the level of detail of metadata in the operation response, -// or no data at all. -// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-entity -func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error { - query, headers := options.getParameters() - headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) - - body, err := json.Marshal(e) - if err != nil { - return err - } - headers = addBodyRelatedHeaders(headers, len(body)) - headers = addReturnContentHeaders(headers, ml) - - uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.Table.buildPath(), query) - resp, err := e.Table.tsc.client.exec(http.MethodPost, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) - if err != nil { - return err - } - defer resp.body.Close() - - data, err := ioutil.ReadAll(resp.body) - if err != nil { - return err - } - - if ml != EmptyPayload { - if err = checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { - return err - } - if err = e.UnmarshalJSON(data); err != nil { - return err - } - } else { - if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - } - - return nil -} - -// Update updates the contents of an entity. The function fails if there is no entity -// with the same PartitionKey and RowKey in the table or if the ETag is different -// than the one in Azure. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/update-entity2 -func (e *Entity) Update(force bool, options *EntityOptions) error { - return e.updateMerge(force, http.MethodPut, options) -} - -// Merge merges the contents of entity specified with PartitionKey and RowKey -// with the content specified in Properties. -// The function fails if there is no entity with the same PartitionKey and -// RowKey in the table or if the ETag is different than the one in Azure. -// Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/merge-entity -func (e *Entity) Merge(force bool, options *EntityOptions) error { - return e.updateMerge(force, "MERGE", options) -} - -// Delete deletes the entity. -// The function fails if there is no entity with the same PartitionKey and -// RowKey in the table or if the ETag is different than the one in Azure. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-entity1 -func (e *Entity) Delete(force bool, options *EntityOptions) error { - query, headers := options.getParameters() - headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) - - headers = addIfMatchHeader(headers, force, e.OdataEtag) - headers = addReturnContentHeaders(headers, EmptyPayload) - - uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) - resp, err := e.Table.tsc.client.exec(http.MethodDelete, uri, headers, nil, e.Table.tsc.auth) - if err != nil { - if resp.statusCode == http.StatusPreconditionFailed { - return fmt.Errorf(etagErrorTemplate, err) - } - return err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - - return e.updateTimestamp(resp.headers) -} - -// InsertOrReplace inserts an entity or replaces the existing one. -// Read more: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-or-replace-entity -func (e *Entity) InsertOrReplace(options *EntityOptions) error { - return e.insertOr(http.MethodPut, options) -} - -// InsertOrMerge inserts an entity or merges the existing one. -// Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/insert-or-merge-entity -func (e *Entity) InsertOrMerge(options *EntityOptions) error { - return e.insertOr("MERGE", options) -} - -func (e *Entity) buildPath() string { - return fmt.Sprintf("%s(PartitionKey='%s', RowKey='%s')", e.Table.buildPath(), e.PartitionKey, e.RowKey) -} - -// MarshalJSON is a custom marshaller for entity -func (e *Entity) MarshalJSON() ([]byte, error) { - completeMap := map[string]interface{}{} - completeMap[partitionKeyNode] = e.PartitionKey - completeMap[rowKeyNode] = e.RowKey - for k, v := range e.Properties { - typeKey := strings.Join([]string{k, OdataTypeSuffix}, "") - switch t := v.(type) { - case []byte: - completeMap[typeKey] = OdataBinary - completeMap[k] = string(t) - case time.Time: - completeMap[typeKey] = OdataDateTime - completeMap[k] = t.Format(time.RFC3339Nano) - case uuid.UUID: - completeMap[typeKey] = OdataGUID - completeMap[k] = t.String() - case int64: - completeMap[typeKey] = OdataInt64 - completeMap[k] = fmt.Sprintf("%v", v) - default: - completeMap[k] = v - } - if strings.HasSuffix(k, OdataTypeSuffix) { - if !(completeMap[k] == OdataBinary || - completeMap[k] == OdataDateTime || - completeMap[k] == OdataGUID || - completeMap[k] == OdataInt64) { - return nil, fmt.Errorf("Odata.type annotation %v value is not valid", k) - } - valueKey := strings.TrimSuffix(k, OdataTypeSuffix) - if _, ok := completeMap[valueKey]; !ok { - return nil, fmt.Errorf("Odata.type annotation %v defined without value defined", k) - } - } - } - return json.Marshal(completeMap) -} - -// UnmarshalJSON is a custom unmarshaller for entities -func (e *Entity) UnmarshalJSON(data []byte) error { - errorTemplate := "Deserializing error: %v" - - props := map[string]interface{}{} - err := json.Unmarshal(data, &props) - if err != nil { - return err - } - - // deselialize metadata - e.OdataMetadata = stringFromMap(props, "odata.metadata") - e.OdataType = stringFromMap(props, "odata.type") - e.OdataID = stringFromMap(props, "odata.id") - e.OdataEtag = stringFromMap(props, "odata.etag") - e.OdataEditLink = stringFromMap(props, "odata.editLink") - e.PartitionKey = stringFromMap(props, partitionKeyNode) - e.RowKey = stringFromMap(props, rowKeyNode) - - // deserialize timestamp - timeStamp, ok := props["Timestamp"] - if ok { - str, ok := timeStamp.(string) - if !ok { - return fmt.Errorf(errorTemplate, "Timestamp casting error") - } - t, err := time.Parse(time.RFC3339Nano, str) - if err != nil { - return fmt.Errorf(errorTemplate, err) - } - e.TimeStamp = t - } - delete(props, "Timestamp") - delete(props, "Timestamp@odata.type") - - // deserialize entity (user defined fields) - for k, v := range props { - if strings.HasSuffix(k, OdataTypeSuffix) { - valueKey := strings.TrimSuffix(k, OdataTypeSuffix) - str, ok := props[valueKey].(string) - if !ok { - return fmt.Errorf(errorTemplate, fmt.Sprintf("%v casting error", v)) - } - switch v { - case OdataBinary: - props[valueKey] = []byte(str) - case OdataDateTime: - t, err := time.Parse("2006-01-02T15:04:05Z", str) - if err != nil { - return fmt.Errorf(errorTemplate, err) - } - props[valueKey] = t - case OdataGUID: - props[valueKey] = uuid.FromStringOrNil(str) - case OdataInt64: - i, err := strconv.ParseInt(str, 10, 64) - if err != nil { - return fmt.Errorf(errorTemplate, err) - } - props[valueKey] = i - default: - return fmt.Errorf(errorTemplate, fmt.Sprintf("%v is not supported", v)) - } - delete(props, k) - } - } - - e.Properties = props - return nil -} - -func getAndDelete(props map[string]interface{}, key string) interface{} { - if value, ok := props[key]; ok { - delete(props, key) - return value - } - return nil -} - -func addIfMatchHeader(h map[string]string, force bool, etag string) map[string]string { - if force { - h[headerIfMatch] = "*" - } else { - h[headerIfMatch] = etag - } - return h -} - -// updates Etag and timestamp -func (e *Entity) updateEtagAndTimestamp(headers http.Header) error { - e.OdataEtag = headers.Get(headerEtag) - return e.updateTimestamp(headers) -} - -func (e *Entity) updateTimestamp(headers http.Header) error { - str := headers.Get(headerDate) - t, err := time.Parse(time.RFC1123, str) - if err != nil { - return fmt.Errorf("Update timestamp error: %v", err) - } - e.TimeStamp = t - return nil -} - -func (e *Entity) insertOr(verb string, options *EntityOptions) error { - query, headers := options.getParameters() - headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) - - body, err := json.Marshal(e) - if err != nil { - return err - } - headers = addBodyRelatedHeaders(headers, len(body)) - headers = addReturnContentHeaders(headers, EmptyPayload) - - uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) - resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - - return e.updateEtagAndTimestamp(resp.headers) -} - -func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) error { - query, headers := options.getParameters() - headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) - - body, err := json.Marshal(e) - if err != nil { - return err - } - headers = addBodyRelatedHeaders(headers, len(body)) - headers = addIfMatchHeader(headers, force, e.OdataEtag) - headers = addReturnContentHeaders(headers, EmptyPayload) - - uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) - resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) - if err != nil { - if resp.statusCode == http.StatusPreconditionFailed { - return fmt.Errorf(etagErrorTemplate, err) - } - return err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - - return e.updateEtagAndTimestamp(resp.headers) -} - -func stringFromMap(props map[string]interface{}, key string) string { - value := getAndDelete(props, key) - if value != nil { - return value.(string) - } - return "" -} - -func (options *EntityOptions) getParameters() (url.Values, map[string]string) { - query := url.Values{} - headers := map[string]string{} - if options != nil { - query = addTimeout(query, options.Timeout) - headers = headersFromStruct(*options) - } - return query, headers -} +package storage + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "github.com/satori/uuid" +) + +// Annotating as secure for gas scanning +/* #nosec */ +const ( + partitionKeyNode = "PartitionKey" + rowKeyNode = "RowKey" + etagErrorTemplate = "Etag didn't match: %v" +) + +var ( + errEmptyPayload = errors.New("Empty payload is not a valid metadata level for this operation") + errNilPreviousResult = errors.New("The previous results page is nil") + errNilNextLink = errors.New("There are no more pages in this query results") +) + +// Entity represents an entity inside an Azure table. +type Entity struct { + Table *Table + PartitionKey string + RowKey string + TimeStamp time.Time + OdataMetadata string + OdataType string + OdataID string + OdataEtag string + OdataEditLink string + Properties map[string]interface{} +} + +// GetEntityReference returns an Entity object with the specified +// partition key and row key. +func (t *Table) GetEntityReference(partitionKey, rowKey string) *Entity { + return &Entity{ + PartitionKey: partitionKey, + RowKey: rowKey, + Table: t, + } +} + +// EntityOptions includes options for entity operations. +type EntityOptions struct { + Timeout uint + RequestID string `header:"x-ms-client-request-id"` +} + +// GetEntityOptions includes options for a get entity operation +type GetEntityOptions struct { + Select []string + RequestID string `header:"x-ms-client-request-id"` +} + +// Get gets the referenced entity. Which properties to get can be +// specified using the select option. +// See: +// https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities +// https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities +func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions) error { + if ml == EmptyPayload { + return errEmptyPayload + } + // RowKey and PartitionKey could be lost if not included in the query + // As those are the entity identifiers, it is best if they are not lost + rk := e.RowKey + pk := e.PartitionKey + + query := url.Values{ + "timeout": {strconv.FormatUint(uint64(timeout), 10)}, + } + headers := e.Table.tsc.client.getStandardHeaders() + headers[headerAccept] = string(ml) + + if options != nil { + if len(options.Select) > 0 { + query.Add("$select", strings.Join(options.Select, ",")) + } + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + + uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) + resp, err := e.Table.tsc.client.exec(http.MethodGet, uri, headers, nil, e.Table.tsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return err + } + + respBody, err := ioutil.ReadAll(resp.body) + if err != nil { + return err + } + err = json.Unmarshal(respBody, e) + if err != nil { + return err + } + e.PartitionKey = pk + e.RowKey = rk + + return nil +} + +// Insert inserts the referenced entity in its table. +// The function fails if there is an entity with the same +// PartitionKey and RowKey in the table. +// ml determines the level of detail of metadata in the operation response, +// or no data at all. +// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-entity +func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error { + query, headers := options.getParameters() + headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) + + body, err := json.Marshal(e) + if err != nil { + return err + } + headers = addBodyRelatedHeaders(headers, len(body)) + headers = addReturnContentHeaders(headers, ml) + + uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.Table.buildPath(), query) + resp, err := e.Table.tsc.client.exec(http.MethodPost, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) + if err != nil { + return err + } + defer resp.body.Close() + + data, err := ioutil.ReadAll(resp.body) + if err != nil { + return err + } + + if ml != EmptyPayload { + if err = checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { + return err + } + if err = e.UnmarshalJSON(data); err != nil { + return err + } + } else { + if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + } + } + + return nil +} + +// Update updates the contents of an entity. The function fails if there is no entity +// with the same PartitionKey and RowKey in the table or if the ETag is different +// than the one in Azure. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/update-entity2 +func (e *Entity) Update(force bool, options *EntityOptions) error { + return e.updateMerge(force, http.MethodPut, options) +} + +// Merge merges the contents of entity specified with PartitionKey and RowKey +// with the content specified in Properties. +// The function fails if there is no entity with the same PartitionKey and +// RowKey in the table or if the ETag is different than the one in Azure. +// Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/merge-entity +func (e *Entity) Merge(force bool, options *EntityOptions) error { + return e.updateMerge(force, "MERGE", options) +} + +// Delete deletes the entity. +// The function fails if there is no entity with the same PartitionKey and +// RowKey in the table or if the ETag is different than the one in Azure. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-entity1 +func (e *Entity) Delete(force bool, options *EntityOptions) error { + query, headers := options.getParameters() + headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) + + headers = addIfMatchHeader(headers, force, e.OdataEtag) + headers = addReturnContentHeaders(headers, EmptyPayload) + + uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) + resp, err := e.Table.tsc.client.exec(http.MethodDelete, uri, headers, nil, e.Table.tsc.auth) + if err != nil { + if resp.statusCode == http.StatusPreconditionFailed { + return fmt.Errorf(etagErrorTemplate, err) + } + return err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + } + + return e.updateTimestamp(resp.headers) +} + +// InsertOrReplace inserts an entity or replaces the existing one. +// Read more: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-or-replace-entity +func (e *Entity) InsertOrReplace(options *EntityOptions) error { + return e.insertOr(http.MethodPut, options) +} + +// InsertOrMerge inserts an entity or merges the existing one. +// Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/insert-or-merge-entity +func (e *Entity) InsertOrMerge(options *EntityOptions) error { + return e.insertOr("MERGE", options) +} + +func (e *Entity) buildPath() string { + return fmt.Sprintf("%s(PartitionKey='%s', RowKey='%s')", e.Table.buildPath(), e.PartitionKey, e.RowKey) +} + +// MarshalJSON is a custom marshaller for entity +func (e *Entity) MarshalJSON() ([]byte, error) { + completeMap := map[string]interface{}{} + completeMap[partitionKeyNode] = e.PartitionKey + completeMap[rowKeyNode] = e.RowKey + for k, v := range e.Properties { + typeKey := strings.Join([]string{k, OdataTypeSuffix}, "") + switch t := v.(type) { + case []byte: + completeMap[typeKey] = OdataBinary + completeMap[k] = string(t) + case time.Time: + completeMap[typeKey] = OdataDateTime + completeMap[k] = t.Format(time.RFC3339Nano) + case uuid.UUID: + completeMap[typeKey] = OdataGUID + completeMap[k] = t.String() + case int64: + completeMap[typeKey] = OdataInt64 + completeMap[k] = fmt.Sprintf("%v", v) + default: + completeMap[k] = v + } + if strings.HasSuffix(k, OdataTypeSuffix) { + if !(completeMap[k] == OdataBinary || + completeMap[k] == OdataDateTime || + completeMap[k] == OdataGUID || + completeMap[k] == OdataInt64) { + return nil, fmt.Errorf("Odata.type annotation %v value is not valid", k) + } + valueKey := strings.TrimSuffix(k, OdataTypeSuffix) + if _, ok := completeMap[valueKey]; !ok { + return nil, fmt.Errorf("Odata.type annotation %v defined without value defined", k) + } + } + } + return json.Marshal(completeMap) +} + +// UnmarshalJSON is a custom unmarshaller for entities +func (e *Entity) UnmarshalJSON(data []byte) error { + errorTemplate := "Deserializing error: %v" + + props := map[string]interface{}{} + err := json.Unmarshal(data, &props) + if err != nil { + return err + } + + // deselialize metadata + e.OdataMetadata = stringFromMap(props, "odata.metadata") + e.OdataType = stringFromMap(props, "odata.type") + e.OdataID = stringFromMap(props, "odata.id") + e.OdataEtag = stringFromMap(props, "odata.etag") + e.OdataEditLink = stringFromMap(props, "odata.editLink") + e.PartitionKey = stringFromMap(props, partitionKeyNode) + e.RowKey = stringFromMap(props, rowKeyNode) + + // deserialize timestamp + timeStamp, ok := props["Timestamp"] + if ok { + str, ok := timeStamp.(string) + if !ok { + return fmt.Errorf(errorTemplate, "Timestamp casting error") + } + t, err := time.Parse(time.RFC3339Nano, str) + if err != nil { + return fmt.Errorf(errorTemplate, err) + } + e.TimeStamp = t + } + delete(props, "Timestamp") + delete(props, "Timestamp@odata.type") + + // deserialize entity (user defined fields) + for k, v := range props { + if strings.HasSuffix(k, OdataTypeSuffix) { + valueKey := strings.TrimSuffix(k, OdataTypeSuffix) + str, ok := props[valueKey].(string) + if !ok { + return fmt.Errorf(errorTemplate, fmt.Sprintf("%v casting error", v)) + } + switch v { + case OdataBinary: + props[valueKey] = []byte(str) + case OdataDateTime: + t, err := time.Parse("2006-01-02T15:04:05Z", str) + if err != nil { + return fmt.Errorf(errorTemplate, err) + } + props[valueKey] = t + case OdataGUID: + props[valueKey] = uuid.FromStringOrNil(str) + case OdataInt64: + i, err := strconv.ParseInt(str, 10, 64) + if err != nil { + return fmt.Errorf(errorTemplate, err) + } + props[valueKey] = i + default: + return fmt.Errorf(errorTemplate, fmt.Sprintf("%v is not supported", v)) + } + delete(props, k) + } + } + + e.Properties = props + return nil +} + +func getAndDelete(props map[string]interface{}, key string) interface{} { + if value, ok := props[key]; ok { + delete(props, key) + return value + } + return nil +} + +func addIfMatchHeader(h map[string]string, force bool, etag string) map[string]string { + if force { + h[headerIfMatch] = "*" + } else { + h[headerIfMatch] = etag + } + return h +} + +// updates Etag and timestamp +func (e *Entity) updateEtagAndTimestamp(headers http.Header) error { + e.OdataEtag = headers.Get(headerEtag) + return e.updateTimestamp(headers) +} + +func (e *Entity) updateTimestamp(headers http.Header) error { + str := headers.Get(headerDate) + t, err := time.Parse(time.RFC1123, str) + if err != nil { + return fmt.Errorf("Update timestamp error: %v", err) + } + e.TimeStamp = t + return nil +} + +func (e *Entity) insertOr(verb string, options *EntityOptions) error { + query, headers := options.getParameters() + headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) + + body, err := json.Marshal(e) + if err != nil { + return err + } + headers = addBodyRelatedHeaders(headers, len(body)) + headers = addReturnContentHeaders(headers, EmptyPayload) + + uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) + resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + } + + return e.updateEtagAndTimestamp(resp.headers) +} + +func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) error { + query, headers := options.getParameters() + headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders()) + + body, err := json.Marshal(e) + if err != nil { + return err + } + headers = addBodyRelatedHeaders(headers, len(body)) + headers = addIfMatchHeader(headers, force, e.OdataEtag) + headers = addReturnContentHeaders(headers, EmptyPayload) + + uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query) + resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth) + if err != nil { + if resp.statusCode == http.StatusPreconditionFailed { + return fmt.Errorf(etagErrorTemplate, err) + } + return err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + } + + return e.updateEtagAndTimestamp(resp.headers) +} + +func stringFromMap(props map[string]interface{}, key string) string { + value := getAndDelete(props, key) + if value != nil { + return value.(string) + } + return "" +} + +func (options *EntityOptions) getParameters() (url.Values, map[string]string) { + query := url.Values{} + headers := map[string]string{} + if options != nil { + query = addTimeout(query, options.Timeout) + headers = headersFromStruct(*options) + } + return query, headers +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity_test.go index 5f0b4dda59..553ee5f3f3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity_test.go @@ -1,549 +1,549 @@ -package storage - -import ( - "encoding/json" - "fmt" - "time" - - "github.com/satori/uuid" - chk "gopkg.in/check.v1" -) - -type StorageEntitySuite struct{} - -var _ = chk.Suite(&StorageEntitySuite{}) - -func (s *StorageEntitySuite) TestGet(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - err = entity.Insert(EmptyPayload, nil) - c.Assert(err, chk.IsNil) - - err = entity.Get(30, FullMetadata, &GetEntityOptions{ - Select: []string{"IsActive"}, - }) - c.Assert(err, chk.IsNil) - c.Assert(entity.Properties, chk.HasLen, 1) - - err = entity.Get(30, FullMetadata, &GetEntityOptions{ - Select: []string{ - "AmountDue", - "CustomerCode", - "CustomerSince", - "IsActive", - "NumberOfOrders", - }}) - c.Assert(err, chk.IsNil) - c.Assert(entity.Properties, chk.HasLen, 5) - - err = entity.Get(30, FullMetadata, nil) - c.Assert(err, chk.IsNil) - c.Assert(entity.Properties, chk.HasLen, 5) -} - -const ( - validEtag = "W/\"datetime''2017-04-01T01%3A07%3A23.8881885Z''\"" -) - -func (s *StorageEntitySuite) TestInsert(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - err = entity.Insert(EmptyPayload, nil) - c.Assert(err, chk.IsNil) - // Did not update - c.Assert(entity.TimeStamp, chk.Equals, time.Time{}) - c.Assert(entity.OdataMetadata, chk.Equals, "") - c.Assert(entity.OdataType, chk.Equals, "") - c.Assert(entity.OdataID, chk.Equals, "") - c.Assert(entity.OdataEtag, chk.Equals, "") - c.Assert(entity.OdataEditLink, chk.Equals, "") - - // Update - entity.PartitionKey = "mypartitionkey2" - entity.RowKey = "myrowkey2" - err = entity.Insert(FullMetadata, nil) - c.Assert(err, chk.IsNil) - // Check everything was updated... - c.Assert(entity.TimeStamp, chk.NotNil) - c.Assert(entity.OdataMetadata, chk.Not(chk.Equals), "") - c.Assert(entity.OdataType, chk.Not(chk.Equals), "") - c.Assert(entity.OdataID, chk.Not(chk.Equals), "") - c.Assert(entity.OdataEtag, chk.Not(chk.Equals), "") - c.Assert(entity.OdataEditLink, chk.Not(chk.Equals), "") -} - -func (s *StorageEntitySuite) TestUpdate(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - entity.Properties = map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - // Force update - err = entity.Insert(FullMetadata, nil) - c.Assert(err, chk.IsNil) - - etag := entity.OdataEtag - timestamp := entity.TimeStamp - - props := map[string]interface{}{ - "Name": "Anakin", - "FamilyName": "Skywalker", - "HasEpicTheme": true, - } - entity.Properties = props - // Update providing etag - err = entity.Update(false, nil) - c.Assert(err, chk.IsNil) - - c.Assert(entity.Properties, chk.DeepEquals, props) - c.Assert(entity.OdataEtag, chk.Not(chk.Equals), etag) - c.Assert(entity.TimeStamp, chk.Not(chk.Equals), timestamp) - - // Try to update with old etag - entity.OdataEtag = validEtag - err = entity.Update(false, nil) - c.Assert(err, chk.NotNil) - c.Assert(err, chk.ErrorMatches, "Etag didn't match: .*") - - // Force update - props = map[string]interface{}{ - "Name": "Leia", - "FamilyName": "Organa", - "HasAwesomeDress": true, - } - entity.Properties = props - err = entity.Update(true, nil) - c.Assert(err, chk.IsNil) - c.Assert(entity.Properties, chk.DeepEquals, props) -} - -func (s *StorageEntitySuite) TestMerge(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - entity.Properties = map[string]interface{}{ - "Country": "Mexico", - "MalePoet": "Nezahualcoyotl", - } - c.Assert(entity.Insert(FullMetadata, nil), chk.IsNil) - - etag := entity.OdataEtag - timestamp := entity.TimeStamp - - entity.Properties = map[string]interface{}{ - "FemalePoet": "Sor Juana Ines de la Cruz", - } - // Merge providing etag - err = entity.Merge(false, nil) - c.Assert(err, chk.IsNil) - c.Assert(entity.OdataEtag, chk.Not(chk.Equals), etag) - c.Assert(entity.TimeStamp, chk.Not(chk.Equals), timestamp) - - // Try to merge with incorrect etag - entity.OdataEtag = validEtag - err = entity.Merge(false, nil) - c.Assert(err, chk.NotNil) - c.Assert(err, chk.ErrorMatches, "Etag didn't match: .*") - - // Force merge - entity.Properties = map[string]interface{}{ - "MalePainter": "Diego Rivera", - "FemalePainter": "Frida Kahlo", - } - err = entity.Merge(true, nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageEntitySuite) TestDelete(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - // Delete providing etag - entity1 := table.GetEntityReference("pkey1", "rowkey1") - c.Assert(entity1.Insert(FullMetadata, nil), chk.IsNil) - - err = entity1.Delete(false, nil) - c.Assert(err, chk.IsNil) - - // Try to delete with incorrect etag - entity2 := table.GetEntityReference("pkey2", "rowkey2") - c.Assert(entity2.Insert(EmptyPayload, nil), chk.IsNil) - entity2.OdataEtag = "GolangRocksOnAzure" - - err = entity2.Delete(false, nil) - c.Assert(err, chk.NotNil) - - // Force delete - err = entity2.Delete(true, nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageEntitySuite) TestInsertOrReplace(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - entity.Properties = map[string]interface{}{ - "Name": "Anakin", - "FamilyName": "Skywalker", - "HasEpicTheme": true, - } - - err = entity.InsertOrReplace(nil) - c.Assert(err, chk.IsNil) - - entity.Properties = map[string]interface{}{ - "Name": "Leia", - "FamilyName": "Organa", - "HasAwesomeDress": true, - } - err = entity.InsertOrReplace(nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageEntitySuite) TestInsertOrMerge(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - entity.Properties = map[string]interface{}{ - "Name": "Luke", - "FamilyName": "Skywalker", - } - - err = entity.InsertOrMerge(nil) - c.Assert(err, chk.IsNil) - - entity.Properties = map[string]interface{}{ - "Father": "Anakin", - "Mentor": "Yoda", - } - err = entity.InsertOrMerge(nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageEntitySuite) Test_InsertAndGetEntities(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "100") - entity.Properties = map[string]interface{}{ - "Name": "Luke", - "FamilyName": "Skywalker", - "HasCoolWeapon": true, - } - c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) - - entity.RowKey = "200" - c.Assert(entity.Insert(FullMetadata, nil), chk.IsNil) - - entities, err := table.QueryEntities(30, FullMetadata, nil) - c.Assert(err, chk.IsNil) - - c.Assert(entities.Entities, chk.HasLen, 2) - c.Assert(entities.OdataMetadata+"/@Element", chk.Equals, entity.OdataMetadata) - - compareEntities(entities.Entities[1], entity, c) -} - -func (s *StorageEntitySuite) Test_InsertAndExecuteQuery(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "100") - entity.Properties = map[string]interface{}{ - "Name": "Luke", - "FamilyName": "Skywalker", - "HasCoolWeapon": true, - } - c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) - - entity.RowKey = "200" - c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) - - queryOptions := QueryOptions{ - Filter: "RowKey eq '200'", - } - - entities, err := table.QueryEntities(30, FullMetadata, &queryOptions) - c.Assert(err, chk.IsNil) - - c.Assert(entities.Entities, chk.HasLen, 1) - c.Assert(entities.Entities[0].RowKey, chk.Equals, entity.RowKey) -} - -func (s *StorageEntitySuite) Test_InsertAndDeleteEntities(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "100") - entity.Properties = map[string]interface{}{ - "FamilyName": "Skywalker", - "Name": "Luke", - "Number": 3, - } - c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) - - entity.Properties["Number"] = 1 - entity.RowKey = "200" - c.Assert(entity.Insert(FullMetadata, nil), chk.IsNil) - - options := QueryOptions{ - Filter: "Number eq 1", - } - - result, err := table.QueryEntities(30, FullMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(result.Entities, chk.HasLen, 1) - compareEntities(result.Entities[0], entity, c) - - err = result.Entities[0].Delete(true, nil) - c.Assert(err, chk.IsNil) - - result, err = table.QueryEntities(30, FullMetadata, nil) - c.Assert(err, chk.IsNil) - - // only 1 entry must be present - c.Assert(result.Entities, chk.HasLen, 1) -} - -func (s *StorageEntitySuite) TestExecuteQueryNextResults(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - var entityList []*Entity - - for i := 0; i < 5; i++ { - entity := table.GetEntityReference("pkey", fmt.Sprintf("r%d", i)) - err := entity.Insert(FullMetadata, nil) - c.Assert(err, chk.IsNil) - entityList = append(entityList, entity) - } - - // retrieve using top = 2. Should return 2 entries, 2 entries and finally - // 1 entry - options := QueryOptions{ - Top: 2, - } - results, err := table.QueryEntities(30, FullMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 2) - c.Assert(results.NextLink, chk.NotNil) - compareEntities(results.Entities[0], entityList[0], c) - compareEntities(results.Entities[1], entityList[1], c) - - results, err = results.NextResults(nil) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 2) - c.Assert(results.NextLink, chk.NotNil) - compareEntities(results.Entities[0], entityList[2], c) - compareEntities(results.Entities[1], entityList[3], c) - - results, err = results.NextResults(nil) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 1) - c.Assert(results.NextLink, chk.IsNil) - compareEntities(results.Entities[0], entityList[4], c) -} - -func (s *StorageEntitySuite) Test_entityMarshalJSON(c *chk.C) { - expected := `{"Address":"Mountain View","Age":23,"AmountDue":200.23,"Binary":"abcd","Binary@odata.type":"Edm.Binary","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}` - - entity := Entity{ - PartitionKey: "mypartitionkey", - RowKey: "myrowkey", - Properties: map[string]interface{}{ - "Address": "Mountain View", - "Age": 23, - "AmountDue": 200.23, - "Binary": []byte("abcd"), - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - }, - } - got, err := json.Marshal(&entity) - c.Assert(err, chk.IsNil) - c.Assert(string(got), chk.Equals, expected) - - entity.Properties["Contoso@odata.type"] = "Edm.Trololololol" - got, err = json.Marshal(&entity) - c.Assert(got, chk.IsNil) - c.Assert(err, chk.ErrorMatches, ".*Odata.type annotation Contoso@odata.type value is not valid") - - entity.Properties["Contoso@odata.type"] = OdataGUID - got, err = json.Marshal(&entity) - c.Assert(got, chk.IsNil) - c.Assert(err, chk.ErrorMatches, ".*Odata.type annotation Contoso@odata.type defined without value defined") -} - -func (s *StorageEntitySuite) Test_entityUnmarshalJSON(c *chk.C) { - input := `{ - "odata.metadata":"https://azuregosdkstoragetests.table.core.windows.net/$metadata#SampleTable/@Element", - "odata.type":"azuregosdkstoragetests.SampleTable", - "odata.id":"https://azuregosdkstoragetests.table.core.windows.net/SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')", - "odata.etag":"W/\"datetime''2017-01-27T01%3A01%3A44.151805Z''\"", - "odata.editLink":"SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')", - "PartitionKey":"mypartitionkey", - "RowKey":"myrowkey", - "Timestamp":"2017-01-27T01:01:44.151805Z", - "Timestamp@odata.type":"Edm.DateTime", - "Address": "Mountain View", - "Age": 23, - "AmountDue":200.23, - "Binary@odata.type": "Edm.Binary", - "Binary": "abcd", - "CustomerCode@odata.type":"Edm.Guid", - "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833", - "CustomerSince@odata.type":"Edm.DateTime", - "CustomerSince":"1992-12-20T21:55:00Z", - "IsActive":true, - "NumberOfOrders@odata.type":"Edm.Int64", - "NumberOfOrders":"255"}` - - var entity Entity - data := []byte(input) - err := json.Unmarshal(data, &entity) - c.Assert(err, chk.IsNil) - - expectedProperties := map[string]interface{}{ - "Address": "Mountain View", - "Age": 23, - "AmountDue": 200.23, - "Binary": []byte("abcd"), - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, 12, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - - c.Assert(entity.OdataMetadata, chk.Equals, "https://azuregosdkstoragetests.table.core.windows.net/$metadata#SampleTable/@Element") - c.Assert(entity.OdataType, chk.Equals, "azuregosdkstoragetests.SampleTable") - c.Assert(entity.OdataID, chk.Equals, "https://azuregosdkstoragetests.table.core.windows.net/SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')") - c.Assert(entity.OdataEtag, chk.Equals, "W/\"datetime''2017-01-27T01%3A01%3A44.151805Z''\"") - c.Assert(entity.OdataEditLink, chk.Equals, "SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')") - c.Assert(entity.PartitionKey, chk.Equals, "mypartitionkey") - c.Assert(entity.RowKey, chk.Equals, "myrowkey") - c.Assert(entity.TimeStamp, chk.Equals, time.Date(2017, 1, 27, 1, 1, 44, 151805000, time.UTC)) - - c.Assert(entity.Properties, chk.HasLen, len(expectedProperties)) - c.Assert(entity.Properties["Address"], chk.Equals, expectedProperties["Address"]) - // Note on Age assertion... Looks like the json unmarshaller thinks all numbers are float64. - c.Assert(entity.Properties["Age"], chk.Equals, float64(expectedProperties["Age"].(int))) - c.Assert(entity.Properties["AmountDue"], chk.Equals, expectedProperties["AmountDue"]) - c.Assert(entity.Properties["Binary"], chk.DeepEquals, expectedProperties["Binary"]) - c.Assert(entity.Properties["CustomerSince"], chk.Equals, expectedProperties["CustomerSince"]) - c.Assert(entity.Properties["IsActive"], chk.Equals, expectedProperties["IsActive"]) - c.Assert(entity.Properties["NumberOfOrders"], chk.Equals, expectedProperties["NumberOfOrders"]) - -} - -func compareEntities(got, expected *Entity, c *chk.C) { - c.Assert(got.PartitionKey, chk.Equals, expected.PartitionKey) - c.Assert(got.RowKey, chk.Equals, expected.RowKey) - c.Assert(got.TimeStamp, chk.Equals, expected.TimeStamp) - - c.Assert(got.OdataEtag, chk.Equals, expected.OdataEtag) - c.Assert(got.OdataType, chk.Equals, expected.OdataType) - c.Assert(got.OdataID, chk.Equals, expected.OdataID) - c.Assert(got.OdataEditLink, chk.Equals, expected.OdataEditLink) - - c.Assert(got.Properties, chk.DeepEquals, expected.Properties) -} +package storage + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/satori/uuid" + chk "gopkg.in/check.v1" +) + +type StorageEntitySuite struct{} + +var _ = chk.Suite(&StorageEntitySuite{}) + +func (s *StorageEntitySuite) TestGet(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + err = entity.Insert(EmptyPayload, nil) + c.Assert(err, chk.IsNil) + + err = entity.Get(30, FullMetadata, &GetEntityOptions{ + Select: []string{"IsActive"}, + }) + c.Assert(err, chk.IsNil) + c.Assert(entity.Properties, chk.HasLen, 1) + + err = entity.Get(30, FullMetadata, &GetEntityOptions{ + Select: []string{ + "AmountDue", + "CustomerCode", + "CustomerSince", + "IsActive", + "NumberOfOrders", + }}) + c.Assert(err, chk.IsNil) + c.Assert(entity.Properties, chk.HasLen, 5) + + err = entity.Get(30, FullMetadata, nil) + c.Assert(err, chk.IsNil) + c.Assert(entity.Properties, chk.HasLen, 5) +} + +const ( + validEtag = "W/\"datetime''2017-04-01T01%3A07%3A23.8881885Z''\"" +) + +func (s *StorageEntitySuite) TestInsert(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + err = entity.Insert(EmptyPayload, nil) + c.Assert(err, chk.IsNil) + // Did not update + c.Assert(entity.TimeStamp, chk.Equals, time.Time{}) + c.Assert(entity.OdataMetadata, chk.Equals, "") + c.Assert(entity.OdataType, chk.Equals, "") + c.Assert(entity.OdataID, chk.Equals, "") + c.Assert(entity.OdataEtag, chk.Equals, "") + c.Assert(entity.OdataEditLink, chk.Equals, "") + + // Update + entity.PartitionKey = "mypartitionkey2" + entity.RowKey = "myrowkey2" + err = entity.Insert(FullMetadata, nil) + c.Assert(err, chk.IsNil) + // Check everything was updated... + c.Assert(entity.TimeStamp, chk.NotNil) + c.Assert(entity.OdataMetadata, chk.Not(chk.Equals), "") + c.Assert(entity.OdataType, chk.Not(chk.Equals), "") + c.Assert(entity.OdataID, chk.Not(chk.Equals), "") + c.Assert(entity.OdataEtag, chk.Not(chk.Equals), "") + c.Assert(entity.OdataEditLink, chk.Not(chk.Equals), "") +} + +func (s *StorageEntitySuite) TestUpdate(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + entity.Properties = map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + // Force update + err = entity.Insert(FullMetadata, nil) + c.Assert(err, chk.IsNil) + + etag := entity.OdataEtag + timestamp := entity.TimeStamp + + props := map[string]interface{}{ + "Name": "Anakin", + "FamilyName": "Skywalker", + "HasEpicTheme": true, + } + entity.Properties = props + // Update providing etag + err = entity.Update(false, nil) + c.Assert(err, chk.IsNil) + + c.Assert(entity.Properties, chk.DeepEquals, props) + c.Assert(entity.OdataEtag, chk.Not(chk.Equals), etag) + c.Assert(entity.TimeStamp, chk.Not(chk.Equals), timestamp) + + // Try to update with old etag + entity.OdataEtag = validEtag + err = entity.Update(false, nil) + c.Assert(err, chk.NotNil) + c.Assert(err, chk.ErrorMatches, "Etag didn't match: .*") + + // Force update + props = map[string]interface{}{ + "Name": "Leia", + "FamilyName": "Organa", + "HasAwesomeDress": true, + } + entity.Properties = props + err = entity.Update(true, nil) + c.Assert(err, chk.IsNil) + c.Assert(entity.Properties, chk.DeepEquals, props) +} + +func (s *StorageEntitySuite) TestMerge(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + entity.Properties = map[string]interface{}{ + "Country": "Mexico", + "MalePoet": "Nezahualcoyotl", + } + c.Assert(entity.Insert(FullMetadata, nil), chk.IsNil) + + etag := entity.OdataEtag + timestamp := entity.TimeStamp + + entity.Properties = map[string]interface{}{ + "FemalePoet": "Sor Juana Ines de la Cruz", + } + // Merge providing etag + err = entity.Merge(false, nil) + c.Assert(err, chk.IsNil) + c.Assert(entity.OdataEtag, chk.Not(chk.Equals), etag) + c.Assert(entity.TimeStamp, chk.Not(chk.Equals), timestamp) + + // Try to merge with incorrect etag + entity.OdataEtag = validEtag + err = entity.Merge(false, nil) + c.Assert(err, chk.NotNil) + c.Assert(err, chk.ErrorMatches, "Etag didn't match: .*") + + // Force merge + entity.Properties = map[string]interface{}{ + "MalePainter": "Diego Rivera", + "FemalePainter": "Frida Kahlo", + } + err = entity.Merge(true, nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageEntitySuite) TestDelete(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + // Delete providing etag + entity1 := table.GetEntityReference("pkey1", "rowkey1") + c.Assert(entity1.Insert(FullMetadata, nil), chk.IsNil) + + err = entity1.Delete(false, nil) + c.Assert(err, chk.IsNil) + + // Try to delete with incorrect etag + entity2 := table.GetEntityReference("pkey2", "rowkey2") + c.Assert(entity2.Insert(EmptyPayload, nil), chk.IsNil) + entity2.OdataEtag = "GolangRocksOnAzure" + + err = entity2.Delete(false, nil) + c.Assert(err, chk.NotNil) + + // Force delete + err = entity2.Delete(true, nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageEntitySuite) TestInsertOrReplace(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + entity.Properties = map[string]interface{}{ + "Name": "Anakin", + "FamilyName": "Skywalker", + "HasEpicTheme": true, + } + + err = entity.InsertOrReplace(nil) + c.Assert(err, chk.IsNil) + + entity.Properties = map[string]interface{}{ + "Name": "Leia", + "FamilyName": "Organa", + "HasAwesomeDress": true, + } + err = entity.InsertOrReplace(nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageEntitySuite) TestInsertOrMerge(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + entity.Properties = map[string]interface{}{ + "Name": "Luke", + "FamilyName": "Skywalker", + } + + err = entity.InsertOrMerge(nil) + c.Assert(err, chk.IsNil) + + entity.Properties = map[string]interface{}{ + "Father": "Anakin", + "Mentor": "Yoda", + } + err = entity.InsertOrMerge(nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageEntitySuite) Test_InsertAndGetEntities(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "100") + entity.Properties = map[string]interface{}{ + "Name": "Luke", + "FamilyName": "Skywalker", + "HasCoolWeapon": true, + } + c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) + + entity.RowKey = "200" + c.Assert(entity.Insert(FullMetadata, nil), chk.IsNil) + + entities, err := table.QueryEntities(30, FullMetadata, nil) + c.Assert(err, chk.IsNil) + + c.Assert(entities.Entities, chk.HasLen, 2) + c.Assert(entities.OdataMetadata+"/@Element", chk.Equals, entity.OdataMetadata) + + compareEntities(entities.Entities[1], entity, c) +} + +func (s *StorageEntitySuite) Test_InsertAndExecuteQuery(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "100") + entity.Properties = map[string]interface{}{ + "Name": "Luke", + "FamilyName": "Skywalker", + "HasCoolWeapon": true, + } + c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) + + entity.RowKey = "200" + c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) + + queryOptions := QueryOptions{ + Filter: "RowKey eq '200'", + } + + entities, err := table.QueryEntities(30, FullMetadata, &queryOptions) + c.Assert(err, chk.IsNil) + + c.Assert(entities.Entities, chk.HasLen, 1) + c.Assert(entities.Entities[0].RowKey, chk.Equals, entity.RowKey) +} + +func (s *StorageEntitySuite) Test_InsertAndDeleteEntities(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "100") + entity.Properties = map[string]interface{}{ + "FamilyName": "Skywalker", + "Name": "Luke", + "Number": 3, + } + c.Assert(entity.Insert(EmptyPayload, nil), chk.IsNil) + + entity.Properties["Number"] = 1 + entity.RowKey = "200" + c.Assert(entity.Insert(FullMetadata, nil), chk.IsNil) + + options := QueryOptions{ + Filter: "Number eq 1", + } + + result, err := table.QueryEntities(30, FullMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(result.Entities, chk.HasLen, 1) + compareEntities(result.Entities[0], entity, c) + + err = result.Entities[0].Delete(true, nil) + c.Assert(err, chk.IsNil) + + result, err = table.QueryEntities(30, FullMetadata, nil) + c.Assert(err, chk.IsNil) + + // only 1 entry must be present + c.Assert(result.Entities, chk.HasLen, 1) +} + +func (s *StorageEntitySuite) TestExecuteQueryNextResults(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + var entityList []*Entity + + for i := 0; i < 5; i++ { + entity := table.GetEntityReference("pkey", fmt.Sprintf("r%d", i)) + err := entity.Insert(FullMetadata, nil) + c.Assert(err, chk.IsNil) + entityList = append(entityList, entity) + } + + // retrieve using top = 2. Should return 2 entries, 2 entries and finally + // 1 entry + options := QueryOptions{ + Top: 2, + } + results, err := table.QueryEntities(30, FullMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 2) + c.Assert(results.NextLink, chk.NotNil) + compareEntities(results.Entities[0], entityList[0], c) + compareEntities(results.Entities[1], entityList[1], c) + + results, err = results.NextResults(nil) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 2) + c.Assert(results.NextLink, chk.NotNil) + compareEntities(results.Entities[0], entityList[2], c) + compareEntities(results.Entities[1], entityList[3], c) + + results, err = results.NextResults(nil) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 1) + c.Assert(results.NextLink, chk.IsNil) + compareEntities(results.Entities[0], entityList[4], c) +} + +func (s *StorageEntitySuite) Test_entityMarshalJSON(c *chk.C) { + expected := `{"Address":"Mountain View","Age":23,"AmountDue":200.23,"Binary":"abcd","Binary@odata.type":"Edm.Binary","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}` + + entity := Entity{ + PartitionKey: "mypartitionkey", + RowKey: "myrowkey", + Properties: map[string]interface{}{ + "Address": "Mountain View", + "Age": 23, + "AmountDue": 200.23, + "Binary": []byte("abcd"), + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + }, + } + got, err := json.Marshal(&entity) + c.Assert(err, chk.IsNil) + c.Assert(string(got), chk.Equals, expected) + + entity.Properties["Contoso@odata.type"] = "Edm.Trololololol" + got, err = json.Marshal(&entity) + c.Assert(got, chk.IsNil) + c.Assert(err, chk.ErrorMatches, ".*Odata.type annotation Contoso@odata.type value is not valid") + + entity.Properties["Contoso@odata.type"] = OdataGUID + got, err = json.Marshal(&entity) + c.Assert(got, chk.IsNil) + c.Assert(err, chk.ErrorMatches, ".*Odata.type annotation Contoso@odata.type defined without value defined") +} + +func (s *StorageEntitySuite) Test_entityUnmarshalJSON(c *chk.C) { + input := `{ + "odata.metadata":"https://azuregosdkstoragetests.table.core.windows.net/$metadata#SampleTable/@Element", + "odata.type":"azuregosdkstoragetests.SampleTable", + "odata.id":"https://azuregosdkstoragetests.table.core.windows.net/SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')", + "odata.etag":"W/\"datetime''2017-01-27T01%3A01%3A44.151805Z''\"", + "odata.editLink":"SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')", + "PartitionKey":"mypartitionkey", + "RowKey":"myrowkey", + "Timestamp":"2017-01-27T01:01:44.151805Z", + "Timestamp@odata.type":"Edm.DateTime", + "Address": "Mountain View", + "Age": 23, + "AmountDue":200.23, + "Binary@odata.type": "Edm.Binary", + "Binary": "abcd", + "CustomerCode@odata.type":"Edm.Guid", + "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833", + "CustomerSince@odata.type":"Edm.DateTime", + "CustomerSince":"1992-12-20T21:55:00Z", + "IsActive":true, + "NumberOfOrders@odata.type":"Edm.Int64", + "NumberOfOrders":"255"}` + + var entity Entity + data := []byte(input) + err := json.Unmarshal(data, &entity) + c.Assert(err, chk.IsNil) + + expectedProperties := map[string]interface{}{ + "Address": "Mountain View", + "Age": 23, + "AmountDue": 200.23, + "Binary": []byte("abcd"), + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, 12, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + + c.Assert(entity.OdataMetadata, chk.Equals, "https://azuregosdkstoragetests.table.core.windows.net/$metadata#SampleTable/@Element") + c.Assert(entity.OdataType, chk.Equals, "azuregosdkstoragetests.SampleTable") + c.Assert(entity.OdataID, chk.Equals, "https://azuregosdkstoragetests.table.core.windows.net/SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')") + c.Assert(entity.OdataEtag, chk.Equals, "W/\"datetime''2017-01-27T01%3A01%3A44.151805Z''\"") + c.Assert(entity.OdataEditLink, chk.Equals, "SampleTable(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')") + c.Assert(entity.PartitionKey, chk.Equals, "mypartitionkey") + c.Assert(entity.RowKey, chk.Equals, "myrowkey") + c.Assert(entity.TimeStamp, chk.Equals, time.Date(2017, 1, 27, 1, 1, 44, 151805000, time.UTC)) + + c.Assert(entity.Properties, chk.HasLen, len(expectedProperties)) + c.Assert(entity.Properties["Address"], chk.Equals, expectedProperties["Address"]) + // Note on Age assertion... Looks like the json unmarshaller thinks all numbers are float64. + c.Assert(entity.Properties["Age"], chk.Equals, float64(expectedProperties["Age"].(int))) + c.Assert(entity.Properties["AmountDue"], chk.Equals, expectedProperties["AmountDue"]) + c.Assert(entity.Properties["Binary"], chk.DeepEquals, expectedProperties["Binary"]) + c.Assert(entity.Properties["CustomerSince"], chk.Equals, expectedProperties["CustomerSince"]) + c.Assert(entity.Properties["IsActive"], chk.Equals, expectedProperties["IsActive"]) + c.Assert(entity.Properties["NumberOfOrders"], chk.Equals, expectedProperties["NumberOfOrders"]) + +} + +func compareEntities(got, expected *Entity, c *chk.C) { + c.Assert(got.PartitionKey, chk.Equals, expected.PartitionKey) + c.Assert(got.RowKey, chk.Equals, expected.RowKey) + c.Assert(got.TimeStamp, chk.Equals, expected.TimeStamp) + + c.Assert(got.OdataEtag, chk.Equals, expected.OdataEtag) + c.Assert(got.OdataType, chk.Equals, expected.OdataType) + c.Assert(got.OdataID, chk.Equals, expected.OdataID) + c.Assert(got.OdataEditLink, chk.Equals, expected.OdataEditLink) + + c.Assert(got.Properties, chk.DeepEquals, expected.Properties) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go index 623ba6764f..238ac6d6d9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go @@ -1,462 +1,462 @@ -package storage - -import ( - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" -) - -const fourMB = uint64(4194304) -const oneTB = uint64(1099511627776) - -// File represents a file on a share. -type File struct { - fsc *FileServiceClient - Metadata map[string]string - Name string `xml:"Name"` - parent *Directory - Properties FileProperties `xml:"Properties"` - share *Share - FileCopyProperties FileCopyState -} - -// FileProperties contains various properties of a file. -type FileProperties struct { - CacheControl string `header:"x-ms-cache-control"` - Disposition string `header:"x-ms-content-disposition"` - Encoding string `header:"x-ms-content-encoding"` - Etag string - Language string `header:"x-ms-content-language"` - LastModified string - Length uint64 `xml:"Content-Length" header:"x-ms-content-length"` - MD5 string `header:"x-ms-content-md5"` - Type string `header:"x-ms-content-type"` -} - -// FileCopyState contains various properties of a file copy operation. -type FileCopyState struct { - CompletionTime string - ID string `header:"x-ms-copy-id"` - Progress string - Source string - Status string `header:"x-ms-copy-status"` - StatusDesc string -} - -// FileStream contains file data returned from a call to GetFile. -type FileStream struct { - Body io.ReadCloser - ContentMD5 string -} - -// FileRequestOptions will be passed to misc file operations. -// Currently just Timeout (in seconds) but could expand. -type FileRequestOptions struct { - Timeout uint // timeout duration in seconds. -} - -func prepareOptions(options *FileRequestOptions) url.Values { - params := url.Values{} - if options != nil { - params = addTimeout(params, options.Timeout) - } - return params -} - -// FileRanges contains a list of file range information for a file. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges -type FileRanges struct { - ContentLength uint64 - LastModified string - ETag string - FileRanges []FileRange `xml:"Range"` -} - -// FileRange contains range information for a file. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges -type FileRange struct { - Start uint64 `xml:"Start"` - End uint64 `xml:"End"` -} - -func (fr FileRange) String() string { - return fmt.Sprintf("bytes=%d-%d", fr.Start, fr.End) -} - -// builds the complete file path for this file object -func (f *File) buildPath() string { - return f.parent.buildPath() + "/" + f.Name -} - -// ClearRange releases the specified range of space in a file. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range -func (f *File) ClearRange(fileRange FileRange, options *FileRequestOptions) error { - var timeout *uint - if options != nil { - timeout = &options.Timeout - } - headers, err := f.modifyRange(nil, fileRange, timeout, nil) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} - -// Create creates a new file or replaces an existing one. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-File -func (f *File) Create(maxSize uint64, options *FileRequestOptions) error { - if maxSize > oneTB { - return fmt.Errorf("max file size is 1TB") - } - params := prepareOptions(options) - headers := headersFromStruct(f.Properties) - headers["x-ms-content-length"] = strconv.FormatUint(maxSize, 10) - headers["x-ms-type"] = "file" - - outputHeaders, err := f.fsc.createResource(f.buildPath(), resourceFile, params, mergeMDIntoExtraHeaders(f.Metadata, headers), []int{http.StatusCreated}) - if err != nil { - return err - } - - f.Properties.Length = maxSize - f.updateEtagAndLastModified(outputHeaders) - return nil -} - -// CopyFile operation copied a file/blob from the sourceURL to the path provided. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/copy-file -func (f *File) CopyFile(sourceURL string, options *FileRequestOptions) error { - extraHeaders := map[string]string{ - "x-ms-type": "file", - "x-ms-copy-source": sourceURL, - } - params := prepareOptions(options) - - headers, err := f.fsc.createResource(f.buildPath(), resourceFile, params, mergeMDIntoExtraHeaders(f.Metadata, extraHeaders), []int{http.StatusAccepted}) - if err != nil { - return err - } - - f.updateEtagLastModifiedAndCopyHeaders(headers) - return nil -} - -// Delete immediately removes this file from the storage account. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2 -func (f *File) Delete(options *FileRequestOptions) error { - return f.fsc.deleteResource(f.buildPath(), resourceFile, options) -} - -// DeleteIfExists removes this file if it exists. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2 -func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) { - resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -// GetFileOptions includes options for a get file operation -type GetFileOptions struct { - Timeout uint - GetContentMD5 bool -} - -// DownloadToStream operation downloads the file. -// -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file -func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, error) { - params := prepareOptions(options) - resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, params, http.MethodGet, nil) - if err != nil { - return nil, err - } - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - readAndCloseBody(resp.body) - return nil, err - } - return resp.body, nil -} - -// DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file -func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOptions) (fs FileStream, err error) { - extraHeaders := map[string]string{ - "Range": fileRange.String(), - } - params := url.Values{} - if options != nil { - if options.GetContentMD5 { - if isRangeTooBig(fileRange) { - return fs, fmt.Errorf("must specify a range less than or equal to 4MB when getContentMD5 is true") - } - extraHeaders["x-ms-range-get-content-md5"] = "true" - } - params = addTimeout(params, options.Timeout) - } - - resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, params, http.MethodGet, extraHeaders) - if err != nil { - return fs, err - } - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK, http.StatusPartialContent}); err != nil { - readAndCloseBody(resp.body) - return fs, err - } - - fs.Body = resp.body - if options != nil && options.GetContentMD5 { - fs.ContentMD5 = resp.headers.Get("Content-MD5") - } - return fs, nil -} - -// Exists returns true if this file exists. -func (f *File) Exists() (bool, error) { - exists, headers, err := f.fsc.resourceExists(f.buildPath(), resourceFile) - if exists { - f.updateEtagAndLastModified(headers) - f.updateProperties(headers) - } - return exists, err -} - -// FetchAttributes updates metadata and properties for this file. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-properties -func (f *File) FetchAttributes(options *FileRequestOptions) error { - params := prepareOptions(options) - headers, err := f.fsc.getResourceHeaders(f.buildPath(), compNone, resourceFile, params, http.MethodHead) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - f.updateProperties(headers) - f.Metadata = getMetadataFromHeaders(headers) - return nil -} - -// returns true if the range is larger than 4MB -func isRangeTooBig(fileRange FileRange) bool { - if fileRange.End-fileRange.Start > fourMB { - return true - } - - return false -} - -// ListRangesOptions includes options for a list file ranges operation -type ListRangesOptions struct { - Timeout uint - ListRange *FileRange -} - -// ListRanges returns the list of valid ranges for this file. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges -func (f *File) ListRanges(options *ListRangesOptions) (*FileRanges, error) { - params := url.Values{"comp": {"rangelist"}} - - // add optional range to list - var headers map[string]string - if options != nil { - params = addTimeout(params, options.Timeout) - if options.ListRange != nil { - headers = make(map[string]string) - headers["Range"] = options.ListRange.String() - } - } - - resp, err := f.fsc.listContent(f.buildPath(), params, headers) - if err != nil { - return nil, err - } - - defer resp.body.Close() - var cl uint64 - cl, err = strconv.ParseUint(resp.headers.Get("x-ms-content-length"), 10, 64) - if err != nil { - ioutil.ReadAll(resp.body) - return nil, err - } - - var out FileRanges - out.ContentLength = cl - out.ETag = resp.headers.Get("ETag") - out.LastModified = resp.headers.Get("Last-Modified") - - err = xmlUnmarshal(resp.body, &out) - return &out, err -} - -// modifies a range of bytes in this file -func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint, contentMD5 *string) (http.Header, error) { - if err := f.fsc.checkForStorageEmulator(); err != nil { - return nil, err - } - if fileRange.End < fileRange.Start { - return nil, errors.New("the value for rangeEnd must be greater than or equal to rangeStart") - } - if bytes != nil && isRangeTooBig(fileRange) { - return nil, errors.New("range cannot exceed 4MB in size") - } - - params := url.Values{"comp": {"range"}} - if timeout != nil { - params = addTimeout(params, *timeout) - } - - uri := f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), params) - - // default to clear - write := "clear" - cl := uint64(0) - - // if bytes is not nil then this is an update operation - if bytes != nil { - write = "update" - cl = (fileRange.End - fileRange.Start) + 1 - } - - extraHeaders := map[string]string{ - "Content-Length": strconv.FormatUint(cl, 10), - "Range": fileRange.String(), - "x-ms-write": write, - } - - if contentMD5 != nil { - extraHeaders["Content-MD5"] = *contentMD5 - } - - headers := mergeHeaders(f.fsc.client.getStandardHeaders(), extraHeaders) - resp, err := f.fsc.client.exec(http.MethodPut, uri, headers, bytes, f.fsc.auth) - if err != nil { - return nil, err - } - defer readAndCloseBody(resp.body) - return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// SetMetadata replaces the metadata for this file. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetFileMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Metadata -func (f *File) SetMetadata(options *FileRequestOptions) error { - headers, err := f.fsc.setResourceHeaders(f.buildPath(), compMetadata, resourceFile, mergeMDIntoExtraHeaders(f.Metadata, nil), options) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} - -// SetProperties sets system properties on this file. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by SetFileProperties. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Properties -func (f *File) SetProperties(options *FileRequestOptions) error { - headers, err := f.fsc.setResourceHeaders(f.buildPath(), compProperties, resourceFile, headersFromStruct(f.Properties), options) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} - -// updates Etag and last modified date -func (f *File) updateEtagAndLastModified(headers http.Header) { - f.Properties.Etag = headers.Get("Etag") - f.Properties.LastModified = headers.Get("Last-Modified") -} - -// updates Etag, last modified date and x-ms-copy-id -func (f *File) updateEtagLastModifiedAndCopyHeaders(headers http.Header) { - f.Properties.Etag = headers.Get("Etag") - f.Properties.LastModified = headers.Get("Last-Modified") - f.FileCopyProperties.ID = headers.Get("X-Ms-Copy-Id") - f.FileCopyProperties.Status = headers.Get("X-Ms-Copy-Status") -} - -// updates file properties from the specified HTTP header -func (f *File) updateProperties(header http.Header) { - size, err := strconv.ParseUint(header.Get("Content-Length"), 10, 64) - if err == nil { - f.Properties.Length = size - } - - f.updateEtagAndLastModified(header) - f.Properties.CacheControl = header.Get("Cache-Control") - f.Properties.Disposition = header.Get("Content-Disposition") - f.Properties.Encoding = header.Get("Content-Encoding") - f.Properties.Language = header.Get("Content-Language") - f.Properties.MD5 = header.Get("Content-MD5") - f.Properties.Type = header.Get("Content-Type") -} - -// URL gets the canonical URL to this file. -// This method does not create a publicly accessible URL if the file -// is private and this method does not check if the file exists. -func (f *File) URL() string { - return f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), nil) -} - -// WriteRangeOptions includes opptions for a write file range operation -type WriteRangeOptions struct { - Timeout uint - ContentMD5 string -} - -// WriteRange writes a range of bytes to this file with an optional MD5 hash of the content (inside -// options parameter). Note that the length of bytes must match (rangeEnd - rangeStart) + 1 with -// a maximum size of 4MB. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range -func (f *File) WriteRange(bytes io.Reader, fileRange FileRange, options *WriteRangeOptions) error { - if bytes == nil { - return errors.New("bytes cannot be nil") - } - var timeout *uint - var md5 *string - if options != nil { - timeout = &options.Timeout - md5 = &options.ContentMD5 - } - - headers, err := f.modifyRange(bytes, fileRange, timeout, md5) - if err != nil { - return err - } - - f.updateEtagAndLastModified(headers) - return nil -} +package storage + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strconv" +) + +const fourMB = uint64(4194304) +const oneTB = uint64(1099511627776) + +// File represents a file on a share. +type File struct { + fsc *FileServiceClient + Metadata map[string]string + Name string `xml:"Name"` + parent *Directory + Properties FileProperties `xml:"Properties"` + share *Share + FileCopyProperties FileCopyState +} + +// FileProperties contains various properties of a file. +type FileProperties struct { + CacheControl string `header:"x-ms-cache-control"` + Disposition string `header:"x-ms-content-disposition"` + Encoding string `header:"x-ms-content-encoding"` + Etag string + Language string `header:"x-ms-content-language"` + LastModified string + Length uint64 `xml:"Content-Length" header:"x-ms-content-length"` + MD5 string `header:"x-ms-content-md5"` + Type string `header:"x-ms-content-type"` +} + +// FileCopyState contains various properties of a file copy operation. +type FileCopyState struct { + CompletionTime string + ID string `header:"x-ms-copy-id"` + Progress string + Source string + Status string `header:"x-ms-copy-status"` + StatusDesc string +} + +// FileStream contains file data returned from a call to GetFile. +type FileStream struct { + Body io.ReadCloser + ContentMD5 string +} + +// FileRequestOptions will be passed to misc file operations. +// Currently just Timeout (in seconds) but could expand. +type FileRequestOptions struct { + Timeout uint // timeout duration in seconds. +} + +func prepareOptions(options *FileRequestOptions) url.Values { + params := url.Values{} + if options != nil { + params = addTimeout(params, options.Timeout) + } + return params +} + +// FileRanges contains a list of file range information for a file. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges +type FileRanges struct { + ContentLength uint64 + LastModified string + ETag string + FileRanges []FileRange `xml:"Range"` +} + +// FileRange contains range information for a file. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges +type FileRange struct { + Start uint64 `xml:"Start"` + End uint64 `xml:"End"` +} + +func (fr FileRange) String() string { + return fmt.Sprintf("bytes=%d-%d", fr.Start, fr.End) +} + +// builds the complete file path for this file object +func (f *File) buildPath() string { + return f.parent.buildPath() + "/" + f.Name +} + +// ClearRange releases the specified range of space in a file. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range +func (f *File) ClearRange(fileRange FileRange, options *FileRequestOptions) error { + var timeout *uint + if options != nil { + timeout = &options.Timeout + } + headers, err := f.modifyRange(nil, fileRange, timeout, nil) + if err != nil { + return err + } + + f.updateEtagAndLastModified(headers) + return nil +} + +// Create creates a new file or replaces an existing one. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-File +func (f *File) Create(maxSize uint64, options *FileRequestOptions) error { + if maxSize > oneTB { + return fmt.Errorf("max file size is 1TB") + } + params := prepareOptions(options) + headers := headersFromStruct(f.Properties) + headers["x-ms-content-length"] = strconv.FormatUint(maxSize, 10) + headers["x-ms-type"] = "file" + + outputHeaders, err := f.fsc.createResource(f.buildPath(), resourceFile, params, mergeMDIntoExtraHeaders(f.Metadata, headers), []int{http.StatusCreated}) + if err != nil { + return err + } + + f.Properties.Length = maxSize + f.updateEtagAndLastModified(outputHeaders) + return nil +} + +// CopyFile operation copied a file/blob from the sourceURL to the path provided. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/copy-file +func (f *File) CopyFile(sourceURL string, options *FileRequestOptions) error { + extraHeaders := map[string]string{ + "x-ms-type": "file", + "x-ms-copy-source": sourceURL, + } + params := prepareOptions(options) + + headers, err := f.fsc.createResource(f.buildPath(), resourceFile, params, mergeMDIntoExtraHeaders(f.Metadata, extraHeaders), []int{http.StatusAccepted}) + if err != nil { + return err + } + + f.updateEtagLastModifiedAndCopyHeaders(headers) + return nil +} + +// Delete immediately removes this file from the storage account. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2 +func (f *File) Delete(options *FileRequestOptions) error { + return f.fsc.deleteResource(f.buildPath(), resourceFile, options) +} + +// DeleteIfExists removes this file if it exists. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2 +func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) { + resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusAccepted, nil + } + } + return false, err +} + +// GetFileOptions includes options for a get file operation +type GetFileOptions struct { + Timeout uint + GetContentMD5 bool +} + +// DownloadToStream operation downloads the file. +// +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file +func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, error) { + params := prepareOptions(options) + resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, params, http.MethodGet, nil) + if err != nil { + return nil, err + } + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + readAndCloseBody(resp.body) + return nil, err + } + return resp.body, nil +} + +// DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file +func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOptions) (fs FileStream, err error) { + extraHeaders := map[string]string{ + "Range": fileRange.String(), + } + params := url.Values{} + if options != nil { + if options.GetContentMD5 { + if isRangeTooBig(fileRange) { + return fs, fmt.Errorf("must specify a range less than or equal to 4MB when getContentMD5 is true") + } + extraHeaders["x-ms-range-get-content-md5"] = "true" + } + params = addTimeout(params, options.Timeout) + } + + resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, params, http.MethodGet, extraHeaders) + if err != nil { + return fs, err + } + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK, http.StatusPartialContent}); err != nil { + readAndCloseBody(resp.body) + return fs, err + } + + fs.Body = resp.body + if options != nil && options.GetContentMD5 { + fs.ContentMD5 = resp.headers.Get("Content-MD5") + } + return fs, nil +} + +// Exists returns true if this file exists. +func (f *File) Exists() (bool, error) { + exists, headers, err := f.fsc.resourceExists(f.buildPath(), resourceFile) + if exists { + f.updateEtagAndLastModified(headers) + f.updateProperties(headers) + } + return exists, err +} + +// FetchAttributes updates metadata and properties for this file. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-properties +func (f *File) FetchAttributes(options *FileRequestOptions) error { + params := prepareOptions(options) + headers, err := f.fsc.getResourceHeaders(f.buildPath(), compNone, resourceFile, params, http.MethodHead) + if err != nil { + return err + } + + f.updateEtagAndLastModified(headers) + f.updateProperties(headers) + f.Metadata = getMetadataFromHeaders(headers) + return nil +} + +// returns true if the range is larger than 4MB +func isRangeTooBig(fileRange FileRange) bool { + if fileRange.End-fileRange.Start > fourMB { + return true + } + + return false +} + +// ListRangesOptions includes options for a list file ranges operation +type ListRangesOptions struct { + Timeout uint + ListRange *FileRange +} + +// ListRanges returns the list of valid ranges for this file. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges +func (f *File) ListRanges(options *ListRangesOptions) (*FileRanges, error) { + params := url.Values{"comp": {"rangelist"}} + + // add optional range to list + var headers map[string]string + if options != nil { + params = addTimeout(params, options.Timeout) + if options.ListRange != nil { + headers = make(map[string]string) + headers["Range"] = options.ListRange.String() + } + } + + resp, err := f.fsc.listContent(f.buildPath(), params, headers) + if err != nil { + return nil, err + } + + defer resp.body.Close() + var cl uint64 + cl, err = strconv.ParseUint(resp.headers.Get("x-ms-content-length"), 10, 64) + if err != nil { + ioutil.ReadAll(resp.body) + return nil, err + } + + var out FileRanges + out.ContentLength = cl + out.ETag = resp.headers.Get("ETag") + out.LastModified = resp.headers.Get("Last-Modified") + + err = xmlUnmarshal(resp.body, &out) + return &out, err +} + +// modifies a range of bytes in this file +func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint, contentMD5 *string) (http.Header, error) { + if err := f.fsc.checkForStorageEmulator(); err != nil { + return nil, err + } + if fileRange.End < fileRange.Start { + return nil, errors.New("the value for rangeEnd must be greater than or equal to rangeStart") + } + if bytes != nil && isRangeTooBig(fileRange) { + return nil, errors.New("range cannot exceed 4MB in size") + } + + params := url.Values{"comp": {"range"}} + if timeout != nil { + params = addTimeout(params, *timeout) + } + + uri := f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), params) + + // default to clear + write := "clear" + cl := uint64(0) + + // if bytes is not nil then this is an update operation + if bytes != nil { + write = "update" + cl = (fileRange.End - fileRange.Start) + 1 + } + + extraHeaders := map[string]string{ + "Content-Length": strconv.FormatUint(cl, 10), + "Range": fileRange.String(), + "x-ms-write": write, + } + + if contentMD5 != nil { + extraHeaders["Content-MD5"] = *contentMD5 + } + + headers := mergeHeaders(f.fsc.client.getStandardHeaders(), extraHeaders) + resp, err := f.fsc.client.exec(http.MethodPut, uri, headers, bytes, f.fsc.auth) + if err != nil { + return nil, err + } + defer readAndCloseBody(resp.body) + return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// SetMetadata replaces the metadata for this file. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by GetFileMetadata. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Metadata +func (f *File) SetMetadata(options *FileRequestOptions) error { + headers, err := f.fsc.setResourceHeaders(f.buildPath(), compMetadata, resourceFile, mergeMDIntoExtraHeaders(f.Metadata, nil), options) + if err != nil { + return err + } + + f.updateEtagAndLastModified(headers) + return nil +} + +// SetProperties sets system properties on this file. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by SetFileProperties. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Properties +func (f *File) SetProperties(options *FileRequestOptions) error { + headers, err := f.fsc.setResourceHeaders(f.buildPath(), compProperties, resourceFile, headersFromStruct(f.Properties), options) + if err != nil { + return err + } + + f.updateEtagAndLastModified(headers) + return nil +} + +// updates Etag and last modified date +func (f *File) updateEtagAndLastModified(headers http.Header) { + f.Properties.Etag = headers.Get("Etag") + f.Properties.LastModified = headers.Get("Last-Modified") +} + +// updates Etag, last modified date and x-ms-copy-id +func (f *File) updateEtagLastModifiedAndCopyHeaders(headers http.Header) { + f.Properties.Etag = headers.Get("Etag") + f.Properties.LastModified = headers.Get("Last-Modified") + f.FileCopyProperties.ID = headers.Get("X-Ms-Copy-Id") + f.FileCopyProperties.Status = headers.Get("X-Ms-Copy-Status") +} + +// updates file properties from the specified HTTP header +func (f *File) updateProperties(header http.Header) { + size, err := strconv.ParseUint(header.Get("Content-Length"), 10, 64) + if err == nil { + f.Properties.Length = size + } + + f.updateEtagAndLastModified(header) + f.Properties.CacheControl = header.Get("Cache-Control") + f.Properties.Disposition = header.Get("Content-Disposition") + f.Properties.Encoding = header.Get("Content-Encoding") + f.Properties.Language = header.Get("Content-Language") + f.Properties.MD5 = header.Get("Content-MD5") + f.Properties.Type = header.Get("Content-Type") +} + +// URL gets the canonical URL to this file. +// This method does not create a publicly accessible URL if the file +// is private and this method does not check if the file exists. +func (f *File) URL() string { + return f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), nil) +} + +// WriteRangeOptions includes opptions for a write file range operation +type WriteRangeOptions struct { + Timeout uint + ContentMD5 string +} + +// WriteRange writes a range of bytes to this file with an optional MD5 hash of the content (inside +// options parameter). Note that the length of bytes must match (rangeEnd - rangeStart) + 1 with +// a maximum size of 4MB. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range +func (f *File) WriteRange(bytes io.Reader, fileRange FileRange, options *WriteRangeOptions) error { + if bytes == nil { + return errors.New("bytes cannot be nil") + } + var timeout *uint + var md5 *string + if options != nil { + timeout = &options.Timeout + md5 = &options.ContentMD5 + } + + headers, err := f.modifyRange(bytes, fileRange, timeout, md5) + if err != nil { + return err + } + + f.updateEtagAndLastModified(headers) + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go index 7f9ea320e3..4993f302ff 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/file_test.go @@ -1,403 +1,403 @@ -package storage - -import ( - "bytes" - "crypto/md5" - "encoding/base64" - "io" - - chk "gopkg.in/check.v1" -) - -type StorageFileSuite struct{} - -var _ = chk.Suite(&StorageFileSuite{}) - -func (s *StorageFileSuite) TestCreateFile(c *chk.C) { - cli := getFileClient(c) - cli.deleteAllShares() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - // create directory structure - dir1 := root.GetDirectoryReference("one") - c.Assert(dir1.Create(nil), chk.IsNil) - dir2 := dir1.GetDirectoryReference("two") - c.Assert(dir2.Create(nil), chk.IsNil) - - // verify file doesn't exist - file := dir2.GetFileReference("some.file") - exists, err := file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) - - // create file - c.Assert(file.Create(1024, nil), chk.IsNil) - - // delete file and verify - c.Assert(file.Delete(nil), chk.IsNil) - exists, err = file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, false) -} - -func (s *StorageFileSuite) TestGetFile(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - // create file - const size = uint64(1024) - byteStream, _ := newByteStream(size) - file := root.GetFileReference("some.file") - c.Assert(file.Create(size, nil), chk.IsNil) - - // fill file with some data - c.Assert(file.WriteRange(byteStream, FileRange{End: size - 1}, nil), chk.IsNil) - - // set some metadata - md := map[string]string{ - "something": "somethingvalue", - "another": "anothervalue", - } - file.Metadata = md - c.Assert(file.SetMetadata(nil), chk.IsNil) - - options := GetFileOptions{ - GetContentMD5: false, - } - // retrieve full file content and verify - stream, err := file.DownloadRangeToStream(FileRange{Start: 0, End: size - 1}, &options) - c.Assert(err, chk.IsNil) - defer stream.Body.Close() - var b1 [size]byte - count, _ := stream.Body.Read(b1[:]) - c.Assert(count, chk.Equals, int(size)) - var c1 [size]byte - bs, _ := newByteStream(size) - bs.Read(c1[:]) - c.Assert(b1, chk.DeepEquals, c1) - - // retrieve partial file content and verify - stream, err = file.DownloadRangeToStream(FileRange{Start: size / 2, End: size - 1}, &options) - c.Assert(err, chk.IsNil) - defer stream.Body.Close() - var b2 [size / 2]byte - count, _ = stream.Body.Read(b2[:]) - c.Assert(count, chk.Equals, int(size)/2) - var c2 [size / 2]byte - bs, _ = newByteStream(size / 2) - bs.Read(c2[:]) - c.Assert(b2, chk.DeepEquals, c2) -} - -func (s *StorageFileSuite) TestFileRanges(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - fileSize := uint64(4096) - contentBytes := content(int(fileSize)) - - // --- File with no valid ranges - file1 := root.GetFileReference("file1.txt") - c.Assert(file1.Create(fileSize, nil), chk.IsNil) - - ranges, err := file1.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.ContentLength, chk.Equals, fileSize) - c.Assert(ranges.FileRanges, chk.IsNil) - - // --- File after writing a range - file2 := root.GetFileReference("file2.txt") - c.Assert(file2.Create(fileSize, nil), chk.IsNil) - c.Assert(file2.WriteRange(bytes.NewReader(contentBytes), FileRange{End: fileSize - 1}, nil), chk.IsNil) - - ranges, err = file2.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(len(ranges.FileRanges), chk.Equals, 1) - c.Assert((ranges.FileRanges[0].End-ranges.FileRanges[0].Start)+1, chk.Equals, fileSize) - - // --- File after writing and clearing - file3 := root.GetFileReference("file3.txt") - c.Assert(file3.Create(fileSize, nil), chk.IsNil) - c.Assert(file3.WriteRange(bytes.NewReader(contentBytes), FileRange{End: fileSize - 1}, nil), chk.IsNil) - c.Assert(file3.ClearRange(FileRange{End: fileSize - 1}, nil), chk.IsNil) - - ranges, err = file3.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.IsNil) - - // --- File with ranges and subranges - file4 := root.GetFileReference("file4.txt") - c.Assert(file4.Create(fileSize, nil), chk.IsNil) - putRanges := []FileRange{ - {End: 511}, - {Start: 1024, End: 1535}, - {Start: 2048, End: 2559}, - {Start: 3072, End: 3583}, - } - - for _, r := range putRanges { - err = file4.WriteRange(bytes.NewReader(contentBytes[:512]), r, nil) - c.Assert(err, chk.IsNil) - } - - // validate all ranges - ranges, err = file4.ListRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.DeepEquals, putRanges) - - options := ListRangesOptions{ - ListRange: &FileRange{ - Start: 1000, - End: 3000, - }, - } - // validate sub-ranges - ranges, err = file4.ListRanges(&options) - c.Assert(err, chk.IsNil) - c.Assert(ranges.FileRanges, chk.DeepEquals, putRanges[1:3]) - - // --- clear partial range and validate - file5 := root.GetFileReference("file5.txt") - c.Assert(file5.Create(fileSize, nil), chk.IsNil) - c.Assert(file5.WriteRange(bytes.NewReader(contentBytes), FileRange{End: fileSize - 1}, nil), chk.IsNil) - c.Assert(file5.ClearRange(putRanges[0], nil), chk.IsNil) - c.Assert(file5.ClearRange(putRanges[2], nil), chk.IsNil) - - ranges, err = file5.ListRanges(nil) - c.Assert(err, chk.IsNil) - expectedtRanges := []FileRange{ - {Start: 512, End: 2047}, - {Start: 2560, End: 4095}, - } - c.Assert(ranges.FileRanges, chk.HasLen, 2) - c.Assert(ranges.FileRanges[0], chk.DeepEquals, expectedtRanges[0]) - c.Assert(ranges.FileRanges[1], chk.DeepEquals, expectedtRanges[1]) -} - -func (s *StorageFileSuite) TestFileProperties(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - fileSize := uint64(512) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize, nil), chk.IsNil) - - // get initial set of properties - c.Assert(file.Properties.Length, chk.Equals, fileSize) - c.Assert(file.Properties.Etag, chk.NotNil) - - // set some file properties - cc := "cachecontrol" - ct := "mytype" - enc := "noencoding" - lang := "neutral" - disp := "friendly" - file.Properties.CacheControl = cc - file.Properties.Type = ct - file.Properties.Disposition = disp - file.Properties.Encoding = enc - file.Properties.Language = lang - c.Assert(file.SetProperties(nil), chk.IsNil) - - // retrieve and verify - c.Assert(file.FetchAttributes(nil), chk.IsNil) - c.Assert(file.Properties.CacheControl, chk.Equals, cc) - c.Assert(file.Properties.Type, chk.Equals, ct) - c.Assert(file.Properties.Disposition, chk.Equals, disp) - c.Assert(file.Properties.Encoding, chk.Equals, enc) - c.Assert(file.Properties.Language, chk.Equals, lang) -} - -func (s *StorageFileSuite) TestFileMetadata(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - fileSize := uint64(512) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize, nil), chk.IsNil) - - // get metadata, shouldn't be any - c.Assert(file.Metadata, chk.HasLen, 0) - - // set some custom metadata - md := map[string]string{ - "something": "somethingvalue", - "another": "anothervalue", - } - file.Metadata = md - c.Assert(file.SetMetadata(nil), chk.IsNil) - - // retrieve and verify - c.Assert(file.FetchAttributes(nil), chk.IsNil) - c.Assert(file.Metadata, chk.DeepEquals, md) -} - -func (s *StorageFileSuite) TestFileMD5(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - // create file - const size = uint64(1024) - fileSize := uint64(size) - file := root.GetFileReference("test.dat") - c.Assert(file.Create(fileSize, nil), chk.IsNil) - - // fill file with some data and MD5 hash - byteStream, contentMD5 := newByteStream(size) - options := WriteRangeOptions{ - ContentMD5: contentMD5, - } - c.Assert(file.WriteRange(byteStream, FileRange{End: size - 1}, &options), chk.IsNil) - - // download file and verify - downloadOptions := GetFileOptions{ - GetContentMD5: true, - } - stream, err := file.DownloadRangeToStream(FileRange{Start: 0, End: size - 1}, &downloadOptions) - c.Assert(err, chk.IsNil) - defer stream.Body.Close() - c.Assert(stream.ContentMD5, chk.Equals, contentMD5) -} - -// returns a byte stream along with a base-64 encoded MD5 hash of its contents -func newByteStream(count uint64) (io.Reader, string) { - b := make([]uint8, count) - for i := uint64(0); i < count; i++ { - b[i] = 0xff - } - - // create an MD5 hash of the array - hash := md5.Sum(b) - - return bytes.NewReader(b), base64.StdEncoding.EncodeToString(hash[:]) -} - -func (s *StorageFileSuite) TestCopyFileSameAccountNoMetaData(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - // create directory structure - dir1 := root.GetDirectoryReference("one") - c.Assert(dir1.Create(nil), chk.IsNil) - dir2 := dir1.GetDirectoryReference("two") - c.Assert(dir2.Create(nil), chk.IsNil) - - // create file - file := dir2.GetFileReference("some.file") - c.Assert(file.Create(1024, nil), chk.IsNil) - exists, err := file.Exists() - c.Assert(err, chk.IsNil) - c.Assert(exists, chk.Equals, true) - - otherFile := dir2.GetFileReference("someother.file") - - // copy the file, no timeout parameter - err = otherFile.CopyFile(file.URL(), nil) - c.Assert(err, chk.IsNil) - - // delete files - c.Assert(file.Delete(nil), chk.IsNil) - c.Assert(otherFile.Delete(nil), chk.IsNil) -} - -func (s *StorageFileSuite) TestCopyFileSameAccountTimeout(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - // create directory structure - dir1 := root.GetDirectoryReference("one") - c.Assert(dir1.Create(nil), chk.IsNil) - dir2 := dir1.GetDirectoryReference("two") - c.Assert(dir2.Create(nil), chk.IsNil) - - // create file - file := dir2.GetFileReference("some.file") - c.Assert(file.Create(1024, nil), chk.IsNil) - - // copy the file, 60 second timeout. - otherFile := dir2.GetFileReference("someother.file") - options := FileRequestOptions{} - options.Timeout = 60 - c.Assert(otherFile.CopyFile(file.URL(), &options), chk.IsNil) - - // delete files - c.Assert(file.Delete(nil), chk.IsNil) - c.Assert(otherFile.Delete(nil), chk.IsNil) -} - -func (s *StorageFileSuite) TestCopyFileMissingFile(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // create share - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - root := share.GetRootDirectoryReference() - - // create directory structure - dir1 := root.GetDirectoryReference("one") - c.Assert(dir1.Create(nil), chk.IsNil) - - otherFile := dir1.GetFileReference("someother.file") - - // copy the file, no timeout parameter - err := otherFile.CopyFile("", nil) - c.Assert(err, chk.NotNil) -} +package storage + +import ( + "bytes" + "crypto/md5" + "encoding/base64" + "io" + + chk "gopkg.in/check.v1" +) + +type StorageFileSuite struct{} + +var _ = chk.Suite(&StorageFileSuite{}) + +func (s *StorageFileSuite) TestCreateFile(c *chk.C) { + cli := getFileClient(c) + cli.deleteAllShares() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + // create directory structure + dir1 := root.GetDirectoryReference("one") + c.Assert(dir1.Create(nil), chk.IsNil) + dir2 := dir1.GetDirectoryReference("two") + c.Assert(dir2.Create(nil), chk.IsNil) + + // verify file doesn't exist + file := dir2.GetFileReference("some.file") + exists, err := file.Exists() + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, false) + + // create file + c.Assert(file.Create(1024, nil), chk.IsNil) + + // delete file and verify + c.Assert(file.Delete(nil), chk.IsNil) + exists, err = file.Exists() + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, false) +} + +func (s *StorageFileSuite) TestGetFile(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + // create file + const size = uint64(1024) + byteStream, _ := newByteStream(size) + file := root.GetFileReference("some.file") + c.Assert(file.Create(size, nil), chk.IsNil) + + // fill file with some data + c.Assert(file.WriteRange(byteStream, FileRange{End: size - 1}, nil), chk.IsNil) + + // set some metadata + md := map[string]string{ + "something": "somethingvalue", + "another": "anothervalue", + } + file.Metadata = md + c.Assert(file.SetMetadata(nil), chk.IsNil) + + options := GetFileOptions{ + GetContentMD5: false, + } + // retrieve full file content and verify + stream, err := file.DownloadRangeToStream(FileRange{Start: 0, End: size - 1}, &options) + c.Assert(err, chk.IsNil) + defer stream.Body.Close() + var b1 [size]byte + count, _ := stream.Body.Read(b1[:]) + c.Assert(count, chk.Equals, int(size)) + var c1 [size]byte + bs, _ := newByteStream(size) + bs.Read(c1[:]) + c.Assert(b1, chk.DeepEquals, c1) + + // retrieve partial file content and verify + stream, err = file.DownloadRangeToStream(FileRange{Start: size / 2, End: size - 1}, &options) + c.Assert(err, chk.IsNil) + defer stream.Body.Close() + var b2 [size / 2]byte + count, _ = stream.Body.Read(b2[:]) + c.Assert(count, chk.Equals, int(size)/2) + var c2 [size / 2]byte + bs, _ = newByteStream(size / 2) + bs.Read(c2[:]) + c.Assert(b2, chk.DeepEquals, c2) +} + +func (s *StorageFileSuite) TestFileRanges(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + fileSize := uint64(4096) + contentBytes := content(int(fileSize)) + + // --- File with no valid ranges + file1 := root.GetFileReference("file1.txt") + c.Assert(file1.Create(fileSize, nil), chk.IsNil) + + ranges, err := file1.ListRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(ranges.ContentLength, chk.Equals, fileSize) + c.Assert(ranges.FileRanges, chk.IsNil) + + // --- File after writing a range + file2 := root.GetFileReference("file2.txt") + c.Assert(file2.Create(fileSize, nil), chk.IsNil) + c.Assert(file2.WriteRange(bytes.NewReader(contentBytes), FileRange{End: fileSize - 1}, nil), chk.IsNil) + + ranges, err = file2.ListRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(len(ranges.FileRanges), chk.Equals, 1) + c.Assert((ranges.FileRanges[0].End-ranges.FileRanges[0].Start)+1, chk.Equals, fileSize) + + // --- File after writing and clearing + file3 := root.GetFileReference("file3.txt") + c.Assert(file3.Create(fileSize, nil), chk.IsNil) + c.Assert(file3.WriteRange(bytes.NewReader(contentBytes), FileRange{End: fileSize - 1}, nil), chk.IsNil) + c.Assert(file3.ClearRange(FileRange{End: fileSize - 1}, nil), chk.IsNil) + + ranges, err = file3.ListRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(ranges.FileRanges, chk.IsNil) + + // --- File with ranges and subranges + file4 := root.GetFileReference("file4.txt") + c.Assert(file4.Create(fileSize, nil), chk.IsNil) + putRanges := []FileRange{ + {End: 511}, + {Start: 1024, End: 1535}, + {Start: 2048, End: 2559}, + {Start: 3072, End: 3583}, + } + + for _, r := range putRanges { + err = file4.WriteRange(bytes.NewReader(contentBytes[:512]), r, nil) + c.Assert(err, chk.IsNil) + } + + // validate all ranges + ranges, err = file4.ListRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(ranges.FileRanges, chk.DeepEquals, putRanges) + + options := ListRangesOptions{ + ListRange: &FileRange{ + Start: 1000, + End: 3000, + }, + } + // validate sub-ranges + ranges, err = file4.ListRanges(&options) + c.Assert(err, chk.IsNil) + c.Assert(ranges.FileRanges, chk.DeepEquals, putRanges[1:3]) + + // --- clear partial range and validate + file5 := root.GetFileReference("file5.txt") + c.Assert(file5.Create(fileSize, nil), chk.IsNil) + c.Assert(file5.WriteRange(bytes.NewReader(contentBytes), FileRange{End: fileSize - 1}, nil), chk.IsNil) + c.Assert(file5.ClearRange(putRanges[0], nil), chk.IsNil) + c.Assert(file5.ClearRange(putRanges[2], nil), chk.IsNil) + + ranges, err = file5.ListRanges(nil) + c.Assert(err, chk.IsNil) + expectedtRanges := []FileRange{ + {Start: 512, End: 2047}, + {Start: 2560, End: 4095}, + } + c.Assert(ranges.FileRanges, chk.HasLen, 2) + c.Assert(ranges.FileRanges[0], chk.DeepEquals, expectedtRanges[0]) + c.Assert(ranges.FileRanges[1], chk.DeepEquals, expectedtRanges[1]) +} + +func (s *StorageFileSuite) TestFileProperties(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + fileSize := uint64(512) + file := root.GetFileReference("test.dat") + c.Assert(file.Create(fileSize, nil), chk.IsNil) + + // get initial set of properties + c.Assert(file.Properties.Length, chk.Equals, fileSize) + c.Assert(file.Properties.Etag, chk.NotNil) + + // set some file properties + cc := "cachecontrol" + ct := "mytype" + enc := "noencoding" + lang := "neutral" + disp := "friendly" + file.Properties.CacheControl = cc + file.Properties.Type = ct + file.Properties.Disposition = disp + file.Properties.Encoding = enc + file.Properties.Language = lang + c.Assert(file.SetProperties(nil), chk.IsNil) + + // retrieve and verify + c.Assert(file.FetchAttributes(nil), chk.IsNil) + c.Assert(file.Properties.CacheControl, chk.Equals, cc) + c.Assert(file.Properties.Type, chk.Equals, ct) + c.Assert(file.Properties.Disposition, chk.Equals, disp) + c.Assert(file.Properties.Encoding, chk.Equals, enc) + c.Assert(file.Properties.Language, chk.Equals, lang) +} + +func (s *StorageFileSuite) TestFileMetadata(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + fileSize := uint64(512) + file := root.GetFileReference("test.dat") + c.Assert(file.Create(fileSize, nil), chk.IsNil) + + // get metadata, shouldn't be any + c.Assert(file.Metadata, chk.HasLen, 0) + + // set some custom metadata + md := map[string]string{ + "something": "somethingvalue", + "another": "anothervalue", + } + file.Metadata = md + c.Assert(file.SetMetadata(nil), chk.IsNil) + + // retrieve and verify + c.Assert(file.FetchAttributes(nil), chk.IsNil) + c.Assert(file.Metadata, chk.DeepEquals, md) +} + +func (s *StorageFileSuite) TestFileMD5(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + // create file + const size = uint64(1024) + fileSize := uint64(size) + file := root.GetFileReference("test.dat") + c.Assert(file.Create(fileSize, nil), chk.IsNil) + + // fill file with some data and MD5 hash + byteStream, contentMD5 := newByteStream(size) + options := WriteRangeOptions{ + ContentMD5: contentMD5, + } + c.Assert(file.WriteRange(byteStream, FileRange{End: size - 1}, &options), chk.IsNil) + + // download file and verify + downloadOptions := GetFileOptions{ + GetContentMD5: true, + } + stream, err := file.DownloadRangeToStream(FileRange{Start: 0, End: size - 1}, &downloadOptions) + c.Assert(err, chk.IsNil) + defer stream.Body.Close() + c.Assert(stream.ContentMD5, chk.Equals, contentMD5) +} + +// returns a byte stream along with a base-64 encoded MD5 hash of its contents +func newByteStream(count uint64) (io.Reader, string) { + b := make([]uint8, count) + for i := uint64(0); i < count; i++ { + b[i] = 0xff + } + + // create an MD5 hash of the array + hash := md5.Sum(b) + + return bytes.NewReader(b), base64.StdEncoding.EncodeToString(hash[:]) +} + +func (s *StorageFileSuite) TestCopyFileSameAccountNoMetaData(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + // create directory structure + dir1 := root.GetDirectoryReference("one") + c.Assert(dir1.Create(nil), chk.IsNil) + dir2 := dir1.GetDirectoryReference("two") + c.Assert(dir2.Create(nil), chk.IsNil) + + // create file + file := dir2.GetFileReference("some.file") + c.Assert(file.Create(1024, nil), chk.IsNil) + exists, err := file.Exists() + c.Assert(err, chk.IsNil) + c.Assert(exists, chk.Equals, true) + + otherFile := dir2.GetFileReference("someother.file") + + // copy the file, no timeout parameter + err = otherFile.CopyFile(file.URL(), nil) + c.Assert(err, chk.IsNil) + + // delete files + c.Assert(file.Delete(nil), chk.IsNil) + c.Assert(otherFile.Delete(nil), chk.IsNil) +} + +func (s *StorageFileSuite) TestCopyFileSameAccountTimeout(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + // create directory structure + dir1 := root.GetDirectoryReference("one") + c.Assert(dir1.Create(nil), chk.IsNil) + dir2 := dir1.GetDirectoryReference("two") + c.Assert(dir2.Create(nil), chk.IsNil) + + // create file + file := dir2.GetFileReference("some.file") + c.Assert(file.Create(1024, nil), chk.IsNil) + + // copy the file, 60 second timeout. + otherFile := dir2.GetFileReference("someother.file") + options := FileRequestOptions{} + options.Timeout = 60 + c.Assert(otherFile.CopyFile(file.URL(), &options), chk.IsNil) + + // delete files + c.Assert(file.Delete(nil), chk.IsNil) + c.Assert(otherFile.Delete(nil), chk.IsNil) +} + +func (s *StorageFileSuite) TestCopyFileMissingFile(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // create share + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + root := share.GetRootDirectoryReference() + + // create directory structure + dir1 := root.GetDirectoryReference("one") + c.Assert(dir1.Create(nil), chk.IsNil) + + otherFile := dir1.GetFileReference("someother.file") + + // copy the file, no timeout parameter + err := otherFile.CopyFile("", nil) + c.Assert(err, chk.NotNil) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go index d0ba79dd0e..81217bdfa8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go @@ -1,324 +1,324 @@ -package storage - -import ( - "encoding/xml" - "fmt" - "net/http" - "net/url" - "strconv" -) - -// FileServiceClient contains operations for Microsoft Azure File Service. -type FileServiceClient struct { - client Client - auth authentication -} - -// ListSharesParameters defines the set of customizable parameters to make a -// List Shares call. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares -type ListSharesParameters struct { - Prefix string - Marker string - Include string - MaxResults uint - Timeout uint -} - -// ShareListResponse contains the response fields from -// ListShares call. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares -type ShareListResponse struct { - XMLName xml.Name `xml:"EnumerationResults"` - Xmlns string `xml:"xmlns,attr"` - Prefix string `xml:"Prefix"` - Marker string `xml:"Marker"` - NextMarker string `xml:"NextMarker"` - MaxResults int64 `xml:"MaxResults"` - Shares []Share `xml:"Shares>Share"` -} - -type compType string - -const ( - compNone compType = "" - compList compType = "list" - compMetadata compType = "metadata" - compProperties compType = "properties" - compRangeList compType = "rangelist" -) - -func (ct compType) String() string { - return string(ct) -} - -type resourceType string - -const ( - resourceDirectory resourceType = "directory" - resourceFile resourceType = "" - resourceShare resourceType = "share" -) - -func (rt resourceType) String() string { - return string(rt) -} - -func (p ListSharesParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.Include != "" { - out.Set("include", p.Include) - } - if p.MaxResults != 0 { - out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) - } - if p.Timeout != 0 { - out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10)) - } - - return out -} - -func (p ListDirsAndFilesParameters) getParameters() url.Values { - out := url.Values{} - - if p.Prefix != "" { - out.Set("prefix", p.Prefix) - } - if p.Marker != "" { - out.Set("marker", p.Marker) - } - if p.MaxResults != 0 { - out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) - } - out = addTimeout(out, p.Timeout) - - return out -} - -// returns url.Values for the specified types -func getURLInitValues(comp compType, res resourceType) url.Values { - values := url.Values{} - if comp != compNone { - values.Set("comp", comp.String()) - } - if res != resourceFile { - values.Set("restype", res.String()) - } - return values -} - -// GetShareReference returns a Share object for the specified share name. -func (f *FileServiceClient) GetShareReference(name string) *Share { - return &Share{ - fsc: f, - Name: name, - Properties: ShareProperties{ - Quota: -1, - }, - } -} - -// ListShares returns the list of shares in a storage account along with -// pagination token and other response details. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/list-shares -func (f FileServiceClient) ListShares(params ListSharesParameters) (*ShareListResponse, error) { - q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}}) - - var out ShareListResponse - resp, err := f.listContent("", q, nil) - if err != nil { - return nil, err - } - defer resp.body.Close() - err = xmlUnmarshal(resp.body, &out) - - // assign our client to the newly created Share objects - for i := range out.Shares { - out.Shares[i].fsc = &f - } - return &out, err -} - -// GetServiceProperties gets the properties of your storage account's file service. -// File service does not support logging -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-service-properties -func (f *FileServiceClient) GetServiceProperties() (*ServiceProperties, error) { - return f.client.getServiceProperties(fileServiceName, f.auth) -} - -// SetServiceProperties sets the properties of your storage account's file service. -// File service does not support logging -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-file-service-properties -func (f *FileServiceClient) SetServiceProperties(props ServiceProperties) error { - return f.client.setServiceProperties(props, fileServiceName, f.auth) -} - -// retrieves directory or share content -func (f FileServiceClient) listContent(path string, params url.Values, extraHeaders map[string]string) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - uri := f.client.getEndpoint(fileServiceName, path, params) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - resp, err := f.client.exec(http.MethodGet, uri, headers, nil, f.auth) - if err != nil { - return nil, err - } - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - readAndCloseBody(resp.body) - return nil, err - } - - return resp, nil -} - -// returns true if the specified resource exists -func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, http.Header, error) { - if err := f.checkForStorageEmulator(); err != nil { - return false, nil, err - } - - uri := f.client.getEndpoint(fileServiceName, path, getURLInitValues(compNone, res)) - headers := f.client.getStandardHeaders() - - resp, err := f.client.exec(http.MethodHead, uri, headers, nil, f.auth) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, resp.headers, nil - } - } - return false, nil, err -} - -// creates a resource depending on the specified resource type -func (f FileServiceClient) createResource(path string, res resourceType, urlParams url.Values, extraHeaders map[string]string, expectedResponseCodes []int) (http.Header, error) { - resp, err := f.createResourceNoClose(path, res, urlParams, extraHeaders) - if err != nil { - return nil, err - } - defer readAndCloseBody(resp.body) - return resp.headers, checkRespCode(resp.statusCode, expectedResponseCodes) -} - -// creates a resource depending on the specified resource type, doesn't close the response body -func (f FileServiceClient) createResourceNoClose(path string, res resourceType, urlParams url.Values, extraHeaders map[string]string) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - values := getURLInitValues(compNone, res) - combinedParams := mergeParams(values, urlParams) - uri := f.client.getEndpoint(fileServiceName, path, combinedParams) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - return f.client.exec(http.MethodPut, uri, headers, nil, f.auth) -} - -// returns HTTP header data for the specified directory or share -func (f FileServiceClient) getResourceHeaders(path string, comp compType, res resourceType, params url.Values, verb string) (http.Header, error) { - resp, err := f.getResourceNoClose(path, comp, res, params, verb, nil) - if err != nil { - return nil, err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - return resp.headers, nil -} - -// gets the specified resource, doesn't close the response body -func (f FileServiceClient) getResourceNoClose(path string, comp compType, res resourceType, params url.Values, verb string, extraHeaders map[string]string) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - params = mergeParams(params, getURLInitValues(comp, res)) - uri := f.client.getEndpoint(fileServiceName, path, params) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - return f.client.exec(verb, uri, headers, nil, f.auth) -} - -// deletes the resource and returns the response -func (f FileServiceClient) deleteResource(path string, res resourceType, options *FileRequestOptions) error { - resp, err := f.deleteResourceNoClose(path, res, options) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} - -// deletes the resource and returns the response, doesn't close the response body -func (f FileServiceClient) deleteResourceNoClose(path string, res resourceType, options *FileRequestOptions) (*storageResponse, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - values := mergeParams(getURLInitValues(compNone, res), prepareOptions(options)) - uri := f.client.getEndpoint(fileServiceName, path, values) - return f.client.exec(http.MethodDelete, uri, f.client.getStandardHeaders(), nil, f.auth) -} - -// merges metadata into extraHeaders and returns extraHeaders -func mergeMDIntoExtraHeaders(metadata, extraHeaders map[string]string) map[string]string { - if metadata == nil && extraHeaders == nil { - return nil - } - if extraHeaders == nil { - extraHeaders = make(map[string]string) - } - for k, v := range metadata { - extraHeaders[userDefinedMetadataHeaderPrefix+k] = v - } - return extraHeaders -} - -// sets extra header data for the specified resource -func (f FileServiceClient) setResourceHeaders(path string, comp compType, res resourceType, extraHeaders map[string]string, options *FileRequestOptions) (http.Header, error) { - if err := f.checkForStorageEmulator(); err != nil { - return nil, err - } - - params := mergeParams(getURLInitValues(comp, res), prepareOptions(options)) - uri := f.client.getEndpoint(fileServiceName, path, params) - extraHeaders = f.client.protectUserAgent(extraHeaders) - headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) - - resp, err := f.client.exec(http.MethodPut, uri, headers, nil, f.auth) - if err != nil { - return nil, err - } - defer readAndCloseBody(resp.body) - - return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusOK}) -} - -//checkForStorageEmulator determines if the client is setup for use with -//Azure Storage Emulator, and returns a relevant error -func (f FileServiceClient) checkForStorageEmulator() error { - if f.client.accountName == StorageEmulatorAccountName { - return fmt.Errorf("Error: File service is not currently supported by Azure Storage Emulator") - } - return nil -} +package storage + +import ( + "encoding/xml" + "fmt" + "net/http" + "net/url" + "strconv" +) + +// FileServiceClient contains operations for Microsoft Azure File Service. +type FileServiceClient struct { + client Client + auth authentication +} + +// ListSharesParameters defines the set of customizable parameters to make a +// List Shares call. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares +type ListSharesParameters struct { + Prefix string + Marker string + Include string + MaxResults uint + Timeout uint +} + +// ShareListResponse contains the response fields from +// ListShares call. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares +type ShareListResponse struct { + XMLName xml.Name `xml:"EnumerationResults"` + Xmlns string `xml:"xmlns,attr"` + Prefix string `xml:"Prefix"` + Marker string `xml:"Marker"` + NextMarker string `xml:"NextMarker"` + MaxResults int64 `xml:"MaxResults"` + Shares []Share `xml:"Shares>Share"` +} + +type compType string + +const ( + compNone compType = "" + compList compType = "list" + compMetadata compType = "metadata" + compProperties compType = "properties" + compRangeList compType = "rangelist" +) + +func (ct compType) String() string { + return string(ct) +} + +type resourceType string + +const ( + resourceDirectory resourceType = "directory" + resourceFile resourceType = "" + resourceShare resourceType = "share" +) + +func (rt resourceType) String() string { + return string(rt) +} + +func (p ListSharesParameters) getParameters() url.Values { + out := url.Values{} + + if p.Prefix != "" { + out.Set("prefix", p.Prefix) + } + if p.Marker != "" { + out.Set("marker", p.Marker) + } + if p.Include != "" { + out.Set("include", p.Include) + } + if p.MaxResults != 0 { + out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) + } + if p.Timeout != 0 { + out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10)) + } + + return out +} + +func (p ListDirsAndFilesParameters) getParameters() url.Values { + out := url.Values{} + + if p.Prefix != "" { + out.Set("prefix", p.Prefix) + } + if p.Marker != "" { + out.Set("marker", p.Marker) + } + if p.MaxResults != 0 { + out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10)) + } + out = addTimeout(out, p.Timeout) + + return out +} + +// returns url.Values for the specified types +func getURLInitValues(comp compType, res resourceType) url.Values { + values := url.Values{} + if comp != compNone { + values.Set("comp", comp.String()) + } + if res != resourceFile { + values.Set("restype", res.String()) + } + return values +} + +// GetShareReference returns a Share object for the specified share name. +func (f *FileServiceClient) GetShareReference(name string) *Share { + return &Share{ + fsc: f, + Name: name, + Properties: ShareProperties{ + Quota: -1, + }, + } +} + +// ListShares returns the list of shares in a storage account along with +// pagination token and other response details. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/list-shares +func (f FileServiceClient) ListShares(params ListSharesParameters) (*ShareListResponse, error) { + q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}}) + + var out ShareListResponse + resp, err := f.listContent("", q, nil) + if err != nil { + return nil, err + } + defer resp.body.Close() + err = xmlUnmarshal(resp.body, &out) + + // assign our client to the newly created Share objects + for i := range out.Shares { + out.Shares[i].fsc = &f + } + return &out, err +} + +// GetServiceProperties gets the properties of your storage account's file service. +// File service does not support logging +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-service-properties +func (f *FileServiceClient) GetServiceProperties() (*ServiceProperties, error) { + return f.client.getServiceProperties(fileServiceName, f.auth) +} + +// SetServiceProperties sets the properties of your storage account's file service. +// File service does not support logging +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-file-service-properties +func (f *FileServiceClient) SetServiceProperties(props ServiceProperties) error { + return f.client.setServiceProperties(props, fileServiceName, f.auth) +} + +// retrieves directory or share content +func (f FileServiceClient) listContent(path string, params url.Values, extraHeaders map[string]string) (*storageResponse, error) { + if err := f.checkForStorageEmulator(); err != nil { + return nil, err + } + + uri := f.client.getEndpoint(fileServiceName, path, params) + extraHeaders = f.client.protectUserAgent(extraHeaders) + headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) + + resp, err := f.client.exec(http.MethodGet, uri, headers, nil, f.auth) + if err != nil { + return nil, err + } + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + readAndCloseBody(resp.body) + return nil, err + } + + return resp, nil +} + +// returns true if the specified resource exists +func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, http.Header, error) { + if err := f.checkForStorageEmulator(); err != nil { + return false, nil, err + } + + uri := f.client.getEndpoint(fileServiceName, path, getURLInitValues(compNone, res)) + headers := f.client.getStandardHeaders() + + resp, err := f.client.exec(http.MethodHead, uri, headers, nil, f.auth) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusOK, resp.headers, nil + } + } + return false, nil, err +} + +// creates a resource depending on the specified resource type +func (f FileServiceClient) createResource(path string, res resourceType, urlParams url.Values, extraHeaders map[string]string, expectedResponseCodes []int) (http.Header, error) { + resp, err := f.createResourceNoClose(path, res, urlParams, extraHeaders) + if err != nil { + return nil, err + } + defer readAndCloseBody(resp.body) + return resp.headers, checkRespCode(resp.statusCode, expectedResponseCodes) +} + +// creates a resource depending on the specified resource type, doesn't close the response body +func (f FileServiceClient) createResourceNoClose(path string, res resourceType, urlParams url.Values, extraHeaders map[string]string) (*storageResponse, error) { + if err := f.checkForStorageEmulator(); err != nil { + return nil, err + } + + values := getURLInitValues(compNone, res) + combinedParams := mergeParams(values, urlParams) + uri := f.client.getEndpoint(fileServiceName, path, combinedParams) + extraHeaders = f.client.protectUserAgent(extraHeaders) + headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) + + return f.client.exec(http.MethodPut, uri, headers, nil, f.auth) +} + +// returns HTTP header data for the specified directory or share +func (f FileServiceClient) getResourceHeaders(path string, comp compType, res resourceType, params url.Values, verb string) (http.Header, error) { + resp, err := f.getResourceNoClose(path, comp, res, params, verb, nil) + if err != nil { + return nil, err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return nil, err + } + + return resp.headers, nil +} + +// gets the specified resource, doesn't close the response body +func (f FileServiceClient) getResourceNoClose(path string, comp compType, res resourceType, params url.Values, verb string, extraHeaders map[string]string) (*storageResponse, error) { + if err := f.checkForStorageEmulator(); err != nil { + return nil, err + } + + params = mergeParams(params, getURLInitValues(comp, res)) + uri := f.client.getEndpoint(fileServiceName, path, params) + headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) + + return f.client.exec(verb, uri, headers, nil, f.auth) +} + +// deletes the resource and returns the response +func (f FileServiceClient) deleteResource(path string, res resourceType, options *FileRequestOptions) error { + resp, err := f.deleteResourceNoClose(path, res, options) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) +} + +// deletes the resource and returns the response, doesn't close the response body +func (f FileServiceClient) deleteResourceNoClose(path string, res resourceType, options *FileRequestOptions) (*storageResponse, error) { + if err := f.checkForStorageEmulator(); err != nil { + return nil, err + } + + values := mergeParams(getURLInitValues(compNone, res), prepareOptions(options)) + uri := f.client.getEndpoint(fileServiceName, path, values) + return f.client.exec(http.MethodDelete, uri, f.client.getStandardHeaders(), nil, f.auth) +} + +// merges metadata into extraHeaders and returns extraHeaders +func mergeMDIntoExtraHeaders(metadata, extraHeaders map[string]string) map[string]string { + if metadata == nil && extraHeaders == nil { + return nil + } + if extraHeaders == nil { + extraHeaders = make(map[string]string) + } + for k, v := range metadata { + extraHeaders[userDefinedMetadataHeaderPrefix+k] = v + } + return extraHeaders +} + +// sets extra header data for the specified resource +func (f FileServiceClient) setResourceHeaders(path string, comp compType, res resourceType, extraHeaders map[string]string, options *FileRequestOptions) (http.Header, error) { + if err := f.checkForStorageEmulator(); err != nil { + return nil, err + } + + params := mergeParams(getURLInitValues(comp, res), prepareOptions(options)) + uri := f.client.getEndpoint(fileServiceName, path, params) + extraHeaders = f.client.protectUserAgent(extraHeaders) + headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders) + + resp, err := f.client.exec(http.MethodPut, uri, headers, nil, f.auth) + if err != nil { + return nil, err + } + defer readAndCloseBody(resp.body) + + return resp.headers, checkRespCode(resp.statusCode, []int{http.StatusOK}) +} + +//checkForStorageEmulator determines if the client is setup for use with +//Azure Storage Emulator, and returns a relevant error +func (f FileServiceClient) checkForStorageEmulator() error { + if f.client.accountName == StorageEmulatorAccountName { + return fmt.Errorf("Error: File service is not currently supported by Azure Storage Emulator") + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go index 2d5db97a20..415b740183 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go @@ -1,187 +1,187 @@ -package storage - -import ( - "errors" - "net/http" - "net/url" - "strconv" - "time" -) - -// lease constants. -const ( - leaseHeaderPrefix = "x-ms-lease-" - headerLeaseID = "x-ms-lease-id" - leaseAction = "x-ms-lease-action" - leaseBreakPeriod = "x-ms-lease-break-period" - leaseDuration = "x-ms-lease-duration" - leaseProposedID = "x-ms-proposed-lease-id" - leaseTime = "x-ms-lease-time" - - acquireLease = "acquire" - renewLease = "renew" - changeLease = "change" - releaseLease = "release" - breakLease = "break" -) - -// leasePut is common PUT code for the various acquire/release/break etc functions. -func (b *Blob) leaseCommonPut(headers map[string]string, expectedStatus int, options *LeaseOptions) (http.Header, error) { - params := url.Values{"comp": {"lease"}} - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return nil, err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{expectedStatus}); err != nil { - return nil, err - } - - return resp.headers, nil -} - -// LeaseOptions includes options for all operations regarding leasing blobs -type LeaseOptions struct { - Timeout uint - Origin string `header:"Origin"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - RequestID string `header:"x-ms-client-request-id"` -} - -// AcquireLease creates a lease for a blob -// returns leaseID acquired -// In API Versions starting on 2012-02-12, the minimum leaseTimeInSeconds is 15, the maximum -// non-infinite leaseTimeInSeconds is 60. To specify an infinite lease, provide the value -1. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob -func (b *Blob) AcquireLease(leaseTimeInSeconds int, proposedLeaseID string, options *LeaseOptions) (returnedLeaseID string, err error) { - headers := b.Container.bsc.client.getStandardHeaders() - headers[leaseAction] = acquireLease - - if leaseTimeInSeconds == -1 { - // Do nothing, but don't trigger the following clauses. - } else if leaseTimeInSeconds > 60 || b.Container.bsc.client.apiVersion < "2012-02-12" { - leaseTimeInSeconds = 60 - } else if leaseTimeInSeconds < 15 { - leaseTimeInSeconds = 15 - } - - headers[leaseDuration] = strconv.Itoa(leaseTimeInSeconds) - - if proposedLeaseID != "" { - headers[leaseProposedID] = proposedLeaseID - } - - respHeaders, err := b.leaseCommonPut(headers, http.StatusCreated, options) - if err != nil { - return "", err - } - - returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID)) - - if returnedLeaseID != "" { - return returnedLeaseID, nil - } - - return "", errors.New("LeaseID not returned") -} - -// BreakLease breaks the lease for a blob -// Returns the timeout remaining in the lease in seconds -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob -func (b *Blob) BreakLease(options *LeaseOptions) (breakTimeout int, err error) { - headers := b.Container.bsc.client.getStandardHeaders() - headers[leaseAction] = breakLease - return b.breakLeaseCommon(headers, options) -} - -// BreakLeaseWithBreakPeriod breaks the lease for a blob -// breakPeriodInSeconds is used to determine how long until new lease can be created. -// Returns the timeout remaining in the lease in seconds -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob -func (b *Blob) BreakLeaseWithBreakPeriod(breakPeriodInSeconds int, options *LeaseOptions) (breakTimeout int, err error) { - headers := b.Container.bsc.client.getStandardHeaders() - headers[leaseAction] = breakLease - headers[leaseBreakPeriod] = strconv.Itoa(breakPeriodInSeconds) - return b.breakLeaseCommon(headers, options) -} - -// breakLeaseCommon is common code for both version of BreakLease (with and without break period) -func (b *Blob) breakLeaseCommon(headers map[string]string, options *LeaseOptions) (breakTimeout int, err error) { - - respHeaders, err := b.leaseCommonPut(headers, http.StatusAccepted, options) - if err != nil { - return 0, err - } - - breakTimeoutStr := respHeaders.Get(http.CanonicalHeaderKey(leaseTime)) - if breakTimeoutStr != "" { - breakTimeout, err = strconv.Atoi(breakTimeoutStr) - if err != nil { - return 0, err - } - } - - return breakTimeout, nil -} - -// ChangeLease changes a lease ID for a blob -// Returns the new LeaseID acquired -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob -func (b *Blob) ChangeLease(currentLeaseID string, proposedLeaseID string, options *LeaseOptions) (newLeaseID string, err error) { - headers := b.Container.bsc.client.getStandardHeaders() - headers[leaseAction] = changeLease - headers[headerLeaseID] = currentLeaseID - headers[leaseProposedID] = proposedLeaseID - - respHeaders, err := b.leaseCommonPut(headers, http.StatusOK, options) - if err != nil { - return "", err - } - - newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID)) - if newLeaseID != "" { - return newLeaseID, nil - } - - return "", errors.New("LeaseID not returned") -} - -// ReleaseLease releases the lease for a blob -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob -func (b *Blob) ReleaseLease(currentLeaseID string, options *LeaseOptions) error { - headers := b.Container.bsc.client.getStandardHeaders() - headers[leaseAction] = releaseLease - headers[headerLeaseID] = currentLeaseID - - _, err := b.leaseCommonPut(headers, http.StatusOK, options) - if err != nil { - return err - } - - return nil -} - -// RenewLease renews the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx -func (b *Blob) RenewLease(currentLeaseID string, options *LeaseOptions) error { - headers := b.Container.bsc.client.getStandardHeaders() - headers[leaseAction] = renewLease - headers[headerLeaseID] = currentLeaseID - - _, err := b.leaseCommonPut(headers, http.StatusOK, options) - if err != nil { - return err - } - - return nil -} +package storage + +import ( + "errors" + "net/http" + "net/url" + "strconv" + "time" +) + +// lease constants. +const ( + leaseHeaderPrefix = "x-ms-lease-" + headerLeaseID = "x-ms-lease-id" + leaseAction = "x-ms-lease-action" + leaseBreakPeriod = "x-ms-lease-break-period" + leaseDuration = "x-ms-lease-duration" + leaseProposedID = "x-ms-proposed-lease-id" + leaseTime = "x-ms-lease-time" + + acquireLease = "acquire" + renewLease = "renew" + changeLease = "change" + releaseLease = "release" + breakLease = "break" +) + +// leasePut is common PUT code for the various acquire/release/break etc functions. +func (b *Blob) leaseCommonPut(headers map[string]string, expectedStatus int, options *LeaseOptions) (http.Header, error) { + params := url.Values{"comp": {"lease"}} + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return nil, err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{expectedStatus}); err != nil { + return nil, err + } + + return resp.headers, nil +} + +// LeaseOptions includes options for all operations regarding leasing blobs +type LeaseOptions struct { + Timeout uint + Origin string `header:"Origin"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + RequestID string `header:"x-ms-client-request-id"` +} + +// AcquireLease creates a lease for a blob +// returns leaseID acquired +// In API Versions starting on 2012-02-12, the minimum leaseTimeInSeconds is 15, the maximum +// non-infinite leaseTimeInSeconds is 60. To specify an infinite lease, provide the value -1. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob +func (b *Blob) AcquireLease(leaseTimeInSeconds int, proposedLeaseID string, options *LeaseOptions) (returnedLeaseID string, err error) { + headers := b.Container.bsc.client.getStandardHeaders() + headers[leaseAction] = acquireLease + + if leaseTimeInSeconds == -1 { + // Do nothing, but don't trigger the following clauses. + } else if leaseTimeInSeconds > 60 || b.Container.bsc.client.apiVersion < "2012-02-12" { + leaseTimeInSeconds = 60 + } else if leaseTimeInSeconds < 15 { + leaseTimeInSeconds = 15 + } + + headers[leaseDuration] = strconv.Itoa(leaseTimeInSeconds) + + if proposedLeaseID != "" { + headers[leaseProposedID] = proposedLeaseID + } + + respHeaders, err := b.leaseCommonPut(headers, http.StatusCreated, options) + if err != nil { + return "", err + } + + returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID)) + + if returnedLeaseID != "" { + return returnedLeaseID, nil + } + + return "", errors.New("LeaseID not returned") +} + +// BreakLease breaks the lease for a blob +// Returns the timeout remaining in the lease in seconds +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob +func (b *Blob) BreakLease(options *LeaseOptions) (breakTimeout int, err error) { + headers := b.Container.bsc.client.getStandardHeaders() + headers[leaseAction] = breakLease + return b.breakLeaseCommon(headers, options) +} + +// BreakLeaseWithBreakPeriod breaks the lease for a blob +// breakPeriodInSeconds is used to determine how long until new lease can be created. +// Returns the timeout remaining in the lease in seconds +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob +func (b *Blob) BreakLeaseWithBreakPeriod(breakPeriodInSeconds int, options *LeaseOptions) (breakTimeout int, err error) { + headers := b.Container.bsc.client.getStandardHeaders() + headers[leaseAction] = breakLease + headers[leaseBreakPeriod] = strconv.Itoa(breakPeriodInSeconds) + return b.breakLeaseCommon(headers, options) +} + +// breakLeaseCommon is common code for both version of BreakLease (with and without break period) +func (b *Blob) breakLeaseCommon(headers map[string]string, options *LeaseOptions) (breakTimeout int, err error) { + + respHeaders, err := b.leaseCommonPut(headers, http.StatusAccepted, options) + if err != nil { + return 0, err + } + + breakTimeoutStr := respHeaders.Get(http.CanonicalHeaderKey(leaseTime)) + if breakTimeoutStr != "" { + breakTimeout, err = strconv.Atoi(breakTimeoutStr) + if err != nil { + return 0, err + } + } + + return breakTimeout, nil +} + +// ChangeLease changes a lease ID for a blob +// Returns the new LeaseID acquired +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob +func (b *Blob) ChangeLease(currentLeaseID string, proposedLeaseID string, options *LeaseOptions) (newLeaseID string, err error) { + headers := b.Container.bsc.client.getStandardHeaders() + headers[leaseAction] = changeLease + headers[headerLeaseID] = currentLeaseID + headers[leaseProposedID] = proposedLeaseID + + respHeaders, err := b.leaseCommonPut(headers, http.StatusOK, options) + if err != nil { + return "", err + } + + newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID)) + if newLeaseID != "" { + return newLeaseID, nil + } + + return "", errors.New("LeaseID not returned") +} + +// ReleaseLease releases the lease for a blob +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob +func (b *Blob) ReleaseLease(currentLeaseID string, options *LeaseOptions) error { + headers := b.Container.bsc.client.getStandardHeaders() + headers[leaseAction] = releaseLease + headers[headerLeaseID] = currentLeaseID + + _, err := b.leaseCommonPut(headers, http.StatusOK, options) + if err != nil { + return err + } + + return nil +} + +// RenewLease renews the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx +func (b *Blob) RenewLease(currentLeaseID string, options *LeaseOptions) error { + headers := b.Container.bsc.client.getStandardHeaders() + headers[leaseAction] = renewLease + headers[headerLeaseID] = currentLeaseID + + _, err := b.leaseCommonPut(headers, http.StatusOK, options) + if err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob_test.go index 48cb68b30b..cd4528be75 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob_test.go @@ -1,211 +1,211 @@ -package storage - -import chk "gopkg.in/check.v1" - -type LeaseBlobSuite struct{} - -var _ = chk.Suite(&LeaseBlobSuite{}) - -func (s *LeaseBlobSuite) TestAcquireLeaseWithNoProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - _, err := b.AcquireLease(30, "", nil) - c.Assert(err, chk.IsNil) -} - -func (s *LeaseBlobSuite) TestAcquireLeaseWithProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - c.Assert(leaseID, chk.Equals, proposedLeaseID) -} - -func (s *LeaseBlobSuite) TestAcquireLeaseWithBadProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - proposedLeaseID := "badbadbad" - _, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.NotNil) -} - -func (s *LeaseBlobSuite) TestAcquireInfiniteLease(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - _, err := b.AcquireLease(-1, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) -} - -func (s *LeaseBlobSuite) TestRenewLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - - err = b.RenewLease(leaseID, nil) - c.Assert(err, chk.IsNil) -} - -func (s *LeaseBlobSuite) TestRenewLeaseAgainstNoCurrentLease(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - badLeaseID := "Golang rocks on Azure" - err := b.RenewLease(badLeaseID, nil) - c.Assert(err, chk.NotNil) -} - -func (s *LeaseBlobSuite) TestChangeLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - - newProposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fbb" - newLeaseID, err := b.ChangeLease(leaseID, newProposedLeaseID, nil) - c.Assert(err, chk.IsNil) - c.Assert(newLeaseID, chk.Equals, newProposedLeaseID) -} - -func (s *LeaseBlobSuite) TestChangeLeaseNotSuccessfulbadProposedLeaseID(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - - newProposedLeaseID := "1f812371-a41d-49e6-b123-f4b542e" - _, err = b.ChangeLease(leaseID, newProposedLeaseID, nil) - c.Assert(err, chk.NotNil) -} - -func (s *LeaseBlobSuite) TestReleaseLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - - err = b.ReleaseLease(leaseID, nil) - c.Assert(err, chk.IsNil) -} - -func (s *LeaseBlobSuite) TestReleaseLeaseNotSuccessfulBadLeaseID(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - _, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - - err = b.ReleaseLease("badleaseid", nil) - c.Assert(err, chk.NotNil) -} - -func (s *LeaseBlobSuite) TestBreakLeaseSuccessful(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) - - proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" - _, err := b.AcquireLease(30, proposedLeaseID, nil) - c.Assert(err, chk.IsNil) - - _, err = b.BreakLease(nil) - c.Assert(err, chk.IsNil) -} +package storage + +import chk "gopkg.in/check.v1" + +type LeaseBlobSuite struct{} + +var _ = chk.Suite(&LeaseBlobSuite{}) + +func (s *LeaseBlobSuite) TestAcquireLeaseWithNoProposedLeaseID(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + _, err := b.AcquireLease(30, "", nil) + c.Assert(err, chk.IsNil) +} + +func (s *LeaseBlobSuite) TestAcquireLeaseWithProposedLeaseID(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + c.Assert(leaseID, chk.Equals, proposedLeaseID) +} + +func (s *LeaseBlobSuite) TestAcquireLeaseWithBadProposedLeaseID(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + proposedLeaseID := "badbadbad" + _, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.NotNil) +} + +func (s *LeaseBlobSuite) TestAcquireInfiniteLease(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + _, err := b.AcquireLease(-1, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) +} + +func (s *LeaseBlobSuite) TestRenewLeaseSuccessful(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + + err = b.RenewLease(leaseID, nil) + c.Assert(err, chk.IsNil) +} + +func (s *LeaseBlobSuite) TestRenewLeaseAgainstNoCurrentLease(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + badLeaseID := "Golang rocks on Azure" + err := b.RenewLease(badLeaseID, nil) + c.Assert(err, chk.NotNil) +} + +func (s *LeaseBlobSuite) TestChangeLeaseSuccessful(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + + newProposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fbb" + newLeaseID, err := b.ChangeLease(leaseID, newProposedLeaseID, nil) + c.Assert(err, chk.IsNil) + c.Assert(newLeaseID, chk.Equals, newProposedLeaseID) +} + +func (s *LeaseBlobSuite) TestChangeLeaseNotSuccessfulbadProposedLeaseID(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + + newProposedLeaseID := "1f812371-a41d-49e6-b123-f4b542e" + _, err = b.ChangeLease(leaseID, newProposedLeaseID, nil) + c.Assert(err, chk.NotNil) +} + +func (s *LeaseBlobSuite) TestReleaseLeaseSuccessful(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + leaseID, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + + err = b.ReleaseLease(leaseID, nil) + c.Assert(err, chk.IsNil) +} + +func (s *LeaseBlobSuite) TestReleaseLeaseNotSuccessfulBadLeaseID(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + _, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + + err = b.ReleaseLease("badleaseid", nil) + c.Assert(err, chk.NotNil) +} + +func (s *LeaseBlobSuite) TestBreakLeaseSuccessful(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + c.Assert(b.putSingleBlockBlob([]byte("Hello!")), chk.IsNil) + + proposedLeaseID := "dfe6dde8-68d5-4910-9248-c97c61768fea" + _, err := b.AcquireLease(30, proposedLeaseID, nil) + c.Assert(err, chk.IsNil) + + _, err = b.BreakLease(nil) + c.Assert(err, chk.IsNil) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go index 00b19bb21b..3ededcd421 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go @@ -1,153 +1,153 @@ -package storage - -import ( - "encoding/xml" - "fmt" - "net/http" - "net/url" - "strconv" - "time" -) - -// Message represents an Azure message. -type Message struct { - Queue *Queue - Text string `xml:"MessageText"` - ID string `xml:"MessageId"` - Insertion TimeRFC1123 `xml:"InsertionTime"` - Expiration TimeRFC1123 `xml:"ExpirationTime"` - PopReceipt string `xml:"PopReceipt"` - NextVisible TimeRFC1123 `xml:"TimeNextVisible"` - DequeueCount int `xml:"DequeueCount"` -} - -func (m *Message) buildPath() string { - return fmt.Sprintf("%s/%s", m.Queue.buildPathMessages(), m.ID) -} - -// PutMessageOptions is the set of options can be specified for Put Messsage -// operation. A zero struct does not use any preferences for the request. -type PutMessageOptions struct { - Timeout uint - VisibilityTimeout int - MessageTTL int - RequestID string `header:"x-ms-client-request-id"` -} - -// Put operation adds a new message to the back of the message queue. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Message -func (m *Message) Put(options *PutMessageOptions) error { - query := url.Values{} - headers := m.Queue.qsc.client.getStandardHeaders() - - req := putMessageRequest{MessageText: m.Text} - body, nn, err := xmlMarshal(req) - if err != nil { - return err - } - headers["Content-Length"] = strconv.Itoa(nn) - - if options != nil { - if options.VisibilityTimeout != 0 { - query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout)) - } - if options.MessageTTL != 0 { - query.Set("messagettl", strconv.Itoa(options.MessageTTL)) - } - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - - uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.Queue.buildPathMessages(), query) - resp, err := m.Queue.qsc.client.exec(http.MethodPost, uri, headers, body, m.Queue.qsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - err = xmlUnmarshal(resp.body, m) - if err != nil { - return err - } - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// UpdateMessageOptions is the set of options can be specified for Update Messsage -// operation. A zero struct does not use any preferences for the request. -type UpdateMessageOptions struct { - Timeout uint - VisibilityTimeout int - RequestID string `header:"x-ms-client-request-id"` -} - -// Update operation updates the specified message. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Update-Message -func (m *Message) Update(options *UpdateMessageOptions) error { - query := url.Values{} - if m.PopReceipt != "" { - query.Set("popreceipt", m.PopReceipt) - } - - headers := m.Queue.qsc.client.getStandardHeaders() - req := putMessageRequest{MessageText: m.Text} - body, nn, err := xmlMarshal(req) - if err != nil { - return err - } - headers["Content-Length"] = strconv.Itoa(nn) - - if options != nil { - if options.VisibilityTimeout != 0 { - query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout)) - } - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.buildPath(), query) - - resp, err := m.Queue.qsc.client.exec(http.MethodPut, uri, headers, body, m.Queue.qsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - m.PopReceipt = resp.headers.Get("x-ms-popreceipt") - nextTimeStr := resp.headers.Get("x-ms-time-next-visible") - if nextTimeStr != "" { - nextTime, err := time.Parse(time.RFC1123, nextTimeStr) - if err != nil { - return err - } - m.NextVisible = TimeRFC1123(nextTime) - } - - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// Delete operation deletes the specified message. -// -// See https://msdn.microsoft.com/en-us/library/azure/dd179347.aspx -func (m *Message) Delete(options *QueueServiceOptions) error { - params := url.Values{"popreceipt": {m.PopReceipt}} - headers := m.Queue.qsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.buildPath(), params) - - resp, err := m.Queue.qsc.client.exec(http.MethodDelete, uri, headers, nil, m.Queue.qsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -type putMessageRequest struct { - XMLName xml.Name `xml:"QueueMessage"` - MessageText string `xml:"MessageText"` -} +package storage + +import ( + "encoding/xml" + "fmt" + "net/http" + "net/url" + "strconv" + "time" +) + +// Message represents an Azure message. +type Message struct { + Queue *Queue + Text string `xml:"MessageText"` + ID string `xml:"MessageId"` + Insertion TimeRFC1123 `xml:"InsertionTime"` + Expiration TimeRFC1123 `xml:"ExpirationTime"` + PopReceipt string `xml:"PopReceipt"` + NextVisible TimeRFC1123 `xml:"TimeNextVisible"` + DequeueCount int `xml:"DequeueCount"` +} + +func (m *Message) buildPath() string { + return fmt.Sprintf("%s/%s", m.Queue.buildPathMessages(), m.ID) +} + +// PutMessageOptions is the set of options can be specified for Put Messsage +// operation. A zero struct does not use any preferences for the request. +type PutMessageOptions struct { + Timeout uint + VisibilityTimeout int + MessageTTL int + RequestID string `header:"x-ms-client-request-id"` +} + +// Put operation adds a new message to the back of the message queue. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Message +func (m *Message) Put(options *PutMessageOptions) error { + query := url.Values{} + headers := m.Queue.qsc.client.getStandardHeaders() + + req := putMessageRequest{MessageText: m.Text} + body, nn, err := xmlMarshal(req) + if err != nil { + return err + } + headers["Content-Length"] = strconv.Itoa(nn) + + if options != nil { + if options.VisibilityTimeout != 0 { + query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout)) + } + if options.MessageTTL != 0 { + query.Set("messagettl", strconv.Itoa(options.MessageTTL)) + } + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + + uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.Queue.buildPathMessages(), query) + resp, err := m.Queue.qsc.client.exec(http.MethodPost, uri, headers, body, m.Queue.qsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + err = xmlUnmarshal(resp.body, m) + if err != nil { + return err + } + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// UpdateMessageOptions is the set of options can be specified for Update Messsage +// operation. A zero struct does not use any preferences for the request. +type UpdateMessageOptions struct { + Timeout uint + VisibilityTimeout int + RequestID string `header:"x-ms-client-request-id"` +} + +// Update operation updates the specified message. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Update-Message +func (m *Message) Update(options *UpdateMessageOptions) error { + query := url.Values{} + if m.PopReceipt != "" { + query.Set("popreceipt", m.PopReceipt) + } + + headers := m.Queue.qsc.client.getStandardHeaders() + req := putMessageRequest{MessageText: m.Text} + body, nn, err := xmlMarshal(req) + if err != nil { + return err + } + headers["Content-Length"] = strconv.Itoa(nn) + + if options != nil { + if options.VisibilityTimeout != 0 { + query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout)) + } + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.buildPath(), query) + + resp, err := m.Queue.qsc.client.exec(http.MethodPut, uri, headers, body, m.Queue.qsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + m.PopReceipt = resp.headers.Get("x-ms-popreceipt") + nextTimeStr := resp.headers.Get("x-ms-time-next-visible") + if nextTimeStr != "" { + nextTime, err := time.Parse(time.RFC1123, nextTimeStr) + if err != nil { + return err + } + m.NextVisible = TimeRFC1123(nextTime) + } + + return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) +} + +// Delete operation deletes the specified message. +// +// See https://msdn.microsoft.com/en-us/library/azure/dd179347.aspx +func (m *Message) Delete(options *QueueServiceOptions) error { + params := url.Values{"popreceipt": {m.PopReceipt}} + headers := m.Queue.qsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.buildPath(), params) + + resp, err := m.Queue.qsc.client.exec(http.MethodDelete, uri, headers, nil, m.Queue.qsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) +} + +type putMessageRequest struct { + XMLName xml.Name `xml:"QueueMessage"` + MessageText string `xml:"MessageText"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/message_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/message_test.go index 04e13e0b05..ea3e675a0c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/message_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/message_test.go @@ -1,79 +1,79 @@ -package storage - -import chk "gopkg.in/check.v1" - -type StorageMessageSuite struct{} - -var _ = chk.Suite(&StorageMessageSuite{}) - -func (s *StorageMessageSuite) Test_pathForMessage(c *chk.C) { - m := getQueueClient(c).GetQueueReference("q").GetMessageReference("m") - m.ID = "ID" - c.Assert(m.buildPath(), chk.Equals, "/q/messages/ID") -} - -func (s *StorageMessageSuite) TestDeleteMessages(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - q := cli.GetQueueReference(queueName(c)) - c.Assert(q.Create(nil), chk.IsNil) - defer q.Delete(nil) - - m := q.GetMessageReference("message") - c.Assert(m.Put(nil), chk.IsNil) - - options := GetMessagesOptions{ - VisibilityTimeout: 1, - } - list, err := q.GetMessages(&options) - c.Assert(err, chk.IsNil) - c.Assert(list, chk.HasLen, 1) - - c.Assert(list[0].Delete(nil), chk.IsNil) -} - -func (s *StorageMessageSuite) TestPutMessage_Peek(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue := cli.GetQueueReference(queueName(c)) - c.Assert(queue.Create(nil), chk.IsNil) - defer queue.Delete(nil) - - msg := queue.GetMessageReference(string(content(64 * 1024))) // exercise max length - c.Assert(msg.Put(nil), chk.IsNil) - - list, err := queue.PeekMessages(nil) - c.Assert(err, chk.IsNil) - c.Assert(len(list), chk.Equals, 1) - c.Assert(list[0].Text, chk.Equals, msg.Text) -} - -func (s *StorageMessageSuite) TestPutMessage_Peek_Update_Delete(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue := cli.GetQueueReference(queueName(c)) - c.Assert(queue.Create(nil), chk.IsNil) - defer queue.Delete(nil) - - msg1 := queue.GetMessageReference(string(content(64 * 1024))) // exercise max length - msg2 := queue.GetMessageReference("and other message") - c.Assert(msg1.Put(nil), chk.IsNil) - c.Assert(msg2.Put(nil), chk.IsNil) - - list, err := queue.GetMessages(&GetMessagesOptions{NumOfMessages: 2, VisibilityTimeout: 2}) - c.Assert(err, chk.IsNil) - c.Assert(len(list), chk.Equals, 2) - c.Assert(list[0].Text, chk.Equals, msg1.Text) - c.Assert(list[1].Text, chk.Equals, msg2.Text) - - list[0].Text = "updated message" - c.Assert(list[0].Update(&UpdateMessageOptions{VisibilityTimeout: 2}), chk.IsNil) - - c.Assert(list[1].Delete(nil), chk.IsNil) -} +package storage + +import chk "gopkg.in/check.v1" + +type StorageMessageSuite struct{} + +var _ = chk.Suite(&StorageMessageSuite{}) + +func (s *StorageMessageSuite) Test_pathForMessage(c *chk.C) { + m := getQueueClient(c).GetQueueReference("q").GetMessageReference("m") + m.ID = "ID" + c.Assert(m.buildPath(), chk.Equals, "/q/messages/ID") +} + +func (s *StorageMessageSuite) TestDeleteMessages(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + q := cli.GetQueueReference(queueName(c)) + c.Assert(q.Create(nil), chk.IsNil) + defer q.Delete(nil) + + m := q.GetMessageReference("message") + c.Assert(m.Put(nil), chk.IsNil) + + options := GetMessagesOptions{ + VisibilityTimeout: 1, + } + list, err := q.GetMessages(&options) + c.Assert(err, chk.IsNil) + c.Assert(list, chk.HasLen, 1) + + c.Assert(list[0].Delete(nil), chk.IsNil) +} + +func (s *StorageMessageSuite) TestPutMessage_Peek(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue := cli.GetQueueReference(queueName(c)) + c.Assert(queue.Create(nil), chk.IsNil) + defer queue.Delete(nil) + + msg := queue.GetMessageReference(string(content(64 * 1024))) // exercise max length + c.Assert(msg.Put(nil), chk.IsNil) + + list, err := queue.PeekMessages(nil) + c.Assert(err, chk.IsNil) + c.Assert(len(list), chk.Equals, 1) + c.Assert(list[0].Text, chk.Equals, msg.Text) +} + +func (s *StorageMessageSuite) TestPutMessage_Peek_Update_Delete(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue := cli.GetQueueReference(queueName(c)) + c.Assert(queue.Create(nil), chk.IsNil) + defer queue.Delete(nil) + + msg1 := queue.GetMessageReference(string(content(64 * 1024))) // exercise max length + msg2 := queue.GetMessageReference("and other message") + c.Assert(msg1.Put(nil), chk.IsNil) + c.Assert(msg2.Put(nil), chk.IsNil) + + list, err := queue.GetMessages(&GetMessagesOptions{NumOfMessages: 2, VisibilityTimeout: 2}) + c.Assert(err, chk.IsNil) + c.Assert(len(list), chk.Equals, 2) + c.Assert(list[0].Text, chk.Equals, msg1.Text) + c.Assert(list[1].Text, chk.Equals, msg2.Text) + + list[0].Text = "updated message" + c.Assert(list[0].Update(&UpdateMessageOptions{VisibilityTimeout: 2}), chk.IsNil) + + c.Assert(list[1].Delete(nil), chk.IsNil) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go index 61ee52ac57..41d832e2be 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go @@ -1,33 +1,33 @@ -package storage - -// MetadataLevel determines if operations should return a paylod, -// and it level of detail. -type MetadataLevel string - -// This consts are meant to help with Odata supported operations -const ( - OdataTypeSuffix = "@odata.type" - - // Types - - OdataBinary = "Edm.Binary" - OdataDateTime = "Edm.DateTime" - OdataGUID = "Edm.Guid" - OdataInt64 = "Edm.Int64" - - // Query options - - OdataFilter = "$filter" - OdataOrderBy = "$orderby" - OdataTop = "$top" - OdataSkip = "$skip" - OdataCount = "$count" - OdataExpand = "$expand" - OdataSelect = "$select" - OdataSearch = "$search" - - EmptyPayload MetadataLevel = "" - NoMetadata MetadataLevel = "application/json;odata=nometadata" - MinimalMetadata MetadataLevel = "application/json;odata=minimalmetadata" - FullMetadata MetadataLevel = "application/json;odata=fullmetadata" -) +package storage + +// MetadataLevel determines if operations should return a paylod, +// and it level of detail. +type MetadataLevel string + +// This consts are meant to help with Odata supported operations +const ( + OdataTypeSuffix = "@odata.type" + + // Types + + OdataBinary = "Edm.Binary" + OdataDateTime = "Edm.DateTime" + OdataGUID = "Edm.Guid" + OdataInt64 = "Edm.Int64" + + // Query options + + OdataFilter = "$filter" + OdataOrderBy = "$orderby" + OdataTop = "$top" + OdataSkip = "$skip" + OdataCount = "$count" + OdataExpand = "$expand" + OdataSelect = "$select" + OdataSearch = "$search" + + EmptyPayload MetadataLevel = "" + NoMetadata MetadataLevel = "application/json;odata=nometadata" + MinimalMetadata MetadataLevel = "application/json;odata=minimalmetadata" + FullMetadata MetadataLevel = "application/json;odata=fullmetadata" +) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go index 9ccddc51dd..bc5b398d3f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go @@ -1,189 +1,189 @@ -package storage - -import ( - "encoding/xml" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "time" -) - -// GetPageRangesResponse contains the response fields from -// Get Page Ranges call. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx -type GetPageRangesResponse struct { - XMLName xml.Name `xml:"PageList"` - PageList []PageRange `xml:"PageRange"` -} - -// PageRange contains information about a page of a page blob from -// Get Pages Range call. -// -// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx -type PageRange struct { - Start int64 `xml:"Start"` - End int64 `xml:"End"` -} - -var ( - errBlobCopyAborted = errors.New("storage: blob copy is aborted") - errBlobCopyIDMismatch = errors.New("storage: blob copy id is a mismatch") -) - -// PutPageOptions includes the options for a put page operation -type PutPageOptions struct { - Timeout uint - LeaseID string `header:"x-ms-lease-id"` - IfSequenceNumberLessThanOrEqualTo *int `header:"x-ms-if-sequence-number-le"` - IfSequenceNumberLessThan *int `header:"x-ms-if-sequence-number-lt"` - IfSequenceNumberEqualTo *int `header:"x-ms-if-sequence-number-eq"` - IfModifiedSince *time.Time `header:"If-Modified-Since"` - IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` - IfMatch string `header:"If-Match"` - IfNoneMatch string `header:"If-None-Match"` - RequestID string `header:"x-ms-client-request-id"` -} - -// WriteRange writes a range of pages to a page blob. -// Ranges must be aligned with 512-byte boundaries and chunk must be of size -// multiplies by 512. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page -func (b *Blob) WriteRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error { - if bytes == nil { - return errors.New("bytes cannot be nil") - } - return b.modifyRange(blobRange, bytes, options) -} - -// ClearRange clears the given range in a page blob. -// Ranges must be aligned with 512-byte boundaries and chunk must be of size -// multiplies by 512. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page -func (b *Blob) ClearRange(blobRange BlobRange, options *PutPageOptions) error { - return b.modifyRange(blobRange, nil, options) -} - -func (b *Blob) modifyRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error { - if blobRange.End < blobRange.Start { - return errors.New("the value for rangeEnd must be greater than or equal to rangeStart") - } - if blobRange.Start%512 != 0 { - return errors.New("the value for rangeStart must be a modulus of 512") - } - if blobRange.End%512 != 511 { - return errors.New("the value for rangeEnd must be a modulus of 511") - } - - params := url.Values{"comp": {"page"}} - - // default to clear - write := "clear" - var cl uint64 - - // if bytes is not nil then this is an update operation - if bytes != nil { - write = "update" - cl = (blobRange.End - blobRange.Start) + 1 - } - - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypePage) - headers["x-ms-page-write"] = write - headers["x-ms-range"] = blobRange.String() - headers["Content-Length"] = fmt.Sprintf("%v", cl) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// GetPageRangesOptions includes the options for a get page ranges operation -type GetPageRangesOptions struct { - Timeout uint - Snapshot *time.Time - PreviousSnapshot *time.Time - Range *BlobRange - LeaseID string `header:"x-ms-lease-id"` - RequestID string `header:"x-ms-client-request-id"` -} - -// GetPageRanges returns the list of valid page ranges for a page blob. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Page-Ranges -func (b *Blob) GetPageRanges(options *GetPageRangesOptions) (GetPageRangesResponse, error) { - params := url.Values{"comp": {"pagelist"}} - headers := b.Container.bsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - params = addSnapshot(params, options.Snapshot) - if options.PreviousSnapshot != nil { - params.Add("prevsnapshot", timeRfc1123Formatted(*options.PreviousSnapshot)) - } - if options.Range != nil { - headers["Range"] = options.Range.String() - } - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - var out GetPageRangesResponse - resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return out, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return out, err - } - err = xmlUnmarshal(resp.body, &out) - return out, err -} - -// PutPageBlob initializes an empty page blob with specified name and maximum -// size in bytes (size must be aligned to a 512-byte boundary). A page blob must -// be created using this method before writing pages. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob -func (b *Blob) PutPageBlob(options *PutBlobOptions) error { - if b.Properties.ContentLength%512 != 0 { - return errors.New("Content length must be aligned to a 512-byte boundary") - } - - params := url.Values{} - headers := b.Container.bsc.client.getStandardHeaders() - headers["x-ms-blob-type"] = string(BlobTypePage) - headers["x-ms-blob-content-length"] = fmt.Sprintf("%v", b.Properties.ContentLength) - headers["x-ms-blob-sequence-number"] = fmt.Sprintf("%v", b.Properties.SequenceNumber) - headers = mergeHeaders(headers, headersFromStruct(b.Properties)) - headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) - - resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} +package storage + +import ( + "encoding/xml" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "time" +) + +// GetPageRangesResponse contains the response fields from +// Get Page Ranges call. +// +// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx +type GetPageRangesResponse struct { + XMLName xml.Name `xml:"PageList"` + PageList []PageRange `xml:"PageRange"` +} + +// PageRange contains information about a page of a page blob from +// Get Pages Range call. +// +// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx +type PageRange struct { + Start int64 `xml:"Start"` + End int64 `xml:"End"` +} + +var ( + errBlobCopyAborted = errors.New("storage: blob copy is aborted") + errBlobCopyIDMismatch = errors.New("storage: blob copy id is a mismatch") +) + +// PutPageOptions includes the options for a put page operation +type PutPageOptions struct { + Timeout uint + LeaseID string `header:"x-ms-lease-id"` + IfSequenceNumberLessThanOrEqualTo *int `header:"x-ms-if-sequence-number-le"` + IfSequenceNumberLessThan *int `header:"x-ms-if-sequence-number-lt"` + IfSequenceNumberEqualTo *int `header:"x-ms-if-sequence-number-eq"` + IfModifiedSince *time.Time `header:"If-Modified-Since"` + IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"` + IfMatch string `header:"If-Match"` + IfNoneMatch string `header:"If-None-Match"` + RequestID string `header:"x-ms-client-request-id"` +} + +// WriteRange writes a range of pages to a page blob. +// Ranges must be aligned with 512-byte boundaries and chunk must be of size +// multiplies by 512. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page +func (b *Blob) WriteRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error { + if bytes == nil { + return errors.New("bytes cannot be nil") + } + return b.modifyRange(blobRange, bytes, options) +} + +// ClearRange clears the given range in a page blob. +// Ranges must be aligned with 512-byte boundaries and chunk must be of size +// multiplies by 512. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page +func (b *Blob) ClearRange(blobRange BlobRange, options *PutPageOptions) error { + return b.modifyRange(blobRange, nil, options) +} + +func (b *Blob) modifyRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error { + if blobRange.End < blobRange.Start { + return errors.New("the value for rangeEnd must be greater than or equal to rangeStart") + } + if blobRange.Start%512 != 0 { + return errors.New("the value for rangeStart must be a modulus of 512") + } + if blobRange.End%512 != 511 { + return errors.New("the value for rangeEnd must be a modulus of 511") + } + + params := url.Values{"comp": {"page"}} + + // default to clear + write := "clear" + var cl uint64 + + // if bytes is not nil then this is an update operation + if bytes != nil { + write = "update" + cl = (blobRange.End - blobRange.Start) + 1 + } + + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-blob-type"] = string(BlobTypePage) + headers["x-ms-page-write"] = write + headers["x-ms-range"] = blobRange.String() + headers["Content-Length"] = fmt.Sprintf("%v", cl) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// GetPageRangesOptions includes the options for a get page ranges operation +type GetPageRangesOptions struct { + Timeout uint + Snapshot *time.Time + PreviousSnapshot *time.Time + Range *BlobRange + LeaseID string `header:"x-ms-lease-id"` + RequestID string `header:"x-ms-client-request-id"` +} + +// GetPageRanges returns the list of valid page ranges for a page blob. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Page-Ranges +func (b *Blob) GetPageRanges(options *GetPageRangesOptions) (GetPageRangesResponse, error) { + params := url.Values{"comp": {"pagelist"}} + headers := b.Container.bsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + params = addSnapshot(params, options.Snapshot) + if options.PreviousSnapshot != nil { + params.Add("prevsnapshot", timeRfc1123Formatted(*options.PreviousSnapshot)) + } + if options.Range != nil { + headers["Range"] = options.Range.String() + } + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + var out GetPageRangesResponse + resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return out, err + } + defer resp.body.Close() + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return out, err + } + err = xmlUnmarshal(resp.body, &out) + return out, err +} + +// PutPageBlob initializes an empty page blob with specified name and maximum +// size in bytes (size must be aligned to a 512-byte boundary). A page blob must +// be created using this method before writing pages. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob +func (b *Blob) PutPageBlob(options *PutBlobOptions) error { + if b.Properties.ContentLength%512 != 0 { + return errors.New("Content length must be aligned to a 512-byte boundary") + } + + params := url.Values{} + headers := b.Container.bsc.client.getStandardHeaders() + headers["x-ms-blob-type"] = string(BlobTypePage) + headers["x-ms-blob-content-length"] = fmt.Sprintf("%v", b.Properties.ContentLength) + headers["x-ms-blob-sequence-number"] = fmt.Sprintf("%v", b.Properties.SequenceNumber) + headers = mergeHeaders(headers, headersFromStruct(b.Properties)) + headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params) + + resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob_test.go index ad6d7ae5ff..de009cfe06 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob_test.go @@ -1,179 +1,179 @@ -package storage - -import ( - "bytes" - "io/ioutil" - - chk "gopkg.in/check.v1" -) - -type PageBlobSuite struct{} - -var _ = chk.Suite(&PageBlobSuite{}) - -func (s *PageBlobSuite) TestPutPageBlob(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - size := int64(10 * 1024 * 1024) - b.Properties.ContentLength = size - c.Assert(b.PutPageBlob(nil), chk.IsNil) - - // Verify - err := b.GetProperties(nil) - c.Assert(err, chk.IsNil) - c.Assert(b.Properties.ContentLength, chk.Equals, size) - c.Assert(b.Properties.BlobType, chk.Equals, BlobTypePage) -} - -func (s *PageBlobSuite) TestPutPagesUpdate(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - size := int64(10 * 1024 * 1024) // larger than we'll use - b.Properties.ContentLength = size - c.Assert(b.PutPageBlob(nil), chk.IsNil) - - chunk1 := content(1024) - chunk2 := content(512) - - // Append chunks - blobRange := BlobRange{ - End: uint64(len(chunk1) - 1), - } - c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk1), nil), chk.IsNil) - blobRange.Start = uint64(len(chunk1)) - blobRange.End = uint64(len(chunk1) + len(chunk2) - 1) - c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk2), nil), chk.IsNil) - - // Verify contents - options := GetBlobRangeOptions{ - Range: &BlobRange{ - End: uint64(len(chunk1) + len(chunk2) - 1), - }, - } - out, err := b.GetRange(&options) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) - - // Overwrite first half of chunk1 - chunk0 := content(512) - blobRange.Start = 0 - blobRange.End = uint64(len(chunk0) - 1) - c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk0), nil), chk.IsNil) - - // Verify contents - out, err = b.GetRange(&options) - c.Assert(err, chk.IsNil) - defer out.Close() - blobContents, err = ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - c.Assert(blobContents, chk.DeepEquals, append(append(chunk0, chunk1[512:]...), chunk2...)) -} - -func (s *PageBlobSuite) TestPutPagesClear(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - b := cnt.GetBlobReference(blobName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - size := int64(10 * 1024 * 1024) // larger than we'll use - b.Properties.ContentLength = size - c.Assert(b.PutPageBlob(nil), chk.IsNil) - - // Put 0-2047 - chunk := content(2048) - blobRange := BlobRange{ - End: 2047, - } - c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk), nil), chk.IsNil) - - // Clear 512-1023 - blobRange.Start = 512 - blobRange.End = 1023 - c.Assert(b.ClearRange(blobRange, nil), chk.IsNil) - - // Verify contents - options := GetBlobRangeOptions{ - Range: &BlobRange{ - Start: 0, - End: 2047, - }, - } - out, err := b.GetRange(&options) - c.Assert(err, chk.IsNil) - contents, err := ioutil.ReadAll(out) - c.Assert(err, chk.IsNil) - defer out.Close() - c.Assert(contents, chk.DeepEquals, append(append(chunk[:512], make([]byte, 512)...), chunk[1024:]...)) -} - -func (s *PageBlobSuite) TestGetPageRanges(c *chk.C) { - cli := getBlobClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - cnt := cli.GetContainerReference(containerName(c)) - c.Assert(cnt.Create(nil), chk.IsNil) - defer cnt.Delete(nil) - - size := int64(10 * 1024) // larger than we'll use - - // Get page ranges on empty blob - blob1 := cnt.GetBlobReference(blobName(c, "1")) - blob1.Properties.ContentLength = size - c.Assert(blob1.PutPageBlob(nil), chk.IsNil) - out, err := blob1.GetPageRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 0) - - // Get page ranges with just one range - blob2 := cnt.GetBlobReference(blobName(c, "2")) - blob2.Properties.ContentLength = size - c.Assert(blob2.PutPageBlob(nil), chk.IsNil) - blobRange := []BlobRange{ - {End: 511}, - {Start: 1024, End: 2047}, - } - c.Assert(blob2.WriteRange(blobRange[0], bytes.NewReader(content(512)), nil), chk.IsNil) - - out, err = blob2.GetPageRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 1) - expected := []PageRange{ - {End: 511}, - {Start: 1024, End: 2047}, - } - c.Assert(out.PageList[0], chk.Equals, expected[0]) - - // Get page ranges with just two range - blob3 := cnt.GetBlobReference(blobName(c, "3")) - blob3.Properties.ContentLength = size - c.Assert(blob3.PutPageBlob(nil), chk.IsNil) - for _, br := range blobRange { - c.Assert(blob3.WriteRange(br, bytes.NewReader(content(int(br.End-br.Start+1))), nil), chk.IsNil) - } - out, err = blob3.GetPageRanges(nil) - c.Assert(err, chk.IsNil) - c.Assert(len(out.PageList), chk.Equals, 2) - c.Assert(out.PageList, chk.DeepEquals, expected) -} +package storage + +import ( + "bytes" + "io/ioutil" + + chk "gopkg.in/check.v1" +) + +type PageBlobSuite struct{} + +var _ = chk.Suite(&PageBlobSuite{}) + +func (s *PageBlobSuite) TestPutPageBlob(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + size := int64(10 * 1024 * 1024) + b.Properties.ContentLength = size + c.Assert(b.PutPageBlob(nil), chk.IsNil) + + // Verify + err := b.GetProperties(nil) + c.Assert(err, chk.IsNil) + c.Assert(b.Properties.ContentLength, chk.Equals, size) + c.Assert(b.Properties.BlobType, chk.Equals, BlobTypePage) +} + +func (s *PageBlobSuite) TestPutPagesUpdate(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + size := int64(10 * 1024 * 1024) // larger than we'll use + b.Properties.ContentLength = size + c.Assert(b.PutPageBlob(nil), chk.IsNil) + + chunk1 := content(1024) + chunk2 := content(512) + + // Append chunks + blobRange := BlobRange{ + End: uint64(len(chunk1) - 1), + } + c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk1), nil), chk.IsNil) + blobRange.Start = uint64(len(chunk1)) + blobRange.End = uint64(len(chunk1) + len(chunk2) - 1) + c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk2), nil), chk.IsNil) + + // Verify contents + options := GetBlobRangeOptions{ + Range: &BlobRange{ + End: uint64(len(chunk1) + len(chunk2) - 1), + }, + } + out, err := b.GetRange(&options) + c.Assert(err, chk.IsNil) + defer out.Close() + blobContents, err := ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + c.Assert(blobContents, chk.DeepEquals, append(chunk1, chunk2...)) + + // Overwrite first half of chunk1 + chunk0 := content(512) + blobRange.Start = 0 + blobRange.End = uint64(len(chunk0) - 1) + c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk0), nil), chk.IsNil) + + // Verify contents + out, err = b.GetRange(&options) + c.Assert(err, chk.IsNil) + defer out.Close() + blobContents, err = ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + c.Assert(blobContents, chk.DeepEquals, append(append(chunk0, chunk1[512:]...), chunk2...)) +} + +func (s *PageBlobSuite) TestPutPagesClear(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + b := cnt.GetBlobReference(blobName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + size := int64(10 * 1024 * 1024) // larger than we'll use + b.Properties.ContentLength = size + c.Assert(b.PutPageBlob(nil), chk.IsNil) + + // Put 0-2047 + chunk := content(2048) + blobRange := BlobRange{ + End: 2047, + } + c.Assert(b.WriteRange(blobRange, bytes.NewReader(chunk), nil), chk.IsNil) + + // Clear 512-1023 + blobRange.Start = 512 + blobRange.End = 1023 + c.Assert(b.ClearRange(blobRange, nil), chk.IsNil) + + // Verify contents + options := GetBlobRangeOptions{ + Range: &BlobRange{ + Start: 0, + End: 2047, + }, + } + out, err := b.GetRange(&options) + c.Assert(err, chk.IsNil) + contents, err := ioutil.ReadAll(out) + c.Assert(err, chk.IsNil) + defer out.Close() + c.Assert(contents, chk.DeepEquals, append(append(chunk[:512], make([]byte, 512)...), chunk[1024:]...)) +} + +func (s *PageBlobSuite) TestGetPageRanges(c *chk.C) { + cli := getBlobClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + cnt := cli.GetContainerReference(containerName(c)) + c.Assert(cnt.Create(nil), chk.IsNil) + defer cnt.Delete(nil) + + size := int64(10 * 1024) // larger than we'll use + + // Get page ranges on empty blob + blob1 := cnt.GetBlobReference(blobName(c, "1")) + blob1.Properties.ContentLength = size + c.Assert(blob1.PutPageBlob(nil), chk.IsNil) + out, err := blob1.GetPageRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(len(out.PageList), chk.Equals, 0) + + // Get page ranges with just one range + blob2 := cnt.GetBlobReference(blobName(c, "2")) + blob2.Properties.ContentLength = size + c.Assert(blob2.PutPageBlob(nil), chk.IsNil) + blobRange := []BlobRange{ + {End: 511}, + {Start: 1024, End: 2047}, + } + c.Assert(blob2.WriteRange(blobRange[0], bytes.NewReader(content(512)), nil), chk.IsNil) + + out, err = blob2.GetPageRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(len(out.PageList), chk.Equals, 1) + expected := []PageRange{ + {End: 511}, + {Start: 1024, End: 2047}, + } + c.Assert(out.PageList[0], chk.Equals, expected[0]) + + // Get page ranges with just two range + blob3 := cnt.GetBlobReference(blobName(c, "3")) + blob3.Properties.ContentLength = size + c.Assert(blob3.PutPageBlob(nil), chk.IsNil) + for _, br := range blobRange { + c.Assert(blob3.WriteRange(br, bytes.NewReader(content(int(br.End-br.Start+1))), nil), chk.IsNil) + } + out, err = blob3.GetPageRanges(nil) + c.Assert(err, chk.IsNil) + c.Assert(len(out.PageList), chk.Equals, 2) + c.Assert(out.PageList, chk.DeepEquals, expected) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go index 4cc31a0f8b..c2c7f742c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go @@ -1,427 +1,427 @@ -package storage - -import ( - "encoding/xml" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "time" -) - -const ( - // casing is per Golang's http.Header canonicalizing the header names. - approximateMessagesCountHeader = "X-Ms-Approximate-Messages-Count" -) - -// QueueAccessPolicy represents each access policy in the queue ACL. -type QueueAccessPolicy struct { - ID string - StartTime time.Time - ExpiryTime time.Time - CanRead bool - CanAdd bool - CanUpdate bool - CanProcess bool -} - -// QueuePermissions represents the queue ACLs. -type QueuePermissions struct { - AccessPolicies []QueueAccessPolicy -} - -// SetQueuePermissionOptions includes options for a set queue permissions operation -type SetQueuePermissionOptions struct { - Timeout uint - RequestID string `header:"x-ms-client-request-id"` -} - -// Queue represents an Azure queue. -type Queue struct { - qsc *QueueServiceClient - Name string - Metadata map[string]string - AproxMessageCount uint64 -} - -func (q *Queue) buildPath() string { - return fmt.Sprintf("/%s", q.Name) -} - -func (q *Queue) buildPathMessages() string { - return fmt.Sprintf("%s/messages", q.buildPath()) -} - -// QueueServiceOptions includes options for some queue service operations -type QueueServiceOptions struct { - Timeout uint - RequestID string `header:"x-ms-client-request-id"` -} - -// Create operation creates a queue under the given account. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Queue4 -func (q *Queue) Create(options *QueueServiceOptions) error { - params := url.Values{} - headers := q.qsc.client.getStandardHeaders() - headers = q.qsc.client.addMetadataToHeaders(headers, q.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) - - resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, nil, q.qsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusCreated}) -} - -// Delete operation permanently deletes the specified queue. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Queue3 -func (q *Queue) Delete(options *QueueServiceOptions) error { - params := url.Values{} - headers := q.qsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) - resp, err := q.qsc.client.exec(http.MethodDelete, uri, headers, nil, q.qsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// Exists returns true if a queue with given name exists. -func (q *Queue) Exists() (bool, error) { - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}}) - resp, err := q.qsc.client.exec(http.MethodGet, uri, q.qsc.client.getStandardHeaders(), nil, q.qsc.auth) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusOK, nil - } - } - return false, err -} - -// SetMetadata operation sets user-defined metadata on the specified queue. -// Metadata is associated with the queue as name-value pairs. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata -func (q *Queue) SetMetadata(options *QueueServiceOptions) error { - params := url.Values{"comp": {"metadata"}} - headers := q.qsc.client.getStandardHeaders() - headers = q.qsc.client.addMetadataToHeaders(headers, q.Metadata) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) - - resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, nil, q.qsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// GetMetadata operation retrieves user-defined metadata and queue -// properties on the specified queue. Metadata is associated with -// the queue as name-values pairs. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata -// -// Because the way Golang's http client (and http.Header in particular) -// canonicalize header names, the returned metadata names would always -// be all lower case. -func (q *Queue) GetMetadata(options *QueueServiceOptions) error { - params := url.Values{"comp": {"metadata"}} - headers := q.qsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}}) - - resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return err - } - - aproxMessagesStr := resp.headers.Get(http.CanonicalHeaderKey(approximateMessagesCountHeader)) - if aproxMessagesStr != "" { - aproxMessages, err := strconv.ParseUint(aproxMessagesStr, 10, 64) - if err != nil { - return err - } - q.AproxMessageCount = aproxMessages - } - - q.Metadata = getMetadataFromHeaders(resp.headers) - return nil -} - -// GetMessageReference returns a message object with the specified text. -func (q *Queue) GetMessageReference(text string) *Message { - return &Message{ - Queue: q, - Text: text, - } -} - -// GetMessagesOptions is the set of options can be specified for Get -// Messsages operation. A zero struct does not use any preferences for the -// request. -type GetMessagesOptions struct { - Timeout uint - NumOfMessages int - VisibilityTimeout int - RequestID string `header:"x-ms-client-request-id"` -} - -type messages struct { - XMLName xml.Name `xml:"QueueMessagesList"` - Messages []Message `xml:"QueueMessage"` -} - -// GetMessages operation retrieves one or more messages from the front of the -// queue. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Messages -func (q *Queue) GetMessages(options *GetMessagesOptions) ([]Message, error) { - query := url.Values{} - headers := q.qsc.client.getStandardHeaders() - - if options != nil { - if options.NumOfMessages != 0 { - query.Set("numofmessages", strconv.Itoa(options.NumOfMessages)) - } - if options.VisibilityTimeout != 0 { - query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout)) - } - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), query) - - resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) - if err != nil { - return []Message{}, err - } - defer readAndCloseBody(resp.body) - - var out messages - err = xmlUnmarshal(resp.body, &out) - if err != nil { - return []Message{}, err - } - for i := range out.Messages { - out.Messages[i].Queue = q - } - return out.Messages, err -} - -// PeekMessagesOptions is the set of options can be specified for Peek -// Messsage operation. A zero struct does not use any preferences for the -// request. -type PeekMessagesOptions struct { - Timeout uint - NumOfMessages int - RequestID string `header:"x-ms-client-request-id"` -} - -// PeekMessages retrieves one or more messages from the front of the queue, but -// does not alter the visibility of the message. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Peek-Messages -func (q *Queue) PeekMessages(options *PeekMessagesOptions) ([]Message, error) { - query := url.Values{"peekonly": {"true"}} // Required for peek operation - headers := q.qsc.client.getStandardHeaders() - - if options != nil { - if options.NumOfMessages != 0 { - query.Set("numofmessages", strconv.Itoa(options.NumOfMessages)) - } - query = addTimeout(query, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), query) - - resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) - if err != nil { - return []Message{}, err - } - defer readAndCloseBody(resp.body) - - var out messages - err = xmlUnmarshal(resp.body, &out) - if err != nil { - return []Message{}, err - } - for i := range out.Messages { - out.Messages[i].Queue = q - } - return out.Messages, err -} - -// ClearMessages operation deletes all messages from the specified queue. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Clear-Messages -func (q *Queue) ClearMessages(options *QueueServiceOptions) error { - params := url.Values{} - headers := q.qsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), params) - - resp, err := q.qsc.client.exec(http.MethodDelete, uri, headers, nil, q.qsc.auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) -} - -// SetPermissions sets up queue permissions -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-acl -func (q *Queue) SetPermissions(permissions QueuePermissions, options *SetQueuePermissionOptions) error { - body, length, err := generateQueueACLpayload(permissions.AccessPolicies) - if err != nil { - return err - } - - params := url.Values{ - "comp": {"acl"}, - } - headers := q.qsc.client.getStandardHeaders() - headers["Content-Length"] = strconv.Itoa(length) - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) - resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, body, q.qsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return errors.New("Unable to set permissions") - } - - return nil -} - -func generateQueueACLpayload(policies []QueueAccessPolicy) (io.Reader, int, error) { - sil := SignedIdentifiers{ - SignedIdentifiers: []SignedIdentifier{}, - } - for _, qapd := range policies { - permission := qapd.generateQueuePermissions() - signedIdentifier := convertAccessPolicyToXMLStructs(qapd.ID, qapd.StartTime, qapd.ExpiryTime, permission) - sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) - } - return xmlMarshal(sil) -} - -func (qapd *QueueAccessPolicy) generateQueuePermissions() (permissions string) { - // generate the permissions string (raup). - // still want the end user API to have bool flags. - permissions = "" - - if qapd.CanRead { - permissions += "r" - } - - if qapd.CanAdd { - permissions += "a" - } - - if qapd.CanUpdate { - permissions += "u" - } - - if qapd.CanProcess { - permissions += "p" - } - - return permissions -} - -// GetQueuePermissionOptions includes options for a get queue permissions operation -type GetQueuePermissionOptions struct { - Timeout uint - RequestID string `header:"x-ms-client-request-id"` -} - -// GetPermissions gets the queue permissions as per https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-acl -// If timeout is 0 then it will not be passed to Azure -func (q *Queue) GetPermissions(options *GetQueuePermissionOptions) (*QueuePermissions, error) { - params := url.Values{ - "comp": {"acl"}, - } - headers := q.qsc.client.getStandardHeaders() - - if options != nil { - params = addTimeout(params, options.Timeout) - headers = mergeHeaders(headers, headersFromStruct(*options)) - } - uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) - resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - var ap AccessPolicy - err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) - if err != nil { - return nil, err - } - return buildQueueAccessPolicy(ap, &resp.headers), nil -} - -func buildQueueAccessPolicy(ap AccessPolicy, headers *http.Header) *QueuePermissions { - permissions := QueuePermissions{ - AccessPolicies: []QueueAccessPolicy{}, - } - - for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { - qapd := QueueAccessPolicy{ - ID: policy.ID, - StartTime: policy.AccessPolicy.StartTime, - ExpiryTime: policy.AccessPolicy.ExpiryTime, - } - qapd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") - qapd.CanAdd = updatePermissions(policy.AccessPolicy.Permission, "a") - qapd.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u") - qapd.CanProcess = updatePermissions(policy.AccessPolicy.Permission, "p") - - permissions.AccessPolicies = append(permissions.AccessPolicies, qapd) - } - return &permissions -} +package storage + +import ( + "encoding/xml" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strconv" + "time" +) + +const ( + // casing is per Golang's http.Header canonicalizing the header names. + approximateMessagesCountHeader = "X-Ms-Approximate-Messages-Count" +) + +// QueueAccessPolicy represents each access policy in the queue ACL. +type QueueAccessPolicy struct { + ID string + StartTime time.Time + ExpiryTime time.Time + CanRead bool + CanAdd bool + CanUpdate bool + CanProcess bool +} + +// QueuePermissions represents the queue ACLs. +type QueuePermissions struct { + AccessPolicies []QueueAccessPolicy +} + +// SetQueuePermissionOptions includes options for a set queue permissions operation +type SetQueuePermissionOptions struct { + Timeout uint + RequestID string `header:"x-ms-client-request-id"` +} + +// Queue represents an Azure queue. +type Queue struct { + qsc *QueueServiceClient + Name string + Metadata map[string]string + AproxMessageCount uint64 +} + +func (q *Queue) buildPath() string { + return fmt.Sprintf("/%s", q.Name) +} + +func (q *Queue) buildPathMessages() string { + return fmt.Sprintf("%s/messages", q.buildPath()) +} + +// QueueServiceOptions includes options for some queue service operations +type QueueServiceOptions struct { + Timeout uint + RequestID string `header:"x-ms-client-request-id"` +} + +// Create operation creates a queue under the given account. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Queue4 +func (q *Queue) Create(options *QueueServiceOptions) error { + params := url.Values{} + headers := q.qsc.client.getStandardHeaders() + headers = q.qsc.client.addMetadataToHeaders(headers, q.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) + + resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, nil, q.qsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusCreated}) +} + +// Delete operation permanently deletes the specified queue. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Queue3 +func (q *Queue) Delete(options *QueueServiceOptions) error { + params := url.Values{} + headers := q.qsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) + resp, err := q.qsc.client.exec(http.MethodDelete, uri, headers, nil, q.qsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) +} + +// Exists returns true if a queue with given name exists. +func (q *Queue) Exists() (bool, error) { + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}}) + resp, err := q.qsc.client.exec(http.MethodGet, uri, q.qsc.client.getStandardHeaders(), nil, q.qsc.auth) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusOK, nil + } + } + return false, err +} + +// SetMetadata operation sets user-defined metadata on the specified queue. +// Metadata is associated with the queue as name-value pairs. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata +func (q *Queue) SetMetadata(options *QueueServiceOptions) error { + params := url.Values{"comp": {"metadata"}} + headers := q.qsc.client.getStandardHeaders() + headers = q.qsc.client.addMetadataToHeaders(headers, q.Metadata) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) + + resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, nil, q.qsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) +} + +// GetMetadata operation retrieves user-defined metadata and queue +// properties on the specified queue. Metadata is associated with +// the queue as name-values pairs. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata +// +// Because the way Golang's http client (and http.Header in particular) +// canonicalize header names, the returned metadata names would always +// be all lower case. +func (q *Queue) GetMetadata(options *QueueServiceOptions) error { + params := url.Values{"comp": {"metadata"}} + headers := q.qsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}}) + + resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return err + } + + aproxMessagesStr := resp.headers.Get(http.CanonicalHeaderKey(approximateMessagesCountHeader)) + if aproxMessagesStr != "" { + aproxMessages, err := strconv.ParseUint(aproxMessagesStr, 10, 64) + if err != nil { + return err + } + q.AproxMessageCount = aproxMessages + } + + q.Metadata = getMetadataFromHeaders(resp.headers) + return nil +} + +// GetMessageReference returns a message object with the specified text. +func (q *Queue) GetMessageReference(text string) *Message { + return &Message{ + Queue: q, + Text: text, + } +} + +// GetMessagesOptions is the set of options can be specified for Get +// Messsages operation. A zero struct does not use any preferences for the +// request. +type GetMessagesOptions struct { + Timeout uint + NumOfMessages int + VisibilityTimeout int + RequestID string `header:"x-ms-client-request-id"` +} + +type messages struct { + XMLName xml.Name `xml:"QueueMessagesList"` + Messages []Message `xml:"QueueMessage"` +} + +// GetMessages operation retrieves one or more messages from the front of the +// queue. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Messages +func (q *Queue) GetMessages(options *GetMessagesOptions) ([]Message, error) { + query := url.Values{} + headers := q.qsc.client.getStandardHeaders() + + if options != nil { + if options.NumOfMessages != 0 { + query.Set("numofmessages", strconv.Itoa(options.NumOfMessages)) + } + if options.VisibilityTimeout != 0 { + query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout)) + } + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), query) + + resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) + if err != nil { + return []Message{}, err + } + defer readAndCloseBody(resp.body) + + var out messages + err = xmlUnmarshal(resp.body, &out) + if err != nil { + return []Message{}, err + } + for i := range out.Messages { + out.Messages[i].Queue = q + } + return out.Messages, err +} + +// PeekMessagesOptions is the set of options can be specified for Peek +// Messsage operation. A zero struct does not use any preferences for the +// request. +type PeekMessagesOptions struct { + Timeout uint + NumOfMessages int + RequestID string `header:"x-ms-client-request-id"` +} + +// PeekMessages retrieves one or more messages from the front of the queue, but +// does not alter the visibility of the message. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Peek-Messages +func (q *Queue) PeekMessages(options *PeekMessagesOptions) ([]Message, error) { + query := url.Values{"peekonly": {"true"}} // Required for peek operation + headers := q.qsc.client.getStandardHeaders() + + if options != nil { + if options.NumOfMessages != 0 { + query.Set("numofmessages", strconv.Itoa(options.NumOfMessages)) + } + query = addTimeout(query, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), query) + + resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) + if err != nil { + return []Message{}, err + } + defer readAndCloseBody(resp.body) + + var out messages + err = xmlUnmarshal(resp.body, &out) + if err != nil { + return []Message{}, err + } + for i := range out.Messages { + out.Messages[i].Queue = q + } + return out.Messages, err +} + +// ClearMessages operation deletes all messages from the specified queue. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Clear-Messages +func (q *Queue) ClearMessages(options *QueueServiceOptions) error { + params := url.Values{} + headers := q.qsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), params) + + resp, err := q.qsc.client.exec(http.MethodDelete, uri, headers, nil, q.qsc.auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusNoContent}) +} + +// SetPermissions sets up queue permissions +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-acl +func (q *Queue) SetPermissions(permissions QueuePermissions, options *SetQueuePermissionOptions) error { + body, length, err := generateQueueACLpayload(permissions.AccessPolicies) + if err != nil { + return err + } + + params := url.Values{ + "comp": {"acl"}, + } + headers := q.qsc.client.getStandardHeaders() + headers["Content-Length"] = strconv.Itoa(length) + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) + resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, body, q.qsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return errors.New("Unable to set permissions") + } + + return nil +} + +func generateQueueACLpayload(policies []QueueAccessPolicy) (io.Reader, int, error) { + sil := SignedIdentifiers{ + SignedIdentifiers: []SignedIdentifier{}, + } + for _, qapd := range policies { + permission := qapd.generateQueuePermissions() + signedIdentifier := convertAccessPolicyToXMLStructs(qapd.ID, qapd.StartTime, qapd.ExpiryTime, permission) + sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) + } + return xmlMarshal(sil) +} + +func (qapd *QueueAccessPolicy) generateQueuePermissions() (permissions string) { + // generate the permissions string (raup). + // still want the end user API to have bool flags. + permissions = "" + + if qapd.CanRead { + permissions += "r" + } + + if qapd.CanAdd { + permissions += "a" + } + + if qapd.CanUpdate { + permissions += "u" + } + + if qapd.CanProcess { + permissions += "p" + } + + return permissions +} + +// GetQueuePermissionOptions includes options for a get queue permissions operation +type GetQueuePermissionOptions struct { + Timeout uint + RequestID string `header:"x-ms-client-request-id"` +} + +// GetPermissions gets the queue permissions as per https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-acl +// If timeout is 0 then it will not be passed to Azure +func (q *Queue) GetPermissions(options *GetQueuePermissionOptions) (*QueuePermissions, error) { + params := url.Values{ + "comp": {"acl"}, + } + headers := q.qsc.client.getStandardHeaders() + + if options != nil { + params = addTimeout(params, options.Timeout) + headers = mergeHeaders(headers, headersFromStruct(*options)) + } + uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params) + resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + + var ap AccessPolicy + err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) + if err != nil { + return nil, err + } + return buildQueueAccessPolicy(ap, &resp.headers), nil +} + +func buildQueueAccessPolicy(ap AccessPolicy, headers *http.Header) *QueuePermissions { + permissions := QueuePermissions{ + AccessPolicies: []QueueAccessPolicy{}, + } + + for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { + qapd := QueueAccessPolicy{ + ID: policy.ID, + StartTime: policy.AccessPolicy.StartTime, + ExpiryTime: policy.AccessPolicy.ExpiryTime, + } + qapd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") + qapd.CanAdd = updatePermissions(policy.AccessPolicy.Permission, "a") + qapd.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u") + qapd.CanProcess = updatePermissions(policy.AccessPolicy.Permission, "p") + + permissions.AccessPolicies = append(permissions.AccessPolicies, qapd) + } + return &permissions +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go index 9672e4fc76..dbed7cacd7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue_test.go @@ -1,361 +1,361 @@ -package storage - -import ( - "time" - - chk "gopkg.in/check.v1" -) - -type StorageQueueSuite struct{} - -var _ = chk.Suite(&StorageQueueSuite{}) - -func getQueueClient(c *chk.C) *QueueServiceClient { - cli := getBasicClient(c).GetQueueService() - return &cli -} - -func (s *StorageQueueSuite) Test_pathForQueue(c *chk.C) { - c.Assert(getQueueClient(c). - GetQueueReference("q"). - buildPath(), chk.Equals, "/q") -} - -func (s *StorageQueueSuite) Test_pathForQueueMessages(c *chk.C) { - c.Assert(getQueueClient(c). - GetQueueReference("q"). - buildPathMessages(), chk.Equals, "/q/messages") -} - -func (s *StorageQueueSuite) TestCreateQueue_DeleteQueue(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - q := cli.GetQueueReference(queueName(c)) - c.Assert(q.Create(nil), chk.IsNil) - c.Assert(q.Delete(nil), chk.IsNil) -} - -func (s *StorageQueueSuite) Test_GetMetadata_GetApproximateCount(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - err := queue1.GetMetadata(nil) - c.Assert(err, chk.IsNil) - c.Assert(queue1.AproxMessageCount, chk.Equals, uint64(0)) - - queue2 := cli.GetQueueReference(queueName(c, "2")) - c.Assert(queue2.Create(nil), chk.IsNil) - defer queue2.Delete(nil) - for ix := 0; ix < 3; ix++ { - msg := queue2.GetMessageReference("lolrofl") - err = msg.Put(nil) - c.Assert(err, chk.IsNil) - } - time.Sleep(1 * time.Second) - - err = queue2.GetMetadata(nil) - c.Assert(err, chk.IsNil) - c.Assert(queue2.AproxMessageCount, chk.Equals, uint64(3)) -} - -func (s *StorageQueueSuite) Test_SetMetadataGetMetadata_Roundtrips(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - metadata := make(map[string]string) - metadata["Lol1"] = "rofl1" - metadata["lolBaz"] = "rofl" - queue1.Metadata = metadata - err := queue1.SetMetadata(nil) - c.Assert(err, chk.IsNil) - - err = queue1.GetMetadata(nil) - c.Assert(err, chk.IsNil) - c.Assert(queue1.Metadata["lol1"], chk.Equals, metadata["Lol1"]) - c.Assert(queue1.Metadata["lolbaz"], chk.Equals, metadata["lolBaz"]) -} - -func (s *StorageQueueSuite) TestQueueExists(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "nonexistent")) - ok, err := queue1.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - queue2 := cli.GetQueueReference(queueName(c, "exisiting")) - c.Assert(queue2.Create(nil), chk.IsNil) - defer queue2.Delete(nil) - - ok, err = queue2.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageQueueSuite) TestGetMessages(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue := cli.GetQueueReference(queueName(c)) - c.Assert(queue.Create(nil), chk.IsNil) - defer queue.Delete(nil) - - msg := queue.GetMessageReference("message") - n := 4 - for i := 0; i < n; i++ { - c.Assert(msg.Put(nil), chk.IsNil) - } - - list, err := queue.GetMessages(&GetMessagesOptions{NumOfMessages: n}) - c.Assert(err, chk.IsNil) - c.Assert(len(list), chk.Equals, n) -} - -func (s *StorageQueueSuite) TestDeleteMessages(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue := cli.GetQueueReference(queueName(c)) - c.Assert(queue.Create(nil), chk.IsNil) - defer queue.Delete(nil) - - msg := queue.GetMessageReference("message") - c.Assert(msg.Put(nil), chk.IsNil) - list, err := queue.GetMessages(&GetMessagesOptions{VisibilityTimeout: 1}) - c.Assert(err, chk.IsNil) - c.Assert(len(list), chk.Equals, 1) - msg = &(list[0]) - c.Assert(msg.Delete(nil), chk.IsNil) -} - -func queueName(c *chk.C, extras ...string) string { - // 63 is the max len for shares - return nameGenerator(63, "queue-", alphanum, c, extras) -} - -func (s *StorageQueueSuite) Test_SetPermissionsAllTrueNoTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - CanRead: true, - CanAdd: true, - CanUpdate: true, - CanProcess: true, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - err := queue1.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageQueueSuite) Test_SetPermissionsAllTrueWithTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - CanRead: true, - CanAdd: true, - CanUpdate: true, - CanProcess: true, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - - options := SetQueuePermissionOptions{Timeout: 30} - err := queue1.SetPermissions(perms, &options) - c.Assert(err, chk.IsNil) - -} - -func (s *StorageQueueSuite) Test_SetPermissionsAlternateTrueNoTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - CanRead: true, - CanAdd: false, - CanUpdate: true, - CanProcess: false, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - err := queue1.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageQueueSuite) Test_SetPermissionsAlternateTrueWithTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), - CanRead: true, - CanAdd: false, - CanUpdate: true, - CanProcess: false, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - - options := SetQueuePermissionOptions{Timeout: 30} - err := queue1.SetPermissions(perms, &options) - c.Assert(err, chk.IsNil) -} - -func (s *StorageQueueSuite) Test_GetPermissionsAllTrueNoTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.UTC), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.UTC), - CanRead: true, - CanAdd: true, - CanUpdate: true, - CanProcess: true, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - err := queue1.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) - - returnedPerms, err := queue1.GetPermissions(nil) - c.Assert(err, chk.IsNil) - c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 1) - - c.Assert(returnedPerms.AccessPolicies[0].CanRead, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanAdd, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanUpdate, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanProcess, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].ID, chk.Equals, "GolangRocksOnAzure") - c.Assert(returnedPerms.AccessPolicies[0].StartTime, chk.Equals, qapd.StartTime) - c.Assert(returnedPerms.AccessPolicies[0].ExpiryTime, chk.Equals, qapd.ExpiryTime) -} - -func (s *StorageQueueSuite) Test_GetPermissionsAllTrueWithTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.UTC), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.UTC), - CanRead: true, - CanAdd: true, - CanUpdate: true, - CanProcess: true, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - err := queue1.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) - - options := GetQueuePermissionOptions{Timeout: 30} - returnedPerms, err := queue1.GetPermissions(&options) - c.Assert(err, chk.IsNil) - c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 1) - - c.Assert(returnedPerms.AccessPolicies[0].CanRead, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanAdd, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanUpdate, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanProcess, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].ID, chk.Equals, "GolangRocksOnAzure") - c.Assert(returnedPerms.AccessPolicies[0].StartTime, chk.Equals, qapd.StartTime) - c.Assert(returnedPerms.AccessPolicies[0].ExpiryTime, chk.Equals, qapd.ExpiryTime) - -} - -func (s *StorageQueueSuite) Test_GetPermissionsAlternateTrueNoTimeout(c *chk.C) { - cli := getQueueClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - queue1 := cli.GetQueueReference(queueName(c, "1")) - c.Assert(queue1.Create(nil), chk.IsNil) - defer queue1.Delete(nil) - - perms := QueuePermissions{} - qapd := QueueAccessPolicy{ - ID: "GolangRocksOnAzure", - StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.UTC), - ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.UTC), - CanRead: true, - CanAdd: false, - CanUpdate: true, - CanProcess: false, - } - perms.AccessPolicies = append(perms.AccessPolicies, qapd) - err := queue1.SetPermissions(perms, nil) - c.Assert(err, chk.IsNil) - - returnedPerms, err := queue1.GetPermissions(nil) - c.Assert(err, chk.IsNil) - c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 1) - - c.Assert(returnedPerms.AccessPolicies[0].CanRead, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanAdd, chk.Equals, false) - c.Assert(returnedPerms.AccessPolicies[0].CanUpdate, chk.Equals, true) - c.Assert(returnedPerms.AccessPolicies[0].CanProcess, chk.Equals, false) - c.Assert(returnedPerms.AccessPolicies[0].ID, chk.Equals, "GolangRocksOnAzure") - c.Assert(returnedPerms.AccessPolicies[0].StartTime, chk.Equals, qapd.StartTime) - c.Assert(returnedPerms.AccessPolicies[0].ExpiryTime, chk.Equals, qapd.ExpiryTime) -} +package storage + +import ( + "time" + + chk "gopkg.in/check.v1" +) + +type StorageQueueSuite struct{} + +var _ = chk.Suite(&StorageQueueSuite{}) + +func getQueueClient(c *chk.C) *QueueServiceClient { + cli := getBasicClient(c).GetQueueService() + return &cli +} + +func (s *StorageQueueSuite) Test_pathForQueue(c *chk.C) { + c.Assert(getQueueClient(c). + GetQueueReference("q"). + buildPath(), chk.Equals, "/q") +} + +func (s *StorageQueueSuite) Test_pathForQueueMessages(c *chk.C) { + c.Assert(getQueueClient(c). + GetQueueReference("q"). + buildPathMessages(), chk.Equals, "/q/messages") +} + +func (s *StorageQueueSuite) TestCreateQueue_DeleteQueue(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + q := cli.GetQueueReference(queueName(c)) + c.Assert(q.Create(nil), chk.IsNil) + c.Assert(q.Delete(nil), chk.IsNil) +} + +func (s *StorageQueueSuite) Test_GetMetadata_GetApproximateCount(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + err := queue1.GetMetadata(nil) + c.Assert(err, chk.IsNil) + c.Assert(queue1.AproxMessageCount, chk.Equals, uint64(0)) + + queue2 := cli.GetQueueReference(queueName(c, "2")) + c.Assert(queue2.Create(nil), chk.IsNil) + defer queue2.Delete(nil) + for ix := 0; ix < 3; ix++ { + msg := queue2.GetMessageReference("lolrofl") + err = msg.Put(nil) + c.Assert(err, chk.IsNil) + } + time.Sleep(1 * time.Second) + + err = queue2.GetMetadata(nil) + c.Assert(err, chk.IsNil) + c.Assert(queue2.AproxMessageCount, chk.Equals, uint64(3)) +} + +func (s *StorageQueueSuite) Test_SetMetadataGetMetadata_Roundtrips(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + metadata := make(map[string]string) + metadata["Lol1"] = "rofl1" + metadata["lolBaz"] = "rofl" + queue1.Metadata = metadata + err := queue1.SetMetadata(nil) + c.Assert(err, chk.IsNil) + + err = queue1.GetMetadata(nil) + c.Assert(err, chk.IsNil) + c.Assert(queue1.Metadata["lol1"], chk.Equals, metadata["Lol1"]) + c.Assert(queue1.Metadata["lolbaz"], chk.Equals, metadata["lolBaz"]) +} + +func (s *StorageQueueSuite) TestQueueExists(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "nonexistent")) + ok, err := queue1.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + + queue2 := cli.GetQueueReference(queueName(c, "exisiting")) + c.Assert(queue2.Create(nil), chk.IsNil) + defer queue2.Delete(nil) + + ok, err = queue2.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) +} + +func (s *StorageQueueSuite) TestGetMessages(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue := cli.GetQueueReference(queueName(c)) + c.Assert(queue.Create(nil), chk.IsNil) + defer queue.Delete(nil) + + msg := queue.GetMessageReference("message") + n := 4 + for i := 0; i < n; i++ { + c.Assert(msg.Put(nil), chk.IsNil) + } + + list, err := queue.GetMessages(&GetMessagesOptions{NumOfMessages: n}) + c.Assert(err, chk.IsNil) + c.Assert(len(list), chk.Equals, n) +} + +func (s *StorageQueueSuite) TestDeleteMessages(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue := cli.GetQueueReference(queueName(c)) + c.Assert(queue.Create(nil), chk.IsNil) + defer queue.Delete(nil) + + msg := queue.GetMessageReference("message") + c.Assert(msg.Put(nil), chk.IsNil) + list, err := queue.GetMessages(&GetMessagesOptions{VisibilityTimeout: 1}) + c.Assert(err, chk.IsNil) + c.Assert(len(list), chk.Equals, 1) + msg = &(list[0]) + c.Assert(msg.Delete(nil), chk.IsNil) +} + +func queueName(c *chk.C, extras ...string) string { + // 63 is the max len for shares + return nameGenerator(63, "queue-", alphanum, c, extras) +} + +func (s *StorageQueueSuite) Test_SetPermissionsAllTrueNoTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + CanRead: true, + CanAdd: true, + CanUpdate: true, + CanProcess: true, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + err := queue1.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageQueueSuite) Test_SetPermissionsAllTrueWithTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + CanRead: true, + CanAdd: true, + CanUpdate: true, + CanProcess: true, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + + options := SetQueuePermissionOptions{Timeout: 30} + err := queue1.SetPermissions(perms, &options) + c.Assert(err, chk.IsNil) + +} + +func (s *StorageQueueSuite) Test_SetPermissionsAlternateTrueNoTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + CanRead: true, + CanAdd: false, + CanUpdate: true, + CanProcess: false, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + err := queue1.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageQueueSuite) Test_SetPermissionsAlternateTrueWithTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)), + CanRead: true, + CanAdd: false, + CanUpdate: true, + CanProcess: false, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + + options := SetQueuePermissionOptions{Timeout: 30} + err := queue1.SetPermissions(perms, &options) + c.Assert(err, chk.IsNil) +} + +func (s *StorageQueueSuite) Test_GetPermissionsAllTrueNoTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.UTC), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.UTC), + CanRead: true, + CanAdd: true, + CanUpdate: true, + CanProcess: true, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + err := queue1.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) + + returnedPerms, err := queue1.GetPermissions(nil) + c.Assert(err, chk.IsNil) + c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 1) + + c.Assert(returnedPerms.AccessPolicies[0].CanRead, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanAdd, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanUpdate, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanProcess, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].ID, chk.Equals, "GolangRocksOnAzure") + c.Assert(returnedPerms.AccessPolicies[0].StartTime, chk.Equals, qapd.StartTime) + c.Assert(returnedPerms.AccessPolicies[0].ExpiryTime, chk.Equals, qapd.ExpiryTime) +} + +func (s *StorageQueueSuite) Test_GetPermissionsAllTrueWithTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.UTC), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.UTC), + CanRead: true, + CanAdd: true, + CanUpdate: true, + CanProcess: true, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + err := queue1.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) + + options := GetQueuePermissionOptions{Timeout: 30} + returnedPerms, err := queue1.GetPermissions(&options) + c.Assert(err, chk.IsNil) + c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 1) + + c.Assert(returnedPerms.AccessPolicies[0].CanRead, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanAdd, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanUpdate, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanProcess, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].ID, chk.Equals, "GolangRocksOnAzure") + c.Assert(returnedPerms.AccessPolicies[0].StartTime, chk.Equals, qapd.StartTime) + c.Assert(returnedPerms.AccessPolicies[0].ExpiryTime, chk.Equals, qapd.ExpiryTime) + +} + +func (s *StorageQueueSuite) Test_GetPermissionsAlternateTrueNoTimeout(c *chk.C) { + cli := getQueueClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + queue1 := cli.GetQueueReference(queueName(c, "1")) + c.Assert(queue1.Create(nil), chk.IsNil) + defer queue1.Delete(nil) + + perms := QueuePermissions{} + qapd := QueueAccessPolicy{ + ID: "GolangRocksOnAzure", + StartTime: time.Date(2050, time.December, 20, 21, 55, 0, 0, time.UTC), + ExpiryTime: time.Date(2051, time.December, 20, 21, 55, 0, 0, time.UTC), + CanRead: true, + CanAdd: false, + CanUpdate: true, + CanProcess: false, + } + perms.AccessPolicies = append(perms.AccessPolicies, qapd) + err := queue1.SetPermissions(perms, nil) + c.Assert(err, chk.IsNil) + + returnedPerms, err := queue1.GetPermissions(nil) + c.Assert(err, chk.IsNil) + c.Assert(returnedPerms.AccessPolicies, chk.HasLen, 1) + + c.Assert(returnedPerms.AccessPolicies[0].CanRead, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanAdd, chk.Equals, false) + c.Assert(returnedPerms.AccessPolicies[0].CanUpdate, chk.Equals, true) + c.Assert(returnedPerms.AccessPolicies[0].CanProcess, chk.Equals, false) + c.Assert(returnedPerms.AccessPolicies[0].ID, chk.Equals, "GolangRocksOnAzure") + c.Assert(returnedPerms.AccessPolicies[0].StartTime, chk.Equals, qapd.StartTime) + c.Assert(returnedPerms.AccessPolicies[0].ExpiryTime, chk.Equals, qapd.ExpiryTime) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go index 1befae9597..19b44941c8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go @@ -1,28 +1,28 @@ -package storage - -// QueueServiceClient contains operations for Microsoft Azure Queue Storage -// Service. -type QueueServiceClient struct { - client Client - auth authentication -} - -// GetServiceProperties gets the properties of your storage account's queue service. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-service-properties -func (q *QueueServiceClient) GetServiceProperties() (*ServiceProperties, error) { - return q.client.getServiceProperties(queueServiceName, q.auth) -} - -// SetServiceProperties sets the properties of your storage account's queue service. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-service-properties -func (q *QueueServiceClient) SetServiceProperties(props ServiceProperties) error { - return q.client.setServiceProperties(props, queueServiceName, q.auth) -} - -// GetQueueReference returns a Container object for the specified queue name. -func (q *QueueServiceClient) GetQueueReference(name string) *Queue { - return &Queue{ - qsc: q, - Name: name, - } -} +package storage + +// QueueServiceClient contains operations for Microsoft Azure Queue Storage +// Service. +type QueueServiceClient struct { + client Client + auth authentication +} + +// GetServiceProperties gets the properties of your storage account's queue service. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-service-properties +func (q *QueueServiceClient) GetServiceProperties() (*ServiceProperties, error) { + return q.client.getServiceProperties(queueServiceName, q.auth) +} + +// SetServiceProperties sets the properties of your storage account's queue service. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-service-properties +func (q *QueueServiceClient) SetServiceProperties(props ServiceProperties) error { + return q.client.setServiceProperties(props, queueServiceName, q.auth) +} + +// GetQueueReference returns a Container object for the specified queue name. +func (q *QueueServiceClient) GetQueueReference(name string) *Queue { + return &Queue{ + qsc: q, + Name: name, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlob.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlob.yaml index 3658bc24d9..3faa753baf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlob.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlob.yaml @@ -1,144 +1,144 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:07kEhjVvT7scsIriqXm/Vq5FSf755FYhiTtdysdqTio= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B88484CF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2776-0001-00d8-135c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3Mfqo3fM8Si0nVB13L6crv4CkD2lhffQX7/qljGXg3w= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe/blob/33appendblobsuitetestputappendblob - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B8774760"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac278f-0001-00d8-285c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:sZtDp+RCsUdXbCUjS7B5JdziEMO6gBUflCDIEA0QgGc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe/blob/33appendblobsuitetestputappendblob - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "0" - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B8774760"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Committed-Block-Count: - - "0" - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac279a-0001-00d8-335c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:U4DxWrvscz7sFHwg2NJxbljiq3lk6BsB02gg+M28Lj4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac27ab-0001-00d8-435c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:07kEhjVvT7scsIriqXm/Vq5FSf755FYhiTtdysdqTio= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B88484CF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2776-0001-00d8-135c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3Mfqo3fM8Si0nVB13L6crv4CkD2lhffQX7/qljGXg3w= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe/blob/33appendblobsuitetestputappendblob + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B8774760"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac278f-0001-00d8-285c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:sZtDp+RCsUdXbCUjS7B5JdziEMO6gBUflCDIEA0QgGc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe/blob/33appendblobsuitetestputappendblob + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "0" + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B8774760"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Committed-Block-Count: + - "0" + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac279a-0001-00d8-335c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:U4DxWrvscz7sFHwg2NJxbljiq3lk6BsB02gg+M28Lj4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33appendblobsuitetestputappe?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac27ab-0001-00d8-435c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlobAppendBlocks.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlobAppendBlocks.yaml index a83c32cff5..49db118f9a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlobAppendBlocks.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AppendBlobSuite/TestPutAppendBlobAppendBlocks.yaml @@ -1,338 +1,338 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:XlOsbAOAYkekh490YtBgTbNrrWsSV3GbrAJiQd+QJG0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B8A4BCAB"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac27b9-0001-00d8-4f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:v2W4RsHq6pPfq9rgnND/I2PpRwBfa3mPBKzrYdwiL0Y= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B897A67A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac27d9-0001-00d8-695c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:0aT4sgI1ivi5dNTZsCpLGxICHzbjQZh+CPKG2bVo7NA= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks?comp=appendblock - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B89ED3B6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Append-Offset: - - "0" - X-Ms-Blob-Committed-Block-Count: - - "1" - X-Ms-Request-Id: - - 5eac27ea-0001-00d8-795c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SIjwjmSWo1QiqvcC1hyw5KzusuuHhmTTLZuPSZUKjbY= - Range: - - bytes=0-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:02 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Range: - - bytes 0-1023/1024 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B89ED3B6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Committed-Block-Count: - - "1" - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2802-0001-00d8-0e5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GGYuVRViEJhQ1gIT5RIQ4n+pYAnpmg1dXYgNdEINaNY= - Content-Length: - - "512" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks?comp=appendblock - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B8AE66E0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Append-Offset: - - "1024" - X-Ms-Blob-Committed-Block-Count: - - "2" - X-Ms-Request-Id: - - 5eac2817-0001-00d8-225c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/91TcnQGQMpMpGIbP8e+TNBF3z4x/Tik2sLquji9KX4= - Range: - - bytes=0-1535 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1536" - Content-Range: - - bytes 0-1535/1536 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B8AE66E0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Committed-Block-Count: - - "2" - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2831-0001-00d8-3a5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ISwxNOU6AKWxzk5pFfVwnZBYhZ6jfp8kizMWhyw6LLI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2845-0001-00d8-4b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XlOsbAOAYkekh490YtBgTbNrrWsSV3GbrAJiQd+QJG0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B8A4BCAB"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac27b9-0001-00d8-4f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:v2W4RsHq6pPfq9rgnND/I2PpRwBfa3mPBKzrYdwiL0Y= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B897A67A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac27d9-0001-00d8-695c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0aT4sgI1ivi5dNTZsCpLGxICHzbjQZh+CPKG2bVo7NA= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks?comp=appendblock + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B89ED3B6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Append-Offset: + - "0" + X-Ms-Blob-Committed-Block-Count: + - "1" + X-Ms-Request-Id: + - 5eac27ea-0001-00d8-795c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SIjwjmSWo1QiqvcC1hyw5KzusuuHhmTTLZuPSZUKjbY= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:02 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Range: + - bytes 0-1023/1024 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B89ED3B6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Committed-Block-Count: + - "1" + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2802-0001-00d8-0e5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GGYuVRViEJhQ1gIT5RIQ4n+pYAnpmg1dXYgNdEINaNY= + Content-Length: + - "512" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks?comp=appendblock + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B8AE66E0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Append-Offset: + - "1024" + X-Ms-Blob-Committed-Block-Count: + - "2" + X-Ms-Request-Id: + - 5eac2817-0001-00d8-225c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/91TcnQGQMpMpGIbP8e+TNBF3z4x/Tik2sLquji9KX4= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe/blob/45appendblobsuitetestputappendblobappendblocks + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum + dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1536" + Content-Range: + - bytes 0-1535/1536 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B8AE66E0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Committed-Block-Count: + - "2" + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2831-0001-00d8-3a5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ISwxNOU6AKWxzk5pFfVwnZBYhZ6jfp8kizMWhyw6LLI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45appendblobsuitetestputappe?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2845-0001-00d8-4b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AuthorizationSuite/Test_allSharedKeys.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AuthorizationSuite/Test_allSharedKeys.yaml index 365f367d5c..dd55116aa3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AuthorizationSuite/Test_allSharedKeys.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/AuthorizationSuite/Test_allSharedKeys.yaml @@ -1,294 +1,294 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:It7tOGp8rbzY+Q3pcOJdvZT6cwlJ82Hb+48q08dbHHc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-137authorizationsuitetestall?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Etag: - - '"0x8D47C73B8DA7C1C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2853-0001-00d8-565c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bBV/4NZR7DQezTxKv3Zw0fRbiZgL0gWwDSRbaJDPJo8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-137authorizationsuitetestall?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:02 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2862-0001-00d8-635c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: | - {"TableName":"table137authorizationsuitetestal"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:E4tcp+kirxlirJfl+WwfJ2q0EVQlLcgUspVij6QdEB8= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table137authorizationsuitetestal') - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table137authorizationsuitetestal') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33a89a-0002-0064-575c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:62/72ceV3DJX5JiAKHkL1PpXMVHdkq309m1Eqlz3KiY= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table137authorizationsuitetestal%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33a8c0-0002-0064-7a5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:O/bbN0MM9/Ru2OYB2h0Kslgi63e8BnkfKLszBMKrC7Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-237authorizationsuitetestall?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B91F325D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac291d-0001-00d8-095c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:cpQe7x1zi5dpaviFgn3tevZ72NMk5Nlt9dRANTcHNqQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-237authorizationsuitetestall?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2933-0001-00d8-1a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: | - {"TableName":"table237authorizationsuitetestal"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKeyLite golangrocksonazure:PVhNyKcfn69NyeQcrmT8irFE17bOEiRmKrdQoEVfWzc= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table237authorizationsuitetestal') - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table237authorizationsuitetestal') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33a8f0-0002-0064-285c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKeyLite golangrocksonazure:ffkeY+Rpp44wFaJUOHOScSSYkEoQ1YiHMLJu4Eg7uuA= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table237authorizationsuitetestal%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33a8f8-0002-0064-2f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:It7tOGp8rbzY+Q3pcOJdvZT6cwlJ82Hb+48q08dbHHc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-137authorizationsuitetestall?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Etag: + - '"0x8D47C73B8DA7C1C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2853-0001-00d8-565c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bBV/4NZR7DQezTxKv3Zw0fRbiZgL0gWwDSRbaJDPJo8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-137authorizationsuitetestall?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:02 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2862-0001-00d8-635c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: | + {"TableName":"table137authorizationsuitetestal"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:E4tcp+kirxlirJfl+WwfJ2q0EVQlLcgUspVij6QdEB8= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table137authorizationsuitetestal') + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table137authorizationsuitetestal') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33a89a-0002-0064-575c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:62/72ceV3DJX5JiAKHkL1PpXMVHdkq309m1Eqlz3KiY= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table137authorizationsuitetestal%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33a8c0-0002-0064-7a5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:O/bbN0MM9/Ru2OYB2h0Kslgi63e8BnkfKLszBMKrC7Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-237authorizationsuitetestall?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B91F325D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac291d-0001-00d8-095c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cpQe7x1zi5dpaviFgn3tevZ72NMk5Nlt9dRANTcHNqQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-237authorizationsuitetestall?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2933-0001-00d8-1a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: | + {"TableName":"table237authorizationsuitetestal"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKeyLite golangrocksonazure:PVhNyKcfn69NyeQcrmT8irFE17bOEiRmKrdQoEVfWzc= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table237authorizationsuitetestal') + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table237authorizationsuitetestal') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33a8f0-0002-0064-285c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKeyLite golangrocksonazure:ffkeY+Rpp44wFaJUOHOScSSYkEoQ1YiHMLJu4Eg7uuA= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table237authorizationsuitetestal%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33a8f8-0002-0064-2f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlobSASURISuite/TestBlobSASURICorrectness.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlobSASURISuite/TestBlobSASURICorrectness.yaml index 1b46005637..716df90053 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlobSASURISuite/TestBlobSASURICorrectness.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlobSASURISuite/TestBlobSASURICorrectness.yaml @@ -1,142 +1,142 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+YWsX3g2o7AtOnIS6KSvAoruvRLu6V81yAMbqPjXwUY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBEA9011"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac30df-0001-00d8-375c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phase - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bkiDi+JwoJlXJnhMHH9mquD+oqtZhrg30gFxjA7rG9g= - Content-Length: - - "100" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas/Lorem/Lorem-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=%20Lorem - method: PUT - response: - body: "" - headers: - Content-Md5: - - Bcz94Jycda959ev/eJWOhw== - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBDD2F2F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac30f8-0001-00d8-4d5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: {} - url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas/Lorem/Lorem-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=%20Lorem?se=2050-12-20T22%3A55%3A06Z&sig=TB9D2vV6JfVyxR2YTJUDMG76D9x0Jr8kpX%2FpwUuX0cY%3D&sp=r&spr=https%2Chttp&sr=b&sv=2016-05-31 - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phase - headers: - Accept-Ranges: - - bytes - Content-Length: - - "100" - Content-Md5: - - Bcz94Jycda959ev/eJWOhw== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBDD2F2F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac3110-0001-00d8-625c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:KDYpZYiijlG0fVsAkJEl4GtAR95p6E3PI9yS5tuIOOA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3134-0001-00d8-055c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+YWsX3g2o7AtOnIS6KSvAoruvRLu6V81yAMbqPjXwUY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBEA9011"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac30df-0001-00d8-375c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phase + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bkiDi+JwoJlXJnhMHH9mquD+oqtZhrg30gFxjA7rG9g= + Content-Length: + - "100" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas/Lorem/Lorem-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=%20Lorem + method: PUT + response: + body: "" + headers: + Content-Md5: + - Bcz94Jycda959ev/eJWOhw== + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBDD2F2F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac30f8-0001-00d8-4d5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: {} + url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas/Lorem/Lorem-._~:%3F%23%5B%5D@%21$&%27%28%29%2A,;+=%20Lorem?se=2050-12-20T22%3A55%3A06Z&sig=TB9D2vV6JfVyxR2YTJUDMG76D9x0Jr8kpX%2FpwUuX0cY%3D&sp=r&spr=https%2Chttp&sr=b&sv=2016-05-31 + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phase + headers: + Accept-Ranges: + - bytes + Content-Length: + - "100" + Content-Md5: + - Bcz94Jycda959ev/eJWOhw== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBDD2F2F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac3110-0001-00d8-625c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KDYpZYiijlG0fVsAkJEl4GtAR95p6E3PI9yS5tuIOOA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41blobsasurisuitetestblobsas?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3134-0001-00d8-055c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlob.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlob.yaml index 795a93f49d..4be8f256f5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlob.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlob.yaml @@ -1,136 +1,136 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:x+VXNUjNKEejGIM602hv8O35Q7v/pHRYYYqU0LSNlDQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BC08CBC4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3164-0001-00d8-355c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:tjkT936bV3Lzb4HhpmHoZFCcvKlCwIAQbsBwN5Rs2Rs= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl/blob/34blockblobsuitetestcreateblockblob - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBFB6B06"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3184-0001-00d8-4f5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Sb6Ag91qTlpNB5pYGznRFrytSnUIYARWkgYAwj+CzA0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl/blob/34blockblobsuitetestcreateblockblob?blocklisttype=all&comp=blocklist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BBFB6B06"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Length: - - "0" - X-Ms-Request-Id: - - 5eac3193-0001-00d8-5e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:qyPqO+vOaCElQ5K1+WP7BtqK3HNjRceS4qrSVwKxMFQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac31a6-0001-00d8-6e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:x+VXNUjNKEejGIM602hv8O35Q7v/pHRYYYqU0LSNlDQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BC08CBC4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3164-0001-00d8-355c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tjkT936bV3Lzb4HhpmHoZFCcvKlCwIAQbsBwN5Rs2Rs= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl/blob/34blockblobsuitetestcreateblockblob + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBFB6B06"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3184-0001-00d8-4f5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Sb6Ag91qTlpNB5pYGznRFrytSnUIYARWkgYAwj+CzA0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl/blob/34blockblobsuitetestcreateblockblob?blocklisttype=all&comp=blocklist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BBFB6B06"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "0" + X-Ms-Request-Id: + - 5eac3193-0001-00d8-5e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qyPqO+vOaCElQ5K1+WP7BtqK3HNjRceS4qrSVwKxMFQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-34blockblobsuitetestcreatebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac31a6-0001-00d8-6e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReader.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReader.yaml index d1ece7ba0a..cf9daabfdc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReader.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReader.yaml @@ -1,370 +1,370 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:730+mIga/KMHk4QPUO6FbTmkaJrA7Z/MTDlWi2IRPxI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC277CBB"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac31b3-0001-00d8-795c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Lx2zPw0dwCDRdQi3/0gEW6w6oP8pptoS+aoXZp5/a8M= - Content-Length: - - "8888" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl/blob/44blockblobsuitetestcreateblockblobfromreader - method: PUT - response: - body: "" - headers: - Content-Md5: - - Ck/NLXf/Ku+Vjw/wgLi74w== - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC1A9162"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac31be-0001-00d8-035c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mYd/dUqJysyX2L5RnKOFHtPFveZIggZwCTb9tSyOA1g= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl/blob/44blockblobsuitetestcreateblockblobfromreader - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas - headers: - Accept-Ranges: - - bytes - Content-Length: - - "8888" - Content-Md5: - - Ck/NLXf/Ku+Vjw/wgLi74w== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC1A9162"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac31d1-0001-00d8-145c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:0whOCVaVlGqgIY+Q7FU//MR+ASLDo0cgV9DumYxGoqw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac31dd-0001-00d8-1d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:730+mIga/KMHk4QPUO6FbTmkaJrA7Z/MTDlWi2IRPxI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC277CBB"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac31b3-0001-00d8-795c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Lx2zPw0dwCDRdQi3/0gEW6w6oP8pptoS+aoXZp5/a8M= + Content-Length: + - "8888" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl/blob/44blockblobsuitetestcreateblockblobfromreader + method: PUT + response: + body: "" + headers: + Content-Md5: + - Ck/NLXf/Ku+Vjw/wgLi74w== + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC1A9162"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac31be-0001-00d8-035c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mYd/dUqJysyX2L5RnKOFHtPFveZIggZwCTb9tSyOA1g= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl/blob/44blockblobsuitetestcreateblockblobfromreader + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas + headers: + Accept-Ranges: + - bytes + Content-Length: + - "8888" + Content-Md5: + - Ck/NLXf/Ku+Vjw/wgLi74w== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC1A9162"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac31d1-0001-00d8-145c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0whOCVaVlGqgIY+Q7FU//MR+ASLDo0cgV9DumYxGoqw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestcreatebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac31dd-0001-00d8-1d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReaderWithShortData.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReaderWithShortData.yaml index 5c4ca2e933..f489fc7775 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReaderWithShortData.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestCreateBlockBlobFromReaderWithShortData.yaml @@ -1,93 +1,93 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1TtdjJhpJlArfKwTbLMJjrQzqcLMFUqxSpffDPAOBaE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-57blockblobsuitetestcreatebl?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC4829DB"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac31eb-0001-00d8-295c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Vuqlh8mtRnkNRB6+f/x1MCbBiKz1j7HB3sNn3IrgD8c= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-57blockblobsuitetestcreatebl/blob/57blockblobsuitetestcreateblockblobfromreaderwithshortdata - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x32\x30\x61\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x32\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x38\x2E\x38\x35\x36\x32\x31\x34\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "215" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac320a-0001-00d8-425c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified blob does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PejiDBm5jfJpYo7WGgf1+EcIZFilJYvELPy6P6eVdA0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-57blockblobsuitetestcreatebl?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac322b-0001-00d8-605c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1TtdjJhpJlArfKwTbLMJjrQzqcLMFUqxSpffDPAOBaE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-57blockblobsuitetestcreatebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC4829DB"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac31eb-0001-00d8-295c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Vuqlh8mtRnkNRB6+f/x1MCbBiKz1j7HB3sNn3IrgD8c= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-57blockblobsuitetestcreatebl/blob/57blockblobsuitetestcreateblockblobfromreaderwithshortdata + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x32\x30\x61\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x32\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x38\x2E\x38\x35\x36\x32\x31\x34\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "215" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac320a-0001-00d8-425c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PejiDBm5jfJpYo7WGgf1+EcIZFilJYvELPy6P6eVdA0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-57blockblobsuitetestcreatebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac322b-0001-00d8-605c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestGetBlockList_PutBlockList.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestGetBlockList_PutBlockList.yaml index 457f82bb5e..1ad9e470a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestGetBlockList_PutBlockList.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestGetBlockList_PutBlockList.yaml @@ -1,264 +1,264 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:aj+Uds0qvE3hUpIBsA9+sk3QwrOqp59CLefMHeFO92o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC6022E3"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3269-0001-00d8-175c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dxUYQ6SDd/fNf7vkMpqfdVp1eQMwZDpwI5BcPv+va5Q= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blockid=bG9s&comp=block - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3284-0001-00d8-2e5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JTwOCcwn/PDtRwn6socX3NusF0ojW+i80awtICTxAXc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blocklisttype=committed&comp=blocklist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac328e-0001-00d8-385c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IuorNNFXzmFGmJJNuWYiswJXBsrh9gttfo6vhSDZO8o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blocklisttype=uncommitted&comp=blocklist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x42\x6C\x6F\x63\x6B\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x47\x39\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x69\x7A\x65\x3E\x31\x30\x32\x34\x3C\x2F\x53\x69\x7A\x65\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x3E\x3C\x2F\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac32a3-0001-00d8-455c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: bG9s - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:EkuqEYQQ/ZVy58Z62ceUQC/mgG/lzyVIGXzydeTmU7k= - Content-Length: - - "92" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?comp=blocklist - method: PUT - response: - body: "" - headers: - Content-Md5: - - LXMsw7piGMWWhhOuwh7iGA== - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC69D11A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac32bf-0001-00d8-5f5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Xjf10Nk1LO2UzWfBqG1WpnzYSJFVkX9+doJ/vhbcaYo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blocklisttype=all&comp=blocklist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x42\x6C\x6F\x63\x6B\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x47\x39\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x69\x7A\x65\x3E\x31\x30\x32\x34\x3C\x2F\x53\x69\x7A\x65\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x3E\x3C\x2F\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC69D11A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Length: - - "1024" - X-Ms-Request-Id: - - 5eac32d0-0001-00d8-6e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YS0nPKn0l1ZbTskvpoMLUaL4Wq5GsBnTGuKUz+dkr2c= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac32e6-0001-00d8-7f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HrVonHjT2jBzGGU4vLEzHoZeP0dcwAl4bAci47evbz0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac32f1-0001-00d8-095c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aj+Uds0qvE3hUpIBsA9+sk3QwrOqp59CLefMHeFO92o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC6022E3"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3269-0001-00d8-175c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dxUYQ6SDd/fNf7vkMpqfdVp1eQMwZDpwI5BcPv+va5Q= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blockid=bG9s&comp=block + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3284-0001-00d8-2e5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JTwOCcwn/PDtRwn6socX3NusF0ojW+i80awtICTxAXc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blocklisttype=committed&comp=blocklist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac328e-0001-00d8-385c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IuorNNFXzmFGmJJNuWYiswJXBsrh9gttfo6vhSDZO8o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blocklisttype=uncommitted&comp=blocklist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x42\x6C\x6F\x63\x6B\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x47\x39\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x69\x7A\x65\x3E\x31\x30\x32\x34\x3C\x2F\x53\x69\x7A\x65\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x3E\x3C\x2F\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac32a3-0001-00d8-455c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: bG9s + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EkuqEYQQ/ZVy58Z62ceUQC/mgG/lzyVIGXzydeTmU7k= + Content-Length: + - "92" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?comp=blocklist + method: PUT + response: + body: "" + headers: + Content-Md5: + - LXMsw7piGMWWhhOuwh7iGA== + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC69D11A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac32bf-0001-00d8-5f5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xjf10Nk1LO2UzWfBqG1WpnzYSJFVkX9+doJ/vhbcaYo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist?blocklisttype=all&comp=blocklist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E\x3C\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x42\x6C\x6F\x63\x6B\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x47\x39\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x69\x7A\x65\x3E\x31\x30\x32\x34\x3C\x2F\x53\x69\x7A\x65\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x3E\x3C\x2F\x43\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x3E\x3C\x55\x6E\x63\x6F\x6D\x6D\x69\x74\x74\x65\x64\x42\x6C\x6F\x63\x6B\x73\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x63\x6B\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC69D11A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "1024" + X-Ms-Request-Id: + - 5eac32d0-0001-00d8-6e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YS0nPKn0l1ZbTskvpoMLUaL4Wq5GsBnTGuKUz+dkr2c= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock/blob/44blockblobsuitetestgetblocklistputblocklist + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac32e6-0001-00d8-7f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HrVonHjT2jBzGGU4vLEzHoZeP0dcwAl4bAci47evbz0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44blockblobsuitetestgetblock?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac32f1-0001-00d8-095c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlock.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlock.yaml index 4527424945..6be0f3baa5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlock.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutBlock.yaml @@ -1,107 +1,107 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bpdAuttAqjy3ANr825mL4OjUB/tUFHjm+pqIuO6uSNY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Etag: - - '"0x8D47C73BC9B88A8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac32fa-0001-00d8-115c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:h9cEbgrw3hbdEvQCNLpJXDFDvz2XKAQV+iYpYeayxeY= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock/blob/27blockblobsuitetestputblock?blockid=bG9s&comp=block - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:08 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3307-0001-00d8-1b5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2Q5qLq26mnuT/e38b11ulL/1/c5WJQ1l2K9ZwBWABvo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac330e-0001-00d8-225c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bpdAuttAqjy3ANr825mL4OjUB/tUFHjm+pqIuO6uSNY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Etag: + - '"0x8D47C73BC9B88A8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac32fa-0001-00d8-115c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:h9cEbgrw3hbdEvQCNLpJXDFDvz2XKAQV+iYpYeayxeY= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock/blob/27blockblobsuitetestputblock?blockid=bG9s&comp=block + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:08 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3307-0001-00d8-1b5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2Q5qLq26mnuT/e38b11ulL/1/c5WJQ1l2K9ZwBWABvo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-27blockblobsuitetestputblock?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac330e-0001-00d8-225c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutEmptyBlockBlob.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutEmptyBlockBlob.yaml index 7c01fd1418..0faaff474a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutEmptyBlockBlob.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/BlockBlobSuite/TestPutEmptyBlockBlob.yaml @@ -1,148 +1,148 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1Um6Np2laSFA2/9LIlnoxelOxi4O9oJaHD41uoiVez4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BCB2700C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3320-0001-00d8-315c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7YKkIUEe8HtX5oz19KMHsVcL/+k4eEsennYTBqsqEAA= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty/blob/36blockblobsuitetestputemptyblockblob - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BCA5371A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac333b-0001-00d8-495c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SrgBc7FWmZSezaK/S+zeijAEg1RxJgR1/v0m2PhZZRI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty/blob/36blockblobsuitetestputemptyblockblob - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "6" - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BCA5371A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac3348-0001-00d8-535c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FhILYilbCYtRaiblbXOc7kzLf2GBVHO/XjHRTsIwQ9c= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3355-0001-00d8-5e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1Um6Np2laSFA2/9LIlnoxelOxi4O9oJaHD41uoiVez4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BCB2700C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3320-0001-00d8-315c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7YKkIUEe8HtX5oz19KMHsVcL/+k4eEsennYTBqsqEAA= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty/blob/36blockblobsuitetestputemptyblockblob + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BCA5371A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac333b-0001-00d8-495c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SrgBc7FWmZSezaK/S+zeijAEg1RxJgR1/v0m2PhZZRI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty/blob/36blockblobsuitetestputemptyblockblob + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "6" + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BCA5371A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac3348-0001-00d8-535c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FhILYilbCYtRaiblbXOc7kzLf2GBVHO/XjHRTsIwQ9c= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-36blockblobsuitetestputempty?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3355-0001-00d8-5e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestContainerExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestContainerExists.yaml index e2dfd7e8dd..f735811023 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestContainerExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestContainerExists.yaml @@ -1,124 +1,124 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:VbziVYphAJqdy58Mc5VB/ZwP22GjGaMkYlM9EAzbJDU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-134containersuitetestcontain?restype=container - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3379-0001-00d8-795c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified container does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:b481+dpQtmF7zoLWaIyVqsS30qf0W7NxQ1D4YEmP6Hg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BCEB8B7E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3385-0001-00d8-015c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gkUCXmBlCQyJTY01AOOYOogKVRqijKyuTK54DDvwclg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BCEB8B7E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac3393-0001-00d8-0c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DLx/9U7PIOMKL+VWL8QTTXsdwzD78NKk/qETwMQs4oE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac339f-0001-00d8-145c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VbziVYphAJqdy58Mc5VB/ZwP22GjGaMkYlM9EAzbJDU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-134containersuitetestcontain?restype=container + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3379-0001-00d8-795c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:b481+dpQtmF7zoLWaIyVqsS30qf0W7NxQ1D4YEmP6Hg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BCEB8B7E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3385-0001-00d8-015c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gkUCXmBlCQyJTY01AOOYOogKVRqijKyuTK54DDvwclg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BCEB8B7E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac3393-0001-00d8-0c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DLx/9U7PIOMKL+VWL8QTTXsdwzD78NKk/qETwMQs4oE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-234containersuitetestcontain?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac339f-0001-00d8-145c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerDeleteContainer.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerDeleteContainer.yaml index 9e9605502d..93f11c06d9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerDeleteContainer.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerDeleteContainer.yaml @@ -1,62 +1,62 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:cyK/FWc/oK0SSk7fSCTrjJF7xstQSlEM08Bvcx8hYn4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49containersuitetestcreateco?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BD016163"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac33aa-0001-00d8-1f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:KZt3lfXe2+Zp+No79CJmsn9xg0nccDDbg1Fogv8kmb4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49containersuitetestcreateco?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac33b7-0001-00d8-295c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cyK/FWc/oK0SSk7fSCTrjJF7xstQSlEM08Bvcx8hYn4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49containersuitetestcreateco?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BD016163"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac33aa-0001-00d8-1f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KZt3lfXe2+Zp+No79CJmsn9xg0nccDDbg1Fogv8kmb4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49containersuitetestcreateco?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac33b7-0001-00d8-295c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfExists.yaml index a25e02c675..dbdacca77d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfExists.yaml @@ -1,35 +1,35 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:a+2QseFVOPlou96cdy3rOHCa7II4R8vL3pjti9m2OVE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42containersuitetestcreateco?restype=container - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x41\x6C\x72\x65\x61\x64\x79\x45\x78\x69\x73\x74\x73\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x33\x64\x63\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x61\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x30\x2E\x31\x37\x30\x31\x31\x34\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "230" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac33dc-0001-00d8-4a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 409 The specified container already exists. - code: 409 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:a+2QseFVOPlou96cdy3rOHCa7II4R8vL3pjti9m2OVE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42containersuitetestcreateco?restype=container + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x41\x6C\x72\x65\x61\x64\x79\x45\x78\x69\x73\x74\x73\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x33\x64\x63\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x61\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x30\x2E\x31\x37\x30\x31\x31\x34\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "230" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac33dc-0001-00d8-4a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 409 The specified container already exists. + code: 409 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfNotExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfNotExists.yaml index a1d9185b1b..91855c66c1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfNotExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestCreateContainerIfNotExists.yaml @@ -1,62 +1,62 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:qMhk61Z/Xk4NhMaGcfY0qYwOewJ36ufAfaZGthAj2a4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45containersuitetestcreateco?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Etag: - - '"0x8D47C73BD285114"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3406-0001-00d8-6f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NbaeGrXLyCIF4v8NwIqzMtRnNmEW17CNndCLthWc9ac= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45containersuitetestcreateco?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac341c-0001-00d8-805c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qMhk61Z/Xk4NhMaGcfY0qYwOewJ36ufAfaZGthAj2a4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45containersuitetestcreateco?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Etag: + - '"0x8D47C73BD285114"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3406-0001-00d8-6f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NbaeGrXLyCIF4v8NwIqzMtRnNmEW17CNndCLthWc9ac= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45containersuitetestcreateco?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac341c-0001-00d8-805c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestDeleteContainerIfExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestDeleteContainerIfExists.yaml index e4b3945590..5345eac782 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestDeleteContainerIfExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestDeleteContainerIfExists.yaml @@ -1,120 +1,120 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Xox9cA8T0hKJnhVSFRSvSqwvB4mJ7NshRZPJpAYkeNc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-142containersuitetestdeletec?restype=container - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3428-0001-00d8-0c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified container does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:zhJcPqeMLyyR2o5YKzXFL8LNOaB3oAqcnULfbziIWy8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-142containersuitetestdeletec?restype=container - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x34\x33\x63\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x31\x62\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x30\x2E\x34\x33\x38\x33\x30\x30\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "225" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac343c-0001-00d8-1b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified container does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:V5nP9+hg+jbiudZEQ0Vix5YaSIMA2g0IICjBYroPIrI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-242containersuitetestdeletec?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD492548"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac344a-0001-00d8-255c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:B+mRH3dKvKnCnmMYCtu+slW/GemSdspZQ0P41tbCGpo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-242containersuitetestdeletec?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3459-0001-00d8-305c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xox9cA8T0hKJnhVSFRSvSqwvB4mJ7NshRZPJpAYkeNc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-142containersuitetestdeletec?restype=container + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3428-0001-00d8-0c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zhJcPqeMLyyR2o5YKzXFL8LNOaB3oAqcnULfbziIWy8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-142containersuitetestdeletec?restype=container + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x34\x33\x63\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x31\x62\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x30\x2E\x34\x33\x38\x33\x30\x30\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "225" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac343c-0001-00d8-1b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:V5nP9+hg+jbiudZEQ0Vix5YaSIMA2g0IICjBYroPIrI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-242containersuitetestdeletec?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD492548"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac344a-0001-00d8-255c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B+mRH3dKvKnCnmMYCtu+slW/GemSdspZQ0P41tbCGpo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-242containersuitetestdeletec?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3459-0001-00d8-305c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsPagination.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsPagination.yaml index dfdbcea07d..e587e6aecc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsPagination.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsPagination.yaml @@ -1,344 +1,344 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:rm0Di9T4afhrHvyjaBfjq8sTYQfxg1T0ip9tV6bbmk0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD5CD7CF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3467-0001-00d8-395c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:vk3KgO7KgiMYzvjvPJLBnl2B/SR3HL3vu29X6JotMgE= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/038containersuitetestlistblobspagination - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD4F9F8E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac347b-0001-00d8-4b5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NpKqNFmYV+6QMvRDRmbhOWx8gExVMIa8r8qOqm0pgbs= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/138containersuitetestlistblobspagination - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD5AEC3C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34a0-0001-00d8-6c5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HIx3n3W/jzvJad4atAaQJkxiwB4sM3uIjiXbTM356kY= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/238containersuitetestlistblobspagination - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD62408E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34af-0001-00d8-795c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7R/ZMcuXUS/ZTeoCxgUqnOZuPRb2RAoGgbPoEk4W7bI= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/338containersuitetestlistblobspagination - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD6994E0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34c1-0001-00d8-0b5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1UkmGJspqTPPNn6Kn83lLqzqs37NvrERz8iMXtRcSno= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/438containersuitetestlistblobspagination - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD70E92D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34cc-0001-00d8-155c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HW6zlDnwAnA4UjmcVUBYxR0N2XYru4Bkz0MaXm3KqSc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?comp=list&maxresults=2&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x30\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x34\x46\x39\x46\x38\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x31\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x35\x41\x45\x43\x33\x43\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x32\x21\x31\x32\x30\x21\x4D\x44\x41\x77\x4D\x44\x51\x31\x49\x57\x4A\x73\x62\x32\x49\x76\x4D\x6A\x4D\x34\x59\x32\x39\x75\x64\x47\x46\x70\x62\x6D\x56\x79\x63\x33\x56\x70\x64\x47\x56\x30\x5A\x58\x4E\x30\x62\x47\x6C\x7A\x64\x47\x4A\x73\x62\x32\x4A\x7A\x63\x47\x46\x6E\x61\x57\x35\x68\x64\x47\x6C\x76\x62\x69\x45\x77\x4D\x44\x41\x77\x4D\x6A\x67\x68\x4F\x54\x6B\x35\x4F\x53\x30\x78\x4D\x69\x30\x7A\x4D\x56\x51\x79\x4D\x7A\x6F\x31\x4F\x54\x6F\x31\x4F\x53\x34\x35\x4F\x54\x6B\x35\x4F\x54\x6B\x35\x57\x69\x45\x2D\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34d5-0001-00d8-1d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9cb+HQHoJnhZQ5fzKTQxwsKL/bklGBVEam/gF4DWC7k= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?comp=list&marker=2%21120%21MDAwMDQ1IWJsb2IvMjM4Y29udGFpbmVyc3VpdGV0ZXN0bGlzdGJsb2JzcGFnaW5hdGlvbiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x62\x6C\x6F\x62\x2F\x32\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x32\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x36\x32\x34\x30\x38\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x33\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x36\x39\x39\x34\x45\x30\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x32\x21\x31\x32\x30\x21\x4D\x44\x41\x77\x4D\x44\x51\x31\x49\x57\x4A\x73\x62\x32\x49\x76\x4E\x44\x4D\x34\x59\x32\x39\x75\x64\x47\x46\x70\x62\x6D\x56\x79\x63\x33\x56\x70\x64\x47\x56\x30\x5A\x58\x4E\x30\x62\x47\x6C\x7A\x64\x47\x4A\x73\x62\x32\x4A\x7A\x63\x47\x46\x6E\x61\x57\x35\x68\x64\x47\x6C\x76\x62\x69\x45\x77\x4D\x44\x41\x77\x4D\x6A\x67\x68\x4F\x54\x6B\x35\x4F\x53\x30\x78\x4D\x69\x30\x7A\x4D\x56\x51\x79\x4D\x7A\x6F\x31\x4F\x54\x6F\x31\x4F\x53\x34\x35\x4F\x54\x6B\x35\x4F\x54\x6B\x35\x57\x69\x45\x2D\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34e9-0001-00d8-305c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Uyc7J218G+6tmKrHbhcZQV5IZJLukq6CclvHCg/P8gM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?comp=list&marker=2%21120%21MDAwMDQ1IWJsb2IvNDM4Y29udGFpbmVyc3VpdGV0ZXN0bGlzdGJsb2JzcGFnaW5hdGlvbiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x62\x6C\x6F\x62\x2F\x34\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x34\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x37\x30\x45\x39\x32\x44\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac34fd-0001-00d8-415c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ksAQWQ4YrUToDIbA6MCWVq8j7ff1jsDfM/pkCBEfbho= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3512-0001-00d8-555c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rm0Di9T4afhrHvyjaBfjq8sTYQfxg1T0ip9tV6bbmk0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD5CD7CF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3467-0001-00d8-395c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vk3KgO7KgiMYzvjvPJLBnl2B/SR3HL3vu29X6JotMgE= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/038containersuitetestlistblobspagination + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD4F9F8E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac347b-0001-00d8-4b5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NpKqNFmYV+6QMvRDRmbhOWx8gExVMIa8r8qOqm0pgbs= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/138containersuitetestlistblobspagination + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD5AEC3C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34a0-0001-00d8-6c5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HIx3n3W/jzvJad4atAaQJkxiwB4sM3uIjiXbTM356kY= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/238containersuitetestlistblobspagination + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD62408E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34af-0001-00d8-795c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7R/ZMcuXUS/ZTeoCxgUqnOZuPRb2RAoGgbPoEk4W7bI= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/338containersuitetestlistblobspagination + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD6994E0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34c1-0001-00d8-0b5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1UkmGJspqTPPNn6Kn83lLqzqs37NvrERz8iMXtRcSno= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob/blob/438containersuitetestlistblobspagination + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD70E92D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34cc-0001-00d8-155c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HW6zlDnwAnA4UjmcVUBYxR0N2XYru4Bkz0MaXm3KqSc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?comp=list&maxresults=2&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x30\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x34\x46\x39\x46\x38\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x31\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x35\x41\x45\x43\x33\x43\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x32\x21\x31\x32\x30\x21\x4D\x44\x41\x77\x4D\x44\x51\x31\x49\x57\x4A\x73\x62\x32\x49\x76\x4D\x6A\x4D\x34\x59\x32\x39\x75\x64\x47\x46\x70\x62\x6D\x56\x79\x63\x33\x56\x70\x64\x47\x56\x30\x5A\x58\x4E\x30\x62\x47\x6C\x7A\x64\x47\x4A\x73\x62\x32\x4A\x7A\x63\x47\x46\x6E\x61\x57\x35\x68\x64\x47\x6C\x76\x62\x69\x45\x77\x4D\x44\x41\x77\x4D\x6A\x67\x68\x4F\x54\x6B\x35\x4F\x53\x30\x78\x4D\x69\x30\x7A\x4D\x56\x51\x79\x4D\x7A\x6F\x31\x4F\x54\x6F\x31\x4F\x53\x34\x35\x4F\x54\x6B\x35\x4F\x54\x6B\x35\x57\x69\x45\x2D\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34d5-0001-00d8-1d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9cb+HQHoJnhZQ5fzKTQxwsKL/bklGBVEam/gF4DWC7k= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?comp=list&marker=2%21120%21MDAwMDQ1IWJsb2IvMjM4Y29udGFpbmVyc3VpdGV0ZXN0bGlzdGJsb2JzcGFnaW5hdGlvbiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x62\x6C\x6F\x62\x2F\x32\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x32\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x36\x32\x34\x30\x38\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x33\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x36\x39\x39\x34\x45\x30\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x32\x21\x31\x32\x30\x21\x4D\x44\x41\x77\x4D\x44\x51\x31\x49\x57\x4A\x73\x62\x32\x49\x76\x4E\x44\x4D\x34\x59\x32\x39\x75\x64\x47\x46\x70\x62\x6D\x56\x79\x63\x33\x56\x70\x64\x47\x56\x30\x5A\x58\x4E\x30\x62\x47\x6C\x7A\x64\x47\x4A\x73\x62\x32\x4A\x7A\x63\x47\x46\x6E\x61\x57\x35\x68\x64\x47\x6C\x76\x62\x69\x45\x77\x4D\x44\x41\x77\x4D\x6A\x67\x68\x4F\x54\x6B\x35\x4F\x53\x30\x78\x4D\x69\x30\x7A\x4D\x56\x51\x79\x4D\x7A\x6F\x31\x4F\x54\x6F\x31\x4F\x53\x34\x35\x4F\x54\x6B\x35\x4F\x54\x6B\x35\x57\x69\x45\x2D\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34e9-0001-00d8-305c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Uyc7J218G+6tmKrHbhcZQV5IZJLukq6CclvHCg/P8gM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?comp=list&marker=2%21120%21MDAwMDQ1IWJsb2IvNDM4Y29udGFpbmVyc3VpdGV0ZXN0bGlzdGJsb2JzcGFnaW5hdGlvbiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x62\x6C\x6F\x62\x2F\x34\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x34\x33\x38\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x70\x61\x67\x69\x6E\x61\x74\x69\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x30\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x37\x30\x45\x39\x32\x44\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac34fd-0001-00d8-415c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ksAQWQ4YrUToDIbA6MCWVq8j7ff1jsDfM/pkCBEfbho= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38containersuitetestlistblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3512-0001-00d8-555c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsTraversal.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsTraversal.yaml index a251c2259d..db5b88d98a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsTraversal.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsTraversal.yaml @@ -1,402 +1,402 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3GUIiNsP7eC9ChOVsT2Vn9NurSKUnhHEpk5AmxDcHCw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BDAADE80"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac352b-0001-00d8-6e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:O61HK2klIIpDJrg6mGtcnZ5N1EUsrgkZ+V6cMmT3gKA= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//usr/bin/ls - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BD9D5863"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3546-0001-00d8-055c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Wg1pns/LeRaZHz0MulOxh0YiUV63o2jXvzAQ6AJ9Lu0= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//usr/bin/cat - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BDA4859E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3557-0001-00d8-145c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Jf9ppMX9Bae6Yigi12jN6bxSF2gnt7rUi7mE/66DyYQ= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//usr/lib64/libc.so - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BDABD9F1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3565-0001-00d8-215c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gsFWwAUM+kYMr8n4YF9zTLbDgXqb54kL5op5LtZM9wk= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//etc/hosts - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BDB30727"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3573-0001-00d8-2e5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yV0gM94Yt0kSk+MQEPG7dAUkLxeuOTbC/BB6vy1QxXE= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//etc/init.d/iptables - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Etag: - - '"0x8D47C73BDBA3462"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac357d-0001-00d8-355c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:EG6SjdwRFmuUYdsdef9V/8u+LlEt1t9veYzza/daXfg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2F&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:10 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac358d-0001-00d8-425c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SQxc+nTXMP5RJy/cRpmhQpNh6VWiGQsKEOO9c9vjqrY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fetc%2F&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x65\x74\x63\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x68\x6F\x73\x74\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x42\x33\x30\x37\x32\x37\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x69\x6E\x69\x74\x2E\x64\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac359b-0001-00d8-4f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Bw8FUx8n/Wn5SstZbGvkCDh3c0E237FcjaZlQoxC+J4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fetc%2Finit.d%2F&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x65\x74\x63\x2F\x69\x6E\x69\x74\x2E\x64\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x69\x6E\x69\x74\x2E\x64\x2F\x69\x70\x74\x61\x62\x6C\x65\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x42\x41\x33\x34\x36\x32\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac35a6-0001-00d8-565c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TR+0oDLjIbsJozE7o6o3uJo6C6D3fZnkeytqrOc7PmM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fusr%2F&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x75\x73\x72\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x6C\x69\x62\x36\x34\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac35b9-0001-00d8-665c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:T2u5NXENCmLER0EnyW2s5efXAlyWY8TM+pVlYhagssQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fusr%2Fbin%2F&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x63\x61\x74\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x41\x34\x38\x35\x39\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x6C\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x39\x44\x35\x38\x36\x33\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac35db-0001-00d8-035c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:opOTsDisGmgskNaIqGoPts/av/KvW4bF/yNdXJuC4Ww= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac35e1-0001-00d8-095c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3GUIiNsP7eC9ChOVsT2Vn9NurSKUnhHEpk5AmxDcHCw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BDAADE80"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac352b-0001-00d8-6e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:O61HK2klIIpDJrg6mGtcnZ5N1EUsrgkZ+V6cMmT3gKA= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//usr/bin/ls + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BD9D5863"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3546-0001-00d8-055c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Wg1pns/LeRaZHz0MulOxh0YiUV63o2jXvzAQ6AJ9Lu0= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//usr/bin/cat + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BDA4859E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3557-0001-00d8-145c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Jf9ppMX9Bae6Yigi12jN6bxSF2gnt7rUi7mE/66DyYQ= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//usr/lib64/libc.so + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BDABD9F1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3565-0001-00d8-215c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gsFWwAUM+kYMr8n4YF9zTLbDgXqb54kL5op5LtZM9wk= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//etc/hosts + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BDB30727"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3573-0001-00d8-2e5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yV0gM94Yt0kSk+MQEPG7dAUkLxeuOTbC/BB6vy1QxXE= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob//etc/init.d/iptables + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Etag: + - '"0x8D47C73BDBA3462"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac357d-0001-00d8-355c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EG6SjdwRFmuUYdsdef9V/8u+LlEt1t9veYzza/daXfg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2F&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:10 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac358d-0001-00d8-425c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SQxc+nTXMP5RJy/cRpmhQpNh6VWiGQsKEOO9c9vjqrY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fetc%2F&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x65\x74\x63\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x68\x6F\x73\x74\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x42\x33\x30\x37\x32\x37\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x69\x6E\x69\x74\x2E\x64\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac359b-0001-00d8-4f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Bw8FUx8n/Wn5SstZbGvkCDh3c0E237FcjaZlQoxC+J4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fetc%2Finit.d%2F&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x65\x74\x63\x2F\x69\x6E\x69\x74\x2E\x64\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x65\x74\x63\x2F\x69\x6E\x69\x74\x2E\x64\x2F\x69\x70\x74\x61\x62\x6C\x65\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x42\x41\x33\x34\x36\x32\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac35a6-0001-00d8-565c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TR+0oDLjIbsJozE7o6o3uJo6C6D3fZnkeytqrOc7PmM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fusr%2F&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x75\x73\x72\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x6C\x69\x62\x36\x34\x2F\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x2F\x42\x6C\x6F\x62\x50\x72\x65\x66\x69\x78\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac35b9-0001-00d8-665c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:T2u5NXENCmLER0EnyW2s5efXAlyWY8TM+pVlYhagssQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?comp=list&delimiter=%2F&prefix=%2Fusr%2Fbin%2F&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x33\x37\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x50\x72\x65\x66\x69\x78\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x3C\x2F\x50\x72\x65\x66\x69\x78\x3E\x3C\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x2F\x3C\x2F\x44\x65\x6C\x69\x6D\x69\x74\x65\x72\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x63\x61\x74\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x41\x34\x38\x35\x39\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x6C\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x44\x39\x44\x35\x38\x36\x33\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x30\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x31\x42\x32\x4D\x32\x59\x38\x41\x73\x67\x54\x70\x67\x41\x6D\x59\x37\x50\x68\x43\x66\x67\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac35db-0001-00d8-035c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:opOTsDisGmgskNaIqGoPts/av/KvW4bF/yNdXJuC4Ww= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-37containersuitetestlistblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac35e1-0001-00d8-095c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsWithMetadata.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsWithMetadata.yaml index b315dda332..ddcd830e3d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsWithMetadata.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListBlobsWithMetadata.yaml @@ -1,582 +1,582 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:iWLThoDaJ6jAtKj/zrTmSHAM1LT/GTNKwJxZo/k8E1M= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE062DEE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac35f2-0001-00d8-185c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QBcuMmyJCBmizF0G86MaLqKstbM7tcGttprsoGC22sI= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/040containersuitetestlistblobswithmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BDF992C2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3607-0001-00d8-2b5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:qi2yAlTq57ArYlEx0X+SEVg6Vl9WphAqp+5yM9FTNYg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:11 GMT - X-Ms-Meta-Lol: - - blob/040containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/040containersuitetestlistblobswithmetadata?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE00BFFD"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3617-0001-00d8-365c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ZpZRwhgbT8v1civqNVzXAMmewBIgBd2FaARvLGbefs4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/040containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/040containersuitetestlistblobswithmetadata?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE0AD3EE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac362f-0001-00d8-485c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:11.7546478Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Rd6EOYPNn2fb+jMFaegyZwsTh+hTlmTn9XCpY7Tw0UM= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/140containersuitetestlistblobswithmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE122840"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3646-0001-00d8-5b5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:lc4kc38SPeaKb3RclX3gC9eyFa2frwqWtiPG3CDLR3s= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/140containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/140containersuitetestlistblobswithmetadata?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE19557B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac365b-0001-00d8-6c5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Jd+pH/agJrsV0G9hMa5Ms1EM1lnXAozvb181GQ5ZXmk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/140containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/140containersuitetestlistblobswithmetadata?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE205B9F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac366f-0001-00d8-7e5c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:11.8957471Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TOkzvBGYlt2N/dqTj/2YRIhbCwpHalGGPjR5O9WPPkc= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/240containersuitetestlistblobswithmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE2B812D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:11 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac368c-0001-00d8-165c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ONnlCa52v2qUSgPO9bPncbcXwdQN2A/cwtIx/6vnxRQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/240containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/240containersuitetestlistblobswithmetadata?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE38CA06"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac369e-0001-00d8-265c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PtLLvfBingpPx1ZT67hu/akvO48sFwYoS5vwUWlLap4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/240containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/240containersuitetestlistblobswithmetadata?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE401E6D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac36b0-0001-00d8-385c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:12.1038957Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Xw6lLR7X43Xqvoe9y4KoIbeuhEopwjRWs/ojEOCF+EY= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/340containersuitetestlistblobswithmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE4772AE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac36ce-0001-00d8-525c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bOHf3GWRV6wodzAhFqn3vhP7kl/B+rAvWQbdwJhu9qU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/340containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/340containersuitetestlistblobswithmetadata?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE4E9FE1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac36e0-0001-00d8-645c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JKsGBVxWPhWPRExBUdmLr+7G+NeGoggEJ9A2ch15Rqs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Meta-Lol: - - blob/340containersuitetestlistblobswithmetadata - X-Ms-Meta-Rofl_baz: - - Waz Qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/340containersuitetestlistblobswithmetadata?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE590204"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac36f2-0001-00d8-6f5c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:12.2670084Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello, world! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YkGmjHzh4H2KXUs+PvcuR8V19hj4U2NzTfemOFahkHU= - Content-Length: - - "13" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/nometa40containersuitetestlistblobswithmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - bNNVbesNpUvKBgtMOUeYOQ== - Date: - - Wed, 05 Apr 2017 22:33:11 GMT - Etag: - - '"0x8D47C73BE602F3F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac370f-0001-00d8-0a5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Lr+sEDmUABGg4IJ3tFrSDZrKhm9rX3O5t6FJmUDBnKI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?comp=list&include=snapshots%2Cmetadata&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x31\x2E\x37\x35\x34\x36\x34\x37\x38\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x30\x41\x44\x33\x45\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x30\x30\x42\x46\x46\x44\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x31\x2E\x38\x39\x35\x37\x34\x37\x31\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x32\x30\x35\x42\x39\x46\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x31\x39\x35\x35\x37\x42\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x32\x2E\x31\x30\x33\x38\x39\x35\x37\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x34\x30\x31\x45\x36\x44\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x33\x38\x43\x41\x30\x36\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x32\x2E\x32\x36\x37\x30\x30\x38\x34\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x35\x39\x30\x32\x30\x34\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x34\x45\x39\x46\x45\x31\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x6E\x6F\x6D\x65\x74\x61\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x36\x30\x32\x46\x33\x46\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3728-0001-00d8-225c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IqNb3Oq6mLrEVU9TU2vtZ272a+nEftNW+lYk0KDzewo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3753-0001-00d8-495c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:iWLThoDaJ6jAtKj/zrTmSHAM1LT/GTNKwJxZo/k8E1M= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE062DEE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac35f2-0001-00d8-185c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QBcuMmyJCBmizF0G86MaLqKstbM7tcGttprsoGC22sI= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/040containersuitetestlistblobswithmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BDF992C2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3607-0001-00d8-2b5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qi2yAlTq57ArYlEx0X+SEVg6Vl9WphAqp+5yM9FTNYg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:11 GMT + X-Ms-Meta-Lol: + - blob/040containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/040containersuitetestlistblobswithmetadata?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE00BFFD"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3617-0001-00d8-365c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZpZRwhgbT8v1civqNVzXAMmewBIgBd2FaARvLGbefs4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/040containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/040containersuitetestlistblobswithmetadata?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE0AD3EE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac362f-0001-00d8-485c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:11.7546478Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Rd6EOYPNn2fb+jMFaegyZwsTh+hTlmTn9XCpY7Tw0UM= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/140containersuitetestlistblobswithmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE122840"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3646-0001-00d8-5b5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lc4kc38SPeaKb3RclX3gC9eyFa2frwqWtiPG3CDLR3s= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/140containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/140containersuitetestlistblobswithmetadata?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE19557B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac365b-0001-00d8-6c5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Jd+pH/agJrsV0G9hMa5Ms1EM1lnXAozvb181GQ5ZXmk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/140containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/140containersuitetestlistblobswithmetadata?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE205B9F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac366f-0001-00d8-7e5c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:11.8957471Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TOkzvBGYlt2N/dqTj/2YRIhbCwpHalGGPjR5O9WPPkc= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/240containersuitetestlistblobswithmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE2B812D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:11 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac368c-0001-00d8-165c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ONnlCa52v2qUSgPO9bPncbcXwdQN2A/cwtIx/6vnxRQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/240containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/240containersuitetestlistblobswithmetadata?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE38CA06"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac369e-0001-00d8-265c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PtLLvfBingpPx1ZT67hu/akvO48sFwYoS5vwUWlLap4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/240containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/240containersuitetestlistblobswithmetadata?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE401E6D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac36b0-0001-00d8-385c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:12.1038957Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xw6lLR7X43Xqvoe9y4KoIbeuhEopwjRWs/ojEOCF+EY= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/340containersuitetestlistblobswithmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE4772AE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac36ce-0001-00d8-525c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bOHf3GWRV6wodzAhFqn3vhP7kl/B+rAvWQbdwJhu9qU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/340containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/340containersuitetestlistblobswithmetadata?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE4E9FE1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac36e0-0001-00d8-645c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JKsGBVxWPhWPRExBUdmLr+7G+NeGoggEJ9A2ch15Rqs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Meta-Lol: + - blob/340containersuitetestlistblobswithmetadata + X-Ms-Meta-Rofl_baz: + - Waz Qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/340containersuitetestlistblobswithmetadata?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE590204"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac36f2-0001-00d8-6f5c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:12.2670084Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello, world! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YkGmjHzh4H2KXUs+PvcuR8V19hj4U2NzTfemOFahkHU= + Content-Length: + - "13" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob/blob/nometa40containersuitetestlistblobswithmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - bNNVbesNpUvKBgtMOUeYOQ== + Date: + - Wed, 05 Apr 2017 22:33:11 GMT + Etag: + - '"0x8D47C73BE602F3F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac370f-0001-00d8-0a5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Lr+sEDmUABGg4IJ3tFrSDZrKhm9rX3O5t6FJmUDBnKI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?comp=list&include=snapshots%2Cmetadata&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x61\x6D\x65\x3D\"\x63\x6E\x74\x2D\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\"\x3E\x3C\x42\x6C\x6F\x62\x73\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x31\x2E\x37\x35\x34\x36\x34\x37\x38\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x30\x41\x44\x33\x45\x45\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x30\x30\x42\x46\x46\x44\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x30\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x31\x2E\x38\x39\x35\x37\x34\x37\x31\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x32\x30\x35\x42\x39\x46\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x31\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x31\x39\x35\x35\x37\x42\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x31\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x32\x2E\x31\x30\x33\x38\x39\x35\x37\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x34\x30\x31\x45\x36\x44\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x33\x38\x43\x41\x30\x36\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x32\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x32\x2E\x32\x36\x37\x30\x30\x38\x34\x5A\x3C\x2F\x53\x6E\x61\x70\x73\x68\x6F\x74\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x35\x39\x30\x32\x30\x34\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x34\x45\x39\x46\x45\x31\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x4C\x6F\x6C\x3E\x62\x6C\x6F\x62\x2F\x33\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4C\x6F\x6C\x3E\x3C\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x57\x61\x7A\x20\x51\x75\x78\x3C\x2F\x52\x6F\x66\x6C\x5F\x62\x61\x7A\x3E\x3C\x2F\x4D\x65\x74\x61\x64\x61\x74\x61\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x42\x6C\x6F\x62\x3E\x3C\x4E\x61\x6D\x65\x3E\x62\x6C\x6F\x62\x2F\x6E\x6F\x6D\x65\x74\x61\x34\x30\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x62\x6C\x6F\x62\x73\x77\x69\x74\x68\x6D\x65\x74\x61\x64\x61\x74\x61\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x36\x30\x32\x46\x33\x46\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x31\x33\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x6F\x63\x74\x65\x74\x2D\x73\x74\x72\x65\x61\x6D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x45\x6E\x63\x6F\x64\x69\x6E\x67\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x61\x6E\x67\x75\x61\x67\x65\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x62\x4E\x4E\x56\x62\x65\x73\x4E\x70\x55\x76\x4B\x42\x67\x74\x4D\x4F\x55\x65\x59\x4F\x51\x3D\x3D\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4D\x44\x35\x3E\x3C\x43\x61\x63\x68\x65\x2D\x43\x6F\x6E\x74\x72\x6F\x6C\x20\x2F\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E\x20\x2F\x3E\x3C\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x42\x6C\x6F\x63\x6B\x42\x6C\x6F\x62\x3C\x2F\x42\x6C\x6F\x62\x54\x79\x70\x65\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x53\x65\x72\x76\x65\x72\x45\x6E\x63\x72\x79\x70\x74\x65\x64\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4D\x65\x74\x61\x64\x61\x74\x61\x20\x2F\x3E\x3C\x2F\x42\x6C\x6F\x62\x3E\x3C\x2F\x42\x6C\x6F\x62\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3728-0001-00d8-225c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IqNb3Oq6mLrEVU9TU2vtZ272a+nEftNW+lYk0KDzewo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40containersuitetestlistblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3753-0001-00d8-495c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListContainersPagination.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListContainersPagination.yaml index 29f82ca528..541aea6819 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListContainersPagination.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestListContainersPagination.yaml @@ -1,381 +1,381 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+a3Lm6EqRMw7S9m19q+6Trc8t6BljXgciGdnzPX+faw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-043containersuitetestlistcon?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BE9BF898"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3779-0001-00d8-6e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mdLvxOeZxKlVXlsuvEq65UAWkp4oIENzeFo9t19r+K4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-143containersuitetestlistcon?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BEA4ACB8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3794-0001-00d8-065c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3SyYBYeteaZI2a+sKGZucy9/S4TGHxSf61T65m41Pkg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-243containersuitetestlistcon?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BEAD60C8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac37b9-0001-00d8-275c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:RwEdYP9JqyVrQV8xJIGMj6lya2Kv5Yw5M74+XzBjSX4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:12 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-343containersuitetestlistcon?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BEB5EDCE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac37d0-0001-00d8-3a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:M95YM9KFRo60/ZeAH8K6aaB2i3LfqMlATYWPDK6Y+4Y= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-443containersuitetestlistcon?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BEBD421C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac37e9-0001-00d8-525c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:MMHBTl3/x0idwxrA/r0Ib4g20450nD9YwYyeDTImsh8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/?comp=list&maxresults=2 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x30\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x39\x42\x46\x38\x39\x38\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x31\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x41\x34\x41\x43\x42\x38\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x32\x33\x34\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x6F\x6E\x74\x61\x69\x6E\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3801-0001-00d8-665c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7cdFNVdvLukb62FLeWLeqZqLiq22AGYtcyYWAcTwUV0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/?comp=list&marker=%2Fgolangrocksonazure%2Fcnt-234containersuitetestcontain&maxresults=2 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x32\x33\x34\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x6F\x6E\x74\x61\x69\x6E\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x32\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x41\x44\x36\x30\x43\x38\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x33\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x42\x35\x45\x44\x43\x45\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x33\x34\x62\x6C\x6F\x63\x6B\x62\x6C\x6F\x62\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x72\x65\x61\x74\x65\x62\x6C\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3815-0001-00d8-775c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:hbTUFTGPhZrrfPf01j9CV9ZVbkKN3IzDNjDa4Mhcvkw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/?comp=list&marker=%2Fgolangrocksonazure%2Fcnt-34blockblobsuitetestcreatebl&maxresults=2 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x33\x34\x62\x6C\x6F\x63\x6B\x62\x6C\x6F\x62\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x72\x65\x61\x74\x65\x62\x6C\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x34\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x42\x44\x34\x32\x31\x43\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3830-0001-00d8-0d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TbWFHgPU6J+hkbZRASZgO8cQtgCo7vS0rv7UAUT73ho= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-443containersuitetestlistcon?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3847-0001-00d8-245c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:rkwvrusvW1OAzuGhKvVdwrAtVI8SR/Z/4PzmghkISOw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-343containersuitetestlistcon?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3866-0001-00d8-425c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gcnoNEkcIwwXJ/EVY1nev7lEUY6Fb0khdLmsmp7zBm8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-243containersuitetestlistcon?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac388c-0001-00d8-645c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:L2M4mlrnmsmXkN3po0Rl0PW9cOyw/6QE2PQuxx4ip1A= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-143containersuitetestlistcon?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac389f-0001-00d8-755c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:zaYJ+NF9ArU23f6nSjY5RFL5d24fBLO2SDhEZVMiY/s= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-043containersuitetestlistcon?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac38c3-0001-00d8-105c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+a3Lm6EqRMw7S9m19q+6Trc8t6BljXgciGdnzPX+faw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-043containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BE9BF898"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3779-0001-00d8-6e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mdLvxOeZxKlVXlsuvEq65UAWkp4oIENzeFo9t19r+K4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-143containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BEA4ACB8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3794-0001-00d8-065c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3SyYBYeteaZI2a+sKGZucy9/S4TGHxSf61T65m41Pkg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-243containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BEAD60C8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac37b9-0001-00d8-275c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RwEdYP9JqyVrQV8xJIGMj6lya2Kv5Yw5M74+XzBjSX4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:12 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-343containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BEB5EDCE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac37d0-0001-00d8-3a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:M95YM9KFRo60/ZeAH8K6aaB2i3LfqMlATYWPDK6Y+4Y= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-443containersuitetestlistcon?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BEBD421C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac37e9-0001-00d8-525c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MMHBTl3/x0idwxrA/r0Ib4g20450nD9YwYyeDTImsh8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/?comp=list&maxresults=2 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x30\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x39\x42\x46\x38\x39\x38\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x31\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x41\x34\x41\x43\x42\x38\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x32\x33\x34\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x6F\x6E\x74\x61\x69\x6E\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3801-0001-00d8-665c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7cdFNVdvLukb62FLeWLeqZqLiq22AGYtcyYWAcTwUV0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/?comp=list&marker=%2Fgolangrocksonazure%2Fcnt-234containersuitetestcontain&maxresults=2 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x32\x33\x34\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x6F\x6E\x74\x61\x69\x6E\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x32\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x41\x44\x36\x30\x43\x38\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x33\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x42\x35\x45\x44\x43\x45\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x33\x34\x62\x6C\x6F\x63\x6B\x62\x6C\x6F\x62\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x72\x65\x61\x74\x65\x62\x6C\x3C\x2F\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3815-0001-00d8-775c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hbTUFTGPhZrrfPf01j9CV9ZVbkKN3IzDNjDa4Mhcvkw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/?comp=list&marker=%2Fgolangrocksonazure%2Fcnt-34blockblobsuitetestcreatebl&maxresults=2 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x62\x6C\x6F\x62\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x72\x6B\x65\x72\x3E\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2F\x63\x6E\x74\x2D\x33\x34\x62\x6C\x6F\x63\x6B\x62\x6C\x6F\x62\x73\x75\x69\x74\x65\x74\x65\x73\x74\x63\x72\x65\x61\x74\x65\x62\x6C\x3C\x2F\x4D\x61\x72\x6B\x65\x72\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x32\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x4E\x61\x6D\x65\x3E\x63\x6E\x74\x2D\x34\x34\x33\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x63\x6F\x6E\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x31\x32\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x42\x45\x42\x44\x34\x32\x31\x43\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x75\x6E\x6C\x6F\x63\x6B\x65\x64\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x75\x73\x3E\x3C\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x3C\x2F\x4C\x65\x61\x73\x65\x53\x74\x61\x74\x65\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x3E\x3C\x2F\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3830-0001-00d8-0d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TbWFHgPU6J+hkbZRASZgO8cQtgCo7vS0rv7UAUT73ho= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-443containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3847-0001-00d8-245c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rkwvrusvW1OAzuGhKvVdwrAtVI8SR/Z/4PzmghkISOw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-343containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3866-0001-00d8-425c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gcnoNEkcIwwXJ/EVY1nev7lEUY6Fb0khdLmsmp7zBm8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-243containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac388c-0001-00d8-645c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L2M4mlrnmsmXkN3po0Rl0PW9cOyw/6QE2PQuxx4ip1A= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-143containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac389f-0001-00d8-755c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zaYJ+NF9ArU23f6nSjY5RFL5d24fBLO2SDhEZVMiY/s= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-043containersuitetestlistcon?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac38c3-0001-00d8-105c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsOnlySuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsOnlySuccessfully.yaml index e0fd4edb6e..ef6f9055a1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsOnlySuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsOnlySuccessfully.yaml @@ -1,97 +1,97 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HxlXNyznIblPu2IwuXYvfPlunwGl72wbViAEzTXBM+o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BF068CFF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac38e7-0001-00d8-325c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zrwd - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:8c7R60g2g8LXKkVejSZ84kAw/nznBVUlMJQFDpHlSgg= - Content-Length: - - "232" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?comp=acl&restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:12 GMT - Etag: - - '"0x8D47C73BF777FD3"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3904-0001-00d8-495c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:CTvatk4+qCzESakKLftn0RL37sNLrGjUQhN5KCXYaMQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3914-0001-00d8-585c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HxlXNyznIblPu2IwuXYvfPlunwGl72wbViAEzTXBM+o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BF068CFF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac38e7-0001-00d8-325c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zrwd + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8c7R60g2g8LXKkVejSZ84kAw/nznBVUlMJQFDpHlSgg= + Content-Length: + - "232" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?comp=acl&restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:12 GMT + Etag: + - '"0x8D47C73BF777FD3"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3904-0001-00d8-495c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CTvatk4+qCzESakKLftn0RL37sNLrGjUQhN5KCXYaMQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-58containersuitetestsetconta?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3914-0001-00d8-585c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsSuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsSuccessfully.yaml index 729bc9276a..e1a16d7172 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsSuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsSuccessfully.yaml @@ -1,97 +1,97 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:8VkKbR0FvS1Vn+JTJh4D8udFrvHKY+jn3SYs6OaEFSA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BF1EFB65"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3939-0001-00d8-795c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zrwd - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dtC7uzyVvuRP615pAtNY9jdrn8VbVKn3rA1B5lKbqa8= - Content-Length: - - "232" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?comp=acl&restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BF912725"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac394a-0001-00d8-085c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QEd3WBufl+C8z7TJQ+yNYonTSNZQaR29i8e7cliwuh0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac396b-0001-00d8-225c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8VkKbR0FvS1Vn+JTJh4D8udFrvHKY+jn3SYs6OaEFSA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BF1EFB65"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3939-0001-00d8-795c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zrwd + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dtC7uzyVvuRP615pAtNY9jdrn8VbVKn3rA1B5lKbqa8= + Content-Length: + - "232" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?comp=acl&restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BF912725"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac394a-0001-00d8-085c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QEd3WBufl+C8z7TJQ+yNYonTSNZQaR29i8e7cliwuh0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54containersuitetestsetconta?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac396b-0001-00d8-225c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsWithTimeoutSuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsWithTimeoutSuccessfully.yaml index ef10fbde6a..95fa4c6eff 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsWithTimeoutSuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetContainerPermissionsWithTimeoutSuccessfully.yaml @@ -1,97 +1,97 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:8xMxTjXwyxmY58ibXtgn7jiW6wxq6obudk1RFnO+xMU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BF37DEEE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3984-0001-00d8-385c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zrwd - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bru8OJdPK9W50qzkfhNOOpfbnI+A8hyU+gOWb2IOMtI= - Content-Length: - - "232" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?comp=acl&restype=container&timeout=30 - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BFA8F968"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac39a2-0001-00d8-525c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IAc3hy3qylHS07/RI8/DpHriNw/Lf3BmCafjR/+bw0I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:13 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac39bc-0001-00d8-6a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8xMxTjXwyxmY58ibXtgn7jiW6wxq6obudk1RFnO+xMU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BF37DEEE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3984-0001-00d8-385c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zrwd + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bru8OJdPK9W50qzkfhNOOpfbnI+A8hyU+gOWb2IOMtI= + Content-Length: + - "232" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?comp=acl&restype=container&timeout=30 + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BFA8F968"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac39a2-0001-00d8-525c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IAc3hy3qylHS07/RI8/DpHriNw/Lf3BmCafjR/+bw0I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:13 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsetconta?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac39bc-0001-00d8-6a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsOnlySuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsOnlySuccessfully.yaml index 72d1792997..a450fd9df7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsOnlySuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsOnlySuccessfully.yaml @@ -1,132 +1,132 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:VZgV2RvtEYAniUSGIbhC2ES8ysvCwztyyQx8ellQFfA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BF5137B8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac39ca-0001-00d8-785c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gEmHMIvTw4VhB+JEaQVJG1AZ//W3b6S4uqfeHdi1eKs= - Content-Length: - - "39" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?comp=acl&restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BFC25290"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac39e9-0001-00d8-135c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ISJ+IwjOGcc7Zp9g7iChhOuxHA9yEClKpfmYb2qjuXU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?comp=acl&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x20\x2F\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BFC25290"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Public-Access: - - blob - X-Ms-Request-Id: - - 5eac3a01-0001-00d8-275c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SrnkzkWIGRlO7IUMAnH6YdnSk6FmwH0YTkBUdFesOFg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3a15-0001-00d8-3b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VZgV2RvtEYAniUSGIbhC2ES8ysvCwztyyQx8ellQFfA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BF5137B8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac39ca-0001-00d8-785c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gEmHMIvTw4VhB+JEaQVJG1AZ//W3b6S4uqfeHdi1eKs= + Content-Length: + - "39" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?comp=acl&restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BFC25290"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac39e9-0001-00d8-135c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ISJ+IwjOGcc7Zp9g7iChhOuxHA9yEClKpfmYb2qjuXU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?comp=acl&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x20\x2F\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BFC25290"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Public-Access: + - blob + X-Ms-Request-Id: + - 5eac3a01-0001-00d8-275c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SrnkzkWIGRlO7IUMAnH6YdnSk6FmwH0YTkBUdFesOFg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-65containersuitetestsettheng?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3a15-0001-00d8-3b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsSuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsSuccessfully.yaml index 7625ff92de..57bd37344e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsSuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/ContainerSuite/TestSetThenGetContainerPermissionsSuccessfully.yaml @@ -1,132 +1,132 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:UYKJKPR/Rmy1V7CWvygqIWOFax0js3LjNvk9qhpVtDc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BF74F29E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3a36-0001-00d8-575c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: AutoRestIsSuperCool2050-12-20T21:55:06Z2050-12-21T07:55:06ZrwdGolangRocksOnAzure2050-12-21T17:55:06Z2050-12-22T03:55:06Zr - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fH9cWNFAFiZlRSIKbiZ0vbVFm119SpFZXLmsUt7M2SI= - Content-Length: - - "424" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?comp=acl&restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BFEDB07E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3a5d-0001-00d8-745c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jnbR9LonAgS9z3RUiw3XJCA4eE5spGm/bssX1IomQxg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?comp=acl&restype=container - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x41\x75\x74\x6F\x52\x65\x73\x74\x49\x73\x53\x75\x70\x65\x72\x43\x6F\x6F\x6C\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x30\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x77\x64\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x31\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x32\x54\x30\x33\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BFEDB07E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Public-Access: - - blob - X-Ms-Request-Id: - - 5eac3a6d-0001-00d8-805c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:aQw3v5t/gB4bVZhWx+0D95x3UiBXpuRaLIKej2JatBg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3a80-0001-00d8-105c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UYKJKPR/Rmy1V7CWvygqIWOFax0js3LjNvk9qhpVtDc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BF74F29E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3a36-0001-00d8-575c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: AutoRestIsSuperCool2050-12-20T21:55:06Z2050-12-21T07:55:06ZrwdGolangRocksOnAzure2050-12-21T17:55:06Z2050-12-22T03:55:06Zr + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fH9cWNFAFiZlRSIKbiZ0vbVFm119SpFZXLmsUt7M2SI= + Content-Length: + - "424" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?comp=acl&restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BFEDB07E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3a5d-0001-00d8-745c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jnbR9LonAgS9z3RUiw3XJCA4eE5spGm/bssX1IomQxg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?comp=acl&restype=container + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x41\x75\x74\x6F\x52\x65\x73\x74\x49\x73\x53\x75\x70\x65\x72\x43\x6F\x6F\x6C\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x30\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x77\x64\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x31\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x32\x54\x30\x33\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BFEDB07E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Public-Access: + - blob + X-Ms-Request-Id: + - 5eac3a6d-0001-00d8-805c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aQw3v5t/gB4bVZhWx+0D95x3UiBXpuRaLIKej2JatBg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61containersuitetestsettheng?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3a80-0001-00d8-105c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestAbortBlobCopy.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestAbortBlobCopy.yaml index 7a414f9029..0efca2366a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestAbortBlobCopy.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestAbortBlobCopy.yaml @@ -1,267 +1,267 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:tJe4MHOTpb1fw/E8qPHlKfCd6PB4e6RUgz9w3wxWBFo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:13 GMT - Etag: - - '"0x8D47C73BFA001D2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3a9a-0001-00d8-245c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dhNUlvHltwWU7btOMdUL0XBN0khASlz9WvoMYRsiusE= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BF92CBFA"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3ab8-0001-00d8-3d5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:XrO7sRyw2UAlm7V75rylmGyj/1r2gDid8GRYyqyM7xU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BF9A9595"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - f814d858-1ab2-4f1b-bfb2-5d293b7000e6 - X-Ms-Copy-Status: - - success - X-Ms-Request-Id: - - 5eac3ac0-0001-00d8-445c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:0X1kyvws7KdbDDXk59IXN4GbhaiXdE1Rl0wKZZnhoZo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BF9A9595"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Copy-Completion-Time: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Copy-Id: - - f814d858-1ab2-4f1b-bfb2-5d293b7000e6 - X-Ms-Copy-Progress: - - 1024/1024 - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy - X-Ms-Copy-Status: - - success - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac3adb-0001-00d8-5b5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:z2s16trMrdgKCaeqC+7QtVT/TLBnqbvcydaMlXIUh0Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Copy-Action: - - abort - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy?comp=copy©id=f814d858-1ab2-4f1b-bfb2-5d293b7000e6 - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x4E\x6F\x50\x65\x6E\x64\x69\x6E\x67\x43\x6F\x70\x79\x4F\x70\x65\x72\x61\x74\x69\x6F\x6E\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x72\x65\x20\x69\x73\x20\x63\x75\x72\x72\x65\x6E\x74\x6C\x79\x20\x6E\x6F\x20\x70\x65\x6E\x64\x69\x6E\x67\x20\x63\x6F\x70\x79\x20\x6F\x70\x65\x72\x61\x74\x69\x6F\x6E\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x62\x32\x65\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x32\x32\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x34\x2E\x36\x37\x31\x32\x31\x30\x32\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "236" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3b2e-0001-00d8-225c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 409 There is currently no pending copy operation. - code: 409 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6GW5Bi5Dpfzm4zVqcyT6pFCZxpGqGPfqX72jso8WeOE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3b50-0001-00d8-405c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PsTSLtTYhHPYfBZTUVlpFgT+snbjvrkOGQiJYbGF8fU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3b6f-0001-00d8-555c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tJe4MHOTpb1fw/E8qPHlKfCd6PB4e6RUgz9w3wxWBFo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:13 GMT + Etag: + - '"0x8D47C73BFA001D2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3a9a-0001-00d8-245c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dhNUlvHltwWU7btOMdUL0XBN0khASlz9WvoMYRsiusE= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BF92CBFA"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3ab8-0001-00d8-3d5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XrO7sRyw2UAlm7V75rylmGyj/1r2gDid8GRYyqyM7xU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BF9A9595"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - f814d858-1ab2-4f1b-bfb2-5d293b7000e6 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 5eac3ac0-0001-00d8-445c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0X1kyvws7KdbDDXk59IXN4GbhaiXdE1Rl0wKZZnhoZo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BF9A9595"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Copy-Completion-Time: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Copy-Id: + - f814d858-1ab2-4f1b-bfb2-5d293b7000e6 + X-Ms-Copy-Progress: + - 1024/1024 + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy + X-Ms-Copy-Status: + - success + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac3adb-0001-00d8-5b5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:z2s16trMrdgKCaeqC+7QtVT/TLBnqbvcydaMlXIUh0Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Copy-Action: + - abort + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/dst31copyblobsuitetestabortblobcopy?comp=copy©id=f814d858-1ab2-4f1b-bfb2-5d293b7000e6 + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x4E\x6F\x50\x65\x6E\x64\x69\x6E\x67\x43\x6F\x70\x79\x4F\x70\x65\x72\x61\x74\x69\x6F\x6E\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x72\x65\x20\x69\x73\x20\x63\x75\x72\x72\x65\x6E\x74\x6C\x79\x20\x6E\x6F\x20\x70\x65\x6E\x64\x69\x6E\x67\x20\x63\x6F\x70\x79\x20\x6F\x70\x65\x72\x61\x74\x69\x6F\x6E\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x62\x32\x65\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x32\x32\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x34\x2E\x36\x37\x31\x32\x31\x30\x32\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "236" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3b2e-0001-00d8-225c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 409 There is currently no pending copy operation. + code: 409 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6GW5Bi5Dpfzm4zVqcyT6pFCZxpGqGPfqX72jso8WeOE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob/blob/src31copyblobsuitetestabortblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3b50-0001-00d8-405c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PsTSLtTYhHPYfBZTUVlpFgT+snbjvrkOGQiJYbGF8fU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuitetestabortblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3b6f-0001-00d8-555c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestBlobCopy.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestBlobCopy.yaml index d3544d67a6..94139dab69 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestBlobCopy.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestBlobCopy.yaml @@ -1,330 +1,330 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YG3y1l7rmCuOU4sw5/P72hm3JWZuHieHzbkwkwWiXoI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BFDE2732"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3b7a-0001-00d8-5f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QRUQV8j6ECiqbVQpCkZhHzmkVtrUoCrMw0w5C286AFs= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BFD0F1A1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3b8f-0001-00d8-705c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/XtwYjuW6Jy/b+3JdIUBaJ6ua58BF8N/ucIxv4X3re8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BFDFC158"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - 9ea2b204-bd54-4b3c-b54b-efdf2dfa7e46 - X-Ms-Copy-Status: - - success - X-Ms-Request-Id: - - 5eac3bd0-0001-00d8-295c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:m/kdNIQ96T8prSckvgu6mbEjtaZGvNW+/2VF18zrCmA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BFDFC158"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Copy-Completion-Time: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Copy-Id: - - 9ea2b204-bd54-4b3c-b54b-efdf2dfa7e46 - X-Ms-Copy-Progress: - - 1024/1024 - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy - X-Ms-Copy-Status: - - success - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac3c02-0001-00d8-565c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:pgDEuByINAUzpGTFfmUUn9AM4uQ0l3agAmcYGlDNsbc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73BFDFC158"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Copy-Completion-Time: - - Wed, 05 Apr 2017 22:33:14 GMT - X-Ms-Copy-Id: - - 9ea2b204-bd54-4b3c-b54b-efdf2dfa7e46 - X-Ms-Copy-Progress: - - 1024/1024 - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy - X-Ms-Copy-Status: - - success - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac3c1f-0001-00d8-715c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:x9v747HCXf/2qEjp2/ba7aVv76A6o8vTF7C8wxmZPYw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3c33-0001-00d8-035c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3uKPkMnfPSfA6LsOyoZ6ZFAZtwrzkNkonQSTZyARE6w= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3c48-0001-00d8-145c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:e/PJJhgMv3RyO2MEJCR8+CGPGEK6bwKOAVPvK5VRPZw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3c62-0001-00d8-2c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YG3y1l7rmCuOU4sw5/P72hm3JWZuHieHzbkwkwWiXoI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BFDE2732"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3b7a-0001-00d8-5f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QRUQV8j6ECiqbVQpCkZhHzmkVtrUoCrMw0w5C286AFs= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BFD0F1A1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3b8f-0001-00d8-705c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/XtwYjuW6Jy/b+3JdIUBaJ6ua58BF8N/ucIxv4X3re8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BFDFC158"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 9ea2b204-bd54-4b3c-b54b-efdf2dfa7e46 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 5eac3bd0-0001-00d8-295c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:m/kdNIQ96T8prSckvgu6mbEjtaZGvNW+/2VF18zrCmA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BFDFC158"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Copy-Completion-Time: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Copy-Id: + - 9ea2b204-bd54-4b3c-b54b-efdf2dfa7e46 + X-Ms-Copy-Progress: + - 1024/1024 + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + X-Ms-Copy-Status: + - success + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac3c02-0001-00d8-565c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pgDEuByINAUzpGTFfmUUn9AM4uQ0l3agAmcYGlDNsbc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73BFDFC158"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Copy-Completion-Time: + - Wed, 05 Apr 2017 22:33:14 GMT + X-Ms-Copy-Id: + - 9ea2b204-bd54-4b3c-b54b-efdf2dfa7e46 + X-Ms-Copy-Progress: + - 1024/1024 + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + X-Ms-Copy-Status: + - success + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac3c1f-0001-00d8-715c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:x9v747HCXf/2qEjp2/ba7aVv76A6o8vTF7C8wxmZPYw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/dst26copyblobsuitetestblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3c33-0001-00d8-035c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3uKPkMnfPSfA6LsOyoZ6ZFAZtwrzkNkonQSTZyARE6w= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy/blob/src26copyblobsuitetestblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3c48-0001-00d8-145c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:e/PJJhgMv3RyO2MEJCR8+CGPGEK6bwKOAVPvK5VRPZw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-26copyblobsuitetestblobcopy?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3c62-0001-00d8-2c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobNoTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobNoTimeout.yaml index e5903898fb..661b840c7f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobNoTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobNoTimeout.yaml @@ -1,173 +1,173 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mGOPcENCBz4vZgGrGPAK9mDczpYl0WmwrvQwUhslesk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:40 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:39 GMT - Etag: - - '"0x8D47D1C90B6FB0A"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f37c-0001-006f-7905-afaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:hy8xP8hx6pOb1r/beX0cvlB2gFseMCSn0uTANiOYZlw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10485760" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:40 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:39 GMT - Etag: - - '"0x8D47D1C9061F86F"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f386-0001-006f-8005-afaa6d000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:pyLKN+3uf1ddMdmdgQEtHBGbl/ip7q0ZrjNPng4tGh8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:40 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:39 GMT - Etag: - - '"0x8D47D1C9061F86F"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f397-0001-006f-0e05-afaa6d000000 - X-Ms-Snapshot: - - 2017-04-06T18:41:40.1448864Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:WFzBK3SazAwNPjBAs+3U0sUK8qZ9fddHp7Zcmpg1o4M= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout?snapshot=2017-04-06T18:41:40.1448864Z - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:40 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/dst46copyblobsuitetestincrementalcopyblobnotimeout?comp=incrementalcopy - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:39 GMT - Etag: - - '"0x8D47D1C9086018D"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - 08155c6c-e234-4e37-9051-844fc1b15fbb - X-Ms-Copy-Status: - - pending - X-Ms-Request-Id: - - 21d2f3ad-0001-006f-2105-afaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:kQ8Z78M2Pls6F879UhxoxwT/7uuZkJTKOxaC1K6pALk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:41 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f3e6-0001-006f-5305-afaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mGOPcENCBz4vZgGrGPAK9mDczpYl0WmwrvQwUhslesk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:40 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:39 GMT + Etag: + - '"0x8D47D1C90B6FB0A"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f37c-0001-006f-7905-afaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hy8xP8hx6pOb1r/beX0cvlB2gFseMCSn0uTANiOYZlw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10485760" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:40 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:39 GMT + Etag: + - '"0x8D47D1C9061F86F"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f386-0001-006f-8005-afaa6d000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pyLKN+3uf1ddMdmdgQEtHBGbl/ip7q0ZrjNPng4tGh8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:40 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:39 GMT + Etag: + - '"0x8D47D1C9061F86F"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f397-0001-006f-0e05-afaa6d000000 + X-Ms-Snapshot: + - 2017-04-06T18:41:40.1448864Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:WFzBK3SazAwNPjBAs+3U0sUK8qZ9fddHp7Zcmpg1o4M= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/src46copyblobsuitetestincrementalcopyblobnotimeout?snapshot=2017-04-06T18:41:40.1448864Z + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:40 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement/blob/dst46copyblobsuitetestincrementalcopyblobnotimeout?comp=incrementalcopy + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:39 GMT + Etag: + - '"0x8D47D1C9086018D"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 08155c6c-e234-4e37-9051-844fc1b15fbb + X-Ms-Copy-Status: + - pending + X-Ms-Request-Id: + - 21d2f3ad-0001-006f-2105-afaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kQ8Z78M2Pls6F879UhxoxwT/7uuZkJTKOxaC1K6pALk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:41 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46copyblobsuitetestincrement?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f3e6-0001-006f-5305-afaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobWithTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobWithTimeout.yaml index feee10e42a..54e376a1f8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobWithTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestIncrementalCopyBlobWithTimeout.yaml @@ -1,173 +1,173 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PzyDyDfBXDbRroLytuHxs/slIOF9asQnBqmSpRMlRjg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Public-Access: - - blob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:41 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:40 GMT - Etag: - - '"0x8D47D1C90FA9FCA"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:41 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f40d-0001-006f-7505-afaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:4BtQaQHSP4lUaifMXa3sImIncgtnaGtD0wPU+RQyDVA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10485760" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:41 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:40 GMT - Etag: - - '"0x8D47D1C90A835A0"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f41f-0001-006f-0305-afaa6d000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FwSIjINEz3pdU2koCg/7v2lVjPfrGcmmYi0ONQRVdII= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:41 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:40 GMT - Etag: - - '"0x8D47D1C90A835A0"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f43c-0001-006f-1d05-afaa6d000000 - X-Ms-Snapshot: - - 2017-04-06T18:41:40.6052049Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DLAuUwIf9UGlnqfBOWLE4mRoht+FkPr5L95/WvGJV6k= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout?snapshot=2017-04-06T18:41:40.6052049Z - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:41 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/dst48copyblobsuitetestincrementalcopyblobwithtimeout?comp=incrementalcopy&timeout=30 - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:40 GMT - Etag: - - '"0x8D47D1C90B9C4EC"' - Last-Modified: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - 68efe3d5-3793-46eb-bbb9-47b8fbbd228b - X-Ms-Copy-Status: - - pending - X-Ms-Request-Id: - - 21d2f444-0001-006f-2505-afaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2GacoRO4v8Z0OUHc6pJvmtkCDf+v5vZqH9NQBANVSY4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Thu, 06 Apr 2017 18:41:41 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:41:40 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 21d2f45a-0001-006f-3b05-afaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PzyDyDfBXDbRroLytuHxs/slIOF9asQnBqmSpRMlRjg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Public-Access: + - blob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:41 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:40 GMT + Etag: + - '"0x8D47D1C90FA9FCA"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:41 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f40d-0001-006f-7505-afaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4BtQaQHSP4lUaifMXa3sImIncgtnaGtD0wPU+RQyDVA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10485760" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:41 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:40 GMT + Etag: + - '"0x8D47D1C90A835A0"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f41f-0001-006f-0305-afaa6d000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FwSIjINEz3pdU2koCg/7v2lVjPfrGcmmYi0ONQRVdII= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:41 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:40 GMT + Etag: + - '"0x8D47D1C90A835A0"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f43c-0001-006f-1d05-afaa6d000000 + X-Ms-Snapshot: + - 2017-04-06T18:41:40.6052049Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DLAuUwIf9UGlnqfBOWLE4mRoht+FkPr5L95/WvGJV6k= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/src48copyblobsuitetestincrementalcopyblobwithtimeout?snapshot=2017-04-06T18:41:40.6052049Z + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:41 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement/blob/dst48copyblobsuitetestincrementalcopyblobwithtimeout?comp=incrementalcopy&timeout=30 + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:40 GMT + Etag: + - '"0x8D47D1C90B9C4EC"' + Last-Modified: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 68efe3d5-3793-46eb-bbb9-47b8fbbd228b + X-Ms-Copy-Status: + - pending + X-Ms-Request-Id: + - 21d2f444-0001-006f-2505-afaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2GacoRO4v8Z0OUHc6pJvmtkCDf+v5vZqH9NQBANVSY4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Thu, 06 Apr 2017 18:41:41 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48copyblobsuitetestincrement?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:41:40 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 21d2f45a-0001-006f-3b05-afaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestStartBlobCopy.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestStartBlobCopy.yaml index 5b6816fab4..ac6393ad2b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestStartBlobCopy.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/CopyBlobSuite/TestStartBlobCopy.yaml @@ -1,177 +1,177 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DT7yP+COrjJFlj6iXHzlg+UryC1HvYDtS14efLNGf3w= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73C0228F39"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3c88-0001-00d8-4d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6FfF8+Y5nZFUxXf/fZkJQpDJnmlKpvXfCPQs920SVFo= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73C016B9C8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3c9f-0001-00d8-605c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FpzEleEFTGZ5tB3Q8VlRnZRKYVmyoNza6/YtF0HWyY4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Copy-Source: - - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/dst31copyblobsuiteteststartblobcopy - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Etag: - - '"0x8D47C73C01E8356"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - 9e266b6d-a433-4286-be66-34d22e018e99 - X-Ms-Copy-Status: - - success - X-Ms-Request-Id: - - 5eac3ca4-0001-00d8-655c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JuV7n0npIE6mVzwZOiU3C9a9Oxd3wELAJKSVzujyZmk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:14 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3cb7-0001-00d8-745c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:MeW6bCi5Uc/ZSUmjx2mGwHfHv+Fqu2hpwNy6oTAg0dE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3cc3-0001-00d8-805c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DT7yP+COrjJFlj6iXHzlg+UryC1HvYDtS14efLNGf3w= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73C0228F39"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3c88-0001-00d8-4d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6FfF8+Y5nZFUxXf/fZkJQpDJnmlKpvXfCPQs920SVFo= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73C016B9C8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3c9f-0001-00d8-605c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FpzEleEFTGZ5tB3Q8VlRnZRKYVmyoNza6/YtF0HWyY4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Copy-Source: + - https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/dst31copyblobsuiteteststartblobcopy + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Etag: + - '"0x8D47C73C01E8356"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 9e266b6d-a433-4286-be66-34d22e018e99 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 5eac3ca4-0001-00d8-655c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JuV7n0npIE6mVzwZOiU3C9a9Oxd3wELAJKSVzujyZmk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob/blob/src31copyblobsuiteteststartblobcopy + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:14 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3cb7-0001-00d8-745c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MeW6bCi5Uc/ZSUmjx2mGwHfHv+Fqu2hpwNy6oTAg0dE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31copyblobsuiteteststartblob?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3cc3-0001-00d8-805c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireInfiniteLease.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireInfiniteLease.yaml index 1fc4f7f1c0..ad86b40a9f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireInfiniteLease.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireInfiniteLease.yaml @@ -1,140 +1,140 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/TxslLjfP6iW5WDOz4DexmhfUAAqjUczGuhJiD7P2pk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Fri, 21 Apr 2017 02:57:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 02:57:04 GMT - Etag: - - '"0x8D488621753FA2E"' - Last-Modified: - - Fri, 21 Apr 2017 02:57:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - a68a1e96-0001-0003-174a-ba01be000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:cQnLL5ZMgcZVbdYFBxPPWKF8VI24LhjWPgMEM50LvOY= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Fri, 21 Apr 2017 02:57:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei/blob/39leaseblobsuitetestacquireinfinitelease - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Fri, 21 Apr 2017 02:57:04 GMT - Etag: - - '"0x8D48862172DE5D9"' - Last-Modified: - - Fri, 21 Apr 2017 02:57:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - a68a1e9c-0001-0003-1c4a-ba01be000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:nCwSRG6YOK776VPfk756miIfDe+WXGYH+J+jV5lSawg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Fri, 21 Apr 2017 02:57:04 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "-1" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei/blob/39leaseblobsuitetestacquireinfinitelease?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 02:57:04 GMT - Etag: - - '"0x8D48862172DE5D9"' - Last-Modified: - - Fri, 21 Apr 2017 02:57:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - a68a1ea7-0001-0003-264a-ba01be000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Ef9xwrB5zWWfkdXCUrgpqFnPkmTN5pVd2pAfKVuIvMs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Fri, 21 Apr 2017 02:57:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 02:57:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - a68a1ead-0001-0003-2c4a-ba01be000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/TxslLjfP6iW5WDOz4DexmhfUAAqjUczGuhJiD7P2pk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Fri, 21 Apr 2017 02:57:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 02:57:04 GMT + Etag: + - '"0x8D488621753FA2E"' + Last-Modified: + - Fri, 21 Apr 2017 02:57:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - a68a1e96-0001-0003-174a-ba01be000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cQnLL5ZMgcZVbdYFBxPPWKF8VI24LhjWPgMEM50LvOY= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Fri, 21 Apr 2017 02:57:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei/blob/39leaseblobsuitetestacquireinfinitelease + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Fri, 21 Apr 2017 02:57:04 GMT + Etag: + - '"0x8D48862172DE5D9"' + Last-Modified: + - Fri, 21 Apr 2017 02:57:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - a68a1e9c-0001-0003-1c4a-ba01be000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nCwSRG6YOK776VPfk756miIfDe+WXGYH+J+jV5lSawg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Fri, 21 Apr 2017 02:57:04 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "-1" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei/blob/39leaseblobsuitetestacquireinfinitelease?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 02:57:04 GMT + Etag: + - '"0x8D48862172DE5D9"' + Last-Modified: + - Fri, 21 Apr 2017 02:57:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - a68a1ea7-0001-0003-264a-ba01be000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Ef9xwrB5zWWfkdXCUrgpqFnPkmTN5pVd2pAfKVuIvMs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Fri, 21 Apr 2017 02:57:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestacquirei?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 02:57:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - a68a1ead-0001-0003-2c4a-ba01be000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithBadProposedLeaseID.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithBadProposedLeaseID.yaml index 1804fd913f..678a701d28 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithBadProposedLeaseID.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithBadProposedLeaseID.yaml @@ -1,138 +1,138 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FDqaMsqumePFxoKgiRM9mS10k/78wGt0mZs8gRgcDx4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C752A95A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac4fdd-0001-00d8-375c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:uQCkHCm0B7QBSGK6cETJC3wtLBqOUSRTPY/4xRqaHcc= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel/blob/53leaseblobsuitetestacquireleasewithbadproposedleaseid - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C7468D51"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac4fef-0001-00d8-445c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YOse8rdgNUgRVlSye3hXhoyAENZJTC6ZkVN1B11M9DE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - badbadbad - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel/blob/53leaseblobsuitetestacquireleasewithbadproposedleaseid?comp=lease - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x34\x66\x66\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x65\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x37\x2E\x34\x32\x35\x39\x38\x30\x39\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x70\x72\x6F\x70\x6F\x73\x65\x64\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x62\x61\x64\x62\x61\x64\x62\x61\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "337" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac4ffb-0001-00d8-4e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 400 The value for one of the HTTP headers is not in the correct format. - code: 400 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PZJhTD6CWE4oPaRHfnjhZzxyn73Qo+IsV+gD2guD2YM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac500c-0001-00d8-5c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FDqaMsqumePFxoKgiRM9mS10k/78wGt0mZs8gRgcDx4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C752A95A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac4fdd-0001-00d8-375c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:uQCkHCm0B7QBSGK6cETJC3wtLBqOUSRTPY/4xRqaHcc= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel/blob/53leaseblobsuitetestacquireleasewithbadproposedleaseid + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C7468D51"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac4fef-0001-00d8-445c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YOse8rdgNUgRVlSye3hXhoyAENZJTC6ZkVN1B11M9DE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - badbadbad + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel/blob/53leaseblobsuitetestacquireleasewithbadproposedleaseid?comp=lease + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x34\x66\x66\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x65\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x37\x2E\x34\x32\x35\x39\x38\x30\x39\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x70\x72\x6F\x70\x6F\x73\x65\x64\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x62\x61\x64\x62\x61\x64\x62\x61\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "337" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac4ffb-0001-00d8-4e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 400 The value for one of the HTTP headers is not in the correct format. + code: 400 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PZJhTD6CWE4oPaRHfnjhZzxyn73Qo+IsV+gD2guD2YM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-53leaseblobsuitetestacquirel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac500c-0001-00d8-5c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithNoProposedLeaseID.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithNoProposedLeaseID.yaml index 10c0adb14c..4a5af8d651 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithNoProposedLeaseID.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithNoProposedLeaseID.yaml @@ -1,138 +1,138 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:sulqnP6xOBga/qO6u3tApM8kjHbwVpQbX5ioOG/f0d8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C771CF91"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac501b-0001-00d8-695c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:As+uTAF3nfcbrtb1cBGIeCL2CiHk+xHz0OC0r4/eCgc= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel/blob/52leaseblobsuitetestacquireleasewithnoproposedleaseid - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7647AF6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac502d-0001-00d8-765c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:OK5qTFY+WyKOn/CSK0+rwMnQ5tZPOBi35CGrVc1Hd6U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel/blob/52leaseblobsuitetestacquireleasewithnoproposedleaseid?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7647AF6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - bbcad337-7837-49ae-889c-270321f9946e - X-Ms-Request-Id: - - 5eac503f-0001-00d8-035c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mZqprUEKW+gOl0FWOu6KJ2JUfrXSgMiEcE+MGpy3zSg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac504b-0001-00d8-0d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:sulqnP6xOBga/qO6u3tApM8kjHbwVpQbX5ioOG/f0d8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C771CF91"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac501b-0001-00d8-695c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:As+uTAF3nfcbrtb1cBGIeCL2CiHk+xHz0OC0r4/eCgc= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel/blob/52leaseblobsuitetestacquireleasewithnoproposedleaseid + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7647AF6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac502d-0001-00d8-765c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:OK5qTFY+WyKOn/CSK0+rwMnQ5tZPOBi35CGrVc1Hd6U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel/blob/52leaseblobsuitetestacquireleasewithnoproposedleaseid?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7647AF6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - bbcad337-7837-49ae-889c-270321f9946e + X-Ms-Request-Id: + - 5eac503f-0001-00d8-035c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mZqprUEKW+gOl0FWOu6KJ2JUfrXSgMiEcE+MGpy3zSg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-52leaseblobsuitetestacquirel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac504b-0001-00d8-0d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithProposedLeaseID.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithProposedLeaseID.yaml index 689c1e1639..767393e18c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithProposedLeaseID.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestAcquireLeaseWithProposedLeaseID.yaml @@ -1,140 +1,140 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QOwficM83KsFF4dJ6YmJXYJ1UY3tIj+tydYCyMLtDbw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C793B569"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5060-0001-00d8-205c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SIgUjtLsmbBcnj+AOBax5u1JmuOy/7TR1pZHclcy5NY= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel/blob/50leaseblobsuitetestacquireleasewithproposedleaseid - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7868809"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5075-0001-00d8-335c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mkYw/hWssxhtLcTF6iHfo8ErV+yzj6G7n70SUvSTZZg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel/blob/50leaseblobsuitetestacquireleasewithproposedleaseid?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7868809"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac5082-0001-00d8-405c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:AsCBOc501cfj1wVpcz/yVKQ+YDee1VCXqqLtJwY5EmM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac508f-0001-00d8-4c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QOwficM83KsFF4dJ6YmJXYJ1UY3tIj+tydYCyMLtDbw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C793B569"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5060-0001-00d8-205c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SIgUjtLsmbBcnj+AOBax5u1JmuOy/7TR1pZHclcy5NY= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel/blob/50leaseblobsuitetestacquireleasewithproposedleaseid + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7868809"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5075-0001-00d8-335c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mkYw/hWssxhtLcTF6iHfo8ErV+yzj6G7n70SUvSTZZg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel/blob/50leaseblobsuitetestacquireleasewithproposedleaseid?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7868809"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac5082-0001-00d8-405c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:AsCBOc501cfj1wVpcz/yVKQ+YDee1VCXqqLtJwY5EmM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestacquirel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac508f-0001-00d8-4c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestBreakLeaseSuccessful.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestBreakLeaseSuccessful.yaml index e3ac5fa271..63f2ff64bc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestBreakLeaseSuccessful.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestBreakLeaseSuccessful.yaml @@ -1,175 +1,175 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:o4+iXrTDxdzWhGPGP1NWfX/JvHGcLqu7kK7K8pgqNxY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7B489A0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac509e-0001-00d8-595c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:MkeFneicuafPmQCmjEXv4dzC1QcpG+e82xmTDNV3jCM= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea/blob/39leaseblobsuitetestbreakleasesuccessful - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7A7837A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac50b4-0001-00d8-695c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IW9sqw07TlX21Ri4nEPIiDAa8GqXkU20vYxKcqiFMGg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea/blob/39leaseblobsuitetestbreakleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7A7837A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac50c2-0001-00d8-775c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PnZuavUuDrw8ANxIeBiHhKYgX445cqXnXlg7KVvf/dA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Lease-Action: - - break - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea/blob/39leaseblobsuitetestbreakleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7A7837A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Time: - - "29" - X-Ms-Request-Id: - - 5eac50f6-0001-00d8-205c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:UMJzbQ1Rj1IklNNVPFwFAK7vUdFgSxCltapC6Qd5++g= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac510d-0001-00d8-335c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:o4+iXrTDxdzWhGPGP1NWfX/JvHGcLqu7kK7K8pgqNxY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7B489A0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac509e-0001-00d8-595c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MkeFneicuafPmQCmjEXv4dzC1QcpG+e82xmTDNV3jCM= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea/blob/39leaseblobsuitetestbreakleasesuccessful + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7A7837A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac50b4-0001-00d8-695c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IW9sqw07TlX21Ri4nEPIiDAa8GqXkU20vYxKcqiFMGg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea/blob/39leaseblobsuitetestbreakleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7A7837A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac50c2-0001-00d8-775c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PnZuavUuDrw8ANxIeBiHhKYgX445cqXnXlg7KVvf/dA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Lease-Action: + - break + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea/blob/39leaseblobsuitetestbreakleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7A7837A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Time: + - "29" + X-Ms-Request-Id: + - 5eac50f6-0001-00d8-205c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UMJzbQ1Rj1IklNNVPFwFAK7vUdFgSxCltapC6Qd5++g= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestbreaklea?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac510d-0001-00d8-335c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseNotSuccessfulbadProposedLeaseID.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseNotSuccessfulbadProposedLeaseID.yaml index 3900659b36..12d71a35db 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseNotSuccessfulbadProposedLeaseID.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseNotSuccessfulbadProposedLeaseID.yaml @@ -1,177 +1,177 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TTJzVoJLE5RrdFHTZwN1cS+VkSuxHIL6RGff+NeI/OE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7E93776"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5124-0001-00d8-495c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:KNPtEe3xrFPagbRAu9kWpJckhX6F35EWuNv+SFYxdtE= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele/blob/61leaseblobsuitetestchangeleasenotsuccessfulbadproposedleaseid - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7DC0A75"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5131-0001-00d8-545c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jScj1joo4CLKQU2ciKwNV1RmWTJLJ2ew+xHL0fiMrjM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele/blob/61leaseblobsuitetestchangeleasenotsuccessfulbadproposedleaseid?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Etag: - - '"0x8D47C73C7DC0A75"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac513a-0001-00d8-5d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3KvZLj6XIe4P3/mPtMnR+dukdYHnpMOoTVJQOGkM8AA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Lease-Action: - - change - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Proposed-Lease-Id: - - 1f812371-a41d-49e6-b123-f4b542e - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele/blob/61leaseblobsuitetestchangeleasenotsuccessfulbadproposedleaseid?comp=lease - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x35\x31\x34\x64\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x62\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x38\x2E\x34\x36\x30\x36\x39\x32\x34\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x70\x72\x6F\x70\x6F\x73\x65\x64\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x31\x66\x38\x31\x32\x33\x37\x31\x2D\x61\x34\x31\x64\x2D\x34\x39\x65\x36\x2D\x62\x31\x32\x33\x2D\x66\x34\x62\x35\x34\x32\x65\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "359" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:27 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac514d-0001-00d8-6b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 400 The value for one of the HTTP headers is not in the correct format. - code: 400 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:UG4g1ou5tuIKGPZp8hR0fLc7EF4jU9J8zRoQJ/240VQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac515b-0001-00d8-755c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TTJzVoJLE5RrdFHTZwN1cS+VkSuxHIL6RGff+NeI/OE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7E93776"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5124-0001-00d8-495c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KNPtEe3xrFPagbRAu9kWpJckhX6F35EWuNv+SFYxdtE= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele/blob/61leaseblobsuitetestchangeleasenotsuccessfulbadproposedleaseid + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7DC0A75"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5131-0001-00d8-545c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jScj1joo4CLKQU2ciKwNV1RmWTJLJ2ew+xHL0fiMrjM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele/blob/61leaseblobsuitetestchangeleasenotsuccessfulbadproposedleaseid?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Etag: + - '"0x8D47C73C7DC0A75"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac513a-0001-00d8-5d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3KvZLj6XIe4P3/mPtMnR+dukdYHnpMOoTVJQOGkM8AA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Lease-Action: + - change + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Proposed-Lease-Id: + - 1f812371-a41d-49e6-b123-f4b542e + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele/blob/61leaseblobsuitetestchangeleasenotsuccessfulbadproposedleaseid?comp=lease + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x35\x31\x34\x64\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x62\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x38\x2E\x34\x36\x30\x36\x39\x32\x34\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x70\x72\x6F\x70\x6F\x73\x65\x64\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x31\x66\x38\x31\x32\x33\x37\x31\x2D\x61\x34\x31\x64\x2D\x34\x39\x65\x36\x2D\x62\x31\x32\x33\x2D\x66\x34\x62\x35\x34\x32\x65\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "359" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:27 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac514d-0001-00d8-6b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 400 The value for one of the HTTP headers is not in the correct format. + code: 400 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UG4g1ou5tuIKGPZp8hR0fLc7EF4jU9J8zRoQJ/240VQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-61leaseblobsuitetestchangele?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac515b-0001-00d8-755c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseSuccessful.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseSuccessful.yaml index 54b1ae88ae..2794bb391a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseSuccessful.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestChangeLeaseSuccessful.yaml @@ -1,179 +1,179 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HbN3gbtWk4C6zEKoNArLeQY0sZm9T6XmG7+f2eLq7+I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C810C39C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac516f-0001-00d8-085c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HQrWY3TzeOXKq7uJnF/mcbdr1tNzGfi+M0P7n5Dnv50= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele/blob/40leaseblobsuitetestchangeleasesuccessful - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C8043322"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5174-0001-00d8-0c5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NI76+D9I30SCpMQGVPaAKWnPBdeg9HUgLnCtiKPeY7U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele/blob/40leaseblobsuitetestchangeleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C8043322"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac5189-0001-00d8-1e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:5pm6hIIg93ELs3kAT3MLvADOwrQglbsSJzralgDuMG0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Lease-Action: - - change - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fbb - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele/blob/40leaseblobsuitetestchangeleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C8043322"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fbb - X-Ms-Request-Id: - - 5eac51a4-0001-00d8-335c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7rOSWW3GB4mve009n98SsvQgAp7XnoMl2fvXDRzyHlk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac51bd-0001-00d8-4a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HbN3gbtWk4C6zEKoNArLeQY0sZm9T6XmG7+f2eLq7+I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C810C39C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac516f-0001-00d8-085c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HQrWY3TzeOXKq7uJnF/mcbdr1tNzGfi+M0P7n5Dnv50= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele/blob/40leaseblobsuitetestchangeleasesuccessful + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C8043322"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5174-0001-00d8-0c5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NI76+D9I30SCpMQGVPaAKWnPBdeg9HUgLnCtiKPeY7U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele/blob/40leaseblobsuitetestchangeleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C8043322"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac5189-0001-00d8-1e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5pm6hIIg93ELs3kAT3MLvADOwrQglbsSJzralgDuMG0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Lease-Action: + - change + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fbb + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele/blob/40leaseblobsuitetestchangeleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C8043322"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fbb + X-Ms-Request-Id: + - 5eac51a4-0001-00d8-335c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7rOSWW3GB4mve009n98SsvQgAp7XnoMl2fvXDRzyHlk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40leaseblobsuitetestchangele?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac51bd-0001-00d8-4a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseNotSuccessfulBadLeaseID.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseNotSuccessfulBadLeaseID.yaml index 3d5818afb2..8bf1db9ebe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseNotSuccessfulBadLeaseID.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseNotSuccessfulBadLeaseID.yaml @@ -1,175 +1,175 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NAXegyCuqomzxQWPmBFM3pMHVj+xXjQ1u8hyy4O4ooY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C83A7303"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac51d5-0001-00d8-5f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GLu9allkgkswNeo+g80c9+6yTwk+hIMA7Lnn5T26GeI= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel/blob/54leaseblobsuitetestreleaseleasenotsuccessfulbadleaseid - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C82D1F3D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac51ed-0001-00d8-735c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yYPGkcygK8sjVQ5xgySZIykMsCIo3MH4kSApbtKuXAA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel/blob/54leaseblobsuitetestreleaseleasenotsuccessfulbadleaseid?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C82D1F3D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac5208-0001-00d8-0c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fBNuI8zacAo33OflXrsJld96Egjy7IPRfOwPtMR5++0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - release - X-Ms-Lease-Id: - - badleaseid - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel/blob/54leaseblobsuitetestreleaseleasenotsuccessfulbadleaseid?comp=lease - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x35\x32\x31\x61\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x31\x64\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x39\x2E\x30\x30\x34\x30\x36\x36\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x62\x61\x64\x6C\x65\x61\x73\x65\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "329" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac521a-0001-00d8-1d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 400 The value for one of the HTTP headers is not in the correct format. - code: 400 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:zY7LYpIEg76A4MjcuN/Tbs1Lc8tsEhP2cKYY9tB7nMM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac522f-0001-00d8-305c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NAXegyCuqomzxQWPmBFM3pMHVj+xXjQ1u8hyy4O4ooY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C83A7303"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac51d5-0001-00d8-5f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GLu9allkgkswNeo+g80c9+6yTwk+hIMA7Lnn5T26GeI= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel/blob/54leaseblobsuitetestreleaseleasenotsuccessfulbadleaseid + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C82D1F3D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac51ed-0001-00d8-735c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yYPGkcygK8sjVQ5xgySZIykMsCIo3MH4kSApbtKuXAA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel/blob/54leaseblobsuitetestreleaseleasenotsuccessfulbadleaseid?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C82D1F3D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac5208-0001-00d8-0c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fBNuI8zacAo33OflXrsJld96Egjy7IPRfOwPtMR5++0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - release + X-Ms-Lease-Id: + - badleaseid + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel/blob/54leaseblobsuitetestreleaseleasenotsuccessfulbadleaseid?comp=lease + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x35\x32\x31\x61\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x31\x64\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x39\x2E\x30\x30\x34\x30\x36\x36\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x62\x61\x64\x6C\x65\x61\x73\x65\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "329" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac521a-0001-00d8-1d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 400 The value for one of the HTTP headers is not in the correct format. + code: 400 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zY7LYpIEg76A4MjcuN/Tbs1Lc8tsEhP2cKYY9tB7nMM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-54leaseblobsuitetestreleasel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac522f-0001-00d8-305c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseSuccessful.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseSuccessful.yaml index c1602a3725..9cec2ac347 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseSuccessful.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestReleaseLeaseSuccessful.yaml @@ -1,175 +1,175 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:vyil4bAoMXJClIl8INmNp5ugOLnklaoEEZ5I5YZ/kDc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C8627472"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac525f-0001-00d8-5c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:B6sWW0Ham+4Cbn73eI3LAPWqicViGT2kdaXHelSZSEc= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel/blob/41leaseblobsuitetestreleaseleasesuccessful - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C85680A2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac527a-0001-00d8-725c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:0muB+K1PjTX/4HpluZhDnn6H+XwnGIYKVNJGkrZVZI0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel/blob/41leaseblobsuitetestreleaseleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C85680A2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac5295-0001-00d8-0b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yqT+v/imq3TFp8EypvBT3z1DvoPsavw+PRCc/R+xgkk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - release - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel/blob/41leaseblobsuitetestreleaseleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C85680A2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52a7-0001-00d8-1b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DmLfbOWK7KGU0RNqiiJhuvGuE85I45vaNCFYXiRSsm8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52b1-0001-00d8-235c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vyil4bAoMXJClIl8INmNp5ugOLnklaoEEZ5I5YZ/kDc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C8627472"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac525f-0001-00d8-5c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B6sWW0Ham+4Cbn73eI3LAPWqicViGT2kdaXHelSZSEc= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel/blob/41leaseblobsuitetestreleaseleasesuccessful + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C85680A2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac527a-0001-00d8-725c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0muB+K1PjTX/4HpluZhDnn6H+XwnGIYKVNJGkrZVZI0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel/blob/41leaseblobsuitetestreleaseleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C85680A2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac5295-0001-00d8-0b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yqT+v/imq3TFp8EypvBT3z1DvoPsavw+PRCc/R+xgkk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - release + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel/blob/41leaseblobsuitetestreleaseleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C85680A2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52a7-0001-00d8-1b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DmLfbOWK7KGU0RNqiiJhuvGuE85I45vaNCFYXiRSsm8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-41leaseblobsuitetestreleasel?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52b1-0001-00d8-235c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseAgainstNoCurrentLease.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseAgainstNoCurrentLease.yaml index 9a5d359449..d249c811ca 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseAgainstNoCurrentLease.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseAgainstNoCurrentLease.yaml @@ -1,136 +1,136 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gAqN5ehsiNZpLP0c0glrTs+76tmMOc8em712F/vQ1/o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C88A0094"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52c6-0001-00d8-335c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JF2lHfXD/k9m4N+SxD85BzqmnCzYsanpR4AZHbBXMdU= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea/blob/50leaseblobsuitetestrenewleaseagainstnocurrentlease - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Etag: - - '"0x8D47C73C87D2270"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52cd-0001-00d8-395c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:aK3J4qL0BaJFOtzcZtibGUupe0tYlP1RC7Op0exeBXA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - renew - X-Ms-Lease-Id: - - Golang rocks on Azure - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea/blob/50leaseblobsuitetestrenewleaseagainstnocurrentlease?comp=lease - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x35\x32\x64\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x35\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x39\x2E\x34\x36\x31\x33\x38\x30\x34\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x47\x6F\x6C\x61\x6E\x67\x20\x72\x6F\x63\x6B\x73\x20\x6F\x6E\x20\x41\x7A\x75\x72\x65\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "340" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:28 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52db-0001-00d8-455c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 400 The value for one of the HTTP headers is not in the correct format. - code: 400 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SAjxkQzmsoOxkFdmhJiz/07Fzkr0AfEsfEPssBd1YDE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52e7-0001-00d8-4f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gAqN5ehsiNZpLP0c0glrTs+76tmMOc8em712F/vQ1/o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C88A0094"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52c6-0001-00d8-335c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JF2lHfXD/k9m4N+SxD85BzqmnCzYsanpR4AZHbBXMdU= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea/blob/50leaseblobsuitetestrenewleaseagainstnocurrentlease + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Etag: + - '"0x8D47C73C87D2270"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52cd-0001-00d8-395c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aK3J4qL0BaJFOtzcZtibGUupe0tYlP1RC7Op0exeBXA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - renew + X-Ms-Lease-Id: + - Golang rocks on Azure + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea/blob/50leaseblobsuitetestrenewleaseagainstnocurrentlease?comp=lease + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x35\x32\x64\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x34\x35\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x39\x2E\x34\x36\x31\x33\x38\x30\x34\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x47\x6F\x6C\x61\x6E\x67\x20\x72\x6F\x63\x6B\x73\x20\x6F\x6E\x20\x41\x7A\x75\x72\x65\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "340" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:28 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52db-0001-00d8-455c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 400 The value for one of the HTTP headers is not in the correct format. + code: 400 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SAjxkQzmsoOxkFdmhJiz/07Fzkr0AfEsfEPssBd1YDE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-50leaseblobsuitetestrenewlea?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52e7-0001-00d8-4f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseSuccessful.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseSuccessful.yaml index 83e8ae944e..15d9050c25 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseSuccessful.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/LeaseBlobSuite/TestRenewLeaseSuccessful.yaml @@ -1,177 +1,177 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:40OxckSKCF94CFPxlvV+ynZqMUAIlCt8G4cXjXCPWQ8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8A8FFB8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac52fd-0001-00d8-625c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:wgYaMFgYTPYelRkDaO524UoKWKxXcJeDj9xz3Kw8OJk= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea/blob/39leaseblobsuitetestrenewleasesuccessful - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8A2D9A8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5343-0001-00d8-205c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jGkxsnyXZyZl3LrOgyqV0ABxJppSbVV18Rcwoz8EGtg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Proposed-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea/blob/39leaseblobsuitetestrenewleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8A2D9A8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac5355-0001-00d8-305c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:LanGqG1mwRkxkJGfLq4JloLFNmhVf4+xUWHLCUiIDZs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Lease-Action: - - renew - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea/blob/39leaseblobsuitetestrenewleasesuccessful?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8A2D9A8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - dfe6dde8-68d5-4910-9248-c97c61768fea - X-Ms-Request-Id: - - 5eac5364-0001-00d8-3e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:RBCRBwU5YA1NBxphFfhwngVwO8UUJnOHkB2ro/xYXL4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac537d-0001-00d8-535c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:40OxckSKCF94CFPxlvV+ynZqMUAIlCt8G4cXjXCPWQ8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8A8FFB8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac52fd-0001-00d8-625c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wgYaMFgYTPYelRkDaO524UoKWKxXcJeDj9xz3Kw8OJk= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea/blob/39leaseblobsuitetestrenewleasesuccessful + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8A2D9A8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5343-0001-00d8-205c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jGkxsnyXZyZl3LrOgyqV0ABxJppSbVV18Rcwoz8EGtg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Proposed-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea/blob/39leaseblobsuitetestrenewleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8A2D9A8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac5355-0001-00d8-305c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LanGqG1mwRkxkJGfLq4JloLFNmhVf4+xUWHLCUiIDZs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Lease-Action: + - renew + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea/blob/39leaseblobsuitetestrenewleasesuccessful?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8A2D9A8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - dfe6dde8-68d5-4910-9248-c97c61768fea + X-Ms-Request-Id: + - 5eac5364-0001-00d8-3e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RBCRBwU5YA1NBxphFfhwngVwO8UUJnOHkB2ro/xYXL4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39leaseblobsuitetestrenewlea?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac537d-0001-00d8-535c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestGetPageRanges.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestGetPageRanges.yaml index 93639ad84c..3532870419 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestGetPageRanges.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestGetPageRanges.yaml @@ -1,443 +1,443 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:tA5vyfPg2DBJt8jDzc9Ql3LJ9CQjpmieMknWUu2JOWI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8D6322D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac539c-0001-00d8-6c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Y8AWottpdAUOoQmbkvnwd5Xm7D4W5vOsl0xVR4PDI94= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10240" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/131pageblobsuitetestgetpageranges - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8C90624"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac53b2-0001-00d8-015c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6Nj7UnreE8KhUPgQW1Z1gGi8dyQHZqMqHS3x1wDYP4U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/131pageblobsuitetestgetpageranges?comp=pagelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x50\x61\x67\x65\x4C\x69\x73\x74\x20\x2F\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8C90624"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Length: - - "10240" - X-Ms-Request-Id: - - 5eac53d9-0001-00d8-265c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dG0Wdb40Xc4UAxFyfUiANwNZVUtOxXdV13NcC1uSmlg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10240" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8D7128A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac53fe-0001-00d8-475c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JT07vD9vPNcpGvLxUofhx25V8qIbniLhj/1gbppUxk0= - Content-Length: - - "512" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=0-511 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8E25F15"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac5423-0001-00d8-685c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2Mum5YrL+V0fn05X+aaedqV+U2YvvuF3vpgnt33aNaQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges?comp=pagelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x50\x61\x67\x65\x4C\x69\x73\x74\x3E\x3C\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x35\x31\x31\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x50\x61\x67\x65\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8E25F15"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Length: - - "10240" - X-Ms-Request-Id: - - 5eac5438-0001-00d8-795c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IfdtQe4+v/YMjoQovGQr2Gcw6UT1/0y82yK3nETYjys= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10240" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8F0E0AB"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5454-0001-00d8-0e5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+ytDt7SMzzc+dy90aLYl57MZ52BgFxNYBKlAB0h4XYI= - Content-Length: - - "512" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=0-511 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C8FB69D9"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac5470-0001-00d8-285c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QbhpGf0uvkpkkvLeDd1R4wi1jL1yo7wzLWmwhz/zGFU= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=1024-2047 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C9029718"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac548d-0001-00d8-425c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:sGTu5KacIddksQgZ9DsOLBmbAeKRD4un/qXMGwBIAtA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges?comp=pagelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x50\x61\x67\x65\x4C\x69\x73\x74\x3E\x3C\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x35\x31\x31\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x31\x30\x32\x34\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x30\x34\x37\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x50\x61\x67\x65\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C9029718"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Length: - - "10240" - X-Ms-Request-Id: - - 5eac54a9-0001-00d8-5d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Cn0pVaCuTB5uTvpMeoR8v716Vjad/xShYdRCEjpELEg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac54c1-0001-00d8-755c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tA5vyfPg2DBJt8jDzc9Ql3LJ9CQjpmieMknWUu2JOWI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8D6322D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac539c-0001-00d8-6c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Y8AWottpdAUOoQmbkvnwd5Xm7D4W5vOsl0xVR4PDI94= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/131pageblobsuitetestgetpageranges + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8C90624"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac53b2-0001-00d8-015c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6Nj7UnreE8KhUPgQW1Z1gGi8dyQHZqMqHS3x1wDYP4U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/131pageblobsuitetestgetpageranges?comp=pagelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x50\x61\x67\x65\x4C\x69\x73\x74\x20\x2F\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8C90624"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Request-Id: + - 5eac53d9-0001-00d8-265c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dG0Wdb40Xc4UAxFyfUiANwNZVUtOxXdV13NcC1uSmlg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8D7128A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac53fe-0001-00d8-475c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JT07vD9vPNcpGvLxUofhx25V8qIbniLhj/1gbppUxk0= + Content-Length: + - "512" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=0-511 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8E25F15"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac5423-0001-00d8-685c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2Mum5YrL+V0fn05X+aaedqV+U2YvvuF3vpgnt33aNaQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/231pageblobsuitetestgetpageranges?comp=pagelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x50\x61\x67\x65\x4C\x69\x73\x74\x3E\x3C\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x35\x31\x31\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x50\x61\x67\x65\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8E25F15"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Request-Id: + - 5eac5438-0001-00d8-795c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IfdtQe4+v/YMjoQovGQr2Gcw6UT1/0y82yK3nETYjys= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8F0E0AB"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5454-0001-00d8-0e5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+ytDt7SMzzc+dy90aLYl57MZ52BgFxNYBKlAB0h4XYI= + Content-Length: + - "512" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=0-511 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C8FB69D9"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac5470-0001-00d8-285c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QbhpGf0uvkpkkvLeDd1R4wi1jL1yo7wzLWmwhz/zGFU= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=1024-2047 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C9029718"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac548d-0001-00d8-425c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:sGTu5KacIddksQgZ9DsOLBmbAeKRD4un/qXMGwBIAtA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera/blob/331pageblobsuitetestgetpageranges?comp=pagelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x50\x61\x67\x65\x4C\x69\x73\x74\x3E\x3C\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x35\x31\x31\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x31\x30\x32\x34\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x30\x34\x37\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x50\x61\x67\x65\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x50\x61\x67\x65\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C9029718"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Length: + - "10240" + X-Ms-Request-Id: + - 5eac54a9-0001-00d8-5d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Cn0pVaCuTB5uTvpMeoR8v716Vjad/xShYdRCEjpELEg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestgetpagera?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac54c1-0001-00d8-755c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPageBlob.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPageBlob.yaml index a8b7c97c7c..a76a9af132 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPageBlob.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPageBlob.yaml @@ -1,148 +1,148 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:tvYkEQ1GZ2zWRduetgbGIViQQ5cWqRMKyX4PFzhMkIQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:29 GMT - Etag: - - '"0x8D47C73C92EE91B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac54e0-0001-00d8-115c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:XEb0XoGTlkh5AAsuwsd1qz4MhQGcWvPy17ZNmPqqgSc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10485760" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl/blob/29pageblobsuitetestputpageblob - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C921BD70"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac54fa-0001-00d8-265c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:VEEYywP1JUjalRyHovAQpRGGNb1z5oD+xKlR7sIJn7M= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl/blob/29pageblobsuitetestputpageblob - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "10485760" - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C921BD70"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac5511-0001-00d8-3b5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6MqV83TTy7DWuiNuIvHQsRokiV8pyVKu0BnxagQ9ePw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac5520-0001-00d8-495c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tvYkEQ1GZ2zWRduetgbGIViQQ5cWqRMKyX4PFzhMkIQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:29 GMT + Etag: + - '"0x8D47C73C92EE91B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac54e0-0001-00d8-115c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XEb0XoGTlkh5AAsuwsd1qz4MhQGcWvPy17ZNmPqqgSc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10485760" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl/blob/29pageblobsuitetestputpageblob + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C921BD70"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac54fa-0001-00d8-265c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VEEYywP1JUjalRyHovAQpRGGNb1z5oD+xKlR7sIJn7M= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl/blob/29pageblobsuitetestputpageblob + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "10485760" + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C921BD70"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac5511-0001-00d8-3b5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6MqV83TTy7DWuiNuIvHQsRokiV8pyVKu0BnxagQ9ePw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-29pageblobsuitetestputpagebl?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac5520-0001-00d8-495c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesClear.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesClear.yaml index cb61952db0..ae0da389b9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesClear.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesClear.yaml @@ -1,284 +1,284 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:v6b9cZvdLNSrpjMUV4j19agcVTyjK5pWBQrGjY3YDdk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C94ED2CD"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac553b-0001-00d8-5f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:G68RWsutirZihc1DgXPvSFNgbZ1t1WP4nj0Nv9s6vWE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10485760" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C941A745"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac554d-0001-00d8-6e5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricie - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:5c/iAbGP+JdP6QAX48Eb0We9xR1KHqHUAfl3k7hbJjg= - Content-Length: - - "2048" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=0-2047 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 38PbAkkDLDPUjo6bIBbUzQ== - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C94949C5"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac5565-0001-00d8-015c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:57ni7xzY26eHlL8dkEzk5VltsLMqlnedJsYFu3uR4tM= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Page-Write: - - clear - X-Ms-Range: - - bytes=512-1023 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear?comp=page - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C95076FC"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac5580-0001-00d8-185c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1icsn/ePcExLI6B40JdtbQ0U5XUL0jlt0C3+QpEpAcM= - Range: - - bytes=0-2047 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:30 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear - method: GET - response: - body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricie" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "2048" - Content-Range: - - bytes 0-2047/10485760 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C95076FC"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac5595-0001-00d8-295c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:LMquHRjneFpwn2HH4pTupLVO8uKXVVfg6azk31Ayghg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac55a4-0001-00d8-365c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:v6b9cZvdLNSrpjMUV4j19agcVTyjK5pWBQrGjY3YDdk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C94ED2CD"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac553b-0001-00d8-5f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:G68RWsutirZihc1DgXPvSFNgbZ1t1WP4nj0Nv9s6vWE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10485760" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C941A745"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac554d-0001-00d8-6e5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricie + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5c/iAbGP+JdP6QAX48Eb0We9xR1KHqHUAfl3k7hbJjg= + Content-Length: + - "2048" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=0-2047 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 38PbAkkDLDPUjo6bIBbUzQ== + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C94949C5"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac5565-0001-00d8-015c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:57ni7xzY26eHlL8dkEzk5VltsLMqlnedJsYFu3uR4tM= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Page-Write: + - clear + X-Ms-Range: + - bytes=512-1023 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear?comp=page + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C95076FC"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac5580-0001-00d8-185c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1icsn/ePcExLI6B40JdtbQ0U5XUL0jlt0C3+QpEpAcM= + Range: + - bytes=0-2047 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:30 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc/blob/31pageblobsuitetestputpagesclear + method: GET + response: + body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricie" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "2048" + Content-Range: + - bytes 0-2047/10485760 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C95076FC"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac5595-0001-00d8-295c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LMquHRjneFpwn2HH4pTupLVO8uKXVVfg6azk31Ayghg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31pageblobsuitetestputpagesc?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac55a4-0001-00d8-365c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesUpdate.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesUpdate.yaml index ae7e15af00..bb2d6d9f14 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesUpdate.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/PageBlobSuite/TestPutPagesUpdate.yaml @@ -1,404 +1,404 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fHZ/uBpYamtK91qPiNH6HBNV7hbz2Q4wQot0Lktfb0I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C97D3DF5"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac55b5-0001-00d8-455c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TovKus31KJdBj1yPNIgS5aL5Ijq9MEZHao0Ti3979kA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Content-Length: - - "10485760" - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C9720ECE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac55c7-0001-00d8-565c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:r7cksT5ys4ZfBVzXPZFIj4tpQ6S9lDSjSzPOnjK2Nbo= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=0-1023 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C979631B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac55d5-0001-00d8-635c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Xa4dVHhFNLwzNAWZRdprMC6ZTllz/rNgEjmH8sEyUzg= - Content-Length: - - "512" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=1024-1535 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C980DE85"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac55e1-0001-00d8-6d5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2n7Z5/hqOuQTr/MlUy9QqraJmgImvRwL2iAw2HI6+1A= - Range: - - bytes=0-1535 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1536" - Content-Range: - - bytes 0-1535/10485760 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C980DE85"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac55f0-0001-00d8-7b5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:4N0WVOQNbRiTmItInO9TrH/fE1xsclv5JGN23rooYVA= - Content-Length: - - "512" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - PageBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Page-Write: - - update - X-Ms-Range: - - bytes=0-511 - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate?comp=page - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C98F601A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Request-Id: - - 5eac55ff-0001-00d8-095c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2n7Z5/hqOuQTr/MlUy9QqraJmgImvRwL2iAw2HI6+1A= - Range: - - bytes=0-1535 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1536" - Content-Range: - - bytes 0-1535/10485760 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Etag: - - '"0x8D47C73C98F601A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Sequence-Number: - - "0" - X-Ms-Blob-Type: - - PageBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac560d-0001-00d8-165c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IJHLX0qSAj77ydGVxlZqM82F2YNHKx7pwC6LmQHeo3I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:30 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac561e-0001-00d8-255c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fHZ/uBpYamtK91qPiNH6HBNV7hbz2Q4wQot0Lktfb0I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C97D3DF5"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac55b5-0001-00d8-455c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TovKus31KJdBj1yPNIgS5aL5Ijq9MEZHao0Ti3979kA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Content-Length: + - "10485760" + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C9720ECE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac55c7-0001-00d8-565c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:r7cksT5ys4ZfBVzXPZFIj4tpQ6S9lDSjSzPOnjK2Nbo= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=0-1023 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C979631B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac55d5-0001-00d8-635c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xa4dVHhFNLwzNAWZRdprMC6ZTllz/rNgEjmH8sEyUzg= + Content-Length: + - "512" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=1024-1535 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C980DE85"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac55e1-0001-00d8-6d5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2n7Z5/hqOuQTr/MlUy9QqraJmgImvRwL2iAw2HI6+1A= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum + dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1536" + Content-Range: + - bytes 0-1535/10485760 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C980DE85"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac55f0-0001-00d8-7b5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4N0WVOQNbRiTmItInO9TrH/fE1xsclv5JGN23rooYVA= + Content-Length: + - "512" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - PageBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Page-Write: + - update + X-Ms-Range: + - bytes=0-511 + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate?comp=page + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C98F601A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Request-Id: + - 5eac55ff-0001-00d8-095c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2n7Z5/hqOuQTr/MlUy9QqraJmgImvRwL2iAw2HI6+1A= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu/blob/32pageblobsuitetestputpagesupdate + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum + dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1536" + Content-Range: + - bytes 0-1535/10485760 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Etag: + - '"0x8D47C73C98F601A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Sequence-Number: + - "0" + X-Ms-Blob-Type: + - PageBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac560d-0001-00d8-165c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IJHLX0qSAj77ydGVxlZqM82F2YNHKx7pwC6LmQHeo3I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-32pageblobsuitetestputpagesu?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:30 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac561e-0001-00d8-255c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestBlobExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestBlobExists.yaml index b9c6d0ddaa..99b70844d7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestBlobExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestBlobExists.yaml @@ -1,206 +1,206 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NNfM0sOSRuZdFDM/PMmOF0jHDqoljosw5OWNqJRFaTE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B9418D6D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac296a-0001-00d8-3f5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yx3XIx06loqzIjzSkTaWbY96kiyIaNOvrRi8SDPOD4E= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B93450D0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2988-0001-00d8-565c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:xGXoX0ntPj2lXOgn1MUVYM9SPReP1NcQG/lFhutak2o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "6" - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B93450D0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac29ac-0001-00d8-745c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jVwki/JVYnn4o8MgUy14dZ2k0yAHfUImZ+7bIHbuSV8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:03 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists.lol - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac29bf-0001-00d8-075c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified blob does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:V9h+U2t20pn0Bv/5qCqQjhq9IQ8PW/OXyW8LKhpbUmY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists.lol - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x39\x64\x37\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x31\x64\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x33\x2E\x39\x31\x31\x38\x31\x32\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "215" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac29d7-0001-00d8-1d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified blob does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Ne2IefHqf2rD7fhQ/S5/isQrNZxxgUnu8YtrnleqQ0U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac29e8-0001-00d8-2d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NNfM0sOSRuZdFDM/PMmOF0jHDqoljosw5OWNqJRFaTE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B9418D6D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac296a-0001-00d8-3f5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yx3XIx06loqzIjzSkTaWbY96kiyIaNOvrRi8SDPOD4E= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B93450D0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2988-0001-00d8-565c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xGXoX0ntPj2lXOgn1MUVYM9SPReP1NcQG/lFhutak2o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "6" + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B93450D0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac29ac-0001-00d8-745c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jVwki/JVYnn4o8MgUy14dZ2k0yAHfUImZ+7bIHbuSV8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:03 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists.lol + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac29bf-0001-00d8-075c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:V9h+U2t20pn0Bv/5qCqQjhq9IQ8PW/OXyW8LKhpbUmY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex/blob/31storageblobsuitetestblobexists.lol + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x39\x64\x37\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x31\x64\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x33\x2E\x39\x31\x31\x38\x31\x32\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "215" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac29d7-0001-00d8-1d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Ne2IefHqf2rD7fhQ/S5/isQrNZxxgUnu8YtrnleqQ0U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-31storageblobsuitetestblobex?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac29e8-0001-00d8-2d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobIfExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobIfExists.yaml index 4829afe508..e2dfa5e274 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobIfExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobIfExists.yaml @@ -1,124 +1,124 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:my8+oQG+lcDLVGFTZ/IPYT2SjCtVmN01P1hbaf7VlH4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B9701FB3"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2a00-0001-00d8-405c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:8gL/zzInU+rUNJZIhWvPEwEZJyBS73UlXj9r3W0abvc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete/blob/39storageblobsuitetestdeleteblobifexists - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x61\x31\x36\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x35\x34\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x34\x2E\x30\x37\x38\x39\x32\x36\x39\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "215" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2a16-0001-00d8-545c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified blob does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:8gL/zzInU+rUNJZIhWvPEwEZJyBS73UlXj9r3W0abvc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete/blob/39storageblobsuitetestdeleteblobifexists - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x61\x33\x30\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x38\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x34\x2E\x31\x32\x33\x39\x35\x37\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "215" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2a30-0001-00d8-685c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified blob does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dXk+vfcAhyD9OXeGwXkjdme/LL3PrlzgZIs3QR2yhKQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2a48-0001-00d8-7d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:my8+oQG+lcDLVGFTZ/IPYT2SjCtVmN01P1hbaf7VlH4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B9701FB3"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2a00-0001-00d8-405c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8gL/zzInU+rUNJZIhWvPEwEZJyBS73UlXj9r3W0abvc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete/blob/39storageblobsuitetestdeleteblobifexists + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x61\x31\x36\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x35\x34\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x34\x2E\x30\x37\x38\x39\x32\x36\x39\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "215" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2a16-0001-00d8-545c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8gL/zzInU+rUNJZIhWvPEwEZJyBS73UlXj9r3W0abvc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete/blob/39storageblobsuitetestdeleteblobifexists + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x42\x6C\x6F\x62\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x62\x6C\x6F\x62\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x61\x33\x30\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x38\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x34\x2E\x31\x32\x33\x39\x35\x37\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "215" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2a30-0001-00d8-685c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dXk+vfcAhyD9OXeGwXkjdme/LL3PrlzgZIs3QR2yhKQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-39storageblobsuitetestdelete?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2a48-0001-00d8-7d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobWithConditions.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobWithConditions.yaml index 8c33799bd0..48a18e3c93 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobWithConditions.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestDeleteBlobWithConditions.yaml @@ -1,257 +1,257 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fYSAc0tS4Aw+88JN5lA5O8ySQeEsCCDMwPzjX/rXDNY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B991692F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2a6a-0001-00d8-1c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:AJSdzpWCVfcadfNnr5rIV5ozSjl5FcLn1mqk6pFdk+8= - Content-Length: - - "0" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions - method: PUT - response: - body: "" - headers: - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B984F05B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2a80-0001-00d8-305c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3pN9EaZKcClXFhJtcArllXrOwACgZ2FJVTW21NJO+78= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "0" - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B984F05B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2a9d-0001-00d8-495c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SzubFj7cnMkuthWg6xmMmGAQR4X9P/syDCRaCWEhgGI= - If-Match: - - GolangRocksOnAzure - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x4E\x6F\x74\x4D\x65\x74\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x75\x73\x69\x6E\x67\x20\x48\x54\x54\x50\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x61\x6C\x20\x68\x65\x61\x64\x65\x72\x28\x73\x29\x20\x69\x73\x20\x6E\x6F\x74\x20\x6D\x65\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x61\x64\x35\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x37\x61\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x34\x2E\x33\x39\x33\x31\x34\x32\x39\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "252" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2ad5-0001-00d8-7a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 412 The condition specified using HTTP conditional header(s) is not met. - code: 412 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3pN9EaZKcClXFhJtcArllXrOwACgZ2FJVTW21NJO+78= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "0" - Content-Md5: - - 1B2M2Y8AsgTpgAmY7PhCfg== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:03 GMT - Etag: - - '"0x8D47C73B984F05B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2b0c-0001-00d8-2d5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:LHc/QODeJmXxUdbC8JqYmtg0L+IZa5i/IHgWQmtvFts= - If-Match: - - '"0x8D47C73B984F05B"' - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2b36-0001-00d8-525c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:89I2qIERjAMfimojoaPc5PugxaLLDvRDl2LutunbZUo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2b4a-0001-00d8-665c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fYSAc0tS4Aw+88JN5lA5O8ySQeEsCCDMwPzjX/rXDNY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B991692F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2a6a-0001-00d8-1c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:AJSdzpWCVfcadfNnr5rIV5ozSjl5FcLn1mqk6pFdk+8= + Content-Length: + - "0" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions + method: PUT + response: + body: "" + headers: + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B984F05B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2a80-0001-00d8-305c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3pN9EaZKcClXFhJtcArllXrOwACgZ2FJVTW21NJO+78= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "0" + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B984F05B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2a9d-0001-00d8-495c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SzubFj7cnMkuthWg6xmMmGAQR4X9P/syDCRaCWEhgGI= + If-Match: + - GolangRocksOnAzure + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x4E\x6F\x74\x4D\x65\x74\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x75\x73\x69\x6E\x67\x20\x48\x54\x54\x50\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x61\x6C\x20\x68\x65\x61\x64\x65\x72\x28\x73\x29\x20\x69\x73\x20\x6E\x6F\x74\x20\x6D\x65\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x61\x64\x35\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x37\x61\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x34\x2E\x33\x39\x33\x31\x34\x32\x39\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "252" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2ad5-0001-00d8-7a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 412 The condition specified using HTTP conditional header(s) is not met. + code: 412 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3pN9EaZKcClXFhJtcArllXrOwACgZ2FJVTW21NJO+78= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "0" + Content-Md5: + - 1B2M2Y8AsgTpgAmY7PhCfg== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:03 GMT + Etag: + - '"0x8D47C73B984F05B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2b0c-0001-00d8-2d5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LHc/QODeJmXxUdbC8JqYmtg0L+IZa5i/IHgWQmtvFts= + If-Match: + - '"0x8D47C73B984F05B"' + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete/blob/45storageblobsuitetestdeleteblobwithconditions + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2b36-0001-00d8-525c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:89I2qIERjAMfimojoaPc5PugxaLLDvRDl2LutunbZUo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-45storageblobsuitetestdelete?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2b4a-0001-00d8-665c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetAndSetBlobMetadata.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetAndSetBlobMetadata.yaml index 35fc34ae5a..2802dc4dfe 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetAndSetBlobMetadata.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetAndSetBlobMetadata.yaml @@ -1,243 +1,243 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HliXHpQuIr+Batk2pVHUHstms+V273PG6omJKyD7W9Y= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9C66537"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2b7c-0001-00d8-135c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9lnfDr1zEIVirInwYXh/vM18wIjVPt4AQ6B//6a0rUo= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/142storageblobsuitetestgetandsetblobmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9B92924"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2bab-0001-00d8-3c5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HQB42k73UtfFyuLjkhxDMECTPSZyATSRN7VemwkCAUI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/142storageblobsuitetestgetandsetblobmetadata?comp=metadata - method: GET - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9B92924"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2bd5-0001-00d8-635c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:agWcquoUjXu7Cvah52a/JgMP54G4xH8y330Y7p9qr9g= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/242storageblobsuitetestgetandsetblobmetadata - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9C7AAB1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2bef-0001-00d8-795c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3BjrlBE9ZeqUIV4rQLpaKKp/7B2GfJRqtkuTrQWf0do= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Meta-Lol: - - rofl - X-Ms-Meta-Rofl_baz: - - waz qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/242storageblobsuitetestgetandsetblobmetadata?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9CED7F1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2c1b-0001-00d8-205c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:izdVMONsLq69zWUKTOCOLLSb05YD1fj1uUCnjzBWpIE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/242storageblobsuitetestgetandsetblobmetadata?comp=metadata - method: GET - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9CED7F1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Lol: - - rofl - X-Ms-Meta-Rofl_baz: - - waz qux - X-Ms-Request-Id: - - 5eac2c33-0001-00d8-385c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:K7BWaORQ8RkFvvVHUyKEaRrg4djzfpJUxEwdelEiJ1w= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:04 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2c4b-0001-00d8-4e5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HliXHpQuIr+Batk2pVHUHstms+V273PG6omJKyD7W9Y= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9C66537"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2b7c-0001-00d8-135c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9lnfDr1zEIVirInwYXh/vM18wIjVPt4AQ6B//6a0rUo= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/142storageblobsuitetestgetandsetblobmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9B92924"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2bab-0001-00d8-3c5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HQB42k73UtfFyuLjkhxDMECTPSZyATSRN7VemwkCAUI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/142storageblobsuitetestgetandsetblobmetadata?comp=metadata + method: GET + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9B92924"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2bd5-0001-00d8-635c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:agWcquoUjXu7Cvah52a/JgMP54G4xH8y330Y7p9qr9g= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/242storageblobsuitetestgetandsetblobmetadata + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9C7AAB1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2bef-0001-00d8-795c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3BjrlBE9ZeqUIV4rQLpaKKp/7B2GfJRqtkuTrQWf0do= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Meta-Lol: + - rofl + X-Ms-Meta-Rofl_baz: + - waz qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/242storageblobsuitetestgetandsetblobmetadata?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9CED7F1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2c1b-0001-00d8-205c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:izdVMONsLq69zWUKTOCOLLSb05YD1fj1uUCnjzBWpIE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand/blob/242storageblobsuitetestgetandsetblobmetadata?comp=metadata + method: GET + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9CED7F1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Lol: + - rofl + X-Ms-Meta-Rofl_baz: + - waz qux + X-Ms-Request-Id: + - 5eac2c33-0001-00d8-385c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:K7BWaORQ8RkFvvVHUyKEaRrg4djzfpJUxEwdelEiJ1w= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:04 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-42storageblobsuitetestgetand?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2c4b-0001-00d8-4e5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobProperties.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobProperties.yaml index ad489e21ed..c779c917ad 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobProperties.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobProperties.yaml @@ -1,175 +1,175 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/aMWaS2dFJEZNJGcSuViOUfzPef2ZUpgeD3U92j/Hwg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9F9B36A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2c6a-0001-00d8-685c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:W3NzjgVnrmyJjA8cPbqf/p5LR+TyFsGu32DjARXWP+Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/138storageblobsuitetestgetblobproperties - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2c8d-0001-00d8-075c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified blob does not exist. - code: 404 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:CwrWIVB3Z7jsnM9uyPXSRb2IpKKajvJ4RicMK5UlBRI= - Content-Length: - - "64" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/238storageblobsuitetestgetblobproperties - method: PUT - response: - body: "" - headers: - Content-Md5: - - k5xcYcwrRU0Jp851wBBhJg== - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9F3A49E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2cad-0001-00d8-235c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FzWuTkmxE4vu7bYoCcJ1Lqz0ARR5HhGsfiY/AZJsIwE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/238storageblobsuitetestgetblobproperties - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "64" - Content-Md5: - - k5xcYcwrRU0Jp851wBBhJg== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73B9F3A49E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2cca-0001-00d8-3d5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:xd4tWwfwPL5s9t3qRWG4jEOb7ftlL/J2J6XjCurknUk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2cda-0001-00d8-4c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/aMWaS2dFJEZNJGcSuViOUfzPef2ZUpgeD3U92j/Hwg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9F9B36A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2c6a-0001-00d8-685c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:W3NzjgVnrmyJjA8cPbqf/p5LR+TyFsGu32DjARXWP+Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/138storageblobsuitetestgetblobproperties + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2c8d-0001-00d8-075c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified blob does not exist. + code: 404 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CwrWIVB3Z7jsnM9uyPXSRb2IpKKajvJ4RicMK5UlBRI= + Content-Length: + - "64" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/238storageblobsuitetestgetblobproperties + method: PUT + response: + body: "" + headers: + Content-Md5: + - k5xcYcwrRU0Jp851wBBhJg== + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9F3A49E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2cad-0001-00d8-235c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FzWuTkmxE4vu7bYoCcJ1Lqz0ARR5HhGsfiY/AZJsIwE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo/blob/238storageblobsuitetestgetblobproperties + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "64" + Content-Md5: + - k5xcYcwrRU0Jp851wBBhJg== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73B9F3A49E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2cca-0001-00d8-3d5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xd4tWwfwPL5s9t3qRWG4jEOb7ftlL/J2J6XjCurknUk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestgetblo?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2cda-0001-00d8-4c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobRange.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobRange.yaml index 0737fedb6d..c61350bb11 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobRange.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestGetBlobRange.yaml @@ -1,287 +1,287 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9nu8qK4mFGC/UbUgj//IsZH4NainTKsjMiM8DO8A7Uk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73BA218DA4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2cf9-0001-00d8-665c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "0123456789" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:avRKkLQKSRGQRUT0nQoWpYyobsr5W+aJVLl8j122A70= - Content-Length: - - "10" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange - method: PUT - response: - body: "" - headers: - Content-Md5: - - eB5eJF1ptWaXm4bijSPyxw== - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73BA1451F6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2d0c-0001-00d8-785c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:lFVzR4t40cNBijPob1rFkS/ZA9xlAaNDJurdN6+CHOk= - Range: - - bytes=0-10 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange - method: GET - response: - body: "0123456789" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "10" - Content-Range: - - bytes 0-9/10 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73BA1451F6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Md5: - - eB5eJF1ptWaXm4bijSPyxw== - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2d1d-0001-00d8-065c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:oEk8/ERI3igcGa9njGqs+roCTHkYuUaK2MiydYMO9a4= - Range: - - bytes=1-3 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange - method: GET - response: - body: "123" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "3" - Content-Range: - - bytes 1-3/10 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73BA1451F6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Md5: - - eB5eJF1ptWaXm4bijSPyxw== - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2d3e-0001-00d8-225c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:MbL6csYCAxYabbcUsptWzsxpx+l04t0e8xku6v0ULSQ= - Range: - - bytes=3-10 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange - method: GET - response: - body: "3456789" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "7" - Content-Range: - - bytes 3-9/10 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:04 GMT - Etag: - - '"0x8D47C73BA1451F6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Content-Md5: - - eB5eJF1ptWaXm4bijSPyxw== - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2d4b-0001-00d8-2f5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:OGcfBLsvzDc8wWTIGpBzxsmOZGUDL8/T+HIgSUcHkWU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2d57-0001-00d8-3a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:aP7h0bJk2tRp12fcdHneFnVlWRhaS45ir7+Tqv3Bs2I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2d6a-0001-00d8-4a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9nu8qK4mFGC/UbUgj//IsZH4NainTKsjMiM8DO8A7Uk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73BA218DA4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2cf9-0001-00d8-665c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "0123456789" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:avRKkLQKSRGQRUT0nQoWpYyobsr5W+aJVLl8j122A70= + Content-Length: + - "10" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: PUT + response: + body: "" + headers: + Content-Md5: + - eB5eJF1ptWaXm4bijSPyxw== + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73BA1451F6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2d0c-0001-00d8-785c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lFVzR4t40cNBijPob1rFkS/ZA9xlAaNDJurdN6+CHOk= + Range: + - bytes=0-10 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: GET + response: + body: "0123456789" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "10" + Content-Range: + - bytes 0-9/10 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73BA1451F6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Md5: + - eB5eJF1ptWaXm4bijSPyxw== + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2d1d-0001-00d8-065c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oEk8/ERI3igcGa9njGqs+roCTHkYuUaK2MiydYMO9a4= + Range: + - bytes=1-3 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: GET + response: + body: "123" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "3" + Content-Range: + - bytes 1-3/10 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73BA1451F6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Md5: + - eB5eJF1ptWaXm4bijSPyxw== + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2d3e-0001-00d8-225c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MbL6csYCAxYabbcUsptWzsxpx+l04t0e8xku6v0ULSQ= + Range: + - bytes=3-10 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: GET + response: + body: "3456789" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "7" + Content-Range: + - bytes 3-9/10 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:04 GMT + Etag: + - '"0x8D47C73BA1451F6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Content-Md5: + - eB5eJF1ptWaXm4bijSPyxw== + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2d4b-0001-00d8-2f5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:OGcfBLsvzDc8wWTIGpBzxsmOZGUDL8/T+HIgSUcHkWU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo/blob/33storageblobsuitetestgetblobrange + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2d57-0001-00d8-3a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aP7h0bJk2tRp12fcdHneFnVlWRhaS45ir7+Tqv3Bs2I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestgetblo?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2d6a-0001-00d8-4a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestMetadataCaseMunging.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestMetadataCaseMunging.yaml index b49ea6c055..b5e03c87b5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestMetadataCaseMunging.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestMetadataCaseMunging.yaml @@ -1,173 +1,173 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:eynfs+QloEhoyfjXWPhjenVYqxOwVGaVaMtUV7n8LmI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA58378E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2d7c-0001-00d8-595c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:iKmxay9pGw/Qi1TDUapSfbmReOvJ6KnC4G7AYytjyFk= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada/blob/40storageblobsuitetestmetadatacasemunging - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA4AFC1B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2d90-0001-00d8-6b5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fxkZ9YdeAw6WI7UJSYEPkS2PBZErF6meDnGPyDTo/sg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Meta-Lol: - - different rofl - X-Ms-Meta-Rofl_baz: - - different waz qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada/blob/40storageblobsuitetestmetadatacasemunging?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA558551"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2dba-0001-00d8-0d5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:4KsPkofVcu8LLMk/WfruMS8zDV9yi7NaKHrM9eiOpAg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada/blob/40storageblobsuitetestmetadatacasemunging?comp=metadata - method: GET - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA558551"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Lol: - - different rofl - X-Ms-Meta-Rofl_baz: - - different waz qux - X-Ms-Request-Id: - - 5eac2dd2-0001-00d8-215c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PHr64tjU6Rufx3kOOECaW6z1pnNuLTLtOLtwR9TY4/k= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2de3-0001-00d8-325c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eynfs+QloEhoyfjXWPhjenVYqxOwVGaVaMtUV7n8LmI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA58378E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2d7c-0001-00d8-595c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:iKmxay9pGw/Qi1TDUapSfbmReOvJ6KnC4G7AYytjyFk= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada/blob/40storageblobsuitetestmetadatacasemunging + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA4AFC1B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2d90-0001-00d8-6b5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fxkZ9YdeAw6WI7UJSYEPkS2PBZErF6meDnGPyDTo/sg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Meta-Lol: + - different rofl + X-Ms-Meta-Rofl_baz: + - different waz qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada/blob/40storageblobsuitetestmetadatacasemunging?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA558551"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2dba-0001-00d8-0d5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4KsPkofVcu8LLMk/WfruMS8zDV9yi7NaKHrM9eiOpAg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada/blob/40storageblobsuitetestmetadatacasemunging?comp=metadata + method: GET + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA558551"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Lol: + - different rofl + X-Ms-Meta-Rofl_baz: + - different waz qux + X-Ms-Request-Id: + - 5eac2dd2-0001-00d8-215c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PHr64tjU6Rufx3kOOECaW6z1pnNuLTLtOLtwR9TY4/k= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-40storageblobsuitetestmetada?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2de3-0001-00d8-325c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestPutAppendBlobSpecialChars.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestPutAppendBlobSpecialChars.yaml index e2d7093481..cbbfe3d2bf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestPutAppendBlobSpecialChars.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestPutAppendBlobSpecialChars.yaml @@ -1,385 +1,385 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2ao4Kve4KRx0SCBjExBTe18/5GdwK2aCW7pV6/JHBt8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA7FC3DF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2dfa-0001-00d8-445c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fnCKYjgpmOIsHxaLF1f2j5PKwcrUfZwlNQPwxXsxA2o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:05 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA72AF7E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2e0d-0001-00d8-555c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2xH0SrxqtqUgBFlkqkBoAoko+QIiAhS7FH064J5NppI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "0" - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA72AF7E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Committed-Block-Count: - - "0" - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2e1e-0001-00d8-605c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dl0675kE/yEj148989t9RZqQMBaZ+qvM40tMkMl/PWY= - Content-Length: - - "1024" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars?comp=appendblock - method: PUT - response: - body: "" - headers: - Content-Md5: - - 0rZVY1m4cHz874drfCSd/w== - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA8109F5"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Append-Offset: - - "0" - X-Ms-Blob-Committed-Block-Count: - - "1" - X-Ms-Request-Id: - - 5eac2e33-0001-00d8-745c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Fac2D1PXWkOoM9BXNMtd1q2XiPy/wxA4fGqQUX9U+7A= - Range: - - bytes=0-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Range: - - bytes 0-1023/1024 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA8109F5"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Committed-Block-Count: - - "1" - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2e48-0001-00d8-075c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NiMS1aNfg6mwJD8pFpPEBOnMbXncHiaa6sJPKEwovLw= - Content-Length: - - "512" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars?comp=appendblock - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA8FD9B4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Append-Offset: - - "1024" - X-Ms-Blob-Committed-Block-Count: - - "2" - X-Ms-Request-Id: - - 5eac2e5b-0001-00d8-185c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Pz4jDCxWQnc8y20sFQVxSd9tOOOFhLL7so/QOSXjhM0= - Range: - - bytes=0-1535 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Range-Get-Content-Md5: - - "false" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars - method: GET - response: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1536" - Content-Range: - - bytes 0-1535/1536 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BA8FD9B4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Committed-Block-Count: - - "2" - X-Ms-Blob-Type: - - AppendBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2e78-0001-00d8-325c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:65J7qO+A9I+XOCHLooRUlpvd/rZwCAZNfIO1MuL9sOg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2e8c-0001-00d8-455c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2ao4Kve4KRx0SCBjExBTe18/5GdwK2aCW7pV6/JHBt8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA7FC3DF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2dfa-0001-00d8-445c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fnCKYjgpmOIsHxaLF1f2j5PKwcrUfZwlNQPwxXsxA2o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:05 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA72AF7E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2e0d-0001-00d8-555c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2xH0SrxqtqUgBFlkqkBoAoko+QIiAhS7FH064J5NppI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "0" + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA72AF7E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Committed-Block-Count: + - "0" + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2e1e-0001-00d8-605c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dl0675kE/yEj148989t9RZqQMBaZ+qvM40tMkMl/PWY= + Content-Length: + - "1024" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars?comp=appendblock + method: PUT + response: + body: "" + headers: + Content-Md5: + - 0rZVY1m4cHz874drfCSd/w== + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA8109F5"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Append-Offset: + - "0" + X-Ms-Blob-Committed-Block-Count: + - "1" + X-Ms-Request-Id: + - 5eac2e33-0001-00d8-745c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Fac2D1PXWkOoM9BXNMtd1q2XiPy/wxA4fGqQUX9U+7A= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Range: + - bytes 0-1023/1024 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA8109F5"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Committed-Block-Count: + - "1" + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2e48-0001-00d8-075c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NiMS1aNfg6mwJD8pFpPEBOnMbXncHiaa6sJPKEwovLw= + Content-Length: + - "512" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars?comp=appendblock + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA8FD9B4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Append-Offset: + - "1024" + X-Ms-Blob-Committed-Block-Count: + - "2" + X-Ms-Request-Id: + - 5eac2e5b-0001-00d8-185c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Pz4jDCxWQnc8y20sFQVxSd9tOOOFhLL7so/QOSXjhM0= + Range: + - bytes=0-1535 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Range-Get-Content-Md5: + - "false" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp/blob/46storageblobsuitetestputappendblobspecialchars + method: GET + response: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio.Lorem ipsum + dolor sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1536" + Content-Range: + - bytes 0-1535/1536 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BA8FD9B4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Committed-Block-Count: + - "2" + X-Ms-Blob-Type: + - AppendBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2e78-0001-00d8-325c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:65J7qO+A9I+XOCHLooRUlpvd/rZwCAZNfIO1MuL9sOg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-46storageblobsuitetestputapp?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2e8c-0001-00d8-455c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetBlobProperties.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetBlobProperties.yaml index c7f8cd0614..57a5548664 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetBlobProperties.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetBlobProperties.yaml @@ -1,195 +1,195 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3n/WNWbfJpcChNPRMIGkjYxwlhin9qmXXMraWmbfBhA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BAC64EFF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2eb5-0001-00d8-6a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gf9hPJP/TiWtEblCDNb7gf2v6jg3E8y4iA+Kc2JX7VI= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo/blob/38storageblobsuitetestsetblobproperties - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BABAC1FA"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2ed3-0001-00d8-7d5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1PHcKZFwoXLL5IF5n/e+1+D3+UCP/3pLPyP7zUzBT74= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Cache-Control: - - private, max-age=0, no-cache - X-Ms-Blob-Content-Encoding: - - gzip - X-Ms-Blob-Content-Language: - - de-DE - X-Ms-Blob-Content-Md5: - - oBATU+oaDduHWbVZLuzIJw== - X-Ms-Blob-Content-Type: - - application/json - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo/blob/38storageblobsuitetestsetblobproperties?comp=properties - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BAC34F09"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2eed-0001-00d8-125c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:xAjyeGUdRx9UTUDt7T4X+TDXEbE64uhGa/+wudQz0jc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo/blob/38storageblobsuitetestsetblobproperties - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Cache-Control: - - private, max-age=0, no-cache - Content-Encoding: - - gzip - Content-Language: - - de-DE - Content-Length: - - "6" - Content-Md5: - - oBATU+oaDduHWbVZLuzIJw== - Content-Type: - - application/json - Date: - - Wed, 05 Apr 2017 22:33:05 GMT - Etag: - - '"0x8D47C73BAC34F09"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2efe-0001-00d8-1f5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TVol7vCEmCjaSySrTiCblrG82dO7YZDD8TiIgxEk1RI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f05-0001-00d8-255c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3n/WNWbfJpcChNPRMIGkjYxwlhin9qmXXMraWmbfBhA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BAC64EFF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2eb5-0001-00d8-6a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gf9hPJP/TiWtEblCDNb7gf2v6jg3E8y4iA+Kc2JX7VI= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo/blob/38storageblobsuitetestsetblobproperties + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BABAC1FA"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2ed3-0001-00d8-7d5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1PHcKZFwoXLL5IF5n/e+1+D3+UCP/3pLPyP7zUzBT74= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Cache-Control: + - private, max-age=0, no-cache + X-Ms-Blob-Content-Encoding: + - gzip + X-Ms-Blob-Content-Language: + - de-DE + X-Ms-Blob-Content-Md5: + - oBATU+oaDduHWbVZLuzIJw== + X-Ms-Blob-Content-Type: + - application/json + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo/blob/38storageblobsuitetestsetblobproperties?comp=properties + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BAC34F09"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2eed-0001-00d8-125c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xAjyeGUdRx9UTUDt7T4X+TDXEbE64uhGa/+wudQz0jc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo/blob/38storageblobsuitetestsetblobproperties + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Cache-Control: + - private, max-age=0, no-cache + Content-Encoding: + - gzip + Content-Language: + - de-DE + Content-Length: + - "6" + Content-Md5: + - oBATU+oaDduHWbVZLuzIJw== + Content-Type: + - application/json + Date: + - Wed, 05 Apr 2017 22:33:05 GMT + Etag: + - '"0x8D47C73BAC34F09"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2efe-0001-00d8-1f5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TVol7vCEmCjaSySrTiCblrG82dO7YZDD8TiIgxEk1RI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-38storageblobsuitetestsetblo?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f05-0001-00d8-255c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetMetadataWithExtraHeaders.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetMetadataWithExtraHeaders.yaml index 6e3a490847..15c26096ec 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetMetadataWithExtraHeaders.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSetMetadataWithExtraHeaders.yaml @@ -1,224 +1,224 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:40BVGSszBHNZ8MOHKSMyc32iEgAxT0qC99YBpedNm88= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BAF221D5"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f1f-0001-00d8-395c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:cir0pEjgllnjmBnoUYB/xHyJph1kqkjnNBN5nFuLkJo= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BAE4E6D6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f37-0001-00d8-4f5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9c/O1liGOdL434WUxTORCkZqYUcoQLMpmncb3375urI= - If-Match: - - incorrect-etag - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Meta-Lol: - - rofl - X-Ms-Meta-Rofl_baz: - - waz qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders?comp=metadata - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x4E\x6F\x74\x4D\x65\x74\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x75\x73\x69\x6E\x67\x20\x48\x54\x54\x50\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x61\x6C\x20\x68\x65\x61\x64\x65\x72\x28\x73\x29\x20\x69\x73\x20\x6E\x6F\x74\x20\x6D\x65\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x66\x34\x35\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x35\x63\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x36\x2E\x36\x35\x32\x36\x39\x36\x36\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "252" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f45-0001-00d8-5c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 412 The condition specified using HTTP conditional header(s) is not met. - code: 412 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QM1FScZh7DHN82PNXMUuOEUqrlP9r8zBMlWwuazZphM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders - method: HEAD - response: - body: "" - headers: - Accept-Ranges: - - bytes - Content-Length: - - "6" - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BAE4E6D6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Lease-State: - - available - X-Ms-Lease-Status: - - unlocked - X-Ms-Request-Id: - - 5eac2f58-0001-00d8-6b5c-aea568000000 - X-Ms-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mff0xqcyXafnzJfxkSHj5m3/CMNeVfZ6Ho+50YyHhzw= - If-Match: - - '"0x8D47C73BAE4E6D6"' - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Meta-Lol: - - rofl - X-Ms-Meta-Rofl_baz: - - waz qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BAF983FD"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f69-0001-00d8-785c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/N2DamQNENQELKCKHdWFOvykDtGsagB9iACvL+D61Ds= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f79-0001-00d8-065c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:40BVGSszBHNZ8MOHKSMyc32iEgAxT0qC99YBpedNm88= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BAF221D5"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f1f-0001-00d8-395c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cir0pEjgllnjmBnoUYB/xHyJph1kqkjnNBN5nFuLkJo= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BAE4E6D6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f37-0001-00d8-4f5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9c/O1liGOdL434WUxTORCkZqYUcoQLMpmncb3375urI= + If-Match: + - incorrect-etag + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Meta-Lol: + - rofl + X-Ms-Meta-Rofl_baz: + - waz qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders?comp=metadata + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x4E\x6F\x74\x4D\x65\x74\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x75\x73\x69\x6E\x67\x20\x48\x54\x54\x50\x20\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x61\x6C\x20\x68\x65\x61\x64\x65\x72\x28\x73\x29\x20\x69\x73\x20\x6E\x6F\x74\x20\x6D\x65\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x66\x34\x35\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x35\x63\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x36\x2E\x36\x35\x32\x36\x39\x36\x36\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "252" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f45-0001-00d8-5c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 412 The condition specified using HTTP conditional header(s) is not met. + code: 412 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QM1FScZh7DHN82PNXMUuOEUqrlP9r8zBMlWwuazZphM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders + method: HEAD + response: + body: "" + headers: + Accept-Ranges: + - bytes + Content-Length: + - "6" + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BAE4E6D6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Lease-State: + - available + X-Ms-Lease-Status: + - unlocked + X-Ms-Request-Id: + - 5eac2f58-0001-00d8-6b5c-aea568000000 + X-Ms-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mff0xqcyXafnzJfxkSHj5m3/CMNeVfZ6Ho+50YyHhzw= + If-Match: + - '"0x8D47C73BAE4E6D6"' + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Meta-Lol: + - rofl + X-Ms-Meta-Rofl_baz: + - waz qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet/blob/48storageblobsuitetestsetmetadatawithextraheaders?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BAF983FD"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f69-0001-00d8-785c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/N2DamQNENQELKCKHdWFOvykDtGsagB9iACvL+D61Ds= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-48storageblobsuitetestsetmet?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f79-0001-00d8-065c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlob.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlob.yaml index ef8b4f1023..23c1d782cb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlob.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlob.yaml @@ -1,134 +1,134 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:t/6lGvVsTn3KMnvombcBYcC3RDsOiFLPLX/6FkX2Ln0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:06 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BB1F7B32"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2f91-0001-00d8-1a5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:nBRLgh4UtfVzqhnCUvaxW6/Ls8rTKtNRht+RnT9dZSs= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh/blob/33storageblobsuitetestsnapshotblob - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BB1240AC"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2fa1-0001-00d8-285c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:a54mDfK452/6GRV8ZSWnnCosonI4JsVjUeVjHfChu7U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh/blob/33storageblobsuitetestsnapshotblob?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BB1240AC"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2fae-0001-00d8-345c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:06.8171721Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:r33Sno/uEd+E2lclVrZoxJ+w5xrqt09vou+rsiGGzm8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2fb6-0001-00d8-3b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:t/6lGvVsTn3KMnvombcBYcC3RDsOiFLPLX/6FkX2Ln0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:06 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BB1F7B32"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2f91-0001-00d8-1a5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nBRLgh4UtfVzqhnCUvaxW6/Ls8rTKtNRht+RnT9dZSs= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh/blob/33storageblobsuitetestsnapshotblob + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BB1240AC"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2fa1-0001-00d8-285c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:a54mDfK452/6GRV8ZSWnnCosonI4JsVjUeVjHfChu7U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh/blob/33storageblobsuitetestsnapshotblob?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BB1240AC"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2fae-0001-00d8-345c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:06.8171721Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:r33Sno/uEd+E2lclVrZoxJ+w5xrqt09vou+rsiGGzm8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-33storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2fb6-0001-00d8-3b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithInvalidLease.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithInvalidLease.yaml index e92f98d850..823354f0a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithInvalidLease.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithInvalidLease.yaml @@ -1,171 +1,171 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:VRwnbdOX1jTByBKMqlEuh6U7JKAWMVQFwP0Gaa/+HTc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BB3EEF9F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2fbe-0001-00d8-435c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yweof7P7pv6iaVFAk/4wsIYKcvI11ET/p8lxA2s5jhY= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh/blob/49storageblobsuitetestsnapshotblobwithinvalidlease - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BB31B519"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2fcc-0001-00d8-4f5c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ZaV6Pp+VdB+caRCZtbmYYYTagicl7NwTGDcDfOag/Vs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh/blob/49storageblobsuitetestsnapshotblobwithinvalidlease?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:06 GMT - Etag: - - '"0x8D47C73BB31B519"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:06 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - b1e514c2-44ab-4851-82a6-69d01591013b - X-Ms-Request-Id: - - 5eac2fe6-0001-00d8-685c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:nT/qzeEWTPPzHM1uwBgu5wWC3/DPzafdWYw+oOg9Rps= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Lease-Id: - - GolangRocksOnAzure - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh/blob/49storageblobsuitetestsnapshotblobwithinvalidlease?comp=snapshot - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x66\x65\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x64\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x37\x2E\x36\x32\x31\x33\x36\x32\x37\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "337" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac2feb-0001-00d8-6d5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 400 The value for one of the HTTP headers is not in the correct format. - code: 400 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bBmN7Q8P9kdcW60ksS90JCVN1JfaR/6iQtBR0/8cVy8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac304f-0001-00d8-405c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VRwnbdOX1jTByBKMqlEuh6U7JKAWMVQFwP0Gaa/+HTc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BB3EEF9F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2fbe-0001-00d8-435c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yweof7P7pv6iaVFAk/4wsIYKcvI11ET/p8lxA2s5jhY= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh/blob/49storageblobsuitetestsnapshotblobwithinvalidlease + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BB31B519"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2fcc-0001-00d8-4f5c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZaV6Pp+VdB+caRCZtbmYYYTagicl7NwTGDcDfOag/Vs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh/blob/49storageblobsuitetestsnapshotblobwithinvalidlease?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:06 GMT + Etag: + - '"0x8D47C73BB31B519"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:06 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - b1e514c2-44ab-4851-82a6-69d01591013b + X-Ms-Request-Id: + - 5eac2fe6-0001-00d8-685c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nT/qzeEWTPPzHM1uwBgu5wWC3/DPzafdWYw+oOg9Rps= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Lease-Id: + - GolangRocksOnAzure + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh/blob/49storageblobsuitetestsnapshotblobwithinvalidlease?comp=snapshot + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x49\x6E\x76\x61\x6C\x69\x64\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x76\x61\x6C\x75\x65\x20\x66\x6F\x72\x20\x6F\x6E\x65\x20\x6F\x66\x20\x74\x68\x65\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x73\x20\x69\x73\x20\x6E\x6F\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x20\x66\x6F\x72\x6D\x61\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x32\x66\x65\x62\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x64\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x37\x2E\x36\x32\x31\x33\x36\x32\x37\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x6C\x65\x61\x73\x65\x2D\x69\x64\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x48\x65\x61\x64\x65\x72\x56\x61\x6C\x75\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "337" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac2feb-0001-00d8-6d5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 400 The value for one of the HTTP headers is not in the correct format. + code: 400 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bBmN7Q8P9kdcW60ksS90JCVN1JfaR/6iQtBR0/8cVy8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac304f-0001-00d8-405c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithTimeout.yaml index edc41ba00f..738bfa099f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithTimeout.yaml @@ -1,134 +1,134 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/36xrr7lid7Gn1zxyrX0yKAtmx/aEqC6sPdFum2uZ34= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBA47A0B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac305e-0001-00d8-4b5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gXUc4ZmfDlm5v3EvYbWkJTNrnrDGOGOOPf5zxRYXrQc= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh/blob/44storageblobsuitetestsnapshotblobwithtimeout - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BB9718E2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac306b-0001-00d8-565c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:LmJi8C9LIZ3BJ5gzso4ygJEWg9vDqKmYbU8A7mFRWP0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh/blob/44storageblobsuitetestsnapshotblobwithtimeout?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BB9718E2"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3077-0001-00d8-5e5c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:07.6897863Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9WvC2wMB2jvf9HDD7U56WnQrkYoNv/zR2Ue0Tiarfbc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:07 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3080-0001-00d8-665c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/36xrr7lid7Gn1zxyrX0yKAtmx/aEqC6sPdFum2uZ34= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBA47A0B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac305e-0001-00d8-4b5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gXUc4ZmfDlm5v3EvYbWkJTNrnrDGOGOOPf5zxRYXrQc= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh/blob/44storageblobsuitetestsnapshotblobwithtimeout + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BB9718E2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac306b-0001-00d8-565c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LmJi8C9LIZ3BJ5gzso4ygJEWg9vDqKmYbU8A7mFRWP0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh/blob/44storageblobsuitetestsnapshotblobwithtimeout?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BB9718E2"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3077-0001-00d8-5e5c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:07.6897863Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9WvC2wMB2jvf9HDD7U56WnQrkYoNv/zR2Ue0Tiarfbc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:07 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-44storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3080-0001-00d8-665c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithValidLease.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithValidLease.yaml index 66fa0d99ce..985048a201 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithValidLease.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageBlobSuite/TestSnapshotBlobWithValidLease.yaml @@ -1,173 +1,173 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:rOa5aUpPbxkhd0REVDTeurhK5Hzkdh2G6twgB7PSZCw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh?restype=container - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBC3EE79"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3097-0001-00d8-785c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Hello! - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7hrzUlCnXjsDu2RPxmi1h5uv5Fgtw0kxCKS0I6RiexM= - Content-Length: - - "6" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Blob-Type: - - BlockBlob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh/blob/47storageblobsuitetestsnapshotblobwithvalidlease - method: PUT - response: - body: "" - headers: - Content-Md5: - - lS0sVtBIWVgzZ0e83ZhZDQ== - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBB6B480"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac30a0-0001-00d8-805c-aea568000000 - X-Ms-Request-Server-Encrypted: - - "false" - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:nTiqzpUIkpVAh7O+FoQ0aPAG+y52d9PPfMCQo1I01o4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Lease-Action: - - acquire - X-Ms-Lease-Duration: - - "30" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh/blob/47storageblobsuitetestsnapshotblobwithvalidlease?comp=lease - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBB6B480"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Lease-Id: - - 121cfe12-766a-49e1-b7a3-bed76b3cbd3d - X-Ms-Request-Id: - - 5eac30af-0001-00d8-0c5c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:kDx+bys2954/Y4BcKbL9ZflnG0TMo014TWmXANbbYM4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Lease-Id: - - 121cfe12-766a-49e1-b7a3-bed76b3cbd3d - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh/blob/47storageblobsuitetestsnapshotblobwithvalidlease?comp=snapshot - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Etag: - - '"0x8D47C73BBB6B480"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac30bb-0001-00d8-175c-aea568000000 - X-Ms-Snapshot: - - 2017-04-05T22:33:07.9479684Z - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NiQYc55mbRai38UlfoQiG45eurheNzxuCvkDtnTTkP4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:08 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh?restype=container - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:07 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac30ca-0001-00d8-235c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rOa5aUpPbxkhd0REVDTeurhK5Hzkdh2G6twgB7PSZCw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh?restype=container + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBC3EE79"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3097-0001-00d8-785c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Hello! + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7hrzUlCnXjsDu2RPxmi1h5uv5Fgtw0kxCKS0I6RiexM= + Content-Length: + - "6" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Blob-Type: + - BlockBlob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh/blob/47storageblobsuitetestsnapshotblobwithvalidlease + method: PUT + response: + body: "" + headers: + Content-Md5: + - lS0sVtBIWVgzZ0e83ZhZDQ== + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBB6B480"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac30a0-0001-00d8-805c-aea568000000 + X-Ms-Request-Server-Encrypted: + - "false" + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nTiqzpUIkpVAh7O+FoQ0aPAG+y52d9PPfMCQo1I01o4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Lease-Action: + - acquire + X-Ms-Lease-Duration: + - "30" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh/blob/47storageblobsuitetestsnapshotblobwithvalidlease?comp=lease + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBB6B480"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Lease-Id: + - 121cfe12-766a-49e1-b7a3-bed76b3cbd3d + X-Ms-Request-Id: + - 5eac30af-0001-00d8-0c5c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:kDx+bys2954/Y4BcKbL9ZflnG0TMo014TWmXANbbYM4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Lease-Id: + - 121cfe12-766a-49e1-b7a3-bed76b3cbd3d + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh/blob/47storageblobsuitetestsnapshotblobwithvalidlease?comp=snapshot + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Etag: + - '"0x8D47C73BBB6B480"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac30bb-0001-00d8-175c-aea568000000 + X-Ms-Snapshot: + - 2017-04-05T22:33:07.9479684Z + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NiQYc55mbRai38UlfoQiG45eurheNzxuCvkDtnTTkP4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:08 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-47storageblobsuitetestsnapsh?restype=container + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:07 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac30ca-0001-00d8-235c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError.yaml index d083b0057d..7ded39a83d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError.yaml @@ -1,35 +1,35 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:i5PsVDNHkZelQiUqDDtTy5YvX5gbppXW8zly6qs6umE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageclientsuitetestretu?restype=container - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x33\x36\x32\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x38\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x39\x2E\x37\x31\x31\x38\x30\x30\x31\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "225" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3362-0001-00d8-685c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified container does not exist. - code: 404 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:i5PsVDNHkZelQiUqDDtTy5YvX5gbppXW8zly6qs6umE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/cnt-49storageclientsuitetestretu?restype=container + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x43\x6F\x6E\x74\x61\x69\x6E\x65\x72\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x65\x61\x63\x33\x33\x36\x32\x2D\x30\x30\x30\x31\x2D\x30\x30\x64\x38\x2D\x36\x38\x35\x63\x2D\x61\x65\x61\x35\x36\x38\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x30\x39\x2E\x37\x31\x31\x38\x30\x30\x31\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "225" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3362-0001-00d8-685c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError_withoutResponseBody.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError_withoutResponseBody.yaml index 495a36113f..29933e92b3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError_withoutResponseBody.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/TestReturnsStorageServiceError_withoutResponseBody.yaml @@ -1,31 +1,31 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jhE7vl6hTbiqyG2bNxYWdLFVIm3pUg3HLAQaznj7hLs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.blob.core.windows.net/non-existing-container/non-existing-blob - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:09 GMT - Server: - - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5eac3370-0001-00d8-735c-aea568000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified container does not exist. - code: 404 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jhE7vl6hTbiqyG2bNxYWdLFVIm3pUg3HLAQaznj7hLs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 blob + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.blob.core.windows.net/non-existing-container/non-existing-blob + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:09 GMT + Server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5eac3370-0001-00d8-735c-aea568000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified container does not exist. + code: 404 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/Test_doRetry.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/Test_doRetry.yaml index dccd3fa5fe..914090c5ee 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/Test_doRetry.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageClientSuite/Test_doRetry.yaml @@ -1,94 +1,94 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Prefer: - - return-no-content - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/%28retry%29?timeout=30 - method: DELETE - response: - body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The - specified resource does not exist.\nRequestId:26d67dd8-0002-0096-0fff-ba608d000000\nTime:2017-04-22T00:30:49.2979671Z"}}}' - headers: - Content-Length: - - "202" - Content-Type: - - application/json - Date: - - Sat, 22 Apr 2017 00:30:49 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 26d67dd8-0002-0096-0fff-ba608d000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Prefer: - - return-no-content - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/%28retry%29?timeout=30 - method: DELETE - response: - body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The - specified resource does not exist.\nRequestId:26d67f51-0002-0096-6fff-ba608d000000\nTime:2017-04-22T00:30:50.3507139Z"}}}' - headers: - Content-Length: - - "202" - Content-Type: - - application/json - Date: - - Sat, 22 Apr 2017 00:30:50 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 26d67f51-0002-0096-6fff-ba608d000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Prefer: - - return-no-content - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/%28retry%29?timeout=30 - method: DELETE - response: - body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The - specified resource does not exist.\nRequestId:26d68106-0002-0096-19ff-ba608d000000\nTime:2017-04-22T00:30:52.4141773Z"}}}' - headers: - Content-Length: - - "202" - Content-Type: - - application/json - Date: - - Sat, 22 Apr 2017 00:30:52 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 26d68106-0002-0096-19ff-ba608d000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Prefer: + - return-no-content + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/%28retry%29?timeout=30 + method: DELETE + response: + body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:26d67dd8-0002-0096-0fff-ba608d000000\nTime:2017-04-22T00:30:49.2979671Z"}}}' + headers: + Content-Length: + - "202" + Content-Type: + - application/json + Date: + - Sat, 22 Apr 2017 00:30:49 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 26d67dd8-0002-0096-0fff-ba608d000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Prefer: + - return-no-content + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/%28retry%29?timeout=30 + method: DELETE + response: + body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:26d67f51-0002-0096-6fff-ba608d000000\nTime:2017-04-22T00:30:50.3507139Z"}}}' + headers: + Content-Length: + - "202" + Content-Type: + - application/json + Date: + - Sat, 22 Apr 2017 00:30:50 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 26d67f51-0002-0096-6fff-ba608d000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Prefer: + - return-no-content + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/%28retry%29?timeout=30 + method: DELETE + response: + body: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The + specified resource does not exist.\nRequestId:26d68106-0002-0096-19ff-ba608d000000\nTime:2017-04-22T00:30:52.4141773Z"}}}' + headers: + Content-Length: + - "202" + Content-Type: + - application/json + Date: + - Sat, 22 Apr 2017 00:30:52 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 26d68106-0002-0096-19ff-ba608d000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectory.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectory.yaml index a4122b4a07..8853406743 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectory.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectory.yaml @@ -1,147 +1,147 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GulbdY+hpNZFChI+5JxYluaQQNotmt8Xj2CwTezlwWE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Etag: - - '"0x8D47C73C04EF93F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271c2-001a-00eb-3a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:5fKvC67bWTZ+GJcdWXaAmX0HH+okYWgFKUAO7593m3A= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:15 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory/dir?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Etag: - - '"0x8D47C73C03EE83B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271c6-001a-00eb-3b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:nd2gmiCfN39oXhxOI92zh8EwtFoOxR9x8nmsQDRqqIs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory/dir?restype=directory - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271c7-001a-00eb-3c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:txfgRb6jfOCu4dTb+DViWej+Qg33QmEKIsTzlEWSKfM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory/dir?restype=directory - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271c8-001a-00eb-3d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ZMbnzTQYOxbPyGxWvOPZCvNXaCPKHg0ZTdyct6SKtn8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271c9-001a-00eb-3e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GulbdY+hpNZFChI+5JxYluaQQNotmt8Xj2CwTezlwWE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Etag: + - '"0x8D47C73C04EF93F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271c2-001a-00eb-3a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5fKvC67bWTZ+GJcdWXaAmX0HH+okYWgFKUAO7593m3A= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:15 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory/dir?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Etag: + - '"0x8D47C73C03EE83B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271c6-001a-00eb-3b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nd2gmiCfN39oXhxOI92zh8EwtFoOxR9x8nmsQDRqqIs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory/dir?restype=directory + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271c7-001a-00eb-3c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:txfgRb6jfOCu4dTb+DViWej+Qg33QmEKIsTzlEWSKfM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory/dir?restype=directory + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271c8-001a-00eb-3d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ZMbnzTQYOxbPyGxWvOPZCvNXaCPKHg0ZTdyct6SKtn8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagedirsuitetestcreatedirectory?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271c9-001a-00eb-3e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfExists.yaml index 2845d4bdc8..1daac683a7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfExists.yaml @@ -1,93 +1,93 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+DHC4mQ3p1YEQToiPQcpqgJHVmQT7AlqjLCBlRmDgXU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-43storagedirsuitetestcreatedirectoryifexists/dir?restype=directory - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x52\x65\x73\x6F\x75\x72\x63\x65\x41\x6C\x72\x65\x61\x64\x79\x45\x78\x69\x73\x74\x73\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x72\x65\x73\x6F\x75\x72\x63\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x31\x63\x64\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x34\x31\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x36\x2E\x30\x34\x34\x30\x34\x30\x36\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "228" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271cd-001a-00eb-415c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 409 The specified resource already exists. - code: 409 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:rdgEL7QEXj/tE05FaJl+wQhA1bAgnyrof7iUkSdIPPE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-43storagedirsuitetestcreatedirectoryifexists/dir?restype=directory - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Etag: - - '"0x8D47C73C06897BD"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271ce-001a-00eb-425c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2uJUfMlpGLvqNZW80dcp4EV4zRJdA08gMknZo5NxpiE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-43storagedirsuitetestcreatedirectoryifexists/dir?restype=directory - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:15 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271cf-001a-00eb-435c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+DHC4mQ3p1YEQToiPQcpqgJHVmQT7AlqjLCBlRmDgXU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-43storagedirsuitetestcreatedirectoryifexists/dir?restype=directory + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x52\x65\x73\x6F\x75\x72\x63\x65\x41\x6C\x72\x65\x61\x64\x79\x45\x78\x69\x73\x74\x73\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x72\x65\x73\x6F\x75\x72\x63\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x31\x63\x64\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x34\x31\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x31\x36\x2E\x30\x34\x34\x30\x34\x30\x36\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "228" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271cd-001a-00eb-415c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 409 The specified resource already exists. + code: 409 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rdgEL7QEXj/tE05FaJl+wQhA1bAgnyrof7iUkSdIPPE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-43storagedirsuitetestcreatedirectoryifexists/dir?restype=directory + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Etag: + - '"0x8D47C73C06897BD"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271ce-001a-00eb-425c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2uJUfMlpGLvqNZW80dcp4EV4zRJdA08gMknZo5NxpiE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-43storagedirsuitetestcreatedirectoryifexists/dir?restype=directory + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:15 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271cf-001a-00eb-435c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfNotExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfNotExists.yaml index 6119dee958..e8c138950f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfNotExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestCreateDirectoryIfNotExists.yaml @@ -1,147 +1,147 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:tYBoYwo3k7dAKh/B7W96IZ+d+xB5g+iVh3xdPRBWlmk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0BAEE4B"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271d2-001a-00eb-455c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yqBUdHpb4BpuM1sQeSNALKx/HcpzHLwCobsibr7G718= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists/dir?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0A07A9E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271d4-001a-00eb-465c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Xi6pByko4gk5Mu7z8ccJZUNn3X3OC2dgf84LmeR49mk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists/dir?restype=directory - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271d5-001a-00eb-475c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:IDpcjwC+vpa2cSlJpQ+BqnVwJBFz+SOYxApJ8FgZhfs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists/dir?restype=directory - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271d6-001a-00eb-485c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:BnMuOTlnT6oFVN4Ybr0gmnUos+1QghtRcgGsUsFH1NU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271d7-001a-00eb-495c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tYBoYwo3k7dAKh/B7W96IZ+d+xB5g+iVh3xdPRBWlmk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0BAEE4B"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271d2-001a-00eb-455c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yqBUdHpb4BpuM1sQeSNALKx/HcpzHLwCobsibr7G718= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists/dir?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0A07A9E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271d4-001a-00eb-465c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Xi6pByko4gk5Mu7z8ccJZUNn3X3OC2dgf84LmeR49mk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists/dir?restype=directory + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271d5-001a-00eb-475c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:IDpcjwC+vpa2cSlJpQ+BqnVwJBFz+SOYxApJ8FgZhfs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists/dir?restype=directory + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271d6-001a-00eb-485c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BnMuOTlnT6oFVN4Ybr0gmnUos+1QghtRcgGsUsFH1NU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagedirsuitetestcreatedirectoryifnotexists?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271d7-001a-00eb-495c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestDirectoryMetadata.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestDirectoryMetadata.yaml index e4aa2f4339..aaa421d16a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestDirectoryMetadata.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestDirectoryMetadata.yaml @@ -1,163 +1,163 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:BrJbysAiS1Y3Y2r4XrnJptRRsWJ02L42cNtIHjfiKu8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0E9F630"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271d8-001a-00eb-4a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:L3J+hND1frw7PXZz2ifODNvOCEVqkuR6h3I81o6VKfI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata/testdir?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0CAC6B3"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271da-001a-00eb-4b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:VXZuu+PHRaP7f+C4LNa8nXHL6xi3SFCN1H2BsjyhudA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata/testdir?comp=metadata&restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0D21AD0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271db-001a-00eb-4c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GOZmcikGAEV7dl0mkf1+MDS+2c5R8U/CGTzcQhfmLM8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:16 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata/testdir?restype=directory - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0D21AD0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Request-Id: - - 5a0271dc-001a-00eb-4d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:rlO59A34pNIgDBova2ILjc2uZo+fNP5UkYViZX9wYCo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271dd-001a-00eb-4e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BrJbysAiS1Y3Y2r4XrnJptRRsWJ02L42cNtIHjfiKu8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0E9F630"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271d8-001a-00eb-4a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L3J+hND1frw7PXZz2ifODNvOCEVqkuR6h3I81o6VKfI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata/testdir?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0CAC6B3"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271da-001a-00eb-4b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VXZuu+PHRaP7f+C4LNa8nXHL6xi3SFCN1H2BsjyhudA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata/testdir?comp=metadata&restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0D21AD0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271db-001a-00eb-4c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GOZmcikGAEV7dl0mkf1+MDS+2c5R8U/CGTzcQhfmLM8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:16 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata/testdir?restype=directory + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0D21AD0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Request-Id: + - 5a0271dc-001a-00eb-4d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:rlO59A34pNIgDBova2ILjc2uZo+fNP5UkYViZX9wYCo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-37storagedirsuitetestdirectorymetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271dd-001a-00eb-4e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListDirsAndFiles.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListDirsAndFiles.yaml index 098bf93fab..58e3ca37f2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListDirsAndFiles.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListDirsAndFiles.yaml @@ -1,211 +1,211 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:UsA0tzil/ple4ocjDcEGBnTKf8QFPGF2+6rGTusTSpA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C1149074"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271de-001a-00eb-4f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2MqkziX1OPi9+m/tB8sjKYdM6zXcroO05YKa1MF/tp0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/SomeDirectory?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0F4C43C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e0-001a-00eb-505c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:bcKBoBGTKBUqthEFBjwSArM9h00cELTXNegIcvgATIk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "512" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Etag: - - '"0x8D47C73C0FD5140"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e1-001a-00eb-515c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:eOmPk0HGKbXg1c+85Z8ioz+V9RajVFAZbTV9dyNOIR4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?comp=list&restype=directory - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x66\x69\x6C\x65\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x53\x68\x61\x72\x65\x4E\x61\x6D\x65\x3D\"\x73\x68\x61\x72\x65\x2D\x33\x36\x73\x74\x6F\x72\x61\x67\x65\x64\x69\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x64\x69\x72\x73\x61\x6E\x64\x66\x69\x6C\x65\x73\"\x20\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x50\x61\x74\x68\x3D\"\"\x3E\x3C\x45\x6E\x74\x72\x69\x65\x73\x3E\x3C\x46\x69\x6C\x65\x3E\x3C\x4E\x61\x6D\x65\x3E\x6C\x6F\x6C\x2E\x66\x69\x6C\x65\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x35\x31\x32\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x46\x69\x6C\x65\x3E\x3C\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x3E\x3C\x4E\x61\x6D\x65\x3E\x53\x6F\x6D\x65\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x20\x2F\x3E\x3C\x2F\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x3E\x3C\x2F\x45\x6E\x74\x72\x69\x65\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e2-001a-00eb-525c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:LCFilQhLUV52r5Pa4vFBZewKe0GZlSFOMxhsQOuLsLQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e3-001a-00eb-535c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mBXNzcMj42D+Vqkvw8ftsnsxr0bW8QDVcXWt2BcmxcA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e4-001a-00eb-545c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:19/BCSDRuJzPJjXk5r7NnZJH71NHsX8cib3WFtdGD88= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:16 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e5-001a-00eb-555c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UsA0tzil/ple4ocjDcEGBnTKf8QFPGF2+6rGTusTSpA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C1149074"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271de-001a-00eb-4f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2MqkziX1OPi9+m/tB8sjKYdM6zXcroO05YKa1MF/tp0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/SomeDirectory?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0F4C43C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e0-001a-00eb-505c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:bcKBoBGTKBUqthEFBjwSArM9h00cELTXNegIcvgATIk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "512" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Etag: + - '"0x8D47C73C0FD5140"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e1-001a-00eb-515c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:eOmPk0HGKbXg1c+85Z8ioz+V9RajVFAZbTV9dyNOIR4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?comp=list&restype=directory + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x66\x69\x6C\x65\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x53\x68\x61\x72\x65\x4E\x61\x6D\x65\x3D\"\x73\x68\x61\x72\x65\x2D\x33\x36\x73\x74\x6F\x72\x61\x67\x65\x64\x69\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x64\x69\x72\x73\x61\x6E\x64\x66\x69\x6C\x65\x73\"\x20\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x50\x61\x74\x68\x3D\"\"\x3E\x3C\x45\x6E\x74\x72\x69\x65\x73\x3E\x3C\x46\x69\x6C\x65\x3E\x3C\x4E\x61\x6D\x65\x3E\x6C\x6F\x6C\x2E\x66\x69\x6C\x65\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x35\x31\x32\x3C\x2F\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x4C\x65\x6E\x67\x74\x68\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x46\x69\x6C\x65\x3E\x3C\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x3E\x3C\x4E\x61\x6D\x65\x3E\x53\x6F\x6D\x65\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x20\x2F\x3E\x3C\x2F\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x3E\x3C\x2F\x45\x6E\x74\x72\x69\x65\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e2-001a-00eb-525c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:LCFilQhLUV52r5Pa4vFBZewKe0GZlSFOMxhsQOuLsLQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e3-001a-00eb-535c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mBXNzcMj42D+Vqkvw8ftsnsxr0bW8QDVcXWt2BcmxcA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles/lol.file + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e4-001a-00eb-545c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:19/BCSDRuJzPJjXk5r7NnZJH71NHsX8cib3WFtdGD88= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-36storagedirsuitetestlistdirsandfiles?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:16 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e5-001a-00eb-555c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListZeroDirsAndFiles.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListZeroDirsAndFiles.yaml index 4817d6a951..a750cc67b3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListZeroDirsAndFiles.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageDirSuite/TestListZeroDirsAndFiles.yaml @@ -1,91 +1,91 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:J7EQc6v6ghrWiYlcB4ZRwRwKR/N2XNwZRKZPiC4xLmQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Etag: - - '"0x8D47C73C154B275"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:17 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e6-001a-00eb-565c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:xtv289Fz9PdX300mQvbchETBLSytltqePWFJyFlN1CM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?comp=list&restype=directory - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x66\x69\x6C\x65\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x53\x68\x61\x72\x65\x4E\x61\x6D\x65\x3D\"\x73\x68\x61\x72\x65\x2D\x34\x30\x73\x74\x6F\x72\x61\x67\x65\x64\x69\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x7A\x65\x72\x6F\x64\x69\x72\x73\x61\x6E\x64\x66\x69\x6C\x65\x73\"\x20\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x50\x61\x74\x68\x3D\"\"\x3E\x3C\x45\x6E\x74\x72\x69\x65\x73\x20\x2F\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e8-001a-00eb-575c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FCpO/4dpP0h0X6qP7x21s8kL/Q5AdeqauPw9ZwZ6c6I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271e9-001a-00eb-585c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:J7EQc6v6ghrWiYlcB4ZRwRwKR/N2XNwZRKZPiC4xLmQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Etag: + - '"0x8D47C73C154B275"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:17 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e6-001a-00eb-565c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xtv289Fz9PdX300mQvbchETBLSytltqePWFJyFlN1CM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?comp=list&restype=directory + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x66\x69\x6C\x65\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x20\x53\x68\x61\x72\x65\x4E\x61\x6D\x65\x3D\"\x73\x68\x61\x72\x65\x2D\x34\x30\x73\x74\x6F\x72\x61\x67\x65\x64\x69\x72\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x7A\x65\x72\x6F\x64\x69\x72\x73\x61\x6E\x64\x66\x69\x6C\x65\x73\"\x20\x44\x69\x72\x65\x63\x74\x6F\x72\x79\x50\x61\x74\x68\x3D\"\"\x3E\x3C\x45\x6E\x74\x72\x69\x65\x73\x20\x2F\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e8-001a-00eb-575c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FCpO/4dpP0h0X6qP7x21s8kL/Q5AdeqauPw9ZwZ6c6I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagedirsuitetestlistzerodirsandfiles?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271e9-001a-00eb-585c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestDelete.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestDelete.yaml index 9f194956da..547a3f83b0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestDelete.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestDelete.yaml @@ -1,308 +1,308 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table29storageentitysuitetestdel"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:TIhEod8E8k9KRsCo/MH+I2wy3r17uZ+MLDvUMto9/Y4= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestdel') - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestdel') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b51a-0002-0064-705c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"PartitionKey":"pkey1","RowKey":"rowkey1"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:bGwrhQWrDakoX9OemzzPI4S5a6umnPcnIjvs4nVMQHM= - Content-Length: - - "43" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table29storageentitysuitetestdel/@Element","odata.type":"golangrocksonazure.table29storageentitysuitetestdel","odata.id":"https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey=''pkey1'',RowKey=''rowkey1'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A17.7938773Z''\"","odata.editLink":"table29storageentitysuitetestdel(PartitionKey=''pkey1'',RowKey=''rowkey1'')","PartitionKey":"pkey1","RowKey":"rowkey1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:17.7938773Z"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A17.7938773Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey='pkey1',RowKey='rowkey1') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b52c-0002-0064-7f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:x+4ONgglyIS5RSax94v2q8fsbQTedePs7wWVZWISATk= - If-Match: - - W/"datetime'2017-04-05T22%3A33%3A17.7938773Z'" - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel%28PartitionKey=%27pkey1%27,%20RowKey=%27rowkey1%27%29 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b54f-0002-0064-1e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"PartitionKey":"pkey2","RowKey":"rowkey2"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:bGwrhQWrDakoX9OemzzPI4S5a6umnPcnIjvs4nVMQHM= - Content-Length: - - "43" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:17 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey='pkey2',RowKey='rowkey2') - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.0160373Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey='pkey2',RowKey='rowkey2') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b567-0002-0064-345c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:daT23oPoAmFDAKMb+I/blIAiR7Vm8MiUa8qiSOXp7Os= - If-Match: - - GolangRocksOnAzure - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel%28PartitionKey=%27pkey2%27,%20RowKey=%27rowkey2%27%29 - method: DELETE - response: - body: '{"odata.error":{"code":"InvalidInput","message":{"lang":"en-US","value":"The - etag value ''GolangRocksOnAzure'' specified in one of the request headers is - not valid. Please make sure only one etag value is specified and is valid.\nRequestId:ab33b580-0002-0064-4d5c-aeb219000000\nTime:2017-04-05T22:33:18.0930922Z"}}}' - headers: - Content-Type: - - application/json;odata=nometadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b580-0002-0064-4d5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 400 Bad Request - code: 400 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:daT23oPoAmFDAKMb+I/blIAiR7Vm8MiUa8qiSOXp7Os= - If-Match: - - '*' - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel%28PartitionKey=%27pkey2%27,%20RowKey=%27rowkey2%27%29 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:17 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b595-0002-0064-625c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:BsZecuKMss+n2Nh/d+jY7x+ZBaqT5h0ncuEKVU3Dk7U= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table29storageentitysuitetestdel%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5a5-0002-0064-725c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table29storageentitysuitetestdel"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:TIhEod8E8k9KRsCo/MH+I2wy3r17uZ+MLDvUMto9/Y4= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestdel') + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestdel') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b51a-0002-0064-705c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"PartitionKey":"pkey1","RowKey":"rowkey1"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:bGwrhQWrDakoX9OemzzPI4S5a6umnPcnIjvs4nVMQHM= + Content-Length: + - "43" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table29storageentitysuitetestdel/@Element","odata.type":"golangrocksonazure.table29storageentitysuitetestdel","odata.id":"https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey=''pkey1'',RowKey=''rowkey1'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A17.7938773Z''\"","odata.editLink":"table29storageentitysuitetestdel(PartitionKey=''pkey1'',RowKey=''rowkey1'')","PartitionKey":"pkey1","RowKey":"rowkey1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:17.7938773Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A17.7938773Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey='pkey1',RowKey='rowkey1') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b52c-0002-0064-7f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:x+4ONgglyIS5RSax94v2q8fsbQTedePs7wWVZWISATk= + If-Match: + - W/"datetime'2017-04-05T22%3A33%3A17.7938773Z'" + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel%28PartitionKey=%27pkey1%27,%20RowKey=%27rowkey1%27%29 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b54f-0002-0064-1e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"PartitionKey":"pkey2","RowKey":"rowkey2"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:bGwrhQWrDakoX9OemzzPI4S5a6umnPcnIjvs4nVMQHM= + Content-Length: + - "43" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:17 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey='pkey2',RowKey='rowkey2') + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.0160373Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel(PartitionKey='pkey2',RowKey='rowkey2') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b567-0002-0064-345c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:daT23oPoAmFDAKMb+I/blIAiR7Vm8MiUa8qiSOXp7Os= + If-Match: + - GolangRocksOnAzure + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel%28PartitionKey=%27pkey2%27,%20RowKey=%27rowkey2%27%29 + method: DELETE + response: + body: '{"odata.error":{"code":"InvalidInput","message":{"lang":"en-US","value":"The + etag value ''GolangRocksOnAzure'' specified in one of the request headers is + not valid. Please make sure only one etag value is specified and is valid.\nRequestId:ab33b580-0002-0064-4d5c-aeb219000000\nTime:2017-04-05T22:33:18.0930922Z"}}}' + headers: + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b580-0002-0064-4d5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 400 Bad Request + code: 400 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:daT23oPoAmFDAKMb+I/blIAiR7Vm8MiUa8qiSOXp7Os= + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestdel%28PartitionKey=%27pkey2%27,%20RowKey=%27rowkey2%27%29 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:17 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b595-0002-0064-625c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:BsZecuKMss+n2Nh/d+jY7x+ZBaqT5h0ncuEKVU3Dk7U= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table29storageentitysuitetestdel%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5a5-0002-0064-725c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestExecuteQueryNextResults.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestExecuteQueryNextResults.yaml index 2dd3057034..9ef87a9058 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestExecuteQueryNextResults.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestExecuteQueryNextResults.yaml @@ -1,449 +1,449 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table46storageentitysuitetestexe"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:CbzLvQ0Zo3EfZLidzftTwfpAW89mhR3CUAsyG1eKQgo= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table46storageentitysuitetestexe') - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table46storageentitysuitetestexe') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5b3-0002-0064-805c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"PartitionKey":"pkey","RowKey":"r0"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= - Content-Length: - - "37" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3012418Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","PartitionKey":"pkey","RowKey":"r0","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3012418Z"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.3012418Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r0') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5c3-0002-0064-0f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: '{"PartitionKey":"pkey","RowKey":"r1"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= - Content-Length: - - "37" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3702918Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","PartitionKey":"pkey","RowKey":"r1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3702918Z"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.3702918Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r1') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5ca-0002-0064-165c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: '{"PartitionKey":"pkey","RowKey":"r2"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= - Content-Length: - - "37" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.43734Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","PartitionKey":"pkey","RowKey":"r2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.43734Z"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.43734Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r2') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5db-0002-0064-275c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: '{"PartitionKey":"pkey","RowKey":"r3"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= - Content-Length: - - "37" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.4873759Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","PartitionKey":"pkey","RowKey":"r3","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.4873759Z"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.4873759Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r3') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5e7-0002-0064-335c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: '{"PartitionKey":"pkey","RowKey":"r4"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= - Content-Length: - - "37" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.5364111Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","PartitionKey":"pkey","RowKey":"r4","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.5364111Z"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.5364111Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r4') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b5f2-0002-0064-3e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:NIr5u1aJ08WoVtptkmKnk8ZgpqxzT07IXMxBr3unxIY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe?%24top=2&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe","value":[{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3012418Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","PartitionKey":"pkey","RowKey":"r0","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3012418Z"},{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3702918Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","PartitionKey":"pkey","RowKey":"r1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3702918Z"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Continuation-Nextpartitionkey: - - 1!8!cGtleQ-- - X-Ms-Continuation-Nextrowkey: - - 1!4!cjI- - X-Ms-Request-Id: - - ab33b5f9-0002-0064-455c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:NIr5u1aJ08WoVtptkmKnk8ZgpqxzT07IXMxBr3unxIY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe?%24top=2&NextPartitionKey=1%218%21cGtleQ--&NextRowKey=1%214%21cjI-&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe","value":[{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.43734Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","PartitionKey":"pkey","RowKey":"r2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.43734Z"},{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.4873759Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","PartitionKey":"pkey","RowKey":"r3","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.4873759Z"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Continuation-Nextpartitionkey: - - 1!8!cGtleQ-- - X-Ms-Continuation-Nextrowkey: - - 1!4!cjQ- - X-Ms-Request-Id: - - ab33b60c-0002-0064-575c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:NIr5u1aJ08WoVtptkmKnk8ZgpqxzT07IXMxBr3unxIY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe?%24top=2&NextPartitionKey=1%218%21cGtleQ--&NextRowKey=1%214%21cjQ-&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe","value":[{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.5364111Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","PartitionKey":"pkey","RowKey":"r4","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.5364111Z"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b61f-0002-0064-6a5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:H5VmkvkkuCMaqu4gU3PPY9s5lHdfOw9QOV/n/yVj0gI= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table46storageentitysuitetestexe%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b629-0002-0064-745c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table46storageentitysuitetestexe"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:CbzLvQ0Zo3EfZLidzftTwfpAW89mhR3CUAsyG1eKQgo= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table46storageentitysuitetestexe') + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table46storageentitysuitetestexe') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5b3-0002-0064-805c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"PartitionKey":"pkey","RowKey":"r0"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3012418Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","PartitionKey":"pkey","RowKey":"r0","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3012418Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.3012418Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r0') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5c3-0002-0064-0f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: '{"PartitionKey":"pkey","RowKey":"r1"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3702918Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","PartitionKey":"pkey","RowKey":"r1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3702918Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.3702918Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r1') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5ca-0002-0064-165c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: '{"PartitionKey":"pkey","RowKey":"r2"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.43734Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","PartitionKey":"pkey","RowKey":"r2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.43734Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.43734Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r2') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5db-0002-0064-275c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: '{"PartitionKey":"pkey","RowKey":"r3"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.4873759Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","PartitionKey":"pkey","RowKey":"r3","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.4873759Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.4873759Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r3') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5e7-0002-0064-335c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: '{"PartitionKey":"pkey","RowKey":"r4"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:C9gMBXO0Hj1IHssTT9YrYmQZqM9l5jxXL3TEeSleXRk= + Content-Length: + - "37" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe/@Element","odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.5364111Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","PartitionKey":"pkey","RowKey":"r4","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.5364111Z"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.5364111Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey='pkey',RowKey='r4') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b5f2-0002-0064-3e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:NIr5u1aJ08WoVtptkmKnk8ZgpqxzT07IXMxBr3unxIY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe?%24top=2&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe","value":[{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3012418Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r0'')","PartitionKey":"pkey","RowKey":"r0","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3012418Z"},{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.3702918Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r1'')","PartitionKey":"pkey","RowKey":"r1","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.3702918Z"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Continuation-Nextpartitionkey: + - 1!8!cGtleQ-- + X-Ms-Continuation-Nextrowkey: + - 1!4!cjI- + X-Ms-Request-Id: + - ab33b5f9-0002-0064-455c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:NIr5u1aJ08WoVtptkmKnk8ZgpqxzT07IXMxBr3unxIY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe?%24top=2&NextPartitionKey=1%218%21cGtleQ--&NextRowKey=1%214%21cjI-&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe","value":[{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.43734Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r2'')","PartitionKey":"pkey","RowKey":"r2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.43734Z"},{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.4873759Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r3'')","PartitionKey":"pkey","RowKey":"r3","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.4873759Z"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Continuation-Nextpartitionkey: + - 1!8!cGtleQ-- + X-Ms-Continuation-Nextrowkey: + - 1!4!cjQ- + X-Ms-Request-Id: + - ab33b60c-0002-0064-575c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:NIr5u1aJ08WoVtptkmKnk8ZgpqxzT07IXMxBr3unxIY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe?%24top=2&NextPartitionKey=1%218%21cGtleQ--&NextRowKey=1%214%21cjQ-&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table46storageentitysuitetestexe","value":[{"odata.type":"golangrocksonazure.table46storageentitysuitetestexe","odata.id":"https://golangrocksonazure.table.core.windows.net/table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.5364111Z''\"","odata.editLink":"table46storageentitysuitetestexe(PartitionKey=''pkey'',RowKey=''r4'')","PartitionKey":"pkey","RowKey":"r4","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.5364111Z"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b61f-0002-0064-6a5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:H5VmkvkkuCMaqu4gU3PPY9s5lHdfOw9QOV/n/yVj0gI= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table46storageentitysuitetestexe%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b629-0002-0064-745c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestGet.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestGet.yaml index df5a250b40..a20ab5b67b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestGet.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestGet.yaml @@ -1,253 +1,253 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table26storageentitysuitetestget"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:WSKjrlxzsHVqJxVBAM3GHKdqJuaffs6+cjliU1X7+rc= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table26storageentitysuitetestget') - Date: - - Fri, 21 Apr 2017 19:01:29 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table26storageentitysuitetestget') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca395-0002-0077-53d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:wcHFp+gr7ZpvZFiASYHDhBYHrlGYf6fYfsMJ3s4tNI0= - Content-Length: - - "323" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey='mypartitionkey',RowKey='myrowkey') - Date: - - Fri, 21 Apr 2017 19:01:29 GMT - Etag: - - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey='mypartitionkey',RowKey='myrowkey') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca3bc-0002-0077-74d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:TXUHWsilHY7Ef/c17zf5K7yTAYVBJauUBGKNBcSGjHU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29?%24select=IsActive&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table26storageentitysuitetestget/@Element&$select=IsActive","odata.type":"golangrocksonazure.table26storageentitysuitetestget","odata.id":"https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-21T19%3A01%3A30.1231644Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","IsActive":true}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Fri, 21 Apr 2017 19:01:29 GMT - Etag: - - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca3c5-0002-0077-7bd1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:TXUHWsilHY7Ef/c17zf5K7yTAYVBJauUBGKNBcSGjHU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29?%24select=AmountDue%2CCustomerCode%2CCustomerSince%2CIsActive%2CNumberOfOrders&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table26storageentitysuitetestget/@Element&$select=AmountDue,CustomerCode,CustomerSince,IsActive,NumberOfOrders","odata.type":"golangrocksonazure.table26storageentitysuitetestget","odata.id":"https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-21T19%3A01%3A30.1231644Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Fri, 21 Apr 2017 19:01:29 GMT - Etag: - - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca3dc-0002-0077-0ed1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:TXUHWsilHY7Ef/c17zf5K7yTAYVBJauUBGKNBcSGjHU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29?timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table26storageentitysuitetestget/@Element","odata.type":"golangrocksonazure.table26storageentitysuitetestget","odata.id":"https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-21T19%3A01%3A30.1231644Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-21T19:01:30.1231644Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Fri, 21 Apr 2017 19:01:29 GMT - Etag: - - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca3e3-0002-0077-15d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:voKWr7ShBYDaJfiGJ6tEcHNivtP4arHfBkOIVbL250w= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table26storageentitysuitetestget%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 19:01:29 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca3f2-0002-0077-24d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table26storageentitysuitetestget"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:WSKjrlxzsHVqJxVBAM3GHKdqJuaffs6+cjliU1X7+rc= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table26storageentitysuitetestget') + Date: + - Fri, 21 Apr 2017 19:01:29 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table26storageentitysuitetestget') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca395-0002-0077-53d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:wcHFp+gr7ZpvZFiASYHDhBYHrlGYf6fYfsMJ3s4tNI0= + Content-Length: + - "323" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey='mypartitionkey',RowKey='myrowkey') + Date: + - Fri, 21 Apr 2017 19:01:29 GMT + Etag: + - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey='mypartitionkey',RowKey='myrowkey') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca3bc-0002-0077-74d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:TXUHWsilHY7Ef/c17zf5K7yTAYVBJauUBGKNBcSGjHU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29?%24select=IsActive&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table26storageentitysuitetestget/@Element&$select=IsActive","odata.type":"golangrocksonazure.table26storageentitysuitetestget","odata.id":"https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-21T19%3A01%3A30.1231644Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","IsActive":true}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 21 Apr 2017 19:01:29 GMT + Etag: + - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca3c5-0002-0077-7bd1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:TXUHWsilHY7Ef/c17zf5K7yTAYVBJauUBGKNBcSGjHU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29?%24select=AmountDue%2CCustomerCode%2CCustomerSince%2CIsActive%2CNumberOfOrders&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table26storageentitysuitetestget/@Element&$select=AmountDue,CustomerCode,CustomerSince,IsActive,NumberOfOrders","odata.type":"golangrocksonazure.table26storageentitysuitetestget","odata.id":"https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-21T19%3A01%3A30.1231644Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 21 Apr 2017 19:01:29 GMT + Etag: + - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca3dc-0002-0077-0ed1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:TXUHWsilHY7Ef/c17zf5K7yTAYVBJauUBGKNBcSGjHU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29?timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table26storageentitysuitetestget/@Element","odata.type":"golangrocksonazure.table26storageentitysuitetestget","odata.id":"https://golangrocksonazure.table.core.windows.net/table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-21T19%3A01%3A30.1231644Z''\"","odata.editLink":"table26storageentitysuitetestget(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-21T19:01:30.1231644Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 21 Apr 2017 19:01:29 GMT + Etag: + - W/"datetime'2017-04-21T19%3A01%3A30.1231644Z'" + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca3e3-0002-0077-15d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:voKWr7ShBYDaJfiGJ6tEcHNivtP4arHfBkOIVbL250w= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table26storageentitysuitetestget%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 19:01:29 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca3f2-0002-0077-24d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsert.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsert.yaml index c60b7f32d5..d03a18a9e7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsert.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsert.yaml @@ -1,191 +1,191 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table29storageentitysuitetestins"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:CbzLvQ0Zo3EfZLidzftTwfpAW89mhR3CUAsyG1eKQgo= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestins') - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestins') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b63b-0002-0064-065c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:/Dn0LgUZt9W1pbmoI+/0QJAfgOZfhnWzpQVpPvlPP9o= - Content-Length: - - "323" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='myrowkey') - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.8786566Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='myrowkey') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b64b-0002-0064-145c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey2","RowKey":"myrowkey2"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:/Dn0LgUZt9W1pbmoI+/0QJAfgOZfhnWzpQVpPvlPP9o= - Content-Length: - - "325" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table29storageentitysuitetestins/@Element","odata.type":"golangrocksonazure.table29storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey=''mypartitionkey2'',RowKey=''myrowkey2'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.9246901Z''\"","odata.editLink":"table29storageentitysuitetestins(PartitionKey=''mypartitionkey2'',RowKey=''myrowkey2'')","PartitionKey":"mypartitionkey2","RowKey":"myrowkey2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.9246901Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.9246901Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey='mypartitionkey2',RowKey='myrowkey2') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b656-0002-0064-1f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:Nc9bEHZ5fnbetPsoAhMDW2q/vnPPGOb8SJC01T3gZrc= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table29storageentitysuitetestins%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b667-0002-0064-305c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table29storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:CbzLvQ0Zo3EfZLidzftTwfpAW89mhR3CUAsyG1eKQgo= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestins') + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestins') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b63b-0002-0064-065c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:/Dn0LgUZt9W1pbmoI+/0QJAfgOZfhnWzpQVpPvlPP9o= + Content-Length: + - "323" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='myrowkey') + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.8786566Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='myrowkey') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b64b-0002-0064-145c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey2","RowKey":"myrowkey2"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:/Dn0LgUZt9W1pbmoI+/0QJAfgOZfhnWzpQVpPvlPP9o= + Content-Length: + - "325" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table29storageentitysuitetestins/@Element","odata.type":"golangrocksonazure.table29storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey=''mypartitionkey2'',RowKey=''myrowkey2'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A18.9246901Z''\"","odata.editLink":"table29storageentitysuitetestins(PartitionKey=''mypartitionkey2'',RowKey=''myrowkey2'')","PartitionKey":"mypartitionkey2","RowKey":"myrowkey2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:18.9246901Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.9246901Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestins(PartitionKey='mypartitionkey2',RowKey='myrowkey2') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b656-0002-0064-1f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:Nc9bEHZ5fnbetPsoAhMDW2q/vnPPGOb8SJC01T3gZrc= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table29storageentitysuitetestins%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b667-0002-0064-305c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrMerge.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrMerge.yaml index fc85ad69bf..a07d6c1663 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrMerge.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrMerge.yaml @@ -1,185 +1,185 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table36storageentitysuitetestins"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:CbzLvQ0Zo3EfZLidzftTwfpAW89mhR3CUAsyG1eKQgo= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:18 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table36storageentitysuitetestins') - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table36storageentitysuitetestins') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b675-0002-0064-3e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:6UkRcHL+noxsQ33uo6MPHx6utOF2ppkprQ9iQF18NUk= - Content-Length: - - "92" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table36storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: MERGE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.8099292Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b682-0002-0064-4a5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"Father":"Anakin","Mentor":"Yoda","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:6UkRcHL+noxsQ33uo6MPHx6utOF2ppkprQ9iQF18NUk= - Content-Length: - - "87" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table36storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: MERGE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:18 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A18.8579615Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b691-0002-0064-595c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:l8d2SSaA5ME/otMGZ0k3XfZb3+gNKdEwWWm8+seOKsY= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table36storageentitysuitetestins%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b69c-0002-0064-635c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table36storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:CbzLvQ0Zo3EfZLidzftTwfpAW89mhR3CUAsyG1eKQgo= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:18 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table36storageentitysuitetestins') + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table36storageentitysuitetestins') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b675-0002-0064-3e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:6UkRcHL+noxsQ33uo6MPHx6utOF2ppkprQ9iQF18NUk= + Content-Length: + - "92" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table36storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: MERGE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.8099292Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b682-0002-0064-4a5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"Father":"Anakin","Mentor":"Yoda","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:6UkRcHL+noxsQ33uo6MPHx6utOF2ppkprQ9iQF18NUk= + Content-Length: + - "87" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table36storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: MERGE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:18 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A18.8579615Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b691-0002-0064-595c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:l8d2SSaA5ME/otMGZ0k3XfZb3+gNKdEwWWm8+seOKsY= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table36storageentitysuitetestins%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b69c-0002-0064-635c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrReplace.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrReplace.yaml index 1a27ea6831..959b746fea 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrReplace.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestInsertOrReplace.yaml @@ -1,185 +1,185 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table38storageentitysuitetestins"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:UApC6hOOGveWssOXfwZxX0XEiTH43zQgc7hFaxaEnHI= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table38storageentitysuitetestins') - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table38storageentitysuitetestins') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b6a7-0002-0064-6e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","HasEpicTheme":true,"Name":"Anakin","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:SdmKhX1o5pDblpgZUJf+NkW2kma6tavc7HIRCnNqdKk= - Content-Length: - - "114" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table38storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: PUT - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A19.0270829Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b6ba-0002-0064-7e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Organa","HasAwesomeDress":true,"Name":"Leia","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:SdmKhX1o5pDblpgZUJf+NkW2kma6tavc7HIRCnNqdKk= - Content-Length: - - "112" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table38storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: PUT - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A19.0751178Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b6ca-0002-0064-0d5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:zwBN93vR49I5/vLgEaNd6U0Dk7QzUMMxxQJuPwrftQo= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table38storageentitysuitetestins%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b6d2-0002-0064-155c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table38storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:UApC6hOOGveWssOXfwZxX0XEiTH43zQgc7hFaxaEnHI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table38storageentitysuitetestins') + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table38storageentitysuitetestins') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b6a7-0002-0064-6e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","HasEpicTheme":true,"Name":"Anakin","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:SdmKhX1o5pDblpgZUJf+NkW2kma6tavc7HIRCnNqdKk= + Content-Length: + - "114" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table38storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: PUT + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A19.0270829Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b6ba-0002-0064-7e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Organa","HasAwesomeDress":true,"Name":"Leia","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:SdmKhX1o5pDblpgZUJf+NkW2kma6tavc7HIRCnNqdKk= + Content-Length: + - "112" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table38storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: PUT + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A19.0751178Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b6ca-0002-0064-0d5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:zwBN93vR49I5/vLgEaNd6U0Dk7QzUMMxxQJuPwrftQo= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table38storageentitysuitetestins%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b6d2-0002-0064-155c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestMerge.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestMerge.yaml index 63bc70c820..46b016106d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestMerge.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestMerge.yaml @@ -1,282 +1,282 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table28storageentitysuitetestmer"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:UApC6hOOGveWssOXfwZxX0XEiTH43zQgc7hFaxaEnHI= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table28storageentitysuitetestmer') - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table28storageentitysuitetestmer') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b6ed-0002-0064-2f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"Country":"Mexico","MalePoet":"Nezahualcoyotl","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:waQ65Pa/FzCzNF8xq6tCL3Hwbyfkmnr7Sz+9cc7b7bU= - Content-Length: - - "100" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table28storageentitysuitetestmer/@Element","odata.type":"golangrocksonazure.table28storageentitysuitetestmer","odata.id":"https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A19.5431339Z''\"","odata.editLink":"table28storageentitysuitetestmer(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:19.5431339Z","Country":"Mexico","MalePoet":"Nezahualcoyotl"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A19.5431339Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer(PartitionKey='mypartitionkey',RowKey='myrowkey') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b6fd-0002-0064-3e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: '{"FemalePoet":"Sor Juana Ines de la Cruz","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:QKcxsU9OKUPDLmjVXAtOlcB+D5aaOfwXc70VX2nKBV8= - Content-Length: - - "94" - Content-Type: - - application/json - If-Match: - - W/"datetime'2017-04-05T22%3A33%3A19.5431339Z'" - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: MERGE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A19.5441339Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b708-0002-0064-495c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FemalePoet":"Sor Juana Ines de la Cruz","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:QKcxsU9OKUPDLmjVXAtOlcB+D5aaOfwXc70VX2nKBV8= - Content-Length: - - "94" - Content-Type: - - application/json - If-Match: - - W/"datetime''2017-04-01T01%3A07%3A23.8881885Z''" - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: MERGE - response: - body: '{"odata.error":{"code":"ConditionNotMet","message":{"lang":"en-US","value":"The - condition specified using HTTP conditional header(s) is not met.\nRequestId:ab33b717-0002-0064-585c-aeb219000000\nTime:2017-04-05T22:33:19.7592892Z"}}}' - headers: - Content-Type: - - application/json;odata=nometadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b717-0002-0064-585c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 412 Precondition Failed - code: 412 -- request: - body: '{"FemalePainter":"Frida Kahlo","MalePainter":"Diego Rivera","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:QKcxsU9OKUPDLmjVXAtOlcB+D5aaOfwXc70VX2nKBV8= - Content-Length: - - "112" - Content-Type: - - application/json - If-Match: - - '*' - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: MERGE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A19.5451339Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b735-0002-0064-765c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:uNlLRSlYVGkKM6TOWgzB6ORWehbUnExnfVVr/QwGH08= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table28storageentitysuitetestmer%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:19 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b740-0002-0064-805c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table28storageentitysuitetestmer"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:UApC6hOOGveWssOXfwZxX0XEiTH43zQgc7hFaxaEnHI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table28storageentitysuitetestmer') + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table28storageentitysuitetestmer') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b6ed-0002-0064-2f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"Country":"Mexico","MalePoet":"Nezahualcoyotl","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:waQ65Pa/FzCzNF8xq6tCL3Hwbyfkmnr7Sz+9cc7b7bU= + Content-Length: + - "100" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table28storageentitysuitetestmer/@Element","odata.type":"golangrocksonazure.table28storageentitysuitetestmer","odata.id":"https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A19.5431339Z''\"","odata.editLink":"table28storageentitysuitetestmer(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:19.5431339Z","Country":"Mexico","MalePoet":"Nezahualcoyotl"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A19.5431339Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer(PartitionKey='mypartitionkey',RowKey='myrowkey') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b6fd-0002-0064-3e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: '{"FemalePoet":"Sor Juana Ines de la Cruz","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:QKcxsU9OKUPDLmjVXAtOlcB+D5aaOfwXc70VX2nKBV8= + Content-Length: + - "94" + Content-Type: + - application/json + If-Match: + - W/"datetime'2017-04-05T22%3A33%3A19.5431339Z'" + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: MERGE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A19.5441339Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b708-0002-0064-495c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FemalePoet":"Sor Juana Ines de la Cruz","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:QKcxsU9OKUPDLmjVXAtOlcB+D5aaOfwXc70VX2nKBV8= + Content-Length: + - "94" + Content-Type: + - application/json + If-Match: + - W/"datetime''2017-04-01T01%3A07%3A23.8881885Z''" + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: MERGE + response: + body: '{"odata.error":{"code":"ConditionNotMet","message":{"lang":"en-US","value":"The + condition specified using HTTP conditional header(s) is not met.\nRequestId:ab33b717-0002-0064-585c-aeb219000000\nTime:2017-04-05T22:33:19.7592892Z"}}}' + headers: + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b717-0002-0064-585c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 412 Precondition Failed + code: 412 +- request: + body: '{"FemalePainter":"Frida Kahlo","MalePainter":"Diego Rivera","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:QKcxsU9OKUPDLmjVXAtOlcB+D5aaOfwXc70VX2nKBV8= + Content-Length: + - "112" + Content-Type: + - application/json + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table28storageentitysuitetestmer%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: MERGE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A19.5451339Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b735-0002-0064-765c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:uNlLRSlYVGkKM6TOWgzB6ORWehbUnExnfVVr/QwGH08= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table28storageentitysuitetestmer%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:19 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b740-0002-0064-805c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestUpdate.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestUpdate.yaml index 27c16ab752..1cc8a048fc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestUpdate.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/TestUpdate.yaml @@ -1,282 +1,282 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table29storageentitysuitetestupd"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:UApC6hOOGveWssOXfwZxX0XEiTH43zQgc7hFaxaEnHI= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestupd') - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestupd') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b751-0002-0064-105c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:8H5S+sLigqgd6u+Zz1ZaF4NGOeDqXGqpHNuLttJFvYY= - Content-Length: - - "323" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table29storageentitysuitetestupd/@Element","odata.type":"golangrocksonazure.table29storageentitysuitetestupd","odata.id":"https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.3944643Z''\"","odata.editLink":"table29storageentitysuitetestupd(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.3944643Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A21.3944643Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd(PartitionKey='mypartitionkey',RowKey='myrowkey') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b8be-0002-0064-5f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: '{"FamilyName":"Skywalker","HasEpicTheme":true,"Name":"Anakin","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:rZSIXhKEtGwbh/9/jOdab4Im+bjetbRJj7Q8lZcgTXQ= - Content-Length: - - "114" - Content-Type: - - application/json - If-Match: - - W/"datetime'2017-04-05T22%3A33%3A21.3944643Z'" - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: PUT - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A21.3954643Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b8cc-0002-0064-6d5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","HasEpicTheme":true,"Name":"Anakin","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:rZSIXhKEtGwbh/9/jOdab4Im+bjetbRJj7Q8lZcgTXQ= - Content-Length: - - "114" - Content-Type: - - application/json - If-Match: - - W/"datetime''2017-04-01T01%3A07%3A23.8881885Z''" - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: PUT - response: - body: '{"odata.error":{"code":"ConditionNotMet","message":{"lang":"en-US","value":"The - condition specified using HTTP conditional header(s) is not met.\nRequestId:ab33b8d9-0002-0064-795c-aeb219000000\nTime:2017-04-05T22:33:21.5435710Z"}}}' - headers: - Content-Type: - - application/json;odata=nometadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b8d9-0002-0064-795c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 412 Precondition Failed - code: 412 -- request: - body: '{"FamilyName":"Organa","HasAwesomeDress":true,"Name":"Leia","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:rZSIXhKEtGwbh/9/jOdab4Im+bjetbRJj7Q8lZcgTXQ= - Content-Length: - - "112" - Content-Type: - - application/json - If-Match: - - '*' - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - method: PUT - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A21.3964643Z'" - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b8ec-0002-0064-095c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:Fx0hjj/Vg9jCf7Cl6kLMeouq4OULBHhxYWBdz6fPfrI= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table29storageentitysuitetestupd%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b8f8-0002-0064-155c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table29storageentitysuitetestupd"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:UApC6hOOGveWssOXfwZxX0XEiTH43zQgc7hFaxaEnHI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestupd') + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table29storageentitysuitetestupd') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b751-0002-0064-105c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"AmountDue":200.23,"CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerCode@odata.type":"Edm.Guid","CustomerSince":"1992-12-20T21:55:00Z","CustomerSince@odata.type":"Edm.DateTime","IsActive":true,"NumberOfOrders":"255","NumberOfOrders@odata.type":"Edm.Int64","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:8H5S+sLigqgd6u+Zz1ZaF4NGOeDqXGqpHNuLttJFvYY= + Content-Length: + - "323" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table29storageentitysuitetestupd/@Element","odata.type":"golangrocksonazure.table29storageentitysuitetestupd","odata.id":"https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.3944643Z''\"","odata.editLink":"table29storageentitysuitetestupd(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.3944643Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A21.3944643Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd(PartitionKey='mypartitionkey',RowKey='myrowkey') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b8be-0002-0064-5f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: '{"FamilyName":"Skywalker","HasEpicTheme":true,"Name":"Anakin","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:rZSIXhKEtGwbh/9/jOdab4Im+bjetbRJj7Q8lZcgTXQ= + Content-Length: + - "114" + Content-Type: + - application/json + If-Match: + - W/"datetime'2017-04-05T22%3A33%3A21.3944643Z'" + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: PUT + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A21.3954643Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b8cc-0002-0064-6d5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","HasEpicTheme":true,"Name":"Anakin","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:rZSIXhKEtGwbh/9/jOdab4Im+bjetbRJj7Q8lZcgTXQ= + Content-Length: + - "114" + Content-Type: + - application/json + If-Match: + - W/"datetime''2017-04-01T01%3A07%3A23.8881885Z''" + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: PUT + response: + body: '{"odata.error":{"code":"ConditionNotMet","message":{"lang":"en-US","value":"The + condition specified using HTTP conditional header(s) is not met.\nRequestId:ab33b8d9-0002-0064-795c-aeb219000000\nTime:2017-04-05T22:33:21.5435710Z"}}}' + headers: + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b8d9-0002-0064-795c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 412 Precondition Failed + code: 412 +- request: + body: '{"FamilyName":"Organa","HasAwesomeDress":true,"Name":"Leia","PartitionKey":"mypartitionkey","RowKey":"myrowkey"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:rZSIXhKEtGwbh/9/jOdab4Im+bjetbRJj7Q8lZcgTXQ= + Content-Length: + - "112" + Content-Type: + - application/json + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table29storageentitysuitetestupd%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + method: PUT + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A21.3964643Z'" + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b8ec-0002-0064-095c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:Fx0hjj/Vg9jCf7Cl6kLMeouq4OULBHhxYWBdz6fPfrI= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table29storageentitysuitetestupd%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b8f8-0002-0064-155c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndDeleteEntities.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndDeleteEntities.yaml index 9b64db61fb..0d17f3b5bf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndDeleteEntities.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndDeleteEntities.yaml @@ -1,300 +1,300 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table47storageentitysuitetestins"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:cy02jfl8ITfr9jAyIek/qzm4CCuo4Y7GXvF74wIrkgY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table47storageentitysuitetestins') - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table47storageentitysuitetestins') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b90b-0002-0064-285c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","Name":"Luke","Number":3,"PartitionKey":"mypartitionkey","RowKey":"100"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:WiA7NftMB4cIorqRb3tMswathla1nQK3IRs1XXtW2UQ= - Content-Length: - - "98" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A21.7507202Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b913-0002-0064-2f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","Name":"Luke","Number":1,"PartitionKey":"mypartitionkey","RowKey":"200"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:WiA7NftMB4cIorqRb3tMswathla1nQK3IRs1XXtW2UQ= - Content-Length: - - "98" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table47storageentitysuitetestins/@Element","odata.type":"golangrocksonazure.table47storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.799755Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.799755Z","FamilyName":"Skywalker","Name":"Luke","Number":1}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A21.799755Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b921-0002-0064-3a5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:z+UsJMxVy3yvwAsQXzVKWvUioZwxIb4LQgfyfde4jgs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins?%24filter=Number+eq+1&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table47storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table47storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.799755Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.799755Z","FamilyName":"Skywalker","Name":"Luke","Number":1}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b92e-0002-0064-455c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:ijytKSa75FkwJenQs0dxgKTuIK0kqkDdtIh48XzY9KU= - If-Match: - - '*' - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27200%27%29 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b936-0002-0064-4d5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:z+UsJMxVy3yvwAsQXzVKWvUioZwxIb4LQgfyfde4jgs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins?timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table47storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table47storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.7507202Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","PartitionKey":"mypartitionkey","RowKey":"100","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.7507202Z","FamilyName":"Skywalker","Name":"Luke","Number":3}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b93c-0002-0064-535c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:OPS7H/nzJDtEovunhxSj7rACRIBMZsQE9nspHvyPiWM= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table47storageentitysuitetestins%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b957-0002-0064-6b5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table47storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:cy02jfl8ITfr9jAyIek/qzm4CCuo4Y7GXvF74wIrkgY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table47storageentitysuitetestins') + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table47storageentitysuitetestins') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b90b-0002-0064-285c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","Name":"Luke","Number":3,"PartitionKey":"mypartitionkey","RowKey":"100"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:WiA7NftMB4cIorqRb3tMswathla1nQK3IRs1XXtW2UQ= + Content-Length: + - "98" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A21.7507202Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b913-0002-0064-2f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","Name":"Luke","Number":1,"PartitionKey":"mypartitionkey","RowKey":"200"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:WiA7NftMB4cIorqRb3tMswathla1nQK3IRs1XXtW2UQ= + Content-Length: + - "98" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table47storageentitysuitetestins/@Element","odata.type":"golangrocksonazure.table47storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.799755Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.799755Z","FamilyName":"Skywalker","Name":"Luke","Number":1}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A21.799755Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b921-0002-0064-3a5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:z+UsJMxVy3yvwAsQXzVKWvUioZwxIb4LQgfyfde4jgs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins?%24filter=Number+eq+1&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table47storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table47storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.799755Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.799755Z","FamilyName":"Skywalker","Name":"Luke","Number":1}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b92e-0002-0064-455c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:ijytKSa75FkwJenQs0dxgKTuIK0kqkDdtIh48XzY9KU= + If-Match: + - '*' + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27200%27%29 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b936-0002-0064-4d5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:z+UsJMxVy3yvwAsQXzVKWvUioZwxIb4LQgfyfde4jgs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins?timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table47storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table47storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A21.7507202Z''\"","odata.editLink":"table47storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","PartitionKey":"mypartitionkey","RowKey":"100","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:21.7507202Z","FamilyName":"Skywalker","Name":"Luke","Number":3}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b93c-0002-0064-535c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:OPS7H/nzJDtEovunhxSj7rACRIBMZsQE9nspHvyPiWM= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table47storageentitysuitetestins%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b957-0002-0064-6b5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndExecuteQuery.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndExecuteQuery.yaml index cc1a93d5da..c4c63995ea 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndExecuteQuery.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndExecuteQuery.yaml @@ -1,228 +1,228 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table45storageentitysuitetestins"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:F55tia1wUmKgJZ/m9yR01k56Vd9CHyyIid1PjT/AGg0= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table45storageentitysuitetestins') - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table45storageentitysuitetestins') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b96f-0002-0064-805c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"100"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:wRiJwXWaYw48eSZV6VK8+0kdJIvRBuFT+QXxSzztHqo= - Content-Length: - - "108" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') - Date: - - Wed, 05 Apr 2017 22:33:21 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A22.1349963Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b97a-0002-0064-0a5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"200"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:wRiJwXWaYw48eSZV6VK8+0kdJIvRBuFT+QXxSzztHqo= - Content-Length: - - "108" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A22.1810293Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b982-0002-0064-125c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:TVOcnY9mrY9dn83/ZVes+i9ZTgwSyF7LxgsEWImQ5RQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins?%24filter=RowKey+eq+%27200%27&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table45storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table45storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.1810293Z''\"","odata.editLink":"table45storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.1810293Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b996-0002-0064-255c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:5LK5XDdD/WDzgpVS8zXAgmcSSntbdlbFzxiYo7u8EAc= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table45storageentitysuitetestins%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b9a5-0002-0064-325c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table45storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:F55tia1wUmKgJZ/m9yR01k56Vd9CHyyIid1PjT/AGg0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table45storageentitysuitetestins') + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table45storageentitysuitetestins') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b96f-0002-0064-805c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"100"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:wRiJwXWaYw48eSZV6VK8+0kdJIvRBuFT+QXxSzztHqo= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') + Date: + - Wed, 05 Apr 2017 22:33:21 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A22.1349963Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b97a-0002-0064-0a5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"200"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:wRiJwXWaYw48eSZV6VK8+0kdJIvRBuFT+QXxSzztHqo= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A22.1810293Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b982-0002-0064-125c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:TVOcnY9mrY9dn83/ZVes+i9ZTgwSyF7LxgsEWImQ5RQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins?%24filter=RowKey+eq+%27200%27&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table45storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table45storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table45storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.1810293Z''\"","odata.editLink":"table45storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.1810293Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b996-0002-0064-255c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:5LK5XDdD/WDzgpVS8zXAgmcSSntbdlbFzxiYo7u8EAc= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table45storageentitysuitetestins%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b9a5-0002-0064-325c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndGetEntities.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndGetEntities.yaml index 2a4734c004..7e6c1a0f96 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndGetEntities.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageEntitySuite/Test_InsertAndGetEntities.yaml @@ -1,226 +1,226 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table44storageentitysuitetestins"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:F55tia1wUmKgJZ/m9yR01k56Vd9CHyyIid1PjT/AGg0= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table44storageentitysuitetestins') - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table44storageentitysuitetestins') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b9b7-0002-0064-405c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"100"}' - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:HzZKkxWm+N5N4RC1FJtQhHlbKKECAd3V+mg76b6UgRI= - Content-Length: - - "108" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A22.3861763Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b9bd-0002-0064-455c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"200"}' - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:HzZKkxWm+N5N4RC1FJtQhHlbKKECAd3V+mg76b6UgRI= - Content-Length: - - "108" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table44storageentitysuitetestins/@Element","odata.type":"golangrocksonazure.table44storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.4352119Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.4352119Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - W/"datetime'2017-04-05T22%3A33%3A22.4352119Z'" - Location: - - https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b9cd-0002-0064-555c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:CghiB6J3n1hZpBl70J5agSQMLorAQjubezthK/UEVZ8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins?timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table44storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table44storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.3861763Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","PartitionKey":"mypartitionkey","RowKey":"100","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.3861763Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"},{"odata.type":"golangrocksonazure.table44storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.4352119Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.4352119Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b9d6-0002-0064-5e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:ne+0wCZ5Z8VUJtgbIRkqR0v4rF2BqpMKvtl1bJZ216A= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table44storageentitysuitetestins%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33b9e8-0002-0064-705c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table44storageentitysuitetestins"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:F55tia1wUmKgJZ/m9yR01k56Vd9CHyyIid1PjT/AGg0= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table44storageentitysuitetestins') + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table44storageentitysuitetestins') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b9b7-0002-0064-405c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"100"}' + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:HzZKkxWm+N5N4RC1FJtQhHlbKKECAd3V+mg76b6UgRI= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A22.3861763Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='100') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b9bd-0002-0064-455c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: '{"FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke","PartitionKey":"mypartitionkey","RowKey":"200"}' + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:HzZKkxWm+N5N4RC1FJtQhHlbKKECAd3V+mg76b6UgRI= + Content-Length: + - "108" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table44storageentitysuitetestins/@Element","odata.type":"golangrocksonazure.table44storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.4352119Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.4352119Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - W/"datetime'2017-04-05T22%3A33%3A22.4352119Z'" + Location: + - https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey='mypartitionkey',RowKey='200') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b9cd-0002-0064-555c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:CghiB6J3n1hZpBl70J5agSQMLorAQjubezthK/UEVZ8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins?timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table44storageentitysuitetestins","value":[{"odata.type":"golangrocksonazure.table44storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.3861763Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''100'')","PartitionKey":"mypartitionkey","RowKey":"100","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.3861763Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"},{"odata.type":"golangrocksonazure.table44storageentitysuitetestins","odata.id":"https://golangrocksonazure.table.core.windows.net/table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","odata.etag":"W/\"datetime''2017-04-05T22%3A33%3A22.4352119Z''\"","odata.editLink":"table44storageentitysuitetestins(PartitionKey=''mypartitionkey'',RowKey=''200'')","PartitionKey":"mypartitionkey","RowKey":"200","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-05T22:33:22.4352119Z","FamilyName":"Skywalker","HasCoolWeapon":true,"Name":"Luke"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b9d6-0002-0064-5e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:ne+0wCZ5Z8VUJtgbIRkqR0v4rF2BqpMKvtl1bJZ216A= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table44storageentitysuitetestins%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33b9e8-0002-0064-705c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileMissingFile.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileMissingFile.yaml index c249e80074..858d994ef9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileMissingFile.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileMissingFile.yaml @@ -1,128 +1,128 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:S+EpqQqFM1g2Gs0deNksf1DYTg6h0EtsZueKSGi29WA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C453642F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f0-001a-00eb-5a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:0FWm/JBcLHsfuVOIWaLMcZ646JZWgpJGRMADPxZ4pHY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile/one?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C4325B3F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f2-001a-00eb-5b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:36kI+byDQVZjmIHbfqq3ZmjH3YgwDJj865RGGy7cZ7s= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Copy-Source: - - "" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile/one/someother.file - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x4D\x69\x73\x73\x69\x6E\x67\x52\x65\x71\x75\x69\x72\x65\x64\x48\x65\x61\x64\x65\x72\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x41\x6E\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x20\x74\x68\x61\x74\x27\x73\x20\x6D\x61\x6E\x64\x61\x74\x6F\x72\x79\x20\x66\x6F\x72\x20\x74\x68\x69\x73\x20\x72\x65\x71\x75\x65\x73\x74\x20\x69\x73\x20\x6E\x6F\x74\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x31\x66\x33\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x35\x63\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x32\x2E\x33\x39\x34\x36\x30\x30\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x63\x6F\x6E\x74\x65\x6E\x74\x2D\x6C\x65\x6E\x67\x74\x68\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "300" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f3-001a-00eb-5c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 400 An HTTP header that's mandatory for this request is not specified. - code: 400 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:E4PK6XOwNMGXpBT49OtEBHqOfHPdHCw7JdJUJKHvecs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f4-001a-00eb-5d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:S+EpqQqFM1g2Gs0deNksf1DYTg6h0EtsZueKSGi29WA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C453642F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f0-001a-00eb-5a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0FWm/JBcLHsfuVOIWaLMcZ646JZWgpJGRMADPxZ4pHY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile/one?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C4325B3F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f2-001a-00eb-5b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:36kI+byDQVZjmIHbfqq3ZmjH3YgwDJj865RGGy7cZ7s= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Copy-Source: + - "" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile/one/someother.file + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x4D\x69\x73\x73\x69\x6E\x67\x52\x65\x71\x75\x69\x72\x65\x64\x48\x65\x61\x64\x65\x72\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x41\x6E\x20\x48\x54\x54\x50\x20\x68\x65\x61\x64\x65\x72\x20\x74\x68\x61\x74\x27\x73\x20\x6D\x61\x6E\x64\x61\x74\x6F\x72\x79\x20\x66\x6F\x72\x20\x74\x68\x69\x73\x20\x72\x65\x71\x75\x65\x73\x74\x20\x69\x73\x20\x6E\x6F\x74\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x31\x66\x33\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x35\x63\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x32\x32\x2E\x33\x39\x34\x36\x30\x30\x30\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x78\x2D\x6D\x73\x2D\x63\x6F\x6E\x74\x65\x6E\x74\x2D\x6C\x65\x6E\x67\x74\x68\x3C\x2F\x48\x65\x61\x64\x65\x72\x4E\x61\x6D\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "300" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f3-001a-00eb-5c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 400 An HTTP header that's mandatory for this request is not specified. + code: 400 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:E4PK6XOwNMGXpBT49OtEBHqOfHPdHCw7JdJUJKHvecs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-40storagefilesuitetestcopyfilemissingfile?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f4-001a-00eb-5d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountNoMetaData.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountNoMetaData.yaml index 891d55ffd7..c9b66493fb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountNoMetaData.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountNoMetaData.yaml @@ -1,289 +1,289 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:MpXcRE8AcpFRx6UGqBsnu81pD8kXXp0KmEqwnGLwNas= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C471C735"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f5-001a-00eb-5e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:r/vbpZmLgpuVrphnZGp7JNOwPo16kAgvQtz0Hw+/39w= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C4510C4D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f7-001a-00eb-5f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:fVAGhJTYMTaf32EAuEZcZIZRhGwjid4NR6rEJ5I70eg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C45E551E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f8-001a-00eb-605c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/GrRmNJMGmvjI59B+DXQUZOauBWipzS+4QtY1vJA6ug= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "1024" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:22 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C469C8DF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271f9-001a-00eb-615c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dMfWg7/08PTtlDJzbQQUajsPjtjSjpW2tL+Rc6regFA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file - method: HEAD - response: - body: "" - headers: - Content-Length: - - "1024" - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C469C8DF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271fa-001a-00eb-625c-aefc45000000 - X-Ms-Type: - - File - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SBAwcDCKwRKlcjSoLAg+sAyoiaR4tqQ2m+n1Ew49LMI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Copy-Source: - - https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/someother.file - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C48FF554"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - c0a7ceda-c893-4efc-82e4-6bf63b1b7b13 - X-Ms-Copy-Status: - - success - X-Ms-Request-Id: - - 5a0271fb-001a-00eb-635c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jQKnIPOy9kUBbMTLXhFSxAxoROW4nBjXXvRxCy0u61g= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271fc-001a-00eb-645c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JJNkKo40JTjM7D6cQTHriQ+j9hh4giWsg5VltV6yhOc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/someother.file - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271fd-001a-00eb-655c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:95AIos3qH/NY0eJgzKonNkl7B3pbksKhiPL76WJuAV0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271fe-001a-00eb-665c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MpXcRE8AcpFRx6UGqBsnu81pD8kXXp0KmEqwnGLwNas= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C471C735"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f5-001a-00eb-5e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:r/vbpZmLgpuVrphnZGp7JNOwPo16kAgvQtz0Hw+/39w= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C4510C4D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f7-001a-00eb-5f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:fVAGhJTYMTaf32EAuEZcZIZRhGwjid4NR6rEJ5I70eg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C45E551E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f8-001a-00eb-605c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/GrRmNJMGmvjI59B+DXQUZOauBWipzS+4QtY1vJA6ug= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "1024" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:22 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C469C8DF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271f9-001a-00eb-615c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dMfWg7/08PTtlDJzbQQUajsPjtjSjpW2tL+Rc6regFA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file + method: HEAD + response: + body: "" + headers: + Content-Length: + - "1024" + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C469C8DF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271fa-001a-00eb-625c-aefc45000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SBAwcDCKwRKlcjSoLAg+sAyoiaR4tqQ2m+n1Ew49LMI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Copy-Source: + - https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/someother.file + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C48FF554"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - c0a7ceda-c893-4efc-82e4-6bf63b1b7b13 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 5a0271fb-001a-00eb-635c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jQKnIPOy9kUBbMTLXhFSxAxoROW4nBjXXvRxCy0u61g= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/some.file + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271fc-001a-00eb-645c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JJNkKo40JTjM7D6cQTHriQ+j9hh4giWsg5VltV6yhOc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata/one/two/someother.file + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271fd-001a-00eb-655c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:95AIos3qH/NY0eJgzKonNkl7B3pbksKhiPL76WJuAV0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-50storagefilesuitetestcopyfilesameaccountnometadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271fe-001a-00eb-665c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountTimeout.yaml index 73f7e31c12..bc8c4b2612 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCopyFileSameAccountTimeout.yaml @@ -1,252 +1,252 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:udbzIbMGhVi2tr0UM3xYe15NXZZazWt0LjpM2vOmsu4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:22 GMT - Etag: - - '"0x8D47C73C4DE7FB1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a0271ff-001a-00eb-675c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:taMcePzD9wI/ovuSi6aFs63ixESIsCj0wMjNM+yKJSo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C4BF4B29"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027201-001a-00eb-685c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YNlmzJEJ7sLl9IPYl72Mr2OxM1jntul6kWKFPH36270= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C4C67873"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027202-001a-00eb-695c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:jro2AAKY68Ojud4PS6d1lf0s3cY+1rJiw8PGMN3h56k= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "1024" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/some.file - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C4E10A07"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027203-001a-00eb-6a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Ux6DJZBmhlEdy7hj2YPYA6W+yxU0RIwYScTPQsE7Uvw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Copy-Source: - - https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/some.file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/someother.file?timeout=60 - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C4EE52CF"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Copy-Id: - - 726ba2bf-9402-4d46-be1a-f2fb34259063 - X-Ms-Copy-Status: - - success - X-Ms-Request-Id: - - 5a027204-001a-00eb-6b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:RJHkCdxWNiaQT0PAYfZgUY1uDlHw3db/cupoQ/oRCPs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/some.file - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027205-001a-00eb-6c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TZF2tA4D5ilv/70W7BrnPBEmaNQ4s95vibFTuCTpWfo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/someother.file - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027206-001a-00eb-6d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:mTMrVQxecnfqWIaD//ZPdqOIANe2fnBrcXgobxBC/ks= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:23 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027207-001a-00eb-6e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:udbzIbMGhVi2tr0UM3xYe15NXZZazWt0LjpM2vOmsu4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:22 GMT + Etag: + - '"0x8D47C73C4DE7FB1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a0271ff-001a-00eb-675c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:taMcePzD9wI/ovuSi6aFs63ixESIsCj0wMjNM+yKJSo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C4BF4B29"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027201-001a-00eb-685c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YNlmzJEJ7sLl9IPYl72Mr2OxM1jntul6kWKFPH36270= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C4C67873"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027202-001a-00eb-695c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:jro2AAKY68Ojud4PS6d1lf0s3cY+1rJiw8PGMN3h56k= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "1024" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/some.file + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C4E10A07"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027203-001a-00eb-6a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Ux6DJZBmhlEdy7hj2YPYA6W+yxU0RIwYScTPQsE7Uvw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Copy-Source: + - https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/some.file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/someother.file?timeout=60 + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C4EE52CF"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Copy-Id: + - 726ba2bf-9402-4d46-be1a-f2fb34259063 + X-Ms-Copy-Status: + - success + X-Ms-Request-Id: + - 5a027204-001a-00eb-6b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RJHkCdxWNiaQT0PAYfZgUY1uDlHw3db/cupoQ/oRCPs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/some.file + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027205-001a-00eb-6c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TZF2tA4D5ilv/70W7BrnPBEmaNQ4s95vibFTuCTpWfo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout/one/two/someother.file + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027206-001a-00eb-6d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:mTMrVQxecnfqWIaD//ZPdqOIANe2fnBrcXgobxBC/ks= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:23 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-47storagefilesuitetestcopyfilesameaccounttimeout?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027207-001a-00eb-6e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCreateFile.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCreateFile.yaml index dea93ffee3..0bc5461432 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCreateFile.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestCreateFile.yaml @@ -1,240 +1,240 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2AhHYE7Is2hJ5ffLFRRx9HS4/d/+DXBcmGFQHWBuQDo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C5420EBD"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02720a-001a-00eb-705c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YnflvuFlNvKqr2pMY7LV7kw4JqMn8MBXuDHUX+sHECw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C52104A6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02720c-001a-00eb-715c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:5O/hOKh72G8ZYpE7TU6u0O6VLPnmkoTJ8Odvv5hBXxw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two?restype=directory - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C528A728"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02720d-001a-00eb-725c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HqWvnjX27W9jv9Ap4apHDeJHX6tpTAYmOAANYUsZOR4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02720e-001a-00eb-735c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ADQao/We+Ye7YzmolaahiHZ7ZMBYBnfDvkM+xqBEUuw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "1024" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:23 GMT - Etag: - - '"0x8D47C73C5477F49"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:23 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02720f-001a-00eb-745c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NHiqWuo1e3lzEKehnQXa1ZhxHznph4+MOiSFINyIoeU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027210-001a-00eb-755c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HqWvnjX27W9jv9Ap4apHDeJHX6tpTAYmOAANYUsZOR4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027211-001a-00eb-765c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified resource does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Bj2Bin+xGxxrdtK8deCXb9hQBK/zBe9jqty6/7uFZRo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027212-001a-00eb-775c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2AhHYE7Is2hJ5ffLFRRx9HS4/d/+DXBcmGFQHWBuQDo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C5420EBD"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02720a-001a-00eb-705c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YnflvuFlNvKqr2pMY7LV7kw4JqMn8MBXuDHUX+sHECw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C52104A6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02720c-001a-00eb-715c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:5O/hOKh72G8ZYpE7TU6u0O6VLPnmkoTJ8Odvv5hBXxw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two?restype=directory + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C528A728"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02720d-001a-00eb-725c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HqWvnjX27W9jv9Ap4apHDeJHX6tpTAYmOAANYUsZOR4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02720e-001a-00eb-735c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ADQao/We+Ye7YzmolaahiHZ7ZMBYBnfDvkM+xqBEUuw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "1024" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:23 GMT + Etag: + - '"0x8D47C73C5477F49"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:23 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02720f-001a-00eb-745c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NHiqWuo1e3lzEKehnQXa1ZhxHznph4+MOiSFINyIoeU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027210-001a-00eb-755c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HqWvnjX27W9jv9Ap4apHDeJHX6tpTAYmOAANYUsZOR4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile/one/two/some.file + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027211-001a-00eb-765c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified resource does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Bj2Bin+xGxxrdtK8deCXb9hQBK/zBe9jqty6/7uFZRo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestcreatefile?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027212-001a-00eb-775c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMD5.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMD5.yaml index 111c761f9b..d998a5cfa0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMD5.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMD5.yaml @@ -1,225 +1,225 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GDcErV0MKKWj9vyAo8Sd9hofqgLzAFUICQyAlRfzTQU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C59E979F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027213-001a-00eb-785c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:L2CXYDagD0SCSQYa5R5zyW5EyVZ/P6LW61vFY8A8NjA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "1024" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5/test.dat - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C57DB429"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027215-001a-00eb-795c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: !!binary | - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ///////////////////////////////////w== - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ktNHnVNY8+4nY1jrfSsYegujNYDUGhp9ck+UqpVGHBY= - Content-Length: - - "1024" - Content-Md5: - - mokYsRh42lBvdhvBycTOFw== - Range: - - bytes=0-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5/test.dat?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - mokYsRh42lBvdhvBycTOFw== - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C586684C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027216-001a-00eb-7a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DsfquVvrO5fR+xc3bvnvW6/T0izTqopb+YEvqItyAkc= - Range: - - bytes=0-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Range-Get-Content-Md5: - - "true" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5/test.dat - method: GET - response: - body: !!binary | - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ///////////////////////////////////w== - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Md5: - - mokYsRh42lBvdhvBycTOFw== - Content-Range: - - bytes 0-1023/1024 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C586684C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027217-001a-00eb-7b5c-aefc45000000 - X-Ms-Type: - - File - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:zpYhbNL94X54QfRPxArAPuGGa6uV2FuXfy57A+ORQBg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:24 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027218-001a-00eb-7c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GDcErV0MKKWj9vyAo8Sd9hofqgLzAFUICQyAlRfzTQU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C59E979F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027213-001a-00eb-785c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L2CXYDagD0SCSQYa5R5zyW5EyVZ/P6LW61vFY8A8NjA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "1024" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5/test.dat + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C57DB429"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027215-001a-00eb-795c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ///////////////////////////////////w== + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ktNHnVNY8+4nY1jrfSsYegujNYDUGhp9ck+UqpVGHBY= + Content-Length: + - "1024" + Content-Md5: + - mokYsRh42lBvdhvBycTOFw== + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5/test.dat?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - mokYsRh42lBvdhvBycTOFw== + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C586684C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027216-001a-00eb-7a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DsfquVvrO5fR+xc3bvnvW6/T0izTqopb+YEvqItyAkc= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Range-Get-Content-Md5: + - "true" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5/test.dat + method: GET + response: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ///////////////////////////////////w== + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Md5: + - mokYsRh42lBvdhvBycTOFw== + Content-Range: + - bytes 0-1023/1024 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C586684C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027217-001a-00eb-7b5c-aefc45000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zpYhbNL94X54QfRPxArAPuGGa6uV2FuXfy57A+ORQBg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:24 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestfilemd5?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027218-001a-00eb-7c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMetadata.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMetadata.yaml index 18b1d2d455..7e5476574f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMetadata.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileMetadata.yaml @@ -1,173 +1,173 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:cp98c9s4axvdKfWe0oaM+dTLU9tr6eV1WCeBo3Dq6AQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5C958FB"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027219-001a-00eb-7d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/jSwP/zdV5+8aq8f0p6K7J9zWCT1CVQRGJtCBfd+210= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "512" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata/test.dat - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5AABFAD"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02721b-001a-00eb-7e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FQmNZz5lbp/tSmomNAS8cuJrZYGlUUiwnB+hOIPrNOk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata/test.dat?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5B3259E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02721c-001a-00eb-7f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:h/y5MQViGWwunnHhxfsA4ssD8hH4HR0VeyYAM9JgMLs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata/test.dat - method: HEAD - response: - body: "" - headers: - Content-Length: - - "512" - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5B3259E"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Request-Id: - - 5a02721d-001a-00eb-805c-aefc45000000 - X-Ms-Type: - - File - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Sr9cjx5UdXEPhncMILPi9Tac0gC4NlCibph+YsC5heE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02721f-001a-00eb-015c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cp98c9s4axvdKfWe0oaM+dTLU9tr6eV1WCeBo3Dq6AQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5C958FB"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027219-001a-00eb-7d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/jSwP/zdV5+8aq8f0p6K7J9zWCT1CVQRGJtCBfd+210= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "512" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata/test.dat + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5AABFAD"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02721b-001a-00eb-7e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FQmNZz5lbp/tSmomNAS8cuJrZYGlUUiwnB+hOIPrNOk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata/test.dat?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5B3259E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02721c-001a-00eb-7f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:h/y5MQViGWwunnHhxfsA4ssD8hH4HR0VeyYAM9JgMLs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata/test.dat + method: HEAD + response: + body: "" + headers: + Content-Length: + - "512" + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5B3259E"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Request-Id: + - 5a02721d-001a-00eb-805c-aefc45000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Sr9cjx5UdXEPhncMILPi9Tac0gC4NlCibph+YsC5heE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-33storagefilesuitetestfilemetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02721f-001a-00eb-015c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileProperties.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileProperties.yaml index 9e66a34efd..2864fdfd03 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileProperties.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileProperties.yaml @@ -1,185 +1,185 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3gfImYdosqvrxRgvVla5TdbSnMMyDpDOotk7cE0oLbE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5F48F9C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027220-001a-00eb-025c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QUcZcmHhF9uj85TOgJVzshkwYWq+6WwG7Fh9LdayK/o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "512" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties/test.dat - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5D3ABC4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027222-001a-00eb-035c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+PLaoHZYQZiStKQ+FuhTCccvJsszoRQTQ+d9mhXRJ9Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Cache-Control: - - cachecontrol - X-Ms-Content-Disposition: - - friendly - X-Ms-Content-Encoding: - - noencoding - X-Ms-Content-Language: - - neutral - X-Ms-Content-Length: - - "512" - X-Ms-Content-Type: - - mytype - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties/test.dat?comp=properties - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5DBEA9A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027223-001a-00eb-045c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:t6KQ/eA5uuM1MEPSG1eiThbrxbDSNR8V/pOffmqrqCQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties/test.dat - method: HEAD - response: - body: "" - headers: - Cache-Control: - - cachecontrol - Content-Disposition: - - friendly - Content-Encoding: - - noencoding - Content-Language: - - neutral - Content-Length: - - "512" - Content-Type: - - mytype - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Etag: - - '"0x8D47C73C5DBEA9A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027224-001a-00eb-055c-aefc45000000 - X-Ms-Type: - - File - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:oVbaWAjk4oZnmwToeFb09LmFdFkF1j5F8V8YrvLmv8w= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:24 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027225-001a-00eb-065c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3gfImYdosqvrxRgvVla5TdbSnMMyDpDOotk7cE0oLbE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5F48F9C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027220-001a-00eb-025c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QUcZcmHhF9uj85TOgJVzshkwYWq+6WwG7Fh9LdayK/o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "512" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties/test.dat + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5D3ABC4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027222-001a-00eb-035c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+PLaoHZYQZiStKQ+FuhTCccvJsszoRQTQ+d9mhXRJ9Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Cache-Control: + - cachecontrol + X-Ms-Content-Disposition: + - friendly + X-Ms-Content-Encoding: + - noencoding + X-Ms-Content-Language: + - neutral + X-Ms-Content-Length: + - "512" + X-Ms-Content-Type: + - mytype + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties/test.dat?comp=properties + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5DBEA9A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027223-001a-00eb-045c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:t6KQ/eA5uuM1MEPSG1eiThbrxbDSNR8V/pOffmqrqCQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties/test.dat + method: HEAD + response: + body: "" + headers: + Cache-Control: + - cachecontrol + Content-Disposition: + - friendly + Content-Encoding: + - noencoding + Content-Language: + - neutral + Content-Length: + - "512" + Content-Type: + - mytype + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Etag: + - '"0x8D47C73C5DBEA9A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027224-001a-00eb-055c-aefc45000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oVbaWAjk4oZnmwToeFb09LmFdFkF1j5F8V8YrvLmv8w= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-35storagefilesuitetestfileproperties?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:24 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027225-001a-00eb-065c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileRanges.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileRanges.yaml index 1c8c54ae87..1d4b2ff297 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileRanges.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestFileRanges.yaml @@ -1,1010 +1,1010 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:R8UCr5bKHYuhdTvZerXTrWvE2fbUyBCSrmXa6q16I0U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C61CDF85"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027226-001a-00eb-075c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gp3Oc/Uk7U7r0ZmfuLVmcgZKXB/dt2Ujizj92s/ZfY8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "4096" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file1.txt - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C5FBAD4D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027228-001a-00eb-085c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:lnvMKlnqJ74u31F1RpBoy7AAboj57EPDSMZDvADBkVc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file1.txt?comp=rangelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x20\x2F\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C5FBAD4D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Content-Length: - - "4096" - X-Ms-Request-Id: - - 5a027229-001a-00eb-095c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure://8iZCTapTBflUcqii//dDJkNROH/ivxL0S6hfTj8yU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "4096" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file2.txt - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C60B195C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02722a-001a-00eb-0a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:XNtcoZ+qTIS8KSda6WBvAuSW6nlHVYVtuLGsjsTvdqo= - Content-Length: - - "4096" - Range: - - bytes=0-4095 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file2.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - jsb3Ma13LxsCTUxwb89yFw== - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6199AE4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02722b-001a-00eb-0b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:CeEhs4ThZzmg1KI9B7+t/KdGRsuyxTJUNptx7ciIkog= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file2.txt?comp=rangelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x34\x30\x39\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6199AE4"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Content-Length: - - "4096" - X-Ms-Request-Id: - - 5a02722c-001a-00eb-0c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/JIHcrxParjsX9e45Ow1/GSP/N0xeXRspgiQ6XkjXXU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "4096" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6286A9F"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02722d-001a-00eb-0d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7Y1ICY2i50Qccv8DS7zmc1YWmFj6F9cRErdHxlUjRMY= - Content-Length: - - "4096" - Range: - - bytes=0-4095 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - jsb3Ma13LxsCTUxwb89yFw== - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6300D14"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02722e-001a-00eb-0e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:xiaE22UDyIaqhqszU7Aac6ue1gbLMY8zu4jAe8edizI= - Content-Length: - - "0" - Range: - - bytes=0-4095 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:25 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - clear - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt?comp=range - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6378880"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02722f-001a-00eb-0f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QdlQR23vZQ9JqVpfNijfe02aQ+sj0RGkXJp8YytVe4Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt?comp=rangelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x20\x2F\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6378880"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Content-Length: - - "4096" - X-Ms-Request-Id: - - 5a027230-001a-00eb-105c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:y1Vjs4w7KRYYwvHXPLgd0A+0ydXzvNONYMGYosQCias= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "4096" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C64594C8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027231-001a-00eb-115c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Q1one+UsUJ4GNRviiARELm5+MS3Cr3puPWKS02lt05I= - Content-Length: - - "512" - Range: - - bytes=0-511 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C64D102A"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027232-001a-00eb-125c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FVxHa6IXwEHmYRyiQS58rJKi0t7z6RprQDaQwyJFoUc= - Content-Length: - - "512" - Range: - - bytes=1024-1535 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C654B2AC"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027233-001a-00eb-135c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QAu471nRbmar0197vPIDFpFc96KtpVkoRuNG3RFUjE0= - Content-Length: - - "512" - Range: - - bytes=2048-2559 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C6661AE5"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027234-001a-00eb-145c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:al5gIxfQF01kp4pdVQHyW0r4IUP8wn3ifivYACNWq30= - Content-Length: - - "512" - Range: - - bytes=3072-3583 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - 2Xr7q2sERdQmQ41hZ7sPvQ== - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C66D6F35"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027235-001a-00eb-155c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:t0n7KNhUMmFLUpRpRAXJdj1IKWthmn6WdOfYsofuK40= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=rangelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x35\x31\x31\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x31\x30\x32\x34\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x31\x35\x33\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x34\x38\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x35\x35\x39\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x33\x30\x37\x32\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x33\x35\x38\x33\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:25 GMT - Etag: - - '"0x8D47C73C66D6F35"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Content-Length: - - "4096" - X-Ms-Request-Id: - - 5a027236-001a-00eb-165c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:iKY/eEZXTz0X3uRR06N5zHpuyolzZKySjiDBNZ6yEJ0= - Range: - - bytes=1000-3000 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=rangelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x31\x30\x32\x34\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x31\x35\x33\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x34\x38\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x35\x35\x39\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C66D6F35"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:25 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Content-Length: - - "4096" - X-Ms-Request-Id: - - 5a027238-001a-00eb-175c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:aAJUH9hdxXdjXhMD/h3UJP3VD54JvJg7Fl/3tByBgcE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "4096" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6963431"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027239-001a-00eb-185c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat - eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus - massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo - interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. - Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec - ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida - dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit - volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:pxTDbT1N1tzDsvN6vp3WjCnT7r2neYkHLH4cqJJu6IY= - Content-Length: - - "4096" - Range: - - bytes=0-4095 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - jsb3Ma13LxsCTUxwb89yFw== - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6B225A6"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02723a-001a-00eb-195c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:tPpzg7V0upNpe63MqTv1TihLSsq52uj3eNKKljPSYP0= - Content-Length: - - "0" - Range: - - bytes=0-511 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - clear - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=range - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6B9A108"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02723b-001a-00eb-1a5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:esNaZmaV5gsCKjugqgoAvD1MH/zhw8B4FSK7m1VYiSM= - Content-Length: - - "0" - Range: - - bytes=2048-2559 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - clear - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=range - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6C0F558"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02723c-001a-00eb-1b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HsfhiM/q4W2tJ4FNPQSB3as2uMpdag5dwHMFReSFLfU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=rangelist - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x35\x31\x32\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x30\x34\x37\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x35\x36\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x34\x30\x39\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6C0F558"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Content-Length: - - "4096" - X-Ms-Request-Id: - - 5a02723d-001a-00eb-1c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Zvu5JIwAAJusgoPk7ReVzyEsu7c6TvYzT1SH9dpUOrk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02723e-001a-00eb-1d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:R8UCr5bKHYuhdTvZerXTrWvE2fbUyBCSrmXa6q16I0U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C61CDF85"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027226-001a-00eb-075c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gp3Oc/Uk7U7r0ZmfuLVmcgZKXB/dt2Ujizj92s/ZfY8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "4096" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file1.txt + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C5FBAD4D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027228-001a-00eb-085c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:lnvMKlnqJ74u31F1RpBoy7AAboj57EPDSMZDvADBkVc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file1.txt?comp=rangelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x20\x2F\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C5FBAD4D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - 5a027229-001a-00eb-095c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure://8iZCTapTBflUcqii//dDJkNROH/ivxL0S6hfTj8yU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "4096" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file2.txt + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C60B195C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02722a-001a-00eb-0a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XNtcoZ+qTIS8KSda6WBvAuSW6nlHVYVtuLGsjsTvdqo= + Content-Length: + - "4096" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file2.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - jsb3Ma13LxsCTUxwb89yFw== + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6199AE4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02722b-001a-00eb-0b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CeEhs4ThZzmg1KI9B7+t/KdGRsuyxTJUNptx7ciIkog= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file2.txt?comp=rangelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x34\x30\x39\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6199AE4"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - 5a02722c-001a-00eb-0c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/JIHcrxParjsX9e45Ow1/GSP/N0xeXRspgiQ6XkjXXU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "4096" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6286A9F"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02722d-001a-00eb-0d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7Y1ICY2i50Qccv8DS7zmc1YWmFj6F9cRErdHxlUjRMY= + Content-Length: + - "4096" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - jsb3Ma13LxsCTUxwb89yFw== + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6300D14"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02722e-001a-00eb-0e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:xiaE22UDyIaqhqszU7Aac6ue1gbLMY8zu4jAe8edizI= + Content-Length: + - "0" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:25 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - clear + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt?comp=range + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6378880"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02722f-001a-00eb-0f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QdlQR23vZQ9JqVpfNijfe02aQ+sj0RGkXJp8YytVe4Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file3.txt?comp=rangelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x20\x2F\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6378880"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - 5a027230-001a-00eb-105c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:y1Vjs4w7KRYYwvHXPLgd0A+0ydXzvNONYMGYosQCias= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "4096" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C64594C8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027231-001a-00eb-115c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Q1one+UsUJ4GNRviiARELm5+MS3Cr3puPWKS02lt05I= + Content-Length: + - "512" + Range: + - bytes=0-511 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C64D102A"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027232-001a-00eb-125c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FVxHa6IXwEHmYRyiQS58rJKi0t7z6RprQDaQwyJFoUc= + Content-Length: + - "512" + Range: + - bytes=1024-1535 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C654B2AC"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027233-001a-00eb-135c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QAu471nRbmar0197vPIDFpFc96KtpVkoRuNG3RFUjE0= + Content-Length: + - "512" + Range: + - bytes=2048-2559 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C6661AE5"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027234-001a-00eb-145c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:al5gIxfQF01kp4pdVQHyW0r4IUP8wn3ifivYACNWq30= + Content-Length: + - "512" + Range: + - bytes=3072-3583 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - 2Xr7q2sERdQmQ41hZ7sPvQ== + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C66D6F35"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027235-001a-00eb-155c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:t0n7KNhUMmFLUpRpRAXJdj1IKWthmn6WdOfYsofuK40= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=rangelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x35\x31\x31\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x31\x30\x32\x34\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x31\x35\x33\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x34\x38\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x35\x35\x39\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x33\x30\x37\x32\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x33\x35\x38\x33\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:25 GMT + Etag: + - '"0x8D47C73C66D6F35"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - 5a027236-001a-00eb-165c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:iKY/eEZXTz0X3uRR06N5zHpuyolzZKySjiDBNZ6yEJ0= + Range: + - bytes=1000-3000 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file4.txt?comp=rangelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x31\x30\x32\x34\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x31\x35\x33\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x34\x38\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x35\x35\x39\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C66D6F35"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:25 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - 5a027238-001a-00eb-175c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aAJUH9hdxXdjXhMD/h3UJP3VD54JvJg7Fl/3tByBgcE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "4096" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6963431"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027239-001a-00eb-185c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat + eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et finibus + massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque id justo + interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. + Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. Donec + ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida + dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit + volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pxTDbT1N1tzDsvN6vp3WjCnT7r2neYkHLH4cqJJu6IY= + Content-Length: + - "4096" + Range: + - bytes=0-4095 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - jsb3Ma13LxsCTUxwb89yFw== + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6B225A6"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02723a-001a-00eb-195c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:tPpzg7V0upNpe63MqTv1TihLSsq52uj3eNKKljPSYP0= + Content-Length: + - "0" + Range: + - bytes=0-511 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - clear + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=range + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6B9A108"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02723b-001a-00eb-1a5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:esNaZmaV5gsCKjugqgoAvD1MH/zhw8B4FSK7m1VYiSM= + Content-Length: + - "0" + Range: + - bytes=2048-2559 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - clear + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=range + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6C0F558"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02723c-001a-00eb-1b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HsfhiM/q4W2tJ4FNPQSB3as2uMpdag5dwHMFReSFLfU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges/file5.txt?comp=rangelist + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x52\x61\x6E\x67\x65\x73\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x35\x31\x32\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x32\x30\x34\x37\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x52\x61\x6E\x67\x65\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x35\x36\x30\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x6E\x64\x3E\x34\x30\x39\x35\x3C\x2F\x45\x6E\x64\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x3E\x3C\x2F\x52\x61\x6E\x67\x65\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6C0F558"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Content-Length: + - "4096" + X-Ms-Request-Id: + - 5a02723d-001a-00eb-1c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Zvu5JIwAAJusgoPk7ReVzyEsu7c6TvYzT1SH9dpUOrk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-31storagefilesuitetestfileranges?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02723e-001a-00eb-1d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestGetFile.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestGetFile.yaml index cf76551f79..17c1540aff 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestGetFile.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageFileSuite/TestGetFile.yaml @@ -1,315 +1,315 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9kLR92BuyF5lIzw8zheBCz7oBG7DFMgjO5naq0+KM8U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C703995D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02723f-001a-00eb-1e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:yhcuHp2qA/h0cp3Kz4SxP3nYnA202aVeY0FHnKtzim4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Content-Length: - - "1024" - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Type: - - file - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6E2DB49"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027241-001a-00eb-1f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: !!binary | - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ///////////////////////////////////w== - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:pFNRo5uEefHQp6iBSfukEKmsWsAnwdrYvXgalmqCVT8= - Content-Length: - - "1024" - Range: - - bytes=0-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - X-Ms-Write: - - update - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file?comp=range - method: PUT - response: - body: "" - headers: - Content-Md5: - - mokYsRh42lBvdhvBycTOFw== - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6EAF30C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027242-001a-00eb-205c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:BGWZeSVp8JMKSQf8WES3wPYVr67bF6bJwFPxsQn7Iow= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file?comp=metadata - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6F2475C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027243-001a-00eb-215c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Y8hknOSjeE5QxB4LIbz1OocJ9mbHLa2S52Psm2LT+lg= - Range: - - bytes=0-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file - method: GET - response: - body: !!binary | - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ///////////////////////////////////w== - headers: - Accept-Ranges: - - bytes - Content-Length: - - "1024" - Content-Range: - - bytes 0-1023/1024 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6F2475C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Request-Id: - - 5a027244-001a-00eb-225c-aefc45000000 - X-Ms-Type: - - File - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2CRI15qsJg6UODR5aiqEFi9R/AU3f+N249JkW7E4goA= - Range: - - bytes=512-1023 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file - method: GET - response: - body: !!binary | - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////8= - headers: - Accept-Ranges: - - bytes - Content-Length: - - "512" - Content-Range: - - bytes 512-1023/1024 - Content-Type: - - application/octet-stream - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Etag: - - '"0x8D47C73C6F2475C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Another: - - anothervalue - X-Ms-Meta-Something: - - somethingvalue - X-Ms-Request-Id: - - 5a027245-001a-00eb-235c-aefc45000000 - X-Ms-Type: - - File - X-Ms-Version: - - 2016-05-31 - status: 206 Partial Content - code: 206 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:wnzAnAKDNFWSecVFKqh4wxsKBvdl2M2RdJrU6dYTRTo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:26 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027246-001a-00eb-245c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9kLR92BuyF5lIzw8zheBCz7oBG7DFMgjO5naq0+KM8U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C703995D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02723f-001a-00eb-1e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:yhcuHp2qA/h0cp3Kz4SxP3nYnA202aVeY0FHnKtzim4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Content-Length: + - "1024" + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Type: + - file + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6E2DB49"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027241-001a-00eb-1f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ///////////////////////////////////w== + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pFNRo5uEefHQp6iBSfukEKmsWsAnwdrYvXgalmqCVT8= + Content-Length: + - "1024" + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + X-Ms-Write: + - update + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file?comp=range + method: PUT + response: + body: "" + headers: + Content-Md5: + - mokYsRh42lBvdhvBycTOFw== + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6EAF30C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027242-001a-00eb-205c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BGWZeSVp8JMKSQf8WES3wPYVr67bF6bJwFPxsQn7Iow= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file?comp=metadata + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6F2475C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027243-001a-00eb-215c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Y8hknOSjeE5QxB4LIbz1OocJ9mbHLa2S52Psm2LT+lg= + Range: + - bytes=0-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file + method: GET + response: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ///////////////////////////////////w== + headers: + Accept-Ranges: + - bytes + Content-Length: + - "1024" + Content-Range: + - bytes 0-1023/1024 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6F2475C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Request-Id: + - 5a027244-001a-00eb-225c-aefc45000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2CRI15qsJg6UODR5aiqEFi9R/AU3f+N249JkW7E4goA= + Range: + - bytes=512-1023 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile/some.file + method: GET + response: + body: !!binary | + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////8= + headers: + Accept-Ranges: + - bytes + Content-Length: + - "512" + Content-Range: + - bytes 512-1023/1024 + Content-Type: + - application/octet-stream + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Etag: + - '"0x8D47C73C6F2475C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Another: + - anothervalue + X-Ms-Meta-Something: + - somethingvalue + X-Ms-Request-Id: + - 5a027245-001a-00eb-235c-aefc45000000 + X-Ms-Type: + - File + X-Ms-Version: + - 2016-05-31 + status: 206 Partial Content + code: 206 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:wnzAnAKDNFWSecVFKqh4wxsKBvdl2M2RdJrU6dYTRTo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-28storagefilesuitetestgetfile?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:26 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027246-001a-00eb-245c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestDeleteMessages.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestDeleteMessages.yaml index 8e42ee4931..4c6cc810ff 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestDeleteMessages.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestDeleteMessages.yaml @@ -1,151 +1,151 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7J32x93osnJ/Lzpyy4dxVPSe1uioAzQeUBeshptVTaY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b5e3-0003-0012-1d66-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HOujcGIBZYS0yO0HMHhfIiqWgK7mxHbRCte7mZCnl54= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x61\x63\x39\x64\x35\x30\x35\x30\x2D\x36\x39\x31\x66\x2D\x34\x35\x62\x32\x2D\x39\x30\x30\x31\x2D\x30\x63\x63\x62\x64\x36\x32\x35\x66\x32\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x43\x61\x39\x57\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b5f8-0003-0012-2f66-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:71lN4zn1znDzKRajaH5cm7QsU8N35yWvUZZueoTDK4g= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages?visibilitytimeout=1 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x61\x63\x39\x64\x35\x30\x35\x30\x2D\x36\x39\x31\x66\x2D\x34\x35\x62\x32\x2D\x39\x30\x30\x31\x2D\x30\x63\x63\x62\x64\x36\x32\x35\x66\x32\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x71\x30\x76\x32\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x37\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b601-0003-0012-3866-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QWIYUOYycw+eJZ++471/ll5cWEau472PzrTShbXFGoU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages/ac9d5050-691f-45b2-9001-0ccbd625f2c9?popreceipt=AgAAAAMAAAAAAAAAq0v2j2au0gE%3D - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b60d-0003-0012-4466-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:KXYBwEee7+QtH0SFyxvQLPCcqRU2t4+mlRHebVLakgQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b614-0003-0012-4b66-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7J32x93osnJ/Lzpyy4dxVPSe1uioAzQeUBeshptVTaY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b5e3-0003-0012-1d66-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HOujcGIBZYS0yO0HMHhfIiqWgK7mxHbRCte7mZCnl54= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x61\x63\x39\x64\x35\x30\x35\x30\x2D\x36\x39\x31\x66\x2D\x34\x35\x62\x32\x2D\x39\x30\x30\x31\x2D\x30\x63\x63\x62\x64\x36\x32\x35\x66\x32\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x43\x61\x39\x57\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b5f8-0003-0012-2f66-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:71lN4zn1znDzKRajaH5cm7QsU8N35yWvUZZueoTDK4g= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages?visibilitytimeout=1 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x61\x63\x39\x64\x35\x30\x35\x30\x2D\x36\x39\x31\x66\x2D\x34\x35\x62\x32\x2D\x39\x30\x30\x31\x2D\x30\x63\x63\x62\x64\x36\x32\x35\x66\x32\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x71\x30\x76\x32\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x37\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b601-0003-0012-3866-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QWIYUOYycw+eJZ++471/ll5cWEau472PzrTShbXFGoU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages/messages/ac9d5050-691f-45b2-9001-0ccbd625f2c9?popreceipt=AgAAAAMAAAAAAAAAq0v2j2au0gE%3D + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b60d-0003-0012-4466-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:KXYBwEee7+QtH0SFyxvQLPCcqRU2t4+mlRHebVLakgQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-38storagemessagesuitetestdeletemessages + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b614-0003-0012-4b66-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek.yaml index fd0c673286..955f51f00f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek.yaml @@ -1,947 +1,947 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1Kd6d39bbodTKHuy/NKyglgQPc2r3tmKiKQBIS19BAg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b61a-0003-0012-5166-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultr - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:l29QUzUtfC/WC0NbYdUifn0ST5iQb1InTeg9gPLblB0= - Content-Length: - - "65592" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x65\x64\x63\x61\x33\x39\x63\x2D\x62\x31\x30\x37\x2D\x34\x30\x39\x66\x2D\x61\x38\x32\x30\x2D\x34\x62\x66\x65\x34\x31\x61\x38\x66\x32\x64\x30\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x6E\x38\x71\x50\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b627-0003-0012-5866-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:8+2Bayii4hEvj3068DdWs7QNr4PkQqCWevf8fYF64Bw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:26 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek/messages?peekonly=true - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x65\x64\x63\x61\x33\x39\x63\x2D\x62\x31\x30\x37\x2D\x34\x30\x39\x66\x2D\x61\x38\x32\x30\x2D\x34\x62\x66\x65\x34\x31\x61\x38\x66\x32\x64\x30\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x30\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:25 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b632-0003-0012-6266-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:a8Kzf7Yx59aF03yxb1P2fiQszqP0D0ItqsxWGq78krQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b64d-0003-0012-7a66-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1Kd6d39bbodTKHuy/NKyglgQPc2r3tmKiKQBIS19BAg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b61a-0003-0012-5166-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultr + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:l29QUzUtfC/WC0NbYdUifn0ST5iQb1InTeg9gPLblB0= + Content-Length: + - "65592" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x65\x64\x63\x61\x33\x39\x63\x2D\x62\x31\x30\x37\x2D\x34\x30\x39\x66\x2D\x61\x38\x32\x30\x2D\x34\x62\x66\x65\x34\x31\x61\x38\x66\x32\x64\x30\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x6E\x38\x71\x50\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b627-0003-0012-5866-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:8+2Bayii4hEvj3068DdWs7QNr4PkQqCWevf8fYF64Bw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:26 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek/messages?peekonly=true + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x65\x64\x63\x61\x33\x39\x63\x2D\x62\x31\x30\x37\x2D\x34\x30\x39\x66\x2D\x61\x38\x32\x30\x2D\x34\x62\x66\x65\x34\x31\x61\x38\x66\x32\x64\x30\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x30\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:25 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b632-0003-0012-6266-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:a8Kzf7Yx59aF03yxb1P2fiQszqP0D0ItqsxWGq78krQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-39storagemessagesuitetestputmessagepeek + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b64d-0003-0012-7a66-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek_Update_Delete.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek_Update_Delete.yaml index 472943be13..c6ea876218 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek_Update_Delete.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageMessageSuite/TestPutMessage_Peek_Update_Delete.yaml @@ -1,1042 +1,1042 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:dP5GMXFtFR/WCgInFmZZdDnk+n35d975vdoq28yO9Us= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b656-0003-0012-0366-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc - suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. - Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque - hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque - id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus - varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur - adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis - eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut - ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam - mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, - vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar - metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices - libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. - Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis - velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor - et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor - sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. - Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec - eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex - a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum - quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, - ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis - sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat - nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor - maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis - porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse - platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer - feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et - finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque - id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula - pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. - Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit - gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, - hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi - id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec - lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In - hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing - elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna - pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. - Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec - justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque - ex posuere. Donec ut ante porttitor, ultr - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Mwu449dg5OOcWsG5UB1+EViMYVu910XvGa5abHsTBXs= - Content-Length: - - "65592" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x36\x31\x30\x30\x39\x33\x36\x2D\x34\x37\x38\x36\x2D\x34\x36\x35\x65\x2D\x62\x62\x36\x37\x2D\x62\x65\x39\x33\x34\x64\x38\x32\x38\x65\x63\x63\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x59\x2B\x4C\x4B\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b661-0003-0012-0d66-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: and other message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:shg3ibKARCSQOK3ve4S1StRrGJ2Vh67dAztqTWQNSc0= - Content-Length: - - "73" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x30\x64\x38\x62\x65\x30\x37\x39\x2D\x61\x37\x66\x64\x2D\x34\x62\x62\x36\x2D\x38\x64\x64\x61\x2D\x64\x64\x32\x33\x31\x62\x63\x30\x35\x66\x34\x66\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x72\x6A\x62\x53\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b665-0003-0012-1166-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JxBWseqRl5v9vbQS6oLmJhN7tcwsCSlBKOf33GI9Sdg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages?numofmessages=2&visibilitytimeout=2 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x36\x31\x30\x30\x39\x33\x36\x2D\x34\x37\x38\x36\x2D\x34\x36\x35\x65\x2D\x62\x62\x36\x37\x2D\x62\x65\x39\x33\x34\x64\x38\x32\x38\x65\x63\x63\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x75\x55\x49\x4B\x6B\x57\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x39\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x30\x64\x38\x62\x65\x30\x37\x39\x2D\x61\x37\x66\x64\x2D\x34\x62\x62\x36\x2D\x38\x64\x64\x61\x2D\x64\x64\x32\x33\x31\x62\x63\x30\x35\x66\x34\x66\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x75\x55\x49\x4B\x6B\x57\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x39\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x61\x6E\x64\x20\x6F\x74\x68\x65\x72\x20\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b676-0003-0012-1e66-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: updated message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Y/zmFd4BK2FzcgDhxbum2PummIKv2ibUPVHoFlWjjjU= - Content-Length: - - "71" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages/76100936-4786-465e-bb67-be934d828ecc?popreceipt=AgAAAAMAAAAAAAAAuUIKkWau0gE%3D&visibilitytimeout=2 - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Popreceipt: - - AwAAAAMAAAAAAAAAS6MfkWau0gEBAAAA - X-Ms-Request-Id: - - 3890b683-0003-0012-2b66-ae36a5000000 - X-Ms-Time-Next-Visible: - - Wed, 05 Apr 2017 23:44:29 GMT - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:U6xmldejHoOxAPeQq+GeQW5O/mRFtrQ0+Np6gOrOzKc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages/0d8be079-a7fd-4bb6-8dda-dd231bc05f4f?popreceipt=AgAAAAMAAAAAAAAAuUIKkWau0gE%3D - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b68a-0003-0012-3066-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:YJcjKmyyQtwvD8cxzqQ0jmLFFxAS3/n4dIDE8rPRPtA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 23:44:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 23:44:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 3890b693-0003-0012-3866-ae36a5000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:dP5GMXFtFR/WCgInFmZZdDnk+n35d975vdoq28yO9Us= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b656-0003-0012-0366-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc + suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. + Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque + hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque + id felis nec lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus + varius. In hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis + eget magna pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut + ut cursus odio. Quisque id justo interdum, maximus ex a, dapibus leo. Nullam + mattis arcu nec justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, + vitae scelerisque ex posuere. Donec ut ante porttitor, ultricies ante ac, pulvinar + metus. Nunc suscipit elit gravida dolor facilisis sollicitudin. Fusce ac ultrices + libero. Donec erat lectus, hendrerit volutpat nisl quis, porta accumsan nibh. + Pellentesque hendrerit nisi id mi porttitor maximus. Phasellus vitae venenatis + velit. Quisque id felis nec lacus iaculis porttitor. Maecenas egestas tortor + et nulla dapibus varius. In hac habitasse platea dictumst.Lorem ipsum dolor + sit amet, consectetur adipiscing elit. Integer feugiat eleifend scelerisque. + Phasellus tempor turpis eget magna pretium, et finibus massa convallis. Donec + eget lacinia nibh. Ut ut cursus odio. Quisque id justo interdum, maximus ex + a, dapibus leo. Nullam mattis arcu nec justo vehicula pretium. Curabitur fermentum + quam ac dolor venenatis, vitae scelerisque ex posuere. Donec ut ante porttitor, + ultricies ante ac, pulvinar metus. Nunc suscipit elit gravida dolor facilisis + sollicitudin. Fusce ac ultrices libero. Donec erat lectus, hendrerit volutpat + nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi id mi porttitor + maximus. Phasellus vitae venenatis velit. Quisque id felis nec lacus iaculis + porttitor. Maecenas egestas tortor et nulla dapibus varius. In hac habitasse + platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer + feugiat eleifend scelerisque. Phasellus tempor turpis eget magna pretium, et + finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. Quisque + id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec justo vehicula + pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque ex posuere. + Donec ut ante porttitor, ultricies ante ac, pulvinar metus. Nunc suscipit elit + gravida dolor facilisis sollicitudin. Fusce ac ultrices libero. Donec erat lectus, + hendrerit volutpat nisl quis, porta accumsan nibh. Pellentesque hendrerit nisi + id mi porttitor maximus. Phasellus vitae venenatis velit. Quisque id felis nec + lacus iaculis porttitor. Maecenas egestas tortor et nulla dapibus varius. In + hac habitasse platea dictumst.Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer feugiat eleifend scelerisque. Phasellus tempor turpis eget magna + pretium, et finibus massa convallis. Donec eget lacinia nibh. Ut ut cursus odio. + Quisque id justo interdum, maximus ex a, dapibus leo. Nullam mattis arcu nec + justo vehicula pretium. Curabitur fermentum quam ac dolor venenatis, vitae scelerisque + ex posuere. Donec ut ante porttitor, ultr + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Mwu449dg5OOcWsG5UB1+EViMYVu910XvGa5abHsTBXs= + Content-Length: + - "65592" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x36\x31\x30\x30\x39\x33\x36\x2D\x34\x37\x38\x36\x2D\x34\x36\x35\x65\x2D\x62\x62\x36\x37\x2D\x62\x65\x39\x33\x34\x64\x38\x32\x38\x65\x63\x63\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x59\x2B\x4C\x4B\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b661-0003-0012-0d66-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: and other message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:shg3ibKARCSQOK3ve4S1StRrGJ2Vh67dAztqTWQNSc0= + Content-Length: + - "73" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x30\x64\x38\x62\x65\x30\x37\x39\x2D\x61\x37\x66\x64\x2D\x34\x62\x62\x36\x2D\x38\x64\x64\x61\x2D\x64\x64\x32\x33\x31\x62\x63\x30\x35\x66\x34\x66\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x72\x6A\x62\x53\x6A\x32\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b665-0003-0012-1166-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JxBWseqRl5v9vbQS6oLmJhN7tcwsCSlBKOf33GI9Sdg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages?numofmessages=2&visibilitytimeout=2 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x36\x31\x30\x30\x39\x33\x36\x2D\x34\x37\x38\x36\x2D\x34\x36\x35\x65\x2D\x62\x62\x36\x37\x2D\x62\x65\x39\x33\x34\x64\x38\x32\x38\x65\x63\x63\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x75\x55\x49\x4B\x6B\x57\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x39\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x69\x63\x69\x65\x73\x20\x61\x6E\x74\x65\x20\x61\x63\x2C\x20\x70\x75\x6C\x76\x69\x6E\x61\x72\x20\x6D\x65\x74\x75\x73\x2E\x20\x4E\x75\x6E\x63\x20\x73\x75\x73\x63\x69\x70\x69\x74\x20\x65\x6C\x69\x74\x20\x67\x72\x61\x76\x69\x64\x61\x20\x64\x6F\x6C\x6F\x72\x20\x66\x61\x63\x69\x6C\x69\x73\x69\x73\x20\x73\x6F\x6C\x6C\x69\x63\x69\x74\x75\x64\x69\x6E\x2E\x20\x46\x75\x73\x63\x65\x20\x61\x63\x20\x75\x6C\x74\x72\x69\x63\x65\x73\x20\x6C\x69\x62\x65\x72\x6F\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x72\x61\x74\x20\x6C\x65\x63\x74\x75\x73\x2C\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x76\x6F\x6C\x75\x74\x70\x61\x74\x20\x6E\x69\x73\x6C\x20\x71\x75\x69\x73\x2C\x20\x70\x6F\x72\x74\x61\x20\x61\x63\x63\x75\x6D\x73\x61\x6E\x20\x6E\x69\x62\x68\x2E\x20\x50\x65\x6C\x6C\x65\x6E\x74\x65\x73\x71\x75\x65\x20\x68\x65\x6E\x64\x72\x65\x72\x69\x74\x20\x6E\x69\x73\x69\x20\x69\x64\x20\x6D\x69\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x20\x6D\x61\x78\x69\x6D\x75\x73\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x76\x69\x74\x61\x65\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x20\x76\x65\x6C\x69\x74\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x66\x65\x6C\x69\x73\x20\x6E\x65\x63\x20\x6C\x61\x63\x75\x73\x20\x69\x61\x63\x75\x6C\x69\x73\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2E\x20\x4D\x61\x65\x63\x65\x6E\x61\x73\x20\x65\x67\x65\x73\x74\x61\x73\x20\x74\x6F\x72\x74\x6F\x72\x20\x65\x74\x20\x6E\x75\x6C\x6C\x61\x20\x64\x61\x70\x69\x62\x75\x73\x20\x76\x61\x72\x69\x75\x73\x2E\x20\x49\x6E\x20\x68\x61\x63\x20\x68\x61\x62\x69\x74\x61\x73\x73\x65\x20\x70\x6C\x61\x74\x65\x61\x20\x64\x69\x63\x74\x75\x6D\x73\x74\x2E\x4C\x6F\x72\x65\x6D\x20\x69\x70\x73\x75\x6D\x20\x64\x6F\x6C\x6F\x72\x20\x73\x69\x74\x20\x61\x6D\x65\x74\x2C\x20\x63\x6F\x6E\x73\x65\x63\x74\x65\x74\x75\x72\x20\x61\x64\x69\x70\x69\x73\x63\x69\x6E\x67\x20\x65\x6C\x69\x74\x2E\x20\x49\x6E\x74\x65\x67\x65\x72\x20\x66\x65\x75\x67\x69\x61\x74\x20\x65\x6C\x65\x69\x66\x65\x6E\x64\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x2E\x20\x50\x68\x61\x73\x65\x6C\x6C\x75\x73\x20\x74\x65\x6D\x70\x6F\x72\x20\x74\x75\x72\x70\x69\x73\x20\x65\x67\x65\x74\x20\x6D\x61\x67\x6E\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2C\x20\x65\x74\x20\x66\x69\x6E\x69\x62\x75\x73\x20\x6D\x61\x73\x73\x61\x20\x63\x6F\x6E\x76\x61\x6C\x6C\x69\x73\x2E\x20\x44\x6F\x6E\x65\x63\x20\x65\x67\x65\x74\x20\x6C\x61\x63\x69\x6E\x69\x61\x20\x6E\x69\x62\x68\x2E\x20\x55\x74\x20\x75\x74\x20\x63\x75\x72\x73\x75\x73\x20\x6F\x64\x69\x6F\x2E\x20\x51\x75\x69\x73\x71\x75\x65\x20\x69\x64\x20\x6A\x75\x73\x74\x6F\x20\x69\x6E\x74\x65\x72\x64\x75\x6D\x2C\x20\x6D\x61\x78\x69\x6D\x75\x73\x20\x65\x78\x20\x61\x2C\x20\x64\x61\x70\x69\x62\x75\x73\x20\x6C\x65\x6F\x2E\x20\x4E\x75\x6C\x6C\x61\x6D\x20\x6D\x61\x74\x74\x69\x73\x20\x61\x72\x63\x75\x20\x6E\x65\x63\x20\x6A\x75\x73\x74\x6F\x20\x76\x65\x68\x69\x63\x75\x6C\x61\x20\x70\x72\x65\x74\x69\x75\x6D\x2E\x20\x43\x75\x72\x61\x62\x69\x74\x75\x72\x20\x66\x65\x72\x6D\x65\x6E\x74\x75\x6D\x20\x71\x75\x61\x6D\x20\x61\x63\x20\x64\x6F\x6C\x6F\x72\x20\x76\x65\x6E\x65\x6E\x61\x74\x69\x73\x2C\x20\x76\x69\x74\x61\x65\x20\x73\x63\x65\x6C\x65\x72\x69\x73\x71\x75\x65\x20\x65\x78\x20\x70\x6F\x73\x75\x65\x72\x65\x2E\x20\x44\x6F\x6E\x65\x63\x20\x75\x74\x20\x61\x6E\x74\x65\x20\x70\x6F\x72\x74\x74\x69\x74\x6F\x72\x2C\x20\x75\x6C\x74\x72\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x30\x64\x38\x62\x65\x30\x37\x39\x2D\x61\x37\x66\x64\x2D\x34\x62\x62\x36\x2D\x38\x64\x64\x61\x2D\x64\x64\x32\x33\x31\x62\x63\x30\x35\x66\x34\x66\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x36\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x75\x55\x49\x4B\x6B\x57\x61\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x33\x3A\x34\x34\x3A\x32\x39\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x61\x6E\x64\x20\x6F\x74\x68\x65\x72\x20\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b676-0003-0012-1e66-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: updated message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Y/zmFd4BK2FzcgDhxbum2PummIKv2ibUPVHoFlWjjjU= + Content-Length: + - "71" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages/76100936-4786-465e-bb67-be934d828ecc?popreceipt=AgAAAAMAAAAAAAAAuUIKkWau0gE%3D&visibilitytimeout=2 + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Popreceipt: + - AwAAAAMAAAAAAAAAS6MfkWau0gEBAAAA + X-Ms-Request-Id: + - 3890b683-0003-0012-2b66-ae36a5000000 + X-Ms-Time-Next-Visible: + - Wed, 05 Apr 2017 23:44:29 GMT + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:U6xmldejHoOxAPeQq+GeQW5O/mRFtrQ0+Np6gOrOzKc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete/messages/0d8be079-a7fd-4bb6-8dda-dd231bc05f4f?popreceipt=AgAAAAMAAAAAAAAAuUIKkWau0gE%3D + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b68a-0003-0012-3066-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:YJcjKmyyQtwvD8cxzqQ0jmLFFxAS3/n4dIDE8rPRPtA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 23:44:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-53storagemessagesuitetestputmessagepeekupdatedelete + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 23:44:26 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 3890b693-0003-0012-3866-ae36a5000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestCreateQueue_DeleteQueue.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestCreateQueue_DeleteQueue.yaml index ccef29e434..0bca299e21 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestCreateQueue_DeleteQueue.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestCreateQueue_DeleteQueue.yaml @@ -1,60 +1,60 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:D4YZwQMwu7TfF7r1N1+LUgAD7N+OhwSW/BE8o3lWzVU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-45storagequeuesuitetestcreatequeuedeletequeue - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c770b-0003-006f-245c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gAGWjSBnkYm7E/rNvaHRIBexGeYk+Ea1uzSnklzhQj8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-45storagequeuesuitetestcreatequeuedeletequeue - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c771a-0003-006f-305c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:D4YZwQMwu7TfF7r1N1+LUgAD7N+OhwSW/BE8o3lWzVU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-45storagequeuesuitetestcreatequeuedeletequeue + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c770b-0003-006f-245c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gAGWjSBnkYm7E/rNvaHRIBexGeYk+Ea1uzSnklzhQj8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-45storagequeuesuitetestcreatequeuedeletequeue + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c771a-0003-006f-305c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestDeleteMessages.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestDeleteMessages.yaml index 018e6806d5..30f31fa37e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestDeleteMessages.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestDeleteMessages.yaml @@ -1,151 +1,151 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:nk53vfpVAAlmXhUHLbjmxYwikFX0egfiGIuCUMoSAw4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c771f-0003-006f-355c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:cFXXl/I/qw5yoeiGhGuUjUe/ZmLj7alVCpfq7sNkwa8= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x64\x38\x63\x65\x63\x62\x39\x2D\x32\x36\x31\x35\x2D\x34\x61\x33\x31\x2D\x39\x36\x65\x35\x2D\x65\x38\x66\x64\x32\x64\x32\x35\x66\x38\x39\x34\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4D\x6C\x78\x73\x70\x31\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c772a-0003-006f-3e5c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Rr2aYJQASzTJlBYriLhh40lJApOaAXPNUKjryGC/gec= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages?visibilitytimeout=1 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x64\x38\x63\x65\x63\x62\x39\x2D\x32\x36\x31\x35\x2D\x34\x61\x33\x31\x2D\x39\x36\x65\x35\x2D\x65\x38\x66\x64\x32\x64\x32\x35\x66\x38\x39\x34\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x39\x78\x38\x4D\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x32\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c7737-0003-006f-4b5c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:pPce1MGXcTx4Gs8kUY8I84n0HJjzd1ISGxkoZuGtehE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:32 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages/6d8cecb9-2615-4a31-96e5-e8fd2d25f894?popreceipt=AgAAAAMAAAAAAAAA9x8MqFyu0gE%3D - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c7742-0003-006f-545c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:v95Fmln4vyQ4P8wWzpcYVx0//WUTk6X5p9oMudWFAf8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:32 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c7746-0003-006f-585c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:nk53vfpVAAlmXhUHLbjmxYwikFX0egfiGIuCUMoSAw4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c771f-0003-006f-355c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:cFXXl/I/qw5yoeiGhGuUjUe/ZmLj7alVCpfq7sNkwa8= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x64\x38\x63\x65\x63\x62\x39\x2D\x32\x36\x31\x35\x2D\x34\x61\x33\x31\x2D\x39\x36\x65\x35\x2D\x65\x38\x66\x64\x32\x64\x32\x35\x66\x38\x39\x34\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4D\x6C\x78\x73\x70\x31\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c772a-0003-006f-3e5c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Rr2aYJQASzTJlBYriLhh40lJApOaAXPNUKjryGC/gec= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages?visibilitytimeout=1 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x36\x64\x38\x63\x65\x63\x62\x39\x2D\x32\x36\x31\x35\x2D\x34\x61\x33\x31\x2D\x39\x36\x65\x35\x2D\x65\x38\x66\x64\x32\x64\x32\x35\x66\x38\x39\x34\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x31\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x39\x78\x38\x4D\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x32\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c7737-0003-006f-4b5c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:pPce1MGXcTx4Gs8kUY8I84n0HJjzd1ISGxkoZuGtehE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:32 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages/messages/6d8cecb9-2615-4a31-96e5-e8fd2d25f894?popreceipt=AgAAAAMAAAAAAAAA9x8MqFyu0gE%3D + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c7742-0003-006f-545c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:v95Fmln4vyQ4P8wWzpcYVx0//WUTk6X5p9oMudWFAf8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:32 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-36storagequeuesuitetestdeletemessages + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c7746-0003-006f-585c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestGetMessages.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestGetMessages.yaml index 02aed83aa8..9f13712e78 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestGetMessages.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestGetMessages.yaml @@ -1,215 +1,215 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:JxkXabRowDdtuodGGJteSMckJ2MCrKhoweTsGlYDmF8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:55:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2c7-0003-0018-5807-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x65\x30\x34\x62\x30\x38\x62\x2D\x62\x36\x32\x31\x2D\x34\x34\x36\x30\x2D\x39\x30\x39\x62\x2D\x65\x39\x34\x30\x64\x62\x30\x63\x33\x37\x62\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x45\x74\x63\x53\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Thu, 06 Apr 2017 18:55:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2d0-0003-0018-5e07-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x39\x31\x65\x36\x30\x66\x33\x61\x2D\x32\x34\x32\x62\x2D\x34\x37\x30\x64\x2D\x39\x32\x34\x35\x2D\x34\x33\x31\x36\x66\x30\x38\x32\x39\x37\x38\x38\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4F\x4E\x30\x5A\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Thu, 06 Apr 2017 18:55:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2d9-0003-0018-6607-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x32\x63\x35\x38\x33\x30\x35\x62\x2D\x61\x64\x65\x61\x2D\x34\x66\x37\x37\x2D\x39\x31\x61\x31\x2D\x64\x38\x34\x38\x34\x37\x31\x38\x62\x36\x35\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x6B\x44\x45\x68\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Thu, 06 Apr 2017 18:55:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2e2-0003-0018-6f07-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: message - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x63\x37\x37\x31\x34\x61\x39\x61\x2D\x64\x37\x39\x38\x2D\x34\x36\x31\x32\x2D\x61\x63\x66\x37\x2D\x37\x36\x39\x32\x64\x61\x66\x64\x62\x66\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x7A\x56\x34\x6F\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Thu, 06 Apr 2017 18:55:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2ee-0003-0018-7a07-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:oxBqsKflHYklkTu7gOASUPLnlgjai3dpfaw3ot/eFCQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages?numofmessages=4 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x65\x30\x34\x62\x30\x38\x62\x2D\x62\x36\x32\x31\x2D\x34\x34\x36\x30\x2D\x39\x30\x39\x62\x2D\x65\x39\x34\x30\x64\x62\x30\x63\x33\x37\x62\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x39\x31\x65\x36\x30\x66\x33\x61\x2D\x32\x34\x32\x62\x2D\x34\x37\x30\x64\x2D\x39\x32\x34\x35\x2D\x34\x33\x31\x36\x66\x30\x38\x32\x39\x37\x38\x38\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x32\x63\x35\x38\x33\x30\x35\x62\x2D\x61\x64\x65\x61\x2D\x34\x66\x37\x37\x2D\x39\x31\x61\x31\x2D\x64\x38\x34\x38\x34\x37\x31\x38\x62\x36\x35\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x63\x37\x37\x31\x34\x61\x39\x61\x2D\x64\x37\x39\x38\x2D\x34\x36\x31\x32\x2D\x61\x63\x66\x37\x2D\x37\x36\x39\x32\x64\x61\x66\x64\x62\x66\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Thu, 06 Apr 2017 18:55:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2f6-0003-0018-0207-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:K0tHMVDU9HaCDtqKfzgOW+LfaOOkaZ7DTu4AfqvwuZ4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Thu, 06 Apr 2017 18:55:30 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 9c31c2fb-0003-0018-0707-af2f2c000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:JxkXabRowDdtuodGGJteSMckJ2MCrKhoweTsGlYDmF8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:55:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2c7-0003-0018-5807-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x65\x30\x34\x62\x30\x38\x62\x2D\x62\x36\x32\x31\x2D\x34\x34\x36\x30\x2D\x39\x30\x39\x62\x2D\x65\x39\x34\x30\x64\x62\x30\x63\x33\x37\x62\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x45\x74\x63\x53\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Thu, 06 Apr 2017 18:55:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2d0-0003-0018-5e07-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x39\x31\x65\x36\x30\x66\x33\x61\x2D\x32\x34\x32\x62\x2D\x34\x37\x30\x64\x2D\x39\x32\x34\x35\x2D\x34\x33\x31\x36\x66\x30\x38\x32\x39\x37\x38\x38\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4F\x4E\x30\x5A\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Thu, 06 Apr 2017 18:55:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2d9-0003-0018-6607-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x32\x63\x35\x38\x33\x30\x35\x62\x2D\x61\x64\x65\x61\x2D\x34\x66\x37\x37\x2D\x39\x31\x61\x31\x2D\x64\x38\x34\x38\x34\x37\x31\x38\x62\x36\x35\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x6B\x44\x45\x68\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Thu, 06 Apr 2017 18:55:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2e2-0003-0018-6f07-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: message + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:hak/DoI1TggDfL4G9OJC0EpO3E+RArNwIDuB5o8ULNU= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x63\x37\x37\x31\x34\x61\x39\x61\x2D\x64\x37\x39\x38\x2D\x34\x36\x31\x32\x2D\x61\x63\x66\x37\x2D\x37\x36\x39\x32\x64\x61\x66\x64\x62\x66\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x7A\x56\x34\x6F\x58\x51\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Thu, 06 Apr 2017 18:55:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2ee-0003-0018-7a07-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:oxBqsKflHYklkTu7gOASUPLnlgjai3dpfaw3ot/eFCQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages/messages?numofmessages=4 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x65\x30\x34\x62\x30\x38\x62\x2D\x62\x36\x32\x31\x2D\x34\x34\x36\x30\x2D\x39\x30\x39\x62\x2D\x65\x39\x34\x30\x64\x62\x30\x63\x33\x37\x62\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x39\x31\x65\x36\x30\x66\x33\x61\x2D\x32\x34\x32\x62\x2D\x34\x37\x30\x64\x2D\x39\x32\x34\x35\x2D\x34\x33\x31\x36\x66\x30\x38\x32\x39\x37\x38\x38\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x32\x63\x35\x38\x33\x30\x35\x62\x2D\x61\x64\x65\x61\x2D\x34\x66\x37\x37\x2D\x39\x31\x61\x31\x2D\x64\x38\x34\x38\x34\x37\x31\x38\x62\x36\x35\x36\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x63\x37\x37\x31\x34\x61\x39\x61\x2D\x64\x37\x39\x38\x2D\x34\x36\x31\x32\x2D\x61\x63\x66\x37\x2D\x37\x36\x39\x32\x64\x61\x66\x64\x62\x66\x63\x39\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x54\x68\x75\x2C\x20\x31\x33\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x35\x3A\x33\x30\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x2B\x41\x63\x52\x62\x77\x65\x76\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x54\x68\x75\x2C\x20\x30\x36\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x31\x38\x3A\x35\x36\x3A\x30\x31\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x31\x3C\x2F\x44\x65\x71\x75\x65\x75\x65\x43\x6F\x75\x6E\x74\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x6D\x65\x73\x73\x61\x67\x65\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x54\x65\x78\x74\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Thu, 06 Apr 2017 18:55:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2f6-0003-0018-0207-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:K0tHMVDU9HaCDtqKfzgOW+LfaOOkaZ7DTu4AfqvwuZ4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-33storagequeuesuitetestgetmessages + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 06 Apr 2017 18:55:30 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 9c31c2fb-0003-0018-0707-af2f2c000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestQueueExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestQueueExists.yaml index ef2f562442..7946d10d06 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestQueueExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/TestQueueExists.yaml @@ -1,122 +1,122 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GRCOP7MGPV+J+oykE99rS+REBONe62B2yoZYcYGqyy4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-nonexistent33storagequeuesuitetestqueueexists?comp=metadata - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x51\x75\x65\x75\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x71\x75\x65\x75\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x62\x32\x32\x33\x32\x64\x61\x36\x2D\x30\x30\x30\x33\x2D\x30\x30\x32\x32\x2D\x33\x39\x30\x37\x2D\x61\x66\x36\x63\x38\x66\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x36\x54\x31\x38\x3A\x35\x35\x3A\x31\x39\x2E\x35\x30\x36\x37\x32\x33\x37\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "217" - Content-Type: - - application/xml - Date: - - Thu, 06 Apr 2017 18:55:19 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - b2232da6-0003-0022-3907-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified queue does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:uuc+semVb2KEuBSqlm3+lVnJTyHI9D4zGxICZ0XFQHk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:55:19 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - b2232db5-0003-0022-4507-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Zt9POEMxLUlhP27KMXetFPkPFhwmgFWUwUAsk3J9YfU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:19 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists?comp=metadata - method: GET - response: - body: "" - headers: - Cache-Control: - - no-cache - Date: - - Thu, 06 Apr 2017 18:55:19 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Approximate-Messages-Count: - - "0" - X-Ms-Request-Id: - - b2232dfc-0003-0022-0907-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SH91Rf0ONFITAFOdY/1AxL5Xr8p0jYotqPqOnSbu8HI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:20 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Thu, 06 Apr 2017 18:55:19 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - b2232e08-0003-0022-1407-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GRCOP7MGPV+J+oykE99rS+REBONe62B2yoZYcYGqyy4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-nonexistent33storagequeuesuitetestqueueexists?comp=metadata + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x51\x75\x65\x75\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x71\x75\x65\x75\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x62\x32\x32\x33\x32\x64\x61\x36\x2D\x30\x30\x30\x33\x2D\x30\x30\x32\x32\x2D\x33\x39\x30\x37\x2D\x61\x66\x36\x63\x38\x66\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x36\x54\x31\x38\x3A\x35\x35\x3A\x31\x39\x2E\x35\x30\x36\x37\x32\x33\x37\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "217" + Content-Type: + - application/xml + Date: + - Thu, 06 Apr 2017 18:55:19 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b2232da6-0003-0022-3907-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified queue does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:uuc+semVb2KEuBSqlm3+lVnJTyHI9D4zGxICZ0XFQHk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:55:19 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b2232db5-0003-0022-4507-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Zt9POEMxLUlhP27KMXetFPkPFhwmgFWUwUAsk3J9YfU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:19 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists?comp=metadata + method: GET + response: + body: "" + headers: + Cache-Control: + - no-cache + Date: + - Thu, 06 Apr 2017 18:55:19 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "0" + X-Ms-Request-Id: + - b2232dfc-0003-0022-0907-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SH91Rf0ONFITAFOdY/1AxL5Xr8p0jYotqPqOnSbu8HI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:20 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-exisiting33storagequeuesuitetestqueueexists + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 06 Apr 2017 18:55:19 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b2232e08-0003-0022-1407-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetMetadata_GetApproximateCount.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetMetadata_GetApproximateCount.yaml index bc21051338..cffd107764 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetMetadata_GetApproximateCount.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetMetadata_GetApproximateCount.yaml @@ -1,271 +1,271 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6gc6xQ0Q9A3sfOfDo1I0XXDi5RV5/y/t2EHE/OPBD6s= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:33 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:33 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c780a-0003-006f-795c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DFhzb0xiv22eBYhV3ytE1ByYry3A7VWJdXEYPs1RJ+c= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:33 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount?comp=metadata - method: GET - response: - body: "" - headers: - Cache-Control: - - no-cache - Date: - - Wed, 05 Apr 2017 22:33:33 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Approximate-Messages-Count: - - "0" - X-Ms-Request-Id: - - 564c780d-0003-006f-7b5c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:XSgbYf86D1ecs3YMqCKihilyvh/sV0J1KuFOY+g9U68= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:33 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:33 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c7812-0003-006f-7f5c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: lolrofl - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:HIMSaKmxDcKBGcnJyZcHKyFWjRKXHoJv/3tvrq40qhA= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:33 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x64\x34\x30\x30\x30\x64\x37\x2D\x34\x37\x65\x30\x2D\x34\x34\x65\x30\x2D\x61\x61\x32\x63\x2D\x64\x35\x63\x39\x61\x39\x39\x63\x32\x36\x32\x34\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x39\x41\x32\x65\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:33 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c781e-0003-006f-095c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: lolrofl - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gC6RSMK/qg1jIfnV5TIs4iXFPDSXJbyEqaxALGBfpC8= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:34 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x61\x38\x61\x34\x36\x61\x61\x36\x2D\x61\x39\x65\x66\x2D\x34\x66\x62\x64\x2D\x38\x31\x32\x31\x2D\x64\x39\x38\x31\x64\x36\x36\x63\x66\x66\x36\x37\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4C\x44\x75\x6C\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:33 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c7828-0003-006f-135c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: lolrofl - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gC6RSMK/qg1jIfnV5TIs4iXFPDSXJbyEqaxALGBfpC8= - Content-Length: - - "63" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:34 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount/messages - method: POST - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x34\x39\x35\x37\x31\x37\x31\x30\x2D\x66\x61\x36\x39\x2D\x34\x33\x62\x30\x2D\x39\x37\x66\x36\x2D\x35\x62\x64\x65\x39\x62\x64\x62\x37\x34\x32\x66\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4D\x68\x71\x73\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:33 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c7830-0003-006f-1a5c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NnaoW4ra9PGN+mPPDo/aqbkebIcYOhcvSQk8+9Zgito= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount?comp=metadata - method: GET - response: - body: "" - headers: - Cache-Control: - - no-cache - Date: - - Wed, 05 Apr 2017 22:33:34 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Approximate-Messages-Count: - - "3" - X-Ms-Request-Id: - - 564c78c2-0003-006f-185c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:41EP0/eIM5i2dObwkAcXsRL0Ac/GSGlkI35lPG0JR3c= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:34 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c78c6-0003-006f-1c5c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:B/U84Unufpi1DoUIx1z9Nc1xn5sDSryVvcEGOBhHY5Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:34 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 564c78cd-0003-006f-215c-aeaa6d000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6gc6xQ0Q9A3sfOfDo1I0XXDi5RV5/y/t2EHE/OPBD6s= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:33 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:33 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c780a-0003-006f-795c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DFhzb0xiv22eBYhV3ytE1ByYry3A7VWJdXEYPs1RJ+c= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:33 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount?comp=metadata + method: GET + response: + body: "" + headers: + Cache-Control: + - no-cache + Date: + - Wed, 05 Apr 2017 22:33:33 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "0" + X-Ms-Request-Id: + - 564c780d-0003-006f-7b5c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XSgbYf86D1ecs3YMqCKihilyvh/sV0J1KuFOY+g9U68= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:33 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:33 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c7812-0003-006f-7f5c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: lolrofl + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:HIMSaKmxDcKBGcnJyZcHKyFWjRKXHoJv/3tvrq40qhA= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:33 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x37\x64\x34\x30\x30\x30\x64\x37\x2D\x34\x37\x65\x30\x2D\x34\x34\x65\x30\x2D\x61\x61\x32\x63\x2D\x64\x35\x63\x39\x61\x39\x39\x63\x32\x36\x32\x34\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x39\x41\x32\x65\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:33 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c781e-0003-006f-095c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: lolrofl + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gC6RSMK/qg1jIfnV5TIs4iXFPDSXJbyEqaxALGBfpC8= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:34 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x61\x38\x61\x34\x36\x61\x61\x36\x2D\x61\x39\x65\x66\x2D\x34\x66\x62\x64\x2D\x38\x31\x32\x31\x2D\x64\x39\x38\x31\x64\x36\x36\x63\x66\x66\x36\x37\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4C\x44\x75\x6C\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:33 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c7828-0003-006f-135c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: lolrofl + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gC6RSMK/qg1jIfnV5TIs4iXFPDSXJbyEqaxALGBfpC8= + Content-Length: + - "63" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:34 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount/messages + method: POST + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E\x3C\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x34\x39\x35\x37\x31\x37\x31\x30\x2D\x66\x61\x36\x39\x2D\x34\x33\x62\x30\x2D\x39\x37\x66\x36\x2D\x35\x62\x64\x65\x39\x62\x64\x62\x37\x34\x32\x66\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x49\x64\x3E\x3C\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x49\x6E\x73\x65\x72\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x57\x65\x64\x2C\x20\x31\x32\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x45\x78\x70\x69\x72\x61\x74\x69\x6F\x6E\x54\x69\x6D\x65\x3E\x3C\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x41\x67\x41\x41\x41\x41\x4D\x41\x41\x41\x41\x41\x41\x41\x41\x41\x4D\x68\x71\x73\x71\x46\x79\x75\x30\x67\x45\x3D\x3C\x2F\x50\x6F\x70\x52\x65\x63\x65\x69\x70\x74\x3E\x3C\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x33\x20\x47\x4D\x54\x3C\x2F\x54\x69\x6D\x65\x4E\x65\x78\x74\x56\x69\x73\x69\x62\x6C\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x51\x75\x65\x75\x65\x4D\x65\x73\x73\x61\x67\x65\x73\x4C\x69\x73\x74\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:33 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c7830-0003-006f-1a5c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NnaoW4ra9PGN+mPPDo/aqbkebIcYOhcvSQk8+9Zgito= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount?comp=metadata + method: GET + response: + body: "" + headers: + Cache-Control: + - no-cache + Date: + - Wed, 05 Apr 2017 22:33:34 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "3" + X-Ms-Request-Id: + - 564c78c2-0003-006f-185c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:41EP0/eIM5i2dObwkAcXsRL0Ac/GSGlkI35lPG0JR3c= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-254storagequeuesuitetestgetmetadatagetapproximatecount + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:34 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c78c6-0003-006f-1c5c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B/U84Unufpi1DoUIx1z9Nc1xn5sDSryVvcEGOBhHY5Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-154storagequeuesuitetestgetmetadatagetapproximatecount + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:34 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 564c78cd-0003-006f-215c-aeaa6d000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueNoTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueNoTimeout.yaml index 71df1712b9..f423045c31 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueNoTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueNoTimeout.yaml @@ -1,122 +1,122 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:zo8JEyh9EENVBRdXExInSvutVAgraQ6OwMIGqlVvEsQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:27 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:27 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec6d-0003-0000-156d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:00Z2051-12-20T21:55:00Zraup - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:W4khUmbLXWT3SFalpmqXlLsy05fZ88kVxcAIBcOKj54= - Content-Length: - - "233" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout?comp=acl - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec7b-0003-0000-176d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Uoena/8a370/fP/wAcFFi3vRj1P0l5S8pORPgxAB6Yo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout?comp=acl - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x31\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x70\x61\x75\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Fri, 21 Apr 2017 07:03:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec80-0003-0000-1a6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gn0ySQpnA/3nw6fVQ8Gcqa8HM70GY+veTfaKLT0hr6I= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:28 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec86-0003-0000-1e6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:zo8JEyh9EENVBRdXExInSvutVAgraQ6OwMIGqlVvEsQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:27 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:27 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec6d-0003-0000-156d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:00Z2051-12-20T21:55:00Zraup + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:W4khUmbLXWT3SFalpmqXlLsy05fZ88kVxcAIBcOKj54= + Content-Length: + - "233" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:28 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec7b-0003-0000-176d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Uoena/8a370/fP/wAcFFi3vRj1P0l5S8pORPgxAB6Yo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout?comp=acl + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x31\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x70\x61\x75\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Fri, 21 Apr 2017 07:03:28 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec80-0003-0000-1a6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gn0ySQpnA/3nw6fVQ8Gcqa8HM70GY+veTfaKLT0hr6I= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:28 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestgetpermissionsalltruenotimeout + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:28 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec86-0003-0000-1e6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueWithTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueWithTimeout.yaml index 2c2a1b95ea..1086f4515d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueWithTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAllTrueWithTimeout.yaml @@ -1,122 +1,122 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9Q+joySVquKCbapR9Wmo7syvk6Oc4LsuzqwnLqtAEcU= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec87-0003-0000-1f6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:00Z2051-12-20T21:55:00Zraup - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PEb0gu18mlZQ/7Exe4we9OUAESVabkqjgw7U3KVSyYg= - Content-Length: - - "233" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout?comp=acl - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec8c-0003-0000-226d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7AWA9mMpPC9xC+6FvjOgipeAFVpSVwTBrsULXmYyKHQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout?comp=acl&timeout=30 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x31\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x70\x61\x75\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Fri, 21 Apr 2017 07:03:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec90-0003-0000-256d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/OYpS0m+LyfVRSl0HujlyefeQEADxAq6TISOLSL+p2A= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec92-0003-0000-276d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9Q+joySVquKCbapR9Wmo7syvk6Oc4LsuzqwnLqtAEcU= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:28 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec87-0003-0000-1f6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:00Z2051-12-20T21:55:00Zraup + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PEb0gu18mlZQ/7Exe4we9OUAESVabkqjgw7U3KVSyYg= + Content-Length: + - "233" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:28 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec8c-0003-0000-226d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7AWA9mMpPC9xC+6FvjOgipeAFVpSVwTBrsULXmYyKHQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout?comp=acl&timeout=30 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x31\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x70\x61\x75\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Fri, 21 Apr 2017 07:03:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec90-0003-0000-256d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/OYpS0m+LyfVRSl0HujlyefeQEADxAq6TISOLSL+p2A= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestgetpermissionsalltruewithtimeout + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec92-0003-0000-276d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAlternateTrueNoTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAlternateTrueNoTimeout.yaml index 16a5fd7391..8109fdc45c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAlternateTrueNoTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_GetPermissionsAlternateTrueNoTimeout.yaml @@ -1,122 +1,122 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9mej1IZVWcP2rwmRp4t5Uz+T09tOKROi6s31ko0AkRw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ec99-0003-0000-2c6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:00Z2051-12-20T21:55:00Zru - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:SGaRGrq/vLK5mGuosXhmXBfKpvtSw9GTQgP1h3lIq3Q= - Content-Length: - - "231" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:29 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime?comp=acl - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108eca0-0003-0000-306d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:DgHuYSoMqRnfBS9hXwSuH2GVW/zyhXBO/UGlOK5Im5U= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime?comp=acl - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x31\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x75\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Fri, 21 Apr 2017 07:03:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108eca5-0003-0000-336d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:78naDiGZFGzp2RY26SWjXygRMzrwJBIO1z7MI5GZ+2Q= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecab-0003-0000-376d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9mej1IZVWcP2rwmRp4t5Uz+T09tOKROi6s31ko0AkRw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ec99-0003-0000-2c6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:00Z2051-12-20T21:55:00Zru + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:SGaRGrq/vLK5mGuosXhmXBfKpvtSw9GTQgP1h3lIq3Q= + Content-Length: + - "231" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:29 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108eca0-0003-0000-306d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:DgHuYSoMqRnfBS9hXwSuH2GVW/zyhXBO/UGlOK5Im5U= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime?comp=acl + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x31\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x30\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x75\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/xml + Date: + - Fri, 21 Apr 2017 07:03:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108eca5-0003-0000-336d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:78naDiGZFGzp2RY26SWjXygRMzrwJBIO1z7MI5GZ+2Q= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestgetpermissionsalternatetruenotime + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:29 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecab-0003-0000-376d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetMetadataGetMetadata_Roundtrips.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetMetadataGetMetadata_Roundtrips.yaml index 806936c86b..00c08ca935 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetMetadataGetMetadata_Roundtrips.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetMetadataGetMetadata_Roundtrips.yaml @@ -1,128 +1,128 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9STNQNuRgLtLXSuzN/CNnvtS24JQyAfjC+BwgHyxYbs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips - method: PUT - response: - body: "" - headers: - Date: - - Thu, 06 Apr 2017 18:55:20 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - b2232eb6-0003-0022-3007-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:TmUzCmzJ2i4DrPUGOUCtwrM0m64EwhuRM6wiO4+qwkw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:21 GMT - X-Ms-Meta-Lol1: - - rofl1 - X-Ms-Meta-Lolbaz: - - rofl - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips?comp=metadata - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Thu, 06 Apr 2017 18:55:20 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - b2232ec5-0003-0022-3d07-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Nit/ykJJuSLD7zD8IRtMk0V0eda7m0FkfAHwpXJz0lY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips?comp=metadata - method: GET - response: - body: "" - headers: - Cache-Control: - - no-cache - Date: - - Thu, 06 Apr 2017 18:55:20 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Approximate-Messages-Count: - - "0" - X-Ms-Meta-Lol1: - - rofl1 - X-Ms-Meta-Lolbaz: - - rofl - X-Ms-Request-Id: - - b2232ed4-0003-0022-4b07-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:ce17BEy8cbRpDaR6KQos2YG0Lu0vIC5Kpwp7EE6LYJs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Thu, 06 Apr 2017 18:55:21 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Thu, 06 Apr 2017 18:55:20 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - b2232edf-0003-0022-5507-af6c8f000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9STNQNuRgLtLXSuzN/CNnvtS24JQyAfjC+BwgHyxYbs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips + method: PUT + response: + body: "" + headers: + Date: + - Thu, 06 Apr 2017 18:55:20 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b2232eb6-0003-0022-3007-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:TmUzCmzJ2i4DrPUGOUCtwrM0m64EwhuRM6wiO4+qwkw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:21 GMT + X-Ms-Meta-Lol1: + - rofl1 + X-Ms-Meta-Lolbaz: + - rofl + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips?comp=metadata + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 06 Apr 2017 18:55:20 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b2232ec5-0003-0022-3d07-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Nit/ykJJuSLD7zD8IRtMk0V0eda7m0FkfAHwpXJz0lY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips?comp=metadata + method: GET + response: + body: "" + headers: + Cache-Control: + - no-cache + Date: + - Thu, 06 Apr 2017 18:55:20 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Approximate-Messages-Count: + - "0" + X-Ms-Meta-Lol1: + - rofl1 + X-Ms-Meta-Lolbaz: + - rofl + X-Ms-Request-Id: + - b2232ed4-0003-0022-4b07-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:ce17BEy8cbRpDaR6KQos2YG0Lu0vIC5Kpwp7EE6LYJs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Thu, 06 Apr 2017 18:55:21 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-156storagequeuesuitetestsetmetadatagetmetadataroundtrips + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Thu, 06 Apr 2017 18:55:20 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - b2232edf-0003-0022-5507-af6c8f000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueNoTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueNoTimeout.yaml index 05588d9303..c171a1420e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueNoTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueNoTimeout.yaml @@ -1,91 +1,91 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:V0atokOdklBzQp3ZVD4bK3BVEr9OxkmPis8Ul3vxV5o= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:30 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecac-0003-0000-386d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zraup - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:td2Y9/rBg/uQpGjNS6L4Bhp3Ks25YO+NSvC8M7XPEd4= - Content-Length: - - "233" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout?comp=acl - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:30 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecb2-0003-0000-3b6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Z4/LFDk3Z1yr2je7MHza3EaYEi+u0r5uyH/7LkL5MKw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:30 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecb5-0003-0000-3d6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:V0atokOdklBzQp3ZVD4bK3BVEr9OxkmPis8Ul3vxV5o= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:30 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecac-0003-0000-386d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zraup + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:td2Y9/rBg/uQpGjNS6L4Bhp3Ks25YO+NSvC8M7XPEd4= + Content-Length: + - "233" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:30 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecb2-0003-0000-3b6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Z4/LFDk3Z1yr2je7MHza3EaYEi+u0r5uyH/7LkL5MKw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-153storagequeuesuitetestsetpermissionsalltruenotimeout + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:30 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecb5-0003-0000-3d6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueWithTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueWithTimeout.yaml index db4fd6a0b8..cc9afee4c6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueWithTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAllTrueWithTimeout.yaml @@ -1,91 +1,91 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:FWXT3whjAM+ap8DYMpl0BOA8jY8kG1LTKI9lAxqH2ec= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:30 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:30 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecbe-0003-0000-426d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zraup - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6Yx8pPgRrSM09qBzBwJUYXAjrhDmvu25PiCODPW9MjU= - Content-Length: - - "233" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout?comp=acl&timeout=30 - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:30 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecc4-0003-0000-456d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:75JdRNsKSuxK8iNFm/6NG1HM13OAO7EsLe2rHgpg7Cc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108eccd-0003-0000-4b6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:FWXT3whjAM+ap8DYMpl0BOA8jY8kG1LTKI9lAxqH2ec= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:30 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:30 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecbe-0003-0000-426d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zraup + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6Yx8pPgRrSM09qBzBwJUYXAjrhDmvu25PiCODPW9MjU= + Content-Length: + - "233" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout?comp=acl&timeout=30 + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:30 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecc4-0003-0000-456d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:75JdRNsKSuxK8iNFm/6NG1HM13OAO7EsLe2rHgpg7Cc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-155storagequeuesuitetestsetpermissionsalltruewithtimeout + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108eccd-0003-0000-4b6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueNoTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueNoTimeout.yaml index 8772ddb701..009b1459cc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueNoTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueNoTimeout.yaml @@ -1,91 +1,91 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:L7MIoa0uGSpcwbpoMhLR40gd6xnJCp4H5tFMa3BRWsM= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108eccf-0003-0000-4d6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zru - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:NPUtgYX9N7LUdcMqyFR0czWOEmDXNTxf6hf0iBZ8big= - Content-Length: - - "231" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime?comp=acl - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecd6-0003-0000-526d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:VDxsdevWZd17miXLhNP6NZaSx8/RLLAFOM5iiOyuKnI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ecdf-0003-0000-586d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:L7MIoa0uGSpcwbpoMhLR40gd6xnJCp4H5tFMa3BRWsM= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108eccf-0003-0000-4d6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zru + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:NPUtgYX9N7LUdcMqyFR0czWOEmDXNTxf6hf0iBZ8big= + Content-Length: + - "231" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime?comp=acl + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecd6-0003-0000-526d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:VDxsdevWZd17miXLhNP6NZaSx8/RLLAFOM5iiOyuKnI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-159storagequeuesuitetestsetpermissionsalternatetruenotime + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ecdf-0003-0000-586d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueWithTimeout.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueWithTimeout.yaml index 61c7edad75..78a18bc746 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueWithTimeout.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageQueueSuite/Test_SetPermissionsAlternateTrueWithTimeout.yaml @@ -1,91 +1,91 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:QSi/TF5fln9g3HmHwLuIyLkVDETLVQ9R7uoLqUZoXGQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:32 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti - method: PUT - response: - body: "" - headers: - Date: - - Fri, 21 Apr 2017 07:03:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ece5-0003-0000-5c6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zru - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:x4lxEpUvHaQLKc5/sEG8MGZIZScR4U/LwawxUAQ9uAk= - Content-Length: - - "231" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:32 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti?comp=acl&timeout=30 - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:31 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108ece8-0003-0000-5e6d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:XTt/tV1s6gtH4hh0ezXLFbI3KVX1HbS6P0StwrLff1Y= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue - X-Ms-Date: - - Fri, 21 Apr 2017 07:03:32 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti - method: DELETE - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 07:03:32 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 8108eceb-0003-0000-616d-bab0ce000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:QSi/TF5fln9g3HmHwLuIyLkVDETLVQ9R7uoLqUZoXGQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:32 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti + method: PUT + response: + body: "" + headers: + Date: + - Fri, 21 Apr 2017 07:03:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ece5-0003-0000-5c6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2051-12-20T21:55:06Zru + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:x4lxEpUvHaQLKc5/sEG8MGZIZScR4U/LwawxUAQ9uAk= + Content-Length: + - "231" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:32 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti?comp=acl&timeout=30 + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:31 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108ece8-0003-0000-5e6d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:XTt/tV1s6gtH4hh0ezXLFbI3KVX1HbS6P0StwrLff1Y= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 queue + X-Ms-Date: + - Fri, 21 Apr 2017 07:03:32 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.queue.core.windows.net/queue-161storagequeuesuitetestsetpermissionsalternatetruewithti + method: DELETE + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 07:03:32 GMT + Server: + - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 8108eceb-0003-0000-616d-bab0ce000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareDeleteShare.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareDeleteShare.yaml index f63416b6e4..34af44c70c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareDeleteShare.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareDeleteShare.yaml @@ -1,62 +1,62 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:7NgdfJGSYIZI1pWWXwmAvpo5CLMI2TBV2gI3/1RkoJE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-44storagesharesuitetestcreatesharedeleteshare?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:34 GMT - Etag: - - '"0x8D47C73CC1140A1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027256-001a-00eb-265c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:K0H6ITM3xUOw/lWTW26297XfV1xNOR+rf+rl5P/REK4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-44storagesharesuitetestcreatesharedeleteshare?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027258-001a-00eb-275c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:7NgdfJGSYIZI1pWWXwmAvpo5CLMI2TBV2gI3/1RkoJE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-44storagesharesuitetestcreatesharedeleteshare?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:34 GMT + Etag: + - '"0x8D47C73CC1140A1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027256-001a-00eb-265c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:K0H6ITM3xUOw/lWTW26297XfV1xNOR+rf+rl5P/REK4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-44storagesharesuitetestcreatesharedeleteshare?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027258-001a-00eb-275c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfExists.yaml index fdfafa47a9..3e1ef6f01b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfExists.yaml @@ -1,68 +1,68 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:BTMAiP7WFgxgziaPnEMXLFj5QFu5ipbkZLnHZifog9g= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-exists41storagesharesuitetestcreateshareifexists?restype=share - method: PUT - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x53\x68\x61\x72\x65\x41\x6C\x72\x65\x61\x64\x79\x45\x78\x69\x73\x74\x73\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x73\x68\x61\x72\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x32\x35\x62\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x32\x39\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x33\x35\x2E\x34\x35\x30\x39\x37\x33\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "222" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02725b-001a-00eb-295c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 409 The specified share already exists. - code: 409 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:aD+MnQPm1iUmsfqxIa3fcvYwKzqzhiYn5mmd/pwUZzk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-exists41storagesharesuitetestcreateshareifexists?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CC234551"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02725c-001a-00eb-2a5c-aefc45000000 - X-Ms-Share-Quota: - - "5120" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:BTMAiP7WFgxgziaPnEMXLFj5QFu5ipbkZLnHZifog9g= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-exists41storagesharesuitetestcreateshareifexists?restype=share + method: PUT + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x53\x68\x61\x72\x65\x41\x6C\x72\x65\x61\x64\x79\x45\x78\x69\x73\x74\x73\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x73\x68\x61\x72\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x32\x35\x62\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x32\x39\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x33\x35\x2E\x34\x35\x30\x39\x37\x33\x38\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "222" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02725b-001a-00eb-295c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 409 The specified share already exists. + code: 409 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:aD+MnQPm1iUmsfqxIa3fcvYwKzqzhiYn5mmd/pwUZzk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-exists41storagesharesuitetestcreateshareifexists?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CC234551"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02725c-001a-00eb-2a5c-aefc45000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfNotExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfNotExists.yaml index 6adcdf1884..81ce8b81a9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfNotExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestCreateShareIfNotExists.yaml @@ -1,62 +1,62 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:0mLifyQz9kZJhM9JKvug3K9kgzNnd3WTKXqFeEYIgro= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-notexists44storagesharesuitetestcreateshareifnotexists?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CC410BFE"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02725f-001a-00eb-2c5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:s+DVz24NgsdttG8MiYq3OKHvZoRKKJZsI1j0nFehcTI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-notexists44storagesharesuitetestcreateshareifnotexists?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027261-001a-00eb-2d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:0mLifyQz9kZJhM9JKvug3K9kgzNnd3WTKXqFeEYIgro= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-notexists44storagesharesuitetestcreateshareifnotexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CC410BFE"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02725f-001a-00eb-2c5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:s+DVz24NgsdttG8MiYq3OKHvZoRKKJZsI1j0nFehcTI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-notexists44storagesharesuitetestcreateshareifnotexists?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027261-001a-00eb-2d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestDeleteShareIfNotExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestDeleteShareIfNotExists.yaml index 4f068f5c46..597e967fab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestDeleteShareIfNotExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestDeleteShareIfNotExists.yaml @@ -1,93 +1,93 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:azUp0+juL5LJAkbLl1u7XpnCcF8HZnm4U8vaz7dWJRE= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:35 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestdeleteshareifnotexists?restype=share - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x53\x68\x61\x72\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x73\x68\x61\x72\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x32\x36\x32\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x32\x65\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x33\x35\x2E\x37\x31\x36\x31\x36\x34\x32\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "217" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027262-001a-00eb-2e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified share does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:9LxGIWlAKojDdLO/vKAHZiqyGVhXyjv5vhKX0ctrPVc= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestdeleteshareifnotexists?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CC5A16D8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027263-001a-00eb-2f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/8SCx3TQKkc+SKpN85eMpLmtZ4qswt9/WfRM3hU8XwI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestdeleteshareifnotexists?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027265-001a-00eb-305c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:azUp0+juL5LJAkbLl1u7XpnCcF8HZnm4U8vaz7dWJRE= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:35 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestdeleteshareifnotexists?restype=share + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x53\x68\x61\x72\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x73\x68\x61\x72\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x32\x36\x32\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x32\x65\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x33\x35\x2E\x37\x31\x36\x31\x36\x34\x32\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "217" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027262-001a-00eb-2e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified share does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:9LxGIWlAKojDdLO/vKAHZiqyGVhXyjv5vhKX0ctrPVc= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestdeleteshareifnotexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CC5A16D8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027263-001a-00eb-2f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/8SCx3TQKkc+SKpN85eMpLmtZ4qswt9/WfRM3hU8XwI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestdeleteshareifnotexists?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027265-001a-00eb-305c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareMetadata.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareMetadata.yaml index 2afe318ff2..1418e54662 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareMetadata.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareMetadata.yaml @@ -1,225 +1,225 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:4iU0Ujbyf35Pc85VAwWvvM7pN3kyXgaB/aTri89TWnQ= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CC69AA0D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027266-001a-00eb-315c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:6t8WcqRaXYprik7Kh+M2BXGg+3ZHGEtaNLiptQrk2Pw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CC69AA0D"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027268-001a-00eb-325c-aefc45000000 - X-Ms-Share-Quota: - - "5120" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:B4Oeb7TJ5C/OSs9gMUavvVZiI+SdgQNpZ33pcWgiDt4= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CC7BD5D8"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027269-001a-00eb-335c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:B6/A9PlV85lu0TaCmc82hXR7MBxNAcauFV2y5J+Qukw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Meta-Lol: - - rofl - X-Ms-Meta-Rofl_baz: - - waz qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?comp=metadata&restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CCFFF17C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02726b-001a-00eb-345c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:3g6A7NRAjwpFEwrmJjhTeFKGWMpWSwAI5a9H90NdRsA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CCFFF17C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Lol: - - rofl - X-Ms-Meta-Rofl_baz: - - waz qux - X-Ms-Request-Id: - - 5a02726c-001a-00eb-355c-aefc45000000 - X-Ms-Share-Quota: - - "5120" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:PJTpoH/AO+SIEVz2i00xxUkYFMvXJH78JIp87WNYTwo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02726d-001a-00eb-365c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:vwUGIfU9TxZpBXsJBDM9k37lVARTuGTCI/t5gm4Yibg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02726e-001a-00eb-375c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:4iU0Ujbyf35Pc85VAwWvvM7pN3kyXgaB/aTri89TWnQ= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CC69AA0D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027266-001a-00eb-315c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:6t8WcqRaXYprik7Kh+M2BXGg+3ZHGEtaNLiptQrk2Pw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CC69AA0D"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027268-001a-00eb-325c-aefc45000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B4Oeb7TJ5C/OSs9gMUavvVZiI+SdgQNpZ33pcWgiDt4= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CC7BD5D8"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027269-001a-00eb-335c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B6/A9PlV85lu0TaCmc82hXR7MBxNAcauFV2y5J+Qukw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Meta-Lol: + - rofl + X-Ms-Meta-Rofl_baz: + - waz qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?comp=metadata&restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CCFFF17C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02726b-001a-00eb-345c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:3g6A7NRAjwpFEwrmJjhTeFKGWMpWSwAI5a9H90NdRsA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CCFFF17C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Lol: + - rofl + X-Ms-Meta-Rofl_baz: + - waz qux + X-Ms-Request-Id: + - 5a02726c-001a-00eb-355c-aefc45000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:PJTpoH/AO+SIEVz2i00xxUkYFMvXJH78JIp87WNYTwo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-244storagesharesuitetestgetandsetsharemetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02726d-001a-00eb-365c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:vwUGIfU9TxZpBXsJBDM9k37lVARTuGTCI/t5gm4Yibg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-144storagesharesuitetestgetandsetsharemetadata?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02726e-001a-00eb-375c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareProperties.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareProperties.yaml index f17c4e13bd..c7a26759d1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareProperties.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestGetAndSetShareProperties.yaml @@ -1,128 +1,128 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:/Zfudoq8l/Y1expHqNgObHsmqBRvQD0n9ilMQMs/qT0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:35 GMT - Etag: - - '"0x8D47C73CCA6701C"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027270-001a-00eb-385c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:noD/0Qbcy4Du9Y8riAEwwASuNbLcfUdwQ2CmUCaQVG0= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Share-Quota: - - "55" - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?comp=properties&restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CD26BA75"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027272-001a-00eb-395c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GT08gyxXW1pEFfNn8BP4DbMGR5VFf1h7x4KqRZl+HUs= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CD26BA75"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027273-001a-00eb-3a5c-aefc45000000 - X-Ms-Share-Quota: - - "55" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:EmD5oVW05gBZexacMnqI99yNnF+6OJcWzAqQViSpjuo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027274-001a-00eb-3b5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:/Zfudoq8l/Y1expHqNgObHsmqBRvQD0n9ilMQMs/qT0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:35 GMT + Etag: + - '"0x8D47C73CCA6701C"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027270-001a-00eb-385c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:noD/0Qbcy4Du9Y8riAEwwASuNbLcfUdwQ2CmUCaQVG0= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Share-Quota: + - "55" + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?comp=properties&restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CD26BA75"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027272-001a-00eb-395c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GT08gyxXW1pEFfNn8BP4DbMGR5VFf1h7x4KqRZl+HUs= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CD26BA75"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027273-001a-00eb-3a5c-aefc45000000 + X-Ms-Share-Quota: + - "55" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:EmD5oVW05gBZexacMnqI99yNnF+6OJcWzAqQViSpjuo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-46storagesharesuitetestgetandsetshareproperties?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027274-001a-00eb-3b5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestListShares.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestListShares.yaml index ff28eedc26..de2d5a7dbc 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestListShares.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestListShares.yaml @@ -1,91 +1,91 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+X1PGkRLGQGTb1tCeCZd/mWYxkUBMIMTMcQbeXy+RGg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-32storagesharesuitetestlistshares?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CCCC9CC1"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027276-001a-00eb-3d5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:B1VZSDtFkLZznYVhm3YVuhmZTRlIVNzvHPRf/f3NdYA= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/?comp=list&maxresults=5 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x66\x69\x6C\x65\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x35\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x53\x68\x61\x72\x65\x73\x3E\x3C\x53\x68\x61\x72\x65\x3E\x3C\x4E\x61\x6D\x65\x3E\x73\x68\x61\x72\x65\x2D\x33\x32\x73\x74\x6F\x72\x61\x67\x65\x73\x68\x61\x72\x65\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x73\x68\x61\x72\x65\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x36\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x43\x43\x43\x43\x39\x43\x43\x31\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x51\x75\x6F\x74\x61\x3E\x35\x31\x32\x30\x3C\x2F\x51\x75\x6F\x74\x61\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x53\x68\x61\x72\x65\x3E\x3C\x2F\x53\x68\x61\x72\x65\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027278-001a-00eb-3e5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:qn3fe0ZWXn8hfmPs+fIhHGoj3j+AJwQlMA29STjSKms= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-32storagesharesuitetestlistshares?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027279-001a-00eb-3f5c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+X1PGkRLGQGTb1tCeCZd/mWYxkUBMIMTMcQbeXy+RGg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-32storagesharesuitetestlistshares?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CCCC9CC1"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027276-001a-00eb-3d5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:B1VZSDtFkLZznYVhm3YVuhmZTRlIVNzvHPRf/f3NdYA= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/?comp=list&maxresults=5 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x20\x53\x65\x72\x76\x69\x63\x65\x45\x6E\x64\x70\x6F\x69\x6E\x74\x3D\"\x68\x74\x74\x70\x73\x3A\x2F\x2F\x67\x6F\x6C\x61\x6E\x67\x72\x6F\x63\x6B\x73\x6F\x6E\x61\x7A\x75\x72\x65\x2E\x66\x69\x6C\x65\x2E\x63\x6F\x72\x65\x2E\x77\x69\x6E\x64\x6F\x77\x73\x2E\x6E\x65\x74\x2F\"\x3E\x3C\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x35\x3C\x2F\x4D\x61\x78\x52\x65\x73\x75\x6C\x74\x73\x3E\x3C\x53\x68\x61\x72\x65\x73\x3E\x3C\x53\x68\x61\x72\x65\x3E\x3C\x4E\x61\x6D\x65\x3E\x73\x68\x61\x72\x65\x2D\x33\x32\x73\x74\x6F\x72\x61\x67\x65\x73\x68\x61\x72\x65\x73\x75\x69\x74\x65\x74\x65\x73\x74\x6C\x69\x73\x74\x73\x68\x61\x72\x65\x73\x3C\x2F\x4E\x61\x6D\x65\x3E\x3C\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x57\x65\x64\x2C\x20\x30\x35\x20\x41\x70\x72\x20\x32\x30\x31\x37\x20\x32\x32\x3A\x33\x33\x3A\x33\x36\x20\x47\x4D\x54\x3C\x2F\x4C\x61\x73\x74\x2D\x4D\x6F\x64\x69\x66\x69\x65\x64\x3E\x3C\x45\x74\x61\x67\x3E\"\x30\x78\x38\x44\x34\x37\x43\x37\x33\x43\x43\x43\x43\x39\x43\x43\x31\"\x3C\x2F\x45\x74\x61\x67\x3E\x3C\x51\x75\x6F\x74\x61\x3E\x35\x31\x32\x30\x3C\x2F\x51\x75\x6F\x74\x61\x3E\x3C\x2F\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x2F\x53\x68\x61\x72\x65\x3E\x3C\x2F\x53\x68\x61\x72\x65\x73\x3E\x3C\x4E\x65\x78\x74\x4D\x61\x72\x6B\x65\x72\x20\x2F\x3E\x3C\x2F\x45\x6E\x75\x6D\x65\x72\x61\x74\x69\x6F\x6E\x52\x65\x73\x75\x6C\x74\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027278-001a-00eb-3e5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:qn3fe0ZWXn8hfmPs+fIhHGoj3j+AJwQlMA29STjSKms= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-32storagesharesuitetestlistshares?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027279-001a-00eb-3f5c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestMetadataCaseMunging.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestMetadataCaseMunging.yaml index db4af6de3f..7f761fdb04 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestMetadataCaseMunging.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestMetadataCaseMunging.yaml @@ -1,134 +1,134 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:F1r1tBB0areOBebzrgBmOq2Jtg923AfOEH4mjZnx7F8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CCE58084"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02727a-001a-00eb-405c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+kA0Bl9invamuXyFodhoQ37csz8f20lBl/eYoZUyWd8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:36 GMT - X-Ms-Meta-Lol: - - different rofl - X-Ms-Meta-Rofl_baz: - - different waz qux - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?comp=metadata&restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CD65F1F0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02727c-001a-00eb-415c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:2sctvq/KbCjOi3tKqgVPzDgOQsjimufOT5NFTO0zTxI= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CD65F1F0"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Meta-Lol: - - different rofl - X-Ms-Meta-Rofl_baz: - - different waz qux - X-Ms-Request-Id: - - 5a02727d-001a-00eb-425c-aefc45000000 - X-Ms-Share-Quota: - - "5120" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:CGGTwuFCxkOE38WPNc2Ks4xgCwe5C9mtWlqRtFED5eg= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share - method: DELETE - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02727e-001a-00eb-435c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:F1r1tBB0areOBebzrgBmOq2Jtg923AfOEH4mjZnx7F8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CCE58084"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02727a-001a-00eb-405c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+kA0Bl9invamuXyFodhoQ37csz8f20lBl/eYoZUyWd8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:36 GMT + X-Ms-Meta-Lol: + - different rofl + X-Ms-Meta-Rofl_baz: + - different waz qux + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?comp=metadata&restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CD65F1F0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02727c-001a-00eb-415c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:2sctvq/KbCjOi3tKqgVPzDgOQsjimufOT5NFTO0zTxI= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CD65F1F0"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Meta-Lol: + - different rofl + X-Ms-Meta-Rofl_baz: + - different waz qux + X-Ms-Request-Id: + - 5a02727d-001a-00eb-425c-aefc45000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CGGTwuFCxkOE38WPNc2Ks4xgCwe5C9mtWlqRtFED5eg= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-41storagesharesuitetestmetadatacasemunging?restype=share + method: DELETE + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02727e-001a-00eb-435c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestShareExists.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestShareExists.yaml index c7b467481a..edd91f7b81 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestShareExists.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageShareSuite/TestShareExists.yaml @@ -1,126 +1,126 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:uDWA9l5GcB+W4k70EwvhVapYgp689WmoGSsYQAgE7QY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-133storagesharesuitetestshareexists?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a02727f-001a-00eb-445c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified share does not exist. - code: 404 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:M83pAjQm4nxng2lFXLbynszPcsFxxe9SfrHGpNA3HTw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-233storagesharesuitetestshareexists?restype=share - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CD0E6CC9"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027281-001a-00eb-455c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:Yf/U9qwc5r1t4rfn6grWKrc8HVIdd4agLZ48HwGFmTo= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-233storagesharesuitetestshareexists?restype=share - method: HEAD - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Etag: - - '"0x8D47C73CD0E6CC9"' - Last-Modified: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027283-001a-00eb-465c-aefc45000000 - X-Ms-Share-Quota: - - "5120" - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:1KXGG9P3zYpS2yLzch5VVsDcjHTuBngVE2q9v8M4IVY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.file.core.windows.net/share-133storagesharesuitetestshareexists?restype=share - method: DELETE - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x53\x68\x61\x72\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x73\x68\x61\x72\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x32\x38\x34\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x34\x37\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x33\x37\x2E\x30\x34\x31\x31\x31\x35\x34\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" - headers: - Content-Length: - - "217" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:36 GMT - Server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - 5a027284-001a-00eb-475c-aefc45000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The specified share does not exist. - code: 404 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:uDWA9l5GcB+W4k70EwvhVapYgp689WmoGSsYQAgE7QY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-133storagesharesuitetestshareexists?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a02727f-001a-00eb-445c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified share does not exist. + code: 404 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:M83pAjQm4nxng2lFXLbynszPcsFxxe9SfrHGpNA3HTw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-233storagesharesuitetestshareexists?restype=share + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CD0E6CC9"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027281-001a-00eb-455c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:Yf/U9qwc5r1t4rfn6grWKrc8HVIdd4agLZ48HwGFmTo= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-233storagesharesuitetestshareexists?restype=share + method: HEAD + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Etag: + - '"0x8D47C73CD0E6CC9"' + Last-Modified: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027283-001a-00eb-465c-aefc45000000 + X-Ms-Share-Quota: + - "5120" + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:1KXGG9P3zYpS2yLzch5VVsDcjHTuBngVE2q9v8M4IVY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 file + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.file.core.windows.net/share-133storagesharesuitetestshareexists?restype=share + method: DELETE + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x45\x72\x72\x6F\x72\x3E\x3C\x43\x6F\x64\x65\x3E\x53\x68\x61\x72\x65\x4E\x6F\x74\x46\x6F\x75\x6E\x64\x3C\x2F\x43\x6F\x64\x65\x3E\x3C\x4D\x65\x73\x73\x61\x67\x65\x3E\x54\x68\x65\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x73\x68\x61\x72\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x2E\n\x52\x65\x71\x75\x65\x73\x74\x49\x64\x3A\x35\x61\x30\x32\x37\x32\x38\x34\x2D\x30\x30\x31\x61\x2D\x30\x30\x65\x62\x2D\x34\x37\x35\x63\x2D\x61\x65\x66\x63\x34\x35\x30\x30\x30\x30\x30\x30\n\x54\x69\x6D\x65\x3A\x32\x30\x31\x37\x2D\x30\x34\x2D\x30\x35\x54\x32\x32\x3A\x33\x33\x3A\x33\x37\x2E\x30\x34\x31\x31\x31\x35\x34\x5A\x3C\x2F\x4D\x65\x73\x73\x61\x67\x65\x3E\x3C\x2F\x45\x72\x72\x6F\x72\x3E" + headers: + Content-Length: + - "217" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:36 GMT + Server: + - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - 5a027284-001a-00eb-475c-aefc45000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The specified share does not exist. + code: 404 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestGetServiceProperties.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestGetServiceProperties.yaml index 0a140071ae..7babe21856 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestGetServiceProperties.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestGetServiceProperties.yaml @@ -1,33 +1,33 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gwUioVuGmO6fOLSuniOpLJWt5TZWHnOwrolVZpMkplw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x52\x65\x61\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x52\x65\x61\x64\x3E\x3C\x57\x72\x69\x74\x65\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x57\x72\x69\x74\x65\x3E\x3C\x44\x65\x6C\x65\x74\x65\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x44\x65\x6C\x65\x74\x65\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x43\x6F\x72\x73\x20\x2F\x3E\x3C\x2F\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c61b-0002-0064-5f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gwUioVuGmO6fOLSuniOpLJWt5TZWHnOwrolVZpMkplw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x52\x65\x61\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x52\x65\x61\x64\x3E\x3C\x57\x72\x69\x74\x65\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x57\x72\x69\x74\x65\x3E\x3C\x44\x65\x6C\x65\x74\x65\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x44\x65\x6C\x65\x74\x65\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x43\x6F\x72\x73\x20\x2F\x3E\x3C\x2F\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c61b-0002-0064-5f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestSetServiceProperties.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestSetServiceProperties.yaml index ca161e9c11..6740877fc2 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestSetServiceProperties.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageSuite/TestSetServiceProperties.yaml @@ -1,66 +1,66 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: 1.0truefalsetruetrue71.0truetruetrue71.0truetruetrue7*GET,PUT500x-ms-meta-customheader,x-ms-meta-data*x-ms-meta-customheader,x-ms-meta-target* - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:+Bntn6Hj/QSEeYqPmpghthxRvTBMQGpUJX81+53tfRs= - Content-Length: - - "868" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service - method: PUT - response: - body: "" - headers: - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c635-0002-0064-745c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gwUioVuGmO6fOLSuniOpLJWt5TZWHnOwrolVZpMkplw= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x52\x65\x61\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x52\x65\x61\x64\x3E\x3C\x57\x72\x69\x74\x65\x3E\x74\x72\x75\x65\x3C\x2F\x57\x72\x69\x74\x65\x3E\x3C\x44\x65\x6C\x65\x74\x65\x3E\x74\x72\x75\x65\x3C\x2F\x44\x65\x6C\x65\x74\x65\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x44\x61\x79\x73\x3E\x37\x3C\x2F\x44\x61\x79\x73\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x74\x72\x75\x65\x3C\x2F\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x44\x61\x79\x73\x3E\x37\x3C\x2F\x44\x61\x79\x73\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x74\x72\x75\x65\x3C\x2F\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x44\x61\x79\x73\x3E\x37\x3C\x2F\x44\x61\x79\x73\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x43\x6F\x72\x73\x3E\x3C\x43\x6F\x72\x73\x52\x75\x6C\x65\x3E\x3C\x41\x6C\x6C\x6F\x77\x65\x64\x4D\x65\x74\x68\x6F\x64\x73\x3E\x47\x45\x54\x2C\x50\x55\x54\x3C\x2F\x41\x6C\x6C\x6F\x77\x65\x64\x4D\x65\x74\x68\x6F\x64\x73\x3E\x3C\x41\x6C\x6C\x6F\x77\x65\x64\x4F\x72\x69\x67\x69\x6E\x73\x3E\x2A\x3C\x2F\x41\x6C\x6C\x6F\x77\x65\x64\x4F\x72\x69\x67\x69\x6E\x73\x3E\x3C\x41\x6C\x6C\x6F\x77\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x63\x75\x73\x74\x6F\x6D\x68\x65\x61\x64\x65\x72\x2C\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x74\x61\x72\x67\x65\x74\x2A\x3C\x2F\x41\x6C\x6C\x6F\x77\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x3C\x45\x78\x70\x6F\x73\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x63\x75\x73\x74\x6F\x6D\x68\x65\x61\x64\x65\x72\x2C\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x64\x61\x74\x61\x2A\x3C\x2F\x45\x78\x70\x6F\x73\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x3C\x4D\x61\x78\x41\x67\x65\x49\x6E\x53\x65\x63\x6F\x6E\x64\x73\x3E\x35\x30\x30\x3C\x2F\x4D\x61\x78\x41\x67\x65\x49\x6E\x53\x65\x63\x6F\x6E\x64\x73\x3E\x3C\x2F\x43\x6F\x72\x73\x52\x75\x6C\x65\x3E\x3C\x2F\x43\x6F\x72\x73\x3E\x3C\x2F\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E" - headers: - Access-Control-Allow-Origin: - - '*' - Access-Control-Expose-Headers: - - x-ms-meta-customheader - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c657-0002-0064-105c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: 1.0truefalsetruetrue71.0truetruetrue71.0truetruetrue7*GET,PUT500x-ms-meta-customheader,x-ms-meta-data*x-ms-meta-customheader,x-ms-meta-target* + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:+Bntn6Hj/QSEeYqPmpghthxRvTBMQGpUJX81+53tfRs= + Content-Length: + - "868" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service + method: PUT + response: + body: "" + headers: + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c635-0002-0064-745c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gwUioVuGmO6fOLSuniOpLJWt5TZWHnOwrolVZpMkplw= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/?comp=properties&restype=service + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E\x3C\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x52\x65\x61\x64\x3E\x66\x61\x6C\x73\x65\x3C\x2F\x52\x65\x61\x64\x3E\x3C\x57\x72\x69\x74\x65\x3E\x74\x72\x75\x65\x3C\x2F\x57\x72\x69\x74\x65\x3E\x3C\x44\x65\x6C\x65\x74\x65\x3E\x74\x72\x75\x65\x3C\x2F\x44\x65\x6C\x65\x74\x65\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x44\x61\x79\x73\x3E\x37\x3C\x2F\x44\x61\x79\x73\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4C\x6F\x67\x67\x69\x6E\x67\x3E\x3C\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x74\x72\x75\x65\x3C\x2F\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x44\x61\x79\x73\x3E\x37\x3C\x2F\x44\x61\x79\x73\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x48\x6F\x75\x72\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x56\x65\x72\x73\x69\x6F\x6E\x3E\x31\x2E\x30\x3C\x2F\x56\x65\x72\x73\x69\x6F\x6E\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x74\x72\x75\x65\x3C\x2F\x49\x6E\x63\x6C\x75\x64\x65\x41\x50\x49\x73\x3E\x3C\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x45\x6E\x61\x62\x6C\x65\x64\x3E\x74\x72\x75\x65\x3C\x2F\x45\x6E\x61\x62\x6C\x65\x64\x3E\x3C\x44\x61\x79\x73\x3E\x37\x3C\x2F\x44\x61\x79\x73\x3E\x3C\x2F\x52\x65\x74\x65\x6E\x74\x69\x6F\x6E\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x4D\x69\x6E\x75\x74\x65\x4D\x65\x74\x72\x69\x63\x73\x3E\x3C\x43\x6F\x72\x73\x3E\x3C\x43\x6F\x72\x73\x52\x75\x6C\x65\x3E\x3C\x41\x6C\x6C\x6F\x77\x65\x64\x4D\x65\x74\x68\x6F\x64\x73\x3E\x47\x45\x54\x2C\x50\x55\x54\x3C\x2F\x41\x6C\x6C\x6F\x77\x65\x64\x4D\x65\x74\x68\x6F\x64\x73\x3E\x3C\x41\x6C\x6C\x6F\x77\x65\x64\x4F\x72\x69\x67\x69\x6E\x73\x3E\x2A\x3C\x2F\x41\x6C\x6C\x6F\x77\x65\x64\x4F\x72\x69\x67\x69\x6E\x73\x3E\x3C\x41\x6C\x6C\x6F\x77\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x63\x75\x73\x74\x6F\x6D\x68\x65\x61\x64\x65\x72\x2C\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x74\x61\x72\x67\x65\x74\x2A\x3C\x2F\x41\x6C\x6C\x6F\x77\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x3C\x45\x78\x70\x6F\x73\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x63\x75\x73\x74\x6F\x6D\x68\x65\x61\x64\x65\x72\x2C\x78\x2D\x6D\x73\x2D\x6D\x65\x74\x61\x2D\x64\x61\x74\x61\x2A\x3C\x2F\x45\x78\x70\x6F\x73\x65\x64\x48\x65\x61\x64\x65\x72\x73\x3E\x3C\x4D\x61\x78\x41\x67\x65\x49\x6E\x53\x65\x63\x6F\x6E\x64\x73\x3E\x35\x30\x30\x3C\x2F\x4D\x61\x78\x41\x67\x65\x49\x6E\x53\x65\x63\x6F\x6E\x64\x73\x3E\x3C\x2F\x43\x6F\x72\x73\x52\x75\x6C\x65\x3E\x3C\x2F\x43\x6F\x72\x73\x3E\x3C\x2F\x53\x74\x6F\x72\x61\x67\x65\x53\x65\x72\x76\x69\x63\x65\x50\x72\x6F\x70\x65\x72\x74\x69\x65\x73\x3E" + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - x-ms-meta-customheader + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c657-0002-0064-105c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestGet.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestGet.yaml index 5b714ef617..39ff3d9ff3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestGet.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestGet.yaml @@ -1,126 +1,126 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table25storagetablesuitetestget"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:oFkVVxYbvsi0eavYxzYyO+K1yj1RtfoYCG8k0Nby2A8= - Content-Length: - - "48" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table25storagetablesuitetestget') - Date: - - Fri, 21 Apr 2017 19:01:31 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table25storagetablesuitetestget') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca575-0002-0077-18d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:XcVA9Plm6Mv6/t+Yz2+MGKxJpuQAvBOx866YjeMdpc8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table25storagetablesuitetestget%27%29?timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","odata.type":"golangrocksonazure.Tables","odata.id":"https://golangrocksonazure.table.core.windows.net/Tables(''table25storagetablesuitetestget'')","odata.editLink":"Tables(''table25storagetablesuitetestget'')","TableName":"table25storagetablesuitetestget"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Fri, 21 Apr 2017 19:01:31 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca57f-0002-0077-20d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:cRjC+bNv9D958nFowOo3XHO0IMUhnMDG1lfNbeLMOHw= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Fri, 21 Apr 2017 19:01:31 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table25storagetablesuitetestget%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Fri, 21 Apr 2017 19:01:31 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 01dca585-0002-0077-26d1-ba87f8000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table25storagetablesuitetestget"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:oFkVVxYbvsi0eavYxzYyO+K1yj1RtfoYCG8k0Nby2A8= + Content-Length: + - "48" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table25storagetablesuitetestget') + Date: + - Fri, 21 Apr 2017 19:01:31 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table25storagetablesuitetestget') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca575-0002-0077-18d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:XcVA9Plm6Mv6/t+Yz2+MGKxJpuQAvBOx866YjeMdpc8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table25storagetablesuitetestget%27%29?timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","odata.type":"golangrocksonazure.Tables","odata.id":"https://golangrocksonazure.table.core.windows.net/Tables(''table25storagetablesuitetestget'')","odata.editLink":"Tables(''table25storagetablesuitetestget'')","TableName":"table25storagetablesuitetestget"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Fri, 21 Apr 2017 19:01:31 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca57f-0002-0077-20d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:cRjC+bNv9D958nFowOo3XHO0IMUhnMDG1lfNbeLMOHw= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Fri, 21 Apr 2017 19:01:31 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table25storagetablesuitetestget%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Fri, 21 Apr 2017 19:01:31 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 01dca585-0002-0077-26d1-ba87f8000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestQueryTablesNextResults.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestQueryTablesNextResults.yaml index cae89ae690..14c5794798 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestQueryTablesNextResults.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestQueryTablesNextResults.yaml @@ -1,337 +1,337 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table044storagetablesuitetestque"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:gSTg/IffFXHUM2hc03D6IFJlaWJyqjogU1J5d6LkvbI= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table044storagetablesuitetestque') - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table044storagetablesuitetestque') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c67a-0002-0064-325c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: | - {"TableName":"table144storagetablesuitetestque"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:gSTg/IffFXHUM2hc03D6IFJlaWJyqjogU1J5d6LkvbI= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table144storagetablesuitetestque') - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table144storagetablesuitetestque') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c688-0002-0064-3f5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: | - {"TableName":"table244storagetablesuitetestque"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:gSTg/IffFXHUM2hc03D6IFJlaWJyqjogU1J5d6LkvbI= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table244storagetablesuitetestque') - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table244storagetablesuitetestque') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c695-0002-0064-4b5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=minimalmetadata - Authorization: - - SharedKey golangrocksonazure:R51QYZu7Bf1ra4piRxz6RkwiltzJNZ0fO41RIoo8Kmk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?%24top=2 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables","value":[{"TableName":"table044storagetablesuitetestque"},{"TableName":"table144storagetablesuitetestque"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Continuation-Nexttablename: - - 1!68!dGFibGUyNDRzdG9yYWdldGFibGVzdWl0ZXRlc3RxdWUBMDFkMmFlNWNhYWQ3OTFhMw-- - X-Ms-Request-Id: - - ab33c6a5-0002-0064-585c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=minimalmetadata - Authorization: - - SharedKey golangrocksonazure:R51QYZu7Bf1ra4piRxz6RkwiltzJNZ0fO41RIoo8Kmk= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?%24top=2&NextTableName=1%2168%21dGFibGUyNDRzdG9yYWdldGFibGVzdWl0ZXRlc3RxdWUBMDFkMmFlNWNhYWQ3OTFhMw-- - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables","value":[{"TableName":"table244storagetablesuitetestque"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c6b5-0002-0064-665c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:jpeBUhYkjP7S2Yk+Xp8EyGtEoLQxfbG71Zzr9iPFEtw= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table244storagetablesuitetestque%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c6bd-0002-0064-6e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:9uJ3dM3GEgR5R/JHiOhnTYl/WZISnvhKh4EC9mBGYzk= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:37 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table144storagetablesuitetestque%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c6c8-0002-0064-785c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:XGWtTP7dLcC0v5KmE2kAarfwOFm//o2F6AhNki7yfks= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table044storagetablesuitetestque%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c6d8-0002-0064-075c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table044storagetablesuitetestque"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:gSTg/IffFXHUM2hc03D6IFJlaWJyqjogU1J5d6LkvbI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table044storagetablesuitetestque') + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table044storagetablesuitetestque') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c67a-0002-0064-325c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: | + {"TableName":"table144storagetablesuitetestque"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:gSTg/IffFXHUM2hc03D6IFJlaWJyqjogU1J5d6LkvbI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table144storagetablesuitetestque') + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table144storagetablesuitetestque') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c688-0002-0064-3f5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: | + {"TableName":"table244storagetablesuitetestque"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:gSTg/IffFXHUM2hc03D6IFJlaWJyqjogU1J5d6LkvbI= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table244storagetablesuitetestque') + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table244storagetablesuitetestque') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c695-0002-0064-4b5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - SharedKey golangrocksonazure:R51QYZu7Bf1ra4piRxz6RkwiltzJNZ0fO41RIoo8Kmk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?%24top=2 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables","value":[{"TableName":"table044storagetablesuitetestque"},{"TableName":"table144storagetablesuitetestque"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Continuation-Nexttablename: + - 1!68!dGFibGUyNDRzdG9yYWdldGFibGVzdWl0ZXRlc3RxdWUBMDFkMmFlNWNhYWQ3OTFhMw-- + X-Ms-Request-Id: + - ab33c6a5-0002-0064-585c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Authorization: + - SharedKey golangrocksonazure:R51QYZu7Bf1ra4piRxz6RkwiltzJNZ0fO41RIoo8Kmk= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?%24top=2&NextTableName=1%2168%21dGFibGUyNDRzdG9yYWdldGFibGVzdWl0ZXRlc3RxdWUBMDFkMmFlNWNhYWQ3OTFhMw-- + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables","value":[{"TableName":"table244storagetablesuitetestque"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c6b5-0002-0064-665c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:jpeBUhYkjP7S2Yk+Xp8EyGtEoLQxfbG71Zzr9iPFEtw= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table244storagetablesuitetestque%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c6bd-0002-0064-6e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:9uJ3dM3GEgR5R/JHiOhnTYl/WZISnvhKh4EC9mBGYzk= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:37 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table144storagetablesuitetestque%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c6c8-0002-0064-785c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:XGWtTP7dLcC0v5KmE2kAarfwOFm//o2F6AhNki7yfks= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table044storagetablesuitetestque%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c6d8-0002-0064-075c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsSuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsSuccessfully.yaml index 9197a50c3a..8c137ed3d3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsSuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsSuccessfully.yaml @@ -1,122 +1,122 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table48storagetablesuitetestsetp"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table48storagetablesuitetestsetp') - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table48storagetablesuitetestsetp') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c6ea-0002-0064-195c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zraud - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:WZmgk259mDd6HO5e9Y/EXwyGTHQTbEunHC7egL9F2fQ= - Content-Length: - - "233" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table48storagetablesuitetestsetp?comp=acl&timeout=30 - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:37 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c6ef-0002-0064-1d5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:A2sZC6ncp2Kzua+9vQt1wGDkKw5W+XiTBPRJ2G0GZb4= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table48storagetablesuitetestsetp%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c6f9-0002-0064-265c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table48storagetablesuitetestsetp"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table48storagetablesuitetestsetp') + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table48storagetablesuitetestsetp') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c6ea-0002-0064-195c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zraud + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:WZmgk259mDd6HO5e9Y/EXwyGTHQTbEunHC7egL9F2fQ= + Content-Length: + - "233" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table48storagetablesuitetestsetp?comp=acl&timeout=30 + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:37 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c6ef-0002-0064-1d5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:A2sZC6ncp2Kzua+9vQt1wGDkKw5W+XiTBPRJ2G0GZb4= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table48storagetablesuitetestsetp%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c6f9-0002-0064-265c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsUnsuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsUnsuccessfully.yaml index 0f70ca139b..918fc98e24 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsUnsuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetPermissionsUnsuccessfully.yaml @@ -1,40 +1,40 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zraud - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:CmYZq2Ifv5YV7xqZwn37rh92ygeD40NHmkqdlpZEhj0= - Content-Length: - - "233" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/nonexistingtable?comp=acl&timeout=30 - method: PUT - response: - body: |- - TableNotFoundThe table specified does not exist. - RequestId:ab33c70a-0002-0064-375c-aeb219000000 - Time:2017-04-05T22:33:38.2906021Z - headers: - Content-Length: - - "316" - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c70a-0002-0064-375c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 404 The table specified does not exist. - code: 404 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06Zraud + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:CmYZq2Ifv5YV7xqZwn37rh92ygeD40NHmkqdlpZEhj0= + Content-Length: + - "233" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/nonexistingtable?comp=acl&timeout=30 + method: PUT + response: + body: |- + TableNotFoundThe table specified does not exist. + RequestId:ab33c70a-0002-0064-375c-aeb219000000 + Time:2017-04-05T22:33:38.2906021Z + headers: + Content-Length: + - "316" + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c70a-0002-0064-375c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 404 The table specified does not exist. + code: 404 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetThenGetPermissionsSuccessfully.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetThenGetPermissionsSuccessfully.yaml index 63f139c69d..e0d3f64495 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetThenGetPermissionsSuccessfully.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/TestSetThenGetPermissionsSuccessfully.yaml @@ -1,151 +1,151 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table55storagetablesuitetestsett"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table55storagetablesuitetestsett') - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table55storagetablesuitetestsett') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c733-0002-0064-5c5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06ZraudAutoRestIsSuperCool2050-12-21T17:55:06Z2050-12-22T03:55:06Zrad - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:F8mXRaou6eIgfd9bOGCGXOLDVO/LPyX6MOhkSMvfuNs= - Content-Length: - - "427" - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table55storagetablesuitetestsett?comp=acl&timeout=30 - method: PUT - response: - body: "" - headers: - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c745-0002-0064-6b5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:UQmh1G4zMkc05NaH+oQQGd8ycqRFVyu28OYK69SSizY= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table55storagetablesuitetestsett?comp=acl&timeout=30 - method: GET - response: - body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x30\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x61\x75\x64\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x41\x75\x74\x6F\x52\x65\x73\x74\x49\x73\x53\x75\x70\x65\x72\x43\x6F\x6F\x6C\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x31\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x32\x54\x30\x33\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x61\x64\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" - headers: - Content-Type: - - application/xml - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Ms-Request-Id: - - ab33c753-0002-0064-795c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:KyQ6PHCMyVS/RoEqU0aEDYcKpYd2526SWQh4G2PesNw= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table55storagetablesuitetestsett%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c764-0002-0064-085c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table55storagetablesuitetestsett"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table55storagetablesuitetestsett') + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table55storagetablesuitetestsett') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c733-0002-0064-5c5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: GolangRocksOnAzure2050-12-20T21:55:06Z2050-12-21T07:55:06ZraudAutoRestIsSuperCool2050-12-21T17:55:06Z2050-12-22T03:55:06Zrad + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:F8mXRaou6eIgfd9bOGCGXOLDVO/LPyX6MOhkSMvfuNs= + Content-Length: + - "427" + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table55storagetablesuitetestsett?comp=acl&timeout=30 + method: PUT + response: + body: "" + headers: + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c745-0002-0064-6b5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:UQmh1G4zMkc05NaH+oQQGd8ycqRFVyu28OYK69SSizY= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table55storagetablesuitetestsett?comp=acl&timeout=30 + method: GET + response: + body: "\uFEFF\x3C\x3F\x78\x6D\x6C\x20\x76\x65\x72\x73\x69\x6F\x6E\x3D\"\x31\x2E\x30\"\x20\x65\x6E\x63\x6F\x64\x69\x6E\x67\x3D\"\x75\x74\x66\x2D\x38\"\x3F\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x47\x6F\x6C\x61\x6E\x67\x52\x6F\x63\x6B\x73\x4F\x6E\x41\x7A\x75\x72\x65\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x30\x54\x32\x31\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x30\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x61\x75\x64\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x49\x64\x3E\x41\x75\x74\x6F\x52\x65\x73\x74\x49\x73\x53\x75\x70\x65\x72\x43\x6F\x6F\x6C\x3C\x2F\x49\x64\x3E\x3C\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x53\x74\x61\x72\x74\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x31\x54\x31\x37\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x53\x74\x61\x72\x74\x3E\x3C\x45\x78\x70\x69\x72\x79\x3E\x32\x30\x35\x30\x2D\x31\x32\x2D\x32\x32\x54\x30\x33\x3A\x35\x35\x3A\x30\x36\x2E\x30\x30\x30\x30\x30\x30\x30\x5A\x3C\x2F\x45\x78\x70\x69\x72\x79\x3E\x3C\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x72\x61\x64\x3C\x2F\x50\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x3E\x3C\x2F\x41\x63\x63\x65\x73\x73\x50\x6F\x6C\x69\x63\x79\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x3E\x3C\x2F\x53\x69\x67\x6E\x65\x64\x49\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x73\x3E" + headers: + Content-Type: + - application/xml + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Ms-Request-Id: + - ab33c753-0002-0064-795c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:KyQ6PHCMyVS/RoEqU0aEDYcKpYd2526SWQh4G2PesNw= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table55storagetablesuitetestsett%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c764-0002-0064-085c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateAndDeleteTable.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateAndDeleteTable.yaml index ecac260b11..f65b62e81d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateAndDeleteTable.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateAndDeleteTable.yaml @@ -1,176 +1,176 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table143storagetablesuitetestcre"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table143storagetablesuitetestcre') - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table143storagetablesuitetestcre') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c77f-0002-0064-235c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: | - {"TableName":"table243storagetablesuitetestcre"} - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","odata.type":"golangrocksonazure.Tables","odata.id":"https://golangrocksonazure.table.core.windows.net/Tables(''table243storagetablesuitetestcre'')","odata.editLink":"Tables(''table243storagetablesuitetestcre'')","TableName":"table243storagetablesuitetestcre"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table243storagetablesuitetestcre') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c797-0002-0064-365c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:gZagydr7XgaDzKM0Q+6sYN6uboOH1eMeHxpWLRKIwkE= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table143storagetablesuitetestcre%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7b0-0002-0064-4e5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:hU0P2a7tNoZeEqeYSMDVFF55jTfLHnq7TWmlWLeBEoM= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table243storagetablesuitetestcre%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7bb-0002-0064-595c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table143storagetablesuitetestcre"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table143storagetablesuitetestcre') + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table143storagetablesuitetestcre') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c77f-0002-0064-235c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: | + {"TableName":"table243storagetablesuitetestcre"} + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","odata.type":"golangrocksonazure.Tables","odata.id":"https://golangrocksonazure.table.core.windows.net/Tables(''table243storagetablesuitetestcre'')","odata.editLink":"Tables(''table243storagetablesuitetestcre'')","TableName":"table243storagetablesuitetestcre"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table243storagetablesuitetestcre') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c797-0002-0064-365c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:gZagydr7XgaDzKM0Q+6sYN6uboOH1eMeHxpWLRKIwkE= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table143storagetablesuitetestcre%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7b0-0002-0064-4e5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:hU0P2a7tNoZeEqeYSMDVFF55jTfLHnq7TWmlWLeBEoM= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table243storagetablesuitetestcre%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7bb-0002-0064-595c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateTableWithAllResponsePayloadLevels.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateTableWithAllResponsePayloadLevels.yaml index 7e8f9fdb3f..295c08f732 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateTableWithAllResponsePayloadLevels.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/StorageTableSuite/Test_CreateTableWithAllResponsePayloadLevels.yaml @@ -1,346 +1,346 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"tableempty62storagetablesuitetes"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('tableempty62storagetablesuitetes') - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('tableempty62storagetablesuitetes') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7cf-0002-0064-6c5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:dF/e5TDwQxk17VDrcX3bgxKMHuWeMrIuU+ygy32Koos= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tableempty62storagetablesuitetes%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7d9-0002-0064-755c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: | - {"TableName":"tablenm62storagetablesuitetestcr"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: '{"TableName":"tablenm62storagetablesuitetestcr"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=nometadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('tablenm62storagetablesuitetestcr') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7e5-0002-0064-015c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:Iceew5yxMs8KNGrIs7sgkd1Q2btKPGbKSUgWZ2jWD10= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:38 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tablenm62storagetablesuitetestcr%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7ea-0002-0064-055c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: | - {"TableName":"tableminimal62storagetablesuitet"} - form: {} - headers: - Accept: - - application/json;odata=minimalmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:ouOoI8e61b/jY8OrrTp3mXiQPuqcHpDbOUuYpwZ8ubE= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:39 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","TableName":"tableminimal62storagetablesuitet"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('tableminimal62storagetablesuitet') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7f2-0002-0064-0d5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:TAFcJGNoRn/SVMjtHZ3zVM+AwFmawZ+tXi6WFadx7Js= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:39 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tableminimal62storagetablesuitet%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c7fc-0002-0064-165c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: | - {"TableName":"tablefull62storagetablesuitetest"} - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:ouOoI8e61b/jY8OrrTp3mXiQPuqcHpDbOUuYpwZ8ubE= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:39 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","odata.type":"golangrocksonazure.Tables","odata.id":"https://golangrocksonazure.table.core.windows.net/Tables(''tablefull62storagetablesuitetest'')","odata.editLink":"Tables(''tablefull62storagetablesuitetest'')","TableName":"tablefull62storagetablesuitetest"}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Wed, 05 Apr 2017 22:33:38 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('tablefull62storagetablesuitetest') - Preference-Applied: - - return-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c807-0002-0064-215c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 201 Created - code: 201 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:m1VdnFK7v7MgjuqeoPzrQOFxGzoJAiwDNnyh+J6Kw3I= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Wed, 05 Apr 2017 22:33:39 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tablefull62storagetablesuitetest%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Wed, 05 Apr 2017 22:33:39 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - ab33c811-0002-0064-2a5c-aeb219000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"tableempty62storagetablesuitetes"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('tableempty62storagetablesuitetes') + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('tableempty62storagetablesuitetes') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7cf-0002-0064-6c5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:dF/e5TDwQxk17VDrcX3bgxKMHuWeMrIuU+ygy32Koos= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tableempty62storagetablesuitetes%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7d9-0002-0064-755c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: | + {"TableName":"tablenm62storagetablesuitetestcr"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:FGdH/rDYACY5yqYP0qQnD+uBzj+bK8+AoqOf264baxY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: '{"TableName":"tablenm62storagetablesuitetestcr"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=nometadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('tablenm62storagetablesuitetestcr') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7e5-0002-0064-015c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:Iceew5yxMs8KNGrIs7sgkd1Q2btKPGbKSUgWZ2jWD10= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:38 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tablenm62storagetablesuitetestcr%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7ea-0002-0064-055c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: | + {"TableName":"tableminimal62storagetablesuitet"} + form: {} + headers: + Accept: + - application/json;odata=minimalmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:ouOoI8e61b/jY8OrrTp3mXiQPuqcHpDbOUuYpwZ8ubE= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:39 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","TableName":"tableminimal62storagetablesuitet"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=minimalmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('tableminimal62storagetablesuitet') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7f2-0002-0064-0d5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:TAFcJGNoRn/SVMjtHZ3zVM+AwFmawZ+tXi6WFadx7Js= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:39 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tableminimal62storagetablesuitet%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c7fc-0002-0064-165c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: | + {"TableName":"tablefull62storagetablesuitetest"} + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:ouOoI8e61b/jY8OrrTp3mXiQPuqcHpDbOUuYpwZ8ubE= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:39 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#Tables/@Element","odata.type":"golangrocksonazure.Tables","odata.id":"https://golangrocksonazure.table.core.windows.net/Tables(''tablefull62storagetablesuitetest'')","odata.editLink":"Tables(''tablefull62storagetablesuitetest'')","TableName":"tablefull62storagetablesuitetest"}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Wed, 05 Apr 2017 22:33:38 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('tablefull62storagetablesuitetest') + Preference-Applied: + - return-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c807-0002-0064-215c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 201 Created + code: 201 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:m1VdnFK7v7MgjuqeoPzrQOFxGzoJAiwDNnyh+J6Kw3I= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Wed, 05 Apr 2017 22:33:39 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tablefull62storagetablesuitetest%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Wed, 05 Apr 2017 22:33:39 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - ab33c811-0002-0064-2a5c-aeb219000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertDeleteSameEntity.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertDeleteSameEntity.yaml index abbf71596b..d3bda170f1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertDeleteSameEntity.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertDeleteSameEntity.yaml @@ -1,139 +1,139 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table48tablebatchsuitetestbatchi"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:pOaHxR/s7rWzcksn6cFJDOO53tfCk8MAuDl7eKONElY= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:09 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table48tablebatchsuitetestbatchi') - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table48tablebatchsuitetestbatchi') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac39d-0002-003f-42ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "--batch_3da8ce75-1ee2-11e7-b451-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8\r\n\r\n\r\n--changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table48tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nDELETE https://golangrocksonazure.table.core.windows.net/table48tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nIf-Match: *\r\nPrefer: return-no-content\r\n\r\n\r\n--changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8--\r\n\r\n--batch_3da8ce75-1ee2-11e7-b451-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:GLDJC/u/UBMvnETo4s5SFMlRb80M7AneKWvj1tg26Xs= - Content-Type: - - multipart/mixed; boundary=batch_3da8ce75-1ee2-11e7-b451-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_9ca4f1d7-1656-48bb-9424-95df6ef992f7\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_472d4d32-edd9-4a1a-91cc-e265a58fdb38\r\n\r\n--changesetresponse_472d4d32-edd9-4a1a-91cc-e265a58fdb38\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 400 Bad - Request\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nDataServiceVersion: - 3.0;\r\nContent-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8\r\n\r\n{\"odata.error\":{\"code\":\"InvalidDuplicateRow\",\"message\":{\"lang\":\"en-US\",\"value\":\"1:The - batch request contains multiple changes with same row key. An entity can appear - only once in a batch request.\\nRequestId:532ac3ba-0002-003f-5bee-b2b565000000\\nTime:2017-04-11T18:11:10.6278114Z\"}}}\r\n--changesetresponse_472d4d32-edd9-4a1a-91cc-e265a58fdb38--\r\n--batchresponse_9ca4f1d7-1656-48bb-9424-95df6ef992f7--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_9ca4f1d7-1656-48bb-9424-95df6ef992f7 - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac3ba-0002-003f-5bee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:njb4+PrjVSZhwsBX15rCVfgCrdtFG+H56EoHnD3WmhU= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table48tablebatchsuitetestbatchi%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac3d8-0002-003f-78ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table48tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:pOaHxR/s7rWzcksn6cFJDOO53tfCk8MAuDl7eKONElY= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:09 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table48tablebatchsuitetestbatchi') + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table48tablebatchsuitetestbatchi') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac39d-0002-003f-42ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_3da8ce75-1ee2-11e7-b451-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8\r\n\r\n\r\n--changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table48tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nDELETE https://golangrocksonazure.table.core.windows.net/table48tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nIf-Match: *\r\nPrefer: return-no-content\r\n\r\n\r\n--changeset_3da8bae2-1ee2-11e7-b451-6451064d81e8--\r\n\r\n--batch_3da8ce75-1ee2-11e7-b451-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:GLDJC/u/UBMvnETo4s5SFMlRb80M7AneKWvj1tg26Xs= + Content-Type: + - multipart/mixed; boundary=batch_3da8ce75-1ee2-11e7-b451-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_9ca4f1d7-1656-48bb-9424-95df6ef992f7\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_472d4d32-edd9-4a1a-91cc-e265a58fdb38\r\n\r\n--changesetresponse_472d4d32-edd9-4a1a-91cc-e265a58fdb38\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 400 Bad + Request\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nDataServiceVersion: + 3.0;\r\nContent-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8\r\n\r\n{\"odata.error\":{\"code\":\"InvalidDuplicateRow\",\"message\":{\"lang\":\"en-US\",\"value\":\"1:The + batch request contains multiple changes with same row key. An entity can appear + only once in a batch request.\\nRequestId:532ac3ba-0002-003f-5bee-b2b565000000\\nTime:2017-04-11T18:11:10.6278114Z\"}}}\r\n--changesetresponse_472d4d32-edd9-4a1a-91cc-e265a58fdb38--\r\n--batchresponse_9ca4f1d7-1656-48bb-9424-95df6ef992f7--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_9ca4f1d7-1656-48bb-9424-95df6ef992f7 + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac3ba-0002-003f-5bee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:njb4+PrjVSZhwsBX15rCVfgCrdtFG+H56EoHnD3WmhU= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table48tablebatchsuitetestbatchi%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac3d8-0002-003f-78ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertMultipleEntities.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertMultipleEntities.yaml index 56d135dd1d..f06f7aaf8d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertMultipleEntities.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertMultipleEntities.yaml @@ -1,175 +1,175 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"tableme48tablebatchsuitetestbatc"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:1t2kY6E0PFMc1W+posaBaQmjBq5FxR+gI/5VXQMEUEo= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('tableme48tablebatchsuitetestbatc') - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('tableme48tablebatchsuitetestbatc') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac3f2-0002-003f-12ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "--batch_3dc2084d-1ee2-11e7-b451-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8\r\n\r\n\r\n--changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey2%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":111.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey2\"}\r\n--changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8--\r\n\r\n--batch_3dc2084d-1ee2-11e7-b451-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:RGy3qLgRm7bByfCAkyVhvp3agRTqbXD9q8Do04EOF+o= - Content-Type: - - multipart/mixed; boundary=batch_3dc2084d-1ee2-11e7-b451-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_bfc11b1c-a658-48ee-aa5b-bc376d99e9c1\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739\r\n\r\n--changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No - Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: - return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.0200758Z'\"\r\n\r\n\r\n--changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No - Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: - return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.0200758Z'\"\r\n\r\n\r\n--changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739--\r\n--batchresponse_bfc11b1c-a658-48ee-aa5b-bc376d99e9c1--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_bfc11b1c-a658-48ee-aa5b-bc376d99e9c1 - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac404-0002-003f-22ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:rXjmlnktLYdHXc3yoRSvyZadPKkRgnTg6EtWc37SJN8= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc?%24top=2&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#tableme48tablebatchsuitetestbatc","value":[{"odata.type":"golangrocksonazure.tableme48tablebatchsuitetestbatc","odata.id":"https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-11T18%3A11%3A11.0200758Z''\"","odata.editLink":"tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:11:11.0200758Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"},{"odata.type":"golangrocksonazure.tableme48tablebatchsuitetestbatc","odata.id":"https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey2'')","odata.etag":"W/\"datetime''2017-04-11T18%3A11%3A11.0200758Z''\"","odata.editLink":"tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey2'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:11:11.0200758Z","AmountDue":111.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac414-0002-003f-32ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:XoadbcLScLmBf/0/Mxvx4pFrC4CXPG86sXfm8gbcj28= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tableme48tablebatchsuitetestbatc%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac41d-0002-003f-3bee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"tableme48tablebatchsuitetestbatc"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:1t2kY6E0PFMc1W+posaBaQmjBq5FxR+gI/5VXQMEUEo= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('tableme48tablebatchsuitetestbatc') + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('tableme48tablebatchsuitetestbatc') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac3f2-0002-003f-12ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_3dc2084d-1ee2-11e7-b451-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8\r\n\r\n\r\n--changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey2%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":111.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey2\"}\r\n--changeset_3dc1f365-1ee2-11e7-b451-6451064d81e8--\r\n\r\n--batch_3dc2084d-1ee2-11e7-b451-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:RGy3qLgRm7bByfCAkyVhvp3agRTqbXD9q8Do04EOF+o= + Content-Type: + - multipart/mixed; boundary=batch_3dc2084d-1ee2-11e7-b451-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_bfc11b1c-a658-48ee-aa5b-bc376d99e9c1\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739\r\n\r\n--changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No + Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: + return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.0200758Z'\"\r\n\r\n\r\n--changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No + Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: + return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.0200758Z'\"\r\n\r\n\r\n--changesetresponse_86be85ca-279f-4cfe-9621-888c22f50739--\r\n--batchresponse_bfc11b1c-a658-48ee-aa5b-bc376d99e9c1--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_bfc11b1c-a658-48ee-aa5b-bc376d99e9c1 + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac404-0002-003f-22ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:rXjmlnktLYdHXc3yoRSvyZadPKkRgnTg6EtWc37SJN8= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc?%24top=2&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#tableme48tablebatchsuitetestbatc","value":[{"odata.type":"golangrocksonazure.tableme48tablebatchsuitetestbatc","odata.id":"https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-11T18%3A11%3A11.0200758Z''\"","odata.editLink":"tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:11:11.0200758Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"},{"odata.type":"golangrocksonazure.tableme48tablebatchsuitetestbatc","odata.id":"https://golangrocksonazure.table.core.windows.net/tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey2'')","odata.etag":"W/\"datetime''2017-04-11T18%3A11%3A11.0200758Z''\"","odata.editLink":"tableme48tablebatchsuitetestbatc(PartitionKey=''mypartitionkey'',RowKey=''myrowkey2'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey2","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:11:11.0200758Z","AmountDue":111.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac414-0002-003f-32ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:XoadbcLScLmBf/0/Mxvx4pFrC4CXPG86sXfm8gbcj28= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27tableme48tablebatchsuitetestbatc%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac41d-0002-003f-3bee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertSameEntryMultipleTimes.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertSameEntryMultipleTimes.yaml index 75eb03a866..eddcade56a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertSameEntryMultipleTimes.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertSameEntryMultipleTimes.yaml @@ -1,139 +1,139 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table54tablebatchsuitetestbatchi"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:1t2kY6E0PFMc1W+posaBaQmjBq5FxR+gI/5VXQMEUEo= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table54tablebatchsuitetestbatchi') - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table54tablebatchsuitetestbatchi') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac430-0002-003f-4eee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "--batch_3de4c6dd-1ee2-11e7-b452-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8\r\n\r\n\r\n--changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table54tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table54tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8--\r\n\r\n--batch_3de4c6dd-1ee2-11e7-b452-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:uxFNTMoAUgZ/GMqj6jw/6t4jdmlHuLfzE3coBobRHJ4= - Content-Type: - - multipart/mixed; boundary=batch_3de4c6dd-1ee2-11e7-b452-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_96d3b428-9daf-41b4-b4ac-d860a49e8d8f\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_dee290b3-2a8d-457c-9cdf-fae6298ba725\r\n\r\n--changesetresponse_dee290b3-2a8d-457c-9cdf-fae6298ba725\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 400 Bad - Request\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: - return-no-content\r\nDataServiceVersion: 3.0;\r\nContent-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8\r\n\r\n{\"odata.error\":{\"code\":\"InvalidDuplicateRow\",\"message\":{\"lang\":\"en-US\",\"value\":\"1:The - batch request contains multiple changes with same row key. An entity can appear - only once in a batch request.\\nRequestId:532ac444-0002-003f-60ee-b2b565000000\\nTime:2017-04-11T18:11:11.0180936Z\"}}}\r\n--changesetresponse_dee290b3-2a8d-457c-9cdf-fae6298ba725--\r\n--batchresponse_96d3b428-9daf-41b4-b4ac-d860a49e8d8f--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_96d3b428-9daf-41b4-b4ac-d860a49e8d8f - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac444-0002-003f-60ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:ei0mh49CqmGLtaxg9XGZQPaQs17FMWuVMepYxvS34I0= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table54tablebatchsuitetestbatchi%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac464-0002-003f-80ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table54tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:1t2kY6E0PFMc1W+posaBaQmjBq5FxR+gI/5VXQMEUEo= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table54tablebatchsuitetestbatchi') + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table54tablebatchsuitetestbatchi') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac430-0002-003f-4eee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_3de4c6dd-1ee2-11e7-b452-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8\r\n\r\n\r\n--changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table54tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table54tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3de4c6dd-1ee2-11e7-b451-6451064d81e8--\r\n\r\n--batch_3de4c6dd-1ee2-11e7-b452-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:uxFNTMoAUgZ/GMqj6jw/6t4jdmlHuLfzE3coBobRHJ4= + Content-Type: + - multipart/mixed; boundary=batch_3de4c6dd-1ee2-11e7-b452-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_96d3b428-9daf-41b4-b4ac-d860a49e8d8f\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_dee290b3-2a8d-457c-9cdf-fae6298ba725\r\n\r\n--changesetresponse_dee290b3-2a8d-457c-9cdf-fae6298ba725\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 400 Bad + Request\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: + return-no-content\r\nDataServiceVersion: 3.0;\r\nContent-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8\r\n\r\n{\"odata.error\":{\"code\":\"InvalidDuplicateRow\",\"message\":{\"lang\":\"en-US\",\"value\":\"1:The + batch request contains multiple changes with same row key. An entity can appear + only once in a batch request.\\nRequestId:532ac444-0002-003f-60ee-b2b565000000\\nTime:2017-04-11T18:11:11.0180936Z\"}}}\r\n--changesetresponse_dee290b3-2a8d-457c-9cdf-fae6298ba725--\r\n--batchresponse_96d3b428-9daf-41b4-b4ac-d860a49e8d8f--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_96d3b428-9daf-41b4-b4ac-d860a49e8d8f + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac444-0002-003f-60ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:ei0mh49CqmGLtaxg9XGZQPaQs17FMWuVMepYxvS34I0= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table54tablebatchsuitetestbatchi%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac464-0002-003f-80ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenDeleteDifferentBatches.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenDeleteDifferentBatches.yaml index 9a8a5de557..6f8a07a913 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenDeleteDifferentBatches.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenDeleteDifferentBatches.yaml @@ -1,247 +1,247 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table58tablebatchsuitetestbatchi"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:ZQjoLUu4jawD/lq7c/3xRqALvT8f8g38m4N7oumNERg= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:10:59 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table58tablebatchsuitetestbatchi') - Date: - - Tue, 11 Apr 2017 18:10:59 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table58tablebatchsuitetestbatchi') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - b800ff32-0002-00cb-42ee-b29089000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "--batch_370daf3b-1ee2-11e7-8317-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_370daf3b-1ee2-11e7-8316-6451064d81e8\r\n\r\n\r\n--changeset_370daf3b-1ee2-11e7-8316-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_370daf3b-1ee2-11e7-8316-6451064d81e8--\r\n\r\n--batch_370daf3b-1ee2-11e7-8317-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:gTrel6MHrzDhnjAXvMxeSo+kteLobWHWbyZT4p1DoEg= - Content-Type: - - multipart/mixed; boundary=batch_370daf3b-1ee2-11e7-8317-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:10:59 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_36b3f5cf-db00-43ec-9831-87f61fc944a6\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_fed881dc-a747-4d56-b60d-c8d6763d1262\r\n\r\n--changesetresponse_fed881dc-a747-4d56-b60d-c8d6763d1262\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No - Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: - return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A10%3A59.8211935Z'\"\r\n\r\n\r\n--changesetresponse_fed881dc-a747-4d56-b60d-c8d6763d1262--\r\n--batchresponse_36b3f5cf-db00-43ec-9831-87f61fc944a6--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_36b3f5cf-db00-43ec-9831-87f61fc944a6 - Date: - - Tue, 11 Apr 2017 18:10:59 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - b800ff5b-0002-00cb-69ee-b29089000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:3H/253yNS75pLlEe3et1OQDloOOhxRzKwaXbmoQMr70= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:10:59 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi?%24top=2&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table58tablebatchsuitetestbatchi","value":[{"odata.type":"golangrocksonazure.table58tablebatchsuitetestbatchi","odata.id":"https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-11T18%3A10%3A59.8211935Z''\"","odata.editLink":"table58tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:10:59.8211935Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Tue, 11 Apr 2017 18:10:59 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - b800ff7f-0002-00cb-0cee-b29089000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "--batch_372510dc-1ee2-11e7-8318-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_372510dc-1ee2-11e7-8317-6451064d81e8\r\n\r\n\r\n--changeset_372510dc-1ee2-11e7-8317-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nDELETE https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nIf-Match: *\r\nPrefer: return-no-content\r\n\r\n\r\n--changeset_372510dc-1ee2-11e7-8317-6451064d81e8--\r\n\r\n--batch_372510dc-1ee2-11e7-8318-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:N6gOtxf+slIZfj5WjvFlcvuzTzWaEcPLF7Z4pcDhnz8= - Content-Type: - - multipart/mixed; boundary=batch_372510dc-1ee2-11e7-8318-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:10:59 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_116ab46a-7032-4c60-9147-9909a6e7952a\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_2e8ecc3d-ff43-408c-9f0d-decb9e160bf0\r\n\r\n--changesetresponse_2e8ecc3d-ff43-408c-9f0d-decb9e160bf0\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No - Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nDataServiceVersion: - 1.0;\r\n\r\n\r\n--changesetresponse_2e8ecc3d-ff43-408c-9f0d-decb9e160bf0--\r\n--batchresponse_116ab46a-7032-4c60-9147-9909a6e7952a--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_116ab46a-7032-4c60-9147-9909a6e7952a - Date: - - Tue, 11 Apr 2017 18:10:59 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - b800ff98-0002-00cb-24ee-b29089000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:3H/253yNS75pLlEe3et1OQDloOOhxRzKwaXbmoQMr70= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:10:59 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi?%24top=2&timeout=15 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table58tablebatchsuitetestbatchi","value":[]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Tue, 11 Apr 2017 18:10:59 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - b800ffad-0002-00cb-39ee-b29089000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:TlhMcLi8twonEpG/QCzz7vy3UsbnLLi+1DaGb/aC6sc= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:10:59 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table58tablebatchsuitetestbatchi%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Tue, 11 Apr 2017 18:10:59 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - b800ffbe-0002-00cb-4aee-b29089000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table58tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:ZQjoLUu4jawD/lq7c/3xRqALvT8f8g38m4N7oumNERg= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:10:59 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table58tablebatchsuitetestbatchi') + Date: + - Tue, 11 Apr 2017 18:10:59 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table58tablebatchsuitetestbatchi') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b800ff32-0002-00cb-42ee-b29089000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_370daf3b-1ee2-11e7-8317-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_370daf3b-1ee2-11e7-8316-6451064d81e8\r\n\r\n\r\n--changeset_370daf3b-1ee2-11e7-8316-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_370daf3b-1ee2-11e7-8316-6451064d81e8--\r\n\r\n--batch_370daf3b-1ee2-11e7-8317-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:gTrel6MHrzDhnjAXvMxeSo+kteLobWHWbyZT4p1DoEg= + Content-Type: + - multipart/mixed; boundary=batch_370daf3b-1ee2-11e7-8317-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:10:59 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_36b3f5cf-db00-43ec-9831-87f61fc944a6\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_fed881dc-a747-4d56-b60d-c8d6763d1262\r\n\r\n--changesetresponse_fed881dc-a747-4d56-b60d-c8d6763d1262\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No + Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: + return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A10%3A59.8211935Z'\"\r\n\r\n\r\n--changesetresponse_fed881dc-a747-4d56-b60d-c8d6763d1262--\r\n--batchresponse_36b3f5cf-db00-43ec-9831-87f61fc944a6--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_36b3f5cf-db00-43ec-9831-87f61fc944a6 + Date: + - Tue, 11 Apr 2017 18:10:59 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b800ff5b-0002-00cb-69ee-b29089000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:3H/253yNS75pLlEe3et1OQDloOOhxRzKwaXbmoQMr70= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:10:59 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi?%24top=2&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table58tablebatchsuitetestbatchi","value":[{"odata.type":"golangrocksonazure.table58tablebatchsuitetestbatchi","odata.id":"https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-11T18%3A10%3A59.8211935Z''\"","odata.editLink":"table58tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:10:59.8211935Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","IsActive":true,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 11 Apr 2017 18:10:59 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b800ff7f-0002-00cb-0cee-b29089000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "--batch_372510dc-1ee2-11e7-8318-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_372510dc-1ee2-11e7-8317-6451064d81e8\r\n\r\n\r\n--changeset_372510dc-1ee2-11e7-8317-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nDELETE https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nIf-Match: *\r\nPrefer: return-no-content\r\n\r\n\r\n--changeset_372510dc-1ee2-11e7-8317-6451064d81e8--\r\n\r\n--batch_372510dc-1ee2-11e7-8318-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:N6gOtxf+slIZfj5WjvFlcvuzTzWaEcPLF7Z4pcDhnz8= + Content-Type: + - multipart/mixed; boundary=batch_372510dc-1ee2-11e7-8318-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:10:59 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_116ab46a-7032-4c60-9147-9909a6e7952a\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_2e8ecc3d-ff43-408c-9f0d-decb9e160bf0\r\n\r\n--changesetresponse_2e8ecc3d-ff43-408c-9f0d-decb9e160bf0\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No + Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nDataServiceVersion: + 1.0;\r\n\r\n\r\n--changesetresponse_2e8ecc3d-ff43-408c-9f0d-decb9e160bf0--\r\n--batchresponse_116ab46a-7032-4c60-9147-9909a6e7952a--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_116ab46a-7032-4c60-9147-9909a6e7952a + Date: + - Tue, 11 Apr 2017 18:10:59 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b800ff98-0002-00cb-24ee-b29089000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:3H/253yNS75pLlEe3et1OQDloOOhxRzKwaXbmoQMr70= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:10:59 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table58tablebatchsuitetestbatchi?%24top=2&timeout=15 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table58tablebatchsuitetestbatchi","value":[]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 11 Apr 2017 18:10:59 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b800ffad-0002-00cb-39ee-b29089000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:TlhMcLi8twonEpG/QCzz7vy3UsbnLLi+1DaGb/aC6sc= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:10:59 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table58tablebatchsuitetestbatchi%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 11 Apr 2017 18:10:59 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - b800ffbe-0002-00cb-4aee-b29089000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenMergeDifferentBatches.yaml b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenMergeDifferentBatches.yaml index 3570d972f2..8290128a3e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenMergeDifferentBatches.yaml +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/recordings/TableBatchSuite/Test_BatchInsertThenMergeDifferentBatches.yaml @@ -1,212 +1,212 @@ ---- -version: 1 -rwmutex: {} -interactions: -- request: - body: | - {"TableName":"table57tablebatchsuitetestbatchi"} - form: {} - headers: - Accept: - - application/json;odata=nometadata - Accept-Charset: - - UTF-8 - Authorization: - - SharedKey golangrocksonazure:1t2kY6E0PFMc1W+posaBaQmjBq5FxR+gI/5VXQMEUEo= - Content-Length: - - "49" - Content-Type: - - application/json - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 - method: POST - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Dataserviceid: - - https://golangrocksonazure.table.core.windows.net/Tables('table57tablebatchsuitetestbatchi') - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Location: - - https://golangrocksonazure.table.core.windows.net/Tables('table57tablebatchsuitetestbatchi') - Preference-Applied: - - return-no-content - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac490-0002-003f-2cee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 -- request: - body: "--batch_3e004b55-1ee2-11e7-b454-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_3e004b55-1ee2-11e7-b453-6451064d81e8\r\n\r\n\r\n--changeset_3e004b55-1ee2-11e7-b453-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3e004b55-1ee2-11e7-b453-6451064d81e8--\r\n\r\n--batch_3e004b55-1ee2-11e7-b454-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:MNYkaMVXUmwr78A4rKs6MJvi/scN2r6+JhTAA1KPZjw= - Content-Type: - - multipart/mixed; boundary=batch_3e004b55-1ee2-11e7-b454-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:10 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_dba5b2db-650e-48c5-b5b9-a3770097be23\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_9787c335-dd9c-49b5-9a1b-8ea7983786d9\r\n\r\n--changesetresponse_9787c335-dd9c-49b5-9a1b-8ea7983786d9\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No - Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: - return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.4273629Z'\"\r\n\r\n\r\n--changesetresponse_9787c335-dd9c-49b5-9a1b-8ea7983786d9--\r\n--batchresponse_dba5b2db-650e-48c5-b5b9-a3770097be23--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_dba5b2db-650e-48c5-b5b9-a3770097be23 - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac4a3-0002-003f-3eee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "--batch_3e085bac-1ee2-11e7-b455-6451064d81e8\r\nContent-Type: multipart/mixed; - boundary=changeset_3e085bac-1ee2-11e7-b454-6451064d81e8\r\n\r\n\r\n--changeset_3e085bac-1ee2-11e7-b454-6451064d81e8\r\nContent-Transfer-Encoding: - binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 - HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: - application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"DifferentField\":123,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3e085bac-1ee2-11e7-b454-6451064d81e8--\r\n\r\n--batch_3e085bac-1ee2-11e7-b455-6451064d81e8--\r\n" - form: {} - headers: - Authorization: - - SharedKey golangrocksonazure:X19NrQ82k2XSNtPA3NIJJvIC+QoZLxhxBBYslyYLUnQ= - Content-Type: - - multipart/mixed; boundary=batch_3e085bac-1ee2-11e7-b455-6451064d81e8 - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/$batch - method: POST - response: - body: "--batchresponse_7a3cefa7-bd6f-4ca0-81c1-69bae992a821\r\nContent-Type: multipart/mixed; - boundary=changesetresponse_0ce041c5-c9ca-4cf9-886e-44542e81235d\r\n\r\n--changesetresponse_0ce041c5-c9ca-4cf9-886e-44542e81235d\r\nContent-Type: - application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No - Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: - return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.476397Z'\"\r\n\r\n\r\n--changesetresponse_0ce041c5-c9ca-4cf9-886e-44542e81235d--\r\n--batchresponse_7a3cefa7-bd6f-4ca0-81c1-69bae992a821--\r\n" - headers: - Cache-Control: - - no-cache - Content-Type: - - multipart/mixed; boundary=batchresponse_7a3cefa7-bd6f-4ca0-81c1-69bae992a821 - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac4be-0002-003f-59ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 202 Accepted - code: 202 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=fullmetadata - Authorization: - - SharedKey golangrocksonazure:fVYsV74PwOzoaxoWf4Z8Gm0hcROYbMQp7/g26UW/nls= - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi?%24top=2&timeout=30 - method: GET - response: - body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table57tablebatchsuitetestbatchi","value":[{"odata.type":"golangrocksonazure.table57tablebatchsuitetestbatchi","odata.id":"https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-11T18%3A11%3A11.476397Z''\"","odata.editLink":"table57tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:11:11.476397Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","DifferentField":123,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}]}' - headers: - Cache-Control: - - no-cache - Content-Type: - - application/json;odata=fullmetadata;streaming=true;charset=utf-8 - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac4db-0002-003f-74ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 200 OK - code: 200 -- request: - body: "" - form: {} - headers: - Accept: - - application/json;odata=nometadata - Authorization: - - SharedKey golangrocksonazure:ReX2dTRJLE2TBb/qmswmRFOPQjkv4otu9COqHtNUrvE= - Prefer: - - return-no-content - User-Agent: - - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table - X-Ms-Date: - - Tue, 11 Apr 2017 18:11:11 GMT - X-Ms-Version: - - 2016-05-31 - url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table57tablebatchsuitetestbatchi%27%29?timeout=30 - method: DELETE - response: - body: "" - headers: - Cache-Control: - - no-cache - Content-Length: - - "0" - Date: - - Tue, 11 Apr 2017 18:11:10 GMT - Server: - - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 - X-Content-Type-Options: - - nosniff - X-Ms-Request-Id: - - 532ac4ef-0002-003f-08ee-b2b565000000 - X-Ms-Version: - - 2016-05-31 - status: 204 No Content - code: 204 +--- +version: 1 +rwmutex: {} +interactions: +- request: + body: | + {"TableName":"table57tablebatchsuitetestbatchi"} + form: {} + headers: + Accept: + - application/json;odata=nometadata + Accept-Charset: + - UTF-8 + Authorization: + - SharedKey golangrocksonazure:1t2kY6E0PFMc1W+posaBaQmjBq5FxR+gI/5VXQMEUEo= + Content-Length: + - "49" + Content-Type: + - application/json + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables?timeout=30 + method: POST + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Dataserviceid: + - https://golangrocksonazure.table.core.windows.net/Tables('table57tablebatchsuitetestbatchi') + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Location: + - https://golangrocksonazure.table.core.windows.net/Tables('table57tablebatchsuitetestbatchi') + Preference-Applied: + - return-no-content + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac490-0002-003f-2cee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 +- request: + body: "--batch_3e004b55-1ee2-11e7-b454-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_3e004b55-1ee2-11e7-b453-6451064d81e8\r\n\r\n\r\n--changeset_3e004b55-1ee2-11e7-b453-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"IsActive\":true,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3e004b55-1ee2-11e7-b453-6451064d81e8--\r\n\r\n--batch_3e004b55-1ee2-11e7-b454-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:MNYkaMVXUmwr78A4rKs6MJvi/scN2r6+JhTAA1KPZjw= + Content-Type: + - multipart/mixed; boundary=batch_3e004b55-1ee2-11e7-b454-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:10 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_dba5b2db-650e-48c5-b5b9-a3770097be23\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_9787c335-dd9c-49b5-9a1b-8ea7983786d9\r\n\r\n--changesetresponse_9787c335-dd9c-49b5-9a1b-8ea7983786d9\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No + Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: + return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.4273629Z'\"\r\n\r\n\r\n--changesetresponse_9787c335-dd9c-49b5-9a1b-8ea7983786d9--\r\n--batchresponse_dba5b2db-650e-48c5-b5b9-a3770097be23--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_dba5b2db-650e-48c5-b5b9-a3770097be23 + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac4a3-0002-003f-3eee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "--batch_3e085bac-1ee2-11e7-b455-6451064d81e8\r\nContent-Type: multipart/mixed; + boundary=changeset_3e085bac-1ee2-11e7-b454-6451064d81e8\r\n\r\n\r\n--changeset_3e085bac-1ee2-11e7-b454-6451064d81e8\r\nContent-Transfer-Encoding: + binary\r\nContent-Type: application/http\r\n\r\nPUT https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi%28PartitionKey=%27mypartitionkey%27,%20RowKey=%27myrowkey%27%29 + HTTP/1.1\r\nAccept: application/json;odata=minimalmetadata\r\nContent-Type: + application/json\r\nPrefer: return-no-content\r\n\r\n{\"AmountDue\":200.23,\"CustomerCode\":\"c9da6455-213d-42c9-9a79-3e9149a57833\",\"CustomerCode@odata.type\":\"Edm.Guid\",\"CustomerSince\":\"1992-12-20T21:55:00Z\",\"CustomerSince@odata.type\":\"Edm.DateTime\",\"DifferentField\":123,\"NumberOfOrders\":\"255\",\"NumberOfOrders@odata.type\":\"Edm.Int64\",\"PartitionKey\":\"mypartitionkey\",\"RowKey\":\"myrowkey\"}\r\n--changeset_3e085bac-1ee2-11e7-b454-6451064d81e8--\r\n\r\n--batch_3e085bac-1ee2-11e7-b455-6451064d81e8--\r\n" + form: {} + headers: + Authorization: + - SharedKey golangrocksonazure:X19NrQ82k2XSNtPA3NIJJvIC+QoZLxhxBBYslyYLUnQ= + Content-Type: + - multipart/mixed; boundary=batch_3e085bac-1ee2-11e7-b455-6451064d81e8 + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/$batch + method: POST + response: + body: "--batchresponse_7a3cefa7-bd6f-4ca0-81c1-69bae992a821\r\nContent-Type: multipart/mixed; + boundary=changesetresponse_0ce041c5-c9ca-4cf9-886e-44542e81235d\r\n\r\n--changesetresponse_0ce041c5-c9ca-4cf9-886e-44542e81235d\r\nContent-Type: + application/http\r\nContent-Transfer-Encoding: binary\r\n\r\nHTTP/1.1 204 No + Content\r\nX-Content-Type-Options: nosniff\r\nCache-Control: no-cache\r\nPreference-Applied: + return-no-content\r\nDataServiceVersion: 3.0;\r\nETag: W/\"datetime'2017-04-11T18%3A11%3A11.476397Z'\"\r\n\r\n\r\n--changesetresponse_0ce041c5-c9ca-4cf9-886e-44542e81235d--\r\n--batchresponse_7a3cefa7-bd6f-4ca0-81c1-69bae992a821--\r\n" + headers: + Cache-Control: + - no-cache + Content-Type: + - multipart/mixed; boundary=batchresponse_7a3cefa7-bd6f-4ca0-81c1-69bae992a821 + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac4be-0002-003f-59ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 202 Accepted + code: 202 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=fullmetadata + Authorization: + - SharedKey golangrocksonazure:fVYsV74PwOzoaxoWf4Z8Gm0hcROYbMQp7/g26UW/nls= + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi?%24top=2&timeout=30 + method: GET + response: + body: '{"odata.metadata":"https://golangrocksonazure.table.core.windows.net/$metadata#table57tablebatchsuitetestbatchi","value":[{"odata.type":"golangrocksonazure.table57tablebatchsuitetestbatchi","odata.id":"https://golangrocksonazure.table.core.windows.net/table57tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","odata.etag":"W/\"datetime''2017-04-11T18%3A11%3A11.476397Z''\"","odata.editLink":"table57tablebatchsuitetestbatchi(PartitionKey=''mypartitionkey'',RowKey=''myrowkey'')","PartitionKey":"mypartitionkey","RowKey":"myrowkey","Timestamp@odata.type":"Edm.DateTime","Timestamp":"2017-04-11T18:11:11.476397Z","AmountDue":200.23,"CustomerCode@odata.type":"Edm.Guid","CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833","CustomerSince@odata.type":"Edm.DateTime","CustomerSince":"1992-12-20T21:55:00Z","DifferentField":123,"NumberOfOrders@odata.type":"Edm.Int64","NumberOfOrders":"255"}]}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json;odata=fullmetadata;streaming=true;charset=utf-8 + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac4db-0002-003f-74ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 200 OK + code: 200 +- request: + body: "" + form: {} + headers: + Accept: + - application/json;odata=nometadata + Authorization: + - SharedKey golangrocksonazure:ReX2dTRJLE2TBb/qmswmRFOPQjkv4otu9COqHtNUrvE= + Prefer: + - return-no-content + User-Agent: + - Go/go1.8 (amd64-windows) azure-storage-go/0.1.0 api-version/2016-05-31 table + X-Ms-Date: + - Tue, 11 Apr 2017 18:11:11 GMT + X-Ms-Version: + - 2016-05-31 + url: https://golangrocksonazure.table.core.windows.net/Tables%28%27table57tablebatchsuitetestbatchi%27%29?timeout=30 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Date: + - Tue, 11 Apr 2017 18:11:10 GMT + Server: + - Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0 + X-Content-Type-Options: + - nosniff + X-Ms-Request-Id: + - 532ac4ef-0002-003f-08ee-b2b565000000 + X-Ms-Version: + - 2016-05-31 + status: 204 No Content + code: 204 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go index 02062785f2..e6a868081a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go @@ -1,202 +1,202 @@ -package storage - -import ( - "fmt" - "net/http" - "net/url" - "strconv" -) - -// Share represents an Azure file share. -type Share struct { - fsc *FileServiceClient - Name string `xml:"Name"` - Properties ShareProperties `xml:"Properties"` - Metadata map[string]string -} - -// ShareProperties contains various properties of a share. -type ShareProperties struct { - LastModified string `xml:"Last-Modified"` - Etag string `xml:"Etag"` - Quota int `xml:"Quota"` -} - -// builds the complete path for this share object. -func (s *Share) buildPath() string { - return fmt.Sprintf("/%s", s.Name) -} - -// Create this share under the associated account. -// If a share with the same name already exists, the operation fails. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share -func (s *Share) Create(options *FileRequestOptions) error { - extraheaders := map[string]string{} - if s.Properties.Quota > 0 { - extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota) - } - - params := prepareOptions(options) - headers, err := s.fsc.createResource(s.buildPath(), resourceShare, params, mergeMDIntoExtraHeaders(s.Metadata, extraheaders), []int{http.StatusCreated}) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - return nil -} - -// CreateIfNotExists creates this share under the associated account if -// it does not exist. Returns true if the share is newly created or false if -// the share already exists. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share -func (s *Share) CreateIfNotExists(options *FileRequestOptions) (bool, error) { - extraheaders := map[string]string{} - if s.Properties.Quota > 0 { - extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota) - } - - params := prepareOptions(options) - resp, err := s.fsc.createResourceNoClose(s.buildPath(), resourceShare, params, extraheaders) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { - if resp.statusCode == http.StatusCreated { - s.updateEtagAndLastModified(resp.headers) - return true, nil - } - return false, s.FetchAttributes(nil) - } - } - - return false, err -} - -// Delete marks this share for deletion. The share along with any files -// and directories contained within it are later deleted during garbage -// collection. If the share does not exist the operation fails -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share -func (s *Share) Delete(options *FileRequestOptions) error { - return s.fsc.deleteResource(s.buildPath(), resourceShare, options) -} - -// DeleteIfExists operation marks this share for deletion if it exists. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share -func (s *Share) DeleteIfExists(options *FileRequestOptions) (bool, error) { - resp, err := s.fsc.deleteResourceNoClose(s.buildPath(), resourceShare, options) - if resp != nil { - defer readAndCloseBody(resp.body) - if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { - return resp.statusCode == http.StatusAccepted, nil - } - } - return false, err -} - -// Exists returns true if this share already exists -// on the storage account, otherwise returns false. -func (s *Share) Exists() (bool, error) { - exists, headers, err := s.fsc.resourceExists(s.buildPath(), resourceShare) - if exists { - s.updateEtagAndLastModified(headers) - s.updateQuota(headers) - } - return exists, err -} - -// FetchAttributes retrieves metadata and properties for this share. -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-share-properties -func (s *Share) FetchAttributes(options *FileRequestOptions) error { - params := prepareOptions(options) - headers, err := s.fsc.getResourceHeaders(s.buildPath(), compNone, resourceShare, params, http.MethodHead) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - s.updateQuota(headers) - s.Metadata = getMetadataFromHeaders(headers) - - return nil -} - -// GetRootDirectoryReference returns a Directory object at the root of this share. -func (s *Share) GetRootDirectoryReference() *Directory { - return &Directory{ - fsc: s.fsc, - share: s, - } -} - -// ServiceClient returns the FileServiceClient associated with this share. -func (s *Share) ServiceClient() *FileServiceClient { - return s.fsc -} - -// SetMetadata replaces the metadata for this share. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by GetShareMetadata. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-share-metadata -func (s *Share) SetMetadata(options *FileRequestOptions) error { - headers, err := s.fsc.setResourceHeaders(s.buildPath(), compMetadata, resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil), options) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - return nil -} - -// SetProperties sets system properties for this share. -// -// Some keys may be converted to Camel-Case before sending. All keys -// are returned in lower case by SetShareProperties. HTTP header names -// are case-insensitive so case munging should not matter to other -// applications either. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Share-Properties -func (s *Share) SetProperties(options *FileRequestOptions) error { - extraheaders := map[string]string{} - if s.Properties.Quota > 0 { - if s.Properties.Quota > 5120 { - return fmt.Errorf("invalid value %v for quota, valid values are [1, 5120]", s.Properties.Quota) - } - extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota) - } - - headers, err := s.fsc.setResourceHeaders(s.buildPath(), compProperties, resourceShare, extraheaders, options) - if err != nil { - return err - } - - s.updateEtagAndLastModified(headers) - return nil -} - -// updates Etag and last modified date -func (s *Share) updateEtagAndLastModified(headers http.Header) { - s.Properties.Etag = headers.Get("Etag") - s.Properties.LastModified = headers.Get("Last-Modified") -} - -// updates quota value -func (s *Share) updateQuota(headers http.Header) { - quota, err := strconv.Atoi(headers.Get("x-ms-share-quota")) - if err == nil { - s.Properties.Quota = quota - } -} - -// URL gets the canonical URL to this share. This method does not create a publicly accessible -// URL if the share is private and this method does not check if the share exists. -func (s *Share) URL() string { - return s.fsc.client.getEndpoint(fileServiceName, s.buildPath(), url.Values{}) -} +package storage + +import ( + "fmt" + "net/http" + "net/url" + "strconv" +) + +// Share represents an Azure file share. +type Share struct { + fsc *FileServiceClient + Name string `xml:"Name"` + Properties ShareProperties `xml:"Properties"` + Metadata map[string]string +} + +// ShareProperties contains various properties of a share. +type ShareProperties struct { + LastModified string `xml:"Last-Modified"` + Etag string `xml:"Etag"` + Quota int `xml:"Quota"` +} + +// builds the complete path for this share object. +func (s *Share) buildPath() string { + return fmt.Sprintf("/%s", s.Name) +} + +// Create this share under the associated account. +// If a share with the same name already exists, the operation fails. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share +func (s *Share) Create(options *FileRequestOptions) error { + extraheaders := map[string]string{} + if s.Properties.Quota > 0 { + extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota) + } + + params := prepareOptions(options) + headers, err := s.fsc.createResource(s.buildPath(), resourceShare, params, mergeMDIntoExtraHeaders(s.Metadata, extraheaders), []int{http.StatusCreated}) + if err != nil { + return err + } + + s.updateEtagAndLastModified(headers) + return nil +} + +// CreateIfNotExists creates this share under the associated account if +// it does not exist. Returns true if the share is newly created or false if +// the share already exists. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share +func (s *Share) CreateIfNotExists(options *FileRequestOptions) (bool, error) { + extraheaders := map[string]string{} + if s.Properties.Quota > 0 { + extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota) + } + + params := prepareOptions(options) + resp, err := s.fsc.createResourceNoClose(s.buildPath(), resourceShare, params, extraheaders) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict { + if resp.statusCode == http.StatusCreated { + s.updateEtagAndLastModified(resp.headers) + return true, nil + } + return false, s.FetchAttributes(nil) + } + } + + return false, err +} + +// Delete marks this share for deletion. The share along with any files +// and directories contained within it are later deleted during garbage +// collection. If the share does not exist the operation fails +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share +func (s *Share) Delete(options *FileRequestOptions) error { + return s.fsc.deleteResource(s.buildPath(), resourceShare, options) +} + +// DeleteIfExists operation marks this share for deletion if it exists. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share +func (s *Share) DeleteIfExists(options *FileRequestOptions) (bool, error) { + resp, err := s.fsc.deleteResourceNoClose(s.buildPath(), resourceShare, options) + if resp != nil { + defer readAndCloseBody(resp.body) + if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound { + return resp.statusCode == http.StatusAccepted, nil + } + } + return false, err +} + +// Exists returns true if this share already exists +// on the storage account, otherwise returns false. +func (s *Share) Exists() (bool, error) { + exists, headers, err := s.fsc.resourceExists(s.buildPath(), resourceShare) + if exists { + s.updateEtagAndLastModified(headers) + s.updateQuota(headers) + } + return exists, err +} + +// FetchAttributes retrieves metadata and properties for this share. +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-share-properties +func (s *Share) FetchAttributes(options *FileRequestOptions) error { + params := prepareOptions(options) + headers, err := s.fsc.getResourceHeaders(s.buildPath(), compNone, resourceShare, params, http.MethodHead) + if err != nil { + return err + } + + s.updateEtagAndLastModified(headers) + s.updateQuota(headers) + s.Metadata = getMetadataFromHeaders(headers) + + return nil +} + +// GetRootDirectoryReference returns a Directory object at the root of this share. +func (s *Share) GetRootDirectoryReference() *Directory { + return &Directory{ + fsc: s.fsc, + share: s, + } +} + +// ServiceClient returns the FileServiceClient associated with this share. +func (s *Share) ServiceClient() *FileServiceClient { + return s.fsc +} + +// SetMetadata replaces the metadata for this share. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by GetShareMetadata. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-share-metadata +func (s *Share) SetMetadata(options *FileRequestOptions) error { + headers, err := s.fsc.setResourceHeaders(s.buildPath(), compMetadata, resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil), options) + if err != nil { + return err + } + + s.updateEtagAndLastModified(headers) + return nil +} + +// SetProperties sets system properties for this share. +// +// Some keys may be converted to Camel-Case before sending. All keys +// are returned in lower case by SetShareProperties. HTTP header names +// are case-insensitive so case munging should not matter to other +// applications either. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Share-Properties +func (s *Share) SetProperties(options *FileRequestOptions) error { + extraheaders := map[string]string{} + if s.Properties.Quota > 0 { + if s.Properties.Quota > 5120 { + return fmt.Errorf("invalid value %v for quota, valid values are [1, 5120]", s.Properties.Quota) + } + extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota) + } + + headers, err := s.fsc.setResourceHeaders(s.buildPath(), compProperties, resourceShare, extraheaders, options) + if err != nil { + return err + } + + s.updateEtagAndLastModified(headers) + return nil +} + +// updates Etag and last modified date +func (s *Share) updateEtagAndLastModified(headers http.Header) { + s.Properties.Etag = headers.Get("Etag") + s.Properties.LastModified = headers.Get("Last-Modified") +} + +// updates quota value +func (s *Share) updateQuota(headers http.Header) { + quota, err := strconv.Atoi(headers.Get("x-ms-share-quota")) + if err == nil { + s.Properties.Quota = quota + } +} + +// URL gets the canonical URL to this share. This method does not create a publicly accessible +// URL if the share is private and this method does not check if the share exists. +func (s *Share) URL() string { + return s.fsc.client.getEndpoint(fileServiceName, s.buildPath(), url.Values{}) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/share_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/share_test.go index ace9c024d0..2e207bdc9d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/share_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/share_test.go @@ -1,207 +1,207 @@ -package storage - -import chk "gopkg.in/check.v1" - -type StorageShareSuite struct{} - -var _ = chk.Suite(&StorageShareSuite{}) - -func getFileClient(c *chk.C) FileServiceClient { - return getBasicClient(c).GetFileService() -} - -func (s *StorageShareSuite) TestCreateShareDeleteShare(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - share := cli.GetShareReference(shareName(c)) - c.Assert(share.Create(nil), chk.IsNil) - c.Assert(share.Delete(nil), chk.IsNil) -} - -func (s *StorageShareSuite) TestCreateShareIfNotExists(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // Create non existing - share := cli.GetShareReference(shareName(c, "notexists")) - ok, err := share.CreateIfNotExists(nil) - defer share.Delete(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) - -} - -func (s *StorageShareSuite) TestCreateShareIfExists(c *chk.C) { - cli := getFileClient(c) - share := cli.GetShareReference(shareName(c, "exists")) - share.Create(nil) - defer share.Delete(nil) - - rec := cli.client.appendRecorder(c) - share.fsc = &cli - defer rec.Stop() - - // Try to create exisiting - ok, err := share.CreateIfNotExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) -} - -func (s *StorageShareSuite) TestDeleteShareIfNotExists(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // delete non-existing share - share1 := cli.GetShareReference(shareName(c, "1")) - ok, err := share1.DeleteIfExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // delete existing share - share2 := cli.GetShareReference(shareName(c, "2")) - c.Assert(share2.Create(nil), chk.IsNil) - ok, err = share2.DeleteIfExists(nil) - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageShareSuite) TestListShares(c *chk.C) { - cli := getFileClient(c) - cli.deleteAllShares() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - name := shareName(c) - share := cli.GetShareReference(name) - - c.Assert(share.Create(nil), chk.IsNil) - - resp, err := cli.ListShares(ListSharesParameters{ - MaxResults: 5, - }) - c.Assert(err, chk.IsNil) - - c.Check(len(resp.Shares), chk.Equals, 1) - c.Check(resp.Shares[0].Name, chk.Equals, name) - - // clean up via the retrieved share object - resp.Shares[0].Delete(nil) -} - -func (s *StorageShareSuite) TestShareExists(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - // Share does not exist - share1 := cli.GetShareReference(shareName(c, "1")) - ok, err := share1.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, false) - - // Share exists - share2 := cli.GetShareReference(shareName(c, "2")) - c.Assert(share2.Create(nil), chk.IsNil) - defer share1.Delete(nil) - ok, err = share2.Exists() - c.Assert(err, chk.IsNil) - c.Assert(ok, chk.Equals, true) -} - -func (s *StorageShareSuite) TestGetAndSetShareProperties(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - share := cli.GetShareReference(shareName(c)) - quota := 55 - - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - c.Assert(share.Properties.LastModified, chk.Not(chk.Equals), "") - - share.Properties.Quota = quota - err := share.SetProperties(nil) - c.Assert(err, chk.IsNil) - - err = share.FetchAttributes(nil) - c.Assert(err, chk.IsNil) - - c.Assert(share.Properties.Quota, chk.Equals, quota) -} - -func (s *StorageShareSuite) TestGetAndSetShareMetadata(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - share1 := cli.GetShareReference(shareName(c, "1")) - - c.Assert(share1.Create(nil), chk.IsNil) - defer share1.Delete(nil) - - // by default there should be no metadata - c.Assert(share1.Metadata, chk.IsNil) - c.Assert(share1.FetchAttributes(nil), chk.IsNil) - c.Assert(share1.Metadata, chk.IsNil) - - share2 := cli.GetShareReference(shareName(c, "2")) - c.Assert(share2.Create(nil), chk.IsNil) - defer share2.Delete(nil) - - c.Assert(share2.Metadata, chk.IsNil) - - mPut := map[string]string{ - "lol": "rofl", - "rofl_baz": "waz qux", - } - - share2.Metadata = mPut - c.Assert(share2.SetMetadata(nil), chk.IsNil) - c.Check(share2.Metadata, chk.DeepEquals, mPut) - - c.Assert(share2.FetchAttributes(nil), chk.IsNil) - c.Check(share2.Metadata, chk.DeepEquals, mPut) -} - -func (s *StorageShareSuite) TestMetadataCaseMunging(c *chk.C) { - cli := getFileClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - share := cli.GetShareReference(shareName(c)) - - c.Assert(share.Create(nil), chk.IsNil) - defer share.Delete(nil) - - mPutUpper := map[string]string{ - "Lol": "different rofl", - "rofl_BAZ": "different waz qux", - } - mExpectLower := map[string]string{ - "lol": "different rofl", - "rofl_baz": "different waz qux", - } - - share.Metadata = mPutUpper - c.Assert(share.SetMetadata(nil), chk.IsNil) - - c.Check(share.Metadata, chk.DeepEquals, mPutUpper) - c.Assert(share.FetchAttributes(nil), chk.IsNil) - c.Check(share.Metadata, chk.DeepEquals, mExpectLower) -} - -func (cli *FileServiceClient) deleteAllShares() { - resp, _ := cli.ListShares(ListSharesParameters{}) - if resp != nil && len(resp.Shares) > 0 { - for _, sh := range resp.Shares { - share := cli.GetShareReference(sh.Name) - share.Delete(nil) - } - } -} - -func shareName(c *chk.C, extras ...string) string { - return nameGenerator(63, "share-", alphanum, c, extras) -} +package storage + +import chk "gopkg.in/check.v1" + +type StorageShareSuite struct{} + +var _ = chk.Suite(&StorageShareSuite{}) + +func getFileClient(c *chk.C) FileServiceClient { + return getBasicClient(c).GetFileService() +} + +func (s *StorageShareSuite) TestCreateShareDeleteShare(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + share := cli.GetShareReference(shareName(c)) + c.Assert(share.Create(nil), chk.IsNil) + c.Assert(share.Delete(nil), chk.IsNil) +} + +func (s *StorageShareSuite) TestCreateShareIfNotExists(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // Create non existing + share := cli.GetShareReference(shareName(c, "notexists")) + ok, err := share.CreateIfNotExists(nil) + defer share.Delete(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) + +} + +func (s *StorageShareSuite) TestCreateShareIfExists(c *chk.C) { + cli := getFileClient(c) + share := cli.GetShareReference(shareName(c, "exists")) + share.Create(nil) + defer share.Delete(nil) + + rec := cli.client.appendRecorder(c) + share.fsc = &cli + defer rec.Stop() + + // Try to create exisiting + ok, err := share.CreateIfNotExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) +} + +func (s *StorageShareSuite) TestDeleteShareIfNotExists(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // delete non-existing share + share1 := cli.GetShareReference(shareName(c, "1")) + ok, err := share1.DeleteIfExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + + // delete existing share + share2 := cli.GetShareReference(shareName(c, "2")) + c.Assert(share2.Create(nil), chk.IsNil) + ok, err = share2.DeleteIfExists(nil) + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) +} + +func (s *StorageShareSuite) TestListShares(c *chk.C) { + cli := getFileClient(c) + cli.deleteAllShares() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + name := shareName(c) + share := cli.GetShareReference(name) + + c.Assert(share.Create(nil), chk.IsNil) + + resp, err := cli.ListShares(ListSharesParameters{ + MaxResults: 5, + }) + c.Assert(err, chk.IsNil) + + c.Check(len(resp.Shares), chk.Equals, 1) + c.Check(resp.Shares[0].Name, chk.Equals, name) + + // clean up via the retrieved share object + resp.Shares[0].Delete(nil) +} + +func (s *StorageShareSuite) TestShareExists(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + // Share does not exist + share1 := cli.GetShareReference(shareName(c, "1")) + ok, err := share1.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, false) + + // Share exists + share2 := cli.GetShareReference(shareName(c, "2")) + c.Assert(share2.Create(nil), chk.IsNil) + defer share1.Delete(nil) + ok, err = share2.Exists() + c.Assert(err, chk.IsNil) + c.Assert(ok, chk.Equals, true) +} + +func (s *StorageShareSuite) TestGetAndSetShareProperties(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + share := cli.GetShareReference(shareName(c)) + quota := 55 + + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + c.Assert(share.Properties.LastModified, chk.Not(chk.Equals), "") + + share.Properties.Quota = quota + err := share.SetProperties(nil) + c.Assert(err, chk.IsNil) + + err = share.FetchAttributes(nil) + c.Assert(err, chk.IsNil) + + c.Assert(share.Properties.Quota, chk.Equals, quota) +} + +func (s *StorageShareSuite) TestGetAndSetShareMetadata(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + share1 := cli.GetShareReference(shareName(c, "1")) + + c.Assert(share1.Create(nil), chk.IsNil) + defer share1.Delete(nil) + + // by default there should be no metadata + c.Assert(share1.Metadata, chk.IsNil) + c.Assert(share1.FetchAttributes(nil), chk.IsNil) + c.Assert(share1.Metadata, chk.IsNil) + + share2 := cli.GetShareReference(shareName(c, "2")) + c.Assert(share2.Create(nil), chk.IsNil) + defer share2.Delete(nil) + + c.Assert(share2.Metadata, chk.IsNil) + + mPut := map[string]string{ + "lol": "rofl", + "rofl_baz": "waz qux", + } + + share2.Metadata = mPut + c.Assert(share2.SetMetadata(nil), chk.IsNil) + c.Check(share2.Metadata, chk.DeepEquals, mPut) + + c.Assert(share2.FetchAttributes(nil), chk.IsNil) + c.Check(share2.Metadata, chk.DeepEquals, mPut) +} + +func (s *StorageShareSuite) TestMetadataCaseMunging(c *chk.C) { + cli := getFileClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + share := cli.GetShareReference(shareName(c)) + + c.Assert(share.Create(nil), chk.IsNil) + defer share.Delete(nil) + + mPutUpper := map[string]string{ + "Lol": "different rofl", + "rofl_BAZ": "different waz qux", + } + mExpectLower := map[string]string{ + "lol": "different rofl", + "rofl_baz": "different waz qux", + } + + share.Metadata = mPutUpper + c.Assert(share.SetMetadata(nil), chk.IsNil) + + c.Check(share.Metadata, chk.DeepEquals, mPutUpper) + c.Assert(share.FetchAttributes(nil), chk.IsNil) + c.Check(share.Metadata, chk.DeepEquals, mExpectLower) +} + +func (cli *FileServiceClient) deleteAllShares() { + resp, _ := cli.ListShares(ListSharesParameters{}) + if resp != nil && len(resp.Shares) > 0 { + for _, sh := range resp.Shares { + share := cli.GetShareReference(sh.Name) + share.Delete(nil) + } + } +} + +func shareName(c *chk.C, extras ...string) string { + return nameGenerator(63, "share-", alphanum, c, extras) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go index 112fa2a1ab..bee1c31ad6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go @@ -1,47 +1,47 @@ -package storage - -import ( - "strings" - "time" -) - -// AccessPolicyDetailsXML has specifics about an access policy -// annotated with XML details. -type AccessPolicyDetailsXML struct { - StartTime time.Time `xml:"Start"` - ExpiryTime time.Time `xml:"Expiry"` - Permission string `xml:"Permission"` -} - -// SignedIdentifier is a wrapper for a specific policy -type SignedIdentifier struct { - ID string `xml:"Id"` - AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"` -} - -// SignedIdentifiers part of the response from GetPermissions call. -type SignedIdentifiers struct { - SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"` -} - -// AccessPolicy is the response type from the GetPermissions call. -type AccessPolicy struct { - SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"` -} - -// convertAccessPolicyToXMLStructs converts between AccessPolicyDetails which is a struct better for API usage to the -// AccessPolicy struct which will get converted to XML. -func convertAccessPolicyToXMLStructs(id string, startTime time.Time, expiryTime time.Time, permissions string) SignedIdentifier { - return SignedIdentifier{ - ID: id, - AccessPolicy: AccessPolicyDetailsXML{ - StartTime: startTime.UTC().Round(time.Second), - ExpiryTime: expiryTime.UTC().Round(time.Second), - Permission: permissions, - }, - } -} - -func updatePermissions(permissions, permission string) bool { - return strings.Contains(permissions, permission) -} +package storage + +import ( + "strings" + "time" +) + +// AccessPolicyDetailsXML has specifics about an access policy +// annotated with XML details. +type AccessPolicyDetailsXML struct { + StartTime time.Time `xml:"Start"` + ExpiryTime time.Time `xml:"Expiry"` + Permission string `xml:"Permission"` +} + +// SignedIdentifier is a wrapper for a specific policy +type SignedIdentifier struct { + ID string `xml:"Id"` + AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"` +} + +// SignedIdentifiers part of the response from GetPermissions call. +type SignedIdentifiers struct { + SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"` +} + +// AccessPolicy is the response type from the GetPermissions call. +type AccessPolicy struct { + SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"` +} + +// convertAccessPolicyToXMLStructs converts between AccessPolicyDetails which is a struct better for API usage to the +// AccessPolicy struct which will get converted to XML. +func convertAccessPolicyToXMLStructs(id string, startTime time.Time, expiryTime time.Time, permissions string) SignedIdentifier { + return SignedIdentifier{ + ID: id, + AccessPolicy: AccessPolicyDetailsXML{ + StartTime: startTime.UTC().Round(time.Second), + ExpiryTime: expiryTime.UTC().Round(time.Second), + Permission: permissions, + }, + } +} + +func updatePermissions(permissions, permission string) bool { + return strings.Contains(permissions, permission) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go index 01a0df9309..88700fbc93 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go @@ -1,117 +1,117 @@ -package storage - -import ( - "net/http" - "net/url" - "strconv" -) - -// ServiceProperties represents the storage account service properties -type ServiceProperties struct { - Logging *Logging - HourMetrics *Metrics - MinuteMetrics *Metrics - Cors *Cors -} - -// Logging represents the Azure Analytics Logging settings -type Logging struct { - Version string - Delete bool - Read bool - Write bool - RetentionPolicy *RetentionPolicy -} - -// RetentionPolicy indicates if retention is enabled and for how many days -type RetentionPolicy struct { - Enabled bool - Days *int -} - -// Metrics provide request statistics. -type Metrics struct { - Version string - Enabled bool - IncludeAPIs *bool - RetentionPolicy *RetentionPolicy -} - -// Cors includes all the CORS rules -type Cors struct { - CorsRule []CorsRule -} - -// CorsRule includes all settings for a Cors rule -type CorsRule struct { - AllowedOrigins string - AllowedMethods string - MaxAgeInSeconds int - ExposedHeaders string - AllowedHeaders string -} - -func (c Client) getServiceProperties(service string, auth authentication) (*ServiceProperties, error) { - query := url.Values{ - "restype": {"service"}, - "comp": {"properties"}, - } - uri := c.getEndpoint(service, "", query) - headers := c.getStandardHeaders() - - resp, err := c.exec(http.MethodGet, uri, headers, nil, auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - var out ServiceProperties - err = xmlUnmarshal(resp.body, &out) - if err != nil { - return nil, err - } - - return &out, nil -} - -func (c Client) setServiceProperties(props ServiceProperties, service string, auth authentication) error { - query := url.Values{ - "restype": {"service"}, - "comp": {"properties"}, - } - uri := c.getEndpoint(service, "", query) - - // Ideally, StorageServiceProperties would be the output struct - // This is to avoid golint stuttering, while generating the correct XML - type StorageServiceProperties struct { - Logging *Logging - HourMetrics *Metrics - MinuteMetrics *Metrics - Cors *Cors - } - input := StorageServiceProperties{ - Logging: props.Logging, - HourMetrics: props.HourMetrics, - MinuteMetrics: props.MinuteMetrics, - Cors: props.Cors, - } - - body, length, err := xmlMarshal(input) - if err != nil { - return err - } - - headers := c.getStandardHeaders() - headers["Content-Length"] = strconv.Itoa(length) - - resp, err := c.exec(http.MethodPut, uri, headers, body, auth) - if err != nil { - return err - } - readAndCloseBody(resp.body) - return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) -} +package storage + +import ( + "net/http" + "net/url" + "strconv" +) + +// ServiceProperties represents the storage account service properties +type ServiceProperties struct { + Logging *Logging + HourMetrics *Metrics + MinuteMetrics *Metrics + Cors *Cors +} + +// Logging represents the Azure Analytics Logging settings +type Logging struct { + Version string + Delete bool + Read bool + Write bool + RetentionPolicy *RetentionPolicy +} + +// RetentionPolicy indicates if retention is enabled and for how many days +type RetentionPolicy struct { + Enabled bool + Days *int +} + +// Metrics provide request statistics. +type Metrics struct { + Version string + Enabled bool + IncludeAPIs *bool + RetentionPolicy *RetentionPolicy +} + +// Cors includes all the CORS rules +type Cors struct { + CorsRule []CorsRule +} + +// CorsRule includes all settings for a Cors rule +type CorsRule struct { + AllowedOrigins string + AllowedMethods string + MaxAgeInSeconds int + ExposedHeaders string + AllowedHeaders string +} + +func (c Client) getServiceProperties(service string, auth authentication) (*ServiceProperties, error) { + query := url.Values{ + "restype": {"service"}, + "comp": {"properties"}, + } + uri := c.getEndpoint(service, "", query) + headers := c.getStandardHeaders() + + resp, err := c.exec(http.MethodGet, uri, headers, nil, auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + + if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return nil, err + } + + var out ServiceProperties + err = xmlUnmarshal(resp.body, &out) + if err != nil { + return nil, err + } + + return &out, nil +} + +func (c Client) setServiceProperties(props ServiceProperties, service string, auth authentication) error { + query := url.Values{ + "restype": {"service"}, + "comp": {"properties"}, + } + uri := c.getEndpoint(service, "", query) + + // Ideally, StorageServiceProperties would be the output struct + // This is to avoid golint stuttering, while generating the correct XML + type StorageServiceProperties struct { + Logging *Logging + HourMetrics *Metrics + MinuteMetrics *Metrics + Cors *Cors + } + input := StorageServiceProperties{ + Logging: props.Logging, + HourMetrics: props.HourMetrics, + MinuteMetrics: props.MinuteMetrics, + Cors: props.Cors, + } + + body, length, err := xmlMarshal(input) + if err != nil { + return err + } + + headers := c.getStandardHeaders() + headers["Content-Length"] = strconv.Itoa(length) + + resp, err := c.exec(http.MethodPut, uri, headers, body, auth) + if err != nil { + return err + } + readAndCloseBody(resp.body) + return checkRespCode(resp.statusCode, []int{http.StatusAccepted}) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice_test.go index c1ca7c2094..713aeb8a27 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice_test.go @@ -1,85 +1,85 @@ -package storage - -import chk "gopkg.in/check.v1" - -type StorageSuite struct{} - -var _ = chk.Suite(&StorageSuite{}) - -// This tests use the Table service, but could also use any other service - -func (s *StorageSuite) TestGetServiceProperties(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - sp, err := cli.GetServiceProperties() - c.Assert(err, chk.IsNil) - c.Assert(sp, chk.NotNil) -} - -func (s *StorageSuite) TestSetServiceProperties(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - - t := true - num := 7 - rp := RetentionPolicy{ - Enabled: true, - Days: &num, - } - m := Metrics{ - Version: "1.0", - Enabled: true, - IncludeAPIs: &t, - RetentionPolicy: &rp, - } - spInput := ServiceProperties{ - Logging: &Logging{ - Version: "1.0", - Delete: true, - Read: false, - Write: true, - RetentionPolicy: &rp, - }, - HourMetrics: &m, - MinuteMetrics: &m, - Cors: &Cors{ - CorsRule: []CorsRule{ - { - AllowedOrigins: "*", - AllowedMethods: "GET,PUT", - MaxAgeInSeconds: 500, - ExposedHeaders: "x-ms-meta-customheader,x-ms-meta-data*", - AllowedHeaders: "x-ms-meta-customheader,x-ms-meta-target*", - }, - }, - }, - } - - err := cli.SetServiceProperties(spInput) - c.Assert(err, chk.IsNil) - - spOutput, err := cli.GetServiceProperties() - c.Assert(err, chk.IsNil) - c.Assert(spOutput, chk.NotNil) - c.Assert(*spOutput, chk.DeepEquals, spInput) - - rec.Stop() - - // Back to defaults - defaultRP := RetentionPolicy{ - Enabled: false, - Days: nil, - } - m.Enabled = false - m.IncludeAPIs = nil - m.RetentionPolicy = &defaultRP - spInput.Logging.Delete = false - spInput.Logging.Read = false - spInput.Logging.Write = false - spInput.Logging.RetentionPolicy = &defaultRP - spInput.Cors = &Cors{nil} - - cli.SetServiceProperties(spInput) -} +package storage + +import chk "gopkg.in/check.v1" + +type StorageSuite struct{} + +var _ = chk.Suite(&StorageSuite{}) + +// This tests use the Table service, but could also use any other service + +func (s *StorageSuite) TestGetServiceProperties(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + sp, err := cli.GetServiceProperties() + c.Assert(err, chk.IsNil) + c.Assert(sp, chk.NotNil) +} + +func (s *StorageSuite) TestSetServiceProperties(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + + t := true + num := 7 + rp := RetentionPolicy{ + Enabled: true, + Days: &num, + } + m := Metrics{ + Version: "1.0", + Enabled: true, + IncludeAPIs: &t, + RetentionPolicy: &rp, + } + spInput := ServiceProperties{ + Logging: &Logging{ + Version: "1.0", + Delete: true, + Read: false, + Write: true, + RetentionPolicy: &rp, + }, + HourMetrics: &m, + MinuteMetrics: &m, + Cors: &Cors{ + CorsRule: []CorsRule{ + { + AllowedOrigins: "*", + AllowedMethods: "GET,PUT", + MaxAgeInSeconds: 500, + ExposedHeaders: "x-ms-meta-customheader,x-ms-meta-data*", + AllowedHeaders: "x-ms-meta-customheader,x-ms-meta-target*", + }, + }, + }, + } + + err := cli.SetServiceProperties(spInput) + c.Assert(err, chk.IsNil) + + spOutput, err := cli.GetServiceProperties() + c.Assert(err, chk.IsNil) + c.Assert(spOutput, chk.NotNil) + c.Assert(*spOutput, chk.DeepEquals, spInput) + + rec.Stop() + + // Back to defaults + defaultRP := RetentionPolicy{ + Enabled: false, + Days: nil, + } + m.Enabled = false + m.IncludeAPIs = nil + m.RetentionPolicy = &defaultRP + spInput.Logging.Delete = false + spInput.Logging.Read = false + spInput.Logging.Write = false + spInput.Logging.RetentionPolicy = &defaultRP + spInput.Cors = &Cors{nil} + + cli.SetServiceProperties(spInput) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go index 367ec1d693..4eae3af9df 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go @@ -1,412 +1,412 @@ -package storage - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "strings" - "time" -) - -const ( - tablesURIPath = "/Tables" - nextTableQueryParameter = "NextTableName" - headerNextPartitionKey = "x-ms-continuation-NextPartitionKey" - headerNextRowKey = "x-ms-continuation-NextRowKey" - nextPartitionKeyQueryParameter = "NextPartitionKey" - nextRowKeyQueryParameter = "NextRowKey" -) - -// TableAccessPolicy are used for SETTING table policies -type TableAccessPolicy struct { - ID string - StartTime time.Time - ExpiryTime time.Time - CanRead bool - CanAppend bool - CanUpdate bool - CanDelete bool -} - -// Table represents an Azure table. -type Table struct { - tsc *TableServiceClient - Name string `json:"TableName"` - OdataEditLink string `json:"odata.editLink"` - OdataID string `json:"odata.id"` - OdataMetadata string `json:"odata.metadata"` - OdataType string `json:"odata.type"` -} - -// EntityQueryResult contains the response from -// ExecuteQuery and ExecuteQueryNextResults functions. -type EntityQueryResult struct { - OdataMetadata string `json:"odata.metadata"` - Entities []*Entity `json:"value"` - QueryNextLink - table *Table -} - -type continuationToken struct { - NextPartitionKey string - NextRowKey string -} - -func (t *Table) buildPath() string { - return fmt.Sprintf("/%s", t.Name) -} - -func (t *Table) buildSpecificPath() string { - return fmt.Sprintf("%s('%s')", tablesURIPath, t.Name) -} - -// Get gets the referenced table. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities -func (t *Table) Get(timeout uint, ml MetadataLevel) error { - if ml == EmptyPayload { - return errEmptyPayload - } - - query := url.Values{ - "timeout": {strconv.FormatUint(uint64(timeout), 10)}, - } - headers := t.tsc.client.getStandardHeaders() - headers[headerAccept] = string(ml) - - uri := t.tsc.client.getEndpoint(tableServiceName, t.buildSpecificPath(), query) - resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return err - } - - respBody, err := ioutil.ReadAll(resp.body) - if err != nil { - return err - } - err = json.Unmarshal(respBody, t) - if err != nil { - return err - } - return nil -} - -// Create creates the referenced table. -// This function fails if the name is not compliant -// with the specification or the tables already exists. -// ml determines the level of detail of metadata in the operation response, -// or no data at all. -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/create-table -func (t *Table) Create(timeout uint, ml MetadataLevel, options *TableOptions) error { - uri := t.tsc.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{ - "timeout": {strconv.FormatUint(uint64(timeout), 10)}, - }) - - type createTableRequest struct { - TableName string `json:"TableName"` - } - req := createTableRequest{TableName: t.Name} - buf := new(bytes.Buffer) - if err := json.NewEncoder(buf).Encode(req); err != nil { - return err - } - - headers := t.tsc.client.getStandardHeaders() - headers = addReturnContentHeaders(headers, ml) - headers = addBodyRelatedHeaders(headers, buf.Len()) - headers = options.addToHeaders(headers) - - resp, err := t.tsc.client.exec(http.MethodPost, uri, headers, buf, t.tsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if ml == EmptyPayload { - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - } else { - if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { - return err - } - } - - if ml != EmptyPayload { - data, err := ioutil.ReadAll(resp.body) - if err != nil { - return err - } - err = json.Unmarshal(data, t) - if err != nil { - return err - } - } - - return nil -} - -// Delete deletes the referenced table. -// This function fails if the table is not present. -// Be advised: Delete deletes all the entries that may be present. -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/delete-table -func (t *Table) Delete(timeout uint, options *TableOptions) error { - uri := t.tsc.client.getEndpoint(tableServiceName, t.buildSpecificPath(), url.Values{ - "timeout": {strconv.Itoa(int(timeout))}, - }) - - headers := t.tsc.client.getStandardHeaders() - headers = addReturnContentHeaders(headers, EmptyPayload) - headers = options.addToHeaders(headers) - - resp, err := t.tsc.client.exec(http.MethodDelete, uri, headers, nil, t.tsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - - } - return nil -} - -// QueryOptions includes options for a query entities operation. -// Top, filter and select are OData query options. -type QueryOptions struct { - Top uint - Filter string - Select []string - RequestID string -} - -func (options *QueryOptions) getParameters() (url.Values, map[string]string) { - query := url.Values{} - headers := map[string]string{} - if options != nil { - if options.Top > 0 { - query.Add(OdataTop, strconv.FormatUint(uint64(options.Top), 10)) - } - if options.Filter != "" { - query.Add(OdataFilter, options.Filter) - } - if len(options.Select) > 0 { - query.Add(OdataSelect, strings.Join(options.Select, ",")) - } - headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) - } - return query, headers -} - -// QueryEntities returns the entities in the table. -// You can use query options defined by the OData Protocol specification. -// -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities -func (t *Table) QueryEntities(timeout uint, ml MetadataLevel, options *QueryOptions) (*EntityQueryResult, error) { - if ml == EmptyPayload { - return nil, errEmptyPayload - } - query, headers := options.getParameters() - query = addTimeout(query, timeout) - uri := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), query) - return t.queryEntities(uri, headers, ml) -} - -// NextResults returns the next page of results -// from a QueryEntities or NextResults operation. -// -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination -func (eqr *EntityQueryResult) NextResults(options *TableOptions) (*EntityQueryResult, error) { - if eqr == nil { - return nil, errNilPreviousResult - } - if eqr.NextLink == nil { - return nil, errNilNextLink - } - headers := options.addToHeaders(map[string]string{}) - return eqr.table.queryEntities(*eqr.NextLink, headers, eqr.ml) -} - -// SetPermissions sets up table ACL permissions -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/Set-Table-ACL -func (t *Table) SetPermissions(tap []TableAccessPolicy, timeout uint, options *TableOptions) error { - params := url.Values{"comp": {"acl"}, - "timeout": {strconv.Itoa(int(timeout))}, - } - - uri := t.tsc.client.getEndpoint(tableServiceName, t.Name, params) - headers := t.tsc.client.getStandardHeaders() - headers = options.addToHeaders(headers) - - body, length, err := generateTableACLPayload(tap) - if err != nil { - return err - } - headers["Content-Length"] = strconv.Itoa(length) - - resp, err := t.tsc.client.exec(http.MethodPut, uri, headers, body, t.tsc.auth) - if err != nil { - return err - } - defer readAndCloseBody(resp.body) - - if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { - return err - } - return nil -} - -func generateTableACLPayload(policies []TableAccessPolicy) (io.Reader, int, error) { - sil := SignedIdentifiers{ - SignedIdentifiers: []SignedIdentifier{}, - } - for _, tap := range policies { - permission := generateTablePermissions(&tap) - signedIdentifier := convertAccessPolicyToXMLStructs(tap.ID, tap.StartTime, tap.ExpiryTime, permission) - sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) - } - return xmlMarshal(sil) -} - -// GetPermissions gets the table ACL permissions -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/get-table-acl -func (t *Table) GetPermissions(timeout int, options *TableOptions) ([]TableAccessPolicy, error) { - params := url.Values{"comp": {"acl"}, - "timeout": {strconv.Itoa(int(timeout))}, - } - - uri := t.tsc.client.getEndpoint(tableServiceName, t.Name, params) - headers := t.tsc.client.getStandardHeaders() - headers = options.addToHeaders(headers) - - resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - var ap AccessPolicy - err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) - if err != nil { - return nil, err - } - return updateTableAccessPolicy(ap), nil -} - -func (t *Table) queryEntities(uri string, headers map[string]string, ml MetadataLevel) (*EntityQueryResult, error) { - headers = mergeHeaders(headers, t.tsc.client.getStandardHeaders()) - if ml != EmptyPayload { - headers[headerAccept] = string(ml) - } - - resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - data, err := ioutil.ReadAll(resp.body) - if err != nil { - return nil, err - } - var entities EntityQueryResult - err = json.Unmarshal(data, &entities) - if err != nil { - return nil, err - } - - for i := range entities.Entities { - entities.Entities[i].Table = t - } - entities.table = t - - contToken := extractContinuationTokenFromHeaders(resp.headers) - if contToken == nil { - entities.NextLink = nil - } else { - originalURI, err := url.Parse(uri) - if err != nil { - return nil, err - } - v := originalURI.Query() - v.Set(nextPartitionKeyQueryParameter, contToken.NextPartitionKey) - v.Set(nextRowKeyQueryParameter, contToken.NextRowKey) - newURI := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), v) - entities.NextLink = &newURI - entities.ml = ml - } - - return &entities, nil -} - -func extractContinuationTokenFromHeaders(h http.Header) *continuationToken { - ct := continuationToken{ - NextPartitionKey: h.Get(headerNextPartitionKey), - NextRowKey: h.Get(headerNextRowKey), - } - - if ct.NextPartitionKey != "" && ct.NextRowKey != "" { - return &ct - } - return nil -} - -func updateTableAccessPolicy(ap AccessPolicy) []TableAccessPolicy { - taps := []TableAccessPolicy{} - for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { - tap := TableAccessPolicy{ - ID: policy.ID, - StartTime: policy.AccessPolicy.StartTime, - ExpiryTime: policy.AccessPolicy.ExpiryTime, - } - tap.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") - tap.CanAppend = updatePermissions(policy.AccessPolicy.Permission, "a") - tap.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u") - tap.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d") - - taps = append(taps, tap) - } - return taps -} - -func generateTablePermissions(tap *TableAccessPolicy) (permissions string) { - // generate the permissions string (raud). - // still want the end user API to have bool flags. - permissions = "" - - if tap.CanRead { - permissions += "r" - } - - if tap.CanAppend { - permissions += "a" - } - - if tap.CanUpdate { - permissions += "u" - } - - if tap.CanDelete { - permissions += "d" - } - return permissions -} +package storage + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "strings" + "time" +) + +const ( + tablesURIPath = "/Tables" + nextTableQueryParameter = "NextTableName" + headerNextPartitionKey = "x-ms-continuation-NextPartitionKey" + headerNextRowKey = "x-ms-continuation-NextRowKey" + nextPartitionKeyQueryParameter = "NextPartitionKey" + nextRowKeyQueryParameter = "NextRowKey" +) + +// TableAccessPolicy are used for SETTING table policies +type TableAccessPolicy struct { + ID string + StartTime time.Time + ExpiryTime time.Time + CanRead bool + CanAppend bool + CanUpdate bool + CanDelete bool +} + +// Table represents an Azure table. +type Table struct { + tsc *TableServiceClient + Name string `json:"TableName"` + OdataEditLink string `json:"odata.editLink"` + OdataID string `json:"odata.id"` + OdataMetadata string `json:"odata.metadata"` + OdataType string `json:"odata.type"` +} + +// EntityQueryResult contains the response from +// ExecuteQuery and ExecuteQueryNextResults functions. +type EntityQueryResult struct { + OdataMetadata string `json:"odata.metadata"` + Entities []*Entity `json:"value"` + QueryNextLink + table *Table +} + +type continuationToken struct { + NextPartitionKey string + NextRowKey string +} + +func (t *Table) buildPath() string { + return fmt.Sprintf("/%s", t.Name) +} + +func (t *Table) buildSpecificPath() string { + return fmt.Sprintf("%s('%s')", tablesURIPath, t.Name) +} + +// Get gets the referenced table. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities +func (t *Table) Get(timeout uint, ml MetadataLevel) error { + if ml == EmptyPayload { + return errEmptyPayload + } + + query := url.Values{ + "timeout": {strconv.FormatUint(uint64(timeout), 10)}, + } + headers := t.tsc.client.getStandardHeaders() + headers[headerAccept] = string(ml) + + uri := t.tsc.client.getEndpoint(tableServiceName, t.buildSpecificPath(), query) + resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return err + } + + respBody, err := ioutil.ReadAll(resp.body) + if err != nil { + return err + } + err = json.Unmarshal(respBody, t) + if err != nil { + return err + } + return nil +} + +// Create creates the referenced table. +// This function fails if the name is not compliant +// with the specification or the tables already exists. +// ml determines the level of detail of metadata in the operation response, +// or no data at all. +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/create-table +func (t *Table) Create(timeout uint, ml MetadataLevel, options *TableOptions) error { + uri := t.tsc.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{ + "timeout": {strconv.FormatUint(uint64(timeout), 10)}, + }) + + type createTableRequest struct { + TableName string `json:"TableName"` + } + req := createTableRequest{TableName: t.Name} + buf := new(bytes.Buffer) + if err := json.NewEncoder(buf).Encode(req); err != nil { + return err + } + + headers := t.tsc.client.getStandardHeaders() + headers = addReturnContentHeaders(headers, ml) + headers = addBodyRelatedHeaders(headers, buf.Len()) + headers = options.addToHeaders(headers) + + resp, err := t.tsc.client.exec(http.MethodPost, uri, headers, buf, t.tsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if ml == EmptyPayload { + if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + } + } else { + if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil { + return err + } + } + + if ml != EmptyPayload { + data, err := ioutil.ReadAll(resp.body) + if err != nil { + return err + } + err = json.Unmarshal(data, t) + if err != nil { + return err + } + } + + return nil +} + +// Delete deletes the referenced table. +// This function fails if the table is not present. +// Be advised: Delete deletes all the entries that may be present. +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/delete-table +func (t *Table) Delete(timeout uint, options *TableOptions) error { + uri := t.tsc.client.getEndpoint(tableServiceName, t.buildSpecificPath(), url.Values{ + "timeout": {strconv.Itoa(int(timeout))}, + }) + + headers := t.tsc.client.getStandardHeaders() + headers = addReturnContentHeaders(headers, EmptyPayload) + headers = options.addToHeaders(headers) + + resp, err := t.tsc.client.exec(http.MethodDelete, uri, headers, nil, t.tsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + + } + return nil +} + +// QueryOptions includes options for a query entities operation. +// Top, filter and select are OData query options. +type QueryOptions struct { + Top uint + Filter string + Select []string + RequestID string +} + +func (options *QueryOptions) getParameters() (url.Values, map[string]string) { + query := url.Values{} + headers := map[string]string{} + if options != nil { + if options.Top > 0 { + query.Add(OdataTop, strconv.FormatUint(uint64(options.Top), 10)) + } + if options.Filter != "" { + query.Add(OdataFilter, options.Filter) + } + if len(options.Select) > 0 { + query.Add(OdataSelect, strings.Join(options.Select, ",")) + } + headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) + } + return query, headers +} + +// QueryEntities returns the entities in the table. +// You can use query options defined by the OData Protocol specification. +// +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities +func (t *Table) QueryEntities(timeout uint, ml MetadataLevel, options *QueryOptions) (*EntityQueryResult, error) { + if ml == EmptyPayload { + return nil, errEmptyPayload + } + query, headers := options.getParameters() + query = addTimeout(query, timeout) + uri := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), query) + return t.queryEntities(uri, headers, ml) +} + +// NextResults returns the next page of results +// from a QueryEntities or NextResults operation. +// +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination +func (eqr *EntityQueryResult) NextResults(options *TableOptions) (*EntityQueryResult, error) { + if eqr == nil { + return nil, errNilPreviousResult + } + if eqr.NextLink == nil { + return nil, errNilNextLink + } + headers := options.addToHeaders(map[string]string{}) + return eqr.table.queryEntities(*eqr.NextLink, headers, eqr.ml) +} + +// SetPermissions sets up table ACL permissions +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/Set-Table-ACL +func (t *Table) SetPermissions(tap []TableAccessPolicy, timeout uint, options *TableOptions) error { + params := url.Values{"comp": {"acl"}, + "timeout": {strconv.Itoa(int(timeout))}, + } + + uri := t.tsc.client.getEndpoint(tableServiceName, t.Name, params) + headers := t.tsc.client.getStandardHeaders() + headers = options.addToHeaders(headers) + + body, length, err := generateTableACLPayload(tap) + if err != nil { + return err + } + headers["Content-Length"] = strconv.Itoa(length) + + resp, err := t.tsc.client.exec(http.MethodPut, uri, headers, body, t.tsc.auth) + if err != nil { + return err + } + defer readAndCloseBody(resp.body) + + if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil { + return err + } + return nil +} + +func generateTableACLPayload(policies []TableAccessPolicy) (io.Reader, int, error) { + sil := SignedIdentifiers{ + SignedIdentifiers: []SignedIdentifier{}, + } + for _, tap := range policies { + permission := generateTablePermissions(&tap) + signedIdentifier := convertAccessPolicyToXMLStructs(tap.ID, tap.StartTime, tap.ExpiryTime, permission) + sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier) + } + return xmlMarshal(sil) +} + +// GetPermissions gets the table ACL permissions +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/get-table-acl +func (t *Table) GetPermissions(timeout int, options *TableOptions) ([]TableAccessPolicy, error) { + params := url.Values{"comp": {"acl"}, + "timeout": {strconv.Itoa(int(timeout))}, + } + + uri := t.tsc.client.getEndpoint(tableServiceName, t.Name, params) + headers := t.tsc.client.getStandardHeaders() + headers = options.addToHeaders(headers) + + resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return nil, err + } + + var ap AccessPolicy + err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList) + if err != nil { + return nil, err + } + return updateTableAccessPolicy(ap), nil +} + +func (t *Table) queryEntities(uri string, headers map[string]string, ml MetadataLevel) (*EntityQueryResult, error) { + headers = mergeHeaders(headers, t.tsc.client.getStandardHeaders()) + if ml != EmptyPayload { + headers[headerAccept] = string(ml) + } + + resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + + if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return nil, err + } + + data, err := ioutil.ReadAll(resp.body) + if err != nil { + return nil, err + } + var entities EntityQueryResult + err = json.Unmarshal(data, &entities) + if err != nil { + return nil, err + } + + for i := range entities.Entities { + entities.Entities[i].Table = t + } + entities.table = t + + contToken := extractContinuationTokenFromHeaders(resp.headers) + if contToken == nil { + entities.NextLink = nil + } else { + originalURI, err := url.Parse(uri) + if err != nil { + return nil, err + } + v := originalURI.Query() + v.Set(nextPartitionKeyQueryParameter, contToken.NextPartitionKey) + v.Set(nextRowKeyQueryParameter, contToken.NextRowKey) + newURI := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), v) + entities.NextLink = &newURI + entities.ml = ml + } + + return &entities, nil +} + +func extractContinuationTokenFromHeaders(h http.Header) *continuationToken { + ct := continuationToken{ + NextPartitionKey: h.Get(headerNextPartitionKey), + NextRowKey: h.Get(headerNextRowKey), + } + + if ct.NextPartitionKey != "" && ct.NextRowKey != "" { + return &ct + } + return nil +} + +func updateTableAccessPolicy(ap AccessPolicy) []TableAccessPolicy { + taps := []TableAccessPolicy{} + for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers { + tap := TableAccessPolicy{ + ID: policy.ID, + StartTime: policy.AccessPolicy.StartTime, + ExpiryTime: policy.AccessPolicy.ExpiryTime, + } + tap.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r") + tap.CanAppend = updatePermissions(policy.AccessPolicy.Permission, "a") + tap.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u") + tap.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d") + + taps = append(taps, tap) + } + return taps +} + +func generateTablePermissions(tap *TableAccessPolicy) (permissions string) { + // generate the permissions string (raud). + // still want the end user API to have bool flags. + permissions = "" + + if tap.CanRead { + permissions += "r" + } + + if tap.CanAppend { + permissions += "a" + } + + if tap.CanUpdate { + permissions += "u" + } + + if tap.CanDelete { + permissions += "d" + } + return permissions +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go index 9ec9f45adc..7a0f0915c6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go @@ -1,302 +1,302 @@ -package storage - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "mime/multipart" - "net/http" - "net/textproto" - "sort" - "strings" - - "github.com/satori/uuid" -) - -// Operation type. Insert, Delete, Replace etc. -type Operation int - -// consts for batch operations. -const ( - InsertOp = Operation(1) - DeleteOp = Operation(2) - ReplaceOp = Operation(3) - MergeOp = Operation(4) - InsertOrReplaceOp = Operation(5) - InsertOrMergeOp = Operation(6) -) - -// BatchEntity used for tracking Entities to operate on and -// whether operations (replace/merge etc) should be forced. -// Wrapper for regular Entity with additional data specific for the entity. -type BatchEntity struct { - *Entity - Force bool - Op Operation -} - -// TableBatch stores all the entities that will be operated on during a batch process. -// Entities can be inserted, replaced or deleted. -type TableBatch struct { - BatchEntitySlice []BatchEntity - - // reference to table we're operating on. - Table *Table -} - -// defaultChangesetHeaders for changeSets -var defaultChangesetHeaders = map[string]string{ - "Accept": "application/json;odata=minimalmetadata", - "Content-Type": "application/json", - "Prefer": "return-no-content", -} - -// NewBatch return new TableBatch for populating. -func (t *Table) NewBatch() *TableBatch { - return &TableBatch{ - Table: t, - } -} - -// InsertEntity adds an entity in preparation for a batch insert. -func (t *TableBatch) InsertEntity(entity *Entity) { - be := BatchEntity{Entity: entity, Force: false, Op: InsertOp} - t.BatchEntitySlice = append(t.BatchEntitySlice, be) -} - -// InsertOrReplaceEntity adds an entity in preparation for a batch insert or replace. -func (t *TableBatch) InsertOrReplaceEntity(entity *Entity, force bool) { - be := BatchEntity{Entity: entity, Force: false, Op: InsertOrReplaceOp} - t.BatchEntitySlice = append(t.BatchEntitySlice, be) -} - -// InsertOrReplaceEntityByForce adds an entity in preparation for a batch insert or replace. Forces regardless of ETag -func (t *TableBatch) InsertOrReplaceEntityByForce(entity *Entity) { - t.InsertOrReplaceEntity(entity, true) -} - -// InsertOrMergeEntity adds an entity in preparation for a batch insert or merge. -func (t *TableBatch) InsertOrMergeEntity(entity *Entity, force bool) { - be := BatchEntity{Entity: entity, Force: false, Op: InsertOrMergeOp} - t.BatchEntitySlice = append(t.BatchEntitySlice, be) -} - -// InsertOrMergeEntityByForce adds an entity in preparation for a batch insert or merge. Forces regardless of ETag -func (t *TableBatch) InsertOrMergeEntityByForce(entity *Entity) { - t.InsertOrMergeEntity(entity, true) -} - -// ReplaceEntity adds an entity in preparation for a batch replace. -func (t *TableBatch) ReplaceEntity(entity *Entity) { - be := BatchEntity{Entity: entity, Force: false, Op: ReplaceOp} - t.BatchEntitySlice = append(t.BatchEntitySlice, be) -} - -// DeleteEntity adds an entity in preparation for a batch delete -func (t *TableBatch) DeleteEntity(entity *Entity, force bool) { - be := BatchEntity{Entity: entity, Force: false, Op: DeleteOp} - t.BatchEntitySlice = append(t.BatchEntitySlice, be) -} - -// DeleteEntityByForce adds an entity in preparation for a batch delete. Forces regardless of ETag -func (t *TableBatch) DeleteEntityByForce(entity *Entity, force bool) { - t.DeleteEntity(entity, true) -} - -// MergeEntity adds an entity in preparation for a batch merge -func (t *TableBatch) MergeEntity(entity *Entity) { - be := BatchEntity{Entity: entity, Force: false, Op: MergeOp} - t.BatchEntitySlice = append(t.BatchEntitySlice, be) -} - -// ExecuteBatch executes many table operations in one request to Azure. -// The operations can be combinations of Insert, Delete, Replace and Merge -// Creates the inner changeset body (various operations, Insert, Delete etc) then creates the outer request packet that encompasses -// the changesets. -// As per document https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/performing-entity-group-transactions -func (t *TableBatch) ExecuteBatch() error { - changesetBoundary := fmt.Sprintf("changeset_%s", uuid.NewV1()) - uri := t.Table.tsc.client.getEndpoint(tableServiceName, "$batch", nil) - changesetBody, err := t.generateChangesetBody(changesetBoundary) - if err != nil { - return err - } - - boundary := fmt.Sprintf("batch_%s", uuid.NewV1()) - body, err := generateBody(changesetBody, changesetBoundary, boundary) - if err != nil { - return err - } - - headers := t.Table.tsc.client.getStandardHeaders() - headers[headerContentType] = fmt.Sprintf("multipart/mixed; boundary=%s", boundary) - - resp, err := t.Table.tsc.client.execBatchOperationJSON(http.MethodPost, uri, headers, bytes.NewReader(body.Bytes()), t.Table.tsc.auth) - if err != nil { - return err - } - defer resp.body.Close() - - if err = checkRespCode(resp.statusCode, []int{http.StatusAccepted}); err != nil { - - // check which batch failed. - operationFailedMessage := t.getFailedOperation(resp.odata.Err.Message.Value) - requestID, date, version := getDebugHeaders(resp.headers) - return AzureStorageServiceError{ - StatusCode: resp.statusCode, - Code: resp.odata.Err.Code, - RequestID: requestID, - Date: date, - APIVersion: version, - Message: operationFailedMessage, - } - } - - return nil -} - -// getFailedOperation parses the original Azure error string and determines which operation failed -// and generates appropriate message. -func (t *TableBatch) getFailedOperation(errorMessage string) string { - // errorMessage consists of "number:string" we just need the number. - sp := strings.Split(errorMessage, ":") - if len(sp) > 1 { - msg := fmt.Sprintf("Element %s in the batch returned an unexpected response code.\n%s", sp[0], errorMessage) - return msg - } - - // cant parse the message, just return the original message to client - return errorMessage -} - -// generateBody generates the complete body for the batch request. -func generateBody(changeSetBody *bytes.Buffer, changesetBoundary string, boundary string) (*bytes.Buffer, error) { - - body := new(bytes.Buffer) - writer := multipart.NewWriter(body) - writer.SetBoundary(boundary) - h := make(textproto.MIMEHeader) - h.Set(headerContentType, fmt.Sprintf("multipart/mixed; boundary=%s\r\n", changesetBoundary)) - batchWriter, err := writer.CreatePart(h) - if err != nil { - return nil, err - } - batchWriter.Write(changeSetBody.Bytes()) - writer.Close() - return body, nil -} - -// generateChangesetBody generates the individual changesets for the various operations within the batch request. -// There is a changeset for Insert, Delete, Merge etc. -func (t *TableBatch) generateChangesetBody(changesetBoundary string) (*bytes.Buffer, error) { - - body := new(bytes.Buffer) - writer := multipart.NewWriter(body) - writer.SetBoundary(changesetBoundary) - - for _, be := range t.BatchEntitySlice { - t.generateEntitySubset(&be, writer) - } - - writer.Close() - return body, nil -} - -// generateVerb generates the HTTP request VERB required for each changeset. -func generateVerb(op Operation) (string, error) { - switch op { - case InsertOp: - return http.MethodPost, nil - case DeleteOp: - return http.MethodDelete, nil - case ReplaceOp, InsertOrReplaceOp: - return http.MethodPut, nil - case MergeOp, InsertOrMergeOp: - return "MERGE", nil - default: - return "", errors.New("Unable to detect operation") - } -} - -// generateQueryPath generates the query path for within the changesets -// For inserts it will just be a table query path (table name) -// but for other operations (modifying an existing entity) then -// the partition/row keys need to be generated. -func (t *TableBatch) generateQueryPath(op Operation, entity *Entity) string { - if op == InsertOp { - return entity.Table.buildPath() - } - return entity.buildPath() -} - -// generateGenericOperationHeaders generates common headers for a given operation. -func generateGenericOperationHeaders(be *BatchEntity) map[string]string { - retval := map[string]string{} - - for k, v := range defaultChangesetHeaders { - retval[k] = v - } - - if be.Op == DeleteOp || be.Op == ReplaceOp || be.Op == MergeOp { - if be.Force || be.Entity.OdataEtag == "" { - retval["If-Match"] = "*" - } else { - retval["If-Match"] = be.Entity.OdataEtag - } - } - - return retval -} - -// generateEntitySubset generates body payload for particular batch entity -func (t *TableBatch) generateEntitySubset(batchEntity *BatchEntity, writer *multipart.Writer) error { - - h := make(textproto.MIMEHeader) - h.Set(headerContentType, "application/http") - h.Set(headerContentTransferEncoding, "binary") - - verb, err := generateVerb(batchEntity.Op) - if err != nil { - return err - } - - genericOpHeadersMap := generateGenericOperationHeaders(batchEntity) - queryPath := t.generateQueryPath(batchEntity.Op, batchEntity.Entity) - uri := t.Table.tsc.client.getEndpoint(tableServiceName, queryPath, nil) - - operationWriter, err := writer.CreatePart(h) - if err != nil { - return err - } - - urlAndVerb := fmt.Sprintf("%s %s HTTP/1.1\r\n", verb, uri) - operationWriter.Write([]byte(urlAndVerb)) - writeHeaders(genericOpHeadersMap, &operationWriter) - operationWriter.Write([]byte("\r\n")) // additional \r\n is needed per changeset separating the "headers" and the body. - - // delete operation doesn't need a body. - if batchEntity.Op != DeleteOp { - //var e Entity = batchEntity.Entity - body, err := json.Marshal(batchEntity.Entity) - if err != nil { - return err - } - operationWriter.Write(body) - } - - return nil -} - -func writeHeaders(h map[string]string, writer *io.Writer) { - // This way it is guaranteed the headers will be written in a sorted order - var keys []string - for k := range h { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - (*writer).Write([]byte(fmt.Sprintf("%s: %s\r\n", k, h[k]))) - } -} +package storage + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/textproto" + "sort" + "strings" + + "github.com/satori/uuid" +) + +// Operation type. Insert, Delete, Replace etc. +type Operation int + +// consts for batch operations. +const ( + InsertOp = Operation(1) + DeleteOp = Operation(2) + ReplaceOp = Operation(3) + MergeOp = Operation(4) + InsertOrReplaceOp = Operation(5) + InsertOrMergeOp = Operation(6) +) + +// BatchEntity used for tracking Entities to operate on and +// whether operations (replace/merge etc) should be forced. +// Wrapper for regular Entity with additional data specific for the entity. +type BatchEntity struct { + *Entity + Force bool + Op Operation +} + +// TableBatch stores all the entities that will be operated on during a batch process. +// Entities can be inserted, replaced or deleted. +type TableBatch struct { + BatchEntitySlice []BatchEntity + + // reference to table we're operating on. + Table *Table +} + +// defaultChangesetHeaders for changeSets +var defaultChangesetHeaders = map[string]string{ + "Accept": "application/json;odata=minimalmetadata", + "Content-Type": "application/json", + "Prefer": "return-no-content", +} + +// NewBatch return new TableBatch for populating. +func (t *Table) NewBatch() *TableBatch { + return &TableBatch{ + Table: t, + } +} + +// InsertEntity adds an entity in preparation for a batch insert. +func (t *TableBatch) InsertEntity(entity *Entity) { + be := BatchEntity{Entity: entity, Force: false, Op: InsertOp} + t.BatchEntitySlice = append(t.BatchEntitySlice, be) +} + +// InsertOrReplaceEntity adds an entity in preparation for a batch insert or replace. +func (t *TableBatch) InsertOrReplaceEntity(entity *Entity, force bool) { + be := BatchEntity{Entity: entity, Force: false, Op: InsertOrReplaceOp} + t.BatchEntitySlice = append(t.BatchEntitySlice, be) +} + +// InsertOrReplaceEntityByForce adds an entity in preparation for a batch insert or replace. Forces regardless of ETag +func (t *TableBatch) InsertOrReplaceEntityByForce(entity *Entity) { + t.InsertOrReplaceEntity(entity, true) +} + +// InsertOrMergeEntity adds an entity in preparation for a batch insert or merge. +func (t *TableBatch) InsertOrMergeEntity(entity *Entity, force bool) { + be := BatchEntity{Entity: entity, Force: false, Op: InsertOrMergeOp} + t.BatchEntitySlice = append(t.BatchEntitySlice, be) +} + +// InsertOrMergeEntityByForce adds an entity in preparation for a batch insert or merge. Forces regardless of ETag +func (t *TableBatch) InsertOrMergeEntityByForce(entity *Entity) { + t.InsertOrMergeEntity(entity, true) +} + +// ReplaceEntity adds an entity in preparation for a batch replace. +func (t *TableBatch) ReplaceEntity(entity *Entity) { + be := BatchEntity{Entity: entity, Force: false, Op: ReplaceOp} + t.BatchEntitySlice = append(t.BatchEntitySlice, be) +} + +// DeleteEntity adds an entity in preparation for a batch delete +func (t *TableBatch) DeleteEntity(entity *Entity, force bool) { + be := BatchEntity{Entity: entity, Force: false, Op: DeleteOp} + t.BatchEntitySlice = append(t.BatchEntitySlice, be) +} + +// DeleteEntityByForce adds an entity in preparation for a batch delete. Forces regardless of ETag +func (t *TableBatch) DeleteEntityByForce(entity *Entity, force bool) { + t.DeleteEntity(entity, true) +} + +// MergeEntity adds an entity in preparation for a batch merge +func (t *TableBatch) MergeEntity(entity *Entity) { + be := BatchEntity{Entity: entity, Force: false, Op: MergeOp} + t.BatchEntitySlice = append(t.BatchEntitySlice, be) +} + +// ExecuteBatch executes many table operations in one request to Azure. +// The operations can be combinations of Insert, Delete, Replace and Merge +// Creates the inner changeset body (various operations, Insert, Delete etc) then creates the outer request packet that encompasses +// the changesets. +// As per document https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/performing-entity-group-transactions +func (t *TableBatch) ExecuteBatch() error { + changesetBoundary := fmt.Sprintf("changeset_%s", uuid.NewV1()) + uri := t.Table.tsc.client.getEndpoint(tableServiceName, "$batch", nil) + changesetBody, err := t.generateChangesetBody(changesetBoundary) + if err != nil { + return err + } + + boundary := fmt.Sprintf("batch_%s", uuid.NewV1()) + body, err := generateBody(changesetBody, changesetBoundary, boundary) + if err != nil { + return err + } + + headers := t.Table.tsc.client.getStandardHeaders() + headers[headerContentType] = fmt.Sprintf("multipart/mixed; boundary=%s", boundary) + + resp, err := t.Table.tsc.client.execBatchOperationJSON(http.MethodPost, uri, headers, bytes.NewReader(body.Bytes()), t.Table.tsc.auth) + if err != nil { + return err + } + defer resp.body.Close() + + if err = checkRespCode(resp.statusCode, []int{http.StatusAccepted}); err != nil { + + // check which batch failed. + operationFailedMessage := t.getFailedOperation(resp.odata.Err.Message.Value) + requestID, date, version := getDebugHeaders(resp.headers) + return AzureStorageServiceError{ + StatusCode: resp.statusCode, + Code: resp.odata.Err.Code, + RequestID: requestID, + Date: date, + APIVersion: version, + Message: operationFailedMessage, + } + } + + return nil +} + +// getFailedOperation parses the original Azure error string and determines which operation failed +// and generates appropriate message. +func (t *TableBatch) getFailedOperation(errorMessage string) string { + // errorMessage consists of "number:string" we just need the number. + sp := strings.Split(errorMessage, ":") + if len(sp) > 1 { + msg := fmt.Sprintf("Element %s in the batch returned an unexpected response code.\n%s", sp[0], errorMessage) + return msg + } + + // cant parse the message, just return the original message to client + return errorMessage +} + +// generateBody generates the complete body for the batch request. +func generateBody(changeSetBody *bytes.Buffer, changesetBoundary string, boundary string) (*bytes.Buffer, error) { + + body := new(bytes.Buffer) + writer := multipart.NewWriter(body) + writer.SetBoundary(boundary) + h := make(textproto.MIMEHeader) + h.Set(headerContentType, fmt.Sprintf("multipart/mixed; boundary=%s\r\n", changesetBoundary)) + batchWriter, err := writer.CreatePart(h) + if err != nil { + return nil, err + } + batchWriter.Write(changeSetBody.Bytes()) + writer.Close() + return body, nil +} + +// generateChangesetBody generates the individual changesets for the various operations within the batch request. +// There is a changeset for Insert, Delete, Merge etc. +func (t *TableBatch) generateChangesetBody(changesetBoundary string) (*bytes.Buffer, error) { + + body := new(bytes.Buffer) + writer := multipart.NewWriter(body) + writer.SetBoundary(changesetBoundary) + + for _, be := range t.BatchEntitySlice { + t.generateEntitySubset(&be, writer) + } + + writer.Close() + return body, nil +} + +// generateVerb generates the HTTP request VERB required for each changeset. +func generateVerb(op Operation) (string, error) { + switch op { + case InsertOp: + return http.MethodPost, nil + case DeleteOp: + return http.MethodDelete, nil + case ReplaceOp, InsertOrReplaceOp: + return http.MethodPut, nil + case MergeOp, InsertOrMergeOp: + return "MERGE", nil + default: + return "", errors.New("Unable to detect operation") + } +} + +// generateQueryPath generates the query path for within the changesets +// For inserts it will just be a table query path (table name) +// but for other operations (modifying an existing entity) then +// the partition/row keys need to be generated. +func (t *TableBatch) generateQueryPath(op Operation, entity *Entity) string { + if op == InsertOp { + return entity.Table.buildPath() + } + return entity.buildPath() +} + +// generateGenericOperationHeaders generates common headers for a given operation. +func generateGenericOperationHeaders(be *BatchEntity) map[string]string { + retval := map[string]string{} + + for k, v := range defaultChangesetHeaders { + retval[k] = v + } + + if be.Op == DeleteOp || be.Op == ReplaceOp || be.Op == MergeOp { + if be.Force || be.Entity.OdataEtag == "" { + retval["If-Match"] = "*" + } else { + retval["If-Match"] = be.Entity.OdataEtag + } + } + + return retval +} + +// generateEntitySubset generates body payload for particular batch entity +func (t *TableBatch) generateEntitySubset(batchEntity *BatchEntity, writer *multipart.Writer) error { + + h := make(textproto.MIMEHeader) + h.Set(headerContentType, "application/http") + h.Set(headerContentTransferEncoding, "binary") + + verb, err := generateVerb(batchEntity.Op) + if err != nil { + return err + } + + genericOpHeadersMap := generateGenericOperationHeaders(batchEntity) + queryPath := t.generateQueryPath(batchEntity.Op, batchEntity.Entity) + uri := t.Table.tsc.client.getEndpoint(tableServiceName, queryPath, nil) + + operationWriter, err := writer.CreatePart(h) + if err != nil { + return err + } + + urlAndVerb := fmt.Sprintf("%s %s HTTP/1.1\r\n", verb, uri) + operationWriter.Write([]byte(urlAndVerb)) + writeHeaders(genericOpHeadersMap, &operationWriter) + operationWriter.Write([]byte("\r\n")) // additional \r\n is needed per changeset separating the "headers" and the body. + + // delete operation doesn't need a body. + if batchEntity.Op != DeleteOp { + //var e Entity = batchEntity.Entity + body, err := json.Marshal(batchEntity.Entity) + if err != nil { + return err + } + operationWriter.Write(body) + } + + return nil +} + +func writeHeaders(h map[string]string, writer *io.Writer) { + // This way it is guaranteed the headers will be written in a sorted order + var keys []string + for k := range h { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + (*writer).Write([]byte(fmt.Sprintf("%s: %s\r\n", k, h[k]))) + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch_test.go index d068c5095c..8b91efa0cf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch_test.go @@ -1,216 +1,216 @@ -package storage - -import ( - "time" - - "github.com/satori/uuid" - chk "gopkg.in/check.v1" -) - -type TableBatchSuite struct{} - -var _ = chk.Suite(&TableBatchSuite{}) - -func (s *TableBatchSuite) Test_BatchInsertMultipleEntities(c *chk.C) { - cli := getBasicClient(c).GetTableService() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c, "me")) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - - entity2 := table.GetEntityReference("mypartitionkey", "myrowkey2") - props2 := map[string]interface{}{ - "AmountDue": 111.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity2.Properties = props2 - - batch := table.NewBatch() - batch.InsertOrReplaceEntity(entity, false) - batch.InsertOrReplaceEntity(entity2, false) - - err = batch.ExecuteBatch() - c.Assert(err, chk.IsNil) - - options := QueryOptions{ - Top: 2, - } - - results, err := table.QueryEntities(30, FullMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 2) -} - -func (s *TableBatchSuite) Test_BatchInsertSameEntryMultipleTimes(c *chk.C) { - cli := getBasicClient(c).GetTableService() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - - batch := table.NewBatch() - batch.InsertOrReplaceEntity(entity, false) - batch.InsertOrReplaceEntity(entity, false) - - err = batch.ExecuteBatch() - c.Assert(err, chk.NotNil) - v, ok := err.(AzureStorageServiceError) - if ok { - c.Assert(v.Code, chk.Equals, "InvalidDuplicateRow") - } -} - -func (s *TableBatchSuite) Test_BatchInsertDeleteSameEntity(c *chk.C) { - cli := getBasicClient(c).GetTableService() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - - batch := table.NewBatch() - batch.InsertOrReplaceEntity(entity, false) - batch.DeleteEntity(entity, true) - - err = batch.ExecuteBatch() - c.Assert(err, chk.NotNil) - - v, ok := err.(AzureStorageServiceError) - if ok { - c.Assert(v.Code, chk.Equals, "InvalidDuplicateRow") - } -} - -func (s *TableBatchSuite) Test_BatchInsertThenDeleteDifferentBatches(c *chk.C) { - cli := getBasicClient(c).GetTableService() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - - batch := table.NewBatch() - batch.InsertOrReplaceEntity(entity, false) - err = batch.ExecuteBatch() - c.Assert(err, chk.IsNil) - - options := QueryOptions{ - Top: 2, - } - - results, err := table.QueryEntities(30, FullMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 1) - - batch = table.NewBatch() - batch.DeleteEntity(entity, true) - err = batch.ExecuteBatch() - c.Assert(err, chk.IsNil) - - // Timeout set to 15 for this test to work propwrly with the recordings - results, err = table.QueryEntities(15, FullMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 0) -} - -func (s *TableBatchSuite) Test_BatchInsertThenMergeDifferentBatches(c *chk.C) { - cli := getBasicClient(c).GetTableService() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - entity := table.GetEntityReference("mypartitionkey", "myrowkey") - props := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "IsActive": true, - "NumberOfOrders": int64(255), - } - entity.Properties = props - - batch := table.NewBatch() - batch.InsertOrReplaceEntity(entity, false) - err = batch.ExecuteBatch() - c.Assert(err, chk.IsNil) - - entity2 := table.GetEntityReference("mypartitionkey", "myrowkey") - props2 := map[string]interface{}{ - "AmountDue": 200.23, - "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), - "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), - "DifferentField": 123, - "NumberOfOrders": int64(255), - } - entity2.Properties = props2 - - batch = table.NewBatch() - batch.InsertOrReplaceEntity(entity2, false) - err = batch.ExecuteBatch() - c.Assert(err, chk.IsNil) - - options := QueryOptions{ - Top: 2, - } - - results, err := table.QueryEntities(30, FullMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(results.Entities, chk.HasLen, 1) -} +package storage + +import ( + "time" + + "github.com/satori/uuid" + chk "gopkg.in/check.v1" +) + +type TableBatchSuite struct{} + +var _ = chk.Suite(&TableBatchSuite{}) + +func (s *TableBatchSuite) Test_BatchInsertMultipleEntities(c *chk.C) { + cli := getBasicClient(c).GetTableService() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c, "me")) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + + entity2 := table.GetEntityReference("mypartitionkey", "myrowkey2") + props2 := map[string]interface{}{ + "AmountDue": 111.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity2.Properties = props2 + + batch := table.NewBatch() + batch.InsertOrReplaceEntity(entity, false) + batch.InsertOrReplaceEntity(entity2, false) + + err = batch.ExecuteBatch() + c.Assert(err, chk.IsNil) + + options := QueryOptions{ + Top: 2, + } + + results, err := table.QueryEntities(30, FullMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 2) +} + +func (s *TableBatchSuite) Test_BatchInsertSameEntryMultipleTimes(c *chk.C) { + cli := getBasicClient(c).GetTableService() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + + batch := table.NewBatch() + batch.InsertOrReplaceEntity(entity, false) + batch.InsertOrReplaceEntity(entity, false) + + err = batch.ExecuteBatch() + c.Assert(err, chk.NotNil) + v, ok := err.(AzureStorageServiceError) + if ok { + c.Assert(v.Code, chk.Equals, "InvalidDuplicateRow") + } +} + +func (s *TableBatchSuite) Test_BatchInsertDeleteSameEntity(c *chk.C) { + cli := getBasicClient(c).GetTableService() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + + batch := table.NewBatch() + batch.InsertOrReplaceEntity(entity, false) + batch.DeleteEntity(entity, true) + + err = batch.ExecuteBatch() + c.Assert(err, chk.NotNil) + + v, ok := err.(AzureStorageServiceError) + if ok { + c.Assert(v.Code, chk.Equals, "InvalidDuplicateRow") + } +} + +func (s *TableBatchSuite) Test_BatchInsertThenDeleteDifferentBatches(c *chk.C) { + cli := getBasicClient(c).GetTableService() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + + batch := table.NewBatch() + batch.InsertOrReplaceEntity(entity, false) + err = batch.ExecuteBatch() + c.Assert(err, chk.IsNil) + + options := QueryOptions{ + Top: 2, + } + + results, err := table.QueryEntities(30, FullMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 1) + + batch = table.NewBatch() + batch.DeleteEntity(entity, true) + err = batch.ExecuteBatch() + c.Assert(err, chk.IsNil) + + // Timeout set to 15 for this test to work propwrly with the recordings + results, err = table.QueryEntities(15, FullMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 0) +} + +func (s *TableBatchSuite) Test_BatchInsertThenMergeDifferentBatches(c *chk.C) { + cli := getBasicClient(c).GetTableService() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + entity := table.GetEntityReference("mypartitionkey", "myrowkey") + props := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "IsActive": true, + "NumberOfOrders": int64(255), + } + entity.Properties = props + + batch := table.NewBatch() + batch.InsertOrReplaceEntity(entity, false) + err = batch.ExecuteBatch() + c.Assert(err, chk.IsNil) + + entity2 := table.GetEntityReference("mypartitionkey", "myrowkey") + props2 := map[string]interface{}{ + "AmountDue": 200.23, + "CustomerCode": uuid.FromStringOrNil("c9da6455-213d-42c9-9a79-3e9149a57833"), + "CustomerSince": time.Date(1992, time.December, 20, 21, 55, 0, 0, time.UTC), + "DifferentField": 123, + "NumberOfOrders": int64(255), + } + entity2.Properties = props2 + + batch = table.NewBatch() + batch.InsertOrReplaceEntity(entity2, false) + err = batch.ExecuteBatch() + c.Assert(err, chk.IsNil) + + options := QueryOptions{ + Top: 2, + } + + results, err := table.QueryEntities(30, FullMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(results.Entities, chk.HasLen, 1) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_test.go index 1a325a52cc..fd17223dbf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_test.go @@ -1,209 +1,209 @@ -package storage - -import ( - "strconv" - "time" - - chk "gopkg.in/check.v1" -) - -type StorageTableSuite struct{} - -var _ = chk.Suite(&StorageTableSuite{}) - -func getTableClient(c *chk.C) TableServiceClient { - return getBasicClient(c).GetTableService() -} - -func (cli *TableServiceClient) deleteAllTables() { - if result, _ := cli.QueryTables(MinimalMetadata, nil); result != nil { - for _, t := range result.Tables { - t.Delete(30, nil) - } - } -} - -func (s *StorageTableSuite) Test_CreateAndDeleteTable(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table1 := cli.GetTableReference(tableName(c, "1")) - err := table1.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - - // update table metadata - table2 := cli.GetTableReference(tableName(c, "2")) - err = table2.Create(30, FullMetadata, nil) - defer table2.Delete(30, nil) - c.Assert(err, chk.IsNil) - - // Check not empty values - c.Assert(table2.OdataEditLink, chk.Not(chk.Equals), "") - c.Assert(table2.OdataID, chk.Not(chk.Equals), "") - c.Assert(table2.OdataMetadata, chk.Not(chk.Equals), "") - c.Assert(table2.OdataType, chk.Not(chk.Equals), "") - - err = table1.Delete(30, nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageTableSuite) Test_CreateTableWithAllResponsePayloadLevels(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - createAndDeleteTable(cli, EmptyPayload, c, "empty") - createAndDeleteTable(cli, NoMetadata, c, "nm") - createAndDeleteTable(cli, MinimalMetadata, c, "minimal") - createAndDeleteTable(cli, FullMetadata, c, "full") -} - -func (s *StorageTableSuite) TestGet(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - tn := tableName(c) - table := cli.GetTableReference(tn) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - - err = table.Get(30, FullMetadata) - c.Assert(err, chk.IsNil) - c.Assert(table.Name, chk.Equals, tn) - c.Assert(table.OdataEditLink, chk.Not(chk.Equals), "") - c.Assert(table.OdataID, chk.Not(chk.Equals), "") - c.Assert(table.OdataMetadata, chk.Not(chk.Equals), "") - c.Assert(table.OdataType, chk.Not(chk.Equals), "") -} - -func createAndDeleteTable(cli TableServiceClient, ml MetadataLevel, c *chk.C, extra string) { - table := cli.GetTableReference(tableName(c, extra)) - c.Assert(table.Create(30, ml, nil), chk.IsNil) - c.Assert(table.Delete(30, nil), chk.IsNil) -} - -func (s *StorageTableSuite) TestQueryTablesNextResults(c *chk.C) { - cli := getTableClient(c) - cli.deleteAllTables() - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - for i := 0; i < 3; i++ { - table := cli.GetTableReference(tableName(c, strconv.Itoa(i))) - err := table.Create(30, EmptyPayload, nil) - c.Assert(err, chk.IsNil) - defer table.Delete(30, nil) - } - - options := QueryTablesOptions{ - Top: 2, - } - result, err := cli.QueryTables(MinimalMetadata, &options) - c.Assert(err, chk.IsNil) - c.Assert(result.Tables, chk.HasLen, 2) - c.Assert(result.NextLink, chk.NotNil) - - result, err = result.NextResults(nil) - c.Assert(err, chk.IsNil) - c.Assert(result.Tables, chk.HasLen, 1) - c.Assert(result.NextLink, chk.IsNil) - - result, err = result.NextResults(nil) - c.Assert(result, chk.IsNil) - c.Assert(err, chk.NotNil) -} - -func appendTablePermission(policies []TableAccessPolicy, ID string, - canRead bool, canAppend bool, canUpdate bool, canDelete bool, - startTime time.Time, expiryTime time.Time) []TableAccessPolicy { - - tap := TableAccessPolicy{ - ID: ID, - StartTime: startTime, - ExpiryTime: expiryTime, - CanRead: canRead, - CanAppend: canAppend, - CanUpdate: canUpdate, - CanDelete: canDelete, - } - policies = append(policies, tap) - return policies -} - -func (s *StorageTableSuite) TestSetPermissionsSuccessfully(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - c.Assert(table.Create(30, EmptyPayload, nil), chk.IsNil) - defer table.Delete(30, nil) - - policies := []TableAccessPolicy{} - policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, fixedTime, fixedTime.Add(10*time.Hour)) - - err := table.SetPermissions(policies, 30, nil) - c.Assert(err, chk.IsNil) -} - -func (s *StorageTableSuite) TestSetPermissionsUnsuccessfully(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference("nonexistingtable") - - policies := []TableAccessPolicy{} - policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, fixedTime, fixedTime.Add(10*time.Hour)) - - err := table.SetPermissions(policies, 30, nil) - c.Assert(err, chk.NotNil) -} - -func (s *StorageTableSuite) TestSetThenGetPermissionsSuccessfully(c *chk.C) { - cli := getTableClient(c) - rec := cli.client.appendRecorder(c) - defer rec.Stop() - - table := cli.GetTableReference(tableName(c)) - c.Assert(table.Create(30, EmptyPayload, nil), chk.IsNil) - defer table.Delete(30, nil) - - policies := []TableAccessPolicy{} - policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, fixedTime, fixedTime.Add(10*time.Hour)) - policies = appendTablePermission(policies, "AutoRestIsSuperCool", true, true, false, true, fixedTime.Add(20*time.Hour), fixedTime.Add(30*time.Hour)) - - err := table.SetPermissions(policies, 30, nil) - c.Assert(err, chk.IsNil) - - newPolicies, err := table.GetPermissions(30, nil) - c.Assert(err, chk.IsNil) - - // fixedTime check policy set. - c.Assert(newPolicies, chk.HasLen, 2) - - for i := range newPolicies { - c.Assert(newPolicies[i].ID, chk.Equals, policies[i].ID) - - // test timestamps down the second - // rounding start/expiry time original perms since the returned perms would have been rounded. - // so need rounded vs rounded. - c.Assert(newPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, policies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123)) - c.Assert(newPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123), - chk.Equals, policies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123)) - - c.Assert(newPolicies[i].CanRead, chk.Equals, policies[i].CanRead) - c.Assert(newPolicies[i].CanAppend, chk.Equals, policies[i].CanAppend) - c.Assert(newPolicies[i].CanUpdate, chk.Equals, policies[i].CanUpdate) - c.Assert(newPolicies[i].CanDelete, chk.Equals, policies[i].CanDelete) - } -} - -func tableName(c *chk.C, extras ...string) string { - // 32 is the max len for table names - return nameGenerator(32, "table", alpha, c, extras) -} +package storage + +import ( + "strconv" + "time" + + chk "gopkg.in/check.v1" +) + +type StorageTableSuite struct{} + +var _ = chk.Suite(&StorageTableSuite{}) + +func getTableClient(c *chk.C) TableServiceClient { + return getBasicClient(c).GetTableService() +} + +func (cli *TableServiceClient) deleteAllTables() { + if result, _ := cli.QueryTables(MinimalMetadata, nil); result != nil { + for _, t := range result.Tables { + t.Delete(30, nil) + } + } +} + +func (s *StorageTableSuite) Test_CreateAndDeleteTable(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table1 := cli.GetTableReference(tableName(c, "1")) + err := table1.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + + // update table metadata + table2 := cli.GetTableReference(tableName(c, "2")) + err = table2.Create(30, FullMetadata, nil) + defer table2.Delete(30, nil) + c.Assert(err, chk.IsNil) + + // Check not empty values + c.Assert(table2.OdataEditLink, chk.Not(chk.Equals), "") + c.Assert(table2.OdataID, chk.Not(chk.Equals), "") + c.Assert(table2.OdataMetadata, chk.Not(chk.Equals), "") + c.Assert(table2.OdataType, chk.Not(chk.Equals), "") + + err = table1.Delete(30, nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageTableSuite) Test_CreateTableWithAllResponsePayloadLevels(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + createAndDeleteTable(cli, EmptyPayload, c, "empty") + createAndDeleteTable(cli, NoMetadata, c, "nm") + createAndDeleteTable(cli, MinimalMetadata, c, "minimal") + createAndDeleteTable(cli, FullMetadata, c, "full") +} + +func (s *StorageTableSuite) TestGet(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + tn := tableName(c) + table := cli.GetTableReference(tn) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + + err = table.Get(30, FullMetadata) + c.Assert(err, chk.IsNil) + c.Assert(table.Name, chk.Equals, tn) + c.Assert(table.OdataEditLink, chk.Not(chk.Equals), "") + c.Assert(table.OdataID, chk.Not(chk.Equals), "") + c.Assert(table.OdataMetadata, chk.Not(chk.Equals), "") + c.Assert(table.OdataType, chk.Not(chk.Equals), "") +} + +func createAndDeleteTable(cli TableServiceClient, ml MetadataLevel, c *chk.C, extra string) { + table := cli.GetTableReference(tableName(c, extra)) + c.Assert(table.Create(30, ml, nil), chk.IsNil) + c.Assert(table.Delete(30, nil), chk.IsNil) +} + +func (s *StorageTableSuite) TestQueryTablesNextResults(c *chk.C) { + cli := getTableClient(c) + cli.deleteAllTables() + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + for i := 0; i < 3; i++ { + table := cli.GetTableReference(tableName(c, strconv.Itoa(i))) + err := table.Create(30, EmptyPayload, nil) + c.Assert(err, chk.IsNil) + defer table.Delete(30, nil) + } + + options := QueryTablesOptions{ + Top: 2, + } + result, err := cli.QueryTables(MinimalMetadata, &options) + c.Assert(err, chk.IsNil) + c.Assert(result.Tables, chk.HasLen, 2) + c.Assert(result.NextLink, chk.NotNil) + + result, err = result.NextResults(nil) + c.Assert(err, chk.IsNil) + c.Assert(result.Tables, chk.HasLen, 1) + c.Assert(result.NextLink, chk.IsNil) + + result, err = result.NextResults(nil) + c.Assert(result, chk.IsNil) + c.Assert(err, chk.NotNil) +} + +func appendTablePermission(policies []TableAccessPolicy, ID string, + canRead bool, canAppend bool, canUpdate bool, canDelete bool, + startTime time.Time, expiryTime time.Time) []TableAccessPolicy { + + tap := TableAccessPolicy{ + ID: ID, + StartTime: startTime, + ExpiryTime: expiryTime, + CanRead: canRead, + CanAppend: canAppend, + CanUpdate: canUpdate, + CanDelete: canDelete, + } + policies = append(policies, tap) + return policies +} + +func (s *StorageTableSuite) TestSetPermissionsSuccessfully(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + c.Assert(table.Create(30, EmptyPayload, nil), chk.IsNil) + defer table.Delete(30, nil) + + policies := []TableAccessPolicy{} + policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, fixedTime, fixedTime.Add(10*time.Hour)) + + err := table.SetPermissions(policies, 30, nil) + c.Assert(err, chk.IsNil) +} + +func (s *StorageTableSuite) TestSetPermissionsUnsuccessfully(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference("nonexistingtable") + + policies := []TableAccessPolicy{} + policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, fixedTime, fixedTime.Add(10*time.Hour)) + + err := table.SetPermissions(policies, 30, nil) + c.Assert(err, chk.NotNil) +} + +func (s *StorageTableSuite) TestSetThenGetPermissionsSuccessfully(c *chk.C) { + cli := getTableClient(c) + rec := cli.client.appendRecorder(c) + defer rec.Stop() + + table := cli.GetTableReference(tableName(c)) + c.Assert(table.Create(30, EmptyPayload, nil), chk.IsNil) + defer table.Delete(30, nil) + + policies := []TableAccessPolicy{} + policies = appendTablePermission(policies, "GolangRocksOnAzure", true, true, true, true, fixedTime, fixedTime.Add(10*time.Hour)) + policies = appendTablePermission(policies, "AutoRestIsSuperCool", true, true, false, true, fixedTime.Add(20*time.Hour), fixedTime.Add(30*time.Hour)) + + err := table.SetPermissions(policies, 30, nil) + c.Assert(err, chk.IsNil) + + newPolicies, err := table.GetPermissions(30, nil) + c.Assert(err, chk.IsNil) + + // fixedTime check policy set. + c.Assert(newPolicies, chk.HasLen, 2) + + for i := range newPolicies { + c.Assert(newPolicies[i].ID, chk.Equals, policies[i].ID) + + // test timestamps down the second + // rounding start/expiry time original perms since the returned perms would have been rounded. + // so need rounded vs rounded. + c.Assert(newPolicies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123), + chk.Equals, policies[i].StartTime.UTC().Round(time.Second).Format(time.RFC1123)) + c.Assert(newPolicies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123), + chk.Equals, policies[i].ExpiryTime.UTC().Round(time.Second).Format(time.RFC1123)) + + c.Assert(newPolicies[i].CanRead, chk.Equals, policies[i].CanRead) + c.Assert(newPolicies[i].CanAppend, chk.Equals, policies[i].CanAppend) + c.Assert(newPolicies[i].CanUpdate, chk.Equals, policies[i].CanUpdate) + c.Assert(newPolicies[i].CanDelete, chk.Equals, policies[i].CanDelete) + } +} + +func tableName(c *chk.C, extras ...string) string { + // 32 is the max len for table names + return nameGenerator(32, "table", alpha, c, extras) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go index d9c56b62af..895dcfded8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go @@ -1,190 +1,190 @@ -package storage - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strconv" -) - -const ( - headerAccept = "Accept" - headerEtag = "Etag" - headerPrefer = "Prefer" - headerXmsContinuation = "x-ms-Continuation-NextTableName" -) - -// TableServiceClient contains operations for Microsoft Azure Table Storage -// Service. -type TableServiceClient struct { - client Client - auth authentication -} - -// TableOptions includes options for some table operations -type TableOptions struct { - RequestID string -} - -func (options *TableOptions) addToHeaders(h map[string]string) map[string]string { - if options != nil { - h = addToHeaders(h, "x-ms-client-request-id", options.RequestID) - } - return h -} - -// QueryNextLink includes information for getting the next page of -// results in query operations -type QueryNextLink struct { - NextLink *string - ml MetadataLevel -} - -// GetServiceProperties gets the properties of your storage account's table service. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-service-properties -func (t *TableServiceClient) GetServiceProperties() (*ServiceProperties, error) { - return t.client.getServiceProperties(tableServiceName, t.auth) -} - -// SetServiceProperties sets the properties of your storage account's table service. -// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties -func (t *TableServiceClient) SetServiceProperties(props ServiceProperties) error { - return t.client.setServiceProperties(props, tableServiceName, t.auth) -} - -// GetTableReference returns a Table object for the specified table name. -func (t *TableServiceClient) GetTableReference(name string) *Table { - return &Table{ - tsc: t, - Name: name, - } -} - -// QueryTablesOptions includes options for some table operations -type QueryTablesOptions struct { - Top uint - Filter string - RequestID string -} - -func (options *QueryTablesOptions) getParameters() (url.Values, map[string]string) { - query := url.Values{} - headers := map[string]string{} - if options != nil { - if options.Top > 0 { - query.Add(OdataTop, strconv.FormatUint(uint64(options.Top), 10)) - } - if options.Filter != "" { - query.Add(OdataFilter, options.Filter) - } - headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) - } - return query, headers -} - -// QueryTables returns the tables in the storage account. -// You can use query options defined by the OData Protocol specification. -// -// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-tables -func (t *TableServiceClient) QueryTables(ml MetadataLevel, options *QueryTablesOptions) (*TableQueryResult, error) { - query, headers := options.getParameters() - uri := t.client.getEndpoint(tableServiceName, tablesURIPath, query) - return t.queryTables(uri, headers, ml) -} - -// NextResults returns the next page of results -// from a QueryTables or a NextResults operation. -// -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-tables -// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination -func (tqr *TableQueryResult) NextResults(options *TableOptions) (*TableQueryResult, error) { - if tqr == nil { - return nil, errNilPreviousResult - } - if tqr.NextLink == nil { - return nil, errNilNextLink - } - headers := options.addToHeaders(map[string]string{}) - - return tqr.tsc.queryTables(*tqr.NextLink, headers, tqr.ml) -} - -// TableQueryResult contains the response from -// QueryTables and QueryTablesNextResults functions. -type TableQueryResult struct { - OdataMetadata string `json:"odata.metadata"` - Tables []Table `json:"value"` - QueryNextLink - tsc *TableServiceClient -} - -func (t *TableServiceClient) queryTables(uri string, headers map[string]string, ml MetadataLevel) (*TableQueryResult, error) { - if ml == EmptyPayload { - return nil, errEmptyPayload - } - headers = mergeHeaders(headers, t.client.getStandardHeaders()) - headers[headerAccept] = string(ml) - - resp, err := t.client.exec(http.MethodGet, uri, headers, nil, t.auth) - if err != nil { - return nil, err - } - defer resp.body.Close() - - if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { - return nil, err - } - - respBody, err := ioutil.ReadAll(resp.body) - if err != nil { - return nil, err - } - var out TableQueryResult - err = json.Unmarshal(respBody, &out) - if err != nil { - return nil, err - } - - for i := range out.Tables { - out.Tables[i].tsc = t - } - out.tsc = t - - nextLink := resp.headers.Get(http.CanonicalHeaderKey(headerXmsContinuation)) - if nextLink == "" { - out.NextLink = nil - } else { - originalURI, err := url.Parse(uri) - if err != nil { - return nil, err - } - v := originalURI.Query() - v.Set(nextTableQueryParameter, nextLink) - newURI := t.client.getEndpoint(tableServiceName, tablesURIPath, v) - out.NextLink = &newURI - out.ml = ml - } - - return &out, nil -} - -func addBodyRelatedHeaders(h map[string]string, length int) map[string]string { - h[headerContentType] = "application/json" - h[headerContentLength] = fmt.Sprintf("%v", length) - h[headerAcceptCharset] = "UTF-8" - return h -} - -func addReturnContentHeaders(h map[string]string, ml MetadataLevel) map[string]string { - if ml != EmptyPayload { - h[headerPrefer] = "return-content" - h[headerAccept] = string(ml) - } else { - h[headerPrefer] = "return-no-content" - // From API version 2015-12-11 onwards, Accept header is required - h[headerAccept] = string(NoMetadata) - } - return h -} +package storage + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strconv" +) + +const ( + headerAccept = "Accept" + headerEtag = "Etag" + headerPrefer = "Prefer" + headerXmsContinuation = "x-ms-Continuation-NextTableName" +) + +// TableServiceClient contains operations for Microsoft Azure Table Storage +// Service. +type TableServiceClient struct { + client Client + auth authentication +} + +// TableOptions includes options for some table operations +type TableOptions struct { + RequestID string +} + +func (options *TableOptions) addToHeaders(h map[string]string) map[string]string { + if options != nil { + h = addToHeaders(h, "x-ms-client-request-id", options.RequestID) + } + return h +} + +// QueryNextLink includes information for getting the next page of +// results in query operations +type QueryNextLink struct { + NextLink *string + ml MetadataLevel +} + +// GetServiceProperties gets the properties of your storage account's table service. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-service-properties +func (t *TableServiceClient) GetServiceProperties() (*ServiceProperties, error) { + return t.client.getServiceProperties(tableServiceName, t.auth) +} + +// SetServiceProperties sets the properties of your storage account's table service. +// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties +func (t *TableServiceClient) SetServiceProperties(props ServiceProperties) error { + return t.client.setServiceProperties(props, tableServiceName, t.auth) +} + +// GetTableReference returns a Table object for the specified table name. +func (t *TableServiceClient) GetTableReference(name string) *Table { + return &Table{ + tsc: t, + Name: name, + } +} + +// QueryTablesOptions includes options for some table operations +type QueryTablesOptions struct { + Top uint + Filter string + RequestID string +} + +func (options *QueryTablesOptions) getParameters() (url.Values, map[string]string) { + query := url.Values{} + headers := map[string]string{} + if options != nil { + if options.Top > 0 { + query.Add(OdataTop, strconv.FormatUint(uint64(options.Top), 10)) + } + if options.Filter != "" { + query.Add(OdataFilter, options.Filter) + } + headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID) + } + return query, headers +} + +// QueryTables returns the tables in the storage account. +// You can use query options defined by the OData Protocol specification. +// +// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-tables +func (t *TableServiceClient) QueryTables(ml MetadataLevel, options *QueryTablesOptions) (*TableQueryResult, error) { + query, headers := options.getParameters() + uri := t.client.getEndpoint(tableServiceName, tablesURIPath, query) + return t.queryTables(uri, headers, ml) +} + +// NextResults returns the next page of results +// from a QueryTables or a NextResults operation. +// +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-tables +// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination +func (tqr *TableQueryResult) NextResults(options *TableOptions) (*TableQueryResult, error) { + if tqr == nil { + return nil, errNilPreviousResult + } + if tqr.NextLink == nil { + return nil, errNilNextLink + } + headers := options.addToHeaders(map[string]string{}) + + return tqr.tsc.queryTables(*tqr.NextLink, headers, tqr.ml) +} + +// TableQueryResult contains the response from +// QueryTables and QueryTablesNextResults functions. +type TableQueryResult struct { + OdataMetadata string `json:"odata.metadata"` + Tables []Table `json:"value"` + QueryNextLink + tsc *TableServiceClient +} + +func (t *TableServiceClient) queryTables(uri string, headers map[string]string, ml MetadataLevel) (*TableQueryResult, error) { + if ml == EmptyPayload { + return nil, errEmptyPayload + } + headers = mergeHeaders(headers, t.client.getStandardHeaders()) + headers[headerAccept] = string(ml) + + resp, err := t.client.exec(http.MethodGet, uri, headers, nil, t.auth) + if err != nil { + return nil, err + } + defer resp.body.Close() + + if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil { + return nil, err + } + + respBody, err := ioutil.ReadAll(resp.body) + if err != nil { + return nil, err + } + var out TableQueryResult + err = json.Unmarshal(respBody, &out) + if err != nil { + return nil, err + } + + for i := range out.Tables { + out.Tables[i].tsc = t + } + out.tsc = t + + nextLink := resp.headers.Get(http.CanonicalHeaderKey(headerXmsContinuation)) + if nextLink == "" { + out.NextLink = nil + } else { + originalURI, err := url.Parse(uri) + if err != nil { + return nil, err + } + v := originalURI.Query() + v.Set(nextTableQueryParameter, nextLink) + newURI := t.client.getEndpoint(tableServiceName, tablesURIPath, v) + out.NextLink = &newURI + out.ml = ml + } + + return &out, nil +} + +func addBodyRelatedHeaders(h map[string]string, length int) map[string]string { + h[headerContentType] = "application/json" + h[headerContentLength] = fmt.Sprintf("%v", length) + h[headerAcceptCharset] = "UTF-8" + return h +} + +func addReturnContentHeaders(h map[string]string, ml MetadataLevel) map[string]string { + if ml != EmptyPayload { + h[headerPrefer] = "return-content" + h[headerAccept] = string(ml) + } else { + h[headerPrefer] = "return-no-content" + // From API version 2015-12-11 onwards, Accept header is required + h[headerAccept] = string(NoMetadata) + } + return h +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go index dbdb5eb6c3..8a902be2f0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go @@ -1,199 +1,199 @@ -package storage - -import ( - "bytes" - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "strconv" - "strings" - "time" -) - -var ( - fixedTime = time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)) -) - -func (c Client) computeHmac256(message string) string { - h := hmac.New(sha256.New, c.accountKey) - h.Write([]byte(message)) - return base64.StdEncoding.EncodeToString(h.Sum(nil)) -} - -func currentTimeRfc1123Formatted() string { - return timeRfc1123Formatted(time.Now().UTC()) -} - -func timeRfc1123Formatted(t time.Time) string { - return t.Format(http.TimeFormat) -} - -func mergeParams(v1, v2 url.Values) url.Values { - out := url.Values{} - for k, v := range v1 { - out[k] = v - } - for k, v := range v2 { - vals, ok := out[k] - if ok { - vals = append(vals, v...) - out[k] = vals - } else { - out[k] = v - } - } - return out -} - -func prepareBlockListRequest(blocks []Block) string { - s := `` - for _, v := range blocks { - s += fmt.Sprintf("<%s>%s", v.Status, v.ID, v.Status) - } - s += `` - return s -} - -func xmlUnmarshal(body io.Reader, v interface{}) error { - data, err := ioutil.ReadAll(body) - if err != nil { - return err - } - return xml.Unmarshal(data, v) -} - -func xmlMarshal(v interface{}) (io.Reader, int, error) { - b, err := xml.Marshal(v) - if err != nil { - return nil, 0, err - } - return bytes.NewReader(b), len(b), nil -} - -func headersFromStruct(v interface{}) map[string]string { - headers := make(map[string]string) - value := reflect.ValueOf(v) - for i := 0; i < value.NumField(); i++ { - key := value.Type().Field(i).Tag.Get("header") - if key != "" { - reflectedValue := reflect.Indirect(value.Field(i)) - var val string - if reflectedValue.IsValid() { - switch reflectedValue.Type() { - case reflect.TypeOf(fixedTime): - val = timeRfc1123Formatted(reflectedValue.Interface().(time.Time)) - case reflect.TypeOf(uint64(0)), reflect.TypeOf(uint(0)): - val = strconv.FormatUint(reflectedValue.Uint(), 10) - case reflect.TypeOf(int(0)): - val = strconv.FormatInt(reflectedValue.Int(), 10) - default: - val = reflectedValue.String() - } - } - if val != "" { - headers[key] = val - } - } - } - return headers -} - -// merges extraHeaders into headers and returns headers -func mergeHeaders(headers, extraHeaders map[string]string) map[string]string { - for k, v := range extraHeaders { - headers[k] = v - } - return headers -} - -func addToHeaders(h map[string]string, key, value string) map[string]string { - if value != "" { - h[key] = value - } - return h -} - -func addTimeToHeaders(h map[string]string, key string, value *time.Time) map[string]string { - if value != nil { - h = addToHeaders(h, key, timeRfc1123Formatted(*value)) - } - return h -} - -func addTimeout(params url.Values, timeout uint) url.Values { - if timeout > 0 { - params.Add("timeout", fmt.Sprintf("%v", timeout)) - } - return params -} - -func addSnapshot(params url.Values, snapshot *time.Time) url.Values { - if snapshot != nil { - params.Add("snapshot", timeRfc1123Formatted(*snapshot)) - } - return params -} - -func getTimeFromHeaders(h http.Header, key string) (*time.Time, error) { - var out time.Time - var err error - outStr := h.Get(key) - if outStr != "" { - out, err = time.Parse(time.RFC1123, outStr) - if err != nil { - return nil, err - } - } - return &out, nil -} - -// TimeRFC1123 is an alias for time.Time needed for custom Unmarshalling -type TimeRFC1123 time.Time - -// UnmarshalXML is a custom unmarshaller that overrides the default time unmarshal which uses a different time layout. -func (t *TimeRFC1123) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var value string - d.DecodeElement(&value, &start) - parse, err := time.Parse(time.RFC1123, value) - if err != nil { - return err - } - *t = TimeRFC1123(parse) - return nil -} - -// returns a map of custom metadata values from the specified HTTP header -func getMetadataFromHeaders(header http.Header) map[string]string { - metadata := make(map[string]string) - for k, v := range header { - // Can't trust CanonicalHeaderKey() to munge case - // reliably. "_" is allowed in identifiers: - // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx - // https://msdn.microsoft.com/library/aa664670(VS.71).aspx - // http://tools.ietf.org/html/rfc7230#section-3.2 - // ...but "_" is considered invalid by - // CanonicalMIMEHeaderKey in - // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542 - // so k can be "X-Ms-Meta-Lol" or "x-ms-meta-lol_rofl". - k = strings.ToLower(k) - if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) { - continue - } - // metadata["lol"] = content of the last X-Ms-Meta-Lol header - k = k[len(userDefinedMetadataHeaderPrefix):] - metadata[k] = v[len(v)-1] - } - - if len(metadata) == 0 { - return nil - } - - return metadata -} +package storage + +import ( + "bytes" + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "encoding/xml" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "reflect" + "strconv" + "strings" + "time" +) + +var ( + fixedTime = time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6)) +) + +func (c Client) computeHmac256(message string) string { + h := hmac.New(sha256.New, c.accountKey) + h.Write([]byte(message)) + return base64.StdEncoding.EncodeToString(h.Sum(nil)) +} + +func currentTimeRfc1123Formatted() string { + return timeRfc1123Formatted(time.Now().UTC()) +} + +func timeRfc1123Formatted(t time.Time) string { + return t.Format(http.TimeFormat) +} + +func mergeParams(v1, v2 url.Values) url.Values { + out := url.Values{} + for k, v := range v1 { + out[k] = v + } + for k, v := range v2 { + vals, ok := out[k] + if ok { + vals = append(vals, v...) + out[k] = vals + } else { + out[k] = v + } + } + return out +} + +func prepareBlockListRequest(blocks []Block) string { + s := `` + for _, v := range blocks { + s += fmt.Sprintf("<%s>%s", v.Status, v.ID, v.Status) + } + s += `` + return s +} + +func xmlUnmarshal(body io.Reader, v interface{}) error { + data, err := ioutil.ReadAll(body) + if err != nil { + return err + } + return xml.Unmarshal(data, v) +} + +func xmlMarshal(v interface{}) (io.Reader, int, error) { + b, err := xml.Marshal(v) + if err != nil { + return nil, 0, err + } + return bytes.NewReader(b), len(b), nil +} + +func headersFromStruct(v interface{}) map[string]string { + headers := make(map[string]string) + value := reflect.ValueOf(v) + for i := 0; i < value.NumField(); i++ { + key := value.Type().Field(i).Tag.Get("header") + if key != "" { + reflectedValue := reflect.Indirect(value.Field(i)) + var val string + if reflectedValue.IsValid() { + switch reflectedValue.Type() { + case reflect.TypeOf(fixedTime): + val = timeRfc1123Formatted(reflectedValue.Interface().(time.Time)) + case reflect.TypeOf(uint64(0)), reflect.TypeOf(uint(0)): + val = strconv.FormatUint(reflectedValue.Uint(), 10) + case reflect.TypeOf(int(0)): + val = strconv.FormatInt(reflectedValue.Int(), 10) + default: + val = reflectedValue.String() + } + } + if val != "" { + headers[key] = val + } + } + } + return headers +} + +// merges extraHeaders into headers and returns headers +func mergeHeaders(headers, extraHeaders map[string]string) map[string]string { + for k, v := range extraHeaders { + headers[k] = v + } + return headers +} + +func addToHeaders(h map[string]string, key, value string) map[string]string { + if value != "" { + h[key] = value + } + return h +} + +func addTimeToHeaders(h map[string]string, key string, value *time.Time) map[string]string { + if value != nil { + h = addToHeaders(h, key, timeRfc1123Formatted(*value)) + } + return h +} + +func addTimeout(params url.Values, timeout uint) url.Values { + if timeout > 0 { + params.Add("timeout", fmt.Sprintf("%v", timeout)) + } + return params +} + +func addSnapshot(params url.Values, snapshot *time.Time) url.Values { + if snapshot != nil { + params.Add("snapshot", timeRfc1123Formatted(*snapshot)) + } + return params +} + +func getTimeFromHeaders(h http.Header, key string) (*time.Time, error) { + var out time.Time + var err error + outStr := h.Get(key) + if outStr != "" { + out, err = time.Parse(time.RFC1123, outStr) + if err != nil { + return nil, err + } + } + return &out, nil +} + +// TimeRFC1123 is an alias for time.Time needed for custom Unmarshalling +type TimeRFC1123 time.Time + +// UnmarshalXML is a custom unmarshaller that overrides the default time unmarshal which uses a different time layout. +func (t *TimeRFC1123) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + var value string + d.DecodeElement(&value, &start) + parse, err := time.Parse(time.RFC1123, value) + if err != nil { + return err + } + *t = TimeRFC1123(parse) + return nil +} + +// returns a map of custom metadata values from the specified HTTP header +func getMetadataFromHeaders(header http.Header) map[string]string { + metadata := make(map[string]string) + for k, v := range header { + // Can't trust CanonicalHeaderKey() to munge case + // reliably. "_" is allowed in identifiers: + // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx + // https://msdn.microsoft.com/library/aa664670(VS.71).aspx + // http://tools.ietf.org/html/rfc7230#section-3.2 + // ...but "_" is considered invalid by + // CanonicalMIMEHeaderKey in + // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542 + // so k can be "X-Ms-Meta-Lol" or "x-ms-meta-lol_rofl". + k = strings.ToLower(k) + if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) { + continue + } + // metadata["lol"] = content of the last X-Ms-Meta-Lol header + k = k[len(userDefinedMetadataHeaderPrefix):] + metadata[k] = v[len(v)-1] + } + + if len(metadata) == 0 { + return nil + } + + return metadata +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go index 48ffdf9cc8..ec57f5056c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/util_test.go @@ -1,187 +1,187 @@ -package storage - -import ( - "bytes" - "encoding/hex" - "encoding/xml" - "fmt" - "io/ioutil" - "net/url" - "os" - "path/filepath" - "strings" - "testing" - "time" - - chk "gopkg.in/check.v1" -) - -func TestMain(m *testing.M) { - exitStatus := m.Run() - err := fixRecordings() - if err != nil { - fmt.Fprintf(os.Stderr, "After test run, fixing recordings failed with error: %v\n", err) - exitStatus = 1 - } - os.Exit(exitStatus) -} - -func fixRecordings() error { - err := filepath.Walk(recordingsFolder, func(path string, file os.FileInfo, err error) error { - if strings.ToLower(filepath.Ext(path)) == ".yaml" { - recording, err := ioutil.ReadFile(path) - if err != nil { - fmt.Fprintf(os.Stderr, "Error reading file '%s': %v", path, err) - } - - fixedRecording := replaceStorageAccount(string(recording)) - - err = ioutil.WriteFile(path, []byte(fixedRecording), 0) - if err != nil { - fmt.Fprintf(os.Stderr, "Error writing file '%s': %v", path, err) - } - } - return err - }) - return err -} - -func replaceStorageAccount(recording string) string { - name := os.Getenv("ACCOUNT_NAME") - if name == "" { - // do nothing - return recording - } - - nameHex := getHex(name) - dummyHex := getHex(dummyStorageAccount) - - r := strings.NewReplacer(name, dummyStorageAccount, - nameHex, dummyHex) - - return r.Replace(string(recording)) -} - -func getHex(input string) string { - encoded := strings.ToUpper(hex.EncodeToString([]byte(input))) - formatted := bytes.Buffer{} - for i := 0; i < len(encoded); i += 2 { - formatted.WriteString(`\x`) - formatted.WriteString(encoded[i : i+2]) - } - return formatted.String() -} - -const ( - dummyStorageAccount = "golangrocksonazure" - dummyMiniStorageKey = "YmFy" - recordingsFolder = "recordings" -) - -func (s *StorageClientSuite) Test_timeRfc1123Formatted(c *chk.C) { - now := time.Now().UTC() - expectedLayout := "Mon, 02 Jan 2006 15:04:05 GMT" - c.Assert(timeRfc1123Formatted(now), chk.Equals, now.Format(expectedLayout)) -} - -func (s *StorageClientSuite) Test_mergeParams(c *chk.C) { - v1 := url.Values{ - "k1": {"v1"}, - "k2": {"v2"}} - v2 := url.Values{ - "k1": {"v11"}, - "k3": {"v3"}} - out := mergeParams(v1, v2) - c.Assert(out.Get("k1"), chk.Equals, "v1") - c.Assert(out.Get("k2"), chk.Equals, "v2") - c.Assert(out.Get("k3"), chk.Equals, "v3") - c.Assert(out["k1"], chk.DeepEquals, []string{"v1", "v11"}) -} - -func (s *StorageClientSuite) Test_prepareBlockListRequest(c *chk.C) { - empty := []Block{} - expected := `` - c.Assert(prepareBlockListRequest(empty), chk.DeepEquals, expected) - - blocks := []Block{{"lol", BlockStatusLatest}, {"rofl", BlockStatusUncommitted}} - expected = `lolrofl` - c.Assert(prepareBlockListRequest(blocks), chk.DeepEquals, expected) -} - -func (s *StorageClientSuite) Test_xmlUnmarshal(c *chk.C) { - xml := ` - - myblob - ` - var blob Blob - body := ioutil.NopCloser(strings.NewReader(xml)) - c.Assert(xmlUnmarshal(body, &blob), chk.IsNil) - c.Assert(blob.Name, chk.Equals, "myblob") -} - -func (s *StorageClientSuite) Test_xmlMarshal(c *chk.C) { - type t struct { - XMLName xml.Name `xml:"S"` - Name string `xml:"Name"` - } - - b := t{Name: "myblob"} - expected := `myblob` - r, i, err := xmlMarshal(b) - c.Assert(err, chk.IsNil) - o, err := ioutil.ReadAll(r) - c.Assert(err, chk.IsNil) - out := string(o) - c.Assert(out, chk.Equals, expected) - c.Assert(i, chk.Equals, len(expected)) -} - -func (s *StorageClientSuite) Test_headersFromStruct(c *chk.C) { - type t struct { - Header1 string `header:"HEADER1"` - Header2 string `header:"HEADER2"` - TimePtr *time.Time `header:"ptr-time-header"` - TimeHeader time.Time `header:"time-header"` - UintPtr *uint `header:"ptr-uint-header"` - UintHeader uint `header:"uint-header"` - IntPtr *int `header:"ptr-int-header"` - IntHeader int `header:"int-header"` - StringAliasPtr *BlobType `header:"ptr-string-alias-header"` - StringAlias BlobType `header:"string-alias-header"` - NilPtr *time.Time `header:"nil-ptr"` - EmptyString string `header:"empty-string"` - } - - timeHeader := time.Date(1985, time.February, 23, 10, 0, 0, 0, time.Local) - uintHeader := uint(15) - intHeader := 30 - alias := BlobTypeAppend - h := t{ - Header1: "value1", - Header2: "value2", - TimePtr: &timeHeader, - TimeHeader: timeHeader, - UintPtr: &uintHeader, - UintHeader: uintHeader, - IntPtr: &intHeader, - IntHeader: intHeader, - StringAliasPtr: &alias, - StringAlias: alias, - } - expected := map[string]string{ - "HEADER1": "value1", - "HEADER2": "value2", - "ptr-time-header": "Sat, 23 Feb 1985 10:00:00 GMT", - "time-header": "Sat, 23 Feb 1985 10:00:00 GMT", - "ptr-uint-header": "15", - "uint-header": "15", - "ptr-int-header": "30", - "int-header": "30", - "ptr-string-alias-header": "AppendBlob", - "string-alias-header": "AppendBlob", - } - - out := headersFromStruct(h) - - c.Assert(out, chk.DeepEquals, expected) -} +package storage + +import ( + "bytes" + "encoding/hex" + "encoding/xml" + "fmt" + "io/ioutil" + "net/url" + "os" + "path/filepath" + "strings" + "testing" + "time" + + chk "gopkg.in/check.v1" +) + +func TestMain(m *testing.M) { + exitStatus := m.Run() + err := fixRecordings() + if err != nil { + fmt.Fprintf(os.Stderr, "After test run, fixing recordings failed with error: %v\n", err) + exitStatus = 1 + } + os.Exit(exitStatus) +} + +func fixRecordings() error { + err := filepath.Walk(recordingsFolder, func(path string, file os.FileInfo, err error) error { + if strings.ToLower(filepath.Ext(path)) == ".yaml" { + recording, err := ioutil.ReadFile(path) + if err != nil { + fmt.Fprintf(os.Stderr, "Error reading file '%s': %v", path, err) + } + + fixedRecording := replaceStorageAccount(string(recording)) + + err = ioutil.WriteFile(path, []byte(fixedRecording), 0) + if err != nil { + fmt.Fprintf(os.Stderr, "Error writing file '%s': %v", path, err) + } + } + return err + }) + return err +} + +func replaceStorageAccount(recording string) string { + name := os.Getenv("ACCOUNT_NAME") + if name == "" { + // do nothing + return recording + } + + nameHex := getHex(name) + dummyHex := getHex(dummyStorageAccount) + + r := strings.NewReplacer(name, dummyStorageAccount, + nameHex, dummyHex) + + return r.Replace(string(recording)) +} + +func getHex(input string) string { + encoded := strings.ToUpper(hex.EncodeToString([]byte(input))) + formatted := bytes.Buffer{} + for i := 0; i < len(encoded); i += 2 { + formatted.WriteString(`\x`) + formatted.WriteString(encoded[i : i+2]) + } + return formatted.String() +} + +const ( + dummyStorageAccount = "golangrocksonazure" + dummyMiniStorageKey = "YmFy" + recordingsFolder = "recordings" +) + +func (s *StorageClientSuite) Test_timeRfc1123Formatted(c *chk.C) { + now := time.Now().UTC() + expectedLayout := "Mon, 02 Jan 2006 15:04:05 GMT" + c.Assert(timeRfc1123Formatted(now), chk.Equals, now.Format(expectedLayout)) +} + +func (s *StorageClientSuite) Test_mergeParams(c *chk.C) { + v1 := url.Values{ + "k1": {"v1"}, + "k2": {"v2"}} + v2 := url.Values{ + "k1": {"v11"}, + "k3": {"v3"}} + out := mergeParams(v1, v2) + c.Assert(out.Get("k1"), chk.Equals, "v1") + c.Assert(out.Get("k2"), chk.Equals, "v2") + c.Assert(out.Get("k3"), chk.Equals, "v3") + c.Assert(out["k1"], chk.DeepEquals, []string{"v1", "v11"}) +} + +func (s *StorageClientSuite) Test_prepareBlockListRequest(c *chk.C) { + empty := []Block{} + expected := `` + c.Assert(prepareBlockListRequest(empty), chk.DeepEquals, expected) + + blocks := []Block{{"lol", BlockStatusLatest}, {"rofl", BlockStatusUncommitted}} + expected = `lolrofl` + c.Assert(prepareBlockListRequest(blocks), chk.DeepEquals, expected) +} + +func (s *StorageClientSuite) Test_xmlUnmarshal(c *chk.C) { + xml := ` + + myblob + ` + var blob Blob + body := ioutil.NopCloser(strings.NewReader(xml)) + c.Assert(xmlUnmarshal(body, &blob), chk.IsNil) + c.Assert(blob.Name, chk.Equals, "myblob") +} + +func (s *StorageClientSuite) Test_xmlMarshal(c *chk.C) { + type t struct { + XMLName xml.Name `xml:"S"` + Name string `xml:"Name"` + } + + b := t{Name: "myblob"} + expected := `myblob` + r, i, err := xmlMarshal(b) + c.Assert(err, chk.IsNil) + o, err := ioutil.ReadAll(r) + c.Assert(err, chk.IsNil) + out := string(o) + c.Assert(out, chk.Equals, expected) + c.Assert(i, chk.Equals, len(expected)) +} + +func (s *StorageClientSuite) Test_headersFromStruct(c *chk.C) { + type t struct { + Header1 string `header:"HEADER1"` + Header2 string `header:"HEADER2"` + TimePtr *time.Time `header:"ptr-time-header"` + TimeHeader time.Time `header:"time-header"` + UintPtr *uint `header:"ptr-uint-header"` + UintHeader uint `header:"uint-header"` + IntPtr *int `header:"ptr-int-header"` + IntHeader int `header:"int-header"` + StringAliasPtr *BlobType `header:"ptr-string-alias-header"` + StringAlias BlobType `header:"string-alias-header"` + NilPtr *time.Time `header:"nil-ptr"` + EmptyString string `header:"empty-string"` + } + + timeHeader := time.Date(1985, time.February, 23, 10, 0, 0, 0, time.Local) + uintHeader := uint(15) + intHeader := 30 + alias := BlobTypeAppend + h := t{ + Header1: "value1", + Header2: "value2", + TimePtr: &timeHeader, + TimeHeader: timeHeader, + UintPtr: &uintHeader, + UintHeader: uintHeader, + IntPtr: &intHeader, + IntHeader: intHeader, + StringAliasPtr: &alias, + StringAlias: alias, + } + expected := map[string]string{ + "HEADER1": "value1", + "HEADER2": "value2", + "ptr-time-header": "Sat, 23 Feb 1985 10:00:00 GMT", + "time-header": "Sat, 23 Feb 1985 10:00:00 GMT", + "ptr-uint-header": "15", + "uint-header": "15", + "ptr-int-header": "30", + "int-header": "30", + "ptr-string-alias-header": "AppendBlob", + "string-alias-header": "AppendBlob", + } + + out := headersFromStruct(h) + + c.Assert(out, chk.DeepEquals, expected) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/version.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/version.go index 0c5aa160d2..a23fff1e2e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/storage/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/storage/version.go @@ -1,5 +1,5 @@ -package storage - -var ( - sdkVersion = "10.0.2" -) +package storage + +var ( + sdkVersion = "10.0.2" +) diff --git a/vendor/github.com/Azure/go-autorest/.gitignore b/vendor/github.com/Azure/go-autorest/.gitignore index 3fe04b3c3d..325986efa4 100644 --- a/vendor/github.com/Azure/go-autorest/.gitignore +++ b/vendor/github.com/Azure/go-autorest/.gitignore @@ -1,29 +1,29 @@ -# The standard Go .gitignore file follows. (Sourced from: github.com/github/gitignore/master/Go.gitignore) -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -# go-autorest specific -vendor/ -autorest/azure/example/example +# The standard Go .gitignore file follows. (Sourced from: github.com/github/gitignore/master/Go.gitignore) +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +# go-autorest specific +vendor/ +autorest/azure/example/example diff --git a/vendor/github.com/Azure/go-autorest/.travis.yml b/vendor/github.com/Azure/go-autorest/.travis.yml index 057b06aa39..3e84ea35f4 100644 --- a/vendor/github.com/Azure/go-autorest/.travis.yml +++ b/vendor/github.com/Azure/go-autorest/.travis.yml @@ -1,22 +1,22 @@ -sudo: false - -language: go - -go: - - 1.7 - - 1.8 - -install: - - go get -u github.com/golang/lint/golint - - go get -u github.com/Masterminds/glide - - go get -u github.com/stretchr/testify - - go get -u github.com/GoASTScanner/gas - - glide install - -script: - - test -z "$(gofmt -s -l -w ./autorest/. | tee /dev/stderr)" - - test -z "$(golint ./autorest/... | tee /dev/stderr)" - - go vet ./autorest/... - - test -z "$(gas ./autorest/... | tee /dev/stderr | grep Error)" - - go build -v ./autorest/... - - go test -v ./autorest/... +sudo: false + +language: go + +go: + - 1.7 + - 1.8 + +install: + - go get -u github.com/golang/lint/golint + - go get -u github.com/Masterminds/glide + - go get -u github.com/stretchr/testify + - go get -u github.com/GoASTScanner/gas + - glide install + +script: + - test -z "$(gofmt -s -l -w ./autorest/. | tee /dev/stderr)" + - test -z "$(golint ./autorest/... | tee /dev/stderr)" + - go vet ./autorest/... + - test -z "$(gas ./autorest/... | tee /dev/stderr | grep Error)" + - go build -v ./autorest/... + - go test -v ./autorest/... diff --git a/vendor/github.com/Azure/go-autorest/CHANGELOG.md b/vendor/github.com/Azure/go-autorest/CHANGELOG.md index 61bee8b1eb..3a395ff950 100644 --- a/vendor/github.com/Azure/go-autorest/CHANGELOG.md +++ b/vendor/github.com/Azure/go-autorest/CHANGELOG.md @@ -1,157 +1,157 @@ -# CHANGELOG - -## v7.3.0 -- Exposing new `RespondDecorator`, `ByDiscardingBody`. This allows operations - to acknowledge that they do not need either the entire or a trailing portion - of accepts response body. In doing so, Go's http library can reuse HTTP - connections more readily. -- Adding `PrepareDecorator` to target custom BaseURLs. -- Adding ACR suffix to public cloud environment. -- Updating Glide dependencies. - -## v7.2.5 -- Fixed the Active Directory endpoint for the China cloud. -- Removes UTF-8 BOM if present in response payload. -- Added telemetry. - -## v7.2.3 -- Fixing bug in calls to `DelayForBackoff` that caused doubling of delay - duration. - -## v7.2.2 -- autorest/azure: added ASM and ARM VM DNS suffixes. - -## v7.2.1 -- fixed parsing of UTC times that are not RFC3339 conformant. - -## v7.2.0 -- autorest/validation: Reformat validation error for better error message. - -## v7.1.0 -- preparer: Added support for multipart formdata - WithMultiPartFormdata() -- preparer: Added support for sending file in request body - WithFile -- client: Added RetryDuration parameter. -- autorest/validation: new package for validation code for Azure Go SDK. - -## v7.0.7 -- Add trailing / to endpoint -- azure: add EnvironmentFromName - -## v7.0.6 -- Add retry logic for 408, 500, 502, 503 and 504 status codes. -- Change url path and query encoding logic. -- Fix DelayForBackoff for proper exponential delay. -- Add CookieJar in Client. - -## v7.0.5 -- Add check to start polling only when status is in [200,201,202]. -- Refactoring for unchecked errors. -- azure/persist changes. -- Fix 'file in use' issue in renewing token in deviceflow. -- Store header RetryAfter for subsequent requests in polling. -- Add attribute details in service error. - -## v7.0.4 -- Better error messages for long running operation failures - -## v7.0.3 -- Corrected DoPollForAsynchronous to properly handle the initial response - -## v7.0.2 -- Corrected DoPollForAsynchronous to continue using the polling method first discovered - -## v7.0.1 -- Fixed empty JSON input error in ByUnmarshallingJSON -- Fixed polling support for GET calls -- Changed format name from TimeRfc1123 to TimeRFC1123 - -## v7.0.0 -- Added ByCopying responder with supporting TeeReadCloser -- Rewrote Azure asynchronous handling -- Reverted to only unmarshalling JSON -- Corrected handling of RFC3339 time strings and added support for Rfc1123 time format - -The `json.Decoder` does not catch bad data as thoroughly as `json.Unmarshal`. Since -`encoding/json` successfully deserializes all core types, and extended types normally provide -their custom JSON serialization handlers, the code has been reverted back to using -`json.Unmarshal`. The original change to use `json.Decode` was made to reduce duplicate -code; there is no loss of function, and there is a gain in accuracy, by reverting. - -Additionally, Azure services indicate requests to be polled by multiple means. The existing code -only checked for one of those (that is, the presence of the `Azure-AsyncOperation` header). -The new code correctly covers all cases and aligns with the other Azure SDKs. - -## v6.1.0 -- Introduced `date.ByUnmarshallingJSONDate` and `date.ByUnmarshallingJSONTime` to enable JSON encoded values. - -## v6.0.0 -- Completely reworked the handling of polled and asynchronous requests -- Removed unnecessary routines -- Reworked `mocks.Sender` to replay a series of `http.Response` objects -- Added `PrepareDecorators` for primitive types (e.g., bool, int32) - -Handling polled and asynchronous requests is no longer part of `Client#Send`. Instead new -`SendDecorators` implement different styles of polled behavior. See`autorest.DoPollForStatusCodes` -and `azure.DoPollForAsynchronous` for examples. - -## v5.0.0 -- Added new RespondDecorators unmarshalling primitive types -- Corrected application of inspection and authorization PrependDecorators - -## v4.0.0 -- Added support for Azure long-running operations. -- Added cancelation support to all decorators and functions that may delay. -- Breaking: `DelayForBackoff` now accepts a channel, which may be nil. - -## v3.1.0 -- Add support for OAuth Device Flow authorization. -- Add support for ServicePrincipalTokens that are backed by an existing token, rather than other secret material. -- Add helpers for persisting and restoring Tokens. -- Increased code coverage in the github.com/Azure/autorest/azure package - -## v3.0.0 -- Breaking: `NewErrorWithError` no longer takes `statusCode int`. -- Breaking: `NewErrorWithStatusCode` is replaced with `NewErrorWithResponse`. -- Breaking: `Client#Send()` no longer takes `codes ...int` argument. -- Add: XML unmarshaling support with `ByUnmarshallingXML()` -- Stopped vending dependencies locally and switched to [Glide](https://github.com/Masterminds/glide). - Applications using this library should either use Glide or vendor dependencies locally some other way. -- Add: `azure.WithErrorUnlessStatusCode()` decorator to handle Azure errors. -- Fix: use `net/http.DefaultClient` as base client. -- Fix: Missing inspection for polling responses added. -- Add: CopyAndDecode helpers. -- Improved `./autorest/to` with `[]string` helpers. -- Removed golint suppressions in .travis.yml. - -## v2.1.0 - -- Added `StatusCode` to `Error` for more easily obtaining the HTTP Reponse StatusCode (if any) - -## v2.0.0 - -- Changed `to.StringMapPtr` method signature to return a pointer -- Changed `ServicePrincipalCertificateSecret` and `NewServicePrincipalTokenFromCertificate` to support generic certificate and private keys - -## v1.0.0 - -- Added Logging inspectors to trace http.Request / Response -- Added support for User-Agent header -- Changed WithHeader PrepareDecorator to use set vs. add -- Added JSON to error when unmarshalling fails -- Added Client#Send method -- Corrected case of "Azure" in package paths -- Added "to" helpers, Azure helpers, and improved ease-of-use -- Corrected golint issues - -## v1.0.1 - -- Added CHANGELOG.md - -## v1.1.0 - -- Added mechanism to retrieve a ServicePrincipalToken using a certificate-signed JWT -- Added an example of creating a certificate-based ServicePrincipal and retrieving an OAuth token using the certificate - -## v1.1.1 - -- Introduce godeps and vendor dependencies introduced in v1.1.1 +# CHANGELOG + +## v7.3.0 +- Exposing new `RespondDecorator`, `ByDiscardingBody`. This allows operations + to acknowledge that they do not need either the entire or a trailing portion + of accepts response body. In doing so, Go's http library can reuse HTTP + connections more readily. +- Adding `PrepareDecorator` to target custom BaseURLs. +- Adding ACR suffix to public cloud environment. +- Updating Glide dependencies. + +## v7.2.5 +- Fixed the Active Directory endpoint for the China cloud. +- Removes UTF-8 BOM if present in response payload. +- Added telemetry. + +## v7.2.3 +- Fixing bug in calls to `DelayForBackoff` that caused doubling of delay + duration. + +## v7.2.2 +- autorest/azure: added ASM and ARM VM DNS suffixes. + +## v7.2.1 +- fixed parsing of UTC times that are not RFC3339 conformant. + +## v7.2.0 +- autorest/validation: Reformat validation error for better error message. + +## v7.1.0 +- preparer: Added support for multipart formdata - WithMultiPartFormdata() +- preparer: Added support for sending file in request body - WithFile +- client: Added RetryDuration parameter. +- autorest/validation: new package for validation code for Azure Go SDK. + +## v7.0.7 +- Add trailing / to endpoint +- azure: add EnvironmentFromName + +## v7.0.6 +- Add retry logic for 408, 500, 502, 503 and 504 status codes. +- Change url path and query encoding logic. +- Fix DelayForBackoff for proper exponential delay. +- Add CookieJar in Client. + +## v7.0.5 +- Add check to start polling only when status is in [200,201,202]. +- Refactoring for unchecked errors. +- azure/persist changes. +- Fix 'file in use' issue in renewing token in deviceflow. +- Store header RetryAfter for subsequent requests in polling. +- Add attribute details in service error. + +## v7.0.4 +- Better error messages for long running operation failures + +## v7.0.3 +- Corrected DoPollForAsynchronous to properly handle the initial response + +## v7.0.2 +- Corrected DoPollForAsynchronous to continue using the polling method first discovered + +## v7.0.1 +- Fixed empty JSON input error in ByUnmarshallingJSON +- Fixed polling support for GET calls +- Changed format name from TimeRfc1123 to TimeRFC1123 + +## v7.0.0 +- Added ByCopying responder with supporting TeeReadCloser +- Rewrote Azure asynchronous handling +- Reverted to only unmarshalling JSON +- Corrected handling of RFC3339 time strings and added support for Rfc1123 time format + +The `json.Decoder` does not catch bad data as thoroughly as `json.Unmarshal`. Since +`encoding/json` successfully deserializes all core types, and extended types normally provide +their custom JSON serialization handlers, the code has been reverted back to using +`json.Unmarshal`. The original change to use `json.Decode` was made to reduce duplicate +code; there is no loss of function, and there is a gain in accuracy, by reverting. + +Additionally, Azure services indicate requests to be polled by multiple means. The existing code +only checked for one of those (that is, the presence of the `Azure-AsyncOperation` header). +The new code correctly covers all cases and aligns with the other Azure SDKs. + +## v6.1.0 +- Introduced `date.ByUnmarshallingJSONDate` and `date.ByUnmarshallingJSONTime` to enable JSON encoded values. + +## v6.0.0 +- Completely reworked the handling of polled and asynchronous requests +- Removed unnecessary routines +- Reworked `mocks.Sender` to replay a series of `http.Response` objects +- Added `PrepareDecorators` for primitive types (e.g., bool, int32) + +Handling polled and asynchronous requests is no longer part of `Client#Send`. Instead new +`SendDecorators` implement different styles of polled behavior. See`autorest.DoPollForStatusCodes` +and `azure.DoPollForAsynchronous` for examples. + +## v5.0.0 +- Added new RespondDecorators unmarshalling primitive types +- Corrected application of inspection and authorization PrependDecorators + +## v4.0.0 +- Added support for Azure long-running operations. +- Added cancelation support to all decorators and functions that may delay. +- Breaking: `DelayForBackoff` now accepts a channel, which may be nil. + +## v3.1.0 +- Add support for OAuth Device Flow authorization. +- Add support for ServicePrincipalTokens that are backed by an existing token, rather than other secret material. +- Add helpers for persisting and restoring Tokens. +- Increased code coverage in the github.com/Azure/autorest/azure package + +## v3.0.0 +- Breaking: `NewErrorWithError` no longer takes `statusCode int`. +- Breaking: `NewErrorWithStatusCode` is replaced with `NewErrorWithResponse`. +- Breaking: `Client#Send()` no longer takes `codes ...int` argument. +- Add: XML unmarshaling support with `ByUnmarshallingXML()` +- Stopped vending dependencies locally and switched to [Glide](https://github.com/Masterminds/glide). + Applications using this library should either use Glide or vendor dependencies locally some other way. +- Add: `azure.WithErrorUnlessStatusCode()` decorator to handle Azure errors. +- Fix: use `net/http.DefaultClient` as base client. +- Fix: Missing inspection for polling responses added. +- Add: CopyAndDecode helpers. +- Improved `./autorest/to` with `[]string` helpers. +- Removed golint suppressions in .travis.yml. + +## v2.1.0 + +- Added `StatusCode` to `Error` for more easily obtaining the HTTP Reponse StatusCode (if any) + +## v2.0.0 + +- Changed `to.StringMapPtr` method signature to return a pointer +- Changed `ServicePrincipalCertificateSecret` and `NewServicePrincipalTokenFromCertificate` to support generic certificate and private keys + +## v1.0.0 + +- Added Logging inspectors to trace http.Request / Response +- Added support for User-Agent header +- Changed WithHeader PrepareDecorator to use set vs. add +- Added JSON to error when unmarshalling fails +- Added Client#Send method +- Corrected case of "Azure" in package paths +- Added "to" helpers, Azure helpers, and improved ease-of-use +- Corrected golint issues + +## v1.0.1 + +- Added CHANGELOG.md + +## v1.1.0 + +- Added mechanism to retrieve a ServicePrincipalToken using a certificate-signed JWT +- Added an example of creating a certificate-based ServicePrincipal and retrieving an OAuth token using the certificate + +## v1.1.1 + +- Introduce godeps and vendor dependencies introduced in v1.1.1 diff --git a/vendor/github.com/Azure/go-autorest/LICENSE b/vendor/github.com/Azure/go-autorest/LICENSE index 9d622981c5..b9d6a27ea9 100644 --- a/vendor/github.com/Azure/go-autorest/LICENSE +++ b/vendor/github.com/Azure/go-autorest/LICENSE @@ -1,191 +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: - - (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 - - Copyright 2015 Microsoft Corporation - - 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. + + 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 + + Copyright 2015 Microsoft Corporation + + 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/Azure/go-autorest/README.md b/vendor/github.com/Azure/go-autorest/README.md index 7c56df9aab..f4c34d0e68 100644 --- a/vendor/github.com/Azure/go-autorest/README.md +++ b/vendor/github.com/Azure/go-autorest/README.md @@ -1,132 +1,132 @@ -# go-autorest - -[![GoDoc](https://godoc.org/github.com/Azure/go-autorest/autorest?status.png)](https://godoc.org/github.com/Azure/go-autorest/autorest) [![Build Status](https://travis-ci.org/Azure/go-autorest.svg?branch=master)](https://travis-ci.org/Azure/go-autorest) [![Go Report Card](https://goreportcard.com/badge/Azure/go-autorest)](https://goreportcard.com/report/Azure/go-autorest) - -## Usage -Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines -and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) -generated Go code. - -The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, -and Responding. A typical pattern is: - -```go - req, err := Prepare(&http.Request{}, - token.WithAuthorization()) - - resp, err := Send(req, - WithLogging(logger), - DoErrorIfStatusCode(http.StatusInternalServerError), - DoCloseIfError(), - DoRetryForAttempts(5, time.Second)) - - err = Respond(resp, - ByDiscardingBody(), - ByClosing()) -``` - -Each phase relies on decorators to modify and / or manage processing. Decorators may first modify -and then pass the data along, pass the data first and then modify the result, or wrap themselves -around passing the data (such as a logger might do). Decorators run in the order provided. For -example, the following: - -```go - req, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPath("a"), - WithPath("b"), - WithPath("c")) -``` - -will set the URL to: - -``` - https://microsoft.com/a/b/c -``` - -Preparers and Responders may be shared and re-used (assuming the underlying decorators support -sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders -shared among multiple go-routines, and a single Sender shared among multiple sending go-routines, -all bound together by means of input / output channels. - -Decorators hold their passed state within a closure (such as the path components in the example -above). Be careful to share Preparers and Responders only in a context where such held state -applies. For example, it may not make sense to share a Preparer that applies a query string from a -fixed set of values. Similarly, sharing a Responder that reads the response body into a passed -struct (e.g., `ByUnmarshallingJson`) is likely incorrect. - -Errors raised by autorest objects and methods will conform to the `autorest.Error` interface. - -See the included examples for more detail. For details on the suggested use of this package by -generated clients, see the Client described below. - -## Helpers - -### Handling Swagger Dates - -The Swagger specification (https://swagger.io) that drives AutoRest -(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The -github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure correct -parsing and formatting. - -### Handling Empty Values - -In JSON, missing values have different semantics than empty values. This is especially true for -services using the HTTP PATCH verb. The JSON submitted with a PATCH request generally contains -only those values to modify. Missing values are to be left unchanged. Developers, then, require a -means to both specify an empty value and to leave the value out of the submitted JSON. - -The Go JSON package (`encoding/json`) supports the `omitempty` tag. When specified, it omits -empty values from the rendered JSON. Since Go defines default values for all base types (such as "" -for string and 0 for int) and provides no means to mark a value as actually empty, the JSON package -treats default values as meaning empty, omitting them from the rendered JSON. This means that, using -the Go base types encoded through the default JSON package, it is not possible to create JSON to -clear a value at the server. - -The workaround within the Go community is to use pointers to base types in lieu of base types within -structures that map to JSON. For example, instead of a value of type `string`, the workaround uses -`*string`. While this enables distinguishing empty values from those to be unchanged, creating -pointers to a base type (notably constant, in-line values) requires additional variables. This, for -example, - -```go - s := struct { - S *string - }{ S: &"foo" } -``` -fails, while, this - -```go - v := "foo" - s := struct { - S *string - }{ S: &v } -``` -succeeds. - -To ease using pointers, the subpackage `to` contains helpers that convert to and from pointers for -Go base types which have Swagger analogs. It also provides a helper that converts between -`map[string]string` and `map[string]*string`, enabling the JSON to specify that the value -associated with a key should be cleared. With the helpers, the previous example becomes - -```go - s := struct { - S *string - }{ S: to.StringPtr("foo") } -``` - -## Install - -```bash -go get github.com/Azure/go-autorest/autorest -go get github.com/Azure/go-autorest/autorest/azure -go get github.com/Azure/go-autorest/autorest/date -go get github.com/Azure/go-autorest/autorest/to -``` - -## License - -See LICENSE file. - ------ -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +# go-autorest + +[![GoDoc](https://godoc.org/github.com/Azure/go-autorest/autorest?status.png)](https://godoc.org/github.com/Azure/go-autorest/autorest) [![Build Status](https://travis-ci.org/Azure/go-autorest.svg?branch=master)](https://travis-ci.org/Azure/go-autorest) [![Go Report Card](https://goreportcard.com/badge/Azure/go-autorest)](https://goreportcard.com/report/Azure/go-autorest) + +## Usage +Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines +and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) +generated Go code. + +The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, +and Responding. A typical pattern is: + +```go + req, err := Prepare(&http.Request{}, + token.WithAuthorization()) + + resp, err := Send(req, + WithLogging(logger), + DoErrorIfStatusCode(http.StatusInternalServerError), + DoCloseIfError(), + DoRetryForAttempts(5, time.Second)) + + err = Respond(resp, + ByDiscardingBody(), + ByClosing()) +``` + +Each phase relies on decorators to modify and / or manage processing. Decorators may first modify +and then pass the data along, pass the data first and then modify the result, or wrap themselves +around passing the data (such as a logger might do). Decorators run in the order provided. For +example, the following: + +```go + req, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + WithPath("a"), + WithPath("b"), + WithPath("c")) +``` + +will set the URL to: + +``` + https://microsoft.com/a/b/c +``` + +Preparers and Responders may be shared and re-used (assuming the underlying decorators support +sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders +shared among multiple go-routines, and a single Sender shared among multiple sending go-routines, +all bound together by means of input / output channels. + +Decorators hold their passed state within a closure (such as the path components in the example +above). Be careful to share Preparers and Responders only in a context where such held state +applies. For example, it may not make sense to share a Preparer that applies a query string from a +fixed set of values. Similarly, sharing a Responder that reads the response body into a passed +struct (e.g., `ByUnmarshallingJson`) is likely incorrect. + +Errors raised by autorest objects and methods will conform to the `autorest.Error` interface. + +See the included examples for more detail. For details on the suggested use of this package by +generated clients, see the Client described below. + +## Helpers + +### Handling Swagger Dates + +The Swagger specification (https://swagger.io) that drives AutoRest +(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The +github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure correct +parsing and formatting. + +### Handling Empty Values + +In JSON, missing values have different semantics than empty values. This is especially true for +services using the HTTP PATCH verb. The JSON submitted with a PATCH request generally contains +only those values to modify. Missing values are to be left unchanged. Developers, then, require a +means to both specify an empty value and to leave the value out of the submitted JSON. + +The Go JSON package (`encoding/json`) supports the `omitempty` tag. When specified, it omits +empty values from the rendered JSON. Since Go defines default values for all base types (such as "" +for string and 0 for int) and provides no means to mark a value as actually empty, the JSON package +treats default values as meaning empty, omitting them from the rendered JSON. This means that, using +the Go base types encoded through the default JSON package, it is not possible to create JSON to +clear a value at the server. + +The workaround within the Go community is to use pointers to base types in lieu of base types within +structures that map to JSON. For example, instead of a value of type `string`, the workaround uses +`*string`. While this enables distinguishing empty values from those to be unchanged, creating +pointers to a base type (notably constant, in-line values) requires additional variables. This, for +example, + +```go + s := struct { + S *string + }{ S: &"foo" } +``` +fails, while, this + +```go + v := "foo" + s := struct { + S *string + }{ S: &v } +``` +succeeds. + +To ease using pointers, the subpackage `to` contains helpers that convert to and from pointers for +Go base types which have Swagger analogs. It also provides a helper that converts between +`map[string]string` and `map[string]*string`, enabling the JSON to specify that the value +associated with a key should be cleared. With the helpers, the previous example becomes + +```go + s := struct { + S *string + }{ S: to.StringPtr("foo") } +``` + +## Install + +```bash +go get github.com/Azure/go-autorest/autorest +go get github.com/Azure/go-autorest/autorest/azure +go get github.com/Azure/go-autorest/autorest/date +go get github.com/Azure/go-autorest/autorest/to +``` + +## License + +See LICENSE file. + +----- +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md index 2dac585763..a17cf98c62 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md @@ -1,253 +1,253 @@ -# Azure Active Directory library for Go - -This project provides a stand alone Azure Active Directory library for Go. The code was extracted -from [go-autorest](https://github.com/Azure/go-autorest/) project, which is used as a base for -[azure-sdk-for-go](https://github.com/Azure/azure-sdk-for-go). - - -## Installation - -``` -go get -u github.com/Azure/go-autorest/autorest/adal -``` - -## Usage - -An Active Directory application is required in order to use this library. An application can be registered in the [Azure Portal](https://portal.azure.com/) follow these [guidelines](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications) or using the [Azure CLI](https://github.com/Azure/azure-cli). - -### Register an Azure AD Application with secret - - -1. Register a new application with a `secret` credential - - ``` - az ad app create \ - --display-name example-app \ - --homepage https://example-app/home \ - --identifier-uris https://example-app/app \ - --password secret - ``` - -2. Create a service principal using the `Application ID` from previous step - - ``` - az ad sp create --id "Application ID" - ``` - - * Replace `Application ID` with `appId` from step 1. - -### Register an Azure AD Application with certificate - -1. Create a private key - - ``` - openssl genrsa -out "example-app.key" 2048 - ``` - -2. Create the certificate - - ``` - openssl req -new -key "example-app.key" -subj "/CN=example-app" -out "example-app.csr" - openssl x509 -req -in "example-app.csr" -signkey "example-app.key" -out "example-app.crt" -days 10000 - ``` - -3. Create the PKCS12 version of the certificate containing also the private key - - ``` - openssl pkcs12 -export -out "example-app.pfx" -inkey "example-app.key" -in "example-app.crt" -passout pass: - - ``` - -4. Register a new application with the certificate content form `example-app.crt` - - ``` - certificateContents="$(tail -n+2 "example-app.crt" | head -n-1)" - - az ad app create \ - --display-name example-app \ - --homepage https://example-app/home \ - --identifier-uris https://example-app/app \ - --key-usage Verify --end-date 2018-01-01 \ - --key-value "${certificateContents}" - ``` - -5. Create a service principal using the `Application ID` from previous step - - ``` - az ad sp create --id "APPLICATION_ID" - ``` - - * Replace `APPLICATION_ID` with `appId` from step 4. - - -### Grant the necessary permissions - -Azure relies on a Role-Based Access Control (RBAC) model to manage the access to resources at a fine-grained -level. There is a set of [pre-defined roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-built-in-roles) -which can be assigned to a service principal of an Azure AD application depending of your needs. - -``` -az role assignment create --assigner "SERVICE_PRINCIPAL_ID" --role "ROLE_NAME" -``` - -* Replace the `SERVICE_PRINCIPAL_ID` with the `appId` from previous step. -* Replace the `ROLE_NAME` with a role name of your choice. - -It is also possible to define custom role definitions. - -``` -az role definition create --role-definition role-definition.json -``` - -* Check [custom roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-control-custom-roles) for more details regarding the content of `role-definition.json` file. - - -### Acquire Access Token - -The common configuration used by all flows: - -```Go -const activeDirectoryEndpoint = "https://login.microsoftonline.com/" -tenantID := "TENANT_ID" -oauthConfig, err := adal.NewOAuthConfig(activeDirectoryEndpoint, tenantID) - -applicationID := "APPLICATION_ID" - -callback := func(token adal.Token) error { - // This is called after the token is acquired -} - -// The resource for which the token is acquired -resource := "https://management.core.windows.net/" -``` - -* Replace the `TENANT_ID` with your tenant ID. -* Replace the `APPLICATION_ID` with the value from previous section. - -#### Client Credentials - -```Go -applicationSecret := "APPLICATION_SECRET" - -spt, err := adal.NewServicePrincipalToken( - oauthConfig, - appliationID, - applicationSecret, - resource, - callbacks...) -if err != nil { - return nil, err -} - -// Acquire a new access token -err = spt.Refresh() -if (err == nil) { - token := spt.Token -} -``` - -* Replace the `APPLICATION_SECRET` with the `password` value from previous section. - -#### Client Certificate - -```Go -certificatePath := "./example-app.pfx" - -certData, err := ioutil.ReadFile(certificatePath) -if err != nil { - return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) -} - -// Get the certificate and private key from pfx file -certificate, rsaPrivateKey, err := decodePkcs12(certData, "") -if err != nil { - return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) -} - -spt, err := adal.NewServicePrincipalTokenFromCertificate( - oauthConfig, - applicationID, - certificate, - rsaPrivateKey, - resource, - callbacks...) - -// Acquire a new access token -err = spt.Refresh() -if (err == nil) { - token := spt.Token -} -``` - -* Update the certificate path to point to the example-app.pfx file which was created in previous section. - - -#### Device Code - -```Go -oauthClient := &http.Client{} - -// Acquire the device code -deviceCode, err := adal.InitiateDeviceAuth( - oauthClient, - oauthConfig, - applicationID, - resource) -if err != nil { - return nil, fmt.Errorf("Failed to start device auth flow: %s", err) -} - -// Display the authentication message -fmt.Println(*deviceCode.Message) - -// Wait here until the user is authenticated -token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) -if err != nil { - return nil, fmt.Errorf("Failed to finish device auth flow: %s", err) -} - -spt, err := adal.NewServicePrincipalTokenFromManualToken( - oauthConfig, - applicationID, - resource, - *token, - callbacks...) - -if (err == nil) { - token := spt.Token -} -``` - -### Command Line Tool - -A command line tool is available in `cmd/adal.go` that can acquire a token for a given resource. It supports all flows mentioned above. - -``` -adal -h - -Usage of ./adal: - -applicationId string - application id - -certificatePath string - path to pk12/PFC application certificate - -mode string - authentication mode (device, secret, cert, refresh) (default "device") - -resource string - resource for which the token is requested - -secret string - application secret - -tenantId string - tenant id - -tokenCachePath string - location of oath token cache (default "/home/cgc/.adal/accessToken.json") -``` - -Example acquire a token for `https://management.core.windows.net/` using device code flow: - -``` -adal -mode device \ - -applicationId "APPLICATION_ID" \ - -tenantId "TENANT_ID" \ - -resource https://management.core.windows.net/ - -``` +# Azure Active Directory library for Go + +This project provides a stand alone Azure Active Directory library for Go. The code was extracted +from [go-autorest](https://github.com/Azure/go-autorest/) project, which is used as a base for +[azure-sdk-for-go](https://github.com/Azure/azure-sdk-for-go). + + +## Installation + +``` +go get -u github.com/Azure/go-autorest/autorest/adal +``` + +## Usage + +An Active Directory application is required in order to use this library. An application can be registered in the [Azure Portal](https://portal.azure.com/) follow these [guidelines](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications) or using the [Azure CLI](https://github.com/Azure/azure-cli). + +### Register an Azure AD Application with secret + + +1. Register a new application with a `secret` credential + + ``` + az ad app create \ + --display-name example-app \ + --homepage https://example-app/home \ + --identifier-uris https://example-app/app \ + --password secret + ``` + +2. Create a service principal using the `Application ID` from previous step + + ``` + az ad sp create --id "Application ID" + ``` + + * Replace `Application ID` with `appId` from step 1. + +### Register an Azure AD Application with certificate + +1. Create a private key + + ``` + openssl genrsa -out "example-app.key" 2048 + ``` + +2. Create the certificate + + ``` + openssl req -new -key "example-app.key" -subj "/CN=example-app" -out "example-app.csr" + openssl x509 -req -in "example-app.csr" -signkey "example-app.key" -out "example-app.crt" -days 10000 + ``` + +3. Create the PKCS12 version of the certificate containing also the private key + + ``` + openssl pkcs12 -export -out "example-app.pfx" -inkey "example-app.key" -in "example-app.crt" -passout pass: + + ``` + +4. Register a new application with the certificate content form `example-app.crt` + + ``` + certificateContents="$(tail -n+2 "example-app.crt" | head -n-1)" + + az ad app create \ + --display-name example-app \ + --homepage https://example-app/home \ + --identifier-uris https://example-app/app \ + --key-usage Verify --end-date 2018-01-01 \ + --key-value "${certificateContents}" + ``` + +5. Create a service principal using the `Application ID` from previous step + + ``` + az ad sp create --id "APPLICATION_ID" + ``` + + * Replace `APPLICATION_ID` with `appId` from step 4. + + +### Grant the necessary permissions + +Azure relies on a Role-Based Access Control (RBAC) model to manage the access to resources at a fine-grained +level. There is a set of [pre-defined roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-built-in-roles) +which can be assigned to a service principal of an Azure AD application depending of your needs. + +``` +az role assignment create --assigner "SERVICE_PRINCIPAL_ID" --role "ROLE_NAME" +``` + +* Replace the `SERVICE_PRINCIPAL_ID` with the `appId` from previous step. +* Replace the `ROLE_NAME` with a role name of your choice. + +It is also possible to define custom role definitions. + +``` +az role definition create --role-definition role-definition.json +``` + +* Check [custom roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-control-custom-roles) for more details regarding the content of `role-definition.json` file. + + +### Acquire Access Token + +The common configuration used by all flows: + +```Go +const activeDirectoryEndpoint = "https://login.microsoftonline.com/" +tenantID := "TENANT_ID" +oauthConfig, err := adal.NewOAuthConfig(activeDirectoryEndpoint, tenantID) + +applicationID := "APPLICATION_ID" + +callback := func(token adal.Token) error { + // This is called after the token is acquired +} + +// The resource for which the token is acquired +resource := "https://management.core.windows.net/" +``` + +* Replace the `TENANT_ID` with your tenant ID. +* Replace the `APPLICATION_ID` with the value from previous section. + +#### Client Credentials + +```Go +applicationSecret := "APPLICATION_SECRET" + +spt, err := adal.NewServicePrincipalToken( + oauthConfig, + appliationID, + applicationSecret, + resource, + callbacks...) +if err != nil { + return nil, err +} + +// Acquire a new access token +err = spt.Refresh() +if (err == nil) { + token := spt.Token +} +``` + +* Replace the `APPLICATION_SECRET` with the `password` value from previous section. + +#### Client Certificate + +```Go +certificatePath := "./example-app.pfx" + +certData, err := ioutil.ReadFile(certificatePath) +if err != nil { + return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) +} + +// Get the certificate and private key from pfx file +certificate, rsaPrivateKey, err := decodePkcs12(certData, "") +if err != nil { + return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) +} + +spt, err := adal.NewServicePrincipalTokenFromCertificate( + oauthConfig, + applicationID, + certificate, + rsaPrivateKey, + resource, + callbacks...) + +// Acquire a new access token +err = spt.Refresh() +if (err == nil) { + token := spt.Token +} +``` + +* Update the certificate path to point to the example-app.pfx file which was created in previous section. + + +#### Device Code + +```Go +oauthClient := &http.Client{} + +// Acquire the device code +deviceCode, err := adal.InitiateDeviceAuth( + oauthClient, + oauthConfig, + applicationID, + resource) +if err != nil { + return nil, fmt.Errorf("Failed to start device auth flow: %s", err) +} + +// Display the authentication message +fmt.Println(*deviceCode.Message) + +// Wait here until the user is authenticated +token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) +if err != nil { + return nil, fmt.Errorf("Failed to finish device auth flow: %s", err) +} + +spt, err := adal.NewServicePrincipalTokenFromManualToken( + oauthConfig, + applicationID, + resource, + *token, + callbacks...) + +if (err == nil) { + token := spt.Token +} +``` + +### Command Line Tool + +A command line tool is available in `cmd/adal.go` that can acquire a token for a given resource. It supports all flows mentioned above. + +``` +adal -h + +Usage of ./adal: + -applicationId string + application id + -certificatePath string + path to pk12/PFC application certificate + -mode string + authentication mode (device, secret, cert, refresh) (default "device") + -resource string + resource for which the token is requested + -secret string + application secret + -tenantId string + tenant id + -tokenCachePath string + location of oath token cache (default "/home/cgc/.adal/accessToken.json") +``` + +Example acquire a token for `https://management.core.windows.net/` using device code flow: + +``` +adal -mode device \ + -applicationId "APPLICATION_ID" \ + -tenantId "TENANT_ID" \ + -resource https://management.core.windows.net/ + +``` diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/cmd/adal.go b/vendor/github.com/Azure/go-autorest/autorest/adal/cmd/adal.go index faae4b9441..baf4c17e78 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/cmd/adal.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/cmd/adal.go @@ -1,284 +1,284 @@ -package main - -import ( - "flag" - "fmt" - "log" - "strings" - - "crypto/rsa" - "crypto/x509" - "io/ioutil" - "net/http" - "os/user" - - "github.com/Azure/go-autorest/autorest/adal" - "golang.org/x/crypto/pkcs12" -) - -const ( - deviceMode = "device" - clientSecretMode = "secret" - clientCertMode = "cert" - refreshMode = "refresh" - - activeDirectoryEndpoint = "https://login.microsoftonline.com/" -) - -type option struct { - name string - value string -} - -var ( - mode string - resource string - - tenantID string - applicationID string - - applicationSecret string - certificatePath string - - tokenCachePath string -) - -func checkMandatoryOptions(mode string, options ...option) { - for _, option := range options { - if strings.TrimSpace(option.value) == "" { - log.Fatalf("Authentication mode '%s' requires mandatory option '%s'.", mode, option.name) - } - } -} - -func defaultTokenCachePath() string { - usr, err := user.Current() - if err != nil { - log.Fatal(err) - } - defaultTokenPath := usr.HomeDir + "/.adal/accessToken.json" - return defaultTokenPath -} - -func init() { - flag.StringVar(&mode, "mode", "device", "authentication mode (device, secret, cert, refresh)") - flag.StringVar(&resource, "resource", "", "resource for which the token is requested") - flag.StringVar(&tenantID, "tenantId", "", "tenant id") - flag.StringVar(&applicationID, "applicationId", "", "application id") - flag.StringVar(&applicationSecret, "secret", "", "application secret") - flag.StringVar(&certificatePath, "certificatePath", "", "path to pk12/PFC application certificate") - flag.StringVar(&tokenCachePath, "tokenCachePath", defaultTokenCachePath(), "location of oath token cache") - - flag.Parse() - - switch mode = strings.TrimSpace(mode); mode { - case clientSecretMode: - checkMandatoryOptions(clientSecretMode, - option{name: "resource", value: resource}, - option{name: "tenantId", value: tenantID}, - option{name: "applicationId", value: applicationID}, - option{name: "secret", value: applicationSecret}, - ) - case clientCertMode: - checkMandatoryOptions(clientCertMode, - option{name: "resource", value: resource}, - option{name: "tenantId", value: tenantID}, - option{name: "applicationId", value: applicationID}, - option{name: "certificatePath", value: certificatePath}, - ) - case deviceMode: - checkMandatoryOptions(deviceMode, - option{name: "resource", value: resource}, - option{name: "tenantId", value: tenantID}, - option{name: "applicationId", value: applicationID}, - ) - case refreshMode: - checkMandatoryOptions(refreshMode, - option{name: "resource", value: resource}, - option{name: "tenantId", value: tenantID}, - option{name: "applicationId", value: applicationID}, - ) - default: - log.Fatalln("Authentication modes 'secret, 'cert', 'device' or 'refresh' are supported.") - } -} - -func acquireTokenClientSecretFlow(oauthConfig adal.OAuthConfig, - appliationID string, - applicationSecret string, - resource string, - callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - - spt, err := adal.NewServicePrincipalToken( - oauthConfig, - appliationID, - applicationSecret, - resource, - callbacks...) - if err != nil { - return nil, err - } - - return spt, spt.Refresh() -} - -func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { - privateKey, certificate, err := pkcs12.Decode(pkcs, password) - if err != nil { - return nil, nil, err - } - - rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey) - if !isRsaKey { - return nil, nil, fmt.Errorf("PKCS#12 certificate must contain an RSA private key") - } - - return certificate, rsaPrivateKey, nil -} - -func acquireTokenClientCertFlow(oauthConfig adal.OAuthConfig, - applicationID string, - applicationCertPath string, - resource string, - callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - - certData, err := ioutil.ReadFile(certificatePath) - if err != nil { - return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) - } - - certificate, rsaPrivateKey, err := decodePkcs12(certData, "") - if err != nil { - return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) - } - - spt, err := adal.NewServicePrincipalTokenFromCertificate( - oauthConfig, - applicationID, - certificate, - rsaPrivateKey, - resource, - callbacks...) - if err != nil { - return nil, err - } - - return spt, spt.Refresh() -} - -func acquireTokenDeviceCodeFlow(oauthConfig adal.OAuthConfig, - applicationID string, - resource string, - callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - - oauthClient := &http.Client{} - deviceCode, err := adal.InitiateDeviceAuth( - oauthClient, - oauthConfig, - applicationID, - resource) - if err != nil { - return nil, fmt.Errorf("Failed to start device auth flow: %s", err) - } - - fmt.Println(*deviceCode.Message) - - token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) - if err != nil { - return nil, fmt.Errorf("Failed to finish device auth flow: %s", err) - } - - spt, err := adal.NewServicePrincipalTokenFromManualToken( - oauthConfig, - applicationID, - resource, - *token, - callbacks...) - return spt, err -} - -func refreshToken(oauthConfig adal.OAuthConfig, - applicationID string, - resource string, - tokenCachePath string, - callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - - token, err := adal.LoadToken(tokenCachePath) - if err != nil { - return nil, fmt.Errorf("failed to load token from cache: %v", err) - } - - spt, err := adal.NewServicePrincipalTokenFromManualToken( - oauthConfig, - applicationID, - resource, - *token, - callbacks...) - if err != nil { - return nil, err - } - return spt, spt.Refresh() -} - -func saveToken(spt adal.Token) error { - if tokenCachePath != "" { - err := adal.SaveToken(tokenCachePath, 0600, spt) - if err != nil { - return err - } - log.Printf("Acquired token was saved in '%s' file\n", tokenCachePath) - return nil - - } - return fmt.Errorf("empty path for token cache") -} - -func main() { - oauthConfig, err := adal.NewOAuthConfig(activeDirectoryEndpoint, tenantID) - if err != nil { - panic(err) - } - - callback := func(token adal.Token) error { - return saveToken(token) - } - - log.Printf("Authenticating with mode '%s'\n", mode) - switch mode { - case clientSecretMode: - _, err = acquireTokenClientSecretFlow( - *oauthConfig, - applicationID, - applicationSecret, - resource, - callback) - case clientCertMode: - _, err = acquireTokenClientCertFlow( - *oauthConfig, - applicationID, - certificatePath, - resource, - callback) - case deviceMode: - var spt *adal.ServicePrincipalToken - spt, err = acquireTokenDeviceCodeFlow( - *oauthConfig, - applicationID, - resource, - callback) - if err == nil { - err = saveToken(spt.Token) - } - case refreshMode: - _, err = refreshToken( - *oauthConfig, - applicationID, - resource, - tokenCachePath, - callback) - } - - if err != nil { - log.Fatalf("Failed to acquire a token for resource %s. Error: %v", resource, err) - } -} +package main + +import ( + "flag" + "fmt" + "log" + "strings" + + "crypto/rsa" + "crypto/x509" + "io/ioutil" + "net/http" + "os/user" + + "github.com/Azure/go-autorest/autorest/adal" + "golang.org/x/crypto/pkcs12" +) + +const ( + deviceMode = "device" + clientSecretMode = "secret" + clientCertMode = "cert" + refreshMode = "refresh" + + activeDirectoryEndpoint = "https://login.microsoftonline.com/" +) + +type option struct { + name string + value string +} + +var ( + mode string + resource string + + tenantID string + applicationID string + + applicationSecret string + certificatePath string + + tokenCachePath string +) + +func checkMandatoryOptions(mode string, options ...option) { + for _, option := range options { + if strings.TrimSpace(option.value) == "" { + log.Fatalf("Authentication mode '%s' requires mandatory option '%s'.", mode, option.name) + } + } +} + +func defaultTokenCachePath() string { + usr, err := user.Current() + if err != nil { + log.Fatal(err) + } + defaultTokenPath := usr.HomeDir + "/.adal/accessToken.json" + return defaultTokenPath +} + +func init() { + flag.StringVar(&mode, "mode", "device", "authentication mode (device, secret, cert, refresh)") + flag.StringVar(&resource, "resource", "", "resource for which the token is requested") + flag.StringVar(&tenantID, "tenantId", "", "tenant id") + flag.StringVar(&applicationID, "applicationId", "", "application id") + flag.StringVar(&applicationSecret, "secret", "", "application secret") + flag.StringVar(&certificatePath, "certificatePath", "", "path to pk12/PFC application certificate") + flag.StringVar(&tokenCachePath, "tokenCachePath", defaultTokenCachePath(), "location of oath token cache") + + flag.Parse() + + switch mode = strings.TrimSpace(mode); mode { + case clientSecretMode: + checkMandatoryOptions(clientSecretMode, + option{name: "resource", value: resource}, + option{name: "tenantId", value: tenantID}, + option{name: "applicationId", value: applicationID}, + option{name: "secret", value: applicationSecret}, + ) + case clientCertMode: + checkMandatoryOptions(clientCertMode, + option{name: "resource", value: resource}, + option{name: "tenantId", value: tenantID}, + option{name: "applicationId", value: applicationID}, + option{name: "certificatePath", value: certificatePath}, + ) + case deviceMode: + checkMandatoryOptions(deviceMode, + option{name: "resource", value: resource}, + option{name: "tenantId", value: tenantID}, + option{name: "applicationId", value: applicationID}, + ) + case refreshMode: + checkMandatoryOptions(refreshMode, + option{name: "resource", value: resource}, + option{name: "tenantId", value: tenantID}, + option{name: "applicationId", value: applicationID}, + ) + default: + log.Fatalln("Authentication modes 'secret, 'cert', 'device' or 'refresh' are supported.") + } +} + +func acquireTokenClientSecretFlow(oauthConfig adal.OAuthConfig, + appliationID string, + applicationSecret string, + resource string, + callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + + spt, err := adal.NewServicePrincipalToken( + oauthConfig, + appliationID, + applicationSecret, + resource, + callbacks...) + if err != nil { + return nil, err + } + + return spt, spt.Refresh() +} + +func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { + privateKey, certificate, err := pkcs12.Decode(pkcs, password) + if err != nil { + return nil, nil, err + } + + rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey) + if !isRsaKey { + return nil, nil, fmt.Errorf("PKCS#12 certificate must contain an RSA private key") + } + + return certificate, rsaPrivateKey, nil +} + +func acquireTokenClientCertFlow(oauthConfig adal.OAuthConfig, + applicationID string, + applicationCertPath string, + resource string, + callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + + certData, err := ioutil.ReadFile(certificatePath) + if err != nil { + return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) + } + + certificate, rsaPrivateKey, err := decodePkcs12(certData, "") + if err != nil { + return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) + } + + spt, err := adal.NewServicePrincipalTokenFromCertificate( + oauthConfig, + applicationID, + certificate, + rsaPrivateKey, + resource, + callbacks...) + if err != nil { + return nil, err + } + + return spt, spt.Refresh() +} + +func acquireTokenDeviceCodeFlow(oauthConfig adal.OAuthConfig, + applicationID string, + resource string, + callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + + oauthClient := &http.Client{} + deviceCode, err := adal.InitiateDeviceAuth( + oauthClient, + oauthConfig, + applicationID, + resource) + if err != nil { + return nil, fmt.Errorf("Failed to start device auth flow: %s", err) + } + + fmt.Println(*deviceCode.Message) + + token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) + if err != nil { + return nil, fmt.Errorf("Failed to finish device auth flow: %s", err) + } + + spt, err := adal.NewServicePrincipalTokenFromManualToken( + oauthConfig, + applicationID, + resource, + *token, + callbacks...) + return spt, err +} + +func refreshToken(oauthConfig adal.OAuthConfig, + applicationID string, + resource string, + tokenCachePath string, + callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + + token, err := adal.LoadToken(tokenCachePath) + if err != nil { + return nil, fmt.Errorf("failed to load token from cache: %v", err) + } + + spt, err := adal.NewServicePrincipalTokenFromManualToken( + oauthConfig, + applicationID, + resource, + *token, + callbacks...) + if err != nil { + return nil, err + } + return spt, spt.Refresh() +} + +func saveToken(spt adal.Token) error { + if tokenCachePath != "" { + err := adal.SaveToken(tokenCachePath, 0600, spt) + if err != nil { + return err + } + log.Printf("Acquired token was saved in '%s' file\n", tokenCachePath) + return nil + + } + return fmt.Errorf("empty path for token cache") +} + +func main() { + oauthConfig, err := adal.NewOAuthConfig(activeDirectoryEndpoint, tenantID) + if err != nil { + panic(err) + } + + callback := func(token adal.Token) error { + return saveToken(token) + } + + log.Printf("Authenticating with mode '%s'\n", mode) + switch mode { + case clientSecretMode: + _, err = acquireTokenClientSecretFlow( + *oauthConfig, + applicationID, + applicationSecret, + resource, + callback) + case clientCertMode: + _, err = acquireTokenClientCertFlow( + *oauthConfig, + applicationID, + certificatePath, + resource, + callback) + case deviceMode: + var spt *adal.ServicePrincipalToken + spt, err = acquireTokenDeviceCodeFlow( + *oauthConfig, + applicationID, + resource, + callback) + if err == nil { + err = saveToken(spt.Token) + } + case refreshMode: + _, err = refreshToken( + *oauthConfig, + applicationID, + resource, + tokenCachePath, + callback) + } + + if err != nil { + log.Fatalf("Failed to acquire a token for resource %s. Error: %v", resource, err) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go index 63681958d1..12375e0e4b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go @@ -1,51 +1,51 @@ -package adal - -import ( - "fmt" - "net/url" -) - -const ( - activeDirectoryAPIVersion = "1.0" -) - -// OAuthConfig represents the endpoints needed -// in OAuth operations -type OAuthConfig struct { - AuthorityEndpoint url.URL - AuthorizeEndpoint url.URL - TokenEndpoint url.URL - DeviceCodeEndpoint url.URL -} - -// NewOAuthConfig returns an OAuthConfig with tenant specific urls -func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) { - const activeDirectoryEndpointTemplate = "%s/oauth2/%s?api-version=%s" - u, err := url.Parse(activeDirectoryEndpoint) - if err != nil { - return nil, err - } - authorityURL, err := u.Parse(tenantID) - if err != nil { - return nil, err - } - authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", activeDirectoryAPIVersion)) - if err != nil { - return nil, err - } - tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", activeDirectoryAPIVersion)) - if err != nil { - return nil, err - } - deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", activeDirectoryAPIVersion)) - if err != nil { - return nil, err - } - - return &OAuthConfig{ - AuthorityEndpoint: *authorityURL, - AuthorizeEndpoint: *authorizeURL, - TokenEndpoint: *tokenURL, - DeviceCodeEndpoint: *deviceCodeURL, - }, nil -} +package adal + +import ( + "fmt" + "net/url" +) + +const ( + activeDirectoryAPIVersion = "1.0" +) + +// OAuthConfig represents the endpoints needed +// in OAuth operations +type OAuthConfig struct { + AuthorityEndpoint url.URL + AuthorizeEndpoint url.URL + TokenEndpoint url.URL + DeviceCodeEndpoint url.URL +} + +// NewOAuthConfig returns an OAuthConfig with tenant specific urls +func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) { + const activeDirectoryEndpointTemplate = "%s/oauth2/%s?api-version=%s" + u, err := url.Parse(activeDirectoryEndpoint) + if err != nil { + return nil, err + } + authorityURL, err := u.Parse(tenantID) + if err != nil { + return nil, err + } + authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", activeDirectoryAPIVersion)) + if err != nil { + return nil, err + } + tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", activeDirectoryAPIVersion)) + if err != nil { + return nil, err + } + deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", activeDirectoryAPIVersion)) + if err != nil { + return nil, err + } + + return &OAuthConfig{ + AuthorityEndpoint: *authorityURL, + AuthorizeEndpoint: *authorizeURL, + TokenEndpoint: *tokenURL, + DeviceCodeEndpoint: *deviceCodeURL, + }, nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config_test.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config_test.go index dbe4cdaca1..e8a58809eb 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/config_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config_test.go @@ -1,30 +1,30 @@ -package adal - -import ( - "testing" -) - -func TestNewOAuthConfig(t *testing.T) { - const testActiveDirectoryEndpoint = "https://login.test.com" - const testTenantID = "tenant-id-test" - - config, err := NewOAuthConfig(testActiveDirectoryEndpoint, testTenantID) - if err != nil { - t.Fatalf("autorest/adal: Unexpected error while creating oauth configuration for tenant: %v.", err) - } - - expected := "https://login.test.com/tenant-id-test/oauth2/authorize?api-version=1.0" - if config.AuthorizeEndpoint.String() != expected { - t.Fatalf("autorest/adal: Incorrect authorize url for Tenant from Environment. expected(%s). actual(%v).", expected, config.AuthorizeEndpoint) - } - - expected = "https://login.test.com/tenant-id-test/oauth2/token?api-version=1.0" - if config.TokenEndpoint.String() != expected { - t.Fatalf("autorest/adal: Incorrect authorize url for Tenant from Environment. expected(%s). actual(%v).", expected, config.TokenEndpoint) - } - - expected = "https://login.test.com/tenant-id-test/oauth2/devicecode?api-version=1.0" - if config.DeviceCodeEndpoint.String() != expected { - t.Fatalf("autorest/adal Incorrect devicecode url for Tenant from Environment. expected(%s). actual(%v).", expected, config.DeviceCodeEndpoint) - } -} +package adal + +import ( + "testing" +) + +func TestNewOAuthConfig(t *testing.T) { + const testActiveDirectoryEndpoint = "https://login.test.com" + const testTenantID = "tenant-id-test" + + config, err := NewOAuthConfig(testActiveDirectoryEndpoint, testTenantID) + if err != nil { + t.Fatalf("autorest/adal: Unexpected error while creating oauth configuration for tenant: %v.", err) + } + + expected := "https://login.test.com/tenant-id-test/oauth2/authorize?api-version=1.0" + if config.AuthorizeEndpoint.String() != expected { + t.Fatalf("autorest/adal: Incorrect authorize url for Tenant from Environment. expected(%s). actual(%v).", expected, config.AuthorizeEndpoint) + } + + expected = "https://login.test.com/tenant-id-test/oauth2/token?api-version=1.0" + if config.TokenEndpoint.String() != expected { + t.Fatalf("autorest/adal: Incorrect authorize url for Tenant from Environment. expected(%s). actual(%v).", expected, config.TokenEndpoint) + } + + expected = "https://login.test.com/tenant-id-test/oauth2/devicecode?api-version=1.0" + if config.DeviceCodeEndpoint.String() != expected { + t.Fatalf("autorest/adal Incorrect devicecode url for Tenant from Environment. expected(%s). actual(%v).", expected, config.DeviceCodeEndpoint) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go index 151daa582f..6c511f8c87 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go @@ -1,228 +1,228 @@ -package adal - -/* - This file is largely based on rjw57/oauth2device's code, with the follow differences: - * scope -> resource, and only allow a single one - * receive "Message" in the DeviceCode struct and show it to users as the prompt - * azure-xplat-cli has the following behavior that this emulates: - - does not send client_secret during the token exchange - - sends resource again in the token exchange request -*/ - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strings" - "time" -) - -const ( - logPrefix = "autorest/adal/devicetoken:" -) - -var ( - // ErrDeviceGeneric represents an unknown error from the token endpoint when using device flow - ErrDeviceGeneric = fmt.Errorf("%s Error while retrieving OAuth token: Unknown Error", logPrefix) - - // ErrDeviceAccessDenied represents an access denied error from the token endpoint when using device flow - ErrDeviceAccessDenied = fmt.Errorf("%s Error while retrieving OAuth token: Access Denied", logPrefix) - - // ErrDeviceAuthorizationPending represents the server waiting on the user to complete the device flow - ErrDeviceAuthorizationPending = fmt.Errorf("%s Error while retrieving OAuth token: Authorization Pending", logPrefix) - - // ErrDeviceCodeExpired represents the server timing out and expiring the code during device flow - ErrDeviceCodeExpired = fmt.Errorf("%s Error while retrieving OAuth token: Code Expired", logPrefix) - - // ErrDeviceSlowDown represents the service telling us we're polling too often during device flow - ErrDeviceSlowDown = fmt.Errorf("%s Error while retrieving OAuth token: Slow Down", logPrefix) - - // ErrDeviceCodeEmpty represents an empty device code from the device endpoint while using device flow - ErrDeviceCodeEmpty = fmt.Errorf("%s Error while retrieving device code: Device Code Empty", logPrefix) - - // ErrOAuthTokenEmpty represents an empty OAuth token from the token endpoint when using device flow - ErrOAuthTokenEmpty = fmt.Errorf("%s Error while retrieving OAuth token: Token Empty", logPrefix) - - errCodeSendingFails = "Error occurred while sending request for Device Authorization Code" - errCodeHandlingFails = "Error occurred while handling response from the Device Endpoint" - errTokenSendingFails = "Error occurred while sending request with device code for a token" - errTokenHandlingFails = "Error occurred while handling response from the Token Endpoint (during device flow)" - errStatusNotOK = "Error HTTP status != 200" -) - -// DeviceCode is the object returned by the device auth endpoint -// It contains information to instruct the user to complete the auth flow -type DeviceCode struct { - DeviceCode *string `json:"device_code,omitempty"` - UserCode *string `json:"user_code,omitempty"` - VerificationURL *string `json:"verification_url,omitempty"` - ExpiresIn *int64 `json:"expires_in,string,omitempty"` - Interval *int64 `json:"interval,string,omitempty"` - - Message *string `json:"message"` // Azure specific - Resource string // store the following, stored when initiating, used when exchanging - OAuthConfig OAuthConfig - ClientID string -} - -// TokenError is the object returned by the token exchange endpoint -// when something is amiss -type TokenError struct { - Error *string `json:"error,omitempty"` - ErrorCodes []int `json:"error_codes,omitempty"` - ErrorDescription *string `json:"error_description,omitempty"` - Timestamp *string `json:"timestamp,omitempty"` - TraceID *string `json:"trace_id,omitempty"` -} - -// DeviceToken is the object return by the token exchange endpoint -// It can either look like a Token or an ErrorToken, so put both here -// and check for presence of "Error" to know if we are in error state -type deviceToken struct { - Token - TokenError -} - -// InitiateDeviceAuth initiates a device auth flow. It returns a DeviceCode -// that can be used with CheckForUserCompletion or WaitForUserCompletion. -func InitiateDeviceAuth(sender Sender, oauthConfig OAuthConfig, clientID, resource string) (*DeviceCode, error) { - v := url.Values{ - "client_id": []string{clientID}, - "resource": []string{resource}, - } - - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - - req, err := http.NewRequest(http.MethodPost, oauthConfig.DeviceCodeEndpoint.String(), body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) - } - - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - resp, err := sender.Do(req) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) - } - defer resp.Body.Close() - - rb, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, err.Error()) - } - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, errStatusNotOK) - } - - if len(strings.Trim(string(rb), " ")) == 0 { - return nil, ErrDeviceCodeEmpty - } - - var code DeviceCode - err = json.Unmarshal(rb, &code) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, err.Error()) - } - - code.ClientID = clientID - code.Resource = resource - code.OAuthConfig = oauthConfig - - return &code, nil -} - -// CheckForUserCompletion takes a DeviceCode and checks with the Azure AD OAuth endpoint -// to see if the device flow has: been completed, timed out, or otherwise failed -func CheckForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { - v := url.Values{ - "client_id": []string{code.ClientID}, - "code": []string{*code.DeviceCode}, - "grant_type": []string{OAuthGrantTypeDeviceCode}, - "resource": []string{code.Resource}, - } - - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - - req, err := http.NewRequest(http.MethodPost, code.OAuthConfig.TokenEndpoint.String(), body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) - } - - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - resp, err := sender.Do(req) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) - } - defer resp.Body.Close() - - rb, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, err.Error()) - } - - if resp.StatusCode != http.StatusOK && len(strings.Trim(string(rb), " ")) == 0 { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, errStatusNotOK) - } - if len(strings.Trim(string(rb), " ")) == 0 { - return nil, ErrOAuthTokenEmpty - } - - var token deviceToken - err = json.Unmarshal(rb, &token) - if err != nil { - return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, err.Error()) - } - - if token.Error == nil { - return &token.Token, nil - } - - switch *token.Error { - case "authorization_pending": - return nil, ErrDeviceAuthorizationPending - case "slow_down": - return nil, ErrDeviceSlowDown - case "access_denied": - return nil, ErrDeviceAccessDenied - case "code_expired": - return nil, ErrDeviceCodeExpired - default: - return nil, ErrDeviceGeneric - } -} - -// WaitForUserCompletion calls CheckForUserCompletion repeatedly until a token is granted or an error state occurs. -// This prevents the user from looping and checking against 'ErrDeviceAuthorizationPending'. -func WaitForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { - intervalDuration := time.Duration(*code.Interval) * time.Second - waitDuration := intervalDuration - - for { - token, err := CheckForUserCompletion(sender, code) - - if err == nil { - return token, nil - } - - switch err { - case ErrDeviceSlowDown: - waitDuration += waitDuration - case ErrDeviceAuthorizationPending: - // noop - default: // everything else is "fatal" to us - return nil, err - } - - if waitDuration > (intervalDuration * 3) { - return nil, fmt.Errorf("%s Error waiting for user to complete device flow. Server told us to slow_down too much", logPrefix) - } - - time.Sleep(waitDuration) - } -} +package adal + +/* + This file is largely based on rjw57/oauth2device's code, with the follow differences: + * scope -> resource, and only allow a single one + * receive "Message" in the DeviceCode struct and show it to users as the prompt + * azure-xplat-cli has the following behavior that this emulates: + - does not send client_secret during the token exchange + - sends resource again in the token exchange request +*/ + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + "time" +) + +const ( + logPrefix = "autorest/adal/devicetoken:" +) + +var ( + // ErrDeviceGeneric represents an unknown error from the token endpoint when using device flow + ErrDeviceGeneric = fmt.Errorf("%s Error while retrieving OAuth token: Unknown Error", logPrefix) + + // ErrDeviceAccessDenied represents an access denied error from the token endpoint when using device flow + ErrDeviceAccessDenied = fmt.Errorf("%s Error while retrieving OAuth token: Access Denied", logPrefix) + + // ErrDeviceAuthorizationPending represents the server waiting on the user to complete the device flow + ErrDeviceAuthorizationPending = fmt.Errorf("%s Error while retrieving OAuth token: Authorization Pending", logPrefix) + + // ErrDeviceCodeExpired represents the server timing out and expiring the code during device flow + ErrDeviceCodeExpired = fmt.Errorf("%s Error while retrieving OAuth token: Code Expired", logPrefix) + + // ErrDeviceSlowDown represents the service telling us we're polling too often during device flow + ErrDeviceSlowDown = fmt.Errorf("%s Error while retrieving OAuth token: Slow Down", logPrefix) + + // ErrDeviceCodeEmpty represents an empty device code from the device endpoint while using device flow + ErrDeviceCodeEmpty = fmt.Errorf("%s Error while retrieving device code: Device Code Empty", logPrefix) + + // ErrOAuthTokenEmpty represents an empty OAuth token from the token endpoint when using device flow + ErrOAuthTokenEmpty = fmt.Errorf("%s Error while retrieving OAuth token: Token Empty", logPrefix) + + errCodeSendingFails = "Error occurred while sending request for Device Authorization Code" + errCodeHandlingFails = "Error occurred while handling response from the Device Endpoint" + errTokenSendingFails = "Error occurred while sending request with device code for a token" + errTokenHandlingFails = "Error occurred while handling response from the Token Endpoint (during device flow)" + errStatusNotOK = "Error HTTP status != 200" +) + +// DeviceCode is the object returned by the device auth endpoint +// It contains information to instruct the user to complete the auth flow +type DeviceCode struct { + DeviceCode *string `json:"device_code,omitempty"` + UserCode *string `json:"user_code,omitempty"` + VerificationURL *string `json:"verification_url,omitempty"` + ExpiresIn *int64 `json:"expires_in,string,omitempty"` + Interval *int64 `json:"interval,string,omitempty"` + + Message *string `json:"message"` // Azure specific + Resource string // store the following, stored when initiating, used when exchanging + OAuthConfig OAuthConfig + ClientID string +} + +// TokenError is the object returned by the token exchange endpoint +// when something is amiss +type TokenError struct { + Error *string `json:"error,omitempty"` + ErrorCodes []int `json:"error_codes,omitempty"` + ErrorDescription *string `json:"error_description,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + TraceID *string `json:"trace_id,omitempty"` +} + +// DeviceToken is the object return by the token exchange endpoint +// It can either look like a Token or an ErrorToken, so put both here +// and check for presence of "Error" to know if we are in error state +type deviceToken struct { + Token + TokenError +} + +// InitiateDeviceAuth initiates a device auth flow. It returns a DeviceCode +// that can be used with CheckForUserCompletion or WaitForUserCompletion. +func InitiateDeviceAuth(sender Sender, oauthConfig OAuthConfig, clientID, resource string) (*DeviceCode, error) { + v := url.Values{ + "client_id": []string{clientID}, + "resource": []string{resource}, + } + + s := v.Encode() + body := ioutil.NopCloser(strings.NewReader(s)) + + req, err := http.NewRequest(http.MethodPost, oauthConfig.DeviceCodeEndpoint.String(), body) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) + } + + req.ContentLength = int64(len(s)) + req.Header.Set(contentType, mimeTypeFormPost) + resp, err := sender.Do(req) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) + } + defer resp.Body.Close() + + rb, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, err.Error()) + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, errStatusNotOK) + } + + if len(strings.Trim(string(rb), " ")) == 0 { + return nil, ErrDeviceCodeEmpty + } + + var code DeviceCode + err = json.Unmarshal(rb, &code) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeHandlingFails, err.Error()) + } + + code.ClientID = clientID + code.Resource = resource + code.OAuthConfig = oauthConfig + + return &code, nil +} + +// CheckForUserCompletion takes a DeviceCode and checks with the Azure AD OAuth endpoint +// to see if the device flow has: been completed, timed out, or otherwise failed +func CheckForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { + v := url.Values{ + "client_id": []string{code.ClientID}, + "code": []string{*code.DeviceCode}, + "grant_type": []string{OAuthGrantTypeDeviceCode}, + "resource": []string{code.Resource}, + } + + s := v.Encode() + body := ioutil.NopCloser(strings.NewReader(s)) + + req, err := http.NewRequest(http.MethodPost, code.OAuthConfig.TokenEndpoint.String(), body) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) + } + + req.ContentLength = int64(len(s)) + req.Header.Set(contentType, mimeTypeFormPost) + resp, err := sender.Do(req) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) + } + defer resp.Body.Close() + + rb, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, err.Error()) + } + + if resp.StatusCode != http.StatusOK && len(strings.Trim(string(rb), " ")) == 0 { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, errStatusNotOK) + } + if len(strings.Trim(string(rb), " ")) == 0 { + return nil, ErrOAuthTokenEmpty + } + + var token deviceToken + err = json.Unmarshal(rb, &token) + if err != nil { + return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenHandlingFails, err.Error()) + } + + if token.Error == nil { + return &token.Token, nil + } + + switch *token.Error { + case "authorization_pending": + return nil, ErrDeviceAuthorizationPending + case "slow_down": + return nil, ErrDeviceSlowDown + case "access_denied": + return nil, ErrDeviceAccessDenied + case "code_expired": + return nil, ErrDeviceCodeExpired + default: + return nil, ErrDeviceGeneric + } +} + +// WaitForUserCompletion calls CheckForUserCompletion repeatedly until a token is granted or an error state occurs. +// This prevents the user from looping and checking against 'ErrDeviceAuthorizationPending'. +func WaitForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { + intervalDuration := time.Duration(*code.Interval) * time.Second + waitDuration := intervalDuration + + for { + token, err := CheckForUserCompletion(sender, code) + + if err == nil { + return token, nil + } + + switch err { + case ErrDeviceSlowDown: + waitDuration += waitDuration + case ErrDeviceAuthorizationPending: + // noop + default: // everything else is "fatal" to us + return nil, err + } + + if waitDuration > (intervalDuration * 3) { + return nil, fmt.Errorf("%s Error waiting for user to complete device flow. Server told us to slow_down too much", logPrefix) + } + + time.Sleep(waitDuration) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken_test.go b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken_test.go index 78b586040a..f7bf0a79de 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken_test.go @@ -1,316 +1,316 @@ -package adal - -import ( - "encoding/json" - "fmt" - "net/http" - "strings" - "testing" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -const ( - TestResource = "SomeResource" - TestClientID = "SomeClientID" - TestTenantID = "SomeTenantID" - TestActiveDirectoryEndpoint = "https://login.test.com/" -) - -var ( - testOAuthConfig, _ = NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) - TestOAuthConfig = *testOAuthConfig -) - -const MockDeviceCodeResponse = ` -{ - "device_code": "10000-40-1234567890", - "user_code": "ABCDEF", - "verification_url": "http://aka.ms/deviceauth", - "expires_in": "900", - "interval": "0" -} -` - -const MockDeviceTokenResponse = `{ - "access_token": "accessToken", - "refresh_token": "refreshToken", - "expires_in": "1000", - "expires_on": "2000", - "not_before": "3000", - "resource": "resource", - "token_type": "type" -} -` - -func TestDeviceCodeIncludesResource(t *testing.T) { - sender := mocks.NewSender() - sender.AppendResponse(mocks.NewResponseWithContent(MockDeviceCodeResponse)) - - code, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) - if err != nil { - t.Fatalf("adal: unexpected error initiating device auth") - } - - if code.Resource != TestResource { - t.Fatalf("adal: InitiateDeviceAuth failed to stash the resource in the DeviceCode struct") - } -} - -func TestDeviceCodeReturnsErrorIfSendingFails(t *testing.T) { - sender := mocks.NewSender() - sender.SetError(fmt.Errorf("this is an error")) - - _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) - if err == nil || !strings.Contains(err.Error(), errCodeSendingFails) { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errCodeSendingFails, err.Error()) - } -} - -func TestDeviceCodeReturnsErrorIfBadRequest(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody("doesn't matter") - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) - - _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) - if err == nil || !strings.Contains(err.Error(), errCodeHandlingFails) { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errCodeHandlingFails, err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceCodeReturnsErrorIfCannotDeserializeDeviceCode(t *testing.T) { - gibberishJSON := strings.Replace(MockDeviceCodeResponse, "expires_in", "\":, :gibberish", -1) - sender := mocks.NewSender() - body := mocks.NewBody(gibberishJSON) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) - - _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) - if err == nil || !strings.Contains(err.Error(), errCodeHandlingFails) { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errCodeHandlingFails, err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceCodeReturnsErrorIfEmptyDeviceCode(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody("") - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) - - _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) - if err != ErrDeviceCodeEmpty { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", ErrDeviceCodeEmpty, err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func deviceCode() *DeviceCode { - var deviceCode DeviceCode - _ = json.Unmarshal([]byte(MockDeviceCodeResponse), &deviceCode) - deviceCode.Resource = TestResource - deviceCode.ClientID = TestClientID - return &deviceCode -} - -func TestDeviceTokenReturns(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody(MockDeviceTokenResponse) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err != nil { - t.Fatalf("adal: got error unexpectedly") - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceTokenReturnsErrorIfSendingFails(t *testing.T) { - sender := mocks.NewSender() - sender.SetError(fmt.Errorf("this is an error")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err == nil || !strings.Contains(err.Error(), errTokenSendingFails) { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errTokenSendingFails, err.Error()) - } -} - -func TestDeviceTokenReturnsErrorIfServerError(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody("") - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusInternalServerError, "Internal Server Error")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err == nil || !strings.Contains(err.Error(), errTokenHandlingFails) { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errTokenHandlingFails, err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceTokenReturnsErrorIfCannotDeserializeDeviceToken(t *testing.T) { - gibberishJSON := strings.Replace(MockDeviceTokenResponse, "expires_in", ";:\"gibberish", -1) - sender := mocks.NewSender() - body := mocks.NewBody(gibberishJSON) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err == nil || !strings.Contains(err.Error(), errTokenHandlingFails) { - t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errTokenHandlingFails, err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func errorDeviceTokenResponse(message string) string { - return `{ "error": "` + message + `" }` -} - -func TestDeviceTokenReturnsErrorIfAuthorizationPending(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody(errorDeviceTokenResponse("authorization_pending")) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) - - _, err := CheckForUserCompletion(sender, deviceCode()) - if err != ErrDeviceAuthorizationPending { - t.Fatalf("!!!") - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceTokenReturnsErrorIfSlowDown(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody(errorDeviceTokenResponse("slow_down")) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) - - _, err := CheckForUserCompletion(sender, deviceCode()) - if err != ErrDeviceSlowDown { - t.Fatalf("!!!") - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -type deviceTokenSender struct { - errorString string - attempts int -} - -func newDeviceTokenSender(deviceErrorString string) *deviceTokenSender { - return &deviceTokenSender{errorString: deviceErrorString, attempts: 0} -} - -func (s *deviceTokenSender) Do(req *http.Request) (*http.Response, error) { - var resp *http.Response - if s.attempts < 1 { - s.attempts++ - resp = mocks.NewResponseWithContent(errorDeviceTokenResponse(s.errorString)) - } else { - resp = mocks.NewResponseWithContent(MockDeviceTokenResponse) - } - return resp, nil -} - -// since the above only exercise CheckForUserCompletion, we repeat the test here, -// but with the intent of showing that WaitForUserCompletion loops properly. -func TestDeviceTokenSucceedsWithIntermediateAuthPending(t *testing.T) { - sender := newDeviceTokenSender("authorization_pending") - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err != nil { - t.Fatalf("unexpected error occurred") - } -} - -// same as above but with SlowDown now -func TestDeviceTokenSucceedsWithIntermediateSlowDown(t *testing.T) { - sender := newDeviceTokenSender("slow_down") - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err != nil { - t.Fatalf("unexpected error occurred") - } -} - -func TestDeviceTokenReturnsErrorIfAccessDenied(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody(errorDeviceTokenResponse("access_denied")) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err != ErrDeviceAccessDenied { - t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrDeviceAccessDenied.Error(), err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceTokenReturnsErrorIfCodeExpired(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody(errorDeviceTokenResponse("code_expired")) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err != ErrDeviceCodeExpired { - t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrDeviceCodeExpired.Error(), err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceTokenReturnsErrorForUnknownError(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody(errorDeviceTokenResponse("unknown_error")) - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err == nil { - t.Fatalf("failed to get error") - } - if err != ErrDeviceGeneric { - t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrDeviceGeneric.Error(), err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} - -func TestDeviceTokenReturnsErrorIfTokenEmptyAndStatusOK(t *testing.T) { - sender := mocks.NewSender() - body := mocks.NewBody("") - sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) - - _, err := WaitForUserCompletion(sender, deviceCode()) - if err != ErrOAuthTokenEmpty { - t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrOAuthTokenEmpty.Error(), err.Error()) - } - - if body.IsOpen() { - t.Fatalf("response body was left open!") - } -} +package adal + +import ( + "encoding/json" + "fmt" + "net/http" + "strings" + "testing" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +const ( + TestResource = "SomeResource" + TestClientID = "SomeClientID" + TestTenantID = "SomeTenantID" + TestActiveDirectoryEndpoint = "https://login.test.com/" +) + +var ( + testOAuthConfig, _ = NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) + TestOAuthConfig = *testOAuthConfig +) + +const MockDeviceCodeResponse = ` +{ + "device_code": "10000-40-1234567890", + "user_code": "ABCDEF", + "verification_url": "http://aka.ms/deviceauth", + "expires_in": "900", + "interval": "0" +} +` + +const MockDeviceTokenResponse = `{ + "access_token": "accessToken", + "refresh_token": "refreshToken", + "expires_in": "1000", + "expires_on": "2000", + "not_before": "3000", + "resource": "resource", + "token_type": "type" +} +` + +func TestDeviceCodeIncludesResource(t *testing.T) { + sender := mocks.NewSender() + sender.AppendResponse(mocks.NewResponseWithContent(MockDeviceCodeResponse)) + + code, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) + if err != nil { + t.Fatalf("adal: unexpected error initiating device auth") + } + + if code.Resource != TestResource { + t.Fatalf("adal: InitiateDeviceAuth failed to stash the resource in the DeviceCode struct") + } +} + +func TestDeviceCodeReturnsErrorIfSendingFails(t *testing.T) { + sender := mocks.NewSender() + sender.SetError(fmt.Errorf("this is an error")) + + _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) + if err == nil || !strings.Contains(err.Error(), errCodeSendingFails) { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errCodeSendingFails, err.Error()) + } +} + +func TestDeviceCodeReturnsErrorIfBadRequest(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody("doesn't matter") + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) + + _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) + if err == nil || !strings.Contains(err.Error(), errCodeHandlingFails) { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errCodeHandlingFails, err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceCodeReturnsErrorIfCannotDeserializeDeviceCode(t *testing.T) { + gibberishJSON := strings.Replace(MockDeviceCodeResponse, "expires_in", "\":, :gibberish", -1) + sender := mocks.NewSender() + body := mocks.NewBody(gibberishJSON) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) + + _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) + if err == nil || !strings.Contains(err.Error(), errCodeHandlingFails) { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errCodeHandlingFails, err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceCodeReturnsErrorIfEmptyDeviceCode(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody("") + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) + + _, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) + if err != ErrDeviceCodeEmpty { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", ErrDeviceCodeEmpty, err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func deviceCode() *DeviceCode { + var deviceCode DeviceCode + _ = json.Unmarshal([]byte(MockDeviceCodeResponse), &deviceCode) + deviceCode.Resource = TestResource + deviceCode.ClientID = TestClientID + return &deviceCode +} + +func TestDeviceTokenReturns(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody(MockDeviceTokenResponse) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err != nil { + t.Fatalf("adal: got error unexpectedly") + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceTokenReturnsErrorIfSendingFails(t *testing.T) { + sender := mocks.NewSender() + sender.SetError(fmt.Errorf("this is an error")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err == nil || !strings.Contains(err.Error(), errTokenSendingFails) { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errTokenSendingFails, err.Error()) + } +} + +func TestDeviceTokenReturnsErrorIfServerError(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody("") + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusInternalServerError, "Internal Server Error")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err == nil || !strings.Contains(err.Error(), errTokenHandlingFails) { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errTokenHandlingFails, err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceTokenReturnsErrorIfCannotDeserializeDeviceToken(t *testing.T) { + gibberishJSON := strings.Replace(MockDeviceTokenResponse, "expires_in", ";:\"gibberish", -1) + sender := mocks.NewSender() + body := mocks.NewBody(gibberishJSON) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err == nil || !strings.Contains(err.Error(), errTokenHandlingFails) { + t.Fatalf("adal: failed to get correct error expected(%s) actual(%s)", errTokenHandlingFails, err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func errorDeviceTokenResponse(message string) string { + return `{ "error": "` + message + `" }` +} + +func TestDeviceTokenReturnsErrorIfAuthorizationPending(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody(errorDeviceTokenResponse("authorization_pending")) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) + + _, err := CheckForUserCompletion(sender, deviceCode()) + if err != ErrDeviceAuthorizationPending { + t.Fatalf("!!!") + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceTokenReturnsErrorIfSlowDown(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody(errorDeviceTokenResponse("slow_down")) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) + + _, err := CheckForUserCompletion(sender, deviceCode()) + if err != ErrDeviceSlowDown { + t.Fatalf("!!!") + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +type deviceTokenSender struct { + errorString string + attempts int +} + +func newDeviceTokenSender(deviceErrorString string) *deviceTokenSender { + return &deviceTokenSender{errorString: deviceErrorString, attempts: 0} +} + +func (s *deviceTokenSender) Do(req *http.Request) (*http.Response, error) { + var resp *http.Response + if s.attempts < 1 { + s.attempts++ + resp = mocks.NewResponseWithContent(errorDeviceTokenResponse(s.errorString)) + } else { + resp = mocks.NewResponseWithContent(MockDeviceTokenResponse) + } + return resp, nil +} + +// since the above only exercise CheckForUserCompletion, we repeat the test here, +// but with the intent of showing that WaitForUserCompletion loops properly. +func TestDeviceTokenSucceedsWithIntermediateAuthPending(t *testing.T) { + sender := newDeviceTokenSender("authorization_pending") + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err != nil { + t.Fatalf("unexpected error occurred") + } +} + +// same as above but with SlowDown now +func TestDeviceTokenSucceedsWithIntermediateSlowDown(t *testing.T) { + sender := newDeviceTokenSender("slow_down") + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err != nil { + t.Fatalf("unexpected error occurred") + } +} + +func TestDeviceTokenReturnsErrorIfAccessDenied(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody(errorDeviceTokenResponse("access_denied")) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err != ErrDeviceAccessDenied { + t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrDeviceAccessDenied.Error(), err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceTokenReturnsErrorIfCodeExpired(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody(errorDeviceTokenResponse("code_expired")) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err != ErrDeviceCodeExpired { + t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrDeviceCodeExpired.Error(), err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceTokenReturnsErrorForUnknownError(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody(errorDeviceTokenResponse("unknown_error")) + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusBadRequest, "Bad Request")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err == nil { + t.Fatalf("failed to get error") + } + if err != ErrDeviceGeneric { + t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrDeviceGeneric.Error(), err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} + +func TestDeviceTokenReturnsErrorIfTokenEmptyAndStatusOK(t *testing.T) { + sender := mocks.NewSender() + body := mocks.NewBody("") + sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) + + _, err := WaitForUserCompletion(sender, deviceCode()) + if err != ErrOAuthTokenEmpty { + t.Fatalf("adal: got wrong error expected(%s) actual(%s)", ErrOAuthTokenEmpty.Error(), err.Error()) + } + + if body.IsOpen() { + t.Fatalf("response body was left open!") + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go index ce09567382..73711c6674 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go @@ -1,59 +1,59 @@ -package adal - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path/filepath" -) - -// LoadToken restores a Token object from a file located at 'path'. -func LoadToken(path string) (*Token, error) { - file, err := os.Open(path) - if err != nil { - return nil, fmt.Errorf("failed to open file (%s) while loading token: %v", path, err) - } - defer file.Close() - - var token Token - - dec := json.NewDecoder(file) - if err = dec.Decode(&token); err != nil { - return nil, fmt.Errorf("failed to decode contents of file (%s) into Token representation: %v", path, err) - } - return &token, nil -} - -// SaveToken persists an oauth token at the given location on disk. -// It moves the new file into place so it can safely be used to replace an existing file -// that maybe accessed by multiple processes. -func SaveToken(path string, mode os.FileMode, token Token) error { - dir := filepath.Dir(path) - err := os.MkdirAll(dir, os.ModePerm) - if err != nil { - return fmt.Errorf("failed to create directory (%s) to store token in: %v", dir, err) - } - - newFile, err := ioutil.TempFile(dir, "token") - if err != nil { - return fmt.Errorf("failed to create the temp file to write the token: %v", err) - } - tempPath := newFile.Name() - - if err := json.NewEncoder(newFile).Encode(token); err != nil { - return fmt.Errorf("failed to encode token to file (%s) while saving token: %v", tempPath, err) - } - if err := newFile.Close(); err != nil { - return fmt.Errorf("failed to close temp file %s: %v", tempPath, err) - } - - // Atomic replace to avoid multi-writer file corruptions - if err := os.Rename(tempPath, path); err != nil { - return fmt.Errorf("failed to move temporary token to desired output location. src=%s dst=%s: %v", tempPath, path, err) - } - if err := os.Chmod(path, mode); err != nil { - return fmt.Errorf("failed to chmod the token file %s: %v", path, err) - } - return nil -} +package adal + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" +) + +// LoadToken restores a Token object from a file located at 'path'. +func LoadToken(path string) (*Token, error) { + file, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("failed to open file (%s) while loading token: %v", path, err) + } + defer file.Close() + + var token Token + + dec := json.NewDecoder(file) + if err = dec.Decode(&token); err != nil { + return nil, fmt.Errorf("failed to decode contents of file (%s) into Token representation: %v", path, err) + } + return &token, nil +} + +// SaveToken persists an oauth token at the given location on disk. +// It moves the new file into place so it can safely be used to replace an existing file +// that maybe accessed by multiple processes. +func SaveToken(path string, mode os.FileMode, token Token) error { + dir := filepath.Dir(path) + err := os.MkdirAll(dir, os.ModePerm) + if err != nil { + return fmt.Errorf("failed to create directory (%s) to store token in: %v", dir, err) + } + + newFile, err := ioutil.TempFile(dir, "token") + if err != nil { + return fmt.Errorf("failed to create the temp file to write the token: %v", err) + } + tempPath := newFile.Name() + + if err := json.NewEncoder(newFile).Encode(token); err != nil { + return fmt.Errorf("failed to encode token to file (%s) while saving token: %v", tempPath, err) + } + if err := newFile.Close(); err != nil { + return fmt.Errorf("failed to close temp file %s: %v", tempPath, err) + } + + // Atomic replace to avoid multi-writer file corruptions + if err := os.Rename(tempPath, path); err != nil { + return fmt.Errorf("failed to move temporary token to desired output location. src=%s dst=%s: %v", tempPath, path, err) + } + if err := os.Chmod(path, mode); err != nil { + return fmt.Errorf("failed to chmod the token file %s: %v", path, err) + } + return nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/persist_test.go b/vendor/github.com/Azure/go-autorest/autorest/adal/persist_test.go index f76afd9a69..12c7ecbbba 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/persist_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/persist_test.go @@ -1,157 +1,157 @@ -package adal - -import ( - "encoding/json" - "io/ioutil" - "os" - "path" - "reflect" - "runtime" - "strings" - "testing" -) - -const MockTokenJSON string = `{ - "access_token": "accessToken", - "refresh_token": "refreshToken", - "expires_in": "1000", - "expires_on": "2000", - "not_before": "3000", - "resource": "resource", - "token_type": "type" -}` - -var TestToken = Token{ - AccessToken: "accessToken", - RefreshToken: "refreshToken", - ExpiresIn: "1000", - ExpiresOn: "2000", - NotBefore: "3000", - Resource: "resource", - Type: "type", -} - -func writeTestTokenFile(t *testing.T, suffix string, contents string) *os.File { - f, err := ioutil.TempFile(os.TempDir(), suffix) - if err != nil { - t.Fatalf("azure: unexpected error when creating temp file: %v", err) - } - defer f.Close() - - _, err = f.Write([]byte(contents)) - if err != nil { - t.Fatalf("azure: unexpected error when writing temp test file: %v", err) - } - - return f -} - -func TestLoadToken(t *testing.T) { - f := writeTestTokenFile(t, "testloadtoken", MockTokenJSON) - defer os.Remove(f.Name()) - - expectedToken := TestToken - actualToken, err := LoadToken(f.Name()) - if err != nil { - t.Fatalf("azure: unexpected error loading token from file: %v", err) - } - - if *actualToken != expectedToken { - t.Fatalf("azure: failed to decode properly expected(%v) actual(%v)", expectedToken, *actualToken) - } - - // test that LoadToken closes the file properly - err = SaveToken(f.Name(), 0600, *actualToken) - if err != nil { - t.Fatalf("azure: could not save token after LoadToken: %v", err) - } -} - -func TestLoadTokenFailsBadPath(t *testing.T) { - _, err := LoadToken("/tmp/this_file_should_never_exist_really") - expectedSubstring := "failed to open file" - if err == nil || !strings.Contains(err.Error(), expectedSubstring) { - t.Fatalf("azure: failed to get correct error expected(%s) actual(%s)", expectedSubstring, err.Error()) - } -} - -func TestLoadTokenFailsBadJson(t *testing.T) { - gibberishJSON := strings.Replace(MockTokenJSON, "expires_on", ";:\"gibberish", -1) - f := writeTestTokenFile(t, "testloadtokenfailsbadjson", gibberishJSON) - defer os.Remove(f.Name()) - - _, err := LoadToken(f.Name()) - expectedSubstring := "failed to decode contents of file" - if err == nil || !strings.Contains(err.Error(), expectedSubstring) { - t.Fatalf("azure: failed to get correct error expected(%s) actual(%s)", expectedSubstring, err.Error()) - } -} - -func token() *Token { - var token Token - json.Unmarshal([]byte(MockTokenJSON), &token) - return &token -} - -func TestSaveToken(t *testing.T) { - f, err := ioutil.TempFile("", "testloadtoken") - if err != nil { - t.Fatalf("azure: unexpected error when creating temp file: %v", err) - } - defer os.Remove(f.Name()) - f.Close() - - mode := os.ModePerm & 0642 - err = SaveToken(f.Name(), mode, *token()) - if err != nil { - t.Fatalf("azure: unexpected error saving token to file: %v", err) - } - fi, err := os.Stat(f.Name()) // open a new stat as held ones are not fresh - if err != nil { - t.Fatalf("azure: stat failed: %v", err) - } - if runtime.GOOS != "windows" { // permissions don't work on Windows - if perm := fi.Mode().Perm(); perm != mode { - t.Fatalf("azure: wrong file perm. got:%s; expected:%s file :%s", perm, mode, f.Name()) - } - } - - var actualToken Token - var expectedToken Token - - json.Unmarshal([]byte(MockTokenJSON), expectedToken) - - contents, err := ioutil.ReadFile(f.Name()) - if err != nil { - t.Fatal("!!") - } - json.Unmarshal(contents, actualToken) - - if !reflect.DeepEqual(actualToken, expectedToken) { - t.Fatal("azure: token was not serialized correctly") - } -} - -func TestSaveTokenFailsNoPermission(t *testing.T) { - pathWhereWeShouldntHavePermission := "/usr/thiswontwork/atall" - if runtime.GOOS == "windows" { - pathWhereWeShouldntHavePermission = path.Join(os.Getenv("windir"), "system32\\mytokendir\\mytoken") - } - err := SaveToken(pathWhereWeShouldntHavePermission, 0644, *token()) - expectedSubstring := "failed to create directory" - if err == nil || !strings.Contains(err.Error(), expectedSubstring) { - t.Fatalf("azure: failed to get correct error expected(%s) actual(%v)", expectedSubstring, err) - } -} - -func TestSaveTokenFailsCantCreate(t *testing.T) { - tokenPath := "/thiswontwork" - if runtime.GOOS == "windows" { - tokenPath = path.Join(os.Getenv("windir"), "system32") - } - err := SaveToken(tokenPath, 0644, *token()) - expectedSubstring := "failed to create the temp file to write the token" - if err == nil || !strings.Contains(err.Error(), expectedSubstring) { - t.Fatalf("azure: failed to get correct error expected(%s) actual(%v)", expectedSubstring, err) - } -} +package adal + +import ( + "encoding/json" + "io/ioutil" + "os" + "path" + "reflect" + "runtime" + "strings" + "testing" +) + +const MockTokenJSON string = `{ + "access_token": "accessToken", + "refresh_token": "refreshToken", + "expires_in": "1000", + "expires_on": "2000", + "not_before": "3000", + "resource": "resource", + "token_type": "type" +}` + +var TestToken = Token{ + AccessToken: "accessToken", + RefreshToken: "refreshToken", + ExpiresIn: "1000", + ExpiresOn: "2000", + NotBefore: "3000", + Resource: "resource", + Type: "type", +} + +func writeTestTokenFile(t *testing.T, suffix string, contents string) *os.File { + f, err := ioutil.TempFile(os.TempDir(), suffix) + if err != nil { + t.Fatalf("azure: unexpected error when creating temp file: %v", err) + } + defer f.Close() + + _, err = f.Write([]byte(contents)) + if err != nil { + t.Fatalf("azure: unexpected error when writing temp test file: %v", err) + } + + return f +} + +func TestLoadToken(t *testing.T) { + f := writeTestTokenFile(t, "testloadtoken", MockTokenJSON) + defer os.Remove(f.Name()) + + expectedToken := TestToken + actualToken, err := LoadToken(f.Name()) + if err != nil { + t.Fatalf("azure: unexpected error loading token from file: %v", err) + } + + if *actualToken != expectedToken { + t.Fatalf("azure: failed to decode properly expected(%v) actual(%v)", expectedToken, *actualToken) + } + + // test that LoadToken closes the file properly + err = SaveToken(f.Name(), 0600, *actualToken) + if err != nil { + t.Fatalf("azure: could not save token after LoadToken: %v", err) + } +} + +func TestLoadTokenFailsBadPath(t *testing.T) { + _, err := LoadToken("/tmp/this_file_should_never_exist_really") + expectedSubstring := "failed to open file" + if err == nil || !strings.Contains(err.Error(), expectedSubstring) { + t.Fatalf("azure: failed to get correct error expected(%s) actual(%s)", expectedSubstring, err.Error()) + } +} + +func TestLoadTokenFailsBadJson(t *testing.T) { + gibberishJSON := strings.Replace(MockTokenJSON, "expires_on", ";:\"gibberish", -1) + f := writeTestTokenFile(t, "testloadtokenfailsbadjson", gibberishJSON) + defer os.Remove(f.Name()) + + _, err := LoadToken(f.Name()) + expectedSubstring := "failed to decode contents of file" + if err == nil || !strings.Contains(err.Error(), expectedSubstring) { + t.Fatalf("azure: failed to get correct error expected(%s) actual(%s)", expectedSubstring, err.Error()) + } +} + +func token() *Token { + var token Token + json.Unmarshal([]byte(MockTokenJSON), &token) + return &token +} + +func TestSaveToken(t *testing.T) { + f, err := ioutil.TempFile("", "testloadtoken") + if err != nil { + t.Fatalf("azure: unexpected error when creating temp file: %v", err) + } + defer os.Remove(f.Name()) + f.Close() + + mode := os.ModePerm & 0642 + err = SaveToken(f.Name(), mode, *token()) + if err != nil { + t.Fatalf("azure: unexpected error saving token to file: %v", err) + } + fi, err := os.Stat(f.Name()) // open a new stat as held ones are not fresh + if err != nil { + t.Fatalf("azure: stat failed: %v", err) + } + if runtime.GOOS != "windows" { // permissions don't work on Windows + if perm := fi.Mode().Perm(); perm != mode { + t.Fatalf("azure: wrong file perm. got:%s; expected:%s file :%s", perm, mode, f.Name()) + } + } + + var actualToken Token + var expectedToken Token + + json.Unmarshal([]byte(MockTokenJSON), expectedToken) + + contents, err := ioutil.ReadFile(f.Name()) + if err != nil { + t.Fatal("!!") + } + json.Unmarshal(contents, actualToken) + + if !reflect.DeepEqual(actualToken, expectedToken) { + t.Fatal("azure: token was not serialized correctly") + } +} + +func TestSaveTokenFailsNoPermission(t *testing.T) { + pathWhereWeShouldntHavePermission := "/usr/thiswontwork/atall" + if runtime.GOOS == "windows" { + pathWhereWeShouldntHavePermission = path.Join(os.Getenv("windir"), "system32\\mytokendir\\mytoken") + } + err := SaveToken(pathWhereWeShouldntHavePermission, 0644, *token()) + expectedSubstring := "failed to create directory" + if err == nil || !strings.Contains(err.Error(), expectedSubstring) { + t.Fatalf("azure: failed to get correct error expected(%s) actual(%v)", expectedSubstring, err) + } +} + +func TestSaveTokenFailsCantCreate(t *testing.T) { + tokenPath := "/thiswontwork" + if runtime.GOOS == "windows" { + tokenPath = path.Join(os.Getenv("windir"), "system32") + } + err := SaveToken(tokenPath, 0644, *token()) + expectedSubstring := "failed to create the temp file to write the token" + if err == nil || !strings.Contains(err.Error(), expectedSubstring) { + t.Fatalf("azure: failed to get correct error expected(%s) actual(%v)", expectedSubstring, err) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go index 8d8cb1fb66..7928c971ab 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go @@ -1,46 +1,46 @@ -package adal - -import ( - "net/http" -) - -const ( - contentType = "Content-Type" - mimeTypeFormPost = "application/x-www-form-urlencoded" -) - -// Sender is the interface that wraps the Do method to send HTTP requests. -// -// The standard http.Client conforms to this interface. -type Sender interface { - Do(*http.Request) (*http.Response, error) -} - -// SenderFunc is a method that implements the Sender interface. -type SenderFunc func(*http.Request) (*http.Response, error) - -// Do implements the Sender interface on SenderFunc. -func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { - return sf(r) -} - -// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the -// http.Request and pass it along or, first, pass the http.Request along then react to the -// http.Response result. -type SendDecorator func(Sender) Sender - -// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. -func CreateSender(decorators ...SendDecorator) Sender { - return DecorateSender(&http.Client{}, decorators...) -} - -// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to -// the Sender. Decorators are applied in the order received, but their affect upon the request -// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a -// post-decorator (pass the http.Request along and react to the results in http.Response). -func DecorateSender(s Sender, decorators ...SendDecorator) Sender { - for _, decorate := range decorators { - s = decorate(s) - } - return s -} +package adal + +import ( + "net/http" +) + +const ( + contentType = "Content-Type" + mimeTypeFormPost = "application/x-www-form-urlencoded" +) + +// Sender is the interface that wraps the Do method to send HTTP requests. +// +// The standard http.Client conforms to this interface. +type Sender interface { + Do(*http.Request) (*http.Response, error) +} + +// SenderFunc is a method that implements the Sender interface. +type SenderFunc func(*http.Request) (*http.Response, error) + +// Do implements the Sender interface on SenderFunc. +func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { + return sf(r) +} + +// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the +// http.Request and pass it along or, first, pass the http.Request along then react to the +// http.Response result. +type SendDecorator func(Sender) Sender + +// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. +func CreateSender(decorators ...SendDecorator) Sender { + return DecorateSender(&http.Client{}, decorators...) +} + +// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to +// the Sender. Decorators are applied in the order received, but their affect upon the request +// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a +// post-decorator (pass the http.Request along and react to the results in http.Response). +func DecorateSender(s Sender, decorators ...SendDecorator) Sender { + for _, decorate := range decorators { + s = decorate(s) + } + return s +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go index 1fb797fc1d..559fc66535 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -1,408 +1,408 @@ -package adal - -import ( - "crypto/rand" - "crypto/rsa" - "crypto/sha1" - "crypto/x509" - "encoding/base64" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "strconv" - "strings" - "time" - - "github.com/dgrijalva/jwt-go" -) - -const ( - defaultRefresh = 5 * time.Minute - tokenBaseDate = "1970-01-01T00:00:00Z" - - // OAuthGrantTypeDeviceCode is the "grant_type" identifier used in device flow - OAuthGrantTypeDeviceCode = "device_code" - - // OAuthGrantTypeClientCredentials is the "grant_type" identifier used in credential flows - OAuthGrantTypeClientCredentials = "client_credentials" - - // OAuthGrantTypeRefreshToken is the "grant_type" identifier used in refresh token flows - OAuthGrantTypeRefreshToken = "refresh_token" - - // managedIdentitySettingsPath is the path to the MSI Extension settings file (to discover the endpoint) - managedIdentitySettingsPath = "/var/lib/waagent/ManagedIdentity-Settings" -) - -var expirationBase time.Time - -func init() { - expirationBase, _ = time.Parse(time.RFC3339, tokenBaseDate) -} - -// OAuthTokenProvider is an interface which should be implemented by an access token retriever -type OAuthTokenProvider interface { - OAuthToken() string -} - -// Refresher is an interface for token refresh functionality -type Refresher interface { - Refresh() error - RefreshExchange(resource string) error - EnsureFresh() error -} - -// TokenRefreshCallback is the type representing callbacks that will be called after -// a successful token refresh -type TokenRefreshCallback func(Token) error - -// Token encapsulates the access token used to authorize Azure requests. -type Token struct { - AccessToken string `json:"access_token"` - RefreshToken string `json:"refresh_token"` - - ExpiresIn string `json:"expires_in"` - ExpiresOn string `json:"expires_on"` - NotBefore string `json:"not_before"` - - Resource string `json:"resource"` - Type string `json:"token_type"` -} - -// Expires returns the time.Time when the Token expires. -func (t Token) Expires() time.Time { - s, err := strconv.Atoi(t.ExpiresOn) - if err != nil { - s = -3600 - } - return expirationBase.Add(time.Duration(s) * time.Second).UTC() -} - -// IsExpired returns true if the Token is expired, false otherwise. -func (t Token) IsExpired() bool { - return t.WillExpireIn(0) -} - -// WillExpireIn returns true if the Token will expire after the passed time.Duration interval -// from now, false otherwise. -func (t Token) WillExpireIn(d time.Duration) bool { - return !t.Expires().After(time.Now().Add(d)) -} - -//OAuthToken return the current access token -func (t *Token) OAuthToken() string { - return t.AccessToken -} - -// ServicePrincipalNoSecret represents a secret type that contains no secret -// meaning it is not valid for fetching a fresh token. This is used by Manual -type ServicePrincipalNoSecret struct { -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret -// It only returns an error for the ServicePrincipalNoSecret type -func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") -} - -// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form -// that is submitted when acquiring an oAuth token. -type ServicePrincipalSecret interface { - SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error -} - -// ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization. -type ServicePrincipalTokenSecret struct { - ClientSecret string -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -// It will populate the form submitted during oAuth Token Acquisition using the client_secret. -func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("client_secret", tokenSecret.ClientSecret) - return nil -} - -// ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs. -type ServicePrincipalCertificateSecret struct { - Certificate *x509.Certificate - PrivateKey *rsa.PrivateKey -} - -// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. -type ServicePrincipalMSISecret struct { -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -// MSI extension requires the authority field to be set to the real tenant authority endpoint -func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - v.Set("authority", spt.oauthConfig.AuthorityEndpoint.String()) - return nil -} - -// SignJwt returns the JWT signed with the certificate's private key. -func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { - hasher := sha1.New() - _, err := hasher.Write(secret.Certificate.Raw) - if err != nil { - return "", err - } - - thumbprint := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) - - // The jti (JWT ID) claim provides a unique identifier for the JWT. - jti := make([]byte, 20) - _, err = rand.Read(jti) - if err != nil { - return "", err - } - - token := jwt.New(jwt.SigningMethodRS256) - token.Header["x5t"] = thumbprint - token.Claims = jwt.MapClaims{ - "aud": spt.oauthConfig.TokenEndpoint.String(), - "iss": spt.clientID, - "sub": spt.clientID, - "jti": base64.URLEncoding.EncodeToString(jti), - "nbf": time.Now().Unix(), - "exp": time.Now().Add(time.Hour * 24).Unix(), - } - - signedString, err := token.SignedString(secret.PrivateKey) - return signedString, err -} - -// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. -// It will populate the form submitted during oAuth Token Acquisition using a JWT signed with a certificate. -func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { - jwt, err := secret.SignJwt(spt) - if err != nil { - return err - } - - v.Set("client_assertion", jwt) - v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") - return nil -} - -// ServicePrincipalToken encapsulates a Token created for a Service Principal. -type ServicePrincipalToken struct { - Token - - secret ServicePrincipalSecret - oauthConfig OAuthConfig - clientID string - resource string - autoRefresh bool - refreshWithin time.Duration - sender Sender - - refreshCallbacks []TokenRefreshCallback -} - -// NewServicePrincipalTokenWithSecret create a ServicePrincipalToken using the supplied ServicePrincipalSecret implementation. -func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - spt := &ServicePrincipalToken{ - oauthConfig: oauthConfig, - secret: secret, - clientID: id, - resource: resource, - autoRefresh: true, - refreshWithin: defaultRefresh, - sender: &http.Client{}, - refreshCallbacks: callbacks, - } - return spt, nil -} - -// NewServicePrincipalTokenFromManualToken creates a ServicePrincipalToken using the supplied token -func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - spt, err := NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalNoSecret{}, - callbacks...) - if err != nil { - return nil, err - } - - spt.Token = token - - return spt, nil -} - -// NewServicePrincipalToken creates a ServicePrincipalToken from the supplied Service Principal -// credentials scoped to the named resource. -func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalTokenSecret{ - ClientSecret: secret, - }, - callbacks..., - ) -} - -// NewServicePrincipalTokenFromCertificate create a ServicePrincipalToken from the supplied pkcs12 bytes. -func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - return NewServicePrincipalTokenWithSecret( - oauthConfig, - clientID, - resource, - &ServicePrincipalCertificateSecret{ - PrivateKey: privateKey, - Certificate: certificate, - }, - callbacks..., - ) -} - -// NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension. -func NewServicePrincipalTokenFromMSI(oauthConfig OAuthConfig, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - return newServicePrincipalTokenFromMSI(oauthConfig, resource, managedIdentitySettingsPath, callbacks...) -} - -func newServicePrincipalTokenFromMSI(oauthConfig OAuthConfig, resource, settingsPath string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { - // Read MSI settings - bytes, err := ioutil.ReadFile(settingsPath) - if err != nil { - return nil, err - } - msiSettings := struct { - URL string `json:"url"` - }{} - err = json.Unmarshal(bytes, &msiSettings) - if err != nil { - return nil, err - } - - // We set the oauth config token endpoint to be MSI's endpoint - // We leave the authority as-is so MSI can POST it with the token request - msiEndpointURL, err := url.Parse(msiSettings.URL) - if err != nil { - return nil, err - } - - msiTokenEndpointURL, err := msiEndpointURL.Parse("/oauth2/token") - if err != nil { - return nil, err - } - - oauthConfig.TokenEndpoint = *msiTokenEndpointURL - - spt := &ServicePrincipalToken{ - oauthConfig: oauthConfig, - secret: &ServicePrincipalMSISecret{}, - resource: resource, - autoRefresh: true, - refreshWithin: defaultRefresh, - sender: &http.Client{}, - refreshCallbacks: callbacks, - } - - return spt, nil -} - -// EnsureFresh will refresh the token if it will expire within the refresh window (as set by -// RefreshWithin) and autoRefresh flag is on. -func (spt *ServicePrincipalToken) EnsureFresh() error { - if spt.autoRefresh && spt.WillExpireIn(spt.refreshWithin) { - return spt.Refresh() - } - return nil -} - -// InvokeRefreshCallbacks calls any TokenRefreshCallbacks that were added to the SPT during initialization -func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { - if spt.refreshCallbacks != nil { - for _, callback := range spt.refreshCallbacks { - err := callback(spt.Token) - if err != nil { - return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) - } - } - } - return nil -} - -// Refresh obtains a fresh token for the Service Principal. -func (spt *ServicePrincipalToken) Refresh() error { - return spt.refreshInternal(spt.resource) -} - -// RefreshExchange refreshes the token, but for a different resource. -func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { - return spt.refreshInternal(resource) -} - -func (spt *ServicePrincipalToken) refreshInternal(resource string) error { - v := url.Values{} - v.Set("client_id", spt.clientID) - v.Set("resource", resource) - - if spt.RefreshToken != "" { - v.Set("grant_type", OAuthGrantTypeRefreshToken) - v.Set("refresh_token", spt.RefreshToken) - } else { - v.Set("grant_type", OAuthGrantTypeClientCredentials) - err := spt.secret.SetAuthenticationValues(spt, &v) - if err != nil { - return err - } - } - - s := v.Encode() - body := ioutil.NopCloser(strings.NewReader(s)) - req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), body) - if err != nil { - return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) - } - - req.ContentLength = int64(len(s)) - req.Header.Set(contentType, mimeTypeFormPost) - resp, err := spt.sender.Do(req) - if err != nil { - return fmt.Errorf("adal: Failed to execute the refresh request. Error = '%v'", err) - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("adal: Refresh request failed. Status Code = '%d'", resp.StatusCode) - } - - rb, err := ioutil.ReadAll(resp.Body) - if err != nil { - return fmt.Errorf("adal: Failed to read a new service principal token during refresh. Error = '%v'", err) - } - if len(strings.Trim(string(rb), " ")) == 0 { - return fmt.Errorf("adal: Empty service principal token received during refresh") - } - var token Token - err = json.Unmarshal(rb, &token) - if err != nil { - return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb)) - } - - spt.Token = token - - return spt.InvokeRefreshCallbacks(token) -} - -// SetAutoRefresh enables or disables automatic refreshing of stale tokens. -func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) { - spt.autoRefresh = autoRefresh -} - -// SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will -// refresh the token. -func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { - spt.refreshWithin = d - return -} - -// SetSender sets the http.Client used when obtaining the Service Principal token. An -// undecorated http.Client is used by default. -func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s } +package adal + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/sha1" + "crypto/x509" + "encoding/base64" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "strings" + "time" + + "github.com/dgrijalva/jwt-go" +) + +const ( + defaultRefresh = 5 * time.Minute + tokenBaseDate = "1970-01-01T00:00:00Z" + + // OAuthGrantTypeDeviceCode is the "grant_type" identifier used in device flow + OAuthGrantTypeDeviceCode = "device_code" + + // OAuthGrantTypeClientCredentials is the "grant_type" identifier used in credential flows + OAuthGrantTypeClientCredentials = "client_credentials" + + // OAuthGrantTypeRefreshToken is the "grant_type" identifier used in refresh token flows + OAuthGrantTypeRefreshToken = "refresh_token" + + // managedIdentitySettingsPath is the path to the MSI Extension settings file (to discover the endpoint) + managedIdentitySettingsPath = "/var/lib/waagent/ManagedIdentity-Settings" +) + +var expirationBase time.Time + +func init() { + expirationBase, _ = time.Parse(time.RFC3339, tokenBaseDate) +} + +// OAuthTokenProvider is an interface which should be implemented by an access token retriever +type OAuthTokenProvider interface { + OAuthToken() string +} + +// Refresher is an interface for token refresh functionality +type Refresher interface { + Refresh() error + RefreshExchange(resource string) error + EnsureFresh() error +} + +// TokenRefreshCallback is the type representing callbacks that will be called after +// a successful token refresh +type TokenRefreshCallback func(Token) error + +// Token encapsulates the access token used to authorize Azure requests. +type Token struct { + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + + ExpiresIn string `json:"expires_in"` + ExpiresOn string `json:"expires_on"` + NotBefore string `json:"not_before"` + + Resource string `json:"resource"` + Type string `json:"token_type"` +} + +// Expires returns the time.Time when the Token expires. +func (t Token) Expires() time.Time { + s, err := strconv.Atoi(t.ExpiresOn) + if err != nil { + s = -3600 + } + return expirationBase.Add(time.Duration(s) * time.Second).UTC() +} + +// IsExpired returns true if the Token is expired, false otherwise. +func (t Token) IsExpired() bool { + return t.WillExpireIn(0) +} + +// WillExpireIn returns true if the Token will expire after the passed time.Duration interval +// from now, false otherwise. +func (t Token) WillExpireIn(d time.Duration) bool { + return !t.Expires().After(time.Now().Add(d)) +} + +//OAuthToken return the current access token +func (t *Token) OAuthToken() string { + return t.AccessToken +} + +// ServicePrincipalNoSecret represents a secret type that contains no secret +// meaning it is not valid for fetching a fresh token. This is used by Manual +type ServicePrincipalNoSecret struct { +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret +// It only returns an error for the ServicePrincipalNoSecret type +func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") +} + +// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form +// that is submitted when acquiring an oAuth token. +type ServicePrincipalSecret interface { + SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error +} + +// ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization. +type ServicePrincipalTokenSecret struct { + ClientSecret string +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +// It will populate the form submitted during oAuth Token Acquisition using the client_secret. +func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("client_secret", tokenSecret.ClientSecret) + return nil +} + +// ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs. +type ServicePrincipalCertificateSecret struct { + Certificate *x509.Certificate + PrivateKey *rsa.PrivateKey +} + +// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. +type ServicePrincipalMSISecret struct { +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +// MSI extension requires the authority field to be set to the real tenant authority endpoint +func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("authority", spt.oauthConfig.AuthorityEndpoint.String()) + return nil +} + +// SignJwt returns the JWT signed with the certificate's private key. +func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { + hasher := sha1.New() + _, err := hasher.Write(secret.Certificate.Raw) + if err != nil { + return "", err + } + + thumbprint := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) + + // The jti (JWT ID) claim provides a unique identifier for the JWT. + jti := make([]byte, 20) + _, err = rand.Read(jti) + if err != nil { + return "", err + } + + token := jwt.New(jwt.SigningMethodRS256) + token.Header["x5t"] = thumbprint + token.Claims = jwt.MapClaims{ + "aud": spt.oauthConfig.TokenEndpoint.String(), + "iss": spt.clientID, + "sub": spt.clientID, + "jti": base64.URLEncoding.EncodeToString(jti), + "nbf": time.Now().Unix(), + "exp": time.Now().Add(time.Hour * 24).Unix(), + } + + signedString, err := token.SignedString(secret.PrivateKey) + return signedString, err +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +// It will populate the form submitted during oAuth Token Acquisition using a JWT signed with a certificate. +func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + jwt, err := secret.SignJwt(spt) + if err != nil { + return err + } + + v.Set("client_assertion", jwt) + v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") + return nil +} + +// ServicePrincipalToken encapsulates a Token created for a Service Principal. +type ServicePrincipalToken struct { + Token + + secret ServicePrincipalSecret + oauthConfig OAuthConfig + clientID string + resource string + autoRefresh bool + refreshWithin time.Duration + sender Sender + + refreshCallbacks []TokenRefreshCallback +} + +// NewServicePrincipalTokenWithSecret create a ServicePrincipalToken using the supplied ServicePrincipalSecret implementation. +func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + spt := &ServicePrincipalToken{ + oauthConfig: oauthConfig, + secret: secret, + clientID: id, + resource: resource, + autoRefresh: true, + refreshWithin: defaultRefresh, + sender: &http.Client{}, + refreshCallbacks: callbacks, + } + return spt, nil +} + +// NewServicePrincipalTokenFromManualToken creates a ServicePrincipalToken using the supplied token +func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + spt, err := NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalNoSecret{}, + callbacks...) + if err != nil { + return nil, err + } + + spt.Token = token + + return spt, nil +} + +// NewServicePrincipalToken creates a ServicePrincipalToken from the supplied Service Principal +// credentials scoped to the named resource. +func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalTokenSecret{ + ClientSecret: secret, + }, + callbacks..., + ) +} + +// NewServicePrincipalTokenFromCertificate create a ServicePrincipalToken from the supplied pkcs12 bytes. +func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalCertificateSecret{ + PrivateKey: privateKey, + Certificate: certificate, + }, + callbacks..., + ) +} + +// NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension. +func NewServicePrincipalTokenFromMSI(oauthConfig OAuthConfig, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + return newServicePrincipalTokenFromMSI(oauthConfig, resource, managedIdentitySettingsPath, callbacks...) +} + +func newServicePrincipalTokenFromMSI(oauthConfig OAuthConfig, resource, settingsPath string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + // Read MSI settings + bytes, err := ioutil.ReadFile(settingsPath) + if err != nil { + return nil, err + } + msiSettings := struct { + URL string `json:"url"` + }{} + err = json.Unmarshal(bytes, &msiSettings) + if err != nil { + return nil, err + } + + // We set the oauth config token endpoint to be MSI's endpoint + // We leave the authority as-is so MSI can POST it with the token request + msiEndpointURL, err := url.Parse(msiSettings.URL) + if err != nil { + return nil, err + } + + msiTokenEndpointURL, err := msiEndpointURL.Parse("/oauth2/token") + if err != nil { + return nil, err + } + + oauthConfig.TokenEndpoint = *msiTokenEndpointURL + + spt := &ServicePrincipalToken{ + oauthConfig: oauthConfig, + secret: &ServicePrincipalMSISecret{}, + resource: resource, + autoRefresh: true, + refreshWithin: defaultRefresh, + sender: &http.Client{}, + refreshCallbacks: callbacks, + } + + return spt, nil +} + +// EnsureFresh will refresh the token if it will expire within the refresh window (as set by +// RefreshWithin) and autoRefresh flag is on. +func (spt *ServicePrincipalToken) EnsureFresh() error { + if spt.autoRefresh && spt.WillExpireIn(spt.refreshWithin) { + return spt.Refresh() + } + return nil +} + +// InvokeRefreshCallbacks calls any TokenRefreshCallbacks that were added to the SPT during initialization +func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { + if spt.refreshCallbacks != nil { + for _, callback := range spt.refreshCallbacks { + err := callback(spt.Token) + if err != nil { + return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) + } + } + } + return nil +} + +// Refresh obtains a fresh token for the Service Principal. +func (spt *ServicePrincipalToken) Refresh() error { + return spt.refreshInternal(spt.resource) +} + +// RefreshExchange refreshes the token, but for a different resource. +func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { + return spt.refreshInternal(resource) +} + +func (spt *ServicePrincipalToken) refreshInternal(resource string) error { + v := url.Values{} + v.Set("client_id", spt.clientID) + v.Set("resource", resource) + + if spt.RefreshToken != "" { + v.Set("grant_type", OAuthGrantTypeRefreshToken) + v.Set("refresh_token", spt.RefreshToken) + } else { + v.Set("grant_type", OAuthGrantTypeClientCredentials) + err := spt.secret.SetAuthenticationValues(spt, &v) + if err != nil { + return err + } + } + + s := v.Encode() + body := ioutil.NopCloser(strings.NewReader(s)) + req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), body) + if err != nil { + return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) + } + + req.ContentLength = int64(len(s)) + req.Header.Set(contentType, mimeTypeFormPost) + resp, err := spt.sender.Do(req) + if err != nil { + return fmt.Errorf("adal: Failed to execute the refresh request. Error = '%v'", err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("adal: Refresh request failed. Status Code = '%d'", resp.StatusCode) + } + + rb, err := ioutil.ReadAll(resp.Body) + if err != nil { + return fmt.Errorf("adal: Failed to read a new service principal token during refresh. Error = '%v'", err) + } + if len(strings.Trim(string(rb), " ")) == 0 { + return fmt.Errorf("adal: Empty service principal token received during refresh") + } + var token Token + err = json.Unmarshal(rb, &token) + if err != nil { + return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb)) + } + + spt.Token = token + + return spt.InvokeRefreshCallbacks(token) +} + +// SetAutoRefresh enables or disables automatic refreshing of stale tokens. +func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) { + spt.autoRefresh = autoRefresh +} + +// SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will +// refresh the token. +func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { + spt.refreshWithin = d + return +} + +// SetSender sets the http.Client used when obtaining the Service Principal token. An +// undecorated http.Client is used by default. +func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s } diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token_test.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token_test.go index a58b71c18e..9c92f41987 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token_test.go @@ -1,599 +1,599 @@ -package adal - -import ( - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "fmt" - "io/ioutil" - "math/big" - "net/http" - "net/url" - "os" - "reflect" - "strconv" - "strings" - "testing" - "time" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -const ( - defaultFormData = "client_id=id&client_secret=secret&grant_type=client_credentials&resource=resource" - defaultManualFormData = "client_id=id&grant_type=refresh_token&refresh_token=refreshtoken&resource=resource" -) - -func TestTokenExpires(t *testing.T) { - tt := time.Now().Add(5 * time.Second) - tk := newTokenExpiresAt(tt) - - if tk.Expires().Equal(tt) { - t.Fatalf("adal: Token#Expires miscalculated expiration time -- received %v, expected %v", tk.Expires(), tt) - } -} - -func TestTokenIsExpired(t *testing.T) { - tk := newTokenExpiresAt(time.Now().Add(-5 * time.Second)) - - if !tk.IsExpired() { - t.Fatalf("adal: Token#IsExpired failed to mark a stale token as expired -- now %v, token expires at %v", - time.Now().UTC(), tk.Expires()) - } -} - -func TestTokenIsExpiredUninitialized(t *testing.T) { - tk := &Token{} - - if !tk.IsExpired() { - t.Fatalf("adal: An uninitialized Token failed to mark itself as expired (expiration time %v)", tk.Expires()) - } -} - -func TestTokenIsNoExpired(t *testing.T) { - tk := newTokenExpiresAt(time.Now().Add(1000 * time.Second)) - - if tk.IsExpired() { - t.Fatalf("adal: Token marked a fresh token as expired -- now %v, token expires at %v", time.Now().UTC(), tk.Expires()) - } -} - -func TestTokenWillExpireIn(t *testing.T) { - d := 5 * time.Second - tk := newTokenExpiresIn(d) - - if !tk.WillExpireIn(d) { - t.Fatal("adal: Token#WillExpireIn mismeasured expiration time") - } -} - -func TestServicePrincipalTokenSetAutoRefresh(t *testing.T) { - spt := newServicePrincipalToken() - - if !spt.autoRefresh { - t.Fatal("adal: ServicePrincipalToken did not default to automatic token refreshing") - } - - spt.SetAutoRefresh(false) - if spt.autoRefresh { - t.Fatal("adal: ServicePrincipalToken#SetAutoRefresh did not disable automatic token refreshing") - } -} - -func TestServicePrincipalTokenSetRefreshWithin(t *testing.T) { - spt := newServicePrincipalToken() - - if spt.refreshWithin != defaultRefresh { - t.Fatal("adal: ServicePrincipalToken did not correctly set the default refresh interval") - } - - spt.SetRefreshWithin(2 * defaultRefresh) - if spt.refreshWithin != 2*defaultRefresh { - t.Fatal("adal: ServicePrincipalToken#SetRefreshWithin did not set the refresh interval") - } -} - -func TestServicePrincipalTokenSetSender(t *testing.T) { - spt := newServicePrincipalToken() - - c := &http.Client{} - spt.SetSender(c) - if !reflect.DeepEqual(c, spt.sender) { - t.Fatal("adal: ServicePrincipalToken#SetSender did not set the sender") - } -} - -func TestServicePrincipalTokenRefreshUsesPOST(t *testing.T) { - spt := newServicePrincipalToken() - - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - if r.Method != "POST" { - t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set HTTP method -- expected %v, received %v", "POST", r.Method) - } - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } - - if body.IsOpen() { - t.Fatalf("the response was not closed!") - } -} - -func TestServicePrincipalTokenRefreshSetsMimeType(t *testing.T) { - spt := newServicePrincipalToken() - - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - if r.Header.Get(http.CanonicalHeaderKey("Content-Type")) != "application/x-www-form-urlencoded" { - t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set Content-Type -- expected %v, received %v", - "application/x-form-urlencoded", - r.Header.Get(http.CanonicalHeaderKey("Content-Type"))) - } - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } -} - -func TestServicePrincipalTokenRefreshSetsURL(t *testing.T) { - spt := newServicePrincipalToken() - - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - if r.URL.String() != TestOAuthConfig.TokenEndpoint.String() { - t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set the URL -- expected %v, received %v", - TestOAuthConfig.TokenEndpoint, r.URL) - } - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } -} - -func testServicePrincipalTokenRefreshSetsBody(t *testing.T, spt *ServicePrincipalToken, f func(*testing.T, []byte)) { - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("adal: Failed to read body of Service Principal token request (%v)", err) - } - f(t, b) - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } -} - -func TestServicePrincipalTokenManualRefreshSetsBody(t *testing.T) { - sptManual := newServicePrincipalTokenManual() - testServicePrincipalTokenRefreshSetsBody(t, sptManual, func(t *testing.T, b []byte) { - if string(b) != defaultManualFormData { - t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set the HTTP Request Body -- expected %v, received %v", - defaultManualFormData, string(b)) - } - }) -} - -func TestServicePrincipalTokenCertficateRefreshSetsBody(t *testing.T) { - sptCert := newServicePrincipalTokenCertificate(t) - testServicePrincipalTokenRefreshSetsBody(t, sptCert, func(t *testing.T, b []byte) { - body := string(b) - - values, _ := url.ParseQuery(body) - if values["client_assertion_type"][0] != "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" || - values["client_id"][0] != "id" || - values["grant_type"][0] != "client_credentials" || - values["resource"][0] != "resource" { - t.Fatalf("adal: ServicePrincipalTokenCertificate#Refresh did not correctly set the HTTP Request Body.") - } - }) -} - -func TestServicePrincipalTokenSecretRefreshSetsBody(t *testing.T) { - spt := newServicePrincipalToken() - testServicePrincipalTokenRefreshSetsBody(t, spt, func(t *testing.T, b []byte) { - if string(b) != defaultFormData { - t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set the HTTP Request Body -- expected %v, received %v", - defaultFormData, string(b)) - } - - }) -} - -func TestServicePrincipalTokenRefreshClosesRequestBody(t *testing.T) { - spt := newServicePrincipalToken() - - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } - if resp.Body.(*mocks.Body).IsOpen() { - t.Fatal("adal: ServicePrincipalToken#Refresh failed to close the HTTP Response Body") - } -} - -func TestServicePrincipalTokenRefreshRejectsResponsesWithStatusNotOK(t *testing.T) { - spt := newServicePrincipalToken() - - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusUnauthorized, "Unauthorized") - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err == nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh should reject a response with status != %d", http.StatusOK) - } -} - -func TestServicePrincipalTokenRefreshRejectsEmptyBody(t *testing.T) { - spt := newServicePrincipalToken() - - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return mocks.NewResponse(), nil - }) - } - })()) - spt.SetSender(s) - err := spt.Refresh() - if err == nil { - t.Fatal("adal: ServicePrincipalToken#Refresh should reject an empty token") - } -} - -func TestServicePrincipalTokenRefreshPropagatesErrors(t *testing.T) { - spt := newServicePrincipalToken() - - c := mocks.NewSender() - c.SetError(fmt.Errorf("Faux Error")) - spt.SetSender(c) - - err := spt.Refresh() - if err == nil { - t.Fatal("adal: Failed to propagate the request error") - } -} - -func TestServicePrincipalTokenRefreshReturnsErrorIfNotOk(t *testing.T) { - spt := newServicePrincipalToken() - - c := mocks.NewSender() - c.AppendResponse(mocks.NewResponseWithStatus("401 NotAuthorized", http.StatusUnauthorized)) - spt.SetSender(c) - - err := spt.Refresh() - if err == nil { - t.Fatalf("adal: Failed to return an when receiving a status code other than HTTP %d", http.StatusOK) - } -} - -func TestServicePrincipalTokenRefreshUnmarshals(t *testing.T) { - spt := newServicePrincipalToken() - - expiresOn := strconv.Itoa(int(time.Now().Add(3600 * time.Second).Sub(expirationBase).Seconds())) - j := newTokenJSON(expiresOn, "resource") - resp := mocks.NewResponseWithContent(j) - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return resp, nil - }) - } - })()) - spt.SetSender(s) - - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } else if spt.AccessToken != "accessToken" || - spt.ExpiresIn != "3600" || - spt.ExpiresOn != expiresOn || - spt.NotBefore != expiresOn || - spt.Resource != "resource" || - spt.Type != "Bearer" { - t.Fatalf("adal: ServicePrincipalToken#Refresh failed correctly unmarshal the JSON -- expected %v, received %v", - j, *spt) - } -} - -func TestServicePrincipalTokenEnsureFreshRefreshes(t *testing.T) { - spt := newServicePrincipalToken() - expireToken(&spt.Token) - - body := mocks.NewBody(newTokenJSON("test", "test")) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - - f := false - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - f = true - return resp, nil - }) - } - })()) - spt.SetSender(s) - err := spt.EnsureFresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#EnsureFresh returned an unexpected error (%v)", err) - } - if !f { - t.Fatal("adal: ServicePrincipalToken#EnsureFresh failed to call Refresh for stale token") - } -} - -func TestServicePrincipalTokenEnsureFreshSkipsIfFresh(t *testing.T) { - spt := newServicePrincipalToken() - setTokenToExpireIn(&spt.Token, 1000*time.Second) - - f := false - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - f = true - return mocks.NewResponse(), nil - }) - } - })()) - spt.SetSender(s) - err := spt.EnsureFresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#EnsureFresh returned an unexpected error (%v)", err) - } - if f { - t.Fatal("adal: ServicePrincipalToken#EnsureFresh invoked Refresh for fresh token") - } -} - -func TestRefreshCallback(t *testing.T) { - callbackTriggered := false - spt := newServicePrincipalToken(func(Token) error { - callbackTriggered = true - return nil - }) - - expiresOn := strconv.Itoa(int(time.Now().Add(3600 * time.Second).Sub(expirationBase).Seconds())) - - sender := mocks.NewSender() - j := newTokenJSON(expiresOn, "resource") - sender.AppendResponse(mocks.NewResponseWithContent(j)) - spt.SetSender(sender) - err := spt.Refresh() - if err != nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) - } - if !callbackTriggered { - t.Fatalf("adal: RefreshCallback failed to trigger call callback") - } -} - -func TestRefreshCallbackErrorPropagates(t *testing.T) { - errorText := "this is an error text" - spt := newServicePrincipalToken(func(Token) error { - return fmt.Errorf(errorText) - }) - - expiresOn := strconv.Itoa(int(time.Now().Add(3600 * time.Second).Sub(expirationBase).Seconds())) - - sender := mocks.NewSender() - j := newTokenJSON(expiresOn, "resource") - sender.AppendResponse(mocks.NewResponseWithContent(j)) - spt.SetSender(sender) - err := spt.Refresh() - - if err == nil || !strings.Contains(err.Error(), errorText) { - t.Fatalf("adal: RefreshCallback failed to propagate error") - } -} - -// This demonstrates the danger of manual token without a refresh token -func TestServicePrincipalTokenManualRefreshFailsWithoutRefresh(t *testing.T) { - spt := newServicePrincipalTokenManual() - spt.RefreshToken = "" - err := spt.Refresh() - if err == nil { - t.Fatalf("adal: ServicePrincipalToken#Refresh should have failed with a ManualTokenSecret without a refresh token") - } -} - -func TestNewServicePrincipalTokenFromMSI(t *testing.T) { - resource := "https://resource" - - cb := func(token Token) error { return nil } - tempSettingsFile, err := ioutil.TempFile("", "ManagedIdentity-Settings") - if err != nil { - t.Fatal("Couldn't write temp settings file") - } - defer os.Remove(tempSettingsFile.Name()) - - settingsContents := []byte(`{ - "url": "http://msiendpoint/" - }`) - - if _, err := tempSettingsFile.Write(settingsContents); err != nil { - t.Fatal("Couldn't fill temp settings file") - } - - oauthConfig, err := NewOAuthConfig("http://adendpoint", "1-2-3-4") - if err != nil { - t.Fatal("Failed to construct oauthconfig") - } - - spt, err := newServicePrincipalTokenFromMSI( - *oauthConfig, - resource, - tempSettingsFile.Name(), - cb) - if err != nil { - t.Fatalf("Failed to get MSI SPT: %v", err) - } - - // check some of the SPT fields - if _, ok := spt.secret.(*ServicePrincipalMSISecret); !ok { - t.Fatal("SPT secret was not of MSI type") - } - - if spt.resource != resource { - t.Fatal("SPT came back with incorrect resource") - } - - if len(spt.refreshCallbacks) != 1 { - t.Fatal("SPT had incorrect refresh callbacks.") - } -} - -func newToken() *Token { - return &Token{ - AccessToken: "ASECRETVALUE", - Resource: "https://azure.microsoft.com/", - Type: "Bearer", - } -} - -func newTokenJSON(expiresOn string, resource string) string { - return fmt.Sprintf(`{ - "access_token" : "accessToken", - "expires_in" : "3600", - "expires_on" : "%s", - "not_before" : "%s", - "resource" : "%s", - "token_type" : "Bearer" - }`, - expiresOn, expiresOn, resource) -} - -func newTokenExpiresIn(expireIn time.Duration) *Token { - return setTokenToExpireIn(newToken(), expireIn) -} - -func newTokenExpiresAt(expireAt time.Time) *Token { - return setTokenToExpireAt(newToken(), expireAt) -} - -func expireToken(t *Token) *Token { - return setTokenToExpireIn(t, 0) -} - -func setTokenToExpireAt(t *Token, expireAt time.Time) *Token { - t.ExpiresIn = "3600" - t.ExpiresOn = strconv.Itoa(int(expireAt.Sub(expirationBase).Seconds())) - t.NotBefore = t.ExpiresOn - return t -} - -func setTokenToExpireIn(t *Token, expireIn time.Duration) *Token { - return setTokenToExpireAt(t, time.Now().Add(expireIn)) -} - -func newServicePrincipalToken(callbacks ...TokenRefreshCallback) *ServicePrincipalToken { - spt, _ := NewServicePrincipalToken(TestOAuthConfig, "id", "secret", "resource", callbacks...) - return spt -} - -func newServicePrincipalTokenManual() *ServicePrincipalToken { - token := newToken() - token.RefreshToken = "refreshtoken" - spt, _ := NewServicePrincipalTokenFromManualToken(TestOAuthConfig, "id", "resource", *token) - return spt -} - -func newServicePrincipalTokenCertificate(t *testing.T) *ServicePrincipalToken { - template := x509.Certificate{ - SerialNumber: big.NewInt(0), - Subject: pkix.Name{CommonName: "test"}, - BasicConstraintsValid: true, - } - privateKey, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - t.Fatal(err) - } - certificateBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &privateKey.PublicKey, privateKey) - if err != nil { - t.Fatal(err) - } - certificate, err := x509.ParseCertificate(certificateBytes) - if err != nil { - t.Fatal(err) - } - - spt, _ := NewServicePrincipalTokenFromCertificate(TestOAuthConfig, "id", certificate, privateKey, "resource") - return spt -} +package adal + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "fmt" + "io/ioutil" + "math/big" + "net/http" + "net/url" + "os" + "reflect" + "strconv" + "strings" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +const ( + defaultFormData = "client_id=id&client_secret=secret&grant_type=client_credentials&resource=resource" + defaultManualFormData = "client_id=id&grant_type=refresh_token&refresh_token=refreshtoken&resource=resource" +) + +func TestTokenExpires(t *testing.T) { + tt := time.Now().Add(5 * time.Second) + tk := newTokenExpiresAt(tt) + + if tk.Expires().Equal(tt) { + t.Fatalf("adal: Token#Expires miscalculated expiration time -- received %v, expected %v", tk.Expires(), tt) + } +} + +func TestTokenIsExpired(t *testing.T) { + tk := newTokenExpiresAt(time.Now().Add(-5 * time.Second)) + + if !tk.IsExpired() { + t.Fatalf("adal: Token#IsExpired failed to mark a stale token as expired -- now %v, token expires at %v", + time.Now().UTC(), tk.Expires()) + } +} + +func TestTokenIsExpiredUninitialized(t *testing.T) { + tk := &Token{} + + if !tk.IsExpired() { + t.Fatalf("adal: An uninitialized Token failed to mark itself as expired (expiration time %v)", tk.Expires()) + } +} + +func TestTokenIsNoExpired(t *testing.T) { + tk := newTokenExpiresAt(time.Now().Add(1000 * time.Second)) + + if tk.IsExpired() { + t.Fatalf("adal: Token marked a fresh token as expired -- now %v, token expires at %v", time.Now().UTC(), tk.Expires()) + } +} + +func TestTokenWillExpireIn(t *testing.T) { + d := 5 * time.Second + tk := newTokenExpiresIn(d) + + if !tk.WillExpireIn(d) { + t.Fatal("adal: Token#WillExpireIn mismeasured expiration time") + } +} + +func TestServicePrincipalTokenSetAutoRefresh(t *testing.T) { + spt := newServicePrincipalToken() + + if !spt.autoRefresh { + t.Fatal("adal: ServicePrincipalToken did not default to automatic token refreshing") + } + + spt.SetAutoRefresh(false) + if spt.autoRefresh { + t.Fatal("adal: ServicePrincipalToken#SetAutoRefresh did not disable automatic token refreshing") + } +} + +func TestServicePrincipalTokenSetRefreshWithin(t *testing.T) { + spt := newServicePrincipalToken() + + if spt.refreshWithin != defaultRefresh { + t.Fatal("adal: ServicePrincipalToken did not correctly set the default refresh interval") + } + + spt.SetRefreshWithin(2 * defaultRefresh) + if spt.refreshWithin != 2*defaultRefresh { + t.Fatal("adal: ServicePrincipalToken#SetRefreshWithin did not set the refresh interval") + } +} + +func TestServicePrincipalTokenSetSender(t *testing.T) { + spt := newServicePrincipalToken() + + c := &http.Client{} + spt.SetSender(c) + if !reflect.DeepEqual(c, spt.sender) { + t.Fatal("adal: ServicePrincipalToken#SetSender did not set the sender") + } +} + +func TestServicePrincipalTokenRefreshUsesPOST(t *testing.T) { + spt := newServicePrincipalToken() + + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + if r.Method != "POST" { + t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set HTTP method -- expected %v, received %v", "POST", r.Method) + } + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } + + if body.IsOpen() { + t.Fatalf("the response was not closed!") + } +} + +func TestServicePrincipalTokenRefreshSetsMimeType(t *testing.T) { + spt := newServicePrincipalToken() + + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + if r.Header.Get(http.CanonicalHeaderKey("Content-Type")) != "application/x-www-form-urlencoded" { + t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set Content-Type -- expected %v, received %v", + "application/x-form-urlencoded", + r.Header.Get(http.CanonicalHeaderKey("Content-Type"))) + } + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } +} + +func TestServicePrincipalTokenRefreshSetsURL(t *testing.T) { + spt := newServicePrincipalToken() + + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + if r.URL.String() != TestOAuthConfig.TokenEndpoint.String() { + t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set the URL -- expected %v, received %v", + TestOAuthConfig.TokenEndpoint, r.URL) + } + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } +} + +func testServicePrincipalTokenRefreshSetsBody(t *testing.T, spt *ServicePrincipalToken, f func(*testing.T, []byte)) { + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("adal: Failed to read body of Service Principal token request (%v)", err) + } + f(t, b) + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } +} + +func TestServicePrincipalTokenManualRefreshSetsBody(t *testing.T) { + sptManual := newServicePrincipalTokenManual() + testServicePrincipalTokenRefreshSetsBody(t, sptManual, func(t *testing.T, b []byte) { + if string(b) != defaultManualFormData { + t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set the HTTP Request Body -- expected %v, received %v", + defaultManualFormData, string(b)) + } + }) +} + +func TestServicePrincipalTokenCertficateRefreshSetsBody(t *testing.T) { + sptCert := newServicePrincipalTokenCertificate(t) + testServicePrincipalTokenRefreshSetsBody(t, sptCert, func(t *testing.T, b []byte) { + body := string(b) + + values, _ := url.ParseQuery(body) + if values["client_assertion_type"][0] != "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" || + values["client_id"][0] != "id" || + values["grant_type"][0] != "client_credentials" || + values["resource"][0] != "resource" { + t.Fatalf("adal: ServicePrincipalTokenCertificate#Refresh did not correctly set the HTTP Request Body.") + } + }) +} + +func TestServicePrincipalTokenSecretRefreshSetsBody(t *testing.T) { + spt := newServicePrincipalToken() + testServicePrincipalTokenRefreshSetsBody(t, spt, func(t *testing.T, b []byte) { + if string(b) != defaultFormData { + t.Fatalf("adal: ServicePrincipalToken#Refresh did not correctly set the HTTP Request Body -- expected %v, received %v", + defaultFormData, string(b)) + } + + }) +} + +func TestServicePrincipalTokenRefreshClosesRequestBody(t *testing.T) { + spt := newServicePrincipalToken() + + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } + if resp.Body.(*mocks.Body).IsOpen() { + t.Fatal("adal: ServicePrincipalToken#Refresh failed to close the HTTP Response Body") + } +} + +func TestServicePrincipalTokenRefreshRejectsResponsesWithStatusNotOK(t *testing.T) { + spt := newServicePrincipalToken() + + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusUnauthorized, "Unauthorized") + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err == nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh should reject a response with status != %d", http.StatusOK) + } +} + +func TestServicePrincipalTokenRefreshRejectsEmptyBody(t *testing.T) { + spt := newServicePrincipalToken() + + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return mocks.NewResponse(), nil + }) + } + })()) + spt.SetSender(s) + err := spt.Refresh() + if err == nil { + t.Fatal("adal: ServicePrincipalToken#Refresh should reject an empty token") + } +} + +func TestServicePrincipalTokenRefreshPropagatesErrors(t *testing.T) { + spt := newServicePrincipalToken() + + c := mocks.NewSender() + c.SetError(fmt.Errorf("Faux Error")) + spt.SetSender(c) + + err := spt.Refresh() + if err == nil { + t.Fatal("adal: Failed to propagate the request error") + } +} + +func TestServicePrincipalTokenRefreshReturnsErrorIfNotOk(t *testing.T) { + spt := newServicePrincipalToken() + + c := mocks.NewSender() + c.AppendResponse(mocks.NewResponseWithStatus("401 NotAuthorized", http.StatusUnauthorized)) + spt.SetSender(c) + + err := spt.Refresh() + if err == nil { + t.Fatalf("adal: Failed to return an when receiving a status code other than HTTP %d", http.StatusOK) + } +} + +func TestServicePrincipalTokenRefreshUnmarshals(t *testing.T) { + spt := newServicePrincipalToken() + + expiresOn := strconv.Itoa(int(time.Now().Add(3600 * time.Second).Sub(expirationBase).Seconds())) + j := newTokenJSON(expiresOn, "resource") + resp := mocks.NewResponseWithContent(j) + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return resp, nil + }) + } + })()) + spt.SetSender(s) + + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } else if spt.AccessToken != "accessToken" || + spt.ExpiresIn != "3600" || + spt.ExpiresOn != expiresOn || + spt.NotBefore != expiresOn || + spt.Resource != "resource" || + spt.Type != "Bearer" { + t.Fatalf("adal: ServicePrincipalToken#Refresh failed correctly unmarshal the JSON -- expected %v, received %v", + j, *spt) + } +} + +func TestServicePrincipalTokenEnsureFreshRefreshes(t *testing.T) { + spt := newServicePrincipalToken() + expireToken(&spt.Token) + + body := mocks.NewBody(newTokenJSON("test", "test")) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + + f := false + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + f = true + return resp, nil + }) + } + })()) + spt.SetSender(s) + err := spt.EnsureFresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#EnsureFresh returned an unexpected error (%v)", err) + } + if !f { + t.Fatal("adal: ServicePrincipalToken#EnsureFresh failed to call Refresh for stale token") + } +} + +func TestServicePrincipalTokenEnsureFreshSkipsIfFresh(t *testing.T) { + spt := newServicePrincipalToken() + setTokenToExpireIn(&spt.Token, 1000*time.Second) + + f := false + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + f = true + return mocks.NewResponse(), nil + }) + } + })()) + spt.SetSender(s) + err := spt.EnsureFresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#EnsureFresh returned an unexpected error (%v)", err) + } + if f { + t.Fatal("adal: ServicePrincipalToken#EnsureFresh invoked Refresh for fresh token") + } +} + +func TestRefreshCallback(t *testing.T) { + callbackTriggered := false + spt := newServicePrincipalToken(func(Token) error { + callbackTriggered = true + return nil + }) + + expiresOn := strconv.Itoa(int(time.Now().Add(3600 * time.Second).Sub(expirationBase).Seconds())) + + sender := mocks.NewSender() + j := newTokenJSON(expiresOn, "resource") + sender.AppendResponse(mocks.NewResponseWithContent(j)) + spt.SetSender(sender) + err := spt.Refresh() + if err != nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh returned an unexpected error (%v)", err) + } + if !callbackTriggered { + t.Fatalf("adal: RefreshCallback failed to trigger call callback") + } +} + +func TestRefreshCallbackErrorPropagates(t *testing.T) { + errorText := "this is an error text" + spt := newServicePrincipalToken(func(Token) error { + return fmt.Errorf(errorText) + }) + + expiresOn := strconv.Itoa(int(time.Now().Add(3600 * time.Second).Sub(expirationBase).Seconds())) + + sender := mocks.NewSender() + j := newTokenJSON(expiresOn, "resource") + sender.AppendResponse(mocks.NewResponseWithContent(j)) + spt.SetSender(sender) + err := spt.Refresh() + + if err == nil || !strings.Contains(err.Error(), errorText) { + t.Fatalf("adal: RefreshCallback failed to propagate error") + } +} + +// This demonstrates the danger of manual token without a refresh token +func TestServicePrincipalTokenManualRefreshFailsWithoutRefresh(t *testing.T) { + spt := newServicePrincipalTokenManual() + spt.RefreshToken = "" + err := spt.Refresh() + if err == nil { + t.Fatalf("adal: ServicePrincipalToken#Refresh should have failed with a ManualTokenSecret without a refresh token") + } +} + +func TestNewServicePrincipalTokenFromMSI(t *testing.T) { + resource := "https://resource" + + cb := func(token Token) error { return nil } + tempSettingsFile, err := ioutil.TempFile("", "ManagedIdentity-Settings") + if err != nil { + t.Fatal("Couldn't write temp settings file") + } + defer os.Remove(tempSettingsFile.Name()) + + settingsContents := []byte(`{ + "url": "http://msiendpoint/" + }`) + + if _, err := tempSettingsFile.Write(settingsContents); err != nil { + t.Fatal("Couldn't fill temp settings file") + } + + oauthConfig, err := NewOAuthConfig("http://adendpoint", "1-2-3-4") + if err != nil { + t.Fatal("Failed to construct oauthconfig") + } + + spt, err := newServicePrincipalTokenFromMSI( + *oauthConfig, + resource, + tempSettingsFile.Name(), + cb) + if err != nil { + t.Fatalf("Failed to get MSI SPT: %v", err) + } + + // check some of the SPT fields + if _, ok := spt.secret.(*ServicePrincipalMSISecret); !ok { + t.Fatal("SPT secret was not of MSI type") + } + + if spt.resource != resource { + t.Fatal("SPT came back with incorrect resource") + } + + if len(spt.refreshCallbacks) != 1 { + t.Fatal("SPT had incorrect refresh callbacks.") + } +} + +func newToken() *Token { + return &Token{ + AccessToken: "ASECRETVALUE", + Resource: "https://azure.microsoft.com/", + Type: "Bearer", + } +} + +func newTokenJSON(expiresOn string, resource string) string { + return fmt.Sprintf(`{ + "access_token" : "accessToken", + "expires_in" : "3600", + "expires_on" : "%s", + "not_before" : "%s", + "resource" : "%s", + "token_type" : "Bearer" + }`, + expiresOn, expiresOn, resource) +} + +func newTokenExpiresIn(expireIn time.Duration) *Token { + return setTokenToExpireIn(newToken(), expireIn) +} + +func newTokenExpiresAt(expireAt time.Time) *Token { + return setTokenToExpireAt(newToken(), expireAt) +} + +func expireToken(t *Token) *Token { + return setTokenToExpireIn(t, 0) +} + +func setTokenToExpireAt(t *Token, expireAt time.Time) *Token { + t.ExpiresIn = "3600" + t.ExpiresOn = strconv.Itoa(int(expireAt.Sub(expirationBase).Seconds())) + t.NotBefore = t.ExpiresOn + return t +} + +func setTokenToExpireIn(t *Token, expireIn time.Duration) *Token { + return setTokenToExpireAt(t, time.Now().Add(expireIn)) +} + +func newServicePrincipalToken(callbacks ...TokenRefreshCallback) *ServicePrincipalToken { + spt, _ := NewServicePrincipalToken(TestOAuthConfig, "id", "secret", "resource", callbacks...) + return spt +} + +func newServicePrincipalTokenManual() *ServicePrincipalToken { + token := newToken() + token.RefreshToken = "refreshtoken" + spt, _ := NewServicePrincipalTokenFromManualToken(TestOAuthConfig, "id", "resource", *token) + return spt +} + +func newServicePrincipalTokenCertificate(t *testing.T) *ServicePrincipalToken { + template := x509.Certificate{ + SerialNumber: big.NewInt(0), + Subject: pkix.Name{CommonName: "test"}, + BasicConstraintsValid: true, + } + privateKey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + certificateBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &privateKey.PublicKey, privateKey) + if err != nil { + t.Fatal(err) + } + certificate, err := x509.ParseCertificate(certificateBytes) + if err != nil { + t.Fatal(err) + } + + spt, _ := NewServicePrincipalTokenFromCertificate(TestOAuthConfig, "id", certificate, privateKey, "resource") + return spt +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go index 9f8bd131da..7f4e3d8454 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization.go +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization.go @@ -1,57 +1,57 @@ -package autorest - -import ( - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest/adal" -) - -// Authorizer is the interface that provides a PrepareDecorator used to supply request -// authorization. Most often, the Authorizer decorator runs last so it has access to the full -// state of the formed HTTP request. -type Authorizer interface { - WithAuthorization() PrepareDecorator -} - -// NullAuthorizer implements a default, "do nothing" Authorizer. -type NullAuthorizer struct{} - -// WithAuthorization returns a PrepareDecorator that does nothing. -func (na NullAuthorizer) WithAuthorization() PrepareDecorator { - return WithNothing() -} - -// BearerAuthorizer implements the bearer authorization -type BearerAuthorizer struct { - tokenProvider adal.OAuthTokenProvider -} - -// NewBearerAuthorizer crates a BearerAuthorizer using the given token provider -func NewBearerAuthorizer(tp adal.OAuthTokenProvider) *BearerAuthorizer { - return &BearerAuthorizer{tokenProvider: tp} -} - -func (ba *BearerAuthorizer) withBearerAuthorization() PrepareDecorator { - return WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", ba.tokenProvider.OAuthToken())) -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose -// value is "Bearer " followed by the token. -// -// By default, the token will be automatically refreshed through the Refresher interface. -func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - refresher, ok := ba.tokenProvider.(adal.Refresher) - if ok { - err := refresher.EnsureFresh() - if err != nil { - return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", nil, - "Failed to refresh the Token for request to %s", r.URL) - } - } - return (ba.withBearerAuthorization()(p)).Prepare(r) - }) - } -} +package autorest + +import ( + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest/adal" +) + +// Authorizer is the interface that provides a PrepareDecorator used to supply request +// authorization. Most often, the Authorizer decorator runs last so it has access to the full +// state of the formed HTTP request. +type Authorizer interface { + WithAuthorization() PrepareDecorator +} + +// NullAuthorizer implements a default, "do nothing" Authorizer. +type NullAuthorizer struct{} + +// WithAuthorization returns a PrepareDecorator that does nothing. +func (na NullAuthorizer) WithAuthorization() PrepareDecorator { + return WithNothing() +} + +// BearerAuthorizer implements the bearer authorization +type BearerAuthorizer struct { + tokenProvider adal.OAuthTokenProvider +} + +// NewBearerAuthorizer crates a BearerAuthorizer using the given token provider +func NewBearerAuthorizer(tp adal.OAuthTokenProvider) *BearerAuthorizer { + return &BearerAuthorizer{tokenProvider: tp} +} + +func (ba *BearerAuthorizer) withBearerAuthorization() PrepareDecorator { + return WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", ba.tokenProvider.OAuthToken())) +} + +// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose +// value is "Bearer " followed by the token. +// +// By default, the token will be automatically refreshed through the Refresher interface. +func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + refresher, ok := ba.tokenProvider.(adal.Refresher) + if ok { + err := refresher.EnsureFresh() + if err != nil { + return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", nil, + "Failed to refresh the Token for request to %s", r.URL) + } + } + return (ba.withBearerAuthorization()(p)).Prepare(r) + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go b/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go index cf3711a676..d3f6388801 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization_test.go @@ -1,137 +1,137 @@ -package autorest - -import ( - "fmt" - "net/http" - "reflect" - "testing" - - "github.com/Azure/go-autorest/autorest/adal" - "github.com/Azure/go-autorest/autorest/mocks" -) - -const ( - TestTenantID = "TestTenantID" - TestActiveDirectoryEndpoint = "https://login/test.com/" -) - -func TestWithAuthorizer(t *testing.T) { - r1 := mocks.NewRequest() - - na := &NullAuthorizer{} - r2, err := Prepare(r1, - na.WithAuthorization()) - if err != nil { - t.Fatalf("autorest: NullAuthorizer#WithAuthorization returned an unexpected error (%v)", err) - } else if !reflect.DeepEqual(r1, r2) { - t.Fatalf("autorest: NullAuthorizer#WithAuthorization modified the request -- received %v, expected %v", r2, r1) - } -} - -func TestTokenWithAuthorization(t *testing.T) { - token := &adal.Token{ - AccessToken: "TestToken", - Resource: "https://azure.microsoft.com/", - Type: "Bearer", - } - - ba := NewBearerAuthorizer(token) - req, err := Prepare(&http.Request{}, ba.WithAuthorization()) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } else if req.Header.Get(http.CanonicalHeaderKey("Authorization")) != fmt.Sprintf("Bearer %s", token.AccessToken) { - t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to set Authorization header") - } -} - -func TestServicePrincipalTokenWithAuthorizationNoRefresh(t *testing.T) { - oauthConfig, err := adal.NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } - spt, err := adal.NewServicePrincipalToken(*oauthConfig, "id", "secret", "resource", nil) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } - spt.SetAutoRefresh(false) - s := mocks.NewSender() - spt.SetSender(s) - - ba := NewBearerAuthorizer(spt) - req, err := Prepare(mocks.NewRequest(), ba.WithAuthorization()) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } else if req.Header.Get(http.CanonicalHeaderKey("Authorization")) != fmt.Sprintf("Bearer %s", spt.AccessToken) { - t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to set Authorization header") - } -} - -func TestServicePrincipalTokenWithAuthorizationRefresh(t *testing.T) { - - oauthConfig, err := adal.NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } - refreshed := false - spt, err := adal.NewServicePrincipalToken(*oauthConfig, "id", "secret", "resource", func(t adal.Token) error { - refreshed = true - return nil - }) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } - - jwt := `{ - "access_token" : "accessToken", - "expires_in" : "3600", - "expires_on" : "test", - "not_before" : "test", - "resource" : "test", - "token_type" : "Bearer" - }` - body := mocks.NewBody(jwt) - resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") - c := mocks.NewSender() - s := DecorateSender(c, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return resp, nil - }) - } - })()) - spt.SetSender(s) - - ba := NewBearerAuthorizer(spt) - req, err := Prepare(mocks.NewRequest(), ba.WithAuthorization()) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } else if req.Header.Get(http.CanonicalHeaderKey("Authorization")) != fmt.Sprintf("Bearer %s", spt.AccessToken) { - t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to set Authorization header") - } - - if !refreshed { - t.Fatal("azure: BearerAuthorizer#WithAuthorization must refresh the token") - } -} - -func TestServicePrincipalTokenWithAuthorizationReturnsErrorIfConnotRefresh(t *testing.T) { - oauthConfig, err := adal.NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } - spt, err := adal.NewServicePrincipalToken(*oauthConfig, "id", "secret", "resource", nil) - if err != nil { - t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) - } - - s := mocks.NewSender() - s.AppendResponse(mocks.NewResponseWithStatus("400 Bad Request", http.StatusBadRequest)) - spt.SetSender(s) - - ba := NewBearerAuthorizer(spt) - _, err = Prepare(mocks.NewRequest(), ba.WithAuthorization()) - if err == nil { - t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to return an error when refresh fails") - } -} +package autorest + +import ( + "fmt" + "net/http" + "reflect" + "testing" + + "github.com/Azure/go-autorest/autorest/adal" + "github.com/Azure/go-autorest/autorest/mocks" +) + +const ( + TestTenantID = "TestTenantID" + TestActiveDirectoryEndpoint = "https://login/test.com/" +) + +func TestWithAuthorizer(t *testing.T) { + r1 := mocks.NewRequest() + + na := &NullAuthorizer{} + r2, err := Prepare(r1, + na.WithAuthorization()) + if err != nil { + t.Fatalf("autorest: NullAuthorizer#WithAuthorization returned an unexpected error (%v)", err) + } else if !reflect.DeepEqual(r1, r2) { + t.Fatalf("autorest: NullAuthorizer#WithAuthorization modified the request -- received %v, expected %v", r2, r1) + } +} + +func TestTokenWithAuthorization(t *testing.T) { + token := &adal.Token{ + AccessToken: "TestToken", + Resource: "https://azure.microsoft.com/", + Type: "Bearer", + } + + ba := NewBearerAuthorizer(token) + req, err := Prepare(&http.Request{}, ba.WithAuthorization()) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } else if req.Header.Get(http.CanonicalHeaderKey("Authorization")) != fmt.Sprintf("Bearer %s", token.AccessToken) { + t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to set Authorization header") + } +} + +func TestServicePrincipalTokenWithAuthorizationNoRefresh(t *testing.T) { + oauthConfig, err := adal.NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } + spt, err := adal.NewServicePrincipalToken(*oauthConfig, "id", "secret", "resource", nil) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } + spt.SetAutoRefresh(false) + s := mocks.NewSender() + spt.SetSender(s) + + ba := NewBearerAuthorizer(spt) + req, err := Prepare(mocks.NewRequest(), ba.WithAuthorization()) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } else if req.Header.Get(http.CanonicalHeaderKey("Authorization")) != fmt.Sprintf("Bearer %s", spt.AccessToken) { + t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to set Authorization header") + } +} + +func TestServicePrincipalTokenWithAuthorizationRefresh(t *testing.T) { + + oauthConfig, err := adal.NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } + refreshed := false + spt, err := adal.NewServicePrincipalToken(*oauthConfig, "id", "secret", "resource", func(t adal.Token) error { + refreshed = true + return nil + }) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } + + jwt := `{ + "access_token" : "accessToken", + "expires_in" : "3600", + "expires_on" : "test", + "not_before" : "test", + "resource" : "test", + "token_type" : "Bearer" + }` + body := mocks.NewBody(jwt) + resp := mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK") + c := mocks.NewSender() + s := DecorateSender(c, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return resp, nil + }) + } + })()) + spt.SetSender(s) + + ba := NewBearerAuthorizer(spt) + req, err := Prepare(mocks.NewRequest(), ba.WithAuthorization()) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } else if req.Header.Get(http.CanonicalHeaderKey("Authorization")) != fmt.Sprintf("Bearer %s", spt.AccessToken) { + t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to set Authorization header") + } + + if !refreshed { + t.Fatal("azure: BearerAuthorizer#WithAuthorization must refresh the token") + } +} + +func TestServicePrincipalTokenWithAuthorizationReturnsErrorIfConnotRefresh(t *testing.T) { + oauthConfig, err := adal.NewOAuthConfig(TestActiveDirectoryEndpoint, TestTenantID) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } + spt, err := adal.NewServicePrincipalToken(*oauthConfig, "id", "secret", "resource", nil) + if err != nil { + t.Fatalf("azure: BearerAuthorizer#WithAuthorization returned an error (%v)", err) + } + + s := mocks.NewSender() + s.AppendResponse(mocks.NewResponseWithStatus("400 Bad Request", http.StatusBadRequest)) + spt.SetSender(s) + + ba := NewBearerAuthorizer(spt) + _, err = Prepare(mocks.NewRequest(), ba.WithAuthorization()) + if err == nil { + t.Fatal("azure: BearerAuthorizer#WithAuthorization failed to return an error when refresh fails") + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest.go b/vendor/github.com/Azure/go-autorest/autorest/autorest.go index f272945385..51f1c4bbca 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/autorest.go +++ b/vendor/github.com/Azure/go-autorest/autorest/autorest.go @@ -1,115 +1,115 @@ -/* -Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines -and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) -generated Go code. - -The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, -and Responding. A typical pattern is: - - req, err := Prepare(&http.Request{}, - token.WithAuthorization()) - - resp, err := Send(req, - WithLogging(logger), - DoErrorIfStatusCode(http.StatusInternalServerError), - DoCloseIfError(), - DoRetryForAttempts(5, time.Second)) - - err = Respond(resp, - ByDiscardingBody(), - ByClosing()) - -Each phase relies on decorators to modify and / or manage processing. Decorators may first modify -and then pass the data along, pass the data first and then modify the result, or wrap themselves -around passing the data (such as a logger might do). Decorators run in the order provided. For -example, the following: - - req, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPath("a"), - WithPath("b"), - WithPath("c")) - -will set the URL to: - - https://microsoft.com/a/b/c - -Preparers and Responders may be shared and re-used (assuming the underlying decorators support -sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders -shared among multiple go-routines, and a single Sender shared among multiple sending go-routines, -all bound together by means of input / output channels. - -Decorators hold their passed state within a closure (such as the path components in the example -above). Be careful to share Preparers and Responders only in a context where such held state -applies. For example, it may not make sense to share a Preparer that applies a query string from a -fixed set of values. Similarly, sharing a Responder that reads the response body into a passed -struct (e.g., ByUnmarshallingJson) is likely incorrect. - -Lastly, the Swagger specification (https://swagger.io) that drives AutoRest -(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The -github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure -correct parsing and formatting. - -Errors raised by autorest objects and methods will conform to the autorest.Error interface. - -See the included examples for more detail. For details on the suggested use of this package by -generated clients, see the Client described below. -*/ -package autorest - -import ( - "net/http" - "time" -) - -const ( - // HeaderLocation specifies the HTTP Location header. - HeaderLocation = "Location" - - // HeaderRetryAfter specifies the HTTP Retry-After header. - HeaderRetryAfter = "Retry-After" -) - -// ResponseHasStatusCode returns true if the status code in the HTTP Response is in the passed set -// and false otherwise. -func ResponseHasStatusCode(resp *http.Response, codes ...int) bool { - return containsInt(codes, resp.StatusCode) -} - -// GetLocation retrieves the URL from the Location header of the passed response. -func GetLocation(resp *http.Response) string { - return resp.Header.Get(HeaderLocation) -} - -// GetRetryAfter extracts the retry delay from the Retry-After header of the passed response. If -// the header is absent or is malformed, it will return the supplied default delay time.Duration. -func GetRetryAfter(resp *http.Response, defaultDelay time.Duration) time.Duration { - retry := resp.Header.Get(HeaderRetryAfter) - if retry == "" { - return defaultDelay - } - - d, err := time.ParseDuration(retry + "s") - if err != nil { - return defaultDelay - } - - return d -} - -// NewPollingRequest allocates and returns a new http.Request to poll for the passed response. -func NewPollingRequest(resp *http.Response, cancel <-chan struct{}) (*http.Request, error) { - location := GetLocation(resp) - if location == "" { - return nil, NewErrorWithResponse("autorest", "NewPollingRequest", resp, "Location header missing from response that requires polling") - } - - req, err := Prepare(&http.Request{Cancel: cancel}, - AsGet(), - WithBaseURL(location)) - if err != nil { - return nil, NewErrorWithError(err, "autorest", "NewPollingRequest", nil, "Failure creating poll request to %s", location) - } - - return req, nil -} +/* +Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines +and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) +generated Go code. + +The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, +and Responding. A typical pattern is: + + req, err := Prepare(&http.Request{}, + token.WithAuthorization()) + + resp, err := Send(req, + WithLogging(logger), + DoErrorIfStatusCode(http.StatusInternalServerError), + DoCloseIfError(), + DoRetryForAttempts(5, time.Second)) + + err = Respond(resp, + ByDiscardingBody(), + ByClosing()) + +Each phase relies on decorators to modify and / or manage processing. Decorators may first modify +and then pass the data along, pass the data first and then modify the result, or wrap themselves +around passing the data (such as a logger might do). Decorators run in the order provided. For +example, the following: + + req, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + WithPath("a"), + WithPath("b"), + WithPath("c")) + +will set the URL to: + + https://microsoft.com/a/b/c + +Preparers and Responders may be shared and re-used (assuming the underlying decorators support +sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders +shared among multiple go-routines, and a single Sender shared among multiple sending go-routines, +all bound together by means of input / output channels. + +Decorators hold their passed state within a closure (such as the path components in the example +above). Be careful to share Preparers and Responders only in a context where such held state +applies. For example, it may not make sense to share a Preparer that applies a query string from a +fixed set of values. Similarly, sharing a Responder that reads the response body into a passed +struct (e.g., ByUnmarshallingJson) is likely incorrect. + +Lastly, the Swagger specification (https://swagger.io) that drives AutoRest +(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The +github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure +correct parsing and formatting. + +Errors raised by autorest objects and methods will conform to the autorest.Error interface. + +See the included examples for more detail. For details on the suggested use of this package by +generated clients, see the Client described below. +*/ +package autorest + +import ( + "net/http" + "time" +) + +const ( + // HeaderLocation specifies the HTTP Location header. + HeaderLocation = "Location" + + // HeaderRetryAfter specifies the HTTP Retry-After header. + HeaderRetryAfter = "Retry-After" +) + +// ResponseHasStatusCode returns true if the status code in the HTTP Response is in the passed set +// and false otherwise. +func ResponseHasStatusCode(resp *http.Response, codes ...int) bool { + return containsInt(codes, resp.StatusCode) +} + +// GetLocation retrieves the URL from the Location header of the passed response. +func GetLocation(resp *http.Response) string { + return resp.Header.Get(HeaderLocation) +} + +// GetRetryAfter extracts the retry delay from the Retry-After header of the passed response. If +// the header is absent or is malformed, it will return the supplied default delay time.Duration. +func GetRetryAfter(resp *http.Response, defaultDelay time.Duration) time.Duration { + retry := resp.Header.Get(HeaderRetryAfter) + if retry == "" { + return defaultDelay + } + + d, err := time.ParseDuration(retry + "s") + if err != nil { + return defaultDelay + } + + return d +} + +// NewPollingRequest allocates and returns a new http.Request to poll for the passed response. +func NewPollingRequest(resp *http.Response, cancel <-chan struct{}) (*http.Request, error) { + location := GetLocation(resp) + if location == "" { + return nil, NewErrorWithResponse("autorest", "NewPollingRequest", resp, "Location header missing from response that requires polling") + } + + req, err := Prepare(&http.Request{Cancel: cancel}, + AsGet(), + WithBaseURL(location)) + if err != nil { + return nil, NewErrorWithError(err, "autorest", "NewPollingRequest", nil, "Failure creating poll request to %s", location) + } + + return req, nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go b/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go index 99d673ae79..58f6501140 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/autorest_test.go @@ -1,126 +1,126 @@ -package autorest - -import ( - "net/http" - "testing" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -func TestResponseHasStatusCode(t *testing.T) { - codes := []int{http.StatusOK, http.StatusAccepted} - resp := &http.Response{StatusCode: http.StatusAccepted} - if !ResponseHasStatusCode(resp, codes...) { - t.Fatalf("autorest: ResponseHasStatusCode failed to find %v in %v", resp.StatusCode, codes) - } -} - -func TestResponseHasStatusCodeNotPresent(t *testing.T) { - codes := []int{http.StatusOK, http.StatusAccepted} - resp := &http.Response{StatusCode: http.StatusInternalServerError} - if ResponseHasStatusCode(resp, codes...) { - t.Fatalf("autorest: ResponseHasStatusCode unexpectedly found %v in %v", resp.StatusCode, codes) - } -} - -func TestNewPollingRequestDoesNotReturnARequestWhenLocationHeaderIsMissing(t *testing.T) { - resp := mocks.NewResponseWithStatus("500 InternalServerError", http.StatusInternalServerError) - - req, _ := NewPollingRequest(resp, nil) - if req != nil { - t.Fatal("autorest: NewPollingRequest returned an http.Request when the Location header was missing") - } -} - -func TestNewPollingRequestReturnsAnErrorWhenPrepareFails(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - resp.Header.Set(http.CanonicalHeaderKey(HeaderLocation), mocks.TestBadURL) - - _, err := NewPollingRequest(resp, nil) - if err == nil { - t.Fatal("autorest: NewPollingRequest failed to return an error when Prepare fails") - } -} - -func TestNewPollingRequestDoesNotReturnARequestWhenPrepareFails(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - resp.Header.Set(http.CanonicalHeaderKey(HeaderLocation), mocks.TestBadURL) - - req, _ := NewPollingRequest(resp, nil) - if req != nil { - t.Fatal("autorest: NewPollingRequest returned an http.Request when Prepare failed") - } -} - -func TestNewPollingRequestReturnsAGetRequest(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - - req, _ := NewPollingRequest(resp, nil) - if req.Method != "GET" { - t.Fatalf("autorest: NewPollingRequest did not create an HTTP GET request -- actual method %v", req.Method) - } -} - -func TestNewPollingRequestProvidesTheURL(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - - req, _ := NewPollingRequest(resp, nil) - if req.URL.String() != mocks.TestURL { - t.Fatalf("autorest: NewPollingRequest did not create an HTTP with the expected URL -- received %v, expected %v", req.URL, mocks.TestURL) - } -} - -func TestGetLocation(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - - l := GetLocation(resp) - if len(l) == 0 { - t.Fatalf("autorest: GetLocation failed to return Location header -- expected %v, received %v", mocks.TestURL, l) - } -} - -func TestGetLocationReturnsEmptyStringForMissingLocation(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - - l := GetLocation(resp) - if len(l) != 0 { - t.Fatalf("autorest: GetLocation return a value without a Location header -- received %v", l) - } -} - -func TestGetRetryAfter(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - - d := GetRetryAfter(resp, DefaultPollingDelay) - if d != mocks.TestDelay { - t.Fatalf("autorest: GetRetryAfter failed to returned the expected delay -- expected %v, received %v", mocks.TestDelay, d) - } -} - -func TestGetRetryAfterReturnsDefaultDelayIfRetryHeaderIsMissing(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - - d := GetRetryAfter(resp, DefaultPollingDelay) - if d != DefaultPollingDelay { - t.Fatalf("autorest: GetRetryAfter failed to returned the default delay for a missing Retry-After header -- expected %v, received %v", - DefaultPollingDelay, d) - } -} - -func TestGetRetryAfterReturnsDefaultDelayIfRetryHeaderIsMalformed(t *testing.T) { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - resp.Header.Set(http.CanonicalHeaderKey(HeaderRetryAfter), "a very bad non-integer value") - - d := GetRetryAfter(resp, DefaultPollingDelay) - if d != DefaultPollingDelay { - t.Fatalf("autorest: GetRetryAfter failed to returned the default delay for a malformed Retry-After header -- expected %v, received %v", - DefaultPollingDelay, d) - } -} +package autorest + +import ( + "net/http" + "testing" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +func TestResponseHasStatusCode(t *testing.T) { + codes := []int{http.StatusOK, http.StatusAccepted} + resp := &http.Response{StatusCode: http.StatusAccepted} + if !ResponseHasStatusCode(resp, codes...) { + t.Fatalf("autorest: ResponseHasStatusCode failed to find %v in %v", resp.StatusCode, codes) + } +} + +func TestResponseHasStatusCodeNotPresent(t *testing.T) { + codes := []int{http.StatusOK, http.StatusAccepted} + resp := &http.Response{StatusCode: http.StatusInternalServerError} + if ResponseHasStatusCode(resp, codes...) { + t.Fatalf("autorest: ResponseHasStatusCode unexpectedly found %v in %v", resp.StatusCode, codes) + } +} + +func TestNewPollingRequestDoesNotReturnARequestWhenLocationHeaderIsMissing(t *testing.T) { + resp := mocks.NewResponseWithStatus("500 InternalServerError", http.StatusInternalServerError) + + req, _ := NewPollingRequest(resp, nil) + if req != nil { + t.Fatal("autorest: NewPollingRequest returned an http.Request when the Location header was missing") + } +} + +func TestNewPollingRequestReturnsAnErrorWhenPrepareFails(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + resp.Header.Set(http.CanonicalHeaderKey(HeaderLocation), mocks.TestBadURL) + + _, err := NewPollingRequest(resp, nil) + if err == nil { + t.Fatal("autorest: NewPollingRequest failed to return an error when Prepare fails") + } +} + +func TestNewPollingRequestDoesNotReturnARequestWhenPrepareFails(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + resp.Header.Set(http.CanonicalHeaderKey(HeaderLocation), mocks.TestBadURL) + + req, _ := NewPollingRequest(resp, nil) + if req != nil { + t.Fatal("autorest: NewPollingRequest returned an http.Request when Prepare failed") + } +} + +func TestNewPollingRequestReturnsAGetRequest(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + + req, _ := NewPollingRequest(resp, nil) + if req.Method != "GET" { + t.Fatalf("autorest: NewPollingRequest did not create an HTTP GET request -- actual method %v", req.Method) + } +} + +func TestNewPollingRequestProvidesTheURL(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + + req, _ := NewPollingRequest(resp, nil) + if req.URL.String() != mocks.TestURL { + t.Fatalf("autorest: NewPollingRequest did not create an HTTP with the expected URL -- received %v, expected %v", req.URL, mocks.TestURL) + } +} + +func TestGetLocation(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + + l := GetLocation(resp) + if len(l) == 0 { + t.Fatalf("autorest: GetLocation failed to return Location header -- expected %v, received %v", mocks.TestURL, l) + } +} + +func TestGetLocationReturnsEmptyStringForMissingLocation(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + + l := GetLocation(resp) + if len(l) != 0 { + t.Fatalf("autorest: GetLocation return a value without a Location header -- received %v", l) + } +} + +func TestGetRetryAfter(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + + d := GetRetryAfter(resp, DefaultPollingDelay) + if d != mocks.TestDelay { + t.Fatalf("autorest: GetRetryAfter failed to returned the expected delay -- expected %v, received %v", mocks.TestDelay, d) + } +} + +func TestGetRetryAfterReturnsDefaultDelayIfRetryHeaderIsMissing(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + + d := GetRetryAfter(resp, DefaultPollingDelay) + if d != DefaultPollingDelay { + t.Fatalf("autorest: GetRetryAfter failed to returned the default delay for a missing Retry-After header -- expected %v, received %v", + DefaultPollingDelay, d) + } +} + +func TestGetRetryAfterReturnsDefaultDelayIfRetryHeaderIsMalformed(t *testing.T) { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + resp.Header.Set(http.CanonicalHeaderKey(HeaderRetryAfter), "a very bad non-integer value") + + d := GetRetryAfter(resp, DefaultPollingDelay) + if d != DefaultPollingDelay { + t.Fatalf("autorest: GetRetryAfter failed to returned the default delay for a malformed Retry-After header -- expected %v, received %v", + DefaultPollingDelay, d) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go index e32ea15760..332a8909d1 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go @@ -1,302 +1,302 @@ -package azure - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "strings" - "time" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -const ( - headerAsyncOperation = "Azure-AsyncOperation" -) - -const ( - operationInProgress string = "InProgress" - operationCanceled string = "Canceled" - operationFailed string = "Failed" - operationSucceeded string = "Succeeded" -) - -// DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure -// long-running operation. It will delay between requests for the duration specified in the -// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by -// closing the optional channel on the http.Request. -func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator { - return func(s autorest.Sender) autorest.Sender { - return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - resp, err = s.Do(r) - if err != nil { - return resp, err - } - pollingCodes := []int{http.StatusAccepted, http.StatusCreated, http.StatusOK} - if !autorest.ResponseHasStatusCode(resp, pollingCodes...) { - return resp, nil - } - - ps := pollingState{} - for err == nil { - err = updatePollingState(resp, &ps) - if err != nil { - break - } - if ps.hasTerminated() { - if !ps.hasSucceeded() { - err = ps - } - break - } - - r, err = newPollingRequest(resp, ps) - if err != nil { - return resp, err - } - - delay = autorest.GetRetryAfter(resp, delay) - resp, err = autorest.SendWithSender(s, r, - autorest.AfterDelay(delay)) - } - - return resp, err - }) - } -} - -func getAsyncOperation(resp *http.Response) string { - return resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) -} - -func hasSucceeded(state string) bool { - return state == operationSucceeded -} - -func hasTerminated(state string) bool { - switch state { - case operationCanceled, operationFailed, operationSucceeded: - return true - default: - return false - } -} - -func hasFailed(state string) bool { - return state == operationFailed -} - -type provisioningTracker interface { - state() string - hasSucceeded() bool - hasTerminated() bool -} - -type operationResource struct { - // Note: - // The specification states services should return the "id" field. However some return it as - // "operationId". - ID string `json:"id"` - OperationID string `json:"operationId"` - Name string `json:"name"` - Status string `json:"status"` - Properties map[string]interface{} `json:"properties"` - OperationError ServiceError `json:"error"` - StartTime date.Time `json:"startTime"` - EndTime date.Time `json:"endTime"` - PercentComplete float64 `json:"percentComplete"` -} - -func (or operationResource) state() string { - return or.Status -} - -func (or operationResource) hasSucceeded() bool { - return hasSucceeded(or.state()) -} - -func (or operationResource) hasTerminated() bool { - return hasTerminated(or.state()) -} - -type provisioningProperties struct { - ProvisioningState string `json:"provisioningState"` -} - -type provisioningStatus struct { - Properties provisioningProperties `json:"properties,omitempty"` - ProvisioningError ServiceError `json:"error,omitempty"` -} - -func (ps provisioningStatus) state() string { - return ps.Properties.ProvisioningState -} - -func (ps provisioningStatus) hasSucceeded() bool { - return hasSucceeded(ps.state()) -} - -func (ps provisioningStatus) hasTerminated() bool { - return hasTerminated(ps.state()) -} - -func (ps provisioningStatus) hasProvisioningError() bool { - return ps.ProvisioningError != ServiceError{} -} - -type pollingResponseFormat string - -const ( - usesOperationResponse pollingResponseFormat = "OperationResponse" - usesProvisioningStatus pollingResponseFormat = "ProvisioningStatus" - formatIsUnknown pollingResponseFormat = "" -) - -type pollingState struct { - responseFormat pollingResponseFormat - uri string - state string - code string - message string -} - -func (ps pollingState) hasSucceeded() bool { - return hasSucceeded(ps.state) -} - -func (ps pollingState) hasTerminated() bool { - return hasTerminated(ps.state) -} - -func (ps pollingState) hasFailed() bool { - return hasFailed(ps.state) -} - -func (ps pollingState) Error() string { - return fmt.Sprintf("Long running operation terminated with status '%s': Code=%q Message=%q", ps.state, ps.code, ps.message) -} - -// updatePollingState maps the operation status -- retrieved from either a provisioningState -// field, the status field of an OperationResource, or inferred from the HTTP status code -- -// into a well-known states. Since the process begins from the initial request, the state -// always comes from either a the provisioningState returned or is inferred from the HTTP -// status code. Subsequent requests will read an Azure OperationResource object if the -// service initially returned the Azure-AsyncOperation header. The responseFormat field notes -// the expected response format. -func updatePollingState(resp *http.Response, ps *pollingState) error { - // Determine the response shape - // -- The first response will always be a provisioningStatus response; only the polling requests, - // depending on the header returned, may be something otherwise. - var pt provisioningTracker - if ps.responseFormat == usesOperationResponse { - pt = &operationResource{} - } else { - pt = &provisioningStatus{} - } - - // If this is the first request (that is, the polling response shape is unknown), determine how - // to poll and what to expect - if ps.responseFormat == formatIsUnknown { - req := resp.Request - if req == nil { - return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Original HTTP request is missing") - } - - // Prefer the Azure-AsyncOperation header - ps.uri = getAsyncOperation(resp) - if ps.uri != "" { - ps.responseFormat = usesOperationResponse - } else { - ps.responseFormat = usesProvisioningStatus - } - - // Else, use the Location header - if ps.uri == "" { - ps.uri = autorest.GetLocation(resp) - } - - // Lastly, requests against an existing resource, use the last request URI - if ps.uri == "" { - m := strings.ToUpper(req.Method) - if m == http.MethodPatch || m == http.MethodPut || m == http.MethodGet { - ps.uri = req.URL.String() - } - } - } - - // Read and interpret the response (saving the Body in case no polling is necessary) - b := &bytes.Buffer{} - err := autorest.Respond(resp, - autorest.ByCopying(b), - autorest.ByUnmarshallingJSON(pt), - autorest.ByClosing()) - resp.Body = ioutil.NopCloser(b) - if err != nil { - return err - } - - // Interpret the results - // -- Terminal states apply regardless - // -- Unknown states are per-service inprogress states - // -- Otherwise, infer state from HTTP status code - if pt.hasTerminated() { - ps.state = pt.state() - } else if pt.state() != "" { - ps.state = operationInProgress - } else { - switch resp.StatusCode { - case http.StatusAccepted: - ps.state = operationInProgress - - case http.StatusNoContent, http.StatusCreated, http.StatusOK: - ps.state = operationSucceeded - - default: - ps.state = operationFailed - } - } - - if ps.state == operationInProgress && ps.uri == "" { - return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Unable to obtain polling URI for %s %s", resp.Request.Method, resp.Request.URL) - } - - // For failed operation, check for error code and message in - // -- Operation resource - // -- Response - // -- Otherwise, Unknown - if ps.hasFailed() { - if ps.responseFormat == usesOperationResponse { - or := pt.(*operationResource) - ps.code = or.OperationError.Code - ps.message = or.OperationError.Message - } else { - p := pt.(*provisioningStatus) - if p.hasProvisioningError() { - ps.code = p.ProvisioningError.Code - ps.message = p.ProvisioningError.Message - } else { - ps.code = "Unknown" - ps.message = "None" - } - } - } - return nil -} - -func newPollingRequest(resp *http.Response, ps pollingState) (*http.Request, error) { - req := resp.Request - if req == nil { - return nil, autorest.NewError("azure", "newPollingRequest", "Azure Polling Error - Original HTTP request is missing") - } - - reqPoll, err := autorest.Prepare(&http.Request{Cancel: req.Cancel}, - autorest.AsGet(), - autorest.WithBaseURL(ps.uri)) - if err != nil { - return nil, autorest.NewErrorWithError(err, "azure", "newPollingRequest", nil, "Failure creating poll request to %s", ps.uri) - } - - return reqPoll, nil -} +package azure + +import ( + "bytes" + "fmt" + "io/ioutil" + "net/http" + "strings" + "time" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +const ( + headerAsyncOperation = "Azure-AsyncOperation" +) + +const ( + operationInProgress string = "InProgress" + operationCanceled string = "Canceled" + operationFailed string = "Failed" + operationSucceeded string = "Succeeded" +) + +// DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure +// long-running operation. It will delay between requests for the duration specified in the +// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by +// closing the optional channel on the http.Request. +func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator { + return func(s autorest.Sender) autorest.Sender { + return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + resp, err = s.Do(r) + if err != nil { + return resp, err + } + pollingCodes := []int{http.StatusAccepted, http.StatusCreated, http.StatusOK} + if !autorest.ResponseHasStatusCode(resp, pollingCodes...) { + return resp, nil + } + + ps := pollingState{} + for err == nil { + err = updatePollingState(resp, &ps) + if err != nil { + break + } + if ps.hasTerminated() { + if !ps.hasSucceeded() { + err = ps + } + break + } + + r, err = newPollingRequest(resp, ps) + if err != nil { + return resp, err + } + + delay = autorest.GetRetryAfter(resp, delay) + resp, err = autorest.SendWithSender(s, r, + autorest.AfterDelay(delay)) + } + + return resp, err + }) + } +} + +func getAsyncOperation(resp *http.Response) string { + return resp.Header.Get(http.CanonicalHeaderKey(headerAsyncOperation)) +} + +func hasSucceeded(state string) bool { + return state == operationSucceeded +} + +func hasTerminated(state string) bool { + switch state { + case operationCanceled, operationFailed, operationSucceeded: + return true + default: + return false + } +} + +func hasFailed(state string) bool { + return state == operationFailed +} + +type provisioningTracker interface { + state() string + hasSucceeded() bool + hasTerminated() bool +} + +type operationResource struct { + // Note: + // The specification states services should return the "id" field. However some return it as + // "operationId". + ID string `json:"id"` + OperationID string `json:"operationId"` + Name string `json:"name"` + Status string `json:"status"` + Properties map[string]interface{} `json:"properties"` + OperationError ServiceError `json:"error"` + StartTime date.Time `json:"startTime"` + EndTime date.Time `json:"endTime"` + PercentComplete float64 `json:"percentComplete"` +} + +func (or operationResource) state() string { + return or.Status +} + +func (or operationResource) hasSucceeded() bool { + return hasSucceeded(or.state()) +} + +func (or operationResource) hasTerminated() bool { + return hasTerminated(or.state()) +} + +type provisioningProperties struct { + ProvisioningState string `json:"provisioningState"` +} + +type provisioningStatus struct { + Properties provisioningProperties `json:"properties,omitempty"` + ProvisioningError ServiceError `json:"error,omitempty"` +} + +func (ps provisioningStatus) state() string { + return ps.Properties.ProvisioningState +} + +func (ps provisioningStatus) hasSucceeded() bool { + return hasSucceeded(ps.state()) +} + +func (ps provisioningStatus) hasTerminated() bool { + return hasTerminated(ps.state()) +} + +func (ps provisioningStatus) hasProvisioningError() bool { + return ps.ProvisioningError != ServiceError{} +} + +type pollingResponseFormat string + +const ( + usesOperationResponse pollingResponseFormat = "OperationResponse" + usesProvisioningStatus pollingResponseFormat = "ProvisioningStatus" + formatIsUnknown pollingResponseFormat = "" +) + +type pollingState struct { + responseFormat pollingResponseFormat + uri string + state string + code string + message string +} + +func (ps pollingState) hasSucceeded() bool { + return hasSucceeded(ps.state) +} + +func (ps pollingState) hasTerminated() bool { + return hasTerminated(ps.state) +} + +func (ps pollingState) hasFailed() bool { + return hasFailed(ps.state) +} + +func (ps pollingState) Error() string { + return fmt.Sprintf("Long running operation terminated with status '%s': Code=%q Message=%q", ps.state, ps.code, ps.message) +} + +// updatePollingState maps the operation status -- retrieved from either a provisioningState +// field, the status field of an OperationResource, or inferred from the HTTP status code -- +// into a well-known states. Since the process begins from the initial request, the state +// always comes from either a the provisioningState returned or is inferred from the HTTP +// status code. Subsequent requests will read an Azure OperationResource object if the +// service initially returned the Azure-AsyncOperation header. The responseFormat field notes +// the expected response format. +func updatePollingState(resp *http.Response, ps *pollingState) error { + // Determine the response shape + // -- The first response will always be a provisioningStatus response; only the polling requests, + // depending on the header returned, may be something otherwise. + var pt provisioningTracker + if ps.responseFormat == usesOperationResponse { + pt = &operationResource{} + } else { + pt = &provisioningStatus{} + } + + // If this is the first request (that is, the polling response shape is unknown), determine how + // to poll and what to expect + if ps.responseFormat == formatIsUnknown { + req := resp.Request + if req == nil { + return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Original HTTP request is missing") + } + + // Prefer the Azure-AsyncOperation header + ps.uri = getAsyncOperation(resp) + if ps.uri != "" { + ps.responseFormat = usesOperationResponse + } else { + ps.responseFormat = usesProvisioningStatus + } + + // Else, use the Location header + if ps.uri == "" { + ps.uri = autorest.GetLocation(resp) + } + + // Lastly, requests against an existing resource, use the last request URI + if ps.uri == "" { + m := strings.ToUpper(req.Method) + if m == http.MethodPatch || m == http.MethodPut || m == http.MethodGet { + ps.uri = req.URL.String() + } + } + } + + // Read and interpret the response (saving the Body in case no polling is necessary) + b := &bytes.Buffer{} + err := autorest.Respond(resp, + autorest.ByCopying(b), + autorest.ByUnmarshallingJSON(pt), + autorest.ByClosing()) + resp.Body = ioutil.NopCloser(b) + if err != nil { + return err + } + + // Interpret the results + // -- Terminal states apply regardless + // -- Unknown states are per-service inprogress states + // -- Otherwise, infer state from HTTP status code + if pt.hasTerminated() { + ps.state = pt.state() + } else if pt.state() != "" { + ps.state = operationInProgress + } else { + switch resp.StatusCode { + case http.StatusAccepted: + ps.state = operationInProgress + + case http.StatusNoContent, http.StatusCreated, http.StatusOK: + ps.state = operationSucceeded + + default: + ps.state = operationFailed + } + } + + if ps.state == operationInProgress && ps.uri == "" { + return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Unable to obtain polling URI for %s %s", resp.Request.Method, resp.Request.URL) + } + + // For failed operation, check for error code and message in + // -- Operation resource + // -- Response + // -- Otherwise, Unknown + if ps.hasFailed() { + if ps.responseFormat == usesOperationResponse { + or := pt.(*operationResource) + ps.code = or.OperationError.Code + ps.message = or.OperationError.Message + } else { + p := pt.(*provisioningStatus) + if p.hasProvisioningError() { + ps.code = p.ProvisioningError.Code + ps.message = p.ProvisioningError.Message + } else { + ps.code = "Unknown" + ps.message = "None" + } + } + } + return nil +} + +func newPollingRequest(resp *http.Response, ps pollingState) (*http.Request, error) { + req := resp.Request + if req == nil { + return nil, autorest.NewError("azure", "newPollingRequest", "Azure Polling Error - Original HTTP request is missing") + } + + reqPoll, err := autorest.Prepare(&http.Request{Cancel: req.Cancel}, + autorest.AsGet(), + autorest.WithBaseURL(ps.uri)) + if err != nil { + return nil, autorest.NewErrorWithError(err, "azure", "newPollingRequest", nil, "Failure creating poll request to %s", ps.uri) + } + + return reqPoll, nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async_test.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async_test.go index 9cd614559c..4c2c695fd9 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/async_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async_test.go @@ -1,1116 +1,1116 @@ -package azure - -import ( - "fmt" - "io/ioutil" - "net/http" - "reflect" - "strings" - "sync" - "testing" - "time" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/mocks" -) - -func TestGetAsyncOperation_ReturnsAzureAsyncOperationHeader(t *testing.T) { - r := newAsynchronousResponse() - - if getAsyncOperation(r) != mocks.TestAzureAsyncURL { - t.Fatalf("azure: getAsyncOperation failed to extract the Azure-AsyncOperation header -- expected %v, received %v", mocks.TestURL, getAsyncOperation(r)) - } -} - -func TestGetAsyncOperation_ReturnsEmptyStringIfHeaderIsAbsent(t *testing.T) { - r := mocks.NewResponse() - - if len(getAsyncOperation(r)) != 0 { - t.Fatalf("azure: getAsyncOperation failed to return empty string when the Azure-AsyncOperation header is absent -- received %v", getAsyncOperation(r)) - } -} - -func TestHasSucceeded_ReturnsTrueForSuccess(t *testing.T) { - if !hasSucceeded(operationSucceeded) { - t.Fatal("azure: hasSucceeded failed to return true for success") - } -} - -func TestHasSucceeded_ReturnsFalseOtherwise(t *testing.T) { - if hasSucceeded("not a success string") { - t.Fatal("azure: hasSucceeded returned true for a non-success") - } -} - -func TestHasTerminated_ReturnsTrueForValidTerminationStates(t *testing.T) { - for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { - if !hasTerminated(state) { - t.Fatalf("azure: hasTerminated failed to return true for the '%s' state", state) - } - } -} - -func TestHasTerminated_ReturnsFalseForUnknownStates(t *testing.T) { - if hasTerminated("not a known state") { - t.Fatal("azure: hasTerminated returned true for an unknown state") - } -} - -func TestOperationError_ErrorReturnsAString(t *testing.T) { - s := (ServiceError{Code: "server code", Message: "server error"}).Error() - if s == "" { - t.Fatalf("azure: operationError#Error failed to return an error") - } - if !strings.Contains(s, "server code") || !strings.Contains(s, "server error") { - t.Fatalf("azure: operationError#Error returned a malformed error -- error='%v'", s) - } -} - -func TestOperationResource_StateReturnsState(t *testing.T) { - if (operationResource{Status: "state"}).state() != "state" { - t.Fatalf("azure: operationResource#state failed to return the correct state") - } -} - -func TestOperationResource_HasSucceededReturnsFalseIfNotSuccess(t *testing.T) { - if (operationResource{Status: "not a success string"}).hasSucceeded() { - t.Fatalf("azure: operationResource#hasSucceeded failed to return false for a canceled operation") - } -} - -func TestOperationResource_HasSucceededReturnsTrueIfSuccessful(t *testing.T) { - if !(operationResource{Status: operationSucceeded}).hasSucceeded() { - t.Fatalf("azure: operationResource#hasSucceeded failed to return true for a successful operation") - } -} - -func TestOperationResource_HasTerminatedReturnsTrueForKnownStates(t *testing.T) { - for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { - if !(operationResource{Status: state}).hasTerminated() { - t.Fatalf("azure: operationResource#hasTerminated failed to return true for the '%s' state", state) - } - } -} - -func TestOperationResource_HasTerminatedReturnsFalseForUnknownStates(t *testing.T) { - if (operationResource{Status: "not a known state"}).hasTerminated() { - t.Fatalf("azure: operationResource#hasTerminated returned true for a non-terminal operation") - } -} - -func TestProvisioningStatus_StateReturnsState(t *testing.T) { - if (provisioningStatus{Properties: provisioningProperties{"state"}}).state() != "state" { - t.Fatalf("azure: provisioningStatus#state failed to return the correct state") - } -} - -func TestProvisioningStatus_HasSucceededReturnsFalseIfNotSuccess(t *testing.T) { - if (provisioningStatus{Properties: provisioningProperties{"not a success string"}}).hasSucceeded() { - t.Fatalf("azure: provisioningStatus#hasSucceeded failed to return false for a canceled operation") - } -} - -func TestProvisioningStatus_HasSucceededReturnsTrueIfSuccessful(t *testing.T) { - if !(provisioningStatus{Properties: provisioningProperties{operationSucceeded}}).hasSucceeded() { - t.Fatalf("azure: provisioningStatus#hasSucceeded failed to return true for a successful operation") - } -} - -func TestProvisioningStatus_HasTerminatedReturnsTrueForKnownStates(t *testing.T) { - for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { - if !(provisioningStatus{Properties: provisioningProperties{state}}).hasTerminated() { - t.Fatalf("azure: provisioningStatus#hasTerminated failed to return true for the '%s' state", state) - } - } -} - -func TestProvisioningStatus_HasTerminatedReturnsFalseForUnknownStates(t *testing.T) { - if (provisioningStatus{Properties: provisioningProperties{"not a known state"}}).hasTerminated() { - t.Fatalf("azure: provisioningStatus#hasTerminated returned true for a non-terminal operation") - } -} - -func TestPollingState_HasSucceededReturnsFalseIfNotSuccess(t *testing.T) { - if (pollingState{state: "not a success string"}).hasSucceeded() { - t.Fatalf("azure: pollingState#hasSucceeded failed to return false for a canceled operation") - } -} - -func TestPollingState_HasSucceededReturnsTrueIfSuccessful(t *testing.T) { - if !(pollingState{state: operationSucceeded}).hasSucceeded() { - t.Fatalf("azure: pollingState#hasSucceeded failed to return true for a successful operation") - } -} - -func TestPollingState_HasTerminatedReturnsTrueForKnownStates(t *testing.T) { - for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { - if !(pollingState{state: state}).hasTerminated() { - t.Fatalf("azure: pollingState#hasTerminated failed to return true for the '%s' state", state) - } - } -} - -func TestPollingState_HasTerminatedReturnsFalseForUnknownStates(t *testing.T) { - if (pollingState{state: "not a known state"}).hasTerminated() { - t.Fatalf("azure: pollingState#hasTerminated returned true for a non-terminal operation") - } -} - -func TestUpdatePollingState_ReturnsAnErrorIfOneOccurs(t *testing.T) { - resp := mocks.NewResponseWithContent(operationResourceIllegal) - err := updatePollingState(resp, &pollingState{}) - if err == nil { - t.Fatalf("azure: updatePollingState failed to return an error after a JSON parsing error") - } -} - -func TestUpdatePollingState_ReturnsTerminatedForKnownProvisioningStates(t *testing.T) { - for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { - resp := mocks.NewResponseWithContent(fmt.Sprintf(pollingStateFormat, state)) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if !ps.hasTerminated() { - t.Fatalf("azure: updatePollingState failed to return a terminating pollingState for the '%s' state", state) - } - } -} - -func TestUpdatePollingState_ReturnsSuccessForSuccessfulProvisioningState(t *testing.T) { - resp := mocks.NewResponseWithContent(fmt.Sprintf(pollingStateFormat, operationSucceeded)) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if !ps.hasSucceeded() { - t.Fatalf("azure: updatePollingState failed to return a successful pollingState for the '%s' state", operationSucceeded) - } -} - -func TestUpdatePollingState_ReturnsInProgressForAllOtherProvisioningStates(t *testing.T) { - s := "not a recognized state" - resp := mocks.NewResponseWithContent(fmt.Sprintf(pollingStateFormat, s)) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if ps.hasTerminated() { - t.Fatalf("azure: updatePollingState returned terminated for unknown state '%s'", s) - } -} - -func TestUpdatePollingState_ReturnsSuccessWhenProvisioningStateFieldIsAbsentForSuccessStatusCodes(t *testing.T) { - for _, sc := range []int{http.StatusOK, http.StatusCreated, http.StatusNoContent} { - resp := mocks.NewResponseWithContent(pollingStateEmpty) - resp.StatusCode = sc - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if !ps.hasSucceeded() { - t.Fatalf("azure: updatePollingState failed to return success when the provisionState field is absent for Status Code %d", sc) - } - } -} - -func TestUpdatePollingState_ReturnsInProgressWhenProvisioningStateFieldIsAbsentForAccepted(t *testing.T) { - resp := mocks.NewResponseWithContent(pollingStateEmpty) - resp.StatusCode = http.StatusAccepted - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if ps.hasTerminated() { - t.Fatalf("azure: updatePollingState returned terminated when the provisionState field is absent for Status Code Accepted") - } -} - -func TestUpdatePollingState_ReturnsFailedWhenProvisioningStateFieldIsAbsentForUnknownStatusCodes(t *testing.T) { - resp := mocks.NewResponseWithContent(pollingStateEmpty) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if !ps.hasTerminated() || ps.hasSucceeded() { - t.Fatalf("azure: updatePollingState did not return failed when the provisionState field is absent for an unknown Status Code") - } -} - -func TestUpdatePollingState_ReturnsTerminatedForKnownOperationResourceStates(t *testing.T) { - for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { - resp := mocks.NewResponseWithContent(fmt.Sprintf(operationResourceFormat, state)) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesOperationResponse} - updatePollingState(resp, ps) - if !ps.hasTerminated() { - t.Fatalf("azure: updatePollingState failed to return a terminating pollingState for the '%s' state", state) - } - } -} - -func TestUpdatePollingState_ReturnsSuccessForSuccessfulOperationResourceState(t *testing.T) { - resp := mocks.NewResponseWithContent(fmt.Sprintf(operationResourceFormat, operationSucceeded)) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesOperationResponse} - updatePollingState(resp, ps) - if !ps.hasSucceeded() { - t.Fatalf("azure: updatePollingState failed to return a successful pollingState for the '%s' state", operationSucceeded) - } -} - -func TestUpdatePollingState_ReturnsInProgressForAllOtherOperationResourceStates(t *testing.T) { - s := "not a recognized state" - resp := mocks.NewResponseWithContent(fmt.Sprintf(operationResourceFormat, s)) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesOperationResponse} - updatePollingState(resp, ps) - if ps.hasTerminated() { - t.Fatalf("azure: updatePollingState returned terminated for unknown state '%s'", s) - } -} - -func TestUpdatePollingState_CopiesTheResponseBody(t *testing.T) { - s := fmt.Sprintf(pollingStateFormat, operationSucceeded) - resp := mocks.NewResponseWithContent(s) - resp.StatusCode = 42 - ps := &pollingState{responseFormat: usesOperationResponse} - updatePollingState(resp, ps) - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Fatalf("azure: updatePollingState failed to replace the http.Response Body -- Error='%v'", err) - } - if string(b) != s { - t.Fatalf("azure: updatePollingState failed to copy the http.Response Body -- Expected='%s' Received='%s'", s, string(b)) - } -} - -func TestUpdatePollingState_ClosesTheOriginalResponseBody(t *testing.T) { - resp := mocks.NewResponse() - b := resp.Body.(*mocks.Body) - ps := &pollingState{responseFormat: usesProvisioningStatus} - updatePollingState(resp, ps) - if b.IsOpen() { - t.Fatal("azure: updatePollingState failed to close the original http.Response Body") - } -} - -func TestUpdatePollingState_FailsWhenResponseLacksRequest(t *testing.T) { - resp := newAsynchronousResponse() - resp.Request = nil - - ps := pollingState{} - err := updatePollingState(resp, &ps) - if err == nil { - t.Fatal("azure: updatePollingState failed to return an error when the http.Response lacked the original http.Request") - } -} - -func TestUpdatePollingState_SetsTheResponseFormatWhenUsingTheAzureAsyncOperationHeader(t *testing.T) { - ps := pollingState{} - updatePollingState(newAsynchronousResponse(), &ps) - - if ps.responseFormat != usesOperationResponse { - t.Fatal("azure: updatePollingState failed to set the correct response format when using the Azure-AsyncOperation header") - } -} - -func TestUpdatePollingState_SetsTheResponseFormatWhenUsingTheAzureAsyncOperationHeaderIsMissing(t *testing.T) { - resp := newAsynchronousResponse() - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - ps := pollingState{} - updatePollingState(resp, &ps) - - if ps.responseFormat != usesProvisioningStatus { - t.Fatal("azure: updatePollingState failed to set the correct response format when the Azure-AsyncOperation header is absent") - } -} - -func TestUpdatePollingState_DoesNotChangeAnExistingReponseFormat(t *testing.T) { - resp := newAsynchronousResponse() - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - ps := pollingState{responseFormat: usesOperationResponse} - updatePollingState(resp, &ps) - - if ps.responseFormat != usesOperationResponse { - t.Fatal("azure: updatePollingState failed to leave an existing response format setting") - } -} - -func TestUpdatePollingState_PrefersTheAzureAsyncOperationHeader(t *testing.T) { - resp := newAsynchronousResponse() - - ps := pollingState{} - updatePollingState(resp, &ps) - - if ps.uri != mocks.TestAzureAsyncURL { - t.Fatal("azure: updatePollingState failed to prefer the Azure-AsyncOperation header") - } -} - -func TestUpdatePollingState_PrefersLocationWhenTheAzureAsyncOperationHeaderMissing(t *testing.T) { - resp := newAsynchronousResponse() - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - ps := pollingState{} - updatePollingState(resp, &ps) - - if ps.uri != mocks.TestLocationURL { - t.Fatal("azure: updatePollingState failed to prefer the Location header when the Azure-AsyncOperation header is missing") - } -} - -func TestUpdatePollingState_UsesTheObjectLocationIfAsyncHeadersAreMissing(t *testing.T) { - resp := newAsynchronousResponse() - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - resp.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) - resp.Request.Method = http.MethodPatch - - ps := pollingState{} - updatePollingState(resp, &ps) - - if ps.uri != mocks.TestURL { - t.Fatal("azure: updatePollingState failed to use the Object URL when the asynchronous headers are missing") - } -} - -func TestUpdatePollingState_RecognizesLowerCaseHTTPVerbs(t *testing.T) { - for _, m := range []string{strings.ToLower(http.MethodPatch), strings.ToLower(http.MethodPut), strings.ToLower(http.MethodGet)} { - resp := newAsynchronousResponse() - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - resp.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) - resp.Request.Method = m - - ps := pollingState{} - updatePollingState(resp, &ps) - - if ps.uri != mocks.TestURL { - t.Fatalf("azure: updatePollingState failed to recognize the lower-case HTTP verb '%s'", m) - } - } -} - -func TestUpdatePollingState_ReturnsAnErrorIfAsyncHeadersAreMissingForANewOrDeletedObject(t *testing.T) { - resp := newAsynchronousResponse() - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - resp.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) - - for _, m := range []string{http.MethodDelete, http.MethodPost} { - resp.Request.Method = m - err := updatePollingState(resp, &pollingState{}) - if err == nil { - t.Fatalf("azure: updatePollingState failed to return an error even though it could not determine the polling URL for Method '%s'", m) - } - } -} - -func TestNewPollingRequest_FailsWhenResponseLacksRequest(t *testing.T) { - resp := newAsynchronousResponse() - resp.Request = nil - - _, err := newPollingRequest(resp, pollingState{}) - if err == nil { - t.Fatal("azure: newPollingRequest failed to return an error when the http.Response lacked the original http.Request") - } -} - -func TestNewPollingRequest_ReturnsAnErrorWhenPrepareFails(t *testing.T) { - _, err := newPollingRequest(newAsynchronousResponse(), pollingState{responseFormat: usesOperationResponse, uri: mocks.TestBadURL}) - if err == nil { - t.Fatal("azure: newPollingRequest failed to return an error when Prepare fails") - } -} - -func TestNewPollingRequest_DoesNotReturnARequestWhenPrepareFails(t *testing.T) { - req, _ := newPollingRequest(newAsynchronousResponse(), pollingState{responseFormat: usesOperationResponse, uri: mocks.TestBadURL}) - if req != nil { - t.Fatal("azure: newPollingRequest returned an http.Request when Prepare failed") - } -} - -func TestNewPollingRequest_ReturnsAGetRequest(t *testing.T) { - req, _ := newPollingRequest(newAsynchronousResponse(), pollingState{responseFormat: usesOperationResponse, uri: mocks.TestAzureAsyncURL}) - if req.Method != "GET" { - t.Fatalf("azure: newPollingRequest did not create an HTTP GET request -- actual method %v", req.Method) - } -} - -func TestDoPollForAsynchronous_IgnoresUnspecifiedStatusCodes(t *testing.T) { - client := mocks.NewSender() - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Duration(0))) - - if client.Attempts() != 1 { - t.Fatalf("azure: DoPollForAsynchronous polled for unspecified status code") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsForSpecifiedStatusCodes(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(newAsynchronousResponse()) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() != 2 { - t.Fatalf("azure: DoPollForAsynchronous failed to poll for specified status code") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_CanBeCanceled(t *testing.T) { - cancel := make(chan struct{}) - delay := 5 * time.Second - - r1 := newAsynchronousResponse() - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(newOperationResourceResponse("Busy"), -1) - - var wg sync.WaitGroup - wg.Add(1) - start := time.Now() - go func() { - req := mocks.NewRequest() - req.Cancel = cancel - - wg.Done() - - r, _ := autorest.SendWithSender(client, req, - DoPollForAsynchronous(10*time.Second)) - autorest.Respond(r, - autorest.ByClosing()) - }() - wg.Wait() - close(cancel) - time.Sleep(5 * time.Millisecond) - if time.Since(start) >= delay { - t.Fatalf("azure: DoPollForAsynchronous failed to cancel") - } -} - -func TestDoPollForAsynchronous_ClosesAllNonreturnedResponseBodiesWhenPolling(t *testing.T) { - r1 := newAsynchronousResponse() - b1 := r1.Body.(*mocks.Body) - r2 := newOperationResourceResponse("busy") - b2 := r2.Body.(*mocks.Body) - r3 := newOperationResourceResponse(operationSucceeded) - b3 := r3.Body.(*mocks.Body) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendResponse(r3) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if b1.IsOpen() || b2.IsOpen() || b3.IsOpen() { - t.Fatalf("azure: DoPollForAsynchronous did not close unreturned response bodies") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_LeavesLastResponseBodyOpen(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse(operationSucceeded) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendResponse(r3) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - b, err := ioutil.ReadAll(r.Body) - if len(b) <= 0 || err != nil { - t.Fatalf("azure: DoPollForAsynchronous did not leave open the body of the last response - Error='%v'", err) - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_DoesNotPollIfOriginalRequestReturnedAnError(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendResponse(r2) - client.SetError(fmt.Errorf("Faux Error")) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() != 1 { - t.Fatalf("azure: DoPollForAsynchronous tried to poll after receiving an error") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_DoesNotPollIfCreatingOperationRequestFails(t *testing.T) { - r1 := newAsynchronousResponse() - mocks.SetResponseHeader(r1, http.CanonicalHeaderKey(headerAsyncOperation), mocks.TestBadURL) - r2 := newOperationResourceResponse("busy") - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() > 1 { - t.Fatalf("azure: DoPollForAsynchronous polled with an invalidly formed operation request") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_StopsPollingAfterAnError(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.SetError(fmt.Errorf("Faux Error")) - client.SetEmitErrorAfter(2) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() > 3 { - t.Fatalf("azure: DoPollForAsynchronous failed to stop polling after receiving an error") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsPollingError(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(newAsynchronousResponse(), 5) - client.SetError(fmt.Errorf("Faux Error")) - client.SetEmitErrorAfter(1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if err == nil { - t.Fatalf("azure: DoPollForAsynchronous failed to return error from polling") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsForStatusAccepted(t *testing.T) { - r1 := newAsynchronousResponse() - r1.Status = "202 Accepted" - r1.StatusCode = http.StatusAccepted - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse(operationCanceled) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() < 4 { - t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsForStatusCreated(t *testing.T) { - r1 := newAsynchronousResponse() - r1.Status = "201 Created" - r1.StatusCode = http.StatusCreated - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse(operationCanceled) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() < 4 { - t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsUntilProvisioningStatusTerminates(t *testing.T) { - r1 := newAsynchronousResponse() - r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r2 := newProvisioningStatusResponse("busy") - r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r3 := newProvisioningStatusResponse(operationCanceled) - r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() < 4 { - t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsUntilProvisioningStatusSucceeds(t *testing.T) { - r1 := newAsynchronousResponse() - r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r2 := newProvisioningStatusResponse("busy") - r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r3 := newProvisioningStatusResponse(operationSucceeded) - r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() < 4 { - t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsUntilOperationResourceHasTerminated(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse(operationCanceled) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() < 4 { - t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_PollsUntilOperationResourceHasSucceeded(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse(operationSucceeded) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() < 4 { - t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_StopsPollingWhenOperationResourceHasTerminated(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse(operationCanceled) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 2) - - r, _ := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() > 4 { - t.Fatalf("azure: DoPollForAsynchronous failed to stop after receiving a terminated OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsAnErrorForCanceledOperations(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceErrorResponse(operationCanceled) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if err == nil || !strings.Contains(fmt.Sprintf("%v", err), "Canceled") { - t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error for a canceled OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsAnErrorForFailedOperations(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceErrorResponse(operationFailed) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if err == nil || !strings.Contains(fmt.Sprintf("%v", err), "Failed") { - t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error for a canceled OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_WithNilURI(t *testing.T) { - r1 := newAsynchronousResponse() - r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r1.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) - - r2 := newOperationResourceResponse("busy") - r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r2.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendResponse(r2) - - req, _ := http.NewRequest("POST", "https://microsoft.com/a/b/c/", mocks.NewBody("")) - r, err := autorest.SendWithSender(client, req, - DoPollForAsynchronous(time.Millisecond)) - - if err == nil { - t.Fatalf("azure: DoPollForAsynchronous failed to return error for nil URI. got: nil; want: Azure Polling Error - Unable to obtain polling URI for POST") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsAnUnknownErrorForFailedOperations(t *testing.T) { - // Return unknown error if error not present in last response - r1 := newAsynchronousResponse() - r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r2 := newProvisioningStatusResponse("busy") - r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r3 := newProvisioningStatusResponse(operationFailed) - r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - expected := makeLongRunningOperationErrorString("Unknown", "None") - if err.Error() != expected { - t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for an unknown error. \n expected=%q \n got=%q", - expected, err.Error()) - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsErrorForLastErrorResponse(t *testing.T) { - // Return error code and message if error present in last response - r1 := newAsynchronousResponse() - r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r2 := newProvisioningStatusResponse("busy") - r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - r3 := newAsynchronousResponseWithError() - r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - expected := makeLongRunningOperationErrorString("InvalidParameter", "tom-service-DISCOVERY-server-base-v1.core.local' is not a valid captured VHD blob name prefix.") - if err.Error() != expected { - t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for an unknown error. \n expected=%q \n got=%q", - expected, err.Error()) - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsOperationResourceErrorForFailedOperations(t *testing.T) { - // Return Operation resource response with error code and message in last operation resource response - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceErrorResponse(operationFailed) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - expected := makeLongRunningOperationErrorString("BadArgument", "The provided database 'foo' has an invalid username.") - if err.Error() != expected { - t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for a failed Operations. \n expected=%q \n got=%q", - expected, err.Error()) - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_ReturnsErrorForFirstPutRequest(t *testing.T) { - // Return 400 bad response with error code and message in first put - r1 := newAsynchronousResponseWithError() - client := mocks.NewSender() - client.AppendResponse(r1) - - res, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - if err != nil { - t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for a failed Operations. \n expected=%q \n got=%q", - errorResponse, err.Error()) - } - - err = autorest.Respond(res, - WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusCreated, http.StatusOK), - autorest.ByClosing()) - - reqError, ok := err.(*RequestError) - if !ok { - t.Fatalf("azure: returned error is not azure.RequestError: %T", err) - } - - expected := &RequestError{ - ServiceError: &ServiceError{ - Code: "InvalidParameter", - Message: "tom-service-DISCOVERY-server-base-v1.core.local' is not a valid captured VHD blob name prefix.", - }, - DetailedError: autorest.DetailedError{ - StatusCode: 400, - }, - } - if !reflect.DeepEqual(reqError, expected) { - t.Fatalf("azure: wrong error. expected=%q\ngot=%q", expected, reqError) - } - - defer res.Body.Close() - b, err := ioutil.ReadAll(res.Body) - if err != nil { - t.Fatal(err) - } - if string(b) != errorResponse { - t.Fatalf("azure: Response body is wrong. got=%q expected=%q", string(b), errorResponse) - } - -} - -func TestDoPollForAsynchronous_ReturnsNoErrorForSuccessfulOperations(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceErrorResponse(operationSucceeded) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if err != nil { - t.Fatalf("azure: DoPollForAsynchronous returned an error for a successful OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -func TestDoPollForAsynchronous_StopsPollingIfItReceivesAnInvalidOperationResource(t *testing.T) { - r1 := newAsynchronousResponse() - r2 := newOperationResourceResponse("busy") - r3 := newOperationResourceResponse("busy") - r3.Body = mocks.NewBody(operationResourceIllegal) - r4 := newOperationResourceResponse(operationSucceeded) - - client := mocks.NewSender() - client.AppendResponse(r1) - client.AppendAndRepeatResponse(r2, 2) - client.AppendAndRepeatResponse(r3, 1) - client.AppendAndRepeatResponse(r4, 1) - - r, err := autorest.SendWithSender(client, mocks.NewRequest(), - DoPollForAsynchronous(time.Millisecond)) - - if client.Attempts() > 4 { - t.Fatalf("azure: DoPollForAsynchronous failed to stop polling after receiving an invalid OperationResource") - } - if err == nil { - t.Fatalf("azure: DoPollForAsynchronous failed to return an error after receving an invalid OperationResource") - } - - autorest.Respond(r, - autorest.ByClosing()) -} - -const ( - operationResourceIllegal = ` - This is not JSON and should fail...badly. - ` - pollingStateFormat = ` - { - "unused" : { - "somefield" : 42 - }, - "properties" : { - "provisioningState": "%s" - } - } - ` - - errorResponse = ` - { - "error" : { - "code" : "InvalidParameter", - "message" : "tom-service-DISCOVERY-server-base-v1.core.local' is not a valid captured VHD blob name prefix." - } - } - ` - - pollingStateEmpty = ` - { - "unused" : { - "somefield" : 42 - }, - "properties" : { - } - } - ` - - operationResourceFormat = ` - { - "id": "/subscriptions/id/locations/westus/operationsStatus/sameguid", - "name": "sameguid", - "status" : "%s", - "startTime" : "2006-01-02T15:04:05Z", - "endTime" : "2006-01-02T16:04:05Z", - "percentComplete" : 50.00, - - "properties" : {} - } - ` - - operationResourceErrorFormat = ` - { - "id": "/subscriptions/id/locations/westus/operationsStatus/sameguid", - "name": "sameguid", - "status" : "%s", - "startTime" : "2006-01-02T15:04:05Z", - "endTime" : "2006-01-02T16:04:05Z", - "percentComplete" : 50.00, - - "properties" : {}, - "error" : { - "code" : "BadArgument", - "message" : "The provided database 'foo' has an invalid username." - } - } - ` -) - -func newAsynchronousResponse() *http.Response { - r := mocks.NewResponseWithStatus("201 Created", http.StatusCreated) - r.Body = mocks.NewBody(fmt.Sprintf(pollingStateFormat, operationInProgress)) - mocks.SetResponseHeader(r, http.CanonicalHeaderKey(headerAsyncOperation), mocks.TestAzureAsyncURL) - mocks.SetResponseHeader(r, http.CanonicalHeaderKey(autorest.HeaderLocation), mocks.TestLocationURL) - mocks.SetRetryHeader(r, retryDelay) - r.Request = mocks.NewRequestForURL(mocks.TestURL) - return r -} - -func newAsynchronousResponseWithError() *http.Response { - r := mocks.NewResponseWithStatus("400 Bad Request", http.StatusBadRequest) - mocks.SetRetryHeader(r, retryDelay) - r.Request = mocks.NewRequestForURL(mocks.TestURL) - r.Body = mocks.NewBody(errorResponse) - return r -} - -func newOperationResourceResponse(status string) *http.Response { - r := newAsynchronousResponse() - r.Body = mocks.NewBody(fmt.Sprintf(operationResourceFormat, status)) - return r -} - -func newOperationResourceErrorResponse(status string) *http.Response { - r := newAsynchronousResponse() - r.Body = mocks.NewBody(fmt.Sprintf(operationResourceErrorFormat, status)) - return r -} - -func newProvisioningStatusResponse(status string) *http.Response { - r := newAsynchronousResponse() - r.Body = mocks.NewBody(fmt.Sprintf(pollingStateFormat, status)) - return r -} - -func makeLongRunningOperationErrorString(code string, message string) string { - return fmt.Sprintf("Long running operation terminated with status 'Failed': Code=%q Message=%q", code, message) -} +package azure + +import ( + "fmt" + "io/ioutil" + "net/http" + "reflect" + "strings" + "sync" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/mocks" +) + +func TestGetAsyncOperation_ReturnsAzureAsyncOperationHeader(t *testing.T) { + r := newAsynchronousResponse() + + if getAsyncOperation(r) != mocks.TestAzureAsyncURL { + t.Fatalf("azure: getAsyncOperation failed to extract the Azure-AsyncOperation header -- expected %v, received %v", mocks.TestURL, getAsyncOperation(r)) + } +} + +func TestGetAsyncOperation_ReturnsEmptyStringIfHeaderIsAbsent(t *testing.T) { + r := mocks.NewResponse() + + if len(getAsyncOperation(r)) != 0 { + t.Fatalf("azure: getAsyncOperation failed to return empty string when the Azure-AsyncOperation header is absent -- received %v", getAsyncOperation(r)) + } +} + +func TestHasSucceeded_ReturnsTrueForSuccess(t *testing.T) { + if !hasSucceeded(operationSucceeded) { + t.Fatal("azure: hasSucceeded failed to return true for success") + } +} + +func TestHasSucceeded_ReturnsFalseOtherwise(t *testing.T) { + if hasSucceeded("not a success string") { + t.Fatal("azure: hasSucceeded returned true for a non-success") + } +} + +func TestHasTerminated_ReturnsTrueForValidTerminationStates(t *testing.T) { + for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { + if !hasTerminated(state) { + t.Fatalf("azure: hasTerminated failed to return true for the '%s' state", state) + } + } +} + +func TestHasTerminated_ReturnsFalseForUnknownStates(t *testing.T) { + if hasTerminated("not a known state") { + t.Fatal("azure: hasTerminated returned true for an unknown state") + } +} + +func TestOperationError_ErrorReturnsAString(t *testing.T) { + s := (ServiceError{Code: "server code", Message: "server error"}).Error() + if s == "" { + t.Fatalf("azure: operationError#Error failed to return an error") + } + if !strings.Contains(s, "server code") || !strings.Contains(s, "server error") { + t.Fatalf("azure: operationError#Error returned a malformed error -- error='%v'", s) + } +} + +func TestOperationResource_StateReturnsState(t *testing.T) { + if (operationResource{Status: "state"}).state() != "state" { + t.Fatalf("azure: operationResource#state failed to return the correct state") + } +} + +func TestOperationResource_HasSucceededReturnsFalseIfNotSuccess(t *testing.T) { + if (operationResource{Status: "not a success string"}).hasSucceeded() { + t.Fatalf("azure: operationResource#hasSucceeded failed to return false for a canceled operation") + } +} + +func TestOperationResource_HasSucceededReturnsTrueIfSuccessful(t *testing.T) { + if !(operationResource{Status: operationSucceeded}).hasSucceeded() { + t.Fatalf("azure: operationResource#hasSucceeded failed to return true for a successful operation") + } +} + +func TestOperationResource_HasTerminatedReturnsTrueForKnownStates(t *testing.T) { + for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { + if !(operationResource{Status: state}).hasTerminated() { + t.Fatalf("azure: operationResource#hasTerminated failed to return true for the '%s' state", state) + } + } +} + +func TestOperationResource_HasTerminatedReturnsFalseForUnknownStates(t *testing.T) { + if (operationResource{Status: "not a known state"}).hasTerminated() { + t.Fatalf("azure: operationResource#hasTerminated returned true for a non-terminal operation") + } +} + +func TestProvisioningStatus_StateReturnsState(t *testing.T) { + if (provisioningStatus{Properties: provisioningProperties{"state"}}).state() != "state" { + t.Fatalf("azure: provisioningStatus#state failed to return the correct state") + } +} + +func TestProvisioningStatus_HasSucceededReturnsFalseIfNotSuccess(t *testing.T) { + if (provisioningStatus{Properties: provisioningProperties{"not a success string"}}).hasSucceeded() { + t.Fatalf("azure: provisioningStatus#hasSucceeded failed to return false for a canceled operation") + } +} + +func TestProvisioningStatus_HasSucceededReturnsTrueIfSuccessful(t *testing.T) { + if !(provisioningStatus{Properties: provisioningProperties{operationSucceeded}}).hasSucceeded() { + t.Fatalf("azure: provisioningStatus#hasSucceeded failed to return true for a successful operation") + } +} + +func TestProvisioningStatus_HasTerminatedReturnsTrueForKnownStates(t *testing.T) { + for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { + if !(provisioningStatus{Properties: provisioningProperties{state}}).hasTerminated() { + t.Fatalf("azure: provisioningStatus#hasTerminated failed to return true for the '%s' state", state) + } + } +} + +func TestProvisioningStatus_HasTerminatedReturnsFalseForUnknownStates(t *testing.T) { + if (provisioningStatus{Properties: provisioningProperties{"not a known state"}}).hasTerminated() { + t.Fatalf("azure: provisioningStatus#hasTerminated returned true for a non-terminal operation") + } +} + +func TestPollingState_HasSucceededReturnsFalseIfNotSuccess(t *testing.T) { + if (pollingState{state: "not a success string"}).hasSucceeded() { + t.Fatalf("azure: pollingState#hasSucceeded failed to return false for a canceled operation") + } +} + +func TestPollingState_HasSucceededReturnsTrueIfSuccessful(t *testing.T) { + if !(pollingState{state: operationSucceeded}).hasSucceeded() { + t.Fatalf("azure: pollingState#hasSucceeded failed to return true for a successful operation") + } +} + +func TestPollingState_HasTerminatedReturnsTrueForKnownStates(t *testing.T) { + for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { + if !(pollingState{state: state}).hasTerminated() { + t.Fatalf("azure: pollingState#hasTerminated failed to return true for the '%s' state", state) + } + } +} + +func TestPollingState_HasTerminatedReturnsFalseForUnknownStates(t *testing.T) { + if (pollingState{state: "not a known state"}).hasTerminated() { + t.Fatalf("azure: pollingState#hasTerminated returned true for a non-terminal operation") + } +} + +func TestUpdatePollingState_ReturnsAnErrorIfOneOccurs(t *testing.T) { + resp := mocks.NewResponseWithContent(operationResourceIllegal) + err := updatePollingState(resp, &pollingState{}) + if err == nil { + t.Fatalf("azure: updatePollingState failed to return an error after a JSON parsing error") + } +} + +func TestUpdatePollingState_ReturnsTerminatedForKnownProvisioningStates(t *testing.T) { + for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { + resp := mocks.NewResponseWithContent(fmt.Sprintf(pollingStateFormat, state)) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if !ps.hasTerminated() { + t.Fatalf("azure: updatePollingState failed to return a terminating pollingState for the '%s' state", state) + } + } +} + +func TestUpdatePollingState_ReturnsSuccessForSuccessfulProvisioningState(t *testing.T) { + resp := mocks.NewResponseWithContent(fmt.Sprintf(pollingStateFormat, operationSucceeded)) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if !ps.hasSucceeded() { + t.Fatalf("azure: updatePollingState failed to return a successful pollingState for the '%s' state", operationSucceeded) + } +} + +func TestUpdatePollingState_ReturnsInProgressForAllOtherProvisioningStates(t *testing.T) { + s := "not a recognized state" + resp := mocks.NewResponseWithContent(fmt.Sprintf(pollingStateFormat, s)) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if ps.hasTerminated() { + t.Fatalf("azure: updatePollingState returned terminated for unknown state '%s'", s) + } +} + +func TestUpdatePollingState_ReturnsSuccessWhenProvisioningStateFieldIsAbsentForSuccessStatusCodes(t *testing.T) { + for _, sc := range []int{http.StatusOK, http.StatusCreated, http.StatusNoContent} { + resp := mocks.NewResponseWithContent(pollingStateEmpty) + resp.StatusCode = sc + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if !ps.hasSucceeded() { + t.Fatalf("azure: updatePollingState failed to return success when the provisionState field is absent for Status Code %d", sc) + } + } +} + +func TestUpdatePollingState_ReturnsInProgressWhenProvisioningStateFieldIsAbsentForAccepted(t *testing.T) { + resp := mocks.NewResponseWithContent(pollingStateEmpty) + resp.StatusCode = http.StatusAccepted + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if ps.hasTerminated() { + t.Fatalf("azure: updatePollingState returned terminated when the provisionState field is absent for Status Code Accepted") + } +} + +func TestUpdatePollingState_ReturnsFailedWhenProvisioningStateFieldIsAbsentForUnknownStatusCodes(t *testing.T) { + resp := mocks.NewResponseWithContent(pollingStateEmpty) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if !ps.hasTerminated() || ps.hasSucceeded() { + t.Fatalf("azure: updatePollingState did not return failed when the provisionState field is absent for an unknown Status Code") + } +} + +func TestUpdatePollingState_ReturnsTerminatedForKnownOperationResourceStates(t *testing.T) { + for _, state := range []string{operationSucceeded, operationCanceled, operationFailed} { + resp := mocks.NewResponseWithContent(fmt.Sprintf(operationResourceFormat, state)) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesOperationResponse} + updatePollingState(resp, ps) + if !ps.hasTerminated() { + t.Fatalf("azure: updatePollingState failed to return a terminating pollingState for the '%s' state", state) + } + } +} + +func TestUpdatePollingState_ReturnsSuccessForSuccessfulOperationResourceState(t *testing.T) { + resp := mocks.NewResponseWithContent(fmt.Sprintf(operationResourceFormat, operationSucceeded)) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesOperationResponse} + updatePollingState(resp, ps) + if !ps.hasSucceeded() { + t.Fatalf("azure: updatePollingState failed to return a successful pollingState for the '%s' state", operationSucceeded) + } +} + +func TestUpdatePollingState_ReturnsInProgressForAllOtherOperationResourceStates(t *testing.T) { + s := "not a recognized state" + resp := mocks.NewResponseWithContent(fmt.Sprintf(operationResourceFormat, s)) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesOperationResponse} + updatePollingState(resp, ps) + if ps.hasTerminated() { + t.Fatalf("azure: updatePollingState returned terminated for unknown state '%s'", s) + } +} + +func TestUpdatePollingState_CopiesTheResponseBody(t *testing.T) { + s := fmt.Sprintf(pollingStateFormat, operationSucceeded) + resp := mocks.NewResponseWithContent(s) + resp.StatusCode = 42 + ps := &pollingState{responseFormat: usesOperationResponse} + updatePollingState(resp, ps) + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Fatalf("azure: updatePollingState failed to replace the http.Response Body -- Error='%v'", err) + } + if string(b) != s { + t.Fatalf("azure: updatePollingState failed to copy the http.Response Body -- Expected='%s' Received='%s'", s, string(b)) + } +} + +func TestUpdatePollingState_ClosesTheOriginalResponseBody(t *testing.T) { + resp := mocks.NewResponse() + b := resp.Body.(*mocks.Body) + ps := &pollingState{responseFormat: usesProvisioningStatus} + updatePollingState(resp, ps) + if b.IsOpen() { + t.Fatal("azure: updatePollingState failed to close the original http.Response Body") + } +} + +func TestUpdatePollingState_FailsWhenResponseLacksRequest(t *testing.T) { + resp := newAsynchronousResponse() + resp.Request = nil + + ps := pollingState{} + err := updatePollingState(resp, &ps) + if err == nil { + t.Fatal("azure: updatePollingState failed to return an error when the http.Response lacked the original http.Request") + } +} + +func TestUpdatePollingState_SetsTheResponseFormatWhenUsingTheAzureAsyncOperationHeader(t *testing.T) { + ps := pollingState{} + updatePollingState(newAsynchronousResponse(), &ps) + + if ps.responseFormat != usesOperationResponse { + t.Fatal("azure: updatePollingState failed to set the correct response format when using the Azure-AsyncOperation header") + } +} + +func TestUpdatePollingState_SetsTheResponseFormatWhenUsingTheAzureAsyncOperationHeaderIsMissing(t *testing.T) { + resp := newAsynchronousResponse() + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + ps := pollingState{} + updatePollingState(resp, &ps) + + if ps.responseFormat != usesProvisioningStatus { + t.Fatal("azure: updatePollingState failed to set the correct response format when the Azure-AsyncOperation header is absent") + } +} + +func TestUpdatePollingState_DoesNotChangeAnExistingReponseFormat(t *testing.T) { + resp := newAsynchronousResponse() + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + ps := pollingState{responseFormat: usesOperationResponse} + updatePollingState(resp, &ps) + + if ps.responseFormat != usesOperationResponse { + t.Fatal("azure: updatePollingState failed to leave an existing response format setting") + } +} + +func TestUpdatePollingState_PrefersTheAzureAsyncOperationHeader(t *testing.T) { + resp := newAsynchronousResponse() + + ps := pollingState{} + updatePollingState(resp, &ps) + + if ps.uri != mocks.TestAzureAsyncURL { + t.Fatal("azure: updatePollingState failed to prefer the Azure-AsyncOperation header") + } +} + +func TestUpdatePollingState_PrefersLocationWhenTheAzureAsyncOperationHeaderMissing(t *testing.T) { + resp := newAsynchronousResponse() + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + ps := pollingState{} + updatePollingState(resp, &ps) + + if ps.uri != mocks.TestLocationURL { + t.Fatal("azure: updatePollingState failed to prefer the Location header when the Azure-AsyncOperation header is missing") + } +} + +func TestUpdatePollingState_UsesTheObjectLocationIfAsyncHeadersAreMissing(t *testing.T) { + resp := newAsynchronousResponse() + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + resp.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) + resp.Request.Method = http.MethodPatch + + ps := pollingState{} + updatePollingState(resp, &ps) + + if ps.uri != mocks.TestURL { + t.Fatal("azure: updatePollingState failed to use the Object URL when the asynchronous headers are missing") + } +} + +func TestUpdatePollingState_RecognizesLowerCaseHTTPVerbs(t *testing.T) { + for _, m := range []string{strings.ToLower(http.MethodPatch), strings.ToLower(http.MethodPut), strings.ToLower(http.MethodGet)} { + resp := newAsynchronousResponse() + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + resp.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) + resp.Request.Method = m + + ps := pollingState{} + updatePollingState(resp, &ps) + + if ps.uri != mocks.TestURL { + t.Fatalf("azure: updatePollingState failed to recognize the lower-case HTTP verb '%s'", m) + } + } +} + +func TestUpdatePollingState_ReturnsAnErrorIfAsyncHeadersAreMissingForANewOrDeletedObject(t *testing.T) { + resp := newAsynchronousResponse() + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + resp.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) + + for _, m := range []string{http.MethodDelete, http.MethodPost} { + resp.Request.Method = m + err := updatePollingState(resp, &pollingState{}) + if err == nil { + t.Fatalf("azure: updatePollingState failed to return an error even though it could not determine the polling URL for Method '%s'", m) + } + } +} + +func TestNewPollingRequest_FailsWhenResponseLacksRequest(t *testing.T) { + resp := newAsynchronousResponse() + resp.Request = nil + + _, err := newPollingRequest(resp, pollingState{}) + if err == nil { + t.Fatal("azure: newPollingRequest failed to return an error when the http.Response lacked the original http.Request") + } +} + +func TestNewPollingRequest_ReturnsAnErrorWhenPrepareFails(t *testing.T) { + _, err := newPollingRequest(newAsynchronousResponse(), pollingState{responseFormat: usesOperationResponse, uri: mocks.TestBadURL}) + if err == nil { + t.Fatal("azure: newPollingRequest failed to return an error when Prepare fails") + } +} + +func TestNewPollingRequest_DoesNotReturnARequestWhenPrepareFails(t *testing.T) { + req, _ := newPollingRequest(newAsynchronousResponse(), pollingState{responseFormat: usesOperationResponse, uri: mocks.TestBadURL}) + if req != nil { + t.Fatal("azure: newPollingRequest returned an http.Request when Prepare failed") + } +} + +func TestNewPollingRequest_ReturnsAGetRequest(t *testing.T) { + req, _ := newPollingRequest(newAsynchronousResponse(), pollingState{responseFormat: usesOperationResponse, uri: mocks.TestAzureAsyncURL}) + if req.Method != "GET" { + t.Fatalf("azure: newPollingRequest did not create an HTTP GET request -- actual method %v", req.Method) + } +} + +func TestDoPollForAsynchronous_IgnoresUnspecifiedStatusCodes(t *testing.T) { + client := mocks.NewSender() + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Duration(0))) + + if client.Attempts() != 1 { + t.Fatalf("azure: DoPollForAsynchronous polled for unspecified status code") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsForSpecifiedStatusCodes(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(newAsynchronousResponse()) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() != 2 { + t.Fatalf("azure: DoPollForAsynchronous failed to poll for specified status code") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_CanBeCanceled(t *testing.T) { + cancel := make(chan struct{}) + delay := 5 * time.Second + + r1 := newAsynchronousResponse() + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(newOperationResourceResponse("Busy"), -1) + + var wg sync.WaitGroup + wg.Add(1) + start := time.Now() + go func() { + req := mocks.NewRequest() + req.Cancel = cancel + + wg.Done() + + r, _ := autorest.SendWithSender(client, req, + DoPollForAsynchronous(10*time.Second)) + autorest.Respond(r, + autorest.ByClosing()) + }() + wg.Wait() + close(cancel) + time.Sleep(5 * time.Millisecond) + if time.Since(start) >= delay { + t.Fatalf("azure: DoPollForAsynchronous failed to cancel") + } +} + +func TestDoPollForAsynchronous_ClosesAllNonreturnedResponseBodiesWhenPolling(t *testing.T) { + r1 := newAsynchronousResponse() + b1 := r1.Body.(*mocks.Body) + r2 := newOperationResourceResponse("busy") + b2 := r2.Body.(*mocks.Body) + r3 := newOperationResourceResponse(operationSucceeded) + b3 := r3.Body.(*mocks.Body) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendResponse(r3) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if b1.IsOpen() || b2.IsOpen() || b3.IsOpen() { + t.Fatalf("azure: DoPollForAsynchronous did not close unreturned response bodies") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_LeavesLastResponseBodyOpen(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse(operationSucceeded) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendResponse(r3) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + b, err := ioutil.ReadAll(r.Body) + if len(b) <= 0 || err != nil { + t.Fatalf("azure: DoPollForAsynchronous did not leave open the body of the last response - Error='%v'", err) + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_DoesNotPollIfOriginalRequestReturnedAnError(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendResponse(r2) + client.SetError(fmt.Errorf("Faux Error")) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() != 1 { + t.Fatalf("azure: DoPollForAsynchronous tried to poll after receiving an error") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_DoesNotPollIfCreatingOperationRequestFails(t *testing.T) { + r1 := newAsynchronousResponse() + mocks.SetResponseHeader(r1, http.CanonicalHeaderKey(headerAsyncOperation), mocks.TestBadURL) + r2 := newOperationResourceResponse("busy") + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() > 1 { + t.Fatalf("azure: DoPollForAsynchronous polled with an invalidly formed operation request") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_StopsPollingAfterAnError(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.SetError(fmt.Errorf("Faux Error")) + client.SetEmitErrorAfter(2) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() > 3 { + t.Fatalf("azure: DoPollForAsynchronous failed to stop polling after receiving an error") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsPollingError(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(newAsynchronousResponse(), 5) + client.SetError(fmt.Errorf("Faux Error")) + client.SetEmitErrorAfter(1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if err == nil { + t.Fatalf("azure: DoPollForAsynchronous failed to return error from polling") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsForStatusAccepted(t *testing.T) { + r1 := newAsynchronousResponse() + r1.Status = "202 Accepted" + r1.StatusCode = http.StatusAccepted + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse(operationCanceled) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() < 4 { + t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsForStatusCreated(t *testing.T) { + r1 := newAsynchronousResponse() + r1.Status = "201 Created" + r1.StatusCode = http.StatusCreated + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse(operationCanceled) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() < 4 { + t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsUntilProvisioningStatusTerminates(t *testing.T) { + r1 := newAsynchronousResponse() + r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r2 := newProvisioningStatusResponse("busy") + r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r3 := newProvisioningStatusResponse(operationCanceled) + r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() < 4 { + t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsUntilProvisioningStatusSucceeds(t *testing.T) { + r1 := newAsynchronousResponse() + r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r2 := newProvisioningStatusResponse("busy") + r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r3 := newProvisioningStatusResponse(operationSucceeded) + r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() < 4 { + t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsUntilOperationResourceHasTerminated(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse(operationCanceled) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() < 4 { + t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_PollsUntilOperationResourceHasSucceeded(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse(operationSucceeded) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() < 4 { + t.Fatalf("azure: DoPollForAsynchronous stopped polling before receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_StopsPollingWhenOperationResourceHasTerminated(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse(operationCanceled) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 2) + + r, _ := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() > 4 { + t.Fatalf("azure: DoPollForAsynchronous failed to stop after receiving a terminated OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsAnErrorForCanceledOperations(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceErrorResponse(operationCanceled) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if err == nil || !strings.Contains(fmt.Sprintf("%v", err), "Canceled") { + t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error for a canceled OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsAnErrorForFailedOperations(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceErrorResponse(operationFailed) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if err == nil || !strings.Contains(fmt.Sprintf("%v", err), "Failed") { + t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error for a canceled OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_WithNilURI(t *testing.T) { + r1 := newAsynchronousResponse() + r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r1.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) + + r2 := newOperationResourceResponse("busy") + r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r2.Header.Del(http.CanonicalHeaderKey(autorest.HeaderLocation)) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendResponse(r2) + + req, _ := http.NewRequest("POST", "https://microsoft.com/a/b/c/", mocks.NewBody("")) + r, err := autorest.SendWithSender(client, req, + DoPollForAsynchronous(time.Millisecond)) + + if err == nil { + t.Fatalf("azure: DoPollForAsynchronous failed to return error for nil URI. got: nil; want: Azure Polling Error - Unable to obtain polling URI for POST") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsAnUnknownErrorForFailedOperations(t *testing.T) { + // Return unknown error if error not present in last response + r1 := newAsynchronousResponse() + r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r2 := newProvisioningStatusResponse("busy") + r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r3 := newProvisioningStatusResponse(operationFailed) + r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + expected := makeLongRunningOperationErrorString("Unknown", "None") + if err.Error() != expected { + t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for an unknown error. \n expected=%q \n got=%q", + expected, err.Error()) + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsErrorForLastErrorResponse(t *testing.T) { + // Return error code and message if error present in last response + r1 := newAsynchronousResponse() + r1.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r2 := newProvisioningStatusResponse("busy") + r2.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + r3 := newAsynchronousResponseWithError() + r3.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + expected := makeLongRunningOperationErrorString("InvalidParameter", "tom-service-DISCOVERY-server-base-v1.core.local' is not a valid captured VHD blob name prefix.") + if err.Error() != expected { + t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for an unknown error. \n expected=%q \n got=%q", + expected, err.Error()) + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsOperationResourceErrorForFailedOperations(t *testing.T) { + // Return Operation resource response with error code and message in last operation resource response + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceErrorResponse(operationFailed) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + expected := makeLongRunningOperationErrorString("BadArgument", "The provided database 'foo' has an invalid username.") + if err.Error() != expected { + t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for a failed Operations. \n expected=%q \n got=%q", + expected, err.Error()) + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_ReturnsErrorForFirstPutRequest(t *testing.T) { + // Return 400 bad response with error code and message in first put + r1 := newAsynchronousResponseWithError() + client := mocks.NewSender() + client.AppendResponse(r1) + + res, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + if err != nil { + t.Fatalf("azure: DoPollForAsynchronous failed to return an appropriate error message for a failed Operations. \n expected=%q \n got=%q", + errorResponse, err.Error()) + } + + err = autorest.Respond(res, + WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusCreated, http.StatusOK), + autorest.ByClosing()) + + reqError, ok := err.(*RequestError) + if !ok { + t.Fatalf("azure: returned error is not azure.RequestError: %T", err) + } + + expected := &RequestError{ + ServiceError: &ServiceError{ + Code: "InvalidParameter", + Message: "tom-service-DISCOVERY-server-base-v1.core.local' is not a valid captured VHD blob name prefix.", + }, + DetailedError: autorest.DetailedError{ + StatusCode: 400, + }, + } + if !reflect.DeepEqual(reqError, expected) { + t.Fatalf("azure: wrong error. expected=%q\ngot=%q", expected, reqError) + } + + defer res.Body.Close() + b, err := ioutil.ReadAll(res.Body) + if err != nil { + t.Fatal(err) + } + if string(b) != errorResponse { + t.Fatalf("azure: Response body is wrong. got=%q expected=%q", string(b), errorResponse) + } + +} + +func TestDoPollForAsynchronous_ReturnsNoErrorForSuccessfulOperations(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceErrorResponse(operationSucceeded) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if err != nil { + t.Fatalf("azure: DoPollForAsynchronous returned an error for a successful OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +func TestDoPollForAsynchronous_StopsPollingIfItReceivesAnInvalidOperationResource(t *testing.T) { + r1 := newAsynchronousResponse() + r2 := newOperationResourceResponse("busy") + r3 := newOperationResourceResponse("busy") + r3.Body = mocks.NewBody(operationResourceIllegal) + r4 := newOperationResourceResponse(operationSucceeded) + + client := mocks.NewSender() + client.AppendResponse(r1) + client.AppendAndRepeatResponse(r2, 2) + client.AppendAndRepeatResponse(r3, 1) + client.AppendAndRepeatResponse(r4, 1) + + r, err := autorest.SendWithSender(client, mocks.NewRequest(), + DoPollForAsynchronous(time.Millisecond)) + + if client.Attempts() > 4 { + t.Fatalf("azure: DoPollForAsynchronous failed to stop polling after receiving an invalid OperationResource") + } + if err == nil { + t.Fatalf("azure: DoPollForAsynchronous failed to return an error after receving an invalid OperationResource") + } + + autorest.Respond(r, + autorest.ByClosing()) +} + +const ( + operationResourceIllegal = ` + This is not JSON and should fail...badly. + ` + pollingStateFormat = ` + { + "unused" : { + "somefield" : 42 + }, + "properties" : { + "provisioningState": "%s" + } + } + ` + + errorResponse = ` + { + "error" : { + "code" : "InvalidParameter", + "message" : "tom-service-DISCOVERY-server-base-v1.core.local' is not a valid captured VHD blob name prefix." + } + } + ` + + pollingStateEmpty = ` + { + "unused" : { + "somefield" : 42 + }, + "properties" : { + } + } + ` + + operationResourceFormat = ` + { + "id": "/subscriptions/id/locations/westus/operationsStatus/sameguid", + "name": "sameguid", + "status" : "%s", + "startTime" : "2006-01-02T15:04:05Z", + "endTime" : "2006-01-02T16:04:05Z", + "percentComplete" : 50.00, + + "properties" : {} + } + ` + + operationResourceErrorFormat = ` + { + "id": "/subscriptions/id/locations/westus/operationsStatus/sameguid", + "name": "sameguid", + "status" : "%s", + "startTime" : "2006-01-02T15:04:05Z", + "endTime" : "2006-01-02T16:04:05Z", + "percentComplete" : 50.00, + + "properties" : {}, + "error" : { + "code" : "BadArgument", + "message" : "The provided database 'foo' has an invalid username." + } + } + ` +) + +func newAsynchronousResponse() *http.Response { + r := mocks.NewResponseWithStatus("201 Created", http.StatusCreated) + r.Body = mocks.NewBody(fmt.Sprintf(pollingStateFormat, operationInProgress)) + mocks.SetResponseHeader(r, http.CanonicalHeaderKey(headerAsyncOperation), mocks.TestAzureAsyncURL) + mocks.SetResponseHeader(r, http.CanonicalHeaderKey(autorest.HeaderLocation), mocks.TestLocationURL) + mocks.SetRetryHeader(r, retryDelay) + r.Request = mocks.NewRequestForURL(mocks.TestURL) + return r +} + +func newAsynchronousResponseWithError() *http.Response { + r := mocks.NewResponseWithStatus("400 Bad Request", http.StatusBadRequest) + mocks.SetRetryHeader(r, retryDelay) + r.Request = mocks.NewRequestForURL(mocks.TestURL) + r.Body = mocks.NewBody(errorResponse) + return r +} + +func newOperationResourceResponse(status string) *http.Response { + r := newAsynchronousResponse() + r.Body = mocks.NewBody(fmt.Sprintf(operationResourceFormat, status)) + return r +} + +func newOperationResourceErrorResponse(status string) *http.Response { + r := newAsynchronousResponse() + r.Body = mocks.NewBody(fmt.Sprintf(operationResourceErrorFormat, status)) + return r +} + +func newProvisioningStatusResponse(status string) *http.Response { + r := newAsynchronousResponse() + r.Body = mocks.NewBody(fmt.Sprintf(pollingStateFormat, status)) + return r +} + +func makeLongRunningOperationErrorString(code string, message string) string { + return fmt.Sprintf("Long running operation terminated with status 'Failed': Code=%q Message=%q", code, message) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go index cc31ebad36..3f4d13421a 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go @@ -1,180 +1,180 @@ -/* -Package azure provides Azure-specific implementations used with AutoRest. - -See the included examples for more detail. -*/ -package azure - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "strconv" - - "github.com/Azure/go-autorest/autorest" -) - -const ( - // HeaderClientID is the Azure extension header to set a user-specified request ID. - HeaderClientID = "x-ms-client-request-id" - - // HeaderReturnClientID is the Azure extension header to set if the user-specified request ID - // should be included in the response. - HeaderReturnClientID = "x-ms-return-client-request-id" - - // HeaderRequestID is the Azure extension header of the service generated request ID returned - // in the response. - HeaderRequestID = "x-ms-request-id" -) - -// ServiceError encapsulates the error response from an Azure service. -type ServiceError struct { - Code string `json:"code"` - Message string `json:"message"` - Details *[]interface{} `json:"details"` -} - -func (se ServiceError) Error() string { - if se.Details != nil { - d, err := json.Marshal(*(se.Details)) - if err != nil { - return fmt.Sprintf("Code=%q Message=%q Details=%v", se.Code, se.Message, *se.Details) - } - return fmt.Sprintf("Code=%q Message=%q Details=%v", se.Code, se.Message, string(d)) - } - return fmt.Sprintf("Code=%q Message=%q", se.Code, se.Message) -} - -// RequestError describes an error response returned by Azure service. -type RequestError struct { - autorest.DetailedError - - // The error returned by the Azure service. - ServiceError *ServiceError `json:"error"` - - // The request id (from the x-ms-request-id-header) of the request. - RequestID string -} - -// Error returns a human-friendly error message from service error. -func (e RequestError) Error() string { - return fmt.Sprintf("autorest/azure: Service returned an error. Status=%v %v", - e.StatusCode, e.ServiceError) -} - -// IsAzureError returns true if the passed error is an Azure Service error; false otherwise. -func IsAzureError(e error) bool { - _, ok := e.(*RequestError) - return ok -} - -// NewErrorWithError creates a new Error conforming object from the -// passed packageType, method, statusCode of the given resp (UndefinedStatusCode -// if resp is nil), message, and original error. message is treated as a format -// string to which the optional args apply. -func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) RequestError { - if v, ok := original.(*RequestError); ok { - return *v - } - - statusCode := autorest.UndefinedStatusCode - if resp != nil { - statusCode = resp.StatusCode - } - return RequestError{ - DetailedError: autorest.DetailedError{ - Original: original, - PackageType: packageType, - Method: method, - StatusCode: statusCode, - Message: fmt.Sprintf(message, args...), - }, - } -} - -// WithReturningClientID returns a PrepareDecorator that adds an HTTP extension header of -// x-ms-client-request-id whose value is the passed, undecorated UUID (e.g., -// "0F39878C-5F76-4DB8-A25D-61D2C193C3CA"). It also sets the x-ms-return-client-request-id -// header to true such that UUID accompanies the http.Response. -func WithReturningClientID(uuid string) autorest.PrepareDecorator { - preparer := autorest.CreatePreparer( - WithClientID(uuid), - WithReturnClientID(true)) - - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - return preparer.Prepare(r) - }) - } -} - -// WithClientID returns a PrepareDecorator that adds an HTTP extension header of -// x-ms-client-request-id whose value is passed, undecorated UUID (e.g., -// "0F39878C-5F76-4DB8-A25D-61D2C193C3CA"). -func WithClientID(uuid string) autorest.PrepareDecorator { - return autorest.WithHeader(HeaderClientID, uuid) -} - -// WithReturnClientID returns a PrepareDecorator that adds an HTTP extension header of -// x-ms-return-client-request-id whose boolean value indicates if the value of the -// x-ms-client-request-id header should be included in the http.Response. -func WithReturnClientID(b bool) autorest.PrepareDecorator { - return autorest.WithHeader(HeaderReturnClientID, strconv.FormatBool(b)) -} - -// ExtractClientID extracts the client identifier from the x-ms-client-request-id header set on the -// http.Request sent to the service (and returned in the http.Response) -func ExtractClientID(resp *http.Response) string { - return autorest.ExtractHeaderValue(HeaderClientID, resp) -} - -// ExtractRequestID extracts the Azure server generated request identifier from the -// x-ms-request-id header. -func ExtractRequestID(resp *http.Response) string { - return autorest.ExtractHeaderValue(HeaderRequestID, resp) -} - -// WithErrorUnlessStatusCode returns a RespondDecorator that emits an -// azure.RequestError by reading the response body unless the response HTTP status code -// is among the set passed. -// -// If there is a chance service may return responses other than the Azure error -// format and the response cannot be parsed into an error, a decoding error will -// be returned containing the response body. In any case, the Responder will -// return an error if the status code is not satisfied. -// -// If this Responder returns an error, the response body will be replaced with -// an in-memory reader, which needs no further closing. -func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator { - return func(r autorest.Responder) autorest.Responder { - return autorest.ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && !autorest.ResponseHasStatusCode(resp, codes...) { - var e RequestError - defer resp.Body.Close() - - // Copy and replace the Body in case it does not contain an error object. - // This will leave the Body available to the caller. - b, decodeErr := autorest.CopyAndDecode(autorest.EncodedAsJSON, resp.Body, &e) - resp.Body = ioutil.NopCloser(&b) - if decodeErr != nil { - return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr) - } else if e.ServiceError == nil { - e.ServiceError = &ServiceError{Code: "Unknown", Message: "Unknown service error"} - } - - e.RequestID = ExtractRequestID(resp) - if e.StatusCode == nil { - e.StatusCode = resp.StatusCode - } - err = &e - } - return err - }) - } -} +/* +Package azure provides Azure-specific implementations used with AutoRest. + +See the included examples for more detail. +*/ +package azure + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "strconv" + + "github.com/Azure/go-autorest/autorest" +) + +const ( + // HeaderClientID is the Azure extension header to set a user-specified request ID. + HeaderClientID = "x-ms-client-request-id" + + // HeaderReturnClientID is the Azure extension header to set if the user-specified request ID + // should be included in the response. + HeaderReturnClientID = "x-ms-return-client-request-id" + + // HeaderRequestID is the Azure extension header of the service generated request ID returned + // in the response. + HeaderRequestID = "x-ms-request-id" +) + +// ServiceError encapsulates the error response from an Azure service. +type ServiceError struct { + Code string `json:"code"` + Message string `json:"message"` + Details *[]interface{} `json:"details"` +} + +func (se ServiceError) Error() string { + if se.Details != nil { + d, err := json.Marshal(*(se.Details)) + if err != nil { + return fmt.Sprintf("Code=%q Message=%q Details=%v", se.Code, se.Message, *se.Details) + } + return fmt.Sprintf("Code=%q Message=%q Details=%v", se.Code, se.Message, string(d)) + } + return fmt.Sprintf("Code=%q Message=%q", se.Code, se.Message) +} + +// RequestError describes an error response returned by Azure service. +type RequestError struct { + autorest.DetailedError + + // The error returned by the Azure service. + ServiceError *ServiceError `json:"error"` + + // The request id (from the x-ms-request-id-header) of the request. + RequestID string +} + +// Error returns a human-friendly error message from service error. +func (e RequestError) Error() string { + return fmt.Sprintf("autorest/azure: Service returned an error. Status=%v %v", + e.StatusCode, e.ServiceError) +} + +// IsAzureError returns true if the passed error is an Azure Service error; false otherwise. +func IsAzureError(e error) bool { + _, ok := e.(*RequestError) + return ok +} + +// NewErrorWithError creates a new Error conforming object from the +// passed packageType, method, statusCode of the given resp (UndefinedStatusCode +// if resp is nil), message, and original error. message is treated as a format +// string to which the optional args apply. +func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) RequestError { + if v, ok := original.(*RequestError); ok { + return *v + } + + statusCode := autorest.UndefinedStatusCode + if resp != nil { + statusCode = resp.StatusCode + } + return RequestError{ + DetailedError: autorest.DetailedError{ + Original: original, + PackageType: packageType, + Method: method, + StatusCode: statusCode, + Message: fmt.Sprintf(message, args...), + }, + } +} + +// WithReturningClientID returns a PrepareDecorator that adds an HTTP extension header of +// x-ms-client-request-id whose value is the passed, undecorated UUID (e.g., +// "0F39878C-5F76-4DB8-A25D-61D2C193C3CA"). It also sets the x-ms-return-client-request-id +// header to true such that UUID accompanies the http.Response. +func WithReturningClientID(uuid string) autorest.PrepareDecorator { + preparer := autorest.CreatePreparer( + WithClientID(uuid), + WithReturnClientID(true)) + + return func(p autorest.Preparer) autorest.Preparer { + return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err != nil { + return r, err + } + return preparer.Prepare(r) + }) + } +} + +// WithClientID returns a PrepareDecorator that adds an HTTP extension header of +// x-ms-client-request-id whose value is passed, undecorated UUID (e.g., +// "0F39878C-5F76-4DB8-A25D-61D2C193C3CA"). +func WithClientID(uuid string) autorest.PrepareDecorator { + return autorest.WithHeader(HeaderClientID, uuid) +} + +// WithReturnClientID returns a PrepareDecorator that adds an HTTP extension header of +// x-ms-return-client-request-id whose boolean value indicates if the value of the +// x-ms-client-request-id header should be included in the http.Response. +func WithReturnClientID(b bool) autorest.PrepareDecorator { + return autorest.WithHeader(HeaderReturnClientID, strconv.FormatBool(b)) +} + +// ExtractClientID extracts the client identifier from the x-ms-client-request-id header set on the +// http.Request sent to the service (and returned in the http.Response) +func ExtractClientID(resp *http.Response) string { + return autorest.ExtractHeaderValue(HeaderClientID, resp) +} + +// ExtractRequestID extracts the Azure server generated request identifier from the +// x-ms-request-id header. +func ExtractRequestID(resp *http.Response) string { + return autorest.ExtractHeaderValue(HeaderRequestID, resp) +} + +// WithErrorUnlessStatusCode returns a RespondDecorator that emits an +// azure.RequestError by reading the response body unless the response HTTP status code +// is among the set passed. +// +// If there is a chance service may return responses other than the Azure error +// format and the response cannot be parsed into an error, a decoding error will +// be returned containing the response body. In any case, the Responder will +// return an error if the status code is not satisfied. +// +// If this Responder returns an error, the response body will be replaced with +// an in-memory reader, which needs no further closing. +func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator { + return func(r autorest.Responder) autorest.Responder { + return autorest.ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil && !autorest.ResponseHasStatusCode(resp, codes...) { + var e RequestError + defer resp.Body.Close() + + // Copy and replace the Body in case it does not contain an error object. + // This will leave the Body available to the caller. + b, decodeErr := autorest.CopyAndDecode(autorest.EncodedAsJSON, resp.Body, &e) + resp.Body = ioutil.NopCloser(&b) + if decodeErr != nil { + return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr) + } else if e.ServiceError == nil { + e.ServiceError = &ServiceError{Code: "Unknown", Message: "Unknown service error"} + } + + e.RequestID = ExtractRequestID(resp) + if e.StatusCode == nil { + e.StatusCode = resp.StatusCode + } + err = &e + } + return err + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure_test.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure_test.go index d21f1d3444..ff014b518e 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure_test.go @@ -1,431 +1,431 @@ -package azure - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "reflect" - "strconv" - "testing" - "time" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/mocks" -) - -const ( - headerAuthorization = "Authorization" - longDelay = 5 * time.Second - retryDelay = 10 * time.Millisecond - testLogPrefix = "azure:" -) - -// Use a Client Inspector to set the request identifier. -func ExampleWithClientID() { - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - req, _ := autorest.Prepare(&http.Request{}, - autorest.AsGet(), - autorest.WithBaseURL("https://microsoft.com/a/b/c/")) - - c := autorest.Client{Sender: mocks.NewSender()} - c.RequestInspector = WithReturningClientID(uuid) - - autorest.SendWithSender(c, req) - fmt.Printf("Inspector added the %s header with the value %s\n", - HeaderClientID, req.Header.Get(HeaderClientID)) - fmt.Printf("Inspector added the %s header with the value %s\n", - HeaderReturnClientID, req.Header.Get(HeaderReturnClientID)) - // Output: - // Inspector added the x-ms-client-request-id header with the value 71FDB9F4-5E49-4C12-B266-DE7B4FD999A6 - // Inspector added the x-ms-return-client-request-id header with the value true -} - -func TestWithReturningClientIDReturnsError(t *testing.T) { - var errIn error - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - _, errOut := autorest.Prepare(&http.Request{}, - withErrorPrepareDecorator(&errIn), - WithReturningClientID(uuid)) - - if errOut == nil || errIn != errOut { - t.Fatalf("azure: WithReturningClientID failed to exit early when receiving an error -- expected (%v), received (%v)", - errIn, errOut) - } -} - -func TestWithClientID(t *testing.T) { - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - req, _ := autorest.Prepare(&http.Request{}, - WithClientID(uuid)) - - if req.Header.Get(HeaderClientID) != uuid { - t.Fatalf("azure: WithClientID failed to set %s -- expected %s, received %s", - HeaderClientID, uuid, req.Header.Get(HeaderClientID)) - } -} - -func TestWithReturnClientID(t *testing.T) { - b := false - req, _ := autorest.Prepare(&http.Request{}, - WithReturnClientID(b)) - - if req.Header.Get(HeaderReturnClientID) != strconv.FormatBool(b) { - t.Fatalf("azure: WithReturnClientID failed to set %s -- expected %s, received %s", - HeaderClientID, strconv.FormatBool(b), req.Header.Get(HeaderClientID)) - } -} - -func TestExtractClientID(t *testing.T) { - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - resp := mocks.NewResponse() - mocks.SetResponseHeader(resp, HeaderClientID, uuid) - - if ExtractClientID(resp) != uuid { - t.Fatalf("azure: ExtractClientID failed to extract the %s -- expected %s, received %s", - HeaderClientID, uuid, ExtractClientID(resp)) - } -} - -func TestExtractRequestID(t *testing.T) { - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - resp := mocks.NewResponse() - mocks.SetResponseHeader(resp, HeaderRequestID, uuid) - - if ExtractRequestID(resp) != uuid { - t.Fatalf("azure: ExtractRequestID failed to extract the %s -- expected %s, received %s", - HeaderRequestID, uuid, ExtractRequestID(resp)) - } -} - -func TestIsAzureError_ReturnsTrueForAzureError(t *testing.T) { - if !IsAzureError(&RequestError{}) { - t.Fatalf("azure: IsAzureError failed to return true for an Azure Service error") - } -} - -func TestIsAzureError_ReturnsFalseForNonAzureError(t *testing.T) { - if IsAzureError(fmt.Errorf("An Error")) { - t.Fatalf("azure: IsAzureError return true for an non-Azure Service error") - } -} - -func TestNewErrorWithError_UsesReponseStatusCode(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("Error"), "packageType", "method", mocks.NewResponseWithStatus("Forbidden", http.StatusForbidden), "message") - if e.StatusCode != http.StatusForbidden { - t.Fatalf("azure: NewErrorWithError failed to use the Status Code of the passed Response -- expected %v, received %v", http.StatusForbidden, e.StatusCode) - } -} - -func TestNewErrorWithError_ReturnsUnwrappedError(t *testing.T) { - e1 := RequestError{} - e1.ServiceError = &ServiceError{Code: "42", Message: "A Message"} - e1.StatusCode = 200 - e1.RequestID = "A RequestID" - e2 := NewErrorWithError(&e1, "packageType", "method", nil, "message") - - if !reflect.DeepEqual(e1, e2) { - t.Fatalf("azure: NewErrorWithError wrapped an RequestError -- expected %T, received %T", e1, e2) - } -} - -func TestNewErrorWithError_WrapsAnError(t *testing.T) { - e1 := fmt.Errorf("Inner Error") - var e2 interface{} = NewErrorWithError(e1, "packageType", "method", nil, "message") - - if _, ok := e2.(RequestError); !ok { - t.Fatalf("azure: NewErrorWithError failed to wrap a standard error -- received %T", e2) - } -} - -func TestWithErrorUnlessStatusCode_NotAnAzureError(t *testing.T) { - body := ` - - IIS Error page - - Some non-JSON error page - ` - r := mocks.NewResponseWithContent(body) - r.Request = mocks.NewRequest() - r.StatusCode = http.StatusBadRequest - r.Status = http.StatusText(r.StatusCode) - - err := autorest.Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - ok, _ := err.(*RequestError) - if ok != nil { - t.Fatalf("azure: azure.RequestError returned from malformed response: %v", err) - } - - // the error body should still be there - defer r.Body.Close() - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - if string(b) != body { - t.Fatalf("response body is wrong. got=%q exptected=%q", string(b), body) - } -} - -func TestWithErrorUnlessStatusCode_FoundAzureErrorWithoutDetails(t *testing.T) { - j := `{ - "error": { - "code": "InternalError", - "message": "Azure is having trouble right now." - } - }` - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - r := mocks.NewResponseWithContent(j) - mocks.SetResponseHeader(r, HeaderRequestID, uuid) - r.Request = mocks.NewRequest() - r.StatusCode = http.StatusInternalServerError - r.Status = http.StatusText(r.StatusCode) - - err := autorest.Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - - if err == nil { - t.Fatalf("azure: returned nil error for proper error response") - } - azErr, ok := err.(*RequestError) - if !ok { - t.Fatalf("azure: returned error is not azure.RequestError: %T", err) - } - - expected := "autorest/azure: Service returned an error. Status=500 Code=\"InternalError\" Message=\"Azure is having trouble right now.\"" - if !reflect.DeepEqual(expected, azErr.Error()) { - t.Fatalf("azure: service error is not unmarshaled properly.\nexpected=%v\ngot=%v", expected, azErr.Error()) - } - - if expected := http.StatusInternalServerError; azErr.StatusCode != expected { - t.Fatalf("azure: got wrong StatusCode=%d Expected=%d", azErr.StatusCode, expected) - } - if expected := uuid; azErr.RequestID != expected { - t.Fatalf("azure: wrong request ID in error. expected=%q; got=%q", expected, azErr.RequestID) - } - - _ = azErr.Error() - - // the error body should still be there - defer r.Body.Close() - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - if string(b) != j { - t.Fatalf("response body is wrong. got=%q expected=%q", string(b), j) - } - -} - -func TestWithErrorUnlessStatusCode_FoundAzureErrorWithDetails(t *testing.T) { - j := `{ - "error": { - "code": "InternalError", - "message": "Azure is having trouble right now.", - "details": [{"code": "conflict1", "message":"error message1"}, - {"code": "conflict2", "message":"error message2"}] - } - }` - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - r := mocks.NewResponseWithContent(j) - mocks.SetResponseHeader(r, HeaderRequestID, uuid) - r.Request = mocks.NewRequest() - r.StatusCode = http.StatusInternalServerError - r.Status = http.StatusText(r.StatusCode) - - err := autorest.Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - - if err == nil { - t.Fatalf("azure: returned nil error for proper error response") - } - azErr, ok := err.(*RequestError) - if !ok { - t.Fatalf("azure: returned error is not azure.RequestError: %T", err) - } - - if expected := "InternalError"; azErr.ServiceError.Code != expected { - t.Fatalf("azure: wrong error code. expected=%q; got=%q", expected, azErr.ServiceError.Code) - } - if azErr.ServiceError.Message == "" { - t.Fatalf("azure: error message is not unmarshaled properly") - } - b, _ := json.Marshal(*azErr.ServiceError.Details) - if string(b) != `[{"code":"conflict1","message":"error message1"},{"code":"conflict2","message":"error message2"}]` { - t.Fatalf("azure: error details is not unmarshaled properly") - } - - if expected := http.StatusInternalServerError; azErr.StatusCode != expected { - t.Fatalf("azure: got wrong StatusCode=%v Expected=%d", azErr.StatusCode, expected) - } - if expected := uuid; azErr.RequestID != expected { - t.Fatalf("azure: wrong request ID in error. expected=%q; got=%q", expected, azErr.RequestID) - } - - _ = azErr.Error() - - // the error body should still be there - defer r.Body.Close() - b, err = ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - if string(b) != j { - t.Fatalf("response body is wrong. got=%q expected=%q", string(b), j) - } - -} - -func TestWithErrorUnlessStatusCode_NoAzureError(t *testing.T) { - j := `{ - "Status":"NotFound" - }` - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - r := mocks.NewResponseWithContent(j) - mocks.SetResponseHeader(r, HeaderRequestID, uuid) - r.Request = mocks.NewRequest() - r.StatusCode = http.StatusInternalServerError - r.Status = http.StatusText(r.StatusCode) - - err := autorest.Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - if err == nil { - t.Fatalf("azure: returned nil error for proper error response") - } - azErr, ok := err.(*RequestError) - if !ok { - t.Fatalf("azure: returned error is not azure.RequestError: %T", err) - } - - expected := &ServiceError{ - Code: "Unknown", - Message: "Unknown service error", - } - - if !reflect.DeepEqual(expected, azErr.ServiceError) { - t.Fatalf("azure: service error is not unmarshaled properly. expected=%q\ngot=%q", expected, azErr.ServiceError) - } - - if expected := http.StatusInternalServerError; azErr.StatusCode != expected { - t.Fatalf("azure: got wrong StatusCode=%v Expected=%d", azErr.StatusCode, expected) - } - if expected := uuid; azErr.RequestID != expected { - t.Fatalf("azure: wrong request ID in error. expected=%q; got=%q", expected, azErr.RequestID) - } - - _ = azErr.Error() - - // the error body should still be there - defer r.Body.Close() - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - if string(b) != j { - t.Fatalf("response body is wrong. got=%q expected=%q", string(b), j) - } - -} - -func TestRequestErrorString_WithError(t *testing.T) { - j := `{ - "error": { - "code": "InternalError", - "message": "Conflict", - "details": [{"code": "conflict1", "message":"error message1"}] - } - }` - uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" - r := mocks.NewResponseWithContent(j) - mocks.SetResponseHeader(r, HeaderRequestID, uuid) - r.Request = mocks.NewRequest() - r.StatusCode = http.StatusInternalServerError - r.Status = http.StatusText(r.StatusCode) - - err := autorest.Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - - if err == nil { - t.Fatalf("azure: returned nil error for proper error response") - } - azErr, _ := err.(*RequestError) - expected := "autorest/azure: Service returned an error. Status=500 Code=\"InternalError\" Message=\"Conflict\" Details=[{\"code\":\"conflict1\",\"message\":\"error message1\"}]" - if expected != azErr.Error() { - t.Fatalf("azure: send wrong RequestError.\nexpected=%v\ngot=%v", expected, azErr.Error()) - } -} - -func withErrorPrepareDecorator(e *error) autorest.PrepareDecorator { - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - *e = fmt.Errorf("azure: Faux Prepare Error") - return r, *e - }) - } -} - -func withAsyncResponseDecorator(n int) autorest.SendDecorator { - i := 0 - return func(s autorest.Sender) autorest.Sender { - return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err == nil { - if i < n { - resp.StatusCode = http.StatusCreated - resp.Header = http.Header{} - resp.Header.Add(http.CanonicalHeaderKey(headerAsyncOperation), mocks.TestURL) - i++ - } else { - resp.StatusCode = http.StatusOK - resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) - } - } - return resp, err - }) - } -} - -type mockAuthorizer struct{} - -func (ma mockAuthorizer) WithAuthorization() autorest.PrepareDecorator { - return autorest.WithHeader(headerAuthorization, mocks.TestAuthorizationHeader) -} - -type mockFailingAuthorizer struct{} - -func (mfa mockFailingAuthorizer) WithAuthorization() autorest.PrepareDecorator { - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - return r, fmt.Errorf("ERROR: mockFailingAuthorizer returned expected error") - }) - } -} - -type mockInspector struct { - wasInvoked bool -} - -func (mi *mockInspector) WithInspection() autorest.PrepareDecorator { - return func(p autorest.Preparer) autorest.Preparer { - return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { - mi.wasInvoked = true - return p.Prepare(r) - }) - } -} - -func (mi *mockInspector) ByInspecting() autorest.RespondDecorator { - return func(r autorest.Responder) autorest.Responder { - return autorest.ResponderFunc(func(resp *http.Response) error { - mi.wasInvoked = true - return r.Respond(resp) - }) - } -} +package azure + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "reflect" + "strconv" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/mocks" +) + +const ( + headerAuthorization = "Authorization" + longDelay = 5 * time.Second + retryDelay = 10 * time.Millisecond + testLogPrefix = "azure:" +) + +// Use a Client Inspector to set the request identifier. +func ExampleWithClientID() { + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + req, _ := autorest.Prepare(&http.Request{}, + autorest.AsGet(), + autorest.WithBaseURL("https://microsoft.com/a/b/c/")) + + c := autorest.Client{Sender: mocks.NewSender()} + c.RequestInspector = WithReturningClientID(uuid) + + autorest.SendWithSender(c, req) + fmt.Printf("Inspector added the %s header with the value %s\n", + HeaderClientID, req.Header.Get(HeaderClientID)) + fmt.Printf("Inspector added the %s header with the value %s\n", + HeaderReturnClientID, req.Header.Get(HeaderReturnClientID)) + // Output: + // Inspector added the x-ms-client-request-id header with the value 71FDB9F4-5E49-4C12-B266-DE7B4FD999A6 + // Inspector added the x-ms-return-client-request-id header with the value true +} + +func TestWithReturningClientIDReturnsError(t *testing.T) { + var errIn error + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + _, errOut := autorest.Prepare(&http.Request{}, + withErrorPrepareDecorator(&errIn), + WithReturningClientID(uuid)) + + if errOut == nil || errIn != errOut { + t.Fatalf("azure: WithReturningClientID failed to exit early when receiving an error -- expected (%v), received (%v)", + errIn, errOut) + } +} + +func TestWithClientID(t *testing.T) { + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + req, _ := autorest.Prepare(&http.Request{}, + WithClientID(uuid)) + + if req.Header.Get(HeaderClientID) != uuid { + t.Fatalf("azure: WithClientID failed to set %s -- expected %s, received %s", + HeaderClientID, uuid, req.Header.Get(HeaderClientID)) + } +} + +func TestWithReturnClientID(t *testing.T) { + b := false + req, _ := autorest.Prepare(&http.Request{}, + WithReturnClientID(b)) + + if req.Header.Get(HeaderReturnClientID) != strconv.FormatBool(b) { + t.Fatalf("azure: WithReturnClientID failed to set %s -- expected %s, received %s", + HeaderClientID, strconv.FormatBool(b), req.Header.Get(HeaderClientID)) + } +} + +func TestExtractClientID(t *testing.T) { + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + resp := mocks.NewResponse() + mocks.SetResponseHeader(resp, HeaderClientID, uuid) + + if ExtractClientID(resp) != uuid { + t.Fatalf("azure: ExtractClientID failed to extract the %s -- expected %s, received %s", + HeaderClientID, uuid, ExtractClientID(resp)) + } +} + +func TestExtractRequestID(t *testing.T) { + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + resp := mocks.NewResponse() + mocks.SetResponseHeader(resp, HeaderRequestID, uuid) + + if ExtractRequestID(resp) != uuid { + t.Fatalf("azure: ExtractRequestID failed to extract the %s -- expected %s, received %s", + HeaderRequestID, uuid, ExtractRequestID(resp)) + } +} + +func TestIsAzureError_ReturnsTrueForAzureError(t *testing.T) { + if !IsAzureError(&RequestError{}) { + t.Fatalf("azure: IsAzureError failed to return true for an Azure Service error") + } +} + +func TestIsAzureError_ReturnsFalseForNonAzureError(t *testing.T) { + if IsAzureError(fmt.Errorf("An Error")) { + t.Fatalf("azure: IsAzureError return true for an non-Azure Service error") + } +} + +func TestNewErrorWithError_UsesReponseStatusCode(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("Error"), "packageType", "method", mocks.NewResponseWithStatus("Forbidden", http.StatusForbidden), "message") + if e.StatusCode != http.StatusForbidden { + t.Fatalf("azure: NewErrorWithError failed to use the Status Code of the passed Response -- expected %v, received %v", http.StatusForbidden, e.StatusCode) + } +} + +func TestNewErrorWithError_ReturnsUnwrappedError(t *testing.T) { + e1 := RequestError{} + e1.ServiceError = &ServiceError{Code: "42", Message: "A Message"} + e1.StatusCode = 200 + e1.RequestID = "A RequestID" + e2 := NewErrorWithError(&e1, "packageType", "method", nil, "message") + + if !reflect.DeepEqual(e1, e2) { + t.Fatalf("azure: NewErrorWithError wrapped an RequestError -- expected %T, received %T", e1, e2) + } +} + +func TestNewErrorWithError_WrapsAnError(t *testing.T) { + e1 := fmt.Errorf("Inner Error") + var e2 interface{} = NewErrorWithError(e1, "packageType", "method", nil, "message") + + if _, ok := e2.(RequestError); !ok { + t.Fatalf("azure: NewErrorWithError failed to wrap a standard error -- received %T", e2) + } +} + +func TestWithErrorUnlessStatusCode_NotAnAzureError(t *testing.T) { + body := ` + + IIS Error page + + Some non-JSON error page + ` + r := mocks.NewResponseWithContent(body) + r.Request = mocks.NewRequest() + r.StatusCode = http.StatusBadRequest + r.Status = http.StatusText(r.StatusCode) + + err := autorest.Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + ok, _ := err.(*RequestError) + if ok != nil { + t.Fatalf("azure: azure.RequestError returned from malformed response: %v", err) + } + + // the error body should still be there + defer r.Body.Close() + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + if string(b) != body { + t.Fatalf("response body is wrong. got=%q exptected=%q", string(b), body) + } +} + +func TestWithErrorUnlessStatusCode_FoundAzureErrorWithoutDetails(t *testing.T) { + j := `{ + "error": { + "code": "InternalError", + "message": "Azure is having trouble right now." + } + }` + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + r := mocks.NewResponseWithContent(j) + mocks.SetResponseHeader(r, HeaderRequestID, uuid) + r.Request = mocks.NewRequest() + r.StatusCode = http.StatusInternalServerError + r.Status = http.StatusText(r.StatusCode) + + err := autorest.Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + + if err == nil { + t.Fatalf("azure: returned nil error for proper error response") + } + azErr, ok := err.(*RequestError) + if !ok { + t.Fatalf("azure: returned error is not azure.RequestError: %T", err) + } + + expected := "autorest/azure: Service returned an error. Status=500 Code=\"InternalError\" Message=\"Azure is having trouble right now.\"" + if !reflect.DeepEqual(expected, azErr.Error()) { + t.Fatalf("azure: service error is not unmarshaled properly.\nexpected=%v\ngot=%v", expected, azErr.Error()) + } + + if expected := http.StatusInternalServerError; azErr.StatusCode != expected { + t.Fatalf("azure: got wrong StatusCode=%d Expected=%d", azErr.StatusCode, expected) + } + if expected := uuid; azErr.RequestID != expected { + t.Fatalf("azure: wrong request ID in error. expected=%q; got=%q", expected, azErr.RequestID) + } + + _ = azErr.Error() + + // the error body should still be there + defer r.Body.Close() + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + if string(b) != j { + t.Fatalf("response body is wrong. got=%q expected=%q", string(b), j) + } + +} + +func TestWithErrorUnlessStatusCode_FoundAzureErrorWithDetails(t *testing.T) { + j := `{ + "error": { + "code": "InternalError", + "message": "Azure is having trouble right now.", + "details": [{"code": "conflict1", "message":"error message1"}, + {"code": "conflict2", "message":"error message2"}] + } + }` + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + r := mocks.NewResponseWithContent(j) + mocks.SetResponseHeader(r, HeaderRequestID, uuid) + r.Request = mocks.NewRequest() + r.StatusCode = http.StatusInternalServerError + r.Status = http.StatusText(r.StatusCode) + + err := autorest.Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + + if err == nil { + t.Fatalf("azure: returned nil error for proper error response") + } + azErr, ok := err.(*RequestError) + if !ok { + t.Fatalf("azure: returned error is not azure.RequestError: %T", err) + } + + if expected := "InternalError"; azErr.ServiceError.Code != expected { + t.Fatalf("azure: wrong error code. expected=%q; got=%q", expected, azErr.ServiceError.Code) + } + if azErr.ServiceError.Message == "" { + t.Fatalf("azure: error message is not unmarshaled properly") + } + b, _ := json.Marshal(*azErr.ServiceError.Details) + if string(b) != `[{"code":"conflict1","message":"error message1"},{"code":"conflict2","message":"error message2"}]` { + t.Fatalf("azure: error details is not unmarshaled properly") + } + + if expected := http.StatusInternalServerError; azErr.StatusCode != expected { + t.Fatalf("azure: got wrong StatusCode=%v Expected=%d", azErr.StatusCode, expected) + } + if expected := uuid; azErr.RequestID != expected { + t.Fatalf("azure: wrong request ID in error. expected=%q; got=%q", expected, azErr.RequestID) + } + + _ = azErr.Error() + + // the error body should still be there + defer r.Body.Close() + b, err = ioutil.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + if string(b) != j { + t.Fatalf("response body is wrong. got=%q expected=%q", string(b), j) + } + +} + +func TestWithErrorUnlessStatusCode_NoAzureError(t *testing.T) { + j := `{ + "Status":"NotFound" + }` + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + r := mocks.NewResponseWithContent(j) + mocks.SetResponseHeader(r, HeaderRequestID, uuid) + r.Request = mocks.NewRequest() + r.StatusCode = http.StatusInternalServerError + r.Status = http.StatusText(r.StatusCode) + + err := autorest.Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + if err == nil { + t.Fatalf("azure: returned nil error for proper error response") + } + azErr, ok := err.(*RequestError) + if !ok { + t.Fatalf("azure: returned error is not azure.RequestError: %T", err) + } + + expected := &ServiceError{ + Code: "Unknown", + Message: "Unknown service error", + } + + if !reflect.DeepEqual(expected, azErr.ServiceError) { + t.Fatalf("azure: service error is not unmarshaled properly. expected=%q\ngot=%q", expected, azErr.ServiceError) + } + + if expected := http.StatusInternalServerError; azErr.StatusCode != expected { + t.Fatalf("azure: got wrong StatusCode=%v Expected=%d", azErr.StatusCode, expected) + } + if expected := uuid; azErr.RequestID != expected { + t.Fatalf("azure: wrong request ID in error. expected=%q; got=%q", expected, azErr.RequestID) + } + + _ = azErr.Error() + + // the error body should still be there + defer r.Body.Close() + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + if string(b) != j { + t.Fatalf("response body is wrong. got=%q expected=%q", string(b), j) + } + +} + +func TestRequestErrorString_WithError(t *testing.T) { + j := `{ + "error": { + "code": "InternalError", + "message": "Conflict", + "details": [{"code": "conflict1", "message":"error message1"}] + } + }` + uuid := "71FDB9F4-5E49-4C12-B266-DE7B4FD999A6" + r := mocks.NewResponseWithContent(j) + mocks.SetResponseHeader(r, HeaderRequestID, uuid) + r.Request = mocks.NewRequest() + r.StatusCode = http.StatusInternalServerError + r.Status = http.StatusText(r.StatusCode) + + err := autorest.Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + + if err == nil { + t.Fatalf("azure: returned nil error for proper error response") + } + azErr, _ := err.(*RequestError) + expected := "autorest/azure: Service returned an error. Status=500 Code=\"InternalError\" Message=\"Conflict\" Details=[{\"code\":\"conflict1\",\"message\":\"error message1\"}]" + if expected != azErr.Error() { + t.Fatalf("azure: send wrong RequestError.\nexpected=%v\ngot=%v", expected, azErr.Error()) + } +} + +func withErrorPrepareDecorator(e *error) autorest.PrepareDecorator { + return func(p autorest.Preparer) autorest.Preparer { + return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { + *e = fmt.Errorf("azure: Faux Prepare Error") + return r, *e + }) + } +} + +func withAsyncResponseDecorator(n int) autorest.SendDecorator { + i := 0 + return func(s autorest.Sender) autorest.Sender { + return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err == nil { + if i < n { + resp.StatusCode = http.StatusCreated + resp.Header = http.Header{} + resp.Header.Add(http.CanonicalHeaderKey(headerAsyncOperation), mocks.TestURL) + i++ + } else { + resp.StatusCode = http.StatusOK + resp.Header.Del(http.CanonicalHeaderKey(headerAsyncOperation)) + } + } + return resp, err + }) + } +} + +type mockAuthorizer struct{} + +func (ma mockAuthorizer) WithAuthorization() autorest.PrepareDecorator { + return autorest.WithHeader(headerAuthorization, mocks.TestAuthorizationHeader) +} + +type mockFailingAuthorizer struct{} + +func (mfa mockFailingAuthorizer) WithAuthorization() autorest.PrepareDecorator { + return func(p autorest.Preparer) autorest.Preparer { + return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { + return r, fmt.Errorf("ERROR: mockFailingAuthorizer returned expected error") + }) + } +} + +type mockInspector struct { + wasInvoked bool +} + +func (mi *mockInspector) WithInspection() autorest.PrepareDecorator { + return func(p autorest.Preparer) autorest.Preparer { + return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) { + mi.wasInvoked = true + return p.Prepare(r) + }) + } +} + +func (mi *mockInspector) ByInspecting() autorest.RespondDecorator { + return func(r autorest.Responder) autorest.Responder { + return autorest.ResponderFunc(func(resp *http.Response) error { + mi.wasInvoked = true + return r.Respond(resp) + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go index b5528d783e..1cf55651f2 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go @@ -1,130 +1,130 @@ -package azure - -import ( - "fmt" - "strings" -) - -var environments = map[string]Environment{ - "AZURECHINACLOUD": ChinaCloud, - "AZUREGERMANCLOUD": GermanCloud, - "AZUREPUBLICCLOUD": PublicCloud, - "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, -} - -// Environment represents a set of endpoints for each of Azure's Clouds. -type Environment struct { - Name string `json:"name"` - ManagementPortalURL string `json:"managementPortalURL"` - PublishSettingsURL string `json:"publishSettingsURL"` - ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` - ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` - ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` - GalleryEndpoint string `json:"galleryEndpoint"` - KeyVaultEndpoint string `json:"keyVaultEndpoint"` - GraphEndpoint string `json:"graphEndpoint"` - StorageEndpointSuffix string `json:"storageEndpointSuffix"` - SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` - TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` - KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` - ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` - ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` - ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` - ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` -} - -var ( - // PublicCloud is the default public Azure cloud environment - PublicCloud = Environment{ - Name: "AzurePublicCloud", - ManagementPortalURL: "https://manage.windowsazure.com/", - PublishSettingsURL: "https://manage.windowsazure.com/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.windows.net/", - ResourceManagerEndpoint: "https://management.azure.com/", - ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", - GalleryEndpoint: "https://gallery.azure.com/", - KeyVaultEndpoint: "https://vault.azure.net/", - GraphEndpoint: "https://graph.windows.net/", - StorageEndpointSuffix: "core.windows.net", - SQLDatabaseDNSSuffix: "database.windows.net", - TrafficManagerDNSSuffix: "trafficmanager.net", - KeyVaultDNSSuffix: "vault.azure.net", - ServiceBusEndpointSuffix: "servicebus.azure.com", - ServiceManagementVMDNSSuffix: "cloudapp.net", - ResourceManagerVMDNSSuffix: "cloudapp.azure.com", - ContainerRegistryDNSSuffix: "azurecr.io", - } - - // USGovernmentCloud is the cloud environment for the US Government - USGovernmentCloud = Environment{ - Name: "AzureUSGovernmentCloud", - ManagementPortalURL: "https://manage.windowsazure.us/", - PublishSettingsURL: "https://manage.windowsazure.us/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.usgovcloudapi.net/", - ResourceManagerEndpoint: "https://management.usgovcloudapi.net/", - ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", - GalleryEndpoint: "https://gallery.usgovcloudapi.net/", - KeyVaultEndpoint: "https://vault.usgovcloudapi.net/", - GraphEndpoint: "https://graph.usgovcloudapi.net/", - StorageEndpointSuffix: "core.usgovcloudapi.net", - SQLDatabaseDNSSuffix: "database.usgovcloudapi.net", - TrafficManagerDNSSuffix: "usgovtrafficmanager.net", - KeyVaultDNSSuffix: "vault.usgovcloudapi.net", - ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net", - ServiceManagementVMDNSSuffix: "usgovcloudapp.net", - ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us", - ContainerRegistryDNSSuffix: "azurecr.io", - } - - // ChinaCloud is the cloud environment operated in China - ChinaCloud = Environment{ - Name: "AzureChinaCloud", - ManagementPortalURL: "https://manage.chinacloudapi.com/", - PublishSettingsURL: "https://manage.chinacloudapi.com/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.chinacloudapi.cn/", - ResourceManagerEndpoint: "https://management.chinacloudapi.cn/", - ActiveDirectoryEndpoint: "https://login.chinacloudapi.cn/", - GalleryEndpoint: "https://gallery.chinacloudapi.cn/", - KeyVaultEndpoint: "https://vault.azure.cn/", - GraphEndpoint: "https://graph.chinacloudapi.cn/", - StorageEndpointSuffix: "core.chinacloudapi.cn", - SQLDatabaseDNSSuffix: "database.chinacloudapi.cn", - TrafficManagerDNSSuffix: "trafficmanager.cn", - KeyVaultDNSSuffix: "vault.azure.cn", - ServiceBusEndpointSuffix: "servicebus.chinacloudapi.net", - ServiceManagementVMDNSSuffix: "chinacloudapp.cn", - ResourceManagerVMDNSSuffix: "cloudapp.azure.cn", - ContainerRegistryDNSSuffix: "azurecr.io", - } - - // GermanCloud is the cloud environment operated in Germany - GermanCloud = Environment{ - Name: "AzureGermanCloud", - ManagementPortalURL: "http://portal.microsoftazure.de/", - PublishSettingsURL: "https://manage.microsoftazure.de/publishsettings/index", - ServiceManagementEndpoint: "https://management.core.cloudapi.de/", - ResourceManagerEndpoint: "https://management.microsoftazure.de/", - ActiveDirectoryEndpoint: "https://login.microsoftonline.de/", - GalleryEndpoint: "https://gallery.cloudapi.de/", - KeyVaultEndpoint: "https://vault.microsoftazure.de/", - GraphEndpoint: "https://graph.cloudapi.de/", - StorageEndpointSuffix: "core.cloudapi.de", - SQLDatabaseDNSSuffix: "database.cloudapi.de", - TrafficManagerDNSSuffix: "azuretrafficmanager.de", - KeyVaultDNSSuffix: "vault.microsoftazure.de", - ServiceBusEndpointSuffix: "servicebus.cloudapi.de", - ServiceManagementVMDNSSuffix: "azurecloudapp.de", - ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de", - ContainerRegistryDNSSuffix: "azurecr.io", - } -) - -// EnvironmentFromName returns an Environment based on the common name specified -func EnvironmentFromName(name string) (Environment, error) { - name = strings.ToUpper(name) - env, ok := environments[name] - if !ok { - return env, fmt.Errorf("autorest/azure: There is no cloud environment matching the name %q", name) - } - return env, nil -} +package azure + +import ( + "fmt" + "strings" +) + +var environments = map[string]Environment{ + "AZURECHINACLOUD": ChinaCloud, + "AZUREGERMANCLOUD": GermanCloud, + "AZUREPUBLICCLOUD": PublicCloud, + "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, +} + +// Environment represents a set of endpoints for each of Azure's Clouds. +type Environment struct { + Name string `json:"name"` + ManagementPortalURL string `json:"managementPortalURL"` + PublishSettingsURL string `json:"publishSettingsURL"` + ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` + ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` + ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` + GalleryEndpoint string `json:"galleryEndpoint"` + KeyVaultEndpoint string `json:"keyVaultEndpoint"` + GraphEndpoint string `json:"graphEndpoint"` + StorageEndpointSuffix string `json:"storageEndpointSuffix"` + SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` + TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` + KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` + ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` + ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` + ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` + ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` +} + +var ( + // PublicCloud is the default public Azure cloud environment + PublicCloud = Environment{ + Name: "AzurePublicCloud", + ManagementPortalURL: "https://manage.windowsazure.com/", + PublishSettingsURL: "https://manage.windowsazure.com/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.windows.net/", + ResourceManagerEndpoint: "https://management.azure.com/", + ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", + GalleryEndpoint: "https://gallery.azure.com/", + KeyVaultEndpoint: "https://vault.azure.net/", + GraphEndpoint: "https://graph.windows.net/", + StorageEndpointSuffix: "core.windows.net", + SQLDatabaseDNSSuffix: "database.windows.net", + TrafficManagerDNSSuffix: "trafficmanager.net", + KeyVaultDNSSuffix: "vault.azure.net", + ServiceBusEndpointSuffix: "servicebus.azure.com", + ServiceManagementVMDNSSuffix: "cloudapp.net", + ResourceManagerVMDNSSuffix: "cloudapp.azure.com", + ContainerRegistryDNSSuffix: "azurecr.io", + } + + // USGovernmentCloud is the cloud environment for the US Government + USGovernmentCloud = Environment{ + Name: "AzureUSGovernmentCloud", + ManagementPortalURL: "https://manage.windowsazure.us/", + PublishSettingsURL: "https://manage.windowsazure.us/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.usgovcloudapi.net/", + ResourceManagerEndpoint: "https://management.usgovcloudapi.net/", + ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", + GalleryEndpoint: "https://gallery.usgovcloudapi.net/", + KeyVaultEndpoint: "https://vault.usgovcloudapi.net/", + GraphEndpoint: "https://graph.usgovcloudapi.net/", + StorageEndpointSuffix: "core.usgovcloudapi.net", + SQLDatabaseDNSSuffix: "database.usgovcloudapi.net", + TrafficManagerDNSSuffix: "usgovtrafficmanager.net", + KeyVaultDNSSuffix: "vault.usgovcloudapi.net", + ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net", + ServiceManagementVMDNSSuffix: "usgovcloudapp.net", + ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us", + ContainerRegistryDNSSuffix: "azurecr.io", + } + + // ChinaCloud is the cloud environment operated in China + ChinaCloud = Environment{ + Name: "AzureChinaCloud", + ManagementPortalURL: "https://manage.chinacloudapi.com/", + PublishSettingsURL: "https://manage.chinacloudapi.com/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.chinacloudapi.cn/", + ResourceManagerEndpoint: "https://management.chinacloudapi.cn/", + ActiveDirectoryEndpoint: "https://login.chinacloudapi.cn/", + GalleryEndpoint: "https://gallery.chinacloudapi.cn/", + KeyVaultEndpoint: "https://vault.azure.cn/", + GraphEndpoint: "https://graph.chinacloudapi.cn/", + StorageEndpointSuffix: "core.chinacloudapi.cn", + SQLDatabaseDNSSuffix: "database.chinacloudapi.cn", + TrafficManagerDNSSuffix: "trafficmanager.cn", + KeyVaultDNSSuffix: "vault.azure.cn", + ServiceBusEndpointSuffix: "servicebus.chinacloudapi.net", + ServiceManagementVMDNSSuffix: "chinacloudapp.cn", + ResourceManagerVMDNSSuffix: "cloudapp.azure.cn", + ContainerRegistryDNSSuffix: "azurecr.io", + } + + // GermanCloud is the cloud environment operated in Germany + GermanCloud = Environment{ + Name: "AzureGermanCloud", + ManagementPortalURL: "http://portal.microsoftazure.de/", + PublishSettingsURL: "https://manage.microsoftazure.de/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.cloudapi.de/", + ResourceManagerEndpoint: "https://management.microsoftazure.de/", + ActiveDirectoryEndpoint: "https://login.microsoftonline.de/", + GalleryEndpoint: "https://gallery.cloudapi.de/", + KeyVaultEndpoint: "https://vault.microsoftazure.de/", + GraphEndpoint: "https://graph.cloudapi.de/", + StorageEndpointSuffix: "core.cloudapi.de", + SQLDatabaseDNSSuffix: "database.cloudapi.de", + TrafficManagerDNSSuffix: "azuretrafficmanager.de", + KeyVaultDNSSuffix: "vault.microsoftazure.de", + ServiceBusEndpointSuffix: "servicebus.cloudapi.de", + ServiceManagementVMDNSSuffix: "azurecloudapp.de", + ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de", + ContainerRegistryDNSSuffix: "azurecr.io", + } +) + +// EnvironmentFromName returns an Environment based on the common name specified +func EnvironmentFromName(name string) (Environment, error) { + name = strings.ToUpper(name) + env, ok := environments[name] + if !ok { + return env, fmt.Errorf("autorest/azure: There is no cloud environment matching the name %q", name) + } + return env, nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/environments_test.go b/vendor/github.com/Azure/go-autorest/autorest/azure/environments_test.go index 020ccd0b99..a36b34b408 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/environments_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments_test.go @@ -1,216 +1,216 @@ -// test -package azure - -import ( - "encoding/json" - "testing" -) - -func TestEnvironmentFromName(t *testing.T) { - name := "azurechinacloud" - if env, _ := EnvironmentFromName(name); env != ChinaCloud { - t.Errorf("Expected to get ChinaCloud for %q", name) - } - - name = "AzureChinaCloud" - if env, _ := EnvironmentFromName(name); env != ChinaCloud { - t.Errorf("Expected to get ChinaCloud for %q", name) - } - - name = "azuregermancloud" - if env, _ := EnvironmentFromName(name); env != GermanCloud { - t.Errorf("Expected to get GermanCloud for %q", name) - } - - name = "AzureGermanCloud" - if env, _ := EnvironmentFromName(name); env != GermanCloud { - t.Errorf("Expected to get GermanCloud for %q", name) - } - - name = "azurepubliccloud" - if env, _ := EnvironmentFromName(name); env != PublicCloud { - t.Errorf("Expected to get PublicCloud for %q", name) - } - - name = "AzurePublicCloud" - if env, _ := EnvironmentFromName(name); env != PublicCloud { - t.Errorf("Expected to get PublicCloud for %q", name) - } - - name = "azureusgovernmentcloud" - if env, _ := EnvironmentFromName(name); env != USGovernmentCloud { - t.Errorf("Expected to get USGovernmentCloud for %q", name) - } - - name = "AzureUSGovernmentCloud" - if env, _ := EnvironmentFromName(name); env != USGovernmentCloud { - t.Errorf("Expected to get USGovernmentCloud for %q", name) - } - - name = "thisisnotarealcloudenv" - if _, err := EnvironmentFromName(name); err == nil { - t.Errorf("Expected to get an error for %q", name) - } -} - -func TestDeserializeEnvironment(t *testing.T) { - env := `{ - "name": "--name--", - "ActiveDirectoryEndpoint": "--active-directory-endpoint--", - "galleryEndpoint": "--gallery-endpoint--", - "graphEndpoint": "--graph-endpoint--", - "keyVaultDNSSuffix": "--key-vault-dns-suffix--", - "keyVaultEndpoint": "--key-vault-endpoint--", - "managementPortalURL": "--management-portal-url--", - "publishSettingsURL": "--publish-settings-url--", - "resourceManagerEndpoint": "--resource-manager-endpoint--", - "serviceBusEndpointSuffix": "--service-bus-endpoint-suffix--", - "serviceManagementEndpoint": "--service-management-endpoint--", - "sqlDatabaseDNSSuffix": "--sql-database-dns-suffix--", - "storageEndpointSuffix": "--storage-endpoint-suffix--", - "trafficManagerDNSSuffix": "--traffic-manager-dns-suffix--", - "serviceManagementVMDNSSuffix": "--asm-vm-dns-suffix--", - "resourceManagerVMDNSSuffix": "--arm-vm-dns-suffix--", - "containerRegistryDNSSuffix": "--container-registry-dns-suffix--" - }` - - testSubject := Environment{} - err := json.Unmarshal([]byte(env), &testSubject) - if err != nil { - t.Fatalf("failed to unmarshal: %s", err) - } - - if "--name--" != testSubject.Name { - t.Errorf("Expected Name to be \"--name--\", but got %q", testSubject.Name) - } - if "--management-portal-url--" != testSubject.ManagementPortalURL { - t.Errorf("Expected ManagementPortalURL to be \"--management-portal-url--\", but got %q", testSubject.ManagementPortalURL) - } - if "--publish-settings-url--" != testSubject.PublishSettingsURL { - t.Errorf("Expected PublishSettingsURL to be \"--publish-settings-url--\", but got %q", testSubject.PublishSettingsURL) - } - if "--service-management-endpoint--" != testSubject.ServiceManagementEndpoint { - t.Errorf("Expected ServiceManagementEndpoint to be \"--service-management-endpoint--\", but got %q", testSubject.ServiceManagementEndpoint) - } - if "--resource-manager-endpoint--" != testSubject.ResourceManagerEndpoint { - t.Errorf("Expected ResourceManagerEndpoint to be \"--resource-manager-endpoint--\", but got %q", testSubject.ResourceManagerEndpoint) - } - if "--active-directory-endpoint--" != testSubject.ActiveDirectoryEndpoint { - t.Errorf("Expected ActiveDirectoryEndpoint to be \"--active-directory-endpoint--\", but got %q", testSubject.ActiveDirectoryEndpoint) - } - if "--gallery-endpoint--" != testSubject.GalleryEndpoint { - t.Errorf("Expected GalleryEndpoint to be \"--gallery-endpoint--\", but got %q", testSubject.GalleryEndpoint) - } - if "--key-vault-endpoint--" != testSubject.KeyVaultEndpoint { - t.Errorf("Expected KeyVaultEndpoint to be \"--key-vault-endpoint--\", but got %q", testSubject.KeyVaultEndpoint) - } - if "--graph-endpoint--" != testSubject.GraphEndpoint { - t.Errorf("Expected GraphEndpoint to be \"--graph-endpoint--\", but got %q", testSubject.GraphEndpoint) - } - if "--storage-endpoint-suffix--" != testSubject.StorageEndpointSuffix { - t.Errorf("Expected StorageEndpointSuffix to be \"--storage-endpoint-suffix--\", but got %q", testSubject.StorageEndpointSuffix) - } - if "--sql-database-dns-suffix--" != testSubject.SQLDatabaseDNSSuffix { - t.Errorf("Expected sql-database-dns-suffix to be \"--sql-database-dns-suffix--\", but got %q", testSubject.SQLDatabaseDNSSuffix) - } - if "--key-vault-dns-suffix--" != testSubject.KeyVaultDNSSuffix { - t.Errorf("Expected StorageEndpointSuffix to be \"--key-vault-dns-suffix--\", but got %q", testSubject.KeyVaultDNSSuffix) - } - if "--service-bus-endpoint-suffix--" != testSubject.ServiceBusEndpointSuffix { - t.Errorf("Expected StorageEndpointSuffix to be \"--service-bus-endpoint-suffix--\", but got %q", testSubject.ServiceBusEndpointSuffix) - } - if "--asm-vm-dns-suffix--" != testSubject.ServiceManagementVMDNSSuffix { - t.Errorf("Expected ServiceManagementVMDNSSuffix to be \"--asm-vm-dns-suffix--\", but got %q", testSubject.ServiceManagementVMDNSSuffix) - } - if "--arm-vm-dns-suffix--" != testSubject.ResourceManagerVMDNSSuffix { - t.Errorf("Expected ResourceManagerVMDNSSuffix to be \"--arm-vm-dns-suffix--\", but got %q", testSubject.ResourceManagerVMDNSSuffix) - } - if "--container-registry-dns-suffix--" != testSubject.ContainerRegistryDNSSuffix { - t.Errorf("Expected ContainerRegistryDNSSuffix to be \"--container-registry-dns-suffix--\", but got %q", testSubject.ContainerRegistryDNSSuffix) - } -} - -func TestRoundTripSerialization(t *testing.T) { - env := Environment{ - Name: "--unit-test--", - ManagementPortalURL: "--management-portal-url", - PublishSettingsURL: "--publish-settings-url--", - ServiceManagementEndpoint: "--service-management-endpoint--", - ResourceManagerEndpoint: "--resource-management-endpoint--", - ActiveDirectoryEndpoint: "--active-directory-endpoint--", - GalleryEndpoint: "--gallery-endpoint--", - KeyVaultEndpoint: "--key-vault--endpoint--", - GraphEndpoint: "--graph-endpoint--", - StorageEndpointSuffix: "--storage-endpoint-suffix--", - SQLDatabaseDNSSuffix: "--sql-database-dns-suffix--", - TrafficManagerDNSSuffix: "--traffic-manager-dns-suffix--", - KeyVaultDNSSuffix: "--key-vault-dns-suffix--", - ServiceBusEndpointSuffix: "--service-bus-endpoint-suffix--", - ServiceManagementVMDNSSuffix: "--asm-vm-dns-suffix--", - ResourceManagerVMDNSSuffix: "--arm-vm-dns-suffix--", - ContainerRegistryDNSSuffix: "--container-registry-dns-suffix--", - } - - bytes, err := json.Marshal(env) - if err != nil { - t.Fatalf("failed to marshal: %s", err) - } - - testSubject := Environment{} - err = json.Unmarshal(bytes, &testSubject) - if err != nil { - t.Fatalf("failed to unmarshal: %s", err) - } - - if env.Name != testSubject.Name { - t.Errorf("Expected Name to be %q, but got %q", env.Name, testSubject.Name) - } - if env.ManagementPortalURL != testSubject.ManagementPortalURL { - t.Errorf("Expected ManagementPortalURL to be %q, but got %q", env.ManagementPortalURL, testSubject.ManagementPortalURL) - } - if env.PublishSettingsURL != testSubject.PublishSettingsURL { - t.Errorf("Expected PublishSettingsURL to be %q, but got %q", env.PublishSettingsURL, testSubject.PublishSettingsURL) - } - if env.ServiceManagementEndpoint != testSubject.ServiceManagementEndpoint { - t.Errorf("Expected ServiceManagementEndpoint to be %q, but got %q", env.ServiceManagementEndpoint, testSubject.ServiceManagementEndpoint) - } - if env.ResourceManagerEndpoint != testSubject.ResourceManagerEndpoint { - t.Errorf("Expected ResourceManagerEndpoint to be %q, but got %q", env.ResourceManagerEndpoint, testSubject.ResourceManagerEndpoint) - } - if env.ActiveDirectoryEndpoint != testSubject.ActiveDirectoryEndpoint { - t.Errorf("Expected ActiveDirectoryEndpoint to be %q, but got %q", env.ActiveDirectoryEndpoint, testSubject.ActiveDirectoryEndpoint) - } - if env.GalleryEndpoint != testSubject.GalleryEndpoint { - t.Errorf("Expected GalleryEndpoint to be %q, but got %q", env.GalleryEndpoint, testSubject.GalleryEndpoint) - } - if env.KeyVaultEndpoint != testSubject.KeyVaultEndpoint { - t.Errorf("Expected KeyVaultEndpoint to be %q, but got %q", env.KeyVaultEndpoint, testSubject.KeyVaultEndpoint) - } - if env.GraphEndpoint != testSubject.GraphEndpoint { - t.Errorf("Expected GraphEndpoint to be %q, but got %q", env.GraphEndpoint, testSubject.GraphEndpoint) - } - if env.StorageEndpointSuffix != testSubject.StorageEndpointSuffix { - t.Errorf("Expected StorageEndpointSuffix to be %q, but got %q", env.StorageEndpointSuffix, testSubject.StorageEndpointSuffix) - } - if env.SQLDatabaseDNSSuffix != testSubject.SQLDatabaseDNSSuffix { - t.Errorf("Expected SQLDatabaseDNSSuffix to be %q, but got %q", env.SQLDatabaseDNSSuffix, testSubject.SQLDatabaseDNSSuffix) - } - if env.TrafficManagerDNSSuffix != testSubject.TrafficManagerDNSSuffix { - t.Errorf("Expected TrafficManagerDNSSuffix to be %q, but got %q", env.TrafficManagerDNSSuffix, testSubject.TrafficManagerDNSSuffix) - } - if env.KeyVaultDNSSuffix != testSubject.KeyVaultDNSSuffix { - t.Errorf("Expected KeyVaultDNSSuffix to be %q, but got %q", env.KeyVaultDNSSuffix, testSubject.KeyVaultDNSSuffix) - } - if env.ServiceBusEndpointSuffix != testSubject.ServiceBusEndpointSuffix { - t.Errorf("Expected ServiceBusEndpointSuffix to be %q, but got %q", env.ServiceBusEndpointSuffix, testSubject.ServiceBusEndpointSuffix) - } - if env.ServiceManagementVMDNSSuffix != testSubject.ServiceManagementVMDNSSuffix { - t.Errorf("Expected ServiceManagementVMDNSSuffix to be %q, but got %q", env.ServiceManagementVMDNSSuffix, testSubject.ServiceManagementVMDNSSuffix) - } - if env.ResourceManagerVMDNSSuffix != testSubject.ResourceManagerVMDNSSuffix { - t.Errorf("Expected ResourceManagerVMDNSSuffix to be %q, but got %q", env.ResourceManagerVMDNSSuffix, testSubject.ResourceManagerVMDNSSuffix) - } - if env.ContainerRegistryDNSSuffix != testSubject.ContainerRegistryDNSSuffix { - t.Errorf("Expected ContainerRegistryDNSSuffix to be %q, but got %q", env.ContainerRegistryDNSSuffix, testSubject.ContainerRegistryDNSSuffix) - } -} +// test +package azure + +import ( + "encoding/json" + "testing" +) + +func TestEnvironmentFromName(t *testing.T) { + name := "azurechinacloud" + if env, _ := EnvironmentFromName(name); env != ChinaCloud { + t.Errorf("Expected to get ChinaCloud for %q", name) + } + + name = "AzureChinaCloud" + if env, _ := EnvironmentFromName(name); env != ChinaCloud { + t.Errorf("Expected to get ChinaCloud for %q", name) + } + + name = "azuregermancloud" + if env, _ := EnvironmentFromName(name); env != GermanCloud { + t.Errorf("Expected to get GermanCloud for %q", name) + } + + name = "AzureGermanCloud" + if env, _ := EnvironmentFromName(name); env != GermanCloud { + t.Errorf("Expected to get GermanCloud for %q", name) + } + + name = "azurepubliccloud" + if env, _ := EnvironmentFromName(name); env != PublicCloud { + t.Errorf("Expected to get PublicCloud for %q", name) + } + + name = "AzurePublicCloud" + if env, _ := EnvironmentFromName(name); env != PublicCloud { + t.Errorf("Expected to get PublicCloud for %q", name) + } + + name = "azureusgovernmentcloud" + if env, _ := EnvironmentFromName(name); env != USGovernmentCloud { + t.Errorf("Expected to get USGovernmentCloud for %q", name) + } + + name = "AzureUSGovernmentCloud" + if env, _ := EnvironmentFromName(name); env != USGovernmentCloud { + t.Errorf("Expected to get USGovernmentCloud for %q", name) + } + + name = "thisisnotarealcloudenv" + if _, err := EnvironmentFromName(name); err == nil { + t.Errorf("Expected to get an error for %q", name) + } +} + +func TestDeserializeEnvironment(t *testing.T) { + env := `{ + "name": "--name--", + "ActiveDirectoryEndpoint": "--active-directory-endpoint--", + "galleryEndpoint": "--gallery-endpoint--", + "graphEndpoint": "--graph-endpoint--", + "keyVaultDNSSuffix": "--key-vault-dns-suffix--", + "keyVaultEndpoint": "--key-vault-endpoint--", + "managementPortalURL": "--management-portal-url--", + "publishSettingsURL": "--publish-settings-url--", + "resourceManagerEndpoint": "--resource-manager-endpoint--", + "serviceBusEndpointSuffix": "--service-bus-endpoint-suffix--", + "serviceManagementEndpoint": "--service-management-endpoint--", + "sqlDatabaseDNSSuffix": "--sql-database-dns-suffix--", + "storageEndpointSuffix": "--storage-endpoint-suffix--", + "trafficManagerDNSSuffix": "--traffic-manager-dns-suffix--", + "serviceManagementVMDNSSuffix": "--asm-vm-dns-suffix--", + "resourceManagerVMDNSSuffix": "--arm-vm-dns-suffix--", + "containerRegistryDNSSuffix": "--container-registry-dns-suffix--" + }` + + testSubject := Environment{} + err := json.Unmarshal([]byte(env), &testSubject) + if err != nil { + t.Fatalf("failed to unmarshal: %s", err) + } + + if "--name--" != testSubject.Name { + t.Errorf("Expected Name to be \"--name--\", but got %q", testSubject.Name) + } + if "--management-portal-url--" != testSubject.ManagementPortalURL { + t.Errorf("Expected ManagementPortalURL to be \"--management-portal-url--\", but got %q", testSubject.ManagementPortalURL) + } + if "--publish-settings-url--" != testSubject.PublishSettingsURL { + t.Errorf("Expected PublishSettingsURL to be \"--publish-settings-url--\", but got %q", testSubject.PublishSettingsURL) + } + if "--service-management-endpoint--" != testSubject.ServiceManagementEndpoint { + t.Errorf("Expected ServiceManagementEndpoint to be \"--service-management-endpoint--\", but got %q", testSubject.ServiceManagementEndpoint) + } + if "--resource-manager-endpoint--" != testSubject.ResourceManagerEndpoint { + t.Errorf("Expected ResourceManagerEndpoint to be \"--resource-manager-endpoint--\", but got %q", testSubject.ResourceManagerEndpoint) + } + if "--active-directory-endpoint--" != testSubject.ActiveDirectoryEndpoint { + t.Errorf("Expected ActiveDirectoryEndpoint to be \"--active-directory-endpoint--\", but got %q", testSubject.ActiveDirectoryEndpoint) + } + if "--gallery-endpoint--" != testSubject.GalleryEndpoint { + t.Errorf("Expected GalleryEndpoint to be \"--gallery-endpoint--\", but got %q", testSubject.GalleryEndpoint) + } + if "--key-vault-endpoint--" != testSubject.KeyVaultEndpoint { + t.Errorf("Expected KeyVaultEndpoint to be \"--key-vault-endpoint--\", but got %q", testSubject.KeyVaultEndpoint) + } + if "--graph-endpoint--" != testSubject.GraphEndpoint { + t.Errorf("Expected GraphEndpoint to be \"--graph-endpoint--\", but got %q", testSubject.GraphEndpoint) + } + if "--storage-endpoint-suffix--" != testSubject.StorageEndpointSuffix { + t.Errorf("Expected StorageEndpointSuffix to be \"--storage-endpoint-suffix--\", but got %q", testSubject.StorageEndpointSuffix) + } + if "--sql-database-dns-suffix--" != testSubject.SQLDatabaseDNSSuffix { + t.Errorf("Expected sql-database-dns-suffix to be \"--sql-database-dns-suffix--\", but got %q", testSubject.SQLDatabaseDNSSuffix) + } + if "--key-vault-dns-suffix--" != testSubject.KeyVaultDNSSuffix { + t.Errorf("Expected StorageEndpointSuffix to be \"--key-vault-dns-suffix--\", but got %q", testSubject.KeyVaultDNSSuffix) + } + if "--service-bus-endpoint-suffix--" != testSubject.ServiceBusEndpointSuffix { + t.Errorf("Expected StorageEndpointSuffix to be \"--service-bus-endpoint-suffix--\", but got %q", testSubject.ServiceBusEndpointSuffix) + } + if "--asm-vm-dns-suffix--" != testSubject.ServiceManagementVMDNSSuffix { + t.Errorf("Expected ServiceManagementVMDNSSuffix to be \"--asm-vm-dns-suffix--\", but got %q", testSubject.ServiceManagementVMDNSSuffix) + } + if "--arm-vm-dns-suffix--" != testSubject.ResourceManagerVMDNSSuffix { + t.Errorf("Expected ResourceManagerVMDNSSuffix to be \"--arm-vm-dns-suffix--\", but got %q", testSubject.ResourceManagerVMDNSSuffix) + } + if "--container-registry-dns-suffix--" != testSubject.ContainerRegistryDNSSuffix { + t.Errorf("Expected ContainerRegistryDNSSuffix to be \"--container-registry-dns-suffix--\", but got %q", testSubject.ContainerRegistryDNSSuffix) + } +} + +func TestRoundTripSerialization(t *testing.T) { + env := Environment{ + Name: "--unit-test--", + ManagementPortalURL: "--management-portal-url", + PublishSettingsURL: "--publish-settings-url--", + ServiceManagementEndpoint: "--service-management-endpoint--", + ResourceManagerEndpoint: "--resource-management-endpoint--", + ActiveDirectoryEndpoint: "--active-directory-endpoint--", + GalleryEndpoint: "--gallery-endpoint--", + KeyVaultEndpoint: "--key-vault--endpoint--", + GraphEndpoint: "--graph-endpoint--", + StorageEndpointSuffix: "--storage-endpoint-suffix--", + SQLDatabaseDNSSuffix: "--sql-database-dns-suffix--", + TrafficManagerDNSSuffix: "--traffic-manager-dns-suffix--", + KeyVaultDNSSuffix: "--key-vault-dns-suffix--", + ServiceBusEndpointSuffix: "--service-bus-endpoint-suffix--", + ServiceManagementVMDNSSuffix: "--asm-vm-dns-suffix--", + ResourceManagerVMDNSSuffix: "--arm-vm-dns-suffix--", + ContainerRegistryDNSSuffix: "--container-registry-dns-suffix--", + } + + bytes, err := json.Marshal(env) + if err != nil { + t.Fatalf("failed to marshal: %s", err) + } + + testSubject := Environment{} + err = json.Unmarshal(bytes, &testSubject) + if err != nil { + t.Fatalf("failed to unmarshal: %s", err) + } + + if env.Name != testSubject.Name { + t.Errorf("Expected Name to be %q, but got %q", env.Name, testSubject.Name) + } + if env.ManagementPortalURL != testSubject.ManagementPortalURL { + t.Errorf("Expected ManagementPortalURL to be %q, but got %q", env.ManagementPortalURL, testSubject.ManagementPortalURL) + } + if env.PublishSettingsURL != testSubject.PublishSettingsURL { + t.Errorf("Expected PublishSettingsURL to be %q, but got %q", env.PublishSettingsURL, testSubject.PublishSettingsURL) + } + if env.ServiceManagementEndpoint != testSubject.ServiceManagementEndpoint { + t.Errorf("Expected ServiceManagementEndpoint to be %q, but got %q", env.ServiceManagementEndpoint, testSubject.ServiceManagementEndpoint) + } + if env.ResourceManagerEndpoint != testSubject.ResourceManagerEndpoint { + t.Errorf("Expected ResourceManagerEndpoint to be %q, but got %q", env.ResourceManagerEndpoint, testSubject.ResourceManagerEndpoint) + } + if env.ActiveDirectoryEndpoint != testSubject.ActiveDirectoryEndpoint { + t.Errorf("Expected ActiveDirectoryEndpoint to be %q, but got %q", env.ActiveDirectoryEndpoint, testSubject.ActiveDirectoryEndpoint) + } + if env.GalleryEndpoint != testSubject.GalleryEndpoint { + t.Errorf("Expected GalleryEndpoint to be %q, but got %q", env.GalleryEndpoint, testSubject.GalleryEndpoint) + } + if env.KeyVaultEndpoint != testSubject.KeyVaultEndpoint { + t.Errorf("Expected KeyVaultEndpoint to be %q, but got %q", env.KeyVaultEndpoint, testSubject.KeyVaultEndpoint) + } + if env.GraphEndpoint != testSubject.GraphEndpoint { + t.Errorf("Expected GraphEndpoint to be %q, but got %q", env.GraphEndpoint, testSubject.GraphEndpoint) + } + if env.StorageEndpointSuffix != testSubject.StorageEndpointSuffix { + t.Errorf("Expected StorageEndpointSuffix to be %q, but got %q", env.StorageEndpointSuffix, testSubject.StorageEndpointSuffix) + } + if env.SQLDatabaseDNSSuffix != testSubject.SQLDatabaseDNSSuffix { + t.Errorf("Expected SQLDatabaseDNSSuffix to be %q, but got %q", env.SQLDatabaseDNSSuffix, testSubject.SQLDatabaseDNSSuffix) + } + if env.TrafficManagerDNSSuffix != testSubject.TrafficManagerDNSSuffix { + t.Errorf("Expected TrafficManagerDNSSuffix to be %q, but got %q", env.TrafficManagerDNSSuffix, testSubject.TrafficManagerDNSSuffix) + } + if env.KeyVaultDNSSuffix != testSubject.KeyVaultDNSSuffix { + t.Errorf("Expected KeyVaultDNSSuffix to be %q, but got %q", env.KeyVaultDNSSuffix, testSubject.KeyVaultDNSSuffix) + } + if env.ServiceBusEndpointSuffix != testSubject.ServiceBusEndpointSuffix { + t.Errorf("Expected ServiceBusEndpointSuffix to be %q, but got %q", env.ServiceBusEndpointSuffix, testSubject.ServiceBusEndpointSuffix) + } + if env.ServiceManagementVMDNSSuffix != testSubject.ServiceManagementVMDNSSuffix { + t.Errorf("Expected ServiceManagementVMDNSSuffix to be %q, but got %q", env.ServiceManagementVMDNSSuffix, testSubject.ServiceManagementVMDNSSuffix) + } + if env.ResourceManagerVMDNSSuffix != testSubject.ResourceManagerVMDNSSuffix { + t.Errorf("Expected ResourceManagerVMDNSSuffix to be %q, but got %q", env.ResourceManagerVMDNSSuffix, testSubject.ResourceManagerVMDNSSuffix) + } + if env.ContainerRegistryDNSSuffix != testSubject.ContainerRegistryDNSSuffix { + t.Errorf("Expected ContainerRegistryDNSSuffix to be %q, but got %q", env.ContainerRegistryDNSSuffix, testSubject.ContainerRegistryDNSSuffix) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/example/README.md b/vendor/github.com/Azure/go-autorest/autorest/azure/example/README.md index 81734a76ac..b87e173fa0 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/example/README.md +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/example/README.md @@ -1,127 +1,127 @@ -# autorest azure example - -## Usage (device mode) - -This shows how to use the example for device auth. - -1. Execute this. It will save your token to /tmp/azure-example-token: - - ``` - ./example -tenantId "13de0a15-b5db-44b9-b682-b4ba82afbd29" -subscriptionId "aff271ee-e9be-4441-b9bb-42f5af4cbaeb" -mode "device" -tokenCachePath "/tmp/azure-example-token" - ``` - -2. Execute it again, it will load the token from cache and not prompt for auth again. - -## Usage (certificate mode) - -This example covers how to make an authenticated call to the Azure Resource Manager APIs, using certificate-based authentication. - -0. Export some required variables - - ``` - export SUBSCRIPTION_ID="aff271ee-e9be-4441-b9bb-42f5af4cbaeb" - export TENANT_ID="13de0a15-b5db-44b9-b682-b4ba82afbd29" - export RESOURCE_GROUP="someresourcegroup" - ``` - - * replace both values with your own - -1. Create a private key - - ``` - openssl genrsa -out "example.key" 2048 - ``` - - - -2. Create the certificate - - ``` - openssl req -new -key "example.key" -subj "/CN=example" -out "example.csr" - - openssl x509 -req -in "example.csr" -signkey "example.key" -out "example.crt" -days 10000 - ``` - - - -3. Create the PKCS12 version of the certificate (with no password) - - ``` - openssl pkcs12 -export -out "example.pfx" -inkey "example.key" -in "example.crt" -passout pass: - ``` - - - -4. Register a new Azure AD Application with the certificate contents - - ``` - certificateContents="$(tail -n+2 "example.key" | head -n-1)" - - azure ad app create \ - --name "example-azuread-app" \ - --home-page="http://example-azuread-app/home" \ - --identifier-uris "http://example-azuread-app/app" \ - --key-usage "Verify" \ - --end-date "2020-01-01" \ - --key-value "${certificateContents}" - ``` - - - -5. Create a new service principal using the "Application Id" from the previous step - - ``` - azure ad sp create "APPLICATION_ID" - ``` - - * Replace APPLICATION_ID with the "Application Id" returned in step 4 - - - -6. Grant your service principal necessary permissions - - ``` - azure role assignment create \ - --resource-group "${RESOURCE_GROUP}" \ - --roleName "Contributor" \ - --subscription "${SUBSCRIPTION_ID}" \ - --spn "http://example-azuread-app/app" - ``` - - * Replace SUBSCRIPTION_ID with your subscription id - * Replace RESOURCE_GROUP with the resource group for the assignment - * Ensure that the `spn` parameter matches an `identifier-url` from Step 4 - - - -7. Run this example app to see your resource groups - - ``` - go run main.go \ - --tenantId="${TENANT_ID}" \ - --subscriptionId="${SUBSCRIPTION_ID}" \ - --applicationId="http://example-azuread-app/app" \ - --certificatePath="certificate.pfx" - ``` - - -You should see something like this as output: - -``` -2015/11/08 18:28:39 Using these settings: -2015/11/08 18:28:39 * certificatePath: certificate.pfx -2015/11/08 18:28:39 * applicationID: http://example-azuread-app/app -2015/11/08 18:28:39 * tenantID: 13de0a15-b5db-44b9-b682-b4ba82afbd29 -2015/11/08 18:28:39 * subscriptionID: aff271ee-e9be-4441-b9bb-42f5af4cbaeb -2015/11/08 18:28:39 loading certificate... -2015/11/08 18:28:39 retrieve oauth token... -2015/11/08 18:28:39 querying the list of resource groups... -2015/11/08 18:28:50 -2015/11/08 18:28:50 Groups: {"value":[{"id":"/subscriptions/aff271ee-e9be-4441-b9bb-42f5af4cbaeb/resourceGroups/kube-66f30810","name":"kube-66f30810","location":"westus","tags":{},"properties":{"provisioningState":"Succeeded"}}]} -``` - - - -## Notes - -You may need to wait sometime between executing step 4, step 5 and step 6. If you issue those requests too quickly, you might hit an AD server that is not consistent with the server where the resource was created. +# autorest azure example + +## Usage (device mode) + +This shows how to use the example for device auth. + +1. Execute this. It will save your token to /tmp/azure-example-token: + + ``` + ./example -tenantId "13de0a15-b5db-44b9-b682-b4ba82afbd29" -subscriptionId "aff271ee-e9be-4441-b9bb-42f5af4cbaeb" -mode "device" -tokenCachePath "/tmp/azure-example-token" + ``` + +2. Execute it again, it will load the token from cache and not prompt for auth again. + +## Usage (certificate mode) + +This example covers how to make an authenticated call to the Azure Resource Manager APIs, using certificate-based authentication. + +0. Export some required variables + + ``` + export SUBSCRIPTION_ID="aff271ee-e9be-4441-b9bb-42f5af4cbaeb" + export TENANT_ID="13de0a15-b5db-44b9-b682-b4ba82afbd29" + export RESOURCE_GROUP="someresourcegroup" + ``` + + * replace both values with your own + +1. Create a private key + + ``` + openssl genrsa -out "example.key" 2048 + ``` + + + +2. Create the certificate + + ``` + openssl req -new -key "example.key" -subj "/CN=example" -out "example.csr" + + openssl x509 -req -in "example.csr" -signkey "example.key" -out "example.crt" -days 10000 + ``` + + + +3. Create the PKCS12 version of the certificate (with no password) + + ``` + openssl pkcs12 -export -out "example.pfx" -inkey "example.key" -in "example.crt" -passout pass: + ``` + + + +4. Register a new Azure AD Application with the certificate contents + + ``` + certificateContents="$(tail -n+2 "example.key" | head -n-1)" + + azure ad app create \ + --name "example-azuread-app" \ + --home-page="http://example-azuread-app/home" \ + --identifier-uris "http://example-azuread-app/app" \ + --key-usage "Verify" \ + --end-date "2020-01-01" \ + --key-value "${certificateContents}" + ``` + + + +5. Create a new service principal using the "Application Id" from the previous step + + ``` + azure ad sp create "APPLICATION_ID" + ``` + + * Replace APPLICATION_ID with the "Application Id" returned in step 4 + + + +6. Grant your service principal necessary permissions + + ``` + azure role assignment create \ + --resource-group "${RESOURCE_GROUP}" \ + --roleName "Contributor" \ + --subscription "${SUBSCRIPTION_ID}" \ + --spn "http://example-azuread-app/app" + ``` + + * Replace SUBSCRIPTION_ID with your subscription id + * Replace RESOURCE_GROUP with the resource group for the assignment + * Ensure that the `spn` parameter matches an `identifier-url` from Step 4 + + + +7. Run this example app to see your resource groups + + ``` + go run main.go \ + --tenantId="${TENANT_ID}" \ + --subscriptionId="${SUBSCRIPTION_ID}" \ + --applicationId="http://example-azuread-app/app" \ + --certificatePath="certificate.pfx" + ``` + + +You should see something like this as output: + +``` +2015/11/08 18:28:39 Using these settings: +2015/11/08 18:28:39 * certificatePath: certificate.pfx +2015/11/08 18:28:39 * applicationID: http://example-azuread-app/app +2015/11/08 18:28:39 * tenantID: 13de0a15-b5db-44b9-b682-b4ba82afbd29 +2015/11/08 18:28:39 * subscriptionID: aff271ee-e9be-4441-b9bb-42f5af4cbaeb +2015/11/08 18:28:39 loading certificate... +2015/11/08 18:28:39 retrieve oauth token... +2015/11/08 18:28:39 querying the list of resource groups... +2015/11/08 18:28:50 +2015/11/08 18:28:50 Groups: {"value":[{"id":"/subscriptions/aff271ee-e9be-4441-b9bb-42f5af4cbaeb/resourceGroups/kube-66f30810","name":"kube-66f30810","location":"westus","tags":{},"properties":{"provisioningState":"Succeeded"}}]} +``` + + + +## Notes + +You may need to wait sometime between executing step 4, step 5 and step 6. If you issue those requests too quickly, you might hit an AD server that is not consistent with the server where the resource was created. diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/example/main.go b/vendor/github.com/Azure/go-autorest/autorest/azure/example/main.go index 483a90b0e1..f39b0a0dfb 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/example/main.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/example/main.go @@ -1,258 +1,258 @@ -package main - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/json" - "flag" - "fmt" - "io/ioutil" - "log" - "net/http" - "strings" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/adal" - "github.com/Azure/go-autorest/autorest/azure" - "golang.org/x/crypto/pkcs12" -) - -const ( - resourceGroupURLTemplate = "https://management.azure.com" - apiVersion = "2015-01-01" - nativeAppClientID = "a87032a7-203c-4bf7-913c-44c50d23409a" - resource = "https://management.core.windows.net/" -) - -var ( - mode string - tenantID string - subscriptionID string - applicationID string - - tokenCachePath string - forceRefresh bool - impatient bool - - certificatePath string -) - -func init() { - flag.StringVar(&mode, "mode", "device", "mode of operation for SPT creation") - flag.StringVar(&certificatePath, "certificatePath", "", "path to pk12/pfx certificate") - flag.StringVar(&applicationID, "applicationId", "", "application id") - flag.StringVar(&tenantID, "tenantId", "", "tenant id") - flag.StringVar(&subscriptionID, "subscriptionId", "", "subscription id") - flag.StringVar(&tokenCachePath, "tokenCachePath", "", "location of oauth token cache") - flag.BoolVar(&forceRefresh, "forceRefresh", false, "pass true to force a token refresh") - - flag.Parse() - - log.Printf("mode(%s) certPath(%s) appID(%s) tenantID(%s), subID(%s)\n", - mode, certificatePath, applicationID, tenantID, subscriptionID) - - if mode == "certificate" && - (strings.TrimSpace(tenantID) == "" || strings.TrimSpace(subscriptionID) == "") { - log.Fatalln("Bad usage. Using certificate mode. Please specify tenantID, subscriptionID") - } - - if mode != "certificate" && mode != "device" { - log.Fatalln("Bad usage. Mode must be one of 'certificate' or 'device'.") - } - - if mode == "device" && strings.TrimSpace(applicationID) == "" { - log.Println("Using device mode auth. Will use `azkube` clientID since none was specified on the comand line.") - applicationID = nativeAppClientID - } - - if mode == "certificate" && strings.TrimSpace(certificatePath) == "" { - log.Fatalln("Bad usage. Mode 'certificate' requires the 'certificatePath' argument.") - } - - if strings.TrimSpace(tenantID) == "" || strings.TrimSpace(subscriptionID) == "" || strings.TrimSpace(applicationID) == "" { - log.Fatalln("Bad usage. Must specify the 'tenantId' and 'subscriptionId'") - } -} - -func getSptFromCachedToken(oauthConfig adal.OAuthConfig, clientID, resource string, callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - token, err := adal.LoadToken(tokenCachePath) - if err != nil { - return nil, fmt.Errorf("failed to load token from cache: %v", err) - } - - spt, _ := adal.NewServicePrincipalTokenFromManualToken( - oauthConfig, - clientID, - resource, - *token, - callbacks...) - - return spt, nil -} - -func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { - privateKey, certificate, err := pkcs12.Decode(pkcs, password) - if err != nil { - return nil, nil, err - } - - rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey) - if !isRsaKey { - return nil, nil, fmt.Errorf("PKCS#12 certificate must contain an RSA private key") - } - - return certificate, rsaPrivateKey, nil -} - -func getSptFromCertificate(oauthConfig adal.OAuthConfig, clientID, resource, certicatePath string, callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - certData, err := ioutil.ReadFile(certificatePath) - if err != nil { - return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) - } - - certificate, rsaPrivateKey, err := decodePkcs12(certData, "") - if err != nil { - return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) - } - - spt, _ := adal.NewServicePrincipalTokenFromCertificate( - oauthConfig, - clientID, - certificate, - rsaPrivateKey, - resource, - callbacks...) - - return spt, nil -} - -func getSptFromDeviceFlow(oauthConfig adal.OAuthConfig, clientID, resource string, callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { - oauthClient := &autorest.Client{} - deviceCode, err := adal.InitiateDeviceAuth(oauthClient, oauthConfig, clientID, resource) - if err != nil { - return nil, fmt.Errorf("failed to start device auth flow: %s", err) - } - - fmt.Println(*deviceCode.Message) - - token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) - if err != nil { - return nil, fmt.Errorf("failed to finish device auth flow: %s", err) - } - - spt, err := adal.NewServicePrincipalTokenFromManualToken( - oauthConfig, - clientID, - resource, - *token, - callbacks...) - if err != nil { - return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err) - } - - return spt, nil -} - -func printResourceGroups(client *autorest.Client) error { - p := map[string]interface{}{"subscription-id": subscriptionID} - q := map[string]interface{}{"api-version": apiVersion} - - req, _ := autorest.Prepare(&http.Request{}, - autorest.AsGet(), - autorest.WithBaseURL(resourceGroupURLTemplate), - autorest.WithPathParameters("/subscriptions/{subscription-id}/resourcegroups", p), - autorest.WithQueryParameters(q)) - - resp, err := autorest.SendWithSender(client, req) - if err != nil { - return err - } - - value := struct { - ResourceGroups []struct { - Name string `json:"name"` - } `json:"value"` - }{} - - defer resp.Body.Close() - dec := json.NewDecoder(resp.Body) - err = dec.Decode(&value) - if err != nil { - return err - } - - var groupNames = make([]string, len(value.ResourceGroups)) - for i, name := range value.ResourceGroups { - groupNames[i] = name.Name - } - - log.Println("Groups:", strings.Join(groupNames, ", ")) - return err -} - -func saveToken(spt adal.Token) { - if tokenCachePath != "" { - err := adal.SaveToken(tokenCachePath, 0600, spt) - if err != nil { - log.Println("error saving token", err) - } else { - log.Println("saved token to", tokenCachePath) - } - } -} - -func main() { - var spt *adal.ServicePrincipalToken - var err error - - callback := func(t adal.Token) error { - log.Println("refresh callback was called") - saveToken(t) - return nil - } - - oauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, tenantID) - if err != nil { - panic(err) - } - - if tokenCachePath != "" { - log.Println("tokenCachePath specified; attempting to load from", tokenCachePath) - spt, err = getSptFromCachedToken(*oauthConfig, applicationID, resource, callback) - if err != nil { - spt = nil // just in case, this is the condition below - log.Println("loading from cache failed:", err) - } - } - - if spt == nil { - log.Println("authenticating via 'mode'", mode) - switch mode { - case "device": - spt, err = getSptFromDeviceFlow(*oauthConfig, applicationID, resource, callback) - case "certificate": - spt, err = getSptFromCertificate(*oauthConfig, applicationID, resource, certificatePath, callback) - } - if err != nil { - log.Fatalln("failed to retrieve token:", err) - } - - // should save it as soon as you get it since Refresh won't be called for some time - if tokenCachePath != "" { - saveToken(spt.Token) - } - } - - client := &autorest.Client{} - client.Authorizer = autorest.NewBearerAuthorizer(spt) - - printResourceGroups(client) - - if forceRefresh { - err = spt.Refresh() - if err != nil { - panic(err) - } - printResourceGroups(client) - } -} +package main + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "net/http" + "strings" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/adal" + "github.com/Azure/go-autorest/autorest/azure" + "golang.org/x/crypto/pkcs12" +) + +const ( + resourceGroupURLTemplate = "https://management.azure.com" + apiVersion = "2015-01-01" + nativeAppClientID = "a87032a7-203c-4bf7-913c-44c50d23409a" + resource = "https://management.core.windows.net/" +) + +var ( + mode string + tenantID string + subscriptionID string + applicationID string + + tokenCachePath string + forceRefresh bool + impatient bool + + certificatePath string +) + +func init() { + flag.StringVar(&mode, "mode", "device", "mode of operation for SPT creation") + flag.StringVar(&certificatePath, "certificatePath", "", "path to pk12/pfx certificate") + flag.StringVar(&applicationID, "applicationId", "", "application id") + flag.StringVar(&tenantID, "tenantId", "", "tenant id") + flag.StringVar(&subscriptionID, "subscriptionId", "", "subscription id") + flag.StringVar(&tokenCachePath, "tokenCachePath", "", "location of oauth token cache") + flag.BoolVar(&forceRefresh, "forceRefresh", false, "pass true to force a token refresh") + + flag.Parse() + + log.Printf("mode(%s) certPath(%s) appID(%s) tenantID(%s), subID(%s)\n", + mode, certificatePath, applicationID, tenantID, subscriptionID) + + if mode == "certificate" && + (strings.TrimSpace(tenantID) == "" || strings.TrimSpace(subscriptionID) == "") { + log.Fatalln("Bad usage. Using certificate mode. Please specify tenantID, subscriptionID") + } + + if mode != "certificate" && mode != "device" { + log.Fatalln("Bad usage. Mode must be one of 'certificate' or 'device'.") + } + + if mode == "device" && strings.TrimSpace(applicationID) == "" { + log.Println("Using device mode auth. Will use `azkube` clientID since none was specified on the comand line.") + applicationID = nativeAppClientID + } + + if mode == "certificate" && strings.TrimSpace(certificatePath) == "" { + log.Fatalln("Bad usage. Mode 'certificate' requires the 'certificatePath' argument.") + } + + if strings.TrimSpace(tenantID) == "" || strings.TrimSpace(subscriptionID) == "" || strings.TrimSpace(applicationID) == "" { + log.Fatalln("Bad usage. Must specify the 'tenantId' and 'subscriptionId'") + } +} + +func getSptFromCachedToken(oauthConfig adal.OAuthConfig, clientID, resource string, callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + token, err := adal.LoadToken(tokenCachePath) + if err != nil { + return nil, fmt.Errorf("failed to load token from cache: %v", err) + } + + spt, _ := adal.NewServicePrincipalTokenFromManualToken( + oauthConfig, + clientID, + resource, + *token, + callbacks...) + + return spt, nil +} + +func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { + privateKey, certificate, err := pkcs12.Decode(pkcs, password) + if err != nil { + return nil, nil, err + } + + rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey) + if !isRsaKey { + return nil, nil, fmt.Errorf("PKCS#12 certificate must contain an RSA private key") + } + + return certificate, rsaPrivateKey, nil +} + +func getSptFromCertificate(oauthConfig adal.OAuthConfig, clientID, resource, certicatePath string, callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + certData, err := ioutil.ReadFile(certificatePath) + if err != nil { + return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) + } + + certificate, rsaPrivateKey, err := decodePkcs12(certData, "") + if err != nil { + return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) + } + + spt, _ := adal.NewServicePrincipalTokenFromCertificate( + oauthConfig, + clientID, + certificate, + rsaPrivateKey, + resource, + callbacks...) + + return spt, nil +} + +func getSptFromDeviceFlow(oauthConfig adal.OAuthConfig, clientID, resource string, callbacks ...adal.TokenRefreshCallback) (*adal.ServicePrincipalToken, error) { + oauthClient := &autorest.Client{} + deviceCode, err := adal.InitiateDeviceAuth(oauthClient, oauthConfig, clientID, resource) + if err != nil { + return nil, fmt.Errorf("failed to start device auth flow: %s", err) + } + + fmt.Println(*deviceCode.Message) + + token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) + if err != nil { + return nil, fmt.Errorf("failed to finish device auth flow: %s", err) + } + + spt, err := adal.NewServicePrincipalTokenFromManualToken( + oauthConfig, + clientID, + resource, + *token, + callbacks...) + if err != nil { + return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err) + } + + return spt, nil +} + +func printResourceGroups(client *autorest.Client) error { + p := map[string]interface{}{"subscription-id": subscriptionID} + q := map[string]interface{}{"api-version": apiVersion} + + req, _ := autorest.Prepare(&http.Request{}, + autorest.AsGet(), + autorest.WithBaseURL(resourceGroupURLTemplate), + autorest.WithPathParameters("/subscriptions/{subscription-id}/resourcegroups", p), + autorest.WithQueryParameters(q)) + + resp, err := autorest.SendWithSender(client, req) + if err != nil { + return err + } + + value := struct { + ResourceGroups []struct { + Name string `json:"name"` + } `json:"value"` + }{} + + defer resp.Body.Close() + dec := json.NewDecoder(resp.Body) + err = dec.Decode(&value) + if err != nil { + return err + } + + var groupNames = make([]string, len(value.ResourceGroups)) + for i, name := range value.ResourceGroups { + groupNames[i] = name.Name + } + + log.Println("Groups:", strings.Join(groupNames, ", ")) + return err +} + +func saveToken(spt adal.Token) { + if tokenCachePath != "" { + err := adal.SaveToken(tokenCachePath, 0600, spt) + if err != nil { + log.Println("error saving token", err) + } else { + log.Println("saved token to", tokenCachePath) + } + } +} + +func main() { + var spt *adal.ServicePrincipalToken + var err error + + callback := func(t adal.Token) error { + log.Println("refresh callback was called") + saveToken(t) + return nil + } + + oauthConfig, err := adal.NewOAuthConfig(azure.PublicCloud.ActiveDirectoryEndpoint, tenantID) + if err != nil { + panic(err) + } + + if tokenCachePath != "" { + log.Println("tokenCachePath specified; attempting to load from", tokenCachePath) + spt, err = getSptFromCachedToken(*oauthConfig, applicationID, resource, callback) + if err != nil { + spt = nil // just in case, this is the condition below + log.Println("loading from cache failed:", err) + } + } + + if spt == nil { + log.Println("authenticating via 'mode'", mode) + switch mode { + case "device": + spt, err = getSptFromDeviceFlow(*oauthConfig, applicationID, resource, callback) + case "certificate": + spt, err = getSptFromCertificate(*oauthConfig, applicationID, resource, certificatePath, callback) + } + if err != nil { + log.Fatalln("failed to retrieve token:", err) + } + + // should save it as soon as you get it since Refresh won't be called for some time + if tokenCachePath != "" { + saveToken(spt.Token) + } + } + + client := &autorest.Client{} + client.Authorizer = autorest.NewBearerAuthorizer(spt) + + printResourceGroups(client) + + if forceRefresh { + err = spt.Refresh() + if err != nil { + panic(err) + } + printResourceGroups(client) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/client.go b/vendor/github.com/Azure/go-autorest/autorest/client.go index 9510fb689f..b5f94b5c3c 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/client.go +++ b/vendor/github.com/Azure/go-autorest/autorest/client.go @@ -1,235 +1,235 @@ -package autorest - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "net/http/cookiejar" - "runtime" - "time" -) - -const ( - // DefaultPollingDelay is a reasonable delay between polling requests. - DefaultPollingDelay = 60 * time.Second - - // DefaultPollingDuration is a reasonable total polling duration. - DefaultPollingDuration = 15 * time.Minute - - // DefaultRetryAttempts is number of attempts for retry status codes (5xx). - DefaultRetryAttempts = 3 -) - -var ( - // defaultUserAgent builds a string containing the Go version, system archityecture and OS, - // and the go-autorest version. - defaultUserAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s", - runtime.Version(), - runtime.GOARCH, - runtime.GOOS, - Version(), - ) - - statusCodesForRetry = []int{ - http.StatusRequestTimeout, // 408 - http.StatusInternalServerError, // 500 - http.StatusBadGateway, // 502 - http.StatusServiceUnavailable, // 503 - http.StatusGatewayTimeout, // 504 - } -) - -const ( - requestFormat = `HTTP Request Begin =================================================== -%s -===================================================== HTTP Request End -` - responseFormat = `HTTP Response Begin =================================================== -%s -===================================================== HTTP Response End -` -) - -// Response serves as the base for all responses from generated clients. It provides access to the -// last http.Response. -type Response struct { - *http.Response `json:"-"` -} - -// LoggingInspector implements request and response inspectors that log the full request and -// response to a supplied log. -type LoggingInspector struct { - Logger *log.Logger -} - -// WithInspection returns a PrepareDecorator that emits the http.Request to the supplied logger. The -// body is restored after being emitted. -// -// Note: Since it reads the entire Body, this decorator should not be used where body streaming is -// important. It is best used to trace JSON or similar body values. -func (li LoggingInspector) WithInspection() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - var body, b bytes.Buffer - - defer r.Body.Close() - - r.Body = ioutil.NopCloser(io.TeeReader(r.Body, &body)) - if err := r.Write(&b); err != nil { - return nil, fmt.Errorf("Failed to write response: %v", err) - } - - li.Logger.Printf(requestFormat, b.String()) - - r.Body = ioutil.NopCloser(&body) - return p.Prepare(r) - }) - } -} - -// ByInspecting returns a RespondDecorator that emits the http.Response to the supplied logger. The -// body is restored after being emitted. -// -// Note: Since it reads the entire Body, this decorator should not be used where body streaming is -// important. It is best used to trace JSON or similar body values. -func (li LoggingInspector) ByInspecting() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - var body, b bytes.Buffer - defer resp.Body.Close() - resp.Body = ioutil.NopCloser(io.TeeReader(resp.Body, &body)) - if err := resp.Write(&b); err != nil { - return fmt.Errorf("Failed to write response: %v", err) - } - - li.Logger.Printf(responseFormat, b.String()) - - resp.Body = ioutil.NopCloser(&body) - return r.Respond(resp) - }) - } -} - -// Client is the base for autorest generated clients. It provides default, "do nothing" -// implementations of an Authorizer, RequestInspector, and ResponseInspector. It also returns the -// standard, undecorated http.Client as a default Sender. -// -// Generated clients should also use Error (see NewError and NewErrorWithError) for errors and -// return responses that compose with Response. -// -// Most customization of generated clients is best achieved by supplying a custom Authorizer, custom -// RequestInspector, and / or custom ResponseInspector. Users may log requests, implement circuit -// breakers (see https://msdn.microsoft.com/en-us/library/dn589784.aspx) or otherwise influence -// sending the request by providing a decorated Sender. -type Client struct { - Authorizer Authorizer - Sender Sender - RequestInspector PrepareDecorator - ResponseInspector RespondDecorator - - // PollingDelay sets the polling frequency used in absence of a Retry-After HTTP header - PollingDelay time.Duration - - // PollingDuration sets the maximum polling time after which an error is returned. - PollingDuration time.Duration - - // RetryAttempts sets the default number of retry attempts for client. - RetryAttempts int - - // RetryDuration sets the delay duration for retries. - RetryDuration time.Duration - - // UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent - // through the Do method. - UserAgent string - - Jar http.CookieJar -} - -// NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed -// string. -func NewClientWithUserAgent(ua string) Client { - c := Client{ - PollingDelay: DefaultPollingDelay, - PollingDuration: DefaultPollingDuration, - RetryAttempts: DefaultRetryAttempts, - RetryDuration: 30 * time.Second, - UserAgent: defaultUserAgent, - } - c.AddToUserAgent(ua) - return c -} - -// AddToUserAgent adds an extension to the current user agent -func (c *Client) AddToUserAgent(extension string) error { - if extension != "" { - c.UserAgent = fmt.Sprintf("%s %s", c.UserAgent, extension) - return nil - } - return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.UserAgent) -} - -// Do implements the Sender interface by invoking the active Sender after applying authorization. -// If Sender is not set, it uses a new instance of http.Client. In both cases it will, if UserAgent -// is set, apply set the User-Agent header. -func (c Client) Do(r *http.Request) (*http.Response, error) { - if r.UserAgent() == "" { - r, _ = Prepare(r, - WithUserAgent(c.UserAgent)) - } - r, err := Prepare(r, - c.WithInspection(), - c.WithAuthorization()) - if err != nil { - return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed") - } - resp, err := SendWithSender(c.sender(), r, - DoRetryForStatusCodes(c.RetryAttempts, c.RetryDuration, statusCodesForRetry...)) - Respond(resp, - c.ByInspecting()) - return resp, err -} - -// sender returns the Sender to which to send requests. -func (c Client) sender() Sender { - if c.Sender == nil { - j, _ := cookiejar.New(nil) - return &http.Client{Jar: j} - } - return c.Sender -} - -// WithAuthorization is a convenience method that returns the WithAuthorization PrepareDecorator -// from the current Authorizer. If not Authorizer is set, it uses the NullAuthorizer. -func (c Client) WithAuthorization() PrepareDecorator { - return c.authorizer().WithAuthorization() -} - -// authorizer returns the Authorizer to use. -func (c Client) authorizer() Authorizer { - if c.Authorizer == nil { - return NullAuthorizer{} - } - return c.Authorizer -} - -// WithInspection is a convenience method that passes the request to the supplied RequestInspector, -// if present, or returns the WithNothing PrepareDecorator otherwise. -func (c Client) WithInspection() PrepareDecorator { - if c.RequestInspector == nil { - return WithNothing() - } - return c.RequestInspector -} - -// ByInspecting is a convenience method that passes the response to the supplied ResponseInspector, -// if present, or returns the ByIgnoring RespondDecorator otherwise. -func (c Client) ByInspecting() RespondDecorator { - if c.ResponseInspector == nil { - return ByIgnoring() - } - return c.ResponseInspector -} +package autorest + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "log" + "net/http" + "net/http/cookiejar" + "runtime" + "time" +) + +const ( + // DefaultPollingDelay is a reasonable delay between polling requests. + DefaultPollingDelay = 60 * time.Second + + // DefaultPollingDuration is a reasonable total polling duration. + DefaultPollingDuration = 15 * time.Minute + + // DefaultRetryAttempts is number of attempts for retry status codes (5xx). + DefaultRetryAttempts = 3 +) + +var ( + // defaultUserAgent builds a string containing the Go version, system archityecture and OS, + // and the go-autorest version. + defaultUserAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s", + runtime.Version(), + runtime.GOARCH, + runtime.GOOS, + Version(), + ) + + statusCodesForRetry = []int{ + http.StatusRequestTimeout, // 408 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + } +) + +const ( + requestFormat = `HTTP Request Begin =================================================== +%s +===================================================== HTTP Request End +` + responseFormat = `HTTP Response Begin =================================================== +%s +===================================================== HTTP Response End +` +) + +// Response serves as the base for all responses from generated clients. It provides access to the +// last http.Response. +type Response struct { + *http.Response `json:"-"` +} + +// LoggingInspector implements request and response inspectors that log the full request and +// response to a supplied log. +type LoggingInspector struct { + Logger *log.Logger +} + +// WithInspection returns a PrepareDecorator that emits the http.Request to the supplied logger. The +// body is restored after being emitted. +// +// Note: Since it reads the entire Body, this decorator should not be used where body streaming is +// important. It is best used to trace JSON or similar body values. +func (li LoggingInspector) WithInspection() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + var body, b bytes.Buffer + + defer r.Body.Close() + + r.Body = ioutil.NopCloser(io.TeeReader(r.Body, &body)) + if err := r.Write(&b); err != nil { + return nil, fmt.Errorf("Failed to write response: %v", err) + } + + li.Logger.Printf(requestFormat, b.String()) + + r.Body = ioutil.NopCloser(&body) + return p.Prepare(r) + }) + } +} + +// ByInspecting returns a RespondDecorator that emits the http.Response to the supplied logger. The +// body is restored after being emitted. +// +// Note: Since it reads the entire Body, this decorator should not be used where body streaming is +// important. It is best used to trace JSON or similar body values. +func (li LoggingInspector) ByInspecting() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + var body, b bytes.Buffer + defer resp.Body.Close() + resp.Body = ioutil.NopCloser(io.TeeReader(resp.Body, &body)) + if err := resp.Write(&b); err != nil { + return fmt.Errorf("Failed to write response: %v", err) + } + + li.Logger.Printf(responseFormat, b.String()) + + resp.Body = ioutil.NopCloser(&body) + return r.Respond(resp) + }) + } +} + +// Client is the base for autorest generated clients. It provides default, "do nothing" +// implementations of an Authorizer, RequestInspector, and ResponseInspector. It also returns the +// standard, undecorated http.Client as a default Sender. +// +// Generated clients should also use Error (see NewError and NewErrorWithError) for errors and +// return responses that compose with Response. +// +// Most customization of generated clients is best achieved by supplying a custom Authorizer, custom +// RequestInspector, and / or custom ResponseInspector. Users may log requests, implement circuit +// breakers (see https://msdn.microsoft.com/en-us/library/dn589784.aspx) or otherwise influence +// sending the request by providing a decorated Sender. +type Client struct { + Authorizer Authorizer + Sender Sender + RequestInspector PrepareDecorator + ResponseInspector RespondDecorator + + // PollingDelay sets the polling frequency used in absence of a Retry-After HTTP header + PollingDelay time.Duration + + // PollingDuration sets the maximum polling time after which an error is returned. + PollingDuration time.Duration + + // RetryAttempts sets the default number of retry attempts for client. + RetryAttempts int + + // RetryDuration sets the delay duration for retries. + RetryDuration time.Duration + + // UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent + // through the Do method. + UserAgent string + + Jar http.CookieJar +} + +// NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed +// string. +func NewClientWithUserAgent(ua string) Client { + c := Client{ + PollingDelay: DefaultPollingDelay, + PollingDuration: DefaultPollingDuration, + RetryAttempts: DefaultRetryAttempts, + RetryDuration: 30 * time.Second, + UserAgent: defaultUserAgent, + } + c.AddToUserAgent(ua) + return c +} + +// AddToUserAgent adds an extension to the current user agent +func (c *Client) AddToUserAgent(extension string) error { + if extension != "" { + c.UserAgent = fmt.Sprintf("%s %s", c.UserAgent, extension) + return nil + } + return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.UserAgent) +} + +// Do implements the Sender interface by invoking the active Sender after applying authorization. +// If Sender is not set, it uses a new instance of http.Client. In both cases it will, if UserAgent +// is set, apply set the User-Agent header. +func (c Client) Do(r *http.Request) (*http.Response, error) { + if r.UserAgent() == "" { + r, _ = Prepare(r, + WithUserAgent(c.UserAgent)) + } + r, err := Prepare(r, + c.WithInspection(), + c.WithAuthorization()) + if err != nil { + return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed") + } + resp, err := SendWithSender(c.sender(), r, + DoRetryForStatusCodes(c.RetryAttempts, c.RetryDuration, statusCodesForRetry...)) + Respond(resp, + c.ByInspecting()) + return resp, err +} + +// sender returns the Sender to which to send requests. +func (c Client) sender() Sender { + if c.Sender == nil { + j, _ := cookiejar.New(nil) + return &http.Client{Jar: j} + } + return c.Sender +} + +// WithAuthorization is a convenience method that returns the WithAuthorization PrepareDecorator +// from the current Authorizer. If not Authorizer is set, it uses the NullAuthorizer. +func (c Client) WithAuthorization() PrepareDecorator { + return c.authorizer().WithAuthorization() +} + +// authorizer returns the Authorizer to use. +func (c Client) authorizer() Authorizer { + if c.Authorizer == nil { + return NullAuthorizer{} + } + return c.Authorizer +} + +// WithInspection is a convenience method that passes the request to the supplied RequestInspector, +// if present, or returns the WithNothing PrepareDecorator otherwise. +func (c Client) WithInspection() PrepareDecorator { + if c.RequestInspector == nil { + return WithNothing() + } + return c.RequestInspector +} + +// ByInspecting is a convenience method that passes the response to the supplied ResponseInspector, +// if present, or returns the ByIgnoring RespondDecorator otherwise. +func (c Client) ByInspecting() RespondDecorator { + if c.ResponseInspector == nil { + return ByIgnoring() + } + return c.ResponseInspector +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/client_test.go b/vendor/github.com/Azure/go-autorest/autorest/client_test.go index 59564d1e27..78a8a59baf 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/client_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/client_test.go @@ -1,342 +1,342 @@ -package autorest - -import ( - "bytes" - "fmt" - "io/ioutil" - "log" - "math/rand" - "net/http" - "reflect" - "testing" - "time" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -func TestLoggingInspectorWithInspection(t *testing.T) { - b := bytes.Buffer{} - c := Client{} - li := LoggingInspector{Logger: log.New(&b, "", 0)} - c.RequestInspector = li.WithInspection() - - Prepare(mocks.NewRequestWithContent("Content"), - c.WithInspection()) - - if len(b.String()) <= 0 { - t.Fatal("autorest: LoggingInspector#WithInspection did not record Request to the log") - } -} - -func TestLoggingInspectorWithInspectionEmitsErrors(t *testing.T) { - b := bytes.Buffer{} - c := Client{} - r := mocks.NewRequestWithContent("Content") - li := LoggingInspector{Logger: log.New(&b, "", 0)} - c.RequestInspector = li.WithInspection() - - if _, err := Prepare(r, - c.WithInspection()); err != nil { - t.Error(err) - } - - if len(b.String()) <= 0 { - t.Fatal("autorest: LoggingInspector#WithInspection did not record Request to the log") - } -} - -func TestLoggingInspectorWithInspectionRestoresBody(t *testing.T) { - b := bytes.Buffer{} - c := Client{} - r := mocks.NewRequestWithContent("Content") - li := LoggingInspector{Logger: log.New(&b, "", 0)} - c.RequestInspector = li.WithInspection() - - Prepare(r, - c.WithInspection()) - - s, _ := ioutil.ReadAll(r.Body) - if len(s) <= 0 { - t.Fatal("autorest: LoggingInspector#WithInspection did not restore the Request body") - } -} - -func TestLoggingInspectorByInspecting(t *testing.T) { - b := bytes.Buffer{} - c := Client{} - li := LoggingInspector{Logger: log.New(&b, "", 0)} - c.ResponseInspector = li.ByInspecting() - - Respond(mocks.NewResponseWithContent("Content"), - c.ByInspecting()) - - if len(b.String()) <= 0 { - t.Fatal("autorest: LoggingInspector#ByInspection did not record Response to the log") - } -} - -func TestLoggingInspectorByInspectingEmitsErrors(t *testing.T) { - b := bytes.Buffer{} - c := Client{} - r := mocks.NewResponseWithContent("Content") - li := LoggingInspector{Logger: log.New(&b, "", 0)} - c.ResponseInspector = li.ByInspecting() - - if err := Respond(r, - c.ByInspecting()); err != nil { - t.Fatal(err) - } - - if len(b.String()) <= 0 { - t.Fatal("autorest: LoggingInspector#ByInspection did not record Response to the log") - } -} - -func TestLoggingInspectorByInspectingRestoresBody(t *testing.T) { - b := bytes.Buffer{} - c := Client{} - r := mocks.NewResponseWithContent("Content") - li := LoggingInspector{Logger: log.New(&b, "", 0)} - c.ResponseInspector = li.ByInspecting() - - Respond(r, - c.ByInspecting()) - - s, _ := ioutil.ReadAll(r.Body) - if len(s) <= 0 { - t.Fatal("autorest: LoggingInspector#ByInspecting did not restore the Response body") - } -} - -func TestNewClientWithUserAgent(t *testing.T) { - ua := "UserAgent" - c := NewClientWithUserAgent(ua) - completeUA := fmt.Sprintf("%s %s", defaultUserAgent, ua) - - if c.UserAgent != completeUA { - t.Fatalf("autorest: NewClientWithUserAgent failed to set the UserAgent -- expected %s, received %s", - completeUA, c.UserAgent) - } -} - -func TestAddToUserAgent(t *testing.T) { - ua := "UserAgent" - c := NewClientWithUserAgent(ua) - ext := "extension" - err := c.AddToUserAgent(ext) - if err != nil { - t.Fatalf("autorest: AddToUserAgent returned error -- expected nil, received %s", err) - } - completeUA := fmt.Sprintf("%s %s %s", defaultUserAgent, ua, ext) - - if c.UserAgent != completeUA { - t.Fatalf("autorest: AddToUserAgent failed to add an extension to the UserAgent -- expected %s, received %s", - completeUA, c.UserAgent) - } - - err = c.AddToUserAgent("") - if err == nil { - t.Fatalf("autorest: AddToUserAgent didn't return error -- expected %s, received nil", - fmt.Errorf("Extension was empty, User Agent stayed as %s", c.UserAgent)) - } - if c.UserAgent != completeUA { - t.Fatalf("autorest: AddToUserAgent failed to not add an empty extension to the UserAgent -- expected %s, received %s", - completeUA, c.UserAgent) - } -} - -func TestClientSenderReturnsHttpClientByDefault(t *testing.T) { - c := Client{} - - if fmt.Sprintf("%T", c.sender()) != "*http.Client" { - t.Fatal("autorest: Client#sender failed to return http.Client by default") - } -} - -func TestClientSenderReturnsSetSender(t *testing.T) { - c := Client{} - - s := mocks.NewSender() - c.Sender = s - - if c.sender() != s { - t.Fatal("autorest: Client#sender failed to return set Sender") - } -} - -func TestClientDoInvokesSender(t *testing.T) { - c := Client{} - - s := mocks.NewSender() - c.Sender = s - - c.Do(&http.Request{}) - if s.Attempts() != 1 { - t.Fatal("autorest: Client#Do failed to invoke the Sender") - } -} - -func TestClientDoSetsUserAgent(t *testing.T) { - ua := "UserAgent" - c := Client{UserAgent: ua} - r := mocks.NewRequest() - s := mocks.NewSender() - c.Sender = s - - c.Do(r) - - if r.UserAgent() != ua { - t.Fatalf("autorest: Client#Do failed to correctly set User-Agent header: %s=%s", - http.CanonicalHeaderKey(headerUserAgent), r.UserAgent()) - } -} - -func TestClientDoSetsAuthorization(t *testing.T) { - r := mocks.NewRequest() - s := mocks.NewSender() - c := Client{Authorizer: mockAuthorizer{}, Sender: s} - - c.Do(r) - if len(r.Header.Get(http.CanonicalHeaderKey(headerAuthorization))) <= 0 { - t.Fatalf("autorest: Client#Send failed to set Authorization header -- %s=%s", - http.CanonicalHeaderKey(headerAuthorization), - r.Header.Get(http.CanonicalHeaderKey(headerAuthorization))) - } -} - -func TestClientDoInvokesRequestInspector(t *testing.T) { - r := mocks.NewRequest() - s := mocks.NewSender() - i := &mockInspector{} - c := Client{RequestInspector: i.WithInspection(), Sender: s} - - c.Do(r) - if !i.wasInvoked { - t.Fatal("autorest: Client#Send failed to invoke the RequestInspector") - } -} - -func TestClientDoInvokesResponseInspector(t *testing.T) { - r := mocks.NewRequest() - s := mocks.NewSender() - i := &mockInspector{} - c := Client{ResponseInspector: i.ByInspecting(), Sender: s} - - c.Do(r) - if !i.wasInvoked { - t.Fatal("autorest: Client#Send failed to invoke the ResponseInspector") - } -} - -func TestClientDoReturnsErrorIfPrepareFails(t *testing.T) { - c := Client{} - s := mocks.NewSender() - c.Authorizer = mockFailingAuthorizer{} - c.Sender = s - - _, err := c.Do(&http.Request{}) - if err == nil { - t.Fatalf("autorest: Client#Do failed to return an error when Prepare failed") - } -} - -func TestClientDoDoesNotSendIfPrepareFails(t *testing.T) { - c := Client{} - s := mocks.NewSender() - c.Authorizer = mockFailingAuthorizer{} - c.Sender = s - - c.Do(&http.Request{}) - if s.Attempts() > 0 { - t.Fatal("autorest: Client#Do failed to invoke the Sender") - } -} - -func TestClientAuthorizerReturnsNullAuthorizerByDefault(t *testing.T) { - c := Client{} - - if fmt.Sprintf("%T", c.authorizer()) != "autorest.NullAuthorizer" { - t.Fatal("autorest: Client#authorizer failed to return the NullAuthorizer by default") - } -} - -func TestClientAuthorizerReturnsSetAuthorizer(t *testing.T) { - c := Client{} - c.Authorizer = mockAuthorizer{} - - if fmt.Sprintf("%T", c.authorizer()) != "autorest.mockAuthorizer" { - t.Fatal("autorest: Client#authorizer failed to return the set Authorizer") - } -} - -func TestClientWithAuthorizer(t *testing.T) { - c := Client{} - c.Authorizer = mockAuthorizer{} - - req, _ := Prepare(&http.Request{}, - c.WithAuthorization()) - - if req.Header.Get(headerAuthorization) == "" { - t.Fatal("autorest: Client#WithAuthorizer failed to return the WithAuthorizer from the active Authorizer") - } -} - -func TestClientWithInspection(t *testing.T) { - c := Client{} - r := &mockInspector{} - c.RequestInspector = r.WithInspection() - - Prepare(&http.Request{}, - c.WithInspection()) - - if !r.wasInvoked { - t.Fatal("autorest: Client#WithInspection failed to invoke RequestInspector") - } -} - -func TestClientWithInspectionSetsDefault(t *testing.T) { - c := Client{} - - r1 := &http.Request{} - r2, _ := Prepare(r1, - c.WithInspection()) - - if !reflect.DeepEqual(r1, r2) { - t.Fatal("autorest: Client#WithInspection failed to provide a default RequestInspector") - } -} - -func TestClientByInspecting(t *testing.T) { - c := Client{} - r := &mockInspector{} - c.ResponseInspector = r.ByInspecting() - - Respond(&http.Response{}, - c.ByInspecting()) - - if !r.wasInvoked { - t.Fatal("autorest: Client#ByInspecting failed to invoke ResponseInspector") - } -} - -func TestClientByInspectingSetsDefault(t *testing.T) { - c := Client{} - - r := &http.Response{} - Respond(r, - c.ByInspecting()) - - if !reflect.DeepEqual(r, &http.Response{}) { - t.Fatal("autorest: Client#ByInspecting failed to provide a default ResponseInspector") - } -} - -func randomString(n int) string { - const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" - r := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) - s := make([]byte, n) - for i := range s { - s[i] = chars[r.Intn(len(chars))] - } - return string(s) -} +package autorest + +import ( + "bytes" + "fmt" + "io/ioutil" + "log" + "math/rand" + "net/http" + "reflect" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +func TestLoggingInspectorWithInspection(t *testing.T) { + b := bytes.Buffer{} + c := Client{} + li := LoggingInspector{Logger: log.New(&b, "", 0)} + c.RequestInspector = li.WithInspection() + + Prepare(mocks.NewRequestWithContent("Content"), + c.WithInspection()) + + if len(b.String()) <= 0 { + t.Fatal("autorest: LoggingInspector#WithInspection did not record Request to the log") + } +} + +func TestLoggingInspectorWithInspectionEmitsErrors(t *testing.T) { + b := bytes.Buffer{} + c := Client{} + r := mocks.NewRequestWithContent("Content") + li := LoggingInspector{Logger: log.New(&b, "", 0)} + c.RequestInspector = li.WithInspection() + + if _, err := Prepare(r, + c.WithInspection()); err != nil { + t.Error(err) + } + + if len(b.String()) <= 0 { + t.Fatal("autorest: LoggingInspector#WithInspection did not record Request to the log") + } +} + +func TestLoggingInspectorWithInspectionRestoresBody(t *testing.T) { + b := bytes.Buffer{} + c := Client{} + r := mocks.NewRequestWithContent("Content") + li := LoggingInspector{Logger: log.New(&b, "", 0)} + c.RequestInspector = li.WithInspection() + + Prepare(r, + c.WithInspection()) + + s, _ := ioutil.ReadAll(r.Body) + if len(s) <= 0 { + t.Fatal("autorest: LoggingInspector#WithInspection did not restore the Request body") + } +} + +func TestLoggingInspectorByInspecting(t *testing.T) { + b := bytes.Buffer{} + c := Client{} + li := LoggingInspector{Logger: log.New(&b, "", 0)} + c.ResponseInspector = li.ByInspecting() + + Respond(mocks.NewResponseWithContent("Content"), + c.ByInspecting()) + + if len(b.String()) <= 0 { + t.Fatal("autorest: LoggingInspector#ByInspection did not record Response to the log") + } +} + +func TestLoggingInspectorByInspectingEmitsErrors(t *testing.T) { + b := bytes.Buffer{} + c := Client{} + r := mocks.NewResponseWithContent("Content") + li := LoggingInspector{Logger: log.New(&b, "", 0)} + c.ResponseInspector = li.ByInspecting() + + if err := Respond(r, + c.ByInspecting()); err != nil { + t.Fatal(err) + } + + if len(b.String()) <= 0 { + t.Fatal("autorest: LoggingInspector#ByInspection did not record Response to the log") + } +} + +func TestLoggingInspectorByInspectingRestoresBody(t *testing.T) { + b := bytes.Buffer{} + c := Client{} + r := mocks.NewResponseWithContent("Content") + li := LoggingInspector{Logger: log.New(&b, "", 0)} + c.ResponseInspector = li.ByInspecting() + + Respond(r, + c.ByInspecting()) + + s, _ := ioutil.ReadAll(r.Body) + if len(s) <= 0 { + t.Fatal("autorest: LoggingInspector#ByInspecting did not restore the Response body") + } +} + +func TestNewClientWithUserAgent(t *testing.T) { + ua := "UserAgent" + c := NewClientWithUserAgent(ua) + completeUA := fmt.Sprintf("%s %s", defaultUserAgent, ua) + + if c.UserAgent != completeUA { + t.Fatalf("autorest: NewClientWithUserAgent failed to set the UserAgent -- expected %s, received %s", + completeUA, c.UserAgent) + } +} + +func TestAddToUserAgent(t *testing.T) { + ua := "UserAgent" + c := NewClientWithUserAgent(ua) + ext := "extension" + err := c.AddToUserAgent(ext) + if err != nil { + t.Fatalf("autorest: AddToUserAgent returned error -- expected nil, received %s", err) + } + completeUA := fmt.Sprintf("%s %s %s", defaultUserAgent, ua, ext) + + if c.UserAgent != completeUA { + t.Fatalf("autorest: AddToUserAgent failed to add an extension to the UserAgent -- expected %s, received %s", + completeUA, c.UserAgent) + } + + err = c.AddToUserAgent("") + if err == nil { + t.Fatalf("autorest: AddToUserAgent didn't return error -- expected %s, received nil", + fmt.Errorf("Extension was empty, User Agent stayed as %s", c.UserAgent)) + } + if c.UserAgent != completeUA { + t.Fatalf("autorest: AddToUserAgent failed to not add an empty extension to the UserAgent -- expected %s, received %s", + completeUA, c.UserAgent) + } +} + +func TestClientSenderReturnsHttpClientByDefault(t *testing.T) { + c := Client{} + + if fmt.Sprintf("%T", c.sender()) != "*http.Client" { + t.Fatal("autorest: Client#sender failed to return http.Client by default") + } +} + +func TestClientSenderReturnsSetSender(t *testing.T) { + c := Client{} + + s := mocks.NewSender() + c.Sender = s + + if c.sender() != s { + t.Fatal("autorest: Client#sender failed to return set Sender") + } +} + +func TestClientDoInvokesSender(t *testing.T) { + c := Client{} + + s := mocks.NewSender() + c.Sender = s + + c.Do(&http.Request{}) + if s.Attempts() != 1 { + t.Fatal("autorest: Client#Do failed to invoke the Sender") + } +} + +func TestClientDoSetsUserAgent(t *testing.T) { + ua := "UserAgent" + c := Client{UserAgent: ua} + r := mocks.NewRequest() + s := mocks.NewSender() + c.Sender = s + + c.Do(r) + + if r.UserAgent() != ua { + t.Fatalf("autorest: Client#Do failed to correctly set User-Agent header: %s=%s", + http.CanonicalHeaderKey(headerUserAgent), r.UserAgent()) + } +} + +func TestClientDoSetsAuthorization(t *testing.T) { + r := mocks.NewRequest() + s := mocks.NewSender() + c := Client{Authorizer: mockAuthorizer{}, Sender: s} + + c.Do(r) + if len(r.Header.Get(http.CanonicalHeaderKey(headerAuthorization))) <= 0 { + t.Fatalf("autorest: Client#Send failed to set Authorization header -- %s=%s", + http.CanonicalHeaderKey(headerAuthorization), + r.Header.Get(http.CanonicalHeaderKey(headerAuthorization))) + } +} + +func TestClientDoInvokesRequestInspector(t *testing.T) { + r := mocks.NewRequest() + s := mocks.NewSender() + i := &mockInspector{} + c := Client{RequestInspector: i.WithInspection(), Sender: s} + + c.Do(r) + if !i.wasInvoked { + t.Fatal("autorest: Client#Send failed to invoke the RequestInspector") + } +} + +func TestClientDoInvokesResponseInspector(t *testing.T) { + r := mocks.NewRequest() + s := mocks.NewSender() + i := &mockInspector{} + c := Client{ResponseInspector: i.ByInspecting(), Sender: s} + + c.Do(r) + if !i.wasInvoked { + t.Fatal("autorest: Client#Send failed to invoke the ResponseInspector") + } +} + +func TestClientDoReturnsErrorIfPrepareFails(t *testing.T) { + c := Client{} + s := mocks.NewSender() + c.Authorizer = mockFailingAuthorizer{} + c.Sender = s + + _, err := c.Do(&http.Request{}) + if err == nil { + t.Fatalf("autorest: Client#Do failed to return an error when Prepare failed") + } +} + +func TestClientDoDoesNotSendIfPrepareFails(t *testing.T) { + c := Client{} + s := mocks.NewSender() + c.Authorizer = mockFailingAuthorizer{} + c.Sender = s + + c.Do(&http.Request{}) + if s.Attempts() > 0 { + t.Fatal("autorest: Client#Do failed to invoke the Sender") + } +} + +func TestClientAuthorizerReturnsNullAuthorizerByDefault(t *testing.T) { + c := Client{} + + if fmt.Sprintf("%T", c.authorizer()) != "autorest.NullAuthorizer" { + t.Fatal("autorest: Client#authorizer failed to return the NullAuthorizer by default") + } +} + +func TestClientAuthorizerReturnsSetAuthorizer(t *testing.T) { + c := Client{} + c.Authorizer = mockAuthorizer{} + + if fmt.Sprintf("%T", c.authorizer()) != "autorest.mockAuthorizer" { + t.Fatal("autorest: Client#authorizer failed to return the set Authorizer") + } +} + +func TestClientWithAuthorizer(t *testing.T) { + c := Client{} + c.Authorizer = mockAuthorizer{} + + req, _ := Prepare(&http.Request{}, + c.WithAuthorization()) + + if req.Header.Get(headerAuthorization) == "" { + t.Fatal("autorest: Client#WithAuthorizer failed to return the WithAuthorizer from the active Authorizer") + } +} + +func TestClientWithInspection(t *testing.T) { + c := Client{} + r := &mockInspector{} + c.RequestInspector = r.WithInspection() + + Prepare(&http.Request{}, + c.WithInspection()) + + if !r.wasInvoked { + t.Fatal("autorest: Client#WithInspection failed to invoke RequestInspector") + } +} + +func TestClientWithInspectionSetsDefault(t *testing.T) { + c := Client{} + + r1 := &http.Request{} + r2, _ := Prepare(r1, + c.WithInspection()) + + if !reflect.DeepEqual(r1, r2) { + t.Fatal("autorest: Client#WithInspection failed to provide a default RequestInspector") + } +} + +func TestClientByInspecting(t *testing.T) { + c := Client{} + r := &mockInspector{} + c.ResponseInspector = r.ByInspecting() + + Respond(&http.Response{}, + c.ByInspecting()) + + if !r.wasInvoked { + t.Fatal("autorest: Client#ByInspecting failed to invoke ResponseInspector") + } +} + +func TestClientByInspectingSetsDefault(t *testing.T) { + c := Client{} + + r := &http.Response{} + Respond(r, + c.ByInspecting()) + + if !reflect.DeepEqual(r, &http.Response{}) { + t.Fatal("autorest: Client#ByInspecting failed to provide a default ResponseInspector") + } +} + +func randomString(n int) string { + const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + r := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) + s := make([]byte, n) + for i := range s { + s[i] = chars[r.Intn(len(chars))] + } + return string(s) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/date.go b/vendor/github.com/Azure/go-autorest/autorest/date/date.go index 4340d2932c..80ca60e9b0 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/date.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/date.go @@ -1,82 +1,82 @@ -/* -Package date provides time.Time derivatives that conform to the Swagger.io (https://swagger.io/) -defined date formats: Date and DateTime. Both types may, in most cases, be used in lieu of -time.Time types. And both convert to time.Time through a ToTime method. -*/ -package date - -import ( - "fmt" - "time" -) - -const ( - fullDate = "2006-01-02" - fullDateJSON = `"2006-01-02"` - dateFormat = "%04d-%02d-%02d" - jsonFormat = `"%04d-%02d-%02d"` -) - -// Date defines a type similar to time.Time but assumes a layout of RFC3339 full-date (i.e., -// 2006-01-02). -type Date struct { - time.Time -} - -// ParseDate create a new Date from the passed string. -func ParseDate(date string) (d Date, err error) { - return parseDate(date, fullDate) -} - -func parseDate(date string, format string) (Date, error) { - d, err := time.Parse(format, date) - return Date{Time: d}, err -} - -// MarshalBinary preserves the Date as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d Date) MarshalBinary() ([]byte, error) { - return d.MarshalText() -} - -// UnmarshalBinary reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d *Date) UnmarshalBinary(data []byte) error { - return d.UnmarshalText(data) -} - -// MarshalJSON preserves the Date as a JSON string conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d Date) MarshalJSON() (json []byte, err error) { - return []byte(fmt.Sprintf(jsonFormat, d.Year(), d.Month(), d.Day())), nil -} - -// UnmarshalJSON reconstitutes the Date from a JSON string conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d *Date) UnmarshalJSON(data []byte) (err error) { - d.Time, err = time.Parse(fullDateJSON, string(data)) - return err -} - -// MarshalText preserves the Date as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d Date) MarshalText() (text []byte, err error) { - return []byte(fmt.Sprintf(dateFormat, d.Year(), d.Month(), d.Day())), nil -} - -// UnmarshalText reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., -// 2006-01-02). -func (d *Date) UnmarshalText(data []byte) (err error) { - d.Time, err = time.Parse(fullDate, string(data)) - return err -} - -// String returns the Date formatted as an RFC3339 full-date string (i.e., 2006-01-02). -func (d Date) String() string { - return fmt.Sprintf(dateFormat, d.Year(), d.Month(), d.Day()) -} - -// ToTime returns a Date as a time.Time -func (d Date) ToTime() time.Time { - return d.Time -} +/* +Package date provides time.Time derivatives that conform to the Swagger.io (https://swagger.io/) +defined date formats: Date and DateTime. Both types may, in most cases, be used in lieu of +time.Time types. And both convert to time.Time through a ToTime method. +*/ +package date + +import ( + "fmt" + "time" +) + +const ( + fullDate = "2006-01-02" + fullDateJSON = `"2006-01-02"` + dateFormat = "%04d-%02d-%02d" + jsonFormat = `"%04d-%02d-%02d"` +) + +// Date defines a type similar to time.Time but assumes a layout of RFC3339 full-date (i.e., +// 2006-01-02). +type Date struct { + time.Time +} + +// ParseDate create a new Date from the passed string. +func ParseDate(date string) (d Date, err error) { + return parseDate(date, fullDate) +} + +func parseDate(date string, format string) (Date, error) { + d, err := time.Parse(format, date) + return Date{Time: d}, err +} + +// MarshalBinary preserves the Date as a byte array conforming to RFC3339 full-date (i.e., +// 2006-01-02). +func (d Date) MarshalBinary() ([]byte, error) { + return d.MarshalText() +} + +// UnmarshalBinary reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., +// 2006-01-02). +func (d *Date) UnmarshalBinary(data []byte) error { + return d.UnmarshalText(data) +} + +// MarshalJSON preserves the Date as a JSON string conforming to RFC3339 full-date (i.e., +// 2006-01-02). +func (d Date) MarshalJSON() (json []byte, err error) { + return []byte(fmt.Sprintf(jsonFormat, d.Year(), d.Month(), d.Day())), nil +} + +// UnmarshalJSON reconstitutes the Date from a JSON string conforming to RFC3339 full-date (i.e., +// 2006-01-02). +func (d *Date) UnmarshalJSON(data []byte) (err error) { + d.Time, err = time.Parse(fullDateJSON, string(data)) + return err +} + +// MarshalText preserves the Date as a byte array conforming to RFC3339 full-date (i.e., +// 2006-01-02). +func (d Date) MarshalText() (text []byte, err error) { + return []byte(fmt.Sprintf(dateFormat, d.Year(), d.Month(), d.Day())), nil +} + +// UnmarshalText reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., +// 2006-01-02). +func (d *Date) UnmarshalText(data []byte) (err error) { + d.Time, err = time.Parse(fullDate, string(data)) + return err +} + +// String returns the Date formatted as an RFC3339 full-date string (i.e., 2006-01-02). +func (d Date) String() string { + return fmt.Sprintf(dateFormat, d.Year(), d.Month(), d.Day()) +} + +// ToTime returns a Date as a time.Time +func (d Date) ToTime() time.Time { + return d.Time +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/date_test.go b/vendor/github.com/Azure/go-autorest/autorest/date/date_test.go index 4c9b3fc9cc..622f1f7efb 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/date_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/date_test.go @@ -1,223 +1,223 @@ -package date - -import ( - "encoding/json" - "fmt" - "reflect" - "testing" - "time" -) - -func ExampleParseDate() { - d, err := ParseDate("2001-02-03") - if err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: 2001-02-03 -} - -func ExampleDate() { - d, err := ParseDate("2001-02-03") - if err != nil { - fmt.Println(err) - } - - t, err := time.Parse(time.RFC3339, "2001-02-04T00:00:00Z") - if err != nil { - fmt.Println(err) - } - - // Date acts as time.Time when the receiver - if d.Before(t) { - fmt.Printf("Before ") - } else { - fmt.Printf("After ") - } - - // Convert Date when needing a time.Time - if t.After(d.ToTime()) { - fmt.Printf("After") - } else { - fmt.Printf("Before") - } - // Output: Before After -} - -func ExampleDate_MarshalBinary() { - d, err := ParseDate("2001-02-03") - if err != nil { - fmt.Println(err) - } - t, err := d.MarshalBinary() - if err != nil { - fmt.Println(err) - } - fmt.Println(string(t)) - // Output: 2001-02-03 -} - -func ExampleDate_UnmarshalBinary() { - d := Date{} - t := "2001-02-03" - - if err := d.UnmarshalBinary([]byte(t)); err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: 2001-02-03 -} - -func ExampleDate_MarshalJSON() { - d, err := ParseDate("2001-02-03") - if err != nil { - fmt.Println(err) - } - j, err := json.Marshal(d) - if err != nil { - fmt.Println(err) - } - fmt.Println(string(j)) - // Output: "2001-02-03" -} - -func ExampleDate_UnmarshalJSON() { - var d struct { - Date Date `json:"date"` - } - j := `{"date" : "2001-02-03"}` - - if err := json.Unmarshal([]byte(j), &d); err != nil { - fmt.Println(err) - } - fmt.Println(d.Date) - // Output: 2001-02-03 -} - -func ExampleDate_MarshalText() { - d, err := ParseDate("2001-02-03") - if err != nil { - fmt.Println(err) - } - t, err := d.MarshalText() - if err != nil { - fmt.Println(err) - } - fmt.Println(string(t)) - // Output: 2001-02-03 -} - -func ExampleDate_UnmarshalText() { - d := Date{} - t := "2001-02-03" - - if err := d.UnmarshalText([]byte(t)); err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: 2001-02-03 -} - -func TestDateString(t *testing.T) { - d, err := ParseDate("2001-02-03") - if err != nil { - t.Fatalf("date: String failed (%v)", err) - } - if d.String() != "2001-02-03" { - t.Fatalf("date: String failed (%v)", d.String()) - } -} - -func TestDateBinaryRoundTrip(t *testing.T) { - d1, err := ParseDate("2001-02-03") - if err != nil { - t.Fatalf("date: ParseDate failed (%v)", err) - } - t1, err := d1.MarshalBinary() - if err != nil { - t.Fatalf("date: MarshalBinary failed (%v)", err) - } - - d2 := Date{} - if err = d2.UnmarshalBinary(t1); err != nil { - t.Fatalf("date: UnmarshalBinary failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip Binary failed (%v, %v)", d1, d2) - } -} - -func TestDateJSONRoundTrip(t *testing.T) { - type s struct { - Date Date `json:"date"` - } - var err error - d1 := s{} - d1.Date, err = ParseDate("2001-02-03") - if err != nil { - t.Fatalf("date: ParseDate failed (%v)", err) - } - - j, err := json.Marshal(d1) - if err != nil { - t.Fatalf("date: MarshalJSON failed (%v)", err) - } - - d2 := s{} - if err = json.Unmarshal(j, &d2); err != nil { - t.Fatalf("date: UnmarshalJSON failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip JSON failed (%v, %v)", d1, d2) - } -} - -func TestDateTextRoundTrip(t *testing.T) { - d1, err := ParseDate("2001-02-03") - if err != nil { - t.Fatalf("date: ParseDate failed (%v)", err) - } - t1, err := d1.MarshalText() - if err != nil { - t.Fatalf("date: MarshalText failed (%v)", err) - } - d2 := Date{} - if err = d2.UnmarshalText(t1); err != nil { - t.Fatalf("date: UnmarshalText failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip Text failed (%v, %v)", d1, d2) - } -} - -func TestDateToTime(t *testing.T) { - var d Date - d, err := ParseDate("2001-02-03") - if err != nil { - t.Fatalf("date: ParseDate failed (%v)", err) - } - var _ time.Time = d.ToTime() -} - -func TestDateUnmarshalJSONReturnsError(t *testing.T) { - var d struct { - Date Date `json:"date"` - } - j := `{"date" : "February 3, 2001"}` - - if err := json.Unmarshal([]byte(j), &d); err == nil { - t.Fatal("date: Date failed to return error for malformed JSON date") - } -} - -func TestDateUnmarshalTextReturnsError(t *testing.T) { - d := Date{} - txt := "February 3, 2001" - - if err := d.UnmarshalText([]byte(txt)); err == nil { - t.Fatal("date: Date failed to return error for malformed Text date") - } -} +package date + +import ( + "encoding/json" + "fmt" + "reflect" + "testing" + "time" +) + +func ExampleParseDate() { + d, err := ParseDate("2001-02-03") + if err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: 2001-02-03 +} + +func ExampleDate() { + d, err := ParseDate("2001-02-03") + if err != nil { + fmt.Println(err) + } + + t, err := time.Parse(time.RFC3339, "2001-02-04T00:00:00Z") + if err != nil { + fmt.Println(err) + } + + // Date acts as time.Time when the receiver + if d.Before(t) { + fmt.Printf("Before ") + } else { + fmt.Printf("After ") + } + + // Convert Date when needing a time.Time + if t.After(d.ToTime()) { + fmt.Printf("After") + } else { + fmt.Printf("Before") + } + // Output: Before After +} + +func ExampleDate_MarshalBinary() { + d, err := ParseDate("2001-02-03") + if err != nil { + fmt.Println(err) + } + t, err := d.MarshalBinary() + if err != nil { + fmt.Println(err) + } + fmt.Println(string(t)) + // Output: 2001-02-03 +} + +func ExampleDate_UnmarshalBinary() { + d := Date{} + t := "2001-02-03" + + if err := d.UnmarshalBinary([]byte(t)); err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: 2001-02-03 +} + +func ExampleDate_MarshalJSON() { + d, err := ParseDate("2001-02-03") + if err != nil { + fmt.Println(err) + } + j, err := json.Marshal(d) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(j)) + // Output: "2001-02-03" +} + +func ExampleDate_UnmarshalJSON() { + var d struct { + Date Date `json:"date"` + } + j := `{"date" : "2001-02-03"}` + + if err := json.Unmarshal([]byte(j), &d); err != nil { + fmt.Println(err) + } + fmt.Println(d.Date) + // Output: 2001-02-03 +} + +func ExampleDate_MarshalText() { + d, err := ParseDate("2001-02-03") + if err != nil { + fmt.Println(err) + } + t, err := d.MarshalText() + if err != nil { + fmt.Println(err) + } + fmt.Println(string(t)) + // Output: 2001-02-03 +} + +func ExampleDate_UnmarshalText() { + d := Date{} + t := "2001-02-03" + + if err := d.UnmarshalText([]byte(t)); err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: 2001-02-03 +} + +func TestDateString(t *testing.T) { + d, err := ParseDate("2001-02-03") + if err != nil { + t.Fatalf("date: String failed (%v)", err) + } + if d.String() != "2001-02-03" { + t.Fatalf("date: String failed (%v)", d.String()) + } +} + +func TestDateBinaryRoundTrip(t *testing.T) { + d1, err := ParseDate("2001-02-03") + if err != nil { + t.Fatalf("date: ParseDate failed (%v)", err) + } + t1, err := d1.MarshalBinary() + if err != nil { + t.Fatalf("date: MarshalBinary failed (%v)", err) + } + + d2 := Date{} + if err = d2.UnmarshalBinary(t1); err != nil { + t.Fatalf("date: UnmarshalBinary failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip Binary failed (%v, %v)", d1, d2) + } +} + +func TestDateJSONRoundTrip(t *testing.T) { + type s struct { + Date Date `json:"date"` + } + var err error + d1 := s{} + d1.Date, err = ParseDate("2001-02-03") + if err != nil { + t.Fatalf("date: ParseDate failed (%v)", err) + } + + j, err := json.Marshal(d1) + if err != nil { + t.Fatalf("date: MarshalJSON failed (%v)", err) + } + + d2 := s{} + if err = json.Unmarshal(j, &d2); err != nil { + t.Fatalf("date: UnmarshalJSON failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip JSON failed (%v, %v)", d1, d2) + } +} + +func TestDateTextRoundTrip(t *testing.T) { + d1, err := ParseDate("2001-02-03") + if err != nil { + t.Fatalf("date: ParseDate failed (%v)", err) + } + t1, err := d1.MarshalText() + if err != nil { + t.Fatalf("date: MarshalText failed (%v)", err) + } + d2 := Date{} + if err = d2.UnmarshalText(t1); err != nil { + t.Fatalf("date: UnmarshalText failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip Text failed (%v, %v)", d1, d2) + } +} + +func TestDateToTime(t *testing.T) { + var d Date + d, err := ParseDate("2001-02-03") + if err != nil { + t.Fatalf("date: ParseDate failed (%v)", err) + } + var _ time.Time = d.ToTime() +} + +func TestDateUnmarshalJSONReturnsError(t *testing.T) { + var d struct { + Date Date `json:"date"` + } + j := `{"date" : "February 3, 2001"}` + + if err := json.Unmarshal([]byte(j), &d); err == nil { + t.Fatal("date: Date failed to return error for malformed JSON date") + } +} + +func TestDateUnmarshalTextReturnsError(t *testing.T) { + d := Date{} + txt := "February 3, 2001" + + if err := d.UnmarshalText([]byte(txt)); err == nil { + t.Fatal("date: Date failed to return error for malformed Text date") + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/time.go b/vendor/github.com/Azure/go-autorest/autorest/date/time.go index e574d430d3..c1af629634 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/time.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/time.go @@ -1,89 +1,89 @@ -package date - -import ( - "regexp" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -const ( - azureUtcFormatJSON = `"2006-01-02T15:04:05.999999999"` - azureUtcFormat = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` - rfc3339 = time.RFC3339Nano - tzOffsetRegex = `(Z|z|\+|-)(\d+:\d+)*"*$` -) - -// Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -type Time struct { - time.Time -} - -// MarshalBinary preserves the Time as a byte array conforming to RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) MarshalBinary() ([]byte, error) { - return t.Time.MarshalText() -} - -// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC3339 date-time -// (i.e., 2006-01-02T15:04:05Z). -func (t *Time) UnmarshalBinary(data []byte) error { - return t.UnmarshalText(data) -} - -// MarshalJSON preserves the Time as a JSON string conforming to RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) MarshalJSON() (json []byte, err error) { - return t.Time.MarshalJSON() -} - -// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time -// (i.e., 2006-01-02T15:04:05Z). -func (t *Time) UnmarshalJSON(data []byte) (err error) { - timeFormat := azureUtcFormatJSON - match, err := regexp.Match(tzOffsetRegex, data) - if err != nil { - return err - } else if match { - timeFormat = rfc3339JSON - } - t.Time, err = ParseTime(timeFormat, string(data)) - return err -} - -// MarshalText preserves the Time as a byte array conforming to RFC3339 date-time (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) MarshalText() (text []byte, err error) { - return t.Time.MarshalText() -} - -// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time -// (i.e., 2006-01-02T15:04:05Z). -func (t *Time) UnmarshalText(data []byte) (err error) { - timeFormat := azureUtcFormat - match, err := regexp.Match(tzOffsetRegex, data) - if err != nil { - return err - } else if match { - timeFormat = rfc3339 - } - t.Time, err = ParseTime(timeFormat, string(data)) - return err -} - -// String returns the Time formatted as an RFC3339 date-time string (i.e., -// 2006-01-02T15:04:05Z). -func (t Time) String() string { - // Note: time.Time.String does not return an RFC3339 compliant string, time.Time.MarshalText does. - b, err := t.MarshalText() - if err != nil { - return "" - } - return string(b) -} - -// ToTime returns a Time as a time.Time -func (t Time) ToTime() time.Time { - return t.Time -} +package date + +import ( + "regexp" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +const ( + azureUtcFormatJSON = `"2006-01-02T15:04:05.999999999"` + azureUtcFormat = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` + rfc3339 = time.RFC3339Nano + tzOffsetRegex = `(Z|z|\+|-)(\d+:\d+)*"*$` +) + +// Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e., +// 2006-01-02T15:04:05Z). +type Time struct { + time.Time +} + +// MarshalBinary preserves the Time as a byte array conforming to RFC3339 date-time (i.e., +// 2006-01-02T15:04:05Z). +func (t Time) MarshalBinary() ([]byte, error) { + return t.Time.MarshalText() +} + +// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC3339 date-time +// (i.e., 2006-01-02T15:04:05Z). +func (t *Time) UnmarshalBinary(data []byte) error { + return t.UnmarshalText(data) +} + +// MarshalJSON preserves the Time as a JSON string conforming to RFC3339 date-time (i.e., +// 2006-01-02T15:04:05Z). +func (t Time) MarshalJSON() (json []byte, err error) { + return t.Time.MarshalJSON() +} + +// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time +// (i.e., 2006-01-02T15:04:05Z). +func (t *Time) UnmarshalJSON(data []byte) (err error) { + timeFormat := azureUtcFormatJSON + match, err := regexp.Match(tzOffsetRegex, data) + if err != nil { + return err + } else if match { + timeFormat = rfc3339JSON + } + t.Time, err = ParseTime(timeFormat, string(data)) + return err +} + +// MarshalText preserves the Time as a byte array conforming to RFC3339 date-time (i.e., +// 2006-01-02T15:04:05Z). +func (t Time) MarshalText() (text []byte, err error) { + return t.Time.MarshalText() +} + +// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time +// (i.e., 2006-01-02T15:04:05Z). +func (t *Time) UnmarshalText(data []byte) (err error) { + timeFormat := azureUtcFormat + match, err := regexp.Match(tzOffsetRegex, data) + if err != nil { + return err + } else if match { + timeFormat = rfc3339 + } + t.Time, err = ParseTime(timeFormat, string(data)) + return err +} + +// String returns the Time formatted as an RFC3339 date-time string (i.e., +// 2006-01-02T15:04:05Z). +func (t Time) String() string { + // Note: time.Time.String does not return an RFC3339 compliant string, time.Time.MarshalText does. + b, err := t.MarshalText() + if err != nil { + return "" + } + return string(b) +} + +// ToTime returns a Time as a time.Time +func (t Time) ToTime() time.Time { + return t.Time +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/time_test.go b/vendor/github.com/Azure/go-autorest/autorest/date/time_test.go index 43e61bd113..0a7dd9eb6b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/time_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/time_test.go @@ -1,263 +1,263 @@ -package date - -import ( - "encoding/json" - "fmt" - "reflect" - "testing" - "time" -) - -func ExampleParseTime() { - d, _ := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - fmt.Println(d) - // Output: 2001-02-03 04:05:06 +0000 UTC -} - -func ExampleTime_MarshalBinary() { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - fmt.Println(err) - } - d := Time{ti} - t, err := d.MarshalBinary() - if err != nil { - fmt.Println(err) - } - fmt.Println(string(t)) - // Output: 2001-02-03T04:05:06Z -} - -func ExampleTime_UnmarshalBinary() { - d := Time{} - t := "2001-02-03T04:05:06Z" - - if err := d.UnmarshalBinary([]byte(t)); err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: 2001-02-03T04:05:06Z -} - -func ExampleTime_MarshalJSON() { - d, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - fmt.Println(err) - } - j, err := json.Marshal(d) - if err != nil { - fmt.Println(err) - } - fmt.Println(string(j)) - // Output: "2001-02-03T04:05:06Z" -} - -func ExampleTime_UnmarshalJSON() { - var d struct { - Time Time `json:"datetime"` - } - j := `{"datetime" : "2001-02-03T04:05:06Z"}` - - if err := json.Unmarshal([]byte(j), &d); err != nil { - fmt.Println(err) - } - fmt.Println(d.Time) - // Output: 2001-02-03T04:05:06Z -} - -func ExampleTime_MarshalText() { - d, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - fmt.Println(err) - } - t, err := d.MarshalText() - if err != nil { - fmt.Println(err) - } - fmt.Println(string(t)) - // Output: 2001-02-03T04:05:06Z -} - -func ExampleTime_UnmarshalText() { - d := Time{} - t := "2001-02-03T04:05:06Z" - - if err := d.UnmarshalText([]byte(t)); err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: 2001-02-03T04:05:06Z -} - -func TestUnmarshalTextforInvalidDate(t *testing.T) { - d := Time{} - dt := "2001-02-03T04:05:06AAA" - - if err := d.UnmarshalText([]byte(dt)); err == nil { - t.Fatalf("date: Time#Unmarshal was expecting error for invalid date") - } -} - -func TestUnmarshalJSONforInvalidDate(t *testing.T) { - d := Time{} - dt := `"2001-02-03T04:05:06AAA"` - - if err := d.UnmarshalJSON([]byte(dt)); err == nil { - t.Fatalf("date: Time#Unmarshal was expecting error for invalid date") - } -} - -func TestTimeString(t *testing.T) { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - fmt.Println(err) - } - d := Time{ti} - if d.String() != "2001-02-03T04:05:06Z" { - t.Fatalf("date: Time#String failed (%v)", d.String()) - } -} - -func TestTimeStringReturnsEmptyStringForError(t *testing.T) { - d := Time{Time: time.Date(20000, 01, 01, 01, 01, 01, 01, time.UTC)} - if d.String() != "" { - t.Fatalf("date: Time#String failed empty string for an error") - } -} - -func TestTimeBinaryRoundTrip(t *testing.T) { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - t.Fatalf("date: Time#ParseTime failed (%v)", err) - } - d1 := Time{ti} - t1, err := d1.MarshalBinary() - if err != nil { - t.Fatalf("date: Time#MarshalBinary failed (%v)", err) - } - - d2 := Time{} - if err = d2.UnmarshalBinary(t1); err != nil { - t.Fatalf("date: Time#UnmarshalBinary failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date:Round-trip Binary failed (%v, %v)", d1, d2) - } -} - -func TestTimeJSONRoundTrip(t *testing.T) { - type s struct { - Time Time `json:"datetime"` - } - - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - t.Fatalf("date: Time#ParseTime failed (%v)", err) - } - - d1 := s{Time: Time{ti}} - j, err := json.Marshal(d1) - if err != nil { - t.Fatalf("date: Time#MarshalJSON failed (%v)", err) - } - - d2 := s{} - if err = json.Unmarshal(j, &d2); err != nil { - t.Fatalf("date: Time#UnmarshalJSON failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip JSON failed (%v, %v)", d1, d2) - } -} - -func TestTimeTextRoundTrip(t *testing.T) { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - t.Fatalf("date: Time#ParseTime failed (%v)", err) - } - d1 := Time{Time: ti} - t1, err := d1.MarshalText() - if err != nil { - t.Fatalf("date: Time#MarshalText failed (%v)", err) - } - - d2 := Time{} - if err = d2.UnmarshalText(t1); err != nil { - t.Fatalf("date: Time#UnmarshalText failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip Text failed (%v, %v)", d1, d2) - } -} - -func TestTimeToTime(t *testing.T) { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - d := Time{ti} - if err != nil { - t.Fatalf("date: Time#ParseTime failed (%v)", err) - } - var _ time.Time = d.ToTime() -} - -func TestUnmarshalJSONNoOffset(t *testing.T) { - var d struct { - Time Time `json:"datetime"` - } - j := `{"datetime" : "2001-02-03T04:05:06.789"}` - - if err := json.Unmarshal([]byte(j), &d); err != nil { - t.Fatalf("date: Time#Unmarshal failed (%v)", err) - } -} - -func TestUnmarshalJSONPosOffset(t *testing.T) { - var d struct { - Time Time `json:"datetime"` - } - j := `{"datetime" : "1980-01-02T00:11:35.01+01:00"}` - - if err := json.Unmarshal([]byte(j), &d); err != nil { - t.Fatalf("date: Time#Unmarshal failed (%v)", err) - } -} - -func TestUnmarshalJSONNegOffset(t *testing.T) { - var d struct { - Time Time `json:"datetime"` - } - j := `{"datetime" : "1492-10-12T10:15:01.789-08:00"}` - - if err := json.Unmarshal([]byte(j), &d); err != nil { - t.Fatalf("date: Time#Unmarshal failed (%v)", err) - } -} - -func TestUnmarshalTextNoOffset(t *testing.T) { - d := Time{} - t1 := "2001-02-03T04:05:06" - - if err := d.UnmarshalText([]byte(t1)); err != nil { - t.Fatalf("date: Time#UnmarshalText failed (%v)", err) - } -} - -func TestUnmarshalTextPosOffset(t *testing.T) { - d := Time{} - t1 := "2001-02-03T04:05:06+00:30" - - if err := d.UnmarshalText([]byte(t1)); err != nil { - t.Fatalf("date: Time#UnmarshalText failed (%v)", err) - } -} - -func TestUnmarshalTextNegOffset(t *testing.T) { - d := Time{} - t1 := "2001-02-03T04:05:06-11:00" - - if err := d.UnmarshalText([]byte(t1)); err != nil { - t.Fatalf("date: Time#UnmarshalText failed (%v)", err) - } -} +package date + +import ( + "encoding/json" + "fmt" + "reflect" + "testing" + "time" +) + +func ExampleParseTime() { + d, _ := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + fmt.Println(d) + // Output: 2001-02-03 04:05:06 +0000 UTC +} + +func ExampleTime_MarshalBinary() { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + fmt.Println(err) + } + d := Time{ti} + t, err := d.MarshalBinary() + if err != nil { + fmt.Println(err) + } + fmt.Println(string(t)) + // Output: 2001-02-03T04:05:06Z +} + +func ExampleTime_UnmarshalBinary() { + d := Time{} + t := "2001-02-03T04:05:06Z" + + if err := d.UnmarshalBinary([]byte(t)); err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: 2001-02-03T04:05:06Z +} + +func ExampleTime_MarshalJSON() { + d, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + fmt.Println(err) + } + j, err := json.Marshal(d) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(j)) + // Output: "2001-02-03T04:05:06Z" +} + +func ExampleTime_UnmarshalJSON() { + var d struct { + Time Time `json:"datetime"` + } + j := `{"datetime" : "2001-02-03T04:05:06Z"}` + + if err := json.Unmarshal([]byte(j), &d); err != nil { + fmt.Println(err) + } + fmt.Println(d.Time) + // Output: 2001-02-03T04:05:06Z +} + +func ExampleTime_MarshalText() { + d, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + fmt.Println(err) + } + t, err := d.MarshalText() + if err != nil { + fmt.Println(err) + } + fmt.Println(string(t)) + // Output: 2001-02-03T04:05:06Z +} + +func ExampleTime_UnmarshalText() { + d := Time{} + t := "2001-02-03T04:05:06Z" + + if err := d.UnmarshalText([]byte(t)); err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: 2001-02-03T04:05:06Z +} + +func TestUnmarshalTextforInvalidDate(t *testing.T) { + d := Time{} + dt := "2001-02-03T04:05:06AAA" + + if err := d.UnmarshalText([]byte(dt)); err == nil { + t.Fatalf("date: Time#Unmarshal was expecting error for invalid date") + } +} + +func TestUnmarshalJSONforInvalidDate(t *testing.T) { + d := Time{} + dt := `"2001-02-03T04:05:06AAA"` + + if err := d.UnmarshalJSON([]byte(dt)); err == nil { + t.Fatalf("date: Time#Unmarshal was expecting error for invalid date") + } +} + +func TestTimeString(t *testing.T) { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + fmt.Println(err) + } + d := Time{ti} + if d.String() != "2001-02-03T04:05:06Z" { + t.Fatalf("date: Time#String failed (%v)", d.String()) + } +} + +func TestTimeStringReturnsEmptyStringForError(t *testing.T) { + d := Time{Time: time.Date(20000, 01, 01, 01, 01, 01, 01, time.UTC)} + if d.String() != "" { + t.Fatalf("date: Time#String failed empty string for an error") + } +} + +func TestTimeBinaryRoundTrip(t *testing.T) { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + t.Fatalf("date: Time#ParseTime failed (%v)", err) + } + d1 := Time{ti} + t1, err := d1.MarshalBinary() + if err != nil { + t.Fatalf("date: Time#MarshalBinary failed (%v)", err) + } + + d2 := Time{} + if err = d2.UnmarshalBinary(t1); err != nil { + t.Fatalf("date: Time#UnmarshalBinary failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date:Round-trip Binary failed (%v, %v)", d1, d2) + } +} + +func TestTimeJSONRoundTrip(t *testing.T) { + type s struct { + Time Time `json:"datetime"` + } + + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + t.Fatalf("date: Time#ParseTime failed (%v)", err) + } + + d1 := s{Time: Time{ti}} + j, err := json.Marshal(d1) + if err != nil { + t.Fatalf("date: Time#MarshalJSON failed (%v)", err) + } + + d2 := s{} + if err = json.Unmarshal(j, &d2); err != nil { + t.Fatalf("date: Time#UnmarshalJSON failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip JSON failed (%v, %v)", d1, d2) + } +} + +func TestTimeTextRoundTrip(t *testing.T) { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + t.Fatalf("date: Time#ParseTime failed (%v)", err) + } + d1 := Time{Time: ti} + t1, err := d1.MarshalText() + if err != nil { + t.Fatalf("date: Time#MarshalText failed (%v)", err) + } + + d2 := Time{} + if err = d2.UnmarshalText(t1); err != nil { + t.Fatalf("date: Time#UnmarshalText failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip Text failed (%v, %v)", d1, d2) + } +} + +func TestTimeToTime(t *testing.T) { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + d := Time{ti} + if err != nil { + t.Fatalf("date: Time#ParseTime failed (%v)", err) + } + var _ time.Time = d.ToTime() +} + +func TestUnmarshalJSONNoOffset(t *testing.T) { + var d struct { + Time Time `json:"datetime"` + } + j := `{"datetime" : "2001-02-03T04:05:06.789"}` + + if err := json.Unmarshal([]byte(j), &d); err != nil { + t.Fatalf("date: Time#Unmarshal failed (%v)", err) + } +} + +func TestUnmarshalJSONPosOffset(t *testing.T) { + var d struct { + Time Time `json:"datetime"` + } + j := `{"datetime" : "1980-01-02T00:11:35.01+01:00"}` + + if err := json.Unmarshal([]byte(j), &d); err != nil { + t.Fatalf("date: Time#Unmarshal failed (%v)", err) + } +} + +func TestUnmarshalJSONNegOffset(t *testing.T) { + var d struct { + Time Time `json:"datetime"` + } + j := `{"datetime" : "1492-10-12T10:15:01.789-08:00"}` + + if err := json.Unmarshal([]byte(j), &d); err != nil { + t.Fatalf("date: Time#Unmarshal failed (%v)", err) + } +} + +func TestUnmarshalTextNoOffset(t *testing.T) { + d := Time{} + t1 := "2001-02-03T04:05:06" + + if err := d.UnmarshalText([]byte(t1)); err != nil { + t.Fatalf("date: Time#UnmarshalText failed (%v)", err) + } +} + +func TestUnmarshalTextPosOffset(t *testing.T) { + d := Time{} + t1 := "2001-02-03T04:05:06+00:30" + + if err := d.UnmarshalText([]byte(t1)); err != nil { + t.Fatalf("date: Time#UnmarshalText failed (%v)", err) + } +} + +func TestUnmarshalTextNegOffset(t *testing.T) { + d := Time{} + t1 := "2001-02-03T04:05:06-11:00" + + if err := d.UnmarshalText([]byte(t1)); err != nil { + t.Fatalf("date: Time#UnmarshalText failed (%v)", err) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go index 229a6423a7..11995fb9f2 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go @@ -1,86 +1,86 @@ -package date - -import ( - "errors" - "time" -) - -const ( - rfc1123JSON = `"` + time.RFC1123 + `"` - rfc1123 = time.RFC1123 -) - -// TimeRFC1123 defines a type similar to time.Time but assumes a layout of RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -type TimeRFC1123 struct { - time.Time -} - -// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC1123 date-time -// (i.e., Mon, 02 Jan 2006 15:04:05 MST). -func (t *TimeRFC1123) UnmarshalJSON(data []byte) (err error) { - t.Time, err = ParseTime(rfc1123JSON, string(data)) - if err != nil { - return err - } - return nil -} - -// MarshalJSON preserves the Time as a JSON string conforming to RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) MarshalJSON() ([]byte, error) { - if y := t.Year(); y < 0 || y >= 10000 { - return nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]") - } - b := []byte(t.Format(rfc1123JSON)) - return b, nil -} - -// MarshalText preserves the Time as a byte array conforming to RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) MarshalText() ([]byte, error) { - if y := t.Year(); y < 0 || y >= 10000 { - return nil, errors.New("Time.MarshalText: year outside of range [0,9999]") - } - - b := []byte(t.Format(rfc1123)) - return b, nil -} - -// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC1123 date-time -// (i.e., Mon, 02 Jan 2006 15:04:05 MST). -func (t *TimeRFC1123) UnmarshalText(data []byte) (err error) { - t.Time, err = ParseTime(rfc1123, string(data)) - if err != nil { - return err - } - return nil -} - -// MarshalBinary preserves the Time as a byte array conforming to RFC1123 date-time (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) MarshalBinary() ([]byte, error) { - return t.MarshalText() -} - -// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC1123 date-time -// (i.e., Mon, 02 Jan 2006 15:04:05 MST). -func (t *TimeRFC1123) UnmarshalBinary(data []byte) error { - return t.UnmarshalText(data) -} - -// ToTime returns a Time as a time.Time -func (t TimeRFC1123) ToTime() time.Time { - return t.Time -} - -// String returns the Time formatted as an RFC1123 date-time string (i.e., -// Mon, 02 Jan 2006 15:04:05 MST). -func (t TimeRFC1123) String() string { - // Note: time.Time.String does not return an RFC1123 compliant string, time.Time.MarshalText does. - b, err := t.MarshalText() - if err != nil { - return "" - } - return string(b) -} +package date + +import ( + "errors" + "time" +) + +const ( + rfc1123JSON = `"` + time.RFC1123 + `"` + rfc1123 = time.RFC1123 +) + +// TimeRFC1123 defines a type similar to time.Time but assumes a layout of RFC1123 date-time (i.e., +// Mon, 02 Jan 2006 15:04:05 MST). +type TimeRFC1123 struct { + time.Time +} + +// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC1123 date-time +// (i.e., Mon, 02 Jan 2006 15:04:05 MST). +func (t *TimeRFC1123) UnmarshalJSON(data []byte) (err error) { + t.Time, err = ParseTime(rfc1123JSON, string(data)) + if err != nil { + return err + } + return nil +} + +// MarshalJSON preserves the Time as a JSON string conforming to RFC1123 date-time (i.e., +// Mon, 02 Jan 2006 15:04:05 MST). +func (t TimeRFC1123) MarshalJSON() ([]byte, error) { + if y := t.Year(); y < 0 || y >= 10000 { + return nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]") + } + b := []byte(t.Format(rfc1123JSON)) + return b, nil +} + +// MarshalText preserves the Time as a byte array conforming to RFC1123 date-time (i.e., +// Mon, 02 Jan 2006 15:04:05 MST). +func (t TimeRFC1123) MarshalText() ([]byte, error) { + if y := t.Year(); y < 0 || y >= 10000 { + return nil, errors.New("Time.MarshalText: year outside of range [0,9999]") + } + + b := []byte(t.Format(rfc1123)) + return b, nil +} + +// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC1123 date-time +// (i.e., Mon, 02 Jan 2006 15:04:05 MST). +func (t *TimeRFC1123) UnmarshalText(data []byte) (err error) { + t.Time, err = ParseTime(rfc1123, string(data)) + if err != nil { + return err + } + return nil +} + +// MarshalBinary preserves the Time as a byte array conforming to RFC1123 date-time (i.e., +// Mon, 02 Jan 2006 15:04:05 MST). +func (t TimeRFC1123) MarshalBinary() ([]byte, error) { + return t.MarshalText() +} + +// UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC1123 date-time +// (i.e., Mon, 02 Jan 2006 15:04:05 MST). +func (t *TimeRFC1123) UnmarshalBinary(data []byte) error { + return t.UnmarshalText(data) +} + +// ToTime returns a Time as a time.Time +func (t TimeRFC1123) ToTime() time.Time { + return t.Time +} + +// String returns the Time formatted as an RFC1123 date-time string (i.e., +// Mon, 02 Jan 2006 15:04:05 MST). +func (t TimeRFC1123) String() string { + // Note: time.Time.String does not return an RFC1123 compliant string, time.Time.MarshalText does. + b, err := t.MarshalText() + if err != nil { + return "" + } + return string(b) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123_test.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123_test.go index 335d14f538..28f3ce2139 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123_test.go @@ -1,212 +1,212 @@ -package date - -import ( - "encoding/json" - "fmt" - "reflect" - "testing" - "time" -) - -func ExampleTimeRFC1123() { - d, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - if err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: 2006-01-02 15:04:05 +0000 MST -} - -func ExampleTimeRFC1123_MarshalBinary() { - ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - if err != nil { - fmt.Println(err) - } - d := TimeRFC1123{ti} - b, err := d.MarshalBinary() - if err != nil { - fmt.Println(err) - } - fmt.Println(string(b)) - // Output: Mon, 02 Jan 2006 15:04:05 MST -} - -func ExampleTimeRFC1123_UnmarshalBinary() { - d := TimeRFC1123{} - t := "Mon, 02 Jan 2006 15:04:05 MST" - if err := d.UnmarshalBinary([]byte(t)); err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: Mon, 02 Jan 2006 15:04:05 MST -} - -func ExampleTimeRFC1123_MarshalJSON() { - ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - if err != nil { - fmt.Println(err) - } - d := TimeRFC1123{ti} - j, err := json.Marshal(d) - if err != nil { - fmt.Println(err) - } - fmt.Println(string(j)) - // Output: "Mon, 02 Jan 2006 15:04:05 MST" -} - -func TestTimeRFC1123MarshalJSONInvalid(t *testing.T) { - ti := time.Date(20000, 01, 01, 00, 00, 00, 00, time.UTC) - d := TimeRFC1123{ti} - if _, err := json.Marshal(d); err == nil { - t.Fatalf("date: TimeRFC1123#Marshal failed for invalid date") - } -} - -func ExampleTimeRFC1123_UnmarshalJSON() { - var d struct { - Time TimeRFC1123 `json:"datetime"` - } - j := `{"datetime" : "Mon, 02 Jan 2006 15:04:05 MST"}` - - if err := json.Unmarshal([]byte(j), &d); err != nil { - fmt.Println(err) - } - fmt.Println(d.Time) - // Output: Mon, 02 Jan 2006 15:04:05 MST -} - -func ExampleTimeRFC1123_MarshalText() { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - fmt.Println(err) - } - d := TimeRFC1123{ti} - t, err := d.MarshalText() - if err != nil { - fmt.Println(err) - } - fmt.Println(string(t)) - // Output: Sat, 03 Feb 2001 04:05:06 UTC -} - -func ExampleTimeRFC1123_UnmarshalText() { - d := TimeRFC1123{} - t := "Sat, 03 Feb 2001 04:05:06 UTC" - - if err := d.UnmarshalText([]byte(t)); err != nil { - fmt.Println(err) - } - fmt.Println(d) - // Output: Sat, 03 Feb 2001 04:05:06 UTC -} - -func TestUnmarshalJSONforInvalidDateRfc1123(t *testing.T) { - dt := `"Mon, 02 Jan 2000000 15:05 MST"` - d := TimeRFC1123{} - if err := d.UnmarshalJSON([]byte(dt)); err == nil { - t.Fatalf("date: TimeRFC1123#Unmarshal failed for invalid date") - } -} - -func TestUnmarshalTextforInvalidDateRfc1123(t *testing.T) { - dt := "Mon, 02 Jan 2000000 15:05 MST" - d := TimeRFC1123{} - if err := d.UnmarshalText([]byte(dt)); err == nil { - t.Fatalf("date: TimeRFC1123#Unmarshal failed for invalid date") - } -} - -func TestTimeStringRfc1123(t *testing.T) { - ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - if err != nil { - fmt.Println(err) - } - d := TimeRFC1123{ti} - if d.String() != "Mon, 02 Jan 2006 15:04:05 MST" { - t.Fatalf("date: TimeRFC1123#String failed (%v)", d.String()) - } -} - -func TestTimeStringReturnsEmptyStringForErrorRfc1123(t *testing.T) { - d := TimeRFC1123{Time: time.Date(20000, 01, 01, 01, 01, 01, 01, time.UTC)} - if d.String() != "" { - t.Fatalf("date: TimeRFC1123#String failed empty string for an error") - } -} - -func TestTimeBinaryRoundTripRfc1123(t *testing.T) { - ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") - if err != nil { - t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) - } - d1 := TimeRFC1123{ti} - t1, err := d1.MarshalBinary() - if err != nil { - t.Fatalf("date: TimeRFC1123#MarshalBinary failed (%v)", err) - } - - d2 := TimeRFC1123{} - if err = d2.UnmarshalBinary(t1); err != nil { - t.Fatalf("date: TimeRFC1123#UnmarshalBinary failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip Binary failed (%v, %v)", d1, d2) - } -} - -func TestTimeJSONRoundTripRfc1123(t *testing.T) { - type s struct { - Time TimeRFC1123 `json:"datetime"` - } - var err error - ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - if err != nil { - t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) - } - d1 := s{Time: TimeRFC1123{ti}} - j, err := json.Marshal(d1) - if err != nil { - t.Fatalf("date: TimeRFC1123#MarshalJSON failed (%v)", err) - } - - d2 := s{} - if err = json.Unmarshal(j, &d2); err != nil { - t.Fatalf("date: TimeRFC1123#UnmarshalJSON failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip JSON failed (%v, %v)", d1, d2) - } -} - -func TestTimeTextRoundTripRfc1123(t *testing.T) { - ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - if err != nil { - t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) - } - d1 := TimeRFC1123{Time: ti} - t1, err := d1.MarshalText() - if err != nil { - t.Fatalf("date: TimeRFC1123#MarshalText failed (%v)", err) - } - - d2 := TimeRFC1123{} - if err = d2.UnmarshalText(t1); err != nil { - t.Fatalf("date: TimeRFC1123#UnmarshalText failed (%v)", err) - } - - if !reflect.DeepEqual(d1, d2) { - t.Fatalf("date: Round-trip Text failed (%v, %v)", d1, d2) - } -} - -func TestTimeToTimeRFC1123(t *testing.T) { - ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") - d := TimeRFC1123{ti} - if err != nil { - t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) - } - var _ time.Time = d.ToTime() -} +package date + +import ( + "encoding/json" + "fmt" + "reflect" + "testing" + "time" +) + +func ExampleTimeRFC1123() { + d, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + if err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: 2006-01-02 15:04:05 +0000 MST +} + +func ExampleTimeRFC1123_MarshalBinary() { + ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + if err != nil { + fmt.Println(err) + } + d := TimeRFC1123{ti} + b, err := d.MarshalBinary() + if err != nil { + fmt.Println(err) + } + fmt.Println(string(b)) + // Output: Mon, 02 Jan 2006 15:04:05 MST +} + +func ExampleTimeRFC1123_UnmarshalBinary() { + d := TimeRFC1123{} + t := "Mon, 02 Jan 2006 15:04:05 MST" + if err := d.UnmarshalBinary([]byte(t)); err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: Mon, 02 Jan 2006 15:04:05 MST +} + +func ExampleTimeRFC1123_MarshalJSON() { + ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + if err != nil { + fmt.Println(err) + } + d := TimeRFC1123{ti} + j, err := json.Marshal(d) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(j)) + // Output: "Mon, 02 Jan 2006 15:04:05 MST" +} + +func TestTimeRFC1123MarshalJSONInvalid(t *testing.T) { + ti := time.Date(20000, 01, 01, 00, 00, 00, 00, time.UTC) + d := TimeRFC1123{ti} + if _, err := json.Marshal(d); err == nil { + t.Fatalf("date: TimeRFC1123#Marshal failed for invalid date") + } +} + +func ExampleTimeRFC1123_UnmarshalJSON() { + var d struct { + Time TimeRFC1123 `json:"datetime"` + } + j := `{"datetime" : "Mon, 02 Jan 2006 15:04:05 MST"}` + + if err := json.Unmarshal([]byte(j), &d); err != nil { + fmt.Println(err) + } + fmt.Println(d.Time) + // Output: Mon, 02 Jan 2006 15:04:05 MST +} + +func ExampleTimeRFC1123_MarshalText() { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + fmt.Println(err) + } + d := TimeRFC1123{ti} + t, err := d.MarshalText() + if err != nil { + fmt.Println(err) + } + fmt.Println(string(t)) + // Output: Sat, 03 Feb 2001 04:05:06 UTC +} + +func ExampleTimeRFC1123_UnmarshalText() { + d := TimeRFC1123{} + t := "Sat, 03 Feb 2001 04:05:06 UTC" + + if err := d.UnmarshalText([]byte(t)); err != nil { + fmt.Println(err) + } + fmt.Println(d) + // Output: Sat, 03 Feb 2001 04:05:06 UTC +} + +func TestUnmarshalJSONforInvalidDateRfc1123(t *testing.T) { + dt := `"Mon, 02 Jan 2000000 15:05 MST"` + d := TimeRFC1123{} + if err := d.UnmarshalJSON([]byte(dt)); err == nil { + t.Fatalf("date: TimeRFC1123#Unmarshal failed for invalid date") + } +} + +func TestUnmarshalTextforInvalidDateRfc1123(t *testing.T) { + dt := "Mon, 02 Jan 2000000 15:05 MST" + d := TimeRFC1123{} + if err := d.UnmarshalText([]byte(dt)); err == nil { + t.Fatalf("date: TimeRFC1123#Unmarshal failed for invalid date") + } +} + +func TestTimeStringRfc1123(t *testing.T) { + ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + if err != nil { + fmt.Println(err) + } + d := TimeRFC1123{ti} + if d.String() != "Mon, 02 Jan 2006 15:04:05 MST" { + t.Fatalf("date: TimeRFC1123#String failed (%v)", d.String()) + } +} + +func TestTimeStringReturnsEmptyStringForErrorRfc1123(t *testing.T) { + d := TimeRFC1123{Time: time.Date(20000, 01, 01, 01, 01, 01, 01, time.UTC)} + if d.String() != "" { + t.Fatalf("date: TimeRFC1123#String failed empty string for an error") + } +} + +func TestTimeBinaryRoundTripRfc1123(t *testing.T) { + ti, err := ParseTime(rfc3339, "2001-02-03T04:05:06Z") + if err != nil { + t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) + } + d1 := TimeRFC1123{ti} + t1, err := d1.MarshalBinary() + if err != nil { + t.Fatalf("date: TimeRFC1123#MarshalBinary failed (%v)", err) + } + + d2 := TimeRFC1123{} + if err = d2.UnmarshalBinary(t1); err != nil { + t.Fatalf("date: TimeRFC1123#UnmarshalBinary failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip Binary failed (%v, %v)", d1, d2) + } +} + +func TestTimeJSONRoundTripRfc1123(t *testing.T) { + type s struct { + Time TimeRFC1123 `json:"datetime"` + } + var err error + ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + if err != nil { + t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) + } + d1 := s{Time: TimeRFC1123{ti}} + j, err := json.Marshal(d1) + if err != nil { + t.Fatalf("date: TimeRFC1123#MarshalJSON failed (%v)", err) + } + + d2 := s{} + if err = json.Unmarshal(j, &d2); err != nil { + t.Fatalf("date: TimeRFC1123#UnmarshalJSON failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip JSON failed (%v, %v)", d1, d2) + } +} + +func TestTimeTextRoundTripRfc1123(t *testing.T) { + ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + if err != nil { + t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) + } + d1 := TimeRFC1123{Time: ti} + t1, err := d1.MarshalText() + if err != nil { + t.Fatalf("date: TimeRFC1123#MarshalText failed (%v)", err) + } + + d2 := TimeRFC1123{} + if err = d2.UnmarshalText(t1); err != nil { + t.Fatalf("date: TimeRFC1123#UnmarshalText failed (%v)", err) + } + + if !reflect.DeepEqual(d1, d2) { + t.Fatalf("date: Round-trip Text failed (%v, %v)", d1, d2) + } +} + +func TestTimeToTimeRFC1123(t *testing.T) { + ti, err := ParseTime(rfc1123, "Mon, 02 Jan 2006 15:04:05 MST") + d := TimeRFC1123{ti} + if err != nil { + t.Fatalf("date: TimeRFC1123#ParseTime failed (%v)", err) + } + var _ time.Time = d.ToTime() +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go index 82efc86ecc..e085c77eea 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go @@ -1,109 +1,109 @@ -package date - -import ( - "bytes" - "encoding/binary" - "encoding/json" - "time" -) - -// unixEpoch is the moment in time that should be treated as timestamp 0. -var unixEpoch = time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) - -// UnixTime marshals and unmarshals a time that is represented as the number -// of seconds (ignoring skip-seconds) since the Unix Epoch. -type UnixTime time.Time - -// Duration returns the time as a Duration since the UnixEpoch. -func (t UnixTime) Duration() time.Duration { - return time.Time(t).Sub(unixEpoch) -} - -// NewUnixTimeFromSeconds creates a UnixTime as a number of seconds from the UnixEpoch. -func NewUnixTimeFromSeconds(seconds float64) UnixTime { - return NewUnixTimeFromDuration(time.Duration(seconds * float64(time.Second))) -} - -// NewUnixTimeFromNanoseconds creates a UnixTime as a number of nanoseconds from the UnixEpoch. -func NewUnixTimeFromNanoseconds(nanoseconds int64) UnixTime { - return NewUnixTimeFromDuration(time.Duration(nanoseconds)) -} - -// NewUnixTimeFromDuration creates a UnixTime as a duration of time since the UnixEpoch. -func NewUnixTimeFromDuration(dur time.Duration) UnixTime { - return UnixTime(unixEpoch.Add(dur)) -} - -// UnixEpoch retreives the moment considered the Unix Epoch. I.e. The time represented by '0' -func UnixEpoch() time.Time { - return unixEpoch -} - -// MarshalJSON preserves the UnixTime as a JSON number conforming to Unix Timestamp requirements. -// (i.e. the number of seconds since midnight January 1st, 1970 not considering leap seconds.) -func (t UnixTime) MarshalJSON() ([]byte, error) { - buffer := &bytes.Buffer{} - enc := json.NewEncoder(buffer) - err := enc.Encode(float64(time.Time(t).UnixNano()) / 1e9) - if err != nil { - return nil, err - } - return buffer.Bytes(), nil -} - -// UnmarshalJSON reconstitures a UnixTime saved as a JSON number of the number of seconds since -// midnight January 1st, 1970. -func (t *UnixTime) UnmarshalJSON(text []byte) error { - dec := json.NewDecoder(bytes.NewReader(text)) - - var secondsSinceEpoch float64 - if err := dec.Decode(&secondsSinceEpoch); err != nil { - return err - } - - *t = NewUnixTimeFromSeconds(secondsSinceEpoch) - - return nil -} - -// MarshalText stores the number of seconds since the Unix Epoch as a textual floating point number. -func (t UnixTime) MarshalText() ([]byte, error) { - cast := time.Time(t) - return cast.MarshalText() -} - -// UnmarshalText populates a UnixTime with a value stored textually as a floating point number of seconds since the Unix Epoch. -func (t *UnixTime) UnmarshalText(raw []byte) error { - var unmarshaled time.Time - - if err := unmarshaled.UnmarshalText(raw); err != nil { - return err - } - - *t = UnixTime(unmarshaled) - return nil -} - -// MarshalBinary converts a UnixTime into a binary.LittleEndian float64 of nanoseconds since the epoch. -func (t UnixTime) MarshalBinary() ([]byte, error) { - buf := &bytes.Buffer{} - - payload := int64(t.Duration()) - - if err := binary.Write(buf, binary.LittleEndian, &payload); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -// UnmarshalBinary converts a from a binary.LittleEndian float64 of nanoseconds since the epoch into a UnixTime. -func (t *UnixTime) UnmarshalBinary(raw []byte) error { - var nanosecondsSinceEpoch int64 - - if err := binary.Read(bytes.NewReader(raw), binary.LittleEndian, &nanosecondsSinceEpoch); err != nil { - return err - } - *t = NewUnixTimeFromNanoseconds(nanosecondsSinceEpoch) - return nil -} +package date + +import ( + "bytes" + "encoding/binary" + "encoding/json" + "time" +) + +// unixEpoch is the moment in time that should be treated as timestamp 0. +var unixEpoch = time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) + +// UnixTime marshals and unmarshals a time that is represented as the number +// of seconds (ignoring skip-seconds) since the Unix Epoch. +type UnixTime time.Time + +// Duration returns the time as a Duration since the UnixEpoch. +func (t UnixTime) Duration() time.Duration { + return time.Time(t).Sub(unixEpoch) +} + +// NewUnixTimeFromSeconds creates a UnixTime as a number of seconds from the UnixEpoch. +func NewUnixTimeFromSeconds(seconds float64) UnixTime { + return NewUnixTimeFromDuration(time.Duration(seconds * float64(time.Second))) +} + +// NewUnixTimeFromNanoseconds creates a UnixTime as a number of nanoseconds from the UnixEpoch. +func NewUnixTimeFromNanoseconds(nanoseconds int64) UnixTime { + return NewUnixTimeFromDuration(time.Duration(nanoseconds)) +} + +// NewUnixTimeFromDuration creates a UnixTime as a duration of time since the UnixEpoch. +func NewUnixTimeFromDuration(dur time.Duration) UnixTime { + return UnixTime(unixEpoch.Add(dur)) +} + +// UnixEpoch retreives the moment considered the Unix Epoch. I.e. The time represented by '0' +func UnixEpoch() time.Time { + return unixEpoch +} + +// MarshalJSON preserves the UnixTime as a JSON number conforming to Unix Timestamp requirements. +// (i.e. the number of seconds since midnight January 1st, 1970 not considering leap seconds.) +func (t UnixTime) MarshalJSON() ([]byte, error) { + buffer := &bytes.Buffer{} + enc := json.NewEncoder(buffer) + err := enc.Encode(float64(time.Time(t).UnixNano()) / 1e9) + if err != nil { + return nil, err + } + return buffer.Bytes(), nil +} + +// UnmarshalJSON reconstitures a UnixTime saved as a JSON number of the number of seconds since +// midnight January 1st, 1970. +func (t *UnixTime) UnmarshalJSON(text []byte) error { + dec := json.NewDecoder(bytes.NewReader(text)) + + var secondsSinceEpoch float64 + if err := dec.Decode(&secondsSinceEpoch); err != nil { + return err + } + + *t = NewUnixTimeFromSeconds(secondsSinceEpoch) + + return nil +} + +// MarshalText stores the number of seconds since the Unix Epoch as a textual floating point number. +func (t UnixTime) MarshalText() ([]byte, error) { + cast := time.Time(t) + return cast.MarshalText() +} + +// UnmarshalText populates a UnixTime with a value stored textually as a floating point number of seconds since the Unix Epoch. +func (t *UnixTime) UnmarshalText(raw []byte) error { + var unmarshaled time.Time + + if err := unmarshaled.UnmarshalText(raw); err != nil { + return err + } + + *t = UnixTime(unmarshaled) + return nil +} + +// MarshalBinary converts a UnixTime into a binary.LittleEndian float64 of nanoseconds since the epoch. +func (t UnixTime) MarshalBinary() ([]byte, error) { + buf := &bytes.Buffer{} + + payload := int64(t.Duration()) + + if err := binary.Write(buf, binary.LittleEndian, &payload); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +// UnmarshalBinary converts a from a binary.LittleEndian float64 of nanoseconds since the epoch into a UnixTime. +func (t *UnixTime) UnmarshalBinary(raw []byte) error { + var nanosecondsSinceEpoch int64 + + if err := binary.Read(bytes.NewReader(raw), binary.LittleEndian, &nanosecondsSinceEpoch); err != nil { + return err + } + *t = NewUnixTimeFromNanoseconds(nanosecondsSinceEpoch) + return nil +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime_test.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime_test.go index 0ebcdc6ece..3d18fd6008 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime_test.go @@ -1,267 +1,267 @@ -package date - -import ( - "bytes" - "encoding/binary" - "encoding/json" - "fmt" - "math" - "testing" - "time" -) - -func ExampleUnixTime_MarshalJSON() { - epoch := UnixTime(UnixEpoch()) - text, _ := json.Marshal(epoch) - fmt.Print(string(text)) - // Output: 0 -} - -func ExampleUnixTime_UnmarshalJSON() { - var myTime UnixTime - json.Unmarshal([]byte("1.3e2"), &myTime) - fmt.Printf("%v", time.Time(myTime)) - // Output: 1970-01-01 00:02:10 +0000 UTC -} - -func TestUnixTime_MarshalJSON(t *testing.T) { - testCases := []time.Time{ - UnixEpoch().Add(-1 * time.Second), // One second befote the Unix Epoch - time.Date(2017, time.April, 14, 20, 27, 47, 0, time.UTC), // The time this test was written - UnixEpoch(), - time.Date(1800, 01, 01, 0, 0, 0, 0, time.UTC), - time.Date(2200, 12, 29, 00, 01, 37, 82, time.UTC), - } - - for _, tc := range testCases { - t.Run(tc.String(), func(subT *testing.T) { - var actual, expected float64 - var marshaled []byte - - target := UnixTime(tc) - expected = float64(target.Duration().Nanoseconds()) / 1e9 - - if temp, err := json.Marshal(target); err == nil { - marshaled = temp - } else { - subT.Error(err) - return - } - - dec := json.NewDecoder(bytes.NewReader(marshaled)) - if err := dec.Decode(&actual); err != nil { - subT.Error(err) - return - } - - diff := math.Abs(actual - expected) - subT.Logf("\ngot :\t%g\nwant:\t%g\ndiff:\t%g", actual, expected, diff) - if diff > 1e-9 { //Must be within 1 nanosecond of one another - subT.Fail() - } - }) - } -} - -func TestUnixTime_UnmarshalJSON(t *testing.T) { - testCases := []struct { - text string - expected time.Time - }{ - {"1", UnixEpoch().Add(time.Second)}, - {"0", UnixEpoch()}, - {"1492203742", time.Date(2017, time.April, 14, 21, 02, 22, 0, time.UTC)}, // The time this test was written - {"-1", time.Date(1969, time.December, 31, 23, 59, 59, 0, time.UTC)}, - {"1.5", UnixEpoch().Add(1500 * time.Millisecond)}, - {"0e1", UnixEpoch()}, // See http://json.org for 'number' format definition. - {"1.3e+2", UnixEpoch().Add(130 * time.Second)}, - {"1.6E-10", UnixEpoch()}, // This is so small, it should get truncated into the UnixEpoch - {"2E-6", UnixEpoch().Add(2 * time.Microsecond)}, - {"1.289345e9", UnixEpoch().Add(1289345000 * time.Second)}, - {"1e-9", UnixEpoch().Add(time.Nanosecond)}, - } - - for _, tc := range testCases { - t.Run(tc.text, func(subT *testing.T) { - var rehydrated UnixTime - if err := json.Unmarshal([]byte(tc.text), &rehydrated); err != nil { - subT.Error(err) - return - } - - if time.Time(rehydrated) != tc.expected { - subT.Logf("\ngot: \t%v\nwant:\t%v\ndiff:\t%v", time.Time(rehydrated), tc.expected, time.Time(rehydrated).Sub(tc.expected)) - subT.Fail() - } - }) - } -} - -func TestUnixTime_JSONRoundTrip(t *testing.T) { - testCases := []time.Time{ - UnixEpoch(), - time.Date(2005, time.November, 5, 0, 0, 0, 0, time.UTC), // The day V for Vendetta (film) was released. - UnixEpoch().Add(-6 * time.Second), - UnixEpoch().Add(800 * time.Hour), - UnixEpoch().Add(time.Nanosecond), - time.Date(2015, time.September, 05, 4, 30, 12, 9992, time.UTC), - } - - for _, tc := range testCases { - t.Run(tc.String(), func(subT *testing.T) { - subject := UnixTime(tc) - var marshaled []byte - if temp, err := json.Marshal(subject); err == nil { - marshaled = temp - } else { - subT.Error(err) - return - } - - var unmarshaled UnixTime - if err := json.Unmarshal(marshaled, &unmarshaled); err != nil { - subT.Error(err) - } - - actual := time.Time(unmarshaled) - diff := actual.Sub(tc) - subT.Logf("\ngot :\t%s\nwant:\t%s\ndiff:\t%s", actual.String(), tc.String(), diff.String()) - - if diff > time.Duration(100) { // We lose some precision be working in floats. We shouldn't lose more than 100 nanoseconds. - subT.Fail() - } - }) - } -} - -func TestUnixTime_MarshalBinary(t *testing.T) { - testCases := []struct { - expected int64 - subject time.Time - }{ - {0, UnixEpoch()}, - {-15 * int64(time.Second), UnixEpoch().Add(-15 * time.Second)}, - {54, UnixEpoch().Add(54 * time.Nanosecond)}, - } - - for _, tc := range testCases { - t.Run("", func(subT *testing.T) { - var marshaled []byte - - if temp, err := UnixTime(tc.subject).MarshalBinary(); err == nil { - marshaled = temp - } else { - subT.Error(err) - return - } - - var unmarshaled int64 - if err := binary.Read(bytes.NewReader(marshaled), binary.LittleEndian, &unmarshaled); err != nil { - subT.Error(err) - return - } - - if unmarshaled != tc.expected { - subT.Logf("\ngot: \t%d\nwant:\t%d", unmarshaled, tc.expected) - subT.Fail() - } - }) - } -} - -func TestUnixTime_BinaryRoundTrip(t *testing.T) { - testCases := []time.Time{ - UnixEpoch(), - UnixEpoch().Add(800 * time.Minute), - UnixEpoch().Add(7 * time.Hour), - UnixEpoch().Add(-1 * time.Nanosecond), - } - - for _, tc := range testCases { - t.Run(tc.String(), func(subT *testing.T) { - original := UnixTime(tc) - var marshaled []byte - - if temp, err := original.MarshalBinary(); err == nil { - marshaled = temp - } else { - subT.Error(err) - return - } - - var traveled UnixTime - if err := traveled.UnmarshalBinary(marshaled); err != nil { - subT.Error(err) - return - } - - if traveled != original { - subT.Logf("\ngot: \t%s\nwant:\t%s", time.Time(original).String(), time.Time(traveled).String()) - subT.Fail() - } - }) - } -} - -func TestUnixTime_MarshalText(t *testing.T) { - testCases := []time.Time{ - UnixEpoch(), - UnixEpoch().Add(45 * time.Second), - UnixEpoch().Add(time.Nanosecond), - UnixEpoch().Add(-100000 * time.Second), - } - - for _, tc := range testCases { - expected, _ := tc.MarshalText() - t.Run("", func(subT *testing.T) { - var marshaled []byte - - if temp, err := UnixTime(tc).MarshalText(); err == nil { - marshaled = temp - } else { - subT.Error(err) - return - } - - if string(marshaled) != string(expected) { - subT.Logf("\ngot: \t%s\nwant:\t%s", string(marshaled), string(expected)) - subT.Fail() - } - }) - } -} - -func TestUnixTime_TextRoundTrip(t *testing.T) { - testCases := []time.Time{ - UnixEpoch(), - UnixEpoch().Add(-1 * time.Nanosecond), - UnixEpoch().Add(1 * time.Nanosecond), - time.Date(2017, time.April, 17, 21, 00, 00, 00, time.UTC), - } - - for _, tc := range testCases { - t.Run(tc.String(), func(subT *testing.T) { - unixTC := UnixTime(tc) - - var marshaled []byte - - if temp, err := unixTC.MarshalText(); err == nil { - marshaled = temp - } else { - subT.Error(err) - return - } - - var unmarshaled UnixTime - if err := unmarshaled.UnmarshalText(marshaled); err != nil { - subT.Error(err) - return - } - - if unmarshaled != unixTC { - t.Logf("\ngot: \t%s\nwant:\t%s", time.Time(unmarshaled).String(), tc.String()) - t.Fail() - } - }) - } -} +package date + +import ( + "bytes" + "encoding/binary" + "encoding/json" + "fmt" + "math" + "testing" + "time" +) + +func ExampleUnixTime_MarshalJSON() { + epoch := UnixTime(UnixEpoch()) + text, _ := json.Marshal(epoch) + fmt.Print(string(text)) + // Output: 0 +} + +func ExampleUnixTime_UnmarshalJSON() { + var myTime UnixTime + json.Unmarshal([]byte("1.3e2"), &myTime) + fmt.Printf("%v", time.Time(myTime)) + // Output: 1970-01-01 00:02:10 +0000 UTC +} + +func TestUnixTime_MarshalJSON(t *testing.T) { + testCases := []time.Time{ + UnixEpoch().Add(-1 * time.Second), // One second befote the Unix Epoch + time.Date(2017, time.April, 14, 20, 27, 47, 0, time.UTC), // The time this test was written + UnixEpoch(), + time.Date(1800, 01, 01, 0, 0, 0, 0, time.UTC), + time.Date(2200, 12, 29, 00, 01, 37, 82, time.UTC), + } + + for _, tc := range testCases { + t.Run(tc.String(), func(subT *testing.T) { + var actual, expected float64 + var marshaled []byte + + target := UnixTime(tc) + expected = float64(target.Duration().Nanoseconds()) / 1e9 + + if temp, err := json.Marshal(target); err == nil { + marshaled = temp + } else { + subT.Error(err) + return + } + + dec := json.NewDecoder(bytes.NewReader(marshaled)) + if err := dec.Decode(&actual); err != nil { + subT.Error(err) + return + } + + diff := math.Abs(actual - expected) + subT.Logf("\ngot :\t%g\nwant:\t%g\ndiff:\t%g", actual, expected, diff) + if diff > 1e-9 { //Must be within 1 nanosecond of one another + subT.Fail() + } + }) + } +} + +func TestUnixTime_UnmarshalJSON(t *testing.T) { + testCases := []struct { + text string + expected time.Time + }{ + {"1", UnixEpoch().Add(time.Second)}, + {"0", UnixEpoch()}, + {"1492203742", time.Date(2017, time.April, 14, 21, 02, 22, 0, time.UTC)}, // The time this test was written + {"-1", time.Date(1969, time.December, 31, 23, 59, 59, 0, time.UTC)}, + {"1.5", UnixEpoch().Add(1500 * time.Millisecond)}, + {"0e1", UnixEpoch()}, // See http://json.org for 'number' format definition. + {"1.3e+2", UnixEpoch().Add(130 * time.Second)}, + {"1.6E-10", UnixEpoch()}, // This is so small, it should get truncated into the UnixEpoch + {"2E-6", UnixEpoch().Add(2 * time.Microsecond)}, + {"1.289345e9", UnixEpoch().Add(1289345000 * time.Second)}, + {"1e-9", UnixEpoch().Add(time.Nanosecond)}, + } + + for _, tc := range testCases { + t.Run(tc.text, func(subT *testing.T) { + var rehydrated UnixTime + if err := json.Unmarshal([]byte(tc.text), &rehydrated); err != nil { + subT.Error(err) + return + } + + if time.Time(rehydrated) != tc.expected { + subT.Logf("\ngot: \t%v\nwant:\t%v\ndiff:\t%v", time.Time(rehydrated), tc.expected, time.Time(rehydrated).Sub(tc.expected)) + subT.Fail() + } + }) + } +} + +func TestUnixTime_JSONRoundTrip(t *testing.T) { + testCases := []time.Time{ + UnixEpoch(), + time.Date(2005, time.November, 5, 0, 0, 0, 0, time.UTC), // The day V for Vendetta (film) was released. + UnixEpoch().Add(-6 * time.Second), + UnixEpoch().Add(800 * time.Hour), + UnixEpoch().Add(time.Nanosecond), + time.Date(2015, time.September, 05, 4, 30, 12, 9992, time.UTC), + } + + for _, tc := range testCases { + t.Run(tc.String(), func(subT *testing.T) { + subject := UnixTime(tc) + var marshaled []byte + if temp, err := json.Marshal(subject); err == nil { + marshaled = temp + } else { + subT.Error(err) + return + } + + var unmarshaled UnixTime + if err := json.Unmarshal(marshaled, &unmarshaled); err != nil { + subT.Error(err) + } + + actual := time.Time(unmarshaled) + diff := actual.Sub(tc) + subT.Logf("\ngot :\t%s\nwant:\t%s\ndiff:\t%s", actual.String(), tc.String(), diff.String()) + + if diff > time.Duration(100) { // We lose some precision be working in floats. We shouldn't lose more than 100 nanoseconds. + subT.Fail() + } + }) + } +} + +func TestUnixTime_MarshalBinary(t *testing.T) { + testCases := []struct { + expected int64 + subject time.Time + }{ + {0, UnixEpoch()}, + {-15 * int64(time.Second), UnixEpoch().Add(-15 * time.Second)}, + {54, UnixEpoch().Add(54 * time.Nanosecond)}, + } + + for _, tc := range testCases { + t.Run("", func(subT *testing.T) { + var marshaled []byte + + if temp, err := UnixTime(tc.subject).MarshalBinary(); err == nil { + marshaled = temp + } else { + subT.Error(err) + return + } + + var unmarshaled int64 + if err := binary.Read(bytes.NewReader(marshaled), binary.LittleEndian, &unmarshaled); err != nil { + subT.Error(err) + return + } + + if unmarshaled != tc.expected { + subT.Logf("\ngot: \t%d\nwant:\t%d", unmarshaled, tc.expected) + subT.Fail() + } + }) + } +} + +func TestUnixTime_BinaryRoundTrip(t *testing.T) { + testCases := []time.Time{ + UnixEpoch(), + UnixEpoch().Add(800 * time.Minute), + UnixEpoch().Add(7 * time.Hour), + UnixEpoch().Add(-1 * time.Nanosecond), + } + + for _, tc := range testCases { + t.Run(tc.String(), func(subT *testing.T) { + original := UnixTime(tc) + var marshaled []byte + + if temp, err := original.MarshalBinary(); err == nil { + marshaled = temp + } else { + subT.Error(err) + return + } + + var traveled UnixTime + if err := traveled.UnmarshalBinary(marshaled); err != nil { + subT.Error(err) + return + } + + if traveled != original { + subT.Logf("\ngot: \t%s\nwant:\t%s", time.Time(original).String(), time.Time(traveled).String()) + subT.Fail() + } + }) + } +} + +func TestUnixTime_MarshalText(t *testing.T) { + testCases := []time.Time{ + UnixEpoch(), + UnixEpoch().Add(45 * time.Second), + UnixEpoch().Add(time.Nanosecond), + UnixEpoch().Add(-100000 * time.Second), + } + + for _, tc := range testCases { + expected, _ := tc.MarshalText() + t.Run("", func(subT *testing.T) { + var marshaled []byte + + if temp, err := UnixTime(tc).MarshalText(); err == nil { + marshaled = temp + } else { + subT.Error(err) + return + } + + if string(marshaled) != string(expected) { + subT.Logf("\ngot: \t%s\nwant:\t%s", string(marshaled), string(expected)) + subT.Fail() + } + }) + } +} + +func TestUnixTime_TextRoundTrip(t *testing.T) { + testCases := []time.Time{ + UnixEpoch(), + UnixEpoch().Add(-1 * time.Nanosecond), + UnixEpoch().Add(1 * time.Nanosecond), + time.Date(2017, time.April, 17, 21, 00, 00, 00, time.UTC), + } + + for _, tc := range testCases { + t.Run(tc.String(), func(subT *testing.T) { + unixTC := UnixTime(tc) + + var marshaled []byte + + if temp, err := unixTC.MarshalText(); err == nil { + marshaled = temp + } else { + subT.Error(err) + return + } + + var unmarshaled UnixTime + if err := unmarshaled.UnmarshalText(marshaled); err != nil { + subT.Error(err) + return + } + + if unmarshaled != unixTC { + t.Logf("\ngot: \t%s\nwant:\t%s", time.Time(unmarshaled).String(), tc.String()) + t.Fail() + } + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go index 70bc76870a..207b1a240a 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go +++ b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go @@ -1,11 +1,11 @@ -package date - -import ( - "strings" - "time" -) - -// ParseTime to parse Time string to specified format. -func ParseTime(format string, t string) (d time.Time, err error) { - return time.Parse(format, strings.ToUpper(t)) -} +package date + +import ( + "strings" + "time" +) + +// ParseTime to parse Time string to specified format. +func ParseTime(format string, t string) (d time.Time, err error) { + return time.Parse(format, strings.ToUpper(t)) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/error.go b/vendor/github.com/Azure/go-autorest/autorest/error.go index 2c54ec862e..4bcb8f27b2 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/error.go +++ b/vendor/github.com/Azure/go-autorest/autorest/error.go @@ -1,80 +1,80 @@ -package autorest - -import ( - "fmt" - "net/http" -) - -const ( - // UndefinedStatusCode is used when HTTP status code is not available for an error. - UndefinedStatusCode = 0 -) - -// DetailedError encloses a error with details of the package, method, and associated HTTP -// status code (if any). -type DetailedError struct { - Original error - - // PackageType is the package type of the object emitting the error. For types, the value - // matches that produced the the '%T' format specifier of the fmt package. For other elements, - // such as functions, it is just the package name (e.g., "autorest"). - PackageType string - - // Method is the name of the method raising the error. - Method string - - // StatusCode is the HTTP Response StatusCode (if non-zero) that led to the error. - StatusCode interface{} - - // Message is the error message. - Message string - - // Service Error is the response body of failed API in bytes - ServiceError []byte -} - -// NewError creates a new Error conforming object from the passed packageType, method, and -// message. message is treated as a format string to which the optional args apply. -func NewError(packageType string, method string, message string, args ...interface{}) DetailedError { - return NewErrorWithError(nil, packageType, method, nil, message, args...) -} - -// NewErrorWithResponse creates a new Error conforming object from the passed -// packageType, method, statusCode of the given resp (UndefinedStatusCode if -// resp is nil), and message. message is treated as a format string to which the -// optional args apply. -func NewErrorWithResponse(packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { - return NewErrorWithError(nil, packageType, method, resp, message, args...) -} - -// NewErrorWithError creates a new Error conforming object from the -// passed packageType, method, statusCode of the given resp (UndefinedStatusCode -// if resp is nil), message, and original error. message is treated as a format -// string to which the optional args apply. -func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { - if v, ok := original.(DetailedError); ok { - return v - } - - statusCode := UndefinedStatusCode - if resp != nil { - statusCode = resp.StatusCode - } - - return DetailedError{ - Original: original, - PackageType: packageType, - Method: method, - StatusCode: statusCode, - Message: fmt.Sprintf(message, args...), - } -} - -// Error returns a formatted containing all available details (i.e., PackageType, Method, -// StatusCode, Message, and original error (if any)). -func (e DetailedError) Error() string { - if e.Original == nil { - return fmt.Sprintf("%s#%s: %s: StatusCode=%d", e.PackageType, e.Method, e.Message, e.StatusCode) - } - return fmt.Sprintf("%s#%s: %s: StatusCode=%d -- Original Error: %v", e.PackageType, e.Method, e.Message, e.StatusCode, e.Original) -} +package autorest + +import ( + "fmt" + "net/http" +) + +const ( + // UndefinedStatusCode is used when HTTP status code is not available for an error. + UndefinedStatusCode = 0 +) + +// DetailedError encloses a error with details of the package, method, and associated HTTP +// status code (if any). +type DetailedError struct { + Original error + + // PackageType is the package type of the object emitting the error. For types, the value + // matches that produced the the '%T' format specifier of the fmt package. For other elements, + // such as functions, it is just the package name (e.g., "autorest"). + PackageType string + + // Method is the name of the method raising the error. + Method string + + // StatusCode is the HTTP Response StatusCode (if non-zero) that led to the error. + StatusCode interface{} + + // Message is the error message. + Message string + + // Service Error is the response body of failed API in bytes + ServiceError []byte +} + +// NewError creates a new Error conforming object from the passed packageType, method, and +// message. message is treated as a format string to which the optional args apply. +func NewError(packageType string, method string, message string, args ...interface{}) DetailedError { + return NewErrorWithError(nil, packageType, method, nil, message, args...) +} + +// NewErrorWithResponse creates a new Error conforming object from the passed +// packageType, method, statusCode of the given resp (UndefinedStatusCode if +// resp is nil), and message. message is treated as a format string to which the +// optional args apply. +func NewErrorWithResponse(packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { + return NewErrorWithError(nil, packageType, method, resp, message, args...) +} + +// NewErrorWithError creates a new Error conforming object from the +// passed packageType, method, statusCode of the given resp (UndefinedStatusCode +// if resp is nil), message, and original error. message is treated as a format +// string to which the optional args apply. +func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { + if v, ok := original.(DetailedError); ok { + return v + } + + statusCode := UndefinedStatusCode + if resp != nil { + statusCode = resp.StatusCode + } + + return DetailedError{ + Original: original, + PackageType: packageType, + Method: method, + StatusCode: statusCode, + Message: fmt.Sprintf(message, args...), + } +} + +// Error returns a formatted containing all available details (i.e., PackageType, Method, +// StatusCode, Message, and original error (if any)). +func (e DetailedError) Error() string { + if e.Original == nil { + return fmt.Sprintf("%s#%s: %s: StatusCode=%d", e.PackageType, e.Method, e.Message, e.StatusCode) + } + return fmt.Sprintf("%s#%s: %s: StatusCode=%d -- Original Error: %v", e.PackageType, e.Method, e.Message, e.StatusCode, e.Original) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/error_test.go b/vendor/github.com/Azure/go-autorest/autorest/error_test.go index 73913a9117..1975155ad0 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/error_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/error_test.go @@ -1,188 +1,188 @@ -package autorest - -import ( - "fmt" - "net/http" - "reflect" - "regexp" - "testing" -) - -func TestNewErrorWithError_AssignsPackageType(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if e.PackageType != "packageType" { - t.Fatalf("autorest: Error failed to set package type -- expected %v, received %v", "packageType", e.PackageType) - } -} - -func TestNewErrorWithError_AssignsMethod(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if e.Method != "method" { - t.Fatalf("autorest: Error failed to set method -- expected %v, received %v", "method", e.Method) - } -} - -func TestNewErrorWithError_AssignsMessage(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if e.Message != "message" { - t.Fatalf("autorest: Error failed to set message -- expected %v, received %v", "message", e.Message) - } -} - -func TestNewErrorWithError_AssignsUndefinedStatusCodeIfRespNil(t *testing.T) { - e := NewErrorWithError(nil, "packageType", "method", nil, "message") - if e.StatusCode != UndefinedStatusCode { - t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", UndefinedStatusCode, e.StatusCode) - } -} - -func TestNewErrorWithError_AssignsStatusCode(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", &http.Response{ - StatusCode: http.StatusBadRequest, - Status: http.StatusText(http.StatusBadRequest)}, "message") - - if e.StatusCode != http.StatusBadRequest { - t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", http.StatusBadRequest, e.StatusCode) - } -} - -func TestNewErrorWithError_AcceptsArgs(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message %s", "arg") - - if matched, _ := regexp.MatchString(`.*arg.*`, e.Message); !matched { - t.Fatalf("autorest: Error failed to apply message arguments -- expected %v, received %v", - `.*arg.*`, e.Message) - } -} - -func TestNewErrorWithError_AssignsError(t *testing.T) { - err := fmt.Errorf("original") - e := NewErrorWithError(err, "packageType", "method", nil, "message") - - if e.Original != err { - t.Fatalf("autorest: Error failed to set error -- expected %v, received %v", err, e.Original) - } -} - -func TestNewErrorWithResponse_ContainsStatusCode(t *testing.T) { - e := NewErrorWithResponse("packageType", "method", &http.Response{ - StatusCode: http.StatusBadRequest, - Status: http.StatusText(http.StatusBadRequest)}, "message") - - if e.StatusCode != http.StatusBadRequest { - t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", http.StatusBadRequest, e.StatusCode) - } -} - -func TestNewErrorWithResponse_nilResponse_ReportsUndefinedStatusCode(t *testing.T) { - e := NewErrorWithResponse("packageType", "method", nil, "message") - - if e.StatusCode != UndefinedStatusCode { - t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", UndefinedStatusCode, e.StatusCode) - } -} - -func TestNewErrorWithResponse_Forwards(t *testing.T) { - e1 := NewError("packageType", "method", "message %s", "arg") - e2 := NewErrorWithResponse("packageType", "method", nil, "message %s", "arg") - - if !reflect.DeepEqual(e1, e2) { - t.Fatal("autorest: NewError did not return an error equivelent to NewErrorWithError") - } -} - -func TestNewErrorWithError_Forwards(t *testing.T) { - e1 := NewError("packageType", "method", "message %s", "arg") - e2 := NewErrorWithError(nil, "packageType", "method", nil, "message %s", "arg") - - if !reflect.DeepEqual(e1, e2) { - t.Fatal("autorest: NewError did not return an error equivelent to NewErrorWithError") - } -} - -func TestNewErrorWithError_DoesNotWrapADetailedError(t *testing.T) { - e1 := NewError("packageType1", "method1", "message1 %s", "arg1") - e2 := NewErrorWithError(e1, "packageType2", "method2", nil, "message2 %s", "arg2") - - if !reflect.DeepEqual(e1, e2) { - t.Fatalf("autorest: NewErrorWithError incorrectly wrapped a DetailedError -- expected %v, received %v", e1, e2) - } -} - -func TestNewErrorWithError_WrapsAnError(t *testing.T) { - e1 := fmt.Errorf("Inner Error") - var e2 interface{} = NewErrorWithError(e1, "packageType", "method", nil, "message") - - if _, ok := e2.(DetailedError); !ok { - t.Fatalf("autorest: NewErrorWithError failed to wrap a standard error -- received %T", e2) - } -} - -func TestDetailedError(t *testing.T) { - err := fmt.Errorf("original") - e := NewErrorWithError(err, "packageType", "method", nil, "message") - - if matched, _ := regexp.MatchString(`.*original.*`, e.Error()); !matched { - t.Fatalf("autorest: Error#Error failed to return original error message -- expected %v, received %v", - `.*original.*`, e.Error()) - } -} - -func TestDetailedErrorConstainsPackageType(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if matched, _ := regexp.MatchString(`.*packageType.*`, e.Error()); !matched { - t.Fatalf("autorest: Error#String failed to include PackageType -- expected %v, received %v", - `.*packageType.*`, e.Error()) - } -} - -func TestDetailedErrorConstainsMethod(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if matched, _ := regexp.MatchString(`.*method.*`, e.Error()); !matched { - t.Fatalf("autorest: Error#String failed to include Method -- expected %v, received %v", - `.*method.*`, e.Error()) - } -} - -func TestDetailedErrorConstainsMessage(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if matched, _ := regexp.MatchString(`.*message.*`, e.Error()); !matched { - t.Fatalf("autorest: Error#String failed to include Message -- expected %v, received %v", - `.*message.*`, e.Error()) - } -} - -func TestDetailedErrorConstainsStatusCode(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", &http.Response{ - StatusCode: http.StatusBadRequest, - Status: http.StatusText(http.StatusBadRequest)}, "message") - - if matched, _ := regexp.MatchString(`.*400.*`, e.Error()); !matched { - t.Fatalf("autorest: Error#String failed to include Status Code -- expected %v, received %v", - `.*400.*`, e.Error()) - } -} - -func TestDetailedErrorConstainsOriginal(t *testing.T) { - e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") - - if matched, _ := regexp.MatchString(`.*original.*`, e.Error()); !matched { - t.Fatalf("autorest: Error#String failed to include Original error -- expected %v, received %v", - `.*original.*`, e.Error()) - } -} - -func TestDetailedErrorSkipsOriginal(t *testing.T) { - e := NewError("packageType", "method", "message") - - if matched, _ := regexp.MatchString(`.*Original.*`, e.Error()); matched { - t.Fatalf("autorest: Error#String included missing Original error -- unexpected %v, received %v", - `.*Original.*`, e.Error()) - } -} +package autorest + +import ( + "fmt" + "net/http" + "reflect" + "regexp" + "testing" +) + +func TestNewErrorWithError_AssignsPackageType(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if e.PackageType != "packageType" { + t.Fatalf("autorest: Error failed to set package type -- expected %v, received %v", "packageType", e.PackageType) + } +} + +func TestNewErrorWithError_AssignsMethod(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if e.Method != "method" { + t.Fatalf("autorest: Error failed to set method -- expected %v, received %v", "method", e.Method) + } +} + +func TestNewErrorWithError_AssignsMessage(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if e.Message != "message" { + t.Fatalf("autorest: Error failed to set message -- expected %v, received %v", "message", e.Message) + } +} + +func TestNewErrorWithError_AssignsUndefinedStatusCodeIfRespNil(t *testing.T) { + e := NewErrorWithError(nil, "packageType", "method", nil, "message") + if e.StatusCode != UndefinedStatusCode { + t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", UndefinedStatusCode, e.StatusCode) + } +} + +func TestNewErrorWithError_AssignsStatusCode(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", &http.Response{ + StatusCode: http.StatusBadRequest, + Status: http.StatusText(http.StatusBadRequest)}, "message") + + if e.StatusCode != http.StatusBadRequest { + t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", http.StatusBadRequest, e.StatusCode) + } +} + +func TestNewErrorWithError_AcceptsArgs(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message %s", "arg") + + if matched, _ := regexp.MatchString(`.*arg.*`, e.Message); !matched { + t.Fatalf("autorest: Error failed to apply message arguments -- expected %v, received %v", + `.*arg.*`, e.Message) + } +} + +func TestNewErrorWithError_AssignsError(t *testing.T) { + err := fmt.Errorf("original") + e := NewErrorWithError(err, "packageType", "method", nil, "message") + + if e.Original != err { + t.Fatalf("autorest: Error failed to set error -- expected %v, received %v", err, e.Original) + } +} + +func TestNewErrorWithResponse_ContainsStatusCode(t *testing.T) { + e := NewErrorWithResponse("packageType", "method", &http.Response{ + StatusCode: http.StatusBadRequest, + Status: http.StatusText(http.StatusBadRequest)}, "message") + + if e.StatusCode != http.StatusBadRequest { + t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", http.StatusBadRequest, e.StatusCode) + } +} + +func TestNewErrorWithResponse_nilResponse_ReportsUndefinedStatusCode(t *testing.T) { + e := NewErrorWithResponse("packageType", "method", nil, "message") + + if e.StatusCode != UndefinedStatusCode { + t.Fatalf("autorest: Error failed to set status code -- expected %v, received %v", UndefinedStatusCode, e.StatusCode) + } +} + +func TestNewErrorWithResponse_Forwards(t *testing.T) { + e1 := NewError("packageType", "method", "message %s", "arg") + e2 := NewErrorWithResponse("packageType", "method", nil, "message %s", "arg") + + if !reflect.DeepEqual(e1, e2) { + t.Fatal("autorest: NewError did not return an error equivelent to NewErrorWithError") + } +} + +func TestNewErrorWithError_Forwards(t *testing.T) { + e1 := NewError("packageType", "method", "message %s", "arg") + e2 := NewErrorWithError(nil, "packageType", "method", nil, "message %s", "arg") + + if !reflect.DeepEqual(e1, e2) { + t.Fatal("autorest: NewError did not return an error equivelent to NewErrorWithError") + } +} + +func TestNewErrorWithError_DoesNotWrapADetailedError(t *testing.T) { + e1 := NewError("packageType1", "method1", "message1 %s", "arg1") + e2 := NewErrorWithError(e1, "packageType2", "method2", nil, "message2 %s", "arg2") + + if !reflect.DeepEqual(e1, e2) { + t.Fatalf("autorest: NewErrorWithError incorrectly wrapped a DetailedError -- expected %v, received %v", e1, e2) + } +} + +func TestNewErrorWithError_WrapsAnError(t *testing.T) { + e1 := fmt.Errorf("Inner Error") + var e2 interface{} = NewErrorWithError(e1, "packageType", "method", nil, "message") + + if _, ok := e2.(DetailedError); !ok { + t.Fatalf("autorest: NewErrorWithError failed to wrap a standard error -- received %T", e2) + } +} + +func TestDetailedError(t *testing.T) { + err := fmt.Errorf("original") + e := NewErrorWithError(err, "packageType", "method", nil, "message") + + if matched, _ := regexp.MatchString(`.*original.*`, e.Error()); !matched { + t.Fatalf("autorest: Error#Error failed to return original error message -- expected %v, received %v", + `.*original.*`, e.Error()) + } +} + +func TestDetailedErrorConstainsPackageType(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if matched, _ := regexp.MatchString(`.*packageType.*`, e.Error()); !matched { + t.Fatalf("autorest: Error#String failed to include PackageType -- expected %v, received %v", + `.*packageType.*`, e.Error()) + } +} + +func TestDetailedErrorConstainsMethod(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if matched, _ := regexp.MatchString(`.*method.*`, e.Error()); !matched { + t.Fatalf("autorest: Error#String failed to include Method -- expected %v, received %v", + `.*method.*`, e.Error()) + } +} + +func TestDetailedErrorConstainsMessage(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if matched, _ := regexp.MatchString(`.*message.*`, e.Error()); !matched { + t.Fatalf("autorest: Error#String failed to include Message -- expected %v, received %v", + `.*message.*`, e.Error()) + } +} + +func TestDetailedErrorConstainsStatusCode(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", &http.Response{ + StatusCode: http.StatusBadRequest, + Status: http.StatusText(http.StatusBadRequest)}, "message") + + if matched, _ := regexp.MatchString(`.*400.*`, e.Error()); !matched { + t.Fatalf("autorest: Error#String failed to include Status Code -- expected %v, received %v", + `.*400.*`, e.Error()) + } +} + +func TestDetailedErrorConstainsOriginal(t *testing.T) { + e := NewErrorWithError(fmt.Errorf("original"), "packageType", "method", nil, "message") + + if matched, _ := regexp.MatchString(`.*original.*`, e.Error()); !matched { + t.Fatalf("autorest: Error#String failed to include Original error -- expected %v, received %v", + `.*original.*`, e.Error()) + } +} + +func TestDetailedErrorSkipsOriginal(t *testing.T) { + e := NewError("packageType", "method", "message") + + if matched, _ := regexp.MatchString(`.*Original.*`, e.Error()); matched { + t.Fatalf("autorest: Error#String included missing Original error -- unexpected %v, received %v", + `.*Original.*`, e.Error()) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go index 60324738a5..add894605b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers.go @@ -1,137 +1,137 @@ -package mocks - -import ( - "fmt" - "net/http" - "time" -) - -const ( - // TestAuthorizationHeader is a faux HTTP Authorization header value - TestAuthorizationHeader = "BEARER SECRETTOKEN" - - // TestBadURL is a malformed URL - TestBadURL = " " - - // TestDelay is the Retry-After delay used in tests. - TestDelay = 0 * time.Second - - // TestHeader is the header used in tests. - TestHeader = "x-test-header" - - // TestURL is the URL used in tests. - TestURL = "https://microsoft.com/a/b/c/" - - // TestAzureAsyncURL is a URL used in Azure asynchronous tests - TestAzureAsyncURL = "https://microsoft.com/a/b/c/async" - - // TestLocationURL is a URL used in Azure asynchronous tests - TestLocationURL = "https://microsoft.com/a/b/c/location" -) - -const ( - headerLocation = "Location" - headerRetryAfter = "Retry-After" -) - -// NewRequest instantiates a new request. -func NewRequest() *http.Request { - return NewRequestWithContent("") -} - -// NewRequestWithContent instantiates a new request using the passed string for the body content. -func NewRequestWithContent(c string) *http.Request { - r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBody(c)) - return r -} - -// NewRequestWithCloseBody instantiates a new request. -func NewRequestWithCloseBody() *http.Request { - return NewRequestWithCloseBodyContent("request body") -} - -// NewRequestWithCloseBodyContent instantiates a new request using the passed string for the body content. -func NewRequestWithCloseBodyContent(c string) *http.Request { - r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBodyClose(c)) - return r -} - -// NewRequestForURL instantiates a new request using the passed URL. -func NewRequestForURL(u string) *http.Request { - r, err := http.NewRequest("GET", u, NewBody("")) - if err != nil { - panic(fmt.Sprintf("mocks: ERROR (%v) parsing testing URL %s", err, u)) - } - return r -} - -// NewResponse instantiates a new response. -func NewResponse() *http.Response { - return NewResponseWithContent("") -} - -// NewResponseWithContent instantiates a new response with the passed string as the body content. -func NewResponseWithContent(c string) *http.Response { - return &http.Response{ - Status: "200 OK", - StatusCode: 200, - Proto: "HTTP/1.0", - ProtoMajor: 1, - ProtoMinor: 0, - Body: NewBody(c), - Request: NewRequest(), - } -} - -// NewResponseWithStatus instantiates a new response using the passed string and integer as the -// status and status code. -func NewResponseWithStatus(s string, c int) *http.Response { - resp := NewResponse() - resp.Status = s - resp.StatusCode = c - return resp -} - -// NewResponseWithBodyAndStatus instantiates a new response using the specified mock body, -// status and status code -func NewResponseWithBodyAndStatus(body *Body, c int, s string) *http.Response { - resp := NewResponse() - resp.Body = body - resp.Status = s - resp.StatusCode = c - return resp -} - -// SetResponseHeader adds a header to the passed response. -func SetResponseHeader(resp *http.Response, h string, v string) { - if resp.Header == nil { - resp.Header = make(http.Header) - } - resp.Header.Set(h, v) -} - -// SetResponseHeaderValues adds a header containing all the passed string values. -func SetResponseHeaderValues(resp *http.Response, h string, values []string) { - if resp.Header == nil { - resp.Header = make(http.Header) - } - for _, v := range values { - resp.Header.Add(h, v) - } -} - -// SetAcceptedHeaders adds the headers usually associated with a 202 Accepted response. -func SetAcceptedHeaders(resp *http.Response) { - SetLocationHeader(resp, TestURL) - SetRetryHeader(resp, TestDelay) -} - -// SetLocationHeader adds the Location header. -func SetLocationHeader(resp *http.Response, location string) { - SetResponseHeader(resp, http.CanonicalHeaderKey(headerLocation), location) -} - -// SetRetryHeader adds the Retry-After header. -func SetRetryHeader(resp *http.Response, delay time.Duration) { - SetResponseHeader(resp, http.CanonicalHeaderKey(headerRetryAfter), fmt.Sprintf("%v", delay.Seconds())) -} +package mocks + +import ( + "fmt" + "net/http" + "time" +) + +const ( + // TestAuthorizationHeader is a faux HTTP Authorization header value + TestAuthorizationHeader = "BEARER SECRETTOKEN" + + // TestBadURL is a malformed URL + TestBadURL = " " + + // TestDelay is the Retry-After delay used in tests. + TestDelay = 0 * time.Second + + // TestHeader is the header used in tests. + TestHeader = "x-test-header" + + // TestURL is the URL used in tests. + TestURL = "https://microsoft.com/a/b/c/" + + // TestAzureAsyncURL is a URL used in Azure asynchronous tests + TestAzureAsyncURL = "https://microsoft.com/a/b/c/async" + + // TestLocationURL is a URL used in Azure asynchronous tests + TestLocationURL = "https://microsoft.com/a/b/c/location" +) + +const ( + headerLocation = "Location" + headerRetryAfter = "Retry-After" +) + +// NewRequest instantiates a new request. +func NewRequest() *http.Request { + return NewRequestWithContent("") +} + +// NewRequestWithContent instantiates a new request using the passed string for the body content. +func NewRequestWithContent(c string) *http.Request { + r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBody(c)) + return r +} + +// NewRequestWithCloseBody instantiates a new request. +func NewRequestWithCloseBody() *http.Request { + return NewRequestWithCloseBodyContent("request body") +} + +// NewRequestWithCloseBodyContent instantiates a new request using the passed string for the body content. +func NewRequestWithCloseBodyContent(c string) *http.Request { + r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBodyClose(c)) + return r +} + +// NewRequestForURL instantiates a new request using the passed URL. +func NewRequestForURL(u string) *http.Request { + r, err := http.NewRequest("GET", u, NewBody("")) + if err != nil { + panic(fmt.Sprintf("mocks: ERROR (%v) parsing testing URL %s", err, u)) + } + return r +} + +// NewResponse instantiates a new response. +func NewResponse() *http.Response { + return NewResponseWithContent("") +} + +// NewResponseWithContent instantiates a new response with the passed string as the body content. +func NewResponseWithContent(c string) *http.Response { + return &http.Response{ + Status: "200 OK", + StatusCode: 200, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + Body: NewBody(c), + Request: NewRequest(), + } +} + +// NewResponseWithStatus instantiates a new response using the passed string and integer as the +// status and status code. +func NewResponseWithStatus(s string, c int) *http.Response { + resp := NewResponse() + resp.Status = s + resp.StatusCode = c + return resp +} + +// NewResponseWithBodyAndStatus instantiates a new response using the specified mock body, +// status and status code +func NewResponseWithBodyAndStatus(body *Body, c int, s string) *http.Response { + resp := NewResponse() + resp.Body = body + resp.Status = s + resp.StatusCode = c + return resp +} + +// SetResponseHeader adds a header to the passed response. +func SetResponseHeader(resp *http.Response, h string, v string) { + if resp.Header == nil { + resp.Header = make(http.Header) + } + resp.Header.Set(h, v) +} + +// SetResponseHeaderValues adds a header containing all the passed string values. +func SetResponseHeaderValues(resp *http.Response, h string, values []string) { + if resp.Header == nil { + resp.Header = make(http.Header) + } + for _, v := range values { + resp.Header.Add(h, v) + } +} + +// SetAcceptedHeaders adds the headers usually associated with a 202 Accepted response. +func SetAcceptedHeaders(resp *http.Response) { + SetLocationHeader(resp, TestURL) + SetRetryHeader(resp, TestDelay) +} + +// SetLocationHeader adds the Location header. +func SetLocationHeader(resp *http.Response, location string) { + SetResponseHeader(resp, http.CanonicalHeaderKey(headerLocation), location) +} + +// SetRetryHeader adds the Retry-After header. +func SetRetryHeader(resp *http.Response, delay time.Duration) { + SetResponseHeader(resp, http.CanonicalHeaderKey(headerRetryAfter), fmt.Sprintf("%v", delay.Seconds())) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers_test.go b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers_test.go index 0331bd9b36..f726b26e5b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/helpers_test.go @@ -1 +1 @@ -package mocks +package mocks diff --git a/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks.go b/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks.go index 71601c263e..dc3dd3b93e 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks.go +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks.go @@ -1,162 +1,162 @@ -/* -Package mocks provides mocks and helpers used in testing. -*/ -package mocks - -import ( - "fmt" - "io" - "net/http" -) - -// Body implements acceptable body over a string. -type Body struct { - s string - b []byte - isOpen bool - closeAttempts int -} - -// NewBody creates a new instance of Body. -func NewBody(s string) *Body { - return (&Body{s: s}).reset() -} - -// NewBodyClose creates a new instance of Body. -func NewBodyClose(s string) *Body { - return &Body{s: s} -} - -// Read reads into the passed byte slice and returns the bytes read. -func (body *Body) Read(b []byte) (n int, err error) { - if !body.IsOpen() { - return 0, fmt.Errorf("ERROR: Body has been closed") - } - if len(body.b) == 0 { - return 0, io.EOF - } - n = copy(b, body.b) - body.b = body.b[n:] - return n, nil -} - -// Close closes the body. -func (body *Body) Close() error { - if body.isOpen { - body.isOpen = false - body.closeAttempts++ - } - return nil -} - -// CloseAttempts returns the number of times Close was called. -func (body *Body) CloseAttempts() int { - return body.closeAttempts -} - -// IsOpen returns true if the Body has not been closed, false otherwise. -func (body *Body) IsOpen() bool { - return body.isOpen -} - -func (body *Body) reset() *Body { - body.isOpen = true - body.b = []byte(body.s) - return body -} - -// Sender implements a simple null sender. -type Sender struct { - attempts int - responses []*http.Response - repeatResponse []int - err error - repeatError int - emitErrorAfter int -} - -// NewSender creates a new instance of Sender. -func NewSender() *Sender { - return &Sender{} -} - -// Do accepts the passed request and, based on settings, emits a response and possible error. -func (c *Sender) Do(r *http.Request) (resp *http.Response, err error) { - c.attempts++ - - if len(c.responses) > 0 { - resp = c.responses[0] - if resp != nil { - if b, ok := resp.Body.(*Body); ok { - b.reset() - } - } - c.repeatResponse[0]-- - if c.repeatResponse[0] == 0 { - c.responses = c.responses[1:] - c.repeatResponse = c.repeatResponse[1:] - } - } else { - resp = NewResponse() - } - if resp != nil { - resp.Request = r - } - - if c.emitErrorAfter > 0 { - c.emitErrorAfter-- - } else if c.err != nil { - err = c.err - c.repeatError-- - if c.repeatError == 0 { - c.err = nil - } - } - - return -} - -// AppendResponse adds the passed http.Response to the response stack. -func (c *Sender) AppendResponse(resp *http.Response) { - c.AppendAndRepeatResponse(resp, 1) -} - -// AppendAndRepeatResponse adds the passed http.Response to the response stack along with a -// repeat count. A negative repeat count will return the response for all remaining calls to Do. -func (c *Sender) AppendAndRepeatResponse(resp *http.Response, repeat int) { - if c.responses == nil { - c.responses = []*http.Response{resp} - c.repeatResponse = []int{repeat} - } else { - c.responses = append(c.responses, resp) - c.repeatResponse = append(c.repeatResponse, repeat) - } -} - -// Attempts returns the number of times Do was called. -func (c *Sender) Attempts() int { - return c.attempts -} - -// SetError sets the error Do should return. -func (c *Sender) SetError(err error) { - c.SetAndRepeatError(err, 1) -} - -// SetAndRepeatError sets the error Do should return and how many calls to Do will return the error. -// A negative repeat value will return the error for all remaining calls to Do. -func (c *Sender) SetAndRepeatError(err error, repeat int) { - c.err = err - c.repeatError = repeat -} - -// SetEmitErrorAfter sets the number of attempts to be made before errors are emitted. -func (c *Sender) SetEmitErrorAfter(ea int) { - c.emitErrorAfter = ea -} - -// T is a simple testing struct. -type T struct { - Name string `json:"name" xml:"Name"` - Age int `json:"age" xml:"Age"` -} +/* +Package mocks provides mocks and helpers used in testing. +*/ +package mocks + +import ( + "fmt" + "io" + "net/http" +) + +// Body implements acceptable body over a string. +type Body struct { + s string + b []byte + isOpen bool + closeAttempts int +} + +// NewBody creates a new instance of Body. +func NewBody(s string) *Body { + return (&Body{s: s}).reset() +} + +// NewBodyClose creates a new instance of Body. +func NewBodyClose(s string) *Body { + return &Body{s: s} +} + +// Read reads into the passed byte slice and returns the bytes read. +func (body *Body) Read(b []byte) (n int, err error) { + if !body.IsOpen() { + return 0, fmt.Errorf("ERROR: Body has been closed") + } + if len(body.b) == 0 { + return 0, io.EOF + } + n = copy(b, body.b) + body.b = body.b[n:] + return n, nil +} + +// Close closes the body. +func (body *Body) Close() error { + if body.isOpen { + body.isOpen = false + body.closeAttempts++ + } + return nil +} + +// CloseAttempts returns the number of times Close was called. +func (body *Body) CloseAttempts() int { + return body.closeAttempts +} + +// IsOpen returns true if the Body has not been closed, false otherwise. +func (body *Body) IsOpen() bool { + return body.isOpen +} + +func (body *Body) reset() *Body { + body.isOpen = true + body.b = []byte(body.s) + return body +} + +// Sender implements a simple null sender. +type Sender struct { + attempts int + responses []*http.Response + repeatResponse []int + err error + repeatError int + emitErrorAfter int +} + +// NewSender creates a new instance of Sender. +func NewSender() *Sender { + return &Sender{} +} + +// Do accepts the passed request and, based on settings, emits a response and possible error. +func (c *Sender) Do(r *http.Request) (resp *http.Response, err error) { + c.attempts++ + + if len(c.responses) > 0 { + resp = c.responses[0] + if resp != nil { + if b, ok := resp.Body.(*Body); ok { + b.reset() + } + } + c.repeatResponse[0]-- + if c.repeatResponse[0] == 0 { + c.responses = c.responses[1:] + c.repeatResponse = c.repeatResponse[1:] + } + } else { + resp = NewResponse() + } + if resp != nil { + resp.Request = r + } + + if c.emitErrorAfter > 0 { + c.emitErrorAfter-- + } else if c.err != nil { + err = c.err + c.repeatError-- + if c.repeatError == 0 { + c.err = nil + } + } + + return +} + +// AppendResponse adds the passed http.Response to the response stack. +func (c *Sender) AppendResponse(resp *http.Response) { + c.AppendAndRepeatResponse(resp, 1) +} + +// AppendAndRepeatResponse adds the passed http.Response to the response stack along with a +// repeat count. A negative repeat count will return the response for all remaining calls to Do. +func (c *Sender) AppendAndRepeatResponse(resp *http.Response, repeat int) { + if c.responses == nil { + c.responses = []*http.Response{resp} + c.repeatResponse = []int{repeat} + } else { + c.responses = append(c.responses, resp) + c.repeatResponse = append(c.repeatResponse, repeat) + } +} + +// Attempts returns the number of times Do was called. +func (c *Sender) Attempts() int { + return c.attempts +} + +// SetError sets the error Do should return. +func (c *Sender) SetError(err error) { + c.SetAndRepeatError(err, 1) +} + +// SetAndRepeatError sets the error Do should return and how many calls to Do will return the error. +// A negative repeat value will return the error for all remaining calls to Do. +func (c *Sender) SetAndRepeatError(err error, repeat int) { + c.err = err + c.repeatError = repeat +} + +// SetEmitErrorAfter sets the number of attempts to be made before errors are emitted. +func (c *Sender) SetEmitErrorAfter(ea int) { + c.emitErrorAfter = ea +} + +// T is a simple testing struct. +type T struct { + Name string `json:"name" xml:"Name"` + Age int `json:"age" xml:"Age"` +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks_test.go b/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks_test.go index 0331bd9b36..f726b26e5b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/mocks/mocks_test.go @@ -1 +1 @@ -package mocks +package mocks diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer.go b/vendor/github.com/Azure/go-autorest/autorest/preparer.go index 0648009206..afd114821b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/preparer.go +++ b/vendor/github.com/Azure/go-autorest/autorest/preparer.go @@ -1,428 +1,428 @@ -package autorest - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "mime/multipart" - "net/http" - "net/url" - "strings" -) - -const ( - mimeTypeJSON = "application/json" - mimeTypeFormPost = "application/x-www-form-urlencoded" - - headerAuthorization = "Authorization" - headerContentType = "Content-Type" - headerUserAgent = "User-Agent" -) - -// Preparer is the interface that wraps the Prepare method. -// -// Prepare accepts and possibly modifies an http.Request (e.g., adding Headers). Implementations -// must ensure to not share or hold per-invocation state since Preparers may be shared and re-used. -type Preparer interface { - Prepare(*http.Request) (*http.Request, error) -} - -// PreparerFunc is a method that implements the Preparer interface. -type PreparerFunc func(*http.Request) (*http.Request, error) - -// Prepare implements the Preparer interface on PreparerFunc. -func (pf PreparerFunc) Prepare(r *http.Request) (*http.Request, error) { - return pf(r) -} - -// PrepareDecorator takes and possibly decorates, by wrapping, a Preparer. Decorators may affect the -// http.Request and pass it along or, first, pass the http.Request along then affect the result. -type PrepareDecorator func(Preparer) Preparer - -// CreatePreparer creates, decorates, and returns a Preparer. -// Without decorators, the returned Preparer returns the passed http.Request unmodified. -// Preparers are safe to share and re-use. -func CreatePreparer(decorators ...PrepareDecorator) Preparer { - return DecoratePreparer( - Preparer(PreparerFunc(func(r *http.Request) (*http.Request, error) { return r, nil })), - decorators...) -} - -// DecoratePreparer accepts a Preparer and a, possibly empty, set of PrepareDecorators, which it -// applies to the Preparer. Decorators are applied in the order received, but their affect upon the -// request depends on whether they are a pre-decorator (change the http.Request and then pass it -// along) or a post-decorator (pass the http.Request along and alter it on return). -func DecoratePreparer(p Preparer, decorators ...PrepareDecorator) Preparer { - for _, decorate := range decorators { - p = decorate(p) - } - return p -} - -// Prepare accepts an http.Request and a, possibly empty, set of PrepareDecorators. -// It creates a Preparer from the decorators which it then applies to the passed http.Request. -func Prepare(r *http.Request, decorators ...PrepareDecorator) (*http.Request, error) { - if r == nil { - return nil, NewError("autorest", "Prepare", "Invoked without an http.Request") - } - return CreatePreparer(decorators...).Prepare(r) -} - -// WithNothing returns a "do nothing" PrepareDecorator that makes no changes to the passed -// http.Request. -func WithNothing() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - return p.Prepare(r) - }) - } -} - -// WithHeader returns a PrepareDecorator that sets the specified HTTP header of the http.Request to -// the passed value. It canonicalizes the passed header name (via http.CanonicalHeaderKey) before -// adding the header. -func WithHeader(header string, value string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set(http.CanonicalHeaderKey(header), value) - } - return r, err - }) - } -} - -// WithBearerAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose -// value is "Bearer " followed by the supplied token. -func WithBearerAuthorization(token string) PrepareDecorator { - return WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", token)) -} - -// AsContentType returns a PrepareDecorator that adds an HTTP Content-Type header whose value -// is the passed contentType. -func AsContentType(contentType string) PrepareDecorator { - return WithHeader(headerContentType, contentType) -} - -// WithUserAgent returns a PrepareDecorator that adds an HTTP User-Agent header whose value is the -// passed string. -func WithUserAgent(ua string) PrepareDecorator { - return WithHeader(headerUserAgent, ua) -} - -// AsFormURLEncoded returns a PrepareDecorator that adds an HTTP Content-Type header whose value is -// "application/x-www-form-urlencoded". -func AsFormURLEncoded() PrepareDecorator { - return AsContentType(mimeTypeFormPost) -} - -// AsJSON returns a PrepareDecorator that adds an HTTP Content-Type header whose value is -// "application/json". -func AsJSON() PrepareDecorator { - return AsContentType(mimeTypeJSON) -} - -// WithMethod returns a PrepareDecorator that sets the HTTP method of the passed request. The -// decorator does not validate that the passed method string is a known HTTP method. -func WithMethod(method string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r.Method = method - return p.Prepare(r) - }) - } -} - -// AsDelete returns a PrepareDecorator that sets the HTTP method to DELETE. -func AsDelete() PrepareDecorator { return WithMethod("DELETE") } - -// AsGet returns a PrepareDecorator that sets the HTTP method to GET. -func AsGet() PrepareDecorator { return WithMethod("GET") } - -// AsHead returns a PrepareDecorator that sets the HTTP method to HEAD. -func AsHead() PrepareDecorator { return WithMethod("HEAD") } - -// AsOptions returns a PrepareDecorator that sets the HTTP method to OPTIONS. -func AsOptions() PrepareDecorator { return WithMethod("OPTIONS") } - -// AsPatch returns a PrepareDecorator that sets the HTTP method to PATCH. -func AsPatch() PrepareDecorator { return WithMethod("PATCH") } - -// AsPost returns a PrepareDecorator that sets the HTTP method to POST. -func AsPost() PrepareDecorator { return WithMethod("POST") } - -// AsPut returns a PrepareDecorator that sets the HTTP method to PUT. -func AsPut() PrepareDecorator { return WithMethod("PUT") } - -// WithBaseURL returns a PrepareDecorator that populates the http.Request with a url.URL constructed -// from the supplied baseUrl. -func WithBaseURL(baseURL string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - var u *url.URL - if u, err = url.Parse(baseURL); err != nil { - return r, err - } - if u.Scheme == "" { - err = fmt.Errorf("autorest: No scheme detected in URL %s", baseURL) - } - if err == nil { - r.URL = u - } - } - return r, err - }) - } -} - -// WithCustomBaseURL returns a PrepareDecorator that replaces brace-enclosed keys within the -// request base URL (i.e., http.Request.URL) with the corresponding values from the passed map. -func WithCustomBaseURL(baseURL string, urlParameters map[string]interface{}) PrepareDecorator { - parameters := ensureValueStrings(urlParameters) - for key, value := range parameters { - baseURL = strings.Replace(baseURL, "{"+key+"}", value, -1) - } - return WithBaseURL(baseURL) -} - -// WithFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) into the -// http.Request body. -func WithFormData(v url.Values) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - s := v.Encode() - r.ContentLength = int64(len(s)) - r.Body = ioutil.NopCloser(strings.NewReader(s)) - } - return r, err - }) - } -} - -// WithMultiPartFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) form parameters -// into the http.Request body. -func WithMultiPartFormData(formDataParameters map[string]interface{}) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - var body bytes.Buffer - writer := multipart.NewWriter(&body) - for key, value := range formDataParameters { - if rc, ok := value.(io.ReadCloser); ok { - var fd io.Writer - if fd, err = writer.CreateFormFile(key, key); err != nil { - return r, err - } - if _, err = io.Copy(fd, rc); err != nil { - return r, err - } - } else { - if err = writer.WriteField(key, ensureValueString(value)); err != nil { - return r, err - } - } - } - if err = writer.Close(); err != nil { - return r, err - } - if r.Header == nil { - r.Header = make(http.Header) - } - r.Header.Set(http.CanonicalHeaderKey(headerContentType), writer.FormDataContentType()) - r.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes())) - r.ContentLength = int64(body.Len()) - return r, err - } - return r, err - }) - } -} - -// WithFile returns a PrepareDecorator that sends file in request body. -func WithFile(f io.ReadCloser) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - b, err := ioutil.ReadAll(f) - if err != nil { - return r, err - } - r.Body = ioutil.NopCloser(bytes.NewReader(b)) - r.ContentLength = int64(len(b)) - } - return r, err - }) - } -} - -// WithBool returns a PrepareDecorator that encodes the passed bool into the body of the request -// and sets the Content-Length header. -func WithBool(v bool) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithFloat32 returns a PrepareDecorator that encodes the passed float32 into the body of the -// request and sets the Content-Length header. -func WithFloat32(v float32) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithFloat64 returns a PrepareDecorator that encodes the passed float64 into the body of the -// request and sets the Content-Length header. -func WithFloat64(v float64) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithInt32 returns a PrepareDecorator that encodes the passed int32 into the body of the request -// and sets the Content-Length header. -func WithInt32(v int32) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithInt64 returns a PrepareDecorator that encodes the passed int64 into the body of the request -// and sets the Content-Length header. -func WithInt64(v int64) PrepareDecorator { - return WithString(fmt.Sprintf("%v", v)) -} - -// WithString returns a PrepareDecorator that encodes the passed string into the body of the request -// and sets the Content-Length header. -func WithString(v string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - r.ContentLength = int64(len(v)) - r.Body = ioutil.NopCloser(strings.NewReader(v)) - } - return r, err - }) - } -} - -// WithJSON returns a PrepareDecorator that encodes the data passed as JSON into the body of the -// request and sets the Content-Length header. -func WithJSON(v interface{}) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - b, err := json.Marshal(v) - if err == nil { - r.ContentLength = int64(len(b)) - r.Body = ioutil.NopCloser(bytes.NewReader(b)) - } - } - return r, err - }) - } -} - -// WithPath returns a PrepareDecorator that adds the supplied path to the request URL. If the path -// is absolute (that is, it begins with a "/"), it replaces the existing path. -func WithPath(path string) PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithPath", "Invoked with a nil URL") - } - if r.URL, err = parseURL(r.URL, path); err != nil { - return r, err - } - } - return r, err - }) - } -} - -// WithEscapedPathParameters returns a PrepareDecorator that replaces brace-enclosed keys within the -// request path (i.e., http.Request.URL.Path) with the corresponding values from the passed map. The -// values will be escaped (aka URL encoded) before insertion into the path. -func WithEscapedPathParameters(path string, pathParameters map[string]interface{}) PrepareDecorator { - parameters := escapeValueStrings(ensureValueStrings(pathParameters)) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithEscapedPathParameters", "Invoked with a nil URL") - } - for key, value := range parameters { - path = strings.Replace(path, "{"+key+"}", value, -1) - } - if r.URL, err = parseURL(r.URL, path); err != nil { - return r, err - } - } - return r, err - }) - } -} - -// WithPathParameters returns a PrepareDecorator that replaces brace-enclosed keys within the -// request path (i.e., http.Request.URL.Path) with the corresponding values from the passed map. -func WithPathParameters(path string, pathParameters map[string]interface{}) PrepareDecorator { - parameters := ensureValueStrings(pathParameters) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithPathParameters", "Invoked with a nil URL") - } - for key, value := range parameters { - path = strings.Replace(path, "{"+key+"}", value, -1) - } - - if r.URL, err = parseURL(r.URL, path); err != nil { - return r, err - } - } - return r, err - }) - } -} - -func parseURL(u *url.URL, path string) (*url.URL, error) { - p := strings.TrimRight(u.String(), "/") - if !strings.HasPrefix(path, "/") { - path = "/" + path - } - return url.Parse(p + path) -} - -// WithQueryParameters returns a PrepareDecorators that encodes and applies the query parameters -// given in the supplied map (i.e., key=value). -func WithQueryParameters(queryParameters map[string]interface{}) PrepareDecorator { - parameters := ensureValueStrings(queryParameters) - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, NewError("autorest", "WithQueryParameters", "Invoked with a nil URL") - } - v := r.URL.Query() - for key, value := range parameters { - v.Add(key, value) - } - r.URL.RawQuery = createQuery(v) - } - return r, err - }) - } -} +package autorest + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "mime/multipart" + "net/http" + "net/url" + "strings" +) + +const ( + mimeTypeJSON = "application/json" + mimeTypeFormPost = "application/x-www-form-urlencoded" + + headerAuthorization = "Authorization" + headerContentType = "Content-Type" + headerUserAgent = "User-Agent" +) + +// Preparer is the interface that wraps the Prepare method. +// +// Prepare accepts and possibly modifies an http.Request (e.g., adding Headers). Implementations +// must ensure to not share or hold per-invocation state since Preparers may be shared and re-used. +type Preparer interface { + Prepare(*http.Request) (*http.Request, error) +} + +// PreparerFunc is a method that implements the Preparer interface. +type PreparerFunc func(*http.Request) (*http.Request, error) + +// Prepare implements the Preparer interface on PreparerFunc. +func (pf PreparerFunc) Prepare(r *http.Request) (*http.Request, error) { + return pf(r) +} + +// PrepareDecorator takes and possibly decorates, by wrapping, a Preparer. Decorators may affect the +// http.Request and pass it along or, first, pass the http.Request along then affect the result. +type PrepareDecorator func(Preparer) Preparer + +// CreatePreparer creates, decorates, and returns a Preparer. +// Without decorators, the returned Preparer returns the passed http.Request unmodified. +// Preparers are safe to share and re-use. +func CreatePreparer(decorators ...PrepareDecorator) Preparer { + return DecoratePreparer( + Preparer(PreparerFunc(func(r *http.Request) (*http.Request, error) { return r, nil })), + decorators...) +} + +// DecoratePreparer accepts a Preparer and a, possibly empty, set of PrepareDecorators, which it +// applies to the Preparer. Decorators are applied in the order received, but their affect upon the +// request depends on whether they are a pre-decorator (change the http.Request and then pass it +// along) or a post-decorator (pass the http.Request along and alter it on return). +func DecoratePreparer(p Preparer, decorators ...PrepareDecorator) Preparer { + for _, decorate := range decorators { + p = decorate(p) + } + return p +} + +// Prepare accepts an http.Request and a, possibly empty, set of PrepareDecorators. +// It creates a Preparer from the decorators which it then applies to the passed http.Request. +func Prepare(r *http.Request, decorators ...PrepareDecorator) (*http.Request, error) { + if r == nil { + return nil, NewError("autorest", "Prepare", "Invoked without an http.Request") + } + return CreatePreparer(decorators...).Prepare(r) +} + +// WithNothing returns a "do nothing" PrepareDecorator that makes no changes to the passed +// http.Request. +func WithNothing() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + return p.Prepare(r) + }) + } +} + +// WithHeader returns a PrepareDecorator that sets the specified HTTP header of the http.Request to +// the passed value. It canonicalizes the passed header name (via http.CanonicalHeaderKey) before +// adding the header. +func WithHeader(header string, value string) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set(http.CanonicalHeaderKey(header), value) + } + return r, err + }) + } +} + +// WithBearerAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose +// value is "Bearer " followed by the supplied token. +func WithBearerAuthorization(token string) PrepareDecorator { + return WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", token)) +} + +// AsContentType returns a PrepareDecorator that adds an HTTP Content-Type header whose value +// is the passed contentType. +func AsContentType(contentType string) PrepareDecorator { + return WithHeader(headerContentType, contentType) +} + +// WithUserAgent returns a PrepareDecorator that adds an HTTP User-Agent header whose value is the +// passed string. +func WithUserAgent(ua string) PrepareDecorator { + return WithHeader(headerUserAgent, ua) +} + +// AsFormURLEncoded returns a PrepareDecorator that adds an HTTP Content-Type header whose value is +// "application/x-www-form-urlencoded". +func AsFormURLEncoded() PrepareDecorator { + return AsContentType(mimeTypeFormPost) +} + +// AsJSON returns a PrepareDecorator that adds an HTTP Content-Type header whose value is +// "application/json". +func AsJSON() PrepareDecorator { + return AsContentType(mimeTypeJSON) +} + +// WithMethod returns a PrepareDecorator that sets the HTTP method of the passed request. The +// decorator does not validate that the passed method string is a known HTTP method. +func WithMethod(method string) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r.Method = method + return p.Prepare(r) + }) + } +} + +// AsDelete returns a PrepareDecorator that sets the HTTP method to DELETE. +func AsDelete() PrepareDecorator { return WithMethod("DELETE") } + +// AsGet returns a PrepareDecorator that sets the HTTP method to GET. +func AsGet() PrepareDecorator { return WithMethod("GET") } + +// AsHead returns a PrepareDecorator that sets the HTTP method to HEAD. +func AsHead() PrepareDecorator { return WithMethod("HEAD") } + +// AsOptions returns a PrepareDecorator that sets the HTTP method to OPTIONS. +func AsOptions() PrepareDecorator { return WithMethod("OPTIONS") } + +// AsPatch returns a PrepareDecorator that sets the HTTP method to PATCH. +func AsPatch() PrepareDecorator { return WithMethod("PATCH") } + +// AsPost returns a PrepareDecorator that sets the HTTP method to POST. +func AsPost() PrepareDecorator { return WithMethod("POST") } + +// AsPut returns a PrepareDecorator that sets the HTTP method to PUT. +func AsPut() PrepareDecorator { return WithMethod("PUT") } + +// WithBaseURL returns a PrepareDecorator that populates the http.Request with a url.URL constructed +// from the supplied baseUrl. +func WithBaseURL(baseURL string) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + var u *url.URL + if u, err = url.Parse(baseURL); err != nil { + return r, err + } + if u.Scheme == "" { + err = fmt.Errorf("autorest: No scheme detected in URL %s", baseURL) + } + if err == nil { + r.URL = u + } + } + return r, err + }) + } +} + +// WithCustomBaseURL returns a PrepareDecorator that replaces brace-enclosed keys within the +// request base URL (i.e., http.Request.URL) with the corresponding values from the passed map. +func WithCustomBaseURL(baseURL string, urlParameters map[string]interface{}) PrepareDecorator { + parameters := ensureValueStrings(urlParameters) + for key, value := range parameters { + baseURL = strings.Replace(baseURL, "{"+key+"}", value, -1) + } + return WithBaseURL(baseURL) +} + +// WithFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) into the +// http.Request body. +func WithFormData(v url.Values) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + s := v.Encode() + r.ContentLength = int64(len(s)) + r.Body = ioutil.NopCloser(strings.NewReader(s)) + } + return r, err + }) + } +} + +// WithMultiPartFormData returns a PrepareDecoratore that "URL encodes" (e.g., bar=baz&foo=quux) form parameters +// into the http.Request body. +func WithMultiPartFormData(formDataParameters map[string]interface{}) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + var body bytes.Buffer + writer := multipart.NewWriter(&body) + for key, value := range formDataParameters { + if rc, ok := value.(io.ReadCloser); ok { + var fd io.Writer + if fd, err = writer.CreateFormFile(key, key); err != nil { + return r, err + } + if _, err = io.Copy(fd, rc); err != nil { + return r, err + } + } else { + if err = writer.WriteField(key, ensureValueString(value)); err != nil { + return r, err + } + } + } + if err = writer.Close(); err != nil { + return r, err + } + if r.Header == nil { + r.Header = make(http.Header) + } + r.Header.Set(http.CanonicalHeaderKey(headerContentType), writer.FormDataContentType()) + r.Body = ioutil.NopCloser(bytes.NewReader(body.Bytes())) + r.ContentLength = int64(body.Len()) + return r, err + } + return r, err + }) + } +} + +// WithFile returns a PrepareDecorator that sends file in request body. +func WithFile(f io.ReadCloser) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + b, err := ioutil.ReadAll(f) + if err != nil { + return r, err + } + r.Body = ioutil.NopCloser(bytes.NewReader(b)) + r.ContentLength = int64(len(b)) + } + return r, err + }) + } +} + +// WithBool returns a PrepareDecorator that encodes the passed bool into the body of the request +// and sets the Content-Length header. +func WithBool(v bool) PrepareDecorator { + return WithString(fmt.Sprintf("%v", v)) +} + +// WithFloat32 returns a PrepareDecorator that encodes the passed float32 into the body of the +// request and sets the Content-Length header. +func WithFloat32(v float32) PrepareDecorator { + return WithString(fmt.Sprintf("%v", v)) +} + +// WithFloat64 returns a PrepareDecorator that encodes the passed float64 into the body of the +// request and sets the Content-Length header. +func WithFloat64(v float64) PrepareDecorator { + return WithString(fmt.Sprintf("%v", v)) +} + +// WithInt32 returns a PrepareDecorator that encodes the passed int32 into the body of the request +// and sets the Content-Length header. +func WithInt32(v int32) PrepareDecorator { + return WithString(fmt.Sprintf("%v", v)) +} + +// WithInt64 returns a PrepareDecorator that encodes the passed int64 into the body of the request +// and sets the Content-Length header. +func WithInt64(v int64) PrepareDecorator { + return WithString(fmt.Sprintf("%v", v)) +} + +// WithString returns a PrepareDecorator that encodes the passed string into the body of the request +// and sets the Content-Length header. +func WithString(v string) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + r.ContentLength = int64(len(v)) + r.Body = ioutil.NopCloser(strings.NewReader(v)) + } + return r, err + }) + } +} + +// WithJSON returns a PrepareDecorator that encodes the data passed as JSON into the body of the +// request and sets the Content-Length header. +func WithJSON(v interface{}) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + b, err := json.Marshal(v) + if err == nil { + r.ContentLength = int64(len(b)) + r.Body = ioutil.NopCloser(bytes.NewReader(b)) + } + } + return r, err + }) + } +} + +// WithPath returns a PrepareDecorator that adds the supplied path to the request URL. If the path +// is absolute (that is, it begins with a "/"), it replaces the existing path. +func WithPath(path string) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if r.URL == nil { + return r, NewError("autorest", "WithPath", "Invoked with a nil URL") + } + if r.URL, err = parseURL(r.URL, path); err != nil { + return r, err + } + } + return r, err + }) + } +} + +// WithEscapedPathParameters returns a PrepareDecorator that replaces brace-enclosed keys within the +// request path (i.e., http.Request.URL.Path) with the corresponding values from the passed map. The +// values will be escaped (aka URL encoded) before insertion into the path. +func WithEscapedPathParameters(path string, pathParameters map[string]interface{}) PrepareDecorator { + parameters := escapeValueStrings(ensureValueStrings(pathParameters)) + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if r.URL == nil { + return r, NewError("autorest", "WithEscapedPathParameters", "Invoked with a nil URL") + } + for key, value := range parameters { + path = strings.Replace(path, "{"+key+"}", value, -1) + } + if r.URL, err = parseURL(r.URL, path); err != nil { + return r, err + } + } + return r, err + }) + } +} + +// WithPathParameters returns a PrepareDecorator that replaces brace-enclosed keys within the +// request path (i.e., http.Request.URL.Path) with the corresponding values from the passed map. +func WithPathParameters(path string, pathParameters map[string]interface{}) PrepareDecorator { + parameters := ensureValueStrings(pathParameters) + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if r.URL == nil { + return r, NewError("autorest", "WithPathParameters", "Invoked with a nil URL") + } + for key, value := range parameters { + path = strings.Replace(path, "{"+key+"}", value, -1) + } + + if r.URL, err = parseURL(r.URL, path); err != nil { + return r, err + } + } + return r, err + }) + } +} + +func parseURL(u *url.URL, path string) (*url.URL, error) { + p := strings.TrimRight(u.String(), "/") + if !strings.HasPrefix(path, "/") { + path = "/" + path + } + return url.Parse(p + path) +} + +// WithQueryParameters returns a PrepareDecorators that encodes and applies the query parameters +// given in the supplied map (i.e., key=value). +func WithQueryParameters(queryParameters map[string]interface{}) PrepareDecorator { + parameters := ensureValueStrings(queryParameters) + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if r.URL == nil { + return r, NewError("autorest", "WithQueryParameters", "Invoked with a nil URL") + } + v := r.URL.Query() + for key, value := range parameters { + v.Add(key, value) + } + r.URL.RawQuery = createQuery(v) + } + return r, err + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go b/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go index 1a5a7e803b..1f715f9b29 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/preparer_test.go @@ -1,752 +1,752 @@ -package autorest - -import ( - "fmt" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "strconv" - "strings" - "testing" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -// PrepareDecorators wrap and invoke a Preparer. Most often, the decorator invokes the passed -// Preparer and decorates the response. -func ExamplePrepareDecorator() { - path := "a/b/c/" - pd := func() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err == nil { - if r.URL == nil { - return r, fmt.Errorf("ERROR: URL is not set") - } - r.URL.Path += path - } - return r, err - }) - } - } - - r, _ := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - pd()) - - fmt.Printf("Path is %s\n", r.URL) - // Output: Path is https://microsoft.com/a/b/c/ -} - -// PrepareDecorators may also modify and then invoke the Preparer. -func ExamplePrepareDecorator_pre() { - pd := func() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r.Header.Add(http.CanonicalHeaderKey("ContentType"), "application/json") - return p.Prepare(r) - }) - } - } - - r, _ := Prepare(&http.Request{Header: http.Header{}}, - pd()) - - fmt.Printf("ContentType is %s\n", r.Header.Get("ContentType")) - // Output: ContentType is application/json -} - -// Create a sequence of three Preparers that build up the URL path. -func ExampleCreatePreparer() { - p := CreatePreparer( - WithBaseURL("https://microsoft.com/"), - WithPath("a"), - WithPath("b"), - WithPath("c")) - r, err := p.Prepare(&http.Request{}) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a/b/c -} - -// Create and apply separate Preparers -func ExampleCreatePreparer_multiple() { - params := map[string]interface{}{ - "param1": "a", - "param2": "c", - } - - p1 := CreatePreparer(WithBaseURL("https://microsoft.com/")) - p2 := CreatePreparer(WithPathParameters("/{param1}/b/{param2}/", params)) - - r, err := p1.Prepare(&http.Request{}) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } - - r, err = p2.Prepare(r) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a/b/c/ -} - -// Create and chain separate Preparers -func ExampleCreatePreparer_chain() { - params := map[string]interface{}{ - "param1": "a", - "param2": "c", - } - - p := CreatePreparer(WithBaseURL("https://microsoft.com/")) - p = DecoratePreparer(p, WithPathParameters("/{param1}/b/{param2}/", params)) - - r, err := p.Prepare(&http.Request{}) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a/b/c/ -} - -// Create and prepare an http.Request in one call -func ExamplePrepare() { - r, err := Prepare(&http.Request{}, - AsGet(), - WithBaseURL("https://microsoft.com/"), - WithPath("a/b/c/")) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Printf("%s %s", r.Method, r.URL) - } - // Output: GET https://microsoft.com/a/b/c/ -} - -// Create a request for a supplied base URL and path -func ExampleWithBaseURL() { - r, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/a/b/c/")) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a/b/c/ -} - -func ExampleWithBaseURL_second() { - _, err := Prepare(&http.Request{}, WithBaseURL(":")) - fmt.Println(err) - // Output: parse :: missing protocol scheme -} - -func ExampleWithCustomBaseURL() { - r, err := Prepare(&http.Request{}, - WithCustomBaseURL("https://{account}.{service}.core.windows.net/", - map[string]interface{}{ - "account": "myaccount", - "service": "blob", - })) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://myaccount.blob.core.windows.net/ -} - -func ExampleWithCustomBaseURL_second() { - _, err := Prepare(&http.Request{}, - WithCustomBaseURL(":", map[string]interface{}{})) - fmt.Println(err) - // Output: parse :: missing protocol scheme -} - -// Create a request with a custom HTTP header -func ExampleWithHeader() { - r, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/a/b/c/"), - WithHeader("x-foo", "bar")) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Printf("Header %s=%s\n", "x-foo", r.Header.Get("x-foo")) - } - // Output: Header x-foo=bar -} - -// Create a request whose Body is the JSON encoding of a structure -func ExampleWithFormData() { - v := url.Values{} - v.Add("name", "Rob Pike") - v.Add("age", "42") - - r, err := Prepare(&http.Request{}, - WithFormData(v)) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Printf("Request Body contains %s\n", string(b)) - } - // Output: Request Body contains age=42&name=Rob+Pike -} - -// Create a request whose Body is the JSON encoding of a structure -func ExampleWithJSON() { - t := mocks.T{Name: "Rob Pike", Age: 42} - - r, err := Prepare(&http.Request{}, - WithJSON(&t)) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Printf("Request Body contains %s\n", string(b)) - } - // Output: Request Body contains {"name":"Rob Pike","age":42} -} - -// Create a request from a path with escaped parameters -func ExampleWithEscapedPathParameters() { - params := map[string]interface{}{ - "param1": "a b c", - "param2": "d e f", - } - r, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithEscapedPathParameters("/{param1}/b/{param2}/", params)) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a+b+c/b/d+e+f/ -} - -// Create a request from a path with parameters -func ExampleWithPathParameters() { - params := map[string]interface{}{ - "param1": "a", - "param2": "c", - } - r, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPathParameters("/{param1}/b/{param2}/", params)) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a/b/c/ -} - -// Create a request with query parameters -func ExampleWithQueryParameters() { - params := map[string]interface{}{ - "q1": "value1", - "q2": "value2", - } - r, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPath("/a/b/c/"), - WithQueryParameters(params)) - if err != nil { - fmt.Printf("ERROR: %v\n", err) - } else { - fmt.Println(r.URL) - } - // Output: https://microsoft.com/a/b/c/?q1=value1&q2=value2 -} - -func TestWithCustomBaseURL(t *testing.T) { - r, err := Prepare(&http.Request{}, WithCustomBaseURL("https://{account}.{service}.core.windows.net/", - map[string]interface{}{ - "account": "myaccount", - "service": "blob", - })) - if err != nil { - t.Fatalf("autorest: WithCustomBaseURL should not fail") - } - if r.URL.String() != "https://myaccount.blob.core.windows.net/" { - t.Fatalf("autorest: WithCustomBaseURL expected https://myaccount.blob.core.windows.net/, got %s", r.URL) - } -} - -func TestWithCustomBaseURLwithInvalidURL(t *testing.T) { - _, err := Prepare(&http.Request{}, WithCustomBaseURL("hello/{account}.{service}.core.windows.net/", - map[string]interface{}{ - "account": "myaccount", - "service": "blob", - })) - if err == nil { - t.Fatalf("autorest: WithCustomBaseURL should fail fo URL parse error") - } -} - -func TestWithPathWithInvalidPath(t *testing.T) { - p := "path%2*end" - if _, err := Prepare(&http.Request{}, WithBaseURL("https://microsoft.com/"), WithPath(p)); err == nil { - t.Fatalf("autorest: WithPath should fail for invalid URL escape error for path '%v' ", p) - } - -} - -func TestWithPathParametersWithInvalidPath(t *testing.T) { - p := "path%2*end" - m := map[string]interface{}{ - "path1": p, - } - if _, err := Prepare(&http.Request{}, WithBaseURL("https://microsoft.com/"), WithPathParameters("/{path1}/", m)); err == nil { - t.Fatalf("autorest: WithPath should fail for invalid URL escape for path '%v' ", p) - } - -} - -func TestCreatePreparerDoesNotModify(t *testing.T) { - r1 := &http.Request{} - p := CreatePreparer() - r2, err := p.Prepare(r1) - if err != nil { - t.Fatalf("autorest: CreatePreparer failed (%v)", err) - } - if !reflect.DeepEqual(r1, r2) { - t.Fatalf("autorest: CreatePreparer without decorators modified the request") - } -} - -func TestCreatePreparerRunsDecoratorsInOrder(t *testing.T) { - p := CreatePreparer(WithBaseURL("https://microsoft.com/"), WithPath("1"), WithPath("2"), WithPath("3")) - r, err := p.Prepare(&http.Request{}) - if err != nil { - t.Fatalf("autorest: CreatePreparer failed (%v)", err) - } - if r.URL.String() != "https:/1/2/3" && r.URL.Host != "microsoft.com" { - t.Fatalf("autorest: CreatePreparer failed to run decorators in order") - } -} - -func TestAsContentType(t *testing.T) { - r, err := Prepare(mocks.NewRequest(), AsContentType("application/text")) - if err != nil { - fmt.Printf("ERROR: %v", err) - } - if r.Header.Get(headerContentType) != "application/text" { - t.Fatalf("autorest: AsContentType failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) - } -} - -func TestAsFormURLEncoded(t *testing.T) { - r, err := Prepare(mocks.NewRequest(), AsFormURLEncoded()) - if err != nil { - fmt.Printf("ERROR: %v", err) - } - if r.Header.Get(headerContentType) != mimeTypeFormPost { - t.Fatalf("autorest: AsFormURLEncoded failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) - } -} - -func TestAsJSON(t *testing.T) { - r, err := Prepare(mocks.NewRequest(), AsJSON()) - if err != nil { - fmt.Printf("ERROR: %v", err) - } - if r.Header.Get(headerContentType) != mimeTypeJSON { - t.Fatalf("autorest: AsJSON failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) - } -} - -func TestWithNothing(t *testing.T) { - r1 := mocks.NewRequest() - r2, err := Prepare(r1, WithNothing()) - if err != nil { - t.Fatalf("autorest: WithNothing returned an unexpected error (%v)", err) - } - - if !reflect.DeepEqual(r1, r2) { - t.Fatal("azure: WithNothing modified the passed HTTP Request") - } -} - -func TestWithBearerAuthorization(t *testing.T) { - r, err := Prepare(mocks.NewRequest(), WithBearerAuthorization("SOME-TOKEN")) - if err != nil { - fmt.Printf("ERROR: %v", err) - } - if r.Header.Get(headerAuthorization) != "Bearer SOME-TOKEN" { - t.Fatalf("autorest: WithBearerAuthorization failed to add header (%s=%s)", headerAuthorization, r.Header.Get(headerAuthorization)) - } -} - -func TestWithUserAgent(t *testing.T) { - ua := "User Agent Go" - r, err := Prepare(mocks.NewRequest(), WithUserAgent(ua)) - if err != nil { - fmt.Printf("ERROR: %v", err) - } - if r.UserAgent() != ua || r.Header.Get(headerUserAgent) != ua { - t.Fatalf("autorest: WithUserAgent failed to add header (%s=%s)", headerUserAgent, r.Header.Get(headerUserAgent)) - } -} - -func TestWithMethod(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), WithMethod("HEAD")) - if r.Method != "HEAD" { - t.Fatal("autorest: WithMethod failed to set HTTP method header") - } -} - -func TestAsDelete(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsDelete()) - if r.Method != "DELETE" { - t.Fatal("autorest: AsDelete failed to set HTTP method header to DELETE") - } -} - -func TestAsGet(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsGet()) - if r.Method != "GET" { - t.Fatal("autorest: AsGet failed to set HTTP method header to GET") - } -} - -func TestAsHead(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsHead()) - if r.Method != "HEAD" { - t.Fatal("autorest: AsHead failed to set HTTP method header to HEAD") - } -} - -func TestAsOptions(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsOptions()) - if r.Method != "OPTIONS" { - t.Fatal("autorest: AsOptions failed to set HTTP method header to OPTIONS") - } -} - -func TestAsPatch(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsPatch()) - if r.Method != "PATCH" { - t.Fatal("autorest: AsPatch failed to set HTTP method header to PATCH") - } -} - -func TestAsPost(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsPost()) - if r.Method != "POST" { - t.Fatal("autorest: AsPost failed to set HTTP method header to POST") - } -} - -func TestAsPut(t *testing.T) { - r, _ := Prepare(mocks.NewRequest(), AsPut()) - if r.Method != "PUT" { - t.Fatal("autorest: AsPut failed to set HTTP method header to PUT") - } -} - -func TestPrepareWithNullRequest(t *testing.T) { - _, err := Prepare(nil) - if err == nil { - t.Fatal("autorest: Prepare failed to return an error when given a null http.Request") - } -} - -func TestWithFormDataSetsContentLength(t *testing.T) { - v := url.Values{} - v.Add("name", "Rob Pike") - v.Add("age", "42") - - r, err := Prepare(&http.Request{}, - WithFormData(v)) - if err != nil { - t.Fatalf("autorest: WithFormData failed with error (%v)", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithFormData failed with error (%v)", err) - } - - expected := "name=Rob+Pike&age=42" - if !(string(b) == "name=Rob+Pike&age=42" || string(b) == "age=42&name=Rob+Pike") { - t.Fatalf("autorest:WithFormData failed to return correct string got (%v), expected (%v)", string(b), expected) - } - - if r.ContentLength != int64(len(b)) { - t.Fatalf("autorest:WithFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) - } -} - -func TestWithMultiPartFormDataSetsContentLength(t *testing.T) { - v := map[string]interface{}{ - "file": ioutil.NopCloser(strings.NewReader("Hello Gopher")), - "age": "42", - } - - r, err := Prepare(&http.Request{}, - WithMultiPartFormData(v)) - if err != nil { - t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) - } - - if r.ContentLength != int64(len(b)) { - t.Fatalf("autorest:WithMultiPartFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) - } -} - -func TestWithMultiPartFormDataWithNoFile(t *testing.T) { - v := map[string]interface{}{ - "file": "no file", - "age": "42", - } - - r, err := Prepare(&http.Request{}, - WithMultiPartFormData(v)) - if err != nil { - t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) - } - - if r.ContentLength != int64(len(b)) { - t.Fatalf("autorest:WithMultiPartFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) - } -} - -func TestWithFile(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithFile(ioutil.NopCloser(strings.NewReader("Hello Gopher")))) - if err != nil { - t.Fatalf("autorest: WithFile failed with error (%v)", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithFile failed with error (%v)", err) - } - if r.ContentLength != int64(len(b)) { - t.Fatalf("autorest:WithFile set Content-Length to %v, expected %v", r.ContentLength, len(b)) - } -} - -func TestWithBool_SetsTheBody(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithBool(false)) - if err != nil { - t.Fatalf("autorest: WithBool failed with error (%v)", err) - } - - s, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithBool failed with error (%v)", err) - } - - if r.ContentLength != int64(len(fmt.Sprintf("%v", false))) { - t.Fatalf("autorest: WithBool set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", false)))) - } - - v, err := strconv.ParseBool(string(s)) - if err != nil || v { - t.Fatalf("autorest: WithBool incorrectly encoded the boolean as %v", s) - } -} - -func TestWithFloat32_SetsTheBody(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithFloat32(42.0)) - if err != nil { - t.Fatalf("autorest: WithFloat32 failed with error (%v)", err) - } - - s, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithFloat32 failed with error (%v)", err) - } - - if r.ContentLength != int64(len(fmt.Sprintf("%v", 42.0))) { - t.Fatalf("autorest: WithFloat32 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42.0)))) - } - - v, err := strconv.ParseFloat(string(s), 32) - if err != nil || float32(v) != float32(42.0) { - t.Fatalf("autorest: WithFloat32 incorrectly encoded the boolean as %v", s) - } -} - -func TestWithFloat64_SetsTheBody(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithFloat64(42.0)) - if err != nil { - t.Fatalf("autorest: WithFloat64 failed with error (%v)", err) - } - - s, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithFloat64 failed with error (%v)", err) - } - - if r.ContentLength != int64(len(fmt.Sprintf("%v", 42.0))) { - t.Fatalf("autorest: WithFloat64 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42.0)))) - } - - v, err := strconv.ParseFloat(string(s), 64) - if err != nil || v != float64(42.0) { - t.Fatalf("autorest: WithFloat64 incorrectly encoded the boolean as %v", s) - } -} - -func TestWithInt32_SetsTheBody(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithInt32(42)) - if err != nil { - t.Fatalf("autorest: WithInt32 failed with error (%v)", err) - } - - s, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithInt32 failed with error (%v)", err) - } - - if r.ContentLength != int64(len(fmt.Sprintf("%v", 42))) { - t.Fatalf("autorest: WithInt32 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42)))) - } - - v, err := strconv.ParseInt(string(s), 10, 32) - if err != nil || int32(v) != int32(42) { - t.Fatalf("autorest: WithInt32 incorrectly encoded the boolean as %v", s) - } -} - -func TestWithInt64_SetsTheBody(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithInt64(42)) - if err != nil { - t.Fatalf("autorest: WithInt64 failed with error (%v)", err) - } - - s, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithInt64 failed with error (%v)", err) - } - - if r.ContentLength != int64(len(fmt.Sprintf("%v", 42))) { - t.Fatalf("autorest: WithInt64 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42)))) - } - - v, err := strconv.ParseInt(string(s), 10, 64) - if err != nil || v != int64(42) { - t.Fatalf("autorest: WithInt64 incorrectly encoded the boolean as %v", s) - } -} - -func TestWithString_SetsTheBody(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithString("value")) - if err != nil { - t.Fatalf("autorest: WithString failed with error (%v)", err) - } - - s, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithString failed with error (%v)", err) - } - - if r.ContentLength != int64(len("value")) { - t.Fatalf("autorest: WithString set Content-Length to %v, expected %v", r.ContentLength, int64(len("value"))) - } - - if string(s) != "value" { - t.Fatalf("autorest: WithString incorrectly encoded the string as %v", s) - } -} - -func TestWithJSONSetsContentLength(t *testing.T) { - r, err := Prepare(&http.Request{}, - WithJSON(&mocks.T{Name: "Rob Pike", Age: 42})) - if err != nil { - t.Fatalf("autorest: WithJSON failed with error (%v)", err) - } - - b, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: WithJSON failed with error (%v)", err) - } - - if r.ContentLength != int64(len(b)) { - t.Fatalf("autorest:WithJSON set Content-Length to %v, expected %v", r.ContentLength, len(b)) - } -} - -func TestWithHeaderAllocatesHeaders(t *testing.T) { - r, err := Prepare(mocks.NewRequest(), WithHeader("x-foo", "bar")) - if err != nil { - t.Fatalf("autorest: WithHeader failed (%v)", err) - } - if r.Header.Get("x-foo") != "bar" { - t.Fatalf("autorest: WithHeader failed to add header (%s=%s)", "x-foo", r.Header.Get("x-foo")) - } -} - -func TestWithPathCatchesNilURL(t *testing.T) { - _, err := Prepare(&http.Request{}, WithPath("a")) - if err == nil { - t.Fatalf("autorest: WithPath failed to catch a nil URL") - } -} - -func TestWithEscapedPathParametersCatchesNilURL(t *testing.T) { - _, err := Prepare(&http.Request{}, WithEscapedPathParameters("", map[string]interface{}{"foo": "bar"})) - if err == nil { - t.Fatalf("autorest: WithEscapedPathParameters failed to catch a nil URL") - } -} - -func TestWithPathParametersCatchesNilURL(t *testing.T) { - _, err := Prepare(&http.Request{}, WithPathParameters("", map[string]interface{}{"foo": "bar"})) - if err == nil { - t.Fatalf("autorest: WithPathParameters failed to catch a nil URL") - } -} - -func TestWithQueryParametersCatchesNilURL(t *testing.T) { - _, err := Prepare(&http.Request{}, WithQueryParameters(map[string]interface{}{"foo": "bar"})) - if err == nil { - t.Fatalf("autorest: WithQueryParameters failed to catch a nil URL") - } -} - -func TestModifyingExistingRequest(t *testing.T) { - r, err := Prepare(mocks.NewRequestForURL("https://bing.com"), WithPath("search"), WithQueryParameters(map[string]interface{}{"q": "golang"})) - if err != nil { - t.Fatalf("autorest: Preparing an existing request returned an error (%v)", err) - } - if r.URL.String() != "https:/search?q=golang" && r.URL.Host != "bing.com" { - t.Fatalf("autorest: Preparing an existing request failed (%s)", r.URL) - } -} +package autorest + +import ( + "fmt" + "io/ioutil" + "net/http" + "net/url" + "reflect" + "strconv" + "strings" + "testing" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +// PrepareDecorators wrap and invoke a Preparer. Most often, the decorator invokes the passed +// Preparer and decorates the response. +func ExamplePrepareDecorator() { + path := "a/b/c/" + pd := func() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if r.URL == nil { + return r, fmt.Errorf("ERROR: URL is not set") + } + r.URL.Path += path + } + return r, err + }) + } + } + + r, _ := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + pd()) + + fmt.Printf("Path is %s\n", r.URL) + // Output: Path is https://microsoft.com/a/b/c/ +} + +// PrepareDecorators may also modify and then invoke the Preparer. +func ExamplePrepareDecorator_pre() { + pd := func() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r.Header.Add(http.CanonicalHeaderKey("ContentType"), "application/json") + return p.Prepare(r) + }) + } + } + + r, _ := Prepare(&http.Request{Header: http.Header{}}, + pd()) + + fmt.Printf("ContentType is %s\n", r.Header.Get("ContentType")) + // Output: ContentType is application/json +} + +// Create a sequence of three Preparers that build up the URL path. +func ExampleCreatePreparer() { + p := CreatePreparer( + WithBaseURL("https://microsoft.com/"), + WithPath("a"), + WithPath("b"), + WithPath("c")) + r, err := p.Prepare(&http.Request{}) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a/b/c +} + +// Create and apply separate Preparers +func ExampleCreatePreparer_multiple() { + params := map[string]interface{}{ + "param1": "a", + "param2": "c", + } + + p1 := CreatePreparer(WithBaseURL("https://microsoft.com/")) + p2 := CreatePreparer(WithPathParameters("/{param1}/b/{param2}/", params)) + + r, err := p1.Prepare(&http.Request{}) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } + + r, err = p2.Prepare(r) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a/b/c/ +} + +// Create and chain separate Preparers +func ExampleCreatePreparer_chain() { + params := map[string]interface{}{ + "param1": "a", + "param2": "c", + } + + p := CreatePreparer(WithBaseURL("https://microsoft.com/")) + p = DecoratePreparer(p, WithPathParameters("/{param1}/b/{param2}/", params)) + + r, err := p.Prepare(&http.Request{}) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a/b/c/ +} + +// Create and prepare an http.Request in one call +func ExamplePrepare() { + r, err := Prepare(&http.Request{}, + AsGet(), + WithBaseURL("https://microsoft.com/"), + WithPath("a/b/c/")) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Printf("%s %s", r.Method, r.URL) + } + // Output: GET https://microsoft.com/a/b/c/ +} + +// Create a request for a supplied base URL and path +func ExampleWithBaseURL() { + r, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/a/b/c/")) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a/b/c/ +} + +func ExampleWithBaseURL_second() { + _, err := Prepare(&http.Request{}, WithBaseURL(":")) + fmt.Println(err) + // Output: parse :: missing protocol scheme +} + +func ExampleWithCustomBaseURL() { + r, err := Prepare(&http.Request{}, + WithCustomBaseURL("https://{account}.{service}.core.windows.net/", + map[string]interface{}{ + "account": "myaccount", + "service": "blob", + })) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://myaccount.blob.core.windows.net/ +} + +func ExampleWithCustomBaseURL_second() { + _, err := Prepare(&http.Request{}, + WithCustomBaseURL(":", map[string]interface{}{})) + fmt.Println(err) + // Output: parse :: missing protocol scheme +} + +// Create a request with a custom HTTP header +func ExampleWithHeader() { + r, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/a/b/c/"), + WithHeader("x-foo", "bar")) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Printf("Header %s=%s\n", "x-foo", r.Header.Get("x-foo")) + } + // Output: Header x-foo=bar +} + +// Create a request whose Body is the JSON encoding of a structure +func ExampleWithFormData() { + v := url.Values{} + v.Add("name", "Rob Pike") + v.Add("age", "42") + + r, err := Prepare(&http.Request{}, + WithFormData(v)) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Printf("Request Body contains %s\n", string(b)) + } + // Output: Request Body contains age=42&name=Rob+Pike +} + +// Create a request whose Body is the JSON encoding of a structure +func ExampleWithJSON() { + t := mocks.T{Name: "Rob Pike", Age: 42} + + r, err := Prepare(&http.Request{}, + WithJSON(&t)) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Printf("Request Body contains %s\n", string(b)) + } + // Output: Request Body contains {"name":"Rob Pike","age":42} +} + +// Create a request from a path with escaped parameters +func ExampleWithEscapedPathParameters() { + params := map[string]interface{}{ + "param1": "a b c", + "param2": "d e f", + } + r, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + WithEscapedPathParameters("/{param1}/b/{param2}/", params)) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a+b+c/b/d+e+f/ +} + +// Create a request from a path with parameters +func ExampleWithPathParameters() { + params := map[string]interface{}{ + "param1": "a", + "param2": "c", + } + r, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + WithPathParameters("/{param1}/b/{param2}/", params)) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a/b/c/ +} + +// Create a request with query parameters +func ExampleWithQueryParameters() { + params := map[string]interface{}{ + "q1": "value1", + "q2": "value2", + } + r, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + WithPath("/a/b/c/"), + WithQueryParameters(params)) + if err != nil { + fmt.Printf("ERROR: %v\n", err) + } else { + fmt.Println(r.URL) + } + // Output: https://microsoft.com/a/b/c/?q1=value1&q2=value2 +} + +func TestWithCustomBaseURL(t *testing.T) { + r, err := Prepare(&http.Request{}, WithCustomBaseURL("https://{account}.{service}.core.windows.net/", + map[string]interface{}{ + "account": "myaccount", + "service": "blob", + })) + if err != nil { + t.Fatalf("autorest: WithCustomBaseURL should not fail") + } + if r.URL.String() != "https://myaccount.blob.core.windows.net/" { + t.Fatalf("autorest: WithCustomBaseURL expected https://myaccount.blob.core.windows.net/, got %s", r.URL) + } +} + +func TestWithCustomBaseURLwithInvalidURL(t *testing.T) { + _, err := Prepare(&http.Request{}, WithCustomBaseURL("hello/{account}.{service}.core.windows.net/", + map[string]interface{}{ + "account": "myaccount", + "service": "blob", + })) + if err == nil { + t.Fatalf("autorest: WithCustomBaseURL should fail fo URL parse error") + } +} + +func TestWithPathWithInvalidPath(t *testing.T) { + p := "path%2*end" + if _, err := Prepare(&http.Request{}, WithBaseURL("https://microsoft.com/"), WithPath(p)); err == nil { + t.Fatalf("autorest: WithPath should fail for invalid URL escape error for path '%v' ", p) + } + +} + +func TestWithPathParametersWithInvalidPath(t *testing.T) { + p := "path%2*end" + m := map[string]interface{}{ + "path1": p, + } + if _, err := Prepare(&http.Request{}, WithBaseURL("https://microsoft.com/"), WithPathParameters("/{path1}/", m)); err == nil { + t.Fatalf("autorest: WithPath should fail for invalid URL escape for path '%v' ", p) + } + +} + +func TestCreatePreparerDoesNotModify(t *testing.T) { + r1 := &http.Request{} + p := CreatePreparer() + r2, err := p.Prepare(r1) + if err != nil { + t.Fatalf("autorest: CreatePreparer failed (%v)", err) + } + if !reflect.DeepEqual(r1, r2) { + t.Fatalf("autorest: CreatePreparer without decorators modified the request") + } +} + +func TestCreatePreparerRunsDecoratorsInOrder(t *testing.T) { + p := CreatePreparer(WithBaseURL("https://microsoft.com/"), WithPath("1"), WithPath("2"), WithPath("3")) + r, err := p.Prepare(&http.Request{}) + if err != nil { + t.Fatalf("autorest: CreatePreparer failed (%v)", err) + } + if r.URL.String() != "https:/1/2/3" && r.URL.Host != "microsoft.com" { + t.Fatalf("autorest: CreatePreparer failed to run decorators in order") + } +} + +func TestAsContentType(t *testing.T) { + r, err := Prepare(mocks.NewRequest(), AsContentType("application/text")) + if err != nil { + fmt.Printf("ERROR: %v", err) + } + if r.Header.Get(headerContentType) != "application/text" { + t.Fatalf("autorest: AsContentType failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) + } +} + +func TestAsFormURLEncoded(t *testing.T) { + r, err := Prepare(mocks.NewRequest(), AsFormURLEncoded()) + if err != nil { + fmt.Printf("ERROR: %v", err) + } + if r.Header.Get(headerContentType) != mimeTypeFormPost { + t.Fatalf("autorest: AsFormURLEncoded failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) + } +} + +func TestAsJSON(t *testing.T) { + r, err := Prepare(mocks.NewRequest(), AsJSON()) + if err != nil { + fmt.Printf("ERROR: %v", err) + } + if r.Header.Get(headerContentType) != mimeTypeJSON { + t.Fatalf("autorest: AsJSON failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) + } +} + +func TestWithNothing(t *testing.T) { + r1 := mocks.NewRequest() + r2, err := Prepare(r1, WithNothing()) + if err != nil { + t.Fatalf("autorest: WithNothing returned an unexpected error (%v)", err) + } + + if !reflect.DeepEqual(r1, r2) { + t.Fatal("azure: WithNothing modified the passed HTTP Request") + } +} + +func TestWithBearerAuthorization(t *testing.T) { + r, err := Prepare(mocks.NewRequest(), WithBearerAuthorization("SOME-TOKEN")) + if err != nil { + fmt.Printf("ERROR: %v", err) + } + if r.Header.Get(headerAuthorization) != "Bearer SOME-TOKEN" { + t.Fatalf("autorest: WithBearerAuthorization failed to add header (%s=%s)", headerAuthorization, r.Header.Get(headerAuthorization)) + } +} + +func TestWithUserAgent(t *testing.T) { + ua := "User Agent Go" + r, err := Prepare(mocks.NewRequest(), WithUserAgent(ua)) + if err != nil { + fmt.Printf("ERROR: %v", err) + } + if r.UserAgent() != ua || r.Header.Get(headerUserAgent) != ua { + t.Fatalf("autorest: WithUserAgent failed to add header (%s=%s)", headerUserAgent, r.Header.Get(headerUserAgent)) + } +} + +func TestWithMethod(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), WithMethod("HEAD")) + if r.Method != "HEAD" { + t.Fatal("autorest: WithMethod failed to set HTTP method header") + } +} + +func TestAsDelete(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsDelete()) + if r.Method != "DELETE" { + t.Fatal("autorest: AsDelete failed to set HTTP method header to DELETE") + } +} + +func TestAsGet(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsGet()) + if r.Method != "GET" { + t.Fatal("autorest: AsGet failed to set HTTP method header to GET") + } +} + +func TestAsHead(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsHead()) + if r.Method != "HEAD" { + t.Fatal("autorest: AsHead failed to set HTTP method header to HEAD") + } +} + +func TestAsOptions(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsOptions()) + if r.Method != "OPTIONS" { + t.Fatal("autorest: AsOptions failed to set HTTP method header to OPTIONS") + } +} + +func TestAsPatch(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsPatch()) + if r.Method != "PATCH" { + t.Fatal("autorest: AsPatch failed to set HTTP method header to PATCH") + } +} + +func TestAsPost(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsPost()) + if r.Method != "POST" { + t.Fatal("autorest: AsPost failed to set HTTP method header to POST") + } +} + +func TestAsPut(t *testing.T) { + r, _ := Prepare(mocks.NewRequest(), AsPut()) + if r.Method != "PUT" { + t.Fatal("autorest: AsPut failed to set HTTP method header to PUT") + } +} + +func TestPrepareWithNullRequest(t *testing.T) { + _, err := Prepare(nil) + if err == nil { + t.Fatal("autorest: Prepare failed to return an error when given a null http.Request") + } +} + +func TestWithFormDataSetsContentLength(t *testing.T) { + v := url.Values{} + v.Add("name", "Rob Pike") + v.Add("age", "42") + + r, err := Prepare(&http.Request{}, + WithFormData(v)) + if err != nil { + t.Fatalf("autorest: WithFormData failed with error (%v)", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithFormData failed with error (%v)", err) + } + + expected := "name=Rob+Pike&age=42" + if !(string(b) == "name=Rob+Pike&age=42" || string(b) == "age=42&name=Rob+Pike") { + t.Fatalf("autorest:WithFormData failed to return correct string got (%v), expected (%v)", string(b), expected) + } + + if r.ContentLength != int64(len(b)) { + t.Fatalf("autorest:WithFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) + } +} + +func TestWithMultiPartFormDataSetsContentLength(t *testing.T) { + v := map[string]interface{}{ + "file": ioutil.NopCloser(strings.NewReader("Hello Gopher")), + "age": "42", + } + + r, err := Prepare(&http.Request{}, + WithMultiPartFormData(v)) + if err != nil { + t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) + } + + if r.ContentLength != int64(len(b)) { + t.Fatalf("autorest:WithMultiPartFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) + } +} + +func TestWithMultiPartFormDataWithNoFile(t *testing.T) { + v := map[string]interface{}{ + "file": "no file", + "age": "42", + } + + r, err := Prepare(&http.Request{}, + WithMultiPartFormData(v)) + if err != nil { + t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) + } + + if r.ContentLength != int64(len(b)) { + t.Fatalf("autorest:WithMultiPartFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) + } +} + +func TestWithFile(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithFile(ioutil.NopCloser(strings.NewReader("Hello Gopher")))) + if err != nil { + t.Fatalf("autorest: WithFile failed with error (%v)", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithFile failed with error (%v)", err) + } + if r.ContentLength != int64(len(b)) { + t.Fatalf("autorest:WithFile set Content-Length to %v, expected %v", r.ContentLength, len(b)) + } +} + +func TestWithBool_SetsTheBody(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithBool(false)) + if err != nil { + t.Fatalf("autorest: WithBool failed with error (%v)", err) + } + + s, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithBool failed with error (%v)", err) + } + + if r.ContentLength != int64(len(fmt.Sprintf("%v", false))) { + t.Fatalf("autorest: WithBool set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", false)))) + } + + v, err := strconv.ParseBool(string(s)) + if err != nil || v { + t.Fatalf("autorest: WithBool incorrectly encoded the boolean as %v", s) + } +} + +func TestWithFloat32_SetsTheBody(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithFloat32(42.0)) + if err != nil { + t.Fatalf("autorest: WithFloat32 failed with error (%v)", err) + } + + s, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithFloat32 failed with error (%v)", err) + } + + if r.ContentLength != int64(len(fmt.Sprintf("%v", 42.0))) { + t.Fatalf("autorest: WithFloat32 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42.0)))) + } + + v, err := strconv.ParseFloat(string(s), 32) + if err != nil || float32(v) != float32(42.0) { + t.Fatalf("autorest: WithFloat32 incorrectly encoded the boolean as %v", s) + } +} + +func TestWithFloat64_SetsTheBody(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithFloat64(42.0)) + if err != nil { + t.Fatalf("autorest: WithFloat64 failed with error (%v)", err) + } + + s, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithFloat64 failed with error (%v)", err) + } + + if r.ContentLength != int64(len(fmt.Sprintf("%v", 42.0))) { + t.Fatalf("autorest: WithFloat64 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42.0)))) + } + + v, err := strconv.ParseFloat(string(s), 64) + if err != nil || v != float64(42.0) { + t.Fatalf("autorest: WithFloat64 incorrectly encoded the boolean as %v", s) + } +} + +func TestWithInt32_SetsTheBody(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithInt32(42)) + if err != nil { + t.Fatalf("autorest: WithInt32 failed with error (%v)", err) + } + + s, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithInt32 failed with error (%v)", err) + } + + if r.ContentLength != int64(len(fmt.Sprintf("%v", 42))) { + t.Fatalf("autorest: WithInt32 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42)))) + } + + v, err := strconv.ParseInt(string(s), 10, 32) + if err != nil || int32(v) != int32(42) { + t.Fatalf("autorest: WithInt32 incorrectly encoded the boolean as %v", s) + } +} + +func TestWithInt64_SetsTheBody(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithInt64(42)) + if err != nil { + t.Fatalf("autorest: WithInt64 failed with error (%v)", err) + } + + s, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithInt64 failed with error (%v)", err) + } + + if r.ContentLength != int64(len(fmt.Sprintf("%v", 42))) { + t.Fatalf("autorest: WithInt64 set Content-Length to %v, expected %v", r.ContentLength, int64(len(fmt.Sprintf("%v", 42)))) + } + + v, err := strconv.ParseInt(string(s), 10, 64) + if err != nil || v != int64(42) { + t.Fatalf("autorest: WithInt64 incorrectly encoded the boolean as %v", s) + } +} + +func TestWithString_SetsTheBody(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithString("value")) + if err != nil { + t.Fatalf("autorest: WithString failed with error (%v)", err) + } + + s, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithString failed with error (%v)", err) + } + + if r.ContentLength != int64(len("value")) { + t.Fatalf("autorest: WithString set Content-Length to %v, expected %v", r.ContentLength, int64(len("value"))) + } + + if string(s) != "value" { + t.Fatalf("autorest: WithString incorrectly encoded the string as %v", s) + } +} + +func TestWithJSONSetsContentLength(t *testing.T) { + r, err := Prepare(&http.Request{}, + WithJSON(&mocks.T{Name: "Rob Pike", Age: 42})) + if err != nil { + t.Fatalf("autorest: WithJSON failed with error (%v)", err) + } + + b, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: WithJSON failed with error (%v)", err) + } + + if r.ContentLength != int64(len(b)) { + t.Fatalf("autorest:WithJSON set Content-Length to %v, expected %v", r.ContentLength, len(b)) + } +} + +func TestWithHeaderAllocatesHeaders(t *testing.T) { + r, err := Prepare(mocks.NewRequest(), WithHeader("x-foo", "bar")) + if err != nil { + t.Fatalf("autorest: WithHeader failed (%v)", err) + } + if r.Header.Get("x-foo") != "bar" { + t.Fatalf("autorest: WithHeader failed to add header (%s=%s)", "x-foo", r.Header.Get("x-foo")) + } +} + +func TestWithPathCatchesNilURL(t *testing.T) { + _, err := Prepare(&http.Request{}, WithPath("a")) + if err == nil { + t.Fatalf("autorest: WithPath failed to catch a nil URL") + } +} + +func TestWithEscapedPathParametersCatchesNilURL(t *testing.T) { + _, err := Prepare(&http.Request{}, WithEscapedPathParameters("", map[string]interface{}{"foo": "bar"})) + if err == nil { + t.Fatalf("autorest: WithEscapedPathParameters failed to catch a nil URL") + } +} + +func TestWithPathParametersCatchesNilURL(t *testing.T) { + _, err := Prepare(&http.Request{}, WithPathParameters("", map[string]interface{}{"foo": "bar"})) + if err == nil { + t.Fatalf("autorest: WithPathParameters failed to catch a nil URL") + } +} + +func TestWithQueryParametersCatchesNilURL(t *testing.T) { + _, err := Prepare(&http.Request{}, WithQueryParameters(map[string]interface{}{"foo": "bar"})) + if err == nil { + t.Fatalf("autorest: WithQueryParameters failed to catch a nil URL") + } +} + +func TestModifyingExistingRequest(t *testing.T) { + r, err := Prepare(mocks.NewRequestForURL("https://bing.com"), WithPath("search"), WithQueryParameters(map[string]interface{}{"q": "golang"})) + if err != nil { + t.Fatalf("autorest: Preparing an existing request returned an error (%v)", err) + } + if r.URL.String() != "https:/search?q=golang" && r.URL.Host != "bing.com" { + t.Fatalf("autorest: Preparing an existing request failed (%s)", r.URL) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder.go b/vendor/github.com/Azure/go-autorest/autorest/responder.go index 070f287621..87f71e5854 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/responder.go +++ b/vendor/github.com/Azure/go-autorest/autorest/responder.go @@ -1,236 +1,236 @@ -package autorest - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "strings" -) - -// Responder is the interface that wraps the Respond method. -// -// Respond accepts and reacts to an http.Response. Implementations must ensure to not share or hold -// state since Responders may be shared and re-used. -type Responder interface { - Respond(*http.Response) error -} - -// ResponderFunc is a method that implements the Responder interface. -type ResponderFunc func(*http.Response) error - -// Respond implements the Responder interface on ResponderFunc. -func (rf ResponderFunc) Respond(r *http.Response) error { - return rf(r) -} - -// RespondDecorator takes and possibly decorates, by wrapping, a Responder. Decorators may react to -// the http.Response and pass it along or, first, pass the http.Response along then react. -type RespondDecorator func(Responder) Responder - -// CreateResponder creates, decorates, and returns a Responder. Without decorators, the returned -// Responder returns the passed http.Response unmodified. Responders may or may not be safe to share -// and re-used: It depends on the applied decorators. For example, a standard decorator that closes -// the response body is fine to share whereas a decorator that reads the body into a passed struct -// is not. -// -// To prevent memory leaks, ensure that at least one Responder closes the response body. -func CreateResponder(decorators ...RespondDecorator) Responder { - return DecorateResponder( - Responder(ResponderFunc(func(r *http.Response) error { return nil })), - decorators...) -} - -// DecorateResponder accepts a Responder and a, possibly empty, set of RespondDecorators, which it -// applies to the Responder. Decorators are applied in the order received, but their affect upon the -// request depends on whether they are a pre-decorator (react to the http.Response and then pass it -// along) or a post-decorator (pass the http.Response along and then react). -func DecorateResponder(r Responder, decorators ...RespondDecorator) Responder { - for _, decorate := range decorators { - r = decorate(r) - } - return r -} - -// Respond accepts an http.Response and a, possibly empty, set of RespondDecorators. -// It creates a Responder from the decorators it then applies to the passed http.Response. -func Respond(r *http.Response, decorators ...RespondDecorator) error { - if r == nil { - return nil - } - return CreateResponder(decorators...).Respond(r) -} - -// ByIgnoring returns a RespondDecorator that ignores the passed http.Response passing it unexamined -// to the next RespondDecorator. -func ByIgnoring() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - return r.Respond(resp) - }) - } -} - -// ByCopying copies the contents of the http.Response Body into the passed bytes.Buffer as -// the Body is read. -func ByCopying(b *bytes.Buffer) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && resp != nil && resp.Body != nil { - resp.Body = TeeReadCloser(resp.Body, b) - } - return err - }) - } -} - -// ByDiscardingBody returns a RespondDecorator that first invokes the passed Responder after which -// it copies the remaining bytes (if any) in the response body to ioutil.Discard. Since the passed -// Responder is invoked prior to discarding the response body, the decorator may occur anywhere -// within the set. -func ByDiscardingBody() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && resp != nil && resp.Body != nil { - if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil { - return fmt.Errorf("Error discarding the response body: %v", err) - } - } - return err - }) - } -} - -// ByClosing returns a RespondDecorator that first invokes the passed Responder after which it -// closes the response body. Since the passed Responder is invoked prior to closing the response -// body, the decorator may occur anywhere within the set. -func ByClosing() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if resp != nil && resp.Body != nil { - if err := resp.Body.Close(); err != nil { - return fmt.Errorf("Error closing the response body: %v", err) - } - } - return err - }) - } -} - -// ByClosingIfError returns a RespondDecorator that first invokes the passed Responder after which -// it closes the response if the passed Responder returns an error and the response body exists. -func ByClosingIfError() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err != nil && resp != nil && resp.Body != nil { - if err := resp.Body.Close(); err != nil { - return fmt.Errorf("Error closing the response body: %v", err) - } - } - return err - }) - } -} - -// ByUnmarshallingJSON returns a RespondDecorator that decodes a JSON document returned in the -// response Body into the value pointed to by v. -func ByUnmarshallingJSON(v interface{}) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil { - b, errInner := ioutil.ReadAll(resp.Body) - // Some responses might include a BOM, remove for successful unmarshalling - b = bytes.TrimPrefix(b, []byte("\xef\xbb\xbf")) - if errInner != nil { - err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) - } else if len(strings.Trim(string(b), " ")) > 0 { - errInner = json.Unmarshal(b, v) - if errInner != nil { - err = fmt.Errorf("Error occurred unmarshalling JSON - Error = '%v' JSON = '%s'", errInner, string(b)) - } - } - } - return err - }) - } -} - -// ByUnmarshallingXML returns a RespondDecorator that decodes a XML document returned in the -// response Body into the value pointed to by v. -func ByUnmarshallingXML(v interface{}) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil { - b, errInner := ioutil.ReadAll(resp.Body) - if errInner != nil { - err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) - } else { - errInner = xml.Unmarshal(b, v) - if errInner != nil { - err = fmt.Errorf("Error occurred unmarshalling Xml - Error = '%v' Xml = '%s'", errInner, string(b)) - } - } - } - return err - }) - } -} - -// WithErrorUnlessStatusCode returns a RespondDecorator that emits an error unless the response -// StatusCode is among the set passed. On error, response body is fully read into a buffer and -// presented in the returned error, as well as in the response body. -func WithErrorUnlessStatusCode(codes ...int) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil && !ResponseHasStatusCode(resp, codes...) { - derr := NewErrorWithResponse("autorest", "WithErrorUnlessStatusCode", resp, "%v %v failed with %s", - resp.Request.Method, - resp.Request.URL, - resp.Status) - if resp.Body != nil { - defer resp.Body.Close() - b, _ := ioutil.ReadAll(resp.Body) - derr.ServiceError = b - resp.Body = ioutil.NopCloser(bytes.NewReader(b)) - } - err = derr - } - return err - }) - } -} - -// WithErrorUnlessOK returns a RespondDecorator that emits an error if the response StatusCode is -// anything other than HTTP 200. -func WithErrorUnlessOK() RespondDecorator { - return WithErrorUnlessStatusCode(http.StatusOK) -} - -// ExtractHeader extracts all values of the specified header from the http.Response. It returns an -// empty string slice if the passed http.Response is nil or the header does not exist. -func ExtractHeader(header string, resp *http.Response) []string { - if resp != nil && resp.Header != nil { - return resp.Header[http.CanonicalHeaderKey(header)] - } - return nil -} - -// ExtractHeaderValue extracts the first value of the specified header from the http.Response. It -// returns an empty string if the passed http.Response is nil or the header does not exist. -func ExtractHeaderValue(header string, resp *http.Response) string { - h := ExtractHeader(header, resp) - if len(h) > 0 { - return h[0] - } - return "" -} +package autorest + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "io/ioutil" + "net/http" + "strings" +) + +// Responder is the interface that wraps the Respond method. +// +// Respond accepts and reacts to an http.Response. Implementations must ensure to not share or hold +// state since Responders may be shared and re-used. +type Responder interface { + Respond(*http.Response) error +} + +// ResponderFunc is a method that implements the Responder interface. +type ResponderFunc func(*http.Response) error + +// Respond implements the Responder interface on ResponderFunc. +func (rf ResponderFunc) Respond(r *http.Response) error { + return rf(r) +} + +// RespondDecorator takes and possibly decorates, by wrapping, a Responder. Decorators may react to +// the http.Response and pass it along or, first, pass the http.Response along then react. +type RespondDecorator func(Responder) Responder + +// CreateResponder creates, decorates, and returns a Responder. Without decorators, the returned +// Responder returns the passed http.Response unmodified. Responders may or may not be safe to share +// and re-used: It depends on the applied decorators. For example, a standard decorator that closes +// the response body is fine to share whereas a decorator that reads the body into a passed struct +// is not. +// +// To prevent memory leaks, ensure that at least one Responder closes the response body. +func CreateResponder(decorators ...RespondDecorator) Responder { + return DecorateResponder( + Responder(ResponderFunc(func(r *http.Response) error { return nil })), + decorators...) +} + +// DecorateResponder accepts a Responder and a, possibly empty, set of RespondDecorators, which it +// applies to the Responder. Decorators are applied in the order received, but their affect upon the +// request depends on whether they are a pre-decorator (react to the http.Response and then pass it +// along) or a post-decorator (pass the http.Response along and then react). +func DecorateResponder(r Responder, decorators ...RespondDecorator) Responder { + for _, decorate := range decorators { + r = decorate(r) + } + return r +} + +// Respond accepts an http.Response and a, possibly empty, set of RespondDecorators. +// It creates a Responder from the decorators it then applies to the passed http.Response. +func Respond(r *http.Response, decorators ...RespondDecorator) error { + if r == nil { + return nil + } + return CreateResponder(decorators...).Respond(r) +} + +// ByIgnoring returns a RespondDecorator that ignores the passed http.Response passing it unexamined +// to the next RespondDecorator. +func ByIgnoring() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + return r.Respond(resp) + }) + } +} + +// ByCopying copies the contents of the http.Response Body into the passed bytes.Buffer as +// the Body is read. +func ByCopying(b *bytes.Buffer) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil && resp != nil && resp.Body != nil { + resp.Body = TeeReadCloser(resp.Body, b) + } + return err + }) + } +} + +// ByDiscardingBody returns a RespondDecorator that first invokes the passed Responder after which +// it copies the remaining bytes (if any) in the response body to ioutil.Discard. Since the passed +// Responder is invoked prior to discarding the response body, the decorator may occur anywhere +// within the set. +func ByDiscardingBody() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil && resp != nil && resp.Body != nil { + if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil { + return fmt.Errorf("Error discarding the response body: %v", err) + } + } + return err + }) + } +} + +// ByClosing returns a RespondDecorator that first invokes the passed Responder after which it +// closes the response body. Since the passed Responder is invoked prior to closing the response +// body, the decorator may occur anywhere within the set. +func ByClosing() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if resp != nil && resp.Body != nil { + if err := resp.Body.Close(); err != nil { + return fmt.Errorf("Error closing the response body: %v", err) + } + } + return err + }) + } +} + +// ByClosingIfError returns a RespondDecorator that first invokes the passed Responder after which +// it closes the response if the passed Responder returns an error and the response body exists. +func ByClosingIfError() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err != nil && resp != nil && resp.Body != nil { + if err := resp.Body.Close(); err != nil { + return fmt.Errorf("Error closing the response body: %v", err) + } + } + return err + }) + } +} + +// ByUnmarshallingJSON returns a RespondDecorator that decodes a JSON document returned in the +// response Body into the value pointed to by v. +func ByUnmarshallingJSON(v interface{}) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil { + b, errInner := ioutil.ReadAll(resp.Body) + // Some responses might include a BOM, remove for successful unmarshalling + b = bytes.TrimPrefix(b, []byte("\xef\xbb\xbf")) + if errInner != nil { + err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) + } else if len(strings.Trim(string(b), " ")) > 0 { + errInner = json.Unmarshal(b, v) + if errInner != nil { + err = fmt.Errorf("Error occurred unmarshalling JSON - Error = '%v' JSON = '%s'", errInner, string(b)) + } + } + } + return err + }) + } +} + +// ByUnmarshallingXML returns a RespondDecorator that decodes a XML document returned in the +// response Body into the value pointed to by v. +func ByUnmarshallingXML(v interface{}) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil { + b, errInner := ioutil.ReadAll(resp.Body) + if errInner != nil { + err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) + } else { + errInner = xml.Unmarshal(b, v) + if errInner != nil { + err = fmt.Errorf("Error occurred unmarshalling Xml - Error = '%v' Xml = '%s'", errInner, string(b)) + } + } + } + return err + }) + } +} + +// WithErrorUnlessStatusCode returns a RespondDecorator that emits an error unless the response +// StatusCode is among the set passed. On error, response body is fully read into a buffer and +// presented in the returned error, as well as in the response body. +func WithErrorUnlessStatusCode(codes ...int) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil && !ResponseHasStatusCode(resp, codes...) { + derr := NewErrorWithResponse("autorest", "WithErrorUnlessStatusCode", resp, "%v %v failed with %s", + resp.Request.Method, + resp.Request.URL, + resp.Status) + if resp.Body != nil { + defer resp.Body.Close() + b, _ := ioutil.ReadAll(resp.Body) + derr.ServiceError = b + resp.Body = ioutil.NopCloser(bytes.NewReader(b)) + } + err = derr + } + return err + }) + } +} + +// WithErrorUnlessOK returns a RespondDecorator that emits an error if the response StatusCode is +// anything other than HTTP 200. +func WithErrorUnlessOK() RespondDecorator { + return WithErrorUnlessStatusCode(http.StatusOK) +} + +// ExtractHeader extracts all values of the specified header from the http.Response. It returns an +// empty string slice if the passed http.Response is nil or the header does not exist. +func ExtractHeader(header string, resp *http.Response) []string { + if resp != nil && resp.Header != nil { + return resp.Header[http.CanonicalHeaderKey(header)] + } + return nil +} + +// ExtractHeaderValue extracts the first value of the specified header from the http.Response. It +// returns an empty string if the passed http.Response is nil or the header does not exist. +func ExtractHeaderValue(header string, resp *http.Response) string { + h := ExtractHeader(header, resp) + if len(h) > 0 { + return h[0] + } + return "" +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder_test.go b/vendor/github.com/Azure/go-autorest/autorest/responder_test.go index 26609fee01..99b858b987 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/responder_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/responder_test.go @@ -1,651 +1,651 @@ -package autorest - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "reflect" - "strings" - "testing" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -func ExampleWithErrorUnlessOK() { - r := mocks.NewResponse() - r.Request = mocks.NewRequest() - - // Respond and leave the response body open (for a subsequent responder to close) - err := Respond(r, - WithErrorUnlessOK(), - ByDiscardingBody(), - ByClosingIfError()) - - if err == nil { - fmt.Printf("%s of %s returned HTTP 200", r.Request.Method, r.Request.URL) - - // Complete handling the response and close the body - Respond(r, - ByDiscardingBody(), - ByClosing()) - } - // Output: GET of https://microsoft.com/a/b/c/ returned HTTP 200 -} - -func ExampleByUnmarshallingJSON() { - c := ` - { - "name" : "Rob Pike", - "age" : 42 - } - ` - - type V struct { - Name string `json:"name"` - Age int `json:"age"` - } - - v := &V{} - - Respond(mocks.NewResponseWithContent(c), - ByUnmarshallingJSON(v), - ByClosing()) - - fmt.Printf("%s is %d years old\n", v.Name, v.Age) - // Output: Rob Pike is 42 years old -} - -func ExampleByUnmarshallingXML() { - c := ` - - Rob Pike - 42 - ` - - type V struct { - Name string `xml:"Name"` - Age int `xml:"Age"` - } - - v := &V{} - - Respond(mocks.NewResponseWithContent(c), - ByUnmarshallingXML(v), - ByClosing()) - - fmt.Printf("%s is %d years old\n", v.Name, v.Age) - // Output: Rob Pike is 42 years old -} - -func TestCreateResponderDoesNotModify(t *testing.T) { - r1 := mocks.NewResponse() - r2 := mocks.NewResponse() - p := CreateResponder() - err := p.Respond(r1) - if err != nil { - t.Fatalf("autorest: CreateResponder failed (%v)", err) - } - if !reflect.DeepEqual(r1, r2) { - t.Fatalf("autorest: CreateResponder without decorators modified the response") - } -} - -func TestCreateResponderRunsDecoratorsInOrder(t *testing.T) { - s := "" - - d := func(n int) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err == nil { - s += fmt.Sprintf("%d", n) - } - return err - }) - } - } - - p := CreateResponder(d(1), d(2), d(3)) - err := p.Respond(&http.Response{}) - if err != nil { - t.Fatalf("autorest: Respond failed (%v)", err) - } - - if s != "123" { - t.Fatalf("autorest: CreateResponder invoked decorators in an incorrect order; expected '123', received '%s'", s) - } -} - -func TestByIgnoring(t *testing.T) { - r := mocks.NewResponse() - - Respond(r, - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(r2 *http.Response) error { - r1 := mocks.NewResponse() - if !reflect.DeepEqual(r1, r2) { - t.Fatalf("autorest: ByIgnoring modified the HTTP Response -- received %v, expected %v", r2, r1) - } - return nil - }) - } - })(), - ByIgnoring(), - ByClosing()) -} - -func TestByCopying_Copies(t *testing.T) { - r := mocks.NewResponseWithContent(jsonT) - b := &bytes.Buffer{} - - err := Respond(r, - ByCopying(b), - ByUnmarshallingJSON(&mocks.T{}), - ByClosing()) - if err != nil { - t.Fatalf("autorest: ByCopying returned an unexpected error -- %v", err) - } - if b.String() != jsonT { - t.Fatalf("autorest: ByCopying failed to copy the bytes read") - } -} - -func TestByCopying_ReturnsNestedErrors(t *testing.T) { - r := mocks.NewResponseWithContent(jsonT) - - r.Body.Close() - err := Respond(r, - ByCopying(&bytes.Buffer{}), - ByUnmarshallingJSON(&mocks.T{}), - ByClosing()) - if err == nil { - t.Fatalf("autorest: ByCopying failed to return the expected error") - } -} - -func TestByCopying_AcceptsNilReponse(t *testing.T) { - r := mocks.NewResponse() - - Respond(r, - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - r.Respond(nil) - return nil - }) - } - })(), - ByCopying(&bytes.Buffer{})) -} - -func TestByCopying_AcceptsNilBody(t *testing.T) { - r := mocks.NewResponse() - - Respond(r, - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - resp.Body = nil - r.Respond(resp) - return nil - }) - } - })(), - ByCopying(&bytes.Buffer{})) -} - -func TestByClosing(t *testing.T) { - r := mocks.NewResponse() - err := Respond(r, ByClosing()) - if err != nil { - t.Fatalf("autorest: ByClosing failed (%v)", err) - } - if r.Body.(*mocks.Body).IsOpen() { - t.Fatalf("autorest: ByClosing did not close the response body") - } -} - -func TestByClosingAcceptsNilResponse(t *testing.T) { - r := mocks.NewResponse() - - Respond(r, - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - r.Respond(nil) - return nil - }) - } - })(), - ByClosing()) -} - -func TestByClosingAcceptsNilBody(t *testing.T) { - r := mocks.NewResponse() - - Respond(r, - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - resp.Body = nil - r.Respond(resp) - return nil - }) - } - })(), - ByClosing()) -} - -func TestByClosingClosesEvenAfterErrors(t *testing.T) { - var e error - - r := mocks.NewResponse() - Respond(r, - withErrorRespondDecorator(&e), - ByClosing()) - - if r.Body.(*mocks.Body).IsOpen() { - t.Fatalf("autorest: ByClosing did not close the response body after an error occurred") - } -} - -func TestByClosingClosesReturnsNestedErrors(t *testing.T) { - var e error - - r := mocks.NewResponse() - err := Respond(r, - withErrorRespondDecorator(&e), - ByClosing()) - - if err == nil || !reflect.DeepEqual(e, err) { - t.Fatalf("autorest: ByClosing failed to return a nested error") - } -} - -func TestByClosingIfErrorAcceptsNilResponse(t *testing.T) { - var e error - - r := mocks.NewResponse() - - Respond(r, - withErrorRespondDecorator(&e), - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - r.Respond(nil) - return nil - }) - } - })(), - ByClosingIfError()) -} - -func TestByClosingIfErrorAcceptsNilBody(t *testing.T) { - var e error - - r := mocks.NewResponse() - - Respond(r, - withErrorRespondDecorator(&e), - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - resp.Body = nil - r.Respond(resp) - return nil - }) - } - })(), - ByClosingIfError()) -} - -func TestByClosingIfErrorClosesIfAnErrorOccurs(t *testing.T) { - var e error - - r := mocks.NewResponse() - Respond(r, - withErrorRespondDecorator(&e), - ByClosingIfError()) - - if r.Body.(*mocks.Body).IsOpen() { - t.Fatalf("autorest: ByClosingIfError did not close the response body after an error occurred") - } -} - -func TestByClosingIfErrorDoesNotClosesIfNoErrorOccurs(t *testing.T) { - r := mocks.NewResponse() - Respond(r, - ByClosingIfError()) - - if !r.Body.(*mocks.Body).IsOpen() { - t.Fatalf("autorest: ByClosingIfError closed the response body even though no error occurred") - } -} - -func TestByDiscardingBody(t *testing.T) { - r := mocks.NewResponse() - err := Respond(r, - ByDiscardingBody()) - if err != nil { - t.Fatalf("autorest: ByDiscardingBody failed (%v)", err) - } - buf, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatalf("autorest: Reading result of ByDiscardingBody failed (%v)", err) - } - - if len(buf) != 0 { - t.Logf("autorest: Body was not empty after calling ByDiscardingBody.") - t.Fail() - } -} - -func TestByDiscardingBodyAcceptsNilResponse(t *testing.T) { - var e error - - r := mocks.NewResponse() - - Respond(r, - withErrorRespondDecorator(&e), - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - r.Respond(nil) - return nil - }) - } - })(), - ByDiscardingBody()) -} - -func TestByDiscardingBodyAcceptsNilBody(t *testing.T) { - var e error - - r := mocks.NewResponse() - - Respond(r, - withErrorRespondDecorator(&e), - (func() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - resp.Body.Close() - resp.Body = nil - r.Respond(resp) - return nil - }) - } - })(), - ByDiscardingBody()) -} - -func TestByUnmarshallingJSON(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err != nil { - t.Fatalf("autorest: ByUnmarshallingJSON failed (%v)", err) - } - if v.Name != "Rob Pike" || v.Age != 42 { - t.Fatalf("autorest: ByUnmarshallingJSON failed to properly unmarshal") - } -} - -func TestByUnmarshallingJSON_HandlesReadErrors(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - r.Body.(*mocks.Body).Close() - - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err == nil { - t.Fatalf("autorest: ByUnmarshallingJSON failed to receive / respond to read error") - } -} - -func TestByUnmarshallingJSONIncludesJSONInErrors(t *testing.T) { - v := &mocks.T{} - j := jsonT[0 : len(jsonT)-2] - r := mocks.NewResponseWithContent(j) - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err == nil || !strings.Contains(err.Error(), j) { - t.Fatalf("autorest: ByUnmarshallingJSON failed to return JSON in error (%v)", err) - } -} - -func TestByUnmarshallingJSONEmptyInput(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(``) - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err != nil { - t.Fatalf("autorest: ByUnmarshallingJSON failed to return nil in case of empty JSON (%v)", err) - } -} - -func TestByUnmarshallingXML(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(xmlT) - err := Respond(r, - ByUnmarshallingXML(v), - ByClosing()) - if err != nil { - t.Fatalf("autorest: ByUnmarshallingXML failed (%v)", err) - } - if v.Name != "Rob Pike" || v.Age != 42 { - t.Fatalf("autorest: ByUnmarshallingXML failed to properly unmarshal") - } -} - -func TestByUnmarshallingXML_HandlesReadErrors(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(xmlT) - r.Body.(*mocks.Body).Close() - - err := Respond(r, - ByUnmarshallingXML(v), - ByClosing()) - if err == nil { - t.Fatalf("autorest: ByUnmarshallingXML failed to receive / respond to read error") - } -} - -func TestByUnmarshallingXMLIncludesXMLInErrors(t *testing.T) { - v := &mocks.T{} - x := xmlT[0 : len(xmlT)-2] - r := mocks.NewResponseWithContent(x) - err := Respond(r, - ByUnmarshallingXML(v), - ByClosing()) - if err == nil || !strings.Contains(err.Error(), x) { - t.Fatalf("autorest: ByUnmarshallingXML failed to return XML in error (%v)", err) - } -} - -func TestRespondAcceptsNullResponse(t *testing.T) { - err := Respond(nil) - if err != nil { - t.Fatalf("autorest: Respond returned an unexpected error when given a null Response (%v)", err) - } -} - -func TestWithErrorUnlessStatusCodeOKResponse(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - err := Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - ByUnmarshallingJSON(v), - ByClosing()) - - if err != nil { - t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) failed on okay response. (%v)", err) - } - - if v.Name != "Rob Pike" || v.Age != 42 { - t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) corrupted the response body of okay response.") - } -} - -func TesWithErrorUnlessStatusCodeErrorResponse(t *testing.T) { - v := &mocks.T{} - e := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - r.Status = "400 BadRequest" - r.StatusCode = http.StatusBadRequest - - err := Respond(r, - WithErrorUnlessStatusCode(http.StatusOK), - ByUnmarshallingJSON(v), - ByClosing()) - - if err == nil { - t.Fatal("autorest: WithErrorUnlessStatusCode(http.StatusOK) did not return error, on a response to a bad request.") - } - - var errorRespBody []byte - if derr, ok := err.(DetailedError); !ok { - t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) got wrong error type : %T, expected: DetailedError, on a response to a bad request.", err) - } else { - errorRespBody = derr.ServiceError - } - - if errorRespBody == nil { - t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) ServiceError not returned in DetailedError on a response to a bad request.") - } - - err = json.Unmarshal(errorRespBody, e) - if err != nil { - t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) cannot parse error returned in ServiceError into json. %v", err) - } - - expected := &mocks.T{Name: "Rob Pike", Age: 42} - if e != expected { - t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK wrong value from parsed ServiceError: got=%#v expected=%#v", e, expected) - } -} - -func TestWithErrorUnlessStatusCode(t *testing.T) { - r := mocks.NewResponse() - r.Request = mocks.NewRequest() - r.Status = "400 BadRequest" - r.StatusCode = http.StatusBadRequest - - err := Respond(r, - WithErrorUnlessStatusCode(http.StatusBadRequest, http.StatusUnauthorized, http.StatusInternalServerError), - ByClosingIfError()) - - if err != nil { - t.Fatalf("autorest: WithErrorUnlessStatusCode returned an error (%v) for an acceptable status code (%s)", err, r.Status) - } -} - -func TestWithErrorUnlessStatusCodeEmitsErrorForUnacceptableStatusCode(t *testing.T) { - r := mocks.NewResponse() - r.Request = mocks.NewRequest() - r.Status = "400 BadRequest" - r.StatusCode = http.StatusBadRequest - - err := Respond(r, - WithErrorUnlessStatusCode(http.StatusOK, http.StatusUnauthorized, http.StatusInternalServerError), - ByClosingIfError()) - - if err == nil { - t.Fatalf("autorest: WithErrorUnlessStatusCode failed to return an error for an unacceptable status code (%s)", r.Status) - } -} - -func TestWithErrorUnlessOK(t *testing.T) { - r := mocks.NewResponse() - r.Request = mocks.NewRequest() - - err := Respond(r, - WithErrorUnlessOK(), - ByClosingIfError()) - - if err != nil { - t.Fatalf("autorest: WithErrorUnlessOK returned an error for OK status code (%v)", err) - } -} - -func TestWithErrorUnlessOKEmitsErrorIfNotOK(t *testing.T) { - r := mocks.NewResponse() - r.Request = mocks.NewRequest() - r.Status = "400 BadRequest" - r.StatusCode = http.StatusBadRequest - - err := Respond(r, - WithErrorUnlessOK(), - ByClosingIfError()) - - if err == nil { - t.Fatalf("autorest: WithErrorUnlessOK failed to return an error for a non-OK status code (%v)", err) - } -} - -func TestExtractHeader(t *testing.T) { - r := mocks.NewResponse() - v := []string{"v1", "v2", "v3"} - mocks.SetResponseHeaderValues(r, mocks.TestHeader, v) - - if !reflect.DeepEqual(ExtractHeader(mocks.TestHeader, r), v) { - t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", - mocks.TestHeader, v, mocks.TestHeader, ExtractHeader(mocks.TestHeader, r)) - } -} - -func TestExtractHeaderHandlesMissingHeader(t *testing.T) { - var v []string - r := mocks.NewResponse() - - if !reflect.DeepEqual(ExtractHeader(mocks.TestHeader, r), v) { - t.Fatalf("autorest: ExtractHeader failed to handle a missing header -- expected %v, received %v", - v, ExtractHeader(mocks.TestHeader, r)) - } -} - -func TestExtractHeaderValue(t *testing.T) { - r := mocks.NewResponse() - v := "v1" - mocks.SetResponseHeader(r, mocks.TestHeader, v) - - if ExtractHeaderValue(mocks.TestHeader, r) != v { - t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", - mocks.TestHeader, v, mocks.TestHeader, ExtractHeaderValue(mocks.TestHeader, r)) - } -} - -func TestExtractHeaderValueHandlesMissingHeader(t *testing.T) { - r := mocks.NewResponse() - v := "" - - if ExtractHeaderValue(mocks.TestHeader, r) != v { - t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", - mocks.TestHeader, v, mocks.TestHeader, ExtractHeaderValue(mocks.TestHeader, r)) - } -} - -func TestExtractHeaderValueRetrievesFirstValue(t *testing.T) { - r := mocks.NewResponse() - v := []string{"v1", "v2", "v3"} - mocks.SetResponseHeaderValues(r, mocks.TestHeader, v) - - if ExtractHeaderValue(mocks.TestHeader, r) != v[0] { - t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", - mocks.TestHeader, v[0], mocks.TestHeader, ExtractHeaderValue(mocks.TestHeader, r)) - } -} +package autorest + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "reflect" + "strings" + "testing" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +func ExampleWithErrorUnlessOK() { + r := mocks.NewResponse() + r.Request = mocks.NewRequest() + + // Respond and leave the response body open (for a subsequent responder to close) + err := Respond(r, + WithErrorUnlessOK(), + ByDiscardingBody(), + ByClosingIfError()) + + if err == nil { + fmt.Printf("%s of %s returned HTTP 200", r.Request.Method, r.Request.URL) + + // Complete handling the response and close the body + Respond(r, + ByDiscardingBody(), + ByClosing()) + } + // Output: GET of https://microsoft.com/a/b/c/ returned HTTP 200 +} + +func ExampleByUnmarshallingJSON() { + c := ` + { + "name" : "Rob Pike", + "age" : 42 + } + ` + + type V struct { + Name string `json:"name"` + Age int `json:"age"` + } + + v := &V{} + + Respond(mocks.NewResponseWithContent(c), + ByUnmarshallingJSON(v), + ByClosing()) + + fmt.Printf("%s is %d years old\n", v.Name, v.Age) + // Output: Rob Pike is 42 years old +} + +func ExampleByUnmarshallingXML() { + c := ` + + Rob Pike + 42 + ` + + type V struct { + Name string `xml:"Name"` + Age int `xml:"Age"` + } + + v := &V{} + + Respond(mocks.NewResponseWithContent(c), + ByUnmarshallingXML(v), + ByClosing()) + + fmt.Printf("%s is %d years old\n", v.Name, v.Age) + // Output: Rob Pike is 42 years old +} + +func TestCreateResponderDoesNotModify(t *testing.T) { + r1 := mocks.NewResponse() + r2 := mocks.NewResponse() + p := CreateResponder() + err := p.Respond(r1) + if err != nil { + t.Fatalf("autorest: CreateResponder failed (%v)", err) + } + if !reflect.DeepEqual(r1, r2) { + t.Fatalf("autorest: CreateResponder without decorators modified the response") + } +} + +func TestCreateResponderRunsDecoratorsInOrder(t *testing.T) { + s := "" + + d := func(n int) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil { + s += fmt.Sprintf("%d", n) + } + return err + }) + } + } + + p := CreateResponder(d(1), d(2), d(3)) + err := p.Respond(&http.Response{}) + if err != nil { + t.Fatalf("autorest: Respond failed (%v)", err) + } + + if s != "123" { + t.Fatalf("autorest: CreateResponder invoked decorators in an incorrect order; expected '123', received '%s'", s) + } +} + +func TestByIgnoring(t *testing.T) { + r := mocks.NewResponse() + + Respond(r, + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(r2 *http.Response) error { + r1 := mocks.NewResponse() + if !reflect.DeepEqual(r1, r2) { + t.Fatalf("autorest: ByIgnoring modified the HTTP Response -- received %v, expected %v", r2, r1) + } + return nil + }) + } + })(), + ByIgnoring(), + ByClosing()) +} + +func TestByCopying_Copies(t *testing.T) { + r := mocks.NewResponseWithContent(jsonT) + b := &bytes.Buffer{} + + err := Respond(r, + ByCopying(b), + ByUnmarshallingJSON(&mocks.T{}), + ByClosing()) + if err != nil { + t.Fatalf("autorest: ByCopying returned an unexpected error -- %v", err) + } + if b.String() != jsonT { + t.Fatalf("autorest: ByCopying failed to copy the bytes read") + } +} + +func TestByCopying_ReturnsNestedErrors(t *testing.T) { + r := mocks.NewResponseWithContent(jsonT) + + r.Body.Close() + err := Respond(r, + ByCopying(&bytes.Buffer{}), + ByUnmarshallingJSON(&mocks.T{}), + ByClosing()) + if err == nil { + t.Fatalf("autorest: ByCopying failed to return the expected error") + } +} + +func TestByCopying_AcceptsNilReponse(t *testing.T) { + r := mocks.NewResponse() + + Respond(r, + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + r.Respond(nil) + return nil + }) + } + })(), + ByCopying(&bytes.Buffer{})) +} + +func TestByCopying_AcceptsNilBody(t *testing.T) { + r := mocks.NewResponse() + + Respond(r, + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + resp.Body = nil + r.Respond(resp) + return nil + }) + } + })(), + ByCopying(&bytes.Buffer{})) +} + +func TestByClosing(t *testing.T) { + r := mocks.NewResponse() + err := Respond(r, ByClosing()) + if err != nil { + t.Fatalf("autorest: ByClosing failed (%v)", err) + } + if r.Body.(*mocks.Body).IsOpen() { + t.Fatalf("autorest: ByClosing did not close the response body") + } +} + +func TestByClosingAcceptsNilResponse(t *testing.T) { + r := mocks.NewResponse() + + Respond(r, + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + r.Respond(nil) + return nil + }) + } + })(), + ByClosing()) +} + +func TestByClosingAcceptsNilBody(t *testing.T) { + r := mocks.NewResponse() + + Respond(r, + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + resp.Body = nil + r.Respond(resp) + return nil + }) + } + })(), + ByClosing()) +} + +func TestByClosingClosesEvenAfterErrors(t *testing.T) { + var e error + + r := mocks.NewResponse() + Respond(r, + withErrorRespondDecorator(&e), + ByClosing()) + + if r.Body.(*mocks.Body).IsOpen() { + t.Fatalf("autorest: ByClosing did not close the response body after an error occurred") + } +} + +func TestByClosingClosesReturnsNestedErrors(t *testing.T) { + var e error + + r := mocks.NewResponse() + err := Respond(r, + withErrorRespondDecorator(&e), + ByClosing()) + + if err == nil || !reflect.DeepEqual(e, err) { + t.Fatalf("autorest: ByClosing failed to return a nested error") + } +} + +func TestByClosingIfErrorAcceptsNilResponse(t *testing.T) { + var e error + + r := mocks.NewResponse() + + Respond(r, + withErrorRespondDecorator(&e), + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + r.Respond(nil) + return nil + }) + } + })(), + ByClosingIfError()) +} + +func TestByClosingIfErrorAcceptsNilBody(t *testing.T) { + var e error + + r := mocks.NewResponse() + + Respond(r, + withErrorRespondDecorator(&e), + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + resp.Body = nil + r.Respond(resp) + return nil + }) + } + })(), + ByClosingIfError()) +} + +func TestByClosingIfErrorClosesIfAnErrorOccurs(t *testing.T) { + var e error + + r := mocks.NewResponse() + Respond(r, + withErrorRespondDecorator(&e), + ByClosingIfError()) + + if r.Body.(*mocks.Body).IsOpen() { + t.Fatalf("autorest: ByClosingIfError did not close the response body after an error occurred") + } +} + +func TestByClosingIfErrorDoesNotClosesIfNoErrorOccurs(t *testing.T) { + r := mocks.NewResponse() + Respond(r, + ByClosingIfError()) + + if !r.Body.(*mocks.Body).IsOpen() { + t.Fatalf("autorest: ByClosingIfError closed the response body even though no error occurred") + } +} + +func TestByDiscardingBody(t *testing.T) { + r := mocks.NewResponse() + err := Respond(r, + ByDiscardingBody()) + if err != nil { + t.Fatalf("autorest: ByDiscardingBody failed (%v)", err) + } + buf, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatalf("autorest: Reading result of ByDiscardingBody failed (%v)", err) + } + + if len(buf) != 0 { + t.Logf("autorest: Body was not empty after calling ByDiscardingBody.") + t.Fail() + } +} + +func TestByDiscardingBodyAcceptsNilResponse(t *testing.T) { + var e error + + r := mocks.NewResponse() + + Respond(r, + withErrorRespondDecorator(&e), + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + r.Respond(nil) + return nil + }) + } + })(), + ByDiscardingBody()) +} + +func TestByDiscardingBodyAcceptsNilBody(t *testing.T) { + var e error + + r := mocks.NewResponse() + + Respond(r, + withErrorRespondDecorator(&e), + (func() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + resp.Body.Close() + resp.Body = nil + r.Respond(resp) + return nil + }) + } + })(), + ByDiscardingBody()) +} + +func TestByUnmarshallingJSON(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err != nil { + t.Fatalf("autorest: ByUnmarshallingJSON failed (%v)", err) + } + if v.Name != "Rob Pike" || v.Age != 42 { + t.Fatalf("autorest: ByUnmarshallingJSON failed to properly unmarshal") + } +} + +func TestByUnmarshallingJSON_HandlesReadErrors(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + r.Body.(*mocks.Body).Close() + + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err == nil { + t.Fatalf("autorest: ByUnmarshallingJSON failed to receive / respond to read error") + } +} + +func TestByUnmarshallingJSONIncludesJSONInErrors(t *testing.T) { + v := &mocks.T{} + j := jsonT[0 : len(jsonT)-2] + r := mocks.NewResponseWithContent(j) + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err == nil || !strings.Contains(err.Error(), j) { + t.Fatalf("autorest: ByUnmarshallingJSON failed to return JSON in error (%v)", err) + } +} + +func TestByUnmarshallingJSONEmptyInput(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(``) + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err != nil { + t.Fatalf("autorest: ByUnmarshallingJSON failed to return nil in case of empty JSON (%v)", err) + } +} + +func TestByUnmarshallingXML(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(xmlT) + err := Respond(r, + ByUnmarshallingXML(v), + ByClosing()) + if err != nil { + t.Fatalf("autorest: ByUnmarshallingXML failed (%v)", err) + } + if v.Name != "Rob Pike" || v.Age != 42 { + t.Fatalf("autorest: ByUnmarshallingXML failed to properly unmarshal") + } +} + +func TestByUnmarshallingXML_HandlesReadErrors(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(xmlT) + r.Body.(*mocks.Body).Close() + + err := Respond(r, + ByUnmarshallingXML(v), + ByClosing()) + if err == nil { + t.Fatalf("autorest: ByUnmarshallingXML failed to receive / respond to read error") + } +} + +func TestByUnmarshallingXMLIncludesXMLInErrors(t *testing.T) { + v := &mocks.T{} + x := xmlT[0 : len(xmlT)-2] + r := mocks.NewResponseWithContent(x) + err := Respond(r, + ByUnmarshallingXML(v), + ByClosing()) + if err == nil || !strings.Contains(err.Error(), x) { + t.Fatalf("autorest: ByUnmarshallingXML failed to return XML in error (%v)", err) + } +} + +func TestRespondAcceptsNullResponse(t *testing.T) { + err := Respond(nil) + if err != nil { + t.Fatalf("autorest: Respond returned an unexpected error when given a null Response (%v)", err) + } +} + +func TestWithErrorUnlessStatusCodeOKResponse(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + err := Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + ByUnmarshallingJSON(v), + ByClosing()) + + if err != nil { + t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) failed on okay response. (%v)", err) + } + + if v.Name != "Rob Pike" || v.Age != 42 { + t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) corrupted the response body of okay response.") + } +} + +func TesWithErrorUnlessStatusCodeErrorResponse(t *testing.T) { + v := &mocks.T{} + e := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + r.Status = "400 BadRequest" + r.StatusCode = http.StatusBadRequest + + err := Respond(r, + WithErrorUnlessStatusCode(http.StatusOK), + ByUnmarshallingJSON(v), + ByClosing()) + + if err == nil { + t.Fatal("autorest: WithErrorUnlessStatusCode(http.StatusOK) did not return error, on a response to a bad request.") + } + + var errorRespBody []byte + if derr, ok := err.(DetailedError); !ok { + t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) got wrong error type : %T, expected: DetailedError, on a response to a bad request.", err) + } else { + errorRespBody = derr.ServiceError + } + + if errorRespBody == nil { + t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) ServiceError not returned in DetailedError on a response to a bad request.") + } + + err = json.Unmarshal(errorRespBody, e) + if err != nil { + t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK) cannot parse error returned in ServiceError into json. %v", err) + } + + expected := &mocks.T{Name: "Rob Pike", Age: 42} + if e != expected { + t.Fatalf("autorest: WithErrorUnlessStatusCode(http.StatusOK wrong value from parsed ServiceError: got=%#v expected=%#v", e, expected) + } +} + +func TestWithErrorUnlessStatusCode(t *testing.T) { + r := mocks.NewResponse() + r.Request = mocks.NewRequest() + r.Status = "400 BadRequest" + r.StatusCode = http.StatusBadRequest + + err := Respond(r, + WithErrorUnlessStatusCode(http.StatusBadRequest, http.StatusUnauthorized, http.StatusInternalServerError), + ByClosingIfError()) + + if err != nil { + t.Fatalf("autorest: WithErrorUnlessStatusCode returned an error (%v) for an acceptable status code (%s)", err, r.Status) + } +} + +func TestWithErrorUnlessStatusCodeEmitsErrorForUnacceptableStatusCode(t *testing.T) { + r := mocks.NewResponse() + r.Request = mocks.NewRequest() + r.Status = "400 BadRequest" + r.StatusCode = http.StatusBadRequest + + err := Respond(r, + WithErrorUnlessStatusCode(http.StatusOK, http.StatusUnauthorized, http.StatusInternalServerError), + ByClosingIfError()) + + if err == nil { + t.Fatalf("autorest: WithErrorUnlessStatusCode failed to return an error for an unacceptable status code (%s)", r.Status) + } +} + +func TestWithErrorUnlessOK(t *testing.T) { + r := mocks.NewResponse() + r.Request = mocks.NewRequest() + + err := Respond(r, + WithErrorUnlessOK(), + ByClosingIfError()) + + if err != nil { + t.Fatalf("autorest: WithErrorUnlessOK returned an error for OK status code (%v)", err) + } +} + +func TestWithErrorUnlessOKEmitsErrorIfNotOK(t *testing.T) { + r := mocks.NewResponse() + r.Request = mocks.NewRequest() + r.Status = "400 BadRequest" + r.StatusCode = http.StatusBadRequest + + err := Respond(r, + WithErrorUnlessOK(), + ByClosingIfError()) + + if err == nil { + t.Fatalf("autorest: WithErrorUnlessOK failed to return an error for a non-OK status code (%v)", err) + } +} + +func TestExtractHeader(t *testing.T) { + r := mocks.NewResponse() + v := []string{"v1", "v2", "v3"} + mocks.SetResponseHeaderValues(r, mocks.TestHeader, v) + + if !reflect.DeepEqual(ExtractHeader(mocks.TestHeader, r), v) { + t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", + mocks.TestHeader, v, mocks.TestHeader, ExtractHeader(mocks.TestHeader, r)) + } +} + +func TestExtractHeaderHandlesMissingHeader(t *testing.T) { + var v []string + r := mocks.NewResponse() + + if !reflect.DeepEqual(ExtractHeader(mocks.TestHeader, r), v) { + t.Fatalf("autorest: ExtractHeader failed to handle a missing header -- expected %v, received %v", + v, ExtractHeader(mocks.TestHeader, r)) + } +} + +func TestExtractHeaderValue(t *testing.T) { + r := mocks.NewResponse() + v := "v1" + mocks.SetResponseHeader(r, mocks.TestHeader, v) + + if ExtractHeaderValue(mocks.TestHeader, r) != v { + t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", + mocks.TestHeader, v, mocks.TestHeader, ExtractHeaderValue(mocks.TestHeader, r)) + } +} + +func TestExtractHeaderValueHandlesMissingHeader(t *testing.T) { + r := mocks.NewResponse() + v := "" + + if ExtractHeaderValue(mocks.TestHeader, r) != v { + t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", + mocks.TestHeader, v, mocks.TestHeader, ExtractHeaderValue(mocks.TestHeader, r)) + } +} + +func TestExtractHeaderValueRetrievesFirstValue(t *testing.T) { + r := mocks.NewResponse() + v := []string{"v1", "v2", "v3"} + mocks.SetResponseHeaderValues(r, mocks.TestHeader, v) + + if ExtractHeaderValue(mocks.TestHeader, r) != v[0] { + t.Fatalf("autorest: ExtractHeader failed to retrieve the expected header -- expected [%s]%v, received [%s]%v", + mocks.TestHeader, v[0], mocks.TestHeader, ExtractHeaderValue(mocks.TestHeader, r)) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go index 35a1491646..9c0697815b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/sender.go +++ b/vendor/github.com/Azure/go-autorest/autorest/sender.go @@ -1,270 +1,270 @@ -package autorest - -import ( - "bytes" - "fmt" - "io/ioutil" - "log" - "math" - "net/http" - "time" -) - -// Sender is the interface that wraps the Do method to send HTTP requests. -// -// The standard http.Client conforms to this interface. -type Sender interface { - Do(*http.Request) (*http.Response, error) -} - -// SenderFunc is a method that implements the Sender interface. -type SenderFunc func(*http.Request) (*http.Response, error) - -// Do implements the Sender interface on SenderFunc. -func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { - return sf(r) -} - -// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the -// http.Request and pass it along or, first, pass the http.Request along then react to the -// http.Response result. -type SendDecorator func(Sender) Sender - -// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. -func CreateSender(decorators ...SendDecorator) Sender { - return DecorateSender(&http.Client{}, decorators...) -} - -// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to -// the Sender. Decorators are applied in the order received, but their affect upon the request -// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a -// post-decorator (pass the http.Request along and react to the results in http.Response). -func DecorateSender(s Sender, decorators ...SendDecorator) Sender { - for _, decorate := range decorators { - s = decorate(s) - } - return s -} - -// Send sends, by means of the default http.Client, the passed http.Request, returning the -// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which -// it will apply the http.Client before invoking the Do method. -// -// Send is a convenience method and not recommended for production. Advanced users should use -// SendWithSender, passing and sharing their own Sender (e.g., instance of http.Client). -// -// Send will not poll or retry requests. -func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) { - return SendWithSender(&http.Client{}, r, decorators...) -} - -// SendWithSender sends the passed http.Request, through the provided Sender, returning the -// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which -// it will apply the http.Client before invoking the Do method. -// -// SendWithSender will not poll or retry requests. -func SendWithSender(s Sender, r *http.Request, decorators ...SendDecorator) (*http.Response, error) { - return DecorateSender(s, decorators...).Do(r) -} - -// AfterDelay returns a SendDecorator that delays for the passed time.Duration before -// invoking the Sender. The delay may be terminated by closing the optional channel on the -// http.Request. If canceled, no further Senders are invoked. -func AfterDelay(d time.Duration) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - if !DelayForBackoff(d, 0, r.Cancel) { - return nil, fmt.Errorf("autorest: AfterDelay canceled before full delay") - } - return s.Do(r) - }) - } -} - -// AsIs returns a SendDecorator that invokes the passed Sender without modifying the http.Request. -func AsIs() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - return s.Do(r) - }) - } -} - -// DoCloseIfError returns a SendDecorator that first invokes the passed Sender after which -// it closes the response if the passed Sender returns an error and the response body exists. -func DoCloseIfError() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err != nil { - Respond(resp, ByDiscardingBody(), ByClosing()) - } - return resp, err - }) - } -} - -// DoErrorIfStatusCode returns a SendDecorator that emits an error if the response StatusCode is -// among the set passed. Since these are artificial errors, the response body may still require -// closing. -func DoErrorIfStatusCode(codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err == nil && ResponseHasStatusCode(resp, codes...) { - err = NewErrorWithResponse("autorest", "DoErrorIfStatusCode", resp, "%v %v failed with %s", - resp.Request.Method, - resp.Request.URL, - resp.Status) - } - return resp, err - }) - } -} - -// DoErrorUnlessStatusCode returns a SendDecorator that emits an error unless the response -// StatusCode is among the set passed. Since these are artificial errors, the response body -// may still require closing. -func DoErrorUnlessStatusCode(codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err == nil && !ResponseHasStatusCode(resp, codes...) { - err = NewErrorWithResponse("autorest", "DoErrorUnlessStatusCode", resp, "%v %v failed with %s", - resp.Request.Method, - resp.Request.URL, - resp.Status) - } - return resp, err - }) - } -} - -// DoPollForStatusCodes returns a SendDecorator that polls if the http.Response contains one of the -// passed status codes. It expects the http.Response to contain a Location header providing the -// URL at which to poll (using GET) and will poll until the time passed is equal to or greater than -// the supplied duration. It will delay between requests for the duration specified in the -// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by -// closing the optional channel on the http.Request. -func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - resp, err = s.Do(r) - - if err == nil && ResponseHasStatusCode(resp, codes...) { - r, err = NewPollingRequest(resp, r.Cancel) - - for err == nil && ResponseHasStatusCode(resp, codes...) { - Respond(resp, - ByDiscardingBody(), - ByClosing()) - resp, err = SendWithSender(s, r, - AfterDelay(GetRetryAfter(resp, delay))) - } - } - - return resp, err - }) - } -} - -// DoRetryForAttempts returns a SendDecorator that retries a failed request for up to the specified -// number of attempts, exponentially backing off between requests using the supplied backoff -// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on -// the http.Request. -func DoRetryForAttempts(attempts int, backoff time.Duration) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - for attempt := 0; attempt < attempts; attempt++ { - resp, err = s.Do(r) - if err == nil { - return resp, err - } - DelayForBackoff(backoff, attempt, r.Cancel) - } - return resp, err - }) - } -} - -// DoRetryForStatusCodes returns a SendDecorator that retries for specified statusCodes for up to the specified -// number of attempts, exponentially backing off between requests using the supplied backoff -// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on -// the http.Request. -func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - b := []byte{} - if r.Body != nil { - b, err = ioutil.ReadAll(r.Body) - if err != nil { - return resp, err - } - } - - // Increment to add the first call (attempts denotes number of retries) - attempts++ - for attempt := 0; attempt < attempts; attempt++ { - r.Body = ioutil.NopCloser(bytes.NewBuffer(b)) - resp, err = s.Do(r) - if err != nil || !ResponseHasStatusCode(resp, codes...) { - return resp, err - } - DelayForBackoff(backoff, attempt, r.Cancel) - } - return resp, err - }) - } -} - -// DoRetryForDuration returns a SendDecorator that retries the request until the total time is equal -// to or greater than the specified duration, exponentially backing off between requests using the -// supplied backoff time.Duration (which may be zero). Retrying may be canceled by closing the -// optional channel on the http.Request. -func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { - end := time.Now().Add(d) - for attempt := 0; time.Now().Before(end); attempt++ { - resp, err = s.Do(r) - if err == nil { - return resp, err - } - DelayForBackoff(backoff, attempt, r.Cancel) - } - return resp, err - }) - } -} - -// WithLogging returns a SendDecorator that implements simple before and after logging of the -// request. -func WithLogging(logger *log.Logger) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - logger.Printf("Sending %s %s", r.Method, r.URL) - resp, err := s.Do(r) - if err != nil { - logger.Printf("%s %s received error '%v'", r.Method, r.URL, err) - } else { - logger.Printf("%s %s received %s", r.Method, r.URL, resp.Status) - } - return resp, err - }) - } -} - -// DelayForBackoff invokes time.After for the supplied backoff duration raised to the power of -// passed attempt (i.e., an exponential backoff delay). Backoff duration is in seconds and can set -// to zero for no delay. The delay may be canceled by closing the passed channel. If terminated early, -// returns false. -// Note: Passing attempt 1 will result in doubling "backoff" duration. Treat this as a zero-based attempt -// count. -func DelayForBackoff(backoff time.Duration, attempt int, cancel <-chan struct{}) bool { - select { - case <-time.After(time.Duration(backoff.Seconds()*math.Pow(2, float64(attempt))) * time.Second): - return true - case <-cancel: - return false - } -} +package autorest + +import ( + "bytes" + "fmt" + "io/ioutil" + "log" + "math" + "net/http" + "time" +) + +// Sender is the interface that wraps the Do method to send HTTP requests. +// +// The standard http.Client conforms to this interface. +type Sender interface { + Do(*http.Request) (*http.Response, error) +} + +// SenderFunc is a method that implements the Sender interface. +type SenderFunc func(*http.Request) (*http.Response, error) + +// Do implements the Sender interface on SenderFunc. +func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { + return sf(r) +} + +// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the +// http.Request and pass it along or, first, pass the http.Request along then react to the +// http.Response result. +type SendDecorator func(Sender) Sender + +// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. +func CreateSender(decorators ...SendDecorator) Sender { + return DecorateSender(&http.Client{}, decorators...) +} + +// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to +// the Sender. Decorators are applied in the order received, but their affect upon the request +// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a +// post-decorator (pass the http.Request along and react to the results in http.Response). +func DecorateSender(s Sender, decorators ...SendDecorator) Sender { + for _, decorate := range decorators { + s = decorate(s) + } + return s +} + +// Send sends, by means of the default http.Client, the passed http.Request, returning the +// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which +// it will apply the http.Client before invoking the Do method. +// +// Send is a convenience method and not recommended for production. Advanced users should use +// SendWithSender, passing and sharing their own Sender (e.g., instance of http.Client). +// +// Send will not poll or retry requests. +func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) { + return SendWithSender(&http.Client{}, r, decorators...) +} + +// SendWithSender sends the passed http.Request, through the provided Sender, returning the +// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which +// it will apply the http.Client before invoking the Do method. +// +// SendWithSender will not poll or retry requests. +func SendWithSender(s Sender, r *http.Request, decorators ...SendDecorator) (*http.Response, error) { + return DecorateSender(s, decorators...).Do(r) +} + +// AfterDelay returns a SendDecorator that delays for the passed time.Duration before +// invoking the Sender. The delay may be terminated by closing the optional channel on the +// http.Request. If canceled, no further Senders are invoked. +func AfterDelay(d time.Duration) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + if !DelayForBackoff(d, 0, r.Cancel) { + return nil, fmt.Errorf("autorest: AfterDelay canceled before full delay") + } + return s.Do(r) + }) + } +} + +// AsIs returns a SendDecorator that invokes the passed Sender without modifying the http.Request. +func AsIs() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return s.Do(r) + }) + } +} + +// DoCloseIfError returns a SendDecorator that first invokes the passed Sender after which +// it closes the response if the passed Sender returns an error and the response body exists. +func DoCloseIfError() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err != nil { + Respond(resp, ByDiscardingBody(), ByClosing()) + } + return resp, err + }) + } +} + +// DoErrorIfStatusCode returns a SendDecorator that emits an error if the response StatusCode is +// among the set passed. Since these are artificial errors, the response body may still require +// closing. +func DoErrorIfStatusCode(codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err == nil && ResponseHasStatusCode(resp, codes...) { + err = NewErrorWithResponse("autorest", "DoErrorIfStatusCode", resp, "%v %v failed with %s", + resp.Request.Method, + resp.Request.URL, + resp.Status) + } + return resp, err + }) + } +} + +// DoErrorUnlessStatusCode returns a SendDecorator that emits an error unless the response +// StatusCode is among the set passed. Since these are artificial errors, the response body +// may still require closing. +func DoErrorUnlessStatusCode(codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err == nil && !ResponseHasStatusCode(resp, codes...) { + err = NewErrorWithResponse("autorest", "DoErrorUnlessStatusCode", resp, "%v %v failed with %s", + resp.Request.Method, + resp.Request.URL, + resp.Status) + } + return resp, err + }) + } +} + +// DoPollForStatusCodes returns a SendDecorator that polls if the http.Response contains one of the +// passed status codes. It expects the http.Response to contain a Location header providing the +// URL at which to poll (using GET) and will poll until the time passed is equal to or greater than +// the supplied duration. It will delay between requests for the duration specified in the +// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by +// closing the optional channel on the http.Request. +func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + resp, err = s.Do(r) + + if err == nil && ResponseHasStatusCode(resp, codes...) { + r, err = NewPollingRequest(resp, r.Cancel) + + for err == nil && ResponseHasStatusCode(resp, codes...) { + Respond(resp, + ByDiscardingBody(), + ByClosing()) + resp, err = SendWithSender(s, r, + AfterDelay(GetRetryAfter(resp, delay))) + } + } + + return resp, err + }) + } +} + +// DoRetryForAttempts returns a SendDecorator that retries a failed request for up to the specified +// number of attempts, exponentially backing off between requests using the supplied backoff +// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on +// the http.Request. +func DoRetryForAttempts(attempts int, backoff time.Duration) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + for attempt := 0; attempt < attempts; attempt++ { + resp, err = s.Do(r) + if err == nil { + return resp, err + } + DelayForBackoff(backoff, attempt, r.Cancel) + } + return resp, err + }) + } +} + +// DoRetryForStatusCodes returns a SendDecorator that retries for specified statusCodes for up to the specified +// number of attempts, exponentially backing off between requests using the supplied backoff +// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on +// the http.Request. +func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + b := []byte{} + if r.Body != nil { + b, err = ioutil.ReadAll(r.Body) + if err != nil { + return resp, err + } + } + + // Increment to add the first call (attempts denotes number of retries) + attempts++ + for attempt := 0; attempt < attempts; attempt++ { + r.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + resp, err = s.Do(r) + if err != nil || !ResponseHasStatusCode(resp, codes...) { + return resp, err + } + DelayForBackoff(backoff, attempt, r.Cancel) + } + return resp, err + }) + } +} + +// DoRetryForDuration returns a SendDecorator that retries the request until the total time is equal +// to or greater than the specified duration, exponentially backing off between requests using the +// supplied backoff time.Duration (which may be zero). Retrying may be canceled by closing the +// optional channel on the http.Request. +func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + end := time.Now().Add(d) + for attempt := 0; time.Now().Before(end); attempt++ { + resp, err = s.Do(r) + if err == nil { + return resp, err + } + DelayForBackoff(backoff, attempt, r.Cancel) + } + return resp, err + }) + } +} + +// WithLogging returns a SendDecorator that implements simple before and after logging of the +// request. +func WithLogging(logger *log.Logger) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + logger.Printf("Sending %s %s", r.Method, r.URL) + resp, err := s.Do(r) + if err != nil { + logger.Printf("%s %s received error '%v'", r.Method, r.URL, err) + } else { + logger.Printf("%s %s received %s", r.Method, r.URL, resp.Status) + } + return resp, err + }) + } +} + +// DelayForBackoff invokes time.After for the supplied backoff duration raised to the power of +// passed attempt (i.e., an exponential backoff delay). Backoff duration is in seconds and can set +// to zero for no delay. The delay may be canceled by closing the passed channel. If terminated early, +// returns false. +// Note: Passing attempt 1 will result in doubling "backoff" duration. Treat this as a zero-based attempt +// count. +func DelayForBackoff(backoff time.Duration, attempt int, cancel <-chan struct{}) bool { + select { + case <-time.After(time.Duration(backoff.Seconds()*math.Pow(2, float64(attempt))) * time.Second): + return true + case <-cancel: + return false + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender_test.go b/vendor/github.com/Azure/go-autorest/autorest/sender_test.go index bc42ed5ec5..d8e7beddbd 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/sender_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/sender_test.go @@ -1,767 +1,767 @@ -package autorest - -import ( - "bytes" - "fmt" - "log" - "net/http" - "os" - "reflect" - "sync" - "testing" - "time" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -func ExampleSendWithSender() { - r := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(r) - - client := mocks.NewSender() - client.AppendAndRepeatResponse(r, 10) - - logger := log.New(os.Stdout, "autorest: ", 0) - na := NullAuthorizer{} - - req, _ := Prepare(&http.Request{}, - AsGet(), - WithBaseURL("https://microsoft.com/a/b/c/"), - na.WithAuthorization()) - - r, _ = SendWithSender(client, req, - WithLogging(logger), - DoErrorIfStatusCode(http.StatusAccepted), - DoCloseIfError(), - DoRetryForAttempts(5, time.Duration(0))) - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - // Output: - // autorest: Sending GET https://microsoft.com/a/b/c/ - // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted - // autorest: Sending GET https://microsoft.com/a/b/c/ - // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted - // autorest: Sending GET https://microsoft.com/a/b/c/ - // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted - // autorest: Sending GET https://microsoft.com/a/b/c/ - // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted - // autorest: Sending GET https://microsoft.com/a/b/c/ - // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted -} - -func ExampleDoRetryForAttempts() { - client := mocks.NewSender() - client.SetAndRepeatError(fmt.Errorf("Faux Error"), 10) - - // Retry with backoff -- ensure returned Bodies are closed - r, _ := SendWithSender(client, mocks.NewRequest(), - DoCloseIfError(), - DoRetryForAttempts(5, time.Duration(0))) - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - fmt.Printf("Retry stopped after %d attempts", client.Attempts()) - // Output: Retry stopped after 5 attempts -} - -func ExampleDoErrorIfStatusCode() { - client := mocks.NewSender() - client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("204 NoContent", http.StatusNoContent), 10) - - // Chain decorators to retry the request, up to five times, if the status code is 204 - r, _ := SendWithSender(client, mocks.NewRequest(), - DoErrorIfStatusCode(http.StatusNoContent), - DoCloseIfError(), - DoRetryForAttempts(5, time.Duration(0))) - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - fmt.Printf("Retry stopped after %d attempts with code %s", client.Attempts(), r.Status) - // Output: Retry stopped after 5 attempts with code 204 NoContent -} - -func TestSendWithSenderRunsDecoratorsInOrder(t *testing.T) { - client := mocks.NewSender() - s := "" - - r, err := SendWithSender(client, mocks.NewRequest(), - withMessage(&s, "a"), - withMessage(&s, "b"), - withMessage(&s, "c")) - if err != nil { - t.Fatalf("autorest: SendWithSender returned an error (%v)", err) - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - if s != "abc" { - t.Fatalf("autorest: SendWithSender invoke decorators out of order; expected 'abc', received '%s'", s) - } -} - -func TestCreateSender(t *testing.T) { - f := false - - s := CreateSender( - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - f = true - return nil, nil - }) - } - })()) - s.Do(&http.Request{}) - - if !f { - t.Fatal("autorest: CreateSender failed to apply supplied decorator") - } -} - -func TestSend(t *testing.T) { - f := false - - Send(&http.Request{}, - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - f = true - return nil, nil - }) - } - })()) - - if !f { - t.Fatal("autorest: Send failed to apply supplied decorator") - } -} - -func TestAfterDelayWaits(t *testing.T) { - client := mocks.NewSender() - - d := 2 * time.Second - - tt := time.Now() - r, _ := SendWithSender(client, mocks.NewRequest(), - AfterDelay(d)) - s := time.Since(tt) - if s < d { - t.Fatal("autorest: AfterDelay failed to wait for at least the specified duration") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestAfterDelay_Cancels(t *testing.T) { - client := mocks.NewSender() - cancel := make(chan struct{}) - delay := 5 * time.Second - - var wg sync.WaitGroup - wg.Add(1) - tt := time.Now() - go func() { - req := mocks.NewRequest() - req.Cancel = cancel - wg.Done() - SendWithSender(client, req, - AfterDelay(delay)) - }() - wg.Wait() - close(cancel) - time.Sleep(5 * time.Millisecond) - if time.Since(tt) >= delay { - t.Fatal("autorest: AfterDelay failed to cancel") - } -} - -func TestAfterDelayDoesNotWaitTooLong(t *testing.T) { - client := mocks.NewSender() - - d := 5 * time.Millisecond - start := time.Now() - r, _ := SendWithSender(client, mocks.NewRequest(), - AfterDelay(d)) - - if time.Since(start) > (5 * d) { - t.Fatal("autorest: AfterDelay waited too long (exceeded 5 times specified duration)") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestAsIs(t *testing.T) { - client := mocks.NewSender() - - r1 := mocks.NewResponse() - client.AppendResponse(r1) - - r2, err := SendWithSender(client, mocks.NewRequest(), - AsIs()) - if err != nil { - t.Fatalf("autorest: AsIs returned an unexpected error (%v)", err) - } else if !reflect.DeepEqual(r1, r2) { - t.Fatalf("autorest: AsIs modified the response -- received %v, expected %v", r2, r1) - } - - Respond(r1, - ByDiscardingBody(), - ByClosing()) - Respond(r2, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoCloseIfError(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(mocks.NewResponseWithStatus("400 BadRequest", http.StatusBadRequest)) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoErrorIfStatusCode(http.StatusBadRequest), - DoCloseIfError()) - - if r.Body.(*mocks.Body).IsOpen() { - t.Fatal("autorest: Expected DoCloseIfError to close response body -- it was left open") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoCloseIfErrorAcceptsNilResponse(t *testing.T) { - client := mocks.NewSender() - - SendWithSender(client, mocks.NewRequest(), - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err != nil { - resp.Body.Close() - } - return nil, fmt.Errorf("Faux Error") - }) - } - })(), - DoCloseIfError()) -} - -func TestDoCloseIfErrorAcceptsNilBody(t *testing.T) { - client := mocks.NewSender() - - SendWithSender(client, mocks.NewRequest(), - (func() SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err != nil { - resp.Body.Close() - } - resp.Body = nil - return resp, fmt.Errorf("Faux Error") - }) - } - })(), - DoCloseIfError()) -} - -func TestDoErrorIfStatusCode(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(mocks.NewResponseWithStatus("400 BadRequest", http.StatusBadRequest)) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoErrorIfStatusCode(http.StatusBadRequest), - DoCloseIfError()) - if err == nil { - t.Fatal("autorest: DoErrorIfStatusCode failed to emit an error for passed code") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoErrorIfStatusCodeIgnoresStatusCodes(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(newAcceptedResponse()) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoErrorIfStatusCode(http.StatusBadRequest), - DoCloseIfError()) - if err != nil { - t.Fatal("autorest: DoErrorIfStatusCode failed to ignore a status code") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoErrorUnlessStatusCode(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(mocks.NewResponseWithStatus("400 BadRequest", http.StatusBadRequest)) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoErrorUnlessStatusCode(http.StatusAccepted), - DoCloseIfError()) - if err == nil { - t.Fatal("autorest: DoErrorUnlessStatusCode failed to emit an error for an unknown status code") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoErrorUnlessStatusCodeIgnoresStatusCodes(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(newAcceptedResponse()) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoErrorUnlessStatusCode(http.StatusAccepted), - DoCloseIfError()) - if err != nil { - t.Fatal("autorest: DoErrorUnlessStatusCode emitted an error for a knonwn status code") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForAttemptsStopsAfterSuccess(t *testing.T) { - client := mocks.NewSender() - - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForAttempts(5, time.Duration(0))) - if client.Attempts() != 1 { - t.Fatalf("autorest: DoRetryForAttempts failed to stop after success -- expected attempts %v, actual %v", - 1, client.Attempts()) - } - if err != nil { - t.Fatalf("autorest: DoRetryForAttempts returned an unexpected error (%v)", err) - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForAttemptsStopsAfterAttempts(t *testing.T) { - client := mocks.NewSender() - client.SetAndRepeatError(fmt.Errorf("Faux Error"), 10) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForAttempts(5, time.Duration(0)), - DoCloseIfError()) - if err == nil { - t.Fatal("autorest: Mock client failed to emit errors") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - if client.Attempts() != 5 { - t.Fatal("autorest: DoRetryForAttempts failed to stop after specified number of attempts") - } -} - -func TestDoRetryForAttemptsReturnsResponse(t *testing.T) { - client := mocks.NewSender() - client.SetError(fmt.Errorf("Faux Error")) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForAttempts(1, time.Duration(0))) - if err == nil { - t.Fatal("autorest: Mock client failed to emit errors") - } - - if r == nil { - t.Fatal("autorest: DoRetryForAttempts failed to return the underlying response") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForDurationStopsAfterSuccess(t *testing.T) { - client := mocks.NewSender() - - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForDuration(10*time.Millisecond, time.Duration(0))) - if client.Attempts() != 1 { - t.Fatalf("autorest: DoRetryForDuration failed to stop after success -- expected attempts %v, actual %v", - 1, client.Attempts()) - } - if err != nil { - t.Fatalf("autorest: DoRetryForDuration returned an unexpected error (%v)", err) - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForDurationStopsAfterDuration(t *testing.T) { - client := mocks.NewSender() - client.SetAndRepeatError(fmt.Errorf("Faux Error"), -1) - - d := 5 * time.Millisecond - start := time.Now() - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForDuration(d, time.Duration(0)), - DoCloseIfError()) - if err == nil { - t.Fatal("autorest: Mock client failed to emit errors") - } - - if time.Since(start) < d { - t.Fatal("autorest: DoRetryForDuration failed stopped too soon") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForDurationStopsWithinReason(t *testing.T) { - client := mocks.NewSender() - client.SetAndRepeatError(fmt.Errorf("Faux Error"), -1) - - d := 5 * time.Second - start := time.Now() - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForDuration(d, time.Duration(0)), - DoCloseIfError()) - if err == nil { - t.Fatal("autorest: Mock client failed to emit errors") - } - - if time.Since(start) > (5 * d) { - t.Fatal("autorest: DoRetryForDuration failed stopped soon enough (exceeded 5 times specified duration)") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForDurationReturnsResponse(t *testing.T) { - client := mocks.NewSender() - client.SetAndRepeatError(fmt.Errorf("Faux Error"), -1) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoRetryForDuration(10*time.Millisecond, time.Duration(0)), - DoCloseIfError()) - if err == nil { - t.Fatal("autorest: Mock client failed to emit errors") - } - - if r == nil { - t.Fatal("autorest: DoRetryForDuration failed to return the underlying response") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDelayForBackoff(t *testing.T) { - d := 2 * time.Second - start := time.Now() - DelayForBackoff(d, 0, nil) - if time.Since(start) < d { - t.Fatal("autorest: DelayForBackoff did not delay as long as expected") - } -} - -func TestDelayForBackoff_Cancels(t *testing.T) { - cancel := make(chan struct{}) - delay := 5 * time.Second - - var wg sync.WaitGroup - wg.Add(1) - start := time.Now() - go func() { - wg.Done() - DelayForBackoff(delay, 0, cancel) - }() - wg.Wait() - close(cancel) - time.Sleep(5 * time.Millisecond) - if time.Since(start) >= delay { - t.Fatal("autorest: DelayForBackoff failed to cancel") - } -} - -func TestDelayForBackoffWithinReason(t *testing.T) { - d := 5 * time.Second - maxCoefficient := 2 - start := time.Now() - DelayForBackoff(d, 0, nil) - if time.Since(start) > (time.Duration(maxCoefficient) * d) { - - t.Fatalf("autorest: DelayForBackoff delayed too long (exceeded %d times the specified duration)", maxCoefficient) - } -} - -func TestDoPollForStatusCodes_IgnoresUnspecifiedStatusCodes(t *testing.T) { - client := mocks.NewSender() - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Duration(0), time.Duration(0))) - - if client.Attempts() != 1 { - t.Fatalf("autorest: Sender#DoPollForStatusCodes polled for unspecified status code") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoPollForStatusCodes_PollsForSpecifiedStatusCodes(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(newAcceptedResponse()) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) - - if client.Attempts() != 2 { - t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to poll for specified status code") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoPollForStatusCodes_CanBeCanceled(t *testing.T) { - cancel := make(chan struct{}) - delay := 5 * time.Second - - r := mocks.NewResponse() - mocks.SetAcceptedHeaders(r) - client := mocks.NewSender() - client.AppendAndRepeatResponse(r, 100) - - var wg sync.WaitGroup - wg.Add(1) - start := time.Now() - go func() { - wg.Done() - r, _ := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) - Respond(r, - ByDiscardingBody(), - ByClosing()) - }() - wg.Wait() - close(cancel) - time.Sleep(5 * time.Millisecond) - if time.Since(start) >= delay { - t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to cancel") - } -} - -func TestDoPollForStatusCodes_ClosesAllNonreturnedResponseBodiesWhenPolling(t *testing.T) { - resp := newAcceptedResponse() - - client := mocks.NewSender() - client.AppendAndRepeatResponse(resp, 2) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) - - if resp.Body.(*mocks.Body).IsOpen() || resp.Body.(*mocks.Body).CloseAttempts() < 2 { - t.Fatalf("autorest: Sender#DoPollForStatusCodes did not close unreturned response bodies") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoPollForStatusCodes_LeavesLastResponseBodyOpen(t *testing.T) { - client := mocks.NewSender() - client.AppendResponse(newAcceptedResponse()) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) - - if !r.Body.(*mocks.Body).IsOpen() { - t.Fatalf("autorest: Sender#DoPollForStatusCodes did not leave open the body of the last response") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoPollForStatusCodes_StopsPollingAfterAnError(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(newAcceptedResponse(), 5) - client.SetError(fmt.Errorf("Faux Error")) - client.SetEmitErrorAfter(1) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) - - if client.Attempts() > 2 { - t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to stop polling after receiving an error") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoPollForStatusCodes_ReturnsPollingError(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(newAcceptedResponse(), 5) - client.SetError(fmt.Errorf("Faux Error")) - client.SetEmitErrorAfter(1) - - r, err := SendWithSender(client, mocks.NewRequest(), - DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) - - if err == nil { - t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to return error from polling") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestWithLogging_Logs(t *testing.T) { - buf := &bytes.Buffer{} - logger := log.New(buf, "autorest: ", 0) - client := mocks.NewSender() - - r, _ := SendWithSender(client, &http.Request{}, - WithLogging(logger)) - - if buf.String() == "" { - t.Fatal("autorest: Sender#WithLogging failed to log the request") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestWithLogging_HandlesMissingResponse(t *testing.T) { - buf := &bytes.Buffer{} - logger := log.New(buf, "autorest: ", 0) - client := mocks.NewSender() - client.AppendResponse(nil) - client.SetError(fmt.Errorf("Faux Error")) - - r, err := SendWithSender(client, &http.Request{}, - WithLogging(logger)) - - if r != nil || err == nil { - t.Fatal("autorest: Sender#WithLogging returned a valid response -- expecting nil") - } - if buf.String() == "" { - t.Fatal("autorest: Sender#WithLogging failed to log the request for a nil response") - } - - Respond(r, - ByDiscardingBody(), - ByClosing()) -} - -func TestDoRetryForStatusCodesWithSuccess(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("408 Request Timeout", http.StatusRequestTimeout), 2) - client.AppendResponse(mocks.NewResponseWithStatus("200 OK", http.StatusOK)) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoRetryForStatusCodes(5, time.Duration(2*time.Second), http.StatusRequestTimeout), - ) - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - if client.Attempts() != 3 { - t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: StatusCode %v in %v attempts; Want: StatusCode 200 OK in 2 attempts -- ", - r.Status, client.Attempts()-1) - } -} - -func TestDoRetryForStatusCodesWithNoSuccess(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("504 Gateway Timeout", http.StatusGatewayTimeout), 5) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoRetryForStatusCodes(2, time.Duration(2*time.Second), http.StatusGatewayTimeout), - ) - Respond(r, - ByDiscardingBody(), - ByClosing()) - - if client.Attempts() != 3 { - t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: failed stop after %v retry attempts; Want: Stop after 2 retry attempts", - client.Attempts()-1) - } -} - -func TestDoRetryForStatusCodes_CodeNotInRetryList(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("204 No Content", http.StatusNoContent), 1) - - r, _ := SendWithSender(client, mocks.NewRequest(), - DoRetryForStatusCodes(6, time.Duration(2*time.Second), http.StatusGatewayTimeout), - ) - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - if client.Attempts() != 1 || r.Status != "204 No Content" { - t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: Retry attempts %v for StatusCode %v; Want: 0 attempts for StatusCode 204", - client.Attempts(), r.Status) - } -} - -func TestDoRetryForStatusCodes_RequestBodyReadError(t *testing.T) { - client := mocks.NewSender() - client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("204 No Content", http.StatusNoContent), 2) - - r, err := SendWithSender(client, mocks.NewRequestWithCloseBody(), - DoRetryForStatusCodes(6, time.Duration(2*time.Second), http.StatusGatewayTimeout), - ) - - Respond(r, - ByDiscardingBody(), - ByClosing()) - - if err == nil || client.Attempts() != 0 { - t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: Not failed for request body read error; Want: Failed for body read error - %v", err) - } -} - -func newAcceptedResponse() *http.Response { - resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) - mocks.SetAcceptedHeaders(resp) - return resp -} +package autorest + +import ( + "bytes" + "fmt" + "log" + "net/http" + "os" + "reflect" + "sync" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +func ExampleSendWithSender() { + r := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(r) + + client := mocks.NewSender() + client.AppendAndRepeatResponse(r, 10) + + logger := log.New(os.Stdout, "autorest: ", 0) + na := NullAuthorizer{} + + req, _ := Prepare(&http.Request{}, + AsGet(), + WithBaseURL("https://microsoft.com/a/b/c/"), + na.WithAuthorization()) + + r, _ = SendWithSender(client, req, + WithLogging(logger), + DoErrorIfStatusCode(http.StatusAccepted), + DoCloseIfError(), + DoRetryForAttempts(5, time.Duration(0))) + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + // Output: + // autorest: Sending GET https://microsoft.com/a/b/c/ + // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted + // autorest: Sending GET https://microsoft.com/a/b/c/ + // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted + // autorest: Sending GET https://microsoft.com/a/b/c/ + // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted + // autorest: Sending GET https://microsoft.com/a/b/c/ + // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted + // autorest: Sending GET https://microsoft.com/a/b/c/ + // autorest: GET https://microsoft.com/a/b/c/ received 202 Accepted +} + +func ExampleDoRetryForAttempts() { + client := mocks.NewSender() + client.SetAndRepeatError(fmt.Errorf("Faux Error"), 10) + + // Retry with backoff -- ensure returned Bodies are closed + r, _ := SendWithSender(client, mocks.NewRequest(), + DoCloseIfError(), + DoRetryForAttempts(5, time.Duration(0))) + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + fmt.Printf("Retry stopped after %d attempts", client.Attempts()) + // Output: Retry stopped after 5 attempts +} + +func ExampleDoErrorIfStatusCode() { + client := mocks.NewSender() + client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("204 NoContent", http.StatusNoContent), 10) + + // Chain decorators to retry the request, up to five times, if the status code is 204 + r, _ := SendWithSender(client, mocks.NewRequest(), + DoErrorIfStatusCode(http.StatusNoContent), + DoCloseIfError(), + DoRetryForAttempts(5, time.Duration(0))) + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + fmt.Printf("Retry stopped after %d attempts with code %s", client.Attempts(), r.Status) + // Output: Retry stopped after 5 attempts with code 204 NoContent +} + +func TestSendWithSenderRunsDecoratorsInOrder(t *testing.T) { + client := mocks.NewSender() + s := "" + + r, err := SendWithSender(client, mocks.NewRequest(), + withMessage(&s, "a"), + withMessage(&s, "b"), + withMessage(&s, "c")) + if err != nil { + t.Fatalf("autorest: SendWithSender returned an error (%v)", err) + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + if s != "abc" { + t.Fatalf("autorest: SendWithSender invoke decorators out of order; expected 'abc', received '%s'", s) + } +} + +func TestCreateSender(t *testing.T) { + f := false + + s := CreateSender( + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + f = true + return nil, nil + }) + } + })()) + s.Do(&http.Request{}) + + if !f { + t.Fatal("autorest: CreateSender failed to apply supplied decorator") + } +} + +func TestSend(t *testing.T) { + f := false + + Send(&http.Request{}, + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + f = true + return nil, nil + }) + } + })()) + + if !f { + t.Fatal("autorest: Send failed to apply supplied decorator") + } +} + +func TestAfterDelayWaits(t *testing.T) { + client := mocks.NewSender() + + d := 2 * time.Second + + tt := time.Now() + r, _ := SendWithSender(client, mocks.NewRequest(), + AfterDelay(d)) + s := time.Since(tt) + if s < d { + t.Fatal("autorest: AfterDelay failed to wait for at least the specified duration") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestAfterDelay_Cancels(t *testing.T) { + client := mocks.NewSender() + cancel := make(chan struct{}) + delay := 5 * time.Second + + var wg sync.WaitGroup + wg.Add(1) + tt := time.Now() + go func() { + req := mocks.NewRequest() + req.Cancel = cancel + wg.Done() + SendWithSender(client, req, + AfterDelay(delay)) + }() + wg.Wait() + close(cancel) + time.Sleep(5 * time.Millisecond) + if time.Since(tt) >= delay { + t.Fatal("autorest: AfterDelay failed to cancel") + } +} + +func TestAfterDelayDoesNotWaitTooLong(t *testing.T) { + client := mocks.NewSender() + + d := 5 * time.Millisecond + start := time.Now() + r, _ := SendWithSender(client, mocks.NewRequest(), + AfterDelay(d)) + + if time.Since(start) > (5 * d) { + t.Fatal("autorest: AfterDelay waited too long (exceeded 5 times specified duration)") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestAsIs(t *testing.T) { + client := mocks.NewSender() + + r1 := mocks.NewResponse() + client.AppendResponse(r1) + + r2, err := SendWithSender(client, mocks.NewRequest(), + AsIs()) + if err != nil { + t.Fatalf("autorest: AsIs returned an unexpected error (%v)", err) + } else if !reflect.DeepEqual(r1, r2) { + t.Fatalf("autorest: AsIs modified the response -- received %v, expected %v", r2, r1) + } + + Respond(r1, + ByDiscardingBody(), + ByClosing()) + Respond(r2, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoCloseIfError(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(mocks.NewResponseWithStatus("400 BadRequest", http.StatusBadRequest)) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoErrorIfStatusCode(http.StatusBadRequest), + DoCloseIfError()) + + if r.Body.(*mocks.Body).IsOpen() { + t.Fatal("autorest: Expected DoCloseIfError to close response body -- it was left open") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoCloseIfErrorAcceptsNilResponse(t *testing.T) { + client := mocks.NewSender() + + SendWithSender(client, mocks.NewRequest(), + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err != nil { + resp.Body.Close() + } + return nil, fmt.Errorf("Faux Error") + }) + } + })(), + DoCloseIfError()) +} + +func TestDoCloseIfErrorAcceptsNilBody(t *testing.T) { + client := mocks.NewSender() + + SendWithSender(client, mocks.NewRequest(), + (func() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err != nil { + resp.Body.Close() + } + resp.Body = nil + return resp, fmt.Errorf("Faux Error") + }) + } + })(), + DoCloseIfError()) +} + +func TestDoErrorIfStatusCode(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(mocks.NewResponseWithStatus("400 BadRequest", http.StatusBadRequest)) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoErrorIfStatusCode(http.StatusBadRequest), + DoCloseIfError()) + if err == nil { + t.Fatal("autorest: DoErrorIfStatusCode failed to emit an error for passed code") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoErrorIfStatusCodeIgnoresStatusCodes(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(newAcceptedResponse()) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoErrorIfStatusCode(http.StatusBadRequest), + DoCloseIfError()) + if err != nil { + t.Fatal("autorest: DoErrorIfStatusCode failed to ignore a status code") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoErrorUnlessStatusCode(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(mocks.NewResponseWithStatus("400 BadRequest", http.StatusBadRequest)) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoErrorUnlessStatusCode(http.StatusAccepted), + DoCloseIfError()) + if err == nil { + t.Fatal("autorest: DoErrorUnlessStatusCode failed to emit an error for an unknown status code") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoErrorUnlessStatusCodeIgnoresStatusCodes(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(newAcceptedResponse()) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoErrorUnlessStatusCode(http.StatusAccepted), + DoCloseIfError()) + if err != nil { + t.Fatal("autorest: DoErrorUnlessStatusCode emitted an error for a knonwn status code") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForAttemptsStopsAfterSuccess(t *testing.T) { + client := mocks.NewSender() + + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForAttempts(5, time.Duration(0))) + if client.Attempts() != 1 { + t.Fatalf("autorest: DoRetryForAttempts failed to stop after success -- expected attempts %v, actual %v", + 1, client.Attempts()) + } + if err != nil { + t.Fatalf("autorest: DoRetryForAttempts returned an unexpected error (%v)", err) + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForAttemptsStopsAfterAttempts(t *testing.T) { + client := mocks.NewSender() + client.SetAndRepeatError(fmt.Errorf("Faux Error"), 10) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForAttempts(5, time.Duration(0)), + DoCloseIfError()) + if err == nil { + t.Fatal("autorest: Mock client failed to emit errors") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + if client.Attempts() != 5 { + t.Fatal("autorest: DoRetryForAttempts failed to stop after specified number of attempts") + } +} + +func TestDoRetryForAttemptsReturnsResponse(t *testing.T) { + client := mocks.NewSender() + client.SetError(fmt.Errorf("Faux Error")) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForAttempts(1, time.Duration(0))) + if err == nil { + t.Fatal("autorest: Mock client failed to emit errors") + } + + if r == nil { + t.Fatal("autorest: DoRetryForAttempts failed to return the underlying response") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForDurationStopsAfterSuccess(t *testing.T) { + client := mocks.NewSender() + + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForDuration(10*time.Millisecond, time.Duration(0))) + if client.Attempts() != 1 { + t.Fatalf("autorest: DoRetryForDuration failed to stop after success -- expected attempts %v, actual %v", + 1, client.Attempts()) + } + if err != nil { + t.Fatalf("autorest: DoRetryForDuration returned an unexpected error (%v)", err) + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForDurationStopsAfterDuration(t *testing.T) { + client := mocks.NewSender() + client.SetAndRepeatError(fmt.Errorf("Faux Error"), -1) + + d := 5 * time.Millisecond + start := time.Now() + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForDuration(d, time.Duration(0)), + DoCloseIfError()) + if err == nil { + t.Fatal("autorest: Mock client failed to emit errors") + } + + if time.Since(start) < d { + t.Fatal("autorest: DoRetryForDuration failed stopped too soon") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForDurationStopsWithinReason(t *testing.T) { + client := mocks.NewSender() + client.SetAndRepeatError(fmt.Errorf("Faux Error"), -1) + + d := 5 * time.Second + start := time.Now() + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForDuration(d, time.Duration(0)), + DoCloseIfError()) + if err == nil { + t.Fatal("autorest: Mock client failed to emit errors") + } + + if time.Since(start) > (5 * d) { + t.Fatal("autorest: DoRetryForDuration failed stopped soon enough (exceeded 5 times specified duration)") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForDurationReturnsResponse(t *testing.T) { + client := mocks.NewSender() + client.SetAndRepeatError(fmt.Errorf("Faux Error"), -1) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoRetryForDuration(10*time.Millisecond, time.Duration(0)), + DoCloseIfError()) + if err == nil { + t.Fatal("autorest: Mock client failed to emit errors") + } + + if r == nil { + t.Fatal("autorest: DoRetryForDuration failed to return the underlying response") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDelayForBackoff(t *testing.T) { + d := 2 * time.Second + start := time.Now() + DelayForBackoff(d, 0, nil) + if time.Since(start) < d { + t.Fatal("autorest: DelayForBackoff did not delay as long as expected") + } +} + +func TestDelayForBackoff_Cancels(t *testing.T) { + cancel := make(chan struct{}) + delay := 5 * time.Second + + var wg sync.WaitGroup + wg.Add(1) + start := time.Now() + go func() { + wg.Done() + DelayForBackoff(delay, 0, cancel) + }() + wg.Wait() + close(cancel) + time.Sleep(5 * time.Millisecond) + if time.Since(start) >= delay { + t.Fatal("autorest: DelayForBackoff failed to cancel") + } +} + +func TestDelayForBackoffWithinReason(t *testing.T) { + d := 5 * time.Second + maxCoefficient := 2 + start := time.Now() + DelayForBackoff(d, 0, nil) + if time.Since(start) > (time.Duration(maxCoefficient) * d) { + + t.Fatalf("autorest: DelayForBackoff delayed too long (exceeded %d times the specified duration)", maxCoefficient) + } +} + +func TestDoPollForStatusCodes_IgnoresUnspecifiedStatusCodes(t *testing.T) { + client := mocks.NewSender() + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Duration(0), time.Duration(0))) + + if client.Attempts() != 1 { + t.Fatalf("autorest: Sender#DoPollForStatusCodes polled for unspecified status code") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoPollForStatusCodes_PollsForSpecifiedStatusCodes(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(newAcceptedResponse()) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) + + if client.Attempts() != 2 { + t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to poll for specified status code") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoPollForStatusCodes_CanBeCanceled(t *testing.T) { + cancel := make(chan struct{}) + delay := 5 * time.Second + + r := mocks.NewResponse() + mocks.SetAcceptedHeaders(r) + client := mocks.NewSender() + client.AppendAndRepeatResponse(r, 100) + + var wg sync.WaitGroup + wg.Add(1) + start := time.Now() + go func() { + wg.Done() + r, _ := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) + Respond(r, + ByDiscardingBody(), + ByClosing()) + }() + wg.Wait() + close(cancel) + time.Sleep(5 * time.Millisecond) + if time.Since(start) >= delay { + t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to cancel") + } +} + +func TestDoPollForStatusCodes_ClosesAllNonreturnedResponseBodiesWhenPolling(t *testing.T) { + resp := newAcceptedResponse() + + client := mocks.NewSender() + client.AppendAndRepeatResponse(resp, 2) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) + + if resp.Body.(*mocks.Body).IsOpen() || resp.Body.(*mocks.Body).CloseAttempts() < 2 { + t.Fatalf("autorest: Sender#DoPollForStatusCodes did not close unreturned response bodies") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoPollForStatusCodes_LeavesLastResponseBodyOpen(t *testing.T) { + client := mocks.NewSender() + client.AppendResponse(newAcceptedResponse()) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) + + if !r.Body.(*mocks.Body).IsOpen() { + t.Fatalf("autorest: Sender#DoPollForStatusCodes did not leave open the body of the last response") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoPollForStatusCodes_StopsPollingAfterAnError(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(newAcceptedResponse(), 5) + client.SetError(fmt.Errorf("Faux Error")) + client.SetEmitErrorAfter(1) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) + + if client.Attempts() > 2 { + t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to stop polling after receiving an error") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoPollForStatusCodes_ReturnsPollingError(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(newAcceptedResponse(), 5) + client.SetError(fmt.Errorf("Faux Error")) + client.SetEmitErrorAfter(1) + + r, err := SendWithSender(client, mocks.NewRequest(), + DoPollForStatusCodes(time.Millisecond, time.Millisecond, http.StatusAccepted)) + + if err == nil { + t.Fatalf("autorest: Sender#DoPollForStatusCodes failed to return error from polling") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestWithLogging_Logs(t *testing.T) { + buf := &bytes.Buffer{} + logger := log.New(buf, "autorest: ", 0) + client := mocks.NewSender() + + r, _ := SendWithSender(client, &http.Request{}, + WithLogging(logger)) + + if buf.String() == "" { + t.Fatal("autorest: Sender#WithLogging failed to log the request") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestWithLogging_HandlesMissingResponse(t *testing.T) { + buf := &bytes.Buffer{} + logger := log.New(buf, "autorest: ", 0) + client := mocks.NewSender() + client.AppendResponse(nil) + client.SetError(fmt.Errorf("Faux Error")) + + r, err := SendWithSender(client, &http.Request{}, + WithLogging(logger)) + + if r != nil || err == nil { + t.Fatal("autorest: Sender#WithLogging returned a valid response -- expecting nil") + } + if buf.String() == "" { + t.Fatal("autorest: Sender#WithLogging failed to log the request for a nil response") + } + + Respond(r, + ByDiscardingBody(), + ByClosing()) +} + +func TestDoRetryForStatusCodesWithSuccess(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("408 Request Timeout", http.StatusRequestTimeout), 2) + client.AppendResponse(mocks.NewResponseWithStatus("200 OK", http.StatusOK)) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoRetryForStatusCodes(5, time.Duration(2*time.Second), http.StatusRequestTimeout), + ) + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + if client.Attempts() != 3 { + t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: StatusCode %v in %v attempts; Want: StatusCode 200 OK in 2 attempts -- ", + r.Status, client.Attempts()-1) + } +} + +func TestDoRetryForStatusCodesWithNoSuccess(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("504 Gateway Timeout", http.StatusGatewayTimeout), 5) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoRetryForStatusCodes(2, time.Duration(2*time.Second), http.StatusGatewayTimeout), + ) + Respond(r, + ByDiscardingBody(), + ByClosing()) + + if client.Attempts() != 3 { + t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: failed stop after %v retry attempts; Want: Stop after 2 retry attempts", + client.Attempts()-1) + } +} + +func TestDoRetryForStatusCodes_CodeNotInRetryList(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("204 No Content", http.StatusNoContent), 1) + + r, _ := SendWithSender(client, mocks.NewRequest(), + DoRetryForStatusCodes(6, time.Duration(2*time.Second), http.StatusGatewayTimeout), + ) + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + if client.Attempts() != 1 || r.Status != "204 No Content" { + t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: Retry attempts %v for StatusCode %v; Want: 0 attempts for StatusCode 204", + client.Attempts(), r.Status) + } +} + +func TestDoRetryForStatusCodes_RequestBodyReadError(t *testing.T) { + client := mocks.NewSender() + client.AppendAndRepeatResponse(mocks.NewResponseWithStatus("204 No Content", http.StatusNoContent), 2) + + r, err := SendWithSender(client, mocks.NewRequestWithCloseBody(), + DoRetryForStatusCodes(6, time.Duration(2*time.Second), http.StatusGatewayTimeout), + ) + + Respond(r, + ByDiscardingBody(), + ByClosing()) + + if err == nil || client.Attempts() != 0 { + t.Fatalf("autorest: Sender#DoRetryForStatusCodes -- Got: Not failed for request body read error; Want: Failed for body read error - %v", err) + } +} + +func newAcceptedResponse() *http.Response { + resp := mocks.NewResponseWithStatus("202 Accepted", http.StatusAccepted) + mocks.SetAcceptedHeaders(resp) + return resp +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go index 222c8a670f..7b180b866b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go @@ -1,133 +1,133 @@ -/* -Package to provides helpers to ease working with pointer values of marshalled structures. -*/ -package to - -// String returns a string value for the passed string pointer. It returns the empty string if the -// pointer is nil. -func String(s *string) string { - if s != nil { - return *s - } - return "" -} - -// StringPtr returns a pointer to the passed string. -func StringPtr(s string) *string { - return &s -} - -// StringSlice returns a string slice value for the passed string slice pointer. It returns a nil -// slice if the pointer is nil. -func StringSlice(s *[]string) []string { - if s != nil { - return *s - } - return nil -} - -// StringSlicePtr returns a pointer to the passed string slice. -func StringSlicePtr(s []string) *[]string { - return &s -} - -// StringMap returns a map of strings built from the map of string pointers. The empty string is -// used for nil pointers. -func StringMap(msp map[string]*string) map[string]string { - ms := make(map[string]string, len(msp)) - for k, sp := range msp { - if sp != nil { - ms[k] = *sp - } else { - ms[k] = "" - } - } - return ms -} - -// StringMapPtr returns a pointer to a map of string pointers built from the passed map of strings. -func StringMapPtr(ms map[string]string) *map[string]*string { - msp := make(map[string]*string, len(ms)) - for k, s := range ms { - msp[k] = StringPtr(s) - } - return &msp -} - -// Bool returns a bool value for the passed bool pointer. It returns false if the pointer is nil. -func Bool(b *bool) bool { - if b != nil { - return *b - } - return false -} - -// BoolPtr returns a pointer to the passed bool. -func BoolPtr(b bool) *bool { - return &b -} - -// Int returns an int value for the passed int pointer. It returns 0 if the pointer is nil. -func Int(i *int) int { - if i != nil { - return *i - } - return 0 -} - -// IntPtr returns a pointer to the passed int. -func IntPtr(i int) *int { - return &i -} - -// Int32 returns an int value for the passed int pointer. It returns 0 if the pointer is nil. -func Int32(i *int32) int32 { - if i != nil { - return *i - } - return 0 -} - -// Int32Ptr returns a pointer to the passed int32. -func Int32Ptr(i int32) *int32 { - return &i -} - -// Int64 returns an int value for the passed int pointer. It returns 0 if the pointer is nil. -func Int64(i *int64) int64 { - if i != nil { - return *i - } - return 0 -} - -// Int64Ptr returns a pointer to the passed int64. -func Int64Ptr(i int64) *int64 { - return &i -} - -// Float32 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil. -func Float32(i *float32) float32 { - if i != nil { - return *i - } - return 0.0 -} - -// Float32Ptr returns a pointer to the passed float32. -func Float32Ptr(i float32) *float32 { - return &i -} - -// Float64 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil. -func Float64(i *float64) float64 { - if i != nil { - return *i - } - return 0.0 -} - -// Float64Ptr returns a pointer to the passed float64. -func Float64Ptr(i float64) *float64 { - return &i -} +/* +Package to provides helpers to ease working with pointer values of marshalled structures. +*/ +package to + +// String returns a string value for the passed string pointer. It returns the empty string if the +// pointer is nil. +func String(s *string) string { + if s != nil { + return *s + } + return "" +} + +// StringPtr returns a pointer to the passed string. +func StringPtr(s string) *string { + return &s +} + +// StringSlice returns a string slice value for the passed string slice pointer. It returns a nil +// slice if the pointer is nil. +func StringSlice(s *[]string) []string { + if s != nil { + return *s + } + return nil +} + +// StringSlicePtr returns a pointer to the passed string slice. +func StringSlicePtr(s []string) *[]string { + return &s +} + +// StringMap returns a map of strings built from the map of string pointers. The empty string is +// used for nil pointers. +func StringMap(msp map[string]*string) map[string]string { + ms := make(map[string]string, len(msp)) + for k, sp := range msp { + if sp != nil { + ms[k] = *sp + } else { + ms[k] = "" + } + } + return ms +} + +// StringMapPtr returns a pointer to a map of string pointers built from the passed map of strings. +func StringMapPtr(ms map[string]string) *map[string]*string { + msp := make(map[string]*string, len(ms)) + for k, s := range ms { + msp[k] = StringPtr(s) + } + return &msp +} + +// Bool returns a bool value for the passed bool pointer. It returns false if the pointer is nil. +func Bool(b *bool) bool { + if b != nil { + return *b + } + return false +} + +// BoolPtr returns a pointer to the passed bool. +func BoolPtr(b bool) *bool { + return &b +} + +// Int returns an int value for the passed int pointer. It returns 0 if the pointer is nil. +func Int(i *int) int { + if i != nil { + return *i + } + return 0 +} + +// IntPtr returns a pointer to the passed int. +func IntPtr(i int) *int { + return &i +} + +// Int32 returns an int value for the passed int pointer. It returns 0 if the pointer is nil. +func Int32(i *int32) int32 { + if i != nil { + return *i + } + return 0 +} + +// Int32Ptr returns a pointer to the passed int32. +func Int32Ptr(i int32) *int32 { + return &i +} + +// Int64 returns an int value for the passed int pointer. It returns 0 if the pointer is nil. +func Int64(i *int64) int64 { + if i != nil { + return *i + } + return 0 +} + +// Int64Ptr returns a pointer to the passed int64. +func Int64Ptr(i int64) *int64 { + return &i +} + +// Float32 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil. +func Float32(i *float32) float32 { + if i != nil { + return *i + } + return 0.0 +} + +// Float32Ptr returns a pointer to the passed float32. +func Float32Ptr(i float32) *float32 { + return &i +} + +// Float64 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil. +func Float64(i *float64) float64 { + if i != nil { + return *i + } + return 0.0 +} + +// Float64Ptr returns a pointer to the passed float64. +func Float64Ptr(i float64) *float64 { + return &i +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/to/convert_test.go b/vendor/github.com/Azure/go-autorest/autorest/to/convert_test.go index 58af298de1..8c98353925 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/to/convert_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert_test.go @@ -1,220 +1,220 @@ -package to - -import ( - "reflect" - "testing" -) - -func TestString(t *testing.T) { - v := "" - if String(&v) != v { - t.Fatalf("to: String failed to return the correct string -- expected %v, received %v", - v, String(&v)) - } -} - -func TestStringHandlesNil(t *testing.T) { - if String(nil) != "" { - t.Fatalf("to: String failed to correctly convert nil -- expected %v, received %v", - "", String(nil)) - } -} - -func TestStringPtr(t *testing.T) { - v := "" - if *StringPtr(v) != v { - t.Fatalf("to: StringPtr failed to return the correct string -- expected %v, received %v", - v, *StringPtr(v)) - } -} - -func TestStringSlice(t *testing.T) { - v := []string{} - if out := StringSlice(&v); !reflect.DeepEqual(out, v) { - t.Fatalf("to: StringSlice failed to return the correct slice -- expected %v, received %v", - v, out) - } -} - -func TestStringSliceHandlesNil(t *testing.T) { - if out := StringSlice(nil); out != nil { - t.Fatalf("to: StringSlice failed to correctly convert nil -- expected %v, received %v", - nil, out) - } -} - -func TestStringSlicePtr(t *testing.T) { - v := []string{"a", "b"} - if out := StringSlicePtr(v); !reflect.DeepEqual(*out, v) { - t.Fatalf("to: StringSlicePtr failed to return the correct slice -- expected %v, received %v", - v, *out) - } -} - -func TestStringMap(t *testing.T) { - msp := map[string]*string{"foo": StringPtr("foo"), "bar": StringPtr("bar"), "baz": StringPtr("baz")} - for k, v := range StringMap(msp) { - if *msp[k] != v { - t.Fatalf("to: StringMap incorrectly converted an entry -- expected [%s]%v, received[%s]%v", - k, v, k, *msp[k]) - } - } -} - -func TestStringMapHandlesNil(t *testing.T) { - msp := map[string]*string{"foo": StringPtr("foo"), "bar": nil, "baz": StringPtr("baz")} - for k, v := range StringMap(msp) { - if msp[k] == nil && v != "" { - t.Fatalf("to: StringMap incorrectly converted a nil entry -- expected [%s]%v, received[%s]%v", - k, v, k, *msp[k]) - } - } -} - -func TestStringMapPtr(t *testing.T) { - ms := map[string]string{"foo": "foo", "bar": "bar", "baz": "baz"} - for k, msp := range *StringMapPtr(ms) { - if ms[k] != *msp { - t.Fatalf("to: StringMapPtr incorrectly converted an entry -- expected [%s]%v, received[%s]%v", - k, ms[k], k, *msp) - } - } -} - -func TestBool(t *testing.T) { - v := false - if Bool(&v) != v { - t.Fatalf("to: Bool failed to return the correct string -- expected %v, received %v", - v, Bool(&v)) - } -} - -func TestBoolHandlesNil(t *testing.T) { - if Bool(nil) != false { - t.Fatalf("to: Bool failed to correctly convert nil -- expected %v, received %v", - false, Bool(nil)) - } -} - -func TestBoolPtr(t *testing.T) { - v := false - if *BoolPtr(v) != v { - t.Fatalf("to: BoolPtr failed to return the correct string -- expected %v, received %v", - v, *BoolPtr(v)) - } -} - -func TestInt(t *testing.T) { - v := 0 - if Int(&v) != v { - t.Fatalf("to: Int failed to return the correct string -- expected %v, received %v", - v, Int(&v)) - } -} - -func TestIntHandlesNil(t *testing.T) { - if Int(nil) != 0 { - t.Fatalf("to: Int failed to correctly convert nil -- expected %v, received %v", - 0, Int(nil)) - } -} - -func TestIntPtr(t *testing.T) { - v := 0 - if *IntPtr(v) != v { - t.Fatalf("to: IntPtr failed to return the correct string -- expected %v, received %v", - v, *IntPtr(v)) - } -} - -func TestInt32(t *testing.T) { - v := int32(0) - if Int32(&v) != v { - t.Fatalf("to: Int32 failed to return the correct string -- expected %v, received %v", - v, Int32(&v)) - } -} - -func TestInt32HandlesNil(t *testing.T) { - if Int32(nil) != int32(0) { - t.Fatalf("to: Int32 failed to correctly convert nil -- expected %v, received %v", - 0, Int32(nil)) - } -} - -func TestInt32Ptr(t *testing.T) { - v := int32(0) - if *Int32Ptr(v) != v { - t.Fatalf("to: Int32Ptr failed to return the correct string -- expected %v, received %v", - v, *Int32Ptr(v)) - } -} - -func TestInt64(t *testing.T) { - v := int64(0) - if Int64(&v) != v { - t.Fatalf("to: Int64 failed to return the correct string -- expected %v, received %v", - v, Int64(&v)) - } -} - -func TestInt64HandlesNil(t *testing.T) { - if Int64(nil) != int64(0) { - t.Fatalf("to: Int64 failed to correctly convert nil -- expected %v, received %v", - 0, Int64(nil)) - } -} - -func TestInt64Ptr(t *testing.T) { - v := int64(0) - if *Int64Ptr(v) != v { - t.Fatalf("to: Int64Ptr failed to return the correct string -- expected %v, received %v", - v, *Int64Ptr(v)) - } -} - -func TestFloat32(t *testing.T) { - v := float32(0) - if Float32(&v) != v { - t.Fatalf("to: Float32 failed to return the correct string -- expected %v, received %v", - v, Float32(&v)) - } -} - -func TestFloat32HandlesNil(t *testing.T) { - if Float32(nil) != float32(0) { - t.Fatalf("to: Float32 failed to correctly convert nil -- expected %v, received %v", - 0, Float32(nil)) - } -} - -func TestFloat32Ptr(t *testing.T) { - v := float32(0) - if *Float32Ptr(v) != v { - t.Fatalf("to: Float32Ptr failed to return the correct string -- expected %v, received %v", - v, *Float32Ptr(v)) - } -} - -func TestFloat64(t *testing.T) { - v := float64(0) - if Float64(&v) != v { - t.Fatalf("to: Float64 failed to return the correct string -- expected %v, received %v", - v, Float64(&v)) - } -} - -func TestFloat64HandlesNil(t *testing.T) { - if Float64(nil) != float64(0) { - t.Fatalf("to: Float64 failed to correctly convert nil -- expected %v, received %v", - 0, Float64(nil)) - } -} - -func TestFloat64Ptr(t *testing.T) { - v := float64(0) - if *Float64Ptr(v) != v { - t.Fatalf("to: Float64Ptr failed to return the correct string -- expected %v, received %v", - v, *Float64Ptr(v)) - } -} +package to + +import ( + "reflect" + "testing" +) + +func TestString(t *testing.T) { + v := "" + if String(&v) != v { + t.Fatalf("to: String failed to return the correct string -- expected %v, received %v", + v, String(&v)) + } +} + +func TestStringHandlesNil(t *testing.T) { + if String(nil) != "" { + t.Fatalf("to: String failed to correctly convert nil -- expected %v, received %v", + "", String(nil)) + } +} + +func TestStringPtr(t *testing.T) { + v := "" + if *StringPtr(v) != v { + t.Fatalf("to: StringPtr failed to return the correct string -- expected %v, received %v", + v, *StringPtr(v)) + } +} + +func TestStringSlice(t *testing.T) { + v := []string{} + if out := StringSlice(&v); !reflect.DeepEqual(out, v) { + t.Fatalf("to: StringSlice failed to return the correct slice -- expected %v, received %v", + v, out) + } +} + +func TestStringSliceHandlesNil(t *testing.T) { + if out := StringSlice(nil); out != nil { + t.Fatalf("to: StringSlice failed to correctly convert nil -- expected %v, received %v", + nil, out) + } +} + +func TestStringSlicePtr(t *testing.T) { + v := []string{"a", "b"} + if out := StringSlicePtr(v); !reflect.DeepEqual(*out, v) { + t.Fatalf("to: StringSlicePtr failed to return the correct slice -- expected %v, received %v", + v, *out) + } +} + +func TestStringMap(t *testing.T) { + msp := map[string]*string{"foo": StringPtr("foo"), "bar": StringPtr("bar"), "baz": StringPtr("baz")} + for k, v := range StringMap(msp) { + if *msp[k] != v { + t.Fatalf("to: StringMap incorrectly converted an entry -- expected [%s]%v, received[%s]%v", + k, v, k, *msp[k]) + } + } +} + +func TestStringMapHandlesNil(t *testing.T) { + msp := map[string]*string{"foo": StringPtr("foo"), "bar": nil, "baz": StringPtr("baz")} + for k, v := range StringMap(msp) { + if msp[k] == nil && v != "" { + t.Fatalf("to: StringMap incorrectly converted a nil entry -- expected [%s]%v, received[%s]%v", + k, v, k, *msp[k]) + } + } +} + +func TestStringMapPtr(t *testing.T) { + ms := map[string]string{"foo": "foo", "bar": "bar", "baz": "baz"} + for k, msp := range *StringMapPtr(ms) { + if ms[k] != *msp { + t.Fatalf("to: StringMapPtr incorrectly converted an entry -- expected [%s]%v, received[%s]%v", + k, ms[k], k, *msp) + } + } +} + +func TestBool(t *testing.T) { + v := false + if Bool(&v) != v { + t.Fatalf("to: Bool failed to return the correct string -- expected %v, received %v", + v, Bool(&v)) + } +} + +func TestBoolHandlesNil(t *testing.T) { + if Bool(nil) != false { + t.Fatalf("to: Bool failed to correctly convert nil -- expected %v, received %v", + false, Bool(nil)) + } +} + +func TestBoolPtr(t *testing.T) { + v := false + if *BoolPtr(v) != v { + t.Fatalf("to: BoolPtr failed to return the correct string -- expected %v, received %v", + v, *BoolPtr(v)) + } +} + +func TestInt(t *testing.T) { + v := 0 + if Int(&v) != v { + t.Fatalf("to: Int failed to return the correct string -- expected %v, received %v", + v, Int(&v)) + } +} + +func TestIntHandlesNil(t *testing.T) { + if Int(nil) != 0 { + t.Fatalf("to: Int failed to correctly convert nil -- expected %v, received %v", + 0, Int(nil)) + } +} + +func TestIntPtr(t *testing.T) { + v := 0 + if *IntPtr(v) != v { + t.Fatalf("to: IntPtr failed to return the correct string -- expected %v, received %v", + v, *IntPtr(v)) + } +} + +func TestInt32(t *testing.T) { + v := int32(0) + if Int32(&v) != v { + t.Fatalf("to: Int32 failed to return the correct string -- expected %v, received %v", + v, Int32(&v)) + } +} + +func TestInt32HandlesNil(t *testing.T) { + if Int32(nil) != int32(0) { + t.Fatalf("to: Int32 failed to correctly convert nil -- expected %v, received %v", + 0, Int32(nil)) + } +} + +func TestInt32Ptr(t *testing.T) { + v := int32(0) + if *Int32Ptr(v) != v { + t.Fatalf("to: Int32Ptr failed to return the correct string -- expected %v, received %v", + v, *Int32Ptr(v)) + } +} + +func TestInt64(t *testing.T) { + v := int64(0) + if Int64(&v) != v { + t.Fatalf("to: Int64 failed to return the correct string -- expected %v, received %v", + v, Int64(&v)) + } +} + +func TestInt64HandlesNil(t *testing.T) { + if Int64(nil) != int64(0) { + t.Fatalf("to: Int64 failed to correctly convert nil -- expected %v, received %v", + 0, Int64(nil)) + } +} + +func TestInt64Ptr(t *testing.T) { + v := int64(0) + if *Int64Ptr(v) != v { + t.Fatalf("to: Int64Ptr failed to return the correct string -- expected %v, received %v", + v, *Int64Ptr(v)) + } +} + +func TestFloat32(t *testing.T) { + v := float32(0) + if Float32(&v) != v { + t.Fatalf("to: Float32 failed to return the correct string -- expected %v, received %v", + v, Float32(&v)) + } +} + +func TestFloat32HandlesNil(t *testing.T) { + if Float32(nil) != float32(0) { + t.Fatalf("to: Float32 failed to correctly convert nil -- expected %v, received %v", + 0, Float32(nil)) + } +} + +func TestFloat32Ptr(t *testing.T) { + v := float32(0) + if *Float32Ptr(v) != v { + t.Fatalf("to: Float32Ptr failed to return the correct string -- expected %v, received %v", + v, *Float32Ptr(v)) + } +} + +func TestFloat64(t *testing.T) { + v := float64(0) + if Float64(&v) != v { + t.Fatalf("to: Float64 failed to return the correct string -- expected %v, received %v", + v, Float64(&v)) + } +} + +func TestFloat64HandlesNil(t *testing.T) { + if Float64(nil) != float64(0) { + t.Fatalf("to: Float64 failed to correctly convert nil -- expected %v, received %v", + 0, Float64(nil)) + } +} + +func TestFloat64Ptr(t *testing.T) { + v := float64(0) + if *Float64Ptr(v) != v { + t.Fatalf("to: Float64Ptr failed to return the correct string -- expected %v, received %v", + v, *Float64Ptr(v)) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go index fc2795f87e..78067148b2 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/utility.go +++ b/vendor/github.com/Azure/go-autorest/autorest/utility.go @@ -1,178 +1,178 @@ -package autorest - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "io" - "net/url" - "reflect" - "sort" - "strings" -) - -// EncodedAs is a series of constants specifying various data encodings -type EncodedAs string - -const ( - // EncodedAsJSON states that data is encoded as JSON - EncodedAsJSON EncodedAs = "JSON" - - // EncodedAsXML states that data is encoded as Xml - EncodedAsXML EncodedAs = "XML" -) - -// Decoder defines the decoding method json.Decoder and xml.Decoder share -type Decoder interface { - Decode(v interface{}) error -} - -// NewDecoder creates a new decoder appropriate to the passed encoding. -// encodedAs specifies the type of encoding and r supplies the io.Reader containing the -// encoded data. -func NewDecoder(encodedAs EncodedAs, r io.Reader) Decoder { - if encodedAs == EncodedAsJSON { - return json.NewDecoder(r) - } else if encodedAs == EncodedAsXML { - return xml.NewDecoder(r) - } - return nil -} - -// CopyAndDecode decodes the data from the passed io.Reader while making a copy. Having a copy -// is especially useful if there is a chance the data will fail to decode. -// encodedAs specifies the expected encoding, r provides the io.Reader to the data, and v -// is the decoding destination. -func CopyAndDecode(encodedAs EncodedAs, r io.Reader, v interface{}) (bytes.Buffer, error) { - b := bytes.Buffer{} - return b, NewDecoder(encodedAs, io.TeeReader(r, &b)).Decode(v) -} - -// TeeReadCloser returns a ReadCloser that writes to w what it reads from rc. -// It utilizes io.TeeReader to copy the data read and has the same behavior when reading. -// Further, when it is closed, it ensures that rc is closed as well. -func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser { - return &teeReadCloser{rc, io.TeeReader(rc, w)} -} - -type teeReadCloser struct { - rc io.ReadCloser - r io.Reader -} - -func (t *teeReadCloser) Read(p []byte) (int, error) { - return t.r.Read(p) -} - -func (t *teeReadCloser) Close() error { - return t.rc.Close() -} - -func containsInt(ints []int, n int) bool { - for _, i := range ints { - if i == n { - return true - } - } - return false -} - -func escapeValueStrings(m map[string]string) map[string]string { - for key, value := range m { - m[key] = url.QueryEscape(value) - } - return m -} - -func ensureValueStrings(mapOfInterface map[string]interface{}) map[string]string { - mapOfStrings := make(map[string]string) - for key, value := range mapOfInterface { - mapOfStrings[key] = ensureValueString(value) - } - return mapOfStrings -} - -func ensureValueString(value interface{}) string { - if value == nil { - return "" - } - switch v := value.(type) { - case string: - return v - case []byte: - return string(v) - default: - return fmt.Sprintf("%v", v) - } -} - -// MapToValues method converts map[string]interface{} to url.Values. -func MapToValues(m map[string]interface{}) url.Values { - v := url.Values{} - for key, value := range m { - x := reflect.ValueOf(value) - if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { - for i := 0; i < x.Len(); i++ { - v.Add(key, ensureValueString(x.Index(i))) - } - } else { - v.Add(key, ensureValueString(value)) - } - } - return v -} - -// String method converts interface v to string. If interface is a list, it -// joins list elements using separator. -func String(v interface{}, sep ...string) string { - if len(sep) > 0 { - return ensureValueString(strings.Join(v.([]string), sep[0])) - } - return ensureValueString(v) -} - -// Encode method encodes url path and query parameters. -func Encode(location string, v interface{}, sep ...string) string { - s := String(v, sep...) - switch strings.ToLower(location) { - case "path": - return pathEscape(s) - case "query": - return queryEscape(s) - default: - return s - } -} - -func pathEscape(s string) string { - return strings.Replace(url.QueryEscape(s), "+", "%20", -1) -} - -func queryEscape(s string) string { - return url.QueryEscape(s) -} - -// This method is same as Encode() method of "net/url" go package, -// except it does not encode the query parameters because they -// already come encoded. It formats values map in query format (bar=foo&a=b). -func createQuery(v url.Values) string { - var buf bytes.Buffer - keys := make([]string, 0, len(v)) - for k := range v { - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - vs := v[k] - prefix := url.QueryEscape(k) + "=" - for _, v := range vs { - if buf.Len() > 0 { - buf.WriteByte('&') - } - buf.WriteString(prefix) - buf.WriteString(v) - } - } - return buf.String() -} +package autorest + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "net/url" + "reflect" + "sort" + "strings" +) + +// EncodedAs is a series of constants specifying various data encodings +type EncodedAs string + +const ( + // EncodedAsJSON states that data is encoded as JSON + EncodedAsJSON EncodedAs = "JSON" + + // EncodedAsXML states that data is encoded as Xml + EncodedAsXML EncodedAs = "XML" +) + +// Decoder defines the decoding method json.Decoder and xml.Decoder share +type Decoder interface { + Decode(v interface{}) error +} + +// NewDecoder creates a new decoder appropriate to the passed encoding. +// encodedAs specifies the type of encoding and r supplies the io.Reader containing the +// encoded data. +func NewDecoder(encodedAs EncodedAs, r io.Reader) Decoder { + if encodedAs == EncodedAsJSON { + return json.NewDecoder(r) + } else if encodedAs == EncodedAsXML { + return xml.NewDecoder(r) + } + return nil +} + +// CopyAndDecode decodes the data from the passed io.Reader while making a copy. Having a copy +// is especially useful if there is a chance the data will fail to decode. +// encodedAs specifies the expected encoding, r provides the io.Reader to the data, and v +// is the decoding destination. +func CopyAndDecode(encodedAs EncodedAs, r io.Reader, v interface{}) (bytes.Buffer, error) { + b := bytes.Buffer{} + return b, NewDecoder(encodedAs, io.TeeReader(r, &b)).Decode(v) +} + +// TeeReadCloser returns a ReadCloser that writes to w what it reads from rc. +// It utilizes io.TeeReader to copy the data read and has the same behavior when reading. +// Further, when it is closed, it ensures that rc is closed as well. +func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser { + return &teeReadCloser{rc, io.TeeReader(rc, w)} +} + +type teeReadCloser struct { + rc io.ReadCloser + r io.Reader +} + +func (t *teeReadCloser) Read(p []byte) (int, error) { + return t.r.Read(p) +} + +func (t *teeReadCloser) Close() error { + return t.rc.Close() +} + +func containsInt(ints []int, n int) bool { + for _, i := range ints { + if i == n { + return true + } + } + return false +} + +func escapeValueStrings(m map[string]string) map[string]string { + for key, value := range m { + m[key] = url.QueryEscape(value) + } + return m +} + +func ensureValueStrings(mapOfInterface map[string]interface{}) map[string]string { + mapOfStrings := make(map[string]string) + for key, value := range mapOfInterface { + mapOfStrings[key] = ensureValueString(value) + } + return mapOfStrings +} + +func ensureValueString(value interface{}) string { + if value == nil { + return "" + } + switch v := value.(type) { + case string: + return v + case []byte: + return string(v) + default: + return fmt.Sprintf("%v", v) + } +} + +// MapToValues method converts map[string]interface{} to url.Values. +func MapToValues(m map[string]interface{}) url.Values { + v := url.Values{} + for key, value := range m { + x := reflect.ValueOf(value) + if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { + for i := 0; i < x.Len(); i++ { + v.Add(key, ensureValueString(x.Index(i))) + } + } else { + v.Add(key, ensureValueString(value)) + } + } + return v +} + +// String method converts interface v to string. If interface is a list, it +// joins list elements using separator. +func String(v interface{}, sep ...string) string { + if len(sep) > 0 { + return ensureValueString(strings.Join(v.([]string), sep[0])) + } + return ensureValueString(v) +} + +// Encode method encodes url path and query parameters. +func Encode(location string, v interface{}, sep ...string) string { + s := String(v, sep...) + switch strings.ToLower(location) { + case "path": + return pathEscape(s) + case "query": + return queryEscape(s) + default: + return s + } +} + +func pathEscape(s string) string { + return strings.Replace(url.QueryEscape(s), "+", "%20", -1) +} + +func queryEscape(s string) string { + return url.QueryEscape(s) +} + +// This method is same as Encode() method of "net/url" go package, +// except it does not encode the query parameters because they +// already come encoded. It formats values map in query format (bar=foo&a=b). +func createQuery(v url.Values) string { + var buf bytes.Buffer + keys := make([]string, 0, len(v)) + for k := range v { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + vs := v[k] + prefix := url.QueryEscape(k) + "=" + for _, v := range vs { + if buf.Len() > 0 { + buf.WriteByte('&') + } + buf.WriteString(prefix) + buf.WriteString(v) + } + } + return buf.String() +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility_test.go b/vendor/github.com/Azure/go-autorest/autorest/utility_test.go index 46064e1a5d..99c16c97c7 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/utility_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/utility_test.go @@ -1,368 +1,368 @@ -package autorest - -import ( - "bytes" - "encoding/json" - "encoding/xml" - "fmt" - "net/http" - "net/url" - "reflect" - "sort" - "strings" - "testing" - - "github.com/Azure/go-autorest/autorest/mocks" -) - -const ( - jsonT = ` - { - "name":"Rob Pike", - "age":42 - }` - xmlT = ` - - Rob Pike - 42 - ` -) - -func TestNewDecoderCreatesJSONDecoder(t *testing.T) { - d := NewDecoder(EncodedAsJSON, strings.NewReader(jsonT)) - _, ok := d.(*json.Decoder) - if d == nil || !ok { - t.Fatal("autorest: NewDecoder failed to create a JSON decoder when requested") - } -} - -func TestNewDecoderCreatesXMLDecoder(t *testing.T) { - d := NewDecoder(EncodedAsXML, strings.NewReader(xmlT)) - _, ok := d.(*xml.Decoder) - if d == nil || !ok { - t.Fatal("autorest: NewDecoder failed to create an XML decoder when requested") - } -} - -func TestNewDecoderReturnsNilForUnknownEncoding(t *testing.T) { - d := NewDecoder("unknown", strings.NewReader(xmlT)) - if d != nil { - t.Fatal("autorest: NewDecoder created a decoder for an unknown encoding") - } -} - -func TestCopyAndDecodeDecodesJSON(t *testing.T) { - _, err := CopyAndDecode(EncodedAsJSON, strings.NewReader(jsonT), &mocks.T{}) - if err != nil { - t.Fatalf("autorest: CopyAndDecode returned an error with valid JSON - %v", err) - } -} - -func TestCopyAndDecodeDecodesXML(t *testing.T) { - _, err := CopyAndDecode(EncodedAsXML, strings.NewReader(xmlT), &mocks.T{}) - if err != nil { - t.Fatalf("autorest: CopyAndDecode returned an error with valid XML - %v", err) - } -} - -func TestCopyAndDecodeReturnsJSONDecodingErrors(t *testing.T) { - _, err := CopyAndDecode(EncodedAsJSON, strings.NewReader(jsonT[0:len(jsonT)-2]), &mocks.T{}) - if err == nil { - t.Fatalf("autorest: CopyAndDecode failed to return an error with invalid JSON") - } -} - -func TestCopyAndDecodeReturnsXMLDecodingErrors(t *testing.T) { - _, err := CopyAndDecode(EncodedAsXML, strings.NewReader(xmlT[0:len(xmlT)-2]), &mocks.T{}) - if err == nil { - t.Fatalf("autorest: CopyAndDecode failed to return an error with invalid XML") - } -} - -func TestCopyAndDecodeAlwaysReturnsACopy(t *testing.T) { - b, _ := CopyAndDecode(EncodedAsJSON, strings.NewReader(jsonT), &mocks.T{}) - if b.String() != jsonT { - t.Fatalf("autorest: CopyAndDecode failed to return a valid copy of the data - %v", b.String()) - } -} - -func TestTeeReadCloser_Copies(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - b := &bytes.Buffer{} - - r.Body = TeeReadCloser(r.Body, b) - - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err != nil { - t.Fatalf("autorest: TeeReadCloser returned an unexpected error -- %v", err) - } - if b.String() != jsonT { - t.Fatalf("autorest: TeeReadCloser failed to copy the bytes read") - } -} - -func TestTeeReadCloser_PassesReadErrors(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - - r.Body.(*mocks.Body).Close() - r.Body = TeeReadCloser(r.Body, &bytes.Buffer{}) - - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err == nil { - t.Fatalf("autorest: TeeReadCloser failed to return the expected error") - } -} - -func TestTeeReadCloser_ClosesWrappedReader(t *testing.T) { - v := &mocks.T{} - r := mocks.NewResponseWithContent(jsonT) - - b := r.Body.(*mocks.Body) - r.Body = TeeReadCloser(r.Body, &bytes.Buffer{}) - err := Respond(r, - ByUnmarshallingJSON(v), - ByClosing()) - if err != nil { - t.Fatalf("autorest: TeeReadCloser returned an unexpected error -- %v", err) - } - if b.IsOpen() { - t.Fatalf("autorest: TeeReadCloser failed to close the nested io.ReadCloser") - } -} - -func TestContainsIntFindsValue(t *testing.T) { - ints := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - v := 5 - if !containsInt(ints, v) { - t.Fatalf("autorest: containsInt failed to find %v in %v", v, ints) - } -} - -func TestContainsIntDoesNotFindValue(t *testing.T) { - ints := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} - v := 42 - if containsInt(ints, v) { - t.Fatalf("autorest: containsInt unexpectedly found %v in %v", v, ints) - } -} - -func TestContainsIntAcceptsEmptyList(t *testing.T) { - ints := make([]int, 10) - if containsInt(ints, 42) { - t.Fatalf("autorest: containsInt failed to handle an empty list") - } -} - -func TestContainsIntAcceptsNilList(t *testing.T) { - var ints []int - if containsInt(ints, 42) { - t.Fatalf("autorest: containsInt failed to handle an nil list") - } -} - -func TestEscapeStrings(t *testing.T) { - m := map[string]string{ - "string": "a long string with = odd characters", - "int": "42", - "nil": "", - } - r := map[string]string{ - "string": "a+long+string+with+%3D+odd+characters", - "int": "42", - "nil": "", - } - v := escapeValueStrings(m) - if !reflect.DeepEqual(v, r) { - t.Fatalf("autorest: ensureValueStrings returned %v\n", v) - } -} - -func TestEnsureStrings(t *testing.T) { - m := map[string]interface{}{ - "string": "string", - "int": 42, - "nil": nil, - "bytes": []byte{255, 254, 253}, - } - r := map[string]string{ - "string": "string", - "int": "42", - "nil": "", - "bytes": string([]byte{255, 254, 253}), - } - v := ensureValueStrings(m) - if !reflect.DeepEqual(v, r) { - t.Fatalf("autorest: ensureValueStrings returned %v\n", v) - } -} - -func ExampleString() { - m := []string{ - "string1", - "string2", - "string3", - } - - fmt.Println(String(m, ",")) - // Output: string1,string2,string3 -} - -func TestStringWithValidString(t *testing.T) { - i := 123 - if String(i) != "123" { - t.Fatal("autorest: String method failed to convert integer 123 to string") - } -} - -func TestEncodeWithValidPath(t *testing.T) { - s := Encode("Path", "Hello Gopher") - if s != "Hello%20Gopher" { - t.Fatalf("autorest: Encode method failed for valid path encoding. Got: %v; Want: %v", s, "Hello%20Gopher") - } -} - -func TestEncodeWithValidQuery(t *testing.T) { - s := Encode("Query", "Hello Gopher") - if s != "Hello+Gopher" { - t.Fatalf("autorest: Encode method failed for valid query encoding. Got: '%v'; Want: 'Hello+Gopher'", s) - } -} - -func TestEncodeWithValidNotPathQuery(t *testing.T) { - s := Encode("Host", "Hello Gopher") - if s != "Hello Gopher" { - t.Fatalf("autorest: Encode method failed for parameter not query or path. Got: '%v'; Want: 'Hello Gopher'", s) - } -} - -func TestMapToValues(t *testing.T) { - m := map[string]interface{}{ - "a": "a", - "b": 2, - } - v := url.Values{} - v.Add("a", "a") - v.Add("b", "2") - if !isEqual(v, MapToValues(m)) { - t.Fatalf("autorest: MapToValues method failed to return correct values - expected(%v) got(%v)", v, MapToValues(m)) - } -} - -func TestMapToValuesWithArrayValues(t *testing.T) { - m := map[string]interface{}{ - "a": []string{"a", "b"}, - "b": 2, - "c": []int{3, 4}, - } - v := url.Values{} - v.Add("a", "a") - v.Add("a", "b") - v.Add("b", "2") - v.Add("c", "3") - v.Add("c", "4") - - if !isEqual(v, MapToValues(m)) { - t.Fatalf("autorest: MapToValues method failed to return correct values - expected(%v) got(%v)", v, MapToValues(m)) - } -} - -func isEqual(v, u url.Values) bool { - for key, value := range v { - if len(u[key]) == 0 { - return false - } - sort.Strings(value) - sort.Strings(u[key]) - for i := range value { - if value[i] != u[key][i] { - return false - } - } - u.Del(key) - } - if len(u) > 0 { - return false - } - return true -} - -func doEnsureBodyClosed(t *testing.T) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if resp != nil && resp.Body != nil && resp.Body.(*mocks.Body).IsOpen() { - t.Fatal("autorest: Expected Body to be closed -- it was left open") - } - return resp, err - }) - } -} - -type mockAuthorizer struct{} - -func (ma mockAuthorizer) WithAuthorization() PrepareDecorator { - return WithHeader(headerAuthorization, mocks.TestAuthorizationHeader) -} - -type mockFailingAuthorizer struct{} - -func (mfa mockFailingAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - return r, fmt.Errorf("ERROR: mockFailingAuthorizer returned expected error") - }) - } -} - -type mockInspector struct { - wasInvoked bool -} - -func (mi *mockInspector) WithInspection() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - mi.wasInvoked = true - return p.Prepare(r) - }) - } -} - -func (mi *mockInspector) ByInspecting() RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - mi.wasInvoked = true - return r.Respond(resp) - }) - } -} - -func withMessage(output *string, msg string) SendDecorator { - return func(s Sender) Sender { - return SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err == nil { - *output += msg - } - return resp, err - }) - } -} - -func withErrorRespondDecorator(e *error) RespondDecorator { - return func(r Responder) Responder { - return ResponderFunc(func(resp *http.Response) error { - err := r.Respond(resp) - if err != nil { - return err - } - *e = fmt.Errorf("autorest: Faux Respond Error") - return *e - }) - } -} +package autorest + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "fmt" + "net/http" + "net/url" + "reflect" + "sort" + "strings" + "testing" + + "github.com/Azure/go-autorest/autorest/mocks" +) + +const ( + jsonT = ` + { + "name":"Rob Pike", + "age":42 + }` + xmlT = ` + + Rob Pike + 42 + ` +) + +func TestNewDecoderCreatesJSONDecoder(t *testing.T) { + d := NewDecoder(EncodedAsJSON, strings.NewReader(jsonT)) + _, ok := d.(*json.Decoder) + if d == nil || !ok { + t.Fatal("autorest: NewDecoder failed to create a JSON decoder when requested") + } +} + +func TestNewDecoderCreatesXMLDecoder(t *testing.T) { + d := NewDecoder(EncodedAsXML, strings.NewReader(xmlT)) + _, ok := d.(*xml.Decoder) + if d == nil || !ok { + t.Fatal("autorest: NewDecoder failed to create an XML decoder when requested") + } +} + +func TestNewDecoderReturnsNilForUnknownEncoding(t *testing.T) { + d := NewDecoder("unknown", strings.NewReader(xmlT)) + if d != nil { + t.Fatal("autorest: NewDecoder created a decoder for an unknown encoding") + } +} + +func TestCopyAndDecodeDecodesJSON(t *testing.T) { + _, err := CopyAndDecode(EncodedAsJSON, strings.NewReader(jsonT), &mocks.T{}) + if err != nil { + t.Fatalf("autorest: CopyAndDecode returned an error with valid JSON - %v", err) + } +} + +func TestCopyAndDecodeDecodesXML(t *testing.T) { + _, err := CopyAndDecode(EncodedAsXML, strings.NewReader(xmlT), &mocks.T{}) + if err != nil { + t.Fatalf("autorest: CopyAndDecode returned an error with valid XML - %v", err) + } +} + +func TestCopyAndDecodeReturnsJSONDecodingErrors(t *testing.T) { + _, err := CopyAndDecode(EncodedAsJSON, strings.NewReader(jsonT[0:len(jsonT)-2]), &mocks.T{}) + if err == nil { + t.Fatalf("autorest: CopyAndDecode failed to return an error with invalid JSON") + } +} + +func TestCopyAndDecodeReturnsXMLDecodingErrors(t *testing.T) { + _, err := CopyAndDecode(EncodedAsXML, strings.NewReader(xmlT[0:len(xmlT)-2]), &mocks.T{}) + if err == nil { + t.Fatalf("autorest: CopyAndDecode failed to return an error with invalid XML") + } +} + +func TestCopyAndDecodeAlwaysReturnsACopy(t *testing.T) { + b, _ := CopyAndDecode(EncodedAsJSON, strings.NewReader(jsonT), &mocks.T{}) + if b.String() != jsonT { + t.Fatalf("autorest: CopyAndDecode failed to return a valid copy of the data - %v", b.String()) + } +} + +func TestTeeReadCloser_Copies(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + b := &bytes.Buffer{} + + r.Body = TeeReadCloser(r.Body, b) + + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err != nil { + t.Fatalf("autorest: TeeReadCloser returned an unexpected error -- %v", err) + } + if b.String() != jsonT { + t.Fatalf("autorest: TeeReadCloser failed to copy the bytes read") + } +} + +func TestTeeReadCloser_PassesReadErrors(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + + r.Body.(*mocks.Body).Close() + r.Body = TeeReadCloser(r.Body, &bytes.Buffer{}) + + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err == nil { + t.Fatalf("autorest: TeeReadCloser failed to return the expected error") + } +} + +func TestTeeReadCloser_ClosesWrappedReader(t *testing.T) { + v := &mocks.T{} + r := mocks.NewResponseWithContent(jsonT) + + b := r.Body.(*mocks.Body) + r.Body = TeeReadCloser(r.Body, &bytes.Buffer{}) + err := Respond(r, + ByUnmarshallingJSON(v), + ByClosing()) + if err != nil { + t.Fatalf("autorest: TeeReadCloser returned an unexpected error -- %v", err) + } + if b.IsOpen() { + t.Fatalf("autorest: TeeReadCloser failed to close the nested io.ReadCloser") + } +} + +func TestContainsIntFindsValue(t *testing.T) { + ints := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} + v := 5 + if !containsInt(ints, v) { + t.Fatalf("autorest: containsInt failed to find %v in %v", v, ints) + } +} + +func TestContainsIntDoesNotFindValue(t *testing.T) { + ints := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} + v := 42 + if containsInt(ints, v) { + t.Fatalf("autorest: containsInt unexpectedly found %v in %v", v, ints) + } +} + +func TestContainsIntAcceptsEmptyList(t *testing.T) { + ints := make([]int, 10) + if containsInt(ints, 42) { + t.Fatalf("autorest: containsInt failed to handle an empty list") + } +} + +func TestContainsIntAcceptsNilList(t *testing.T) { + var ints []int + if containsInt(ints, 42) { + t.Fatalf("autorest: containsInt failed to handle an nil list") + } +} + +func TestEscapeStrings(t *testing.T) { + m := map[string]string{ + "string": "a long string with = odd characters", + "int": "42", + "nil": "", + } + r := map[string]string{ + "string": "a+long+string+with+%3D+odd+characters", + "int": "42", + "nil": "", + } + v := escapeValueStrings(m) + if !reflect.DeepEqual(v, r) { + t.Fatalf("autorest: ensureValueStrings returned %v\n", v) + } +} + +func TestEnsureStrings(t *testing.T) { + m := map[string]interface{}{ + "string": "string", + "int": 42, + "nil": nil, + "bytes": []byte{255, 254, 253}, + } + r := map[string]string{ + "string": "string", + "int": "42", + "nil": "", + "bytes": string([]byte{255, 254, 253}), + } + v := ensureValueStrings(m) + if !reflect.DeepEqual(v, r) { + t.Fatalf("autorest: ensureValueStrings returned %v\n", v) + } +} + +func ExampleString() { + m := []string{ + "string1", + "string2", + "string3", + } + + fmt.Println(String(m, ",")) + // Output: string1,string2,string3 +} + +func TestStringWithValidString(t *testing.T) { + i := 123 + if String(i) != "123" { + t.Fatal("autorest: String method failed to convert integer 123 to string") + } +} + +func TestEncodeWithValidPath(t *testing.T) { + s := Encode("Path", "Hello Gopher") + if s != "Hello%20Gopher" { + t.Fatalf("autorest: Encode method failed for valid path encoding. Got: %v; Want: %v", s, "Hello%20Gopher") + } +} + +func TestEncodeWithValidQuery(t *testing.T) { + s := Encode("Query", "Hello Gopher") + if s != "Hello+Gopher" { + t.Fatalf("autorest: Encode method failed for valid query encoding. Got: '%v'; Want: 'Hello+Gopher'", s) + } +} + +func TestEncodeWithValidNotPathQuery(t *testing.T) { + s := Encode("Host", "Hello Gopher") + if s != "Hello Gopher" { + t.Fatalf("autorest: Encode method failed for parameter not query or path. Got: '%v'; Want: 'Hello Gopher'", s) + } +} + +func TestMapToValues(t *testing.T) { + m := map[string]interface{}{ + "a": "a", + "b": 2, + } + v := url.Values{} + v.Add("a", "a") + v.Add("b", "2") + if !isEqual(v, MapToValues(m)) { + t.Fatalf("autorest: MapToValues method failed to return correct values - expected(%v) got(%v)", v, MapToValues(m)) + } +} + +func TestMapToValuesWithArrayValues(t *testing.T) { + m := map[string]interface{}{ + "a": []string{"a", "b"}, + "b": 2, + "c": []int{3, 4}, + } + v := url.Values{} + v.Add("a", "a") + v.Add("a", "b") + v.Add("b", "2") + v.Add("c", "3") + v.Add("c", "4") + + if !isEqual(v, MapToValues(m)) { + t.Fatalf("autorest: MapToValues method failed to return correct values - expected(%v) got(%v)", v, MapToValues(m)) + } +} + +func isEqual(v, u url.Values) bool { + for key, value := range v { + if len(u[key]) == 0 { + return false + } + sort.Strings(value) + sort.Strings(u[key]) + for i := range value { + if value[i] != u[key][i] { + return false + } + } + u.Del(key) + } + if len(u) > 0 { + return false + } + return true +} + +func doEnsureBodyClosed(t *testing.T) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if resp != nil && resp.Body != nil && resp.Body.(*mocks.Body).IsOpen() { + t.Fatal("autorest: Expected Body to be closed -- it was left open") + } + return resp, err + }) + } +} + +type mockAuthorizer struct{} + +func (ma mockAuthorizer) WithAuthorization() PrepareDecorator { + return WithHeader(headerAuthorization, mocks.TestAuthorizationHeader) +} + +type mockFailingAuthorizer struct{} + +func (mfa mockFailingAuthorizer) WithAuthorization() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + return r, fmt.Errorf("ERROR: mockFailingAuthorizer returned expected error") + }) + } +} + +type mockInspector struct { + wasInvoked bool +} + +func (mi *mockInspector) WithInspection() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + mi.wasInvoked = true + return p.Prepare(r) + }) + } +} + +func (mi *mockInspector) ByInspecting() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + mi.wasInvoked = true + return r.Respond(resp) + }) + } +} + +func withMessage(output *string, msg string) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err == nil { + *output += msg + } + return resp, err + }) + } +} + +func withErrorRespondDecorator(e *error) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err != nil { + return err + } + *e = fmt.Errorf("autorest: Faux Respond Error") + return *e + }) + } +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go index 1b34b1919a..d7b0eadc55 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go @@ -1,373 +1,373 @@ -/* -Package validation provides methods for validating parameter value using reflection. -*/ -package validation - -import ( - "fmt" - "reflect" - "regexp" - "strings" -) - -// Constraint stores constraint name, target field name -// Rule and chain validations. -type Constraint struct { - - // Target field name for validation. - Target string - - // Constraint name e.g. minLength, MaxLength, Pattern, etc. - Name string - - // Rule for constraint e.g. greater than 10, less than 5 etc. - Rule interface{} - - // Chain Validations for struct type - Chain []Constraint -} - -// Validation stores parameter-wise validation. -type Validation struct { - TargetValue interface{} - Constraints []Constraint -} - -// Constraint list -const ( - Empty = "Empty" - Null = "Null" - ReadOnly = "ReadOnly" - Pattern = "Pattern" - MaxLength = "MaxLength" - MinLength = "MinLength" - MaxItems = "MaxItems" - MinItems = "MinItems" - MultipleOf = "MultipleOf" - UniqueItems = "UniqueItems" - InclusiveMaximum = "InclusiveMaximum" - ExclusiveMaximum = "ExclusiveMaximum" - ExclusiveMinimum = "ExclusiveMinimum" - InclusiveMinimum = "InclusiveMinimum" -) - -// Validate method validates constraints on parameter -// passed in validation array. -func Validate(m []Validation) error { - for _, item := range m { - v := reflect.ValueOf(item.TargetValue) - for _, constraint := range item.Constraints { - var err error - switch v.Kind() { - case reflect.Ptr: - err = validatePtr(v, constraint) - case reflect.String: - err = validateString(v, constraint) - case reflect.Struct: - err = validateStruct(v, constraint) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - err = validateInt(v, constraint) - case reflect.Float32, reflect.Float64: - err = validateFloat(v, constraint) - case reflect.Array, reflect.Slice, reflect.Map: - err = validateArrayMap(v, constraint) - default: - err = createError(v, constraint, fmt.Sprintf("unknown type %v", v.Kind())) - } - - if err != nil { - return err - } - } - } - return nil -} - -func validateStruct(x reflect.Value, v Constraint, name ...string) error { - //Get field name from target name which is in format a.b.c - s := strings.Split(v.Target, ".") - f := x.FieldByName(s[len(s)-1]) - if isZero(f) { - return createError(x, v, fmt.Sprintf("field %q doesn't exist", v.Target)) - } - - if err := Validate([]Validation{ - { - TargetValue: getInterfaceValue(f), - Constraints: []Constraint{v}, - }, - }); err != nil { - return err - } - return nil -} - -func validatePtr(x reflect.Value, v Constraint) error { - if v.Name == ReadOnly { - if !x.IsNil() { - return createError(x.Elem(), v, "readonly parameter; must send as nil or empty in request") - } - return nil - } - if x.IsNil() { - return checkNil(x, v) - } - if v.Chain != nil { - return Validate([]Validation{ - { - TargetValue: getInterfaceValue(x.Elem()), - Constraints: v.Chain, - }, - }) - } - return nil -} - -func validateInt(x reflect.Value, v Constraint) error { - i := x.Int() - r, ok := v.Rule.(int) - if !ok { - return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) - } - switch v.Name { - case MultipleOf: - if i%int64(r) != 0 { - return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r)) - } - case ExclusiveMinimum: - if i <= int64(r) { - return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) - } - case ExclusiveMaximum: - if i >= int64(r) { - return createError(x, v, fmt.Sprintf("value must be less than %v", r)) - } - case InclusiveMinimum: - if i < int64(r) { - return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) - } - case InclusiveMaximum: - if i > int64(r) { - return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) - } - default: - return createError(x, v, fmt.Sprintf("constraint %v is not applicable for type integer", v.Name)) - } - return nil -} - -func validateFloat(x reflect.Value, v Constraint) error { - f := x.Float() - r, ok := v.Rule.(float64) - if !ok { - return createError(x, v, fmt.Sprintf("rule must be float value for %v constraint; got: %v", v.Name, v.Rule)) - } - switch v.Name { - case ExclusiveMinimum: - if f <= r { - return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) - } - case ExclusiveMaximum: - if f >= r { - return createError(x, v, fmt.Sprintf("value must be less than %v", r)) - } - case InclusiveMinimum: - if f < r { - return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) - } - case InclusiveMaximum: - if f > r { - return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) - } - default: - return createError(x, v, fmt.Sprintf("constraint %s is not applicable for type float", v.Name)) - } - return nil -} - -func validateString(x reflect.Value, v Constraint) error { - s := x.String() - switch v.Name { - case Empty: - if len(s) == 0 { - return checkEmpty(x, v) - } - case Pattern: - reg, err := regexp.Compile(v.Rule.(string)) - if err != nil { - return createError(x, v, err.Error()) - } - if !reg.MatchString(s) { - return createError(x, v, fmt.Sprintf("value doesn't match pattern %v", v.Rule)) - } - case MaxLength: - if _, ok := v.Rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) - } - if len(s) > v.Rule.(int) { - return createError(x, v, fmt.Sprintf("value length must be less than %v", v.Rule)) - } - case MinLength: - if _, ok := v.Rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) - } - if len(s) < v.Rule.(int) { - return createError(x, v, fmt.Sprintf("value length must be greater than %v", v.Rule)) - } - case ReadOnly: - if len(s) > 0 { - return createError(reflect.ValueOf(s), v, "readonly parameter; must send as nil or empty in request") - } - default: - return createError(x, v, fmt.Sprintf("constraint %s is not applicable to string type", v.Name)) - } - - if v.Chain != nil { - return Validate([]Validation{ - { - TargetValue: getInterfaceValue(x), - Constraints: v.Chain, - }, - }) - } - return nil -} - -func validateArrayMap(x reflect.Value, v Constraint) error { - switch v.Name { - case Null: - if x.IsNil() { - return checkNil(x, v) - } - case Empty: - if x.IsNil() || x.Len() == 0 { - return checkEmpty(x, v) - } - case MaxItems: - if _, ok := v.Rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule)) - } - if x.Len() > v.Rule.(int) { - return createError(x, v, fmt.Sprintf("maximum item limit is %v; got: %v", v.Rule, x.Len())) - } - case MinItems: - if _, ok := v.Rule.(int); !ok { - return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule)) - } - if x.Len() < v.Rule.(int) { - return createError(x, v, fmt.Sprintf("minimum item limit is %v; got: %v", v.Rule, x.Len())) - } - case UniqueItems: - if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { - if !checkForUniqueInArray(x) { - return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x)) - } - } else if x.Kind() == reflect.Map { - if !checkForUniqueInMap(x) { - return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x)) - } - } else { - return createError(x, v, fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", v.Name, x.Kind())) - } - case ReadOnly: - if x.Len() != 0 { - return createError(x, v, "readonly parameter; must send as nil or empty in request") - } - default: - return createError(x, v, fmt.Sprintf("constraint %v is not applicable to array, slice and map type", v.Name)) - } - - if v.Chain != nil { - return Validate([]Validation{ - { - TargetValue: getInterfaceValue(x), - Constraints: v.Chain, - }, - }) - } - return nil -} - -func checkNil(x reflect.Value, v Constraint) error { - if _, ok := v.Rule.(bool); !ok { - return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) - } - if v.Rule.(bool) { - return createError(x, v, "value can not be null; required parameter") - } - return nil -} - -func checkEmpty(x reflect.Value, v Constraint) error { - if _, ok := v.Rule.(bool); !ok { - return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) - } - - if v.Rule.(bool) { - return createError(x, v, "value can not be null or empty; required parameter") - } - return nil -} - -func checkForUniqueInArray(x reflect.Value) bool { - if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { - return false - } - arrOfInterface := make([]interface{}, x.Len()) - - for i := 0; i < x.Len(); i++ { - arrOfInterface[i] = x.Index(i).Interface() - } - - m := make(map[interface{}]bool) - for _, val := range arrOfInterface { - if m[val] { - return false - } - m[val] = true - } - return true -} - -func checkForUniqueInMap(x reflect.Value) bool { - if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { - return false - } - mapOfInterface := make(map[interface{}]interface{}, x.Len()) - - keys := x.MapKeys() - for _, k := range keys { - mapOfInterface[k.Interface()] = x.MapIndex(k).Interface() - } - - m := make(map[interface{}]bool) - for _, val := range mapOfInterface { - if m[val] { - return false - } - m[val] = true - } - return true -} - -func getInterfaceValue(x reflect.Value) interface{} { - if x.Kind() == reflect.Invalid { - return nil - } - return x.Interface() -} - -func isZero(x interface{}) bool { - return x == reflect.Zero(reflect.TypeOf(x)).Interface() -} - -func createError(x reflect.Value, v Constraint, err string) error { - return fmt.Errorf("autorest/validation: validation failed: parameter=%s constraint=%s value=%#v details: %s", - v.Target, v.Name, getInterfaceValue(x), err) -} - -// NewErrorWithValidationError appends package type and method name in -// validation error. -func NewErrorWithValidationError(err error, packageType, method string) error { - return fmt.Errorf("%s#%s: Invalid input: %v", packageType, method, err) -} +/* +Package validation provides methods for validating parameter value using reflection. +*/ +package validation + +import ( + "fmt" + "reflect" + "regexp" + "strings" +) + +// Constraint stores constraint name, target field name +// Rule and chain validations. +type Constraint struct { + + // Target field name for validation. + Target string + + // Constraint name e.g. minLength, MaxLength, Pattern, etc. + Name string + + // Rule for constraint e.g. greater than 10, less than 5 etc. + Rule interface{} + + // Chain Validations for struct type + Chain []Constraint +} + +// Validation stores parameter-wise validation. +type Validation struct { + TargetValue interface{} + Constraints []Constraint +} + +// Constraint list +const ( + Empty = "Empty" + Null = "Null" + ReadOnly = "ReadOnly" + Pattern = "Pattern" + MaxLength = "MaxLength" + MinLength = "MinLength" + MaxItems = "MaxItems" + MinItems = "MinItems" + MultipleOf = "MultipleOf" + UniqueItems = "UniqueItems" + InclusiveMaximum = "InclusiveMaximum" + ExclusiveMaximum = "ExclusiveMaximum" + ExclusiveMinimum = "ExclusiveMinimum" + InclusiveMinimum = "InclusiveMinimum" +) + +// Validate method validates constraints on parameter +// passed in validation array. +func Validate(m []Validation) error { + for _, item := range m { + v := reflect.ValueOf(item.TargetValue) + for _, constraint := range item.Constraints { + var err error + switch v.Kind() { + case reflect.Ptr: + err = validatePtr(v, constraint) + case reflect.String: + err = validateString(v, constraint) + case reflect.Struct: + err = validateStruct(v, constraint) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + err = validateInt(v, constraint) + case reflect.Float32, reflect.Float64: + err = validateFloat(v, constraint) + case reflect.Array, reflect.Slice, reflect.Map: + err = validateArrayMap(v, constraint) + default: + err = createError(v, constraint, fmt.Sprintf("unknown type %v", v.Kind())) + } + + if err != nil { + return err + } + } + } + return nil +} + +func validateStruct(x reflect.Value, v Constraint, name ...string) error { + //Get field name from target name which is in format a.b.c + s := strings.Split(v.Target, ".") + f := x.FieldByName(s[len(s)-1]) + if isZero(f) { + return createError(x, v, fmt.Sprintf("field %q doesn't exist", v.Target)) + } + + if err := Validate([]Validation{ + { + TargetValue: getInterfaceValue(f), + Constraints: []Constraint{v}, + }, + }); err != nil { + return err + } + return nil +} + +func validatePtr(x reflect.Value, v Constraint) error { + if v.Name == ReadOnly { + if !x.IsNil() { + return createError(x.Elem(), v, "readonly parameter; must send as nil or empty in request") + } + return nil + } + if x.IsNil() { + return checkNil(x, v) + } + if v.Chain != nil { + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(x.Elem()), + Constraints: v.Chain, + }, + }) + } + return nil +} + +func validateInt(x reflect.Value, v Constraint) error { + i := x.Int() + r, ok := v.Rule.(int) + if !ok { + return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) + } + switch v.Name { + case MultipleOf: + if i%int64(r) != 0 { + return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r)) + } + case ExclusiveMinimum: + if i <= int64(r) { + return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) + } + case ExclusiveMaximum: + if i >= int64(r) { + return createError(x, v, fmt.Sprintf("value must be less than %v", r)) + } + case InclusiveMinimum: + if i < int64(r) { + return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) + } + case InclusiveMaximum: + if i > int64(r) { + return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) + } + default: + return createError(x, v, fmt.Sprintf("constraint %v is not applicable for type integer", v.Name)) + } + return nil +} + +func validateFloat(x reflect.Value, v Constraint) error { + f := x.Float() + r, ok := v.Rule.(float64) + if !ok { + return createError(x, v, fmt.Sprintf("rule must be float value for %v constraint; got: %v", v.Name, v.Rule)) + } + switch v.Name { + case ExclusiveMinimum: + if f <= r { + return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) + } + case ExclusiveMaximum: + if f >= r { + return createError(x, v, fmt.Sprintf("value must be less than %v", r)) + } + case InclusiveMinimum: + if f < r { + return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) + } + case InclusiveMaximum: + if f > r { + return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) + } + default: + return createError(x, v, fmt.Sprintf("constraint %s is not applicable for type float", v.Name)) + } + return nil +} + +func validateString(x reflect.Value, v Constraint) error { + s := x.String() + switch v.Name { + case Empty: + if len(s) == 0 { + return checkEmpty(x, v) + } + case Pattern: + reg, err := regexp.Compile(v.Rule.(string)) + if err != nil { + return createError(x, v, err.Error()) + } + if !reg.MatchString(s) { + return createError(x, v, fmt.Sprintf("value doesn't match pattern %v", v.Rule)) + } + case MaxLength: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) + } + if len(s) > v.Rule.(int) { + return createError(x, v, fmt.Sprintf("value length must be less than %v", v.Rule)) + } + case MinLength: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) + } + if len(s) < v.Rule.(int) { + return createError(x, v, fmt.Sprintf("value length must be greater than %v", v.Rule)) + } + case ReadOnly: + if len(s) > 0 { + return createError(reflect.ValueOf(s), v, "readonly parameter; must send as nil or empty in request") + } + default: + return createError(x, v, fmt.Sprintf("constraint %s is not applicable to string type", v.Name)) + } + + if v.Chain != nil { + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(x), + Constraints: v.Chain, + }, + }) + } + return nil +} + +func validateArrayMap(x reflect.Value, v Constraint) error { + switch v.Name { + case Null: + if x.IsNil() { + return checkNil(x, v) + } + case Empty: + if x.IsNil() || x.Len() == 0 { + return checkEmpty(x, v) + } + case MaxItems: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule)) + } + if x.Len() > v.Rule.(int) { + return createError(x, v, fmt.Sprintf("maximum item limit is %v; got: %v", v.Rule, x.Len())) + } + case MinItems: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule)) + } + if x.Len() < v.Rule.(int) { + return createError(x, v, fmt.Sprintf("minimum item limit is %v; got: %v", v.Rule, x.Len())) + } + case UniqueItems: + if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { + if !checkForUniqueInArray(x) { + return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x)) + } + } else if x.Kind() == reflect.Map { + if !checkForUniqueInMap(x) { + return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x)) + } + } else { + return createError(x, v, fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", v.Name, x.Kind())) + } + case ReadOnly: + if x.Len() != 0 { + return createError(x, v, "readonly parameter; must send as nil or empty in request") + } + default: + return createError(x, v, fmt.Sprintf("constraint %v is not applicable to array, slice and map type", v.Name)) + } + + if v.Chain != nil { + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(x), + Constraints: v.Chain, + }, + }) + } + return nil +} + +func checkNil(x reflect.Value, v Constraint) error { + if _, ok := v.Rule.(bool); !ok { + return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) + } + if v.Rule.(bool) { + return createError(x, v, "value can not be null; required parameter") + } + return nil +} + +func checkEmpty(x reflect.Value, v Constraint) error { + if _, ok := v.Rule.(bool); !ok { + return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) + } + + if v.Rule.(bool) { + return createError(x, v, "value can not be null or empty; required parameter") + } + return nil +} + +func checkForUniqueInArray(x reflect.Value) bool { + if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { + return false + } + arrOfInterface := make([]interface{}, x.Len()) + + for i := 0; i < x.Len(); i++ { + arrOfInterface[i] = x.Index(i).Interface() + } + + m := make(map[interface{}]bool) + for _, val := range arrOfInterface { + if m[val] { + return false + } + m[val] = true + } + return true +} + +func checkForUniqueInMap(x reflect.Value) bool { + if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { + return false + } + mapOfInterface := make(map[interface{}]interface{}, x.Len()) + + keys := x.MapKeys() + for _, k := range keys { + mapOfInterface[k.Interface()] = x.MapIndex(k).Interface() + } + + m := make(map[interface{}]bool) + for _, val := range mapOfInterface { + if m[val] { + return false + } + m[val] = true + } + return true +} + +func getInterfaceValue(x reflect.Value) interface{} { + if x.Kind() == reflect.Invalid { + return nil + } + return x.Interface() +} + +func isZero(x interface{}) bool { + return x == reflect.Zero(reflect.TypeOf(x)).Interface() +} + +func createError(x reflect.Value, v Constraint, err string) error { + return fmt.Errorf("autorest/validation: validation failed: parameter=%s constraint=%s value=%#v details: %s", + v.Target, v.Name, getInterfaceValue(x), err) +} + +// NewErrorWithValidationError appends package type and method name in +// validation error. +func NewErrorWithValidationError(err error, packageType, method string) error { + return fmt.Errorf("%s#%s: Invalid input: %v", packageType, method, err) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation_test.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation_test.go index b66aa19e40..fdf8228463 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/validation/validation_test.go +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation_test.go @@ -1,2417 +1,2417 @@ -package validation - -import ( - "fmt" - "reflect" - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestCheckForUniqueInArrayTrue(t *testing.T) { - require.Equal(t, checkForUniqueInArray(reflect.ValueOf([]int{1, 2, 3})), true) -} - -func TestCheckForUniqueInArrayFalse(t *testing.T) { - require.Equal(t, checkForUniqueInArray(reflect.ValueOf([]int{1, 2, 3, 3})), false) -} - -func TestCheckForUniqueInArrayEmpty(t *testing.T) { - require.Equal(t, checkForUniqueInArray(reflect.ValueOf([]int{})), false) -} - -func TestCheckForUniqueInMapTrue(t *testing.T) { - require.Equal(t, checkForUniqueInMap(reflect.ValueOf(map[string]int{"one": 1, "two": 2})), true) -} - -func TestCheckForUniqueInMapFalse(t *testing.T) { - require.Equal(t, checkForUniqueInMap(reflect.ValueOf(map[int]string{1: "one", 2: "one"})), false) -} - -func TestCheckForUniqueInMapEmpty(t *testing.T) { - require.Equal(t, checkForUniqueInMap(reflect.ValueOf(map[int]string{})), false) -} - -func TestCheckEmpty_WithValueEmptyRuleTrue(t *testing.T) { - var x interface{} - v := Constraint{ - Target: "str", - Name: Empty, - Rule: true, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), v, "value can not be null or empty; required parameter") - require.Equal(t, checkEmpty(reflect.ValueOf(x), v).Error(), expected.Error()) -} - -func TestCheckEmpty_WithEmptyStringRuleFalse(t *testing.T) { - var x interface{} - v := Constraint{ - Target: "str", - Name: Empty, - Rule: false, - Chain: nil, - } - require.Nil(t, checkEmpty(reflect.ValueOf(x), v)) -} - -func TestCheckEmpty_IncorrectRule(t *testing.T) { - var x interface{} - v := Constraint{ - Target: "str", - Name: Empty, - Rule: 10, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) - require.Equal(t, checkEmpty(reflect.ValueOf(x), v).Error(), expected.Error()) -} - -func TestCheckEmpty_WithErrorArray(t *testing.T) { - var x interface{} = []string{} - v := Constraint{ - Target: "str", - Name: Empty, - Rule: true, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), v, "value can not be null or empty; required parameter") - require.Equal(t, checkEmpty(reflect.ValueOf(x), v).Error(), expected.Error()) -} - -func TestCheckNil_WithNilValueRuleTrue(t *testing.T) { - var x interface{} - v := Constraint{ - Target: "x", - Name: Null, - Rule: true, - Chain: []Constraint{ - {"x", MaxItems, 4, nil}, - }, - } - expected := createError(reflect.ValueOf(x), v, "value can not be null; required parameter") - require.Equal(t, checkNil(reflect.ValueOf(x), v).Error(), expected.Error()) -} - -func TestCheckNil_WithNilValueRuleFalse(t *testing.T) { - var x interface{} - v := Constraint{ - Target: "x", - Name: Null, - Rule: false, - Chain: []Constraint{ - {"x", MaxItems, 4, nil}, - }, - } - require.Nil(t, checkNil(reflect.ValueOf(x), v)) -} - -func TestCheckNil_IncorrectRule(t *testing.T) { - var x interface{} - c := Constraint{ - Target: "str", - Name: Null, - Rule: 10, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", c.Name, c.Rule)) - require.Equal(t, checkNil(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_WithNilValueRuleTrue(t *testing.T) { - var a []string - var x interface{} = a - c := Constraint{ - Target: "arr", - Name: Null, - Rule: true, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, "value can not be null; required parameter") - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c), expected) -} - -func TestValidateArrayMap_WithNilValueRuleFalse(t *testing.T) { - var x interface{} = []string{} - c := Constraint{ - Target: "arr", - Name: Null, - Rule: false, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_WithValueRuleNullTrue(t *testing.T) { - var x interface{} = []string{"1", "2"} - c := Constraint{ - Target: "arr", - Name: Null, - Rule: false, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_WithEmptyValueRuleTrue(t *testing.T) { - var x interface{} = []string{} - c := Constraint{ - Target: "arr", - Name: Empty, - Rule: true, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, "value can not be null or empty; required parameter") - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c), expected) -} - -func TestValidateArrayMap_WithEmptyValueRuleFalse(t *testing.T) { - var x interface{} = []string{} - c := Constraint{ - Target: "arr", - Name: Empty, - Rule: false, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_WithEmptyRuleEmptyTrue(t *testing.T) { - var x interface{} = []string{"1", "2"} - c := Constraint{ - Target: "arr", - Name: Empty, - Rule: false, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_MaxItemsIncorrectRule(t *testing.T) { - var x interface{} = []string{"1", "2"} - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: false, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_MaxItemsNoError(t *testing.T) { - var x interface{} = []string{"1", "2"} - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_MaxItemsWithError(t *testing.T) { - var x interface{} = []string{"1", "2", "3"} - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: 2, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("maximum item limit is %v; got: 3", c.Rule)) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_MaxItemsWithEmpty(t *testing.T) { - var x interface{} = []string{} - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_MinItemsIncorrectRule(t *testing.T) { - var x interface{} = []int{1, 2} - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: false, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_MinItemsNoError1(t *testing.T) { - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf([]int{1, 2}), c)) -} - -func TestValidateArrayMap_MinItemsNoError2(t *testing.T) { - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf([]int{1, 2, 3}), c)) -} - -func TestValidateArrayMap_MinItemsWithError(t *testing.T) { - var x interface{} = []int{1} - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: 1", c.Rule)) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_MinItemsWithEmpty(t *testing.T) { - var x interface{} = []int{} - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: 0", c.Rule)) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_Map_MaxItemsIncorrectRule(t *testing.T) { - var x interface{} = map[int]string{1: "1", 2: "2"} - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: false, - Chain: nil, - } - require.Equal(t, strings.Contains(validateArrayMap(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)), true) -} - -func TestValidateArrayMap_Map_MaxItemsNoError(t *testing.T) { - var x interface{} = map[int]string{1: "1", 2: "2"} - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_Map_MaxItemsWithError(t *testing.T) { - a := map[int]string{1: "1", 2: "2", 3: "3"} - var x interface{} = a - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: 2, - Chain: nil, - } - require.Equal(t, strings.Contains(validateArrayMap(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("maximum item limit is %v; got: %v", c.Rule, len(a))), true) -} - -func TestValidateArrayMap_Map_MaxItemsWithEmpty(t *testing.T) { - a := map[int]string{} - var x interface{} = a - c := Constraint{ - Target: "arr", - Name: MaxItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_Map_MinItemsIncorrectRule(t *testing.T) { - var x interface{} = map[int]string{1: "1", 2: "2"} - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: false, - Chain: nil, - } - require.Equal(t, strings.Contains(validateArrayMap(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)), true) -} - -func TestValidateArrayMap_Map_MinItemsNoError1(t *testing.T) { - var x interface{} = map[int]string{1: "1", 2: "2"} - require.Nil(t, validateArrayMap(reflect.ValueOf(x), - Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - })) -} - -func TestValidateArrayMap_Map_MinItemsNoError2(t *testing.T) { - var x interface{} = map[int]string{1: "1", 2: "2", 3: "3"} - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_Map_MinItemsWithError(t *testing.T) { - a := map[int]string{1: "1"} - var x interface{} = a - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: %v", c.Rule, len(a))) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -func TestValidateArrayMap_Map_MinItemsWithEmpty(t *testing.T) { - a := map[int]string{} - var x interface{} = a - c := Constraint{ - Target: "arr", - Name: MinItems, - Rule: 2, - Chain: nil, - } - expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: %v", c.Rule, len(a))) - require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) -} - -// func TestValidateArrayMap_Map_MinItemsNil(t *testing.T) { -// var a map[int]float64 -// var x interface{} = a -// c := Constraint{ -// Target: "str", -// Name: MinItems, -// Rule: true, -// Chain: nil, -// } -// expected := createError(reflect.Value(x), c, fmt.Sprintf("all items in parameter %v must be unique; got:%v", c.Target, x)) -// if z := validateArrayMap(reflect.ValueOf(x), c); strings.Contains(z.Error(), "all items in parameter str must be unique;") { -// t.Fatalf("autorest/validation: valiateArrayMap failed to return error \nexpect: %v;\ngot: %v", expected, z) -// } -// } - -func TestValidateArrayMap_Map_UniqueItemsTrue(t *testing.T) { - var x interface{} = map[float64]int{1.2: 1, 1.4: 2} - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_Map_UniqueItemsFalse(t *testing.T) { - var x interface{} = map[string]string{"1": "1", "2": "2", "3": "1"} - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("all items in parameter %q must be unique", c.Target)), true) -} - -func TestValidateArrayMap_Map_UniqueItemsEmpty(t *testing.T) { - // Consider Empty map as not unique returns false - var x interface{} = map[int]float64{} - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("all items in parameter %q must be unique", c.Target)), true) -} - -func TestValidateArrayMap_Map_UniqueItemsNil(t *testing.T) { - var a map[int]float64 - var x interface{} = a - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) -} - -func TestValidateArrayMap_Array_UniqueItemsTrue(t *testing.T) { - var x interface{} = []int{1, 2} - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_Array_UniqueItemsFalse(t *testing.T) { - var x interface{} = []string{"1", "2", "1"} - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) -} - -func TestValidateArrayMap_Array_UniqueItemsEmpty(t *testing.T) { - // Consider Empty array as not unique returns false - var x interface{} = []float64{} - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) -} - -func TestValidateArrayMap_Array_UniqueItemsNil(t *testing.T) { - // Consider nil array as not unique returns false - var a []float64 - var x interface{} = a - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) -} - -func TestValidateArrayMap_Array_UniqueItemsInvalidType(t *testing.T) { - var x interface{} = "hello" - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", c.Name, reflect.ValueOf(x).Kind())), true) -} - -func TestValidateArrayMap_Array_UniqueItemsInvalidConstraint(t *testing.T) { - var x interface{} = "hello" - c := Constraint{ - Target: "str", - Name: "sdad", - Rule: true, - Chain: nil, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("constraint %v is not applicable to array, slice and map type", c.Name)), true) -} - -func TestValidateArrayMap_ValidateChainConstraint1(t *testing.T) { - a := []int{1, 2, 3, 4} - var x interface{} = a - c := Constraint{ - Target: "str", - Name: Null, - Rule: true, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("maximum item limit is %v; got: %v", (c.Chain)[0].Rule, len(a))), true) -} - -func TestValidateArrayMap_ValidateChainConstraint2(t *testing.T) { - a := []int{1, 2, 3, 4} - var x interface{} = a - c := Constraint{ - Target: "str", - Name: Empty, - Rule: true, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("maximum item limit is %v; got: %v", (c.Chain)[0].Rule, len(a))), true) -} - -func TestValidateArrayMap_ValidateChainConstraint3(t *testing.T) { - var a []string - var x interface{} = a - c := Constraint{ - Target: "str", - Name: Null, - Rule: true, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("value can not be null; required parameter")), true) -} - -func TestValidateArrayMap_ValidateChainConstraint4(t *testing.T) { - var x interface{} = []int{} - c := Constraint{ - Target: "str", - Name: Empty, - Rule: true, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("value can not be null or empty; required parameter")), true) -} - -func TestValidateArrayMap_ValidateChainConstraintNilNotRequired(t *testing.T) { - var a []int - var x interface{} = a - c := Constraint{ - Target: "str", - Name: Null, - Rule: false, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_ValidateChainConstraintEmptyNotRequired(t *testing.T) { - var x interface{} = map[string]int{} - c := Constraint{ - Target: "str", - Name: Empty, - Rule: false, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateArrayMap_ReadOnlyWithError(t *testing.T) { - var x interface{} = []int{1, 2} - c := Constraint{ - Target: "str", - Name: ReadOnly, - Rule: true, - Chain: []Constraint{ - {"str", MaxItems, 3, nil}, - }, - } - z := validateArrayMap(reflect.ValueOf(x), c) - require.Equal(t, strings.Contains(z.Error(), - fmt.Sprintf("readonly parameter; must send as nil or empty in request")), true) -} - -func TestValidateArrayMap_ReadOnlyWithoutError(t *testing.T) { - var x interface{} = []int{} - c := Constraint{ - Target: "str", - Name: ReadOnly, - Rule: true, - Chain: nil, - } - require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) -} - -func TestValidateString_ReadOnly(t *testing.T) { - var x interface{} = "Hello Gopher" - c := Constraint{ - Target: "str", - Name: ReadOnly, - Rule: true, - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("readonly parameter; must send as nil or empty in request")), true) -} - -func TestValidateString_EmptyTrue(t *testing.T) { - // Empty true means parameter is required but Empty returns error - c := Constraint{ - Target: "str", - Name: Empty, - Rule: true, - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(""), c).Error(), - fmt.Sprintf("value can not be null or empty; required parameter")), true) -} - -func TestValidateString_EmptyFalse(t *testing.T) { - // Empty false means parameter is not required and Empty return nil - var x interface{} - c := Constraint{ - Target: "str", - Name: Empty, - Rule: false, - Chain: nil, - } - require.Nil(t, validateString(reflect.ValueOf(x), c)) -} - -func TestValidateString_MaxLengthInvalid(t *testing.T) { - // Empty true means parameter is required but Empty returns error - var x interface{} = "Hello" - c := Constraint{ - Target: "str", - Name: MaxLength, - Rule: 4, - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value length must be less than %v", c.Rule)), true) -} - -func TestValidateString_MaxLengthValid(t *testing.T) { - // Empty false means parameter is not required and Empty return nil - c := Constraint{ - Target: "str", - Name: MaxLength, - Rule: 7, - Chain: nil, - } - require.Nil(t, validateString(reflect.ValueOf("Hello"), c)) -} - -func TestValidateString_MaxLengthRuleInvalid(t *testing.T) { - var x interface{} = "Hello" - c := Constraint{ - Target: "str", - Name: MaxLength, - Rule: true, // must be int for maxLength - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("rule must be integer value for %v constraint; got: %v", c.Name, c.Rule)), true) -} - -func TestValidateString_MinLengthInvalid(t *testing.T) { - var x interface{} = "Hello" - c := Constraint{ - Target: "str", - Name: MinLength, - Rule: 10, - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value length must be greater than %v", c.Rule)), true) -} - -func TestValidateString_MinLengthValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: MinLength, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateString(reflect.ValueOf("Hello"), c)) -} - -func TestValidateString_MinLengthRuleInvalid(t *testing.T) { - var x interface{} = "Hello" - c := Constraint{ - Target: "str", - Name: MinLength, - Rule: true, // must be int for minLength - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("rule must be integer value for %v constraint; got: %v", c.Name, c.Rule)), true) -} - -func TestValidateString_PatternInvalidPattern(t *testing.T) { - var x interface{} = "Hello" - c := Constraint{ - Target: "str", - Name: Pattern, - Rule: `^[[:alnum:$`, - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - "error parsing regexp: missing closing ]"), true) -} - -func TestValidateString_PatternMatch1(t *testing.T) { - c := Constraint{ - Target: "str", - Name: Pattern, - Rule: `^http://\w+$`, - Chain: nil, - } - require.Nil(t, validateString(reflect.ValueOf("http://masd"), c)) -} - -func TestValidateString_PatternMatch2(t *testing.T) { - c := Constraint{ - Target: "str", - Name: Pattern, - Rule: `^[a-zA-Z0-9]+$`, - Chain: nil, - } - require.Nil(t, validateString(reflect.ValueOf("asdadad2323sad"), c)) -} - -func TestValidateString_PatternNotMatch(t *testing.T) { - var x interface{} = "asdad@@ad2323sad" - c := Constraint{ - Target: "str", - Name: Pattern, - Rule: `^[a-zA-Z0-9]+$`, - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value doesn't match pattern %v", c.Rule)), true) -} - -func TestValidateString_InvalidConstraint(t *testing.T) { - var x interface{} = "asdad@@ad2323sad" - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: "^[a-zA-Z0-9]+$", - Chain: nil, - } - require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("constraint %s is not applicable to string type", c.Name)), true) -} - -func TestValidateFloat_InvalidConstraint(t *testing.T) { - var x interface{} = 1.4 - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: 3.0, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("constraint %v is not applicable for type float", c.Name)), true) -} - -func TestValidateFloat_InvalidRuleValue(t *testing.T) { - var x interface{} = 1.4 - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 3, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("rule must be float value for %v constraint; got: %v", c.Name, c.Rule)), true) -} - -func TestValidateFloat_ExclusiveMinimumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 1.0, - Chain: nil, - } - require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) -} - -func TestValidateFloat_ExclusiveMinimumConstraintInvalid(t *testing.T) { - var x interface{} = 1.4 - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 1.5, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value must be greater than %v", c.Rule)), true) -} - -func TestValidateFloat_ExclusiveMinimumConstraintBoundary(t *testing.T) { - var x interface{} = 1.42 - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 1.42, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value must be greater than %v", c.Rule)), true) -} - -func TestValidateFloat_exclusiveMaximumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: ExclusiveMaximum, - Rule: 2.0, - Chain: nil, - } - require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) -} - -func TestValidateFloat_exclusiveMaximumConstraintInvalid(t *testing.T) { - var x interface{} = 1.42 - c := Constraint{ - Target: "str", - Name: ExclusiveMaximum, - Rule: 1.2, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value must be less than %v", c.Rule)), true) -} - -func TestValidateFloat_exclusiveMaximumConstraintBoundary(t *testing.T) { - var x interface{} = 1.42 - c := Constraint{ - Target: "str", - Name: ExclusiveMaximum, - Rule: 1.42, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value must be less than %v", c.Rule)), true) -} - -func TestValidateFloat_inclusiveMaximumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMaximum, - Rule: 2.0, - Chain: nil, - } - require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) -} - -func TestValidateFloat_inclusiveMaximumConstraintInvalid(t *testing.T) { - var x interface{} = 1.42 - c := Constraint{ - Target: "str", - Name: InclusiveMaximum, - Rule: 1.2, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value must be less than or equal to %v", c.Rule)), true) - -} - -func TestValidateFloat_inclusiveMaximumConstraintBoundary(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMaximum, - Rule: 1.42, - Chain: nil, - } - require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) -} - -func TestValidateFloat_InclusiveMinimumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMinimum, - Rule: 1.0, - Chain: nil, - } - require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) -} - -func TestValidateFloat_InclusiveMinimumConstraintInvalid(t *testing.T) { - var x interface{} = 1.42 - c := Constraint{ - Target: "str", - Name: InclusiveMinimum, - Rule: 1.5, - Chain: nil, - } - require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("value must be greater than or equal to %v", c.Rule)), true) - -} - -func TestValidateFloat_InclusiveMinimumConstraintBoundary(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMinimum, - Rule: 1.42, - Chain: nil, - } - require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) -} - -func TestValidateInt_InvalidConstraint(t *testing.T) { - var x interface{} = 1 - c := Constraint{ - Target: "str", - Name: UniqueItems, - Rule: 3, - Chain: nil, - } - require.Equal(t, strings.Contains(validateInt(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("constraint %s is not applicable for type integer", c.Name)), true) -} - -func TestValidateInt_InvalidRuleValue(t *testing.T) { - var x interface{} = 1 - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 3.4, - Chain: nil, - } - require.Equal(t, strings.Contains(validateInt(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("rule must be integer value for %v constraint; got: %v", c.Name, c.Rule)), true) -} - -func TestValidateInt_ExclusiveMinimumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 1, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(3), c)) -} - -func TestValidateInt_ExclusiveMinimumConstraintInvalid(t *testing.T) { - var x interface{} = 1 - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 3, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be greater than %v", c.Rule)).Error()) -} - -func TestValidateInt_ExclusiveMinimumConstraintBoundary(t *testing.T) { - var x interface{} = 1 - c := Constraint{ - Target: "str", - Name: ExclusiveMinimum, - Rule: 1, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be greater than %v", c.Rule)).Error()) -} - -func TestValidateInt_exclusiveMaximumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: ExclusiveMaximum, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(1), c)) -} - -func TestValidateInt_exclusiveMaximumConstraintInvalid(t *testing.T) { - var x interface{} = 2 - c := Constraint{ - Target: "str", - Name: ExclusiveMaximum, - Rule: 1, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be less than %v", c.Rule)).Error()) -} - -func TestValidateInt_exclusiveMaximumConstraintBoundary(t *testing.T) { - var x interface{} = 1 - c := Constraint{ - Target: "str", - Name: ExclusiveMaximum, - Rule: 1, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be less than %v", c.Rule)).Error()) -} - -func TestValidateInt_inclusiveMaximumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMaximum, - Rule: 2, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(1), c)) -} - -func TestValidateInt_inclusiveMaximumConstraintInvalid(t *testing.T) { - var x interface{} = 2 - c := Constraint{ - Target: "str", - Name: InclusiveMaximum, - Rule: 1, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be less than or equal to %v", c.Rule)).Error()) -} - -func TestValidateInt_inclusiveMaximumConstraintBoundary(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMaximum, - Rule: 1, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(1), c)) -} - -func TestValidateInt_InclusiveMinimumConstraintValid(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMinimum, - Rule: 1, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(1), c)) -} - -func TestValidateInt_InclusiveMinimumConstraintInvalid(t *testing.T) { - var x interface{} = 1 - c := Constraint{ - Target: "str", - Name: InclusiveMinimum, - Rule: 2, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be greater than or equal to %v", c.Rule)).Error()) -} - -func TestValidateInt_InclusiveMinimumConstraintBoundary(t *testing.T) { - c := Constraint{ - Target: "str", - Name: InclusiveMinimum, - Rule: 1, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(1), c)) -} - -func TestValidateInt_MultipleOfWithoutError(t *testing.T) { - c := Constraint{ - Target: "str", - Name: MultipleOf, - Rule: 10, - Chain: nil, - } - require.Nil(t, validateInt(reflect.ValueOf(2300), c)) -} - -func TestValidateInt_MultipleOfWithError(t *testing.T) { - c := Constraint{ - Target: "str", - Name: MultipleOf, - Rule: 11, - Chain: nil, - } - require.Equal(t, validateInt(reflect.ValueOf(2300), c).Error(), - createError(reflect.ValueOf(2300), c, fmt.Sprintf("value must be a multiple of %v", c.Rule)).Error()) -} - -func TestValidatePointer_NilTrue(t *testing.T) { - var z *int - var x interface{} = z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, // Required property - Chain: nil, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, "value can not be null; required parameter").Error()) -} - -func TestValidatePointer_NilFalse(t *testing.T) { - var z *int - var x interface{} = z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: false, // not required property - Chain: nil, - } - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidatePointer_NilReadonlyValid(t *testing.T) { - var z *int - var x interface{} = z - c := Constraint{ - Target: "ptr", - Name: ReadOnly, - Rule: true, - Chain: nil, - } - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidatePointer_NilReadonlyInvalid(t *testing.T) { - z := 10 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: ReadOnly, - Rule: true, - Chain: nil, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(z), c, "readonly parameter; must send as nil or empty in request").Error()) -} - -func TestValidatePointer_IntValid(t *testing.T) { - z := 10 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: InclusiveMinimum, - Rule: 3, - Chain: nil, - } - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidatePointer_IntInvalid(t *testing.T) { - z := 10 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: InclusiveMinimum, - Rule: 11, - Chain: nil, - }, - }, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(10), c.Chain[0], "value must be greater than or equal to 11").Error()) -} - -func TestValidatePointer_IntInvalidConstraint(t *testing.T) { - z := 10 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: MaxItems, - Rule: 3, - Chain: nil, - }, - }, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(10), c.Chain[0], - fmt.Sprintf("constraint %v is not applicable for type integer", MaxItems)).Error()) -} - -func TestValidatePointer_ValidInt64(t *testing.T) { - z := int64(10) - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: InclusiveMinimum, - Rule: 3, - Chain: nil, - }, - }} - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidatePointer_InvalidConstraintInt64(t *testing.T) { - z := int64(10) - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: MaxItems, - Rule: 3, - Chain: nil, - }, - }, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(10), c.Chain[0], - fmt.Sprintf("constraint %v is not applicable for type integer", MaxItems)).Error()) -} - -func TestValidatePointer_ValidFloat(t *testing.T) { - z := 10.1 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: InclusiveMinimum, - Rule: 3.0, - Chain: nil, - }}} - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidatePointer_InvalidFloat(t *testing.T) { - z := 10.1 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: InclusiveMinimum, - Rule: 12.0, - Chain: nil, - }}, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(10.1), c.Chain[0], - "value must be greater than or equal to 12").Error()) -} - -func TestValidatePointer_InvalidConstraintFloat(t *testing.T) { - z := 10.1 - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: MaxItems, - Rule: 3.0, - Chain: nil, - }}, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(10.1), c.Chain[0], - fmt.Sprintf("constraint %v is not applicable for type float", MaxItems)).Error()) -} - -func TestValidatePointer_StringValid(t *testing.T) { - z := "hello" - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: Pattern, - Rule: "^[a-z]+$", - Chain: nil, - }}} - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidatePointer_StringInvalid(t *testing.T) { - z := "hello" - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: MaxLength, - Rule: 2, - Chain: nil, - }}} - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf("hello"), c.Chain[0], - "value length must be less than 2").Error()) -} - -func TestValidatePointer_ArrayValid(t *testing.T) { - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: UniqueItems, - Rule: "true", - Chain: nil, - }}} - require.Nil(t, validatePtr(reflect.ValueOf(&[]string{"1", "2"}), c)) -} - -func TestValidatePointer_ArrayInvalid(t *testing.T) { - z := []string{"1", "2", "2"} - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{{ - Target: "ptr", - Name: UniqueItems, - Rule: true, - Chain: nil, - }}, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(z), c.Chain[0], - fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, z)).Error()) -} - -func TestValidatePointer_MapValid(t *testing.T) { - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{ - { - Target: "ptr", - Name: UniqueItems, - Rule: true, - Chain: nil, - }}} - require.Nil(t, validatePtr(reflect.ValueOf(&map[interface{}]string{1: "1", "1": "2"}), c)) -} - -func TestValidatePointer_MapInvalid(t *testing.T) { - z := map[interface{}]string{1: "1", "1": "2", 1.3: "2"} - var x interface{} = &z - c := Constraint{ - Target: "ptr", - Name: Null, - Rule: true, - Chain: []Constraint{{ - Target: "ptr", - Name: UniqueItems, - Rule: true, - Chain: nil, - }}, - } - require.Equal(t, strings.Contains(validatePtr(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("all items in parameter %q must be unique;", c.Target)), true) -} - -type Child struct { - I string -} -type Product struct { - C *Child - Str *string - Name string - Arr *[]string - M *map[string]string - Num *int32 -} - -type Sample struct { - M *map[string]*string - Name string -} - -func TestValidatePointer_StructWithError(t *testing.T) { - s := "hello" - var x interface{} = &Product{ - C: &Child{"100"}, - Str: &s, - Name: "Gopher", - } - c := Constraint{ - "p", Null, "True", - []Constraint{ - {"C", Null, true, - []Constraint{ - {"I", MaxLength, 2, nil}, - }}, - {"Str", MaxLength, 2, nil}, - {"Name", MaxLength, 5, nil}, - }, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf("100"), c.Chain[0].Chain[0], - "value length must be less than 2").Error()) -} - -func TestValidatePointer_WithNilStruct(t *testing.T) { - var p *Product - var x interface{} = p - c := Constraint{ - "p", Null, true, - []Constraint{ - {"C", Null, true, - []Constraint{ - {"I", Empty, true, - []Constraint{ - {"I", MaxLength, 5, nil}, - }}, - }}, - {"Str", MaxLength, 2, nil}, - {"Name", MaxLength, 5, nil}, - }, - } - require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x), c, - fmt.Sprintf("value can not be null; required parameter")).Error()) -} - -func TestValidatePointer_StructWithNoError(t *testing.T) { - s := "hello" - var x interface{} = &Product{ - C: &Child{"100"}, - Str: &s, - Name: "Gopher", - } - c := Constraint{ - "p", Null, true, - []Constraint{ - {"C", Null, true, - []Constraint{ - {"I", Empty, true, - []Constraint{ - {"I", MaxLength, 5, nil}, - }}, - }}, - }, - } - require.Nil(t, validatePtr(reflect.ValueOf(x), c)) -} - -func TestValidateStruct_FieldNotExist(t *testing.T) { - s := "hello" - var x interface{} = Product{ - C: &Child{"100"}, - Str: &s, - Name: "Gopher", - } - c := Constraint{ - "C", Null, true, - []Constraint{ - {"Name", Empty, true, nil}, - }, - } - s = "Name" - require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(Child{"100"}), c.Chain[0], - fmt.Sprintf("field %q doesn't exist", s)).Error()) -} - -func TestValidateStruct_WithChainConstraint(t *testing.T) { - s := "hello" - var x interface{} = Product{ - C: &Child{"100"}, - Str: &s, - Name: "Gopher", - } - c := Constraint{ - "C", Null, true, - []Constraint{ - {"I", Empty, true, - []Constraint{ - {"I", MaxLength, 2, nil}, - }}, - }, - } - require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf("100"), c.Chain[0].Chain[0], "value length must be less than 2").Error()) -} - -func TestValidateStruct_WithoutChainConstraint(t *testing.T) { - s := "hello" - var x interface{} = Product{ - C: &Child{""}, - Str: &s, - Name: "Gopher", - } - c := Constraint{"C", Null, true, - []Constraint{ - {"I", Empty, true, nil}, // throw error for Empty - }} - require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(""), c.Chain[0], "value can not be null or empty; required parameter").Error()) -} - -func TestValidateStruct_WithArrayNull(t *testing.T) { - s := "hello" - var x interface{} = Product{ - C: &Child{""}, - Str: &s, - Name: "Gopher", - Arr: nil, - } - c := Constraint{"Arr", Null, true, - []Constraint{ - {"Arr", MaxItems, 4, nil}, - {"Arr", MinItems, 2, nil}, - }, - } - require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(x.(Product).Arr), c, "value can not be null; required parameter").Error()) -} - -func TestValidateStruct_WithArrayEmptyError(t *testing.T) { - // arr := []string{} - var x interface{} = Product{ - Arr: &[]string{}, - } - c := Constraint{ - "Arr", Null, true, - []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MaxItems, 4, nil}, - {"Arr", MinItems, 2, nil}, - }} - - require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(*(x.(Product).Arr)), c.Chain[0], - fmt.Sprintf("value can not be null or empty; required parameter")).Error()) -} - -func TestValidateStruct_WithArrayEmptyWithoutError(t *testing.T) { - var x interface{} = Product{ - Arr: &[]string{}, - } - c := Constraint{ - "Arr", Null, true, - []Constraint{ - {"Arr", Empty, false, nil}, - {"Arr", MaxItems, 4, nil}, - }, - } - require.Nil(t, validateStruct(reflect.ValueOf(x), c)) -} - -func TestValidateStruct_ArrayWithError(t *testing.T) { - arr := []string{"1", "1"} - var x interface{} = Product{ - Arr: &arr, - } - c := Constraint{ - "Arr", Null, true, - []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MaxItems, 4, nil}, - {"Arr", UniqueItems, true, nil}, - }, - } - s := "Arr" - require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), - createError(reflect.ValueOf(*(x.(Product).Arr)), c.Chain[2], - fmt.Sprintf("all items in parameter %q must be unique; got:%v", s, *(x.(Product).Arr))).Error()) -} - -func TestValidateStruct_MapWithError(t *testing.T) { - m := map[string]string{ - "a": "hello", - "b": "hello", - } - var x interface{} = Product{ - M: &m, - } - c := Constraint{ - "M", Null, true, - []Constraint{ - {"M", Empty, true, nil}, - {"M", MaxItems, 4, nil}, - {"M", UniqueItems, true, nil}, - }, - } - - s := "M" - require.Equal(t, strings.Contains(validateStruct(reflect.ValueOf(x), c).Error(), - fmt.Sprintf("all items in parameter %q must be unique;", s)), true) -} - -func TestValidateStruct_MapWithNoError(t *testing.T) { - m := map[string]string{} - var x interface{} = Product{ - M: &m, - } - c := Constraint{ - "M", Null, true, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MaxItems, 4, nil}, - }, - } - require.Nil(t, validateStruct(reflect.ValueOf(x), c)) -} - -func TestValidateStruct_MapNilNoError(t *testing.T) { - var m map[string]string - var x interface{} = Product{ - M: &m, - } - c := Constraint{ - "M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MaxItems, 4, nil}, - }, - } - require.Nil(t, validateStruct(reflect.ValueOf(x), c)) -} - -func TestValidate_MapValidationWithError(t *testing.T) { - var x1 interface{} = &Product{ - Arr: &[]string{"1", "2"}, - M: &map[string]string{"a": "hello"}, - } - s := "hello" - var x2 interface{} = &Sample{ - M: &map[string]*string{"a": &s}, - } - v := []Validation{ - {x1, - []Constraint{{"x1", Null, true, - []Constraint{ - {"Arr", Null, true, - []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MaxItems, 4, nil}, - {"Arr", UniqueItems, true, nil}, - }, - }, - {"M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MinItems, 1, nil}, - {"M", UniqueItems, true, nil}, - }, - }, - }, - }}}, - {x2, - []Constraint{ - {"x2", Null, true, - []Constraint{ - {"M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MinItems, 2, nil}, - {"M", UniqueItems, true, nil}, - }, - }, - }, - }, - {"Name", Empty, true, nil}, - }}, - } - - z := Validate(v).Error() - require.Equal(t, strings.Contains(z, "minimum item limit is 2; got: 1"), true) - require.Equal(t, strings.Contains(z, "MinItems"), true) -} - -func TestValidate_MapValidationWithoutError(t *testing.T) { - var x1 interface{} = &Product{ - Arr: &[]string{"1", "2"}, - M: &map[string]string{"a": "hello"}, - } - s := "hello" - var x2 interface{} = &Sample{ - M: &map[string]*string{"a": &s}, - } - v := []Validation{ - {x1, - []Constraint{{"x1", Null, true, - []Constraint{ - {"Arr", Null, true, - []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MaxItems, 4, nil}, - {"Arr", UniqueItems, true, nil}, - }, - }, - {"M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MinItems, 1, nil}, - {"M", UniqueItems, true, nil}, - }, - }, - }, - }}}, - {x2, - []Constraint{ - {"x2", Null, true, - []Constraint{ - {"M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MinItems, 1, nil}, - {"M", UniqueItems, true, nil}, - }, - }, - }, - }, - {"Name", Empty, true, nil}, - }}, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_UnknownType(t *testing.T) { - var c chan int - v := []Validation{ - {c, - []Constraint{{"c", Null, true, nil}}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(c), v[0].Constraints[0], - fmt.Sprintf("unknown type %v", reflect.ValueOf(c).Kind())).Error()) -} - -func TestValidate_example1(t *testing.T) { - var x1 interface{} = Product{ - Arr: &[]string{"1", "1"}, - M: &map[string]string{"a": "hello"}, - } - s := "hello" - var x2 interface{} = Sample{ - M: &map[string]*string{"a": &s}, - } - v := []Validation{ - {x1, - []Constraint{{"Arr", Null, true, - []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MaxItems, 4, nil}, - {"Arr", UniqueItems, true, nil}, - }}, - {"M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MinItems, 1, nil}, - {"M", UniqueItems, true, nil}, - }, - }, - }}, - {x2, - []Constraint{ - {"M", Null, false, - []Constraint{ - {"M", Empty, false, nil}, - {"M", MinItems, 1, nil}, - {"M", UniqueItems, true, nil}, - }, - }, - {"Name", Empty, true, nil}, - }}, - } - s = "Arr" - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf([]string{"1", "1"}), v[0].Constraints[0].Chain[2], - fmt.Sprintf("all items in parameter %q must be unique; got:%v", s, []string{"1", "1"})).Error()) -} - -func TestValidate_Int(t *testing.T) { - n := int32(100) - v := []Validation{ - {n, - []Constraint{ - {"n", MultipleOf, 10, nil}, - {"n", ExclusiveMinimum, 100, nil}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(n), v[0].Constraints[1], - "value must be greater than 100").Error()) -} - -func TestValidate_IntPointer(t *testing.T) { - n := int32(100) - p := &n - v := []Validation{ - {p, - []Constraint{ - {"p", Null, true, []Constraint{ - {"p", ExclusiveMinimum, 100, nil}, - }}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(n), v[0].Constraints[0].Chain[0], - "value must be greater than 100").Error()) - - // required paramter - p = nil - v = []Validation{ - {p, - []Constraint{ - {"p", Null, true, []Constraint{ - {"p", ExclusiveMinimum, 100, nil}, - }}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(v[0].TargetValue), v[0].Constraints[0], - "value can not be null; required parameter").Error()) - - // Not required - p = nil - v = []Validation{ - {p, - []Constraint{ - {"p", Null, false, []Constraint{ - {"p", ExclusiveMinimum, 100, nil}, - }}, - }, - }, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_IntStruct(t *testing.T) { - n := int32(100) - p := &Product{ - Num: &n, - } - - v := []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"Num", Null, true, []Constraint{ - {"Num", ExclusiveMinimum, 100, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(n), v[0].Constraints[0].Chain[0].Chain[0], - "value must be greater than 100").Error()) - - // required paramter - p = &Product{} - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"p.Num", Null, true, []Constraint{ - {"p.Num", ExclusiveMinimum, 100, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(p.Num), v[0].Constraints[0].Chain[0], - "value can not be null; required parameter").Error()) - - // Not required - p = &Product{} - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"Num", Null, false, []Constraint{ - {"Num", ExclusiveMinimum, 100, nil}, - }}, - }, - }}}, - } - require.Nil(t, Validate(v)) - - // Parent not required - p = nil - v = []Validation{ - {p, []Constraint{{"p", Null, false, - []Constraint{ - {"Num", Null, false, []Constraint{ - {"Num", ExclusiveMinimum, 100, nil}, - }}, - }, - }}}, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_String(t *testing.T) { - s := "hello" - v := []Validation{ - {s, - []Constraint{ - {"s", Empty, true, nil}, - {"s", Empty, true, - []Constraint{{"s", MaxLength, 3, nil}}}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[1].Chain[0], - "value length must be less than 3").Error()) - - // required paramter - s = "" - v = []Validation{ - {s, - []Constraint{ - {"s", Empty, true, nil}, - {"s", Empty, true, - []Constraint{{"s", MaxLength, 3, nil}}}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[1], - "value can not be null or empty; required parameter").Error()) - - // not required paramter - s = "" - v = []Validation{ - {s, - []Constraint{ - {"s", Empty, false, nil}, - {"s", Empty, false, - []Constraint{{"s", MaxLength, 3, nil}}}, - }, - }, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_StringStruct(t *testing.T) { - s := "hello" - p := &Product{ - Str: &s, - } - - v := []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"p.Str", Null, true, []Constraint{ - {"p.Str", Empty, true, nil}, - {"p.Str", MaxLength, 3, nil}, - }}, - }, - }}}, - } - // e := ValidationError{ - // Constraint: MaxLength, - // Target: "Str", - // TargetValue: s, - // Details: fmt.Sprintf("value length must be less than 3", s), - // } - // if z := Validate(v); !reflect.DeepEqual(e, z) { - // t.Fatalf("autorest/validation: Validate failed to return error \nexpect: %v\ngot: %v", e, z) - // } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[1], - "value length must be less than 3").Error()) - - // required paramter - can't be Empty - s = "" - p = &Product{ - Str: &s, - } - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"Str", Null, true, []Constraint{ - {"Str", Empty, true, nil}, - {"Str", MaxLength, 3, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[0], - "value can not be null or empty; required parameter").Error()) - - // required paramter - can't be null - p = &Product{} - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"p.Str", Null, true, []Constraint{ - {"p.Str", Empty, true, nil}, - {"p.Str", MaxLength, 3, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(p.Str), v[0].Constraints[0].Chain[0], - "value can not be null; required parameter").Error()) - - // Not required - p = &Product{} - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"Str", Null, false, []Constraint{ - {"Str", Empty, true, nil}, - {"Str", MaxLength, 3, nil}, - }}, - }, - }}}, - } - require.Nil(t, Validate(v)) - - // Parent not required - p = nil - v = []Validation{ - {p, []Constraint{{"p", Null, false, - []Constraint{ - {"Str", Null, true, []Constraint{ - {"Str", Empty, true, nil}, - {"Str", MaxLength, 3, nil}, - }}, - }, - }}}, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_Array(t *testing.T) { - s := []string{"hello"} - v := []Validation{ - {s, - []Constraint{ - {"s", Null, true, - []Constraint{ - {"s", Empty, true, nil}, - {"s", MinItems, 2, nil}, - }}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[1], - fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error()) - - // Empty array - v = []Validation{ - {[]string{}, - []Constraint{ - {"s", Null, true, - []Constraint{ - {"s", Empty, true, nil}, - {"s", MinItems, 2, nil}}}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0], - "value can not be null or empty; required parameter").Error()) - - // null array - var s1 []string - v = []Validation{ - {s1, - []Constraint{ - {"s1", Null, true, - []Constraint{ - {"s1", Empty, true, nil}, - {"s1", MinItems, 2, nil}}}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s1), v[0].Constraints[0], - "value can not be null; required parameter").Error()) - - // not required paramter - v = []Validation{ - {s1, - []Constraint{ - {"s1", Null, false, - []Constraint{ - {"s1", Empty, true, nil}, - {"s1", MinItems, 2, nil}}}, - }, - }, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_ArrayPointer(t *testing.T) { - s := []string{"hello"} - v := []Validation{ - {&s, - []Constraint{ - {"s", Null, true, - []Constraint{ - {"s", Empty, true, nil}, - {"s", MinItems, 2, nil}, - }}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[1], - fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error()) - - // Empty array - v = []Validation{ - {&[]string{}, - []Constraint{ - {"s", Null, true, - []Constraint{ - {"s", Empty, true, nil}, - {"s", MinItems, 2, nil}}}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0], - "value can not be null or empty; required parameter").Error()) - - // null array - var s1 *[]string - v = []Validation{ - {s1, - []Constraint{ - {"s1", Null, true, - []Constraint{ - {"s1", Empty, true, nil}, - {"s1", MinItems, 2, nil}}}, - }, - }, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s1), v[0].Constraints[0], - "value can not be null; required parameter").Error()) - - // not required paramter - v = []Validation{ - {s1, - []Constraint{ - {"s1", Null, false, - []Constraint{ - {"s1", Empty, true, nil}, - {"s1", MinItems, 2, nil}}}, - }, - }, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_ArrayInStruct(t *testing.T) { - s := []string{"hello"} - p := &Product{ - Arr: &s, - } - - v := []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"p.Arr", Null, true, []Constraint{ - {"p.Arr", Empty, true, nil}, - {"p.Arr", MinItems, 2, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[1], - fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error()) - - // required paramter - can't be Empty - p = &Product{ - Arr: &[]string{}, - } - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"p.Arr", Null, true, []Constraint{ - {"p.Arr", Empty, true, nil}, - {"p.Arr", MinItems, 2, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0].Chain[0], - "value can not be null or empty; required parameter").Error()) - - // required paramter - can't be null - p = &Product{} - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{ - {"p.Arr", Null, true, []Constraint{ - {"p.Arr", Empty, true, nil}, - {"p.Arr", MinItems, 2, nil}, - }}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(p.Arr), v[0].Constraints[0].Chain[0], - "value can not be null; required parameter").Error()) - - // Not required - v = []Validation{ - {&Product{}, []Constraint{{"p", Null, true, - []Constraint{ - {"Arr", Null, false, []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MinItems, 2, nil}, - }}, - }, - }}}, - } - require.Nil(t, Validate(v)) - - // Parent not required - p = nil - v = []Validation{ - {p, []Constraint{{"p", Null, false, - []Constraint{ - {"Arr", Null, true, []Constraint{ - {"Arr", Empty, true, nil}, - {"Arr", MinItems, 2, nil}, - }}, - }, - }}}, - } - require.Nil(t, Validate(v)) -} - -func TestValidate_StructInStruct(t *testing.T) { - p := &Product{ - C: &Child{I: "hello"}, - } - v := []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{{"C", Null, true, - []Constraint{{"I", MinLength, 7, nil}}}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(p.C.I), v[0].Constraints[0].Chain[0].Chain[0], - "value length must be greater than 7").Error()) - - // required paramter - can't be Empty - p = &Product{ - C: &Child{I: ""}, - } - - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{{"C", Null, true, - []Constraint{{"I", Empty, true, nil}}}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(p.C.I), v[0].Constraints[0].Chain[0].Chain[0], - "value can not be null or empty; required parameter").Error()) - - // required paramter - can't be null - p = &Product{} - v = []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{{"C", Null, true, - []Constraint{{"I", Empty, true, nil}}}, - }, - }}}, - } - require.Equal(t, Validate(v).Error(), - createError(reflect.ValueOf(p.C), v[0].Constraints[0].Chain[0], - "value can not be null; required parameter").Error()) - - // Not required - v = []Validation{ - {&Product{}, []Constraint{{"p", Null, true, - []Constraint{{"p.C", Null, false, - []Constraint{{"p.C.I", Empty, true, nil}}}, - }, - }}}, - } - require.Nil(t, Validate(v)) - - // Parent not required - p = nil - v = []Validation{ - {p, []Constraint{{"p", Null, false, - []Constraint{{"p.C", Null, false, - []Constraint{{"p.C.I", Empty, true, nil}}}, - }, - }}}, - } - require.Nil(t, Validate(v)) -} - -func TestNewErrorWithValidationError(t *testing.T) { - p := &Product{} - v := []Validation{ - {p, []Constraint{{"p", Null, true, - []Constraint{{"p.C", Null, true, - []Constraint{{"p.C.I", Empty, true, nil}}}, - }, - }}}, - } - err := createError(reflect.ValueOf(p.C), v[0].Constraints[0].Chain[0], "value can not be null; required parameter") - z := fmt.Sprintf("batch.AccountClient#Create: Invalid input: %s", - err.Error()) - require.Equal(t, NewErrorWithValidationError(err, "batch.AccountClient", "Create").Error(), z) -} +package validation + +import ( + "fmt" + "reflect" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestCheckForUniqueInArrayTrue(t *testing.T) { + require.Equal(t, checkForUniqueInArray(reflect.ValueOf([]int{1, 2, 3})), true) +} + +func TestCheckForUniqueInArrayFalse(t *testing.T) { + require.Equal(t, checkForUniqueInArray(reflect.ValueOf([]int{1, 2, 3, 3})), false) +} + +func TestCheckForUniqueInArrayEmpty(t *testing.T) { + require.Equal(t, checkForUniqueInArray(reflect.ValueOf([]int{})), false) +} + +func TestCheckForUniqueInMapTrue(t *testing.T) { + require.Equal(t, checkForUniqueInMap(reflect.ValueOf(map[string]int{"one": 1, "two": 2})), true) +} + +func TestCheckForUniqueInMapFalse(t *testing.T) { + require.Equal(t, checkForUniqueInMap(reflect.ValueOf(map[int]string{1: "one", 2: "one"})), false) +} + +func TestCheckForUniqueInMapEmpty(t *testing.T) { + require.Equal(t, checkForUniqueInMap(reflect.ValueOf(map[int]string{})), false) +} + +func TestCheckEmpty_WithValueEmptyRuleTrue(t *testing.T) { + var x interface{} + v := Constraint{ + Target: "str", + Name: Empty, + Rule: true, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), v, "value can not be null or empty; required parameter") + require.Equal(t, checkEmpty(reflect.ValueOf(x), v).Error(), expected.Error()) +} + +func TestCheckEmpty_WithEmptyStringRuleFalse(t *testing.T) { + var x interface{} + v := Constraint{ + Target: "str", + Name: Empty, + Rule: false, + Chain: nil, + } + require.Nil(t, checkEmpty(reflect.ValueOf(x), v)) +} + +func TestCheckEmpty_IncorrectRule(t *testing.T) { + var x interface{} + v := Constraint{ + Target: "str", + Name: Empty, + Rule: 10, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) + require.Equal(t, checkEmpty(reflect.ValueOf(x), v).Error(), expected.Error()) +} + +func TestCheckEmpty_WithErrorArray(t *testing.T) { + var x interface{} = []string{} + v := Constraint{ + Target: "str", + Name: Empty, + Rule: true, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), v, "value can not be null or empty; required parameter") + require.Equal(t, checkEmpty(reflect.ValueOf(x), v).Error(), expected.Error()) +} + +func TestCheckNil_WithNilValueRuleTrue(t *testing.T) { + var x interface{} + v := Constraint{ + Target: "x", + Name: Null, + Rule: true, + Chain: []Constraint{ + {"x", MaxItems, 4, nil}, + }, + } + expected := createError(reflect.ValueOf(x), v, "value can not be null; required parameter") + require.Equal(t, checkNil(reflect.ValueOf(x), v).Error(), expected.Error()) +} + +func TestCheckNil_WithNilValueRuleFalse(t *testing.T) { + var x interface{} + v := Constraint{ + Target: "x", + Name: Null, + Rule: false, + Chain: []Constraint{ + {"x", MaxItems, 4, nil}, + }, + } + require.Nil(t, checkNil(reflect.ValueOf(x), v)) +} + +func TestCheckNil_IncorrectRule(t *testing.T) { + var x interface{} + c := Constraint{ + Target: "str", + Name: Null, + Rule: 10, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", c.Name, c.Rule)) + require.Equal(t, checkNil(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_WithNilValueRuleTrue(t *testing.T) { + var a []string + var x interface{} = a + c := Constraint{ + Target: "arr", + Name: Null, + Rule: true, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, "value can not be null; required parameter") + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c), expected) +} + +func TestValidateArrayMap_WithNilValueRuleFalse(t *testing.T) { + var x interface{} = []string{} + c := Constraint{ + Target: "arr", + Name: Null, + Rule: false, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_WithValueRuleNullTrue(t *testing.T) { + var x interface{} = []string{"1", "2"} + c := Constraint{ + Target: "arr", + Name: Null, + Rule: false, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_WithEmptyValueRuleTrue(t *testing.T) { + var x interface{} = []string{} + c := Constraint{ + Target: "arr", + Name: Empty, + Rule: true, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, "value can not be null or empty; required parameter") + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c), expected) +} + +func TestValidateArrayMap_WithEmptyValueRuleFalse(t *testing.T) { + var x interface{} = []string{} + c := Constraint{ + Target: "arr", + Name: Empty, + Rule: false, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_WithEmptyRuleEmptyTrue(t *testing.T) { + var x interface{} = []string{"1", "2"} + c := Constraint{ + Target: "arr", + Name: Empty, + Rule: false, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_MaxItemsIncorrectRule(t *testing.T) { + var x interface{} = []string{"1", "2"} + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: false, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_MaxItemsNoError(t *testing.T) { + var x interface{} = []string{"1", "2"} + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_MaxItemsWithError(t *testing.T) { + var x interface{} = []string{"1", "2", "3"} + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: 2, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("maximum item limit is %v; got: 3", c.Rule)) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_MaxItemsWithEmpty(t *testing.T) { + var x interface{} = []string{} + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_MinItemsIncorrectRule(t *testing.T) { + var x interface{} = []int{1, 2} + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: false, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_MinItemsNoError1(t *testing.T) { + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf([]int{1, 2}), c)) +} + +func TestValidateArrayMap_MinItemsNoError2(t *testing.T) { + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf([]int{1, 2, 3}), c)) +} + +func TestValidateArrayMap_MinItemsWithError(t *testing.T) { + var x interface{} = []int{1} + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: 1", c.Rule)) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_MinItemsWithEmpty(t *testing.T) { + var x interface{} = []int{} + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: 0", c.Rule)) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_Map_MaxItemsIncorrectRule(t *testing.T) { + var x interface{} = map[int]string{1: "1", 2: "2"} + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: false, + Chain: nil, + } + require.Equal(t, strings.Contains(validateArrayMap(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)), true) +} + +func TestValidateArrayMap_Map_MaxItemsNoError(t *testing.T) { + var x interface{} = map[int]string{1: "1", 2: "2"} + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_Map_MaxItemsWithError(t *testing.T) { + a := map[int]string{1: "1", 2: "2", 3: "3"} + var x interface{} = a + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: 2, + Chain: nil, + } + require.Equal(t, strings.Contains(validateArrayMap(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("maximum item limit is %v; got: %v", c.Rule, len(a))), true) +} + +func TestValidateArrayMap_Map_MaxItemsWithEmpty(t *testing.T) { + a := map[int]string{} + var x interface{} = a + c := Constraint{ + Target: "arr", + Name: MaxItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_Map_MinItemsIncorrectRule(t *testing.T) { + var x interface{} = map[int]string{1: "1", 2: "2"} + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: false, + Chain: nil, + } + require.Equal(t, strings.Contains(validateArrayMap(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("rule must be integer for %v constraint; got: %v", c.Name, c.Rule)), true) +} + +func TestValidateArrayMap_Map_MinItemsNoError1(t *testing.T) { + var x interface{} = map[int]string{1: "1", 2: "2"} + require.Nil(t, validateArrayMap(reflect.ValueOf(x), + Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + })) +} + +func TestValidateArrayMap_Map_MinItemsNoError2(t *testing.T) { + var x interface{} = map[int]string{1: "1", 2: "2", 3: "3"} + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_Map_MinItemsWithError(t *testing.T) { + a := map[int]string{1: "1"} + var x interface{} = a + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: %v", c.Rule, len(a))) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +func TestValidateArrayMap_Map_MinItemsWithEmpty(t *testing.T) { + a := map[int]string{} + var x interface{} = a + c := Constraint{ + Target: "arr", + Name: MinItems, + Rule: 2, + Chain: nil, + } + expected := createError(reflect.ValueOf(x), c, fmt.Sprintf("minimum item limit is %v; got: %v", c.Rule, len(a))) + require.Equal(t, validateArrayMap(reflect.ValueOf(x), c).Error(), expected.Error()) +} + +// func TestValidateArrayMap_Map_MinItemsNil(t *testing.T) { +// var a map[int]float64 +// var x interface{} = a +// c := Constraint{ +// Target: "str", +// Name: MinItems, +// Rule: true, +// Chain: nil, +// } +// expected := createError(reflect.Value(x), c, fmt.Sprintf("all items in parameter %v must be unique; got:%v", c.Target, x)) +// if z := validateArrayMap(reflect.ValueOf(x), c); strings.Contains(z.Error(), "all items in parameter str must be unique;") { +// t.Fatalf("autorest/validation: valiateArrayMap failed to return error \nexpect: %v;\ngot: %v", expected, z) +// } +// } + +func TestValidateArrayMap_Map_UniqueItemsTrue(t *testing.T) { + var x interface{} = map[float64]int{1.2: 1, 1.4: 2} + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_Map_UniqueItemsFalse(t *testing.T) { + var x interface{} = map[string]string{"1": "1", "2": "2", "3": "1"} + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("all items in parameter %q must be unique", c.Target)), true) +} + +func TestValidateArrayMap_Map_UniqueItemsEmpty(t *testing.T) { + // Consider Empty map as not unique returns false + var x interface{} = map[int]float64{} + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("all items in parameter %q must be unique", c.Target)), true) +} + +func TestValidateArrayMap_Map_UniqueItemsNil(t *testing.T) { + var a map[int]float64 + var x interface{} = a + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) +} + +func TestValidateArrayMap_Array_UniqueItemsTrue(t *testing.T) { + var x interface{} = []int{1, 2} + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_Array_UniqueItemsFalse(t *testing.T) { + var x interface{} = []string{"1", "2", "1"} + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) +} + +func TestValidateArrayMap_Array_UniqueItemsEmpty(t *testing.T) { + // Consider Empty array as not unique returns false + var x interface{} = []float64{} + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) +} + +func TestValidateArrayMap_Array_UniqueItemsNil(t *testing.T) { + // Consider nil array as not unique returns false + var a []float64 + var x interface{} = a + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, x)), true) +} + +func TestValidateArrayMap_Array_UniqueItemsInvalidType(t *testing.T) { + var x interface{} = "hello" + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", c.Name, reflect.ValueOf(x).Kind())), true) +} + +func TestValidateArrayMap_Array_UniqueItemsInvalidConstraint(t *testing.T) { + var x interface{} = "hello" + c := Constraint{ + Target: "str", + Name: "sdad", + Rule: true, + Chain: nil, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("constraint %v is not applicable to array, slice and map type", c.Name)), true) +} + +func TestValidateArrayMap_ValidateChainConstraint1(t *testing.T) { + a := []int{1, 2, 3, 4} + var x interface{} = a + c := Constraint{ + Target: "str", + Name: Null, + Rule: true, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("maximum item limit is %v; got: %v", (c.Chain)[0].Rule, len(a))), true) +} + +func TestValidateArrayMap_ValidateChainConstraint2(t *testing.T) { + a := []int{1, 2, 3, 4} + var x interface{} = a + c := Constraint{ + Target: "str", + Name: Empty, + Rule: true, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("maximum item limit is %v; got: %v", (c.Chain)[0].Rule, len(a))), true) +} + +func TestValidateArrayMap_ValidateChainConstraint3(t *testing.T) { + var a []string + var x interface{} = a + c := Constraint{ + Target: "str", + Name: Null, + Rule: true, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("value can not be null; required parameter")), true) +} + +func TestValidateArrayMap_ValidateChainConstraint4(t *testing.T) { + var x interface{} = []int{} + c := Constraint{ + Target: "str", + Name: Empty, + Rule: true, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("value can not be null or empty; required parameter")), true) +} + +func TestValidateArrayMap_ValidateChainConstraintNilNotRequired(t *testing.T) { + var a []int + var x interface{} = a + c := Constraint{ + Target: "str", + Name: Null, + Rule: false, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_ValidateChainConstraintEmptyNotRequired(t *testing.T) { + var x interface{} = map[string]int{} + c := Constraint{ + Target: "str", + Name: Empty, + Rule: false, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateArrayMap_ReadOnlyWithError(t *testing.T) { + var x interface{} = []int{1, 2} + c := Constraint{ + Target: "str", + Name: ReadOnly, + Rule: true, + Chain: []Constraint{ + {"str", MaxItems, 3, nil}, + }, + } + z := validateArrayMap(reflect.ValueOf(x), c) + require.Equal(t, strings.Contains(z.Error(), + fmt.Sprintf("readonly parameter; must send as nil or empty in request")), true) +} + +func TestValidateArrayMap_ReadOnlyWithoutError(t *testing.T) { + var x interface{} = []int{} + c := Constraint{ + Target: "str", + Name: ReadOnly, + Rule: true, + Chain: nil, + } + require.Nil(t, validateArrayMap(reflect.ValueOf(x), c)) +} + +func TestValidateString_ReadOnly(t *testing.T) { + var x interface{} = "Hello Gopher" + c := Constraint{ + Target: "str", + Name: ReadOnly, + Rule: true, + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("readonly parameter; must send as nil or empty in request")), true) +} + +func TestValidateString_EmptyTrue(t *testing.T) { + // Empty true means parameter is required but Empty returns error + c := Constraint{ + Target: "str", + Name: Empty, + Rule: true, + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(""), c).Error(), + fmt.Sprintf("value can not be null or empty; required parameter")), true) +} + +func TestValidateString_EmptyFalse(t *testing.T) { + // Empty false means parameter is not required and Empty return nil + var x interface{} + c := Constraint{ + Target: "str", + Name: Empty, + Rule: false, + Chain: nil, + } + require.Nil(t, validateString(reflect.ValueOf(x), c)) +} + +func TestValidateString_MaxLengthInvalid(t *testing.T) { + // Empty true means parameter is required but Empty returns error + var x interface{} = "Hello" + c := Constraint{ + Target: "str", + Name: MaxLength, + Rule: 4, + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value length must be less than %v", c.Rule)), true) +} + +func TestValidateString_MaxLengthValid(t *testing.T) { + // Empty false means parameter is not required and Empty return nil + c := Constraint{ + Target: "str", + Name: MaxLength, + Rule: 7, + Chain: nil, + } + require.Nil(t, validateString(reflect.ValueOf("Hello"), c)) +} + +func TestValidateString_MaxLengthRuleInvalid(t *testing.T) { + var x interface{} = "Hello" + c := Constraint{ + Target: "str", + Name: MaxLength, + Rule: true, // must be int for maxLength + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("rule must be integer value for %v constraint; got: %v", c.Name, c.Rule)), true) +} + +func TestValidateString_MinLengthInvalid(t *testing.T) { + var x interface{} = "Hello" + c := Constraint{ + Target: "str", + Name: MinLength, + Rule: 10, + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value length must be greater than %v", c.Rule)), true) +} + +func TestValidateString_MinLengthValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: MinLength, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateString(reflect.ValueOf("Hello"), c)) +} + +func TestValidateString_MinLengthRuleInvalid(t *testing.T) { + var x interface{} = "Hello" + c := Constraint{ + Target: "str", + Name: MinLength, + Rule: true, // must be int for minLength + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("rule must be integer value for %v constraint; got: %v", c.Name, c.Rule)), true) +} + +func TestValidateString_PatternInvalidPattern(t *testing.T) { + var x interface{} = "Hello" + c := Constraint{ + Target: "str", + Name: Pattern, + Rule: `^[[:alnum:$`, + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + "error parsing regexp: missing closing ]"), true) +} + +func TestValidateString_PatternMatch1(t *testing.T) { + c := Constraint{ + Target: "str", + Name: Pattern, + Rule: `^http://\w+$`, + Chain: nil, + } + require.Nil(t, validateString(reflect.ValueOf("http://masd"), c)) +} + +func TestValidateString_PatternMatch2(t *testing.T) { + c := Constraint{ + Target: "str", + Name: Pattern, + Rule: `^[a-zA-Z0-9]+$`, + Chain: nil, + } + require.Nil(t, validateString(reflect.ValueOf("asdadad2323sad"), c)) +} + +func TestValidateString_PatternNotMatch(t *testing.T) { + var x interface{} = "asdad@@ad2323sad" + c := Constraint{ + Target: "str", + Name: Pattern, + Rule: `^[a-zA-Z0-9]+$`, + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value doesn't match pattern %v", c.Rule)), true) +} + +func TestValidateString_InvalidConstraint(t *testing.T) { + var x interface{} = "asdad@@ad2323sad" + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: "^[a-zA-Z0-9]+$", + Chain: nil, + } + require.Equal(t, strings.Contains(validateString(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("constraint %s is not applicable to string type", c.Name)), true) +} + +func TestValidateFloat_InvalidConstraint(t *testing.T) { + var x interface{} = 1.4 + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: 3.0, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("constraint %v is not applicable for type float", c.Name)), true) +} + +func TestValidateFloat_InvalidRuleValue(t *testing.T) { + var x interface{} = 1.4 + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 3, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("rule must be float value for %v constraint; got: %v", c.Name, c.Rule)), true) +} + +func TestValidateFloat_ExclusiveMinimumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 1.0, + Chain: nil, + } + require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) +} + +func TestValidateFloat_ExclusiveMinimumConstraintInvalid(t *testing.T) { + var x interface{} = 1.4 + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 1.5, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value must be greater than %v", c.Rule)), true) +} + +func TestValidateFloat_ExclusiveMinimumConstraintBoundary(t *testing.T) { + var x interface{} = 1.42 + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 1.42, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value must be greater than %v", c.Rule)), true) +} + +func TestValidateFloat_exclusiveMaximumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: ExclusiveMaximum, + Rule: 2.0, + Chain: nil, + } + require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) +} + +func TestValidateFloat_exclusiveMaximumConstraintInvalid(t *testing.T) { + var x interface{} = 1.42 + c := Constraint{ + Target: "str", + Name: ExclusiveMaximum, + Rule: 1.2, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value must be less than %v", c.Rule)), true) +} + +func TestValidateFloat_exclusiveMaximumConstraintBoundary(t *testing.T) { + var x interface{} = 1.42 + c := Constraint{ + Target: "str", + Name: ExclusiveMaximum, + Rule: 1.42, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value must be less than %v", c.Rule)), true) +} + +func TestValidateFloat_inclusiveMaximumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMaximum, + Rule: 2.0, + Chain: nil, + } + require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) +} + +func TestValidateFloat_inclusiveMaximumConstraintInvalid(t *testing.T) { + var x interface{} = 1.42 + c := Constraint{ + Target: "str", + Name: InclusiveMaximum, + Rule: 1.2, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value must be less than or equal to %v", c.Rule)), true) + +} + +func TestValidateFloat_inclusiveMaximumConstraintBoundary(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMaximum, + Rule: 1.42, + Chain: nil, + } + require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) +} + +func TestValidateFloat_InclusiveMinimumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMinimum, + Rule: 1.0, + Chain: nil, + } + require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) +} + +func TestValidateFloat_InclusiveMinimumConstraintInvalid(t *testing.T) { + var x interface{} = 1.42 + c := Constraint{ + Target: "str", + Name: InclusiveMinimum, + Rule: 1.5, + Chain: nil, + } + require.Equal(t, strings.Contains(validateFloat(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("value must be greater than or equal to %v", c.Rule)), true) + +} + +func TestValidateFloat_InclusiveMinimumConstraintBoundary(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMinimum, + Rule: 1.42, + Chain: nil, + } + require.Nil(t, validateFloat(reflect.ValueOf(1.42), c)) +} + +func TestValidateInt_InvalidConstraint(t *testing.T) { + var x interface{} = 1 + c := Constraint{ + Target: "str", + Name: UniqueItems, + Rule: 3, + Chain: nil, + } + require.Equal(t, strings.Contains(validateInt(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("constraint %s is not applicable for type integer", c.Name)), true) +} + +func TestValidateInt_InvalidRuleValue(t *testing.T) { + var x interface{} = 1 + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 3.4, + Chain: nil, + } + require.Equal(t, strings.Contains(validateInt(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("rule must be integer value for %v constraint; got: %v", c.Name, c.Rule)), true) +} + +func TestValidateInt_ExclusiveMinimumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 1, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(3), c)) +} + +func TestValidateInt_ExclusiveMinimumConstraintInvalid(t *testing.T) { + var x interface{} = 1 + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 3, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be greater than %v", c.Rule)).Error()) +} + +func TestValidateInt_ExclusiveMinimumConstraintBoundary(t *testing.T) { + var x interface{} = 1 + c := Constraint{ + Target: "str", + Name: ExclusiveMinimum, + Rule: 1, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be greater than %v", c.Rule)).Error()) +} + +func TestValidateInt_exclusiveMaximumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: ExclusiveMaximum, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(1), c)) +} + +func TestValidateInt_exclusiveMaximumConstraintInvalid(t *testing.T) { + var x interface{} = 2 + c := Constraint{ + Target: "str", + Name: ExclusiveMaximum, + Rule: 1, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be less than %v", c.Rule)).Error()) +} + +func TestValidateInt_exclusiveMaximumConstraintBoundary(t *testing.T) { + var x interface{} = 1 + c := Constraint{ + Target: "str", + Name: ExclusiveMaximum, + Rule: 1, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be less than %v", c.Rule)).Error()) +} + +func TestValidateInt_inclusiveMaximumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMaximum, + Rule: 2, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(1), c)) +} + +func TestValidateInt_inclusiveMaximumConstraintInvalid(t *testing.T) { + var x interface{} = 2 + c := Constraint{ + Target: "str", + Name: InclusiveMaximum, + Rule: 1, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be less than or equal to %v", c.Rule)).Error()) +} + +func TestValidateInt_inclusiveMaximumConstraintBoundary(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMaximum, + Rule: 1, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(1), c)) +} + +func TestValidateInt_InclusiveMinimumConstraintValid(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMinimum, + Rule: 1, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(1), c)) +} + +func TestValidateInt_InclusiveMinimumConstraintInvalid(t *testing.T) { + var x interface{} = 1 + c := Constraint{ + Target: "str", + Name: InclusiveMinimum, + Rule: 2, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, fmt.Sprintf("value must be greater than or equal to %v", c.Rule)).Error()) +} + +func TestValidateInt_InclusiveMinimumConstraintBoundary(t *testing.T) { + c := Constraint{ + Target: "str", + Name: InclusiveMinimum, + Rule: 1, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(1), c)) +} + +func TestValidateInt_MultipleOfWithoutError(t *testing.T) { + c := Constraint{ + Target: "str", + Name: MultipleOf, + Rule: 10, + Chain: nil, + } + require.Nil(t, validateInt(reflect.ValueOf(2300), c)) +} + +func TestValidateInt_MultipleOfWithError(t *testing.T) { + c := Constraint{ + Target: "str", + Name: MultipleOf, + Rule: 11, + Chain: nil, + } + require.Equal(t, validateInt(reflect.ValueOf(2300), c).Error(), + createError(reflect.ValueOf(2300), c, fmt.Sprintf("value must be a multiple of %v", c.Rule)).Error()) +} + +func TestValidatePointer_NilTrue(t *testing.T) { + var z *int + var x interface{} = z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, // Required property + Chain: nil, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, "value can not be null; required parameter").Error()) +} + +func TestValidatePointer_NilFalse(t *testing.T) { + var z *int + var x interface{} = z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: false, // not required property + Chain: nil, + } + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidatePointer_NilReadonlyValid(t *testing.T) { + var z *int + var x interface{} = z + c := Constraint{ + Target: "ptr", + Name: ReadOnly, + Rule: true, + Chain: nil, + } + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidatePointer_NilReadonlyInvalid(t *testing.T) { + z := 10 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: ReadOnly, + Rule: true, + Chain: nil, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(z), c, "readonly parameter; must send as nil or empty in request").Error()) +} + +func TestValidatePointer_IntValid(t *testing.T) { + z := 10 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: InclusiveMinimum, + Rule: 3, + Chain: nil, + } + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidatePointer_IntInvalid(t *testing.T) { + z := 10 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: InclusiveMinimum, + Rule: 11, + Chain: nil, + }, + }, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(10), c.Chain[0], "value must be greater than or equal to 11").Error()) +} + +func TestValidatePointer_IntInvalidConstraint(t *testing.T) { + z := 10 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: MaxItems, + Rule: 3, + Chain: nil, + }, + }, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(10), c.Chain[0], + fmt.Sprintf("constraint %v is not applicable for type integer", MaxItems)).Error()) +} + +func TestValidatePointer_ValidInt64(t *testing.T) { + z := int64(10) + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: InclusiveMinimum, + Rule: 3, + Chain: nil, + }, + }} + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidatePointer_InvalidConstraintInt64(t *testing.T) { + z := int64(10) + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: MaxItems, + Rule: 3, + Chain: nil, + }, + }, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(10), c.Chain[0], + fmt.Sprintf("constraint %v is not applicable for type integer", MaxItems)).Error()) +} + +func TestValidatePointer_ValidFloat(t *testing.T) { + z := 10.1 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: InclusiveMinimum, + Rule: 3.0, + Chain: nil, + }}} + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidatePointer_InvalidFloat(t *testing.T) { + z := 10.1 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: InclusiveMinimum, + Rule: 12.0, + Chain: nil, + }}, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(10.1), c.Chain[0], + "value must be greater than or equal to 12").Error()) +} + +func TestValidatePointer_InvalidConstraintFloat(t *testing.T) { + z := 10.1 + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: MaxItems, + Rule: 3.0, + Chain: nil, + }}, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(10.1), c.Chain[0], + fmt.Sprintf("constraint %v is not applicable for type float", MaxItems)).Error()) +} + +func TestValidatePointer_StringValid(t *testing.T) { + z := "hello" + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: Pattern, + Rule: "^[a-z]+$", + Chain: nil, + }}} + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidatePointer_StringInvalid(t *testing.T) { + z := "hello" + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: MaxLength, + Rule: 2, + Chain: nil, + }}} + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf("hello"), c.Chain[0], + "value length must be less than 2").Error()) +} + +func TestValidatePointer_ArrayValid(t *testing.T) { + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: UniqueItems, + Rule: "true", + Chain: nil, + }}} + require.Nil(t, validatePtr(reflect.ValueOf(&[]string{"1", "2"}), c)) +} + +func TestValidatePointer_ArrayInvalid(t *testing.T) { + z := []string{"1", "2", "2"} + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{{ + Target: "ptr", + Name: UniqueItems, + Rule: true, + Chain: nil, + }}, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(z), c.Chain[0], + fmt.Sprintf("all items in parameter %q must be unique; got:%v", c.Target, z)).Error()) +} + +func TestValidatePointer_MapValid(t *testing.T) { + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{ + { + Target: "ptr", + Name: UniqueItems, + Rule: true, + Chain: nil, + }}} + require.Nil(t, validatePtr(reflect.ValueOf(&map[interface{}]string{1: "1", "1": "2"}), c)) +} + +func TestValidatePointer_MapInvalid(t *testing.T) { + z := map[interface{}]string{1: "1", "1": "2", 1.3: "2"} + var x interface{} = &z + c := Constraint{ + Target: "ptr", + Name: Null, + Rule: true, + Chain: []Constraint{{ + Target: "ptr", + Name: UniqueItems, + Rule: true, + Chain: nil, + }}, + } + require.Equal(t, strings.Contains(validatePtr(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("all items in parameter %q must be unique;", c.Target)), true) +} + +type Child struct { + I string +} +type Product struct { + C *Child + Str *string + Name string + Arr *[]string + M *map[string]string + Num *int32 +} + +type Sample struct { + M *map[string]*string + Name string +} + +func TestValidatePointer_StructWithError(t *testing.T) { + s := "hello" + var x interface{} = &Product{ + C: &Child{"100"}, + Str: &s, + Name: "Gopher", + } + c := Constraint{ + "p", Null, "True", + []Constraint{ + {"C", Null, true, + []Constraint{ + {"I", MaxLength, 2, nil}, + }}, + {"Str", MaxLength, 2, nil}, + {"Name", MaxLength, 5, nil}, + }, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf("100"), c.Chain[0].Chain[0], + "value length must be less than 2").Error()) +} + +func TestValidatePointer_WithNilStruct(t *testing.T) { + var p *Product + var x interface{} = p + c := Constraint{ + "p", Null, true, + []Constraint{ + {"C", Null, true, + []Constraint{ + {"I", Empty, true, + []Constraint{ + {"I", MaxLength, 5, nil}, + }}, + }}, + {"Str", MaxLength, 2, nil}, + {"Name", MaxLength, 5, nil}, + }, + } + require.Equal(t, validatePtr(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x), c, + fmt.Sprintf("value can not be null; required parameter")).Error()) +} + +func TestValidatePointer_StructWithNoError(t *testing.T) { + s := "hello" + var x interface{} = &Product{ + C: &Child{"100"}, + Str: &s, + Name: "Gopher", + } + c := Constraint{ + "p", Null, true, + []Constraint{ + {"C", Null, true, + []Constraint{ + {"I", Empty, true, + []Constraint{ + {"I", MaxLength, 5, nil}, + }}, + }}, + }, + } + require.Nil(t, validatePtr(reflect.ValueOf(x), c)) +} + +func TestValidateStruct_FieldNotExist(t *testing.T) { + s := "hello" + var x interface{} = Product{ + C: &Child{"100"}, + Str: &s, + Name: "Gopher", + } + c := Constraint{ + "C", Null, true, + []Constraint{ + {"Name", Empty, true, nil}, + }, + } + s = "Name" + require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(Child{"100"}), c.Chain[0], + fmt.Sprintf("field %q doesn't exist", s)).Error()) +} + +func TestValidateStruct_WithChainConstraint(t *testing.T) { + s := "hello" + var x interface{} = Product{ + C: &Child{"100"}, + Str: &s, + Name: "Gopher", + } + c := Constraint{ + "C", Null, true, + []Constraint{ + {"I", Empty, true, + []Constraint{ + {"I", MaxLength, 2, nil}, + }}, + }, + } + require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf("100"), c.Chain[0].Chain[0], "value length must be less than 2").Error()) +} + +func TestValidateStruct_WithoutChainConstraint(t *testing.T) { + s := "hello" + var x interface{} = Product{ + C: &Child{""}, + Str: &s, + Name: "Gopher", + } + c := Constraint{"C", Null, true, + []Constraint{ + {"I", Empty, true, nil}, // throw error for Empty + }} + require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(""), c.Chain[0], "value can not be null or empty; required parameter").Error()) +} + +func TestValidateStruct_WithArrayNull(t *testing.T) { + s := "hello" + var x interface{} = Product{ + C: &Child{""}, + Str: &s, + Name: "Gopher", + Arr: nil, + } + c := Constraint{"Arr", Null, true, + []Constraint{ + {"Arr", MaxItems, 4, nil}, + {"Arr", MinItems, 2, nil}, + }, + } + require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(x.(Product).Arr), c, "value can not be null; required parameter").Error()) +} + +func TestValidateStruct_WithArrayEmptyError(t *testing.T) { + // arr := []string{} + var x interface{} = Product{ + Arr: &[]string{}, + } + c := Constraint{ + "Arr", Null, true, + []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MaxItems, 4, nil}, + {"Arr", MinItems, 2, nil}, + }} + + require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(*(x.(Product).Arr)), c.Chain[0], + fmt.Sprintf("value can not be null or empty; required parameter")).Error()) +} + +func TestValidateStruct_WithArrayEmptyWithoutError(t *testing.T) { + var x interface{} = Product{ + Arr: &[]string{}, + } + c := Constraint{ + "Arr", Null, true, + []Constraint{ + {"Arr", Empty, false, nil}, + {"Arr", MaxItems, 4, nil}, + }, + } + require.Nil(t, validateStruct(reflect.ValueOf(x), c)) +} + +func TestValidateStruct_ArrayWithError(t *testing.T) { + arr := []string{"1", "1"} + var x interface{} = Product{ + Arr: &arr, + } + c := Constraint{ + "Arr", Null, true, + []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MaxItems, 4, nil}, + {"Arr", UniqueItems, true, nil}, + }, + } + s := "Arr" + require.Equal(t, validateStruct(reflect.ValueOf(x), c).Error(), + createError(reflect.ValueOf(*(x.(Product).Arr)), c.Chain[2], + fmt.Sprintf("all items in parameter %q must be unique; got:%v", s, *(x.(Product).Arr))).Error()) +} + +func TestValidateStruct_MapWithError(t *testing.T) { + m := map[string]string{ + "a": "hello", + "b": "hello", + } + var x interface{} = Product{ + M: &m, + } + c := Constraint{ + "M", Null, true, + []Constraint{ + {"M", Empty, true, nil}, + {"M", MaxItems, 4, nil}, + {"M", UniqueItems, true, nil}, + }, + } + + s := "M" + require.Equal(t, strings.Contains(validateStruct(reflect.ValueOf(x), c).Error(), + fmt.Sprintf("all items in parameter %q must be unique;", s)), true) +} + +func TestValidateStruct_MapWithNoError(t *testing.T) { + m := map[string]string{} + var x interface{} = Product{ + M: &m, + } + c := Constraint{ + "M", Null, true, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MaxItems, 4, nil}, + }, + } + require.Nil(t, validateStruct(reflect.ValueOf(x), c)) +} + +func TestValidateStruct_MapNilNoError(t *testing.T) { + var m map[string]string + var x interface{} = Product{ + M: &m, + } + c := Constraint{ + "M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MaxItems, 4, nil}, + }, + } + require.Nil(t, validateStruct(reflect.ValueOf(x), c)) +} + +func TestValidate_MapValidationWithError(t *testing.T) { + var x1 interface{} = &Product{ + Arr: &[]string{"1", "2"}, + M: &map[string]string{"a": "hello"}, + } + s := "hello" + var x2 interface{} = &Sample{ + M: &map[string]*string{"a": &s}, + } + v := []Validation{ + {x1, + []Constraint{{"x1", Null, true, + []Constraint{ + {"Arr", Null, true, + []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MaxItems, 4, nil}, + {"Arr", UniqueItems, true, nil}, + }, + }, + {"M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MinItems, 1, nil}, + {"M", UniqueItems, true, nil}, + }, + }, + }, + }}}, + {x2, + []Constraint{ + {"x2", Null, true, + []Constraint{ + {"M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MinItems, 2, nil}, + {"M", UniqueItems, true, nil}, + }, + }, + }, + }, + {"Name", Empty, true, nil}, + }}, + } + + z := Validate(v).Error() + require.Equal(t, strings.Contains(z, "minimum item limit is 2; got: 1"), true) + require.Equal(t, strings.Contains(z, "MinItems"), true) +} + +func TestValidate_MapValidationWithoutError(t *testing.T) { + var x1 interface{} = &Product{ + Arr: &[]string{"1", "2"}, + M: &map[string]string{"a": "hello"}, + } + s := "hello" + var x2 interface{} = &Sample{ + M: &map[string]*string{"a": &s}, + } + v := []Validation{ + {x1, + []Constraint{{"x1", Null, true, + []Constraint{ + {"Arr", Null, true, + []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MaxItems, 4, nil}, + {"Arr", UniqueItems, true, nil}, + }, + }, + {"M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MinItems, 1, nil}, + {"M", UniqueItems, true, nil}, + }, + }, + }, + }}}, + {x2, + []Constraint{ + {"x2", Null, true, + []Constraint{ + {"M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MinItems, 1, nil}, + {"M", UniqueItems, true, nil}, + }, + }, + }, + }, + {"Name", Empty, true, nil}, + }}, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_UnknownType(t *testing.T) { + var c chan int + v := []Validation{ + {c, + []Constraint{{"c", Null, true, nil}}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(c), v[0].Constraints[0], + fmt.Sprintf("unknown type %v", reflect.ValueOf(c).Kind())).Error()) +} + +func TestValidate_example1(t *testing.T) { + var x1 interface{} = Product{ + Arr: &[]string{"1", "1"}, + M: &map[string]string{"a": "hello"}, + } + s := "hello" + var x2 interface{} = Sample{ + M: &map[string]*string{"a": &s}, + } + v := []Validation{ + {x1, + []Constraint{{"Arr", Null, true, + []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MaxItems, 4, nil}, + {"Arr", UniqueItems, true, nil}, + }}, + {"M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MinItems, 1, nil}, + {"M", UniqueItems, true, nil}, + }, + }, + }}, + {x2, + []Constraint{ + {"M", Null, false, + []Constraint{ + {"M", Empty, false, nil}, + {"M", MinItems, 1, nil}, + {"M", UniqueItems, true, nil}, + }, + }, + {"Name", Empty, true, nil}, + }}, + } + s = "Arr" + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf([]string{"1", "1"}), v[0].Constraints[0].Chain[2], + fmt.Sprintf("all items in parameter %q must be unique; got:%v", s, []string{"1", "1"})).Error()) +} + +func TestValidate_Int(t *testing.T) { + n := int32(100) + v := []Validation{ + {n, + []Constraint{ + {"n", MultipleOf, 10, nil}, + {"n", ExclusiveMinimum, 100, nil}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(n), v[0].Constraints[1], + "value must be greater than 100").Error()) +} + +func TestValidate_IntPointer(t *testing.T) { + n := int32(100) + p := &n + v := []Validation{ + {p, + []Constraint{ + {"p", Null, true, []Constraint{ + {"p", ExclusiveMinimum, 100, nil}, + }}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(n), v[0].Constraints[0].Chain[0], + "value must be greater than 100").Error()) + + // required paramter + p = nil + v = []Validation{ + {p, + []Constraint{ + {"p", Null, true, []Constraint{ + {"p", ExclusiveMinimum, 100, nil}, + }}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(v[0].TargetValue), v[0].Constraints[0], + "value can not be null; required parameter").Error()) + + // Not required + p = nil + v = []Validation{ + {p, + []Constraint{ + {"p", Null, false, []Constraint{ + {"p", ExclusiveMinimum, 100, nil}, + }}, + }, + }, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_IntStruct(t *testing.T) { + n := int32(100) + p := &Product{ + Num: &n, + } + + v := []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"Num", Null, true, []Constraint{ + {"Num", ExclusiveMinimum, 100, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(n), v[0].Constraints[0].Chain[0].Chain[0], + "value must be greater than 100").Error()) + + // required paramter + p = &Product{} + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"p.Num", Null, true, []Constraint{ + {"p.Num", ExclusiveMinimum, 100, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(p.Num), v[0].Constraints[0].Chain[0], + "value can not be null; required parameter").Error()) + + // Not required + p = &Product{} + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"Num", Null, false, []Constraint{ + {"Num", ExclusiveMinimum, 100, nil}, + }}, + }, + }}}, + } + require.Nil(t, Validate(v)) + + // Parent not required + p = nil + v = []Validation{ + {p, []Constraint{{"p", Null, false, + []Constraint{ + {"Num", Null, false, []Constraint{ + {"Num", ExclusiveMinimum, 100, nil}, + }}, + }, + }}}, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_String(t *testing.T) { + s := "hello" + v := []Validation{ + {s, + []Constraint{ + {"s", Empty, true, nil}, + {"s", Empty, true, + []Constraint{{"s", MaxLength, 3, nil}}}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[1].Chain[0], + "value length must be less than 3").Error()) + + // required paramter + s = "" + v = []Validation{ + {s, + []Constraint{ + {"s", Empty, true, nil}, + {"s", Empty, true, + []Constraint{{"s", MaxLength, 3, nil}}}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[1], + "value can not be null or empty; required parameter").Error()) + + // not required paramter + s = "" + v = []Validation{ + {s, + []Constraint{ + {"s", Empty, false, nil}, + {"s", Empty, false, + []Constraint{{"s", MaxLength, 3, nil}}}, + }, + }, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_StringStruct(t *testing.T) { + s := "hello" + p := &Product{ + Str: &s, + } + + v := []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"p.Str", Null, true, []Constraint{ + {"p.Str", Empty, true, nil}, + {"p.Str", MaxLength, 3, nil}, + }}, + }, + }}}, + } + // e := ValidationError{ + // Constraint: MaxLength, + // Target: "Str", + // TargetValue: s, + // Details: fmt.Sprintf("value length must be less than 3", s), + // } + // if z := Validate(v); !reflect.DeepEqual(e, z) { + // t.Fatalf("autorest/validation: Validate failed to return error \nexpect: %v\ngot: %v", e, z) + // } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[1], + "value length must be less than 3").Error()) + + // required paramter - can't be Empty + s = "" + p = &Product{ + Str: &s, + } + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"Str", Null, true, []Constraint{ + {"Str", Empty, true, nil}, + {"Str", MaxLength, 3, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[0], + "value can not be null or empty; required parameter").Error()) + + // required paramter - can't be null + p = &Product{} + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"p.Str", Null, true, []Constraint{ + {"p.Str", Empty, true, nil}, + {"p.Str", MaxLength, 3, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(p.Str), v[0].Constraints[0].Chain[0], + "value can not be null; required parameter").Error()) + + // Not required + p = &Product{} + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"Str", Null, false, []Constraint{ + {"Str", Empty, true, nil}, + {"Str", MaxLength, 3, nil}, + }}, + }, + }}}, + } + require.Nil(t, Validate(v)) + + // Parent not required + p = nil + v = []Validation{ + {p, []Constraint{{"p", Null, false, + []Constraint{ + {"Str", Null, true, []Constraint{ + {"Str", Empty, true, nil}, + {"Str", MaxLength, 3, nil}, + }}, + }, + }}}, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_Array(t *testing.T) { + s := []string{"hello"} + v := []Validation{ + {s, + []Constraint{ + {"s", Null, true, + []Constraint{ + {"s", Empty, true, nil}, + {"s", MinItems, 2, nil}, + }}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[1], + fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error()) + + // Empty array + v = []Validation{ + {[]string{}, + []Constraint{ + {"s", Null, true, + []Constraint{ + {"s", Empty, true, nil}, + {"s", MinItems, 2, nil}}}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0], + "value can not be null or empty; required parameter").Error()) + + // null array + var s1 []string + v = []Validation{ + {s1, + []Constraint{ + {"s1", Null, true, + []Constraint{ + {"s1", Empty, true, nil}, + {"s1", MinItems, 2, nil}}}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s1), v[0].Constraints[0], + "value can not be null; required parameter").Error()) + + // not required paramter + v = []Validation{ + {s1, + []Constraint{ + {"s1", Null, false, + []Constraint{ + {"s1", Empty, true, nil}, + {"s1", MinItems, 2, nil}}}, + }, + }, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_ArrayPointer(t *testing.T) { + s := []string{"hello"} + v := []Validation{ + {&s, + []Constraint{ + {"s", Null, true, + []Constraint{ + {"s", Empty, true, nil}, + {"s", MinItems, 2, nil}, + }}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[1], + fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error()) + + // Empty array + v = []Validation{ + {&[]string{}, + []Constraint{ + {"s", Null, true, + []Constraint{ + {"s", Empty, true, nil}, + {"s", MinItems, 2, nil}}}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0], + "value can not be null or empty; required parameter").Error()) + + // null array + var s1 *[]string + v = []Validation{ + {s1, + []Constraint{ + {"s1", Null, true, + []Constraint{ + {"s1", Empty, true, nil}, + {"s1", MinItems, 2, nil}}}, + }, + }, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s1), v[0].Constraints[0], + "value can not be null; required parameter").Error()) + + // not required paramter + v = []Validation{ + {s1, + []Constraint{ + {"s1", Null, false, + []Constraint{ + {"s1", Empty, true, nil}, + {"s1", MinItems, 2, nil}}}, + }, + }, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_ArrayInStruct(t *testing.T) { + s := []string{"hello"} + p := &Product{ + Arr: &s, + } + + v := []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"p.Arr", Null, true, []Constraint{ + {"p.Arr", Empty, true, nil}, + {"p.Arr", MinItems, 2, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[1], + fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error()) + + // required paramter - can't be Empty + p = &Product{ + Arr: &[]string{}, + } + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"p.Arr", Null, true, []Constraint{ + {"p.Arr", Empty, true, nil}, + {"p.Arr", MinItems, 2, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0].Chain[0], + "value can not be null or empty; required parameter").Error()) + + // required paramter - can't be null + p = &Product{} + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{ + {"p.Arr", Null, true, []Constraint{ + {"p.Arr", Empty, true, nil}, + {"p.Arr", MinItems, 2, nil}, + }}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(p.Arr), v[0].Constraints[0].Chain[0], + "value can not be null; required parameter").Error()) + + // Not required + v = []Validation{ + {&Product{}, []Constraint{{"p", Null, true, + []Constraint{ + {"Arr", Null, false, []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MinItems, 2, nil}, + }}, + }, + }}}, + } + require.Nil(t, Validate(v)) + + // Parent not required + p = nil + v = []Validation{ + {p, []Constraint{{"p", Null, false, + []Constraint{ + {"Arr", Null, true, []Constraint{ + {"Arr", Empty, true, nil}, + {"Arr", MinItems, 2, nil}, + }}, + }, + }}}, + } + require.Nil(t, Validate(v)) +} + +func TestValidate_StructInStruct(t *testing.T) { + p := &Product{ + C: &Child{I: "hello"}, + } + v := []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{{"C", Null, true, + []Constraint{{"I", MinLength, 7, nil}}}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(p.C.I), v[0].Constraints[0].Chain[0].Chain[0], + "value length must be greater than 7").Error()) + + // required paramter - can't be Empty + p = &Product{ + C: &Child{I: ""}, + } + + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{{"C", Null, true, + []Constraint{{"I", Empty, true, nil}}}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(p.C.I), v[0].Constraints[0].Chain[0].Chain[0], + "value can not be null or empty; required parameter").Error()) + + // required paramter - can't be null + p = &Product{} + v = []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{{"C", Null, true, + []Constraint{{"I", Empty, true, nil}}}, + }, + }}}, + } + require.Equal(t, Validate(v).Error(), + createError(reflect.ValueOf(p.C), v[0].Constraints[0].Chain[0], + "value can not be null; required parameter").Error()) + + // Not required + v = []Validation{ + {&Product{}, []Constraint{{"p", Null, true, + []Constraint{{"p.C", Null, false, + []Constraint{{"p.C.I", Empty, true, nil}}}, + }, + }}}, + } + require.Nil(t, Validate(v)) + + // Parent not required + p = nil + v = []Validation{ + {p, []Constraint{{"p", Null, false, + []Constraint{{"p.C", Null, false, + []Constraint{{"p.C.I", Empty, true, nil}}}, + }, + }}}, + } + require.Nil(t, Validate(v)) +} + +func TestNewErrorWithValidationError(t *testing.T) { + p := &Product{} + v := []Validation{ + {p, []Constraint{{"p", Null, true, + []Constraint{{"p.C", Null, true, + []Constraint{{"p.C.I", Empty, true, nil}}}, + }, + }}}, + } + err := createError(reflect.ValueOf(p.C), v[0].Constraints[0].Chain[0], "value can not be null; required parameter") + z := fmt.Sprintf("batch.AccountClient#Create: Invalid input: %s", + err.Error()) + require.Equal(t, NewErrorWithValidationError(err, "batch.AccountClient", "Create").Error(), z) +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go index b4c6acd204..a222e8efaa 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/version.go +++ b/vendor/github.com/Azure/go-autorest/autorest/version.go @@ -1,35 +1,35 @@ -package autorest - -import ( - "bytes" - "fmt" - "strings" - "sync" -) - -const ( - major = 8 - minor = 0 - patch = 0 - tag = "" -) - -var once sync.Once -var version string - -// Version returns the semantic version (see http://semver.org). -func Version() string { - once.Do(func() { - semver := fmt.Sprintf("%d.%d.%d", major, minor, patch) - verBuilder := bytes.NewBufferString(semver) - if tag != "" && tag != "-" { - updated := strings.TrimPrefix(tag, "-") - _, err := verBuilder.WriteString("-" + updated) - if err == nil { - verBuilder = bytes.NewBufferString(semver) - } - } - version = verBuilder.String() - }) - return version -} +package autorest + +import ( + "bytes" + "fmt" + "strings" + "sync" +) + +const ( + major = 8 + minor = 0 + patch = 0 + tag = "" +) + +var once sync.Once +var version string + +// Version returns the semantic version (see http://semver.org). +func Version() string { + once.Do(func() { + semver := fmt.Sprintf("%d.%d.%d", major, minor, patch) + verBuilder := bytes.NewBufferString(semver) + if tag != "" && tag != "-" { + updated := strings.TrimPrefix(tag, "-") + _, err := verBuilder.WriteString("-" + updated) + if err == nil { + verBuilder = bytes.NewBufferString(semver) + } + } + version = verBuilder.String() + }) + return version +} diff --git a/vendor/github.com/Azure/go-autorest/glide.lock b/vendor/github.com/Azure/go-autorest/glide.lock index 3a37aa56d9..7c8ad81f33 100644 --- a/vendor/github.com/Azure/go-autorest/glide.lock +++ b/vendor/github.com/Azure/go-autorest/glide.lock @@ -1,42 +1,42 @@ -hash: 51202aefdfe9c4a992f96ab58f6cacf21cdbd1b66efe955c9030bca736ac816d -updated: 2017-02-14T17:07:23.015382703-08:00 -imports: -- name: github.com/dgrijalva/jwt-go - version: a601269ab70c205d26370c16f7c81e9017c14e04 - subpackages: - - . -- name: golang.org/x/crypto - version: 453249f01cfeb54c3d549ddb75ff152ca243f9d8 - repo: https://github.com/golang/crypto.git - vcs: git - subpackages: - - pkcs12 - - pkcs12/internal/rc2 -- name: golang.org/x/net - version: 61557ac0112b576429a0df080e1c2cef5dfbb642 - repo: https://github.com/golang/net.git - vcs: git - subpackages: - - . -- name: golang.org/x/text - version: 06d6eba81293389cafdff7fca90d75592194b2d9 - repo: https://github.com/golang/text.git - vcs: git - subpackages: - - . -testImports: -- name: github.com/davecgh/go-spew - version: 346938d642f2ec3594ed81d874461961cd0faa76 - subpackages: - - spew -- name: github.com/Masterminds/semver - version: 59c29afe1a994eacb71c833025ca7acf874bb1da -- name: github.com/pmezard/go-difflib - version: 792786c7400a136282c1664665ae0a8db921c6c2 - subpackages: - - difflib -- name: github.com/stretchr/testify - version: 4d4bfba8f1d1027c4fdbe371823030df51419987 - subpackages: - - assert - - require +hash: 51202aefdfe9c4a992f96ab58f6cacf21cdbd1b66efe955c9030bca736ac816d +updated: 2017-02-14T17:07:23.015382703-08:00 +imports: +- name: github.com/dgrijalva/jwt-go + version: a601269ab70c205d26370c16f7c81e9017c14e04 + subpackages: + - . +- name: golang.org/x/crypto + version: 453249f01cfeb54c3d549ddb75ff152ca243f9d8 + repo: https://github.com/golang/crypto.git + vcs: git + subpackages: + - pkcs12 + - pkcs12/internal/rc2 +- name: golang.org/x/net + version: 61557ac0112b576429a0df080e1c2cef5dfbb642 + repo: https://github.com/golang/net.git + vcs: git + subpackages: + - . +- name: golang.org/x/text + version: 06d6eba81293389cafdff7fca90d75592194b2d9 + repo: https://github.com/golang/text.git + vcs: git + subpackages: + - . +testImports: +- name: github.com/davecgh/go-spew + version: 346938d642f2ec3594ed81d874461961cd0faa76 + subpackages: + - spew +- name: github.com/Masterminds/semver + version: 59c29afe1a994eacb71c833025ca7acf874bb1da +- name: github.com/pmezard/go-difflib + version: 792786c7400a136282c1664665ae0a8db921c6c2 + subpackages: + - difflib +- name: github.com/stretchr/testify + version: 4d4bfba8f1d1027c4fdbe371823030df51419987 + subpackages: + - assert + - require diff --git a/vendor/github.com/Azure/go-autorest/glide.yaml b/vendor/github.com/Azure/go-autorest/glide.yaml index 760548239a..dda283cc29 100644 --- a/vendor/github.com/Azure/go-autorest/glide.yaml +++ b/vendor/github.com/Azure/go-autorest/glide.yaml @@ -1,28 +1,28 @@ -package: github.com/Azure/go-autorest -import: -- package: github.com/dgrijalva/jwt-go - subpackages: - - . -- package: golang.org/x/crypto - vcs: git - repo: https://github.com/golang/crypto.git - subpackages: - - /pkcs12 -- package: golang.org/x/net - vcs: git - repo: https://github.com/golang/net.git - subpackages: - - . -- package: golang.org/x/text - vcs: git - repo: https://github.com/golang/text.git - subpackages: - - . -testImports: -- package: github.com/stretchr/testify - vcs: git - repo: https://github.com/stretchr/testify.git - subpackages: - - /require -- package: github.com/Masterminds/semver - version: ~1.2.2 +package: github.com/Azure/go-autorest +import: +- package: github.com/dgrijalva/jwt-go + subpackages: + - . +- package: golang.org/x/crypto + vcs: git + repo: https://github.com/golang/crypto.git + subpackages: + - /pkcs12 +- package: golang.org/x/net + vcs: git + repo: https://github.com/golang/net.git + subpackages: + - . +- package: golang.org/x/text + vcs: git + repo: https://github.com/golang/text.git + subpackages: + - . +testImports: +- package: github.com/stretchr/testify + vcs: git + repo: https://github.com/stretchr/testify.git + subpackages: + - /require +- package: github.com/Masterminds/semver + version: ~1.2.2 diff --git a/vendor/github.com/Sirupsen/logrus/.gitignore b/vendor/github.com/Sirupsen/logrus/.gitignore index c63be35bd4..66be63a005 100644 --- a/vendor/github.com/Sirupsen/logrus/.gitignore +++ b/vendor/github.com/Sirupsen/logrus/.gitignore @@ -1 +1 @@ -logrus +logrus diff --git a/vendor/github.com/Sirupsen/logrus/.travis.yml b/vendor/github.com/Sirupsen/logrus/.travis.yml index 245aceedbe..804c569438 100644 --- a/vendor/github.com/Sirupsen/logrus/.travis.yml +++ b/vendor/github.com/Sirupsen/logrus/.travis.yml @@ -1,8 +1,8 @@ -language: go -go: - - 1.6 - - 1.7 - - tip -install: - - go get -t ./... -script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./... +language: go +go: + - 1.6 + - 1.7 + - tip +install: + - go get -t ./... +script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./... diff --git a/vendor/github.com/Sirupsen/logrus/CHANGELOG.md b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md index 639c0b9dfc..747e4d89a2 100644 --- a/vendor/github.com/Sirupsen/logrus/CHANGELOG.md +++ b/vendor/github.com/Sirupsen/logrus/CHANGELOG.md @@ -1,94 +1,94 @@ -# 0.11.5 - -* feature: add writer and writerlevel to entry (#372) - -# 0.11.4 - -* bug: fix undefined variable on solaris (#493) - -# 0.11.3 - -* formatter: configure quoting of empty values (#484) -* formatter: configure quoting character (default is `"`) (#484) -* bug: fix not importing io correctly in non-linux environments (#481) - -# 0.11.2 - -* bug: fix windows terminal detection (#476) - -# 0.11.1 - -* bug: fix tty detection with custom out (#471) - -# 0.11.0 - -* performance: Use bufferpool to allocate (#370) -* terminal: terminal detection for app-engine (#343) -* feature: exit handler (#375) - -# 0.10.0 - -* feature: Add a test hook (#180) -* feature: `ParseLevel` is now case-insensitive (#326) -* feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308) -* performance: avoid re-allocations on `WithFields` (#335) - -# 0.9.0 - -* logrus/text_formatter: don't emit empty msg -* logrus/hooks/airbrake: move out of main repository -* logrus/hooks/sentry: move out of main repository -* logrus/hooks/papertrail: move out of main repository -* logrus/hooks/bugsnag: move out of main repository -* logrus/core: run tests with `-race` -* logrus/core: detect TTY based on `stderr` -* logrus/core: support `WithError` on logger -* logrus/core: Solaris support - -# 0.8.7 - -* logrus/core: fix possible race (#216) -* logrus/doc: small typo fixes and doc improvements - - -# 0.8.6 - -* hooks/raven: allow passing an initialized client - -# 0.8.5 - -* logrus/core: revert #208 - -# 0.8.4 - -* formatter/text: fix data race (#218) - -# 0.8.3 - -* logrus/core: fix entry log level (#208) -* logrus/core: improve performance of text formatter by 40% -* logrus/core: expose `LevelHooks` type -* logrus/core: add support for DragonflyBSD and NetBSD -* formatter/text: print structs more verbosely - -# 0.8.2 - -* logrus: fix more Fatal family functions - -# 0.8.1 - -* logrus: fix not exiting on `Fatalf` and `Fatalln` - -# 0.8.0 - -* logrus: defaults to stderr instead of stdout -* hooks/sentry: add special field for `*http.Request` -* formatter/text: ignore Windows for colors - -# 0.7.3 - -* formatter/\*: allow configuration of timestamp layout - -# 0.7.2 - -* formatter/text: Add configuration option for time format (#158) +# 0.11.5 + +* feature: add writer and writerlevel to entry (#372) + +# 0.11.4 + +* bug: fix undefined variable on solaris (#493) + +# 0.11.3 + +* formatter: configure quoting of empty values (#484) +* formatter: configure quoting character (default is `"`) (#484) +* bug: fix not importing io correctly in non-linux environments (#481) + +# 0.11.2 + +* bug: fix windows terminal detection (#476) + +# 0.11.1 + +* bug: fix tty detection with custom out (#471) + +# 0.11.0 + +* performance: Use bufferpool to allocate (#370) +* terminal: terminal detection for app-engine (#343) +* feature: exit handler (#375) + +# 0.10.0 + +* feature: Add a test hook (#180) +* feature: `ParseLevel` is now case-insensitive (#326) +* feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308) +* performance: avoid re-allocations on `WithFields` (#335) + +# 0.9.0 + +* logrus/text_formatter: don't emit empty msg +* logrus/hooks/airbrake: move out of main repository +* logrus/hooks/sentry: move out of main repository +* logrus/hooks/papertrail: move out of main repository +* logrus/hooks/bugsnag: move out of main repository +* logrus/core: run tests with `-race` +* logrus/core: detect TTY based on `stderr` +* logrus/core: support `WithError` on logger +* logrus/core: Solaris support + +# 0.8.7 + +* logrus/core: fix possible race (#216) +* logrus/doc: small typo fixes and doc improvements + + +# 0.8.6 + +* hooks/raven: allow passing an initialized client + +# 0.8.5 + +* logrus/core: revert #208 + +# 0.8.4 + +* formatter/text: fix data race (#218) + +# 0.8.3 + +* logrus/core: fix entry log level (#208) +* logrus/core: improve performance of text formatter by 40% +* logrus/core: expose `LevelHooks` type +* logrus/core: add support for DragonflyBSD and NetBSD +* formatter/text: print structs more verbosely + +# 0.8.2 + +* logrus: fix more Fatal family functions + +# 0.8.1 + +* logrus: fix not exiting on `Fatalf` and `Fatalln` + +# 0.8.0 + +* logrus: defaults to stderr instead of stdout +* hooks/sentry: add special field for `*http.Request` +* formatter/text: ignore Windows for colors + +# 0.7.3 + +* formatter/\*: allow configuration of timestamp layout + +# 0.7.2 + +* formatter/text: Add configuration option for time format (#158) diff --git a/vendor/github.com/Sirupsen/logrus/LICENSE b/vendor/github.com/Sirupsen/logrus/LICENSE index 8c2c6598f6..f090cb42f3 100644 --- a/vendor/github.com/Sirupsen/logrus/LICENSE +++ b/vendor/github.com/Sirupsen/logrus/LICENSE @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2014 Simon Eskildsen - -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. +The MIT License (MIT) + +Copyright (c) 2014 Simon Eskildsen + +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/Sirupsen/logrus/README.md b/vendor/github.com/Sirupsen/logrus/README.md index 1efb7307b9..640cf61f6f 100644 --- a/vendor/github.com/Sirupsen/logrus/README.md +++ b/vendor/github.com/Sirupsen/logrus/README.md @@ -1,476 +1,476 @@ -# Logrus :walrus: [![Build Status](https://travis-ci.org/Sirupsen/logrus.svg?branch=master)](https://travis-ci.org/Sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/Sirupsen/logrus?status.svg)](https://godoc.org/github.com/Sirupsen/logrus) - -**Seeing weird case-sensitive problems?** See [this -issue](https://github.com/sirupsen/logrus/issues/451#issuecomment-264332021). -This change has been reverted. I apologize for causing this. I greatly -underestimated the impact this would have. Logrus strives for stability and -backwards compatibility and failed to provide that. - -Logrus is a structured logger for Go (golang), completely API compatible with -the standard library logger. [Godoc][godoc]. **Please note the Logrus API is not -yet stable (pre 1.0). Logrus itself is completely stable and has been used in -many large deployments. The core API is unlikely to change much but please -version control your Logrus to make sure you aren't fetching latest `master` on -every build.** - -Nicely color-coded in development (when a TTY is attached, otherwise just -plain text): - -![Colored](http://i.imgur.com/PY7qMwd.png) - -With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash -or Splunk: - -```json -{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the -ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"} - -{"level":"warning","msg":"The group's number increased tremendously!", -"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"} - -{"animal":"walrus","level":"info","msg":"A giant walrus appears!", -"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"} - -{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.", -"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"} - -{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true, -"time":"2014-03-10 19:57:38.562543128 -0400 EDT"} -``` - -With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not -attached, the output is compatible with the -[logfmt](http://godoc.org/github.com/kr/logfmt) format: - -```text -time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8 -time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10 -time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true -time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4 -time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009 -time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true -exit status 1 -``` - -#### Example - -The simplest way to use Logrus is simply the package-level exported logger: - -```go -package main - -import ( - log "github.com/Sirupsen/logrus" -) - -func main() { - log.WithFields(log.Fields{ - "animal": "walrus", - }).Info("A walrus appears") -} -``` - -Note that it's completely api-compatible with the stdlib logger, so you can -replace your `log` imports everywhere with `log "github.com/Sirupsen/logrus"` -and you'll now have the flexibility of Logrus. You can customize it all you -want: - -```go -package main - -import ( - "os" - log "github.com/Sirupsen/logrus" -) - -func init() { - // Log as JSON instead of the default ASCII formatter. - log.SetFormatter(&log.JSONFormatter{}) - - // Output to stdout instead of the default stderr - // Can be any io.Writer, see below for File example - log.SetOutput(os.Stdout) - - // Only log the warning severity or above. - log.SetLevel(log.WarnLevel) -} - -func main() { - log.WithFields(log.Fields{ - "animal": "walrus", - "size": 10, - }).Info("A group of walrus emerges from the ocean") - - log.WithFields(log.Fields{ - "omg": true, - "number": 122, - }).Warn("The group's number increased tremendously!") - - log.WithFields(log.Fields{ - "omg": true, - "number": 100, - }).Fatal("The ice breaks!") - - // A common pattern is to re-use fields between logging statements by re-using - // the logrus.Entry returned from WithFields() - contextLogger := log.WithFields(log.Fields{ - "common": "this is a common field", - "other": "I also should be logged always", - }) - - contextLogger.Info("I'll be logged with common and other field") - contextLogger.Info("Me too") -} -``` - -For more advanced usage such as logging to multiple locations from the same -application, you can also create an instance of the `logrus` Logger: - -```go -package main - -import ( - "github.com/Sirupsen/logrus" -) - -// Create a new instance of the logger. You can have any number of instances. -var log = logrus.New() - -func main() { - // The API for setting attributes is a little different than the package level - // exported logger. See Godoc. - log.Out = os.Stdout - - // You could set this to any `io.Writer` such as a file - // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666) - // if err == nil { - // log.Out = file - // } else { - // log.Info("Failed to log to file, using default stderr") - // } - - log.WithFields(logrus.Fields{ - "animal": "walrus", - "size": 10, - }).Info("A group of walrus emerges from the ocean") -} -``` - -#### Fields - -Logrus encourages careful, structured logging though logging fields instead of -long, unparseable error messages. For example, instead of: `log.Fatalf("Failed -to send event %s to topic %s with key %d")`, you should log the much more -discoverable: - -```go -log.WithFields(log.Fields{ - "event": event, - "topic": topic, - "key": key, -}).Fatal("Failed to send event") -``` - -We've found this API forces you to think about logging in a way that produces -much more useful logging messages. We've been in countless situations where just -a single added field to a log statement that was already there would've saved us -hours. The `WithFields` call is optional. - -In general, with Logrus using any of the `printf`-family functions should be -seen as a hint you should add a field, however, you can still use the -`printf`-family functions with Logrus. - -#### Default Fields - -Often it's helpful to have fields _always_ attached to log statements in an -application or parts of one. For example, you may want to always log the -`request_id` and `user_ip` in the context of a request. Instead of writing -`log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})` on -every line, you can create a `logrus.Entry` to pass around instead: - -```go -requestLogger := log.WithFields(log.Fields{"request_id": request_id, user_ip: user_ip}) -requestLogger.Info("something happened on that request") # will log request_id and user_ip -requestLogger.Warn("something not great happened") -``` - -#### Hooks - -You can add hooks for logging levels. For example to send errors to an exception -tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to -multiple places simultaneously, e.g. syslog. - -Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in -`init`: - -```go -import ( - log "github.com/Sirupsen/logrus" - "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake" - logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" - "log/syslog" -) - -func init() { - - // Use the Airbrake hook to report errors that have Error severity or above to - // an exception tracker. You can create custom hooks, see the Hooks section. - log.AddHook(airbrake.NewHook(123, "xyz", "production")) - - hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") - if err != nil { - log.Error("Unable to connect to local syslog daemon") - } else { - log.AddHook(hook) - } -} -``` -Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md). - -| Hook | Description | -| ----- | ----------- | -| [Airbrake "legacy"](https://github.com/gemnasium/logrus-airbrake-legacy-hook) | Send errors to an exception tracking service compatible with the Airbrake API V2. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. | -| [Airbrake](https://github.com/gemnasium/logrus-airbrake-hook) | Send errors to the Airbrake API V3. Uses the official [`gobrake`](https://github.com/airbrake/gobrake) behind the scenes. | -| [Amazon Kinesis](https://github.com/evalphobia/logrus_kinesis) | Hook for logging to [Amazon Kinesis](https://aws.amazon.com/kinesis/) | -| [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) | -| [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. | -| [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic | -| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch| -| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd | -| [Go-Slack](https://github.com/multiplay/go-slack) | Hook for logging to [Slack](https://slack.com) | -| [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) | -| [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. | -| [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger | -| [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb | -| [Influxus] (http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB] (http://influxdata.com/) | -| [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` | -| [KafkaLogrus](https://github.com/goibibo/KafkaLogrus) | Hook for logging to kafka | -| [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem | -| [Logentries](https://github.com/jcftang/logentriesrus) | Hook for logging to [Logentries](https://logentries.com/) | -| [Logentrus](https://github.com/puddingfactory/logentrus) | Hook for logging to [Logentries](https://logentries.com/) | -| [Logmatic.io](https://github.com/logmatic/logmatic-go) | Hook for logging to [Logmatic.io](http://logmatic.io/) | -| [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) | -| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) | -| [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail | -| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb | -| [NATS-Hook](https://github.com/rybit/nats_logrus_hook) | Hook for logging to [NATS](https://nats.io) | -| [Octokit](https://github.com/dorajistyle/logrus-octokit-hook) | Hook for logging to github via octokit | -| [Papertrail](https://github.com/polds/logrus-papertrail-hook) | Send errors to the [Papertrail](https://papertrailapp.com) hosted logging service via UDP. | -| [PostgreSQL](https://github.com/gemnasium/logrus-postgresql-hook) | Send logs to [PostgreSQL](http://postgresql.org) | -| [Pushover](https://github.com/toorop/logrus_pushover) | Send error via [Pushover](https://pushover.net) | -| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) | -| [Redis-Hook](https://github.com/rogierlommers/logrus-redis-hook) | Hook for logging to a ELK stack (through Redis) | -| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar | -| [Scribe](https://github.com/sagar8192/logrus-scribe-hook) | Hook for logging to [Scribe](https://github.com/facebookarchive/scribe)| -| [Sentry](https://github.com/evalphobia/logrus_sentry) | Send errors to the Sentry error logging and aggregation service. | -| [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. | -| [Stackdriver](https://github.com/knq/sdhook) | Hook for logging to [Google Stackdriver](https://cloud.google.com/logging/) | -| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)| -| [Syslog](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. | -| [TraceView](https://github.com/evalphobia/logrus_appneta) | Hook for logging to [AppNeta TraceView](https://www.appneta.com/products/traceview/) | -| [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) | -| [logz.io](https://github.com/ripcurld00d/logrus-logzio-hook) | Hook for logging to [logz.io](https://logz.io), a Log as a Service using Logstash | - -#### Level logging - -Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic. - -```go -log.Debug("Useful debugging information.") -log.Info("Something noteworthy happened!") -log.Warn("You should probably take a look at this.") -log.Error("Something failed but I'm not quitting.") -// Calls os.Exit(1) after logging -log.Fatal("Bye.") -// Calls panic() after logging -log.Panic("I'm bailing.") -``` - -You can set the logging level on a `Logger`, then it will only log entries with -that severity or anything above it: - -```go -// Will log anything that is info or above (warn, error, fatal, panic). Default. -log.SetLevel(log.InfoLevel) -``` - -It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose -environment if your application has that. - -#### Entries - -Besides the fields added with `WithField` or `WithFields` some fields are -automatically added to all logging events: - -1. `time`. The timestamp when the entry was created. -2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after - the `AddFields` call. E.g. `Failed to send event.` -3. `level`. The logging level. E.g. `info`. - -#### Environments - -Logrus has no notion of environment. - -If you wish for hooks and formatters to only be used in specific environments, -you should handle that yourself. For example, if your application has a global -variable `Environment`, which is a string representation of the environment you -could do: - -```go -import ( - log "github.com/Sirupsen/logrus" -) - -init() { - // do something here to set environment depending on an environment variable - // or command-line flag - if Environment == "production" { - log.SetFormatter(&log.JSONFormatter{}) - } else { - // The TextFormatter is default, you don't actually have to do this. - log.SetFormatter(&log.TextFormatter{}) - } -} -``` - -This configuration is how `logrus` was intended to be used, but JSON in -production is mostly only useful if you do log aggregation with tools like -Splunk or Logstash. - -#### Formatters - -The built-in logging formatters are: - -* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise - without colors. - * *Note:* to force colored output when there is no TTY, set the `ForceColors` - field to `true`. To force no colored output even if there is a TTY set the - `DisableColors` field to `true`. For Windows, see - [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable). - * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter). -* `logrus.JSONFormatter`. Logs fields as JSON. - * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter). - -Third party logging formatters: - -* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events. -* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout. -* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦. - -You can define your formatter by implementing the `Formatter` interface, -requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a -`Fields` type (`map[string]interface{}`) with all your fields as well as the -default ones (see Entries section above): - -```go -type MyJSONFormatter struct { -} - -log.SetFormatter(new(MyJSONFormatter)) - -func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) { - // Note this doesn't include Time, Level and Message which are available on - // the Entry. Consult `godoc` on information about those fields or read the - // source of the official loggers. - serialized, err := json.Marshal(entry.Data) - if err != nil { - return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) - } - return append(serialized, '\n'), nil -} -``` - -#### Logger as an `io.Writer` - -Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it. - -```go -w := logger.Writer() -defer w.Close() - -srv := http.Server{ - // create a stdlib log.Logger that writes to - // logrus.Logger. - ErrorLog: log.New(w, "", 0), -} -``` - -Each line written to that writer will be printed the usual way, using formatters -and hooks. The level for those entries is `info`. - -This means that we can override the standard library logger easily: - -```go -logger := logrus.New() -logger.Formatter = &logrus.JSONFormatter{} - -// Use logrus for standard log output -// Note that `log` here references stdlib's log -// Not logrus imported under the name `log`. -log.SetOutput(logger.Writer()) -``` - -#### Rotation - -Log rotation is not provided with Logrus. Log rotation should be done by an -external program (like `logrotate(8)`) that can compress and delete old log -entries. It should not be a feature of the application-level logger. - -#### Tools - -| Tool | Description | -| ---- | ----------- | -|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.| -|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper arround Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) | - -#### Testing - -Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides: - -* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook -* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any): - -```go -logger, hook := NewNullLogger() -logger.Error("Hello error") - -assert.Equal(1, len(hook.Entries)) -assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level) -assert.Equal("Hello error", hook.LastEntry().Message) - -hook.Reset() -assert.Nil(hook.LastEntry()) -``` - -#### Fatal handlers - -Logrus can register one or more functions that will be called when any `fatal` -level message is logged. The registered handlers will be executed before -logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need -to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted. - -``` -... -handler := func() { - // gracefully shutdown something... -} -logrus.RegisterExitHandler(handler) -... -``` - -#### Thread safety - -By default Logger is protected by mutex for concurrent writes, this mutex is invoked when calling hooks and writing logs. -If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking. - -Situation when locking is not needed includes: - -* You have no hooks registered, or hooks calling is already thread-safe. - -* Writing to logger.Out is already thread-safe, for example: - - 1) logger.Out is protected by locks. - - 2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing) - - (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/) +# Logrus :walrus: [![Build Status](https://travis-ci.org/Sirupsen/logrus.svg?branch=master)](https://travis-ci.org/Sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/Sirupsen/logrus?status.svg)](https://godoc.org/github.com/Sirupsen/logrus) + +**Seeing weird case-sensitive problems?** See [this +issue](https://github.com/sirupsen/logrus/issues/451#issuecomment-264332021). +This change has been reverted. I apologize for causing this. I greatly +underestimated the impact this would have. Logrus strives for stability and +backwards compatibility and failed to provide that. + +Logrus is a structured logger for Go (golang), completely API compatible with +the standard library logger. [Godoc][godoc]. **Please note the Logrus API is not +yet stable (pre 1.0). Logrus itself is completely stable and has been used in +many large deployments. The core API is unlikely to change much but please +version control your Logrus to make sure you aren't fetching latest `master` on +every build.** + +Nicely color-coded in development (when a TTY is attached, otherwise just +plain text): + +![Colored](http://i.imgur.com/PY7qMwd.png) + +With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash +or Splunk: + +```json +{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the +ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"} + +{"level":"warning","msg":"The group's number increased tremendously!", +"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"} + +{"animal":"walrus","level":"info","msg":"A giant walrus appears!", +"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"} + +{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.", +"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"} + +{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true, +"time":"2014-03-10 19:57:38.562543128 -0400 EDT"} +``` + +With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not +attached, the output is compatible with the +[logfmt](http://godoc.org/github.com/kr/logfmt) format: + +```text +time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8 +time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10 +time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true +time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4 +time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009 +time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true +exit status 1 +``` + +#### Example + +The simplest way to use Logrus is simply the package-level exported logger: + +```go +package main + +import ( + log "github.com/Sirupsen/logrus" +) + +func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + }).Info("A walrus appears") +} +``` + +Note that it's completely api-compatible with the stdlib logger, so you can +replace your `log` imports everywhere with `log "github.com/Sirupsen/logrus"` +and you'll now have the flexibility of Logrus. You can customize it all you +want: + +```go +package main + +import ( + "os" + log "github.com/Sirupsen/logrus" +) + +func init() { + // Log as JSON instead of the default ASCII formatter. + log.SetFormatter(&log.JSONFormatter{}) + + // Output to stdout instead of the default stderr + // Can be any io.Writer, see below for File example + log.SetOutput(os.Stdout) + + // Only log the warning severity or above. + log.SetLevel(log.WarnLevel) +} + +func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + "size": 10, + }).Info("A group of walrus emerges from the ocean") + + log.WithFields(log.Fields{ + "omg": true, + "number": 122, + }).Warn("The group's number increased tremendously!") + + log.WithFields(log.Fields{ + "omg": true, + "number": 100, + }).Fatal("The ice breaks!") + + // A common pattern is to re-use fields between logging statements by re-using + // the logrus.Entry returned from WithFields() + contextLogger := log.WithFields(log.Fields{ + "common": "this is a common field", + "other": "I also should be logged always", + }) + + contextLogger.Info("I'll be logged with common and other field") + contextLogger.Info("Me too") +} +``` + +For more advanced usage such as logging to multiple locations from the same +application, you can also create an instance of the `logrus` Logger: + +```go +package main + +import ( + "github.com/Sirupsen/logrus" +) + +// Create a new instance of the logger. You can have any number of instances. +var log = logrus.New() + +func main() { + // The API for setting attributes is a little different than the package level + // exported logger. See Godoc. + log.Out = os.Stdout + + // You could set this to any `io.Writer` such as a file + // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666) + // if err == nil { + // log.Out = file + // } else { + // log.Info("Failed to log to file, using default stderr") + // } + + log.WithFields(logrus.Fields{ + "animal": "walrus", + "size": 10, + }).Info("A group of walrus emerges from the ocean") +} +``` + +#### Fields + +Logrus encourages careful, structured logging though logging fields instead of +long, unparseable error messages. For example, instead of: `log.Fatalf("Failed +to send event %s to topic %s with key %d")`, you should log the much more +discoverable: + +```go +log.WithFields(log.Fields{ + "event": event, + "topic": topic, + "key": key, +}).Fatal("Failed to send event") +``` + +We've found this API forces you to think about logging in a way that produces +much more useful logging messages. We've been in countless situations where just +a single added field to a log statement that was already there would've saved us +hours. The `WithFields` call is optional. + +In general, with Logrus using any of the `printf`-family functions should be +seen as a hint you should add a field, however, you can still use the +`printf`-family functions with Logrus. + +#### Default Fields + +Often it's helpful to have fields _always_ attached to log statements in an +application or parts of one. For example, you may want to always log the +`request_id` and `user_ip` in the context of a request. Instead of writing +`log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})` on +every line, you can create a `logrus.Entry` to pass around instead: + +```go +requestLogger := log.WithFields(log.Fields{"request_id": request_id, user_ip: user_ip}) +requestLogger.Info("something happened on that request") # will log request_id and user_ip +requestLogger.Warn("something not great happened") +``` + +#### Hooks + +You can add hooks for logging levels. For example to send errors to an exception +tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to +multiple places simultaneously, e.g. syslog. + +Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in +`init`: + +```go +import ( + log "github.com/Sirupsen/logrus" + "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake" + logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" + "log/syslog" +) + +func init() { + + // Use the Airbrake hook to report errors that have Error severity or above to + // an exception tracker. You can create custom hooks, see the Hooks section. + log.AddHook(airbrake.NewHook(123, "xyz", "production")) + + hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + if err != nil { + log.Error("Unable to connect to local syslog daemon") + } else { + log.AddHook(hook) + } +} +``` +Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md). + +| Hook | Description | +| ----- | ----------- | +| [Airbrake "legacy"](https://github.com/gemnasium/logrus-airbrake-legacy-hook) | Send errors to an exception tracking service compatible with the Airbrake API V2. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. | +| [Airbrake](https://github.com/gemnasium/logrus-airbrake-hook) | Send errors to the Airbrake API V3. Uses the official [`gobrake`](https://github.com/airbrake/gobrake) behind the scenes. | +| [Amazon Kinesis](https://github.com/evalphobia/logrus_kinesis) | Hook for logging to [Amazon Kinesis](https://aws.amazon.com/kinesis/) | +| [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) | +| [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. | +| [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic | +| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch| +| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd | +| [Go-Slack](https://github.com/multiplay/go-slack) | Hook for logging to [Slack](https://slack.com) | +| [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) | +| [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. | +| [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger | +| [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb | +| [Influxus] (http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB] (http://influxdata.com/) | +| [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` | +| [KafkaLogrus](https://github.com/goibibo/KafkaLogrus) | Hook for logging to kafka | +| [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem | +| [Logentries](https://github.com/jcftang/logentriesrus) | Hook for logging to [Logentries](https://logentries.com/) | +| [Logentrus](https://github.com/puddingfactory/logentrus) | Hook for logging to [Logentries](https://logentries.com/) | +| [Logmatic.io](https://github.com/logmatic/logmatic-go) | Hook for logging to [Logmatic.io](http://logmatic.io/) | +| [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) | +| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) | +| [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail | +| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb | +| [NATS-Hook](https://github.com/rybit/nats_logrus_hook) | Hook for logging to [NATS](https://nats.io) | +| [Octokit](https://github.com/dorajistyle/logrus-octokit-hook) | Hook for logging to github via octokit | +| [Papertrail](https://github.com/polds/logrus-papertrail-hook) | Send errors to the [Papertrail](https://papertrailapp.com) hosted logging service via UDP. | +| [PostgreSQL](https://github.com/gemnasium/logrus-postgresql-hook) | Send logs to [PostgreSQL](http://postgresql.org) | +| [Pushover](https://github.com/toorop/logrus_pushover) | Send error via [Pushover](https://pushover.net) | +| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) | +| [Redis-Hook](https://github.com/rogierlommers/logrus-redis-hook) | Hook for logging to a ELK stack (through Redis) | +| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar | +| [Scribe](https://github.com/sagar8192/logrus-scribe-hook) | Hook for logging to [Scribe](https://github.com/facebookarchive/scribe)| +| [Sentry](https://github.com/evalphobia/logrus_sentry) | Send errors to the Sentry error logging and aggregation service. | +| [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. | +| [Stackdriver](https://github.com/knq/sdhook) | Hook for logging to [Google Stackdriver](https://cloud.google.com/logging/) | +| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)| +| [Syslog](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. | +| [TraceView](https://github.com/evalphobia/logrus_appneta) | Hook for logging to [AppNeta TraceView](https://www.appneta.com/products/traceview/) | +| [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) | +| [logz.io](https://github.com/ripcurld00d/logrus-logzio-hook) | Hook for logging to [logz.io](https://logz.io), a Log as a Service using Logstash | + +#### Level logging + +Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic. + +```go +log.Debug("Useful debugging information.") +log.Info("Something noteworthy happened!") +log.Warn("You should probably take a look at this.") +log.Error("Something failed but I'm not quitting.") +// Calls os.Exit(1) after logging +log.Fatal("Bye.") +// Calls panic() after logging +log.Panic("I'm bailing.") +``` + +You can set the logging level on a `Logger`, then it will only log entries with +that severity or anything above it: + +```go +// Will log anything that is info or above (warn, error, fatal, panic). Default. +log.SetLevel(log.InfoLevel) +``` + +It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose +environment if your application has that. + +#### Entries + +Besides the fields added with `WithField` or `WithFields` some fields are +automatically added to all logging events: + +1. `time`. The timestamp when the entry was created. +2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after + the `AddFields` call. E.g. `Failed to send event.` +3. `level`. The logging level. E.g. `info`. + +#### Environments + +Logrus has no notion of environment. + +If you wish for hooks and formatters to only be used in specific environments, +you should handle that yourself. For example, if your application has a global +variable `Environment`, which is a string representation of the environment you +could do: + +```go +import ( + log "github.com/Sirupsen/logrus" +) + +init() { + // do something here to set environment depending on an environment variable + // or command-line flag + if Environment == "production" { + log.SetFormatter(&log.JSONFormatter{}) + } else { + // The TextFormatter is default, you don't actually have to do this. + log.SetFormatter(&log.TextFormatter{}) + } +} +``` + +This configuration is how `logrus` was intended to be used, but JSON in +production is mostly only useful if you do log aggregation with tools like +Splunk or Logstash. + +#### Formatters + +The built-in logging formatters are: + +* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise + without colors. + * *Note:* to force colored output when there is no TTY, set the `ForceColors` + field to `true`. To force no colored output even if there is a TTY set the + `DisableColors` field to `true`. For Windows, see + [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable). + * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter). +* `logrus.JSONFormatter`. Logs fields as JSON. + * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter). + +Third party logging formatters: + +* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events. +* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout. +* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦. + +You can define your formatter by implementing the `Formatter` interface, +requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a +`Fields` type (`map[string]interface{}`) with all your fields as well as the +default ones (see Entries section above): + +```go +type MyJSONFormatter struct { +} + +log.SetFormatter(new(MyJSONFormatter)) + +func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) { + // Note this doesn't include Time, Level and Message which are available on + // the Entry. Consult `godoc` on information about those fields or read the + // source of the official loggers. + serialized, err := json.Marshal(entry.Data) + if err != nil { + return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) + } + return append(serialized, '\n'), nil +} +``` + +#### Logger as an `io.Writer` + +Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it. + +```go +w := logger.Writer() +defer w.Close() + +srv := http.Server{ + // create a stdlib log.Logger that writes to + // logrus.Logger. + ErrorLog: log.New(w, "", 0), +} +``` + +Each line written to that writer will be printed the usual way, using formatters +and hooks. The level for those entries is `info`. + +This means that we can override the standard library logger easily: + +```go +logger := logrus.New() +logger.Formatter = &logrus.JSONFormatter{} + +// Use logrus for standard log output +// Note that `log` here references stdlib's log +// Not logrus imported under the name `log`. +log.SetOutput(logger.Writer()) +``` + +#### Rotation + +Log rotation is not provided with Logrus. Log rotation should be done by an +external program (like `logrotate(8)`) that can compress and delete old log +entries. It should not be a feature of the application-level logger. + +#### Tools + +| Tool | Description | +| ---- | ----------- | +|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.| +|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper arround Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) | + +#### Testing + +Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides: + +* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook +* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any): + +```go +logger, hook := NewNullLogger() +logger.Error("Hello error") + +assert.Equal(1, len(hook.Entries)) +assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level) +assert.Equal("Hello error", hook.LastEntry().Message) + +hook.Reset() +assert.Nil(hook.LastEntry()) +``` + +#### Fatal handlers + +Logrus can register one or more functions that will be called when any `fatal` +level message is logged. The registered handlers will be executed before +logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need +to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted. + +``` +... +handler := func() { + // gracefully shutdown something... +} +logrus.RegisterExitHandler(handler) +... +``` + +#### Thread safety + +By default Logger is protected by mutex for concurrent writes, this mutex is invoked when calling hooks and writing logs. +If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking. + +Situation when locking is not needed includes: + +* You have no hooks registered, or hooks calling is already thread-safe. + +* Writing to logger.Out is already thread-safe, for example: + + 1) logger.Out is protected by locks. + + 2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing) + + (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/) diff --git a/vendor/github.com/Sirupsen/logrus/alt_exit.go b/vendor/github.com/Sirupsen/logrus/alt_exit.go index 8429217a2b..b4c9e84754 100644 --- a/vendor/github.com/Sirupsen/logrus/alt_exit.go +++ b/vendor/github.com/Sirupsen/logrus/alt_exit.go @@ -1,64 +1,64 @@ -package logrus - -// The following code was sourced and modified from the -// https://bitbucket.org/tebeka/atexit package governed by the following license: -// -// Copyright (c) 2012 Miki Tebeka . -// -// 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. - -import ( - "fmt" - "os" -) - -var handlers = []func(){} - -func runHandler(handler func()) { - defer func() { - if err := recover(); err != nil { - fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err) - } - }() - - handler() -} - -func runHandlers() { - for _, handler := range handlers { - runHandler(handler) - } -} - -// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code) -func Exit(code int) { - runHandlers() - os.Exit(code) -} - -// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke -// all handlers. The handlers will also be invoked when any Fatal log entry is -// made. -// -// This method is useful when a caller wishes to use logrus to log a fatal -// message but also needs to gracefully shutdown. An example usecase could be -// closing database connections, or sending a alert that the application is -// closing. -func RegisterExitHandler(handler func()) { - handlers = append(handlers, handler) -} +package logrus + +// The following code was sourced and modified from the +// https://bitbucket.org/tebeka/atexit package governed by the following license: +// +// Copyright (c) 2012 Miki Tebeka . +// +// 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. + +import ( + "fmt" + "os" +) + +var handlers = []func(){} + +func runHandler(handler func()) { + defer func() { + if err := recover(); err != nil { + fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err) + } + }() + + handler() +} + +func runHandlers() { + for _, handler := range handlers { + runHandler(handler) + } +} + +// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code) +func Exit(code int) { + runHandlers() + os.Exit(code) +} + +// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke +// all handlers. The handlers will also be invoked when any Fatal log entry is +// made. +// +// This method is useful when a caller wishes to use logrus to log a fatal +// message but also needs to gracefully shutdown. An example usecase could be +// closing database connections, or sending a alert that the application is +// closing. +func RegisterExitHandler(handler func()) { + handlers = append(handlers, handler) +} diff --git a/vendor/github.com/Sirupsen/logrus/alt_exit_test.go b/vendor/github.com/Sirupsen/logrus/alt_exit_test.go index f0dcc31cb4..022b778303 100644 --- a/vendor/github.com/Sirupsen/logrus/alt_exit_test.go +++ b/vendor/github.com/Sirupsen/logrus/alt_exit_test.go @@ -1,74 +1,74 @@ -package logrus - -import ( - "io/ioutil" - "os/exec" - "testing" - "time" -) - -func TestRegister(t *testing.T) { - current := len(handlers) - RegisterExitHandler(func() {}) - if len(handlers) != current+1 { - t.Fatalf("can't add handler") - } -} - -func TestHandler(t *testing.T) { - gofile := "/tmp/testprog.go" - if err := ioutil.WriteFile(gofile, testprog, 0666); err != nil { - t.Fatalf("can't create go file") - } - - outfile := "/tmp/testprog.out" - arg := time.Now().UTC().String() - err := exec.Command("go", "run", gofile, outfile, arg).Run() - if err == nil { - t.Fatalf("completed normally, should have failed") - } - - data, err := ioutil.ReadFile(outfile) - if err != nil { - t.Fatalf("can't read output file %s", outfile) - } - - if string(data) != arg { - t.Fatalf("bad data") - } -} - -var testprog = []byte(` -// Test program for atexit, gets output file and data as arguments and writes -// data to output file in atexit handler. -package main - -import ( - "github.com/Sirupsen/logrus" - "flag" - "fmt" - "io/ioutil" -) - -var outfile = "" -var data = "" - -func handler() { - ioutil.WriteFile(outfile, []byte(data), 0666) -} - -func badHandler() { - n := 0 - fmt.Println(1/n) -} - -func main() { - flag.Parse() - outfile = flag.Arg(0) - data = flag.Arg(1) - - logrus.RegisterExitHandler(handler) - logrus.RegisterExitHandler(badHandler) - logrus.Fatal("Bye bye") -} -`) +package logrus + +import ( + "io/ioutil" + "os/exec" + "testing" + "time" +) + +func TestRegister(t *testing.T) { + current := len(handlers) + RegisterExitHandler(func() {}) + if len(handlers) != current+1 { + t.Fatalf("can't add handler") + } +} + +func TestHandler(t *testing.T) { + gofile := "/tmp/testprog.go" + if err := ioutil.WriteFile(gofile, testprog, 0666); err != nil { + t.Fatalf("can't create go file") + } + + outfile := "/tmp/testprog.out" + arg := time.Now().UTC().String() + err := exec.Command("go", "run", gofile, outfile, arg).Run() + if err == nil { + t.Fatalf("completed normally, should have failed") + } + + data, err := ioutil.ReadFile(outfile) + if err != nil { + t.Fatalf("can't read output file %s", outfile) + } + + if string(data) != arg { + t.Fatalf("bad data") + } +} + +var testprog = []byte(` +// Test program for atexit, gets output file and data as arguments and writes +// data to output file in atexit handler. +package main + +import ( + "github.com/Sirupsen/logrus" + "flag" + "fmt" + "io/ioutil" +) + +var outfile = "" +var data = "" + +func handler() { + ioutil.WriteFile(outfile, []byte(data), 0666) +} + +func badHandler() { + n := 0 + fmt.Println(1/n) +} + +func main() { + flag.Parse() + outfile = flag.Arg(0) + data = flag.Arg(1) + + logrus.RegisterExitHandler(handler) + logrus.RegisterExitHandler(badHandler) + logrus.Fatal("Bye bye") +} +`) diff --git a/vendor/github.com/Sirupsen/logrus/doc.go b/vendor/github.com/Sirupsen/logrus/doc.go index fa0b4af6fb..dddd5f877b 100644 --- a/vendor/github.com/Sirupsen/logrus/doc.go +++ b/vendor/github.com/Sirupsen/logrus/doc.go @@ -1,26 +1,26 @@ -/* -Package logrus is a structured logger for Go, completely API compatible with the standard library logger. - - -The simplest way to use Logrus is simply the package-level exported logger: - - package main - - import ( - log "github.com/Sirupsen/logrus" - ) - - func main() { - log.WithFields(log.Fields{ - "animal": "walrus", - "number": 1, - "size": 10, - }).Info("A walrus appears") - } - -Output: - time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 - -For a full guide visit https://github.com/Sirupsen/logrus -*/ -package logrus +/* +Package logrus is a structured logger for Go, completely API compatible with the standard library logger. + + +The simplest way to use Logrus is simply the package-level exported logger: + + package main + + import ( + log "github.com/Sirupsen/logrus" + ) + + func main() { + log.WithFields(log.Fields{ + "animal": "walrus", + "number": 1, + "size": 10, + }).Info("A walrus appears") + } + +Output: + time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 + +For a full guide visit https://github.com/Sirupsen/logrus +*/ +package logrus diff --git a/vendor/github.com/Sirupsen/logrus/entry.go b/vendor/github.com/Sirupsen/logrus/entry.go index e92cdc1c29..4edbe7a2de 100644 --- a/vendor/github.com/Sirupsen/logrus/entry.go +++ b/vendor/github.com/Sirupsen/logrus/entry.go @@ -1,275 +1,275 @@ -package logrus - -import ( - "bytes" - "fmt" - "os" - "sync" - "time" -) - -var bufferPool *sync.Pool - -func init() { - bufferPool = &sync.Pool{ - New: func() interface{} { - return new(bytes.Buffer) - }, - } -} - -// Defines the key when adding errors using WithError. -var ErrorKey = "error" - -// An entry is the final or intermediate Logrus logging entry. It contains all -// the fields passed with WithField{,s}. It's finally logged when Debug, Info, -// Warn, Error, Fatal or Panic is called on it. These objects can be reused and -// passed around as much as you wish to avoid field duplication. -type Entry struct { - Logger *Logger - - // Contains all the fields set by the user. - Data Fields - - // Time at which the log entry was created - Time time.Time - - // Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic - Level Level - - // Message passed to Debug, Info, Warn, Error, Fatal or Panic - Message string - - // When formatter is called in entry.log(), an Buffer may be set to entry - Buffer *bytes.Buffer -} - -func NewEntry(logger *Logger) *Entry { - return &Entry{ - Logger: logger, - // Default is three fields, give a little extra room - Data: make(Fields, 5), - } -} - -// Returns the string representation from the reader and ultimately the -// formatter. -func (entry *Entry) String() (string, error) { - serialized, err := entry.Logger.Formatter.Format(entry) - if err != nil { - return "", err - } - str := string(serialized) - return str, nil -} - -// Add an error as single field (using the key defined in ErrorKey) to the Entry. -func (entry *Entry) WithError(err error) *Entry { - return entry.WithField(ErrorKey, err) -} - -// Add a single field to the Entry. -func (entry *Entry) WithField(key string, value interface{}) *Entry { - return entry.WithFields(Fields{key: value}) -} - -// Add a map of fields to the Entry. -func (entry *Entry) WithFields(fields Fields) *Entry { - data := make(Fields, len(entry.Data)+len(fields)) - for k, v := range entry.Data { - data[k] = v - } - for k, v := range fields { - data[k] = v - } - return &Entry{Logger: entry.Logger, Data: data} -} - -// This function is not declared with a pointer value because otherwise -// race conditions will occur when using multiple goroutines -func (entry Entry) log(level Level, msg string) { - var buffer *bytes.Buffer - entry.Time = time.Now() - entry.Level = level - entry.Message = msg - - if err := entry.Logger.Hooks.Fire(level, &entry); err != nil { - entry.Logger.mu.Lock() - fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err) - entry.Logger.mu.Unlock() - } - buffer = bufferPool.Get().(*bytes.Buffer) - buffer.Reset() - defer bufferPool.Put(buffer) - entry.Buffer = buffer - serialized, err := entry.Logger.Formatter.Format(&entry) - entry.Buffer = nil - if err != nil { - entry.Logger.mu.Lock() - fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err) - entry.Logger.mu.Unlock() - } else { - entry.Logger.mu.Lock() - _, err = entry.Logger.Out.Write(serialized) - if err != nil { - fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) - } - entry.Logger.mu.Unlock() - } - - // To avoid Entry#log() returning a value that only would make sense for - // panic() to use in Entry#Panic(), we avoid the allocation by checking - // directly here. - if level <= PanicLevel { - panic(&entry) - } -} - -func (entry *Entry) Debug(args ...interface{}) { - if entry.Logger.Level >= DebugLevel { - entry.log(DebugLevel, fmt.Sprint(args...)) - } -} - -func (entry *Entry) Print(args ...interface{}) { - entry.Info(args...) -} - -func (entry *Entry) Info(args ...interface{}) { - if entry.Logger.Level >= InfoLevel { - entry.log(InfoLevel, fmt.Sprint(args...)) - } -} - -func (entry *Entry) Warn(args ...interface{}) { - if entry.Logger.Level >= WarnLevel { - entry.log(WarnLevel, fmt.Sprint(args...)) - } -} - -func (entry *Entry) Warning(args ...interface{}) { - entry.Warn(args...) -} - -func (entry *Entry) Error(args ...interface{}) { - if entry.Logger.Level >= ErrorLevel { - entry.log(ErrorLevel, fmt.Sprint(args...)) - } -} - -func (entry *Entry) Fatal(args ...interface{}) { - if entry.Logger.Level >= FatalLevel { - entry.log(FatalLevel, fmt.Sprint(args...)) - } - Exit(1) -} - -func (entry *Entry) Panic(args ...interface{}) { - if entry.Logger.Level >= PanicLevel { - entry.log(PanicLevel, fmt.Sprint(args...)) - } - panic(fmt.Sprint(args...)) -} - -// Entry Printf family functions - -func (entry *Entry) Debugf(format string, args ...interface{}) { - if entry.Logger.Level >= DebugLevel { - entry.Debug(fmt.Sprintf(format, args...)) - } -} - -func (entry *Entry) Infof(format string, args ...interface{}) { - if entry.Logger.Level >= InfoLevel { - entry.Info(fmt.Sprintf(format, args...)) - } -} - -func (entry *Entry) Printf(format string, args ...interface{}) { - entry.Infof(format, args...) -} - -func (entry *Entry) Warnf(format string, args ...interface{}) { - if entry.Logger.Level >= WarnLevel { - entry.Warn(fmt.Sprintf(format, args...)) - } -} - -func (entry *Entry) Warningf(format string, args ...interface{}) { - entry.Warnf(format, args...) -} - -func (entry *Entry) Errorf(format string, args ...interface{}) { - if entry.Logger.Level >= ErrorLevel { - entry.Error(fmt.Sprintf(format, args...)) - } -} - -func (entry *Entry) Fatalf(format string, args ...interface{}) { - if entry.Logger.Level >= FatalLevel { - entry.Fatal(fmt.Sprintf(format, args...)) - } - Exit(1) -} - -func (entry *Entry) Panicf(format string, args ...interface{}) { - if entry.Logger.Level >= PanicLevel { - entry.Panic(fmt.Sprintf(format, args...)) - } -} - -// Entry Println family functions - -func (entry *Entry) Debugln(args ...interface{}) { - if entry.Logger.Level >= DebugLevel { - entry.Debug(entry.sprintlnn(args...)) - } -} - -func (entry *Entry) Infoln(args ...interface{}) { - if entry.Logger.Level >= InfoLevel { - entry.Info(entry.sprintlnn(args...)) - } -} - -func (entry *Entry) Println(args ...interface{}) { - entry.Infoln(args...) -} - -func (entry *Entry) Warnln(args ...interface{}) { - if entry.Logger.Level >= WarnLevel { - entry.Warn(entry.sprintlnn(args...)) - } -} - -func (entry *Entry) Warningln(args ...interface{}) { - entry.Warnln(args...) -} - -func (entry *Entry) Errorln(args ...interface{}) { - if entry.Logger.Level >= ErrorLevel { - entry.Error(entry.sprintlnn(args...)) - } -} - -func (entry *Entry) Fatalln(args ...interface{}) { - if entry.Logger.Level >= FatalLevel { - entry.Fatal(entry.sprintlnn(args...)) - } - Exit(1) -} - -func (entry *Entry) Panicln(args ...interface{}) { - if entry.Logger.Level >= PanicLevel { - entry.Panic(entry.sprintlnn(args...)) - } -} - -// Sprintlnn => Sprint no newline. This is to get the behavior of how -// fmt.Sprintln where spaces are always added between operands, regardless of -// their type. Instead of vendoring the Sprintln implementation to spare a -// string allocation, we do the simplest thing. -func (entry *Entry) sprintlnn(args ...interface{}) string { - msg := fmt.Sprintln(args...) - return msg[:len(msg)-1] -} +package logrus + +import ( + "bytes" + "fmt" + "os" + "sync" + "time" +) + +var bufferPool *sync.Pool + +func init() { + bufferPool = &sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, + } +} + +// Defines the key when adding errors using WithError. +var ErrorKey = "error" + +// An entry is the final or intermediate Logrus logging entry. It contains all +// the fields passed with WithField{,s}. It's finally logged when Debug, Info, +// Warn, Error, Fatal or Panic is called on it. These objects can be reused and +// passed around as much as you wish to avoid field duplication. +type Entry struct { + Logger *Logger + + // Contains all the fields set by the user. + Data Fields + + // Time at which the log entry was created + Time time.Time + + // Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic + Level Level + + // Message passed to Debug, Info, Warn, Error, Fatal or Panic + Message string + + // When formatter is called in entry.log(), an Buffer may be set to entry + Buffer *bytes.Buffer +} + +func NewEntry(logger *Logger) *Entry { + return &Entry{ + Logger: logger, + // Default is three fields, give a little extra room + Data: make(Fields, 5), + } +} + +// Returns the string representation from the reader and ultimately the +// formatter. +func (entry *Entry) String() (string, error) { + serialized, err := entry.Logger.Formatter.Format(entry) + if err != nil { + return "", err + } + str := string(serialized) + return str, nil +} + +// Add an error as single field (using the key defined in ErrorKey) to the Entry. +func (entry *Entry) WithError(err error) *Entry { + return entry.WithField(ErrorKey, err) +} + +// Add a single field to the Entry. +func (entry *Entry) WithField(key string, value interface{}) *Entry { + return entry.WithFields(Fields{key: value}) +} + +// Add a map of fields to the Entry. +func (entry *Entry) WithFields(fields Fields) *Entry { + data := make(Fields, len(entry.Data)+len(fields)) + for k, v := range entry.Data { + data[k] = v + } + for k, v := range fields { + data[k] = v + } + return &Entry{Logger: entry.Logger, Data: data} +} + +// This function is not declared with a pointer value because otherwise +// race conditions will occur when using multiple goroutines +func (entry Entry) log(level Level, msg string) { + var buffer *bytes.Buffer + entry.Time = time.Now() + entry.Level = level + entry.Message = msg + + if err := entry.Logger.Hooks.Fire(level, &entry); err != nil { + entry.Logger.mu.Lock() + fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err) + entry.Logger.mu.Unlock() + } + buffer = bufferPool.Get().(*bytes.Buffer) + buffer.Reset() + defer bufferPool.Put(buffer) + entry.Buffer = buffer + serialized, err := entry.Logger.Formatter.Format(&entry) + entry.Buffer = nil + if err != nil { + entry.Logger.mu.Lock() + fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err) + entry.Logger.mu.Unlock() + } else { + entry.Logger.mu.Lock() + _, err = entry.Logger.Out.Write(serialized) + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) + } + entry.Logger.mu.Unlock() + } + + // To avoid Entry#log() returning a value that only would make sense for + // panic() to use in Entry#Panic(), we avoid the allocation by checking + // directly here. + if level <= PanicLevel { + panic(&entry) + } +} + +func (entry *Entry) Debug(args ...interface{}) { + if entry.Logger.Level >= DebugLevel { + entry.log(DebugLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Print(args ...interface{}) { + entry.Info(args...) +} + +func (entry *Entry) Info(args ...interface{}) { + if entry.Logger.Level >= InfoLevel { + entry.log(InfoLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Warn(args ...interface{}) { + if entry.Logger.Level >= WarnLevel { + entry.log(WarnLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Warning(args ...interface{}) { + entry.Warn(args...) +} + +func (entry *Entry) Error(args ...interface{}) { + if entry.Logger.Level >= ErrorLevel { + entry.log(ErrorLevel, fmt.Sprint(args...)) + } +} + +func (entry *Entry) Fatal(args ...interface{}) { + if entry.Logger.Level >= FatalLevel { + entry.log(FatalLevel, fmt.Sprint(args...)) + } + Exit(1) +} + +func (entry *Entry) Panic(args ...interface{}) { + if entry.Logger.Level >= PanicLevel { + entry.log(PanicLevel, fmt.Sprint(args...)) + } + panic(fmt.Sprint(args...)) +} + +// Entry Printf family functions + +func (entry *Entry) Debugf(format string, args ...interface{}) { + if entry.Logger.Level >= DebugLevel { + entry.Debug(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Infof(format string, args ...interface{}) { + if entry.Logger.Level >= InfoLevel { + entry.Info(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Printf(format string, args ...interface{}) { + entry.Infof(format, args...) +} + +func (entry *Entry) Warnf(format string, args ...interface{}) { + if entry.Logger.Level >= WarnLevel { + entry.Warn(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Warningf(format string, args ...interface{}) { + entry.Warnf(format, args...) +} + +func (entry *Entry) Errorf(format string, args ...interface{}) { + if entry.Logger.Level >= ErrorLevel { + entry.Error(fmt.Sprintf(format, args...)) + } +} + +func (entry *Entry) Fatalf(format string, args ...interface{}) { + if entry.Logger.Level >= FatalLevel { + entry.Fatal(fmt.Sprintf(format, args...)) + } + Exit(1) +} + +func (entry *Entry) Panicf(format string, args ...interface{}) { + if entry.Logger.Level >= PanicLevel { + entry.Panic(fmt.Sprintf(format, args...)) + } +} + +// Entry Println family functions + +func (entry *Entry) Debugln(args ...interface{}) { + if entry.Logger.Level >= DebugLevel { + entry.Debug(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Infoln(args ...interface{}) { + if entry.Logger.Level >= InfoLevel { + entry.Info(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Println(args ...interface{}) { + entry.Infoln(args...) +} + +func (entry *Entry) Warnln(args ...interface{}) { + if entry.Logger.Level >= WarnLevel { + entry.Warn(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Warningln(args ...interface{}) { + entry.Warnln(args...) +} + +func (entry *Entry) Errorln(args ...interface{}) { + if entry.Logger.Level >= ErrorLevel { + entry.Error(entry.sprintlnn(args...)) + } +} + +func (entry *Entry) Fatalln(args ...interface{}) { + if entry.Logger.Level >= FatalLevel { + entry.Fatal(entry.sprintlnn(args...)) + } + Exit(1) +} + +func (entry *Entry) Panicln(args ...interface{}) { + if entry.Logger.Level >= PanicLevel { + entry.Panic(entry.sprintlnn(args...)) + } +} + +// Sprintlnn => Sprint no newline. This is to get the behavior of how +// fmt.Sprintln where spaces are always added between operands, regardless of +// their type. Instead of vendoring the Sprintln implementation to spare a +// string allocation, we do the simplest thing. +func (entry *Entry) sprintlnn(args ...interface{}) string { + msg := fmt.Sprintln(args...) + return msg[:len(msg)-1] +} diff --git a/vendor/github.com/Sirupsen/logrus/entry_test.go b/vendor/github.com/Sirupsen/logrus/entry_test.go index b20dc0895e..99c3b41d5f 100644 --- a/vendor/github.com/Sirupsen/logrus/entry_test.go +++ b/vendor/github.com/Sirupsen/logrus/entry_test.go @@ -1,77 +1,77 @@ -package logrus - -import ( - "bytes" - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestEntryWithError(t *testing.T) { - - assert := assert.New(t) - - defer func() { - ErrorKey = "error" - }() - - err := fmt.Errorf("kaboom at layer %d", 4711) - - assert.Equal(err, WithError(err).Data["error"]) - - logger := New() - logger.Out = &bytes.Buffer{} - entry := NewEntry(logger) - - assert.Equal(err, entry.WithError(err).Data["error"]) - - ErrorKey = "err" - - assert.Equal(err, entry.WithError(err).Data["err"]) - -} - -func TestEntryPanicln(t *testing.T) { - errBoom := fmt.Errorf("boom time") - - defer func() { - p := recover() - assert.NotNil(t, p) - - switch pVal := p.(type) { - case *Entry: - assert.Equal(t, "kaboom", pVal.Message) - assert.Equal(t, errBoom, pVal.Data["err"]) - default: - t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) - } - }() - - logger := New() - logger.Out = &bytes.Buffer{} - entry := NewEntry(logger) - entry.WithField("err", errBoom).Panicln("kaboom") -} - -func TestEntryPanicf(t *testing.T) { - errBoom := fmt.Errorf("boom again") - - defer func() { - p := recover() - assert.NotNil(t, p) - - switch pVal := p.(type) { - case *Entry: - assert.Equal(t, "kaboom true", pVal.Message) - assert.Equal(t, errBoom, pVal.Data["err"]) - default: - t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) - } - }() - - logger := New() - logger.Out = &bytes.Buffer{} - entry := NewEntry(logger) - entry.WithField("err", errBoom).Panicf("kaboom %v", true) -} +package logrus + +import ( + "bytes" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEntryWithError(t *testing.T) { + + assert := assert.New(t) + + defer func() { + ErrorKey = "error" + }() + + err := fmt.Errorf("kaboom at layer %d", 4711) + + assert.Equal(err, WithError(err).Data["error"]) + + logger := New() + logger.Out = &bytes.Buffer{} + entry := NewEntry(logger) + + assert.Equal(err, entry.WithError(err).Data["error"]) + + ErrorKey = "err" + + assert.Equal(err, entry.WithError(err).Data["err"]) + +} + +func TestEntryPanicln(t *testing.T) { + errBoom := fmt.Errorf("boom time") + + defer func() { + p := recover() + assert.NotNil(t, p) + + switch pVal := p.(type) { + case *Entry: + assert.Equal(t, "kaboom", pVal.Message) + assert.Equal(t, errBoom, pVal.Data["err"]) + default: + t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) + } + }() + + logger := New() + logger.Out = &bytes.Buffer{} + entry := NewEntry(logger) + entry.WithField("err", errBoom).Panicln("kaboom") +} + +func TestEntryPanicf(t *testing.T) { + errBoom := fmt.Errorf("boom again") + + defer func() { + p := recover() + assert.NotNil(t, p) + + switch pVal := p.(type) { + case *Entry: + assert.Equal(t, "kaboom true", pVal.Message) + assert.Equal(t, errBoom, pVal.Data["err"]) + default: + t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal) + } + }() + + logger := New() + logger.Out = &bytes.Buffer{} + entry := NewEntry(logger) + entry.WithField("err", errBoom).Panicf("kaboom %v", true) +} diff --git a/vendor/github.com/Sirupsen/logrus/examples/basic/basic.go b/vendor/github.com/Sirupsen/logrus/examples/basic/basic.go index d93f594db7..ad703fcb6e 100644 --- a/vendor/github.com/Sirupsen/logrus/examples/basic/basic.go +++ b/vendor/github.com/Sirupsen/logrus/examples/basic/basic.go @@ -1,59 +1,59 @@ -package main - -import ( - "github.com/Sirupsen/logrus" - // "os" -) - -var log = logrus.New() - -func init() { - log.Formatter = new(logrus.JSONFormatter) - log.Formatter = new(logrus.TextFormatter) // default - - // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666) - // if err == nil { - // log.Out = file - // } else { - // log.Info("Failed to log to file, using default stderr") - // } - - log.Level = logrus.DebugLevel -} - -func main() { - defer func() { - err := recover() - if err != nil { - log.WithFields(logrus.Fields{ - "omg": true, - "err": err, - "number": 100, - }).Fatal("The ice breaks!") - } - }() - - log.WithFields(logrus.Fields{ - "animal": "walrus", - "number": 8, - }).Debug("Started observing beach") - - log.WithFields(logrus.Fields{ - "animal": "walrus", - "size": 10, - }).Info("A group of walrus emerges from the ocean") - - log.WithFields(logrus.Fields{ - "omg": true, - "number": 122, - }).Warn("The group's number increased tremendously!") - - log.WithFields(logrus.Fields{ - "temperature": -4, - }).Debug("Temperature changes") - - log.WithFields(logrus.Fields{ - "animal": "orca", - "size": 9009, - }).Panic("It's over 9000!") -} +package main + +import ( + "github.com/Sirupsen/logrus" + // "os" +) + +var log = logrus.New() + +func init() { + log.Formatter = new(logrus.JSONFormatter) + log.Formatter = new(logrus.TextFormatter) // default + + // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666) + // if err == nil { + // log.Out = file + // } else { + // log.Info("Failed to log to file, using default stderr") + // } + + log.Level = logrus.DebugLevel +} + +func main() { + defer func() { + err := recover() + if err != nil { + log.WithFields(logrus.Fields{ + "omg": true, + "err": err, + "number": 100, + }).Fatal("The ice breaks!") + } + }() + + log.WithFields(logrus.Fields{ + "animal": "walrus", + "number": 8, + }).Debug("Started observing beach") + + log.WithFields(logrus.Fields{ + "animal": "walrus", + "size": 10, + }).Info("A group of walrus emerges from the ocean") + + log.WithFields(logrus.Fields{ + "omg": true, + "number": 122, + }).Warn("The group's number increased tremendously!") + + log.WithFields(logrus.Fields{ + "temperature": -4, + }).Debug("Temperature changes") + + log.WithFields(logrus.Fields{ + "animal": "orca", + "size": 9009, + }).Panic("It's over 9000!") +} diff --git a/vendor/github.com/Sirupsen/logrus/examples/hook/hook.go b/vendor/github.com/Sirupsen/logrus/examples/hook/hook.go index 533fb6fe5a..3187f6d3e1 100644 --- a/vendor/github.com/Sirupsen/logrus/examples/hook/hook.go +++ b/vendor/github.com/Sirupsen/logrus/examples/hook/hook.go @@ -1,30 +1,30 @@ -package main - -import ( - "github.com/Sirupsen/logrus" - "gopkg.in/gemnasium/logrus-airbrake-hook.v2" -) - -var log = logrus.New() - -func init() { - log.Formatter = new(logrus.TextFormatter) // default - log.Hooks.Add(airbrake.NewHook(123, "xyz", "development")) -} - -func main() { - log.WithFields(logrus.Fields{ - "animal": "walrus", - "size": 10, - }).Info("A group of walrus emerges from the ocean") - - log.WithFields(logrus.Fields{ - "omg": true, - "number": 122, - }).Warn("The group's number increased tremendously!") - - log.WithFields(logrus.Fields{ - "omg": true, - "number": 100, - }).Fatal("The ice breaks!") -} +package main + +import ( + "github.com/Sirupsen/logrus" + "gopkg.in/gemnasium/logrus-airbrake-hook.v2" +) + +var log = logrus.New() + +func init() { + log.Formatter = new(logrus.TextFormatter) // default + log.Hooks.Add(airbrake.NewHook(123, "xyz", "development")) +} + +func main() { + log.WithFields(logrus.Fields{ + "animal": "walrus", + "size": 10, + }).Info("A group of walrus emerges from the ocean") + + log.WithFields(logrus.Fields{ + "omg": true, + "number": 122, + }).Warn("The group's number increased tremendously!") + + log.WithFields(logrus.Fields{ + "omg": true, + "number": 100, + }).Fatal("The ice breaks!") +} diff --git a/vendor/github.com/Sirupsen/logrus/exported.go b/vendor/github.com/Sirupsen/logrus/exported.go index 2f7fae912e..9a0120ac1d 100644 --- a/vendor/github.com/Sirupsen/logrus/exported.go +++ b/vendor/github.com/Sirupsen/logrus/exported.go @@ -1,193 +1,193 @@ -package logrus - -import ( - "io" -) - -var ( - // std is the name of the standard logger in stdlib `log` - std = New() -) - -func StandardLogger() *Logger { - return std -} - -// SetOutput sets the standard logger output. -func SetOutput(out io.Writer) { - std.mu.Lock() - defer std.mu.Unlock() - std.Out = out -} - -// SetFormatter sets the standard logger formatter. -func SetFormatter(formatter Formatter) { - std.mu.Lock() - defer std.mu.Unlock() - std.Formatter = formatter -} - -// SetLevel sets the standard logger level. -func SetLevel(level Level) { - std.mu.Lock() - defer std.mu.Unlock() - std.Level = level -} - -// GetLevel returns the standard logger level. -func GetLevel() Level { - std.mu.Lock() - defer std.mu.Unlock() - return std.Level -} - -// AddHook adds a hook to the standard logger hooks. -func AddHook(hook Hook) { - std.mu.Lock() - defer std.mu.Unlock() - std.Hooks.Add(hook) -} - -// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key. -func WithError(err error) *Entry { - return std.WithField(ErrorKey, err) -} - -// WithField creates an entry from the standard logger and adds a field to -// it. If you want multiple fields, use `WithFields`. -// -// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal -// or Panic on the Entry it returns. -func WithField(key string, value interface{}) *Entry { - return std.WithField(key, value) -} - -// WithFields creates an entry from the standard logger and adds multiple -// fields to it. This is simply a helper for `WithField`, invoking it -// once for each field. -// -// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal -// or Panic on the Entry it returns. -func WithFields(fields Fields) *Entry { - return std.WithFields(fields) -} - -// Debug logs a message at level Debug on the standard logger. -func Debug(args ...interface{}) { - std.Debug(args...) -} - -// Print logs a message at level Info on the standard logger. -func Print(args ...interface{}) { - std.Print(args...) -} - -// Info logs a message at level Info on the standard logger. -func Info(args ...interface{}) { - std.Info(args...) -} - -// Warn logs a message at level Warn on the standard logger. -func Warn(args ...interface{}) { - std.Warn(args...) -} - -// Warning logs a message at level Warn on the standard logger. -func Warning(args ...interface{}) { - std.Warning(args...) -} - -// Error logs a message at level Error on the standard logger. -func Error(args ...interface{}) { - std.Error(args...) -} - -// Panic logs a message at level Panic on the standard logger. -func Panic(args ...interface{}) { - std.Panic(args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func Fatal(args ...interface{}) { - std.Fatal(args...) -} - -// Debugf logs a message at level Debug on the standard logger. -func Debugf(format string, args ...interface{}) { - std.Debugf(format, args...) -} - -// Printf logs a message at level Info on the standard logger. -func Printf(format string, args ...interface{}) { - std.Printf(format, args...) -} - -// Infof logs a message at level Info on the standard logger. -func Infof(format string, args ...interface{}) { - std.Infof(format, args...) -} - -// Warnf logs a message at level Warn on the standard logger. -func Warnf(format string, args ...interface{}) { - std.Warnf(format, args...) -} - -// Warningf logs a message at level Warn on the standard logger. -func Warningf(format string, args ...interface{}) { - std.Warningf(format, args...) -} - -// Errorf logs a message at level Error on the standard logger. -func Errorf(format string, args ...interface{}) { - std.Errorf(format, args...) -} - -// Panicf logs a message at level Panic on the standard logger. -func Panicf(format string, args ...interface{}) { - std.Panicf(format, args...) -} - -// Fatalf logs a message at level Fatal on the standard logger. -func Fatalf(format string, args ...interface{}) { - std.Fatalf(format, args...) -} - -// Debugln logs a message at level Debug on the standard logger. -func Debugln(args ...interface{}) { - std.Debugln(args...) -} - -// Println logs a message at level Info on the standard logger. -func Println(args ...interface{}) { - std.Println(args...) -} - -// Infoln logs a message at level Info on the standard logger. -func Infoln(args ...interface{}) { - std.Infoln(args...) -} - -// Warnln logs a message at level Warn on the standard logger. -func Warnln(args ...interface{}) { - std.Warnln(args...) -} - -// Warningln logs a message at level Warn on the standard logger. -func Warningln(args ...interface{}) { - std.Warningln(args...) -} - -// Errorln logs a message at level Error on the standard logger. -func Errorln(args ...interface{}) { - std.Errorln(args...) -} - -// Panicln logs a message at level Panic on the standard logger. -func Panicln(args ...interface{}) { - std.Panicln(args...) -} - -// Fatalln logs a message at level Fatal on the standard logger. -func Fatalln(args ...interface{}) { - std.Fatalln(args...) -} +package logrus + +import ( + "io" +) + +var ( + // std is the name of the standard logger in stdlib `log` + std = New() +) + +func StandardLogger() *Logger { + return std +} + +// SetOutput sets the standard logger output. +func SetOutput(out io.Writer) { + std.mu.Lock() + defer std.mu.Unlock() + std.Out = out +} + +// SetFormatter sets the standard logger formatter. +func SetFormatter(formatter Formatter) { + std.mu.Lock() + defer std.mu.Unlock() + std.Formatter = formatter +} + +// SetLevel sets the standard logger level. +func SetLevel(level Level) { + std.mu.Lock() + defer std.mu.Unlock() + std.Level = level +} + +// GetLevel returns the standard logger level. +func GetLevel() Level { + std.mu.Lock() + defer std.mu.Unlock() + return std.Level +} + +// AddHook adds a hook to the standard logger hooks. +func AddHook(hook Hook) { + std.mu.Lock() + defer std.mu.Unlock() + std.Hooks.Add(hook) +} + +// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key. +func WithError(err error) *Entry { + return std.WithField(ErrorKey, err) +} + +// WithField creates an entry from the standard logger and adds a field to +// it. If you want multiple fields, use `WithFields`. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithField(key string, value interface{}) *Entry { + return std.WithField(key, value) +} + +// WithFields creates an entry from the standard logger and adds multiple +// fields to it. This is simply a helper for `WithField`, invoking it +// once for each field. +// +// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal +// or Panic on the Entry it returns. +func WithFields(fields Fields) *Entry { + return std.WithFields(fields) +} + +// Debug logs a message at level Debug on the standard logger. +func Debug(args ...interface{}) { + std.Debug(args...) +} + +// Print logs a message at level Info on the standard logger. +func Print(args ...interface{}) { + std.Print(args...) +} + +// Info logs a message at level Info on the standard logger. +func Info(args ...interface{}) { + std.Info(args...) +} + +// Warn logs a message at level Warn on the standard logger. +func Warn(args ...interface{}) { + std.Warn(args...) +} + +// Warning logs a message at level Warn on the standard logger. +func Warning(args ...interface{}) { + std.Warning(args...) +} + +// Error logs a message at level Error on the standard logger. +func Error(args ...interface{}) { + std.Error(args...) +} + +// Panic logs a message at level Panic on the standard logger. +func Panic(args ...interface{}) { + std.Panic(args...) +} + +// Fatal logs a message at level Fatal on the standard logger. +func Fatal(args ...interface{}) { + std.Fatal(args...) +} + +// Debugf logs a message at level Debug on the standard logger. +func Debugf(format string, args ...interface{}) { + std.Debugf(format, args...) +} + +// Printf logs a message at level Info on the standard logger. +func Printf(format string, args ...interface{}) { + std.Printf(format, args...) +} + +// Infof logs a message at level Info on the standard logger. +func Infof(format string, args ...interface{}) { + std.Infof(format, args...) +} + +// Warnf logs a message at level Warn on the standard logger. +func Warnf(format string, args ...interface{}) { + std.Warnf(format, args...) +} + +// Warningf logs a message at level Warn on the standard logger. +func Warningf(format string, args ...interface{}) { + std.Warningf(format, args...) +} + +// Errorf logs a message at level Error on the standard logger. +func Errorf(format string, args ...interface{}) { + std.Errorf(format, args...) +} + +// Panicf logs a message at level Panic on the standard logger. +func Panicf(format string, args ...interface{}) { + std.Panicf(format, args...) +} + +// Fatalf logs a message at level Fatal on the standard logger. +func Fatalf(format string, args ...interface{}) { + std.Fatalf(format, args...) +} + +// Debugln logs a message at level Debug on the standard logger. +func Debugln(args ...interface{}) { + std.Debugln(args...) +} + +// Println logs a message at level Info on the standard logger. +func Println(args ...interface{}) { + std.Println(args...) +} + +// Infoln logs a message at level Info on the standard logger. +func Infoln(args ...interface{}) { + std.Infoln(args...) +} + +// Warnln logs a message at level Warn on the standard logger. +func Warnln(args ...interface{}) { + std.Warnln(args...) +} + +// Warningln logs a message at level Warn on the standard logger. +func Warningln(args ...interface{}) { + std.Warningln(args...) +} + +// Errorln logs a message at level Error on the standard logger. +func Errorln(args ...interface{}) { + std.Errorln(args...) +} + +// Panicln logs a message at level Panic on the standard logger. +func Panicln(args ...interface{}) { + std.Panicln(args...) +} + +// Fatalln logs a message at level Fatal on the standard logger. +func Fatalln(args ...interface{}) { + std.Fatalln(args...) +} diff --git a/vendor/github.com/Sirupsen/logrus/formatter.go b/vendor/github.com/Sirupsen/logrus/formatter.go index c74c91781f..b5fbe934d1 100644 --- a/vendor/github.com/Sirupsen/logrus/formatter.go +++ b/vendor/github.com/Sirupsen/logrus/formatter.go @@ -1,45 +1,45 @@ -package logrus - -import "time" - -const DefaultTimestampFormat = time.RFC3339 - -// The Formatter interface is used to implement a custom Formatter. It takes an -// `Entry`. It exposes all the fields, including the default ones: -// -// * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. -// * `entry.Data["time"]`. The timestamp. -// * `entry.Data["level"]. The level the entry was logged at. -// -// Any additional fields added with `WithField` or `WithFields` are also in -// `entry.Data`. Format is expected to return an array of bytes which are then -// logged to `logger.Out`. -type Formatter interface { - Format(*Entry) ([]byte, error) -} - -// This is to not silently overwrite `time`, `msg` and `level` fields when -// dumping it. If this code wasn't there doing: -// -// logrus.WithField("level", 1).Info("hello") -// -// Would just silently drop the user provided level. Instead with this code -// it'll logged as: -// -// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} -// -// It's not exported because it's still using Data in an opinionated way. It's to -// avoid code duplication between the two default formatters. -func prefixFieldClashes(data Fields) { - if t, ok := data["time"]; ok { - data["fields.time"] = t - } - - if m, ok := data["msg"]; ok { - data["fields.msg"] = m - } - - if l, ok := data["level"]; ok { - data["fields.level"] = l - } -} +package logrus + +import "time" + +const DefaultTimestampFormat = time.RFC3339 + +// The Formatter interface is used to implement a custom Formatter. It takes an +// `Entry`. It exposes all the fields, including the default ones: +// +// * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. +// * `entry.Data["time"]`. The timestamp. +// * `entry.Data["level"]. The level the entry was logged at. +// +// Any additional fields added with `WithField` or `WithFields` are also in +// `entry.Data`. Format is expected to return an array of bytes which are then +// logged to `logger.Out`. +type Formatter interface { + Format(*Entry) ([]byte, error) +} + +// This is to not silently overwrite `time`, `msg` and `level` fields when +// dumping it. If this code wasn't there doing: +// +// logrus.WithField("level", 1).Info("hello") +// +// Would just silently drop the user provided level. Instead with this code +// it'll logged as: +// +// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} +// +// It's not exported because it's still using Data in an opinionated way. It's to +// avoid code duplication between the two default formatters. +func prefixFieldClashes(data Fields) { + if t, ok := data["time"]; ok { + data["fields.time"] = t + } + + if m, ok := data["msg"]; ok { + data["fields.msg"] = m + } + + if l, ok := data["level"]; ok { + data["fields.level"] = l + } +} diff --git a/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go b/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go index a5868dc469..d9481589f5 100644 --- a/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go +++ b/vendor/github.com/Sirupsen/logrus/formatter_bench_test.go @@ -1,101 +1,101 @@ -package logrus - -import ( - "fmt" - "testing" - "time" -) - -// smallFields is a small size data set for benchmarking -var smallFields = Fields{ - "foo": "bar", - "baz": "qux", - "one": "two", - "three": "four", -} - -// largeFields is a large size data set for benchmarking -var largeFields = Fields{ - "foo": "bar", - "baz": "qux", - "one": "two", - "three": "four", - "five": "six", - "seven": "eight", - "nine": "ten", - "eleven": "twelve", - "thirteen": "fourteen", - "fifteen": "sixteen", - "seventeen": "eighteen", - "nineteen": "twenty", - "a": "b", - "c": "d", - "e": "f", - "g": "h", - "i": "j", - "k": "l", - "m": "n", - "o": "p", - "q": "r", - "s": "t", - "u": "v", - "w": "x", - "y": "z", - "this": "will", - "make": "thirty", - "entries": "yeah", -} - -var errorFields = Fields{ - "foo": fmt.Errorf("bar"), - "baz": fmt.Errorf("qux"), -} - -func BenchmarkErrorTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{DisableColors: true}, errorFields) -} - -func BenchmarkSmallTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields) -} - -func BenchmarkLargeTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{DisableColors: true}, largeFields) -} - -func BenchmarkSmallColoredTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{ForceColors: true}, smallFields) -} - -func BenchmarkLargeColoredTextFormatter(b *testing.B) { - doBenchmark(b, &TextFormatter{ForceColors: true}, largeFields) -} - -func BenchmarkSmallJSONFormatter(b *testing.B) { - doBenchmark(b, &JSONFormatter{}, smallFields) -} - -func BenchmarkLargeJSONFormatter(b *testing.B) { - doBenchmark(b, &JSONFormatter{}, largeFields) -} - -func doBenchmark(b *testing.B, formatter Formatter, fields Fields) { - logger := New() - - entry := &Entry{ - Time: time.Time{}, - Level: InfoLevel, - Message: "message", - Data: fields, - Logger: logger, - } - var d []byte - var err error - for i := 0; i < b.N; i++ { - d, err = formatter.Format(entry) - if err != nil { - b.Fatal(err) - } - b.SetBytes(int64(len(d))) - } -} +package logrus + +import ( + "fmt" + "testing" + "time" +) + +// smallFields is a small size data set for benchmarking +var smallFields = Fields{ + "foo": "bar", + "baz": "qux", + "one": "two", + "three": "four", +} + +// largeFields is a large size data set for benchmarking +var largeFields = Fields{ + "foo": "bar", + "baz": "qux", + "one": "two", + "three": "four", + "five": "six", + "seven": "eight", + "nine": "ten", + "eleven": "twelve", + "thirteen": "fourteen", + "fifteen": "sixteen", + "seventeen": "eighteen", + "nineteen": "twenty", + "a": "b", + "c": "d", + "e": "f", + "g": "h", + "i": "j", + "k": "l", + "m": "n", + "o": "p", + "q": "r", + "s": "t", + "u": "v", + "w": "x", + "y": "z", + "this": "will", + "make": "thirty", + "entries": "yeah", +} + +var errorFields = Fields{ + "foo": fmt.Errorf("bar"), + "baz": fmt.Errorf("qux"), +} + +func BenchmarkErrorTextFormatter(b *testing.B) { + doBenchmark(b, &TextFormatter{DisableColors: true}, errorFields) +} + +func BenchmarkSmallTextFormatter(b *testing.B) { + doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields) +} + +func BenchmarkLargeTextFormatter(b *testing.B) { + doBenchmark(b, &TextFormatter{DisableColors: true}, largeFields) +} + +func BenchmarkSmallColoredTextFormatter(b *testing.B) { + doBenchmark(b, &TextFormatter{ForceColors: true}, smallFields) +} + +func BenchmarkLargeColoredTextFormatter(b *testing.B) { + doBenchmark(b, &TextFormatter{ForceColors: true}, largeFields) +} + +func BenchmarkSmallJSONFormatter(b *testing.B) { + doBenchmark(b, &JSONFormatter{}, smallFields) +} + +func BenchmarkLargeJSONFormatter(b *testing.B) { + doBenchmark(b, &JSONFormatter{}, largeFields) +} + +func doBenchmark(b *testing.B, formatter Formatter, fields Fields) { + logger := New() + + entry := &Entry{ + Time: time.Time{}, + Level: InfoLevel, + Message: "message", + Data: fields, + Logger: logger, + } + var d []byte + var err error + for i := 0; i < b.N; i++ { + d, err = formatter.Format(entry) + if err != nil { + b.Fatal(err) + } + b.SetBytes(int64(len(d))) + } +} diff --git a/vendor/github.com/Sirupsen/logrus/hook_test.go b/vendor/github.com/Sirupsen/logrus/hook_test.go index 1c39ec2fe7..13f34cb6f8 100644 --- a/vendor/github.com/Sirupsen/logrus/hook_test.go +++ b/vendor/github.com/Sirupsen/logrus/hook_test.go @@ -1,122 +1,122 @@ -package logrus - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -type TestHook struct { - Fired bool -} - -func (hook *TestHook) Fire(entry *Entry) error { - hook.Fired = true - return nil -} - -func (hook *TestHook) Levels() []Level { - return []Level{ - DebugLevel, - InfoLevel, - WarnLevel, - ErrorLevel, - FatalLevel, - PanicLevel, - } -} - -func TestHookFires(t *testing.T) { - hook := new(TestHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - assert.Equal(t, hook.Fired, false) - - log.Print("test") - }, func(fields Fields) { - assert.Equal(t, hook.Fired, true) - }) -} - -type ModifyHook struct { -} - -func (hook *ModifyHook) Fire(entry *Entry) error { - entry.Data["wow"] = "whale" - return nil -} - -func (hook *ModifyHook) Levels() []Level { - return []Level{ - DebugLevel, - InfoLevel, - WarnLevel, - ErrorLevel, - FatalLevel, - PanicLevel, - } -} - -func TestHookCanModifyEntry(t *testing.T) { - hook := new(ModifyHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - log.WithField("wow", "elephant").Print("test") - }, func(fields Fields) { - assert.Equal(t, fields["wow"], "whale") - }) -} - -func TestCanFireMultipleHooks(t *testing.T) { - hook1 := new(ModifyHook) - hook2 := new(TestHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook1) - log.Hooks.Add(hook2) - - log.WithField("wow", "elephant").Print("test") - }, func(fields Fields) { - assert.Equal(t, fields["wow"], "whale") - assert.Equal(t, hook2.Fired, true) - }) -} - -type ErrorHook struct { - Fired bool -} - -func (hook *ErrorHook) Fire(entry *Entry) error { - hook.Fired = true - return nil -} - -func (hook *ErrorHook) Levels() []Level { - return []Level{ - ErrorLevel, - } -} - -func TestErrorHookShouldntFireOnInfo(t *testing.T) { - hook := new(ErrorHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - log.Info("test") - }, func(fields Fields) { - assert.Equal(t, hook.Fired, false) - }) -} - -func TestErrorHookShouldFireOnError(t *testing.T) { - hook := new(ErrorHook) - - LogAndAssertJSON(t, func(log *Logger) { - log.Hooks.Add(hook) - log.Error("test") - }, func(fields Fields) { - assert.Equal(t, hook.Fired, true) - }) -} +package logrus + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +type TestHook struct { + Fired bool +} + +func (hook *TestHook) Fire(entry *Entry) error { + hook.Fired = true + return nil +} + +func (hook *TestHook) Levels() []Level { + return []Level{ + DebugLevel, + InfoLevel, + WarnLevel, + ErrorLevel, + FatalLevel, + PanicLevel, + } +} + +func TestHookFires(t *testing.T) { + hook := new(TestHook) + + LogAndAssertJSON(t, func(log *Logger) { + log.Hooks.Add(hook) + assert.Equal(t, hook.Fired, false) + + log.Print("test") + }, func(fields Fields) { + assert.Equal(t, hook.Fired, true) + }) +} + +type ModifyHook struct { +} + +func (hook *ModifyHook) Fire(entry *Entry) error { + entry.Data["wow"] = "whale" + return nil +} + +func (hook *ModifyHook) Levels() []Level { + return []Level{ + DebugLevel, + InfoLevel, + WarnLevel, + ErrorLevel, + FatalLevel, + PanicLevel, + } +} + +func TestHookCanModifyEntry(t *testing.T) { + hook := new(ModifyHook) + + LogAndAssertJSON(t, func(log *Logger) { + log.Hooks.Add(hook) + log.WithField("wow", "elephant").Print("test") + }, func(fields Fields) { + assert.Equal(t, fields["wow"], "whale") + }) +} + +func TestCanFireMultipleHooks(t *testing.T) { + hook1 := new(ModifyHook) + hook2 := new(TestHook) + + LogAndAssertJSON(t, func(log *Logger) { + log.Hooks.Add(hook1) + log.Hooks.Add(hook2) + + log.WithField("wow", "elephant").Print("test") + }, func(fields Fields) { + assert.Equal(t, fields["wow"], "whale") + assert.Equal(t, hook2.Fired, true) + }) +} + +type ErrorHook struct { + Fired bool +} + +func (hook *ErrorHook) Fire(entry *Entry) error { + hook.Fired = true + return nil +} + +func (hook *ErrorHook) Levels() []Level { + return []Level{ + ErrorLevel, + } +} + +func TestErrorHookShouldntFireOnInfo(t *testing.T) { + hook := new(ErrorHook) + + LogAndAssertJSON(t, func(log *Logger) { + log.Hooks.Add(hook) + log.Info("test") + }, func(fields Fields) { + assert.Equal(t, hook.Fired, false) + }) +} + +func TestErrorHookShouldFireOnError(t *testing.T) { + hook := new(ErrorHook) + + LogAndAssertJSON(t, func(log *Logger) { + log.Hooks.Add(hook) + log.Error("test") + }, func(fields Fields) { + assert.Equal(t, hook.Fired, true) + }) +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks.go b/vendor/github.com/Sirupsen/logrus/hooks.go index 92df541d30..3f151cdc39 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks.go +++ b/vendor/github.com/Sirupsen/logrus/hooks.go @@ -1,34 +1,34 @@ -package logrus - -// A hook to be fired when logging on the logging levels returned from -// `Levels()` on your implementation of the interface. Note that this is not -// fired in a goroutine or a channel with workers, you should handle such -// functionality yourself if your call is non-blocking and you don't wish for -// the logging calls for levels returned from `Levels()` to block. -type Hook interface { - Levels() []Level - Fire(*Entry) error -} - -// Internal type for storing the hooks on a logger instance. -type LevelHooks map[Level][]Hook - -// Add a hook to an instance of logger. This is called with -// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. -func (hooks LevelHooks) Add(hook Hook) { - for _, level := range hook.Levels() { - hooks[level] = append(hooks[level], hook) - } -} - -// Fire all the hooks for the passed level. Used by `entry.log` to fire -// appropriate hooks for a log entry. -func (hooks LevelHooks) Fire(level Level, entry *Entry) error { - for _, hook := range hooks[level] { - if err := hook.Fire(entry); err != nil { - return err - } - } - - return nil -} +package logrus + +// A hook to be fired when logging on the logging levels returned from +// `Levels()` on your implementation of the interface. Note that this is not +// fired in a goroutine or a channel with workers, you should handle such +// functionality yourself if your call is non-blocking and you don't wish for +// the logging calls for levels returned from `Levels()` to block. +type Hook interface { + Levels() []Level + Fire(*Entry) error +} + +// Internal type for storing the hooks on a logger instance. +type LevelHooks map[Level][]Hook + +// Add a hook to an instance of logger. This is called with +// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. +func (hooks LevelHooks) Add(hook Hook) { + for _, level := range hook.Levels() { + hooks[level] = append(hooks[level], hook) + } +} + +// Fire all the hooks for the passed level. Used by `entry.log` to fire +// appropriate hooks for a log entry. +func (hooks LevelHooks) Fire(level Level, entry *Entry) error { + for _, hook := range hooks[level] { + if err := hook.Fire(entry); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md b/vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md index 9aab1ee1ad..066704b370 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md +++ b/vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md @@ -1,39 +1,39 @@ -# Syslog Hooks for Logrus :walrus: - -## Usage - -```go -import ( - "log/syslog" - "github.com/Sirupsen/logrus" - logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" -) - -func main() { - log := logrus.New() - hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") - - if err == nil { - log.Hooks.Add(hook) - } -} -``` - -If you want to connect to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). Just assign empty string to the first two parameters of `NewSyslogHook`. It should look like the following. - -```go -import ( - "log/syslog" - "github.com/Sirupsen/logrus" - logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" -) - -func main() { - log := logrus.New() - hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "") - - if err == nil { - log.Hooks.Add(hook) - } -} +# Syslog Hooks for Logrus :walrus: + +## Usage + +```go +import ( + "log/syslog" + "github.com/Sirupsen/logrus" + logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" +) + +func main() { + log := logrus.New() + hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + + if err == nil { + log.Hooks.Add(hook) + } +} +``` + +If you want to connect to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). Just assign empty string to the first two parameters of `NewSyslogHook`. It should look like the following. + +```go +import ( + "log/syslog" + "github.com/Sirupsen/logrus" + logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog" +) + +func main() { + log := logrus.New() + hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "") + + if err == nil { + log.Hooks.Add(hook) + } +} ``` \ No newline at end of file diff --git a/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go b/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go index 5b8e72d4cf..a36e20032e 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go +++ b/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog.go @@ -1,54 +1,54 @@ -// +build !windows,!nacl,!plan9 - -package logrus_syslog - -import ( - "fmt" - "github.com/Sirupsen/logrus" - "log/syslog" - "os" -) - -// SyslogHook to send logs via syslog. -type SyslogHook struct { - Writer *syslog.Writer - SyslogNetwork string - SyslogRaddr string -} - -// Creates a hook to be added to an instance of logger. This is called with -// `hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_DEBUG, "")` -// `if err == nil { log.Hooks.Add(hook) }` -func NewSyslogHook(network, raddr string, priority syslog.Priority, tag string) (*SyslogHook, error) { - w, err := syslog.Dial(network, raddr, priority, tag) - return &SyslogHook{w, network, raddr}, err -} - -func (hook *SyslogHook) Fire(entry *logrus.Entry) error { - line, err := entry.String() - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to read entry, %v", err) - return err - } - - switch entry.Level { - case logrus.PanicLevel: - return hook.Writer.Crit(line) - case logrus.FatalLevel: - return hook.Writer.Crit(line) - case logrus.ErrorLevel: - return hook.Writer.Err(line) - case logrus.WarnLevel: - return hook.Writer.Warning(line) - case logrus.InfoLevel: - return hook.Writer.Info(line) - case logrus.DebugLevel: - return hook.Writer.Debug(line) - default: - return nil - } -} - -func (hook *SyslogHook) Levels() []logrus.Level { - return logrus.AllLevels -} +// +build !windows,!nacl,!plan9 + +package logrus_syslog + +import ( + "fmt" + "github.com/Sirupsen/logrus" + "log/syslog" + "os" +) + +// SyslogHook to send logs via syslog. +type SyslogHook struct { + Writer *syslog.Writer + SyslogNetwork string + SyslogRaddr string +} + +// Creates a hook to be added to an instance of logger. This is called with +// `hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_DEBUG, "")` +// `if err == nil { log.Hooks.Add(hook) }` +func NewSyslogHook(network, raddr string, priority syslog.Priority, tag string) (*SyslogHook, error) { + w, err := syslog.Dial(network, raddr, priority, tag) + return &SyslogHook{w, network, raddr}, err +} + +func (hook *SyslogHook) Fire(entry *logrus.Entry) error { + line, err := entry.String() + if err != nil { + fmt.Fprintf(os.Stderr, "Unable to read entry, %v", err) + return err + } + + switch entry.Level { + case logrus.PanicLevel: + return hook.Writer.Crit(line) + case logrus.FatalLevel: + return hook.Writer.Crit(line) + case logrus.ErrorLevel: + return hook.Writer.Err(line) + case logrus.WarnLevel: + return hook.Writer.Warning(line) + case logrus.InfoLevel: + return hook.Writer.Info(line) + case logrus.DebugLevel: + return hook.Writer.Debug(line) + default: + return nil + } +} + +func (hook *SyslogHook) Levels() []logrus.Level { + return logrus.AllLevels +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go b/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go index 598e22b3db..42762dc10d 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go +++ b/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go @@ -1,26 +1,26 @@ -package logrus_syslog - -import ( - "github.com/Sirupsen/logrus" - "log/syslog" - "testing" -) - -func TestLocalhostAddAndPrint(t *testing.T) { - log := logrus.New() - hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") - - if err != nil { - t.Errorf("Unable to connect to local syslog.") - } - - log.Hooks.Add(hook) - - for _, level := range hook.Levels() { - if len(log.Hooks[level]) != 1 { - t.Errorf("SyslogHook was not added. The length of log.Hooks[%v]: %v", level, len(log.Hooks[level])) - } - } - - log.Info("Congratulations!") -} +package logrus_syslog + +import ( + "github.com/Sirupsen/logrus" + "log/syslog" + "testing" +) + +func TestLocalhostAddAndPrint(t *testing.T) { + log := logrus.New() + hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + + if err != nil { + t.Errorf("Unable to connect to local syslog.") + } + + log.Hooks.Add(hook) + + for _, level := range hook.Levels() { + if len(log.Hooks[level]) != 1 { + t.Errorf("SyslogHook was not added. The length of log.Hooks[%v]: %v", level, len(log.Hooks[level])) + } + } + + log.Info("Congratulations!") +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/test/test.go b/vendor/github.com/Sirupsen/logrus/hooks/test/test.go index 36007a0974..068812535d 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks/test/test.go +++ b/vendor/github.com/Sirupsen/logrus/hooks/test/test.go @@ -1,67 +1,67 @@ -package test - -import ( - "io/ioutil" - - "github.com/Sirupsen/logrus" -) - -// test.Hook is a hook designed for dealing with logs in test scenarios. -type Hook struct { - Entries []*logrus.Entry -} - -// Installs a test hook for the global logger. -func NewGlobal() *Hook { - - hook := new(Hook) - logrus.AddHook(hook) - - return hook - -} - -// Installs a test hook for a given local logger. -func NewLocal(logger *logrus.Logger) *Hook { - - hook := new(Hook) - logger.Hooks.Add(hook) - - return hook - -} - -// Creates a discarding logger and installs the test hook. -func NewNullLogger() (*logrus.Logger, *Hook) { - - logger := logrus.New() - logger.Out = ioutil.Discard - - return logger, NewLocal(logger) - -} - -func (t *Hook) Fire(e *logrus.Entry) error { - t.Entries = append(t.Entries, e) - return nil -} - -func (t *Hook) Levels() []logrus.Level { - return logrus.AllLevels -} - -// LastEntry returns the last entry that was logged or nil. -func (t *Hook) LastEntry() (l *logrus.Entry) { - - if i := len(t.Entries) - 1; i < 0 { - return nil - } else { - return t.Entries[i] - } - -} - -// Reset removes all Entries from this test hook. -func (t *Hook) Reset() { - t.Entries = make([]*logrus.Entry, 0) -} +package test + +import ( + "io/ioutil" + + "github.com/Sirupsen/logrus" +) + +// test.Hook is a hook designed for dealing with logs in test scenarios. +type Hook struct { + Entries []*logrus.Entry +} + +// Installs a test hook for the global logger. +func NewGlobal() *Hook { + + hook := new(Hook) + logrus.AddHook(hook) + + return hook + +} + +// Installs a test hook for a given local logger. +func NewLocal(logger *logrus.Logger) *Hook { + + hook := new(Hook) + logger.Hooks.Add(hook) + + return hook + +} + +// Creates a discarding logger and installs the test hook. +func NewNullLogger() (*logrus.Logger, *Hook) { + + logger := logrus.New() + logger.Out = ioutil.Discard + + return logger, NewLocal(logger) + +} + +func (t *Hook) Fire(e *logrus.Entry) error { + t.Entries = append(t.Entries, e) + return nil +} + +func (t *Hook) Levels() []logrus.Level { + return logrus.AllLevels +} + +// LastEntry returns the last entry that was logged or nil. +func (t *Hook) LastEntry() (l *logrus.Entry) { + + if i := len(t.Entries) - 1; i < 0 { + return nil + } else { + return t.Entries[i] + } + +} + +// Reset removes all Entries from this test hook. +func (t *Hook) Reset() { + t.Entries = make([]*logrus.Entry, 0) +} diff --git a/vendor/github.com/Sirupsen/logrus/hooks/test/test_test.go b/vendor/github.com/Sirupsen/logrus/hooks/test/test_test.go index a24a0ade7d..d69455ba04 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks/test/test_test.go +++ b/vendor/github.com/Sirupsen/logrus/hooks/test/test_test.go @@ -1,39 +1,39 @@ -package test - -import ( - "testing" - - "github.com/Sirupsen/logrus" - "github.com/stretchr/testify/assert" -) - -func TestAllHooks(t *testing.T) { - - assert := assert.New(t) - - logger, hook := NewNullLogger() - assert.Nil(hook.LastEntry()) - assert.Equal(0, len(hook.Entries)) - - logger.Error("Hello error") - assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level) - assert.Equal("Hello error", hook.LastEntry().Message) - assert.Equal(1, len(hook.Entries)) - - logger.Warn("Hello warning") - assert.Equal(logrus.WarnLevel, hook.LastEntry().Level) - assert.Equal("Hello warning", hook.LastEntry().Message) - assert.Equal(2, len(hook.Entries)) - - hook.Reset() - assert.Nil(hook.LastEntry()) - assert.Equal(0, len(hook.Entries)) - - hook = NewGlobal() - - logrus.Error("Hello error") - assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level) - assert.Equal("Hello error", hook.LastEntry().Message) - assert.Equal(1, len(hook.Entries)) - -} +package test + +import ( + "testing" + + "github.com/Sirupsen/logrus" + "github.com/stretchr/testify/assert" +) + +func TestAllHooks(t *testing.T) { + + assert := assert.New(t) + + logger, hook := NewNullLogger() + assert.Nil(hook.LastEntry()) + assert.Equal(0, len(hook.Entries)) + + logger.Error("Hello error") + assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level) + assert.Equal("Hello error", hook.LastEntry().Message) + assert.Equal(1, len(hook.Entries)) + + logger.Warn("Hello warning") + assert.Equal(logrus.WarnLevel, hook.LastEntry().Level) + assert.Equal("Hello warning", hook.LastEntry().Message) + assert.Equal(2, len(hook.Entries)) + + hook.Reset() + assert.Nil(hook.LastEntry()) + assert.Equal(0, len(hook.Entries)) + + hook = NewGlobal() + + logrus.Error("Hello error") + assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level) + assert.Equal("Hello error", hook.LastEntry().Message) + assert.Equal(1, len(hook.Entries)) + +} diff --git a/vendor/github.com/Sirupsen/logrus/json_formatter.go b/vendor/github.com/Sirupsen/logrus/json_formatter.go index 452fcfa096..266554e9ff 100644 --- a/vendor/github.com/Sirupsen/logrus/json_formatter.go +++ b/vendor/github.com/Sirupsen/logrus/json_formatter.go @@ -1,74 +1,74 @@ -package logrus - -import ( - "encoding/json" - "fmt" -) - -type fieldKey string -type FieldMap map[fieldKey]string - -const ( - FieldKeyMsg = "msg" - FieldKeyLevel = "level" - FieldKeyTime = "time" -) - -func (f FieldMap) resolve(key fieldKey) string { - if k, ok := f[key]; ok { - return k - } - - return string(key) -} - -type JSONFormatter struct { - // TimestampFormat sets the format used for marshaling timestamps. - TimestampFormat string - - // DisableTimestamp allows disabling automatic timestamps in output - DisableTimestamp bool - - // FieldMap allows users to customize the names of keys for various fields. - // As an example: - // formatter := &JSONFormatter{ - // FieldMap: FieldMap{ - // FieldKeyTime: "@timestamp", - // FieldKeyLevel: "@level", - // FieldKeyLevel: "@message", - // }, - // } - FieldMap FieldMap -} - -func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { - data := make(Fields, len(entry.Data)+3) - for k, v := range entry.Data { - switch v := v.(type) { - case error: - // Otherwise errors are ignored by `encoding/json` - // https://github.com/Sirupsen/logrus/issues/137 - data[k] = v.Error() - default: - data[k] = v - } - } - prefixFieldClashes(data) - - timestampFormat := f.TimestampFormat - if timestampFormat == "" { - timestampFormat = DefaultTimestampFormat - } - - if !f.DisableTimestamp { - data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat) - } - data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message - data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String() - - serialized, err := json.Marshal(data) - if err != nil { - return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) - } - return append(serialized, '\n'), nil -} +package logrus + +import ( + "encoding/json" + "fmt" +) + +type fieldKey string +type FieldMap map[fieldKey]string + +const ( + FieldKeyMsg = "msg" + FieldKeyLevel = "level" + FieldKeyTime = "time" +) + +func (f FieldMap) resolve(key fieldKey) string { + if k, ok := f[key]; ok { + return k + } + + return string(key) +} + +type JSONFormatter struct { + // TimestampFormat sets the format used for marshaling timestamps. + TimestampFormat string + + // DisableTimestamp allows disabling automatic timestamps in output + DisableTimestamp bool + + // FieldMap allows users to customize the names of keys for various fields. + // As an example: + // formatter := &JSONFormatter{ + // FieldMap: FieldMap{ + // FieldKeyTime: "@timestamp", + // FieldKeyLevel: "@level", + // FieldKeyLevel: "@message", + // }, + // } + FieldMap FieldMap +} + +func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { + data := make(Fields, len(entry.Data)+3) + for k, v := range entry.Data { + switch v := v.(type) { + case error: + // Otherwise errors are ignored by `encoding/json` + // https://github.com/Sirupsen/logrus/issues/137 + data[k] = v.Error() + default: + data[k] = v + } + } + prefixFieldClashes(data) + + timestampFormat := f.TimestampFormat + if timestampFormat == "" { + timestampFormat = DefaultTimestampFormat + } + + if !f.DisableTimestamp { + data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat) + } + data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message + data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String() + + serialized, err := json.Marshal(data) + if err != nil { + return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) + } + return append(serialized, '\n'), nil +} diff --git a/vendor/github.com/Sirupsen/logrus/json_formatter_test.go b/vendor/github.com/Sirupsen/logrus/json_formatter_test.go index 4e5bac79a6..51093a79ba 100644 --- a/vendor/github.com/Sirupsen/logrus/json_formatter_test.go +++ b/vendor/github.com/Sirupsen/logrus/json_formatter_test.go @@ -1,199 +1,199 @@ -package logrus - -import ( - "encoding/json" - "errors" - "strings" - "testing" -) - -func TestErrorNotLost(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("error", errors.New("wild walrus"))) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["error"] != "wild walrus" { - t.Fatal("Error field not set") - } -} - -func TestErrorNotLostOnFieldNotNamedError(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("omg", errors.New("wild walrus"))) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["omg"] != "wild walrus" { - t.Fatal("Error field not set") - } -} - -func TestFieldClashWithTime(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("time", "right now!")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["fields.time"] != "right now!" { - t.Fatal("fields.time not set to original time field") - } - - if entry["time"] != "0001-01-01T00:00:00Z" { - t.Fatal("time field not set to current time, was: ", entry["time"]) - } -} - -func TestFieldClashWithMsg(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("msg", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["fields.msg"] != "something" { - t.Fatal("fields.msg not set to original msg field") - } -} - -func TestFieldClashWithLevel(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - entry := make(map[string]interface{}) - err = json.Unmarshal(b, &entry) - if err != nil { - t.Fatal("Unable to unmarshal formatted entry: ", err) - } - - if entry["fields.level"] != "something" { - t.Fatal("fields.level not set to original level field") - } -} - -func TestJSONEntryEndsWithNewline(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - - if b[len(b)-1] != '\n' { - t.Fatal("Expected JSON log entry to end with a newline") - } -} - -func TestJSONMessageKey(t *testing.T) { - formatter := &JSONFormatter{ - FieldMap: FieldMap{ - FieldKeyMsg: "message", - }, - } - - b, err := formatter.Format(&Entry{Message: "oh hai"}) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - s := string(b) - if !(strings.Contains(s, "message") && strings.Contains(s, "oh hai")) { - t.Fatal("Expected JSON to format message key") - } -} - -func TestJSONLevelKey(t *testing.T) { - formatter := &JSONFormatter{ - FieldMap: FieldMap{ - FieldKeyLevel: "somelevel", - }, - } - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - s := string(b) - if !strings.Contains(s, "somelevel") { - t.Fatal("Expected JSON to format level key") - } -} - -func TestJSONTimeKey(t *testing.T) { - formatter := &JSONFormatter{ - FieldMap: FieldMap{ - FieldKeyTime: "timeywimey", - }, - } - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - s := string(b) - if !strings.Contains(s, "timeywimey") { - t.Fatal("Expected JSON to format time key") - } -} - -func TestJSONDisableTimestamp(t *testing.T) { - formatter := &JSONFormatter{ - DisableTimestamp: true, - } - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - s := string(b) - if strings.Contains(s, FieldKeyTime) { - t.Error("Did not prevent timestamp", s) - } -} - -func TestJSONEnableTimestamp(t *testing.T) { - formatter := &JSONFormatter{} - - b, err := formatter.Format(WithField("level", "something")) - if err != nil { - t.Fatal("Unable to format entry: ", err) - } - s := string(b) - if !strings.Contains(s, FieldKeyTime) { - t.Error("Timestamp not present", s) - } -} +package logrus + +import ( + "encoding/json" + "errors" + "strings" + "testing" +) + +func TestErrorNotLost(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("error", errors.New("wild walrus"))) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + + entry := make(map[string]interface{}) + err = json.Unmarshal(b, &entry) + if err != nil { + t.Fatal("Unable to unmarshal formatted entry: ", err) + } + + if entry["error"] != "wild walrus" { + t.Fatal("Error field not set") + } +} + +func TestErrorNotLostOnFieldNotNamedError(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("omg", errors.New("wild walrus"))) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + + entry := make(map[string]interface{}) + err = json.Unmarshal(b, &entry) + if err != nil { + t.Fatal("Unable to unmarshal formatted entry: ", err) + } + + if entry["omg"] != "wild walrus" { + t.Fatal("Error field not set") + } +} + +func TestFieldClashWithTime(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("time", "right now!")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + + entry := make(map[string]interface{}) + err = json.Unmarshal(b, &entry) + if err != nil { + t.Fatal("Unable to unmarshal formatted entry: ", err) + } + + if entry["fields.time"] != "right now!" { + t.Fatal("fields.time not set to original time field") + } + + if entry["time"] != "0001-01-01T00:00:00Z" { + t.Fatal("time field not set to current time, was: ", entry["time"]) + } +} + +func TestFieldClashWithMsg(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("msg", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + + entry := make(map[string]interface{}) + err = json.Unmarshal(b, &entry) + if err != nil { + t.Fatal("Unable to unmarshal formatted entry: ", err) + } + + if entry["fields.msg"] != "something" { + t.Fatal("fields.msg not set to original msg field") + } +} + +func TestFieldClashWithLevel(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("level", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + + entry := make(map[string]interface{}) + err = json.Unmarshal(b, &entry) + if err != nil { + t.Fatal("Unable to unmarshal formatted entry: ", err) + } + + if entry["fields.level"] != "something" { + t.Fatal("fields.level not set to original level field") + } +} + +func TestJSONEntryEndsWithNewline(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("level", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + + if b[len(b)-1] != '\n' { + t.Fatal("Expected JSON log entry to end with a newline") + } +} + +func TestJSONMessageKey(t *testing.T) { + formatter := &JSONFormatter{ + FieldMap: FieldMap{ + FieldKeyMsg: "message", + }, + } + + b, err := formatter.Format(&Entry{Message: "oh hai"}) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + s := string(b) + if !(strings.Contains(s, "message") && strings.Contains(s, "oh hai")) { + t.Fatal("Expected JSON to format message key") + } +} + +func TestJSONLevelKey(t *testing.T) { + formatter := &JSONFormatter{ + FieldMap: FieldMap{ + FieldKeyLevel: "somelevel", + }, + } + + b, err := formatter.Format(WithField("level", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + s := string(b) + if !strings.Contains(s, "somelevel") { + t.Fatal("Expected JSON to format level key") + } +} + +func TestJSONTimeKey(t *testing.T) { + formatter := &JSONFormatter{ + FieldMap: FieldMap{ + FieldKeyTime: "timeywimey", + }, + } + + b, err := formatter.Format(WithField("level", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + s := string(b) + if !strings.Contains(s, "timeywimey") { + t.Fatal("Expected JSON to format time key") + } +} + +func TestJSONDisableTimestamp(t *testing.T) { + formatter := &JSONFormatter{ + DisableTimestamp: true, + } + + b, err := formatter.Format(WithField("level", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + s := string(b) + if strings.Contains(s, FieldKeyTime) { + t.Error("Did not prevent timestamp", s) + } +} + +func TestJSONEnableTimestamp(t *testing.T) { + formatter := &JSONFormatter{} + + b, err := formatter.Format(WithField("level", "something")) + if err != nil { + t.Fatal("Unable to format entry: ", err) + } + s := string(b) + if !strings.Contains(s, FieldKeyTime) { + t.Error("Timestamp not present", s) + } +} diff --git a/vendor/github.com/Sirupsen/logrus/logger.go b/vendor/github.com/Sirupsen/logrus/logger.go index bc307d8142..b769f3d352 100644 --- a/vendor/github.com/Sirupsen/logrus/logger.go +++ b/vendor/github.com/Sirupsen/logrus/logger.go @@ -1,308 +1,308 @@ -package logrus - -import ( - "io" - "os" - "sync" -) - -type Logger struct { - // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a - // file, or leave it default which is `os.Stderr`. You can also set this to - // something more adventorous, such as logging to Kafka. - Out io.Writer - // Hooks for the logger instance. These allow firing events based on logging - // levels and log entries. For example, to send errors to an error tracking - // service, log to StatsD or dump the core on fatal errors. - Hooks LevelHooks - // All log entries pass through the formatter before logged to Out. The - // included formatters are `TextFormatter` and `JSONFormatter` for which - // TextFormatter is the default. In development (when a TTY is attached) it - // logs with colors, but to a file it wouldn't. You can easily implement your - // own that implements the `Formatter` interface, see the `README` or included - // formatters for examples. - Formatter Formatter - // The logging level the logger should log at. This is typically (and defaults - // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be - // logged. `logrus.Debug` is useful in - Level Level - // Used to sync writing to the log. Locking is enabled by Default - mu MutexWrap - // Reusable empty entry - entryPool sync.Pool -} - -type MutexWrap struct { - lock sync.Mutex - disabled bool -} - -func (mw *MutexWrap) Lock() { - if !mw.disabled { - mw.lock.Lock() - } -} - -func (mw *MutexWrap) Unlock() { - if !mw.disabled { - mw.lock.Unlock() - } -} - -func (mw *MutexWrap) Disable() { - mw.disabled = true -} - -// Creates a new logger. Configuration should be set by changing `Formatter`, -// `Out` and `Hooks` directly on the default logger instance. You can also just -// instantiate your own: -// -// var log = &Logger{ -// Out: os.Stderr, -// Formatter: new(JSONFormatter), -// Hooks: make(LevelHooks), -// Level: logrus.DebugLevel, -// } -// -// It's recommended to make this a global instance called `log`. -func New() *Logger { - return &Logger{ - Out: os.Stderr, - Formatter: new(TextFormatter), - Hooks: make(LevelHooks), - Level: InfoLevel, - } -} - -func (logger *Logger) newEntry() *Entry { - entry, ok := logger.entryPool.Get().(*Entry) - if ok { - return entry - } - return NewEntry(logger) -} - -func (logger *Logger) releaseEntry(entry *Entry) { - logger.entryPool.Put(entry) -} - -// Adds a field to the log entry, note that it doesn't log until you call -// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry. -// If you want multiple fields, use `WithFields`. -func (logger *Logger) WithField(key string, value interface{}) *Entry { - entry := logger.newEntry() - defer logger.releaseEntry(entry) - return entry.WithField(key, value) -} - -// Adds a struct of fields to the log entry. All it does is call `WithField` for -// each `Field`. -func (logger *Logger) WithFields(fields Fields) *Entry { - entry := logger.newEntry() - defer logger.releaseEntry(entry) - return entry.WithFields(fields) -} - -// Add an error as single field to the log entry. All it does is call -// `WithError` for the given `error`. -func (logger *Logger) WithError(err error) *Entry { - entry := logger.newEntry() - defer logger.releaseEntry(entry) - return entry.WithError(err) -} - -func (logger *Logger) Debugf(format string, args ...interface{}) { - if logger.Level >= DebugLevel { - entry := logger.newEntry() - entry.Debugf(format, args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Infof(format string, args ...interface{}) { - if logger.Level >= InfoLevel { - entry := logger.newEntry() - entry.Infof(format, args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Printf(format string, args ...interface{}) { - entry := logger.newEntry() - entry.Printf(format, args...) - logger.releaseEntry(entry) -} - -func (logger *Logger) Warnf(format string, args ...interface{}) { - if logger.Level >= WarnLevel { - entry := logger.newEntry() - entry.Warnf(format, args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Warningf(format string, args ...interface{}) { - if logger.Level >= WarnLevel { - entry := logger.newEntry() - entry.Warnf(format, args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Errorf(format string, args ...interface{}) { - if logger.Level >= ErrorLevel { - entry := logger.newEntry() - entry.Errorf(format, args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Fatalf(format string, args ...interface{}) { - if logger.Level >= FatalLevel { - entry := logger.newEntry() - entry.Fatalf(format, args...) - logger.releaseEntry(entry) - } - Exit(1) -} - -func (logger *Logger) Panicf(format string, args ...interface{}) { - if logger.Level >= PanicLevel { - entry := logger.newEntry() - entry.Panicf(format, args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Debug(args ...interface{}) { - if logger.Level >= DebugLevel { - entry := logger.newEntry() - entry.Debug(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Info(args ...interface{}) { - if logger.Level >= InfoLevel { - entry := logger.newEntry() - entry.Info(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Print(args ...interface{}) { - entry := logger.newEntry() - entry.Info(args...) - logger.releaseEntry(entry) -} - -func (logger *Logger) Warn(args ...interface{}) { - if logger.Level >= WarnLevel { - entry := logger.newEntry() - entry.Warn(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Warning(args ...interface{}) { - if logger.Level >= WarnLevel { - entry := logger.newEntry() - entry.Warn(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Error(args ...interface{}) { - if logger.Level >= ErrorLevel { - entry := logger.newEntry() - entry.Error(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Fatal(args ...interface{}) { - if logger.Level >= FatalLevel { - entry := logger.newEntry() - entry.Fatal(args...) - logger.releaseEntry(entry) - } - Exit(1) -} - -func (logger *Logger) Panic(args ...interface{}) { - if logger.Level >= PanicLevel { - entry := logger.newEntry() - entry.Panic(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Debugln(args ...interface{}) { - if logger.Level >= DebugLevel { - entry := logger.newEntry() - entry.Debugln(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Infoln(args ...interface{}) { - if logger.Level >= InfoLevel { - entry := logger.newEntry() - entry.Infoln(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Println(args ...interface{}) { - entry := logger.newEntry() - entry.Println(args...) - logger.releaseEntry(entry) -} - -func (logger *Logger) Warnln(args ...interface{}) { - if logger.Level >= WarnLevel { - entry := logger.newEntry() - entry.Warnln(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Warningln(args ...interface{}) { - if logger.Level >= WarnLevel { - entry := logger.newEntry() - entry.Warnln(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Errorln(args ...interface{}) { - if logger.Level >= ErrorLevel { - entry := logger.newEntry() - entry.Errorln(args...) - logger.releaseEntry(entry) - } -} - -func (logger *Logger) Fatalln(args ...interface{}) { - if logger.Level >= FatalLevel { - entry := logger.newEntry() - entry.Fatalln(args...) - logger.releaseEntry(entry) - } - Exit(1) -} - -func (logger *Logger) Panicln(args ...interface{}) { - if logger.Level >= PanicLevel { - entry := logger.newEntry() - entry.Panicln(args...) - logger.releaseEntry(entry) - } -} - -//When file is opened with appending mode, it's safe to -//write concurrently to a file (within 4k message on Linux). -//In these cases user can choose to disable the lock. -func (logger *Logger) SetNoLock() { - logger.mu.Disable() -} +package logrus + +import ( + "io" + "os" + "sync" +) + +type Logger struct { + // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a + // file, or leave it default which is `os.Stderr`. You can also set this to + // something more adventorous, such as logging to Kafka. + Out io.Writer + // Hooks for the logger instance. These allow firing events based on logging + // levels and log entries. For example, to send errors to an error tracking + // service, log to StatsD or dump the core on fatal errors. + Hooks LevelHooks + // All log entries pass through the formatter before logged to Out. The + // included formatters are `TextFormatter` and `JSONFormatter` for which + // TextFormatter is the default. In development (when a TTY is attached) it + // logs with colors, but to a file it wouldn't. You can easily implement your + // own that implements the `Formatter` interface, see the `README` or included + // formatters for examples. + Formatter Formatter + // The logging level the logger should log at. This is typically (and defaults + // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be + // logged. `logrus.Debug` is useful in + Level Level + // Used to sync writing to the log. Locking is enabled by Default + mu MutexWrap + // Reusable empty entry + entryPool sync.Pool +} + +type MutexWrap struct { + lock sync.Mutex + disabled bool +} + +func (mw *MutexWrap) Lock() { + if !mw.disabled { + mw.lock.Lock() + } +} + +func (mw *MutexWrap) Unlock() { + if !mw.disabled { + mw.lock.Unlock() + } +} + +func (mw *MutexWrap) Disable() { + mw.disabled = true +} + +// Creates a new logger. Configuration should be set by changing `Formatter`, +// `Out` and `Hooks` directly on the default logger instance. You can also just +// instantiate your own: +// +// var log = &Logger{ +// Out: os.Stderr, +// Formatter: new(JSONFormatter), +// Hooks: make(LevelHooks), +// Level: logrus.DebugLevel, +// } +// +// It's recommended to make this a global instance called `log`. +func New() *Logger { + return &Logger{ + Out: os.Stderr, + Formatter: new(TextFormatter), + Hooks: make(LevelHooks), + Level: InfoLevel, + } +} + +func (logger *Logger) newEntry() *Entry { + entry, ok := logger.entryPool.Get().(*Entry) + if ok { + return entry + } + return NewEntry(logger) +} + +func (logger *Logger) releaseEntry(entry *Entry) { + logger.entryPool.Put(entry) +} + +// Adds a field to the log entry, note that it doesn't log until you call +// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry. +// If you want multiple fields, use `WithFields`. +func (logger *Logger) WithField(key string, value interface{}) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithField(key, value) +} + +// Adds a struct of fields to the log entry. All it does is call `WithField` for +// each `Field`. +func (logger *Logger) WithFields(fields Fields) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithFields(fields) +} + +// Add an error as single field to the log entry. All it does is call +// `WithError` for the given `error`. +func (logger *Logger) WithError(err error) *Entry { + entry := logger.newEntry() + defer logger.releaseEntry(entry) + return entry.WithError(err) +} + +func (logger *Logger) Debugf(format string, args ...interface{}) { + if logger.Level >= DebugLevel { + entry := logger.newEntry() + entry.Debugf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Infof(format string, args ...interface{}) { + if logger.Level >= InfoLevel { + entry := logger.newEntry() + entry.Infof(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Printf(format string, args ...interface{}) { + entry := logger.newEntry() + entry.Printf(format, args...) + logger.releaseEntry(entry) +} + +func (logger *Logger) Warnf(format string, args ...interface{}) { + if logger.Level >= WarnLevel { + entry := logger.newEntry() + entry.Warnf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Warningf(format string, args ...interface{}) { + if logger.Level >= WarnLevel { + entry := logger.newEntry() + entry.Warnf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Errorf(format string, args ...interface{}) { + if logger.Level >= ErrorLevel { + entry := logger.newEntry() + entry.Errorf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Fatalf(format string, args ...interface{}) { + if logger.Level >= FatalLevel { + entry := logger.newEntry() + entry.Fatalf(format, args...) + logger.releaseEntry(entry) + } + Exit(1) +} + +func (logger *Logger) Panicf(format string, args ...interface{}) { + if logger.Level >= PanicLevel { + entry := logger.newEntry() + entry.Panicf(format, args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Debug(args ...interface{}) { + if logger.Level >= DebugLevel { + entry := logger.newEntry() + entry.Debug(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Info(args ...interface{}) { + if logger.Level >= InfoLevel { + entry := logger.newEntry() + entry.Info(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Print(args ...interface{}) { + entry := logger.newEntry() + entry.Info(args...) + logger.releaseEntry(entry) +} + +func (logger *Logger) Warn(args ...interface{}) { + if logger.Level >= WarnLevel { + entry := logger.newEntry() + entry.Warn(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Warning(args ...interface{}) { + if logger.Level >= WarnLevel { + entry := logger.newEntry() + entry.Warn(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Error(args ...interface{}) { + if logger.Level >= ErrorLevel { + entry := logger.newEntry() + entry.Error(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Fatal(args ...interface{}) { + if logger.Level >= FatalLevel { + entry := logger.newEntry() + entry.Fatal(args...) + logger.releaseEntry(entry) + } + Exit(1) +} + +func (logger *Logger) Panic(args ...interface{}) { + if logger.Level >= PanicLevel { + entry := logger.newEntry() + entry.Panic(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Debugln(args ...interface{}) { + if logger.Level >= DebugLevel { + entry := logger.newEntry() + entry.Debugln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Infoln(args ...interface{}) { + if logger.Level >= InfoLevel { + entry := logger.newEntry() + entry.Infoln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Println(args ...interface{}) { + entry := logger.newEntry() + entry.Println(args...) + logger.releaseEntry(entry) +} + +func (logger *Logger) Warnln(args ...interface{}) { + if logger.Level >= WarnLevel { + entry := logger.newEntry() + entry.Warnln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Warningln(args ...interface{}) { + if logger.Level >= WarnLevel { + entry := logger.newEntry() + entry.Warnln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Errorln(args ...interface{}) { + if logger.Level >= ErrorLevel { + entry := logger.newEntry() + entry.Errorln(args...) + logger.releaseEntry(entry) + } +} + +func (logger *Logger) Fatalln(args ...interface{}) { + if logger.Level >= FatalLevel { + entry := logger.newEntry() + entry.Fatalln(args...) + logger.releaseEntry(entry) + } + Exit(1) +} + +func (logger *Logger) Panicln(args ...interface{}) { + if logger.Level >= PanicLevel { + entry := logger.newEntry() + entry.Panicln(args...) + logger.releaseEntry(entry) + } +} + +//When file is opened with appending mode, it's safe to +//write concurrently to a file (within 4k message on Linux). +//In these cases user can choose to disable the lock. +func (logger *Logger) SetNoLock() { + logger.mu.Disable() +} diff --git a/vendor/github.com/Sirupsen/logrus/logger_bench_test.go b/vendor/github.com/Sirupsen/logrus/logger_bench_test.go index 9dd615f1c9..dd23a3535e 100644 --- a/vendor/github.com/Sirupsen/logrus/logger_bench_test.go +++ b/vendor/github.com/Sirupsen/logrus/logger_bench_test.go @@ -1,61 +1,61 @@ -package logrus - -import ( - "os" - "testing" -) - -// smallFields is a small size data set for benchmarking -var loggerFields = Fields{ - "foo": "bar", - "baz": "qux", - "one": "two", - "three": "four", -} - -func BenchmarkDummyLogger(b *testing.B) { - nullf, err := os.OpenFile("/dev/null", os.O_WRONLY, 0666) - if err != nil { - b.Fatalf("%v", err) - } - defer nullf.Close() - doLoggerBenchmark(b, nullf, &TextFormatter{DisableColors: true}, smallFields) -} - -func BenchmarkDummyLoggerNoLock(b *testing.B) { - nullf, err := os.OpenFile("/dev/null", os.O_WRONLY|os.O_APPEND, 0666) - if err != nil { - b.Fatalf("%v", err) - } - defer nullf.Close() - doLoggerBenchmarkNoLock(b, nullf, &TextFormatter{DisableColors: true}, smallFields) -} - -func doLoggerBenchmark(b *testing.B, out *os.File, formatter Formatter, fields Fields) { - logger := Logger{ - Out: out, - Level: InfoLevel, - Formatter: formatter, - } - entry := logger.WithFields(fields) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - entry.Info("aaa") - } - }) -} - -func doLoggerBenchmarkNoLock(b *testing.B, out *os.File, formatter Formatter, fields Fields) { - logger := Logger{ - Out: out, - Level: InfoLevel, - Formatter: formatter, - } - logger.SetNoLock() - entry := logger.WithFields(fields) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - entry.Info("aaa") - } - }) -} +package logrus + +import ( + "os" + "testing" +) + +// smallFields is a small size data set for benchmarking +var loggerFields = Fields{ + "foo": "bar", + "baz": "qux", + "one": "two", + "three": "four", +} + +func BenchmarkDummyLogger(b *testing.B) { + nullf, err := os.OpenFile("/dev/null", os.O_WRONLY, 0666) + if err != nil { + b.Fatalf("%v", err) + } + defer nullf.Close() + doLoggerBenchmark(b, nullf, &TextFormatter{DisableColors: true}, smallFields) +} + +func BenchmarkDummyLoggerNoLock(b *testing.B) { + nullf, err := os.OpenFile("/dev/null", os.O_WRONLY|os.O_APPEND, 0666) + if err != nil { + b.Fatalf("%v", err) + } + defer nullf.Close() + doLoggerBenchmarkNoLock(b, nullf, &TextFormatter{DisableColors: true}, smallFields) +} + +func doLoggerBenchmark(b *testing.B, out *os.File, formatter Formatter, fields Fields) { + logger := Logger{ + Out: out, + Level: InfoLevel, + Formatter: formatter, + } + entry := logger.WithFields(fields) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + entry.Info("aaa") + } + }) +} + +func doLoggerBenchmarkNoLock(b *testing.B, out *os.File, formatter Formatter, fields Fields) { + logger := Logger{ + Out: out, + Level: InfoLevel, + Formatter: formatter, + } + logger.SetNoLock() + entry := logger.WithFields(fields) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + entry.Info("aaa") + } + }) +} diff --git a/vendor/github.com/Sirupsen/logrus/logrus.go b/vendor/github.com/Sirupsen/logrus/logrus.go index 9702d63902..e596691116 100644 --- a/vendor/github.com/Sirupsen/logrus/logrus.go +++ b/vendor/github.com/Sirupsen/logrus/logrus.go @@ -1,143 +1,143 @@ -package logrus - -import ( - "fmt" - "log" - "strings" -) - -// Fields type, used to pass to `WithFields`. -type Fields map[string]interface{} - -// Level type -type Level uint8 - -// Convert the Level to a string. E.g. PanicLevel becomes "panic". -func (level Level) String() string { - switch level { - case DebugLevel: - return "debug" - case InfoLevel: - return "info" - case WarnLevel: - return "warning" - case ErrorLevel: - return "error" - case FatalLevel: - return "fatal" - case PanicLevel: - return "panic" - } - - return "unknown" -} - -// ParseLevel takes a string level and returns the Logrus log level constant. -func ParseLevel(lvl string) (Level, error) { - switch strings.ToLower(lvl) { - case "panic": - return PanicLevel, nil - case "fatal": - return FatalLevel, nil - case "error": - return ErrorLevel, nil - case "warn", "warning": - return WarnLevel, nil - case "info": - return InfoLevel, nil - case "debug": - return DebugLevel, nil - } - - var l Level - return l, fmt.Errorf("not a valid logrus Level: %q", lvl) -} - -// A constant exposing all logging levels -var AllLevels = []Level{ - PanicLevel, - FatalLevel, - ErrorLevel, - WarnLevel, - InfoLevel, - DebugLevel, -} - -// These are the different logging levels. You can set the logging level to log -// on your instance of logger, obtained with `logrus.New()`. -const ( - // PanicLevel level, highest level of severity. Logs and then calls panic with the - // message passed to Debug, Info, ... - PanicLevel Level = iota - // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the - // logging level is set to Panic. - FatalLevel - // ErrorLevel level. Logs. Used for errors that should definitely be noted. - // Commonly used for hooks to send errors to an error tracking service. - ErrorLevel - // WarnLevel level. Non-critical entries that deserve eyes. - WarnLevel - // InfoLevel level. General operational entries about what's going on inside the - // application. - InfoLevel - // DebugLevel level. Usually only enabled when debugging. Very verbose logging. - DebugLevel -) - -// Won't compile if StdLogger can't be realized by a log.Logger -var ( - _ StdLogger = &log.Logger{} - _ StdLogger = &Entry{} - _ StdLogger = &Logger{} -) - -// StdLogger is what your logrus-enabled library should take, that way -// it'll accept a stdlib logger and a logrus logger. There's no standard -// interface, this is the closest we get, unfortunately. -type StdLogger interface { - Print(...interface{}) - Printf(string, ...interface{}) - Println(...interface{}) - - Fatal(...interface{}) - Fatalf(string, ...interface{}) - Fatalln(...interface{}) - - Panic(...interface{}) - Panicf(string, ...interface{}) - Panicln(...interface{}) -} - -// The FieldLogger interface generalizes the Entry and Logger types -type FieldLogger interface { - WithField(key string, value interface{}) *Entry - WithFields(fields Fields) *Entry - WithError(err error) *Entry - - Debugf(format string, args ...interface{}) - Infof(format string, args ...interface{}) - Printf(format string, args ...interface{}) - Warnf(format string, args ...interface{}) - Warningf(format string, args ...interface{}) - Errorf(format string, args ...interface{}) - Fatalf(format string, args ...interface{}) - Panicf(format string, args ...interface{}) - - Debug(args ...interface{}) - Info(args ...interface{}) - Print(args ...interface{}) - Warn(args ...interface{}) - Warning(args ...interface{}) - Error(args ...interface{}) - Fatal(args ...interface{}) - Panic(args ...interface{}) - - Debugln(args ...interface{}) - Infoln(args ...interface{}) - Println(args ...interface{}) - Warnln(args ...interface{}) - Warningln(args ...interface{}) - Errorln(args ...interface{}) - Fatalln(args ...interface{}) - Panicln(args ...interface{}) -} +package logrus + +import ( + "fmt" + "log" + "strings" +) + +// Fields type, used to pass to `WithFields`. +type Fields map[string]interface{} + +// Level type +type Level uint8 + +// Convert the Level to a string. E.g. PanicLevel becomes "panic". +func (level Level) String() string { + switch level { + case DebugLevel: + return "debug" + case InfoLevel: + return "info" + case WarnLevel: + return "warning" + case ErrorLevel: + return "error" + case FatalLevel: + return "fatal" + case PanicLevel: + return "panic" + } + + return "unknown" +} + +// ParseLevel takes a string level and returns the Logrus log level constant. +func ParseLevel(lvl string) (Level, error) { + switch strings.ToLower(lvl) { + case "panic": + return PanicLevel, nil + case "fatal": + return FatalLevel, nil + case "error": + return ErrorLevel, nil + case "warn", "warning": + return WarnLevel, nil + case "info": + return InfoLevel, nil + case "debug": + return DebugLevel, nil + } + + var l Level + return l, fmt.Errorf("not a valid logrus Level: %q", lvl) +} + +// A constant exposing all logging levels +var AllLevels = []Level{ + PanicLevel, + FatalLevel, + ErrorLevel, + WarnLevel, + InfoLevel, + DebugLevel, +} + +// These are the different logging levels. You can set the logging level to log +// on your instance of logger, obtained with `logrus.New()`. +const ( + // PanicLevel level, highest level of severity. Logs and then calls panic with the + // message passed to Debug, Info, ... + PanicLevel Level = iota + // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the + // logging level is set to Panic. + FatalLevel + // ErrorLevel level. Logs. Used for errors that should definitely be noted. + // Commonly used for hooks to send errors to an error tracking service. + ErrorLevel + // WarnLevel level. Non-critical entries that deserve eyes. + WarnLevel + // InfoLevel level. General operational entries about what's going on inside the + // application. + InfoLevel + // DebugLevel level. Usually only enabled when debugging. Very verbose logging. + DebugLevel +) + +// Won't compile if StdLogger can't be realized by a log.Logger +var ( + _ StdLogger = &log.Logger{} + _ StdLogger = &Entry{} + _ StdLogger = &Logger{} +) + +// StdLogger is what your logrus-enabled library should take, that way +// it'll accept a stdlib logger and a logrus logger. There's no standard +// interface, this is the closest we get, unfortunately. +type StdLogger interface { + Print(...interface{}) + Printf(string, ...interface{}) + Println(...interface{}) + + Fatal(...interface{}) + Fatalf(string, ...interface{}) + Fatalln(...interface{}) + + Panic(...interface{}) + Panicf(string, ...interface{}) + Panicln(...interface{}) +} + +// The FieldLogger interface generalizes the Entry and Logger types +type FieldLogger interface { + WithField(key string, value interface{}) *Entry + WithFields(fields Fields) *Entry + WithError(err error) *Entry + + Debugf(format string, args ...interface{}) + Infof(format string, args ...interface{}) + Printf(format string, args ...interface{}) + Warnf(format string, args ...interface{}) + Warningf(format string, args ...interface{}) + Errorf(format string, args ...interface{}) + Fatalf(format string, args ...interface{}) + Panicf(format string, args ...interface{}) + + Debug(args ...interface{}) + Info(args ...interface{}) + Print(args ...interface{}) + Warn(args ...interface{}) + Warning(args ...interface{}) + Error(args ...interface{}) + Fatal(args ...interface{}) + Panic(args ...interface{}) + + Debugln(args ...interface{}) + Infoln(args ...interface{}) + Println(args ...interface{}) + Warnln(args ...interface{}) + Warningln(args ...interface{}) + Errorln(args ...interface{}) + Fatalln(args ...interface{}) + Panicln(args ...interface{}) +} diff --git a/vendor/github.com/Sirupsen/logrus/logrus_test.go b/vendor/github.com/Sirupsen/logrus/logrus_test.go index 71cc07ded2..78cbc28259 100644 --- a/vendor/github.com/Sirupsen/logrus/logrus_test.go +++ b/vendor/github.com/Sirupsen/logrus/logrus_test.go @@ -1,386 +1,386 @@ -package logrus - -import ( - "bytes" - "encoding/json" - "strconv" - "strings" - "sync" - "testing" - - "github.com/stretchr/testify/assert" -) - -func LogAndAssertJSON(t *testing.T, log func(*Logger), assertions func(fields Fields)) { - var buffer bytes.Buffer - var fields Fields - - logger := New() - logger.Out = &buffer - logger.Formatter = new(JSONFormatter) - - log(logger) - - err := json.Unmarshal(buffer.Bytes(), &fields) - assert.Nil(t, err) - - assertions(fields) -} - -func LogAndAssertText(t *testing.T, log func(*Logger), assertions func(fields map[string]string)) { - var buffer bytes.Buffer - - logger := New() - logger.Out = &buffer - logger.Formatter = &TextFormatter{ - DisableColors: true, - } - - log(logger) - - fields := make(map[string]string) - for _, kv := range strings.Split(buffer.String(), " ") { - if !strings.Contains(kv, "=") { - continue - } - kvArr := strings.Split(kv, "=") - key := strings.TrimSpace(kvArr[0]) - val := kvArr[1] - if kvArr[1][0] == '"' { - var err error - val, err = strconv.Unquote(val) - assert.NoError(t, err) - } - fields[key] = val - } - assertions(fields) -} - -func TestPrint(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Print("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["level"], "info") - }) -} - -func TestInfo(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["level"], "info") - }) -} - -func TestWarn(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Warn("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["level"], "warning") - }) -} - -func TestInfolnShouldAddSpacesBetweenStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln("test", "test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test test") - }) -} - -func TestInfolnShouldAddSpacesBetweenStringAndNonstring(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln("test", 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test 10") - }) -} - -func TestInfolnShouldAddSpacesBetweenTwoNonStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln(10, 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "10 10") - }) -} - -func TestInfoShouldAddSpacesBetweenTwoNonStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Infoln(10, 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "10 10") - }) -} - -func TestInfoShouldNotAddSpacesBetweenStringAndNonstring(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Info("test", 10) - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test10") - }) -} - -func TestInfoShouldNotAddSpacesBetweenStrings(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.Info("test", "test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "testtest") - }) -} - -func TestWithFieldsShouldAllowAssignments(t *testing.T) { - var buffer bytes.Buffer - var fields Fields - - logger := New() - logger.Out = &buffer - logger.Formatter = new(JSONFormatter) - - localLog := logger.WithFields(Fields{ - "key1": "value1", - }) - - localLog.WithField("key2", "value2").Info("test") - err := json.Unmarshal(buffer.Bytes(), &fields) - assert.Nil(t, err) - - assert.Equal(t, "value2", fields["key2"]) - assert.Equal(t, "value1", fields["key1"]) - - buffer = bytes.Buffer{} - fields = Fields{} - localLog.Info("test") - err = json.Unmarshal(buffer.Bytes(), &fields) - assert.Nil(t, err) - - _, ok := fields["key2"] - assert.Equal(t, false, ok) - assert.Equal(t, "value1", fields["key1"]) -} - -func TestUserSuppliedFieldDoesNotOverwriteDefaults(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("msg", "hello").Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - }) -} - -func TestUserSuppliedMsgFieldHasPrefix(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("msg", "hello").Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["msg"], "test") - assert.Equal(t, fields["fields.msg"], "hello") - }) -} - -func TestUserSuppliedTimeFieldHasPrefix(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("time", "hello").Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["fields.time"], "hello") - }) -} - -func TestUserSuppliedLevelFieldHasPrefix(t *testing.T) { - LogAndAssertJSON(t, func(log *Logger) { - log.WithField("level", 1).Info("test") - }, func(fields Fields) { - assert.Equal(t, fields["level"], "info") - assert.Equal(t, fields["fields.level"], 1.0) // JSON has floats only - }) -} - -func TestDefaultFieldsAreNotPrefixed(t *testing.T) { - LogAndAssertText(t, func(log *Logger) { - ll := log.WithField("herp", "derp") - ll.Info("hello") - ll.Info("bye") - }, func(fields map[string]string) { - for _, fieldName := range []string{"fields.level", "fields.time", "fields.msg"} { - if _, ok := fields[fieldName]; ok { - t.Fatalf("should not have prefixed %q: %v", fieldName, fields) - } - } - }) -} - -func TestDoubleLoggingDoesntPrefixPreviousFields(t *testing.T) { - - var buffer bytes.Buffer - var fields Fields - - logger := New() - logger.Out = &buffer - logger.Formatter = new(JSONFormatter) - - llog := logger.WithField("context", "eating raw fish") - - llog.Info("looks delicious") - - err := json.Unmarshal(buffer.Bytes(), &fields) - assert.NoError(t, err, "should have decoded first message") - assert.Equal(t, len(fields), 4, "should only have msg/time/level/context fields") - assert.Equal(t, fields["msg"], "looks delicious") - assert.Equal(t, fields["context"], "eating raw fish") - - buffer.Reset() - - llog.Warn("omg it is!") - - err = json.Unmarshal(buffer.Bytes(), &fields) - assert.NoError(t, err, "should have decoded second message") - assert.Equal(t, len(fields), 4, "should only have msg/time/level/context fields") - assert.Equal(t, fields["msg"], "omg it is!") - assert.Equal(t, fields["context"], "eating raw fish") - assert.Nil(t, fields["fields.msg"], "should not have prefixed previous `msg` entry") - -} - -func TestConvertLevelToString(t *testing.T) { - assert.Equal(t, "debug", DebugLevel.String()) - assert.Equal(t, "info", InfoLevel.String()) - assert.Equal(t, "warning", WarnLevel.String()) - assert.Equal(t, "error", ErrorLevel.String()) - assert.Equal(t, "fatal", FatalLevel.String()) - assert.Equal(t, "panic", PanicLevel.String()) -} - -func TestParseLevel(t *testing.T) { - l, err := ParseLevel("panic") - assert.Nil(t, err) - assert.Equal(t, PanicLevel, l) - - l, err = ParseLevel("PANIC") - assert.Nil(t, err) - assert.Equal(t, PanicLevel, l) - - l, err = ParseLevel("fatal") - assert.Nil(t, err) - assert.Equal(t, FatalLevel, l) - - l, err = ParseLevel("FATAL") - assert.Nil(t, err) - assert.Equal(t, FatalLevel, l) - - l, err = ParseLevel("error") - assert.Nil(t, err) - assert.Equal(t, ErrorLevel, l) - - l, err = ParseLevel("ERROR") - assert.Nil(t, err) - assert.Equal(t, ErrorLevel, l) - - l, err = ParseLevel("warn") - assert.Nil(t, err) - assert.Equal(t, WarnLevel, l) - - l, err = ParseLevel("WARN") - assert.Nil(t, err) - assert.Equal(t, WarnLevel, l) - - l, err = ParseLevel("warning") - assert.Nil(t, err) - assert.Equal(t, WarnLevel, l) - - l, err = ParseLevel("WARNING") - assert.Nil(t, err) - assert.Equal(t, WarnLevel, l) - - l, err = ParseLevel("info") - assert.Nil(t, err) - assert.Equal(t, InfoLevel, l) - - l, err = ParseLevel("INFO") - assert.Nil(t, err) - assert.Equal(t, InfoLevel, l) - - l, err = ParseLevel("debug") - assert.Nil(t, err) - assert.Equal(t, DebugLevel, l) - - l, err = ParseLevel("DEBUG") - assert.Nil(t, err) - assert.Equal(t, DebugLevel, l) - - l, err = ParseLevel("invalid") - assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error()) -} - -func TestGetSetLevelRace(t *testing.T) { - wg := sync.WaitGroup{} - for i := 0; i < 100; i++ { - wg.Add(1) - go func(i int) { - defer wg.Done() - if i%2 == 0 { - SetLevel(InfoLevel) - } else { - GetLevel() - } - }(i) - - } - wg.Wait() -} - -func TestLoggingRace(t *testing.T) { - logger := New() - - var wg sync.WaitGroup - wg.Add(100) - - for i := 0; i < 100; i++ { - go func() { - logger.Info("info") - wg.Done() - }() - } - wg.Wait() -} - -// Compile test -func TestLogrusInterface(t *testing.T) { - var buffer bytes.Buffer - fn := func(l FieldLogger) { - b := l.WithField("key", "value") - b.Debug("Test") - } - // test logger - logger := New() - logger.Out = &buffer - fn(logger) - - // test Entry - e := logger.WithField("another", "value") - fn(e) -} - -// Implements io.Writer using channels for synchronization, so we can wait on -// the Entry.Writer goroutine to write in a non-racey way. This does assume that -// there is a single call to Logger.Out for each message. -type channelWriter chan []byte - -func (cw channelWriter) Write(p []byte) (int, error) { - cw <- p - return len(p), nil -} - -func TestEntryWriter(t *testing.T) { - cw := channelWriter(make(chan []byte, 1)) - log := New() - log.Out = cw - log.Formatter = new(JSONFormatter) - log.WithField("foo", "bar").WriterLevel(WarnLevel).Write([]byte("hello\n")) - - bs := <-cw - var fields Fields - err := json.Unmarshal(bs, &fields) - assert.Nil(t, err) - assert.Equal(t, fields["foo"], "bar") - assert.Equal(t, fields["level"], "warning") -} +package logrus + +import ( + "bytes" + "encoding/json" + "strconv" + "strings" + "sync" + "testing" + + "github.com/stretchr/testify/assert" +) + +func LogAndAssertJSON(t *testing.T, log func(*Logger), assertions func(fields Fields)) { + var buffer bytes.Buffer + var fields Fields + + logger := New() + logger.Out = &buffer + logger.Formatter = new(JSONFormatter) + + log(logger) + + err := json.Unmarshal(buffer.Bytes(), &fields) + assert.Nil(t, err) + + assertions(fields) +} + +func LogAndAssertText(t *testing.T, log func(*Logger), assertions func(fields map[string]string)) { + var buffer bytes.Buffer + + logger := New() + logger.Out = &buffer + logger.Formatter = &TextFormatter{ + DisableColors: true, + } + + log(logger) + + fields := make(map[string]string) + for _, kv := range strings.Split(buffer.String(), " ") { + if !strings.Contains(kv, "=") { + continue + } + kvArr := strings.Split(kv, "=") + key := strings.TrimSpace(kvArr[0]) + val := kvArr[1] + if kvArr[1][0] == '"' { + var err error + val, err = strconv.Unquote(val) + assert.NoError(t, err) + } + fields[key] = val + } + assertions(fields) +} + +func TestPrint(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Print("test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test") + assert.Equal(t, fields["level"], "info") + }) +} + +func TestInfo(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Info("test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test") + assert.Equal(t, fields["level"], "info") + }) +} + +func TestWarn(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Warn("test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test") + assert.Equal(t, fields["level"], "warning") + }) +} + +func TestInfolnShouldAddSpacesBetweenStrings(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Infoln("test", "test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test test") + }) +} + +func TestInfolnShouldAddSpacesBetweenStringAndNonstring(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Infoln("test", 10) + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test 10") + }) +} + +func TestInfolnShouldAddSpacesBetweenTwoNonStrings(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Infoln(10, 10) + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "10 10") + }) +} + +func TestInfoShouldAddSpacesBetweenTwoNonStrings(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Infoln(10, 10) + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "10 10") + }) +} + +func TestInfoShouldNotAddSpacesBetweenStringAndNonstring(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Info("test", 10) + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test10") + }) +} + +func TestInfoShouldNotAddSpacesBetweenStrings(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.Info("test", "test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "testtest") + }) +} + +func TestWithFieldsShouldAllowAssignments(t *testing.T) { + var buffer bytes.Buffer + var fields Fields + + logger := New() + logger.Out = &buffer + logger.Formatter = new(JSONFormatter) + + localLog := logger.WithFields(Fields{ + "key1": "value1", + }) + + localLog.WithField("key2", "value2").Info("test") + err := json.Unmarshal(buffer.Bytes(), &fields) + assert.Nil(t, err) + + assert.Equal(t, "value2", fields["key2"]) + assert.Equal(t, "value1", fields["key1"]) + + buffer = bytes.Buffer{} + fields = Fields{} + localLog.Info("test") + err = json.Unmarshal(buffer.Bytes(), &fields) + assert.Nil(t, err) + + _, ok := fields["key2"] + assert.Equal(t, false, ok) + assert.Equal(t, "value1", fields["key1"]) +} + +func TestUserSuppliedFieldDoesNotOverwriteDefaults(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.WithField("msg", "hello").Info("test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test") + }) +} + +func TestUserSuppliedMsgFieldHasPrefix(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.WithField("msg", "hello").Info("test") + }, func(fields Fields) { + assert.Equal(t, fields["msg"], "test") + assert.Equal(t, fields["fields.msg"], "hello") + }) +} + +func TestUserSuppliedTimeFieldHasPrefix(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.WithField("time", "hello").Info("test") + }, func(fields Fields) { + assert.Equal(t, fields["fields.time"], "hello") + }) +} + +func TestUserSuppliedLevelFieldHasPrefix(t *testing.T) { + LogAndAssertJSON(t, func(log *Logger) { + log.WithField("level", 1).Info("test") + }, func(fields Fields) { + assert.Equal(t, fields["level"], "info") + assert.Equal(t, fields["fields.level"], 1.0) // JSON has floats only + }) +} + +func TestDefaultFieldsAreNotPrefixed(t *testing.T) { + LogAndAssertText(t, func(log *Logger) { + ll := log.WithField("herp", "derp") + ll.Info("hello") + ll.Info("bye") + }, func(fields map[string]string) { + for _, fieldName := range []string{"fields.level", "fields.time", "fields.msg"} { + if _, ok := fields[fieldName]; ok { + t.Fatalf("should not have prefixed %q: %v", fieldName, fields) + } + } + }) +} + +func TestDoubleLoggingDoesntPrefixPreviousFields(t *testing.T) { + + var buffer bytes.Buffer + var fields Fields + + logger := New() + logger.Out = &buffer + logger.Formatter = new(JSONFormatter) + + llog := logger.WithField("context", "eating raw fish") + + llog.Info("looks delicious") + + err := json.Unmarshal(buffer.Bytes(), &fields) + assert.NoError(t, err, "should have decoded first message") + assert.Equal(t, len(fields), 4, "should only have msg/time/level/context fields") + assert.Equal(t, fields["msg"], "looks delicious") + assert.Equal(t, fields["context"], "eating raw fish") + + buffer.Reset() + + llog.Warn("omg it is!") + + err = json.Unmarshal(buffer.Bytes(), &fields) + assert.NoError(t, err, "should have decoded second message") + assert.Equal(t, len(fields), 4, "should only have msg/time/level/context fields") + assert.Equal(t, fields["msg"], "omg it is!") + assert.Equal(t, fields["context"], "eating raw fish") + assert.Nil(t, fields["fields.msg"], "should not have prefixed previous `msg` entry") + +} + +func TestConvertLevelToString(t *testing.T) { + assert.Equal(t, "debug", DebugLevel.String()) + assert.Equal(t, "info", InfoLevel.String()) + assert.Equal(t, "warning", WarnLevel.String()) + assert.Equal(t, "error", ErrorLevel.String()) + assert.Equal(t, "fatal", FatalLevel.String()) + assert.Equal(t, "panic", PanicLevel.String()) +} + +func TestParseLevel(t *testing.T) { + l, err := ParseLevel("panic") + assert.Nil(t, err) + assert.Equal(t, PanicLevel, l) + + l, err = ParseLevel("PANIC") + assert.Nil(t, err) + assert.Equal(t, PanicLevel, l) + + l, err = ParseLevel("fatal") + assert.Nil(t, err) + assert.Equal(t, FatalLevel, l) + + l, err = ParseLevel("FATAL") + assert.Nil(t, err) + assert.Equal(t, FatalLevel, l) + + l, err = ParseLevel("error") + assert.Nil(t, err) + assert.Equal(t, ErrorLevel, l) + + l, err = ParseLevel("ERROR") + assert.Nil(t, err) + assert.Equal(t, ErrorLevel, l) + + l, err = ParseLevel("warn") + assert.Nil(t, err) + assert.Equal(t, WarnLevel, l) + + l, err = ParseLevel("WARN") + assert.Nil(t, err) + assert.Equal(t, WarnLevel, l) + + l, err = ParseLevel("warning") + assert.Nil(t, err) + assert.Equal(t, WarnLevel, l) + + l, err = ParseLevel("WARNING") + assert.Nil(t, err) + assert.Equal(t, WarnLevel, l) + + l, err = ParseLevel("info") + assert.Nil(t, err) + assert.Equal(t, InfoLevel, l) + + l, err = ParseLevel("INFO") + assert.Nil(t, err) + assert.Equal(t, InfoLevel, l) + + l, err = ParseLevel("debug") + assert.Nil(t, err) + assert.Equal(t, DebugLevel, l) + + l, err = ParseLevel("DEBUG") + assert.Nil(t, err) + assert.Equal(t, DebugLevel, l) + + l, err = ParseLevel("invalid") + assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error()) +} + +func TestGetSetLevelRace(t *testing.T) { + wg := sync.WaitGroup{} + for i := 0; i < 100; i++ { + wg.Add(1) + go func(i int) { + defer wg.Done() + if i%2 == 0 { + SetLevel(InfoLevel) + } else { + GetLevel() + } + }(i) + + } + wg.Wait() +} + +func TestLoggingRace(t *testing.T) { + logger := New() + + var wg sync.WaitGroup + wg.Add(100) + + for i := 0; i < 100; i++ { + go func() { + logger.Info("info") + wg.Done() + }() + } + wg.Wait() +} + +// Compile test +func TestLogrusInterface(t *testing.T) { + var buffer bytes.Buffer + fn := func(l FieldLogger) { + b := l.WithField("key", "value") + b.Debug("Test") + } + // test logger + logger := New() + logger.Out = &buffer + fn(logger) + + // test Entry + e := logger.WithField("another", "value") + fn(e) +} + +// Implements io.Writer using channels for synchronization, so we can wait on +// the Entry.Writer goroutine to write in a non-racey way. This does assume that +// there is a single call to Logger.Out for each message. +type channelWriter chan []byte + +func (cw channelWriter) Write(p []byte) (int, error) { + cw <- p + return len(p), nil +} + +func TestEntryWriter(t *testing.T) { + cw := channelWriter(make(chan []byte, 1)) + log := New() + log.Out = cw + log.Formatter = new(JSONFormatter) + log.WithField("foo", "bar").WriterLevel(WarnLevel).Write([]byte("hello\n")) + + bs := <-cw + var fields Fields + err := json.Unmarshal(bs, &fields) + assert.Nil(t, err) + assert.Equal(t, fields["foo"], "bar") + assert.Equal(t, fields["level"], "warning") +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_appengine.go b/vendor/github.com/Sirupsen/logrus/terminal_appengine.go index 6836673941..e011a86945 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_appengine.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_appengine.go @@ -1,10 +1,10 @@ -// +build appengine - -package logrus - -import "io" - -// IsTerminal returns true if stderr's file descriptor is a terminal. -func IsTerminal(f io.Writer) bool { - return true -} +// +build appengine + +package logrus + +import "io" + +// IsTerminal returns true if stderr's file descriptor is a terminal. +func IsTerminal(f io.Writer) bool { + return true +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go index f7f042c13a..5f6be4d3c0 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_bsd.go @@ -1,10 +1,10 @@ -// +build darwin freebsd openbsd netbsd dragonfly -// +build !appengine - -package logrus - -import "syscall" - -const ioctlReadTermios = syscall.TIOCGETA - -type Termios syscall.Termios +// +build darwin freebsd openbsd netbsd dragonfly +// +build !appengine + +package logrus + +import "syscall" + +const ioctlReadTermios = syscall.TIOCGETA + +type Termios syscall.Termios diff --git a/vendor/github.com/Sirupsen/logrus/terminal_linux.go b/vendor/github.com/Sirupsen/logrus/terminal_linux.go index 09651f2047..308160ca80 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_linux.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_linux.go @@ -1,14 +1,14 @@ -// Based on ssh/terminal: -// 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. - -// +build !appengine - -package logrus - -import "syscall" - -const ioctlReadTermios = syscall.TCGETS - -type Termios syscall.Termios +// Based on ssh/terminal: +// 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. + +// +build !appengine + +package logrus + +import "syscall" + +const ioctlReadTermios = syscall.TCGETS + +type Termios syscall.Termios diff --git a/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go b/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go index bd608dc18c..190297abf3 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_notwindows.go @@ -1,28 +1,28 @@ -// Based on ssh/terminal: -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux darwin freebsd openbsd netbsd dragonfly -// +build !appengine - -package logrus - -import ( - "io" - "os" - "syscall" - "unsafe" -) - -// IsTerminal returns true if stderr's file descriptor is a terminal. -func IsTerminal(f io.Writer) bool { - var termios Termios - switch v := f.(type) { - case *os.File: - _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) - return err == 0 - default: - return false - } -} +// Based on ssh/terminal: +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux darwin freebsd openbsd netbsd dragonfly +// +build !appengine + +package logrus + +import ( + "io" + "os" + "syscall" + "unsafe" +) + +// IsTerminal returns true if stderr's file descriptor is a terminal. +func IsTerminal(f io.Writer) bool { + var termios Termios + switch v := f.(type) { + case *os.File: + _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) + return err == 0 + default: + return false + } +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_solaris.go b/vendor/github.com/Sirupsen/logrus/terminal_solaris.go index b5d90263ef..3c86b1abee 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_solaris.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_solaris.go @@ -1,21 +1,21 @@ -// +build solaris,!appengine - -package logrus - -import ( - "io" - "os" - - "golang.org/x/sys/unix" -) - -// IsTerminal returns true if the given file descriptor is a terminal. -func IsTerminal(f io.Writer) bool { - switch v := f.(type) { - case *os.File: - _, err := unix.IoctlGetTermios(int(v.Fd()), unix.TCGETA) - return err == nil - default: - return false - } -} +// +build solaris,!appengine + +package logrus + +import ( + "io" + "os" + + "golang.org/x/sys/unix" +) + +// IsTerminal returns true if the given file descriptor is a terminal. +func IsTerminal(f io.Writer) bool { + switch v := f.(type) { + case *os.File: + _, err := unix.IoctlGetTermios(int(v.Fd()), unix.TCGETA) + return err == nil + default: + return false + } +} diff --git a/vendor/github.com/Sirupsen/logrus/terminal_windows.go b/vendor/github.com/Sirupsen/logrus/terminal_windows.go index 226184fad2..05d2f91f16 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_windows.go +++ b/vendor/github.com/Sirupsen/logrus/terminal_windows.go @@ -1,33 +1,33 @@ -// Based on ssh/terminal: -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows,!appengine - -package logrus - -import ( - "io" - "os" - "syscall" - "unsafe" -) - -var kernel32 = syscall.NewLazyDLL("kernel32.dll") - -var ( - procGetConsoleMode = kernel32.NewProc("GetConsoleMode") -) - -// IsTerminal returns true if stderr's file descriptor is a terminal. -func IsTerminal(f io.Writer) bool { - switch v := f.(type) { - case *os.File: - var st uint32 - r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(v.Fd()), uintptr(unsafe.Pointer(&st)), 0) - return r != 0 && e == 0 - default: - return false - } -} +// Based on ssh/terminal: +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build windows,!appengine + +package logrus + +import ( + "io" + "os" + "syscall" + "unsafe" +) + +var kernel32 = syscall.NewLazyDLL("kernel32.dll") + +var ( + procGetConsoleMode = kernel32.NewProc("GetConsoleMode") +) + +// IsTerminal returns true if stderr's file descriptor is a terminal. +func IsTerminal(f io.Writer) bool { + switch v := f.(type) { + case *os.File: + var st uint32 + r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(v.Fd()), uintptr(unsafe.Pointer(&st)), 0) + return r != 0 && e == 0 + default: + return false + } +} diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter.go b/vendor/github.com/Sirupsen/logrus/text_formatter.go index f869c543f1..ba88854061 100644 --- a/vendor/github.com/Sirupsen/logrus/text_formatter.go +++ b/vendor/github.com/Sirupsen/logrus/text_formatter.go @@ -1,189 +1,189 @@ -package logrus - -import ( - "bytes" - "fmt" - "sort" - "strings" - "sync" - "time" -) - -const ( - nocolor = 0 - red = 31 - green = 32 - yellow = 33 - blue = 34 - gray = 37 -) - -var ( - baseTimestamp time.Time -) - -func init() { - baseTimestamp = time.Now() -} - -type TextFormatter struct { - // Set to true to bypass checking for a TTY before outputting colors. - ForceColors bool - - // Force disabling colors. - DisableColors bool - - // Disable timestamp logging. useful when output is redirected to logging - // system that already adds timestamps. - DisableTimestamp bool - - // Enable logging the full timestamp when a TTY is attached instead of just - // the time passed since beginning of execution. - FullTimestamp bool - - // TimestampFormat to use for display when a full timestamp is printed - TimestampFormat string - - // The fields are sorted by default for a consistent output. For applications - // that log extremely frequently and don't use the JSON formatter this may not - // be desired. - DisableSorting bool - - // QuoteEmptyFields will wrap empty fields in quotes if true - QuoteEmptyFields bool - - // QuoteCharacter can be set to the override the default quoting character " - // with something else. For example: ', or `. - QuoteCharacter string - - // Whether the logger's out is to a terminal - isTerminal bool - - sync.Once -} - -func (f *TextFormatter) init(entry *Entry) { - if len(f.QuoteCharacter) == 0 { - f.QuoteCharacter = "\"" - } - if entry.Logger != nil { - f.isTerminal = IsTerminal(entry.Logger.Out) - } -} - -func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { - var b *bytes.Buffer - keys := make([]string, 0, len(entry.Data)) - for k := range entry.Data { - keys = append(keys, k) - } - - if !f.DisableSorting { - sort.Strings(keys) - } - if entry.Buffer != nil { - b = entry.Buffer - } else { - b = &bytes.Buffer{} - } - - prefixFieldClashes(entry.Data) - - f.Do(func() { f.init(entry) }) - - isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors - - timestampFormat := f.TimestampFormat - if timestampFormat == "" { - timestampFormat = DefaultTimestampFormat - } - if isColored { - f.printColored(b, entry, keys, timestampFormat) - } else { - if !f.DisableTimestamp { - f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat)) - } - f.appendKeyValue(b, "level", entry.Level.String()) - if entry.Message != "" { - f.appendKeyValue(b, "msg", entry.Message) - } - for _, key := range keys { - f.appendKeyValue(b, key, entry.Data[key]) - } - } - - b.WriteByte('\n') - return b.Bytes(), nil -} - -func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { - var levelColor int - switch entry.Level { - case DebugLevel: - levelColor = gray - case WarnLevel: - levelColor = yellow - case ErrorLevel, FatalLevel, PanicLevel: - levelColor = red - default: - levelColor = blue - } - - levelText := strings.ToUpper(entry.Level.String())[0:4] - - if f.DisableTimestamp { - fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message) - } else if !f.FullTimestamp { - fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message) - } else { - fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message) - } - for _, k := range keys { - v := entry.Data[k] - fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k) - f.appendValue(b, v) - } -} - -func (f *TextFormatter) needsQuoting(text string) bool { - if f.QuoteEmptyFields && len(text) == 0 { - return true - } - for _, ch := range text { - if !((ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z') || - (ch >= '0' && ch <= '9') || - ch == '-' || ch == '.') { - return true - } - } - return false -} - -func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { - - b.WriteString(key) - b.WriteByte('=') - f.appendValue(b, value) - b.WriteByte(' ') -} - -func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) { - switch value := value.(type) { - case string: - if !f.needsQuoting(value) { - b.WriteString(value) - } else { - fmt.Fprintf(b, "%s%v%s", f.QuoteCharacter, value, f.QuoteCharacter) - } - case error: - errmsg := value.Error() - if !f.needsQuoting(errmsg) { - b.WriteString(errmsg) - } else { - fmt.Fprintf(b, "%s%v%s", f.QuoteCharacter, errmsg, f.QuoteCharacter) - } - default: - fmt.Fprint(b, value) - } -} +package logrus + +import ( + "bytes" + "fmt" + "sort" + "strings" + "sync" + "time" +) + +const ( + nocolor = 0 + red = 31 + green = 32 + yellow = 33 + blue = 34 + gray = 37 +) + +var ( + baseTimestamp time.Time +) + +func init() { + baseTimestamp = time.Now() +} + +type TextFormatter struct { + // Set to true to bypass checking for a TTY before outputting colors. + ForceColors bool + + // Force disabling colors. + DisableColors bool + + // Disable timestamp logging. useful when output is redirected to logging + // system that already adds timestamps. + DisableTimestamp bool + + // Enable logging the full timestamp when a TTY is attached instead of just + // the time passed since beginning of execution. + FullTimestamp bool + + // TimestampFormat to use for display when a full timestamp is printed + TimestampFormat string + + // The fields are sorted by default for a consistent output. For applications + // that log extremely frequently and don't use the JSON formatter this may not + // be desired. + DisableSorting bool + + // QuoteEmptyFields will wrap empty fields in quotes if true + QuoteEmptyFields bool + + // QuoteCharacter can be set to the override the default quoting character " + // with something else. For example: ', or `. + QuoteCharacter string + + // Whether the logger's out is to a terminal + isTerminal bool + + sync.Once +} + +func (f *TextFormatter) init(entry *Entry) { + if len(f.QuoteCharacter) == 0 { + f.QuoteCharacter = "\"" + } + if entry.Logger != nil { + f.isTerminal = IsTerminal(entry.Logger.Out) + } +} + +func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { + var b *bytes.Buffer + keys := make([]string, 0, len(entry.Data)) + for k := range entry.Data { + keys = append(keys, k) + } + + if !f.DisableSorting { + sort.Strings(keys) + } + if entry.Buffer != nil { + b = entry.Buffer + } else { + b = &bytes.Buffer{} + } + + prefixFieldClashes(entry.Data) + + f.Do(func() { f.init(entry) }) + + isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors + + timestampFormat := f.TimestampFormat + if timestampFormat == "" { + timestampFormat = DefaultTimestampFormat + } + if isColored { + f.printColored(b, entry, keys, timestampFormat) + } else { + if !f.DisableTimestamp { + f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat)) + } + f.appendKeyValue(b, "level", entry.Level.String()) + if entry.Message != "" { + f.appendKeyValue(b, "msg", entry.Message) + } + for _, key := range keys { + f.appendKeyValue(b, key, entry.Data[key]) + } + } + + b.WriteByte('\n') + return b.Bytes(), nil +} + +func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { + var levelColor int + switch entry.Level { + case DebugLevel: + levelColor = gray + case WarnLevel: + levelColor = yellow + case ErrorLevel, FatalLevel, PanicLevel: + levelColor = red + default: + levelColor = blue + } + + levelText := strings.ToUpper(entry.Level.String())[0:4] + + if f.DisableTimestamp { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message) + } else if !f.FullTimestamp { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message) + } else { + fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message) + } + for _, k := range keys { + v := entry.Data[k] + fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k) + f.appendValue(b, v) + } +} + +func (f *TextFormatter) needsQuoting(text string) bool { + if f.QuoteEmptyFields && len(text) == 0 { + return true + } + for _, ch := range text { + if !((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || + ch == '-' || ch == '.') { + return true + } + } + return false +} + +func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { + + b.WriteString(key) + b.WriteByte('=') + f.appendValue(b, value) + b.WriteByte(' ') +} + +func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) { + switch value := value.(type) { + case string: + if !f.needsQuoting(value) { + b.WriteString(value) + } else { + fmt.Fprintf(b, "%s%v%s", f.QuoteCharacter, value, f.QuoteCharacter) + } + case error: + errmsg := value.Error() + if !f.needsQuoting(errmsg) { + b.WriteString(errmsg) + } else { + fmt.Fprintf(b, "%s%v%s", f.QuoteCharacter, errmsg, f.QuoteCharacter) + } + default: + fmt.Fprint(b, value) + } +} diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter_test.go b/vendor/github.com/Sirupsen/logrus/text_formatter_test.go index e9faabe46b..9793b5f37d 100644 --- a/vendor/github.com/Sirupsen/logrus/text_formatter_test.go +++ b/vendor/github.com/Sirupsen/logrus/text_formatter_test.go @@ -1,87 +1,87 @@ -package logrus - -import ( - "bytes" - "errors" - "strings" - "testing" - "time" -) - -func TestQuoting(t *testing.T) { - tf := &TextFormatter{DisableColors: true} - - checkQuoting := func(q bool, value interface{}) { - b, _ := tf.Format(WithField("test", value)) - idx := bytes.Index(b, ([]byte)("test=")) - cont := bytes.Contains(b[idx+5:], []byte(tf.QuoteCharacter)) - if cont != q { - if q { - t.Errorf("quoting expected for: %#v", value) - } else { - t.Errorf("quoting not expected for: %#v", value) - } - } - } - - checkQuoting(false, "") - checkQuoting(false, "abcd") - checkQuoting(false, "v1.0") - checkQuoting(false, "1234567890") - checkQuoting(true, "/foobar") - checkQuoting(true, "x y") - checkQuoting(true, "x,y") - checkQuoting(false, errors.New("invalid")) - checkQuoting(true, errors.New("invalid argument")) - - // Test for custom quote character. - tf.QuoteCharacter = "`" - checkQuoting(false, "") - checkQuoting(false, "abcd") - checkQuoting(true, "/foobar") - checkQuoting(true, errors.New("invalid argument")) - - // Test for multi-character quotes. - tf.QuoteCharacter = "§~±" - checkQuoting(false, "abcd") - checkQuoting(true, errors.New("invalid argument")) - - // Test for quoting empty fields. - tf.QuoteEmptyFields = true - checkQuoting(true, "") - checkQuoting(false, "abcd") - checkQuoting(true, errors.New("invalid argument")) -} - -func TestTimestampFormat(t *testing.T) { - checkTimeStr := func(format string) { - customFormatter := &TextFormatter{DisableColors: true, TimestampFormat: format} - customStr, _ := customFormatter.Format(WithField("test", "test")) - timeStart := bytes.Index(customStr, ([]byte)("time=")) - timeEnd := bytes.Index(customStr, ([]byte)("level=")) - timeStr := customStr[timeStart+5+len(customFormatter.QuoteCharacter) : timeEnd-1-len(customFormatter.QuoteCharacter)] - if format == "" { - format = time.RFC3339 - } - _, e := time.Parse(format, (string)(timeStr)) - if e != nil { - t.Errorf("time string \"%s\" did not match provided time format \"%s\": %s", timeStr, format, e) - } - } - - checkTimeStr("2006-01-02T15:04:05.000000000Z07:00") - checkTimeStr("Mon Jan _2 15:04:05 2006") - checkTimeStr("") -} - -func TestDisableTimestampWithColoredOutput(t *testing.T) { - tf := &TextFormatter{DisableTimestamp: true, ForceColors: true} - - b, _ := tf.Format(WithField("test", "test")) - if strings.Contains(string(b), "[0000]") { - t.Error("timestamp not expected when DisableTimestamp is true") - } -} - -// TODO add tests for sorting etc., this requires a parser for the text -// formatter output. +package logrus + +import ( + "bytes" + "errors" + "strings" + "testing" + "time" +) + +func TestQuoting(t *testing.T) { + tf := &TextFormatter{DisableColors: true} + + checkQuoting := func(q bool, value interface{}) { + b, _ := tf.Format(WithField("test", value)) + idx := bytes.Index(b, ([]byte)("test=")) + cont := bytes.Contains(b[idx+5:], []byte(tf.QuoteCharacter)) + if cont != q { + if q { + t.Errorf("quoting expected for: %#v", value) + } else { + t.Errorf("quoting not expected for: %#v", value) + } + } + } + + checkQuoting(false, "") + checkQuoting(false, "abcd") + checkQuoting(false, "v1.0") + checkQuoting(false, "1234567890") + checkQuoting(true, "/foobar") + checkQuoting(true, "x y") + checkQuoting(true, "x,y") + checkQuoting(false, errors.New("invalid")) + checkQuoting(true, errors.New("invalid argument")) + + // Test for custom quote character. + tf.QuoteCharacter = "`" + checkQuoting(false, "") + checkQuoting(false, "abcd") + checkQuoting(true, "/foobar") + checkQuoting(true, errors.New("invalid argument")) + + // Test for multi-character quotes. + tf.QuoteCharacter = "§~±" + checkQuoting(false, "abcd") + checkQuoting(true, errors.New("invalid argument")) + + // Test for quoting empty fields. + tf.QuoteEmptyFields = true + checkQuoting(true, "") + checkQuoting(false, "abcd") + checkQuoting(true, errors.New("invalid argument")) +} + +func TestTimestampFormat(t *testing.T) { + checkTimeStr := func(format string) { + customFormatter := &TextFormatter{DisableColors: true, TimestampFormat: format} + customStr, _ := customFormatter.Format(WithField("test", "test")) + timeStart := bytes.Index(customStr, ([]byte)("time=")) + timeEnd := bytes.Index(customStr, ([]byte)("level=")) + timeStr := customStr[timeStart+5+len(customFormatter.QuoteCharacter) : timeEnd-1-len(customFormatter.QuoteCharacter)] + if format == "" { + format = time.RFC3339 + } + _, e := time.Parse(format, (string)(timeStr)) + if e != nil { + t.Errorf("time string \"%s\" did not match provided time format \"%s\": %s", timeStr, format, e) + } + } + + checkTimeStr("2006-01-02T15:04:05.000000000Z07:00") + checkTimeStr("Mon Jan _2 15:04:05 2006") + checkTimeStr("") +} + +func TestDisableTimestampWithColoredOutput(t *testing.T) { + tf := &TextFormatter{DisableTimestamp: true, ForceColors: true} + + b, _ := tf.Format(WithField("test", "test")) + if strings.Contains(string(b), "[0000]") { + t.Error("timestamp not expected when DisableTimestamp is true") + } +} + +// TODO add tests for sorting etc., this requires a parser for the text +// formatter output. diff --git a/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/Sirupsen/logrus/writer.go index 6526e0b2e2..7bdebedc60 100644 --- a/vendor/github.com/Sirupsen/logrus/writer.go +++ b/vendor/github.com/Sirupsen/logrus/writer.go @@ -1,62 +1,62 @@ -package logrus - -import ( - "bufio" - "io" - "runtime" -) - -func (logger *Logger) Writer() *io.PipeWriter { - return logger.WriterLevel(InfoLevel) -} - -func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { - return NewEntry(logger).WriterLevel(level) -} - -func (entry *Entry) Writer() *io.PipeWriter { - return entry.WriterLevel(InfoLevel) -} - -func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { - reader, writer := io.Pipe() - - var printFunc func(args ...interface{}) - - switch level { - case DebugLevel: - printFunc = entry.Debug - case InfoLevel: - printFunc = entry.Info - case WarnLevel: - printFunc = entry.Warn - case ErrorLevel: - printFunc = entry.Error - case FatalLevel: - printFunc = entry.Fatal - case PanicLevel: - printFunc = entry.Panic - default: - printFunc = entry.Print - } - - go entry.writerScanner(reader, printFunc) - runtime.SetFinalizer(writer, writerFinalizer) - - return writer -} - -func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { - scanner := bufio.NewScanner(reader) - for scanner.Scan() { - printFunc(scanner.Text()) - } - if err := scanner.Err(); err != nil { - entry.Errorf("Error while reading from Writer: %s", err) - } - reader.Close() -} - -func writerFinalizer(writer *io.PipeWriter) { - writer.Close() -} +package logrus + +import ( + "bufio" + "io" + "runtime" +) + +func (logger *Logger) Writer() *io.PipeWriter { + return logger.WriterLevel(InfoLevel) +} + +func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { + return NewEntry(logger).WriterLevel(level) +} + +func (entry *Entry) Writer() *io.PipeWriter { + return entry.WriterLevel(InfoLevel) +} + +func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { + reader, writer := io.Pipe() + + var printFunc func(args ...interface{}) + + switch level { + case DebugLevel: + printFunc = entry.Debug + case InfoLevel: + printFunc = entry.Info + case WarnLevel: + printFunc = entry.Warn + case ErrorLevel: + printFunc = entry.Error + case FatalLevel: + printFunc = entry.Fatal + case PanicLevel: + printFunc = entry.Panic + default: + printFunc = entry.Print + } + + go entry.writerScanner(reader, printFunc) + runtime.SetFinalizer(writer, writerFinalizer) + + return writer +} + +func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + printFunc(scanner.Text()) + } + if err := scanner.Err(); err != nil { + entry.Errorf("Error while reading from Writer: %s", err) + } + reader.Close() +} + +func writerFinalizer(writer *io.PipeWriter) { + writer.Close() +} diff --git a/vendor/github.com/dgrijalva/jwt-go/.gitignore b/vendor/github.com/dgrijalva/jwt-go/.gitignore index 6a8ca8d4f4..80bed650ec 100644 --- a/vendor/github.com/dgrijalva/jwt-go/.gitignore +++ b/vendor/github.com/dgrijalva/jwt-go/.gitignore @@ -1,4 +1,4 @@ -.DS_Store -bin - - +.DS_Store +bin + + diff --git a/vendor/github.com/dgrijalva/jwt-go/.travis.yml b/vendor/github.com/dgrijalva/jwt-go/.travis.yml index 724d638283..1027f56cd9 100644 --- a/vendor/github.com/dgrijalva/jwt-go/.travis.yml +++ b/vendor/github.com/dgrijalva/jwt-go/.travis.yml @@ -1,13 +1,13 @@ -language: go - -script: - - go vet ./... - - go test -v ./... - -go: - - 1.3 - - 1.4 - - 1.5 - - 1.6 - - 1.7 - - tip +language: go + +script: + - go vet ./... + - go test -v ./... + +go: + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - 1.7 + - tip diff --git a/vendor/github.com/dgrijalva/jwt-go/LICENSE b/vendor/github.com/dgrijalva/jwt-go/LICENSE index 69fd01aa65..df83a9c2f0 100644 --- a/vendor/github.com/dgrijalva/jwt-go/LICENSE +++ b/vendor/github.com/dgrijalva/jwt-go/LICENSE @@ -1,8 +1,8 @@ -Copyright (c) 2012 Dave Grijalva - -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 Dave Grijalva + +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/dgrijalva/jwt-go/MIGRATION_GUIDE.md b/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md index 4157ed4100..7fc1f793cb 100644 --- a/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md +++ b/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md @@ -1,97 +1,97 @@ -## Migration Guide from v2 -> v3 - -Version 3 adds several new, frequently requested features. To do so, it introduces a few breaking changes. We've worked to keep these as minimal as possible. This guide explains the breaking changes and how you can quickly update your code. - -### `Token.Claims` is now an interface type - -The most requested feature from the 2.0 verison of this library was the ability to provide a custom type to the JSON parser for claims. This was implemented by introducing a new interface, `Claims`, to replace `map[string]interface{}`. We also included two concrete implementations of `Claims`: `MapClaims` and `StandardClaims`. - -`MapClaims` is an alias for `map[string]interface{}` with built in validation behavior. It is the default claims type when using `Parse`. The usage is unchanged except you must type cast the claims property. - -The old example for parsing a token looked like this.. - -```go - if token, err := jwt.Parse(tokenString, keyLookupFunc); err == nil { - fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"]) - } -``` - -is now directly mapped to... - -```go - if token, err := jwt.Parse(tokenString, keyLookupFunc); err == nil { - claims := token.Claims.(jwt.MapClaims) - fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"]) - } -``` - -`StandardClaims` is designed to be embedded in your custom type. You can supply a custom claims type with the new `ParseWithClaims` function. Here's an example of using a custom claims type. - -```go - type MyCustomClaims struct { - User string - *StandardClaims - } - - if token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, keyLookupFunc); err == nil { - claims := token.Claims.(*MyCustomClaims) - fmt.Printf("Token for user %v expires %v", claims.User, claims.StandardClaims.ExpiresAt) - } -``` - -### `ParseFromRequest` has been moved - -To keep this library focused on the tokens without becoming overburdened with complex request processing logic, `ParseFromRequest` and its new companion `ParseFromRequestWithClaims` have been moved to a subpackage, `request`. The method signatues have also been augmented to receive a new argument: `Extractor`. - -`Extractors` do the work of picking the token string out of a request. The interface is simple and composable. - -This simple parsing example: - -```go - if token, err := jwt.ParseFromRequest(tokenString, req, keyLookupFunc); err == nil { - fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"]) - } -``` - -is directly mapped to: - -```go - if token, err := request.ParseFromRequest(req, request.OAuth2Extractor, keyLookupFunc); err == nil { - claims := token.Claims.(jwt.MapClaims) - fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"]) - } -``` - -There are several concrete `Extractor` types provided for your convenience: - -* `HeaderExtractor` will search a list of headers until one contains content. -* `ArgumentExtractor` will search a list of keys in request query and form arguments until one contains content. -* `MultiExtractor` will try a list of `Extractors` in order until one returns content. -* `AuthorizationHeaderExtractor` will look in the `Authorization` header for a `Bearer` token. -* `OAuth2Extractor` searches the places an OAuth2 token would be specified (per the spec): `Authorization` header and `access_token` argument -* `PostExtractionFilter` wraps an `Extractor`, allowing you to process the content before it's parsed. A simple example is stripping the `Bearer ` text from a header - - -### RSA signing methods no longer accept `[]byte` keys - -Due to a [critical vulnerability](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/), we've decided the convenience of accepting `[]byte` instead of `rsa.PublicKey` or `rsa.PrivateKey` isn't worth the risk of misuse. - -To replace this behavior, we've added two helper methods: `ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)` and `ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)`. These are just simple helpers for unpacking PEM encoded PKCS1 and PKCS8 keys. If your keys are encoded any other way, all you need to do is convert them to the `crypto/rsa` package's types. - -```go - func keyLookupFunc(*Token) (interface{}, error) { - // Don't forget to validate the alg is what you expect: - if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { - return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) - } - - // Look up key - key, err := lookupPublicKey(token.Header["kid"]) - if err != nil { - return nil, err - } - - // Unpack key from PEM encoded PKCS8 - return jwt.ParseRSAPublicKeyFromPEM(key) - } -``` +## Migration Guide from v2 -> v3 + +Version 3 adds several new, frequently requested features. To do so, it introduces a few breaking changes. We've worked to keep these as minimal as possible. This guide explains the breaking changes and how you can quickly update your code. + +### `Token.Claims` is now an interface type + +The most requested feature from the 2.0 verison of this library was the ability to provide a custom type to the JSON parser for claims. This was implemented by introducing a new interface, `Claims`, to replace `map[string]interface{}`. We also included two concrete implementations of `Claims`: `MapClaims` and `StandardClaims`. + +`MapClaims` is an alias for `map[string]interface{}` with built in validation behavior. It is the default claims type when using `Parse`. The usage is unchanged except you must type cast the claims property. + +The old example for parsing a token looked like this.. + +```go + if token, err := jwt.Parse(tokenString, keyLookupFunc); err == nil { + fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"]) + } +``` + +is now directly mapped to... + +```go + if token, err := jwt.Parse(tokenString, keyLookupFunc); err == nil { + claims := token.Claims.(jwt.MapClaims) + fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"]) + } +``` + +`StandardClaims` is designed to be embedded in your custom type. You can supply a custom claims type with the new `ParseWithClaims` function. Here's an example of using a custom claims type. + +```go + type MyCustomClaims struct { + User string + *StandardClaims + } + + if token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, keyLookupFunc); err == nil { + claims := token.Claims.(*MyCustomClaims) + fmt.Printf("Token for user %v expires %v", claims.User, claims.StandardClaims.ExpiresAt) + } +``` + +### `ParseFromRequest` has been moved + +To keep this library focused on the tokens without becoming overburdened with complex request processing logic, `ParseFromRequest` and its new companion `ParseFromRequestWithClaims` have been moved to a subpackage, `request`. The method signatues have also been augmented to receive a new argument: `Extractor`. + +`Extractors` do the work of picking the token string out of a request. The interface is simple and composable. + +This simple parsing example: + +```go + if token, err := jwt.ParseFromRequest(tokenString, req, keyLookupFunc); err == nil { + fmt.Printf("Token for user %v expires %v", token.Claims["user"], token.Claims["exp"]) + } +``` + +is directly mapped to: + +```go + if token, err := request.ParseFromRequest(req, request.OAuth2Extractor, keyLookupFunc); err == nil { + claims := token.Claims.(jwt.MapClaims) + fmt.Printf("Token for user %v expires %v", claims["user"], claims["exp"]) + } +``` + +There are several concrete `Extractor` types provided for your convenience: + +* `HeaderExtractor` will search a list of headers until one contains content. +* `ArgumentExtractor` will search a list of keys in request query and form arguments until one contains content. +* `MultiExtractor` will try a list of `Extractors` in order until one returns content. +* `AuthorizationHeaderExtractor` will look in the `Authorization` header for a `Bearer` token. +* `OAuth2Extractor` searches the places an OAuth2 token would be specified (per the spec): `Authorization` header and `access_token` argument +* `PostExtractionFilter` wraps an `Extractor`, allowing you to process the content before it's parsed. A simple example is stripping the `Bearer ` text from a header + + +### RSA signing methods no longer accept `[]byte` keys + +Due to a [critical vulnerability](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/), we've decided the convenience of accepting `[]byte` instead of `rsa.PublicKey` or `rsa.PrivateKey` isn't worth the risk of misuse. + +To replace this behavior, we've added two helper methods: `ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)` and `ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)`. These are just simple helpers for unpacking PEM encoded PKCS1 and PKCS8 keys. If your keys are encoded any other way, all you need to do is convert them to the `crypto/rsa` package's types. + +```go + func keyLookupFunc(*Token) (interface{}, error) { + // Don't forget to validate the alg is what you expect: + if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { + return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) + } + + // Look up key + key, err := lookupPublicKey(token.Header["kid"]) + if err != nil { + return nil, err + } + + // Unpack key from PEM encoded PKCS8 + return jwt.ParseRSAPublicKeyFromPEM(key) + } +``` diff --git a/vendor/github.com/dgrijalva/jwt-go/README.md b/vendor/github.com/dgrijalva/jwt-go/README.md index 2f55f0d626..70bae69e4b 100644 --- a/vendor/github.com/dgrijalva/jwt-go/README.md +++ b/vendor/github.com/dgrijalva/jwt-go/README.md @@ -1,85 +1,85 @@ -A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html) - -[![Build Status](https://travis-ci.org/dgrijalva/jwt-go.svg?branch=master)](https://travis-ci.org/dgrijalva/jwt-go) - -**BREAKING CHANGES:*** Version 3.0.0 is here. It includes _a lot_ of changes including a few that break the API. We've tried to break as few things as possible, so there should just be a few type signature changes. A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code. - -**NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided. - - -## What the heck is a JWT? - -JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens. - -In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](http://tools.ietf.org/html/rfc4648) encoded. The last part is the signature, encoded the same way. - -The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used. - -The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [the RFC](http://self-issued.info/docs/draft-jones-json-web-token.html) for information about reserved keys and the proper way to add your own. - -## What's in the box? - -This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. - -## Examples - -See [the project documentation](https://godoc.org/github.com/dgrijalva/jwt-go) for examples of usage: - -* [Simple example of parsing and validating a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) -* [Simple example of building and signing a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-New--Hmac) -* [Directory of Examples](https://godoc.org/github.com/dgrijalva/jwt-go#pkg-examples) - -## Extensions - -This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. - -Here's an example of an extension that integrates with the Google App Engine signing tools: https://github.com/someone1/gcp-jwt-go - -## Compliance - -This library was last reviewed to comply with [RTF 7519](http://www.rfc-editor.org/info/rfc7519) dated May 2015 with a few notable differences: - -* In order to protect against accidental use of [Unsecured JWTs](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#UnsecuredJWT), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key. - -## Project Status & Versioning - -This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason). - -This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `master`. Periodically, versions will be tagged from `master`. You can find all the releases on [the project releases page](https://github.com/dgrijalva/jwt-go/releases). - -While we try to make it obvious when we make breaking changes, there isn't a great mechanism for pushing announcements out to users. You may want to use this alternative package include: `gopkg.in/dgrijalva/jwt-go.v2`. It will do the right thing WRT semantic versioning. - -## Usage Tips - -### Signing vs Encryption - -A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data: - -* The author of the token was in the possession of the signing secret -* The data has not been modified since it was signed - -It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library. - -### Choosing a Signing Method - -There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric. - -Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation. - -Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification. - -### JWT and OAuth - -It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication. - -Without going too far down the rabbit hole, here's a description of the interaction of these technologies: - -* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth. -* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token. -* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL. - -## More - -Documentation can be found [on godoc.org](http://godoc.org/github.com/dgrijalva/jwt-go). - -The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in to documentation. +A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html) + +[![Build Status](https://travis-ci.org/dgrijalva/jwt-go.svg?branch=master)](https://travis-ci.org/dgrijalva/jwt-go) + +**BREAKING CHANGES:*** Version 3.0.0 is here. It includes _a lot_ of changes including a few that break the API. We've tried to break as few things as possible, so there should just be a few type signature changes. A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code. + +**NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided. + + +## What the heck is a JWT? + +JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens. + +In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](http://tools.ietf.org/html/rfc4648) encoded. The last part is the signature, encoded the same way. + +The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used. + +The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [the RFC](http://self-issued.info/docs/draft-jones-json-web-token.html) for information about reserved keys and the proper way to add your own. + +## What's in the box? + +This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. + +## Examples + +See [the project documentation](https://godoc.org/github.com/dgrijalva/jwt-go) for examples of usage: + +* [Simple example of parsing and validating a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) +* [Simple example of building and signing a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-New--Hmac) +* [Directory of Examples](https://godoc.org/github.com/dgrijalva/jwt-go#pkg-examples) + +## Extensions + +This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. + +Here's an example of an extension that integrates with the Google App Engine signing tools: https://github.com/someone1/gcp-jwt-go + +## Compliance + +This library was last reviewed to comply with [RTF 7519](http://www.rfc-editor.org/info/rfc7519) dated May 2015 with a few notable differences: + +* In order to protect against accidental use of [Unsecured JWTs](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#UnsecuredJWT), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key. + +## Project Status & Versioning + +This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason). + +This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `master`. Periodically, versions will be tagged from `master`. You can find all the releases on [the project releases page](https://github.com/dgrijalva/jwt-go/releases). + +While we try to make it obvious when we make breaking changes, there isn't a great mechanism for pushing announcements out to users. You may want to use this alternative package include: `gopkg.in/dgrijalva/jwt-go.v2`. It will do the right thing WRT semantic versioning. + +## Usage Tips + +### Signing vs Encryption + +A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data: + +* The author of the token was in the possession of the signing secret +* The data has not been modified since it was signed + +It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library. + +### Choosing a Signing Method + +There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric. + +Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation. + +Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification. + +### JWT and OAuth + +It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication. + +Without going too far down the rabbit hole, here's a description of the interaction of these technologies: + +* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth. +* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token. +* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL. + +## More + +Documentation can be found [on godoc.org](http://godoc.org/github.com/dgrijalva/jwt-go). + +The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in to documentation. diff --git a/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md b/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md index 33c17abc07..b605b45093 100644 --- a/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md +++ b/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md @@ -1,105 +1,105 @@ -## `jwt-go` Version History - -#### 3.0.0 - -* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code - * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. - * `ParseFromRequest` has been moved to `request` subpackage and usage has changed - * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. -* Other Additions and Changes - * Added `Claims` interface type to allow users to decode the claims into a custom type - * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. - * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage - * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` - * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. - * Added several new, more specific, validation errors to error type bitmask - * Moved examples from README to executable example files - * Signing method registry is now thread safe - * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) - -#### 2.7.0 - -This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. - -* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying -* Error text for expired tokens includes how long it's been expired -* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` -* Documentation updates - -#### 2.6.0 - -* Exposed inner error within ValidationError -* Fixed validation errors when using UseJSONNumber flag -* Added several unit tests - -#### 2.5.0 - -* Added support for signing method none. You shouldn't use this. The API tries to make this clear. -* Updated/fixed some documentation -* Added more helpful error message when trying to parse tokens that begin with `BEARER ` - -#### 2.4.0 - -* Added new type, Parser, to allow for configuration of various parsing parameters - * You can now specify a list of valid signing methods. Anything outside this set will be rejected. - * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON -* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) -* Fixed some bugs with ECDSA parsing - -#### 2.3.0 - -* Added support for ECDSA signing methods -* Added support for RSA PSS signing methods (requires go v1.4) - -#### 2.2.0 - -* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. - -#### 2.1.0 - -Backwards compatible API change that was missed in 2.0.0. - -* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` - -#### 2.0.0 - -There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. - -The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. - -It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. - -* **Compatibility Breaking Changes** - * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` - * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` - * `KeyFunc` now returns `interface{}` instead of `[]byte` - * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key - * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key -* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodHS256` - * Added public package global `SigningMethodHS384` - * Added public package global `SigningMethodHS512` -* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodRS256` - * Added public package global `SigningMethodRS384` - * Added public package global `SigningMethodRS512` -* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. -* Refactored the RSA implementation to be easier to read -* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` - -#### 1.0.2 - -* Fixed bug in parsing public keys from certificates -* Added more tests around the parsing of keys for RS256 -* Code refactoring in RS256 implementation. No functional changes - -#### 1.0.1 - -* Fixed panic if RS256 signing method was passed an invalid key - -#### 1.0.0 - -* First versioned release -* API stabilized -* Supports creating, signing, parsing, and validating JWT tokens +## `jwt-go` Version History + +#### 3.0.0 + +* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code + * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. + * `ParseFromRequest` has been moved to `request` subpackage and usage has changed + * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. +* Other Additions and Changes + * Added `Claims` interface type to allow users to decode the claims into a custom type + * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. + * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage + * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` + * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. + * Added several new, more specific, validation errors to error type bitmask + * Moved examples from README to executable example files + * Signing method registry is now thread safe + * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) + +#### 2.7.0 + +This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. + +* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying +* Error text for expired tokens includes how long it's been expired +* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` +* Documentation updates + +#### 2.6.0 + +* Exposed inner error within ValidationError +* Fixed validation errors when using UseJSONNumber flag +* Added several unit tests + +#### 2.5.0 + +* Added support for signing method none. You shouldn't use this. The API tries to make this clear. +* Updated/fixed some documentation +* Added more helpful error message when trying to parse tokens that begin with `BEARER ` + +#### 2.4.0 + +* Added new type, Parser, to allow for configuration of various parsing parameters + * You can now specify a list of valid signing methods. Anything outside this set will be rejected. + * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON +* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) +* Fixed some bugs with ECDSA parsing + +#### 2.3.0 + +* Added support for ECDSA signing methods +* Added support for RSA PSS signing methods (requires go v1.4) + +#### 2.2.0 + +* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. + +#### 2.1.0 + +Backwards compatible API change that was missed in 2.0.0. + +* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` + +#### 2.0.0 + +There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. + +The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. + +It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. + +* **Compatibility Breaking Changes** + * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` + * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` + * `KeyFunc` now returns `interface{}` instead of `[]byte` + * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key + * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key +* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodHS256` + * Added public package global `SigningMethodHS384` + * Added public package global `SigningMethodHS512` +* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodRS256` + * Added public package global `SigningMethodRS384` + * Added public package global `SigningMethodRS512` +* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. +* Refactored the RSA implementation to be easier to read +* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` + +#### 1.0.2 + +* Fixed bug in parsing public keys from certificates +* Added more tests around the parsing of keys for RS256 +* Code refactoring in RS256 implementation. No functional changes + +#### 1.0.1 + +* Fixed panic if RS256 signing method was passed an invalid key + +#### 1.0.0 + +* First versioned release +* API stabilized +* Supports creating, signing, parsing, and validating JWT tokens * Supports RS256 and HS256 signing methods \ No newline at end of file diff --git a/vendor/github.com/dgrijalva/jwt-go/claims.go b/vendor/github.com/dgrijalva/jwt-go/claims.go index 05c68ce167..f0228f02e0 100644 --- a/vendor/github.com/dgrijalva/jwt-go/claims.go +++ b/vendor/github.com/dgrijalva/jwt-go/claims.go @@ -1,134 +1,134 @@ -package jwt - -import ( - "crypto/subtle" - "fmt" - "time" -) - -// For a type to be a Claims object, it must just have a Valid method that determines -// if the token is invalid for any supported reason -type Claims interface { - Valid() error -} - -// Structured version of Claims Section, as referenced at -// https://tools.ietf.org/html/rfc7519#section-4.1 -// See examples for how to use this with your own claim types -type StandardClaims struct { - Audience string `json:"aud,omitempty"` - ExpiresAt int64 `json:"exp,omitempty"` - Id string `json:"jti,omitempty"` - IssuedAt int64 `json:"iat,omitempty"` - Issuer string `json:"iss,omitempty"` - NotBefore int64 `json:"nbf,omitempty"` - Subject string `json:"sub,omitempty"` -} - -// Validates time based claims "exp, iat, nbf". -// There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (c StandardClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc().Unix() - - // The claims below are optional, by default, so if they are set to the - // default value in Go, let's not fail the verification for them. - if c.VerifyExpiresAt(now, false) == false { - delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0)) - vErr.Inner = fmt.Errorf("token is expired by %v", delta) - vErr.Errors |= ValidationErrorExpired - } - - if c.VerifyIssuedAt(now, false) == false { - vErr.Inner = fmt.Errorf("Token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if c.VerifyNotBefore(now, false) == false { - vErr.Inner = fmt.Errorf("token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} - -// Compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool { - return verifyAud(c.Audience, cmp, req) -} - -// Compares the exp claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool { - return verifyExp(c.ExpiresAt, cmp, req) -} - -// Compares the iat claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool { - return verifyIat(c.IssuedAt, cmp, req) -} - -// Compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool { - return verifyIss(c.Issuer, cmp, req) -} - -// Compares the nbf claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool { - return verifyNbf(c.NotBefore, cmp, req) -} - -// ----- helpers - -func verifyAud(aud string, cmp string, required bool) bool { - if aud == "" { - return !required - } - if subtle.ConstantTimeCompare([]byte(aud), []byte(cmp)) != 0 { - return true - } else { - return false - } -} - -func verifyExp(exp int64, now int64, required bool) bool { - if exp == 0 { - return !required - } - return now <= exp -} - -func verifyIat(iat int64, now int64, required bool) bool { - if iat == 0 { - return !required - } - return now >= iat -} - -func verifyIss(iss string, cmp string, required bool) bool { - if iss == "" { - return !required - } - if subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 { - return true - } else { - return false - } -} - -func verifyNbf(nbf int64, now int64, required bool) bool { - if nbf == 0 { - return !required - } - return now >= nbf -} +package jwt + +import ( + "crypto/subtle" + "fmt" + "time" +) + +// For a type to be a Claims object, it must just have a Valid method that determines +// if the token is invalid for any supported reason +type Claims interface { + Valid() error +} + +// Structured version of Claims Section, as referenced at +// https://tools.ietf.org/html/rfc7519#section-4.1 +// See examples for how to use this with your own claim types +type StandardClaims struct { + Audience string `json:"aud,omitempty"` + ExpiresAt int64 `json:"exp,omitempty"` + Id string `json:"jti,omitempty"` + IssuedAt int64 `json:"iat,omitempty"` + Issuer string `json:"iss,omitempty"` + NotBefore int64 `json:"nbf,omitempty"` + Subject string `json:"sub,omitempty"` +} + +// Validates time based claims "exp, iat, nbf". +// There is no accounting for clock skew. +// As well, if any of the above claims are not in the token, it will still +// be considered a valid claim. +func (c StandardClaims) Valid() error { + vErr := new(ValidationError) + now := TimeFunc().Unix() + + // The claims below are optional, by default, so if they are set to the + // default value in Go, let's not fail the verification for them. + if c.VerifyExpiresAt(now, false) == false { + delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0)) + vErr.Inner = fmt.Errorf("token is expired by %v", delta) + vErr.Errors |= ValidationErrorExpired + } + + if c.VerifyIssuedAt(now, false) == false { + vErr.Inner = fmt.Errorf("Token used before issued") + vErr.Errors |= ValidationErrorIssuedAt + } + + if c.VerifyNotBefore(now, false) == false { + vErr.Inner = fmt.Errorf("token is not valid yet") + vErr.Errors |= ValidationErrorNotValidYet + } + + if vErr.valid() { + return nil + } + + return vErr +} + +// Compares the aud claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool { + return verifyAud(c.Audience, cmp, req) +} + +// Compares the exp claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool { + return verifyExp(c.ExpiresAt, cmp, req) +} + +// Compares the iat claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool { + return verifyIat(c.IssuedAt, cmp, req) +} + +// Compares the iss claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool { + return verifyIss(c.Issuer, cmp, req) +} + +// Compares the nbf claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool { + return verifyNbf(c.NotBefore, cmp, req) +} + +// ----- helpers + +func verifyAud(aud string, cmp string, required bool) bool { + if aud == "" { + return !required + } + if subtle.ConstantTimeCompare([]byte(aud), []byte(cmp)) != 0 { + return true + } else { + return false + } +} + +func verifyExp(exp int64, now int64, required bool) bool { + if exp == 0 { + return !required + } + return now <= exp +} + +func verifyIat(iat int64, now int64, required bool) bool { + if iat == 0 { + return !required + } + return now >= iat +} + +func verifyIss(iss string, cmp string, required bool) bool { + if iss == "" { + return !required + } + if subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0 { + return true + } else { + return false + } +} + +func verifyNbf(nbf int64, now int64, required bool) bool { + if nbf == 0 { + return !required + } + return now >= nbf +} diff --git a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md index fdaed79339..c05150e33d 100644 --- a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md +++ b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/README.md @@ -1,13 +1,13 @@ -`jwt` command-line tool -======================= - -This is a simple tool to sign, verify and show JSON Web Tokens from -the command line. - -The following will create and sign a token, then verify it and output the original claims: - - echo {\"foo\":\"bar\"} | ./jwt -key ../../test/sample_key -alg RS256 -sign - | ./jwt -key ../../test/sample_key.pub -alg RS256 -verify - - -To simply display a token, use: - - echo $JWT | ./jwt -show - +`jwt` command-line tool +======================= + +This is a simple tool to sign, verify and show JSON Web Tokens from +the command line. + +The following will create and sign a token, then verify it and output the original claims: + + echo {\"foo\":\"bar\"} | ./jwt -key ../../test/sample_key -alg RS256 -sign - | ./jwt -key ../../test/sample_key.pub -alg RS256 -verify - + +To simply display a token, use: + + echo $JWT | ./jwt -show - diff --git a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/app.go b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/app.go index c012ee3f08..727182a981 100644 --- a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/app.go +++ b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/app.go @@ -1,282 +1,282 @@ -// A useful example app. You can use this to debug your tokens on the command line. -// This is also a great place to look at how you might use this library. -// -// Example usage: -// The following will create and sign a token, then verify it and output the original claims. -// echo {\"foo\":\"bar\"} | bin/jwt -key test/sample_key -alg RS256 -sign - | bin/jwt -key test/sample_key.pub -verify - -package main - -import ( - "encoding/json" - "flag" - "fmt" - "io" - "io/ioutil" - "os" - "regexp" - "strings" - - jwt "github.com/dgrijalva/jwt-go" -) - -var ( - // Options - flagAlg = flag.String("alg", "", "signing algorithm identifier") - flagKey = flag.String("key", "", "path to key file or '-' to read from stdin") - flagCompact = flag.Bool("compact", false, "output compact JSON") - flagDebug = flag.Bool("debug", false, "print out all kinds of debug data") - flagClaims = make(ArgList) - flagHead = make(ArgList) - - // Modes - exactly one of these is required - flagSign = flag.String("sign", "", "path to claims object to sign, '-' to read from stdin, or '+' to use only -claim args") - flagVerify = flag.String("verify", "", "path to JWT token to verify or '-' to read from stdin") - flagShow = flag.String("show", "", "path to JWT file or '-' to read from stdin") -) - -func main() { - // Plug in Var flags - flag.Var(flagClaims, "claim", "add additional claims. may be used more than once") - flag.Var(flagHead, "header", "add additional header params. may be used more than once") - - // Usage message if you ask for -help or if you mess up inputs. - flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) - fmt.Fprintf(os.Stderr, " One of the following flags is required: sign, verify\n") - flag.PrintDefaults() - } - - // Parse command line options - flag.Parse() - - // Do the thing. If something goes wrong, print error to stderr - // and exit with a non-zero status code - if err := start(); err != nil { - fmt.Fprintf(os.Stderr, "Error: %v\n", err) - os.Exit(1) - } -} - -// Figure out which thing to do and then do that -func start() error { - if *flagSign != "" { - return signToken() - } else if *flagVerify != "" { - return verifyToken() - } else if *flagShow != "" { - return showToken() - } else { - flag.Usage() - return fmt.Errorf("None of the required flags are present. What do you want me to do?") - } -} - -// Helper func: Read input from specified file or stdin -func loadData(p string) ([]byte, error) { - if p == "" { - return nil, fmt.Errorf("No path specified") - } - - var rdr io.Reader - if p == "-" { - rdr = os.Stdin - } else if p == "+" { - return []byte("{}"), nil - } else { - if f, err := os.Open(p); err == nil { - rdr = f - defer f.Close() - } else { - return nil, err - } - } - return ioutil.ReadAll(rdr) -} - -// Print a json object in accordance with the prophecy (or the command line options) -func printJSON(j interface{}) error { - var out []byte - var err error - - if *flagCompact == false { - out, err = json.MarshalIndent(j, "", " ") - } else { - out, err = json.Marshal(j) - } - - if err == nil { - fmt.Println(string(out)) - } - - return err -} - -// Verify a token and output the claims. This is a great example -// of how to verify and view a token. -func verifyToken() error { - // get the token - tokData, err := loadData(*flagVerify) - if err != nil { - return fmt.Errorf("Couldn't read token: %v", err) - } - - // trim possible whitespace from token - tokData = regexp.MustCompile(`\s*$`).ReplaceAll(tokData, []byte{}) - if *flagDebug { - fmt.Fprintf(os.Stderr, "Token len: %v bytes\n", len(tokData)) - } - - // Parse the token. Load the key from command line option - token, err := jwt.Parse(string(tokData), func(t *jwt.Token) (interface{}, error) { - data, err := loadData(*flagKey) - if err != nil { - return nil, err - } - if isEs() { - return jwt.ParseECPublicKeyFromPEM(data) - } else if isRs() { - return jwt.ParseRSAPublicKeyFromPEM(data) - } - return data, nil - }) - - // Print some debug data - if *flagDebug && token != nil { - fmt.Fprintf(os.Stderr, "Header:\n%v\n", token.Header) - fmt.Fprintf(os.Stderr, "Claims:\n%v\n", token.Claims) - } - - // Print an error if we can't parse for some reason - if err != nil { - return fmt.Errorf("Couldn't parse token: %v", err) - } - - // Is token invalid? - if !token.Valid { - return fmt.Errorf("Token is invalid") - } - - // Print the token details - if err := printJSON(token.Claims); err != nil { - return fmt.Errorf("Failed to output claims: %v", err) - } - - return nil -} - -// Create, sign, and output a token. This is a great, simple example of -// how to use this library to create and sign a token. -func signToken() error { - // get the token data from command line arguments - tokData, err := loadData(*flagSign) - if err != nil { - return fmt.Errorf("Couldn't read token: %v", err) - } else if *flagDebug { - fmt.Fprintf(os.Stderr, "Token: %v bytes", len(tokData)) - } - - // parse the JSON of the claims - var claims jwt.MapClaims - if err := json.Unmarshal(tokData, &claims); err != nil { - return fmt.Errorf("Couldn't parse claims JSON: %v", err) - } - - // add command line claims - if len(flagClaims) > 0 { - for k, v := range flagClaims { - claims[k] = v - } - } - - // get the key - var key interface{} - key, err = loadData(*flagKey) - if err != nil { - return fmt.Errorf("Couldn't read key: %v", err) - } - - // get the signing alg - alg := jwt.GetSigningMethod(*flagAlg) - if alg == nil { - return fmt.Errorf("Couldn't find signing method: %v", *flagAlg) - } - - // create a new token - token := jwt.NewWithClaims(alg, claims) - - // add command line headers - if len(flagHead) > 0 { - for k, v := range flagHead { - token.Header[k] = v - } - } - - if isEs() { - if k, ok := key.([]byte); !ok { - return fmt.Errorf("Couldn't convert key data to key") - } else { - key, err = jwt.ParseECPrivateKeyFromPEM(k) - if err != nil { - return err - } - } - } else if isRs() { - if k, ok := key.([]byte); !ok { - return fmt.Errorf("Couldn't convert key data to key") - } else { - key, err = jwt.ParseRSAPrivateKeyFromPEM(k) - if err != nil { - return err - } - } - } - - if out, err := token.SignedString(key); err == nil { - fmt.Println(out) - } else { - return fmt.Errorf("Error signing token: %v", err) - } - - return nil -} - -// showToken pretty-prints the token on the command line. -func showToken() error { - // get the token - tokData, err := loadData(*flagShow) - if err != nil { - return fmt.Errorf("Couldn't read token: %v", err) - } - - // trim possible whitespace from token - tokData = regexp.MustCompile(`\s*$`).ReplaceAll(tokData, []byte{}) - if *flagDebug { - fmt.Fprintf(os.Stderr, "Token len: %v bytes\n", len(tokData)) - } - - token, err := jwt.Parse(string(tokData), nil) - if token == nil { - return fmt.Errorf("malformed token: %v", err) - } - - // Print the token details - fmt.Println("Header:") - if err := printJSON(token.Header); err != nil { - return fmt.Errorf("Failed to output header: %v", err) - } - - fmt.Println("Claims:") - if err := printJSON(token.Claims); err != nil { - return fmt.Errorf("Failed to output claims: %v", err) - } - - return nil -} - -func isEs() bool { - return strings.HasPrefix(*flagAlg, "ES") -} - -func isRs() bool { - return strings.HasPrefix(*flagAlg, "RS") -} +// A useful example app. You can use this to debug your tokens on the command line. +// This is also a great place to look at how you might use this library. +// +// Example usage: +// The following will create and sign a token, then verify it and output the original claims. +// echo {\"foo\":\"bar\"} | bin/jwt -key test/sample_key -alg RS256 -sign - | bin/jwt -key test/sample_key.pub -verify - +package main + +import ( + "encoding/json" + "flag" + "fmt" + "io" + "io/ioutil" + "os" + "regexp" + "strings" + + jwt "github.com/dgrijalva/jwt-go" +) + +var ( + // Options + flagAlg = flag.String("alg", "", "signing algorithm identifier") + flagKey = flag.String("key", "", "path to key file or '-' to read from stdin") + flagCompact = flag.Bool("compact", false, "output compact JSON") + flagDebug = flag.Bool("debug", false, "print out all kinds of debug data") + flagClaims = make(ArgList) + flagHead = make(ArgList) + + // Modes - exactly one of these is required + flagSign = flag.String("sign", "", "path to claims object to sign, '-' to read from stdin, or '+' to use only -claim args") + flagVerify = flag.String("verify", "", "path to JWT token to verify or '-' to read from stdin") + flagShow = flag.String("show", "", "path to JWT file or '-' to read from stdin") +) + +func main() { + // Plug in Var flags + flag.Var(flagClaims, "claim", "add additional claims. may be used more than once") + flag.Var(flagHead, "header", "add additional header params. may be used more than once") + + // Usage message if you ask for -help or if you mess up inputs. + flag.Usage = func() { + fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) + fmt.Fprintf(os.Stderr, " One of the following flags is required: sign, verify\n") + flag.PrintDefaults() + } + + // Parse command line options + flag.Parse() + + // Do the thing. If something goes wrong, print error to stderr + // and exit with a non-zero status code + if err := start(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } +} + +// Figure out which thing to do and then do that +func start() error { + if *flagSign != "" { + return signToken() + } else if *flagVerify != "" { + return verifyToken() + } else if *flagShow != "" { + return showToken() + } else { + flag.Usage() + return fmt.Errorf("None of the required flags are present. What do you want me to do?") + } +} + +// Helper func: Read input from specified file or stdin +func loadData(p string) ([]byte, error) { + if p == "" { + return nil, fmt.Errorf("No path specified") + } + + var rdr io.Reader + if p == "-" { + rdr = os.Stdin + } else if p == "+" { + return []byte("{}"), nil + } else { + if f, err := os.Open(p); err == nil { + rdr = f + defer f.Close() + } else { + return nil, err + } + } + return ioutil.ReadAll(rdr) +} + +// Print a json object in accordance with the prophecy (or the command line options) +func printJSON(j interface{}) error { + var out []byte + var err error + + if *flagCompact == false { + out, err = json.MarshalIndent(j, "", " ") + } else { + out, err = json.Marshal(j) + } + + if err == nil { + fmt.Println(string(out)) + } + + return err +} + +// Verify a token and output the claims. This is a great example +// of how to verify and view a token. +func verifyToken() error { + // get the token + tokData, err := loadData(*flagVerify) + if err != nil { + return fmt.Errorf("Couldn't read token: %v", err) + } + + // trim possible whitespace from token + tokData = regexp.MustCompile(`\s*$`).ReplaceAll(tokData, []byte{}) + if *flagDebug { + fmt.Fprintf(os.Stderr, "Token len: %v bytes\n", len(tokData)) + } + + // Parse the token. Load the key from command line option + token, err := jwt.Parse(string(tokData), func(t *jwt.Token) (interface{}, error) { + data, err := loadData(*flagKey) + if err != nil { + return nil, err + } + if isEs() { + return jwt.ParseECPublicKeyFromPEM(data) + } else if isRs() { + return jwt.ParseRSAPublicKeyFromPEM(data) + } + return data, nil + }) + + // Print some debug data + if *flagDebug && token != nil { + fmt.Fprintf(os.Stderr, "Header:\n%v\n", token.Header) + fmt.Fprintf(os.Stderr, "Claims:\n%v\n", token.Claims) + } + + // Print an error if we can't parse for some reason + if err != nil { + return fmt.Errorf("Couldn't parse token: %v", err) + } + + // Is token invalid? + if !token.Valid { + return fmt.Errorf("Token is invalid") + } + + // Print the token details + if err := printJSON(token.Claims); err != nil { + return fmt.Errorf("Failed to output claims: %v", err) + } + + return nil +} + +// Create, sign, and output a token. This is a great, simple example of +// how to use this library to create and sign a token. +func signToken() error { + // get the token data from command line arguments + tokData, err := loadData(*flagSign) + if err != nil { + return fmt.Errorf("Couldn't read token: %v", err) + } else if *flagDebug { + fmt.Fprintf(os.Stderr, "Token: %v bytes", len(tokData)) + } + + // parse the JSON of the claims + var claims jwt.MapClaims + if err := json.Unmarshal(tokData, &claims); err != nil { + return fmt.Errorf("Couldn't parse claims JSON: %v", err) + } + + // add command line claims + if len(flagClaims) > 0 { + for k, v := range flagClaims { + claims[k] = v + } + } + + // get the key + var key interface{} + key, err = loadData(*flagKey) + if err != nil { + return fmt.Errorf("Couldn't read key: %v", err) + } + + // get the signing alg + alg := jwt.GetSigningMethod(*flagAlg) + if alg == nil { + return fmt.Errorf("Couldn't find signing method: %v", *flagAlg) + } + + // create a new token + token := jwt.NewWithClaims(alg, claims) + + // add command line headers + if len(flagHead) > 0 { + for k, v := range flagHead { + token.Header[k] = v + } + } + + if isEs() { + if k, ok := key.([]byte); !ok { + return fmt.Errorf("Couldn't convert key data to key") + } else { + key, err = jwt.ParseECPrivateKeyFromPEM(k) + if err != nil { + return err + } + } + } else if isRs() { + if k, ok := key.([]byte); !ok { + return fmt.Errorf("Couldn't convert key data to key") + } else { + key, err = jwt.ParseRSAPrivateKeyFromPEM(k) + if err != nil { + return err + } + } + } + + if out, err := token.SignedString(key); err == nil { + fmt.Println(out) + } else { + return fmt.Errorf("Error signing token: %v", err) + } + + return nil +} + +// showToken pretty-prints the token on the command line. +func showToken() error { + // get the token + tokData, err := loadData(*flagShow) + if err != nil { + return fmt.Errorf("Couldn't read token: %v", err) + } + + // trim possible whitespace from token + tokData = regexp.MustCompile(`\s*$`).ReplaceAll(tokData, []byte{}) + if *flagDebug { + fmt.Fprintf(os.Stderr, "Token len: %v bytes\n", len(tokData)) + } + + token, err := jwt.Parse(string(tokData), nil) + if token == nil { + return fmt.Errorf("malformed token: %v", err) + } + + // Print the token details + fmt.Println("Header:") + if err := printJSON(token.Header); err != nil { + return fmt.Errorf("Failed to output header: %v", err) + } + + fmt.Println("Claims:") + if err := printJSON(token.Claims); err != nil { + return fmt.Errorf("Failed to output claims: %v", err) + } + + return nil +} + +func isEs() bool { + return strings.HasPrefix(*flagAlg, "ES") +} + +func isRs() bool { + return strings.HasPrefix(*flagAlg, "RS") +} diff --git a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/args.go b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/args.go index 517757b90e..a5bba5b10c 100644 --- a/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/args.go +++ b/vendor/github.com/dgrijalva/jwt-go/cmd/jwt/args.go @@ -1,23 +1,23 @@ -package main - -import ( - "encoding/json" - "fmt" - "strings" -) - -type ArgList map[string]string - -func (l ArgList) String() string { - data, _ := json.Marshal(l) - return string(data) -} - -func (l ArgList) Set(arg string) error { - parts := strings.SplitN(arg, "=", 2) - if len(parts) != 2 { - return fmt.Errorf("Invalid argument '%v'. Must use format 'key=value'. %v", arg, parts) - } - l[parts[0]] = parts[1] - return nil -} +package main + +import ( + "encoding/json" + "fmt" + "strings" +) + +type ArgList map[string]string + +func (l ArgList) String() string { + data, _ := json.Marshal(l) + return string(data) +} + +func (l ArgList) Set(arg string) error { + parts := strings.SplitN(arg, "=", 2) + if len(parts) != 2 { + return fmt.Errorf("Invalid argument '%v'. Must use format 'key=value'. %v", arg, parts) + } + l[parts[0]] = parts[1] + return nil +} diff --git a/vendor/github.com/dgrijalva/jwt-go/doc.go b/vendor/github.com/dgrijalva/jwt-go/doc.go index 7cb678ea41..a86dc1a3b3 100644 --- a/vendor/github.com/dgrijalva/jwt-go/doc.go +++ b/vendor/github.com/dgrijalva/jwt-go/doc.go @@ -1,4 +1,4 @@ -// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html -// -// See README.md for more info. -package jwt +// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html +// +// See README.md for more info. +package jwt diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go index 9e5171b743..2f59a22236 100644 --- a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go @@ -1,147 +1,147 @@ -package jwt - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rand" - "errors" - "math/big" -) - -var ( - // Sadly this is missing from crypto/ecdsa compared to crypto/rsa - ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") -) - -// Implements the ECDSA family of signing methods signing methods -type SigningMethodECDSA struct { - Name string - Hash crypto.Hash - KeySize int - CurveBits int -} - -// Specific instances for EC256 and company -var ( - SigningMethodES256 *SigningMethodECDSA - SigningMethodES384 *SigningMethodECDSA - SigningMethodES512 *SigningMethodECDSA -) - -func init() { - // ES256 - SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} - RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { - return SigningMethodES256 - }) - - // ES384 - SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} - RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { - return SigningMethodES384 - }) - - // ES512 - SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} - RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { - return SigningMethodES512 - }) -} - -func (m *SigningMethodECDSA) Alg() string { - return m.Name -} - -// Implements the Verify method from SigningMethod -// For this verify method, key must be an ecdsa.PublicKey struct -func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - // Get the key - var ecdsaKey *ecdsa.PublicKey - switch k := key.(type) { - case *ecdsa.PublicKey: - ecdsaKey = k - default: - return ErrInvalidKeyType - } - - if len(sig) != 2*m.KeySize { - return ErrECDSAVerification - } - - r := big.NewInt(0).SetBytes(sig[:m.KeySize]) - s := big.NewInt(0).SetBytes(sig[m.KeySize:]) - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus == true { - return nil - } else { - return ErrECDSAVerification - } -} - -// Implements the Sign method from SigningMethod -// For this signing method, key must be an ecdsa.PrivateKey struct -func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) { - // Get the key - var ecdsaKey *ecdsa.PrivateKey - switch k := key.(type) { - case *ecdsa.PrivateKey: - ecdsaKey = k - default: - return "", ErrInvalidKeyType - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return r, s - if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { - curveBits := ecdsaKey.Curve.Params().BitSize - - if m.CurveBits != curveBits { - return "", ErrInvalidKey - } - - keyBytes := curveBits / 8 - if curveBits%8 > 0 { - keyBytes += 1 - } - - // We serialize the outpus (r and s) into big-endian byte arrays and pad - // them with zeros on the left to make sure the sizes work out. Both arrays - // must be keyBytes long, and the output must be 2*keyBytes long. - rBytes := r.Bytes() - rBytesPadded := make([]byte, keyBytes) - copy(rBytesPadded[keyBytes-len(rBytes):], rBytes) - - sBytes := s.Bytes() - sBytesPadded := make([]byte, keyBytes) - copy(sBytesPadded[keyBytes-len(sBytes):], sBytes) - - out := append(rBytesPadded, sBytesPadded...) - - return EncodeSegment(out), nil - } else { - return "", err - } -} +package jwt + +import ( + "crypto" + "crypto/ecdsa" + "crypto/rand" + "errors" + "math/big" +) + +var ( + // Sadly this is missing from crypto/ecdsa compared to crypto/rsa + ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") +) + +// Implements the ECDSA family of signing methods signing methods +type SigningMethodECDSA struct { + Name string + Hash crypto.Hash + KeySize int + CurveBits int +} + +// Specific instances for EC256 and company +var ( + SigningMethodES256 *SigningMethodECDSA + SigningMethodES384 *SigningMethodECDSA + SigningMethodES512 *SigningMethodECDSA +) + +func init() { + // ES256 + SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} + RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { + return SigningMethodES256 + }) + + // ES384 + SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} + RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { + return SigningMethodES384 + }) + + // ES512 + SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} + RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { + return SigningMethodES512 + }) +} + +func (m *SigningMethodECDSA) Alg() string { + return m.Name +} + +// Implements the Verify method from SigningMethod +// For this verify method, key must be an ecdsa.PublicKey struct +func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error { + var err error + + // Decode the signature + var sig []byte + if sig, err = DecodeSegment(signature); err != nil { + return err + } + + // Get the key + var ecdsaKey *ecdsa.PublicKey + switch k := key.(type) { + case *ecdsa.PublicKey: + ecdsaKey = k + default: + return ErrInvalidKeyType + } + + if len(sig) != 2*m.KeySize { + return ErrECDSAVerification + } + + r := big.NewInt(0).SetBytes(sig[:m.KeySize]) + s := big.NewInt(0).SetBytes(sig[m.KeySize:]) + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus == true { + return nil + } else { + return ErrECDSAVerification + } +} + +// Implements the Sign method from SigningMethod +// For this signing method, key must be an ecdsa.PrivateKey struct +func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) { + // Get the key + var ecdsaKey *ecdsa.PrivateKey + switch k := key.(type) { + case *ecdsa.PrivateKey: + ecdsaKey = k + default: + return "", ErrInvalidKeyType + } + + // Create the hasher + if !m.Hash.Available() { + return "", ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return r, s + if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { + curveBits := ecdsaKey.Curve.Params().BitSize + + if m.CurveBits != curveBits { + return "", ErrInvalidKey + } + + keyBytes := curveBits / 8 + if curveBits%8 > 0 { + keyBytes += 1 + } + + // We serialize the outpus (r and s) into big-endian byte arrays and pad + // them with zeros on the left to make sure the sizes work out. Both arrays + // must be keyBytes long, and the output must be 2*keyBytes long. + rBytes := r.Bytes() + rBytesPadded := make([]byte, keyBytes) + copy(rBytesPadded[keyBytes-len(rBytes):], rBytes) + + sBytes := s.Bytes() + sBytesPadded := make([]byte, keyBytes) + copy(sBytesPadded[keyBytes-len(sBytes):], sBytes) + + out := append(rBytesPadded, sBytesPadded...) + + return EncodeSegment(out), nil + } else { + return "", err + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go index 812c0de7f8..753047b1ec 100644 --- a/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa_test.go @@ -1,100 +1,100 @@ -package jwt_test - -import ( - "crypto/ecdsa" - "io/ioutil" - "strings" - "testing" - - "github.com/dgrijalva/jwt-go" -) - -var ecdsaTestData = []struct { - name string - keys map[string]string - tokenString string - alg string - claims map[string]interface{} - valid bool -}{ - { - "Basic ES256", - map[string]string{"private": "test/ec256-private.pem", "public": "test/ec256-public.pem"}, - "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJmb28iOiJiYXIifQ.feG39E-bn8HXAKhzDZq7yEAPWYDhZlwTn3sePJnU9VrGMmwdXAIEyoOnrjreYlVM_Z4N13eK9-TmMTWyfKJtHQ", - "ES256", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic ES384", - map[string]string{"private": "test/ec384-private.pem", "public": "test/ec384-public.pem"}, - "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJmb28iOiJiYXIifQ.ngAfKMbJUh0WWubSIYe5GMsA-aHNKwFbJk_wq3lq23aPp8H2anb1rRILIzVR0gUf4a8WzDtrzmiikuPWyCS6CN4-PwdgTk-5nehC7JXqlaBZU05p3toM3nWCwm_LXcld", - "ES384", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic ES512", - map[string]string{"private": "test/ec512-private.pem", "public": "test/ec512-public.pem"}, - "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzUxMiJ9.eyJmb28iOiJiYXIifQ.AAU0TvGQOcdg2OvrwY73NHKgfk26UDekh9Prz-L_iWuTBIBqOFCWwwLsRiHB1JOddfKAls5do1W0jR_F30JpVd-6AJeTjGKA4C1A1H6gIKwRY0o_tFDIydZCl_lMBMeG5VNFAjO86-WCSKwc3hqaGkq1MugPRq_qrF9AVbuEB4JPLyL5", - "ES512", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "basic ES256 invalid: foo => bar", - map[string]string{"private": "test/ec256-private.pem", "public": "test/ec256-public.pem"}, - "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.MEQCIHoSJnmGlPaVQDqacx_2XlXEhhqtWceVopjomc2PJLtdAiAUTeGPoNYxZw0z8mgOnnIcjoxRuNDVZvybRZF3wR1l8W", - "ES256", - map[string]interface{}{"foo": "bar"}, - false, - }, -} - -func TestECDSAVerify(t *testing.T) { - for _, data := range ecdsaTestData { - var err error - - key, _ := ioutil.ReadFile(data.keys["public"]) - - var ecdsaKey *ecdsa.PublicKey - if ecdsaKey, err = jwt.ParseECPublicKeyFromPEM(key); err != nil { - t.Errorf("Unable to parse ECDSA public key: %v", err) - } - - parts := strings.Split(data.tokenString, ".") - - method := jwt.GetSigningMethod(data.alg) - err = method.Verify(strings.Join(parts[0:2], "."), parts[2], ecdsaKey) - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying key: %v", data.name, err) - } - if !data.valid && err == nil { - t.Errorf("[%v] Invalid key passed validation", data.name) - } - } -} - -func TestECDSASign(t *testing.T) { - for _, data := range ecdsaTestData { - var err error - key, _ := ioutil.ReadFile(data.keys["private"]) - - var ecdsaKey *ecdsa.PrivateKey - if ecdsaKey, err = jwt.ParseECPrivateKeyFromPEM(key); err != nil { - t.Errorf("Unable to parse ECDSA private key: %v", err) - } - - if data.valid { - parts := strings.Split(data.tokenString, ".") - method := jwt.GetSigningMethod(data.alg) - sig, err := method.Sign(strings.Join(parts[0:2], "."), ecdsaKey) - if err != nil { - t.Errorf("[%v] Error signing token: %v", data.name, err) - } - if sig == parts[2] { - t.Errorf("[%v] Identical signatures\nbefore:\n%v\nafter:\n%v", data.name, parts[2], sig) - } - } - } -} +package jwt_test + +import ( + "crypto/ecdsa" + "io/ioutil" + "strings" + "testing" + + "github.com/dgrijalva/jwt-go" +) + +var ecdsaTestData = []struct { + name string + keys map[string]string + tokenString string + alg string + claims map[string]interface{} + valid bool +}{ + { + "Basic ES256", + map[string]string{"private": "test/ec256-private.pem", "public": "test/ec256-public.pem"}, + "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJmb28iOiJiYXIifQ.feG39E-bn8HXAKhzDZq7yEAPWYDhZlwTn3sePJnU9VrGMmwdXAIEyoOnrjreYlVM_Z4N13eK9-TmMTWyfKJtHQ", + "ES256", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic ES384", + map[string]string{"private": "test/ec384-private.pem", "public": "test/ec384-public.pem"}, + "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJmb28iOiJiYXIifQ.ngAfKMbJUh0WWubSIYe5GMsA-aHNKwFbJk_wq3lq23aPp8H2anb1rRILIzVR0gUf4a8WzDtrzmiikuPWyCS6CN4-PwdgTk-5nehC7JXqlaBZU05p3toM3nWCwm_LXcld", + "ES384", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic ES512", + map[string]string{"private": "test/ec512-private.pem", "public": "test/ec512-public.pem"}, + "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzUxMiJ9.eyJmb28iOiJiYXIifQ.AAU0TvGQOcdg2OvrwY73NHKgfk26UDekh9Prz-L_iWuTBIBqOFCWwwLsRiHB1JOddfKAls5do1W0jR_F30JpVd-6AJeTjGKA4C1A1H6gIKwRY0o_tFDIydZCl_lMBMeG5VNFAjO86-WCSKwc3hqaGkq1MugPRq_qrF9AVbuEB4JPLyL5", + "ES512", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "basic ES256 invalid: foo => bar", + map[string]string{"private": "test/ec256-private.pem", "public": "test/ec256-public.pem"}, + "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.MEQCIHoSJnmGlPaVQDqacx_2XlXEhhqtWceVopjomc2PJLtdAiAUTeGPoNYxZw0z8mgOnnIcjoxRuNDVZvybRZF3wR1l8W", + "ES256", + map[string]interface{}{"foo": "bar"}, + false, + }, +} + +func TestECDSAVerify(t *testing.T) { + for _, data := range ecdsaTestData { + var err error + + key, _ := ioutil.ReadFile(data.keys["public"]) + + var ecdsaKey *ecdsa.PublicKey + if ecdsaKey, err = jwt.ParseECPublicKeyFromPEM(key); err != nil { + t.Errorf("Unable to parse ECDSA public key: %v", err) + } + + parts := strings.Split(data.tokenString, ".") + + method := jwt.GetSigningMethod(data.alg) + err = method.Verify(strings.Join(parts[0:2], "."), parts[2], ecdsaKey) + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying key: %v", data.name, err) + } + if !data.valid && err == nil { + t.Errorf("[%v] Invalid key passed validation", data.name) + } + } +} + +func TestECDSASign(t *testing.T) { + for _, data := range ecdsaTestData { + var err error + key, _ := ioutil.ReadFile(data.keys["private"]) + + var ecdsaKey *ecdsa.PrivateKey + if ecdsaKey, err = jwt.ParseECPrivateKeyFromPEM(key); err != nil { + t.Errorf("Unable to parse ECDSA private key: %v", err) + } + + if data.valid { + parts := strings.Split(data.tokenString, ".") + method := jwt.GetSigningMethod(data.alg) + sig, err := method.Sign(strings.Join(parts[0:2], "."), ecdsaKey) + if err != nil { + t.Errorf("[%v] Error signing token: %v", data.name, err) + } + if sig == parts[2] { + t.Errorf("[%v] Identical signatures\nbefore:\n%v\nafter:\n%v", data.name, parts[2], sig) + } + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go index eb839ca7b9..d19624b726 100644 --- a/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go @@ -1,67 +1,67 @@ -package jwt - -import ( - "crypto/ecdsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrNotECPublicKey = errors.New("Key is not a valid ECDSA public key") - ErrNotECPrivateKey = errors.New("Key is not a valid ECDSA private key") -) - -// Parse PEM encoded Elliptic Curve Private Key Structure -func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { - return nil, err - } - - var pkey *ecdsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { - return nil, ErrNotECPrivateKey - } - - return pkey, nil -} - -// Parse PEM encoded PKCS1 or PKCS8 public key -func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *ecdsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { - return nil, ErrNotECPublicKey - } - - return pkey, nil -} +package jwt + +import ( + "crypto/ecdsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotECPublicKey = errors.New("Key is not a valid ECDSA public key") + ErrNotECPrivateKey = errors.New("Key is not a valid ECDSA private key") +) + +// Parse PEM encoded Elliptic Curve Private Key Structure +func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { + return nil, err + } + + var pkey *ecdsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { + return nil, ErrNotECPrivateKey + } + + return pkey, nil +} + +// Parse PEM encoded PKCS1 or PKCS8 public key +func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + return nil, err + } + } + + var pkey *ecdsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { + return nil, ErrNotECPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/dgrijalva/jwt-go/errors.go b/vendor/github.com/dgrijalva/jwt-go/errors.go index 8548ab5278..1c93024aad 100644 --- a/vendor/github.com/dgrijalva/jwt-go/errors.go +++ b/vendor/github.com/dgrijalva/jwt-go/errors.go @@ -1,59 +1,59 @@ -package jwt - -import ( - "errors" -) - -// Error constants -var ( - ErrInvalidKey = errors.New("key is invalid") - ErrInvalidKeyType = errors.New("key is of invalid type") - ErrHashUnavailable = errors.New("the requested hash function is unavailable") -) - -// The errors that might occur when parsing and validating a token -const ( - ValidationErrorMalformed uint32 = 1 << iota // Token is malformed - ValidationErrorUnverifiable // Token could not be verified because of signing problems - ValidationErrorSignatureInvalid // Signature validation failed - - // Standard Claim validation errors - ValidationErrorAudience // AUD validation failed - ValidationErrorExpired // EXP validation failed - ValidationErrorIssuedAt // IAT validation failed - ValidationErrorIssuer // ISS validation failed - ValidationErrorNotValidYet // NBF validation failed - ValidationErrorId // JTI validation failed - ValidationErrorClaimsInvalid // Generic claims validation error -) - -// Helper for constructing a ValidationError with a string error message -func NewValidationError(errorText string, errorFlags uint32) *ValidationError { - return &ValidationError{ - text: errorText, - Errors: errorFlags, - } -} - -// The error from Parse if token is not valid -type ValidationError struct { - Inner error // stores the error returned by external dependencies, i.e.: KeyFunc - Errors uint32 // bitfield. see ValidationError... constants - text string // errors that do not have a valid error just have text -} - -// Validation error is an error type -func (e ValidationError) Error() string { - if e.Inner != nil { - return e.Inner.Error() - } else if e.text != "" { - return e.text - } else { - return "token is invalid" - } -} - -// No errors -func (e *ValidationError) valid() bool { - return e.Errors == 0 -} +package jwt + +import ( + "errors" +) + +// Error constants +var ( + ErrInvalidKey = errors.New("key is invalid") + ErrInvalidKeyType = errors.New("key is of invalid type") + ErrHashUnavailable = errors.New("the requested hash function is unavailable") +) + +// The errors that might occur when parsing and validating a token +const ( + ValidationErrorMalformed uint32 = 1 << iota // Token is malformed + ValidationErrorUnverifiable // Token could not be verified because of signing problems + ValidationErrorSignatureInvalid // Signature validation failed + + // Standard Claim validation errors + ValidationErrorAudience // AUD validation failed + ValidationErrorExpired // EXP validation failed + ValidationErrorIssuedAt // IAT validation failed + ValidationErrorIssuer // ISS validation failed + ValidationErrorNotValidYet // NBF validation failed + ValidationErrorId // JTI validation failed + ValidationErrorClaimsInvalid // Generic claims validation error +) + +// Helper for constructing a ValidationError with a string error message +func NewValidationError(errorText string, errorFlags uint32) *ValidationError { + return &ValidationError{ + text: errorText, + Errors: errorFlags, + } +} + +// The error from Parse if token is not valid +type ValidationError struct { + Inner error // stores the error returned by external dependencies, i.e.: KeyFunc + Errors uint32 // bitfield. see ValidationError... constants + text string // errors that do not have a valid error just have text +} + +// Validation error is an error type +func (e ValidationError) Error() string { + if e.Inner != nil { + return e.Inner.Error() + } else if e.text != "" { + return e.text + } else { + return "token is invalid" + } +} + +// No errors +func (e *ValidationError) valid() bool { + return e.Errors == 0 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/example_test.go b/vendor/github.com/dgrijalva/jwt-go/example_test.go index 6abb4dd79e..ae8b788a0b 100644 --- a/vendor/github.com/dgrijalva/jwt-go/example_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/example_test.go @@ -1,114 +1,114 @@ -package jwt_test - -import ( - "fmt" - "github.com/dgrijalva/jwt-go" - "time" -) - -// Example (atypical) using the StandardClaims type by itself to parse a token. -// The StandardClaims type is designed to be embedded into your custom types -// to provide standard validation features. You can use it alone, but there's -// no way to retrieve other fields after parsing. -// See the CustomClaimsType example for intended usage. -func ExampleNewWithClaims_standardClaims() { - mySigningKey := []byte("AllYourBase") - - // Create the Claims - claims := &jwt.StandardClaims{ - ExpiresAt: 15000, - Issuer: "test", - } - - token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) - ss, err := token.SignedString(mySigningKey) - fmt.Printf("%v %v", ss, err) - //Output: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.QsODzZu3lUZMVdhbO76u3Jv02iYCvEHcYVUI1kOWEU0 -} - -// Example creating a token using a custom claims type. The StandardClaim is embedded -// in the custom type to allow for easy encoding, parsing and validation of standard claims. -func ExampleNewWithClaims_customClaimsType() { - mySigningKey := []byte("AllYourBase") - - type MyCustomClaims struct { - Foo string `json:"foo"` - jwt.StandardClaims - } - - // Create the Claims - claims := MyCustomClaims{ - "bar", - jwt.StandardClaims{ - ExpiresAt: 15000, - Issuer: "test", - }, - } - - token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) - ss, err := token.SignedString(mySigningKey) - fmt.Printf("%v %v", ss, err) - //Output: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c -} - -// Example creating a token using a custom claims type. The StandardClaim is embedded -// in the custom type to allow for easy encoding, parsing and validation of standard claims. -func ExampleParseWithClaims_customClaimsType() { - tokenString := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c" - - type MyCustomClaims struct { - Foo string `json:"foo"` - jwt.StandardClaims - } - - // sample token is expired. override time so it parses as valid - at(time.Unix(0, 0), func() { - token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) { - return []byte("AllYourBase"), nil - }) - - if claims, ok := token.Claims.(*MyCustomClaims); ok && token.Valid { - fmt.Printf("%v %v", claims.Foo, claims.StandardClaims.ExpiresAt) - } else { - fmt.Println(err) - } - }) - - // Output: bar 15000 -} - -// Override time value for tests. Restore default value after. -func at(t time.Time, f func()) { - jwt.TimeFunc = func() time.Time { - return t - } - f() - jwt.TimeFunc = time.Now -} - -// An example of parsing the error types using bitfield checks -func ExampleParse_errorChecking() { - // Token from another example. This token is expired - var tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c" - - token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { - return []byte("AllYourBase"), nil - }) - - if token.Valid { - fmt.Println("You look nice today") - } else if ve, ok := err.(*jwt.ValidationError); ok { - if ve.Errors&jwt.ValidationErrorMalformed != 0 { - fmt.Println("That's not even a token") - } else if ve.Errors&(jwt.ValidationErrorExpired|jwt.ValidationErrorNotValidYet) != 0 { - // Token is either expired or not active yet - fmt.Println("Timing is everything") - } else { - fmt.Println("Couldn't handle this token:", err) - } - } else { - fmt.Println("Couldn't handle this token:", err) - } - - // Output: Timing is everything -} +package jwt_test + +import ( + "fmt" + "github.com/dgrijalva/jwt-go" + "time" +) + +// Example (atypical) using the StandardClaims type by itself to parse a token. +// The StandardClaims type is designed to be embedded into your custom types +// to provide standard validation features. You can use it alone, but there's +// no way to retrieve other fields after parsing. +// See the CustomClaimsType example for intended usage. +func ExampleNewWithClaims_standardClaims() { + mySigningKey := []byte("AllYourBase") + + // Create the Claims + claims := &jwt.StandardClaims{ + ExpiresAt: 15000, + Issuer: "test", + } + + token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + ss, err := token.SignedString(mySigningKey) + fmt.Printf("%v %v", ss, err) + //Output: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.QsODzZu3lUZMVdhbO76u3Jv02iYCvEHcYVUI1kOWEU0 +} + +// Example creating a token using a custom claims type. The StandardClaim is embedded +// in the custom type to allow for easy encoding, parsing and validation of standard claims. +func ExampleNewWithClaims_customClaimsType() { + mySigningKey := []byte("AllYourBase") + + type MyCustomClaims struct { + Foo string `json:"foo"` + jwt.StandardClaims + } + + // Create the Claims + claims := MyCustomClaims{ + "bar", + jwt.StandardClaims{ + ExpiresAt: 15000, + Issuer: "test", + }, + } + + token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + ss, err := token.SignedString(mySigningKey) + fmt.Printf("%v %v", ss, err) + //Output: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c +} + +// Example creating a token using a custom claims type. The StandardClaim is embedded +// in the custom type to allow for easy encoding, parsing and validation of standard claims. +func ExampleParseWithClaims_customClaimsType() { + tokenString := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c" + + type MyCustomClaims struct { + Foo string `json:"foo"` + jwt.StandardClaims + } + + // sample token is expired. override time so it parses as valid + at(time.Unix(0, 0), func() { + token, err := jwt.ParseWithClaims(tokenString, &MyCustomClaims{}, func(token *jwt.Token) (interface{}, error) { + return []byte("AllYourBase"), nil + }) + + if claims, ok := token.Claims.(*MyCustomClaims); ok && token.Valid { + fmt.Printf("%v %v", claims.Foo, claims.StandardClaims.ExpiresAt) + } else { + fmt.Println(err) + } + }) + + // Output: bar 15000 +} + +// Override time value for tests. Restore default value after. +func at(t time.Time, f func()) { + jwt.TimeFunc = func() time.Time { + return t + } + f() + jwt.TimeFunc = time.Now +} + +// An example of parsing the error types using bitfield checks +func ExampleParse_errorChecking() { + // Token from another example. This token is expired + var tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE1MDAwLCJpc3MiOiJ0ZXN0In0.HE7fK0xOQwFEr4WDgRWj4teRPZ6i3GLwD5YCm6Pwu_c" + + token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { + return []byte("AllYourBase"), nil + }) + + if token.Valid { + fmt.Println("You look nice today") + } else if ve, ok := err.(*jwt.ValidationError); ok { + if ve.Errors&jwt.ValidationErrorMalformed != 0 { + fmt.Println("That's not even a token") + } else if ve.Errors&(jwt.ValidationErrorExpired|jwt.ValidationErrorNotValidYet) != 0 { + // Token is either expired or not active yet + fmt.Println("Timing is everything") + } else { + fmt.Println("Couldn't handle this token:", err) + } + } else { + fmt.Println("Couldn't handle this token:", err) + } + + // Output: Timing is everything +} diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac.go b/vendor/github.com/dgrijalva/jwt-go/hmac.go index 39d4e6b8ec..c229919254 100644 --- a/vendor/github.com/dgrijalva/jwt-go/hmac.go +++ b/vendor/github.com/dgrijalva/jwt-go/hmac.go @@ -1,94 +1,94 @@ -package jwt - -import ( - "crypto" - "crypto/hmac" - "errors" -) - -// Implements the HMAC-SHA family of signing methods signing methods -type SigningMethodHMAC struct { - Name string - Hash crypto.Hash -} - -// Specific instances for HS256 and company -var ( - SigningMethodHS256 *SigningMethodHMAC - SigningMethodHS384 *SigningMethodHMAC - SigningMethodHS512 *SigningMethodHMAC - ErrSignatureInvalid = errors.New("signature is invalid") -) - -func init() { - // HS256 - SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { - return SigningMethodHS256 - }) - - // HS384 - SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { - return SigningMethodHS384 - }) - - // HS512 - SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { - return SigningMethodHS512 - }) -} - -func (m *SigningMethodHMAC) Alg() string { - return m.Name -} - -// Verify the signature of HSXXX tokens. Returns nil if the signature is valid. -func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error { - // Verify the key is the right type - keyBytes, ok := key.([]byte) - if !ok { - return ErrInvalidKeyType - } - - // Decode signature, for comparison - sig, err := DecodeSegment(signature) - if err != nil { - return err - } - - // Can we use the specified hashing method? - if !m.Hash.Available() { - return ErrHashUnavailable - } - - // This signing method is symmetric, so we validate the signature - // by reproducing the signature from the signing string and key, then - // comparing that against the provided signature. - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - if !hmac.Equal(sig, hasher.Sum(nil)) { - return ErrSignatureInvalid - } - - // No validation errors. Signature is good. - return nil -} - -// Implements the Sign method from SigningMethod for this signing method. -// Key must be []byte -func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) { - if keyBytes, ok := key.([]byte); ok { - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - - return EncodeSegment(hasher.Sum(nil)), nil - } - - return "", ErrInvalidKey -} +package jwt + +import ( + "crypto" + "crypto/hmac" + "errors" +) + +// Implements the HMAC-SHA family of signing methods signing methods +type SigningMethodHMAC struct { + Name string + Hash crypto.Hash +} + +// Specific instances for HS256 and company +var ( + SigningMethodHS256 *SigningMethodHMAC + SigningMethodHS384 *SigningMethodHMAC + SigningMethodHS512 *SigningMethodHMAC + ErrSignatureInvalid = errors.New("signature is invalid") +) + +func init() { + // HS256 + SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { + return SigningMethodHS256 + }) + + // HS384 + SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { + return SigningMethodHS384 + }) + + // HS512 + SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { + return SigningMethodHS512 + }) +} + +func (m *SigningMethodHMAC) Alg() string { + return m.Name +} + +// Verify the signature of HSXXX tokens. Returns nil if the signature is valid. +func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error { + // Verify the key is the right type + keyBytes, ok := key.([]byte) + if !ok { + return ErrInvalidKeyType + } + + // Decode signature, for comparison + sig, err := DecodeSegment(signature) + if err != nil { + return err + } + + // Can we use the specified hashing method? + if !m.Hash.Available() { + return ErrHashUnavailable + } + + // This signing method is symmetric, so we validate the signature + // by reproducing the signature from the signing string and key, then + // comparing that against the provided signature. + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + if !hmac.Equal(sig, hasher.Sum(nil)) { + return ErrSignatureInvalid + } + + // No validation errors. Signature is good. + return nil +} + +// Implements the Sign method from SigningMethod for this signing method. +// Key must be []byte +func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) { + if keyBytes, ok := key.([]byte); ok { + if !m.Hash.Available() { + return "", ErrHashUnavailable + } + + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + + return EncodeSegment(hasher.Sum(nil)), nil + } + + return "", ErrInvalidKey +} diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go b/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go index 0ff13e5f42..0027831474 100644 --- a/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/hmac_example_test.go @@ -1,66 +1,66 @@ -package jwt_test - -import ( - "fmt" - "github.com/dgrijalva/jwt-go" - "io/ioutil" - "time" -) - -// For HMAC signing method, the key can be any []byte. It is recommended to generate -// a key using crypto/rand or something equivalent. You need the same key for signing -// and validating. -var hmacSampleSecret []byte - -func init() { - // Load sample key data - if keyData, e := ioutil.ReadFile("test/hmacTestKey"); e == nil { - hmacSampleSecret = keyData - } else { - panic(e) - } -} - -// Example creating, signing, and encoding a JWT token using the HMAC signing method -func ExampleNew_hmac() { - // Create a new token object, specifying signing method and the claims - // you would like it to contain. - token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ - "foo": "bar", - "nbf": time.Date(2015, 10, 10, 12, 0, 0, 0, time.UTC).Unix(), - }) - - // Sign and get the complete encoded token as a string using the secret - tokenString, err := token.SignedString(hmacSampleSecret) - - fmt.Println(tokenString, err) - // Output: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.u1riaD1rW97opCoAuRCTy4w58Br-Zk-bh7vLiRIsrpU -} - -// Example parsing and validating a token using the HMAC signing method -func ExampleParse_hmac() { - // sample token string taken from the New example - tokenString := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.u1riaD1rW97opCoAuRCTy4w58Br-Zk-bh7vLiRIsrpU" - - // Parse takes the token string and a function for looking up the key. The latter is especially - // useful if you use multiple keys for your application. The standard is to use 'kid' in the - // head of the token to identify which key to use, but the parsed token (head and claims) is provided - // to the callback, providing flexibility. - token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { - // Don't forget to validate the alg is what you expect: - if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { - return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) - } - - // hmacSampleSecret is a []byte containing your secret, e.g. []byte("my_secret_key") - return hmacSampleSecret, nil - }) - - if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid { - fmt.Println(claims["foo"], claims["nbf"]) - } else { - fmt.Println(err) - } - - // Output: bar 1.4444784e+09 -} +package jwt_test + +import ( + "fmt" + "github.com/dgrijalva/jwt-go" + "io/ioutil" + "time" +) + +// For HMAC signing method, the key can be any []byte. It is recommended to generate +// a key using crypto/rand or something equivalent. You need the same key for signing +// and validating. +var hmacSampleSecret []byte + +func init() { + // Load sample key data + if keyData, e := ioutil.ReadFile("test/hmacTestKey"); e == nil { + hmacSampleSecret = keyData + } else { + panic(e) + } +} + +// Example creating, signing, and encoding a JWT token using the HMAC signing method +func ExampleNew_hmac() { + // Create a new token object, specifying signing method and the claims + // you would like it to contain. + token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "foo": "bar", + "nbf": time.Date(2015, 10, 10, 12, 0, 0, 0, time.UTC).Unix(), + }) + + // Sign and get the complete encoded token as a string using the secret + tokenString, err := token.SignedString(hmacSampleSecret) + + fmt.Println(tokenString, err) + // Output: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.u1riaD1rW97opCoAuRCTy4w58Br-Zk-bh7vLiRIsrpU +} + +// Example parsing and validating a token using the HMAC signing method +func ExampleParse_hmac() { + // sample token string taken from the New example + tokenString := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.u1riaD1rW97opCoAuRCTy4w58Br-Zk-bh7vLiRIsrpU" + + // Parse takes the token string and a function for looking up the key. The latter is especially + // useful if you use multiple keys for your application. The standard is to use 'kid' in the + // head of the token to identify which key to use, but the parsed token (head and claims) is provided + // to the callback, providing flexibility. + token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { + // Don't forget to validate the alg is what you expect: + if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) + } + + // hmacSampleSecret is a []byte containing your secret, e.g. []byte("my_secret_key") + return hmacSampleSecret, nil + }) + + if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid { + fmt.Println(claims["foo"], claims["nbf"]) + } else { + fmt.Println(err) + } + + // Output: bar 1.4444784e+09 +} diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac_test.go b/vendor/github.com/dgrijalva/jwt-go/hmac_test.go index d7eca37c2a..c7e114f4f9 100644 --- a/vendor/github.com/dgrijalva/jwt-go/hmac_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/hmac_test.go @@ -1,91 +1,91 @@ -package jwt_test - -import ( - "github.com/dgrijalva/jwt-go" - "io/ioutil" - "strings" - "testing" -) - -var hmacTestData = []struct { - name string - tokenString string - alg string - claims map[string]interface{} - valid bool -}{ - { - "web sample", - "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", - "HS256", - map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, - true, - }, - { - "HS384", - "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuMzAwODE5MzhlKzA5LCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwiaXNzIjoiam9lIn0.KWZEuOD5lbBxZ34g7F-SlVLAQ_r5KApWNWlZIIMyQVz5Zs58a7XdNzj5_0EcNoOy", - "HS384", - map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, - true, - }, - { - "HS512", - "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuMzAwODE5MzhlKzA5LCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwiaXNzIjoiam9lIn0.CN7YijRX6Aw1n2jyI2Id1w90ja-DEMYiWixhYCyHnrZ1VfJRaFQz1bEbjjA5Fn4CLYaUG432dEYmSbS4Saokmw", - "HS512", - map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, - true, - }, - { - "web sample: invalid", - "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXo", - "HS256", - map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, - false, - }, -} - -// Sample data from http://tools.ietf.org/html/draft-jones-json-web-signature-04#appendix-A.1 -var hmacTestKey, _ = ioutil.ReadFile("test/hmacTestKey") - -func TestHMACVerify(t *testing.T) { - for _, data := range hmacTestData { - parts := strings.Split(data.tokenString, ".") - - method := jwt.GetSigningMethod(data.alg) - err := method.Verify(strings.Join(parts[0:2], "."), parts[2], hmacTestKey) - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying key: %v", data.name, err) - } - if !data.valid && err == nil { - t.Errorf("[%v] Invalid key passed validation", data.name) - } - } -} - -func TestHMACSign(t *testing.T) { - for _, data := range hmacTestData { - if data.valid { - parts := strings.Split(data.tokenString, ".") - method := jwt.GetSigningMethod(data.alg) - sig, err := method.Sign(strings.Join(parts[0:2], "."), hmacTestKey) - if err != nil { - t.Errorf("[%v] Error signing token: %v", data.name, err) - } - if sig != parts[2] { - t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", data.name, sig, parts[2]) - } - } - } -} - -func BenchmarkHS256Signing(b *testing.B) { - benchmarkSigning(b, jwt.SigningMethodHS256, hmacTestKey) -} - -func BenchmarkHS384Signing(b *testing.B) { - benchmarkSigning(b, jwt.SigningMethodHS384, hmacTestKey) -} - -func BenchmarkHS512Signing(b *testing.B) { - benchmarkSigning(b, jwt.SigningMethodHS512, hmacTestKey) -} +package jwt_test + +import ( + "github.com/dgrijalva/jwt-go" + "io/ioutil" + "strings" + "testing" +) + +var hmacTestData = []struct { + name string + tokenString string + alg string + claims map[string]interface{} + valid bool +}{ + { + "web sample", + "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", + "HS256", + map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, + true, + }, + { + "HS384", + "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuMzAwODE5MzhlKzA5LCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwiaXNzIjoiam9lIn0.KWZEuOD5lbBxZ34g7F-SlVLAQ_r5KApWNWlZIIMyQVz5Zs58a7XdNzj5_0EcNoOy", + "HS384", + map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, + true, + }, + { + "HS512", + "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuMzAwODE5MzhlKzA5LCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwiaXNzIjoiam9lIn0.CN7YijRX6Aw1n2jyI2Id1w90ja-DEMYiWixhYCyHnrZ1VfJRaFQz1bEbjjA5Fn4CLYaUG432dEYmSbS4Saokmw", + "HS512", + map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, + true, + }, + { + "web sample: invalid", + "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXo", + "HS256", + map[string]interface{}{"iss": "joe", "exp": 1300819380, "http://example.com/is_root": true}, + false, + }, +} + +// Sample data from http://tools.ietf.org/html/draft-jones-json-web-signature-04#appendix-A.1 +var hmacTestKey, _ = ioutil.ReadFile("test/hmacTestKey") + +func TestHMACVerify(t *testing.T) { + for _, data := range hmacTestData { + parts := strings.Split(data.tokenString, ".") + + method := jwt.GetSigningMethod(data.alg) + err := method.Verify(strings.Join(parts[0:2], "."), parts[2], hmacTestKey) + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying key: %v", data.name, err) + } + if !data.valid && err == nil { + t.Errorf("[%v] Invalid key passed validation", data.name) + } + } +} + +func TestHMACSign(t *testing.T) { + for _, data := range hmacTestData { + if data.valid { + parts := strings.Split(data.tokenString, ".") + method := jwt.GetSigningMethod(data.alg) + sig, err := method.Sign(strings.Join(parts[0:2], "."), hmacTestKey) + if err != nil { + t.Errorf("[%v] Error signing token: %v", data.name, err) + } + if sig != parts[2] { + t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", data.name, sig, parts[2]) + } + } + } +} + +func BenchmarkHS256Signing(b *testing.B) { + benchmarkSigning(b, jwt.SigningMethodHS256, hmacTestKey) +} + +func BenchmarkHS384Signing(b *testing.B) { + benchmarkSigning(b, jwt.SigningMethodHS384, hmacTestKey) +} + +func BenchmarkHS512Signing(b *testing.B) { + benchmarkSigning(b, jwt.SigningMethodHS512, hmacTestKey) +} diff --git a/vendor/github.com/dgrijalva/jwt-go/http_example_test.go b/vendor/github.com/dgrijalva/jwt-go/http_example_test.go index 5c9ef7619f..82e9c50a41 100644 --- a/vendor/github.com/dgrijalva/jwt-go/http_example_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/http_example_test.go @@ -1,216 +1,216 @@ -package jwt_test - -// Example HTTP auth using asymmetric crypto/RSA keys -// This is based on a (now outdated) example at https://gist.github.com/cryptix/45c33ecf0ae54828e63b - -import ( - "bytes" - "crypto/rsa" - "fmt" - "github.com/dgrijalva/jwt-go" - "github.com/dgrijalva/jwt-go/request" - "io" - "io/ioutil" - "log" - "net" - "net/http" - "net/url" - "strings" - "time" -) - -// location of the files used for signing and verification -const ( - privKeyPath = "test/sample_key" // openssl genrsa -out app.rsa keysize - pubKeyPath = "test/sample_key.pub" // openssl rsa -in app.rsa -pubout > app.rsa.pub -) - -var ( - verifyKey *rsa.PublicKey - signKey *rsa.PrivateKey - serverPort int - // storing sample username/password pairs - // don't do this on a real server - users = map[string]string{ - "test": "known", - } -) - -// read the key files before starting http handlers -func init() { - signBytes, err := ioutil.ReadFile(privKeyPath) - fatal(err) - - signKey, err = jwt.ParseRSAPrivateKeyFromPEM(signBytes) - fatal(err) - - verifyBytes, err := ioutil.ReadFile(pubKeyPath) - fatal(err) - - verifyKey, err = jwt.ParseRSAPublicKeyFromPEM(verifyBytes) - fatal(err) - - http.HandleFunc("/authenticate", authHandler) - http.HandleFunc("/restricted", restrictedHandler) - - // Setup listener - listener, err := net.ListenTCP("tcp", &net.TCPAddr{}) - serverPort = listener.Addr().(*net.TCPAddr).Port - - log.Println("Listening...") - go func() { - fatal(http.Serve(listener, nil)) - }() -} - -var start func() - -func fatal(err error) { - if err != nil { - log.Fatal(err) - } -} - -// Define some custom types were going to use within our tokens -type CustomerInfo struct { - Name string - Kind string -} - -type CustomClaimsExample struct { - *jwt.StandardClaims - TokenType string - CustomerInfo -} - -func Example_getTokenViaHTTP() { - // See func authHandler for an example auth handler that produces a token - res, err := http.PostForm(fmt.Sprintf("http://localhost:%v/authenticate", serverPort), url.Values{ - "user": {"test"}, - "pass": {"known"}, - }) - if err != nil { - fatal(err) - } - - if res.StatusCode != 200 { - fmt.Println("Unexpected status code", res.StatusCode) - } - - // Read the token out of the response body - buf := new(bytes.Buffer) - io.Copy(buf, res.Body) - res.Body.Close() - tokenString := strings.TrimSpace(buf.String()) - - // Parse the token - token, err := jwt.ParseWithClaims(tokenString, &CustomClaimsExample{}, func(token *jwt.Token) (interface{}, error) { - // since we only use the one private key to sign the tokens, - // we also only use its public counter part to verify - return verifyKey, nil - }) - fatal(err) - - claims := token.Claims.(*CustomClaimsExample) - fmt.Println(claims.CustomerInfo.Name) - - //Output: test -} - -func Example_useTokenViaHTTP() { - - // Make a sample token - // In a real world situation, this token will have been acquired from - // some other API call (see Example_getTokenViaHTTP) - token, err := createToken("foo") - fatal(err) - - // Make request. See func restrictedHandler for example request processor - req, err := http.NewRequest("GET", fmt.Sprintf("http://localhost:%v/restricted", serverPort), nil) - fatal(err) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token)) - res, err := http.DefaultClient.Do(req) - fatal(err) - - // Read the response body - buf := new(bytes.Buffer) - io.Copy(buf, res.Body) - res.Body.Close() - fmt.Println(buf.String()) - - // Output: Welcome, foo -} - -func createToken(user string) (string, error) { - // create a signer for rsa 256 - t := jwt.New(jwt.GetSigningMethod("RS256")) - - // set our claims - t.Claims = &CustomClaimsExample{ - &jwt.StandardClaims{ - // set the expire time - // see http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-20#section-4.1.4 - ExpiresAt: time.Now().Add(time.Minute * 1).Unix(), - }, - "level1", - CustomerInfo{user, "human"}, - } - - // Creat token string - return t.SignedString(signKey) -} - -// reads the form values, checks them and creates the token -func authHandler(w http.ResponseWriter, r *http.Request) { - // make sure its post - if r.Method != "POST" { - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintln(w, "No POST", r.Method) - return - } - - user := r.FormValue("user") - pass := r.FormValue("pass") - - log.Printf("Authenticate: user[%s] pass[%s]\n", user, pass) - - // check values - if user != "test" || pass != "known" { - w.WriteHeader(http.StatusForbidden) - fmt.Fprintln(w, "Wrong info") - return - } - - tokenString, err := createToken(user) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - fmt.Fprintln(w, "Sorry, error while Signing Token!") - log.Printf("Token Signing error: %v\n", err) - return - } - - w.Header().Set("Content-Type", "application/jwt") - w.WriteHeader(http.StatusOK) - fmt.Fprintln(w, tokenString) -} - -// only accessible with a valid token -func restrictedHandler(w http.ResponseWriter, r *http.Request) { - // Get token from request - token, err := request.ParseFromRequestWithClaims(r, request.OAuth2Extractor, &CustomClaimsExample{}, func(token *jwt.Token) (interface{}, error) { - // since we only use the one private key to sign the tokens, - // we also only use its public counter part to verify - return verifyKey, nil - }) - - // If the token is missing or invalid, return error - if err != nil { - w.WriteHeader(http.StatusUnauthorized) - fmt.Fprintln(w, "Invalid token:", err) - return - } - - // Token is valid - fmt.Fprintln(w, "Welcome,", token.Claims.(*CustomClaimsExample).Name) - return -} +package jwt_test + +// Example HTTP auth using asymmetric crypto/RSA keys +// This is based on a (now outdated) example at https://gist.github.com/cryptix/45c33ecf0ae54828e63b + +import ( + "bytes" + "crypto/rsa" + "fmt" + "github.com/dgrijalva/jwt-go" + "github.com/dgrijalva/jwt-go/request" + "io" + "io/ioutil" + "log" + "net" + "net/http" + "net/url" + "strings" + "time" +) + +// location of the files used for signing and verification +const ( + privKeyPath = "test/sample_key" // openssl genrsa -out app.rsa keysize + pubKeyPath = "test/sample_key.pub" // openssl rsa -in app.rsa -pubout > app.rsa.pub +) + +var ( + verifyKey *rsa.PublicKey + signKey *rsa.PrivateKey + serverPort int + // storing sample username/password pairs + // don't do this on a real server + users = map[string]string{ + "test": "known", + } +) + +// read the key files before starting http handlers +func init() { + signBytes, err := ioutil.ReadFile(privKeyPath) + fatal(err) + + signKey, err = jwt.ParseRSAPrivateKeyFromPEM(signBytes) + fatal(err) + + verifyBytes, err := ioutil.ReadFile(pubKeyPath) + fatal(err) + + verifyKey, err = jwt.ParseRSAPublicKeyFromPEM(verifyBytes) + fatal(err) + + http.HandleFunc("/authenticate", authHandler) + http.HandleFunc("/restricted", restrictedHandler) + + // Setup listener + listener, err := net.ListenTCP("tcp", &net.TCPAddr{}) + serverPort = listener.Addr().(*net.TCPAddr).Port + + log.Println("Listening...") + go func() { + fatal(http.Serve(listener, nil)) + }() +} + +var start func() + +func fatal(err error) { + if err != nil { + log.Fatal(err) + } +} + +// Define some custom types were going to use within our tokens +type CustomerInfo struct { + Name string + Kind string +} + +type CustomClaimsExample struct { + *jwt.StandardClaims + TokenType string + CustomerInfo +} + +func Example_getTokenViaHTTP() { + // See func authHandler for an example auth handler that produces a token + res, err := http.PostForm(fmt.Sprintf("http://localhost:%v/authenticate", serverPort), url.Values{ + "user": {"test"}, + "pass": {"known"}, + }) + if err != nil { + fatal(err) + } + + if res.StatusCode != 200 { + fmt.Println("Unexpected status code", res.StatusCode) + } + + // Read the token out of the response body + buf := new(bytes.Buffer) + io.Copy(buf, res.Body) + res.Body.Close() + tokenString := strings.TrimSpace(buf.String()) + + // Parse the token + token, err := jwt.ParseWithClaims(tokenString, &CustomClaimsExample{}, func(token *jwt.Token) (interface{}, error) { + // since we only use the one private key to sign the tokens, + // we also only use its public counter part to verify + return verifyKey, nil + }) + fatal(err) + + claims := token.Claims.(*CustomClaimsExample) + fmt.Println(claims.CustomerInfo.Name) + + //Output: test +} + +func Example_useTokenViaHTTP() { + + // Make a sample token + // In a real world situation, this token will have been acquired from + // some other API call (see Example_getTokenViaHTTP) + token, err := createToken("foo") + fatal(err) + + // Make request. See func restrictedHandler for example request processor + req, err := http.NewRequest("GET", fmt.Sprintf("http://localhost:%v/restricted", serverPort), nil) + fatal(err) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token)) + res, err := http.DefaultClient.Do(req) + fatal(err) + + // Read the response body + buf := new(bytes.Buffer) + io.Copy(buf, res.Body) + res.Body.Close() + fmt.Println(buf.String()) + + // Output: Welcome, foo +} + +func createToken(user string) (string, error) { + // create a signer for rsa 256 + t := jwt.New(jwt.GetSigningMethod("RS256")) + + // set our claims + t.Claims = &CustomClaimsExample{ + &jwt.StandardClaims{ + // set the expire time + // see http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-20#section-4.1.4 + ExpiresAt: time.Now().Add(time.Minute * 1).Unix(), + }, + "level1", + CustomerInfo{user, "human"}, + } + + // Creat token string + return t.SignedString(signKey) +} + +// reads the form values, checks them and creates the token +func authHandler(w http.ResponseWriter, r *http.Request) { + // make sure its post + if r.Method != "POST" { + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintln(w, "No POST", r.Method) + return + } + + user := r.FormValue("user") + pass := r.FormValue("pass") + + log.Printf("Authenticate: user[%s] pass[%s]\n", user, pass) + + // check values + if user != "test" || pass != "known" { + w.WriteHeader(http.StatusForbidden) + fmt.Fprintln(w, "Wrong info") + return + } + + tokenString, err := createToken(user) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + fmt.Fprintln(w, "Sorry, error while Signing Token!") + log.Printf("Token Signing error: %v\n", err) + return + } + + w.Header().Set("Content-Type", "application/jwt") + w.WriteHeader(http.StatusOK) + fmt.Fprintln(w, tokenString) +} + +// only accessible with a valid token +func restrictedHandler(w http.ResponseWriter, r *http.Request) { + // Get token from request + token, err := request.ParseFromRequestWithClaims(r, request.OAuth2Extractor, &CustomClaimsExample{}, func(token *jwt.Token) (interface{}, error) { + // since we only use the one private key to sign the tokens, + // we also only use its public counter part to verify + return verifyKey, nil + }) + + // If the token is missing or invalid, return error + if err != nil { + w.WriteHeader(http.StatusUnauthorized) + fmt.Fprintln(w, "Invalid token:", err) + return + } + + // Token is valid + fmt.Fprintln(w, "Welcome,", token.Claims.(*CustomClaimsExample).Name) + return +} diff --git a/vendor/github.com/dgrijalva/jwt-go/map_claims.go b/vendor/github.com/dgrijalva/jwt-go/map_claims.go index ca1512e426..291213c460 100644 --- a/vendor/github.com/dgrijalva/jwt-go/map_claims.go +++ b/vendor/github.com/dgrijalva/jwt-go/map_claims.go @@ -1,94 +1,94 @@ -package jwt - -import ( - "encoding/json" - "errors" - // "fmt" -) - -// Claims type that uses the map[string]interface{} for JSON decoding -// This is the default claims type if you don't supply one -type MapClaims map[string]interface{} - -// Compares the aud claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyAudience(cmp string, req bool) bool { - aud, _ := m["aud"].(string) - return verifyAud(aud, cmp, req) -} - -// Compares the exp claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { - switch exp := m["exp"].(type) { - case float64: - return verifyExp(int64(exp), cmp, req) - case json.Number: - v, _ := exp.Int64() - return verifyExp(v, cmp, req) - } - return req == false -} - -// Compares the iat claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool { - switch iat := m["iat"].(type) { - case float64: - return verifyIat(int64(iat), cmp, req) - case json.Number: - v, _ := iat.Int64() - return verifyIat(v, cmp, req) - } - return req == false -} - -// Compares the iss claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyIssuer(cmp string, req bool) bool { - iss, _ := m["iss"].(string) - return verifyIss(iss, cmp, req) -} - -// Compares the nbf claim against cmp. -// If required is false, this method will return true if the value matches or is unset -func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool { - switch nbf := m["nbf"].(type) { - case float64: - return verifyNbf(int64(nbf), cmp, req) - case json.Number: - v, _ := nbf.Int64() - return verifyNbf(v, cmp, req) - } - return req == false -} - -// Validates time based claims "exp, iat, nbf". -// There is no accounting for clock skew. -// As well, if any of the above claims are not in the token, it will still -// be considered a valid claim. -func (m MapClaims) Valid() error { - vErr := new(ValidationError) - now := TimeFunc().Unix() - - if m.VerifyExpiresAt(now, false) == false { - vErr.Inner = errors.New("Token is expired") - vErr.Errors |= ValidationErrorExpired - } - - if m.VerifyIssuedAt(now, false) == false { - vErr.Inner = errors.New("Token used before issued") - vErr.Errors |= ValidationErrorIssuedAt - } - - if m.VerifyNotBefore(now, false) == false { - vErr.Inner = errors.New("Token is not valid yet") - vErr.Errors |= ValidationErrorNotValidYet - } - - if vErr.valid() { - return nil - } - - return vErr -} +package jwt + +import ( + "encoding/json" + "errors" + // "fmt" +) + +// Claims type that uses the map[string]interface{} for JSON decoding +// This is the default claims type if you don't supply one +type MapClaims map[string]interface{} + +// Compares the aud claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (m MapClaims) VerifyAudience(cmp string, req bool) bool { + aud, _ := m["aud"].(string) + return verifyAud(aud, cmp, req) +} + +// Compares the exp claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { + switch exp := m["exp"].(type) { + case float64: + return verifyExp(int64(exp), cmp, req) + case json.Number: + v, _ := exp.Int64() + return verifyExp(v, cmp, req) + } + return req == false +} + +// Compares the iat claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool { + switch iat := m["iat"].(type) { + case float64: + return verifyIat(int64(iat), cmp, req) + case json.Number: + v, _ := iat.Int64() + return verifyIat(v, cmp, req) + } + return req == false +} + +// Compares the iss claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (m MapClaims) VerifyIssuer(cmp string, req bool) bool { + iss, _ := m["iss"].(string) + return verifyIss(iss, cmp, req) +} + +// Compares the nbf claim against cmp. +// If required is false, this method will return true if the value matches or is unset +func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool { + switch nbf := m["nbf"].(type) { + case float64: + return verifyNbf(int64(nbf), cmp, req) + case json.Number: + v, _ := nbf.Int64() + return verifyNbf(v, cmp, req) + } + return req == false +} + +// Validates time based claims "exp, iat, nbf". +// There is no accounting for clock skew. +// As well, if any of the above claims are not in the token, it will still +// be considered a valid claim. +func (m MapClaims) Valid() error { + vErr := new(ValidationError) + now := TimeFunc().Unix() + + if m.VerifyExpiresAt(now, false) == false { + vErr.Inner = errors.New("Token is expired") + vErr.Errors |= ValidationErrorExpired + } + + if m.VerifyIssuedAt(now, false) == false { + vErr.Inner = errors.New("Token used before issued") + vErr.Errors |= ValidationErrorIssuedAt + } + + if m.VerifyNotBefore(now, false) == false { + vErr.Inner = errors.New("Token is not valid yet") + vErr.Errors |= ValidationErrorNotValidYet + } + + if vErr.valid() { + return nil + } + + return vErr +} diff --git a/vendor/github.com/dgrijalva/jwt-go/none.go b/vendor/github.com/dgrijalva/jwt-go/none.go index 18ec5a8550..f04d189d06 100644 --- a/vendor/github.com/dgrijalva/jwt-go/none.go +++ b/vendor/github.com/dgrijalva/jwt-go/none.go @@ -1,52 +1,52 @@ -package jwt - -// Implements the none signing method. This is required by the spec -// but you probably should never use it. -var SigningMethodNone *signingMethodNone - -const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" - -var NoneSignatureTypeDisallowedError error - -type signingMethodNone struct{} -type unsafeNoneMagicConstant string - -func init() { - SigningMethodNone = &signingMethodNone{} - NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid) - - RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { - return SigningMethodNone - }) -} - -func (m *signingMethodNone) Alg() string { - return "none" -} - -// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) { - // Key must be UnsafeAllowNoneSignatureType to prevent accidentally - // accepting 'none' signing method - if _, ok := key.(unsafeNoneMagicConstant); !ok { - return NoneSignatureTypeDisallowedError - } - // If signing method is none, signature must be an empty string - if signature != "" { - return NewValidationError( - "'none' signing method with non-empty signature", - ValidationErrorSignatureInvalid, - ) - } - - // Accept 'none' signing method. - return nil -} - -// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) { - if _, ok := key.(unsafeNoneMagicConstant); ok { - return "", nil - } - return "", NoneSignatureTypeDisallowedError -} +package jwt + +// Implements the none signing method. This is required by the spec +// but you probably should never use it. +var SigningMethodNone *signingMethodNone + +const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" + +var NoneSignatureTypeDisallowedError error + +type signingMethodNone struct{} +type unsafeNoneMagicConstant string + +func init() { + SigningMethodNone = &signingMethodNone{} + NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid) + + RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { + return SigningMethodNone + }) +} + +func (m *signingMethodNone) Alg() string { + return "none" +} + +// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) { + // Key must be UnsafeAllowNoneSignatureType to prevent accidentally + // accepting 'none' signing method + if _, ok := key.(unsafeNoneMagicConstant); !ok { + return NoneSignatureTypeDisallowedError + } + // If signing method is none, signature must be an empty string + if signature != "" { + return NewValidationError( + "'none' signing method with non-empty signature", + ValidationErrorSignatureInvalid, + ) + } + + // Accept 'none' signing method. + return nil +} + +// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) { + if _, ok := key.(unsafeNoneMagicConstant); ok { + return "", nil + } + return "", NoneSignatureTypeDisallowedError +} diff --git a/vendor/github.com/dgrijalva/jwt-go/none_test.go b/vendor/github.com/dgrijalva/jwt-go/none_test.go index ad854f18f4..29a69efef7 100644 --- a/vendor/github.com/dgrijalva/jwt-go/none_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/none_test.go @@ -1,72 +1,72 @@ -package jwt_test - -import ( - "github.com/dgrijalva/jwt-go" - "strings" - "testing" -) - -var noneTestData = []struct { - name string - tokenString string - alg string - key interface{} - claims map[string]interface{} - valid bool -}{ - { - "Basic", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.", - "none", - jwt.UnsafeAllowNoneSignatureType, - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic - no key", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.", - "none", - nil, - map[string]interface{}{"foo": "bar"}, - false, - }, - { - "Signed", - "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.W-jEzRfBigtCWsinvVVuldiuilzVdU5ty0MvpLaSaqK9PlAWWlDQ1VIQ_qSKzwL5IXaZkvZFJXT3yL3n7OUVu7zCNJzdwznbC8Z-b0z2lYvcklJYi2VOFRcGbJtXUqgjk2oGsiqUMUMOLP70TTefkpsgqDxbRh9CDUfpOJgW-dU7cmgaoswe3wjUAUi6B6G2YEaiuXC0XScQYSYVKIzgKXJV8Zw-7AN_DBUI4GkTpsvQ9fVVjZM9csQiEXhYekyrKu1nu_POpQonGd8yqkIyXPECNmmqH5jH4sFiF67XhD7_JpkvLziBpI-uh86evBUadmHhb9Otqw3uV3NTaXLzJw", - "none", - jwt.UnsafeAllowNoneSignatureType, - map[string]interface{}{"foo": "bar"}, - false, - }, -} - -func TestNoneVerify(t *testing.T) { - for _, data := range noneTestData { - parts := strings.Split(data.tokenString, ".") - - method := jwt.GetSigningMethod(data.alg) - err := method.Verify(strings.Join(parts[0:2], "."), parts[2], data.key) - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying key: %v", data.name, err) - } - if !data.valid && err == nil { - t.Errorf("[%v] Invalid key passed validation", data.name) - } - } -} - -func TestNoneSign(t *testing.T) { - for _, data := range noneTestData { - if data.valid { - parts := strings.Split(data.tokenString, ".") - method := jwt.GetSigningMethod(data.alg) - sig, err := method.Sign(strings.Join(parts[0:2], "."), data.key) - if err != nil { - t.Errorf("[%v] Error signing token: %v", data.name, err) - } - if sig != parts[2] { - t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", data.name, sig, parts[2]) - } - } - } -} +package jwt_test + +import ( + "github.com/dgrijalva/jwt-go" + "strings" + "testing" +) + +var noneTestData = []struct { + name string + tokenString string + alg string + key interface{} + claims map[string]interface{} + valid bool +}{ + { + "Basic", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.", + "none", + jwt.UnsafeAllowNoneSignatureType, + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic - no key", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.", + "none", + nil, + map[string]interface{}{"foo": "bar"}, + false, + }, + { + "Signed", + "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.W-jEzRfBigtCWsinvVVuldiuilzVdU5ty0MvpLaSaqK9PlAWWlDQ1VIQ_qSKzwL5IXaZkvZFJXT3yL3n7OUVu7zCNJzdwznbC8Z-b0z2lYvcklJYi2VOFRcGbJtXUqgjk2oGsiqUMUMOLP70TTefkpsgqDxbRh9CDUfpOJgW-dU7cmgaoswe3wjUAUi6B6G2YEaiuXC0XScQYSYVKIzgKXJV8Zw-7AN_DBUI4GkTpsvQ9fVVjZM9csQiEXhYekyrKu1nu_POpQonGd8yqkIyXPECNmmqH5jH4sFiF67XhD7_JpkvLziBpI-uh86evBUadmHhb9Otqw3uV3NTaXLzJw", + "none", + jwt.UnsafeAllowNoneSignatureType, + map[string]interface{}{"foo": "bar"}, + false, + }, +} + +func TestNoneVerify(t *testing.T) { + for _, data := range noneTestData { + parts := strings.Split(data.tokenString, ".") + + method := jwt.GetSigningMethod(data.alg) + err := method.Verify(strings.Join(parts[0:2], "."), parts[2], data.key) + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying key: %v", data.name, err) + } + if !data.valid && err == nil { + t.Errorf("[%v] Invalid key passed validation", data.name) + } + } +} + +func TestNoneSign(t *testing.T) { + for _, data := range noneTestData { + if data.valid { + parts := strings.Split(data.tokenString, ".") + method := jwt.GetSigningMethod(data.alg) + sig, err := method.Sign(strings.Join(parts[0:2], "."), data.key) + if err != nil { + t.Errorf("[%v] Error signing token: %v", data.name, err) + } + if sig != parts[2] { + t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", data.name, sig, parts[2]) + } + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/parser.go b/vendor/github.com/dgrijalva/jwt-go/parser.go index 3928634173..7bf1c4ea08 100644 --- a/vendor/github.com/dgrijalva/jwt-go/parser.go +++ b/vendor/github.com/dgrijalva/jwt-go/parser.go @@ -1,131 +1,131 @@ -package jwt - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" -) - -type Parser struct { - ValidMethods []string // If populated, only these methods will be considered valid - UseJSONNumber bool // Use JSON Number format in JSON decoder - SkipClaimsValidation bool // Skip claims validation during token parsing -} - -// Parse, validate, and return a token. -// keyFunc will receive the parsed token and should return the key for validating. -// If everything is kosher, err will be nil -func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { - return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) -} - -func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { - parts := strings.Split(tokenString, ".") - if len(parts) != 3 { - return nil, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed) - } - - var err error - token := &Token{Raw: tokenString} - - // parse Header - var headerBytes []byte - if headerBytes, err = DecodeSegment(parts[0]); err != nil { - if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") { - return token, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed) - } - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - if err = json.Unmarshal(headerBytes, &token.Header); err != nil { - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - - // parse Claims - var claimBytes []byte - token.Claims = claims - - if claimBytes, err = DecodeSegment(parts[1]); err != nil { - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) - if p.UseJSONNumber { - dec.UseNumber() - } - // JSON Decode. Special case for map type to avoid weird pointer behavior - if c, ok := token.Claims.(MapClaims); ok { - err = dec.Decode(&c) - } else { - err = dec.Decode(&claims) - } - // Handle decode error - if err != nil { - return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} - } - - // Lookup signature method - if method, ok := token.Header["alg"].(string); ok { - if token.Method = GetSigningMethod(method); token.Method == nil { - return token, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable) - } - } else { - return token, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable) - } - - // Verify signing method is in the required set - if p.ValidMethods != nil { - var signingMethodValid = false - var alg = token.Method.Alg() - for _, m := range p.ValidMethods { - if m == alg { - signingMethodValid = true - break - } - } - if !signingMethodValid { - // signing method is not in the listed set - return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid) - } - } - - // Lookup key - var key interface{} - if keyFunc == nil { - // keyFunc was not provided. short circuiting validation - return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable) - } - if key, err = keyFunc(token); err != nil { - // keyFunc returned an error - return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable} - } - - vErr := &ValidationError{} - - // Validate Claims - if !p.SkipClaimsValidation { - if err := token.Claims.Valid(); err != nil { - - // If the Claims Valid returned an error, check if it is a validation error, - // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set - if e, ok := err.(*ValidationError); !ok { - vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} - } else { - vErr = e - } - } - } - - // Perform validation - token.Signature = parts[2] - if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil { - vErr.Inner = err - vErr.Errors |= ValidationErrorSignatureInvalid - } - - if vErr.valid() { - token.Valid = true - return token, nil - } - - return token, vErr -} +package jwt + +import ( + "bytes" + "encoding/json" + "fmt" + "strings" +) + +type Parser struct { + ValidMethods []string // If populated, only these methods will be considered valid + UseJSONNumber bool // Use JSON Number format in JSON decoder + SkipClaimsValidation bool // Skip claims validation during token parsing +} + +// Parse, validate, and return a token. +// keyFunc will receive the parsed token and should return the key for validating. +// If everything is kosher, err will be nil +func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { + return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) +} + +func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { + parts := strings.Split(tokenString, ".") + if len(parts) != 3 { + return nil, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed) + } + + var err error + token := &Token{Raw: tokenString} + + // parse Header + var headerBytes []byte + if headerBytes, err = DecodeSegment(parts[0]); err != nil { + if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") { + return token, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed) + } + return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + if err = json.Unmarshal(headerBytes, &token.Header); err != nil { + return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + + // parse Claims + var claimBytes []byte + token.Claims = claims + + if claimBytes, err = DecodeSegment(parts[1]); err != nil { + return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) + if p.UseJSONNumber { + dec.UseNumber() + } + // JSON Decode. Special case for map type to avoid weird pointer behavior + if c, ok := token.Claims.(MapClaims); ok { + err = dec.Decode(&c) + } else { + err = dec.Decode(&claims) + } + // Handle decode error + if err != nil { + return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + + // Lookup signature method + if method, ok := token.Header["alg"].(string); ok { + if token.Method = GetSigningMethod(method); token.Method == nil { + return token, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable) + } + } else { + return token, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable) + } + + // Verify signing method is in the required set + if p.ValidMethods != nil { + var signingMethodValid = false + var alg = token.Method.Alg() + for _, m := range p.ValidMethods { + if m == alg { + signingMethodValid = true + break + } + } + if !signingMethodValid { + // signing method is not in the listed set + return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid) + } + } + + // Lookup key + var key interface{} + if keyFunc == nil { + // keyFunc was not provided. short circuiting validation + return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable) + } + if key, err = keyFunc(token); err != nil { + // keyFunc returned an error + return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable} + } + + vErr := &ValidationError{} + + // Validate Claims + if !p.SkipClaimsValidation { + if err := token.Claims.Valid(); err != nil { + + // If the Claims Valid returned an error, check if it is a validation error, + // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set + if e, ok := err.(*ValidationError); !ok { + vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} + } else { + vErr = e + } + } + } + + // Perform validation + token.Signature = parts[2] + if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil { + vErr.Inner = err + vErr.Errors |= ValidationErrorSignatureInvalid + } + + if vErr.valid() { + token.Valid = true + return token, nil + } + + return token, vErr +} diff --git a/vendor/github.com/dgrijalva/jwt-go/parser_test.go b/vendor/github.com/dgrijalva/jwt-go/parser_test.go index 712841be60..f8ad6f9083 100644 --- a/vendor/github.com/dgrijalva/jwt-go/parser_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/parser_test.go @@ -1,261 +1,261 @@ -package jwt_test - -import ( - "crypto/rsa" - "encoding/json" - "fmt" - "reflect" - "testing" - "time" - - "github.com/dgrijalva/jwt-go" - "github.com/dgrijalva/jwt-go/test" -) - -var keyFuncError error = fmt.Errorf("error loading key") - -var ( - jwtTestDefaultKey *rsa.PublicKey - defaultKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return jwtTestDefaultKey, nil } - emptyKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return nil, nil } - errorKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return nil, keyFuncError } - nilKeyFunc jwt.Keyfunc = nil -) - -func init() { - jwtTestDefaultKey = test.LoadRSAPublicKeyFromDisk("test/sample_key.pub") -} - -var jwtTestData = []struct { - name string - tokenString string - keyfunc jwt.Keyfunc - claims jwt.Claims - valid bool - errors uint32 - parser *jwt.Parser -}{ - { - "basic", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - defaultKeyFunc, - jwt.MapClaims{"foo": "bar"}, - true, - 0, - nil, - }, - { - "basic expired", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "exp": float64(time.Now().Unix() - 100)}, - false, - jwt.ValidationErrorExpired, - nil, - }, - { - "basic nbf", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "nbf": float64(time.Now().Unix() + 100)}, - false, - jwt.ValidationErrorNotValidYet, - nil, - }, - { - "expired and nbf", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "nbf": float64(time.Now().Unix() + 100), "exp": float64(time.Now().Unix() - 100)}, - false, - jwt.ValidationErrorNotValidYet | jwt.ValidationErrorExpired, - nil, - }, - { - "basic invalid", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.EhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - defaultKeyFunc, - jwt.MapClaims{"foo": "bar"}, - false, - jwt.ValidationErrorSignatureInvalid, - nil, - }, - { - "basic nokeyfunc", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - nilKeyFunc, - jwt.MapClaims{"foo": "bar"}, - false, - jwt.ValidationErrorUnverifiable, - nil, - }, - { - "basic nokey", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - emptyKeyFunc, - jwt.MapClaims{"foo": "bar"}, - false, - jwt.ValidationErrorSignatureInvalid, - nil, - }, - { - "basic errorkey", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - errorKeyFunc, - jwt.MapClaims{"foo": "bar"}, - false, - jwt.ValidationErrorUnverifiable, - nil, - }, - { - "invalid signing method", - "", - defaultKeyFunc, - jwt.MapClaims{"foo": "bar"}, - false, - jwt.ValidationErrorSignatureInvalid, - &jwt.Parser{ValidMethods: []string{"HS256"}}, - }, - { - "valid signing method", - "", - defaultKeyFunc, - jwt.MapClaims{"foo": "bar"}, - true, - 0, - &jwt.Parser{ValidMethods: []string{"RS256", "HS256"}}, - }, - { - "JSON Number", - "", - defaultKeyFunc, - jwt.MapClaims{"foo": json.Number("123.4")}, - true, - 0, - &jwt.Parser{UseJSONNumber: true}, - }, - { - "Standard Claims", - "", - defaultKeyFunc, - &jwt.StandardClaims{ - ExpiresAt: time.Now().Add(time.Second * 10).Unix(), - }, - true, - 0, - &jwt.Parser{UseJSONNumber: true}, - }, - { - "JSON Number - basic expired", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "exp": json.Number(fmt.Sprintf("%v", time.Now().Unix()-100))}, - false, - jwt.ValidationErrorExpired, - &jwt.Parser{UseJSONNumber: true}, - }, - { - "JSON Number - basic nbf", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100))}, - false, - jwt.ValidationErrorNotValidYet, - &jwt.Parser{UseJSONNumber: true}, - }, - { - "JSON Number - expired and nbf", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100)), "exp": json.Number(fmt.Sprintf("%v", time.Now().Unix()-100))}, - false, - jwt.ValidationErrorNotValidYet | jwt.ValidationErrorExpired, - &jwt.Parser{UseJSONNumber: true}, - }, - { - "SkipClaimsValidation during token parsing", - "", // autogen - defaultKeyFunc, - jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100))}, - true, - 0, - &jwt.Parser{UseJSONNumber: true, SkipClaimsValidation: true}, - }, -} - -func TestParser_Parse(t *testing.T) { - privateKey := test.LoadRSAPrivateKeyFromDisk("test/sample_key") - - // Iterate over test data set and run tests - for _, data := range jwtTestData { - // If the token string is blank, use helper function to generate string - if data.tokenString == "" { - data.tokenString = test.MakeSampleToken(data.claims, privateKey) - } - - // Parse the token - var token *jwt.Token - var err error - var parser = data.parser - if parser == nil { - parser = new(jwt.Parser) - } - // Figure out correct claims type - switch data.claims.(type) { - case jwt.MapClaims: - token, err = parser.ParseWithClaims(data.tokenString, jwt.MapClaims{}, data.keyfunc) - case *jwt.StandardClaims: - token, err = parser.ParseWithClaims(data.tokenString, &jwt.StandardClaims{}, data.keyfunc) - } - - // Verify result matches expectation - if !reflect.DeepEqual(data.claims, token.Claims) { - t.Errorf("[%v] Claims mismatch. Expecting: %v Got: %v", data.name, data.claims, token.Claims) - } - - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying token: %T:%v", data.name, err, err) - } - - if !data.valid && err == nil { - t.Errorf("[%v] Invalid token passed validation", data.name) - } - - if (err == nil && !token.Valid) || (err != nil && token.Valid) { - t.Errorf("[%v] Inconsistent behavior between returned error and token.Valid", data.name) - } - - if data.errors != 0 { - if err == nil { - t.Errorf("[%v] Expecting error. Didn't get one.", data.name) - } else { - - ve := err.(*jwt.ValidationError) - // compare the bitfield part of the error - if e := ve.Errors; e != data.errors { - t.Errorf("[%v] Errors don't match expectation. %v != %v", data.name, e, data.errors) - } - - if err.Error() == keyFuncError.Error() && ve.Inner != keyFuncError { - t.Errorf("[%v] Inner error does not match expectation. %v != %v", data.name, ve.Inner, keyFuncError) - } - } - } - if data.valid && token.Signature == "" { - t.Errorf("[%v] Signature is left unpopulated after parsing", data.name) - } - } -} - -// Helper method for benchmarking various methods -func benchmarkSigning(b *testing.B, method jwt.SigningMethod, key interface{}) { - t := jwt.New(method) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - if _, err := t.SignedString(key); err != nil { - b.Fatal(err) - } - } - }) - -} +package jwt_test + +import ( + "crypto/rsa" + "encoding/json" + "fmt" + "reflect" + "testing" + "time" + + "github.com/dgrijalva/jwt-go" + "github.com/dgrijalva/jwt-go/test" +) + +var keyFuncError error = fmt.Errorf("error loading key") + +var ( + jwtTestDefaultKey *rsa.PublicKey + defaultKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return jwtTestDefaultKey, nil } + emptyKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return nil, nil } + errorKeyFunc jwt.Keyfunc = func(t *jwt.Token) (interface{}, error) { return nil, keyFuncError } + nilKeyFunc jwt.Keyfunc = nil +) + +func init() { + jwtTestDefaultKey = test.LoadRSAPublicKeyFromDisk("test/sample_key.pub") +} + +var jwtTestData = []struct { + name string + tokenString string + keyfunc jwt.Keyfunc + claims jwt.Claims + valid bool + errors uint32 + parser *jwt.Parser +}{ + { + "basic", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + defaultKeyFunc, + jwt.MapClaims{"foo": "bar"}, + true, + 0, + nil, + }, + { + "basic expired", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "exp": float64(time.Now().Unix() - 100)}, + false, + jwt.ValidationErrorExpired, + nil, + }, + { + "basic nbf", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "nbf": float64(time.Now().Unix() + 100)}, + false, + jwt.ValidationErrorNotValidYet, + nil, + }, + { + "expired and nbf", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "nbf": float64(time.Now().Unix() + 100), "exp": float64(time.Now().Unix() - 100)}, + false, + jwt.ValidationErrorNotValidYet | jwt.ValidationErrorExpired, + nil, + }, + { + "basic invalid", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.EhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + defaultKeyFunc, + jwt.MapClaims{"foo": "bar"}, + false, + jwt.ValidationErrorSignatureInvalid, + nil, + }, + { + "basic nokeyfunc", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + nilKeyFunc, + jwt.MapClaims{"foo": "bar"}, + false, + jwt.ValidationErrorUnverifiable, + nil, + }, + { + "basic nokey", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + emptyKeyFunc, + jwt.MapClaims{"foo": "bar"}, + false, + jwt.ValidationErrorSignatureInvalid, + nil, + }, + { + "basic errorkey", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + errorKeyFunc, + jwt.MapClaims{"foo": "bar"}, + false, + jwt.ValidationErrorUnverifiable, + nil, + }, + { + "invalid signing method", + "", + defaultKeyFunc, + jwt.MapClaims{"foo": "bar"}, + false, + jwt.ValidationErrorSignatureInvalid, + &jwt.Parser{ValidMethods: []string{"HS256"}}, + }, + { + "valid signing method", + "", + defaultKeyFunc, + jwt.MapClaims{"foo": "bar"}, + true, + 0, + &jwt.Parser{ValidMethods: []string{"RS256", "HS256"}}, + }, + { + "JSON Number", + "", + defaultKeyFunc, + jwt.MapClaims{"foo": json.Number("123.4")}, + true, + 0, + &jwt.Parser{UseJSONNumber: true}, + }, + { + "Standard Claims", + "", + defaultKeyFunc, + &jwt.StandardClaims{ + ExpiresAt: time.Now().Add(time.Second * 10).Unix(), + }, + true, + 0, + &jwt.Parser{UseJSONNumber: true}, + }, + { + "JSON Number - basic expired", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "exp": json.Number(fmt.Sprintf("%v", time.Now().Unix()-100))}, + false, + jwt.ValidationErrorExpired, + &jwt.Parser{UseJSONNumber: true}, + }, + { + "JSON Number - basic nbf", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100))}, + false, + jwt.ValidationErrorNotValidYet, + &jwt.Parser{UseJSONNumber: true}, + }, + { + "JSON Number - expired and nbf", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100)), "exp": json.Number(fmt.Sprintf("%v", time.Now().Unix()-100))}, + false, + jwt.ValidationErrorNotValidYet | jwt.ValidationErrorExpired, + &jwt.Parser{UseJSONNumber: true}, + }, + { + "SkipClaimsValidation during token parsing", + "", // autogen + defaultKeyFunc, + jwt.MapClaims{"foo": "bar", "nbf": json.Number(fmt.Sprintf("%v", time.Now().Unix()+100))}, + true, + 0, + &jwt.Parser{UseJSONNumber: true, SkipClaimsValidation: true}, + }, +} + +func TestParser_Parse(t *testing.T) { + privateKey := test.LoadRSAPrivateKeyFromDisk("test/sample_key") + + // Iterate over test data set and run tests + for _, data := range jwtTestData { + // If the token string is blank, use helper function to generate string + if data.tokenString == "" { + data.tokenString = test.MakeSampleToken(data.claims, privateKey) + } + + // Parse the token + var token *jwt.Token + var err error + var parser = data.parser + if parser == nil { + parser = new(jwt.Parser) + } + // Figure out correct claims type + switch data.claims.(type) { + case jwt.MapClaims: + token, err = parser.ParseWithClaims(data.tokenString, jwt.MapClaims{}, data.keyfunc) + case *jwt.StandardClaims: + token, err = parser.ParseWithClaims(data.tokenString, &jwt.StandardClaims{}, data.keyfunc) + } + + // Verify result matches expectation + if !reflect.DeepEqual(data.claims, token.Claims) { + t.Errorf("[%v] Claims mismatch. Expecting: %v Got: %v", data.name, data.claims, token.Claims) + } + + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying token: %T:%v", data.name, err, err) + } + + if !data.valid && err == nil { + t.Errorf("[%v] Invalid token passed validation", data.name) + } + + if (err == nil && !token.Valid) || (err != nil && token.Valid) { + t.Errorf("[%v] Inconsistent behavior between returned error and token.Valid", data.name) + } + + if data.errors != 0 { + if err == nil { + t.Errorf("[%v] Expecting error. Didn't get one.", data.name) + } else { + + ve := err.(*jwt.ValidationError) + // compare the bitfield part of the error + if e := ve.Errors; e != data.errors { + t.Errorf("[%v] Errors don't match expectation. %v != %v", data.name, e, data.errors) + } + + if err.Error() == keyFuncError.Error() && ve.Inner != keyFuncError { + t.Errorf("[%v] Inner error does not match expectation. %v != %v", data.name, ve.Inner, keyFuncError) + } + } + } + if data.valid && token.Signature == "" { + t.Errorf("[%v] Signature is left unpopulated after parsing", data.name) + } + } +} + +// Helper method for benchmarking various methods +func benchmarkSigning(b *testing.B, method jwt.SigningMethod, key interface{}) { + t := jwt.New(method) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + if _, err := t.SignedString(key); err != nil { + b.Fatal(err) + } + } + }) + +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/doc.go b/vendor/github.com/dgrijalva/jwt-go/request/doc.go index b6767d4601..c01069c984 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/doc.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/doc.go @@ -1,7 +1,7 @@ -// Utility package for extracting JWT tokens from -// HTTP requests. -// -// The main function is ParseFromRequest and it's WithClaims variant. -// See examples for how to use the various Extractor implementations -// or roll your own. -package request +// Utility package for extracting JWT tokens from +// HTTP requests. +// +// The main function is ParseFromRequest and it's WithClaims variant. +// See examples for how to use the various Extractor implementations +// or roll your own. +package request diff --git a/vendor/github.com/dgrijalva/jwt-go/request/extractor.go b/vendor/github.com/dgrijalva/jwt-go/request/extractor.go index 2b890a45ae..14414fe2f2 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/extractor.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/extractor.go @@ -1,81 +1,81 @@ -package request - -import ( - "errors" - "net/http" -) - -// Errors -var ( - ErrNoTokenInRequest = errors.New("no token present in request") -) - -// Interface for extracting a token from an HTTP request. -// The ExtractToken method should return a token string or an error. -// If no token is present, you must return ErrNoTokenInRequest. -type Extractor interface { - ExtractToken(*http.Request) (string, error) -} - -// Extractor for finding a token in a header. Looks at each specified -// header in order until there's a match -type HeaderExtractor []string - -func (e HeaderExtractor) ExtractToken(req *http.Request) (string, error) { - // loop over header names and return the first one that contains data - for _, header := range e { - if ah := req.Header.Get(header); ah != "" { - return ah, nil - } - } - return "", ErrNoTokenInRequest -} - -// Extract token from request arguments. This includes a POSTed form or -// GET URL arguments. Argument names are tried in order until there's a match. -// This extractor calls `ParseMultipartForm` on the request -type ArgumentExtractor []string - -func (e ArgumentExtractor) ExtractToken(req *http.Request) (string, error) { - // Make sure form is parsed - req.ParseMultipartForm(10e6) - - // loop over arg names and return the first one that contains data - for _, arg := range e { - if ah := req.Form.Get(arg); ah != "" { - return ah, nil - } - } - - return "", ErrNoTokenInRequest -} - -// Tries Extractors in order until one returns a token string or an error occurs -type MultiExtractor []Extractor - -func (e MultiExtractor) ExtractToken(req *http.Request) (string, error) { - // loop over header names and return the first one that contains data - for _, extractor := range e { - if tok, err := extractor.ExtractToken(req); tok != "" { - return tok, nil - } else if err != ErrNoTokenInRequest { - return "", err - } - } - return "", ErrNoTokenInRequest -} - -// Wrap an Extractor in this to post-process the value before it's handed off. -// See AuthorizationHeaderExtractor for an example -type PostExtractionFilter struct { - Extractor - Filter func(string) (string, error) -} - -func (e *PostExtractionFilter) ExtractToken(req *http.Request) (string, error) { - if tok, err := e.Extractor.ExtractToken(req); tok != "" { - return e.Filter(tok) - } else { - return "", err - } -} +package request + +import ( + "errors" + "net/http" +) + +// Errors +var ( + ErrNoTokenInRequest = errors.New("no token present in request") +) + +// Interface for extracting a token from an HTTP request. +// The ExtractToken method should return a token string or an error. +// If no token is present, you must return ErrNoTokenInRequest. +type Extractor interface { + ExtractToken(*http.Request) (string, error) +} + +// Extractor for finding a token in a header. Looks at each specified +// header in order until there's a match +type HeaderExtractor []string + +func (e HeaderExtractor) ExtractToken(req *http.Request) (string, error) { + // loop over header names and return the first one that contains data + for _, header := range e { + if ah := req.Header.Get(header); ah != "" { + return ah, nil + } + } + return "", ErrNoTokenInRequest +} + +// Extract token from request arguments. This includes a POSTed form or +// GET URL arguments. Argument names are tried in order until there's a match. +// This extractor calls `ParseMultipartForm` on the request +type ArgumentExtractor []string + +func (e ArgumentExtractor) ExtractToken(req *http.Request) (string, error) { + // Make sure form is parsed + req.ParseMultipartForm(10e6) + + // loop over arg names and return the first one that contains data + for _, arg := range e { + if ah := req.Form.Get(arg); ah != "" { + return ah, nil + } + } + + return "", ErrNoTokenInRequest +} + +// Tries Extractors in order until one returns a token string or an error occurs +type MultiExtractor []Extractor + +func (e MultiExtractor) ExtractToken(req *http.Request) (string, error) { + // loop over header names and return the first one that contains data + for _, extractor := range e { + if tok, err := extractor.ExtractToken(req); tok != "" { + return tok, nil + } else if err != ErrNoTokenInRequest { + return "", err + } + } + return "", ErrNoTokenInRequest +} + +// Wrap an Extractor in this to post-process the value before it's handed off. +// See AuthorizationHeaderExtractor for an example +type PostExtractionFilter struct { + Extractor + Filter func(string) (string, error) +} + +func (e *PostExtractionFilter) ExtractToken(req *http.Request) (string, error) { + if tok, err := e.Extractor.ExtractToken(req); tok != "" { + return e.Filter(tok) + } else { + return "", err + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/extractor_example_test.go b/vendor/github.com/dgrijalva/jwt-go/request/extractor_example_test.go index 84092b8139..a994ffe586 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/extractor_example_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/extractor_example_test.go @@ -1,32 +1,32 @@ -package request - -import ( - "fmt" - "net/url" -) - -const ( - exampleTokenA = "A" -) - -func ExampleHeaderExtractor() { - req := makeExampleRequest("GET", "/", map[string]string{"Token": exampleTokenA}, nil) - tokenString, err := HeaderExtractor{"Token"}.ExtractToken(req) - if err == nil { - fmt.Println(tokenString) - } else { - fmt.Println(err) - } - //Output: A -} - -func ExampleArgumentExtractor() { - req := makeExampleRequest("GET", "/", nil, url.Values{"token": {extractorTestTokenA}}) - tokenString, err := ArgumentExtractor{"token"}.ExtractToken(req) - if err == nil { - fmt.Println(tokenString) - } else { - fmt.Println(err) - } - //Output: A -} +package request + +import ( + "fmt" + "net/url" +) + +const ( + exampleTokenA = "A" +) + +func ExampleHeaderExtractor() { + req := makeExampleRequest("GET", "/", map[string]string{"Token": exampleTokenA}, nil) + tokenString, err := HeaderExtractor{"Token"}.ExtractToken(req) + if err == nil { + fmt.Println(tokenString) + } else { + fmt.Println(err) + } + //Output: A +} + +func ExampleArgumentExtractor() { + req := makeExampleRequest("GET", "/", nil, url.Values{"token": {extractorTestTokenA}}) + tokenString, err := ArgumentExtractor{"token"}.ExtractToken(req) + if err == nil { + fmt.Println(tokenString) + } else { + fmt.Println(err) + } + //Output: A +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go b/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go index 7579235e33..e3bbb0a3eb 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/extractor_test.go @@ -1,91 +1,91 @@ -package request - -import ( - "fmt" - "net/http" - "net/url" - "testing" -) - -var extractorTestTokenA = "A" -var extractorTestTokenB = "B" - -var extractorTestData = []struct { - name string - extractor Extractor - headers map[string]string - query url.Values - token string - err error -}{ - { - name: "simple header", - extractor: HeaderExtractor{"Foo"}, - headers: map[string]string{"Foo": extractorTestTokenA}, - query: nil, - token: extractorTestTokenA, - err: nil, - }, - { - name: "simple argument", - extractor: ArgumentExtractor{"token"}, - headers: map[string]string{}, - query: url.Values{"token": {extractorTestTokenA}}, - token: extractorTestTokenA, - err: nil, - }, - { - name: "multiple extractors", - extractor: MultiExtractor{ - HeaderExtractor{"Foo"}, - ArgumentExtractor{"token"}, - }, - headers: map[string]string{"Foo": extractorTestTokenA}, - query: url.Values{"token": {extractorTestTokenB}}, - token: extractorTestTokenA, - err: nil, - }, - { - name: "simple miss", - extractor: HeaderExtractor{"This-Header-Is-Not-Set"}, - headers: map[string]string{"Foo": extractorTestTokenA}, - query: nil, - token: "", - err: ErrNoTokenInRequest, - }, - { - name: "filter", - extractor: AuthorizationHeaderExtractor, - headers: map[string]string{"Authorization": "Bearer " + extractorTestTokenA}, - query: nil, - token: extractorTestTokenA, - err: nil, - }, -} - -func TestExtractor(t *testing.T) { - // Bearer token request - for _, data := range extractorTestData { - // Make request from test struct - r := makeExampleRequest("GET", "/", data.headers, data.query) - - // Test extractor - token, err := data.extractor.ExtractToken(r) - if token != data.token { - t.Errorf("[%v] Expected token '%v'. Got '%v'", data.name, data.token, token) - continue - } - if err != data.err { - t.Errorf("[%v] Expected error '%v'. Got '%v'", data.name, data.err, err) - continue - } - } -} - -func makeExampleRequest(method, path string, headers map[string]string, urlArgs url.Values) *http.Request { - r, _ := http.NewRequest(method, fmt.Sprintf("%v?%v", path, urlArgs.Encode()), nil) - for k, v := range headers { - r.Header.Set(k, v) - } - return r -} +package request + +import ( + "fmt" + "net/http" + "net/url" + "testing" +) + +var extractorTestTokenA = "A" +var extractorTestTokenB = "B" + +var extractorTestData = []struct { + name string + extractor Extractor + headers map[string]string + query url.Values + token string + err error +}{ + { + name: "simple header", + extractor: HeaderExtractor{"Foo"}, + headers: map[string]string{"Foo": extractorTestTokenA}, + query: nil, + token: extractorTestTokenA, + err: nil, + }, + { + name: "simple argument", + extractor: ArgumentExtractor{"token"}, + headers: map[string]string{}, + query: url.Values{"token": {extractorTestTokenA}}, + token: extractorTestTokenA, + err: nil, + }, + { + name: "multiple extractors", + extractor: MultiExtractor{ + HeaderExtractor{"Foo"}, + ArgumentExtractor{"token"}, + }, + headers: map[string]string{"Foo": extractorTestTokenA}, + query: url.Values{"token": {extractorTestTokenB}}, + token: extractorTestTokenA, + err: nil, + }, + { + name: "simple miss", + extractor: HeaderExtractor{"This-Header-Is-Not-Set"}, + headers: map[string]string{"Foo": extractorTestTokenA}, + query: nil, + token: "", + err: ErrNoTokenInRequest, + }, + { + name: "filter", + extractor: AuthorizationHeaderExtractor, + headers: map[string]string{"Authorization": "Bearer " + extractorTestTokenA}, + query: nil, + token: extractorTestTokenA, + err: nil, + }, +} + +func TestExtractor(t *testing.T) { + // Bearer token request + for _, data := range extractorTestData { + // Make request from test struct + r := makeExampleRequest("GET", "/", data.headers, data.query) + + // Test extractor + token, err := data.extractor.ExtractToken(r) + if token != data.token { + t.Errorf("[%v] Expected token '%v'. Got '%v'", data.name, data.token, token) + continue + } + if err != data.err { + t.Errorf("[%v] Expected error '%v'. Got '%v'", data.name, data.err, err) + continue + } + } +} + +func makeExampleRequest(method, path string, headers map[string]string, urlArgs url.Values) *http.Request { + r, _ := http.NewRequest(method, fmt.Sprintf("%v?%v", path, urlArgs.Encode()), nil) + for k, v := range headers { + r.Header.Set(k, v) + } + return r +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go b/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go index a50e1bc6aa..5948694a51 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/oauth2.go @@ -1,28 +1,28 @@ -package request - -import ( - "strings" -) - -// Strips 'Bearer ' prefix from bearer token string -func stripBearerPrefixFromTokenString(tok string) (string, error) { - // Should be a bearer token - if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " { - return tok[7:], nil - } - return tok, nil -} - -// Extract bearer token from Authorization header -// Uses PostExtractionFilter to strip "Bearer " prefix from header -var AuthorizationHeaderExtractor = &PostExtractionFilter{ - HeaderExtractor{"Authorization"}, - stripBearerPrefixFromTokenString, -} - -// Extractor for OAuth2 access tokens. Looks in 'Authorization' -// header then 'access_token' argument for a token. -var OAuth2Extractor = &MultiExtractor{ - AuthorizationHeaderExtractor, - ArgumentExtractor{"access_token"}, -} +package request + +import ( + "strings" +) + +// Strips 'Bearer ' prefix from bearer token string +func stripBearerPrefixFromTokenString(tok string) (string, error) { + // Should be a bearer token + if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " { + return tok[7:], nil + } + return tok, nil +} + +// Extract bearer token from Authorization header +// Uses PostExtractionFilter to strip "Bearer " prefix from header +var AuthorizationHeaderExtractor = &PostExtractionFilter{ + HeaderExtractor{"Authorization"}, + stripBearerPrefixFromTokenString, +} + +// Extractor for OAuth2 access tokens. Looks in 'Authorization' +// header then 'access_token' argument for a token. +var OAuth2Extractor = &MultiExtractor{ + AuthorizationHeaderExtractor, + ArgumentExtractor{"access_token"}, +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/request.go b/vendor/github.com/dgrijalva/jwt-go/request/request.go index 1affd20680..1807b39658 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/request.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/request.go @@ -1,24 +1,24 @@ -package request - -import ( - "github.com/dgrijalva/jwt-go" - "net/http" -) - -// Extract and parse a JWT token from an HTTP request. -// This behaves the same as Parse, but accepts a request and an extractor -// instead of a token string. The Extractor interface allows you to define -// the logic for extracting a token. Several useful implementations are provided. -func ParseFromRequest(req *http.Request, extractor Extractor, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) { - return ParseFromRequestWithClaims(req, extractor, jwt.MapClaims{}, keyFunc) -} - -// ParseFromRequest but with custom Claims type -func ParseFromRequestWithClaims(req *http.Request, extractor Extractor, claims jwt.Claims, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) { - // Extract token from request - if tokStr, err := extractor.ExtractToken(req); err == nil { - return jwt.ParseWithClaims(tokStr, claims, keyFunc) - } else { - return nil, err - } -} +package request + +import ( + "github.com/dgrijalva/jwt-go" + "net/http" +) + +// Extract and parse a JWT token from an HTTP request. +// This behaves the same as Parse, but accepts a request and an extractor +// instead of a token string. The Extractor interface allows you to define +// the logic for extracting a token. Several useful implementations are provided. +func ParseFromRequest(req *http.Request, extractor Extractor, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) { + return ParseFromRequestWithClaims(req, extractor, jwt.MapClaims{}, keyFunc) +} + +// ParseFromRequest but with custom Claims type +func ParseFromRequestWithClaims(req *http.Request, extractor Extractor, claims jwt.Claims, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) { + // Extract token from request + if tokStr, err := extractor.ExtractToken(req); err == nil { + return jwt.ParseWithClaims(tokStr, claims, keyFunc) + } else { + return nil, err + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/request/request_test.go b/vendor/github.com/dgrijalva/jwt-go/request/request_test.go index 7dae6978d6..b4365cd869 100644 --- a/vendor/github.com/dgrijalva/jwt-go/request/request_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/request/request_test.go @@ -1,103 +1,103 @@ -package request - -import ( - "fmt" - "github.com/dgrijalva/jwt-go" - "github.com/dgrijalva/jwt-go/test" - "net/http" - "net/url" - "reflect" - "strings" - "testing" -) - -var requestTestData = []struct { - name string - claims jwt.MapClaims - extractor Extractor - headers map[string]string - query url.Values - valid bool -}{ - { - "authorization bearer token", - jwt.MapClaims{"foo": "bar"}, - AuthorizationHeaderExtractor, - map[string]string{"Authorization": "Bearer %v"}, - url.Values{}, - true, - }, - { - "oauth bearer token - header", - jwt.MapClaims{"foo": "bar"}, - OAuth2Extractor, - map[string]string{"Authorization": "Bearer %v"}, - url.Values{}, - true, - }, - { - "oauth bearer token - url", - jwt.MapClaims{"foo": "bar"}, - OAuth2Extractor, - map[string]string{}, - url.Values{"access_token": {"%v"}}, - true, - }, - { - "url token", - jwt.MapClaims{"foo": "bar"}, - ArgumentExtractor{"token"}, - map[string]string{}, - url.Values{"token": {"%v"}}, - true, - }, -} - -func TestParseRequest(t *testing.T) { - // load keys from disk - privateKey := test.LoadRSAPrivateKeyFromDisk("../test/sample_key") - publicKey := test.LoadRSAPublicKeyFromDisk("../test/sample_key.pub") - keyfunc := func(*jwt.Token) (interface{}, error) { - return publicKey, nil - } - - // Bearer token request - for _, data := range requestTestData { - // Make token from claims - tokenString := test.MakeSampleToken(data.claims, privateKey) - - // Make query string - for k, vv := range data.query { - for i, v := range vv { - if strings.Contains(v, "%v") { - data.query[k][i] = fmt.Sprintf(v, tokenString) - } - } - } - - // Make request from test struct - r, _ := http.NewRequest("GET", fmt.Sprintf("/?%v", data.query.Encode()), nil) - for k, v := range data.headers { - if strings.Contains(v, "%v") { - r.Header.Set(k, fmt.Sprintf(v, tokenString)) - } else { - r.Header.Set(k, tokenString) - } - } - token, err := ParseFromRequestWithClaims(r, data.extractor, jwt.MapClaims{}, keyfunc) - - if token == nil { - t.Errorf("[%v] Token was not found: %v", data.name, err) - continue - } - if !reflect.DeepEqual(data.claims, token.Claims) { - t.Errorf("[%v] Claims mismatch. Expecting: %v Got: %v", data.name, data.claims, token.Claims) - } - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying token: %v", data.name, err) - } - if !data.valid && err == nil { - t.Errorf("[%v] Invalid token passed validation", data.name) - } - } -} +package request + +import ( + "fmt" + "github.com/dgrijalva/jwt-go" + "github.com/dgrijalva/jwt-go/test" + "net/http" + "net/url" + "reflect" + "strings" + "testing" +) + +var requestTestData = []struct { + name string + claims jwt.MapClaims + extractor Extractor + headers map[string]string + query url.Values + valid bool +}{ + { + "authorization bearer token", + jwt.MapClaims{"foo": "bar"}, + AuthorizationHeaderExtractor, + map[string]string{"Authorization": "Bearer %v"}, + url.Values{}, + true, + }, + { + "oauth bearer token - header", + jwt.MapClaims{"foo": "bar"}, + OAuth2Extractor, + map[string]string{"Authorization": "Bearer %v"}, + url.Values{}, + true, + }, + { + "oauth bearer token - url", + jwt.MapClaims{"foo": "bar"}, + OAuth2Extractor, + map[string]string{}, + url.Values{"access_token": {"%v"}}, + true, + }, + { + "url token", + jwt.MapClaims{"foo": "bar"}, + ArgumentExtractor{"token"}, + map[string]string{}, + url.Values{"token": {"%v"}}, + true, + }, +} + +func TestParseRequest(t *testing.T) { + // load keys from disk + privateKey := test.LoadRSAPrivateKeyFromDisk("../test/sample_key") + publicKey := test.LoadRSAPublicKeyFromDisk("../test/sample_key.pub") + keyfunc := func(*jwt.Token) (interface{}, error) { + return publicKey, nil + } + + // Bearer token request + for _, data := range requestTestData { + // Make token from claims + tokenString := test.MakeSampleToken(data.claims, privateKey) + + // Make query string + for k, vv := range data.query { + for i, v := range vv { + if strings.Contains(v, "%v") { + data.query[k][i] = fmt.Sprintf(v, tokenString) + } + } + } + + // Make request from test struct + r, _ := http.NewRequest("GET", fmt.Sprintf("/?%v", data.query.Encode()), nil) + for k, v := range data.headers { + if strings.Contains(v, "%v") { + r.Header.Set(k, fmt.Sprintf(v, tokenString)) + } else { + r.Header.Set(k, tokenString) + } + } + token, err := ParseFromRequestWithClaims(r, data.extractor, jwt.MapClaims{}, keyfunc) + + if token == nil { + t.Errorf("[%v] Token was not found: %v", data.name, err) + continue + } + if !reflect.DeepEqual(data.claims, token.Claims) { + t.Errorf("[%v] Claims mismatch. Expecting: %v Got: %v", data.name, data.claims, token.Claims) + } + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying token: %v", data.name, err) + } + if !data.valid && err == nil { + t.Errorf("[%v] Invalid token passed validation", data.name) + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa.go b/vendor/github.com/dgrijalva/jwt-go/rsa.go index 87a14901a4..0ae0b1984e 100644 --- a/vendor/github.com/dgrijalva/jwt-go/rsa.go +++ b/vendor/github.com/dgrijalva/jwt-go/rsa.go @@ -1,100 +1,100 @@ -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// Implements the RSA family of signing methods signing methods -type SigningMethodRSA struct { - Name string - Hash crypto.Hash -} - -// Specific instances for RS256 and company -var ( - SigningMethodRS256 *SigningMethodRSA - SigningMethodRS384 *SigningMethodRSA - SigningMethodRS512 *SigningMethodRSA -) - -func init() { - // RS256 - SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { - return SigningMethodRS256 - }) - - // RS384 - SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { - return SigningMethodRS384 - }) - - // RS512 - SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { - return SigningMethodRS512 - }) -} - -func (m *SigningMethodRSA) Alg() string { - return m.Name -} - -// Implements the Verify method from SigningMethod -// For this signing method, must be an rsa.PublicKey structure. -func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - var rsaKey *rsa.PublicKey - var ok bool - - if rsaKey, ok = key.(*rsa.PublicKey); !ok { - return ErrInvalidKeyType - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) -} - -// Implements the Sign method from SigningMethod -// For this signing method, must be an rsa.PrivateKey structure. -func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) { - var rsaKey *rsa.PrivateKey - var ok bool - - // Validate type of key - if rsaKey, ok = key.(*rsa.PrivateKey); !ok { - return "", ErrInvalidKey - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { - return EncodeSegment(sigBytes), nil - } else { - return "", err - } -} +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// Implements the RSA family of signing methods signing methods +type SigningMethodRSA struct { + Name string + Hash crypto.Hash +} + +// Specific instances for RS256 and company +var ( + SigningMethodRS256 *SigningMethodRSA + SigningMethodRS384 *SigningMethodRSA + SigningMethodRS512 *SigningMethodRSA +) + +func init() { + // RS256 + SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { + return SigningMethodRS256 + }) + + // RS384 + SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { + return SigningMethodRS384 + }) + + // RS512 + SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { + return SigningMethodRS512 + }) +} + +func (m *SigningMethodRSA) Alg() string { + return m.Name +} + +// Implements the Verify method from SigningMethod +// For this signing method, must be an rsa.PublicKey structure. +func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error { + var err error + + // Decode the signature + var sig []byte + if sig, err = DecodeSegment(signature); err != nil { + return err + } + + var rsaKey *rsa.PublicKey + var ok bool + + if rsaKey, ok = key.(*rsa.PublicKey); !ok { + return ErrInvalidKeyType + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) +} + +// Implements the Sign method from SigningMethod +// For this signing method, must be an rsa.PrivateKey structure. +func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) { + var rsaKey *rsa.PrivateKey + var ok bool + + // Validate type of key + if rsaKey, ok = key.(*rsa.PrivateKey); !ok { + return "", ErrInvalidKey + } + + // Create the hasher + if !m.Hash.Available() { + return "", ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { + return EncodeSegment(sigBytes), nil + } else { + return "", err + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go b/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go index f9e249d270..10ee9db8a4 100644 --- a/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go @@ -1,126 +1,126 @@ -// +build go1.4 - -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// Implements the RSAPSS family of signing methods signing methods -type SigningMethodRSAPSS struct { - *SigningMethodRSA - Options *rsa.PSSOptions -} - -// Specific instances for RS/PS and company -var ( - SigningMethodPS256 *SigningMethodRSAPSS - SigningMethodPS384 *SigningMethodRSAPSS - SigningMethodPS512 *SigningMethodRSAPSS -) - -func init() { - // PS256 - SigningMethodPS256 = &SigningMethodRSAPSS{ - &SigningMethodRSA{ - Name: "PS256", - Hash: crypto.SHA256, - }, - &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - Hash: crypto.SHA256, - }, - } - RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { - return SigningMethodPS256 - }) - - // PS384 - SigningMethodPS384 = &SigningMethodRSAPSS{ - &SigningMethodRSA{ - Name: "PS384", - Hash: crypto.SHA384, - }, - &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - Hash: crypto.SHA384, - }, - } - RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { - return SigningMethodPS384 - }) - - // PS512 - SigningMethodPS512 = &SigningMethodRSAPSS{ - &SigningMethodRSA{ - Name: "PS512", - Hash: crypto.SHA512, - }, - &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - Hash: crypto.SHA512, - }, - } - RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { - return SigningMethodPS512 - }) -} - -// Implements the Verify method from SigningMethod -// For this verify method, key must be an rsa.PublicKey struct -func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error { - var err error - - // Decode the signature - var sig []byte - if sig, err = DecodeSegment(signature); err != nil { - return err - } - - var rsaKey *rsa.PublicKey - switch k := key.(type) { - case *rsa.PublicKey: - rsaKey = k - default: - return ErrInvalidKey - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, m.Options) -} - -// Implements the Sign method from SigningMethod -// For this signing method, key must be an rsa.PrivateKey struct -func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) { - var rsaKey *rsa.PrivateKey - - switch k := key.(type) { - case *rsa.PrivateKey: - rsaKey = k - default: - return "", ErrInvalidKeyType - } - - // Create the hasher - if !m.Hash.Available() { - return "", ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { - return EncodeSegment(sigBytes), nil - } else { - return "", err - } -} +// +build go1.4 + +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// Implements the RSAPSS family of signing methods signing methods +type SigningMethodRSAPSS struct { + *SigningMethodRSA + Options *rsa.PSSOptions +} + +// Specific instances for RS/PS and company +var ( + SigningMethodPS256 *SigningMethodRSAPSS + SigningMethodPS384 *SigningMethodRSAPSS + SigningMethodPS512 *SigningMethodRSAPSS +) + +func init() { + // PS256 + SigningMethodPS256 = &SigningMethodRSAPSS{ + &SigningMethodRSA{ + Name: "PS256", + Hash: crypto.SHA256, + }, + &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + Hash: crypto.SHA256, + }, + } + RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { + return SigningMethodPS256 + }) + + // PS384 + SigningMethodPS384 = &SigningMethodRSAPSS{ + &SigningMethodRSA{ + Name: "PS384", + Hash: crypto.SHA384, + }, + &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + Hash: crypto.SHA384, + }, + } + RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { + return SigningMethodPS384 + }) + + // PS512 + SigningMethodPS512 = &SigningMethodRSAPSS{ + &SigningMethodRSA{ + Name: "PS512", + Hash: crypto.SHA512, + }, + &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + Hash: crypto.SHA512, + }, + } + RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { + return SigningMethodPS512 + }) +} + +// Implements the Verify method from SigningMethod +// For this verify method, key must be an rsa.PublicKey struct +func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error { + var err error + + // Decode the signature + var sig []byte + if sig, err = DecodeSegment(signature); err != nil { + return err + } + + var rsaKey *rsa.PublicKey + switch k := key.(type) { + case *rsa.PublicKey: + rsaKey = k + default: + return ErrInvalidKey + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, m.Options) +} + +// Implements the Sign method from SigningMethod +// For this signing method, key must be an rsa.PrivateKey struct +func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) { + var rsaKey *rsa.PrivateKey + + switch k := key.(type) { + case *rsa.PrivateKey: + rsaKey = k + default: + return "", ErrInvalidKeyType + } + + // Create the hasher + if !m.Hash.Available() { + return "", ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { + return EncodeSegment(sigBytes), nil + } else { + return "", err + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go b/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go index b114fc3f31..9045aaf349 100644 --- a/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_pss_test.go @@ -1,96 +1,96 @@ -// +build go1.4 - -package jwt_test - -import ( - "crypto/rsa" - "io/ioutil" - "strings" - "testing" - - "github.com/dgrijalva/jwt-go" -) - -var rsaPSSTestData = []struct { - name string - tokenString string - alg string - claims map[string]interface{} - valid bool -}{ - { - "Basic PS256", - "eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.PPG4xyDVY8ffp4CcxofNmsTDXsrVG2npdQuibLhJbv4ClyPTUtR5giNSvuxo03kB6I8VXVr0Y9X7UxhJVEoJOmULAwRWaUsDnIewQa101cVhMa6iR8X37kfFoiZ6NkS-c7henVkkQWu2HtotkEtQvN5hFlk8IevXXPmvZlhQhwzB1sGzGYnoi1zOfuL98d3BIjUjtlwii5w6gYG2AEEzp7HnHCsb3jIwUPdq86Oe6hIFjtBwduIK90ca4UqzARpcfwxHwVLMpatKask00AgGVI0ysdk0BLMjmLutquD03XbThHScC2C2_Pp4cHWgMzvbgLU2RYYZcZRKr46QeNgz9w", - "PS256", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic PS384", - "eyJhbGciOiJQUzM4NCIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.w7-qqgj97gK4fJsq_DCqdYQiylJjzWONvD0qWWWhqEOFk2P1eDULPnqHRnjgTXoO4HAw4YIWCsZPet7nR3Xxq4ZhMqvKW8b7KlfRTb9cH8zqFvzMmybQ4jv2hKc3bXYqVow3AoR7hN_CWXI3Dv6Kd2X5xhtxRHI6IL39oTVDUQ74LACe-9t4c3QRPuj6Pq1H4FAT2E2kW_0KOc6EQhCLWEhm2Z2__OZskDC8AiPpP8Kv4k2vB7l0IKQu8Pr4RcNBlqJdq8dA5D3hk5TLxP8V5nG1Ib80MOMMqoS3FQvSLyolFX-R_jZ3-zfq6Ebsqr0yEb0AH2CfsECF7935Pa0FKQ", - "PS384", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic PS512", - "eyJhbGciOiJQUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.GX1HWGzFaJevuSLavqqFYaW8_TpvcjQ8KfC5fXiSDzSiT9UD9nB_ikSmDNyDILNdtjZLSvVKfXxZJqCfefxAtiozEDDdJthZ-F0uO4SPFHlGiXszvKeodh7BuTWRI2wL9-ZO4mFa8nq3GMeQAfo9cx11i7nfN8n2YNQ9SHGovG7_T_AvaMZB_jT6jkDHpwGR9mz7x1sycckEo6teLdHRnH_ZdlHlxqknmyTu8Odr5Xh0sJFOL8BepWbbvIIn-P161rRHHiDWFv6nhlHwZnVzjx7HQrWSGb6-s2cdLie9QL_8XaMcUpjLkfOMKkDOfHo6AvpL7Jbwi83Z2ZTHjJWB-A", - "PS512", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "basic PS256 invalid: foo => bar", - "eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.PPG4xyDVY8ffp4CcxofNmsTDXsrVG2npdQuibLhJbv4ClyPTUtR5giNSvuxo03kB6I8VXVr0Y9X7UxhJVEoJOmULAwRWaUsDnIewQa101cVhMa6iR8X37kfFoiZ6NkS-c7henVkkQWu2HtotkEtQvN5hFlk8IevXXPmvZlhQhwzB1sGzGYnoi1zOfuL98d3BIjUjtlwii5w6gYG2AEEzp7HnHCsb3jIwUPdq86Oe6hIFjtBwduIK90ca4UqzARpcfwxHwVLMpatKask00AgGVI0ysdk0BLMjmLutquD03XbThHScC2C2_Pp4cHWgMzvbgLU2RYYZcZRKr46QeNgz9W", - "PS256", - map[string]interface{}{"foo": "bar"}, - false, - }, -} - -func TestRSAPSSVerify(t *testing.T) { - var err error - - key, _ := ioutil.ReadFile("test/sample_key.pub") - var rsaPSSKey *rsa.PublicKey - if rsaPSSKey, err = jwt.ParseRSAPublicKeyFromPEM(key); err != nil { - t.Errorf("Unable to parse RSA public key: %v", err) - } - - for _, data := range rsaPSSTestData { - parts := strings.Split(data.tokenString, ".") - - method := jwt.GetSigningMethod(data.alg) - err := method.Verify(strings.Join(parts[0:2], "."), parts[2], rsaPSSKey) - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying key: %v", data.name, err) - } - if !data.valid && err == nil { - t.Errorf("[%v] Invalid key passed validation", data.name) - } - } -} - -func TestRSAPSSSign(t *testing.T) { - var err error - - key, _ := ioutil.ReadFile("test/sample_key") - var rsaPSSKey *rsa.PrivateKey - if rsaPSSKey, err = jwt.ParseRSAPrivateKeyFromPEM(key); err != nil { - t.Errorf("Unable to parse RSA private key: %v", err) - } - - for _, data := range rsaPSSTestData { - if data.valid { - parts := strings.Split(data.tokenString, ".") - method := jwt.GetSigningMethod(data.alg) - sig, err := method.Sign(strings.Join(parts[0:2], "."), rsaPSSKey) - if err != nil { - t.Errorf("[%v] Error signing token: %v", data.name, err) - } - if sig == parts[2] { - t.Errorf("[%v] Signatures shouldn't match\nnew:\n%v\noriginal:\n%v", data.name, sig, parts[2]) - } - } - } -} +// +build go1.4 + +package jwt_test + +import ( + "crypto/rsa" + "io/ioutil" + "strings" + "testing" + + "github.com/dgrijalva/jwt-go" +) + +var rsaPSSTestData = []struct { + name string + tokenString string + alg string + claims map[string]interface{} + valid bool +}{ + { + "Basic PS256", + "eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.PPG4xyDVY8ffp4CcxofNmsTDXsrVG2npdQuibLhJbv4ClyPTUtR5giNSvuxo03kB6I8VXVr0Y9X7UxhJVEoJOmULAwRWaUsDnIewQa101cVhMa6iR8X37kfFoiZ6NkS-c7henVkkQWu2HtotkEtQvN5hFlk8IevXXPmvZlhQhwzB1sGzGYnoi1zOfuL98d3BIjUjtlwii5w6gYG2AEEzp7HnHCsb3jIwUPdq86Oe6hIFjtBwduIK90ca4UqzARpcfwxHwVLMpatKask00AgGVI0ysdk0BLMjmLutquD03XbThHScC2C2_Pp4cHWgMzvbgLU2RYYZcZRKr46QeNgz9w", + "PS256", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic PS384", + "eyJhbGciOiJQUzM4NCIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.w7-qqgj97gK4fJsq_DCqdYQiylJjzWONvD0qWWWhqEOFk2P1eDULPnqHRnjgTXoO4HAw4YIWCsZPet7nR3Xxq4ZhMqvKW8b7KlfRTb9cH8zqFvzMmybQ4jv2hKc3bXYqVow3AoR7hN_CWXI3Dv6Kd2X5xhtxRHI6IL39oTVDUQ74LACe-9t4c3QRPuj6Pq1H4FAT2E2kW_0KOc6EQhCLWEhm2Z2__OZskDC8AiPpP8Kv4k2vB7l0IKQu8Pr4RcNBlqJdq8dA5D3hk5TLxP8V5nG1Ib80MOMMqoS3FQvSLyolFX-R_jZ3-zfq6Ebsqr0yEb0AH2CfsECF7935Pa0FKQ", + "PS384", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic PS512", + "eyJhbGciOiJQUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.GX1HWGzFaJevuSLavqqFYaW8_TpvcjQ8KfC5fXiSDzSiT9UD9nB_ikSmDNyDILNdtjZLSvVKfXxZJqCfefxAtiozEDDdJthZ-F0uO4SPFHlGiXszvKeodh7BuTWRI2wL9-ZO4mFa8nq3GMeQAfo9cx11i7nfN8n2YNQ9SHGovG7_T_AvaMZB_jT6jkDHpwGR9mz7x1sycckEo6teLdHRnH_ZdlHlxqknmyTu8Odr5Xh0sJFOL8BepWbbvIIn-P161rRHHiDWFv6nhlHwZnVzjx7HQrWSGb6-s2cdLie9QL_8XaMcUpjLkfOMKkDOfHo6AvpL7Jbwi83Z2ZTHjJWB-A", + "PS512", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "basic PS256 invalid: foo => bar", + "eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.PPG4xyDVY8ffp4CcxofNmsTDXsrVG2npdQuibLhJbv4ClyPTUtR5giNSvuxo03kB6I8VXVr0Y9X7UxhJVEoJOmULAwRWaUsDnIewQa101cVhMa6iR8X37kfFoiZ6NkS-c7henVkkQWu2HtotkEtQvN5hFlk8IevXXPmvZlhQhwzB1sGzGYnoi1zOfuL98d3BIjUjtlwii5w6gYG2AEEzp7HnHCsb3jIwUPdq86Oe6hIFjtBwduIK90ca4UqzARpcfwxHwVLMpatKask00AgGVI0ysdk0BLMjmLutquD03XbThHScC2C2_Pp4cHWgMzvbgLU2RYYZcZRKr46QeNgz9W", + "PS256", + map[string]interface{}{"foo": "bar"}, + false, + }, +} + +func TestRSAPSSVerify(t *testing.T) { + var err error + + key, _ := ioutil.ReadFile("test/sample_key.pub") + var rsaPSSKey *rsa.PublicKey + if rsaPSSKey, err = jwt.ParseRSAPublicKeyFromPEM(key); err != nil { + t.Errorf("Unable to parse RSA public key: %v", err) + } + + for _, data := range rsaPSSTestData { + parts := strings.Split(data.tokenString, ".") + + method := jwt.GetSigningMethod(data.alg) + err := method.Verify(strings.Join(parts[0:2], "."), parts[2], rsaPSSKey) + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying key: %v", data.name, err) + } + if !data.valid && err == nil { + t.Errorf("[%v] Invalid key passed validation", data.name) + } + } +} + +func TestRSAPSSSign(t *testing.T) { + var err error + + key, _ := ioutil.ReadFile("test/sample_key") + var rsaPSSKey *rsa.PrivateKey + if rsaPSSKey, err = jwt.ParseRSAPrivateKeyFromPEM(key); err != nil { + t.Errorf("Unable to parse RSA private key: %v", err) + } + + for _, data := range rsaPSSTestData { + if data.valid { + parts := strings.Split(data.tokenString, ".") + method := jwt.GetSigningMethod(data.alg) + sig, err := method.Sign(strings.Join(parts[0:2], "."), rsaPSSKey) + if err != nil { + t.Errorf("[%v] Error signing token: %v", data.name, err) + } + if sig == parts[2] { + t.Errorf("[%v] Signatures shouldn't match\nnew:\n%v\noriginal:\n%v", data.name, sig, parts[2]) + } + } + } +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_test.go b/vendor/github.com/dgrijalva/jwt-go/rsa_test.go index 3b409b3086..2e0f785361 100644 --- a/vendor/github.com/dgrijalva/jwt-go/rsa_test.go +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_test.go @@ -1,176 +1,176 @@ -package jwt_test - -import ( - "github.com/dgrijalva/jwt-go" - "io/ioutil" - "strings" - "testing" -) - -var rsaTestData = []struct { - name string - tokenString string - alg string - claims map[string]interface{} - valid bool -}{ - { - "Basic RS256", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - "RS256", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic RS384", - "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.W-jEzRfBigtCWsinvVVuldiuilzVdU5ty0MvpLaSaqK9PlAWWlDQ1VIQ_qSKzwL5IXaZkvZFJXT3yL3n7OUVu7zCNJzdwznbC8Z-b0z2lYvcklJYi2VOFRcGbJtXUqgjk2oGsiqUMUMOLP70TTefkpsgqDxbRh9CDUfpOJgW-dU7cmgaoswe3wjUAUi6B6G2YEaiuXC0XScQYSYVKIzgKXJV8Zw-7AN_DBUI4GkTpsvQ9fVVjZM9csQiEXhYekyrKu1nu_POpQonGd8yqkIyXPECNmmqH5jH4sFiF67XhD7_JpkvLziBpI-uh86evBUadmHhb9Otqw3uV3NTaXLzJw", - "RS384", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "Basic RS512", - "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.zBlLlmRrUxx4SJPUbV37Q1joRcI9EW13grnKduK3wtYKmDXbgDpF1cZ6B-2Jsm5RB8REmMiLpGms-EjXhgnyh2TSHE-9W2gA_jvshegLWtwRVDX40ODSkTb7OVuaWgiy9y7llvcknFBTIg-FnVPVpXMmeV_pvwQyhaz1SSwSPrDyxEmksz1hq7YONXhXPpGaNbMMeDTNP_1oj8DZaqTIL9TwV8_1wb2Odt_Fy58Ke2RVFijsOLdnyEAjt2n9Mxihu9i3PhNBkkxa2GbnXBfq3kzvZ_xxGGopLdHhJjcGWXO-NiwI9_tiu14NRv4L2xC0ItD9Yz68v2ZIZEp_DuzwRQ", - "RS512", - map[string]interface{}{"foo": "bar"}, - true, - }, - { - "basic invalid: foo => bar", - "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.EhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", - "RS256", - map[string]interface{}{"foo": "bar"}, - false, - }, -} - -func TestRSAVerify(t *testing.T) { - keyData, _ := ioutil.ReadFile("test/sample_key.pub") - key, _ := jwt.ParseRSAPublicKeyFromPEM(keyData) - - for _, data := range rsaTestData { - parts := strings.Split(data.tokenString, ".") - - method := jwt.GetSigningMethod(data.alg) - err := method.Verify(strings.Join(parts[0:2], "."), parts[2], key) - if data.valid && err != nil { - t.Errorf("[%v] Error while verifying key: %v", data.name, err) - } - if !data.valid && err == nil { - t.Errorf("[%v] Invalid key passed validation", data.name) - } - } -} - -func TestRSASign(t *testing.T) { - keyData, _ := ioutil.ReadFile("test/sample_key") - key, _ := jwt.ParseRSAPrivateKeyFromPEM(keyData) - - for _, data := range rsaTestData { - if data.valid { - parts := strings.Split(data.tokenString, ".") - method := jwt.GetSigningMethod(data.alg) - sig, err := method.Sign(strings.Join(parts[0:2], "."), key) - if err != nil { - t.Errorf("[%v] Error signing token: %v", data.name, err) - } - if sig != parts[2] { - t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", data.name, sig, parts[2]) - } - } - } -} - -func TestRSAVerifyWithPreParsedPrivateKey(t *testing.T) { - key, _ := ioutil.ReadFile("test/sample_key.pub") - parsedKey, err := jwt.ParseRSAPublicKeyFromPEM(key) - if err != nil { - t.Fatal(err) - } - testData := rsaTestData[0] - parts := strings.Split(testData.tokenString, ".") - err = jwt.SigningMethodRS256.Verify(strings.Join(parts[0:2], "."), parts[2], parsedKey) - if err != nil { - t.Errorf("[%v] Error while verifying key: %v", testData.name, err) - } -} - -func TestRSAWithPreParsedPrivateKey(t *testing.T) { - key, _ := ioutil.ReadFile("test/sample_key") - parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) - if err != nil { - t.Fatal(err) - } - testData := rsaTestData[0] - parts := strings.Split(testData.tokenString, ".") - sig, err := jwt.SigningMethodRS256.Sign(strings.Join(parts[0:2], "."), parsedKey) - if err != nil { - t.Errorf("[%v] Error signing token: %v", testData.name, err) - } - if sig != parts[2] { - t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", testData.name, sig, parts[2]) - } -} - -func TestRSAKeyParsing(t *testing.T) { - key, _ := ioutil.ReadFile("test/sample_key") - pubKey, _ := ioutil.ReadFile("test/sample_key.pub") - badKey := []byte("All your base are belong to key") - - // Test parsePrivateKey - if _, e := jwt.ParseRSAPrivateKeyFromPEM(key); e != nil { - t.Errorf("Failed to parse valid private key: %v", e) - } - - if k, e := jwt.ParseRSAPrivateKeyFromPEM(pubKey); e == nil { - t.Errorf("Parsed public key as valid private key: %v", k) - } - - if k, e := jwt.ParseRSAPrivateKeyFromPEM(badKey); e == nil { - t.Errorf("Parsed invalid key as valid private key: %v", k) - } - - // Test parsePublicKey - if _, e := jwt.ParseRSAPublicKeyFromPEM(pubKey); e != nil { - t.Errorf("Failed to parse valid public key: %v", e) - } - - if k, e := jwt.ParseRSAPublicKeyFromPEM(key); e == nil { - t.Errorf("Parsed private key as valid public key: %v", k) - } - - if k, e := jwt.ParseRSAPublicKeyFromPEM(badKey); e == nil { - t.Errorf("Parsed invalid key as valid private key: %v", k) - } - -} - -func BenchmarkRS256Signing(b *testing.B) { - key, _ := ioutil.ReadFile("test/sample_key") - parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) - if err != nil { - b.Fatal(err) - } - - benchmarkSigning(b, jwt.SigningMethodRS256, parsedKey) -} - -func BenchmarkRS384Signing(b *testing.B) { - key, _ := ioutil.ReadFile("test/sample_key") - parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) - if err != nil { - b.Fatal(err) - } - - benchmarkSigning(b, jwt.SigningMethodRS384, parsedKey) -} - -func BenchmarkRS512Signing(b *testing.B) { - key, _ := ioutil.ReadFile("test/sample_key") - parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) - if err != nil { - b.Fatal(err) - } - - benchmarkSigning(b, jwt.SigningMethodRS512, parsedKey) -} +package jwt_test + +import ( + "github.com/dgrijalva/jwt-go" + "io/ioutil" + "strings" + "testing" +) + +var rsaTestData = []struct { + name string + tokenString string + alg string + claims map[string]interface{} + valid bool +}{ + { + "Basic RS256", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.FhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + "RS256", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic RS384", + "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.W-jEzRfBigtCWsinvVVuldiuilzVdU5ty0MvpLaSaqK9PlAWWlDQ1VIQ_qSKzwL5IXaZkvZFJXT3yL3n7OUVu7zCNJzdwznbC8Z-b0z2lYvcklJYi2VOFRcGbJtXUqgjk2oGsiqUMUMOLP70TTefkpsgqDxbRh9CDUfpOJgW-dU7cmgaoswe3wjUAUi6B6G2YEaiuXC0XScQYSYVKIzgKXJV8Zw-7AN_DBUI4GkTpsvQ9fVVjZM9csQiEXhYekyrKu1nu_POpQonGd8yqkIyXPECNmmqH5jH4sFiF67XhD7_JpkvLziBpI-uh86evBUadmHhb9Otqw3uV3NTaXLzJw", + "RS384", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "Basic RS512", + "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.zBlLlmRrUxx4SJPUbV37Q1joRcI9EW13grnKduK3wtYKmDXbgDpF1cZ6B-2Jsm5RB8REmMiLpGms-EjXhgnyh2TSHE-9W2gA_jvshegLWtwRVDX40ODSkTb7OVuaWgiy9y7llvcknFBTIg-FnVPVpXMmeV_pvwQyhaz1SSwSPrDyxEmksz1hq7YONXhXPpGaNbMMeDTNP_1oj8DZaqTIL9TwV8_1wb2Odt_Fy58Ke2RVFijsOLdnyEAjt2n9Mxihu9i3PhNBkkxa2GbnXBfq3kzvZ_xxGGopLdHhJjcGWXO-NiwI9_tiu14NRv4L2xC0ItD9Yz68v2ZIZEp_DuzwRQ", + "RS512", + map[string]interface{}{"foo": "bar"}, + true, + }, + { + "basic invalid: foo => bar", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmb28iOiJiYXIifQ.EhkiHkoESI_cG3NPigFrxEk9Z60_oXrOT2vGm9Pn6RDgYNovYORQmmA0zs1AoAOf09ly2Nx2YAg6ABqAYga1AcMFkJljwxTT5fYphTuqpWdy4BELeSYJx5Ty2gmr8e7RonuUztrdD5WfPqLKMm1Ozp_T6zALpRmwTIW0QPnaBXaQD90FplAg46Iy1UlDKr-Eupy0i5SLch5Q-p2ZpaL_5fnTIUDlxC3pWhJTyx_71qDI-mAA_5lE_VdroOeflG56sSmDxopPEG3bFlSu1eowyBfxtu0_CuVd-M42RU75Zc4Gsj6uV77MBtbMrf4_7M_NUTSgoIF3fRqxrj0NzihIBg", + "RS256", + map[string]interface{}{"foo": "bar"}, + false, + }, +} + +func TestRSAVerify(t *testing.T) { + keyData, _ := ioutil.ReadFile("test/sample_key.pub") + key, _ := jwt.ParseRSAPublicKeyFromPEM(keyData) + + for _, data := range rsaTestData { + parts := strings.Split(data.tokenString, ".") + + method := jwt.GetSigningMethod(data.alg) + err := method.Verify(strings.Join(parts[0:2], "."), parts[2], key) + if data.valid && err != nil { + t.Errorf("[%v] Error while verifying key: %v", data.name, err) + } + if !data.valid && err == nil { + t.Errorf("[%v] Invalid key passed validation", data.name) + } + } +} + +func TestRSASign(t *testing.T) { + keyData, _ := ioutil.ReadFile("test/sample_key") + key, _ := jwt.ParseRSAPrivateKeyFromPEM(keyData) + + for _, data := range rsaTestData { + if data.valid { + parts := strings.Split(data.tokenString, ".") + method := jwt.GetSigningMethod(data.alg) + sig, err := method.Sign(strings.Join(parts[0:2], "."), key) + if err != nil { + t.Errorf("[%v] Error signing token: %v", data.name, err) + } + if sig != parts[2] { + t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", data.name, sig, parts[2]) + } + } + } +} + +func TestRSAVerifyWithPreParsedPrivateKey(t *testing.T) { + key, _ := ioutil.ReadFile("test/sample_key.pub") + parsedKey, err := jwt.ParseRSAPublicKeyFromPEM(key) + if err != nil { + t.Fatal(err) + } + testData := rsaTestData[0] + parts := strings.Split(testData.tokenString, ".") + err = jwt.SigningMethodRS256.Verify(strings.Join(parts[0:2], "."), parts[2], parsedKey) + if err != nil { + t.Errorf("[%v] Error while verifying key: %v", testData.name, err) + } +} + +func TestRSAWithPreParsedPrivateKey(t *testing.T) { + key, _ := ioutil.ReadFile("test/sample_key") + parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) + if err != nil { + t.Fatal(err) + } + testData := rsaTestData[0] + parts := strings.Split(testData.tokenString, ".") + sig, err := jwt.SigningMethodRS256.Sign(strings.Join(parts[0:2], "."), parsedKey) + if err != nil { + t.Errorf("[%v] Error signing token: %v", testData.name, err) + } + if sig != parts[2] { + t.Errorf("[%v] Incorrect signature.\nwas:\n%v\nexpecting:\n%v", testData.name, sig, parts[2]) + } +} + +func TestRSAKeyParsing(t *testing.T) { + key, _ := ioutil.ReadFile("test/sample_key") + pubKey, _ := ioutil.ReadFile("test/sample_key.pub") + badKey := []byte("All your base are belong to key") + + // Test parsePrivateKey + if _, e := jwt.ParseRSAPrivateKeyFromPEM(key); e != nil { + t.Errorf("Failed to parse valid private key: %v", e) + } + + if k, e := jwt.ParseRSAPrivateKeyFromPEM(pubKey); e == nil { + t.Errorf("Parsed public key as valid private key: %v", k) + } + + if k, e := jwt.ParseRSAPrivateKeyFromPEM(badKey); e == nil { + t.Errorf("Parsed invalid key as valid private key: %v", k) + } + + // Test parsePublicKey + if _, e := jwt.ParseRSAPublicKeyFromPEM(pubKey); e != nil { + t.Errorf("Failed to parse valid public key: %v", e) + } + + if k, e := jwt.ParseRSAPublicKeyFromPEM(key); e == nil { + t.Errorf("Parsed private key as valid public key: %v", k) + } + + if k, e := jwt.ParseRSAPublicKeyFromPEM(badKey); e == nil { + t.Errorf("Parsed invalid key as valid private key: %v", k) + } + +} + +func BenchmarkRS256Signing(b *testing.B) { + key, _ := ioutil.ReadFile("test/sample_key") + parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) + if err != nil { + b.Fatal(err) + } + + benchmarkSigning(b, jwt.SigningMethodRS256, parsedKey) +} + +func BenchmarkRS384Signing(b *testing.B) { + key, _ := ioutil.ReadFile("test/sample_key") + parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) + if err != nil { + b.Fatal(err) + } + + benchmarkSigning(b, jwt.SigningMethodRS384, parsedKey) +} + +func BenchmarkRS512Signing(b *testing.B) { + key, _ := ioutil.ReadFile("test/sample_key") + parsedKey, err := jwt.ParseRSAPrivateKeyFromPEM(key) + if err != nil { + b.Fatal(err) + } + + benchmarkSigning(b, jwt.SigningMethodRS512, parsedKey) +} diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go index 7bcd037035..213a90dbbf 100644 --- a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go @@ -1,69 +1,69 @@ -package jwt - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") - ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") - ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key") -) - -// Parse PEM encoded PKCS1 or PKCS8 private key -func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - var parsedKey interface{} - if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - } - - var pkey *rsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { - return nil, ErrNotRSAPrivateKey - } - - return pkey, nil -} - -// Parse PEM encoded PKCS1 or PKCS8 public key -func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey interface{} - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *rsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { - return nil, ErrNotRSAPublicKey - } - - return pkey, nil -} +package jwt + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") + ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") + ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key") +) + +// Parse PEM encoded PKCS1 or PKCS8 private key +func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey interface{} + if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// Parse PEM encoded PKCS1 or PKCS8 public key +func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + return nil, err + } + } + + var pkey *rsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { + return nil, ErrNotRSAPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/dgrijalva/jwt-go/signing_method.go b/vendor/github.com/dgrijalva/jwt-go/signing_method.go index 9f79d7346a..ed1f212b21 100644 --- a/vendor/github.com/dgrijalva/jwt-go/signing_method.go +++ b/vendor/github.com/dgrijalva/jwt-go/signing_method.go @@ -1,35 +1,35 @@ -package jwt - -import ( - "sync" -) - -var signingMethods = map[string]func() SigningMethod{} -var signingMethodLock = new(sync.RWMutex) - -// Implement SigningMethod to add new methods for signing or verifying tokens. -type SigningMethod interface { - Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid - Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error - Alg() string // returns the alg identifier for this method (example: 'HS256') -} - -// Register the "alg" name and a factory function for signing method. -// This is typically done during init() in the method's implementation -func RegisterSigningMethod(alg string, f func() SigningMethod) { - signingMethodLock.Lock() - defer signingMethodLock.Unlock() - - signingMethods[alg] = f -} - -// Get a signing method from an "alg" string -func GetSigningMethod(alg string) (method SigningMethod) { - signingMethodLock.RLock() - defer signingMethodLock.RUnlock() - - if methodF, ok := signingMethods[alg]; ok { - method = methodF() - } - return -} +package jwt + +import ( + "sync" +) + +var signingMethods = map[string]func() SigningMethod{} +var signingMethodLock = new(sync.RWMutex) + +// Implement SigningMethod to add new methods for signing or verifying tokens. +type SigningMethod interface { + Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid + Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error + Alg() string // returns the alg identifier for this method (example: 'HS256') +} + +// Register the "alg" name and a factory function for signing method. +// This is typically done during init() in the method's implementation +func RegisterSigningMethod(alg string, f func() SigningMethod) { + signingMethodLock.Lock() + defer signingMethodLock.Unlock() + + signingMethods[alg] = f +} + +// Get a signing method from an "alg" string +func GetSigningMethod(alg string) (method SigningMethod) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + if methodF, ok := signingMethods[alg]; ok { + method = methodF() + } + return +} diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem index 18a726948f..a6882b3e53 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec256-private.pem @@ -1,5 +1,5 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIAh5qA3rmqQQuu0vbKV/+zouz/y/Iy2pLpIcWUSyImSwoAoGCCqGSM49 -AwEHoUQDQgAEYD54V/vp+54P9DXarYqx4MPcm+HKRIQzNasYSoRQHQ/6S6Ps8tpM -cT+KvIIC8W/e9k0W7Cm72M1P9jU7SLf/vg== ------END EC PRIVATE KEY----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIAh5qA3rmqQQuu0vbKV/+zouz/y/Iy2pLpIcWUSyImSwoAoGCCqGSM49 +AwEHoUQDQgAEYD54V/vp+54P9DXarYqx4MPcm+HKRIQzNasYSoRQHQ/6S6Ps8tpM +cT+KvIIC8W/e9k0W7Cm72M1P9jU7SLf/vg== +-----END EC PRIVATE KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec256-public.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec256-public.pem index efad19fc28..7191361e72 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/ec256-public.pem +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec256-public.pem @@ -1,4 +1,4 @@ ------BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYD54V/vp+54P9DXarYqx4MPcm+HK -RIQzNasYSoRQHQ/6S6Ps8tpMcT+KvIIC8W/e9k0W7Cm72M1P9jU7SLf/vg== ------END PUBLIC KEY----- +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYD54V/vp+54P9DXarYqx4MPcm+HK +RIQzNasYSoRQHQ/6S6Ps8tpMcT+KvIIC8W/e9k0W7Cm72M1P9jU7SLf/vg== +-----END PUBLIC KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec384-private.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec384-private.pem index 5f8f90b02f..a86c823e56 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/ec384-private.pem +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec384-private.pem @@ -1,6 +1,6 @@ ------BEGIN EC PRIVATE KEY----- -MIGkAgEBBDCaCvMHKhcG/qT7xsNLYnDT7sE/D+TtWIol1ROdaK1a564vx5pHbsRy -SEKcIxISi1igBwYFK4EEACKhZANiAATYa7rJaU7feLMqrAx6adZFNQOpaUH/Uylb -ZLriOLON5YFVwtVUpO1FfEXZUIQpptRPtc5ixIPY658yhBSb6irfIJUSP9aYTflJ -GKk/mDkK4t8mWBzhiD5B6jg9cEGhGgA= ------END EC PRIVATE KEY----- +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDCaCvMHKhcG/qT7xsNLYnDT7sE/D+TtWIol1ROdaK1a564vx5pHbsRy +SEKcIxISi1igBwYFK4EEACKhZANiAATYa7rJaU7feLMqrAx6adZFNQOpaUH/Uylb +ZLriOLON5YFVwtVUpO1FfEXZUIQpptRPtc5ixIPY658yhBSb6irfIJUSP9aYTflJ +GKk/mDkK4t8mWBzhiD5B6jg9cEGhGgA= +-----END EC PRIVATE KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec384-public.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec384-public.pem index 47c21e3805..e80d005644 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/ec384-public.pem +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec384-public.pem @@ -1,5 +1,5 @@ ------BEGIN PUBLIC KEY----- -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE2Gu6yWlO33izKqwMemnWRTUDqWlB/1Mp -W2S64jizjeWBVcLVVKTtRXxF2VCEKabUT7XOYsSD2OufMoQUm+oq3yCVEj/WmE35 -SRipP5g5CuLfJlgc4Yg+Qeo4PXBBoRoA ------END PUBLIC KEY----- +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE2Gu6yWlO33izKqwMemnWRTUDqWlB/1Mp +W2S64jizjeWBVcLVVKTtRXxF2VCEKabUT7XOYsSD2OufMoQUm+oq3yCVEj/WmE35 +SRipP5g5CuLfJlgc4Yg+Qeo4PXBBoRoA +-----END PUBLIC KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec512-private.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec512-private.pem index 28e7ea8458..213afaf13c 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/ec512-private.pem +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec512-private.pem @@ -1,7 +1,7 @@ ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIB0pE4uFaWRx7t03BsYlYvF1YvKaBGyvoakxnodm9ou0R9wC+sJAjH -QZZJikOg4SwNqgQ/hyrOuDK2oAVHhgVGcYmgBwYFK4EEACOhgYkDgYYABAAJXIuw -12MUzpHggia9POBFYXSxaOGKGbMjIyDI+6q7wi7LMw3HgbaOmgIqFG72o8JBQwYN -4IbXHf+f86CRY1AA2wHzbHvt6IhkCXTNxBEffa1yMUgu8n9cKKF2iLgyQKcKqW33 -8fGOw/n3Rm2Yd/EB56u2rnD29qS+nOM9eGS+gy39OQ== ------END EC PRIVATE KEY----- +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIB0pE4uFaWRx7t03BsYlYvF1YvKaBGyvoakxnodm9ou0R9wC+sJAjH +QZZJikOg4SwNqgQ/hyrOuDK2oAVHhgVGcYmgBwYFK4EEACOhgYkDgYYABAAJXIuw +12MUzpHggia9POBFYXSxaOGKGbMjIyDI+6q7wi7LMw3HgbaOmgIqFG72o8JBQwYN +4IbXHf+f86CRY1AA2wHzbHvt6IhkCXTNxBEffa1yMUgu8n9cKKF2iLgyQKcKqW33 +8fGOw/n3Rm2Yd/EB56u2rnD29qS+nOM9eGS+gy39OQ== +-----END EC PRIVATE KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/ec512-public.pem b/vendor/github.com/dgrijalva/jwt-go/test/ec512-public.pem index 702fca5ccd..02ea022031 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/ec512-public.pem +++ b/vendor/github.com/dgrijalva/jwt-go/test/ec512-public.pem @@ -1,6 +1,6 @@ ------BEGIN PUBLIC KEY----- -MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQACVyLsNdjFM6R4IImvTzgRWF0sWjh -ihmzIyMgyPuqu8IuyzMNx4G2jpoCKhRu9qPCQUMGDeCG1x3/n/OgkWNQANsB82x7 -7eiIZAl0zcQRH32tcjFILvJ/XCihdoi4MkCnCqlt9/HxjsP590ZtmHfxAeertq5w -9vakvpzjPXhkvoMt/Tk= ------END PUBLIC KEY----- +-----BEGIN PUBLIC KEY----- +MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQACVyLsNdjFM6R4IImvTzgRWF0sWjh +ihmzIyMgyPuqu8IuyzMNx4G2jpoCKhRu9qPCQUMGDeCG1x3/n/OgkWNQANsB82x7 +7eiIZAl0zcQRH32tcjFILvJ/XCihdoi4MkCnCqlt9/HxjsP590ZtmHfxAeertq5w +9vakvpzjPXhkvoMt/Tk= +-----END PUBLIC KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/helpers.go b/vendor/github.com/dgrijalva/jwt-go/test/helpers.go index ab7bf51fb0..f84c3ef63e 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/helpers.go +++ b/vendor/github.com/dgrijalva/jwt-go/test/helpers.go @@ -1,42 +1,42 @@ -package test - -import ( - "crypto/rsa" - "github.com/dgrijalva/jwt-go" - "io/ioutil" -) - -func LoadRSAPrivateKeyFromDisk(location string) *rsa.PrivateKey { - keyData, e := ioutil.ReadFile(location) - if e != nil { - panic(e.Error()) - } - key, e := jwt.ParseRSAPrivateKeyFromPEM(keyData) - if e != nil { - panic(e.Error()) - } - return key -} - -func LoadRSAPublicKeyFromDisk(location string) *rsa.PublicKey { - keyData, e := ioutil.ReadFile(location) - if e != nil { - panic(e.Error()) - } - key, e := jwt.ParseRSAPublicKeyFromPEM(keyData) - if e != nil { - panic(e.Error()) - } - return key -} - -func MakeSampleToken(c jwt.Claims, key interface{}) string { - token := jwt.NewWithClaims(jwt.SigningMethodRS256, c) - s, e := token.SignedString(key) - - if e != nil { - panic(e.Error()) - } - - return s -} +package test + +import ( + "crypto/rsa" + "github.com/dgrijalva/jwt-go" + "io/ioutil" +) + +func LoadRSAPrivateKeyFromDisk(location string) *rsa.PrivateKey { + keyData, e := ioutil.ReadFile(location) + if e != nil { + panic(e.Error()) + } + key, e := jwt.ParseRSAPrivateKeyFromPEM(keyData) + if e != nil { + panic(e.Error()) + } + return key +} + +func LoadRSAPublicKeyFromDisk(location string) *rsa.PublicKey { + keyData, e := ioutil.ReadFile(location) + if e != nil { + panic(e.Error()) + } + key, e := jwt.ParseRSAPublicKeyFromPEM(keyData) + if e != nil { + panic(e.Error()) + } + return key +} + +func MakeSampleToken(c jwt.Claims, key interface{}) string { + token := jwt.NewWithClaims(jwt.SigningMethodRS256, c) + s, e := token.SignedString(key) + + if e != nil { + panic(e.Error()) + } + + return s +} diff --git a/vendor/github.com/dgrijalva/jwt-go/test/sample_key b/vendor/github.com/dgrijalva/jwt-go/test/sample_key index 8946e467ac..abdbade312 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/sample_key +++ b/vendor/github.com/dgrijalva/jwt-go/test/sample_key @@ -1,27 +1,27 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA4f5wg5l2hKsTeNem/V41fGnJm6gOdrj8ym3rFkEU/wT8RDtn -SgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7mCpz9Er5qLaMXJwZxzHzAahlfA0i -cqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBpHssPnpYGIn20ZZuNlX2BrClciHhC -PUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2XrHhR+1DcKJzQBSTAGnpYVaqpsAR -ap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3bODIRe1AuTyHceAbewn8b462yEWKA -Rdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy7wIDAQABAoIBAQCwia1k7+2oZ2d3 -n6agCAbqIE1QXfCmh41ZqJHbOY3oRQG3X1wpcGH4Gk+O+zDVTV2JszdcOt7E5dAy -MaomETAhRxB7hlIOnEN7WKm+dGNrKRvV0wDU5ReFMRHg31/Lnu8c+5BvGjZX+ky9 -POIhFFYJqwCRlopGSUIxmVj5rSgtzk3iWOQXr+ah1bjEXvlxDOWkHN6YfpV5ThdE -KdBIPGEVqa63r9n2h+qazKrtiRqJqGnOrHzOECYbRFYhexsNFz7YT02xdfSHn7gM -IvabDDP/Qp0PjE1jdouiMaFHYnLBbgvlnZW9yuVf/rpXTUq/njxIXMmvmEyyvSDn -FcFikB8pAoGBAPF77hK4m3/rdGT7X8a/gwvZ2R121aBcdPwEaUhvj/36dx596zvY -mEOjrWfZhF083/nYWE2kVquj2wjs+otCLfifEEgXcVPTnEOPO9Zg3uNSL0nNQghj -FuD3iGLTUBCtM66oTe0jLSslHe8gLGEQqyMzHOzYxNqibxcOZIe8Qt0NAoGBAO+U -I5+XWjWEgDmvyC3TrOSf/KCGjtu0TSv30ipv27bDLMrpvPmD/5lpptTFwcxvVhCs -2b+chCjlghFSWFbBULBrfci2FtliClOVMYrlNBdUSJhf3aYSG2Doe6Bgt1n2CpNn -/iu37Y3NfemZBJA7hNl4dYe+f+uzM87cdQ214+jrAoGAXA0XxX8ll2+ToOLJsaNT -OvNB9h9Uc5qK5X5w+7G7O998BN2PC/MWp8H+2fVqpXgNENpNXttkRm1hk1dych86 -EunfdPuqsX+as44oCyJGFHVBnWpm33eWQw9YqANRI+pCJzP08I5WK3osnPiwshd+ -hR54yjgfYhBFNI7B95PmEQkCgYBzFSz7h1+s34Ycr8SvxsOBWxymG5zaCsUbPsL0 -4aCgLScCHb9J+E86aVbbVFdglYa5Id7DPTL61ixhl7WZjujspeXZGSbmq0Kcnckb -mDgqkLECiOJW2NHP/j0McAkDLL4tysF8TLDO8gvuvzNC+WQ6drO2ThrypLVZQ+ry -eBIPmwKBgEZxhqa0gVvHQG/7Od69KWj4eJP28kq13RhKay8JOoN0vPmspXJo1HY3 -CKuHRG+AP579dncdUnOMvfXOtkdM4vk0+hWASBQzM9xzVcztCa+koAugjVaLS9A+ -9uQoqEeVNTckxx0S2bYevRy7hGQmUJTyQm3j1zEUR5jpdbL83Fbq ------END RSA PRIVATE KEY----- +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA4f5wg5l2hKsTeNem/V41fGnJm6gOdrj8ym3rFkEU/wT8RDtn +SgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7mCpz9Er5qLaMXJwZxzHzAahlfA0i +cqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBpHssPnpYGIn20ZZuNlX2BrClciHhC +PUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2XrHhR+1DcKJzQBSTAGnpYVaqpsAR +ap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3bODIRe1AuTyHceAbewn8b462yEWKA +Rdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy7wIDAQABAoIBAQCwia1k7+2oZ2d3 +n6agCAbqIE1QXfCmh41ZqJHbOY3oRQG3X1wpcGH4Gk+O+zDVTV2JszdcOt7E5dAy +MaomETAhRxB7hlIOnEN7WKm+dGNrKRvV0wDU5ReFMRHg31/Lnu8c+5BvGjZX+ky9 +POIhFFYJqwCRlopGSUIxmVj5rSgtzk3iWOQXr+ah1bjEXvlxDOWkHN6YfpV5ThdE +KdBIPGEVqa63r9n2h+qazKrtiRqJqGnOrHzOECYbRFYhexsNFz7YT02xdfSHn7gM +IvabDDP/Qp0PjE1jdouiMaFHYnLBbgvlnZW9yuVf/rpXTUq/njxIXMmvmEyyvSDn +FcFikB8pAoGBAPF77hK4m3/rdGT7X8a/gwvZ2R121aBcdPwEaUhvj/36dx596zvY +mEOjrWfZhF083/nYWE2kVquj2wjs+otCLfifEEgXcVPTnEOPO9Zg3uNSL0nNQghj +FuD3iGLTUBCtM66oTe0jLSslHe8gLGEQqyMzHOzYxNqibxcOZIe8Qt0NAoGBAO+U +I5+XWjWEgDmvyC3TrOSf/KCGjtu0TSv30ipv27bDLMrpvPmD/5lpptTFwcxvVhCs +2b+chCjlghFSWFbBULBrfci2FtliClOVMYrlNBdUSJhf3aYSG2Doe6Bgt1n2CpNn +/iu37Y3NfemZBJA7hNl4dYe+f+uzM87cdQ214+jrAoGAXA0XxX8ll2+ToOLJsaNT +OvNB9h9Uc5qK5X5w+7G7O998BN2PC/MWp8H+2fVqpXgNENpNXttkRm1hk1dych86 +EunfdPuqsX+as44oCyJGFHVBnWpm33eWQw9YqANRI+pCJzP08I5WK3osnPiwshd+ +hR54yjgfYhBFNI7B95PmEQkCgYBzFSz7h1+s34Ycr8SvxsOBWxymG5zaCsUbPsL0 +4aCgLScCHb9J+E86aVbbVFdglYa5Id7DPTL61ixhl7WZjujspeXZGSbmq0Kcnckb +mDgqkLECiOJW2NHP/j0McAkDLL4tysF8TLDO8gvuvzNC+WQ6drO2ThrypLVZQ+ry +eBIPmwKBgEZxhqa0gVvHQG/7Od69KWj4eJP28kq13RhKay8JOoN0vPmspXJo1HY3 +CKuHRG+AP579dncdUnOMvfXOtkdM4vk0+hWASBQzM9xzVcztCa+koAugjVaLS9A+ +9uQoqEeVNTckxx0S2bYevRy7hGQmUJTyQm3j1zEUR5jpdbL83Fbq +-----END RSA PRIVATE KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub b/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub index 419ddba131..03dc982acb 100644 --- a/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub +++ b/vendor/github.com/dgrijalva/jwt-go/test/sample_key.pub @@ -1,9 +1,9 @@ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4f5wg5l2hKsTeNem/V41 -fGnJm6gOdrj8ym3rFkEU/wT8RDtnSgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7 -mCpz9Er5qLaMXJwZxzHzAahlfA0icqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBp -HssPnpYGIn20ZZuNlX2BrClciHhCPUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2 -XrHhR+1DcKJzQBSTAGnpYVaqpsARap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3b -ODIRe1AuTyHceAbewn8b462yEWKARdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy -7wIDAQAB ------END PUBLIC KEY----- +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4f5wg5l2hKsTeNem/V41 +fGnJm6gOdrj8ym3rFkEU/wT8RDtnSgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7 +mCpz9Er5qLaMXJwZxzHzAahlfA0icqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBp +HssPnpYGIn20ZZuNlX2BrClciHhCPUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2 +XrHhR+1DcKJzQBSTAGnpYVaqpsARap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3b +ODIRe1AuTyHceAbewn8b462yEWKARdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy +7wIDAQAB +-----END PUBLIC KEY----- diff --git a/vendor/github.com/dgrijalva/jwt-go/token.go b/vendor/github.com/dgrijalva/jwt-go/token.go index fe8a355c4d..d637e0867c 100644 --- a/vendor/github.com/dgrijalva/jwt-go/token.go +++ b/vendor/github.com/dgrijalva/jwt-go/token.go @@ -1,108 +1,108 @@ -package jwt - -import ( - "encoding/base64" - "encoding/json" - "strings" - "time" -) - -// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time). -// You can override it to use another time value. This is useful for testing or if your -// server uses a different time zone than your tokens. -var TimeFunc = time.Now - -// Parse methods use this callback function to supply -// the key for verification. The function receives the parsed, -// but unverified Token. This allows you to use properties in the -// Header of the token (such as `kid`) to identify which key to use. -type Keyfunc func(*Token) (interface{}, error) - -// A JWT Token. Different fields will be used depending on whether you're -// creating or parsing/verifying a token. -type Token struct { - Raw string // The raw token. Populated when you Parse a token - Method SigningMethod // The signing method used or to be used - Header map[string]interface{} // The first segment of the token - Claims Claims // The second segment of the token - Signature string // The third segment of the token. Populated when you Parse a token - Valid bool // Is the token valid? Populated when you Parse/Verify a token -} - -// Create a new Token. Takes a signing method -func New(method SigningMethod) *Token { - return NewWithClaims(method, MapClaims{}) -} - -func NewWithClaims(method SigningMethod, claims Claims) *Token { - return &Token{ - Header: map[string]interface{}{ - "typ": "JWT", - "alg": method.Alg(), - }, - Claims: claims, - Method: method, - } -} - -// Get the complete, signed token -func (t *Token) SignedString(key interface{}) (string, error) { - var sig, sstr string - var err error - if sstr, err = t.SigningString(); err != nil { - return "", err - } - if sig, err = t.Method.Sign(sstr, key); err != nil { - return "", err - } - return strings.Join([]string{sstr, sig}, "."), nil -} - -// Generate the signing string. This is the -// most expensive part of the whole deal. Unless you -// need this for something special, just go straight for -// the SignedString. -func (t *Token) SigningString() (string, error) { - var err error - parts := make([]string, 2) - for i, _ := range parts { - var jsonValue []byte - if i == 0 { - if jsonValue, err = json.Marshal(t.Header); err != nil { - return "", err - } - } else { - if jsonValue, err = json.Marshal(t.Claims); err != nil { - return "", err - } - } - - parts[i] = EncodeSegment(jsonValue) - } - return strings.Join(parts, "."), nil -} - -// Parse, validate, and return a token. -// keyFunc will receive the parsed token and should return the key for validating. -// If everything is kosher, err will be nil -func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { - return new(Parser).Parse(tokenString, keyFunc) -} - -func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { - return new(Parser).ParseWithClaims(tokenString, claims, keyFunc) -} - -// Encode JWT specific base64url encoding with padding stripped -func EncodeSegment(seg []byte) string { - return strings.TrimRight(base64.URLEncoding.EncodeToString(seg), "=") -} - -// Decode JWT specific base64url encoding with padding stripped -func DecodeSegment(seg string) ([]byte, error) { - if l := len(seg) % 4; l > 0 { - seg += strings.Repeat("=", 4-l) - } - - return base64.URLEncoding.DecodeString(seg) -} +package jwt + +import ( + "encoding/base64" + "encoding/json" + "strings" + "time" +) + +// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time). +// You can override it to use another time value. This is useful for testing or if your +// server uses a different time zone than your tokens. +var TimeFunc = time.Now + +// Parse methods use this callback function to supply +// the key for verification. The function receives the parsed, +// but unverified Token. This allows you to use properties in the +// Header of the token (such as `kid`) to identify which key to use. +type Keyfunc func(*Token) (interface{}, error) + +// A JWT Token. Different fields will be used depending on whether you're +// creating or parsing/verifying a token. +type Token struct { + Raw string // The raw token. Populated when you Parse a token + Method SigningMethod // The signing method used or to be used + Header map[string]interface{} // The first segment of the token + Claims Claims // The second segment of the token + Signature string // The third segment of the token. Populated when you Parse a token + Valid bool // Is the token valid? Populated when you Parse/Verify a token +} + +// Create a new Token. Takes a signing method +func New(method SigningMethod) *Token { + return NewWithClaims(method, MapClaims{}) +} + +func NewWithClaims(method SigningMethod, claims Claims) *Token { + return &Token{ + Header: map[string]interface{}{ + "typ": "JWT", + "alg": method.Alg(), + }, + Claims: claims, + Method: method, + } +} + +// Get the complete, signed token +func (t *Token) SignedString(key interface{}) (string, error) { + var sig, sstr string + var err error + if sstr, err = t.SigningString(); err != nil { + return "", err + } + if sig, err = t.Method.Sign(sstr, key); err != nil { + return "", err + } + return strings.Join([]string{sstr, sig}, "."), nil +} + +// Generate the signing string. This is the +// most expensive part of the whole deal. Unless you +// need this for something special, just go straight for +// the SignedString. +func (t *Token) SigningString() (string, error) { + var err error + parts := make([]string, 2) + for i, _ := range parts { + var jsonValue []byte + if i == 0 { + if jsonValue, err = json.Marshal(t.Header); err != nil { + return "", err + } + } else { + if jsonValue, err = json.Marshal(t.Claims); err != nil { + return "", err + } + } + + parts[i] = EncodeSegment(jsonValue) + } + return strings.Join(parts, "."), nil +} + +// Parse, validate, and return a token. +// keyFunc will receive the parsed token and should return the key for validating. +// If everything is kosher, err will be nil +func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { + return new(Parser).Parse(tokenString, keyFunc) +} + +func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { + return new(Parser).ParseWithClaims(tokenString, claims, keyFunc) +} + +// Encode JWT specific base64url encoding with padding stripped +func EncodeSegment(seg []byte) string { + return strings.TrimRight(base64.URLEncoding.EncodeToString(seg), "=") +} + +// Decode JWT specific base64url encoding with padding stripped +func DecodeSegment(seg string) ([]byte, error) { + if l := len(seg) % 4; l > 0 { + seg += strings.Repeat("=", 4-l) + } + + return base64.URLEncoding.DecodeString(seg) +} diff --git a/vendor/github.com/ghodss/yaml/.gitignore b/vendor/github.com/ghodss/yaml/.gitignore index cf0c4ecf71..e256a31e00 100644 --- a/vendor/github.com/ghodss/yaml/.gitignore +++ b/vendor/github.com/ghodss/yaml/.gitignore @@ -1,20 +1,20 @@ -# OSX leaves these everywhere on SMB shares -._* - -# Eclipse files -.classpath -.project -.settings/** - -# Emacs save files -*~ - -# Vim-related files -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -*.un~ -Session.vim -.netrwhist - -# Go test binaries -*.test +# OSX leaves these everywhere on SMB shares +._* + +# Eclipse files +.classpath +.project +.settings/** + +# Emacs save files +*~ + +# Vim-related files +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +*.un~ +Session.vim +.netrwhist + +# Go test binaries +*.test diff --git a/vendor/github.com/ghodss/yaml/.travis.yml b/vendor/github.com/ghodss/yaml/.travis.yml index 77977ab24b..0e9d6edc01 100644 --- a/vendor/github.com/ghodss/yaml/.travis.yml +++ b/vendor/github.com/ghodss/yaml/.travis.yml @@ -1,7 +1,7 @@ -language: go -go: - - 1.3 - - 1.4 -script: - - go test - - go build +language: go +go: + - 1.3 + - 1.4 +script: + - go test + - go build diff --git a/vendor/github.com/ghodss/yaml/LICENSE b/vendor/github.com/ghodss/yaml/LICENSE index 62c2600424..7805d36de7 100644 --- a/vendor/github.com/ghodss/yaml/LICENSE +++ b/vendor/github.com/ghodss/yaml/LICENSE @@ -1,50 +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. +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/ghodss/yaml/README.md b/vendor/github.com/ghodss/yaml/README.md index 1063147bcc..0200f75b4d 100644 --- a/vendor/github.com/ghodss/yaml/README.md +++ b/vendor/github.com/ghodss/yaml/README.md @@ -1,121 +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"} - */ -} -``` +# 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/ghodss/yaml/fields.go b/vendor/github.com/ghodss/yaml/fields.go index ba9a68d0f7..5860074026 100644 --- a/vendor/github.com/ghodss/yaml/fields.go +++ b/vendor/github.com/ghodss/yaml/fields.go @@ -1,501 +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 -} +// 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/ghodss/yaml/yaml.go b/vendor/github.com/ghodss/yaml/yaml.go index ed066721a9..4fb4054a8b 100644 --- a/vendor/github.com/ghodss/yaml/yaml.go +++ b/vendor/github.com/ghodss/yaml/yaml.go @@ -1,277 +1,277 @@ -package yaml - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "strconv" - - "gopkg.in/yaml.v2" -) - -// Marshals the object into JSON then converts JSON to YAML and returns the -// YAML. -func Marshal(o interface{}) ([]byte, error) { - j, err := json.Marshal(o) - if err != nil { - return nil, fmt.Errorf("error marshaling into JSON: %v", err) - } - - y, err := JSONToYAML(j) - if err != nil { - return nil, fmt.Errorf("error converting JSON to YAML: %v", err) - } - - return y, nil -} - -// Converts YAML to JSON then uses JSON to unmarshal into an object. -func Unmarshal(y []byte, o interface{}) error { - vo := reflect.ValueOf(o) - j, err := yamlToJSON(y, &vo) - if err != nil { - return fmt.Errorf("error converting YAML to JSON: %v", err) - } - - err = json.Unmarshal(j, o) - if err != nil { - return fmt.Errorf("error unmarshaling JSON: %v", err) - } - - return nil -} - -// Convert JSON to YAML. -func JSONToYAML(j []byte) ([]byte, error) { - // Convert the JSON to an object. - var jsonObj interface{} - // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the - // Go JSON library doesn't try to pick the right number type (int, float, - // etc.) when unmarshalling to interface{}, it just picks float64 - // universally. go-yaml does go through the effort of picking the right - // number type, so we can preserve number type throughout this process. - err := yaml.Unmarshal(j, &jsonObj) - if err != nil { - return nil, err - } - - // Marshal this object into YAML. - return yaml.Marshal(jsonObj) -} - -// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through -// this method should be a no-op. -// -// Things YAML can do that are not supported by JSON: -// * In YAML you can have binary and null keys in your maps. These are invalid -// in JSON. (int and float keys are converted to strings.) -// * Binary data in YAML with the !!binary tag is not supported. If you want to -// use binary data with this library, encode the data as base64 as usual but do -// not use the !!binary tag in your YAML. This will ensure the original base64 -// encoded data makes it all the way through to the JSON. -func YAMLToJSON(y []byte) ([]byte, error) { - return yamlToJSON(y, nil) -} - -func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) { - // Convert the YAML to an object. - var yamlObj interface{} - err := yaml.Unmarshal(y, &yamlObj) - if err != nil { - return nil, err - } - - // YAML objects are not completely compatible with JSON objects (e.g. you - // can have non-string keys in YAML). So, convert the YAML-compatible object - // to a JSON-compatible object, failing with an error if irrecoverable - // incompatibilties happen along the way. - jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) - if err != nil { - return nil, err - } - - // Convert this object to JSON and return the data. - return json.Marshal(jsonObj) -} - -func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { - var err error - - // Resolve jsonTarget to a concrete value (i.e. not a pointer or an - // interface). We pass decodingNull as false because we're not actually - // decoding into the value, we're just checking if the ultimate target is a - // string. - if jsonTarget != nil { - ju, tu, pv := indirect(*jsonTarget, false) - // We have a JSON or Text Umarshaler at this level, so we can't be trying - // to decode into a string. - if ju != nil || tu != nil { - jsonTarget = nil - } else { - jsonTarget = &pv - } - } - - // If yamlObj is a number or a boolean, check if jsonTarget is a string - - // if so, coerce. Else return normal. - // If yamlObj is a map or array, find the field that each key is - // unmarshaling to, and when you recurse pass the reflect.Value for that - // field back into this function. - switch typedYAMLObj := yamlObj.(type) { - case map[interface{}]interface{}: - // JSON does not support arbitrary keys in a map, so we must convert - // these keys to strings. - // - // From my reading of go-yaml v2 (specifically the resolve function), - // keys can only have the types string, int, int64, float64, binary - // (unsupported), or null (unsupported). - strMap := make(map[string]interface{}) - for k, v := range typedYAMLObj { - // Resolve the key to a string first. - var keyString string - switch typedKey := k.(type) { - case string: - keyString = typedKey - case int: - keyString = strconv.Itoa(typedKey) - case int64: - // go-yaml will only return an int64 as a key if the system - // architecture is 32-bit and the key's value is between 32-bit - // and 64-bit. Otherwise the key type will simply be int. - keyString = strconv.FormatInt(typedKey, 10) - case float64: - // Stolen from go-yaml to use the same conversion to string as - // the go-yaml library uses to convert float to string when - // Marshaling. - s := strconv.FormatFloat(typedKey, 'g', -1, 32) - switch s { - case "+Inf": - s = ".inf" - case "-Inf": - s = "-.inf" - case "NaN": - s = ".nan" - } - keyString = s - case bool: - if typedKey { - keyString = "true" - } else { - keyString = "false" - } - default: - return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v", - reflect.TypeOf(k), k, v) - } - - // jsonTarget should be a struct or a map. If it's a struct, find - // the field it's going to map to and pass its reflect.Value. If - // it's a map, find the element type of the map and pass the - // reflect.Value created from that type. If it's neither, just pass - // nil - JSON conversion will error for us if it's a real issue. - if jsonTarget != nil { - t := *jsonTarget - if t.Kind() == reflect.Struct { - keyBytes := []byte(keyString) - // Find the field that the JSON library would use. - var f *field - fields := cachedTypeFields(t.Type()) - for i := range fields { - ff := &fields[i] - if bytes.Equal(ff.nameBytes, keyBytes) { - f = ff - break - } - // Do case-insensitive comparison. - if f == nil && ff.equalFold(ff.nameBytes, keyBytes) { - f = ff - } - } - if f != nil { - // Find the reflect.Value of the most preferential - // struct field. - jtf := t.Field(f.index[0]) - strMap[keyString], err = convertToJSONableObject(v, &jtf) - if err != nil { - return nil, err - } - continue - } - } else if t.Kind() == reflect.Map { - // Create a zero value of the map's element type to use as - // the JSON target. - jtv := reflect.Zero(t.Type().Elem()) - strMap[keyString], err = convertToJSONableObject(v, &jtv) - if err != nil { - return nil, err - } - continue - } - } - strMap[keyString], err = convertToJSONableObject(v, nil) - if err != nil { - return nil, err - } - } - return strMap, nil - case []interface{}: - // We need to recurse into arrays in case there are any - // map[interface{}]interface{}'s inside and to convert any - // numbers to strings. - - // If jsonTarget is a slice (which it really should be), find the - // thing it's going to map to. If it's not a slice, just pass nil - // - JSON conversion will error for us if it's a real issue. - var jsonSliceElemValue *reflect.Value - if jsonTarget != nil { - t := *jsonTarget - if t.Kind() == reflect.Slice { - // By default slices point to nil, but we need a reflect.Value - // pointing to a value of the slice type, so we create one here. - ev := reflect.Indirect(reflect.New(t.Type().Elem())) - jsonSliceElemValue = &ev - } - } - - // Make and use a new array. - arr := make([]interface{}, len(typedYAMLObj)) - for i, v := range typedYAMLObj { - arr[i], err = convertToJSONableObject(v, jsonSliceElemValue) - if err != nil { - return nil, err - } - } - return arr, nil - default: - // If the target type is a string and the YAML type is a number, - // convert the YAML type to a string. - if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String { - // Based on my reading of go-yaml, it may return int, int64, - // float64, or uint64. - var s string - switch typedVal := typedYAMLObj.(type) { - case int: - s = strconv.FormatInt(int64(typedVal), 10) - case int64: - s = strconv.FormatInt(typedVal, 10) - case float64: - s = strconv.FormatFloat(typedVal, 'g', -1, 32) - case uint64: - s = strconv.FormatUint(typedVal, 10) - case bool: - if typedVal { - s = "true" - } else { - s = "false" - } - } - if len(s) > 0 { - yamlObj = interface{}(s) - } - } - return yamlObj, nil - } - - return nil, nil -} +package yaml + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strconv" + + "gopkg.in/yaml.v2" +) + +// Marshals the object into JSON then converts JSON to YAML and returns the +// YAML. +func Marshal(o interface{}) ([]byte, error) { + j, err := json.Marshal(o) + if err != nil { + return nil, fmt.Errorf("error marshaling into JSON: %v", err) + } + + y, err := JSONToYAML(j) + if err != nil { + return nil, fmt.Errorf("error converting JSON to YAML: %v", err) + } + + return y, nil +} + +// Converts YAML to JSON then uses JSON to unmarshal into an object. +func Unmarshal(y []byte, o interface{}) error { + vo := reflect.ValueOf(o) + j, err := yamlToJSON(y, &vo) + if err != nil { + return fmt.Errorf("error converting YAML to JSON: %v", err) + } + + err = json.Unmarshal(j, o) + if err != nil { + return fmt.Errorf("error unmarshaling JSON: %v", err) + } + + return nil +} + +// Convert JSON to YAML. +func JSONToYAML(j []byte) ([]byte, error) { + // Convert the JSON to an object. + var jsonObj interface{} + // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the + // Go JSON library doesn't try to pick the right number type (int, float, + // etc.) when unmarshalling to interface{}, it just picks float64 + // universally. go-yaml does go through the effort of picking the right + // number type, so we can preserve number type throughout this process. + err := yaml.Unmarshal(j, &jsonObj) + if err != nil { + return nil, err + } + + // Marshal this object into YAML. + return yaml.Marshal(jsonObj) +} + +// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through +// this method should be a no-op. +// +// Things YAML can do that are not supported by JSON: +// * In YAML you can have binary and null keys in your maps. These are invalid +// in JSON. (int and float keys are converted to strings.) +// * Binary data in YAML with the !!binary tag is not supported. If you want to +// use binary data with this library, encode the data as base64 as usual but do +// not use the !!binary tag in your YAML. This will ensure the original base64 +// encoded data makes it all the way through to the JSON. +func YAMLToJSON(y []byte) ([]byte, error) { + return yamlToJSON(y, nil) +} + +func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) { + // Convert the YAML to an object. + var yamlObj interface{} + err := yaml.Unmarshal(y, &yamlObj) + if err != nil { + return nil, err + } + + // YAML objects are not completely compatible with JSON objects (e.g. you + // can have non-string keys in YAML). So, convert the YAML-compatible object + // to a JSON-compatible object, failing with an error if irrecoverable + // incompatibilties happen along the way. + jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) + if err != nil { + return nil, err + } + + // Convert this object to JSON and return the data. + return json.Marshal(jsonObj) +} + +func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { + var err error + + // Resolve jsonTarget to a concrete value (i.e. not a pointer or an + // interface). We pass decodingNull as false because we're not actually + // decoding into the value, we're just checking if the ultimate target is a + // string. + if jsonTarget != nil { + ju, tu, pv := indirect(*jsonTarget, false) + // We have a JSON or Text Umarshaler at this level, so we can't be trying + // to decode into a string. + if ju != nil || tu != nil { + jsonTarget = nil + } else { + jsonTarget = &pv + } + } + + // If yamlObj is a number or a boolean, check if jsonTarget is a string - + // if so, coerce. Else return normal. + // If yamlObj is a map or array, find the field that each key is + // unmarshaling to, and when you recurse pass the reflect.Value for that + // field back into this function. + switch typedYAMLObj := yamlObj.(type) { + case map[interface{}]interface{}: + // JSON does not support arbitrary keys in a map, so we must convert + // these keys to strings. + // + // From my reading of go-yaml v2 (specifically the resolve function), + // keys can only have the types string, int, int64, float64, binary + // (unsupported), or null (unsupported). + strMap := make(map[string]interface{}) + for k, v := range typedYAMLObj { + // Resolve the key to a string first. + var keyString string + switch typedKey := k.(type) { + case string: + keyString = typedKey + case int: + keyString = strconv.Itoa(typedKey) + case int64: + // go-yaml will only return an int64 as a key if the system + // architecture is 32-bit and the key's value is between 32-bit + // and 64-bit. Otherwise the key type will simply be int. + keyString = strconv.FormatInt(typedKey, 10) + case float64: + // Stolen from go-yaml to use the same conversion to string as + // the go-yaml library uses to convert float to string when + // Marshaling. + s := strconv.FormatFloat(typedKey, 'g', -1, 32) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + keyString = s + case bool: + if typedKey { + keyString = "true" + } else { + keyString = "false" + } + default: + return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v", + reflect.TypeOf(k), k, v) + } + + // jsonTarget should be a struct or a map. If it's a struct, find + // the field it's going to map to and pass its reflect.Value. If + // it's a map, find the element type of the map and pass the + // reflect.Value created from that type. If it's neither, just pass + // nil - JSON conversion will error for us if it's a real issue. + if jsonTarget != nil { + t := *jsonTarget + if t.Kind() == reflect.Struct { + keyBytes := []byte(keyString) + // Find the field that the JSON library would use. + var f *field + fields := cachedTypeFields(t.Type()) + for i := range fields { + ff := &fields[i] + if bytes.Equal(ff.nameBytes, keyBytes) { + f = ff + break + } + // Do case-insensitive comparison. + if f == nil && ff.equalFold(ff.nameBytes, keyBytes) { + f = ff + } + } + if f != nil { + // Find the reflect.Value of the most preferential + // struct field. + jtf := t.Field(f.index[0]) + strMap[keyString], err = convertToJSONableObject(v, &jtf) + if err != nil { + return nil, err + } + continue + } + } else if t.Kind() == reflect.Map { + // Create a zero value of the map's element type to use as + // the JSON target. + jtv := reflect.Zero(t.Type().Elem()) + strMap[keyString], err = convertToJSONableObject(v, &jtv) + if err != nil { + return nil, err + } + continue + } + } + strMap[keyString], err = convertToJSONableObject(v, nil) + if err != nil { + return nil, err + } + } + return strMap, nil + case []interface{}: + // We need to recurse into arrays in case there are any + // map[interface{}]interface{}'s inside and to convert any + // numbers to strings. + + // If jsonTarget is a slice (which it really should be), find the + // thing it's going to map to. If it's not a slice, just pass nil + // - JSON conversion will error for us if it's a real issue. + var jsonSliceElemValue *reflect.Value + if jsonTarget != nil { + t := *jsonTarget + if t.Kind() == reflect.Slice { + // By default slices point to nil, but we need a reflect.Value + // pointing to a value of the slice type, so we create one here. + ev := reflect.Indirect(reflect.New(t.Type().Elem())) + jsonSliceElemValue = &ev + } + } + + // Make and use a new array. + arr := make([]interface{}, len(typedYAMLObj)) + for i, v := range typedYAMLObj { + arr[i], err = convertToJSONableObject(v, jsonSliceElemValue) + if err != nil { + return nil, err + } + } + return arr, nil + default: + // If the target type is a string and the YAML type is a number, + // convert the YAML type to a string. + if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String { + // Based on my reading of go-yaml, it may return int, int64, + // float64, or uint64. + var s string + switch typedVal := typedYAMLObj.(type) { + case int: + s = strconv.FormatInt(int64(typedVal), 10) + case int64: + s = strconv.FormatInt(typedVal, 10) + case float64: + s = strconv.FormatFloat(typedVal, 'g', -1, 32) + case uint64: + s = strconv.FormatUint(typedVal, 10) + case bool: + if typedVal { + s = "true" + } else { + s = "false" + } + } + if len(s) > 0 { + yamlObj = interface{}(s) + } + } + return yamlObj, nil + } + + return nil, nil +} diff --git a/vendor/github.com/ghodss/yaml/yaml_test.go b/vendor/github.com/ghodss/yaml/yaml_test.go index bf98d1064a..505af45301 100644 --- a/vendor/github.com/ghodss/yaml/yaml_test.go +++ b/vendor/github.com/ghodss/yaml/yaml_test.go @@ -1,287 +1,287 @@ -package yaml - -import ( - "fmt" - "math" - "reflect" - "strconv" - "testing" -) - -type MarshalTest struct { - A string - B int64 - // Would like to test float64, but it's not supported in go-yaml. - // (See https://github.com/go-yaml/yaml/issues/83.) - C float32 -} - -func TestMarshal(t *testing.T) { - f32String := strconv.FormatFloat(math.MaxFloat32, 'g', -1, 32) - s := MarshalTest{"a", math.MaxInt64, math.MaxFloat32} - e := []byte(fmt.Sprintf("A: a\nB: %d\nC: %s\n", math.MaxInt64, f32String)) - - y, err := Marshal(s) - if err != nil { - t.Errorf("error marshaling YAML: %v", err) - } - - if !reflect.DeepEqual(y, e) { - t.Errorf("marshal YAML was unsuccessful, expected: %#v, got: %#v", - string(e), string(y)) - } -} - -type UnmarshalString struct { - A string - True string -} - -type UnmarshalStringMap struct { - A map[string]string -} - -type UnmarshalNestedString struct { - A NestedString -} - -type NestedString struct { - A string -} - -type UnmarshalSlice struct { - A []NestedSlice -} - -type NestedSlice struct { - B string - C *string -} - -func TestUnmarshal(t *testing.T) { - y := []byte("a: 1") - s1 := UnmarshalString{} - e1 := UnmarshalString{A: "1"} - unmarshal(t, y, &s1, &e1) - - y = []byte("a: true") - s1 = UnmarshalString{} - e1 = UnmarshalString{A: "true"} - unmarshal(t, y, &s1, &e1) - - y = []byte("true: 1") - s1 = UnmarshalString{} - e1 = UnmarshalString{True: "1"} - unmarshal(t, y, &s1, &e1) - - y = []byte("a:\n a: 1") - s2 := UnmarshalNestedString{} - e2 := UnmarshalNestedString{NestedString{"1"}} - unmarshal(t, y, &s2, &e2) - - y = []byte("a:\n - b: abc\n c: def\n - b: 123\n c: 456\n") - s3 := UnmarshalSlice{} - e3 := UnmarshalSlice{[]NestedSlice{NestedSlice{"abc", strPtr("def")}, NestedSlice{"123", strPtr("456")}}} - unmarshal(t, y, &s3, &e3) - - y = []byte("a:\n b: 1") - s4 := UnmarshalStringMap{} - e4 := UnmarshalStringMap{map[string]string{"b": "1"}} - unmarshal(t, y, &s4, &e4) - - y = []byte(` -a: - name: TestA -b: - name: TestB -`) - type NamedThing struct { - Name string `json:"name"` - } - s5 := map[string]*NamedThing{} - e5 := map[string]*NamedThing{ - "a": &NamedThing{Name: "TestA"}, - "b": &NamedThing{Name: "TestB"}, - } - unmarshal(t, y, &s5, &e5) -} - -func unmarshal(t *testing.T, y []byte, s, e interface{}) { - err := Unmarshal(y, s) - if err != nil { - t.Errorf("error unmarshaling YAML: %v", err) - } - - if !reflect.DeepEqual(s, e) { - t.Errorf("unmarshal YAML was unsuccessful, expected: %+#v, got: %+#v", - e, s) - } -} - -type Case struct { - input string - output string - // By default we test that reversing the output == input. But if there is a - // difference in the reversed output, you can optionally specify it here. - reverse *string -} - -type RunType int - -const ( - RunTypeJSONToYAML RunType = iota - RunTypeYAMLToJSON -) - -func TestJSONToYAML(t *testing.T) { - cases := []Case{ - { - `{"t":"a"}`, - "t: a\n", - nil, - }, { - `{"t":null}`, - "t: null\n", - nil, - }, - } - - runCases(t, RunTypeJSONToYAML, cases) -} - -func TestYAMLToJSON(t *testing.T) { - cases := []Case{ - { - "t: a\n", - `{"t":"a"}`, - nil, - }, { - "t: \n", - `{"t":null}`, - strPtr("t: null\n"), - }, { - "t: null\n", - `{"t":null}`, - nil, - }, { - "1: a\n", - `{"1":"a"}`, - strPtr("\"1\": a\n"), - }, { - "1000000000000000000000000000000000000: a\n", - `{"1e+36":"a"}`, - strPtr("\"1e+36\": a\n"), - }, { - "1e+36: a\n", - `{"1e+36":"a"}`, - strPtr("\"1e+36\": a\n"), - }, { - "\"1e+36\": a\n", - `{"1e+36":"a"}`, - nil, - }, { - "\"1.2\": a\n", - `{"1.2":"a"}`, - nil, - }, { - "- t: a\n", - `[{"t":"a"}]`, - nil, - }, { - "- t: a\n" + - "- t:\n" + - " b: 1\n" + - " c: 2\n", - `[{"t":"a"},{"t":{"b":1,"c":2}}]`, - nil, - }, { - `[{t: a}, {t: {b: 1, c: 2}}]`, - `[{"t":"a"},{"t":{"b":1,"c":2}}]`, - strPtr("- t: a\n" + - "- t:\n" + - " b: 1\n" + - " c: 2\n"), - }, { - "- t: \n", - `[{"t":null}]`, - strPtr("- t: null\n"), - }, { - "- t: null\n", - `[{"t":null}]`, - nil, - }, - } - - // Cases that should produce errors. - _ = []Case{ - { - "~: a", - `{"null":"a"}`, - nil, - }, { - "a: !!binary gIGC\n", - "{\"a\":\"\x80\x81\x82\"}", - nil, - }, - } - - runCases(t, RunTypeYAMLToJSON, cases) -} - -func runCases(t *testing.T, runType RunType, cases []Case) { - var f func([]byte) ([]byte, error) - var invF func([]byte) ([]byte, error) - var msg string - var invMsg string - if runType == RunTypeJSONToYAML { - f = JSONToYAML - invF = YAMLToJSON - msg = "JSON to YAML" - invMsg = "YAML back to JSON" - } else { - f = YAMLToJSON - invF = JSONToYAML - msg = "YAML to JSON" - invMsg = "JSON back to YAML" - } - - for _, c := range cases { - // Convert the string. - t.Logf("converting %s\n", c.input) - output, err := f([]byte(c.input)) - if err != nil { - t.Errorf("Failed to convert %s, input: `%s`, err: %v", msg, c.input, err) - } - - // Check it against the expected output. - if string(output) != c.output { - t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`", - msg, c.input, c.output, string(output)) - } - - // Set the string that we will compare the reversed output to. - reverse := c.input - // If a special reverse string was specified, use that instead. - if c.reverse != nil { - reverse = *c.reverse - } - - // Reverse the output. - input, err := invF(output) - if err != nil { - t.Errorf("Failed to convert %s, input: `%s`, err: %v", invMsg, string(output), err) - } - - // Check the reverse is equal to the input (or to *c.reverse). - if string(input) != reverse { - t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`", - invMsg, string(output), reverse, string(input)) - } - } - -} - -// To be able to easily fill in the *Case.reverse string above. -func strPtr(s string) *string { - return &s -} +package yaml + +import ( + "fmt" + "math" + "reflect" + "strconv" + "testing" +) + +type MarshalTest struct { + A string + B int64 + // Would like to test float64, but it's not supported in go-yaml. + // (See https://github.com/go-yaml/yaml/issues/83.) + C float32 +} + +func TestMarshal(t *testing.T) { + f32String := strconv.FormatFloat(math.MaxFloat32, 'g', -1, 32) + s := MarshalTest{"a", math.MaxInt64, math.MaxFloat32} + e := []byte(fmt.Sprintf("A: a\nB: %d\nC: %s\n", math.MaxInt64, f32String)) + + y, err := Marshal(s) + if err != nil { + t.Errorf("error marshaling YAML: %v", err) + } + + if !reflect.DeepEqual(y, e) { + t.Errorf("marshal YAML was unsuccessful, expected: %#v, got: %#v", + string(e), string(y)) + } +} + +type UnmarshalString struct { + A string + True string +} + +type UnmarshalStringMap struct { + A map[string]string +} + +type UnmarshalNestedString struct { + A NestedString +} + +type NestedString struct { + A string +} + +type UnmarshalSlice struct { + A []NestedSlice +} + +type NestedSlice struct { + B string + C *string +} + +func TestUnmarshal(t *testing.T) { + y := []byte("a: 1") + s1 := UnmarshalString{} + e1 := UnmarshalString{A: "1"} + unmarshal(t, y, &s1, &e1) + + y = []byte("a: true") + s1 = UnmarshalString{} + e1 = UnmarshalString{A: "true"} + unmarshal(t, y, &s1, &e1) + + y = []byte("true: 1") + s1 = UnmarshalString{} + e1 = UnmarshalString{True: "1"} + unmarshal(t, y, &s1, &e1) + + y = []byte("a:\n a: 1") + s2 := UnmarshalNestedString{} + e2 := UnmarshalNestedString{NestedString{"1"}} + unmarshal(t, y, &s2, &e2) + + y = []byte("a:\n - b: abc\n c: def\n - b: 123\n c: 456\n") + s3 := UnmarshalSlice{} + e3 := UnmarshalSlice{[]NestedSlice{NestedSlice{"abc", strPtr("def")}, NestedSlice{"123", strPtr("456")}}} + unmarshal(t, y, &s3, &e3) + + y = []byte("a:\n b: 1") + s4 := UnmarshalStringMap{} + e4 := UnmarshalStringMap{map[string]string{"b": "1"}} + unmarshal(t, y, &s4, &e4) + + y = []byte(` +a: + name: TestA +b: + name: TestB +`) + type NamedThing struct { + Name string `json:"name"` + } + s5 := map[string]*NamedThing{} + e5 := map[string]*NamedThing{ + "a": &NamedThing{Name: "TestA"}, + "b": &NamedThing{Name: "TestB"}, + } + unmarshal(t, y, &s5, &e5) +} + +func unmarshal(t *testing.T, y []byte, s, e interface{}) { + err := Unmarshal(y, s) + if err != nil { + t.Errorf("error unmarshaling YAML: %v", err) + } + + if !reflect.DeepEqual(s, e) { + t.Errorf("unmarshal YAML was unsuccessful, expected: %+#v, got: %+#v", + e, s) + } +} + +type Case struct { + input string + output string + // By default we test that reversing the output == input. But if there is a + // difference in the reversed output, you can optionally specify it here. + reverse *string +} + +type RunType int + +const ( + RunTypeJSONToYAML RunType = iota + RunTypeYAMLToJSON +) + +func TestJSONToYAML(t *testing.T) { + cases := []Case{ + { + `{"t":"a"}`, + "t: a\n", + nil, + }, { + `{"t":null}`, + "t: null\n", + nil, + }, + } + + runCases(t, RunTypeJSONToYAML, cases) +} + +func TestYAMLToJSON(t *testing.T) { + cases := []Case{ + { + "t: a\n", + `{"t":"a"}`, + nil, + }, { + "t: \n", + `{"t":null}`, + strPtr("t: null\n"), + }, { + "t: null\n", + `{"t":null}`, + nil, + }, { + "1: a\n", + `{"1":"a"}`, + strPtr("\"1\": a\n"), + }, { + "1000000000000000000000000000000000000: a\n", + `{"1e+36":"a"}`, + strPtr("\"1e+36\": a\n"), + }, { + "1e+36: a\n", + `{"1e+36":"a"}`, + strPtr("\"1e+36\": a\n"), + }, { + "\"1e+36\": a\n", + `{"1e+36":"a"}`, + nil, + }, { + "\"1.2\": a\n", + `{"1.2":"a"}`, + nil, + }, { + "- t: a\n", + `[{"t":"a"}]`, + nil, + }, { + "- t: a\n" + + "- t:\n" + + " b: 1\n" + + " c: 2\n", + `[{"t":"a"},{"t":{"b":1,"c":2}}]`, + nil, + }, { + `[{t: a}, {t: {b: 1, c: 2}}]`, + `[{"t":"a"},{"t":{"b":1,"c":2}}]`, + strPtr("- t: a\n" + + "- t:\n" + + " b: 1\n" + + " c: 2\n"), + }, { + "- t: \n", + `[{"t":null}]`, + strPtr("- t: null\n"), + }, { + "- t: null\n", + `[{"t":null}]`, + nil, + }, + } + + // Cases that should produce errors. + _ = []Case{ + { + "~: a", + `{"null":"a"}`, + nil, + }, { + "a: !!binary gIGC\n", + "{\"a\":\"\x80\x81\x82\"}", + nil, + }, + } + + runCases(t, RunTypeYAMLToJSON, cases) +} + +func runCases(t *testing.T, runType RunType, cases []Case) { + var f func([]byte) ([]byte, error) + var invF func([]byte) ([]byte, error) + var msg string + var invMsg string + if runType == RunTypeJSONToYAML { + f = JSONToYAML + invF = YAMLToJSON + msg = "JSON to YAML" + invMsg = "YAML back to JSON" + } else { + f = YAMLToJSON + invF = JSONToYAML + msg = "YAML to JSON" + invMsg = "JSON back to YAML" + } + + for _, c := range cases { + // Convert the string. + t.Logf("converting %s\n", c.input) + output, err := f([]byte(c.input)) + if err != nil { + t.Errorf("Failed to convert %s, input: `%s`, err: %v", msg, c.input, err) + } + + // Check it against the expected output. + if string(output) != c.output { + t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`", + msg, c.input, c.output, string(output)) + } + + // Set the string that we will compare the reversed output to. + reverse := c.input + // If a special reverse string was specified, use that instead. + if c.reverse != nil { + reverse = *c.reverse + } + + // Reverse the output. + input, err := invF(output) + if err != nil { + t.Errorf("Failed to convert %s, input: `%s`, err: %v", invMsg, string(output), err) + } + + // Check the reverse is equal to the input (or to *c.reverse). + if string(input) != reverse { + t.Errorf("Failed to convert %s, input: `%s`, expected `%s`, got `%s`", + invMsg, string(output), reverse, string(input)) + } + } + +} + +// To be able to easily fill in the *Case.reverse string above. +func strPtr(s string) *string { + return &s +} diff --git a/vendor/github.com/inconshreveable/mousetrap/LICENSE b/vendor/github.com/inconshreveable/mousetrap/LICENSE index c55e0b90f0..5f0d1fb6a7 100644 --- a/vendor/github.com/inconshreveable/mousetrap/LICENSE +++ b/vendor/github.com/inconshreveable/mousetrap/LICENSE @@ -1,13 +1,13 @@ -Copyright 2014 Alan Shreve - -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. +Copyright 2014 Alan Shreve + +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/inconshreveable/mousetrap/README.md b/vendor/github.com/inconshreveable/mousetrap/README.md index 590f1eb0a0..7a950d1774 100644 --- a/vendor/github.com/inconshreveable/mousetrap/README.md +++ b/vendor/github.com/inconshreveable/mousetrap/README.md @@ -1,23 +1,23 @@ -# mousetrap - -mousetrap is a tiny library that answers a single question. - -On a Windows machine, was the process invoked by someone double clicking on -the executable file while browsing in explorer? - -### Motivation - -Windows developers unfamiliar with command line tools will often "double-click" -the executable for a tool. Because most CLI tools print the help and then exit -when invoked without arguments, this is often very frustrating for those users. - -mousetrap provides a way to detect these invocations so that you can provide -more helpful behavior and instructions on how to run the CLI tool. To see what -this looks like, both from an organizational and a technical perspective, see -https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ - -### The interface - -The library exposes a single interface: - - func StartedByExplorer() (bool) +# mousetrap + +mousetrap is a tiny library that answers a single question. + +On a Windows machine, was the process invoked by someone double clicking on +the executable file while browsing in explorer? + +### Motivation + +Windows developers unfamiliar with command line tools will often "double-click" +the executable for a tool. Because most CLI tools print the help and then exit +when invoked without arguments, this is often very frustrating for those users. + +mousetrap provides a way to detect these invocations so that you can provide +more helpful behavior and instructions on how to run the CLI tool. To see what +this looks like, both from an organizational and a technical perspective, see +https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ + +### The interface + +The library exposes a single interface: + + func StartedByExplorer() (bool) diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/vendor/github.com/inconshreveable/mousetrap/trap_others.go index 8daa3baeb0..9d2d8a4bab 100644 --- a/vendor/github.com/inconshreveable/mousetrap/trap_others.go +++ b/vendor/github.com/inconshreveable/mousetrap/trap_others.go @@ -1,15 +1,15 @@ -// +build !windows - -package mousetrap - -// StartedByExplorer returns true if the program was invoked by the user -// double-clicking on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -// -// On non-Windows platforms, it always returns false. -func StartedByExplorer() bool { - return false -} +// +build !windows + +package mousetrap + +// StartedByExplorer returns true if the program was invoked by the user +// double-clicking on the executable from explorer.exe +// +// It is conservative and returns false if any of the internal calls fail. +// It does not guarantee that the program was run from a terminal. It only can tell you +// whether it was launched from explorer.exe +// +// On non-Windows platforms, it always returns false. +func StartedByExplorer() bool { + return false +} diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go index b7c7ea1178..336142a5e3 100644 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go +++ b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go @@ -1,98 +1,98 @@ -// +build windows -// +build !go1.4 - -package mousetrap - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const ( - // defined by the Win32 API - th32cs_snapprocess uintptr = 0x2 -) - -var ( - kernel = syscall.MustLoadDLL("kernel32.dll") - CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") - Process32First = kernel.MustFindProc("Process32FirstW") - Process32Next = kernel.MustFindProc("Process32NextW") -) - -// ProcessEntry32 structure defined by the Win32 API -type processEntry32 struct { - dwSize uint32 - cntUsage uint32 - th32ProcessID uint32 - th32DefaultHeapID int - th32ModuleID uint32 - cntThreads uint32 - th32ParentProcessID uint32 - pcPriClassBase int32 - dwFlags uint32 - szExeFile [syscall.MAX_PATH]uint16 -} - -func getProcessEntry(pid int) (pe *processEntry32, err error) { - snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) - if snapshot == uintptr(syscall.InvalidHandle) { - err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) - return - } - defer syscall.CloseHandle(syscall.Handle(snapshot)) - - var processEntry processEntry32 - processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) - ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32First: %v", e1) - return - } - - for { - if processEntry.th32ProcessID == uint32(pid) { - pe = &processEntry - return - } - - ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) - if ok == 0 { - err = fmt.Errorf("Process32Next: %v", e1) - return - } - } -} - -func getppid() (pid int, err error) { - pe, err := getProcessEntry(os.Getpid()) - if err != nil { - return - } - - pid = int(pe.th32ParentProcessID) - return -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - ppid, err := getppid() - if err != nil { - return false - } - - pe, err := getProcessEntry(ppid) - if err != nil { - return false - } - - name := syscall.UTF16ToString(pe.szExeFile[:]) - return name == "explorer.exe" -} +// +build windows +// +build !go1.4 + +package mousetrap + +import ( + "fmt" + "os" + "syscall" + "unsafe" +) + +const ( + // defined by the Win32 API + th32cs_snapprocess uintptr = 0x2 +) + +var ( + kernel = syscall.MustLoadDLL("kernel32.dll") + CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot") + Process32First = kernel.MustFindProc("Process32FirstW") + Process32Next = kernel.MustFindProc("Process32NextW") +) + +// ProcessEntry32 structure defined by the Win32 API +type processEntry32 struct { + dwSize uint32 + cntUsage uint32 + th32ProcessID uint32 + th32DefaultHeapID int + th32ModuleID uint32 + cntThreads uint32 + th32ParentProcessID uint32 + pcPriClassBase int32 + dwFlags uint32 + szExeFile [syscall.MAX_PATH]uint16 +} + +func getProcessEntry(pid int) (pe *processEntry32, err error) { + snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0)) + if snapshot == uintptr(syscall.InvalidHandle) { + err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1) + return + } + defer syscall.CloseHandle(syscall.Handle(snapshot)) + + var processEntry processEntry32 + processEntry.dwSize = uint32(unsafe.Sizeof(processEntry)) + ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) + if ok == 0 { + err = fmt.Errorf("Process32First: %v", e1) + return + } + + for { + if processEntry.th32ProcessID == uint32(pid) { + pe = &processEntry + return + } + + ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry))) + if ok == 0 { + err = fmt.Errorf("Process32Next: %v", e1) + return + } + } +} + +func getppid() (pid int, err error) { + pe, err := getProcessEntry(os.Getpid()) + if err != nil { + return + } + + pid = int(pe.th32ParentProcessID) + return +} + +// StartedByExplorer returns true if the program was invoked by the user double-clicking +// on the executable from explorer.exe +// +// It is conservative and returns false if any of the internal calls fail. +// It does not guarantee that the program was run from a terminal. It only can tell you +// whether it was launched from explorer.exe +func StartedByExplorer() bool { + ppid, err := getppid() + if err != nil { + return false + } + + pe, err := getProcessEntry(ppid) + if err != nil { + return false + } + + name := syscall.UTF16ToString(pe.szExeFile[:]) + return name == "explorer.exe" +} diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go index 3ac6117632..9a28e57c3c 100644 --- a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go +++ b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go @@ -1,46 +1,46 @@ -// +build windows -// +build go1.4 - -package mousetrap - -import ( - "os" - "syscall" - "unsafe" -) - -func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { - snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) - if err != nil { - return nil, err - } - defer syscall.CloseHandle(snapshot) - var procEntry syscall.ProcessEntry32 - procEntry.Size = uint32(unsafe.Sizeof(procEntry)) - if err = syscall.Process32First(snapshot, &procEntry); err != nil { - return nil, err - } - for { - if procEntry.ProcessID == uint32(pid) { - return &procEntry, nil - } - err = syscall.Process32Next(snapshot, &procEntry) - if err != nil { - return nil, err - } - } -} - -// StartedByExplorer returns true if the program was invoked by the user double-clicking -// on the executable from explorer.exe -// -// It is conservative and returns false if any of the internal calls fail. -// It does not guarantee that the program was run from a terminal. It only can tell you -// whether it was launched from explorer.exe -func StartedByExplorer() bool { - pe, err := getProcessEntry(os.Getppid()) - if err != nil { - return false - } - return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) -} +// +build windows +// +build go1.4 + +package mousetrap + +import ( + "os" + "syscall" + "unsafe" +) + +func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { + snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) + if err != nil { + return nil, err + } + defer syscall.CloseHandle(snapshot) + var procEntry syscall.ProcessEntry32 + procEntry.Size = uint32(unsafe.Sizeof(procEntry)) + if err = syscall.Process32First(snapshot, &procEntry); err != nil { + return nil, err + } + for { + if procEntry.ProcessID == uint32(pid) { + return &procEntry, nil + } + err = syscall.Process32Next(snapshot, &procEntry) + if err != nil { + return nil, err + } + } +} + +// StartedByExplorer returns true if the program was invoked by the user double-clicking +// on the executable from explorer.exe +// +// It is conservative and returns false if any of the internal calls fail. +// It does not guarantee that the program was run from a terminal. It only can tell you +// whether it was launched from explorer.exe +func StartedByExplorer() bool { + pe, err := getProcessEntry(os.Getppid()) + if err != nil { + return false + } + return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) +} diff --git a/vendor/github.com/leonelquinteros/gotext/.gitignore b/vendor/github.com/leonelquinteros/gotext/.gitignore new file mode 100644 index 0000000000..d537248563 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/.gitignore @@ -0,0 +1,29 @@ +# Eclipse shit +.project +.settings +.buildpath + +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/leonelquinteros/gotext/.travis.yml b/vendor/github.com/leonelquinteros/gotext/.travis.yml new file mode 100644 index 0000000000..74aadf366e --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/.travis.yml @@ -0,0 +1,7 @@ +language: go +script: go test -v -race ./... + +go: + - 1.5 + - 1.6 + - tip diff --git a/vendor/github.com/leonelquinteros/gotext/Godeps/Godeps.json b/vendor/github.com/leonelquinteros/gotext/Godeps/Godeps.json new file mode 100644 index 0000000000..968e5f9543 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/Godeps/Godeps.json @@ -0,0 +1,22 @@ +{ + "ImportPath": "github.com/leonelquinteros/gotext", + "GoVersion": "go1.6", + "GodepVersion": "v74", + "Packages": [ + "./..." + ], + "Deps": [ + { + "ImportPath": "github.com/mattn/anko/ast", + "Rev": "a8c68fa2983e7dd5d3472992b1fbe2f7c44261f0" + }, + { + "ImportPath": "github.com/mattn/anko/parser", + "Rev": "a8c68fa2983e7dd5d3472992b1fbe2f7c44261f0" + }, + { + "ImportPath": "github.com/mattn/anko/vm", + "Rev": "a8c68fa2983e7dd5d3472992b1fbe2f7c44261f0" + } + ] +} diff --git a/vendor/github.com/leonelquinteros/gotext/Godeps/Readme b/vendor/github.com/leonelquinteros/gotext/Godeps/Readme new file mode 100644 index 0000000000..4cdaa53d56 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/Godeps/Readme @@ -0,0 +1,5 @@ +This directory tree is generated automatically by godep. + +Please do not edit. + +See https://github.com/tools/godep for more information. diff --git a/vendor/github.com/leonelquinteros/gotext/LICENSE b/vendor/github.com/leonelquinteros/gotext/LICENSE new file mode 100644 index 0000000000..a753ef28a5 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Leonel Quinteros + +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/leonelquinteros/gotext/README.md b/vendor/github.com/leonelquinteros/gotext/README.md new file mode 100644 index 0000000000..3dd621afe7 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/README.md @@ -0,0 +1,307 @@ +[![GoDoc](https://godoc.org/github.com/leonelquinteros/gotext?status.svg)](https://godoc.org/github.com/leonelquinteros/gotext) +[![Build Status](https://travis-ci.org/leonelquinteros/gotext.svg?branch=master)](https://travis-ci.org/leonelquinteros/gotext) +[![Go Report Card](https://goreportcard.com/badge/github.com/leonelquinteros/gotext)](https://goreportcard.com/report/github.com/leonelquinteros/gotext) + +# Gotext + +[GNU gettext utilities](https://www.gnu.org/software/gettext) for Go. + +Version: [v1.1.1](https://github.com/leonelquinteros/gotext/releases/tag/v1.1.1) + + +# Features + +- Implements GNU gettext support in native Go. +- Complete support for [PO files](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) including: + - Support for multiline strings and headers. + - Support for variables inside translation strings using Go's [fmt syntax](https://golang.org/pkg/fmt/). + - Support for [pluralization rules](https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html). + - Support for [message contexts](https://www.gnu.org/software/gettext/manual/html_node/Contexts.html). +- Thread-safe: This package is safe for concurrent use across multiple goroutines. +- It works with UTF-8 encoding as it's the default for Go language. +- Unit tests available. See coverage: https://gocover.io/github.com/leonelquinteros/gotext +- Language codes are automatically simplified from the form `en_UK` to `en` if the first isn't available. +- Ready to use inside Go templates. + + +# License + +[MIT license](LICENSE) + + +# Documentation + +Refer to the Godoc package documentation at (https://godoc.org/github.com/leonelquinteros/gotext) + + +# Installation + +``` +go get github.com/leonelquinteros/gotext +``` + +- There are no requirements or dependencies to use this package. +- No need to install GNU gettext utilities (unless specific needs of CLI tools). +- No need for environment variables. Some naming conventions are applied but not needed. + + +#### Version vendoring + +Stable releases use [semantic versioning](http://semver.org/spec/v2.0.0.html) tagging on this repository. + +You can rely on this to use your preferred vendoring tool or to manually retrieve the corresponding release tag from the GitHub repository. + + +##### Vendoring with [gopkg.in](http://labix.org/gopkg.in) + +[http://gopkg.in/leonelquinteros/gotext.v1](http://gopkg.in/leonelquinteros/gotext.v1) + +To get the latest v1 package stable release, execute: + +``` +go get gopkg.in/leonelquinteros/gotext.v1 +``` + +To import this package, add the following line to your code: + +```go +import "gopkg.in/leonelquinteros/gotext.v1" +``` + +Refer to it as gotext. + + +# Locales directories structure + +The package will assume a directories structure starting with a base path that will be provided to the package configuration +or to object constructors depending on the use, but either will use the same convention to lookup inside the base path. + +Inside the base directory where will be the language directories named using the language and country 2-letter codes (en_US, es_AR, ...). +All package functions can lookup after the simplified version for each language in case the full code isn't present but the more general language code exists. +So if the language set is `en_UK`, but there is no directory named after that code and there is a directory named `en`, +all package functions will be able to resolve this generalization and provide translations for the more general library. + +The language codes are assumed to be [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) codes (2-letter codes). +That said, most functions will work with any coding standard as long the directory name matches the language code set on the configuration. + +Then, there can be a `LC_MESSAGES` containing all PO files or the PO files themselves. +A library directory structure can look like: + +``` +/path/to/locales +/path/to/locales/en_US +/path/to/locales/en_US/LC_MESSAGES +/path/to/locales/en_US/LC_MESSAGES/default.po +/path/to/locales/en_US/LC_MESSAGES/extras.po +/path/to/locales/en_UK +/path/to/locales/en_UK/LC_MESSAGES +/path/to/locales/en_UK/LC_MESSAGES/default.po +/path/to/locales/en_UK/LC_MESSAGES/extras.po +/path/to/locales/en_AU +/path/to/locales/en_AU/LC_MESSAGES +/path/to/locales/en_AU/LC_MESSAGES/default.po +/path/to/locales/en_AU/LC_MESSAGES/extras.po +/path/to/locales/es +/path/to/locales/es/default.po +/path/to/locales/es/extras.po +/path/to/locales/es_ES +/path/to/locales/es_ES/default.po +/path/to/locales/es_ES/extras.po +/path/to/locales/fr +/path/to/locales/fr/default.po +/path/to/locales/fr/extras.po +``` + +And so on... + + + +# About translation function names + +The standard GNU gettext defines helper functions that maps to the `gettext()` function and it's widely adopted by most implementations. + +The basic translation function is usually `_()` in the form: + +``` +_("Translate this") +``` + +In Go, this can't be implemented by a reusable package as the function name has to start with a capital letter in order to be exported. + +Each implementation of this package can declare this helper functions inside their own packages if this function naming are desired/needed: + +```go +package main + +import "github.com/leonelquinteros/gotext" + +func _(str string, vars ...interface{}) string { + return gotext.Get(str, vars...) +} + +``` + +This is valid and can be used within a package. + +In normal conditions the Go compiler will optimize the calls to `_()` by replacing its content in place of the function call to reduce the function calling overhead. +This is a normal Go compiler behavior. + + + +# Usage examples + +## Using package for single language/domain settings + +For quick/simple translations you can use the package level functions directly. + +```go +import "github.com/leonelquinteros/gotext" + +func main() { + // Configure package + gotext.Configure("/path/to/locales/root/dir", "en_UK", "domain-name") + + // Translate text from default domain + println(gotext.Get("My text on 'domain-name' domain")) + + // Translate text from a different domain without reconfigure + println(gotext.GetD("domain2", "Another text on a different domain")) +} + +``` + +## Using dynamic variables on translations + +All translation strings support dynamic variables to be inserted without translate. +Use the fmt.Printf syntax (from Go's "fmt" package) to specify how to print the non-translated variable inside the translation string. + +```go +import "github.com/leonelquinteros/gotext" + +func main() { + // Configure package + gotext.Configure("/path/to/locales/root/dir", "en_UK", "domain-name") + + // Set variables + name := "John" + + // Translate text with variables + println(gotext.Get("Hi, my name is %s", name)) +} + +``` + + +## Using Locale object + +When having multiple languages/domains/libraries at the same time, you can create Locale objects for each variation +so you can handle each settings on their own. + +```go +import "github.com/leonelquinteros/gotext" + +func main() { + // Create Locale with library path and language code + l := gotext.NewLocale("/path/to/locales/root/dir", "es_UY") + + // Load domain '/path/to/locales/root/dir/es_UY/default.po' + l.AddDomain("default") + + // Translate text from default domain + println(l.Get("Translate this")) + + // Load different domain + l.AddDomain("translations") + + // Translate text from domain + println(l.GetD("translations", "Translate this")) +} +``` + +This is also helpful for using inside templates (from the "text/template" package), where you can pass the Locale object to the template. +If you set the Locale object as "Loc" in the template, then the template code would look like: + +``` +{{ .Loc.Get "Translate this" }} +``` + + +## Using the Po object to handle .po files and PO-formatted strings + +For when you need to work with PO files and strings, +you can directly use the Po object to parse it and access the translations in there in the same way. + +```go +import "github.com/leonelquinteros/gotext" + +func main() { + // Set PO content + str := ` +msgid "Translate this" +msgstr "Translated text" + +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgstr "This one sets the var: %s" +` + + // Create Po object + po := new(Po) + po.Parse(str) + + println(po.Get("Translate this")) +} +``` + + +## Use plural forms of translations + +PO format supports defining one or more plural forms for the same translation. +Relying on the PO file headers, a Plural-Forms formula can be set on the translation file +as defined in (https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-forms.html) + +Plural formulas are parsed and evaluated using [Anko](https://github.com/mattn/anko) + +```go +import "github.com/leonelquinteros/gotext" + +func main() { + // Set PO content + str := ` +msgid "" +msgstr "" + +# Header below +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "Translate this" +msgstr "Translated text" + +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +` + + // Create Po object + po := new(Po) + po.Parse(str) + + println(po.GetN("One with var: %s", "Several with vars: %s", 54, v)) + // "This one is the plural: Variable" +} +``` + + +# Contribute + +- Please, contribute. +- Use the package on your projects. +- Report issues on Github. +- Send pull requests for bugfixes and improvements. +- Send proposals on Github issues. diff --git a/vendor/github.com/leonelquinteros/gotext/gotext.go b/vendor/github.com/leonelquinteros/gotext/gotext.go new file mode 100644 index 0000000000..4f4d94362c --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/gotext.go @@ -0,0 +1,151 @@ +/* +Package gotext implements GNU gettext utilities. + +For quick/simple translations you can use the package level functions directly. + + import "github.com/leonelquinteros/gotext" + + func main() { + // Configure package + gotext.Configure("/path/to/locales/root/dir", "en_UK", "domain-name") + + // Translate text from default domain + println(gotext.Get("My text on 'domain-name' domain")) + + // Translate text from a different domain without reconfigure + println(gotext.GetD("domain2", "Another text on a different domain")) + } + +*/ +package gotext + +// Global environment variables +var ( + // Default domain to look at when no domain is specified. Used by package level functions. + domain = "default" + + // Language set. + language = "en_US" + + // Path to library directory where all locale directories and translation files are. + library = "/usr/local/share/locale" + + // Storage for package level methods + storage *Locale +) + +// loadStorage creates a new Locale object at package level based on the Global variables settings. +// It's called automatically when trying to use Get or GetD methods. +func loadStorage(force bool) { + if storage == nil || force { + storage = NewLocale(library, language) + } + + if _, ok := storage.domains[domain]; !ok || force { + storage.AddDomain(domain) + } +} + +// GetDomain is the domain getter for the package configuration +func GetDomain() string { + return domain +} + +// SetDomain sets the name for the domain to be used at package level. +// It reloads the corresponding translation file. +func SetDomain(dom string) { + domain = dom + loadStorage(true) +} + +// GetLanguage is the language getter for the package configuration +func GetLanguage() string { + return language +} + +// SetLanguage sets the language code to be used at package level. +// It reloads the corresponding translation file. +func SetLanguage(lang string) { + language = lang + loadStorage(true) +} + +// GetLibrary is the library getter for the package configuration +func GetLibrary() string { + return library +} + +// SetLibrary sets the root path for the loale directories and files to be used at package level. +// It reloads the corresponding translation file. +func SetLibrary(lib string) { + library = lib + loadStorage(true) +} + +// Configure sets all configuration variables to be used at package level and reloads the corresponding translation file. +// It receives the library path, language code and domain name. +// This function is recommended to be used when changing more than one setting, +// as using each setter will introduce a I/O overhead because the translation file will be loaded after each set. +func Configure(lib, lang, dom string) { + library = lib + language = lang + domain = dom + + loadStorage(true) +} + +// Get uses the default domain globally set to return the corresponding translation of a given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func Get(str string, vars ...interface{}) string { + return GetD(domain, str, vars...) +} + +// GetN retrieves the (N)th plural form of translation for the given string in the "default" domain. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetN(str, plural string, n int, vars ...interface{}) string { + return GetND("default", str, plural, n, vars...) +} + +// GetD returns the corresponding translation in the given domain for a given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetD(dom, str string, vars ...interface{}) string { + return GetND(dom, str, str, 1, vars...) +} + +// GetND retrieves the (N)th plural form of translation in the given domain for a given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetND(dom, str, plural string, n int, vars ...interface{}) string { + // Try to load default package Locale storage + loadStorage(false) + + // Return translation + return storage.GetND(dom, str, plural, n, vars...) +} + +// GetC uses the default domain globally set to return the corresponding translation of the given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetC(str, ctx string, vars ...interface{}) string { + return GetDC(domain, str, ctx, vars...) +} + +// GetNC retrieves the (N)th plural form of translation for the given string in the given context in the "default" domain. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetNC(str, plural string, n int, ctx string, vars ...interface{}) string { + return GetNDC("default", str, plural, n, ctx, vars...) +} + +// GetDC returns the corresponding translation in the given domain for the given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetDC(dom, str, ctx string, vars ...interface{}) string { + return GetNDC(dom, str, str, 1, ctx, vars...) +} + +// GetNDC retrieves the (N)th plural form of translation in the given domain for a given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func GetNDC(dom, str, plural string, n int, ctx string, vars ...interface{}) string { + // Try to load default package Locale storage + loadStorage(false) + + // Return translation + return storage.GetNDC(dom, str, plural, n, ctx, vars...) +} diff --git a/vendor/github.com/leonelquinteros/gotext/gotext_test.go b/vendor/github.com/leonelquinteros/gotext/gotext_test.go new file mode 100644 index 0000000000..d9b786ded5 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/gotext_test.go @@ -0,0 +1,199 @@ +package gotext + +import ( + "os" + "path" + "testing" +) + +func TestGettersSetters(t *testing.T) { + SetDomain("test") + dom := GetDomain() + + if dom != "test" { + t.Errorf("Expected GetDomain to return 'test', but got '%s'", dom) + } + + SetLibrary("/tmp/test") + lib := GetLibrary() + + if lib != "/tmp/test" { + t.Errorf("Expected GetLibrary to return '/tmp/test', but got '%s'", lib) + } + + SetLanguage("es") + lang := GetLanguage() + + if lang != "es" { + t.Errorf("Expected GetLanguage to return 'es', but got '%s'", lang) + } +} + +func TestPackageFunctions(t *testing.T) { + // Set PO content + str := ` +msgid "" +msgstr "" +# Initial comment +# Headers below +"Language: en\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + +msgid "This one has invalid syntax translations" +msgid_plural "Plural index" +msgstr[abc] "Wrong index" +msgstr[1 "Forgot to close brackets" +msgstr[0] "Badly formatted string' + +msgid "Invalid formatted id[] with no translations + +msgctxt "Ctx" +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular in a Ctx context: %s" +msgstr[1] "This one is the plural in a Ctx context: %s" + +msgid "Some random" +msgstr "Some random translation" + +msgctxt "Ctx" +msgid "Some random in a context" +msgstr "Some random translation in a context" + +msgid "More" +msgstr "More translation" + + ` + + // Create Locales directory on default location + dirname := path.Clean("/tmp" + string(os.PathSeparator) + "en_US") + err := os.MkdirAll(dirname, os.ModePerm) + if err != nil { + t.Fatalf("Can't create test directory: %s", err.Error()) + } + + // Write PO content to default domain file + filename := path.Clean(dirname + string(os.PathSeparator) + "default.po") + + f, err := os.Create(filename) + if err != nil { + t.Fatalf("Can't create test file: %s", err.Error()) + } + defer f.Close() + + _, err = f.WriteString(str) + if err != nil { + t.Fatalf("Can't write to test file: %s", err.Error()) + } + + // Set package configuration + Configure("/tmp", "en_US", "default") + + // Test translations + tr := Get("My text") + if tr != "Translated text" { + t.Errorf("Expected 'Translated text' but got '%s'", tr) + } + + v := "Variable" + tr = Get("One with var: %s", v) + if tr != "This one is the singular: Variable" { + t.Errorf("Expected 'This one is the singular: Variable' but got '%s'", tr) + } + + // Test plural + tr = GetN("One with var: %s", "Several with vars: %s", 2, v) + if tr != "This one is the plural: Variable" { + t.Errorf("Expected 'This one is the plural: Variable' but got '%s'", tr) + } + + // Test context translations + tr = GetC("Some random in a context", "Ctx") + if tr != "Some random translation in a context" { + t.Errorf("Expected 'Some random translation in a context' but got '%s'", tr) + } + + v = "Variable" + tr = GetC("One with var: %s", "Ctx", v) + if tr != "This one is the singular in a Ctx context: Variable" { + t.Errorf("Expected 'This one is the singular in a Ctx context: Variable' but got '%s'", tr) + } + + tr = GetNC("One with var: %s", "Several with vars: %s", 19, "Ctx", v) + if tr != "This one is the plural in a Ctx context: Variable" { + t.Errorf("Expected 'This one is the plural in a Ctx context: Variable' but got '%s'", tr) + } +} + +func TestPackageRace(t *testing.T) { + // Set PO content + str := `# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + + ` + + // Create Locales directory on default location + dirname := path.Clean(library + string(os.PathSeparator) + "en_US") + err := os.MkdirAll(dirname, os.ModePerm) + if err != nil { + t.Fatalf("Can't create test directory: %s", err.Error()) + } + + // Write PO content to default domain file + filename := path.Clean(dirname + string(os.PathSeparator) + domain + ".po") + + f, err := os.Create(filename) + if err != nil { + t.Fatalf("Can't create test file: %s", err.Error()) + } + defer f.Close() + + _, err = f.WriteString(str) + if err != nil { + t.Fatalf("Can't write to test file: %s", err.Error()) + } + + // Init sync channels + c1 := make(chan bool) + c2 := make(chan bool) + + // Test translations + go func(done chan bool) { + Get("My text") + done <- true + }(c1) + + go func(done chan bool) { + Get("My text") + done <- true + }(c2) + + Get("My text") +} diff --git a/vendor/github.com/leonelquinteros/gotext/locale.go b/vendor/github.com/leonelquinteros/gotext/locale.go new file mode 100644 index 0000000000..1cb59b7a80 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/locale.go @@ -0,0 +1,176 @@ +package gotext + +import ( + "fmt" + "os" + "path" + "sync" +) + +/* +Locale wraps the entire i18n collection for a single language (locale) +It's used by the package functions, but it can also be used independently to handle +multiple languages at the same time by working with this object. + +Example: + + import "github.com/leonelquinteros/gotext" + + func main() { + // Create Locale with library path and language code + l := gotext.NewLocale("/path/to/i18n/dir", "en_US") + + // Load domain '/path/to/i18n/dir/en_US/LC_MESSAGES/default.po' + l.AddDomain("default") + + // Translate text from default domain + println(l.Get("Translate this")) + + // Load different domain ('/path/to/i18n/dir/en_US/LC_MESSAGES/extras.po') + l.AddDomain("extras") + + // Translate text from domain + println(l.GetD("extras", "Translate this")) + } + +*/ +type Locale struct { + // Path to locale files. + path string + + // Language for this Locale + lang string + + // List of available domains for this locale. + domains map[string]*Po + + // Sync Mutex + sync.RWMutex +} + +// NewLocale creates and initializes a new Locale object for a given language. +// It receives a path for the i18n files directory (p) and a language code to use (l). +func NewLocale(p, l string) *Locale { + return &Locale{ + path: p, + lang: l, + domains: make(map[string]*Po), + } +} + +func (l *Locale) findPO(dom string) string { + filename := path.Join(l.path, l.lang, "LC_MESSAGES", dom+".po") + if _, err := os.Stat(filename); err == nil { + return filename + } + + if len(l.lang) > 2 { + filename = path.Join(l.path, l.lang[:2], "LC_MESSAGES", dom+".po") + if _, err := os.Stat(filename); err == nil { + return filename + } + } + + filename = path.Join(l.path, l.lang, dom+".po") + if _, err := os.Stat(filename); err == nil { + return filename + } + + if len(l.lang) > 2 { + filename = path.Join(l.path, l.lang[:2], dom+".po") + } + + return filename +} + +// AddDomain creates a new domain for a given locale object and initializes the Po object. +// If the domain exists, it gets reloaded. +func (l *Locale) AddDomain(dom string) { + po := new(Po) + + // Parse file. + po.ParseFile(l.findPO(dom)) + + // Save new domain + l.Lock() + defer l.Unlock() + + if l.domains == nil { + l.domains = make(map[string]*Po) + } + l.domains[dom] = po +} + +// Get uses a domain "default" to return the corresponding translation of a given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) Get(str string, vars ...interface{}) string { + return l.GetD("default", str, vars...) +} + +// GetN retrieves the (N)th plural form of translation for the given string in the "default" domain. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetN(str, plural string, n int, vars ...interface{}) string { + return l.GetND("default", str, plural, n, vars...) +} + +// GetD returns the corresponding translation in the given domain for the given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetD(dom, str string, vars ...interface{}) string { + return l.GetND(dom, str, str, 1, vars...) +} + +// GetND retrieves the (N)th plural form of translation in the given domain for the given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetND(dom, str, plural string, n int, vars ...interface{}) string { + // Sync read + l.RLock() + defer l.RUnlock() + + if l.domains != nil { + if _, ok := l.domains[dom]; ok { + if l.domains[dom] != nil { + return l.domains[dom].GetN(str, plural, n, vars...) + } + } + } + + // Return the same we received by default + return fmt.Sprintf(plural, vars...) +} + +// GetC uses a domain "default" to return the corresponding translation of the given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetC(str, ctx string, vars ...interface{}) string { + return l.GetDC("default", str, ctx, vars...) +} + +// GetNC retrieves the (N)th plural form of translation for the given string in the given context in the "default" domain. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetNC(str, plural string, n int, ctx string, vars ...interface{}) string { + return l.GetNDC("default", str, plural, n, ctx, vars...) +} + +// GetDC returns the corresponding translation in the given domain for the given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetDC(dom, str, ctx string, vars ...interface{}) string { + return l.GetNDC(dom, str, str, 1, ctx, vars...) +} + +// GetNDC retrieves the (N)th plural form of translation in the given domain for the given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (l *Locale) GetNDC(dom, str, plural string, n int, ctx string, vars ...interface{}) string { + // Sync read + l.RLock() + defer l.RUnlock() + + if l.domains != nil { + if _, ok := l.domains[dom]; ok { + if l.domains[dom] != nil { + return l.domains[dom].GetNC(str, plural, n, ctx, vars...) + } + } + } + + // Return the same we received by default + return fmt.Sprintf(plural, vars...) +} diff --git a/vendor/github.com/leonelquinteros/gotext/locale_test.go b/vendor/github.com/leonelquinteros/gotext/locale_test.go new file mode 100644 index 0000000000..062b0bfc36 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/locale_test.go @@ -0,0 +1,310 @@ +package gotext + +import ( + "os" + "path" + "testing" +) + +func TestLocale(t *testing.T) { + // Set PO content + str := ` +msgid "" +msgstr "" +# Initial comment +# Headers below +"Language: en\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + +msgid "This one has invalid syntax translations" +msgid_plural "Plural index" +msgstr[abc] "Wrong index" +msgstr[1 "Forgot to close brackets" +msgstr[0] "Badly formatted string' + +msgid "Invalid formatted id[] with no translations + +msgctxt "Ctx" +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular in a Ctx context: %s" +msgstr[1] "This one is the plural in a Ctx context: %s" + +msgid "Some random" +msgstr "Some random translation" + +msgctxt "Ctx" +msgid "Some random in a context" +msgstr "Some random translation in a context" + +msgid "More" +msgstr "More translation" + + ` + + // Create Locales directory with simplified language code + dirname := path.Join("/tmp", "en", "LC_MESSAGES") + err := os.MkdirAll(dirname, os.ModePerm) + if err != nil { + t.Fatalf("Can't create test directory: %s", err.Error()) + } + + // Write PO content to file + filename := path.Join(dirname, "my_domain.po") + + f, err := os.Create(filename) + if err != nil { + t.Fatalf("Can't create test file: %s", err.Error()) + } + defer f.Close() + + _, err = f.WriteString(str) + if err != nil { + t.Fatalf("Can't write to test file: %s", err.Error()) + } + + // Create Locale with full language code + l := NewLocale("/tmp", "en_US") + + // Force nil domain storage + l.domains = nil + + // Add domain + l.AddDomain("my_domain") + + // Test translations + tr := l.GetD("my_domain", "My text") + if tr != "Translated text" { + t.Errorf("Expected 'Translated text' but got '%s'", tr) + } + + v := "Variable" + tr = l.GetD("my_domain", "One with var: %s", v) + if tr != "This one is the singular: Variable" { + t.Errorf("Expected 'This one is the singular: Variable' but got '%s'", tr) + } + + // Test plural + tr = l.GetND("my_domain", "One with var: %s", "Several with vars: %s", 7, v) + if tr != "This one is the plural: Variable" { + t.Errorf("Expected 'This one is the plural: Variable' but got '%s'", tr) + } + + // Test context translations + v = "Test" + tr = l.GetDC("my_domain", "One with var: %s", "Ctx", v) + if tr != "This one is the singular in a Ctx context: Test" { + t.Errorf("Expected 'This one is the singular in a Ctx context: Test' but got '%s'", tr) + } + + // Test plural + tr = l.GetNDC("my_domain", "One with var: %s", "Several with vars: %s", 3, "Ctx", v) + if tr != "This one is the plural in a Ctx context: Test" { + t.Errorf("Expected 'This one is the plural in a Ctx context: Test' but got '%s'", tr) + } + + // Test last translation + tr = l.GetD("my_domain", "More") + if tr != "More translation" { + t.Errorf("Expected 'More translation' but got '%s'", tr) + } +} + +func TestLocaleFails(t *testing.T) { + // Set PO content + str := ` +msgid "" +msgstr "" +# Initial comment +# Headers below +"Language: en\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + +msgid "This one has invalid syntax translations" +msgid_plural "Plural index" +msgstr[abc] "Wrong index" +msgstr[1 "Forgot to close brackets" +msgstr[0] "Badly formatted string' + +msgid "Invalid formatted id[] with no translations + +msgctxt "Ctx" +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular in a Ctx context: %s" +msgstr[1] "This one is the plural in a Ctx context: %s" + +msgid "Some random" +msgstr "Some random translation" + +msgctxt "Ctx" +msgid "Some random in a context" +msgstr "Some random translation in a context" + +msgid "More" +msgstr "More translation" + + ` + + // Create Locales directory with simplified language code + dirname := path.Join("/tmp", "en", "LC_MESSAGES") + err := os.MkdirAll(dirname, os.ModePerm) + if err != nil { + t.Fatalf("Can't create test directory: %s", err.Error()) + } + + // Write PO content to file + filename := path.Join(dirname, "my_domain.po") + + f, err := os.Create(filename) + if err != nil { + t.Fatalf("Can't create test file: %s", err.Error()) + } + defer f.Close() + + _, err = f.WriteString(str) + if err != nil { + t.Fatalf("Can't write to test file: %s", err.Error()) + } + + // Create Locale with full language code + l := NewLocale("/tmp", "en_US") + + // Force nil domain storage + l.domains = nil + + // Add domain + l.AddDomain("my_domain") + + // Test non-existent "deafult" domain responses + tr := l.Get("My text") + if tr != "My text" { + t.Errorf("Expected 'My text' but got '%s'", tr) + } + + v := "Variable" + tr = l.GetN("One with var: %s", "Several with vars: %s", 2, v) + if tr != "Several with vars: Variable" { + t.Errorf("Expected 'Several with vars: Variable' but got '%s'", tr) + } + + // Test inexistent translations + tr = l.Get("This is a test") + if tr != "This is a test" { + t.Errorf("Expected 'This is a test' but got '%s'", tr) + } + + tr = l.GetN("This is a test", "This are tests", 1) + if tr != "This are tests" { + t.Errorf("Expected 'This are tests' but got '%s'", tr) + } + + // Test syntax error parsed translations + tr = l.Get("This one has invalid syntax translations") + if tr != "This one has invalid syntax translations" { + t.Errorf("Expected 'This one has invalid syntax translations' but got '%s'", tr) + } + + tr = l.GetN("This one has invalid syntax translations", "This are tests", 1) + if tr != "This are tests" { + t.Errorf("Expected 'Plural index' but got '%s'", tr) + } +} + +func TestLocaleRace(t *testing.T) { + // Set PO content + str := `# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + + ` + + // Create Locales directory with simplified language code + dirname := path.Join("/tmp", "es") + err := os.MkdirAll(dirname, os.ModePerm) + if err != nil { + t.Fatalf("Can't create test directory: %s", err.Error()) + } + + // Write PO content to file + filename := path.Join(dirname, "race.po") + + f, err := os.Create(filename) + if err != nil { + t.Fatalf("Can't create test file: %s", err.Error()) + } + defer f.Close() + + _, err = f.WriteString(str) + if err != nil { + t.Fatalf("Can't write to test file: %s", err.Error()) + } + + // Create Locale with full language code + l := NewLocale("/tmp", "es") + + // Init sync channels + ac := make(chan bool) + rc := make(chan bool) + + // Add domain in goroutine + go func(l *Locale, done chan bool) { + l.AddDomain("race") + done <- true + }(l, ac) + + // Get translations in goroutine + go func(l *Locale, done chan bool) { + l.GetD("race", "My text") + done <- true + }(l, rc) + + // Get translations at top level + l.GetD("race", "My text") + + // Wait for goroutines to finish + <-ac + <-rc +} diff --git a/vendor/github.com/leonelquinteros/gotext/po.go b/vendor/github.com/leonelquinteros/gotext/po.go new file mode 100644 index 0000000000..57a818484a --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/po.go @@ -0,0 +1,450 @@ +package gotext + +import ( + "bufio" + "fmt" + "github.com/mattn/anko/vm" + "io/ioutil" + "net/textproto" + "os" + "strconv" + "strings" + "sync" +) + +type translation struct { + id string + pluralID string + trs map[int]string +} + +func newTranslation() *translation { + tr := new(translation) + tr.trs = make(map[int]string) + + return tr +} + +func (t *translation) get() string { + // Look for translation index 0 + if _, ok := t.trs[0]; ok { + return t.trs[0] + } + + // Return unstranlated id by default + return t.id +} + +func (t *translation) getN(n int) string { + // Look for translation index + if _, ok := t.trs[n]; ok { + return t.trs[n] + } + + // Return unstranlated plural by default + return t.pluralID +} + +/* +Po parses the content of any PO file and provides all the translation functions needed. +It's the base object used by all package methods. +And it's safe for concurrent use by multiple goroutines by using the sync package for locking. + +Example: + + import "github.com/leonelquinteros/gotext" + + func main() { + // Create po object + po := new(gotext.Po) + + // Parse .po file + po.ParseFile("/path/to/po/file/translations.po") + + // Get translation + println(po.Get("Translate this")) + } + +*/ +type Po struct { + // Headers + RawHeaders string + + // Language header + Language string + + // Plural-Forms header + PluralForms string + + // Parsed Plural-Forms header values + nplurals int + plural string + + // Storage + translations map[string]*translation + contexts map[string]map[string]*translation + + // Sync Mutex + sync.RWMutex + + // Parsing buffers + trBuffer *translation + ctxBuffer string +} + +// ParseFile tries to read the file by its provided path (f) and parse its content as a .po file. +func (po *Po) ParseFile(f string) { + // Check if file exists + info, err := os.Stat(f) + if err != nil { + return + } + + // Check that isn't a directory + if info.IsDir() { + return + } + + // Parse file content + data, err := ioutil.ReadFile(f) + if err != nil { + return + } + + po.Parse(string(data)) +} + +// Parse loads the translations specified in the provided string (str) +func (po *Po) Parse(str string) { + // Lock while parsing + po.Lock() + defer po.Unlock() + + // Init storage + if po.translations == nil { + po.translations = make(map[string]*translation) + po.contexts = make(map[string]map[string]*translation) + } + + // Get lines + lines := strings.Split(str, "\n") + + // Init buffer + po.trBuffer = newTranslation() + po.ctxBuffer = "" + + for _, l := range lines { + // Trim spaces + l = strings.TrimSpace(l) + + // Skip invalid lines + if !po.isValidLine(l) { + continue + } + + // Buffer context and continue + if strings.HasPrefix(l, "msgctxt") { + po.parseContext(l) + continue + } + + // Buffer msgid and continue + if strings.HasPrefix(l, "msgid") && !strings.HasPrefix(l, "msgid_plural") { + po.parseID(l) + continue + } + + // Check for plural form + if strings.HasPrefix(l, "msgid_plural") { + po.parsePluralID(l) + continue + } + + // Save translation + if strings.HasPrefix(l, "msgstr") { + po.parseMessage(l) + continue + } + + // Multi line strings and headers + if strings.HasPrefix(l, "\"") && strings.HasSuffix(l, "\"") { + po.parseString(l) + continue + } + } + + // Save last translation buffer. + po.saveBuffer() + + // Parse headers + po.parseHeaders() +} + +// saveBuffer takes the context and translation buffers +// and saves it on the translations collection +func (po *Po) saveBuffer() { + // If we have something to save... + if po.trBuffer.id != "" { + // With no context... + if po.ctxBuffer == "" { + po.translations[po.trBuffer.id] = po.trBuffer + } else { + // With context... + if _, ok := po.contexts[po.ctxBuffer]; !ok { + po.contexts[po.ctxBuffer] = make(map[string]*translation) + } + po.contexts[po.ctxBuffer][po.trBuffer.id] = po.trBuffer + } + + // Flush buffer + po.trBuffer = newTranslation() + po.ctxBuffer = "" + } +} + +// parseContext takes a line starting with "msgctxt", +// saves the current translation buffer and creates a new context. +func (po *Po) parseContext(l string) { + // Save current translation buffer. + po.saveBuffer() + + // Buffer context + po.ctxBuffer, _ = strconv.Unquote(strings.TrimSpace(strings.TrimPrefix(l, "msgctxt"))) +} + +// parseID takes a line starting with "msgid", +// saves the current translation and creates a new msgid buffer. +func (po *Po) parseID(l string) { + // Save current translation buffer. + po.saveBuffer() + + // Set id + po.trBuffer.id, _ = strconv.Unquote(strings.TrimSpace(strings.TrimPrefix(l, "msgid"))) +} + +// parsePluralID saves the plural id buffer from a line starting with "msgid_plural" +func (po *Po) parsePluralID(l string) { + po.trBuffer.pluralID, _ = strconv.Unquote(strings.TrimSpace(strings.TrimPrefix(l, "msgid_plural"))) +} + +// parseMessage takes a line starting with "msgstr" and saves it into the current buffer. +func (po *Po) parseMessage(l string) { + l = strings.TrimSpace(strings.TrimPrefix(l, "msgstr")) + + // Check for indexed translation forms + if strings.HasPrefix(l, "[") { + idx := strings.Index(l, "]") + if idx == -1 { + // Skip wrong index formatting + return + } + + // Parse index + i, err := strconv.Atoi(l[1:idx]) + if err != nil { + // Skip wrong index formatting + return + } + + // Parse translation string + po.trBuffer.trs[i], _ = strconv.Unquote(strings.TrimSpace(l[idx+1:])) + + // Loop + return + } + + // Save single translation form under 0 index + po.trBuffer.trs[0], _ = strconv.Unquote(l) +} + +// parseString takes a well formatted string without prefix +// and creates headers or attach multi-line strings when corresponding +func (po *Po) parseString(l string) { + // Check for multiline from previously set msgid + if po.trBuffer.id != "" { + // Append to last translation found + uq, _ := strconv.Unquote(l) + po.trBuffer.trs[len(po.trBuffer.trs)-1] += uq + + return + } + + // Otherwise is a header + h, err := strconv.Unquote(strings.TrimSpace(l)) + if err != nil { + return + } + + po.RawHeaders += h +} + +// isValidLine checks for line prefixes to detect valid syntax. +func (po *Po) isValidLine(l string) bool { + // Skip empty lines + if l == "" { + return false + } + + // Check prefix + if !strings.HasPrefix(l, "\"") && !strings.HasPrefix(l, "msgctxt") && !strings.HasPrefix(l, "msgid") && !strings.HasPrefix(l, "msgid_plural") && !strings.HasPrefix(l, "msgstr") { + return false + } + + return true +} + +// parseHeaders retrieves data from previously parsed headers +func (po *Po) parseHeaders() { + // Make sure we end with 2 carriage returns. + po.RawHeaders += "\n\n" + + // Read + reader := bufio.NewReader(strings.NewReader(po.RawHeaders)) + tp := textproto.NewReader(reader) + + mimeHeader, err := tp.ReadMIMEHeader() + if err != nil { + return + } + + // Get/save needed headers + po.Language = mimeHeader.Get("Language") + po.PluralForms = mimeHeader.Get("Plural-Forms") + + // Parse Plural-Forms formula + if po.PluralForms == "" { + return + } + + // Split plural form header value + pfs := strings.Split(po.PluralForms, ";") + + // Parse values + for _, i := range pfs { + vs := strings.SplitN(i, "=", 2) + if len(vs) != 2 { + continue + } + + switch strings.TrimSpace(vs[0]) { + case "nplurals": + po.nplurals, _ = strconv.Atoi(vs[1]) + + case "plural": + po.plural = vs[1] + } + } +} + +// pluralForm calculates the plural form index corresponding to n. +// Returns 0 on error +func (po *Po) pluralForm(n int) int { + po.RLock() + defer po.RUnlock() + + // Failsafe + if po.nplurals < 1 { + return 0 + } + if po.plural == "" { + return 0 + } + + // Init compiler + env := vm.NewEnv() + env.Define("n", n) + + plural, err := env.Execute(po.plural) + if err != nil { + return 0 + } + if plural.Type().Name() == "bool" { + if plural.Bool() { + return 1 + } + // Else + return 0 + } + + if int(plural.Int()) > po.nplurals { + return 0 + } + + return int(plural.Int()) +} + +// Get retrieves the corresponding translation for the given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (po *Po) Get(str string, vars ...interface{}) string { + // Sync read + po.RLock() + defer po.RUnlock() + + if po.translations != nil { + if _, ok := po.translations[str]; ok { + return fmt.Sprintf(po.translations[str].get(), vars...) + } + } + + // Return the same we received by default + return fmt.Sprintf(str, vars...) +} + +// GetN retrieves the (N)th plural form of translation for the given string. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (po *Po) GetN(str, plural string, n int, vars ...interface{}) string { + // Sync read + po.RLock() + defer po.RUnlock() + + if po.translations != nil { + if _, ok := po.translations[str]; ok { + return fmt.Sprintf(po.translations[str].getN(po.pluralForm(n)), vars...) + } + } + + // Return the plural string we received by default + return fmt.Sprintf(plural, vars...) +} + +// GetC retrieves the corresponding translation for a given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (po *Po) GetC(str, ctx string, vars ...interface{}) string { + // Sync read + po.RLock() + defer po.RUnlock() + + if po.contexts != nil { + if _, ok := po.contexts[ctx]; ok { + if po.contexts[ctx] != nil { + if _, ok := po.contexts[ctx][str]; ok { + return fmt.Sprintf(po.contexts[ctx][str].get(), vars...) + } + } + } + } + + // Return the string we received by default + return fmt.Sprintf(str, vars...) +} + +// GetNC retrieves the (N)th plural form of translation for the given string in the given context. +// Supports optional parameters (vars... interface{}) to be inserted on the formatted string using the fmt.Printf syntax. +func (po *Po) GetNC(str, plural string, n int, ctx string, vars ...interface{}) string { + // Sync read + po.RLock() + defer po.RUnlock() + + if po.contexts != nil { + if _, ok := po.contexts[ctx]; ok { + if po.contexts[ctx] != nil { + if _, ok := po.contexts[ctx][str]; ok { + return fmt.Sprintf(po.contexts[ctx][str].getN(po.pluralForm(n)), vars...) + } + } + } + } + + // Return the plural string we received by default + return fmt.Sprintf(plural, vars...) +} diff --git a/vendor/github.com/leonelquinteros/gotext/po_test.go b/vendor/github.com/leonelquinteros/gotext/po_test.go new file mode 100644 index 0000000000..9f59a33d22 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/po_test.go @@ -0,0 +1,424 @@ +package gotext + +import ( + "os" + "path" + "testing" +) + +func TestPo(t *testing.T) { + // Set PO content + str := ` +msgid "" +msgstr "" +# Initial comment +# Headers below +"Language: en\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +#Multi-line string +msgid "Multi-line" +msgstr "Multi " +"line" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + +msgid "This one has invalid syntax translations" +msgid_plural "Plural index" +msgstr[abc] "Wrong index" +msgstr[1 "Forgot to close brackets" +msgstr[0] "Badly formatted string' + +msgid "Invalid formatted id[] with no translations + +msgctxt "Ctx" +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular in a Ctx context: %s" +msgstr[1] "This one is the plural in a Ctx context: %s" + +msgid "Some random" +msgstr "Some random translation" + +msgctxt "Ctx" +msgid "Some random in a context" +msgstr "Some random translation in a context" + +msgid "More" +msgstr "More translation" + ` + + // Write PO content to file + filename := path.Clean(os.TempDir() + string(os.PathSeparator) + "default.po") + + f, err := os.Create(filename) + if err != nil { + t.Fatalf("Can't create test file: %s", err.Error()) + } + defer f.Close() + + _, err = f.WriteString(str) + if err != nil { + t.Fatalf("Can't write to test file: %s", err.Error()) + } + + // Create po object + po := new(Po) + + // Try to parse a directory + po.ParseFile(path.Clean(os.TempDir())) + + // Parse file + po.ParseFile(filename) + + // Test translations + tr := po.Get("My text") + if tr != "Translated text" { + t.Errorf("Expected 'Translated text' but got '%s'", tr) + } + + v := "Variable" + tr = po.Get("One with var: %s", v) + if tr != "This one is the singular: Variable" { + t.Errorf("Expected 'This one is the singular: Variable' but got '%s'", tr) + } + + // Test multi-line + tr = po.Get("Multi-line") + if tr != "Multi line" { + t.Errorf("Expected 'Multi line' but got '%s'", tr) + } + + // Test plural + tr = po.GetN("One with var: %s", "Several with vars: %s", 2, v) + if tr != "This one is the plural: Variable" { + t.Errorf("Expected 'This one is the plural: Variable' but got '%s'", tr) + } + + // Test inexistent translations + tr = po.Get("This is a test") + if tr != "This is a test" { + t.Errorf("Expected 'This is a test' but got '%s'", tr) + } + + tr = po.GetN("This is a test", "This are tests", 100) + if tr != "This are tests" { + t.Errorf("Expected 'This are tests' but got '%s'", tr) + } + + // Test syntax error parsed translations + tr = po.Get("This one has invalid syntax translations") + if tr != "" { + t.Errorf("Expected '' but got '%s'", tr) + } + + tr = po.GetN("This one has invalid syntax translations", "This are tests", 4) + if tr != "Plural index" { + t.Errorf("Expected 'Plural index' but got '%s'", tr) + } + + // Test context translations + v = "Test" + tr = po.GetC("One with var: %s", "Ctx", v) + if tr != "This one is the singular in a Ctx context: Test" { + t.Errorf("Expected 'This one is the singular in a Ctx context: Test' but got '%s'", tr) + } + + // Test plural + tr = po.GetNC("One with var: %s", "Several with vars: %s", 17, "Ctx", v) + if tr != "This one is the plural in a Ctx context: Test" { + t.Errorf("Expected 'This one is the plural in a Ctx context: Test' but got '%s'", tr) + } + + // Test last translation + tr = po.Get("More") + if tr != "More translation" { + t.Errorf("Expected 'More translation' but got '%s'", tr) + } + +} + +func TestPoHeaders(t *testing.T) { + // Set PO content + str := ` +msgid "" +msgstr "" +# Initial comment +# Headers below +"Language: en\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +# Some comment +msgid "Example" +msgstr "Translated example" + ` + + // Create po object + po := new(Po) + + // Parse + po.Parse(str) + + // Check headers expected + if po.Language != "en" { + t.Errorf("Expected 'Language: en' but got '%s'", po.Language) + } + + // Check headers expected + if po.PluralForms != "nplurals=2; plural=(n != 1);" { + t.Errorf("Expected 'Plural-Forms: nplurals=2; plural=(n != 1);' but got '%s'", po.PluralForms) + } +} + +func TestPluralFormsSingle(t *testing.T) { + // Single form + str := ` +"Plural-Forms: nplurals=1; plural=0;" + +# Some comment +msgid "Singular" +msgid_plural "Plural" +msgstr[0] "Singular form" +msgstr[1] "Plural form 1" +msgstr[2] "Plural form 2" +msgstr[3] "Plural form 3" + ` + + // Create po object + po := new(Po) + + // Parse + po.Parse(str) + + // Check plural form + n := po.pluralForm(0) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(0), got %d", n) + } + n = po.pluralForm(1) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(1), got %d", n) + } + n = po.pluralForm(2) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(2), got %d", n) + } + n = po.pluralForm(3) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(3), got %d", n) + } + n = po.pluralForm(50) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(50), got %d", n) + } +} + +func TestPluralForms2(t *testing.T) { + // 2 forms + str := ` +"Plural-Forms: nplurals=2; plural=n != 1;" + +# Some comment +msgid "Singular" +msgid_plural "Plural" +msgstr[0] "Singular form" +msgstr[1] "Plural form 1" +msgstr[2] "Plural form 2" +msgstr[3] "Plural form 3" + ` + + // Create po object + po := new(Po) + + // Parse + po.Parse(str) + + // Check plural form + n := po.pluralForm(0) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(0), got %d", n) + } + n = po.pluralForm(1) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(1), got %d", n) + } + n = po.pluralForm(2) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(2), got %d", n) + } + n = po.pluralForm(3) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(3), got %d", n) + } +} + +func TestPluralForms3(t *testing.T) { + // 3 forms + str := ` +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;" + +# Some comment +msgid "Singular" +msgid_plural "Plural" +msgstr[0] "Singular form" +msgstr[1] "Plural form 1" +msgstr[2] "Plural form 2" +msgstr[3] "Plural form 3" + ` + + // Create po object + po := new(Po) + + // Parse + po.Parse(str) + + // Check plural form + n := po.pluralForm(0) + if n != 2 { + t.Errorf("Expected 2 for pluralForm(0), got %d", n) + } + n = po.pluralForm(1) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(1), got %d", n) + } + n = po.pluralForm(2) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(2), got %d", n) + } + n = po.pluralForm(3) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(3), got %d", n) + } + n = po.pluralForm(100) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(100), got %d", n) + } + n = po.pluralForm(49) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(3), got %d", n) + } +} + +func TestPluralFormsSpecial(t *testing.T) { + // 3 forms special + str := ` +"Plural-Forms: nplurals=3;" +"plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;" + +# Some comment +msgid "Singular" +msgid_plural "Plural" +msgstr[0] "Singular form" +msgstr[1] "Plural form 1" +msgstr[2] "Plural form 2" +msgstr[3] "Plural form 3" + ` + + // Create po object + po := new(Po) + + // Parse + po.Parse(str) + + // Check plural form + n := po.pluralForm(1) + if n != 0 { + t.Errorf("Expected 0 for pluralForm(1), got %d", n) + } + n = po.pluralForm(2) + if n != 1 { + t.Errorf("Expected 1 for pluralForm(2), got %d", n) + } + n = po.pluralForm(4) + if n != 1 { + t.Errorf("Expected 4 for pluralForm(4), got %d", n) + } + n = po.pluralForm(0) + if n != 2 { + t.Errorf("Expected 2 for pluralForm(2), got %d", n) + } + n = po.pluralForm(1000) + if n != 2 { + t.Errorf("Expected 2 for pluralForm(1000), got %d", n) + } +} + +func TestTranslationObject(t *testing.T) { + tr := newTranslation() + str := tr.get() + + if str != "" { + t.Errorf("Expected '' but got '%s'", str) + } + + // Set id + tr.id = "Text" + + // Get again + str = tr.get() + + if str != "Text" { + t.Errorf("Expected 'Text' but got '%s'", str) + } +} + +func TestPoRace(t *testing.T) { + // Set PO content + str := `# Some comment +msgid "My text" +msgstr "Translated text" + +# More comments +msgid "Another string" +msgstr "" + +msgid "One with var: %s" +msgid_plural "Several with vars: %s" +msgstr[0] "This one is the singular: %s" +msgstr[1] "This one is the plural: %s" +msgstr[2] "And this is the second plural form: %s" + + ` + + // Create Po object + po := new(Po) + + // Create sync channels + pc := make(chan bool) + rc := make(chan bool) + + // Parse po content in a goroutine + go func(po *Po, done chan bool) { + po.Parse(str) + done <- true + }(po, pc) + + // Read some translation on a goroutine + go func(po *Po, done chan bool) { + po.Get("My text") + done <- true + }(po, rc) + + // Read something at top level + po.Get("My text") + + // Wait for goroutines to finish + <-pc + <-rc +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/doc.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/doc.go new file mode 100644 index 0000000000..8781cfc7d9 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/doc.go @@ -0,0 +1,2 @@ +// Package ast implements abstruct-syntax-tree for anko. +package ast diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/expr.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/expr.go new file mode 100644 index 0000000000..c43aac6dd5 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/expr.go @@ -0,0 +1,201 @@ +package ast + +// Expr provides all of interfaces for expression. +type Expr interface { + Pos + expr() +} + +// ExprImpl provide commonly implementations for Expr. +type ExprImpl struct { + PosImpl // ExprImpl provide Pos() function. +} + +// expr provide restraint interface. +func (x *ExprImpl) expr() {} + +// NumberExpr provide Number expression. +type NumberExpr struct { + ExprImpl + Lit string +} + +// StringExpr provide String expression. +type StringExpr struct { + ExprImpl + Lit string +} + +// ArrayExpr provide Array expression. +type ArrayExpr struct { + ExprImpl + Exprs []Expr +} + +// PairExpr provide one of Map key/value pair. +type PairExpr struct { + ExprImpl + Key string + Value Expr +} + +// MapExpr provide Map expression. +type MapExpr struct { + ExprImpl + MapExpr map[string]Expr +} + +// IdentExpr provide identity expression. +type IdentExpr struct { + ExprImpl + Lit string +} + +// UnaryExpr provide unary minus expression. ex: -1, ^1, ~1. +type UnaryExpr struct { + ExprImpl + Operator string + Expr Expr +} + +// AddrExpr provide referencing address expression. +type AddrExpr struct { + ExprImpl + Expr Expr +} + +// DerefExpr provide dereferencing address expression. +type DerefExpr struct { + ExprImpl + Expr Expr +} + +// ParenExpr provide parent block expression. +type ParenExpr struct { + ExprImpl + SubExpr Expr +} + +// BinOpExpr provide binary operator expression. +type BinOpExpr struct { + ExprImpl + Lhs Expr + Operator string + Rhs Expr +} + +type TernaryOpExpr struct { + ExprImpl + Expr Expr + Lhs Expr + Rhs Expr +} + +// CallExpr provide calling expression. +type CallExpr struct { + ExprImpl + Func interface{} + Name string + SubExprs []Expr + VarArg bool + Go bool +} + +// AnonCallExpr provide anonymous calling expression. ex: func(){}(). +type AnonCallExpr struct { + ExprImpl + Expr Expr + SubExprs []Expr + VarArg bool + Go bool +} + +// MemberExpr provide expression to refer menber. +type MemberExpr struct { + ExprImpl + Expr Expr + Name string +} + +// ItemExpr provide expression to refer Map/Array item. +type ItemExpr struct { + ExprImpl + Value Expr + Index Expr +} + +// SliceExpr provide expression to refer slice of Array. +type SliceExpr struct { + ExprImpl + Value Expr + Begin Expr + End Expr +} + +// FuncExpr provide function expression. +type FuncExpr struct { + ExprImpl + Name string + Stmts []Stmt + Args []string + VarArg bool +} + +// LetExpr provide expression to let variable. +type LetExpr struct { + ExprImpl + Lhs Expr + Rhs Expr +} + +// LetsExpr provide multiple expression of let. +type LetsExpr struct { + ExprImpl + Lhss []Expr + Operator string + Rhss []Expr +} + +// AssocExpr provide expression to assoc operation. +type AssocExpr struct { + ExprImpl + Lhs Expr + Operator string + Rhs Expr +} + +// NewExpr provide expression to make new instance. +type NewExpr struct { + ExprImpl + Name string + SubExprs []Expr +} + +// ConstExpr provide expression for constant variable. +type ConstExpr struct { + ExprImpl + Value string +} + +type ChanExpr struct { + ExprImpl + Lhs Expr + Rhs Expr +} + +type Type struct { + Name string +} + +type MakeChanExpr struct { + ExprImpl + Type string + SizeExpr Expr +} + +type MakeArrayExpr struct { + ExprImpl + Type string + LenExpr Expr + CapExpr Expr +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/pos.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/pos.go new file mode 100644 index 0000000000..5a0e470d92 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/pos.go @@ -0,0 +1,28 @@ +package ast + +// Position provides interface to store code locations. +type Position struct { + Line int + Column int +} + +// Pos interface provies two functions to get/set the position for expression or statement. +type Pos interface { + Position() Position + SetPosition(Position) +} + +// PosImpl provies commonly implementations for Pos. +type PosImpl struct { + pos Position +} + +// Position return the position of the expression or statement. +func (x *PosImpl) Position() Position { + return x.pos +} + +// SetPosition is a function to specify position of the expression or statement. +func (x *PosImpl) SetPosition(pos Position) { + x.pos = pos +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/stmt.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/stmt.go new file mode 100644 index 0000000000..14bbdf7174 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/stmt.go @@ -0,0 +1,127 @@ +package ast + +// Stmt provides all of interfaces for statement. +type Stmt interface { + Pos + stmt() +} + +// StmtImpl provide commonly implementations for Stmt.. +type StmtImpl struct { + PosImpl // StmtImpl provide Pos() function. +} + +// stmt provide restraint interface. +func (x *StmtImpl) stmt() {} + +// ExprStmt provide expression statement. +type ExprStmt struct { + StmtImpl + Expr Expr +} + +// IfStmt provide "if/else" statement. +type IfStmt struct { + StmtImpl + If Expr + Then []Stmt + ElseIf []Stmt // This is array of IfStmt + Else []Stmt +} + +// TryStmt provide "try/catch/finally" statement. +type TryStmt struct { + StmtImpl + Try []Stmt + Var string + Catch []Stmt + Finally []Stmt +} + +// ForStmt provide "for in" expression statement. +type ForStmt struct { + StmtImpl + Var string + Value Expr + Stmts []Stmt +} + +// CForStmt provide C-style "for (;;)" expression statement. +type CForStmt struct { + StmtImpl + Expr1 Expr + Expr2 Expr + Expr3 Expr + Stmts []Stmt +} + +// LoopStmt provide "for expr" expression statement. +type LoopStmt struct { + StmtImpl + Expr Expr + Stmts []Stmt +} + +// BreakStmt provide "break" expression statement. +type BreakStmt struct { + StmtImpl +} + +// ContinueStmt provide "continue" expression statement. +type ContinueStmt struct { + StmtImpl +} + +// ForStmt provide "return" expression statement. +type ReturnStmt struct { + StmtImpl + Exprs []Expr +} + +// ThrowStmt provide "throw" expression statement. +type ThrowStmt struct { + StmtImpl + Expr Expr +} + +// ModuleStmt provide "module" expression statement. +type ModuleStmt struct { + StmtImpl + Name string + Stmts []Stmt +} + +// VarStmt provide statement to let variables in current scope. +type VarStmt struct { + StmtImpl + Names []string + Exprs []Expr +} + +// SwitchStmt provide switch statement. +type SwitchStmt struct { + StmtImpl + Expr Expr + Cases []Stmt +} + +// CaseStmt provide switch/case statement. +type CaseStmt struct { + StmtImpl + Expr Expr + Stmts []Stmt +} + +// DefaultStmt provide switch/default statement. +type DefaultStmt struct { + StmtImpl + Stmts []Stmt +} + +// LetsStmt provide multiple statement of let. +type LetsStmt struct { + StmtImpl + Lhss []Expr + Operator string + Rhss []Expr +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/token.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/token.go new file mode 100644 index 0000000000..6b47cd0544 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/ast/token.go @@ -0,0 +1,7 @@ +package ast + +type Token struct { + PosImpl // StmtImpl provide Pos() function. + Tok int + Lit string +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/Makefile b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/Makefile new file mode 100644 index 0000000000..8b33e31724 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/Makefile @@ -0,0 +1,4 @@ +all : parser.go + +parser.go : parser.go.y + go tool yacc -o $@ parser.go.y diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/lexer.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/lexer.go new file mode 100644 index 0000000000..ea0fc49300 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/lexer.go @@ -0,0 +1,530 @@ +// Package parser implements parser for anko. +package parser + +import ( + "errors" + "fmt" + + "github.com/mattn/anko/ast" +) + +const ( + EOF = -1 // End of file. + EOL = '\n' // End of line. +) + +// Error provides a convenient interface for handling runtime error. +// It can be Error inteface with type cast which can call Pos(). +type Error struct { + Message string + Pos ast.Position + Filename string + Fatal bool +} + +// Error returns the error message. +func (e *Error) Error() string { + return e.Message +} + +// Scanner stores informations for lexer. +type Scanner struct { + src []rune + offset int + lineHead int + line int +} + +// opName is correction of operation names. +var opName = map[string]int{ + "func": FUNC, + "return": RETURN, + "var": VAR, + "throw": THROW, + "if": IF, + "for": FOR, + "break": BREAK, + "continue": CONTINUE, + "in": IN, + "else": ELSE, + "new": NEW, + "true": TRUE, + "false": FALSE, + "nil": NIL, + "module": MODULE, + "try": TRY, + "catch": CATCH, + "finally": FINALLY, + "switch": SWITCH, + "case": CASE, + "default": DEFAULT, + "go": GO, + "chan": CHAN, + "make": MAKE, +} + +// Init resets code to scan. +func (s *Scanner) Init(src string) { + s.src = []rune(src) +} + +// Scan analyses token, and decide identify or literals. +func (s *Scanner) Scan() (tok int, lit string, pos ast.Position, err error) { +retry: + s.skipBlank() + pos = s.pos() + switch ch := s.peek(); { + case isLetter(ch): + lit, err = s.scanIdentifier() + if err != nil { + return + } + if name, ok := opName[lit]; ok { + tok = name + } else { + tok = IDENT + } + case isDigit(ch): + tok = NUMBER + lit, err = s.scanNumber() + if err != nil { + return + } + case ch == '"': + tok = STRING + lit, err = s.scanString('"') + if err != nil { + return + } + case ch == '\'': + tok = STRING + lit, err = s.scanString('\'') + if err != nil { + return + } + case ch == '`': + tok = STRING + lit, err = s.scanRawString() + if err != nil { + return + } + default: + switch ch { + case EOF: + tok = EOF + case '#': + for !isEOL(s.peek()) { + s.next() + } + goto retry + case '!': + s.next() + switch s.peek() { + case '=': + tok = NEQ + lit = "!=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '=': + s.next() + switch s.peek() { + case '=': + tok = EQEQ + lit = "==" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '+': + s.next() + switch s.peek() { + case '+': + tok = PLUSPLUS + lit = "++" + case '=': + tok = PLUSEQ + lit = "+=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '-': + s.next() + switch s.peek() { + case '-': + tok = MINUSMINUS + lit = "--" + case '=': + tok = MINUSEQ + lit = "-=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '*': + s.next() + switch s.peek() { + case '*': + tok = POW + lit = "**" + case '=': + tok = MULEQ + lit = "*=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '/': + s.next() + switch s.peek() { + case '=': + tok = DIVEQ + lit = "/=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '>': + s.next() + switch s.peek() { + case '=': + tok = GE + lit = ">=" + case '>': + tok = SHIFTRIGHT + lit = ">>" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '<': + s.next() + switch s.peek() { + case '-': + tok = OPCHAN + lit = "<-" + case '=': + tok = LE + lit = "<=" + case '<': + tok = SHIFTLEFT + lit = "<<" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '|': + s.next() + switch s.peek() { + case '|': + tok = OROR + lit = "||" + case '=': + tok = OREQ + lit = "|=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '&': + s.next() + switch s.peek() { + case '&': + tok = ANDAND + lit = "&&" + case '=': + tok = ANDEQ + lit = "&=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '.': + s.next() + if s.peek() == '.' { + s.next() + if s.peek() == '.' { + tok = VARARG + } else { + err = fmt.Errorf(`syntax error "%s"`, "..") + return + } + } else { + s.back() + tok = int(ch) + lit = string(ch) + } + case '(', ')', ':', ';', '%', '?', '{', '}', ',', '[', ']', '^', '\n': + s.next() + if ch == '[' && s.peek() == ']' { + s.next() + if isLetter(s.peek()) { + s.back() + tok = ARRAYLIT + lit = "[]" + } else { + s.back() + s.back() + tok = int(ch) + lit = string(ch) + } + } else { + s.back() + tok = int(ch) + lit = string(ch) + } + default: + err = fmt.Errorf(`syntax error "%s"`, string(ch)) + return + } + s.next() + } + return +} + +// isLetter returns true if the rune is a letter for identity. +func isLetter(ch rune) bool { + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' +} + +// isDigit returns true if the rune is a number. +func isDigit(ch rune) bool { + return '0' <= ch && ch <= '9' +} + +// isHex returns true if the rune is a hex digits. +func isHex(ch rune) bool { + return ('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') +} + +// isEOL returns true if the rune is at end-of-line or end-of-file. +func isEOL(ch rune) bool { + return ch == '\n' || ch == -1 +} + +// isBlank returns true if the rune is empty character.. +func isBlank(ch rune) bool { + return ch == ' ' || ch == '\t' || ch == '\r' +} + +// peek returns current rune in the code. +func (s *Scanner) peek() rune { + if s.reachEOF() { + return EOF + } + return s.src[s.offset] +} + +// next moves offset to next. +func (s *Scanner) next() { + if !s.reachEOF() { + if s.peek() == '\n' { + s.lineHead = s.offset + 1 + s.line++ + } + s.offset++ + } +} + +// current returns the current offset. +func (s *Scanner) current() int { + return s.offset +} + +// offset sets the offset value. +func (s *Scanner) set(o int) { + s.offset = o +} + +// back moves back offset once to top. +func (s *Scanner) back() { + s.offset-- +} + +// reachEOF returns true if offset is at end-of-file. +func (s *Scanner) reachEOF() bool { + return len(s.src) <= s.offset +} + +// pos returns the position of current. +func (s *Scanner) pos() ast.Position { + return ast.Position{Line: s.line + 1, Column: s.offset - s.lineHead + 1} +} + +// skipBlank moves position into non-black character. +func (s *Scanner) skipBlank() { + for isBlank(s.peek()) { + s.next() + } +} + +// scanIdentifier returns identifier begining at current position. +func (s *Scanner) scanIdentifier() (string, error) { + var ret []rune + for { + if !isLetter(s.peek()) && !isDigit(s.peek()) { + break + } + ret = append(ret, s.peek()) + s.next() + } + return string(ret), nil +} + +// scanNumber returns number begining at current position. +func (s *Scanner) scanNumber() (string, error) { + var ret []rune + ch := s.peek() + ret = append(ret, ch) + s.next() + if ch == '0' && s.peek() == 'x' { + ret = append(ret, s.peek()) + s.next() + for isHex(s.peek()) { + ret = append(ret, s.peek()) + s.next() + } + } else { + for isDigit(s.peek()) || s.peek() == '.' { + ret = append(ret, s.peek()) + s.next() + } + if s.peek() == 'e' { + ret = append(ret, s.peek()) + s.next() + if isDigit(s.peek()) || s.peek() == '+' || s.peek() == '-' { + ret = append(ret, s.peek()) + s.next() + for isDigit(s.peek()) || s.peek() == '.' { + ret = append(ret, s.peek()) + s.next() + } + } + for isDigit(s.peek()) || s.peek() == '.' { + ret = append(ret, s.peek()) + s.next() + } + } + if isLetter(s.peek()) { + return "", errors.New("identifier starts immediately after numeric literal") + } + } + return string(ret), nil +} + +// scanRawString returns raw-string starting at current position. +func (s *Scanner) scanRawString() (string, error) { + var ret []rune + for { + s.next() + if s.peek() == EOF { + return "", errors.New("unexpected EOF") + break + } + if s.peek() == '`' { + s.next() + break + } + ret = append(ret, s.peek()) + } + return string(ret), nil +} + +// scanString returns string starting at current position. +// This handles backslash escaping. +func (s *Scanner) scanString(l rune) (string, error) { + var ret []rune +eos: + for { + s.next() + switch s.peek() { + case EOL: + return "", errors.New("unexpected EOL") + case EOF: + return "", errors.New("unexpected EOF") + case l: + s.next() + break eos + case '\\': + s.next() + switch s.peek() { + case 'b': + ret = append(ret, '\b') + continue + case 'f': + ret = append(ret, '\f') + continue + case 'r': + ret = append(ret, '\r') + continue + case 'n': + ret = append(ret, '\n') + continue + case 't': + ret = append(ret, '\t') + continue + } + ret = append(ret, s.peek()) + continue + default: + ret = append(ret, s.peek()) + } + } + return string(ret), nil +} + +// Lexer provides inteface to parse codes. +type Lexer struct { + s *Scanner + lit string + pos ast.Position + e error + stmts []ast.Stmt +} + +// Lex scans the token and literals. +func (l *Lexer) Lex(lval *yySymType) int { + tok, lit, pos, err := l.s.Scan() + if err != nil { + l.e = &Error{Message: fmt.Sprintf("%s", err.Error()), Pos: pos, Fatal: true} + } + lval.tok = ast.Token{Tok: tok, Lit: lit} + lval.tok.SetPosition(pos) + l.lit = lit + l.pos = pos + return tok +} + +// Error sets parse error. +func (l *Lexer) Error(msg string) { + l.e = &Error{Message: msg, Pos: l.pos, Fatal: false} +} + +// Parser provides way to parse the code using Scanner. +func Parse(s *Scanner) ([]ast.Stmt, error) { + l := Lexer{s: s} + if yyParse(&l) != 0 { + return nil, l.e + } + return l.stmts, l.e +} + +// ParserSrc provides way to parse the code from source. +func ParseSrc(src string) ([]ast.Stmt, error) { + scanner := &Scanner{ + src: []rune(src), + } + return Parse(scanner) +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go new file mode 100644 index 0000000000..01f5adf689 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go @@ -0,0 +1,1997 @@ +//line parser.go.y:2 +package parser + +import __yyfmt__ "fmt" + +//line parser.go.y:2 +import ( + "github.com/mattn/anko/ast" +) + +//line parser.go.y:26 +type yySymType struct { + yys int + compstmt []ast.Stmt + stmt_if ast.Stmt + stmt_default ast.Stmt + stmt_case ast.Stmt + stmt_cases []ast.Stmt + stmts []ast.Stmt + stmt ast.Stmt + typ ast.Type + expr ast.Expr + exprs []ast.Expr + expr_many []ast.Expr + expr_lets ast.Expr + expr_pair ast.Expr + expr_pairs []ast.Expr + expr_idents []string + tok ast.Token + term ast.Token + terms ast.Token + opt_terms ast.Token +} + +const IDENT = 57346 +const NUMBER = 57347 +const STRING = 57348 +const ARRAY = 57349 +const VARARG = 57350 +const FUNC = 57351 +const RETURN = 57352 +const VAR = 57353 +const THROW = 57354 +const IF = 57355 +const ELSE = 57356 +const FOR = 57357 +const IN = 57358 +const EQEQ = 57359 +const NEQ = 57360 +const GE = 57361 +const LE = 57362 +const OROR = 57363 +const ANDAND = 57364 +const NEW = 57365 +const TRUE = 57366 +const FALSE = 57367 +const NIL = 57368 +const MODULE = 57369 +const TRY = 57370 +const CATCH = 57371 +const FINALLY = 57372 +const PLUSEQ = 57373 +const MINUSEQ = 57374 +const MULEQ = 57375 +const DIVEQ = 57376 +const ANDEQ = 57377 +const OREQ = 57378 +const BREAK = 57379 +const CONTINUE = 57380 +const PLUSPLUS = 57381 +const MINUSMINUS = 57382 +const POW = 57383 +const SHIFTLEFT = 57384 +const SHIFTRIGHT = 57385 +const SWITCH = 57386 +const CASE = 57387 +const DEFAULT = 57388 +const GO = 57389 +const CHAN = 57390 +const MAKE = 57391 +const OPCHAN = 57392 +const ARRAYLIT = 57393 +const UNARY = 57394 + +var yyToknames = [...]string{ + "$end", + "error", + "$unk", + "IDENT", + "NUMBER", + "STRING", + "ARRAY", + "VARARG", + "FUNC", + "RETURN", + "VAR", + "THROW", + "IF", + "ELSE", + "FOR", + "IN", + "EQEQ", + "NEQ", + "GE", + "LE", + "OROR", + "ANDAND", + "NEW", + "TRUE", + "FALSE", + "NIL", + "MODULE", + "TRY", + "CATCH", + "FINALLY", + "PLUSEQ", + "MINUSEQ", + "MULEQ", + "DIVEQ", + "ANDEQ", + "OREQ", + "BREAK", + "CONTINUE", + "PLUSPLUS", + "MINUSMINUS", + "POW", + "SHIFTLEFT", + "SHIFTRIGHT", + "SWITCH", + "CASE", + "DEFAULT", + "GO", + "CHAN", + "MAKE", + "OPCHAN", + "ARRAYLIT", + "'='", + "'?'", + "':'", + "','", + "'>'", + "'<'", + "'+'", + "'-'", + "'*'", + "'/'", + "'%'", + "UNARY", + "'{'", + "'}'", + "';'", + "'.'", + "'!'", + "'^'", + "'&'", + "'('", + "')'", + "'['", + "']'", + "'|'", + "'\\n'", +} +var yyStatenames = [...]string{} + +const yyEofCode = 1 +const yyErrCode = 2 +const yyInitialStackSize = 16 + +//line parser.go.y:705 + +//line yacctab:1 +var yyExca = [...]int{ + -1, 0, + 1, 3, + -2, 121, + -1, 1, + 1, -1, + -2, 0, + -1, 2, + 55, 48, + -2, 1, + -1, 10, + 55, 49, + -2, 24, + -1, 43, + 55, 48, + -2, 122, + -1, 85, + 65, 3, + -2, 121, + -1, 88, + 55, 49, + -2, 43, + -1, 90, + 65, 3, + -2, 121, + -1, 97, + 1, 57, + 8, 57, + 45, 57, + 46, 57, + 52, 57, + 54, 57, + 55, 57, + 64, 57, + 65, 57, + 66, 57, + 72, 57, + 74, 57, + 76, 57, + -2, 52, + -1, 99, + 1, 59, + 8, 59, + 45, 59, + 46, 59, + 52, 59, + 54, 59, + 55, 59, + 64, 59, + 65, 59, + 66, 59, + 72, 59, + 74, 59, + 76, 59, + -2, 52, + -1, 127, + 17, 0, + 18, 0, + -2, 85, + -1, 128, + 17, 0, + 18, 0, + -2, 86, + -1, 147, + 55, 49, + -2, 43, + -1, 149, + 65, 3, + -2, 121, + -1, 151, + 65, 3, + -2, 121, + -1, 153, + 65, 1, + -2, 36, + -1, 156, + 65, 3, + -2, 121, + -1, 178, + 65, 3, + -2, 121, + -1, 220, + 55, 50, + -2, 44, + -1, 221, + 1, 45, + 45, 45, + 46, 45, + 52, 45, + 55, 51, + 65, 45, + 66, 45, + 76, 45, + -2, 52, + -1, 228, + 1, 51, + 8, 51, + 45, 51, + 46, 51, + 55, 51, + 65, 51, + 66, 51, + 72, 51, + 74, 51, + 76, 51, + -2, 52, + -1, 230, + 65, 3, + -2, 121, + -1, 232, + 65, 3, + -2, 121, + -1, 245, + 65, 3, + -2, 121, + -1, 256, + 1, 106, + 8, 106, + 45, 106, + 46, 106, + 52, 106, + 54, 106, + 55, 106, + 64, 106, + 65, 106, + 66, 106, + 72, 106, + 74, 106, + 76, 106, + -2, 104, + -1, 258, + 1, 110, + 8, 110, + 45, 110, + 46, 110, + 52, 110, + 54, 110, + 55, 110, + 64, 110, + 65, 110, + 66, 110, + 72, 110, + 74, 110, + 76, 110, + -2, 108, + -1, 269, + 65, 3, + -2, 121, + -1, 274, + 65, 3, + -2, 121, + -1, 275, + 65, 3, + -2, 121, + -1, 280, + 1, 105, + 8, 105, + 45, 105, + 46, 105, + 52, 105, + 54, 105, + 55, 105, + 64, 105, + 65, 105, + 66, 105, + 72, 105, + 74, 105, + 76, 105, + -2, 103, + -1, 281, + 1, 109, + 8, 109, + 45, 109, + 46, 109, + 52, 109, + 54, 109, + 55, 109, + 64, 109, + 65, 109, + 66, 109, + 72, 109, + 74, 109, + 76, 109, + -2, 107, + -1, 287, + 65, 3, + -2, 121, + -1, 288, + 65, 3, + -2, 121, + -1, 291, + 45, 3, + 46, 3, + 65, 3, + -2, 121, + -1, 295, + 65, 3, + -2, 121, + -1, 302, + 45, 3, + 46, 3, + 65, 3, + -2, 121, + -1, 315, + 65, 3, + -2, 121, + -1, 316, + 65, 3, + -2, 121, +} + +const yyNprod = 127 +const yyPrivate = 57344 + +var yyTokenNames []string +var yyStates []string + +const yyLast = 2223 + +var yyAct = [...]int{ + + 81, 169, 237, 10, 217, 238, 45, 6, 92, 211, + 93, 2, 1, 250, 281, 42, 82, 7, 209, 88, + 6, 91, 280, 276, 94, 95, 96, 98, 100, 6, + 7, 11, 40, 154, 246, 173, 105, 93, 108, 7, + 110, 243, 112, 225, 10, 103, 104, 80, 116, 117, + 89, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 102, 172, 139, 140, 141, 142, 166, 144, 145, + 147, 257, 64, 65, 66, 67, 68, 69, 92, 109, + 93, 155, 55, 261, 161, 255, 148, 153, 152, 115, + 115, 78, 199, 158, 320, 259, 182, 262, 164, 143, + 260, 146, 319, 254, 312, 147, 247, 205, 49, 259, + 309, 74, 76, 177, 77, 160, 72, 180, 148, 170, + 239, 240, 268, 308, 305, 304, 167, 301, 101, 292, + 286, 285, 148, 263, 252, 258, 179, 234, 231, 148, + 236, 188, 316, 148, 10, 192, 193, 229, 147, 256, + 186, 196, 187, 315, 189, 190, 200, 150, 295, 194, + 183, 198, 288, 207, 275, 274, 245, 149, 220, 210, + 212, 219, 224, 90, 148, 111, 226, 227, 279, 195, + 114, 222, 269, 115, 271, 213, 175, 157, 79, 176, + 8, 241, 314, 244, 242, 214, 215, 216, 239, 240, + 5, 310, 235, 84, 253, 44, 248, 206, 151, 170, + 282, 249, 223, 251, 218, 208, 204, 203, 165, 118, + 106, 83, 46, 4, 267, 168, 87, 43, 197, 17, + 270, 3, 0, 265, 113, 266, 0, 0, 0, 0, + 227, 0, 0, 278, 44, 61, 63, 0, 273, 0, + 0, 0, 283, 284, 0, 0, 0, 64, 65, 66, + 67, 68, 69, 0, 0, 70, 71, 55, 56, 57, + 0, 0, 289, 291, 0, 0, 78, 293, 294, 0, + 0, 0, 60, 62, 50, 51, 52, 53, 54, 307, + 299, 300, 302, 49, 303, 0, 74, 76, 306, 77, + 0, 72, 0, 0, 0, 311, 58, 59, 61, 63, + 73, 75, 0, 0, 0, 0, 0, 0, 317, 318, + 64, 65, 66, 67, 68, 69, 0, 0, 70, 71, + 55, 56, 57, 0, 0, 0, 0, 0, 0, 78, + 0, 0, 48, 0, 298, 60, 62, 50, 51, 52, + 53, 54, 0, 0, 0, 0, 49, 0, 0, 74, + 76, 297, 77, 0, 72, 58, 59, 61, 63, 73, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 65, 66, 67, 68, 69, 0, 0, 70, 71, 55, + 56, 57, 0, 0, 0, 0, 0, 0, 78, 0, + 0, 48, 202, 0, 60, 62, 50, 51, 52, 53, + 54, 0, 0, 0, 0, 49, 0, 0, 74, 76, + 0, 77, 201, 72, 58, 59, 61, 63, 73, 75, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 71, 55, 56, + 57, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 48, 185, 0, 60, 62, 50, 51, 52, 53, 54, + 0, 0, 0, 0, 49, 0, 0, 74, 76, 0, + 77, 184, 72, 58, 59, 61, 63, 73, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 65, 66, + 67, 68, 69, 0, 0, 70, 71, 55, 56, 57, + 0, 0, 0, 0, 0, 0, 78, 0, 0, 48, + 0, 0, 60, 62, 50, 51, 52, 53, 54, 0, + 0, 0, 0, 49, 0, 0, 74, 76, 313, 77, + 0, 72, 58, 59, 61, 63, 73, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 71, 55, 56, 57, 0, + 0, 0, 0, 0, 0, 78, 0, 0, 48, 0, + 0, 60, 62, 50, 51, 52, 53, 54, 0, 0, + 0, 0, 49, 0, 0, 74, 76, 296, 77, 0, + 72, 58, 59, 61, 63, 73, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, + 69, 0, 0, 70, 71, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 48, 290, 0, + 60, 62, 50, 51, 52, 53, 54, 0, 0, 0, + 0, 49, 0, 0, 74, 76, 0, 77, 0, 72, + 58, 59, 61, 63, 73, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 48, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 287, 0, 0, + 49, 0, 0, 74, 76, 0, 77, 0, 72, 58, + 59, 61, 63, 73, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 65, 66, 67, 68, 69, 0, + 0, 70, 71, 55, 56, 57, 0, 0, 0, 0, + 0, 0, 78, 0, 0, 48, 0, 0, 60, 62, + 50, 51, 52, 53, 54, 0, 0, 0, 0, 49, + 0, 0, 74, 76, 0, 77, 272, 72, 58, 59, + 61, 63, 73, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 67, 68, 69, 0, 0, + 70, 71, 55, 56, 57, 0, 0, 0, 0, 0, + 0, 78, 0, 0, 48, 0, 0, 60, 62, 50, + 51, 52, 53, 54, 0, 0, 0, 0, 49, 0, + 0, 74, 76, 0, 77, 264, 72, 58, 59, 61, + 63, 73, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 64, 65, 66, 67, 68, 69, 0, 0, 70, + 71, 55, 56, 57, 0, 0, 0, 0, 0, 0, + 78, 0, 0, 48, 0, 0, 60, 62, 50, 51, + 52, 53, 54, 0, 0, 0, 233, 49, 0, 0, + 74, 76, 0, 77, 0, 72, 58, 59, 61, 63, + 73, 75, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 65, 66, 67, 68, 69, 0, 0, 70, 71, + 55, 56, 57, 0, 0, 0, 0, 0, 0, 78, + 0, 0, 48, 0, 0, 60, 62, 50, 51, 52, + 53, 54, 0, 232, 0, 0, 49, 0, 0, 74, + 76, 0, 77, 0, 72, 58, 59, 61, 63, 73, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 65, 66, 67, 68, 69, 0, 0, 70, 71, 55, + 56, 57, 0, 0, 0, 0, 0, 0, 78, 0, + 0, 48, 0, 0, 60, 62, 50, 51, 52, 53, + 54, 0, 230, 0, 0, 49, 0, 0, 74, 76, + 0, 77, 0, 72, 58, 59, 61, 63, 73, 75, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 71, 55, 56, + 57, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 48, 181, 0, 60, 62, 50, 51, 52, 53, 54, + 0, 0, 0, 0, 49, 0, 0, 74, 76, 0, + 77, 0, 72, 58, 59, 61, 63, 73, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 65, 66, + 67, 68, 69, 0, 0, 70, 71, 55, 56, 57, + 0, 0, 0, 0, 0, 0, 78, 0, 0, 48, + 0, 0, 60, 62, 50, 51, 52, 53, 54, 0, + 178, 0, 0, 49, 0, 0, 74, 76, 0, 77, + 0, 72, 58, 59, 61, 63, 73, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 71, 55, 56, 57, 0, + 0, 0, 0, 0, 0, 78, 0, 0, 48, 0, + 0, 60, 62, 50, 51, 52, 53, 54, 0, 0, + 0, 0, 49, 0, 0, 74, 76, 171, 77, 0, + 72, 58, 59, 61, 63, 73, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, + 69, 0, 0, 70, 71, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 48, 0, 0, + 60, 62, 50, 51, 52, 53, 54, 0, 159, 0, + 0, 49, 0, 0, 74, 76, 0, 77, 0, 72, + 58, 59, 61, 63, 73, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 48, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 156, 0, 0, + 49, 0, 0, 74, 76, 0, 77, 0, 72, 21, + 22, 28, 0, 0, 32, 14, 9, 15, 41, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 36, 29, + 30, 31, 16, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 0, 0, 0, 0, 0, 20, + 0, 0, 37, 0, 38, 39, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 27, 0, 0, 0, 34, + 0, 6, 0, 24, 25, 26, 35, 0, 33, 0, + 0, 7, 58, 59, 61, 63, 73, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 71, 55, 56, 57, 0, + 0, 0, 0, 0, 0, 78, 0, 47, 48, 0, + 0, 60, 62, 50, 51, 52, 53, 54, 0, 0, + 0, 0, 49, 0, 0, 74, 76, 0, 77, 0, + 72, 58, 59, 61, 63, 73, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, + 69, 0, 0, 70, 71, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 48, 0, 0, + 60, 62, 50, 51, 52, 53, 54, 0, 0, 0, + 0, 49, 0, 0, 74, 76, 0, 77, 0, 72, + 58, 59, 61, 63, 73, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 48, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 0, 0, 0, + 49, 0, 0, 74, 174, 0, 77, 0, 72, 58, + 59, 61, 63, 73, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 65, 66, 67, 68, 69, 0, + 0, 70, 71, 55, 56, 57, 0, 0, 0, 0, + 0, 0, 78, 0, 0, 48, 0, 0, 60, 62, + 50, 51, 52, 53, 54, 0, 0, 0, 0, 163, + 0, 0, 74, 76, 0, 77, 0, 72, 58, 59, + 61, 63, 73, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 67, 68, 69, 0, 0, + 70, 71, 55, 56, 57, 0, 0, 0, 0, 0, + 0, 78, 0, 0, 48, 0, 0, 60, 62, 50, + 51, 52, 53, 54, 58, 59, 61, 63, 162, 75, + 0, 74, 76, 0, 77, 0, 72, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 71, 55, 56, + 57, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 0, 0, 0, 60, 62, 50, 51, 52, 53, 54, + 58, 59, 61, 63, 49, 0, 0, 74, 76, 0, + 77, 0, 72, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 0, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 0, 0, 0, + 49, 0, 0, 74, 76, 0, 77, 0, 72, 21, + 22, 191, 0, 0, 32, 14, 9, 15, 41, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 36, 29, + 30, 31, 16, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 0, 0, 0, 0, 0, 20, + 0, 0, 37, 0, 38, 39, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 27, 0, 0, 0, 34, + 0, 0, 0, 24, 25, 26, 35, 0, 33, 21, + 22, 28, 0, 0, 32, 14, 9, 15, 41, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 36, 29, + 30, 31, 16, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 0, 0, 0, 0, 0, 20, + 0, 0, 37, 0, 38, 39, 0, 0, 64, 65, + 66, 67, 68, 69, 23, 27, 70, 71, 55, 34, + 0, 0, 0, 24, 25, 26, 35, 78, 33, 0, + 0, 0, 0, 0, 0, 50, 51, 52, 53, 54, + 228, 22, 28, 0, 49, 32, 0, 74, 76, 0, + 77, 0, 72, 0, 0, 0, 0, 0, 0, 36, + 29, 30, 31, 0, 0, 0, 0, 0, 21, 22, + 28, 0, 0, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 37, 0, 38, 39, 36, 29, 30, + 31, 0, 0, 0, 0, 23, 27, 228, 22, 28, + 34, 0, 32, 0, 24, 25, 26, 35, 0, 33, + 277, 37, 0, 38, 39, 0, 36, 29, 30, 31, + 0, 0, 0, 23, 27, 221, 22, 28, 34, 0, + 32, 0, 24, 25, 26, 35, 0, 33, 0, 0, + 37, 0, 38, 39, 36, 29, 30, 31, 0, 0, + 0, 0, 23, 27, 107, 22, 28, 34, 0, 32, + 0, 24, 25, 26, 35, 0, 33, 0, 37, 0, + 38, 39, 0, 36, 29, 30, 31, 0, 0, 0, + 23, 27, 99, 22, 28, 34, 0, 32, 0, 24, + 25, 26, 35, 0, 33, 0, 0, 37, 0, 38, + 39, 36, 29, 30, 31, 0, 0, 0, 0, 23, + 27, 97, 22, 28, 34, 0, 32, 0, 24, 25, + 26, 35, 0, 33, 0, 37, 0, 38, 39, 0, + 36, 29, 30, 31, 0, 0, 0, 23, 27, 86, + 22, 28, 34, 0, 32, 0, 24, 25, 26, 35, + 0, 33, 0, 0, 37, 0, 38, 39, 36, 29, + 30, 31, 0, 0, 0, 0, 23, 27, 0, 0, + 0, 34, 0, 0, 0, 24, 25, 26, 35, 0, + 33, 0, 37, 0, 38, 39, 0, 0, 64, 65, + 66, 67, 68, 69, 23, 27, 0, 0, 55, 85, + 0, 0, 0, 24, 25, 26, 35, 78, 33, 0, + 0, 0, 0, 0, 0, 0, 0, 52, 53, 54, + 0, 0, 0, 0, 49, 0, 0, 74, 76, 0, + 77, 0, 72, +} +var yyPact = [...]int{ + + -59, -1000, 1845, -59, -59, -1000, -1000, -1000, -1000, 228, + 1375, 146, -1000, -1000, 1954, 1954, 227, 199, 2125, 119, + 1954, -63, -1000, 1954, 1954, 1954, 2097, 2068, -1000, -1000, + -1000, -1000, 67, -59, -59, 1954, 226, 2040, 18, 1954, + 130, 1954, -1000, 1315, -1000, 138, -1000, 1954, 1954, 225, + 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, + 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, + -1000, -1000, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, + 129, 1434, 1434, 113, 154, -59, 17, 25, 1243, 145, + -59, 1184, 1954, 1954, 51, 51, 51, -63, 1611, -63, + 1552, 224, 6, 1954, 213, 1125, 1, -36, 1493, 148, + 1434, -59, 1066, -1000, 1954, -59, 1434, 1007, -1000, 2147, + 2147, 51, 51, 51, 1434, 1867, 1867, 236, 236, 1867, + 1867, 1867, 1867, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + 1657, 1434, 1703, 98, 417, 1434, -1000, 1434, -59, -59, + 1954, -59, 100, 1775, 1954, 1954, -59, 1954, 96, -59, + 94, 358, 223, 222, 45, 209, 221, -37, -46, -1000, + 141, -1000, 1954, 1954, 1954, 220, 220, 2011, -59, -1000, + 218, 1954, -29, -1000, -1000, 1954, 1983, 92, 948, 83, + -1000, 141, 889, 830, 82, -1000, 183, 85, 163, -31, + -1000, -1000, 1954, -1000, -1000, 112, -38, 44, 208, -59, + -61, -59, 79, 1954, 41, 87, 73, 38, -1000, 52, + 1434, -63, 78, -1000, 1434, -1000, 771, 1434, -63, -1000, + -59, -1000, -59, 1954, -1000, 128, -1000, -1000, -1000, 1954, + 140, -1000, -1000, -1000, 712, -59, 111, 110, -49, 1926, + -1000, 123, -1000, 1434, -1000, -50, -1000, -58, -1000, 216, + -1000, 1954, 1954, -1000, -1000, 76, 75, 653, 108, -59, + 594, -59, -1000, 74, -59, -59, 104, -1000, -1000, -1000, + -1000, -1000, -1000, 535, 299, -1000, -1000, -59, -59, 72, + -59, -59, -1000, 70, 69, -59, -1000, -1000, 1954, 68, + 55, 181, -59, -1000, -1000, -1000, 49, 476, -1000, 172, + 99, -1000, -1000, -1000, 88, -59, -59, 47, 39, -1000, + -1000, +} +var yyPgo = [...]int{ + + 0, 12, 241, 200, 239, 5, 2, 238, 4, 0, + 32, 31, 236, 1, 235, 6, 11, 233, 210, +} +var yyR1 = [...]int{ + + 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 7, 7, + 7, 7, 7, 6, 5, 13, 14, 14, 14, 15, + 15, 15, 12, 11, 11, 11, 8, 8, 10, 10, + 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 16, 16, 17, 17, 18, 18, +} +var yyR2 = [...]int{ + + 0, 1, 2, 0, 2, 3, 4, 3, 3, 1, + 1, 2, 2, 5, 1, 4, 7, 9, 5, 13, + 12, 9, 8, 5, 1, 7, 5, 5, 0, 2, + 2, 2, 2, 5, 4, 3, 0, 1, 4, 0, + 1, 4, 3, 1, 4, 4, 1, 3, 0, 1, + 4, 4, 1, 1, 2, 2, 2, 2, 4, 2, + 4, 1, 1, 1, 1, 5, 3, 7, 8, 8, + 9, 5, 6, 5, 6, 3, 5, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, + 3, 3, 3, 5, 4, 6, 5, 5, 4, 6, + 5, 4, 4, 6, 6, 5, 7, 7, 9, 3, + 2, 0, 1, 1, 2, 1, 1, +} +var yyChk = [...]int{ + + -1000, -1, -16, -2, -17, -18, 66, 76, -3, 11, + -9, -11, 37, 38, 10, 12, 27, -4, 15, 28, + 44, 4, 5, 59, 68, 69, 70, 60, 6, 24, + 25, 26, 9, 73, 64, 71, 23, 47, 49, 50, + -10, 13, -16, -17, -18, -15, 4, 52, 53, 67, + 58, 59, 60, 61, 62, 41, 42, 43, 17, 18, + 56, 19, 57, 20, 31, 32, 33, 34, 35, 36, + 39, 40, 75, 21, 70, 22, 71, 73, 50, 52, + -10, -9, -9, 4, 14, 64, 4, -12, -9, -11, + 64, -9, 71, 73, -9, -9, -9, 4, -9, 4, + -9, 71, 4, -16, -16, -9, 4, 4, -9, 71, + -9, 55, -9, -3, 52, 55, -9, -9, 4, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -10, -9, -9, -11, -9, 55, 64, + 13, 64, -1, -16, 16, 66, 64, 52, -1, 64, + -10, -9, 67, 67, -15, 4, 71, -10, -14, -13, + 6, 72, 71, 71, 71, 48, 51, -16, 64, -11, + -16, 54, 8, 72, 74, 54, -16, -1, -9, -1, + 65, 6, -9, -9, -1, -11, 65, -7, -16, 8, + 72, 74, 54, 4, 4, 72, 8, -15, 4, 55, + -16, 55, -16, 54, -10, -10, -10, -8, 4, -8, + -9, 4, -1, 4, -9, 72, -9, -9, 4, 65, + 64, 65, 64, 66, 65, 29, 65, -6, -5, 45, + 46, -6, -5, 72, -9, 64, 72, 72, 8, -16, + 74, -16, 65, -9, 72, 8, 72, 8, 72, 67, + 72, 55, 55, 65, 74, -1, -1, -9, 4, 64, + -9, 54, 74, -1, 64, 64, 72, 74, -13, 65, + 72, 72, 4, -9, -9, 65, 65, 64, 64, -1, + 54, -16, 65, -1, -1, 64, 72, 72, 55, -1, + -1, 65, -16, -1, 65, 65, -1, -9, 65, 65, + 30, -1, 65, 72, 30, 64, 64, -1, -1, 65, + 65, +} +var yyDef = [...]int{ + + -2, -2, -2, 121, 122, 123, 125, 126, 4, 39, + -2, 0, 9, 10, 48, 0, 0, 14, 48, 0, + 0, 52, 53, 0, 0, 0, 0, 0, 61, 62, + 63, 64, 0, 121, 121, 0, 0, 0, 0, 0, + 0, 0, 2, -2, 124, 0, 40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 97, 98, 0, 0, 0, 0, 48, 0, 0, 48, + 11, 49, 12, 0, 0, -2, 52, 0, -2, 0, + -2, 0, 48, 0, 54, 55, 56, -2, 0, -2, + 0, 39, 0, 48, 36, 0, 0, 52, 0, 0, + 120, 121, 0, 5, 48, 121, 7, 0, 66, 77, + 78, 79, 80, 81, 82, 83, 84, -2, -2, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 99, + 100, 101, 102, 0, 0, 119, 8, -2, 121, -2, + 0, -2, 0, -2, 0, 0, -2, 48, 0, 28, + 0, 0, 0, 0, 0, 40, 39, 121, 121, 37, + 0, 75, 48, 48, 48, 0, 0, 0, -2, 6, + 0, 0, 0, 108, 112, 0, 0, 0, 0, 0, + 15, 61, 0, 0, 0, 42, 0, 0, 0, 0, + 104, 111, 0, 58, 60, 0, 0, 0, 40, 121, + 0, 121, 0, 0, 0, 0, 0, 0, 46, 0, + -2, -2, 0, 41, 65, 107, 0, 50, -2, 13, + -2, 26, -2, 0, 18, 0, 23, 31, 32, 0, + 0, 29, 30, 103, 0, -2, 0, 0, 0, 0, + 71, 0, 73, 35, 76, 0, -2, 0, -2, 0, + 115, 0, 0, 27, 114, 0, 0, 0, 0, -2, + 0, 121, 113, 0, -2, -2, 0, 72, 38, 74, + -2, -2, 47, 0, 0, 25, 16, -2, -2, 0, + 121, -2, 67, 0, 0, -2, 116, 117, 0, 0, + 0, 22, -2, 34, 68, 69, 0, 0, 17, 21, + 0, 33, 70, 118, 0, -2, -2, 0, 0, 20, + 19, +} +var yyTok1 = [...]int{ + + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 76, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 68, 3, 3, 3, 62, 70, 3, + 71, 72, 60, 58, 55, 59, 67, 61, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 54, 66, + 57, 52, 56, 53, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 73, 3, 74, 69, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 64, 75, 65, +} +var yyTok2 = [...]int{ + + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 63, +} +var yyTok3 = [...]int{ + 0, +} + +var yyErrorMessages = [...]struct { + state int + token int + msg string +}{} + +//line yaccpar:1 + +/* parser for yacc output */ + +var ( + yyDebug = 0 + yyErrorVerbose = false +) + +type yyLexer interface { + Lex(lval *yySymType) int + Error(s string) +} + +type yyParser interface { + Parse(yyLexer) int + Lookahead() int +} + +type yyParserImpl struct { + lval yySymType + stack [yyInitialStackSize]yySymType + char int +} + +func (p *yyParserImpl) Lookahead() int { + return p.char +} + +func yyNewParser() yyParser { + return &yyParserImpl{} +} + +const yyFlag = -1000 + +func yyTokname(c int) string { + if c >= 1 && c-1 < len(yyToknames) { + if yyToknames[c-1] != "" { + return yyToknames[c-1] + } + } + return __yyfmt__.Sprintf("tok-%v", c) +} + +func yyStatname(s int) string { + if s >= 0 && s < len(yyStatenames) { + if yyStatenames[s] != "" { + return yyStatenames[s] + } + } + return __yyfmt__.Sprintf("state-%v", s) +} + +func yyErrorMessage(state, lookAhead int) string { + const TOKSTART = 4 + + if !yyErrorVerbose { + return "syntax error" + } + + for _, e := range yyErrorMessages { + if e.state == state && e.token == lookAhead { + return "syntax error: " + e.msg + } + } + + res := "syntax error: unexpected " + yyTokname(lookAhead) + + // To match Bison, suggest at most four expected tokens. + expected := make([]int, 0, 4) + + // Look for shiftable tokens. + base := yyPact[state] + for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { + if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok { + if len(expected) == cap(expected) { + return res + } + expected = append(expected, tok) + } + } + + if yyDef[state] == -2 { + i := 0 + for yyExca[i] != -1 || yyExca[i+1] != state { + i += 2 + } + + // Look for tokens that we accept or reduce. + for i += 2; yyExca[i] >= 0; i += 2 { + tok := yyExca[i] + if tok < TOKSTART || yyExca[i+1] == 0 { + continue + } + if len(expected) == cap(expected) { + return res + } + expected = append(expected, tok) + } + + // If the default action is to accept or reduce, give up. + if yyExca[i+1] != 0 { + return res + } + } + + for i, tok := range expected { + if i == 0 { + res += ", expecting " + } else { + res += " or " + } + res += yyTokname(tok) + } + return res +} + +func yylex1(lex yyLexer, lval *yySymType) (char, token int) { + token = 0 + char = lex.Lex(lval) + if char <= 0 { + token = yyTok1[0] + goto out + } + if char < len(yyTok1) { + token = yyTok1[char] + goto out + } + if char >= yyPrivate { + if char < yyPrivate+len(yyTok2) { + token = yyTok2[char-yyPrivate] + goto out + } + } + for i := 0; i < len(yyTok3); i += 2 { + token = yyTok3[i+0] + if token == char { + token = yyTok3[i+1] + goto out + } + } + +out: + if token == 0 { + token = yyTok2[1] /* unknown char */ + } + if yyDebug >= 3 { + __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) + } + return char, token +} + +func yyParse(yylex yyLexer) int { + return yyNewParser().Parse(yylex) +} + +func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { + var yyn int + var yyVAL yySymType + var yyDollar []yySymType + _ = yyDollar // silence set and not used + yyS := yyrcvr.stack[:] + + Nerrs := 0 /* number of errors */ + Errflag := 0 /* error recovery flag */ + yystate := 0 + yyrcvr.char = -1 + yytoken := -1 // yyrcvr.char translated into internal numbering + defer func() { + // Make sure we report no lookahead when not parsing. + yystate = -1 + yyrcvr.char = -1 + yytoken = -1 + }() + yyp := -1 + goto yystack + +ret0: + return 0 + +ret1: + return 1 + +yystack: + /* put a state and value onto the stack */ + if yyDebug >= 4 { + __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) + } + + yyp++ + if yyp >= len(yyS) { + nyys := make([]yySymType, len(yyS)*2) + copy(nyys, yyS) + yyS = nyys + } + yyS[yyp] = yyVAL + yyS[yyp].yys = yystate + +yynewstate: + yyn = yyPact[yystate] + if yyn <= yyFlag { + goto yydefault /* simple state */ + } + if yyrcvr.char < 0 { + yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) + } + yyn += yytoken + if yyn < 0 || yyn >= yyLast { + goto yydefault + } + yyn = yyAct[yyn] + if yyChk[yyn] == yytoken { /* valid shift */ + yyrcvr.char = -1 + yytoken = -1 + yyVAL = yyrcvr.lval + yystate = yyn + if Errflag > 0 { + Errflag-- + } + goto yystack + } + +yydefault: + /* default state action */ + yyn = yyDef[yystate] + if yyn == -2 { + if yyrcvr.char < 0 { + yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) + } + + /* look through exception table */ + xi := 0 + for { + if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate { + break + } + xi += 2 + } + for xi += 2; ; xi += 2 { + yyn = yyExca[xi+0] + if yyn < 0 || yyn == yytoken { + break + } + } + yyn = yyExca[xi+1] + if yyn < 0 { + goto ret0 + } + } + if yyn == 0 { + /* error ... attempt to resume parsing */ + switch Errflag { + case 0: /* brand new error */ + yylex.Error(yyErrorMessage(yystate, yytoken)) + Nerrs++ + if yyDebug >= 1 { + __yyfmt__.Printf("%s", yyStatname(yystate)) + __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) + } + fallthrough + + case 1, 2: /* incompletely recovered error ... try again */ + Errflag = 3 + + /* find a state where "error" is a legal shift action */ + for yyp >= 0 { + yyn = yyPact[yyS[yyp].yys] + yyErrCode + if yyn >= 0 && yyn < yyLast { + yystate = yyAct[yyn] /* simulate a shift of "error" */ + if yyChk[yystate] == yyErrCode { + goto yystack + } + } + + /* the current p has no shift on "error", pop stack */ + if yyDebug >= 2 { + __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) + } + yyp-- + } + /* there is no state on the stack with an error shift ... abort */ + goto ret1 + + case 3: /* no shift yet; clobber input char */ + if yyDebug >= 2 { + __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) + } + if yytoken == yyEofCode { + goto ret1 + } + yyrcvr.char = -1 + yytoken = -1 + goto yynewstate /* try again in the same state */ + } + } + + /* reduction by production yyn */ + if yyDebug >= 2 { + __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) + } + + yynt := yyn + yypt := yyp + _ = yypt // guard against "declared and not used" + + yyp -= yyR2[yyn] + // yyp is now the index of $0. Perform the default action. Iff the + // reduced production is ε, $1 is possibly out of range. + if yyp+1 >= len(yyS) { + nyys := make([]yySymType, len(yyS)*2) + copy(nyys, yyS) + yyS = nyys + } + yyVAL = yyS[yyp+1] + + /* consult goto table to find next state */ + yyn = yyR1[yyn] + yyg := yyPgo[yyn] + yyj := yyg + yyS[yyp].yys + 1 + + if yyj >= yyLast { + yystate = yyAct[yyg] + } else { + yystate = yyAct[yyj] + if yyChk[yystate] != -yyn { + yystate = yyAct[yyg] + } + } + // dummy call; replaced with literal code + switch yynt { + + case 1: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:65 + { + yyVAL.compstmt = nil + } + case 2: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:69 + { + yyVAL.compstmt = yyDollar[1].stmts + } + case 3: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:74 + { + yyVAL.stmts = nil + if l, ok := yylex.(*Lexer); ok { + l.stmts = yyVAL.stmts + } + } + case 4: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:81 + { + yyVAL.stmts = []ast.Stmt{yyDollar[2].stmt} + if l, ok := yylex.(*Lexer); ok { + l.stmts = yyVAL.stmts + } + } + case 5: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:88 + { + if yyDollar[3].stmt != nil { + yyVAL.stmts = append(yyDollar[1].stmts, yyDollar[3].stmt) + if l, ok := yylex.(*Lexer); ok { + l.stmts = yyVAL.stmts + } + } + } + case 6: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:99 + { + yyVAL.stmt = &ast.VarStmt{Names: yyDollar[2].expr_idents, Exprs: yyDollar[4].expr_many} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 7: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:104 + { + yyVAL.stmt = &ast.LetsStmt{Lhss: []ast.Expr{yyDollar[1].expr}, Operator: "=", Rhss: []ast.Expr{yyDollar[3].expr}} + } + case 8: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:108 + { + yyVAL.stmt = &ast.LetsStmt{Lhss: yyDollar[1].expr_many, Operator: "=", Rhss: yyDollar[3].expr_many} + } + case 9: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:112 + { + yyVAL.stmt = &ast.BreakStmt{} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 10: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:117 + { + yyVAL.stmt = &ast.ContinueStmt{} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 11: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:122 + { + yyVAL.stmt = &ast.ReturnStmt{Exprs: yyDollar[2].exprs} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 12: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:127 + { + yyVAL.stmt = &ast.ThrowStmt{Expr: yyDollar[2].expr} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 13: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:132 + { + yyVAL.stmt = &ast.ModuleStmt{Name: yyDollar[2].tok.Lit, Stmts: yyDollar[4].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 14: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:137 + { + yyVAL.stmt = yyDollar[1].stmt_if + yyVAL.stmt.SetPosition(yyDollar[1].stmt_if.Position()) + } + case 15: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:142 + { + yyVAL.stmt = &ast.LoopStmt{Stmts: yyDollar[3].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 16: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:147 + { + yyVAL.stmt = &ast.ForStmt{Var: yyDollar[2].tok.Lit, Value: yyDollar[4].expr, Stmts: yyDollar[6].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 17: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:152 + { + yyVAL.stmt = &ast.CForStmt{Expr1: yyDollar[2].expr_lets, Expr2: yyDollar[4].expr, Expr3: yyDollar[6].expr, Stmts: yyDollar[8].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 18: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:157 + { + yyVAL.stmt = &ast.LoopStmt{Expr: yyDollar[2].expr, Stmts: yyDollar[4].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 19: + yyDollar = yyS[yypt-13 : yypt+1] + //line parser.go.y:162 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Var: yyDollar[6].tok.Lit, Catch: yyDollar[8].compstmt, Finally: yyDollar[12].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 20: + yyDollar = yyS[yypt-12 : yypt+1] + //line parser.go.y:167 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Catch: yyDollar[7].compstmt, Finally: yyDollar[11].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 21: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:172 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Var: yyDollar[6].tok.Lit, Catch: yyDollar[8].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 22: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.go.y:177 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Catch: yyDollar[7].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 23: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:182 + { + yyVAL.stmt = &ast.SwitchStmt{Expr: yyDollar[2].expr, Cases: yyDollar[4].stmt_cases} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 24: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:187 + { + yyVAL.stmt = &ast.ExprStmt{Expr: yyDollar[1].expr} + yyVAL.stmt.SetPosition(yyDollar[1].expr.Position()) + } + case 25: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:195 + { + yyDollar[1].stmt_if.(*ast.IfStmt).ElseIf = append(yyDollar[1].stmt_if.(*ast.IfStmt).ElseIf, &ast.IfStmt{If: yyDollar[4].expr, Then: yyDollar[6].compstmt}) + yyVAL.stmt_if.SetPosition(yyDollar[1].stmt_if.Position()) + } + case 26: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:200 + { + if yyVAL.stmt_if.(*ast.IfStmt).Else != nil { + yylex.Error("multiple else statement") + } else { + yyVAL.stmt_if.(*ast.IfStmt).Else = append(yyVAL.stmt_if.(*ast.IfStmt).Else, yyDollar[4].compstmt...) + } + yyVAL.stmt_if.SetPosition(yyDollar[1].stmt_if.Position()) + } + case 27: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:209 + { + yyVAL.stmt_if = &ast.IfStmt{If: yyDollar[2].expr, Then: yyDollar[4].compstmt, Else: nil} + yyVAL.stmt_if.SetPosition(yyDollar[1].tok.Position()) + } + case 28: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:215 + { + yyVAL.stmt_cases = []ast.Stmt{} + } + case 29: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:219 + { + yyVAL.stmt_cases = []ast.Stmt{yyDollar[2].stmt_case} + } + case 30: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:223 + { + yyVAL.stmt_cases = []ast.Stmt{yyDollar[2].stmt_default} + } + case 31: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:227 + { + yyVAL.stmt_cases = append(yyDollar[1].stmt_cases, yyDollar[2].stmt_case) + } + case 32: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:231 + { + for _, stmt := range yyDollar[1].stmt_cases { + if _, ok := stmt.(*ast.DefaultStmt); ok { + yylex.Error("multiple default statement") + } + } + yyVAL.stmt_cases = append(yyDollar[1].stmt_cases, yyDollar[2].stmt_default) + } + case 33: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:242 + { + yyVAL.stmt_case = &ast.CaseStmt{Expr: yyDollar[2].expr, Stmts: yyDollar[5].compstmt} + } + case 34: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:248 + { + yyVAL.stmt_default = &ast.DefaultStmt{Stmts: yyDollar[4].compstmt} + } + case 35: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:254 + { + yyVAL.expr_pair = &ast.PairExpr{Key: yyDollar[1].tok.Lit, Value: yyDollar[3].expr} + } + case 36: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:259 + { + yyVAL.expr_pairs = []ast.Expr{} + } + case 37: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:263 + { + yyVAL.expr_pairs = []ast.Expr{yyDollar[1].expr_pair} + } + case 38: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:267 + { + yyVAL.expr_pairs = append(yyDollar[1].expr_pairs, yyDollar[4].expr_pair) + } + case 39: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:272 + { + yyVAL.expr_idents = []string{} + } + case 40: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:276 + { + yyVAL.expr_idents = []string{yyDollar[1].tok.Lit} + } + case 41: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:280 + { + yyVAL.expr_idents = append(yyDollar[1].expr_idents, yyDollar[4].tok.Lit) + } + case 42: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:285 + { + yyVAL.expr_lets = &ast.LetsExpr{Lhss: yyDollar[1].expr_many, Operator: "=", Rhss: yyDollar[3].expr_many} + } + case 43: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:291 + { + yyVAL.expr_many = []ast.Expr{yyDollar[1].expr} + } + case 44: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:295 + { + yyVAL.expr_many = append(yyDollar[1].exprs, yyDollar[4].expr) + } + case 45: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:299 + { + yyVAL.expr_many = append(yyDollar[1].exprs, &ast.IdentExpr{Lit: yyDollar[4].tok.Lit}) + } + case 46: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:304 + { + yyVAL.typ = ast.Type{Name: yyDollar[1].tok.Lit} + } + case 47: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:308 + { + yyVAL.typ = ast.Type{Name: yyDollar[1].typ.Name + "." + yyDollar[3].tok.Lit} + } + case 48: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:313 + { + yyVAL.exprs = nil + } + case 49: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:317 + { + yyVAL.exprs = []ast.Expr{yyDollar[1].expr} + } + case 50: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:321 + { + yyVAL.exprs = append(yyDollar[1].exprs, yyDollar[4].expr) + } + case 51: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:325 + { + yyVAL.exprs = append(yyDollar[1].exprs, &ast.IdentExpr{Lit: yyDollar[4].tok.Lit}) + } + case 52: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:331 + { + yyVAL.expr = &ast.IdentExpr{Lit: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 53: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:336 + { + yyVAL.expr = &ast.NumberExpr{Lit: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 54: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:341 + { + yyVAL.expr = &ast.UnaryExpr{Operator: "-", Expr: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 55: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:346 + { + yyVAL.expr = &ast.UnaryExpr{Operator: "!", Expr: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 56: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:351 + { + yyVAL.expr = &ast.UnaryExpr{Operator: "^", Expr: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 57: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:356 + { + yyVAL.expr = &ast.AddrExpr{Expr: &ast.IdentExpr{Lit: yyDollar[2].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 58: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:361 + { + yyVAL.expr = &ast.AddrExpr{Expr: &ast.MemberExpr{Expr: yyDollar[2].expr, Name: yyDollar[4].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 59: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:366 + { + yyVAL.expr = &ast.DerefExpr{Expr: &ast.IdentExpr{Lit: yyDollar[2].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 60: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:371 + { + yyVAL.expr = &ast.DerefExpr{Expr: &ast.MemberExpr{Expr: yyDollar[2].expr, Name: yyDollar[4].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 61: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:376 + { + yyVAL.expr = &ast.StringExpr{Lit: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 62: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:381 + { + yyVAL.expr = &ast.ConstExpr{Value: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 63: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:386 + { + yyVAL.expr = &ast.ConstExpr{Value: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 64: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:391 + { + yyVAL.expr = &ast.ConstExpr{Value: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 65: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:396 + { + yyVAL.expr = &ast.TernaryOpExpr{Expr: yyDollar[1].expr, Lhs: yyDollar[3].expr, Rhs: yyDollar[5].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 66: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:401 + { + yyVAL.expr = &ast.MemberExpr{Expr: yyDollar[1].expr, Name: yyDollar[3].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 67: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:406 + { + yyVAL.expr = &ast.FuncExpr{Args: yyDollar[3].expr_idents, Stmts: yyDollar[6].compstmt} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 68: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.go.y:411 + { + yyVAL.expr = &ast.FuncExpr{Args: []string{yyDollar[3].tok.Lit}, Stmts: yyDollar[7].compstmt, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 69: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.go.y:416 + { + yyVAL.expr = &ast.FuncExpr{Name: yyDollar[2].tok.Lit, Args: yyDollar[4].expr_idents, Stmts: yyDollar[7].compstmt} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 70: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:421 + { + yyVAL.expr = &ast.FuncExpr{Name: yyDollar[2].tok.Lit, Args: []string{yyDollar[4].tok.Lit}, Stmts: yyDollar[8].compstmt, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 71: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:426 + { + yyVAL.expr = &ast.ArrayExpr{Exprs: yyDollar[3].exprs} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 72: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:431 + { + yyVAL.expr = &ast.ArrayExpr{Exprs: yyDollar[3].exprs} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 73: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:436 + { + mapExpr := make(map[string]ast.Expr) + for _, v := range yyDollar[3].expr_pairs { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + yyVAL.expr = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 74: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:445 + { + mapExpr := make(map[string]ast.Expr) + for _, v := range yyDollar[3].expr_pairs { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + yyVAL.expr = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 75: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:454 + { + yyVAL.expr = &ast.ParenExpr{SubExpr: yyDollar[2].expr} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 76: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:459 + { + yyVAL.expr = &ast.NewExpr{Name: yyDollar[2].tok.Lit, SubExprs: yyDollar[4].exprs} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 77: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:464 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "+", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 78: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:469 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "-", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 79: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:474 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "*", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 80: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:479 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "/", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 81: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:484 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "%", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 82: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:489 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "**", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 83: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:494 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "<<", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 84: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:499 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: ">>", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 85: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:504 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "==", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 86: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:509 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "!=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 87: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:514 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: ">", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 88: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:519 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: ">=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 89: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:524 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "<", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 90: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:529 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "<=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 91: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:534 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "+=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 92: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:539 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "-=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 93: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:544 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "*=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 94: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:549 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "/=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 95: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:554 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "&=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 96: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:559 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "|=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 97: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:564 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "++"} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 98: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:569 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "--"} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 99: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:574 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "|", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 100: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:579 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "||", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 101: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:584 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "&", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 102: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:589 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "&&", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 103: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:594 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[1].tok.Lit, SubExprs: yyDollar[3].exprs, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 104: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:599 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[1].tok.Lit, SubExprs: yyDollar[3].exprs} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 105: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:604 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[2].tok.Lit, SubExprs: yyDollar[4].exprs, VarArg: true, Go: true} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 106: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:609 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[2].tok.Lit, SubExprs: yyDollar[4].exprs, Go: true} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 107: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:614 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[1].expr, SubExprs: yyDollar[3].exprs, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 108: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:619 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[1].expr, SubExprs: yyDollar[3].exprs} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 109: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:624 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[2].expr, SubExprs: yyDollar[4].exprs, VarArg: true, Go: true} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 110: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:629 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[2].expr, SubExprs: yyDollar[4].exprs, Go: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 111: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:634 + { + yyVAL.expr = &ast.ItemExpr{Value: &ast.IdentExpr{Lit: yyDollar[1].tok.Lit}, Index: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 112: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:639 + { + yyVAL.expr = &ast.ItemExpr{Value: yyDollar[1].expr, Index: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 113: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:644 + { + yyVAL.expr = &ast.SliceExpr{Value: &ast.IdentExpr{Lit: yyDollar[1].tok.Lit}, Begin: yyDollar[3].expr, End: yyDollar[5].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 114: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:649 + { + yyVAL.expr = &ast.SliceExpr{Value: yyDollar[1].expr, Begin: yyDollar[3].expr, End: yyDollar[5].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 115: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:654 + { + yyVAL.expr = &ast.MakeChanExpr{Type: yyDollar[4].typ.Name, SizeExpr: nil} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 116: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:659 + { + yyVAL.expr = &ast.MakeChanExpr{Type: yyDollar[4].typ.Name, SizeExpr: yyDollar[6].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 117: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:664 + { + yyVAL.expr = &ast.MakeArrayExpr{Type: yyDollar[4].typ.Name, LenExpr: yyDollar[6].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 118: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:669 + { + yyVAL.expr = &ast.MakeArrayExpr{Type: yyDollar[4].typ.Name, LenExpr: yyDollar[6].expr, CapExpr: yyDollar[8].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 119: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:674 + { + yyVAL.expr = &ast.ChanExpr{Lhs: yyDollar[1].expr, Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 120: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:679 + { + yyVAL.expr = &ast.ChanExpr{Rhs: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 123: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:690 + { + } + case 124: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:693 + { + } + case 125: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:698 + { + } + case 126: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:701 + { + } + } + goto yystack /* stack new state and value */ +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go.y b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go.y new file mode 100644 index 0000000000..9ebe8ae068 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/parser/parser.go.y @@ -0,0 +1,705 @@ +%{ +package parser + +import ( + "github.com/mattn/anko/ast" +) + +%} + +%type compstmt +%type stmts +%type stmt +%type stmt_if +%type stmt_default +%type stmt_case +%type stmt_cases +%type typ +%type expr +%type exprs +%type expr_many +%type expr_lets +%type expr_pair +%type expr_pairs +%type expr_idents + +%union{ + compstmt []ast.Stmt + stmt_if ast.Stmt + stmt_default ast.Stmt + stmt_case ast.Stmt + stmt_cases []ast.Stmt + stmts []ast.Stmt + stmt ast.Stmt + typ ast.Type + expr ast.Expr + exprs []ast.Expr + expr_many []ast.Expr + expr_lets ast.Expr + expr_pair ast.Expr + expr_pairs []ast.Expr + expr_idents []string + tok ast.Token + term ast.Token + terms ast.Token + opt_terms ast.Token +} + +%token IDENT NUMBER STRING ARRAY VARARG FUNC RETURN VAR THROW IF ELSE FOR IN EQEQ NEQ GE LE OROR ANDAND NEW TRUE FALSE NIL MODULE TRY CATCH FINALLY PLUSEQ MINUSEQ MULEQ DIVEQ ANDEQ OREQ BREAK CONTINUE PLUSPLUS MINUSMINUS POW SHIFTLEFT SHIFTRIGHT SWITCH CASE DEFAULT GO CHAN MAKE OPCHAN ARRAYLIT + +%right '=' +%right '?' ':' +%left OROR +%left ANDAND +%left IDENT +%nonassoc EQEQ NEQ ',' +%left '>' GE '<' LE SHIFTLEFT SHIFTRIGHT + +%left '+' '-' PLUSPLUS MINUSMINUS +%left '*' '/' '%' +%right UNARY + +%% + +compstmt : opt_terms + { + $$ = nil + } + | stmts opt_terms + { + $$ = $1 + } + +stmts : + { + $$ = nil + if l, ok := yylex.(*Lexer); ok { + l.stmts = $$ + } + } + | opt_terms stmt + { + $$ = []ast.Stmt{$2} + if l, ok := yylex.(*Lexer); ok { + l.stmts = $$ + } + } + | stmts terms stmt + { + if $3 != nil { + $$ = append($1, $3) + if l, ok := yylex.(*Lexer); ok { + l.stmts = $$ + } + } + } + +stmt : + VAR expr_idents '=' expr_many + { + $$ = &ast.VarStmt{Names: $2, Exprs: $4} + $$.SetPosition($1.Position()) + } + | expr '=' expr + { + $$ = &ast.LetsStmt{Lhss: []ast.Expr{$1}, Operator: "=", Rhss: []ast.Expr{$3}} + } + | expr_many '=' expr_many + { + $$ = &ast.LetsStmt{Lhss: $1, Operator: "=", Rhss: $3} + } + | BREAK + { + $$ = &ast.BreakStmt{} + $$.SetPosition($1.Position()) + } + | CONTINUE + { + $$ = &ast.ContinueStmt{} + $$.SetPosition($1.Position()) + } + | RETURN exprs + { + $$ = &ast.ReturnStmt{Exprs: $2} + $$.SetPosition($1.Position()) + } + | THROW expr + { + $$ = &ast.ThrowStmt{Expr: $2} + $$.SetPosition($1.Position()) + } + | MODULE IDENT '{' compstmt '}' + { + $$ = &ast.ModuleStmt{Name: $2.Lit, Stmts: $4} + $$.SetPosition($1.Position()) + } + | stmt_if + { + $$ = $1 + $$.SetPosition($1.Position()) + } + | FOR '{' compstmt '}' + { + $$ = &ast.LoopStmt{Stmts: $3} + $$.SetPosition($1.Position()) + } + | FOR IDENT IN expr '{' compstmt '}' + { + $$ = &ast.ForStmt{Var: $2.Lit, Value: $4, Stmts: $6} + $$.SetPosition($1.Position()) + } + | FOR expr_lets ';' expr ';' expr '{' compstmt '}' + { + $$ = &ast.CForStmt{Expr1: $2, Expr2: $4, Expr3: $6, Stmts: $8} + $$.SetPosition($1.Position()) + } + | FOR expr '{' compstmt '}' + { + $$ = &ast.LoopStmt{Expr: $2, Stmts: $4} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH IDENT '{' compstmt '}' FINALLY '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Var: $6.Lit, Catch: $8, Finally: $12} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH '{' compstmt '}' FINALLY '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Catch: $7, Finally: $11} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH IDENT '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Var: $6.Lit, Catch: $8} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Catch: $7} + $$.SetPosition($1.Position()) + } + | SWITCH expr '{' stmt_cases '}' + { + $$ = &ast.SwitchStmt{Expr: $2, Cases: $4} + $$.SetPosition($1.Position()) + } + | expr + { + $$ = &ast.ExprStmt{Expr: $1} + $$.SetPosition($1.Position()) + } + + +stmt_if : + stmt_if ELSE IF expr '{' compstmt '}' + { + $1.(*ast.IfStmt).ElseIf = append($1.(*ast.IfStmt).ElseIf, &ast.IfStmt{If: $4, Then: $6}) + $$.SetPosition($1.Position()) + } + | stmt_if ELSE '{' compstmt '}' + { + if $$.(*ast.IfStmt).Else != nil { + yylex.Error("multiple else statement") + } else { + $$.(*ast.IfStmt).Else = append($$.(*ast.IfStmt).Else, $4...) + } + $$.SetPosition($1.Position()) + } + | IF expr '{' compstmt '}' + { + $$ = &ast.IfStmt{If: $2, Then: $4, Else: nil} + $$.SetPosition($1.Position()) + } + +stmt_cases : + { + $$ = []ast.Stmt{} + } + | opt_terms stmt_case + { + $$ = []ast.Stmt{$2} + } + | opt_terms stmt_default + { + $$ = []ast.Stmt{$2} + } + | stmt_cases stmt_case + { + $$ = append($1, $2) + } + | stmt_cases stmt_default + { + for _, stmt := range $1 { + if _, ok := stmt.(*ast.DefaultStmt); ok { + yylex.Error("multiple default statement") + } + } + $$ = append($1, $2) + } + +stmt_case : + CASE expr ':' opt_terms compstmt + { + $$ = &ast.CaseStmt{Expr: $2, Stmts: $5} + } + +stmt_default : + DEFAULT ':' opt_terms compstmt + { + $$ = &ast.DefaultStmt{Stmts: $4} + } + +expr_pair : + STRING ':' expr + { + $$ = &ast.PairExpr{Key: $1.Lit, Value: $3} + } + +expr_pairs : + { + $$ = []ast.Expr{} + } + | expr_pair + { + $$ = []ast.Expr{$1} + } + | expr_pairs ',' opt_terms expr_pair + { + $$ = append($1, $4) + } + +expr_idents : + { + $$ = []string{} + } + | IDENT + { + $$ = []string{$1.Lit} + } + | expr_idents ',' opt_terms IDENT + { + $$ = append($1, $4.Lit) + } + +expr_lets : expr_many '=' expr_many + { + $$ = &ast.LetsExpr{Lhss: $1, Operator: "=", Rhss: $3} + } + +expr_many : + expr + { + $$ = []ast.Expr{$1} + } + | exprs ',' opt_terms expr + { + $$ = append($1, $4) + } + | exprs ',' opt_terms IDENT + { + $$ = append($1, &ast.IdentExpr{Lit: $4.Lit}) + } + +typ : IDENT + { + $$ = ast.Type{Name: $1.Lit} + } + | typ '.' IDENT + { + $$ = ast.Type{Name: $1.Name + "." + $3.Lit} + } + +exprs : + { + $$ = nil + } + | expr + { + $$ = []ast.Expr{$1} + } + | exprs ',' opt_terms expr + { + $$ = append($1, $4) + } + | exprs ',' opt_terms IDENT + { + $$ = append($1, &ast.IdentExpr{Lit: $4.Lit}) + } + +expr : + IDENT + { + $$ = &ast.IdentExpr{Lit: $1.Lit} + $$.SetPosition($1.Position()) + } + | NUMBER + { + $$ = &ast.NumberExpr{Lit: $1.Lit} + $$.SetPosition($1.Position()) + } + | '-' expr %prec UNARY + { + $$ = &ast.UnaryExpr{Operator: "-", Expr: $2} + $$.SetPosition($2.Position()) + } + | '!' expr %prec UNARY + { + $$ = &ast.UnaryExpr{Operator: "!", Expr: $2} + $$.SetPosition($2.Position()) + } + | '^' expr %prec UNARY + { + $$ = &ast.UnaryExpr{Operator: "^", Expr: $2} + $$.SetPosition($2.Position()) + } + | '&' IDENT %prec UNARY + { + $$ = &ast.AddrExpr{Expr: &ast.IdentExpr{Lit: $2.Lit}} + $$.SetPosition($2.Position()) + } + | '&' expr '.' IDENT %prec UNARY + { + $$ = &ast.AddrExpr{Expr: &ast.MemberExpr{Expr: $2, Name: $4.Lit}} + $$.SetPosition($2.Position()) + } + | '*' IDENT %prec UNARY + { + $$ = &ast.DerefExpr{Expr: &ast.IdentExpr{Lit: $2.Lit}} + $$.SetPosition($2.Position()) + } + | '*' expr '.' IDENT %prec UNARY + { + $$ = &ast.DerefExpr{Expr: &ast.MemberExpr{Expr: $2, Name: $4.Lit}} + $$.SetPosition($2.Position()) + } + | STRING + { + $$ = &ast.StringExpr{Lit: $1.Lit} + $$.SetPosition($1.Position()) + } + | TRUE + { + $$ = &ast.ConstExpr{Value: $1.Lit} + $$.SetPosition($1.Position()) + } + | FALSE + { + $$ = &ast.ConstExpr{Value: $1.Lit} + $$.SetPosition($1.Position()) + } + | NIL + { + $$ = &ast.ConstExpr{Value: $1.Lit} + $$.SetPosition($1.Position()) + } + | expr '?' expr ':' expr + { + $$ = &ast.TernaryOpExpr{Expr: $1, Lhs: $3, Rhs: $5} + $$.SetPosition($1.Position()) + } + | expr '.' IDENT + { + $$ = &ast.MemberExpr{Expr: $1, Name: $3.Lit} + $$.SetPosition($1.Position()) + } + | FUNC '(' expr_idents ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Args: $3, Stmts: $6} + $$.SetPosition($1.Position()) + } + | FUNC '(' IDENT VARARG ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Args: []string{$3.Lit}, Stmts: $7, VarArg: true} + $$.SetPosition($1.Position()) + } + | FUNC IDENT '(' expr_idents ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Name: $2.Lit, Args: $4, Stmts: $7} + $$.SetPosition($1.Position()) + } + | FUNC IDENT '(' IDENT VARARG ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Name: $2.Lit, Args: []string{$4.Lit}, Stmts: $8, VarArg: true} + $$.SetPosition($1.Position()) + } + | '[' opt_terms exprs opt_terms ']' + { + $$ = &ast.ArrayExpr{Exprs: $3} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '[' opt_terms exprs ',' opt_terms ']' + { + $$ = &ast.ArrayExpr{Exprs: $3} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '{' opt_terms expr_pairs opt_terms '}' + { + mapExpr := make(map[string]ast.Expr) + for _, v := range $3 { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + $$ = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '{' opt_terms expr_pairs ',' opt_terms '}' + { + mapExpr := make(map[string]ast.Expr) + for _, v := range $3 { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + $$ = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '(' expr ')' + { + $$ = &ast.ParenExpr{SubExpr: $2} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | NEW IDENT '(' exprs ')' + { + $$ = &ast.NewExpr{Name: $2.Lit, SubExprs: $4} + $$.SetPosition($1.Position()) + } + | expr '+' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "+", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '-' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "-", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '*' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "*", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '/' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "/", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '%' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "%", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr POW expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "**", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr SHIFTLEFT expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "<<", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr SHIFTRIGHT expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: ">>", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr EQEQ expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "==", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr NEQ expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "!=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '>' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: ">", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr GE expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: ">=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '<' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "<", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr LE expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "<=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr PLUSEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "+=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr MINUSEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "-=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr MULEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "*=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr DIVEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "/=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr ANDEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "&=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr OREQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "|=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr PLUSPLUS + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "++"} + $$.SetPosition($1.Position()) + } + | expr MINUSMINUS + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "--"} + $$.SetPosition($1.Position()) + } + | expr '|' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "|", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr OROR expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "||", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '&' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "&", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr ANDAND expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "&&", Rhs: $3} + $$.SetPosition($1.Position()) + } + | IDENT '(' exprs VARARG ')' + { + $$ = &ast.CallExpr{Name: $1.Lit, SubExprs: $3, VarArg: true} + $$.SetPosition($1.Position()) + } + | IDENT '(' exprs ')' + { + $$ = &ast.CallExpr{Name: $1.Lit, SubExprs: $3} + $$.SetPosition($1.Position()) + } + | GO IDENT '(' exprs VARARG ')' + { + $$ = &ast.CallExpr{Name: $2.Lit, SubExprs: $4, VarArg: true, Go: true} + $$.SetPosition($2.Position()) + } + | GO IDENT '(' exprs ')' + { + $$ = &ast.CallExpr{Name: $2.Lit, SubExprs: $4, Go: true} + $$.SetPosition($2.Position()) + } + | expr '(' exprs VARARG ')' + { + $$ = &ast.AnonCallExpr{Expr: $1, SubExprs: $3, VarArg: true} + $$.SetPosition($1.Position()) + } + | expr '(' exprs ')' + { + $$ = &ast.AnonCallExpr{Expr: $1, SubExprs: $3} + $$.SetPosition($1.Position()) + } + | GO expr '(' exprs VARARG ')' + { + $$ = &ast.AnonCallExpr{Expr: $2, SubExprs: $4, VarArg: true, Go: true} + $$.SetPosition($2.Position()) + } + | GO expr '(' exprs ')' + { + $$ = &ast.AnonCallExpr{Expr: $2, SubExprs: $4, Go: true} + $$.SetPosition($1.Position()) + } + | IDENT '[' expr ']' + { + $$ = &ast.ItemExpr{Value: &ast.IdentExpr{Lit: $1.Lit}, Index: $3} + $$.SetPosition($1.Position()) + } + | expr '[' expr ']' + { + $$ = &ast.ItemExpr{Value: $1, Index: $3} + $$.SetPosition($1.Position()) + } + | IDENT '[' expr ':' expr ']' + { + $$ = &ast.SliceExpr{Value: &ast.IdentExpr{Lit: $1.Lit}, Begin: $3, End: $5} + $$.SetPosition($1.Position()) + } + | expr '[' expr ':' expr ']' + { + $$ = &ast.SliceExpr{Value: $1, Begin: $3, End: $5} + $$.SetPosition($1.Position()) + } + | MAKE '(' CHAN typ ')' + { + $$ = &ast.MakeChanExpr{Type: $4.Name, SizeExpr: nil} + $$.SetPosition($1.Position()) + } + | MAKE '(' CHAN typ ',' expr ')' + { + $$ = &ast.MakeChanExpr{Type: $4.Name, SizeExpr: $6} + $$.SetPosition($1.Position()) + } + | MAKE '(' ARRAYLIT typ ',' expr ')' + { + $$ = &ast.MakeArrayExpr{Type: $4.Name, LenExpr: $6} + $$.SetPosition($1.Position()) + } + | MAKE '(' ARRAYLIT typ ',' expr ',' expr ')' + { + $$ = &ast.MakeArrayExpr{Type: $4.Name, LenExpr: $6, CapExpr: $8} + $$.SetPosition($1.Position()) + } + | expr OPCHAN expr + { + $$ = &ast.ChanExpr{Lhs: $1, Rhs: $3} + $$.SetPosition($1.Position()) + } + | OPCHAN expr + { + $$ = &ast.ChanExpr{Rhs: $2} + $$.SetPosition($2.Position()) + } + +opt_terms : /* none */ + | terms + ; + + +terms : term + { + } + | terms term + { + } + ; + +term : ';' + { + } + | '\n' + { + } + ; + +%% diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/doc.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/doc.go new file mode 100644 index 0000000000..6bbb194516 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/doc.go @@ -0,0 +1,2 @@ +// Package vm implements virtual-machine for anko. +package vm diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/env.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/env.go new file mode 100644 index 0000000000..0e431e2b33 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/env.go @@ -0,0 +1,258 @@ +package vm + +import ( + "fmt" + "reflect" + "strings" + "sync" + + "github.com/mattn/anko/parser" +) + +// Env provides interface to run VM. This mean function scope and blocked-scope. +// If stack goes to blocked-scope, it will make new Env. +type Env struct { + name string + env map[string]reflect.Value + typ map[string]reflect.Type + parent *Env + interrupt *bool + sync.RWMutex +} + +// NewEnv creates new global scope. +func NewEnv() *Env { + b := false + + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: nil, + interrupt: &b, + } +} + +// NewEnv creates new child scope. +func (e *Env) NewEnv() *Env { + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: e, + name: e.name, + interrupt: e.interrupt, + } +} + +func NewPackage(n string) *Env { + b := false + + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: nil, + name: n, + interrupt: &b, + } +} + +func (e *Env) NewPackage(n string) *Env { + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: e, + name: n, + interrupt: e.interrupt, + } +} + +// Destroy deletes current scope. +func (e *Env) Destroy() { + e.Lock() + defer e.Unlock() + + if e.parent == nil { + return + } + for k, v := range e.parent.env { + if v.IsValid() && v.Interface() == e { + delete(e.parent.env, k) + } + } + e.parent = nil + e.env = nil +} + +// NewModule creates new module scope as global. +func (e *Env) NewModule(n string) *Env { + m := &Env{ + env: make(map[string]reflect.Value), + parent: e, + name: n, + } + e.Define(n, m) + return m +} + +// SetName sets a name of the scope. This means that the scope is module. +func (e *Env) SetName(n string) { + e.Lock() + e.name = n + e.Unlock() +} + +// GetName returns module name. +func (e *Env) GetName() string { + e.RLock() + defer e.RUnlock() + + return e.name +} + +// Addr returns pointer value which specified symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Addr(k string) (reflect.Value, error) { + e.RLock() + defer e.RUnlock() + + if v, ok := e.env[k]; ok { + return v.Addr(), nil + } + if e.parent == nil { + return NilValue, fmt.Errorf("Undefined symbol '%s'", k) + } + return e.parent.Addr(k) +} + +// Type returns type which specified symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Type(k string) (reflect.Type, error) { + e.RLock() + defer e.RUnlock() + + if v, ok := e.typ[k]; ok { + return v, nil + } + if e.parent == nil { + return NilType, fmt.Errorf("Undefined type '%s'", k) + } + return e.parent.Type(k) +} + +// Get returns value which specified symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Get(k string) (reflect.Value, error) { + e.RLock() + defer e.RUnlock() + + if v, ok := e.env[k]; ok { + return v, nil + } + if e.parent == nil { + return NilValue, fmt.Errorf("Undefined symbol '%s'", k) + } + return e.parent.Get(k) +} + +// Set modifies value which specified as symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Set(k string, v interface{}) error { + e.Lock() + defer e.Unlock() + + if _, ok := e.env[k]; ok { + val, ok := v.(reflect.Value) + if !ok { + val = reflect.ValueOf(v) + } + e.env[k] = val + return nil + } + if e.parent == nil { + return fmt.Errorf("Unknown symbol '%s'", k) + } + return e.parent.Set(k, v) +} + +// DefineGlobal defines symbol in global scope. +func (e *Env) DefineGlobal(k string, v interface{}) error { + if e.parent == nil { + return e.Define(k, v) + } + return e.parent.DefineGlobal(k, v) +} + +// DefineType defines type which specifis symbol in global scope. +func (e *Env) DefineType(k string, t interface{}) error { + if strings.Contains(k, ".") { + return fmt.Errorf("Unknown symbol '%s'", k) + } + global := e + keys := []string{k} + + e.RLock() + for global.parent != nil { + if global.name != "" { + keys = append(keys, global.name) + } + global = global.parent + } + e.RUnlock() + + for i, j := 0, len(keys)-1; i < j; i, j = i+1, j-1 { + keys[i], keys[j] = keys[j], keys[i] + } + + typ, ok := t.(reflect.Type) + if !ok { + typ = reflect.TypeOf(t) + } + + global.Lock() + global.typ[strings.Join(keys, ".")] = typ + global.Unlock() + + return nil +} + +// Define defines symbol in current scope. +func (e *Env) Define(k string, v interface{}) error { + if strings.Contains(k, ".") { + return fmt.Errorf("Unknown symbol '%s'", k) + } + val, ok := v.(reflect.Value) + if !ok { + val = reflect.ValueOf(v) + } + + e.Lock() + e.env[k] = val + e.Unlock() + + return nil +} + +// String return the name of current scope. +func (e *Env) String() string { + e.RLock() + defer e.RUnlock() + + return e.name +} + +// Dump show symbol values in the scope. +func (e *Env) Dump() { + e.RLock() + for k, v := range e.env { + fmt.Printf("%v = %#v\n", k, v) + } + e.RUnlock() +} + +// Execute parses and runs source in current scope. +func (e *Env) Execute(src string) (reflect.Value, error) { + stmts, err := parser.ParseSrc(src) + if err != nil { + return NilValue, err + } + return Run(stmts, e) +} diff --git a/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/vm.go b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/vm.go new file mode 100644 index 0000000000..7e85d5b438 --- /dev/null +++ b/vendor/github.com/leonelquinteros/gotext/vendor/github.com/mattn/anko/vm/vm.go @@ -0,0 +1,1504 @@ +package vm + +import ( + "errors" + "fmt" + "math" + "os" + "reflect" + "strconv" + "strings" + + "github.com/mattn/anko/ast" + "github.com/mattn/anko/parser" +) + +var ( + NilValue = reflect.ValueOf((*interface{})(nil)) + NilType = reflect.TypeOf((*interface{})(nil)) + TrueValue = reflect.ValueOf(true) + FalseValue = reflect.ValueOf(false) +) + +// Error provides a convenient interface for handling runtime error. +// It can be Error interface with type cast which can call Pos(). +type Error struct { + Message string + Pos ast.Position +} + +var ( + BreakError = errors.New("Unexpected break statement") + ContinueError = errors.New("Unexpected continue statement") + ReturnError = errors.New("Unexpected return statement") + InterruptError = errors.New("Execution interrupted") +) + +// NewStringError makes error interface with message. +func NewStringError(pos ast.Pos, err string) error { + if pos == nil { + return &Error{Message: err, Pos: ast.Position{1, 1}} + } + return &Error{Message: err, Pos: pos.Position()} +} + +// NewErrorf makes error interface with message. +func NewErrorf(pos ast.Pos, format string, args ...interface{}) error { + return &Error{Message: fmt.Sprintf(format, args...), Pos: pos.Position()} +} + +// NewError makes error interface with message. +// This doesn't overwrite last error. +func NewError(pos ast.Pos, err error) error { + if err == nil { + return nil + } + if err == BreakError || err == ContinueError || err == ReturnError { + return err + } + if pe, ok := err.(*parser.Error); ok { + return pe + } + if ee, ok := err.(*Error); ok { + return ee + } + return &Error{Message: err.Error(), Pos: pos.Position()} +} + +// Error returns the error message. +func (e *Error) Error() string { + return e.Message +} + +// Func is function interface to reflect functions internaly. +type Func func(args ...reflect.Value) (reflect.Value, error) + +func (f Func) String() string { + return fmt.Sprintf("[Func: %p]", f) +} + +func ToFunc(f Func) reflect.Value { + return reflect.ValueOf(f) +} + +// Run executes statements in the specified environment. +func Run(stmts []ast.Stmt, env *Env) (reflect.Value, error) { + rv := NilValue + var err error + for _, stmt := range stmts { + if _, ok := stmt.(*ast.BreakStmt); ok { + return NilValue, BreakError + } + if _, ok := stmt.(*ast.ContinueStmt); ok { + return NilValue, ContinueError + } + rv, err = RunSingleStmt(stmt, env) + if err != nil { + return rv, err + } + if _, ok := stmt.(*ast.ReturnStmt); ok { + return reflect.ValueOf(rv), ReturnError + } + } + return rv, nil +} + +// Interrupts the execution of any running statements in the specified environment. +// +// Note that the execution is not instantly aborted: after a call to Interrupt, +// the current running statement will finish, but the next statement will not run, +// and instead will return a NilValue and an InterruptError. +func Interrupt(env *Env) { + env.Lock() + *(env.interrupt) = true + env.Unlock() +} + +// RunSingleStmt executes one statement in the specified environment. +func RunSingleStmt(stmt ast.Stmt, env *Env) (reflect.Value, error) { + env.Lock() + if *(env.interrupt) { + *(env.interrupt) = false + env.Unlock() + + return NilValue, InterruptError + } + env.Unlock() + + switch stmt := stmt.(type) { + case *ast.ExprStmt: + rv, err := invokeExpr(stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + return rv, nil + case *ast.VarStmt: + rv := NilValue + var err error + rvs := []reflect.Value{} + for _, expr := range stmt.Exprs { + rv, err = invokeExpr(expr, env) + if err != nil { + return rv, NewError(expr, err) + } + rvs = append(rvs, rv) + } + result := []interface{}{} + for i, name := range stmt.Names { + if i < len(rvs) { + env.Define(name, rvs[i]) + result = append(result, rvs[i].Interface()) + } + } + return reflect.ValueOf(result), nil + case *ast.LetsStmt: + rv := NilValue + var err error + vs := []interface{}{} + for _, rhs := range stmt.Rhss { + rv, err = invokeExpr(rhs, env) + if err != nil { + return rv, NewError(rhs, err) + } + if rv == NilValue { + vs = append(vs, nil) + } else if rv.IsValid() && rv.CanInterface() { + vs = append(vs, rv.Interface()) + } else { + vs = append(vs, nil) + } + } + rvs := reflect.ValueOf(vs) + if len(stmt.Lhss) > 1 && rvs.Len() == 1 { + item := rvs.Index(0) + if item.Kind() == reflect.Interface { + item = item.Elem() + } + if item.Kind() == reflect.Slice { + rvs = item + } + } + for i, lhs := range stmt.Lhss { + if i >= rvs.Len() { + break + } + v := rvs.Index(i) + if v.Kind() == reflect.Interface { + v = v.Elem() + } + _, err = invokeLetExpr(lhs, v, env) + if err != nil { + return rvs, NewError(lhs, err) + } + } + if rvs.Len() == 1 { + return rvs.Index(0), nil + } + return rvs, nil + case *ast.IfStmt: + // If + rv, err := invokeExpr(stmt.If, env) + if err != nil { + return rv, NewError(stmt, err) + } + if toBool(rv) { + // Then + newenv := env.NewEnv() + defer newenv.Destroy() + rv, err = Run(stmt.Then, newenv) + if err != nil { + return rv, NewError(stmt, err) + } + return rv, nil + } + done := false + if len(stmt.ElseIf) > 0 { + for _, stmt := range stmt.ElseIf { + stmt_if := stmt.(*ast.IfStmt) + // ElseIf + rv, err = invokeExpr(stmt_if.If, env) + if err != nil { + return rv, NewError(stmt, err) + } + if !toBool(rv) { + continue + } + // ElseIf Then + done = true + rv, err = Run(stmt_if.Then, env) + if err != nil { + return rv, NewError(stmt, err) + } + break + } + } + if !done && len(stmt.Else) > 0 { + // Else + newenv := env.NewEnv() + defer newenv.Destroy() + rv, err = Run(stmt.Else, newenv) + if err != nil { + return rv, NewError(stmt, err) + } + } + return rv, nil + case *ast.TryStmt: + newenv := env.NewEnv() + defer newenv.Destroy() + _, err := Run(stmt.Try, newenv) + if err != nil { + // Catch + cenv := env.NewEnv() + defer cenv.Destroy() + if stmt.Var != "" { + cenv.Define(stmt.Var, reflect.ValueOf(err)) + } + _, e1 := Run(stmt.Catch, cenv) + if e1 != nil { + err = NewError(stmt.Catch[0], e1) + } else { + err = nil + } + } + if len(stmt.Finally) > 0 { + // Finally + fenv := env.NewEnv() + defer fenv.Destroy() + _, e2 := Run(stmt.Finally, newenv) + if e2 != nil { + err = NewError(stmt.Finally[0], e2) + } + } + return NilValue, NewError(stmt, err) + case *ast.LoopStmt: + newenv := env.NewEnv() + defer newenv.Destroy() + for { + if stmt.Expr != nil { + ev, ee := invokeExpr(stmt.Expr, newenv) + if ee != nil { + return ev, ee + } + if !toBool(ev) { + break + } + } + + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + if err == BreakError { + err = nil + break + } + if err == ContinueError { + err = nil + continue + } + if err == ReturnError { + return rv, err + } + return rv, NewError(stmt, err) + } + } + return NilValue, nil + case *ast.ForStmt: + val, ee := invokeExpr(stmt.Value, env) + if ee != nil { + return val, ee + } + if val.Kind() == reflect.Interface { + val = val.Elem() + } + if val.Kind() != reflect.Array && val.Kind() != reflect.Slice { + return NilValue, NewStringError(stmt, "Invalid operation for non-array value") + } + newenv := env.NewEnv() + defer newenv.Destroy() + + for i := 0; i < val.Len(); i++ { + iv := val.Index(i) + if val.Index(i).Kind() == reflect.Interface || val.Index(i).Kind() == reflect.Ptr { + iv = iv.Elem() + } + newenv.Define(stmt.Var, iv) + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + if err == BreakError { + err = nil + break + } + if err == ContinueError { + err = nil + continue + } + if err == ReturnError { + return rv, err + } + return rv, NewError(stmt, err) + } + } + return NilValue, nil + case *ast.CForStmt: + newenv := env.NewEnv() + defer newenv.Destroy() + _, err := invokeExpr(stmt.Expr1, newenv) + if err != nil { + return NilValue, err + } + for { + fb, err := invokeExpr(stmt.Expr2, newenv) + if err != nil { + return NilValue, err + } + if !toBool(fb) { + break + } + + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + if err == BreakError { + err = nil + break + } + if err == ContinueError { + err = nil + continue + } + if err == ReturnError { + return rv, err + } + return rv, NewError(stmt, err) + } + _, err = invokeExpr(stmt.Expr3, newenv) + if err != nil { + return NilValue, err + } + } + return NilValue, nil + case *ast.ReturnStmt: + rvs := []interface{}{} + switch len(stmt.Exprs) { + case 0: + return NilValue, nil + case 1: + rv, err := invokeExpr(stmt.Exprs[0], env) + if err != nil { + return rv, NewError(stmt, err) + } + return rv, nil + } + for _, expr := range stmt.Exprs { + rv, err := invokeExpr(expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + if isNil(rv) { + rvs = append(rvs, nil) + } else if rv.IsValid() { + rvs = append(rvs, rv.Interface()) + } else { + rvs = append(rvs, nil) + } + } + return reflect.ValueOf(rvs), nil + case *ast.ThrowStmt: + rv, err := invokeExpr(stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + if !rv.IsValid() { + return NilValue, NewError(stmt, err) + } + return rv, NewStringError(stmt, fmt.Sprint(rv.Interface())) + case *ast.ModuleStmt: + newenv := env.NewEnv() + newenv.SetName(stmt.Name) + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + return rv, NewError(stmt, err) + } + env.DefineGlobal(stmt.Name, reflect.ValueOf(newenv)) + return rv, nil + case *ast.SwitchStmt: + rv, err := invokeExpr(stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + done := false + var default_stmt *ast.DefaultStmt + for _, ss := range stmt.Cases { + if ssd, ok := ss.(*ast.DefaultStmt); ok { + default_stmt = ssd + continue + } + case_stmt := ss.(*ast.CaseStmt) + cv, err := invokeExpr(case_stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + if !equal(rv, cv) { + continue + } + rv, err = Run(case_stmt.Stmts, env) + if err != nil { + return rv, NewError(stmt, err) + } + done = true + break + } + if !done && default_stmt != nil { + rv, err = Run(default_stmt.Stmts, env) + if err != nil { + return rv, NewError(stmt, err) + } + } + return rv, nil + default: + return NilValue, NewStringError(stmt, "unknown statement") + } +} + +// toString converts all reflect.Value-s into string. +func toString(v reflect.Value) string { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.String { + return v.String() + } + if !v.IsValid() { + return "nil" + } + return fmt.Sprint(v.Interface()) +} + +// toBool converts all reflect.Value-s into bool. +func toBool(v reflect.Value) bool { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + + switch v.Kind() { + case reflect.Float32, reflect.Float64: + return v.Float() != 0.0 + case reflect.Int, reflect.Int32, reflect.Int64: + return v.Int() != 0 + case reflect.Bool: + return v.Bool() + case reflect.String: + if v.String() == "true" { + return true + } + if toInt64(v) != 0 { + return true + } + } + return false +} + +// toFloat64 converts all reflect.Value-s into float64. +func toFloat64(v reflect.Value) float64 { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + switch v.Kind() { + case reflect.Float32, reflect.Float64: + return v.Float() + case reflect.Int, reflect.Int32, reflect.Int64: + return float64(v.Int()) + } + return 0.0 +} + +func isNil(v reflect.Value) bool { + if !v.IsValid() || v.Kind().String() == "unsafe.Pointer" { + return true + } + if (v.Kind() == reflect.Interface || v.Kind() == reflect.Ptr) && v.IsNil() { + return true + } + return false +} + +func isNum(v reflect.Value) bool { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: + return true + } + return false +} + +// equal returns true when lhsV and rhsV is same value. +func equal(lhsV, rhsV reflect.Value) bool { + lhsIsNil, rhsIsNil := isNil(lhsV), isNil(rhsV) + if lhsIsNil && rhsIsNil { + return true + } + if (!lhsIsNil && rhsIsNil) || (lhsIsNil && !rhsIsNil) { + return false + } + if lhsV.Kind() == reflect.Interface || lhsV.Kind() == reflect.Ptr { + lhsV = lhsV.Elem() + } + if rhsV.Kind() == reflect.Interface || rhsV.Kind() == reflect.Ptr { + rhsV = rhsV.Elem() + } + if !lhsV.IsValid() || !rhsV.IsValid() { + return true + } + if isNum(lhsV) && isNum(rhsV) { + if rhsV.Type().ConvertibleTo(lhsV.Type()) { + rhsV = rhsV.Convert(lhsV.Type()) + } + } + if lhsV.CanInterface() && rhsV.CanInterface() { + return reflect.DeepEqual(lhsV.Interface(), rhsV.Interface()) + } + return reflect.DeepEqual(lhsV, rhsV) +} + +// toInt64 converts all reflect.Value-s into int64. +func toInt64(v reflect.Value) int64 { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + switch v.Kind() { + case reflect.Float32, reflect.Float64: + return int64(v.Float()) + case reflect.Int, reflect.Int32, reflect.Int64: + return v.Int() + case reflect.String: + s := v.String() + var i int64 + var err error + if strings.HasPrefix(s, "0x") { + i, err = strconv.ParseInt(s, 16, 64) + } else { + i, err = strconv.ParseInt(s, 10, 64) + } + if err == nil { + return int64(i) + } + } + return 0 +} + +func invokeLetExpr(expr ast.Expr, rv reflect.Value, env *Env) (reflect.Value, error) { + switch lhs := expr.(type) { + case *ast.IdentExpr: + if env.Set(lhs.Lit, rv) != nil { + if strings.Contains(lhs.Lit, ".") { + return NilValue, NewErrorf(expr, "Undefined symbol '%s'", lhs.Lit) + } + env.Define(lhs.Lit, rv) + } + return rv, nil + case *ast.MemberExpr: + v, err := invokeExpr(lhs.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + + if !v.IsValid() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + v = v.FieldByName(lhs.Name) + if !v.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + v.Set(rv) + } else if v.Kind() == reflect.Map { + v.SetMapIndex(reflect.ValueOf(lhs.Name), rv) + } else { + if !v.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + v.Set(rv) + } + return v, nil + case *ast.ItemExpr: + v, err := invokeExpr(lhs.Value, env) + if err != nil { + return v, NewError(expr, err) + } + i, err := invokeExpr(lhs.Index, env) + if err != nil { + return i, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if i.Kind() != reflect.Int && i.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(i.Int()) + if ii < 0 || ii >= v.Len() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv := v.Index(ii) + if !vv.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv.Set(rv) + return rv, nil + } + if v.Kind() == reflect.Map { + if i.Kind() != reflect.String { + return NilValue, NewStringError(expr, "Map key should be string") + } + v.SetMapIndex(i, rv) + return rv, nil + } + return v, NewStringError(expr, "Invalid operation") + case *ast.SliceExpr: + v, err := invokeExpr(lhs.Value, env) + if err != nil { + return v, NewError(expr, err) + } + rb, err := invokeExpr(lhs.Begin, env) + if err != nil { + return rb, NewError(expr, err) + } + re, err := invokeExpr(lhs.End, env) + if err != nil { + return re, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if rb.Kind() != reflect.Int && rb.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + if re.Kind() != reflect.Int && re.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(rb.Int()) + if ii < 0 || ii >= v.Len() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + ij := int(re.Int()) + if ij < 0 || ij >= v.Len() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv := v.Slice(ii, ij) + if !vv.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv.Set(rv) + return rv, nil + } + return v, NewStringError(expr, "Invalid operation") + } + return NilValue, NewStringError(expr, "Invalid operation") +} + +// invokeExpr evaluates one expression. +func invokeExpr(expr ast.Expr, env *Env) (reflect.Value, error) { + switch e := expr.(type) { + case *ast.NumberExpr: + if strings.Contains(e.Lit, ".") || strings.Contains(e.Lit, "e") { + v, err := strconv.ParseFloat(e.Lit, 64) + if err != nil { + return NilValue, NewError(expr, err) + } + return reflect.ValueOf(float64(v)), nil + } + var i int64 + var err error + if strings.HasPrefix(e.Lit, "0x") { + i, err = strconv.ParseInt(e.Lit[2:], 16, 64) + } else { + i, err = strconv.ParseInt(e.Lit, 10, 64) + } + if err != nil { + return NilValue, NewError(expr, err) + } + return reflect.ValueOf(i), nil + case *ast.IdentExpr: + return env.Get(e.Lit) + case *ast.StringExpr: + return reflect.ValueOf(e.Lit), nil + case *ast.ArrayExpr: + a := make([]interface{}, len(e.Exprs)) + for i, expr := range e.Exprs { + arg, err := invokeExpr(expr, env) + if err != nil { + return arg, NewError(expr, err) + } + a[i] = arg.Interface() + } + return reflect.ValueOf(a), nil + case *ast.MapExpr: + m := make(map[string]interface{}) + for k, expr := range e.MapExpr { + v, err := invokeExpr(expr, env) + if err != nil { + return v, NewError(expr, err) + } + m[k] = v.Interface() + } + return reflect.ValueOf(m), nil + case *ast.DerefExpr: + v := NilValue + var err error + switch ee := e.Expr.(type) { + case *ast.IdentExpr: + v, err = env.Get(ee.Lit) + if err != nil { + return v, err + } + case *ast.MemberExpr: + v, err := invokeExpr(ee.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + if v.IsValid() && v.CanInterface() { + if vme, ok := v.Interface().(*Env); ok { + m, err := vme.Get(ee.Name) + if !m.IsValid() || err != nil { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + return m, nil + } + } + + m := v.MethodByName(ee.Name) + if !m.IsValid() { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + m = v.FieldByName(ee.Name) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else if v.Kind() == reflect.Map { + m = v.MapIndex(reflect.ValueOf(ee.Name)) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + v = m + } else { + v = m + } + default: + return NilValue, NewStringError(expr, "Invalid operation for the value") + } + if v.Kind() != reflect.Ptr { + return NilValue, NewStringError(expr, "Cannot deference for the value") + } + return v.Addr(), nil + case *ast.AddrExpr: + v := NilValue + var err error + switch ee := e.Expr.(type) { + case *ast.IdentExpr: + v, err = env.Get(ee.Lit) + if err != nil { + return v, err + } + case *ast.MemberExpr: + v, err := invokeExpr(ee.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + if v.IsValid() && v.CanInterface() { + if vme, ok := v.Interface().(*Env); ok { + m, err := vme.Get(ee.Name) + if !m.IsValid() || err != nil { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + return m, nil + } + } + + m := v.MethodByName(ee.Name) + if !m.IsValid() { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + m = v.FieldByName(ee.Name) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else if v.Kind() == reflect.Map { + m = v.MapIndex(reflect.ValueOf(ee.Name)) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + v = m + } else { + v = m + } + default: + return NilValue, NewStringError(expr, "Invalid operation for the value") + } + if !v.CanAddr() { + i := v.Interface() + return reflect.ValueOf(&i), nil + } + return v.Addr(), nil + case *ast.UnaryExpr: + v, err := invokeExpr(e.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + switch e.Operator { + case "-": + if v.Kind() == reflect.Float64 { + return reflect.ValueOf(-v.Float()), nil + } + return reflect.ValueOf(-v.Int()), nil + case "^": + return reflect.ValueOf(^toInt64(v)), nil + case "!": + return reflect.ValueOf(!toBool(v)), nil + default: + return NilValue, NewStringError(e, "Unknown operator ''") + } + case *ast.ParenExpr: + v, err := invokeExpr(e.SubExpr, env) + if err != nil { + return v, NewError(expr, err) + } + return v, nil + case *ast.FuncExpr: + f := reflect.ValueOf(func(expr *ast.FuncExpr, env *Env) Func { + return func(args ...reflect.Value) (reflect.Value, error) { + if !expr.VarArg { + if len(args) != len(expr.Args) { + return NilValue, NewStringError(expr, "Arguments Number of mismatch") + } + } + newenv := env.NewEnv() + if expr.VarArg { + newenv.Define(expr.Args[0], reflect.ValueOf(args)) + } else { + for i, arg := range expr.Args { + newenv.Define(arg, args[i]) + } + } + rr, err := Run(expr.Stmts, newenv) + if err == ReturnError { + err = nil + rr = rr.Interface().(reflect.Value) + } + return rr, err + } + }(e, env)) + env.Define(e.Name, f) + return f, nil + case *ast.MemberExpr: + v, err := invokeExpr(e.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + if v.IsValid() && v.CanInterface() { + if vme, ok := v.Interface().(*Env); ok { + m, err := vme.Get(e.Name) + if !m.IsValid() || err != nil { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + return m, nil + } + } + + m := v.MethodByName(e.Name) + if !m.IsValid() { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + m = v.FieldByName(e.Name) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + } else if v.Kind() == reflect.Map { + m = v.MapIndex(reflect.ValueOf(e.Name)) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + } else { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + } + return m, nil + case *ast.ItemExpr: + v, err := invokeExpr(e.Value, env) + if err != nil { + return v, NewError(expr, err) + } + i, err := invokeExpr(e.Index, env) + if err != nil { + return i, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if i.Kind() != reflect.Int && i.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(i.Int()) + if ii < 0 || ii >= v.Len() { + return NilValue, nil + } + return v.Index(ii), nil + } + if v.Kind() == reflect.Map { + if i.Kind() != reflect.String { + return NilValue, NewStringError(expr, "Map key should be string") + } + return v.MapIndex(i), nil + } + if v.Kind() == reflect.String { + rs := []rune(v.Interface().(string)) + ii := int(i.Int()) + if ii < 0 || ii >= len(rs) { + return NilValue, nil + } + return reflect.ValueOf(rs[ii]), nil + } + return v, NewStringError(expr, "Invalid operation") + case *ast.SliceExpr: + v, err := invokeExpr(e.Value, env) + if err != nil { + return v, NewError(expr, err) + } + rb, err := invokeExpr(e.Begin, env) + if err != nil { + return rb, NewError(expr, err) + } + re, err := invokeExpr(e.End, env) + if err != nil { + return re, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if rb.Kind() != reflect.Int && rb.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + if re.Kind() != reflect.Int && re.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(rb.Int()) + if ii < 0 || ii > v.Len() { + return NilValue, nil + } + ij := int(re.Int()) + if ij < 0 || ij > v.Len() { + return v, nil + } + return v.Slice(ii, ij), nil + } + if v.Kind() == reflect.String { + if rb.Kind() != reflect.Int && rb.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + if re.Kind() != reflect.Int && re.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + r := []rune(v.String()) + ii := int(rb.Int()) + if ii < 0 || ii >= len(r) { + return NilValue, nil + } + ij := int(re.Int()) + if ij < 0 || ij >= len(r) { + return NilValue, nil + } + return reflect.ValueOf(string(r[ii:ij])), nil + } + return v, NewStringError(expr, "Invalid operation") + case *ast.AssocExpr: + switch e.Operator { + case "++": + if alhs, ok := e.Lhs.(*ast.IdentExpr); ok { + v, err := env.Get(alhs.Lit) + if err != nil { + return v, err + } + if v.Kind() == reflect.Float64 { + v = reflect.ValueOf(toFloat64(v) + 1.0) + } else { + v = reflect.ValueOf(toInt64(v) + 1) + } + if env.Set(alhs.Lit, v) != nil { + env.Define(alhs.Lit, v) + } + return v, nil + } + case "--": + if alhs, ok := e.Lhs.(*ast.IdentExpr); ok { + v, err := env.Get(alhs.Lit) + if err != nil { + return v, err + } + if v.Kind() == reflect.Float64 { + v = reflect.ValueOf(toFloat64(v) - 1.0) + } else { + v = reflect.ValueOf(toInt64(v) - 1) + } + if env.Set(alhs.Lit, v) != nil { + env.Define(alhs.Lit, v) + } + return v, nil + } + } + + v, err := invokeExpr(&ast.BinOpExpr{Lhs: e.Lhs, Operator: e.Operator[0:1], Rhs: e.Rhs}, env) + if err != nil { + return v, err + } + + if v.Kind() == reflect.Interface { + v = v.Elem() + } + return invokeLetExpr(e.Lhs, v, env) + case *ast.LetExpr: + rv, err := invokeExpr(e.Rhs, env) + if err != nil { + return rv, NewError(e, err) + } + if rv.Kind() == reflect.Interface { + rv = rv.Elem() + } + return invokeLetExpr(e.Lhs, rv, env) + case *ast.LetsExpr: + rv := NilValue + var err error + vs := []interface{}{} + for _, rhs := range e.Rhss { + rv, err = invokeExpr(rhs, env) + if err != nil { + return rv, NewError(rhs, err) + } + if rv == NilValue { + vs = append(vs, nil) + } else if rv.IsValid() && rv.CanInterface() { + vs = append(vs, rv.Interface()) + } else { + vs = append(vs, nil) + } + } + rvs := reflect.ValueOf(vs) + if len(e.Lhss) > 1 && rvs.Len() == 1 { + item := rvs.Index(0) + if item.Kind() == reflect.Interface { + item = item.Elem() + } + if item.Kind() == reflect.Slice { + rvs = item + } + } + for i, lhs := range e.Lhss { + if i >= rvs.Len() { + break + } + v := rvs.Index(i) + if v.Kind() == reflect.Interface { + v = v.Elem() + } + _, err = invokeLetExpr(lhs, v, env) + if err != nil { + return rvs, NewError(lhs, err) + } + } + if rvs.Len() == 1 { + return rvs.Index(0), nil + } + return rvs, nil + //case *ast.NewExpr: + // println("NEW") + // return NilValue, nil + case *ast.BinOpExpr: + lhsV := NilValue + rhsV := NilValue + var err error + + lhsV, err = invokeExpr(e.Lhs, env) + if err != nil { + return lhsV, NewError(expr, err) + } + if lhsV.Kind() == reflect.Interface { + lhsV = lhsV.Elem() + } + if e.Rhs != nil { + rhsV, err = invokeExpr(e.Rhs, env) + if err != nil { + return rhsV, NewError(expr, err) + } + if rhsV.Kind() == reflect.Interface { + rhsV = rhsV.Elem() + } + } + switch e.Operator { + case "+": + if lhsV.Kind() == reflect.String || rhsV.Kind() == reflect.String { + return reflect.ValueOf(toString(lhsV) + toString(rhsV)), nil + } + if (lhsV.Kind() == reflect.Array || lhsV.Kind() == reflect.Slice) && (rhsV.Kind() != reflect.Array && rhsV.Kind() != reflect.Slice) { + return reflect.Append(lhsV, rhsV), nil + } + if (lhsV.Kind() == reflect.Array || lhsV.Kind() == reflect.Slice) && (rhsV.Kind() == reflect.Array || rhsV.Kind() == reflect.Slice) { + return reflect.AppendSlice(lhsV, rhsV), nil + } + if lhsV.Kind() == reflect.Float64 || rhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(toFloat64(lhsV) + toFloat64(rhsV)), nil + } + return reflect.ValueOf(toInt64(lhsV) + toInt64(rhsV)), nil + case "-": + if lhsV.Kind() == reflect.Float64 || rhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(toFloat64(lhsV) - toFloat64(rhsV)), nil + } + return reflect.ValueOf(toInt64(lhsV) - toInt64(rhsV)), nil + case "*": + if lhsV.Kind() == reflect.String && (rhsV.Kind() == reflect.Int || rhsV.Kind() == reflect.Int32 || rhsV.Kind() == reflect.Int64) { + return reflect.ValueOf(strings.Repeat(toString(lhsV), int(toInt64(rhsV)))), nil + } + if lhsV.Kind() == reflect.Float64 || rhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(toFloat64(lhsV) * toFloat64(rhsV)), nil + } + return reflect.ValueOf(toInt64(lhsV) * toInt64(rhsV)), nil + case "/": + return reflect.ValueOf(toFloat64(lhsV) / toFloat64(rhsV)), nil + case "%": + return reflect.ValueOf(toInt64(lhsV) % toInt64(rhsV)), nil + case "==": + return reflect.ValueOf(equal(lhsV, rhsV)), nil + case "!=": + return reflect.ValueOf(equal(lhsV, rhsV) == false), nil + case ">": + return reflect.ValueOf(toFloat64(lhsV) > toFloat64(rhsV)), nil + case ">=": + return reflect.ValueOf(toFloat64(lhsV) >= toFloat64(rhsV)), nil + case "<": + return reflect.ValueOf(toFloat64(lhsV) < toFloat64(rhsV)), nil + case "<=": + return reflect.ValueOf(toFloat64(lhsV) <= toFloat64(rhsV)), nil + case "|": + return reflect.ValueOf(toInt64(lhsV) | toInt64(rhsV)), nil + case "||": + if toBool(lhsV) { + return lhsV, nil + } + return rhsV, nil + case "&": + return reflect.ValueOf(toInt64(lhsV) & toInt64(rhsV)), nil + case "&&": + if toBool(lhsV) { + return rhsV, nil + } + return lhsV, nil + case "**": + if lhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(math.Pow(toFloat64(lhsV), toFloat64(rhsV))), nil + } + return reflect.ValueOf(int64(math.Pow(toFloat64(lhsV), toFloat64(rhsV)))), nil + case ">>": + return reflect.ValueOf(toInt64(lhsV) >> uint64(toInt64(rhsV))), nil + case "<<": + return reflect.ValueOf(toInt64(lhsV) << uint64(toInt64(rhsV))), nil + default: + return NilValue, NewStringError(expr, "Unknown operator") + } + case *ast.ConstExpr: + switch e.Value { + case "true": + return reflect.ValueOf(true), nil + case "false": + return reflect.ValueOf(false), nil + } + return reflect.ValueOf(nil), nil + case *ast.AnonCallExpr: + f, err := invokeExpr(e.Expr, env) + if err != nil { + return f, NewError(expr, err) + } + if f.Kind() == reflect.Interface { + f = f.Elem() + } + if f.Kind() != reflect.Func { + return f, NewStringError(expr, "Unknown function") + } + return invokeExpr(&ast.CallExpr{Func: f, SubExprs: e.SubExprs, VarArg: e.VarArg, Go: e.Go}, env) + case *ast.CallExpr: + f := NilValue + + if e.Func != nil { + f = e.Func.(reflect.Value) + } else { + var err error + ff, err := env.Get(e.Name) + if err != nil { + return f, err + } + f = ff + } + _, isReflect := f.Interface().(Func) + + args := []reflect.Value{} + l := len(e.SubExprs) + for i, expr := range e.SubExprs { + arg, err := invokeExpr(expr, env) + if err != nil { + return arg, NewError(expr, err) + } + + if i < f.Type().NumIn() { + if !f.Type().IsVariadic() { + it := f.Type().In(i) + if arg.Kind().String() == "unsafe.Pointer" { + arg = reflect.New(it).Elem() + } + if arg.Kind() != it.Kind() && arg.IsValid() && arg.Type().ConvertibleTo(it) { + arg = arg.Convert(it) + } else if arg.Kind() == reflect.Func { + if _, isFunc := arg.Interface().(Func); isFunc { + rfunc := arg + arg = reflect.MakeFunc(it, func(args []reflect.Value) []reflect.Value { + for i := range args { + args[i] = reflect.ValueOf(args[i]) + } + if e.Go { + go func() { + rfunc.Call(args) + }() + return []reflect.Value{} + } + return rfunc.Call(args)[:it.NumOut()] + }) + } + } else if !arg.IsValid() { + arg = reflect.Zero(it) + } + } + } + if !arg.IsValid() { + arg = NilValue + } + + if !isReflect { + if e.VarArg && i == l-1 { + for j := 0; j < arg.Len(); j++ { + args = append(args, arg.Index(j).Elem()) + } + } else { + args = append(args, arg) + } + } else { + if arg.Kind() == reflect.Interface { + arg = arg.Elem() + } + if e.VarArg && i == l-1 { + for j := 0; j < arg.Len(); j++ { + args = append(args, reflect.ValueOf(arg.Index(j).Elem())) + } + } else { + args = append(args, reflect.ValueOf(arg)) + } + } + } + ret := NilValue + var err error + fnc := func() { + defer func() { + if os.Getenv("ANKO_DEBUG") == "" { + if ex := recover(); ex != nil { + if e, ok := ex.(error); ok { + err = e + } else { + err = errors.New(fmt.Sprint(ex)) + } + } + } + }() + if f.Kind() == reflect.Interface { + f = f.Elem() + } + rets := f.Call(args) + if isReflect { + ev := rets[1].Interface() + if ev != nil { + err = ev.(error) + } + ret = rets[0].Interface().(reflect.Value) + } else { + for i, expr := range e.SubExprs { + if ae, ok := expr.(*ast.AddrExpr); ok { + if id, ok := ae.Expr.(*ast.IdentExpr); ok { + invokeLetExpr(id, args[i].Elem().Elem(), env) + } + } + } + if f.Type().NumOut() == 1 { + ret = rets[0] + } else { + var result []interface{} + for _, r := range rets { + result = append(result, r.Interface()) + } + ret = reflect.ValueOf(result) + } + } + } + if e.Go { + go fnc() + return NilValue, nil + } + fnc() + if err != nil { + return ret, NewError(expr, err) + } + return ret, nil + case *ast.TernaryOpExpr: + rv, err := invokeExpr(e.Expr, env) + if err != nil { + return rv, NewError(expr, err) + } + if toBool(rv) { + lhsV, err := invokeExpr(e.Lhs, env) + if err != nil { + return lhsV, NewError(expr, err) + } + return lhsV, nil + } + rhsV, err := invokeExpr(e.Rhs, env) + if err != nil { + return rhsV, NewError(expr, err) + } + return rhsV, nil + case *ast.MakeChanExpr: + typ, err := env.Type(e.Type) + if err != nil { + return NilValue, err + } + var size int + if e.SizeExpr != nil { + rv, err := invokeExpr(e.SizeExpr, env) + if err != nil { + return NilValue, err + } + size = int(toInt64(rv)) + } + return func() (reflect.Value, error) { + defer func() { + if os.Getenv("ANKO_DEBUG") == "" { + if ex := recover(); ex != nil { + if e, ok := ex.(error); ok { + err = e + } else { + err = errors.New(fmt.Sprint(ex)) + } + } + } + }() + return reflect.MakeChan(reflect.ChanOf(reflect.BothDir, typ), size), nil + }() + case *ast.MakeArrayExpr: + typ, err := env.Type(e.Type) + if err != nil { + return NilValue, err + } + var alen int + if e.LenExpr != nil { + rv, err := invokeExpr(e.LenExpr, env) + if err != nil { + return NilValue, err + } + alen = int(toInt64(rv)) + } + var acap int + if e.CapExpr != nil { + rv, err := invokeExpr(e.CapExpr, env) + if err != nil { + return NilValue, err + } + acap = int(toInt64(rv)) + } else { + acap = alen + } + return func() (reflect.Value, error) { + defer func() { + if os.Getenv("ANKO_DEBUG") == "" { + if ex := recover(); ex != nil { + if e, ok := ex.(error); ok { + err = e + } else { + err = errors.New(fmt.Sprint(ex)) + } + } + } + }() + return reflect.MakeSlice(reflect.SliceOf(typ), alen, acap), nil + }() + case *ast.ChanExpr: + rhs, err := invokeExpr(e.Rhs, env) + if err != nil { + return NilValue, NewError(expr, err) + } + + if e.Lhs == nil { + if rhs.Kind() == reflect.Chan { + rv, _ := rhs.Recv() + return rv, nil + } + } else { + lhs, err := invokeExpr(e.Lhs, env) + if err != nil { + return NilValue, NewError(expr, err) + } + if lhs.Kind() == reflect.Chan { + lhs.Send(rhs) + return NilValue, nil + } else if rhs.Kind() == reflect.Chan { + rv, _ := rhs.Recv() + return invokeLetExpr(e.Lhs, rv, env) + } + } + return NilValue, NewStringError(expr, "Invalid operation for chan") + default: + return NilValue, NewStringError(expr, "Unknown expression") + } +} diff --git a/vendor/github.com/mattn/anko/.travis.yml b/vendor/github.com/mattn/anko/.travis.yml new file mode 100644 index 0000000000..a6ccc91c8b --- /dev/null +++ b/vendor/github.com/mattn/anko/.travis.yml @@ -0,0 +1,10 @@ +language: go +go: + - tip +before_install: + - go get github.com/daviddengcn/go-colortext +script: + - go build + - ./t/test.sh + - ./anko ./_example/scripts/term.ank + diff --git a/vendor/github.com/mattn/anko/README.md b/vendor/github.com/mattn/anko/README.md new file mode 100644 index 0000000000..2bb218d10a --- /dev/null +++ b/vendor/github.com/mattn/anko/README.md @@ -0,0 +1,92 @@ +# anko + +[![Build Status](https://travis-ci.org/mattn/anko.png?branch=master)](https://travis-ci.org/mattn/anko) +[![GoDoc](https://godoc.org/github.com/mattn/anko/vm?status.svg)](https://godoc.org/github.com/mattn/anko/vm) + +Anko is a scriptable interpreter written in Go. + +![](https://raw.githubusercontent.com/mattn/anko/master/anko.png) + +(Picture licensed under CC BY-SA 3.0 by wikipedia) + +## Installation +Requires Go. +``` +$ go get -u github.com/mattn/anko +``` + +## Examples + +```bash +# declare function +func plus(n){ + return n + 1 +} + +# declare variables +x = 1 +y = x + 1 + +# print values +println(x * (y + 2 * x + plus(x) / 2)) + +# if/else condition +if plus(y) > 1 { + println("こんにちわ世界") +} else { + println("Hello, World") +} + +# array type +a = [1,2,3] +println(a[2]) +println(len(a)) + +# map type +m = {"foo": "bar", "far": "boo"} +m.foo = "baz" +for k in keys(m) { + println(m[k]) +} +``` + +See `_examples/scripts` for more examples. + + + +## Usage + +Embedding the interpreter into your own program: + +```Go +var env = vm.NewEnv() + +env.Define("foo", 1) +env.Define("bar", func() int { + return 2 +}) + +val, err := env.Execute(`foo + bar()`) +if err != nil { + panic(err) +} + +fmt.Println(val) +// output: +// 3 +``` + +Running scripts using anko command-line tool: + +``` +$ anko script.ank +``` + +# License + +MIT + +# Author + +Yasuhiro Matsumoto (a.k.a mattn) + diff --git a/vendor/github.com/mattn/anko/TODO b/vendor/github.com/mattn/anko/TODO new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vendor/github.com/mattn/anko/_example/embed/main.go b/vendor/github.com/mattn/anko/_example/embed/main.go new file mode 100644 index 0000000000..d82397c26b --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/embed/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "log" + + "github.com/mattn/anko/vm" +) + +func main() { + env := vm.NewEnv() + + env.Define("foo", 1) + env.Define("bar", func() int { + return 2 + }) + + v, err := env.Execute(`foo + bar()`) + if err != nil { + log.Fatal(err) + } + + fmt.Println(v) +} diff --git a/vendor/github.com/mattn/anko/_example/scripts/anonymous-call.ank b/vendor/github.com/mattn/anko/_example/scripts/anonymous-call.ank new file mode 100644 index 0000000000..df73133c2b --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/anonymous-call.ank @@ -0,0 +1,9 @@ +#!anko + +func(x) { + return func(y) { + x(y) + } +}(func(z) { + println("Yay!", z) +})("hello world") diff --git a/vendor/github.com/mattn/anko/_example/scripts/chan.ank b/vendor/github.com/mattn/anko/_example/scripts/chan.ank new file mode 100644 index 0000000000..18d6e78269 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/chan.ank @@ -0,0 +1,13 @@ +#!anko + +c = make(chan int64) + +go func() { + c <- 1 + c <- 2 + c <- 3 +}() + +println(<-c) +println(<-c) +println(<-c) diff --git a/vendor/github.com/mattn/anko/_example/scripts/env.ank b/vendor/github.com/mattn/anko/_example/scripts/env.ank new file mode 100644 index 0000000000..b98b7cc0bb --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/env.ank @@ -0,0 +1,9 @@ +#!anko + +var os, runtime = import("os"), import("runtime") + +if runtime.GOOS == "windows" { + println(os.Getenv("USERPROFILE")) +} else { + println(os.Getenv("HOME")) +} diff --git a/vendor/github.com/mattn/anko/_example/scripts/example.ank b/vendor/github.com/mattn/anko/_example/scripts/example.ank new file mode 100644 index 0000000000..77faad9074 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/example.ank @@ -0,0 +1,70 @@ +#!anko + +# declare function +func foo(x){ + return x + 1 +} + +func bar(x ...){ + return len(x) +} + +# declare variables +x = 1 +y = x + 1 + +# print values +println(x * (y + 2 * x + foo(x) / 2)) + +# if/else condition +if foo(y) >= 1 { + println("こんにちわ世界") +} else { + println("Hello, World") +} + +# array type +a = [1,2,3] +println(a) +println(a[2]) +println(len(a)) + +# map type +m = {"foo": "bar", "bar": "baz"} +for k in keys(m) { + println(m[k]) +} + +f = func(a) { + println(a) +} + +f("あんこ") + +f = func(a ...) { + println(a) +} + +f("あんこ", "だいすき") + +println(1 && 2) + +println(bar(1,2,3)) +println("foo") +println(toByteSlice("あいう")) +println(toRuneSlice("あいう")) + +a = 1 +func foo() { + a = 2 +} +foo() +println(a) + +module Foo { + func bar1() { + println("Foo.bar1") + } +} + +println(Foo.bar1()) diff --git a/vendor/github.com/mattn/anko/_example/scripts/exec.ank b/vendor/github.com/mattn/anko/_example/scripts/exec.ank new file mode 100644 index 0000000000..45b3988960 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/exec.ank @@ -0,0 +1,7 @@ +#!anko + +var os, exec = import("os"), import("os/exec") + +cmd = exec.Command("ls", "-la") +cmd.Stdout = os.Stdout +cmd.Run() diff --git a/vendor/github.com/mattn/anko/_example/scripts/fib-for.ank b/vendor/github.com/mattn/anko/_example/scripts/fib-for.ank new file mode 100644 index 0000000000..e4d8b1931b --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/fib-for.ank @@ -0,0 +1,15 @@ +#!anko + +func fib(n) { + a, b = 1, 1 + f = [] + for i in range(n) { + f += a + b += a + a = b - a + } + return f +} + + +println(fib(20)) diff --git a/vendor/github.com/mattn/anko/_example/scripts/fib-recursion.ank b/vendor/github.com/mattn/anko/_example/scripts/fib-recursion.ank new file mode 100644 index 0000000000..01cbab0329 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/fib-recursion.ank @@ -0,0 +1,14 @@ +#!anko + +func fib(n) { + if n == 1 { + return [1] + } else if n == 2 { + return [1,1] + } else { + t = fib(n-1) + return t + (t[len(t)-1] + t[len(t)-2]) + } +} + +println(fib(20)) diff --git a/vendor/github.com/mattn/anko/_example/scripts/for-break-continue.ank b/vendor/github.com/mattn/anko/_example/scripts/for-break-continue.ank new file mode 100644 index 0000000000..2f5185a154 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/for-break-continue.ank @@ -0,0 +1,12 @@ +#!anko + +for i in [1,2,3,4,5] { + if i == 2 { + continue + } + println(i) + if i > 3 { + break + } + println("foo") +} diff --git a/vendor/github.com/mattn/anko/_example/scripts/http.ank b/vendor/github.com/mattn/anko/_example/scripts/http.ank new file mode 100644 index 0000000000..eaa62adf6e --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/http.ank @@ -0,0 +1,8 @@ +#!anko + +var http, ioutil = import("net/http"), import("io/ioutil") + +r = http.DefaultClient.Get("http://golang.org/") +b, _ = ioutil.ReadAll(r[0].Body) +printf("%s", toString(b)) +r[0].Body.Close() diff --git a/vendor/github.com/mattn/anko/_example/scripts/module.ank b/vendor/github.com/mattn/anko/_example/scripts/module.ank new file mode 100644 index 0000000000..2a17d9079a --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/module.ank @@ -0,0 +1,10 @@ +#!anko + +module Foo { + func bar1() { + println("Foo.bar1") + return 1 + } +} + +println(Foo.bar1()) diff --git a/vendor/github.com/mattn/anko/_example/scripts/regexp.ank b/vendor/github.com/mattn/anko/_example/scripts/regexp.ank new file mode 100644 index 0000000000..27e2e65efb --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/regexp.ank @@ -0,0 +1,8 @@ +#!anko + +var regexp = import("regexp") + +for s in regexp.MustCompile(`[\s_]`).Split("foo_bar_baz", -1) { + println(s) +} + diff --git a/vendor/github.com/mattn/anko/_example/scripts/server.ank b/vendor/github.com/mattn/anko/_example/scripts/server.ank new file mode 100644 index 0000000000..1a7cfc779c --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/server.ank @@ -0,0 +1,8 @@ +#!anko + +var http = import("net/http") + +http.HandleFunc("/", func(w, r) { + w.Write(toByteSlice("hello world")) +}) +http.ListenAndServe(":8080", nil) diff --git a/vendor/github.com/mattn/anko/_example/scripts/signal.ank b/vendor/github.com/mattn/anko/_example/scripts/signal.ank new file mode 100644 index 0000000000..ccd64c519a --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/signal.ank @@ -0,0 +1,14 @@ +#!anko + +var os, signal, time = import("os"), import("os/signal"), import("time") + +c = make(chan os.Signal, 1) +signal.Notify(c, os.Interrupt) +go func() { + <-c + println("CTRL-C") + os.Exit(0) +}() + +d, _ = time.ParseDuration("10s") +time.Sleep(d) diff --git a/vendor/github.com/mattn/anko/_example/scripts/slice.ank b/vendor/github.com/mattn/anko/_example/scripts/slice.ank new file mode 100644 index 0000000000..3216ffb202 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/slice.ank @@ -0,0 +1,10 @@ +#!anko + +a = make([]int64, 5) + +for i = 0; i < len(a); i++ { + a[i] = i +} +for i in a { + println(i) +} diff --git a/vendor/github.com/mattn/anko/_example/scripts/socket.ank b/vendor/github.com/mattn/anko/_example/scripts/socket.ank new file mode 100644 index 0000000000..5e4c3f6f1a --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/socket.ank @@ -0,0 +1,26 @@ +#!anko + +var os, net, url, ioutil = import("os"), import("net"), import("net/url"), import("io/ioutil"); + +func connect(uri) { + proxy = os.Getenv("http_proxy") + if proxy != "" { + u, e = url.Parse(proxy) + if e != nil { + return nil, e + } + return net.Dial("tcp", u.Host) + } + return net.Dial("tcp", uri) +} + +c, e = connect("www.google.com:80") +if e != nil { + throw e +} +c.Write(toByteSlice("GET http://www.google.com/ HTTP/1.0\r\n\r\n")) +b, e = ioutil.ReadAll(c) +if e != nil { + throw e +} +printf("%s", b) diff --git a/vendor/github.com/mattn/anko/_example/scripts/term.ank b/vendor/github.com/mattn/anko/_example/scripts/term.ank new file mode 100644 index 0000000000..73e6851953 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/term.ank @@ -0,0 +1,60 @@ +#!anko + +var colortext = import("github.com/daviddengcn/go-colortext") + +data = [ +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOO OOO", +"OOOOOOOOOOOOOOOOOOOOO O . OOO", +"OOOOOOOOOOOOOOOOOOOO XXXX . OOOO", +"OOOOOOOOOOOOOOOOOOO XOXXXX OOOOO", +"OOOOOOOOOOOOOOOOOO XOXXXXXX OOOO", +"OOOOOOOOOOOOOOOOOO XXXXXXXX OOOO", +"OOOOOOOOOOOOOOOOOO XXXXXXXX OOOO", +"OOOOOOOOOOOOOOO XXXXXXX OOOO", +"OOOOOOOOOOOOOO OOOO XXXXX OOOOO", +"OOOOOOOOOOOOO OOOOOOO XXX OOOOOO", +"OOOOOOOOOOOO OOOOOOOO OOOOOOO", +"OOOOOOOOOOOO OOOOOOOOO OOOOOOOOO", +"OOOOOOOOOOOO OOOOOOOOO OOOOOOOOO", +"OOOOOOOOOO OOOOOOO OOOOOOOOO", +"OOOOOOOOO ooooo OOOOO OOOOOOOOOO", +"OOOOOOOO oOooooo OOO OOOOOOOOOOO", +"OOOOOOO oOoooooo OOOOOOOOOOOO", +"OOOOOOO ooooooooo OOOOOOOOOOOOOO", +"OOOOOOO ooooooooo OOOOOOOOOOOOOO", +"OOOOOOO ooooooooo OOOOOOOOOOOOOO", +"OOOOOOO o ooooo OOOOOOOOOOOOOO", +"OOOOOOOO . ooooo OOOOOOOOOOOOOOO", +"OOOOOOO . oooo OOOOOOOOOOOOOOOO", +"OOOOOO . O OOOOOOOOOOOOOOOOO", +"OOOOO . OOOOOOOOOOOOOOOOOOOOOOOO", +"OOOO . OOOOOOOOOOOOOOOOOOOOOOOOO", +"OOO . OOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOO OOOOOOOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", +] + +for d in data { + for b in toRuneSlice(d) { + switch toChar(b) { + case "O": + colortext.ChangeColor("none", false, "white", true) + case ".": + colortext.ChangeColor("none", false, "red", false) + case "X": + colortext.ChangeColor("none", false, "green", true) + case "o": + colortext.ChangeColor("none", false, "mazenta", true) + case " ": + colortext.ChangeColor("none", false, "black", false) + case "+": + colortext.ChangeColor("none", false, "white", true) + case "X": + colortext.ChangeColor("none", false, "red", false) + } + print(" ") + } + colortext.ResetColor() + println() +} diff --git a/vendor/github.com/mattn/anko/_example/scripts/try-catch.ank b/vendor/github.com/mattn/anko/_example/scripts/try-catch.ank new file mode 100644 index 0000000000..80029b38ee --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/try-catch.ank @@ -0,0 +1,19 @@ +#!anko + +var http = import("net/http") + +try { + http.Do() +} catch { + println("catch!") +} finally { + println("finally!") +} + +try { + http.Do() +} catch e { + println("catch!", e) +} finally { + println("finally!") +} diff --git a/vendor/github.com/mattn/anko/_example/scripts/url.ank b/vendor/github.com/mattn/anko/_example/scripts/url.ank new file mode 100644 index 0000000000..4454fc8b03 --- /dev/null +++ b/vendor/github.com/mattn/anko/_example/scripts/url.ank @@ -0,0 +1,7 @@ +#!anko + +var url = import("net/url") + +u, _ = url.Parse("http://www.google.com/search?q=こんにちわ世界") +println(u.Path) +println(u.Host) diff --git a/vendor/github.com/mattn/anko/anko.go b/vendor/github.com/mattn/anko/anko.go new file mode 100644 index 0000000000..181507260f --- /dev/null +++ b/vendor/github.com/mattn/anko/anko.go @@ -0,0 +1,238 @@ +// +build !appengine + +package main + +import ( + "bufio" + "flag" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "reflect" + "strings" + + "github.com/daviddengcn/go-colortext" + "github.com/mattn/anko/parser" + "github.com/mattn/anko/vm" + "github.com/mattn/go-isatty" + + anko_core "github.com/mattn/anko/builtins" + anko_encoding_json "github.com/mattn/anko/builtins/encoding/json" + anko_errors "github.com/mattn/anko/builtins/errors" + anko_flag "github.com/mattn/anko/builtins/flag" + anko_fmt "github.com/mattn/anko/builtins/fmt" + anko_io "github.com/mattn/anko/builtins/io" + anko_io_ioutil "github.com/mattn/anko/builtins/io/ioutil" + anko_math "github.com/mattn/anko/builtins/math" + anko_math_rand "github.com/mattn/anko/builtins/math/rand" + anko_net "github.com/mattn/anko/builtins/net" + anko_net_http "github.com/mattn/anko/builtins/net/http" + anko_net_url "github.com/mattn/anko/builtins/net/url" + anko_os "github.com/mattn/anko/builtins/os" + anko_os_exec "github.com/mattn/anko/builtins/os/exec" + anko_os_signal "github.com/mattn/anko/builtins/os/signal" + anko_path "github.com/mattn/anko/builtins/path" + anko_path_filepath "github.com/mattn/anko/builtins/path/filepath" + anko_regexp "github.com/mattn/anko/builtins/regexp" + anko_runtime "github.com/mattn/anko/builtins/runtime" + anko_sort "github.com/mattn/anko/builtins/sort" + anko_strings "github.com/mattn/anko/builtins/strings" + anko_time "github.com/mattn/anko/builtins/time" + + anko_colortext "github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext" +) + +const version = "0.0.1" + +var ( + fs = flag.NewFlagSet(os.Args[0], 1) + line = fs.String("e", "", "One line of program") + v = fs.Bool("v", false, "Display version") + + istty = isatty.IsTerminal(os.Stdout.Fd()) +) + +func colortext(color ct.Color, bright bool, f func()) { + if istty { + ct.ChangeColor(color, bright, ct.None, false) + f() + ct.ResetColor() + } else { + f() + } +} + +func main() { + fs.Parse(os.Args[1:]) + if *v { + fmt.Println(version) + os.Exit(0) + } + + var ( + code string + b []byte + reader *bufio.Reader + following bool + source string + ) + + env := vm.NewEnv() + interactive := fs.NArg() == 0 && *line == "" + + env.Define("args", fs.Args()) + + if interactive { + reader = bufio.NewReader(os.Stdin) + source = "typein" + os.Args = append([]string{os.Args[0]}, fs.Args()...) + } else { + if *line != "" { + b = []byte(*line) + source = "argument" + } else { + var err error + b, err = ioutil.ReadFile(fs.Arg(0)) + if err != nil { + colortext(ct.Red, false, func() { + fmt.Fprintln(os.Stderr, err) + }) + os.Exit(1) + } + env.Define("args", fs.Args()[1:]) + source = filepath.Clean(fs.Arg(0)) + } + os.Args = fs.Args() + } + + anko_core.Import(env) + + pkgs := map[string]func(env *vm.Env) *vm.Env{ + "encoding/json": anko_encoding_json.Import, + "errors": anko_errors.Import, + "flag": anko_flag.Import, + "fmt": anko_fmt.Import, + "io": anko_io.Import, + "io/ioutil": anko_io_ioutil.Import, + "math": anko_math.Import, + "math/rand": anko_math_rand.Import, + "net": anko_net.Import, + "net/http": anko_net_http.Import, + "net/url": anko_net_url.Import, + "os": anko_os.Import, + "os/exec": anko_os_exec.Import, + "os/signal": anko_os_signal.Import, + "path": anko_path.Import, + "path/filepath": anko_path_filepath.Import, + "regexp": anko_regexp.Import, + "runtime": anko_runtime.Import, + "sort": anko_sort.Import, + "strings": anko_strings.Import, + "time": anko_time.Import, + "github.com/daviddengcn/go-colortext": anko_colortext.Import, + } + + env.Define("import", func(s string) interface{} { + if loader, ok := pkgs[s]; ok { + m := loader(env) + return m + } + panic(fmt.Sprintf("package '%s' not found", s)) + }) + + for { + if interactive { + colortext(ct.Green, true, func() { + if following { + fmt.Print(" ") + } else { + fmt.Print("> ") + } + }) + var err error + b, _, err = reader.ReadLine() + if err != nil { + break + } + if len(b) == 0 { + continue + } + if code != "" { + code += "\n" + } + code += string(b) + } else { + code = string(b) + } + + stmts, err := parser.ParseSrc(code) + + if interactive { + if e, ok := err.(*parser.Error); ok { + es := e.Error() + if strings.HasPrefix(es, "syntax error: unexpected") { + if strings.HasPrefix(es, "syntax error: unexpected $end,") { + following = true + continue + } + } else { + if e.Pos.Column == len(b) && !e.Fatal { + println(e.Error()) + following = true + continue + } + if e.Error() == "unexpected EOF" { + following = true + continue + } + } + } + } + + following = false + code = "" + v := vm.NilValue + + if err == nil { + v, err = vm.Run(stmts, env) + } + if err != nil { + colortext(ct.Red, false, func() { + if e, ok := err.(*vm.Error); ok { + fmt.Fprintf(os.Stderr, "%s:%d: %s\n", source, e.Pos.Line, err) + } else if e, ok := err.(*parser.Error); ok { + if e.Filename != "" { + source = e.Filename + } + fmt.Fprintf(os.Stderr, "%s:%d: %s\n", source, e.Pos.Line, err) + } else { + fmt.Fprintln(os.Stderr, err) + } + }) + + if interactive { + continue + } else { + os.Exit(1) + } + } else { + if interactive { + colortext(ct.Black, true, func() { + if v == vm.NilValue || !v.IsValid() { + fmt.Println("nil") + } else { + s, ok := v.Interface().(fmt.Stringer) + if v.Kind() != reflect.String && ok { + fmt.Println(s) + } else { + fmt.Printf("%#v\n", v.Interface()) + } + } + }) + } else { + break + } + } + } +} diff --git a/vendor/github.com/mattn/anko/anko.png b/vendor/github.com/mattn/anko/anko.png new file mode 100644 index 0000000000000000000000000000000000000000..f1b98f2379f559c2219ca5ca88b303b8891d0d5d GIT binary patch literal 363250 zcmV(*K;FNJP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L04^f{04^f|c%?sf004jhNklQ?>0TniPAP5AYBo7ofIn ziv$7DZUBS`8vy9G-J}T_mH$A_A6gVaqfMHyK~Nw-%cRt30Ft1B4GR=ux(NWJXgrM# z7bs#$wm};}V*?;qD8ubGK$g+UZ#2IGB>^xjmie?FLI8vYY?`1ga*+){E&~L~4X|Bi z8x6>?Ac6o1!2}4%+`vP$XuxeYKmY`Mfo$C1CP+xeHqB>IHUR+}*n$9p+bBao872(x z!rSOZLjX+B`Lij*AF8A`Otl zJaXlRwVH;vXz*@JSb4%g5Lf3>^oNl8$`=VVY%&j^Hy%JlflXMDEu&1pcX1hLE*r(C z;Pw{F$nR!$eoN&QWd7~C=nt^-(Fr1?u7)9#3s|;+{LYrp$dh1_ZNgwaJQRrbFCbWS zo1C}ZJ0D6z4I10ni^^9?V*bzhb4WB$SNj9rXc2@7xPd$gGzo$&o3w##lt@1$fr2j+ zpbIt{Ael$KX_zmWjSnDWgAWaY@B(1n^af;HK$*4y$lh|Z-tZ=#oF_R=fNlybAWsN{ zf?+(ymdjqI$eXy$HtD8tHF7i+QQQB*5B)Zaz8fE)FfScJ0~<0>aGqF^l@pZyG#9+{ zyMiRp-h>+lU&gk#SnU>M=h<$$>C3$AO|@yXNEtNUFk5gAjn1Rg{6pM8kqfpBuy{^# z@*&HHEt1_Eb>aCCCSf-u8;0p(E&|YO_$Km*f>48`;O;zs`TJRRgTFxD4goKC+nbcJ zU>Y|8K-g`xDdf~a?hZo>d6!oSzwS+4Z5VBA_ZCDfpbR>{d>#UcW_Ra1Hw;9O$lQhvbv z=OX6@6N!90Mico=IbR1lLj{=INO`f%nLkKye$4{QxN+VvBZqYUJqx&UOw0?J)0wNe zfhO{7cb;#fL>LWhk?;ZyJ_HRJA_Xi%lnZ*$_aJA_{r#Dc~_S&_aO= zglXjgWUeKglbgtQW!aSr2`unxmr0&4gm~-{B+hpVunkffMCJ&$Ko=#5C_w^Efo<%j zmD$P-Qds#yUT=*A-~V;P*W#W!>1&)Wx+RsjIF*??!>vCa(I#0G8VU~LL$7@}W5=lue5$v@yG zUhqSIL=mDPplxe4EQ=P=#_f664BmF5e+e}Uu=yCfVd6~`&~_dh=L-P^Y@^|B3vT*0 z&IJhAd8q|A3BzZHf#(2Ho(@1~v2hMM;Md-S8YYVwoB%j7bYuK5sukQ2f&s2O)eH-2MJ_}6EkMNOdgq@btGKe05o&MpAzI$`|N4LYU$PtGOqChbKvOk8CHp+v`Tv!J24sG- ztR(qdFh_XKA?E`FF_&)@RiKcMEH90mi?d-#v*}S8k3i3~ovWRsDnI4l%Qcs-lpjR- z?(=m4vnXRD^E?Z48_#h)r!iic2g&&;=7F1E@%-D)e$lx;TfhS9d~~^a=)9}#JO)OC zG-|u;$58e&KsiS9K^ri3^ERIIPkJuNyr_V&W`^+jw5cZdpoCr8xt7FbIs;c;!x=l>Mw3N6CCUQTB5;$JT|F*W@O91KR{jE&&+Z2KGLQF zHQM&9B?0bW6Ay3`RL_@~yC@$x_}hNun{G&$O{oDJ+h8vBM$-)%vt{1!2DS}KbNNB` zgZ>b7cAr@{n|R#Y-pJ4AhV9OMX8Q&=m?N{>l4xKW z+MJu!+vnB?_Bqez5AetYnp&i62sS~yBS1F1%cF?y2{Q7+JlmWM>(jp$9nM=Z8kU?IWIaWH$Ue z*OCaRya)l0%=Zy$8cHo7wAdH0sZTJ#Svm4FVH>w_FukT>YlHdO zGFOt|4nk{FoZHS@r2B?%29j}S-M0;Nd*_e&o(X3e$YpsGRIaxfRX6kM4SMj9$gDZj zCMyps&oediIz$${I3ri~{Tq0sB5J@=oClKMWtWB}0!0>UPOKc`RONdT%Ai;oJ#$;- zSruRT-3b9AywM9m!}uZqwsg%>&TI}@IxP%cM5-+!iwdhQKt?~fXGP>v5k1GBo!7{A zi|_6RKjA0D3OWIr5G)vbZa5u4TQee|3hM15EM``|Db*D3};^JLzgXyhv%SY=N9nKJX=%`+8@U5 zIZU&GKMpjFE081DU>Pbdg7yWjphfKi<7B3@fGbQx8OGimIvQBam`{a!HXg8rGTIEH z)CYXphQ2(dabe(P*aBI);B7qSZa^rZH_%!$wkzk0O#w}8dLKHfiBd4h+|pk_2nNbn zz(Y5H?flJ|0G{j_1%m3H4(^q0lYZ$bh+c(vWu>^@;^1p{sC$zH{baNu^)O;ww~8!liU z;y{Cpfq87QYtjv@p6yC>sJjhcr0i|VuyNZ>uJ%P(t~`l3{z;fiR@>%=TXGF>2U!eJN46o}@FN!ZwrxB_$fHfueHjaR>w;HWfSYY*YwuhT#4-#& zU>SS62^gFBhcNi$tatZJ;2`h? zs@t87q6hcNF@~XpyEMz)rX`dcazSeS8ZA@~FJzhb2e_TtTjkzar|obJ+W@hjZ~^Vk zY~Qo0+QD)%uF*j6J=6KjQtx&FMsI1}7#kUUqof%+7h-PNCG_&L0YSLw+|=kt*Twj!1{4X^sgcK4P*7F?N_@dX2!fxm!~nD2`$=^D8R^Dv7R zc#$w}U{fOBz#TyffR^EfzQxOPgWh0UhsPyt+8F|HL_iFkZ94;}2Qa@$6H8c)C%dt9 zjqJ=sHb{J+hW`U>`nM=>0c+zqBb5%Qa)CF$Jm1W}vOmBLUdmU4g2N=OHi^~vV+hXD z-;G($+S~qMgmlaJ1fTbL1=3}{g=RoAkR`+R$LArWVeHU}+XUWu@WoG_ zNXv(}*5SJa!ZhkQo0e zuWGkta?@^TaNt317Fh#qx(Sy50VQpFZ+voa2?lqRo{a&v*kQHGd4F+Rn_S+Tpw;%B zmzok=4O_Awcn{8io6!le>^&Fz{3HT2{4WV;_r?%1Lkt^V3?!=va)8hqaQnBPhb;8& z04rv96Ksz-kNZPNtW17KH09l$Gv9a`X6R~UXeZid|JHX~C*-yd17$y?=?Hl9K6dw} zED4qoc()tR?4H3_{Llo7wE);pkd?~stGs$9791{fXZhm*jk)nV2<_bN%)+zDZSHel zZ>=CKHTr@xae985{M(`$&cIMPEwPP4c6D^|CQ%!Je56wn3ZS``3e;kRVFY#$ms_t< zII@YAZ^A}JF`=FB-VUEwWy~Oj9>Oz-P-J5f{Nf%2$1N6A`RB>ycGc*S3D;ut0T%iq zHt>KA@21HA4D;8|kp+(&i8MI^keOr&L`X6x;v!!59wY~wcuD_p-yp!%6m&=U3a{M0 zd1MZ4Fw9v#U4~AHhGEEq>Zo&%rY`C>dv=IurImA%Z~H?(c}Ksz7eQi0iV10;C-Hb@rV2YUK|-^7=@kt;y__= z-+AY4Hn&)|1d7ZS0!O$B_yGg7+z;~ytst;4z7vcg@`XUP%mi%7C4~8n%E*3^pc-g6 zFJ=26AMnL&*!k!!LgWLi@F!-4F#?x(nVXp+M*TkEaN$jIV|RXMzW|fZaLpJUO4xV1 ziIwZY4)rKPOS=bgYMN$sy=h;*8hhgocI?Qu(L=!;fS!X^KMLVwxyA4DYoMDfP>ow& zAvFyRmjwX1)rQw-w|X>`v^(1{R@8=6Xj?Qr7d@+oDL;gQLxXRsB0UQzHkfoI9&-bc zY-+=#UVw}T*aB-%>*_DKNrNwV=Zhm+DxeylXb(j}4eh*g!gH3z@9#>`8cli>83Z1f zoD1POt5t6Og4JDpRHNWMYX&G6(ZJ!`az}7uK!t3jzlM6$FeSHgH-MYlc<@!A&FFco z8V-sJj%c)O3t)e?AMm1Y;4v1zKr^8Lm@Qxq5;$;H8`~`O${Lr=w|m6@gpO36?jq2A z8+Wmcd-n$}_yu<)FyH?Pl5$>_(sDnrJPa{33~rXcRYTj_etHAQ2k4>Ldj4HU#gI2N z>i)JPN6CYiy_Vf!h=hJd0s;kY1O&b^N!e~}%`@fb8|?fy+JV#O8&ke72Y1@}T;UBo z@I$_{=62+S2Q$y+>2cFs2iOQIT|T!!Aj3#i4o~0QkMRPj7PQdJQ9#Ia+X13QE>+a( z(GF~_T;mZr8eDe4rK;IH0f5qFBLdVA+dbgG;Wv9el{qCT<55;m?sg9&Wf(1N63=Lx zX07bV7Q7{QHo{t&tdICc-)+DHxoDR7LCeedm%NKV^PeG#k8r?E8@`8l1a~xgJoF_HxFDl3jxuO@% zAnD%3&W`BelC$)?{Qzt~MA@%d#YR(L(Ey>VhS445z1&cWcw36eWTGkI(hF6E>rd<9f*Zq;sQ3uc6GV)O&vWZ zU{+@`X4_i$0bECp`6b`BO_s>+n=Fp(W0zN>3OmoFaib-`DDs^%pM8t`440bo3g} zR%w%M$D{`cT8T;G{P5rqqcNe8XJBxB07o>2V>FKfW5v8*k%P%gV$?~We zbl#@?QvZx13hyY+&f^w=;?Izdv0>=1Wr(p_4*MM6P_|Dv;t2l?d_)5;^TUwkmgkiK zv`NbwCh!7l#wx#o3+y}t1bdK=B7a7}H7LlYcDoB@G#b*&%ty4rZBwe8vc;F_^6X z1fm@Rb#NdSi8iR%I_?~T&F%5&nTFWI(`PZ{3vFYQB^D#BRgTUUD<5>Bi6<;07!ysC zC`){DoHrY2d5LS|*LviNf)6tL8C~J%0T&R?%kigD9br^nzXefi`-bmOZDIx^KwnpV z3<#N=)Y#7Aad_@U0sGNSo74v2r(mGOS6J|9zr`lnD*FN(j?;2vJ|oFgMRhvALVk9S zn%#49WMf&dJz8HDiv2V`!~(Mwbf{%}05dBR1opuT_VYwQ)dS zEn+8$0biYR@80uM@e4!9M>>A=Q{&?x13ME<@m$A5V}pXLpy1z)Pjd^>0C613o;Tn_ zG2GY?3cQB>an_jHhR-DzQP_9+b{oFiomuJ#H)l)4u=vO=328n<#A~ny=SKH2H5^Yz znF4mWFk>~>IAc2s-QQA~z<$`SzHz-Uw7M4g6?W4o*c};EHZMM4h2%8)@o%xpmw@i= z%*&D_SsX8VF6=FI$<27@TOe5;7@iUI03hBr%)JyQ>;i;f@epR_Cs?v1o_S=C0SX%^ zvBWASBjOS*e#prZAOXHXx&Ksd#JS_!fo_n55Sc|kJy8sH8`z~PtMgXXiZ(5pM#AR1 zai1Sk;4);dL2@vQDEJ{nUt@#eoCxi$3=>-R(l`z>Pb?g;H9R14#89dQJTU-ZwB~a2 zn0)rg1EXF6?KKXjQG)|`(TZvS$Lc`Ji2G>NEMR5=M@f6w)>yeX2s0nR^a2*}g3GIU=UuEMaF7AX4` z*l0`)NVR0|{C$NAZ8I_ySa@+RiDjy}b0PHJAsJ)k7YkV6Q+{*g`x7s-86iPIKyUlW zWx_TU$z_pEsHu$}3M0Qu1AGwbh1a&BCxh1FPcU9~DH#_r5RAB`8@pyzE%EjAzi~H- zD!$yCRJ#|;dclV8W1ZUaCqDbwrwtjqu%c3V@QDU(h73!7Lxg$J%?gx*)k*aYdc8pylaEdn&b)$Y&;m)I$}_7&p?dsVST4X5`J!s@mIQDZuDtG~HJi?Ww zhXn4c$1}4%NQiT|HFS5V7|G_gx$^_sAw0RM#UZI3~x5OiP%LBX2c}qRgn|Ni) zSaT~!xNDR5xdo#Lm7vWXRWLYQm$5li=V(E{Q|TmuU~+#5p?${no z5i2Tj0jTPZUZ%*f5_`~_Ca@@-bhVgTV81~{G69{_0<9|0C#%a2+wIKmgIJ3eyt#{Fd-E}}aVzI_)U1u?HBppNWhcBsxo+a1D64LQ?jpig0?n#&z2GR z^T7DPrYo@HSL^`C8iDS%YS>VMC)Eh3adc=JWn_m$?iR}bC-MRIMw}ZTyWx^$d`zpjO~-19Tc8pd zMK&)JblIP(wM{Ti?yECl@C2tou0=F(6VJ?`Nq->9Y+rfn;4aH&Ic{4pcn9b{|F*y% zAaWxzeuv$+2(XVkKSa54+=`j2I+&tnwK`hZc&_p@3%!pW(ctch!ibwO+(e|5p+Zmc z3Hc>QV{{k|h2sksDjv4@K6^AD#rQVe2O7)_nB4>-usb%5IW*6W6?s)eKmKM`%!?Ri z_GBO`;||d5_b61hyuFQw3Es+Ymcwq}rpAtni==T6 zXD|+ZjjVYbm4Gf7?q|$&z}fO?Jnk-563sAfSQ$T)VKl7wv!nfXMX}o*qb9kk+bdHy zo<)}kGp`+!i^d^V+hB7+K)wbeAQ2fsP18?jX7`pe*P|+++`HkE>(m&I3YaU68&7d1 zM5eiIi5JYvk$$6%dNJDU3{ufw zfZ#(_dkc$x0Wd!+tV19pdPOgqrD3-5LK049@|_S(e80Dt&+s1_td96CVOz@8IL~(% zKElPkht80NA`2G`^0TqY|DYde&#K){2$8ub*QqaHpYV;m5}ITjPKf9kG{^X#+w9m5 zol!tw$C1Jn6goI9A#jtyVGOG3eH4Zvx@ttk0@-Z~ujZYRI-g0bN;y??yG{1XNcn;s z{1TV(G44Q52d;iN5o2XmMp64oRLKDHI0-2Ek^I4gBUVUvDt?c!sRdV1hj`2P#4iZ; z#x1g0j@^iBvR=Hwn#a+BX9d2%Pt53Ya;8YELL2QUt_P)OzPx|H!tcIJ_kICm~flV0w5O<^ZIJ-Kpvw7M5pv7WbMO-4$yJ?|p8(FUx zK=%c7QBQxO?iMd_?Y_ax1osn{Ydi}!*qaf;yt5H!GA0VVj5coSO(%eY#y|G8`3!eQ z*x60DypZq{7P?^<6ZM+G{dMyZtOoEhe~E4f5F%{p6?nZvz6-;(&)O9F*2F$44T39& zwMQ!x9^uU8`EtBR&6B$%Ri`tT7UJ!@WsUXm-9`ZbG)C0he(W6yf{!y+W7%>Hb=mGh zMsa+qId>`!Y~V?JM?v|yjrd_Q zR(uyYse^trP&xwi(AlKDX`8=LWC-zKyiA$D#B(U6qQ8dxS2sja;&)3Ewn?~-w+N8& zN>IYNS$Q_F52cQzVxo-dYiS_fL~lxXV}_2RTUn;_0i58#(Ldp`PB3qj?m{xyPH>B2 zf-1c1&T}QKf@~6hj1!mXjcgcvMmU)SX+Gq~2GNUz?DfNKl_F(4xfrQ?JOE$jg0y&EKQcCEayo!2Nwl+)r#&Ny3W3+_w2iwog&U zEq_kr&@b3YGY+$`EhZfh9bXD2-Lnsw?ZQ79InPG>04+v(Z?TBoe*C3;yp2EO3V@Bu zxUl&wKzOMm8gzQ zR7YstyYaMs2sb{0BZ!L(kgQI)lJ}@22Y6gQ(1d0me2|3%5lKC87S4`GGi%%^h2nBa z;uI!7Xy-LXTaW0DuBvsGs80R`fNnj`xcOw{dZ^Bm?3+w}%#LOS*gc8sJ~zN7B)>f| z4IvRGw4kwsg&Cf9%*tSI|BA~hCM1?m<0`&4upr>!*QnrKgk82S5ZD`=t{HD_m3@2# zM6;hTa>+9>uJbB^0}TP*^o|NRK9&^X}ufxd>Slb=ceGgnU*#z-P-5|}fKu2vDTx-HndvsYnvhHWn6ely% zu|dapSx#nW?*NP^0xYtx48F_GAy&bC;MKtbaUy9+diP%!%R19Ue*ByH$;6tRi3ZDb zLh24uh=Pvpe|sWSo1*bMSALLIUR1d`$@%+%R@>C_2CRp7QED&m4_G0MsM`=AVeQT_ zabVOC_e_uq$s$)wbyA-cmSAw@=s;C7T20<^k2nj=s!@7_A7YEjq8kmNQJj%NBPs^S z%br|o2WOucg{SHwLpO~!bQDIz^e&^t<=%i)E9b(*dXS*(7udoUS@;k9)4E}l-;Ia3 zO`(gp$ptUqPOR}p=A$yUfW}XwizeQ~8K6sVL)#?ppyi08ycm5X#~xPpPSTG^;dP#W zfw!WVi5Q0rt7ppn6#g;dKFe41j5QgTeI3yHqysV%M-DzT0{F1607~Hw821PfWx!lf z57TeqYTuB^7xBOe-F@f!KgVs^n^>{4Bf}UCti-}dG#(>i6qRT#=Se_Z17YKSz{_5Qm7ot?#v|U>JO)lGF9y`Zak#|RxpxBk zag$GS)Deb~NlBy!0B??Mr8}bBf%Br^j$pU5S?4Q*AEVp9h6^vueZ^)ITe9p9>l50* z8+zhEv{&zLY{piG{Ba*b52Bh@)-^(nI-5>W8o8;!{fDS-gWFEr(o5RyU)ae5=#wOz zV8SyQoT3%L-~$35YQdC6KUN}&6?bj&P!XUuF5Cf1pGk{wv`C4WW8Au=;8)KTdwpzb z1M6{R(2v{DDEI$>cjLB~xowNDs00WDuM^iZm@WW>jb_x5I!9%G5|;p{DFLF~`6P|L zJ)vy9V-qp6u?dE^px({s%ldczeYnVLR4G^q@#v@plijV}wpijRhfrc-2sZN?4gn;` zA8~{y8D9ri=hc$~(-hc;@Z#}UkNh&e?4elWxp>^bMq5)|(36^YqI*3uv1|x~7CQS_ zmcW^C4sxE?)-7J15517Ej1j{XL~s+9lhSw-CKs_HGDdDcU>}br`GQS0sV`~lc&O~| z=2Tn&mYY;{C)cWRKW?>Zp>K1X!`-(L;?u?+Szs5$5cP%sQ&?;1e9ps}M^B|t#V0@Q zW&*o%i(8W%dqH86b=Gk@3+TV&&rKf=q|H3JG9iJFPc zN9^vVEdE2-+&yl00fp%-Vh!d}t=qoIMX0byZEx2@#P#ol76TA2^6qq}MDH4DK23Ca zJF&?}s19uNIz9&r(eXCj<`!Y90b?6abIYk+wD^r-jzc4?8pFCwkyjW4&&pSIdJ z@QViVk1e9e$9P7ejZbo6JW7OpqP*j$s{GIzwSpr!&}b}X4N6uSqb|m_Z|OSt;b#n5 zZcGB#C0_JK0iKLc$1vt+CaMXfjZVr=JUwsWa$r>_s`DT8Cs1Me-YjD!N)RKk%G4f9 z!x!|sjOzi2)%_UHn#^}|a)Cpu_d#PlL3eKOCk`>=X@7_!uC^P=_*fmQ=olqH#}~dE zFc#Y4HNg&kC7G|$#uE19hj!Xmh_xr6(}QN=Xz>xs?!$c~R-bSa_m z`vxiq?3h-2N*z*A20pOSJBu&W-m(6%Bs{#ivrL_Tt$RNtw-*@QPJ97FIA({2pPp59 z8{4@IK;Vx-Y)!aoM8xH%v<1>z_v+RHh!gLzl`1ZWLnL@od^VD&9`GTWGpnO zpA0}64-mU;WNoQQ*u;Vtc+c1F$qx~aX*1G5SN8_iq(->ZAE+A_@lFUx_Dj~ohOJ#c z?(Nw;7E8{*pV&@`iFjm@D+&H10OU=7x^2eF*xC5JBV@Zc3o1oHPdOu4>-leE=-zRA$WGQ zV<`ndViTiLPnHeD%YQH0F9UvL*^V2NW41ObQsn^yrZk}^wM{Wq zMbr1R2Tq}9`s?~xw+;V?(vPAj$VL=kC-(x7&m?g|+Ur^IH=LZdhh{1mNqPtxgZ zC*wsRHVOMzyo~Gb?!p`v4SvR)h8O&pdt^Nf37v>8od+4n9x(B8Al6}JKI9QlaOP9v zUszH#KNEyQB;q}_0p^}@UdbxD$j@m*d*p?$F883I?GIeJ&%~Gg8&0U3g~c&$8kmYa zK;gP~TWZ3Im6$^Tw^DS2&&D5G>|f&QPIHXxE#1wP4|)5)z{_9zH-3{G`*^OCGvwbR zbp{n9vNtkocBR-65`8CQ+8rUfavP_dXa0TUj$G0pihYc&scZvdut{*V5qr;2!I1)W z$DyQ7ePQ#Y!erXshCAOixVxiwWV^lVgr)|4F^S%8H-Et*uCoe8?c&J+-ND0CC0ghn_99($UH zH6V8P9{}K+T=S3SH^m1Q@$S()%MKWDMal(l><}yP6e1}Z2}Cl*YjJ4Vfrv|uEUF>6s?3{!SIf27Bd0}`#Mu_pY42T2^e=R7drKuEZdKxy-2 z&xAZ`WMc{Tt8Be1kJ7U<)4}fcb*v}W;A0*rZb}e5%0e#tnU{V#)`p@#|MGn8M_fuZ zSIDtEIXyt)^PVsTFB1!O%g#gp%`pGKdH^=Lo2fFFiw0= zgou~JF=7YdY8on|*Tx53A~2P`w{a6It(JD1e*lpGXa~0mFsXL$euz@E9!z%pN# zlrx&no`Kr_V4_!}RfUH1CGx=_&78>htb_RA~0!okeFIZf-^~Cpgr&88yofqC? znJ1{2fIBb0!Jx21v1jYu?Z^J1F&$xilyFcy?FUqkKH?D{_j}=IW9RZDy7?sV!LFw5 zkEThpV8tLJ7zti&PF|#!Zn{qPZCMWcPRSnJYrb_G6|NX`g-)YzX}@EwLloPk+~L ze8`{3)6O4&o@??Y*TL%ZE#&&oGHuN9|FUoRm%8AJ%&+^u$5OG4e=*emEK!Zm)Q2XL zgXL4<0sAxsZEKJ9HX6^vP_{RC1216#zxE%a0w=^Ph3RMf=7i_6n1_mIALJxsj7lR_ zDPlH(ouo8G&fm0(#<8~oCne2VoUp`KDn(??VOt6c8p;zbCer7@P&6mH_7M6(_CQ6X6}`+Zvz&a&wWz-Z~IrCtTW-CLp*bIeB?f@c>f2i7pfRG&&3l zs}txwrm56@`D!fqqJK}_a56+QF{p@|+$${dNu3*ZjfKQ27M;FK&I=8}Z-T1GzV^b;9(ZSV zbm*erEDl!Y=X_o*FL05cg$WV<-g|RIPJ|Xgu(#c zhUMg@<70FNu0|?L4Bs7fTSQ*b{@6iN^P!)xh2b;X4Q}|Mt8qf6bGJ_zJ=(Wj#ARN4 zf5dMteKNYQp!LQLc6;^U;}hpO{v-n4oHSN$}1j9Y9Z0oV0cU(?cL{4gj?CD2i4Z(f<~zz4RsyfBWd3J0M91XX`Y#$A57emdxtj(eDaKL zSG(~GP8=h^fm?{|wfcM6>?;PXp4}+$_6RMG!W;VrCAf#Jx!pjnJ z?uH?)%WY1IAH`*Egcfr)N)99qr(yuvZG4SpG*4O2wg9mAU3IngL@$iYUgvx4GuMO+ z;V>xf;5k7X=c?nVS{@X4gUxad$Bmpd6)Y2rrn=gS%Pk;rds`=PsWnMD7aFVD~f8;;Op z=Ml2^xe+_CK_J3;V8;=J=nR~zH#h;-36f+&8L^+ac#X43FBA5kbOR9pHsi=dLVM!& zUWSeTn#F#T3v-vd-B0{NY$kew_aym7mxT1i$)TL{zneUc%MpWHO)G2y=&)$)BjCj( zuDDa#8EtC3a|f$wu)W>g5_j&Cws*U|_ohg!C$pVAb;TrI!lZZMMD+ET68o8mqq(Mt zVrg8ieNrPhf#dEL8W>AbbZSX9CVFJ;Ss{E+a71?uZAcytWyss52Sf^3Pa1GY>NEqY z@dWD6VLi2K6gq%^i0Y?|J!A>?%6<;2|HNS7BLr~cvmyyH|DzOav)vcM|#?)LGSpNn86 zVJl^G{%iai5G=ebg}=YQA?E4Uwc z2_T=sa^e+dUCEykf%r1CA}tYs^=%*t8wVEpN`V;h0&H}UmRw*?$Ynno85tioCq+G4 zNJQZVM^W5F^|Loq0ki4lXL?e1qwv%CBi<+cte%|kQG>^5=m#AlwtziJuwOeKZ~$A` zpVmzfUhX8!DW!p_x$0Dx=f}l=0RkW4AMpYndm%zrV#DHIT9cosEf827h4zcNyhmq+ zlZAQh)b64>y}U$GlY$3=6o8D1_2Yn^Y&lK2L z#@itEr@+p`?XC$ID{6&PueHVoM#gW`ywguwQAS{akIqHdQVmnXZix@d)96b(+sS` zBV-qu?Ix7njA>qf0PZ&1{Q7+XABA^v8aqe*sN_^{7O8YAB(eHoL?! zh4}tMvjNZ@WgY39K+xUbhQ(7Vu3F^T% zW}(o;p)eT@CiEdTTZw1u_DI1!;r`BPyGHuTd*b$RLoCKiuLnL}GR?P34obsjf zW)Epy;3cmB z&AYv2ORrM_`Usn5oC#CR8n(?5wmhd|rG_lQvLaQeMl0zyexR-FWP?C*at-lB7chYy zd_Xt;(Yywo0-Xn+^4+M7Dq5q7Nyx*mC+U_%Enx4bap!8xMhe%1P3#?Mq9xwOX14RZ z8(mL_b90t{`!fU-4AwJFEd!5j?=q))+zHG~UJPP;{y;R|grfuEkhq^5!SGWm*d>8I zu^83FYD2g(dY8%#ay5R5XBzidFc+7B?T^A!0NoH@9yQHvT3o;n`a|x*a$6R-%;g!? zeuzc?X{OMojGd)3DZBHRS%3gz)1k|Y4f$m*aD%%>+I@^G2=de2kFZMP?HOg{Odl`v zX%T&|3cwlN&}BFEETp{%2qIKPHp>4!=2#bn60_y?1}w7FS()t1+?Z&XwZ*y za~pL;qDLI}95<4_*G=%d`EXC~Q%pxbDG=G)+dg2X$yiGo>*};F#`fwg^-p7mD@1?G zM|$TJ*gMi?TN99%qWD?;65EiZ+l^6V1u%Y2T6~ck(`J^(XR?-<9&+|Z(uu;3YiEy# z;mZKEi3T6z2FlY65vi?|T+~5X#tD~pb7CDVG&f}&99!6hoeO^O1>9m8FZ;s-0&_Si z9EI0l*OM?bAnyl^5_=M!Jxc6gT^v@`C#dxsDgdT&ySagKJgeUDS4@;#beytYa^{Nt zzm1jgMn?GcC{?Xo8#a!6D02N#_};N)lgjpgMl=IE8YDUd4F*KaFz3o++5LQ1k~te8 z`8w7N46_~9?ySnp0x_8NwmnbRFjTgj*fH0XUMO zR1sivg43eHoOt(hqo#J*qxnd;1DMlRxx8s0;P!61VZnm72^PE}f`@24MHA{2!t-*w zz7DXN+V(J2$=pWMBCc(LAK`o^~eQ!#hi`6dV$#yfj#CS$gfCe{^NG5ExDQp@yy&D%v z@;3f-Dqtt(YNuRiEW)XGV?nRRp7bSCT#=jGb8y7=tvQSnSlz}gtT=*U3tU{eq;*PA z#nVQyJhAwd1DbZ(?gM5Zt@=ZH90v{TV@frQH=+< zIe4P%)EM)xaS~|$wm*t))G%7Q=_e~1r_#H>7vw zZ9MbTp&IXo;*$iH+uyicpK%c5l1ZzeI2etQhqh}x**+?SfFoZgRVI^CpNo_D%XvpY z>gfp&rSceQwvIu6`jPm*jVQKRvaQ2PkVKcK+KwkpQ=lNp-3gPm>0WcO0^pWpLlU$& zqg0y@K;o6W8s-V$%B)E~pmS#kJb}9dYK*XZst{Ky7)dI817)q`u*XQ#+)|hW&B4bD z5dDm^V8W6h<$!ojTQ5hb6~rU~N4?T5Il)XgvvrgOnEJ5VbyRJ)UCzQ0m<^Bdu-A6# z2x9M(;XToPwr}8_R6^MH2l9^HoKF2D0AqLN^kAD5{E4iz@k@$W_S<~mUrdAW7=q*p z7@aR%;3*9SWpeK=F&ypJT1|wb@KY?~LE;_AB#yWn4A6Ih3j?qZ16>HCzlj46 za(Z)shIaG8cnmN2F>i6%f^V}MZ9bZ6lts*!Xg}fG8Xua%D*;%Ypu}_eIDHzXlgBw# zw9jPonu$3P{sDXEEFX!=sP2oA!^kM;2mRPqKm|O6h(C?=STqKLU5#J!Ax@&MxaB?&=qNaC4{SUUNwsg1_P^q8zvKG~%Az*qZ*Z)q-qkjatz z+l`iat?Qk4`vOgEqQuL583rB%+vQ3HO{cvbYvN$l6F@)U6wJqo+55&j=+~neY0{j? zepv5A<6m@ZeAZCyV|yYtp2F z_SM+nh90`?=K!HaXmU2Pj!(zP3EJFMeA(Wem>O~AC|Q7P4S$58%CZ!a9idIScikY^7fawKsc z{r^$Dkmk#s__=Rkt;l}}*nbc;CZ3+BZqU?NaE^w1eCCV+k1JKCM$H$fWj`JC^dQ}T z^A$p7RTjgk@0;NEz%X$WjLH6Gx49EFdGtHM+owdyfc=4f4!z01hmFKt&RyMo!>m-M zCsdK*`6n`;z`xFE2~GAgzryaUocmxfJfVq?Eoo&c3r@G)$wRW`!4^)IVE#G}q#uLO zb@Ea)R`}HAy1U~5{Ho$XdLwJOZZVl?E|gogcMJ)v+*I2ZZ&)M&+!W0hR_H4pvhla` zgG$UV=blJo_Q>e(W^y!>4!EUd{Ez*h+V1kD1hskrFMEql3j&g9MVnblq8Cdd3Qson zhJVS6Sh=o_d%lb)p(Z3gs^%#M9Erb-8b9*vqG z{}ll5Fm?8(wEe`lL=Y2e6H!~tYL8jR=?bvXcakD}dQDG$T77j&9UUi5(3By3=nOZ_wipllnv0JNVO_Xad}xi7GqdAJi{) z78JRs=pdzS)FdZ%h!`MhnE6d(PY7c(S+HNc7zv+<@d|^$dHU<-IQ$mIh+cWp<02ZT zYhP*L#d%&m5*8kNNzj|vh(*3|=78`qn7h8|hpx5i8m&A5T%yS3Bt6Z4O5&&8A(Sc6 zze=~mJbh;lK+*pIZTy0)(aRN?atkMecPzG^3`2Npzz+g%_#q#Yjmu#Bw`BSs^eu&E zyFzuuW>0(%3Xf*9o4}6x4AuQ7Ip8FRO_7W}KiC0Mrf(;X9|Vs65O1e0WZJ?!iz%*j z%VfffEU3Ga>BCbbHCzRpkgt#n#yyS>>tIU=Tr(E~y8ST0{Y1)c#~h5ibjgu4%XmZ= z--gobY%a|1`vyStk{XK4Hf$3~N$~_jt<@|6sHsF7-TpI>H z?uYworYR_Rqu>Nm!njvD$@ywO#xe^C18rfE`$P(vTs7*IcYB*jDT;p|=&o4|6Q?oW zXrodih;;MeGZJwWBJ&yl{slCuPC!md;A4qN6|`q}iK8t@>>Q&I?>JUFhsD$-R#3r;(-;hmDK*Wx+f!I2MK@$^Aqo0$87=c1Aq(@p4YzZ4TluCnP zXy*?KHmj1KnIWw`3Fw?26`~Ue&xSWx!^n+UC>uyJ#hFZk(e->iUnk`#^B=Sig^2?} zk!j`$Y6$Ll+{Xz$5gy;pJ_E!PsYnvJD_dqFPUolUFIgPuHCNn-uH(aEl9(VD>A!bp zt^l*s+RNkhJ0w6#e-bqVxVw(;C?!OMYfn^>=MOzlbdr`yZ>0AZ@Wbsi!Pus^QSB(U z*vSCFvR7;^MuHyl2|%$pA~Lub0bo2Tb;GuL@PGr-Bp6{N6i3C<*pG*7eqiO<4|Yhd z(?Z&quFMTLr;TlfMb=j_R!VJC+Ja|S?e0e9Bhtvz2%=)XB1!jr!+|$Ww1PWn-nmic zYxOX`I=ZEy0_U<)Pc`5fwLEgCkrAY5U|0{;?oAS^>>Cy!Es0d=R83F%u8LEukYxNN zh3ZQhLyg3jb7>JvsP4`lNS81XdQv)eqJn$%bV}tx618b;cj?6hSSP)}2?vhbm~nGI zc+eI|tagNmu>V)kM32Bv36la=Kb`id`5_s_QU*N3m*)1f{lt}a#?r*9y*oY!v+)OE zj7He~M}r%4@12ze-xg0Cbyqf%uo?Vq_i2d;?bRSOuE8cMsi_3SE5-C4U*LSh5*bw* z!$Dk=-YgNXX$d5VhkO|nKlX=A$BqUVLBan3HzY9HA;lFMt&KqR6Um(YIT%X>bg(rI z*Q~aMkMQ0zZ4hn_v6IOomGb|(ReT$_<7rCGQ9F$OoE1PC+0dUP9+0aYyt?Tv{HPKMXrTxbeye~waOoki+pxVV{=X0B}?HPWNx8llN4*CtHfFe=w} zMZ0sMKZMQYSotyPhh_`i7I+DlCK9hxfvj_7B&wwO5EorF58uYbbcCq;v2XiHM@8~1 z&k!?RlH{0Q#cPlMBUn8)(?>)G|4(zvm~e)>YTlacz%l;<(3DAgESP-ErWbh;Wk|Ru zF_D#Q`O)rS3=V(q@2G71L4QVl+}^2GI58U23jqECL#mf>A`wY!E^v>`fyDqH*; z$1qZ6GClB9doe}4FnU7cJ5A^PHUFH`zmjj!RCA!g6L5=2>N*;B@1#QI;-VuDB|=of zQFLQ0#lia9=Mv8-0Nil02To*1_w;#Y#@Voou$7-7R#HFxK%^Cm*-21O7)T)#6`K^g z?GIT#UFvWUqd*NJ-MmjT=?xaW&`Px^d5YO+WPdv`5H9v;qc*%(#kaY^E*HB-iX@~j zCtuD^Tpg~dRR8O<&kqwAB=^Iff5-!OBwB}2pJ0O*c@6%LEFBu-&G^`7XsCMO*uQKV zi(E@<%0@V31Pn=Uda&#f+a1FiRKN@Vqu?i6m{RUVCA*c%_hga_;`Se+s2blVoRUHI zxGXY|`4elTz2X*#8B#f-etIr2D6)T6 z&LE=3J9uQnw7{Q`4zn#x`O;`O9Q$t?)z0}HyKsK;-J2)*D5G#u-j5E-50+I){|`<9 z@>@TL^FNYBJ6vwVUtQJwE-pkhhm?2$WX=1zB37iI|>0WV1h_RA64hZdNAY0Mzf zCsq>J`v!Z5hrtu*v$+FQ(8n)Ar)XiI-X@40`u6Cu4WoNB$rCQM(WIBTo44r=5v@a0 zo_b?DYNi={njLoF!20vSHHS`-Ta(Y#0K2GgW=G3@0%JN1bT!uAj{thRw-IqK#y&FZ zp6rU&;9H!8`JLUg`J{1!Uf`0|M92$d9?><|YU&?mD%rEidjWyYT2(%A%~RDg^*>pP zl>F-?Q%|tLlA%Z`yFcJA?L<@03#Z7+)8 zpR(W*_jYHCg>Br0$5@`*52R!fwfTrkoC2?m_QVd7#stHXP#0_T0Z6JG+iR+lXLxIH zD-tTue1`8Z;l21z7M-YIx(j+6pExo#O@Bs^XOF2_9wH698<-<3^RozJpSXwH+|kM#iS~_cw}SlUTvU|sOqS9U#K~U)Yv90ag0q;2 z-lOr3BWSb~7rjJm{-&Y;XsFyKE243EicO-|r6iYp`J@sg{{eiR{cj64OVJ71)^B0a zN$l%N>wEGy=o9ei&0pd_XiUK~ccKsM>b?l<3F~O1Hx_ZZZ(%c@Js9XUTI>59)8l_V z9i5wMeVJER;0I4g`{DCIa5Z+|UK7c~;q;Rqo_WB!8Y*;d#XJDPg;tcsBgkf%yK!0$ zr@%NvMUebIn6BAqXXES};bOvnlTm~7^5Uyh>hE2$8(Y(6d6{c0p@*UmFF2`LU+2@X zMXP%cL+Pd>p-&3&u#a%EB%?AR60+a92-@6GjmtHmfjOE6gZ55UJwX?m-=A&rrITJ5 zxt4WO_IhK2WF0gxTSUS@QbLtwduFD9$K^p%1G*a7ti8jabF^eTJ(^72%hBQ)c{AnS z#P)7z4gJ|i$EJu+H*r9g0aXjCfTsD~Ru(gOcQU|(oh(A7G8S-woBRM}OVdv(>H^AR zfY&5^oy!Twc4Iv96F2*@V*&9!vlIIT6I6R^#jL6JkGsRkao>@o|K zq0$S8z^prRA19&mEJ#Z6Y6ZkdGg zC2yxtOYn znui(7PSUHU865_(G| zX-SDwOxFZ!$I|jmG9Fh~QWz7VDv1D_8D>+S7 z9?KXoSLSp!YYGJf;2w=CBVFCV)2wvMj(aSHVYC+Aaer5X;A>egy5<#({2%F%d5wJ6 z8~$G-weas@T9S>Ie!xGX+F23)9hn!~=FTDK%{H|F5RXlBaiS=Ft^qkl;Ylpohf~a+ z5+*;TI^Px`*ncJ#gLeq0Gp&pwc?4;0&~kwvqQUoccKXr4?C_>14clY($2zhGQWaL8 zxG=7NwI5AiX48c+g+{T#&4;Mu^2Oj}Mg_C7a2S6oUU<|(N|!}GWS2K_p;m@|`Ddia z$@v4KzDZm=SwI@0qguM*%a(_&f1MZRC)iH;?HF~Ur*{Jvv5coJitb-=A9YI3w0Xyp z-fmt|QI(d{|09nD951*VAIGHNc8b>f2L0?UN7;A5aNq7JGYi)D1jrf^y?~2;Y=u-@ z*x0wZo8zpFI3n^`X&#Jd4LAR2Oqy&wh6=0D-Jh?aGfTp(PaS{D7L}&c!Pp4$L%!*W zO)vm_q;1y*z*~kO`bI?s+KS%JFdib-uLrigsLSqxh`0F^Be7BA_T*AXuBT&~#qJGn zBu1f4{MrUePa6tJY42E*D<>yKR#W7HMcxTmPGQbWr;z4wkrb74{DtI{kx9-q0qN zrV%f2PyX3GL2XmGIeF9r_zj5M=B5)ks>1_0JskW3^hlnPRE zp9vT5j2d#X>=T42U~gy&P#J`21Y_~^Htg-RDaaNhT!^?6Hl9u>%GmtW8|+CrOx95F zpQ$XIKwWn~0K^M8n$Y3b9*&=Ba^;WVhsEmX9)_t6HC=GK?~{hn*>j{f_&?@v-hH6j z5>ZvTICM-?W49epN<+{`I6nJn_R{9uEy=+apbF+1nm%C|OkzR4AkJf8WxtDDbq2XK z$0XPX1-{!Pp0R691SzvD@qp?C4XJwYPD*+lacR5b-vPA;B#4y66pJIsN^Ajf z>ZYqID01A&D}hlO!YNu0gZEAXfP2=ULDE0*bpUFpa1qb;vttkD)40_E2eNYW@h-N& z_8zzePCA!;`xpa;)W{P#m8+RuYx2|aaO(D8xcvcu+}TlhnZ}jhHxRi#z+@tP=A7s)cHdy*$^xmkB ze#Aw-fh*J&nI4J@xKsk_;U)bR%654E$T=~}tl#WoIYx^GRqGe6;!7ic%(y+-qGz=K zj28|fU-TW}IsxGy5L-9Wf)H6II~6Dy3mJfzgntN_8?}ut{wHVJI9ICJuigKv-DC-| zs+duHIH@|-$pubsiFfyBGH3#b*~|sT)jfe>V3E}(aCJoZ+I=X!G;7ni_&RL)rY#oR zB1@OO2o>~oH)Q0t9By9fDNaaVa!5lJK7z)qlU6D*;FzImdfgx10Z;9>B9 zA4bEHL(@?jccUA!-;yo#(raNoedi-_FJKT+c zN!IqsX$Xd?j&deME-M*Qv&oV6nsw3fgMHI*Gm9j-X%4P9#J=eb$qJpn#<~8#VC`S- zW`HoBl^>8s?z|4yw2ptTzFIq)7?l(K$iRI;nMRFKBno#K>JP_fx#;eu%{-ODza1}FG&*UC*U!qT?a z^j@SCyp4oJ<&v02xtv=fqP@tivMHH7Pb8e zhnw6!`{x&`~V`rQ&$_doEXXv!4lOP`$$T-d!gU^sA zQ}mH9BVbs?LB9R560;IM?{Z*zgOKn8ABz|PXFhs?ML&eaH^!HIPmCFI!M|}vv6NrQ zi;(f5mK|9#=#{9cn$hfMLeVkb4=LzHU8%u%(cm9}P7wknUS|ADuM<8ldPhJnNPfA# zrOCk#wiM;6L7{unE@|Qq@MCaF{bKEyC?|~zbIK$}ydBXEkcapYSY$heDuFR<+`!H; zBo>hH+HvW%9{~+@PcLaFyU*>J{Q(zo5e!KjRiZqGe9v8E@?RL#%Pev)zQ{6LgtWey zEkv#86;{TM*Y+>;p-a4?)esiAp%|BU@T>2;NniWKBtdxqUX2BK4LcAjOrTvE(;iCf ztN}NAE&d1Ev_}4wzsRy^u%}O{yNvYx;3$heq`b?#_enz=a-RwI%69P(7x@y_NmPCT zckE9N6rh(pz-^`#xkk_BbwVD+e#A1;D~dE^SeyMXU~r*Drbg|@cp>Ag3w*TTt?W)}Qcv)Z+=G#Xoo7i%`o9(RX$td&b0!K~SFebl?12u0# zb-WEHi}7ou4E31rneY$#KHipi)^i;mYtYfNI{-;%qZFbA;|46Qb{&vAa&KU|>=J6N zsPKkJ9cKMtt9rFh)+>LKB7?V z)rviF5qU&%i?im_kJOIMp)5^3B;Chdf9foQXPHfWX5hjCmB9R&x(wEJGQ)U&W*)T= zjHY(*B%_TrwaVP>rWem_l0~=VlN6UGdl6UXLe2~*lZ#ymK%Yyo`^lpTzwO_~FHJ$+ zySeQT;W&e|7ZpY*utOZ}Qi*k-C9IqRRH0N21!k%~K&eW|B-p zeSC*bEQ@^`6xXPZSx#XTMg2lIJG)@O;xsO=Ey8Q@YP^73%E?7|wV#YW_GMmaGHPuQ zkmMitL-z9fX@wZ<1pAEcf6)BJd>wn_xN(=%{l@J>}+zB56QX^4aX&o3=`M#=2{;AnkE? zcoL8grbmF-L8$ElUjXHI{1W+(WdIQw=fLCKd?W24sv^+pEW|qGFGGrtJ_Kh2RhpLu zr~4E(@FNDoYD_FUa z+61{mMMSA36w>K1oNJx-zt>C;@u?qW4`(aw#2pYMUqBg2&}^FW1&mOTQ2S~8N*9N< z-JuD9eZHMxISwTgLRS+nilZfJrkRS`zz_Kr{tG^|oC4hF=hYZ!Lww=&ZTE{NSe2z`oD zmLl|}s2&!AZ<@v}y?|dRluyEt>(~s@=qexm%8N(fG(OrvCxdxH|?gXDzmY?cI(nG~ls} z$9%xc{`mBn6L#NmnG01@Dt_7kyvYwHrj?{BKeixQe4}pZkNh$(p+ksz+t@^TH+2!5 z!1j<_-j4jpo1|PFTaIdaO#xITia1iG-KqkO7{pvkZDkQGxmK&6-bL>RjTMbR_OE zg)1bsqwaQD`(SrhT8v2BK{#>z?lp}>_@@E#a}HFU6w9{l$fbW+GN5&utQv za=(tjA(!_K_mGJ2WNXs_bBfq;KPpjQ-+xzhAqcoqN1lxN@RB#;qb1IZ!f!fb$Rhz; z$s|u=Hd9;Eh>R}d&}hyV6NpBVX|6S#`nbtp<*`;z;N1j*cs4jc;4AlH_6|W@G375ttqcy?ktTUw z)GQ5q90A%##17&_`52k63uG9PB?vAZ;27<udldA`(bfM2kXFP=;7#)IYx+}{3L;B@%`dh~RmJRg-Ru6KQitL4nfuL~# z%)s2ee`&Up0 z#0W8F8SK8hKX&!Ryw${XBq7x@cl_4mi`@w!ccVy6c6TH{!8W5B@Nn)?j+V_GpUA5?qtcr(Gnbc*D#j?RzjLKKo|W=g^o~p zFVq0G#b!~i7=DJ*PEJCB7ioA)ozkkr*JNU~6hddT&0O$C8(7kx$4~1&>{}i^@BD0M z!9hRvPHPJsLwru-v+UxYTHmj>X8M}7qL@P`M|m{=If4KvNCv*X;M2f11#?ja zj0|G#Alv+tw~vk;t4C4H0EZ2#a56Gr406r0lO4U*XoH%q0pT$iZ$wdq2q~!8+{nY( z#{CEM5(ibFBZD1_qsQ{d1U1Kgk^1jNd^1dL@%{7f2XRnlwj6t!)}h z$LBT4q@zii#THYbbWPMawzO)!XY$dm{JG3kntczzQ;KSW&CTd$@WTAutF$#X@vvtG zk`?8&S9(0_C9Fmf%l<=sz$;$cY36PXKN1&!ODu46615V1wliO(DZGb&m{^?BWf#mL z#W83^vow*9by^m}ZONQQ?V7u+#s7Ga!ZDbCo#fWoCV_6)`%6+V!oT>3WcO1H@T97O)p@hT3j0H_mW8c#Ar{g z=8_Ym6q{^Zvw&XhM>(L!M)npr@C&}h3;rwsd>H`m++>u0Gj+Y4u6)}~LuQa+(cn}~~?nWGY znNaRJ@*)Tc+x-|M9-_N{nig*AnzbM-3a%Wzxe`D&5~F=U(Cir~5AOG{X)T5-MsGCg zvI}?>F9YBuyt+T0{DLt0J<1;#y~Vu3CU>^u$&|3jqHBEW{-UGLsS!L!j5<<=_RyT? zMvKPbJJa_V1agXz#5z?U$$5B`o(x_%nVhp&h!bYc5w?X{4sokln>>7Uf}TfZv**+u zjecRY{Pe_Ug1up1d)UQ>558Z0-xf z;SE9ifjlXPI057NfqYvvhI8o1!3fiSQt1FavG5Vqet85qaWT9Trb*O+KcjltvyQSD zT_HQzm(fTOYM+?|l&7fEyg06$TwXx85ZTR!ha6X)3e{+eJmRuR8!^vEm`v3XyAKE^ zHu%`b$Qqfv=Lu_|N0xF;q@>?A;0cg1w;MHR4C7xasf$0uUxy-snxusXGYvb>1cNN)Qd zKv2tQ7jQFC5Aj5fZ%g1!SCd#JY}>}meqf`6NjIzM$3@{vYf&uSozC;|6Lxk1>QT3N zP0st6RE&7Hc;GV^N=o&t^vzu>ybYjlOJp~ixT1#ws#)~^pRYe$kR!>BbwM-0BeTdE zUG0y3|93nqO_P=3fZZPk&nouJ*_JfwAz8(&%!q&kF#GJ&%kAKZEHrDnZoYK}+k9hy z-5dHK0eq^v{ebHjkdBjxcnQD63S3&7x>_I2PueThsW}hA=lY;QOnx4gKi@ImGvGj{ zK8xN?;EIWuZDPR?L|MAHknS(%5Ufe21^Jw1B7(A3zr#prY>OjYU&$ozl*kX^2Ell8 z#*rJ*sWURQ7L-1erT+*tk9*gJ1X~Yv9WS3xS+2xOiqX7GZg=a@=F{|>h?>KCpSUV9 zTC%wZ2Mj`@2g@O^4(w*Mh}}<{q6fJ)ZV#enbX_`@<$?B$T_j1{No^+a>g$LfZL;7H|X-%4%FSXE~+eaiayP3C#)K}dYXP7{$C>#S&e`Z+Ek4LV|w7!-I%kcegN z-b|{HB;who7eJ0Dbp$)Z;F1EY4|i!dQ!9j8xcifZ^>C}*cwhDxbe+jlk zmUB4zunPg>bS|}B-EOeM(W|p^?_0!))3D<}>>E}fj%W{!&Y-6hvZCH5q>*95#2%2X zG6z~jvmj$q+V*iVOIXD_2os{)TLB@sd>&MHFk=GRT=J6s*#v}=O_fu7#btR_knc$3iq% z%|&Ed9)Knhych|TYaMwh;ExJWsu}9#0E3G(6)lZw2&|Tj0E0+gO>;)BnJ!X^2NcLG z(Woz{n-XgMB7Q`#<_#8bbtmDuTL5g{sg|O({AoZzOf0>X?w1Q2q5_el(YUAr7nsD&fb`56zFm^TJG1c_@qivMFx;EknQUa^rd|&6 zP$#N5LkMv1uPGVSyj>LcrBO)%M zKmnweWM(}O!lU(DQB;ywsB7lHBfyY^?3sWin>FA$4Tg>Q3_R)VsrMXMoNNz3_-uYA zGDc2jIj>KjNtJm+t`I$2Re~!5m$nZmrG)9NH63CdUpqkcgWj8}n3KY!qaL=S=VThP zd4L5TU_=0&SZlz67E=LcUF8BE@KY)J=mdp~dl7?rKW}%14B8n3Sr! z-bjcca!D4iDpaFF57gF~T3P}mK`2a6fgut{SHW}Oc1A+HpD%?W_OyI zE1VI+TgoCLt))uZB5_9$TwVnwnOG!+JD9?YOrP_DXw79z<{f2#2su+^OzJx0Ghj=% zx=b1B#_>v}ri-hy1?oB099)Nau0%*L;mLNkDZ@U?sPle6G*DO=N}}*41$_M6bS} z1S4wvIq^?$5jPScmToWt3%Vh*Nj-88+Xv;$V1#s|0Y1Y1ZEP=U8aJ_tlBs(NhwC^9 zi~%vb3G5TY0?$(DNvjb*n7ug_r9BaCvp(n$)ofnEozq$r@d50j$OweF)6#2J7w}sV z%>;I6fdp<~(T`qTz;yXU`i>?xv7{8Q$Z$5IxYbOA@}cg42?AWIMsz}05<<~l(RMr8 zTXiGa*@88@s+IiVT|Xm;ipancn%O}h9+viq53n-)&R4TTi`XKGm3+j!RJRo?_%qPJ zXQHS_^QDMTpgWce;*ZeH4g{5-fnVU&{TM0-e-OJN_ynuONc$;}RWrh(#*Jh+B zUse?k=dotItHb zdpcte2E<|$xX1^h)kWN`+s2_&8gS0O(fVZgOz!5&dyiRuMm%N#YseBOWvA!jJcAQl zP(nw=KfkNs&o?b}UNBa4fYsWXq@NI|{=EV}$*M`|l?5Ae7_$RbXB_=E*XS)zcWe@fm`<+c+%K4b#c<@@ z3+Uui?XkBNTUdN{kGjF1T*UH$-_DH5x=Ml7N8JyAydg0@?8GLW0{iktBoJaAbXZQZK~;3b&3xP1>9f-qyrb}Z8N#fmY}O@timHDJ3ofFvHH&x=c9YN1hlDG9C6 z#-UZ8{3Ne1OA@#>iWm&Gv9|{pemKn(m3~fTTLk9{q;B0D=ApqL=_C8;Ph%dwE=pXq z;1)O*?vAzmoj8RAf-;xwC{81q0A=C~a^0Q!g6}h)^O1J!*AU;G@rY(e?7|pb*od@; zV8!_wSo3d@(TJ?#2vN6$oQq8{9B-YqaDs>I2ixOH?+`*BzP&5(Bm?>r4xD^v4Kvg2 z$9CS|EL;qKKA)20mLr5^EC1PIg0zh%1B)EyQjBqllg~Xr7sN#cnckqE{o#wch=*}_ zF#^wdzXY$MZIo)qBF;v2`p0<^jH>QP5fOCY6@cI-!waAuQQoKmkDB1^{x*r~3|ObD z^T3hdqjh_{Z=R(eO?Dp`oI+rl5TnW*Ksj~}vyCfJ0((q7I=-_l)xv5!JVH0-CB)2) z{hlhrg|ba#3n$HIKy)E-(uTHLVTy zj(CM`;sHL$b?W&Fwy@)D7r+mVJWTVLRw=M?GuG0D7NX(VGZ!a7cMC#1B6dteSK#Uh zF&8Fg^r)uuy`C1OF6VAaAwC|~MtlC+v2nX8>yeMsX-d zlIm<@=7f)9>vSERkmIxs2b0M-qMij*ptR(>-^a5*e+SkTa8lh=R2Uehm2k%OR7A zL2ZPqkA|ZjXFb?N3z0s*j&GNkJKE1xko$;3eaRZeG}L;x!#L%A%9(o3GBZ!@;kFI+ zIJ|5|Nb1G6Rx7EG(#s#6H7Db|Kdf)jeL|!%z=ESGHX4kNrV^0|4_O&DXiUb;TtKtT z_Bil%zBxTO>6rg^<#!y7wz0oid|3Dvgy5Uq*eR*Zev9ec>uUI=zUk3p`P zF~VAtXItFuOAv`(R?NJ`P!JH?5pFi<-EIO$B-}36n?tWLs}j`#jn@JZ}iwcHe<2 zTp6xjiX%@Aq?Dd7zI9E;V)_Zf$*3P0s9h8;b1_oPNy|b!s1-2QrohXa0uuqGM~lHb zl?XI;E72cN6P2dVDwq%L6UpPLqBm{&L_4C+;~$T%Hki^=ygkqyKqG_t0X=+oO?UtU zdL=Kxytp`n?FacZ=m3--3+7d}A^1Qvb799{;4R+bKl-NdFEf*4Jtoe?HurZPAT}e^ z;lFSQcLoM}F4zUxevPTe0q^<&PNVWtz}Kc$xXT&4U0)}ZsmEIt!PUs z)FLAzpxx~s?>bp<1|2z5VUucP#V?}7ALnoY;o{_-P+g#xb`SY}#3E4oZ1mCxkcSd+ z3FzKnkPlDI;w>s0tgkcvd}s=>WY;4Frg~5L98}qeBQbF%jdwYPd!V!3?9X$cn>5VH z;Iu)jmm6uPsQ8w&?2Ew}`sapoQqvGb-c$H`Bg^BYU5 zpaM}IGvjXUmZY0%Alj-$3@AqE<|}YH!@wtGUcv^S-QK757)8;-mOdxO zATSUvG?4APWgKTEu-LVecl^s(^as?hv&)aAUkY3{-4JIsjaxoAOPV?-8KL%7-6 zfXGijB0#qrk+^BJhygF$yv`P#*b9Q z8ZZR~tmPdK81ax3f@gYY>@mm(^l+{h2q~?>XqEF2%;q(JxJN{F3tN0L0{9Htvna@m zR*?(KOHgB?`xvM^;wN}n-q~dGN?eTdq!{Jnb7F`b5004bGUi-_SdimseV4QbNZwK- ze?UR4=#R+H=7*2*>YN#<2~BLufPotV))NhI2Mcjo>0{`PXY3x97s|6Uo2<^$;39JI z0k$IEF4c6CVXg6W&vin5!&%eDF9c@QIu02S=$z4WFtXK!Bo}%ittTImw|Jtg=ZyN^ zVT}%18gZ6dJTL&v^ka@Uf~t1#F?K!Kbwb2!!Ov2Rs548&^t3Z2X*krb4bJo{!Ds-- zX+)C7c{)dL2qz~?W=vH*IZFI`&oyEV70^jh2`~Y574Gi#)=m2C zo+uvchAbuL#2zSy@Xii)zrZy8KQe&weUR~x7Sat~2P*OK#IJcHY+L#Vw1GX_7uFml z)uCLtG;c?F-W~V>1aJo?8C&W+blvbcYjy!X94hBBEoXmD`kJBny}Kng`qQ@~>XT|B z3)x@_)tlU8ZWXy%^4)#wlSZk{(!p##kPCXWK4Cvn?=~olmmshG$rn&Pr>zjXQ3-Lq$hy?c?i6 zp}InYJUm3}lQ0;-uYio!l?6zi%v$(M{-@nL!C<>ND$Wd-R_ zDZIUPY?p!R7f{4+-~sTBP~`;j0iErmJ+_6EO=%KB8^Pg2K}jOe$lcF~n&xtd)eS{h zfaOI)989iUVs;o%KM&{!<-Cgs$I8&@gYNHxOqp#<1N6C&2yF-K6f>gpBG$$&UTSh( zeHZORm9;}npOBos;AlM%yf~cm1fsRk7vR7+kJcnqgTU_~sRaeNKqk{#O8BsTmX^lC zqk9FxsNN1XumN3tvkR(Y$aUGwkPfiOAIhkSMtd~^0xw?;3~Faigh$YB72FfLV)bqo z#{D>6CccRZDths%FF2#SDIMVaz$GFeqMM=BtBb8qORC)v0GdF8xwLh%BI3<+o6?~M z${5#}qj^AZAd*j&JrG}c0FLwLlas{#HZcJM-@E$mg5OucL|n;<^H1&zb1tdCO! zBLyFY@P!ItOelg1WPA+n=G-7aGZP1@9DE#!y^qL%e8BeO%u!A+ob0}_Bj^t1`|q3y zfyWqDF6(W^%|-+oU9e_o1bs2vc-%zLA=k|2(Ipr{Gv}wa0DBU@&yY5trP-F@tX@DQ zBZ!T(Bxi_^2n9X*NX8@R;QEP`_L)v7^(~7k+}ihXuo>6mqr$+xB_@={rH(pZtSIsh zi;!uJE~#rdJ}AsNh;taMw=f-4;YgI5};AxjTL1H?-iiDMS>E%2lE31d>&AX4i#Al6?!3SqFK%4 zoTqcp*26q&WFO!r&6;Q9!SUo(BZTk-i#o@g@>SAwY~T#W_F1WIK^jWsC}J2Fu&4?O zTu?;BtXmo6)AMYTGyo5l>j*C9HumA=2rG;T4O47d6;2*yH+I;98J0UnjDpH@6ffVJ zT!G7Vkyt>3J8)Sc=?>p+I`>GWJ%$H;QkVJxZXa8S>fXt0nSo=Sc5?`GB)j1ax*sT! zT%cNxvDyl%t*Ass$2>T&Rm8fGDpMd@lR2X~*%FGQ%gZ_E$5=P_`FC^Lk6xMtBP3Y3 z>eoyGNG`EE{aAYV-mciu*_9P@ZRSXhpMEk7^h!GB;8}Exm}SJGb2z{xGk1odXKzg2Rfzj6Ru<2T^g+SH{25#x zUoy;maCDMFh$DKp!2M-URiDTxKkAw=D%>l2v8RRypj(>Z`Jp%@a6weP&?O*@MY6Go z4ISws7u2ndSt6j>KqZv1=BbNhg!8OgVBcXglmNb(t`2^9Teyo*^d1#~S}BRB_^i0A z*GWoPZJTJ9xPTad^W@~%fVrC?Y>9zIwi$Ee#re<^*flmv9~itvrT4lFywPlwuYqWk zN3EXTgNt$$qc86Z2W+CL2t{NG9Kt56f(4f6Nnesh6?)VJ|n3=yxd^lCfUCvt8r9Sj*wM@ zdH@f!f5Nl0wjZAjZQ=tXhXJv}#Wc-Ud@{e4BfC8`XfUK4@*81MPyEjDi4TmUdfuG~^ z!kSfF+%3k$N`Jmj&4o@pAeP@o=4f(A(dGDJ1p620`GOZ$O(bz6Zs>{vRgK%+vD1`W zWAXx)S<0$cAX_50wde_DFyA_ zuG)tXRyS_xRHY<9+ADR+nhsy#qhWV2rEuV+Lw$HgWdC> zs97^c2F~AQ11SNBn-H`li4}b=OhCMBCYr{OCm9qu!2lSnAV&&I7!`ZQ>CXH*9{0ku zI@QLeDYm+Nh~}VoNIC~I-NYwaJMjP)bdy(6l+rkt*`4?aVrnV#^mB4p04nXZ#p%2h zVSsJS_7E0r9P>VoQfyc`9L50UBt;WMWy(x)fsSN%wz|r&!T@eEi_13=xZi;2t?NxhP1!1PZXYghYlF9lg~Ge2k&mC{jKfkIA9JChK77MmsEAjAermiQv;k zmg~`7G}}Qh=@Y|njrK+pEboI=R3O6RmAo$XBnNqM&oJCHf=%2I8V{ei%fl*_Em}ee zDdreF{7gr-7phozC!hcxs#yaPDESNxH8w_~2;wpvBN!+6*~+IF*z>y_kAD1wj&Yc# zKCWmQ;hUhWJdB(LFgs*WC}yT8C-1!xa!1O*WkvgYxM2?}(1GaluviH*p4vR%=G+W( zkIk;dhhKk+1*}4GDE|d0n(CxN9iy|>ZU-uOI3O{?&o56u9L75SA}&S^af6k3NKd1& zWA=8Y9eDbU;BMT4m`*4uZ_&(d1YXBrxPdFMbUv`8LCr0uOZQ>~0A1h+#Y4Yi>iq^% zx-9yqSPiJrukKg(9k^6(xl6+b zZX9-ubasv;sHl%_HFw}9SxtDb$ptm=f+CpR)izo<)38?0_|&f9%VG@aNtfpU{`r!c_5zxywZR<6cxT0I?EqqE+Cp*x)x_xUww@?TRoQzrc z!B?w{de?Hx!@l!<8U!X;+rW=M>B0TEgx6;8Qupj&dX>Wr#CQBm?h6XQ6t zTnp^pP9B@LmjOk0M|iquIS*EZ^y47z9qs;rP+HO*BM`3EYcdaecbk5HB>lL6Ct(!z zO8i5383ZA^jV3}lFz^@=0S@ZR?Mly_-1-oh{G?9~0&^uyt9E2zNsB}5D-2!r0z~(q z^XB;Kzkpk66EzHqma3tUbqd79mCmFM!{Vi4g*O4+gnXdkWEHp6(0@h$l-iM|DR$pD zGNQmWPHwV;#1-B#NkBAgVYAwSw$o4AgmVVtBA#z$833oLV)iCi^9Js~C4+9gt7tLg z&H?<;@p{mn5{gFQ8MVeI=E|w&O-Gn$pH1+HrZmRx<*_+nBi1x^hv58+T;d0e{8LFU z5%w1dHFEb6{5ua&WVT+5Yu3D&L5^>5tA!vKMYYDcb7X*%PN;^K0tQV;NiJ~?0Tbn{?*_Mi#M>YBIGg?@)@C`p|Kg1%JL7#3fgl_nap@IzvrDuU@iU7){)G+a!FCbAeU(3_Kzsd#&z_kYZ#T)=&o}%Qg`Y2OVl;GQiwQ-yikatoRcyuv;eeTVD?^Q z5fT&p1hUv83#Va@o}T+@wS52_CyMV0j|2cJ$Ma^Rre_3N2iIyRA_El~50L=M4xd>x zc~LDTnW+|QQh1Gt#}?$7!U#81-6âZ)&GPtQY!Pom{L zrXZ}~5*4_-b_9_M^&&RATPr{^ONGAB3s_`Xj{*?7IOjZuNdD*%>QMO6!z_DFjHYs6 z$yg(P;!8tr_<(New$OIrW8@?9estm{j^t-Z%RL>=6V{L+=|&T)y1TY;lO#U?mTqBF$d2lvrirxHC38jk2=x$W z_smJ36wqZRZj;dySrLO}Vpz}R=1?ss>^g@&z$f8j8QX5`k+K`c@=&Z8jp1N2#g`p_ zPzW{FO4hKhl+h1gqV92!po*4=J0g%F)ui{rc+&#fZ*FtSR(iRPbL(mDm@S+!u zNn7N|KoB#CViqy!wk@$2N1|&ohG}m)LW5}YN`@8KK(+$3sMt&|0uN81i5sdB5%{!t zO7D#RygE^Y^Cgf%NxPY$4`D-b5?)_q+ZtqC^C1hFlk`A0__BDT`D7#T5?_#YUMb$) z55_}C@K-k4lrpTrl~iHGdk^R(-q9DZ+Kd<$`=VEReTz{lG^~84BAVmTo|EGkgo8QU zV6bKvi=fx!UXd<~CdfPZ>+Ct^{gJa$ndE|UqT_K{_3ocn{0wT&vq&H#vh1qD6G)*V zig4&+C7$3O@~|5gIZtqjp7Z#?eMU5J4xkmqIr%`?5XlwX-a7_$7PoFm)0x45mvAGI z#TX(x*y!47Bf8LqW9{h{(GgHshBJp%VH2B@&x-^$n|LvvPy*fDVL~3ufL&|%BiGQW za4m&&-tet~=b;-fFv0OT5Y{Ia6oGrrPi)8jwAC*@*v~Q6FVc0f%sQ1&B_f-@q{WFY za-Mv5-@@*uln%?{aFQX>DhcWa5B-V~s(T-x&)trG&>k^oa11ANCpZqsexdDI1;xM% z*yJeuHF+bC4YLAFuD`<;Dujm6?CY6!+b|l6WLhcH=s@xyol05W?MG5tp=P8StWrQ% z=t&m189}TVl}yA)+w4v)tAD6e$FbXXfPqJ=dIUtGknTQYZ)bc-=*J=+P$7LCKKymQ zzoZ3KK*9&0=#&_G0K3uAKcNLQt;Ka@H6p6eYGT9 zK2ID~afrC}S4fHfGV)K*t(yvV(i2LI(Z{4siw%Vbba`nbd;(JMUNLu#ejMT6Ow2GJ zZV1`h!7C7r?NMUR_S=ebL<9`7Mzn4sT97O-IK~aGx|< zOMrm~bWL9Fh-PEshM0H)6;N|kL;}eNf~xCC-6%hgq8nixx3rhff9hXct zJncRxqIrvfEk5T19`7c`j6euCK;VH{HThE{8Nvk}$0AwWIg5jCklaEg{z-Oo+#0YS z3~Xy^{jk7$Rag;wYZIBqG@89J=}ZOgaQ7%5dqb*#8a|%Kz=W)KC0fqPzQjF@JuT`| z+*K7Kn2l`Iysfy|64JzmH)L;s24(Ya0O|kNvzsvDb@#k;MOydx>3oHN#1DXREFwZR zBA9~&aRaK~!2}*E!l~NKa-M`^Gn8k+zrjtlw8%W$JL|1q7zqi)&p@@-Y`C>sFQB@6 zScclIZCre@n;l9j+IlPKXaa1}{q2F(fOgCS4@Zj1OmY$d8@jgt+@KX^QeMR89E`ZA z0(TsLs<1%~d=YXYh1B4sFP<656t|>dk0S`AQJ1!yKnzOv7T9UpF!ivbKXqvap@@*U zs6~{y4+#W5nj27Pb$ZrvLEH18Kxk6kJdCaId~Vk8U-YQOBm1chG)qPuN;3ti+Rc!h2l zf@!!IC{(DrgLu04Disi2OCD9K#f@IwcB?!O!D{we?rLNK)GVs#9jNA1f|kLzdvw~k zblSu|$q<$qLKe4rxWdNo_Y}xOtk(81v72GxH={KMHVxGbbaT5Z43=+m|&UMo-v_^fmD!7nK=VC@7N46y;VXE`uGUjIX0pwxfi!PBi<NjZDOzkTK^((6OYq+a_;enj2i9r@Dw8vk6J4k2PzJ z>s117$GX{VH<)=zDE0!oIl7aM1U6*&iSa_RFblRF;+A00M`8iROb6;&Nh7r4GcXUP zpzO4soO9(u&7rBiU$`1$PLf{i zSIgMDYXcU}6w+o*X&g}qr;KOF_{eCMRWdTw+}n&cm5PZq8+r>^xr9z%*b2*TATB$) z)u6?|L-ZV=n#BHbElMxoVn*quzCsQB(pXq8D8L`q{}V=NO)wv@8XH9Ddc)^S6n5PKaJ&@o)C~ODs`lehbXBpc_U7GmAC#g3Adua;aW!)Zex;} zHmt^^aWolm9m2|*O@w9VXSb zScW31jB)V1Itk!{UK!E-OC}uHQ3-2LUY_rbwN?SO@Ed$Nd=I3!`~WI!gwplF8C#6j z4PB-*9EZsdg5qx??YAxjw30YRZzReyhx8NQ%^Au%C~+reICFUH*6Tby44807Z=Hcw z?T*H#K806noWPEQ&0|sYwcEI3xG({2aUUGS?a3#w&`VkJv=&?KoNq%18$cn5oy@`@ zhS@dNpzfe=xj@?oDX`iqN?hxpa1<}-B8?kqGTT@QTr+odhlR@uesdOy-T9jUwIDC& zHkjnYSOcQSa^2wg`dtOp4g$o6uHaLExI>LF0bqkSSd8#vJ=B3sG?=XjJjoVbjECMh zRVP$Vpg}k8BwIhJ2>Xb<{i9D*~YI)c$xDw(iRM_0fT_8iBMwE zk7S)N=I}POrVDS&FPqNGMt2Kr@=_bu!_aklkh8*687LWOYKOu2F5ak6DUzMZtKPyW zwRn>ab|BFYwHW1f(`5E)37@9VA3A9TFm!R`xYB7;E)EWlBYvjU#iN}Idit`1%%y6t zw`&{_6R2?cvnkKmWIPDejssd2seBnRop}WaYz`fW2U8G8#Nk#63zJ@)Y|6I)+09@> z!H2g-LYSiOq9S!@2_(yI>K+(K14}No3LriCo3Z71X>gWVP0RscNRvz;(E&>Q@L(-4 zU=R<7-hX!zTVgacm!n`JYzEiqK zJmbz~8fWG~J0PDG6MD7}`+GXvtWm<+LGBfPK$EH>XK@60g=ad663{JBx0xMYr+r;Y`-Lpmm$WhJ#3D>Yez7c3EXy@^Z zCNo;V1=`YW9>S(AWJo~~7q9|%txc^&s5_92yD$*`kSQx}0^I1(D>joM#m8|%&6O;B zYtW5uFNKheO9mx&As=8>-$H^H`UW>+!8ff%XH{f3Hks(^!wKwi{x1Qx`)eSOY+!)ITpl=0bz@5E%0}s$t6_Um+Wdj^CHtZdNLCmz}={pubnNH zPfI-`rRsMO>iDM4lma>@wO`cbzTBKRO`3XuKxeC|n|QQ}c%2=ZJ<(fO&}$UGCRKRB zK?~R4xq%*8`T6t$9@GVc6h|J)WGC|=&EPqv7aRjjRkZ;Tu9dzOuzfhDGubd}(NGIF z0AN`V4sNf6ML{=_hnSie;dO2a&JYjuDP1V`>-cXdSsgwIKv5;h<6Lb#unnWYG!E54CLTfKR zdQwT&5P}2j7LmMI5ASv_Enul%jPcF}9#S<{Y2q`CiiVa%>as7(DobfV+)z3M*H``c z5jbe1m`A~gCjt#VfD7Exr+xR0NTl@MhuT7Qk!x04<9yzseP9V{GzU((?7BLQJjkfQ zR^A~sQe46n+Tr#F4+2{4hzuKA zjLx-ae+(~d51Cg&tsL=M+b&@-m>>68e4u`JbZ}|%S{F{Fjfjuc!?y@XpgvRePQK!>pQB0AV zXT;Ncx*3|N91>#4QjaCAgPa6Pxzqj{61MhPSFGp-8h!OSHsi4`@7c;>BT{3;AFYh_ zl$gZg-_k}e%>l?#CV^Kd#S(k8h$3lxrbWNzVqd^wd}8vaHh2X~_zd5c(Se86MyA2Y zk-bXm3_`_#u#96R0K6Ixh|bt)+(U2n2!uU!X0Mf;PvTfjHsFQE1$ru&v~hRlU1&N0 zuMqcSVL+i(oHcXAVcqK%qPxM*w855EOWI}|;wUpZ%bNgi_rb;45qxYT3h8BvXK9ZB zjV7SN@S+j_vwVsbE5UYW*Z300T0IozJ<2#0c{OVjY~*_E`787$s}%J2&g z&`M#W0WBmzA{(zz__s3>vD9i6wF8CB0eYe}zD*whGM(#-7)dsKgl!;V6bIpPjUqgM z2)m#89t59(d@RBG_6vDFbJ-+f{`)`e<5tD7Gs|p0D$jEGT??Jg|##2WlzR| z{aG_nVxgZ_aHTe)#U!pmq3;02TQR2R(uS_?P97|CH1Ub9;3Xm*m%$7@DK+mI!-Ied z-djq%TA=nystSSDZ}zn^^wuZJo$*GPG`k^$9>nSpVWwRHmy!K8QcLs+UCLn(27ymt zVMv)4No}uI!dPZ*bc>Cn{cN*OW`nYW$$E&Z@M4I_(r#G3;drmr2=InpjiEhogdr{5 zjBC_J+V7pkpct^?07H@w#3kK=k1SMMTqE)aB*ZOm5NChoWMadq?1Qp%>CyTXp-_<5 zEc}Yy3w%&+JUJLZ1oR+__!V4&pojSkL=~Frq8?y-eM8zBWHm?zFR4eUPgmqK z@Qb~qISARqcvo-eXH(_AAG3yRxR(P7Ut9w{7~22HbjPtFRQ!WPp!8QY7I)l(AMs&dF9Gc(cC)r zCZ3x&@xKw-x}xLwP9oH)=;$?r^pqI1P~0)bQ9P%vxF*eGn*R}J1gyzwk{M5{3YKK> z%*rz}!4VJ%3RaM<2dKs?xMn11O)xv1N9c%jRSQ#x07j~VtO<{1965lF$)wLDv88MY z_&n(Mr;RZgA(aqBH8(q3R6NYO2EcZg#idfQu37nGr)+heQv-5v>+&pEI>_LV6Hc zPWc`&pTBJR;NQM6VK`nDq;w3m+d*6WUJ<)(YSEnxaEX2Rt9Jv?izIY4D10VsK*Lh$ z4leuQgebj&02X8F3}gnL(0wj_z!!brvHq zIKE^|ZqJMX<{Up;)gkD(=Q-Z}@i&KBVMz60WIcZthOz{H+Ev z7C?5kK4C`#w^S$#bE_LMHmgmEeWR+ejbt)ulwDMH)uh^0vA3{MrM_jlbz76X&8;Q3 zeF=VbLeWj(;0ZKN0=@Ql8jWNEon40V)6n`s4DD;5yBV^-So;tPtvBeX3HQZ{?hY3^D*PgNw6L8uu$(0M7s%V{h5Tnma^)Iz7X zK#Z5d^)eL;+60iDll?SWFhCL8;`$-pvVjUd=i!6|%E%wj7lV%jq@)l^idu-k&rwXZ z9hKHwJg7q0FqV_NhX-|0+hfrc?pxM5fpQ3hT4Sn56P**LIOJTfMeo7;@j6X%2Ujzx z7rB*6yu4ct9CUU*dh+{V@v#`_O@R62yacsJ1js((a5vVP8PUK_gzc+JdQc(UfhJNN zj2ajl&{Qi>F9({C5VFy&0v?Rrx=n$Zbnqmkiv*UC;HwE~kyq%^NMQ$F4#w#jQr#gE zHVYcXaDl4<;)y7#*{jh;R%H=*Hg@9`{E$kM51JZ3(Gt3Q$DG_DgygFsAVegvIEZ2^ z<+2r22Y*qXx2tvQL}$STrzCHW!bI_3hn%k9- zCt(6vtYEWk3U~X^f~(!-DU(L-p=F}?CVLpi1R4&mY$TZ0e~VYd^RD5rK$EFe3mn_-xAd#E5xx{tl3yrJ^HYF*r=W(m3kJLk@D2 zG;Vp0;T5M;LmGPAdD>zsE8dE=_p$c;(i^=umagfC&bAVxL7j^15jTn_Ai>~3tIr^? zZ%w}4Abp@cu98-F105>J9{c!EZ4DPj+RqSfhw!#`F_yBs#AYmM$NN&9TwV*rLM%hL8(r;>RBt+x zuqWQwvs19S$u{wAX7Xa|b+!_gzj}pPUSG_djpm1dDj~i2Y~ut_M@jAvPvtYjTPQYw zjg%@(@#Jsfr%xWE+G)1A;__9wq&=!+TZ$DCkBTxQ2aX zBq!wnc%axNvK2tDOgm|a%SXKyf*}Hm90H^80 zGML2YYEMN>9I1!3h(U)O*c`Gk$yO10qwUVNMmOw8=ExN1As({=h;$U4p29tC zF^Cr7r+km-L)}OD1wdM-iO1$mpI5+O6bIf$Jqn+PA)E~XFEY9}fn_YVF(a0kh~+N~5|QA_q!{TS;TdQL zVvP#Hdn3CTEDq!JAM=?GTV+U(IJ<`_kSB9#CRWq*zT<|0vkw{L!{7gTfA##?Sq;Cx zr*srR`YOJ_dwV`j^uTXt<~X0%EJ(jeislycBK-!iH2T9fVbOc9cIHBP-aH6m(^zFu zORH5qS)9~86YSkBT>TOn{i$m8jk>X0eN(&Y-qoR(s?@txZR5oldW=QGP1JJZU z*P0YNfC27Jgt;@$y#VKAgUQXU=$ywsRcLhBG0{M1Jg~+gjAjiq*LwDUvo8;E4~pUB zvyUeeHk3O{ZQgEsfr8j7Fhn#W`-1L36-wdcR5YvyOz7>MJqRkP5HUip3*AD8BTz>L zRvoKxuSi?<$klqyrv?abWVgpx$Z#V=Vi_bMfP9$#3uT9lgzsiz3Dwx@cGfk<7f&K# z`my`XV51W$c_~)i72-3jMGAzCShnb`nBXYuCOYwinuu~li7H4;$VY{3Ac`2lT2I@; zchZ_QlsjV7tbQB4AsUUFF1uTBlrJ!6W=05*dI4k=ABiV=BXXi?aV0Oqg>2Je04gbv z39WFAf*98dU~-QGICPs+fXyPgEQrc5wStkAY;Pede<6QIV}`h|HR| zcrP-rCTy7HbFsIt#S9gr4!Y74F$Wk&Ow35Lqq*HAg)YtLyQ-ZfkkC&s8LQitdNo4Y zsk;v|c(i3EtxJe*tK`)|wXT?)qeSW?mjSV^4w~9^x$;=-7;c7V+u2 zCJb4U+`tkp;1hJf88QHSgp^I$2Q{V{`JsccaUYDDbZfLi1x5+}+#4I(Lj)OPSbEh% zZ*#{kJpnyl(#}x?5quyP6UaoY6<4`KWj^xiNXCV{5Fg2fT!^Jyi)>?fbXRczK*}r&k@l>$kGXKTGQj zjYmN$e0_g?uf1R2<=sf@G}Aie`MnH3)9$Z)v?;S+)m!*h%3aGx%WV&>-Y;U(rhJH; z@9FR4nX(&b4eO_2o=!I)wv!7ADoAitmbO~0ratc?bVqO1?%wKG*C(pGKGlU?d*7-M09`W?Zq0HP018cNt78&~ zXhF@$6+v*dHO;yNi8mb@7nG(L+P222xbVjuCr20suDvFe7{p*n(M@ zjxh}x&&1(XhzUeh!!Z?MNm@oMVz&yofLmPb#~d0>yF`<#bqBMRI^rE24SE{gC13)h zyt6A04}f5#hxYn%QUuX47rAHpj#9k|5>N7%Qq+4}R~?%O=phi1f$hBZ)?cZmcuKz) zuhu2(kx+F>4tMZ@c4U~1fOc?|6tnTUmM-yD%pOt5gf+_-@l$BwPCn#3KtGpA=~6>_ zd5i472!gO2D)zUDl$KpV9ZAzV$siuU4Hmi73`Dox8Y}dGJ^_K3KbaY%9pr~vMqMY7$D&o7g&i@%A z|F9*HafOb%C1#rCwLt^D6-vfU|2 zn_aAyc9{s<)zxh5er4V4&#vZf?cc0d>38iH`u|`@cWeKp+u`wdUX8wyEvzIXG=GO7D*;w+dX7L^`L@(gQSrE39$!60rETN;#WQw1mMJ&^m z3ysbsn-rtqI(>mHmMIj$iy5sZ7PS^y5nBu{GEEw(CQyXQ_6iuTlGK2m)ZGTR0e*-y zA>87{UJ-1(5)YBUMO@Txj;AW2&CVHOf^31==^@HB<8F1ZnE~d&tU`%P200Vt)5UHX zzT<_7SP|FUin?bjY<%nvpH*{3u58 zF0}%#z=i`XBE-+e9?O(wco?9f2Jk&okwul4xLPmh&Pn~dh>zxPXp>ljNR2bnNa4ZB zy0|By(^G9^#)1~Oi3Pn*s7Yf~wz%{Nv9hF)?otvT!CQR?09Y<>7t>K8>H%X$ndxrWE2X$Vx{(zVVI4zE)#STco+v_k z+=SED&iVYbu-^(S-#sqg|6^GcPcQprb@-~RoPKe(jNfbC`OCg)mc|C1~-UN7^UzfgD+pmA#v*`00^k*rDCct=X11EK7{xFZLXCC?QhbioN#~l3o ztd{kC*E}V@Phszq2XofadY=N`Uooxe%)-@a0jajS(Ou5r?&>Yfrnzcw>7_31n|-TZ zx?gwSQU9yD`zH4b^}GA8zN-qMySm#J?cT{Ar3^1GF~z&xV1R|0CpVg6MmqeRlX!ST zYUX6h$x`VKcA>{HHCM$pxMq;U3VJCx+6>M%*F@g)(fGH0J|Mf*p{Eq0Uw%-Aw;VbF z2-YB&9HqsSQ~5Yzm%(>*3ODepwaM!^nr;E=vEVo+bue?NmZ06p#tIo4f73$!b~xFH z;Q|t>tuwV>Fhn)g(p9(t+af$8-{i9Q1EYp7hh&2rNYTpHG+$Y;oVL+OL_s&kuuX!P zz|EYYtk*&fvK8WQ;4|9J_Lg29o59pWjw==o9Bg#6gBSI@beB|gsMnmFgRK!g&m~Pd zzkHlXLJ|xFa6rU~p*3p;UFol6*;*2DCk^M_~&)a0LUn0r!fs|I-$No?SPIZDvTL zp-<~B!^l&;%6AA$d}%M=@*mL}-xTIu<^h$1vUvl_nA(4CmpdJL! zMKyCGQ4=|fI>(Yj(jpy9x*A?rPh@@Qbw=+t>MT07w3oB<#H}G%9un^s;!{>OTGxi9 zko1z-B)a5OxrL066%VfH$4BOmwXRqXTtB!TyjH{`@*{F_UBM?85Eo-b1Y#ks01$}? zIP^R7jDh1l89oK|U3Fa?0~5b!vGMocJq7cixf}MkUnJ z%O-?5euVX1Rst7!Nrz%4c#jsmC`u?5BczwA$TFA~oSY&v7CAp48tddny8=BZ6<>`z z0pMe11AK$wvbuqxQgb5k;vj^DcDTq1i&EbB|pOjkX} z^g%Abqk^ek|4Yu8LzV@6oUjHw%Qh(SfG3OkzWi($h{16z3P zx>I*!E28y~UJ@tu8JnVQ8evcmKZz&nfnYdhR*^QzGzi!Up?ApeOofX9Uc3OJi4~!H%FVMG=)U3FKj-d@3ib*Aa2LY>X3bct@yL ztAWe?RL|~aANf^b&g=wk!8E}>8F207L`-J-dkIIA+`ALQ>incae2E19(H+9?hzR}Y zp#*)#a*58QB4VhzbUAwGK#xuOLsVK@dwF)NUVWL^6bG zj3fR$GIulWhGfGNszxc3Sj^BWuAf~0jVtqUMLcu;BiBE2J$OC1K2|KQ3;D>k5Rb?! zTwF65^S_u0apJ3^jcq|Be6okN^8C@h0l4p1*h0rzrkkUO&b) zc_#4ht@8JF|D?bHCsgjw4jXSY?jH;5Bf|bZuRa~~$b6l%H8tSg?-&G5>yGvE*mugp6)eC+1zWaXh{;Yao|GMuN?^pNlUBB@9OLb!x`nMUZ z(l6)dG;c#Oz=u?x+=_$I6xv`Fp|=QDIyL||Kx+B7FqD%fUuIWOjL zF=)6ZE}+W&-n=6g`qnJthb0nnndc1&T#c8asAo{peOPk0I)!JTsgko*zIq`ebrbZW zP%1Vy`iNoi8ARb8SRpQSHeQ-z!R<0kZGVcs1#ikRz&3V=uIj{`Y0AhApyg~gzUTl} zw3=c&t;Qi^Y!wP2si4~=Ea|fw%?OyY>dr@vlSB?2szwF2x`andJrrO8)!2=lFgIpv zFb_>#jZcmqwtE1fH8=+BKoB1`kbBZVkhl#aGkQop$o*DshVo zko2;QK9Iuy3N8I45KQp}NLb7!B>)5 zYG4DExn#T)L3)`1p{z+Z(?>}4PpE~q3;_x$f>)!0ATJ+j2Pna99SU`+Ln;UnKOj&$ z@e(hC$OuM|G5guGhqaCdj`TV$>&%qD#>G?nCfeduV%zV(^{l7n7*M3|o$J4s zK%b%J-{Vic)8DHu-iPxke!%a`#lJEpwB72 zUjytO`Q+4tFuU&WS zf3d6ftLw%7RNo1CC=EO+eo+iu(4Gaa-A7>abB_Lyuz^>iiY+|>L)PxF%9+lP4(I5I zeduOho83e}w*bTgT|f(WTWUJn;vIb07Z#n0-Rf{&du&v~qKz;`PSHgLaRZk<1+$`+ znzvK6?G*;^)>M)4OyMQ%M*0No0w!A6+l^Zes>GVaj$XPuRI?0!vbj!gYEr&65i*wXJg@q2Q|?H!fmLGa~RnYRUYQDm5+HDVkT z(^0g)i148#^+D96KqD~uFkywds8RxtvEgcRJ&Km(1;ZH~v&KU>VC_aGkkFFjEpgAj zFns!>88lrh;c3KWK||nyw+Wjd7ql(YqygQ$BsE@M6xjX*F^A9IWQM&N*})5jm?sez zfris~d~QqOYTd#E0G**r;abXI{xjFlydJoI##;IKXXHP4J$bE+kGL+aKwcRi8Nqci zE`vl78IchQ+V#V425w`et&UgT6K$gG1UB{=w_cwg2u{}c3-+qEWgl2yf zegNlyy5rcRBuEu!kmbqQI|ER$;z&`a@-8D(x)rFRNtJS?#FZSM5 z+TDG3ee&L2ziYp$Zth=u|JMB*`+w{Hg;#68*uPbd3%{Yw4hGSt)b$Y^m^D<0SFpXx zMl^AuQ&eH2Nj{)`7NQ#9ZkJ;ex*1&1Edu2o(=C;=Z>4n73>fMSIeiPQ)u7@pn>|{; z5fzQb-GtLlrQfaJ#1ES|P_M(NK(GvN;tU@OVC!~ZusSCe-G(1_b*gH`?uKN))@9Y6 zTT2=AgcJq+KHM1Jwzn06r`rMWYoJl!WW(xVW>8}}Q!b?LI`V?gmf20e4Z~?{xgRHl z&$$)thnjJV|8EyP9NmpyM3z;(kp@Nq(8Ta;z=2!)%(k3^xrNr9g-=9G(A*rwoP27~ zq`J3dKsEvu9Z)O>eLJ*-t$_0n=8ke~IE0tO%ft*VK@koJxiTd7A}DL&n*MvZnypbQ zT#0{>e@T6j!cI_%#Q!5(qgt&SGi+>iCn>zt%Sx_EM9U9I-FuSn?CksU7CROuh0ml% z*6!&)!|wPBvz(+w5BfV1>8R?lQUn4WhInW=&D~3(pr6MxETQhuB^%nDnnz25ZG4^j zEG#CRZ(|zC_;=$P4bTkkTIh(>u=lP>HQ~%dKwAh9SdCyP^n<=UI)cxVg3ib+pi@t= z&BM|0W?1ule3LHf4+83n@G&bo9_zXyp2!b8p1D4lAACHy{+a7yUa=m?XRHVFipaZI~-u)bXS?Titc>^!W$i82ub?J+`&(@ zQJ?pKx?0d$q=P2T4aE+J0mmK8hH13f9Bo=K!3_|4h&v*H)nemCAoU|q&{GB@Dgf_= zcLd3ccv;p9PMC}3frEnvB5rCmD$r_m_)(TrRu|yd%^HLgnSEITUn5f1UfmVy!LLs63gdP!{O*Li&KOnVzQ;|J?&PiF<~hzwnL_T%4;Cnb^=@hY~7^E z?*T@sQlz58Q4_xFLUaW8gOKpzWIOm%f1M5DG4vB+r7`U^Vc4a$G^kv^6*he*=(~Ek zcsFB>7+8%x4N4%^4@NR0uV>^>ULSh=jO)p@$p4Dju|Hl4G;|asZhuZ#WwWM8}Lu=O8{pdf@Nd&Hwn1AL4%&XiZL@Cz-P)#&lRd z;PcSZ83+V&An=$GWR`^&N81mzoJY zmH6AA$1t^yTKlM>PW?Hh&^21`_ek$P`t22-!@=1izFY8bZ@7+(1#l7h4+HCWS@m-F z?_=>l-(*f)7{C7tzkM%#E9A%5MV?jkj5Fp+`WkM3{Q>FSG`sw^zFOqziD9&e>$1v) z+4Z^A=4$CS~-JiPux9?xNfA{?_)UMb6;{L3v?hExwsXIpe z?31U;VdOx~fgU86?+Fo#Ze3{4awoq*hKvHzLVS+QV4S+qQbtP&?a-rngR%Gz>Bbqc z07+iNtj|Lg(8ddKQGh;U-c<+M!?~!=x1Xz$=$_eZz*tnK5b^Tr-u0yPA}%-0k{H+M z>-v+9tC86CR^mB5#RsqMJ0e?!X{ri*oMD&1mlQ49J|hKiL6?IU9pM9(bc+v<7OKaS zsP4IjF@q3z&Nt`sK37?w5fKh-^&J`}6yX#4pk?8%VO#_YzZJ^<=$4r>0ZiY1lAC~wxUtZ=x zn(%BNEO-kQ`Um(Ecr~N@R+pPRHH7U%RzcF|L!FCyJp>$fDTw88iiC%8VxN_2Byq4%jIcOQ>4b|+)0$^SaF?}W&=+LrW~|A;6qEUZl)Y;55&{y z2NcL?|3@JCQ`bLnWj-EU|DWr6V*QiXGuDOcgLy?R&&jSOamt3AQHoZ8X&-Z_Zs{eL1$GIeMyvWwd zd~1u_>aDXtZuN|>yREoxuahmVMr~Eq-d(@3e`|N|&+gxS|BJ7`KKH-+-tqcNuYXm2 z_9pIM!Y5Tm?8Sz%W$q-FkVJ)PHfZ972y#U?_|jZ(WmC<3RtC!<2YwBPXpErv<< zjuHu@LS{TW6uqMCcnajWPSxEVOuQd>vdN`^pb|ji)oonCC-9>9K2d4p_Z#7$>D!W$ z>VmAZ388cXzrkAr8aHQR0ig48aCa#50SMXwmTthIx)X`$M?n+azQY=NwW=sG4Wp*$ zUHD`($6De7kZ}M{TuMd+v3%$c_2RR2C7ogo;E8TB5=#xmOCs?@sKW132TZ2CK@^e! zg&n{zI`+;)!{a3nR{AJ1W4TOS4#(_{fJ1Oo+QbWez=!C@J%c@K<;OIzk#k^7s||;$ zVR`4XDd>eR?>^~<0}*mSyVt9}TmAm94`xb5#7n4fz&mzx`|#p*Zz38yOm3UZDfO4` zgpf+FLyL_`X6t0MxCP$~pra;aatH!Wx0VJU?Wv(1u{HTIB{CM%QQ+bWa-!u0F>)hv ztw-cftRHwh;_;FBUwr<=^BI|I{WJ0h@)7yuT8hQYH2ipAQb~G}oTtS4wsc>cXNil! zAitZMqnJ8LVLGSi_W<@A^$90mXKLO&Xycp9^^c|KTWIvH{G6x0-jC)##-p-4dOFJ) z|9?>@zCZh?!1R0CdTRN*Zs8QA_j>f;5dpsODD$j`Z74bs=6@EIF_rqgYjvDf&Sz+T zy|DL>{vM%!75ejEJ$=%VFMmy;r-A?DJ(=SE{z1OP(gM^>S8fsQ$Mh_vkbis{Z$> z!Q9U9H}=Z+2JRy($LSFe}uUw!{iy?*H~ z?3eZi7%C{#&A1$Hor6N6ctHx@?Ptl%EE^E{Xxt+bZD-bnmo=g?Bs>cRR^nn4aXVCa z)}SbIt5@?O-NYxH65Xu`azQt_iJv_IP-(6W*;H;2!R|;{4L8J|6;$L_2v<5}Ru4%{ zE;Eu*h4R~Pg>Oy-YK{dW7VwGDPL!8UaUQeiY8D3aF61|mwKf7PVFPm)b ztNeBY8RvO1ju>{FyBaHkg9iADN)1d@^FFYEZdD+2v{gan`f?%OG0y zJl+ip_6fo#ofuawX?hsm^pnhzy@f zrts_VnVXCnB!_?Vk;voD}?Md#0u|P)VySoiKOYz;}MpzLwi(GJ2$~Z-IYVCPa&ml)s73YnR zb@ty@esk>M`w{+KUStTTxtEyc?^{h0zMkHvQT(dke>{^;6Ie+lo z!21l;Af(W{XP(m3_*15Z8PNwK4r1e7oZsX2@28?O2WPw+e0?7=e5<8@42u6a9r0`u1sm9U9M9=-Z*|YjZ3Jed@9Qx)>0DkzmP4s!F z+JV@HP;7H~maFOX;fkGrN>Q=O1#tw)rT{LUj(QtCy zTMEm4!?99jqDd%L;4&}^NZKNWB<;!J!ll@y9k|@HxAM~66V+<9N|FFptCrc4d@88k zf#@(0n;T%@0foQQ>L-4Iu>?VGl?4K|!b$e`&BT?-Ge8l9@dPtZ;wbck>yXA)^em-K4= z#@P8@WjmWTyIX0exjjg4B~8o&A#D=%V%g#Z!quX)Z_L%h!a6z_bcYCVxMkI^&}ZO> z2`oOpfQ-;RBDzJQ`6)-5G=ZJG+F_zx5UPLEF=VLZDrwFTrqwuN1v^M|m|Guy7C7e| zp;n_v^S4{V?iT?WL#Vt zuSc@JdPR*_^xe08eUqB`$Ct+H{ny8PJaVeS`#ZkHRKR;WjsN_QD|hz*1OKgd{@d40 zcjrg=-^9%Pw^r=^Tbgz4pWn!v`ma*|ReN}5=l$&q&KlNUpl|P#X1w3$-G29>_)>1o zKmA^-`gBaZpJVggK|4m{>kKmk>-hGLOpcQ<#(krbW_rQDz3Q(EgJ;Tr<`D0i{cT?I zejDDM>(^WT{m1G5>^J*Dul!pJ{(hUkjBcl)f3rbG>eYSP|;`+xNL*ZuiR`(J&3_UpH*qxVc)#+`O~G3fh%RESiHHJUE4 zks%Q#zwQZK!e(57MI^9WU_2=SOIgtwaFEQe@hHQi&7YKjdu;P_^No5k<$yuSt1&|u zVT#MgHOIRhLgSH0#OiuUVnpa#Xkc~U%@S5Jg*}oeY#}KwJ_!^zc$1={ocn2+ESwCu zB*`Fm?fC}YnP;(4O@~QB;$%^9zr;5bQyB>2hUjLF_;`Ue-Wz!Ybmx8QxvZ zEfP%TQvT@cBd#kRKl1U9xPHdtA94L7)-%@w>m%0ltx}Fmf7XuLoAtxYkYn^w;}V(~ zp#QyrBevvMM}L$}e$W{lHAP0>Y^m>OXB>>-c`|-2GX2nfx5D_U*6(8c{cHbL{&>pv z+phB-GwItO!yonNOPPf~3i`i)^RMphtCWG?{>=1X-)q>{UwFRB`$zo`-}zm5{(J#n zmF9GL%Gu!7dzJp)lO91?^Xq;4m+bzaZ+9X8Lj;HbXw)g-$TzXuy{sdi&( z!25#uR?#K|1kh+Nzkiaa628wC-|F{#D}Xu+>vNVGm)g5OC*seu(0hQd|8V8JVP^p1 z{lUFiX5UUAzSzTOw6pE@SEPTYqwI3t#Mwkz#HAi-@ViTPbKKItd%sk#-k++^-oHQY zuKQp6^{emy)$6bN{2#pj)t|pmzjxm(e_}UidFiw9nh9CtB4B)em zJww>$NU(|&v>Go@F@plHy~DsuFesr);pxdmkor_`5@pD+96gFyLX_hf1hN7WezKR) znHM1Fg36fQj3q?2Gf_H;Bi6qHo4A{qxPU|gN;5-9wYK#<)Dr(?HfyV(M^I8XDzp&E zU}IC9+l8EtA7XoEd^;gc68f_C_S-!k#jq4S801x_*=Jp$3jUPfFOQ%PNoavGh%-oH zHSfg>9a1S?1lRCBM=rx=DX+j4Oz=jB8qLUrZ?4uW&_R?IJ*$oke93oIuusq1*Ai>DG@s$ zWVbee#D^j0P%$&wIKvQ|abZGPJL4I%SNA~VqUGFC(jB}I7j-+hD(8eeA!x+*7()9= zi2PkB@IfzPT@@(!5;yb;0v@u-9Hv~am=Rw95Bu(cHVftysEA0VVmk7ulZ=Jmn#5$j?;A}?lIPBru7$?S_mPCoviif}3_!=7b`vk@JmtxGsM^q}kj)JrYlV>)o%k zkZLp28X!tq&HsVmEtZQwcp{0{L#r>a3gGfz@z0hQ$D{a!#jSK$bFrjBdRE z6`pg*0MA}JOstv9URU?FX1qZlrHc&W1E}FlI{N^Z)Q0vpUm$@rJBm!rR6WIWeAEaBIY@r2|^#+zR{nA>H`efI3&CITp= z3NB2E4$ZW{_j-(d0uO{QhAXar#Jb}7-|_g!#}9t|cU;eS{EX`#Tpy8XzYz0^%m~kx z<21WRt{kV+{o-C6#>GHS+-i(>Xx=EHgSzF)&k{d;FQ^WJGu`EOsVzx~U9m?gje7JU(#X94{lQ+~mqze?)Y z{_x)p0s7nD`?n_e{bP}D&s9@t)ye^Rac*APcp-a;8}IVh_;y&~nGB2&;oE`c?2G-$ zzQ@sD#{$iF`=)62@#w3W_QmraKYZ&H-QD0Fn98diKSl5<1sy6Fj++zINwOaRSI`uQpn5lBUFfFc1m=~N@QJqP$4-_6 zgSczp8n;xYL;)(6lXb(wf#}wr`L(v6H#G`$Y3PzvZ(1rFg-=&_=>+xtjIeW48=Cqiwwl>x{pKwYGBqjE#g4F>VpDiY`lbVQPmgDP6C zP{<`xx~Nnb^!hXo3tpq53Sl3v&lpzx577%HNZ|l*SH$I;8hB6*?go)p#Lrldcs}F# z-}(6OeEx{XKjQH-t{+&Bygo7?u^xyOnX}MkxcZ(3HwLNf?AtR{_QS#^xHC$`Igc30 z;sP3ScA6K@rw1C5$G6Vt{m|oiq<=Ld`g;EU|LX|P%JciL|5>N;H@)kbc>kM>`Kvqq z{@4B681lU?{hlI)RXEFoYK%DmnZfC%!|DgsRdX)zS^YmxPXd$oaIs?AUzLtbITbF z0%>_!0XMRmSnhtIjkv%ld}d_oVOtykAf+Nwyc-+ML>%eY6Lzd07!9yA(-;w1=MrE; zTB3k`^G-f71kr*V&7tZxbkvUzB2?Y_-4gWC3TS)2(D)516oDXN0C%DrWyeu+38Yr5 zq)jX!BPK@aFb@lCH-SJF zxeMmhFn+`PXQasV5QED%OyuIleEfsYAMyBST>l-9=k@rR>nE;ft_RnX>-qnZ_Gdk^ zB}tkf_KB$KIkx$Fw^%YFx5~<5S5+@HJp&K}lHeObzL0Mm@MV7K00amQ*@H$ethK9h ziO5*)=DVBOSyV;%AgX$fnfuLZkPc*|Uvsl#XHk{qlTSWj=bW|YaxLXrd#&w65%ryx**7vvjCDH9!DBPnW5Q!{Ex1HQ_JyWLJ)><4W>1ujOOqcLv9rk3dhbH% zce289DIe!qPbw)%NGpBBM}H^%R>qyg#NtI0V*n8} zK}l6pih|LpDp_X^DMje0%21oF9wDUgqDa~km`qbbE$MHd5it=l8`VH<5~B@QhNv^y z_|h*Bl^~>^edddUK&Io-TJ&m|97sT>anvz6z&Q$13t85dr7S8%cFGyYR?!kn<5)m8 zW{Jo+HR#lZ+^}oXt(u4iz$+8$NEDos=_sTOb{N6U0iLz@?9@o+>H*=bF~uW|&eVHt zXprO)vS#waV0=4HYl51*Kn6_3d0)a*$VO}U$N!a9A zOMA4!D~W?}7N{Nxj%+Y6K{*R=y6lM)6G={uJdrnEBH)a7o!yIL@}9#YG#hHxu34j5 zx^@%X3Qa41$$sIzbFLxp$vJj`&C5FGT*fVBUCx7qQ2nm4lrg1{W`Ovhd|R5%a=MVM zN41FuUQ><0HYJ@VZlH(mbDnt4O#U-j@27sIR!>xqTMQ%3z9plX#fOzEqzq%}Ot`ZC zF?$57oKlS#>4Eo@rwPwVW+r?bO7Smv{N@ z(rcBU;Ow^BADDBDl8RPhdEm8a$`D$Hsw-kGg+XRD+PWo)?ab`;()%DK8#ZB(lx09# zk))y$M@=ckA*3OVgN&VyyK(HLdq~5*43DY1k==gmA6yy`&D7W^ol%vQoJdqP1T-Zm zX+z42K}~uYBW#kO^i1B=Er>*=2YF?ajkVr?N!Dhf-qe^g-@x!is}OS>#nq>wG6Jm1 z#85;)od$(B?+kT<#KfW_QLv%&ssTEHMiU}bZHkR5!o6yO!3tq!Rvn3)!&(Ijw)7nk zXdq1jAxTUPQP$fB8-8xfAuDM*b_!u~s$NN|j<1L~4zSjEG@?m4uQd-!#6m>syn@uG z3VPN^1REu1Nv3xoh$=ZKloAV(7+;%}BSV-xY|3LM`=tUbilQS}-AOqcM#~usOG6EL zNP^BFC{hBJNh8yqq>-%71lTYsf|%N=Q3*B69}%hQponTswCXkY4?|g<_D0ttWiSgA zNQ9&!U88xda(cj@J_k#AIdjMmGU2t~#B%+m3kvsOc!1@H>YS!}GybQu39 zGp$rB`k3#S6dv%rYBdKxm!&L9S{iC*4b7C9 z)tR(j9voDs0S;N#vQRS0aZTW-n02lS8R2l%R9&eaq@CN$rGxltu-z zj^?KmFQ|m0#pq!AXDtnh^{T4j)rM*(5%CIB|F8xpsmZYKbp#a}RXm7@*@@{|B~@n# z0I5JnF)D&a*yKJkIY<$1g_MveD#0a60I`_hw32peLzBso4#q)Zc%lTNL_%3c5K0jU z1ScAeM}|uG6WE{y1*_x-C@F%F5KC{W^#EIDP5?ub?K4dSk(2CwYyhC4l>*qb2~K1w zmQbGdlZc3v6{8kCiQJdNk>(d zj3bCBixllig;k7H6Ep%@$yqW;695M!F$f8oAP{1;=Ftd^CKCqr3WW|Log$G26;(;8 zkX`biv20;W(K6FrBEUBEC|TJRAhoR2+oljL?T%RsBQg8paI--ZO+;jfF|#)$DhmoI zdo~2!=2%;ku48hl4oIbOu>pA?iKQoHnvb8b&uvqrOW zZR6Y$e#O2e*E+|jEaJ&# z(-R{+YjK@rqB8qO%?YQ}IoqbEPH6T@<&+k~hgwLkrAUA&P5CM?nc`xh?bCEX1*+-E z5yap--DoW^9^PD9}wxzal9AS6iQ7)p)^8cpv>Fd|vS4ML)% zB;F)EZ4xn|RMmAPb&`9B3>&cI#c7V;oF))yDnXKD!D9kOq5!r*ZA3ImW-JY=PT;@; zgjC4J*D6G`1Hsf1RdOnuXoRt$B`IwFd?d1B!2lA_0_uQ~s1*Wq%z9GD{m*~`12F)n zk{D$A!~omSSj*-Wuy!maBvlnkrolvjc7O^ZL1?hB4%p1+A zSBC`YY!a<~iA#nw8Pu7MPi;&nVNK2LGL<JK`jK>w;Y`( zOrfU0;R0pOF%dMUq+AFE^#lwXkaA|iC{WUrzt=V@l=>|p3vJ9{{CN?2?v?5AJY&_) zF@!Y_3MpP0f9$6$NGpWT0>>Gsp(;7v$cjrs)3VJFc>&catLZVD0FXxv5jnkn6i`0xfw;z zVy(FfVrYcT7M9)!VVaFdRE<>Pe6>DvKk)n3BQca}robjF6 zo$8jT;-{tHs+HoDO?a`PQkRsxjyMmSxJ*(i zo}*|+%(WJ07Qa4qwqjD5@-S(b6!3Oh3~{$2>uUxC}-#i%a~^ zyWw(0=4KUBj*Fc8P65We6hI{?%8InkRC|#-^7HdXHggP+lBiQv^;!30a>Hthn3^O? z8q+wYXuPd1jY)^c*gvFU=eu3%@38+U{gB2-O#`CwPHmcR1iWePG8(bLO*yP|Y7iV8 zIR-{e$}W+Ns>~)>R!rgQ`Jj<0OlSq=)Iv5N@K?306l)$DCZR!vXaOyx_EF%Os z&rM3Iqi8UlB*|!E;w(1Xfvsjx;PNN9Efs_|2T3{!Na0Cp`;7Pf6sjz!I@1Nmq>9tY z+-#NRjv3~gxr!pCz?kVe|6Qt*`$r05xitFbb?W!QPsdnUY$L|4Iqt=nI4ayZx=c9Eb0bm{ zQ%WL97j+n(`l2@r@fQCTCAP)?H5H*V4kWok@LXJd1 zfalR){C3uz?07L|}?UjiPacoB$K4dM3Ml zJ}{z=nxgS;72aSGRU)^~EqX`_BM#-7#u?RUO zXc7Waf<2-<*fKve)4MLsFv(_iBPNguk+4BYxeL}10BT@tN%o>uqD&P@VdFWW7!41A z5|dL>p`MkEa+Q)NB=1y_5=P=k?BLHdG=8z>)l0W({Nlp37p_@y)A(lN{DOif7o79V zjvO<4&ZS+Os6ozxzgZJvHfI&itgmDOF4b1fPvOabq}!*^k4k0qh`OT%lC5TO=9#BF zsUFkDA50`O&56mJAvOEn;}f00+asGjUCE3QU7f@PbR&P~L}!|DXzO{-L>lzz8BAvO zX^J|%XEN}!+ffH5<|v?&5=-V??<_xe+$T;;58haL+sg>r7JPJulN=(n?^*D4n6ZUWjP}Co(;T%=OJFks-S$n=T=Bi%v z`)JBM2WL{IgH-hqojp;qZ)sLv$p{d4gep=Z$*MO=x=PWEX9<`)aHHjp1!y+Onr8uTI>exx_;SwUUA6b*dCuU0yjXq>Vt7Mw9OVDd3<4wt0Li z;+0*tdCDNCIxwp$m>d`k$M7~GHw%rCG8$D?u!AE?#7-3q&u~#lvrbxo3M(;jqTV#L zU_DOi8D2361}4@ld?~~pNJ<0X8G*DBB%uxj7FbOea8Ol5(1M6a1|?GRKq7LY5}i#< znmmqDFpZYLP&J;ABn3cBBal2vrl1je5CKjJAa7z=1?=%jqm`N!1SIB>$br_Z1Rd2z z_GstSld2*yu_~BYP0_>jC`^A;0Cp-vrd_C&d~ARlC7VF0RD>gJr9(tOVm;1GjNG@! z1h$qDXBjMcMHW9H9YI8nRhi(3oTKcrNnHu0lgq#^mvlM+PP6ceQ&mtTgMT4O9U(zS zK$$qj4!&_NaJ%x03tC_B^0Zl9xWxrGE7vSJEI2gm8|MQ%=a`v2J72~>n*1^`^Q5@@ zB=34YTg_JQNDg7DaX#yJ4_`#>P{}y+p)s7jSPWrBGc)lWC0Cg;I_S*RRttyviyphx z*>_InyE-bJ{d3;WgDJ(FA0ex5NlBtAf2^FOIY&JCLYgP|m5fsp-04f7`WG!M*;!9c z?ukMPy>rRt2_^QKV@(+E#62P)Z|dg^{d6G{|GTE>Pl4eXPF^AISzrTqsHswJEbt_| zoojtpoP;VFoMuTa9eg)y4j_*_=s_`|+zpz29c8lj1jS4zpha9H7flQIb=DZ9(>wDF zPo14W-6l4ktgeluVsTCRDSSg?R|}zb_8u*2^YM0LW%`O-1j!4u&b-jtKt2^V4yqMY z-)W12C+!?6ArPipNJgPGX+0J=@9B_4Eh#0_;*vB<98(%4CK>nA_cCr}*ron4_IKFt z;&7+?E#f0frl1>~l9>~tphz%wYVHqlWO^5rr$i`&Ng#wqB{|L`jG^Whq7WPcu}) zAx1QbDcOic)#S1ofzL{3q6`ma)uaHxV6{7INP{y)XePT5fP|96hJl2Rows4S*&a(y z9)%)7m>LDCMj{UlNo@n9q{$HgR&4}u6rnaHBodTa;3C@dW_j*cmtpnFFHdN-_RYC# zTWVJ9Tj#y=o}DknU3To5$ym*xtO=5N>ovXnbZP1NQtlKKXG5=by!?!ZY=GebB&x-1 zmg4^0I?rpqlldrbD2F7m$Hk!z<9H{m`3&PHvN`cEtcW-rK zb2fE-ccHSWOs^ePY-d;giIlj+0#ee)`d%sLUnbliV~a;W4kc?Rsz;ta^2w#4T4xd{ z+4Lu&A~JE9WP>rOc1?w(&RpU z5;d|kRLQ}H1`5cLdPT1g$6i%g02QJ}Ae7U^1;BzqDUpKI+Za9T=Tt-@=g?Ryoe*iB zkZXhN27r?lg<&03&LI+@Xuuz2rf8M9v2PCKYnJ@=6OM90ACA9y1Wx zs>$3c95BL2cp5}TP(mJVoJ1Xys6-`~vhrADAyMN(bAk|(BNqWcNNwao5|!M22NC$J znIj+y>=I#Q_=F}8`mpI+7B1#3Ma15sQDRRD&_LvgZAb$-a>NaUU6}yQa712s%%}-P zZ_=g)AWa&#i?tSu3flbLx&u* zlk#mk=?L%3=aOx(ZS)u?l+O_0!XbO)SdyedQ?zzgvyW)3hNL+0}-SJZfSwrvQ zyEEdK-(~i?_MhdCNlA%NTD>&GtP`m=o27YHT`p`Y-WCgwf+$PYoi6z_9bYP*cZGAu znJw!S3h0v~WWc%dtBDUh(!qBfgW(7NoKm!cVPsiKn%N5T@jQL>sXt?#`!k&kX;~-y ztka&IV0BQc2a(470g#p%(+7u8&5xfX=Y|tS>sh~FSMMxMFHvCbp?T&cpGgyE%WQ&2 z^0fn{>-Qi4ngml1Fywkxc^{NyIkW35Br@kZW8vEoxWuD*F0!d(<+3V-45UK>c>+-$ zam-wkY{yJCs@BvqE9Gk15hgg9qZyn0J>mIA-6_Hd6J}7^13Fz9h*XZl-29!TGM(FU zDLZv3$E*WtmAQenl&Bz!QX6F}cQi>#k~R|0Qj9WmH15V>7l%h39??C-?m_wo3_BUe z6s;dbDQjRt;YEcAE|&-mcx^~MD5*x~0C=FWxLqZa&Q+bI*9vBnDzq>MWpW0q=m?F_ zhMCP`gN$-4qz!|iQQ$xgfi?AD1r~}CG(f;uDjHSs@JdOPp{T_LJqZu2y202~1*7&JQeBrthxLL_AYD<>d&Pi(3pwq~rC$!TCQ z@#q8^93@c?X6r*M!sQN76%}qE5tJ0HIw*A19>RoHF)FMNNArAK+85(uULqQLt|ShI zgp;ZVtQguEQ<@lL%w%TDJ?i$0`A*|ug-l;Up7mqRMJZ3P_kaz&G7=WZ1Wm{a;z7|E zQ(KS(17m3#+=@|XBxZJj!kJsI!|K8DrBN78HW>jq}CzvSXX~=e#Sp z)f{A=v2~t;l1KU#<}s(%&bbv6onFbF_0TsIzUzz$RT886*BV{c%$YJpu&5g8-02f) z1(@=FFUi-WfRMw|+6H3AAzRHHMwFss2^m0B;SY10W8Uf0R{YSAPwu*SvdI}7d0)zO z$s(URa|QG2TE0t|CLzvH_k7utC}wdBg2Ic|*%cMPHA9%|kI-}$^V^Mb1D<^2h2i6Ko9=o^G%KG#=UsC3Lg?U;&O!Ub8#1{Z znvooiF5K#>F8@A-b5cVCNsQP*`{h;^g@ zYnp_@%N8om+d4^znN?Mtv-a6!4p^h4RwbpBG)0Ng#X({x!(RHGA9m6|rs0lux7^*w zZcpPNk}`=0xe2DUv*&doxs`}P!Gx8RB9IuyAC`h7*y3rX@PwhnDyDqHN)7A@s8&w>V;ojgvBW@&Rnx}?b3yX^P%`%?+j;lp4e#-rsCQVSW7!4Zm)G79G2E* z+q3eQN~`3I?RQ<90)xc)FYeJ~& z7u9rn!qyHFP@ItKIh*AhzXV+`i+e3)qW;|PB&osewzKe zvSa4CbVVEO#w&6&juADfI77@YW%luEf3=Xci<6lDxfB#~L-5ldOW>!Bxjd62u!Qnc zJLW)5ZzwRIz4KGOZq`^*t6&0WgHs1yQV4r69fzn19{0+6%*kgPhwFy%yL z5--}6mf|E5C5cFqw3Zk(4m$R6=+oHwVTqr3ULMbIEi;~j>r)U5nNdiQ`<*1C5Ae1;uZn08QQDU!}fT#r6Oj|f1 zD@q_ieZIriSfm7IGg3s3h~QLPLp&24)Eb^@H84e@Ksvx?9cQl>1f&p7oq~vc$^lNb zIjkxsa$&nyB@m#Rm_*e4pNXTG3nI0l$`D2E&4N*97$8Ii0Fyv$zkmRR862|vl3_)Q zrG!|?DNzH0GCQymGrYi47K(RZI9N990nZd!qs@$VaH7ts1KE%!Q(+yUB%0vZhoxJc z(B}1GeeTv5es%8Kb8gqZUAoXXADnkpG{fb@H;?=)w8>(>CmU|z3D5kH&VQKsmPqeLp(jdEwIMaJ9@%*8IKe&vKwSC%qrATdQn`3s*b&c1d|3qQt*%gJO& z_P8s0MoF$M#k2L4&r@a>K~Epe%m?QpfQm7JVkQJB0A}Z$bKW_ZyIpm*UMMSMU~1hi zk0(3hc|X#Oq$IPg@wCmXr0%* zLA5GktC?$~H8dp!l1V_BTr(gA*e(Hg2H5S?3hFSo2$|whX-v!pKDKyS&nsuD#Z8v#_+0|N=OiR~8xx~hw0q#V&aZ8{MpD5)f{g>=#E!)OF8 z@{*V+Dz+j}alnviS{W)&YJ4eWB2E~|C}L^@6$C=$OqJYvSqlvyXpcn1>5ks6B3 z))TA*heV_bCM8F~TOC3PBneO`E80Y5dyo(!Q~*g3rUtMspip#)7+|7CK_+OD`N<$4 zi6-lOLf$aMrEwf&7hk3GSV;sUkrD;Antd*JXqh>Z0Ah01&Bx#bQs#nJj|>nTQyz*y za8Q5*8mt>k)fFT(se%xawKWk#HR&kmoZqh9&_|P~X zm>oOMjvWWfdNcT4Q_ZUOkZoucD$ErlOu9{z;hTP$xIXYW888d0#wDKo5^tNqi;aIMlM3H74cUcjlS7-r%D} zR~+8l(bor+QW|3%#}wljV@xr|m_&t`ool>z!MhL|@7c36FthTIsceF}-R9r^Y!6v| zR`T?3)1l_^+!SzVvGLZOA<#7Q!4(wFLzxU$B3N;dW?#)EVw*QKlh}lvd=MiFRZAei z90{19=@J>t)BxrXml)zAd4j^7pTh8Vh}r02dLLZlVtU25osi) zMat;(nH%VAYfKuG%Cg=N-$MN2w_kt)I$k~LW#-cOv0wuYa$j!YY2YI%Ud0> z=~)sO)Fglr2y9U{6FE>qA|l2@p_Jz=IqN|dihxZGZK!lf2?*rXW*VwccH)C7q5`a9 zW?ofcq6?WMt#iS-obo#7m`O{e7l3dHXb(+b z0T<{v*)2?!$)e3sWqrm#@U$amHg{5Um|?b)>oOZ8GwhW9xbZKa zojL3&r`I`ROcudgGs$F$GZnnZRp_w`$_3+E9e*a%o_Rsd%uvEX9{<#_O(3_{dosD~ zV_#LC&vbfKOQL)Yf#xR7w#Fxt)_PVGSc1vMJomOK9C-R?Wux<^yEc0hO zqq;ot)&&;OCpmq6e>uc+%XfAbq7swDF%HAn5B<;&`@WAuKXlzN4k<revCT80ft`7Ucbn^V%t)yvP>wMX2k?E*Mpd10t7SKGZ$hs16 zI&Ck@yi?7yQ8#*SDY2ZxisV{oh;!cwlc_|(@KuONl!cU4kl8_?SwJlnod!TTypZab zXA?n;@IZO77b6A$1 z#0JC=DWZ~BQZ_9V#H4Ifr#Oe>1ZYCCjEF&A5sN(}s4zKuf>z~KWxxp>=R&`vELa;A zj?^(x!dQgR?OIulFr1STYXSqPQOatBR;;G{z0sySkt)%`l}t*>b50^uDJmH7q)Koo zbQsoTA|6mmazefFVL*~V$-f)`LoyIG#td6$YEzx5GSu3*DKkFNb$4V(tGNc23A))2&4JGvJj}l5h`J&@) zT%A(-TmrWS++!qrcH64n#O$8r`%%4P{%7XN+V=T`52k7;=V{LDfX{s7ldWPj-N5HQ zbqu!99Cw&ru4%EBiUCB&82fST`@ZjnuIszqw%hNwyT{$`VYhqSJwELBk5E~xH>YQp z>(%LMwP}|p!8f7x!8^y!dv2PhY1+^^mD>%MOwYeRbIM$OmCFMae z^=&%KgUbdvj=^kDZTce*hX5dD=;;r4*i&q-bPfwk_xCT$AI^pUvZ7 zA+w3g3=$>7&lSp<;FiNl8@DK;mq@vUjK_!A2nnZ=+ga#o;NCF0d5h6wuseBRkc3@FaB32^mg%k)-2U5|2 z5C9|yOVMDb#_T=i+cN?n4TPv9f(TIuFAB9poIEjX{)1v9_NwqIVhz_|u`z`?q)P+` z<&r;%Aes$U`==&iuZT8bQN-qmIaP@yuGY-qDn_G-(2WzHG*TeHJm=Nt?dG*V zdEu5X!s^5?R<2!#W@*$a$KE+lOr~9BG&io@jurcwlU<%P>P{hc1(l}xvWFJS-ji$G zGtowU#;i^i&XQYb?; zxBjy*I}5WmJ5H)6EXS^TE{&4ogmS618m~q52Ty)%R@1XSIOP}`xe8Si(SHuSI6ATa zsyCO1S)q=3yjE%mbHNh;NJ-)_?z(Qj-|u$2`-l6-`}^(V!^8dU!`=1v_PV>he!RcA zyS~{yK7@sP{ngK3{Nxv#vy1h~c?fN2L%Uc8cHYtE?EK{9VzpYWmdn+08N5mClwRvk zU-i>Q>XIB4sH(;aa}Bt|kecUlo|c@LOiKP31Dmy1&+Z;dZ(5G=j&;;0>F?Qd$?64J z;-Nf+QnoiIHpR?Y`GTe^(}|;1t;a0mpO!ko>ZsFMGg)zw3Kf4U|2yZD;nazPiX=%Q zF(nC-QoBegj^mhyUe@Ph_bLourQLnMyB@di<>6}F-;QI)lHq(oqB4#gHhV&HE590H zNF4!!0UB+@gKDw?y*UFS5Rym&9FdAfl4xx>5GHO^qaqT8BF>!3MKcftqa#=`I8Pfz zUsjHa4qU1_1Xc1vL>L_+Ktcj_46hGtyBecp0bhae-AU8DM>p7sE^W}{JJO+l|jXr zrO-155OO?>!*nOtg{CyI+KCyyR?A%z<~>IvDkr%e``hAql|XbZ59A%>IGOX;--o`)VoSXzmoZxjRrrmff!rdM5E{&gpC_ zkOP@MzscRtnd3$67Nx*8$C{>HK}FSonOR`~bxKK65J@4V)Gp(4<;O7&y`Ee&`+K#{ETAS3 zM2(YW`@B&}B0YhCq4bgvtf2@*=u2(1Q6)z%I?{cLB>|%Lpons<3*&SX@9E&ZrJVYLN>uln4US zB$0>-jx-55!jdSe4LHfsAyEi!apq56wCkU^%?r1F;TEU9U5CZm7r*Pg&(ayCf430$ zNu~tKM zx+Lm5d8%I?|1gTBnLWikez@4~D!6#awzd->6#0YF0*>+_B0Li;<^~ZUijFbH7)6Ab zymO5U&gHr!E0Rdx_q*Nh_V)Jb!`t`oeti4mcOSm}-S~JbeHymIaC6=5ZzX9zbltvF z5ps-CbP2N=TALYVbCo(Kts@tBex9nk*a;1aw zrV`3G+EPdBDkWw{2q~#mh=a5#C5c0dn_)eKelI64<9^rd@8a%i*xrl}AI66(?Y0v4 zKxA@u8X`i(qzd!|g#?8v2F)sVqix;@VGye-E$qfXJR8SWBY}aK$09+ps0v6d&CRE8 z)qDnxsv-~*5F-F&tX?+cRY62d(m|29Xk?N=ooJ|=DM1*cX6fQ&)2l3BPci_i@LrXm z=FBa4FO@b?N~E;NOkx5MOV7k;ArUj6Q4))aVyyG6g*8hq=^WxlE)yl3u_s$yCmiC|H zbg(opXldrjyK8a~htc$5gj$btNQs>TmBnipAqmtN-GsMkMpH5?KT%PUL89DZIzzQ` z+n%K)Q^q{&5wY0WL|OE}E#$6oOfEB5vIfj_QT6%@nsJy- z=PYB6d*jeGQo+S012>uF>HSC8M7e1P5B4YxE&3#?MV8A9E0^5wckh1u;k(~||IL5-@Q?p6eE2{qNrZE4<7lt(q2G7i(C-IL;vCyEY+E=P*PF8! zFTY-$UAPc_NdNG|-~IL9e|#Ui?#n;seQssFZ5F2jE0P$%&hkB%~M@ixf9;97BJZ_OGSe5BuA={h02rcaPtv-K`8e&iy+e zs3$hCo@^i;H2`bwcF9t91X5yxCx{{$DTy^G0mP~vVm01e282xvGzJnt$TPak!)Ern zj#W~u6n9E1spXlfrki5p1vMi@B4r?hwK%grDm9>B!iuGw7CkwS+@YJ>c%dNp%KidC zWb9%Gkcy;?gU2MfZwp{hOX>iS8evLQ2SaWg5+R5NC54WHk(7i+hGTV5Au1&gRmI3) zz$uL-C2)#?5E+eHoJ!tkk4eRAYr2@Afv`{})&wLdvkzFEG^IoGgr{_g2)(<5Zw z4v@9=Cj(XcWaeo00RTKX-Et07(2_2 zC6{ji6%`XY`0j$o7f_&3XAg=S0!<=A*YCSwzv~_z?;anw3iVE#rd=)9tL4f!EfI@I z-*xv7cUK=jynXwJ?|%39KmLFIWB=}I(Y8r+?EAg!BK&^9_F)@Eop(NXQg9PaUS6)x z&WL}gW|MBtt)fd0~^@~@pSL>7Ia@{T#&WEOLmy34M zF50&Bp(%W6M}TL7N%}hHyvzNAG$9xhEKyY24mzjj_ngQkwoK4;en#^yzv%&0TOiLJ ztr&x2G6@x3|HAWw)I-k_OT8>S`~%sH!#3nGOEe&v^&=HwMlKVPiApw(Gep18L4 z?aKScdGB0sj-B(4y|ri0k-d4F;1ds89pIB)R69;eW9gBv&St#=lT&>m$CR`F`|=HS z4d)c5*vn~cXTZ8{^x|u>+nAY^2~*A+ZQd4@3F-xvJCb0S2N_x|P4TO?5$k;2Oo1jq ztKTTuU&-)tTX0Eo4}rPL=$Q!NJo#xYT;SQwnw*byM%PYUl&)SXl;>&?4+_`@>D1#? zu%TS~#9pE46NmQr5C%N5)U!KyP-#DY+hmI=Kit}Yl zth(+glODKOxEhlyL6UY|zuRr^A9mN*Hy=OzczyM@>+TnAd$M_ParyG}>>{)+DXGeS zx4XH%`grx>hj0Gw`@j8Ob>R%ttapxVMvFIaCRxJ|M+g@>I96a#p=O9dd z@&peX`tysmr%2}(rB=GDjMCvzr5>$BsL+E2r={Iq3bYECOHt%;SozZ~myAfwhv^Zm zQ0G#el`So5$S$%qEEnY%*2bw4l1hqW6H-cx7#AsS(%6qD`_R9P`-gOSGd|u84#Vjm3&qWQ4LLi&>-G3FInOU&ut^*{h+pk_cdRN}|N2 z3pD53mS+)EWkgOMRN<(IE3zePlnRs)nY=%Wt%W33Mr*HaER6P(G9sKnJob@zelCdT1EY1-yl ztFYMUIU=sP@rvpPXD-_UU7&zRWt2h8l2r2I(W8!#9dajVjdV)t;F02bQm=#{gGpVE4hFUQ$Wh? zw!=7fU3Y)~`0m{gKmPFD`yal0|HE%T{^1*fd;Qa&z4_{=FJ6AOJ~=mDY}a*ncQ+s2 z{`lSB{q@5i-lizA-)oAC)pEI9l8O&5gcI=TV!34B>~C+A#>+3?T)z2yxmw-dJ$(H5 zF3ID1aWQt|!`+9w>)ZXl^BVh6yWc(By!!)%m2a0#(}ZQa+N@8`FE(dqm#^QPUc7F? zA~e1Ut@D8$g|H0GV$p`ST{dmwoj1{~;2b%2&U^3Kx!}DIj>}~3r{X#FhqIBKG-9U> zaP<4(8;;lc0Ym(=P09J7$g)i zg-M=Zr(zM0m4p~FDNVpYV+vL3M>UyV8X$zGM9{5(iI@;TFm9U^G=)JncS0~Q7z9Bi z3Z{gmIucuYSVYsvWqrXMFO?uV04ciC?T-SUTTu@ZJS> zo*bKUWM)^@m}Oot!4vZjU?#3R?<6_gL`7vu3)6PyAgiyN@ZMq|r`qpRLrBLbl<7ih zoyfI$rtHF^Lpx!ov-B=wYO~|#eOfw3ri8Hi)0rQdTqkDUpdtb~zqI1;Ce_1ZlQXAt z=VE*5#GQj_^}m@n#S^{6rjTS;PFBq_7_0)(C8q}!7&RZ)GKhonuM$zke(7jMJckND z_q^tJ=Ahg38F!}{raSh98O*bIyclfG#rfm&LLnB_w@DS0u8(NC#5{Kohi^CzKxeh> z1CfpT_arIC-F|<4_3`^}fB#?p`rm#3w}0JVf52Yg!uR+0H{X4Ca`|HY^38I+5s9jL ze{=QzoA2-6-w9lwx)=wJBD-!JM+aS9ygq;ZWqYz|*XzbNyW6YX?(WN9{PNHL)ql5K zoNRa7-~Q%5{rmst|McU-H%f!Pa`m^YiV_38QQ?DF*Fe7RhQ&@>@9@4XK$_z*(dv>^oRGY*XpjklRRvlIuD za)svcN@X9Sz5$2u?}0R)xh5?)yV{MsB&pIkp5gZ8Gnq5J^8cCnPls$inZHPnP_2bXcZ;K1-;I2GqaMI@vq zr6HwdT&&0C5XZBz+otoEvi)-0-o=M^-NV(mdn;W}0w(KM)pD(zvqK6ZM#m?J3JJjz znGaJH4_Iy=0X3-!q5vpMQi2kT=6Mp(NaToGsOj9OkX7&#Af&7rA!4%eKhv&d)4gD2 z2NhMJ$c_!vuwe}Z^&lltC#0rOtPT)0pGN}IOa>7g7=X`UCaI}3D>2|zD_xlwfkc&r zSPV-fqj(W=so2&E4WOQotYMdt6r{9L%@Y=xJP}9g9f8#=f|BWK5>Z3ygnA<4c0udY z_T?c*87d+>+n zQo1Mi>>0~FBZy{(;`C2shm(=@sShfDr5;)OxtMb~I2AB=f}o2Lnp0zH!_ssg4B)rY zIO&9L%&E+^xoCD4H2YtUac63HhwI@WEIByfJei)|euX{@0?+8ImFP-;MVjnf7o|qWUDwU!d zBX<2=f4hG?ISCG7wFs+KlK9*E+mp@7`Db5m&Mr>QFE?kG?1S^ZX%ESHORv0AN8 z)~nTGy;`J&NZU4zXU=fogmdMQgayqx%2LaF3`d^fw$&C?m6!U-2}>hXvf)AR_@UUl z`Oj3|AUNFDhxW?$Nj>1xJ+7sfViF0dAgC%4Ndev%T6zSCF$M3Lo@8B3Py(6Qn$>CqS5(LhC4c`sB-5XOf? z6#+0znmlD`5mO;8Hp!}-Y9(O@VI=}ZuhN^0G=r293T#D4!q)q2!YKk`A^|0)L`e28 zkP{VL@6blnDZiL=m~dne8PTKbin&(m_E9j#LRfNC78G zPzMKIw0`rdJ^d=2Uii&xzdUn`jc-~XTIXAK-ub}JGZUCB*`QCLg;gSBa+G@Tr)Qf( z4h+=PN>3=ArnxXubFZRyqmvNT?7Jq9QVgM%Rjl*L^2l>RP>KX|#N3td)yyA1$e0dO zo>`(fGrv@uZ)&NvXbsSlgH)VcOBY<(_Sq##E=gy~bWW6yFxLWOXPZ(O9&>D>ItkTM z89g|K`iv@|KYatMai&TXFvr=ZE}KKc`HU-_Xo))6wV64aLY+yQ;$SHqqQHmo1L`ySvd*66v7&xZf>Z z@C#CVguRn#Jkiv2$s>Pr3xzeVW z;i$6WDR)(tahF<}%_c3}*>*7Ku5JmMmhPN&Sj<4-J{k1TtDJ8Wy>3<;YB#=FxDcER-Ua799Fuc}*F5V8(PMm33)8Id zZE~DA-$&1M>mDxBX`eu+kJD6n&Cb<)gm7g$PhT=aIIZ52t#k=op&&=4cc7BvkY|&c zu}me~wU!2|5Ml*mpS1p?VrQ!aMmY0`Kr=rd(@X((}sGU#`~W~3^V)?vohB#g{@WOYQpNrF>{$E)_*bw z$s(0w8OwaaTq3l2MMCMo_UeR>P`T4q`ogrr%OyUGFw@iLKPTnVWFN~^-Gdb>fU2e_ zV~o3f_xNzXy}KDjLqp5uX5SCves}Z!eRHyRt{Ia=a8fAii#Hcv{`{BA_4yFv&D-yG z*Eelg$zngo{m}LIch^b$IK*bNQKD`bcl+&k-+r@PE-z2dQ@_8y`mhM6%U7G&#|ziI zc=PqmyFaX(OGja~+PDyeL!@Ts_WP~}28f6v3PT-@vRJf!v5NaR?svg27w2oJG7!h^ z@&3CI+DJh~y<?YJCn87TDz&g+q12_g2T;} z!x%0tEP9Ma%{NgAy656|lZRI-u9LD1U(p?(?=s*(8bGUuJnV%(Jed;0PNw2$wbcEc zvXP{c3lIUW!0;&#wIeMvwY2(gn$nd?IEMgByUDbN!9?mDJ9a*VkWy@Yh$)U~F~sE< z*Qcp}nNHs{=a237YP^3x-oA~y?^FLMHug3f0#O}7jwz^`J4&oH0^$-Ru(F~TQldaa z(3Bgy+2@hQd81h)X376mMPq4gRLhkKP;#V>C^rodxxz zs~DuAiLAqkor(}CLqSg9Nx{s3D2a$b0g8+WI3O?>8jaY^n$#xjQY^eK6&;y`0Og?Y z1)N}L8EXguB|!sqq!A=y9V~9)*XPaoXN!x^+taW8<~%G;e7kW?>q1}`JbU)eI}hU8 zMmbX^nl1LC&dCke?6!1A7ofSe zh2%vw#iLX1ci;~d!kK4WK*QOVI^OrQG)gh$x%TaR2z$wmJpC;9&Ea^ z#gI_m@R%ycInW^+*ihcX^Mf2@0y!+H@ZaPek339ishp<=GXqrP0iKq^Df2ebx{fHHTdC@<`=q~-2^jiR2ea;%%_pu`ykBL0ZYUMB%B4JP^fAu zYt>rcRkN^aMg`03$Y7iTNKyJ>+;6*wyZigQ`~Km2b>c5y{;BsT-PnKl;kVnXtNunn zJjysg))yy#`mg`nU;g@kwQN=~(&OVUgmB#~AK!j2+NW;RA;#T(^oyOQyNCNR5ivxD z-FCa%KE8T$(U0BZ?c?d``R4qU^y%jM)^q#f^_RL+B%vq`x9jDm?-gys=yVyo?lBE1 zMqy4JblD9g5Ru)``&A?3fU#E!VYO^z7`OY8#QC5}G!DD%e)ruEkKg>$@aON+ul{9{ zQT3JGe!pn5;8tx@EOpb;>-HQ`i*#mBj{jPz(KMA!<|YNGYrY71Q0>LAGnp8W)gK=E z_?d;U4V9>@^vc1+1n1;}stLK+w&b!AOfRX#hov=7L6lHAS!$icP!!fEmxZcSCds2j zEt*fsM0%*~*!(TdIp*LrNNQ4QVu-1UvRIF+HE+7my&O+J8!x{c?|(Af{h_;iKkh$J zN{m1@g;ptPQW%>~EDTZ#AR!1jFDiM8FbL#9qACue5|tF(P@bJ^x8AbeR2l=peHmTF_Z{G5wKdV0oqccBV!|LZXzxfHiMo)U(l@QO6_NAK2glA#iQ-8HbkG_^&qB%vm~e)c=GpKO2fuipYST;-x{L)c zB@$@XjM0NakOi|j8kp3figlb=&XoK02r@fDCfHS9GWgO+0B30pNE^y?;fqKSI7vdad5gUNI-Ak%9 z2WUhvj$_yLeLuu;jHcm3aNY;+vm_K?tu^LPRZX8rBtvarVm9G*RWVT^BIno#@7Q_A zAW9-BrEcHfKRn)E-`w9`-CcbgxBJtxOVDz=-A6&Yem&gW#Xhq4G!DG-zx>O;_>*7! z`HQp97pv9n{f&)5T5e9pv-5;B?8hNK5W=wU2H^DdX_Iu^cU_Fv?{0PvH~YuWm+KXi zBf|P*O-o7=KfHhFwvQx4ksNW1BS%r?5JJ;5%5ibJxxKp9ZirDFhi=yk= zh1|(U69QMRiV4bvvQ^o+MK1@M14!kkoqP2Xt#LUAAbENO7og9!f+Kd!&N=TTB}r-Y zF@$zGE?49FBzBj>$?N9)%jV%jfA{Th_jcUgA`Pz6Rl!B)F%nr1k_f2-92%J#7C}ff zJ+7?vp=1*P1c)Fo)+)lJWaIjB@khWcFs7)fjs_(M83}^yddGxFHe=C5l{rt`5QVCM ziBzM#M#cmqXG?>@AR%Lv0jj3X=u~a|pCdSvN3_uj1fLKHeOa!JA{9=x4GC802u&bX z@`|L{2(xLaF)94QZ%+LAm+kq_n$tJ!<|3@lLc8)!<9*|NS+dWosHU3i)C*Sh!?@jUAGf=^`}_TVH;%o;#NG$r zEZT(&jdyVDd}!I_<~vo1V;aY#szhSNE|QdD8leg}V(0y8wQSqQJLg>>LQ1J0hV6ED z_2KI6k3YP9`~BPRzk9sz!%0x|NSgW%aiGv(7yz7HoP7D`fBD5v|H6f~9|sNEPS!6&!<&oqei+`q{r>#y z1p3OZ_}<%QKHc5bi>5^ee$k3-JIPI??r^grD6Q=!}q&~TXudJdIzMK zH1?^#9fxil*tLyoCA7{na}uYzB&T=Vo4@-{j@^2_IXS;vq?Je#b;`c-n@uq5Nl;ay z^SU+^C44ru)`G{D?(_1l92v^Ix!2a6Dv_{~9J=V^(n+;c6W}q`a!`VR67L@Y%!eye zp?S)3-m-@aHlJ3l3`tc`D8hMU9XPo_SupDIMHSK|z~%<#ysw-HBcr+X8kw1yor9`R zDWn*irj2bJ+tp&V88(;0>FdSWm;K}QaQ|(0_hY)hM%<-jLK>Vm5F$YoUbPkUkOX2? zXKFddg;GFs3v@|QHI*I7(B6gyF?YK z+7rNN^DPHJJrOH;0f1zESFq+NxFi6RW@t4ssg?VzN?9}`Y$8H}<~p{D5GMkYG7*@Z zst7U27jKk6!Vpmfdv;5|IrHaVFE3t)lh4BDm0z7U?IMIG1QU;J*qKEknHG8;%u*m# z)hG6NR-Du4UaaZzlj>Qi&(y`9r`vLoLYwwX1)J!pCC{X$LUAg*MIol@5{z#{xuRSS z&ZvyngXp%pJT0j8R70F$k2QZSz3~MP$bK*{yy`mAk(i{Pk;#F*kZ4r7clr8L_0GP5d4lA-HwZ?8XmeE;^x z@2=l{JM8yE97V>}dUqsg6S&`aY#mb!5km1E~&u*AG2N znbEeZ^UIf~o71Lg90w5D^xnJs+ncKoj}P|`_czr_IC1C7&NoY6c=z3o4u=4)&{HMS8)pD`9`gr}3-D7{d zbnR-n^u(GZjsQr$euO$Lx}}y-w1r=6)O@ z&Alc?G^SQM%OaW9NBNyHjAg%-T;WKBVA?t7y^HFMpdZigE!Bq^vnhlkD>jK|UfT z^3FMt#>MDEo8rQ^>t?ly>vMnlqB(oDytwM`-tX?ejdvfl>mUP>butgCs_LO6P;>oR z@Wg6o6>YPWUxl(5Co7T-Q2>Du69ys=xFqDrK>&)S_DCwEDr12lGe|0;DrOp0gU`zW zN}52b5QZmm1gLsq29lB_N(@$r1A|%AD})hiw$3@DjSAANL}o~tNGh~uCDG`32^F>O zWL1za37t<8MH07*=H#>G#ZTP%=i%fh?fN_{SIzRohv2>U&M;>OuH@qK@KmSOak#>c zXjHbU>sp-HhST!V(lk-B(z=>F{W;}eZ0RN_YdClYIVw? zNwL4bxfvgCn|84|e{=r&;>DZKPtM;o&5GFdeZSj2-ap)G8i$Ae;oXPxcC}xH+w0pH z-EwszalHF@mHOlzBSmo2kID}>x7VBX+1WS@kM|GThkHnh_jjtg->Yo5GVGUUFV0?E zv~AP)&@@eZvJCglzSr&D`}N8BvOP_GWOl2?a_q<5cGm{q@49g}q+u{UOq1`uyM0Sc zP2<(k(2t&+&A3hD$UdkfjZtEhVZ3{MAg0Fo1(HZiBEvSVb+cG(*tG~6wb`d3IKSAu zQnZ?sh#lCb!4w$9;@yMlNPXxBARFndF(R+Tx{`7%{#;S)pr5#W%dF&a@R1^$g$b*v z+ovw}LmN5Sgi_4KOl_#911dTFD*LvejFTNAE?6UH<*ZpCl6f%zs*-&@wL&#H2w5tI zu20Na-C0be%w!6eF@_LgY}(i^{Bkp_&*RC^2!lzLx=fg%>ZS#{-%Xk(QTRMs8dFM97Wgb zn_}zXsxnG~Mu=357@=$6WHR+owM@KtyD)G!~t);=HwkJ&(?C}P{4AG^UYuBwi z4^V1eo9)od1?qv7sx|z{Ld@H3k8<%@Vmdv5KkgA}mct$|q~}yH4lF`3qeOG%(CH0N zqKKpW9b+2DF^;JpV&4zr*pG1>`hK_F?RVSzhnu_GkK4!FxbI>bdUcb$r)1Wl4s!uZg;x9`6FD9ps|u=_o`6nP|03hjqD?jBR$BdYTO%!-(X zk>a>opWmNcy>DoFvIytr&B@B5fWp%oDw$krMf zQ+Wls)K#J6>^rAQj(P6mVlX{#rfM*4`AlAgvrHrBw}-Z4h8@-8)Q^^ocD^sP@JXbI zQdVnJVI&-0L;2UFYi%3Hs$Q6k1FM2)-h+;r!6@N~=Cc4`Bnbj5IM=6{=+LGer0!~r zY34>G_#iPfp^5EcF|1Z`bGkUa7a6hF-%)@RDcjvMzJ<-s3O7&AXd90O4gvO5pW1D zY%Uisf3~>%sXuw$u8rZm49&v%#(B@qJLjepXJ%8gaXX6Xp7p!)KTSwuB@9f9ODhOk zeOIx<`LkLFbE8g;wyjXOgG`6H)C{#Pk~bCYtqtO2OmYIRM=R^Y7ja9D|uciqt={|FtL}ZR9t7WCzxH$(N3a+%b!Tr z)fJXAoEMt&2j@U}z9^a2zvUy!~64`tEN)i=jRT@I-TJBM?{7p zc3rpI?{>TH{$YFnaMSI#!_W_1-*0z!w;$hr|GVoy{C3>!WK3}!**S6z*h6&x@R;sD zw&R$RCL0S#3>6Oq(S*cAj#x!fw{sqw^G#@1`#5ex*xhW$u^+loWu#1-blb-V4lTQr zs~_GE|MU;)0>Vl}o49M2&DyWR;vyyi=MG9wUZN5OVI)ZcRp+nYzH{L}fBy4d_4~Wq zx8G|NP}ttRi~DVJ`Vx+y>YHY{+3fD`C5mg;)GWp{Ztre~$L`h3H(&qBpSgDBf^W~4 z*T4Th?)(0+C!(?GQc_8y?C&*^3jt{$NdZET@nM_N2pt*Zp|Anz{XnEjEXsg{Ca|M8 zL=_oRWTnPAFqZ3fwOR6F9mj!OD^1vo?sxsL@4J1sSPss6BA&R;rL{J9u;c+diZY~O zs@I?viDugeI7(-0WPB7j&Q{&@&$__eq<4sHU*_r?g%egVyppLL)Qo0{axsvqYO`1- zDETl;&F#oju78*fIAUWL;)&Dj_I<@@gTyW#dX>G7UpBGqE6tdJ^zquf$!F~G=V z?aGD5`NsP|&arcJ?0OHZc~Po3jO?-z&qd9{*XiI5wj8SnBIm^dsXbtM{poC> z>a;Z~Au*Gfw7TK>SJrTLmKxWLI3H`8V^Y0P=1if+kMqj1=ETa*qHJ)Q5bVP(R?f8q zo{Sk5MkS*xIkA$?-Q|I}70Q&PgIqj^q;?PKP=mOd7o%2Hm8RLL6^yr(FRIa+EYZOw zO`Iu9wyRjjyvF_HqtlBs_jyza{^UF7A^aarrk|=@)xep>yYJrr_``m;4eTjN?7G-*m(+N~$NqlU?=(poQ{49{jw-Tf8gNjJ!~hah zn$QL~(s*|9$}iUYF~u=L#Wl2ApHtJe?V{~3)9^i|``!N0=mvvIl8ABGzWu?4g>&2x z1r{1R2D#wI-SFYJ|8Vh>uY4P}kHh`VHAF=;38y?WmlUF!Nbv5vcMrFBtM!K9(wN4s zN8CaC{{AB%szPBgbbV;M)w=Jx;m7a3Q^@w?TTMdU_prPTPQ4b3>VeY08(o3rNh#q#XUaQXG__M83H_wsO!xFtB`(Z6=%G}%2!|`+w^eS2lTpbVp`6Lu@RBn&oW>*_HH-G-^XB5K=HjRA*_&o_ z?w9MPU5C&*7uY+v;9MEbTcV=LtR5h|$MxTepG>dHj0vn&^`(-Pp`t}&sS*}uS!e}K zZ72XwoWIiInZYKDcg3Q)+H3=4ivA2_&Iy;Pn$BL-QkKt-s$O%Z0hdVv^USvV@7Z?P z1Mf>E5Vx&7;i@?{C@K$HYn~`+G8M6~gI=S<@0&VZs|`8K_y}206U7{9QJI`04P?Cx z6{tVzVwijV@={6D_2^B9ztTKIIR5*rdiP9rI|mN_fBUJVy8^`zTSFdRF^YO`LgPM7QTa&t2D;v(8`vfYk@NQ_Jp8A8-LW*X=xSyQ{0an`;Vg=m+UWF7cQ^k&@{&C=~3x3o>XYdxq1L;@Ai&)Vf;?E2mPm5zg;9jM!FxBW22F^>H%_|WaPBFVAab)D*Xa`tAq`AvUw$Gntr zpg5%1J53>uF7BBaixxhlG!EUEL=aO_73;JjQfN$(Txu4rb4(nBJ%ijLFzc|p);Kzq zmy66{1wCF-I@{0_ zyi=t-G&8(v?ECCWo6kTjA^O2PRYA|LK9zaq{R~W~1-*eWO!LO9CYQ=C(L(U7G5BoP zQBLRzUN-SRC3|kE=D}P@W{*z0+Pp8R2uO;huBzEE$tY_LA|$o0WsRl!1A_C8o%0gB zH)_GMSuDrpYTTTK(-;2i^X0|6-OV@M^|$fVM{Vn9NLaSp^BROc9HN$Pm^u@dgpf(;#npqeo!+hjKT zu(-ln?3s!0bAd7sSvgbkN{0@0BJCDGS9WXhvIXd>RhhCp>PF+@)yiomr*(>F#&CziY>AUga;qm(R=KcHkfB5!y z|M-u8^EdzL-~Hil|MTP9cWyu@C8J&)fq-|-v z*{s$lF!>#VvnCPIm?SDIfxRQLzX&8*4JJWF5+I^U0cLJO@XixEh@`R8G%`pSmp^&^ z>wo)i{_J1=+t0rII%)rSa}62CuJ8M9=(j_+Ph*Pv9kDd0r<;qj)0gL8fBmzQ^+`W& zZ*H!JzK=t6?09@^;=YNaQwdB>yKv3QdEX6V-}hOSB*&YX2*`w#5-FUc;N7wf>*ccb zZna(!MyAxXL4`#Gz_`1S{vq{y8Al>$>c(-O#$>sTO6Ji}4k_!xC4R#2J6M`@u!eIB zEKMKBC+i>+PBpzmM}IFb7N2#Pf7@?3j?i%!;uoh%a|N2T4^<^;qFn3{sDKhQGDf3@!}PN9 z`ZDvz4sb#5b>t|dL=VeW#MneQo zpP16+40O$G%ya<<54Hx>#rE-k2lxv-oN|qo8SK3-~5Na{$KvzAHMy45N*&hTpzob z`abC}3Ojdle%UP6?ILvDet&&0N%s9?_qZeHmz&Ltm#;Rb7u+s~af{fUT&ylW`?_t< z6;6~As884r!>)gb-7fC0{Axod7k;r|x9ayh?jBl7=a(0s|NIxr&6(rC#4!#QPl>Xq z#w5z#wPCqAS!_1soo~Ey7)DL00Cl;{NH%xOR;FjLM%IXie)4br?0@%v{=fX&|Nej9 zw(GHvi}l&QyQ0{`H7|ei`By*xio73UA`H8``^W7=bK3kj|LuRzd)nXM35VTofAjvM z>>j*C-w*V-b!n8;Imd8|F-BWxeLtuwDS6+ttHtVcM=e=Tl+R8DusiQBTLA!_AVt)wJnmSP@OHJTZ(% z*~Q$6PEfWHoYa9(WTx~8=yrmtQsNBA@1#?-W_liGbY3}$!|0FaxJLg$GK5n-A& z>Aep=G`?B*#o8}6&H7bXU%JIIA?nye62q~TOw|)D7=hI>1t!mcqX70qV0Kx6g1{IE zAa+x{Bc+Q>Q7g@s-YZ5T0=(B;_O_VCMt+!o4yuZ&p@yxlqadY5vZSpT_$3fhhI-J5 zoC!55mN!G0kTemy#oE98Z1wur>x-YZCokLed9z%3-&np&?3~ql5A9v?y9eGE6(P<# z`>GY)o53Mf`KlIK%fP-0Kxg<2hSblgS@Q%*D|oDR)#N2Mb$>n+ix!8TOUpWSHx=fj zP7VUL&ZcEu-pVy}pxKGdP+-m%Mkovcut__L|U6TRGu zu^m71=^FvHQWjK2#~6okh(nAq4a3k6{cb;OcMse9>kscgeEZvf`rY6D-Tk}kKtX-0 z>ifPY$Qa|U+j-?Q4$Je?P5NdUoC}n{M0*)HfS#+Re+?&0+&y z#(n>|yBnF-FJ6-0#r?ohpmh4?^5=i~7v6=dk5|8qyQ}^6X}fv(>L=%CUyeS0+y92b z67CVv5G+-ZBqO_Fv3h-Sa_&73L;v`=U9Q*QFm4}Yj7c4PVUjT=W+ryIu14hAWgLf} z|2Kd2fBL`uk6(QD%a<=-K3v{3tA+c1G2*ZGAK!oR(_b%7E^j}6{OK?M^4*6YZm+NI z-+uqy?|%FK_orjO-#?6Z@2X%te?NU3oV%uz&%f)4#i?CQZ-$HzM z-|6G^_`|o|cfURV#jm$7zTBL?T%VmT)~lv%La@;coI#qxGkYS$TUYv%|Ic=rW;V(u zW?J2+B(l|BRb|9N=afSAo*lKC(aCPjQ?Uvx&MuOOAjWzx8=M)QoO3Su;6oEa8`?#) zSPkpbW^=YUf3vv!Wq0+5?ae>MhYvi)Eb^?HEVImJq7maw6X)VX9z(^X3Q0<=8FNvy z%mn13GI9PDM%se=AO6>0=O;#L8?AuGMS7hagr`Q79Kje+t_o%HpoZWX9;8Z6N%9;j zB1IBSyjZobzB>8p->kp-*XuXG+FX9NJiS;fH_c)l+NEzAmsM-0Sg$U-*`h4n=rmO& zYAjTn+DlS3k%{a~sjvf(4_SvK)Jx-HgiC2(YZGqm0;*`@Vp%?b`hpzdH|S8*|3pojb*YYsx|U!RzxB zyqs5!k7>FsbHjrAK%b$|)f+}7W9P|kJj;+e`u*vPM}N(?f~Q3_tCD{*-<==!({G@I zFRl4YJ}4OzX&7VQb^BfS@bGwlcYk|xb9Hn5@xzA?Z-03I?uYBEcOTyU@Wb!EdH37j zK3;w7`!4oF96FV>Iyvipi*|MTdEmu3jJvq^XNy1ki+}mWmp?l>-Gqg|zxrWuw*1q7^;ciK{)HFn zhMi#8-h6bT2wnxt<$9mS`@0*7(Ij?Qg(MQ|*^9Hw7jK%TZNk#~7BaR(jbF4Ou#C<( zi{}1wlDgjM4g&IQJ(aj(PH$w;wh8At|B z;?;3N(`~s)dVdMk@KQBG zhjwbd z?!FQZ6=U(lkdT&x6d8ajU~=%m`sstN-`OI;@tezga`g1+8K_S`awLa)^w;`&CJ$IB zm&+2Fm;r@AQ%d`Nx83db`~7~qeYn5dKHlHm-`w0@ZErqyk9U1PDEV$XZg1|lcX!<| z_K$a*RN043yE@t2e|RU|u<(l=E0EGKlH+k7cemg5!{}L8s|Lg}YTxaKBxxABZZAIa zqSZy{L?w-*4qyNLS7#?Lwm0{&8yCy7#l28L{9w`OZwo&j7q#PDb9BUiFY3ReIO~OfJOpxe&;_dfuhr8>C%io>6deOal zd3y1BbNVu@Pus=P6GxGe2+MVIa0v;e62&gI-{XFX;0?7yJj?pN?C^oofWqx^idDKD{pcYonz%l2i3WWv}W^ql`)-> zrHdtn&dFoxP)bnFeN99l$-Eva0+AV)A|mG)j@f$`gZHg(hGx-@>vcHUG^cNt=U?wW zeAC~2JKnw5H~=7WhGkoCOzq_&5L?!pjTehy9HkrsFpZFL$}WA@Ag%BKCyRU)35Sdu7dIDHXbf4zGBtLF6UW^=w+pSJDFht~PP zJ}@7{lJms3KE=Z|I%hy@USlyEBmX(Lx{|`bQV36N`SlFCn<}-I$ z|2qX1huR(U!_00zPoGnrd@Kw+sKb=&S$rZ>{Y3lhfz_D*1$AJ8KC@c>=w~a8z=u|+ zoJScLQb=I*Uu)ndIHfMyO!_pPy%^);c6WPwcYAkpe|vRv{qg4N!`=1O-G}c#e*gV& zeI@%{7h`+=DlASV>VCg{xVzckZyTnjUBtfI-aSx+?jsb?0T7KW5u!Y}w4hf8ABT?S{@b==>i}N=x z*J;@en zj~~u1-mDfYiW2?em;d6gR;$H_Km5RQqk9catNUCF6hufe&I_}tT(ei_(!lB&%mhig zzj@~u=t5+#%dfc|{ z5{NO1q*2qTLi8|D_wD2LH}bX}&M${IU#-tyjmuM37Uu>T-HX@U{&`BLRt#itD)f7u zc>f2Bd7hnG%~)pLl~eRw+#46%@>A>ds4g>mX9=<=uWSFGJ2JA~-YnlkaRxK9@&tx{ z?hKyEllA$}nU%`3T8Rp#IYEtj@NrVr3Ir;_hAWgjWfn|pCCbpG`C0}W!;$00dGA69 zA;fkW+I71+>o+f&lh^(Im%FRqb?<+l9&aJSREoA#s|aeE%vlvI4`8IiRo4v73NgI( zT&cQ({FC>-A@YKlKpy8bgg(MHynG1Ar+&lqe}X!_9elvcCLm z@%mTc@|Vro>vnb8E*2rQ-Y>`-BvbI#=knd>*UfCAM+rVEs+(h*(hZ*zRYl=JOwZf= z1kWq4g+UFX(mn(W<_fM1R5)6z)?3Zqri5|AjSsB#l=C8kFq4{b@ys*7UgmPm3zAf& zCd*}%zsQV=aELDzcJ(BYjPi0#$EQ}QLxG?C#^U|$;Q7pRW?s*+B!G6`pU^^P*v9ls zkKcpI{~ag3R4vazCOuml&u6yN(wetULZOH;rI=Do%oMzHIn&dFFL>q@^G_X;SV0n$ zS`Yzo93Qs3tDD;&zyJQnAHRA3!#CI8{(gIN)opk2?rPY@uIu9dag4fs99?@2$iCa{ z?zS>&@;uPc_1BW(X1Nj_`@YvW020L|rscZXoL?@MizX~6`K5CjhOxhup{N=CC&M(@< z;&i=%e|d6war*k(x4->;*C!Y5)jZs#5|~Vy|7VUQ$CIo<)(OCW*T) zE+at0Fzg?$$Nte1#;77LDQi?pP7@T-u~O9pvrj9by+KaP(N+pFvAAAkJucfb9IfBM^h|M0_i?ryK$b{L1Q+s9$t?faPG7-Q`B zO024q6v9lkH=lpGTCANTA&vWi8D5i51BNJR_xO0j zLB_|sf#T!i!}js9X`06<|J47zTP$|_VSE3GA?i3pO=A}uzh3e(tZ;IEc6Wa>+<%NW z_Z&U7fq7KwR0k1(B&Ia%`sjRYGuPds!~ehLrBF@3-&YNk4q}?eACT zFTec7pEce|jLXI8n=gJgMA>d{@4w&n`%$}H9Cj=s%ED-f8)Ya&6Ep=E(DfoZGJ%(= zr`UDGyT^z7uvx1^B8Q~I5MxZK7fC^N(6rYmX1$Ycfq@*gX%H9MrXBVVqtGx$a|W#^ zH)0>xp>0AF;2oWw``5p0Uj1bA;e{-Fv4R`YX2 zB0G9F@}Z1;lwTJu1J;Y)U^)M64h*eS8^Q~~#2#~>PBl(M#e?S?r7D~oj;uG+0mO`k zy?4on5TXyQZ&%~`q+4J5)6d!$Kiz-)r~c~4w7X|X#2x@J>Xci_j0q$rNCP553v#tQ zNC1cxi3pxT1DHOBmf=2*lxI>O#Ola&CyUA=(2!jz0mL8&Bsgt0uiDo?TfO?};{5C8 z{t@ptu7d=UC>OUkWiF1T`_MYQ1##Fp0QvXuBy^9PQFb$Z+BvDlcLhI~M zIUYe-C6u*X@}i(4wtuNdYLWNN`LrsC1gSK&Xg*R_b>!K_<|E|qtYe4_08KjW0;=1kgcCH~o_eb*A><%Ft&j`Rabc=t#D_bSFnQlOqb=s}Nf68)ioY z@3?J(3!(AOd#6SYoPpIfO%{(Eozg>i@}?Qh<{|MnlR4cCX5P9Fk;tf03jRaW3r#jl0q5qHRys7mKq?rZ%|E zpZxl(4~x~?|MDO1-hLOH^X(?I;p}9?ezo22lam*pf3-P#@#W9H{`wa`d->+gB5XME z+jsq!pa1f9ar5}FJzKsSP9GlLzVG4?_(Hh>c+oEV_^{tSunT7|UVnV~Qk~!JZc?{n zRSz&jiNTH>6D7n*&Lt&|U{>``G-AKsU0*K{5Y}TqA|)Eq*lX;Q^c_+(x|}FPlcwk# zIia+RszO6b+$cfQ2$3X6KvL~Ik#}wp8*$6Cm#Z&+cJjs7=b!z2bMa!aI^lN3A&~Q- zX}k~K2RPPjmDNZxrtMTsV)nt+3)Nk7u=4ZPXDx2HC=AtI$Hk6t6}y=2JX9D_ixN-W zDRukLe5Nspt9_~-mFHOYCwK20F#e+|>Q9dI^!G_vGryP(w-l3)T$d=J2UIC@i#h+3 z1Y#*>sUDJ04y>st9|CaBF*AA3A%vzKn}u&zVRbUB&)bvN{n-zXAAj55e9PTn4{ge` zGOj?mUPmI#tenXqmJnwHl^u`|ffb~1grpL!qCgx}ErX6AW%bG`FsaN$U`!M?A_^eV zrdeEmxqAJli_5PUXRn&|S<|jUSUBIXbL{vTQQ(6gE;a4RTVyefSzbGvmHYpt?7w~_ z+qd*UY^|T!CVZr?EMLdgIrm(DyZbiTY`PwjL(Zrv4xj-w)W`sm1|pz`kqF8Fg8m0V zfF6W_phr;yjYi^#oThDm``Y7O`Sh9LW4oVOOAp(`&Z@e%XX4?U%FKuz+ph1ozV)qd zK~>&G008p!_2uU3wA)%4Hpw(!yS}wxzfO4ppo!qM@mBlpgOawWmXGBX#@4plwr$lS z7HjQwb8O8zs9_>D+TV(nuAV)D4SQUY(AB^AWgF?uX(>-sc~V;sZu5*{O(DF}bJO%U zZRq*>L_#YRylxfsDtG)64S!7)^4k3Mm<dCZJipw|VTg`m5rE+ba6{59J`+EG?4t zda;5h0287D;IehJ zsxQOUdv7D+QdY2Wel$SFkD;*2V0s*X?99>N=5=JP}giIc3 z$<7prLEP;GfpxCPQX~QH`C?PtXFZkAB{$FCuY=MiacA8HG|##+xOqx z9_$3F16qIr?=2ZZ0-GBlWYmd@Vr}w#u)Q-H?LqFna-Dw9<8rmivLrD{9>yIH&I9?f z(}|T9LMeq(NEJ#Yok_eyp*!f2i2w>IrB9;NPX!08A~u%Dd*jdno5GW2V)EXRB!^6( z02~qmLRMH_v5dU4NFLcU5X-=j@XRXe#{JxegW&Fa;|K5d_ipt^J8`$8!$>KO0;P~b zNE8wPyz`#OJMWzH&M}o!novrq1Fg&1h)pO2gt9xg-TYSF;w9oXs?HjDS}c{Q#Got~ ze0zo66soF+gU5Kn1J; zQ)ECP7&VhXPzs1e4$OdB0#(kN$O53T6J&+5H;i`PjCbA*M*DGZD~kIn2$c@X#<)_o z0k64AFMDfLr>gOcY)h9nnOr41uPKPKB*|4lzMen7xhYG6pw3=iU9dIRxV2mLJzMcF z*D}1OnXk2aL;xlrsN`_1Vs$0eYiDIt{YtdWL9k}Xn`xb!icLjdQH61vo~%YUC|U*G zCbQ?(?OfXdHRb8{429~Tn)2;6W}^DI!1j}P?N9Az?6t2~SmHkibYHqU*L!?he`>h6 zSGusle@#4w){KOY&x8EJ?-t2Gf>P|=L$e0`e27^I& zI2vpn4Ep0RjD(QDgaVWfq!3DJCdf>hrpY=@Opyx!MBy!^$$Bz7n_L{fc>Hv7d=W5u zfkkGZ$fW@9!8x#&s--#$22ae+IYdH4!K^@dCK4ERV<7{wMC2WLU=D#pQ52IL@+A}b z+(>5-2#J)Al~TE5lN+1nL=M>llOtrsod8DTLEIe`h9;A4d}iVzHPlEJ+UIJfD%Z-lHeVc#WoadkBu?K*Oc`E+t}j71(r zU6-caeqV(##vNk}gF|bkM~~kA{tvP&zi{V68uvznBwNkrS4ClTpa;XgabyX5!=0I9GFxP1W~8k>-W07 zPPe0ipnf76&-G1gytddb3&L2BFS-tQh)7lAP3s}8!wX!0pz07>1_)#-Jr=QcK(61= zj+L)@mNy-k(5wiWBJd^?ssqeRgjTC}r)r?D(ip5WstsF5(4378jJMVl)q9D`n83{v zo&jXjd0LL!u1kQ`?CsjXs|3z6HkPiXsFc!5Dy_oUbUL~>(!HI0bhDT|OU}Qtt8;J; zfWZp@X7tR6tf;hkMgVYFRs66VVMSF9yOcc(#Vi??(Oou+u9EJ*hNGAw>K9T;m(t`4I5+e5^cW8v+9>bZf3f zL;g1iRDob!y4;B8O4g^jh|m(mwycKR_gCF@UT#k`w@V9C>kJk*cLdZ1l^fo>{r1MO z0$LuJ^%iR*RH$h0O{D?=u{~6y{5@69BNb-XnKL#u+L~T2hhNpHc=ec7xW)Bv8qOJN z!n_T0)iz(7FgGRY>)vp`^7ZE;?#u6oYZP=_rS;3oz?*$1Hica$>&0RN|C(vQ(r4i^Lj5~3s z2dLJ`a=n~SuP!dmj-4qwy?&r|ktNI7bUk1AqzG9su<^hwtufv@CL$tW@*|A%gdAVd_4p24cU-9fn`&eG#60Uub6^lXNoc%uajbT|hv|$^687R}`rsDZE1@ zS!9ufELlJM{1@H97K6%)94}9<&QJ5CKnY2bN~w!=mM&5hy}|Bbw-fe;(O@`OPUjb= zS81LEp&sw-?Cu}#A0G4v!R%t5q&B@echk$vQCG5*$V|rjl1dbm3#omr($DXJ>ttl_L~0TP?Yx8!t02-*H|X^9{zwmYvdiQA@=>uqK?1?D zX8NfvjT18=HXfG<0ZWj* ztzi2>IJ&Kd2T^w%#a*pK83a-)6at(3pgJ4Z(3dyoXpxEok{Vs5L(} zy*+ioxZc(JtZk5l)_8v*d1lC)T@R@2Gl#rfIU>9dpPU!Onznik7Zw-=3f z(;`pu%%-Uai`M#8;+cUQ7pp8?<<_3?&%PM_fgWxP5dxrdo`8F!(O^8#@xWTQxVoI2 zoMnpzn?h(21~QO9*a_lspf!PI@5ob8WZpUOjLf2(Rwe*|rDPrJ?ZX>4Z{I_yFhGS| zr0e0%o#ED@CzSEYx}YRopeGIJ2y>Q>eFRPd3PjI%^X?%{Ymc8T5DJ_tVewWCK*Pmf-N$g@0kvxO-U{g_Sb9%3X#_Ci4wSlRL0^Fj_YL2naWwA^X zn|S!Tl5e~C*Y0L+{@V(DwTiJ3XP572rlU9g^}I<@s`WqBpV;Ks^@^OTguMx0+~}i4 zmB}MCA~a-R^!1J-@P>szd^>9`63}Bu>(K`S6UJ(X5|>DO1i8-$$~{aAXiii43emXsD>RO3l&De z_=etjTMci9-BAz^gD_G$khR$A+GW00kK3HJhA*ffwke8oy?*1@aK;Vu+p=D4v##}h zRe!9h$a1-etQSGhFc1}6vl+fuvd?v~Q2E*gMu#3umROUf(u2*{HeWHKM8)2xC)4@!3*&(Sg$jZw z%%YQ1a*T?Yt#QtHWKe9GT#mv?gfQ`4YjxzEapZlPP?1?<6iOjL2TJNthM@prU+7Nn zo8S4hKy`H|+PQT|g|Q}|uM*2lEc#pHJMX;R8w9f#Pt(~Ih!8**S?XM&0f0S&Cu^}N zf*3{IIe73+6!olv{`M}gfWmKW?+bB|E$4Z%G}7+vZfOWn^u~L4C+3;AuFMf7gf7YQ z#bSlLfA6jS_{R2lT;%rtgZG6Du8z;LGrlZ#`s zSRqKVKABu{XCIXkczPIJG$E zjkhhprZvBbQV8_A!>Jb~^)iL)q9b$VQBarq7>J=8OMBoTfqc8v-A;e0hM`b-j2w-F(M9|v`b{?p$d%CwDcKSN(svwjysG#@dSjn&b zsnSnzU7D<$nVa`**^6GNZ$L8+FYIWQEvjHEfy<4a@EpKkYhTg6_ z5K8#09!JCtBh)5yu-a>A-Lq|gt{?My74b5-w%s->(0}dgSFpqg=$uc|EH4a@mjbm8 zlu}wtrBpdwiOb~&zxhn*3{?(6vfA!*-a@dc$%prQ=iZz0ay1oAJ zj*{W@>fG}rP0md+an4gg-g~VzARuccBoTSWK*JqQcFhwF7ptWYZFXzPu`PzQn3tJNhj2oEp5_#zJaQFojf zlO)UBS*e9x<8qZ1mK+GdpaC@k5lP{dfO=LNuxA8jasUW{V1>>VN`Vk^eCzJbcOFJ@ z-(;E1(@vn47c*iGyi>~LxzXr%wtGZ@56029OIB;LPATOwYYD)@?0ovkpZzE^Zn0W! z@7(D3dqOH>>|(h%KYe!e?9pnvT3@UrDIIl8k!UA9aJpRe_sM{cb&oliJwJK;(NDH- zKIrs%VW>nk)U{F!)izJH%A-v98s!K!`Ck=%B%rUuT2+9mIWB-&=+vs|Fn}PY+M}W} zaRRL709?y%Hk*CzoVAT2x^?R`L~{##xH{`q zpHHLXZ}6rfjO)^I^Zur=xv8%<_e|Xb+rF}ODY!ADtY~B8_C6wEvqES#Seu4y_IU$c zjUNuSIp(^pY@?X3xabX@ZJMU)-)u}L+IQf_dbZud+tAcC^w-Oi8gu_#MHRmMo|l@7 zes$K1h}QV4$^7*EWHvodl0_Iqqpj_3r#I{mdYx_JSYj|4TPs@&&{u zU7bFEeDw35c8%5j9V-YSTrUzv8x6X;tCbG(wM&#;rGe9hr5>g=&dM^N! z#7KY?=*T%|y){gZ95NBGD;;7bmvi~R7ly58l;nXtBY-UD0x_r{R6+|zM4@!NUd^9< z@$t@``>~JmEH73WhvLqS2a;u)6@y+s))D(&sI}I5IbUmWu0u^RoPGV7CNf3lOrZs3 znVU_fPIZDXh_^@CWa5hv?avYy0oXn~mrvOnNO z>Iz@QQV&R!U7h&R76f^|GB%s(Xas{{wkm9qxxxuni}R(FiS=%D^G?+1rAaoOPIq^< zl~CTXO&xo@cyYR#{@(cJy`+G}#i{q!s!Fv``pkg6(Z!g+@ zpts(TgZ;SE)nP|e-IJpB)@YyMO)Rc|SBL(MMyal0Vx?YgiN;uZv#H8&%DMox8mrPVRUKq?x?BCVVMb7JQS+A^&!4>$fAm3!{Bq;k{L zv|+QFO|&1B>&V}_&@bh?uW{9=|HTaJBs)4i`S@pl{Kb#{g-w?`H{Vc7cSggV8@F%V zy0g1;V>sN3<8B-UI?(cEE8UkX-&m6cHI0P=C6WwO7zA1uiAm-JL8v?A)oPL5eCN&a z==QTG&vTolHp|wlBrOWo*5{5{OJ#_#^hp9n1n-?ka3)15gmvJUeMv{CvW6s30wOU< zKxXjH6MF^$46+u)GO#J~WW6v-AqrJ0iqg)GD}TU)X_+gk^R+i!mG?&ZblYH|^GwPb(%=y>wv)MV+^YN3N9nXxnTNtUiYj5{509I`@oKWtuShZa)-}8t(01T~17%7$V_Rs5LTio?JfpScfC> zme{W|FZYcJw&$x^o~25mQVaruFcfSQ8%oXdufIGy3hurArgyZsygGS)JfF>{CnwJy zJ!g!)$@3ylv!%&a%v2DUk{M56m>gojjDQkRqwwUJsan7)7D&LXK?y)MCZEl-&de04 z?u5=}X_^^h**a$nXDy(#xj*{)(P;k=(9Y%;KF^g7kQl(LKoNs0EF$OUvu7t~&U>eX z=mcR9r0aDU^tQGR6FYNxV!aQ;P5?aU^d?T&yf{BPUM+2)G@^F}q$ekn)05=wtk*S& z0hEij(m#k1>zG5E3L2Ljo!CUXrY*j7L2Nx2Q29#&wC5=y5Q6~rOqD%OlbS$PG2KM; z>&_c>BV-d3UhPv5l`smSJr%JA{W2KAD+z1s-}F-D?$zOA2xT`<$@+0a07C6tU;X~2 zKvf1Ysxv$R*K!90UpCp+R6x0|s0aUYRl&x(sY(cesD%(pY8~n@R$&~*y{NmL4fj_U zpBB>-X}v&Ib^{|IgBK_mh=Hq27lf9e00=QaL;#P#B{mQv1d-l440j%cqX%JkTgP1; z#!>}BC?T-bG*+cs*Bw^cVZG+`d2_T)N?EO9n#bU) zrm1$-q!LRtrPbib; z+PtT{u+z!aaYy+om;bXm$8EG)&aA1ZBJuEUVLT+NbIayp%yr}L$;4hVAR zh}g47>k&XAAb71I810ZJZpYcC5T$8>XLjC;@=0UIz!GcY7v?NU zoikbm0@%Bv9M-$M$mds!$;oMdIP8x{`Dz(=cY-jSKK)vTdc3`7tYySuf6$G4f_W70 z1gan0e{XMV=j!4z?mu75|5cHv=!;~YgM{Jkjl$bJSy)?yVYqW}aB%D3^vRRe$th-; z&9gWRl~T;)fXgAI%q(TKR42wfb=F>(yx7`106=34DNt%T-Z|)QZOb5Z-mS9rI+S!{oimY?=|F_27v_>05qx#o5V;b<9dJ7i68YOrD%G)|J&I7bx`E^6Ew6 zgtWPF4m@)w?sU5ykcvU9)>)cm<&165?9wd1oGL9<&@~;%JIIvTY?&rkhX*%-33Mcf zyH2DaA)8-08GsUkz?$sp=;-X^Sc{<7>!HLj41*|W9-GDwt7No%6`4>}T_V*ZNz5dw zoUexM%J<*bt+Dk3+=Q=2f>djm+RJfK^OVgqUq%>gkH`bq*xuoFysWE%^sqLfJz#})}7v$nCL?bGSDE>X@>Dg;k1`)>>_18^8dR$W zgxbTuETak(D1->5kf^i@0uy!exUYLdJ-As+zDUo%a?7b8Lez-NC=eM@GlK&51kBzs zdci`JvQq>A$v`Ag_Xg4Ko5A+OxW5Kt8{m^~PEvucZvM7P1;| zM#Sm5SWc$ddMUi)+$PH@1bt;8y*N91@$}?pKly0%FNP0p-g)<%Z@>S&yZ7GQ+c_9? z`zq8@%4=ykacL`5ek&7s@AJa0*U5S{PnRQ@fx?Uq8A3c8Fb` zKEIlro&$prNaO*5SP(Ij6Nrd12;|K-?(29zT})RKvV;oPF*gA>cm|#xSG$qqh2`d=l#{K!`oXs zhxt0$yCbvNxi(p(0ttnr0uY6uguNw+3{oi+LH%5K0O@RYdGs|i1)V{6>mZ0?-P;l% z*^@IaNmq-@Bbr=buTRc7=e>7<)@o~8dLQ^gNzmP}zdfQPU7cN+j2Vs3R>17j)QceM z>@aZ{1{eg^l0vlW$!wkG7Cgc6<40OpNSDQW#@QShfs}{b5jkhQhul{(4G&Dj78n5> zlL62u5Lf~#R0vGWfnY6}1Zu6cL;@xiIG~HOQ%j(<3WGoi1uRe~LXSdqLm7vPrOKV< z-f;WY{mc~S&z^-Oqruo%lg?IQ5Ts`9$&&|WBJkaQx6>c>w)Pv|PeDJax_IhABf z)CJTwCY7egbv$COljDuB>pE+_iC&1vbyiXS@0F1zHJev|x($;R@|EKvUaBQu4;7nw zHz3p=UhNG+O)_sh5?ax)wKp3asAOU_VgG8;dc);cEJBkqS3V(?09had3#zrj%)Sx` zBUFRFnkY#qg%*L5QY)>4Ku3{|`@T2q4DPHiK20yafFiFpTwYBffHPw-hDe7-i-RAAnvLlR!WO{cyB4@LVWdPm9`?aYXsLY0HV?A*6R&K zZi=)5>sF#xM=w`O1B9vvYLh}XC;l2K+1#vEL9_a4Q@w3IP`$GrAb`!T0oH3jfa}{w z7Byftb3+*0U-+_ssY+nms-+qpu}=TXcJxvkSnn)urfM~WdVQwLa&P%w-0V7R97kSy zEXuKu*g|EjziD$uUdeIWx~=B@zf25Om2f}yOXA_@omAsxwqk+#Bywp}h4(47qjF+5G8~<1apa{^;ZR@`9BnKom*| zSu#QZz{Jk^!Wd(%bIux@=UJBJi`Dw%_~_}=FQ0w!5ieJF-g)PZZ~a=Qw=Y%T*pZgb zxXa^{q*S5Qh!Q{wWC7Ix@UlcBu@qt;fv_YHH2`|3yha7EXOJomCFbj;^9Q+vS8!A?k@ELTL+V*n<#4D5W$CA*Dbm86+YGVGx9!xHk&pes4VL47x#}LFznN z%}0jqh1(mp-`ge_gREe1*Oc=Iq%4MW&+R>wSayc^n0-mRM73- z{@}ac_|6aCdgozpt2dj>v$W7E5T04kpda@8Jq9YQC8Ds~4ST~ljym0ukeZw)TL61h z(Cv?jMOGNZ5Ta0o*5xa5o|#!l5+DNMY&JRiI!z{Ve;7sGAkbpd+~35jvYEBchjBA9 zrfMG9goQdfB>>^4b zrBq4WABJ$NTs7=vL4j zg;7_Bp;TH3)yA{U3aBnRa_#w1Wp8b1bKQl@HLH9*->uruYKN;@DYZGBHUH6~?4cGy zHRq;2mE06iTgBq$|IJ1>Fu!4q0o$u7ynd5yzI)R^S7+<3BIWgeaecBHY{YsIfpw*p zD;Ysk&)m2Vm-@46x686nsWAXV7F>C{mp7rH=?*MU})Em0k3g2%^msbzhC#n zZ0>JnFwUoGo~B8%UM&{Oi>r&{<3~r&9@~7qzqfPy{(CAK_6FThhV$9-==s;rKKaw# zt?ur757X3UX-WhTLonR+LZDLUja16oB>DRBFHTO6Kl=FIH^2Gz_x{4&yYEF&w>RiV zaYV*hYw|ob)(RoK<08+~JX@`o&z?Sh^2LXX)1yF$V6-QrVS0JFo}Qax=CTwW6j@Sa zNdO>&kUX<3ob`f$83ls`5dZ`d0}ysL6(kUWyeo=SNC^-C0!tJ^0I_#oDJiv#I-#?U z3z7iFG9r=yWR_(!Ay*?Cxg>}LGqWQBqD)>`Deav}lC=sVzg$4Yf_aTr=|C`CJw3X7 zeiX!UZ@d+RVRt+p?ca*xuFJjFT^+~dUAGeqI%CRJk>~lkSi0%sb z_H|)$%_0ax8Fgb2g|R*}WSFcIN)Si@A&Xe`ZEmqEW6>23|NN|V@mRRRjs{U3APc*ScRL)8r07&7oP$}w@-EQ5gL z`B#rQ&6Lfrozm3*e{H&KQ!YRyopg$OO>=O**3 zu@A z;%gHNUl+ql9e5SRDt4N|mzge7Rcz;4g)3{lFE>;7 z)5+1%^73jp-hP^!pY{Go$FYzw7!4JP$@6EtzTE${-wMKBw--7I9&q;_X&Ih9eth-S zM*$fD(wfLv<6N=$)Q=?#}KZI#eH_70l5J~`(| zpj1kraKr+IKtareLINr+Km~vjoOR9-6M`ckq2f;59SyfUSsesYMZM0B%iR9%&cV$$ zLKS?H&B8q73{sO#r;~0^FoAWrn5PcTbrgl5^3@7d6pnW&UG@6C(T%sxKDd9+m8Qaxjx|~kfI3$z> zgo;Bgy~MLGeoB_IM9$}HlA&=9Q3xR=2ILXAV9v;7nMnmm$}?#aX)~#MVcbJ<#u!&< zj{?yfDso50kw>r$IWvQ&T4BT>5Clt!S}BRZT)K`a6aXG|AS9zu8G}S-Aq)sg5|D8M{0fh&VI{=rP!hG@JVE2ZOcGmM5dr$0~Nz-fvS`S2|L|4k* z!GV}ek6gYkmRABjYUM54+&N=`ge!b%=cuJt!u#Bx6-UMZm7QL#ec{#$`&zb9iAtIXxT$Atf+uX4w#LvG z83-8!wo=)R5!J7V5VbTLfB74D1Kah!R9qUi-_Y{(s=>B#3u|-ICC6UX5-S-SmJ7A( zBJsLU^;#Ik>a^6_^R_UFYqRHi?hkTRT`u7V8OjBB(@ZUt3Z#%qX{ACLgc!y)-cI`a z#rfxE`j{Ok00m@4#cO+1IvC%M_TLM(?uETk-0A5smP$*ZuwiyLxW56UYM@YkcvLwf zV(EQR`$siry#fWo7Nos$A?pHY*^^eytHt(tZ!eJ=NJpwaR3?g>q?eJ)(!e!Iaed!({7)RP%^nO?=clD>ir6hFsXR zTEPbY%m0ezOKbn==1+AE=2tZ4wr@@NZ}wth@5vZ9U#yRhpFMu`$rm60?8RrlC}x)d zO7zGDbv?MrOej6Mn%O)@Z#7UPSvnhcI#)**7>=6K*k`e)< zIJo=p+x?vzFP=P^JbM~3GBE*KF9=WovPW>POh`0%2JnC~?1!=w5-A~tkW3JDMoPxx z8>4T$_ib<@-Q7#xerMGm6zk$_I-SgCc>yw%I@0~U!Pd^U4nhQo4|Z2C)|pMWws*T* z`#W#G)fw*OX)aVpE6fR^uruiORw(4ji&0CLnUkdtiY=W~b(4{nJbhmuU*99iw0=Nl5Prg|`+=?n~7m3i8etDHG`c zEPDV9gFpb}Md67v5DBma@C?3mGGeA$5+sBWTKD282&5`K^@UVA(t&hE;<6%CqyQOs zZ43c0mSC2FKtwU#*$Gw54*PwP&CU>rQ8>aZH^j_{$?5dR|N39-+__(@rbV(|XQs0~ z-oA4ypU<+@G#*5rh2UV&yOGPKE%JQ5LLu_JU}E+l0IXpdhutt>Q+P+lc@cFOSqkj~ zvcQWx>jEW<2`Le9cJ|p%L5BoUGX za&v49tu5C*AC)wgs{9FR5|ish7_aYZ`N1YvZuGq6F=898st{VQ0_xb0RiU{$yVtM= z>sfdx6a*qvN+_*$mbA;C#gqxeA zUb|G+wm#)`6YK^oH|*)A5L+EuY5$A}@)}atU&PoLnl@jJP_zH_*Vgg{XiUDE@`b1m zucq=vwTv&dS=CWAomSA?J6I9>*Y>Es)ix!LO__x2AKJBKmOBy{$D=*<3A|QE+NU$I`HhRwYf=GD^Ctlm&Fo6434D= ziIEV)(Y6e=Qb>qWh$KrKIpHX~nggPDmc0ckZH`b0A#!J@)78aE!5&n+o~P+@oz2&? z%d7JjPm=jnw=w$V~cd%?S_$xHH!V)_hUWKfI3hz#GQM01~={k z1z>NssQbpZ(Ydi`<{TKiJfA{bFz5n5Ga3dTJF3z4qW=kaj0t!SS zB{Q)1L>93$Y-e)BOtF&6=Pb(yQ7I`|U}vYlcW^kJ%%_uC7zQ@6>>%#;lvd-N?fVZO zy#K*B-hB7H{exT1*uv#9j9if=^GVztb+-1R;aKR%8Se^P6gG&vckaCj4hrvxjW1Hq zK;W${40Crl?DS$|){Dyv$aBFy5FkP3X_8%?nRM;4jBVkGiP;m#atb=L&23Q>h4qCg zJUIbgODHjtO@ZE#ccnKk2@wnjy&H$R+ecS;N7fMoTJIU91uWPXo(xw@b0LJ1QY)#I z?1Vu-ih7|M^x}Rej>2Hj?+026;3y0=*${=6s=T{BgC#)bAPhR)5u-rhNQdZ=Yymcn zqG+(Q9gVi~+%hTx1u9;zlFOr``DC(QtvjRb+i$(MzjvoU+*&T@=jZ3vT30yl7=fjb zf!3XFH_z8TPo?0%8^}{v6zF`QRBtdAAhY${<{4S1q+r29B7k>!;!NQ@C)3&0*$bPm zz$Rb|wuLDYSy;SnpCB+p6;IW-$463~q;;D)DUrY^Cw7O4W5bzIlHWu3q6yp$4Q9RH|h0rRpHI zxb~OZjB5^(Hsw{F{(}RtlWvMa}QYfXR(n1Fqc0@Fioh>E6F+_~0 z`&-feH}%dN(QrHJj>5Prlu}Y|WK)exXQfF7sMT#HMJ_-9H@+g}zO_W*P;;~8Vb#L4 zie7IL(w45QdSgSzR(vWo^N4DvmL?5H0Zqk%Y7fJbe6Gpf#^!YM?d6v>{cpaMdX??J z^%u9eQX(4g>S0wt|O=eQiZshN>o>Qh4KMLpv^*XGGt3`(1n^n%n z6mAWU%2=UQ=sc1$N+Gi%!Dlp9c3B|2 z6m)R!{@#rT$=Q`0^*WJ3^JAoE)6nDql zi^&=t#c^Q5P=&otJkZ@R>y3GMxw&=HAREXQoIAOs_wGHHGU+;<%^Z2&+aBy~*-)_bWD}voG`HD0xqIjSyAQvyx3@Q0Ek63QKgynb zwKLueL@!;=lgSIaxbm4{@5>2>j6ebt%hp>Z1p|?BAf<6wc!%D{f1W5!zVHQj14ObYrOwXi`IL%$WdIn1D011cEs7utnZO$(B@PGU!S)_XJ9#z_oRy?J z13POICx-pe){S^Lc=X91EzTEVcPs#^av=%^D!li^5;a{U&;R(3;p!y4b-2C17xi{^ zcN`1`VQ(Dw#yaW*L8P?~%0_u18btB{h*D6?wHBK~C|5!R0fLY=Es=GS+ZvAkG8$nE zaB36GjSC@ccu3lO@H)wSEvi5p)R@`VikK!ttNcaU?U*fqZTMll{`(4Rn;fvBO|f0b z-uOk-N!&|Bc{BgClKs}X@3nz-^(X4FN4Oye%849x2^D~a0MsfFU7>WKLmkAjGgMkD zmQs!PKvLs?G}+yEcfD9`{GR%((4%xa{83TbK?R)azngf&0D9O>cu zsK@HyYGpwADZw>4j~f9{P2O)3aK_r+`I_3R)j@mB8LDYW#trXZH&AiwR5P-`%6Y5Y zV7buQc%57a-ugP#gghW2idI7tw5AQzB^lAOpTSMaj?I%%-8yXn_$E<)EuiA{YRz?} z;_GzH%tY)R8SAp#q-mC$EKS#0x}MJ_m*>Zq=O^c<$5+pvrI%O5DiJ1^-pe59_D3F- z5CBDLT_FTn$JSW{Ped|~?%sPRpJ&VD%4cq#tmEah-&0$ItvvIo$rqQ)<})61@2A3rpmU(cXtb#ab&3N(I>> zL#=|oTu!dK>BaH9 zFp=tx$z~=?owY(J09Ikx8|?v8QLHIRm@%CQM5T4m>xoEvAt=j}vn-#jJ)Ajq9@r8^aR*rq zhr2T9*}~kou@~yja*;lL{?%waxOMwZAfv2+@o3wIj{+@(Gs+uH&gCgtBqGn?%f>w7 zH2`{nmZb!N42~_KV@v^KYmr$75hzVks!(23rX{mq#AntVqlP!!CptKMO!~_I_p(6y7B`Hh4ah4Jl40moy zA+ps>cVh2dsh?h~vhh}Q^Ue3dK`)5It;5^n;r7A3yWxkU>E%?&pja%{i@9?qO>+@O zv&Ce%x1X<8%lVbi<(am^gLPJ_V0`1S-`@&5UCOOFKVwS@Bnu!x5Xr&8aI|-u1M}%0 z{Q)^*R_J9EhEf1YU?NMLdr~MY!Rl%f`h{3uNIgbWA`0T&y=d=2G}?~(TXEcrq9_O= zt(DeVDJhf`H62~cmY`|+#2ONz(r#`7uGmDt3cDIhyKCOJ001nwd_$9*^2RWWuZ5r* zE?$+GTm$Ki+J&p^q)FhQ?AC3$!ZUziLS#aD%`v2$lT^N?FlA-L@wy-%&z(i?xJJyJ=m`l#&nwC8boM3L*tsMcWVbjrW4#t*E;b zb-GH2C`$Jp1Q5J&nSfetRRiiZ^Jb_T)L2v_gW4^y&7htQ&Q=SiMp3<)gmCRr*FCo_ zL*{n=+MK1TFb$h(ZIv-L%7O;6%S8z`r?*@pQft{&apz?*;H6gCx-wB8CU7-~u&UQ` z8>?Z%lQj33xW>Vk^bl3w$JLFw8P{8HwuP8juN<23y|2?a{4!D1uTFvim^@qS^TMWC zwqCCm%hh}~y|_G{PtTI&Vl|&n&W{&o&yuT&PmHo82t%bspg54b_wH}qx|gl<`Q=qQ zJ%ii`f^%P7dZUVm`7cjr7mAxU`@8i~w$y<9u*1he$$ z3(IJF-GP;ggFz7PxWZ^13#Iccvx`d^sdzZ>E-}kOdMA_|?`*B}%uiPmq!I#{mX}vW zXjL37GjeG@Dtv$J0AX=CcLs|rTTIUK)yz}j!GQuPgSZn*155M`HsMCM{oA1Z{VX|IiNpkw^hJ?pH5aOrn9A{2;|nPxG*Fcy_AT8wZML7uwE_&DyKtdj1)kUk%%o3P$2-&l2Dy> zrUSjRJsxlE+`f6|aOdFhi)R<7r#g&+I5tHwn@!1)12WzV7PIq-EpkGiCUfEQ+^{Gd zNd>CM0=>6-)Ll-OW@Us{K-?MK$R{haEXKVpn=F!anTM3FrY=crQq0fK`rR#)7B+L_ z1rZbuJeAfENQ?l|5iygX(xQZ1>5_tSMJSk57(j2NB?p1pyLE5>@D>BECRcH{Ki=DV z{OEoS?hq}L01P+vC2SVs1-;g;KCH%c+H{5(D+24kUEIR z{hd1x_U}K?sw0DMcoLug_|Jd=nS5@b6ILvy5XKvnC_6E9M_%`rOQA)|9feWo%0$X*!7Kw(HlcX#KI=@N| zg1(vxUu9+2v)c+Mh+A8z1=tN@ZOFkE8kZmR8?fLF!Znq}DuB0&kX3el%~iNYn%AHy zRQVw^v}ctdZ!onbPHPhGx=pH4Z@t#edIL$!HKC4Wfw>~P1v0AAJWItlz7g!br-wJA z-Y^I|N@<~*#8&`tGvKg7ludpKyh#qP(GM>}X^XRGei>;u%LhQdRwme-*?K?*U)vV6 z?yGCniB@;`h8U5$>mADn0XK0lP_{8vVa&_Fbb5YGy?18kv#&n-Bui%@ zcG$98&(RxHy3^|xws`vGk0agf>p*zQn2Pz;(bZXz=5M_J1NLG$zp`d#^VET0Z*-Qs zWQ8Gy{ljRybN|8JPIq+t=<)3GyjU*0FYdkd;N5Tipzz^WkDq+~>4)>@KmUy%{*`<0 z{pRzdlTUv9N6Cw43`$GEwlK+rm~|M1akRX;%oejSj+MN+#K%RJnf1~axpy9zwD1^q zFzh?>7K@a;x8$?s_!h>)J@O}c zt!BbAFbc8+JiEB)^g6yU=cf~hM_NjD8QaX6909%5UJBuz$W0l~f!n6oO5{ z)&en;_sry3NO69A@r$2-IKFlFa4-rm+8!wjiV1C&WXW=|bV5mB$g`~1=~F@3a(!`i zc6ofZUMxknMh13Hgq?V>B~VG?^>n5Xj0#Y|VmZ;0ln9JX^ZDiKWcqa&_O=gZCnvK< zPhoA+VhXvjEVCR6FAH*xg=0{qX)d!PPf+`-mMt+rLZA@BfZ({RN89@k-s_Ks#qt94 zEMKh=<vbkFo**g#iM}=rO(rTAUjfd=fhsV z(AqQR&KG%BU@p47oxK|pIdh|Vrnvu&63 z1r)1vwOEC!3+ScN)|x2nq*>7)?cI4t9ew?=@T&(8-ecZOPtKn2Z5`Uw7P&Fb738E8fmB=f@7;d*LC_s_IuVQY?RVZ=O^+^KTzW%AkqPiB z45gHSpoL_z3^-pFl154x3AqXsCkBfwU7fnq3%zwB2cz!JerIbx9&V4f_eR61_Ib&{k&`q#@x!~0b zf!N4-YDB+ASl4P8tTF8sTxpocO%Se+@%ry8s46EAl};L)Xj>g4HjP~`zcy3=w?Svq zmfPS8mm_p44pjh9J)f@PFoh7P0~H;9H|Xz0y^#tdDW#AS+lf*&wC-A|y;+&?_3O9U zv1Vu5i>p_1+v{KewY$qJ$J~BbH9e{3Z_9FQwatw}tKoE8d)@}`dg5*iZX0o5t2*0! z3)I@Os-g_nzY$uC%ohJrC$&tQyqlmIy4Bt*1OU<4!PNhGiO+`CdSY|hYL{qynM(d; z(EIvTEkjnA*?fI9nVg}UaJef)vT2EQNat?)~&wly~4uatC4!4K<&Kd8097fW(bUJt7Kx!gz z&ikB9mgnhed2u>BdFmERwgr+COwxMqp9|eVsm*GYOiv_okrxC!IexOey918q=jUjP zFaPil0;Sn{Dy#su)~DXGjEKPMPJsp#K<=vE4Z%`DAXKPAA!Yq6c>*Vd3<4#D-9Okn zJUDa?A$GIbBR{>;TAKA@J)IUs&M29MCGUZ}XY^hG2@qPaG>OnGWfZ8M)KR2SFli;p z6`@uHA_Q7Vi8>tLzJ33V4}g6bij&ofJqAL}FOJSn9uIeJr-_r{K!jcC0IU&OC9CA< z(dTSQ%Q#tHOn1(^TRUN=b9r?k5gc>3*S~e}-ocH%pZx3pYBfC-++*Xm_HT^FyGU?& z_+Wj0nkJb-)KNG~W{cAcldn9O!HvTp3gbb1^BW&Lc=*0#X?-F@A9?%g_S^G|v~Zc{ z!sP{c5>bqT1u~Lz&H{@|dmaWNkfp=xp)Vl@q?L@k6? z;BT}ua2>x}agA_OhDKy+Mdwy9d<7F)h*G{sRAQ@U%dhxfZF1S`nk#Na+cI~mA(^p> zvhcbcsh5{^U~YJL+9c(bPzoEBby{KPWI;f#X8g5z+|7|zCxtexIGY6rv_H^He7>%@+H7mHOlr=_ zhLC9nGl=@fmQ4D34hh$I-IqGO8&&{ILI*2ntD3HC8KW zJ_jNshgd4!7?33jZ;aMvxHTq@uda@+E{_GeI}hH~7)Rad@Ww4I;O^TGhr9QWzk0kH zp3fJT+3d7G97m$3m0(XU*Ngdbw)i**qkgEQ5T3x9f~jmpn2X6YFN*c-%q%C?;2;0tAARHd9W{!BRexva&DqsgGO{=Be}8s*kzbw4 zUOy0WFxpBIljc+JOn+}T-q~MVU98T|(KC7WB)u)zuDl3{O%O{4AS<)!RW?75Iy)v? zclU?i{p-K})~z3sV**ZA>-qHR>Ekb+e*AMYKMicAC6Wh3M!|^86qcOj zVjf5g3Va9-pNSddW4OLB~W zXq*E}v9@RpF|bR`#d5HBC<_9ogv~Xg77~HkJ7J9=0B2*gL7>(PBV@o@fY7?vdH=iL zGLDX(ekL3wN#-qT9WjuTV2fh<{CIsei+f!m-NBvvx8M9Aodsc}e(|UOCR;B5(%<+y zvD~L<>+t6NFaGRL`n_=!cbv$zQr-U07KsD|YYuPS*t+{((CI#Z^x2m`|4Da$Z|~m2 z-Ms@H$j)HQj>53($$BoEz*e@^60c;O1R7-0Ac>N@;-z0)>>a^!ncDcw55? zuymWRjQ!wM)krIf^7Wune~O{*WNM-^wlqEU2J!l4YEZBBPS@$|4O7llCAF1;UVGOj z)^4mVUxPGQ_8VQ#)2<^?75SUqtEP#zftY4>z)f+Mn&NNs_qzC6Hq8MyV=|!8t;v7% zkN@{72!)g=%U~{Q8BimCuCLDZe71(8c5NRvjjwg1bXi}mr|rEg_IY`JRFlIthlj0` z)cV%VVr6sl08|?A>YBFviV>T7DQ>oO-O3bRIuXF<#7pYtSDQ5ZT;ib&LRQr#;)?FW@r6kk-RuM z{_N9_e)5OEclG=$Wz7C)dpsKVhg*48m~36Fk|H%g4#{CTHVXuiAO=yY&pgg2SJUa$ z+2zT6HO-du@n952qji>9pY{6N#wisE5yY2Ar;F1kHqF?AKre%UuyRy@+F?>72xefg z%%rvI4Md>4H?#T0*5RQuaCLDUhSB2m0y!NIhl|VE`A`$`^1)@Y|_EcJAJ7+u- z*FAy|hS(YOw)gMddsDCkg|8TWhJ+k1P5_ul;OcmLLZ z^dAR<{?ji%y!Y?}oBM1zom`%!>mUB89D|TtWYQN($taHdqfyu$M1%3W z-~QpvH{Uor`qCy@)QJmcXY)mtu1!%S=_<`~V_~&gdP&yiS0_i={E``Oyz}Rl;Ni`yh;WZ{F_ohwCIMhs$-k11WTGxIGw*2V3JCHxIMf#dU6bRlHv1uviC~ zHqw^xA{rE`Wx}siV4Lh0p>ECCc!<1=e6_Fz+xXIut$3|&iBMzcH9Zh+<~LkROsYS( ze$(RM`C0_6BYn+izJ%np9q_f1E7Z6Pbq>_FXsVqgus-W$BUrsgQA%qR0z_rSRbGR} z2Ib|GS^a;rirG-&WkFzbu$vHH@B1tA=4!+dHzn)qc^fyKugw>?Ch%3#sn)itSq=?4 zRw4psV8H;4REz2BhU;tAW!Fyzu5b&a>jHkQrf?}E}thN$%|bz{Iw z3$g2DdGl~Ir>xmPdCgurZ=3e~`i|R_aEOUY^8ywEg%oL0oL|k(&yK(T;=_;r7eV1^z8V_$)m^JXtl^zv$J!vUPS@SE-#(oJXyQtDnN-*Bwdi4O`j*lXzyma zSlr*;+Uno?_$NqdKl(D6 zUumt#n8ODLfA_!l4=yLh>v*2&7ys|y|7ZW7f2zB1^7WJT z*>rYxarF6TcD)7?)-VxT5*`?t9g_t@sQ^%hqC1Fso#;E?`HSEE?yo<4^7OMm`!)#7YDKMO%glX_(E;OM^bqV*%jz*K3fXQYhDeu zdhdVh+f44+vu9bBz47p&C15J@d2A+VwJsb36QCsaVXPUIceWr$%);lAfSmW_08oMu zOh6V9fshCZ!7(C82@nv1!_ae}HQU_hiBu>AL`nw1xI5fJyJq8k#(;u|B9|AAWx_{Xe{T{L!FuCkkRgqR5EABjiFViLpQs#8QAzS^^1jI_!*h z?hMA`C>rc+-{=neci;Koi=TW5M#)%rceWQ-XRC{I1&~{|h#fJwJU=6w%}im)3;X7JX-Z@u{Pb0Ii$vw1o% zzV=t=N8_C>25GZASu8J)pC?Hc3njF4MMkI*(K#z5Dk(Zq@9p>Ar6OCMJk>f@8h!2q z;X?w!UU-M#i)>|60$QrG0L z3;?y6Nh^nLoum4v>n-ao^li}(SaUMhO7_=4xc+B(@~pAzG)vRmnnEej>2%18lhgAr zzy9RQkN)`R(_bu}KIsNg9u0ciyG5GMFHWMtaC-jY^2K9o3(t<&p=Tkg8c?~E_Cy5e znUUOgfBi4*9=>yQd=$ljlwpw<ipT~AFbrNAYP_R?@cGvMV2C< z%Z;}Vl=4C{k`AIGu~$dOI#6GIGWpN`um7j*8}D{9{lmBJ|Mu_v%};Ob{q(>3f2OC; z_ijB*PA1R3`fRlSR^gpiy|}XzbdK^=ktYGB8|eOEuzz@4^!v|WJbrd^EIsma^0VLj zS8qT3K5oa4{>3jo`?vqaet$cbU6U+3WOFSoDPUJPYsg#n0?`w)00AHs#Bn$p548|c zZ@{cw;=`Z|Q0{oPw!tLDl~7Wsa2N(*R}-q~JX6BieCfza zkHV94=s+T{CWwepI4uQvwggrn2`Pmj0IeiTbWCV7=jrt5i3|d_UUgIu#XUiQ44#-E zU=Wu5t=snw?!Ofe#wVv=_O^!o{wN}M=iP7o+yC4D{oWnJWWyj_@ye40@EQTFwP^tX zqc!Lpv#`0LJau`tT1e}h4g(RX%d2VOnO*+ITi<&BgCBTr|IP3HlZ!7Oc@+_Je{cV- z_ulPv!;7P@&R?A5i$XeHou9n--471my7RL?`8UgFXIgeFITeC4iLs+P)QO~0Q9K;>cfS7dj{>4VNeLkUOA&htih?8=sifAzp(82Jo<9$I!!YdX zV7PPV&2*VuoL(+wCyR@Tl(O6JMV&q~B(&NZv66FfkGdcAnT2vp{#$U|Zzr*@r(e^YguTzuO;fbvnU~yKfxa zen(0rWv`s1bB!nk7Fdy}vT{#AsJktO>R%xNe+>Mc9RZDFa zR1H*D_=vSJDb#dH3EVFiJ#ll{u&Pazo?Ojzt@_?5cS%$YZ_Vc!s)0zQj&O5YpgH8a zZ<(-K9n_KpKn77kw4iciI}kLScU=#zmrYn7TLak)z|c%YY?iC_dZniQUwJixyyg%Q zaFymK=VzzK&#q37SMv)g=-~D}#No5&U;pAqfAH)_zaM6aMr~ELj-NvmC-bCOo~l?~ zU0!Gr?CjoH%ol5W7m zl2X8MxD`d6d@(ah{Ng7+A|M2Nd2#GLNgY7Y(}VCY{oViI{U7|z)w+0o{^IJ{m-&mQ z${Xi$8TA0QM5Bd3MlF~GC&&)iGq@t{jiXy{yv-PjAP#$-s}~n1&z=v5JH1ZlJh?)j zqBjcca6G)dzw4E_Oqk}U{M)>%j7e8KDx1apLJKm^3bIY1;p2dH&`616}n6$!yo znk*$wiX{QdUT@SLYf%^>6ZN_%<>kp^h{E&dkI{q4DP7#SI=_r{|IYn~ zljBR90Xl<3-Tt`OAB6Ep$IqUB{&N*+TflH|79e|Gz%BJG(ohtvzzEp3Sl( z&7wF1H;%iZj+GRd$-sFX1cYRrMeC#kMF9);WIUrOjI}lz4+HA>WRc9y!k`x;EY8m` ziqouM3<0xrnbJDl9>k;VgViccW>fE}D4Y-hFi3$y>Hcsl3{)Hj-WOy%5GyY(AAcr= zEhb0ka>5X$(i#FSOlHx86p}!SU?31hF|*SX&Qj+Ja{21TQNGH9?hx26-g{4~I0&Oa z2T>fA7$cw&`&MJN398|I1R(2#kZN+c^2A`Sg{0TxPd%9(TILX~xK!az!%M%yhgP^* z8Dx~XE>$cZH(6CJ*s20>1(C1Si`CYUFSmps)+3bLy!10fh-mD9VYZADD<96=N)xv{Hfz|8W9NN~M?f*6wX>?83y+OX_t@WWc zTx&g_9yXn|uN-O#YTR__)S$;rr2(M4p*A>G*9}^!e+`S*64IJ?CS)P1bt1PuiqOh^ z5wBljMkvv`fmqz6!yAZg-!8mKf?r$i{iXIAb!WgTNgqEw{^+A0ef{B&lG8JuU8Ji^ z=tg_@-?_M)J^SQSSS%HQ2vk8_oLx;9IkC=HGoQ}3Zrr^8jqi9u5J#P!cAk^jyjZTC z_vPFmiJ*lDlu{_qpFisF9-`EX$>QVlf2}*+-e5?Kd7kbb9^Sfj$2c*c&o9qT1o=-t z`q`bg?CkQ{;_OM0t|WOaf+&c?ZbZP&TN%RLHy_5MoAYN+kDh*&E-xRx|IpzF&mTQL zd;HiY7QAL_jY0NCAW3B8Ea-3;M^Yi6G$0E{T8B18v!1V~%Rl|IKe~JCd#PDWX4AsU zdE=yJtXg9(oxL!(mjcuI{{dPiy(F{?)%-m~fuV-udADZlo?gf0SOF zn594Z;z&O_J&3iBaCvnccLpeQz$C*C#IZ7kv;{dI1+fSN4#H3=K>$lR2G%40+XD`kkebtc&ph;*68X2WfBuGd>>^eZG zqKu@^*IS3Xzw^7l`^H<}eDc+!)5(kDr(fCm{KZEw7a)! zLF8&3cEl?8c|qPY5qdz6;DE|h8yqQsK(IiT0z;{lQbC{t6iT2dM?O0y0t68#?1qRo z1 zq6N{3SfUx0%P2RWojaF#%bq<7WOTx2Iv9)&w&G6TWQFR*7zXRbvb$P%tuLQH0#w7% zNGXlNSW~?9<~O$X@219o{lzbqR}%mtcE$=z6a`8+A4u$WV(*wR;oOontJRwFwHBht zDK|@0DvE+Zz|w2)n2-RS@d*gY&azqg^%6iR7077hXUoai8A%;z)xUAr9gM;tmP!SI zD#M1rYMM_|IRyYl6inEJyDFSk>a8+_@k`-|>zD`i78^ux$0Ny|$zgW%Gz6NC~y9TZrNt^Vq0-!dB z`f3insb04$iW`EwAqmRQ%Kz0r`o~R&>Pr#))ui^7%J4>Hd`*qS6@YEn33wHpo25_< zB=wFq=2p<0;7Un_6?rczQCB0${v{3LWktKZexmyKCfyWu)>{6uVn9lczE#L?Nwum| z*Z9BGw`+ZTZS<=b8PJgao43Byk6Web8=j+4kTv&BRkwc$o1xNJHLq9DmzT@z@zWPS z|Jk4X;XnV+&p!SctTI1e_|;-Po0#Q15d8N0?+4x9YQ6G?P)PFZv(#p5D$H;=xb?<+ zf$lPy?y&pt+rPGba6e1ZWHEK#6Ci>RC=^PqH4_GLcQ8Jjo=($bmd@vk*?hHH6MJVV zjHC+Wbg?+QnodrRmY1i~i}RCbk7p-O+-jZ|g|&p>1I0>#5F!pE4PrIF3j1-gUSB?Y zytBRi?eG7kH{bk*>h>{|x8J;b_uX&wcJ>7UnR4I|A+Tf$1a_j(c}ff8oh$OxnACe? z6Z6%_AI;{cj~{(8IXfb1UtnJg0QNIy=7l>QlQ|TSLZC zH99)LL@*E%As;n83j!LQwY^F8*kwYQ(G(??(a?4SN;|L5iN zlm7nwc(7CCtJ(QcktT5`>h!xxi7Gw{76O#SPB-dwI)Mt641~~#QVP^kiK=ELUEwZH zj@FCI#dMx5S0-Osn;Y+@i>t}y>Ga}kdV0E=uCi4zIXgQ)dCH0=rzgqe+!jTD=SC3r z=F8!)FOun$GKUOEBm{(kR6*3++9wY| z5Q2mxS>%af21{fMo7;S6Z?8Yt@;3KH((jM94{ibrlcgq2LWN2K3Q;&)*vwhm@AkI0 zwv|NihKnpuXL;c~1de5HWp0UB1aXK+!leN?#a6h&yWE@9I|Gi;TSy`b+ zx|mwy9hRd;+i1YQ$k$D6Oy= zW+@s@qJHPg$#-iVRIY@O+Y1D2I-2SWz%PBave2sDhOJU-b35WjB95)HL460;!zUVs zyTS99_qO>|C5^ABlWWSu)=HweB5lNdsQ_Gl#Cw{})32XC``M5G_>ceDe}4YShXDl6 zIcqXw?e5K6Pj;OT6FqdX6|-6!|^VOs4#XhIoaOb-rjq# zUb&0uS+<%>009zF36v-#qmV&tJYSxltfxmdUnw1v!!#=t;IJPLc6NgPU_PJDj*n@z z<~;X#=CX{9RbgxiopYWFsc|qKs~{lqN=UO?3|Q&TJ+e*Xtjjuy+s-FM#n z!S{Z6>+VAtbk~ck)%+sMZRsd1P)NZ-X+ZR@DAL4RL(Ub(AcC1MXJ@B7H}5?B&UfGZ z_V>irP7(Dw<8L@WHjcb?5uZ%D-x3@-gpF1lC<<1yksJu0~g*Klc&JW+aliH4hP#P zV7#?0m9j-*a(i}iy3W>lYS05XLLpQbK>)@WlV#w&R1u;A5kS;Ac=N&G{kJ-C=dJf2 z-o5)SlD6QlPLJIpNoJSDY+B40-jZ>YJHx>JNC%QlvS3%Nm+RSbWf-JZG6+!zAixo^ zR6>VQe=iyws(5I@1;UNOpdW^@R#H?WMhVb*OH@sb119I4bKW~k-myTT6bhkKAp5=k z&fa)?@5$F+%qQn3r;q;lpZyoJr_TbZm6mZYT+OeRR~IP5!PZW%+t)z=1So}8LJHDx zG#>AEyFDq9*mBtfhb)8;B4iN~A+aOkWStskZMH&Zh|ITt>o4Db`#afsdHU>$O%0GP zpSRW3)z#5cvtFi)1qi)fO$)PHEvEvZHy8}IZ>Tt4EtkNYrx^qF`~4!f={j3pP0ea) zQ^OtvvPK35ZwisK_TU^@ z=bZDzR9g861fm=moDYpD5DZf~T6Kx?^?XNpaqh^XUK{Tm>JvOT7BGZIxL zmJv~KlWSa0Dw+%ep^4ee?4CwM-@Fa+C<`nE1ky^3m!1E57ev=6!A z3{XI8%he5eO>vD48?d=eVe^eO#a;bKwQ9Lkd$&}ESk3<041sFh98FsLa;L!SsOIV< z*6r8M`HRW&i${-s{HMSFhyVPaUVi#vFCL)m*}Nbo&p6!P8SEUy!yO$C(&ch~cAicq z=xi8B9ra}p1YxAYXqBwji|Oq2WIdaENtesX@v|>vwvvcMWqUUWApnt>kjZ50!a2u+ z7zt1+3DyjDg5Ul7|M9Im-$;vOeQ^Z2A6%Su%*s$&WQ*C=k&MJVnSK7V zKc0T^<#cuV)&~zk2w*4n(VMHJN94!t}RB=O@R{KK`Uwtdsc_=eZIRQFS>~437bs9DsY8%R;QQktY86JE8;5W8x_d>D#sT+~-41kDYoW>|u|x16 zrS5jO_xDt&O`aiH9fdLsnZYoi(o&)jD3y+e!_3g>i?2?fefjw3KYRMKpO~w8C=?=W z-Ppcy|IPl+K@i33)f^dg5D1}(1+WKp%p42`x8AxB?200{&ao{#0z`_K0;RQ9ESSk6 zvOqwx=!vXXQrv#y9rO_bur)=Rld}v?NK`>cEKF`ZfpJjeW;I`WM?ikGvwQRY+bEQG zzBd^6M?0BGnY<^T=UK8^u9vesS$aVX1$rwzW8sR$rCUv0RuId4xk}g5EH%zE3HE}9 zqoGN%)nbw_=ityLg->RX%)t>ma_a@JCOXdp@3bwPD@Hqeqh2q&d?B(V)FBcXLs{YS zG;!83LVxF=w{$SMoJ_xn_v% ztz#4KYZNc{=%wJ!h{)GlG#hc*b+@k;;e74Y%BQcPZ-dR%L2~;O^==`;D<=p_3L0KM z;0?{%0{#}I+*0|xp8Ktiq%q9EUv@|hYQ5&yo0h0rvUj~_tF+AIYGKx<+{<@}Ys@-U z)b565*j&Wx#PEjity%A;C%67nY4sthksx^OP%4=;x4^hr2eiPnMY*>YjL@KNz1#KL z0Y$wJqM`s=*j#;*h^(=BZZ57CpMUwqAN~IC{n0=BFPG0B#|TozD5VNR55(-UEH_2I znk~|FadrCQ>ctbYN+bdKvIkUo@+1Z7&=f_Urye+6ET%7xFwKQA$c#b)1EN4gCA>fm z!azr{LDkvX4|-iot{dy|!QkOv`1NcTK!wO20HgpELSnxkcl$d!j1F(!Dx4ec?({|nm*qvU zgyyo>gWGT1ceYqfUH}#I%Zq1Ue);UvU#w1#1?Wc~fAWhT{mV~2{qW-Gm@V7YJkl^8 z?KpDQWZqei5r#unkt6ghjdeuCT>3F0p!CGXdLp{_@L@36N%G>>8*jYx&bP=*BQSG5 z9Pf}2`Fdq+v0ks)dm(^<*!#@7)qG}_3v#3x5j?RML9C;GG}`G6$4ba3?4BGSJ$?Me zYC26W&y(rpdU`1lq9}@cqyEl~sH=xt!y9+rQr%qxQIQw9aVuiW076Km!vNoZ|KT^k z{r$JzdWV46+itfbz=xC%B=vNllmq}~LLe!m3iRHMy9bB&Fo@D@O+^-V2Qr9FVZ5Vq zxMFwE?es>Y;Z`7{>FLSr_?akj?Va>K3Y6|d_rCMp`yc$;Xy;~kdw1(#yFVPK>(yd$ zWt>+^OTj4cul#ra-dpc~KPR3|*WPLG?f3rLU;drH_aFKI^EB-bwxsmHzSN^22myjY zAj9hFijY@%x>`<5nh5epjwK5vQAk1{6bOg}N-72rN_R%%(e^HQiu$29CI~vlW_g}6 z5jp39*V#hIV6?p-cH$ykVQ$D;GREaax?UwFO_meN3THV@myXgro2QFOk>{(^r!sfi z7CKw-Y96v9*b^&XUO~vU6E(3u8>-tN})iN~?~Jw)0MU-;buF?=da(s4uYrx%JAYsUppC|~G3;%siq|4- zovmzgn>vByCdgLUjBQf71e$w9P0-*Kgntv8$(%Bwdh>bjIvkZ7;4_j&SHPmaE z{^pOha%)q6-GDM)!|iH-E0ik2`i5u&Az+<1w|1-5&n}u~cx(=Tb5GXX!L|FQ0cot# zT!GlWI*4eDTdkAjYJGY!`Rwyg{^Sq->p%II|36qJyWIf*a~O=a4^ZoZ3X`Q~ovdc_ z#dLD@{K@>{d^Mj7XC)(`U?TG9yd$zg2&E;X*9h#Htn-$vX8;x`nstMcprl|#lDKT_=n4v*Yz_n$Dj6 zg}?HHy@R{fkDfod^VZuReCIc0*g3yA zP3Cix+0}d*A`6i0&}2SYFI{Gd5I~@cWY|%?aew<(n!4PiohU43E1N8zeDd+dlh2Z? zlVoxk0)#ryQjErf(Rk49^@HxXw|7UV?ZjZ3%(FaQIU)cS$jtpw@BMebsW|8j`w!lJ zb9;ZQC=y6kkxjZprMW+sz2wAFDj`4x5rE9rt0Y;vJktPZ3noWIh*Am>>QF1ui9_L2 zn=WmZp>ynRo=D)AXFfQ5TYDngHboKS%wO`ot_GV+}S)&sK~VrhgrbTWEj3>*?6214*)B0*YJw7qZ$^W0Q|9-YC%hJQJwYE9t zy5~*4^jVqZtGc?Xt8I1n^mLCOU@(9HkWkPdCNLBA+S1&I(T zQIu$gFoOYR(Bs;7RhO^KtaLA*ch?`c-CFwL+Lx6L+{mhYdGERB?6dEE``hbV-}+W6 zAO+)wC%(!!*kB4U1v-)p&iVjC=~$w&#W0X#fT}Wseqn3~&Vo0R7#XzC5U416c{UhU z-gvZuJ%|7t06c+XR0te^2sC(!F!K8m0Kxivm{m3(4o)B3edp5;f6(h5MfHWW)>2Z8 zQ+0EamKl|Yh=3D<_dH#EP7#e0S=VIYn}HP0(kw&wBwkO@ zXdXy#(rn-f77t2r@7d%Y;M}N zXo}4^%>|FPHFGlQse(-)3Z6Mf(Qw6(t1ADo??9UmRuz4OVBzyIC$|MZVkmS4GWS+GVWNy6&-1?#EZ zJtbqn5qU?(ka5n~-~uwBKn7w2&&)(@Ed(3a8XA=F9+eIfjSq|vh#6&I02C5NHNimS zgA~oRH3ZjOXgKzN`QQGHU;WL$6X~U4Wq$g@?{^<;4^EFtTLwZOh&cd)l<{D2a{0we zUM_s_;fI4kr`~8>zW!W&`GQItKB#`TUkp07vL0n~Y2n4se?hCppx29QjiL&*R(kd7 z_4etY-8nni-S+*SWMU4E*^D~v5iqf}wkn2|Ei8t(wwQPNI}h(2?QM5YkNWLXXNvVJ zTdNnZwN_S1#)Dyh(C>Qdn85||-h1KzN+`_=DA4faSX+za$vf-3HQ)n^IEJLoIwgoi z)Z*G=vUX9Y4V9#rq)ag}cyDc4vMIo3t}2g@2ZMGyIP;Zn{c=q&TVqep4m!tev>v^6 zrmPBMi^^r0&+`z7fJs7a@j}wN*jT^Ltb94>o$b4PP;@$j!-Mi{hljl|EQBSEGD3(X zN;VoisMLE7M1XM!7F}nU^~=B@fDi=;l%ln?qGYmmdF#T3iz|&*O{?zqZJ7@RA_`;< zfx>uWLjeK}vwl_-Wi}{>eE|&QX{3opgt0n+k-fK-ElXFGz$7FHDTRonj2Exm*tqdx zr_<|Kz1P0*h1I1?nCj~;$eE6{$c1)SOz=*NLNb5){1n{GEJ5AGT&%JW><{KBUUFo0g+p1*HN=BpPj|5i0 z5 zTL32otB4~FaqNLvDiy~VSOdjK3K-F&1Sa;m36-bHkt1&%5$UCkOP~L0V{NOlo@E3w zSy;b( zan5l|+n-D2j)(qpt3%HNC{NK({_fxV2T$~DpWWjVJTpG|^7KKI!9R8Pa1IxzEo`3> ztirialAk`w=ldnh-aLyGCmXJbS%lzOVez?|BAm*naN?CY#*%R~j^h+BPxX8gM4d(A zvrY)(=f?h2D5fJDcbuF^!DjP1$9hjjH&^)k^U}RI|D^^11Z!Ql-#^^nfBfjdgL}6> z{K-%6zWr0^v=^eJ7HJ&`9cy2h&gqfQ&la>wRLbOZ97&Mi!>IKnk9;LZGy{4iq!5w` z0(k(^I*KB#qeLYMqX;OyCt{E&B!p2mIB?j!dPOA*rO6x1E0>>r?#o~Q<)!5d#PaUL z`#<}OKk458q{@1gbpVJ`C?yb3NSzJK2So}IKGe|meczk}9{1c)|(B?!zyh^b8*0lK1!q^k0P zDTaA}P-X>%U|lG^y>$JG6pgc!PN#E{_d4Eq@4a)D00IjT%39k!J2m}|t_F(>waYKP z+}v2JD%%?job`s-MX3j2m_a94Yu45-1?Oy)S<7gHvlTM}31=J-X<1`ZNC5zKvnHab z(>~g}eJ5l?#Z{;ZQ<ja(1qDaJ0YbCcYBg766e+FH8`Iyj-Q%iz>Z@KTdu%IV zO%hzpPOt-S6DOk->`>Zy)HRhoR* zIe1|6e3WPi9Ebuij;kR#aGZ5gD17rHU3>%`}a?ucSZ#u8ggW@f;W-isB?n z#u8kqp_Z;}thbNbX`@kFTuPhG=Hi-!nkDhh+ut+&fz}B-J3KmcgD%<1**r-g?{;?g z_D^>XT%HwK*ONdgr4(8!C6q#es2GG&v2{T=n@Mw_$cI(8>x@HGTBiU4AqZp|wcmh| z!HFf7!@(eUS8KF_=Rvz`s#2$sjAK)k#c=TIn{QsZa;x54R2V6x_YNMJG6NJKBa~4P z7`GZ*S8lbI)=WMKrqIZ-khNIG0wi-3)ugP2(okh75D^DRL~ZTT8*g5H{q?wB>z|zj z1l>qP9JA6`t9jtS96&i2Xw+UyB^cEmM!9p2+{8Z^iP1AU5C*kj9>v5gQ<1KDl1M>v zkQ~4`E^H0sNN6zOOO#_1Az&Rt^qzH`sa;`J$o zNpoh_|GLMd7HIm9&s+@vh* ziqD*J`kBwo;)r&gqRzQGohOEd)4Vz$f}jayf}efM^kSpy&kQA}csM1jc{1>Gw>C-Y zpS#%!NijmQiA<1ZUnrOfnf^mLfae2$8iwM)bfsj$@Tr>jH36ZwO=^iT%U<+aG^;wEd`ivS-Tz z7^7IHt)>(L0em2glGnffOFCL;#I;D`qkA78?rxK*T-JA04iJL1A&~QKb$xSV`HIIV z)S6Xh`<<>C3_AMo|(yT2n=Jtzz(1uw_|R&XQ*g zgv6NVISQ^S-|wF7?>#OC{ZV~C1&2&Z3MCbD5X{or7|j>I^Q$*r`#Llisvy0rwfkMB zAao?-CRG491 z3*jlx2f-R|O$d%c;1DSIG||XT3i4%-vePhZbCt2l6|)o)DX8Ft9ZEJF0(pWE1bbwU zL;++#cD6($W2y2U$@uJHFOag^K6-WgJ z1s;W@3G*Zng%FX}wOX{gx|zfckW3tinWYRM2w5m-)M{~D$0WrliKCQ)_2jKB&bpoT z&9#Nv5)-zIPG00kJKJZwyMh?WAY1EQaE`1Mg0-&a!!lI4uQFF=aolJutY{I~8w4)} z0!RYMfX`<-@`WrM-#(W5)QEQN$ffIvi*v{p7RU45?6Sm<;Qg{>}cUehWe zGgQH8;3#UKu91p^j{9YkR)}TG`$@Ln=`RU;^&N5A+RcrMNoN=}gUXpX*6f6G ztaqhz9gJ|&AZL2n37E_Yh$rdku`GvSRGKs;ZRcZ7ej413IrK?c%A|H_{vA&qJr6{4 z8W&{_fxV2QyUr%ws;*eiHA-{}yAJIz06;`lNX7{4;(WXE-h9rvuN2-lI%MW?sCYu*m4N10WCIiP(S3^O8xz*%0kJDr`!+n?U~@c!)&PxkgsclWE4 zUG5$!Yh)mHHW)TVVQmqmT1oA_0l^CwHde1(Gb~I|NTH^NDO#WsED(fH%!on)3um2o zj-2zh^rNO`zLZEl5CZ{tMj#MU#d((ZhrN8zLvm%7dFOYx9}W8LR@$C}nqT~e4cZVkjuE=fH4^;_FQYn-Q5Qzf;vk+S8TAT_X0s%q=V&mC5ww|r`o(PDT z$yT=C>z^KMA0KQFI&BFo5D-{t9VJRjAz3P94WLmgfiHdK&6_X3*)yexQ&Y<0Uf1PA zrJ^W}WfZ0LW+bDNqwRk8*z|{S6xUiSh><5q8%+S^La@$N#zb0UFdEQWu>H&p`-)0U zzADRZSrpEB65bO9VxkZnc@u#}lL=?YWN0fHf?^g@MJf)~I$Qaw^d89zBKC}i(d)#^ zI9lGKsNNqA^D?Wf_s(h#kz^%=V39^iEs1JLA_8XZlij=TpYHCk6AWTx1JFFpwzy=>B^l?<*uJrLMOEY7U4jEVDJi7NyDi&Qvl=YmLQ7#igk{ zd1m&6MBsyS-XKFYEb>8S%8I;)U?mC{hzWo_2kV^yj6lU6fB*#|2Rj%H%c?5N%2ZYf z1n)y-g0oq_HyE7lKK$h9VDIqp{p{>Spp2!Akd%^XW9jOR8!Hzt>Uw+06l@@V+MSz)#7s|TqBU0h_D5Nuw4cvCEt57Z)#Veev7BqHCLf`rSXh(>;TJkC6chftX1k zicu?RCS+jkS6S2bFV?5|L0$n3qTi?4ok_vHBasB?BkRT;b~yj!~Xst~Q* zpLUJ0#tA9+9`6*k|N1w-vYNhdN|45)>+)bg5=sG1uyJN=CyfjcfP@cRI*%ZNH!M65 z1kVJ5iG&alaG>A<0b)KFnv8*5iWn>9iQ`tfdHGhA=Xv`iR91!H91&6FOzF+y+UAzy zvy*n*j5e-bdob(>@)1BIs;M~X^g7EcYqeT(^5|jdZ3+$~N+p6RP{s&A6jSiSv(uWE zL!l!F!L!yZyXU65X-ano6rfKns@LZj6vGZ6|RqS9IjB8gLA;lgNFL_YT}5GaX4Fte6G0Ro^D zGF6;3moy_eC!_)?7(%e#md5+aRL|_+Ms{p{ege@#)U2;w zx?Wps=~#z=cRzgpwkfYh9C)&w(+;r`-b5gz7BK>{OdHLWYd1EZeRl2YrQV=>dFfg+ zN#6UD|4~#n7Q$oft%2Ypq}t+QV{3DD@x^|(Uvv(z^1^E6suaokGE|0TAHmlf%RXjp za|Uk=6{eOKC6y-l5WIKHVPdK~+PD)>WKzx`F`%dz$c6P*`ng~I4W*ml!o&A}B-pKN zU8*I`ys>7F&zvn9%NzFa@F)M{KOB7ZYqeIhxw?5_>-mL+WvvvBYLF&NA5J>Al9&MM zcpYX0B$)dAkNo0C+8L(lYDP~fOML=saN+>TGnkp<562MtnbVx#3Cx{~X%;;ZPoQA# zqGK}g+=4sdDH+BT_7lB@XU-cFs2I0H#tGui>7(ZDDd)?Im|6br@BIT5qmteyG)?Cw z2w=iNoWs|-N&DA4rj+a~s+&XQDI|;O9th4`Y)nCUT2VH(44XyYQ_#a1HjgoLRvZ09 z8u*+DYIKhiter3pv$%L_>ixvGXHxGpyE{NJ*PLs@Y6FZ_{1fHWlu4fy7@?R-1tvW8 z>?(7+OJi)eH#j)hyMOnCPu}^9y*nT0$7k8F?4Pu`eW1%6Q2_?MRfJKrc;%VR z8=rR-)*Jfe&wr_N+#BWtXN&*{5UfB%(QMY%H!d0;yBb1!eKEkAqfrJ}H>CuiMu zo4oUZ{HX1n_dq-xwENkK6Vbup;ql&1C^BCawyGLSE8d6w{k=}N&kTWy7|Oy9yFDSO z$cG09JJz~H$AY1<*7@Kal{OSMcnX3;2<(X*aS#Gf0tFzikb!~+9QBIl(XMNHnKUek!p&Cj%h=2p(D7=nheEEy73)UaK_mivFwnT*iqhXPyNlizp z%m?ci*WdcqFDsq)O@G)ubFMO>awZR^M1jBP&yK*83F+?dnE!>g-k?Yd42in&09-Xu45VlgevPBQ^+V;+Sm$O z0g5=%TBlieki;puaQnTV?tbzyR3Xw4qH3*PxODT@Gp~I9wYR=?ln+VkdZU>%YQt(^ zDifH?a!^(SJ0hyRv##>q3IPg1B92UtgR_ByWdSl$LR6+SwiHN7x{%hFKnmwQGcyw~ z3n`>fQgD(=6(?FLsnuYZ4F*{`ETbr?HygFIjxJ~+C4!Q2VeP`=rK?w7dF4C5`j?vv zOL3YE``x>L@ker4sHo;hc~pUePLtN+YHf9GVPmbv_)CE6Rov5b+ zEDA?4CnJyDIL7#kC?^gUf@e$Bc%>SJy<$>Xdp@rC%rg4fC(f0{00JT*Pj>?|WzJ`l zi_^$^Mg&hvX7K#AMq-~Q;dL6n&g!tllVRqR!kiKIVsie`&GH-(@DxT90F;md7*I(L zVHPOjIT~PM!h9ar$1mYL3Gs8%;ylIlIWn2&(RVUF0YG!P*!dj6^dyM01jPJBW=^5= zO{Pa;ZaPPU!z2YgyYyrWf)nCmbaF8-%)@hzXkv8CxOviOA2it&!qnGtD$jnR`fVQg z$G1DTulo!UGmZF(s3?kVw|{VOu>IhZ2Os>nzw@ZdY=3A5{XPskaXyqxmf2INm@P3x z(bB>K>j*flgs3m-jrFbjcOL8?Zy!AVBot+mHksIm;8_5m0!@Hov{z&h0+5^(q$GJE zHm+Vzn-_*BXT#oUr*lADun!2r5qVbzKp|9Cx=V{IOO3VDvm@&|-}%eGa%t`LlhYq9 ztQ<1lcH~E!QUSt~L;==DCr9PQ7n;|vx3WS1QTsFmTHV}gceCMOx8FHK@+71&-iE5V zw$!)&r$76tvp(zeA{AMbHdKV(dnWG#2q82u5;}oG35kFKiGU;oiO7KjVvNLyEU|Rp zh?P=}Mx6nHNC1FHQY98zOI4AZsu#+_8^clw)PzVvfB5zX|K0!XKVQG`YUlV!`Vi@~ zQEL_TMMTWAJeVR*t{7LbgyrQm(;Jv_$dyMHp3oIuDbYw12q>dmxgmO!L@{t+S20^; z;6MRUL=j5O0jzh9DDhO2+7L!MGEzB-EC7T;sTf&lsMQ-<*9$KSUoiPdqL$c*;#fy< zq&$P*u)4n0SY54M+4#+W=RYV1{?WrvuC85tf9)qf>i&Q2V8FztGS-DaC=ms!5Ilnw zLMxpJ0l-|8x#Kfp!6>}*fUtD=`pS)Gj_yCG&f2zAE*L3QJxz=mf{;<%h~xCat?RG7 z^=tXC{K237O1yX>xeEAw8Jb3hg zBrGqjyWA``mt5X=!(Q-)kfeg;wPmT2jrB|W=22lQLwd2b!AasdC+|S1te54T?$X9Z zbY774Wf@%PXO$UdVUWupHLxHG-t~_jw^pl2#~N5kh-=u2#Zj=vQ%>vw0*@)gFaZi= z5I_<@0}zFHv9W&nT3Lnd`yX_>ox@K*F-HezY`MQ3IirCDl8m($Sh)ZpB=Jgf=|+9+ zMv^Y@w1N0|O&l3U&l0h6OywZ~3m%z3ffzSXKn4h7&#Uq3C#Hep7)yAP^PML%Ckyf{ z1vxSb9xb#20cM@(U?kP%Npr!G?iR+y#?wv{z@Gu=`98Umka|A8oUqO~9_H*Mv(R~( z51$6CGa$!VZ$B6XyW_m~`B)zm6OCRLQet2pcLd@I*)V#DDOo!=$jQKGC^^m7Kk*O~ z>R>L-KIykKM^8`p5tHrGj6im7n+EgNq(c)Gjdxi9h)6NFDp8&02m3LTvn)#+(>cX#{orym{P zeV=+~wfbUScC+EBYj={e4TvPP_pS;Qh=IA5=tgrX1Q#jvRq^P(ccof5I5_>}ogWPk zPc^d-o|sHvOi~o!tkW#U%`2I~2Sx&B@MdB461k*(uwU5YewDrZ!H0gB1siDeYetf+ z3uv8@pWgjs_43tWr(2f&|33Ghe~YZV?D$ch1G?%i@koH4U0HQ(uNXIOgg&t>WyFewZGBr4&Q(Gy*nSj$3>~@(d%FPVyE=) z{^|Frn@1ujA)>gR)S_lHvSnqf9ElLT4djB4B{Bh^LS;ut9I+gO9#gX z@BjGI_V%_nmC1)7qf57LUVHAj!{eQ-SD+W|y~hteee{Qa_&@#9Z~rYNYKw~-&CNCa zxTdqZki}^89VInDqEKlPTFRBptX^H(QOR+wZ^I z5Fxs-espkP`)%iak!Q=T7I|Y#hRi_hU5RM|X+3hB4|+k!0P&+o4_TAYx;Jd+{b6uH z*CJz;1z*=OyNZ~EjKENSdTQfDX`vNXWtDdax#f&Twi^&8tEWH)l!QtEY7PS2D9c7R zuLfs_{gcysKM^1x%e1vs#q1fKQxKFwIp`k!?0Zh4(22bG$}`{it;^5cY%DA#wREC- z;R#rZ@rplQn8&p9l(J)>$v9m{+OlbnzfB-5Gp+JU- zTz3@N)00EwIrN^1nJ1Gr4)La)e4i|nnj{IvPtpWj5a!W^dD;bX($;q#&Bt{?=Rbhy z6v9-gJdf)$mVa(P!EwDzLDtd`?s&{zF4bWs7kkX<+2P^6xNqzGl>^h){>Q#&%O1f>$hHc{)K0o z>E`bK}-1Z$)$P$>;cNg-7%g@`}|8f}Dy5FkX5j5_g^vGd7?-GdX`K7$aF zI2IC&EsS+i2qj5!lEn1~?|%H}OaJq;FMSCB7cOsI*t*`VuZswct-9?_=isn=uuI4n zFJIocbp3^|edFbq-xw6x!-x0!C!LR@A8)_=<3IoXfAaYLr*D4y*Pr|RS6_PL%f+xd ztL=co{_+08%4S+$bi*FGn8~D(zOdFBG8AhG}5-G3?!8sV79%-c^(zWJdTuUylUR+&Vdwlyx+3~^p)-wyM z>upy$SDha1-~I4|G^y?HZKDI>89;VUk94EvJ-J|Ive;Z+?;kwey?-Y!32SL2bsWX5 zl|~w^o%Qy0RT7m*0L+d>)Mycc^A>@!qBz|> zQuKNQtjZdA!6Xq=DFdT-fxRySBV&vp7%1yUE9+`wv%Yy{dGpfJ@UG(xq`YcTRpZMPD)L1@J`vm!|yT zBp}7fnml4A=dO583B}X)@8ckM0;cm~s(FyX&mi}C;(9W2nlkp2dfzA1U1ItMKvV$0 z#G{pZgf;;g#hBlnZUA5wh2tcw9QSCPs-0l6ZTO6SXiAgJE62r1+BKV+(U{NIck!&} z^N2A1d9`0tK6#XCpJn|g?8!M1JHTAg6wc|n&f(uwV>P+(bfYwxlPMCU=N` zz~kfq!>ncWgr|9$f^F`TpKK(70u8g`?Cj+6quY-^e6QHwPgWLG5=<~;eS)0m0E8w$ zfPhj*Qo^WfOb~X^L&6XOVj%AVb#s%0Kq4mvfK+iBU$}CKy)26=Ck)o=SZzLcLpGZ2 z{XN_5vGbAAd1lI;+srP6pyCBk7^L==0DwkKlL=iwiG*Ol1C>Zg3o$y`c~A|07)+N# z>5P>^sVEVFm5jYBklf++&iDW2cb|FbmA~-*q+@DNA|>1Fu~f92o$+!w!f_ru50@xB9+wPdl?y!z~|YcITX<=Tyd z-Mwg0WPaEw3#iUGBO(CnM5LIQy{Sk@)(3MN|`Z!7|80oGux7VAbWU0ZtVxBkZVeEwB2M+f^0M=E z`1rv)|KcAz>q2R2Neu;vP_fG>00@O5^0JCDXFk?i@cZvwmRdN?YxH%B8C@@}U3l$A7F_3y-&V%Hc4u zkhL@sko8V9qC{;N2^iQj1px?3MQJLv3i*&27|2r~fN3=n z&*D;^bZsBEQ<#vi%)m5pXJingZV6-Kj;S~X=7cdLB$)JDpH>0S2*ml-bG*V&#I6&< zm0+Ui!C5pqA}^lQF^$GJ=B_7KpFTZ_2YD>@nIGl!<$3P(Nf??7P;n-=owhMP_n?XT z8v#K6XMgwi=HEX_TTTMWxuH&o+$VCFFcUpZe|iFeaTIln2~j%@ws{gw3IKU$ypwSN z0Du5VL_t&zc<|iWVX~>1lDgwm_p}gb?$~MZE{}INQ?=8aOpYhH^2vucNt91N7o6Sk z6nbYfFxu_SWt4$o)E#*KCUAQ4If8j!sXw;6dP?{^eRd)MgQ76UM<;tb_wRr5QUBq6 z<*oI>xxj%GLLE_98$3C$7_^i^3sO=@sicrNs<}WyApoQ$LMcKBNI{}NA(^0NvrnDf8#Ix2fz1!z4hvsj(XYQ{sFiU*J?>^Gwb!pn0jq#aqES$q#{3HpCgZo zlg8gQ0YKy=02yy9JILF4XV0JQP|-yS$PnpBr%@b7u~rg+$b|qW2giAT@2~x}-->Z< z=jhSL@B9e8w^e!R`sEAPZk-$*+TiZryS=x2`9v zW2A~u>PQ)Dl4j%C7hk-1`Re-S`lV~vo_*n^&wcT$6@17I@2zura9J_zx-#RcFvZY0OGHr|DV+eL@ivN7y_OQH;O$^I=;Wqy0f{2^5(1Ow zI8pT^N+LiG)<_DYuGtKzB`72%HK1T72qcKudFLHMW%7J*c2e}auFNHnl!6$-C`KX# zApy|1LNt@_{Mv6{Tfh12^Up^zI^4UTN*U>3dS_H+T8n31ef68a_S>kNS$1afzAX$e zfj0smFd1K!tt)y(uYGp$ z#^syWUmOcGqc8xxqWU%UFbFMjRT zi!Z5=KYe`fbo=4%{YU-Y zaO?VO>zAGx3{Hx{K&Q2|-UzlV^Q_ida>i(1kuA!iJ3QJQ96k(11}*?mB$XCIA_wmn z1O*;s5oNb@h@SOhypb}?I@@to)fCd={INO)2O zGc6N-5+|nu+&OfcKL7N1X(|VM5}@aTx=9zQ>67w5`@O$EzY!SMBk_1%W^+1&AD-4% zO)ROVPmYe}C$2h0vq`pkT)8wSbDQd(o`CPEVc6`1GmY8Ez~Vd)FsV}-W4o9rwno)R z6V>rJ!!wIw0dbt(m|^hv%%eS-nA|0d6zMY<#;M5&A`{F3J50B8WBzV#mj2a0oO==> zxR7Vn=~;L8@uSC&?(E-vV0v8^SQ=-G!NNi#X|2R@-8rhtJcLRqC8bnKNG%1T#F1!G zFbW~H)Dck_**%YTCjte4DhB1S-??;gb9MF7>gM_{|JHB5@X8nZgW}UqKRMZcq^gnv zIdTNH(OhjTUy2u+rhn%9`z}~QVu1`mOylbNk--JX%2c)-vZ){hCYLl46~!n6{QM?`ONa5B5*?-u>xMvXc`eAWQv0d+5xA+jrmj{vU1Md;hgJ-n@G4g>HBF z-Usje>39F>AN)`M!*~Dj@Biex|8n^Fps6AO;GA9AToFRMa@c4!&JGXHcJCLRHU_6q zGGZJjI*v)YH@@-ZuYCJ23v77r*H>3BZeAv-@}hs?!bRu9%KFmk+IlT*#JaB2tV~V0E zDqEJeTU8}tgg!cwk3J*1N%UMkVpxPwbDpD(rPnt@JJ3QIA@kNmT$fIe5%u; z-S*i~Aw@b;T1SzJFh~)xP@Y`ntpo1$vVP}uI6R4fT~*!r_-B#e)upu%I0RQ~Ef-Z@ z1=DUHX%;RwgF%miz)9U;pimTLB$HNiX^{2%y-w9_bEpuI7~Aia& z)K`|j@U>r9UEL`2LAQT${rML+u3WqQ@w;z-?@w+&`0;z+|NhzbemU&hY&h(l4Z3H; zVK*;_fkRwRGgCki^n)o(Rc7rDj8&-(*&=A_rUw!Fxo2iYkH&*X`Gs>E_VX*TOMrEOIncDt3Q(OM>i_9#7}V1TG<^FxiQUhl;_Q?H#5|!oA@qj|y{XKJ%qt`pDy0OQ@v>~7SYDrhcY3X{%HQ~&65IL{+SV%!b;d@rXtZSxb8 z#yqRyn!nzN$e0;%Ox5g@nysk~)m;7-XX>wUygSk)kJWDz2%YQnFw;B(PPzH<9noBS zN1lxi5k@5W1bTTwr%&%`^tlUQp7lwd=<4R-9QY|%J0CJXwN=!pyU}1U>~(wl`@7o@ z?i@YdVeskliZ60DonqK!+-j_Bn3|EpA+!&5sFaMEnOQKhLImc(zzkA~IEhh6Z%PUQ zQK3-5)0m=QQcT5g*k~-13xD<}f3b6X+UsX~pMHQv4}&8S8&`qA)>iYiue~mkw8-xD z+Z@TbFc}hzj5~-~Nr{nO-&|ikW$IuL!((AcB}UB z;qp=qFaQBKUTG~nEY0!$Vc_F#_uy;a{`!TDXPxy3#E={BNySLPTEBVoxogkAzO((f z-90RZxlHSg_06g(Y_HFu^5n59fxQNyp7C_oEFa*hHEh~tPTG?o?t(B@`iVL>Z#w113@#6iHQ6Qq<%Q}C)@ zYb-Ua=RyC3fQ3%c@w>C<02Lha0N|CVf~W>rk~#zk zKBzcdTDfxf?K{J&_xU%z*lexbxcTDd)hl=IZ+8w4y1g!Qp@q8f+UI}c-~GF5m##19 z)}x(AfBeV4fBg8)x4!vX&s=|X(ChEqy}eeu9<4QRAHChIYatTnJOVR2!S3pf=bwN5 zt(}9N&Z7st;smO~Id()6BNsv-+db}o{L}9Xp@p{yGI$@UNDC<>TMFJAW`Up<7FJi* z>c-~Qm7jj_?!n%pKy>-abz^dGh8H$37;E#60VxaPr4m|Uk$3kW-X#+@uRPZ%t55FS zdGN{GaU}a^$4pGthNB}bMNMmGGa(VR2%}z=&T-%nz<>}^0#U^_Bgg`xGno&k23Xc2 z8RvO!oh4%faV%(Qv9?-|mueEU$_KqpZOyFo3#b^F5Clvk&autpxDs=^IM10hAb?<;)bh@u z$hg5R0FLZH0Ve9D>FZO-;|aGsjdCZ|GF;rBRHEXt0(Y8 zW1@9>QzK)F@m!CGxcPc!?{^4&AE^l=e@0Grx~FXoxk3b zeE1}oKJN-Pf$RCZz^Mnv4Ev^zSYxje5F_ZFHh!3B#KuYbNuqYLN#LnJalN{GN@D;4Xcx#CS#W_|Fab)qDol!0jU ztHkU^UoG>S9W*W zr|q5Pi<|vk@9g-vdvIj(3YdYs(n>3FX>(=k#?3E${aX~`N87u5`$r$X3;D^8GuBj9 zBaO)g8>%WV7yy}SiBd^yjrS&uTzG=#`m+2FfA2rO{S!KPurHN3+&lPR{`-H(9BqGk zyKMKDRXu7oAlOJT8K(sV>0W>1_2%lcKl$z-)R&t?!j|16(py(A9`5b-$eRF3BvhK@ zrG0$w(NDko2QR$woqLZSmA&Iynx36>Y5;7CYtO#4xAXY>|Kg9o{vDkc{Jrn~lrjy}mddteG;24hMW7FL#TzVNDNwR8Az zz(-2RG)jb&N~2n8<9;p;%vIcq~KiftY1Q7;6p&2A7uGQiY>QW_9S}%)%D@$M=*EcRN)fVbe)@knqQ><>RIp;#CYPI^};;IYs>|~cg zS?d{;5D1YJA!1Sl!WKDIT}dt_QB`0DZoOiK?sSiIgkO5|>kk(;j@n1d#MhpAZex9OYxByT58k=- z%*`v8t{21p?)GD;<&|sC4+aAkOuzvJ zC}{(9N^p!op3&PPE2^A>S12#E(o3rg3$+-)_e?nJ_xAdk38T;mh?&`sR(%4Nh=5>$ z0l+gbVyCGx{ zD8{NAMBq`t4Pg!}c$QV3sd`7XqUWJuh6Gcms+s%8`PL0nCV8@+kKl^tUj;m;fSM%} zr-AasOo=B|s6hCH<<`@jDJIxFQ#3un%i^?bY6{5!z<~01e)sRqf!q^1=chjqXS(Wh z8O^7%&i|_OO#l82xj(D5Mg%!iD4$OuoST)|_JSudCr?Rk5G#4na zbJm4`Dvsh<2m~PmAux@;M9zBzZ%S(zt%zNPKI;ct83&HY1zK2MT;ANcbo27-U;FxT zyWJafu3WjfymHZpVEWwzsUE8uO2I*fDwyHcGtVTgrB1hVy#H{}Ic=XDfHmx#KxCpo zp)3n)EqgDdh>|1(vepFeMoCYp&^RL(22RC4{Ifqky!UY^ZF~EE-W%A05^{@mxxBm~ zLg1lJGXy!`=@{Y=fD5IxUNA!PXUFHIzk;Q zrLtjX*zZ==u)egUg(lC;!WCs{OBYB3d*{=J+Pr$@^3CV3-F!}JHSDw{AX9M8qxVWE zspI9P)mX<84Pb~Gb%<+)4bD2Epd{2H350Q)Y;J9_&n5W?)avS{N}Ar~7p~njCT}jZ zR-gG|Yx9OTg)0YAAb@az0|^l&0ni7jga#Cq_oeZOV)S!2?*wpyF{JeiU;O-l!r-)H zoa=Nt1ori>eQopVb0!}s1`a_<;e)cCm?@5BS(UadLO$d`fzcrbW?)k20fKkI7{|*mi5~wN4?WddoX;sxBa6({^N%qd_pWiN(R2~gZ|DXN$ zX9vfdo7V=N-s4C2t+Qmx&i>B+?t}K}VNJ(z+GwBc56%vxj@GX|>pTnx+1cLq;Ap?> zwQVt!07~gVP)}>E#pO6|2q9h3RW6qZB2G!h0VHY_*IO*5^ImBs6?$(gQ#xbFI7v== zQ}nyt_VMxFV_Q*Ud1?8=mNSJAaPiWutlRnEhktT%+S$B%v$oLOyMHh5_o_TM9z0;> zD#K&~I08=u3?Y#5p>nSBq4I14m_P+#MUZ(Ic&=E0kV%|a5@!`TKor6;mChBFHGyie zd}h7AoG1cWdU2N7gML0VUI`^ZBBB&Rfs!B)SRpF_MkIj&g-78Lq`+8?wa$!Kc`mI3 zWK??f!d9!ftaKEJ!l_}|5)<2^IhV&Lum{Cwo}6cn=Sov2FP&>-Fb1JHj&=&FEGEjKX{|8BxHIbrX(k8- zlhA4`eL9cgWCzqQ> zw4(rhauCvN19ncYHP0mwmqpp{_j~Qr_UYcy-h-nD_s{M9pQ3rI88&k)4eN zsYF{(6x^F%|H{JBjeqoC{~4-3GF{iIHIt^4z!HRKd+EwL2V=@(0gS{^lCEFag3?yK z(?RbeAb%#JOD{h6`qzJH*fXK>KF@3~i)9?6y!GtMmc^rc53wqpL^ra|M@??@ww;!kN=nd{9pW&fA;R5{IBi9 zqt&gYOIMy*zjD3m47Gy5-myDr9}~tzoYWU>aG@$GA0~c?e*Z7NTU)<)`SWj~qwfB_Sj#l6)oPIp^vNIou=za(c4&$oATKKGg9-ZE@l3aCg`@alBSbnkFmBR4Iy3Re8T# znM^VPfC0%WU2Lr;=|btfmQh-yP_d5cNiEeRtu+87RTS$ws~WLSVreStioPJPkVTRP zrorh^dw*9%DHD=8yL{;tFva1$5BGO=dztZu);HEKUU{~Eu=^?SwjW{VuW$`^hxm&1CEZN zIhRL)Frt?xInh~wJW(Z`e>}CxJpjzNW|~zgkHd^}=bU@X1Pey5!+An?25&rd#}YgR z)+vuX)e${m0sXXrBQwk2`Q5+&#B1jx%L(azJ_bEUyN}7|8Lmz0clopTFujkd66{G= zX8@S<`xuqg{%hm%Ia*+Bh$6;kHOfJYqF=CP{$L}dEB;Pw$+(_)?$jc zv*;fL&s(FxlqY$59Q>4g@aXzQQT98XGyWu`EmF5?egdlyb<-Lm$7rc z$ol1=LS zSovVXs7j1j>g9`9uRZ_lTfhA6T4QD9!iHz?E&u>Zu--NomoHv_whH*p5C7ubKmF%t zdk?bHz5L`%`k)bkLvyLQu)1~Ql~;fJ-}w)RxvQ!y>t~_JFK=zdabk)=BZ<;TwHj%x zL%E>d{qg;y><^SR;Ki65Runpa4OKood;a>(?s5S<6AByCx^S0@grpi1B*}u zn`^CW^@Y~L!Z*J4Z7tGarxVN&f)T({$S6&gmlxAGO>3>w!_$Mkhewa@y50$ZBWBEuvON$E&rs%9KuQnGJSFT*I zZ(iTs-OdLGS8qPkKIyD(Tu?fG@zqy8_sUm3{OH5&JMU*_N2PUcl*XYTIA|%Eyvc@w z{My>;>gpnMa3H1D&Qw)ZG5bK|L2{G`rGvA0ktHg&WuCX&{o~Ve&}%f)g+{AUuWO-Q2ti0R zx$U23XUCN1QYxWU+FYnL7ePprDu5_VnVH;?V<}zU25*(p5wawUt|C(j)Cxr`D2a3{ zYH068(Gk^9vxy`pS^-(600D_yRSYCDI6rJ3lr{uNE?&R9w7OxdqI+~SJU&2IRo)cA zdm)^Vs3V6IoF!(@KqDIsMnnk2Ca?(<7#t%Dsic-d1P%^3BkFthARLkP-j5u=5M6-W z_-^4krO!M^sdWcy}H4;Aabiv~% z3S-6vD`HZWB4*kcnugBPdf7?vGN;a(!QVKN786SO=d=eLAqP#J)BmOk-zNe4oLmZL z|Hjz?vms4TdX8xp6H10rOwTke#2K>=pS_*=pJ$qNW?(R-?Y7$o``eFhf3)+XKkwcB zz#gCZydd%Le9PllLfusf?*CkRZdxxRJGO=|Uhv zU_?P7Ab?O20kBe_giuic!BVIs`o-V)_6wi;(#0D$7M52xwl3wyoV8B{aa^lMI_tnD1^gfcVP z;H*2?-#>_$Dfi#|vp;Ab?Z!d@(B1dm?wlOldH1J-!`&!q*Z`g&5RYW@-WqQ$S!0=! zG_9wJbv8F80#{`qARVPBwFd^Nq*NRn0tp<6xVb3v&1Y{t_vSCuSC(J-%3H{?%z8`9 zi*c<^%CD@gX8r#0{ZEM@IPa^{S>tRd`+Z*(Qh?Tx)^QZqYPCoyVZ8I!xolW;j*9My zEpunR5K&yK2_YajU=IkT@jz75BB?cnbuJ%p2xLttbE-13h0A-P=&~7r9Y$P1)fX;T z>@^bx!yzDQ780d|;B8S3+wCIDya!bJ(v6#GBf&@x2g9=8ukt}C3hR8y!2zN~hmhM~ ztPKPsUS0t(k36l=0D8ax0#FE{Q3@6igbX^aSeXFc)5zF-BqkjhRR@9q0ze2MnsKxs zxy5EdxEhd-G{rRsPz3J)K?o_Ombjj(t(AqPwbfdqj)2ZOV)PV*1QkUfgp^U16=w%~ ziwnydz~i#uNy+Ji^q!-v5fKQP#W*Q-FI?BRiLB zeDb&ne~OskbUkk`Gh7s z#T0(0AJC*F6g>4YE-izZ`0QL3cf8LKlOl0A7qC9{oKuPU+$@jDhl!mR%nfy-IharU z&g~&^y7`+87pDUK*%og6gP2SgF*)bRyWnhD6#d@dWPfM-?t8m$|3z{Cj_-C|X&gmH z#+6JQNbig-iclGLjsOBmp%cdt$k&=J!5Bqa$vE%!UEY@h%k2YwH)^d+%pb`fjg(u(#dadt|aK_`p7tS$?{|SDc(s zRtUzJ!nc0?J74*Yzt!yzdI#H3R^C*$%o8QrhexOP?+hM3sE+rcXp^f{lAu)0#SJ9M z#Eq4u=IVxw5&}iR63{;#Q7pJ>i=H9#986Vuy-pPX>e3wrTia~aCc#!o6WJxh9X7ofw0o9PJ zfG;B8pIH?*j@MYqd~sD2BtmZBu0; zgjmTCOcLv*<&`9^*V0r->4_JYmx3cxj&h0~2?a`a4qT-rYk@+_H-GupFWh`Z*Wzbi zef3LU|CQ6zvx7$u5rhw(fkYJ5me$s9JhOJ|Ss%AnuHX2|Z~x8B>n|Sn&g9B7H{SYN z^{p=ts9L-6M%xw7fBoh!{r11RymDb-WBs*PzwpxK*M9Wpf8>vj>#eIFfAZ<0JMY** z#}-3h6~cShKNe+I0oOzVh6iWI!;@W?m5)Dte0p%`Z54OyZq z=wwyDa@Knn*s<~qB1#RD2@c331)&5=i=WqYy2iw~pA3VOh zvAUvbwU=LgZDZ}q-8&!k4i1Q<_gq%Nc#yJ*Py>;$O49mbtZP*)o=3M2qbQ`U(MY`tgTSjt2~EJZz0jYvmwO!a9Y zMlaRD)VYcQl@z5)N);Q%ih`CxOO+~Eiexj1S_`cttvi!jn@c5Cq=f)2&{jE-1EI)y zav)Shw#<%>LuFzmxabd$k9Y6gd-%zR4{yKi1+8yhNuqRGbU6oNlXUL1;s_XEWTTG~ z07vCb<2E1T_;?!qj+Rfsv)E^v8bug2zL`|F;A|283=mF*PfuXLERviWL(S)B$Dqd3 zr1TT0I19vi9N*2w=Qtw2@iW7j145kUR#EUM2RwQ6lmwXhQ~z9*_FQZ_moxs1B7DBi zYMKz82-!Y^>qw&_wWrM*BS4tO<4@cc0*)L;rjAz(j35DEmV^8L%eUh&q9ZbyDT3;2x8&l=QAUi!hJ$Ufx(fdED z9^CWYp*MyJI88}K75h+`z=0~m)&T%$2}*gTks~7Lwoew8R_d)*Sqz=cZPCLd!rBsm zAjb?K1S+AO_Y5x5O2^vy0OZTOBB_+B#c51I0N_vl=oX`(HE{f_r}K`y^Wv3T-J`BO>9Vur z86*w%w|l3@m^PEu83gXe3{+%%Qnx&M*WK9KjBfie@$EJC6PLG@Ql#rr@CRL%zGGr=ptCe6fzwp2PYfHDj`tHB{qZA*3 z!Q%|e5{XphJQ7HOQXvWqfe|bKt8_`li&arrTY*F!#c3QN5CJKVjRs?IgJIv>B8Zq! zN+E6aed zzgJI_A|GB*$<}kX_WSvbSH2We^5Hwh?#`$G;6M65EiAQm_Z}sU#@>GK<4*>?-FMn= zziW<jXrB1v>%4`^p88Th7B!2-sX- z-P*d)K00aVJt;UKl8ls63{h5Ql^<#qD=k%m;J~;XrD`@;C|K}Ta0uj43YN+<%GOfc zYd` zI2@$Dr6MrH%!eR_M_tz|YmQvhY$=txYG|vjvK3aP22w3y8J%U`*=09CW2CbTN{sp$ z6GR+1hXK(zyQP{xH!>(7>J$sz|>0B*6PaEr7I@S zt9}Q(RZ-j-X6{a2Mm=pNs$~>R<2Xo+lfzS%aIt%Y7$B9Yp(A39sn$n*4i5ztULiszt z`}gPbr#x}jn0Q5rx#2!F+CLX<0(>_7o$|QjR!y^J$)D9SKcQ$EKPl!j>2svV6Nq`f zH}o__JugC@gTv8>K1l=5e~1$)-qg`$F1DT3Tu<`vW~=H%ik<44$gI zDEgSq?UU`hySLvz{P6AU!EN8oOzC`ZP_J>VSuz;l5L_sSrtXrRg~m|aa0a-5J9Mf z0GzYIh10|13s=_u!~f(zjpMa;=j7|({N@+G`s>50XrCM;q9%X=yplRqIzl{n{9tIh z2e&^i_jja}jfK@Xt_{wPyT`jKUWjUoQN3POw#YLx803S2$p${_xUxsVfVUDu#KB}) zb9F=4mkxLC_YV)NLEheboSz-nlXzjVWwSnT`^vMoWT@4XR4Jh%{>E?p)fd0|E38_F zI}ZbLsMkZB^sDk~zxivgfAufz@1LFR9qsQPJ~%n+J0ccDNCA`}1d<4X2{{n?K(_Lw zluk!dB{fiyM-fnYp+KmlmI|#|pooL5BtpT=L}Z=yBxGE>_TtNHS8ndz zdB4m~Z@&22;qK0-AAY}o|6`G7S)Rv99LG^CHQ6F?*y|r|T)TYz)(ib?P*C~&E3bb3 zwO5xDY9-~HU;feyue`Fnw6yc!(f7Xp_ReARxLd2r8-Moy`-i;qK9V%ZvbEaVxf^=h z&80B53e8$K8xOi^SIjFh3)TmT)1K!^&# zLZ|`@4}e4xMIef_(n$&^6$&MVR!XYKQ}95QbBV;Ns16@(=e;(0u#WrPcK__~;hm2k z+ef>C($zYHVC24B4w(g!BX6B|oFP6Ao_Q7+r4lFv69SPn)#lafm##fa6t-^M zlyUO#qxXtlhaIu=KtTa14&`v*Z6F3M)rE@}z4gPQGz7pw2C@C%;hno5p^_?!bR26P zP1aFyJ_HYhjn&r#4g#kXn7`pNMg;tA(Iw~fHL z6MQz@eR7(n=91%F@wk7%gzFt&1jfZgGd28Fk9PiilNf(oLO%EG1XagG>zu)U0JZ#^2r+x3E(|bQ_-?^Lb9-3hujPn2?PW9qN zpVpm-I9Olwzz3#)C{PH26h&fbV{>W!k_a-C!&<#wcKd_l!@S$p5|gARSXEUXs$2mm zsg#yNA_}1uB6;h`g>k>Is8+|g?wqfx5&}e8eeK(C-F)TEqvNwr-~HZ&wS}~~`uOp7 zcG|9sD30XP(n=cDf-5zUALjd?d|=Mb*m$jD0ay+C<*;Wf7ot=(VnECbTV{O)z@9>t zfwKyMOnLd4=LJYfHqVM)=g?I{KNyO9*gM!6WWCCTdLkpOOm2#^qYIa>6q$22EN^Vp z>XB6O;P{~GpOLLLZ(V=mH~(6F<8ov9!tM9(WP=maFSb8;_x|qV!^)CM9m)XY$qNdC zd9)4*$wEcC(Rk_WUv~j)HPBjXDR{IZhrofDKnM}(NDFc8+SThfu44$XQi8w{+47Xl zP$H$Rg{0Z)_qz4w%HqbR$+}FCwiZFh*Pnat>%aNed&B(Rr?>Y$`2eiV$}+F2!nr_z zLNJF$4Q{>o3OhL2*=e7gJ^u9e!}s5no`>16DuXjrm8CV-6xG9f_qJZR{?;%4`r7J+ zm9_P&H*SDX2M7D_zxU2NKl~FR-Jl5n%m45{{qaBg!=uNY)f-=4*n08N{dd|Q{v+-j z5hE2<`@s+M{daFXbK}LYey7vzRGkxGs<##!8&?Ki_A0Zow))I#U&y`og;9}wyS+F~TB|F`LSu1h#aBL9v%YyzOSQPNws!GqYk6~FoY{ocvI$5#LdOcrPZaP$jTzGJYBr`{8zs9OKY1Khr_|q(b2HmG1-Z$hMtg#$p;|f zVDr3Jmeyk}2<<{J&UxYx$cK?}Cla9zU>p>dtz&12y%!W9pcFDf625f72hg74#)XY% zUVe=|^p1`?`-h#Q6VuIYmgi;eoblc}>um_eTNeVea732aBRF8kYymu=gz2h;jYMoL zHkMkAW~vjmbrF^lwcKc2ynf^Q^RHIcf9)5)^V*lce)p5NUB8>u79?;Yf>c7MwGdo| z(&@(1##VE2#o8d!dShX+cY25%(nzy+QmaT)AYYg;==QpYk3aq3T~j&TsCn;3{T8$m z6r6XS5p|RRcqSrCwe`)Vi&qGPA?r$8o%Orj&c}D&t!#N=>sk`UqqvZPCV95$A}tV* zk;j?d^DDlXEY_p!ahRqi$NkZttWBEGsIw;UGxw=ku5W7C@iZcLQX?~=SI-xx&SCHb zHt{LvnNZ|&knogam}e34x$7gVsk0MJ?q{sBo^avw@bpAS`nlkp&x7ie1DH_iGokip z!1m|meJ716=3t%)Mt&(`cAazL?9qGXE1*V2K|DEZJXoBioF`2kXQpN2Z13F0fX|KN zi9O6zLohxb=fvq_3HRJqXu1hP??aIf&kpu_5AKvlyTg;?s-OExLXeEiQKVKc$i})> zN>^p5IvAX1MyZ8L0#Q8?Qh^{7Co1Hqq_kz04^Bz!nWJ2F5dv@Z=}P|mQe$W}sOt-k3!XYCWA6bb}ccVr^100Oxp zsnu8NX?b!KTm|eF6J3-=|M9`q8!x2KJ{#2*JWKm8Lau`p^N zR2swColgSGvhvH9wywVR#+SeGod13_`wO{%YU~WA7?AN~i>mR-U&d%LWG{e&Rg_|#aK0Dhz-oF<$7OuVWDx-XS|KafD z=+^6R)EYOtCnwclXl!0f>PoewS_s5CS&ZWls%rnygOh{pA}>Gq$&dO&Bx_JAwXj?b z^5L*Af{l!0fZ%+=2tq^@ge3^1Br2qlp^+5QGdLngAcPQ1O7LZ;UhtIxkcD(xNb?cKj4 z3YWw>8@4fxpjN+k{}V3rSZNS6PQC%>-Lqnld1HIFNRxDV%Uzrs3t^IN|_!T;g^@ZZ_2?Cu_jL;NRq?z+l;>1*GPb>zJd z!AYf(xR%6897jS-3p(Y*Fk=Q+IF|B`xM&0(S1}PH^2B5b5C8%^DSGC4{|%TX8>dV4 zv~`0Vb=y0Kky9=1G|M;wWSk-wPozRmU;Agnm?7bO$TtrWb8Q*NX9fn4zw>*4e+qbW zF*Khmnwd-!&IR;1L9Nf~v?f3^{}j$*OqkNV@Yy#`2Qz)!{7;B5D$hk2Zx$wz{&){F zFJ{KMAI|?ZQi_jnf(1;-3ZACk$J?Xxd!jL#3Ox5A&QAc3_IWc}<@^R>7CbY6Dczvc zKH7WGz5jtbJ2J))Y4SMgsEN(RXk}9`u3)4?HBjUW&eQB6cqw6I*3 z1$kqN%=Efu*cZT&j-^t8e5gt_*;f$-A1DORBcCk-2f{Hpg8KU9C|xU!De~U6XDy(=0^4U|!WeyOI|l>Oram!Ar6YEh%66D)`Inyj~4^@S#R zE>4dVq=m%=B{degC^|gs#U__kQS^JH>#%g?!V527di8au;=-8SPw(~*_7#bUME`8J zGaMY5fLgu!`s*S}dwF3z5kezL(p0t<7m~EDwA2W_!#xQu0_n1WHKmSfwOYfKxvvJ! zS2w=&=1XsV{nf91D{ieGKDg@#XPT`7ij+Nb2_K{{G=M6Kg4k{Z2LP zw@;2g_}P!n4iC)GlzFys`O=N&Ub%2#i=5B0E`qB?VxhSrqUOaL*S#^W8d%VUqcS(n zv(S+XK}V{-u&{7(!z)QZx1N9L&%XQJfAZh{mwP)Oa1EALF5dp+{(C?CG3_6hhX<6m zS8u)i+OPgjt##}D@BQP4KmLD^%WI8RT5kfn3+wA~8s)zK`Y(K^v3BL|Cm-5jVXg1B z`*}r5sx+zX?>stwa4(d_;=*#j-HyP4GsUncg0D4O3mex^q8lED%J|?EVyoU{KpO%e z1g11e0chpY#r3UAhuhoP@!r)-*Q9_!zaLNp3aJ)aXlqTQS!>i6^I?DE!i8cm2)Yiw zIqdE)tSq(9I>T-U03Lt*0a9qJEDzde+3A545PTI0Aq5NvC&mmAN*$+htz`g`FL=;mb<*y*1R%ABNZEw6)&2SpZy zuz`tL2*C(KN+HB#(sV73Ktesyi*ZdbkPpU&zyeTtXB^Wow}auZaKjJ3_Xpj_kJ&Pj zU)s2^yt(xJ7rxxsxcJf=Z(i8EwEf_=v(>H7zxLdlUs$_%dF%3ZsiUeYJ$VAHl_Z-d zv5qAHBg;rD>8t$g;Ln*Dl<;@!V@~?(S}{Z>&H2-184_ zf7ChHwq;gdSV>fJ|D$&;*-t-x{|A5iPv8FGpM3JsPqrW4>Gax3TCb-~Atjz$)ERNq zs$m{?W@4r}KjBG;G>6+yxJ;aHTsxsKXN)(@ggl=?n>qBIuK9Co`#GNW+&j-x-+&V$ zdM;9Xa#Zjn?%{-jp2EU8Quw?f6`#XRobN3#8^=W2_Ec_ta+{N#&v}qNhrSaOADwDq zW-(IW&yof+_@5N=o}&RqRJDLBa*ZUpe;E6C`*D~;)AdDiauK~9haPKcEUNlNR*HMO*=>P;ynR^F9nm={v3q}~!z z0hvgIq~64&E|VGvp;crCxzBo0)KF2%A)qgW%|-B|@%i9K9Z)C)Ch!aar2{F1Vo;zW zoz@0}qeS`t-T(gYEN|ZWi$DF-kAM8<+2idPNCC%^IZ)Q=YoY3O?Tuet-DobXAKiPH z9c{C71V~bg`l6SK^@|onL+Rt6!-vtR6gm zxcBk<4}SRlgHJwU>&b@Uuyc|PPYSbnaqFcQKYx65(i?R1s;EWk(n7k}NVSduAyHZ> z5heB3;(Ffen_*8NOBLl=W~xFawWTXpfBE11x1ayQw;n&A|)@E=pqWgw2D^-JlZ&M+!NvuNu$gu&tE{#*;Ja*KV%fd?|`*cF;#+4y>q5 zlgJ0_$RQRUln;s`AfxtyE9;!8Fi`vO;PHb`;s|PK?eOuv z;n{Jprje+H#br}ghwC5mW_O5>>z@vqfo8=7a@7#iAVby(bPVN*0A< z<6<Zv#R!m+P zH|2SXb@G#E<;mew&huQWW5f}b$lv+9e{Y72Q_0ncpPmDx37$`UxSp1{ogkBdN$`ID z&cr+(O~uMl5gzfrni5^du&Ivt;6?6EwHBw^BwXukGq0?(tfPh#Qmy-bBvv!~AO zXGS;w1a$JmE^SO+3wZKd0FQOub$^FY?CXqKY*80Ny1@k~Uhb>v5VcEUyTa=G~rF+*;lUEWE9t%B0Vkf<#0B zVwOrx9AepnFrXbuDO8fyVgP?i2wnW995PuGKav3S_&bMyS)yw)iTz)4np;Z{cA70 zP+!`-^U(*L(=$_6&J^`jZC<(jmEZi$fBQfF-4giD$M0Ob@nWsER!>?#{Nq17eEi_8 z@BH${){Xbyc{fyMWo7Nrhd+#@Y;Iif!S%a`5TE^9|G{7X_AmVUrDt#5y7BqD4?f+y zciZ+#Pf$59CJfqVAyB)Mwa*UFR|u?;5D1Y30a5U-G{yz*t+gCRYlv%YUaGBbcxRQ% zQ3xAUsLJ52_a#C=p`}O{7ZOho9>cety7y`20#rUfJ}^bL zyt(z@?nlO&W@};p!M*lrzrJ~;x!ij8mCu*M?&-lE#A#IwZIJ~EwdIv)anpF{WkVMy zt&L5Auyyl!jH9aG1!h~8-j~J{CyyUJeE*ZOkSG#g4Q*Kvh~{Fe9GsQi0R+Wfq;Wls z>%IsNZ{I#V+1a{&b7gs5Ocv)+&oqJ4)s`ob7fuU`1&@Emxs>6|F=8gPnemOEwdEKA z5>N2!99TUOBOyEu)&M5uK(oB$B=tE9b{Xe>KGz){r)NIrWHGvB7|E+i9Qfm3fxd7t-27APQBkfTT<~uCYvH5;Yc=5k)yX zTU=X77uSi1Y$1HbBg5bErt$yJ*nb9Fc3o$J;M(Tc>+kb6UwULBk?@`XNf7j+MA1l; zSBa{UDne4IMNz7b=$e>`sG0uLGZWL%T`}EN(a}9I>M|;gT2&=chNLKf@GdivNTh$> zU4QSf+pRr6?lbo#!0CAbAm6+1-gEZe2f4rft@W*M5l$JRL4yDktyRDjVG2#LS_w;4 zm8I1Z|MlPg&9nDEb?467`>*{_tleT@EfPQ=#(-2FC*=b57%7Kk4|Rc>LJ;J+8b5wt zb>>7+snf6s%&*qR=1!f;MNYV@l>s9_M;sJ5u0)KZEE!~Ju2X3+_3q zPkiaC&4I|`LA$%#>ko=VJ^j?<^~uHcyElE6PKRvT=OykVp;8;I4fjLpl?ZpGQdyi@ zOVBbYGD3(0K$Q^PcGlP)tlhMiWMXT7w{!(h7;gfHH>?mr>Voiq#3? zI@VeW=(-$$fTh|11#qcFji}IZyt$=QgmIC@U}U?~+u7Y-zjIqenG_nV<(%Y6>(S>v zQJ+2DZEvsNyuQ8BMOq<%X>X8b^v<1Ix9?oLaPh(;k3JqH-JOlqfb!n%PLwph@*BVM z8-MsOrlwE!qQSdwy;}3VEKWXn=j~|Fl``)~v9dY{14}8Q&Id6V@E8ewZYUMj%_I`a znHQo#2G--AH4@NDWzsb7H#U>q4UGFzNM5XK>!fK;7&BUf&Y4lqeEvm|M=WjM|HvZ* zk!S(NI=-vWSc67pR4GabW!&{V9+sv~pPF7eJ+*Z9=`Vlz*)M&S1@4vCe&krp2A$U0 zEuyvWxhC!Bsp@5>Sg%zkXAo!<$CD?{KJwfPTC2v^nvvF6W{kF|wehkjNwQRl%xXoz z8pZ^HOi3+ssZd*@(HPK%0CimAxWK&(A=5@0ZLCEL)`GF90fdFzS_MP`XA4(;K$SLCvcc?WM zjn8O}lMsyWc#h*)y5}y;0MJ_NIpv9ZZLC)HdD7ldY3v6c4?^OVUDvP8jy?OiFG#I3 zWl&Q>$j-*HLrBtUwmQ3oYVCt7m#O1xsc&6<_x?v7X56k_zq)+&-9fu8l-5dtQuXQS ziNzBlH)+(XO-!7B^6@hdK6LByTOc&|OCs%uf$RH0((Z2EzNw-C&&}AxY@t?eHa3j4 zN=PpVWiF{Tlv5!LA_c}5?|aY-i>tS92y2d=JZrQ~;#f+FM?$j0pd%V`0G4|oJ!Ff+ zq~l@Fnh{cakH(4|RC#_3f{rM24{&<_;C$M*2O2k7-Nbbe$2AJ4$|XyO5O9?6f6&iLS5KtARYhpF#y+8!1-jhwU&OtOZlWO6v`;SlaMM$xlpiRWstSwBjnKC!k~u5!oM#^iZ|Mi^rZ zqT_}<3`?~-Aw=d$xmqLKlQMTKuwm$4DPzDQFH#O269p;B=!N|O^|xk{;{0e~yl zaotMjRjZWxU=&&*bad?WiTSe+b>nm}kcrR(VKQXW5@DP5NVVUTK1PMUm&-^<~-KHgV4(@v(EK*H*h)=!N5_-hJoIPIKk>@x^YZ zr;>ifhhh*2t+C%4#!v;mr;+&8>eqhjca|e%vAPlFbXSw6LVbK6V zrN97E!ZdAC#_ug{zs8?Rbpys)&nvA%x$df-A>E% zgF>;+nPZg9^T-m=+6?;LsJ)x^I{jXM(C;gwbEyYOmKc*tRdt}i&Divm9Ecab`ZFgU zed5Xw|0WE*Y>+lvgWcYMqBK$>0wJ6cM!N;JwM5}=$pegKS1rIgmj7&O)(XasFR0T>|Kf(C*>l?4IN zZFN>ZxZK{|$dVM1NQF{sWzc#)c%@wA#403Kp-r`pgwd8DWu70nu4e)I{azZU6bK`f zSj!34n5{7C5Qh`S90weaQpzboV>E-uzVM|leDfDemD>8Xw`43C_qi7o$EGG0Pczq# zl15l60^gA6S zTp(1Rf*Ecs-I{i+rq>{r0 zM*u?D(2x>`HNbQq*eD!k3P))b9;AeiAk(N*(+Je;@mD(xqK?KbEgpnYKQ08lPkqT~ zgS#V2t3!d*J|-X0Y#+hnBhqk+b|}KKhtt?oW&Z>t4|3G{>LUO@Qf2&+Z1Yhx8V$%F z8R5YPN2-{PI5yvNSQ$Q>;fU>i3}d7Ue6(G{fkpFZQPE+M(+J@oD&G#CI2pa+-ZJhF z@}Mi?XpWbREHvy#)Q1t51Ij!+198r|<8bC_ZTp#sdM%kG)Cp)%K+lt?qkd1N5hpe% zl?|stE2Xqm(gFg=La9`!)kbihvl~hTVHg_C~gmaUpDv1peZHz&^SLRPBVH7AO zjsuQMffyyTsIQgmb_X|auiUtP{pNeG4p!Hxp_EW!DPf#2N{9c?A=ko45owtcL@jih z%5JyaY419m#m#P^K&oSPLh&elD}Tx4p@%EtV?G;Y!Oy=}b$bMV$62SSgLR#1Q`Y^Uwal zKmWfBBzCqph}J4sQkZVDvwGuJd#jlb`g8Z6{mjpO^()`}#uLvzQ>zy|mnL!l`tse) zt+nxTDeCq&SFe2HtDpZz-~AVN);7QYy+65i_rvoKTzvAePc0rhdHU=F^Jh+d=F?w& z_UX?&{?zjif8vGWME#kkKE2i0-MoF%^et&PoUt;SrodiA~L&1O$cMm7>tu7iDQ-J#3HqZq7Fe;IH816LOh2PN`SJVwginK z4*BvgeCwGPzO-`p=9}ODE6|j=A$WmTse$J|@R?7ac<|!-@?Di1jXH{x-gcu{9qa9G zXT2^Er`6s~v*h~K_czw==9%cWTAkgUcC)K3Ro2X$I1yCFQX$X}k(1AS?WdhmWnyk& zb7MWp)W*uP1BSa{Kh9FAh!HO51dU2#0FY9pX~e1X&@-RRv&`Wx^W7xsX^F$a2a9&l zZx8w%#@#GVnrpYVSC=>Mt~S=U?%ep`_Vvpvw?Ej~UT?Oxg%ZU=nY->VCAk+V-FJ{4 z!hk*4IbqM^>EMf!BT3PZ(p4bV9@)b0#aQ^5*AGGBW4t;>VCAEtpQCj15RmtWcMzr~ z9PE(w+tJ3rKOq%;5cMV_)>lW2MC`uJ%e?~{@yt4`(mE`k+8^BE*~G%If#4nxl7mtv zVh=(S0Q(vFJt6ddh0=&h?!dL19ELXz+DP4d0vP@7Xpmyq8)@{2WcNpPG+1yi{T+ef zBj*vjZ?*;Cc}}5JD3`Sfmt#g0H2@6NyG^Y0%>C&E?MR zb+yincTTI+te^3YQc&!0Yf`_5fMs6sRrkTPI&=y>e%poh-wUdr3aWSLLZSTBWs zmOOlX{`^y)xqbcS-M8Q9_IvqY$MZZTjLwy1Jl=_m$GKMv!)mEEKHaL%ZEx=Q)E2|y zU?4=E7l3o0_8S{UYblfvf;n!%^~=>sw_Lk^_5DH+Zs%!j#((^CpMB@0A6>ig`my7) zitn0MudS4hqbyGq8qI=mY-+00=}An#^vz#eTfVjV z-Wv+Jkw6Io2kNpsj=%czKl8b-{(7_7NCs`4)&An&{tw^&tzSR)WllGlkswvj*+tx(`q5hS`a6Fc$8lqG*Y`Zg%uHBL``cL( zp)pkD1i@sE83wy*!^*eW9dE`xT#5C#KexSD3X|fBfp)=`$~W=Icf{T1rAG zwXojot~FA>ax#yTEa_0@awBNUxa(1!`;`h8@t8Ya_t|!5J8kcjCre>C9t68w#6Z!Y z^%=Fqp}b@frOI=WQOpKPWtvD!EHJ`2<1Tf$L6c^Q%RS1OrBqq81d#4`?HM8h0c%0; z8CMZyNe1Af1Rc zm&YgSfBq-`BUjMx4<3K^xj(yhW#i_xWVh)t-b(smWsbAL*2-qNSDFNv%U4yvoF@i7GM4GE3Mt_ul?e;AdhvwAEo*9#FSOy?i()`{UW7M z@IwTmb3vG!$b5Hg4Ww`Y9(dyE<(oI|T)O0W0dYv+^0?hD*6LGB$1@>hmQ;)Nq~GsF z&9GeA`tZh}u~8ozo0yv}PftGg<)1(Iz~iNI#bw+A?(JC?kdk3@V+I86o^X1Ru=sNv0n7Ssf`D9kpoO^E~{Ra^VBX)E@5J19L4q0*FTtaCEC5jrx-PoazWnSoVkC z{iD77@P6U*;q68)I|@-p=r$aoeFsrv_}}|Fv_Kin6cc;czy2Uie5gM^(8L|gj2y`t z?2ml^ij-J#;N85xK%<0rB(8i|PPQ+9KZ?nR^5^{u@O>@c(HQyB)u1D+m;8ifVT2fj zXpl6U+dFG_RCC*}R7tTy9Y>}j9YmO?F6YDxoFKH!)maW;31Qsxi&L|uu?g4n2|^kt zgH|)`G(LPeg0#iAdMQDD@fB_ODa=xQy!atWZ|urTiT3FX|aM2S{8$Sen9 zk=iU#twyuCyRp4~H;xixi2+L-$8wJVEjfH{vNln6Ll-P}+lkp7h;AZ?>+P;@-hB7X z?bTaJzndg+nhWCcV*Do)~w=?M{uO0{ORElkcP=%tNKMy*I<5Q0jnh0tiZUqIptW2IERRwM5= zh)4j@$PA36mLPF~J7G|AU6%qdN(;4`UnsP9c2`zzE}cBPvA$WU)S@I&S}@KO1y-Ld zPahYA)W&L?>uayQ_R5vZ?`=1BkXYCAipApk#?}W{F2}nKfrH(4=lg&0XA{*rXD+vV zV`KTx{>}gN@(=#(+FS2lf8)w4fAzPmwVi&u9rb$O|IdHcxO+!LxiOj$DwVR9G}d?D z`2P2rt9OX8z{0RrFV`kT7HgdXq8+*^T4WZL(z%p?Vs2v0Bb*!KQ>F9Bw-N_!m8OhP zf|{v>Sz{m|wJ{cij_01gc=q!@`zwhO>vwK)G`HS;J(Inl;CCC_VDY`nZ@>5Ydpp;c zlg3(<^=!#g1Sq41pw?M7==B?0dDQLfZnrj;TbpYZskNRkR9i)@0xgX(+!{(PcYWXU z!XOA-?l2-W^psI(Eg{5p!eU`&a@zNOX@nDmrAiGgrg=W>I0S?o>Rt)42TksQ5K0&z zwaO3>#wY}dfB?iwtqmfvU=b{1Jkq3_XQ>j#7&KbT9A(C=av22F2AuocbtrWx^|`}5 z9~eVp5U^AXD?uPN0`S$9)vIs4xqb6)0jLY$Fs`I}=-Fpvo@tfDS)BCa-k^VS>11PL z<%3s#NQBZN1r*xaZmwb>i`AM=ZM z{>>YAXBLkgJHGJ2dzXxb$3FYw=fC>3v5CpoU-}UkWP~yT4oC*Zpm8V++RZR??cI$vW>T8O#x0crT{z39mjBbJcSv5&ZVjOL|}2LAVEKYa4TE{mg2`Xkwe z!(8x3(U%fJkAm^&0c}K|MF6anrrYhVuHM?c@jgUdr!r=!Ym8P&A_iS8a^LlN=sJZ0 z;e|YjKnYGTCuBBS#f6Eb zGe}sHB#z@+%KC98tm`-XFnMf>YbJ4?#6Cud{P_fdG;&6_1ly8J$iR@tJP>|%TvSR+!{ly z0gHqX>U!Sf(#Z!u|FaINQr;fKsYs<&2-;|og9K2 zmNG(QE;NB$3hub1T&vA5)k>8cSKkYKZ+de6;zN&o@u$Ce>GJ!3|JQ#}D_1vGS38@V z-PU03`o@QEUCKML!~E@ytvlD>zkc<4V|l#^Xw;>CwP@#d?q zcUCuug(3YiXt?Wh%2bk}v;+y`q);nYre`c+auBI3AC^lPLN$UCIk6aWIbJPS%XKSa zrUkd$^U7J8=fVJ5iwd=+)RV>xgmQ!M$xpvnm|1G~dh2&@#ewB`mH}G&7TOz7EfM$Vs&-Z|Sn?yNr2=mJ#q7VE_h+(pnp101&M-R$9oBNU)j^Lr6!OPL>-)isvN zoz>;Ly*%>*KP;4d$D?GwRq&D8S9^%fqrums;pGv6c!)Xs zfHS0__W!E30TA1RNcKTo^&`-B0JYWcdw?5!1 zXXSdLOeWH}-_}V)DR+X9`Mw{P03nSd$W!L9(&S`qdL}GZt+i5QGEX?;Mrp_4Adx8P z5X;D(+Zv%1twEyzr2!nSpq3heDQ$*zGFs#&k5DEQHDj)|+z(1TC|JkK5L&$!v&wUs zMU=TfYk_j)VU9tPipp%cI6j^BBdGE#FMT`bbF1py9EN} zVyU^)JbVBBlP6B!U0!y9PRz^?l6dv@^}wTxC(rtR!6mGHQi@7>j)RsYnMk`G3kbeX90!?;1PCKx;8zHB(N0W_ z%YN4g?HJ|yj-)PgJ&M{PfL=L8CRFbEB{wY978WWqv+Y4MiX)TD&~wM<7L|d`<<-{C z&dSZ}{jHs}*`GeW_=#_R{Zn81%F?kj8Z34EPN%=Qv*CH38y15~J*bZPDb zZ6u<#$S81P87dCOrNrl6KzT@s2jCL)9pZBqa_$o9fb}R4gGNd;idaJ}QbH^uB2a4? zSjXi$lf-b}2`46IH`lLIk2`*8dTL?!&Ye6>lmX@zp83+(Ha6BbZrPN1 z6EA*Y>CCyOKJn?LQ>Pz%=;F%ll{;7OCf#PU*;wD$oIQ5pH~-0Rzxm@I5DJVyzq^&E z@zpn9z5L@>h_(dHkl&yMAd~|*e&AQfTe}U%b02v6+1>Sx&e{qwXp|Xd#yJJ6Ff3K5 z!<(zOWfVKa!?b78KFFM-1tp2rRw~^cByrT}cM)`{I_`QNWrP5*{n+in9&HJH?6!K; zgleC`9U{d+(DevH?F*y-e`D5Y;&n8vOz%-|4MU$tBtZwBmj^hrUj)s*^W8t*Z|*c= zcCq&+x+nh{K^NE~=7$nx0(B8L@=M|P z!ot|}0su?1SY$b9>+p~QSPLqRKqSMH!%+M;EU6fp&k({GbB6~k&baS#N`Q0Ub$l%o zVg#qubv?#i?r`oo3av(?wX}ddEI47=Dudb(FDOng_2XC*Ewt`-+u0yyjB>w1n1{fb z<8#NgS|Pz)N|8z>GAUA}q(Pmd)u`vEDyQZb>eF+s>t>xM(^)Pu!@bhPyhY0y3;mD~ zo~Ieb{LxQ5*VyUotll_t@#2Z|7itqz-JLC!B-RYgYK;^*B7(Kn*tk3B>}-oHMN85o z(L$ghacW%O8y~A`O;ieDSSr=WJcp%2K3(vMe`RTSTzN+U2{;$)M*l$~g1<&~uzK7cV~h;^!Sd;2wYB#TQ+# zn3(kP`)?*0Y4zAkKlpxQ_0Hzz=7%3#*O{Ls0FdWzyfMxkrCo@?s8fQd8H6kOQoXk1E55k7$Y=Ft$~2YfT9i1Z5$LY@ca@=lcsTrl^@yYq~7r*$kU*B0@Szo?BIWckN z@|E}Bd@F6W@?NV{Dn0z%r#|u7&)$6hoqzW~{mZ-8t|tBd+Kt;=ckc9>yQr`fR74g5 zNFZE;r-4vZ%%N^j8ed$>l1N0|zz_P3rb!}Bs8I^6^}LW!lk^&Kx2L5PgMrF(5%p|5 zU`jHXd4PZv4RA_8iB4l@YxS;R#4i>Lg_6TK0@ytn%YK*^4pV{mxKxc0Q*An$|DVK#I$$a|PbK5V6XG$Kk4^tB6BOq{CcQg{y z-Di-8-HS$$W^~GXxz~F#o%g;4_7r3E5YY}+k$mL8uy2_%JQI*n(B3~LjAYfxJ;ssy z@@9I-T}P6>hh+a?YzLn`c*6*!A4c8xk3ajOy3vEkkkRgi84kR-4jj(*vIU6ND5a!O zLP)7aE_$8r_V(tT+t+&QE79oHv>B0-&{s<){`On~j{=Z6t6O9|!FWyH0F8f!S^Mc?-v%9yQBEryk2 zih-r*062^hAj5vE6fLzFcn){GuvnwiGiY5N5XPm>f`Cq+SeTeORw&njd08)~V8IK4 zxz-q&r^S+U;>2l@q)F7$d2Y2bMoX&%YR=eH#ao;i17oNb{oM`JN+Z$AW^qid2`HbK znWlc|hb57zcV2mIcjfkY$@$tp`c3PUF1`A4+};U`h0^$#<9iN=iK%JFFDR`L9nK3D zjW$L}X|$0Vogkbzeu{f;=(!6g?n|T0nk;abNE4L`6q0e4Mse03=p=DH&r;HEG#TNw zu}Pp1^}1o9B$XY+eb;w;jmFg6H7>pNdfaGBq;n5_72K0+H{Wip-0rrTjm=Hpg~vYee4##d_5F8CV`J;v z+bi#1O`0vxnxO$LN)wfEVq9wb^b4PR?D-eAw{~ovFaj2>Rtl|kTn_;WXH)YF6Z4Dx zWRPbjL#?e}(jZju8qlskYjFpl!LkmclAuu51 zfv29m_~2vhPAf|Ktxli&#d8-QT-#c`^6oo2&neM>$}(<(!qR7qA1J~lNsH$GM!FV#Gt#A0p?0A-9+d_F%`pD0zvf@;}e zMP^+JoKfz$1PEmmtmV`x*TxE!iWFKKw1jf*BQRsZSSS=i#z_(-j5{u6#8S|TaU2ZV zj$cAb+uPfh{_bz1W~)4NjCzjFvreZqi2G9H)Pi5A%%8pR*e5?-E*6)sU0J(%V{`d- zHi&x7R(E&JcLR;)%=wFNzxLAK{`sG(D5=%POVx48-1_YNH@^LwNj%uPbJr-PM1s_@ z#2HpIDj}0za`OB`c^Yrtx^D7BWf^6zu@cm7xu0sw?sD>zZ;DllEAV^CNenkKXd;|iIRKAR48ws(5?)TmswPYUtdC(1Mw8VLo zu8sB%{7KcnM_ICkQ6StO;6C#_q>pg#JMK-c?hlBNeM4>w`?W+z4hf^#-TkAk?J?QWiY_t=%p=1(g3-grOAd}4!`4Lm)?Filu_H3Oy~nGK$&)OO`cbdb?{%Yo zchKu>Z*8pIy}5DwM%HdpVMHbsYEmdTLBS16VWr0XP$aQT2fpW_fUMusGOdi)t1~lh zP{_6Ew>y{)f>O~fl>tfCYU$nQD+`fl{C@P-^W^OhLh-)=KLPU3dK0 z>52Jy##tW6+Mrg(SStafL6K*ul$>VT* zE=zI{kSWO5Ce1E)FnXMP+7ne|38TImLATvY32g9;7c8D(e z?AYm3<0tOlZS06Rs?{e8g&>QP&9$xTSKjMyE}y>tzURLBbrY0YogOuLxl&aInCo)S zp%jglMr%I^Jl7|LES^|+_^BuIB<=2OIB}x0vn`^5)S6Kn7RtsTXFM!c z3*|~!Do{qL!!6-Pq0$0TIE=UymX;RIoqJHkiRZY*VzCeeoDrW>Vgw*lB454z;p*+% zI=7p*R&U&X+xX()i%%89v5n=GJW)dHQxAXU*o9MzXQvvQE7i$bS|rOiumAYvzmJpn zbD#UdFa7Fomg-aQz4{Nj+X1kEYHXtT%m2l9Ui|7WoPY3hg%uyCJS^z4fO!IWm?;BLy zag3Hi^oDgY)>=dZ0G86K!)H7)TP@9wkClRe5*%BY|HL=GRiB)ycm<}VPqFOsv4X!e zF|k-J-hbjuB`9%`I+zneEg^m(;M_rjuERkiBaAyPqET8h$~bo%*R?>Dw!|8%l}vKV zi;O#*lA%!8C>amZ=`-i8=ih$&63tAG)-M%|&f+BYYU9KUMZd=xEl-cnpFZ=`-~7g# zFaO|2fAQzFa-}v_-@JRh-|MqN;Dl}>9e*EJ_&-7EYa)Rw=EX`s53)%7v0~X_dT8t zHtdg0{Mmy-;ZdWhVF!qN3U>Ap`zRGA`>1`O_dQZoeCYRZfQF+#@4a>Z9+VKi2QB-? zoClKt0BaGB#J&#?4M*p6kZInV*~doHhol$bu(yOg)L#vW;)uiczB!293zh=_9=viG zSr|R`kbN7n(Mytp%k5Y7?#B>5%F_>xEf0ZqRNQ6{F16nT>)vC~k=pE!K6_)cIPG>? zt=;uOb3Gq)w9G6eaco)}4c%@N1q!J&2GBZ;vQm)}5*CXh7lZ(6BQt5yF`$4*>iC2g zltNSnl_FB1ly1$Dz))p?)}g+&XwdFETN8&l6fAYQMoS4p#J&H!ECbDGI+&de%k}x& zd8~TfsM7_ixx@TgmAYOrEaihZ?RN|SbzEXip2bERk3(-;#8KpwYEtApte{(xN*L5p zs{y@Dt7VqA8Y|Zkt=85cGET;eg~_Qow>&;*Z`X?qwXv?(THjV_W(}o8Qc6S5V+5?l z-Ie946U;2l#{tt>E+u5C++5vY934&u-FRts{M_SD{5Q9kTiYA;DVUgB=(an7%LlDp zk!4n7h=x*ItrWL6Hj}~M5#WS)y=Kevy%P_d*Gg07ESx{Rb!)A;a(C{5bMp^9Y_sI{ zJ6C3%FwY{9Nv36OvcA2!!+}u7J;p%`uTspkxpVnS5IEt*$L5YL)+UPWMvutY=*aU6 zfTq=I1;xUbzy7n=E?@3$ZTq2LaJ(o+k!93^vb4F|qKH(bKJ`7nP%H=ielJclYJDJ7 zDQP51)RyooBZ7_tYm}8Z=nm``OP|&zyPm{cE+IwfFzvU;G~x z3*UU_JcK&QzxJC`qDDp;Qpy)GF1%>Rs1`($r+Wvr3FKnsC>% zZXro6V?OiT7;QI+UDt70;01ot+^)D@!Rj0DUaCygfB83mr&_H~%`bq`Z~W-{H?F+r zQE-AFC|1g~vGJMXwR-)n*IwS*SQSyOWk#vJcJ&PlcJuBnEwdzQS|P0Kh2vwV=kL$c z*g1KsyB+qrty~GlX?^k7#PlLT>vON{0LcbuBv;l`ZLVVzcYLEuBu5mvLSu8G6{8dg z;f%Z15Rn#`RmO^_!5JO%oS@(lu!M5Poxz}=X6bB!&-lDtEeD~e5QFMmabn@APk#Q+ z^$-5~%DYnat7ZRzC!QEYgFH&J)~1eom2-iI&+{4QGKo5=C_BCds+0wA^C${SRYi-F$LCHhO<#HK@5d)+ zXD&XNYqW9p#>#DU-Lnr|2n*hy{Hy==otOV1+1?44PI_Ub#CgvozxJI!-d6NpCl|z2axv1 zXOA)N2w#SUuv|L6y|EsPe%g!(TFbamR%?mOaY|K68KvO3E*eY*QJ(ZX&n3Wg+Vvb9 zTUZL}GZu+ddEW11p80{}1;spzv(A=IVr!9rwS)m>bZC7^2?cZmmr{yG6F_2(!x<0? zh^1oa7HWNLWx`%Q7pLiY9S1QafUwHD#t(6r_QXLIWoH_N`pZi7E3ps#J zV^AiJBdN6za?oz;I3Wf(A&dfdoIJ}ICDRM1kn#2Pb&=)>)&giLDR*)Wu~39k3lxD9 zV1THl6e2Gb#yZ>0!OnKn?`^Ezp_tCiP2FB!`~F}5c|cudrQ<=r)j4(IOryQ?%rnog zt?vB0fBpY#-&rFZ#^z6G!xi$4fpYy|;n<1q{qdDoLZOrNt$pgY}|HHV3zoxnO2@lmB@2iGG0B&WFisjQ{Z}N#Khu) z)+Xz8C@O=-5C=GX{;S_OdE!j9T-#}Ezx4gTy8708z86+2wIFbS!qU0>W1UMWM3VJ7 zgF?A%WWIjuMz66mXg0U*E)%rHO8L~ehr&wf=}&&LHZi@uvu(9ZqXDOGp;DhabN}q( zX~zwvHff#>np?@vZPD4anE)jSN@Yn$*+!}bf<&W@MnpuzD9je!*+OC5_s3oIi77E! zbDi-*Fk7#mT3k52FjouQ0HEUXQo*N;DI>gMrC1)@Sh)#Y2${e3y}vX{31qWrPq)9N(vuS*?Z0gvHz_%_u9CyfCy{qeahi3&jd?3)~BXQb}k@-SFi3 z3)9Dz&@U`J_;4okLAya1v6OYUceife@XOx$XP!Ls&_j1_-k6x3`-Ok{yHe|y{_}q{ zX*#_ys|;8}-}w6<%VxX8=_Aj-aPg@}m*0G8(CPQnxYd)E*5Y%y)%qU}MeeP7T zSnfA=l5V$HsS}QAe}^)1?7{fN?BL91D*n=E<$ia`OfA(4DJ*FHVd!s#Q*#D7z=ez&R z5Niq0LlS>)8W>=d2OoJI?xBIBH#=ODJ!ZXs*Aen~Lh* z)o7(mWVg|>T3chYv}cXvjJcE@*uHm6iGw5X%|Q z^IRxx7(tihXr;!+>fN&sT;zrF&h49y!+z$U{ASJy%y9=<(%s%onw`LNT#q(e?JOSX zEH-GgQE`@OW2a`O7EUbqi>Cx~o97O2M@K|QrAlSt{s+!J`dTy*7KhH^a~F@^7x5UXY(xeJCT4{1V)i{U-$)FweJI%(X>~2G^ZF514(ppG^o02W3 zG!okG6(14`fM9DLp9wsVpkuX5O+X+7TA-F$?J!2bYAFg~7&s0C1;iSQ3IPqt;|R65 z@!mT(-+tZZ60N6|%KQD!?$++w9pCq+7ZzvET*$1`iy~kgII|AzCyCJ7Ak3aT{phow za$G-Z?@(fsTx5m;`dr6TdSKAQ@v)k{qrcRx?_}HVa<2l93#PsxwU;3%>nYs4X zTGD9}#tB-B#;80f_>*%p8tC}qlIOC{+6twd7YhnW)ahouo+Z{Y-vTqJ3|LE;9lAp@ zqAUu;Od7vFW@!P1cFR7ch270Hw^p8=UvgddU?U%Drw9Qg!!`s5po<5IVY{!!89v_; z1iB~rxTm7}IQi`Ur7RE%#FC>5?1OOY9xB-pl)a~9_Yhz9!oh?9Vc+@gA0Osb_dt;z zfy2?U>@(Dlym&A69E@!U!+5A*I!M3nEx^ctMm~4&?;Z?~PT{ZyX+))b?>WHkTQ-k0 zhCG1zgSfK?%wY9mCFM%_VUyRmYswR}VOdahT= zGDE!321RXnp7fA; zwosWMmgL=@QmM|`NvAEeER;&cTKV(e_$hB{>DHx7Gm~Sru~Kzv%o|(K+E#0&nUiPR zy?)e-jW)sz3=>I4D$SYn_6T0v*Dv0R+Vz0@kWLfBdJubmqC|C|Z=5c9W>r6G@8#bKHv+sV+SA$bb2N{eLW; zxbN{#Jhi#8^2T5P#ih4izWKqsajN)DSDt81n5Tue<&F(qfG zs^=bg!gInwyD_~qC-a<0={bSP;(%M3>nN5{q?IPbT23*O+0^MXsvpOjE8O)sb>mJG zjUn7C)r;J*PEg+MsLOA^dE@n0RHwy(mx?7|G^mUh#%E4FaQ~CfK3}bk6~myhyL0os z*E`#r_34E|x!zb=Zf~quEdWfn)5$3P+P8k)q5KE``QOMSEmWo|^~o?SXqC&fC-XQR z3|hO}Nn_h)5!Hqm1Z#}|=0F+0wM_-LQ|RUztu+=Y0H+KrIGi0X2Ne#(nkCowUBB#l zj_YJ$1lXdtD|(u8u4Qx8+Y7)P+v)3cV*Za*@)l2M%L zyf!`CPoqIJPyp6(D>HLwY1)s0@UUD>2L0C7x&aba#!%U<`r!Hez zCN?+koV#$oJi9P`>P${dztsZ5W36-W*KgeJwAQQh^On)q|L%MJR#O`N(5GJTI4oa! zGjteN+2ZU}XM5%LJFlBuX2^+C22KZqrf9Aat?Ub^_x)>rSX5F`0BVtOCY8wI{@j`Kb7wC2)k>Nxzf@6((e7p; z^tDVWgE&qcKO}@Q<}uF)1VW%VS?6IO4f0BL?%aLAyl!LL62l55i`dv+<;7rT{~Ss<2u=MVqrurz5{p98R8d~`3{z4vTzh)g5EGn%sAv$`0u;XDA%QAFL( z?(PM9$v#Z({gTolwjG9#2_ZoDV#RpxS%Dn1OR#(8%pb`&-vhu0=uGyHCZiPjDA0b? z$?Rhu;xJ;px2A|P&$C`D+Fft0uSAWOl`-Q~8A^hJL4rbvWLGCmgD#~GAc|ZVpgb%9 zb99strG(6s)~@GxLD3Rc7^{V)8X}}=)NgMl%^fx95G_Dz$OkSloI8%^5$162`-RXA z0_wR&BeBSsTd3D5ceK$)f{Dgp|$6xje#8AGx- zlUXWdCY91?l(7n}GLRwU2Be|HVUF)>;%H+lm2iGxc4B6+I$58bpJ{HbVjc&@iEgXY zYd3nWolI)S4|?5BmL!xj4H%3S79V;njtyulWbPF!*FX4R=k6`Ws5JWK)em-8?%cfk z{_=;{lV;bdJd@dzU;ffJ{>kr`Cl})+=Z?=^Z)|oki84aLD7f;2??HRZ;|^-&SO~*% zrr7ee50g&Ema5(NHWj!3%>6ciJ?}BV<(SO--~*^(B(kTqT!6HEK5a3xbGE8 zer2rJX;U;tso`IHv{osT#<5J>m9d%|ma|M41Z@l$?J|dN)+{ptU!b^8wFNHiO(Pn0sbHjElHTj1qa28J(sJr;g8^xxZSUn3!E8lvl>yujPsUW@v@EX|u+o69$@i(KyP?%cip;h@vigy+g?8Wd+vm&eB& zJ8SR0`f`?}L3s?AJLtB1+jnHQBcr}bqNLl@al|w_h-i$lpe)^ybVpHbkup-RRZFGf zFxOP|ooOE&lY5-j3clm=2cQ4!!ifi3tp+eUjKvu=4}Ib@&wue}Tictvn_Gr5zf>NZ znGeEB)Z9(dG|nViIyry5FfkqHxsb{MrsAIGdyTEFL8rlqbtyGUgF|`XWzj$z(;W=D z-ENlS_{^eEd9D=a)F_mBMr>XxdW3uJMpNbqqc-kE@4oq(Mf}n){PGi@{rvjMN~hoN zC6P27yu$qH)2Gj$xqbC=XLGk)otT)NzkBVyjqBGu>KdsyDjzcvHiL9heeiDJQK1M0You~L50z!inV6Xa1VB{? z!%|RIxtv`({=idDXM?Q0xt2#AD+H&+^+wlaIjF(Q%LDS&!UoA28`hWqSySdv#Q!5#v#N&HbT#yxG?9G=O_jtpl{b zC&Isfr;k^4AAs#B@QyC4{aDVuKl;62(0x`<2r){@G|Kv&sL`~>a<3w@#Bz{Gj4~)v z757D&qZX(%%G79qjz=Be7@H>%T1go-1e`+2bwft2R}8pUKy8RMC>3V8N(LqyXeq3e z)+j_nz!G4TI*c*qQsCSIVcY}G{6fJm76>s~NmLpvp_DOdDS)wtdmaGLaW6^}Vad{c=jKkIwT|Ct?o=j~?kcx^2(*5UtUQS|yao74Ej$-6SnkD;FPm z$P!|tbO?1RFO{p$y!hEOk3GG+vpeYSa+jVxd)5mBna5fqV=VAp3WO44DRqK!F>tat zeedO0S3kI#c2kkciN(dl!0OGLadS0`TOYjf%%o1*&Epp?Jpc7y6j}b< z&wnjp&i1Y4?Yk?rT4j84rnA##%G#uhGF953rP6>xQky?Xol=%%1_)XkwHh++F^4*y zYmFoX5g6g#ur#YMzaWWiefX|Jt>?N98e+6jf)|3%ef{eblaqJu+*-S{lE$e;7_ZjN};lJ&~EOm-bvbxEQ#YJOOw=! zjG(sGf<;Rpw@EqIu0*}A*aj;#Q>*Ho}4&w zdT04VRMG&IA~RXqUthWT?pw{~_K6D@Pv8Gwso>0?I$4;UC{B!>d-QRSI3kL7qdovt zLh-<_OiW5`(?n3>5icaxXdx>zvtGI0>$KuD35!K12y=~EWrL)XQ|d9tW-$N~Yb<3z zxXf~;lm!IlNkO7PY%M1JK^#X9JpHtBicT<9pI-{9g^B6$*I#}q?)8h6;^fSvRmO1( zy;d8vv1ql(h(!n{KKYBkUK}60b@gUpe5O1#7k8SFr_2IFG=$#w)MH=x>CYZNHmQ=< zzxh}HU2Aja3t#*BcE8hZHddEcZ@l}C%@VLC2#QK+G?sGa2W~Rxr-RgW0^j$>rzWMy zRnm>Nchf>04<&@h6Cqsl09D3&JVz_|EcoZ9cMw2!i*z?Wk;2z)*!eP&zWX~O9M3H<5X?scE z{o9V{tVRYhBB$Cf5*gU*FFc14lEisM+77oQ-6b_Ky zTFA3J9Yo2X>pEUKka^Uz1Qb%#7EDfnSWCfbi%P1TxIQ|*wNwfb4|;i)IHBicP|@IMMTE$e(LzZImJzEBT1#+v zeB5tmV$e_{OFo^MsMRYKtMl6A1O*ze-I_gddg9?v-M;x@-f8C&eAii6oPX$(pQ_H! ztgbHiI&BxEkm`*ezmYVzJ%_p6BS2l(!=ZteL8FY3#v+s|)v@v5vFFa*|Lhmu{PA12 zKfJtq`}%mj(rLFGfNPiDTY2vtUuH~YpmT>3&tZY@FhZy$Qi>#sIAP2PCm`Efkzl2T zr@vJ@{mjhsU+gD>xpmYf)$1m^JDjoF>}=HU%0bMT1B5!B9~498xRf}?m`9#{%=(3H zv!~;JJ{Y|C^Ityq#c#g#gI7G2P=^fbCZx)T5t|0AA0QE?jVU@WyfC=`m5W54v<|K!3WpIBL4*3^FR-n)aH#)a(+6slKo_SP#~AG|Glt#Yk8IW?PSQJxOc!628hTXc^tEe)Ex-OY7s z2q!dZZl~>577v7!%4lUk8bqV1MFL;|1VUt4mpCbNgF-kxK2|Rl=cgtqnzY*}aa${d z1@3!pKq%u*;JbcfV|D)A$@?CC>YeX@&!Ex-riyFs}+F*`m{H%2!b z?Z)nQST29&i(hOuSH~x-^{M*Y;#{xSYqy(D5KNyqX_&jPw6wW;7nM>{B6XAj76g9i z)yBu8e&0CmlP^5q?=>(>0IV@qrm^Fa-R-q2Z@m204}Y+AXJatP1>&iT=StN{&|G#S z&ksG<a+!#j_*LpZq8NSOMd z(&^*sh4-s??1+^G48=_&+>#u)aRCql48U4~d+T6F=E%(TBaP?tZmD-t)jmuP`hgS5l=()NSpeNR=@LQCngyr4$IY z#9_cG^MhOypiB|ZIw4vTrvoio({t66=g%KMwKO+BH90d8)M~(8rIkgbgfhy&D58{u znxiHJ&;lP?_JE8>?x&aSDzf^XE!1Wx*ahS`P?*+99*AJaA z^uw~_`kqgNLMbed@t^?Q$m&cYrW02 zrDL_(3y(#+El&&>peA6zF`6lXc`DL&rx=D~)5m&k`N1o%>m)mN=1gm6rFruv1WqqX z9{B9fZ#MJJTYn94hdN%G0b?#DkS39}1}F{2>(o*a4UEjwbnvBb|3-UfTXy@v0|olC z-}?ETjb`ii4et8J7zPxq4N7&*LTOPUN|9f?bZO9R1CTh$0qyks;vf?;iy61y{FQIL z__d#Y>eF9t_M%%iuI5QnGkt;W@zWdfcRAwfA>D#|`^1{Qf{O#XF8yiL{?mAwn zFn8)ySgH2Y%vjJeF-B``w8$8zXCHj{=`VcY)cO00p63?XFaOiuYjx9=_per6zIpRz z-fcNtkBwDaTKN9I`}ZsFy?yB)UU4mP-Jn>RT>o&{$o@kweCCJ${@+8Ipe4!}B!J)m zVSrj>F{MBm6HA_VSY^Z((0eEd@{ zzI*B2q}%e)5G~_D*4f+$eIK>LTsYjdN{Te`{lb|G7jhx8e(VM=goV$1`OD1YZ@>Do zRNC{xTqtJHh?H542wGdmb6n3!yF2~nmJq5|uVrakAFFORRwt&Xl+51x@k@hFyHKlD zr>38M;j>|(`raFFB)y1-MR%+greJ@@6WoIHK{&6i(d4$lP; zpv)?nrrJ1BB#e~flQTDO-e~V^b6^X{Psdr-YqcolSsIsX^|aUF)C!R!f<>eA)UTFV zp}6(o^>}BSpale_H5$W)aYSpBOekmEag0`4DN3yCIB4nA$&4y8pO53PU) zlBSPHw(g;4N1)+I8WafZl_4Do_a0?*d-j_n9SuKnKXPv-^&a#c&Tp^$_dxD+FLi{Y za;y=Z)kki&m)|{2Lz?e%M&oXW)8^}}$sUYM;1#X`uu&}e0}w!|&gX9xXgkj7gZ8*!@%)&eR( z-D_^I-MFfgv{tL8{b=XTEti7@Y&9C5M_td2I^BZraDa1(A*oXRME;HhU>sqo`J|I@{VllMRK)cW1+yO%GELATfHpfZ$#MN~ovtF7Z0tASWc ziIk{?4#J>Zom^dCkE71m*q9VT3w7m<*YDhX{le1^fBH*5yRqJA+__D34hESuy{*-+ z|LQOP>hJ#ZfBoP8-(UTk|JYt#vq?@V35q4g=!uID)aGVe&93M9)@UUa02rfAUA*`k zzyIC&h2#J6PyW{*{cnFNyKND5Z(n{t-&%L#NcUR-%L^{F*VhKE{{2tAxN+w$Np-i0 zYnR?yzje1ddt%VqUAuWTYBYt2rO7o~q%IOyDMJ9!DAZEssS*hQ5<-+Q8ZCmQ9ygR2 zBvNY6qGOGUBP&vu5~~0tT8RX;6L{bjw>H*LCPeEr85CyEPoIB0m^pUr{$ER!P6l^; zuQGS+SL2u9>^rL<(OrkME&`2nygi@d^H;^DnkfatA*ixx9R;i5_ z!#by~5-ytg#bZx?`g27}AnsU|8WAI9)$ysk*Oqx4lnRvcz;`AVPP${0zxv1j)gX$t zZr)%(0Ej_sZ*Nj+wzoE#o#y(=o#h*M+)_2*{JkIlFeo^`{=2_-{mnPpH&&;{$J^U$ zkjC8MK&cVZAUdw^c|JI9SSpKXU@iIdFa7d~ix2+CfBmn1_@{r$jH%Ag96NWvPQ>=s z`uNFX%=J0-jZ!ihf_eYarGB?#5i7;;_~JBDMhYdZ zCHL6G{Os7&^!4{H_2cA=-}w6Ubp6t+|G)?lgGl8usuWOj0uEp~45@~xxv5gA+}mo2 zLEng!QXs}qODN-n5sOGDl*&~vC~z-SS*FsM09eFxk3UYivvTQOh88SAgBGaKRwr3M z=~w2bjvYTUjLzCUfz$zD?&+flApmHB5=%z*b_)ld%!k?7gP`TXo(=m+F^$nqX2|`=MVoGke}djHG*3E%=;cfP7h(}qble<{3b9ws_X?PKQ3@S zg2#jqutO*7gEPwEn-7xeaQMxr!s`&7j}Y~bPU;{^F+%wdgjeJUN)vJrsXpk|_z@$H z{iQkZDmnc1@KI~2g%nb$v^U85eTztmC7b}I)Nz>?SRUjOh0fe+-L2HpY>?-J2Od22 z+^0UXuyAr>VzN*v70cyPxmv1JYqeUnRx6f^jzgmEcHCG|y&aXuu;)VxNYD~%(Ky^G zc$`y9C}ECAx#I>Qb6q5a0byjXO9$iJ@yo<15jUXBCDfsm5g^?4D0j65gBBde0<%aA zMM-#;X_;s4*eog3b=s#glEw^ASfz4xW@_TtbkzX^4hJ5nG;tm0#6wTAu-a+0?|k@S z(ra_4Ku`xR9h;mcUeOYw!ESBrbhg$f=I585`t;O^Gp$atv$kBXgjqlG7@1p~PvicL z%a@7;_S{c@%?%5Kew@V7e-#O_T9^G&73${oI19#ynX41e@%>H zwef*M;4X7Li`Js@ETI-qX_cqd$!gXgI8I0aO0|kVF)osJEo6h+S4ejStbFW?pJ}x^ zjrF@Ci$Th`-O1CG08iR&oe!)rd1m8O?d~>YCeA!^5v*;mtj7J$?8%eUC(iEPz2#5~ zXpBSwQ<|=Xzkcs7=~7> z)Aya(USIj~fBFv_Z@dZp*r9gq(i^qvgwCR}ia1IRO6Iwcm_^C-nKP_DR+}5=wdu;@ z^wPO=-R5BT_J>>7-d9Q~G|Ct!C@Sg-Z496`T1#oPp@3kC1!An#1PP;ns5R6UmcZvA zGNy!UHORQ=QrGpglpHLe0i(g;#34p&uT-agu^&YbKL6CGKKrR^DQI<8+MBnj7?gri zzuj)G-iSAs&7ddZB+f)CbRz8lNrnV1A(R>*hEPLUZcv~$*1DcMQ>mPqo|>zV6+O;T zyOdOl#iiqm({qb=uU#9ox1`Wgfmf z7^+^S)|RtEt-@Wux7|pZor_OA^Ymw4Xs)gDUyimGA!F{+r2TCq8)dmB(NF z-0%FK{?F?x%k7mrQ{%Ov!61 z$7O-%oxT6u!_Pc@m;iF8Iw4rOwX<{oV~;JIy>RRD`%z6o&4;WJrq+Q@{HKvwPN+M|&oXvbsHQXmW(O z?I9QZ(jMYB0XjNTYxjP%hxV3xqqB!M zyLYl9sq_(u9TjyE^3j1EIZhnRa%f39WTu2^jauX=b8D?d4GyKgYbj9x)-6ayYLim{ zUZ>UJu6gRYCr+F?SFY8aAYhKeT-OOgCnyA^VzpAL*J`Cgi7}?qEz#R$gcAycQOY=> zoUlE`yyLn&@QLd($MFi~Vr9ZFl{t4n4f_@lK&!MB%4mxkHKl|z%Be$uSU}D>BBHh0 z5`{4A&Sroy;FeIKg;ZUYv`}Rl!2oDW$4kLP)%7{a@*J)8ypl*0tukZserG#LBEL{{ zD6vL|g`i%qRwl-ZvnRG2O(~U2kaAX^UgU-GC=-vq@F}Y?+FG?*Wl3f!M**5^?TM*cI6nWE|MuUlUwuCv45(X(vaH)_Ft1Ra7@sa7PZZ}L8ed_0bwtReP z`O5oYP`U4kXGmCz+g-@gjpbXDCr=yV4BCB;V3fXd<)+Ef2cCJN*XguZ?qZynG-E(4 zQYnN%<5ug1ay1)71a+RJ7H!mSpE$j+bmqR5+si@>yXzyr(jeXE14T35eQp4ce=7LySB1YD+VU&nmFFN@?mH7 zhM^V-WO~@Iff_W{8bobC8*PXML@<^bU>3;mjIM;7TRc{qomswfiwMEMxL_R%od4M2_wdcP9nO}pJb1#14nP(q5eeUX|zy9#ezYPiWo12}j)x6szN{U>h zLM2kC%BBW#BnUtm2hNnW0wFgxH%ft-9j`yIv@|_lr+^-s(4#;|;D^4;8#}Al-hHjt zY5JuxUaZ&ZV=iYK%QtkEP(p=Nd6uI>BUF2B`JEsBptZi`P=^w*giM~fZ*1xK)QPj> zbH^C4crX}juQSlupkD}sVzGMT-K%l4qm>khK~T(uqG81;)AEa5gxw~}yWIPy1k$Zk1qo~vEr70GQV;h@m{eIGEb~z|!w&)&e zmS<+l3&))Dgj+5LwF)}HAWoxRk6KK6QRw57&pk0cd(01u#G%Y_8TXkRIBtP5mvYDR z++wlh`vLbnR`j{!c&_VvuIqW8?>V05I6h;X63aan6pJhLqi=eGY;jh)YxgZcULz*xb(sD^;`1`Q=k0GSKoN$HJ_&Qr_Nt{^PQxz zCWPc#pFT7H;B(K7A3N1=>@b9|RA8Q;b^DG5AXEcU2nGSEbpxMyp+TkdENbmo5!q~D z;@GOh8mW~KQIvO@ot^DsP^2t8|H5;pU;K2GWSiGN>~3vHr62g@)5Y1D#`=2RYb~6< zZ_w#-V$`6&ed}i09~5hKuqx}ejMf=~21^*x7Exor-O;FpmM&wBm6cwrQ!1AF-8LnL zTGS%X`n%P7)#HBL?WP96@wwv?hX>_yp*GRnyo>RG4@3Wq5eCNCem`&CxkY5^)~a9q z$KRfvI`P`y{?+#KZLUqlB^8ec4mw1-99q4>tvlO}C1sL}G?AKWLzNI-SZ?jMc9(Da zgvHD2yYF4vx^a!5B8B2WX=9WyRvHA0oRDD$Zlw)^MIe?^1i-z&_f$z0l!E&oyZ^?A zH{w>;qt>Iy(YVBbQK%FmF@_)z1aJ!hcU+5Ppp3TQa_{!dTX$|>Tidw#;kEZoZe<+z zcQ=*FtVN|wrc6(o1W9ach88Iyj!P&Rc9)XIXls~Drz@p%OG{_YociL=ee>L-PiIlr zsKjN6TFN|EaT*j#^{J^xo_h9~Fa4}WW_8~W+^8E{V-be7{>-9w7^T!9&ah0t`l0{y z7ryxTmwqakn!E3rXSGm+t!2yyaX(SHO4D3ssnL0!X1UhLoLs6>b?gh@`h{NH+u2xE zXr(cXaZ0&0lA_{(-F9bVbxlNrL8r-)uHU*II^@G2zxvh>f9QM81CKlp#G5*Oe0zE0 z?eD+z=AZu?k`6?cP#{@6Xs@h>1f+u2ZbPKG?}k#ze!Jb>X^hXz?lhX+-L+R=dim;= zt2@i9vfpP)Pfd+k(@$Cr87C*s-9Njuw0iSHN*!xd+H2=go~K#XYh_tirdhPRW3{x5 zNn@q)Dz$kTM~+{qPAti^hcZR2yh=?Qu$f?#Ivx{g${7i3^l}A9Mgnt`N}z+H$RM-(!!x|Jtjf+u@$8jUfgZV@|=3lO&uNJOAk8ffwxK z>9E(|o=L`j5b)^U{4pptx|1W>#|e5Mr~X*%v-`~gk8ba<#|uZZnfF*%9T~|X0RO>v z|Ji{I*&abVxCc%we3T*H13yP^WA{;RB#e6mun$I$b|0bbo^A06P9H221+wo+dE~4C z`$iihIc{<=qN7-N5J@JZy&^vXr$_iO8MV~@IP@iONV>^E=p29!V<5wiP)Yzqnr8h@ z+}Pw?EL^y-bn(fF#WS_ZndxIoVYx01^m@J4+FjXQ;m~^Ep@oYN-CwCq@*pIX1L442 zAe?j8^*kUHEdZloA@G9=4a&rK8AsOvFJNB4gD~{NLJ+!s$h`vhi%zjr@O|QXz&T?M z)r4831P}p@78b0sXaQVeT}~O>TR}=F5Nl8wt-xpsK!5>S$~p5K1}yLOG3gT}0YGVW z>iGPr^Y`gI4_!7sIUW`&SuRRr6CzCm&ky|)8jN~9il#DFUwrsca7(SV)rp0LbRhHX z?Eo|furhZkT9L*(8yIyQ$|yj2a$ExAUMNumC%~Mj7j+u#J2!77o!0fYFE4+1y}hziB6&2^OtKpeKGqRhGuXpx8{)+(j0 zLx592CnzAwq|*Q-t{3$3+`8Ni!(3t1@8@Zvt>K(g&Y9!5j7ObzmPVX2 z06?VzKTt}6QLe|q4VV|`kU#q6PtGjd*WB6O-dshIIh>*;7J)moc=BRt`hw~U;+LmR zURb+z>$Si6%jGv-pP65*E}V$lU9P+J5Cg}6#r0;IWw}M&?Z-wSB9R&m8YuF4 zD2&Y!a%*#h9Eq^N{X%VgLTGIa4)@}M$L>G1bgEW7fA-|h|Mu^0?e0uY&pV#i+SrN) zJ*je&OHi~@AAji6pK-!)cVn}++oC#iJlb5_8ukD{V+y6B>$-r3Gg_aTK|-@EBE+oU zx@NTe;@7@5S+DMVa7C`)k-3PYyxC|GLJ9S_Uz7%wOgSaS;Go&sy89vbgE)$mNV&ra zWt3RdsWpN!@O)pU%1Et*lu@*Lr#2ie?BySo>j z|KuQ!TDzN`7X)rd0osk-xYbTOt%EL4h#x!MpDrTROdT>U3j$N2UFu%i6nJ zGK!`qXZ;}TcUsevlOj?k$+J$cSgl#djiQKwWvE?7AWwxz!Eu4`N@Y9@!(OKmgf;H@ zJ2x+*NYN1P2Cg3vBSB}BS)+u`6Sq_`1p7Pd6s(fk4_yk@2<191YNfJ-5^%yIYGH)t zoFkz(-oGk)T?*D9SZ%CUgfQYT1wO0QkDWa=F)_W@UvQY(C5I?L58Bx7!GXPJryn)Y z7;e;ix#ZEH=sjPDeULu-I|4w4qA+^|lI@Xd*Glu=4hYr`04j3E#UM5EN0i7XL=n5Tn)SdVjU z^yJj^iL>X^UXLMlcp$VM#8KRD5wq7GZZH@Ck=%2q78fR#j!TJYf8hBcp*-%jiG|u& ztu{3i7E6I2Xr&E;%F|9idE|x1p8onT{M}#vUAmGKX7h(HgCk zKx-5dWXzkK=<<-yFL`4VNg9``WpMpYyKex~eq;OQwWz-f29iOyAIIgfiKO3(+TEz% zUOc%NwUaE4<9=T$rKF?)S%09CTxz2U5dg+7Snh)*mY_jnDOK83sx?0-8f5~c zPS)$XVNoN=2T{K_NStCGPHZ-I5ikgfl)GpQqS6K}?gxs{5&%YE*h7ADZn|9Z`@8F{ zPFLz-Q3GLMIZ$pbfHf90Y5+@p&kIA>b%oIg3<*b*dv3tJ5}*=Er`zr4sgN3_vC=|n zAh%XnB9JH`8VGfqa-H^7ZGzlHJ*P75F2-k$qif6F=Z zN9J1!fSiaZyq9@1^WK~J?)N+2`Of#D2&2H8{K6xbr-P9q8tvWfZ{FU!y@3P*g(m_; zATm{5doOh$0dzC&Ts*&c_I%pwZolzbHR#{FbK|}5e?6PzrI&d&ZY`}Wow+z1OkC}Q zFcfG_m1`lGsjdq|kr#QSlWuD@Qh@FV@by?it_ z))`Ng_aL+uK`6v@Z@U;B1PYuPr%_BEeeKaf7>7X|BeF!v3_1*hDA~Gk)z?)JhGe`m z#ybLH0iblC!iZP`izsQ3b$}!r9ppe-_RcT?GcgJsC8T7sxYk@hm3ErvE?yQw;C!0& zu!=oIFaSJEhJ8Qnd)RS3g2JO1_<0-mKF~eh{)2%0e(})zlNn~)eTZ%1F~Z5;_>I4N zh#x0rh)*j>mSv_HA%`QVYful_zdi{bryqOb(esxd?Jk|tNn6MWFa(f{2&fKi zsSyB#5JE@*0Ybz{BaC7JD5O`)#7U4e!Y~P)6;FmC9$6Q#{0 zjhd}y+U>->g|ydgwwghjf<)&G5=ry|EqUX-V`QO2sgzbqNhy@9%W<6@%rwl>6p|eZ zVXRHlaB+FrK``hKb)-adxh{>%MhJq49C=2sG_IVx+*vzM3`#|LQF!O`@ir;r&p)_eX7faPUoXP`k70QKQSE+m)Cpg znFk(x;^|4@?rrQeJKepl{e{)Wqo4l#@BjAi-FWj|88#=GHH2(3=PLrR-W%&JQDz;b zi_P_O8~c0De&NS{bkad>8%%RTf+q)L@vxzWz-lG|1P~~gd~2aqRM~Wr zPqKnYNW@4;;aM|j!2m!Ejv19krAdI0!Z}kFRb_}wSrmmSOJ7c_BCks0JQ?q=Go`}=0Esv&OY?Wm8YJ5 z^IKozBlG!kv<+7UZzg%VbYz1siGfBdU)ulv+TpPL?R{ps)itA&;2Qx9EEl6bnmQ|#|6 z&#@E%SvMW#d3NFPXU;zQBM?4)**^0UCu`R zYP63IlQ^!el~HJmyqcDtoYIomIbQ{m$d*WmLJ?7#c5R-M@!k=D02Wee<7~UrMWJj} zA)*MR_ogzr43!j)im{ww1bYz(5w|!@MJr4e+EJr%?&1S+90Sp;IVkv8k;L;J=+Srb zLp8=c*GBz^=7>%RhTk_(^gg-I5mFwhoKI5JNB!lKh436+m=DvCj$i9OvKSA!+z)wG zoU^z`EbECKKQ6aFK)drHj2^)yo}krd_wf-(BhQAq4qx$526f^s@dV@^!86V?m+u!e zp9IT8nc5-L!~L%}2jy8;`h)f&_esOvhs^{m0R7>zOU&kl5xgg3>LAeVrS-VI90Y+< z$Yj8mKzSs}c48Mgjqbui(pe1Co(NME0RWQ_AT**xR0Ie_!~}>+Dk-%PQV3K*kfbdY zhJqam7esLwCQ+P*VH!qp5Vv&L3Bx!DQ&fSF3S~?}38lg~jN&*>8e!518_lHM(T%1^ zVv-W0$V+K#je&^UN!V=4Fm%>V?x6 zU0M5l$V5`2R*F1#S5}wLU($^>F_osCWaVTy9_;S>Y1Zzw9YbE4x+YWmAWDpf;pjlJ z8|)rz+_-~4VI2SHSN>x6{6ibpuayV=REuT|tLM&6OV?RBed^NXr$6`Et*zbXKK?@I z)P;lHohy$%G}zl7P4nH`8#bG^+ii@xCg+Y8g>%!&)SfHP77(K(Ieocv<^mywY5Ifj zeed1xevceDMwv8NVwk2;XDKhn%{WX$QRP{GR0@@ZQ7A(Rc+r{ry(Wwqh5 zs=bt?Lc_AVun?t5Ef^$tLB1$lW$N+xBOiUnGHhOZJ53_*!81ys1!G=j-a97NDpXQ} z2dVJ$Kl3xP(H#$mvBsC*{>GpEPrvVmnQ_`0Nf-$MOTAcS8?gU&BuO*GR0}4}5Smg` zr4S@y?IebcN~kke9yF_u9u1RY_6&Be`(w}ZOm*iiF|`7*6hT8v zrKE^sCzXgAlm6h|-J4}L_QnauPPaXoPA@+81Rw@+DrC^#-nQ0s*4FQBZd6%e4Ow6o zN+})0NfgIXqsh!ctMRE{_{-UN`t~>f)a2RnnN!x*H{N~kr+@W7_s9a-0GzvYKIUy!a7={sfL*9C8?p%Lo|K64dxp4Z- z#(Ou=)F!VF?(Kv@fXGEz2moYBI%=(+bCZd)1%MAbXM*nfWVD?`p*5AW1(P#nCQPZ= zt2iP+iBY??T#Sb_7oD(YucE+Mj{?EhC}r4ayJF;wAp$|fbpg(49Xan9SgC-MhU#`1 zeA-=LSFfE}TUc5Hq7zf5Gq;F&aXX(=n(?+rX|l&g&ohuF0f*QP003g1iaURmBR|8# zXC0&GVXa7WJUG$QJg#5gZw5{G0Y2gp0P}qajUT|I_w`7R4&pG!;pBsOw5Rtgn@(W& zNyRtJ{&MEyQirbDhf9EYgfhd24d0$<)6RDr8Gr!fiE{Y3c0Ote^I<>u#7Hr`?+6c# zso!_Tj+PDcU*8vhbjTJQav}4PB?e^j4#9;Q1C4JVjw zLeJXx#6$py8c+kM`Kcs^Svm*KXNZK*LW&?tq>dygV4;FQ>rh2$5GFyG=pd1S7BY}Q zh$>)^4u}LIpcE*D5Q2qNaoR}Qow(6XI=!g7oOBk`h2_@DsrK?}tGA%jCJE4*<1|Q` zX_BTo2xO=LC3p(hG?GS;E+p*++d3Z?X&f)CEsG>7hWlZVc;+-obP&hA#pco}p#ly9 zuY#S;eN*R)Yb!vQ73Ie5jp=9@gbfr5SRNc4)Y+b3f9cWlpa11wSv-B=+`0BI{>J~| z=DpGN?|nzvJc^Wn%9dt-GX3el`U__t{D=T12eGvK2fKMb*}T1V_szE*icu!sdF8Dl z%g;Uj;PRotGJxHa%!z{!~m$ICKApIhXiTl8tz^E_lXWa9U>k!Mo&~W)&|oC8_uhIg2`g5p#p0REy9dQ& zZ^yA0f^;LP!NyTi<)+B0LO=yIU$5VKeSFXQ(m5GfZ zW4u&>t83vQY_?2o_io2Y+VIPfR4WQ zd%q*=`p)ZbmHP*hr6&?PZnis~XmrjARrW`v{M^S?qfL&){(fiugg+?WWMj;}}f=Q{+mTZgxa7ZMD5HlYR z00g0w0w87?r)^tgWG#^=XA~;|q4nO8XDM`JL3I~FNMc@IKi$9iR%@Yk{_+#Ef@e02 zG`rXy6@WbN5YHbIM<8)nstRTSICl*`M&0+btM3QCIhLKo%0tXLp_e+;@gB-}4@Z{n z*93$7_5bqk0Rr47-#Ub}lj5Tjdw@q+$oJLv_v6qZ!ksLq??+=eMlytXr+3~dKJoZ` z|9OV4e5A6*4_2ker15{Cp*t6B9x~Q&h?O5ul$}J{`&Jew0R6sg@Bd|1;4?Ba5tH@4 zCR?H_h0ipWf$)L!5{%$daD{9U{NW@U9d;!=q9^aYcfbT70W_kVQ_ujjoI?OW6o+jF z5<=-Pb{?3GK%unOfmS+}Iube{DV5TJ41`bw?1==j0A#_A5t$ScqLfMoK@dhsk|d2* zD{gh-MmvZj9fmrN(nhn@?WNs?u+%BH8&Sm zK{k|*fP|@wsMU~R7{-ANlfruM9ZIYwV>g|ELKQ{cdtcSg)!y6v{eyd3cS8luX7Y(I zef|?a`_(sIda1M6%rW}?fAmjbxFviMA}Sp`{kb3e!Y}{oTd!X=lY`dE%Dn*GKqJ4+ z-K*dI?s$Lm%-Yh$haRnM-CJCo6rfe3xfp%v=Y9gT+8)=t`}?&i0a*x)loCpTw_Hxq zR*iOpfxU`XE?gS!ZFD>7qo4SEiHYC86;WN5^>C8=puPIQB`wKJigG#vu9GB26{Av1 z>nm}$ljV6Q)em1@mSoq@t_dXuH(zz80xyINDq{jE$or_3u3tL8y}e_Zv?58BFDvDo zw}t>cOKUBYV*nY(gPqM*3-7&i4G%KyVu=ETT0gy(CUL%di}PKdPi6< z8=+W$1ZsuYKr5Y_R%RzJD?rO!I_FVT#08^cbWEOs4h`97hJG`?TPZ~dk-`h9S_(AJ z7w@93U6h2*n*QD{S{tdbv#{cYGI^$zER3I&wkV8uwHBNFP}dfG?InO z4_$uZvAxYZ3rnl5g%uQh?$YJ&{rf-9_V(9SmYvCNynQw4EbeY^{M&!_-`#oT^}){I z>Pz33 zGG9&e(G(zXrZ%ROS_NUkpjOVE-@JOY*c*9gPhGeWH#-L#H_@3WX@)v9**JmhcZ)=+kB^%*=AQTr9H{J)btiYK9tpllLlqTI?L}h{$2cZ{8mIN^( zNeMKwsPaytT)KFvHigfNIdBmxApltF5Ov@gm_Y`KT3WzFPbY)!%1Rn1yVu^XonL+6 za@uU8l!w=47JO{%aM%_XixF1e+60+(XC1mFQ200A=sF*pE=?0|{MFjeepa>m)x z`4TYz5rPna>Ug0e=b8a#2JlSGz(PptjHxGrNyQYcUW2`QwKLW-HOk(4sfL7+pWwNinOA{7QIPQo-!8c7tzN<~StC3R4Y z`li3*i)q#$xU!DhJsCC_R1j%K>8(%NZJDIT`f-2H5f_7z^kz67l||NSG)I$Snr8?7 z{%|@B!m!b7G`pRmqBmZ8<&AHB$LICtwHuqSzb4QoNg};Zdz}ZLf8i59`O_YQ#pUIt zQ>TZc@!I*z?ZvgNt^SQS-<<62-FWTQGp80iE1h$fS1K$2;J1F)I@6zyx}7Blm`(N) zExOIF&#SJ^7l_tKkxpy#iD8SeXo$;O+1OdiT+}}U2 z#%d2p;29CTB*U4oVBhBDbUbEHryqH2?aJjmD`XHsIrjNzRG5OK zXZGa1C&%EJnMusACJ2N=1VX4l%0M9yNMK}t`Qlk;s@i00=gt(9>1a9`XGK|?%Ci;H zp#+pHghSyGw35vbdkHNzbY0gs29qHPlFBmIr3KkLY8t?XpDe(vHk>#ShwXN& zv&2^JZ*Cc5ilT<36@;l@9z009&L6P(kLDF4_s9`=TJfr zNChqwG9L`52fJ*`X0uh8`q58+>e6$cSiE@Uu}^(w;mql<-9Fgb(`3Um>8`HqY;PF{ zLMQ=X@(DR(Nff04M_MWmWSO0>(dIUr`l|Bd{Sb^mku=gqGmheT;lami2!dGU!+tfG zRJn~CjjGPcGdsuNNU%WkGv} zv1>>Ow5*K*(Cn;`h=@We@>Vbbiq(r}Y(61l89bn10I8JFDrh$_3Qg@1b)&l+EG{@H z8oi~o(cOOUYTn4ASw1YVj}Z2xT!ON zrGz+iuAT+ME1G>>kpMNK5Oa3GNhyR1SV%sM$N~f+&rD+0&qe{r3?w8Xf|j9okd!Kq+Lq)4q4-Rz4UdadZ3T&8>IdZl=1sxB#d@h~+aYakG`@d2emK zs)`7q)$Kg=#G}>=0?}Dnz5U*fGNvl~lkp(0s&kJ#=F57e7ryx8pDR4E>g8FL1VP+R z$=Ar>B`Nt-f`7tUX*YhV{NR@aJhq`sWh>Nfcwmh8-gVMs(%;Jt4wS1G&s;3Z3PflOR<-43Pj#0LMq{#8 zI^$4{t@N$sS~epc0*v~t@ zJfnY6NPz-?(l`hu3Qxok#q!*#H7&T|$6Zm4vdPPL_NR_30E-etNGyTadUBo#r9?2! z#*OgY+EP)u>*H(!5vTxz$PgPM2Z9(q`B@3>fr)__X{NbGlu|J>gI^6*1SkR_6)=Hh zDVPLe5{FXAIB7bD$#gv2*=j6yf9gN~FP!1sYwu8TAQ^y#U{AJ^DEhmT!PZ?nIoNvh zjm>LspSt`YIrHQvo@=cv{?R}C$CqDt{wMz0FI{@<8CG!`>gGb{!RMa4{)0DNHIc36 zsVfgY{HY%qji%KkfBZ*2`R-erY(?kd0~@#RYC&ncas7=q>d_zohfph}fXMqwDg_uw zshB*2=&meROken=U;gpG@=LmrF0QUU`^g`D)x6|x)tRuEgM{#Wm z@*Fi+r=y`~(qYI_T3ZWGNgT3AZw==e7Dd`!XfLh;i*RZ6qhI~`k9_*m-P7mO#ns(+ z-(}BrU8A?Q%<9_O+IjE8URQ-7TRL^_qHOlUbjf)nTOj~TMLHrBnw?}?Ts@z(7F{)I zq|HRC2n{%^gfy1xnuI_prIe8bf!-rxs71EF4c0TFpVg~^fvk+APE%`%K*ebqbUR_E z6Ze)oYiFi=JN@hLMJN(qW(Rw!)4g!zu|R1+ro*`(LImV_7|#h}bY@g>=ru9x4eG52?`mLGO6uLko@> zU43j9f-oPM;*(_Y;l$C=i15kRJF@ROK8%xo&9lN6Km0I`N$bPC`S4ASqayeNNPaZX z3;^JOJb2G!z?I}m_9gfde1X0|R|qNuRf21YPOwJ+oO?bJg9ipCU`F!JlOtCzE<7~D>0D_z?ych+|v~nn&v(;qm z%c{zXFlp5Jv^v-c>ME2{2cfMUcoqmM4na5-C7w~~0D!=IuR>#?8jU3j&$Eg~SdflCvwYge*ZiBcduP|V+G`2J;v)njB4CAQL>5wzl8t46taWx*S2S#a)iVU%BDoN z&eq;m))s4vNvj!AKGimlTdknzX4gAmA3ZT-?xH%05qB9IK#(3(tvkdA~klY^ZoZa624X$D#;t@pS4lgUU4 z@U}K8JurTEm=DM0bTUmk&9DBazjpiPb!qEJ*y3Q@XA{Bp;v)}cg`1SF60$5SC6#3^ ziRQ_r%!sqec3}1Z911BUS4_FF2iAto)}CQ=DTWYAK?aU=+RS>=;#I@oQb$s^Bw^rN5oiGTN7zxDW&PmD(S z!OnghCj`)4J6}&GcD(1RyckWwxKT~>Qy0#g%DnllZ@l?~?}jo>!|2U#eCO)7zBk;w zIoP~2xVJ@Y?p}ZUp{GBRv^$fX?RvbQM5@T_7k=qKx%}J`X4F?wLsf@sw5SJkvG%j>VcR!wtLxhP4M zlEruwh9L@F)p-RLJ?w;LMv``d(PIw_ukQkOSA|ekAk4EcIm=}-r_2vIBdEC!mQ{! zjvcrUQgOylvp94PCS*h*06&as#={QsQR|lB!@(HeC&)e8>?ok=eNc_a>V46O?|b3< zE8s&L>$&Cs;iLEO$q`^9;E8vh_ihhMRlVZLvjG2;>tndy*ve_sjCfF3}I`})@J zJ8vh~J+nElxkT>6Z})k6&JT+Ds0j{C1nij{um_$sWeLdv83aG?{LgJzJOYVX6aq0I zF*73bOiu-l3B30Jo}6PUnJqJcCr=i(psl(UzW42TLD1+iBm z@Xnz`1OaZ=z)%FDEb__jMm-qR*`(3xB}o&V%Q2Lw1sG-*Dy|%qgNaD8I7qqnQU;zK zSnEAEJFBs>KJ59a~Id9ZE!jQU?kU83ZGyz2wT%&;P>T`Wt($ z{g3|k-@(x?0t~kHH}C!g84e*5&&_-HKEJlBCo00lvk!mtFa4jt{fED`^WFa;4#lv)lMS}F zw*#dVvLo^WgpdlfmT|+9sj@*{jn1@0QD!xPVPT1=Dz(7M)+f<$M_AP%$1fe=9)MBu7wvWHm9I4QG{^%5lgc7)4 zRJnDY836LZcroH9mg3s&1>(hF7_U7 zEn*|yx_kTW*WL=6t>v@l!sg<1GRy}1B)s67$a?~2AoiY^53g&4;K^&jSC*G9FE7SX zvo406Zg0G^nHRZK0V)9ktZ}Y3j;s*TLU*;+EVO?4PyW|H@_TQ;POexze|oU96UEVk z&wb?OKfLFPngz-ru-3NMR_<)v+PuA8SLSd1*MGm+>HfpN_qUruPIpTwT_qTjWbY6D zq}k~i>on2s=HBA+I+MaEeC0de{`gP+M9FTvyDgO*jWe4Uk3IX*^~WyT+Wg7?@Y|th z9Ylao*LkP}G72TqG&=wEM}FpS{%51%_@KXgs<%*8=AGAGf8_DU@`L?A2ASa?2qyhO ztC>n?On=9DP|g*jz2^G)%tE@nQVsUacr=wR&!(fjZCBUrg^n!)J>|~A!eCfw<%j*d zJG+~g9(wHB4_}@RhP_i~4tBNyAc_){vMkCl42t1iG2D;ZUFSG_fB1U~%j-+arv!VL zS0S?^VJ4}Xu{Co{nz_Tw=~xB^5OZ?)2ng@b?mc3lkEdroywIDG!zWBX5a#hpDDGo= z@AIX2KLvgCfBfK29|rdy`oMi+C_IuG<6-E-;jbs&65(j}i03BScr>eY5`&MhT>v1> zs?ztXm`|ebAu;~JmBRa;am=N|JUEgF$b+xJ6*E>D&4k?qsSs?CEK-f^C9s$WLOW&) z@w6#@gD{RcXr7R;8)3x}4a$@Xk7Ci98Vk zDpV1u7)JV6=^*gVsvv5wo~@0WjK-aXwkgJ=@xk8y*63i5Ya40R z3buK-mn=v7tefZMFXP+;#tdRtbFfhX*cp(wcdC3q30=#i$X06$s zQM9liqbMsY2f{EHo-^WtxCY3HhQ>}E*;$th1q0t4Rj=(8H;3lUz3j%gR&nF` z7e0P=vGa*fJn_X}{PO128(;pLf9umf{};dgZ+>4ACymbH%9+LG<%S?Ml}?i&2#~5Y zkSxUD;DG9?^2{I*(9PHy008vB%+QI$OUnySKJZX68r0>e5rwuYCxe0Y&QlElj)9y_ z!aysn6{f38Kl7jctvnwe+}&`7279{^R7t4osyg@3qi?_b-EuNjQ4%y8Pz3(7f;k$nCOKcO4ZYv28*WJ~$59v*~2%tR~%2rYo)cI=%8Vi6`P zZt64vs@YZo5u8cNex zH0(?16`MqqFxfI<+0Jg%aS>bJvS1n>-V>C|B$k%z;%;SW~}AEDX% zOg2t{4j*#VheYY@0Xn`&9}c}T(+NbS836yi`>^-8Am$T*^q~?h0Du!B=R;o&;A1-Y z{>kNIKPh}4BQpAMg6ohep6jp}cs^nK9|qRLUH#wekk48A88z&fEV+tp z0d@*@if#&af^H&wA-EP`5j+A)Mr02_K*Vg=m*i`5HTlXrOWs;*taGk*)>L&>RaI?G z>1yL_?dsZ@%GQOcvbvtu)zsO_*T&nL$N~!n$x;awVvu6kc91v_AR-mDg$kHFFd;c$ zI-Y5s3*6Z|HyZ3_laaB;TT?k_y|1me#6(CQ$dMyHd*-`v~U8XWAKJP!#%0coITGXarS47_@79pVNtwtGu& ze&?lIZ(qCh&gyZxSakALjR!JxIL7Lp`cT3Jy+ z(1?TewN;IxnvR8MV25OUo!M&IJ9|a7P91D*21&cDZCMrI*cK%Ti9ym>Ki@jrx$?qu zryhLBL$rDO=2I`cxOL~|LMM?*jrRsom?*O7eJG`v&j+BjW~Z=KW1)NYp`_Uvj0dKw z0i`9X$y)#d@C=rLU@m}U6bvAQlu~-Yk>`r#>dNBhKK0QTKJvun^A8R-@4fuz-&niy z=*PeK**CxUja%RUzLL^9s;AR?*WLwdA9(iJFa4#zYO|r)zSTzm(B+F)9=a@TRZl0i z=ZeT3Dmzh##dhPlM<0IV+#@>u*pw8V$;OH*Y=r!V|yv zH-F{3fAY2I_8qeI?d!M4{k+IctJ@n5`^MC$Q7dJu(i(%Pl16Ly_RTlG^W8hIzFv*? z8=cn5>dM#u=YO5;4afW2VWfpprYgNRrZ%&ISI1yvB;y28v|HWLXg^w7>Yl!^xxM?; zXMXH+zxY>!R%1LGd*erUZuo2@YXPHr_v)Lk{K>y{RaoWaq<>F}kgZW#NF}VX;DJmX zM3E^?IUXwDY&0sW62N!TaB%Ckn~t09?r3-5%YqyUiH^t{+ga*3Lrk13EJm%4PyxG2 zD@0&lef$y`FJf1E>oXxzRMABIehYWKq(T7x&A5v=`g7|#y^n{hg z(R-c%$~g=po*WFG^?-l#@7}MKet+S3qM$sv5gsa{`Q*CcSb}_?viev>eE1AJY~LJ% z_sM9(m51kjWyO9YpgM~HO|!5)P*(18S71LOzo9=J8^dvgQU5*BEg2f3e&ETG3rFdji|XmBA8Am zK@m^)tz^4 z${EzzswApC1yXB}ays5L&md0BnkV7Hs(a=nWiNug0i95~CQZ?S!_8Xx+^$5Q%vn z&dLD5kF75~dv5JQCtZ}ZdGqcdgN5$m+WMt0{U?8YaPzHi{Ez=a8)8?5p(@6cwXs-hrUH`BB- zWn*z+{mP@C`pQ>8scdhrsf3EcZ~yym-MYP<9rVlblrY%1dxMI?6;mCArgr3rJmpz_ z{fDn-lbQp$|ISNpIt-c%ryqT)cjnBW{hQw_`~C6m0ockD=HqET7%Qcm;BhgMVHgI9 zFDvIs2BEcP*gxp+?rY%|ms&U9x&590<@cv|Zh2Ejanx=%>#QJel@7f%$mD??NY;sp znpIv8w|9a@^NYXstF2!9V?X|rm!5d?(Py4c+s#`$J85fS_xg2b92j&Zc$=GP9z?6b z!g)-Z#b6vL4ANAGNs;Hawox40ssJ_;$yS8`VpH$ky0vrty)aCc&t7!axw51(1G1fV z5-N6Op@ayd4hxmE60L>JDg_YeKu94KN+nSuN)@&i5hS?E8e=>*SC-OVuNv)}{!SbO zX%upq3n8d3?P#PKLm8%VtI<3KVT9FQoPM{NkC5Qp{`@j>+O9EQDi$74a+> z7zNLIjWY(355-nT=*K72KzKaTbA(gJSouEY_kQ4ef3J z;|XbE_CS_h%`PW9WHW|(0A?TE40I=gt(bS|B?<+IAQUqaTOe}II$wKN&w$n$XRI~W znz}S~ZjH6p)yA8;cD8o5s_W9#g)ed_Y`oWGy+P?YT15bZsTIK7fPc5H$V6?mQ&?65#_Q}s)d-vwX8*f#EdkbeSZSU;8 z{r&ImZEjXY2}%rh_f1hstz{@lXjXAv*`hMN)#a$!txFTeX;~DuHiAJSgy4Z$2pKio zULh-`k~lAG6gq7+JiB%hJanN6WbN<9_()4zLre}f~+;BDC#tg7`U`f9RHzX zs)9)1#WSZKd+>o&2qau@r%x<3mO@nCkf9g8{4=Z1Jay;I*OuDd{?6ui{`K!Dhq|}! zq)^`1WwmnY;BiT;HoddK&INJOJ$3r-wQF{=uYgW1Ev|H%*?8P;G#^-A zY%6Gl%H}y4tF#6om_aJ3f>6bcibQU`h~hX&tFm?kQJ~{cSB}HDMW#B~*($O+%Zn<{ z$vaem)*_IiD$2&{*-KA7ef5=B&Rn_j#b5rbGHks5_3ym(jX#URCX@2REv)jW5w1P_ zc)mY?s`e<#+E`y#b-u9FRwD4@(dhOY(oCgyRhChlUU~9KGcBlcWnN8&`^31sembl2 z(ZT-0Qn$ImZ3zBr>L6ICVA~PLWBH zl?W11OBUqFRE*qQSW*h}{+27oWD0P#1PtR?B?$`=HJd2d787PF;Bv+*nozL8PSgqS5T0xfr(=XE4FYi~@L01fML! zP85%bhdILHm^YpQjDQ&}df#l!tQJH(%=+$mOT}PtilLNPhHP#WP9=^zlg~QQiC-l_+ zn{D0s(-@hU9eYErWIJIqWOD#^AI-k7`+{a|-AVvU5GW+d06@>yNHb9rdFM^-opH|2 zYuwtJ+F0w2bJo_@*3MY#tasj7>*~_ig|8>x=Hv`G18fmdAc;VVFco1#C*7dA7<5iY z?Xz+BeB3=3w$4WBnvNG`*cK{Ap;1UBmDZ7|-NEkuU~6ON&een4*Y|I}x%1Ym2k%@R z-h5~8o!7Uny$0Zms@S;w-qzh)`E<%c&SvURNRUFzrhkQGfe3^`GDt=#g_1(Td_AaC z5Qj-q=@5lvfSKzwAL-L)|1uzwCEnTGnB00-Sq2>vVAx#@S_|Xh0oFwrr`CDvu(rmN z5jydpNJ*g-05+EvMHGgORv5=|D~VdIq}i@b3EsKNda{JzO}Tbzp?&5|Sr}gxou%bQ ztL@0_Z*QJ`;9T$Ag}u8s@4orw^v>;u^4^sip{z`QYp1`lIUbIEo(sigZ9R(dU|5ew zjik{(*tz!dx6iCJAA0fA*RNhL$3qriopt0_&pn`{Mv)JZU8~hvJ$-RH9x{NCN(kW{ zg+jCg%!;fmi?YZO1u-O@j`IZMrG~P|&n-7r7gVTaZ|y88aM^&zJDRE}Y9z7hT{^oN ztjOMZMyQHH$LZ;ZA3NB%Q*7N?J$p_~3x@u^>;L zth1FPLd77_dGuwGjkzkpnfAhx>Ms4<-~JoaXm4%aJNNW6{k;RQWqWC{bLw2!?SK&b zw{P3L9PVvpTbujuUCRc0&RBsA&M0<)l7W(1kWy%z%PV_es9%}7%-LC2Q#74V0+`AQmF9yZd z+pmebR8f546QA&5c=rcC{Nk_us_Jy!{I`FM`Lx>GYqwiU!}94f@$zbCrFZJWnYyaW zEXT4u-AR@^txlsUi8Vl@-6Dae&XI_`LG(eObkr#7y0*5ijk9FDBoLwC<&~9%(-$Oo zNp^V92VfSG0g9^1sytv)&IwP>^Q1rKtiFD2qp{FgxwQVhuYFzG(w6yTYg4(x7_)x) z+?Rj(KYHuiFI9Cp%5!H-ATa<^brEnaePxS+Ss1d`*Mt4N{=ID>gYjrg-VF!CtSD>e zSI?eqH(OP|uXW%(b~`;`jjty`AO!@~v~IT(U%Tx)n^a}xXxLfofDR@HdybqFAfiT` zv?d3AM_>twS;sApRF(bS%96|a@4fO8ICb~NX4-6DyZZW-r=Gs{>Ra!8@1;(+OVD`a z6Q6kavmdL2m2mN);f;5*Yu}jMeocS{a`j}NOfH2`QOtrF&{&i~0^ksx5J=v#vrty! zz1=8H$Q6xFTLnQr8pA9IfgOVDuC26}dQluSx((fk1QPlZ!OJKL(uNMSD@J6eKqhW2 zq$_Jd5O8rolO2UIgY>gSK-!Q>#c32Z+vw`Jost_}eE30(qk42thf?Xluu7NK7EfPf z6f8~-$R0OWVeZc_?!%Nr1B=5*z9S?ip5x%0XFkeU`ml~B;YrLn!mIlL_;8qMu1==o z3K&0#U56NVguCx+x8nP{!-sRbvphjQ!bv{q-N=XX;=^)uzS;5q;@n>Pgh|z*mh0pS z01p=@?{oGz95^BX$Lwa^T(%Ra`)qch-T||Nt}m&QYy}u02vG?Ufd~)-K*b<{f!GtF zcXsxlHMKR~88Wpqrk>Hu*3YV8qa0b=d4iaYx53)o4{^?u%)&w~RU<61DebZ3z$s zDy_9vj*JX-lqA+v0x4=FL8C>0QQD~UiW%~J?6Q%!jtRS`&N?#Fy}i}7(?PojGAy&g z*mCuOD=gE^t8Xb&1VHE=5LLs0FxA$zYwvvbo700K$#Af{n=CHLFbKoO^|#&_?A*Kf z=wn;kdvCn_N;#RXoI7QhoijR4O7ACwA=H(MB4hn%e^}&2QRSwtLiCL^DJ_kvV(H>j z>B>Xt;))XukLhT4L$iz11|qhb%?sVA*ANnUyt^SKRKva*jj5P0*#UQN)Qj)l+FyV8 z@iLp<{NcBwQ1|cLHhcFX3`4YF26OmJE54-YZ~*B-uM}toM`J7T%9M4GjvZNQfwDT)uR!(jC)aIVKSI#a@E0}E2gf>f+T6IUXWUzyL8rO z)Bf%ELd~N)*W4s0^3GI3LL*6A?T#TG(jci;fRPUE%jeEo-i^v$K!3(5Mz(o!$bGRw=LyYR>-K6B^B^;>WL;Dw+4 z%8&iZujSTH2YEFps%(;tr$tugj+_i-ARUnaf$Tshv{ ziwixfY9ynTX27)7e)OZyB#rdu+t*DoWmlj?41>z^xIcc!J8mZI?z%|L9CPn zi84-?&Y$kCFDBh~YjL@?yxLq|2pWN@D+C#(F?pxLIB2vyd5n^v*%g4I&d@U1%GVRE zl#ZjI+fi{6M3GVw@`ET%!z3<8w_R2HT38uj+(J~KaQ({DK@j5%V|fNQa2(7BEPzf< z*32q2KE~Ad6@EuTsFRIRp0nKdbFX*;tL`8AeII{(+*xG?b-(@#V6MpqIA(-TlGA+T z)eHcK)5XVv>Dek`e%!NqX|}ibMJ>&b8IF1BxoOrhpLL%Q{6uH`1d)x$hcVBBB=SIx z$uiaKOYj+z0k+5%*$8$s{|c5`K#Hj56J01~pvy!|L?j%sa~_-{@2snc9kU>ko*WQ) zA^^_}o{4?U?7;h(s8|S=f>|n|11YpnS_QFGp-?G`m_^7KvXDwhlnP|PQZpctm<=W| z5iv0nGZ3+x-)vpic|J8vUWPJR;)WA4!Pp@RLSPg!Zi1G@#EV3TBy<>Y<(MW?Nu>Z) z0H|0f1s*{#fMX|>W@h4<1X_TQLTRZZMwnT~2qB2*u)T*U1QQ9ESwkTC5)p;eEFlVI zls0q}gc{?tS(-W<=Rk})peR8yRZ$3L?Yv+X8bEz4J0@rR0~UqfxQHy>#)+X#aBmwb!ky*;{1RN(fJZ z_fo*{y{prm+h6=I{&&M%O#8V#7-oGNHd{t7S+F~AeZRBVQsGi#VNpv}WW(n__ak04 z{_Su5OJg!e6;Vyh?QRRX%KQ6OMM1@zFfA-?pe!rd$MmyL4e7b#$ZE37o zUt4M>8p#NSX)AW+7>ZrCQ%7L3q83%1VBA~u0^j(-%L_}V!lYXqY$G$1b6HKEoClOj zNUbCkwa=Z8k~r+GX2X5SH8B>Btp^au%&3r6=n$*YIAcwj>!?A~EOzeY8`r0I_b)yB z@q4!_n-`Ies4^RGzE0#NvzB4Lzr!G8piEWOl?jzl0G3GtBZCL$JR3%m5+t%9fyjVi zr_)MpGQ%768LymS4XfBdcQII0;?NTtY) z#{K?ycWGg6z!h_*ec)=U4S~ zkd3CrV0-V4Z+?60V85!(&W+brdR^yvG8|cVb!}~VIGQ-m#Ga5UYj1DfV-(Cj7>@-x zsW?!YPdK+#!PZ6|46RzO^2yMYo0D7O~1s_RKiON(b8 z5Bvc7H5c{t-i~j$w9^TU{`T+uPc~_sfAWcsz4#;5^{?Ih^RH>^UG1Yl#Q}F0yFv%X zKwf0U{s?SMNMJdn00M6Rms5Jm8D|XugeU8!bTc) z79ea227y8#%P0!l&8XSS`y*47LMz>DGk_1Y(ozMIoyRyqZ-uu|3lBb7SQ71?v!1Mx zE=MF42-R*C{o5M7SUD>fRhGzPa-nRrD{iJUB|9gh_f?xq@kWC6d^OPXK$G*vKg5Xn_aGV z*zBR*7p^a8D!@r(ff8jPRD)FmRZEH{V$4DlXky_Byk}?07;8;EyP2vqbzK{4<^~Mj zJMWx#-gxJ{H_n&jXQ3=W=7rFUvB|^SqcAMP8O=S(ZhS<;671rjyBJJRXflqpT>hqIA{^sUeIYZDON? zX&2K4OuLYDFm9oaNN7gMAgnV=Llj3!MNq!1cr*ecaASuk${D;-2qM@j|9Vz{{k zoe5|b@Cv{J1tOH$bhvSMym`~*qc{vu#UhMkAgZcjqNLSfrK~3@g$}ilLh6tZJQ6b% z!+t&8Pt&l~>3UC$G6-YOZN29M0%mbnhG*$5kp>q14PwWG;UffEwqq#=+OPn{;I z4>osvSs-|=Bzxy-%ZN;jOlCTHl`8F=bMuA&6br!-n+r1}?%on+AbSwn@NuDgNHG9jWo$a-?l?#tP zvw!In`Ne`tsz@i^)zGlm8p%jhzLZE z=40V39^|S30Du5VL_t*6L204#U|Fz~B-M_^L19j<_x{Fz`fKB@J#B{hU}t4*RVTe( zZz%>0ooyfj`LxqI`_xC=bkb<0GSm-0_q2?ID2xp@CR0<_wHL(kq%Cq-?lx-8y( z`_0y=GrNP)`9~fuL^!J5s1SMWtcrZn+AHm7T2E_NlJ~x<%X~N*uyf86S*wB|YIVL3WBC{zMsB>@~tY_w9sz)kn`=)!)mU1=qH463x@#*pUjN38*SjKkQ=j6i zXcTo#q{E=y@=COpR&vi_qqVlY=!s+$rky4u0%DaH_wL?iDem35fvyJc8%a~JaJ8?? zLIt{Zl?npsOHI?c4Q0dh6?~E)RMutLP{qG1%L&I@%wa&3E3A zT$R(2lt5(astl4A=pdg=MUYPR?g$~;r_RI+Jrq(z3CaY6ltHjDMC82*w2ZVQ>wv9b z0`fr=Ma?D)KpE<^CF9P*g$Kh{TkA-MvCu+l2%?^hn>vkjtTB)}ZHhqYP(_VYVxf4d zv;qJL3RDC^6m@&dPU_H;LvI4fs@dW+)y;)y@zm-wFFf?g&n{iKymaxAwJT4yyGu$3 z9*@e*xhQE~p7Jb%a1KBMfWgme#QV_iX!eGWBv(h47>C^J2cI>c&N<3IIN=6;jO9m; z(6gOW$K$w%Z+Mtk0LUlz?c`eE(2?W*x4&O1eYnh+1qvQpaKOpZ_pqBi`;lN?;2-kk zhwWrW7R*3?7I((p0$ZSpeT7s5RY(@WAX-ELpb!N4f#4t%LIT3_$64^-x76Ki3 z=gYjzvWYX!kd#t1npz8VCil)bL~pHg7NrovhjAPy&FNrI>!8S|wWrqdN>t^sl;i$R zUNahzpPNQ$d;Q^uH(nlyiV1-|5J)y&NJjLCGLm6&`^`9MYjT5)Ye5i56jfa^I1xvq z?K?i{=1#nG?e1^?!~gedFTE*iD|7^|_6UWN5;|VvtX(D%{!sLXuVrCaJ30l%~dj zKlha{qY7``xwU@b+#?S^Rt?85|I6Po*~9_LME}TN`uRWq{Xg1%`<8`$kUrQfcPhW;j21s(80kQuYA84?N@mrw2nf>$opH{c~P#N zzBsshL--OTwR(#@oI;il`hDkW91eYLYho|7(&*S5Qm%4UHSL{!JQ~Sz_l~ocxgOlR z&PERRwnCtTcV2Tv4a!Yx0x7i$P)KQOQM@N;?q@IVj0cHV-;d7X)bhbVWbf@WkS6gZ39x=-zVSWfZ@k@ZQ9 z*KyGZ_s#iyfJ>ei!F)J|bU!J6yy<;Ps`uGw&A8?dm~x%aGUHKKcHaFx3Qd3$&W`if zM;0fIn&-2`NB~UUc{5_O4|WW82xbrMF1mrF94VJ*q(Gq}AtI15$`nKhA_NhE2mu2I zNyN?>S68mgOr6!mxGJW$D(f;cb!kj(Z0()%&N=7Ev-iaFVOc@}LTI71&{FA0=}?DJ zkfdRw6*ZUQ_Da$@opjH|?bA_nHHsIaxTS+c>rhG!QqEce#N?Q*XKSe_O_rD0bUGPN zCX>lzGM$Xaqw#Pu9A@J|o=u8rmQS{3fQhBJ$7dUgP z1ZLuc-JR{*H>%ye2t=TwtjMi1L8!G1!Z<`JY-yDU5QVREq>9-K z?VD_DttV#3078P&B58W(L12`orp~>okY!yKMLA^DL~3WZWN&cK4PS z7L;Ns1&~Wx?WEb20?1XiF0#sJiy|dob;5|8KQER0~bv-2l z1moFwu!IOg&n7(qj6YteTI+7SeKi{#+o0%(>k9n4FTJG0W(C;j zwIK@k_eLU!^C~N{K%uF3huslee>3}8?U}pW+j6ts`BzPkEETb zvAB{p8oM`coIZbHJRIvlD-~XP;SNzzs-wIoJI766w{pFjKX zqg%H(ioB}xy4c?>hkIHvIj`Ag`N%n2PRD`NTFM{{lm=5yeO?5CB4-TQsIwr$rgL7W z4OCjCiAoYz)gA$*L|gm1a*l$uDYOJD?7DU|{-Ll7264bFMFibt`tJim_+k!Fh0qYT4Cm#De$>OOwM}2@sx)O~>$)zgswk?WEc2``GFMl&HqKi1jvcY*!`0Kg7C&059IsvwfCVDX77=lh zN~KX8dRie0p=Mu76k4c22qlybqiD7kCZd_-YPJBuLt2870f5M7(@B+AqGlxl1eZna zowG%qAMBZIj7mD^oiRSo^X*&3!L4#QsPY0OL}{o5#0e~)SxFXqGEIew1d+l(sQ`pz zBCR8-0v$$;g$42?09uXi@ZRQR|4ysh%Eki~sI-wf=c6<>MV2O!b!_qs!4tC%AZVl_ zY1^!5wOdhViBVURNmU!K0tX;af(*j6Q=58x(7$`_%~U!txy=rQWb1rB9>_Qd!YCUJ zk$g6til{RgjLhUfO7YYuKG|JAb@#^gIv?*Jj2?L4!JqlrpWXQ3H)#94R->UMBU`OJ z)O9{(1CdZFx4icBC)b{N;@&%N1w~Ey(B@-Pdt+HLAd154N=B6kM39=w?;BGBI>w6F zBRWPvfkcL&Cb09I7h%08AoO;;ySshk)~nz8?)J@F#bB?_b2eNX8>UU2b_pd`bv2n( zc_t#2J6F`!dq>P3!2nq%OYB)#f{NHOGeE&SCiG$O+{d3U4t8-g2!S<#H+5E4ld`gv ziK4jnoGkP{@`+D8`pn~HR@{8$HG$;G?%mtI`^GDwR2#Q8b~o-l`myI8|K!K-?d)B; z@?d{&S4KR|Cc-gF&>F{k`wu?z?07J)N26@7f9k^d$3F8JOR#f$qa02jxNxSs&~=V& zIpJ!O4+m#2J$UEV&EDc-V_{`lac6nS*_w^_weiN7GEdU57$4Nr>2PN!J2=Qj2g|3| z+wE=~HI~k-Day4{LPlix>MO5PRj-{oSC-|?x8B-#=Z3GX3gbA8u72;O(eC!Cv*+Ia z-pk6?aeJXEGo2)za}WHb|NYc>Z$zzjv$=BS(Z_!BKmKK)@L*%B zzkSn}MKzrk!!cRAbm@|4wDXb%S#3d8me(J+7&JN$KK0n?OK1PvfAIetjkANT+s;%X z2&+7|#xJfcojre1$1N?j5EwO^MQP$FVplm+N~Kg7s7SJ;R=e3-TJ+vWN^2DvTb84N zw?1q)M}q?bX|imo8Jt`1SYvWyg%EXJo4V8}6^StF#I403f~qvODAQKM3jq)~l2vWf zg|3W46(yK7oVDznK*8i0z>yEqw6VMzwt8`QHSVpZD{JxcDb?<#%gb?RA!)QxDJ8WQ z0;CjTc3stg5`<)_bTBvFVq(Qy zLvWo5ROe9zhxW@SL2zCWA6}!6by)J(f8*~RK_1Wdc};wA`w9#1xY{pOpE~l+(JJ+OjmJwpC$m?HzhAW>EyhNDM?CzzHExY9T|R0~tgrj8qis zxDlo8sM!sh3vqKfZZ5^?Vw7})s2v2&Ku1z)P)g3+x@SI?C(ilN!2;o|q9$O^>^;@i z*2Y?E$$4v?cg}m772(!-Z=LssoMq?16EMwe)MjUlXP-LaETU*O55|XqjeI!xjEK&9 z8Hg}WgwRqcA%s9R`|zcZQY$%IJ!+|Spj3c}%>FoAX+}TK?J8%B2y)h%vNq!(Ra57^ z_dd{((5W$QIxTeCmMU;{RrGhK+nbZEJCptWet%dO<5b(mLfBnjYOI`5aZ?6~5?V-E z)}^&ROk*jPDN8_5QNSp|IAM=Lny|ofFtKG;9PGzY(CqcX=0aW7NOjamq}Iit?<*rw z5V(cab*-DuRNd7z5TSSMnOMnqXawh>ax$Lw_k5j6GVMkJXMD0D&Vg3^ZBQ0bsH+h)!L& zbm@twPn~;Ux}U%L$A5bL+g}5=EPUDu!*=iPjeDM8>)z&cJRa=al0mqA>)sFk-5)6Q zAc!3c)Iv}a1?_Hge`~uKPal2Zh0(A)d;Zd;XI{8>_ukU_3WC1#_O*pmYpunFy}P#t z8@Gqs{V0qdc>D?W{KV7GtY3Ptc4j)AR<%ba$>=TFsw(r+c?y$;XC@FPE69Oob^eiu z_HNuLv%&;IXysYH`{rA(ed`-9{TRoU3rr9xn~LU}1j2_$C_AqWBqPAC~_rF0M^VP)%SQ6NE;PuI__ z21%S1)wn1o#u`KdDF8J8O(0Q9K_0SW0Xf3U19qCXtmY0&{1<)FG;F;`XVhzb4 z0v4zOCs?LQw6KykJ3z*vvMel8_sqH8>S-aR(psuODJ7JUfs{HxrG*ZG1<#e88c~82 zQbj_ChytZhGsX@~5J_eQ&W1tYoV7}5Ax0u%WtqVh$uivK&b^w z8G#63X49gz(yFHAs8jh&pzNR`f9ccLYli+&(}bF)ISg?NboFf zS4gR~);iEZqO_CJk?>MF?;Vnx4VVJ4_a0`uPJo9aKmZ;<%)MGr%sx3LG1Ke`acHG> zXcs=)m3%UZk`#niT1%;Cj>ZD#0E{SsNeB=^Far}K2!WoMP|SXvdv5b=p@$fRK@cj8 zv|+5uLMvWaJtMnk^DG{`v(E=eC zFFlYS4D!Js2vA1}VWgvUG@2IKp2@SqWGYFeHH=(3Q{~f6+9V+3Y9;k>zu#;%^0M*- zR(KTBPO?UKp{R?bw|4I7Pk!T1zh3Qcojw1+y?Y1$;=ljLqe)eahNdWcO>ybr)8l{I zpWL~(bgtP-OO4h!8Xc5*ZdDivg;_Ci?PmY_)!X0uy21#V4b9woyks^WyeSAP1tPa( znQ|$d5RTZf044i_RNH7z{5rFX$eWabS(gD_0}L%%(Z9FAjRCN77ukIvkzV|O7GG*tx8U$Z-$~a)_6uG1aPAfOf9QMGiao5 ze*HVuU{6ySM=fh@5U2}}Ji9*{se@5j)mNT)?Cz~iq1(g#%+@aLESu>#iepnv8%Y>M zjnTLuke5F4%<6*=?`-S^q1fKM)w}jq+6>D{@#DYvbKm)Q|2_^ynkG@Z7e=l13(MJX zFy3nBzqR_{#e27I*gV%kK*Hx`?Tr;W%lt? zU-)j}hr=$Mz^12Y< zDwB4aC3{!ed~iTgo<8@`WK^()(cX4x-Ojzq=Ekrx_1@iUokknVY1~X~6p@r@{9CWS zlPs>+b)AIay^W1duRATL0$50apsTD7V}%$1fI#VOR!)mnw@ZPDp;en|nol2i^6`x~ zUZWt`>>DAiBx#8p00L;OfgG?IZ@p^?pZ^PAQAoGzA1Dsk2WcmgNz_EJ-G{a0JZj)j9sI$1c)rD9{Yrd4bR9cz&AZNX zU_EJ2sdygabF%E5dGnvFWRGH%W_sqiITZsQNw*H$*hesm^R>Wn1Tq{mn)eM#(Hz+C zXRVL%oq;@8PK}4PY7L`S&wEFH>W!IMIa+7P8gh&5TI3n2t*8sju^<|VR93Kpji+hGSKWB zA%O`{=r9yIz__K-4)u5JbYgmC5@6iz>NLvwTV}dP1yz%Yv&Iq^)+>cer%pw^HIcM~ zMpH(K5P=X92$?a61WHmWLJUn^g~LUXi8I-HIU!XRvhX&NR@hu z@q?GI{+GX5j3!0Dc&jw-bW6!%G-OH^0c^V(=dAla2A@M=V-(&MOinP>))O-kRE`tOI?G%!8m-Mt73jSu20-FNRs}$yL?N7KDVRxQ&bM_bV^y=r2sBZwl)ykE zd4jFI;j|dFJK7E>L37a++4+Ya0RTJ6z{%cn^V|bxZ{FOP8B~7yr@y@U%6DG-?l-a` zt4!tdQPSM{ZfP`+gTZ?Pmg;ifvs^S-a z{PVZpez(1_vV7`6WkvCgK|UNtapU1f9^JToV>sNaEcKQaoD{2eXi?z!iPMLC(ibn|Xo2Y>i4e{Xc>_S%`1cDGsP1(+(* zYJYoEl4wL}5{T1lOS?P!24yYOd#}9~#Bojdz5nX#jn3lfOHVt1g|$Z;0Chg5Py)y> zN>(mBNO`_>^TvW936wOO=N^7YO7-qE=W;9r>o_49)OLyj1jzU4 zWGvmj`i7}0siLB&RUl1K)}Es`XL?N*#djHtsfPErOU5JHDqYmLHqCxw`$ zk6VifObVGup<;IIJqbx(BC`s#3^b}lfMg{)=bq*;eBy;qude+63H#3=$+g8((-E1~M1wjx%p$a8Xm06WKGjzCo@>6$zyyqSsRp{LS49JXh4}b5u$2<3& zd+xcXc%B80^(J)`$R5xmkUu7Wu2F;;>Ob%?ubZ2g0X!fza9*#5TW~1N*UbO_UL|m> z+SU<)P)}_xwqNJ8_$NGD{N5k@qvM3+<0Jfd6L*0nBOGUL&7!l8o5c%S@@!QPE-Z;S zE=W#>Xv{$NJ-Tmo&J=jI3}un+m($%cpXwqvRb`E_4y~8Ylk;GVbH0f^ zW&|Q3h>%DIfe6|Z1R|6wOjO*KNhj*8M(uvw-H1D@QF|qfdqLEZVN0qAr6eH)3Lu(Q z8pq21jD`Z%tBnCf<4faN#nGG&HPuQzWz62QwcZ+ARi-RUYpi$1JI@}NnZ4nr1zZ25 z<1DnMEl^)vn*RlnPBse=5ebEyHw*xX!3TkigGhy;kUU9rc6hy5S3$m4o;)I!{Ld%8($f%V~^U>aYa4sEYJI|MG8^mX^wV8n%0@=T7Z?_`!Jl&i2h~RXP*^ql3c>k6u|lb9!lY zHR<<_#oqe*-+bdQu72-(VJLI&=BlXlK8(zV`TMUVZPa_wQf7R_1AM^)z^jla|S|{OE9f zYpX2NVv?#b=&r9YvPtueQ|k{t@zCy_ouhkqeU&Q6gvp>Rrh_Agm~?xdpmKroz-rq+v>0PTm7YYsULQhf;a|JLPb&BLP0=Ms343Y+3Xi5&z=xTh&t6($^ZpP zsSpLAU?P%INFkJxQ7prx)!$gY`1s2C2Yagk6wcEko4zL=!%F=Jsu^T6dxQ&u zY-3#h_;_zKrUUh(5s&Zo#|_(sM+3kjeOv_ASre8J>o6*A`p8W$lIwJh2KSg5K>Xex z{NX2Oia!Cs__1Tac{~O#a{2}zc!7ms!-iqLuV>ybo=0rq$xRHiBBjA^=WIIJH`#XE_Mk)+JtdFP#F zZ>_6LRT-zXW^346VD#QH+u76W3&6-V@kLj+E$Fy~F}rNsqMOgDUvpO zwx#h7EkMq`C@WhP{q@$9ufEvYx)^u+L9!Hgmx3@*K}b@dAS7f4p#l%&jFUuRr`1_r zHM+1~lMskX1S*VLLIp*Zm7^m8-s((}7hz%qLwzl@EFMbhJXsc3J1$$}7S>h?No=l1X1)?Qa>Dy-!yfBhGK z?(Ofr{TKiApNvL_#u}{+06p{B&%FGlFJFD@$9o^%`O+`{61Bqp`}bb^gRAz zjt&p|%RQwStx;hw%QI8hwR2|=C)2yPcFsTi=-_Z1wK~kEnjSv<^b^@&m`(dU#-+)!q*7-j9Ru+{0Ja`aSRR zJ0D(q>9yCjF$eeWby{%%ECp$8KK#*}?|l2)D3`5<{O?41mC1?{DN)aj|H#q6!sttc5E9>sBcxO+Rl zf4w@oU*>76(=N33BsnHXa402^5OH^1NadXYB2!od zA_V}>Tj#tdLT`<605SjoZM1Qm=9NbZl6KJP2=K*tSm~Tl2yjR~O4?Dk7j;+K%Ny~^ zDgcs_DpcNBTb6*H6e42KX@%`DY$e_GUYMvbNmQtih)IzOf*=$@NI^tG0HTmmNlA!; zL>L4p2mnb)5`;vA1cFGQ_g)YQK|)AH5^F}U!m!;_oqlV1EpByDh*ql=$H@#*7C;AP zF_H_CFV39EctSho*{zf3kDoyu1E9dBBh$+W~p8ftWTt69Y;yS2|v~`I4@kXV?Xur+J?Cbef(?&A*3<7 z%Ep99LV}duv$4i`3$AwTdH^PrQc02|gO&^v5r!(R_fYnu&U)NkPkI|kcRg;eg~@W5 z^i)lAMF1pG5YUXWe#`?lI|b3m&h>7C#^_Xk8i*0G$)%^}-Q{CT_e|eoW)JMyJI}6h zTzO|~4Qb4X=owudkTSnOjhVjLl045VrRFG!>LRQ5G}nhrI0I)yA|yfrkdlQY5kyjj zLI`FL=-GpF&N+twQV0a9hp%RAx6TpujfuPY7x3&67}!@;WwlO^22NWFJKDPO(O`IV zaB#TIA&T~rbKcqVu@{~`^XT(3X@_w~#qB6=k&sx6Q38dOLW+9zhI7t4XH4mw^TaAp zrm9q+9H4X7OMy-d?%Z-Zb=HYiM?|qRh8ao8G%LzH&vkxuaNwCvJ#gx8|L)&!cl$^8 zK6>p-uME?&x7>RD?|e;gPNa>oYnQKFc>c>{9jskAJvrF(RZdbcvLKm{Q>_6zXDi3m zc2?d?TDC!L-YW~80VVtbI0Hrqzr;6@!U8`iR!kn2L@!{QWT+! z2@t#zMCh0;$kMuN74GvI^$NBEPd&Hbir@GXaAHEz0cyRC5 z!JV6tvH&jWEkFLsXR_RyQ93z18Xb)9-M;_P)oYJG^F*f2{_at?yBc;@9{<7@3*$#S z16^{|-_YpOY5CC8&s~1%iKkwEdF#TNpwn@R4sYJ-_m-dj%%`JPba=3@ol__zQWPe4 zu3wj7xV*M{`-2~!x$;m^PDgutdNTC+I7uQTG$it(3ZwR!%a?~c+d40#R5A+Cnut^s zh73YU$+n7vAdEXYpM-kE`LLeRCvZ3Z=FP(!HxF*z&bIGH;9GIuS6(HtZ-v(Rb5A^b z<>gObdHGYLgHe$eQU=}|WS6Gp?%myPuM3{rt)44#sRBTzKw{F0+C3R{Hcp@2+aCbQ zBx&cyCqc5jyc~pKYpI(Jk4%wg>4dE!;-(#lGfPt)l@yD|)A*y#qn zKFI(jF0U_(Kmtl3m5_>rAeE>v7DA#_DvS_ON=YP;5Ty_@6hxkz)BzzRH}@`(qP}(2 zHdav&Oa@^rWgumUQYsY$DpX3vaS}ywjeqqJ?E<9LHe+@*X=zHCWaY896x==kee9CIv;8l^2`g3>V*XiIJ2}iY0cvI{_r22faeA6 z8W)guZmorxoofCUn4j%D|9RoXj`uFiy1YC;_NJM9y#C=>qn`gAfCQmbWtF-zM*<22 zcnkGjT0ta~kct9@VMt+H#+@MPhwXmUU5&dNad)HDT}#?4LDExETd9OpMD>^uHPY+C z)`%t(l$uWW$4zc^L^WfrHqTFKuEfvFjQO&N<4X>Wj@Te-<39tgw;gyUKoA53RBQLl z9vascBGet^rkjs5RUC~F~X7=p8m6FP;$fgsnDwT9pt7k!N@9hka?z^f8l6GrpMVDE3DS6`6 z*OQfX5|Id7K@=(_Yw9JXA|btZK@brNAn!ca)qwZbI|trN$yJ#X1{egos)Tp8EWPz{ zXC+$dOBD)`M65kj&Qcga7)>WxC~$x0@WzkceChL_65Zat4{z+;xb{oG_SOAq+702c zXP*4ifAasxcRpO+*gW;r=k8p8-w$p_QJ}(>3c_(VJ@w@0!tUu8zw#@&kjodIuUx3J zBN?l9D9w1>?e;q>Yf1%YE?o@6mNRbq+S_L~+83XGVf*F>&wlwUD^I*~=BXEMzxSiw z*6H=fpGynp$|BQwMwpAhOXa2XLV*w{L}jhEn!T^l7Z|KH0nvqx&80Z@RjC9CBx115 z0}z2PuC4TwV3g*yif%pB6KWo*Ms&km0XRg*VAyN#40{XU0Gt2LYAess?e(RMbX5}8 z9~EDJEF{5FAQd|TCy+^oC|fKda2nW#OWlW_dU|(fXZOZUnS=&pyT2s@8MguiZY4>l z)t*cSS{Grft92zvg~_t6%#)va{Y$_6%kTWu{S1gekFqcS^51&yv#)x`@4s{P?A8kD>F%wY7an{3 zVE@oer~BLY**Rylx5gs`Nqc{HZ>it8|NcAIzyH1L@QA>>GWS~RVw@KFRD+P=BhNgO zPDbfqSWGi(U8qzLsBAj6rEM?ww$7g!+`Vs5eD*hf>np$WJKz82U--!gS?}Dw_5SzX z8Vu9q?6X(C`fKC6H;aS4N`~X<^p&6a+L>pbJ>0$5>Msl6elNNI;fH}#Rhb7WbY;m# zli;&wPfZ3#mC>LS1ffF#{nfbDcX?VA#rD1JmGyODgHspIzxeY%^Y*vD&v`17L?B_6 zJIm#?lmsLsIYRU*kZW6;*6MULky1rTWW4G1m&>9|^DInSNMt-Pk@pM?rFE`Wd!4OY zP0m!-mPm?}+I|16@!tKU(?t)0lpv*|ShU-!)pqQcR(h>o0wjfsq*PK$5K4uy3<8pY zP=Sz=NJyn>f-9sDLNvq^oDc%*VGJ1{f|#k(03?)RA{8{bl#EP5NEHM@7=%%))eeGi z4o`e61kV$m8gtTuDe3qI?iX*$bDUbR%GO>8n8i^5BBHBFPopeD-S0ha3(if-yl{_S zs0WTZA`vDOb%MAbcGjZKR?i37MLf!wj>JUHAl8Ybte_L*xNS zpi)7t0s#v|Wb{G^0IEZ~yq^cD`nsJkgJ91M8hc-NDcR?Fo=v82*fn#>;8PP!<)(V!r19UU1 zBavia<6PWox4J7;SyW|VOvT`t&^s@v9+>3Km^LEngaLcc%qnb!K@uP-DJWEsbZ*_e zdGqbJ!!V3`U0`Xoak}UxK_C&?J6Bd^<^fJU^tfdSPNpRr;L&I@+`TtE+P#*J#+c|U;N3R z|LD)Zx%1u|KmO*ooUNXH?bQb#z4-38|1z)KaR1P0`r->;(hl!`_ygys-L2DcXJt~lyVq}|M|*>v?R01F=6mmHUA33j zozD9GW#^?f)__mbTuMl%BgfQR+cYSj`s{1d!y`Q&qt~X)l?alcg<7Z6$z(7p^T~8N z0_UAAWt1=r0u(}OZAhx+Gw1SrIvI@|paUukolVA`eH4Z4JR2=3^o)ewgLB?hMgx){ zNkQlVKnC&BR@hxFjGr705ANLR^jA@ca&Ta)GK_+_(_ul5A&!HU^(B%dWkjS@5TOW3 zC8$)rI=uF-k|ZQaLI@#+41`cpN)m!d018A9f~1s$^+S{pN(fo6UkjtCxjT{&lIrou zAP761o|LNgOV6;aRu<<7${+I{<9CMAaQy6Ap>FDjg@d2@t&S5Y=dUv_ zMC#H4Pm1`*ERkm5wGc5q0}~=3VRR~lmticzwv75wdp+!KB;8Z3-d5CJkJ~Fz+*46U z1QCg#7CE6w-l|W8v4PR1Dp(Yo=dV`dC2>8seOwNRd9+uP5ITEvkr6;3)+;#Xoq&0% z(HPNcF@zfGED!_{NfK0l1W6D95&$91n-7hdps`@rP1_otYO~&P`+*u(T`SJDpn{0N zGyW_ZstrseqzZ}Zbm+Pn(=0x!r?zV1%kv;;=2|2Nz~8FoTYoOB$!i;q6oTipudc9bM4O5#>KjFTF783<7XVTeRR2nJ-P`uB^G zJTswSW+KvMZqq{mGS&^Z?+~%p4jG69dwaCKQyd*6OI;a7?WJDQ?vF>QsR|`HZ1*T= zb6Ewhxc>eJgF!wiDM;1{^r;J{*B-d^@FVBn{^qxb`v<+%ershpFEU?L`*%L5%A@|N zi;utltM7jI8%OW`rvP;;5Wpanbd#|}^Mzmk&2*aYUb`Bttaf|-bmy?uX|F$U<>21k z@!`=2-~Eow++;l6zjvF;sz`HYA&|6lj-(RgtIAt%yszU=EwfaTgtW#yy1Dk*M=ymY z?RUFZ9)GMj+@aCYlE4*7Yglbaw=R8Pbj*BVy-NgHX-ZRD5-gu~6JfZNhv?@Rs#I3ch zR;ybUnIm9^ba-fVX{-ZVIjgHOccze1TzdS8r88%PFdPmC{nHm7ed$xDFPy&d?i&O; zn@%W>A9?ZFgZ-)X!B>9e?|6Z6sLotEd;8kWyH{^x5{-w${o6NmHc^p$;ft!R=0x$ zI-BN&)sjTi8XZk8Jo@;PpZom%53fQ#@m zSKsS(yM`fIT9f^=%gd{Fc#sb7ftv_lo_pj0soEFz z$F|5V5Qi~IH65p6JJ>vP&T;^P;&y*{w10GOo2&+B06}%SlfhtgG${&BVwo04ajR>r zGnVr-jY5SC#yAlwr3Bcj%F-}U0LZ93%F@^@tEy772V+W*Sec4h6A9<7waz(fz4ZX? zwe^(?7o(Mp_Qq+iWID|)h?Vo_I-8s2c!KQWUgDi0a!V`y)y=+)C6W*-A*p}@3`3L( zNeW3o*wBO8wAlv+z7*PD)@Bh&;B!A)y=g*%dV>M>6`B5%flJJ-!!!a+06Noy~=TA;0 z!)z=V8$o@si~&GEDU}RD8OBk2Icjev-L<&A941RD>WCl~GC(1LL}M$T_mN>?78(%< zp&?(31xD&(1XO2VH(6IrDM2LaZflb!30#j7NflBv zwk(+0Hv!nQ0Ib=RUA-02Img~N1B8r@J$rAg8ILEU`**9s0V1LdQ7Feifl^7rOxC$D z3NJnK@Y3pf)M|%OD{i-i3ILEu0D>gR3`zuAE51 zAc>6DuBtqH0QOc(653P;`+EegySiK%FGZM62IP#^Hg0VoMbpEBVmv-NI$XVYrF-fj zXQ!Wg{e^IO?ce^t{)NqofS|}Gqy(^4VH?p$?e^ekKuNfN>+R~!kEB3Ek^t{ zm9rjeWkM{itf(MZ74YJj{)N-aX0QX=Kb}vXATYq_UJGUpugH(S=rE9 z19*WTkO7^uIv=G%iuT&t#it);LYL|LmXt^Y+TR1ImxK zL09Z(f9KFyKO7C0`pe5}%eJaoovsW601cj^?rLvyD_L4&XMsICosN#id2SRrKoPVq zU%8_5(Y>qh6{90(O}E=Jp1$^XfAgJdAAR>5-)JG*N}D1@V0Io1ItWUgD~9py8!F+? z{oH4w7Hr?VzOr#99cMONCK+Vo19ra3iZG09p%FOjwtUpm-cLpYSC*&FpOazabY+}# zwhCI^-~R9ZL2q^a!#CgXCiTvVFa+j!^>Y7#=eqs1fY6i`AtFgc#xI85lwgJ=8e%R&huV8XrIg-#02H#G(`XvWVHCBJLvn)@K z2Ki*-tY;t!LdJT%BQqd-A4suvX1%wz7AI|Fj>3opv1fo<0Fcgm1W-~2L1?X&QZfTO zT`T+~gb;!OWDtq4U8K`=a1g|C(qHq&fOA%RsR9+nsKT-^M|(THjdc!VX3h=|L2EX7 zXJw6&rK9`X6vTi+wbxv9?#(~@JF926+Ur|+J}J`C@NhgCPHkD((v;Il zyB!%@RvsLY5X9bEtDWbIk3Hsy2BT4+q*T&*cczs*y3+1I;q$D8PF3T;j$7o;K6v?4 zzxb=N(=u6FRTU|9gq4yZ04SwM zNCpx?yVc)(^o3_z>!*OF9uJADZogx7UQSBq5u8Tn*t5l8dE-ofbydb)nItPKy&wMN zw~EoEzq*o-r!oi%=WpM4lyW$kItp9;<)j@kpbA>c8=Fg~&R9a9u88BTGQ!tJQ#lGJAX6D%wT6%=)4|eu*OLd z>TI&Ibw+hpw;p-=Ft<^!KNyd}m1SC;x%|+rAKyIn%;zQthxyJ&Dvp4?&MQ~AXlW_v z_o}SadD>fE^^8K$!TynR7QySXxNz?D(ZSx}a7T)0ZDV74c$8044}AWKr`FFuoE;sy z@m@CElR~sw9T|x{9kWMkA@F=kV@8LERi2FpN5yoSr&DJtD05=dUtJ~uu*KTx_VU@Yh%8ius*6Gb zA&J`NEQN|lN~$M51)(4$Qc@xb60!!-dc`<3U!q|zg2FJwx(_ELB6{zgwKYx?VdG^1 zjG`z>T7tyMunU~c_RJ?wcs}j3fJF=pel|#1x1*atshM+mfj&0y=^K!pjqjXfkjKFs z3;o79n#@Vx%m_^Z+YZ$LfzipOVvjA!#H? z0RYaLCIN(-(Yl&-JFA^7XKSRrXU_oMTPY}NcN{=An&{FIJ6W&uaaKu>Nzz(bi#q+N z)#+_+2CXA?Uv&-rvx?O#84@sx;@VsaEEap6Q|Km@TaN}W!S zz4z|aqn{~Di2PVYNje%!X3%bVb@}|m7gZQ}#3A5$0RppT>p7N~AYVGY@#-rtw!>hh-Oloi8P4|F5B0)j3CQTQ z@vaJmkEB(g%k6tK87k7~t9Gx;GGG7}vMh3I0hms&_1bZG|7bF?b(g?LQf>8GS59p_ ze(BO97tTJkwRWyWk8CbqTww6%U(@kogKa zMm8K3X%?zbDp_P{IvjlT)?2qex=}K%T)1?ww|DEk9}Tu|^_M#ixY7^?!C*Qm8M4Ws z9Ys+f2gA{LSoGGGS2k9%qj5D!rJ{5=h?7W$>Tr9#@R zluK)qscx^VSLLJ{9FnP$I854I884TW)#-%UnM#|Y+I;9y=x*-azO#1mxgWoI&5w^p z_irM4&1Ub$2WEUIi~(I~lT#E%E6drq@(%l_PDR~5N-QQ*XENihkYN-cJM->ee|NIK z3xW>zj}(!&cB$JQ@7=w9_4`LR-YZ83O0rUvgcT#iVA&^%IdWh{GglH^SbW*3@0a#z|G1kp29hW)0dIfvq*3MXtaLv3I60#Pni$&1- z#7{r2HRhhI69%LcHNwX!^2Ze5u5m@#Hb%%ws-7 zK3Y7&03|`%zPcLlb;uOfEws7vT<>0{d1y-g)9N<|XQ|z@9HFLw;JNNGd;F}W+H@DF z*=@s(I06jp*;`->?3}mWdGC#93(g^U20!CAv#xsM%c{|p00~Ku6eQ~9APVdFOet!I zePffZkb2wbO3H-=|k6rb7G3!&;z(k8pXImgV-TX0Yo>G0?NcGgd=p1oj;g7tKCcvxi9AjD|pOnmCO!R>2D_ddwRBLzN@&_Z0^=%2ZC zA?dVapwPSf*FOq`vc?ZT`Vg{Fezbdd{U&%9DC{qHMu)?*k3Xe7Pj>D@X~_6!Wo>=6 zb9SY@wA7s(?1$c5zOd!Xw5{Z&<+z7cNCJSY5guc}pqk{)R00ei+@!r*R2CTZlC{k$ z8wWwiDj83v4g&VH(v7}yHgB@ODn6+nBl>|R4!D3BDT6Hi!7Ut ziae`t(WA7`-UCs6ALuQw2@?5aoj7cR^}fBKP9nBjc1xhly zET1}~y>m*aI7q^7FX(jR?h*x|*LtNTyM56=dsaqEVX{U+2M{HbkctF>P$UE)AVW=d zg&-w_5E4n$))N3Afr!KaLNqW&1b`@nRP_`SqIa&UO6Tm1`%;}52mnHeAdHhF5kJB1 z)OcgDiBGP(g-s46H)7<;M(^=mc?KlSv{2K!VITyey0bg?1pzngYi4{##*+wk?0^1A zFIUsZrdK^1+a>Y)fAEL1R_O`oZRUkev|^i%ceASDIM?GC0rA8`PoD1LdCxRp{J8!M z$LKq^A^|LRzZYhm2tEekv##$f`12DO|8cJ0oN0YMm}co#;Bi*+%xjGrZt1u$4zrv{ zTLn zqr(GJ8esO|flybb(mD(yZR}_?NT*XkbLru8Yp2f1AgH~-u93lHyH z-@beEItF++9I2>v>G4PV>!-$t*(+cDsjxvtgBQI5-DxGb#7^MQ&;8rhaP$5XTRz_XT!X^w&JR?%yV5;SvGAgtqKv_ zssw~eYpqMFhaLn!L6aYv> zaTvGaAK%*T*B6MuQpdVP#xb3#3j13OmH=Z`!Np8iQb z>qQtle%4$rM|UiRsHZQTjx zc|kNQBl!4|ovesX3`H{#AOAy>lu=hz^|yG2uZReqz4HeAY&TSWq%?O!&j7XF@I?Zp z5;Br9k}{SmlB!O=QYa*mL?S{EM2J|A2oQRhmp2|^9d zRfqfgcW+!zkB*SJNxTW7AnwFThXINzFDJu%bO@jydFJW$Qx}wqocG|p5W;zO&Jbdg zti^TY77IbvTJZJoDlrp#&rnA}p%4x-bq~{Us(j862@Gf^NIDaf(`PotLgG zkv&_(MIHn}-0Mf3PL-xE&jj1n*@uGV3)R7$DoX*wq|+rvQ)H$r4)5LoZ>q{dyn?Nj z{aZh>2l_eBM zyQBSmD^+WG`P9WTLfCY0lxaO0kH@1aS|r?N&OPTzvTA^48X+M;~6_T049G>|}6s@5k?fFPt&R7^pyn zK@_*92M2@Q`#|KJ7J{;A!Nx*aNzby=Emh!1%0Stw%m%~J{@!qJ&sdX{l@-#UDzZGQ z^wD^Xibx6~S*O!gMNw51cyEnW%j-{l_Vu^E_ia~Xc{+XZbFY2%SATi^%qg<=;fEjm z;dg%Iuss>3ROY6bm}cRuSzB3s|F8e%+2^0h4iBpFA=}bUv(U4!l{aZsOpPP(E<{FWh#7%`C@!)hY_)<` zl;?&BJv&pSz$n9BZ*4t@gRL{C!1MTMG}_x1Y(2v?ON}YxB+*6TwFYMdnjlsVK}it? zfiqU3FvfU*C{$8O?<^6vg@{ZZL}AifX_Jm(8+AH};JsEtk`N$;kRWQabG?JLna-#o zS0ITd1*k#a*%vi8E-6J*(>pu6RW?S|T6n9UUT@J$TJ1PaaPDG0;bwwQBpuJ&whbUd zBR1A|>?YW6K3_BwPmk5nS>(fPfOO%f0?y1_Kl$qf30)wwi;Qu0w7}xO|NTFl`L$|4 z(cJc2;}6ezopWBdn1wZ8jfAt)TsVqFd^?GSClD7;qV@@l#ZNwd26QLtjYU^=GY@oJ zWN`DIpTvH`nTdS>!5+W^GkbR4dGFctXga-r^P}w_zsK4Iaoc+a&$cLP zS*a|Gayl}jp)1n<`tq}%{@l{)CXpaQAq5HHnUMrAv$x!K*^N65i00@W2L%)oIGc5?evSJ0uy1AOZkiWX@RC z-N+|-zH=><5=m5f3bqW$vp2o9_0*w_x4P$^QK5?TT~~~?vCJp|BZPLSlDHFhS3Ap{ z!&^68K1uq^S?cuo2&;*m>=tQ0Nm08}MWVa1UX72Y2g9W^7e4(fznl*C4{lzaj)p>p zrH0aYNdnoCKoy1vD2dqHR=f4^Yo9;b9jXx+f}x3PWS8_TZ$9dfhlwuGE$BmGOCLf-sKbFp5JFwuDm7S|W1Vq?3|S z8t;26{ii?k>dp7x{fmG0FCKXG;Zs*0d+)ElgRUZGV0!t>pYN`%jCKwmdFqKX4_qAV z>|KB7{oOm;_wNk<;*Y=X%=BpIo-YfnEs~0ZB$U!r8IbVC=yXI9lcjD|nf3Dzz4Eia z#3DF6*cGv=ifXvCpH4=;j=UjaU{Yk9GuC^dJV_NrVH}GfjM`nt;H|3zRvklLlq+X1 zKKt6s@Ba0-T&8+X3V|cj7Ml1HtmVjPZHdQuF zM@j{PgkvE$*4u0Ss>q`xFh(aya^`^xt7{uCz5dGQe(Ht%XkbR;YCMY2OQd$UmrgS> zd4DO6!T_vuWfce^1p;$vz4ct=g|P;htoD_un6TaL9SkN>r}yM5uYLL}U*5m|-kl%4 zdG))0lN}s{Vc-ohNJ4T}3v#B^P%pn?!44#nKmhiwb~^|HYn*i!JO@$=rQ&X{7cZes z<5&t*y@X_>A#4S$brK;GP!NESf>4OsLIpx76oRA@LJC1x8?R=jt2%tX!CfJNP!Is1 z_w1b`!rEKX+=*v-x3vcCyhlO3UOx;%KHdwra1&iXy9L|L$-HNtV++r7DCb?^ntHio z$RrPSZy0B!uD0>=NrZwE0`3V&o{vSryz@8%vN<6|U~YQAi=yeVqI!&p^Hs%*=e+Rv zxifnq^>Qw;pGdnhG7{L?H zXfHD&_*%W48=z)9dnSEg^FcWNBcD9lx!S=1jEfc9Cr+&)xi$JWgS@q@gG2&qPrd*_ zAcUMXNdyW>LJ1iNsYoai0)+yhkRrs;iwNogfw~|CQIqy2RjYYr&ur`VGc$OP?0sE- zFuVFg=h?IOb=J0XZaf+t+_^QneI2|@dVL`RaK1R)fim+Rimb>6du5tx$KAEwQ!jpM zX?X+c*e*gs>6wY^31iK`0;G4^J1f8wVx7;!fX*30Pk`RKx&}a!1PDMR1S1eTW*4{G z$;#SvJTYY@Mc}R0*%VEs2)y^~(OZY?tTDsEq0v=&u%GYTP-swa++X$J$yQOPFT3j; zhT|+d|M;U zrc#y8tp1=eH1?N zr7y}LzW>n;osLbOJ@Cv^&wT!ir_Mio_r^zm@z4K>^wt)WqZ>DiQ5q~SiAX*2!YdEF z@C;B8$jB8%AP_(~ChM&O1QY@Uc+_PHUV|~c^^G*kWElU_@BTOKKz;bb@4fT&|Gf9( z_Z3NSU~&^gJ=tp8>=3MT#(3umNdN^w&|BV6B$F`G*~H{iDM%3oN~$oHN)S@NzZ3-I z%M?r*DZjS4roxa!Aj7r{rBFe=WdTT`5I~Y-6a)$YsP;M6sxwIdt^?=i>{m!Bq&((E zO~v2brH`FcY->51NOmk zo86mjaGzy6GWxloiU7@4R`^&qdXD<@yFAUX|5)SYMQCN1jUmA&aDBlyHM8&jBpLX) z9Xt;PJAt;xO;I=&sPSVEb$lkr^#v}7&$vicXG;rD>?B?kp6dhn*aXw;=<5=On#AVD z(Z;~ogo`i$5HIp&#Ckz4*E8NTJ(`&iP8i>2el(=INiZv$__)0IxF8P4*LHqgnp_Ma zq?AeqDhPuhRDqI8DWym#p(3FIp`?(4RDeQ~lu}5cq#!9(GdzbvAccs5AP`7`0u)FH z;&^6BAP54{1bn0SUOR@`fKb0%z8(wqwL^@Z^9XF69S;VRy#t?Xt}3B|u+>HOCL5We zASFGCVlvUi#5x^>^0DV$Tw2|j$>fSiBG&O9TrXT=HbMX}c;|_T2nd0s^6afK$j;Xr zj|shZBoqqenZUCIWI)GW3Mr%{RA?%f4vj8tRS3{PfwyM=&W(dRAEI+%tE0;t*#JXc zl$LD}1S@B@vNQ|YOGYL|kzIKBQn#DLfuTU;S(yzEg?DX5fufa_ejJJR*(Zwq`}XJ~ zV0MFVJ7cmGn6tsK)#;pm=u&%q_3c0ZGd(&)LlTnEGY>@tKBa15`;3=S*9Y( zy)khjpLy-`?UnUb6kWLT$llG5M*BNiR%*th-Mg=R@pFz^AHDfj90;4I`FO}>X*Ktj zm;UoV{pY=vbszWR)y*s&L%MB?X)zp)cDJ2zrYgZz&Kd?JumWLe<21`S3|lG)-hb=u zci(!W*IRq^`IoHL+2Dw6h29I|POpvZ(CJE7B%~CAq!3b2J&cEJtD@aq3Zo=TGY{mM zJ#)OW{Iy^IyK8G_KDv5ibZ`(zym#}av;H^!;s5>z-}^q7X1aSML)^RbQ8hl$`3Mn1 z6#0;~ z^X|K6FJ1_G{m=aBuU&ZbnE<2D{=(0-k4bGg}INZMXy?^&_Km6`@ga|e+KB&6=rLC?2iDtd2?SB32${W$k`BtSp3qlP z2pK39VV#^qI2(OLq?%>dg0y4?B9wuuchYzdGqstWw+w#93hES84~=Hah#W;pD{jg9 zHZenuIc%TcG|e{~LN)`s*`Imdb6f0C&TLxqr#D-5>KndaV3D}6pzvee=miLCh~5m# z<|6GveK4b2Ab#%;{?W(qZ~-Qp$1ZFK{`l8yE#53PX%SXV_>Ja!qZVJK=`J(RCb5n& z{3m18tTLcaDB2BtooIj4+#lCm_TvlE{C|C7)C?8DET;<4)ya^2+yOX#I~OL38G5o95SPyss+><9_L1F|FK0Bc2>0ji=Z_P2$p z&^rPsio!TLxPRy1-Yr|{e3DIvBLMaw7(}$ZB3jAt=ztikafAE!O=(4|Qxp^CV1I8M zh24CTjfY1HK%q@q@x^ne14a4Ko-m_MOIFiSm5pMu({Wl-D+39wxOL{V3__}=gPS*W zR;ljN^2PHkTx%)T#u$snvPV!7%TbCR5L^%^o98aX-M({5+rWD$j`r^U_&pV2QP(7 z%U8eoE>`Yf?+7ha>2R`hfB*K~QU`ag-ya_iFNz;RarRC+`>c;uYkKFn2)?{)Z1LuuvEp3)nl^2Ds$~3E1uDr7T__M$GTfg?H zFTA>Q^Y*QGeyr0e3aLFl``YVgE?@ZQ?f2gNlmF=Q-O2X$=IJe9TcslzChMCQHqV~< z@pry|?MK)3ICoVRMG4yieTj_3EQF}X77U~I$SMqz7@6hc4fUhlEb ze&);*&zyPm(cSHBuvOi(LeT6SlTvXfi6b-?OrEqu*$N(h{so~zJs3ryWba~OJDjh^ z;c^tO^^#sMrl{LJeNL%}t&;%(S_B`o+DNJx?K@M&tv(1-9%=d?Ll0`wMG4Q7Q}HP^Fhq4Cmg{3* zO*W*ELI_Dx2%)450u{z_6u08I6({XDX(z2t(rULlomRV>B<(PYR1lF=Bm|NK41grf z_I7X`bcskpA`+08MOHT%(Vm-`=4O8;dtl?iK<#_x#?RllpqUxCD9iC+WYPl4T%aqp z%O}$~YB7>$1CH4mE{4KtFs9w_UU~VI?(zoC?FHEQty-;?u~v`-WN$UI^WF#|=RLD0 z*~~C_=Li`nB2wTifUCng+537y6fh$Rt@Y&S$c&B%kl2$zCgs?dMWypX1udZ>DWnR5 zq`!hvMjPv4cR6miCc{ylj+VE!C{R_Fj`p_)2YW%-o2KsmjjPfX0>OD5D_URfwUUrW zyJoWQ%QOr^o$E49hgnr&5Om`1YVY&|m+oBs=-!(@@TD$|UwPm`OcLw8j9b047j;&& zT5&6sp%hURhe@KsR+Mz2DC(?lT>0#0*DgJrrxPT0#%+J}(RBY_tJ@-Dkp1e#2VeZ! zFMaNJ|C__KIJkM6bkz+N1;Vmn3av*%^p>?VYI#|Of!C(Wbg$EjqJSh;jHdFNmmk=C z;+eO<{l?pW_GjrNw?3$fG6*C9d+!8V0%U`xa^86oic~-{^v;CfT1hL6qEna7ub#hr z@u^R_%I?1Z&T#uqaj>t42VsaPL@c8Ro_M-{`pm08`=!B9Z+~!y5>*st>-^>0w{A=Z zhyUIG_5bwY^_y|G*FUwcxV7@Yle}f-dtbqcS2-;bTsU3t|yTg-nur~-_}`G zWRo|(`Ij$z`o*vO>fcEZwr^d(Ug=WEVCB>~3#gp~CGxBcmR5Tk>pZyMqG~#wyz$L% zM{%%r?yN4$om;n_e)&`1{%3!D?VJB8J-7||6szpu`VC)X05}?qZr-@{{u}R%Zr?T9 zM;qrXC@jXFy)i71iAX9*Qe~BvQ3TFsgK=rhul(+Bt*@*-{qjq_wN>!;;P&-Sr!~zc zgWVl4WjP%pmq8$a6gXsC2|?&tvQL&)jH}v9?RaTv=fn2{C_AlSxgD)`I&s_zqLAXa zd+CAAD^IFc4`l3}Lo!jP8?~226r&8Jlq4j@EfljDAt9wyI8V<&045jE|&_c(EmkRONnPZTvc%Lr>O?8hEPSj)U8d%ef1d9D99hP=53;G6z1 zo~RXo>DWXy3zCGnVQ$uwZi*k61!W$S-ILA!**iKLUY=i~MsEQ|ngyTHY@VpevJ$mb zp$RA#^{Bg)N~$0TR2YU~7{*Z?C2=c?T2a!Dl6DlgRg|bOLK&e{OcGHwAt9s$3Q?mJ zfgoz4IuQ|N-8>-CWQB9BMFThh?>#Wp%Mp33?YqVwANgjOe<^I|hNeO^LN&rA2MmDAb?~Ezx_OjJEdo4szm(R{O))+=F zupSgdXDepp`d1bZ*)%1d2SBlRe>*=o2jozta`;x;?(ojIEhc4Rq3U#<7rr`J|>u3b7rmz!+ronX@JJ`No4hF5Iwav>9Jo)-(ws&@}egFHh&`V1pAX{xK zja6l|)7rU`$xv9OuBCck{msAET3H(0zuoC}lBGU)L?&wWCZl5G{DWJUAI~bb-g~x@ zBqb@3QW3bylwMdNq*B1(!P;_c%KXx!k3aUxOS-hC$ew%s)u+Gk`48W}Q4ROG%D`ze z9ZmQ4wm-P>z{8Jx@i%_ODfQx)Uhk}&KK;NW?Tyn%cXquuPrdYlK`WBz;!}@Z`_Wad z;HQ55Yo$;3@7?aU!h;XqCYK@!?ZC4D=UGO$x@p7Y`OklG{ejE3KDu6(S(Z&1+>$Z@=}eKYQo9-@AMDYNb;d1Ut9y#H}Q3x3_O! zAKblpc=v`PU}L-o8ARZPF7r|5+RK+)t@gn?-wXp-fB5NiJkXOvLFAqD)*yM7iot`k z%WJ2dx0BJ)=IPCI=g$uJcek&;yL|DKr^?0k`CpFgE0wbjq zLIz~vQ`(z;mSixbJDkz;PCUc|y-_@U%W&I!5G=dAP7aO+@gE zRD1sKi!(|9h%-%K2I_uRAIz@oOmjZ*lZfkeQ9$+4fM^D={mjS)vjJfg;Oj(0MxKos zEndyzcNgGzEkQG%vk1M+pQs^@OO5$PWyA*hX(q?uZ2fS(c%wn=6NH#hAd##E9VvyB zQb;9*kWvLoi9m`l2vih=p$cOe#3U4O04Na&Kp@oKhuQ~$^$;!>@BdXNi2AoeDj`T(W0)D(f_Lbdonc028IVcVp`5NRgq^YIog^_EoSJDEwb)a)*_Dzi zINaSY(@7G?)>`(S5LFZg?N-w2>TIg>sT62TIY~!4%Ry_*rrBs;kPu-Uw%Sn=PlqG# zETbQ$L#%S)bf?q1c;U>cvzHh+AKZ7^>Wa&Xi)rq3QIx)Lm~>i7VK?ct!?+k9mDaDG zJ+*n^l(R0Mj8|4xyZz4H_udbr@Ks?;-3SYoi2>Q$vPciMci#W;&b#kq_wR#~LbgzA zGtSAo!~6I3bXpFFciwvUd;j8J-F@qAZKfVMiIZ3a)=*wLFQ_y+%?(EFFa5@^oqO_` z7rykx&;H$?zjx!-weNmE>h(NxS!S1?d1CFsOA*pne(e`u`_-?Er`i3hALw#aMUP;_Wd{COYdAu$HTXO_(9meaPZO9PJ%(ZW3=n6 ztgJu!WPtIDKl7FGBp>bWKK1EmU-y1wTs>(5xARKTMwN9PAaQoWzKuVqGTW2ps?H-%b z=F>>ZRt#lcdg~k`QK*FUf@BaYAr*l{)#`PVc93r0lg!|(W09i7oB2v9fMG7Jmz>Tuz zXK_D>GZ5qxN-{GGA%sv;NRlE7B0+*1HFNInof9uuSi^8^RyuY*L9@+fcK?{uM4TJ2 z=9_0v7<*i|z;-Hf>7iJ#FN%zR4`&AQ0U0OI%m;E$j&iGAFxyfE0a z81z&(OJR2W3yoWzo4b!O?f7ZO!tx1!6wJ8h0-!E%|HX^BAiHDZ)AG$lIez#o#HybC z!a7f^8UCq}nHr_OImOuqDsG%_1T)s#7^!fUgE1E$nr^{QLf;wO!W>rX86arDmjI|q z#+ccia29^K_yzT{huJ?6)~l?EXdc5!H8m8qN<#`k0HgQTvSm*oWOI?Q7I=^mxfw)K zKp~Q>Cz@b(gaCvfxapVA!?EiAhzHNiR#$d1N%Lt2&N6t99tDBnGR<^84wUeoT~+4k zR14^D^shYm^vdQr6r`jCKmf+38*Kg-M+@!hnFCa!6-TDBlSwKA zl`Qpwq|FRPkrP|cIvq?w2m*Fa%Roqp>=A<`>aQ4UZ8~97dSiW6=rj{3`j^j^=@cFA z-nkEq)&d5J?6lJ9*xJe?WR=#XPEau0(rV`kK$VUr)AGS5pZwf!{BpmyB&B-uTW{WY z<44ba@zrR3>7%#a{rp$H^4w2Qr%4rl~yA2FN zin{B7OsqYM5aVT^7v=U1bk*GtuIb#M9k&wY8LjoDf!_HuaS~m6Y5=N@s=-TvUC<<+%mmT#TAkZi4HdG64V zAS6Zw$x?go-ob@SSAy0Oc=7zJFSPsXkH7k9QsMsnUDjrGbsbeGBoveBBhNn5SzV7> z-SzVqC;OvFfX=JsQx|)kjeI=S-g<4>nNF|gjjeKxq>zySytQRjmSttN9vvK&d6DKN ziXaYSXR3au`w#!m|6^(RN8kNxp#qWu1g&ju?cTmM9Ug9;+49a04hBoB8%O&)IvWe5 zRuaaM%BNH7p)f%!Sq?!=@7p#&gi;bGt#+ritk?x13FffZHdPsQ+A3<13MRutZ%b!f5G5*%k!{>* zOA$zcp`=#Q(bJU6vejMk2*r3z7)*D!u^2>4%Rz4?Sy}faf_BRX%6k@4WYeLDDCu@& zv=p_LMbyH&yXzb{ONgQ|ZVHrANjYN?a(?%!S55m`bDk;GH9M>kd3G0O?;DR438_Lw zB&1X`l&HadX2m`3CC|r`=9uG|>y7L6s@G#pwWgGQHphZ9o<_~>zP2kd)|q`gV@p`8 zZ*|YHKBRDrWVQ&&5i~s%){?P(wn->g=WDaL(nhTJQjDYpwadVe% zBw<|qpM|4Xa8aFf|DHhh`QK&_U}$s4KDN4buBOsR zD21@r)j=GB>Me@ok%dsR;@APZ+JlYE3>Mh{AUETL(l;eeBgr`L7z~0J0;LcEh7yG2Po{1hGP*Bsvw9GZwy=AO@fPO zPZi@)1SM7_811buE9*Q@EN|z2;>iJcrs1#%`~8(iA68*RD7E%+tCOdbAc%#KUKeaD zaFt-EglA{#ab6BEF4N-Dvro4!Tvol+GA|qm)mbJP#7n)( zR-BjYT%Kli+w6sxYb*Pp1dNJ0A+2R^yS* zr{(y72#V5{)+Wm<7%rvvkC6QJ8@ImmpZ>E#cjn3i_wU`?I)D0sryt+HeQ)FJ>8Z~4 zZrzUB(bad~)7o`6*0QQ7rkSqF{`#6q;;7Rqt2`TxPG3AnB&O5+^6JCC`d|OOrPJ|r zIDYuCXP*E3r^km!d$;bk!`4GjKBj>W?rkf8pZR;g@%$G)_wbcRp852Pt^U$@_h4}I z{@?!}{@^SB^>18#_i8#Cbb4)L?9tvH8zno6ml+v_c#Ju^HSO!jvj1EcJ&u4u!)$V2G~z-S%xRy(II9NoDZ z2i~|+f)2bXr*^msJ zOl910#^-}WSLUITs?|~bwbtpgM!UGT(bbJ^6 zSPt{d9o=BF0|fSU+(8{rKj(P3fP2U@iI*4rRsc+M&(Iv>X`$cRn7sshJ_cQ$fzo{0 z&jNkKxhn~!5;lVFJbnP~pRW(h&nCCi;^n)>&&!y{^G}W31LzS5_NclvPn^ zt&O)HJ+iA^V2%j@Br{>Xtq=q>m1!Mft&jwx1eA5WC1Aar7=g$!dSBZm(6O`5GmtgD zDoU>%vOp9h1jv9{SZ7R@xok+L4A`=DBEqu|KeDoQQL2EwuQM|d!8#i#Rrf9G<)Pq^ zok3t@HF#D;%w#>z8b5?mVr>c|<=K1h>x`ZHLJd8c~ zkpj)MWNkrPSCz$Rz(61)rz^A-F(7i4rR6BErjv4<>%x|kTu(;mZ4kvGjzts}d1~^E zNLrG{vXqLYut*Moh|AH z?(KKq8Qj0u>-Qgh_0>w_U^2B*AUo%s3?oE=LJ)$AqDfw))9I6+i?aOa{cAhdZ$AIp=RWmwKi^+p+rD*cd~}FNdpGZW```R~ zC;S7?KKXC|m;dMY|IHs?{oxx)D|+OqE1iwCbC=J3|4+aE^ouX8ojtpDYUBEQAB^7L zdHJhf+&eh9``-J*yLV1Md~rM--2L&}N+FPtQV`Z9tRpEMp!LRwJa~uT zCiz%w^lvN{!;(&-re+YkninHcXrCMw4Md3m5nn|w>>#HYWI5mjZJ1p zLg+%9JhxTmomELEh!bZV5wN!ce9&pTcDr@%fv~%3to4lSj5h{AO~+YPRa+M?I0k_v zr34ZrBNeq!Dyb3_0a0_?M-+l&eQy;)05G%TI`DorWmGSCf!PA^Ms34pD~pgSien-a zB#8*6BteoyZ3n60?Gv}pc~Wq5xAqODG=0Y7RRA-K?7YFa$T<;fI@~zE8Ze&U?wRU! z49wWDtNK~Td6$b?@B9bX<4n|$zL|q;aU0T{U*ZDFHsuJ+&T6*Lehy1D8DX9u>Q6@T zMr)WaLHaLX&q?&HJ@~Z+dC%)It!~ zO=4t3Vye@q38_x-5LAOPDnvmfk!0OTW+wJ^KnI)3>B{QL)Rri3y)%v-c#q&cdRwRN z1W~Yh{_N??kA`uFXBIv09Wq!`5EubgqE+aGue_OfTQD?h5P^iRgIQ}^1fpjEfsE*V z&8Nv*)A$>ZjAto`t+x4;oh>VkNhfG^s-i^ioO3}Et9Dxms?t$=Dg32>{Eskhr$@uV z;q*t}`|G>cejG+2vqqguA(RRgVKuX%*WuDuhHA%~r&GiRfcxLx-d^mMhDzJ8I zd1+%~b!Bti=hMA+-U4gl-Vy>uQ6!`!Nye1m6#}rSk|d@;cV-jnXudT zk|v|{!IxjY^uiPAIPI>j^iOXF?WMC%y_lB#y?^niS(XlVZf|U@TzukDCUNKeYo^E< zn50_2aNb%gfTLCz#4_nE<$0A&QV}LH>ZF5d)J{6fz22$QS#Fsz%kz!%=bn7=Q=k3Y zzZfiS-2dpdwfS^B-MxNyaQnvo-R*1N`94&KJBJ5@ok4Ll_S&-dORMXI0W*|Nlf}{D z5g5JPU486@=hrvR-hTh;(ZO~niK57j)BQ5d`e!!pe02BzNB6w&gS~@dniHuH-+ISS z&9DCN{@c?JUDi|mz!Q&t?=Qc5^ZgHs=~1UGc0T+-$>{yJ-f&rJwP#~PA&MeLKtl4s z&RSn);4C32B?UU8wKf`oksWy}$w#f==@*{JjT0bUUKr=B$@lKw9UtsZ50Bzj?_hgJ z61Ces0>q%zUEV0O6w$LY?Et&IXq;uk{X;WJ1A?edDF<}G#6aNd<`+sKR6tT%U74yx zKp>3U?IO#ClHLB23PMn#Ec49D_WJ23Klf@`=B+46+QIc7emC2{FML_0LoTYbk35A* ze>%yOQthQ4dXMO}X65Xd0|fG}2T=a$Yt5N=*9y`WH8=d5$y z8j}~!dLl7A++I0zhN47?Cf`xc03t}rt*V;wa=yY+EhiXell z@64VZvqvNus2~UdNC;VvB+4dKYi>54@yMTWAD#KLW+O4pmWG;zH0mTHfG4O!pt+IM zct(Qf&Ek1)vsO|Yvlnu0ID^@~!nu0=6DO384MsR?+}5N~{NC^X(Hw1#0fJ}Wsr}9K zK;q+5pH24SoXyV*ggM{+nDKfM(-#%(Ip{75;V{F*#&xrBE#}?(nRMJ-Z9gkjW=5U* zM>J&*@^R5KpWVfUL19F$b@isvi&R7OjM>iLiaDEYSfn64X1X)rJ`p7HN%UR(#;nY0 zaJSxnV4OG3&H1i&wyJDa=xJJxC&grvPSbRpX5+L-r+J>{MP`eyS-i!8mgh)J#!*VjADu;XT{-6_!hn{~jPxD@R8-0HRZNe~Jc-nr%Tl&zLQuzvZH@kTgKx*Z`&$v}V)LP=6O>j1!8FQuq- z;hbUbr$%QzHqCjh*ojaT7Hxm_p?Kgkx($f$B`TzQ__pje^U?ViGP%QVm+2P*q-QCx| z_6xu9kN@H6M;<(V>GJz;f0Q1j*|2)$D_?y0Q_lrSC_{Dghwr@m#@qLH_jccUlheUu zIJ$G~qbfH`D_goS*<=Ksl>}!rG4_^LtS)t#d1s{*Qeo7JJL_ljv=rdMdr8Djt3YW> z#<;yZx4f;4tyqJW>i67>qweBM+77ZGF0uQGONn8NO~(aP4zU5d;O!~V3g@_sT+6X z@a`?pez3jki@Yq|^ytXzQc27v(@W1h|HNlszVX(ZW^@#VzMPJ;qj9^x*4sQ6ciUkr zHkq}hv&MiBMXrmy$cu5jw$VEOz;IlsIA)2i-V*M-DRY622&y9Mu5a~LS3NLEg@h<% z826+M06cp;_eYWth;{BBc;^`WY%e{}7v?Q&U-L5qXfs2ENKq64AVR%ZsgCDqz=s+g zdeM#bNx-XZFO4#c$Ln0@2v#2h5FBH2{Stmo$e>w5*DU6#yP3$uI9tqcob@orGCxn* zm?7fvs4mRYz8cUGzxM}!cp`ynfxFH@nNQ&8d||^PT+R`6ZWo&`uwTTUV-#Nm;01+t z)?jXcYi_NcL2m=ab*J`N&Y$_i8!cl#^%)E=p6={*xo*+UGokCVnW@V#C$)>y zOfaML^Z)%A;{F$1TK|PF_H5Z3=Zv*=uhdzqov(~7OFNxrlgVT<&ZcRWW?5P4vT&v{ zR$FJRbKW~-@0+GKA`=ma`g}aGClG)VBtp%DJ);AZhyp<{)Z4f`5HU&=0iXcKKsdkj zH5&#gh?}dA$n2#Oh_2G9w%Qx-jYjXQVp>%bly+%-CGIbW%dOU_)!y31x$|fH{dOk_ zm)fe`Qtdd1BN>H(ltL1UdTOvH9@-FrLe z_@Sqt*u8ZvLZ2vwAUwr};wsOpQe&9NPCK7YrsFX><b=;8TzP#y|Q8d0D*p`s;)J-3w>W#LN9}{rhjUdaVbZdTexfczADTc)0(=Kl^j% zi%<$Ejr5w>Dne~}rF-h>mtKsQyV|(P{=j5u)arcZt3TCW?RWaUy?gim-~X5Y`|bzt zb(Z>eIGEnKV|30WwG~xaMTv0U=2?npoT(J~{_0AW7Pib}5C|y&xX4{zltNMvNGSvB zyz@XZnhdAeU^h_6*lahcv{rG8q)J+C=h+mc2x5-oWO;2mII8loXATI#qpuuES4<|Z zD4fk(0TUQ)EieMfih|NO2T~W6x3<^oItP{|hjFshCSYAu=$%q%tsjp@`-4L-ly%;u zX@anP_Dry`IXXNzb@6;Y94nx$%NP4w8*wX2M+bvD*Odg7gzY5kE_Kd7`y9qyu58jt z(!)_}c{%8GO3N&Sr_xkuXXBy?BM4~e?Adxbkq7UM!Ky-bDhi@@d;R>SUcWy}XA~-E z0gh0=v zYGmV6L7a^aHze`oO_e;tyir{qL?Hh*VQ|%!X!%#KExex3UQp1Vqr4y9;80C(|faZt*souE2KntDQ+30Tb0hr@|bMdKe zBFrsR0JE{41(Eq;un7LXMf?hfA`g&{rTr#d+o{R zUU>G|=T4vAY_+2>P*Ms(&0b@MdH{`ifa2VI4z z%E?hSI4maPA{`&xx#`QPWL}C}y`>H?0EKy)8gQze5O_dp_m+H~#Q@AsAOukmb=$Tq zq*NOZJ*s+3gS)$}qytDnD~gtv^1>J6aWx*1w?asi$_vF5IPaOcz0_vLs+N&{665*hz*{-=K& zZmjmA*5j`|d+o!U%jeGzEBlRq`X9*a;dpGl%C*#m=PDQAY^Bka%q0nAOUtWUXgxYd z2n5VdhhYpt#_g6MY{lW)*^4snpMUW3(eAeQ`0x{tRi5|v4yG>OKHPr$J3p+Z`O)}j ze}5mqsi^b!|HuDf>&lfoSFfQff*b)f}2$!w-6Sp(oa5CTV`G(NP> z69FT#l(oA`DzfFoy%ds!422!vyJLzxim06Cj-^Uk^#A4S&w?$@uJb@_ zt+j`LIOCmjtg6hKP=%@jKms5*h@wbQYz`V}1w&GYLmlqH9ctO_c37{r`=K8kt{!@vhJF=ZZ3VX*`>5_R zgl`vH-TsQd8)q+`ou>?}`fIz~Pk;A?H*D(5^Mf9?@zV8QJg5s67HsS;Hh|o9u+(2I z^)Pu+YxI1oK1TNvh3W#FFJATUhThGqh!^$IC16(F%wM37{$Q3M(sFEL3~h)pG%?m~ ztlL;s?P^&qm#gJ`xn4GP9okkROG*d?KtTm?2n3kc-l$~B8t062&Khe?D#1+m99|IX zv|o~>@-V$uEC40BTgpH{L6Lv}C@d01L?sFb0I=3MYsi8x-Ds=$g}?gKKle+2soE;b=JB+TPjUF9t&(3t$X6BG)VKs7ni#6kSCcfjP1&3jml9T0$fsA_s&?Ue~9c zfg+{os8r#iLN~FNU<@fsSk53c92(_ta&!{v)o5>rGCSDW0&;O(lQaexLtC94ub$l3 zuyT%!5s*4mYt%RxmE-B&^kAo&9dZMwCr4X*QjN`;K#lW* zt=-+{Z;>^!sx!*`WU^YU2h(Y}wM|*k)^T+{YpWW4mXF5P7eQiJSFsKz%VOlVSqmaU z-c)t0s;n&Sa9FLY(6lUJQLk5_ZP8ItX5Ly$!ZFJ;XUP)8HOgQ85C6kY{lt$OYtB#SCue8XY)OQw1_iG^cjX6u z`lsIf`gbP#lkNST_4)k9i?^qHliRPnFh4tUT)p!re{}Nj@o;N0xq0K!-N&Q7eZRG1 z4Xx)(Ecez?XU9ip4j7`NQ8od~!4# zyQW&8&E9|a4k(}Azjy29+uJv<9?ja>`C1y;x&BP7SM$dw5hVf%!(^OsWNxFeBm~Sc z#@MvXib!a!HP))IvEKL+jBlGD3hTNZ47N-$bUxePzlmA7Sj-8;dY28#LFv|uGZx|X z+;c-Lh-wWYX>40(?V!xP^KC?t)YD-UaoJE%Io49Q)|TTN&&15Ih%1IZA06JmYluu< zMA7s4d=-Qh8K7O)?P^ucm-FLes8>bq!>UrnaykulBa4&aU=TxytJ>InuzRJg!}!{B z>$+Z^oJt7AbUfHUK$}~aH*FAfXv&6pc=ILzP~E zZofd56bQ*E0vc2hR6t|Vcr+HlB)eHcip;Ex9W8nzWlbDP1yzx>@x@Lq+F_Hi)-_FA zH-T*CoTW=H3DAWO)8&?Dvl_kVzw{zwAf3qFezvCp5g}X}4fj)E-MCt8+?jelRyX`a zxxgNUG(Ug3LDl}8#g4LdnZ``LS~mf9-vM7&G{XzaWk@RGI0 zcaLPhw`1-l(Rc~8p1K1`ce~LVeNWT*6!-YzLi7}c>Zu7gP;Z1my~g^|7m!|%s=8(Q z_s*6t-G}c&-lwXP@4;n&US|_km?g&8GKa`*451Be+tzJZH|=Uwuhz|SQOy^t#d5J) z)a!NKwr$%=GR82ohAINGlRVSeTikadiF0l{Y^1`WJrmvp?|{{@m@CUyEu(lu%d7 zERkajqTK7AK{s>=pyWuG=zAhb1;Pl#0zkQd=g7toLj*{gA_Ur~x*Zt@9e-UC^@Ag) zrG)Wjb$-&E9!XW@<=||#;JV3jzgVrV+`K*7+Ml1E$7*r)#`R*nyE;4P^|B}|<*um% z5h+=d<$E`8gsAyo5Sbr7xQ`^yyzo-nv|(}X2o33AGz8;A6M+R-M96Jj$p%H9=jCvu z)^HF%9Q(lt!Gtzc^QCb`wmXib^W)Q4x1c68v28-z#x}IfL1KvORs;fbL|v{LR^-Ul zx>_uk%eFlaGON~$<-Dq@HU=;V2D}60wyoO5>>QM{90m3LuYKpEFMsp2n*aX)@XzkQ z{pRxM;pv@^_nv#!_+fK$nnB|WJA3k^o*#3);1JrDV|0*@UjFnC{Eff+KQ-gw`(OIw zQ6@xOwQXRQ&fo@PUF~d7fBYAIZa$kYPfvg9m;UNIUwbQ53q@Tlmw)zW{@joK>|c~} zdU7^vo7L>(%v$%&FTFMNgXdm&es%aDr*QcAWU=C(`?vpAxivhw`|<3_gR?t#&p&v# z+}>WD&6f}EaJwFlM?(3FpZn2gUi<85d}X|Uy$$3iqjl3P&Q9L^gFpD)-}vpr`;T7z z%(GpVu(!$3Z{)3 zL`_~8??W2^43Sl4gJ4N45=tc1yeNxu&{j1l7&q9y`TW6)uhvadEf-B)Rp;mBAfN8< zwlS_()q1_O-ZoV=)Npfmt!1zk`SMvH)?qKX8uT@{mwDTYY4+}@(euw_=0 zm(xL0&)TZC-lB6=Q?FL7sx1fQD?juFTa1j$&L1BZp7Nn@>&hZILJ7^lQ(ll647ugH z61TTMedfAwW6NQ_wHIR~L&oOKVyysetksE5EB_c~C8dU^{$Yx}mF%HQ<-(b{reSsd`r!!c|mN!012y4|Ji`?9C-@gl%h;W9-C zdZ|ycpxE$+Hy!DQH+7j+_4Jd{gXQI!v!e75G^up;;>zXHQ-m9GT7S`QTYSlX1p5Ji z^xgJmA>7H)Hc3i|z}>!DL8Fu*RzBs;Snr##&+&7ABEo;Mfm2j0zzNAgdbDD1fRKl~oy%Lpq2kOM26)fXZ}O ze(tlc-?(ut%L+shVWO<7Fk(<+mC`%OrZ=M~rv(YbG|FaCNeduVKx4ruuvp^+a4;FH z5n{ctL`s%9ZFx~4DkvFL0W>H~g2q@-5o;ZT0acUH=*lzAa#2^0S4W4}Zd^Zg}>727~$oimxW%{qqF^3LoDSw~J>=9lMZVciVULJaj(;LsU>$;kq zH`SU&5uE_WkT&-yL=CT5f;CPRs^haH&WManv=KN)Z6jAzg~*x3VUh3cY^n8awKhg2 z#k4^3w2h;0=vj-np2g}nXq5_(F zxqji3Fa7oZ=s$S>?RVb!;vX4~K*1R(9W7dJ+S=L-5CQl*U;e%Q|8DQiue|->-49>= z)GNCO+lx8XO;gh7OTY6czx6Bs%HMdV)j0BK^U~XlL4M??f3gj;hi_%`$4qG3=-z+( zk+Q${?)wr}&AMH$PS5`3uVrMhS$gLc^XEVR=Rfr`KXtHoaO>q;>-GA#e)(6Qd+p|( zyYIjAr9XK1!8>P5_QSou`S1Si!v{}(?^l2I(aPy)I{WxLZE0q$7Upz$^yK{LiH88n z)#}s?hFr%{mRX2x(|Yd(OYA>tNghsV*ruHcC0*<`FS$>rn@BLS zNtL)<9CVV{&N>8b8qoLPn|6}emo0sLaKWtBZjanWM_k&srbG3j{nPKd;U4G{MVS!B$Z7)M9vJ1O{CpmA-GF6R`k- zY~)r70Er^}eb%=ZwZvr&ID({6O!vsACgj z6GDtJ#=sGkNl{cKNuI#~fl0eqRD(oBYRD*wiU?BLsz#N-F(>g(2?^1QFpCNVjG{o& z-DLqy^4i2&Kt)kdN|wusIspJ(yq8f8po&P$;gy#@ar^m~LX0u6DkFl;jf%1`IZwu= z06`Gt7%+u?LIjA|ZGqC8s2|0rfrUY%gt3iHO$NvqP$mF0CNe-uJ3&T>tV)LRvS?~F zz#uVbKx0T5)Q)$r39Hg@@twDq?|d5-oHpa>Sa=1tEVstP=@_jO;qm^#aC^I{*Km3q z+IcY=Xs9z(Xe&ZNfEc57&LGxjM-IF-7EnQgv<>6{R$^685BAI5-MS6=px{s)zV|NH z4NC+8jw}G%&pkiA{rvD?_tD$mDOSV5)>gAzizpI=&;k$|%N@tiG!2GeOlRqb#-M;u zW^`4#d|d3_UOl>})e}Hu;iicXA0BP(@7{jn)jRKf+^*JSG`8(<=%-hk)b5Bz0t1L`jAiB<5kQPlqv-L` zW8q*2MYCGBtL5&&mEqP-TQ}{KC+*n@H!GL>B8$v+TRAVP>W{J>~NSIkv2@pg?LZWu6Xb5rL#1JXV29^kt z3xp_8M_&;Zq2!IHy|eG-JURfll#Q!mx@dFhf7%WC(h}?P+?aaE+q6v7HG+~*s<#LM z0E5saCU)d9MFkWU>Q2mVmE1WdUf`fe$7AhwyGe$0LHfPC+1>0+d$`$*sqvEOWcRo? z!|09kV~1bgyAa-B?RS0Wg16n1(>neYUEFk{B15NMCGFiDss9&%*$|{Ix2pX&E^DT= zr#E*G0XqAP4W(J>`{z#e4foRyEZ9$56jXs#qCjMc97B{CVhkaK5ZchRu?nH8+ErDr zR@HpDUM$zk#cH*#o2m(I!z`ekF(mbVZpNnM%{=qDaZVC@SXDKEXh#xI1W0jxDgp>> zNRzDwD?|}eAeGcVCzq0R+-!`cKmi~-uG%jmbt7bmqrfTYHIGL)=C@;x40|biB`4}ZD%IW?U zvO1Z1jMZd3uo<*XwSVoF%}Z!ki3kc1Evf-DNWvjhRjg`f{noR$TQIID2Ggepz+1(dE<9DtO$J;M_ z_BFpfZAD|#HdVX(@@GEzm;UC_!^bjv=$sNIl_VJC-Gdv;vpKixJj)zWsKe)f>d(FW zqo4oa&2KfQbLKdnjQ-Al_P_nHU;K*#^zmEo8d*<<+3DevrmmQv4PocXjZnw)dk<0d z;k^$uEb|=38Ep;BaA2>z`r2$!7sGLuPdF0CcCx=SnvRXs64&LhsO!3Jnsz;JMe0@y z$kt~ zmw)Ewtt;R7S6>`vgM-`8JidGPYk%;EzyD8u{n3XXjfUCH=WZU|JDh9{Oi6G4>#v?Z zI?Paf;nwS=v0(hLUapo$4|AVC^Fu%DuD;%)Y3mupnl%`U%27fD0c9mr?+g)YjLM>b zM5Y{$%E`28Dl(>OLS#^p*f#6MdE3_Bx#`|sHXO}P&wM#FK9?90m$zB0+EwMOA&_-l z=VYfvW)U$j{CF$^Z7qr(eKFXcdh5^6W-RUU==kiT58K80?zJ1m*2o&OoXtyI zJv+-hOs_t}EMYxwRufq% z&t~hBv+4Gp^MwRPz?K90To~(Wef;RoXlJk7ngW0@L(}l8ma6jB6@#I3#(0|*wppL} z!C>dcvz%y~(ujI=rLmqa*&ZkWGqc1*Is*ib%p6%b^+6n&nY-C)cZeyAv~8#wUR2t~ zWQ31Mq>6nj*&X7lkQ{17LAo7mN1)vx2_hwrXGCPwr(3Ch0E-*NZAZ;XnQ)huxQNiX z{{VKg*q+zCu}LJn=r;83>e~{n7Xc8=f3nd5!{uMR;Erv^>)*ZY#HWH4 zHVC@WSap9W_C2@uL@0b(*Yv$l4D{kvcvWrg#ZamG2H<-QyahNIzdSPq7z z^SLoL%>z|gq$>hb`XG@akSL(Cs*tg0ERyjC2{BRY4Jn~e_l>0DL7Sp4RTR^xh&r4G zz%(pS5aGI74NLm;YoEx=f%m2;$}G>3h?&zn(im%ui6Jm2FB(z-LhZo#!soM7AtM^$ z2pR#9Mbg_wID(o~jLK7_dxL1mdO{ys7KzNMdsJabA>aV)ye~%Ms&4#nn?_S~h0Vu{ z41sr9Hpt03u7j|k ziZlUQ_F2C3+^u43JlHw#<=AHV;_wNehzOEFW5{Gp@WYv|BL_e|N4La!+-6khS#=U{ejnh{@?p0&g^17Tg^_bH_Q1fY8I*r z>zM`d-dbY}!tU1A_19iCWfo=&N8~f_95u_uYPq`q&Ibsn4h7=&_QCB}U&#vp=I?xQ zcKRenY1`li<3OffEuMYhHX8fUm;U&{x4$LQIG+!kop`=_V>>VwTl=s5g`Y<^c4{YE zd)0Y8-5X223g@TeN#P6?(;YwBnw^|BRde&jm#*Eu`RLAFmeyqUgFpGI&d&=M%Tnt3 z`3LXaIa@G;4f7LgEjZJ(F`_j{0Q$=3KEMCsv$@slH}*gN*4H#PH(z?`{s$k=9-p9* zb=y37e6(|LuwI^j=TE;3F&J{EM~~~KGUV#Tdc8Oci*sq$!#wu@&wTpx<+HCE?>Q{< z(q`6$Hs-@|wOoRt!A-XW)*1m|MorafY=dY(lNDubl1DhBVp~_<+3mgUdv_jI98V7) zuaA$$+oR*zdA(YDP_%A;IvNnn7W1t^F|anqpyjx{@~j_E{cu!FCX>CZ_55^sa+K%g z{L!QOe6?DwZQ=ZA~V5Xx_i)=JZ8|BKS zsbq5CptPmM4Wjiea;LD>-bC>d+lhMfrate8E^(wgBP&WX<_)c=$E6Ml6)%13yIVEv zt^>3uVO?tSzCSEpU~XUH^!SULzA2RpN>6W16X0ELaQhK2_N2E*7}zc|{Xd;bbv;C~0if+;+>+g7sz z1F~wzO6sgLLd!9P7-DP!*9mv)X0fi9>uSAPFBhxja=otVs%l~zRM;4kdta7*P!_|% zU{IFBK|UypyvXu0D~H8sJQ$4!qv2pMC8Pb&i}Ni-ru+CKtjWA)+WE0h17E;vWJlh!RT+5XOah?#A|~Uwh%& zwQEH=@IE7JRfXGHw4dQ9Fl#cMpx%|G+v8wA5ki%|Kuf9FBBIJ^E6ys+k&r}Kfcu)v zfD)=A8nqtC0%!=eN@pIH!YLGhRV4=JjG(EjX0$a0>ja(2^Jcwjo7TEQf#!>OyISVX zb6Zu5)16VaHOiV+1Gsusm6;FgCAST$Sm&lYyM&ZFCsYxRL^$5v&ZnaYCZF!GsC5Mb ztQNGo(S4{b$kS2<#KG= z3Zs_Z?(gQ-@%!JnH=nIv`JvAqJvbhhqrdg{{%7+=b9nDTy*Npqf~u-)HfY5z7N_gQ z`Op6KU$TSIH~#c%S%z2lck5Ym`uG^*O6v26_mAw>?R7Ne&JI|ZpUv7R`PRNIM`1Nn z=4YRK@iRaEx$k`CtAF~%KRUht!H3^?(_!|)r(YXwO>Tes<>jg#?Cc&rnTNWudG`43 zo%!j>*8c8dH6LzYnI2qOo*wV+jCZf?m4%1($=Ty0Eq0nvhw2O<0vaNk9_%hpPl02~ zhX+vu-R6#vj59@10%0~9jSp@V#Wb|7F`^)39Eeuy_40hVI9vGPNz_r<&8peb3F=xm_jiGaMMa70tldjq?mcU#JS!Olly9fz8ixvQC}4RZFei1 zK*kGi3%GQdr)rB!jc#|~ZUAX>nG0dp#vt=4NZ+h|`zz=fP#y5;<$B!LB4ohrJ>&2>>VilElWd{mh_$mbF(lBPa@LkIkUk8Kb0sCD~e9TuRzn zBu15pcD0-a;UF5L#KeN6^cL#B|$|*mhSV{y~2sxCH*i-SrH>k8!A;s^wxRi7HkAYV8o<+00FQ-7FARt zs2DP6t*V4{tsIEZ7!tu4!+2|JaeTtdrOoqlEag+t$tu+u?70Gx~kNMVw%25c26sjdwcKdwejwFcK0I_Lgq7$&9&#QJ@=^>s#Wzb z{?UK;)^Gpo>hwWVKUpo$>(gV2Do8LGs43Rxa~kaut0%Oi&SByGYB~G;U;al#?%M6^ zH-6w%M05J#$B`p~@x}mYR1;cSpB~={l_>_V{pb(oTib8{(U+=|S!`ObI^5lM7D1xP zN4wXqo*o@G%hmjBK7R4qgNLVg9?b0N@^}7E|3Dxg-+HYH>mUEifBxXs!Pmd|`-dNX z7`4rcyo&PV!3Wm6gJ*Al`y1bU=?6Zycm4X}(Y=!g_y3*$^CR|H`-gw&c;aA_>;5Q3!l6;-8(>T3491`&8-}Ny#Dqd z-FV|uP!`7@e}te{Zd?Niq2bJXBnou^5K*vd5WpJrxi>zuJ`-i(*sRuBZZu}&>A0=K z;iJbOu%0gw&HV90AZn53hi4&JH{8ohuT6cnI3|@*UNnR!ZCnK{y|XS8^2d*#$ZAcb z#V9+u|Grdfveso}%RxRGNmJFcQyU5ZbLHii7{q7MYB$1vRUqwB@iG$_QnjiEJ} zMGYpdjF7IEF)vX#bEL+G^AjIhV~5sflwn{OzyKs-tO61BNrHf+2rR-eB0^{zj*JMR z%q$|D02M$DnaGKv3f&sCKTE4d>RN>fC^;2~Ds%mj}GT!b|vl(fe+i=}S@^O=6y>CeY9|Iu~T-%lMs8^U_ssdR6R07B{zb zf%(|WfW8aBdlGgxXVy!qzS-n}ycJ_?Ya_Ph6P*`A*ARKkd22e+M9 zMv@ODo>XiDhrl7kI>e@lRb5wAyIM7?^?J2hE#|A`s#>n9s;Xnt#266KSeND5uq?)d zVlWsC%3?6chec5g^1R53BF}Q4Wm%SGdFJ}A)i_JWkR?M12GLmKoORARZ*uR8A}h;m zG{^=;QRKcT@-okhJkN`w(;|8Ato4q(HQu`-cX{TEJTG#e=iX<|S>r4iOlfc`z=p!s z5N=&{uf4GK#w*ufdj8qH{VRDsP(_tQ#TU>J+NP=+MQdyZ@Au{91kZeE+KF?Msht87AGglPW*}bb*vhn2f z@grwUTrJDp-NDsoqH5g)z-)Z5@5(V5bcO|q>$MXg?^)CU8bxod#wdcUNTOkJwmvx= z49n5A1Mi3+=0z^CI{x_1cYg0{fBG+e{q(`RqDzswIX{KiqKHV0bUF@$!tw!qV!9j-&YIuG?S zhK8&e9~@ZkxD7GT^0eW)L5OYJ%;xLwd^mr2vW^;UTRGy{;p6xI8 zc>n&^^=oRf2k(6Qx#ypG?$wu09zVNIDedlr7|np<@x!^<0p%=vun4XwFbZV zkN^Aay{Q=&4?nuUedXHudU1I7?sWHBIhj6q_gw>Wc6@qvG~2m)^Xl_2R#h`UKJwYH zS~m6RBMY%wu1_ByB1csz$5UrLH#GrdSw_}?3MxbaQ;Y}=SptaqUyDA3eH1fA~P!$~#+3 zCUxW(+bpAeP?Y0w1J3Ur*ukh?SKh$%V81-r&oU#Az7y`f?TKJ8f+C;X{-oP~reUqC zT9lCxLBe{C0_Ehu`cmu4fRcCQ9EuFblVWRI9YjOFN_=nH+&>W>)C!>tEQ^}E)R11A!wJ(iyMo|ixF+VuS{Wu30eC7Q!jmUvoQNU z;?;DI6uOjldm&%$An2m&-E69#hS>fl05<>icTW+!D&ay4+*8V)>SUoGR;KSMCT&@d zpqE-sOf=oTR!XmTBB7hEF6d336#%#w|8AD*rW1-HUd;6I(w**X%F>Snl%yl6r+0>? z9xgSyDa%77B_#+;6kydDlVxNGA%xh5HnwdHF?l&7iy=T`(0S{ub>2DeGwZx1XUSUc z99d_qO@G)VGbdw`23im#X=bHswM9gPtw3h5@DwE%QB3i=1gQw@Ddh-+){rrlj7dzN zgiH#mV$%YdqlCz98|u2L>k!)7p$-ePw>91#mt~P9eZ2rOOK+9R99jhpQQB4%2n~q< z8d}chmIweurLz(fKp;XCZ8y^=08k(R0*EPvP=P=-a|N@o#+4rP z`H7#J{0x81r~-}(0Y znKh3-`gV2vU~B?dNu%f8Le_9S*L&_L+lMUWGin`TD0msH4v2hJ!frxez-vz{b;Pa`om`C8pK9 zsYAZCwf)?Fy*{24&){UcF`Dh{>v*qP&+KSBBI$a`?V8(`RLL15k@C!sve>LqqV{fjFCl>zm$lmByf~;N=I%1 z5R%$AsZ15xme*AX(V%hZ=%o#%R8a-gC~BzNKot|>0Jzi)tpQ75462}NAhD`oMEg0l zLgyLXlaMhZYIVesjYTyR-%9>E4?N-~PGifIt0AR9OW@K$AL1g+)2J z<8X{21tP={Lld|O+=N)ST-ULxn|0Mzt7@@aELO|KVzpkcSF5U8HBD%RSp|$Sne%0l zjmm5|$j5`hpe%-EG03x`$ci#6iY&`huj_N~lXI1|#-!*=LPAQJe>UZTSYr$&pmx@H z?~BZrSymQ#k!QL0S>~K|);aHemia8p@+{B2_s%+Nj7b+KL*xt@L)IGatamnZRC+TV z>Wv-$+_mZTE4!2N$oWjsihwAq1m#A#)!0a=M1%!G?DqZw2#`kpeY*>rmoC+&(hTqZ;`BqAa~l@ZAp4I!u^2zM59NTF>P zXQu`TZ6?)HW3AjE2LuJOL_jJ;R4rHa`RUCY2imqEkd3D-(u9}|_lA?5yc`d?Xl1RP^*SR~JL@}(I}KK%AO58nUC=My*DogQ4DA3w3eS(z{9^W|c>b^S_aK|^he z65O~f%i{+RXAd7P&mJq(v8@K9u>f!g0BXrBSL?w1!e>6S|I7_V4D~w8%X+mm0!5y0 zU%j$8Jw3gDcQhRj_V?5UCKb-nz4pqh+1@UI4#xJ`S6?i~ zV_`jb=GNBrTMzEuH`XfI%$L)x1LKBnvSTxghE&0312>%P-?}my*$@I4SDhS%Ah6d+XU7ue>(Bc4M-; z>^A%S?xTZ4Vg_aJM`LF0u_*r6Qf?Ri2784-ks`F z!B37F~DZ93~2)_2r8Y$Qh)KT&&7-T)?IQ#aDt6Sw3mv)r3cmVn=gP@` zMpT2=naq0YEM?Yt=bSU%I%|z}#yE1uShB_%vc`}hgBH7(%cm{3urC@?HASR?h+wF5 zF4umM(zDlk$P>X!474s$LQ`!CV5BeHK!rIl!M9X{kz}#(pPW4a@#g+oO9Q%x~kP|Kwx*SKPz!zfE7fP;%fEi>tDa|sn@f- z6t%0fipT~AMJA8rl*7_V2pbceNH1!HJ8VUxX7>=kcxN0c16cG$SSq^}(nlG&(EK39V}bK`STgGy(QPyX;6Kl` z%ZK+KsKKULe)G#;D#lY&=Ic6m?^+FfelmN2b%Xi#md}k;6qf5&A~!2C=H{n=ga{tI z`L$}j%AF99*6YAk+pJb~>gO_+WGmqsgCbGP>$AGLxLP+ zh08}VH#8h>5!tw`$HU39w_eJeLx_hTygxrWS!)yrVR;K!XxERQ zFh`9Gi4e}`VUkr=Ay=yOj!jwf2 zHblUp8rwDq3m8H|Lqjfp`3uy>QV)TJdB z7xkT5@_+6dQ3Mr9zDginmM`{H>|`w1gBfgGm(unUF5OVywO;6Mp!4kquuo;pU-)nU zY^K$^vANhFT=%S8;#=wFYByx>-Z7*b&_C^Vxlu}A+_@fewCjejQ-wxmVS(gG(m8Zo zr2SotTRY^vAZ~Ts=&mXP-PA~cC|x6_f{9kuxw8nWf(napWMI)0iP^@$kz?c#ImRf= z!jV~%8#4kJGDybS%sFz-8kc!zGh@6Z<0yfzHPitwB3X;6$t5yxQhw~6WUhGT;yCX2xyWynaxPJ2Bw5>+lqxO965S_D(&>lTmeq5Bd zZo6z0Lfftu+Tzy1By%N>hH-HwvJyaYxsFF%FU}u)C=s$e`}&{!;g`SoFA;b!G}c#M zn+ODIt|wY$wtT)1?0JaU7sxuUcRM@^=i4A9nsRo0HQ`3EG?pu*?jgZ|M}nd&d;AbJbSRU zcV!Q>nmsu2BTFDc*=X+u|PCpXBcYj{g`TX9u-tt8rKpN+)!8|LN@b1TV z(0z4vI$JO2Tf6%ozxie5aO3*+>a?_EZI0B2rdqfh+nBxj#%KS`U;p{MFn8YjPLP0x zfP`FLx1r2(gKCYn*5p1LPbW{_eS18fjLK|XF+y~fat}xn>elDQ!E@JEZQHKaFMaCu zTW@^&-a8-6?tdgru!e@@ngD@yFdd+wEsC;Ut;jlqm{SI;=5+nQs6o+kf43-c zG9KV;G1}j6)R*J!y{iY#&}e%QnSC)BKl2RR43H^S zg!9uAl_a__#dtKxOnZL5Uaclqt}2lkjEBY-MRszS3pBBsnZ4ampE)wxR&l+~vr<%W zb(oDtW;E2vZZ_VMW(Cz5sd!(wVY&PK?QAq|V<2)Y%-Sk5ixqIBU;rg@+V6=*5fG7N zLctJ~)B6?yKtx$X+V5=)F%*C!Hi3hvF_~Zv=zzMk1yz#*+d)%^yecXShybuQZHs`p z%@9d|5*=mZY2Vvq0VgkoO9$Zwd6Eoi)AwGcQ1x?ZQ6TJQ;hlY?bf~8tuLS_oKrO!j z)uhI=6A1(0g%L-(L{fQNKBAL>N76@uy=3mJo7T4@O+9t2>qWb}NhRJ0kT=Aqe&%?| z_a9OZcIo<_hKWwy?Cm^LAaF|K%$DIO|B@2wg4oZznfJ=k=Vs!>xQ6!Xb41<((*<{ISq2ikTt*@ zkx4jlo`GXGRT2PIPLl=^1pwj1^S1<6AR+)7(}*adQ9?A4g$z3HB}O7dYY6htHV9%3 z2DJd-5SWw^C2}zu9evdJ+=Ous=W~Z9RCROw7_*YeHUZkUwh*Sf`?Ve1o6C9A3~a*# z+g5A4TC5l6;Ux2AfofuipaRT`2lw;sp$v3*<*G=zdi+q@wkUGcxaM`eICg_EL@Y^Q zl(nV|4L8fG@Uft1z2Viutxe&rmL@8qVUd=b8s|q@V2{eN29p+H7L5fI(X|0Y0U|Qi zSmOuVqZpYv-+KNN#r5mQ-+VL9XXU7HWge;tp zcV~atwfS@&@XL4<|h}DXT zARhtC$>T>^=Dp9!gLihkv$OZiEn!qbTaLUDvwS!`*l(9J2V^q}O$E#ZoaLD)-g@Qs zvoGHIr~mj@?tS}P$gM>TP4ts3q(T+d4I(##V$jac&Soc>GYAbx$dHR7A8(D@<*cge z5Lz25;hak2I`cjK{u3iDul%Oap)tScb$;|U>Q zjDup3j|)IC7N&b!YiJ-JPInH*+xrO8ESAVZPRr@IsVmE2VB2zMvit1I*1D=$iSYzz z3@MVJ`qJDOUPmH8CF6tv5bV_}8ltgK%})$UZe1)&8t=AsD5v|twI}s{0z+k!N1!~* zy`#LKkQeAF&)vF3V|B2%TMj3~Yd0rXuSQl-3t#|*qll0|r{fQ?Q9)x6P^8o0r+5WX z5RnLyW|FJ`1VNZV5kM4-f?*Z~qht+PLWgLjx8;{k_HR*DAtW%8G+RbhB^9G$IGOfs zI*wioq#aUT%vYtOO~GYk>He+=kXq&rx_a-)E~8*`3yO&mfesXAU0bCgc0 z#!)~Rgqejq5YSV~EHQS!2Dk))G0JS!WYPIRUQeKsPaW$rvQ+oduywf#_!E z-_82Ic-r&=eZN1zZt{@-|9)XNy$KwHgc`U_Dmar&4m$@pRt_R9aI4BHq#~*zazwS< z1rC953tf+^#yKQZiAD{mCyPm=rI&`|073{v1gdA}r%xU|tkx?M+1Wqv$A~LJey_L$7ie6?8(`1nC(3~gw;84gG9Wl zis@FozBhk(NU>4ouwJd6Jea(=WmE}iw7*x5M@VW>Jj&wi6x#D*d&`owL(An#uzCfB543^pt$a%2;GMpn^f0 zjbk0#s!HU9&<-pw?aPF{NSy(U-=6^{>G1d;rQsu<8Qo;>##fCdNe;( zRaKX$D$1Y$gle&kS|NC2EX4Zw!AHgt42Rstd@ycBLfafYc`}?#y+W8Rtd6c;yY-15 z``q34KYZs;evb?fyvYno4Bp@iuf4Krg3bMCIN;fFIdroRKRBN+h^QQnE6UpH2{nx@ z<+)FNf;0b(KYi=$u^_HKH1-Gt5v&RSrtvnT}4aA=7gy2Vuj!= zYGzScWxa0Zv+0%FJCke24~~Yrfnzn@*(ye3E&WRG%;zhErksrZaF`Fu) zy4*_=**Fhsl_FtaP>U82+7K-nXFVEJLvejBq0W5PaEr!IuRga3tp$mTQz{C#byd6{ zzxaH^&Kl2UhNA*zrv}s#XTws~%dFsXd*H`oL=cHcE*a^vl4`eC6%j-wW5|&7&7Ua8 z*n)ycRB17_h-s^rEPSLJ(WWh~Aw$+9`DD4wYEtinY!pOL0F*i|2x8|tDTInBXe6~n zz2LMX-%{t4n8v-7C{-QNR{;PbDgc=aXJWnF*dT7e4>TdSDuQ$^GWPu;$R$%~O(sRq z`9EJ!vHC`|Zz&TKO+hY3$YOiq)P`MkalCiPd(qfG)m`;H*@Za=B3wMK4Zj%yK(vcS z)_yRl7s8?LPBZjg+dbl?>qKLWgH&??i3*?yteU#5YiVQJGKwZc4uWnx+pXnQm6Vd1 zXnML?SXDq!()>7~GNxH{S_6E(!wmrICOV{2TH3yS_S2*T3<1I&%vZj-eH9B(?<7rDKvw zm7Q`c994rdt8@`fBEp=gi=84qil_i{+I~mXV4yLkMT2BeT>)ljTxr~hj8ify${bKZ zIIh?8)6=sD_a1)u(T7hSKj9F3ZocrNKYH`lRum2`gSLc}R0;qHY7C-5gJ?UhpP?i> zL?8lEV?-4gPytCfHYpv&04BXMA%#{D$vTK>FwQ2b8cWZ7;-!1v`c6*LjEd#shoM@a zEs3M0##<3-eJ1T{y?+1g^>P)IK&GSFoX(dv%OTHszB+q+IKBOxD<|!8#q(p^p7VMJ z;S}sumu2N}VzR8R8|QqvchFYnpevIbiDD!W0T|8p#-Sn!4UC7zQ+huFFae-IY-{Ea znh@6ky1Y~oR*1?WIyA8r5;WHMB1i8<5Q@xyO^ zJur;7uS76mKId53%#$~|77Lo^)+%CXO=P0PD`FKRU;!|5Cbq&sEZTY*PmZc9FT8N~ zJ71%wHRv9_f2RT1n(i6v{b=Nd!&Z>nxSm(6k{9J<=NhZzJdqH?$~h>?A#g&sxFwUmF$T@F}RS`g0 z&u17TP4}74t@Q*z?UF-dGiS0~6$jT|eEsDgYT78G#``>T^G6StkM9|8_V%A)xe8$c z<+kL*HX;&$B-=<~PUBgTG$S_XEQzM3Q4usYtF~HF+B%^jLRM5!5MW5#Ba3JhP|1>U zK+YJaf#OGK-{qMSZGstU;IQ=00!LpaR(*V!jknu%TUBjvz_QS`LF28V=JZUX#yXS$?7TB>eRQ-t zG+X<-ThBg!`0fYw;e&R$vcst>#xYZ!uXk?UDz4l#gS;3`vvOcv7J)c24W@$|&lzZq zQ&p4*v2D4XlR_rLG`10mv93_1b3|12A{^UTEi?+Kx}xMZw2LaPmb`3Z<0G{yU>vzY zM){Bfhtr2VtE{%rwtz+m0E8@paJ#AjY<+Sv%6%BP-}=A)qu9#f2luD9-_XfUy_|bEU{C|5m_GN??poJ_IY|BRy?6B2BXeBOXBDPaz^IBb zURq@hQCeXEpe!rurWI}w(4uiJ&xS*09gc==!?#|zeRlld(fg0a(}SJsJJ)VJd;5he zU;Vu=o*y6iEE{^si^1~r+yM-Wd~57K@$&Pm^uf0VyMOk_kM2Eq@}2i)_a7>+fLjXT z;Mr$*+0KsVfBHLr@XC+r!Ht8DzVVIo4?ixlf*WAS6f*)eByrtBBNRBx9C9??W_iYK zLu5q)$A%?!N}Od7YC+@dILo$%Ml7tFdbRxM_*9)i=bC!nMq#lrwu?o(JY7Pojb+%ElFwYhp)Wh>VHo zd|`+TphLo)XPz&24p!&0!NFCNc@-f*CS*|*5DAi^-W1a4RYe8B2!x;tq=F(GLTFZJ zp*bf|03tIGG7(gmh&&?^89)nU35}2k@<|k=mltB z?4Wy%6I^QNFTVeMvKcN7?{OO&k0 zkvh=rLY<%9I&A1r&{O6wfL1}fD2demU&MP{_A`0Z3a#ug+HphYCI zn(9`rRf0;;)ShTmX62}glE`Xml)Jdj7y<}02bQ3*4t2#%WuPXjU_JPf?LcveXbhEL z1_85m6;93;kB=T7AIi#X)C~uB_aiE8QZ4Z-QK#kjS`yGs@y-|re;CMYXl)( zPhWaveCyS0vhT~nSfAOKZ7a7^luV027&6D{UE7V{AZ}(6+50)EsNB zY5*+C5fQ9U9|9N=HhCVJHTp$1%wQTr9owc2t2IT*ib9>Ws8Ur17idBiBUpuauWh-ui>$*%v?kQ$IHQ;Jw*<@3-q33qPDrloX@mP?LeA z8$k{>1)eIFOyARw2Gn-~xPAqcaA8X=2D znGJ{n<%1D(J=xh>oGh;F-pOcp zPoCTR&HwsiOTZe6f-)*Xqg)41CeO2KHCGnzGL4P3#;5~P=f9fjH9 zIoHt*2V2`$!H_GBA#9hYtJB9@S8t-v6sedDuH3qjkH_FL2DZL1#*?wBtcFDRw?@%) zlS`sxIF3j{S_LV#Z{$VZHmw5`0y8>jS^#Om6u=?#PP7$Jlw=HOk}ZZUN8@752+DwH z6a80|RikJC@Srg*9#sWI6g9NnWQw^3388L6vrH6<`fkUN(zpX5;u`5IjTyG zLE1XD3yw9aqM@wtWQXW;Fa;TlZh)>Zu2AEG+A83AT%T1<6*A*}u1KgYNMzvH#fgzI z3W`FD^Ygk|mcuO~}odg1c0J0y859L(ZV<>p4I)pbUvg*gYl5%~}j8D0L(- zLKRXV>qy0jafPvOSY1eD!b^nf6gTyKv!XUT#c$?9zPfz_| zlE)p3@vcVADU_DB4ezl5K5vvt)>#P+^EGVN) z9gx8o1lJ-0!m5CZYK-+;+gDzD{rYErSfRZC`+qnoozZ&B)xY@f{o=!ulRy4{|3>wA z{ru-&hf?4D@>kE_epf<^L9(4Gsw-IY%-3fp$4^efm;Pku+O?P8c?0U4zX_6OY6+Z<6{bghxc0?j(_pr|2seWGhY~v zvdQkj?N5K|&ENmM2OoWykMdZprHOy#-~C&A&%W^0-}v1J-}%bf!{dyiapuG2<5sj@ z)*zg1P3z?egnBh^#n|c1>$hKj>E4~Y?|<{#MwjD*t+S)k$?iB-v*pps4F*A7Yp|)# zK(&sVXGTF01dRcX1Q3M@G&hKV5Cu_vW@EJ^aMS&r!NHaLZ@nX-J^J{5y<8T1yZbi= zp$S1GF9013hM5F`^;)G}&*yP=&dgQYWDb08GZ*Xi2^v2wC*>fk#TM6Y`l5tprY2m! z^>Q&8f%jlCl4z_q)*C|tLSPJ8w1kwHN-BV4tTjH(X6vT0d69Xi!p3{FMCH)^;C4Mf zJo)k$O54NAv$Lqk_EDcGNn!~0pvgl0F_h}6PK5Tfq(@p8cLrWdC#ye-M1wxBNm%2UbhQm+A>ZBg0r&%_^DG+}S~vH%;4y z1|%}8r0j>T-XTZ{RYU@65vc36lWm&*{nRG54Z6Z$fx4U^TUNE8kdT8RyCliXWOC*1)6 zQE5~nbS8 zHnP;!R{^{r6 z_)I;M*}M0&Io!Yf9B0Mb|MGWsU%371pZ|gp`^FD^^6huu|LFbq&7`n7^2upA-im-% z_V)K*dim~`-tr>B>APQfvp!p}p>|anSBlJ$D@2RVDWIZ@01~3j9D<9hO4_KHKCJ!e zqui|KO_uNPKl2km|5u-X{f&U~$}7+BU6~v`c(Og+{?=E%)vlUnUcC0fSDsJ|D13VV z!O#AUU;NY;-uTYf-ulk({oy89&~lERUstR=wFvHR4b3ga9@4oxq;YT0pU_P*fs>N_3%>qJY0F)a-Bqd`6 zfdMdrMr}~RI0A?k^x)==*>V=DxykHsXU9$A?9t<9Rp*)EwqBo{_-wjZ9kVtPl>kE< z2~Y__TVo7aA?0`)ma|2(D27u2XlM7G&g)`F;d5X;x!l=I*rGu&NX`JG3Zk)yN&rad z^I(A-pb=Ft295IsWT@pxWUaBP;Jk6)RQhsl(3K^W z7SyV0$vDHA#~6)v9-{_S0sA@bCb+muPD(dsC=s;?y4i8EjWEQ1}BJ-uK6Tw=g~Kl<_|V%nu|Zsq{#S2%{2V-rI~!kA(yk;phu zP>muoPauDG}9UdFu+3 z5B*^5^P#bx0Yj7+I~F2#d}k1rAi`h~bHtb^Xhx!HR6~gm2Y_I@&qWgI6FC4%?(8;Y ze~PA8L6{}wZ6G6}_9K1SXv#@INHwO{NJI#Xbcco-V*r3-1XUt%7NV*uMGnO<BkmYtOt;H{tmH$MxbQtWTj@u;u{Ay7U^@IbTe?aE$9UwlS)a zz}A@OKl8@H^UsEWnC0L8?O(5!i?Z+^yz|aif9DUMdFADsufH1B)wjR=tw-O!I~a~> zG@Q+=!jH0HIiSH${iVPB@h3m~&hPwDc~w7djZ&2c=stJYS55|K*#1 zI(zttz@W96F<<`Yzy9!@w}0R#f3gkX;JKUaPyA@RUa#+-Z*RM4);xIs+hMt)Y+${2 zVnO-r`1F_m!GG1Zt1v(Gu^I2~iyr}tiZa>2e028%YUAF)v!~4+GL846SAOJ&&mMmC z=*wS4XF*$QFtimQkRetjFdj4GAgXB7oZr6>=m(Q68f1$nPcrY<%k_Fb_qm^)&)aG} z+{<}&?j5xpz0ZJrF#h=PXtfH%ENAC|Oc^;;YhzsmR}2d@Nb22mHydraY>4E^rXWj_ zq@N{1vPgzVOy9Tyh@uKe68X8L+EBIDbw`GxvIekb=lSKynE^x#L4yh_A#lKyl?!S9 zOG2vJkRr1vC?krn#*lb`gh}H-om2!!FbA8SC#OhctU-&$E0IA<u286>3$f@lzgE!Yl!jbxb_l=*0o7lm~WET!`~5oFP%p(TJ4B}_G)L6cnU zF)!G@J&tS)DL3#3{q9v2`oMtR6iTQ&*?Wmm=gFZ6l4KzW)VYRS;8ura`duw9TxdsC z#Xg;av>8ID3I(XY$J*yHL2s(D@fk_i*-cnGel@_Q>GMX()RTWZFo%oV)r*GrDJzXj zfV4s9E;)+2Lzu`Iqt10atR4fgF9Om->KwpQXmol-E7xS`d)gjz8~@Z0);POaC)UwHA)B^YKaYUP~fB_26XB29Bbg9QmZm3 zDhK99xRs<$GnwKr+1SJoKtL5)R5fy2$GB#0L8G;q&&K2o+98<%xq;8iEHATiZ1a-P zsA^#55QIBEeUjXXg zkd+mTA_7_!MiAy;5Qw}g6Bze)*ElU|Fy5-{M?9Q74sq+Zf~{qNp9Mm-6`&DG1ukxPDI1&B_gBE3~ISOnOwh? zZyl7Aozc#|F9z1-)_d%Q76#B}d0;k*2u@X1n7ktU7$ZPL>}~i&MbP9DLlkC%N>&Wu zbayL?G%L#Tsq+F#gvc_t5+(;%CwU3kV0rjR>P53SrE+G=AwD_^^D`vLasyBX=c!$p z5ZbC*KKkI{n{VzPTzlb-7nR%h{-BsY`ly}Hc3*oXtVWOCej6R0ot(_?->r_1&F;Wt zZtt0AKl=+mOPM+R%D1P(;-$}h;=O_~ky*QrquqN{cT)UK5kxcS@Z*ja7(b3*D^zQBl4}`^7$5ln+Y`C-Qy=|J-jRwvb zqCu!<6v6lbdY}0`tku)d+~>CDK}mU0EtZqD*}nB1i3}a%7zoNnzM1T~~mjBA}vZd|5vK*~8O03Y%yJRHPxzB1TALWr&hm zhA0Ywg+W*qqcoj|m8y3}AjLLfa%Kl~gtlu;$Qnw%Hy({cFbYP<5;{Rt6in<+0O>N< zks#%fcI;XPmE>j%Dx?O;AQ%F&CiAYyvOM?RqDfq5#I!9;Iw&Lq0Oq1;6w`Z9T!Oxy zklbN2kP@djas|GS@Aiofn^kVV62y%eWooUlQ~h4-gP+!g_Tx_3NJcLm^%tmT5qc@{ zrboq%Ot{l9Z4jb+<`Fi6qK?1Y+cI4+wmLhG9_lZ!=VB1sBdzou?{|-2JGk!$*q5C$ z`|euPB0zg#*M;}i#T9lN?0z4A0sfc$r=k1F=7#_&y0*t_=~AgWeAcH}4t1jeB?5BJSi>O<$D@N=w;z7< zP3!Goyvyx+G(~ZHemF8>A03^n>AmMa{dw?ZYyzm-++{_!^X%1fXFnh9k9YU-;RwlC z>ybz#qLMKPhE&KJ?M#0ZNTP5=W5{^bs3=HQBD?env7RHeb&b-hD1x+YG{#PM_Z2Wk z9*l+xa&+%ryIRbS&;1aFlikc0)nX>b4xM-28fO-dL{@W(bqG#X$)aHbkn;!cfAJsw z7x(`3n^#|Y@x!lwWA*-AHKgrX6V3?M;zpD?Q;c@C|$2CZwOGJ~Qd zeug4AZyr8+_$&X#Km5W^{;))O@4Wuzx4&`k;|IU+H-GW&hvs*G_16Y|@YnyNzw@PE z`)Biq_jj*fxqI?tkRd=AW_0K4U;WgN|Im;B#h>`cU;FYO|N4KsScYc4nC$PJ<7udu z8X}5j1CwXko}4*vi|N*AYdU%MO0}F*#Oc97M2x5Nh;sJiA+_~$uYcx^AN$ z1{Psp5se_6EC(Y80YL&m(*#eLn5&9p6$}s=a)5-!5;`OU#sXSJ2S5roC3gcLs7=(R z6o7_ApvhuNIa5)WQPSc_nvrS`8~wZzH?~$i8M!A!B?nDF1-SrGBF5%aPZ%Y6uDSEYQ#Ci@c zA|lwQ0I%EAY|!X3%3LfdH-?oPwbW(&+@R29BkHF`u9r8SupwJ*cwg|;HEmo?60wOc znVMW^v^Lyo?8nW$npz=oYdacu+Goq9EX95fo?Jq@eKn@dZokqO>~jYCvZ}wY`qWE) z@%RugTKbKs`TKlbUb&~9SycnKiC0yDw3}TupaDP;RtOjwq*Vjo|>^J0*dW9vPU>Cja#UN9ge>HnvS zs0L9H43Tp#&+`yiqXi@Z1+)qkf*4dp;MizazzBjrJUYJl+&a(8?oFN^Kc(Gz$7)N- z&PY}|b4pdw#Q#U66ynrvjkS0D-WZ+&s0tB*D2JG58Dfl$q!BQn0{PHZ``7nZ^XE@L z{J?n0r{j`#cWzuagVCdp?!5i(Z%mA{me5$hI2>;~ZSqM`ZXXP{cC*Q@9}bOkh?bm9 zuaWkm1yO-yN}_5=ggeuEw2*}OLP``-AS=8dj6&4)*_rd>5CxU3C1&2baf6x8506Hp zp&yhSCA5t}S4<}y+O55VYJHA~3ow9I$Oy&uB*HRkD`6F&7HC_HV9B+!!*BoYZ+`us z{~BWJ2DvE*CLeNJ$0p8C+rxixJic*rG~PkL#pzLXe)il8&sNnEBG|31-~4ZXb^hex z+1>lO17Jj-g+OftHC_pjED*8)AXp+1R&G^LnLVNLreUe;*s_Yt5N&3t5gv?eF!0qs z{>r0|K4kFEy#C63`JLbRzx_X6{=v^2-?_K9d*#K~U%C5@Z+-Abf4F{fPeOg?t#6}1 zF&?RfFaGjByz`B(E{`7Fd+RGi)|Mle?KnrPv!yW(vNY)g>kA@2xO#2-_KPck$<dBKo`L%xY0?2veYkq6}(CSry0tSuzOHYK%%wjp-W@ zN+t(ghMFpe5Tu2|Ga|GVAfrJ5E5b=YnphL5l2wh^4-gdzkpP_{C7)45wP=Zqq7k&t zdLWCGfpLNW;0OspH1#?NpuLR`sKJhYdTA8g`BjoCfdLRpgs2A9T32{q7TKW8liY|X zB_k*iS?e%aFZ5@)Y?^}0ikwS_a^Im+hq3)CmjMi<@im}Q66vON7z9ON-2jkY5M&Yi zomv<0a3LV=+s2Od(_3mn&ou^BFezICk`-lt57VOZGLT$`iY^qsS23ky^68wxzQ*Wx zofr9k1gZj;_}-gE@%NM`o7=+UzD*^MMFMBGN)%p`{n6H^8Qjwh#e0Sz59r*E0fyO~f#Ejko|H zqEP?@Nhu8?Qq?Q$0$f z7T)^Yx$)lqaOWT!jI(lJowvr3v1kpch#FM@Fo_~)QbY<;I?lSPkT8`{q$=nLG|P*u z9Po0Pm$}I@XxMuj+X^5o=W~gIsH{%}XE! zWelL2WgbJ-7#3(&S8nXo>-O=JNAG_0U`9IH+gsj0v^akC^Pf9=^bnfn)gSrcyI;R^ z{_rENj-_223vH+ou%7ALzxxMdQYH|McgB+E3}Zfe7(?`fL5Q(FIhmG4o|*OX6d!)9 zb_A;yNp*RSIA}#9L#!8;>IdKWa_JG&x&5o-D_4u{T{2E%TRnNOzWbq-fQ|%1pjJW;mP8&iopqzvTqa{@5XA8-iX<3H)e7LpCwTAQ4nCF=lPlk%g zaA#Dn!+f@$4#p^Cpoq)IT2o}QB$+o6$hv`w0JH?E5@XYNixE{Y%LXG=h*6V8BmpqD z^=j!y+o~xFRz;)m#(!8vq^{Si#W8Xn5mnJ30|B661pslBkzrOsu$}WF8YEJ5fDVWZ zA`l^vCTAN$LW4E~bZ9-01#$`&kpQd$D8@ck_ktfo3IL`vVFU$W>CB|Wr0xs_5P`^8 z$O(!(8x96Vk!6`Nh73~jz92)^dTX7bJ{;(R8~had_C}JF9GN!#qx3|o^lPR&=DX;; zo?+hWh5>v1MY@c16m9?j1~33f+7}!k8#5{BdW$}^Fx?~VfFzCL5jJszkUYM+_}&X1 z)TLgOdUwozP~AUH#HVa4VFQExP#$|nuFaIWPi*)eNfKU~8(*5PV?R+&Q~U2VK*pzf z?n~dhv{UU@&jdY<8TuJP|8v`$8dLWuu#-P`zmJ{9Ck^`;9 z?oQ*D+jVS~v7SqN4zV_Uv_o2C3a^xx8rKk;&L=ZOW){^LBdcY$ktqfUQ9}qZv@zD9 zuG{rIHglB*39>xP%OT|>S4>T|WsB{6v_IV5A8j8D$2(auw8r&x{qOU&aowU6dz4gI z)UVG05Xl&0y~{E;806(3H^xDiJEqui;#5w>y!kNI1-%$3MeB8qN1g8G_*czL-YS5?az8; zOP2IN%m#N~LqzQ9j5*xQJ655|B8yZL{m^P?gdm{xqGvq``Yrki0;C_HHvs|!Ne~(h zK@!mv!6v~bMOLw@S>qk@=5U5R#juvUnd!mYS48Y{GVi4nz|DL1-Z89L%a@zkXPXEE`xUR}QWbi96+hOr-4DfS^o_iqLS0QQ^! zoXN=;0)@cs=m1?9jT+&An28ZcisnP+*u|~~)Ai-0sFj>!*XKMV7zQp196KOyn290n zANKQHx}o1(T^4~n?U53aN#5H$<6O#NlDVi65EW$Qm~&A+L>lim=AZ0c+ zBm!iQ#88{trea8xhLJcRgBTl93?ZfjCi~s?tH1r~yTAGM!*{pu@9)0;>Z{AK|NQe; z|C9g4|LpSh%fI@Qzu^7hfA~NDpO($)k+0vspUVB$AQKaho14w^m;HJ@O;cR0E1M_3(`-@LL1(Ew-{q=e? zgaDC|0~68s>^YB{?blz=-+d!@cbW^8DWr}!&&OA<#+w^6y8G^NnnVeWup5Wfv*)+p ze!J>$Kg~1s_=q!y{XUJjW2%pMIiNXnKrR5a{CaGI5Sw*T4L- zfBEC0xVhY<)fG?x%|MD2tdz3d60%^Vv<3`nh#UY}RlpP|2u2LSJ#4f(db%ot<&wqp z?VI0B5AO`Lm|=wyqj{}|$#rjBsm}<3B4IL4h8=Q`91sIyKnl#!?|h$L90F1yyfjLI(yRaFD^?F#X`@V~Tz0C+j7&&_M z4bGmeSS6qV`=G_i;~4fTqUJG)w6%Vh3aMHXA-dZD0kv?BVAhcIMki`pI<=yj+BUc( z7v7a!G^LK^)^aedG7NR&YX{WY#MSI@;ZR}g-C~t%TsTorJGWSU?wU$xi)VJ0o3vyyOfGPwn8U-?o(p-@)}zz+_R#(6{Af6457{$gER3Mtem_Px#p&SZ9*`AcAFDB zNi00BSHi$)>2Ie9!s!(`PYM9cM5SonYo1K9+000h5>VIB0Wq1;#3Y+eCbOI8f;CG( zOJY`vt7wvH22)YvSo7fk0Du5VL_t*3yqyn^rWw^Z#?UjxYfdY~9w@{#q+#8So33BQ z)KzUP{dm3m(Lf9cgotKjNN5P+SO$Xv03mg$i@e$$W;BvAYnjXhU4gYiMTLn^7!tjJi_!$luyT{A9|}V++j%Cr!|;&_tLRP*lyi7(}Eh4r?)kh^ZsXv!DLq<;zdL{-035?C0%}N@0i#b-1Xd9MDD#04 zIVO%>5XkcZW9rkO3XB{Qg}@>*tkxkV1RyLqXPI{Qga)&ff<<*VlXqsxR27Fl4jbtE zc{dvdP?TAek;eY+_Sawi>7T%E3wb*~jv=JbjjPM_Z~hH`IA4zH^2Sg|F3@?$5)%r{^+0mH^2Iuzxm%?{_M-=Kly{N|N55?zxw|K z0+|bQ7dMws=GF7pup065T2r4z%RD35aCK?Sgk&)$F5}Bjar5F~KkXjh$@bAKbFhdO zL*!L>`NfyRION^Ez5O<&NEpjp>|skLWj>f9_e1R0aeY00`bANB_p4vM{nb}IKEM3z z6U7o@SF$|5d1r#NS=V)Vm~Ea?3|B8-=$upE^<60Y?Zw3iNTxtRL*Sq)dI$kHfS{x< zAaw_2=q}fv|2S-}00B&V+=P*c;~oQt4pXm2j2J?&n%qa1vS$v~tY%c9$=$0+F@pK9 z-95YkV!%W|fMN)UvFglG03bsml-lYdLQH0^>F2C3p8{d5c0~jf4TB+j@@-X77r{r+ z0SM8|ikUkK6;Nub%=LcJKuw{M2m%=q#Kc_}$DtqlG$eOLM+P)@og?NDBC}65E*w}o zBB~!go`wtrU?cD3It#i53RMEsO0GI~Cy^A?!03d;MR3w|#;WZM?G#uGJkD@BIk4q0 z6f4hq8AEDJud4jKR3xp`T_&k;(HTAlo)&P9)!ouct|8Kn)`ie!zZ(r1K$~jFd6;64 zaVMgdO-Q=Rh&+i7wRp!PLCvi$mR5CRKi4x>F^v=7gL=qhtpSP%Zh&|)*xU-?qxzVC zJ6e$cBLJ}Ucl~FRGD)5^??ES&jEF>xA-J5k8_R>vrZZ|0kGraBl~QljD}qXyOpBqJ zv4Y7w$>BEVJ)wpaxnFaLz>#U7w5D#wap;DzAJ#E-#9T{9{a8Y?T!FLxgS9TXe;ovX z0APg5E*TAg+BgFe7>BW2&0{IESTUOsM2!(r&WZ+s>EZVA{o8lXUMAw?;0_Xk*mA-Q zP%6r={$nvAGDJ231oO?n!>xlNDgt0?O2i1DDhSAc;@N>QB1#q@6e-|a92kKD5r-gU zdi%@2;W8Q6-J5UMpM0_T$uAP@$BR|Bc|KmfNaIBshS+!J6aV0J4fO+eOn^WM0Z>fA zw8@DR15qgj!K(5pG%}lMh=BruAt9AH8(@gZL{r~$OnpE0tC5NNVchR_CFd0M;$j0K z-oJfU6vm5-%NMT<5pss^Ui)DhS2&t&vx$^q0pt3MpUz_V+wWkS0Lnb=`qc*G@cyf} z+qeG=nAPUH-~L*JMT{t=A(<8q5`}XSVxFh6o8CYBGapddl~Yzx_38 z?gH?z+TU-*1VF)!$&E~A%~^K@X$)Ng$+8$38O86z*!}eH|J@(`M?Wc|W=4(}iHhtEC~d9;nK>~c5?f97 zErcMTC1*3OS*!z*W@=7C05iM0eFp*|^acd36M&{bl>uD=K{77QDroY2wb=0rlI5_3<^-Yzy@N#NMxX3?3AcR012xCX%IIPFj(8U-j zQWM`~*SjJ{3V{(xo6ketr_QLwOH^8Be{0bL2!cSW=wY#HRbp*&swe5~Eurc}yVO8^ zTB~KXc6J-(e5q5RQHbgRRElXcVYEhgqJ^OumRMN7!m-RdkJ;^)b~YY-nrWQSo=$;T zt74GL6BqB|h7lkh>%}E)Sz;J80KsZxZ`|lQ?qv-Z2RnTmcU3l8z7P6Lx%cq_K^OYB zQ{q7dy|gE9;U*OF;%dFHXUq=%4Q`( zl#&TZWd6-pzv+g4wYf$LfD$k|7YizfzHT*yTxDg5nrt@LM5|FB(8Xtv%(UL`6$f(T zO7*)|fryPji&nr}M3E2$DDw90R`&N{jNRt>yw8Wn+lx5t|thub%$3m6AXD;y2ztty6?Y_=Fjz8GYm z%fmepU`z(&sbE%UYN@PR>&jnSzG}9C<&&7(&(^L$nsi>%F zNiirCp%85P<$v{me)G3~uF6-hU%vnCucz<+D%z|nadW|&i&?}cPfShAT*{;rh+|xh z@4xv<6g9*8^$UnJi(x5H4y&6LM||Awg-{AnNGhPa-Tu4Z#%Tw`di?CC&~+9V1MlCz zhr=8%Zn~S->Dfz>41~(izqrO{V=ihXZ?0}M&no*!1r+;Xxcg4F@9*Qd(wyhFZ@cwi zfO*ars|_b(MvE9?0%m0*5oWx2`3!ruY`gt@_58)F&tFL1Gxg?Ut$<)OPdkM!^(z;+ zckx@Riv|I$lwx(l9z=@Yq^@h{#lU{IeR#Y_?f|*H&RNFfQbYhmZm$K*9K5f@#72Y^ zkpiLt2Ef>wd_h1EYGKlf4Db4oB7iDlC22yfzPuEode6D&Bp8APZ_EVlQ&^4tYCQ~n z3PeoMln1NcK9VbQpy9Cxdp`MdI;vAc;4zvYnd!0H=nY>*L=eYL(W-XDg2A5bF0Gf0 z3(AcSd!y8WmAY-U&L-GmsB5;o!}8E}A3e!;e%^efkF`K+E)NGCe#7|PD(^3cOT6@1}-MYTmYI^G$2*Nw9f=v2vo`p zs6^!QeQ02WV&onVA_Wi?Xr5(QUr%k*H3sH! z5J@@bIp@%IaU3HNA;i$duHSRC5GnQ?Ck`?7S-WvM*!zF?SJ{LP>L`}be{s!utF$SIboh%z%7ls<)i)jiz3`@jEh z{5c+-%0puzQ%hVQmJFZ{KqW7tfw+>~FvNrc4Jg zr2y+yC%P@Wd*BX2$P;%V2%#8>FSBwauuyG5RKyHb_5SX?h%hq%1Cq-L zR^<&2=(@Tb+!TO003jFy1tbCrj(8d{5R>aVn$O!?LupyTZ3c0fN^!4Mu!?M&3Ltn{ zuU30lND!HrF$Q*-$@SRvJqIGr=Yc5q4Ki) zCC6?0d@DcMq(3|-t-?JC@QZQ82TZRM#mx4XW2A1Sv>og9GYV8|Q^NvJEPFXMpt+?B z){3U)H{mf@!5Yb#4AA?nsE)ydYMIJhitIsl1V$XwICAU|lgpiRT&H23#!WY@V|1MP z#H3@HUTzKTkA++RXDf(NmotBS^0CA1G&E%L*+6%Kt>=V5gM+_)hqBQuCPj5>Bg>{h zs>r~%w+|G)`SdkHx2Dj6JArx&Roh*It}bd~?t=uPg4O@3X{1z~sY2y|Xhv#A)CLaR zcbEKqP@xK&2{3>Fp_z&3#iu{sfAg#9;db6{=SRGLalL-_y1#tZtyUpo2*@EChDJD| zMZe5*Y#=i*GGsdWFo>?6J->hRYr;ej5K5pB(@0TmyoRLvZ@!u5NwA2_`0DD*|IR;*xytygGv?wFQzQYI{vKnZ%0C0J;*&TNK{nkPe zofQglT3iqEyrY#`pc`~<{1L0$^GNq_F8uXvRZHQ;eD1pNBY&D{^=*5 ze{u7pA4{2#=;o7`D=PiXC3m3|(0!39UtQWY^L!}d%7%;QyW97dpFH0@yA})_0Llzy zAHcPk(Zws+6p;|QP0|`7n%bO;s;N)t0o1y;<;JG=`1r8f?E**iZ3w7xjfklF2PNR> zR>O$oWAcE^#I7-EP|b~03m_sSLqnf4G^OUx;M)QnHy8)7(AtQuqOk!I5GX;5u>rd- z4*jqihE*R@WY_0kY~`ZYzBTaKN#yuwr1_zT`Q5XCq~~z8hdx&f5yz#QazibA7mo!% zL-luSFLyNp_2SO#ly`j+?EqUV))`$|#T@I#d=j?WH`6M#aV|N5)j4f>-m#BpXBBk) zn`ih{S_14W-1={-$x>x@9Z$(J2UO>u>S;0KlY-uk_0QSII#TJMyg&zj-Rg8UgF!U{ z(iW<{MeiS~iqss6tYr~u=hxo9mRhl#)w1Tj<~_=cAc3l!4Ir2n)EU6QippMeHWifu zil!!j2uYO`$Sjzs6RK2-=v>Mq(}R^l7&rzVIu41#iZ~hdA$GA}r}3g2Rxx$Vp~hW# zn%dMWV;?NsdhHh=x)GLPSrSiQwDdv{k%<$Vi5i-LxV5u)RTvQ%t?$RpYR*%hcV#*l zM>JJX!J2&B-`;kCuCE~t2H2SeVnSxb3V{lMh!Ub&0b^4%5Y?*f>;j^t6s)8YmNxU> zDDBRCE_L1vT~3tE3IH%MK&S$0s(0@mDWeHYkNffSA3gigk1w7->o@DvrPy^G5`c>m zIk2SecgfgDiKt{+x$}sNrVSW?DVSiT&md9op($&)oFat~Q%a($rYX9$se>lL53iJ& z*$^?tNNgo*WG-1K1sn$u=-Z_Ua$}!~gbQ z{~J~=^Mh*MzWL^}FFzTt*O#xJ@4lUE-iz7-p8=rcqN)qr2>eVMo$ei-wVO(E~H!t#>ZU2a!3Bt#U!US=ZNDkx6pJj;@0ud7>1Iq?DPl`n}W*jIcWCjXYTaa!8 zuK=V?coIO12$GBB`|nIu=Xrj(zehvFw6J)I-7AQgV+awEjUsU{2!;&k|1|@rG`a*Y zh$#Y_fjHOFXL^au#3ePrdDm41b{X`sws#{b5R!|+G6J(<;I0dsakX9zLkfYQ`QRWE z27fRwYJx54U-InV@xT-4v~AR&m1_e{uSq@nkS+165uETCM~+eDB)+t!WJ9-(V7SMc zMRTI1By}@wHF0fDQ-DVL!sRfRGN*;i<NMWuk)5n4JT3wl!zHIBBFq)&S=FGefM6~uC8yu zHX-(a$<3$?>u4MSx?M2=I7)9OJ_s)`lf{;AlKM()+UUM1p$`WMic>JEQwk!1>trA? z5?npI>Mz!62iQppadmm~;`7hCi_31c4k^Zz2-&pyk}xh@jrw5ZI=>vmh2Zr_#L_uu}>pTGP1 z+lTu-C!%32`Jl2>GgZeE$Xz!GB=jkcmy+}0@sUC@gl@C8zT1AcpXV}9P=LS(NBh-0 zPxtR0BEWEYb8~r>_qV_Ko4*w0Kv80{y>Ql{Tc;SxA)AV*xV}TaduJu5zDGhJQ?kdq zhyC6CeiqBn5B)Ul_w%8s8Ke}`)$3Q;G|z%XJC28WdVGI-5m6rZVtu&i(`wEApem#q z3~7C(`yJUtoH+Ix)WCG!!}iTUcdH0ih*F9n#cnbwdQ5i>C~Qy~MzNHAfS(mm=yrSfGUInNM1N9l7ey7=x`bnFrsT|7?Od~vEU;!F;H66eaZ86 ztgv&JR^#B&H+t;#Az;MF977=HI^cTFv3erh`~4yKBQ%y{nbpE)CHAzQF1#ty!8^X9q_!}AOxk%;dL4`V5Yfb2}g>o>}T1I=nxTZO+hf>9|t7eKW zlQD+N*tJ)WPW5w^8z7v@Tpqt9!eM_W+pkgg41{PXGjVLWs;XuLF)boR%Vgq38yj|F z2AWJ!)kIO$OjQ)6%rHM_Ihak%T{i@Z7ZiHJNFhP!LR^P#-L2MLzY4LZTJJXd zrx(4|#p1~enjV+r`N=)|X?dqpw!N88cX{A2TvTp=Or5sIqsSh(@^0HnGFlS*mQ6=iSZl32NQu3Uq1BZ$d znFyM8!`QD@@-U|1Acr~3A%rliF~ywA^v$<+*h1Nm+4*TtXJJ0>Q2VPz5GQ5BDczD(`-U00zf6t({>l1T^w#7VK))!n_vAkPFn`D z-DCg!b-&)kVZa#YY@qWH1&}oiG6!NJk~Ag*z;Z}@7<t?u95+hNlEf#$=_ z)w9))eyX;+d;8Vq)hp>Xx-Dd=6D8tl|0o7&y`ipG5Xlo=Tnf@WPtbS3v0FdCx_M^b z{dEkbAJ-;1!0z?W|DzdL)!5TmpqvqGpxA{F%{}UU3nel@vur?wk20*i@) zshFAWr~TouV~)Q1i3os@n2>=Y_~N7!2H^;V4r4 zfdL3EUseIg&pI z9;e%1b9ux48bgOB$UOjx?kYBl_)R@I|T}jz2obj|8W1Pf~p9>JrM^016B3aR4t1ETwTvU zk{H!$l1Lz?bx@9(oX|$pM9EI>Q&rI_&q@XnU{(_qoDVaVgC2IVAH{5Sb=|F2ec#2z z#6(1klsq`j48?sT(3+$ll7E01p)XoAB-iNRx{4cvUwvj0!N8bERRP2%0e6-OF>nNc zQf8tQLY;E%``*k%ICecT_ABEU=0ljLLyT#4@m%ijrQgo0h*ON6loCNLL@xWi91frg zc_u9gcKhG{dHm+VfJNtY`ONbEa63^P``91Sel8M23ciIGp0=Rf~N==d-H z@qdZ?!@5s#yeLII*u-JQm(Ms9L@86rhy3ivKMz;WzWs|o8-{qlz1#0HL6?RVr!H;Q zbIG)uWS&8%`@8#mzfG|lUOc<}@{8g6+N7jtJfw~_X-T?MBa2-~9g-2u9KgzCIImxh zES%_yhLm%T5p{RJ;wfz~tS98hhexqEq;)^LQQKIYKv`w5oGNLH z=m)hpWn^k@m$&RS{(>WuY55|@ZxoKinuTR`f(AFKjQX2}A+^vqPfDY+DDb3dXsu>% zKQ$IlE2prvr=PYh9VTrlgwLW9_^w=`_aj%Ur3)+K1N$wJG@ENDC$m zP$i;q;d~RCDZzfbEw|sQ-P?SZZoV{#U9bXDx@BrExVpok=gQW zd2cpx2*awUw1E%_BS55(C=O{@r}3ie#~6n;ziXhnpbLw_%SWRxKtngqSb23x!tZ(< zr8Q6W#7^y-(1(&vBJpwYHQc(XXdwdBQ3?i*2x7|0gg&8%K!}IK1aRwb)%62&P*rd{ zHiROgsuj_yquFX&k3h|04D+0!8At$_&t|BI8K{`5Fe6~?l@%%OU$3I`G;QC$f&D&E zzrJ~v`u>xjemPuTaf%$gIYq}*6RKKxL!rTHvRgd$AR+)(bIM5sFbDrktKey+k(z3Q z`bCOaAqq&LWJADyllnf*Gd{_D5HW;+82wvvjKmH>6xnaP&DHcUhQnj*6Nr{Al%fFE zt@^+^-QDSASOiQ{B)R>qIJAkv!v%9N1R_a&uek&SGergkoF}&yG*m^+CIte6F#-dZ zA$HxfPk8;jNI5(n<~j5iqfQ6Hkh(amp3mDunI2=AFE-;nPa>H++}^$2T=dtUelBl* zTaXSyKmjfH!)lfp4sZCPKRn9xXtQ$KjA@hhyWL!HyWP%n8HeHJ7hhQ5em!g-?hkKn zLl+HkkWes&RouLMF*OkO7?f4K~*V50?CK_xlH>Go~9eSAN*!MIH>#iT-B`4gx z`t;)ECzsEzx4Z4;#k0+`XVcvqlD)HA()7&kA^o@H*u*JWYQwJ zNS16Ss933-wfU=u!(7SPqKYST44`apyPq0zm%7`iTYDRq4uy3{c*;26gl&i%T$au1H($VN^zuc`P_;a~ zc|*J3tZr5iS7EqDD>5IBEJ2Cc#-L2JICepv|q#u#oRh-{)gXd|4lGTv`qh zI3C+pK6>Q})ipA3Wahx3n4%TMVCsHf$nL6uIM4IL-FG4)av4(}0y`M%g4u4{?IMx_ zN@gJ>BFs7Gsz}LTU?M<7MBZ69HIag70F<*D2$*;{7s;Szz%uLZ?$Izn=wfHxYPf#+ zYPGp&;+v_aqtyBuHJ25{rf<+V^@t20-v2c-(*lUzCOGNfG~z~$!=B=?su75oF>@(p znhz=lfF)OcXcaJ^Dr%4J072XhE4zMGw$uD@7q4!3zvb{CLC`lEGZ774ZyP=22T);7 zAq5DO52Z{wmZFl)kOOHJohG(os{6wP0LVcJAtcCBh0{be3z+u9kh-W5(#;x)^22U^ zc&CWlyPeMa7;ts-4At`eoB8m#yM6oo#RWdjZ@+o-{+EAt`_12U>l;EA4ot|%qGGW# z48yqQAs)6xrwpP0=)~mbwyP~-ZL1www zjOq2w{^4!De;=OTgg*A`>olx&f7`D&z> znb&D386O{hQ_9Ta*sU&$V4xI}M#?-N`aYG*E1t^k_BIYFjA_4pycoOTa!qlRdG0T| zw7%l?>ebKxuwSiJCW`%jH-&NNUwtyYdkY*8NpUcQ%i`7GL5pASe zbJirrTF`8o(iMLML<}F9nrZ~FQ+8L|QX9l*M_zanv065hhG3sJdYAtkhlNhgYMYWd zA4#&4cR9`h`ID%5N1Y#i%Xk`tYKie4W2p{()cF-cP;za@6EzS6BwOSr8-3aU8-ETF z@^qMuP1x=Z)Zby;NG=F00wy5J-t<)~s;o9ko^;Nt6PSb)c^oi~fd`^w$jBXsAr502 zH>q2tG!XlWKjI}HeS8$sUsmMlpN>rLCoy%A==Ox~=@|P*KJnx;Y9E=2#62{Tv|jHj z+2UvtGk4uEj_Z;$0?spLLQnwp_@qd&B@;TA43BqcqJ1yj$lPJ2n@bxot72tNa|>L3 zLRDN56Tv{;pBSCfBmgrQ0tOLL6~x*a05DNgRpS8t06^Wd@a@0-=QlS$SzTWO5OG9K zfP|(5VgLqA#0GB7qzx-FM06SoAOZwuSfYsmm{IMjwKI2|CGdX`P_?8nFOI#NCsI_* z$H7xd&fkWHE0~!8nH5*s?N^)ii`R$8+r$30-yig_pC_fbXDwDLY|q20yFr^16LRPb z6mVeX2>7f2=3fj$OsgLS?pL3_Jmfs@wshFe<&n{dy0Sg!KEq~+W73?~ zo6XfHpF-f+twW;jS-)PV5D1}|#_cVeX^1wA!??N``!wwyg@@SnJ!&L-eAvfvW%-U7 z_2KR6^5smnPF-FlogP=|diVD2_M3-s^Kw|Fn4OJ53ti*&0%g?D|p99_rM2Qf?0B2uJao9@?!0L?jP z0rwRJW5dX%iU$>Y4Kx@Dh=(Mqd>6D9*tpR!2>>gw>NRzpza$@g zBn9L|F$9VU`>yZ%ZtPPZ9r;4<S%`80qmNn=t zlPG8Go%1IWo<-Ls0$Qz9PvR_|KkXC|Z>LY2#O7H%X=%y_-CtV{qkX6IfV2paz%lqQ zaE2c!Ic3+D_V>}>&f48c;nLa5-kIGx;GglvJ*0%NfBs{m* zH~63i(00;3EOy(=&mf>P0K?gpL>xF;BqWyrFwsgKRHG(5J`AH8Fo(y7$K7tv^P!Yk zL{u4p7d7sHXi!A*cKhCRh$11GcSAiiEgIDIOBv=ORY4CB5v5Mjn}~QOpe6v$Xj<-2xg_0%bKrA4Hl-4V-6#i5XA6yzj<{zytpabt?ai@rhc`F;|g@L{a$vNS=Z}L z7}ECrgNYz85i`e-5`_@Du3N3f%PRnbdCxZ4{sGIRQmAbI+5hqX!0XE}%Zryc>C;!c z2Q?8EDUZARx9?Q_ZSk8pb%ru4e;))a6o;Bi1&q8V1)5PeUh$B~L&Ih$>1P)X+p5jTYVBixADk`!1yv zDW;+(>bxgaQ!`ba=BbD=^@5dxr*u{YIOSx^*=fNK?IE-hJA6175rPV4mSkre?< zsFrxZ=tG-O$sGX1fJng&6&R2MGxsrdDGfs!hm-;bCSn(4b=|9gfdf_{>18E?Gn{-tq7Y$w6z1_C0*2EJa;OBb-JMv3PExamUsMqBI7lfZr&%-{su#)i@^M5$B0@_FC&?9o)9m%9)#jP#xLPu0SDj{hE3{+7>~a9XWX;1 z!nfLGJ;@V4zChcWIyPV1uWQYFY=_jRewac&dFP|5%h^HsK#ortkk3DesTC0yzG?s& z0LG5i98y1oZWHbw_S?rfPdU%#rK%S1d->$Q0u{;I-7XgEillBNN_Br|&W<(AYC$A3 z_ML>Q0Z}dWy(ShXU0J16fQs8J0kIVY05(t{6@iGU3!CRRH(!3i-N4`=b0F`Awi#bj z1vGDgfy>T=yTQ?tDPdhURsO9huvSl|YOq{6#5c2f) zVOYhkA5x#eGIO}Rx!DQEhnbK?GBQ!Oy8it2#b%5l2?5Ruv+VY}GR?>d$q4bAfBz@_ zYSUdkAD`VkKJKQwy{f){_YShGHmlY3>oRACkXE7V0;-Ky&o6#{v+5HNQOLv=cmPvm z0!o0LKoU_{3;riWX`m23Xq0 zhrlh5EocFd3`|_K8Nh%I9j|fflm*5RIE4^nh#|(vT?$=FT?~PMn2?AFnK%U((^iN{U+oOE_lDxJc=l_qWWkpk`5 z96v?^utjR@JmQ{s{~mwWD%l3CHk_c2{4O1~lb0M1x)O-3f;(2Re4vW1qmfo7{i4(X zEsY?xl)CZR%l-B%C{v!xVfR=l%6!l%Tiyd2Gk4>_si)WjMudc6pl*o$MK`Wf--pzZ zCqN%wo%&su?7=^qPEX1iy!^CtvZO@qlC&#XwZ!O1!ulAJW6KLq&bE)1*ER;?X~P2u z3D~uoEdp3H5fPPKN-0HE34xKA1IG?SN1>Js5 z1#`#lzgSxkASNDi70FEKSctQ?DyqadI429*=|%uhbv_H!5p*I`tT^97Txn`Y2uMW1 zK{_NPj4|e%PrEc;;``8Fodi);Dfw_fu+;af>lYxF^Ijy=<4$oF(V~zAbidDcyZytX z>>sscGY~)sks`)Xs875ax$6lCLx30r01SsN>?Z+%$fi2yQlQ)PsT*&up}QQPJww3z zU;lFc`fqjjo(fFwrt)}8H|ybQv$|eQ+wGKPJB8KDFP~xm?YsM2WIcp#wNgup{b5#^ z9tSI3pfZ*1yIo-*#5tGo>c&D$FJA7EAKt&^BGb0WVZMBE6JsQV)p~`B$wVLS?(QFl zS1&*NgDV+ns`WY{fk=6)g0daKn;);jfj{n1V|xvDUE&Kbty(p zftiq*D!B>)ap8Xi4$fg%dc8jcIK%e`Kh++GjBxI{gxfqa3oD_yf~ z*637LJSWs5E-bCan>rw-Y-$TPDeE{_0efLt>ut;6YHfY4GK13+e4KYN*f(@8lX2gnE8Kd2TC6vt=C z0fP&?br?F1UFgm3jzbm({a(63ooA@%yFchkj$Gzn2VAJIzuAskdPvBPz>`l>zuS?k^mVIXK>uda_xVa z0nLSRfmB%3OLsuoodll9f5 zoZ@j#!z#S^?AnGQu19h!jX)wU2xTOOsLbZh z^hMDuqZwM!QY@FeKL8KbZOlNlPMQLOsQQ$S=Z@MKg(4y%TC#a$L^2A9onkU$aHkMN zpSZ_rz30o)2`+|K%t!$Ng<3a6&9DN2&JG45L^Sq`Mom&9QVQ0`ICSG`82T>6Kt#w~ z6(ayK)SeK95SV?Aolm!`)2`O}aMk(Gi+D~= zh7l^#S*;n`Kn%K?kyg!0K&;^D0u{=#Ti1H?1gC4!>iE4{KUBlA!M0Z(8>~zH+c;ab z6n%=hgQo;;T--F%a4FT#29q4GTg&dRjj&c{j;X32EPyi^D4qmps~IEU zanPuJa{HFGTsh_&^*;orhz6);T>GvS#a1TJ z+0}FaXW{sqtQbFsuI7k-U6wZUM~;Vx>z~L#RRvw~+>C$`O;(_)d)yz8lp+)YL`5bf zk!(^gs%Jm*EUNn$1%m=15vz6Jdxd+GwHmUj;)%MVg~QKv#iJRTh^T21Q89I%I*3^Y z#9^JLZG>Hj{kmU`#4UlVygp<=qhOX%4+u~ddKc;*7$6Fgn`Qt2Ae)a-p?8p@86t_B zOUA%O>JX+@TV`B(#%7jt1_UIY=a~p&OlD+$AMc|L&50?5OL z`m4ml{@dU58^{MNYRn;Y-MSmoa5?v>hz^^}7r*%VyTANP-QN=o+lR+bfAM#Q=P$Jg z8Wd3=^sag6{fe8srT}R%z$?APdl~Rh7EJf4>BQYQ{ zP(ths7?FKrEAC%XizPH*P;h5XGd5tvY@lE+=HjKG1A@lQAC`%bj2M{NnNx|F12JQY zoVsr8x-Ny#rgo5B8#u{vK=6TFZ;tLONwEVGGgv6aqbo zXy6Wsbxg()XV(mLwSQ}{Fn}3|dAr_Fus;{ zr$?qrJAz{m_@o3qhP4_hk6M@pCm(Rq**)8vkMm14u&Ol~&J*!ZJqb>D{-Mk9G_)Da zP?nTqLBE%SLh|0YRgb#mi&UV{a~@oZN<$Fvb8g(&OVnTmC(`xf`s$~D^ib|hwirSf zE--F@BBvn@n>1`=Qf0bq|r;%c-oDUucf z6F@appF{%Pn+k=Fh)skjcne3-Bjp4D27x@)M|5v;1O*U-;F%u+c;E#yDPmfDq|vkh zl-1R^o44F2j!riAuv&*1)P$-hc|}Z!7EQR|eCsB94q%F^t~Kc=P73?Yr0VSrKh;er z6dBB77e!P>ya$|1i2+r0I!r_iKq8V-a>I3IHWM>dk-&tA`7o=YLGrOFERt3i!_CY2 zu+#0%=7&J00??&$d10mSJ{uSkDl-BAAqO@zEC<-%S~ocGXhaS>f?WY3;>aNYW}LS0 zcx$D|`XvU0fZNT>#6n|%xe!uV zt-J9$z5M*J+UWfQB7X9VKU_V#{_5ZT`Tg4mjVm12NX%Vujz1Ux2)ULmP*E^ZL`7o9 zkn0$!WaFY7`IJb#REt;Vf%_rk8_SL!!Tt01y(H z=!u;BGInzuB=JvgL1dvAEoI3vXkupvN>!r6wV+Qrgs>b^B`_WPzi^UIwBq|n%!L}a zPtfOM+q(q`I1Sqk&unK0Ta~-S8{b9gG%DBD;|a&Ds&koQrLQ#<;yA*zm@8E_4A$wb zr-6kR?wd!DNV7XDw~^^_S1i~|N1YOHC}wm!&T~smJG@brPc>b3<^4q@WLLy+o z7*IeUJ5W>CYXqhamu?3D!c3~whZ_qaVJX=}fdoy7*i`d;K*`Jt%Oq2U)J|TMP`QI;)r&s0gT1mCjX@3|2ydZrzVJS21;DO;NSdI>1ao_Xq^lR838# z)~x2JoBvZ!KpLwyaHe&t%-cBNjcfEp4pj~n=V|t#;a0QTJWp<(l1m1lJkNQa`k@B| z5P>!p%&{|t0SRQSlILlssZ(Q8(>&#?oo=^QRAfhNfSOh#Op?oc$iiT3GY|k#Kr%`I zfDn;7Bm`paf&mc7u(^B`OE-O%MfTabmNO> z07BicdU2gn;J(8$m4`Pv<<-TDFaO@(SzTS!4WQyBN=$$Zrb>u$p#CbYHh^|G+-aU5 zYl=~2Qoib+eX0oCZ@%YQ!y+@q5v#+A6e*>MNCpEyM(&6L z5F13I&X@sN4a}Gf1ymtdXIeu85fgxfcyt5uKPdoVZZj)}0E|RH3_u9X7*klSy49*5 zy40l*n2C_FB3nex(5KJRmmE?IRBXo*1%%2rZQ3$%C|qy3z#mw)a3Yq=Ea z<*1FcV>mkNkyol_t8zVR;<0#M_W7suQ$^JRU}|8fD#b+Ahi9#*7F7c+rn4G`7-Byt zG6JG1xVdlr!elCD1zKALk)5$&6+mWRpl$D4IyZn2s)C4GZ4Ch8QK!95_nPX`gQ-i` zOjHw-nN8D#06FI(IfS69A%qapoU=|sM5&9b%L_4$Q%8imjvmV{lwr8K%=;H2g8HsJ z?p1_h49{Mq*q8U;;bAs2A`n!9VsUhcn_{5ANI{t}PdFWHI^eX2-9F3*3V}lBA|Iei zR#Hrh*@H-#-)zLt6C&U@CI|cI+cOzv*9o@%m>!V`gvLaS8|oCP>U2 z&`d8l(I1(#da$82pTxN)?PJ>JuBzd+LMZJ~O!eb^$k7PUN@ z(sE5s1+ic`iuRcm&u@N$-Va1Hr>NC^RkE`p7sTGZ4Igh6EhOhhGMB8paKky)^qscA6O z;*y_`BNastS%F-=6c2J zJkO@)ke{Ey!~URV08`f&DMjXzQY-{HOU}h>lfaPzbLhJD&G)+v z*t|m~j)^H)=vA0gZ(U?wIg^4B75VnfckjRc_4w>ZH_u)j2tw-3im$+KH3a6ElF2;p zA9oMiNYtfRa$%scTZzEt*=GIfwV;fb>zB{3zy9ansBwJxql-WI!;9z7F(v{dH8keH zgb4}3RJ0%(d3#?)tOVXb*-G9*;Nj}CaQUeM#>=6*c|~BG;nH5c2DE&C4=@qxB(WHk zJe6`_3@UZue+PjAkenfdHY1u~I^?A|jeg zDb51`iohLEG7dl;LJx>mg$~h>nlU-5fdL}|nmR&4zyftXo($0lt5CCo`zl!FG5{0^ z1k4;MCF;8{bX~{9Sc_dIBw}Q)UYQMK{^<4v@U-gqD7<&N*L}1yeli*Seev6Ob>HlC z5kWj-3@vqK+v=R})0AObtqB0t&cV62R_{nX!Dyu_NYwn==Xw zHBf-!XogiX1sDSc1ycwFCQZ;&RnZhJt7fmN%}iBnE-{9F?3#ST>ue7mxGpe8`QOms8Hve7#2VR$#vw~aCen8F_Y#%W5-nuP(&)VQ31?tos5X5 z{iLRZFy}JmBBEv}BKa_@U>G;~u*Z`7^(CT-p_U!lUD+X_qG>mT{hleS7GyA+cUU&a zi9@8A2=OpKmcs$I_b~6V2vg!#AOIluD~b`2Q{P|yVhr8Wq&$0~n<-;`%}; zDsTwEfaNex0I<5a{`oH+ZYP@N)JL2jA{r2K3}%vxh~z|;0x&R$>2zQM)0q&U8~e?A z2s|6T`1G@1{LvpU(A&TI_4AJ3(=E+kjMW?-k6SM)EN5@Alp|#Ea?7A;sxV@F48=Lwl41jCD)EVg7 z0a*rbPo0^XR!XbPt%X3>|2T`-=P~%B3+sEn#qUCrKRhAroVQb4u}^DPX9<%&hVwfo z+)sKo$2V{A@cCij(;t4vTRUH_N*QZ?kyaOPLqmcPm?}L20iiKx79#^yGsGr*p$1@TMb+uY0=bCJs;W5$9%JminrW); zVuA?P+oRO#XXrbVo@TGspRif;8=2M4LG&;^WPs1$*gLD#zh+wE0%0U!sZ>qEum zc`5}Fn@NZnA)^#&ChdM8Y{VP@qd;80I}U?TrZ}hd#Y)8v+kL(dkaZ$K&_e-Ap;LpM zNdP1*5F!wRX$GZeg7X98%v}&hfQ`-*7JXzw`fL*!VpxXSTw|V zb4BAyij_%Kt*Dp^6UT8i7Z?H{fRsaIj6UXqY{+05$N~XVGy!CcF(Sf@syQnvF^6&e z>hn)N`{^fLpg;Ie{=xq5{?V{r#V-0-4kCx1gV%e2szL-VLX4)s5p6 z!=-P$0fJAk7Wc&iMnY8+2*%0Eyx-l6&1eb|5J1b({}h#h2&=#{a|JqmB2GZiCnd2O zt|_4*L{&5}F%}UpRja20DF6kg4#Qy7yR{K4Aam70^r@vnR;xY))2iguB0m5cfuVw0 z9l8NjBnk>zxidse7)ZMihSZHizZ&{TNNnu9D&GrG5ks9g{apyz@7(%+0B!zoOk=q_ zPN=4MUOLyi5>0Ixt6z3l?;oCqpf&>NXTawR+jeZwynq}DZ8}wpHLw#h$u}HmFFA+1 zj}h<`f?i4?p98Ku%pXW&8WpSVU?-JhJCDbT2wStc>3bYiG|p<+*7&dS8PCex<7Y2W z_6Ha5soYl0YH;}`YCvF&4PtErIqpqW>3~Rf3|0tD;L}w(oJ^}NA#%#x+3`F%st=m-FeZ#%1$8eUpzy-($<>BZu8u25lVsNlWDk{qE`E zJ^2|3K-{QBs#I1bgsB$MN#?^|cDutg&83(aq12?#1@8V24F?n%B>0?*jSQ;4CtPnRxuc(Dy)mr2q0KTAsQ;=S&~Z4mX2$Sj(1tBfP`V_i_X*SW8@e|zYHQs(jMlWewn@d^7ZIguhF z6JV%ryzT}Fgg_XB5SHCE?;aI&)`B521X2cyvq)q{HWNfaLB^> z6}>VB0jyfP)V6pc44hKx)~nUf#favT8h}1r1W)R`|Io(|P@R7#3;I~LouF&q_u87t zI_7??7!2BYi$SwPauwn_1AN>%!Ns2u!Bw3XI|pa9TP0St(6#K0p7%H<#6F0Uc-*W3 z!0iZuDso6C?c265fbZ+=5-+XQB~56X`BIe~w~XT!Z*5bzD#3MZJfDneosKzKi?6NY zZ9kZ8S;J$%_jahCV#jRfm2b#{vOE=BAQ)Tke}Qkv>#-JKCzNVKza|KX(X$1{c#3PmH_wR~^6(x;X0DfRk< z!0_al&C`CBB9@DY6mj=J)w$?A&xgabpQdTb(_A!zNW$092s9_(rze5iS>8Lv>q?&e(#J;ozfq$HD^u zAV)co5D-z_L|Mhuj5vjH4VqO%bqf7@ym?^;Ds#5)C`;Fc_-vK?1bM}#MHw(~ze?*h z#{jxld2kUznKPA~jEo>$jL?t8*g#5FMhe{s#K;IBa+pI;&3h#7 zI+PCb0sGZT&F1}m&Zc6s&?;S}^+p02npi+ZVp2dU1tb@wI5PL+jNP-J{^G}f{70MX z%dQWIgaN^XP&g!@KxjUX3WlJfszg4Lgn$fajHuJr0JvX42qdLumx!uns6YuRsZ0)R z7!nZ|$wd(m=fj-$dmzC82%TYIjvxZaXoZE;m;i{;1c^uu3?1L~-BgT&w6Q^zq5!Tl zOhgGPv%sNx>#>;EEieW=LR!F24$D zf(U>N=n7VWDR!yr`_M&ZA1s1aR~@4QniWtsm5=&&Fy&|U zq_~0){^?)ww4(K3fXi^of*u&2tG?-Ng1mZJZbgf$=vZtEBIsA;5Fm)yJdn5ou^or4z;*EOYtGOP*f#r^~$2t54w|GZWFGT2w@| zh>CiG52ffl&-?xUFimrooGZ;!#R2mZCr{H#fv@q5&=82t$RH{ST8cqM=4>TMCMl*W zQcPy5TN|1N_a#v)KuHZv3xXI1P&1I0R~djQ6pS4Q_aP=gB{EepW-~A+&Zt6&m0P>; z{Hxq9Rh99!sKNE4D-`9+Obmn5Hrn;@h2e#-U>!8Jt&JGTfOz%D-T8$MATH7 zS+amCsE_ZanF6N{#h~QauZAlvGK&V#cQR*HBMv4j1B_|{6#6m51R}P5PkNv(nxGsM ziQ{UGG4j}DAP|)4!Ag!77h$yqaTP^jPL#Ug@^bz8XZxw#ez&*K?e6ZW?7CH#`nWED zyF%;q?N{#}?son2PnaXb*jt zkRl2g;0z_KuV@afJCfdMa1!N zL;_cdq9}@Y@89IrI-={1qD}E0!9W31PsK+&OBg|tS)Z|$Vi3( z2#F#R00y80p+icB!7wP2&sJ1h9`7iDTY|aQ7OJrqA>L~7F?WM(#$=$N0&Z)nSScAn zfDF|IBguf-of0@k3Xz$CyyLlyy;n-+u~!Jc$Kwb1Q@=-3>?7poCqJG%2Ty*Fb=NSf zg9&ZZbVt0U!BZQcZnOxs>t?MiWHa#yv6P6%8quQ_+gStn>=;iwp~nNRy0iWc6ppl= z(-$6d>(ld5H^F1ub@`lXqYPCH3n~@34ow~5aSvW*u#6d>M6U&0s6V!@aXY4yZ&k0s zS@2upMq@U$bJUj05l8j?%21nbmn*P&^BUdzqH3cwp0v4bNE@!JbJ9OZG5Ddn^Zdjf zm(-Jlu5sGx=rdLpH`s!Oe-O5vF7bT?uKJ(`a8|^F?DRsMz&jtOju})$*|a%zayoacEiBI1gi&EWvRKoM9?s^N;O+SYW{FNzWcG$SLW zppX$Mm;xJ0Q4A4WlYBbr1t6#vaBiHD$nZxZlZyK(iJ1m{7?jvT>aB z@mBA?!4Nq0InRzua|gr$wBWqMNhoKIF{WpnI^u{_%Hu6Sq;!d4oO4#m96IQqO{_9) zHFKA^8!byVimO$4_x`X49LLRF$(NQBDG_PciDWYl-8u%&a|vC1{)fMK{lynAKl^kX z$3;6|!9q;F#}T&X2(jO}$Z>M3L;P-GbvL6>VSv9rU-(5?^HKHFfZw`3gs)R zQ4x9EK49p8Q1yUjPjyy2{0wEC9|AQdJ1(2DEBOnt6JlcE_Y8Y!`PfrktP0E*^QdOlO>lX{F8 ze2zC#O1v7jBFi;p6j1IVDD zpoF!sf;KHucUd$%DikiU#3xAVz!0?k7^*lk)(~^7j9ayL)^|RE37e+J@qm3&`AG%& zWWwcaKR&DIPTst|qo-vEiiUq=M03Hnr2LP+Y9L-&_ zl9ML%DayXks~4+yJJzP?+PgI-6I7acGr6d|>ADEjjIeQrmZtglCIn0W-a(6xJmF+{ zeRQU_vFJT}JLWMB4mqJR{}63qLEYOAOMlmJnXx|o`~})L@3Pc?cqccz6zvj$)y%AD z$#b6Od7kDuPo-!P)2iTz08m78DIzK&CZLT=QDsbhH)(7>vPFiAZ72!= zz-_<4rm%($4@YrBStc+LRWywKVDn5mnNb*{Aa*_)W*O}5Y+L4}Vp2*$;r)*8CrV}y z@2Ko3txXCba@WVr7*b{^)7!f^9TKO4$g53A9U1lma^ID3B{T5qs=IuFv73v8u1_Q0 ze6gMnx$L$E`xvP!rqr$0*W>Vh8+jW-p62oW`_C_WqKN=z#T?eyt&Qx*|L8yd^e3NR zU2WnxAci_dLr5G{)l4}?5FvCaMD(2vsj^)W0f`Ze5XEa*g;FeZ9dLAz0!^LxgcO~v zV_*W_{y03EJO@oY!R*s>Lz`Wawo{IT!hDz4!V~HD)jUKRw3RTKg_IterLLYS>x^ z*G{UaC7{3u+wkdcnhlZvf$I15Sc42;zE2{Zofl8tD}IU}bav0JZcmZ|Xi5=U=~^|7 z`Itk)@}lah&?K?Wl)PMm8w{H2SM9g?xpuE9tbSGX95&i>3%ti{>tj9Oqgu6poFbjK zQBRgs3!00-$$AlNjvH1K#lzfz=Z0j`Y44Dbe!~Wd9oQ$?QFCwWhkgX6}5s! z&{9xD5JWHx&^RBptQBg%8O!HiJJK7%L zVXq-T&S@OO#kwd_77l@SA|;!YtW09`zbFJDtXuwe>0@YG+dta}-*UyaY6VLw8M z{gB6%LX6!wzWMcU@4xvqYl%Bi>veVcY<-C!d&N21oBREXK8(2M{LrQA1MT+*x%}+& zpZ(pRUtDbnos7#q$bcLWiP=MoA#qKE5Ik^sYS?5xdphS--p-{0K}VhjU;A&~+K2ExkFB&=dAo;RA?l@K>RGq^A<5(ElJ5jZj? zpa{f7$;WXKi2wnD5}FBt-z&cC70oAixsIj!Mphks0nG~5DLAVQHDd)pDPT+#AXFK5 z1V)O;94I9ohJLjkHe=rf*F3E|9fBdUpXU%<5E}k}d;ABrb$`z%90MAjRI0~q3teTX z(qHu?04_>ch+s+va?b2>x(^-abaCnLF8j0h(XILPEUm2bLpuVNC%bfgLO3~k_@D=U zrjN0F?9!vH+fO4SEu<;$N=xeo!ZBZfVLUJuRdT|{dfGMlpto^s6(GUs zO7e~5d*2z(-uUDbkInd#ztWNc_|5uZbNv*2{*Y&=0BWFO>di)<>QyLebCKn1I0x=2}12#of0(7rIMijr!zReLC6PS3>Zk4K{rM6nw)Eb~6 zR;ytv6`96muGh>|1u!tSoYNdHMs7EEKmbrRQ#Wu0bh15p+F}5%7Dw(mQEeDmK+Q$8 zYe&$zjb4t6s-X9`zyJeM1~EkA$cDjjO47mb=R?P+L#J^}pS|L%=WK;B6QbAl!}I6k=RXprxhV3u+R!izyKTOu<=DYdfGU3J84KYNz0HYYR3lDMPmp4Bjd$y7x4FFD2 zW&&ekCKfFVvQy_>TYiq<1FmLf9N2+=hfs+afz=8jp_kDL0I1#sMl>}-6Um57ZkJ(r zILzDaV~D8*dv7#HH>#??@ht)wUA}??A~FXcLPO?YXoRd7fCGZZy5PD@hJJmkmLsCK zT$oG^4b{xqf1ugX)iy!5c%^f=MSxvUk5?I0>9 zc@9h;12-JeU966$;L3kz9cpS}q!M(FvArF~QlB^2v(k9J&wRcikUTk3-q<6~qk=X$!Z zsvSkUkZsDWiMq7+SRmxuhi;dO>e0edPn}W27J}7rRJzsZKYR;4y$2ep3#~c;sJrNz znyQO}l4Z=Zy$pr)YW6W9uht|1TNj8G(VO?hVI5C{{Yf@u)|V`M`#;>aO{7>Obh zo5?)sG|xKEB$7o50Mr!SD}$ZQBme+JQawxwgMuI+AuED_8Il?y$Z|6-x1K4gn9ptc zMrevzm8=lE-%#~n5JRK{fM%pBpg>G^qCS7JU=ffMmMOLZibxT`RXmz?=;EzpC)5&b zOQdCf3%#PgG1M%^)P0m|o^PsVKm@=b7)enLy;duw03xTM17ILTl-;|anT;&43@am+ z?E&UFq!eT57foKLm(e-CNbv$PBp&0}!GSs-w9+%w6wZbkEAi zhsTn02ps?$8W05xL;)R4MyeIBi{^1aVxkTpv}o3O7gjMK@S@1ri(MvS|RA58_1Sr81R!AUVz&o;C<6ThkO#ADB}k)szq#S=H7@4|eR6cQ z%t8In1)%&%5n@KFpeDDkvrj#zZD2tY*qe*{o$vsAQ&E{Z0%)0l^4G8{MY<%@6=M zCf`Quw4iqdOihbVNg-lEBLpN?oskKN3>n2)siMYi`CPAZbrbcup*p0Arl8PNGpO?7 zyb8D0c>whk*AVSE4y;bJusUCg-gi>--$`R^nTvlDm@*@f=M6VxIm@8JHoInRiZ zHy6Cx@cIHCAIkPVGSHAf2|0Sth?(06jd`U9fCP&JkFS0PGp~BVlxnY?7|2xJmjMv! zdY<5JTV&2q^?a1_(mTO?U;73>m3MU}O~} z!01FmaiFj&qCth?01UVZA{@5}H6aA^hMplCl8@DysS!A}2n(UBWn=?6$H|u6?E50n@BjF) z?|b&1t^6SUNX&LOC{k61tdW>p~;{Qj+lp+iw8;>C(4fXjwT z&1I!FUF{4@KCNuS*_m;jtfztYY}an8)Ab41^mwc$TxSUYA%dw989*h*HyfP_v3%I^ zZO#xi39yeukS6}JU`c)eVcA{gW%DpUQ78leG1-Tc|~-o=N0Adafo?=9xtu z=00uL*0#ZEP2bKFo+2F9Rt2=~u_>@`662txi8yZ-*iDM&7+ zsvuIbNGVcE0fpi|2Bl0>Iqc`%Zol8{rzw}BB5rhD%X(^d&F(Eq$RS_|-1S}GcSD!@ zE;2I_BdVBX8O)G~L!iK1t2O`tQ>`Mjpn|FZCYBw>1x0o3C^a)=M6rxjia}cc#()IL zK*%5fs<(a?y-@{K6(Voc87YVqkBeX;zAH%vUrA2BCWu|nt`uEi3pMo+ji?IMOr`Bk z>PlFub>h5sOaQ^GIJ8sqA}zHu;~sNn06~DzxoDtZ700DuZ~0sB!6Lf3a!H=zqe!ekgb zTHS=J8)9ba$UEK0h9sH|OP=8EZ@=E&-Isa4x>yl++VLlU=NEtb>%WD&B5;u19m<^F zy$8+x_#D&B*MU;%Y_-3A(D@LrE+ji^$z`<3!xK5UV(k=rlNB<2>#Ss9t**LDP&hU$I^f8KTdZJLUplM%72&RKdL2jrCZUMmR>|6e*=R^nKr_ zlsE*6waE1?s7E9YAqEcB=*Sz?%f4jblXc%;^*$+0pTy(#gr`L4|Im4)vmNZbqxpT$ zVS}YO(Uv~K7TqdeBWCr6IQFpjNKU!JQ~Rlv^n{7Oc!N)lPHqe|q(h0%PHS>X{P{{UH7 zuH1Qd;TX5LBBCCpV0Ja+gHiemL+b}in9PPKDW4`k7@ z1OU{N_>8R!aHJ@!E|cHw9DINOdpQ&B3GKYpFT4nEfiYGzh^LvI}7Syvub9D{^ zV4ng6Z`C$20|d}g2#F}D&OnG2@&hnL(~9$Iu_7(hsg;Sljwt%Mb&ndi^Pl-jB1kqD}VpdQB1q@*p3|AK&8Rz3EK6LPN9yFcAfg!2Jr-S`HHth6oG?$_80Ejxi~x zWMR!5#XCeuiUBDEHnF_Df1D3f>XMp*sUW1Q%di^c_P5<8NWLrgTM)8%q5Wld^@$Oc zX(C_&dwiJiqF^1tVn70dzyVx~(TotaD$^K(5rG-0h)>P<=A(dsfn2G?LrVqWtkU=Z z{JfP)Zx92Pq9S>>-`?Ndff{mf*FEACLNsEafE1BCMJ5cW>~nYC^-$-jcrycP!w^7C zj|;#>DAA7s#OhW7Xhnf47OYJK++iCP0B{dyFar=U2#iF)OkIj&*A0CdyRPdwhBiIq zzyL8KRzqJeaH~hU9ruO*;0OLbk@Ukc4QL_CH_6}mF=vg@@A*8ecz*pWpGol^|3yw} zTkzhaRBR2FWT>EZf*PHCzQDL=(HI+xa?89zcErG+u7#5`e*92}!K*shv4CH$k+!K_ zN1Iy9x~2>MYqUNk5ZVX7Y{w{S&UDT-?3$=Z(OG29c{&^p z`)Rj7Oov>Gs7MhIL4{(VT+g5vC0<$}bLcx>kKJlq^?m9Rb08vQBz6U$7-9^}j6`Zy zL~=n_KlU4l41oyLfN4Drff)lI=y0GJ=TJZlr7FRxA_U)14a`U?0Ai@Js2UKv*)1nE zP!%vl;Az^c77mFhsboYjATm)=H8Gegfej2q%tUO){J=BE&~xZ8M1_th9FtcwRI6^R z^@RJF-jX#rNUdOIM&Ll`lHCC~exyc7W*}hd3JlKH@k~PN+_0y&1a&N>s>yrR6)30{ zLW39p8DtK9M{&?x07(lnht<%BZav+-k-QC%Ots8PkeMx{6vse_$6+oC0a8Dhii>8L8d%v}J$v=X|LB{4{D0y7UQ0B(rmM@e z*@QkQBXbJtD*%RW%_$-=QSfq*BQb@xT+e!w&UtpLdvB$y2~~a+T4Qh!v9lKdKr879 zDxX0#=j^hKDn(RsE)Ng8X)YX6%`7;D&=CivV3ZI8VlZSwHUdBaKr%F|17`#(KxTqK zCZKGHZ6MXV3DroRp$2EvY8qd6^?KxWsufz(QX6c?NQ!8YIHj;ztv2gn=woDL|MCRH z?#o1hm_v)aM1V_k?R!J-hjWQPw6Xjy+rbZBd)$z|?>&F`6TfE@^LSs+-bda6+=kF< zN2gUcRy(Oc0Bj(QW8}3X)lgAiWNiRwX@#DifOSdn4SpO^QcRJ=H(d+1DYiq5yo@^@vaBc1Rvb;QBE}veO>*czxYwNw4nRhdIF^3r_;^+cu z2+B(rl~VNSJbm-->HWL;bee0Cq^%IDT1%PgRBOrXS}<88LcA8)+gJpl*#%S5 zT8ns7 zx_Pv4!p!_?{mSddzC7FXuDts}Ii0n>H$77;Q9KN-#@O068{BZRzWaco#sbMu}-Tn=d9dnXT@fdg{G@`t@(*r=QM0VR`yc=6B1o`f6I_ zN-u69RN`i9yY$`!Qc5-G&;Nt}`KQ16<){DlzvMife(_J`!_V8NKiKlCf|Z;X-MrkAa) zwU?Kd@4ovK*am}1C=)1#Vyr@Osoh1>(@B1b3=u@Ici&pfIRNi!G=&lB)<`eT2xC2! z`6I87g3i$O_RNh%px@!{U6RkxE4g8qB2tUaRVS5Hz!V{k4hd|hXswzd@jXH0wUxRd zmEe^ber+ZnTHh~ag8lR7JOqgQuY4{7-cQ19#XUIkAn7cJ2qq)8L+()AI~;qEZjza! zL6OcrNkc-?NuqC*-~;p>yp;HXtsBx|oOgchBadi^V2&JaMw4(0>YwF0usgdLJbfc$ zH^(+Oqd&#*@rUOU#Y8vB)Q1vXHmD?f?q+>y>vC-`m&^0><)}%s6DO6Fdbw1S} zeRF>Qbe`v;CH4V{q+6|Jnx<0gaX(-*E>#84dp9%K(6ddXKuCYbGQWR%n&;=2?^2zsB;dOYO_M{_ZF9`#-C*L`yG_z6FMl9`_*1vmOuP<`m=SJuPi5OsS+zq z!D6k6migV2J)2(ug)2$ackh1wzxogV^4m{%x$2+&BR%~D<(+@mX}`s~uszSS$ogA6 ze^);I#Ld7GZE3?D5h*c>TT9JY!*q&7CYY3vrLd6<@!osyohT6%Z%LQl`?{{Zo0+Mw zb!+Rotn0^*FV<1(45)}w)L2Xa6k;+dNVP~D6otKGfD-{HGoi?!(TQtx4GFxkIm}_~ zAjL2=gSdnwn<1prw+%Lp5o2|7(KZ5{B>U0;d&9PL+*;5hMK~-7+Tb3W+6y= z0ez(1lef&HZ|I|2@v9k`9uS87K6dKYEv5O$w~|9HIe&+)H`jc~?|!yUz>ojhBD>!E z+M+Fi#Rq}K_1<5umya*kw)(PMmzT@((wE*0@Ge=U6}6VZ#sr;RRK=-6QJtrHI?eCj zoxXW@n&&Fx6~&RIaGs}9YNqP2Ih_Ehj!G4>TlP}&?(Qy<)5oY3sLE8!^*miJ%Y3QJ za&2o{meyO-)mk@0H*}-+9x;$XEvzXh%3|yy-mFvfeGEOl;C z&ZL5Q3PmJp#r0!JptiND<->bgbynxOwf3@phtmC1msNz;)+_Z?YVExPXuV%Az0hl| ztxndu(+sRd&HE32{uh7ozy9C;)qnn9eEgfgdiv&LJ%8X2eu8iRfVPNGE6wcFuYUcb zAOGCz6QY6_S*x0q$qkxIJGE0d-P{dkxx=+}rG$7HM3TrKd@j(Qw&QLN2&2tWY@IzAJq!s}34Wam#fQ*5ESe9+ zS|rf`LN##g5gSAzIaIiUv*NA}cC!}9k$89=Lll7k+=xoS0X&M7jzOPoosXjQ&9eJi(z^TrhmNV0mphzP z^?F@k%?-2 zQli8teTFdr+gc-0okCStckjJ788uLY9xBdGkW{U6E$^OAt+!?EFUxXyxh|K>dhP4l z)(&eEV9kt0IDV9YddYUPo2R^G76w6&2VHe>^eBRj zqVrfAZBkpE0*z zcn!yN3rlZ4%N^Cm!rRm;B|v5zFsCD5IxhoEM&&p#E79S@Y1mNM5zUQ~jz~_I%|;}A zih;cz;p1cQb+7_VA}O~!lR-a=VD2V?8P@+mlfE&u7#3)^*L!X>QQ?tX*>UFEu^f>C z2cmFDr;_xzSYyg=#E|iLL9ZX5H~{IxJjmcefP)Er=f1oRzxdJJcsL4~mz9HEzRB_) z3%cK8Ox!;BE$J|zW<-TDv}?aQ*Zby+U!+7^h^QhfE^y1A){QB1wi zHJ7u%)93<0!Sn)|RBJ8ssh&>rsn$|M3P3dL`b(`-DOyxSH3$CCTyM*T003QyENY>u zNLOp!yqm*%7Xu|E<_#)dmF9Au{i#pO`RV25^73-Iyj)%u;bPj%0rLRJ-CbeDq=~9~ zk9ttb^xNP5!TKVi=&s_V%@t4cX{uFhs{^cOo+W_5Og&jB`jR=fxn+2w_9JQ(BefZtM@$zwdLAb-6s0KHYA&*Y=rI#y z5WPASOP%C2o0nx}kzo3w6cwdd=}iq?#JDbiig;VQsKT|A?Cmf9y?^@h%YWhj>c6S> zJGoF#rA#VZ?b8eOg7wFxR%$*rp}<0EOduT)QaSdg9Ep&6F>}v`k8W#}7m>Q{w6Q4Q zSeKxKmx&JxJzZY~50ygOQe$B`yfWE<&~W5hMkUfRsJvmwi$I#ODsWa~lsNqTT|V>OBx$b9lFI zeOcPeWqG+=uh(U5E6mRGTtxcP-Jv42R1x58EmYneZbm{xG=wswK%AfwRavX5s;U$j zLhgk{N*r5Cxxt+GP2xCVkNArN2-;Q=sp{Rm_b!?gu*eUGW<|(VDoYigCw+RFFPHPD z=gY@Wm*sM4VhzQ+!MnMT97^+))OJ{}AAcv_YAN(yCz*7bYLQaYd!+}g30q)Iq)w;z z(>G6-Pg83P*a5#j|DjyJt*4(rg3T9-l`g7BR}qZh#NFHQ(sFxc_S^`r>_(et1BBTW zZo-`tz_?+tREnFm_=waoV?%02Lsicu+S7?@^i5PiDa@Aby|^s^SSKh2@UECTo|=DL zT?*$XJ-wIdeVxxP)nz8tdhcf1J494fi?Y+ri~=bXB{TqU(Gp4hQruyp(@*}%Kl#ny z{xkRIm)|ee`VaoW&x;wZmwJNz=3ljc{V&fSei)4>C{aToLsw@57!N@RU_H|*vFk0% z($+T3PsleDL@@W(*4E73gZtlFw~kLQ*Ji?Ub~$Zz8EQ1$_*B{t1(2Cj3lJKe$eg_9 zNQT$^3`qg~t2Yi|@es_evuhPm{6NAA$jzmNZN_3fulz!yw zvvWZ1M{c9J!XB1}!kWLrtGD60H~&D{b4=r~jbU|{uVw~bI}vKj`;aZs+5iB607*na zRK|550ODOo@dkoU^$LszGVZ?fpSJAu=CbT5VI1p=;$^n0dW9UJj{txB!EiTx7+s6P zIl)Ne2B;A2cO;?Z!(i=~q+k>V4_b2K1#h7%d-|4#M>FOE4i+~{08&8m{_Ahezq`rz zh~(ul;9H8fZ~cpcX61ct-dkUNwXMy%J8?d1DWVjeq*N(7*Q)zmO1y$3 zwU%0HDWQ-M*(M(a&(7QzprWdhHhE~{AB(L%vlHY@8xM`7I0aM{cQ>=vt+m#>1&Y_5 zsu~<9H7PnxQ<>*FPvyIh{B$9yvR+rPxuBCyE9x%Zr4rwq>d!ySCwqRXRf?A~QI(rh z=mzifz`?sCDq0;XGEK71P;py9;ku$Xlcb#aK5r1+qaw=n6l%|^zTs8}X68Wl2M+vn zGc<$8-ba1A0Sc!K=2rHb6NCaN8(oZ{N#GP=@105CiF~nAjS)k;nwg8csmGd%t~o_b zy?|}`glvg$Wf5!7~KR*44=cgyMYx~{be*EYEucv?X?_&A^AbqIYhkAD`|43Ga>L<2w>JBds zi{6-}P9%D79>{Yf@ywPM-8H+T_wKFP^|HEAbaGY^aYl$sC}W zolbKRNic*5?*w#m<3E4F`o3*KykMo+`m|W znUeRtMCc~Z%#j2FForr=!5J|V$*S9?+twWEE>?3uhCCPew?17kI|GI}lPuT3C78z+)iGDW@Qn$+JL26CU-u-@NjL`PzROB^tyT$~-BPb0~ z)~#n$R!GI^x3Sj2dl?+FaV=x=ZJiu$r*OV(lv|CI-LS8BY4dGD>@x%OQ8SV!y{SlY z_ph1I$GP~rn#hnbVsE{7Px(kUcXadC*6Xsqye!wtr^~giEqW{TP-`!u0#VVYr)iod ziKMOy^C?nPYbmu>kuay^=&zF6exA@CHbcF?_SyPH(|a=w;y+OjNl0ivXInZ^k+rqf zx?5T{7jqY3q|H=Ms9L64=jWGC`sw9)b*g!xDP7EDQhhhgKmEb^7k~c#&wu`lr}w33 z6PdZU^Xl$VgBxYT&8?ZOy|30*ky1~mzOKDPS`-Oi)SINtWb$t_5gFDtM=5IJl;M(x zwD0&Zlj8`2g-Q1L47bq|mKk1Zwy}crv`=sAVoCAO6}PUdnf2b>%-y49wRLAXK_-_H46ei8xwO{ZN;GV8cNYtF zh_u!8A}&&bS8v=4*QMojg#!s5 zCiSr2Wh}fss=c9u42$B9K%t`mi9>a9xF6$Wp7L+uP27xEUSATGZ+Kt(KQ`-Y1J>R$ z*ZKT7t}r9@oOs#3n(1gqAnZEw!ozSfM%_m)k_V1?KADZK9XneXb!;Pxu@!D9=MAIY zl2dVZ+05+?#&8?O-rC?BMB{EQ-c<3zS2ODo^|mOe7|5Ep-q*EVuFLguy<9GRZGBx= zOLdYE#i*seKcAn@r)jR|S&M4cazI3+R1Mv_(2m8B{eCrPkf2H87B@clc%a|I`X1)P zmc@v*kftp}^hBih&dwl!CehTz;YJm@mZv(^QbYv$QPjP2l49>_`RRvuKl{o1AN}~7 z^V3<&6J>IDdV@9h26Xc_dS;0G>iuf%YIbphwbl9x>zT|gg@7%;M}Kzzz|<-l)aN0% zlk+x9;s#UG=@_!r;ob?yY~rXX-bUHdr*!~b0?`B<;_U7grN$BTxMhzElZN5370E+Gh)qP!CZ=q=& zijYn!p)iBB$%r+@R`|Gz7od|7^f`S!c2zxta$|M?F}anWD>>c9HGEX&JJ z{=@%MtFw6%s&9?pBFkz9A>C+nr@LA2?j4M39_cM4WtzLkt(n={TWby8-TZo8*JS}I zT1^zx0QLpyE(SOB;2awilxY0naAhVZ#MMbhA5ul-fK$3q;UG;&hv*@gi2l;GlseZB z@6Jz8vzdQP>o+M2 zKQedxaJqpE-waz?2OlaDn^nBO_=20=F?do(OU&_Ta>X8kPzIGF*!QD(T&#vocFPr+ zA{jcTqqs3-4z|IUYS!Vs2@OGvDrK(qbehiR)2Zq_O)OGGlynt}6qPBB?@;&K zF^FTu6b2_R%bo{bk){-@76-O*&Sw)bs#~CoTj4ROtoI7 z(yyqZKRTU%{9%6gek#+6oTIeVy}K>e7Xo7kcZM(Hi`%95m)@KAm)6#{bX%_8p<1K> zL0H9PtI6zcJ#^fo}h7xJEKdR3RGuG$1siU03O=gXMfiJ)u-*>EolG;iT#Sb#S}Q9@f{R2>3P3_8EFJz8WsR`?~EW$B)Zo=i+>w{>C5= z@p$}QDewSR$9^?(Ia%}MA~;A^Y&dD`KU>xxS@^pZ{^a^TL`|OG-pI52^%oA}-3D7{ zbnDI=mmy-?k>|}|GM|9C3tTf#y4&v~cB>H*(Yv{AM6oUQKXTCC7}+f`JQ&f5tz*wV zA1oi4Xr}OBP?JOhdX6lwQn%F6oey$+iH|(O>!)}FvHX2rN0cO!r=ui2%y27S zvvE__57R8!zUGDUR3|*WE5NDtQ>ALnYDq+NwtBy~UmTqfpm<1P+UmZVE#5A@ue~pA zz4q2^H8*D|q*6K|Fo9^-DC1|knn|!q6}ICOCg|wqAs&_ht3Xu0GVx&<4!c+=1$OJ#)IMzb0-R!$y5u$>j=ULhzLbs?&eVH+#ArL zT3LlfoC2AgRGKI$#UXCFc6yIm8@6t4MzXs(0s`?pVj_0K>2FaDR-yJ$6YLw9#k67V%* z;UH@vozcwfbVAMDLayAr*|IK63$fK?ZwaJQW|!GzHVO<*bvS(;nYt)M?^)M4QXN@) z>>j31BeU;LN$NtlObQ{Z35uYQN~LHiGS50q^*qg|Q`I6>2ohCJRnPPJ+xqExxi$x- zNRgr%jjBj#>)NhME%NT^G|yFsvO2P~DH9qbRJD{XYxHo>+5h{-UUc*37Zb^^&u|x9 z-6tH6=HSMH@U3e&{^P!;ew+wSq`){R1@LmLW2)6D<{_gM7) z*=KOQX-XWP{aZF@`+6#c9d10s?+E7{7TsEUC}o7zwPr~tvEJ9-mZdG1>+{R?x~^^Q zu@z?N6-7m+Qp#yQ&(rx-rfDigizvw&wLYR@bybU~$Phhv5b|!-4N>)-VZ!~5-}rKW zyjSE$LpTT{L?KZ@h8>DySMP1>IF5J^TYjG? zr|CyO8C&Yi~sol_?u7HpW)X({ptME_vM>!%JPQ-opJugzWG5Za&4=%?nLixHk9L#Z+2%^lqU_O>oBmuKre28$G7q1I${%L&xP)Uw$F+{L0zENt7C6McvbbV6^S zQ-#U3%5EbdMG*mNWs#y*L`t2eTBfPiN#;6LRn-KSVwWkRRZFe%a-9t>Qd9+qf;I<< zQ?c_**r`g1ZogxB$R3Z7LBrt@#(VI(3vJ)plliEv!f`)*YnS^xBYGTg2p_+WS^dSI z#=)@|yB7WMu1B6?sM&aE4Gc>$MwG`=+TDMSE#HIRl$PZf0ZZmKZL_Cg=!=g(91xM$ ze#-7E9mDyoZr<<69o>5L*@%1P0nHzHNBaL9n5rLRY2Q^Y$JD-khnt>;1R3YR;z@ZA z4i1K!5BE>#W(R{1reEVq{K1?%-o8hGOjqYVmhjPR((i`I9n97>ck>K*qu0@m8<=@< zw@ou47**!o-MR-`%FNnG?grVUb#L9S*JW8Qm&>Isc3pd0TQF|3j7Ox_GS%rkPfzn) zrW(zMO0+|fu)9&kTUE>EDR1nl8z%z?U*fhCF-Kr}Q#L;S^+ySUk1si}GB4wqC)D$VxT|uow<&u&eh4eu1ry2CDM}id(aOfi2#zZi_j4yS8?x>rVIX3O8*_@Ahj~o$5D~Cu&@&Kq`kvJA~^pV$Dr$N1*_~tb0756oogl*j>%3 zmZXZ{XGsFeLU9c85e=UG)LkO}4Sul1jz=KYz5_6!IBWD@3z{386jc$O-?1pxm#$Y= zg&Wn1oB~)iN7UeQbl!0w60RF1K3qrfP891sc-N6vxAr2U%eBvc_80%;fA@c=|LK4F z&9uJza8k4KL;Cq0N-d`u<-O~O~4v1Ra!-E%2=5hb-JgF zp=W4yGZm9ju?ItR= z>0i5V89^Txk$CP_gEa8md^5ZN4WuXb_-GKro!UYSr!(6I10Lc3Fp3914#>rIdYq3=w{9O zy0m3!*Xwn?F3UB--DaK9zgy{5gerBar@2hiX`bh~>QtyA6o@EABE4HnEk#PunT8|% z+VtK&_8lD9CjIfL?=yAeH2xGe_&_xoV9}UcF-W$)V0lqrBkfI0aC5(+U)-+V7kYCz zSR5xf-MiT*Zy(*R=I%WP8`jru<~|$dEcDSzxVqUWTaT27ON0A*`DEU4>Sc2JBqTU( zI*FdeMNw1}>m2m#;G3TD;53?f$Qv6$_E6MHr!RqMA|xgpzG-*B1wC5w8A6fW$Clw# zjk(v&X&Viti|V!tne+~gpv&F8H3*>esNU97;y8MdQ9NZ%t%t;^d$%+Q zg>LLHcTt8M=JjRy@bCP?fAXLFC%^kI{xj{L9KiIh%j->G48^!I2BIn~!H8$RkpeP>PBcohCik zX`1Hgl<<~@4<3C{M5UBcYUomFrg+~ry8DcOwQ@3Fd8^iTBb;_Sb^pXKhgoaZ7F(XZ zUx`HnL?PW)*a~00zrbFC18yKNnVZ>#zV!ZVeevGlJ(?4DGZ;JO&Po(W4Hhmkgd{n2 z>%Ffr54|ns9ZE6j>s9MQ6f=g=WQY_GA#qT~N=j~(?5H{;P-XfzCc&)<&?sDQ(on!C zM{vl1e@IxShl6rufvH*+GPsW(hu$2NXgf%r27!%ndSv z1YvJZa}mj!zyNd{=IE`p55Crk_AzOPO?hTs;5cbpU>~#pXW(SbRMBlq(sDA{!xzMIyqU}xXZ-CYvn8!VK~wrp|T zFgzAdd1NIISK z3MKqSi>BCw(|QL~Wi5P!Y7&Ndei`wYNnj+~2kP>ZLI7 zUZcRAj4rzEY9Ic|Kh^X5{@kXglks}F{O?sbZae>rKI-`&yG?l&2CO; z?|p4cTi4cBz(oqA2$ibPiJU1@Xn5wPDuAhj?k$+7N)TpSZ}n`x)C3-_mQ+N^qMWKe zo#zkVoZp?p+hx?s7nNG8sB$Fjx$nC;c&OXN0tQ-`>)Ij0d7c1pZAObtPY5k(=>-rJ zadgl|hmRzROA_kt7R%?C(%o+GnXkNs5`WQVkGm)Q!8z}~JEEvBgx4XtEsoo0YG)#i zh#BD>=C`=p&w)iBlV`qFx@>?YN7u1zm3DinelUxJ@N^Hpmi%LPxOc~7#BOP>lCgY8 zGs{xXtIxL?uXjws@fTM+SduT4W!+f*GVV*tg zul3$~Th{e*S+1Amx~|L8qTg$`#T|(#f)pts{8!6qnx<)*r&6kxDk^1=nnhHrN-0Ha z6_F~txs9{nvljPuZ5+@UADn=lmc|`?9+TStNHs_gE+#L@%+|gxwm#eP%-%%|O3-K# z$o5bMgXKa(QXj7paqj%@#KiOcbSyK*SeN>BVUTI`H%l{v9`05eV1IU$pBd zvDHg$>$0WjD3apWha68d-D~aATI;<#C|ZT$Bw0i!N^w0I#Hj&+WbKlB9~0RCpc_m` z`pA}xXI0?PC@&F%Rym)_H}B6+=c$D5n}~{(!V?^3@|x=ljMU_9if_}?m{jyM ztwmc)C0SC6YSmJ5nL`9Y((FC-o$*&4n6Ggor z*A*OR=?flw_3qMcZA1RA3=4tb0!N%_d$5*}$evzHD|ig^a5v7c?+;)ZGxo-|j`WWo zzIVVR-4joyjiYZ$Ox)4C0Z_>t?IzA~c=#ObOUR)cBR4X01iJ&>8y{ga+A(AYg7nQ; z?>M|~mFLI#@Ms3yOwApvJ`8mBbOScbe296Ek#aWy4xl$8JPnD^4)+Y2qkw;?A-S6c z?rd#sS;^Yg-mR@>=GUbyYcp%s5?fR<%7msmm0G5`&b8L6wPvNRXz-V*8S!cV%FTvLaWimga0fOcyb7(5bB{~#0n}yhjZe;UsX8t$?EOR$Oi1fKdX)NKS&In*xqHas!>X8B4vPcwX2dN^%!!&|s zy)T#NkH1+izo(t8%_vncxs!z=?%hol6x9Y$WFpzGD}Y8Jigeb#|%FN|te}8{1Mmp?WuDg9Qq@bw#)>7L-gcNo*?0Dx7Pr zQ+@yb^!{9H$+llQWT%Gu;~pDqsj@qJcvx6GZrPqFP8QmEEtWeE1yF8uXNVMcR}DoD zB#E7P9nRh?rB^b`U(Dk^Oa_0AfqZzt>rngk)$Xvt$k)nk1G@N@-cnHx#N#)%5afm) z^)j~Wf;pK{nLYlZj3VHJH+3|%KKLjjle~G-d#)Ajb zt(!}s=eFXKsnY|s3j2igfzI!v%%nXX(Hde%c*5lsp)ZWI?Xj49bkoev$hREt!!wRF zb01&YbI+U2_u&J%du!c#b`9M!$gz`km<;mWHsJ>vll6x%r(yMOJ$NbBLNYQ6SG$>e z%SQK9PeG@U&Jm>uYn8d4>s02cXsNXpEi9@eiinE1Q1ewLRVgaM&G5c9y01y^_`FHp z+$4@9dCse&AM_}r^T)8k0sfeKx7F6g*2ULn*oBCWF_u+2fzrX;jAI_eQ*(RiZR!2O z{_K72zQF0O4lxKg1BI%T3KoJc;-ZiVknUJlxQmDwy!Q?_A4+bqDhw2gNbR-)CQ>Pr zrFP)%Fn5^5j$!7aK?oilv+sP$u?m7jA){0{cXe|JT);lSjFJ5rOfIGht%Op954s8R zdNImpz?2{|LxY=W0oC1A3bl^X9wKFe2*9#`?Pdm4luo*3e}dGtUe|tk@zxq%nk;A{ z{UkbTE2R|G*{n#Zkx+3sIrWqaG54OG-v~3pBobSL&6X0|EgC>4_(+lBR8U1kb%su) zg!N5N7$Iu~Iwg|Dar-_hBnh~e;KkA6b`+oz>Q$sxnN-iG^V7TeX)d*vqUrsrNGUSX zzN0tf{Yv`EKZ)V7NBTf~+Y?`7vJ^q^{2zb*D8Bq^it_iU0RAcn`u<{kBvT%o?RGf6 z^0N8m_ql6Aj^db&6&(`l$Ll~=o8jJ|9FG|Pli{EF5h%=wTjIwyibtHxJ@pcY);C5D z?e$}mEs*E_+nK?Ddq-!qsf+5oG_uGtg$(m;dj=!;4yMDA%(V|z(u|L>Y^37=hY1eQ z05H^Xv5^?>A8Kw2$M{eT66fP6nuK=GJ>Q z0k>|UlbHNa7l`pdoHr$@ViX9Zlrm8P)>3QLQly624P+@3Jj@O>BCMrE)7s4M=1q&zu7**07jbappE$&dvy~8$yn`?dgR$an-hAj8iZ|SR=ht7FsPAK~ zKmX|~oAMQGtZ^I;q12Xje)z2+tiBy{e^`QJJ~W;}*e7rK;lmgw*|482w2ew1CL4iS z;}rGj#}j(l#J{#HqHh*#4?BlIN!s9i@ZkyHruJ{2dibPXWmNI*Y^Y(1;R2eF<~9J` zdpcF*5clBisN%N`u>&F)+8pk1v+)Vt{gvrWw}lAYmaDM~y7j`qdnFT6al=W8qchf~8KEdica72@s!m0PTBxF>6siiT z6b@aCBrT8r_EfEd;w&Q25cu0~6L0=|UOm>+va|8qxY+OGg~q##OjzJMxLneB#2RRYF$3Q zeER+GUVihhfAjwR<)8cqKVA(ms<0L{6Q`>Xjvia|08YRHcd%2OUM*W#R631HI=pup z;fhVB5N;;a(c3q=ok7A1SO_&IF%OW?^$0RAAc63J8=vv;|6BTG^g9VDe|Y4Kla?Jp zEYSh;c7-*7E-Iyh3O7n|(Sb-s)st>qu5DLwb4Vyuv-i~Yv2LwjTU$PU_xp}sN)1Yw zQzOqz2dy_;=!!1XYmovi>;)kV$$)>gg97g`fR+vJ<4#4iB+eRaBq@|its;sDc@fGg zNI=Ofkc4cL>(&F(j|P#*eP}>%5O`IQs`FgtTIN#D=Xst>RaK=%yc=SzrBG0~VZYm6 z^~ZT}kA{!27JvuFVyxC}MaR~CQ?&C%8#!(uT)Lsa{piReW%~1Hd-#sucfI@4RULM! z4YNI-U~@!{r#*NlH&JXNQ$EBv#=K7AaQd#kWqj$Gt(RO`H^?_f!A|l&AEX*k2AqU! zg%F$Y-CXg!{t+f`zam>I@%AAN?r*S$-B;^HBXKke^~MAbGoevU6#Z>{Sl@BYB%G07 z)B8&c&(emBppSOd85iV6=7)PeP80_yvMEYB0Vpkk0`i#3&AuhWYL!AVTh1u}oKI)# z_^$DK`P7~%U1xemK3B31ieeLVT))#9p zVyor@$sXoWqBR7qdiNFP=1X+6g=++)Zfk1|-r$5+=L{`mAr&mt3YlCgSUPlZznXts zJ~f$t^{;>b;m5!F;m>})wB|(CqJtE1%Q72ta3@1?Bz0Y)TdSy3$wC0WkOnskRE8F- z)y1RG77`iXaLO_T;#8uOgfZ!Nnd*)1h8D#zjv@1$%7_*;KtLT$(r1mP1u_^GbQ5~C z!-~M#%^O4^n(|v($F{|6yOhNOWA~s1y*krrL4tC3csH}|*X7gY`B};g^(-2sWM$|y-UAl{0l7L+DHq)S8S@u^_C^6M~KApb#a5|r+DpE_TJ_-?RXAP30%CNiJiuxlmA8ud# zs`Yf(qQ874Z`sk@(M{g^;sM2c^UQBw*mlge@RJ^V{Nn4_;P&f&C+IYOWv_I7Ys)%} zPkI4zDE#IA12O7RffLwjcG}$q0Eas+dv7vx|@iVTkj%XC`Y|5J)?M-doj>Pn~D{6<9MVK5vT;c z+0D#*{rn7&C|b^<$lu%jLQ(W=*1u zQbko%poPMTqADoLq5@IX8a=`iQP!<4pGZ9%983A4ZYU}rIPixpy}Lc$JBzzb^uznU z0Sz2e^H^zaNu~WFhhm@Q$9H&#xNRHtZRd)^(z$=r%*sKbhGA$?(wHP#El*(|E7k-nGnhea$>2FLRQfkTAjrp=7hUguanKEPuI(LZLWXy z&;P~w{d=8Gt#ukG6=pDsXhRc$cbaQBONM1^{UJiG&Ppjsg!Y(hsYT>``C zYp8t0nvjtna~FWoh|=u38d| zi@8s6xN5}2CE$6HVibr%in35@7B90{RA)JzZlk=ANU=K0a!YlL@d`PwEx%0yi~zSx za+;FD9OEF9RdW_2U7by`4e3p#`ZuG0;>SeQkP!A@PcU#w1Z}eFDO^#qE*Y z%4<2kweb#s;X7m^AVcRvDxOCJ>{%Ce%#U(pe{VK%jAnz9&p)}-J9|2A2X{I2O_Ivo z#8g7g?dT4~FlYA;-)Pm2kg3~Z;^?JQ_Yi>POX%qseBJHL~3FjH^$*hXpRjli< zwqa+508~P(meKNUbPl*Bu0IY{j|8ioPVSj(I6S3W{OX~Rd~kC2Jzcp?)%?f9>Hfu2 zN6NhS)z(X2FWxS+mEK7cMuDcmTfn5|&27zgP~Pa~5RY0{x5y5fb$1X2JWE8PQbcFS znPrlC(t0k_49MDgYb#p!zEW7H`t(^T9CU{UR7`O~Q$hzDE#h{mCI%KvUvn^MRG!RB&oCMix{=8@ z9H|+J-rKn=6MGkv3}c;u6pF)|HG?=@3}-24mI)4F3DFQjqdoZHBAv>iG%q7h6n5N5 z1L4ih`gL7CJzr4H^iz<~8FI>G^bB>@r0a@CqD8bs2099eL5P%qr6QF}7RfVAiZWzK z1W*^aB<*F8JmcOQ00RqTb9X$caY9RIbtq(KOJ!BoqEpfHX*!=vEr{hAZ4VH%azXaZ zmJB++7tHf_c)f0|1K^?c{XDVxfz^CuN57JF_3->(Owhi*PLeR!&zjo@mVWFkTg&V1 zZsI0hedRv;mM`KJbAV+N*+W^l2_$Y7#=V-ujRG%1yBgM!DXocznf`+{MAeT+h)7skBi?@sSEA68BWJCPK4Gq@d z4r_+hy!i;WJmvT$Wjk$gA7Cj9WCkZl6)jTET4tS|>iksZS+#()-u-elGZUkcga}Km zrA&ZG)nEVmH?{udU;NMhVYlRWb?XF;DpZQAiF;<9e1OPWh>QPb;vDTZV%$2bz7FUuCC=w!nVodPZot(Oq=+@1w*-Bq!s*3$vjML!-{X?1~{x6-A^f zr%BGI`Te`oRCUN&q;(I6Xo$>F$dvlSpX%i||J=64FT1vn*6-hulkt_OdMhTz7pBhTt-uHe3(>kcyim!&qIbT-_^*Y%tMDfhNWi7^x&BZmS9rm=gvDb5wMs-xJr$#xsP9 z7A>=FtruM)^a#4tCPI||gCp_y&ZcgxvyC;r&$iG0xy`Ltpv~AO$J;}M#T_^T6JK9! zfQQz1Ym{`mIF99y10Zs9v)+2U`g*l?alg_{;3A=l8fd5YRFQ1%mh@)p$*=RC@vb*F znvpEzF&|Yr!iUtD*yIxe_3b!(NBKf ztcghP#@@ihDMZ8!=1mBJbhnTijuy#wYf zLB+CBWs7uvIlR)4@lUn>NR)5cieY`C<`)JdC=k~Ik(7MSu3R#TBSrv_*C*TVx_hO$ z*#_hvad7YMt@rC?Ejkq~-Fj3Ghc3!CZ%L{Yp@`B|R4b%XPE-|65ZMx9j50n{m4Ua8 z>dNSOo4Z4FYk&t4EH&1Vu%w{@!M_7SU@{Vax$>bDN+ns8r_=QQ-TCQMPqm0rC_*Sn zA|NW&sQOEP{!beF9?-nQ(#ilNDzZKg(thEiFCPCo|N45D_#%t*F4+AX5d8{E3$9bN zjM~q0yT3DAUZy|#I+J!oxq1zZk2D%GRm9z<#S|ZrppPuf=x>;Z@9lqlH;CCZ=x`M! zeAw{=BLsR4_NL|(GYPSk9>o===dE$;1JjOE+J*#dbuebWvZ)ji$&$@e<@7V$sGWo@m+%qHcNazub{!aOXQW2gW(6(x6-v)lO$Yj*LPo+aJq{WP?+5IA zIMXRB0#!mKcEHgJYO80+@4YVg`OKdWKf2>eJUr%@;n;%y$O#^w@(oOK`?@>N*Sv0L z{JuKwtZ&vq+uGNwtrxTl>>3`X~q8{L**4-D1L(Qhu9?@B#UCP)!c z(F&#Y?Q~j^-eN6>y{{G6QPJ3Jv1i0OQwyZ@+I*Yf=-F!B@~b zkKZM-4u(UY#=o#}Z8mEE`!=8)fN~^l5?>y)XTt!K##166Ly|sDneBK>x27z~c#8Sz z;=_7!3zoL9>=4o3ocKTqV2axAKz1JMk=*ToM2CUs0}^foJVaLG6c+7EgCIqb03huc zPx+AI+RU)awp_&-HaJ??-vqyIpjebMCd*O6{SEmBj2cNwHn`Xje{3YQ2s>W4h76^l zJ=`Ose+n|6A&*w*YeRd-3;4YC#oH_D;Vb1?4yoHCK>zTZ-xsRdoz`uyI6@YYp0(E7 zVr}tuMZdbOLRX=2E4f)cBqXi7H@9_AdwQa>wn=A)Kp7nZnJG^pQ!Hf`ouy1=daCog zX`WTfy>i!B7(Qsb+eP-?dt1$|gP<6IGOexs?O*@0mS4>0cl1J0cVE|~)+!<{5{)^c zUe?Tfz^ep1LUB=o4ginzMiKz_wFHbw=&8LB(sMAv912KkO(vdfsZ1U2akzz})$f+l zlT7>ebfn!!!5v9AG-gY3h8QF$pfSrD$J!q?I=*3^az8zK6kWTUqcyv{G_a@^LZRKQ zsdw}Oo7|gw@7BU0fg6mX?7fRL!IFG!ROe7EAM>M6p#m-847=QY!KoLm%D!4WJ!j!#DNN z_qTjtTpv(XVw8vb0p3aO@gSo`(d>3U8?e@^V%N;oVnd@h*pFbb){X1!Vn7J2+=m{0CBhIbNZNnH-K** zW`3yK-o!H)5%xB9O(D^6dw>)`?wP&;5Ggj4ITp9roh*BE=im;AIL|zkpSdN|3B{-} zIpqA0b8dKOTR?p167ibIbeq=wY=YMBe(3Nm-~jAcLa-x{c=Y-{Hh$+<-@F@pvi089 z-WFf4-Y@hXI+0L^Gm3>m*csj(p+{_J&3ug+Zr;r$)H~gSq)MT;Elrnu& zrl)B>mpaSd;pdHu&MNiofqHbifJHxT2C6KgpFTbR)nEP9KlpckaXNn^GLeF84qr(T zDZNLR9~Bn3d3PhiG)rnCic@GEP8Vt-FD4w2SV|p@B7x}Yx`zT=y+h0y-8Lf9LmqO& zYvbV^)`~`aF*0NrDddPGmAi64uI?Sm8x6a*E+dD@KZY?ht>N9RHM?G4T65|g{wGmX zD!jQgS~qL%O}xgO$@YaVp|Ih;L<3_N0vbeXhOu-Jmn?sRIo#mtiQ}6Au&k2w9{X6N zq4xbE(#kX{HE@!mr)iq2LXZM#pcb8q%(axMgr;lcHi9A$B3F@2xZ^zkiD2lhqVyoW z9>2H8c}FMm^)mhtX|eCY^&>BxK2`*6#8lr0`%{ozLATy`U3c>KzCl5PLZMzXI^ z?pyHr2&P7xyBJ3v>?MP>KYYL=H+#g6fqmJog_72nLyb9#2z_j)WnHcYmV(@4hOA&f zN}~Za#(tV$&#*VTN@ZF4{n{Pct2_3zPa!1<}IeDKJg`F1pU*E#Ir~o^dFWs*se+dGb z-SEY6XGal&3%bECfa6|H{C-KiCMmoQls`j0^d5$^#-);3zQ9bVOl>vUw`?pe))@k@QX5?MJCnaN~=?Lb*Y(GlHCqmI*O?%%RS$awak?ni@NFKx5J7g7!GoD3Aa~ zZg`*n84x454DpmloJIj^)WQyn9fQ^r-5hj{U+Q-q$;D?Nwg1>!NiGWLb(Zi|8%cow(Ca!m%*)PKIgZ) z`#q#J{hjH}U-^3LGT!2i9-)>8AKYK_Mnu49ZN#3LjF1kEhzI~|i2D=G;beXN`^lOJ zczF|oNRt%TFgRAnk<17%vSOPZwCykslJgK`%&bazdHysRFwd;WihmJ;W-g32^*)v& z_B-b$xDz+DN9W@>8~*7Qby;||8&xu_xH-(a3Q83Frf%fWa~|~2?4!FGwp*{tJ^FO+ zj8Ke&jVbWDe-$}VxBbV-R2mAG$t^hS;*6|W@`;9A#WwqG2)XCb4aaAU`zU0N?%TMx zf(IL%AU;P(%=L zYw*s@z8TEioA)*FlE}?>(A>p(w`OK$>mbxN_h_A4K&2E)g-lXZq>7%Tp6Yb2^SRD* z(djF<#k4Et47u;&XZPOR%)JK%49!*8e*R?%=dR|wTT1aux5Gv`p*sEI? zICO=tVg+z#0bH^IqzWp~;< zI!*O-n&wHSl5G>Bu{T50l1z~~r5v8gCK&oBx4nmn`YKa2V$iP$Yafz|zb2>q`u&H< z+}EFKd~_E{ZlCxY$A9LXREfbR6%ljAWV1?=!c}nJ6qM7)KU&HNuq?a1r{}sSVVK=R zgEjBKoyOweSPrln8iqM2hns9lTx?mcFNo}_LnnmB52-OW0>Jkwpj{bbs6}RUJbbcH z2Oy9wINZ!rK+2&biS^(y_TC{-Dk)4EbPhgAHYXY5Be%xM4{shEbRQr1z5x77`9t2@oyq2y#zDOIFU6k0_lEwk2hJv~kHsg_x_;Oky{{O&}9$e=^BLoN%_Yls@5E)-|oM!*G*XzBp> z=z~OY>7$9O4`D{fR@mV#I=VIzw5Y&Wk*YdrsZ*U#H4LgIPOn(=|&8P?EVY6-)+!o)EM~PRr&CJGZGr!XJ%zRm!S>Qo3?N`Lhi!_7z9IL zR2pR>FrY#!mydsN4<8>D?zNVp4oJ#nY$)>3REu|@8^sRWEWiO}&Gv#az7#*0s;hWK z5+m8oJ6n(-hNBle8wDVvnUd`u!R!Ay27dtoxM!E`*RyFbKylbShH=a*P&YtBqFS;9 z(~@19<mOA>us_1V*Sc~rDxqI0onpvEg4nau>f?;PH}^K^VWJ_+^*hN^KK!A41$Gn zqMlVND56!$#4^|EX_}s=A~JpMt6`H3H=}}+2;pdL z`TcKx-LCJR-ks`fWjb#fWeAKRCW{G0t!F5RG-NXP4N3@Q&sUAo`)x%9WMu<_N+Kp* z;pvgblXu@*jvb=K8~QmNogpn3=NgR3v2MbO0r2o&0hk#N-j*k1VB#B_I^OB6t!}<9 z%coDDK!_-)fYQ~SCLZGkfQs%O4VvgM4rV1wY$Yuxb~Ge5U=6N|poD6d=T4fPoCJ*4 z$V0BvRRtk;Afn1DrIs?!)9F-CQ=O+$qUv5COmgw*(&jp&JMJ$HK#OGt>*V(^(hugAyc!nFW@X__eUEI8RgUKCw zwLJ!zk7V97GmbhZhrj*h zhoAloAAV#WT#*xf^5Q_CraWp{4_E7fXz;czM6Sj|AH+7OmzyCPJ&qiq7M7Q&F<9L! zHKQZH>pK%WfiI@G=E!e?~J5WgI+NTEmn6VP2j%bF6nXBTwZ zv5IF03=SsqFwyzSurU;X@27=xL?Q88Z*r_|^1JlmCv9f@@#gRrv-<9xSB$NjKgS$L zt|exy22asu>#GO1*%o?};Gnv}JW7e&oBQfchej^byoLIew-vT_@9rH2GjR$zQD$m^ z%+xBSicGBMI-jQbX_`)2%HLJ?&quz;4#27lJsM4gDP;&uksyl7UL7F@vEK3Rw;$Ja zegBQr4mX?TbJ0|6)=}HntqV1YLuBtxI`klv;Z7O=ionZA)r|R@HAqTC!n%#b>PQm% zaW9V0I$A_HxXIx$ojh*;PS>3~FtdjszK7!Ghxw3mdZb#Sbr^|tZR@(4`Q>t1*Hy|4 zQ5TK&4-pE}k=ZC1NF{AhRYu$}Qpf*_diqk_W}O=I2rU1ZT`&b zs{-ON!7|(T6-f0yk&bT;SNtuO=&SQ2IdtUsV9620A@;zb-eo((8^e3F)gv4`T<)G= z9_*(*$n#9#I$$C0e;YmTQPV)S_hq*6jJC6tU;oSh*6jl8(>Fg%zO?(af$0L6U?|uE z8~VMUhC^sX;5~<@HdbDADp0sthu^!jM0~!|xs$rqFzgl0dUD2=T4c>@OnxngST615` znrD|s0@dMgHCwG;dcTC8v-j?9A*t`6$V@pwD|HqvqBF~>Omm%|rs-U#B2xHwG`$!T za(Lv!jmY^Ci4R(=Gyy?@)~r-TV9ny@BB1c)vh@D@4?hU?Vc`tAsD_Ok>XGc-;VpVb zQxGizbbw0^sOL0{$g)SF(eU6lWUM%CK%wKAk3?=5%gp{#C=gLI>pj{ZamZ-c0h-Bd z+)%RTMlJMh>$q)I86?U0hcY+C@I;D)X8(O54|pr?j%$xqO+Dd>uIi~Xel}usllfb>X370=vXoO zDKL3e|HkvXhs6ur?`Chqc!x(-!Z$^*IWKu0$?tVH(1nHsWFC$bDiEw~+-8 z@IZ{5(L8)4ZU*AJJ1_27tyLBg9$dHPDRP1n{bAgIx5kXc1T2JfbF;13Z@d10TsmK8z=8ufoxwmxl zP2D2e2>D=w3;=^$R%m=70}6xrPB+ZPfM2-h%&_tuwnS(f$r`Po30*;zw- zCOUwHMq|Y0!5D?Bp}R-9eeW;^Rn7N>Cdt1PfXzE;*=Gs{KwJSahQ6K%0YNEJwaoK$ zo~Ng$d7d;n6sa(z)CJipTLhv~N|Cg^xGU%VxAof6y+=L4!^c}ZbDX~q7VPWL_I3Ji z+m2qJ?a_t3alu~-h#wztdv%ZSVWiz3V1#d_Jz+M)2)8bqGx-$}e{TMg*5>{*0;4Zq zbfUGOFd)~7ZO`cLfoyjXWWA15i{yxtw%s#MRsQC`|L^-^y`i_o%}zh);oiGro@YgM zRZ+UTMP|vOa8VAwH4N|`;tDa)=k!naF&*21rT(+aO)2aE1l+NrtLq5AyThU}3q8t~ z2*B>$j(vuNs}uz2S5uQIUjP}E8R;x!P!NsP#8PWIgra?$4?)$Abp4J*XB3!+`D*svvz~$_Bv+W+?Fjazdh%dCgS(Y`wn)nnRT=7eMMV(zoM^VEfk!CC!_u^p(xi0Is-~RroE%e?`AEeF{(I{xo zBG)YTahN;JMAa;4f`QZS2?PRVP)f3leQ={g_0$40MdplU+s+cKi)KqU8jb;sK8G8v z=dfQ5*U(1LvHf|6g4n3^jl~*}hMW1aw(GLIygc`2qSZx2i$POUBrZSkE)$0H+r#Ij zxzJoFUfj*l;nXY%$+A4cmEkA5AknzMW))DXMh6Gwr1dnNp5B*t=Xoxn9w{VrBzggl zDqfA2oqZrhDk8g)l?4EHcaCBhP|IIV(NySkq zb9|sq6#C1*{;U74tuJ8Z@;GCkF4u62sy&_CAh_}Vew5sFxEWUbRQ zol3o!ziZ1Cg5De4#99wzG|Wlpd`FN;>%D*X-M824_58t}-hD&NRj0tpgxyJ+4A4iI zTCf9hVaEtqhh0=)6UIp=f6y@p29!O4x9%o`ZjtC+>|KLFvu*PEtPcln!nYCp`Uq2p z*pP?w(dp=!p0S{&_}co*%jNR&vM!701SwrAr~||!Ko~uMygl(o3A`k5@8DK=(L zb4x`KgCn)OqsKA?geXBMON98fN-1TYrt@ifcdnBWK?Lxfz9UdBuI;L zuWrPn*?R=;eGJ&>jW;T__JG*Xy{QUWkhs&9kKYw9ee-NU1nX?CNWb?YH$Hb%ii}dQ zOb8l%v?qw8qby3c6qy6!E~#D})E&<*F`0=(05fwp>)qPY+lqdnU1%Li3vwgOnp-nBxWN~9hgTqECwf~i zZcA?$_-Z}?%|J50S}mhmBsistOwgG!OF3yh=`@$=U7g?6Y1UGdL$2bF@p`yJF*!KW z%}I!;yQ%7YI-jmf5cR}us9as6eHPraq4khrx15cBT~_=3Z_qCM@Iy@Rgp~pV1tyy; zo6srUJjDYP-1A+QMNl4EmD^)7%cYf2nc23L+|U9&ef9A;^Qh4H97KKRcx352Z)^{@ zvH_J1lSR!lXy*zyUnp zi=y-2hV>mg_~%02`@OrEfNC-1N4;15IFK8_((8GW5y;*1s`%Vmgwt%(GP^N z+-)2H%i0!ErOS7}`Rji9XfNN{a`Aql{enKatY(IwDpVCDo%_*Js`TL9Zjc9fMi#Dz1uDrXBbI9i-9K8M}xahc{7>SEk4Jl|U!8yDHa3rTIiu-}?}N^cD05i8&30mp-RBTTWKmW>bkYHjs?MO$cBdIwv?67GQakgAIGpgSyR01mTm?WOgL z^~P@IYy3!e0+mqe1esV)q9@i_%c)FH)9ISns@7s);+ocL!#Hc07L-{?A@;4{^8oYefS~je4^E$M7hJL0L9%R zrwSp>J31}azEC#Z7w>&5GZ?J}I68<#C5Mk$%i~UTob`^)$KS{Y33}UrlQ%(kw=BvM zNcZL*yFh*~R-d^87EP>r>z9|yb-6krS{;=#t4P@TU^W_~k}|MGl>|UKAWq#0kK1yg zt4B#-wto4pJWX|~A}Xq-7R}ZdfLR|nr>msK^PTnm z(@nE4zKDYz`TUH1`1KgRSAg@~&hU^^3EYGMkAL(IZO$#?9+|sIi-t#<>BY^!K2A2f zy&iZT**gP2zJv7kuL-1dbMv<^^7YS)%*vjR#Lw#oZ_*CGZUK(6etmTmK7=vF$1NH2Cy z&g+G-`Ah>Fd2E?K4`{z$LZA6G+@O$+bnDhvZ>#r<_bcp0U_!VI0}b=gvGO+JHZ_M^ zb6c!8Z>#sEd(YOhUMvQV3aOOB@+9Sn42g{DZK6_|czBAtBDvop2*H z;3P8yJ&L3c4t2zv=7}-DdlV(_br%-x`OFeX+%c-T;pNbe?% z8ng}z`b8p4ZXw0$Ff&K*&AYYBuGxbEs(9Y zxfMTbdwlhl<;&f1xIPc2GO?RAsT z&)({94pAmw4vF6M9Y=4{QJ3Ol@OXcQTb;pN5x3VlxWUI~;{s2tHCV-wD^AkSp7|T0 zQ(BwMTqUbI+JUFd#;zpAEn*$Wb%7|d@=wj>nmxUT zJG=vDb@QTy6<%nGW(U18eTUl({xGqE@SWFagRln8`$)T#qe?>HbY?6K050afvKLi} zUf@wPVh%|it89Z1p@4u;^f0S^4B)HD9my%UY;3Yz9U&=e?Z~rEc3YNH48m1b8gal7 zE*s3vp-i^ddT=~4-{`2fbK^E6d)y%+df?q#537mrWm}7#{I(OD&3fx=^L}+(*cYaP zRVRBk=5d&>v6{?R_wHs6g4G<|nzgIFwUcA%CL%z1Z;iW1X&I=^>7fn{a$wyGFRj7lusNbBeeyhSR*X@hG) zL4mBFKK`CMz5nnd(ZUW13~6gGP3gV6JE_7#5%-;?I22EItjTRq^L*4Z*nnf=nLO5D z*_zXhNA1bRAK@;ePHdYQpcpd&5vK@1#LX-Wu=lq5vRp5h7Y9`)%H&dmJ4QewW*90w zz%H_L2w(#F4z&$N$#r%xAqokW5XTUeQsh+1X`bG{Kc8kTQE?QtM8R_1O`0k``p{aGikPlJ!J??!Q_Xk(u2#}5uCFGc(9Jx#c_ab;l zZh;tYGna$Pl%sMuafY_JGU?%J<}eRD*3<73qD(?JW^&t21-*a#^kg ztFH_C;{8gy3f8RWif!Ft9;Ll&Y{QNQv);v>p{Hind%t?W23a*zg%nUkXVEjuNz0k_ zROY8Tor7SdQa(o%|6^>HpZD%#4y%aQQj+v<<_3XxJe|c+oX?OerL=zST@b>+9oD;n zW`s3&$SAgpqAb9i`1su)1bFw&2P@(ol!D&i4lO_1u`%AUB!El)9Fn2#A=G1T*37e;WbeISFYB@_ z4v|tsXXg|tnE>$M;yO4d6oyVKp`;DDk1X_ebxn#2T?BM7DoY4!6jqg5WS;AJp3kQ` zm!gHy956#p7+b)jArAo-x& zzv<9_hT(PdyJLU7sS5H9>4@d^*EOGb8? z4pLkM``if+H#bX1Xu|q87B5|okG050wL)A3>X`00gEI31nBGF4Kq%k|g4 z{O8x}$Lr;}Ezh=I@zcNHH$NoY&EO~0DNPepvZG5*ci%>D@Q;q*sY4uQ$=wRu7V_>c z9@_jcv8V{x8U+mCHa2qw(9GOXVq?m>$S$N=l=g*<0>#zQ0oafP0&gBUb6%vgkT@Wt zIH`}Q7ci%|8EhkK`L>ewr=*afd@#Ul=ceX&m~DjIrZ;zdoPPdhiot-6*vbxS_WY!SDhXDxPM7&rtA! z#faX(P6(B3pu$va?fv2|fEit>KzA!)0>AtA4+Kx|3mioubhB)%Hgqe^BVlPlJJOh~ zB00-K^n_W}gTWfyD(xdm+G@~4kz=UNXNzUT5B10^$3q<^IesmO9@af-|ExDNco4C? zxq0uluIsW~dp9>gM5RKDi7;u;iFpXQ1;GLr)eZoiPI?)iXoACHMi(ytlvFAd%2KtI z!cujb%K21IRWpN|zJe$r0;)t+5lKdFGu3@Rr>@jzxCV^W*gog;U&yxb7*8pEfMV2??l%|G`6~ z`+8~L?sB0h7ll9OU4kBacZH)jfF~6vc4bJ~j-(j*SbF24BTaJj1VVJ`u!Z}m(ivlM zLuBDF#ZHz+QJAQ@OY6O@Jv1oScDekIzg%AW`t9%h<=^Y;^_%4v{-dA7ZQEGT;9#bq~&At3lq9HqwBN%oF!|Ol~9*P+oEqh}-N8L2Q?idXl zNNW0!bnhfLO7ZBctPmGEH=g#+b7D41&i+i1k=ouFngZkIB>B%<2bRNJd^PX6qCtC+s_-YV=5DgywTl?<2 z-&4wT{>I#+#2siN!W5mQ`65QbMI)UeBHq0d%ucr-*IKJirIezgsL`HC_N;K!@=8cK%V0nL@ygY{ z{ycY~_N!0F#`C4Ka2Tzx@gDCC;a=GDYIFGf>KO0xtpnb&xUVnZ_-DQoceB&1ZlYcv z+%t|23L@j3?H~TRYs2f^F9JQ+S2Ql%ZYLb7aCsIW4a)I3kut9GkdO4Ep1*JTMZdi& z4}>-fVsY4I901DGJQbm;7`(f8Ux0!q*PcR&6!d*98v z+o^huu1V^-2vRcdfaa%vfy^^*79ir#EQh24W+N9&IW~34+8+rpbATj7vbd}p=@bc7 zdPg=?C0w1M$s{7MAX5!S)p5RVz{1uUBb}iTgC!w7Eu#aV8}?e}cxZH{UNpoZfqQ4A zci5E(re!>~fM8^(sv5kfu9jp!yr38k1n0g&_rT42xJA4PJ`;dh@2xFvi}wZX%D%Wa z!6LzZgLx8w%)OhpB+3T(=w`hG)zTGn7<)KcqKKHIR96+5L{Czy)~7O^OP%X__e7n}ER_=3;!wJbc?`geYVIONy7i0>-D+yzOEhA*rz~{1u~ly zN|lhiiY~=4VNod}J{3;&T&L)LluBJ;Xoisy5sJcmi2M*LQj5;DX0cH0Vd)fet0pQX zDt&X+Zvp7{O%m&S`7wLN ze;c(k@F;*eP{AC??ml+(NH$?!-40wVw9yOr2x#kf+Eo)sHTb1R!NPR!TfpUbZvo|rE2v$ILJj!0I06YXfhIUc3tWZBN|BjOY$5iwyqx;C@*t)Lk z_1V`Ku@~BfXpG8K^z`Dag9yQ@QHN%5cWVZ?sUv(HjkLT)CqXG>5fqBDOe|H)S%wT( zMQ7~*KqZ~4b#xc{(!-}r$JYp~t9|_TcjtGP>FK@rq&k_I!BrUS;7s7AAWY5=5xR-` zme}OhlQbsQ0mkocKDwECqz3?u3{LKDW)?whz|XPYbq{`jR(%_~cU#wGS*~rpqFqgt zECb0>r-)3hlSuJ!BVb@q7K%heQw$1-XozTR zX`hHzY%7_|MuGBx&-{HO;2pkv`wS1yd8BCO8XFh$Mbqn}g}@MW=WTD>%hA1xx=8q*(Ay!MciO(xmuSXMjO!pE3iHnNgq6yn_t=!R$xC%@^ZF&CYXMfHg{M6n1+$Z)Y5m+~`|UF0chjR4{v(*oMZBuefJ4EH=um1>%A&BnXO@ z;drB#x+AxRYi~9zx?f-<&1|_ox9@(->u;eKEe;WgIt1PmA@RrxXJ7=ULEvto5!ek> zhx%Zbx=f%5MWl#UDKqP-Os85;rOu^R)zBb1cm^39+*2j)FMH6?UT+!4RrlF!(3kD* z-D^XYM77d^-rQ(TMk8aY$}~;aYo(ZLw(&^LG{qn++0zzO>na@TmBDx>y0uTAKAH8? z`MsNq78kJ|noe!V%@=ev>2ML6LCMn5NJ$ZS$t9EC_TgqDXcdVt7bDcnfOz~HL)gql zz=2V-8ySVx*XQeXX|067?VNb=;o6`n-O$d3?ZX-VVG$sUu(*jNmWA)8kuj z8zBJjJ-EpI6JLcbZzM7Q^Y(D!N~I$j&U9kISai60=| zuadsoA$kyVy@{9)Sv7OG zKK+mW@i!r4BqLy?sGtN!-0f=KiQ?VY=a=U{e79aNKEljsax%!~GQjRFEE^8)gWZrD zE`1omtt^WiJ(wUEj!m2@`%!U(=g33+Fz3Lb?Cdc-j-fqAjE)QY+TMCD-K1SeXK3PO zP#aCyBShSzjlhC^YkI_y{pIG5jq%?RcxK75ABH8{QVfG@;*deZ8%OQPOr*SDMa7Tf z%iV;dTf2PvZu#xsv_Jfnv~NWmf&C>_$IM!fQj_4uL7W8;Gc-f*X5EZ*7MJ2EK&4bE zRqIsd_htUUbpB>Oe{(v&n@{I5)gmQ3^5K3z+upjF2V>RTkOv;UUdQ)$oVCx4$!A_1 z*F%A-p)2N!@6#?+%%V~=!0h~xy)3}9WaZC%oPjwFWf zGb=1*_oj3>yXSnfC?Cpf*~YHgI98rwRn`)@h;kthwp@OrcZ&yXmi%ZBaVzicy<1zB z<$C$FTt7AI?t-+qm0BoOWunf|8D*v@M4Ztz+tSry@RM0owA9n2r&^-pP!N?xqzH;? zEoCaT7LA62N-!0hk;DvcfOGsCl3;W;Amk40eUH~?jO!7xdU%*0J{{=rz9GE*ld*3f z&p8ah7UF*$3jR6k`})t}w10W#AGWn|lQ*&K;U{i}{9w87ouLg}!7#1>+=EvbyY=3; zW&~(EPWBnM`_Z~S+U$K#*bWY7VB0OmsUkJAZziFNVKz+l;LPnQd?r(CFo%F>x)Aq} z&3Fg8o~9r#XzNxefIx}^&_PB|yCn{|bt<4W*}hH)UM_#IfAyE%ul@2}zrOV4a{keu z`G=o)H!~~s>8(`V~D4_-)8eAJpm^7|fMK|02(Lvia zMcp?hU%$03mTBZH924~H@wlz+gK46qI>}IPc;FQtC-HVn@4YX}x_)ZUpX~W+wg!bJ zR3y-Ik9LqO4(*_sc|&WxyU~@H+zMIXDimr}on$&mJ=N({>s)FTEh>8NW8GWdJB*I| zO+MW9ZX^EJd&fh2jKAlLpo$tz#JZ2d+_0A}=z>l+37IFSQ(ZEf&q5J;qeI9QzGlT; z#LNU(mS+9acc-=KJWH8G6f8YBSrnl`(9DohYu!;u6&T{pQ71P>AZG6dI0un|W;RSo zb|DO_ZPq<2kt`_K)_Ys8YqQqOZ2lvU`B=Vm#FroJSAE1UAFxm3&tJ^Qi|t|3_+U)luZ5Z) zgoB@(>f_QrYqoDc+^_8*{PHN>;{)A0e0AH4Mou@OKx4*OH-7TX-X+m)Cjo&YGwWvj zGs4*-kS~n=ft%)0q?fvuTLvd!N|%kpn4WEfltdIz4HV2GhdAtZF#LDAy(Hs$TbUa} z*Mn9Rn(y(25{Qrs%t8P!Vlks~kR<7ZcOywb>)-zBmw$Nv_}j~;PnYNCAHKZU^>Y64 z&&JD*uaUd%70*XGCDj!4P8$VNqe57&1m_|}4s~;_LtFB-sOSdm!%qD4O z;*nR&O6ZY<6D{gZ939rTs|oIQC)5!FTZ29(++5B~66Qj&VOWh&4=xLsx&JX|58F!o zMvu&VmO{IYI>;Dlhf4(AP>Jkn3VE0?D@xo;r1SP4*~jW=s4PiEw`@& zt**0_*$J3?j|o+}(_y`#uiZNmnUD%8A{DBtManGoTJSf(GBKqJ-X&~x9+~S)p|2)-Fj$PxX`;2$)ZXJ zjgyLcuhEv#-Q3o2XT=Q^7csZ%bzxhy)>5V_1*++}iqb;nxGEHojvi`^L0}mccuSio zMZztNsCUpxx0`CijdQaWxvdc#TWjmOE^Awff&`pFilc~DiW-%y6opG@*^a`esCCS2 zrm~8%P*i1}%hOcnDFvx?L<6A{S&E8mRLB26du^fYp>e`n$7QpL$a`-4!U5NPl!JVG zs(*&<@#fV&AWPqw+y_Q_T*HGi?TOh}MjPS!Vv_8|OeD%*E;AFqnX&g~=A0X6?X`YX=Y|J8_axYBP5AWOnaQWJ@G)yN3;( zPN9m}pFujxo>?cl_1?RR0AdXeZ{|_7TU7;7hz~9J?svahuIu{gyLNqEFV7#Am(!2_ ztiAuCS)1)t%A}=>t6NvCs*&8Z2*&-GzS+aO5q&zg@|=X)NjPPrbq-_}TZvK{SHJBr zrNKX8GE74$!ki6|TEvX;Vr=ehi_)VVOs<#FOMa(PZ%fIIA%(ZeQM#Ph7pQ#Ws5e7hZ!FKEszQD)!beh zKfa(|WiAknDr|RnNB3sdtsy$pQdH#xp_EB;R^1xRfA76 zChm<6{`Y5W-Wl4zr`VnBkUEa1OFMI%pzF zr@Mj$R=cTLcbTkDpaE-6y%3Tyv!(UbTe)iV&&4QnrGTQPs1{NiHHu%6fXTqGsesVR zA-IaV`fyW?7;dGzd2{Pg#NGSax_3iw&FPehsU|C=Qi@5XR3{mLya(EZB>$)PG$L|} zid2>9G(DZBxt6I&DN(ko0nw>OBLp4%DeiOS-^S~E{q%41fFiEHsaMYNqd#U_W|a3nYfaTwb`4P`2h zqrw4U>3~WkMiG3&wExa#>$O>1y;8ims5KO9IHHZU{&O<=q*@AUA4NiA<*=*28 zfH+Qs0)&WJ50u@~fk^S)BfNH)H}McHQS%4ODbflDuhd7-f1qm_NKsYM$;xcY#k%Qp z!}+D?M4`E&!yIOdS$8j_Kt;5QR*@p5N;ylNOP#dLrB1a}5e+@>8~GR6l-drl`Jlb+ zxY8?mysvq^2BQD|X!G_^&66n5+Pb#Zy7g{hftR)}*X8+gSuWS!TJJ`44{yt(fdn5X?O{->ZYdgH zIQjSJ%>CfIkKf)B)(HaM(5AM4Z#%~;!+dkoV?VZptAV7|Mr?e6Y&iS7GD2qX)7UngNk+ zu1lO$l7E zFW&#;`Shbd_xHW`HqCP_vpLmVU4x<=Y36%$pJ`wtXOL_rk8($*7f&&`zyr1&HL|&Y z`-pzC@QK0cO}DNC)_ZYKvN3q1!6HosXrOS&CwrJ25icAPv8lJac>}jIEJ9>bq8)Wk z5qFN}!GpH$a44jsCo4OWez(5(4duZLIC99z;D4~*ZvPq;(;IPvMvB&=(^;nv{rY0I zUe_+y3#KP(jgkZJ*1f}(I*BT^Xq~j2q|91ot+SR%i>g);5z%ztHcWh9gxtM>5$Ptd z^T-W<$h>%bpML`D>*Hak#A5HQ_qF%Xpy;hH%k|Usa=l#p+ScaXyqg0SpnbwSLtPOb zsh1u$*hoPUDq&P}>pc)@H}5OhMhA0u7l%ge1A)RwZos{Fm^1>-k-9ruB8e1dR0O!}?+cq+{Z-4Qek9PkX63O>OhH|-a@5uT& zH2LBAvp?>uGux}*IUu*>F$TE#wXI6%YcPN}U+hV`eMAGe^UGfshTIHqM%Nr56b?6X zn-NL8RXloR?m0&K)+;fZ{6!BIH)9x~^e{&qB0@lxfYC#eqJ+sv#<`dZ0kLjyC};+! zE19vY8-<{_J6&lc?E2mBe)E@~){oyV|LD_tUEW<5`|)-D!H;@B+iY50y;Se?0!P&K zZ3@yG<>@#>_KiDuEzE|#$K+lJbN3{cBz@Y(x(-PVrW$QHA7}=(6vo;gnYdDV$3S56 zNo-0QKv-~WK=ObZz*`dof-EFDOi~>avXSHtTmlX$vB2yi2_Ylo_GsMLf$>{|0(Mv% za6q@oHz)?t>p84llvHlbn-o!$1(rIM(^HvFR?f{DV10FI9qdta40YusoFS9eN$M=+ zBxNpj)>2C;!4iz@_|{q?{U;fY_LecoBp3pbz@we(&0XLYDS1tD{$mBc(T>E-TWh^r zH|xE1v+n4vt!sO^T&|bPb#2-Gr+fF5r`62OXSRg&(19YwEL7WsXmp57q&dyS3nsVK z9VXp3;?VS zlB%KHC}dEsSfkgeP;ES22k9C`^9t#swFBU}q{RiUDz%m=ngBB5^j)3mZs+Cy#LVyK z-GNP0=zaoc3hNjMzM0c~Z3*6bef^P-7tTh|P7LgEqR02%qZnMeq>3KyI%BsH_An(I z({hnxNJ2TmZwrx`A?7{c93erd{Xe>W-*gi8uh@eK{`Gx5G{d;J&?C{j7s;&;x}tMx~KZQWi;7 z=U$4{4+=k-$(q9{eT z;cyH=Tp)wY(9(35Xb75Z*f5aikgXWd2`Mf{lW4FynzC*8m8ny=PKUWt!sREBBrcKQ zrlx-vB(kxP2GPPXqTV!?K9*!WTEe|Y*A@=;-}Wqr!03i{jE;nR4&Smq8`v#YR+-(i z6?Vfhkne#ZMDBm22D7*`y0AH20hCh9`Kg?q`t`~CO20zHQHe?^q(D@(s7_Lzq@1Kq zs#DRTHChz~$4WeF1jD`4E%{D{`+N}axp9OaM7M7dn;$Jp{{4;aSXb$+o5Pwd)_U)~ zS+{PULKSOk*LA&ImgRcsZCwMh?M6^@O^N}P>JDcQXOJwUnD?TydpGxL#fg?+it_)* z-JfkqlH^!|-~~X;BD&b(9&1)tS9SGI%+vhX{L_5TJj|(cdTPmx@WmEYm6eHrc>q96 zEUIQ6ky%-lGjbx#RYhgtg$T>V#f1s9vJ^EJW1XQ3tf^K&O(oHo#Y|lV6E>@BT!0v? za1EPD$p?3edR#|F%xcb<42p6(Kmttw6Bnl<5D9Z3=H^FD(Qc#`!6%s!#H%B|A3;oz z9JfSf!c={hFAE8?PbcE&8p;Y;AaZL@(Xf*L=RJNi-Ttok#Zdno{}9S8-4v`!yxSCz zwv!LuqBjqp`nQ#VZ%!^9?U2{n=GPvn51$hvxDou1BZl(-MqRHVxy0)n9p~FS#>cQ; zrsHoMZ?>D~Z{N5RnNN%-NE?6r+77%4J8xew+8qCsma6bH6Sba59hQ*v1?^I%9BGYUfK~{@Fpk@j)*Ue;z@1Jn2tlIojG<_JQ zI!_!~l8wPVSb-j|tk?C%>S!DPiA_YY#+N~Uc zh$%;1P$y#demiEFcK7Ywk8L@dRw(f_v+TLta}kn45`Z(8StQVAPkG-Mlj3V{sQ5ak zdy^)7BjjK1Ss|A+Y9^)6ZvHMQANm!;L}+SvJ6YQ0{rm+Q4&Yi+f*>P@vUBj#e_ zdKG{fiBs8$(uC3Ej3j42nKo;+nX)zpgSY`K0yQwR8KJ_&%mhtag|B&SX2qbe8Zjj? zQC0I{Tmlq=029y*3?`t$U{3NQN!3=4(b^=S!p_xVh7=DJK*F&BOC&o)%_zo{5(w<_ zZ$_;b%sAs$XNd{fBxRbWc~|asQbMa4oK2Ws8~1u}R;>T!_w(<2y!nN_=JYN1tdZVy zw%~we1!_e|o#2&c^jnGR_r33T-1E2JXv4qjuQsFsZ(+`vXk*7eBdNZi zByGj@h&GP!!5lrD+{}NqZA!YiA@u4Lx<^n_$uH_T>-XsL-wN4>pFL*?!gFu)c~#F^ zLm4H&H1Weg2$Hx!fKNusajYJ}#XfEj$b(pwQkyR&z-ixL& zctSJVb;oK^PV{MvLB8W$ok$pr9mwe6cD!szGGk_A)Lqm&-{*O+4mBG&pO(oi(n{*eGQ@erezU6EGm0WK}n0vowxZb8s zwKlC<>rz`Pe>K%w>-D;vFW2Q-RjanvLJ)@uL3a`smT8(;gw<$SRJFzpWn!78Nu0EJ zy)Mh;veYYDqgMS!vndQLOh(N^VUj{-ro=N~rqy5+a@-12SjwYv9k^^vCJ5ej0~JE? zh|M`!Y{tQ=5F#cn#3kCGsF+JSL(q#k=0ytzvzmgMnhF(f2H;41I+w!4Yu!Y1DZAZ# ze>d;vQc5Y}q-S287J-?4OrQ^Z;{WLm`0ds8>W5b^7{SY!+b6=eD`j-%-H* zPEmFssnECHwf;&LRk3wDS|A!5Qq|_`%+`249837)!QCc0mv01dGZ0LO8o0v9dwF9B zSXcs2gEXPC@7#?%PGhGWr9tzr_-)Sf_dcD>(0Z;zt^pBkNd5GXO)=`PVq)ZlOZ&?h z^DZEf9ssGzlt!mx%bMj;_r;Eo7H02(P$rpVDuqoK1zIzPyf1T8tBR&dRwpqLl4-Y_ zm|!u4ga9LjIH`kRhfn`~xxSo^&)4H~JwIK~f4aN;VgLSv-qm?`SISh%Bx>e@h9V@) z1Y$)O3T-NbLCLXe6)faq&~3nxq*sziGVF({if0m5nw3DaqpOj;X9r9HVbFylp zA$FPjeGKE)E#?SEFK-wbFv*1bN5G^My}pM)<_DhkQg$qpu&{HRH;z3Sl^svC-0FiC zP%P5{8+gSOeZ%{{CN6ds`fC1sboM%y{_V$@(5!ig3v8RJLW9*@o3=$&o9iCerDvdVKORcT78co+~fH|30m?jaP$~4Wpc`Bv27DZk3T3a&{DqOe}o|u)OKx@1TDvwhg0QlwfmA?XQkYS5p0Pnq1e$@OH8zQ~ILaV?TI!4trV%!A)`9mg2>@mo zv!b}?j54+B@TB!Hu$krX03&jJ)Q}5tLIpvY;5>XG_Fl%~eZj)>Jl);z?sug~;TVp< zsb1$LViFO*Vnks4PksC*`270e+GgMX%+U{xkMG0F`Ig(kLEryt)>fm^)PwmqyNr+? zH=pf8;OyqRR&G{E`{c(%VUkGl>#rEDjP(%#I5(YZ^UeA}9!Iu4im(d`a2x z;1rXUnzs2MTX2M{)^)f!Bznh~2YiIFvH zFE7W#)9Lu>)A{KyAO8HG-X9P3^t=80AKK%``R+mIR;F1@R8>@1OJgD_U`s$Glq$s3 zYb?p{Ps@b0G z+tR21Wgf!3VH92` zyKi!-UjK{UqDL6fgg19>E{M3EftUrcxsBZB8XCx^&01^AvRp6A<$77JORE*Z=Ck5H zrZ7mDxlCoA=lwjFB2r389F>^to?+B%AbV$~t*-Vo^Z9tao^ibz8j~s*%H-ow$+Qru zv4TKK46;H5Mpb6Q#M&peaCY1^Bq+f_VD=q=l}$lDRvSc;z+fzJZ%Fe?sZmIf9&NeM zK2h3zsstaMsGMKM1YxfsPws$cAra={fg30I?AbE=*wElY|4*l0{axRe%jq`pz4`T~ zp89tm(%Vkjx>0}2v#urBaT@7c=`wnzFr>Li{^mNc5?&|iA{eCcs}XJ-?W@a~ZAEJ| zrRr#?%aW2OgB0kr%LjSdV4EQTc{D^VRh9gylrbPrTVIE5;}O1*<5&gG06s@h1Q&6#Zk7Jm8k_1C9g|MJ&A{m0M0|KFcJ{=_!DJa9+^IaYM+JvKC7 zB^`Q~VY2~)IFyDi^;oM4I$h!%-D0|7ZRY6W%Hg`*rKL=TOKa8BCh=y)A3J zO?7FyEVW*j<+?1(QfsT#NADRCL<;+)cM&e7Ol3FC(_G3_itDQenkqgT-i419)|ytQ zajC+rsj{m$@;nh8hydlqtWk(DOYwvCpo)YYOahn$WXc}nF;P(BeHm7YTCy)~?sKz~ z0H2r6e3Gyb*y;c3fE#gh+67cCkU@%&g#lDFcd=cG-fJ-e55$SZCZ?&(({7$8zMIN4 zvxqR@r`+AG7k!yoWYhTjZ|!m8ZRm}~wteWgKk9Gw%pI7eD8u&e?4`2t1J_r*@eSLj z)+~ARr|k#Ezl2N&!^aT4l8+`jlX6r50Du5VL_t)~;$*y3uUXCcMt_Tq$YB~5g^{VO zbn$FZcDQg9=g1Hz$G+$-|D3qNBv5lUKuyaU-y^aVpdY}u(t}XsAVRa~yBUum>zBw* zstj?#MlNC*c1$9ojU-7kA#5OXK(pUP0})C!FF93a2AT)hJ|P^Y)TnBMNv(7Z5qK?3 zl~kBP;KI9U-rL-)ImQ0^MC$-pO4Rn!`DCj!+%&#FAwLByAQwLJ^s+{ z?(4kF(@wRpnu@YbWF!J+PS!DTB=5)-5hp;d&}3>*C1O)r$Lp50=zfWx5 zUZ%|t{SSGEHxed;w-2*2pxcr9#^8CiW>($LddlmX$7-#$+G<^@yWHh^txIdBW=v6M zg%PvRRGd&W&C@(jMJAb~$m&S?!@FG9kk6PK>(Xe^W~yj_k-8h6pnI4a6V+O+p{UPK zAW(@hy=GD34;Y{T&U=#e-U5ag2uLs@34JS~MgWV`0%A}B0WdX^pdB!*5I2olc;m2x zwqDh24-787ByYaxTYs{#4KwP5gOaO_ACWw-SB}}<{+8(c8>H#`XC@_^ zJR$2ol^HQo5CThTRT!&2to6I+7#^{iR}mc-;}%JFpGy;|vnHXM##75f1>nURL~G_o zOGFZw0|gf~x|=AFzohVFHgB5|+FLeVTwqv^`pk%YHC7SXcG5GE0y3-s0wU6lfPvT< z9FZlirF0@DP*JeAKWbI=#M~*4Y%GYj6Q~PU2phqeAsiqW+2moZx3m@`6oQcv8yIF2 ztG2_Z|Mq`f4lnij%klZk`#=8q@pOLtaN529I6b^?`!-MeQq0U)K`N>yLP7!&M4+hz zHtO;#!@x~=%^W%CXL20 zFdKh{>mOjRHiJ)%V~V^z^FIg6StIuAsxlVY#ujNAripF5@8&i7Mp?}@{?g~i*0#K2 zpxlLdwtm`7J{KZt72HejZ}0HrVZG5`^i5(jMbI5~Y(*t4VdVI09`l+sjj_Dn12vy2 zui7H@T(mV!K6BHiy42d1Wm%TXQrl9U?rdtE)(L>!QAnBQ-QC@8p2{?dNST;PNLZLz z3cIwb`xLClwSsc4@+8VjZA_-xh>4V`VZS3Hx)i=#uCy%DYU=}w1_iqKI3t6=o7stI z{SqUeyzA3B$x9(#o$|NK&T4 z(_D7*RD_6mVx9|^QrM-rq9d5RWKPVTCNctr{~A8{pZ)o{yWD7QID`FXyY;@Wn|Z$R z;eSgd7zFZ}+8g@h>q>1LY24VXIw?DQd2EteU!NO$+>(uqb81}{P0T}Y0;dW=7vVK0 z)WniQ0|XY7*#MJQGR%NZN16*?au!njVg{m`FQ%xLey@GVf*!~%o11BSHS&rCYDPUI z8Fo!?4143Atlt~TGI2J{6hJEXPq@|Ck~opuf`LEnIk*PKu(}CH_*Jc3D+$>olL=Kt zRn>ZJ+R$LtC#?w}o%FO>PuJi7!{h1q`wxHEJ-%;u57X{$nx--pwqh#K=xHVqCRPGRyV-iRdeTO5RX8(B zUk-ypCxyA9AcYc{F9asCN{P#Blz)lV`;}#8B9e(r$;`*gL`@b7R??jHyP_Q76@1Ji z2dA0W1xn1O4c(bjB<>qIDFr#R0(sEX9$HsfbYjGm&@%6|kdPFBcFtU}i2zfDYSU^Evq{yO z#pqCiDVi=9<=P0$%%t-)Gkcwg!60iM4#QY`4^TUuKmD~HU(U~8Psgv9!=E0H$NLYz zyL`>F1xc@~*W#l%=mw3$rCP-f4QJVHy*%vTB7uv;iOSP>?6oQAr|H!w+9 zbLWgA^`?@&lORK{1$d|^LdM1>s?e5%Fpv(qp#FU^7DpRFh@!TF?AW#VZm;+Wpc-ju zA9Fpd>COJ}bM=%-w!U&*4C|uCI*F+3FdJSKa9%(9`?nF_4e#UIJj@{;?fWh+fBX=K z6V_m${&!3qn(inNGgVXb1UF_An>N!{6{^;1U6!V`Ep>4!v$h5`wVYfP1UqK&Iq*{{ z(=>VPmwuMW)xP?`02b=P#rQ1~PkHUAfTa|(Nv*}?U2UqRP4hg@yX9Kv+O$=)s{4-h2iCE-6o=l$YrHI;<`NT=WAZexhyS(R?M=SB$->@x@z9Wl8@ovO zhGXq7HM;run>L=l7vA)~Z#m`_;rvcYZ8v|j)iZ8i5WO+4_okuiN*Y2h(~;*G@nR}Q zEsdyJW^Kuf_Fu9c2o5dFh*;%i3DyF+w>BCt5fPcS7}=80@%ZQ_rx$l`;I@stL3+XN z_ikD%-s}o~Ea29=U&^r%1+#?Xb`B`hQKpGSy&jSZ)df2h1nhyB!{d?6&%*l*e z^PjwMHB%u7kpxl^=F$b8i=*>wL~6vMF3#ulfr!ctJ_9AAceBfKx_I0~owPZFgwJo)^x@c2Jc2k2ha0eoCJhTYU zQz=EtRHiZqeCi;xbE|~i;fOeQcTCv-jt8X#l`tkaHILOu)mm#iokQ}nS!>!_yDqKP zs;yp^7J`_KRht?EY+7L;>19{LR-Jj7UvWm13QgKBCi}CPW0kb=!XO?f~H6$ojqr(4ry>Zv=@|pIsOu zE&zhcI=79S3X=(A$TyIeH_}XWd%)k_MmJ>Gv14MqESlg75#$YCA6Zs~-vEX)HSgvZ zH=mz91UIO7aI=O;t=EL&8I3+G3n@ns*2oOO4UOraQ6np@Iy1?FI8D8Qf>JsW+A7$D zMZlhRH6w4bF?P2{W)8Me)5^p|+Pp}tAx_{#PPGLv)#LLo=j+q+%jaJ%fBsL)@Bfec zAD^$Mm)-l{PuF+#{$ZZ?)4VIwq*j=fwTL!WRu+?h01U|!LDx^~sjv$}L_N%l3`$)> z5=yXOPRBB8PKL86n8UeRYI%3N+gocYB$jBid0&a;dmVD|P>HhHk_WQ;aI^c=NY0&R zW}pzjB4iIvEM@AVJBVs6gp7<-LlG@%*z02S#^?|wv~G@WC7feK#Q4~2D!jsY7JCifGZ(*R>9`(*W1I{Y0JSVB118E zpANV9)I&cy_7H@aX)0x!WuD7^j=o+Zb_slEXA_gKQ?dL~-MU`9_3Qt%$IbUfPuk!3 z=Dgp|WPRiB-}R~Eli!DwhwrjmU-a9sR1{M<(F z(Q9@FD*!^KvE$M-9?uYE*~X_@bR0)v5O4-*BO+M&?L`qC7?N3)Wl7eY$%A#GM?^Wy zn~=)A{@5pNy+2@l$@;Ud6|;OkDu;HPRx^cUW2`G$c}bCP#3kxL=5X(ug*{96+f>Wb z^RYF9iJHNhFinMt&{~5z_e7dCgBB(M#qe4NSUJ%O51Fh{ZN>r?v`kn0axh?OLO!|; zMqsJe>zBjf>GbK->5soY{P}->_lMsTAHx?4XbEJ**xo(lhF z`n%;`d4s@>BVOHbc+(q(!|gY$Z%;4=@TEw;S{#?D5gl3!pxJwfQmk23RngR})#M>@ z>aq}XA#(V*Oj1e_DN`v^5ywcwp9r%Q8Ks#x1_Dv^jO87~|FB0!^-=FPmy?Ec5Tz}a(u9%fO<+FCP5)uE=^)X2TK&yT$YBA`MjVxMKg@wxaLD#drlT|2-c&l=^~;_?s0Me>EX; zxWQwSz3ISz+rNJAl_2s^DfRHTQ0@AzV2^YX#QK_*0=+qYAA1#1x?3>vDR;(e=WYnd z%McZZN;3gK1tirl(35NO+Q+6PcSW}Q6Ru;m9${Qi{?0w`RXJFy7Oe}*U8vWqjA97Q z255YX=t-}>VaOml&Im)u1#UiwS6%)$IyDmU&uIXO%(J>IxQ?e872oFeY<*bMx-4bh z&$Xc~rmeN+S_;%!)!MY0p)rdQUl)U3h1gU{tVk=|>!;y~TGLuxky&eFGc&%jkXQ*} z9-(;>XayMRy@hSL{Bl0N+S17?*gEFXdH+FNwjTtuMgUB7U@4LH+%)c{ zF~pdmja1htI3ltv1DH{WR%3ku#RO+g2Sp$?Ga}C~+P0my|J<9ZBIl?6jiXqr?@Z@3 zX>8L3I^4o!L>(Y}j#W$W2*c5D2$|Wj>+iLYA?q`bhD@OUYU=r}!dmp|T6Jh9oR7;t zHd8c*o}0GTT#~AVLanjum5>9+JVokSM0hSzrin$QNJ$5qO+*qYZ}jgXrv7w(0KK_; z|5YAq)|fDe2+Y_3)2W%7A}0}BtyP;YO>1ptZK<`HYK!>`O|_YsbDJa5ZwfXI$?@BX&XcWW|1OOiIT3zqgn2vZj4e?BcJ#eUjYou`dfef&4;Z&+^U~`k2IB4 zqbREOV17+Wd)aDRU>raHTfTFA{p)93NZeMq_y&tkkJt-RPLkqoH{!Kjs%LZM+<-*B zm>Mizm+?tujySdG1L+@0!ORMEQVTO0boy8 z#HK&L@{+-0hxBXW=fG~uQ=&$YEFwBr%htlu&Bh-b@R-_dd~n|8I5r^X-hv1WG+$H* z4yn1wytPaleAL>qT$kl?F7Mv&{m7aU8Ctuls_M+dXuK>HaD5F=0^yx#P6Jl7rl?Ix zgWMvM0LsMEM8aIk0}B|W#xAcTtjtk$H8m%R)#Z5nvMkrOJbk%7e|bE-+<*LX_u-HF z?t|Vxmiu?pzD~P+nWj<-i?FJSc!FM7$i#~yiAS@;ksTB;Goa}(HQu_P;jzt!gTJy$ zvN+9uCS1YArtY(I$?(kf`f?9}am?{~dWNfJfO|Ef7Q8e~I3M=`2 zEnP)hoUPHVFoAhHB~lMGxe0#d{&UP7RXFBXj6+>nd$q9%ph+1nczYh%*Fk! z6rN-fDPEFf<~6B}T#bl^RF^!dL#Ve}_GonL^)GTN|GYdd>bHJYa! zlW&$c#5cA1gv2zHG3U#NAcW(LLT==|fgQ*2B92B~evK#7_@A}b|IbZNzlm4>W={N_ zkG+*>cs(@m<_(mPtUq!4!;18Tg8o}&-Pb>_belfXW&L1FDAiKt{Nf6t+*a}xE>H-t_T;09oYGRo8@(c(Z<)l z<$Zx@cwH|TEF>m9XEuhjK21Z--N9z9TG3RS*5z`!p0DT2`FJQWc5bsP$NJQxME!NQ zFJ{f!T55I8cvCc0uLmovYW033rs73c29-!jy{DU9IayK7%=;)|VlnAZnYo>xzW(Lq z^!)kh*S~!D^M8E*yXW@9kNbBY=XXEs?%&t@$FjdG^KL4ol*zPE6D?+J!bajcP9Cza z*M^943ycA7=C|fEpu!OY!EhUT^FwEvp_^yT46cWpcdlzexh9oEer(Q^_WF${on&lD z+%r=b-nDfe@Y;gwC20Zy#V6|o!@?{Ze_aNhbHl95J~}dPdM{qYv&MIAnEMPV%3Ej^kD|L?6>( zTg)n5X+$HRXh@y2{Aqwm_VW6n@R}&P|0BRB<3x_0Iqul#=;uPcCD+35+}zDxL6f%5 zsNU3%Z(h7XmACYiArFoc-s*Qp&Q#ty1!0hL_NV!l@C?9p<01~ar}$<$OLa=hNZo`Q_`^^7Q5Gz5a}=HdBBYLSR!f1B>-l zrz&RbJ;ZQZ?FAN_O7Xfv)2JmVu!MZPcj7jvF^PF+4gsLn8VNi4+q5zf(D3qe`St79 zzkd1g-~IaG&wqIQ@y~ZZ{ORuT!~XGc_wZr5e^+<=X`V~jl`@Iy!lW{ZMiXK$<7FnaeT}89oLI5b-D1h-@ZKyPhOu{klqKiO)}g|h zvI&&c93o1$*W)_^wSad>5k45hENip=7C*Tx1?N~mi`ub*z=T3XplaH*+OpK^a;dGE z`iyx)4r}tv)hq-vn>yXeG=>ME%f&{+EE6+IDa>UIB-Le5<0)^oX1L0&Fi=%ECG(F0ZS=j~Fqo(W{)F2J?XzG8R58jx7 zw|*o_OBu%T&6ILuCBB(lEjx^|}OKTdvp3 z^>{hHoL-(!&rdI(K0kf_rJOJDoEFC#dKk71h6%8zMXNf5xnPzj0HlM!{M*bU%tHi%f}!7;orai)0cO@ z|Kt7RJF`42Rd}SG(IFa*CM~9Kp=uz23A=jb#>}4DB^b&i{xY zFlqMlqEKTSI^+AUNn$t=a->YJGK>~=*q{GwIP_opv30iJJV4vL{(t3pe9QTFhr*o< zv-#^ro$9yp)!}Vh{CODAdz*T`ZW9{+3cywE$1*Ke?>IPMik#I!P=gw(Prop0uTw+Z zIN=U=2VZwv3=S1PAUjmix08RHDIjCVZ76kE=su?LunxH=SloG4x!8?pg^0TZP#6&+ z9S+#X87Zj25!}t$t=KpPFqR36^+pUJ$QOy}{`l|yx=dTKAT|Z&G)PtqF&c9Bm@%T{%Z5}^Kn~g4ko1N%?HcGe%<5s4B+m;C1a%1| zmq!X`oL!)+kSPmD3Y8+YwrQGnyLPQrYwe}t+-M1&dnu#Wf7RGOPE9yJl$Z)n%pwAx zQGhj)4Z2f@v!cl$0v8(fX1Yu_qIgLw$vG;TH~Yu;VX)fQ!c%6n9f0gj17TtYJ2tTR z!s7P}j{o0#{M$L^?|9$As-*uKB8L9V+nH__eKMTOX?oV-B&4s|So0gM6E@Y#*MIFz zOtfVn4x~y_^*V9NKV`4rEsXNY?@~-yR?fv|G43QSkH*|81E5Oq0UT>m5E9Kfm@S-c z(u4d<-FIq^QlK7-5Y~ACuU2{w{iUPY>i~+R8f4PY(ECW@8~scEX)F)_mfsz5jw}%NCFEX_*5&EQe>6TKXLl;PFrT%i&1zk) z^}1Xx*URB_csV@1oW6cJeE#|Cr=OmF`p4&={_^tW=Q0Z~9>tl$`}z&+j>5-BS-_1< zXr|eu10pPqJb@{s!Y$?&8#@+WVX&H%0AgE&8J@Bvv$m-vSm;fW)D$pV3_AA9%Q~N^KP1U(=@9Jvxu@r zhlylL6g3Ens1iuUZsZ8LwedM%%7KFL+U*5ioOHavf%{E#$6`KLv{&2+5n}qS8&)C3 zC!%H*qN(uTI!TI09{>&&zb z7BiWZ-~{4*v~A1=$`m#Uhn7JJCF0-T%=af^X;AJzXqIhqjNQZS3EWSNpgBc%As#kk@tyf?oO8zS39J)*qe7Gx+Vk z6#L}2^3ZW(>rR?xGW`XD}Fig!|e!m#^=irG4C7r)8!bl)Xx_BRv&# z9cH`vJXp>=$U2%|sesVCaQl$?`SIO+dwyXQD|{I%NL{+9ZzWo9!WM%_mB%=jxRRW# zD`yuwXNGg;phvH=&N%YTZk+m2nFH_uw4qm{-@uATmhAf6R&?w&7y5>2wf(?1favaS zH)dj8e`Y=j$720ypqZvXQ$-7IWYcQZXTH?sdbylW=i~G7`T6km^Wn>`y~uUqxwZ+-dsXIb~UH_}uqE(LVg9P?KC zZt~3136*Q`_zJWf@}41f3oevy4gD(wn{MCOk!9P+(%H~1c=LM1vLrJ$&0}$mQI}gF zz+@YPo0$?yKNlhboMa=fK~#k31bezQp392&kB_X^MWPE?UHgU(&wzS4DSq8XyPdPL z4mlfOiPx3aR}8E*XC0Bq@#oD^Z#{0Nyz93_%k%oBVZt|IP-kY2p6$g zo7PraTUxzd&X?=ud^sI1hv%0sU!T8xefj*$^DqDO<)?r8^2^W1r^9mi)%0RU#n=j& zct<{FwS@^NRE-HNZ3!l&MmLBvddU^F;)_0NKtA`rXE@kvp!g5w+4z5*`>OQw^fD`c^RkX$#}k_ksQb=lyZJLY5{e%lAp ztBu~T<+@AbfnUjmNP1;WwopBO=n_?sZ%wKV!v6@|7zR8?J0km)+S! z_uR<0@P@BVCxzuyx>tE>Mg*%S#x|N*XOC>5UAw&|!_~?v(faq6F704>!3XE>hx z^IB7>eOg}!pMdTKhX|F{qln)FB;sDtF&~Xb1LQyr0HF*bCjCqtb$U(Vl z4e6#H)$eSYv$u-(ZFUzkdDv<>m9wFTecL*I)kW@cHNE_`<5Qm@%8F{NMl2e@CWji<&iS zT9;<14cDu+Yc;EWWJ0i38OE@}5VpMEjeCg=jz~LE2iCvqYC;Tclbr zY(2?Qzgo##zNuz}JL{cqZ2g|6{`yUf7P#q+Th7QUK=tHf`~D2K>872Mn~iM6^v@jC z4boTTgZtR7u94WkA$=sVFOSt5=jL?tF^0N%_L(KPZ;4`Ro*=S~)R`vS0sWEUL|*JQ zS}y?lmADOFZk`+y;%>HX*#G@fZ9XzyIDHl^2h(iQ{mT#-7n#-PXLgHcEBMbKpZkg+I~Q9!l5+ouQLwlx%&?MxsxZx;yDol2J2DdlR2~vq{GPaTgo#>4$xfk27PU**xD( ztQ2a@zSWqBz#6)1gQ=v=m%?Y*rUF-Z;*KJIV^wUd!OgG3lRUg6mSh56Lqr{t^_rL% zBB62T>vdVre5{J)-m{cF9P$dmxn1zKBc<-_kjwst0}RrPYMs#3T>p$&Ce%*1a`gEOd09%$R;5nHBy;oQy~%; zFjZ@&%jI-h{^|Mj^y%>B=ZD|@>Gb0tPal8WKfS+y|NGs;X}-TN_Yce6{p2hy*W6cC zRae||60I_mn3Iqdx)EO6?0N0L*HCj^cS(o6uv(wUh5KNbFb&BN$@lhq@7i22u&w>~ zf7CrvY^h33DGnpAO}h$0g0v~wGP&A15!PKGS*wo*5=|57vznL^gr_P+H3wT?*C0k z`(`AOKMYA^zZRCoKLdjIfW$H^fXY?=X&C=bX3C%xhwAYTc?&!B@7bP^jlI9)iDrRg zZCQx>9;C%w;iMUx+Hhd6_GcbV#<)=v$vQ`V<6E~P|4QSpd5~{j`2MmiO<|>*WXNba zI?ykS44cLuV!>ffU)!;_o5h%H%d~J~7?c>TtE&3)C#>rA+&Sn>9xnJKk=4F#WUc!C z*|sB$Zg^|5-md1p*>|+=s;CgF8qnvc=Nd6Hb(LewB0|C`FesXuLR$?fp{BK7uh+|R zJzoxo)8Xm#{Q2

378-EC2xufW-_T;0Gci0MEY|>>bwy z00!=>6cD~B;o!2Ik`e)fNTLjK=(h`yb248TG4hr`X;4WsW4w?lv+ z6dCxc0P)^`5MA8eToJBVPkA?2B+9`H1IMD=TtWYmCk%);Ea2({SlIrH1%vSPMA*xr zu%0>yj1I~d;S3THf;4mO`~aZT{|kC0Q8aaO^QtHm|3P)dV&I-w5ZHWh2@R0w{*b&p zv2HGU2v>Uq24N2ZJDAVs0|1VH017}g8=zeNu4?E52vEroc8KT$DD(kXB)fjy9su+H zFR%j20fj~R0|J5i{)Y>E)j(jFe?6=c;NtmTT-q3b%@ywae=*q!nY#i^jDMJ}l7Ks# zxdFMqs!0$;2oh+2!1iAtMW7*7UEmG~4TP%$))54S2#f0duGs-V4F5>_2V{)02Qb1= zh$s*JmmB~?^IsUiYtR#c1wmm@GEci!fc&SWu0#OuhI?LBzlb^*lAL;!IrRio5DAQ)`)+9i_^}mGZVB8!q za2F87s&B;-K>TN+{w3h=rh|ZmU|{gpydeU>{Lxn>lruu#%?ktQt1ypDcridE{U-?} zXSk;$NTNc79{8E-zkdew@IOl{A_0^XD7A?A-uw+G0RBfWm9)HEY!MicsIU+O%=yEo z5TMfk5$0wGcm8+Nh(N&rc3J_hNE18o`uD@ z0s52LEaU@FDgP0ptfQ~$igW`>fW;l}MfU(GoQHtxZD5W zR9%6=z|9?jf!m^-QCL4!pwIY%^d!U+x08?n@{cKa5 zu^3{xqxx%E1x)Z{-2|5;&;(agsbOO-Vj(vH(-@J}+jJqo^ii5x}405hC5Bi7K4T<%EV-O%&dpBDIyN;t9*3Hw=&7ED*8R2p@ zRj`W*g4vBxuJ&#|o^iN)VgUD_O4j$XMI-F63Mfx3+|>@Dch$xqa0vA_0|5KeQUFXJ zVfXhq00uX_mfZZGLjFztGiHOq%EfF~Q_-JM>yMCs25B&O0dn*jK!N=Y{yk+HdLl6L zZZ20@2Z4yvgoS5xtHHCnVBtAkuvmo6H3q0ClLiCm)QUBC>!YO&!273>jU7=~gdE)Y zswf}`Tl(TvRsCrtQ+Zo?jEpdxWPQ2IcN7r3hz5^i^;Hy98AWOu}3-5&@E`S|z< zq7Zh1c8)AhK^g#u*#FBSum%A%^$PlrP<90b67J=UWxq{mHZ s&{ru1MEu>HzHoO<%?AoVU+_lQD`DJRK={=frT`TXsijaUXA|=O0Z<79cmMzZ literal 0 HcmV?d00001 diff --git a/vendor/github.com/mattn/anko/ast/doc.go b/vendor/github.com/mattn/anko/ast/doc.go new file mode 100644 index 0000000000..8781cfc7d9 --- /dev/null +++ b/vendor/github.com/mattn/anko/ast/doc.go @@ -0,0 +1,2 @@ +// Package ast implements abstruct-syntax-tree for anko. +package ast diff --git a/vendor/github.com/mattn/anko/ast/expr.go b/vendor/github.com/mattn/anko/ast/expr.go new file mode 100644 index 0000000000..c43aac6dd5 --- /dev/null +++ b/vendor/github.com/mattn/anko/ast/expr.go @@ -0,0 +1,201 @@ +package ast + +// Expr provides all of interfaces for expression. +type Expr interface { + Pos + expr() +} + +// ExprImpl provide commonly implementations for Expr. +type ExprImpl struct { + PosImpl // ExprImpl provide Pos() function. +} + +// expr provide restraint interface. +func (x *ExprImpl) expr() {} + +// NumberExpr provide Number expression. +type NumberExpr struct { + ExprImpl + Lit string +} + +// StringExpr provide String expression. +type StringExpr struct { + ExprImpl + Lit string +} + +// ArrayExpr provide Array expression. +type ArrayExpr struct { + ExprImpl + Exprs []Expr +} + +// PairExpr provide one of Map key/value pair. +type PairExpr struct { + ExprImpl + Key string + Value Expr +} + +// MapExpr provide Map expression. +type MapExpr struct { + ExprImpl + MapExpr map[string]Expr +} + +// IdentExpr provide identity expression. +type IdentExpr struct { + ExprImpl + Lit string +} + +// UnaryExpr provide unary minus expression. ex: -1, ^1, ~1. +type UnaryExpr struct { + ExprImpl + Operator string + Expr Expr +} + +// AddrExpr provide referencing address expression. +type AddrExpr struct { + ExprImpl + Expr Expr +} + +// DerefExpr provide dereferencing address expression. +type DerefExpr struct { + ExprImpl + Expr Expr +} + +// ParenExpr provide parent block expression. +type ParenExpr struct { + ExprImpl + SubExpr Expr +} + +// BinOpExpr provide binary operator expression. +type BinOpExpr struct { + ExprImpl + Lhs Expr + Operator string + Rhs Expr +} + +type TernaryOpExpr struct { + ExprImpl + Expr Expr + Lhs Expr + Rhs Expr +} + +// CallExpr provide calling expression. +type CallExpr struct { + ExprImpl + Func interface{} + Name string + SubExprs []Expr + VarArg bool + Go bool +} + +// AnonCallExpr provide anonymous calling expression. ex: func(){}(). +type AnonCallExpr struct { + ExprImpl + Expr Expr + SubExprs []Expr + VarArg bool + Go bool +} + +// MemberExpr provide expression to refer menber. +type MemberExpr struct { + ExprImpl + Expr Expr + Name string +} + +// ItemExpr provide expression to refer Map/Array item. +type ItemExpr struct { + ExprImpl + Value Expr + Index Expr +} + +// SliceExpr provide expression to refer slice of Array. +type SliceExpr struct { + ExprImpl + Value Expr + Begin Expr + End Expr +} + +// FuncExpr provide function expression. +type FuncExpr struct { + ExprImpl + Name string + Stmts []Stmt + Args []string + VarArg bool +} + +// LetExpr provide expression to let variable. +type LetExpr struct { + ExprImpl + Lhs Expr + Rhs Expr +} + +// LetsExpr provide multiple expression of let. +type LetsExpr struct { + ExprImpl + Lhss []Expr + Operator string + Rhss []Expr +} + +// AssocExpr provide expression to assoc operation. +type AssocExpr struct { + ExprImpl + Lhs Expr + Operator string + Rhs Expr +} + +// NewExpr provide expression to make new instance. +type NewExpr struct { + ExprImpl + Name string + SubExprs []Expr +} + +// ConstExpr provide expression for constant variable. +type ConstExpr struct { + ExprImpl + Value string +} + +type ChanExpr struct { + ExprImpl + Lhs Expr + Rhs Expr +} + +type Type struct { + Name string +} + +type MakeChanExpr struct { + ExprImpl + Type string + SizeExpr Expr +} + +type MakeArrayExpr struct { + ExprImpl + Type string + LenExpr Expr + CapExpr Expr +} diff --git a/vendor/github.com/mattn/anko/ast/pos.go b/vendor/github.com/mattn/anko/ast/pos.go new file mode 100644 index 0000000000..5a0e470d92 --- /dev/null +++ b/vendor/github.com/mattn/anko/ast/pos.go @@ -0,0 +1,28 @@ +package ast + +// Position provides interface to store code locations. +type Position struct { + Line int + Column int +} + +// Pos interface provies two functions to get/set the position for expression or statement. +type Pos interface { + Position() Position + SetPosition(Position) +} + +// PosImpl provies commonly implementations for Pos. +type PosImpl struct { + pos Position +} + +// Position return the position of the expression or statement. +func (x *PosImpl) Position() Position { + return x.pos +} + +// SetPosition is a function to specify position of the expression or statement. +func (x *PosImpl) SetPosition(pos Position) { + x.pos = pos +} diff --git a/vendor/github.com/mattn/anko/ast/stmt.go b/vendor/github.com/mattn/anko/ast/stmt.go new file mode 100644 index 0000000000..14bbdf7174 --- /dev/null +++ b/vendor/github.com/mattn/anko/ast/stmt.go @@ -0,0 +1,127 @@ +package ast + +// Stmt provides all of interfaces for statement. +type Stmt interface { + Pos + stmt() +} + +// StmtImpl provide commonly implementations for Stmt.. +type StmtImpl struct { + PosImpl // StmtImpl provide Pos() function. +} + +// stmt provide restraint interface. +func (x *StmtImpl) stmt() {} + +// ExprStmt provide expression statement. +type ExprStmt struct { + StmtImpl + Expr Expr +} + +// IfStmt provide "if/else" statement. +type IfStmt struct { + StmtImpl + If Expr + Then []Stmt + ElseIf []Stmt // This is array of IfStmt + Else []Stmt +} + +// TryStmt provide "try/catch/finally" statement. +type TryStmt struct { + StmtImpl + Try []Stmt + Var string + Catch []Stmt + Finally []Stmt +} + +// ForStmt provide "for in" expression statement. +type ForStmt struct { + StmtImpl + Var string + Value Expr + Stmts []Stmt +} + +// CForStmt provide C-style "for (;;)" expression statement. +type CForStmt struct { + StmtImpl + Expr1 Expr + Expr2 Expr + Expr3 Expr + Stmts []Stmt +} + +// LoopStmt provide "for expr" expression statement. +type LoopStmt struct { + StmtImpl + Expr Expr + Stmts []Stmt +} + +// BreakStmt provide "break" expression statement. +type BreakStmt struct { + StmtImpl +} + +// ContinueStmt provide "continue" expression statement. +type ContinueStmt struct { + StmtImpl +} + +// ForStmt provide "return" expression statement. +type ReturnStmt struct { + StmtImpl + Exprs []Expr +} + +// ThrowStmt provide "throw" expression statement. +type ThrowStmt struct { + StmtImpl + Expr Expr +} + +// ModuleStmt provide "module" expression statement. +type ModuleStmt struct { + StmtImpl + Name string + Stmts []Stmt +} + +// VarStmt provide statement to let variables in current scope. +type VarStmt struct { + StmtImpl + Names []string + Exprs []Expr +} + +// SwitchStmt provide switch statement. +type SwitchStmt struct { + StmtImpl + Expr Expr + Cases []Stmt +} + +// CaseStmt provide switch/case statement. +type CaseStmt struct { + StmtImpl + Expr Expr + Stmts []Stmt +} + +// DefaultStmt provide switch/default statement. +type DefaultStmt struct { + StmtImpl + Stmts []Stmt +} + +// LetsStmt provide multiple statement of let. +type LetsStmt struct { + StmtImpl + Lhss []Expr + Operator string + Rhss []Expr +} diff --git a/vendor/github.com/mattn/anko/ast/token.go b/vendor/github.com/mattn/anko/ast/token.go new file mode 100644 index 0000000000..6b47cd0544 --- /dev/null +++ b/vendor/github.com/mattn/anko/ast/token.go @@ -0,0 +1,7 @@ +package ast + +type Token struct { + PosImpl // StmtImpl provide Pos() function. + Tok int + Lit string +} diff --git a/vendor/github.com/mattn/anko/builtins/core.go b/vendor/github.com/mattn/anko/builtins/core.go new file mode 100644 index 0000000000..4a82c6f89b --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/core.go @@ -0,0 +1,217 @@ +// Package core implements core interface for anko script. +package core + +import ( + "fmt" + "io/ioutil" + "os" + "reflect" + + "github.com/mattn/anko/parser" + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + env.Define("len", func(v interface{}) int64 { + rv := reflect.ValueOf(v) + if rv.Kind() == reflect.Interface { + rv = rv.Elem() + } + if rv.Kind() == reflect.String { + return int64(len([]byte(rv.String()))) + } + if rv.Kind() != reflect.Array && rv.Kind() != reflect.Slice { + panic("Argument #1 should be array") + } + return int64(rv.Len()) + }) + + env.Define("keys", func(v interface{}) []string { + rv := reflect.ValueOf(v) + if rv.Kind() == reflect.Interface { + rv = rv.Elem() + } + if rv.Kind() != reflect.Map { + panic("Argument #1 should be map") + } + keys := []string{} + mk := rv.MapKeys() + for _, key := range mk { + keys = append(keys, key.String()) + } + return keys + }) + + env.Define("range", func(args ...int64) []int64 { + if len(args) < 1 { + panic("Missing arguments") + } + if len(args) > 2 { + panic("Too many arguments") + } + var min, max int64 + if len(args) == 1 { + min = 0 + max = args[0] - 1 + } else { + min = args[0] + max = args[1] + } + arr := []int64{} + for i := min; i <= max; i++ { + arr = append(arr, i) + } + return arr + }) + + env.Define("toString", func(v interface{}) string { + if b, ok := v.([]byte); ok { + return string(b) + } + return fmt.Sprint(v) + }) + + env.Define("toInt", func(v interface{}) int64 { + nt := reflect.TypeOf(1) + rv := reflect.ValueOf(v) + if !rv.Type().ConvertibleTo(nt) { + return 0 + } + return rv.Convert(nt).Int() + }) + + env.Define("toFloat", func(v interface{}) float64 { + nt := reflect.TypeOf(1.0) + rv := reflect.ValueOf(v) + if !rv.Type().ConvertibleTo(nt) { + return 0.0 + } + return rv.Convert(nt).Float() + }) + + env.Define("toBool", func(v interface{}) bool { + nt := reflect.TypeOf(true) + rv := reflect.ValueOf(v) + if !rv.Type().ConvertibleTo(nt) { + return false + } + return rv.Convert(nt).Bool() + }) + + env.Define("toChar", func(s rune) string { + return string(s) + }) + + env.Define("toRune", func(s string) rune { + if len(s) == 0 { + return 0 + } + return []rune(s)[0] + }) + + env.Define("toByteSlice", func(s string) []byte { + return []byte(s) + }) + + env.Define("toRuneSlice", func(s string) []rune { + return []rune(s) + }) + + env.Define("toBoolSlice", func(v []interface{}) []bool { + var result []bool + toSlice(v, &result) + return result + }) + + env.Define("toFloatSlice", func(v []interface{}) []float64 { + var result []float64 + toSlice(v, &result) + return result + }) + + env.Define("toIntSlice", func(v []interface{}) []int64 { + var result []int64 + toSlice(v, &result) + return result + }) + + env.Define("toStringSlice", func(v []interface{}) []string { + var result []string + toSlice(v, &result) + return result + }) + + env.Define("typeOf", func(v interface{}) string { + return reflect.TypeOf(v).String() + }) + + env.Define("chanOf", func(t reflect.Type) reflect.Value { + return reflect.MakeChan(t, 1) + }) + + env.Define("defined", func(s string) bool { + _, err := env.Get(s) + return err == nil + }) + + env.Define("load", func(s string) interface{} { + body, err := ioutil.ReadFile(s) + if err != nil { + panic(err) + } + scanner := new(parser.Scanner) + scanner.Init(string(body)) + stmts, err := parser.Parse(scanner) + if err != nil { + if pe, ok := err.(*parser.Error); ok { + pe.Filename = s + panic(pe) + } + panic(err) + } + rv, err := vm.Run(stmts, env) + if err != nil { + panic(err) + } + if rv.IsValid() && rv.CanInterface() { + return rv.Interface() + } + return nil + }) + + env.Define("panic", func(e interface{}) { + os.Setenv("ANKO_DEBUG", "1") + panic(e) + }) + + env.Define("print", fmt.Print) + env.Define("println", fmt.Println) + env.Define("printf", fmt.Printf) + + env.DefineType("int64", int64(0)) + env.DefineType("float64", float64(0.0)) + env.DefineType("bool", true) + env.DefineType("string", "") + return env +} + +// toSlice takes in a "generic" slice and converts and copies +// it's elements into the typed slice pointed at by ptr. +// Note that this is a costly operation. +func toSlice(from []interface{}, ptr interface{}) { + // Value of the pointer to the target + obj := reflect.Indirect(reflect.ValueOf(ptr)) + // We can't just convert from interface{} to whatever the target is (diff memory layout), + // so we need to create a New slice of the proper type and copy the values individually + t := reflect.TypeOf(ptr).Elem() + slice := reflect.MakeSlice(t, len(from), len(from)) + // Copying the data, val is an adressable Pointer of the actual target type + val := reflect.Indirect(reflect.New(t.Elem())) + for i := 0; i < len(from); i++ { + v := reflect.ValueOf(from[i]) + val.Set(v) + slice.Index(i).Set(v) + } + // Ok now assign our slice to the target pointer + obj.Set(slice) +} diff --git a/vendor/github.com/mattn/anko/builtins/encoding/json/json.go b/vendor/github.com/mattn/anko/builtins/encoding/json/json.go new file mode 100644 index 0000000000..5d9f16327e --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/encoding/json/json.go @@ -0,0 +1,15 @@ +// Package json implements json interface for anko script. +package json + +import ( + "encoding/json" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("json") + m.Define("Marshal", json.Marshal) + m.Define("Unmarshal", json.Unmarshal) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/errors/errors.go b/vendor/github.com/mattn/anko/builtins/errors/errors.go new file mode 100644 index 0000000000..09da555e17 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/errors/errors.go @@ -0,0 +1,13 @@ +// Package errors implements errors interface for anko script. +package errors + +import ( + pkg "errors" + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewModule("errors") + m.Define("New", pkg.New) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/flag/flag.go b/vendor/github.com/mattn/anko/builtins/flag/flag.go new file mode 100644 index 0000000000..76fb9fb6d6 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/flag/flag.go @@ -0,0 +1,48 @@ +// Package flag implements flag interface for anko script. +package flag + +import ( + pkg "flag" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("flag") + m.Define("Arg", pkg.Arg) + m.Define("Args", pkg.Args) + m.Define("Bool", pkg.Bool) + m.Define("BoolVar", pkg.BoolVar) + m.Define("CommandLine", pkg.CommandLine) + m.Define("ContinueOnError", pkg.ContinueOnError) + m.Define("Duration", pkg.Duration) + m.Define("DurationVar", pkg.DurationVar) + m.Define("ErrHelp", pkg.ErrHelp) + m.Define("ExitOnError", pkg.ExitOnError) + m.Define("Float64", pkg.Float64) + m.Define("Float64Var", pkg.Float64Var) + m.Define("Int", pkg.Int) + m.Define("Int64", pkg.Int64) + m.Define("Int64Var", pkg.Int64Var) + m.Define("IntVar", pkg.IntVar) + m.Define("Lookup", pkg.Lookup) + m.Define("NArg", pkg.NArg) + m.Define("NFlag", pkg.NFlag) + m.Define("NewFlagSet", pkg.NewFlagSet) + m.Define("PanicOnError", pkg.PanicOnError) + m.Define("Parse", pkg.Parse) + m.Define("Parsed", pkg.Parsed) + m.Define("PrintDefaults", pkg.PrintDefaults) + m.Define("Set", pkg.Set) + m.Define("String", pkg.String) + m.Define("StringVar", pkg.StringVar) + m.Define("Uint", pkg.Uint) + m.Define("Uint64", pkg.Uint64) + m.Define("Uint64Var", pkg.Uint64Var) + m.Define("UintVar", pkg.UintVar) + m.Define("Usage", pkg.Usage) + m.Define("Var", pkg.Var) + m.Define("Visit", pkg.Visit) + m.Define("VisitAll", pkg.VisitAll) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/fmt/fmt.go b/vendor/github.com/mattn/anko/builtins/fmt/fmt.go new file mode 100644 index 0000000000..9ee526f790 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/fmt/fmt.go @@ -0,0 +1,32 @@ +// Package fmt implements json interface for anko script. +package fmt + +import ( + pkg "fmt" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("fmt") + m.Define("Errorf", pkg.Errorf) + m.Define("Fprint", pkg.Fprint) + m.Define("Fprintf", pkg.Fprintf) + m.Define("Fprintln", pkg.Fprintln) + m.Define("Fscan", pkg.Fscan) + m.Define("Fscanf", pkg.Fscanf) + m.Define("Fscanln", pkg.Fscanln) + m.Define("Print", pkg.Print) + m.Define("Printf", pkg.Printf) + m.Define("Println", pkg.Println) + m.Define("Scan", pkg.Scan) + m.Define("Scanf", pkg.Scanf) + m.Define("Scanln", pkg.Scanln) + m.Define("Sprint", pkg.Sprint) + m.Define("Sprintf", pkg.Sprintf) + m.Define("Sprintln", pkg.Sprintln) + m.Define("Sscan", pkg.Sscan) + m.Define("Sscanf", pkg.Sscanf) + m.Define("Sscanln", pkg.Sscanln) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext.go b/vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext.go new file mode 100644 index 0000000000..e7c3911bf0 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext.go @@ -0,0 +1,53 @@ +// +build !appengine + +// Package colortext implements terminal interface for anko script. +package colortext + +import ( + "github.com/daviddengcn/go-colortext" + "github.com/mattn/anko/vm" +) + +var ntoc = map[string]ct.Color{ + "none": ct.None, + "black": ct.Black, + "red": ct.Red, + "green": ct.Green, + "yellow": ct.Yellow, + "blue": ct.Blue, + "mazenta": ct.Magenta, + "cyan": ct.Cyan, + "white": ct.White, +} + +func colorOf(name string) ct.Color { + if c, ok := ntoc[name]; ok { + return c + } + return ct.None +} + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("ct") + + m.Define("ChangeColor", func(fg string, fa bool, rest ...interface{}) { + if len(rest) == 2 { + bg, ok := rest[0].(string) + if !ok { + panic("Argument #3 should be string") + } + ba, ok := rest[1].(bool) + if !ok { + panic("Argument #4 should be string") + } + ct.ChangeColor(colorOf(fg), fa, colorOf(bg), ba) + } else { + ct.ChangeColor(colorOf(fg), fa, ct.None, false) + } + }) + + m.Define("ResetColor", func() { + ct.ResetColor() + }) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext_appengine.go b/vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext_appengine.go new file mode 100644 index 0000000000..62b86542ba --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/github.com/daviddengcn/go-colortext/colortext_appengine.go @@ -0,0 +1,13 @@ +// +build appengine + +// Package colortext implements terminal interface for anko script. +package colortext + +import ( + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + panic("can't import 'github.com/daviddengcn/go-colortext'") + return nil +} diff --git a/vendor/github.com/mattn/anko/builtins/io/io.go b/vendor/github.com/mattn/anko/builtins/io/io.go new file mode 100644 index 0000000000..46c5dc2c9d --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/io/io.go @@ -0,0 +1,30 @@ +// Package io implements io interface for anko script. +package io + +import ( + pkg "io" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("io") + m.Define("Copy", pkg.Copy) + m.Define("CopyN", pkg.CopyN) + m.Define("EOF", pkg.EOF) + m.Define("ErrClosedPipe", pkg.ErrClosedPipe) + m.Define("ErrNoProgress", pkg.ErrNoProgress) + m.Define("ErrShortBuffer", pkg.ErrShortBuffer) + m.Define("ErrShortWrite", pkg.ErrShortWrite) + m.Define("ErrUnexpectedEOF", pkg.ErrUnexpectedEOF) + m.Define("LimitReader", pkg.LimitReader) + m.Define("MultiReader", pkg.MultiReader) + m.Define("MultiWriter", pkg.MultiWriter) + m.Define("NewSectionReader", pkg.NewSectionReader) + m.Define("Pipe", pkg.Pipe) + m.Define("ReadAtLeast", pkg.ReadAtLeast) + m.Define("ReadFull", pkg.ReadFull) + m.Define("TeeReader", pkg.TeeReader) + m.Define("WriteString", pkg.WriteString) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/io/ioutil/ioutil.go b/vendor/github.com/mattn/anko/builtins/io/ioutil/ioutil.go new file mode 100644 index 0000000000..ca67785665 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/io/ioutil/ioutil.go @@ -0,0 +1,17 @@ +// Package ioutil implements I/O interface for anko script. +package ioutil + +import ( + u "io/ioutil" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("iotuil") + m.Define("ReadAll", u.ReadAll) + m.Define("ReadDir", u.ReadDir) + m.Define("ReadFile", u.ReadFile) + m.Define("WriteFile", u.WriteFile) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/math/math.go b/vendor/github.com/mattn/anko/builtins/math/math.go new file mode 100644 index 0000000000..84fd1594ee --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/math/math.go @@ -0,0 +1,74 @@ +// Package math implements math interface for anko script. +package math + +import ( + t "math" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("math") + m.Define("Abs", t.Abs) + m.Define("Acos", t.Acos) + m.Define("Acosh", t.Acosh) + m.Define("Asin", t.Asin) + m.Define("Asinh", t.Asinh) + m.Define("Atan", t.Atan) + m.Define("Atan2", t.Atan2) + m.Define("Atanh", t.Atanh) + m.Define("Cbrt", t.Cbrt) + m.Define("Ceil", t.Ceil) + m.Define("Copysign", t.Copysign) + m.Define("Cos", t.Cos) + m.Define("Cosh", t.Cosh) + m.Define("Dim", t.Dim) + m.Define("Erf", t.Erf) + m.Define("Erfc", t.Erfc) + m.Define("Exp", t.Exp) + m.Define("Exp2", t.Exp2) + m.Define("Expm1", t.Expm1) + m.Define("Float32bits", t.Float32bits) + m.Define("Float32frombits", t.Float32frombits) + m.Define("Float64bits", t.Float64bits) + m.Define("Float64frombits", t.Float64frombits) + m.Define("Floor", t.Floor) + m.Define("Frexp", t.Frexp) + m.Define("Gamma", t.Gamma) + m.Define("Hypot", t.Hypot) + m.Define("Ilogb", t.Ilogb) + m.Define("Inf", t.Inf) + m.Define("IsInf", t.IsInf) + m.Define("IsNaN", t.IsNaN) + m.Define("J0", t.J0) + m.Define("J1", t.J1) + m.Define("Jn", t.Jn) + m.Define("Ldexp", t.Ldexp) + m.Define("Lgamma", t.Lgamma) + m.Define("Log", t.Log) + m.Define("Log10", t.Log10) + m.Define("Log1p", t.Log1p) + m.Define("Log2", t.Log2) + m.Define("Logb", t.Logb) + m.Define("Max", t.Max) + m.Define("Min", t.Min) + m.Define("Mod", t.Mod) + m.Define("Modf", t.Modf) + m.Define("NaN", t.NaN) + m.Define("Nextafter", t.Nextafter) + m.Define("Pow", t.Pow) + m.Define("Pow10", t.Pow10) + m.Define("Remainder", t.Remainder) + m.Define("Signbit", t.Signbit) + m.Define("Sin", t.Sin) + m.Define("Sincos", t.Sincos) + m.Define("Sinh", t.Sinh) + m.Define("Sqrt", t.Sqrt) + m.Define("Tan", t.Tan) + m.Define("Tanh", t.Tanh) + m.Define("Trunc", t.Trunc) + m.Define("Y0", t.Y0) + m.Define("Y1", t.Y1) + m.Define("Yn", t.Yn) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/math/rand/rand.go b/vendor/github.com/mattn/anko/builtins/math/rand/rand.go new file mode 100644 index 0000000000..0318fe680f --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/math/rand/rand.go @@ -0,0 +1,26 @@ +// Package rand implements math/rand interface for anko script. +package rand + +import ( + t "math/rand" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("rand") + m.Define("ExpFloat64", t.ExpFloat64) + m.Define("Float32", t.Float32) + m.Define("Float64", t.Float64) + m.Define("Int", t.Int) + m.Define("Int31", t.Int31) + m.Define("Int31n", t.Int31n) + m.Define("Int63", t.Int63) + m.Define("Int63n", t.Int63n) + m.Define("Intn", t.Intn) + m.Define("NormFloat64", t.NormFloat64) + m.Define("Perm", t.Perm) + m.Define("Seed", t.Seed) + m.Define("Uint32", t.Uint32) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/net/http/http.go b/vendor/github.com/mattn/anko/builtins/net/http/http.go new file mode 100644 index 0000000000..cd1fe952ea --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/net/http/http.go @@ -0,0 +1,40 @@ +// +build !appengine + +// Package http implements http interface for anko script. +package http + +import ( + "errors" + h "net/http" + "reflect" + + "github.com/mattn/anko/vm" +) + +type Client struct { + c *h.Client +} + +func (c *Client) Get(args ...reflect.Value) (reflect.Value, error) { + if len(args) < 1 { + return vm.NilValue, errors.New("Missing arguments") + } + if len(args) > 1 { + return vm.NilValue, errors.New("Too many arguments") + } + if args[0].Kind() != reflect.String { + return vm.NilValue, errors.New("Argument should be string") + } + res, err := h.Get(args[0].String()) + return reflect.ValueOf(res), err +} + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("http") + m.Define("DefaultClient", h.DefaultClient) + m.Define("NewServeMux", h.NewServeMux) + m.Define("Handle", h.Handle) + m.Define("HandleFunc", h.HandleFunc) + m.Define("ListenAndServe", h.ListenAndServe) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/net/http/http_appengine.go b/vendor/github.com/mattn/anko/builtins/net/http/http_appengine.go new file mode 100644 index 0000000000..45c8837811 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/net/http/http_appengine.go @@ -0,0 +1,13 @@ +// +build appengine + +// Package net implements http interface for anko script. +package net + +import ( + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + panic("can't import 'net/http'") + return nil +} diff --git a/vendor/github.com/mattn/anko/builtins/net/net.go b/vendor/github.com/mattn/anko/builtins/net/net.go new file mode 100644 index 0000000000..22e49f5502 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/net/net.go @@ -0,0 +1,76 @@ +// +build !appengine + +// Package net implements net interface for anko script. +package net + +import ( + pkg "net" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("net") + m.Define("CIDRMask", pkg.CIDRMask) + m.Define("Dial", pkg.Dial) + m.Define("DialIP", pkg.DialIP) + m.Define("DialTCP", pkg.DialTCP) + m.Define("DialTimeout", pkg.DialTimeout) + m.Define("DialUDP", pkg.DialUDP) + m.Define("DialUnix", pkg.DialUnix) + m.Define("ErrWriteToConnected", pkg.ErrWriteToConnected) + m.Define("FileConn", pkg.FileConn) + m.Define("FileListener", pkg.FileListener) + m.Define("FilePacketConn", pkg.FilePacketConn) + m.Define("FlagBroadcast", pkg.FlagBroadcast) + m.Define("FlagLoopback", pkg.FlagLoopback) + m.Define("FlagMulticast", pkg.FlagMulticast) + m.Define("FlagPointToPoint", pkg.FlagPointToPoint) + m.Define("FlagUp", pkg.FlagUp) + m.Define("IPv4", pkg.IPv4) + m.Define("IPv4Mask", pkg.IPv4Mask) + m.Define("IPv4allrouter", pkg.IPv4allrouter) + m.Define("IPv4allsys", pkg.IPv4allsys) + m.Define("IPv4bcast", pkg.IPv4bcast) + m.Define("IPv4len", pkg.IPv4len) + m.Define("IPv4zero", pkg.IPv4zero) + m.Define("IPv6interfacelocalallnodes", pkg.IPv6interfacelocalallnodes) + m.Define("IPv6len", pkg.IPv6len) + m.Define("IPv6linklocalallnodes", pkg.IPv6linklocalallnodes) + m.Define("IPv6linklocalallrouters", pkg.IPv6linklocalallrouters) + m.Define("IPv6loopback", pkg.IPv6loopback) + m.Define("IPv6unspecified", pkg.IPv6unspecified) + m.Define("IPv6zero", pkg.IPv6zero) + m.Define("InterfaceAddrs", pkg.InterfaceAddrs) + m.Define("InterfaceByIndex", pkg.InterfaceByIndex) + m.Define("InterfaceByName", pkg.InterfaceByName) + m.Define("Interfaces", pkg.Interfaces) + m.Define("JoinHostPort", pkg.JoinHostPort) + m.Define("Listen", pkg.Listen) + m.Define("ListenIP", pkg.ListenIP) + m.Define("ListenMulticastUDP", pkg.ListenMulticastUDP) + m.Define("ListenPacket", pkg.ListenPacket) + m.Define("ListenTCP", pkg.ListenTCP) + m.Define("ListenUDP", pkg.ListenUDP) + m.Define("ListenUnix", pkg.ListenUnix) + m.Define("ListenUnixgram", pkg.ListenUnixgram) + m.Define("LookupAddr", pkg.LookupAddr) + m.Define("LookupCNAME", pkg.LookupCNAME) + m.Define("LookupHost", pkg.LookupHost) + m.Define("LookupIP", pkg.LookupIP) + m.Define("LookupMX", pkg.LookupMX) + m.Define("LookupNS", pkg.LookupNS) + m.Define("LookupPort", pkg.LookupPort) + m.Define("LookupSRV", pkg.LookupSRV) + m.Define("LookupTXT", pkg.LookupTXT) + m.Define("ParseCIDR", pkg.ParseCIDR) + m.Define("ParseIP", pkg.ParseIP) + m.Define("ParseMAC", pkg.ParseMAC) + m.Define("Pipe", pkg.Pipe) + m.Define("ResolveIPAddr", pkg.ResolveIPAddr) + m.Define("ResolveTCPAddr", pkg.ResolveTCPAddr) + m.Define("ResolveUDPAddr", pkg.ResolveUDPAddr) + m.Define("ResolveUnixAddr", pkg.ResolveUnixAddr) + m.Define("SplitHostPort", pkg.SplitHostPort) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/net/net_appengine.go b/vendor/github.com/mattn/anko/builtins/net/net_appengine.go new file mode 100644 index 0000000000..48fefa095e --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/net/net_appengine.go @@ -0,0 +1,13 @@ +// +build appengine + +// Package net implements net interface for anko script. +package net + +import ( + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + panic("can't import 'net'") + return nil +} diff --git a/vendor/github.com/mattn/anko/builtins/net/url/url.go b/vendor/github.com/mattn/anko/builtins/net/url/url.go new file mode 100644 index 0000000000..3109c8b258 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/net/url/url.go @@ -0,0 +1,16 @@ +// +build !appengine + +// Package url implements url interface for anko script. +package url + +import ( + u "net/url" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("url") + m.Define("Parse", u.Parse) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/net/url/url_appengine.go b/vendor/github.com/mattn/anko/builtins/net/url/url_appengine.go new file mode 100644 index 0000000000..ea639e485c --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/net/url/url_appengine.go @@ -0,0 +1,13 @@ +// +build appengine + +// Package url implements url interface for anko script. +package url + +import ( + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + panic("can't import 'url'") + return nil +} diff --git a/vendor/github.com/mattn/anko/builtins/os/exec/exec.go b/vendor/github.com/mattn/anko/builtins/os/exec/exec.go new file mode 100644 index 0000000000..b05809d4c8 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/os/exec/exec.go @@ -0,0 +1,16 @@ +// Package exec implements os/exec interface for anko script. +package exec + +import ( + e "os/exec" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("exec") + m.Define("ErrNotFound", e.ErrNotFound) + m.Define("LookPath", e.LookPath) + m.Define("Command", e.Command) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/os/os.go b/vendor/github.com/mattn/anko/builtins/os/os.go new file mode 100644 index 0000000000..3318e2ecc7 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/os/os.go @@ -0,0 +1,102 @@ +// Package os implements os interface for anko script. +package os + +import ( + pkg "os" + "reflect" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("os") + m.Define("Args", pkg.Args) + m.Define("Chdir", pkg.Chdir) + m.Define("Chmod", pkg.Chmod) + m.Define("Chown", pkg.Chown) + m.Define("Chtimes", pkg.Chtimes) + m.Define("Clearenv", pkg.Clearenv) + m.Define("Create", pkg.Create) + m.Define("DevNull", pkg.DevNull) + m.Define("Environ", pkg.Environ) + m.Define("ErrExist", pkg.ErrExist) + m.Define("ErrInvalid", pkg.ErrInvalid) + m.Define("ErrNotExist", pkg.ErrNotExist) + m.Define("ErrPermission", pkg.ErrPermission) + m.Define("Exit", pkg.Exit) + m.Define("Expand", pkg.Expand) + m.Define("ExpandEnv", pkg.ExpandEnv) + m.Define("FindProcess", pkg.FindProcess) + m.Define("Getegid", pkg.Getegid) + m.Define("Getenv", pkg.Getenv) + m.Define("Geteuid", pkg.Geteuid) + m.Define("Getgid", pkg.Getgid) + m.Define("Getgroups", pkg.Getgroups) + m.Define("Getpagesize", pkg.Getpagesize) + m.Define("Getpid", pkg.Getpid) + handleAppEngine(m) + m.Define("Getuid", pkg.Getuid) + m.Define("Getwd", pkg.Getwd) + m.Define("Hostname", pkg.Hostname) + m.Define("Interrupt", pkg.Interrupt) + m.Define("IsExist", pkg.IsExist) + m.Define("IsNotExist", pkg.IsNotExist) + m.Define("IsPathSeparator", pkg.IsPathSeparator) + m.Define("IsPermission", pkg.IsPermission) + m.Define("Kill", pkg.Kill) + m.Define("Lchown", pkg.Lchown) + m.Define("Link", pkg.Link) + m.Define("Lstat", pkg.Lstat) + m.Define("Mkdir", pkg.Mkdir) + m.Define("MkdirAll", pkg.MkdirAll) + m.Define("ModeAppend", pkg.ModeAppend) + m.Define("ModeCharDevice", pkg.ModeCharDevice) + m.Define("ModeDevice", pkg.ModeDevice) + m.Define("ModeDir", pkg.ModeDir) + m.Define("ModeExclusive", pkg.ModeExclusive) + m.Define("ModeNamedPipe", pkg.ModeNamedPipe) + m.Define("ModePerm", pkg.ModePerm) + m.Define("ModeSetgid", pkg.ModeSetgid) + m.Define("ModeSetuid", pkg.ModeSetuid) + m.Define("ModeSocket", pkg.ModeSocket) + m.Define("ModeSticky", pkg.ModeSticky) + m.Define("ModeSymlink", pkg.ModeSymlink) + m.Define("ModeTemporary", pkg.ModeTemporary) + m.Define("ModeType", pkg.ModeType) + m.Define("NewFile", pkg.NewFile) + m.Define("NewSyscallError", pkg.NewSyscallError) + m.Define("O_APPEND", pkg.O_APPEND) + m.Define("O_CREATE", pkg.O_CREATE) + m.Define("O_EXCL", pkg.O_EXCL) + m.Define("O_RDONLY", pkg.O_RDONLY) + m.Define("O_RDWR", pkg.O_RDWR) + m.Define("O_SYNC", pkg.O_SYNC) + m.Define("O_TRUNC", pkg.O_TRUNC) + m.Define("O_WRONLY", pkg.O_WRONLY) + m.Define("Open", pkg.Open) + m.Define("OpenFile", pkg.OpenFile) + m.Define("PathListSeparator", pkg.PathListSeparator) + m.Define("PathSeparator", pkg.PathSeparator) + m.Define("Pipe", pkg.Pipe) + m.Define("Readlink", pkg.Readlink) + m.Define("Remove", pkg.Remove) + m.Define("RemoveAll", pkg.RemoveAll) + m.Define("Rename", pkg.Rename) + m.Define("SEEK_CUR", pkg.SEEK_CUR) + m.Define("SEEK_END", pkg.SEEK_END) + m.Define("SEEK_SET", pkg.SEEK_SET) + m.Define("SameFile", pkg.SameFile) + m.Define("Setenv", pkg.Setenv) + m.Define("StartProcess", pkg.StartProcess) + m.Define("Stat", pkg.Stat) + m.Define("Stderr", pkg.Stderr) + m.Define("Stdin", pkg.Stdin) + m.Define("Stdout", pkg.Stdout) + m.Define("Symlink", pkg.Symlink) + m.Define("TempDir", pkg.TempDir) + m.Define("Truncate", pkg.Truncate) + + var v pkg.Signal + m.DefineType("Signal", reflect.TypeOf(&v).Elem()) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/os/os_appengine.go b/vendor/github.com/mattn/anko/builtins/os/os_appengine.go new file mode 100644 index 0000000000..41371ae8ab --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/os/os_appengine.go @@ -0,0 +1,10 @@ +// +build appengine + +package os + +import ( + "github.com/mattn/anko/vm" +) + +func handleAppEngine(m *vm.Env) { +} diff --git a/vendor/github.com/mattn/anko/builtins/os/os_nonappengine.go b/vendor/github.com/mattn/anko/builtins/os/os_nonappengine.go new file mode 100644 index 0000000000..ce65a61439 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/os/os_nonappengine.go @@ -0,0 +1,13 @@ +// +build !appengine + +package os + +import ( + "github.com/mattn/anko/vm" + pkg "os" + "reflect" +) + +func handleAppEngine(m *vm.Env) { + m.Define("Getppid", reflect.ValueOf(pkg.Getppid)) +} diff --git a/vendor/github.com/mattn/anko/builtins/os/signal/signal.go b/vendor/github.com/mattn/anko/builtins/os/signal/signal.go new file mode 100644 index 0000000000..7aa59e3494 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/os/signal/signal.go @@ -0,0 +1,18 @@ +// Package signal implements signal interface for anko script. +package signal + +import ( + pkg "os/signal" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("os/signal") + + //m.Define("Ignore", pkg.Ignore) + m.Define("Notify", pkg.Notify) + //m.Define("Reset", pkg.Reset) + m.Define("Stop", pkg.Stop) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/path/filepath/filepath.go b/vendor/github.com/mattn/anko/builtins/path/filepath/filepath.go new file mode 100644 index 0000000000..9cedb5ed1c --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/path/filepath/filepath.go @@ -0,0 +1,32 @@ +// Package path implements path manipulation interface for anko script. +package filepath + +import ( + f "path/filepath" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("filepath") + m.Define("Join", f.Join) + m.Define("Clean", f.Join) + m.Define("Abs", f.Abs) + m.Define("Base", f.Base) + m.Define("Clean", f.Clean) + m.Define("Dir", f.Dir) + m.Define("EvalSymlinks", f.EvalSymlinks) + m.Define("Ext", f.Ext) + m.Define("FromSlash", f.FromSlash) + m.Define("Glob", f.Glob) + m.Define("HasPrefix", f.HasPrefix) + m.Define("IsAbs", f.IsAbs) + m.Define("Join", f.Join) + m.Define("Match", f.Match) + m.Define("Rel", f.Rel) + m.Define("Split", f.Split) + m.Define("SplitList", f.SplitList) + m.Define("ToSlash", f.ToSlash) + m.Define("VolumeName", f.VolumeName) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/path/path.go b/vendor/github.com/mattn/anko/builtins/path/path.go new file mode 100644 index 0000000000..2e7cd41e77 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/path/path.go @@ -0,0 +1,22 @@ +// Package path implements path interface for anko script. +package path + +import ( + pkg "path" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("path") + m.Define("Base", pkg.Base) + m.Define("Clean", pkg.Clean) + m.Define("Dir", pkg.Dir) + m.Define("ErrBadPattern", pkg.ErrBadPattern) + m.Define("Ext", pkg.Ext) + m.Define("IsAbs", pkg.IsAbs) + m.Define("Join", pkg.Join) + m.Define("Match", pkg.Match) + m.Define("Split", pkg.Split) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/regexp/regexp.go b/vendor/github.com/mattn/anko/builtins/regexp/regexp.go new file mode 100644 index 0000000000..8848a3ce3f --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/regexp/regexp.go @@ -0,0 +1,21 @@ +// Package regexp implements regexp interface for anko script. +package sort + +import ( + r "regexp" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("sort") + m.Define("Match", r.Match) + m.Define("MatchReader", r.MatchReader) + m.Define("MatchString", r.MatchString) + m.Define("QuoteMeta", r.QuoteMeta) + m.Define("Compile", r.Compile) + m.Define("CompilePOSIX", r.CompilePOSIX) + m.Define("MustCompile", r.MustCompile) + m.Define("MustCompilePOSIX", r.MustCompilePOSIX) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/runtime/runtime.go b/vendor/github.com/mattn/anko/builtins/runtime/runtime.go new file mode 100644 index 0000000000..29d7087c1c --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/runtime/runtime.go @@ -0,0 +1,45 @@ +// Package runtime implements runtime interface for anko script. +package runtime + +import ( + "github.com/mattn/anko/vm" + pkg "runtime" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewModule("runtime") + //m.Define("BlockProfile", pkg.BlockProfile) + //m.Define("Breakpoint", pkg.Breakpoint) + //m.Define("CPUProfile", pkg.CPUProfile) + //m.Define("Caller", pkg.Caller) + //m.Define("Callers", pkg.Callers) + //m.Define("CallersFrames", pkg.CallersFrames) + //m.Define("Compiler", pkg.Compiler) + //m.Define("FuncForPC", pkg.FuncForPC) + m.Define("GC", pkg.GC) + m.Define("GOARCH", pkg.GOARCH) + m.Define("GOMAXPROCS", pkg.GOMAXPROCS) + m.Define("GOOS", pkg.GOOS) + m.Define("GOROOT", pkg.GOROOT) + //m.Define("Goexit", pkg.Goexit) + //m.Define("GoroutineProfile", pkg.GoroutineProfile) + //m.Define("Gosched", pkg.Gosched) + //m.Define("LockOSThread", pkg.LockOSThread) + //m.Define("MemProfile", pkg.MemProfile) + //m.Define("MemProfileRate", pkg.MemProfileRate) + //m.Define("NumCPU", pkg.NumCPU) + //m.Define("NumCgoCall", pkg.NumCgoCall) + //m.Define("NumGoroutine", pkg.NumGoroutine) + //m.Define("ReadMemStats", pkg.ReadMemStats) + //m.Define("ReadTrace", pkg.ReadTrace) + //m.Define("SetBlockProfileRate", pkg.SetBlockProfileRate) + //m.Define("SetCPUProfileRate", pkg.SetCPUProfileRate) + //m.Define("SetFinalizer", pkg.SetFinalizer) + //m.Define("Stack", pkg.Stack) + //m.Define("StartTrace", pkg.StartTrace) + //m.Define("StopTrace", pkg.StopTrace) + //m.Define("ThreadCreateProfile", pkg.ThreadCreateProfile) + //m.Define("UnlockOSThread", pkg.UnlockOSThread) + //m.Define("Version", pkg.Version) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/sort/sort.go b/vendor/github.com/mattn/anko/builtins/sort/sort.go new file mode 100644 index 0000000000..72749d7221 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/sort/sort.go @@ -0,0 +1,43 @@ +// Package sort implements sort interface for anko script. +package sort + +import ( + s "sort" + + "github.com/mattn/anko/vm" +) + +type is []interface{} + +func (p is) Len() int { return len(p) } +func (p is) Less(i, j int) bool { return p[i].(int64) < p[j].(int64) } +func (p is) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type fs []interface{} + +func (p fs) Len() int { return len(p) } +func (p fs) Less(i, j int) bool { return p[i].(float64) < p[j].(float64) } +func (p fs) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type ss []interface{} + +func (p ss) Len() int { return len(p) } +func (p ss) Less(i, j int) bool { return p[i].(string) < p[j].(string) } +func (p ss) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("sort") + m.Define("Ints", func(ints []interface{}) []interface{} { + s.Sort(is(ints)) + return ints + }) + m.Define("Float64s", func(ints []interface{}) []interface{} { + s.Sort(is(ints)) + return ints + }) + m.Define("Strings", func(ints []interface{}) []interface{} { + s.Sort(is(ints)) + return ints + }) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/strings/strings.go b/vendor/github.com/mattn/anko/builtins/strings/strings.go new file mode 100644 index 0000000000..7adb3e9736 --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/strings/strings.go @@ -0,0 +1,56 @@ +// Package strings implements strings interface for anko script. +package strings + +import ( + pkg "strings" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("strings") + m.Define("Contains", pkg.Contains) + m.Define("ContainsAny", pkg.ContainsAny) + m.Define("ContainsRune", pkg.ContainsRune) + m.Define("Count", pkg.Count) + m.Define("EqualFold", pkg.EqualFold) + m.Define("Fields", pkg.Fields) + m.Define("FieldsFunc", pkg.FieldsFunc) + m.Define("HasPrefix", pkg.HasPrefix) + m.Define("HasSuffix", pkg.HasSuffix) + m.Define("Index", pkg.Index) + m.Define("IndexAny", pkg.IndexAny) + m.Define("IndexByte", pkg.IndexByte) + m.Define("IndexFunc", pkg.IndexFunc) + m.Define("IndexRune", pkg.IndexRune) + m.Define("Join", pkg.Join) + m.Define("LastIndex", pkg.LastIndex) + m.Define("LastIndexAny", pkg.LastIndexAny) + m.Define("LastIndexFunc", pkg.LastIndexFunc) + m.Define("Map", pkg.Map) + m.Define("NewReader", pkg.NewReader) + m.Define("NewReplacer", pkg.NewReplacer) + m.Define("Repeat", pkg.Repeat) + m.Define("Replace", pkg.Replace) + m.Define("Split", pkg.Split) + m.Define("SplitAfter", pkg.SplitAfter) + m.Define("SplitAfterN", pkg.SplitAfterN) + m.Define("SplitN", pkg.SplitN) + m.Define("Title", pkg.Title) + m.Define("ToLower", pkg.ToLower) + m.Define("ToLowerSpecial", pkg.ToLowerSpecial) + m.Define("ToTitle", pkg.ToTitle) + m.Define("ToTitleSpecial", pkg.ToTitleSpecial) + m.Define("ToUpper", pkg.ToUpper) + m.Define("ToUpperSpecial", pkg.ToUpperSpecial) + m.Define("Trim", pkg.Trim) + m.Define("TrimFunc", pkg.TrimFunc) + m.Define("TrimLeft", pkg.TrimLeft) + m.Define("TrimLeftFunc", pkg.TrimLeftFunc) + m.Define("TrimPrefix", pkg.TrimPrefix) + m.Define("TrimRight", pkg.TrimRight) + m.Define("TrimRightFunc", pkg.TrimRightFunc) + m.Define("TrimSpace", pkg.TrimSpace) + m.Define("TrimSuffix", pkg.TrimSuffix) + return m +} diff --git a/vendor/github.com/mattn/anko/builtins/time/time.go b/vendor/github.com/mattn/anko/builtins/time/time.go new file mode 100644 index 0000000000..6739d2e8ba --- /dev/null +++ b/vendor/github.com/mattn/anko/builtins/time/time.go @@ -0,0 +1,28 @@ +// Package time implements time interface for anko script. +package time + +import ( + t "time" + + "github.com/mattn/anko/vm" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewPackage("time") + m.Define("After", t.After) + m.Define("Sleep", t.Sleep) + m.Define("Tick", t.Tick) + m.Define("Since", t.Since) + m.Define("FixedZone", t.FixedZone) + m.Define("LoadLocation", t.LoadLocation) + m.Define("NewTicker", t.NewTicker) + m.Define("Date", t.Date) + m.Define("Now", t.Now) + m.Define("Parse", t.Parse) + m.Define("ParseDuration", t.ParseDuration) + m.Define("ParseInLocation", t.ParseInLocation) + m.Define("Unix", t.Unix) + m.Define("AfterFunc", t.AfterFunc) + m.Define("NewTimer", t.NewTimer) + return m +} diff --git a/vendor/github.com/mattn/anko/misc/vim/ftdetect/ank.vim b/vendor/github.com/mattn/anko/misc/vim/ftdetect/ank.vim new file mode 100644 index 0000000000..13bd684386 --- /dev/null +++ b/vendor/github.com/mattn/anko/misc/vim/ftdetect/ank.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.ank setlocal filetype=anko diff --git a/vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/comment.vim b/vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/comment.vim new file mode 100644 index 0000000000..35f52f9174 --- /dev/null +++ b/vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/comment.vim @@ -0,0 +1,11 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal comments=s1:# +setlocal commentstring=#\ %s + +let b:undo_ftplugin = "setl com< cms<" + +" vim:ts=4:sw=4:et diff --git a/vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/play.vim b/vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/play.vim new file mode 100644 index 0000000000..6da8751a04 --- /dev/null +++ b/vendor/github.com/mattn/anko/misc/vim/ftplugin/anko/play.vim @@ -0,0 +1,15 @@ +scriptencoding utf-8 + +function! s:play() + let code = join(getline(1, '$'), "\n") + let res = webapi#http#post("http://play-anko.appspot.com/api/play", {"code": code}) + if res.status == "200" + echo iconv(res.content, "utf-8", &encoding) + else + for line in split(res.content, "\n") + echohl Error | echomsg iconv(line, "utf-8", &encoding) | echohl None + endfor + endif +endfunction + +command! -buffer PlayAnko call s:play() diff --git a/vendor/github.com/mattn/anko/misc/vim/syntax/anko.vim b/vendor/github.com/mattn/anko/misc/vim/syntax/anko.vim new file mode 100644 index 0000000000..9be5c837d8 --- /dev/null +++ b/vendor/github.com/mattn/anko/misc/vim/syntax/anko.vim @@ -0,0 +1,100 @@ +if exists("b:current_syntax") + finish +endif + +syn case match + +syn keyword ankoDirective module +syn keyword ankoDeclaration var + +hi def link ankoDirective Statement +hi def link ankoDeclaration Type + +syn keyword ankoStatement return break continue throw +syn keyword ankoConditional if else switch try catch finally +syn keyword ankoLabel case default +syn keyword ankoRepeat for range + +hi def link ankoStatement Statement +hi def link ankoConditional Conditional +hi def link ankoLabel Label +hi def link ankoRepeat Repeat + +syn match ankoDeclaration /\/ +syn match ankoDeclaration /^func\>/ + +syn keyword ankoCast bytes runes string + +hi def link ankoCast Type + +syn keyword ankoBuiltins keys len +syn keyword ankoBuiltins println printf print +syn keyword ankoConstants true false nil + +hi def link ankoBuiltins Keyword +hi def link ankoConstants Keyword + +" Comments; their contents +syn keyword ankoTodo contained TODO FIXME XXX BUG +syn cluster ankoCommentGroup contains=ankoTodo +syn region ankoComment start="#" end="$" contains=@ankoCommentGroup,@Spell + +hi def link ankoComment Comment +hi def link ankoTodo Todo + +" anko escapes +syn match ankoEscapeOctal display contained "\\[0-7]\{3}" +syn match ankoEscapeC display contained +\\[abfnrtv\\'"]+ +syn match ankoEscapeX display contained "\\x\x\{2}" +syn match ankoEscapeU display contained "\\u\x\{4}" +syn match ankoEscapeBigU display contained "\\U\x\{8}" +syn match ankoEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ + +hi def link ankoEscapeOctal ankoSpecialString +hi def link ankoEscapeC ankoSpecialString +hi def link ankoEscapeX ankoSpecialString +hi def link ankoEscapeU ankoSpecialString +hi def link ankoEscapeBigU ankoSpecialString +hi def link ankoSpecialString Special +hi def link ankoEscapeError Error + +" Strings and their contents +syn cluster ankoStringGroup contains=ankoEscapeOctal,ankoEscapeC,ankoEscapeX,ankoEscapeU,ankoEscapeBigU,ankoEscapeError +syn region ankoString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@ankoStringGroup +syn region ankoRawString start=+`+ end=+`+ + +hi def link ankoString String +hi def link ankoRawString String + +" Characters; their contents +syn cluster ankoCharacterGroup contains=ankoEscapeOctal,ankoEscapeC,ankoEscapeX,ankoEscapeU,ankoEscapeBigU +syn region ankoCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@ankoCharacterGroup + +hi def link ankoCharacter Character + +" Regions +syn region ankoBlock start="{" end="}" transparent fold +syn region ankoParen start='(' end=')' transparent + +" Integers +syn match ankoDecimalInt "\<\d\+\([Ee]\d\+\)\?\>" +syn match ankoHexadecimalInt "\<0x\x\+\>" +syn match ankoOctalInt "\<0\o\+\>" +syn match ankoOctalError "\<0\o*[89]\d*\>" + +hi def link ankoDecimalInt Integer +hi def link ankoHexadecimalInt Integer +hi def link ankoOctalInt Integer +hi def link Integer Number + +" Floating point +syn match ankoFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match ankoFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match ankoFloat "\<\d\+[Ee][-+]\d\+\>" + +hi def link ankoFloat Float +hi def link ankoImaginary Number + +syn sync minlines=500 + +let b:current_syntax = "anko" diff --git a/vendor/github.com/mattn/anko/parser/Makefile b/vendor/github.com/mattn/anko/parser/Makefile new file mode 100644 index 0000000000..8b33e31724 --- /dev/null +++ b/vendor/github.com/mattn/anko/parser/Makefile @@ -0,0 +1,4 @@ +all : parser.go + +parser.go : parser.go.y + go tool yacc -o $@ parser.go.y diff --git a/vendor/github.com/mattn/anko/parser/lexer.go b/vendor/github.com/mattn/anko/parser/lexer.go new file mode 100644 index 0000000000..ea0fc49300 --- /dev/null +++ b/vendor/github.com/mattn/anko/parser/lexer.go @@ -0,0 +1,530 @@ +// Package parser implements parser for anko. +package parser + +import ( + "errors" + "fmt" + + "github.com/mattn/anko/ast" +) + +const ( + EOF = -1 // End of file. + EOL = '\n' // End of line. +) + +// Error provides a convenient interface for handling runtime error. +// It can be Error inteface with type cast which can call Pos(). +type Error struct { + Message string + Pos ast.Position + Filename string + Fatal bool +} + +// Error returns the error message. +func (e *Error) Error() string { + return e.Message +} + +// Scanner stores informations for lexer. +type Scanner struct { + src []rune + offset int + lineHead int + line int +} + +// opName is correction of operation names. +var opName = map[string]int{ + "func": FUNC, + "return": RETURN, + "var": VAR, + "throw": THROW, + "if": IF, + "for": FOR, + "break": BREAK, + "continue": CONTINUE, + "in": IN, + "else": ELSE, + "new": NEW, + "true": TRUE, + "false": FALSE, + "nil": NIL, + "module": MODULE, + "try": TRY, + "catch": CATCH, + "finally": FINALLY, + "switch": SWITCH, + "case": CASE, + "default": DEFAULT, + "go": GO, + "chan": CHAN, + "make": MAKE, +} + +// Init resets code to scan. +func (s *Scanner) Init(src string) { + s.src = []rune(src) +} + +// Scan analyses token, and decide identify or literals. +func (s *Scanner) Scan() (tok int, lit string, pos ast.Position, err error) { +retry: + s.skipBlank() + pos = s.pos() + switch ch := s.peek(); { + case isLetter(ch): + lit, err = s.scanIdentifier() + if err != nil { + return + } + if name, ok := opName[lit]; ok { + tok = name + } else { + tok = IDENT + } + case isDigit(ch): + tok = NUMBER + lit, err = s.scanNumber() + if err != nil { + return + } + case ch == '"': + tok = STRING + lit, err = s.scanString('"') + if err != nil { + return + } + case ch == '\'': + tok = STRING + lit, err = s.scanString('\'') + if err != nil { + return + } + case ch == '`': + tok = STRING + lit, err = s.scanRawString() + if err != nil { + return + } + default: + switch ch { + case EOF: + tok = EOF + case '#': + for !isEOL(s.peek()) { + s.next() + } + goto retry + case '!': + s.next() + switch s.peek() { + case '=': + tok = NEQ + lit = "!=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '=': + s.next() + switch s.peek() { + case '=': + tok = EQEQ + lit = "==" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '+': + s.next() + switch s.peek() { + case '+': + tok = PLUSPLUS + lit = "++" + case '=': + tok = PLUSEQ + lit = "+=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '-': + s.next() + switch s.peek() { + case '-': + tok = MINUSMINUS + lit = "--" + case '=': + tok = MINUSEQ + lit = "-=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '*': + s.next() + switch s.peek() { + case '*': + tok = POW + lit = "**" + case '=': + tok = MULEQ + lit = "*=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '/': + s.next() + switch s.peek() { + case '=': + tok = DIVEQ + lit = "/=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '>': + s.next() + switch s.peek() { + case '=': + tok = GE + lit = ">=" + case '>': + tok = SHIFTRIGHT + lit = ">>" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '<': + s.next() + switch s.peek() { + case '-': + tok = OPCHAN + lit = "<-" + case '=': + tok = LE + lit = "<=" + case '<': + tok = SHIFTLEFT + lit = "<<" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '|': + s.next() + switch s.peek() { + case '|': + tok = OROR + lit = "||" + case '=': + tok = OREQ + lit = "|=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '&': + s.next() + switch s.peek() { + case '&': + tok = ANDAND + lit = "&&" + case '=': + tok = ANDEQ + lit = "&=" + default: + s.back() + tok = int(ch) + lit = string(ch) + } + case '.': + s.next() + if s.peek() == '.' { + s.next() + if s.peek() == '.' { + tok = VARARG + } else { + err = fmt.Errorf(`syntax error "%s"`, "..") + return + } + } else { + s.back() + tok = int(ch) + lit = string(ch) + } + case '(', ')', ':', ';', '%', '?', '{', '}', ',', '[', ']', '^', '\n': + s.next() + if ch == '[' && s.peek() == ']' { + s.next() + if isLetter(s.peek()) { + s.back() + tok = ARRAYLIT + lit = "[]" + } else { + s.back() + s.back() + tok = int(ch) + lit = string(ch) + } + } else { + s.back() + tok = int(ch) + lit = string(ch) + } + default: + err = fmt.Errorf(`syntax error "%s"`, string(ch)) + return + } + s.next() + } + return +} + +// isLetter returns true if the rune is a letter for identity. +func isLetter(ch rune) bool { + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' +} + +// isDigit returns true if the rune is a number. +func isDigit(ch rune) bool { + return '0' <= ch && ch <= '9' +} + +// isHex returns true if the rune is a hex digits. +func isHex(ch rune) bool { + return ('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'f') || ('A' <= ch && ch <= 'F') +} + +// isEOL returns true if the rune is at end-of-line or end-of-file. +func isEOL(ch rune) bool { + return ch == '\n' || ch == -1 +} + +// isBlank returns true if the rune is empty character.. +func isBlank(ch rune) bool { + return ch == ' ' || ch == '\t' || ch == '\r' +} + +// peek returns current rune in the code. +func (s *Scanner) peek() rune { + if s.reachEOF() { + return EOF + } + return s.src[s.offset] +} + +// next moves offset to next. +func (s *Scanner) next() { + if !s.reachEOF() { + if s.peek() == '\n' { + s.lineHead = s.offset + 1 + s.line++ + } + s.offset++ + } +} + +// current returns the current offset. +func (s *Scanner) current() int { + return s.offset +} + +// offset sets the offset value. +func (s *Scanner) set(o int) { + s.offset = o +} + +// back moves back offset once to top. +func (s *Scanner) back() { + s.offset-- +} + +// reachEOF returns true if offset is at end-of-file. +func (s *Scanner) reachEOF() bool { + return len(s.src) <= s.offset +} + +// pos returns the position of current. +func (s *Scanner) pos() ast.Position { + return ast.Position{Line: s.line + 1, Column: s.offset - s.lineHead + 1} +} + +// skipBlank moves position into non-black character. +func (s *Scanner) skipBlank() { + for isBlank(s.peek()) { + s.next() + } +} + +// scanIdentifier returns identifier begining at current position. +func (s *Scanner) scanIdentifier() (string, error) { + var ret []rune + for { + if !isLetter(s.peek()) && !isDigit(s.peek()) { + break + } + ret = append(ret, s.peek()) + s.next() + } + return string(ret), nil +} + +// scanNumber returns number begining at current position. +func (s *Scanner) scanNumber() (string, error) { + var ret []rune + ch := s.peek() + ret = append(ret, ch) + s.next() + if ch == '0' && s.peek() == 'x' { + ret = append(ret, s.peek()) + s.next() + for isHex(s.peek()) { + ret = append(ret, s.peek()) + s.next() + } + } else { + for isDigit(s.peek()) || s.peek() == '.' { + ret = append(ret, s.peek()) + s.next() + } + if s.peek() == 'e' { + ret = append(ret, s.peek()) + s.next() + if isDigit(s.peek()) || s.peek() == '+' || s.peek() == '-' { + ret = append(ret, s.peek()) + s.next() + for isDigit(s.peek()) || s.peek() == '.' { + ret = append(ret, s.peek()) + s.next() + } + } + for isDigit(s.peek()) || s.peek() == '.' { + ret = append(ret, s.peek()) + s.next() + } + } + if isLetter(s.peek()) { + return "", errors.New("identifier starts immediately after numeric literal") + } + } + return string(ret), nil +} + +// scanRawString returns raw-string starting at current position. +func (s *Scanner) scanRawString() (string, error) { + var ret []rune + for { + s.next() + if s.peek() == EOF { + return "", errors.New("unexpected EOF") + break + } + if s.peek() == '`' { + s.next() + break + } + ret = append(ret, s.peek()) + } + return string(ret), nil +} + +// scanString returns string starting at current position. +// This handles backslash escaping. +func (s *Scanner) scanString(l rune) (string, error) { + var ret []rune +eos: + for { + s.next() + switch s.peek() { + case EOL: + return "", errors.New("unexpected EOL") + case EOF: + return "", errors.New("unexpected EOF") + case l: + s.next() + break eos + case '\\': + s.next() + switch s.peek() { + case 'b': + ret = append(ret, '\b') + continue + case 'f': + ret = append(ret, '\f') + continue + case 'r': + ret = append(ret, '\r') + continue + case 'n': + ret = append(ret, '\n') + continue + case 't': + ret = append(ret, '\t') + continue + } + ret = append(ret, s.peek()) + continue + default: + ret = append(ret, s.peek()) + } + } + return string(ret), nil +} + +// Lexer provides inteface to parse codes. +type Lexer struct { + s *Scanner + lit string + pos ast.Position + e error + stmts []ast.Stmt +} + +// Lex scans the token and literals. +func (l *Lexer) Lex(lval *yySymType) int { + tok, lit, pos, err := l.s.Scan() + if err != nil { + l.e = &Error{Message: fmt.Sprintf("%s", err.Error()), Pos: pos, Fatal: true} + } + lval.tok = ast.Token{Tok: tok, Lit: lit} + lval.tok.SetPosition(pos) + l.lit = lit + l.pos = pos + return tok +} + +// Error sets parse error. +func (l *Lexer) Error(msg string) { + l.e = &Error{Message: msg, Pos: l.pos, Fatal: false} +} + +// Parser provides way to parse the code using Scanner. +func Parse(s *Scanner) ([]ast.Stmt, error) { + l := Lexer{s: s} + if yyParse(&l) != 0 { + return nil, l.e + } + return l.stmts, l.e +} + +// ParserSrc provides way to parse the code from source. +func ParseSrc(src string) ([]ast.Stmt, error) { + scanner := &Scanner{ + src: []rune(src), + } + return Parse(scanner) +} diff --git a/vendor/github.com/mattn/anko/parser/parser.go b/vendor/github.com/mattn/anko/parser/parser.go new file mode 100644 index 0000000000..01f5adf689 --- /dev/null +++ b/vendor/github.com/mattn/anko/parser/parser.go @@ -0,0 +1,1997 @@ +//line parser.go.y:2 +package parser + +import __yyfmt__ "fmt" + +//line parser.go.y:2 +import ( + "github.com/mattn/anko/ast" +) + +//line parser.go.y:26 +type yySymType struct { + yys int + compstmt []ast.Stmt + stmt_if ast.Stmt + stmt_default ast.Stmt + stmt_case ast.Stmt + stmt_cases []ast.Stmt + stmts []ast.Stmt + stmt ast.Stmt + typ ast.Type + expr ast.Expr + exprs []ast.Expr + expr_many []ast.Expr + expr_lets ast.Expr + expr_pair ast.Expr + expr_pairs []ast.Expr + expr_idents []string + tok ast.Token + term ast.Token + terms ast.Token + opt_terms ast.Token +} + +const IDENT = 57346 +const NUMBER = 57347 +const STRING = 57348 +const ARRAY = 57349 +const VARARG = 57350 +const FUNC = 57351 +const RETURN = 57352 +const VAR = 57353 +const THROW = 57354 +const IF = 57355 +const ELSE = 57356 +const FOR = 57357 +const IN = 57358 +const EQEQ = 57359 +const NEQ = 57360 +const GE = 57361 +const LE = 57362 +const OROR = 57363 +const ANDAND = 57364 +const NEW = 57365 +const TRUE = 57366 +const FALSE = 57367 +const NIL = 57368 +const MODULE = 57369 +const TRY = 57370 +const CATCH = 57371 +const FINALLY = 57372 +const PLUSEQ = 57373 +const MINUSEQ = 57374 +const MULEQ = 57375 +const DIVEQ = 57376 +const ANDEQ = 57377 +const OREQ = 57378 +const BREAK = 57379 +const CONTINUE = 57380 +const PLUSPLUS = 57381 +const MINUSMINUS = 57382 +const POW = 57383 +const SHIFTLEFT = 57384 +const SHIFTRIGHT = 57385 +const SWITCH = 57386 +const CASE = 57387 +const DEFAULT = 57388 +const GO = 57389 +const CHAN = 57390 +const MAKE = 57391 +const OPCHAN = 57392 +const ARRAYLIT = 57393 +const UNARY = 57394 + +var yyToknames = [...]string{ + "$end", + "error", + "$unk", + "IDENT", + "NUMBER", + "STRING", + "ARRAY", + "VARARG", + "FUNC", + "RETURN", + "VAR", + "THROW", + "IF", + "ELSE", + "FOR", + "IN", + "EQEQ", + "NEQ", + "GE", + "LE", + "OROR", + "ANDAND", + "NEW", + "TRUE", + "FALSE", + "NIL", + "MODULE", + "TRY", + "CATCH", + "FINALLY", + "PLUSEQ", + "MINUSEQ", + "MULEQ", + "DIVEQ", + "ANDEQ", + "OREQ", + "BREAK", + "CONTINUE", + "PLUSPLUS", + "MINUSMINUS", + "POW", + "SHIFTLEFT", + "SHIFTRIGHT", + "SWITCH", + "CASE", + "DEFAULT", + "GO", + "CHAN", + "MAKE", + "OPCHAN", + "ARRAYLIT", + "'='", + "'?'", + "':'", + "','", + "'>'", + "'<'", + "'+'", + "'-'", + "'*'", + "'/'", + "'%'", + "UNARY", + "'{'", + "'}'", + "';'", + "'.'", + "'!'", + "'^'", + "'&'", + "'('", + "')'", + "'['", + "']'", + "'|'", + "'\\n'", +} +var yyStatenames = [...]string{} + +const yyEofCode = 1 +const yyErrCode = 2 +const yyInitialStackSize = 16 + +//line parser.go.y:705 + +//line yacctab:1 +var yyExca = [...]int{ + -1, 0, + 1, 3, + -2, 121, + -1, 1, + 1, -1, + -2, 0, + -1, 2, + 55, 48, + -2, 1, + -1, 10, + 55, 49, + -2, 24, + -1, 43, + 55, 48, + -2, 122, + -1, 85, + 65, 3, + -2, 121, + -1, 88, + 55, 49, + -2, 43, + -1, 90, + 65, 3, + -2, 121, + -1, 97, + 1, 57, + 8, 57, + 45, 57, + 46, 57, + 52, 57, + 54, 57, + 55, 57, + 64, 57, + 65, 57, + 66, 57, + 72, 57, + 74, 57, + 76, 57, + -2, 52, + -1, 99, + 1, 59, + 8, 59, + 45, 59, + 46, 59, + 52, 59, + 54, 59, + 55, 59, + 64, 59, + 65, 59, + 66, 59, + 72, 59, + 74, 59, + 76, 59, + -2, 52, + -1, 127, + 17, 0, + 18, 0, + -2, 85, + -1, 128, + 17, 0, + 18, 0, + -2, 86, + -1, 147, + 55, 49, + -2, 43, + -1, 149, + 65, 3, + -2, 121, + -1, 151, + 65, 3, + -2, 121, + -1, 153, + 65, 1, + -2, 36, + -1, 156, + 65, 3, + -2, 121, + -1, 178, + 65, 3, + -2, 121, + -1, 220, + 55, 50, + -2, 44, + -1, 221, + 1, 45, + 45, 45, + 46, 45, + 52, 45, + 55, 51, + 65, 45, + 66, 45, + 76, 45, + -2, 52, + -1, 228, + 1, 51, + 8, 51, + 45, 51, + 46, 51, + 55, 51, + 65, 51, + 66, 51, + 72, 51, + 74, 51, + 76, 51, + -2, 52, + -1, 230, + 65, 3, + -2, 121, + -1, 232, + 65, 3, + -2, 121, + -1, 245, + 65, 3, + -2, 121, + -1, 256, + 1, 106, + 8, 106, + 45, 106, + 46, 106, + 52, 106, + 54, 106, + 55, 106, + 64, 106, + 65, 106, + 66, 106, + 72, 106, + 74, 106, + 76, 106, + -2, 104, + -1, 258, + 1, 110, + 8, 110, + 45, 110, + 46, 110, + 52, 110, + 54, 110, + 55, 110, + 64, 110, + 65, 110, + 66, 110, + 72, 110, + 74, 110, + 76, 110, + -2, 108, + -1, 269, + 65, 3, + -2, 121, + -1, 274, + 65, 3, + -2, 121, + -1, 275, + 65, 3, + -2, 121, + -1, 280, + 1, 105, + 8, 105, + 45, 105, + 46, 105, + 52, 105, + 54, 105, + 55, 105, + 64, 105, + 65, 105, + 66, 105, + 72, 105, + 74, 105, + 76, 105, + -2, 103, + -1, 281, + 1, 109, + 8, 109, + 45, 109, + 46, 109, + 52, 109, + 54, 109, + 55, 109, + 64, 109, + 65, 109, + 66, 109, + 72, 109, + 74, 109, + 76, 109, + -2, 107, + -1, 287, + 65, 3, + -2, 121, + -1, 288, + 65, 3, + -2, 121, + -1, 291, + 45, 3, + 46, 3, + 65, 3, + -2, 121, + -1, 295, + 65, 3, + -2, 121, + -1, 302, + 45, 3, + 46, 3, + 65, 3, + -2, 121, + -1, 315, + 65, 3, + -2, 121, + -1, 316, + 65, 3, + -2, 121, +} + +const yyNprod = 127 +const yyPrivate = 57344 + +var yyTokenNames []string +var yyStates []string + +const yyLast = 2223 + +var yyAct = [...]int{ + + 81, 169, 237, 10, 217, 238, 45, 6, 92, 211, + 93, 2, 1, 250, 281, 42, 82, 7, 209, 88, + 6, 91, 280, 276, 94, 95, 96, 98, 100, 6, + 7, 11, 40, 154, 246, 173, 105, 93, 108, 7, + 110, 243, 112, 225, 10, 103, 104, 80, 116, 117, + 89, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 102, 172, 139, 140, 141, 142, 166, 144, 145, + 147, 257, 64, 65, 66, 67, 68, 69, 92, 109, + 93, 155, 55, 261, 161, 255, 148, 153, 152, 115, + 115, 78, 199, 158, 320, 259, 182, 262, 164, 143, + 260, 146, 319, 254, 312, 147, 247, 205, 49, 259, + 309, 74, 76, 177, 77, 160, 72, 180, 148, 170, + 239, 240, 268, 308, 305, 304, 167, 301, 101, 292, + 286, 285, 148, 263, 252, 258, 179, 234, 231, 148, + 236, 188, 316, 148, 10, 192, 193, 229, 147, 256, + 186, 196, 187, 315, 189, 190, 200, 150, 295, 194, + 183, 198, 288, 207, 275, 274, 245, 149, 220, 210, + 212, 219, 224, 90, 148, 111, 226, 227, 279, 195, + 114, 222, 269, 115, 271, 213, 175, 157, 79, 176, + 8, 241, 314, 244, 242, 214, 215, 216, 239, 240, + 5, 310, 235, 84, 253, 44, 248, 206, 151, 170, + 282, 249, 223, 251, 218, 208, 204, 203, 165, 118, + 106, 83, 46, 4, 267, 168, 87, 43, 197, 17, + 270, 3, 0, 265, 113, 266, 0, 0, 0, 0, + 227, 0, 0, 278, 44, 61, 63, 0, 273, 0, + 0, 0, 283, 284, 0, 0, 0, 64, 65, 66, + 67, 68, 69, 0, 0, 70, 71, 55, 56, 57, + 0, 0, 289, 291, 0, 0, 78, 293, 294, 0, + 0, 0, 60, 62, 50, 51, 52, 53, 54, 307, + 299, 300, 302, 49, 303, 0, 74, 76, 306, 77, + 0, 72, 0, 0, 0, 311, 58, 59, 61, 63, + 73, 75, 0, 0, 0, 0, 0, 0, 317, 318, + 64, 65, 66, 67, 68, 69, 0, 0, 70, 71, + 55, 56, 57, 0, 0, 0, 0, 0, 0, 78, + 0, 0, 48, 0, 298, 60, 62, 50, 51, 52, + 53, 54, 0, 0, 0, 0, 49, 0, 0, 74, + 76, 297, 77, 0, 72, 58, 59, 61, 63, 73, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 65, 66, 67, 68, 69, 0, 0, 70, 71, 55, + 56, 57, 0, 0, 0, 0, 0, 0, 78, 0, + 0, 48, 202, 0, 60, 62, 50, 51, 52, 53, + 54, 0, 0, 0, 0, 49, 0, 0, 74, 76, + 0, 77, 201, 72, 58, 59, 61, 63, 73, 75, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 71, 55, 56, + 57, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 48, 185, 0, 60, 62, 50, 51, 52, 53, 54, + 0, 0, 0, 0, 49, 0, 0, 74, 76, 0, + 77, 184, 72, 58, 59, 61, 63, 73, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 65, 66, + 67, 68, 69, 0, 0, 70, 71, 55, 56, 57, + 0, 0, 0, 0, 0, 0, 78, 0, 0, 48, + 0, 0, 60, 62, 50, 51, 52, 53, 54, 0, + 0, 0, 0, 49, 0, 0, 74, 76, 313, 77, + 0, 72, 58, 59, 61, 63, 73, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 71, 55, 56, 57, 0, + 0, 0, 0, 0, 0, 78, 0, 0, 48, 0, + 0, 60, 62, 50, 51, 52, 53, 54, 0, 0, + 0, 0, 49, 0, 0, 74, 76, 296, 77, 0, + 72, 58, 59, 61, 63, 73, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, + 69, 0, 0, 70, 71, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 48, 290, 0, + 60, 62, 50, 51, 52, 53, 54, 0, 0, 0, + 0, 49, 0, 0, 74, 76, 0, 77, 0, 72, + 58, 59, 61, 63, 73, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 48, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 287, 0, 0, + 49, 0, 0, 74, 76, 0, 77, 0, 72, 58, + 59, 61, 63, 73, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 65, 66, 67, 68, 69, 0, + 0, 70, 71, 55, 56, 57, 0, 0, 0, 0, + 0, 0, 78, 0, 0, 48, 0, 0, 60, 62, + 50, 51, 52, 53, 54, 0, 0, 0, 0, 49, + 0, 0, 74, 76, 0, 77, 272, 72, 58, 59, + 61, 63, 73, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 67, 68, 69, 0, 0, + 70, 71, 55, 56, 57, 0, 0, 0, 0, 0, + 0, 78, 0, 0, 48, 0, 0, 60, 62, 50, + 51, 52, 53, 54, 0, 0, 0, 0, 49, 0, + 0, 74, 76, 0, 77, 264, 72, 58, 59, 61, + 63, 73, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 64, 65, 66, 67, 68, 69, 0, 0, 70, + 71, 55, 56, 57, 0, 0, 0, 0, 0, 0, + 78, 0, 0, 48, 0, 0, 60, 62, 50, 51, + 52, 53, 54, 0, 0, 0, 233, 49, 0, 0, + 74, 76, 0, 77, 0, 72, 58, 59, 61, 63, + 73, 75, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 65, 66, 67, 68, 69, 0, 0, 70, 71, + 55, 56, 57, 0, 0, 0, 0, 0, 0, 78, + 0, 0, 48, 0, 0, 60, 62, 50, 51, 52, + 53, 54, 0, 232, 0, 0, 49, 0, 0, 74, + 76, 0, 77, 0, 72, 58, 59, 61, 63, 73, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 64, + 65, 66, 67, 68, 69, 0, 0, 70, 71, 55, + 56, 57, 0, 0, 0, 0, 0, 0, 78, 0, + 0, 48, 0, 0, 60, 62, 50, 51, 52, 53, + 54, 0, 230, 0, 0, 49, 0, 0, 74, 76, + 0, 77, 0, 72, 58, 59, 61, 63, 73, 75, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 71, 55, 56, + 57, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 48, 181, 0, 60, 62, 50, 51, 52, 53, 54, + 0, 0, 0, 0, 49, 0, 0, 74, 76, 0, + 77, 0, 72, 58, 59, 61, 63, 73, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 65, 66, + 67, 68, 69, 0, 0, 70, 71, 55, 56, 57, + 0, 0, 0, 0, 0, 0, 78, 0, 0, 48, + 0, 0, 60, 62, 50, 51, 52, 53, 54, 0, + 178, 0, 0, 49, 0, 0, 74, 76, 0, 77, + 0, 72, 58, 59, 61, 63, 73, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 71, 55, 56, 57, 0, + 0, 0, 0, 0, 0, 78, 0, 0, 48, 0, + 0, 60, 62, 50, 51, 52, 53, 54, 0, 0, + 0, 0, 49, 0, 0, 74, 76, 171, 77, 0, + 72, 58, 59, 61, 63, 73, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, + 69, 0, 0, 70, 71, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 48, 0, 0, + 60, 62, 50, 51, 52, 53, 54, 0, 159, 0, + 0, 49, 0, 0, 74, 76, 0, 77, 0, 72, + 58, 59, 61, 63, 73, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 48, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 156, 0, 0, + 49, 0, 0, 74, 76, 0, 77, 0, 72, 21, + 22, 28, 0, 0, 32, 14, 9, 15, 41, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 36, 29, + 30, 31, 16, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 0, 0, 0, 0, 0, 20, + 0, 0, 37, 0, 38, 39, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 27, 0, 0, 0, 34, + 0, 6, 0, 24, 25, 26, 35, 0, 33, 0, + 0, 7, 58, 59, 61, 63, 73, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, + 68, 69, 0, 0, 70, 71, 55, 56, 57, 0, + 0, 0, 0, 0, 0, 78, 0, 47, 48, 0, + 0, 60, 62, 50, 51, 52, 53, 54, 0, 0, + 0, 0, 49, 0, 0, 74, 76, 0, 77, 0, + 72, 58, 59, 61, 63, 73, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, + 69, 0, 0, 70, 71, 55, 56, 57, 0, 0, + 0, 0, 0, 0, 78, 0, 0, 48, 0, 0, + 60, 62, 50, 51, 52, 53, 54, 0, 0, 0, + 0, 49, 0, 0, 74, 76, 0, 77, 0, 72, + 58, 59, 61, 63, 73, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 48, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 0, 0, 0, + 49, 0, 0, 74, 174, 0, 77, 0, 72, 58, + 59, 61, 63, 73, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 64, 65, 66, 67, 68, 69, 0, + 0, 70, 71, 55, 56, 57, 0, 0, 0, 0, + 0, 0, 78, 0, 0, 48, 0, 0, 60, 62, + 50, 51, 52, 53, 54, 0, 0, 0, 0, 163, + 0, 0, 74, 76, 0, 77, 0, 72, 58, 59, + 61, 63, 73, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 65, 66, 67, 68, 69, 0, 0, + 70, 71, 55, 56, 57, 0, 0, 0, 0, 0, + 0, 78, 0, 0, 48, 0, 0, 60, 62, 50, + 51, 52, 53, 54, 58, 59, 61, 63, 162, 75, + 0, 74, 76, 0, 77, 0, 72, 0, 64, 65, + 66, 67, 68, 69, 0, 0, 70, 71, 55, 56, + 57, 0, 0, 0, 0, 0, 0, 78, 0, 0, + 0, 0, 0, 60, 62, 50, 51, 52, 53, 54, + 58, 59, 61, 63, 49, 0, 0, 74, 76, 0, + 77, 0, 72, 0, 64, 65, 66, 67, 68, 69, + 0, 0, 70, 71, 55, 56, 57, 0, 0, 0, + 0, 0, 0, 78, 0, 0, 0, 0, 0, 60, + 62, 50, 51, 52, 53, 54, 0, 0, 0, 0, + 49, 0, 0, 74, 76, 0, 77, 0, 72, 21, + 22, 191, 0, 0, 32, 14, 9, 15, 41, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 36, 29, + 30, 31, 16, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 0, 0, 0, 0, 0, 20, + 0, 0, 37, 0, 38, 39, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 27, 0, 0, 0, 34, + 0, 0, 0, 24, 25, 26, 35, 0, 33, 21, + 22, 28, 0, 0, 32, 14, 9, 15, 41, 0, + 18, 0, 0, 0, 0, 0, 0, 0, 36, 29, + 30, 31, 16, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 0, 0, 0, 0, 0, 20, + 0, 0, 37, 0, 38, 39, 0, 0, 64, 65, + 66, 67, 68, 69, 23, 27, 70, 71, 55, 34, + 0, 0, 0, 24, 25, 26, 35, 78, 33, 0, + 0, 0, 0, 0, 0, 50, 51, 52, 53, 54, + 228, 22, 28, 0, 49, 32, 0, 74, 76, 0, + 77, 0, 72, 0, 0, 0, 0, 0, 0, 36, + 29, 30, 31, 0, 0, 0, 0, 0, 21, 22, + 28, 0, 0, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 37, 0, 38, 39, 36, 29, 30, + 31, 0, 0, 0, 0, 23, 27, 228, 22, 28, + 34, 0, 32, 0, 24, 25, 26, 35, 0, 33, + 277, 37, 0, 38, 39, 0, 36, 29, 30, 31, + 0, 0, 0, 23, 27, 221, 22, 28, 34, 0, + 32, 0, 24, 25, 26, 35, 0, 33, 0, 0, + 37, 0, 38, 39, 36, 29, 30, 31, 0, 0, + 0, 0, 23, 27, 107, 22, 28, 34, 0, 32, + 0, 24, 25, 26, 35, 0, 33, 0, 37, 0, + 38, 39, 0, 36, 29, 30, 31, 0, 0, 0, + 23, 27, 99, 22, 28, 34, 0, 32, 0, 24, + 25, 26, 35, 0, 33, 0, 0, 37, 0, 38, + 39, 36, 29, 30, 31, 0, 0, 0, 0, 23, + 27, 97, 22, 28, 34, 0, 32, 0, 24, 25, + 26, 35, 0, 33, 0, 37, 0, 38, 39, 0, + 36, 29, 30, 31, 0, 0, 0, 23, 27, 86, + 22, 28, 34, 0, 32, 0, 24, 25, 26, 35, + 0, 33, 0, 0, 37, 0, 38, 39, 36, 29, + 30, 31, 0, 0, 0, 0, 23, 27, 0, 0, + 0, 34, 0, 0, 0, 24, 25, 26, 35, 0, + 33, 0, 37, 0, 38, 39, 0, 0, 64, 65, + 66, 67, 68, 69, 23, 27, 0, 0, 55, 85, + 0, 0, 0, 24, 25, 26, 35, 78, 33, 0, + 0, 0, 0, 0, 0, 0, 0, 52, 53, 54, + 0, 0, 0, 0, 49, 0, 0, 74, 76, 0, + 77, 0, 72, +} +var yyPact = [...]int{ + + -59, -1000, 1845, -59, -59, -1000, -1000, -1000, -1000, 228, + 1375, 146, -1000, -1000, 1954, 1954, 227, 199, 2125, 119, + 1954, -63, -1000, 1954, 1954, 1954, 2097, 2068, -1000, -1000, + -1000, -1000, 67, -59, -59, 1954, 226, 2040, 18, 1954, + 130, 1954, -1000, 1315, -1000, 138, -1000, 1954, 1954, 225, + 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, + 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, + -1000, -1000, 1954, 1954, 1954, 1954, 1954, 1954, 1954, 1954, + 129, 1434, 1434, 113, 154, -59, 17, 25, 1243, 145, + -59, 1184, 1954, 1954, 51, 51, 51, -63, 1611, -63, + 1552, 224, 6, 1954, 213, 1125, 1, -36, 1493, 148, + 1434, -59, 1066, -1000, 1954, -59, 1434, 1007, -1000, 2147, + 2147, 51, 51, 51, 1434, 1867, 1867, 236, 236, 1867, + 1867, 1867, 1867, 1434, 1434, 1434, 1434, 1434, 1434, 1434, + 1657, 1434, 1703, 98, 417, 1434, -1000, 1434, -59, -59, + 1954, -59, 100, 1775, 1954, 1954, -59, 1954, 96, -59, + 94, 358, 223, 222, 45, 209, 221, -37, -46, -1000, + 141, -1000, 1954, 1954, 1954, 220, 220, 2011, -59, -1000, + 218, 1954, -29, -1000, -1000, 1954, 1983, 92, 948, 83, + -1000, 141, 889, 830, 82, -1000, 183, 85, 163, -31, + -1000, -1000, 1954, -1000, -1000, 112, -38, 44, 208, -59, + -61, -59, 79, 1954, 41, 87, 73, 38, -1000, 52, + 1434, -63, 78, -1000, 1434, -1000, 771, 1434, -63, -1000, + -59, -1000, -59, 1954, -1000, 128, -1000, -1000, -1000, 1954, + 140, -1000, -1000, -1000, 712, -59, 111, 110, -49, 1926, + -1000, 123, -1000, 1434, -1000, -50, -1000, -58, -1000, 216, + -1000, 1954, 1954, -1000, -1000, 76, 75, 653, 108, -59, + 594, -59, -1000, 74, -59, -59, 104, -1000, -1000, -1000, + -1000, -1000, -1000, 535, 299, -1000, -1000, -59, -59, 72, + -59, -59, -1000, 70, 69, -59, -1000, -1000, 1954, 68, + 55, 181, -59, -1000, -1000, -1000, 49, 476, -1000, 172, + 99, -1000, -1000, -1000, 88, -59, -59, 47, 39, -1000, + -1000, +} +var yyPgo = [...]int{ + + 0, 12, 241, 200, 239, 5, 2, 238, 4, 0, + 32, 31, 236, 1, 235, 6, 11, 233, 210, +} +var yyR1 = [...]int{ + + 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 7, 7, + 7, 7, 7, 6, 5, 13, 14, 14, 14, 15, + 15, 15, 12, 11, 11, 11, 8, 8, 10, 10, + 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 16, 16, 17, 17, 18, 18, +} +var yyR2 = [...]int{ + + 0, 1, 2, 0, 2, 3, 4, 3, 3, 1, + 1, 2, 2, 5, 1, 4, 7, 9, 5, 13, + 12, 9, 8, 5, 1, 7, 5, 5, 0, 2, + 2, 2, 2, 5, 4, 3, 0, 1, 4, 0, + 1, 4, 3, 1, 4, 4, 1, 3, 0, 1, + 4, 4, 1, 1, 2, 2, 2, 2, 4, 2, + 4, 1, 1, 1, 1, 5, 3, 7, 8, 8, + 9, 5, 6, 5, 6, 3, 5, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, + 3, 3, 3, 5, 4, 6, 5, 5, 4, 6, + 5, 4, 4, 6, 6, 5, 7, 7, 9, 3, + 2, 0, 1, 1, 2, 1, 1, +} +var yyChk = [...]int{ + + -1000, -1, -16, -2, -17, -18, 66, 76, -3, 11, + -9, -11, 37, 38, 10, 12, 27, -4, 15, 28, + 44, 4, 5, 59, 68, 69, 70, 60, 6, 24, + 25, 26, 9, 73, 64, 71, 23, 47, 49, 50, + -10, 13, -16, -17, -18, -15, 4, 52, 53, 67, + 58, 59, 60, 61, 62, 41, 42, 43, 17, 18, + 56, 19, 57, 20, 31, 32, 33, 34, 35, 36, + 39, 40, 75, 21, 70, 22, 71, 73, 50, 52, + -10, -9, -9, 4, 14, 64, 4, -12, -9, -11, + 64, -9, 71, 73, -9, -9, -9, 4, -9, 4, + -9, 71, 4, -16, -16, -9, 4, 4, -9, 71, + -9, 55, -9, -3, 52, 55, -9, -9, 4, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -10, -9, -9, -11, -9, 55, 64, + 13, 64, -1, -16, 16, 66, 64, 52, -1, 64, + -10, -9, 67, 67, -15, 4, 71, -10, -14, -13, + 6, 72, 71, 71, 71, 48, 51, -16, 64, -11, + -16, 54, 8, 72, 74, 54, -16, -1, -9, -1, + 65, 6, -9, -9, -1, -11, 65, -7, -16, 8, + 72, 74, 54, 4, 4, 72, 8, -15, 4, 55, + -16, 55, -16, 54, -10, -10, -10, -8, 4, -8, + -9, 4, -1, 4, -9, 72, -9, -9, 4, 65, + 64, 65, 64, 66, 65, 29, 65, -6, -5, 45, + 46, -6, -5, 72, -9, 64, 72, 72, 8, -16, + 74, -16, 65, -9, 72, 8, 72, 8, 72, 67, + 72, 55, 55, 65, 74, -1, -1, -9, 4, 64, + -9, 54, 74, -1, 64, 64, 72, 74, -13, 65, + 72, 72, 4, -9, -9, 65, 65, 64, 64, -1, + 54, -16, 65, -1, -1, 64, 72, 72, 55, -1, + -1, 65, -16, -1, 65, 65, -1, -9, 65, 65, + 30, -1, 65, 72, 30, 64, 64, -1, -1, 65, + 65, +} +var yyDef = [...]int{ + + -2, -2, -2, 121, 122, 123, 125, 126, 4, 39, + -2, 0, 9, 10, 48, 0, 0, 14, 48, 0, + 0, 52, 53, 0, 0, 0, 0, 0, 61, 62, + 63, 64, 0, 121, 121, 0, 0, 0, 0, 0, + 0, 0, 2, -2, 124, 0, 40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 97, 98, 0, 0, 0, 0, 48, 0, 0, 48, + 11, 49, 12, 0, 0, -2, 52, 0, -2, 0, + -2, 0, 48, 0, 54, 55, 56, -2, 0, -2, + 0, 39, 0, 48, 36, 0, 0, 52, 0, 0, + 120, 121, 0, 5, 48, 121, 7, 0, 66, 77, + 78, 79, 80, 81, 82, 83, 84, -2, -2, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 99, + 100, 101, 102, 0, 0, 119, 8, -2, 121, -2, + 0, -2, 0, -2, 0, 0, -2, 48, 0, 28, + 0, 0, 0, 0, 0, 40, 39, 121, 121, 37, + 0, 75, 48, 48, 48, 0, 0, 0, -2, 6, + 0, 0, 0, 108, 112, 0, 0, 0, 0, 0, + 15, 61, 0, 0, 0, 42, 0, 0, 0, 0, + 104, 111, 0, 58, 60, 0, 0, 0, 40, 121, + 0, 121, 0, 0, 0, 0, 0, 0, 46, 0, + -2, -2, 0, 41, 65, 107, 0, 50, -2, 13, + -2, 26, -2, 0, 18, 0, 23, 31, 32, 0, + 0, 29, 30, 103, 0, -2, 0, 0, 0, 0, + 71, 0, 73, 35, 76, 0, -2, 0, -2, 0, + 115, 0, 0, 27, 114, 0, 0, 0, 0, -2, + 0, 121, 113, 0, -2, -2, 0, 72, 38, 74, + -2, -2, 47, 0, 0, 25, 16, -2, -2, 0, + 121, -2, 67, 0, 0, -2, 116, 117, 0, 0, + 0, 22, -2, 34, 68, 69, 0, 0, 17, 21, + 0, 33, 70, 118, 0, -2, -2, 0, 0, 20, + 19, +} +var yyTok1 = [...]int{ + + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 76, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 68, 3, 3, 3, 62, 70, 3, + 71, 72, 60, 58, 55, 59, 67, 61, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 54, 66, + 57, 52, 56, 53, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 73, 3, 74, 69, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 64, 75, 65, +} +var yyTok2 = [...]int{ + + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 63, +} +var yyTok3 = [...]int{ + 0, +} + +var yyErrorMessages = [...]struct { + state int + token int + msg string +}{} + +//line yaccpar:1 + +/* parser for yacc output */ + +var ( + yyDebug = 0 + yyErrorVerbose = false +) + +type yyLexer interface { + Lex(lval *yySymType) int + Error(s string) +} + +type yyParser interface { + Parse(yyLexer) int + Lookahead() int +} + +type yyParserImpl struct { + lval yySymType + stack [yyInitialStackSize]yySymType + char int +} + +func (p *yyParserImpl) Lookahead() int { + return p.char +} + +func yyNewParser() yyParser { + return &yyParserImpl{} +} + +const yyFlag = -1000 + +func yyTokname(c int) string { + if c >= 1 && c-1 < len(yyToknames) { + if yyToknames[c-1] != "" { + return yyToknames[c-1] + } + } + return __yyfmt__.Sprintf("tok-%v", c) +} + +func yyStatname(s int) string { + if s >= 0 && s < len(yyStatenames) { + if yyStatenames[s] != "" { + return yyStatenames[s] + } + } + return __yyfmt__.Sprintf("state-%v", s) +} + +func yyErrorMessage(state, lookAhead int) string { + const TOKSTART = 4 + + if !yyErrorVerbose { + return "syntax error" + } + + for _, e := range yyErrorMessages { + if e.state == state && e.token == lookAhead { + return "syntax error: " + e.msg + } + } + + res := "syntax error: unexpected " + yyTokname(lookAhead) + + // To match Bison, suggest at most four expected tokens. + expected := make([]int, 0, 4) + + // Look for shiftable tokens. + base := yyPact[state] + for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { + if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok { + if len(expected) == cap(expected) { + return res + } + expected = append(expected, tok) + } + } + + if yyDef[state] == -2 { + i := 0 + for yyExca[i] != -1 || yyExca[i+1] != state { + i += 2 + } + + // Look for tokens that we accept or reduce. + for i += 2; yyExca[i] >= 0; i += 2 { + tok := yyExca[i] + if tok < TOKSTART || yyExca[i+1] == 0 { + continue + } + if len(expected) == cap(expected) { + return res + } + expected = append(expected, tok) + } + + // If the default action is to accept or reduce, give up. + if yyExca[i+1] != 0 { + return res + } + } + + for i, tok := range expected { + if i == 0 { + res += ", expecting " + } else { + res += " or " + } + res += yyTokname(tok) + } + return res +} + +func yylex1(lex yyLexer, lval *yySymType) (char, token int) { + token = 0 + char = lex.Lex(lval) + if char <= 0 { + token = yyTok1[0] + goto out + } + if char < len(yyTok1) { + token = yyTok1[char] + goto out + } + if char >= yyPrivate { + if char < yyPrivate+len(yyTok2) { + token = yyTok2[char-yyPrivate] + goto out + } + } + for i := 0; i < len(yyTok3); i += 2 { + token = yyTok3[i+0] + if token == char { + token = yyTok3[i+1] + goto out + } + } + +out: + if token == 0 { + token = yyTok2[1] /* unknown char */ + } + if yyDebug >= 3 { + __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) + } + return char, token +} + +func yyParse(yylex yyLexer) int { + return yyNewParser().Parse(yylex) +} + +func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { + var yyn int + var yyVAL yySymType + var yyDollar []yySymType + _ = yyDollar // silence set and not used + yyS := yyrcvr.stack[:] + + Nerrs := 0 /* number of errors */ + Errflag := 0 /* error recovery flag */ + yystate := 0 + yyrcvr.char = -1 + yytoken := -1 // yyrcvr.char translated into internal numbering + defer func() { + // Make sure we report no lookahead when not parsing. + yystate = -1 + yyrcvr.char = -1 + yytoken = -1 + }() + yyp := -1 + goto yystack + +ret0: + return 0 + +ret1: + return 1 + +yystack: + /* put a state and value onto the stack */ + if yyDebug >= 4 { + __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) + } + + yyp++ + if yyp >= len(yyS) { + nyys := make([]yySymType, len(yyS)*2) + copy(nyys, yyS) + yyS = nyys + } + yyS[yyp] = yyVAL + yyS[yyp].yys = yystate + +yynewstate: + yyn = yyPact[yystate] + if yyn <= yyFlag { + goto yydefault /* simple state */ + } + if yyrcvr.char < 0 { + yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) + } + yyn += yytoken + if yyn < 0 || yyn >= yyLast { + goto yydefault + } + yyn = yyAct[yyn] + if yyChk[yyn] == yytoken { /* valid shift */ + yyrcvr.char = -1 + yytoken = -1 + yyVAL = yyrcvr.lval + yystate = yyn + if Errflag > 0 { + Errflag-- + } + goto yystack + } + +yydefault: + /* default state action */ + yyn = yyDef[yystate] + if yyn == -2 { + if yyrcvr.char < 0 { + yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) + } + + /* look through exception table */ + xi := 0 + for { + if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate { + break + } + xi += 2 + } + for xi += 2; ; xi += 2 { + yyn = yyExca[xi+0] + if yyn < 0 || yyn == yytoken { + break + } + } + yyn = yyExca[xi+1] + if yyn < 0 { + goto ret0 + } + } + if yyn == 0 { + /* error ... attempt to resume parsing */ + switch Errflag { + case 0: /* brand new error */ + yylex.Error(yyErrorMessage(yystate, yytoken)) + Nerrs++ + if yyDebug >= 1 { + __yyfmt__.Printf("%s", yyStatname(yystate)) + __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) + } + fallthrough + + case 1, 2: /* incompletely recovered error ... try again */ + Errflag = 3 + + /* find a state where "error" is a legal shift action */ + for yyp >= 0 { + yyn = yyPact[yyS[yyp].yys] + yyErrCode + if yyn >= 0 && yyn < yyLast { + yystate = yyAct[yyn] /* simulate a shift of "error" */ + if yyChk[yystate] == yyErrCode { + goto yystack + } + } + + /* the current p has no shift on "error", pop stack */ + if yyDebug >= 2 { + __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) + } + yyp-- + } + /* there is no state on the stack with an error shift ... abort */ + goto ret1 + + case 3: /* no shift yet; clobber input char */ + if yyDebug >= 2 { + __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) + } + if yytoken == yyEofCode { + goto ret1 + } + yyrcvr.char = -1 + yytoken = -1 + goto yynewstate /* try again in the same state */ + } + } + + /* reduction by production yyn */ + if yyDebug >= 2 { + __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) + } + + yynt := yyn + yypt := yyp + _ = yypt // guard against "declared and not used" + + yyp -= yyR2[yyn] + // yyp is now the index of $0. Perform the default action. Iff the + // reduced production is ε, $1 is possibly out of range. + if yyp+1 >= len(yyS) { + nyys := make([]yySymType, len(yyS)*2) + copy(nyys, yyS) + yyS = nyys + } + yyVAL = yyS[yyp+1] + + /* consult goto table to find next state */ + yyn = yyR1[yyn] + yyg := yyPgo[yyn] + yyj := yyg + yyS[yyp].yys + 1 + + if yyj >= yyLast { + yystate = yyAct[yyg] + } else { + yystate = yyAct[yyj] + if yyChk[yystate] != -yyn { + yystate = yyAct[yyg] + } + } + // dummy call; replaced with literal code + switch yynt { + + case 1: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:65 + { + yyVAL.compstmt = nil + } + case 2: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:69 + { + yyVAL.compstmt = yyDollar[1].stmts + } + case 3: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:74 + { + yyVAL.stmts = nil + if l, ok := yylex.(*Lexer); ok { + l.stmts = yyVAL.stmts + } + } + case 4: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:81 + { + yyVAL.stmts = []ast.Stmt{yyDollar[2].stmt} + if l, ok := yylex.(*Lexer); ok { + l.stmts = yyVAL.stmts + } + } + case 5: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:88 + { + if yyDollar[3].stmt != nil { + yyVAL.stmts = append(yyDollar[1].stmts, yyDollar[3].stmt) + if l, ok := yylex.(*Lexer); ok { + l.stmts = yyVAL.stmts + } + } + } + case 6: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:99 + { + yyVAL.stmt = &ast.VarStmt{Names: yyDollar[2].expr_idents, Exprs: yyDollar[4].expr_many} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 7: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:104 + { + yyVAL.stmt = &ast.LetsStmt{Lhss: []ast.Expr{yyDollar[1].expr}, Operator: "=", Rhss: []ast.Expr{yyDollar[3].expr}} + } + case 8: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:108 + { + yyVAL.stmt = &ast.LetsStmt{Lhss: yyDollar[1].expr_many, Operator: "=", Rhss: yyDollar[3].expr_many} + } + case 9: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:112 + { + yyVAL.stmt = &ast.BreakStmt{} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 10: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:117 + { + yyVAL.stmt = &ast.ContinueStmt{} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 11: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:122 + { + yyVAL.stmt = &ast.ReturnStmt{Exprs: yyDollar[2].exprs} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 12: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:127 + { + yyVAL.stmt = &ast.ThrowStmt{Expr: yyDollar[2].expr} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 13: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:132 + { + yyVAL.stmt = &ast.ModuleStmt{Name: yyDollar[2].tok.Lit, Stmts: yyDollar[4].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 14: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:137 + { + yyVAL.stmt = yyDollar[1].stmt_if + yyVAL.stmt.SetPosition(yyDollar[1].stmt_if.Position()) + } + case 15: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:142 + { + yyVAL.stmt = &ast.LoopStmt{Stmts: yyDollar[3].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 16: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:147 + { + yyVAL.stmt = &ast.ForStmt{Var: yyDollar[2].tok.Lit, Value: yyDollar[4].expr, Stmts: yyDollar[6].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 17: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:152 + { + yyVAL.stmt = &ast.CForStmt{Expr1: yyDollar[2].expr_lets, Expr2: yyDollar[4].expr, Expr3: yyDollar[6].expr, Stmts: yyDollar[8].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 18: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:157 + { + yyVAL.stmt = &ast.LoopStmt{Expr: yyDollar[2].expr, Stmts: yyDollar[4].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 19: + yyDollar = yyS[yypt-13 : yypt+1] + //line parser.go.y:162 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Var: yyDollar[6].tok.Lit, Catch: yyDollar[8].compstmt, Finally: yyDollar[12].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 20: + yyDollar = yyS[yypt-12 : yypt+1] + //line parser.go.y:167 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Catch: yyDollar[7].compstmt, Finally: yyDollar[11].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 21: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:172 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Var: yyDollar[6].tok.Lit, Catch: yyDollar[8].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 22: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.go.y:177 + { + yyVAL.stmt = &ast.TryStmt{Try: yyDollar[3].compstmt, Catch: yyDollar[7].compstmt} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 23: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:182 + { + yyVAL.stmt = &ast.SwitchStmt{Expr: yyDollar[2].expr, Cases: yyDollar[4].stmt_cases} + yyVAL.stmt.SetPosition(yyDollar[1].tok.Position()) + } + case 24: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:187 + { + yyVAL.stmt = &ast.ExprStmt{Expr: yyDollar[1].expr} + yyVAL.stmt.SetPosition(yyDollar[1].expr.Position()) + } + case 25: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:195 + { + yyDollar[1].stmt_if.(*ast.IfStmt).ElseIf = append(yyDollar[1].stmt_if.(*ast.IfStmt).ElseIf, &ast.IfStmt{If: yyDollar[4].expr, Then: yyDollar[6].compstmt}) + yyVAL.stmt_if.SetPosition(yyDollar[1].stmt_if.Position()) + } + case 26: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:200 + { + if yyVAL.stmt_if.(*ast.IfStmt).Else != nil { + yylex.Error("multiple else statement") + } else { + yyVAL.stmt_if.(*ast.IfStmt).Else = append(yyVAL.stmt_if.(*ast.IfStmt).Else, yyDollar[4].compstmt...) + } + yyVAL.stmt_if.SetPosition(yyDollar[1].stmt_if.Position()) + } + case 27: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:209 + { + yyVAL.stmt_if = &ast.IfStmt{If: yyDollar[2].expr, Then: yyDollar[4].compstmt, Else: nil} + yyVAL.stmt_if.SetPosition(yyDollar[1].tok.Position()) + } + case 28: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:215 + { + yyVAL.stmt_cases = []ast.Stmt{} + } + case 29: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:219 + { + yyVAL.stmt_cases = []ast.Stmt{yyDollar[2].stmt_case} + } + case 30: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:223 + { + yyVAL.stmt_cases = []ast.Stmt{yyDollar[2].stmt_default} + } + case 31: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:227 + { + yyVAL.stmt_cases = append(yyDollar[1].stmt_cases, yyDollar[2].stmt_case) + } + case 32: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:231 + { + for _, stmt := range yyDollar[1].stmt_cases { + if _, ok := stmt.(*ast.DefaultStmt); ok { + yylex.Error("multiple default statement") + } + } + yyVAL.stmt_cases = append(yyDollar[1].stmt_cases, yyDollar[2].stmt_default) + } + case 33: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:242 + { + yyVAL.stmt_case = &ast.CaseStmt{Expr: yyDollar[2].expr, Stmts: yyDollar[5].compstmt} + } + case 34: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:248 + { + yyVAL.stmt_default = &ast.DefaultStmt{Stmts: yyDollar[4].compstmt} + } + case 35: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:254 + { + yyVAL.expr_pair = &ast.PairExpr{Key: yyDollar[1].tok.Lit, Value: yyDollar[3].expr} + } + case 36: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:259 + { + yyVAL.expr_pairs = []ast.Expr{} + } + case 37: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:263 + { + yyVAL.expr_pairs = []ast.Expr{yyDollar[1].expr_pair} + } + case 38: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:267 + { + yyVAL.expr_pairs = append(yyDollar[1].expr_pairs, yyDollar[4].expr_pair) + } + case 39: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:272 + { + yyVAL.expr_idents = []string{} + } + case 40: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:276 + { + yyVAL.expr_idents = []string{yyDollar[1].tok.Lit} + } + case 41: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:280 + { + yyVAL.expr_idents = append(yyDollar[1].expr_idents, yyDollar[4].tok.Lit) + } + case 42: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:285 + { + yyVAL.expr_lets = &ast.LetsExpr{Lhss: yyDollar[1].expr_many, Operator: "=", Rhss: yyDollar[3].expr_many} + } + case 43: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:291 + { + yyVAL.expr_many = []ast.Expr{yyDollar[1].expr} + } + case 44: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:295 + { + yyVAL.expr_many = append(yyDollar[1].exprs, yyDollar[4].expr) + } + case 45: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:299 + { + yyVAL.expr_many = append(yyDollar[1].exprs, &ast.IdentExpr{Lit: yyDollar[4].tok.Lit}) + } + case 46: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:304 + { + yyVAL.typ = ast.Type{Name: yyDollar[1].tok.Lit} + } + case 47: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:308 + { + yyVAL.typ = ast.Type{Name: yyDollar[1].typ.Name + "." + yyDollar[3].tok.Lit} + } + case 48: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.go.y:313 + { + yyVAL.exprs = nil + } + case 49: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:317 + { + yyVAL.exprs = []ast.Expr{yyDollar[1].expr} + } + case 50: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:321 + { + yyVAL.exprs = append(yyDollar[1].exprs, yyDollar[4].expr) + } + case 51: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:325 + { + yyVAL.exprs = append(yyDollar[1].exprs, &ast.IdentExpr{Lit: yyDollar[4].tok.Lit}) + } + case 52: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:331 + { + yyVAL.expr = &ast.IdentExpr{Lit: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 53: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:336 + { + yyVAL.expr = &ast.NumberExpr{Lit: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 54: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:341 + { + yyVAL.expr = &ast.UnaryExpr{Operator: "-", Expr: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 55: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:346 + { + yyVAL.expr = &ast.UnaryExpr{Operator: "!", Expr: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 56: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:351 + { + yyVAL.expr = &ast.UnaryExpr{Operator: "^", Expr: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 57: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:356 + { + yyVAL.expr = &ast.AddrExpr{Expr: &ast.IdentExpr{Lit: yyDollar[2].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 58: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:361 + { + yyVAL.expr = &ast.AddrExpr{Expr: &ast.MemberExpr{Expr: yyDollar[2].expr, Name: yyDollar[4].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 59: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:366 + { + yyVAL.expr = &ast.DerefExpr{Expr: &ast.IdentExpr{Lit: yyDollar[2].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 60: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:371 + { + yyVAL.expr = &ast.DerefExpr{Expr: &ast.MemberExpr{Expr: yyDollar[2].expr, Name: yyDollar[4].tok.Lit}} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 61: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:376 + { + yyVAL.expr = &ast.StringExpr{Lit: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 62: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:381 + { + yyVAL.expr = &ast.ConstExpr{Value: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 63: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:386 + { + yyVAL.expr = &ast.ConstExpr{Value: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 64: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:391 + { + yyVAL.expr = &ast.ConstExpr{Value: yyDollar[1].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 65: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:396 + { + yyVAL.expr = &ast.TernaryOpExpr{Expr: yyDollar[1].expr, Lhs: yyDollar[3].expr, Rhs: yyDollar[5].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 66: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:401 + { + yyVAL.expr = &ast.MemberExpr{Expr: yyDollar[1].expr, Name: yyDollar[3].tok.Lit} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 67: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:406 + { + yyVAL.expr = &ast.FuncExpr{Args: yyDollar[3].expr_idents, Stmts: yyDollar[6].compstmt} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 68: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.go.y:411 + { + yyVAL.expr = &ast.FuncExpr{Args: []string{yyDollar[3].tok.Lit}, Stmts: yyDollar[7].compstmt, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 69: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.go.y:416 + { + yyVAL.expr = &ast.FuncExpr{Name: yyDollar[2].tok.Lit, Args: yyDollar[4].expr_idents, Stmts: yyDollar[7].compstmt} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 70: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:421 + { + yyVAL.expr = &ast.FuncExpr{Name: yyDollar[2].tok.Lit, Args: []string{yyDollar[4].tok.Lit}, Stmts: yyDollar[8].compstmt, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 71: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:426 + { + yyVAL.expr = &ast.ArrayExpr{Exprs: yyDollar[3].exprs} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 72: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:431 + { + yyVAL.expr = &ast.ArrayExpr{Exprs: yyDollar[3].exprs} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 73: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:436 + { + mapExpr := make(map[string]ast.Expr) + for _, v := range yyDollar[3].expr_pairs { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + yyVAL.expr = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 74: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:445 + { + mapExpr := make(map[string]ast.Expr) + for _, v := range yyDollar[3].expr_pairs { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + yyVAL.expr = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 75: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:454 + { + yyVAL.expr = &ast.ParenExpr{SubExpr: yyDollar[2].expr} + if l, ok := yylex.(*Lexer); ok { + yyVAL.expr.SetPosition(l.pos) + } + } + case 76: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:459 + { + yyVAL.expr = &ast.NewExpr{Name: yyDollar[2].tok.Lit, SubExprs: yyDollar[4].exprs} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 77: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:464 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "+", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 78: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:469 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "-", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 79: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:474 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "*", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 80: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:479 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "/", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 81: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:484 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "%", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 82: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:489 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "**", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 83: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:494 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "<<", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 84: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:499 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: ">>", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 85: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:504 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "==", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 86: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:509 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "!=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 87: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:514 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: ">", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 88: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:519 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: ">=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 89: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:524 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "<", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 90: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:529 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "<=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 91: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:534 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "+=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 92: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:539 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "-=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 93: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:544 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "*=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 94: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:549 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "/=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 95: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:554 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "&=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 96: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:559 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "|=", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 97: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:564 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "++"} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 98: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:569 + { + yyVAL.expr = &ast.AssocExpr{Lhs: yyDollar[1].expr, Operator: "--"} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 99: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:574 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "|", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 100: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:579 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "||", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 101: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:584 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "&", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 102: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:589 + { + yyVAL.expr = &ast.BinOpExpr{Lhs: yyDollar[1].expr, Operator: "&&", Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 103: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:594 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[1].tok.Lit, SubExprs: yyDollar[3].exprs, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 104: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:599 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[1].tok.Lit, SubExprs: yyDollar[3].exprs} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 105: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:604 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[2].tok.Lit, SubExprs: yyDollar[4].exprs, VarArg: true, Go: true} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 106: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:609 + { + yyVAL.expr = &ast.CallExpr{Name: yyDollar[2].tok.Lit, SubExprs: yyDollar[4].exprs, Go: true} + yyVAL.expr.SetPosition(yyDollar[2].tok.Position()) + } + case 107: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:614 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[1].expr, SubExprs: yyDollar[3].exprs, VarArg: true} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 108: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:619 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[1].expr, SubExprs: yyDollar[3].exprs} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 109: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:624 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[2].expr, SubExprs: yyDollar[4].exprs, VarArg: true, Go: true} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 110: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:629 + { + yyVAL.expr = &ast.AnonCallExpr{Expr: yyDollar[2].expr, SubExprs: yyDollar[4].exprs, Go: true} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 111: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:634 + { + yyVAL.expr = &ast.ItemExpr{Value: &ast.IdentExpr{Lit: yyDollar[1].tok.Lit}, Index: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 112: + yyDollar = yyS[yypt-4 : yypt+1] + //line parser.go.y:639 + { + yyVAL.expr = &ast.ItemExpr{Value: yyDollar[1].expr, Index: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 113: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:644 + { + yyVAL.expr = &ast.SliceExpr{Value: &ast.IdentExpr{Lit: yyDollar[1].tok.Lit}, Begin: yyDollar[3].expr, End: yyDollar[5].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 114: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.go.y:649 + { + yyVAL.expr = &ast.SliceExpr{Value: yyDollar[1].expr, Begin: yyDollar[3].expr, End: yyDollar[5].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 115: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.go.y:654 + { + yyVAL.expr = &ast.MakeChanExpr{Type: yyDollar[4].typ.Name, SizeExpr: nil} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 116: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:659 + { + yyVAL.expr = &ast.MakeChanExpr{Type: yyDollar[4].typ.Name, SizeExpr: yyDollar[6].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 117: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.go.y:664 + { + yyVAL.expr = &ast.MakeArrayExpr{Type: yyDollar[4].typ.Name, LenExpr: yyDollar[6].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 118: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.go.y:669 + { + yyVAL.expr = &ast.MakeArrayExpr{Type: yyDollar[4].typ.Name, LenExpr: yyDollar[6].expr, CapExpr: yyDollar[8].expr} + yyVAL.expr.SetPosition(yyDollar[1].tok.Position()) + } + case 119: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.go.y:674 + { + yyVAL.expr = &ast.ChanExpr{Lhs: yyDollar[1].expr, Rhs: yyDollar[3].expr} + yyVAL.expr.SetPosition(yyDollar[1].expr.Position()) + } + case 120: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:679 + { + yyVAL.expr = &ast.ChanExpr{Rhs: yyDollar[2].expr} + yyVAL.expr.SetPosition(yyDollar[2].expr.Position()) + } + case 123: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:690 + { + } + case 124: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.go.y:693 + { + } + case 125: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:698 + { + } + case 126: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.go.y:701 + { + } + } + goto yystack /* stack new state and value */ +} diff --git a/vendor/github.com/mattn/anko/parser/parser.go.y b/vendor/github.com/mattn/anko/parser/parser.go.y new file mode 100644 index 0000000000..9ebe8ae068 --- /dev/null +++ b/vendor/github.com/mattn/anko/parser/parser.go.y @@ -0,0 +1,705 @@ +%{ +package parser + +import ( + "github.com/mattn/anko/ast" +) + +%} + +%type compstmt +%type stmts +%type stmt +%type stmt_if +%type stmt_default +%type stmt_case +%type stmt_cases +%type typ +%type expr +%type exprs +%type expr_many +%type expr_lets +%type expr_pair +%type expr_pairs +%type expr_idents + +%union{ + compstmt []ast.Stmt + stmt_if ast.Stmt + stmt_default ast.Stmt + stmt_case ast.Stmt + stmt_cases []ast.Stmt + stmts []ast.Stmt + stmt ast.Stmt + typ ast.Type + expr ast.Expr + exprs []ast.Expr + expr_many []ast.Expr + expr_lets ast.Expr + expr_pair ast.Expr + expr_pairs []ast.Expr + expr_idents []string + tok ast.Token + term ast.Token + terms ast.Token + opt_terms ast.Token +} + +%token IDENT NUMBER STRING ARRAY VARARG FUNC RETURN VAR THROW IF ELSE FOR IN EQEQ NEQ GE LE OROR ANDAND NEW TRUE FALSE NIL MODULE TRY CATCH FINALLY PLUSEQ MINUSEQ MULEQ DIVEQ ANDEQ OREQ BREAK CONTINUE PLUSPLUS MINUSMINUS POW SHIFTLEFT SHIFTRIGHT SWITCH CASE DEFAULT GO CHAN MAKE OPCHAN ARRAYLIT + +%right '=' +%right '?' ':' +%left OROR +%left ANDAND +%left IDENT +%nonassoc EQEQ NEQ ',' +%left '>' GE '<' LE SHIFTLEFT SHIFTRIGHT + +%left '+' '-' PLUSPLUS MINUSMINUS +%left '*' '/' '%' +%right UNARY + +%% + +compstmt : opt_terms + { + $$ = nil + } + | stmts opt_terms + { + $$ = $1 + } + +stmts : + { + $$ = nil + if l, ok := yylex.(*Lexer); ok { + l.stmts = $$ + } + } + | opt_terms stmt + { + $$ = []ast.Stmt{$2} + if l, ok := yylex.(*Lexer); ok { + l.stmts = $$ + } + } + | stmts terms stmt + { + if $3 != nil { + $$ = append($1, $3) + if l, ok := yylex.(*Lexer); ok { + l.stmts = $$ + } + } + } + +stmt : + VAR expr_idents '=' expr_many + { + $$ = &ast.VarStmt{Names: $2, Exprs: $4} + $$.SetPosition($1.Position()) + } + | expr '=' expr + { + $$ = &ast.LetsStmt{Lhss: []ast.Expr{$1}, Operator: "=", Rhss: []ast.Expr{$3}} + } + | expr_many '=' expr_many + { + $$ = &ast.LetsStmt{Lhss: $1, Operator: "=", Rhss: $3} + } + | BREAK + { + $$ = &ast.BreakStmt{} + $$.SetPosition($1.Position()) + } + | CONTINUE + { + $$ = &ast.ContinueStmt{} + $$.SetPosition($1.Position()) + } + | RETURN exprs + { + $$ = &ast.ReturnStmt{Exprs: $2} + $$.SetPosition($1.Position()) + } + | THROW expr + { + $$ = &ast.ThrowStmt{Expr: $2} + $$.SetPosition($1.Position()) + } + | MODULE IDENT '{' compstmt '}' + { + $$ = &ast.ModuleStmt{Name: $2.Lit, Stmts: $4} + $$.SetPosition($1.Position()) + } + | stmt_if + { + $$ = $1 + $$.SetPosition($1.Position()) + } + | FOR '{' compstmt '}' + { + $$ = &ast.LoopStmt{Stmts: $3} + $$.SetPosition($1.Position()) + } + | FOR IDENT IN expr '{' compstmt '}' + { + $$ = &ast.ForStmt{Var: $2.Lit, Value: $4, Stmts: $6} + $$.SetPosition($1.Position()) + } + | FOR expr_lets ';' expr ';' expr '{' compstmt '}' + { + $$ = &ast.CForStmt{Expr1: $2, Expr2: $4, Expr3: $6, Stmts: $8} + $$.SetPosition($1.Position()) + } + | FOR expr '{' compstmt '}' + { + $$ = &ast.LoopStmt{Expr: $2, Stmts: $4} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH IDENT '{' compstmt '}' FINALLY '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Var: $6.Lit, Catch: $8, Finally: $12} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH '{' compstmt '}' FINALLY '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Catch: $7, Finally: $11} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH IDENT '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Var: $6.Lit, Catch: $8} + $$.SetPosition($1.Position()) + } + | TRY '{' compstmt '}' CATCH '{' compstmt '}' + { + $$ = &ast.TryStmt{Try: $3, Catch: $7} + $$.SetPosition($1.Position()) + } + | SWITCH expr '{' stmt_cases '}' + { + $$ = &ast.SwitchStmt{Expr: $2, Cases: $4} + $$.SetPosition($1.Position()) + } + | expr + { + $$ = &ast.ExprStmt{Expr: $1} + $$.SetPosition($1.Position()) + } + + +stmt_if : + stmt_if ELSE IF expr '{' compstmt '}' + { + $1.(*ast.IfStmt).ElseIf = append($1.(*ast.IfStmt).ElseIf, &ast.IfStmt{If: $4, Then: $6}) + $$.SetPosition($1.Position()) + } + | stmt_if ELSE '{' compstmt '}' + { + if $$.(*ast.IfStmt).Else != nil { + yylex.Error("multiple else statement") + } else { + $$.(*ast.IfStmt).Else = append($$.(*ast.IfStmt).Else, $4...) + } + $$.SetPosition($1.Position()) + } + | IF expr '{' compstmt '}' + { + $$ = &ast.IfStmt{If: $2, Then: $4, Else: nil} + $$.SetPosition($1.Position()) + } + +stmt_cases : + { + $$ = []ast.Stmt{} + } + | opt_terms stmt_case + { + $$ = []ast.Stmt{$2} + } + | opt_terms stmt_default + { + $$ = []ast.Stmt{$2} + } + | stmt_cases stmt_case + { + $$ = append($1, $2) + } + | stmt_cases stmt_default + { + for _, stmt := range $1 { + if _, ok := stmt.(*ast.DefaultStmt); ok { + yylex.Error("multiple default statement") + } + } + $$ = append($1, $2) + } + +stmt_case : + CASE expr ':' opt_terms compstmt + { + $$ = &ast.CaseStmt{Expr: $2, Stmts: $5} + } + +stmt_default : + DEFAULT ':' opt_terms compstmt + { + $$ = &ast.DefaultStmt{Stmts: $4} + } + +expr_pair : + STRING ':' expr + { + $$ = &ast.PairExpr{Key: $1.Lit, Value: $3} + } + +expr_pairs : + { + $$ = []ast.Expr{} + } + | expr_pair + { + $$ = []ast.Expr{$1} + } + | expr_pairs ',' opt_terms expr_pair + { + $$ = append($1, $4) + } + +expr_idents : + { + $$ = []string{} + } + | IDENT + { + $$ = []string{$1.Lit} + } + | expr_idents ',' opt_terms IDENT + { + $$ = append($1, $4.Lit) + } + +expr_lets : expr_many '=' expr_many + { + $$ = &ast.LetsExpr{Lhss: $1, Operator: "=", Rhss: $3} + } + +expr_many : + expr + { + $$ = []ast.Expr{$1} + } + | exprs ',' opt_terms expr + { + $$ = append($1, $4) + } + | exprs ',' opt_terms IDENT + { + $$ = append($1, &ast.IdentExpr{Lit: $4.Lit}) + } + +typ : IDENT + { + $$ = ast.Type{Name: $1.Lit} + } + | typ '.' IDENT + { + $$ = ast.Type{Name: $1.Name + "." + $3.Lit} + } + +exprs : + { + $$ = nil + } + | expr + { + $$ = []ast.Expr{$1} + } + | exprs ',' opt_terms expr + { + $$ = append($1, $4) + } + | exprs ',' opt_terms IDENT + { + $$ = append($1, &ast.IdentExpr{Lit: $4.Lit}) + } + +expr : + IDENT + { + $$ = &ast.IdentExpr{Lit: $1.Lit} + $$.SetPosition($1.Position()) + } + | NUMBER + { + $$ = &ast.NumberExpr{Lit: $1.Lit} + $$.SetPosition($1.Position()) + } + | '-' expr %prec UNARY + { + $$ = &ast.UnaryExpr{Operator: "-", Expr: $2} + $$.SetPosition($2.Position()) + } + | '!' expr %prec UNARY + { + $$ = &ast.UnaryExpr{Operator: "!", Expr: $2} + $$.SetPosition($2.Position()) + } + | '^' expr %prec UNARY + { + $$ = &ast.UnaryExpr{Operator: "^", Expr: $2} + $$.SetPosition($2.Position()) + } + | '&' IDENT %prec UNARY + { + $$ = &ast.AddrExpr{Expr: &ast.IdentExpr{Lit: $2.Lit}} + $$.SetPosition($2.Position()) + } + | '&' expr '.' IDENT %prec UNARY + { + $$ = &ast.AddrExpr{Expr: &ast.MemberExpr{Expr: $2, Name: $4.Lit}} + $$.SetPosition($2.Position()) + } + | '*' IDENT %prec UNARY + { + $$ = &ast.DerefExpr{Expr: &ast.IdentExpr{Lit: $2.Lit}} + $$.SetPosition($2.Position()) + } + | '*' expr '.' IDENT %prec UNARY + { + $$ = &ast.DerefExpr{Expr: &ast.MemberExpr{Expr: $2, Name: $4.Lit}} + $$.SetPosition($2.Position()) + } + | STRING + { + $$ = &ast.StringExpr{Lit: $1.Lit} + $$.SetPosition($1.Position()) + } + | TRUE + { + $$ = &ast.ConstExpr{Value: $1.Lit} + $$.SetPosition($1.Position()) + } + | FALSE + { + $$ = &ast.ConstExpr{Value: $1.Lit} + $$.SetPosition($1.Position()) + } + | NIL + { + $$ = &ast.ConstExpr{Value: $1.Lit} + $$.SetPosition($1.Position()) + } + | expr '?' expr ':' expr + { + $$ = &ast.TernaryOpExpr{Expr: $1, Lhs: $3, Rhs: $5} + $$.SetPosition($1.Position()) + } + | expr '.' IDENT + { + $$ = &ast.MemberExpr{Expr: $1, Name: $3.Lit} + $$.SetPosition($1.Position()) + } + | FUNC '(' expr_idents ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Args: $3, Stmts: $6} + $$.SetPosition($1.Position()) + } + | FUNC '(' IDENT VARARG ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Args: []string{$3.Lit}, Stmts: $7, VarArg: true} + $$.SetPosition($1.Position()) + } + | FUNC IDENT '(' expr_idents ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Name: $2.Lit, Args: $4, Stmts: $7} + $$.SetPosition($1.Position()) + } + | FUNC IDENT '(' IDENT VARARG ')' '{' compstmt '}' + { + $$ = &ast.FuncExpr{Name: $2.Lit, Args: []string{$4.Lit}, Stmts: $8, VarArg: true} + $$.SetPosition($1.Position()) + } + | '[' opt_terms exprs opt_terms ']' + { + $$ = &ast.ArrayExpr{Exprs: $3} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '[' opt_terms exprs ',' opt_terms ']' + { + $$ = &ast.ArrayExpr{Exprs: $3} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '{' opt_terms expr_pairs opt_terms '}' + { + mapExpr := make(map[string]ast.Expr) + for _, v := range $3 { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + $$ = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '{' opt_terms expr_pairs ',' opt_terms '}' + { + mapExpr := make(map[string]ast.Expr) + for _, v := range $3 { + mapExpr[v.(*ast.PairExpr).Key] = v.(*ast.PairExpr).Value + } + $$ = &ast.MapExpr{MapExpr: mapExpr} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | '(' expr ')' + { + $$ = &ast.ParenExpr{SubExpr: $2} + if l, ok := yylex.(*Lexer); ok { $$.SetPosition(l.pos) } + } + | NEW IDENT '(' exprs ')' + { + $$ = &ast.NewExpr{Name: $2.Lit, SubExprs: $4} + $$.SetPosition($1.Position()) + } + | expr '+' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "+", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '-' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "-", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '*' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "*", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '/' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "/", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '%' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "%", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr POW expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "**", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr SHIFTLEFT expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "<<", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr SHIFTRIGHT expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: ">>", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr EQEQ expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "==", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr NEQ expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "!=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '>' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: ">", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr GE expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: ">=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '<' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "<", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr LE expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "<=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr PLUSEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "+=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr MINUSEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "-=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr MULEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "*=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr DIVEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "/=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr ANDEQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "&=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr OREQ expr + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "|=", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr PLUSPLUS + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "++"} + $$.SetPosition($1.Position()) + } + | expr MINUSMINUS + { + $$ = &ast.AssocExpr{Lhs: $1, Operator: "--"} + $$.SetPosition($1.Position()) + } + | expr '|' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "|", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr OROR expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "||", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr '&' expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "&", Rhs: $3} + $$.SetPosition($1.Position()) + } + | expr ANDAND expr + { + $$ = &ast.BinOpExpr{Lhs: $1, Operator: "&&", Rhs: $3} + $$.SetPosition($1.Position()) + } + | IDENT '(' exprs VARARG ')' + { + $$ = &ast.CallExpr{Name: $1.Lit, SubExprs: $3, VarArg: true} + $$.SetPosition($1.Position()) + } + | IDENT '(' exprs ')' + { + $$ = &ast.CallExpr{Name: $1.Lit, SubExprs: $3} + $$.SetPosition($1.Position()) + } + | GO IDENT '(' exprs VARARG ')' + { + $$ = &ast.CallExpr{Name: $2.Lit, SubExprs: $4, VarArg: true, Go: true} + $$.SetPosition($2.Position()) + } + | GO IDENT '(' exprs ')' + { + $$ = &ast.CallExpr{Name: $2.Lit, SubExprs: $4, Go: true} + $$.SetPosition($2.Position()) + } + | expr '(' exprs VARARG ')' + { + $$ = &ast.AnonCallExpr{Expr: $1, SubExprs: $3, VarArg: true} + $$.SetPosition($1.Position()) + } + | expr '(' exprs ')' + { + $$ = &ast.AnonCallExpr{Expr: $1, SubExprs: $3} + $$.SetPosition($1.Position()) + } + | GO expr '(' exprs VARARG ')' + { + $$ = &ast.AnonCallExpr{Expr: $2, SubExprs: $4, VarArg: true, Go: true} + $$.SetPosition($2.Position()) + } + | GO expr '(' exprs ')' + { + $$ = &ast.AnonCallExpr{Expr: $2, SubExprs: $4, Go: true} + $$.SetPosition($1.Position()) + } + | IDENT '[' expr ']' + { + $$ = &ast.ItemExpr{Value: &ast.IdentExpr{Lit: $1.Lit}, Index: $3} + $$.SetPosition($1.Position()) + } + | expr '[' expr ']' + { + $$ = &ast.ItemExpr{Value: $1, Index: $3} + $$.SetPosition($1.Position()) + } + | IDENT '[' expr ':' expr ']' + { + $$ = &ast.SliceExpr{Value: &ast.IdentExpr{Lit: $1.Lit}, Begin: $3, End: $5} + $$.SetPosition($1.Position()) + } + | expr '[' expr ':' expr ']' + { + $$ = &ast.SliceExpr{Value: $1, Begin: $3, End: $5} + $$.SetPosition($1.Position()) + } + | MAKE '(' CHAN typ ')' + { + $$ = &ast.MakeChanExpr{Type: $4.Name, SizeExpr: nil} + $$.SetPosition($1.Position()) + } + | MAKE '(' CHAN typ ',' expr ')' + { + $$ = &ast.MakeChanExpr{Type: $4.Name, SizeExpr: $6} + $$.SetPosition($1.Position()) + } + | MAKE '(' ARRAYLIT typ ',' expr ')' + { + $$ = &ast.MakeArrayExpr{Type: $4.Name, LenExpr: $6} + $$.SetPosition($1.Position()) + } + | MAKE '(' ARRAYLIT typ ',' expr ',' expr ')' + { + $$ = &ast.MakeArrayExpr{Type: $4.Name, LenExpr: $6, CapExpr: $8} + $$.SetPosition($1.Position()) + } + | expr OPCHAN expr + { + $$ = &ast.ChanExpr{Lhs: $1, Rhs: $3} + $$.SetPosition($1.Position()) + } + | OPCHAN expr + { + $$ = &ast.ChanExpr{Rhs: $2} + $$.SetPosition($2.Position()) + } + +opt_terms : /* none */ + | terms + ; + + +terms : term + { + } + | terms term + { + } + ; + +term : ';' + { + } + | '\n' + { + } + ; + +%% diff --git a/vendor/github.com/mattn/anko/t/01-let.ank b/vendor/github.com/mattn/anko/t/01-let.ank new file mode 100644 index 0000000000..d6591538da --- /dev/null +++ b/vendor/github.com/mattn/anko/t/01-let.ank @@ -0,0 +1,31 @@ +a = nil +is(nil, a, "let nil") + +a = 1 +is(1, a, "let int") + +a = 1.2 +is(1.2, a, "let float") + +a = "foo" +is("foo", a, "let string") + +a = nil +is(nil, a, "let nil") + +a = true +is(true, a, "let true") + +a = false +is(false, a, "let false") + +a = [1,2,3] +is([1,2,3], a, "let array") + +a = {"foo": "bar", "bar": "baz"} +is({"bar": "baz", "foo": "bar"}, a, "let map") + +a = {"foo": "bar", "bar": {"blah": true, "blah!": [1.3e3, true]}} +is({"foo": "bar", "bar": {"blah": true, "blah!": [1.3e3, true]}}, a, "let map deep") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/02-toString.ank b/vendor/github.com/mattn/anko/t/02-toString.ank new file mode 100644 index 0000000000..e4d8f90c62 --- /dev/null +++ b/vendor/github.com/mattn/anko/t/02-toString.ank @@ -0,0 +1,7 @@ +is("1", toString(1), "toString(int)") +is("1.2", toString(1.2), "toString(float)") +is("true", toString(true), "toString(true)") +is("false", toString(false), "toString(false)") +is("foo", toString("foo"), "toString(\"foo\")") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/03-op.ank b/vendor/github.com/mattn/anko/t/03-op.ank new file mode 100644 index 0000000000..a7d37c9d74 --- /dev/null +++ b/vendor/github.com/mattn/anko/t/03-op.ank @@ -0,0 +1,68 @@ +#!anko + +ok(1 > 0, "1 > 0") +ok(1 == 1.0, "1 == 1.0") +ok(1 != "1", "1 != \"1\"") +ok(1 == 1, "1 == 1") +ok(1.1 == 1.1, "1.1 == 1.1") +ok("1" == "1", "\"1\" == \"1\"") + +ok(false != "1", "false != \"1\"") +ok(false != true, "false != true") +ok(false == false, "false == false") +ok(true == true, "true == true") +ok(false == false, "false == false") +ok(nil == nil, "nil == nil") + +ok(1 <= 1, "1 <= 1") +ok(1.0 <= 1.0, "1.0 <= 1.0") + +is(true, 1 <= 2 ? true : false, "1 == 1 ? true : false") + +a = 1; a += 1 +is(2, a, "+=") + +a = 2; a -= 1 +is(1, a, "-=") + +a = 2; a *= 2 +is(4, a, "*=") + +a = 3; a /= 2 +is(1.5, a, "/=") + +a = 2; a++ +is(3, a, "++") + +a = 2; a-- +is(1, a, "--") + +a = 2**3 +is(8, a, "**") + +a = 1; a &= 2 +is(0, a, "&=") + +a = 1; a |= 2 +is(3, a, "|=") + +a = !3 +is(false, a, "!3") + +a = !true +is(false, a, "!true") + +a = !false +is(true, a, "!false") + +a = ^3 +is(-4, a, "^3") + +a = 3 << 2 +is(12, a, "3 << 2") + +a = 11 >> 2 +is(2, a, "11 >> 2") + +# vim: set ft=anko: + diff --git a/vendor/github.com/mattn/anko/t/04-func.ank b/vendor/github.com/mattn/anko/t/04-func.ank new file mode 100644 index 0000000000..0440e1595e --- /dev/null +++ b/vendor/github.com/mattn/anko/t/04-func.ank @@ -0,0 +1,23 @@ +func a() { return 2 } +is(2, a(), "func a() { return 2 }") + +func b(x) { return x + 1 } +is(3, b(2), "func b(x) { return x + 1 }") + +func c(x) { return x, x + 1 } +is([2,3], c(2), "func c(x) { return x, x + 1 }") + +func d(x) { return func() { return x + 1 } } +is(3, d(2)(), "func d(x) { return func() { return x + 1 } }") + +var x = func(x) { + return func(y) { + x(y) + } +}(func(z) { + return "Yay! " + z +})("hello world") + +is("Yay! hello world", x, "...") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/05-len.ank b/vendor/github.com/mattn/anko/t/05-len.ank new file mode 100644 index 0000000000..fd4072893f --- /dev/null +++ b/vendor/github.com/mattn/anko/t/05-len.ank @@ -0,0 +1,5 @@ +is(3, len("foo"), "len(\"foo\")") +is(0, len(""), "len(\"\")") +is(4, len([1,2,true,["foo"]]), "len([1,2,true,[\"foo\"]])") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/06-for.ank b/vendor/github.com/mattn/anko/t/06-for.ank new file mode 100644 index 0000000000..22a1e449e8 --- /dev/null +++ b/vendor/github.com/mattn/anko/t/06-for.ank @@ -0,0 +1,74 @@ +x = 0 +for a in [1,2,3] { + x += 1 +} +is(3, x, "for a in range [1,2,3]") + +x = 0 + +for { + x += 1 + if (x > 3) { + break + } +} +is(4, x, "for loop") + +func loop_with_return_stmt() { + y = 0 + for { + if y == 5 { + return y + } + y++ + } + return 1 +} +is(5, loop_with_return_stmt(), "loop with return stmt") + +func for_with_return_stmt() { + y = 0 + for k in range(0, 10) { + if k == 5 { + return y + } + y++ + } + return 1 +} +is(5, for_with_return_stmt(), "for loop with return stmt") + +x = 0 +for a = 0; a < 10; a++ { + x++ +} +is(10, x, "C-style for loop") + +func cstylefor_with_return_stmt() { + y = 0 + for i = 0; i < 10; i++ { + if i == 5 { + return y + } + y++ + } + + return 1 +} + +is(5, cstylefor_with_return_stmt(), "C-style for loop with return statement") + +resp = { + "items": [{ + "someData": 2, + }] +} + +x = 0 +for item in resp.items { + x += item.someData +} + +is(2, x, "dereference slice element") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/07-switch.ank b/vendor/github.com/mattn/anko/t/07-switch.ank new file mode 100644 index 0000000000..707814f35c --- /dev/null +++ b/vendor/github.com/mattn/anko/t/07-switch.ank @@ -0,0 +1,39 @@ +x = 0 +r = -1 +switch x { +case 0: + r = 0 +case 1: + r = 1 +case 2: + r = 2 +} +is(0, r, "switch/case") + +x = 3 +r = -1 +switch x { +case 0: + r = 0 +case 1: + r = 1 +case 2: + r = 2 +} +is(-1, r, "switch/case") + +x = 3 +r = -1 +switch x { +case 0: + r = 0 +case 1: + r = 1 +case 2: + r = 2 +default: + r = 3 +} +is(3, r, "switch/default") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/08-if.ank b/vendor/github.com/mattn/anko/t/08-if.ank new file mode 100644 index 0000000000..5e92cded3b --- /dev/null +++ b/vendor/github.com/mattn/anko/t/08-if.ank @@ -0,0 +1,15 @@ +#!anko + +r = -1 +if (false) { + r = 1 +} else if (false) { + r = 2 +} else if (false) { + r = 3 +} else { + r = 4 +} +is(4, r, "if") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/09-toBytes.ank b/vendor/github.com/mattn/anko/t/09-toBytes.ank new file mode 100644 index 0000000000..20153e8a56 --- /dev/null +++ b/vendor/github.com/mattn/anko/t/09-toBytes.ank @@ -0,0 +1,11 @@ +a = toByteSlice("あいうえお") +b = [227, 129, 130, 227, 129, 132, 227, 129, 134, 227, 129, 136, 227, 129, 138] +x = 0 +for i = 0; i < len(a); i++ { + if (a[i] == b[i]) { + x++ + } +} +is(x, len(a), "toByteSlice(str)") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/10-toRunes.ank b/vendor/github.com/mattn/anko/t/10-toRunes.ank new file mode 100644 index 0000000000..7b0f14efc8 --- /dev/null +++ b/vendor/github.com/mattn/anko/t/10-toRunes.ank @@ -0,0 +1,11 @@ +a = toRuneSlice("あいうえお") +b = [12354, 12356, 12358, 12360, 12362] +x = 0 +for i = 0; i < len(a); i++ { + if (a[i] == b[i]) { + x++ + } +} +is(x, len(a), "toRuneSlice(str)") + +# vim: set ft=anko: diff --git a/vendor/github.com/mattn/anko/t/lib/tester.ank b/vendor/github.com/mattn/anko/t/lib/tester.ank new file mode 100644 index 0000000000..1699e552ec --- /dev/null +++ b/vendor/github.com/mattn/anko/t/lib/tester.ank @@ -0,0 +1,43 @@ +var colortext = import("github.com/daviddengcn/go-colortext") + +count = func() { + var n = 0 + return func() { + n += 1 + return n + } +}() + +func is(expect, got, name) { + if (expect == got) { + printf("%03d: %s: ", count(), name) + colortext.ChangeColor("green", true) + println("OK") + colortext.ResetColor() + } else { + printf("%03d: %s: %v %v ", count(), name, expect, got) + colortext.ChangeColor("red", true) + println("NG") + colortext.ResetColor() + } +} + +func ok(expect, name) { + if (expect) { + printf("%03d: %s: ", count(), name) + colortext.ChangeColor("green", true) + println("OK") + colortext.ResetColor() + } else { + printf("%03d: %s: ", count(), name) + colortext.ChangeColor("red", true) + println("NG") + colortext.ResetColor() + throw name + ": expected " + expect + " but got " + got + } +} + +if (len(args) > 0) { + println(args[0]) + load(args[0]) +} diff --git a/vendor/github.com/mattn/anko/t/test.bat b/vendor/github.com/mattn/anko/t/test.bat new file mode 100644 index 0000000000..2d47f61dad --- /dev/null +++ b/vendor/github.com/mattn/anko/t/test.bat @@ -0,0 +1,13 @@ +@echo off + +setlocal enabledelayedexpansion +set DIR=%~dp0 +(cd %DIR%.. && go build) +if !ERRORLEVEL! neq 0 goto error +for %%i in (%DIR%*.ank) do ( + %DIR%..\anko %DIR%lib\tester.ank %%i + if !ERRORLEVEL! neq 0 goto error +) +exit /b 0 +:error +exit /b 1 diff --git a/vendor/github.com/mattn/anko/t/test.sh b/vendor/github.com/mattn/anko/t/test.sh new file mode 100644 index 0000000000..2f44d31ba1 --- /dev/null +++ b/vendor/github.com/mattn/anko/t/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +DIR=$(cd $(dirname $0);pwd) + +ls $DIR/*.ank |\ +while read f; do + $DIR/../anko $DIR/lib/tester.ank $f +done diff --git a/vendor/github.com/mattn/anko/tool/makebuiltin.go b/vendor/github.com/mattn/anko/tool/makebuiltin.go new file mode 100644 index 0000000000..c08a2fad27 --- /dev/null +++ b/vendor/github.com/mattn/anko/tool/makebuiltin.go @@ -0,0 +1,128 @@ +package main + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "log" + "os" + "os/exec" + "path/filepath" + "sort" + "strings" +) + +func pkgName(f string) string { + file, err := parser.ParseFile(token.NewFileSet(), f, nil, parser.PackageClauseOnly) + if err != nil || file == nil { + return "" + } + return file.Name.Name +} + +func isGoFile(dir os.FileInfo) bool { + return !dir.IsDir() && + !strings.HasPrefix(dir.Name(), ".") && // ignore .files + filepath.Ext(dir.Name()) == ".go" +} + +func isPkgFile(dir os.FileInfo) bool { + return isGoFile(dir) && !strings.HasSuffix(dir.Name(), "_test.go") // ignore test files +} + +func parseDir(p string) (map[string]*ast.Package, error) { + _, pn := filepath.Split(p) + + isGoDir := func(d os.FileInfo) bool { + if isPkgFile(d) { + name := pkgName(p + "/" + d.Name()) + return name == pn + } + return false + } + + pkgs, err := parser.ParseDir(token.NewFileSet(), p, isGoDir, parser.ParseComments) + if err != nil { + return nil, err + } + return pkgs, nil +} + +func main() { + pkg := "flag" + if len(os.Args) == 2 { + pkg = os.Args[1] + } + b, err := exec.Command("go", "env", "GOROOT").CombinedOutput() + if err != nil { + log.Fatal(err) + } + paths := []string{filepath.Join(strings.TrimSpace(string(b)), "src")} + b, err = exec.Command("go", "env", "GOPATH").CombinedOutput() + if err != nil { + log.Fatal(err) + } + for _, p := range strings.Split(strings.TrimSpace(string(b)), string(filepath.ListSeparator)) { + paths = append(paths, filepath.Join(p, "src")) + } + for _, p := range paths { + pp := filepath.Join(p, pkg) + pkgs, err := parseDir(pp) + if err != nil { + continue + } + names := map[string]bool{} + for _, pp := range pkgs { + for _, f := range pp.Files { + for _, d := range f.Decls { + switch decl := d.(type) { + case *ast.GenDecl: + for _, spec := range decl.Specs { + if vspec, ok := spec.(*ast.ValueSpec); ok { + for _, n := range vspec.Names { + c := n.Name[0] + if c < 'A' || c > 'Z' { + continue + } + names[n.Name] = true + } + } + } + case *ast.FuncDecl: + if decl.Recv != nil { + continue + } + c := decl.Name.Name[0] + if c < 'A' || c > 'Z' { + continue + } + names[decl.Name.Name] = true + } + } + } + } + keys := []string{} + for k, _ := range names { + keys = append(keys, k) + } + sort.Strings(keys) + _, pn := filepath.Split(pkg) + fmt.Printf(`// Package %s implements %s interface for anko script. +package %s + +import ( + "github.com/mattn/anko/vm" + pkg "%s" +) + +func Import(env *vm.Env) *vm.Env { + m := env.NewModule("%s") +`, pn, pkg, pn, pkg, pn) + for _, k := range keys { + fmt.Printf("\t"+`m.Define("%s", pkg.%s)`+"\n", k, k) + } + fmt.Println("\treturn m") + fmt.Println("}") + } +} diff --git a/vendor/github.com/mattn/anko/vm/doc.go b/vendor/github.com/mattn/anko/vm/doc.go new file mode 100644 index 0000000000..6bbb194516 --- /dev/null +++ b/vendor/github.com/mattn/anko/vm/doc.go @@ -0,0 +1,2 @@ +// Package vm implements virtual-machine for anko. +package vm diff --git a/vendor/github.com/mattn/anko/vm/env.go b/vendor/github.com/mattn/anko/vm/env.go new file mode 100644 index 0000000000..0e431e2b33 --- /dev/null +++ b/vendor/github.com/mattn/anko/vm/env.go @@ -0,0 +1,258 @@ +package vm + +import ( + "fmt" + "reflect" + "strings" + "sync" + + "github.com/mattn/anko/parser" +) + +// Env provides interface to run VM. This mean function scope and blocked-scope. +// If stack goes to blocked-scope, it will make new Env. +type Env struct { + name string + env map[string]reflect.Value + typ map[string]reflect.Type + parent *Env + interrupt *bool + sync.RWMutex +} + +// NewEnv creates new global scope. +func NewEnv() *Env { + b := false + + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: nil, + interrupt: &b, + } +} + +// NewEnv creates new child scope. +func (e *Env) NewEnv() *Env { + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: e, + name: e.name, + interrupt: e.interrupt, + } +} + +func NewPackage(n string) *Env { + b := false + + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: nil, + name: n, + interrupt: &b, + } +} + +func (e *Env) NewPackage(n string) *Env { + return &Env{ + env: make(map[string]reflect.Value), + typ: make(map[string]reflect.Type), + parent: e, + name: n, + interrupt: e.interrupt, + } +} + +// Destroy deletes current scope. +func (e *Env) Destroy() { + e.Lock() + defer e.Unlock() + + if e.parent == nil { + return + } + for k, v := range e.parent.env { + if v.IsValid() && v.Interface() == e { + delete(e.parent.env, k) + } + } + e.parent = nil + e.env = nil +} + +// NewModule creates new module scope as global. +func (e *Env) NewModule(n string) *Env { + m := &Env{ + env: make(map[string]reflect.Value), + parent: e, + name: n, + } + e.Define(n, m) + return m +} + +// SetName sets a name of the scope. This means that the scope is module. +func (e *Env) SetName(n string) { + e.Lock() + e.name = n + e.Unlock() +} + +// GetName returns module name. +func (e *Env) GetName() string { + e.RLock() + defer e.RUnlock() + + return e.name +} + +// Addr returns pointer value which specified symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Addr(k string) (reflect.Value, error) { + e.RLock() + defer e.RUnlock() + + if v, ok := e.env[k]; ok { + return v.Addr(), nil + } + if e.parent == nil { + return NilValue, fmt.Errorf("Undefined symbol '%s'", k) + } + return e.parent.Addr(k) +} + +// Type returns type which specified symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Type(k string) (reflect.Type, error) { + e.RLock() + defer e.RUnlock() + + if v, ok := e.typ[k]; ok { + return v, nil + } + if e.parent == nil { + return NilType, fmt.Errorf("Undefined type '%s'", k) + } + return e.parent.Type(k) +} + +// Get returns value which specified symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Get(k string) (reflect.Value, error) { + e.RLock() + defer e.RUnlock() + + if v, ok := e.env[k]; ok { + return v, nil + } + if e.parent == nil { + return NilValue, fmt.Errorf("Undefined symbol '%s'", k) + } + return e.parent.Get(k) +} + +// Set modifies value which specified as symbol. It goes to upper scope until +// found or returns error. +func (e *Env) Set(k string, v interface{}) error { + e.Lock() + defer e.Unlock() + + if _, ok := e.env[k]; ok { + val, ok := v.(reflect.Value) + if !ok { + val = reflect.ValueOf(v) + } + e.env[k] = val + return nil + } + if e.parent == nil { + return fmt.Errorf("Unknown symbol '%s'", k) + } + return e.parent.Set(k, v) +} + +// DefineGlobal defines symbol in global scope. +func (e *Env) DefineGlobal(k string, v interface{}) error { + if e.parent == nil { + return e.Define(k, v) + } + return e.parent.DefineGlobal(k, v) +} + +// DefineType defines type which specifis symbol in global scope. +func (e *Env) DefineType(k string, t interface{}) error { + if strings.Contains(k, ".") { + return fmt.Errorf("Unknown symbol '%s'", k) + } + global := e + keys := []string{k} + + e.RLock() + for global.parent != nil { + if global.name != "" { + keys = append(keys, global.name) + } + global = global.parent + } + e.RUnlock() + + for i, j := 0, len(keys)-1; i < j; i, j = i+1, j-1 { + keys[i], keys[j] = keys[j], keys[i] + } + + typ, ok := t.(reflect.Type) + if !ok { + typ = reflect.TypeOf(t) + } + + global.Lock() + global.typ[strings.Join(keys, ".")] = typ + global.Unlock() + + return nil +} + +// Define defines symbol in current scope. +func (e *Env) Define(k string, v interface{}) error { + if strings.Contains(k, ".") { + return fmt.Errorf("Unknown symbol '%s'", k) + } + val, ok := v.(reflect.Value) + if !ok { + val = reflect.ValueOf(v) + } + + e.Lock() + e.env[k] = val + e.Unlock() + + return nil +} + +// String return the name of current scope. +func (e *Env) String() string { + e.RLock() + defer e.RUnlock() + + return e.name +} + +// Dump show symbol values in the scope. +func (e *Env) Dump() { + e.RLock() + for k, v := range e.env { + fmt.Printf("%v = %#v\n", k, v) + } + e.RUnlock() +} + +// Execute parses and runs source in current scope. +func (e *Env) Execute(src string) (reflect.Value, error) { + stmts, err := parser.ParseSrc(src) + if err != nil { + return NilValue, err + } + return Run(stmts, e) +} diff --git a/vendor/github.com/mattn/anko/vm/env_test.go b/vendor/github.com/mattn/anko/vm/env_test.go new file mode 100644 index 0000000000..36fb47172a --- /dev/null +++ b/vendor/github.com/mattn/anko/vm/env_test.go @@ -0,0 +1,202 @@ +package vm + +import ( + "reflect" + "testing" +) + +func TestGet(t *testing.T) { + env := NewEnv() + env.Define("foo", "bar") + + v, err := env.Get("foo") + if err != nil { + t.Fatalf(`Can't Get value for "foo"`) + } + if v.Kind() != reflect.String { + t.Fatalf(`Can't Get string value for "foo"`) + } + if v.String() != "bar" { + t.Fatalf("Expected %v, but %v:", "bar", v.String()) + } +} + +func TestDefine(t *testing.T) { + env := NewEnv() + env.Define("foo", "bar") + sub := env.NewEnv() + + v, err := sub.Get("foo") + if err != nil { + t.Fatalf(`Can't Get value for "foo"`) + } + if v.Kind() != reflect.String { + t.Fatalf(`Can't Get string value for "foo"`) + } + if v.String() != "bar" { + t.Fatalf("Expected %v, but %v:", "bar", v.String()) + } +} + +func TestDefineModify(t *testing.T) { + env := NewEnv() + env.Define("foo", "bar") + sub := env.NewEnv() + sub.Define("foo", true) + + v, err := sub.Get("foo") + if err != nil { + t.Fatalf(`Can't Get value for "foo"`) + } + if v.Kind() != reflect.Bool { + t.Fatalf(`Can't Get bool value for "foo"`) + } + if v.Bool() != true { + t.Fatalf("Expected %v, but %v:", true, v.Bool()) + } + + v, err = env.Get("foo") + if err != nil { + t.Fatalf(`Can't Get value for "foo"`) + } + if v.Kind() != reflect.String { + t.Fatalf(`Can't Get string value for "foo"`) + } + if v.String() != "bar" { + t.Fatalf("Expected %v, but %v:", "bar", v.String()) + } +} + +func TestDefineType(t *testing.T) { + env := NewEnv() + env.DefineType("int", int(0)) + sub := env.NewEnv() + sub.DefineType("str", "") + pkg := env.NewPackage("pkg") + pkg.DefineType("Bool", true) + + for _, e := range []*Env{env, sub, pkg} { + typ, err := e.Type("int") + if err != nil { + t.Fatalf(`Can't get Type for "int"`) + } + if typ.Kind() != reflect.Int { + t.Fatalf(`Can't get int Type for "int"`) + } + + typ, err = e.Type("str") + if err != nil { + t.Fatalf(`Can't get Type for "str"`) + } + if typ.Kind() != reflect.String { + t.Fatalf(`Can't get string Type for "str"`) + } + + typ, err = e.Type("pkg.Bool") + if err != nil { + t.Fatalf(`Can't get Type for "pkg.Bool"`) + } + if typ.Kind() != reflect.Bool { + t.Fatalf(`Can't get bool Type for "pkg.Bool"`) + } + } +} + +func TestEnvRaces(t *testing.T) { + // Create env + env := NewEnv() + + // Define some values in parallel + go env.Define("foo", "bar") + go env.Define("bar", "foo") + go env.Define("one", "two") + go env.Define("hello", "there") + go env.Define("hey", "ho") + + // Get some values in parallel + go func(env *Env, t *testing.T) { + _, err := env.Get("foo") + if err != nil { + t.Fatalf(`Can't Get value for "foo"`) + } + }(env, t) + + go func(env *Env, t *testing.T) { + _, err := env.Get("bar") + if err != nil { + t.Fatalf(`Can't Get value for "bar"`) + } + }(env, t) + + go func(env *Env, t *testing.T) { + _, err := env.Get("one") + if err != nil { + t.Fatalf(`Can't Get value for "one"`) + } + }(env, t) + + go func(env *Env, t *testing.T) { + _, err := env.Get("hello") + if err != nil { + t.Fatalf(`Can't Get value for "hello"`) + } + }(env, t) + + go func(env *Env, t *testing.T) { + _, err := env.Get("hey") + if err != nil { + t.Fatalf(`Can't Get value for "hey"`) + } + }(env, t) + + // Get subs + go func(env *Env, t *testing.T) { + sub := env.NewEnv() + + _, err := sub.Get("foo") + if err != nil { + t.Fatalf(`Can't Get value for "foo"`) + } + }(env, t) + + go func(env *Env, t *testing.T) { + sub := env.NewEnv() + + _, err := sub.Get("one") + if err != nil { + t.Fatalf(`Can't Get value for "one"`) + } + }(env, t) + + go func(env *Env, t *testing.T) { + sub := env.NewEnv() + + _, err := sub.Get("bar") + if err != nil { + t.Fatalf(`Can't Get value for "bar"`) + } + }(env, t) + + // Define some types + go env.DefineType("int", int(0)) + go env.DefineType("str", "") + + // Define packages + go func(env *Env, t *testing.T) { + pkg := env.NewPackage("pkg") + pkg.DefineType("Bool", true) + }(env, t) + + go func(env *Env, t *testing.T) { + pkg := env.NewPackage("pkg2") + pkg.DefineType("Bool", true) + }(env, t) + + // Get some types + go env.Type("int") + go env.Type("str") + go env.Type("int") + go env.Type("str") + go env.Type("int") + go env.Type("str") +} diff --git a/vendor/github.com/mattn/anko/vm/example_test.go b/vendor/github.com/mattn/anko/vm/example_test.go new file mode 100644 index 0000000000..55148c559f --- /dev/null +++ b/vendor/github.com/mattn/anko/vm/example_test.go @@ -0,0 +1,48 @@ +package vm_test + +import ( + "fmt" + "log" + "time" + + "github.com/mattn/anko/parser" + "github.com/mattn/anko/vm" +) + +func ExampleInterrupt() { + env := vm.NewEnv() + + var sleepFunc = func(spec string) { + if d, err := time.ParseDuration(spec); err != nil { + panic(err) + } else { + time.Sleep(d) + } + } + + env.Define("println", fmt.Println) + env.Define("sleep", sleepFunc) + + script := ` +sleep("2s") +# Should interrupt here. +# The next line will not be executed. +println("") +` + stmts, err := parser.ParseSrc(script) + if err != nil { + log.Fatal() + } + + // Interrupts after 1 second. + go func() { + time.Sleep(time.Second) + vm.Interrupt(env) + }() + + // Run script + v, err := vm.Run(stmts, env) + fmt.Println(v, err) + // output: + // Execution interrupted +} diff --git a/vendor/github.com/mattn/anko/vm/vm.go b/vendor/github.com/mattn/anko/vm/vm.go new file mode 100644 index 0000000000..7e85d5b438 --- /dev/null +++ b/vendor/github.com/mattn/anko/vm/vm.go @@ -0,0 +1,1504 @@ +package vm + +import ( + "errors" + "fmt" + "math" + "os" + "reflect" + "strconv" + "strings" + + "github.com/mattn/anko/ast" + "github.com/mattn/anko/parser" +) + +var ( + NilValue = reflect.ValueOf((*interface{})(nil)) + NilType = reflect.TypeOf((*interface{})(nil)) + TrueValue = reflect.ValueOf(true) + FalseValue = reflect.ValueOf(false) +) + +// Error provides a convenient interface for handling runtime error. +// It can be Error interface with type cast which can call Pos(). +type Error struct { + Message string + Pos ast.Position +} + +var ( + BreakError = errors.New("Unexpected break statement") + ContinueError = errors.New("Unexpected continue statement") + ReturnError = errors.New("Unexpected return statement") + InterruptError = errors.New("Execution interrupted") +) + +// NewStringError makes error interface with message. +func NewStringError(pos ast.Pos, err string) error { + if pos == nil { + return &Error{Message: err, Pos: ast.Position{1, 1}} + } + return &Error{Message: err, Pos: pos.Position()} +} + +// NewErrorf makes error interface with message. +func NewErrorf(pos ast.Pos, format string, args ...interface{}) error { + return &Error{Message: fmt.Sprintf(format, args...), Pos: pos.Position()} +} + +// NewError makes error interface with message. +// This doesn't overwrite last error. +func NewError(pos ast.Pos, err error) error { + if err == nil { + return nil + } + if err == BreakError || err == ContinueError || err == ReturnError { + return err + } + if pe, ok := err.(*parser.Error); ok { + return pe + } + if ee, ok := err.(*Error); ok { + return ee + } + return &Error{Message: err.Error(), Pos: pos.Position()} +} + +// Error returns the error message. +func (e *Error) Error() string { + return e.Message +} + +// Func is function interface to reflect functions internaly. +type Func func(args ...reflect.Value) (reflect.Value, error) + +func (f Func) String() string { + return fmt.Sprintf("[Func: %p]", f) +} + +func ToFunc(f Func) reflect.Value { + return reflect.ValueOf(f) +} + +// Run executes statements in the specified environment. +func Run(stmts []ast.Stmt, env *Env) (reflect.Value, error) { + rv := NilValue + var err error + for _, stmt := range stmts { + if _, ok := stmt.(*ast.BreakStmt); ok { + return NilValue, BreakError + } + if _, ok := stmt.(*ast.ContinueStmt); ok { + return NilValue, ContinueError + } + rv, err = RunSingleStmt(stmt, env) + if err != nil { + return rv, err + } + if _, ok := stmt.(*ast.ReturnStmt); ok { + return reflect.ValueOf(rv), ReturnError + } + } + return rv, nil +} + +// Interrupts the execution of any running statements in the specified environment. +// +// Note that the execution is not instantly aborted: after a call to Interrupt, +// the current running statement will finish, but the next statement will not run, +// and instead will return a NilValue and an InterruptError. +func Interrupt(env *Env) { + env.Lock() + *(env.interrupt) = true + env.Unlock() +} + +// RunSingleStmt executes one statement in the specified environment. +func RunSingleStmt(stmt ast.Stmt, env *Env) (reflect.Value, error) { + env.Lock() + if *(env.interrupt) { + *(env.interrupt) = false + env.Unlock() + + return NilValue, InterruptError + } + env.Unlock() + + switch stmt := stmt.(type) { + case *ast.ExprStmt: + rv, err := invokeExpr(stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + return rv, nil + case *ast.VarStmt: + rv := NilValue + var err error + rvs := []reflect.Value{} + for _, expr := range stmt.Exprs { + rv, err = invokeExpr(expr, env) + if err != nil { + return rv, NewError(expr, err) + } + rvs = append(rvs, rv) + } + result := []interface{}{} + for i, name := range stmt.Names { + if i < len(rvs) { + env.Define(name, rvs[i]) + result = append(result, rvs[i].Interface()) + } + } + return reflect.ValueOf(result), nil + case *ast.LetsStmt: + rv := NilValue + var err error + vs := []interface{}{} + for _, rhs := range stmt.Rhss { + rv, err = invokeExpr(rhs, env) + if err != nil { + return rv, NewError(rhs, err) + } + if rv == NilValue { + vs = append(vs, nil) + } else if rv.IsValid() && rv.CanInterface() { + vs = append(vs, rv.Interface()) + } else { + vs = append(vs, nil) + } + } + rvs := reflect.ValueOf(vs) + if len(stmt.Lhss) > 1 && rvs.Len() == 1 { + item := rvs.Index(0) + if item.Kind() == reflect.Interface { + item = item.Elem() + } + if item.Kind() == reflect.Slice { + rvs = item + } + } + for i, lhs := range stmt.Lhss { + if i >= rvs.Len() { + break + } + v := rvs.Index(i) + if v.Kind() == reflect.Interface { + v = v.Elem() + } + _, err = invokeLetExpr(lhs, v, env) + if err != nil { + return rvs, NewError(lhs, err) + } + } + if rvs.Len() == 1 { + return rvs.Index(0), nil + } + return rvs, nil + case *ast.IfStmt: + // If + rv, err := invokeExpr(stmt.If, env) + if err != nil { + return rv, NewError(stmt, err) + } + if toBool(rv) { + // Then + newenv := env.NewEnv() + defer newenv.Destroy() + rv, err = Run(stmt.Then, newenv) + if err != nil { + return rv, NewError(stmt, err) + } + return rv, nil + } + done := false + if len(stmt.ElseIf) > 0 { + for _, stmt := range stmt.ElseIf { + stmt_if := stmt.(*ast.IfStmt) + // ElseIf + rv, err = invokeExpr(stmt_if.If, env) + if err != nil { + return rv, NewError(stmt, err) + } + if !toBool(rv) { + continue + } + // ElseIf Then + done = true + rv, err = Run(stmt_if.Then, env) + if err != nil { + return rv, NewError(stmt, err) + } + break + } + } + if !done && len(stmt.Else) > 0 { + // Else + newenv := env.NewEnv() + defer newenv.Destroy() + rv, err = Run(stmt.Else, newenv) + if err != nil { + return rv, NewError(stmt, err) + } + } + return rv, nil + case *ast.TryStmt: + newenv := env.NewEnv() + defer newenv.Destroy() + _, err := Run(stmt.Try, newenv) + if err != nil { + // Catch + cenv := env.NewEnv() + defer cenv.Destroy() + if stmt.Var != "" { + cenv.Define(stmt.Var, reflect.ValueOf(err)) + } + _, e1 := Run(stmt.Catch, cenv) + if e1 != nil { + err = NewError(stmt.Catch[0], e1) + } else { + err = nil + } + } + if len(stmt.Finally) > 0 { + // Finally + fenv := env.NewEnv() + defer fenv.Destroy() + _, e2 := Run(stmt.Finally, newenv) + if e2 != nil { + err = NewError(stmt.Finally[0], e2) + } + } + return NilValue, NewError(stmt, err) + case *ast.LoopStmt: + newenv := env.NewEnv() + defer newenv.Destroy() + for { + if stmt.Expr != nil { + ev, ee := invokeExpr(stmt.Expr, newenv) + if ee != nil { + return ev, ee + } + if !toBool(ev) { + break + } + } + + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + if err == BreakError { + err = nil + break + } + if err == ContinueError { + err = nil + continue + } + if err == ReturnError { + return rv, err + } + return rv, NewError(stmt, err) + } + } + return NilValue, nil + case *ast.ForStmt: + val, ee := invokeExpr(stmt.Value, env) + if ee != nil { + return val, ee + } + if val.Kind() == reflect.Interface { + val = val.Elem() + } + if val.Kind() != reflect.Array && val.Kind() != reflect.Slice { + return NilValue, NewStringError(stmt, "Invalid operation for non-array value") + } + newenv := env.NewEnv() + defer newenv.Destroy() + + for i := 0; i < val.Len(); i++ { + iv := val.Index(i) + if val.Index(i).Kind() == reflect.Interface || val.Index(i).Kind() == reflect.Ptr { + iv = iv.Elem() + } + newenv.Define(stmt.Var, iv) + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + if err == BreakError { + err = nil + break + } + if err == ContinueError { + err = nil + continue + } + if err == ReturnError { + return rv, err + } + return rv, NewError(stmt, err) + } + } + return NilValue, nil + case *ast.CForStmt: + newenv := env.NewEnv() + defer newenv.Destroy() + _, err := invokeExpr(stmt.Expr1, newenv) + if err != nil { + return NilValue, err + } + for { + fb, err := invokeExpr(stmt.Expr2, newenv) + if err != nil { + return NilValue, err + } + if !toBool(fb) { + break + } + + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + if err == BreakError { + err = nil + break + } + if err == ContinueError { + err = nil + continue + } + if err == ReturnError { + return rv, err + } + return rv, NewError(stmt, err) + } + _, err = invokeExpr(stmt.Expr3, newenv) + if err != nil { + return NilValue, err + } + } + return NilValue, nil + case *ast.ReturnStmt: + rvs := []interface{}{} + switch len(stmt.Exprs) { + case 0: + return NilValue, nil + case 1: + rv, err := invokeExpr(stmt.Exprs[0], env) + if err != nil { + return rv, NewError(stmt, err) + } + return rv, nil + } + for _, expr := range stmt.Exprs { + rv, err := invokeExpr(expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + if isNil(rv) { + rvs = append(rvs, nil) + } else if rv.IsValid() { + rvs = append(rvs, rv.Interface()) + } else { + rvs = append(rvs, nil) + } + } + return reflect.ValueOf(rvs), nil + case *ast.ThrowStmt: + rv, err := invokeExpr(stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + if !rv.IsValid() { + return NilValue, NewError(stmt, err) + } + return rv, NewStringError(stmt, fmt.Sprint(rv.Interface())) + case *ast.ModuleStmt: + newenv := env.NewEnv() + newenv.SetName(stmt.Name) + rv, err := Run(stmt.Stmts, newenv) + if err != nil { + return rv, NewError(stmt, err) + } + env.DefineGlobal(stmt.Name, reflect.ValueOf(newenv)) + return rv, nil + case *ast.SwitchStmt: + rv, err := invokeExpr(stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + done := false + var default_stmt *ast.DefaultStmt + for _, ss := range stmt.Cases { + if ssd, ok := ss.(*ast.DefaultStmt); ok { + default_stmt = ssd + continue + } + case_stmt := ss.(*ast.CaseStmt) + cv, err := invokeExpr(case_stmt.Expr, env) + if err != nil { + return rv, NewError(stmt, err) + } + if !equal(rv, cv) { + continue + } + rv, err = Run(case_stmt.Stmts, env) + if err != nil { + return rv, NewError(stmt, err) + } + done = true + break + } + if !done && default_stmt != nil { + rv, err = Run(default_stmt.Stmts, env) + if err != nil { + return rv, NewError(stmt, err) + } + } + return rv, nil + default: + return NilValue, NewStringError(stmt, "unknown statement") + } +} + +// toString converts all reflect.Value-s into string. +func toString(v reflect.Value) string { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.String { + return v.String() + } + if !v.IsValid() { + return "nil" + } + return fmt.Sprint(v.Interface()) +} + +// toBool converts all reflect.Value-s into bool. +func toBool(v reflect.Value) bool { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + + switch v.Kind() { + case reflect.Float32, reflect.Float64: + return v.Float() != 0.0 + case reflect.Int, reflect.Int32, reflect.Int64: + return v.Int() != 0 + case reflect.Bool: + return v.Bool() + case reflect.String: + if v.String() == "true" { + return true + } + if toInt64(v) != 0 { + return true + } + } + return false +} + +// toFloat64 converts all reflect.Value-s into float64. +func toFloat64(v reflect.Value) float64 { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + switch v.Kind() { + case reflect.Float32, reflect.Float64: + return v.Float() + case reflect.Int, reflect.Int32, reflect.Int64: + return float64(v.Int()) + } + return 0.0 +} + +func isNil(v reflect.Value) bool { + if !v.IsValid() || v.Kind().String() == "unsafe.Pointer" { + return true + } + if (v.Kind() == reflect.Interface || v.Kind() == reflect.Ptr) && v.IsNil() { + return true + } + return false +} + +func isNum(v reflect.Value) bool { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: + return true + } + return false +} + +// equal returns true when lhsV and rhsV is same value. +func equal(lhsV, rhsV reflect.Value) bool { + lhsIsNil, rhsIsNil := isNil(lhsV), isNil(rhsV) + if lhsIsNil && rhsIsNil { + return true + } + if (!lhsIsNil && rhsIsNil) || (lhsIsNil && !rhsIsNil) { + return false + } + if lhsV.Kind() == reflect.Interface || lhsV.Kind() == reflect.Ptr { + lhsV = lhsV.Elem() + } + if rhsV.Kind() == reflect.Interface || rhsV.Kind() == reflect.Ptr { + rhsV = rhsV.Elem() + } + if !lhsV.IsValid() || !rhsV.IsValid() { + return true + } + if isNum(lhsV) && isNum(rhsV) { + if rhsV.Type().ConvertibleTo(lhsV.Type()) { + rhsV = rhsV.Convert(lhsV.Type()) + } + } + if lhsV.CanInterface() && rhsV.CanInterface() { + return reflect.DeepEqual(lhsV.Interface(), rhsV.Interface()) + } + return reflect.DeepEqual(lhsV, rhsV) +} + +// toInt64 converts all reflect.Value-s into int64. +func toInt64(v reflect.Value) int64 { + if v.Kind() == reflect.Interface { + v = v.Elem() + } + switch v.Kind() { + case reflect.Float32, reflect.Float64: + return int64(v.Float()) + case reflect.Int, reflect.Int32, reflect.Int64: + return v.Int() + case reflect.String: + s := v.String() + var i int64 + var err error + if strings.HasPrefix(s, "0x") { + i, err = strconv.ParseInt(s, 16, 64) + } else { + i, err = strconv.ParseInt(s, 10, 64) + } + if err == nil { + return int64(i) + } + } + return 0 +} + +func invokeLetExpr(expr ast.Expr, rv reflect.Value, env *Env) (reflect.Value, error) { + switch lhs := expr.(type) { + case *ast.IdentExpr: + if env.Set(lhs.Lit, rv) != nil { + if strings.Contains(lhs.Lit, ".") { + return NilValue, NewErrorf(expr, "Undefined symbol '%s'", lhs.Lit) + } + env.Define(lhs.Lit, rv) + } + return rv, nil + case *ast.MemberExpr: + v, err := invokeExpr(lhs.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + + if !v.IsValid() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + v = v.FieldByName(lhs.Name) + if !v.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + v.Set(rv) + } else if v.Kind() == reflect.Map { + v.SetMapIndex(reflect.ValueOf(lhs.Name), rv) + } else { + if !v.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + v.Set(rv) + } + return v, nil + case *ast.ItemExpr: + v, err := invokeExpr(lhs.Value, env) + if err != nil { + return v, NewError(expr, err) + } + i, err := invokeExpr(lhs.Index, env) + if err != nil { + return i, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if i.Kind() != reflect.Int && i.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(i.Int()) + if ii < 0 || ii >= v.Len() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv := v.Index(ii) + if !vv.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv.Set(rv) + return rv, nil + } + if v.Kind() == reflect.Map { + if i.Kind() != reflect.String { + return NilValue, NewStringError(expr, "Map key should be string") + } + v.SetMapIndex(i, rv) + return rv, nil + } + return v, NewStringError(expr, "Invalid operation") + case *ast.SliceExpr: + v, err := invokeExpr(lhs.Value, env) + if err != nil { + return v, NewError(expr, err) + } + rb, err := invokeExpr(lhs.Begin, env) + if err != nil { + return rb, NewError(expr, err) + } + re, err := invokeExpr(lhs.End, env) + if err != nil { + return re, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if rb.Kind() != reflect.Int && rb.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + if re.Kind() != reflect.Int && re.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(rb.Int()) + if ii < 0 || ii >= v.Len() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + ij := int(re.Int()) + if ij < 0 || ij >= v.Len() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv := v.Slice(ii, ij) + if !vv.CanSet() { + return NilValue, NewStringError(expr, "Cannot assignable") + } + vv.Set(rv) + return rv, nil + } + return v, NewStringError(expr, "Invalid operation") + } + return NilValue, NewStringError(expr, "Invalid operation") +} + +// invokeExpr evaluates one expression. +func invokeExpr(expr ast.Expr, env *Env) (reflect.Value, error) { + switch e := expr.(type) { + case *ast.NumberExpr: + if strings.Contains(e.Lit, ".") || strings.Contains(e.Lit, "e") { + v, err := strconv.ParseFloat(e.Lit, 64) + if err != nil { + return NilValue, NewError(expr, err) + } + return reflect.ValueOf(float64(v)), nil + } + var i int64 + var err error + if strings.HasPrefix(e.Lit, "0x") { + i, err = strconv.ParseInt(e.Lit[2:], 16, 64) + } else { + i, err = strconv.ParseInt(e.Lit, 10, 64) + } + if err != nil { + return NilValue, NewError(expr, err) + } + return reflect.ValueOf(i), nil + case *ast.IdentExpr: + return env.Get(e.Lit) + case *ast.StringExpr: + return reflect.ValueOf(e.Lit), nil + case *ast.ArrayExpr: + a := make([]interface{}, len(e.Exprs)) + for i, expr := range e.Exprs { + arg, err := invokeExpr(expr, env) + if err != nil { + return arg, NewError(expr, err) + } + a[i] = arg.Interface() + } + return reflect.ValueOf(a), nil + case *ast.MapExpr: + m := make(map[string]interface{}) + for k, expr := range e.MapExpr { + v, err := invokeExpr(expr, env) + if err != nil { + return v, NewError(expr, err) + } + m[k] = v.Interface() + } + return reflect.ValueOf(m), nil + case *ast.DerefExpr: + v := NilValue + var err error + switch ee := e.Expr.(type) { + case *ast.IdentExpr: + v, err = env.Get(ee.Lit) + if err != nil { + return v, err + } + case *ast.MemberExpr: + v, err := invokeExpr(ee.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + if v.IsValid() && v.CanInterface() { + if vme, ok := v.Interface().(*Env); ok { + m, err := vme.Get(ee.Name) + if !m.IsValid() || err != nil { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + return m, nil + } + } + + m := v.MethodByName(ee.Name) + if !m.IsValid() { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + m = v.FieldByName(ee.Name) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else if v.Kind() == reflect.Map { + m = v.MapIndex(reflect.ValueOf(ee.Name)) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + v = m + } else { + v = m + } + default: + return NilValue, NewStringError(expr, "Invalid operation for the value") + } + if v.Kind() != reflect.Ptr { + return NilValue, NewStringError(expr, "Cannot deference for the value") + } + return v.Addr(), nil + case *ast.AddrExpr: + v := NilValue + var err error + switch ee := e.Expr.(type) { + case *ast.IdentExpr: + v, err = env.Get(ee.Lit) + if err != nil { + return v, err + } + case *ast.MemberExpr: + v, err := invokeExpr(ee.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + if v.IsValid() && v.CanInterface() { + if vme, ok := v.Interface().(*Env); ok { + m, err := vme.Get(ee.Name) + if !m.IsValid() || err != nil { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + return m, nil + } + } + + m := v.MethodByName(ee.Name) + if !m.IsValid() { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + m = v.FieldByName(ee.Name) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else if v.Kind() == reflect.Map { + m = v.MapIndex(reflect.ValueOf(ee.Name)) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + } else { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", ee.Name)) + } + v = m + } else { + v = m + } + default: + return NilValue, NewStringError(expr, "Invalid operation for the value") + } + if !v.CanAddr() { + i := v.Interface() + return reflect.ValueOf(&i), nil + } + return v.Addr(), nil + case *ast.UnaryExpr: + v, err := invokeExpr(e.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + switch e.Operator { + case "-": + if v.Kind() == reflect.Float64 { + return reflect.ValueOf(-v.Float()), nil + } + return reflect.ValueOf(-v.Int()), nil + case "^": + return reflect.ValueOf(^toInt64(v)), nil + case "!": + return reflect.ValueOf(!toBool(v)), nil + default: + return NilValue, NewStringError(e, "Unknown operator ''") + } + case *ast.ParenExpr: + v, err := invokeExpr(e.SubExpr, env) + if err != nil { + return v, NewError(expr, err) + } + return v, nil + case *ast.FuncExpr: + f := reflect.ValueOf(func(expr *ast.FuncExpr, env *Env) Func { + return func(args ...reflect.Value) (reflect.Value, error) { + if !expr.VarArg { + if len(args) != len(expr.Args) { + return NilValue, NewStringError(expr, "Arguments Number of mismatch") + } + } + newenv := env.NewEnv() + if expr.VarArg { + newenv.Define(expr.Args[0], reflect.ValueOf(args)) + } else { + for i, arg := range expr.Args { + newenv.Define(arg, args[i]) + } + } + rr, err := Run(expr.Stmts, newenv) + if err == ReturnError { + err = nil + rr = rr.Interface().(reflect.Value) + } + return rr, err + } + }(e, env)) + env.Define(e.Name, f) + return f, nil + case *ast.MemberExpr: + v, err := invokeExpr(e.Expr, env) + if err != nil { + return v, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Slice { + v = v.Index(0) + } + if v.IsValid() && v.CanInterface() { + if vme, ok := v.Interface().(*Env); ok { + m, err := vme.Get(e.Name) + if !m.IsValid() || err != nil { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + return m, nil + } + } + + m := v.MethodByName(e.Name) + if !m.IsValid() { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if v.Kind() == reflect.Struct { + m = v.FieldByName(e.Name) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + } else if v.Kind() == reflect.Map { + m = v.MapIndex(reflect.ValueOf(e.Name)) + if !m.IsValid() { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + } else { + return NilValue, NewStringError(expr, fmt.Sprintf("Invalid operation '%s'", e.Name)) + } + } + return m, nil + case *ast.ItemExpr: + v, err := invokeExpr(e.Value, env) + if err != nil { + return v, NewError(expr, err) + } + i, err := invokeExpr(e.Index, env) + if err != nil { + return i, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if i.Kind() != reflect.Int && i.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(i.Int()) + if ii < 0 || ii >= v.Len() { + return NilValue, nil + } + return v.Index(ii), nil + } + if v.Kind() == reflect.Map { + if i.Kind() != reflect.String { + return NilValue, NewStringError(expr, "Map key should be string") + } + return v.MapIndex(i), nil + } + if v.Kind() == reflect.String { + rs := []rune(v.Interface().(string)) + ii := int(i.Int()) + if ii < 0 || ii >= len(rs) { + return NilValue, nil + } + return reflect.ValueOf(rs[ii]), nil + } + return v, NewStringError(expr, "Invalid operation") + case *ast.SliceExpr: + v, err := invokeExpr(e.Value, env) + if err != nil { + return v, NewError(expr, err) + } + rb, err := invokeExpr(e.Begin, env) + if err != nil { + return rb, NewError(expr, err) + } + re, err := invokeExpr(e.End, env) + if err != nil { + return re, NewError(expr, err) + } + if v.Kind() == reflect.Interface { + v = v.Elem() + } + if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { + if rb.Kind() != reflect.Int && rb.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + if re.Kind() != reflect.Int && re.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + ii := int(rb.Int()) + if ii < 0 || ii > v.Len() { + return NilValue, nil + } + ij := int(re.Int()) + if ij < 0 || ij > v.Len() { + return v, nil + } + return v.Slice(ii, ij), nil + } + if v.Kind() == reflect.String { + if rb.Kind() != reflect.Int && rb.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + if re.Kind() != reflect.Int && re.Kind() != reflect.Int64 { + return NilValue, NewStringError(expr, "Array index should be int") + } + r := []rune(v.String()) + ii := int(rb.Int()) + if ii < 0 || ii >= len(r) { + return NilValue, nil + } + ij := int(re.Int()) + if ij < 0 || ij >= len(r) { + return NilValue, nil + } + return reflect.ValueOf(string(r[ii:ij])), nil + } + return v, NewStringError(expr, "Invalid operation") + case *ast.AssocExpr: + switch e.Operator { + case "++": + if alhs, ok := e.Lhs.(*ast.IdentExpr); ok { + v, err := env.Get(alhs.Lit) + if err != nil { + return v, err + } + if v.Kind() == reflect.Float64 { + v = reflect.ValueOf(toFloat64(v) + 1.0) + } else { + v = reflect.ValueOf(toInt64(v) + 1) + } + if env.Set(alhs.Lit, v) != nil { + env.Define(alhs.Lit, v) + } + return v, nil + } + case "--": + if alhs, ok := e.Lhs.(*ast.IdentExpr); ok { + v, err := env.Get(alhs.Lit) + if err != nil { + return v, err + } + if v.Kind() == reflect.Float64 { + v = reflect.ValueOf(toFloat64(v) - 1.0) + } else { + v = reflect.ValueOf(toInt64(v) - 1) + } + if env.Set(alhs.Lit, v) != nil { + env.Define(alhs.Lit, v) + } + return v, nil + } + } + + v, err := invokeExpr(&ast.BinOpExpr{Lhs: e.Lhs, Operator: e.Operator[0:1], Rhs: e.Rhs}, env) + if err != nil { + return v, err + } + + if v.Kind() == reflect.Interface { + v = v.Elem() + } + return invokeLetExpr(e.Lhs, v, env) + case *ast.LetExpr: + rv, err := invokeExpr(e.Rhs, env) + if err != nil { + return rv, NewError(e, err) + } + if rv.Kind() == reflect.Interface { + rv = rv.Elem() + } + return invokeLetExpr(e.Lhs, rv, env) + case *ast.LetsExpr: + rv := NilValue + var err error + vs := []interface{}{} + for _, rhs := range e.Rhss { + rv, err = invokeExpr(rhs, env) + if err != nil { + return rv, NewError(rhs, err) + } + if rv == NilValue { + vs = append(vs, nil) + } else if rv.IsValid() && rv.CanInterface() { + vs = append(vs, rv.Interface()) + } else { + vs = append(vs, nil) + } + } + rvs := reflect.ValueOf(vs) + if len(e.Lhss) > 1 && rvs.Len() == 1 { + item := rvs.Index(0) + if item.Kind() == reflect.Interface { + item = item.Elem() + } + if item.Kind() == reflect.Slice { + rvs = item + } + } + for i, lhs := range e.Lhss { + if i >= rvs.Len() { + break + } + v := rvs.Index(i) + if v.Kind() == reflect.Interface { + v = v.Elem() + } + _, err = invokeLetExpr(lhs, v, env) + if err != nil { + return rvs, NewError(lhs, err) + } + } + if rvs.Len() == 1 { + return rvs.Index(0), nil + } + return rvs, nil + //case *ast.NewExpr: + // println("NEW") + // return NilValue, nil + case *ast.BinOpExpr: + lhsV := NilValue + rhsV := NilValue + var err error + + lhsV, err = invokeExpr(e.Lhs, env) + if err != nil { + return lhsV, NewError(expr, err) + } + if lhsV.Kind() == reflect.Interface { + lhsV = lhsV.Elem() + } + if e.Rhs != nil { + rhsV, err = invokeExpr(e.Rhs, env) + if err != nil { + return rhsV, NewError(expr, err) + } + if rhsV.Kind() == reflect.Interface { + rhsV = rhsV.Elem() + } + } + switch e.Operator { + case "+": + if lhsV.Kind() == reflect.String || rhsV.Kind() == reflect.String { + return reflect.ValueOf(toString(lhsV) + toString(rhsV)), nil + } + if (lhsV.Kind() == reflect.Array || lhsV.Kind() == reflect.Slice) && (rhsV.Kind() != reflect.Array && rhsV.Kind() != reflect.Slice) { + return reflect.Append(lhsV, rhsV), nil + } + if (lhsV.Kind() == reflect.Array || lhsV.Kind() == reflect.Slice) && (rhsV.Kind() == reflect.Array || rhsV.Kind() == reflect.Slice) { + return reflect.AppendSlice(lhsV, rhsV), nil + } + if lhsV.Kind() == reflect.Float64 || rhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(toFloat64(lhsV) + toFloat64(rhsV)), nil + } + return reflect.ValueOf(toInt64(lhsV) + toInt64(rhsV)), nil + case "-": + if lhsV.Kind() == reflect.Float64 || rhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(toFloat64(lhsV) - toFloat64(rhsV)), nil + } + return reflect.ValueOf(toInt64(lhsV) - toInt64(rhsV)), nil + case "*": + if lhsV.Kind() == reflect.String && (rhsV.Kind() == reflect.Int || rhsV.Kind() == reflect.Int32 || rhsV.Kind() == reflect.Int64) { + return reflect.ValueOf(strings.Repeat(toString(lhsV), int(toInt64(rhsV)))), nil + } + if lhsV.Kind() == reflect.Float64 || rhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(toFloat64(lhsV) * toFloat64(rhsV)), nil + } + return reflect.ValueOf(toInt64(lhsV) * toInt64(rhsV)), nil + case "/": + return reflect.ValueOf(toFloat64(lhsV) / toFloat64(rhsV)), nil + case "%": + return reflect.ValueOf(toInt64(lhsV) % toInt64(rhsV)), nil + case "==": + return reflect.ValueOf(equal(lhsV, rhsV)), nil + case "!=": + return reflect.ValueOf(equal(lhsV, rhsV) == false), nil + case ">": + return reflect.ValueOf(toFloat64(lhsV) > toFloat64(rhsV)), nil + case ">=": + return reflect.ValueOf(toFloat64(lhsV) >= toFloat64(rhsV)), nil + case "<": + return reflect.ValueOf(toFloat64(lhsV) < toFloat64(rhsV)), nil + case "<=": + return reflect.ValueOf(toFloat64(lhsV) <= toFloat64(rhsV)), nil + case "|": + return reflect.ValueOf(toInt64(lhsV) | toInt64(rhsV)), nil + case "||": + if toBool(lhsV) { + return lhsV, nil + } + return rhsV, nil + case "&": + return reflect.ValueOf(toInt64(lhsV) & toInt64(rhsV)), nil + case "&&": + if toBool(lhsV) { + return rhsV, nil + } + return lhsV, nil + case "**": + if lhsV.Kind() == reflect.Float64 { + return reflect.ValueOf(math.Pow(toFloat64(lhsV), toFloat64(rhsV))), nil + } + return reflect.ValueOf(int64(math.Pow(toFloat64(lhsV), toFloat64(rhsV)))), nil + case ">>": + return reflect.ValueOf(toInt64(lhsV) >> uint64(toInt64(rhsV))), nil + case "<<": + return reflect.ValueOf(toInt64(lhsV) << uint64(toInt64(rhsV))), nil + default: + return NilValue, NewStringError(expr, "Unknown operator") + } + case *ast.ConstExpr: + switch e.Value { + case "true": + return reflect.ValueOf(true), nil + case "false": + return reflect.ValueOf(false), nil + } + return reflect.ValueOf(nil), nil + case *ast.AnonCallExpr: + f, err := invokeExpr(e.Expr, env) + if err != nil { + return f, NewError(expr, err) + } + if f.Kind() == reflect.Interface { + f = f.Elem() + } + if f.Kind() != reflect.Func { + return f, NewStringError(expr, "Unknown function") + } + return invokeExpr(&ast.CallExpr{Func: f, SubExprs: e.SubExprs, VarArg: e.VarArg, Go: e.Go}, env) + case *ast.CallExpr: + f := NilValue + + if e.Func != nil { + f = e.Func.(reflect.Value) + } else { + var err error + ff, err := env.Get(e.Name) + if err != nil { + return f, err + } + f = ff + } + _, isReflect := f.Interface().(Func) + + args := []reflect.Value{} + l := len(e.SubExprs) + for i, expr := range e.SubExprs { + arg, err := invokeExpr(expr, env) + if err != nil { + return arg, NewError(expr, err) + } + + if i < f.Type().NumIn() { + if !f.Type().IsVariadic() { + it := f.Type().In(i) + if arg.Kind().String() == "unsafe.Pointer" { + arg = reflect.New(it).Elem() + } + if arg.Kind() != it.Kind() && arg.IsValid() && arg.Type().ConvertibleTo(it) { + arg = arg.Convert(it) + } else if arg.Kind() == reflect.Func { + if _, isFunc := arg.Interface().(Func); isFunc { + rfunc := arg + arg = reflect.MakeFunc(it, func(args []reflect.Value) []reflect.Value { + for i := range args { + args[i] = reflect.ValueOf(args[i]) + } + if e.Go { + go func() { + rfunc.Call(args) + }() + return []reflect.Value{} + } + return rfunc.Call(args)[:it.NumOut()] + }) + } + } else if !arg.IsValid() { + arg = reflect.Zero(it) + } + } + } + if !arg.IsValid() { + arg = NilValue + } + + if !isReflect { + if e.VarArg && i == l-1 { + for j := 0; j < arg.Len(); j++ { + args = append(args, arg.Index(j).Elem()) + } + } else { + args = append(args, arg) + } + } else { + if arg.Kind() == reflect.Interface { + arg = arg.Elem() + } + if e.VarArg && i == l-1 { + for j := 0; j < arg.Len(); j++ { + args = append(args, reflect.ValueOf(arg.Index(j).Elem())) + } + } else { + args = append(args, reflect.ValueOf(arg)) + } + } + } + ret := NilValue + var err error + fnc := func() { + defer func() { + if os.Getenv("ANKO_DEBUG") == "" { + if ex := recover(); ex != nil { + if e, ok := ex.(error); ok { + err = e + } else { + err = errors.New(fmt.Sprint(ex)) + } + } + } + }() + if f.Kind() == reflect.Interface { + f = f.Elem() + } + rets := f.Call(args) + if isReflect { + ev := rets[1].Interface() + if ev != nil { + err = ev.(error) + } + ret = rets[0].Interface().(reflect.Value) + } else { + for i, expr := range e.SubExprs { + if ae, ok := expr.(*ast.AddrExpr); ok { + if id, ok := ae.Expr.(*ast.IdentExpr); ok { + invokeLetExpr(id, args[i].Elem().Elem(), env) + } + } + } + if f.Type().NumOut() == 1 { + ret = rets[0] + } else { + var result []interface{} + for _, r := range rets { + result = append(result, r.Interface()) + } + ret = reflect.ValueOf(result) + } + } + } + if e.Go { + go fnc() + return NilValue, nil + } + fnc() + if err != nil { + return ret, NewError(expr, err) + } + return ret, nil + case *ast.TernaryOpExpr: + rv, err := invokeExpr(e.Expr, env) + if err != nil { + return rv, NewError(expr, err) + } + if toBool(rv) { + lhsV, err := invokeExpr(e.Lhs, env) + if err != nil { + return lhsV, NewError(expr, err) + } + return lhsV, nil + } + rhsV, err := invokeExpr(e.Rhs, env) + if err != nil { + return rhsV, NewError(expr, err) + } + return rhsV, nil + case *ast.MakeChanExpr: + typ, err := env.Type(e.Type) + if err != nil { + return NilValue, err + } + var size int + if e.SizeExpr != nil { + rv, err := invokeExpr(e.SizeExpr, env) + if err != nil { + return NilValue, err + } + size = int(toInt64(rv)) + } + return func() (reflect.Value, error) { + defer func() { + if os.Getenv("ANKO_DEBUG") == "" { + if ex := recover(); ex != nil { + if e, ok := ex.(error); ok { + err = e + } else { + err = errors.New(fmt.Sprint(ex)) + } + } + } + }() + return reflect.MakeChan(reflect.ChanOf(reflect.BothDir, typ), size), nil + }() + case *ast.MakeArrayExpr: + typ, err := env.Type(e.Type) + if err != nil { + return NilValue, err + } + var alen int + if e.LenExpr != nil { + rv, err := invokeExpr(e.LenExpr, env) + if err != nil { + return NilValue, err + } + alen = int(toInt64(rv)) + } + var acap int + if e.CapExpr != nil { + rv, err := invokeExpr(e.CapExpr, env) + if err != nil { + return NilValue, err + } + acap = int(toInt64(rv)) + } else { + acap = alen + } + return func() (reflect.Value, error) { + defer func() { + if os.Getenv("ANKO_DEBUG") == "" { + if ex := recover(); ex != nil { + if e, ok := ex.(error); ok { + err = e + } else { + err = errors.New(fmt.Sprint(ex)) + } + } + } + }() + return reflect.MakeSlice(reflect.SliceOf(typ), alen, acap), nil + }() + case *ast.ChanExpr: + rhs, err := invokeExpr(e.Rhs, env) + if err != nil { + return NilValue, NewError(expr, err) + } + + if e.Lhs == nil { + if rhs.Kind() == reflect.Chan { + rv, _ := rhs.Recv() + return rv, nil + } + } else { + lhs, err := invokeExpr(e.Lhs, env) + if err != nil { + return NilValue, NewError(expr, err) + } + if lhs.Kind() == reflect.Chan { + lhs.Send(rhs) + return NilValue, nil + } else if rhs.Kind() == reflect.Chan { + rv, _ := rhs.Recv() + return invokeLetExpr(e.Lhs, rv, env) + } + } + return NilValue, NewStringError(expr, "Invalid operation for chan") + default: + return NilValue, NewStringError(expr, "Unknown expression") + } +} diff --git a/vendor/github.com/mattn/anko/vm/vm_test.go b/vendor/github.com/mattn/anko/vm/vm_test.go new file mode 100644 index 0000000000..1dfd0b2e11 --- /dev/null +++ b/vendor/github.com/mattn/anko/vm/vm_test.go @@ -0,0 +1,54 @@ +package vm + +import ( + "fmt" + "log" + "testing" + "time" + + "github.com/mattn/anko/parser" +) + +func testInterrupt() { + env := NewEnv() + + var sleepFunc = func(spec string) { + if d, err := time.ParseDuration(spec); err != nil { + panic(err) + } else { + time.Sleep(d) + } + } + + env.Define("println", fmt.Println) + env.Define("sleep", sleepFunc) + + script := ` +sleep("2s") +# Should interrupt here. +# The next line will not be executed. +println("") +` + stmts, err := parser.ParseSrc(script) + if err != nil { + log.Fatal() + } + + // Interrupts after 1 second. + go func() { + time.Sleep(time.Second) + Interrupt(env) + }() + + _, err = Run(stmts, env) + if err != nil { + log.Fatal() + } +} + +func TestInterruptRaces(t *testing.T) { + // Run example several times + for i := 0; i < 100; i++ { + go testInterrupt() + } +} diff --git a/vendor/github.com/mitchellh/go-homedir/LICENSE b/vendor/github.com/mitchellh/go-homedir/LICENSE index 42354d5d5a..f9c841a51e 100644 --- a/vendor/github.com/mitchellh/go-homedir/LICENSE +++ b/vendor/github.com/mitchellh/go-homedir/LICENSE @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2013 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2013 Mitchell Hashimoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/go-homedir/README.md b/vendor/github.com/mitchellh/go-homedir/README.md index 9872b7bb45..d70706d5b3 100644 --- a/vendor/github.com/mitchellh/go-homedir/README.md +++ b/vendor/github.com/mitchellh/go-homedir/README.md @@ -1,14 +1,14 @@ -# go-homedir - -This is a Go library for detecting the user's home directory without -the use of cgo, so the library can be used in cross-compilation environments. - -Usage is incredibly simple, just call `homedir.Dir()` to get the home directory -for a user, and `homedir.Expand()` to expand the `~` in a path to the home -directory. - -**Why not just use `os/user`?** The built-in `os/user` package requires -cgo on Darwin systems. This means that any Go code that uses that package -cannot cross compile. But 99% of the time the use for `os/user` is just to -retrieve the home directory, which we can do for the current user without -cgo. This library does that, enabling cross-compilation. +# go-homedir + +This is a Go library for detecting the user's home directory without +the use of cgo, so the library can be used in cross-compilation environments. + +Usage is incredibly simple, just call `homedir.Dir()` to get the home directory +for a user, and `homedir.Expand()` to expand the `~` in a path to the home +directory. + +**Why not just use `os/user`?** The built-in `os/user` package requires +cgo on Darwin systems. This means that any Go code that uses that package +cannot cross compile. But 99% of the time the use for `os/user` is just to +retrieve the home directory, which we can do for the current user without +cgo. This library does that, enabling cross-compilation. diff --git a/vendor/github.com/mitchellh/go-homedir/homedir.go b/vendor/github.com/mitchellh/go-homedir/homedir.go index a05be48e7e..47e1f9ef8e 100644 --- a/vendor/github.com/mitchellh/go-homedir/homedir.go +++ b/vendor/github.com/mitchellh/go-homedir/homedir.go @@ -1,137 +1,137 @@ -package homedir - -import ( - "bytes" - "errors" - "os" - "os/exec" - "path/filepath" - "runtime" - "strconv" - "strings" - "sync" -) - -// DisableCache will disable caching of the home directory. Caching is enabled -// by default. -var DisableCache bool - -var homedirCache string -var cacheLock sync.RWMutex - -// Dir returns the home directory for the executing user. -// -// This uses an OS-specific method for discovering the home directory. -// An error is returned if a home directory cannot be detected. -func Dir() (string, error) { - if !DisableCache { - cacheLock.RLock() - cached := homedirCache - cacheLock.RUnlock() - if cached != "" { - return cached, nil - } - } - - cacheLock.Lock() - defer cacheLock.Unlock() - - var result string - var err error - if runtime.GOOS == "windows" { - result, err = dirWindows() - } else { - // Unix-like system, so just assume Unix - result, err = dirUnix() - } - - if err != nil { - return "", err - } - homedirCache = result - return result, nil -} - -// Expand expands the path to include the home directory if the path -// is prefixed with `~`. If it isn't prefixed with `~`, the path is -// returned as-is. -func Expand(path string) (string, error) { - if len(path) == 0 { - return path, nil - } - - if path[0] != '~' { - return path, nil - } - - if len(path) > 1 && path[1] != '/' && path[1] != '\\' { - return "", errors.New("cannot expand user-specific home dir") - } - - dir, err := Dir() - if err != nil { - return "", err - } - - return filepath.Join(dir, path[1:]), nil -} - -func dirUnix() (string, error) { - // First prefer the HOME environmental variable - if home := os.Getenv("HOME"); home != "" { - return home, nil - } - - // If that fails, try getent - var stdout bytes.Buffer - cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid())) - cmd.Stdout = &stdout - if err := cmd.Run(); err != nil { - // If the error is ErrNotFound, we ignore it. Otherwise, return it. - if err != exec.ErrNotFound { - return "", err - } - } else { - if passwd := strings.TrimSpace(stdout.String()); passwd != "" { - // username:password:uid:gid:gecos:home:shell - passwdParts := strings.SplitN(passwd, ":", 7) - if len(passwdParts) > 5 { - return passwdParts[5], nil - } - } - } - - // If all else fails, try the shell - stdout.Reset() - cmd = exec.Command("sh", "-c", "cd && pwd") - cmd.Stdout = &stdout - if err := cmd.Run(); err != nil { - return "", err - } - - result := strings.TrimSpace(stdout.String()) - if result == "" { - return "", errors.New("blank output when reading home directory") - } - - return result, nil -} - -func dirWindows() (string, error) { - // First prefer the HOME environmental variable - if home := os.Getenv("HOME"); home != "" { - return home, nil - } - - drive := os.Getenv("HOMEDRIVE") - path := os.Getenv("HOMEPATH") - home := drive + path - if drive == "" || path == "" { - home = os.Getenv("USERPROFILE") - } - if home == "" { - return "", errors.New("HOMEDRIVE, HOMEPATH, and USERPROFILE are blank") - } - - return home, nil -} +package homedir + +import ( + "bytes" + "errors" + "os" + "os/exec" + "path/filepath" + "runtime" + "strconv" + "strings" + "sync" +) + +// DisableCache will disable caching of the home directory. Caching is enabled +// by default. +var DisableCache bool + +var homedirCache string +var cacheLock sync.RWMutex + +// Dir returns the home directory for the executing user. +// +// This uses an OS-specific method for discovering the home directory. +// An error is returned if a home directory cannot be detected. +func Dir() (string, error) { + if !DisableCache { + cacheLock.RLock() + cached := homedirCache + cacheLock.RUnlock() + if cached != "" { + return cached, nil + } + } + + cacheLock.Lock() + defer cacheLock.Unlock() + + var result string + var err error + if runtime.GOOS == "windows" { + result, err = dirWindows() + } else { + // Unix-like system, so just assume Unix + result, err = dirUnix() + } + + if err != nil { + return "", err + } + homedirCache = result + return result, nil +} + +// Expand expands the path to include the home directory if the path +// is prefixed with `~`. If it isn't prefixed with `~`, the path is +// returned as-is. +func Expand(path string) (string, error) { + if len(path) == 0 { + return path, nil + } + + if path[0] != '~' { + return path, nil + } + + if len(path) > 1 && path[1] != '/' && path[1] != '\\' { + return "", errors.New("cannot expand user-specific home dir") + } + + dir, err := Dir() + if err != nil { + return "", err + } + + return filepath.Join(dir, path[1:]), nil +} + +func dirUnix() (string, error) { + // First prefer the HOME environmental variable + if home := os.Getenv("HOME"); home != "" { + return home, nil + } + + // If that fails, try getent + var stdout bytes.Buffer + cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid())) + cmd.Stdout = &stdout + if err := cmd.Run(); err != nil { + // If the error is ErrNotFound, we ignore it. Otherwise, return it. + if err != exec.ErrNotFound { + return "", err + } + } else { + if passwd := strings.TrimSpace(stdout.String()); passwd != "" { + // username:password:uid:gid:gecos:home:shell + passwdParts := strings.SplitN(passwd, ":", 7) + if len(passwdParts) > 5 { + return passwdParts[5], nil + } + } + } + + // If all else fails, try the shell + stdout.Reset() + cmd = exec.Command("sh", "-c", "cd && pwd") + cmd.Stdout = &stdout + if err := cmd.Run(); err != nil { + return "", err + } + + result := strings.TrimSpace(stdout.String()) + if result == "" { + return "", errors.New("blank output when reading home directory") + } + + return result, nil +} + +func dirWindows() (string, error) { + // First prefer the HOME environmental variable + if home := os.Getenv("HOME"); home != "" { + return home, nil + } + + drive := os.Getenv("HOMEDRIVE") + path := os.Getenv("HOMEPATH") + home := drive + path + if drive == "" || path == "" { + home = os.Getenv("USERPROFILE") + } + if home == "" { + return "", errors.New("HOMEDRIVE, HOMEPATH, and USERPROFILE are blank") + } + + return home, nil +} diff --git a/vendor/github.com/mitchellh/go-homedir/homedir_test.go b/vendor/github.com/mitchellh/go-homedir/homedir_test.go index 593dc0f7d9..e4054e72a3 100644 --- a/vendor/github.com/mitchellh/go-homedir/homedir_test.go +++ b/vendor/github.com/mitchellh/go-homedir/homedir_test.go @@ -1,112 +1,112 @@ -package homedir - -import ( - "os" - "os/user" - "path/filepath" - "testing" -) - -func patchEnv(key, value string) func() { - bck := os.Getenv(key) - deferFunc := func() { - os.Setenv(key, bck) - } - - os.Setenv(key, value) - return deferFunc -} - -func BenchmarkDir(b *testing.B) { - // We do this for any "warmups" - for i := 0; i < 10; i++ { - Dir() - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - Dir() - } -} - -func TestDir(t *testing.T) { - u, err := user.Current() - if err != nil { - t.Fatalf("err: %s", err) - } - - dir, err := Dir() - if err != nil { - t.Fatalf("err: %s", err) - } - - if u.HomeDir != dir { - t.Fatalf("%#v != %#v", u.HomeDir, dir) - } -} - -func TestExpand(t *testing.T) { - u, err := user.Current() - if err != nil { - t.Fatalf("err: %s", err) - } - - cases := []struct { - Input string - Output string - Err bool - }{ - { - "/foo", - "/foo", - false, - }, - - { - "~/foo", - filepath.Join(u.HomeDir, "foo"), - false, - }, - - { - "", - "", - false, - }, - - { - "~", - u.HomeDir, - false, - }, - - { - "~foo/foo", - "", - true, - }, - } - - for _, tc := range cases { - actual, err := Expand(tc.Input) - if (err != nil) != tc.Err { - t.Fatalf("Input: %#v\n\nErr: %s", tc.Input, err) - } - - if actual != tc.Output { - t.Fatalf("Input: %#v\n\nOutput: %#v", tc.Input, actual) - } - } - - DisableCache = true - defer func() { DisableCache = false }() - defer patchEnv("HOME", "/custom/path/")() - expected := filepath.Join("/", "custom", "path", "foo/bar") - actual, err := Expand("~/foo/bar") - - if err != nil { - t.Errorf("No error is expected, got: %v", err) - } else if actual != expected { - t.Errorf("Expected: %v; actual: %v", expected, actual) - } -} +package homedir + +import ( + "os" + "os/user" + "path/filepath" + "testing" +) + +func patchEnv(key, value string) func() { + bck := os.Getenv(key) + deferFunc := func() { + os.Setenv(key, bck) + } + + os.Setenv(key, value) + return deferFunc +} + +func BenchmarkDir(b *testing.B) { + // We do this for any "warmups" + for i := 0; i < 10; i++ { + Dir() + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + Dir() + } +} + +func TestDir(t *testing.T) { + u, err := user.Current() + if err != nil { + t.Fatalf("err: %s", err) + } + + dir, err := Dir() + if err != nil { + t.Fatalf("err: %s", err) + } + + if u.HomeDir != dir { + t.Fatalf("%#v != %#v", u.HomeDir, dir) + } +} + +func TestExpand(t *testing.T) { + u, err := user.Current() + if err != nil { + t.Fatalf("err: %s", err) + } + + cases := []struct { + Input string + Output string + Err bool + }{ + { + "/foo", + "/foo", + false, + }, + + { + "~/foo", + filepath.Join(u.HomeDir, "foo"), + false, + }, + + { + "", + "", + false, + }, + + { + "~", + u.HomeDir, + false, + }, + + { + "~foo/foo", + "", + true, + }, + } + + for _, tc := range cases { + actual, err := Expand(tc.Input) + if (err != nil) != tc.Err { + t.Fatalf("Input: %#v\n\nErr: %s", tc.Input, err) + } + + if actual != tc.Output { + t.Fatalf("Input: %#v\n\nOutput: %#v", tc.Input, actual) + } + } + + DisableCache = true + defer func() { DisableCache = false }() + defer patchEnv("HOME", "/custom/path/")() + expected := filepath.Join("/", "custom", "path", "foo/bar") + actual, err := Expand("~/foo/bar") + + if err != nil { + t.Errorf("No error is expected, got: %v", err) + } else if actual != expected { + t.Errorf("Expected: %v; actual: %v", expected, actual) + } +} diff --git a/vendor/github.com/onsi/gomega/.gitignore b/vendor/github.com/onsi/gomega/.gitignore index 7e3281da97..720c13cba8 100644 --- a/vendor/github.com/onsi/gomega/.gitignore +++ b/vendor/github.com/onsi/gomega/.gitignore @@ -1,5 +1,5 @@ -.DS_Store -*.test -. -.idea -gomega.iml +.DS_Store +*.test +. +.idea +gomega.iml diff --git a/vendor/github.com/onsi/gomega/.travis.yml b/vendor/github.com/onsi/gomega/.travis.yml index 9154ede2c7..9bc3fd027f 100644 --- a/vendor/github.com/onsi/gomega/.travis.yml +++ b/vendor/github.com/onsi/gomega/.travis.yml @@ -1,11 +1,11 @@ -language: go -go: - - 1.6 - - 1.7 - -install: - - go get -v ./... - - go get github.com/onsi/ginkgo - - go install github.com/onsi/ginkgo/ginkgo - -script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --failOnPending --randomizeSuites --race +language: go +go: + - 1.6 + - 1.7 + +install: + - go get -v ./... + - go get github.com/onsi/ginkgo + - go install github.com/onsi/ginkgo/ginkgo + +script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --failOnPending --randomizeSuites --race diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 93a4367c2f..0c5ede5d82 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,70 +1,70 @@ -## HEAD - -Improvements: - -- Added `BeSent` which attempts to send a value down a channel and fails if the attempt blocks. Can be paired with `Eventually` to safely send a value down a channel with a timeout. -- `Ω`, `Expect`, `Eventually`, and `Consistently` now immediately `panic` if there is no registered fail handler. This is always a mistake that can hide failing tests. -- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShoudlNot(Receive()) always passes with a closed channel. -- Added `HavePrefix` and `HaveSuffix` matchers. -- `ghttp` can now handle concurrent requests. -- Added `Succeed` which allows one to write `Ω(MyFunction()).Should(Succeed())`. -- Improved `ghttp`'s behavior around failing assertions and panics: - - If a registered handler makes a failing assertion `ghttp` will return `500`. - - If a registered handler panics, `ghttp` will return `500` *and* fail the test. This is new behavior that may cause existing code to break. This code is almost certainly incorrect and creating a false positive. -- `ghttp` servers can take an `io.Writer`. `ghttp` will write a line to the writer when each request arrives. -- Added `WithTransform` matcher to allow munging input data before feeding into the relevant matcher -- Added boolean `And`, `Or`, and `Not` matchers to allow creating composite matchers - -Bug Fixes: -- gexec: `session.Wait` now uses `EventuallyWithOffset` to get the right line number in the failure. -- `ContainElement` no longer bails if a passed-in matcher errors. - -## 1.0 (8/2/2014) - -No changes. Dropping "beta" from the version number. - -## 1.0.0-beta (7/8/2014) -Breaking Changes: - -- Changed OmegaMatcher interface. Instead of having `Match` return failure messages, two new methods `FailureMessage` and `NegatedFailureMessage` are called instead. -- Moved and renamed OmegaFailHandler to types.GomegaFailHandler and OmegaMatcher to types.GomegaMatcher. Any references to OmegaMatcher in any custom matchers will need to be changed to point to types.GomegaMatcher - -New Test-Support Features: - -- `ghttp`: supports testing http clients - - Provides a flexible fake http server - - Provides a collection of chainable http handlers that perform assertions. -- `gbytes`: supports making ordered assertions against streams of data - - Provides a `gbytes.Buffer` - - Provides a `Say` matcher to perform ordered assertions against output data -- `gexec`: supports testing external processes - - Provides support for building Go binaries - - Wraps and starts `exec.Cmd` commands - - Makes it easy to assert against stdout and stderr - - Makes it easy to send signals and wait for processes to exit - - Provides an `Exit` matcher to assert against exit code. - -DSL Changes: - -- `Eventually` and `Consistently` can accept `time.Duration` interval and polling inputs. -- The default timeouts for `Eventually` and `Consistently` are now configurable. - -New Matchers: - -- `ConsistOf`: order-independent assertion against the elements of an array/slice or keys of a map. -- `BeTemporally`: like `BeNumerically` but for `time.Time` -- `HaveKeyWithValue`: asserts a map has a given key with the given value. - -Updated Matchers: - -- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an objet that satisfies the passed-in matcher. -- Matchers that implement `MatchMayChangeInTheFuture(actual interface{}) bool` can inform `Eventually` and/or `Consistently` when a match has no chance of changing status in the future. For example, `Receive` returns `false` when a channel is closed. - -Misc: - -- Start using semantic versioning -- Start maintaining changelog - -Major refactor: - -- Pull out Gomega's internal to `internal` +## HEAD + +Improvements: + +- Added `BeSent` which attempts to send a value down a channel and fails if the attempt blocks. Can be paired with `Eventually` to safely send a value down a channel with a timeout. +- `Ω`, `Expect`, `Eventually`, and `Consistently` now immediately `panic` if there is no registered fail handler. This is always a mistake that can hide failing tests. +- `Receive()` no longer errors when passed a closed channel, it's perfectly fine to attempt to read from a closed channel so Ω(c).Should(Receive()) always fails and Ω(c).ShoudlNot(Receive()) always passes with a closed channel. +- Added `HavePrefix` and `HaveSuffix` matchers. +- `ghttp` can now handle concurrent requests. +- Added `Succeed` which allows one to write `Ω(MyFunction()).Should(Succeed())`. +- Improved `ghttp`'s behavior around failing assertions and panics: + - If a registered handler makes a failing assertion `ghttp` will return `500`. + - If a registered handler panics, `ghttp` will return `500` *and* fail the test. This is new behavior that may cause existing code to break. This code is almost certainly incorrect and creating a false positive. +- `ghttp` servers can take an `io.Writer`. `ghttp` will write a line to the writer when each request arrives. +- Added `WithTransform` matcher to allow munging input data before feeding into the relevant matcher +- Added boolean `And`, `Or`, and `Not` matchers to allow creating composite matchers + +Bug Fixes: +- gexec: `session.Wait` now uses `EventuallyWithOffset` to get the right line number in the failure. +- `ContainElement` no longer bails if a passed-in matcher errors. + +## 1.0 (8/2/2014) + +No changes. Dropping "beta" from the version number. + +## 1.0.0-beta (7/8/2014) +Breaking Changes: + +- Changed OmegaMatcher interface. Instead of having `Match` return failure messages, two new methods `FailureMessage` and `NegatedFailureMessage` are called instead. +- Moved and renamed OmegaFailHandler to types.GomegaFailHandler and OmegaMatcher to types.GomegaMatcher. Any references to OmegaMatcher in any custom matchers will need to be changed to point to types.GomegaMatcher + +New Test-Support Features: + +- `ghttp`: supports testing http clients + - Provides a flexible fake http server + - Provides a collection of chainable http handlers that perform assertions. +- `gbytes`: supports making ordered assertions against streams of data + - Provides a `gbytes.Buffer` + - Provides a `Say` matcher to perform ordered assertions against output data +- `gexec`: supports testing external processes + - Provides support for building Go binaries + - Wraps and starts `exec.Cmd` commands + - Makes it easy to assert against stdout and stderr + - Makes it easy to send signals and wait for processes to exit + - Provides an `Exit` matcher to assert against exit code. + +DSL Changes: + +- `Eventually` and `Consistently` can accept `time.Duration` interval and polling inputs. +- The default timeouts for `Eventually` and `Consistently` are now configurable. + +New Matchers: + +- `ConsistOf`: order-independent assertion against the elements of an array/slice or keys of a map. +- `BeTemporally`: like `BeNumerically` but for `time.Time` +- `HaveKeyWithValue`: asserts a map has a given key with the given value. + +Updated Matchers: + +- `Receive` matcher can take a matcher as an argument and passes only if the channel under test receives an objet that satisfies the passed-in matcher. +- Matchers that implement `MatchMayChangeInTheFuture(actual interface{}) bool` can inform `Eventually` and/or `Consistently` when a match has no chance of changing status in the future. For example, `Receive` returns `false` when a channel is closed. + +Misc: + +- Start using semantic versioning +- Start maintaining changelog + +Major refactor: + +- Pull out Gomega's internal to `internal` diff --git a/vendor/github.com/onsi/gomega/LICENSE b/vendor/github.com/onsi/gomega/LICENSE index aa5e69f14a..9415ee72c1 100644 --- a/vendor/github.com/onsi/gomega/LICENSE +++ b/vendor/github.com/onsi/gomega/LICENSE @@ -1,20 +1,20 @@ -Copyright (c) 2013-2014 Onsi Fakhouri - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Copyright (c) 2013-2014 Onsi Fakhouri + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/onsi/gomega/README.md b/vendor/github.com/onsi/gomega/README.md index 44b082626c..9714f67798 100644 --- a/vendor/github.com/onsi/gomega/README.md +++ b/vendor/github.com/onsi/gomega/README.md @@ -1,21 +1,21 @@ -![Gomega: Ginkgo's Preferred Matcher Library](http://onsi.github.io/gomega/images/gomega.png) - -[![Build Status](https://travis-ci.org/onsi/gomega.svg)](https://travis-ci.org/onsi/gomega) - -Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers). - -To discuss Gomega and get updates, join the [google group](https://groups.google.com/d/forum/ginkgo-and-gomega). - -## [Ginkgo](http://github.com/onsi/ginkgo): a BDD Testing Framework for Golang - -Learn more about Ginkgo [here](http://onsi.github.io/ginkgo/) - -## Community Matchers - -A collection of community matchers is available on the [wiki](https://github.com/onsi/gomega/wiki). - -## License - -Gomega is MIT-Licensed - -The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license. +![Gomega: Ginkgo's Preferred Matcher Library](http://onsi.github.io/gomega/images/gomega.png) + +[![Build Status](https://travis-ci.org/onsi/gomega.svg)](https://travis-ci.org/onsi/gomega) + +Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers). + +To discuss Gomega and get updates, join the [google group](https://groups.google.com/d/forum/ginkgo-and-gomega). + +## [Ginkgo](http://github.com/onsi/ginkgo): a BDD Testing Framework for Golang + +Learn more about Ginkgo [here](http://onsi.github.io/ginkgo/) + +## Community Matchers + +A collection of community matchers is available on the [wiki](https://github.com/onsi/gomega/wiki). + +## License + +Gomega is MIT-Licensed + +The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license. diff --git a/vendor/github.com/onsi/gomega/format/format.go b/vendor/github.com/onsi/gomega/format/format.go index 7f7ac2dc00..a9d2651369 100644 --- a/vendor/github.com/onsi/gomega/format/format.go +++ b/vendor/github.com/onsi/gomega/format/format.go @@ -1,384 +1,384 @@ -/* -Gomega's format package pretty-prints objects. It explores input objects recursively and generates formatted, indented output with type information. -*/ -package format - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "time" -) - -// Use MaxDepth to set the maximum recursion depth when printing deeply nested objects -var MaxDepth = uint(10) - -/* -By default, all objects (even those that implement fmt.Stringer and fmt.GoStringer) are recursively inspected to generate output. - -Set UseStringerRepresentation = true to use GoString (for fmt.GoStringers) or String (for fmt.Stringer) instead. - -Note that GoString and String don't always have all the information you need to understand why a test failed! -*/ -var UseStringerRepresentation = false - -/* -Print the content of context objects. By default it will be suppressed. - -Set PrintContextObjects = true to enable printing of the context internals. -*/ -var PrintContextObjects = false - -// Ctx interface defined here to keep backwards compatability with go < 1.7 -// It matches the context.Context interface -type Ctx interface { - Deadline() (deadline time.Time, ok bool) - Done() <-chan struct{} - Err() error - Value(key interface{}) interface{} -} - -var contextType = reflect.TypeOf((*Ctx)(nil)).Elem() -var timeType = reflect.TypeOf(time.Time{}) - -//The default indentation string emitted by the format package -var Indent = " " - -var longFormThreshold = 20 - -/* -Generates a formatted matcher success/failure message of the form: - - Expected - - - - -If expected is omited, then the message looks like: - - Expected - - -*/ -func Message(actual interface{}, message string, expected ...interface{}) string { - if len(expected) == 0 { - return fmt.Sprintf("Expected\n%s\n%s", Object(actual, 1), message) - } else { - return fmt.Sprintf("Expected\n%s\n%s\n%s", Object(actual, 1), message, Object(expected[0], 1)) - } -} - -/* - -Generates a nicely formatted matcher success / failure message - -Much like Message(...), but it attempts to pretty print diffs in strings - -Expected - : "...aaaaabaaaaa..." -to equal | - : "...aaaaazaaaaa..." - -*/ - -func MessageWithDiff(actual, message, expected string) string { - if len(actual) >= truncateThreshold && len(expected) >= truncateThreshold { - diffPoint := findFirstMismatch(actual, expected) - formattedActual := truncateAndFormat(actual, diffPoint) - formattedExpected := truncateAndFormat(expected, diffPoint) - - spacesBeforeFormattedMismatch := findFirstMismatch(formattedActual, formattedExpected) - - tabLength := 4 - spaceFromMessageToActual := tabLength + len(": ") - len(message) - padding := strings.Repeat(" ", spaceFromMessageToActual+spacesBeforeFormattedMismatch) + "|" - return Message(formattedActual, message+padding, formattedExpected) - } - return Message(actual, message, expected) -} - -func truncateAndFormat(str string, index int) string { - leftPadding := `...` - rightPadding := `...` - - start := index - charactersAroundMismatchToInclude - if start < 0 { - start = 0 - leftPadding = "" - } - - // slice index must include the mis-matched character - lengthOfMismatchedCharacter := 1 - end := index + charactersAroundMismatchToInclude + lengthOfMismatchedCharacter - if end > len(str) { - end = len(str) - rightPadding = "" - - } - return fmt.Sprintf("\"%s\"", leftPadding+str[start:end]+rightPadding) -} - -func findFirstMismatch(a, b string) int { - aSlice := strings.Split(a, "") - bSlice := strings.Split(b, "") - - for index, str := range aSlice { - if index > len(b) - 1 { - return index - } - if str != bSlice[index] { - return index - } - } - - if len(b) > len(a) { - return len(a) + 1 - } - - return 0 -} - -const ( - truncateThreshold = 50 - charactersAroundMismatchToInclude = 5 -) - -/* -Pretty prints the passed in object at the passed in indentation level. - -Object recurses into deeply nested objects emitting pretty-printed representations of their components. - -Modify format.MaxDepth to control how deep the recursion is allowed to go -Set format.UseStringerRepresentation to true to return object.GoString() or object.String() when available instead of -recursing into the object. - -Set PrintContextObjects to true to print the content of objects implementing context.Context -*/ -func Object(object interface{}, indentation uint) string { - indent := strings.Repeat(Indent, int(indentation)) - value := reflect.ValueOf(object) - return fmt.Sprintf("%s<%s>: %s", indent, formatType(object), formatValue(value, indentation)) -} - -/* -IndentString takes a string and indents each line by the specified amount. -*/ -func IndentString(s string, indentation uint) string { - components := strings.Split(s, "\n") - result := "" - indent := strings.Repeat(Indent, int(indentation)) - for i, component := range components { - result += indent + component - if i < len(components)-1 { - result += "\n" - } - } - - return result -} - -func formatType(object interface{}) string { - t := reflect.TypeOf(object) - if t == nil { - return "nil" - } - switch t.Kind() { - case reflect.Chan: - v := reflect.ValueOf(object) - return fmt.Sprintf("%T | len:%d, cap:%d", object, v.Len(), v.Cap()) - case reflect.Ptr: - return fmt.Sprintf("%T | %p", object, object) - case reflect.Slice: - v := reflect.ValueOf(object) - return fmt.Sprintf("%T | len:%d, cap:%d", object, v.Len(), v.Cap()) - case reflect.Map: - v := reflect.ValueOf(object) - return fmt.Sprintf("%T | len:%d", object, v.Len()) - default: - return fmt.Sprintf("%T", object) - } -} - -func formatValue(value reflect.Value, indentation uint) string { - if indentation > MaxDepth { - return "..." - } - - if isNilValue(value) { - return "nil" - } - - if UseStringerRepresentation { - if value.CanInterface() { - obj := value.Interface() - switch x := obj.(type) { - case fmt.GoStringer: - return x.GoString() - case fmt.Stringer: - return x.String() - } - } - } - - if !PrintContextObjects { - if value.Type().Implements(contextType) && indentation > 1 { - return "" - } - } - - switch value.Kind() { - case reflect.Bool: - return fmt.Sprintf("%v", value.Bool()) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return fmt.Sprintf("%v", value.Int()) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return fmt.Sprintf("%v", value.Uint()) - case reflect.Uintptr: - return fmt.Sprintf("0x%x", value.Uint()) - case reflect.Float32, reflect.Float64: - return fmt.Sprintf("%v", value.Float()) - case reflect.Complex64, reflect.Complex128: - return fmt.Sprintf("%v", value.Complex()) - case reflect.Chan: - return fmt.Sprintf("0x%x", value.Pointer()) - case reflect.Func: - return fmt.Sprintf("0x%x", value.Pointer()) - case reflect.Ptr: - return formatValue(value.Elem(), indentation) - case reflect.Slice: - return formatSlice(value, indentation) - case reflect.String: - return formatString(value.String(), indentation) - case reflect.Array: - return formatSlice(value, indentation) - case reflect.Map: - return formatMap(value, indentation) - case reflect.Struct: - if value.Type() == timeType && value.CanInterface() { - t, _ := value.Interface().(time.Time) - return t.Format(time.RFC3339Nano) - } - return formatStruct(value, indentation) - case reflect.Interface: - return formatValue(value.Elem(), indentation) - default: - if value.CanInterface() { - return fmt.Sprintf("%#v", value.Interface()) - } else { - return fmt.Sprintf("%#v", value) - } - } -} - -func formatString(object interface{}, indentation uint) string { - if indentation == 1 { - s := fmt.Sprintf("%s", object) - components := strings.Split(s, "\n") - result := "" - for i, component := range components { - if i == 0 { - result += component - } else { - result += Indent + component - } - if i < len(components)-1 { - result += "\n" - } - } - - return fmt.Sprintf("%s", result) - } else { - return fmt.Sprintf("%q", object) - } -} - -func formatSlice(v reflect.Value, indentation uint) string { - if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && isPrintableString(string(v.Bytes())) { - return formatString(v.Bytes(), indentation) - } - - l := v.Len() - result := make([]string, l) - longest := 0 - for i := 0; i < l; i++ { - result[i] = formatValue(v.Index(i), indentation+1) - if len(result[i]) > longest { - longest = len(result[i]) - } - } - - if longest > longFormThreshold { - indenter := strings.Repeat(Indent, int(indentation)) - return fmt.Sprintf("[\n%s%s,\n%s]", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) - } else { - return fmt.Sprintf("[%s]", strings.Join(result, ", ")) - } -} - -func formatMap(v reflect.Value, indentation uint) string { - l := v.Len() - result := make([]string, l) - - longest := 0 - for i, key := range v.MapKeys() { - value := v.MapIndex(key) - result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1), formatValue(value, indentation+1)) - if len(result[i]) > longest { - longest = len(result[i]) - } - } - - if longest > longFormThreshold { - indenter := strings.Repeat(Indent, int(indentation)) - return fmt.Sprintf("{\n%s%s,\n%s}", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) - } else { - return fmt.Sprintf("{%s}", strings.Join(result, ", ")) - } -} - -func formatStruct(v reflect.Value, indentation uint) string { - t := v.Type() - - l := v.NumField() - result := []string{} - longest := 0 - for i := 0; i < l; i++ { - structField := t.Field(i) - fieldEntry := v.Field(i) - representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1)) - result = append(result, representation) - if len(representation) > longest { - longest = len(representation) - } - } - if longest > longFormThreshold { - indenter := strings.Repeat(Indent, int(indentation)) - return fmt.Sprintf("{\n%s%s,\n%s}", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) - } else { - return fmt.Sprintf("{%s}", strings.Join(result, ", ")) - } -} - -func isNilValue(a reflect.Value) bool { - switch a.Kind() { - case reflect.Invalid: - return true - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return a.IsNil() - } - - return false -} - -/* -Returns true when the string is entirely made of printable runes, false otherwise. -*/ -func isPrintableString(str string) bool { - for _, runeValue := range str { - if !strconv.IsPrint(runeValue) { - return false - } - } - return true -} +/* +Gomega's format package pretty-prints objects. It explores input objects recursively and generates formatted, indented output with type information. +*/ +package format + +import ( + "fmt" + "reflect" + "strconv" + "strings" + "time" +) + +// Use MaxDepth to set the maximum recursion depth when printing deeply nested objects +var MaxDepth = uint(10) + +/* +By default, all objects (even those that implement fmt.Stringer and fmt.GoStringer) are recursively inspected to generate output. + +Set UseStringerRepresentation = true to use GoString (for fmt.GoStringers) or String (for fmt.Stringer) instead. + +Note that GoString and String don't always have all the information you need to understand why a test failed! +*/ +var UseStringerRepresentation = false + +/* +Print the content of context objects. By default it will be suppressed. + +Set PrintContextObjects = true to enable printing of the context internals. +*/ +var PrintContextObjects = false + +// Ctx interface defined here to keep backwards compatability with go < 1.7 +// It matches the context.Context interface +type Ctx interface { + Deadline() (deadline time.Time, ok bool) + Done() <-chan struct{} + Err() error + Value(key interface{}) interface{} +} + +var contextType = reflect.TypeOf((*Ctx)(nil)).Elem() +var timeType = reflect.TypeOf(time.Time{}) + +//The default indentation string emitted by the format package +var Indent = " " + +var longFormThreshold = 20 + +/* +Generates a formatted matcher success/failure message of the form: + + Expected + + + + +If expected is omited, then the message looks like: + + Expected + + +*/ +func Message(actual interface{}, message string, expected ...interface{}) string { + if len(expected) == 0 { + return fmt.Sprintf("Expected\n%s\n%s", Object(actual, 1), message) + } else { + return fmt.Sprintf("Expected\n%s\n%s\n%s", Object(actual, 1), message, Object(expected[0], 1)) + } +} + +/* + +Generates a nicely formatted matcher success / failure message + +Much like Message(...), but it attempts to pretty print diffs in strings + +Expected + : "...aaaaabaaaaa..." +to equal | + : "...aaaaazaaaaa..." + +*/ + +func MessageWithDiff(actual, message, expected string) string { + if len(actual) >= truncateThreshold && len(expected) >= truncateThreshold { + diffPoint := findFirstMismatch(actual, expected) + formattedActual := truncateAndFormat(actual, diffPoint) + formattedExpected := truncateAndFormat(expected, diffPoint) + + spacesBeforeFormattedMismatch := findFirstMismatch(formattedActual, formattedExpected) + + tabLength := 4 + spaceFromMessageToActual := tabLength + len(": ") - len(message) + padding := strings.Repeat(" ", spaceFromMessageToActual+spacesBeforeFormattedMismatch) + "|" + return Message(formattedActual, message+padding, formattedExpected) + } + return Message(actual, message, expected) +} + +func truncateAndFormat(str string, index int) string { + leftPadding := `...` + rightPadding := `...` + + start := index - charactersAroundMismatchToInclude + if start < 0 { + start = 0 + leftPadding = "" + } + + // slice index must include the mis-matched character + lengthOfMismatchedCharacter := 1 + end := index + charactersAroundMismatchToInclude + lengthOfMismatchedCharacter + if end > len(str) { + end = len(str) + rightPadding = "" + + } + return fmt.Sprintf("\"%s\"", leftPadding+str[start:end]+rightPadding) +} + +func findFirstMismatch(a, b string) int { + aSlice := strings.Split(a, "") + bSlice := strings.Split(b, "") + + for index, str := range aSlice { + if index > len(b) - 1 { + return index + } + if str != bSlice[index] { + return index + } + } + + if len(b) > len(a) { + return len(a) + 1 + } + + return 0 +} + +const ( + truncateThreshold = 50 + charactersAroundMismatchToInclude = 5 +) + +/* +Pretty prints the passed in object at the passed in indentation level. + +Object recurses into deeply nested objects emitting pretty-printed representations of their components. + +Modify format.MaxDepth to control how deep the recursion is allowed to go +Set format.UseStringerRepresentation to true to return object.GoString() or object.String() when available instead of +recursing into the object. + +Set PrintContextObjects to true to print the content of objects implementing context.Context +*/ +func Object(object interface{}, indentation uint) string { + indent := strings.Repeat(Indent, int(indentation)) + value := reflect.ValueOf(object) + return fmt.Sprintf("%s<%s>: %s", indent, formatType(object), formatValue(value, indentation)) +} + +/* +IndentString takes a string and indents each line by the specified amount. +*/ +func IndentString(s string, indentation uint) string { + components := strings.Split(s, "\n") + result := "" + indent := strings.Repeat(Indent, int(indentation)) + for i, component := range components { + result += indent + component + if i < len(components)-1 { + result += "\n" + } + } + + return result +} + +func formatType(object interface{}) string { + t := reflect.TypeOf(object) + if t == nil { + return "nil" + } + switch t.Kind() { + case reflect.Chan: + v := reflect.ValueOf(object) + return fmt.Sprintf("%T | len:%d, cap:%d", object, v.Len(), v.Cap()) + case reflect.Ptr: + return fmt.Sprintf("%T | %p", object, object) + case reflect.Slice: + v := reflect.ValueOf(object) + return fmt.Sprintf("%T | len:%d, cap:%d", object, v.Len(), v.Cap()) + case reflect.Map: + v := reflect.ValueOf(object) + return fmt.Sprintf("%T | len:%d", object, v.Len()) + default: + return fmt.Sprintf("%T", object) + } +} + +func formatValue(value reflect.Value, indentation uint) string { + if indentation > MaxDepth { + return "..." + } + + if isNilValue(value) { + return "nil" + } + + if UseStringerRepresentation { + if value.CanInterface() { + obj := value.Interface() + switch x := obj.(type) { + case fmt.GoStringer: + return x.GoString() + case fmt.Stringer: + return x.String() + } + } + } + + if !PrintContextObjects { + if value.Type().Implements(contextType) && indentation > 1 { + return "" + } + } + + switch value.Kind() { + case reflect.Bool: + return fmt.Sprintf("%v", value.Bool()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return fmt.Sprintf("%v", value.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return fmt.Sprintf("%v", value.Uint()) + case reflect.Uintptr: + return fmt.Sprintf("0x%x", value.Uint()) + case reflect.Float32, reflect.Float64: + return fmt.Sprintf("%v", value.Float()) + case reflect.Complex64, reflect.Complex128: + return fmt.Sprintf("%v", value.Complex()) + case reflect.Chan: + return fmt.Sprintf("0x%x", value.Pointer()) + case reflect.Func: + return fmt.Sprintf("0x%x", value.Pointer()) + case reflect.Ptr: + return formatValue(value.Elem(), indentation) + case reflect.Slice: + return formatSlice(value, indentation) + case reflect.String: + return formatString(value.String(), indentation) + case reflect.Array: + return formatSlice(value, indentation) + case reflect.Map: + return formatMap(value, indentation) + case reflect.Struct: + if value.Type() == timeType && value.CanInterface() { + t, _ := value.Interface().(time.Time) + return t.Format(time.RFC3339Nano) + } + return formatStruct(value, indentation) + case reflect.Interface: + return formatValue(value.Elem(), indentation) + default: + if value.CanInterface() { + return fmt.Sprintf("%#v", value.Interface()) + } else { + return fmt.Sprintf("%#v", value) + } + } +} + +func formatString(object interface{}, indentation uint) string { + if indentation == 1 { + s := fmt.Sprintf("%s", object) + components := strings.Split(s, "\n") + result := "" + for i, component := range components { + if i == 0 { + result += component + } else { + result += Indent + component + } + if i < len(components)-1 { + result += "\n" + } + } + + return fmt.Sprintf("%s", result) + } else { + return fmt.Sprintf("%q", object) + } +} + +func formatSlice(v reflect.Value, indentation uint) string { + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && isPrintableString(string(v.Bytes())) { + return formatString(v.Bytes(), indentation) + } + + l := v.Len() + result := make([]string, l) + longest := 0 + for i := 0; i < l; i++ { + result[i] = formatValue(v.Index(i), indentation+1) + if len(result[i]) > longest { + longest = len(result[i]) + } + } + + if longest > longFormThreshold { + indenter := strings.Repeat(Indent, int(indentation)) + return fmt.Sprintf("[\n%s%s,\n%s]", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) + } else { + return fmt.Sprintf("[%s]", strings.Join(result, ", ")) + } +} + +func formatMap(v reflect.Value, indentation uint) string { + l := v.Len() + result := make([]string, l) + + longest := 0 + for i, key := range v.MapKeys() { + value := v.MapIndex(key) + result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1), formatValue(value, indentation+1)) + if len(result[i]) > longest { + longest = len(result[i]) + } + } + + if longest > longFormThreshold { + indenter := strings.Repeat(Indent, int(indentation)) + return fmt.Sprintf("{\n%s%s,\n%s}", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) + } else { + return fmt.Sprintf("{%s}", strings.Join(result, ", ")) + } +} + +func formatStruct(v reflect.Value, indentation uint) string { + t := v.Type() + + l := v.NumField() + result := []string{} + longest := 0 + for i := 0; i < l; i++ { + structField := t.Field(i) + fieldEntry := v.Field(i) + representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1)) + result = append(result, representation) + if len(representation) > longest { + longest = len(representation) + } + } + if longest > longFormThreshold { + indenter := strings.Repeat(Indent, int(indentation)) + return fmt.Sprintf("{\n%s%s,\n%s}", indenter+Indent, strings.Join(result, ",\n"+indenter+Indent), indenter) + } else { + return fmt.Sprintf("{%s}", strings.Join(result, ", ")) + } +} + +func isNilValue(a reflect.Value) bool { + switch a.Kind() { + case reflect.Invalid: + return true + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return a.IsNil() + } + + return false +} + +/* +Returns true when the string is entirely made of printable runes, false otherwise. +*/ +func isPrintableString(str string) bool { + for _, runeValue := range str { + if !strconv.IsPrint(runeValue) { + return false + } + } + return true +} diff --git a/vendor/github.com/onsi/gomega/format/format_suite_test.go b/vendor/github.com/onsi/gomega/format/format_suite_test.go index fc4ad4e7b5..8e65a95292 100644 --- a/vendor/github.com/onsi/gomega/format/format_suite_test.go +++ b/vendor/github.com/onsi/gomega/format/format_suite_test.go @@ -1,13 +1,13 @@ -package format_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "testing" -) - -func TestFormat(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Format Suite") -} +package format_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFormat(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Format Suite") +} diff --git a/vendor/github.com/onsi/gomega/format/format_test.go b/vendor/github.com/onsi/gomega/format/format_test.go index b8131c121a..a1a9031640 100644 --- a/vendor/github.com/onsi/gomega/format/format_test.go +++ b/vendor/github.com/onsi/gomega/format/format_test.go @@ -1,590 +1,590 @@ -package format_test - -import ( - "fmt" - "strings" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/format" - "github.com/onsi/gomega/types" -) - -//recursive struct - -type StringAlias string -type ByteAlias []byte -type IntAlias int - -type AStruct struct { - Exported string -} - -type SimpleStruct struct { - Name string - Enumeration int - Veritas bool - Data []byte - secret uint32 -} - -type ComplexStruct struct { - Strings []string - SimpleThings []*SimpleStruct - DataMaps map[int]ByteAlias -} - -type SecretiveStruct struct { - boolValue bool - intValue int - uintValue uint - uintptrValue uintptr - floatValue float32 - complexValue complex64 - chanValue chan bool - funcValue func() - pointerValue *int - sliceValue []string - byteSliceValue []byte - stringValue string - arrValue [3]int - byteArrValue [3]byte - mapValue map[string]int - structValue AStruct - interfaceValue interface{} -} - -type GoStringer struct { -} - -func (g GoStringer) GoString() string { - return "go-string" -} - -func (g GoStringer) String() string { - return "string" -} - -type Stringer struct { -} - -func (g Stringer) String() string { - return "string" -} - -type ctx struct { -} - -func (c *ctx) Deadline() (deadline time.Time, ok bool) { - return time.Time{}, false -} - -func (c *ctx) Done() <-chan struct{} { - return nil -} - -func (c *ctx) Err() error { - return nil -} - -func (c *ctx) Value(key interface{}) interface{} { - return nil -} - -var _ = Describe("Format", func() { - match := func(typeRepresentation string, valueRepresentation string, args ...interface{}) types.GomegaMatcher { - if len(args) > 0 { - valueRepresentation = fmt.Sprintf(valueRepresentation, args...) - } - return Equal(fmt.Sprintf("%s<%s>: %s", Indent, typeRepresentation, valueRepresentation)) - } - - matchRegexp := func(typeRepresentation string, valueRepresentation string, args ...interface{}) types.GomegaMatcher { - if len(args) > 0 { - valueRepresentation = fmt.Sprintf(valueRepresentation, args...) - } - return MatchRegexp(fmt.Sprintf("%s<%s>: %s", Indent, typeRepresentation, valueRepresentation)) - } - - hashMatchingRegexp := func(entries ...string) string { - entriesSwitch := "(" + strings.Join(entries, "|") + ")" - arr := make([]string, len(entries)) - for i := range arr { - arr[i] = entriesSwitch - } - return "{" + strings.Join(arr, ", ") + "}" - } - - Describe("Message", func() { - Context("with only an actual value", func() { - It("should print out an indented formatted representation of the value and the message", func() { - Ω(Message(3, "to be three.")).Should(Equal("Expected\n : 3\nto be three.")) - }) - }) - - Context("with an actual and an expected value", func() { - It("should print out an indented formatted representatino of both values, and the message", func() { - Ω(Message(3, "to equal", 4)).Should(Equal("Expected\n : 3\nto equal\n : 4")) - }) - }) - }) - - Describe("MessageWithDiff", func() { - It("shows the exact point where two long strings differ", func() { - stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - - Ω(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedLongStringFailureMessage)) - }) - - It("truncates the start of long strings that differ only at their end", func() { - stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" - stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz" - - Ω(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedTruncatedStartStringFailureMessage)) - }) - - It("truncates the start of long strings that differ only in length", func() { - smallString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - largeString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - - Ω(MessageWithDiff(largeString, "to equal", smallString)).Should(Equal(expectedTruncatedStartSizeFailureMessage)) - Ω(MessageWithDiff(smallString, "to equal", largeString)).Should(Equal(expectedTruncatedStartSizeSwappedFailureMessage)) - }) - - It("truncates the end of long strings that differ only at their start", func() { - stringWithB := "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - stringWithZ := "zaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - - Ω(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedTruncatedEndStringFailureMessage)) - }) - }) - - Describe("IndentString", func() { - It("should indent the string", func() { - Ω(IndentString("foo\n bar\nbaz", 2)).Should(Equal(" foo\n bar\n baz")) - }) - }) - - Describe("Object", func() { - Describe("formatting boolean values", func() { - It("should give the type and format values correctly", func() { - Ω(Object(true, 1)).Should(match("bool", "true")) - Ω(Object(false, 1)).Should(match("bool", "false")) - }) - }) - - Describe("formatting numbers", func() { - It("should give the type and format values correctly", func() { - Ω(Object(int(3), 1)).Should(match("int", "3")) - Ω(Object(int8(3), 1)).Should(match("int8", "3")) - Ω(Object(int16(3), 1)).Should(match("int16", "3")) - Ω(Object(int32(3), 1)).Should(match("int32", "3")) - Ω(Object(int64(3), 1)).Should(match("int64", "3")) - - Ω(Object(uint(3), 1)).Should(match("uint", "3")) - Ω(Object(uint8(3), 1)).Should(match("uint8", "3")) - Ω(Object(uint16(3), 1)).Should(match("uint16", "3")) - Ω(Object(uint32(3), 1)).Should(match("uint32", "3")) - Ω(Object(uint64(3), 1)).Should(match("uint64", "3")) - }) - - It("should handle uintptr differently", func() { - Ω(Object(uintptr(3), 1)).Should(match("uintptr", "0x3")) - }) - }) - - Describe("formatting channels", func() { - It("should give the type and format values correctly", func() { - c := make(chan<- bool, 3) - c <- true - c <- false - Ω(Object(c, 1)).Should(match("chan<- bool | len:2, cap:3", "%v", c)) - }) - }) - - Describe("formatting strings", func() { - It("should give the type and format values correctly", func() { - s := "a\nb\nc" - Ω(Object(s, 1)).Should(match("string", `a - b - c`)) - }) - }) - - Describe("formatting []byte slices", func() { - Context("when the slice is made of printable bytes", func() { - It("should present it as string", func() { - b := []byte("a b c") - Ω(Object(b, 1)).Should(matchRegexp(`\[\]uint8 \| len:5, cap:\d+`, `a b c`)) - }) - }) - Context("when the slice contains non-printable bytes", func() { - It("should present it as slice", func() { - b := []byte("a b c\n\x01\x02\x03\xff\x1bH") - Ω(Object(b, 1)).Should(matchRegexp(`\[\]uint8 \| len:12, cap:\d+`, `\[97, 32, 98, 32, 99, 10, 1, 2, 3, 255, 27, 72\]`)) - }) - }) - }) - - Describe("formatting functions", func() { - It("should give the type and format values correctly", func() { - f := func(a string, b []int) ([]byte, error) { - return []byte("abc"), nil - } - Ω(Object(f, 1)).Should(match("func(string, []int) ([]uint8, error)", "%v", f)) - }) - }) - - Describe("formatting pointers", func() { - It("should give the type and dereference the value to format it correctly", func() { - a := 3 - Ω(Object(&a, 1)).Should(match(fmt.Sprintf("*int | %p", &a), "3")) - }) - - Context("when there are pointers to pointers...", func() { - It("should recursively deference the pointer until it gets to a value", func() { - a := 3 - var b *int - var c **int - var d ***int - b = &a - c = &b - d = &c - - Ω(Object(d, 1)).Should(match(fmt.Sprintf("***int | %p", d), "3")) - }) - }) - - Context("when the pointer points to nil", func() { - It("should say nil and not explode", func() { - var a *AStruct - Ω(Object(a, 1)).Should(match("*format_test.AStruct | 0x0", "nil")) - }) - }) - }) - - Describe("formatting arrays", func() { - It("should give the type and format values correctly", func() { - w := [3]string{"Jed Bartlet", "Toby Ziegler", "CJ Cregg"} - Ω(Object(w, 1)).Should(match("[3]string", `["Jed Bartlet", "Toby Ziegler", "CJ Cregg"]`)) - }) - - Context("with byte arrays", func() { - It("should give the type and format values correctly", func() { - w := [3]byte{17, 28, 19} - Ω(Object(w, 1)).Should(match("[3]uint8", `[17, 28, 19]`)) - }) - }) - }) - - Describe("formatting slices", func() { - It("should include the length and capacity in the type information", func() { - s := make([]bool, 3, 4) - Ω(Object(s, 1)).Should(match("[]bool | len:3, cap:4", "[false, false, false]")) - }) - - Context("when the slice contains long entries", func() { - It("should format the entries with newlines", func() { - w := []string{"Josiah Edward Bartlet", "Toby Ziegler", "CJ Cregg"} - expected := `[ - "Josiah Edward Bartlet", - "Toby Ziegler", - "CJ Cregg", - ]` - Ω(Object(w, 1)).Should(match("[]string | len:3, cap:3", expected)) - }) - }) - }) - - Describe("formatting maps", func() { - It("should include the length in the type information", func() { - m := make(map[int]bool, 5) - m[3] = true - m[4] = false - Ω(Object(m, 1)).Should(matchRegexp(`map\[int\]bool \| len:2`, hashMatchingRegexp("3: true", "4: false"))) - }) - - Context("when the slice contains long entries", func() { - It("should format the entries with newlines", func() { - m := map[string][]byte{} - m["Josiah Edward Bartlet"] = []byte("Martin Sheen") - m["Toby Ziegler"] = []byte("Richard Schiff") - m["CJ Cregg"] = []byte("Allison Janney") - expected := `{ - ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"), - ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"), - ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"), - }` - Ω(Object(m, 1)).Should(matchRegexp(`map\[string\]\[\]uint8 \| len:3`, expected)) - }) - }) - }) - - Describe("formatting structs", func() { - It("should include the struct name and the field names", func() { - s := SimpleStruct{ - Name: "Oswald", - Enumeration: 17, - Veritas: true, - Data: []byte("datum"), - secret: 1983, - } - - Ω(Object(s, 1)).Should(match("format_test.SimpleStruct", `{Name: "Oswald", Enumeration: 17, Veritas: true, Data: "datum", secret: 1983}`)) - }) - - Context("when the struct contains long entries", func() { - It("should format the entries with new lines", func() { - s := &SimpleStruct{ - Name: "Mithrandir Gandalf Greyhame", - Enumeration: 2021, - Veritas: true, - Data: []byte("wizard"), - secret: 3, - } - - Ω(Object(s, 1)).Should(match(fmt.Sprintf("*format_test.SimpleStruct | %p", s), `{ - Name: "Mithrandir Gandalf Greyhame", - Enumeration: 2021, - Veritas: true, - Data: "wizard", - secret: 3, - }`)) - }) - }) - }) - - Describe("formatting nil values", func() { - It("should print out nil", func() { - Ω(Object(nil, 1)).Should(match("nil", "nil")) - var typedNil *AStruct - Ω(Object(typedNil, 1)).Should(match("*format_test.AStruct | 0x0", "nil")) - var c chan<- bool - Ω(Object(c, 1)).Should(match("chan<- bool | len:0, cap:0", "nil")) - var s []string - Ω(Object(s, 1)).Should(match("[]string | len:0, cap:0", "nil")) - var m map[string]bool - Ω(Object(m, 1)).Should(match("map[string]bool | len:0", "nil")) - }) - }) - - Describe("formatting aliased types", func() { - It("should print out the correct alias type", func() { - Ω(Object(StringAlias("alias"), 1)).Should(match("format_test.StringAlias", `alias`)) - Ω(Object(ByteAlias("alias"), 1)).Should(matchRegexp(`format_test\.ByteAlias \| len:5, cap:\d+`, `alias`)) - Ω(Object(IntAlias(3), 1)).Should(match("format_test.IntAlias", "3")) - }) - }) - - Describe("handling nested things", func() { - It("should produce a correctly nested representation", func() { - s := ComplexStruct{ - Strings: []string{"lots", "of", "short", "strings"}, - SimpleThings: []*SimpleStruct{ - {"short", 7, true, []byte("succinct"), 17}, - {"something longer", 427, true, []byte("designed to wrap around nicely"), 30}, - }, - DataMaps: map[int]ByteAlias{ - 17: ByteAlias("some substantially longer chunks of data"), - 1138: ByteAlias("that should make things wrap"), - }, - } - expected := `{ - Strings: \["lots", "of", "short", "strings"\], - SimpleThings: \[ - {Name: "short", Enumeration: 7, Veritas: true, Data: "succinct", secret: 17}, - { - Name: "something longer", - Enumeration: 427, - Veritas: true, - Data: "designed to wrap around nicely", - secret: 30, - }, - \], - DataMaps: { - (17: "some substantially longer chunks of data"|1138: "that should make things wrap"), - (17: "some substantially longer chunks of data"|1138: "that should make things wrap"), - }, - }` - Ω(Object(s, 1)).Should(matchRegexp(`format_test\.ComplexStruct`, expected)) - }) - }) - - Describe("formatting times", func() { - It("should format time as RFC3339", func() { - t := time.Date(2016, 10, 31, 9, 57, 23, 12345, time.UTC) - Ω(Object(t, 1)).Should(match("time.Time", `2016-10-31T09:57:23.000012345Z`)) - }) - }) - }) - - Describe("Handling unexported fields in structs", func() { - It("should handle all the various types correctly", func() { - a := int(5) - s := SecretiveStruct{ - boolValue: true, - intValue: 3, - uintValue: 4, - uintptrValue: 5, - floatValue: 6.0, - complexValue: complex(5.0, 3.0), - chanValue: make(chan bool, 2), - funcValue: func() {}, - pointerValue: &a, - sliceValue: []string{"string", "slice"}, - byteSliceValue: []byte("bytes"), - stringValue: "a string", - arrValue: [3]int{11, 12, 13}, - byteArrValue: [3]byte{17, 20, 32}, - mapValue: map[string]int{"a key": 20, "b key": 30}, - structValue: AStruct{"exported"}, - interfaceValue: map[string]int{"a key": 17}, - } - - expected := fmt.Sprintf(`{ - boolValue: true, - intValue: 3, - uintValue: 4, - uintptrValue: 0x5, - floatValue: 6, - complexValue: \(5\+3i\), - chanValue: %p, - funcValue: %p, - pointerValue: 5, - sliceValue: \["string", "slice"\], - byteSliceValue: "bytes", - stringValue: "a string", - arrValue: \[11, 12, 13\], - byteArrValue: \[17, 20, 32\], - mapValue: %s, - structValue: {Exported: "exported"}, - interfaceValue: {"a key": 17}, - }`, s.chanValue, s.funcValue, hashMatchingRegexp(`"a key": 20`, `"b key": 30`)) - - Ω(Object(s, 1)).Should(matchRegexp(`format_test\.SecretiveStruct`, expected)) - }) - }) - - Describe("Handling interfaces", func() { - It("should unpack the interface", func() { - outerHash := map[string]interface{}{} - innerHash := map[string]int{} - - innerHash["inner"] = 3 - outerHash["integer"] = 2 - outerHash["map"] = innerHash - - expected := hashMatchingRegexp(`"integer": 2`, `"map": {"inner": 3}`) - Ω(Object(outerHash, 1)).Should(matchRegexp(`map\[string\]interface {} \| len:2`, expected)) - }) - }) - - Describe("Handling recursive things", func() { - It("should not go crazy...", func() { - m := map[string]interface{}{} - m["integer"] = 2 - m["map"] = m - Ω(Object(m, 1)).Should(ContainSubstring("...")) - }) - - It("really should not go crazy...", func() { - type complexKey struct { - Value map[interface{}]int - } - - complexObject := complexKey{} - complexObject.Value = make(map[interface{}]int) - - complexObject.Value[&complexObject] = 2 - Ω(Object(complexObject, 1)).Should(ContainSubstring("...")) - }) - }) - - Describe("When instructed to use the Stringer representation", func() { - BeforeEach(func() { - UseStringerRepresentation = true - }) - - AfterEach(func() { - UseStringerRepresentation = false - }) - - Context("when passed a GoStringer", func() { - It("should use what GoString() returns", func() { - Ω(Object(GoStringer{}, 1)).Should(ContainSubstring(": go-string")) - }) - }) - - Context("when passed a stringer", func() { - It("should use what String() returns", func() { - Ω(Object(Stringer{}, 1)).Should(ContainSubstring(": string")) - }) - }) - }) - - Describe("Printing a context.Context field", func() { - - type structWithContext struct { - Context Ctx - Value string - } - - context := ctx{} - objWithContext := structWithContext{Value: "some-value", Context: &context} - - It("Suppresses the content by default", func() { - Ω(Object(objWithContext, 1)).Should(ContainSubstring("")) - }) - - It("Doesn't supress the context if it's the object being printed", func() { - Ω(Object(context, 1)).ShouldNot(MatchRegexp("^.*$")) - }) - - Context("PrintContextObjects is set", func() { - BeforeEach(func() { - PrintContextObjects = true - }) - - AfterEach(func() { - PrintContextObjects = false - }) - - It("Prints the context", func() { - Ω(Object(objWithContext, 1)).ShouldNot(ContainSubstring("")) - }) - }) - }) -}) - -var expectedLongStringFailureMessage = strings.TrimSpace(` -Expected - : "...aaaaabaaaaa..." -to equal | - : "...aaaaazaaaaa..." -`) -var expectedTruncatedEndStringFailureMessage = strings.TrimSpace(` -Expected - : "baaaaa..." -to equal | - : "zaaaaa..." -`) -var expectedTruncatedStartStringFailureMessage = strings.TrimSpace(` -Expected - : "...aaaaab" -to equal | - : "...aaaaaz" -`) -var expectedTruncatedStartSizeFailureMessage = strings.TrimSpace(` -Expected - : "...aaaaaa" -to equal | - : "...aaaaa" -`) -var expectedTruncatedStartSizeSwappedFailureMessage = strings.TrimSpace(` -Expected - : "...aaaa" -to equal | - : "...aaaaa" -`) +package format_test + +import ( + "fmt" + "strings" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/format" + "github.com/onsi/gomega/types" +) + +//recursive struct + +type StringAlias string +type ByteAlias []byte +type IntAlias int + +type AStruct struct { + Exported string +} + +type SimpleStruct struct { + Name string + Enumeration int + Veritas bool + Data []byte + secret uint32 +} + +type ComplexStruct struct { + Strings []string + SimpleThings []*SimpleStruct + DataMaps map[int]ByteAlias +} + +type SecretiveStruct struct { + boolValue bool + intValue int + uintValue uint + uintptrValue uintptr + floatValue float32 + complexValue complex64 + chanValue chan bool + funcValue func() + pointerValue *int + sliceValue []string + byteSliceValue []byte + stringValue string + arrValue [3]int + byteArrValue [3]byte + mapValue map[string]int + structValue AStruct + interfaceValue interface{} +} + +type GoStringer struct { +} + +func (g GoStringer) GoString() string { + return "go-string" +} + +func (g GoStringer) String() string { + return "string" +} + +type Stringer struct { +} + +func (g Stringer) String() string { + return "string" +} + +type ctx struct { +} + +func (c *ctx) Deadline() (deadline time.Time, ok bool) { + return time.Time{}, false +} + +func (c *ctx) Done() <-chan struct{} { + return nil +} + +func (c *ctx) Err() error { + return nil +} + +func (c *ctx) Value(key interface{}) interface{} { + return nil +} + +var _ = Describe("Format", func() { + match := func(typeRepresentation string, valueRepresentation string, args ...interface{}) types.GomegaMatcher { + if len(args) > 0 { + valueRepresentation = fmt.Sprintf(valueRepresentation, args...) + } + return Equal(fmt.Sprintf("%s<%s>: %s", Indent, typeRepresentation, valueRepresentation)) + } + + matchRegexp := func(typeRepresentation string, valueRepresentation string, args ...interface{}) types.GomegaMatcher { + if len(args) > 0 { + valueRepresentation = fmt.Sprintf(valueRepresentation, args...) + } + return MatchRegexp(fmt.Sprintf("%s<%s>: %s", Indent, typeRepresentation, valueRepresentation)) + } + + hashMatchingRegexp := func(entries ...string) string { + entriesSwitch := "(" + strings.Join(entries, "|") + ")" + arr := make([]string, len(entries)) + for i := range arr { + arr[i] = entriesSwitch + } + return "{" + strings.Join(arr, ", ") + "}" + } + + Describe("Message", func() { + Context("with only an actual value", func() { + It("should print out an indented formatted representation of the value and the message", func() { + Ω(Message(3, "to be three.")).Should(Equal("Expected\n : 3\nto be three.")) + }) + }) + + Context("with an actual and an expected value", func() { + It("should print out an indented formatted representatino of both values, and the message", func() { + Ω(Message(3, "to equal", 4)).Should(Equal("Expected\n : 3\nto equal\n : 4")) + }) + }) + }) + + Describe("MessageWithDiff", func() { + It("shows the exact point where two long strings differ", func() { + stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + Ω(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedLongStringFailureMessage)) + }) + + It("truncates the start of long strings that differ only at their end", func() { + stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab" + stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz" + + Ω(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedTruncatedStartStringFailureMessage)) + }) + + It("truncates the start of long strings that differ only in length", func() { + smallString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + largeString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + Ω(MessageWithDiff(largeString, "to equal", smallString)).Should(Equal(expectedTruncatedStartSizeFailureMessage)) + Ω(MessageWithDiff(smallString, "to equal", largeString)).Should(Equal(expectedTruncatedStartSizeSwappedFailureMessage)) + }) + + It("truncates the end of long strings that differ only at their start", func() { + stringWithB := "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + stringWithZ := "zaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + Ω(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedTruncatedEndStringFailureMessage)) + }) + }) + + Describe("IndentString", func() { + It("should indent the string", func() { + Ω(IndentString("foo\n bar\nbaz", 2)).Should(Equal(" foo\n bar\n baz")) + }) + }) + + Describe("Object", func() { + Describe("formatting boolean values", func() { + It("should give the type and format values correctly", func() { + Ω(Object(true, 1)).Should(match("bool", "true")) + Ω(Object(false, 1)).Should(match("bool", "false")) + }) + }) + + Describe("formatting numbers", func() { + It("should give the type and format values correctly", func() { + Ω(Object(int(3), 1)).Should(match("int", "3")) + Ω(Object(int8(3), 1)).Should(match("int8", "3")) + Ω(Object(int16(3), 1)).Should(match("int16", "3")) + Ω(Object(int32(3), 1)).Should(match("int32", "3")) + Ω(Object(int64(3), 1)).Should(match("int64", "3")) + + Ω(Object(uint(3), 1)).Should(match("uint", "3")) + Ω(Object(uint8(3), 1)).Should(match("uint8", "3")) + Ω(Object(uint16(3), 1)).Should(match("uint16", "3")) + Ω(Object(uint32(3), 1)).Should(match("uint32", "3")) + Ω(Object(uint64(3), 1)).Should(match("uint64", "3")) + }) + + It("should handle uintptr differently", func() { + Ω(Object(uintptr(3), 1)).Should(match("uintptr", "0x3")) + }) + }) + + Describe("formatting channels", func() { + It("should give the type and format values correctly", func() { + c := make(chan<- bool, 3) + c <- true + c <- false + Ω(Object(c, 1)).Should(match("chan<- bool | len:2, cap:3", "%v", c)) + }) + }) + + Describe("formatting strings", func() { + It("should give the type and format values correctly", func() { + s := "a\nb\nc" + Ω(Object(s, 1)).Should(match("string", `a + b + c`)) + }) + }) + + Describe("formatting []byte slices", func() { + Context("when the slice is made of printable bytes", func() { + It("should present it as string", func() { + b := []byte("a b c") + Ω(Object(b, 1)).Should(matchRegexp(`\[\]uint8 \| len:5, cap:\d+`, `a b c`)) + }) + }) + Context("when the slice contains non-printable bytes", func() { + It("should present it as slice", func() { + b := []byte("a b c\n\x01\x02\x03\xff\x1bH") + Ω(Object(b, 1)).Should(matchRegexp(`\[\]uint8 \| len:12, cap:\d+`, `\[97, 32, 98, 32, 99, 10, 1, 2, 3, 255, 27, 72\]`)) + }) + }) + }) + + Describe("formatting functions", func() { + It("should give the type and format values correctly", func() { + f := func(a string, b []int) ([]byte, error) { + return []byte("abc"), nil + } + Ω(Object(f, 1)).Should(match("func(string, []int) ([]uint8, error)", "%v", f)) + }) + }) + + Describe("formatting pointers", func() { + It("should give the type and dereference the value to format it correctly", func() { + a := 3 + Ω(Object(&a, 1)).Should(match(fmt.Sprintf("*int | %p", &a), "3")) + }) + + Context("when there are pointers to pointers...", func() { + It("should recursively deference the pointer until it gets to a value", func() { + a := 3 + var b *int + var c **int + var d ***int + b = &a + c = &b + d = &c + + Ω(Object(d, 1)).Should(match(fmt.Sprintf("***int | %p", d), "3")) + }) + }) + + Context("when the pointer points to nil", func() { + It("should say nil and not explode", func() { + var a *AStruct + Ω(Object(a, 1)).Should(match("*format_test.AStruct | 0x0", "nil")) + }) + }) + }) + + Describe("formatting arrays", func() { + It("should give the type and format values correctly", func() { + w := [3]string{"Jed Bartlet", "Toby Ziegler", "CJ Cregg"} + Ω(Object(w, 1)).Should(match("[3]string", `["Jed Bartlet", "Toby Ziegler", "CJ Cregg"]`)) + }) + + Context("with byte arrays", func() { + It("should give the type and format values correctly", func() { + w := [3]byte{17, 28, 19} + Ω(Object(w, 1)).Should(match("[3]uint8", `[17, 28, 19]`)) + }) + }) + }) + + Describe("formatting slices", func() { + It("should include the length and capacity in the type information", func() { + s := make([]bool, 3, 4) + Ω(Object(s, 1)).Should(match("[]bool | len:3, cap:4", "[false, false, false]")) + }) + + Context("when the slice contains long entries", func() { + It("should format the entries with newlines", func() { + w := []string{"Josiah Edward Bartlet", "Toby Ziegler", "CJ Cregg"} + expected := `[ + "Josiah Edward Bartlet", + "Toby Ziegler", + "CJ Cregg", + ]` + Ω(Object(w, 1)).Should(match("[]string | len:3, cap:3", expected)) + }) + }) + }) + + Describe("formatting maps", func() { + It("should include the length in the type information", func() { + m := make(map[int]bool, 5) + m[3] = true + m[4] = false + Ω(Object(m, 1)).Should(matchRegexp(`map\[int\]bool \| len:2`, hashMatchingRegexp("3: true", "4: false"))) + }) + + Context("when the slice contains long entries", func() { + It("should format the entries with newlines", func() { + m := map[string][]byte{} + m["Josiah Edward Bartlet"] = []byte("Martin Sheen") + m["Toby Ziegler"] = []byte("Richard Schiff") + m["CJ Cregg"] = []byte("Allison Janney") + expected := `{ + ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"), + ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"), + ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"), + }` + Ω(Object(m, 1)).Should(matchRegexp(`map\[string\]\[\]uint8 \| len:3`, expected)) + }) + }) + }) + + Describe("formatting structs", func() { + It("should include the struct name and the field names", func() { + s := SimpleStruct{ + Name: "Oswald", + Enumeration: 17, + Veritas: true, + Data: []byte("datum"), + secret: 1983, + } + + Ω(Object(s, 1)).Should(match("format_test.SimpleStruct", `{Name: "Oswald", Enumeration: 17, Veritas: true, Data: "datum", secret: 1983}`)) + }) + + Context("when the struct contains long entries", func() { + It("should format the entries with new lines", func() { + s := &SimpleStruct{ + Name: "Mithrandir Gandalf Greyhame", + Enumeration: 2021, + Veritas: true, + Data: []byte("wizard"), + secret: 3, + } + + Ω(Object(s, 1)).Should(match(fmt.Sprintf("*format_test.SimpleStruct | %p", s), `{ + Name: "Mithrandir Gandalf Greyhame", + Enumeration: 2021, + Veritas: true, + Data: "wizard", + secret: 3, + }`)) + }) + }) + }) + + Describe("formatting nil values", func() { + It("should print out nil", func() { + Ω(Object(nil, 1)).Should(match("nil", "nil")) + var typedNil *AStruct + Ω(Object(typedNil, 1)).Should(match("*format_test.AStruct | 0x0", "nil")) + var c chan<- bool + Ω(Object(c, 1)).Should(match("chan<- bool | len:0, cap:0", "nil")) + var s []string + Ω(Object(s, 1)).Should(match("[]string | len:0, cap:0", "nil")) + var m map[string]bool + Ω(Object(m, 1)).Should(match("map[string]bool | len:0", "nil")) + }) + }) + + Describe("formatting aliased types", func() { + It("should print out the correct alias type", func() { + Ω(Object(StringAlias("alias"), 1)).Should(match("format_test.StringAlias", `alias`)) + Ω(Object(ByteAlias("alias"), 1)).Should(matchRegexp(`format_test\.ByteAlias \| len:5, cap:\d+`, `alias`)) + Ω(Object(IntAlias(3), 1)).Should(match("format_test.IntAlias", "3")) + }) + }) + + Describe("handling nested things", func() { + It("should produce a correctly nested representation", func() { + s := ComplexStruct{ + Strings: []string{"lots", "of", "short", "strings"}, + SimpleThings: []*SimpleStruct{ + {"short", 7, true, []byte("succinct"), 17}, + {"something longer", 427, true, []byte("designed to wrap around nicely"), 30}, + }, + DataMaps: map[int]ByteAlias{ + 17: ByteAlias("some substantially longer chunks of data"), + 1138: ByteAlias("that should make things wrap"), + }, + } + expected := `{ + Strings: \["lots", "of", "short", "strings"\], + SimpleThings: \[ + {Name: "short", Enumeration: 7, Veritas: true, Data: "succinct", secret: 17}, + { + Name: "something longer", + Enumeration: 427, + Veritas: true, + Data: "designed to wrap around nicely", + secret: 30, + }, + \], + DataMaps: { + (17: "some substantially longer chunks of data"|1138: "that should make things wrap"), + (17: "some substantially longer chunks of data"|1138: "that should make things wrap"), + }, + }` + Ω(Object(s, 1)).Should(matchRegexp(`format_test\.ComplexStruct`, expected)) + }) + }) + + Describe("formatting times", func() { + It("should format time as RFC3339", func() { + t := time.Date(2016, 10, 31, 9, 57, 23, 12345, time.UTC) + Ω(Object(t, 1)).Should(match("time.Time", `2016-10-31T09:57:23.000012345Z`)) + }) + }) + }) + + Describe("Handling unexported fields in structs", func() { + It("should handle all the various types correctly", func() { + a := int(5) + s := SecretiveStruct{ + boolValue: true, + intValue: 3, + uintValue: 4, + uintptrValue: 5, + floatValue: 6.0, + complexValue: complex(5.0, 3.0), + chanValue: make(chan bool, 2), + funcValue: func() {}, + pointerValue: &a, + sliceValue: []string{"string", "slice"}, + byteSliceValue: []byte("bytes"), + stringValue: "a string", + arrValue: [3]int{11, 12, 13}, + byteArrValue: [3]byte{17, 20, 32}, + mapValue: map[string]int{"a key": 20, "b key": 30}, + structValue: AStruct{"exported"}, + interfaceValue: map[string]int{"a key": 17}, + } + + expected := fmt.Sprintf(`{ + boolValue: true, + intValue: 3, + uintValue: 4, + uintptrValue: 0x5, + floatValue: 6, + complexValue: \(5\+3i\), + chanValue: %p, + funcValue: %p, + pointerValue: 5, + sliceValue: \["string", "slice"\], + byteSliceValue: "bytes", + stringValue: "a string", + arrValue: \[11, 12, 13\], + byteArrValue: \[17, 20, 32\], + mapValue: %s, + structValue: {Exported: "exported"}, + interfaceValue: {"a key": 17}, + }`, s.chanValue, s.funcValue, hashMatchingRegexp(`"a key": 20`, `"b key": 30`)) + + Ω(Object(s, 1)).Should(matchRegexp(`format_test\.SecretiveStruct`, expected)) + }) + }) + + Describe("Handling interfaces", func() { + It("should unpack the interface", func() { + outerHash := map[string]interface{}{} + innerHash := map[string]int{} + + innerHash["inner"] = 3 + outerHash["integer"] = 2 + outerHash["map"] = innerHash + + expected := hashMatchingRegexp(`"integer": 2`, `"map": {"inner": 3}`) + Ω(Object(outerHash, 1)).Should(matchRegexp(`map\[string\]interface {} \| len:2`, expected)) + }) + }) + + Describe("Handling recursive things", func() { + It("should not go crazy...", func() { + m := map[string]interface{}{} + m["integer"] = 2 + m["map"] = m + Ω(Object(m, 1)).Should(ContainSubstring("...")) + }) + + It("really should not go crazy...", func() { + type complexKey struct { + Value map[interface{}]int + } + + complexObject := complexKey{} + complexObject.Value = make(map[interface{}]int) + + complexObject.Value[&complexObject] = 2 + Ω(Object(complexObject, 1)).Should(ContainSubstring("...")) + }) + }) + + Describe("When instructed to use the Stringer representation", func() { + BeforeEach(func() { + UseStringerRepresentation = true + }) + + AfterEach(func() { + UseStringerRepresentation = false + }) + + Context("when passed a GoStringer", func() { + It("should use what GoString() returns", func() { + Ω(Object(GoStringer{}, 1)).Should(ContainSubstring(": go-string")) + }) + }) + + Context("when passed a stringer", func() { + It("should use what String() returns", func() { + Ω(Object(Stringer{}, 1)).Should(ContainSubstring(": string")) + }) + }) + }) + + Describe("Printing a context.Context field", func() { + + type structWithContext struct { + Context Ctx + Value string + } + + context := ctx{} + objWithContext := structWithContext{Value: "some-value", Context: &context} + + It("Suppresses the content by default", func() { + Ω(Object(objWithContext, 1)).Should(ContainSubstring("")) + }) + + It("Doesn't supress the context if it's the object being printed", func() { + Ω(Object(context, 1)).ShouldNot(MatchRegexp("^.*$")) + }) + + Context("PrintContextObjects is set", func() { + BeforeEach(func() { + PrintContextObjects = true + }) + + AfterEach(func() { + PrintContextObjects = false + }) + + It("Prints the context", func() { + Ω(Object(objWithContext, 1)).ShouldNot(ContainSubstring("")) + }) + }) + }) +}) + +var expectedLongStringFailureMessage = strings.TrimSpace(` +Expected + : "...aaaaabaaaaa..." +to equal | + : "...aaaaazaaaaa..." +`) +var expectedTruncatedEndStringFailureMessage = strings.TrimSpace(` +Expected + : "baaaaa..." +to equal | + : "zaaaaa..." +`) +var expectedTruncatedStartStringFailureMessage = strings.TrimSpace(` +Expected + : "...aaaaab" +to equal | + : "...aaaaaz" +`) +var expectedTruncatedStartSizeFailureMessage = strings.TrimSpace(` +Expected + : "...aaaaaa" +to equal | + : "...aaaaa" +`) +var expectedTruncatedStartSizeSwappedFailureMessage = strings.TrimSpace(` +Expected + : "...aaaa" +to equal | + : "...aaaaa" +`) diff --git a/vendor/github.com/onsi/gomega/gbytes/buffer.go b/vendor/github.com/onsi/gomega/gbytes/buffer.go index 33d4c0b240..8775b8611a 100644 --- a/vendor/github.com/onsi/gomega/gbytes/buffer.go +++ b/vendor/github.com/onsi/gomega/gbytes/buffer.go @@ -1,229 +1,229 @@ -/* -Package gbytes provides a buffer that supports incrementally detecting input. - -You use gbytes.Buffer with the gbytes.Say matcher. When Say finds a match, it fastforwards the buffer's read cursor to the end of that match. - -Subsequent matches against the buffer will only operate against data that appears *after* the read cursor. - -The read cursor is an opaque implementation detail that you cannot access. You should use the Say matcher to sift through the buffer. You can always -access the entire buffer's contents with Contents(). - -*/ -package gbytes - -import ( - "errors" - "fmt" - "io" - "regexp" - "sync" - "time" -) - -/* -gbytes.Buffer implements an io.Writer and can be used with the gbytes.Say matcher. - -You should only use a gbytes.Buffer in test code. It stores all writes in an in-memory buffer - behavior that is inappropriate for production code! -*/ -type Buffer struct { - contents []byte - readCursor uint64 - lock *sync.Mutex - detectCloser chan interface{} - closed bool -} - -/* -NewBuffer returns a new gbytes.Buffer -*/ -func NewBuffer() *Buffer { - return &Buffer{ - lock: &sync.Mutex{}, - } -} - -/* -BufferWithBytes returns a new gbytes.Buffer seeded with the passed in bytes -*/ -func BufferWithBytes(bytes []byte) *Buffer { - return &Buffer{ - lock: &sync.Mutex{}, - contents: bytes, - } -} - -/* -Write implements the io.Writer interface -*/ -func (b *Buffer) Write(p []byte) (n int, err error) { - b.lock.Lock() - defer b.lock.Unlock() - - if b.closed { - return 0, errors.New("attempt to write to closed buffer") - } - - b.contents = append(b.contents, p...) - return len(p), nil -} - -/* -Read implements the io.Reader interface. It advances the -cursor as it reads. - -Returns an error if called after Close. -*/ -func (b *Buffer) Read(d []byte) (int, error) { - b.lock.Lock() - defer b.lock.Unlock() - - if b.closed { - return 0, errors.New("attempt to read from closed buffer") - } - - if uint64(len(b.contents)) <= b.readCursor { - return 0, io.EOF - } - - n := copy(d, b.contents[b.readCursor:]) - b.readCursor += uint64(n) - - return n, nil -} - -/* -Close signifies that the buffer will no longer be written to -*/ -func (b *Buffer) Close() error { - b.lock.Lock() - defer b.lock.Unlock() - - b.closed = true - - return nil -} - -/* -Closed returns true if the buffer has been closed -*/ -func (b *Buffer) Closed() bool { - b.lock.Lock() - defer b.lock.Unlock() - - return b.closed -} - -/* -Contents returns all data ever written to the buffer. -*/ -func (b *Buffer) Contents() []byte { - b.lock.Lock() - defer b.lock.Unlock() - - contents := make([]byte, len(b.contents)) - copy(contents, b.contents) - return contents -} - -/* -Detect takes a regular expression and returns a channel. - -The channel will receive true the first time data matching the regular expression is written to the buffer. -The channel is subsequently closed and the buffer's read-cursor is fast-forwarded to just after the matching region. - -You typically don't need to use Detect and should use the ghttp.Say matcher instead. Detect is useful, however, in cases where your code must -be branch and handle different outputs written to the buffer. - -For example, consider a buffer hooked up to the stdout of a client library. You may (or may not, depending on state outside of your control) need to authenticate the client library. - -You could do something like: - -select { -case <-buffer.Detect("You are not logged in"): - //log in -case <-buffer.Detect("Success"): - //carry on -case <-time.After(time.Second): - //welp -} -buffer.CancelDetects() - -You should always call CancelDetects after using Detect. This will close any channels that have not detected and clean up the goroutines that were spawned to support them. - -Finally, you can pass detect a format string followed by variadic arguments. This will construct the regexp using fmt.Sprintf. -*/ -func (b *Buffer) Detect(desired string, args ...interface{}) chan bool { - formattedRegexp := desired - if len(args) > 0 { - formattedRegexp = fmt.Sprintf(desired, args...) - } - re := regexp.MustCompile(formattedRegexp) - - b.lock.Lock() - defer b.lock.Unlock() - - if b.detectCloser == nil { - b.detectCloser = make(chan interface{}) - } - - closer := b.detectCloser - response := make(chan bool) - go func() { - ticker := time.NewTicker(10 * time.Millisecond) - defer ticker.Stop() - defer close(response) - for { - select { - case <-ticker.C: - b.lock.Lock() - data, cursor := b.contents[b.readCursor:], b.readCursor - loc := re.FindIndex(data) - b.lock.Unlock() - - if loc != nil { - response <- true - b.lock.Lock() - newCursorPosition := cursor + uint64(loc[1]) - if newCursorPosition >= b.readCursor { - b.readCursor = newCursorPosition - } - b.lock.Unlock() - return - } - case <-closer: - return - } - } - }() - - return response -} - -/* -CancelDetects cancels any pending detects and cleans up their goroutines. You should always call this when you're done with a set of Detect channels. -*/ -func (b *Buffer) CancelDetects() { - b.lock.Lock() - defer b.lock.Unlock() - - close(b.detectCloser) - b.detectCloser = nil -} - -func (b *Buffer) didSay(re *regexp.Regexp) (bool, []byte) { - b.lock.Lock() - defer b.lock.Unlock() - - unreadBytes := b.contents[b.readCursor:] - copyOfUnreadBytes := make([]byte, len(unreadBytes)) - copy(copyOfUnreadBytes, unreadBytes) - - loc := re.FindIndex(unreadBytes) - - if loc != nil { - b.readCursor += uint64(loc[1]) - return true, copyOfUnreadBytes - } else { - return false, copyOfUnreadBytes - } -} +/* +Package gbytes provides a buffer that supports incrementally detecting input. + +You use gbytes.Buffer with the gbytes.Say matcher. When Say finds a match, it fastforwards the buffer's read cursor to the end of that match. + +Subsequent matches against the buffer will only operate against data that appears *after* the read cursor. + +The read cursor is an opaque implementation detail that you cannot access. You should use the Say matcher to sift through the buffer. You can always +access the entire buffer's contents with Contents(). + +*/ +package gbytes + +import ( + "errors" + "fmt" + "io" + "regexp" + "sync" + "time" +) + +/* +gbytes.Buffer implements an io.Writer and can be used with the gbytes.Say matcher. + +You should only use a gbytes.Buffer in test code. It stores all writes in an in-memory buffer - behavior that is inappropriate for production code! +*/ +type Buffer struct { + contents []byte + readCursor uint64 + lock *sync.Mutex + detectCloser chan interface{} + closed bool +} + +/* +NewBuffer returns a new gbytes.Buffer +*/ +func NewBuffer() *Buffer { + return &Buffer{ + lock: &sync.Mutex{}, + } +} + +/* +BufferWithBytes returns a new gbytes.Buffer seeded with the passed in bytes +*/ +func BufferWithBytes(bytes []byte) *Buffer { + return &Buffer{ + lock: &sync.Mutex{}, + contents: bytes, + } +} + +/* +Write implements the io.Writer interface +*/ +func (b *Buffer) Write(p []byte) (n int, err error) { + b.lock.Lock() + defer b.lock.Unlock() + + if b.closed { + return 0, errors.New("attempt to write to closed buffer") + } + + b.contents = append(b.contents, p...) + return len(p), nil +} + +/* +Read implements the io.Reader interface. It advances the +cursor as it reads. + +Returns an error if called after Close. +*/ +func (b *Buffer) Read(d []byte) (int, error) { + b.lock.Lock() + defer b.lock.Unlock() + + if b.closed { + return 0, errors.New("attempt to read from closed buffer") + } + + if uint64(len(b.contents)) <= b.readCursor { + return 0, io.EOF + } + + n := copy(d, b.contents[b.readCursor:]) + b.readCursor += uint64(n) + + return n, nil +} + +/* +Close signifies that the buffer will no longer be written to +*/ +func (b *Buffer) Close() error { + b.lock.Lock() + defer b.lock.Unlock() + + b.closed = true + + return nil +} + +/* +Closed returns true if the buffer has been closed +*/ +func (b *Buffer) Closed() bool { + b.lock.Lock() + defer b.lock.Unlock() + + return b.closed +} + +/* +Contents returns all data ever written to the buffer. +*/ +func (b *Buffer) Contents() []byte { + b.lock.Lock() + defer b.lock.Unlock() + + contents := make([]byte, len(b.contents)) + copy(contents, b.contents) + return contents +} + +/* +Detect takes a regular expression and returns a channel. + +The channel will receive true the first time data matching the regular expression is written to the buffer. +The channel is subsequently closed and the buffer's read-cursor is fast-forwarded to just after the matching region. + +You typically don't need to use Detect and should use the ghttp.Say matcher instead. Detect is useful, however, in cases where your code must +be branch and handle different outputs written to the buffer. + +For example, consider a buffer hooked up to the stdout of a client library. You may (or may not, depending on state outside of your control) need to authenticate the client library. + +You could do something like: + +select { +case <-buffer.Detect("You are not logged in"): + //log in +case <-buffer.Detect("Success"): + //carry on +case <-time.After(time.Second): + //welp +} +buffer.CancelDetects() + +You should always call CancelDetects after using Detect. This will close any channels that have not detected and clean up the goroutines that were spawned to support them. + +Finally, you can pass detect a format string followed by variadic arguments. This will construct the regexp using fmt.Sprintf. +*/ +func (b *Buffer) Detect(desired string, args ...interface{}) chan bool { + formattedRegexp := desired + if len(args) > 0 { + formattedRegexp = fmt.Sprintf(desired, args...) + } + re := regexp.MustCompile(formattedRegexp) + + b.lock.Lock() + defer b.lock.Unlock() + + if b.detectCloser == nil { + b.detectCloser = make(chan interface{}) + } + + closer := b.detectCloser + response := make(chan bool) + go func() { + ticker := time.NewTicker(10 * time.Millisecond) + defer ticker.Stop() + defer close(response) + for { + select { + case <-ticker.C: + b.lock.Lock() + data, cursor := b.contents[b.readCursor:], b.readCursor + loc := re.FindIndex(data) + b.lock.Unlock() + + if loc != nil { + response <- true + b.lock.Lock() + newCursorPosition := cursor + uint64(loc[1]) + if newCursorPosition >= b.readCursor { + b.readCursor = newCursorPosition + } + b.lock.Unlock() + return + } + case <-closer: + return + } + } + }() + + return response +} + +/* +CancelDetects cancels any pending detects and cleans up their goroutines. You should always call this when you're done with a set of Detect channels. +*/ +func (b *Buffer) CancelDetects() { + b.lock.Lock() + defer b.lock.Unlock() + + close(b.detectCloser) + b.detectCloser = nil +} + +func (b *Buffer) didSay(re *regexp.Regexp) (bool, []byte) { + b.lock.Lock() + defer b.lock.Unlock() + + unreadBytes := b.contents[b.readCursor:] + copyOfUnreadBytes := make([]byte, len(unreadBytes)) + copy(copyOfUnreadBytes, unreadBytes) + + loc := re.FindIndex(unreadBytes) + + if loc != nil { + b.readCursor += uint64(loc[1]) + return true, copyOfUnreadBytes + } else { + return false, copyOfUnreadBytes + } +} diff --git a/vendor/github.com/onsi/gomega/gbytes/buffer_test.go b/vendor/github.com/onsi/gomega/gbytes/buffer_test.go index 826c5b9690..b1111389e1 100644 --- a/vendor/github.com/onsi/gomega/gbytes/buffer_test.go +++ b/vendor/github.com/onsi/gomega/gbytes/buffer_test.go @@ -1,158 +1,158 @@ -package gbytes_test - -import ( - "io" - "time" - - . "github.com/onsi/gomega/gbytes" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Buffer", func() { - var buffer *Buffer - - BeforeEach(func() { - buffer = NewBuffer() - }) - - Describe("dumping the entire contents of the buffer", func() { - It("should return everything that's been written", func() { - buffer.Write([]byte("abc")) - buffer.Write([]byte("def")) - Ω(buffer.Contents()).Should(Equal([]byte("abcdef"))) - - Ω(buffer).Should(Say("bcd")) - Ω(buffer.Contents()).Should(Equal([]byte("abcdef"))) - }) - }) - - Describe("creating a buffer with bytes", func() { - It("should create the buffer with the cursor set to the beginning", func() { - buffer := BufferWithBytes([]byte("abcdef")) - Ω(buffer.Contents()).Should(Equal([]byte("abcdef"))) - Ω(buffer).Should(Say("abc")) - Ω(buffer).ShouldNot(Say("abc")) - Ω(buffer).Should(Say("def")) - }) - }) - - Describe("reading from a buffer", func() { - It("should read the current contents of the buffer", func() { - buffer := BufferWithBytes([]byte("abcde")) - - dest := make([]byte, 3) - n, err := buffer.Read(dest) - Ω(err).ShouldNot(HaveOccurred()) - Ω(n).Should(Equal(3)) - Ω(string(dest)).Should(Equal("abc")) - - dest = make([]byte, 3) - n, err = buffer.Read(dest) - Ω(err).ShouldNot(HaveOccurred()) - Ω(n).Should(Equal(2)) - Ω(string(dest[:n])).Should(Equal("de")) - - n, err = buffer.Read(dest) - Ω(err).Should(Equal(io.EOF)) - Ω(n).Should(Equal(0)) - }) - - Context("after the buffer has been closed", func() { - It("returns an error", func() { - buffer := BufferWithBytes([]byte("abcde")) - - buffer.Close() - - dest := make([]byte, 3) - n, err := buffer.Read(dest) - Ω(err).Should(HaveOccurred()) - Ω(n).Should(Equal(0)) - }) - }) - }) - - Describe("detecting regular expressions", func() { - It("should fire the appropriate channel when the passed in pattern matches, then close it", func(done Done) { - go func() { - time.Sleep(10 * time.Millisecond) - buffer.Write([]byte("abcde")) - }() - - A := buffer.Detect("%s", "a.c") - B := buffer.Detect("def") - - var gotIt bool - select { - case gotIt = <-A: - case <-B: - Fail("should not have gotten here") - } - - Ω(gotIt).Should(BeTrue()) - Eventually(A).Should(BeClosed()) - - buffer.Write([]byte("f")) - Eventually(B).Should(Receive()) - Eventually(B).Should(BeClosed()) - - close(done) - }) - - It("should fast-forward the buffer upon detection", func(done Done) { - buffer.Write([]byte("abcde")) - <-buffer.Detect("abc") - Ω(buffer).ShouldNot(Say("abc")) - Ω(buffer).Should(Say("de")) - close(done) - }) - - It("should only fast-forward the buffer when the channel is read, and only if doing so would not rewind it", func(done Done) { - buffer.Write([]byte("abcde")) - A := buffer.Detect("abc") - time.Sleep(20 * time.Millisecond) //give the goroutine a chance to detect and write to the channel - Ω(buffer).Should(Say("abcd")) - <-A - Ω(buffer).ShouldNot(Say("d")) - Ω(buffer).Should(Say("e")) - Eventually(A).Should(BeClosed()) - close(done) - }) - - It("should be possible to cancel a detection", func(done Done) { - A := buffer.Detect("abc") - B := buffer.Detect("def") - buffer.CancelDetects() - buffer.Write([]byte("abcdef")) - Eventually(A).Should(BeClosed()) - Eventually(B).Should(BeClosed()) - - Ω(buffer).Should(Say("bcde")) - <-buffer.Detect("f") - close(done) - }) - }) - - Describe("closing the buffer", func() { - It("should error when further write attempts are made", func() { - _, err := buffer.Write([]byte("abc")) - Ω(err).ShouldNot(HaveOccurred()) - - buffer.Close() - - _, err = buffer.Write([]byte("def")) - Ω(err).Should(HaveOccurred()) - - Ω(buffer.Contents()).Should(Equal([]byte("abc"))) - }) - - It("should be closed", func() { - Ω(buffer.Closed()).Should(BeFalse()) - - buffer.Close() - - Ω(buffer.Closed()).Should(BeTrue()) - }) - }) -}) +package gbytes_test + +import ( + "io" + "time" + + . "github.com/onsi/gomega/gbytes" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Buffer", func() { + var buffer *Buffer + + BeforeEach(func() { + buffer = NewBuffer() + }) + + Describe("dumping the entire contents of the buffer", func() { + It("should return everything that's been written", func() { + buffer.Write([]byte("abc")) + buffer.Write([]byte("def")) + Ω(buffer.Contents()).Should(Equal([]byte("abcdef"))) + + Ω(buffer).Should(Say("bcd")) + Ω(buffer.Contents()).Should(Equal([]byte("abcdef"))) + }) + }) + + Describe("creating a buffer with bytes", func() { + It("should create the buffer with the cursor set to the beginning", func() { + buffer := BufferWithBytes([]byte("abcdef")) + Ω(buffer.Contents()).Should(Equal([]byte("abcdef"))) + Ω(buffer).Should(Say("abc")) + Ω(buffer).ShouldNot(Say("abc")) + Ω(buffer).Should(Say("def")) + }) + }) + + Describe("reading from a buffer", func() { + It("should read the current contents of the buffer", func() { + buffer := BufferWithBytes([]byte("abcde")) + + dest := make([]byte, 3) + n, err := buffer.Read(dest) + Ω(err).ShouldNot(HaveOccurred()) + Ω(n).Should(Equal(3)) + Ω(string(dest)).Should(Equal("abc")) + + dest = make([]byte, 3) + n, err = buffer.Read(dest) + Ω(err).ShouldNot(HaveOccurred()) + Ω(n).Should(Equal(2)) + Ω(string(dest[:n])).Should(Equal("de")) + + n, err = buffer.Read(dest) + Ω(err).Should(Equal(io.EOF)) + Ω(n).Should(Equal(0)) + }) + + Context("after the buffer has been closed", func() { + It("returns an error", func() { + buffer := BufferWithBytes([]byte("abcde")) + + buffer.Close() + + dest := make([]byte, 3) + n, err := buffer.Read(dest) + Ω(err).Should(HaveOccurred()) + Ω(n).Should(Equal(0)) + }) + }) + }) + + Describe("detecting regular expressions", func() { + It("should fire the appropriate channel when the passed in pattern matches, then close it", func(done Done) { + go func() { + time.Sleep(10 * time.Millisecond) + buffer.Write([]byte("abcde")) + }() + + A := buffer.Detect("%s", "a.c") + B := buffer.Detect("def") + + var gotIt bool + select { + case gotIt = <-A: + case <-B: + Fail("should not have gotten here") + } + + Ω(gotIt).Should(BeTrue()) + Eventually(A).Should(BeClosed()) + + buffer.Write([]byte("f")) + Eventually(B).Should(Receive()) + Eventually(B).Should(BeClosed()) + + close(done) + }) + + It("should fast-forward the buffer upon detection", func(done Done) { + buffer.Write([]byte("abcde")) + <-buffer.Detect("abc") + Ω(buffer).ShouldNot(Say("abc")) + Ω(buffer).Should(Say("de")) + close(done) + }) + + It("should only fast-forward the buffer when the channel is read, and only if doing so would not rewind it", func(done Done) { + buffer.Write([]byte("abcde")) + A := buffer.Detect("abc") + time.Sleep(20 * time.Millisecond) //give the goroutine a chance to detect and write to the channel + Ω(buffer).Should(Say("abcd")) + <-A + Ω(buffer).ShouldNot(Say("d")) + Ω(buffer).Should(Say("e")) + Eventually(A).Should(BeClosed()) + close(done) + }) + + It("should be possible to cancel a detection", func(done Done) { + A := buffer.Detect("abc") + B := buffer.Detect("def") + buffer.CancelDetects() + buffer.Write([]byte("abcdef")) + Eventually(A).Should(BeClosed()) + Eventually(B).Should(BeClosed()) + + Ω(buffer).Should(Say("bcde")) + <-buffer.Detect("f") + close(done) + }) + }) + + Describe("closing the buffer", func() { + It("should error when further write attempts are made", func() { + _, err := buffer.Write([]byte("abc")) + Ω(err).ShouldNot(HaveOccurred()) + + buffer.Close() + + _, err = buffer.Write([]byte("def")) + Ω(err).Should(HaveOccurred()) + + Ω(buffer.Contents()).Should(Equal([]byte("abc"))) + }) + + It("should be closed", func() { + Ω(buffer.Closed()).Should(BeFalse()) + + buffer.Close() + + Ω(buffer.Closed()).Should(BeTrue()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go b/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go index 2ef9670f3c..3a7dc06123 100644 --- a/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go +++ b/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go @@ -1,13 +1,13 @@ -package gbytes_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "testing" -) - -func TestGbytes(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Gbytes Suite") -} +package gbytes_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestGbytes(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Gbytes Suite") +} diff --git a/vendor/github.com/onsi/gomega/gbytes/say_matcher.go b/vendor/github.com/onsi/gomega/gbytes/say_matcher.go index bcf6835e2d..cbc266c56d 100644 --- a/vendor/github.com/onsi/gomega/gbytes/say_matcher.go +++ b/vendor/github.com/onsi/gomega/gbytes/say_matcher.go @@ -1,105 +1,105 @@ -package gbytes - -import ( - "fmt" - "regexp" - - "github.com/onsi/gomega/format" -) - -//Objects satisfying the BufferProvider can be used with the Say matcher. -type BufferProvider interface { - Buffer() *Buffer -} - -/* -Say is a Gomega matcher that operates on gbytes.Buffers: - - Ω(buffer).Should(Say("something")) - -will succeed if the unread portion of the buffer matches the regular expression "something". - -When Say succeeds, it fast forwards the gbytes.Buffer's read cursor to just after the succesful match. -Thus, subsequent calls to Say will only match against the unread portion of the buffer - -Say pairs very well with Eventually. To assert that a buffer eventually receives data matching "[123]-star" within 3 seconds you can: - - Eventually(buffer, 3).Should(Say("[123]-star")) - -Ditto with consistently. To assert that a buffer does not receive data matching "never-see-this" for 1 second you can: - - Consistently(buffer, 1).ShouldNot(Say("never-see-this")) - -In addition to bytes.Buffers, Say can operate on objects that implement the gbytes.BufferProvider interface. -In such cases, Say simply operates on the *gbytes.Buffer returned by Buffer() - -If the buffer is closed, the Say matcher will tell Eventually to abort. -*/ -func Say(expected string, args ...interface{}) *sayMatcher { - formattedRegexp := expected - if len(args) > 0 { - formattedRegexp = fmt.Sprintf(expected, args...) - } - return &sayMatcher{ - re: regexp.MustCompile(formattedRegexp), - } -} - -type sayMatcher struct { - re *regexp.Regexp - receivedSayings []byte -} - -func (m *sayMatcher) buffer(actual interface{}) (*Buffer, bool) { - var buffer *Buffer - - switch x := actual.(type) { - case *Buffer: - buffer = x - case BufferProvider: - buffer = x.Buffer() - default: - return nil, false - } - - return buffer, true -} - -func (m *sayMatcher) Match(actual interface{}) (success bool, err error) { - buffer, ok := m.buffer(actual) - if !ok { - return false, fmt.Errorf("Say must be passed a *gbytes.Buffer or BufferProvider. Got:\n%s", format.Object(actual, 1)) - } - - didSay, sayings := buffer.didSay(m.re) - m.receivedSayings = sayings - - return didSay, nil -} - -func (m *sayMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf( - "Got stuck at:\n%s\nWaiting for:\n%s", - format.IndentString(string(m.receivedSayings), 1), - format.IndentString(m.re.String(), 1), - ) -} - -func (m *sayMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf( - "Saw:\n%s\nWhich matches the unexpected:\n%s", - format.IndentString(string(m.receivedSayings), 1), - format.IndentString(m.re.String(), 1), - ) -} - -func (m *sayMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - switch x := actual.(type) { - case *Buffer: - return !x.Closed() - case BufferProvider: - return !x.Buffer().Closed() - default: - return true - } -} +package gbytes + +import ( + "fmt" + "regexp" + + "github.com/onsi/gomega/format" +) + +//Objects satisfying the BufferProvider can be used with the Say matcher. +type BufferProvider interface { + Buffer() *Buffer +} + +/* +Say is a Gomega matcher that operates on gbytes.Buffers: + + Ω(buffer).Should(Say("something")) + +will succeed if the unread portion of the buffer matches the regular expression "something". + +When Say succeeds, it fast forwards the gbytes.Buffer's read cursor to just after the succesful match. +Thus, subsequent calls to Say will only match against the unread portion of the buffer + +Say pairs very well with Eventually. To assert that a buffer eventually receives data matching "[123]-star" within 3 seconds you can: + + Eventually(buffer, 3).Should(Say("[123]-star")) + +Ditto with consistently. To assert that a buffer does not receive data matching "never-see-this" for 1 second you can: + + Consistently(buffer, 1).ShouldNot(Say("never-see-this")) + +In addition to bytes.Buffers, Say can operate on objects that implement the gbytes.BufferProvider interface. +In such cases, Say simply operates on the *gbytes.Buffer returned by Buffer() + +If the buffer is closed, the Say matcher will tell Eventually to abort. +*/ +func Say(expected string, args ...interface{}) *sayMatcher { + formattedRegexp := expected + if len(args) > 0 { + formattedRegexp = fmt.Sprintf(expected, args...) + } + return &sayMatcher{ + re: regexp.MustCompile(formattedRegexp), + } +} + +type sayMatcher struct { + re *regexp.Regexp + receivedSayings []byte +} + +func (m *sayMatcher) buffer(actual interface{}) (*Buffer, bool) { + var buffer *Buffer + + switch x := actual.(type) { + case *Buffer: + buffer = x + case BufferProvider: + buffer = x.Buffer() + default: + return nil, false + } + + return buffer, true +} + +func (m *sayMatcher) Match(actual interface{}) (success bool, err error) { + buffer, ok := m.buffer(actual) + if !ok { + return false, fmt.Errorf("Say must be passed a *gbytes.Buffer or BufferProvider. Got:\n%s", format.Object(actual, 1)) + } + + didSay, sayings := buffer.didSay(m.re) + m.receivedSayings = sayings + + return didSay, nil +} + +func (m *sayMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf( + "Got stuck at:\n%s\nWaiting for:\n%s", + format.IndentString(string(m.receivedSayings), 1), + format.IndentString(m.re.String(), 1), + ) +} + +func (m *sayMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf( + "Saw:\n%s\nWhich matches the unexpected:\n%s", + format.IndentString(string(m.receivedSayings), 1), + format.IndentString(m.re.String(), 1), + ) +} + +func (m *sayMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + switch x := actual.(type) { + case *Buffer: + return !x.Closed() + case BufferProvider: + return !x.Buffer().Closed() + default: + return true + } +} diff --git a/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go b/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go index 418645fc59..63fb3b3b8f 100644 --- a/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go +++ b/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go @@ -1,163 +1,163 @@ -package gbytes_test - -import ( - . "github.com/onsi/gomega/gbytes" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -type speaker struct { - buffer *Buffer -} - -func (s *speaker) Buffer() *Buffer { - return s.buffer -} - -var _ = Describe("SayMatcher", func() { - var buffer *Buffer - - BeforeEach(func() { - buffer = NewBuffer() - buffer.Write([]byte("abc")) - }) - - Context("when actual is not a gexec Buffer, or a BufferProvider", func() { - It("should error", func() { - failures := InterceptGomegaFailures(func() { - Ω("foo").Should(Say("foo")) - }) - Ω(failures[0]).Should(ContainSubstring("*gbytes.Buffer")) - }) - }) - - Context("when a match is found", func() { - It("should succeed", func() { - Ω(buffer).Should(Say("abc")) - }) - - It("should support printf-like formatting", func() { - Ω(buffer).Should(Say("a%sc", "b")) - }) - - It("should use a regular expression", func() { - Ω(buffer).Should(Say("a.c")) - }) - - It("should fastforward the buffer", func() { - buffer.Write([]byte("def")) - Ω(buffer).Should(Say("abcd")) - Ω(buffer).Should(Say("ef")) - Ω(buffer).ShouldNot(Say("[a-z]")) - }) - }) - - Context("when no match is found", func() { - It("should not error", func() { - Ω(buffer).ShouldNot(Say("def")) - }) - - Context("when the buffer is closed", func() { - BeforeEach(func() { - buffer.Close() - }) - - It("should abort an eventually", func() { - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(buffer).Should(Say("def")) - }) - Eventually(buffer).ShouldNot(Say("def")) - Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) - Ω(failures).Should(HaveLen(1)) - - t = time.Now() - Eventually(buffer).Should(Say("abc")) - Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) - }) - - It("should abort a consistently", func() { - t := time.Now() - Consistently(buffer, 2.0).ShouldNot(Say("def")) - Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) - }) - - It("should not error with a synchronous matcher", func() { - Ω(buffer).ShouldNot(Say("def")) - Ω(buffer).Should(Say("abc")) - }) - }) - }) - - Context("when a positive match fails", func() { - It("should report where it got stuck", func() { - Ω(buffer).Should(Say("abc")) - buffer.Write([]byte("def")) - failures := InterceptGomegaFailures(func() { - Ω(buffer).Should(Say("abc")) - }) - Ω(failures[0]).Should(ContainSubstring("Got stuck at:")) - Ω(failures[0]).Should(ContainSubstring("def")) - }) - }) - - Context("when a negative match fails", func() { - It("should report where it got stuck", func() { - failures := InterceptGomegaFailures(func() { - Ω(buffer).ShouldNot(Say("abc")) - }) - Ω(failures[0]).Should(ContainSubstring("Saw:")) - Ω(failures[0]).Should(ContainSubstring("Which matches the unexpected:")) - Ω(failures[0]).Should(ContainSubstring("abc")) - }) - }) - - Context("when a match is not found", func() { - It("should not fastforward the buffer", func() { - Ω(buffer).ShouldNot(Say("def")) - Ω(buffer).Should(Say("abc")) - }) - }) - - Context("a nice real-life example", func() { - It("should behave well", func() { - Ω(buffer).Should(Say("abc")) - go func() { - time.Sleep(10 * time.Millisecond) - buffer.Write([]byte("def")) - }() - Ω(buffer).ShouldNot(Say("def")) - Eventually(buffer).Should(Say("def")) - }) - }) - - Context("when actual is a BufferProvider", func() { - It("should use actual's buffer", func() { - s := &speaker{ - buffer: NewBuffer(), - } - - Ω(s).ShouldNot(Say("abc")) - - s.Buffer().Write([]byte("abc")) - Ω(s).Should(Say("abc")) - }) - - It("should abort an eventually", func() { - s := &speaker{ - buffer: NewBuffer(), - } - - s.buffer.Close() - - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(s).Should(Say("def")) - }) - Ω(failures).Should(HaveLen(1)) - Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) - }) - }) -}) +package gbytes_test + +import ( + . "github.com/onsi/gomega/gbytes" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +type speaker struct { + buffer *Buffer +} + +func (s *speaker) Buffer() *Buffer { + return s.buffer +} + +var _ = Describe("SayMatcher", func() { + var buffer *Buffer + + BeforeEach(func() { + buffer = NewBuffer() + buffer.Write([]byte("abc")) + }) + + Context("when actual is not a gexec Buffer, or a BufferProvider", func() { + It("should error", func() { + failures := InterceptGomegaFailures(func() { + Ω("foo").Should(Say("foo")) + }) + Ω(failures[0]).Should(ContainSubstring("*gbytes.Buffer")) + }) + }) + + Context("when a match is found", func() { + It("should succeed", func() { + Ω(buffer).Should(Say("abc")) + }) + + It("should support printf-like formatting", func() { + Ω(buffer).Should(Say("a%sc", "b")) + }) + + It("should use a regular expression", func() { + Ω(buffer).Should(Say("a.c")) + }) + + It("should fastforward the buffer", func() { + buffer.Write([]byte("def")) + Ω(buffer).Should(Say("abcd")) + Ω(buffer).Should(Say("ef")) + Ω(buffer).ShouldNot(Say("[a-z]")) + }) + }) + + Context("when no match is found", func() { + It("should not error", func() { + Ω(buffer).ShouldNot(Say("def")) + }) + + Context("when the buffer is closed", func() { + BeforeEach(func() { + buffer.Close() + }) + + It("should abort an eventually", func() { + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(buffer).Should(Say("def")) + }) + Eventually(buffer).ShouldNot(Say("def")) + Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) + Ω(failures).Should(HaveLen(1)) + + t = time.Now() + Eventually(buffer).Should(Say("abc")) + Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) + }) + + It("should abort a consistently", func() { + t := time.Now() + Consistently(buffer, 2.0).ShouldNot(Say("def")) + Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) + }) + + It("should not error with a synchronous matcher", func() { + Ω(buffer).ShouldNot(Say("def")) + Ω(buffer).Should(Say("abc")) + }) + }) + }) + + Context("when a positive match fails", func() { + It("should report where it got stuck", func() { + Ω(buffer).Should(Say("abc")) + buffer.Write([]byte("def")) + failures := InterceptGomegaFailures(func() { + Ω(buffer).Should(Say("abc")) + }) + Ω(failures[0]).Should(ContainSubstring("Got stuck at:")) + Ω(failures[0]).Should(ContainSubstring("def")) + }) + }) + + Context("when a negative match fails", func() { + It("should report where it got stuck", func() { + failures := InterceptGomegaFailures(func() { + Ω(buffer).ShouldNot(Say("abc")) + }) + Ω(failures[0]).Should(ContainSubstring("Saw:")) + Ω(failures[0]).Should(ContainSubstring("Which matches the unexpected:")) + Ω(failures[0]).Should(ContainSubstring("abc")) + }) + }) + + Context("when a match is not found", func() { + It("should not fastforward the buffer", func() { + Ω(buffer).ShouldNot(Say("def")) + Ω(buffer).Should(Say("abc")) + }) + }) + + Context("a nice real-life example", func() { + It("should behave well", func() { + Ω(buffer).Should(Say("abc")) + go func() { + time.Sleep(10 * time.Millisecond) + buffer.Write([]byte("def")) + }() + Ω(buffer).ShouldNot(Say("def")) + Eventually(buffer).Should(Say("def")) + }) + }) + + Context("when actual is a BufferProvider", func() { + It("should use actual's buffer", func() { + s := &speaker{ + buffer: NewBuffer(), + } + + Ω(s).ShouldNot(Say("abc")) + + s.Buffer().Write([]byte("abc")) + Ω(s).Should(Say("abc")) + }) + + It("should abort an eventually", func() { + s := &speaker{ + buffer: NewBuffer(), + } + + s.buffer.Close() + + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(s).Should(Say("def")) + }) + Ω(failures).Should(HaveLen(1)) + Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go b/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go index 5176b95dba..16091c22b1 100644 --- a/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go +++ b/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go @@ -1,36 +1,36 @@ -package main - -import ( - "fmt" - "math/rand" - "os" - "strconv" - "time" -) - -var outQuote = "We've done the impossible, and that makes us mighty." -var errQuote = "Ah, curse your sudden but inevitable betrayal!" - -var randomQuotes = []string{ - "Can we maybe vote on the whole murdering people issue?", - "I swear by my pretty floral bonnet, I will end you.", - "My work's illegal, but at least it's honest.", -} - -func main() { - fmt.Fprintln(os.Stdout, outQuote) - fmt.Fprintln(os.Stderr, errQuote) - - randomIndex := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(randomQuotes)) - - time.Sleep(100 * time.Millisecond) - - fmt.Fprintln(os.Stdout, randomQuotes[randomIndex]) - - if len(os.Args) == 2 { - exitCode, _ := strconv.Atoi(os.Args[1]) - os.Exit(exitCode) - } else { - os.Exit(randomIndex) - } -} +package main + +import ( + "fmt" + "math/rand" + "os" + "strconv" + "time" +) + +var outQuote = "We've done the impossible, and that makes us mighty." +var errQuote = "Ah, curse your sudden but inevitable betrayal!" + +var randomQuotes = []string{ + "Can we maybe vote on the whole murdering people issue?", + "I swear by my pretty floral bonnet, I will end you.", + "My work's illegal, but at least it's honest.", +} + +func main() { + fmt.Fprintln(os.Stdout, outQuote) + fmt.Fprintln(os.Stderr, errQuote) + + randomIndex := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(randomQuotes)) + + time.Sleep(100 * time.Millisecond) + + fmt.Fprintln(os.Stdout, randomQuotes[randomIndex]) + + if len(os.Args) == 2 { + exitCode, _ := strconv.Atoi(os.Args[1]) + os.Exit(exitCode) + } else { + os.Exit(randomIndex) + } +} diff --git a/vendor/github.com/onsi/gomega/gexec/build.go b/vendor/github.com/onsi/gomega/gexec/build.go index d0ea5ef448..d11b2fd8a3 100644 --- a/vendor/github.com/onsi/gomega/gexec/build.go +++ b/vendor/github.com/onsi/gomega/gexec/build.go @@ -1,99 +1,99 @@ -package gexec - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - "os/exec" - "path" - "path/filepath" - "runtime" - "sync" -) - -var ( - mu sync.Mutex - tmpDir string -) - -/* -Build uses go build to compile the package at packagePath. The resulting binary is saved off in a temporary directory. -A path pointing to this binary is returned. - -Build uses the $GOPATH set in your environment. It passes the variadic args on to `go build`. -*/ -func Build(packagePath string, args ...string) (compiledPath string, err error) { - return doBuild(os.Getenv("GOPATH"), packagePath, nil, args...) -} - -/* -BuildWithEnvironment is identical to Build but allows you to specify env vars to be set at build time. -*/ -func BuildWithEnvironment(packagePath string, env []string, args ...string) (compiledPath string, err error) { - return doBuild(os.Getenv("GOPATH"), packagePath, env, args...) -} - -/* -BuildIn is identical to Build but allows you to specify a custom $GOPATH (the first argument). -*/ -func BuildIn(gopath string, packagePath string, args ...string) (compiledPath string, err error) { - return doBuild(gopath, packagePath, nil, args...) -} - -func doBuild(gopath, packagePath string, env []string, args ...string) (compiledPath string, err error) { - tmpDir, err := temporaryDirectory() - if err != nil { - return "", err - } - - if len(gopath) == 0 { - return "", errors.New("$GOPATH not provided when building " + packagePath) - } - - executable := filepath.Join(tmpDir, path.Base(packagePath)) - if runtime.GOOS == "windows" { - executable = executable + ".exe" - } - - cmdArgs := append([]string{"build"}, args...) - cmdArgs = append(cmdArgs, "-o", executable, packagePath) - - build := exec.Command("go", cmdArgs...) - build.Env = append([]string{"GOPATH=" + gopath}, os.Environ()...) - build.Env = append(build.Env, env...) - - output, err := build.CombinedOutput() - if err != nil { - return "", fmt.Errorf("Failed to build %s:\n\nError:\n%s\n\nOutput:\n%s", packagePath, err, string(output)) - } - - return executable, nil -} - -/* -You should call CleanupBuildArtifacts before your test ends to clean up any temporary artifacts generated by -gexec. In Ginkgo this is typically done in an AfterSuite callback. -*/ -func CleanupBuildArtifacts() { - mu.Lock() - defer mu.Unlock() - if tmpDir != "" { - os.RemoveAll(tmpDir) - tmpDir = "" - } -} - -func temporaryDirectory() (string, error) { - var err error - mu.Lock() - defer mu.Unlock() - if tmpDir == "" { - tmpDir, err = ioutil.TempDir("", "gexec_artifacts") - if err != nil { - return "", err - } - } - - return ioutil.TempDir(tmpDir, "g") -} +package gexec + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path" + "path/filepath" + "runtime" + "sync" +) + +var ( + mu sync.Mutex + tmpDir string +) + +/* +Build uses go build to compile the package at packagePath. The resulting binary is saved off in a temporary directory. +A path pointing to this binary is returned. + +Build uses the $GOPATH set in your environment. It passes the variadic args on to `go build`. +*/ +func Build(packagePath string, args ...string) (compiledPath string, err error) { + return doBuild(os.Getenv("GOPATH"), packagePath, nil, args...) +} + +/* +BuildWithEnvironment is identical to Build but allows you to specify env vars to be set at build time. +*/ +func BuildWithEnvironment(packagePath string, env []string, args ...string) (compiledPath string, err error) { + return doBuild(os.Getenv("GOPATH"), packagePath, env, args...) +} + +/* +BuildIn is identical to Build but allows you to specify a custom $GOPATH (the first argument). +*/ +func BuildIn(gopath string, packagePath string, args ...string) (compiledPath string, err error) { + return doBuild(gopath, packagePath, nil, args...) +} + +func doBuild(gopath, packagePath string, env []string, args ...string) (compiledPath string, err error) { + tmpDir, err := temporaryDirectory() + if err != nil { + return "", err + } + + if len(gopath) == 0 { + return "", errors.New("$GOPATH not provided when building " + packagePath) + } + + executable := filepath.Join(tmpDir, path.Base(packagePath)) + if runtime.GOOS == "windows" { + executable = executable + ".exe" + } + + cmdArgs := append([]string{"build"}, args...) + cmdArgs = append(cmdArgs, "-o", executable, packagePath) + + build := exec.Command("go", cmdArgs...) + build.Env = append([]string{"GOPATH=" + gopath}, os.Environ()...) + build.Env = append(build.Env, env...) + + output, err := build.CombinedOutput() + if err != nil { + return "", fmt.Errorf("Failed to build %s:\n\nError:\n%s\n\nOutput:\n%s", packagePath, err, string(output)) + } + + return executable, nil +} + +/* +You should call CleanupBuildArtifacts before your test ends to clean up any temporary artifacts generated by +gexec. In Ginkgo this is typically done in an AfterSuite callback. +*/ +func CleanupBuildArtifacts() { + mu.Lock() + defer mu.Unlock() + if tmpDir != "" { + os.RemoveAll(tmpDir) + tmpDir = "" + } +} + +func temporaryDirectory() (string, error) { + var err error + mu.Lock() + defer mu.Unlock() + if tmpDir == "" { + tmpDir, err = ioutil.TempDir("", "gexec_artifacts") + if err != nil { + return "", err + } + } + + return ioutil.TempDir(tmpDir, "g") +} diff --git a/vendor/github.com/onsi/gomega/gexec/build_test.go b/vendor/github.com/onsi/gomega/gexec/build_test.go index 38b2714e12..8df0790cd5 100644 --- a/vendor/github.com/onsi/gomega/gexec/build_test.go +++ b/vendor/github.com/onsi/gomega/gexec/build_test.go @@ -1,59 +1,59 @@ -package gexec_test - -import ( - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/onsi/gomega/gexec" -) - -var packagePath = "./_fixture/firefly" - -var _ = Describe(".Build", func() { - Context("when there have been previous calls to Build", func() { - BeforeEach(func() { - _, err := gexec.Build(packagePath) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("compiles the specified package", func() { - compiledPath, err := gexec.Build(packagePath) - Ω(err).ShouldNot(HaveOccurred()) - Ω(compiledPath).Should(BeAnExistingFile()) - }) - - Context("and CleanupBuildArtifacts has been called", func() { - BeforeEach(func() { - gexec.CleanupBuildArtifacts() - }) - - It("compiles the specified package", func() { - var err error - fireflyPath, err = gexec.Build(packagePath) - Ω(err).ShouldNot(HaveOccurred()) - Ω(fireflyPath).Should(BeAnExistingFile()) - }) - }) - }) -}) - -var _ = Describe(".BuildWithEnvironment", func() { - var err error - env := []string{ - "GOOS=linux", - "GOARCH=amd64", - } - - It("compiles the specified package with the specified env vars", func() { - compiledPath, err := gexec.BuildWithEnvironment(packagePath, env) - Ω(err).ShouldNot(HaveOccurred()) - Ω(compiledPath).Should(BeAnExistingFile()) - }) - - It("returns the environment to a good state", func() { - _, err = gexec.BuildWithEnvironment(packagePath, env) - Ω(err).ShouldNot(HaveOccurred()) - Ω(os.Environ()).ShouldNot(ContainElement("GOOS=linux")) - }) -}) +package gexec_test + +import ( + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var packagePath = "./_fixture/firefly" + +var _ = Describe(".Build", func() { + Context("when there have been previous calls to Build", func() { + BeforeEach(func() { + _, err := gexec.Build(packagePath) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("compiles the specified package", func() { + compiledPath, err := gexec.Build(packagePath) + Ω(err).ShouldNot(HaveOccurred()) + Ω(compiledPath).Should(BeAnExistingFile()) + }) + + Context("and CleanupBuildArtifacts has been called", func() { + BeforeEach(func() { + gexec.CleanupBuildArtifacts() + }) + + It("compiles the specified package", func() { + var err error + fireflyPath, err = gexec.Build(packagePath) + Ω(err).ShouldNot(HaveOccurred()) + Ω(fireflyPath).Should(BeAnExistingFile()) + }) + }) + }) +}) + +var _ = Describe(".BuildWithEnvironment", func() { + var err error + env := []string{ + "GOOS=linux", + "GOARCH=amd64", + } + + It("compiles the specified package with the specified env vars", func() { + compiledPath, err := gexec.BuildWithEnvironment(packagePath, env) + Ω(err).ShouldNot(HaveOccurred()) + Ω(compiledPath).Should(BeAnExistingFile()) + }) + + It("returns the environment to a good state", func() { + _, err = gexec.BuildWithEnvironment(packagePath, env) + Ω(err).ShouldNot(HaveOccurred()) + Ω(os.Environ()).ShouldNot(ContainElement("GOOS=linux")) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gexec/exit_matcher.go b/vendor/github.com/onsi/gomega/gexec/exit_matcher.go index acfcec9da5..e6f4329427 100644 --- a/vendor/github.com/onsi/gomega/gexec/exit_matcher.go +++ b/vendor/github.com/onsi/gomega/gexec/exit_matcher.go @@ -1,88 +1,88 @@ -package gexec - -import ( - "fmt" - - "github.com/onsi/gomega/format" -) - -/* -The Exit matcher operates on a session: - - Ω(session).Should(Exit()) - -Exit passes if the session has already exited. - -If no status code is provided, then Exit will succeed if the session has exited regardless of exit code. -Otherwise, Exit will only succeed if the process has exited with the provided status code. - -Note that the process must have already exited. To wait for a process to exit, use Eventually: - - Eventually(session, 3).Should(Exit(0)) -*/ -func Exit(optionalExitCode ...int) *exitMatcher { - exitCode := -1 - if len(optionalExitCode) > 0 { - exitCode = optionalExitCode[0] - } - - return &exitMatcher{ - exitCode: exitCode, - } -} - -type exitMatcher struct { - exitCode int - didExit bool - actualExitCode int -} - -type Exiter interface { - ExitCode() int -} - -func (m *exitMatcher) Match(actual interface{}) (success bool, err error) { - exiter, ok := actual.(Exiter) - if !ok { - return false, fmt.Errorf("Exit must be passed a gexec.Exiter (Missing method ExitCode() int) Got:\n%s", format.Object(actual, 1)) - } - - m.actualExitCode = exiter.ExitCode() - - if m.actualExitCode == -1 { - return false, nil - } - - if m.exitCode == -1 { - return true, nil - } - return m.exitCode == m.actualExitCode, nil -} - -func (m *exitMatcher) FailureMessage(actual interface{}) (message string) { - if m.actualExitCode == -1 { - return "Expected process to exit. It did not." - } else { - return format.Message(m.actualExitCode, "to match exit code:", m.exitCode) - } -} - -func (m *exitMatcher) NegatedFailureMessage(actual interface{}) (message string) { - if m.actualExitCode == -1 { - return "you really shouldn't be able to see this!" - } else { - if m.exitCode == -1 { - return "Expected process not to exit. It did." - } else { - return format.Message(m.actualExitCode, "not to match exit code:", m.exitCode) - } - } -} - -func (m *exitMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - session, ok := actual.(*Session) - if ok { - return session.ExitCode() == -1 - } - return true -} +package gexec + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +/* +The Exit matcher operates on a session: + + Ω(session).Should(Exit()) + +Exit passes if the session has already exited. + +If no status code is provided, then Exit will succeed if the session has exited regardless of exit code. +Otherwise, Exit will only succeed if the process has exited with the provided status code. + +Note that the process must have already exited. To wait for a process to exit, use Eventually: + + Eventually(session, 3).Should(Exit(0)) +*/ +func Exit(optionalExitCode ...int) *exitMatcher { + exitCode := -1 + if len(optionalExitCode) > 0 { + exitCode = optionalExitCode[0] + } + + return &exitMatcher{ + exitCode: exitCode, + } +} + +type exitMatcher struct { + exitCode int + didExit bool + actualExitCode int +} + +type Exiter interface { + ExitCode() int +} + +func (m *exitMatcher) Match(actual interface{}) (success bool, err error) { + exiter, ok := actual.(Exiter) + if !ok { + return false, fmt.Errorf("Exit must be passed a gexec.Exiter (Missing method ExitCode() int) Got:\n%s", format.Object(actual, 1)) + } + + m.actualExitCode = exiter.ExitCode() + + if m.actualExitCode == -1 { + return false, nil + } + + if m.exitCode == -1 { + return true, nil + } + return m.exitCode == m.actualExitCode, nil +} + +func (m *exitMatcher) FailureMessage(actual interface{}) (message string) { + if m.actualExitCode == -1 { + return "Expected process to exit. It did not." + } else { + return format.Message(m.actualExitCode, "to match exit code:", m.exitCode) + } +} + +func (m *exitMatcher) NegatedFailureMessage(actual interface{}) (message string) { + if m.actualExitCode == -1 { + return "you really shouldn't be able to see this!" + } else { + if m.exitCode == -1 { + return "Expected process not to exit. It did." + } else { + return format.Message(m.actualExitCode, "not to match exit code:", m.exitCode) + } + } +} + +func (m *exitMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + session, ok := actual.(*Session) + if ok { + return session.ExitCode() == -1 + } + return true +} diff --git a/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go b/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go index daf50b5f66..79615ddf81 100644 --- a/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go +++ b/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go @@ -1,113 +1,113 @@ -package gexec_test - -import ( - . "github.com/onsi/gomega/gexec" - "os/exec" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -type NeverExits struct{} - -func (e NeverExits) ExitCode() int { - return -1 -} - -var _ = Describe("ExitMatcher", func() { - var command *exec.Cmd - var session *Session - - BeforeEach(func() { - var err error - command = exec.Command(fireflyPath, "0") - session, err = Start(command, nil, nil) - Ω(err).ShouldNot(HaveOccurred()) - }) - - Describe("when passed something that is an Exiter", func() { - It("should act normally", func() { - failures := InterceptGomegaFailures(func() { - Ω(NeverExits{}).Should(Exit()) - }) - - Ω(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) - }) - }) - - Describe("when passed something that is not an Exiter", func() { - It("should error", func() { - failures := InterceptGomegaFailures(func() { - Ω("aardvark").Should(Exit()) - }) - - Ω(failures[0]).Should(ContainSubstring("Exit must be passed a gexec.Exiter")) - }) - }) - - Context("with no exit code", func() { - It("should say the right things when it fails", func() { - Ω(session).ShouldNot(Exit()) - - failures := InterceptGomegaFailures(func() { - Ω(session).Should(Exit()) - }) - - Ω(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) - - Eventually(session).Should(Exit()) - - Ω(session).Should(Exit()) - - failures = InterceptGomegaFailures(func() { - Ω(session).ShouldNot(Exit()) - }) - - Ω(failures[0]).Should(ContainSubstring("Expected process not to exit. It did.")) - }) - }) - - Context("with an exit code", func() { - It("should say the right things when it fails", func() { - Ω(session).ShouldNot(Exit(0)) - Ω(session).ShouldNot(Exit(1)) - - failures := InterceptGomegaFailures(func() { - Ω(session).Should(Exit(0)) - }) - - Ω(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) - - Eventually(session).Should(Exit(0)) - - Ω(session).Should(Exit(0)) - - failures = InterceptGomegaFailures(func() { - Ω(session).Should(Exit(1)) - }) - - Ω(failures[0]).Should(ContainSubstring("to match exit code:")) - - Ω(session).ShouldNot(Exit(1)) - - failures = InterceptGomegaFailures(func() { - Ω(session).ShouldNot(Exit(0)) - }) - - Ω(failures[0]).Should(ContainSubstring("not to match exit code:")) - }) - }) - - Describe("bailing out early", func() { - It("should bail out early once the process exits", func() { - t := time.Now() - - failures := InterceptGomegaFailures(func() { - Eventually(session).Should(Exit(1)) - }) - Ω(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond)) - Ω(failures).Should(HaveLen(1)) - }) - }) -}) +package gexec_test + +import ( + . "github.com/onsi/gomega/gexec" + "os/exec" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +type NeverExits struct{} + +func (e NeverExits) ExitCode() int { + return -1 +} + +var _ = Describe("ExitMatcher", func() { + var command *exec.Cmd + var session *Session + + BeforeEach(func() { + var err error + command = exec.Command(fireflyPath, "0") + session, err = Start(command, nil, nil) + Ω(err).ShouldNot(HaveOccurred()) + }) + + Describe("when passed something that is an Exiter", func() { + It("should act normally", func() { + failures := InterceptGomegaFailures(func() { + Ω(NeverExits{}).Should(Exit()) + }) + + Ω(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) + }) + }) + + Describe("when passed something that is not an Exiter", func() { + It("should error", func() { + failures := InterceptGomegaFailures(func() { + Ω("aardvark").Should(Exit()) + }) + + Ω(failures[0]).Should(ContainSubstring("Exit must be passed a gexec.Exiter")) + }) + }) + + Context("with no exit code", func() { + It("should say the right things when it fails", func() { + Ω(session).ShouldNot(Exit()) + + failures := InterceptGomegaFailures(func() { + Ω(session).Should(Exit()) + }) + + Ω(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) + + Eventually(session).Should(Exit()) + + Ω(session).Should(Exit()) + + failures = InterceptGomegaFailures(func() { + Ω(session).ShouldNot(Exit()) + }) + + Ω(failures[0]).Should(ContainSubstring("Expected process not to exit. It did.")) + }) + }) + + Context("with an exit code", func() { + It("should say the right things when it fails", func() { + Ω(session).ShouldNot(Exit(0)) + Ω(session).ShouldNot(Exit(1)) + + failures := InterceptGomegaFailures(func() { + Ω(session).Should(Exit(0)) + }) + + Ω(failures[0]).Should(ContainSubstring("Expected process to exit. It did not.")) + + Eventually(session).Should(Exit(0)) + + Ω(session).Should(Exit(0)) + + failures = InterceptGomegaFailures(func() { + Ω(session).Should(Exit(1)) + }) + + Ω(failures[0]).Should(ContainSubstring("to match exit code:")) + + Ω(session).ShouldNot(Exit(1)) + + failures = InterceptGomegaFailures(func() { + Ω(session).ShouldNot(Exit(0)) + }) + + Ω(failures[0]).Should(ContainSubstring("not to match exit code:")) + }) + }) + + Describe("bailing out early", func() { + It("should bail out early once the process exits", func() { + t := time.Now() + + failures := InterceptGomegaFailures(func() { + Eventually(session).Should(Exit(1)) + }) + Ω(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond)) + Ω(failures).Should(HaveLen(1)) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go b/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go index 897a11c09e..87672aafa3 100644 --- a/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go +++ b/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go @@ -1,26 +1,26 @@ -package gexec_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/onsi/gomega/gexec" - - "testing" -) - -var fireflyPath string - -func TestGexec(t *testing.T) { - BeforeSuite(func() { - var err error - fireflyPath, err = gexec.Build("./_fixture/firefly") - Ω(err).ShouldNot(HaveOccurred()) - }) - - AfterSuite(func() { - gexec.CleanupBuildArtifacts() - }) - - RegisterFailHandler(Fail) - RunSpecs(t, "Gexec Suite") -} +package gexec_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" + + "testing" +) + +var fireflyPath string + +func TestGexec(t *testing.T) { + BeforeSuite(func() { + var err error + fireflyPath, err = gexec.Build("./_fixture/firefly") + Ω(err).ShouldNot(HaveOccurred()) + }) + + AfterSuite(func() { + gexec.CleanupBuildArtifacts() + }) + + RegisterFailHandler(Fail) + RunSpecs(t, "Gexec Suite") +} diff --git a/vendor/github.com/onsi/gomega/gexec/prefixed_writer.go b/vendor/github.com/onsi/gomega/gexec/prefixed_writer.go index 6ec6a8e8c6..05e695abc8 100644 --- a/vendor/github.com/onsi/gomega/gexec/prefixed_writer.go +++ b/vendor/github.com/onsi/gomega/gexec/prefixed_writer.go @@ -1,53 +1,53 @@ -package gexec - -import ( - "io" - "sync" -) - -/* -PrefixedWriter wraps an io.Writer, emiting the passed in prefix at the beginning of each new line. -This can be useful when running multiple gexec.Sessions concurrently - you can prefix the log output of each -session by passing in a PrefixedWriter: - -gexec.Start(cmd, NewPrefixedWriter("[my-cmd] ", GinkgoWriter), NewPrefixedWriter("[my-cmd] ", GinkgoWriter)) -*/ -type PrefixedWriter struct { - prefix []byte - writer io.Writer - lock *sync.Mutex - atStartOfLine bool -} - -func NewPrefixedWriter(prefix string, writer io.Writer) *PrefixedWriter { - return &PrefixedWriter{ - prefix: []byte(prefix), - writer: writer, - lock: &sync.Mutex{}, - atStartOfLine: true, - } -} - -func (w *PrefixedWriter) Write(b []byte) (int, error) { - w.lock.Lock() - defer w.lock.Unlock() - - toWrite := []byte{} - - for _, c := range b { - if w.atStartOfLine { - toWrite = append(toWrite, w.prefix...) - } - - toWrite = append(toWrite, c) - - w.atStartOfLine = c == '\n' - } - - _, err := w.writer.Write(toWrite) - if err != nil { - return 0, err - } - - return len(b), nil -} +package gexec + +import ( + "io" + "sync" +) + +/* +PrefixedWriter wraps an io.Writer, emiting the passed in prefix at the beginning of each new line. +This can be useful when running multiple gexec.Sessions concurrently - you can prefix the log output of each +session by passing in a PrefixedWriter: + +gexec.Start(cmd, NewPrefixedWriter("[my-cmd] ", GinkgoWriter), NewPrefixedWriter("[my-cmd] ", GinkgoWriter)) +*/ +type PrefixedWriter struct { + prefix []byte + writer io.Writer + lock *sync.Mutex + atStartOfLine bool +} + +func NewPrefixedWriter(prefix string, writer io.Writer) *PrefixedWriter { + return &PrefixedWriter{ + prefix: []byte(prefix), + writer: writer, + lock: &sync.Mutex{}, + atStartOfLine: true, + } +} + +func (w *PrefixedWriter) Write(b []byte) (int, error) { + w.lock.Lock() + defer w.lock.Unlock() + + toWrite := []byte{} + + for _, c := range b { + if w.atStartOfLine { + toWrite = append(toWrite, w.prefix...) + } + + toWrite = append(toWrite, c) + + w.atStartOfLine = c == '\n' + } + + _, err := w.writer.Write(toWrite) + if err != nil { + return 0, err + } + + return len(b), nil +} diff --git a/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go b/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go index 22f69db9f8..8657d0c9de 100644 --- a/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go +++ b/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go @@ -1,43 +1,43 @@ -package gexec_test - -import ( - "bytes" - - . "github.com/onsi/gomega/gexec" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("PrefixedWriter", func() { - var buffer *bytes.Buffer - var writer *PrefixedWriter - BeforeEach(func() { - buffer = &bytes.Buffer{} - writer = NewPrefixedWriter("[p]", buffer) - }) - - It("should emit the prefix on newlines", func() { - writer.Write([]byte("abc")) - writer.Write([]byte("def\n")) - writer.Write([]byte("hij\n")) - writer.Write([]byte("\n\n")) - writer.Write([]byte("klm\n\nnop")) - writer.Write([]byte("")) - writer.Write([]byte("qrs")) - writer.Write([]byte("\ntuv\nwx")) - writer.Write([]byte("yz\n\n")) - - Ω(buffer.String()).Should(Equal(`[p]abcdef -[p]hij -[p] -[p] -[p]klm -[p] -[p]nopqrs -[p]tuv -[p]wxyz -[p] -`)) - }) -}) +package gexec_test + +import ( + "bytes" + + . "github.com/onsi/gomega/gexec" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("PrefixedWriter", func() { + var buffer *bytes.Buffer + var writer *PrefixedWriter + BeforeEach(func() { + buffer = &bytes.Buffer{} + writer = NewPrefixedWriter("[p]", buffer) + }) + + It("should emit the prefix on newlines", func() { + writer.Write([]byte("abc")) + writer.Write([]byte("def\n")) + writer.Write([]byte("hij\n")) + writer.Write([]byte("\n\n")) + writer.Write([]byte("klm\n\nnop")) + writer.Write([]byte("")) + writer.Write([]byte("qrs")) + writer.Write([]byte("\ntuv\nwx")) + writer.Write([]byte("yz\n\n")) + + Ω(buffer.String()).Should(Equal(`[p]abcdef +[p]hij +[p] +[p] +[p]klm +[p] +[p]nopqrs +[p]tuv +[p]wxyz +[p] +`)) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gexec/session.go b/vendor/github.com/onsi/gomega/gexec/session.go index 4024186658..387a72cde6 100644 --- a/vendor/github.com/onsi/gomega/gexec/session.go +++ b/vendor/github.com/onsi/gomega/gexec/session.go @@ -1,305 +1,305 @@ -/* -Package gexec provides support for testing external processes. -*/ -package gexec - -import ( - "io" - "os" - "os/exec" - "reflect" - "sync" - "syscall" - - . "github.com/onsi/gomega" - "github.com/onsi/gomega/gbytes" -) - -const INVALID_EXIT_CODE = 254 - -type Session struct { - //The wrapped command - Command *exec.Cmd - - //A *gbytes.Buffer connected to the command's stdout - Out *gbytes.Buffer - - //A *gbytes.Buffer connected to the command's stderr - Err *gbytes.Buffer - - //A channel that will close when the command exits - Exited <-chan struct{} - - lock *sync.Mutex - exitCode int -} - -/* -Start starts the passed-in *exec.Cmd command. It wraps the command in a *gexec.Session. - -The session pipes the command's stdout and stderr to two *gbytes.Buffers available as properties on the session: session.Out and session.Err. -These buffers can be used with the gbytes.Say matcher to match against unread output: - - Ω(session.Out).Should(gbytes.Say("foo-out")) - Ω(session.Err).Should(gbytes.Say("foo-err")) - -In addition, Session satisfies the gbytes.BufferProvider interface and provides the stdout *gbytes.Buffer. This allows you to replace the first line, above, with: - - Ω(session).Should(gbytes.Say("foo-out")) - -When outWriter and/or errWriter are non-nil, the session will pipe stdout and/or stderr output both into the session *gybtes.Buffers and to the passed-in outWriter/errWriter. -This is useful for capturing the process's output or logging it to screen. In particular, when using Ginkgo it can be convenient to direct output to the GinkgoWriter: - - session, err := Start(command, GinkgoWriter, GinkgoWriter) - -This will log output when running tests in verbose mode, but - otherwise - will only log output when a test fails. - -The session wrapper is responsible for waiting on the *exec.Cmd command. You *should not* call command.Wait() yourself. -Instead, to assert that the command has exited you can use the gexec.Exit matcher: - - Ω(session).Should(gexec.Exit()) - -When the session exits it closes the stdout and stderr gbytes buffers. This will short circuit any -Eventuallys waiting for the buffers to Say something. -*/ -func Start(command *exec.Cmd, outWriter io.Writer, errWriter io.Writer) (*Session, error) { - exited := make(chan struct{}) - - session := &Session{ - Command: command, - Out: gbytes.NewBuffer(), - Err: gbytes.NewBuffer(), - Exited: exited, - lock: &sync.Mutex{}, - exitCode: -1, - } - - var commandOut, commandErr io.Writer - - commandOut, commandErr = session.Out, session.Err - - if outWriter != nil && !reflect.ValueOf(outWriter).IsNil() { - commandOut = io.MultiWriter(commandOut, outWriter) - } - - if errWriter != nil && !reflect.ValueOf(errWriter).IsNil() { - commandErr = io.MultiWriter(commandErr, errWriter) - } - - command.Stdout = commandOut - command.Stderr = commandErr - - err := command.Start() - if err == nil { - go session.monitorForExit(exited) - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - trackedSessions = append(trackedSessions, session) - } - - return session, err -} - -/* -Buffer implements the gbytes.BufferProvider interface and returns s.Out -This allows you to make gbytes.Say matcher assertions against stdout without having to reference .Out: - - Eventually(session).Should(gbytes.Say("foo")) -*/ -func (s *Session) Buffer() *gbytes.Buffer { - return s.Out -} - -/* -ExitCode returns the wrapped command's exit code. If the command hasn't exited yet, ExitCode returns -1. - -To assert that the command has exited it is more convenient to use the Exit matcher: - - Eventually(s).Should(gexec.Exit()) - -When the process exits because it has received a particular signal, the exit code will be 128+signal-value -(See http://www.tldp.org/LDP/abs/html/exitcodes.html and http://man7.org/linux/man-pages/man7/signal.7.html) - -*/ -func (s *Session) ExitCode() int { - s.lock.Lock() - defer s.lock.Unlock() - return s.exitCode -} - -/* -Wait waits until the wrapped command exits. It can be passed an optional timeout. -If the command does not exit within the timeout, Wait will trigger a test failure. - -Wait returns the session, making it possible to chain: - - session.Wait().Out.Contents() - -will wait for the command to exit then return the entirety of Out's contents. - -Wait uses eventually under the hood and accepts the same timeout/polling intervals that eventually does. -*/ -func (s *Session) Wait(timeout ...interface{}) *Session { - EventuallyWithOffset(1, s, timeout...).Should(Exit()) - return s -} - -/* -Kill sends the running command a SIGKILL signal. It does not wait for the process to exit. - -If the command has already exited, Kill returns silently. - -The session is returned to enable chaining. -*/ -func (s *Session) Kill() *Session { - if s.ExitCode() != -1 { - return s - } - s.Command.Process.Kill() - return s -} - -/* -Interrupt sends the running command a SIGINT signal. It does not wait for the process to exit. - -If the command has already exited, Interrupt returns silently. - -The session is returned to enable chaining. -*/ -func (s *Session) Interrupt() *Session { - return s.Signal(syscall.SIGINT) -} - -/* -Terminate sends the running command a SIGTERM signal. It does not wait for the process to exit. - -If the command has already exited, Terminate returns silently. - -The session is returned to enable chaining. -*/ -func (s *Session) Terminate() *Session { - return s.Signal(syscall.SIGTERM) -} - -/* -Signal sends the running command the passed in signal. It does not wait for the process to exit. - -If the command has already exited, Signal returns silently. - -The session is returned to enable chaining. -*/ -func (s *Session) Signal(signal os.Signal) *Session { - if s.ExitCode() != -1 { - return s - } - s.Command.Process.Signal(signal) - return s -} - -func (s *Session) monitorForExit(exited chan<- struct{}) { - err := s.Command.Wait() - s.lock.Lock() - s.Out.Close() - s.Err.Close() - status := s.Command.ProcessState.Sys().(syscall.WaitStatus) - if status.Signaled() { - s.exitCode = 128 + int(status.Signal()) - } else { - exitStatus := status.ExitStatus() - if exitStatus == -1 && err != nil { - s.exitCode = INVALID_EXIT_CODE - } - s.exitCode = exitStatus - } - s.lock.Unlock() - - close(exited) -} - -var trackedSessions = []*Session{} -var trackedSessionsMutex = &sync.Mutex{} - -/* -Kill sends a SIGKILL signal to all the processes started by Run, and waits for them to exit. -The timeout specified is applied to each process killed. - -If any of the processes already exited, KillAndWait returns silently. -*/ -func KillAndWait(timeout ...interface{}) { - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - for _, session := range trackedSessions { - session.Kill().Wait(timeout...) - } - trackedSessions = []*Session{} -} - -/* -Kill sends a SIGTERM signal to all the processes started by Run, and waits for them to exit. -The timeout specified is applied to each process killed. - -If any of the processes already exited, TerminateAndWait returns silently. -*/ -func TerminateAndWait(timeout ...interface{}) { - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - for _, session := range trackedSessions { - session.Terminate().Wait(timeout...) - } -} - -/* -Kill sends a SIGKILL signal to all the processes started by Run. -It does not wait for the processes to exit. - -If any of the processes already exited, Kill returns silently. -*/ -func Kill() { - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - for _, session := range trackedSessions { - session.Kill() - } -} - -/* -Terminate sends a SIGTERM signal to all the processes started by Run. -It does not wait for the processes to exit. - -If any of the processes already exited, Terminate returns silently. -*/ -func Terminate() { - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - for _, session := range trackedSessions { - session.Terminate() - } -} - -/* -Signal sends the passed in signal to all the processes started by Run. -It does not wait for the processes to exit. - -If any of the processes already exited, Signal returns silently. -*/ -func Signal(signal os.Signal) { - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - for _, session := range trackedSessions { - session.Signal(signal) - } -} - -/* -Interrupt sends the SIGINT signal to all the processes started by Run. -It does not wait for the processes to exit. - -If any of the processes already exited, Interrupt returns silently. -*/ -func Interrupt() { - trackedSessionsMutex.Lock() - defer trackedSessionsMutex.Unlock() - for _, session := range trackedSessions { - session.Interrupt() - } -} +/* +Package gexec provides support for testing external processes. +*/ +package gexec + +import ( + "io" + "os" + "os/exec" + "reflect" + "sync" + "syscall" + + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" +) + +const INVALID_EXIT_CODE = 254 + +type Session struct { + //The wrapped command + Command *exec.Cmd + + //A *gbytes.Buffer connected to the command's stdout + Out *gbytes.Buffer + + //A *gbytes.Buffer connected to the command's stderr + Err *gbytes.Buffer + + //A channel that will close when the command exits + Exited <-chan struct{} + + lock *sync.Mutex + exitCode int +} + +/* +Start starts the passed-in *exec.Cmd command. It wraps the command in a *gexec.Session. + +The session pipes the command's stdout and stderr to two *gbytes.Buffers available as properties on the session: session.Out and session.Err. +These buffers can be used with the gbytes.Say matcher to match against unread output: + + Ω(session.Out).Should(gbytes.Say("foo-out")) + Ω(session.Err).Should(gbytes.Say("foo-err")) + +In addition, Session satisfies the gbytes.BufferProvider interface and provides the stdout *gbytes.Buffer. This allows you to replace the first line, above, with: + + Ω(session).Should(gbytes.Say("foo-out")) + +When outWriter and/or errWriter are non-nil, the session will pipe stdout and/or stderr output both into the session *gybtes.Buffers and to the passed-in outWriter/errWriter. +This is useful for capturing the process's output or logging it to screen. In particular, when using Ginkgo it can be convenient to direct output to the GinkgoWriter: + + session, err := Start(command, GinkgoWriter, GinkgoWriter) + +This will log output when running tests in verbose mode, but - otherwise - will only log output when a test fails. + +The session wrapper is responsible for waiting on the *exec.Cmd command. You *should not* call command.Wait() yourself. +Instead, to assert that the command has exited you can use the gexec.Exit matcher: + + Ω(session).Should(gexec.Exit()) + +When the session exits it closes the stdout and stderr gbytes buffers. This will short circuit any +Eventuallys waiting for the buffers to Say something. +*/ +func Start(command *exec.Cmd, outWriter io.Writer, errWriter io.Writer) (*Session, error) { + exited := make(chan struct{}) + + session := &Session{ + Command: command, + Out: gbytes.NewBuffer(), + Err: gbytes.NewBuffer(), + Exited: exited, + lock: &sync.Mutex{}, + exitCode: -1, + } + + var commandOut, commandErr io.Writer + + commandOut, commandErr = session.Out, session.Err + + if outWriter != nil && !reflect.ValueOf(outWriter).IsNil() { + commandOut = io.MultiWriter(commandOut, outWriter) + } + + if errWriter != nil && !reflect.ValueOf(errWriter).IsNil() { + commandErr = io.MultiWriter(commandErr, errWriter) + } + + command.Stdout = commandOut + command.Stderr = commandErr + + err := command.Start() + if err == nil { + go session.monitorForExit(exited) + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + trackedSessions = append(trackedSessions, session) + } + + return session, err +} + +/* +Buffer implements the gbytes.BufferProvider interface and returns s.Out +This allows you to make gbytes.Say matcher assertions against stdout without having to reference .Out: + + Eventually(session).Should(gbytes.Say("foo")) +*/ +func (s *Session) Buffer() *gbytes.Buffer { + return s.Out +} + +/* +ExitCode returns the wrapped command's exit code. If the command hasn't exited yet, ExitCode returns -1. + +To assert that the command has exited it is more convenient to use the Exit matcher: + + Eventually(s).Should(gexec.Exit()) + +When the process exits because it has received a particular signal, the exit code will be 128+signal-value +(See http://www.tldp.org/LDP/abs/html/exitcodes.html and http://man7.org/linux/man-pages/man7/signal.7.html) + +*/ +func (s *Session) ExitCode() int { + s.lock.Lock() + defer s.lock.Unlock() + return s.exitCode +} + +/* +Wait waits until the wrapped command exits. It can be passed an optional timeout. +If the command does not exit within the timeout, Wait will trigger a test failure. + +Wait returns the session, making it possible to chain: + + session.Wait().Out.Contents() + +will wait for the command to exit then return the entirety of Out's contents. + +Wait uses eventually under the hood and accepts the same timeout/polling intervals that eventually does. +*/ +func (s *Session) Wait(timeout ...interface{}) *Session { + EventuallyWithOffset(1, s, timeout...).Should(Exit()) + return s +} + +/* +Kill sends the running command a SIGKILL signal. It does not wait for the process to exit. + +If the command has already exited, Kill returns silently. + +The session is returned to enable chaining. +*/ +func (s *Session) Kill() *Session { + if s.ExitCode() != -1 { + return s + } + s.Command.Process.Kill() + return s +} + +/* +Interrupt sends the running command a SIGINT signal. It does not wait for the process to exit. + +If the command has already exited, Interrupt returns silently. + +The session is returned to enable chaining. +*/ +func (s *Session) Interrupt() *Session { + return s.Signal(syscall.SIGINT) +} + +/* +Terminate sends the running command a SIGTERM signal. It does not wait for the process to exit. + +If the command has already exited, Terminate returns silently. + +The session is returned to enable chaining. +*/ +func (s *Session) Terminate() *Session { + return s.Signal(syscall.SIGTERM) +} + +/* +Signal sends the running command the passed in signal. It does not wait for the process to exit. + +If the command has already exited, Signal returns silently. + +The session is returned to enable chaining. +*/ +func (s *Session) Signal(signal os.Signal) *Session { + if s.ExitCode() != -1 { + return s + } + s.Command.Process.Signal(signal) + return s +} + +func (s *Session) monitorForExit(exited chan<- struct{}) { + err := s.Command.Wait() + s.lock.Lock() + s.Out.Close() + s.Err.Close() + status := s.Command.ProcessState.Sys().(syscall.WaitStatus) + if status.Signaled() { + s.exitCode = 128 + int(status.Signal()) + } else { + exitStatus := status.ExitStatus() + if exitStatus == -1 && err != nil { + s.exitCode = INVALID_EXIT_CODE + } + s.exitCode = exitStatus + } + s.lock.Unlock() + + close(exited) +} + +var trackedSessions = []*Session{} +var trackedSessionsMutex = &sync.Mutex{} + +/* +Kill sends a SIGKILL signal to all the processes started by Run, and waits for them to exit. +The timeout specified is applied to each process killed. + +If any of the processes already exited, KillAndWait returns silently. +*/ +func KillAndWait(timeout ...interface{}) { + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + for _, session := range trackedSessions { + session.Kill().Wait(timeout...) + } + trackedSessions = []*Session{} +} + +/* +Kill sends a SIGTERM signal to all the processes started by Run, and waits for them to exit. +The timeout specified is applied to each process killed. + +If any of the processes already exited, TerminateAndWait returns silently. +*/ +func TerminateAndWait(timeout ...interface{}) { + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + for _, session := range trackedSessions { + session.Terminate().Wait(timeout...) + } +} + +/* +Kill sends a SIGKILL signal to all the processes started by Run. +It does not wait for the processes to exit. + +If any of the processes already exited, Kill returns silently. +*/ +func Kill() { + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + for _, session := range trackedSessions { + session.Kill() + } +} + +/* +Terminate sends a SIGTERM signal to all the processes started by Run. +It does not wait for the processes to exit. + +If any of the processes already exited, Terminate returns silently. +*/ +func Terminate() { + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + for _, session := range trackedSessions { + session.Terminate() + } +} + +/* +Signal sends the passed in signal to all the processes started by Run. +It does not wait for the processes to exit. + +If any of the processes already exited, Signal returns silently. +*/ +func Signal(signal os.Signal) { + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + for _, session := range trackedSessions { + session.Signal(signal) + } +} + +/* +Interrupt sends the SIGINT signal to all the processes started by Run. +It does not wait for the processes to exit. + +If any of the processes already exited, Interrupt returns silently. +*/ +func Interrupt() { + trackedSessionsMutex.Lock() + defer trackedSessionsMutex.Unlock() + for _, session := range trackedSessions { + session.Interrupt() + } +} diff --git a/vendor/github.com/onsi/gomega/gexec/session_test.go b/vendor/github.com/onsi/gomega/gexec/session_test.go index 017779bdaa..b7841a090f 100644 --- a/vendor/github.com/onsi/gomega/gexec/session_test.go +++ b/vendor/github.com/onsi/gomega/gexec/session_test.go @@ -1,351 +1,351 @@ -package gexec_test - -import ( - "os/exec" - "syscall" - "time" - - . "github.com/onsi/gomega/gbytes" - . "github.com/onsi/gomega/gexec" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Session", func() { - var command *exec.Cmd - var session *Session - - var outWriter, errWriter *Buffer - - BeforeEach(func() { - outWriter = nil - errWriter = nil - }) - - JustBeforeEach(func() { - command = exec.Command(fireflyPath) - var err error - session, err = Start(command, outWriter, errWriter) - Ω(err).ShouldNot(HaveOccurred()) - }) - - Context("running a command", func() { - It("should start the process", func() { - Ω(command.Process).ShouldNot(BeNil()) - }) - - It("should wrap the process's stdout and stderr with gbytes buffers", func(done Done) { - Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) - Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!")) - defer session.Out.CancelDetects() - - select { - case <-session.Out.Detect("Can we maybe vote on the whole murdering people issue"): - Eventually(session).Should(Exit(0)) - case <-session.Out.Detect("I swear by my pretty floral bonnet, I will end you."): - Eventually(session).Should(Exit(1)) - case <-session.Out.Detect("My work's illegal, but at least it's honest."): - Eventually(session).Should(Exit(2)) - } - - close(done) - }) - - It("should satisfy the gbytes.BufferProvider interface, passing Stdout", func() { - Eventually(session).Should(Say("We've done the impossible, and that makes us mighty")) - Eventually(session).Should(Exit()) - }) - }) - - Describe("providing the exit code", func() { - It("should provide the app's exit code", func() { - Ω(session.ExitCode()).Should(Equal(-1)) - - Eventually(session).Should(Exit()) - Ω(session.ExitCode()).Should(BeNumerically(">=", 0)) - Ω(session.ExitCode()).Should(BeNumerically("<", 3)) - }) - }) - - Describe("wait", func() { - It("should wait till the command exits", func() { - Ω(session.ExitCode()).Should(Equal(-1)) - Ω(session.Wait().ExitCode()).Should(BeNumerically(">=", 0)) - Ω(session.Wait().ExitCode()).Should(BeNumerically("<", 3)) - }) - }) - - Describe("exited", func() { - It("should close when the command exits", func() { - Eventually(session.Exited).Should(BeClosed()) - Ω(session.ExitCode()).ShouldNot(Equal(-1)) - }) - }) - - Describe("kill", func() { - It("should kill the command and don't wait for it to exit", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session.Kill() - Ω(session).ShouldNot(Exit(), "Should not exit immediately...") - Eventually(session).Should(Exit(128 + 9)) - }) - }) - - Describe("interrupt", func() { - It("should interrupt the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session.Interrupt() - Ω(session).ShouldNot(Exit(), "Should not exit immediately...") - Eventually(session).Should(Exit(128 + 2)) - }) - }) - - Describe("terminate", func() { - It("should terminate the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session.Terminate() - Ω(session).ShouldNot(Exit(), "Should not exit immediately...") - Eventually(session).Should(Exit(128 + 15)) - }) - }) - - Describe("signal", func() { - It("should send the signal to the command", func() { - session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session.Signal(syscall.SIGABRT) - Ω(session).ShouldNot(Exit(), "Should not exit immediately...") - Eventually(session).Should(Exit(128 + 6)) - }) - }) - - Context("tracking sessions", func() { - BeforeEach(func() { - KillAndWait() - }) - - Describe("kill", func() { - It("should kill all the started sessions", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Kill() - - Eventually(session1).Should(Exit(128 + 9)) - Eventually(session2).Should(Exit(128 + 9)) - Eventually(session3).Should(Exit(128 + 9)) - }) - - It("should not wait for exit", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Kill() - Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") - - Eventually(session1).Should(Exit(128 + 9)) - }) - - It("should not track unstarted sessions", func() { - _, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).Should(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Kill() - - Eventually(session2).Should(Exit(128 + 9)) - Eventually(session3).Should(Exit(128 + 9)) - }) - - }) - - Describe("killAndWait", func() { - It("should kill all the started sessions and wait for them to finish", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - KillAndWait() - Ω(session1).Should(Exit(128+9), "Should have exited") - Ω(session2).Should(Exit(128+9), "Should have exited") - Ω(session3).Should(Exit(128+9), "Should have exited") - }) - }) - - Describe("terminate", func() { - It("should terminate all the started sessions", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Terminate() - - Eventually(session1).Should(Exit(128 + 15)) - Eventually(session2).Should(Exit(128 + 15)) - Eventually(session3).Should(Exit(128 + 15)) - }) - - It("should not wait for exit", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Terminate() - - Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") - }) - }) - - Describe("terminateAndWait", func() { - It("should terminate all the started sessions, and wait for them to exit", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - TerminateAndWait() - - Ω(session1).Should(Exit(128+15), "Should have exited") - Ω(session2).Should(Exit(128+15), "Should have exited") - Ω(session3).Should(Exit(128+15), "Should have exited") - }) - }) - - Describe("signal", func() { - It("should signal all the started sessions", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Signal(syscall.SIGABRT) - - Eventually(session1).Should(Exit(128 + 6)) - Eventually(session2).Should(Exit(128 + 6)) - Eventually(session3).Should(Exit(128 + 6)) - }) - - It("should not wait", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Signal(syscall.SIGABRT) - - Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") - }) - }) - - Describe("interrupt", func() { - It("should interrupt all the started sessions, and not wait", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Interrupt() - - Eventually(session1).Should(Exit(128 + 2)) - Eventually(session2).Should(Exit(128 + 2)) - Eventually(session3).Should(Exit(128 + 2)) - }) - - It("should not wait", func() { - session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) - Ω(err).ShouldNot(HaveOccurred()) - - Interrupt() - - Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") - }) - }) - }) - - Context("when the command exits", func() { - It("should close the buffers", func() { - Eventually(session).Should(Exit()) - - Ω(session.Out.Closed()).Should(BeTrue()) - Ω(session.Err.Closed()).Should(BeTrue()) - - Ω(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) - }) - - var So = It - - So("this means that eventually should short circuit", func() { - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(session).Should(Say("blah blah blah blah blah")) - }) - Ω(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond)) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Context("when wrapping out and err", func() { - BeforeEach(func() { - outWriter = NewBuffer() - errWriter = NewBuffer() - }) - - It("should route to both the provided writers and the gbytes buffers", func() { - Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) - Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!")) - - Ω(outWriter.Contents()).Should(ContainSubstring("We've done the impossible, and that makes us mighty")) - Ω(errWriter.Contents()).Should(ContainSubstring("Ah, curse your sudden but inevitable betrayal!")) - - Eventually(session).Should(Exit()) - - Ω(outWriter.Contents()).Should(Equal(session.Out.Contents())) - Ω(errWriter.Contents()).Should(Equal(session.Err.Contents())) - }) - }) - - Describe("when the command fails to start", func() { - It("should return an error", func() { - _, err := Start(exec.Command("agklsjdfas"), nil, nil) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package gexec_test + +import ( + "os/exec" + "syscall" + "time" + + . "github.com/onsi/gomega/gbytes" + . "github.com/onsi/gomega/gexec" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Session", func() { + var command *exec.Cmd + var session *Session + + var outWriter, errWriter *Buffer + + BeforeEach(func() { + outWriter = nil + errWriter = nil + }) + + JustBeforeEach(func() { + command = exec.Command(fireflyPath) + var err error + session, err = Start(command, outWriter, errWriter) + Ω(err).ShouldNot(HaveOccurred()) + }) + + Context("running a command", func() { + It("should start the process", func() { + Ω(command.Process).ShouldNot(BeNil()) + }) + + It("should wrap the process's stdout and stderr with gbytes buffers", func(done Done) { + Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) + Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!")) + defer session.Out.CancelDetects() + + select { + case <-session.Out.Detect("Can we maybe vote on the whole murdering people issue"): + Eventually(session).Should(Exit(0)) + case <-session.Out.Detect("I swear by my pretty floral bonnet, I will end you."): + Eventually(session).Should(Exit(1)) + case <-session.Out.Detect("My work's illegal, but at least it's honest."): + Eventually(session).Should(Exit(2)) + } + + close(done) + }) + + It("should satisfy the gbytes.BufferProvider interface, passing Stdout", func() { + Eventually(session).Should(Say("We've done the impossible, and that makes us mighty")) + Eventually(session).Should(Exit()) + }) + }) + + Describe("providing the exit code", func() { + It("should provide the app's exit code", func() { + Ω(session.ExitCode()).Should(Equal(-1)) + + Eventually(session).Should(Exit()) + Ω(session.ExitCode()).Should(BeNumerically(">=", 0)) + Ω(session.ExitCode()).Should(BeNumerically("<", 3)) + }) + }) + + Describe("wait", func() { + It("should wait till the command exits", func() { + Ω(session.ExitCode()).Should(Equal(-1)) + Ω(session.Wait().ExitCode()).Should(BeNumerically(">=", 0)) + Ω(session.Wait().ExitCode()).Should(BeNumerically("<", 3)) + }) + }) + + Describe("exited", func() { + It("should close when the command exits", func() { + Eventually(session.Exited).Should(BeClosed()) + Ω(session.ExitCode()).ShouldNot(Equal(-1)) + }) + }) + + Describe("kill", func() { + It("should kill the command and don't wait for it to exit", func() { + session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session.Kill() + Ω(session).ShouldNot(Exit(), "Should not exit immediately...") + Eventually(session).Should(Exit(128 + 9)) + }) + }) + + Describe("interrupt", func() { + It("should interrupt the command", func() { + session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session.Interrupt() + Ω(session).ShouldNot(Exit(), "Should not exit immediately...") + Eventually(session).Should(Exit(128 + 2)) + }) + }) + + Describe("terminate", func() { + It("should terminate the command", func() { + session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session.Terminate() + Ω(session).ShouldNot(Exit(), "Should not exit immediately...") + Eventually(session).Should(Exit(128 + 15)) + }) + }) + + Describe("signal", func() { + It("should send the signal to the command", func() { + session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session.Signal(syscall.SIGABRT) + Ω(session).ShouldNot(Exit(), "Should not exit immediately...") + Eventually(session).Should(Exit(128 + 6)) + }) + }) + + Context("tracking sessions", func() { + BeforeEach(func() { + KillAndWait() + }) + + Describe("kill", func() { + It("should kill all the started sessions", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Kill() + + Eventually(session1).Should(Exit(128 + 9)) + Eventually(session2).Should(Exit(128 + 9)) + Eventually(session3).Should(Exit(128 + 9)) + }) + + It("should not wait for exit", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Kill() + Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") + + Eventually(session1).Should(Exit(128 + 9)) + }) + + It("should not track unstarted sessions", func() { + _, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).Should(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Kill() + + Eventually(session2).Should(Exit(128 + 9)) + Eventually(session3).Should(Exit(128 + 9)) + }) + + }) + + Describe("killAndWait", func() { + It("should kill all the started sessions and wait for them to finish", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + KillAndWait() + Ω(session1).Should(Exit(128+9), "Should have exited") + Ω(session2).Should(Exit(128+9), "Should have exited") + Ω(session3).Should(Exit(128+9), "Should have exited") + }) + }) + + Describe("terminate", func() { + It("should terminate all the started sessions", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Terminate() + + Eventually(session1).Should(Exit(128 + 15)) + Eventually(session2).Should(Exit(128 + 15)) + Eventually(session3).Should(Exit(128 + 15)) + }) + + It("should not wait for exit", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Terminate() + + Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") + }) + }) + + Describe("terminateAndWait", func() { + It("should terminate all the started sessions, and wait for them to exit", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + TerminateAndWait() + + Ω(session1).Should(Exit(128+15), "Should have exited") + Ω(session2).Should(Exit(128+15), "Should have exited") + Ω(session3).Should(Exit(128+15), "Should have exited") + }) + }) + + Describe("signal", func() { + It("should signal all the started sessions", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Signal(syscall.SIGABRT) + + Eventually(session1).Should(Exit(128 + 6)) + Eventually(session2).Should(Exit(128 + 6)) + Eventually(session3).Should(Exit(128 + 6)) + }) + + It("should not wait", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Signal(syscall.SIGABRT) + + Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") + }) + }) + + Describe("interrupt", func() { + It("should interrupt all the started sessions, and not wait", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Interrupt() + + Eventually(session1).Should(Exit(128 + 2)) + Eventually(session2).Should(Exit(128 + 2)) + Eventually(session3).Should(Exit(128 + 2)) + }) + + It("should not wait", func() { + session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + + Interrupt() + + Ω(session1).ShouldNot(Exit(), "Should not exit immediately...") + }) + }) + }) + + Context("when the command exits", func() { + It("should close the buffers", func() { + Eventually(session).Should(Exit()) + + Ω(session.Out.Closed()).Should(BeTrue()) + Ω(session.Err.Closed()).Should(BeTrue()) + + Ω(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) + }) + + var So = It + + So("this means that eventually should short circuit", func() { + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(session).Should(Say("blah blah blah blah blah")) + }) + Ω(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond)) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Context("when wrapping out and err", func() { + BeforeEach(func() { + outWriter = NewBuffer() + errWriter = NewBuffer() + }) + + It("should route to both the provided writers and the gbytes buffers", func() { + Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty")) + Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!")) + + Ω(outWriter.Contents()).Should(ContainSubstring("We've done the impossible, and that makes us mighty")) + Ω(errWriter.Contents()).Should(ContainSubstring("Ah, curse your sudden but inevitable betrayal!")) + + Eventually(session).Should(Exit()) + + Ω(outWriter.Contents()).Should(Equal(session.Out.Contents())) + Ω(errWriter.Contents()).Should(Equal(session.Err.Contents())) + }) + }) + + Describe("when the command fails to start", func() { + It("should return an error", func() { + _, err := Start(exec.Command("agklsjdfas"), nil, nil) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/ghttp/handlers.go b/vendor/github.com/onsi/gomega/ghttp/handlers.go index f2c52412fe..63ff6919ad 100644 --- a/vendor/github.com/onsi/gomega/ghttp/handlers.go +++ b/vendor/github.com/onsi/gomega/ghttp/handlers.go @@ -1,313 +1,313 @@ -package ghttp - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "net/url" - "reflect" - - "github.com/golang/protobuf/proto" - . "github.com/onsi/gomega" - "github.com/onsi/gomega/types" -) - -//CombineHandler takes variadic list of handlers and produces one handler -//that calls each handler in order. -func CombineHandlers(handlers ...http.HandlerFunc) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - for _, handler := range handlers { - handler(w, req) - } - } -} - -//VerifyRequest returns a handler that verifies that a request uses the specified method to connect to the specified path -//You may also pass in an optional rawQuery string which is tested against the request's `req.URL.RawQuery` -// -//For path, you may pass in a string, in which case strict equality will be applied -//Alternatively you can pass in a matcher (ContainSubstring("/foo") and MatchRegexp("/foo/[a-f0-9]+") for example) -func VerifyRequest(method string, path interface{}, rawQuery ...string) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - Ω(req.Method).Should(Equal(method), "Method mismatch") - switch p := path.(type) { - case types.GomegaMatcher: - Ω(req.URL.Path).Should(p, "Path mismatch") - default: - Ω(req.URL.Path).Should(Equal(path), "Path mismatch") - } - if len(rawQuery) > 0 { - values, err := url.ParseQuery(rawQuery[0]) - Ω(err).ShouldNot(HaveOccurred(), "Expected RawQuery is malformed") - - Ω(req.URL.Query()).Should(Equal(values), "RawQuery mismatch") - } - } -} - -//VerifyContentType returns a handler that verifies that a request has a Content-Type header set to the -//specified value -func VerifyContentType(contentType string) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - Ω(req.Header.Get("Content-Type")).Should(Equal(contentType)) - } -} - -//VerifyBasicAuth returns a handler that verifies the request contains a BasicAuth Authorization header -//matching the passed in username and password -func VerifyBasicAuth(username string, password string) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - auth := req.Header.Get("Authorization") - Ω(auth).ShouldNot(Equal(""), "Authorization header must be specified") - - decoded, err := base64.StdEncoding.DecodeString(auth[6:]) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(string(decoded)).Should(Equal(fmt.Sprintf("%s:%s", username, password)), "Authorization mismatch") - } -} - -//VerifyHeader returns a handler that verifies the request contains the passed in headers. -//The passed in header keys are first canonicalized via http.CanonicalHeaderKey. -// -//The request must contain *all* the passed in headers, but it is allowed to have additional headers -//beyond the passed in set. -func VerifyHeader(header http.Header) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - for key, values := range header { - key = http.CanonicalHeaderKey(key) - Ω(req.Header[key]).Should(Equal(values), "Header mismatch for key: %s", key) - } - } -} - -//VerifyHeaderKV returns a handler that verifies the request contains a header matching the passed in key and values -//(recall that a `http.Header` is a mapping from string (key) to []string (values)) -//It is a convenience wrapper around `VerifyHeader` that allows you to avoid having to create an `http.Header` object. -func VerifyHeaderKV(key string, values ...string) http.HandlerFunc { - return VerifyHeader(http.Header{key: values}) -} - -//VerifyBody returns a handler that verifies that the body of the request matches the passed in byte array. -//It does this using Equal(). -func VerifyBody(expectedBody []byte) http.HandlerFunc { - return CombineHandlers( - func(w http.ResponseWriter, req *http.Request) { - body, err := ioutil.ReadAll(req.Body) - req.Body.Close() - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(Equal(expectedBody), "Body Mismatch") - }, - ) -} - -//VerifyJSON returns a handler that verifies that the body of the request is a valid JSON representation -//matching the passed in JSON string. It does this using Gomega's MatchJSON method -// -//VerifyJSON also verifies that the request's content type is application/json -func VerifyJSON(expectedJSON string) http.HandlerFunc { - return CombineHandlers( - VerifyContentType("application/json"), - func(w http.ResponseWriter, req *http.Request) { - body, err := ioutil.ReadAll(req.Body) - req.Body.Close() - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(MatchJSON(expectedJSON), "JSON Mismatch") - }, - ) -} - -//VerifyJSONRepresenting is similar to VerifyJSON. Instead of taking a JSON string, however, it -//takes an arbitrary JSON-encodable object and verifies that the requests's body is a JSON representation -//that matches the object -func VerifyJSONRepresenting(object interface{}) http.HandlerFunc { - data, err := json.Marshal(object) - Ω(err).ShouldNot(HaveOccurred()) - return CombineHandlers( - VerifyContentType("application/json"), - VerifyJSON(string(data)), - ) -} - -//VerifyForm returns a handler that verifies a request contains the specified form values. -// -//The request must contain *all* of the specified values, but it is allowed to have additional -//form values beyond the passed in set. -func VerifyForm(values url.Values) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - err := r.ParseForm() - Ω(err).ShouldNot(HaveOccurred()) - for key, vals := range values { - Ω(r.Form[key]).Should(Equal(vals), "Form mismatch for key: %s", key) - } - } -} - -//VerifyFormKV returns a handler that verifies a request contains a form key with the specified values. -// -//It is a convenience wrapper around `VerifyForm` that lets you avoid having to create a `url.Values` object. -func VerifyFormKV(key string, values ...string) http.HandlerFunc { - return VerifyForm(url.Values{key: values}) -} - -//VerifyProtoRepresenting returns a handler that verifies that the body of the request is a valid protobuf -//representation of the passed message. -// -//VerifyProtoRepresenting also verifies that the request's content type is application/x-protobuf -func VerifyProtoRepresenting(expected proto.Message) http.HandlerFunc { - return CombineHandlers( - VerifyContentType("application/x-protobuf"), - func(w http.ResponseWriter, req *http.Request) { - body, err := ioutil.ReadAll(req.Body) - Ω(err).ShouldNot(HaveOccurred()) - req.Body.Close() - - expectedType := reflect.TypeOf(expected) - actualValuePtr := reflect.New(expectedType.Elem()) - - actual, ok := actualValuePtr.Interface().(proto.Message) - Ω(ok).Should(BeTrue(), "Message value is not a proto.Message") - - err = proto.Unmarshal(body, actual) - Ω(err).ShouldNot(HaveOccurred(), "Failed to unmarshal protobuf") - - Ω(actual).Should(Equal(expected), "ProtoBuf Mismatch") - }, - ) -} - -func copyHeader(src http.Header, dst http.Header) { - for key, value := range src { - dst[key] = value - } -} - -/* -RespondWith returns a handler that responds to a request with the specified status code and body - -Body may be a string or []byte - -Also, RespondWith can be given an optional http.Header. The headers defined therein will be added to the response headers. -*/ -func RespondWith(statusCode int, body interface{}, optionalHeader ...http.Header) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - if len(optionalHeader) == 1 { - copyHeader(optionalHeader[0], w.Header()) - } - w.WriteHeader(statusCode) - switch x := body.(type) { - case string: - w.Write([]byte(x)) - case []byte: - w.Write(x) - default: - Ω(body).Should(BeNil(), "Invalid type for body. Should be string or []byte.") - } - } -} - -/* -RespondWithPtr returns a handler that responds to a request with the specified status code and body - -Unlike RespondWith, you pass RepondWithPtr a pointer to the status code and body allowing different tests -to share the same setup but specify different status codes and bodies. - -Also, RespondWithPtr can be given an optional http.Header. The headers defined therein will be added to the response headers. -Since the http.Header can be mutated after the fact you don't need to pass in a pointer. -*/ -func RespondWithPtr(statusCode *int, body interface{}, optionalHeader ...http.Header) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - if len(optionalHeader) == 1 { - copyHeader(optionalHeader[0], w.Header()) - } - w.WriteHeader(*statusCode) - if body != nil { - switch x := (body).(type) { - case *string: - w.Write([]byte(*x)) - case *[]byte: - w.Write(*x) - default: - Ω(body).Should(BeNil(), "Invalid type for body. Should be string or []byte.") - } - } - } -} - -/* -RespondWithJSONEncoded returns a handler that responds to a request with the specified status code and a body -containing the JSON-encoding of the passed in object - -Also, RespondWithJSONEncoded can be given an optional http.Header. The headers defined therein will be added to the response headers. -*/ -func RespondWithJSONEncoded(statusCode int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc { - data, err := json.Marshal(object) - Ω(err).ShouldNot(HaveOccurred()) - - var headers http.Header - if len(optionalHeader) == 1 { - headers = optionalHeader[0] - } else { - headers = make(http.Header) - } - if _, found := headers["Content-Type"]; !found { - headers["Content-Type"] = []string{"application/json"} - } - return RespondWith(statusCode, string(data), headers) -} - -/* -RespondWithJSONEncodedPtr behaves like RespondWithJSONEncoded but takes a pointer -to a status code and object. - -This allows different tests to share the same setup but specify different status codes and JSON-encoded -objects. - -Also, RespondWithJSONEncodedPtr can be given an optional http.Header. The headers defined therein will be added to the response headers. -Since the http.Header can be mutated after the fact you don't need to pass in a pointer. -*/ -func RespondWithJSONEncodedPtr(statusCode *int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - data, err := json.Marshal(object) - Ω(err).ShouldNot(HaveOccurred()) - var headers http.Header - if len(optionalHeader) == 1 { - headers = optionalHeader[0] - } else { - headers = make(http.Header) - } - if _, found := headers["Content-Type"]; !found { - headers["Content-Type"] = []string{"application/json"} - } - copyHeader(headers, w.Header()) - w.WriteHeader(*statusCode) - w.Write(data) - } -} - -//RespondWithProto returns a handler that responds to a request with the specified status code and a body -//containing the protobuf serialization of the provided message. -// -//Also, RespondWithProto can be given an optional http.Header. The headers defined therein will be added to the response headers. -func RespondWithProto(statusCode int, message proto.Message, optionalHeader ...http.Header) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - data, err := proto.Marshal(message) - Ω(err).ShouldNot(HaveOccurred()) - - var headers http.Header - if len(optionalHeader) == 1 { - headers = optionalHeader[0] - } else { - headers = make(http.Header) - } - if _, found := headers["Content-Type"]; !found { - headers["Content-Type"] = []string{"application/x-protobuf"} - } - copyHeader(headers, w.Header()) - - w.WriteHeader(statusCode) - w.Write(data) - } -} +package ghttp + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "reflect" + + "github.com/golang/protobuf/proto" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/types" +) + +//CombineHandler takes variadic list of handlers and produces one handler +//that calls each handler in order. +func CombineHandlers(handlers ...http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + for _, handler := range handlers { + handler(w, req) + } + } +} + +//VerifyRequest returns a handler that verifies that a request uses the specified method to connect to the specified path +//You may also pass in an optional rawQuery string which is tested against the request's `req.URL.RawQuery` +// +//For path, you may pass in a string, in which case strict equality will be applied +//Alternatively you can pass in a matcher (ContainSubstring("/foo") and MatchRegexp("/foo/[a-f0-9]+") for example) +func VerifyRequest(method string, path interface{}, rawQuery ...string) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + Ω(req.Method).Should(Equal(method), "Method mismatch") + switch p := path.(type) { + case types.GomegaMatcher: + Ω(req.URL.Path).Should(p, "Path mismatch") + default: + Ω(req.URL.Path).Should(Equal(path), "Path mismatch") + } + if len(rawQuery) > 0 { + values, err := url.ParseQuery(rawQuery[0]) + Ω(err).ShouldNot(HaveOccurred(), "Expected RawQuery is malformed") + + Ω(req.URL.Query()).Should(Equal(values), "RawQuery mismatch") + } + } +} + +//VerifyContentType returns a handler that verifies that a request has a Content-Type header set to the +//specified value +func VerifyContentType(contentType string) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + Ω(req.Header.Get("Content-Type")).Should(Equal(contentType)) + } +} + +//VerifyBasicAuth returns a handler that verifies the request contains a BasicAuth Authorization header +//matching the passed in username and password +func VerifyBasicAuth(username string, password string) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + auth := req.Header.Get("Authorization") + Ω(auth).ShouldNot(Equal(""), "Authorization header must be specified") + + decoded, err := base64.StdEncoding.DecodeString(auth[6:]) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(string(decoded)).Should(Equal(fmt.Sprintf("%s:%s", username, password)), "Authorization mismatch") + } +} + +//VerifyHeader returns a handler that verifies the request contains the passed in headers. +//The passed in header keys are first canonicalized via http.CanonicalHeaderKey. +// +//The request must contain *all* the passed in headers, but it is allowed to have additional headers +//beyond the passed in set. +func VerifyHeader(header http.Header) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + for key, values := range header { + key = http.CanonicalHeaderKey(key) + Ω(req.Header[key]).Should(Equal(values), "Header mismatch for key: %s", key) + } + } +} + +//VerifyHeaderKV returns a handler that verifies the request contains a header matching the passed in key and values +//(recall that a `http.Header` is a mapping from string (key) to []string (values)) +//It is a convenience wrapper around `VerifyHeader` that allows you to avoid having to create an `http.Header` object. +func VerifyHeaderKV(key string, values ...string) http.HandlerFunc { + return VerifyHeader(http.Header{key: values}) +} + +//VerifyBody returns a handler that verifies that the body of the request matches the passed in byte array. +//It does this using Equal(). +func VerifyBody(expectedBody []byte) http.HandlerFunc { + return CombineHandlers( + func(w http.ResponseWriter, req *http.Request) { + body, err := ioutil.ReadAll(req.Body) + req.Body.Close() + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(Equal(expectedBody), "Body Mismatch") + }, + ) +} + +//VerifyJSON returns a handler that verifies that the body of the request is a valid JSON representation +//matching the passed in JSON string. It does this using Gomega's MatchJSON method +// +//VerifyJSON also verifies that the request's content type is application/json +func VerifyJSON(expectedJSON string) http.HandlerFunc { + return CombineHandlers( + VerifyContentType("application/json"), + func(w http.ResponseWriter, req *http.Request) { + body, err := ioutil.ReadAll(req.Body) + req.Body.Close() + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(MatchJSON(expectedJSON), "JSON Mismatch") + }, + ) +} + +//VerifyJSONRepresenting is similar to VerifyJSON. Instead of taking a JSON string, however, it +//takes an arbitrary JSON-encodable object and verifies that the requests's body is a JSON representation +//that matches the object +func VerifyJSONRepresenting(object interface{}) http.HandlerFunc { + data, err := json.Marshal(object) + Ω(err).ShouldNot(HaveOccurred()) + return CombineHandlers( + VerifyContentType("application/json"), + VerifyJSON(string(data)), + ) +} + +//VerifyForm returns a handler that verifies a request contains the specified form values. +// +//The request must contain *all* of the specified values, but it is allowed to have additional +//form values beyond the passed in set. +func VerifyForm(values url.Values) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + Ω(err).ShouldNot(HaveOccurred()) + for key, vals := range values { + Ω(r.Form[key]).Should(Equal(vals), "Form mismatch for key: %s", key) + } + } +} + +//VerifyFormKV returns a handler that verifies a request contains a form key with the specified values. +// +//It is a convenience wrapper around `VerifyForm` that lets you avoid having to create a `url.Values` object. +func VerifyFormKV(key string, values ...string) http.HandlerFunc { + return VerifyForm(url.Values{key: values}) +} + +//VerifyProtoRepresenting returns a handler that verifies that the body of the request is a valid protobuf +//representation of the passed message. +// +//VerifyProtoRepresenting also verifies that the request's content type is application/x-protobuf +func VerifyProtoRepresenting(expected proto.Message) http.HandlerFunc { + return CombineHandlers( + VerifyContentType("application/x-protobuf"), + func(w http.ResponseWriter, req *http.Request) { + body, err := ioutil.ReadAll(req.Body) + Ω(err).ShouldNot(HaveOccurred()) + req.Body.Close() + + expectedType := reflect.TypeOf(expected) + actualValuePtr := reflect.New(expectedType.Elem()) + + actual, ok := actualValuePtr.Interface().(proto.Message) + Ω(ok).Should(BeTrue(), "Message value is not a proto.Message") + + err = proto.Unmarshal(body, actual) + Ω(err).ShouldNot(HaveOccurred(), "Failed to unmarshal protobuf") + + Ω(actual).Should(Equal(expected), "ProtoBuf Mismatch") + }, + ) +} + +func copyHeader(src http.Header, dst http.Header) { + for key, value := range src { + dst[key] = value + } +} + +/* +RespondWith returns a handler that responds to a request with the specified status code and body + +Body may be a string or []byte + +Also, RespondWith can be given an optional http.Header. The headers defined therein will be added to the response headers. +*/ +func RespondWith(statusCode int, body interface{}, optionalHeader ...http.Header) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + if len(optionalHeader) == 1 { + copyHeader(optionalHeader[0], w.Header()) + } + w.WriteHeader(statusCode) + switch x := body.(type) { + case string: + w.Write([]byte(x)) + case []byte: + w.Write(x) + default: + Ω(body).Should(BeNil(), "Invalid type for body. Should be string or []byte.") + } + } +} + +/* +RespondWithPtr returns a handler that responds to a request with the specified status code and body + +Unlike RespondWith, you pass RepondWithPtr a pointer to the status code and body allowing different tests +to share the same setup but specify different status codes and bodies. + +Also, RespondWithPtr can be given an optional http.Header. The headers defined therein will be added to the response headers. +Since the http.Header can be mutated after the fact you don't need to pass in a pointer. +*/ +func RespondWithPtr(statusCode *int, body interface{}, optionalHeader ...http.Header) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + if len(optionalHeader) == 1 { + copyHeader(optionalHeader[0], w.Header()) + } + w.WriteHeader(*statusCode) + if body != nil { + switch x := (body).(type) { + case *string: + w.Write([]byte(*x)) + case *[]byte: + w.Write(*x) + default: + Ω(body).Should(BeNil(), "Invalid type for body. Should be string or []byte.") + } + } + } +} + +/* +RespondWithJSONEncoded returns a handler that responds to a request with the specified status code and a body +containing the JSON-encoding of the passed in object + +Also, RespondWithJSONEncoded can be given an optional http.Header. The headers defined therein will be added to the response headers. +*/ +func RespondWithJSONEncoded(statusCode int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc { + data, err := json.Marshal(object) + Ω(err).ShouldNot(HaveOccurred()) + + var headers http.Header + if len(optionalHeader) == 1 { + headers = optionalHeader[0] + } else { + headers = make(http.Header) + } + if _, found := headers["Content-Type"]; !found { + headers["Content-Type"] = []string{"application/json"} + } + return RespondWith(statusCode, string(data), headers) +} + +/* +RespondWithJSONEncodedPtr behaves like RespondWithJSONEncoded but takes a pointer +to a status code and object. + +This allows different tests to share the same setup but specify different status codes and JSON-encoded +objects. + +Also, RespondWithJSONEncodedPtr can be given an optional http.Header. The headers defined therein will be added to the response headers. +Since the http.Header can be mutated after the fact you don't need to pass in a pointer. +*/ +func RespondWithJSONEncodedPtr(statusCode *int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + data, err := json.Marshal(object) + Ω(err).ShouldNot(HaveOccurred()) + var headers http.Header + if len(optionalHeader) == 1 { + headers = optionalHeader[0] + } else { + headers = make(http.Header) + } + if _, found := headers["Content-Type"]; !found { + headers["Content-Type"] = []string{"application/json"} + } + copyHeader(headers, w.Header()) + w.WriteHeader(*statusCode) + w.Write(data) + } +} + +//RespondWithProto returns a handler that responds to a request with the specified status code and a body +//containing the protobuf serialization of the provided message. +// +//Also, RespondWithProto can be given an optional http.Header. The headers defined therein will be added to the response headers. +func RespondWithProto(statusCode int, message proto.Message, optionalHeader ...http.Header) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + data, err := proto.Marshal(message) + Ω(err).ShouldNot(HaveOccurred()) + + var headers http.Header + if len(optionalHeader) == 1 { + headers = optionalHeader[0] + } else { + headers = make(http.Header) + } + if _, found := headers["Content-Type"]; !found { + headers["Content-Type"] = []string{"application/x-protobuf"} + } + copyHeader(headers, w.Header()) + + w.WriteHeader(statusCode) + w.Write(data) + } +} diff --git a/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go b/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go index 1e9ec93d1a..b2972bc9fb 100644 --- a/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go +++ b/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go @@ -1,3 +1,3 @@ -package protobuf - -//go:generate protoc --go_out=. simple_message.proto +package protobuf + +//go:generate protoc --go_out=. simple_message.proto diff --git a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go b/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go index 68515e0f62..c55a48448f 100644 --- a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go +++ b/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go @@ -1,55 +1,55 @@ -// Code generated by protoc-gen-go. -// source: simple_message.proto -// DO NOT EDIT! - -/* -Package protobuf is a generated protocol buffer package. - -It is generated from these files: - simple_message.proto - -It has these top-level messages: - SimpleMessage -*/ -package protobuf - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -type SimpleMessage struct { - Description *string `protobuf:"bytes,1,req,name=description" json:"description,omitempty"` - Id *int32 `protobuf:"varint,2,req,name=id" json:"id,omitempty"` - Metadata *string `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } -func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } -func (*SimpleMessage) ProtoMessage() {} - -func (m *SimpleMessage) GetDescription() string { - if m != nil && m.Description != nil { - return *m.Description - } - return "" -} - -func (m *SimpleMessage) GetId() int32 { - if m != nil && m.Id != nil { - return *m.Id - } - return 0 -} - -func (m *SimpleMessage) GetMetadata() string { - if m != nil && m.Metadata != nil { - return *m.Metadata - } - return "" -} +// Code generated by protoc-gen-go. +// source: simple_message.proto +// DO NOT EDIT! + +/* +Package protobuf is a generated protocol buffer package. + +It is generated from these files: + simple_message.proto + +It has these top-level messages: + SimpleMessage +*/ +package protobuf + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type SimpleMessage struct { + Description *string `protobuf:"bytes,1,req,name=description" json:"description,omitempty"` + Id *int32 `protobuf:"varint,2,req,name=id" json:"id,omitempty"` + Metadata *string `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SimpleMessage) Reset() { *m = SimpleMessage{} } +func (m *SimpleMessage) String() string { return proto.CompactTextString(m) } +func (*SimpleMessage) ProtoMessage() {} + +func (m *SimpleMessage) GetDescription() string { + if m != nil && m.Description != nil { + return *m.Description + } + return "" +} + +func (m *SimpleMessage) GetId() int32 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *SimpleMessage) GetMetadata() string { + if m != nil && m.Metadata != nil { + return *m.Metadata + } + return "" +} diff --git a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto b/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto index 22995f1d66..35b7145c24 100644 --- a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto +++ b/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto @@ -1,9 +1,9 @@ -syntax = "proto2"; - -package protobuf; - -message SimpleMessage { - required string description = 1; - required int32 id = 2; - optional string metadata = 3; -} +syntax = "proto2"; + +package protobuf; + +message SimpleMessage { + required string description = 1; + required int32 id = 2; + optional string metadata = 3; +} diff --git a/vendor/github.com/onsi/gomega/ghttp/test_server.go b/vendor/github.com/onsi/gomega/ghttp/test_server.go index bc9bf1e058..40d92dea2c 100644 --- a/vendor/github.com/onsi/gomega/ghttp/test_server.go +++ b/vendor/github.com/onsi/gomega/ghttp/test_server.go @@ -1,381 +1,381 @@ -/* -Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports -registering multiple handlers. Incoming requests are not routed between the different handlers -- rather it is merely the order of the handlers that matters. The first request is handled by the first -registered handler, the second request by the second handler, etc. - -The intent here is to have each handler *verify* that the incoming request is valid. To accomplish, ghttp -also provides a collection of bite-size handlers that each perform one aspect of request verification. These can -be composed together and registered with a ghttp server. The result is an expressive language for describing -the requests generated by the client under test. - -Here's a simple example, note that the server handler is only defined in one BeforeEach and then modified, as required, by the nested BeforeEaches. -A more comprehensive example is available at https://onsi.github.io/gomega/#_testing_http_clients - - var _ = Describe("A Sprockets Client", func() { - var server *ghttp.Server - var client *SprocketClient - BeforeEach(func() { - server = ghttp.NewServer() - client = NewSprocketClient(server.URL(), "skywalker", "tk427") - }) - - AfterEach(func() { - server.Close() - }) - - Describe("fetching sprockets", func() { - var statusCode int - var sprockets []Sprocket - BeforeEach(func() { - statusCode = http.StatusOK - sprockets = []Sprocket{} - server.AppendHandlers(ghttp.CombineHandlers( - ghttp.VerifyRequest("GET", "/sprockets"), - ghttp.VerifyBasicAuth("skywalker", "tk427"), - ghttp.RespondWithJSONEncodedPtr(&statusCode, &sprockets), - )) - }) - - Context("when requesting all sprockets", func() { - Context("when the response is succesful", func() { - BeforeEach(func() { - sprockets = []Sprocket{ - NewSprocket("Alfalfa"), - NewSprocket("Banana"), - } - }) - - It("should return the returned sprockets", func() { - Ω(client.Sprockets()).Should(Equal(sprockets)) - }) - }) - - Context("when the response is missing", func() { - BeforeEach(func() { - statusCode = http.StatusNotFound - }) - - It("should return an empty list of sprockets", func() { - Ω(client.Sprockets()).Should(BeEmpty()) - }) - }) - - Context("when the response fails to authenticate", func() { - BeforeEach(func() { - statusCode = http.StatusUnauthorized - }) - - It("should return an AuthenticationError error", func() { - sprockets, err := client.Sprockets() - Ω(sprockets).Should(BeEmpty()) - Ω(err).Should(MatchError(AuthenticationError)) - }) - }) - - Context("when the response is a server failure", func() { - BeforeEach(func() { - statusCode = http.StatusInternalServerError - }) - - It("should return an InternalError error", func() { - sprockets, err := client.Sprockets() - Ω(sprockets).Should(BeEmpty()) - Ω(err).Should(MatchError(InternalError)) - }) - }) - }) - - Context("when requesting some sprockets", func() { - BeforeEach(func() { - sprockets = []Sprocket{ - NewSprocket("Alfalfa"), - NewSprocket("Banana"), - } - - server.WrapHandler(0, ghttp.VerifyRequest("GET", "/sprockets", "filter=FOOD")) - }) - - It("should make the request with a filter", func() { - Ω(client.Sprockets("food")).Should(Equal(sprockets)) - }) - }) - }) - }) -*/ -package ghttp - -import ( - "fmt" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "reflect" - "regexp" - "strings" - "sync" - - . "github.com/onsi/gomega" -) - -func new() *Server { - return &Server{ - AllowUnhandledRequests: false, - UnhandledRequestStatusCode: http.StatusInternalServerError, - writeLock: &sync.Mutex{}, - } -} - -type routedHandler struct { - method string - pathRegexp *regexp.Regexp - path string - handler http.HandlerFunc -} - -// NewServer returns a new `*ghttp.Server` that wraps an `httptest` server. The server is started automatically. -func NewServer() *Server { - s := new() - s.HTTPTestServer = httptest.NewServer(s) - return s -} - -// NewUnstartedServer return a new, unstarted, `*ghttp.Server`. Useful for specifying a custom listener on `server.HTTPTestServer`. -func NewUnstartedServer() *Server { - s := new() - s.HTTPTestServer = httptest.NewUnstartedServer(s) - return s -} - -// NewTLSServer returns a new `*ghttp.Server` that wraps an `httptest` TLS server. The server is started automatically. -func NewTLSServer() *Server { - s := new() - s.HTTPTestServer = httptest.NewTLSServer(s) - return s -} - -type Server struct { - //The underlying httptest server - HTTPTestServer *httptest.Server - - //Defaults to false. If set to true, the Server will allow more requests than there are registered handlers. - AllowUnhandledRequests bool - - //The status code returned when receiving an unhandled request. - //Defaults to http.StatusInternalServerError. - //Only applies if AllowUnhandledRequests is true - UnhandledRequestStatusCode int - - //If provided, ghttp will log about each request received to the provided io.Writer - //Defaults to nil - //If you're using Ginkgo, set this to GinkgoWriter to get improved output during failures - Writer io.Writer - - receivedRequests []*http.Request - requestHandlers []http.HandlerFunc - routedHandlers []routedHandler - - writeLock *sync.Mutex - calls int -} - -//Start() starts an unstarted ghttp server. It is a catastrophic error to call Start more than once (thanks, httptest). -func (s *Server) Start() { - s.HTTPTestServer.Start() -} - -//URL() returns a url that will hit the server -func (s *Server) URL() string { - return s.HTTPTestServer.URL -} - -//Addr() returns the address on which the server is listening. -func (s *Server) Addr() string { - return s.HTTPTestServer.Listener.Addr().String() -} - -//Close() should be called at the end of each test. It spins down and cleans up the test server. -func (s *Server) Close() { - s.writeLock.Lock() - server := s.HTTPTestServer - s.HTTPTestServer = nil - s.writeLock.Unlock() - - if server != nil { - server.Close() - } -} - -//ServeHTTP() makes Server an http.Handler -//When the server receives a request it handles the request in the following order: -// -//1. If the request matches a handler registered with RouteToHandler, that handler is called. -//2. Otherwise, if there are handlers registered via AppendHandlers, those handlers are called in order. -//3. If all registered handlers have been called then: -// a) If AllowUnhandledRequests is true, the request will be handled with response code of UnhandledRequestStatusCode -// b) If AllowUnhandledRequests is false, the request will not be handled and the current test will be marked as failed. -func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) { - s.writeLock.Lock() - defer func() { - e := recover() - if e != nil { - w.WriteHeader(http.StatusInternalServerError) - } - - //If the handler panics GHTTP will silently succeed. This is bad™. - //To catch this case we need to fail the test if the handler has panicked. - //However, if the handler is panicking because Ginkgo's causing it to panic (i.e. an assertion failed) - //then we shouldn't double-report the error as this will confuse people. - - //So: step 1, if this is a Ginkgo panic - do nothing, Ginkgo's aware of the failure - eAsString, ok := e.(string) - if ok && strings.Contains(eAsString, "defer GinkgoRecover()") { - return - } - - //If we're here, we have to do step 2: assert that the error is nil. This assertion will - //allow us to fail the test suite (note: we can't call Fail since Gomega is not allowed to import Ginkgo). - //Since a failed assertion throws a panic, and we are likely in a goroutine, we need to defer within our defer! - defer func() { - recover() - }() - Ω(e).Should(BeNil(), "Handler Panicked") - }() - - if s.Writer != nil { - s.Writer.Write([]byte(fmt.Sprintf("GHTTP Received Request: %s - %s\n", req.Method, req.URL))) - } - - s.receivedRequests = append(s.receivedRequests, req) - if routedHandler, ok := s.handlerForRoute(req.Method, req.URL.Path); ok { - s.writeLock.Unlock() - routedHandler(w, req) - } else if s.calls < len(s.requestHandlers) { - h := s.requestHandlers[s.calls] - s.calls++ - s.writeLock.Unlock() - h(w, req) - } else { - s.writeLock.Unlock() - if s.AllowUnhandledRequests { - ioutil.ReadAll(req.Body) - req.Body.Close() - w.WriteHeader(s.UnhandledRequestStatusCode) - } else { - Ω(req).Should(BeNil(), "Received Unhandled Request") - } - } -} - -//ReceivedRequests is an array containing all requests received by the server (both handled and unhandled requests) -func (s *Server) ReceivedRequests() []*http.Request { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - return s.receivedRequests -} - -//RouteToHandler can be used to register handlers that will always handle requests that match -//the passed in method and path. -// -//The path may be either a string object or a *regexp.Regexp. -func (s *Server) RouteToHandler(method string, path interface{}, handler http.HandlerFunc) { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - rh := routedHandler{ - method: method, - handler: handler, - } - - switch p := path.(type) { - case *regexp.Regexp: - rh.pathRegexp = p - case string: - rh.path = p - default: - panic("path must be a string or a regular expression") - } - - for i, existingRH := range s.routedHandlers { - if existingRH.method == method && - reflect.DeepEqual(existingRH.pathRegexp, rh.pathRegexp) && - existingRH.path == rh.path { - s.routedHandlers[i] = rh - return - } - } - s.routedHandlers = append(s.routedHandlers, rh) -} - -func (s *Server) handlerForRoute(method string, path string) (http.HandlerFunc, bool) { - for _, rh := range s.routedHandlers { - if rh.method == method { - if rh.pathRegexp != nil { - if rh.pathRegexp.Match([]byte(path)) { - return rh.handler, true - } - } else if rh.path == path { - return rh.handler, true - } - } - } - - return nil, false -} - -//AppendHandlers will appends http.HandlerFuncs to the server's list of registered handlers. The first incoming request is handled by the first handler, the second by the second, etc... -func (s *Server) AppendHandlers(handlers ...http.HandlerFunc) { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - s.requestHandlers = append(s.requestHandlers, handlers...) -} - -//SetHandler overrides the registered handler at the passed in index with the passed in handler -//This is useful, for example, when a server has been set up in a shared context, but must be tweaked -//for a particular test. -func (s *Server) SetHandler(index int, handler http.HandlerFunc) { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - s.requestHandlers[index] = handler -} - -//GetHandler returns the handler registered at the passed in index. -func (s *Server) GetHandler(index int) http.HandlerFunc { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - return s.requestHandlers[index] -} - -func (s *Server) Reset() { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - s.HTTPTestServer.CloseClientConnections() - s.calls = 0 - s.receivedRequests = nil - s.requestHandlers = nil - s.routedHandlers = nil -} - -//WrapHandler combines the passed in handler with the handler registered at the passed in index. -//This is useful, for example, when a server has been set up in a shared context but must be tweaked -//for a particular test. -// -//If the currently registered handler is A, and the new passed in handler is B then -//WrapHandler will generate a new handler that first calls A, then calls B, and assign it to index -func (s *Server) WrapHandler(index int, handler http.HandlerFunc) { - existingHandler := s.GetHandler(index) - s.SetHandler(index, CombineHandlers(existingHandler, handler)) -} - -func (s *Server) CloseClientConnections() { - s.writeLock.Lock() - defer s.writeLock.Unlock() - - s.HTTPTestServer.CloseClientConnections() -} +/* +Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports +registering multiple handlers. Incoming requests are not routed between the different handlers +- rather it is merely the order of the handlers that matters. The first request is handled by the first +registered handler, the second request by the second handler, etc. + +The intent here is to have each handler *verify* that the incoming request is valid. To accomplish, ghttp +also provides a collection of bite-size handlers that each perform one aspect of request verification. These can +be composed together and registered with a ghttp server. The result is an expressive language for describing +the requests generated by the client under test. + +Here's a simple example, note that the server handler is only defined in one BeforeEach and then modified, as required, by the nested BeforeEaches. +A more comprehensive example is available at https://onsi.github.io/gomega/#_testing_http_clients + + var _ = Describe("A Sprockets Client", func() { + var server *ghttp.Server + var client *SprocketClient + BeforeEach(func() { + server = ghttp.NewServer() + client = NewSprocketClient(server.URL(), "skywalker", "tk427") + }) + + AfterEach(func() { + server.Close() + }) + + Describe("fetching sprockets", func() { + var statusCode int + var sprockets []Sprocket + BeforeEach(func() { + statusCode = http.StatusOK + sprockets = []Sprocket{} + server.AppendHandlers(ghttp.CombineHandlers( + ghttp.VerifyRequest("GET", "/sprockets"), + ghttp.VerifyBasicAuth("skywalker", "tk427"), + ghttp.RespondWithJSONEncodedPtr(&statusCode, &sprockets), + )) + }) + + Context("when requesting all sprockets", func() { + Context("when the response is succesful", func() { + BeforeEach(func() { + sprockets = []Sprocket{ + NewSprocket("Alfalfa"), + NewSprocket("Banana"), + } + }) + + It("should return the returned sprockets", func() { + Ω(client.Sprockets()).Should(Equal(sprockets)) + }) + }) + + Context("when the response is missing", func() { + BeforeEach(func() { + statusCode = http.StatusNotFound + }) + + It("should return an empty list of sprockets", func() { + Ω(client.Sprockets()).Should(BeEmpty()) + }) + }) + + Context("when the response fails to authenticate", func() { + BeforeEach(func() { + statusCode = http.StatusUnauthorized + }) + + It("should return an AuthenticationError error", func() { + sprockets, err := client.Sprockets() + Ω(sprockets).Should(BeEmpty()) + Ω(err).Should(MatchError(AuthenticationError)) + }) + }) + + Context("when the response is a server failure", func() { + BeforeEach(func() { + statusCode = http.StatusInternalServerError + }) + + It("should return an InternalError error", func() { + sprockets, err := client.Sprockets() + Ω(sprockets).Should(BeEmpty()) + Ω(err).Should(MatchError(InternalError)) + }) + }) + }) + + Context("when requesting some sprockets", func() { + BeforeEach(func() { + sprockets = []Sprocket{ + NewSprocket("Alfalfa"), + NewSprocket("Banana"), + } + + server.WrapHandler(0, ghttp.VerifyRequest("GET", "/sprockets", "filter=FOOD")) + }) + + It("should make the request with a filter", func() { + Ω(client.Sprockets("food")).Should(Equal(sprockets)) + }) + }) + }) + }) +*/ +package ghttp + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "reflect" + "regexp" + "strings" + "sync" + + . "github.com/onsi/gomega" +) + +func new() *Server { + return &Server{ + AllowUnhandledRequests: false, + UnhandledRequestStatusCode: http.StatusInternalServerError, + writeLock: &sync.Mutex{}, + } +} + +type routedHandler struct { + method string + pathRegexp *regexp.Regexp + path string + handler http.HandlerFunc +} + +// NewServer returns a new `*ghttp.Server` that wraps an `httptest` server. The server is started automatically. +func NewServer() *Server { + s := new() + s.HTTPTestServer = httptest.NewServer(s) + return s +} + +// NewUnstartedServer return a new, unstarted, `*ghttp.Server`. Useful for specifying a custom listener on `server.HTTPTestServer`. +func NewUnstartedServer() *Server { + s := new() + s.HTTPTestServer = httptest.NewUnstartedServer(s) + return s +} + +// NewTLSServer returns a new `*ghttp.Server` that wraps an `httptest` TLS server. The server is started automatically. +func NewTLSServer() *Server { + s := new() + s.HTTPTestServer = httptest.NewTLSServer(s) + return s +} + +type Server struct { + //The underlying httptest server + HTTPTestServer *httptest.Server + + //Defaults to false. If set to true, the Server will allow more requests than there are registered handlers. + AllowUnhandledRequests bool + + //The status code returned when receiving an unhandled request. + //Defaults to http.StatusInternalServerError. + //Only applies if AllowUnhandledRequests is true + UnhandledRequestStatusCode int + + //If provided, ghttp will log about each request received to the provided io.Writer + //Defaults to nil + //If you're using Ginkgo, set this to GinkgoWriter to get improved output during failures + Writer io.Writer + + receivedRequests []*http.Request + requestHandlers []http.HandlerFunc + routedHandlers []routedHandler + + writeLock *sync.Mutex + calls int +} + +//Start() starts an unstarted ghttp server. It is a catastrophic error to call Start more than once (thanks, httptest). +func (s *Server) Start() { + s.HTTPTestServer.Start() +} + +//URL() returns a url that will hit the server +func (s *Server) URL() string { + return s.HTTPTestServer.URL +} + +//Addr() returns the address on which the server is listening. +func (s *Server) Addr() string { + return s.HTTPTestServer.Listener.Addr().String() +} + +//Close() should be called at the end of each test. It spins down and cleans up the test server. +func (s *Server) Close() { + s.writeLock.Lock() + server := s.HTTPTestServer + s.HTTPTestServer = nil + s.writeLock.Unlock() + + if server != nil { + server.Close() + } +} + +//ServeHTTP() makes Server an http.Handler +//When the server receives a request it handles the request in the following order: +// +//1. If the request matches a handler registered with RouteToHandler, that handler is called. +//2. Otherwise, if there are handlers registered via AppendHandlers, those handlers are called in order. +//3. If all registered handlers have been called then: +// a) If AllowUnhandledRequests is true, the request will be handled with response code of UnhandledRequestStatusCode +// b) If AllowUnhandledRequests is false, the request will not be handled and the current test will be marked as failed. +func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) { + s.writeLock.Lock() + defer func() { + e := recover() + if e != nil { + w.WriteHeader(http.StatusInternalServerError) + } + + //If the handler panics GHTTP will silently succeed. This is bad™. + //To catch this case we need to fail the test if the handler has panicked. + //However, if the handler is panicking because Ginkgo's causing it to panic (i.e. an assertion failed) + //then we shouldn't double-report the error as this will confuse people. + + //So: step 1, if this is a Ginkgo panic - do nothing, Ginkgo's aware of the failure + eAsString, ok := e.(string) + if ok && strings.Contains(eAsString, "defer GinkgoRecover()") { + return + } + + //If we're here, we have to do step 2: assert that the error is nil. This assertion will + //allow us to fail the test suite (note: we can't call Fail since Gomega is not allowed to import Ginkgo). + //Since a failed assertion throws a panic, and we are likely in a goroutine, we need to defer within our defer! + defer func() { + recover() + }() + Ω(e).Should(BeNil(), "Handler Panicked") + }() + + if s.Writer != nil { + s.Writer.Write([]byte(fmt.Sprintf("GHTTP Received Request: %s - %s\n", req.Method, req.URL))) + } + + s.receivedRequests = append(s.receivedRequests, req) + if routedHandler, ok := s.handlerForRoute(req.Method, req.URL.Path); ok { + s.writeLock.Unlock() + routedHandler(w, req) + } else if s.calls < len(s.requestHandlers) { + h := s.requestHandlers[s.calls] + s.calls++ + s.writeLock.Unlock() + h(w, req) + } else { + s.writeLock.Unlock() + if s.AllowUnhandledRequests { + ioutil.ReadAll(req.Body) + req.Body.Close() + w.WriteHeader(s.UnhandledRequestStatusCode) + } else { + Ω(req).Should(BeNil(), "Received Unhandled Request") + } + } +} + +//ReceivedRequests is an array containing all requests received by the server (both handled and unhandled requests) +func (s *Server) ReceivedRequests() []*http.Request { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + return s.receivedRequests +} + +//RouteToHandler can be used to register handlers that will always handle requests that match +//the passed in method and path. +// +//The path may be either a string object or a *regexp.Regexp. +func (s *Server) RouteToHandler(method string, path interface{}, handler http.HandlerFunc) { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + rh := routedHandler{ + method: method, + handler: handler, + } + + switch p := path.(type) { + case *regexp.Regexp: + rh.pathRegexp = p + case string: + rh.path = p + default: + panic("path must be a string or a regular expression") + } + + for i, existingRH := range s.routedHandlers { + if existingRH.method == method && + reflect.DeepEqual(existingRH.pathRegexp, rh.pathRegexp) && + existingRH.path == rh.path { + s.routedHandlers[i] = rh + return + } + } + s.routedHandlers = append(s.routedHandlers, rh) +} + +func (s *Server) handlerForRoute(method string, path string) (http.HandlerFunc, bool) { + for _, rh := range s.routedHandlers { + if rh.method == method { + if rh.pathRegexp != nil { + if rh.pathRegexp.Match([]byte(path)) { + return rh.handler, true + } + } else if rh.path == path { + return rh.handler, true + } + } + } + + return nil, false +} + +//AppendHandlers will appends http.HandlerFuncs to the server's list of registered handlers. The first incoming request is handled by the first handler, the second by the second, etc... +func (s *Server) AppendHandlers(handlers ...http.HandlerFunc) { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + s.requestHandlers = append(s.requestHandlers, handlers...) +} + +//SetHandler overrides the registered handler at the passed in index with the passed in handler +//This is useful, for example, when a server has been set up in a shared context, but must be tweaked +//for a particular test. +func (s *Server) SetHandler(index int, handler http.HandlerFunc) { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + s.requestHandlers[index] = handler +} + +//GetHandler returns the handler registered at the passed in index. +func (s *Server) GetHandler(index int) http.HandlerFunc { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + return s.requestHandlers[index] +} + +func (s *Server) Reset() { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + s.HTTPTestServer.CloseClientConnections() + s.calls = 0 + s.receivedRequests = nil + s.requestHandlers = nil + s.routedHandlers = nil +} + +//WrapHandler combines the passed in handler with the handler registered at the passed in index. +//This is useful, for example, when a server has been set up in a shared context but must be tweaked +//for a particular test. +// +//If the currently registered handler is A, and the new passed in handler is B then +//WrapHandler will generate a new handler that first calls A, then calls B, and assign it to index +func (s *Server) WrapHandler(index int, handler http.HandlerFunc) { + existingHandler := s.GetHandler(index) + s.SetHandler(index, CombineHandlers(existingHandler, handler)) +} + +func (s *Server) CloseClientConnections() { + s.writeLock.Lock() + defer s.writeLock.Unlock() + + s.HTTPTestServer.CloseClientConnections() +} diff --git a/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go b/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go index a6541c04c1..7c12360827 100644 --- a/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go +++ b/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go @@ -1,13 +1,13 @@ -package ghttp_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "testing" -) - -func TestGHTTP(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "GHTTP Suite") -} +package ghttp_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestGHTTP(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "GHTTP Suite") +} diff --git a/vendor/github.com/onsi/gomega/ghttp/test_server_test.go b/vendor/github.com/onsi/gomega/ghttp/test_server_test.go index a7dc56f9d8..88b3246547 100644 --- a/vendor/github.com/onsi/gomega/ghttp/test_server_test.go +++ b/vendor/github.com/onsi/gomega/ghttp/test_server_test.go @@ -1,1089 +1,1089 @@ -package ghttp_test - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - "net/url" - "regexp" - - "github.com/golang/protobuf/proto" - "github.com/onsi/gomega/gbytes" - "github.com/onsi/gomega/ghttp/protobuf" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/ghttp" -) - -var _ = Describe("TestServer", func() { - var ( - resp *http.Response - err error - s *Server - ) - - BeforeEach(func() { - s = NewServer() - }) - - AfterEach(func() { - s.Close() - }) - - Describe("Resetting the server", func() { - BeforeEach(func() { - s.RouteToHandler("GET", "/", func(w http.ResponseWriter, req *http.Request) {}) - s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {}) - http.Get(s.URL() + "/") - - Ω(s.ReceivedRequests()).Should(HaveLen(1)) - }) - - It("clears all handlers and call counts", func() { - s.Reset() - Ω(s.ReceivedRequests()).Should(HaveLen(0)) - Ω(func() { s.GetHandler(0) }).Should(Panic()) - }) - }) - - Describe("closing client connections", func() { - It("closes", func() { - s.RouteToHandler("GET", "/", - func(w http.ResponseWriter, req *http.Request) { - io.WriteString(w, req.RemoteAddr) - }, - ) - client := http.Client{Transport: &http.Transport{DisableKeepAlives: true}} - resp, err := client.Get(s.URL()) - Ω(err).ShouldNot(HaveOccurred()) - Ω(resp.StatusCode).Should(Equal(200)) - - body, err := ioutil.ReadAll(resp.Body) - resp.Body.Close() - Ω(err).ShouldNot(HaveOccurred()) - - s.CloseClientConnections() - - resp, err = client.Get(s.URL()) - Ω(err).ShouldNot(HaveOccurred()) - Ω(resp.StatusCode).Should(Equal(200)) - - body2, err := ioutil.ReadAll(resp.Body) - resp.Body.Close() - Ω(err).ShouldNot(HaveOccurred()) - - Ω(body2).ShouldNot(Equal(body)) - }) - }) - - Describe("closing server mulitple times", func() { - It("should not fail", func() { - s.Close() - Ω(s.Close).ShouldNot(Panic()) - }) - }) - - Describe("allowing unhandled requests", func() { - Context("when true", func() { - BeforeEach(func() { - s.AllowUnhandledRequests = true - s.UnhandledRequestStatusCode = http.StatusForbidden - resp, err = http.Get(s.URL() + "/foo") - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should allow unhandled requests and respond with the passed in status code", func() { - Ω(err).ShouldNot(HaveOccurred()) - Ω(resp.StatusCode).Should(Equal(http.StatusForbidden)) - - data, err := ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(data).Should(BeEmpty()) - }) - - It("should record the requests", func() { - Ω(s.ReceivedRequests()).Should(HaveLen(1)) - Ω(s.ReceivedRequests()[0].URL.Path).Should(Equal("/foo")) - }) - }) - - Context("when false", func() { - It("should fail when attempting a request", func() { - failures := InterceptGomegaFailures(func() { - http.Get(s.URL() + "/foo") - }) - - Ω(failures[0]).Should(ContainSubstring("Received Unhandled Request")) - }) - }) - }) - - Describe("Managing Handlers", func() { - var called []string - BeforeEach(func() { - called = []string{} - s.RouteToHandler("GET", "/routed", func(w http.ResponseWriter, req *http.Request) { - called = append(called, "r1") - }) - s.RouteToHandler("POST", regexp.MustCompile(`/routed\d`), func(w http.ResponseWriter, req *http.Request) { - called = append(called, "r2") - }) - s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) { - called = append(called, "A") - }, func(w http.ResponseWriter, req *http.Request) { - called = append(called, "B") - }) - }) - - It("should prefer routed handlers if there is a match", func() { - http.Get(s.URL() + "/routed") - http.Post(s.URL()+"/routed7", "application/json", nil) - http.Get(s.URL() + "/foo") - http.Get(s.URL() + "/routed") - http.Post(s.URL()+"/routed9", "application/json", nil) - http.Get(s.URL() + "/bar") - - failures := InterceptGomegaFailures(func() { - http.Get(s.URL() + "/foo") - http.Get(s.URL() + "/routed/not/a/match") - http.Get(s.URL() + "/routed7") - http.Post(s.URL()+"/routed", "application/json", nil) - }) - - Ω(failures[0]).Should(ContainSubstring("Received Unhandled Request")) - Ω(failures).Should(HaveLen(4)) - - http.Post(s.URL()+"/routed3", "application/json", nil) - - Ω(called).Should(Equal([]string{"r1", "r2", "A", "r1", "r2", "B", "r2"})) - }) - - It("should override routed handlers when reregistered", func() { - s.RouteToHandler("GET", "/routed", func(w http.ResponseWriter, req *http.Request) { - called = append(called, "r3") - }) - s.RouteToHandler("POST", regexp.MustCompile(`/routed\d`), func(w http.ResponseWriter, req *http.Request) { - called = append(called, "r4") - }) - - http.Get(s.URL() + "/routed") - http.Post(s.URL()+"/routed7", "application/json", nil) - - Ω(called).Should(Equal([]string{"r3", "r4"})) - }) - - It("should call the appended handlers, in order, as requests come in", func() { - http.Get(s.URL() + "/foo") - Ω(called).Should(Equal([]string{"A"})) - - http.Get(s.URL() + "/foo") - Ω(called).Should(Equal([]string{"A", "B"})) - - failures := InterceptGomegaFailures(func() { - http.Get(s.URL() + "/foo") - }) - - Ω(failures[0]).Should(ContainSubstring("Received Unhandled Request")) - }) - - Describe("Overwriting an existing handler", func() { - BeforeEach(func() { - s.SetHandler(0, func(w http.ResponseWriter, req *http.Request) { - called = append(called, "C") - }) - }) - - It("should override the specified handler", func() { - http.Get(s.URL() + "/foo") - http.Get(s.URL() + "/foo") - Ω(called).Should(Equal([]string{"C", "B"})) - }) - }) - - Describe("Getting an existing handler", func() { - It("should return the handler func", func() { - s.GetHandler(1)(nil, nil) - Ω(called).Should(Equal([]string{"B"})) - }) - }) - - Describe("Wrapping an existing handler", func() { - BeforeEach(func() { - s.WrapHandler(0, func(w http.ResponseWriter, req *http.Request) { - called = append(called, "C") - }) - }) - - It("should wrap the existing handler in a new handler", func() { - http.Get(s.URL() + "/foo") - http.Get(s.URL() + "/foo") - Ω(called).Should(Equal([]string{"A", "C", "B"})) - }) - }) - }) - - Describe("When a handler fails", func() { - BeforeEach(func() { - s.UnhandledRequestStatusCode = http.StatusForbidden //just to be clear that 500s aren't coming from unhandled requests - }) - - Context("because the handler has panicked", func() { - BeforeEach(func() { - s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) { - panic("bam") - }) - }) - - It("should respond with a 500 and make a failing assertion", func() { - var resp *http.Response - var err error - - failures := InterceptGomegaFailures(func() { - resp, err = http.Get(s.URL()) - }) - - Ω(err).ShouldNot(HaveOccurred()) - Ω(resp.StatusCode).Should(Equal(http.StatusInternalServerError)) - Ω(failures).Should(ConsistOf(ContainSubstring("Handler Panicked"))) - }) - }) - - Context("because an assertion has failed", func() { - BeforeEach(func() { - s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) { - // Ω(true).Should(BeFalse()) <-- would be nice to do it this way, but the test just can't be written this way - - By("We're cheating a bit here -- we're throwing a GINKGO_PANIC which simulates a failed assertion") - panic(GINKGO_PANIC) - }) - }) - - It("should respond with a 500 and *not* make a failing assertion, instead relying on Ginkgo to have already been notified of the error", func() { - resp, err := http.Get(s.URL()) - - Ω(err).ShouldNot(HaveOccurred()) - Ω(resp.StatusCode).Should(Equal(http.StatusInternalServerError)) - }) - }) - }) - - Describe("Logging to the Writer", func() { - var buf *gbytes.Buffer - BeforeEach(func() { - buf = gbytes.NewBuffer() - s.Writer = buf - s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {}) - s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {}) - }) - - It("should write to the buffer when a request comes in", func() { - http.Get(s.URL() + "/foo") - Ω(buf).Should(gbytes.Say("GHTTP Received Request: GET - /foo\n")) - - http.Post(s.URL()+"/bar", "", nil) - Ω(buf).Should(gbytes.Say("GHTTP Received Request: POST - /bar\n")) - }) - }) - - Describe("Request Handlers", func() { - Describe("VerifyRequest", func() { - BeforeEach(func() { - s.AppendHandlers(VerifyRequest("GET", "/foo")) - }) - - It("should verify the method, path", func() { - resp, err = http.Get(s.URL() + "/foo?baz=bar") - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the method, path", func() { - failures := InterceptGomegaFailures(func() { - http.Get(s.URL() + "/foo2") - }) - Ω(failures).Should(HaveLen(1)) - }) - - It("should verify the method, path", func() { - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/foo", "application/json", nil) - }) - Ω(failures).Should(HaveLen(1)) - }) - - Context("when passed a rawQuery", func() { - It("should also be possible to verify the rawQuery", func() { - s.SetHandler(0, VerifyRequest("GET", "/foo", "baz=bar")) - resp, err = http.Get(s.URL() + "/foo?baz=bar") - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should match irregardless of query parameter ordering", func() { - s.SetHandler(0, VerifyRequest("GET", "/foo", "type=get&name=money")) - u, _ := url.Parse(s.URL() + "/foo") - u.RawQuery = url.Values{ - "type": []string{"get"}, - "name": []string{"money"}, - }.Encode() - - resp, err = http.Get(u.String()) - Ω(err).ShouldNot(HaveOccurred()) - }) - }) - - Context("when passed a matcher for path", func() { - It("should apply the matcher", func() { - s.SetHandler(0, VerifyRequest("GET", MatchRegexp(`/foo/[a-f]*/3`))) - resp, err = http.Get(s.URL() + "/foo/abcdefa/3") - Ω(err).ShouldNot(HaveOccurred()) - }) - }) - }) - - Describe("VerifyContentType", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("GET", "/foo"), - VerifyContentType("application/octet-stream"), - )) - }) - - It("should verify the content type", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.Header.Set("Content-Type", "application/octet-stream") - - resp, err = http.DefaultClient.Do(req) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the content type", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.Header.Set("Content-Type", "application/json") - - failures := InterceptGomegaFailures(func() { - http.DefaultClient.Do(req) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("Verify BasicAuth", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("GET", "/foo"), - VerifyBasicAuth("bob", "password"), - )) - }) - - It("should verify basic auth", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.SetBasicAuth("bob", "password") - - resp, err = http.DefaultClient.Do(req) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify basic auth", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.SetBasicAuth("bob", "bassword") - - failures := InterceptGomegaFailures(func() { - http.DefaultClient.Do(req) - }) - Ω(failures).Should(HaveLen(1)) - }) - - It("should require basic auth header", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - - failures := InterceptGomegaFailures(func() { - http.DefaultClient.Do(req) - }) - Ω(failures).Should(ContainElement(ContainSubstring("Authorization header must be specified"))) - }) - }) - - Describe("VerifyHeader", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("GET", "/foo"), - VerifyHeader(http.Header{ - "accept": []string{"jpeg", "png"}, - "cache-control": []string{"omicron"}, - "Return-Path": []string{"hobbiton"}, - }), - )) - }) - - It("should verify the headers", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.Header.Add("Accept", "jpeg") - req.Header.Add("Accept", "png") - req.Header.Add("Cache-Control", "omicron") - req.Header.Add("return-path", "hobbiton") - - resp, err = http.DefaultClient.Do(req) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the headers", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.Header.Add("Schmaccept", "jpeg") - req.Header.Add("Schmaccept", "png") - req.Header.Add("Cache-Control", "omicron") - req.Header.Add("return-path", "hobbiton") - - failures := InterceptGomegaFailures(func() { - http.DefaultClient.Do(req) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("VerifyHeaderKV", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("GET", "/foo"), - VerifyHeaderKV("accept", "jpeg", "png"), - VerifyHeaderKV("cache-control", "omicron"), - VerifyHeaderKV("Return-Path", "hobbiton"), - )) - }) - - It("should verify the headers", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.Header.Add("Accept", "jpeg") - req.Header.Add("Accept", "png") - req.Header.Add("Cache-Control", "omicron") - req.Header.Add("return-path", "hobbiton") - - resp, err = http.DefaultClient.Do(req) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the headers", func() { - req, err := http.NewRequest("GET", s.URL()+"/foo", nil) - Ω(err).ShouldNot(HaveOccurred()) - req.Header.Add("Accept", "jpeg") - req.Header.Add("Cache-Control", "omicron") - req.Header.Add("return-path", "hobbiton") - - failures := InterceptGomegaFailures(func() { - http.DefaultClient.Do(req) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("VerifyBody", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - VerifyBody([]byte("some body")), - )) - }) - - It("should verify the body", func() { - resp, err = http.Post(s.URL()+"/foo", "", bytes.NewReader([]byte("some body"))) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the body", func() { - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/foo", "", bytes.NewReader([]byte("wrong body"))) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("VerifyJSON", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - VerifyJSON(`{"a":3, "b":2}`), - )) - }) - - It("should verify the json body and the content type", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`{"b":2, "a":3}`))) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the json body and the content type", func() { - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`{"b":2, "a":4}`))) - }) - Ω(failures).Should(HaveLen(1)) - }) - - It("should verify the json body and the content type", func() { - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/foo", "application/not-json", bytes.NewReader([]byte(`{"b":2, "a":3}`))) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("VerifyJSONRepresenting", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - VerifyJSONRepresenting([]int{1, 3, 5}), - )) - }) - - It("should verify the json body and the content type", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`[1,3,5]`))) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the json body and the content type", func() { - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`[1,3]`))) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("VerifyForm", func() { - var formValues url.Values - - BeforeEach(func() { - formValues = make(url.Values) - formValues.Add("users", "user1") - formValues.Add("users", "user2") - formValues.Add("group", "users") - }) - - Context("when encoded in the URL", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("GET", "/foo"), - VerifyForm(url.Values{ - "users": []string{"user1", "user2"}, - "group": []string{"users"}, - }), - )) - }) - - It("should verify form values", func() { - resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should ignore extra values", func() { - formValues.Add("extra", "value") - resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("fail on missing values", func() { - formValues.Del("group") - failures := InterceptGomegaFailures(func() { - resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) - }) - Ω(failures).Should(HaveLen(1)) - }) - - It("fail on incorrect values", func() { - formValues.Set("group", "wheel") - failures := InterceptGomegaFailures(func() { - resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Context("when present in the body", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - VerifyForm(url.Values{ - "users": []string{"user1", "user2"}, - "group": []string{"users"}, - }), - )) - }) - - It("should verify form values", func() { - resp, err = http.PostForm(s.URL()+"/foo", formValues) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should ignore extra values", func() { - formValues.Add("extra", "value") - resp, err = http.PostForm(s.URL()+"/foo", formValues) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("fail on missing values", func() { - formValues.Del("group") - failures := InterceptGomegaFailures(func() { - resp, err = http.PostForm(s.URL()+"/foo", formValues) - }) - Ω(failures).Should(HaveLen(1)) - }) - - It("fail on incorrect values", func() { - formValues.Set("group", "wheel") - failures := InterceptGomegaFailures(func() { - resp, err = http.PostForm(s.URL()+"/foo", formValues) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - }) - - Describe("VerifyFormKV", func() { - Context("when encoded in the URL", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("GET", "/foo"), - VerifyFormKV("users", "user1", "user2"), - )) - }) - - It("verifies the form value", func() { - resp, err = http.Get(s.URL() + "/foo?users=user1&users=user2") - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("verifies the form value", func() { - failures := InterceptGomegaFailures(func() { - resp, err = http.Get(s.URL() + "/foo?users=user1") - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Context("when present in the body", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - VerifyFormKV("users", "user1", "user2"), - )) - }) - - It("verifies the form value", func() { - resp, err = http.PostForm(s.URL()+"/foo", url.Values{"users": []string{"user1", "user2"}}) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("verifies the form value", func() { - failures := InterceptGomegaFailures(func() { - resp, err = http.PostForm(s.URL()+"/foo", url.Values{"users": []string{"user1"}}) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - }) - - Describe("VerifyProtoRepresenting", func() { - var message *protobuf.SimpleMessage - - BeforeEach(func() { - message = new(protobuf.SimpleMessage) - message.Description = proto.String("A description") - message.Id = proto.Int32(0) - - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/proto"), - VerifyProtoRepresenting(message), - )) - }) - - It("verifies the proto body and the content type", func() { - serialized, err := proto.Marshal(message) - Ω(err).ShouldNot(HaveOccurred()) - - resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", bytes.NewReader(serialized)) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should verify the proto body and the content type", func() { - serialized, err := proto.Marshal(&protobuf.SimpleMessage{ - Description: proto.String("A description"), - Id: proto.Int32(0), - Metadata: proto.String("some metadata"), - }) - Ω(err).ShouldNot(HaveOccurred()) - - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/proto", "application/x-protobuf", bytes.NewReader(serialized)) - }) - Ω(failures).Should(HaveLen(1)) - }) - - It("should verify the proto body and the content type", func() { - serialized, err := proto.Marshal(message) - Ω(err).ShouldNot(HaveOccurred()) - - failures := InterceptGomegaFailures(func() { - http.Post(s.URL()+"/proto", "application/not-x-protobuf", bytes.NewReader(serialized)) - }) - Ω(failures).Should(HaveLen(1)) - }) - }) - - Describe("RespondWith", func() { - Context("without headers", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWith(http.StatusCreated, "sweet"), - ), CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWith(http.StatusOK, []byte("sour")), - )) - }) - - It("should return the response", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - - body, err := ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(Equal([]byte("sweet"))) - - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusOK)) - - body, err = ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(Equal([]byte("sour"))) - }) - }) - - Context("with headers", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWith(http.StatusCreated, "sweet", http.Header{"X-Custom-Header": []string{"my header"}}), - )) - }) - - It("should return the headers too", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - Ω(ioutil.ReadAll(resp.Body)).Should(Equal([]byte("sweet"))) - Ω(resp.Header.Get("X-Custom-Header")).Should(Equal("my header")) - }) - }) - }) - - Describe("RespondWithPtr", func() { - var code int - var byteBody []byte - var stringBody string - BeforeEach(func() { - code = http.StatusOK - byteBody = []byte("sweet") - stringBody = "sour" - - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithPtr(&code, &byteBody), - ), CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithPtr(&code, &stringBody), - )) - }) - - It("should return the response", func() { - code = http.StatusCreated - byteBody = []byte("tasty") - stringBody = "treat" - - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - - body, err := ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(Equal([]byte("tasty"))) - - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - - body, err = ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(Equal([]byte("treat"))) - }) - - Context("when passed a nil body", func() { - BeforeEach(func() { - s.SetHandler(0, CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithPtr(&code, nil), - )) - }) - - It("should return an empty body and not explode", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - - Ω(err).ShouldNot(HaveOccurred()) - Ω(resp.StatusCode).Should(Equal(http.StatusOK)) - body, err := ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(BeEmpty()) - - Ω(s.ReceivedRequests()).Should(HaveLen(1)) - }) - }) - }) - - Describe("RespondWithJSON", func() { - Context("when no optional headers are set", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithJSONEncoded(http.StatusCreated, []int{1, 2, 3}), - )) - }) - - It("should return the response", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - - body, err := ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(MatchJSON("[1,2,3]")) - }) - - It("should set the Content-Type header to application/json", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) - }) - }) - - Context("when optional headers are set", func() { - var headers http.Header - BeforeEach(func() { - headers = http.Header{"Stuff": []string{"things"}} - }) - - JustBeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithJSONEncoded(http.StatusCreated, []int{1, 2, 3}, headers), - )) - }) - - It("should preserve those headers", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Stuff"]).Should(Equal([]string{"things"})) - }) - - It("should set the Content-Type header to application/json", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) - }) - - Context("when setting the Content-Type explicitly", func() { - BeforeEach(func() { - headers["Content-Type"] = []string{"not-json"} - }) - - It("should use the Content-Type header that was explicitly set", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"not-json"})) - }) - }) - }) - }) - - Describe("RespondWithJSONPtr", func() { - type testObject struct { - Key string - Value string - } - - var code int - var object testObject - - Context("when no optional headers are set", func() { - BeforeEach(func() { - code = http.StatusOK - object = testObject{} - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithJSONEncodedPtr(&code, &object), - )) - }) - - It("should return the response", func() { - code = http.StatusCreated - object = testObject{ - Key: "Jim", - Value: "Codes", - } - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - - body, err := ioutil.ReadAll(resp.Body) - Ω(err).ShouldNot(HaveOccurred()) - Ω(body).Should(MatchJSON(`{"Key": "Jim", "Value": "Codes"}`)) - }) - - It("should set the Content-Type header to application/json", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) - }) - }) - - Context("when optional headers are set", func() { - var headers http.Header - BeforeEach(func() { - headers = http.Header{"Stuff": []string{"things"}} - }) - - JustBeforeEach(func() { - code = http.StatusOK - object = testObject{} - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/foo"), - RespondWithJSONEncodedPtr(&code, &object, headers), - )) - }) - - It("should preserve those headers", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Stuff"]).Should(Equal([]string{"things"})) - }) - - It("should set the Content-Type header to application/json", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) - }) - - Context("when setting the Content-Type explicitly", func() { - BeforeEach(func() { - headers["Content-Type"] = []string{"not-json"} - }) - - It("should use the Content-Type header that was explicitly set", func() { - resp, err = http.Post(s.URL()+"/foo", "application/json", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"not-json"})) - }) - }) - }) - }) - - Describe("RespondWithProto", func() { - var message *protobuf.SimpleMessage - - BeforeEach(func() { - message = new(protobuf.SimpleMessage) - message.Description = proto.String("A description") - message.Id = proto.Int32(99) - }) - - Context("when no optional headers are set", func() { - BeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/proto"), - RespondWithProto(http.StatusCreated, message), - )) - }) - - It("should return the response", func() { - resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) - - var received protobuf.SimpleMessage - body, err := ioutil.ReadAll(resp.Body) - err = proto.Unmarshal(body, &received) - Ω(err).ShouldNot(HaveOccurred()) - }) - - It("should set the Content-Type header to application/x-protobuf", func() { - resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/x-protobuf"})) - }) - }) - - Context("when optional headers are set", func() { - var headers http.Header - BeforeEach(func() { - headers = http.Header{"Stuff": []string{"things"}} - }) - - JustBeforeEach(func() { - s.AppendHandlers(CombineHandlers( - VerifyRequest("POST", "/proto"), - RespondWithProto(http.StatusCreated, message, headers), - )) - }) - - It("should preserve those headers", func() { - resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Stuff"]).Should(Equal([]string{"things"})) - }) - - It("should set the Content-Type header to application/x-protobuf", func() { - resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/x-protobuf"})) - }) - - Context("when setting the Content-Type explicitly", func() { - BeforeEach(func() { - headers["Content-Type"] = []string{"not-x-protobuf"} - }) - - It("should use the Content-Type header that was explicitly set", func() { - resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) - Ω(err).ShouldNot(HaveOccurred()) - - Ω(resp.Header["Content-Type"]).Should(Equal([]string{"not-x-protobuf"})) - }) - }) - }) - }) - }) -}) +package ghttp_test + +import ( + "bytes" + "io" + "io/ioutil" + "net/http" + "net/url" + "regexp" + + "github.com/golang/protobuf/proto" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/ghttp/protobuf" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/ghttp" +) + +var _ = Describe("TestServer", func() { + var ( + resp *http.Response + err error + s *Server + ) + + BeforeEach(func() { + s = NewServer() + }) + + AfterEach(func() { + s.Close() + }) + + Describe("Resetting the server", func() { + BeforeEach(func() { + s.RouteToHandler("GET", "/", func(w http.ResponseWriter, req *http.Request) {}) + s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {}) + http.Get(s.URL() + "/") + + Ω(s.ReceivedRequests()).Should(HaveLen(1)) + }) + + It("clears all handlers and call counts", func() { + s.Reset() + Ω(s.ReceivedRequests()).Should(HaveLen(0)) + Ω(func() { s.GetHandler(0) }).Should(Panic()) + }) + }) + + Describe("closing client connections", func() { + It("closes", func() { + s.RouteToHandler("GET", "/", + func(w http.ResponseWriter, req *http.Request) { + io.WriteString(w, req.RemoteAddr) + }, + ) + client := http.Client{Transport: &http.Transport{DisableKeepAlives: true}} + resp, err := client.Get(s.URL()) + Ω(err).ShouldNot(HaveOccurred()) + Ω(resp.StatusCode).Should(Equal(200)) + + body, err := ioutil.ReadAll(resp.Body) + resp.Body.Close() + Ω(err).ShouldNot(HaveOccurred()) + + s.CloseClientConnections() + + resp, err = client.Get(s.URL()) + Ω(err).ShouldNot(HaveOccurred()) + Ω(resp.StatusCode).Should(Equal(200)) + + body2, err := ioutil.ReadAll(resp.Body) + resp.Body.Close() + Ω(err).ShouldNot(HaveOccurred()) + + Ω(body2).ShouldNot(Equal(body)) + }) + }) + + Describe("closing server mulitple times", func() { + It("should not fail", func() { + s.Close() + Ω(s.Close).ShouldNot(Panic()) + }) + }) + + Describe("allowing unhandled requests", func() { + Context("when true", func() { + BeforeEach(func() { + s.AllowUnhandledRequests = true + s.UnhandledRequestStatusCode = http.StatusForbidden + resp, err = http.Get(s.URL() + "/foo") + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should allow unhandled requests and respond with the passed in status code", func() { + Ω(err).ShouldNot(HaveOccurred()) + Ω(resp.StatusCode).Should(Equal(http.StatusForbidden)) + + data, err := ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(data).Should(BeEmpty()) + }) + + It("should record the requests", func() { + Ω(s.ReceivedRequests()).Should(HaveLen(1)) + Ω(s.ReceivedRequests()[0].URL.Path).Should(Equal("/foo")) + }) + }) + + Context("when false", func() { + It("should fail when attempting a request", func() { + failures := InterceptGomegaFailures(func() { + http.Get(s.URL() + "/foo") + }) + + Ω(failures[0]).Should(ContainSubstring("Received Unhandled Request")) + }) + }) + }) + + Describe("Managing Handlers", func() { + var called []string + BeforeEach(func() { + called = []string{} + s.RouteToHandler("GET", "/routed", func(w http.ResponseWriter, req *http.Request) { + called = append(called, "r1") + }) + s.RouteToHandler("POST", regexp.MustCompile(`/routed\d`), func(w http.ResponseWriter, req *http.Request) { + called = append(called, "r2") + }) + s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) { + called = append(called, "A") + }, func(w http.ResponseWriter, req *http.Request) { + called = append(called, "B") + }) + }) + + It("should prefer routed handlers if there is a match", func() { + http.Get(s.URL() + "/routed") + http.Post(s.URL()+"/routed7", "application/json", nil) + http.Get(s.URL() + "/foo") + http.Get(s.URL() + "/routed") + http.Post(s.URL()+"/routed9", "application/json", nil) + http.Get(s.URL() + "/bar") + + failures := InterceptGomegaFailures(func() { + http.Get(s.URL() + "/foo") + http.Get(s.URL() + "/routed/not/a/match") + http.Get(s.URL() + "/routed7") + http.Post(s.URL()+"/routed", "application/json", nil) + }) + + Ω(failures[0]).Should(ContainSubstring("Received Unhandled Request")) + Ω(failures).Should(HaveLen(4)) + + http.Post(s.URL()+"/routed3", "application/json", nil) + + Ω(called).Should(Equal([]string{"r1", "r2", "A", "r1", "r2", "B", "r2"})) + }) + + It("should override routed handlers when reregistered", func() { + s.RouteToHandler("GET", "/routed", func(w http.ResponseWriter, req *http.Request) { + called = append(called, "r3") + }) + s.RouteToHandler("POST", regexp.MustCompile(`/routed\d`), func(w http.ResponseWriter, req *http.Request) { + called = append(called, "r4") + }) + + http.Get(s.URL() + "/routed") + http.Post(s.URL()+"/routed7", "application/json", nil) + + Ω(called).Should(Equal([]string{"r3", "r4"})) + }) + + It("should call the appended handlers, in order, as requests come in", func() { + http.Get(s.URL() + "/foo") + Ω(called).Should(Equal([]string{"A"})) + + http.Get(s.URL() + "/foo") + Ω(called).Should(Equal([]string{"A", "B"})) + + failures := InterceptGomegaFailures(func() { + http.Get(s.URL() + "/foo") + }) + + Ω(failures[0]).Should(ContainSubstring("Received Unhandled Request")) + }) + + Describe("Overwriting an existing handler", func() { + BeforeEach(func() { + s.SetHandler(0, func(w http.ResponseWriter, req *http.Request) { + called = append(called, "C") + }) + }) + + It("should override the specified handler", func() { + http.Get(s.URL() + "/foo") + http.Get(s.URL() + "/foo") + Ω(called).Should(Equal([]string{"C", "B"})) + }) + }) + + Describe("Getting an existing handler", func() { + It("should return the handler func", func() { + s.GetHandler(1)(nil, nil) + Ω(called).Should(Equal([]string{"B"})) + }) + }) + + Describe("Wrapping an existing handler", func() { + BeforeEach(func() { + s.WrapHandler(0, func(w http.ResponseWriter, req *http.Request) { + called = append(called, "C") + }) + }) + + It("should wrap the existing handler in a new handler", func() { + http.Get(s.URL() + "/foo") + http.Get(s.URL() + "/foo") + Ω(called).Should(Equal([]string{"A", "C", "B"})) + }) + }) + }) + + Describe("When a handler fails", func() { + BeforeEach(func() { + s.UnhandledRequestStatusCode = http.StatusForbidden //just to be clear that 500s aren't coming from unhandled requests + }) + + Context("because the handler has panicked", func() { + BeforeEach(func() { + s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) { + panic("bam") + }) + }) + + It("should respond with a 500 and make a failing assertion", func() { + var resp *http.Response + var err error + + failures := InterceptGomegaFailures(func() { + resp, err = http.Get(s.URL()) + }) + + Ω(err).ShouldNot(HaveOccurred()) + Ω(resp.StatusCode).Should(Equal(http.StatusInternalServerError)) + Ω(failures).Should(ConsistOf(ContainSubstring("Handler Panicked"))) + }) + }) + + Context("because an assertion has failed", func() { + BeforeEach(func() { + s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) { + // Ω(true).Should(BeFalse()) <-- would be nice to do it this way, but the test just can't be written this way + + By("We're cheating a bit here -- we're throwing a GINKGO_PANIC which simulates a failed assertion") + panic(GINKGO_PANIC) + }) + }) + + It("should respond with a 500 and *not* make a failing assertion, instead relying on Ginkgo to have already been notified of the error", func() { + resp, err := http.Get(s.URL()) + + Ω(err).ShouldNot(HaveOccurred()) + Ω(resp.StatusCode).Should(Equal(http.StatusInternalServerError)) + }) + }) + }) + + Describe("Logging to the Writer", func() { + var buf *gbytes.Buffer + BeforeEach(func() { + buf = gbytes.NewBuffer() + s.Writer = buf + s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {}) + s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {}) + }) + + It("should write to the buffer when a request comes in", func() { + http.Get(s.URL() + "/foo") + Ω(buf).Should(gbytes.Say("GHTTP Received Request: GET - /foo\n")) + + http.Post(s.URL()+"/bar", "", nil) + Ω(buf).Should(gbytes.Say("GHTTP Received Request: POST - /bar\n")) + }) + }) + + Describe("Request Handlers", func() { + Describe("VerifyRequest", func() { + BeforeEach(func() { + s.AppendHandlers(VerifyRequest("GET", "/foo")) + }) + + It("should verify the method, path", func() { + resp, err = http.Get(s.URL() + "/foo?baz=bar") + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the method, path", func() { + failures := InterceptGomegaFailures(func() { + http.Get(s.URL() + "/foo2") + }) + Ω(failures).Should(HaveLen(1)) + }) + + It("should verify the method, path", func() { + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/foo", "application/json", nil) + }) + Ω(failures).Should(HaveLen(1)) + }) + + Context("when passed a rawQuery", func() { + It("should also be possible to verify the rawQuery", func() { + s.SetHandler(0, VerifyRequest("GET", "/foo", "baz=bar")) + resp, err = http.Get(s.URL() + "/foo?baz=bar") + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should match irregardless of query parameter ordering", func() { + s.SetHandler(0, VerifyRequest("GET", "/foo", "type=get&name=money")) + u, _ := url.Parse(s.URL() + "/foo") + u.RawQuery = url.Values{ + "type": []string{"get"}, + "name": []string{"money"}, + }.Encode() + + resp, err = http.Get(u.String()) + Ω(err).ShouldNot(HaveOccurred()) + }) + }) + + Context("when passed a matcher for path", func() { + It("should apply the matcher", func() { + s.SetHandler(0, VerifyRequest("GET", MatchRegexp(`/foo/[a-f]*/3`))) + resp, err = http.Get(s.URL() + "/foo/abcdefa/3") + Ω(err).ShouldNot(HaveOccurred()) + }) + }) + }) + + Describe("VerifyContentType", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("GET", "/foo"), + VerifyContentType("application/octet-stream"), + )) + }) + + It("should verify the content type", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.Header.Set("Content-Type", "application/octet-stream") + + resp, err = http.DefaultClient.Do(req) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the content type", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.Header.Set("Content-Type", "application/json") + + failures := InterceptGomegaFailures(func() { + http.DefaultClient.Do(req) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("Verify BasicAuth", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("GET", "/foo"), + VerifyBasicAuth("bob", "password"), + )) + }) + + It("should verify basic auth", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.SetBasicAuth("bob", "password") + + resp, err = http.DefaultClient.Do(req) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify basic auth", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.SetBasicAuth("bob", "bassword") + + failures := InterceptGomegaFailures(func() { + http.DefaultClient.Do(req) + }) + Ω(failures).Should(HaveLen(1)) + }) + + It("should require basic auth header", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + + failures := InterceptGomegaFailures(func() { + http.DefaultClient.Do(req) + }) + Ω(failures).Should(ContainElement(ContainSubstring("Authorization header must be specified"))) + }) + }) + + Describe("VerifyHeader", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("GET", "/foo"), + VerifyHeader(http.Header{ + "accept": []string{"jpeg", "png"}, + "cache-control": []string{"omicron"}, + "Return-Path": []string{"hobbiton"}, + }), + )) + }) + + It("should verify the headers", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.Header.Add("Accept", "jpeg") + req.Header.Add("Accept", "png") + req.Header.Add("Cache-Control", "omicron") + req.Header.Add("return-path", "hobbiton") + + resp, err = http.DefaultClient.Do(req) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the headers", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.Header.Add("Schmaccept", "jpeg") + req.Header.Add("Schmaccept", "png") + req.Header.Add("Cache-Control", "omicron") + req.Header.Add("return-path", "hobbiton") + + failures := InterceptGomegaFailures(func() { + http.DefaultClient.Do(req) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("VerifyHeaderKV", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("GET", "/foo"), + VerifyHeaderKV("accept", "jpeg", "png"), + VerifyHeaderKV("cache-control", "omicron"), + VerifyHeaderKV("Return-Path", "hobbiton"), + )) + }) + + It("should verify the headers", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.Header.Add("Accept", "jpeg") + req.Header.Add("Accept", "png") + req.Header.Add("Cache-Control", "omicron") + req.Header.Add("return-path", "hobbiton") + + resp, err = http.DefaultClient.Do(req) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the headers", func() { + req, err := http.NewRequest("GET", s.URL()+"/foo", nil) + Ω(err).ShouldNot(HaveOccurred()) + req.Header.Add("Accept", "jpeg") + req.Header.Add("Cache-Control", "omicron") + req.Header.Add("return-path", "hobbiton") + + failures := InterceptGomegaFailures(func() { + http.DefaultClient.Do(req) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("VerifyBody", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + VerifyBody([]byte("some body")), + )) + }) + + It("should verify the body", func() { + resp, err = http.Post(s.URL()+"/foo", "", bytes.NewReader([]byte("some body"))) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the body", func() { + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/foo", "", bytes.NewReader([]byte("wrong body"))) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("VerifyJSON", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + VerifyJSON(`{"a":3, "b":2}`), + )) + }) + + It("should verify the json body and the content type", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`{"b":2, "a":3}`))) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the json body and the content type", func() { + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`{"b":2, "a":4}`))) + }) + Ω(failures).Should(HaveLen(1)) + }) + + It("should verify the json body and the content type", func() { + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/foo", "application/not-json", bytes.NewReader([]byte(`{"b":2, "a":3}`))) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("VerifyJSONRepresenting", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + VerifyJSONRepresenting([]int{1, 3, 5}), + )) + }) + + It("should verify the json body and the content type", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`[1,3,5]`))) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the json body and the content type", func() { + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`[1,3]`))) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("VerifyForm", func() { + var formValues url.Values + + BeforeEach(func() { + formValues = make(url.Values) + formValues.Add("users", "user1") + formValues.Add("users", "user2") + formValues.Add("group", "users") + }) + + Context("when encoded in the URL", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("GET", "/foo"), + VerifyForm(url.Values{ + "users": []string{"user1", "user2"}, + "group": []string{"users"}, + }), + )) + }) + + It("should verify form values", func() { + resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should ignore extra values", func() { + formValues.Add("extra", "value") + resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("fail on missing values", func() { + formValues.Del("group") + failures := InterceptGomegaFailures(func() { + resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) + }) + Ω(failures).Should(HaveLen(1)) + }) + + It("fail on incorrect values", func() { + formValues.Set("group", "wheel") + failures := InterceptGomegaFailures(func() { + resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode()) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Context("when present in the body", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + VerifyForm(url.Values{ + "users": []string{"user1", "user2"}, + "group": []string{"users"}, + }), + )) + }) + + It("should verify form values", func() { + resp, err = http.PostForm(s.URL()+"/foo", formValues) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should ignore extra values", func() { + formValues.Add("extra", "value") + resp, err = http.PostForm(s.URL()+"/foo", formValues) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("fail on missing values", func() { + formValues.Del("group") + failures := InterceptGomegaFailures(func() { + resp, err = http.PostForm(s.URL()+"/foo", formValues) + }) + Ω(failures).Should(HaveLen(1)) + }) + + It("fail on incorrect values", func() { + formValues.Set("group", "wheel") + failures := InterceptGomegaFailures(func() { + resp, err = http.PostForm(s.URL()+"/foo", formValues) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + }) + + Describe("VerifyFormKV", func() { + Context("when encoded in the URL", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("GET", "/foo"), + VerifyFormKV("users", "user1", "user2"), + )) + }) + + It("verifies the form value", func() { + resp, err = http.Get(s.URL() + "/foo?users=user1&users=user2") + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("verifies the form value", func() { + failures := InterceptGomegaFailures(func() { + resp, err = http.Get(s.URL() + "/foo?users=user1") + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Context("when present in the body", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + VerifyFormKV("users", "user1", "user2"), + )) + }) + + It("verifies the form value", func() { + resp, err = http.PostForm(s.URL()+"/foo", url.Values{"users": []string{"user1", "user2"}}) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("verifies the form value", func() { + failures := InterceptGomegaFailures(func() { + resp, err = http.PostForm(s.URL()+"/foo", url.Values{"users": []string{"user1"}}) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + }) + + Describe("VerifyProtoRepresenting", func() { + var message *protobuf.SimpleMessage + + BeforeEach(func() { + message = new(protobuf.SimpleMessage) + message.Description = proto.String("A description") + message.Id = proto.Int32(0) + + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/proto"), + VerifyProtoRepresenting(message), + )) + }) + + It("verifies the proto body and the content type", func() { + serialized, err := proto.Marshal(message) + Ω(err).ShouldNot(HaveOccurred()) + + resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", bytes.NewReader(serialized)) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should verify the proto body and the content type", func() { + serialized, err := proto.Marshal(&protobuf.SimpleMessage{ + Description: proto.String("A description"), + Id: proto.Int32(0), + Metadata: proto.String("some metadata"), + }) + Ω(err).ShouldNot(HaveOccurred()) + + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/proto", "application/x-protobuf", bytes.NewReader(serialized)) + }) + Ω(failures).Should(HaveLen(1)) + }) + + It("should verify the proto body and the content type", func() { + serialized, err := proto.Marshal(message) + Ω(err).ShouldNot(HaveOccurred()) + + failures := InterceptGomegaFailures(func() { + http.Post(s.URL()+"/proto", "application/not-x-protobuf", bytes.NewReader(serialized)) + }) + Ω(failures).Should(HaveLen(1)) + }) + }) + + Describe("RespondWith", func() { + Context("without headers", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWith(http.StatusCreated, "sweet"), + ), CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWith(http.StatusOK, []byte("sour")), + )) + }) + + It("should return the response", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + + body, err := ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(Equal([]byte("sweet"))) + + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusOK)) + + body, err = ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(Equal([]byte("sour"))) + }) + }) + + Context("with headers", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWith(http.StatusCreated, "sweet", http.Header{"X-Custom-Header": []string{"my header"}}), + )) + }) + + It("should return the headers too", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + Ω(ioutil.ReadAll(resp.Body)).Should(Equal([]byte("sweet"))) + Ω(resp.Header.Get("X-Custom-Header")).Should(Equal("my header")) + }) + }) + }) + + Describe("RespondWithPtr", func() { + var code int + var byteBody []byte + var stringBody string + BeforeEach(func() { + code = http.StatusOK + byteBody = []byte("sweet") + stringBody = "sour" + + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithPtr(&code, &byteBody), + ), CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithPtr(&code, &stringBody), + )) + }) + + It("should return the response", func() { + code = http.StatusCreated + byteBody = []byte("tasty") + stringBody = "treat" + + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + + body, err := ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(Equal([]byte("tasty"))) + + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + + body, err = ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(Equal([]byte("treat"))) + }) + + Context("when passed a nil body", func() { + BeforeEach(func() { + s.SetHandler(0, CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithPtr(&code, nil), + )) + }) + + It("should return an empty body and not explode", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + + Ω(err).ShouldNot(HaveOccurred()) + Ω(resp.StatusCode).Should(Equal(http.StatusOK)) + body, err := ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(BeEmpty()) + + Ω(s.ReceivedRequests()).Should(HaveLen(1)) + }) + }) + }) + + Describe("RespondWithJSON", func() { + Context("when no optional headers are set", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithJSONEncoded(http.StatusCreated, []int{1, 2, 3}), + )) + }) + + It("should return the response", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + + body, err := ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(MatchJSON("[1,2,3]")) + }) + + It("should set the Content-Type header to application/json", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) + }) + }) + + Context("when optional headers are set", func() { + var headers http.Header + BeforeEach(func() { + headers = http.Header{"Stuff": []string{"things"}} + }) + + JustBeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithJSONEncoded(http.StatusCreated, []int{1, 2, 3}, headers), + )) + }) + + It("should preserve those headers", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Stuff"]).Should(Equal([]string{"things"})) + }) + + It("should set the Content-Type header to application/json", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) + }) + + Context("when setting the Content-Type explicitly", func() { + BeforeEach(func() { + headers["Content-Type"] = []string{"not-json"} + }) + + It("should use the Content-Type header that was explicitly set", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"not-json"})) + }) + }) + }) + }) + + Describe("RespondWithJSONPtr", func() { + type testObject struct { + Key string + Value string + } + + var code int + var object testObject + + Context("when no optional headers are set", func() { + BeforeEach(func() { + code = http.StatusOK + object = testObject{} + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithJSONEncodedPtr(&code, &object), + )) + }) + + It("should return the response", func() { + code = http.StatusCreated + object = testObject{ + Key: "Jim", + Value: "Codes", + } + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + + body, err := ioutil.ReadAll(resp.Body) + Ω(err).ShouldNot(HaveOccurred()) + Ω(body).Should(MatchJSON(`{"Key": "Jim", "Value": "Codes"}`)) + }) + + It("should set the Content-Type header to application/json", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) + }) + }) + + Context("when optional headers are set", func() { + var headers http.Header + BeforeEach(func() { + headers = http.Header{"Stuff": []string{"things"}} + }) + + JustBeforeEach(func() { + code = http.StatusOK + object = testObject{} + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/foo"), + RespondWithJSONEncodedPtr(&code, &object, headers), + )) + }) + + It("should preserve those headers", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Stuff"]).Should(Equal([]string{"things"})) + }) + + It("should set the Content-Type header to application/json", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"})) + }) + + Context("when setting the Content-Type explicitly", func() { + BeforeEach(func() { + headers["Content-Type"] = []string{"not-json"} + }) + + It("should use the Content-Type header that was explicitly set", func() { + resp, err = http.Post(s.URL()+"/foo", "application/json", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"not-json"})) + }) + }) + }) + }) + + Describe("RespondWithProto", func() { + var message *protobuf.SimpleMessage + + BeforeEach(func() { + message = new(protobuf.SimpleMessage) + message.Description = proto.String("A description") + message.Id = proto.Int32(99) + }) + + Context("when no optional headers are set", func() { + BeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/proto"), + RespondWithProto(http.StatusCreated, message), + )) + }) + + It("should return the response", func() { + resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.StatusCode).Should(Equal(http.StatusCreated)) + + var received protobuf.SimpleMessage + body, err := ioutil.ReadAll(resp.Body) + err = proto.Unmarshal(body, &received) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should set the Content-Type header to application/x-protobuf", func() { + resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/x-protobuf"})) + }) + }) + + Context("when optional headers are set", func() { + var headers http.Header + BeforeEach(func() { + headers = http.Header{"Stuff": []string{"things"}} + }) + + JustBeforeEach(func() { + s.AppendHandlers(CombineHandlers( + VerifyRequest("POST", "/proto"), + RespondWithProto(http.StatusCreated, message, headers), + )) + }) + + It("should preserve those headers", func() { + resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Stuff"]).Should(Equal([]string{"things"})) + }) + + It("should set the Content-Type header to application/x-protobuf", func() { + resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"application/x-protobuf"})) + }) + + Context("when setting the Content-Type explicitly", func() { + BeforeEach(func() { + headers["Content-Type"] = []string{"not-x-protobuf"} + }) + + It("should use the Content-Type header that was explicitly set", func() { + resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(resp.Header["Content-Type"]).Should(Equal([]string{"not-x-protobuf"})) + }) + }) + }) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index f60f779e3a..78bd188c07 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -1,335 +1,335 @@ -/* -Gomega is the Ginkgo BDD-style testing framework's preferred matcher library. - -The godoc documentation describes Gomega's API. More comprehensive documentation (with examples!) is available at http://onsi.github.io/gomega/ - -Gomega on Github: http://github.com/onsi/gomega - -Learn more about Ginkgo online: http://onsi.github.io/ginkgo - -Ginkgo on Github: http://github.com/onsi/ginkgo - -Gomega is MIT-Licensed -*/ -package gomega - -import ( - "fmt" - "reflect" - "time" - - "github.com/onsi/gomega/internal/assertion" - "github.com/onsi/gomega/internal/asyncassertion" - "github.com/onsi/gomega/internal/testingtsupport" - "github.com/onsi/gomega/types" -) - -const GOMEGA_VERSION = "1.0" - -const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil. -If you're using Ginkgo then you probably forgot to put your assertion in an It(). -Alternatively, you may have forgotten to register a fail handler with RegisterFailHandler() or RegisterTestingT(). -` - -var globalFailHandler types.GomegaFailHandler - -var defaultEventuallyTimeout = time.Second -var defaultEventuallyPollingInterval = 10 * time.Millisecond -var defaultConsistentlyDuration = 100 * time.Millisecond -var defaultConsistentlyPollingInterval = 10 * time.Millisecond - -//RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails -//the fail handler passed into RegisterFailHandler is called. -func RegisterFailHandler(handler types.GomegaFailHandler) { - globalFailHandler = handler -} - -//RegisterTestingT connects Gomega to Golang's XUnit style -//Testing.T tests. You'll need to call this at the top of each XUnit style test: -// -// func TestFarmHasCow(t *testing.T) { -// RegisterTestingT(t) -// -// f := farm.New([]string{"Cow", "Horse"}) -// Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") -// } -// -// Note that this *testing.T is registered *globally* by Gomega (this is why you don't have to -// pass `t` down to the matcher itself). This means that you cannot run the XUnit style tests -// in parallel as the global fail handler cannot point to more than one testing.T at a time. -// -// (As an aside: Ginkgo gets around this limitation by running parallel tests in different *processes*). -func RegisterTestingT(t types.GomegaTestingT) { - RegisterFailHandler(testingtsupport.BuildTestingTGomegaFailHandler(t)) -} - -//InterceptGomegaHandlers runs a given callback and returns an array of -//failure messages generated by any Gomega assertions within the callback. -// -//This is accomplished by temporarily replacing the *global* fail handler -//with a fail handler that simply annotates failures. The original fail handler -//is reset when InterceptGomegaFailures returns. -// -//This is most useful when testing custom matchers, but can also be used to check -//on a value using a Gomega assertion without causing a test failure. -func InterceptGomegaFailures(f func()) []string { - originalHandler := globalFailHandler - failures := []string{} - RegisterFailHandler(func(message string, callerSkip ...int) { - failures = append(failures, message) - }) - f() - RegisterFailHandler(originalHandler) - return failures -} - -//Ω wraps an actual value allowing assertions to be made on it: -// Ω("foo").Should(Equal("foo")) -// -//If Ω is passed more than one argument it will pass the *first* argument to the matcher. -//All subsequent arguments will be required to be nil/zero. -// -//This is convenient if you want to make an assertion on a method/function that returns -//a value and an error - a common patter in Go. -// -//For example, given a function with signature: -// func MyAmazingThing() (int, error) -// -//Then: -// Ω(MyAmazingThing()).Should(Equal(3)) -//Will succeed only if `MyAmazingThing()` returns `(3, nil)` -// -//Ω and Expect are identical -func Ω(actual interface{}, extra ...interface{}) GomegaAssertion { - return ExpectWithOffset(0, actual, extra...) -} - -//Expect wraps an actual value allowing assertions to be made on it: -// Expect("foo").To(Equal("foo")) -// -//If Expect is passed more than one argument it will pass the *first* argument to the matcher. -//All subsequent arguments will be required to be nil/zero. -// -//This is convenient if you want to make an assertion on a method/function that returns -//a value and an error - a common patter in Go. -// -//For example, given a function with signature: -// func MyAmazingThing() (int, error) -// -//Then: -// Expect(MyAmazingThing()).Should(Equal(3)) -//Will succeed only if `MyAmazingThing()` returns `(3, nil)` -// -//Expect and Ω are identical -func Expect(actual interface{}, extra ...interface{}) GomegaAssertion { - return ExpectWithOffset(0, actual, extra...) -} - -//ExpectWithOffset wraps an actual value allowing assertions to be made on it: -// ExpectWithOffset(1, "foo").To(Equal("foo")) -// -//Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument -//this is used to modify the call-stack offset when computing line numbers. -// -//This is most useful in helper functions that make assertions. If you want Gomega's -//error message to refer to the calling line in the test (as opposed to the line in the helper function) -//set the first argument of `ExpectWithOffset` appropriately. -func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) GomegaAssertion { - if globalFailHandler == nil { - panic(nilFailHandlerPanic) - } - return assertion.New(actual, globalFailHandler, offset, extra...) -} - -//Eventually wraps an actual value allowing assertions to be made on it. -//The assertion is tried periodically until it passes or a timeout occurs. -// -//Both the timeout and polling interval are configurable as optional arguments: -//The first optional argument is the timeout -//The second optional argument is the polling interval -// -//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the -//last case they are interpreted as seconds. -// -//If Eventually is passed an actual that is a function taking no arguments and returning at least one value, -//then Eventually will call the function periodically and try the matcher against the function's first return value. -// -//Example: -// -// Eventually(func() int { -// return thingImPolling.Count() -// }).Should(BeNumerically(">=", 17)) -// -//Note that this example could be rewritten: -// -// Eventually(thingImPolling.Count).Should(BeNumerically(">=", 17)) -// -//If the function returns more than one value, then Eventually will pass the first value to the matcher and -//assert that all other values are nil/zero. -//This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. -// -//For example, consider a method that returns a value and an error: -// func FetchFromDB() (string, error) -// -//Then -// Eventually(FetchFromDB).Should(Equal("hasselhoff")) -// -//Will pass only if the the returned error is nil and the returned string passes the matcher. -// -//Eventually's default timeout is 1 second, and its default polling interval is 10ms -func Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { - return EventuallyWithOffset(0, actual, intervals...) -} - -//EventuallyWithOffset operates like Eventually but takes an additional -//initial argument to indicate an offset in the call stack. This is useful when building helper -//functions that contain matchers. To learn more, read about `ExpectWithOffset`. -func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { - if globalFailHandler == nil { - panic(nilFailHandlerPanic) - } - timeoutInterval := defaultEventuallyTimeout - pollingInterval := defaultEventuallyPollingInterval - if len(intervals) > 0 { - timeoutInterval = toDuration(intervals[0]) - } - if len(intervals) > 1 { - pollingInterval = toDuration(intervals[1]) - } - return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, globalFailHandler, timeoutInterval, pollingInterval, offset) -} - -//Consistently wraps an actual value allowing assertions to be made on it. -//The assertion is tried periodically and is required to pass for a period of time. -// -//Both the total time and polling interval are configurable as optional arguments: -//The first optional argument is the duration that Consistently will run for -//The second optional argument is the polling interval -// -//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the -//last case they are interpreted as seconds. -// -//If Consistently is passed an actual that is a function taking no arguments and returning at least one value, -//then Consistently will call the function periodically and try the matcher against the function's first return value. -// -//If the function returns more than one value, then Consistently will pass the first value to the matcher and -//assert that all other values are nil/zero. -//This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. -// -//Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. -//For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: -// -// Consistently(channel).ShouldNot(Receive()) -// -//Consistently's default duration is 100ms, and its default polling interval is 10ms -func Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { - return ConsistentlyWithOffset(0, actual, intervals...) -} - -//ConsistentlyWithOffset operates like Consistnetly but takes an additional -//initial argument to indicate an offset in the call stack. This is useful when building helper -//functions that contain matchers. To learn more, read about `ExpectWithOffset`. -func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { - if globalFailHandler == nil { - panic(nilFailHandlerPanic) - } - timeoutInterval := defaultConsistentlyDuration - pollingInterval := defaultConsistentlyPollingInterval - if len(intervals) > 0 { - timeoutInterval = toDuration(intervals[0]) - } - if len(intervals) > 1 { - pollingInterval = toDuration(intervals[1]) - } - return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, globalFailHandler, timeoutInterval, pollingInterval, offset) -} - -//Set the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. -func SetDefaultEventuallyTimeout(t time.Duration) { - defaultEventuallyTimeout = t -} - -//Set the default polling interval for Eventually. -func SetDefaultEventuallyPollingInterval(t time.Duration) { - defaultEventuallyPollingInterval = t -} - -//Set the default duration for Consistently. Consistently will verify that your condition is satsified for this long. -func SetDefaultConsistentlyDuration(t time.Duration) { - defaultConsistentlyDuration = t -} - -//Set the default polling interval for Consistently. -func SetDefaultConsistentlyPollingInterval(t time.Duration) { - defaultConsistentlyPollingInterval = t -} - -//GomegaAsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against -//the matcher passed to the Should and ShouldNot methods. -// -//Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to -//fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more -//descriptive -// -//Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. -// -//Example: -// -// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") -// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") -type GomegaAsyncAssertion interface { - Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool - ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool -} - -//GomegaAssertion is returned by Ω and Expect and compares the actual value to the matcher -//passed to the Should/ShouldNot and To/ToNot/NotTo methods. -// -//Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect -//though this is not enforced. -// -//All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() -//and is used to annotate failure messages. -// -//All methods return a bool that is true if hte assertion passed and false if it failed. -// -//Example: -// -// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) -type GomegaAssertion interface { - Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool - ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool - - To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool - ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool - NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool -} - -//OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it -type OmegaMatcher types.GomegaMatcher - -func toDuration(input interface{}) time.Duration { - duration, ok := input.(time.Duration) - if ok { - return duration - } - - value := reflect.ValueOf(input) - kind := reflect.TypeOf(input).Kind() - - if reflect.Int <= kind && kind <= reflect.Int64 { - return time.Duration(value.Int()) * time.Second - } else if reflect.Uint <= kind && kind <= reflect.Uint64 { - return time.Duration(value.Uint()) * time.Second - } else if reflect.Float32 <= kind && kind <= reflect.Float64 { - return time.Duration(value.Float() * float64(time.Second)) - } else if reflect.String == kind { - duration, err := time.ParseDuration(value.String()) - if err != nil { - panic(fmt.Sprintf("%#v is not a valid parsable duration string.", input)) - } - return duration - } - - panic(fmt.Sprintf("%v is not a valid interval. Must be time.Duration, parsable duration string or a number.", input)) -} +/* +Gomega is the Ginkgo BDD-style testing framework's preferred matcher library. + +The godoc documentation describes Gomega's API. More comprehensive documentation (with examples!) is available at http://onsi.github.io/gomega/ + +Gomega on Github: http://github.com/onsi/gomega + +Learn more about Ginkgo online: http://onsi.github.io/ginkgo + +Ginkgo on Github: http://github.com/onsi/ginkgo + +Gomega is MIT-Licensed +*/ +package gomega + +import ( + "fmt" + "reflect" + "time" + + "github.com/onsi/gomega/internal/assertion" + "github.com/onsi/gomega/internal/asyncassertion" + "github.com/onsi/gomega/internal/testingtsupport" + "github.com/onsi/gomega/types" +) + +const GOMEGA_VERSION = "1.0" + +const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil. +If you're using Ginkgo then you probably forgot to put your assertion in an It(). +Alternatively, you may have forgotten to register a fail handler with RegisterFailHandler() or RegisterTestingT(). +` + +var globalFailHandler types.GomegaFailHandler + +var defaultEventuallyTimeout = time.Second +var defaultEventuallyPollingInterval = 10 * time.Millisecond +var defaultConsistentlyDuration = 100 * time.Millisecond +var defaultConsistentlyPollingInterval = 10 * time.Millisecond + +//RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails +//the fail handler passed into RegisterFailHandler is called. +func RegisterFailHandler(handler types.GomegaFailHandler) { + globalFailHandler = handler +} + +//RegisterTestingT connects Gomega to Golang's XUnit style +//Testing.T tests. You'll need to call this at the top of each XUnit style test: +// +// func TestFarmHasCow(t *testing.T) { +// RegisterTestingT(t) +// +// f := farm.New([]string{"Cow", "Horse"}) +// Expect(f.HasCow()).To(BeTrue(), "Farm should have cow") +// } +// +// Note that this *testing.T is registered *globally* by Gomega (this is why you don't have to +// pass `t` down to the matcher itself). This means that you cannot run the XUnit style tests +// in parallel as the global fail handler cannot point to more than one testing.T at a time. +// +// (As an aside: Ginkgo gets around this limitation by running parallel tests in different *processes*). +func RegisterTestingT(t types.GomegaTestingT) { + RegisterFailHandler(testingtsupport.BuildTestingTGomegaFailHandler(t)) +} + +//InterceptGomegaHandlers runs a given callback and returns an array of +//failure messages generated by any Gomega assertions within the callback. +// +//This is accomplished by temporarily replacing the *global* fail handler +//with a fail handler that simply annotates failures. The original fail handler +//is reset when InterceptGomegaFailures returns. +// +//This is most useful when testing custom matchers, but can also be used to check +//on a value using a Gomega assertion without causing a test failure. +func InterceptGomegaFailures(f func()) []string { + originalHandler := globalFailHandler + failures := []string{} + RegisterFailHandler(func(message string, callerSkip ...int) { + failures = append(failures, message) + }) + f() + RegisterFailHandler(originalHandler) + return failures +} + +//Ω wraps an actual value allowing assertions to be made on it: +// Ω("foo").Should(Equal("foo")) +// +//If Ω is passed more than one argument it will pass the *first* argument to the matcher. +//All subsequent arguments will be required to be nil/zero. +// +//This is convenient if you want to make an assertion on a method/function that returns +//a value and an error - a common patter in Go. +// +//For example, given a function with signature: +// func MyAmazingThing() (int, error) +// +//Then: +// Ω(MyAmazingThing()).Should(Equal(3)) +//Will succeed only if `MyAmazingThing()` returns `(3, nil)` +// +//Ω and Expect are identical +func Ω(actual interface{}, extra ...interface{}) GomegaAssertion { + return ExpectWithOffset(0, actual, extra...) +} + +//Expect wraps an actual value allowing assertions to be made on it: +// Expect("foo").To(Equal("foo")) +// +//If Expect is passed more than one argument it will pass the *first* argument to the matcher. +//All subsequent arguments will be required to be nil/zero. +// +//This is convenient if you want to make an assertion on a method/function that returns +//a value and an error - a common patter in Go. +// +//For example, given a function with signature: +// func MyAmazingThing() (int, error) +// +//Then: +// Expect(MyAmazingThing()).Should(Equal(3)) +//Will succeed only if `MyAmazingThing()` returns `(3, nil)` +// +//Expect and Ω are identical +func Expect(actual interface{}, extra ...interface{}) GomegaAssertion { + return ExpectWithOffset(0, actual, extra...) +} + +//ExpectWithOffset wraps an actual value allowing assertions to be made on it: +// ExpectWithOffset(1, "foo").To(Equal("foo")) +// +//Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument +//this is used to modify the call-stack offset when computing line numbers. +// +//This is most useful in helper functions that make assertions. If you want Gomega's +//error message to refer to the calling line in the test (as opposed to the line in the helper function) +//set the first argument of `ExpectWithOffset` appropriately. +func ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) GomegaAssertion { + if globalFailHandler == nil { + panic(nilFailHandlerPanic) + } + return assertion.New(actual, globalFailHandler, offset, extra...) +} + +//Eventually wraps an actual value allowing assertions to be made on it. +//The assertion is tried periodically until it passes or a timeout occurs. +// +//Both the timeout and polling interval are configurable as optional arguments: +//The first optional argument is the timeout +//The second optional argument is the polling interval +// +//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +//last case they are interpreted as seconds. +// +//If Eventually is passed an actual that is a function taking no arguments and returning at least one value, +//then Eventually will call the function periodically and try the matcher against the function's first return value. +// +//Example: +// +// Eventually(func() int { +// return thingImPolling.Count() +// }).Should(BeNumerically(">=", 17)) +// +//Note that this example could be rewritten: +// +// Eventually(thingImPolling.Count).Should(BeNumerically(">=", 17)) +// +//If the function returns more than one value, then Eventually will pass the first value to the matcher and +//assert that all other values are nil/zero. +//This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go. +// +//For example, consider a method that returns a value and an error: +// func FetchFromDB() (string, error) +// +//Then +// Eventually(FetchFromDB).Should(Equal("hasselhoff")) +// +//Will pass only if the the returned error is nil and the returned string passes the matcher. +// +//Eventually's default timeout is 1 second, and its default polling interval is 10ms +func Eventually(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + return EventuallyWithOffset(0, actual, intervals...) +} + +//EventuallyWithOffset operates like Eventually but takes an additional +//initial argument to indicate an offset in the call stack. This is useful when building helper +//functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + if globalFailHandler == nil { + panic(nilFailHandlerPanic) + } + timeoutInterval := defaultEventuallyTimeout + pollingInterval := defaultEventuallyPollingInterval + if len(intervals) > 0 { + timeoutInterval = toDuration(intervals[0]) + } + if len(intervals) > 1 { + pollingInterval = toDuration(intervals[1]) + } + return asyncassertion.New(asyncassertion.AsyncAssertionTypeEventually, actual, globalFailHandler, timeoutInterval, pollingInterval, offset) +} + +//Consistently wraps an actual value allowing assertions to be made on it. +//The assertion is tried periodically and is required to pass for a period of time. +// +//Both the total time and polling interval are configurable as optional arguments: +//The first optional argument is the duration that Consistently will run for +//The second optional argument is the polling interval +// +//Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the +//last case they are interpreted as seconds. +// +//If Consistently is passed an actual that is a function taking no arguments and returning at least one value, +//then Consistently will call the function periodically and try the matcher against the function's first return value. +// +//If the function returns more than one value, then Consistently will pass the first value to the matcher and +//assert that all other values are nil/zero. +//This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go. +// +//Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem. +//For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could: +// +// Consistently(channel).ShouldNot(Receive()) +// +//Consistently's default duration is 100ms, and its default polling interval is 10ms +func Consistently(actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + return ConsistentlyWithOffset(0, actual, intervals...) +} + +//ConsistentlyWithOffset operates like Consistnetly but takes an additional +//initial argument to indicate an offset in the call stack. This is useful when building helper +//functions that contain matchers. To learn more, read about `ExpectWithOffset`. +func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) GomegaAsyncAssertion { + if globalFailHandler == nil { + panic(nilFailHandlerPanic) + } + timeoutInterval := defaultConsistentlyDuration + pollingInterval := defaultConsistentlyPollingInterval + if len(intervals) > 0 { + timeoutInterval = toDuration(intervals[0]) + } + if len(intervals) > 1 { + pollingInterval = toDuration(intervals[1]) + } + return asyncassertion.New(asyncassertion.AsyncAssertionTypeConsistently, actual, globalFailHandler, timeoutInterval, pollingInterval, offset) +} + +//Set the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses. +func SetDefaultEventuallyTimeout(t time.Duration) { + defaultEventuallyTimeout = t +} + +//Set the default polling interval for Eventually. +func SetDefaultEventuallyPollingInterval(t time.Duration) { + defaultEventuallyPollingInterval = t +} + +//Set the default duration for Consistently. Consistently will verify that your condition is satsified for this long. +func SetDefaultConsistentlyDuration(t time.Duration) { + defaultConsistentlyDuration = t +} + +//Set the default polling interval for Consistently. +func SetDefaultConsistentlyPollingInterval(t time.Duration) { + defaultConsistentlyPollingInterval = t +} + +//GomegaAsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against +//the matcher passed to the Should and ShouldNot methods. +// +//Both Should and ShouldNot take a variadic optionalDescription argument. This is passed on to +//fmt.Sprintf() and is used to annotate failure messages. This allows you to make your failure messages more +//descriptive +// +//Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed. +// +//Example: +// +// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.") +// Consistently(myChannel).ShouldNot(Receive(), "Nothing should have come down the pipe.") +type GomegaAsyncAssertion interface { + Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool +} + +//GomegaAssertion is returned by Ω and Expect and compares the actual value to the matcher +//passed to the Should/ShouldNot and To/ToNot/NotTo methods. +// +//Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect +//though this is not enforced. +// +//All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf() +//and is used to annotate failure messages. +// +//All methods return a bool that is true if hte assertion passed and false if it failed. +// +//Example: +// +// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm) +type GomegaAssertion interface { + Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + + To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool + NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool +} + +//OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it +type OmegaMatcher types.GomegaMatcher + +func toDuration(input interface{}) time.Duration { + duration, ok := input.(time.Duration) + if ok { + return duration + } + + value := reflect.ValueOf(input) + kind := reflect.TypeOf(input).Kind() + + if reflect.Int <= kind && kind <= reflect.Int64 { + return time.Duration(value.Int()) * time.Second + } else if reflect.Uint <= kind && kind <= reflect.Uint64 { + return time.Duration(value.Uint()) * time.Second + } else if reflect.Float32 <= kind && kind <= reflect.Float64 { + return time.Duration(value.Float() * float64(time.Second)) + } else if reflect.String == kind { + duration, err := time.ParseDuration(value.String()) + if err != nil { + panic(fmt.Sprintf("%#v is not a valid parsable duration string.", input)) + } + return duration + } + + panic(fmt.Sprintf("%v is not a valid interval. Must be time.Duration, parsable duration string or a number.", input)) +} diff --git a/vendor/github.com/onsi/gomega/gstruct/elements.go b/vendor/github.com/onsi/gomega/gstruct/elements.go index d4962bacdb..a315fa139f 100644 --- a/vendor/github.com/onsi/gomega/gstruct/elements.go +++ b/vendor/github.com/onsi/gomega/gstruct/elements.go @@ -1,145 +1,145 @@ -package gstruct - -import ( - "errors" - "fmt" - "reflect" - "runtime/debug" - - "github.com/onsi/gomega/format" - errorsutil "github.com/onsi/gomega/gstruct/errors" - "github.com/onsi/gomega/types" -) - -//MatchAllElements succeeds if every element of a slice matches the element matcher it maps to -//through the id function, and every element matcher is matched. -// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, matchers.Elements{ -// "a": BeEqual("a"), -// "b": BeEqual("b"), -// }) -func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher { - return &ElementsMatcher{ - Identifier: identifier, - Elements: elements, - } -} - -//MatchElements succeeds if each element of a slice matches the element matcher it maps to -//through the id function. It can ignore extra elements and/or missing elements. -// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing|IgnoreExtra, matchers.Elements{ -// "a": BeEqual("a") -// "b": BeEqual("b"), -// }) -func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher { - return &ElementsMatcher{ - Identifier: identifier, - Elements: elements, - IgnoreExtras: options&IgnoreExtras != 0, - IgnoreMissing: options&IgnoreMissing != 0, - AllowDuplicates: options&AllowDuplicates != 0, - } -} - -// ElementsMatcher is a NestingMatcher that applies custom matchers to each element of a slice mapped -// by the Identifier function. -// TODO: Extend this to work with arrays & maps (map the key) as well. -type ElementsMatcher struct { - // Matchers for each element. - Elements Elements - // Function mapping an element to the string key identifying its matcher. - Identifier Identifier - - // Whether to ignore extra elements or consider it an error. - IgnoreExtras bool - // Whether to ignore missing elements or consider it an error. - IgnoreMissing bool - // Whether to key duplicates when matching IDs. - AllowDuplicates bool - - // State. - failures []error -} - -// Element ID to matcher. -type Elements map[string]types.GomegaMatcher - -// Function for identifying (mapping) elements. -type Identifier func(element interface{}) string - -func (m *ElementsMatcher) Match(actual interface{}) (success bool, err error) { - if reflect.TypeOf(actual).Kind() != reflect.Slice { - return false, fmt.Errorf("%v is type %T, expected slice", actual, actual) - } - - m.failures = m.matchElements(actual) - if len(m.failures) > 0 { - return false, nil - } - return true, nil -} - -func (m *ElementsMatcher) matchElements(actual interface{}) (errs []error) { - // Provide more useful error messages in the case of a panic. - defer func() { - if err := recover(); err != nil { - errs = append(errs, fmt.Errorf("panic checking %+v: %v\n%s", actual, err, debug.Stack())) - } - }() - - val := reflect.ValueOf(actual) - elements := map[string]bool{} - for i := 0; i < val.Len(); i++ { - element := val.Index(i).Interface() - id := m.Identifier(element) - if elements[id] { - if !m.AllowDuplicates { - errs = append(errs, fmt.Errorf("found duplicate element ID %s", id)) - continue - } - } - elements[id] = true - - matcher, expected := m.Elements[id] - if !expected { - if !m.IgnoreExtras { - errs = append(errs, fmt.Errorf("unexpected element %s", id)) - } - continue - } - - match, err := matcher.Match(element) - if match { - continue - } - - if err == nil { - if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { - err = errorsutil.AggregateError(nesting.Failures()) - } else { - err = errors.New(matcher.FailureMessage(element)) - } - } - errs = append(errs, errorsutil.Nest(fmt.Sprintf("[%s]", id), err)) - } - - for id := range m.Elements { - if !elements[id] && !m.IgnoreMissing { - errs = append(errs, fmt.Errorf("missing expected element %s", id)) - } - } - - return errs -} - -func (m *ElementsMatcher) FailureMessage(actual interface{}) (message string) { - failure := errorsutil.AggregateError(m.failures) - return format.Message(actual, fmt.Sprintf("to match elements: %v", failure)) -} - -func (m *ElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to match elements") -} - -func (m *ElementsMatcher) Failures() []error { - return m.failures -} +package gstruct + +import ( + "errors" + "fmt" + "reflect" + "runtime/debug" + + "github.com/onsi/gomega/format" + errorsutil "github.com/onsi/gomega/gstruct/errors" + "github.com/onsi/gomega/types" +) + +//MatchAllElements succeeds if every element of a slice matches the element matcher it maps to +//through the id function, and every element matcher is matched. +// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, matchers.Elements{ +// "a": BeEqual("a"), +// "b": BeEqual("b"), +// }) +func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher { + return &ElementsMatcher{ + Identifier: identifier, + Elements: elements, + } +} + +//MatchElements succeeds if each element of a slice matches the element matcher it maps to +//through the id function. It can ignore extra elements and/or missing elements. +// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing|IgnoreExtra, matchers.Elements{ +// "a": BeEqual("a") +// "b": BeEqual("b"), +// }) +func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher { + return &ElementsMatcher{ + Identifier: identifier, + Elements: elements, + IgnoreExtras: options&IgnoreExtras != 0, + IgnoreMissing: options&IgnoreMissing != 0, + AllowDuplicates: options&AllowDuplicates != 0, + } +} + +// ElementsMatcher is a NestingMatcher that applies custom matchers to each element of a slice mapped +// by the Identifier function. +// TODO: Extend this to work with arrays & maps (map the key) as well. +type ElementsMatcher struct { + // Matchers for each element. + Elements Elements + // Function mapping an element to the string key identifying its matcher. + Identifier Identifier + + // Whether to ignore extra elements or consider it an error. + IgnoreExtras bool + // Whether to ignore missing elements or consider it an error. + IgnoreMissing bool + // Whether to key duplicates when matching IDs. + AllowDuplicates bool + + // State. + failures []error +} + +// Element ID to matcher. +type Elements map[string]types.GomegaMatcher + +// Function for identifying (mapping) elements. +type Identifier func(element interface{}) string + +func (m *ElementsMatcher) Match(actual interface{}) (success bool, err error) { + if reflect.TypeOf(actual).Kind() != reflect.Slice { + return false, fmt.Errorf("%v is type %T, expected slice", actual, actual) + } + + m.failures = m.matchElements(actual) + if len(m.failures) > 0 { + return false, nil + } + return true, nil +} + +func (m *ElementsMatcher) matchElements(actual interface{}) (errs []error) { + // Provide more useful error messages in the case of a panic. + defer func() { + if err := recover(); err != nil { + errs = append(errs, fmt.Errorf("panic checking %+v: %v\n%s", actual, err, debug.Stack())) + } + }() + + val := reflect.ValueOf(actual) + elements := map[string]bool{} + for i := 0; i < val.Len(); i++ { + element := val.Index(i).Interface() + id := m.Identifier(element) + if elements[id] { + if !m.AllowDuplicates { + errs = append(errs, fmt.Errorf("found duplicate element ID %s", id)) + continue + } + } + elements[id] = true + + matcher, expected := m.Elements[id] + if !expected { + if !m.IgnoreExtras { + errs = append(errs, fmt.Errorf("unexpected element %s", id)) + } + continue + } + + match, err := matcher.Match(element) + if match { + continue + } + + if err == nil { + if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { + err = errorsutil.AggregateError(nesting.Failures()) + } else { + err = errors.New(matcher.FailureMessage(element)) + } + } + errs = append(errs, errorsutil.Nest(fmt.Sprintf("[%s]", id), err)) + } + + for id := range m.Elements { + if !elements[id] && !m.IgnoreMissing { + errs = append(errs, fmt.Errorf("missing expected element %s", id)) + } + } + + return errs +} + +func (m *ElementsMatcher) FailureMessage(actual interface{}) (message string) { + failure := errorsutil.AggregateError(m.failures) + return format.Message(actual, fmt.Sprintf("to match elements: %v", failure)) +} + +func (m *ElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match elements") +} + +func (m *ElementsMatcher) Failures() []error { + return m.failures +} diff --git a/vendor/github.com/onsi/gomega/gstruct/elements_test.go b/vendor/github.com/onsi/gomega/gstruct/elements_test.go index 2d24525a26..8ba78cb91a 100644 --- a/vendor/github.com/onsi/gomega/gstruct/elements_test.go +++ b/vendor/github.com/onsi/gomega/gstruct/elements_test.go @@ -1,144 +1,144 @@ -package gstruct_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" -) - -var _ = Describe("Slice", func() { - allElements := []string{"a", "b"} - missingElements := []string{"a"} - extraElements := []string{"a", "b", "c"} - duplicateElements := []string{"a", "a", "b"} - empty := []string{} - var nils []string - - It("should strictly match all elements", func() { - m := MatchAllElements(id, Elements{ - "b": Equal("b"), - "a": Equal("a"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).ShouldNot(m, "should fail with missing elements") - Ω(extraElements).ShouldNot(m, "should fail with extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") - - m = MatchAllElements(id, Elements{ - "a": Equal("a"), - "b": Equal("fail"), - }) - Ω(allElements).ShouldNot(m, "should run nested matchers") - - m = MatchAllElements(id, Elements{}) - Ω(empty).Should(m, "should handle empty slices") - Ω(allElements).ShouldNot(m, "should handle only empty slices") - Ω(nils).Should(m, "should handle nil slices") - }) - - It("should ignore extra elements", func() { - m := MatchElements(id, IgnoreExtras, Elements{ - "b": Equal("b"), - "a": Equal("a"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).ShouldNot(m, "should fail with missing elements") - Ω(extraElements).Should(m, "should ignore extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") - }) - - It("should ignore missing elements", func() { - m := MatchElements(id, IgnoreMissing, Elements{ - "a": Equal("a"), - "b": Equal("b"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).Should(m, "should ignore missing elements") - Ω(extraElements).ShouldNot(m, "should fail with extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).Should(m, "should ignore an uninitialized slice") - }) - - It("should ignore missing and extra elements", func() { - m := MatchElements(id, IgnoreMissing|IgnoreExtras, Elements{ - "a": Equal("a"), - "b": Equal("b"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).Should(m, "should ignore missing elements") - Ω(extraElements).Should(m, "should ignore extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).Should(m, "should ignore an uninitialized slice") - - m = MatchElements(id, IgnoreExtras|IgnoreMissing, Elements{ - "a": Equal("a"), - "b": Equal("fail"), - }) - Ω(allElements).ShouldNot(m, "should run nested matchers") - }) - - Context("with elements that share a key", func() { - nonUniqueID := func(element interface{}) string { - return element.(string)[0:1] - } - - allElements := []string{"a123", "a213", "b321"} - includingBadElements := []string{"a123", "b123", "b5555"} - extraElements := []string{"a123", "b1234", "c345"} - missingElements := []string{"b123", "b1234", "b1345"} - - It("should strictly allow multiple matches", func() { - m := MatchElements(nonUniqueID, AllowDuplicates, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).ShouldNot(m, "should reject with extra keys") - Ω(missingElements).ShouldNot(m, "should reject with missing keys") - Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") - }) - - It("should ignore missing", func() { - m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreMissing, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).ShouldNot(m, "should reject with extra keys") - Ω(missingElements).Should(m, "should allow missing keys") - Ω(nils).Should(m, "should allow an uninitialized slice") - }) - - It("should ignore extras", func() { - m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreExtras, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).Should(m, "should allow extra keys") - Ω(missingElements).ShouldNot(m, "should reject missing keys") - Ω(nils).ShouldNot(m, "should reject an uninitialized slice") - }) - - It("should ignore missing and extras", func() { - m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreExtras|IgnoreMissing, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).Should(m, "should allow extra keys") - Ω(missingElements).Should(m, "should allow missing keys") - Ω(nils).Should(m, "should allow an uninitialized slice") - }) - }) -}) - -func id(element interface{}) string { - return element.(string) -} +package gstruct_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" +) + +var _ = Describe("Slice", func() { + allElements := []string{"a", "b"} + missingElements := []string{"a"} + extraElements := []string{"a", "b", "c"} + duplicateElements := []string{"a", "a", "b"} + empty := []string{} + var nils []string + + It("should strictly match all elements", func() { + m := MatchAllElements(id, Elements{ + "b": Equal("b"), + "a": Equal("a"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(missingElements).ShouldNot(m, "should fail with missing elements") + Ω(extraElements).ShouldNot(m, "should fail with extra elements") + Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") + Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") + + m = MatchAllElements(id, Elements{ + "a": Equal("a"), + "b": Equal("fail"), + }) + Ω(allElements).ShouldNot(m, "should run nested matchers") + + m = MatchAllElements(id, Elements{}) + Ω(empty).Should(m, "should handle empty slices") + Ω(allElements).ShouldNot(m, "should handle only empty slices") + Ω(nils).Should(m, "should handle nil slices") + }) + + It("should ignore extra elements", func() { + m := MatchElements(id, IgnoreExtras, Elements{ + "b": Equal("b"), + "a": Equal("a"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(missingElements).ShouldNot(m, "should fail with missing elements") + Ω(extraElements).Should(m, "should ignore extra elements") + Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") + Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") + }) + + It("should ignore missing elements", func() { + m := MatchElements(id, IgnoreMissing, Elements{ + "a": Equal("a"), + "b": Equal("b"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(missingElements).Should(m, "should ignore missing elements") + Ω(extraElements).ShouldNot(m, "should fail with extra elements") + Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") + Ω(nils).Should(m, "should ignore an uninitialized slice") + }) + + It("should ignore missing and extra elements", func() { + m := MatchElements(id, IgnoreMissing|IgnoreExtras, Elements{ + "a": Equal("a"), + "b": Equal("b"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(missingElements).Should(m, "should ignore missing elements") + Ω(extraElements).Should(m, "should ignore extra elements") + Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") + Ω(nils).Should(m, "should ignore an uninitialized slice") + + m = MatchElements(id, IgnoreExtras|IgnoreMissing, Elements{ + "a": Equal("a"), + "b": Equal("fail"), + }) + Ω(allElements).ShouldNot(m, "should run nested matchers") + }) + + Context("with elements that share a key", func() { + nonUniqueID := func(element interface{}) string { + return element.(string)[0:1] + } + + allElements := []string{"a123", "a213", "b321"} + includingBadElements := []string{"a123", "b123", "b5555"} + extraElements := []string{"a123", "b1234", "c345"} + missingElements := []string{"b123", "b1234", "b1345"} + + It("should strictly allow multiple matches", func() { + m := MatchElements(nonUniqueID, AllowDuplicates, Elements{ + "a": ContainSubstring("1"), + "b": ContainSubstring("1"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") + Ω(extraElements).ShouldNot(m, "should reject with extra keys") + Ω(missingElements).ShouldNot(m, "should reject with missing keys") + Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") + }) + + It("should ignore missing", func() { + m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreMissing, Elements{ + "a": ContainSubstring("1"), + "b": ContainSubstring("1"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") + Ω(extraElements).ShouldNot(m, "should reject with extra keys") + Ω(missingElements).Should(m, "should allow missing keys") + Ω(nils).Should(m, "should allow an uninitialized slice") + }) + + It("should ignore extras", func() { + m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreExtras, Elements{ + "a": ContainSubstring("1"), + "b": ContainSubstring("1"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") + Ω(extraElements).Should(m, "should allow extra keys") + Ω(missingElements).ShouldNot(m, "should reject missing keys") + Ω(nils).ShouldNot(m, "should reject an uninitialized slice") + }) + + It("should ignore missing and extras", func() { + m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreExtras|IgnoreMissing, Elements{ + "a": ContainSubstring("1"), + "b": ContainSubstring("1"), + }) + Ω(allElements).Should(m, "should match all elements") + Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") + Ω(extraElements).Should(m, "should allow extra keys") + Ω(missingElements).Should(m, "should allow missing keys") + Ω(nils).Should(m, "should allow an uninitialized slice") + }) + }) +}) + +func id(element interface{}) string { + return element.(string) +} diff --git a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go b/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go index cf28853847..188492b212 100644 --- a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go +++ b/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go @@ -1,72 +1,72 @@ -package errors - -import ( - "fmt" - "strings" - - "github.com/onsi/gomega/types" -) - -// A stateful matcher that nests other matchers within it and preserves the error types of the -// nested matcher failures. -type NestingMatcher interface { - types.GomegaMatcher - - // Returns the failures of nested matchers. - Failures() []error -} - -// An error type for labeling errors on deeply nested matchers. -type NestedError struct { - Path string - Err error -} - -func (e *NestedError) Error() string { - // Indent Errors. - indented := strings.Replace(e.Err.Error(), "\n", "\n\t", -1) - return fmt.Sprintf("%s:\n\t%v", e.Path, indented) -} - -// Create a NestedError with the given path. -// If err is a NestedError, prepend the path to it. -// If err is an AggregateError, recursively Nest each error. -func Nest(path string, err error) error { - if ag, ok := err.(AggregateError); ok { - var errs AggregateError - for _, e := range ag { - errs = append(errs, Nest(path, e)) - } - return errs - } - if ne, ok := err.(*NestedError); ok { - return &NestedError{ - Path: path + ne.Path, - Err: ne.Err, - } - } - return &NestedError{ - Path: path, - Err: err, - } -} - -// An error type for treating multiple errors as a single error. -type AggregateError []error - -// Error is part of the error interface. -func (err AggregateError) Error() string { - if len(err) == 0 { - // This should never happen, really. - return "" - } - if len(err) == 1 { - return err[0].Error() - } - result := fmt.Sprintf("[%s", err[0].Error()) - for i := 1; i < len(err); i++ { - result += fmt.Sprintf(", %s", err[i].Error()) - } - result += "]" - return result -} +package errors + +import ( + "fmt" + "strings" + + "github.com/onsi/gomega/types" +) + +// A stateful matcher that nests other matchers within it and preserves the error types of the +// nested matcher failures. +type NestingMatcher interface { + types.GomegaMatcher + + // Returns the failures of nested matchers. + Failures() []error +} + +// An error type for labeling errors on deeply nested matchers. +type NestedError struct { + Path string + Err error +} + +func (e *NestedError) Error() string { + // Indent Errors. + indented := strings.Replace(e.Err.Error(), "\n", "\n\t", -1) + return fmt.Sprintf("%s:\n\t%v", e.Path, indented) +} + +// Create a NestedError with the given path. +// If err is a NestedError, prepend the path to it. +// If err is an AggregateError, recursively Nest each error. +func Nest(path string, err error) error { + if ag, ok := err.(AggregateError); ok { + var errs AggregateError + for _, e := range ag { + errs = append(errs, Nest(path, e)) + } + return errs + } + if ne, ok := err.(*NestedError); ok { + return &NestedError{ + Path: path + ne.Path, + Err: ne.Err, + } + } + return &NestedError{ + Path: path, + Err: err, + } +} + +// An error type for treating multiple errors as a single error. +type AggregateError []error + +// Error is part of the error interface. +func (err AggregateError) Error() string { + if len(err) == 0 { + // This should never happen, really. + return "" + } + if len(err) == 1 { + return err[0].Error() + } + result := fmt.Sprintf("[%s", err[0].Error()) + for i := 1; i < len(err); i++ { + result += fmt.Sprintf(", %s", err[i].Error()) + } + result += "]" + return result +} diff --git a/vendor/github.com/onsi/gomega/gstruct/fields.go b/vendor/github.com/onsi/gomega/gstruct/fields.go index 330fe8a8db..f3c1575511 100644 --- a/vendor/github.com/onsi/gomega/gstruct/fields.go +++ b/vendor/github.com/onsi/gomega/gstruct/fields.go @@ -1,141 +1,141 @@ -package gstruct - -import ( - "errors" - "fmt" - "reflect" - "runtime/debug" - "strings" - - "github.com/onsi/gomega/format" - errorsutil "github.com/onsi/gomega/gstruct/errors" - "github.com/onsi/gomega/types" -) - -//MatchAllFields succeeds if every field of a struct matches the field matcher associated with -//it, and every element matcher is matched. -// Expect([]string{"a", "b"}).To(MatchAllFields(idFn, gstruct.Fields{ -// "a": BeEqual("a"), -// "b": BeEqual("b"), -// }) -func MatchAllFields(fields Fields) types.GomegaMatcher { - return &FieldsMatcher{ - Fields: fields, - } -} - -//MatchFields succeeds if each element of a struct matches the field matcher associated with -//it. It can ignore extra fields and/or missing fields. -// Expect([]string{"a", "c"}).To(MatchFields(idFn, IgnoreMissing|IgnoreExtra, gstruct.Fields{ -// "a": BeEqual("a") -// "b": BeEqual("b"), -// }) -func MatchFields(options Options, fields Fields) types.GomegaMatcher { - return &FieldsMatcher{ - Fields: fields, - IgnoreExtras: options&IgnoreExtras != 0, - IgnoreMissing: options&IgnoreMissing != 0, - } -} - -type FieldsMatcher struct { - // Matchers for each field. - Fields Fields - - // Whether to ignore extra elements or consider it an error. - IgnoreExtras bool - // Whether to ignore missing elements or consider it an error. - IgnoreMissing bool - - // State. - failures []error -} - -// Field name to matcher. -type Fields map[string]types.GomegaMatcher - -func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error) { - if reflect.TypeOf(actual).Kind() != reflect.Struct { - return false, fmt.Errorf("%v is type %T, expected struct", actual, actual) - } - - m.failures = m.matchFields(actual) - if len(m.failures) > 0 { - return false, nil - } - return true, nil -} - -func (m *FieldsMatcher) matchFields(actual interface{}) (errs []error) { - val := reflect.ValueOf(actual) - typ := val.Type() - fields := map[string]bool{} - for i := 0; i < val.NumField(); i++ { - fieldName := typ.Field(i).Name - fields[fieldName] = true - - err := func() (err error) { - // This test relies heavily on reflect, which tends to panic. - // Recover here to provide more useful error messages in that case. - defer func() { - if r := recover(); r != nil { - err = fmt.Errorf("panic checking %+v: %v\n%s", actual, r, debug.Stack()) - } - }() - - matcher, expected := m.Fields[fieldName] - if !expected { - if !m.IgnoreExtras { - return fmt.Errorf("unexpected field %s: %+v", fieldName, actual) - } - return nil - } - - var field interface{} - if val.Field(i).IsValid() { - field = val.Field(i).Interface() - } else { - field = reflect.Zero(typ.Field(i).Type) - } - - match, err := matcher.Match(field) - if err != nil { - return err - } else if !match { - if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { - return errorsutil.AggregateError(nesting.Failures()) - } - return errors.New(matcher.FailureMessage(field)) - } - return nil - }() - if err != nil { - errs = append(errs, errorsutil.Nest("."+fieldName, err)) - } - } - - for field := range m.Fields { - if !fields[field] && !m.IgnoreMissing { - errs = append(errs, fmt.Errorf("missing expected field %s", field)) - } - } - - return errs -} - -func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string) { - failures := make([]string, len(m.failures)) - for i := range m.failures { - failures[i] = m.failures[i].Error() - } - return format.Message(reflect.TypeOf(actual).Name(), - fmt.Sprintf("to match fields: {\n%v\n}\n", strings.Join(failures, "\n"))) -} - -func (m *FieldsMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to match fields") -} - -func (m *FieldsMatcher) Failures() []error { - return m.failures -} +package gstruct + +import ( + "errors" + "fmt" + "reflect" + "runtime/debug" + "strings" + + "github.com/onsi/gomega/format" + errorsutil "github.com/onsi/gomega/gstruct/errors" + "github.com/onsi/gomega/types" +) + +//MatchAllFields succeeds if every field of a struct matches the field matcher associated with +//it, and every element matcher is matched. +// Expect([]string{"a", "b"}).To(MatchAllFields(idFn, gstruct.Fields{ +// "a": BeEqual("a"), +// "b": BeEqual("b"), +// }) +func MatchAllFields(fields Fields) types.GomegaMatcher { + return &FieldsMatcher{ + Fields: fields, + } +} + +//MatchFields succeeds if each element of a struct matches the field matcher associated with +//it. It can ignore extra fields and/or missing fields. +// Expect([]string{"a", "c"}).To(MatchFields(idFn, IgnoreMissing|IgnoreExtra, gstruct.Fields{ +// "a": BeEqual("a") +// "b": BeEqual("b"), +// }) +func MatchFields(options Options, fields Fields) types.GomegaMatcher { + return &FieldsMatcher{ + Fields: fields, + IgnoreExtras: options&IgnoreExtras != 0, + IgnoreMissing: options&IgnoreMissing != 0, + } +} + +type FieldsMatcher struct { + // Matchers for each field. + Fields Fields + + // Whether to ignore extra elements or consider it an error. + IgnoreExtras bool + // Whether to ignore missing elements or consider it an error. + IgnoreMissing bool + + // State. + failures []error +} + +// Field name to matcher. +type Fields map[string]types.GomegaMatcher + +func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error) { + if reflect.TypeOf(actual).Kind() != reflect.Struct { + return false, fmt.Errorf("%v is type %T, expected struct", actual, actual) + } + + m.failures = m.matchFields(actual) + if len(m.failures) > 0 { + return false, nil + } + return true, nil +} + +func (m *FieldsMatcher) matchFields(actual interface{}) (errs []error) { + val := reflect.ValueOf(actual) + typ := val.Type() + fields := map[string]bool{} + for i := 0; i < val.NumField(); i++ { + fieldName := typ.Field(i).Name + fields[fieldName] = true + + err := func() (err error) { + // This test relies heavily on reflect, which tends to panic. + // Recover here to provide more useful error messages in that case. + defer func() { + if r := recover(); r != nil { + err = fmt.Errorf("panic checking %+v: %v\n%s", actual, r, debug.Stack()) + } + }() + + matcher, expected := m.Fields[fieldName] + if !expected { + if !m.IgnoreExtras { + return fmt.Errorf("unexpected field %s: %+v", fieldName, actual) + } + return nil + } + + var field interface{} + if val.Field(i).IsValid() { + field = val.Field(i).Interface() + } else { + field = reflect.Zero(typ.Field(i).Type) + } + + match, err := matcher.Match(field) + if err != nil { + return err + } else if !match { + if nesting, ok := matcher.(errorsutil.NestingMatcher); ok { + return errorsutil.AggregateError(nesting.Failures()) + } + return errors.New(matcher.FailureMessage(field)) + } + return nil + }() + if err != nil { + errs = append(errs, errorsutil.Nest("."+fieldName, err)) + } + } + + for field := range m.Fields { + if !fields[field] && !m.IgnoreMissing { + errs = append(errs, fmt.Errorf("missing expected field %s", field)) + } + } + + return errs +} + +func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string) { + failures := make([]string, len(m.failures)) + for i := range m.failures { + failures[i] = m.failures[i].Error() + } + return format.Message(reflect.TypeOf(actual).Name(), + fmt.Sprintf("to match fields: {\n%v\n}\n", strings.Join(failures, "\n"))) +} + +func (m *FieldsMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match fields") +} + +func (m *FieldsMatcher) Failures() []error { + return m.failures +} diff --git a/vendor/github.com/onsi/gomega/gstruct/fields_test.go b/vendor/github.com/onsi/gomega/gstruct/fields_test.go index 57bcf47df3..61f4afc401 100644 --- a/vendor/github.com/onsi/gomega/gstruct/fields_test.go +++ b/vendor/github.com/onsi/gomega/gstruct/fields_test.go @@ -1,76 +1,76 @@ -package gstruct_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" -) - -var _ = Describe("Struct", func() { - allFields := struct{ A, B string }{"a", "b"} - missingFields := struct{ A string }{"a"} - extraFields := struct{ A, B, C string }{"a", "b", "c"} - emptyFields := struct{ A, B string }{} - - It("should strictly match all fields", func() { - m := MatchAllFields(Fields{ - "B": Equal("b"), - "A": Equal("a"), - }) - Ω(allFields).Should(m, "should match all fields") - Ω(missingFields).ShouldNot(m, "should fail with missing fields") - Ω(extraFields).ShouldNot(m, "should fail with extra fields") - Ω(emptyFields).ShouldNot(m, "should fail with empty fields") - - m = MatchAllFields(Fields{ - "A": Equal("a"), - "B": Equal("fail"), - }) - Ω(allFields).ShouldNot(m, "should run nested matchers") - }) - - It("should handle empty structs", func() { - m := MatchAllFields(Fields{}) - Ω(struct{}{}).Should(m, "should handle empty structs") - Ω(allFields).ShouldNot(m, "should fail with extra fields") - }) - - It("should ignore missing fields", func() { - m := MatchFields(IgnoreMissing, Fields{ - "B": Equal("b"), - "A": Equal("a"), - }) - Ω(allFields).Should(m, "should match all fields") - Ω(missingFields).Should(m, "should ignore missing fields") - Ω(extraFields).ShouldNot(m, "should fail with extra fields") - Ω(emptyFields).ShouldNot(m, "should fail with empty fields") - }) - - It("should ignore extra fields", func() { - m := MatchFields(IgnoreExtras, Fields{ - "B": Equal("b"), - "A": Equal("a"), - }) - Ω(allFields).Should(m, "should match all fields") - Ω(missingFields).ShouldNot(m, "should fail with missing fields") - Ω(extraFields).Should(m, "should ignore extra fields") - Ω(emptyFields).ShouldNot(m, "should fail with empty fields") - }) - - It("should ignore missing and extra fields", func() { - m := MatchFields(IgnoreMissing|IgnoreExtras, Fields{ - "B": Equal("b"), - "A": Equal("a"), - }) - Ω(allFields).Should(m, "should match all fields") - Ω(missingFields).Should(m, "should ignore missing fields") - Ω(extraFields).Should(m, "should ignore extra fields") - Ω(emptyFields).ShouldNot(m, "should fail with empty fields") - - m = MatchFields(IgnoreMissing|IgnoreExtras, Fields{ - "A": Equal("a"), - "B": Equal("fail"), - }) - Ω(allFields).ShouldNot(m, "should run nested matchers") - }) -}) +package gstruct_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" +) + +var _ = Describe("Struct", func() { + allFields := struct{ A, B string }{"a", "b"} + missingFields := struct{ A string }{"a"} + extraFields := struct{ A, B, C string }{"a", "b", "c"} + emptyFields := struct{ A, B string }{} + + It("should strictly match all fields", func() { + m := MatchAllFields(Fields{ + "B": Equal("b"), + "A": Equal("a"), + }) + Ω(allFields).Should(m, "should match all fields") + Ω(missingFields).ShouldNot(m, "should fail with missing fields") + Ω(extraFields).ShouldNot(m, "should fail with extra fields") + Ω(emptyFields).ShouldNot(m, "should fail with empty fields") + + m = MatchAllFields(Fields{ + "A": Equal("a"), + "B": Equal("fail"), + }) + Ω(allFields).ShouldNot(m, "should run nested matchers") + }) + + It("should handle empty structs", func() { + m := MatchAllFields(Fields{}) + Ω(struct{}{}).Should(m, "should handle empty structs") + Ω(allFields).ShouldNot(m, "should fail with extra fields") + }) + + It("should ignore missing fields", func() { + m := MatchFields(IgnoreMissing, Fields{ + "B": Equal("b"), + "A": Equal("a"), + }) + Ω(allFields).Should(m, "should match all fields") + Ω(missingFields).Should(m, "should ignore missing fields") + Ω(extraFields).ShouldNot(m, "should fail with extra fields") + Ω(emptyFields).ShouldNot(m, "should fail with empty fields") + }) + + It("should ignore extra fields", func() { + m := MatchFields(IgnoreExtras, Fields{ + "B": Equal("b"), + "A": Equal("a"), + }) + Ω(allFields).Should(m, "should match all fields") + Ω(missingFields).ShouldNot(m, "should fail with missing fields") + Ω(extraFields).Should(m, "should ignore extra fields") + Ω(emptyFields).ShouldNot(m, "should fail with empty fields") + }) + + It("should ignore missing and extra fields", func() { + m := MatchFields(IgnoreMissing|IgnoreExtras, Fields{ + "B": Equal("b"), + "A": Equal("a"), + }) + Ω(allFields).Should(m, "should match all fields") + Ω(missingFields).Should(m, "should ignore missing fields") + Ω(extraFields).Should(m, "should ignore extra fields") + Ω(emptyFields).ShouldNot(m, "should fail with empty fields") + + m = MatchFields(IgnoreMissing|IgnoreExtras, Fields{ + "A": Equal("a"), + "B": Equal("fail"), + }) + Ω(allFields).ShouldNot(m, "should run nested matchers") + }) +}) diff --git a/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go b/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go index f852e26f98..d475663040 100644 --- a/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go +++ b/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go @@ -1,13 +1,13 @@ -package gstruct_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func Test(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Gstruct Suite") -} +package gstruct_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func Test(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Gstruct Suite") +} diff --git a/vendor/github.com/onsi/gomega/gstruct/ignore.go b/vendor/github.com/onsi/gomega/gstruct/ignore.go index a27cbe4a07..0365f32ad1 100644 --- a/vendor/github.com/onsi/gomega/gstruct/ignore.go +++ b/vendor/github.com/onsi/gomega/gstruct/ignore.go @@ -1,37 +1,37 @@ -package gstruct - -import ( - "github.com/onsi/gomega/types" -) - -//Ignore ignores the actual value and always succeeds. -// Expect(nil).To(Ignore()) -// Expect(true).To(Ignore()) -func Ignore() types.GomegaMatcher { - return &IgnoreMatcher{true} -} - -//Reject ignores the actual value and always fails. It can be used in conjunction with IgnoreMissing -//to catch problematic elements, or to verify tests are running. -// Expect(nil).NotTo(Reject()) -// Expect(true).NotTo(Reject()) -func Reject() types.GomegaMatcher { - return &IgnoreMatcher{false} -} - -// A matcher that either always succeeds or always fails. -type IgnoreMatcher struct { - Succeed bool -} - -func (m *IgnoreMatcher) Match(actual interface{}) (bool, error) { - return m.Succeed, nil -} - -func (m *IgnoreMatcher) FailureMessage(_ interface{}) (message string) { - return "Unconditional failure" -} - -func (m *IgnoreMatcher) NegatedFailureMessage(_ interface{}) (message string) { - return "Unconditional success" -} +package gstruct + +import ( + "github.com/onsi/gomega/types" +) + +//Ignore ignores the actual value and always succeeds. +// Expect(nil).To(Ignore()) +// Expect(true).To(Ignore()) +func Ignore() types.GomegaMatcher { + return &IgnoreMatcher{true} +} + +//Reject ignores the actual value and always fails. It can be used in conjunction with IgnoreMissing +//to catch problematic elements, or to verify tests are running. +// Expect(nil).NotTo(Reject()) +// Expect(true).NotTo(Reject()) +func Reject() types.GomegaMatcher { + return &IgnoreMatcher{false} +} + +// A matcher that either always succeeds or always fails. +type IgnoreMatcher struct { + Succeed bool +} + +func (m *IgnoreMatcher) Match(actual interface{}) (bool, error) { + return m.Succeed, nil +} + +func (m *IgnoreMatcher) FailureMessage(_ interface{}) (message string) { + return "Unconditional failure" +} + +func (m *IgnoreMatcher) NegatedFailureMessage(_ interface{}) (message string) { + return "Unconditional success" +} diff --git a/vendor/github.com/onsi/gomega/gstruct/ignore_test.go b/vendor/github.com/onsi/gomega/gstruct/ignore_test.go index 831ea8c2cb..70e1d40077 100644 --- a/vendor/github.com/onsi/gomega/gstruct/ignore_test.go +++ b/vendor/github.com/onsi/gomega/gstruct/ignore_test.go @@ -1,23 +1,23 @@ -package gstruct_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" -) - -var _ = Describe("Ignore", func() { - It("should always succeed", func() { - Ω(nil).Should(Ignore()) - Ω(struct{}{}).Should(Ignore()) - Ω(0).Should(Ignore()) - Ω(false).Should(Ignore()) - }) - - It("should always fail", func() { - Ω(nil).ShouldNot(Reject()) - Ω(struct{}{}).ShouldNot(Reject()) - Ω(1).ShouldNot(Reject()) - Ω(true).ShouldNot(Reject()) - }) -}) +package gstruct_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" +) + +var _ = Describe("Ignore", func() { + It("should always succeed", func() { + Ω(nil).Should(Ignore()) + Ω(struct{}{}).Should(Ignore()) + Ω(0).Should(Ignore()) + Ω(false).Should(Ignore()) + }) + + It("should always fail", func() { + Ω(nil).ShouldNot(Reject()) + Ω(struct{}{}).ShouldNot(Reject()) + Ω(1).ShouldNot(Reject()) + Ω(true).ShouldNot(Reject()) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gstruct/pointer.go b/vendor/github.com/onsi/gomega/gstruct/pointer.go index bd2892f2b9..0a2f35de31 100644 --- a/vendor/github.com/onsi/gomega/gstruct/pointer.go +++ b/vendor/github.com/onsi/gomega/gstruct/pointer.go @@ -1,56 +1,56 @@ -package gstruct - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" - "github.com/onsi/gomega/types" -) - -//PointTo applies the given matcher to the value pointed to by actual. It fails if the pointer is -//nil. -// actual := 5 -// Expect(&actual).To(PointTo(Equal(5))) -func PointTo(matcher types.GomegaMatcher) types.GomegaMatcher { - return &PointerMatcher{ - Matcher: matcher, - } -} - -type PointerMatcher struct { - Matcher types.GomegaMatcher - - // Failure message. - failure string -} - -func (m *PointerMatcher) Match(actual interface{}) (bool, error) { - val := reflect.ValueOf(actual) - - // return error if actual type is not a pointer - if val.Kind() != reflect.Ptr { - return false, fmt.Errorf("PointerMatcher expects a pointer but we have '%s'", val.Kind()) - } - - if !val.IsValid() || val.IsNil() { - m.failure = format.Message(actual, "not to be ") - return false, nil - } - - // Forward the value. - elem := val.Elem().Interface() - match, err := m.Matcher.Match(elem) - if !match { - m.failure = m.Matcher.FailureMessage(elem) - } - return match, err -} - -func (m *PointerMatcher) FailureMessage(_ interface{}) (message string) { - return m.failure -} - -func (m *PointerMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return m.Matcher.NegatedFailureMessage(actual) -} +package gstruct + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/types" +) + +//PointTo applies the given matcher to the value pointed to by actual. It fails if the pointer is +//nil. +// actual := 5 +// Expect(&actual).To(PointTo(Equal(5))) +func PointTo(matcher types.GomegaMatcher) types.GomegaMatcher { + return &PointerMatcher{ + Matcher: matcher, + } +} + +type PointerMatcher struct { + Matcher types.GomegaMatcher + + // Failure message. + failure string +} + +func (m *PointerMatcher) Match(actual interface{}) (bool, error) { + val := reflect.ValueOf(actual) + + // return error if actual type is not a pointer + if val.Kind() != reflect.Ptr { + return false, fmt.Errorf("PointerMatcher expects a pointer but we have '%s'", val.Kind()) + } + + if !val.IsValid() || val.IsNil() { + m.failure = format.Message(actual, "not to be ") + return false, nil + } + + // Forward the value. + elem := val.Elem().Interface() + match, err := m.Matcher.Match(elem) + if !match { + m.failure = m.Matcher.FailureMessage(elem) + } + return match, err +} + +func (m *PointerMatcher) FailureMessage(_ interface{}) (message string) { + return m.failure +} + +func (m *PointerMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return m.Matcher.NegatedFailureMessage(actual) +} diff --git a/vendor/github.com/onsi/gomega/gstruct/pointer_test.go b/vendor/github.com/onsi/gomega/gstruct/pointer_test.go index 1540e574ec..b02081c4ca 100644 --- a/vendor/github.com/onsi/gomega/gstruct/pointer_test.go +++ b/vendor/github.com/onsi/gomega/gstruct/pointer_test.go @@ -1,33 +1,33 @@ -package gstruct_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" -) - -var _ = Describe("PointTo", func() { - It("should fail when passed nil", func() { - var p *struct{} - Ω(p).Should(BeNil()) - }) - - It("should succeed when passed non-nil pointer", func() { - var s struct{} - Ω(&s).Should(PointTo(Ignore())) - }) - - It("should unwrap the pointee value", func() { - i := 1 - Ω(&i).Should(PointTo(Equal(1))) - Ω(&i).ShouldNot(PointTo(Equal(2))) - }) - - It("should work with nested pointers", func() { - i := 1 - ip := &i - ipp := &ip - Ω(ipp).Should(PointTo(PointTo(Equal(1)))) - Ω(ipp).ShouldNot(PointTo(PointTo(Equal(2)))) - }) -}) +package gstruct_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" +) + +var _ = Describe("PointTo", func() { + It("should fail when passed nil", func() { + var p *struct{} + Ω(p).Should(BeNil()) + }) + + It("should succeed when passed non-nil pointer", func() { + var s struct{} + Ω(&s).Should(PointTo(Ignore())) + }) + + It("should unwrap the pointee value", func() { + i := 1 + Ω(&i).Should(PointTo(Equal(1))) + Ω(&i).ShouldNot(PointTo(Equal(2))) + }) + + It("should work with nested pointers", func() { + i := 1 + ip := &i + ipp := &ip + Ω(ipp).Should(PointTo(PointTo(Equal(1)))) + Ω(ipp).ShouldNot(PointTo(PointTo(Equal(2)))) + }) +}) diff --git a/vendor/github.com/onsi/gomega/gstruct/types.go b/vendor/github.com/onsi/gomega/gstruct/types.go index 9e3d2f08d4..48cbbe8f66 100644 --- a/vendor/github.com/onsi/gomega/gstruct/types.go +++ b/vendor/github.com/onsi/gomega/gstruct/types.go @@ -1,15 +1,15 @@ -package gstruct - -//Options is the type for options passed to some matchers. -type Options int - -const ( - //IgnoreExtras tells the matcher to ignore extra elements or fields, rather than triggering a failure. - IgnoreExtras Options = 1 << iota - //IgnoreMissing tells the matcher to ignore missing elements or fields, rather than triggering a failure. - IgnoreMissing - //AllowDuplicates tells the matcher to permit multiple members of the slice to produce the same ID when - //considered by the indentifier function. All members that map to a given key must still match successfully - //with the matcher that is provided for that key. - AllowDuplicates -) +package gstruct + +//Options is the type for options passed to some matchers. +type Options int + +const ( + //IgnoreExtras tells the matcher to ignore extra elements or fields, rather than triggering a failure. + IgnoreExtras Options = 1 << iota + //IgnoreMissing tells the matcher to ignore missing elements or fields, rather than triggering a failure. + IgnoreMissing + //AllowDuplicates tells the matcher to permit multiple members of the slice to produce the same ID when + //considered by the indentifier function. All members that map to a given key must still match successfully + //with the matcher that is provided for that key. + AllowDuplicates +) diff --git a/vendor/github.com/onsi/gomega/internal/assertion/assertion.go b/vendor/github.com/onsi/gomega/internal/assertion/assertion.go index 0c9c74bad8..b73673f21e 100644 --- a/vendor/github.com/onsi/gomega/internal/assertion/assertion.go +++ b/vendor/github.com/onsi/gomega/internal/assertion/assertion.go @@ -1,98 +1,98 @@ -package assertion - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/types" -) - -type Assertion struct { - actualInput interface{} - fail types.GomegaFailHandler - offset int - extra []interface{} -} - -func New(actualInput interface{}, fail types.GomegaFailHandler, offset int, extra ...interface{}) *Assertion { - return &Assertion{ - actualInput: actualInput, - fail: fail, - offset: offset, - extra: extra, - } -} - -func (assertion *Assertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, true, optionalDescription...) -} - -func (assertion *Assertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) -} - -func (assertion *Assertion) To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, true, optionalDescription...) -} - -func (assertion *Assertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) -} - -func (assertion *Assertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) -} - -func (assertion *Assertion) buildDescription(optionalDescription ...interface{}) string { - switch len(optionalDescription) { - case 0: - return "" - default: - return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" - } -} - -func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { - matches, err := matcher.Match(assertion.actualInput) - description := assertion.buildDescription(optionalDescription...) - if err != nil { - assertion.fail(description+err.Error(), 2+assertion.offset) - return false - } - if matches != desiredMatch { - var message string - if desiredMatch { - message = matcher.FailureMessage(assertion.actualInput) - } else { - message = matcher.NegatedFailureMessage(assertion.actualInput) - } - assertion.fail(description+message, 2+assertion.offset) - return false - } - - return true -} - -func (assertion *Assertion) vetExtras(optionalDescription ...interface{}) bool { - success, message := vetExtras(assertion.extra) - if success { - return true - } - - description := assertion.buildDescription(optionalDescription...) - assertion.fail(description+message, 2+assertion.offset) - return false -} - -func vetExtras(extras []interface{}) (bool, string) { - for i, extra := range extras { - if extra != nil { - zeroValue := reflect.Zero(reflect.TypeOf(extra)).Interface() - if !reflect.DeepEqual(zeroValue, extra) { - message := fmt.Sprintf("Unexpected non-nil/non-zero extra argument at index %d:\n\t<%T>: %#v", i+1, extra, extra) - return false, message - } - } - } - return true, "" -} +package assertion + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/types" +) + +type Assertion struct { + actualInput interface{} + fail types.GomegaFailHandler + offset int + extra []interface{} +} + +func New(actualInput interface{}, fail types.GomegaFailHandler, offset int, extra ...interface{}) *Assertion { + return &Assertion{ + actualInput: actualInput, + fail: fail, + offset: offset, + extra: extra, + } +} + +func (assertion *Assertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, true, optionalDescription...) +} + +func (assertion *Assertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *Assertion) To(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, true, optionalDescription...) +} + +func (assertion *Assertion) ToNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *Assertion) NotTo(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.vetExtras(optionalDescription...) && assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *Assertion) buildDescription(optionalDescription ...interface{}) string { + switch len(optionalDescription) { + case 0: + return "" + default: + return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" + } +} + +func (assertion *Assertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { + matches, err := matcher.Match(assertion.actualInput) + description := assertion.buildDescription(optionalDescription...) + if err != nil { + assertion.fail(description+err.Error(), 2+assertion.offset) + return false + } + if matches != desiredMatch { + var message string + if desiredMatch { + message = matcher.FailureMessage(assertion.actualInput) + } else { + message = matcher.NegatedFailureMessage(assertion.actualInput) + } + assertion.fail(description+message, 2+assertion.offset) + return false + } + + return true +} + +func (assertion *Assertion) vetExtras(optionalDescription ...interface{}) bool { + success, message := vetExtras(assertion.extra) + if success { + return true + } + + description := assertion.buildDescription(optionalDescription...) + assertion.fail(description+message, 2+assertion.offset) + return false +} + +func vetExtras(extras []interface{}) (bool, string) { + for i, extra := range extras { + if extra != nil { + zeroValue := reflect.Zero(reflect.TypeOf(extra)).Interface() + if !reflect.DeepEqual(zeroValue, extra) { + message := fmt.Sprintf("Unexpected non-nil/non-zero extra argument at index %d:\n\t<%T>: %#v", i+1, extra, extra) + return false, message + } + } + } + return true, "" +} diff --git a/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go b/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go index dc44ad269c..dae47a48bf 100644 --- a/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go +++ b/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go @@ -1,13 +1,13 @@ -package assertion_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "testing" -) - -func TestAssertion(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Assertion Suite") -} +package assertion_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestAssertion(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Assertion Suite") +} diff --git a/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go b/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go index 7d45a3ccc2..c03b7a320c 100644 --- a/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go +++ b/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go @@ -1,252 +1,252 @@ -package assertion_test - -import ( - "errors" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/internal/assertion" - "github.com/onsi/gomega/internal/fakematcher" -) - -var _ = Describe("Assertion", func() { - var ( - a *Assertion - failureMessage string - failureCallerSkip int - matcher *fakematcher.FakeMatcher - ) - - input := "The thing I'm testing" - - var fakeFailHandler = func(message string, callerSkip ...int) { - failureMessage = message - if len(callerSkip) == 1 { - failureCallerSkip = callerSkip[0] - } - } - - BeforeEach(func() { - matcher = &fakematcher.FakeMatcher{} - failureMessage = "" - failureCallerSkip = 0 - a = New(input, fakeFailHandler, 1) - }) - - Context("when called", func() { - It("should pass the provided input value to the matcher", func() { - a.Should(matcher) - - Ω(matcher.ReceivedActual).Should(Equal(input)) - matcher.ReceivedActual = "" - - a.ShouldNot(matcher) - - Ω(matcher.ReceivedActual).Should(Equal(input)) - matcher.ReceivedActual = "" - - a.To(matcher) - - Ω(matcher.ReceivedActual).Should(Equal(input)) - matcher.ReceivedActual = "" - - a.ToNot(matcher) - - Ω(matcher.ReceivedActual).Should(Equal(input)) - matcher.ReceivedActual = "" - - a.NotTo(matcher) - - Ω(matcher.ReceivedActual).Should(Equal(input)) - }) - }) - - Context("when the matcher succeeds", func() { - BeforeEach(func() { - matcher.MatchesToReturn = true - matcher.ErrToReturn = nil - }) - - Context("and a positive assertion is being made", func() { - It("should not call the failure callback", func() { - a.Should(matcher) - Ω(failureMessage).Should(Equal("")) - }) - - It("should be true", func() { - Ω(a.Should(matcher)).Should(BeTrue()) - }) - }) - - Context("and a negative assertion is being made", func() { - It("should call the failure callback", func() { - a.ShouldNot(matcher) - Ω(failureMessage).Should(Equal("negative: The thing I'm testing")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - - It("should be false", func() { - Ω(a.ShouldNot(matcher)).Should(BeFalse()) - }) - }) - }) - - Context("when the matcher fails", func() { - BeforeEach(func() { - matcher.MatchesToReturn = false - matcher.ErrToReturn = nil - }) - - Context("and a positive assertion is being made", func() { - It("should call the failure callback", func() { - a.Should(matcher) - Ω(failureMessage).Should(Equal("positive: The thing I'm testing")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - - It("should be false", func() { - Ω(a.Should(matcher)).Should(BeFalse()) - }) - }) - - Context("and a negative assertion is being made", func() { - It("should not call the failure callback", func() { - a.ShouldNot(matcher) - Ω(failureMessage).Should(Equal("")) - }) - - It("should be true", func() { - Ω(a.ShouldNot(matcher)).Should(BeTrue()) - }) - }) - }) - - Context("When reporting a failure", func() { - BeforeEach(func() { - matcher.MatchesToReturn = false - matcher.ErrToReturn = nil - }) - - Context("and there is an optional description", func() { - It("should append the description to the failure message", func() { - a.Should(matcher, "A description") - Ω(failureMessage).Should(Equal("A description\npositive: The thing I'm testing")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - }) - - Context("and there are multiple arguments to the optional description", func() { - It("should append the formatted description to the failure message", func() { - a.Should(matcher, "A description of [%d]", 3) - Ω(failureMessage).Should(Equal("A description of [3]\npositive: The thing I'm testing")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - }) - }) - - Context("When the matcher returns an error", func() { - BeforeEach(func() { - matcher.ErrToReturn = errors.New("Kaboom!") - }) - - Context("and a positive assertion is being made", func() { - It("should call the failure callback", func() { - matcher.MatchesToReturn = true - a.Should(matcher) - Ω(failureMessage).Should(Equal("Kaboom!")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - }) - - Context("and a negative assertion is being made", func() { - It("should call the failure callback", func() { - matcher.MatchesToReturn = false - a.ShouldNot(matcher) - Ω(failureMessage).Should(Equal("Kaboom!")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - }) - - It("should always be false", func() { - Ω(a.Should(matcher)).Should(BeFalse()) - Ω(a.ShouldNot(matcher)).Should(BeFalse()) - }) - }) - - Context("when there are extra parameters", func() { - It("(a simple example)", func() { - Ω(func() (string, int, error) { - return "foo", 0, nil - }()).Should(Equal("foo")) - }) - - Context("when the parameters are all nil or zero", func() { - It("should invoke the matcher", func() { - matcher.MatchesToReturn = true - matcher.ErrToReturn = nil - - var typedNil []string - a = New(input, fakeFailHandler, 1, 0, nil, typedNil) - - result := a.Should(matcher) - Ω(result).Should(BeTrue()) - Ω(matcher.ReceivedActual).Should(Equal(input)) - - Ω(failureMessage).Should(BeZero()) - }) - }) - - Context("when any of the parameters are not nil or zero", func() { - It("should call the failure callback", func() { - matcher.MatchesToReturn = false - matcher.ErrToReturn = nil - - a = New(input, fakeFailHandler, 1, errors.New("foo")) - result := a.Should(matcher) - Ω(result).Should(BeFalse()) - Ω(matcher.ReceivedActual).Should(BeZero(), "The matcher doesn't even get called") - Ω(failureMessage).Should(ContainSubstring("foo")) - failureMessage = "" - - a = New(input, fakeFailHandler, 1, nil, 1) - result = a.ShouldNot(matcher) - Ω(result).Should(BeFalse()) - Ω(failureMessage).Should(ContainSubstring("1")) - failureMessage = "" - - a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"}) - result = a.To(matcher) - Ω(result).Should(BeFalse()) - Ω(failureMessage).Should(ContainSubstring("foo")) - failureMessage = "" - - a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"}) - result = a.ToNot(matcher) - Ω(result).Should(BeFalse()) - Ω(failureMessage).Should(ContainSubstring("foo")) - failureMessage = "" - - a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"}) - result = a.NotTo(matcher) - Ω(result).Should(BeFalse()) - Ω(failureMessage).Should(ContainSubstring("foo")) - Ω(failureCallerSkip).Should(Equal(3)) - }) - }) - }) - - Context("Making an assertion without a registered fail handler", func() { - It("should panic", func() { - defer func() { - e := recover() - RegisterFailHandler(Fail) - if e == nil { - Fail("expected a panic to have occurred") - } - }() - - RegisterFailHandler(nil) - Ω(true).Should(BeTrue()) - }) - }) -}) +package assertion_test + +import ( + "errors" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/internal/assertion" + "github.com/onsi/gomega/internal/fakematcher" +) + +var _ = Describe("Assertion", func() { + var ( + a *Assertion + failureMessage string + failureCallerSkip int + matcher *fakematcher.FakeMatcher + ) + + input := "The thing I'm testing" + + var fakeFailHandler = func(message string, callerSkip ...int) { + failureMessage = message + if len(callerSkip) == 1 { + failureCallerSkip = callerSkip[0] + } + } + + BeforeEach(func() { + matcher = &fakematcher.FakeMatcher{} + failureMessage = "" + failureCallerSkip = 0 + a = New(input, fakeFailHandler, 1) + }) + + Context("when called", func() { + It("should pass the provided input value to the matcher", func() { + a.Should(matcher) + + Ω(matcher.ReceivedActual).Should(Equal(input)) + matcher.ReceivedActual = "" + + a.ShouldNot(matcher) + + Ω(matcher.ReceivedActual).Should(Equal(input)) + matcher.ReceivedActual = "" + + a.To(matcher) + + Ω(matcher.ReceivedActual).Should(Equal(input)) + matcher.ReceivedActual = "" + + a.ToNot(matcher) + + Ω(matcher.ReceivedActual).Should(Equal(input)) + matcher.ReceivedActual = "" + + a.NotTo(matcher) + + Ω(matcher.ReceivedActual).Should(Equal(input)) + }) + }) + + Context("when the matcher succeeds", func() { + BeforeEach(func() { + matcher.MatchesToReturn = true + matcher.ErrToReturn = nil + }) + + Context("and a positive assertion is being made", func() { + It("should not call the failure callback", func() { + a.Should(matcher) + Ω(failureMessage).Should(Equal("")) + }) + + It("should be true", func() { + Ω(a.Should(matcher)).Should(BeTrue()) + }) + }) + + Context("and a negative assertion is being made", func() { + It("should call the failure callback", func() { + a.ShouldNot(matcher) + Ω(failureMessage).Should(Equal("negative: The thing I'm testing")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + + It("should be false", func() { + Ω(a.ShouldNot(matcher)).Should(BeFalse()) + }) + }) + }) + + Context("when the matcher fails", func() { + BeforeEach(func() { + matcher.MatchesToReturn = false + matcher.ErrToReturn = nil + }) + + Context("and a positive assertion is being made", func() { + It("should call the failure callback", func() { + a.Should(matcher) + Ω(failureMessage).Should(Equal("positive: The thing I'm testing")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + + It("should be false", func() { + Ω(a.Should(matcher)).Should(BeFalse()) + }) + }) + + Context("and a negative assertion is being made", func() { + It("should not call the failure callback", func() { + a.ShouldNot(matcher) + Ω(failureMessage).Should(Equal("")) + }) + + It("should be true", func() { + Ω(a.ShouldNot(matcher)).Should(BeTrue()) + }) + }) + }) + + Context("When reporting a failure", func() { + BeforeEach(func() { + matcher.MatchesToReturn = false + matcher.ErrToReturn = nil + }) + + Context("and there is an optional description", func() { + It("should append the description to the failure message", func() { + a.Should(matcher, "A description") + Ω(failureMessage).Should(Equal("A description\npositive: The thing I'm testing")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + }) + + Context("and there are multiple arguments to the optional description", func() { + It("should append the formatted description to the failure message", func() { + a.Should(matcher, "A description of [%d]", 3) + Ω(failureMessage).Should(Equal("A description of [3]\npositive: The thing I'm testing")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + }) + }) + + Context("When the matcher returns an error", func() { + BeforeEach(func() { + matcher.ErrToReturn = errors.New("Kaboom!") + }) + + Context("and a positive assertion is being made", func() { + It("should call the failure callback", func() { + matcher.MatchesToReturn = true + a.Should(matcher) + Ω(failureMessage).Should(Equal("Kaboom!")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + }) + + Context("and a negative assertion is being made", func() { + It("should call the failure callback", func() { + matcher.MatchesToReturn = false + a.ShouldNot(matcher) + Ω(failureMessage).Should(Equal("Kaboom!")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + }) + + It("should always be false", func() { + Ω(a.Should(matcher)).Should(BeFalse()) + Ω(a.ShouldNot(matcher)).Should(BeFalse()) + }) + }) + + Context("when there are extra parameters", func() { + It("(a simple example)", func() { + Ω(func() (string, int, error) { + return "foo", 0, nil + }()).Should(Equal("foo")) + }) + + Context("when the parameters are all nil or zero", func() { + It("should invoke the matcher", func() { + matcher.MatchesToReturn = true + matcher.ErrToReturn = nil + + var typedNil []string + a = New(input, fakeFailHandler, 1, 0, nil, typedNil) + + result := a.Should(matcher) + Ω(result).Should(BeTrue()) + Ω(matcher.ReceivedActual).Should(Equal(input)) + + Ω(failureMessage).Should(BeZero()) + }) + }) + + Context("when any of the parameters are not nil or zero", func() { + It("should call the failure callback", func() { + matcher.MatchesToReturn = false + matcher.ErrToReturn = nil + + a = New(input, fakeFailHandler, 1, errors.New("foo")) + result := a.Should(matcher) + Ω(result).Should(BeFalse()) + Ω(matcher.ReceivedActual).Should(BeZero(), "The matcher doesn't even get called") + Ω(failureMessage).Should(ContainSubstring("foo")) + failureMessage = "" + + a = New(input, fakeFailHandler, 1, nil, 1) + result = a.ShouldNot(matcher) + Ω(result).Should(BeFalse()) + Ω(failureMessage).Should(ContainSubstring("1")) + failureMessage = "" + + a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"}) + result = a.To(matcher) + Ω(result).Should(BeFalse()) + Ω(failureMessage).Should(ContainSubstring("foo")) + failureMessage = "" + + a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"}) + result = a.ToNot(matcher) + Ω(result).Should(BeFalse()) + Ω(failureMessage).Should(ContainSubstring("foo")) + failureMessage = "" + + a = New(input, fakeFailHandler, 1, nil, 0, []string{"foo"}) + result = a.NotTo(matcher) + Ω(result).Should(BeFalse()) + Ω(failureMessage).Should(ContainSubstring("foo")) + Ω(failureCallerSkip).Should(Equal(3)) + }) + }) + }) + + Context("Making an assertion without a registered fail handler", func() { + It("should panic", func() { + defer func() { + e := recover() + RegisterFailHandler(Fail) + if e == nil { + Fail("expected a panic to have occurred") + } + }() + + RegisterFailHandler(nil) + Ω(true).Should(BeTrue()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go index 9b0cb1147d..bce0853006 100644 --- a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go +++ b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go @@ -1,189 +1,189 @@ -package asyncassertion - -import ( - "errors" - "fmt" - "reflect" - "time" - - "github.com/onsi/gomega/internal/oraclematcher" - "github.com/onsi/gomega/types" -) - -type AsyncAssertionType uint - -const ( - AsyncAssertionTypeEventually AsyncAssertionType = iota - AsyncAssertionTypeConsistently -) - -type AsyncAssertion struct { - asyncType AsyncAssertionType - actualInput interface{} - timeoutInterval time.Duration - pollingInterval time.Duration - fail types.GomegaFailHandler - offset int -} - -func New(asyncType AsyncAssertionType, actualInput interface{}, fail types.GomegaFailHandler, timeoutInterval time.Duration, pollingInterval time.Duration, offset int) *AsyncAssertion { - actualType := reflect.TypeOf(actualInput) - if actualType.Kind() == reflect.Func { - if actualType.NumIn() != 0 || actualType.NumOut() == 0 { - panic("Expected a function with no arguments and one or more return values.") - } - } - - return &AsyncAssertion{ - asyncType: asyncType, - actualInput: actualInput, - fail: fail, - timeoutInterval: timeoutInterval, - pollingInterval: pollingInterval, - offset: offset, - } -} - -func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.match(matcher, true, optionalDescription...) -} - -func (assertion *AsyncAssertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { - return assertion.match(matcher, false, optionalDescription...) -} - -func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interface{}) string { - switch len(optionalDescription) { - case 0: - return "" - default: - return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" - } -} - -func (assertion *AsyncAssertion) actualInputIsAFunction() bool { - actualType := reflect.TypeOf(assertion.actualInput) - return actualType.Kind() == reflect.Func && actualType.NumIn() == 0 && actualType.NumOut() > 0 -} - -func (assertion *AsyncAssertion) pollActual() (interface{}, error) { - if assertion.actualInputIsAFunction() { - values := reflect.ValueOf(assertion.actualInput).Call([]reflect.Value{}) - - extras := []interface{}{} - for _, value := range values[1:] { - extras = append(extras, value.Interface()) - } - - success, message := vetExtras(extras) - - if !success { - return nil, errors.New(message) - } - - return values[0].Interface(), nil - } - - return assertion.actualInput, nil -} - -func (assertion *AsyncAssertion) matcherMayChange(matcher types.GomegaMatcher, value interface{}) bool { - if assertion.actualInputIsAFunction() { - return true - } - - return oraclematcher.MatchMayChangeInTheFuture(matcher, value) -} - -func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { - timer := time.Now() - timeout := time.After(assertion.timeoutInterval) - - description := assertion.buildDescription(optionalDescription...) - - var matches bool - var err error - mayChange := true - value, err := assertion.pollActual() - if err == nil { - mayChange = assertion.matcherMayChange(matcher, value) - matches, err = matcher.Match(value) - } - - fail := func(preamble string) { - errMsg := "" - message := "" - if err != nil { - errMsg = "Error: " + err.Error() - } else { - if desiredMatch { - message = matcher.FailureMessage(value) - } else { - message = matcher.NegatedFailureMessage(value) - } - } - assertion.fail(fmt.Sprintf("%s after %.3fs.\n%s%s%s", preamble, time.Since(timer).Seconds(), description, message, errMsg), 3+assertion.offset) - } - - if assertion.asyncType == AsyncAssertionTypeEventually { - for { - if err == nil && matches == desiredMatch { - return true - } - - if !mayChange { - fail("No future change is possible. Bailing out early") - return false - } - - select { - case <-time.After(assertion.pollingInterval): - value, err = assertion.pollActual() - if err == nil { - mayChange = assertion.matcherMayChange(matcher, value) - matches, err = matcher.Match(value) - } - case <-timeout: - fail("Timed out") - return false - } - } - } else if assertion.asyncType == AsyncAssertionTypeConsistently { - for { - if !(err == nil && matches == desiredMatch) { - fail("Failed") - return false - } - - if !mayChange { - return true - } - - select { - case <-time.After(assertion.pollingInterval): - value, err = assertion.pollActual() - if err == nil { - mayChange = assertion.matcherMayChange(matcher, value) - matches, err = matcher.Match(value) - } - case <-timeout: - return true - } - } - } - - return false -} - -func vetExtras(extras []interface{}) (bool, string) { - for i, extra := range extras { - if extra != nil { - zeroValue := reflect.Zero(reflect.TypeOf(extra)).Interface() - if !reflect.DeepEqual(zeroValue, extra) { - message := fmt.Sprintf("Unexpected non-nil/non-zero extra argument at index %d:\n\t<%T>: %#v", i+1, extra, extra) - return false, message - } - } - } - return true, "" -} +package asyncassertion + +import ( + "errors" + "fmt" + "reflect" + "time" + + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type AsyncAssertionType uint + +const ( + AsyncAssertionTypeEventually AsyncAssertionType = iota + AsyncAssertionTypeConsistently +) + +type AsyncAssertion struct { + asyncType AsyncAssertionType + actualInput interface{} + timeoutInterval time.Duration + pollingInterval time.Duration + fail types.GomegaFailHandler + offset int +} + +func New(asyncType AsyncAssertionType, actualInput interface{}, fail types.GomegaFailHandler, timeoutInterval time.Duration, pollingInterval time.Duration, offset int) *AsyncAssertion { + actualType := reflect.TypeOf(actualInput) + if actualType.Kind() == reflect.Func { + if actualType.NumIn() != 0 || actualType.NumOut() == 0 { + panic("Expected a function with no arguments and one or more return values.") + } + } + + return &AsyncAssertion{ + asyncType: asyncType, + actualInput: actualInput, + fail: fail, + timeoutInterval: timeoutInterval, + pollingInterval: pollingInterval, + offset: offset, + } +} + +func (assertion *AsyncAssertion) Should(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.match(matcher, true, optionalDescription...) +} + +func (assertion *AsyncAssertion) ShouldNot(matcher types.GomegaMatcher, optionalDescription ...interface{}) bool { + return assertion.match(matcher, false, optionalDescription...) +} + +func (assertion *AsyncAssertion) buildDescription(optionalDescription ...interface{}) string { + switch len(optionalDescription) { + case 0: + return "" + default: + return fmt.Sprintf(optionalDescription[0].(string), optionalDescription[1:]...) + "\n" + } +} + +func (assertion *AsyncAssertion) actualInputIsAFunction() bool { + actualType := reflect.TypeOf(assertion.actualInput) + return actualType.Kind() == reflect.Func && actualType.NumIn() == 0 && actualType.NumOut() > 0 +} + +func (assertion *AsyncAssertion) pollActual() (interface{}, error) { + if assertion.actualInputIsAFunction() { + values := reflect.ValueOf(assertion.actualInput).Call([]reflect.Value{}) + + extras := []interface{}{} + for _, value := range values[1:] { + extras = append(extras, value.Interface()) + } + + success, message := vetExtras(extras) + + if !success { + return nil, errors.New(message) + } + + return values[0].Interface(), nil + } + + return assertion.actualInput, nil +} + +func (assertion *AsyncAssertion) matcherMayChange(matcher types.GomegaMatcher, value interface{}) bool { + if assertion.actualInputIsAFunction() { + return true + } + + return oraclematcher.MatchMayChangeInTheFuture(matcher, value) +} + +func (assertion *AsyncAssertion) match(matcher types.GomegaMatcher, desiredMatch bool, optionalDescription ...interface{}) bool { + timer := time.Now() + timeout := time.After(assertion.timeoutInterval) + + description := assertion.buildDescription(optionalDescription...) + + var matches bool + var err error + mayChange := true + value, err := assertion.pollActual() + if err == nil { + mayChange = assertion.matcherMayChange(matcher, value) + matches, err = matcher.Match(value) + } + + fail := func(preamble string) { + errMsg := "" + message := "" + if err != nil { + errMsg = "Error: " + err.Error() + } else { + if desiredMatch { + message = matcher.FailureMessage(value) + } else { + message = matcher.NegatedFailureMessage(value) + } + } + assertion.fail(fmt.Sprintf("%s after %.3fs.\n%s%s%s", preamble, time.Since(timer).Seconds(), description, message, errMsg), 3+assertion.offset) + } + + if assertion.asyncType == AsyncAssertionTypeEventually { + for { + if err == nil && matches == desiredMatch { + return true + } + + if !mayChange { + fail("No future change is possible. Bailing out early") + return false + } + + select { + case <-time.After(assertion.pollingInterval): + value, err = assertion.pollActual() + if err == nil { + mayChange = assertion.matcherMayChange(matcher, value) + matches, err = matcher.Match(value) + } + case <-timeout: + fail("Timed out") + return false + } + } + } else if assertion.asyncType == AsyncAssertionTypeConsistently { + for { + if !(err == nil && matches == desiredMatch) { + fail("Failed") + return false + } + + if !mayChange { + return true + } + + select { + case <-time.After(assertion.pollingInterval): + value, err = assertion.pollActual() + if err == nil { + mayChange = assertion.matcherMayChange(matcher, value) + matches, err = matcher.Match(value) + } + case <-timeout: + return true + } + } + } + + return false +} + +func vetExtras(extras []interface{}) (bool, string) { + for i, extra := range extras { + if extra != nil { + zeroValue := reflect.Zero(reflect.TypeOf(extra)).Interface() + if !reflect.DeepEqual(zeroValue, extra) { + message := fmt.Sprintf("Unexpected non-nil/non-zero extra argument at index %d:\n\t<%T>: %#v", i+1, extra, extra) + return false, message + } + } + } + return true, "" +} diff --git a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go index 1fd01ff9a7..bdb0c3d220 100644 --- a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go +++ b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go @@ -1,13 +1,13 @@ -package asyncassertion_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "testing" -) - -func TestAsyncAssertion(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "AsyncAssertion Suite") -} +package asyncassertion_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestAsyncAssertion(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "AsyncAssertion Suite") +} diff --git a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go index a46ce40064..3d7e3489d1 100644 --- a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go +++ b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go @@ -1,345 +1,345 @@ -package asyncassertion_test - -import ( - "errors" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/internal/asyncassertion" -) - -var _ = Describe("Async Assertion", func() { - var ( - failureMessage string - callerSkip int - ) - - var fakeFailHandler = func(message string, skip ...int) { - failureMessage = message - callerSkip = skip[0] - } - - BeforeEach(func() { - failureMessage = "" - callerSkip = 0 - }) - - Describe("Eventually", func() { - Context("the positive case", func() { - It("should poll the function and matcher", func() { - counter := 0 - a := New(AsyncAssertionTypeEventually, func() int { - counter++ - return counter - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.Should(BeNumerically("==", 5)) - Ω(failureMessage).Should(BeZero()) - }) - - It("should continue when the matcher errors", func() { - counter := 0 - a := New(AsyncAssertionTypeEventually, func() interface{} { - counter++ - if counter == 5 { - return "not-a-number" //this should cause the matcher to error - } - return counter - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.Should(BeNumerically("==", 5), "My description %d", 2) - - Ω(failureMessage).Should(ContainSubstring("Timed out after")) - Ω(failureMessage).Should(ContainSubstring("My description 2")) - Ω(callerSkip).Should(Equal(4)) - }) - - It("should be able to timeout", func() { - counter := 0 - a := New(AsyncAssertionTypeEventually, func() int { - counter++ - return counter - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.Should(BeNumerically(">", 100), "My description %d", 2) - - Ω(counter).Should(BeNumerically(">", 8)) - Ω(counter).Should(BeNumerically("<=", 10)) - Ω(failureMessage).Should(ContainSubstring("Timed out after")) - Ω(failureMessage).Should(MatchRegexp(`\: \d`), "Should pass the correct value to the matcher message formatter.") - Ω(failureMessage).Should(ContainSubstring("My description 2")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - - Context("the negative case", func() { - It("should poll the function and matcher", func() { - counter := 0 - a := New(AsyncAssertionTypeEventually, func() int { - counter += 1 - return counter - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.ShouldNot(BeNumerically("<", 3)) - - Ω(counter).Should(Equal(3)) - Ω(failureMessage).Should(BeZero()) - }) - - It("should timeout when the matcher errors", func() { - a := New(AsyncAssertionTypeEventually, func() interface{} { - return 0 //this should cause the matcher to error - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.ShouldNot(HaveLen(0), "My description %d", 2) - - Ω(failureMessage).Should(ContainSubstring("Timed out after")) - Ω(failureMessage).Should(ContainSubstring("Error:")) - Ω(failureMessage).Should(ContainSubstring("My description 2")) - Ω(callerSkip).Should(Equal(4)) - }) - - It("should be able to timeout", func() { - a := New(AsyncAssertionTypeEventually, func() int { - return 0 - }, fakeFailHandler, time.Duration(0.1*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.ShouldNot(Equal(0), "My description %d", 2) - - Ω(failureMessage).Should(ContainSubstring("Timed out after")) - Ω(failureMessage).Should(ContainSubstring(": 0"), "Should pass the correct value to the matcher message formatter.") - Ω(failureMessage).Should(ContainSubstring("My description 2")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - - Context("with a function that returns multiple values", func() { - It("should eventually succeed if the additional arguments are nil", func() { - i := 0 - Eventually(func() (int, error) { - i++ - return i, nil - }).Should(Equal(10)) - }) - - It("should eventually timeout if the additional arguments are not nil", func() { - i := 0 - a := New(AsyncAssertionTypeEventually, func() (int, error) { - i++ - return i, errors.New("bam") - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - a.Should(Equal(2)) - - Ω(failureMessage).Should(ContainSubstring("Timed out after")) - Ω(failureMessage).Should(ContainSubstring("Error:")) - Ω(failureMessage).Should(ContainSubstring("bam")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - - Context("Making an assertion without a registered fail handler", func() { - It("should panic", func() { - defer func() { - e := recover() - RegisterFailHandler(Fail) - if e == nil { - Fail("expected a panic to have occurred") - } - }() - - RegisterFailHandler(nil) - c := make(chan bool, 1) - c <- true - Eventually(c).Should(Receive()) - }) - }) - }) - - Describe("Consistently", func() { - Describe("The positive case", func() { - Context("when the matcher consistently passes for the duration", func() { - It("should pass", func() { - calls := 0 - a := New(AsyncAssertionTypeConsistently, func() string { - calls++ - return "foo" - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.Should(Equal("foo")) - Ω(calls).Should(BeNumerically(">", 8)) - Ω(calls).Should(BeNumerically("<=", 10)) - Ω(failureMessage).Should(BeZero()) - }) - }) - - Context("when the matcher fails at some point", func() { - It("should fail", func() { - calls := 0 - a := New(AsyncAssertionTypeConsistently, func() interface{} { - calls++ - if calls > 5 { - return "bar" - } - return "foo" - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.Should(Equal("foo")) - Ω(failureMessage).Should(ContainSubstring("to equal")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - - Context("when the matcher errors at some point", func() { - It("should fail", func() { - calls := 0 - a := New(AsyncAssertionTypeConsistently, func() interface{} { - calls++ - if calls > 5 { - return 3 - } - return []int{1, 2, 3} - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.Should(HaveLen(3)) - Ω(failureMessage).Should(ContainSubstring("HaveLen matcher expects")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - }) - - Describe("The negative case", func() { - Context("when the matcher consistently passes for the duration", func() { - It("should pass", func() { - c := make(chan bool) - a := New(AsyncAssertionTypeConsistently, c, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.ShouldNot(Receive()) - Ω(failureMessage).Should(BeZero()) - }) - }) - - Context("when the matcher fails at some point", func() { - It("should fail", func() { - c := make(chan bool) - go func() { - time.Sleep(time.Duration(100 * time.Millisecond)) - c <- true - }() - - a := New(AsyncAssertionTypeConsistently, c, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.ShouldNot(Receive()) - Ω(failureMessage).Should(ContainSubstring("not to receive anything")) - }) - }) - - Context("when the matcher errors at some point", func() { - It("should fail", func() { - calls := 0 - a := New(AsyncAssertionTypeConsistently, func() interface{} { - calls++ - return calls - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - - a.ShouldNot(BeNumerically(">", 5)) - Ω(failureMessage).Should(ContainSubstring("not to be >")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - }) - - Context("with a function that returns multiple values", func() { - It("should consistently succeed if the additional arguments are nil", func() { - i := 2 - Consistently(func() (int, error) { - i++ - return i, nil - }).Should(BeNumerically(">=", 2)) - }) - - It("should eventually timeout if the additional arguments are not nil", func() { - i := 2 - a := New(AsyncAssertionTypeEventually, func() (int, error) { - i++ - return i, errors.New("bam") - }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) - a.Should(BeNumerically(">=", 2)) - - Ω(failureMessage).Should(ContainSubstring("Error:")) - Ω(failureMessage).Should(ContainSubstring("bam")) - Ω(callerSkip).Should(Equal(4)) - }) - }) - - Context("Making an assertion without a registered fail handler", func() { - It("should panic", func() { - defer func() { - e := recover() - RegisterFailHandler(Fail) - if e == nil { - Fail("expected a panic to have occurred") - } - }() - - RegisterFailHandler(nil) - c := make(chan bool) - Consistently(c).ShouldNot(Receive()) - }) - }) - }) - - Context("when passed a function with the wrong # or arguments & returns", func() { - It("should panic", func() { - Ω(func() { - New(AsyncAssertionTypeEventually, func() {}, fakeFailHandler, 0, 0, 1) - }).Should(Panic()) - - Ω(func() { - New(AsyncAssertionTypeEventually, func(a string) int { return 0 }, fakeFailHandler, 0, 0, 1) - }).Should(Panic()) - - Ω(func() { - New(AsyncAssertionTypeEventually, func() int { return 0 }, fakeFailHandler, 0, 0, 1) - }).ShouldNot(Panic()) - - Ω(func() { - New(AsyncAssertionTypeEventually, func() (int, error) { return 0, nil }, fakeFailHandler, 0, 0, 1) - }).ShouldNot(Panic()) - }) - }) - - Describe("bailing early", func() { - Context("when actual is a value", func() { - It("Eventually should bail out and fail early if the matcher says to", func() { - c := make(chan bool) - close(c) - - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(c, 0.1).Should(Receive()) - }) - Ω(time.Since(t)).Should(BeNumerically("<", 90*time.Millisecond)) - - Ω(failures).Should(HaveLen(1)) - }) - }) - - Context("when actual is a function", func() { - It("should never bail early", func() { - c := make(chan bool) - close(c) - - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(func() chan bool { - return c - }, 0.1).Should(Receive()) - }) - Ω(time.Since(t)).Should(BeNumerically(">=", 90*time.Millisecond)) - - Ω(failures).Should(HaveLen(1)) - }) - }) - }) -}) +package asyncassertion_test + +import ( + "errors" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/internal/asyncassertion" +) + +var _ = Describe("Async Assertion", func() { + var ( + failureMessage string + callerSkip int + ) + + var fakeFailHandler = func(message string, skip ...int) { + failureMessage = message + callerSkip = skip[0] + } + + BeforeEach(func() { + failureMessage = "" + callerSkip = 0 + }) + + Describe("Eventually", func() { + Context("the positive case", func() { + It("should poll the function and matcher", func() { + counter := 0 + a := New(AsyncAssertionTypeEventually, func() int { + counter++ + return counter + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.Should(BeNumerically("==", 5)) + Ω(failureMessage).Should(BeZero()) + }) + + It("should continue when the matcher errors", func() { + counter := 0 + a := New(AsyncAssertionTypeEventually, func() interface{} { + counter++ + if counter == 5 { + return "not-a-number" //this should cause the matcher to error + } + return counter + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.Should(BeNumerically("==", 5), "My description %d", 2) + + Ω(failureMessage).Should(ContainSubstring("Timed out after")) + Ω(failureMessage).Should(ContainSubstring("My description 2")) + Ω(callerSkip).Should(Equal(4)) + }) + + It("should be able to timeout", func() { + counter := 0 + a := New(AsyncAssertionTypeEventually, func() int { + counter++ + return counter + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.Should(BeNumerically(">", 100), "My description %d", 2) + + Ω(counter).Should(BeNumerically(">", 8)) + Ω(counter).Should(BeNumerically("<=", 10)) + Ω(failureMessage).Should(ContainSubstring("Timed out after")) + Ω(failureMessage).Should(MatchRegexp(`\: \d`), "Should pass the correct value to the matcher message formatter.") + Ω(failureMessage).Should(ContainSubstring("My description 2")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + + Context("the negative case", func() { + It("should poll the function and matcher", func() { + counter := 0 + a := New(AsyncAssertionTypeEventually, func() int { + counter += 1 + return counter + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.ShouldNot(BeNumerically("<", 3)) + + Ω(counter).Should(Equal(3)) + Ω(failureMessage).Should(BeZero()) + }) + + It("should timeout when the matcher errors", func() { + a := New(AsyncAssertionTypeEventually, func() interface{} { + return 0 //this should cause the matcher to error + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.ShouldNot(HaveLen(0), "My description %d", 2) + + Ω(failureMessage).Should(ContainSubstring("Timed out after")) + Ω(failureMessage).Should(ContainSubstring("Error:")) + Ω(failureMessage).Should(ContainSubstring("My description 2")) + Ω(callerSkip).Should(Equal(4)) + }) + + It("should be able to timeout", func() { + a := New(AsyncAssertionTypeEventually, func() int { + return 0 + }, fakeFailHandler, time.Duration(0.1*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.ShouldNot(Equal(0), "My description %d", 2) + + Ω(failureMessage).Should(ContainSubstring("Timed out after")) + Ω(failureMessage).Should(ContainSubstring(": 0"), "Should pass the correct value to the matcher message formatter.") + Ω(failureMessage).Should(ContainSubstring("My description 2")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + + Context("with a function that returns multiple values", func() { + It("should eventually succeed if the additional arguments are nil", func() { + i := 0 + Eventually(func() (int, error) { + i++ + return i, nil + }).Should(Equal(10)) + }) + + It("should eventually timeout if the additional arguments are not nil", func() { + i := 0 + a := New(AsyncAssertionTypeEventually, func() (int, error) { + i++ + return i, errors.New("bam") + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + a.Should(Equal(2)) + + Ω(failureMessage).Should(ContainSubstring("Timed out after")) + Ω(failureMessage).Should(ContainSubstring("Error:")) + Ω(failureMessage).Should(ContainSubstring("bam")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + + Context("Making an assertion without a registered fail handler", func() { + It("should panic", func() { + defer func() { + e := recover() + RegisterFailHandler(Fail) + if e == nil { + Fail("expected a panic to have occurred") + } + }() + + RegisterFailHandler(nil) + c := make(chan bool, 1) + c <- true + Eventually(c).Should(Receive()) + }) + }) + }) + + Describe("Consistently", func() { + Describe("The positive case", func() { + Context("when the matcher consistently passes for the duration", func() { + It("should pass", func() { + calls := 0 + a := New(AsyncAssertionTypeConsistently, func() string { + calls++ + return "foo" + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.Should(Equal("foo")) + Ω(calls).Should(BeNumerically(">", 8)) + Ω(calls).Should(BeNumerically("<=", 10)) + Ω(failureMessage).Should(BeZero()) + }) + }) + + Context("when the matcher fails at some point", func() { + It("should fail", func() { + calls := 0 + a := New(AsyncAssertionTypeConsistently, func() interface{} { + calls++ + if calls > 5 { + return "bar" + } + return "foo" + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.Should(Equal("foo")) + Ω(failureMessage).Should(ContainSubstring("to equal")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + + Context("when the matcher errors at some point", func() { + It("should fail", func() { + calls := 0 + a := New(AsyncAssertionTypeConsistently, func() interface{} { + calls++ + if calls > 5 { + return 3 + } + return []int{1, 2, 3} + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.Should(HaveLen(3)) + Ω(failureMessage).Should(ContainSubstring("HaveLen matcher expects")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + }) + + Describe("The negative case", func() { + Context("when the matcher consistently passes for the duration", func() { + It("should pass", func() { + c := make(chan bool) + a := New(AsyncAssertionTypeConsistently, c, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.ShouldNot(Receive()) + Ω(failureMessage).Should(BeZero()) + }) + }) + + Context("when the matcher fails at some point", func() { + It("should fail", func() { + c := make(chan bool) + go func() { + time.Sleep(time.Duration(100 * time.Millisecond)) + c <- true + }() + + a := New(AsyncAssertionTypeConsistently, c, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.ShouldNot(Receive()) + Ω(failureMessage).Should(ContainSubstring("not to receive anything")) + }) + }) + + Context("when the matcher errors at some point", func() { + It("should fail", func() { + calls := 0 + a := New(AsyncAssertionTypeConsistently, func() interface{} { + calls++ + return calls + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + + a.ShouldNot(BeNumerically(">", 5)) + Ω(failureMessage).Should(ContainSubstring("not to be >")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + }) + + Context("with a function that returns multiple values", func() { + It("should consistently succeed if the additional arguments are nil", func() { + i := 2 + Consistently(func() (int, error) { + i++ + return i, nil + }).Should(BeNumerically(">=", 2)) + }) + + It("should eventually timeout if the additional arguments are not nil", func() { + i := 2 + a := New(AsyncAssertionTypeEventually, func() (int, error) { + i++ + return i, errors.New("bam") + }, fakeFailHandler, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1) + a.Should(BeNumerically(">=", 2)) + + Ω(failureMessage).Should(ContainSubstring("Error:")) + Ω(failureMessage).Should(ContainSubstring("bam")) + Ω(callerSkip).Should(Equal(4)) + }) + }) + + Context("Making an assertion without a registered fail handler", func() { + It("should panic", func() { + defer func() { + e := recover() + RegisterFailHandler(Fail) + if e == nil { + Fail("expected a panic to have occurred") + } + }() + + RegisterFailHandler(nil) + c := make(chan bool) + Consistently(c).ShouldNot(Receive()) + }) + }) + }) + + Context("when passed a function with the wrong # or arguments & returns", func() { + It("should panic", func() { + Ω(func() { + New(AsyncAssertionTypeEventually, func() {}, fakeFailHandler, 0, 0, 1) + }).Should(Panic()) + + Ω(func() { + New(AsyncAssertionTypeEventually, func(a string) int { return 0 }, fakeFailHandler, 0, 0, 1) + }).Should(Panic()) + + Ω(func() { + New(AsyncAssertionTypeEventually, func() int { return 0 }, fakeFailHandler, 0, 0, 1) + }).ShouldNot(Panic()) + + Ω(func() { + New(AsyncAssertionTypeEventually, func() (int, error) { return 0, nil }, fakeFailHandler, 0, 0, 1) + }).ShouldNot(Panic()) + }) + }) + + Describe("bailing early", func() { + Context("when actual is a value", func() { + It("Eventually should bail out and fail early if the matcher says to", func() { + c := make(chan bool) + close(c) + + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(c, 0.1).Should(Receive()) + }) + Ω(time.Since(t)).Should(BeNumerically("<", 90*time.Millisecond)) + + Ω(failures).Should(HaveLen(1)) + }) + }) + + Context("when actual is a function", func() { + It("should never bail early", func() { + c := make(chan bool) + close(c) + + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(func() chan bool { + return c + }, 0.1).Should(Receive()) + }) + Ω(time.Since(t)).Should(BeNumerically(">=", 90*time.Millisecond)) + + Ω(failures).Should(HaveLen(1)) + }) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go b/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go index 08305e9ef5..6e351a7de5 100644 --- a/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go +++ b/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go @@ -1,23 +1,23 @@ -package fakematcher - -import "fmt" - -type FakeMatcher struct { - ReceivedActual interface{} - MatchesToReturn bool - ErrToReturn error -} - -func (matcher *FakeMatcher) Match(actual interface{}) (bool, error) { - matcher.ReceivedActual = actual - - return matcher.MatchesToReturn, matcher.ErrToReturn -} - -func (matcher *FakeMatcher) FailureMessage(actual interface{}) string { - return fmt.Sprintf("positive: %v", actual) -} - -func (matcher *FakeMatcher) NegatedFailureMessage(actual interface{}) string { - return fmt.Sprintf("negative: %v", actual) -} +package fakematcher + +import "fmt" + +type FakeMatcher struct { + ReceivedActual interface{} + MatchesToReturn bool + ErrToReturn error +} + +func (matcher *FakeMatcher) Match(actual interface{}) (bool, error) { + matcher.ReceivedActual = actual + + return matcher.MatchesToReturn, matcher.ErrToReturn +} + +func (matcher *FakeMatcher) FailureMessage(actual interface{}) string { + return fmt.Sprintf("positive: %v", actual) +} + +func (matcher *FakeMatcher) NegatedFailureMessage(actual interface{}) string { + return fmt.Sprintf("negative: %v", actual) +} diff --git a/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go b/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go index a84277f529..66cad88a1f 100644 --- a/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go +++ b/vendor/github.com/onsi/gomega/internal/oraclematcher/oracle_matcher.go @@ -1,25 +1,25 @@ -package oraclematcher - -import "github.com/onsi/gomega/types" - -/* -GomegaMatchers that also match the OracleMatcher interface can convey information about -whether or not their result will change upon future attempts. - -This allows `Eventually` and `Consistently` to short circuit if success becomes impossible. - -For example, a process' exit code can never change. So, gexec's Exit matcher returns `true` -for `MatchMayChangeInTheFuture` until the process exits, at which point it returns `false` forevermore. -*/ -type OracleMatcher interface { - MatchMayChangeInTheFuture(actual interface{}) bool -} - -func MatchMayChangeInTheFuture(matcher types.GomegaMatcher, value interface{}) bool { - oracleMatcher, ok := matcher.(OracleMatcher) - if !ok { - return true - } - - return oracleMatcher.MatchMayChangeInTheFuture(value) -} +package oraclematcher + +import "github.com/onsi/gomega/types" + +/* +GomegaMatchers that also match the OracleMatcher interface can convey information about +whether or not their result will change upon future attempts. + +This allows `Eventually` and `Consistently` to short circuit if success becomes impossible. + +For example, a process' exit code can never change. So, gexec's Exit matcher returns `true` +for `MatchMayChangeInTheFuture` until the process exits, at which point it returns `false` forevermore. +*/ +type OracleMatcher interface { + MatchMayChangeInTheFuture(actual interface{}) bool +} + +func MatchMayChangeInTheFuture(matcher types.GomegaMatcher, value interface{}) bool { + oracleMatcher, ok := matcher.(OracleMatcher) + if !ok { + return true + } + + return oracleMatcher.MatchMayChangeInTheFuture(value) +} diff --git a/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go b/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go index b644b62ec6..7871fd4395 100644 --- a/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go +++ b/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go @@ -1,40 +1,40 @@ -package testingtsupport - -import ( - "regexp" - "runtime/debug" - "strings" - - "github.com/onsi/gomega/types" -) - -type gomegaTestingT interface { - Errorf(format string, args ...interface{}) -} - -func BuildTestingTGomegaFailHandler(t gomegaTestingT) types.GomegaFailHandler { - return func(message string, callerSkip ...int) { - skip := 1 - if len(callerSkip) > 0 { - skip = callerSkip[0] - } - stackTrace := pruneStack(string(debug.Stack()), skip) - t.Errorf("\n%s\n%s", stackTrace, message) - } -} - -func pruneStack(fullStackTrace string, skip int) string { - stack := strings.Split(fullStackTrace, "\n") - if len(stack) > 2*(skip+1) { - stack = stack[2*(skip+1):] - } - prunedStack := []string{} - re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) - for i := 0; i < len(stack)/2; i++ { - if !re.Match([]byte(stack[i*2])) { - prunedStack = append(prunedStack, stack[i*2]) - prunedStack = append(prunedStack, stack[i*2+1]) - } - } - return strings.Join(prunedStack, "\n") -} +package testingtsupport + +import ( + "regexp" + "runtime/debug" + "strings" + + "github.com/onsi/gomega/types" +) + +type gomegaTestingT interface { + Errorf(format string, args ...interface{}) +} + +func BuildTestingTGomegaFailHandler(t gomegaTestingT) types.GomegaFailHandler { + return func(message string, callerSkip ...int) { + skip := 1 + if len(callerSkip) > 0 { + skip = callerSkip[0] + } + stackTrace := pruneStack(string(debug.Stack()), skip) + t.Errorf("\n%s\n%s", stackTrace, message) + } +} + +func pruneStack(fullStackTrace string, skip int) string { + stack := strings.Split(fullStackTrace, "\n") + if len(stack) > 2*(skip+1) { + stack = stack[2*(skip+1):] + } + prunedStack := []string{} + re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) + for i := 0; i < len(stack)/2; i++ { + if !re.Match([]byte(stack[i*2])) { + prunedStack = append(prunedStack, stack[i*2]) + prunedStack = append(prunedStack, stack[i*2+1]) + } + } + return strings.Join(prunedStack, "\n") +} diff --git a/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go b/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go index 05792f82de..b9fbd6c640 100644 --- a/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go +++ b/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go @@ -1,12 +1,12 @@ -package testingtsupport_test - -import ( - . "github.com/onsi/gomega" - - "testing" -) - -func TestTestingT(t *testing.T) { - RegisterTestingT(t) - Ω(true).Should(BeTrue()) -} +package testingtsupport_test + +import ( + . "github.com/onsi/gomega" + + "testing" +) + +func TestTestingT(t *testing.T) { + RegisterTestingT(t) + Ω(true).Should(BeTrue()) +} diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index f8e58ca458..ad04ab6574 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -1,418 +1,418 @@ -package gomega - -import ( - "time" - - "github.com/onsi/gomega/matchers" - "github.com/onsi/gomega/types" -) - -//Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about -//types when performing comparisons. -//It is an error for both actual and expected to be nil. Use BeNil() instead. -func Equal(expected interface{}) types.GomegaMatcher { - return &matchers.EqualMatcher{ - Expected: expected, - } -} - -//BeEquivalentTo is more lax than Equal, allowing equality between different types. -//This is done by converting actual to have the type of expected before -//attempting equality with reflect.DeepEqual. -//It is an error for actual and expected to be nil. Use BeNil() instead. -func BeEquivalentTo(expected interface{}) types.GomegaMatcher { - return &matchers.BeEquivalentToMatcher{ - Expected: expected, - } -} - -//BeIdenticalTo uses the == operator to compare actual with expected. -//BeIdenticalTo is strict about types when performing comparisons. -//It is an error for both actual and expected to be nil. Use BeNil() instead. -func BeIdenticalTo(expected interface{}) types.GomegaMatcher { - return &matchers.BeIdenticalToMatcher{ - Expected: expected, - } -} - -//BeNil succeeds if actual is nil -func BeNil() types.GomegaMatcher { - return &matchers.BeNilMatcher{} -} - -//BeTrue succeeds if actual is true -func BeTrue() types.GomegaMatcher { - return &matchers.BeTrueMatcher{} -} - -//BeFalse succeeds if actual is false -func BeFalse() types.GomegaMatcher { - return &matchers.BeFalseMatcher{} -} - -//HaveOccurred succeeds if actual is a non-nil error -//The typical Go error checking pattern looks like: -// err := SomethingThatMightFail() -// Ω(err).ShouldNot(HaveOccurred()) -func HaveOccurred() types.GomegaMatcher { - return &matchers.HaveOccurredMatcher{} -} - -//Succeed passes if actual is a nil error -//Succeed is intended to be used with functions that return a single error value. Instead of -// err := SomethingThatMightFail() -// Ω(err).ShouldNot(HaveOccurred()) -// -//You can write: -// Ω(SomethingThatMightFail()).Should(Succeed()) -// -//It is a mistake to use Succeed with a function that has multiple return values. Gomega's Ω and Expect -//functions automatically trigger failure if any return values after the first return value are non-zero/non-nil. -//This means that Ω(MultiReturnFunc()).ShouldNot(Succeed()) can never pass. -func Succeed() types.GomegaMatcher { - return &matchers.SucceedMatcher{} -} - -//MatchError succeeds if actual is a non-nil error that matches the passed in string/error. -// -//These are valid use-cases: -// Ω(err).Should(MatchError("an error")) //asserts that err.Error() == "an error" -// Ω(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual) -// -//It is an error for err to be nil or an object that does not implement the Error interface -func MatchError(expected interface{}) types.GomegaMatcher { - return &matchers.MatchErrorMatcher{ - Expected: expected, - } -} - -//BeClosed succeeds if actual is a closed channel. -//It is an error to pass a non-channel to BeClosed, it is also an error to pass nil -// -//In order to check whether or not the channel is closed, Gomega must try to read from the channel -//(even in the `ShouldNot(BeClosed())` case). You should keep this in mind if you wish to make subsequent assertions about -//values coming down the channel. -// -//Also, if you are testing that a *buffered* channel is closed you must first read all values out of the channel before -//asserting that it is closed (it is not possible to detect that a buffered-channel has been closed until all its buffered values are read). -// -//Finally, as a corollary: it is an error to check whether or not a send-only channel is closed. -func BeClosed() types.GomegaMatcher { - return &matchers.BeClosedMatcher{} -} - -//Receive succeeds if there is a value to be received on actual. -//Actual must be a channel (and cannot be a send-only channel) -- anything else is an error. -// -//Receive returns immediately and never blocks: -// -//- If there is nothing on the channel `c` then Ω(c).Should(Receive()) will fail and Ω(c).ShouldNot(Receive()) will pass. -// -//- If the channel `c` is closed then Ω(c).Should(Receive()) will fail and Ω(c).ShouldNot(Receive()) will pass. -// -//- If there is something on the channel `c` ready to be read, then Ω(c).Should(Receive()) will pass and Ω(c).ShouldNot(Receive()) will fail. -// -//If you have a go-routine running in the background that will write to channel `c` you can: -// Eventually(c).Should(Receive()) -// -//This will timeout if nothing gets sent to `c` (you can modify the timeout interval as you normally do with `Eventually`) -// -//A similar use-case is to assert that no go-routine writes to a channel (for a period of time). You can do this with `Consistently`: -// Consistently(c).ShouldNot(Receive()) -// -//You can pass `Receive` a matcher. If you do so, it will match the received object against the matcher. For example: -// Ω(c).Should(Receive(Equal("foo"))) -// -//When given a matcher, `Receive` will always fail if there is nothing to be received on the channel. -// -//Passing Receive a matcher is especially useful when paired with Eventually: -// -// Eventually(c).Should(Receive(ContainSubstring("bar"))) -// -//will repeatedly attempt to pull values out of `c` until a value matching "bar" is received. -// -//Finally, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: -// var myThing thing -// Eventually(thingChan).Should(Receive(&myThing)) -// Ω(myThing.Sprocket).Should(Equal("foo")) -// Ω(myThing.IsValid()).Should(BeTrue()) -func Receive(args ...interface{}) types.GomegaMatcher { - var arg interface{} - if len(args) > 0 { - arg = args[0] - } - - return &matchers.ReceiveMatcher{ - Arg: arg, - } -} - -//BeSent succeeds if a value can be sent to actual. -//Actual must be a channel (and cannot be a receive-only channel) that can sent the type of the value passed into BeSent -- anything else is an error. -//In addition, actual must not be closed. -// -//BeSent never blocks: -// -//- If the channel `c` is not ready to receive then Ω(c).Should(BeSent("foo")) will fail immediately -//- If the channel `c` is eventually ready to receive then Eventually(c).Should(BeSent("foo")) will succeed.. presuming the channel becomes ready to receive before Eventually's timeout -//- If the channel `c` is closed then Ω(c).Should(BeSent("foo")) and Ω(c).ShouldNot(BeSent("foo")) will both fail immediately -// -//Of course, the value is actually sent to the channel. The point of `BeSent` is less to make an assertion about the availability of the channel (which is typically an implementation detail that your test should not be concerned with). -//Rather, the point of `BeSent` is to make it possible to easily and expressively write tests that can timeout on blocked channel sends. -func BeSent(arg interface{}) types.GomegaMatcher { - return &matchers.BeSentMatcher{ - Arg: arg, - } -} - -//MatchRegexp succeeds if actual is a string or stringer that matches the -//passed-in regexp. Optional arguments can be provided to construct a regexp -//via fmt.Sprintf(). -func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { - return &matchers.MatchRegexpMatcher{ - Regexp: regexp, - Args: args, - } -} - -//ContainSubstring succeeds if actual is a string or stringer that contains the -//passed-in substring. Optional arguments can be provided to construct the substring -//via fmt.Sprintf(). -func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { - return &matchers.ContainSubstringMatcher{ - Substr: substr, - Args: args, - } -} - -//HavePrefix succeeds if actual is a string or stringer that contains the -//passed-in string as a prefix. Optional arguments can be provided to construct -//via fmt.Sprintf(). -func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { - return &matchers.HavePrefixMatcher{ - Prefix: prefix, - Args: args, - } -} - -//HaveSuffix succeeds if actual is a string or stringer that contains the -//passed-in string as a suffix. Optional arguments can be provided to construct -//via fmt.Sprintf(). -func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { - return &matchers.HaveSuffixMatcher{ - Suffix: suffix, - Args: args, - } -} - -//MatchJSON succeeds if actual is a string or stringer of JSON that matches -//the expected JSON. The JSONs are decoded and the resulting objects are compared via -//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. -func MatchJSON(json interface{}) types.GomegaMatcher { - return &matchers.MatchJSONMatcher{ - JSONToMatch: json, - } -} - -//MatchYAML succeeds if actual is a string or stringer of YAML that matches -//the expected YAML. The YAML's are decoded and the resulting objects are compared via -//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. -func MatchYAML(yaml interface{}) types.GomegaMatcher { - return &matchers.MatchYAMLMatcher{ - YAMLToMatch: yaml, - } -} - -//BeEmpty succeeds if actual is empty. Actual must be of type string, array, map, chan, or slice. -func BeEmpty() types.GomegaMatcher { - return &matchers.BeEmptyMatcher{} -} - -//HaveLen succeeds if actual has the passed-in length. Actual must be of type string, array, map, chan, or slice. -func HaveLen(count int) types.GomegaMatcher { - return &matchers.HaveLenMatcher{ - Count: count, - } -} - -//HaveCap succeeds if actual has the passed-in capacity. Actual must be of type array, chan, or slice. -func HaveCap(count int) types.GomegaMatcher { - return &matchers.HaveCapMatcher{ - Count: count, - } -} - -//BeZero succeeds if actual is the zero value for its type or if actual is nil. -func BeZero() types.GomegaMatcher { - return &matchers.BeZeroMatcher{} -} - -//ContainElement succeeds if actual contains the passed in element. -//By default ContainElement() uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Ω([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubstring("Bar"))) -// -//Actual must be an array, slice or map. -//For maps, ContainElement searches through the map's values. -func ContainElement(element interface{}) types.GomegaMatcher { - return &matchers.ContainElementMatcher{ - Element: element, - } -} - -//ConsistOf succeeds if actual contains preciely the elements passed into the matcher. The ordering of the elements does not matter. -//By default ConsistOf() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: -// -// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf("FooBar", "Foo")) -// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Bar"), "Foo")) -// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Foo"), ContainSubstring("Foo"))) -// -//Actual must be an array, slice or map. For maps, ConsistOf matches against the map's values. -// -//You typically pass variadic arguments to ConsistOf (as in the examples above). However, if you need to pass in a slice you can provided that it -//is the only element passed in to ConsistOf: -// -// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf([]string{"FooBar", "Foo"})) -// -//Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []interface{} are different types - hence the need for this special rule. -func ConsistOf(elements ...interface{}) types.GomegaMatcher { - return &matchers.ConsistOfMatcher{ - Elements: elements, - } -} - -//HaveKey succeeds if actual is a map with the passed in key. -//By default HaveKey uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKey(MatchRegexp(`.+Foo$`))) -func HaveKey(key interface{}) types.GomegaMatcher { - return &matchers.HaveKeyMatcher{ - Key: key, - } -} - -//HaveKeyWithValue succeeds if actual is a map with the passed in key and value. -//By default HaveKeyWithValue uses Equal() to perform the match, however a -//matcher can be passed in instead: -// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue("Foo", "Bar")) -// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue(MatchRegexp(`.+Foo$`), "Bar")) -func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { - return &matchers.HaveKeyWithValueMatcher{ - Key: key, - Value: value, - } -} - -//BeNumerically performs numerical assertions in a type-agnostic way. -//Actual and expected should be numbers, though the specific type of -//number is irrelevant (floa32, float64, uint8, etc...). -// -//There are six, self-explanatory, supported comparators: -// Ω(1.0).Should(BeNumerically("==", 1)) -// Ω(1.0).Should(BeNumerically("~", 0.999, 0.01)) -// Ω(1.0).Should(BeNumerically(">", 0.9)) -// Ω(1.0).Should(BeNumerically(">=", 1.0)) -// Ω(1.0).Should(BeNumerically("<", 3)) -// Ω(1.0).Should(BeNumerically("<=", 1.0)) -func BeNumerically(comparator string, compareTo ...interface{}) types.GomegaMatcher { - return &matchers.BeNumericallyMatcher{ - Comparator: comparator, - CompareTo: compareTo, - } -} - -//BeTemporally compares time.Time's like BeNumerically -//Actual and expected must be time.Time. The comparators are the same as for BeNumerically -// Ω(time.Now()).Should(BeTemporally(">", time.Time{})) -// Ω(time.Now()).Should(BeTemporally("~", time.Now(), time.Second)) -func BeTemporally(comparator string, compareTo time.Time, threshold ...time.Duration) types.GomegaMatcher { - return &matchers.BeTemporallyMatcher{ - Comparator: comparator, - CompareTo: compareTo, - Threshold: threshold, - } -} - -//BeAssignableToTypeOf succeeds if actual is assignable to the type of expected. -//It will return an error when one of the values is nil. -// Ω(0).Should(BeAssignableToTypeOf(0)) // Same values -// Ω(5).Should(BeAssignableToTypeOf(-1)) // different values same type -// Ω("foo").Should(BeAssignableToTypeOf("bar")) // different values same type -// Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) -func BeAssignableToTypeOf(expected interface{}) types.GomegaMatcher { - return &matchers.AssignableToTypeOfMatcher{ - Expected: expected, - } -} - -//Panic succeeds if actual is a function that, when invoked, panics. -//Actual must be a function that takes no arguments and returns no results. -func Panic() types.GomegaMatcher { - return &matchers.PanicMatcher{} -} - -//BeAnExistingFile succeeds if a file exists. -//Actual must be a string representing the abs path to the file being checked. -func BeAnExistingFile() types.GomegaMatcher { - return &matchers.BeAnExistingFileMatcher{} -} - -//BeARegularFile succeeds iff a file exists and is a regular file. -//Actual must be a string representing the abs path to the file being checked. -func BeARegularFile() types.GomegaMatcher { - return &matchers.BeARegularFileMatcher{} -} - -//BeADirectory succeeds iff a file exists and is a directory. -//Actual must be a string representing the abs path to the file being checked. -func BeADirectory() types.GomegaMatcher { - return &matchers.BeADirectoryMatcher{} -} - -//And succeeds only if all of the given matchers succeed. -//The matchers are tried in order, and will fail-fast if one doesn't succeed. -// Expect("hi").To(And(HaveLen(2), Equal("hi")) -// -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. -func And(ms ...types.GomegaMatcher) types.GomegaMatcher { - return &matchers.AndMatcher{Matchers: ms} -} - -//SatisfyAll is an alias for And(). -// Ω("hi").Should(SatisfyAll(HaveLen(2), Equal("hi"))) -func SatisfyAll(matchers ...types.GomegaMatcher) types.GomegaMatcher { - return And(matchers...) -} - -//Or succeeds if any of the given matchers succeed. -//The matchers are tried in order and will return immediately upon the first successful match. -// Expect("hi").To(Or(HaveLen(3), HaveLen(2)) -// -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. -func Or(ms ...types.GomegaMatcher) types.GomegaMatcher { - return &matchers.OrMatcher{Matchers: ms} -} - -//SatisfyAny is an alias for Or(). -// Expect("hi").SatisfyAny(Or(HaveLen(3), HaveLen(2)) -func SatisfyAny(matchers ...types.GomegaMatcher) types.GomegaMatcher { - return Or(matchers...) -} - -//Not negates the given matcher; it succeeds if the given matcher fails. -// Expect(1).To(Not(Equal(2)) -// -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. -func Not(matcher types.GomegaMatcher) types.GomegaMatcher { - return &matchers.NotMatcher{Matcher: matcher} -} - -//WithTransform applies the `transform` to the actual value and matches it against `matcher`. -//The given transform must be a function of one parameter that returns one value. -// var plus1 = func(i int) int { return i + 1 } -// Expect(1).To(WithTransform(plus1, Equal(2)) -// -//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. -func WithTransform(transform interface{}, matcher types.GomegaMatcher) types.GomegaMatcher { - return matchers.NewWithTransformMatcher(transform, matcher) -} +package gomega + +import ( + "time" + + "github.com/onsi/gomega/matchers" + "github.com/onsi/gomega/types" +) + +//Equal uses reflect.DeepEqual to compare actual with expected. Equal is strict about +//types when performing comparisons. +//It is an error for both actual and expected to be nil. Use BeNil() instead. +func Equal(expected interface{}) types.GomegaMatcher { + return &matchers.EqualMatcher{ + Expected: expected, + } +} + +//BeEquivalentTo is more lax than Equal, allowing equality between different types. +//This is done by converting actual to have the type of expected before +//attempting equality with reflect.DeepEqual. +//It is an error for actual and expected to be nil. Use BeNil() instead. +func BeEquivalentTo(expected interface{}) types.GomegaMatcher { + return &matchers.BeEquivalentToMatcher{ + Expected: expected, + } +} + +//BeIdenticalTo uses the == operator to compare actual with expected. +//BeIdenticalTo is strict about types when performing comparisons. +//It is an error for both actual and expected to be nil. Use BeNil() instead. +func BeIdenticalTo(expected interface{}) types.GomegaMatcher { + return &matchers.BeIdenticalToMatcher{ + Expected: expected, + } +} + +//BeNil succeeds if actual is nil +func BeNil() types.GomegaMatcher { + return &matchers.BeNilMatcher{} +} + +//BeTrue succeeds if actual is true +func BeTrue() types.GomegaMatcher { + return &matchers.BeTrueMatcher{} +} + +//BeFalse succeeds if actual is false +func BeFalse() types.GomegaMatcher { + return &matchers.BeFalseMatcher{} +} + +//HaveOccurred succeeds if actual is a non-nil error +//The typical Go error checking pattern looks like: +// err := SomethingThatMightFail() +// Ω(err).ShouldNot(HaveOccurred()) +func HaveOccurred() types.GomegaMatcher { + return &matchers.HaveOccurredMatcher{} +} + +//Succeed passes if actual is a nil error +//Succeed is intended to be used with functions that return a single error value. Instead of +// err := SomethingThatMightFail() +// Ω(err).ShouldNot(HaveOccurred()) +// +//You can write: +// Ω(SomethingThatMightFail()).Should(Succeed()) +// +//It is a mistake to use Succeed with a function that has multiple return values. Gomega's Ω and Expect +//functions automatically trigger failure if any return values after the first return value are non-zero/non-nil. +//This means that Ω(MultiReturnFunc()).ShouldNot(Succeed()) can never pass. +func Succeed() types.GomegaMatcher { + return &matchers.SucceedMatcher{} +} + +//MatchError succeeds if actual is a non-nil error that matches the passed in string/error. +// +//These are valid use-cases: +// Ω(err).Should(MatchError("an error")) //asserts that err.Error() == "an error" +// Ω(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual) +// +//It is an error for err to be nil or an object that does not implement the Error interface +func MatchError(expected interface{}) types.GomegaMatcher { + return &matchers.MatchErrorMatcher{ + Expected: expected, + } +} + +//BeClosed succeeds if actual is a closed channel. +//It is an error to pass a non-channel to BeClosed, it is also an error to pass nil +// +//In order to check whether or not the channel is closed, Gomega must try to read from the channel +//(even in the `ShouldNot(BeClosed())` case). You should keep this in mind if you wish to make subsequent assertions about +//values coming down the channel. +// +//Also, if you are testing that a *buffered* channel is closed you must first read all values out of the channel before +//asserting that it is closed (it is not possible to detect that a buffered-channel has been closed until all its buffered values are read). +// +//Finally, as a corollary: it is an error to check whether or not a send-only channel is closed. +func BeClosed() types.GomegaMatcher { + return &matchers.BeClosedMatcher{} +} + +//Receive succeeds if there is a value to be received on actual. +//Actual must be a channel (and cannot be a send-only channel) -- anything else is an error. +// +//Receive returns immediately and never blocks: +// +//- If there is nothing on the channel `c` then Ω(c).Should(Receive()) will fail and Ω(c).ShouldNot(Receive()) will pass. +// +//- If the channel `c` is closed then Ω(c).Should(Receive()) will fail and Ω(c).ShouldNot(Receive()) will pass. +// +//- If there is something on the channel `c` ready to be read, then Ω(c).Should(Receive()) will pass and Ω(c).ShouldNot(Receive()) will fail. +// +//If you have a go-routine running in the background that will write to channel `c` you can: +// Eventually(c).Should(Receive()) +// +//This will timeout if nothing gets sent to `c` (you can modify the timeout interval as you normally do with `Eventually`) +// +//A similar use-case is to assert that no go-routine writes to a channel (for a period of time). You can do this with `Consistently`: +// Consistently(c).ShouldNot(Receive()) +// +//You can pass `Receive` a matcher. If you do so, it will match the received object against the matcher. For example: +// Ω(c).Should(Receive(Equal("foo"))) +// +//When given a matcher, `Receive` will always fail if there is nothing to be received on the channel. +// +//Passing Receive a matcher is especially useful when paired with Eventually: +// +// Eventually(c).Should(Receive(ContainSubstring("bar"))) +// +//will repeatedly attempt to pull values out of `c` until a value matching "bar" is received. +// +//Finally, if you want to have a reference to the value *sent* to the channel you can pass the `Receive` matcher a pointer to a variable of the appropriate type: +// var myThing thing +// Eventually(thingChan).Should(Receive(&myThing)) +// Ω(myThing.Sprocket).Should(Equal("foo")) +// Ω(myThing.IsValid()).Should(BeTrue()) +func Receive(args ...interface{}) types.GomegaMatcher { + var arg interface{} + if len(args) > 0 { + arg = args[0] + } + + return &matchers.ReceiveMatcher{ + Arg: arg, + } +} + +//BeSent succeeds if a value can be sent to actual. +//Actual must be a channel (and cannot be a receive-only channel) that can sent the type of the value passed into BeSent -- anything else is an error. +//In addition, actual must not be closed. +// +//BeSent never blocks: +// +//- If the channel `c` is not ready to receive then Ω(c).Should(BeSent("foo")) will fail immediately +//- If the channel `c` is eventually ready to receive then Eventually(c).Should(BeSent("foo")) will succeed.. presuming the channel becomes ready to receive before Eventually's timeout +//- If the channel `c` is closed then Ω(c).Should(BeSent("foo")) and Ω(c).ShouldNot(BeSent("foo")) will both fail immediately +// +//Of course, the value is actually sent to the channel. The point of `BeSent` is less to make an assertion about the availability of the channel (which is typically an implementation detail that your test should not be concerned with). +//Rather, the point of `BeSent` is to make it possible to easily and expressively write tests that can timeout on blocked channel sends. +func BeSent(arg interface{}) types.GomegaMatcher { + return &matchers.BeSentMatcher{ + Arg: arg, + } +} + +//MatchRegexp succeeds if actual is a string or stringer that matches the +//passed-in regexp. Optional arguments can be provided to construct a regexp +//via fmt.Sprintf(). +func MatchRegexp(regexp string, args ...interface{}) types.GomegaMatcher { + return &matchers.MatchRegexpMatcher{ + Regexp: regexp, + Args: args, + } +} + +//ContainSubstring succeeds if actual is a string or stringer that contains the +//passed-in substring. Optional arguments can be provided to construct the substring +//via fmt.Sprintf(). +func ContainSubstring(substr string, args ...interface{}) types.GomegaMatcher { + return &matchers.ContainSubstringMatcher{ + Substr: substr, + Args: args, + } +} + +//HavePrefix succeeds if actual is a string or stringer that contains the +//passed-in string as a prefix. Optional arguments can be provided to construct +//via fmt.Sprintf(). +func HavePrefix(prefix string, args ...interface{}) types.GomegaMatcher { + return &matchers.HavePrefixMatcher{ + Prefix: prefix, + Args: args, + } +} + +//HaveSuffix succeeds if actual is a string or stringer that contains the +//passed-in string as a suffix. Optional arguments can be provided to construct +//via fmt.Sprintf(). +func HaveSuffix(suffix string, args ...interface{}) types.GomegaMatcher { + return &matchers.HaveSuffixMatcher{ + Suffix: suffix, + Args: args, + } +} + +//MatchJSON succeeds if actual is a string or stringer of JSON that matches +//the expected JSON. The JSONs are decoded and the resulting objects are compared via +//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +func MatchJSON(json interface{}) types.GomegaMatcher { + return &matchers.MatchJSONMatcher{ + JSONToMatch: json, + } +} + +//MatchYAML succeeds if actual is a string or stringer of YAML that matches +//the expected YAML. The YAML's are decoded and the resulting objects are compared via +//reflect.DeepEqual so things like key-ordering and whitespace shouldn't matter. +func MatchYAML(yaml interface{}) types.GomegaMatcher { + return &matchers.MatchYAMLMatcher{ + YAMLToMatch: yaml, + } +} + +//BeEmpty succeeds if actual is empty. Actual must be of type string, array, map, chan, or slice. +func BeEmpty() types.GomegaMatcher { + return &matchers.BeEmptyMatcher{} +} + +//HaveLen succeeds if actual has the passed-in length. Actual must be of type string, array, map, chan, or slice. +func HaveLen(count int) types.GomegaMatcher { + return &matchers.HaveLenMatcher{ + Count: count, + } +} + +//HaveCap succeeds if actual has the passed-in capacity. Actual must be of type array, chan, or slice. +func HaveCap(count int) types.GomegaMatcher { + return &matchers.HaveCapMatcher{ + Count: count, + } +} + +//BeZero succeeds if actual is the zero value for its type or if actual is nil. +func BeZero() types.GomegaMatcher { + return &matchers.BeZeroMatcher{} +} + +//ContainElement succeeds if actual contains the passed in element. +//By default ContainElement() uses Equal() to perform the match, however a +//matcher can be passed in instead: +// Ω([]string{"Foo", "FooBar"}).Should(ContainElement(ContainSubstring("Bar"))) +// +//Actual must be an array, slice or map. +//For maps, ContainElement searches through the map's values. +func ContainElement(element interface{}) types.GomegaMatcher { + return &matchers.ContainElementMatcher{ + Element: element, + } +} + +//ConsistOf succeeds if actual contains preciely the elements passed into the matcher. The ordering of the elements does not matter. +//By default ConsistOf() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples: +// +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf("FooBar", "Foo")) +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Bar"), "Foo")) +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf(ContainSubstring("Foo"), ContainSubstring("Foo"))) +// +//Actual must be an array, slice or map. For maps, ConsistOf matches against the map's values. +// +//You typically pass variadic arguments to ConsistOf (as in the examples above). However, if you need to pass in a slice you can provided that it +//is the only element passed in to ConsistOf: +// +// Ω([]string{"Foo", "FooBar"}).Should(ConsistOf([]string{"FooBar", "Foo"})) +// +//Note that Go's type system does not allow you to write this as ConsistOf([]string{"FooBar", "Foo"}...) as []string and []interface{} are different types - hence the need for this special rule. +func ConsistOf(elements ...interface{}) types.GomegaMatcher { + return &matchers.ConsistOfMatcher{ + Elements: elements, + } +} + +//HaveKey succeeds if actual is a map with the passed in key. +//By default HaveKey uses Equal() to perform the match, however a +//matcher can be passed in instead: +// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKey(MatchRegexp(`.+Foo$`))) +func HaveKey(key interface{}) types.GomegaMatcher { + return &matchers.HaveKeyMatcher{ + Key: key, + } +} + +//HaveKeyWithValue succeeds if actual is a map with the passed in key and value. +//By default HaveKeyWithValue uses Equal() to perform the match, however a +//matcher can be passed in instead: +// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue("Foo", "Bar")) +// Ω(map[string]string{"Foo": "Bar", "BazFoo": "Duck"}).Should(HaveKeyWithValue(MatchRegexp(`.+Foo$`), "Bar")) +func HaveKeyWithValue(key interface{}, value interface{}) types.GomegaMatcher { + return &matchers.HaveKeyWithValueMatcher{ + Key: key, + Value: value, + } +} + +//BeNumerically performs numerical assertions in a type-agnostic way. +//Actual and expected should be numbers, though the specific type of +//number is irrelevant (floa32, float64, uint8, etc...). +// +//There are six, self-explanatory, supported comparators: +// Ω(1.0).Should(BeNumerically("==", 1)) +// Ω(1.0).Should(BeNumerically("~", 0.999, 0.01)) +// Ω(1.0).Should(BeNumerically(">", 0.9)) +// Ω(1.0).Should(BeNumerically(">=", 1.0)) +// Ω(1.0).Should(BeNumerically("<", 3)) +// Ω(1.0).Should(BeNumerically("<=", 1.0)) +func BeNumerically(comparator string, compareTo ...interface{}) types.GomegaMatcher { + return &matchers.BeNumericallyMatcher{ + Comparator: comparator, + CompareTo: compareTo, + } +} + +//BeTemporally compares time.Time's like BeNumerically +//Actual and expected must be time.Time. The comparators are the same as for BeNumerically +// Ω(time.Now()).Should(BeTemporally(">", time.Time{})) +// Ω(time.Now()).Should(BeTemporally("~", time.Now(), time.Second)) +func BeTemporally(comparator string, compareTo time.Time, threshold ...time.Duration) types.GomegaMatcher { + return &matchers.BeTemporallyMatcher{ + Comparator: comparator, + CompareTo: compareTo, + Threshold: threshold, + } +} + +//BeAssignableToTypeOf succeeds if actual is assignable to the type of expected. +//It will return an error when one of the values is nil. +// Ω(0).Should(BeAssignableToTypeOf(0)) // Same values +// Ω(5).Should(BeAssignableToTypeOf(-1)) // different values same type +// Ω("foo").Should(BeAssignableToTypeOf("bar")) // different values same type +// Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) +func BeAssignableToTypeOf(expected interface{}) types.GomegaMatcher { + return &matchers.AssignableToTypeOfMatcher{ + Expected: expected, + } +} + +//Panic succeeds if actual is a function that, when invoked, panics. +//Actual must be a function that takes no arguments and returns no results. +func Panic() types.GomegaMatcher { + return &matchers.PanicMatcher{} +} + +//BeAnExistingFile succeeds if a file exists. +//Actual must be a string representing the abs path to the file being checked. +func BeAnExistingFile() types.GomegaMatcher { + return &matchers.BeAnExistingFileMatcher{} +} + +//BeARegularFile succeeds iff a file exists and is a regular file. +//Actual must be a string representing the abs path to the file being checked. +func BeARegularFile() types.GomegaMatcher { + return &matchers.BeARegularFileMatcher{} +} + +//BeADirectory succeeds iff a file exists and is a directory. +//Actual must be a string representing the abs path to the file being checked. +func BeADirectory() types.GomegaMatcher { + return &matchers.BeADirectoryMatcher{} +} + +//And succeeds only if all of the given matchers succeed. +//The matchers are tried in order, and will fail-fast if one doesn't succeed. +// Expect("hi").To(And(HaveLen(2), Equal("hi")) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func And(ms ...types.GomegaMatcher) types.GomegaMatcher { + return &matchers.AndMatcher{Matchers: ms} +} + +//SatisfyAll is an alias for And(). +// Ω("hi").Should(SatisfyAll(HaveLen(2), Equal("hi"))) +func SatisfyAll(matchers ...types.GomegaMatcher) types.GomegaMatcher { + return And(matchers...) +} + +//Or succeeds if any of the given matchers succeed. +//The matchers are tried in order and will return immediately upon the first successful match. +// Expect("hi").To(Or(HaveLen(3), HaveLen(2)) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func Or(ms ...types.GomegaMatcher) types.GomegaMatcher { + return &matchers.OrMatcher{Matchers: ms} +} + +//SatisfyAny is an alias for Or(). +// Expect("hi").SatisfyAny(Or(HaveLen(3), HaveLen(2)) +func SatisfyAny(matchers ...types.GomegaMatcher) types.GomegaMatcher { + return Or(matchers...) +} + +//Not negates the given matcher; it succeeds if the given matcher fails. +// Expect(1).To(Not(Equal(2)) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func Not(matcher types.GomegaMatcher) types.GomegaMatcher { + return &matchers.NotMatcher{Matcher: matcher} +} + +//WithTransform applies the `transform` to the actual value and matches it against `matcher`. +//The given transform must be a function of one parameter that returns one value. +// var plus1 = func(i int) int { return i + 1 } +// Expect(1).To(WithTransform(plus1, Equal(2)) +// +//And(), Or(), Not() and WithTransform() allow matchers to be composed into complex expressions. +func WithTransform(transform interface{}, matcher types.GomegaMatcher) types.GomegaMatcher { + return matchers.NewWithTransformMatcher(transform, matcher) +} diff --git a/vendor/github.com/onsi/gomega/matchers/and.go b/vendor/github.com/onsi/gomega/matchers/and.go index 4e1b0a64da..94c42a7db7 100644 --- a/vendor/github.com/onsi/gomega/matchers/and.go +++ b/vendor/github.com/onsi/gomega/matchers/and.go @@ -1,64 +1,64 @@ -package matchers - -import ( - "fmt" - - "github.com/onsi/gomega/format" - "github.com/onsi/gomega/internal/oraclematcher" - "github.com/onsi/gomega/types" -) - -type AndMatcher struct { - Matchers []types.GomegaMatcher - - // state - firstFailedMatcher types.GomegaMatcher -} - -func (m *AndMatcher) Match(actual interface{}) (success bool, err error) { - m.firstFailedMatcher = nil - for _, matcher := range m.Matchers { - success, err := matcher.Match(actual) - if !success || err != nil { - m.firstFailedMatcher = matcher - return false, err - } - } - return true, nil -} - -func (m *AndMatcher) FailureMessage(actual interface{}) (message string) { - return m.firstFailedMatcher.FailureMessage(actual) -} - -func (m *AndMatcher) NegatedFailureMessage(actual interface{}) (message string) { - // not the most beautiful list of matchers, but not bad either... - return format.Message(actual, fmt.Sprintf("To not satisfy all of these matchers: %s", m.Matchers)) -} - -func (m *AndMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - /* - Example with 3 matchers: A, B, C - - Match evaluates them: T, F, => F - So match is currently F, what should MatchMayChangeInTheFuture() return? - Seems like it only depends on B, since currently B MUST change to allow the result to become T - - Match eval: T, T, T => T - So match is currently T, what should MatchMayChangeInTheFuture() return? - Seems to depend on ANY of them being able to change to F. - */ - - if m.firstFailedMatcher == nil { - // so all matchers succeeded.. Any one of them changing would change the result. - for _, matcher := range m.Matchers { - if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { - return true - } - } - return false // none of were going to change - } else { - // one of the matchers failed.. it must be able to change in order to affect the result - return oraclematcher.MatchMayChangeInTheFuture(m.firstFailedMatcher, actual) - } -} +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type AndMatcher struct { + Matchers []types.GomegaMatcher + + // state + firstFailedMatcher types.GomegaMatcher +} + +func (m *AndMatcher) Match(actual interface{}) (success bool, err error) { + m.firstFailedMatcher = nil + for _, matcher := range m.Matchers { + success, err := matcher.Match(actual) + if !success || err != nil { + m.firstFailedMatcher = matcher + return false, err + } + } + return true, nil +} + +func (m *AndMatcher) FailureMessage(actual interface{}) (message string) { + return m.firstFailedMatcher.FailureMessage(actual) +} + +func (m *AndMatcher) NegatedFailureMessage(actual interface{}) (message string) { + // not the most beautiful list of matchers, but not bad either... + return format.Message(actual, fmt.Sprintf("To not satisfy all of these matchers: %s", m.Matchers)) +} + +func (m *AndMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + /* + Example with 3 matchers: A, B, C + + Match evaluates them: T, F, => F + So match is currently F, what should MatchMayChangeInTheFuture() return? + Seems like it only depends on B, since currently B MUST change to allow the result to become T + + Match eval: T, T, T => T + So match is currently T, what should MatchMayChangeInTheFuture() return? + Seems to depend on ANY of them being able to change to F. + */ + + if m.firstFailedMatcher == nil { + // so all matchers succeeded.. Any one of them changing would change the result. + for _, matcher := range m.Matchers { + if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { + return true + } + } + return false // none of were going to change + } else { + // one of the matchers failed.. it must be able to change in order to affect the result + return oraclematcher.MatchMayChangeInTheFuture(m.firstFailedMatcher, actual) + } +} diff --git a/vendor/github.com/onsi/gomega/matchers/and_test.go b/vendor/github.com/onsi/gomega/matchers/and_test.go index 084dafa26c..acf778cd6d 100644 --- a/vendor/github.com/onsi/gomega/matchers/and_test.go +++ b/vendor/github.com/onsi/gomega/matchers/and_test.go @@ -1,103 +1,103 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" - "github.com/onsi/gomega/types" -) - -// sample data -var ( - // example input - input = "hi" - // some matchers that succeed against the input - true1 = HaveLen(2) - true2 = Equal("hi") - true3 = MatchRegexp("hi") - // some matchers that fail against the input. - false1 = HaveLen(1) - false2 = Equal("hip") - false3 = MatchRegexp("hope") -) - -// verifyFailureMessage expects the matcher to fail with the given input, and verifies the failure message. -func verifyFailureMessage(m types.GomegaMatcher, input string, expectedFailureMsgFragment string) { - Expect(m.Match(input)).To(BeFalse()) - Expect(m.FailureMessage(input)).To(Equal( - "Expected\n : " + input + "\n" + expectedFailureMsgFragment)) -} - -var _ = Describe("AndMatcher", func() { - It("works with positive cases", func() { - Expect(input).To(And()) - Expect(input).To(And(true1)) - Expect(input).To(And(true1, true2)) - Expect(input).To(And(true1, true2, true3)) - - // use alias - Expect(input).To(SatisfyAll(true1, true2, true3)) - }) - - It("works with negative cases", func() { - Expect(input).ToNot(And(false1, false2)) - Expect(input).ToNot(And(true1, true2, false3)) - Expect(input).ToNot(And(true1, false2, false3)) - Expect(input).ToNot(And(false1, true1, true2)) - }) - - Context("failure messages", func() { - Context("when match fails", func() { - It("gives a descriptive message", func() { - verifyFailureMessage(And(false1, true1), input, "to have length 1") - verifyFailureMessage(And(true1, false2), input, "to equal\n : hip") - verifyFailureMessage(And(true1, true2, false3), input, "to match regular expression\n : hope") - }) - }) - - Context("when match succeeds, but expected it to fail", func() { - It("gives a descriptive message", func() { - verifyFailureMessage(Not(And(true1, true2)), input, - `To not satisfy all of these matchers: [%!s(*matchers.HaveLenMatcher=&{2}) %!s(*matchers.EqualMatcher=&{hi})]`) - }) - }) - }) - - Context("MatchMayChangeInTheFuture", func() { - Context("Match returned false", func() { - Context("returns value of the failed matcher", func() { - It("false if failed matcher not going to change", func() { - // 3 matchers: 1st returns true, 2nd returns false and is not going to change, 3rd is never called - m := And(Not(BeNil()), Or(), Equal(1)) - Expect(m.Match("hi")).To(BeFalse()) - Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // empty Or() indicates not going to change - }) - It("true if failed matcher indicates it might change", func() { - // 3 matchers: 1st returns true, 2nd returns false and "might" change, 3rd is never called - m := And(Not(BeNil()), Equal(5), Equal(1)) - Expect(m.Match("hi")).To(BeFalse()) - Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // Equal(5) indicates it might change - }) - }) - }) - Context("Match returned true", func() { - It("returns true if any of the matchers could change", func() { - // 3 matchers, all return true, and all could change - m := And(Not(BeNil()), Equal("hi"), HaveLen(2)) - Expect(m.Match("hi")).To(BeTrue()) - Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // all 3 of these matchers default to 'true' - }) - It("returns false if none of the matchers could change", func() { - // empty And() has the property of always matching, and never can change since there are no sub-matchers that could change - m := And() - Expect(m.Match("anything")).To(BeTrue()) - Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse()) - - // And() with 3 sub-matchers that return true, and can't change - m = And(And(), And(), And()) - Expect(m.Match("hi")).To(BeTrue()) - Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // the 3 empty And()'s won't change - }) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" + "github.com/onsi/gomega/types" +) + +// sample data +var ( + // example input + input = "hi" + // some matchers that succeed against the input + true1 = HaveLen(2) + true2 = Equal("hi") + true3 = MatchRegexp("hi") + // some matchers that fail against the input. + false1 = HaveLen(1) + false2 = Equal("hip") + false3 = MatchRegexp("hope") +) + +// verifyFailureMessage expects the matcher to fail with the given input, and verifies the failure message. +func verifyFailureMessage(m types.GomegaMatcher, input string, expectedFailureMsgFragment string) { + Expect(m.Match(input)).To(BeFalse()) + Expect(m.FailureMessage(input)).To(Equal( + "Expected\n : " + input + "\n" + expectedFailureMsgFragment)) +} + +var _ = Describe("AndMatcher", func() { + It("works with positive cases", func() { + Expect(input).To(And()) + Expect(input).To(And(true1)) + Expect(input).To(And(true1, true2)) + Expect(input).To(And(true1, true2, true3)) + + // use alias + Expect(input).To(SatisfyAll(true1, true2, true3)) + }) + + It("works with negative cases", func() { + Expect(input).ToNot(And(false1, false2)) + Expect(input).ToNot(And(true1, true2, false3)) + Expect(input).ToNot(And(true1, false2, false3)) + Expect(input).ToNot(And(false1, true1, true2)) + }) + + Context("failure messages", func() { + Context("when match fails", func() { + It("gives a descriptive message", func() { + verifyFailureMessage(And(false1, true1), input, "to have length 1") + verifyFailureMessage(And(true1, false2), input, "to equal\n : hip") + verifyFailureMessage(And(true1, true2, false3), input, "to match regular expression\n : hope") + }) + }) + + Context("when match succeeds, but expected it to fail", func() { + It("gives a descriptive message", func() { + verifyFailureMessage(Not(And(true1, true2)), input, + `To not satisfy all of these matchers: [%!s(*matchers.HaveLenMatcher=&{2}) %!s(*matchers.EqualMatcher=&{hi})]`) + }) + }) + }) + + Context("MatchMayChangeInTheFuture", func() { + Context("Match returned false", func() { + Context("returns value of the failed matcher", func() { + It("false if failed matcher not going to change", func() { + // 3 matchers: 1st returns true, 2nd returns false and is not going to change, 3rd is never called + m := And(Not(BeNil()), Or(), Equal(1)) + Expect(m.Match("hi")).To(BeFalse()) + Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // empty Or() indicates not going to change + }) + It("true if failed matcher indicates it might change", func() { + // 3 matchers: 1st returns true, 2nd returns false and "might" change, 3rd is never called + m := And(Not(BeNil()), Equal(5), Equal(1)) + Expect(m.Match("hi")).To(BeFalse()) + Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // Equal(5) indicates it might change + }) + }) + }) + Context("Match returned true", func() { + It("returns true if any of the matchers could change", func() { + // 3 matchers, all return true, and all could change + m := And(Not(BeNil()), Equal("hi"), HaveLen(2)) + Expect(m.Match("hi")).To(BeTrue()) + Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // all 3 of these matchers default to 'true' + }) + It("returns false if none of the matchers could change", func() { + // empty And() has the property of always matching, and never can change since there are no sub-matchers that could change + m := And() + Expect(m.Match("anything")).To(BeTrue()) + Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse()) + + // And() with 3 sub-matchers that return true, and can't change + m = And(And(), And(), And()) + Expect(m.Match("hi")).To(BeTrue()) + Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // the 3 empty And()'s won't change + }) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go index 129a20b625..89a1fc2116 100644 --- a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go @@ -1,31 +1,31 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type AssignableToTypeOfMatcher struct { - Expected interface{} -} - -func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { - if actual == nil || matcher.Expected == nil { - return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") - } - - actualType := reflect.TypeOf(actual) - expectedType := reflect.TypeOf(matcher.Expected) - - return actualType.AssignableTo(expectedType), nil -} - -func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { - return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) -} - -func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { - return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type AssignableToTypeOfMatcher struct { + Expected interface{} +} + +func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil || matcher.Expected == nil { + return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") + } + + actualType := reflect.TypeOf(actual) + expectedType := reflect.TypeOf(matcher.Expected) + + return actualType.AssignableTo(expectedType), nil +} + +func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { + return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) +} + +func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { + return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) +} diff --git a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go index cd1e8b456e..d2280e0506 100644 --- a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go @@ -1,30 +1,30 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("AssignableToTypeOf", func() { - Context("When asserting assignability between types", func() { - It("should do the right thing", func() { - Ω(0).Should(BeAssignableToTypeOf(0)) - Ω(5).Should(BeAssignableToTypeOf(-1)) - Ω("foo").Should(BeAssignableToTypeOf("bar")) - Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) - - Ω(0).ShouldNot(BeAssignableToTypeOf("bar")) - Ω(5).ShouldNot(BeAssignableToTypeOf(struct{ Foo string }{})) - Ω("foo").ShouldNot(BeAssignableToTypeOf(42)) - }) - }) - - Context("When asserting nil values", func() { - It("should error", func() { - success, err := (&AssignableToTypeOfMatcher{Expected: nil}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("AssignableToTypeOf", func() { + Context("When asserting assignability between types", func() { + It("should do the right thing", func() { + Ω(0).Should(BeAssignableToTypeOf(0)) + Ω(5).Should(BeAssignableToTypeOf(-1)) + Ω("foo").Should(BeAssignableToTypeOf("bar")) + Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) + + Ω(0).ShouldNot(BeAssignableToTypeOf("bar")) + Ω(5).ShouldNot(BeAssignableToTypeOf(struct{ Foo string }{})) + Ω("foo").ShouldNot(BeAssignableToTypeOf(42)) + }) + }) + + Context("When asserting nil values", func() { + It("should error", func() { + success, err := (&AssignableToTypeOfMatcher{Expected: nil}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go index b1e6df228e..7b6975e41e 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_directory.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_directory.go @@ -1,54 +1,54 @@ -package matchers - -import ( - "fmt" - "os" - - "github.com/onsi/gomega/format" -) - -type notADirectoryError struct { - os.FileInfo -} - -func (t notADirectoryError) Error() string { - fileInfo := os.FileInfo(t) - switch { - case fileInfo.Mode().IsRegular(): - return "file is a regular file" - default: - return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) - } -} - -type BeADirectoryMatcher struct { - expected interface{} - err error -} - -func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { - actualFilename, ok := actual.(string) - if !ok { - return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") - } - - fileInfo, err := os.Stat(actualFilename) - if err != nil { - matcher.err = err - return false, nil - } - - if !fileInfo.Mode().IsDir() { - matcher.err = notADirectoryError{fileInfo} - return false, nil - } - return true, nil -} - -func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) -} - -func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not be a directory")) -} +package matchers + +import ( + "fmt" + "os" + + "github.com/onsi/gomega/format" +) + +type notADirectoryError struct { + os.FileInfo +} + +func (t notADirectoryError) Error() string { + fileInfo := os.FileInfo(t) + switch { + case fileInfo.Mode().IsRegular(): + return "file is a regular file" + default: + return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) + } +} + +type BeADirectoryMatcher struct { + expected interface{} + err error +} + +func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { + actualFilename, ok := actual.(string) + if !ok { + return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") + } + + fileInfo, err := os.Stat(actualFilename) + if err != nil { + matcher.err = err + return false, nil + } + + if !fileInfo.Mode().IsDir() { + matcher.err = notADirectoryError{fileInfo} + return false, nil + } + return true, nil +} + +func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) +} + +func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not be a directory")) +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go b/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go index afe41ae56a..e59d769901 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go @@ -1,40 +1,40 @@ -package matchers_test - -import ( - "io/ioutil" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeADirectoryMatcher", func() { - Context("when passed a string", func() { - It("should do the right thing", func() { - Ω("/dne/test").ShouldNot(BeADirectory()) - - tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") - Ω(err).ShouldNot(HaveOccurred()) - defer os.Remove(tmpFile.Name()) - Ω(tmpFile.Name()).ShouldNot(BeADirectory()) - - tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") - Ω(err).ShouldNot(HaveOccurred()) - defer os.Remove(tmpDir) - Ω(tmpDir).Should(BeADirectory()) - }) - }) - - Context("when passed something else", func() { - It("should error", func() { - success, err := (&BeADirectoryMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeADirectoryMatcher{}).Match(true) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + "io/ioutil" + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeADirectoryMatcher", func() { + Context("when passed a string", func() { + It("should do the right thing", func() { + Ω("/dne/test").ShouldNot(BeADirectory()) + + tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") + Ω(err).ShouldNot(HaveOccurred()) + defer os.Remove(tmpFile.Name()) + Ω(tmpFile.Name()).ShouldNot(BeADirectory()) + + tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") + Ω(err).ShouldNot(HaveOccurred()) + defer os.Remove(tmpDir) + Ω(tmpDir).Should(BeADirectory()) + }) + }) + + Context("when passed something else", func() { + It("should error", func() { + success, err := (&BeADirectoryMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeADirectoryMatcher{}).Match(true) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go index 19bfcb3286..e239131fb6 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go @@ -1,54 +1,54 @@ -package matchers - -import ( - "fmt" - "os" - - "github.com/onsi/gomega/format" -) - -type notARegularFileError struct { - os.FileInfo -} - -func (t notARegularFileError) Error() string { - fileInfo := os.FileInfo(t) - switch { - case fileInfo.IsDir(): - return "file is a directory" - default: - return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) - } -} - -type BeARegularFileMatcher struct { - expected interface{} - err error -} - -func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { - actualFilename, ok := actual.(string) - if !ok { - return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") - } - - fileInfo, err := os.Stat(actualFilename) - if err != nil { - matcher.err = err - return false, nil - } - - if !fileInfo.Mode().IsRegular() { - matcher.err = notARegularFileError{fileInfo} - return false, nil - } - return true, nil -} - -func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) -} - -func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not be a regular file")) -} +package matchers + +import ( + "fmt" + "os" + + "github.com/onsi/gomega/format" +) + +type notARegularFileError struct { + os.FileInfo +} + +func (t notARegularFileError) Error() string { + fileInfo := os.FileInfo(t) + switch { + case fileInfo.IsDir(): + return "file is a directory" + default: + return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) + } +} + +type BeARegularFileMatcher struct { + expected interface{} + err error +} + +func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { + actualFilename, ok := actual.(string) + if !ok { + return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") + } + + fileInfo, err := os.Stat(actualFilename) + if err != nil { + matcher.err = err + return false, nil + } + + if !fileInfo.Mode().IsRegular() { + matcher.err = notARegularFileError{fileInfo} + return false, nil + } + return true, nil +} + +func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) +} + +func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not be a regular file")) +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go index 0288468271..951e750d64 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go @@ -1,40 +1,40 @@ -package matchers_test - -import ( - "io/ioutil" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeARegularFileMatcher", func() { - Context("when passed a string", func() { - It("should do the right thing", func() { - Ω("/dne/test").ShouldNot(BeARegularFile()) - - tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") - Ω(err).ShouldNot(HaveOccurred()) - defer os.Remove(tmpFile.Name()) - Ω(tmpFile.Name()).Should(BeARegularFile()) - - tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") - Ω(err).ShouldNot(HaveOccurred()) - defer os.Remove(tmpDir) - Ω(tmpDir).ShouldNot(BeARegularFile()) - }) - }) - - Context("when passed something else", func() { - It("should error", func() { - success, err := (&BeARegularFileMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeARegularFileMatcher{}).Match(true) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + "io/ioutil" + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeARegularFileMatcher", func() { + Context("when passed a string", func() { + It("should do the right thing", func() { + Ω("/dne/test").ShouldNot(BeARegularFile()) + + tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") + Ω(err).ShouldNot(HaveOccurred()) + defer os.Remove(tmpFile.Name()) + Ω(tmpFile.Name()).Should(BeARegularFile()) + + tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") + Ω(err).ShouldNot(HaveOccurred()) + defer os.Remove(tmpDir) + Ω(tmpDir).ShouldNot(BeARegularFile()) + }) + }) + + Context("when passed something else", func() { + It("should error", func() { + success, err := (&BeARegularFileMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeARegularFileMatcher{}).Match(true) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go index 8fd37b90ee..d42eba2234 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go +++ b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go @@ -1,38 +1,38 @@ -package matchers - -import ( - "fmt" - "os" - - "github.com/onsi/gomega/format" -) - -type BeAnExistingFileMatcher struct { - expected interface{} -} - -func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { - actualFilename, ok := actual.(string) - if !ok { - return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") - } - - if _, err = os.Stat(actualFilename); err != nil { - switch { - case os.IsNotExist(err): - return false, nil - default: - return false, err - } - } - - return true, nil -} - -func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("to exist")) -} - -func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not to exist")) -} +package matchers + +import ( + "fmt" + "os" + + "github.com/onsi/gomega/format" +) + +type BeAnExistingFileMatcher struct { + expected interface{} +} + +func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { + actualFilename, ok := actual.(string) + if !ok { + return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") + } + + if _, err = os.Stat(actualFilename); err != nil { + switch { + case os.IsNotExist(err): + return false, nil + default: + return false, err + } + } + + return true, nil +} + +func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to exist")) +} + +func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to exist")) +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go index 496a3a205b..775f7b6aca 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go @@ -1,40 +1,40 @@ -package matchers_test - -import ( - "io/ioutil" - "os" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeAnExistingFileMatcher", func() { - Context("when passed a string", func() { - It("should do the right thing", func() { - Ω("/dne/test").ShouldNot(BeAnExistingFile()) - - tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") - Ω(err).ShouldNot(HaveOccurred()) - defer os.Remove(tmpFile.Name()) - Ω(tmpFile.Name()).Should(BeAnExistingFile()) - - tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") - Ω(err).ShouldNot(HaveOccurred()) - defer os.Remove(tmpDir) - Ω(tmpDir).Should(BeAnExistingFile()) - }) - }) - - Context("when passed something else", func() { - It("should error", func() { - success, err := (&BeAnExistingFileMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeAnExistingFileMatcher{}).Match(true) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + "io/ioutil" + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeAnExistingFileMatcher", func() { + Context("when passed a string", func() { + It("should do the right thing", func() { + Ω("/dne/test").ShouldNot(BeAnExistingFile()) + + tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") + Ω(err).ShouldNot(HaveOccurred()) + defer os.Remove(tmpFile.Name()) + Ω(tmpFile.Name()).Should(BeAnExistingFile()) + + tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") + Ω(err).ShouldNot(HaveOccurred()) + defer os.Remove(tmpDir) + Ω(tmpDir).Should(BeAnExistingFile()) + }) + }) + + Context("when passed something else", func() { + It("should error", func() { + success, err := (&BeAnExistingFileMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeAnExistingFileMatcher{}).Match(true) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go index 7d5cb539e3..c1b499597d 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go @@ -1,45 +1,45 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "reflect" -) - -type BeClosedMatcher struct { -} - -func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { - if !isChan(actual) { - return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) - } - - channelType := reflect.TypeOf(actual) - channelValue := reflect.ValueOf(actual) - - if channelType.ChanDir() == reflect.SendDir { - return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1)) - } - - winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ - reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, - reflect.SelectCase{Dir: reflect.SelectDefault}, - }) - - var closed bool - if winnerIndex == 0 { - closed = !open - } else if winnerIndex == 1 { - closed = false - } - - return closed, nil -} - -func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be closed") -} - -func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be open") -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type BeClosedMatcher struct { +} + +func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { + if !isChan(actual) { + return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) + } + + channelType := reflect.TypeOf(actual) + channelValue := reflect.ValueOf(actual) + + if channelType.ChanDir() == reflect.SendDir { + return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1)) + } + + winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ + reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, + }) + + var closed bool + if winnerIndex == 0 { + closed = !open + } else if winnerIndex == 1 { + closed = false + } + + return closed, nil +} + +func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be closed") +} + +func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be open") +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go index 7a67bc1375..b2c40c9103 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go @@ -1,70 +1,70 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeClosedMatcher", func() { - Context("when passed a channel", func() { - It("should do the right thing", func() { - openChannel := make(chan bool) - Ω(openChannel).ShouldNot(BeClosed()) - - var openReaderChannel <-chan bool - openReaderChannel = openChannel - Ω(openReaderChannel).ShouldNot(BeClosed()) - - closedChannel := make(chan bool) - close(closedChannel) - - Ω(closedChannel).Should(BeClosed()) - - var closedReaderChannel <-chan bool - closedReaderChannel = closedChannel - Ω(closedReaderChannel).Should(BeClosed()) - }) - }) - - Context("when passed a send-only channel", func() { - It("should error", func() { - openChannel := make(chan bool) - var openWriterChannel chan<- bool - openWriterChannel = openChannel - - success, err := (&BeClosedMatcher{}).Match(openWriterChannel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - closedChannel := make(chan bool) - close(closedChannel) - - var closedWriterChannel chan<- bool - closedWriterChannel = closedChannel - - success, err = (&BeClosedMatcher{}).Match(closedWriterChannel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - }) - }) - - Context("when passed something else", func() { - It("should error", func() { - var nilChannel chan bool - - success, err := (&BeClosedMatcher{}).Match(nilChannel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeClosedMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeClosedMatcher{}).Match(7) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeClosedMatcher", func() { + Context("when passed a channel", func() { + It("should do the right thing", func() { + openChannel := make(chan bool) + Ω(openChannel).ShouldNot(BeClosed()) + + var openReaderChannel <-chan bool + openReaderChannel = openChannel + Ω(openReaderChannel).ShouldNot(BeClosed()) + + closedChannel := make(chan bool) + close(closedChannel) + + Ω(closedChannel).Should(BeClosed()) + + var closedReaderChannel <-chan bool + closedReaderChannel = closedChannel + Ω(closedReaderChannel).Should(BeClosed()) + }) + }) + + Context("when passed a send-only channel", func() { + It("should error", func() { + openChannel := make(chan bool) + var openWriterChannel chan<- bool + openWriterChannel = openChannel + + success, err := (&BeClosedMatcher{}).Match(openWriterChannel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + closedChannel := make(chan bool) + close(closedChannel) + + var closedWriterChannel chan<- bool + closedWriterChannel = closedChannel + + success, err = (&BeClosedMatcher{}).Match(closedWriterChannel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + }) + }) + + Context("when passed something else", func() { + It("should error", func() { + var nilChannel chan bool + + success, err := (&BeClosedMatcher{}).Match(nilChannel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeClosedMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeClosedMatcher{}).Match(7) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go index acf5d8364c..55bdd7d15d 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go @@ -1,26 +1,26 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" -) - -type BeEmptyMatcher struct { -} - -func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { - length, ok := lengthOf(actual) - if !ok { - return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) - } - - return length == 0, nil -} - -func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be empty") -} - -func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be empty") -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type BeEmptyMatcher struct { +} + +func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { + length, ok := lengthOf(actual) + if !ok { + return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + } + + return length == 0, nil +} + +func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be empty") +} + +func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be empty") +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go index 8a24d81fdf..541c1b951e 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go @@ -1,52 +1,52 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeEmpty", func() { - Context("when passed a supported type", func() { - It("should do the right thing", func() { - Ω("").Should(BeEmpty()) - Ω(" ").ShouldNot(BeEmpty()) - - Ω([0]int{}).Should(BeEmpty()) - Ω([1]int{1}).ShouldNot(BeEmpty()) - - Ω([]int{}).Should(BeEmpty()) - Ω([]int{1}).ShouldNot(BeEmpty()) - - Ω(map[string]int{}).Should(BeEmpty()) - Ω(map[string]int{"a": 1}).ShouldNot(BeEmpty()) - - c := make(chan bool, 1) - Ω(c).Should(BeEmpty()) - c <- true - Ω(c).ShouldNot(BeEmpty()) - }) - }) - - Context("when passed a correctly typed nil", func() { - It("should be true", func() { - var nilSlice []int - Ω(nilSlice).Should(BeEmpty()) - - var nilMap map[int]string - Ω(nilMap).Should(BeEmpty()) - }) - }) - - Context("when passed an unsupported type", func() { - It("should error", func() { - success, err := (&BeEmptyMatcher{}).Match(0) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeEmptyMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeEmpty", func() { + Context("when passed a supported type", func() { + It("should do the right thing", func() { + Ω("").Should(BeEmpty()) + Ω(" ").ShouldNot(BeEmpty()) + + Ω([0]int{}).Should(BeEmpty()) + Ω([1]int{1}).ShouldNot(BeEmpty()) + + Ω([]int{}).Should(BeEmpty()) + Ω([]int{1}).ShouldNot(BeEmpty()) + + Ω(map[string]int{}).Should(BeEmpty()) + Ω(map[string]int{"a": 1}).ShouldNot(BeEmpty()) + + c := make(chan bool, 1) + Ω(c).Should(BeEmpty()) + c <- true + Ω(c).ShouldNot(BeEmpty()) + }) + }) + + Context("when passed a correctly typed nil", func() { + It("should be true", func() { + var nilSlice []int + Ω(nilSlice).Should(BeEmpty()) + + var nilMap map[int]string + Ω(nilMap).Should(BeEmpty()) + }) + }) + + Context("when passed an unsupported type", func() { + It("should error", func() { + success, err := (&BeEmptyMatcher{}).Match(0) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeEmptyMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go index 57b88d2d83..32a0c3108a 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go @@ -1,33 +1,33 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "reflect" -) - -type BeEquivalentToMatcher struct { - Expected interface{} -} - -func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { - if actual == nil && matcher.Expected == nil { - return false, fmt.Errorf("Both actual and expected must not be nil.") - } - - convertedActual := actual - - if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) { - convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface() - } - - return reflect.DeepEqual(convertedActual, matcher.Expected), nil -} - -func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be equivalent to", matcher.Expected) -} - -func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be equivalent to", matcher.Expected) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type BeEquivalentToMatcher struct { + Expected interface{} +} + +func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil && matcher.Expected == nil { + return false, fmt.Errorf("Both actual and expected must not be nil.") + } + + convertedActual := actual + + if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) { + convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface() + } + + return reflect.DeepEqual(convertedActual, matcher.Expected), nil +} + +func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be equivalent to", matcher.Expected) +} + +func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be equivalent to", matcher.Expected) +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go index da59cfdfa7..def5104fa7 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go @@ -1,50 +1,50 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeEquivalentTo", func() { - Context("when asserting that nil is equivalent to nil", func() { - It("should error", func() { - success, err := (&BeEquivalentToMatcher{Expected: nil}).Match(nil) - - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("When asserting on nil", func() { - It("should do the right thing", func() { - Ω("foo").ShouldNot(BeEquivalentTo(nil)) - Ω(nil).ShouldNot(BeEquivalentTo(3)) - Ω([]int{1, 2}).ShouldNot(BeEquivalentTo(nil)) - }) - }) - - Context("When asserting on type aliases", func() { - It("should the right thing", func() { - Ω(StringAlias("foo")).Should(BeEquivalentTo("foo")) - Ω("foo").Should(BeEquivalentTo(StringAlias("foo"))) - Ω(StringAlias("foo")).ShouldNot(BeEquivalentTo("bar")) - Ω("foo").ShouldNot(BeEquivalentTo(StringAlias("bar"))) - }) - }) - - Context("When asserting on numbers", func() { - It("should convert actual to expected and do the right thing", func() { - Ω(5).Should(BeEquivalentTo(5)) - Ω(5.0).Should(BeEquivalentTo(5.0)) - Ω(5).Should(BeEquivalentTo(5.0)) - - Ω(5).ShouldNot(BeEquivalentTo("5")) - Ω(5).ShouldNot(BeEquivalentTo(3)) - - //Here be dragons! - Ω(5.1).Should(BeEquivalentTo(5)) - Ω(5).ShouldNot(BeEquivalentTo(5.1)) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeEquivalentTo", func() { + Context("when asserting that nil is equivalent to nil", func() { + It("should error", func() { + success, err := (&BeEquivalentToMatcher{Expected: nil}).Match(nil) + + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("When asserting on nil", func() { + It("should do the right thing", func() { + Ω("foo").ShouldNot(BeEquivalentTo(nil)) + Ω(nil).ShouldNot(BeEquivalentTo(3)) + Ω([]int{1, 2}).ShouldNot(BeEquivalentTo(nil)) + }) + }) + + Context("When asserting on type aliases", func() { + It("should the right thing", func() { + Ω(StringAlias("foo")).Should(BeEquivalentTo("foo")) + Ω("foo").Should(BeEquivalentTo(StringAlias("foo"))) + Ω(StringAlias("foo")).ShouldNot(BeEquivalentTo("bar")) + Ω("foo").ShouldNot(BeEquivalentTo(StringAlias("bar"))) + }) + }) + + Context("When asserting on numbers", func() { + It("should convert actual to expected and do the right thing", func() { + Ω(5).Should(BeEquivalentTo(5)) + Ω(5.0).Should(BeEquivalentTo(5.0)) + Ω(5).Should(BeEquivalentTo(5.0)) + + Ω(5).ShouldNot(BeEquivalentTo("5")) + Ω(5).ShouldNot(BeEquivalentTo(3)) + + //Here be dragons! + Ω(5.1).Should(BeEquivalentTo(5)) + Ω(5).ShouldNot(BeEquivalentTo(5.1)) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go index e16714a122..0b224cbbc6 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_false_matcher.go @@ -1,25 +1,25 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" -) - -type BeFalseMatcher struct { -} - -func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { - if !isBool(actual) { - return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) - } - - return actual == false, nil -} - -func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be false") -} - -func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be false") -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type BeFalseMatcher struct { +} + +func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { + if !isBool(actual) { + return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) + } + + return actual == false, nil +} + +func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be false") +} + +func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be false") +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go index 1a85db0abd..3965a2c539 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go @@ -1,20 +1,20 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeFalse", func() { - It("should handle true and false correctly", func() { - Ω(true).ShouldNot(BeFalse()) - Ω(false).Should(BeFalse()) - }) - - It("should only support booleans", func() { - success, err := (&BeFalseMatcher{}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeFalse", func() { + It("should handle true and false correctly", func() { + Ω(true).ShouldNot(BeFalse()) + Ω(false).Should(BeFalse()) + }) + + It("should only support booleans", func() { + success, err := (&BeFalseMatcher{}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_identical_to.go b/vendor/github.com/onsi/gomega/matchers/be_identical_to.go index a215b26b23..fdcda4d1fb 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_identical_to.go +++ b/vendor/github.com/onsi/gomega/matchers/be_identical_to.go @@ -1,37 +1,37 @@ -package matchers - -import ( - "fmt" - "runtime" - - "github.com/onsi/gomega/format" -) - -type BeIdenticalToMatcher struct { - Expected interface{} -} - -func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) { - if actual == nil && matcher.Expected == nil { - return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") - } - - defer func() { - if r := recover(); r != nil { - if _, ok := r.(runtime.Error); ok { - success = false - matchErr = nil - } - } - }() - - return actual == matcher.Expected, nil -} - -func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string { - return format.Message(actual, "to be identical to", matcher.Expected) -} - -func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string { - return format.Message(actual, "not to be identical to", matcher.Expected) -} +package matchers + +import ( + "fmt" + "runtime" + + "github.com/onsi/gomega/format" +) + +type BeIdenticalToMatcher struct { + Expected interface{} +} + +func (matcher *BeIdenticalToMatcher) Match(actual interface{}) (success bool, matchErr error) { + if actual == nil && matcher.Expected == nil { + return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") + } + + defer func() { + if r := recover(); r != nil { + if _, ok := r.(runtime.Error); ok { + success = false + matchErr = nil + } + } + }() + + return actual == matcher.Expected, nil +} + +func (matcher *BeIdenticalToMatcher) FailureMessage(actual interface{}) string { + return format.Message(actual, "to be identical to", matcher.Expected) +} + +func (matcher *BeIdenticalToMatcher) NegatedFailureMessage(actual interface{}) string { + return format.Message(actual, "not to be identical to", matcher.Expected) +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go b/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go index 846f5df4db..8b90a1a619 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go @@ -1,61 +1,61 @@ -package matchers_test - -import ( - "errors" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeIdenticalTo", func() { - Context("when asserting that nil equals nil", func() { - It("should error", func() { - success, err := (&BeIdenticalToMatcher{Expected: nil}).Match(nil) - - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - It("should treat the same pointer to a struct as identical", func() { - mySpecialStruct := myCustomType{} - Ω(&mySpecialStruct).Should(BeIdenticalTo(&mySpecialStruct)) - Ω(&myCustomType{}).ShouldNot(BeIdenticalTo(&mySpecialStruct)) - }) - - It("should be strict about types", func() { - Ω(5).ShouldNot(BeIdenticalTo("5")) - Ω(5).ShouldNot(BeIdenticalTo(5.0)) - Ω(5).ShouldNot(BeIdenticalTo(3)) - }) - - It("should treat primtives as identical", func() { - Ω("5").Should(BeIdenticalTo("5")) - Ω("5").ShouldNot(BeIdenticalTo("55")) - - Ω(5.55).Should(BeIdenticalTo(5.55)) - Ω(5.55).ShouldNot(BeIdenticalTo(6.66)) - - Ω(5).Should(BeIdenticalTo(5)) - Ω(5).ShouldNot(BeIdenticalTo(55)) - }) - - It("should treat the same pointers to a slice as identical", func() { - mySlice := []int{1, 2} - Ω(&mySlice).Should(BeIdenticalTo(&mySlice)) - Ω(&mySlice).ShouldNot(BeIdenticalTo(&[]int{1, 2})) - }) - - It("should treat the same pointers to a map as identical", func() { - myMap := map[string]string{"a": "b", "c": "d"} - Ω(&myMap).Should(BeIdenticalTo(&myMap)) - Ω(myMap).ShouldNot(BeIdenticalTo(map[string]string{"a": "b", "c": "d"})) - }) - - It("should treat the same pointers to an error as identical", func() { - myError := errors.New("foo") - Ω(&myError).Should(BeIdenticalTo(&myError)) - Ω(errors.New("foo")).ShouldNot(BeIdenticalTo(errors.New("bar"))) - }) -}) +package matchers_test + +import ( + "errors" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeIdenticalTo", func() { + Context("when asserting that nil equals nil", func() { + It("should error", func() { + success, err := (&BeIdenticalToMatcher{Expected: nil}).Match(nil) + + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + It("should treat the same pointer to a struct as identical", func() { + mySpecialStruct := myCustomType{} + Ω(&mySpecialStruct).Should(BeIdenticalTo(&mySpecialStruct)) + Ω(&myCustomType{}).ShouldNot(BeIdenticalTo(&mySpecialStruct)) + }) + + It("should be strict about types", func() { + Ω(5).ShouldNot(BeIdenticalTo("5")) + Ω(5).ShouldNot(BeIdenticalTo(5.0)) + Ω(5).ShouldNot(BeIdenticalTo(3)) + }) + + It("should treat primtives as identical", func() { + Ω("5").Should(BeIdenticalTo("5")) + Ω("5").ShouldNot(BeIdenticalTo("55")) + + Ω(5.55).Should(BeIdenticalTo(5.55)) + Ω(5.55).ShouldNot(BeIdenticalTo(6.66)) + + Ω(5).Should(BeIdenticalTo(5)) + Ω(5).ShouldNot(BeIdenticalTo(55)) + }) + + It("should treat the same pointers to a slice as identical", func() { + mySlice := []int{1, 2} + Ω(&mySlice).Should(BeIdenticalTo(&mySlice)) + Ω(&mySlice).ShouldNot(BeIdenticalTo(&[]int{1, 2})) + }) + + It("should treat the same pointers to a map as identical", func() { + myMap := map[string]string{"a": "b", "c": "d"} + Ω(&myMap).Should(BeIdenticalTo(&myMap)) + Ω(myMap).ShouldNot(BeIdenticalTo(map[string]string{"a": "b", "c": "d"})) + }) + + It("should treat the same pointers to an error as identical", func() { + myError := errors.New("foo") + Ω(&myError).Should(BeIdenticalTo(&myError)) + Ω(errors.New("foo")).ShouldNot(BeIdenticalTo(errors.New("bar"))) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go index b02d9f0003..7ee84fe1bc 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go @@ -1,18 +1,18 @@ -package matchers - -import "github.com/onsi/gomega/format" - -type BeNilMatcher struct { -} - -func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { - return isNil(actual), nil -} - -func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be nil") -} - -func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be nil") -} +package matchers + +import "github.com/onsi/gomega/format" + +type BeNilMatcher struct { +} + +func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { + return isNil(actual), nil +} + +func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be nil") +} + +func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be nil") +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go index 7d7d03a60e..7533253632 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go @@ -1,28 +1,28 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("BeNil", func() { - It("should succeed when passed nil", func() { - Ω(nil).Should(BeNil()) - }) - - It("should succeed when passed a typed nil", func() { - var a []int - Ω(a).Should(BeNil()) - }) - - It("should succeed when passing nil pointer", func() { - var f *struct{} - Ω(f).Should(BeNil()) - }) - - It("should not succeed when not passed nil", func() { - Ω(0).ShouldNot(BeNil()) - Ω(false).ShouldNot(BeNil()) - Ω("").ShouldNot(BeNil()) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("BeNil", func() { + It("should succeed when passed nil", func() { + Ω(nil).Should(BeNil()) + }) + + It("should succeed when passed a typed nil", func() { + var a []int + Ω(a).Should(BeNil()) + }) + + It("should succeed when passing nil pointer", func() { + var f *struct{} + Ω(f).Should(BeNil()) + }) + + It("should not succeed when not passed nil", func() { + Ω(0).ShouldNot(BeNil()) + Ω(false).ShouldNot(BeNil()) + Ω("").ShouldNot(BeNil()) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go index 927d5fab87..0c157f61b9 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go @@ -1,120 +1,120 @@ -package matchers - -import ( - "fmt" - "math" - - "github.com/onsi/gomega/format" -) - -type BeNumericallyMatcher struct { - Comparator string - CompareTo []interface{} -} - -func (matcher *BeNumericallyMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo[0]) -} - -func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo[0]) -} - -func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, err error) { - if len(matcher.CompareTo) == 0 || len(matcher.CompareTo) > 2 { - return false, fmt.Errorf("BeNumerically requires 1 or 2 CompareTo arguments. Got:\n%s", format.Object(matcher.CompareTo, 1)) - } - if !isNumber(actual) { - return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(actual, 1)) - } - if !isNumber(matcher.CompareTo[0]) { - return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1)) - } - if len(matcher.CompareTo) == 2 && !isNumber(matcher.CompareTo[1]) { - return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1)) - } - - switch matcher.Comparator { - case "==", "~", ">", ">=", "<", "<=": - default: - return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) - } - - if isFloat(actual) || isFloat(matcher.CompareTo[0]) { - var secondOperand float64 = 1e-8 - if len(matcher.CompareTo) == 2 { - secondOperand = toFloat(matcher.CompareTo[1]) - } - success = matcher.matchFloats(toFloat(actual), toFloat(matcher.CompareTo[0]), secondOperand) - } else if isInteger(actual) { - var secondOperand int64 = 0 - if len(matcher.CompareTo) == 2 { - secondOperand = toInteger(matcher.CompareTo[1]) - } - success = matcher.matchIntegers(toInteger(actual), toInteger(matcher.CompareTo[0]), secondOperand) - } else if isUnsignedInteger(actual) { - var secondOperand uint64 = 0 - if len(matcher.CompareTo) == 2 { - secondOperand = toUnsignedInteger(matcher.CompareTo[1]) - } - success = matcher.matchUnsignedIntegers(toUnsignedInteger(actual), toUnsignedInteger(matcher.CompareTo[0]), secondOperand) - } else { - return false, fmt.Errorf("Failed to compare:\n%s\n%s:\n%s", format.Object(actual, 1), matcher.Comparator, format.Object(matcher.CompareTo[0], 1)) - } - - return success, nil -} - -func (matcher *BeNumericallyMatcher) matchIntegers(actual, compareTo, threshold int64) (success bool) { - switch matcher.Comparator { - case "==", "~": - diff := actual - compareTo - return -threshold <= diff && diff <= threshold - case ">": - return (actual > compareTo) - case ">=": - return (actual >= compareTo) - case "<": - return (actual < compareTo) - case "<=": - return (actual <= compareTo) - } - return false -} - -func (matcher *BeNumericallyMatcher) matchUnsignedIntegers(actual, compareTo, threshold uint64) (success bool) { - switch matcher.Comparator { - case "==", "~": - if actual < compareTo { - actual, compareTo = compareTo, actual - } - return actual-compareTo <= threshold - case ">": - return (actual > compareTo) - case ">=": - return (actual >= compareTo) - case "<": - return (actual < compareTo) - case "<=": - return (actual <= compareTo) - } - return false -} - -func (matcher *BeNumericallyMatcher) matchFloats(actual, compareTo, threshold float64) (success bool) { - switch matcher.Comparator { - case "~": - return math.Abs(actual-compareTo) <= threshold - case "==": - return (actual == compareTo) - case ">": - return (actual > compareTo) - case ">=": - return (actual >= compareTo) - case "<": - return (actual < compareTo) - case "<=": - return (actual <= compareTo) - } - return false -} +package matchers + +import ( + "fmt" + "math" + + "github.com/onsi/gomega/format" +) + +type BeNumericallyMatcher struct { + Comparator string + CompareTo []interface{} +} + +func (matcher *BeNumericallyMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo[0]) +} + +func (matcher *BeNumericallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo[0]) +} + +func (matcher *BeNumericallyMatcher) Match(actual interface{}) (success bool, err error) { + if len(matcher.CompareTo) == 0 || len(matcher.CompareTo) > 2 { + return false, fmt.Errorf("BeNumerically requires 1 or 2 CompareTo arguments. Got:\n%s", format.Object(matcher.CompareTo, 1)) + } + if !isNumber(actual) { + return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(actual, 1)) + } + if !isNumber(matcher.CompareTo[0]) { + return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1)) + } + if len(matcher.CompareTo) == 2 && !isNumber(matcher.CompareTo[1]) { + return false, fmt.Errorf("Expected a number. Got:\n%s", format.Object(matcher.CompareTo[0], 1)) + } + + switch matcher.Comparator { + case "==", "~", ">", ">=", "<", "<=": + default: + return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) + } + + if isFloat(actual) || isFloat(matcher.CompareTo[0]) { + var secondOperand float64 = 1e-8 + if len(matcher.CompareTo) == 2 { + secondOperand = toFloat(matcher.CompareTo[1]) + } + success = matcher.matchFloats(toFloat(actual), toFloat(matcher.CompareTo[0]), secondOperand) + } else if isInteger(actual) { + var secondOperand int64 = 0 + if len(matcher.CompareTo) == 2 { + secondOperand = toInteger(matcher.CompareTo[1]) + } + success = matcher.matchIntegers(toInteger(actual), toInteger(matcher.CompareTo[0]), secondOperand) + } else if isUnsignedInteger(actual) { + var secondOperand uint64 = 0 + if len(matcher.CompareTo) == 2 { + secondOperand = toUnsignedInteger(matcher.CompareTo[1]) + } + success = matcher.matchUnsignedIntegers(toUnsignedInteger(actual), toUnsignedInteger(matcher.CompareTo[0]), secondOperand) + } else { + return false, fmt.Errorf("Failed to compare:\n%s\n%s:\n%s", format.Object(actual, 1), matcher.Comparator, format.Object(matcher.CompareTo[0], 1)) + } + + return success, nil +} + +func (matcher *BeNumericallyMatcher) matchIntegers(actual, compareTo, threshold int64) (success bool) { + switch matcher.Comparator { + case "==", "~": + diff := actual - compareTo + return -threshold <= diff && diff <= threshold + case ">": + return (actual > compareTo) + case ">=": + return (actual >= compareTo) + case "<": + return (actual < compareTo) + case "<=": + return (actual <= compareTo) + } + return false +} + +func (matcher *BeNumericallyMatcher) matchUnsignedIntegers(actual, compareTo, threshold uint64) (success bool) { + switch matcher.Comparator { + case "==", "~": + if actual < compareTo { + actual, compareTo = compareTo, actual + } + return actual-compareTo <= threshold + case ">": + return (actual > compareTo) + case ">=": + return (actual >= compareTo) + case "<": + return (actual < compareTo) + case "<=": + return (actual <= compareTo) + } + return false +} + +func (matcher *BeNumericallyMatcher) matchFloats(actual, compareTo, threshold float64) (success bool) { + switch matcher.Comparator { + case "~": + return math.Abs(actual-compareTo) <= threshold + case "==": + return (actual == compareTo) + case ">": + return (actual > compareTo) + case ">=": + return (actual >= compareTo) + case "<": + return (actual < compareTo) + case "<=": + return (actual <= compareTo) + } + return false +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go index 8166b9849b..43fdb1fe0b 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go @@ -1,148 +1,148 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeNumerically", func() { - Context("when passed a number", func() { - It("should support ==", func() { - Ω(uint32(5)).Should(BeNumerically("==", 5)) - Ω(float64(5.0)).Should(BeNumerically("==", 5)) - Ω(int8(5)).Should(BeNumerically("==", 5)) - }) - - It("should not have false positives", func() { - Ω(5.1).ShouldNot(BeNumerically("==", 5)) - Ω(5).ShouldNot(BeNumerically("==", 5.1)) - }) - - It("should support >", func() { - Ω(uint32(5)).Should(BeNumerically(">", 4)) - Ω(float64(5.0)).Should(BeNumerically(">", 4.9)) - Ω(int8(5)).Should(BeNumerically(">", 4)) - - Ω(uint32(5)).ShouldNot(BeNumerically(">", 5)) - Ω(float64(5.0)).ShouldNot(BeNumerically(">", 5.0)) - Ω(int8(5)).ShouldNot(BeNumerically(">", 5)) - }) - - It("should support <", func() { - Ω(uint32(5)).Should(BeNumerically("<", 6)) - Ω(float64(5.0)).Should(BeNumerically("<", 5.1)) - Ω(int8(5)).Should(BeNumerically("<", 6)) - - Ω(uint32(5)).ShouldNot(BeNumerically("<", 5)) - Ω(float64(5.0)).ShouldNot(BeNumerically("<", 5.0)) - Ω(int8(5)).ShouldNot(BeNumerically("<", 5)) - }) - - It("should support >=", func() { - Ω(uint32(5)).Should(BeNumerically(">=", 4)) - Ω(float64(5.0)).Should(BeNumerically(">=", 4.9)) - Ω(int8(5)).Should(BeNumerically(">=", 4)) - - Ω(uint32(5)).Should(BeNumerically(">=", 5)) - Ω(float64(5.0)).Should(BeNumerically(">=", 5.0)) - Ω(int8(5)).Should(BeNumerically(">=", 5)) - - Ω(uint32(5)).ShouldNot(BeNumerically(">=", 6)) - Ω(float64(5.0)).ShouldNot(BeNumerically(">=", 5.1)) - Ω(int8(5)).ShouldNot(BeNumerically(">=", 6)) - }) - - It("should support <=", func() { - Ω(uint32(5)).Should(BeNumerically("<=", 6)) - Ω(float64(5.0)).Should(BeNumerically("<=", 5.1)) - Ω(int8(5)).Should(BeNumerically("<=", 6)) - - Ω(uint32(5)).Should(BeNumerically("<=", 5)) - Ω(float64(5.0)).Should(BeNumerically("<=", 5.0)) - Ω(int8(5)).Should(BeNumerically("<=", 5)) - - Ω(uint32(5)).ShouldNot(BeNumerically("<=", 4)) - Ω(float64(5.0)).ShouldNot(BeNumerically("<=", 4.9)) - Ω(int8(5)).Should(BeNumerically("<=", 5)) - }) - - Context("when passed ~", func() { - Context("when passed a float", func() { - Context("and there is no precision parameter", func() { - It("should default to 1e-8", func() { - Ω(5.00000001).Should(BeNumerically("~", 5.00000002)) - Ω(5.00000001).ShouldNot(BeNumerically("~", 5.0000001)) - }) - }) - - Context("and there is a precision parameter", func() { - It("should use the precision parameter", func() { - Ω(5.1).Should(BeNumerically("~", 5.19, 0.1)) - Ω(5.1).Should(BeNumerically("~", 5.01, 0.1)) - Ω(5.1).ShouldNot(BeNumerically("~", 5.22, 0.1)) - Ω(5.1).ShouldNot(BeNumerically("~", 4.98, 0.1)) - }) - }) - }) - - Context("when passed an int/uint", func() { - Context("and there is no precision parameter", func() { - It("should just do strict equality", func() { - Ω(5).Should(BeNumerically("~", 5)) - Ω(5).ShouldNot(BeNumerically("~", 6)) - Ω(uint(5)).ShouldNot(BeNumerically("~", 6)) - }) - }) - - Context("and there is a precision parameter", func() { - It("should use precision paramter", func() { - Ω(5).Should(BeNumerically("~", 6, 2)) - Ω(5).ShouldNot(BeNumerically("~", 8, 2)) - Ω(uint(5)).Should(BeNumerically("~", 6, 1)) - }) - }) - }) - }) - }) - - Context("when passed a non-number", func() { - It("should error", func() { - success, err := (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{5}}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeNumericallyMatcher{Comparator: "=="}).Match(5) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeNumericallyMatcher{Comparator: "~", CompareTo: []interface{}{3.0, "foo"}}).Match(5.0) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match(5) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{nil}}).Match(0) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{0}}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed an unsupported comparator", func() { - It("should error", func() { - success, err := (&BeNumericallyMatcher{Comparator: "!=", CompareTo: []interface{}{5}}).Match(4) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeNumerically", func() { + Context("when passed a number", func() { + It("should support ==", func() { + Ω(uint32(5)).Should(BeNumerically("==", 5)) + Ω(float64(5.0)).Should(BeNumerically("==", 5)) + Ω(int8(5)).Should(BeNumerically("==", 5)) + }) + + It("should not have false positives", func() { + Ω(5.1).ShouldNot(BeNumerically("==", 5)) + Ω(5).ShouldNot(BeNumerically("==", 5.1)) + }) + + It("should support >", func() { + Ω(uint32(5)).Should(BeNumerically(">", 4)) + Ω(float64(5.0)).Should(BeNumerically(">", 4.9)) + Ω(int8(5)).Should(BeNumerically(">", 4)) + + Ω(uint32(5)).ShouldNot(BeNumerically(">", 5)) + Ω(float64(5.0)).ShouldNot(BeNumerically(">", 5.0)) + Ω(int8(5)).ShouldNot(BeNumerically(">", 5)) + }) + + It("should support <", func() { + Ω(uint32(5)).Should(BeNumerically("<", 6)) + Ω(float64(5.0)).Should(BeNumerically("<", 5.1)) + Ω(int8(5)).Should(BeNumerically("<", 6)) + + Ω(uint32(5)).ShouldNot(BeNumerically("<", 5)) + Ω(float64(5.0)).ShouldNot(BeNumerically("<", 5.0)) + Ω(int8(5)).ShouldNot(BeNumerically("<", 5)) + }) + + It("should support >=", func() { + Ω(uint32(5)).Should(BeNumerically(">=", 4)) + Ω(float64(5.0)).Should(BeNumerically(">=", 4.9)) + Ω(int8(5)).Should(BeNumerically(">=", 4)) + + Ω(uint32(5)).Should(BeNumerically(">=", 5)) + Ω(float64(5.0)).Should(BeNumerically(">=", 5.0)) + Ω(int8(5)).Should(BeNumerically(">=", 5)) + + Ω(uint32(5)).ShouldNot(BeNumerically(">=", 6)) + Ω(float64(5.0)).ShouldNot(BeNumerically(">=", 5.1)) + Ω(int8(5)).ShouldNot(BeNumerically(">=", 6)) + }) + + It("should support <=", func() { + Ω(uint32(5)).Should(BeNumerically("<=", 6)) + Ω(float64(5.0)).Should(BeNumerically("<=", 5.1)) + Ω(int8(5)).Should(BeNumerically("<=", 6)) + + Ω(uint32(5)).Should(BeNumerically("<=", 5)) + Ω(float64(5.0)).Should(BeNumerically("<=", 5.0)) + Ω(int8(5)).Should(BeNumerically("<=", 5)) + + Ω(uint32(5)).ShouldNot(BeNumerically("<=", 4)) + Ω(float64(5.0)).ShouldNot(BeNumerically("<=", 4.9)) + Ω(int8(5)).Should(BeNumerically("<=", 5)) + }) + + Context("when passed ~", func() { + Context("when passed a float", func() { + Context("and there is no precision parameter", func() { + It("should default to 1e-8", func() { + Ω(5.00000001).Should(BeNumerically("~", 5.00000002)) + Ω(5.00000001).ShouldNot(BeNumerically("~", 5.0000001)) + }) + }) + + Context("and there is a precision parameter", func() { + It("should use the precision parameter", func() { + Ω(5.1).Should(BeNumerically("~", 5.19, 0.1)) + Ω(5.1).Should(BeNumerically("~", 5.01, 0.1)) + Ω(5.1).ShouldNot(BeNumerically("~", 5.22, 0.1)) + Ω(5.1).ShouldNot(BeNumerically("~", 4.98, 0.1)) + }) + }) + }) + + Context("when passed an int/uint", func() { + Context("and there is no precision parameter", func() { + It("should just do strict equality", func() { + Ω(5).Should(BeNumerically("~", 5)) + Ω(5).ShouldNot(BeNumerically("~", 6)) + Ω(uint(5)).ShouldNot(BeNumerically("~", 6)) + }) + }) + + Context("and there is a precision parameter", func() { + It("should use precision paramter", func() { + Ω(5).Should(BeNumerically("~", 6, 2)) + Ω(5).ShouldNot(BeNumerically("~", 8, 2)) + Ω(uint(5)).Should(BeNumerically("~", 6, 1)) + }) + }) + }) + }) + }) + + Context("when passed a non-number", func() { + It("should error", func() { + success, err := (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{5}}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeNumericallyMatcher{Comparator: "=="}).Match(5) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeNumericallyMatcher{Comparator: "~", CompareTo: []interface{}{3.0, "foo"}}).Match(5.0) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match(5) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{nil}}).Match(0) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{0}}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed an unsupported comparator", func() { + It("should error", func() { + success, err := (&BeNumericallyMatcher{Comparator: "!=", CompareTo: []interface{}{5}}).Match(4) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go index 3506ce9c86..d7c32233ec 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go @@ -1,71 +1,71 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type BeSentMatcher struct { - Arg interface{} - channelClosed bool -} - -func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error) { - if !isChan(actual) { - return false, fmt.Errorf("BeSent expects a channel. Got:\n%s", format.Object(actual, 1)) - } - - channelType := reflect.TypeOf(actual) - channelValue := reflect.ValueOf(actual) - - if channelType.ChanDir() == reflect.RecvDir { - return false, fmt.Errorf("BeSent matcher cannot be passed a receive-only channel. Got:\n%s", format.Object(actual, 1)) - } - - argType := reflect.TypeOf(matcher.Arg) - assignable := argType.AssignableTo(channelType.Elem()) - - if !assignable { - return false, fmt.Errorf("Cannot pass:\n%s to the channel:\n%s\nThe types don't match.", format.Object(matcher.Arg, 1), format.Object(actual, 1)) - } - - argValue := reflect.ValueOf(matcher.Arg) - - defer func() { - if e := recover(); e != nil { - success = false - err = fmt.Errorf("Cannot send to a closed channel") - matcher.channelClosed = true - } - }() - - winnerIndex, _, _ := reflect.Select([]reflect.SelectCase{ - reflect.SelectCase{Dir: reflect.SelectSend, Chan: channelValue, Send: argValue}, - reflect.SelectCase{Dir: reflect.SelectDefault}, - }) - - var didSend bool - if winnerIndex == 0 { - didSend = true - } - - return didSend, nil -} - -func (matcher *BeSentMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to send:", matcher.Arg) -} - -func (matcher *BeSentMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to send:", matcher.Arg) -} - -func (matcher *BeSentMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - if !isChan(actual) { - return false - } - - return !matcher.channelClosed -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type BeSentMatcher struct { + Arg interface{} + channelClosed bool +} + +func (matcher *BeSentMatcher) Match(actual interface{}) (success bool, err error) { + if !isChan(actual) { + return false, fmt.Errorf("BeSent expects a channel. Got:\n%s", format.Object(actual, 1)) + } + + channelType := reflect.TypeOf(actual) + channelValue := reflect.ValueOf(actual) + + if channelType.ChanDir() == reflect.RecvDir { + return false, fmt.Errorf("BeSent matcher cannot be passed a receive-only channel. Got:\n%s", format.Object(actual, 1)) + } + + argType := reflect.TypeOf(matcher.Arg) + assignable := argType.AssignableTo(channelType.Elem()) + + if !assignable { + return false, fmt.Errorf("Cannot pass:\n%s to the channel:\n%s\nThe types don't match.", format.Object(matcher.Arg, 1), format.Object(actual, 1)) + } + + argValue := reflect.ValueOf(matcher.Arg) + + defer func() { + if e := recover(); e != nil { + success = false + err = fmt.Errorf("Cannot send to a closed channel") + matcher.channelClosed = true + } + }() + + winnerIndex, _, _ := reflect.Select([]reflect.SelectCase{ + reflect.SelectCase{Dir: reflect.SelectSend, Chan: channelValue, Send: argValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, + }) + + var didSend bool + if winnerIndex == 0 { + didSend = true + } + + return didSend, nil +} + +func (matcher *BeSentMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to send:", matcher.Arg) +} + +func (matcher *BeSentMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to send:", matcher.Arg) +} + +func (matcher *BeSentMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + if !isChan(actual) { + return false + } + + return !matcher.channelClosed +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go index b4403d05fc..205d71f405 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go @@ -1,106 +1,106 @@ -package matchers_test - -import ( - . "github.com/onsi/gomega/matchers" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("BeSent", func() { - Context("when passed a channel and a matching type", func() { - Context("when the channel is ready to receive", func() { - It("should succeed and send the value down the channel", func() { - c := make(chan string) - d := make(chan string) - go func() { - val := <-c - d <- val - }() - - time.Sleep(10 * time.Millisecond) - - Ω(c).Should(BeSent("foo")) - Eventually(d).Should(Receive(Equal("foo"))) - }) - - It("should succeed (with a buffered channel)", func() { - c := make(chan string, 1) - Ω(c).Should(BeSent("foo")) - Ω(<-c).Should(Equal("foo")) - }) - }) - - Context("when the channel is not ready to receive", func() { - It("should fail and not send down the channel", func() { - c := make(chan string) - Ω(c).ShouldNot(BeSent("foo")) - Consistently(c).ShouldNot(Receive()) - }) - }) - - Context("when the channel is eventually ready to receive", func() { - It("should succeed", func() { - c := make(chan string) - d := make(chan string) - go func() { - time.Sleep(30 * time.Millisecond) - val := <-c - d <- val - }() - - Eventually(c).Should(BeSent("foo")) - Eventually(d).Should(Receive(Equal("foo"))) - }) - }) - - Context("when the channel is closed", func() { - It("should error", func() { - c := make(chan string) - close(c) - success, err := (&BeSentMatcher{Arg: "foo"}).Match(c) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - - It("should short-circuit Eventually", func() { - c := make(chan string) - close(c) - - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(c, 10.0).Should(BeSent("foo")) - }) - Ω(failures).Should(HaveLen(1)) - Ω(time.Since(t)).Should(BeNumerically("<", time.Second)) - }) - }) - }) - - Context("when passed a channel and a non-matching type", func() { - It("should error", func() { - success, err := (&BeSentMatcher{Arg: "foo"}).Match(make(chan int, 1)) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed a receive-only channel", func() { - It("should error", func() { - var c <-chan string - c = make(chan string, 1) - success, err := (&BeSentMatcher{Arg: "foo"}).Match(c) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed a nonchannel", func() { - It("should error", func() { - success, err := (&BeSentMatcher{Arg: "foo"}).Match("bar") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/gomega/matchers" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("BeSent", func() { + Context("when passed a channel and a matching type", func() { + Context("when the channel is ready to receive", func() { + It("should succeed and send the value down the channel", func() { + c := make(chan string) + d := make(chan string) + go func() { + val := <-c + d <- val + }() + + time.Sleep(10 * time.Millisecond) + + Ω(c).Should(BeSent("foo")) + Eventually(d).Should(Receive(Equal("foo"))) + }) + + It("should succeed (with a buffered channel)", func() { + c := make(chan string, 1) + Ω(c).Should(BeSent("foo")) + Ω(<-c).Should(Equal("foo")) + }) + }) + + Context("when the channel is not ready to receive", func() { + It("should fail and not send down the channel", func() { + c := make(chan string) + Ω(c).ShouldNot(BeSent("foo")) + Consistently(c).ShouldNot(Receive()) + }) + }) + + Context("when the channel is eventually ready to receive", func() { + It("should succeed", func() { + c := make(chan string) + d := make(chan string) + go func() { + time.Sleep(30 * time.Millisecond) + val := <-c + d <- val + }() + + Eventually(c).Should(BeSent("foo")) + Eventually(d).Should(Receive(Equal("foo"))) + }) + }) + + Context("when the channel is closed", func() { + It("should error", func() { + c := make(chan string) + close(c) + success, err := (&BeSentMatcher{Arg: "foo"}).Match(c) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + + It("should short-circuit Eventually", func() { + c := make(chan string) + close(c) + + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(c, 10.0).Should(BeSent("foo")) + }) + Ω(failures).Should(HaveLen(1)) + Ω(time.Since(t)).Should(BeNumerically("<", time.Second)) + }) + }) + }) + + Context("when passed a channel and a non-matching type", func() { + It("should error", func() { + success, err := (&BeSentMatcher{Arg: "foo"}).Match(make(chan int, 1)) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed a receive-only channel", func() { + It("should error", func() { + var c <-chan string + c = make(chan string, 1) + success, err := (&BeSentMatcher{Arg: "foo"}).Match(c) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed a nonchannel", func() { + It("should error", func() { + success, err := (&BeSentMatcher{Arg: "foo"}).Match("bar") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go index c4cbe02d12..abda4eb1e7 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go @@ -1,65 +1,65 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "time" -) - -type BeTemporallyMatcher struct { - Comparator string - CompareTo time.Time - Threshold []time.Duration -} - -func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo) -} - -func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo) -} - -func (matcher *BeTemporallyMatcher) Match(actual interface{}) (bool, error) { - // predicate to test for time.Time type - isTime := func(t interface{}) bool { - _, ok := t.(time.Time) - return ok - } - - if !isTime(actual) { - return false, fmt.Errorf("Expected a time.Time. Got:\n%s", format.Object(actual, 1)) - } - - switch matcher.Comparator { - case "==", "~", ">", ">=", "<", "<=": - default: - return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) - } - - var threshold = time.Millisecond - if len(matcher.Threshold) == 1 { - threshold = matcher.Threshold[0] - } - - return matcher.matchTimes(actual.(time.Time), matcher.CompareTo, threshold), nil -} - -func (matcher *BeTemporallyMatcher) matchTimes(actual, compareTo time.Time, threshold time.Duration) (success bool) { - switch matcher.Comparator { - case "==": - return actual.Equal(compareTo) - case "~": - diff := actual.Sub(compareTo) - return -threshold <= diff && diff <= threshold - case ">": - return actual.After(compareTo) - case ">=": - return !actual.Before(compareTo) - case "<": - return actual.Before(compareTo) - case "<=": - return !actual.After(compareTo) - } - return false -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "time" +) + +type BeTemporallyMatcher struct { + Comparator string + CompareTo time.Time + Threshold []time.Duration +} + +func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo) +} + +func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo) +} + +func (matcher *BeTemporallyMatcher) Match(actual interface{}) (bool, error) { + // predicate to test for time.Time type + isTime := func(t interface{}) bool { + _, ok := t.(time.Time) + return ok + } + + if !isTime(actual) { + return false, fmt.Errorf("Expected a time.Time. Got:\n%s", format.Object(actual, 1)) + } + + switch matcher.Comparator { + case "==", "~", ">", ">=", "<", "<=": + default: + return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) + } + + var threshold = time.Millisecond + if len(matcher.Threshold) == 1 { + threshold = matcher.Threshold[0] + } + + return matcher.matchTimes(actual.(time.Time), matcher.CompareTo, threshold), nil +} + +func (matcher *BeTemporallyMatcher) matchTimes(actual, compareTo time.Time, threshold time.Duration) (success bool) { + switch matcher.Comparator { + case "==": + return actual.Equal(compareTo) + case "~": + diff := actual.Sub(compareTo) + return -threshold <= diff && diff <= threshold + case ">": + return actual.After(compareTo) + case ">=": + return !actual.Before(compareTo) + case "<": + return actual.Before(compareTo) + case "<=": + return !actual.After(compareTo) + } + return false +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go index 85aa045ab0..feb33e5dc1 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go @@ -1,98 +1,98 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" - "time" -) - -var _ = Describe("BeTemporally", func() { - - var t0, t1, t2 time.Time - BeforeEach(func() { - t0 = time.Now() - t1 = t0.Add(time.Second) - t2 = t0.Add(-time.Second) - }) - - Context("When comparing times", func() { - - It("should support ==", func() { - Ω(t0).Should(BeTemporally("==", t0)) - Ω(t1).ShouldNot(BeTemporally("==", t0)) - Ω(t0).ShouldNot(BeTemporally("==", t1)) - Ω(t0).ShouldNot(BeTemporally("==", time.Time{})) - }) - - It("should support >", func() { - Ω(t0).Should(BeTemporally(">", t2)) - Ω(t0).ShouldNot(BeTemporally(">", t0)) - Ω(t2).ShouldNot(BeTemporally(">", t0)) - }) - - It("should support <", func() { - Ω(t0).Should(BeTemporally("<", t1)) - Ω(t0).ShouldNot(BeTemporally("<", t0)) - Ω(t1).ShouldNot(BeTemporally("<", t0)) - }) - - It("should support >=", func() { - Ω(t0).Should(BeTemporally(">=", t2)) - Ω(t0).Should(BeTemporally(">=", t0)) - Ω(t0).ShouldNot(BeTemporally(">=", t1)) - }) - - It("should support <=", func() { - Ω(t0).Should(BeTemporally("<=", t1)) - Ω(t0).Should(BeTemporally("<=", t0)) - Ω(t0).ShouldNot(BeTemporally("<=", t2)) - }) - - Context("when passed ~", func() { - Context("and there is no precision parameter", func() { - BeforeEach(func() { - t1 = t0.Add(time.Millisecond / 2) - t2 = t0.Add(-2 * time.Millisecond) - }) - It("should approximate", func() { - Ω(t0).Should(BeTemporally("~", t0)) - Ω(t0).Should(BeTemporally("~", t1)) - Ω(t0).ShouldNot(BeTemporally("~", t2)) - }) - }) - - Context("and there is a precision parameter", func() { - BeforeEach(func() { - t2 = t0.Add(3 * time.Second) - }) - It("should use precision paramter", func() { - d := 2 * time.Second - Ω(t0).Should(BeTemporally("~", t0, d)) - Ω(t0).Should(BeTemporally("~", t1, d)) - Ω(t0).ShouldNot(BeTemporally("~", t2, d)) - }) - }) - }) - }) - - Context("when passed a non-time", func() { - It("should error", func() { - success, err := (&BeTemporallyMatcher{Comparator: "==", CompareTo: t0}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&BeTemporallyMatcher{Comparator: "=="}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed an unsupported comparator", func() { - It("should error", func() { - success, err := (&BeTemporallyMatcher{Comparator: "!=", CompareTo: t0}).Match(t2) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" + "time" +) + +var _ = Describe("BeTemporally", func() { + + var t0, t1, t2 time.Time + BeforeEach(func() { + t0 = time.Now() + t1 = t0.Add(time.Second) + t2 = t0.Add(-time.Second) + }) + + Context("When comparing times", func() { + + It("should support ==", func() { + Ω(t0).Should(BeTemporally("==", t0)) + Ω(t1).ShouldNot(BeTemporally("==", t0)) + Ω(t0).ShouldNot(BeTemporally("==", t1)) + Ω(t0).ShouldNot(BeTemporally("==", time.Time{})) + }) + + It("should support >", func() { + Ω(t0).Should(BeTemporally(">", t2)) + Ω(t0).ShouldNot(BeTemporally(">", t0)) + Ω(t2).ShouldNot(BeTemporally(">", t0)) + }) + + It("should support <", func() { + Ω(t0).Should(BeTemporally("<", t1)) + Ω(t0).ShouldNot(BeTemporally("<", t0)) + Ω(t1).ShouldNot(BeTemporally("<", t0)) + }) + + It("should support >=", func() { + Ω(t0).Should(BeTemporally(">=", t2)) + Ω(t0).Should(BeTemporally(">=", t0)) + Ω(t0).ShouldNot(BeTemporally(">=", t1)) + }) + + It("should support <=", func() { + Ω(t0).Should(BeTemporally("<=", t1)) + Ω(t0).Should(BeTemporally("<=", t0)) + Ω(t0).ShouldNot(BeTemporally("<=", t2)) + }) + + Context("when passed ~", func() { + Context("and there is no precision parameter", func() { + BeforeEach(func() { + t1 = t0.Add(time.Millisecond / 2) + t2 = t0.Add(-2 * time.Millisecond) + }) + It("should approximate", func() { + Ω(t0).Should(BeTemporally("~", t0)) + Ω(t0).Should(BeTemporally("~", t1)) + Ω(t0).ShouldNot(BeTemporally("~", t2)) + }) + }) + + Context("and there is a precision parameter", func() { + BeforeEach(func() { + t2 = t0.Add(3 * time.Second) + }) + It("should use precision paramter", func() { + d := 2 * time.Second + Ω(t0).Should(BeTemporally("~", t0, d)) + Ω(t0).Should(BeTemporally("~", t1, d)) + Ω(t0).ShouldNot(BeTemporally("~", t2, d)) + }) + }) + }) + }) + + Context("when passed a non-time", func() { + It("should error", func() { + success, err := (&BeTemporallyMatcher{Comparator: "==", CompareTo: t0}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&BeTemporallyMatcher{Comparator: "=="}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed an unsupported comparator", func() { + It("should error", func() { + success, err := (&BeTemporallyMatcher{Comparator: "!=", CompareTo: t0}).Match(t2) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go index 4c9933104f..1275e5fc9d 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_true_matcher.go @@ -1,25 +1,25 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" -) - -type BeTrueMatcher struct { -} - -func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { - if !isBool(actual) { - return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) - } - - return actual.(bool), nil -} - -func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be true") -} - -func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be true") -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type BeTrueMatcher struct { +} + +func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { + if !isBool(actual) { + return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) + } + + return actual.(bool), nil +} + +func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be true") +} + +func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be true") +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go index 1f954d9c17..ca32e56bea 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go @@ -1,20 +1,20 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("BeTrue", func() { - It("should handle true and false correctly", func() { - Ω(true).Should(BeTrue()) - Ω(false).ShouldNot(BeTrue()) - }) - - It("should only support booleans", func() { - success, err := (&BeTrueMatcher{}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("BeTrue", func() { + It("should handle true and false correctly", func() { + Ω(true).Should(BeTrue()) + Ω(false).ShouldNot(BeTrue()) + }) + + It("should only support booleans", func() { + success, err := (&BeTrueMatcher{}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go index 5b66942048..b39c9144be 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go @@ -1,27 +1,27 @@ -package matchers - -import ( - "github.com/onsi/gomega/format" - "reflect" -) - -type BeZeroMatcher struct { -} - -func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { - if actual == nil { - return true, nil - } - zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() - - return reflect.DeepEqual(zeroValue, actual), nil - -} - -func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to be zero-valued") -} - -func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to be zero-valued") -} +package matchers + +import ( + "github.com/onsi/gomega/format" + "reflect" +) + +type BeZeroMatcher struct { +} + +func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil { + return true, nil + } + zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() + + return reflect.DeepEqual(zeroValue, actual), nil + +} + +func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to be zero-valued") +} + +func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to be zero-valued") +} diff --git a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go index f5e410e908..8ec3643c28 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go @@ -1,30 +1,30 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("BeZero", func() { - It("should succeed if the passed in object is the zero value for its type", func() { - Ω(nil).Should(BeZero()) - - Ω("").Should(BeZero()) - Ω(" ").ShouldNot(BeZero()) - - Ω(0).Should(BeZero()) - Ω(1).ShouldNot(BeZero()) - - Ω(0.0).Should(BeZero()) - Ω(0.1).ShouldNot(BeZero()) - - // Ω([]int{}).Should(BeZero()) - Ω([]int{1}).ShouldNot(BeZero()) - - // Ω(map[string]int{}).Should(BeZero()) - Ω(map[string]int{"a": 1}).ShouldNot(BeZero()) - - Ω(myCustomType{}).Should(BeZero()) - Ω(myCustomType{s: "a"}).ShouldNot(BeZero()) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("BeZero", func() { + It("should succeed if the passed in object is the zero value for its type", func() { + Ω(nil).Should(BeZero()) + + Ω("").Should(BeZero()) + Ω(" ").ShouldNot(BeZero()) + + Ω(0).Should(BeZero()) + Ω(1).ShouldNot(BeZero()) + + Ω(0.0).Should(BeZero()) + Ω(0.1).ShouldNot(BeZero()) + + // Ω([]int{}).Should(BeZero()) + Ω([]int{1}).ShouldNot(BeZero()) + + // Ω(map[string]int{}).Should(BeZero()) + Ω(map[string]int{"a": 1}).ShouldNot(BeZero()) + + Ω(myCustomType{}).Should(BeZero()) + Ω(myCustomType{s: "a"}).ShouldNot(BeZero()) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of.go b/vendor/github.com/onsi/gomega/matchers/consist_of.go index 5abe2cf747..7b0e088684 100644 --- a/vendor/github.com/onsi/gomega/matchers/consist_of.go +++ b/vendor/github.com/onsi/gomega/matchers/consist_of.go @@ -1,80 +1,80 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" - "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" -) - -type ConsistOfMatcher struct { - Elements []interface{} -} - -func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) - } - - elements := matcher.Elements - if len(matcher.Elements) == 1 && isArrayOrSlice(matcher.Elements[0]) { - elements = []interface{}{} - value := reflect.ValueOf(matcher.Elements[0]) - for i := 0; i < value.Len(); i++ { - elements = append(elements, value.Index(i).Interface()) - } - } - - matchers := []interface{}{} - for _, element := range elements { - matcher, isMatcher := element.(omegaMatcher) - if !isMatcher { - matcher = &EqualMatcher{Expected: element} - } - matchers = append(matchers, matcher) - } - - values := matcher.valuesOf(actual) - - if len(values) != len(matchers) { - return false, nil - } - - neighbours := func(v, m interface{}) (bool, error) { - match, err := m.(omegaMatcher).Match(v) - return match && err == nil, nil - } - - bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(values, matchers, neighbours) - if err != nil { - return false, err - } - - return len(bipartiteGraph.LargestMatching()) == len(values), nil -} - -func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} { - value := reflect.ValueOf(actual) - values := []interface{}{} - if isMap(actual) { - keys := value.MapKeys() - for i := 0; i < value.Len(); i++ { - values = append(values, value.MapIndex(keys[i]).Interface()) - } - } else { - for i := 0; i < value.Len(); i++ { - values = append(values, value.Index(i).Interface()) - } - } - - return values -} - -func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to consist of", matcher.Elements) -} - -func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to consist of", matcher.Elements) -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" +) + +type ConsistOfMatcher struct { + Elements []interface{} +} + +func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) { + return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + } + + elements := matcher.Elements + if len(matcher.Elements) == 1 && isArrayOrSlice(matcher.Elements[0]) { + elements = []interface{}{} + value := reflect.ValueOf(matcher.Elements[0]) + for i := 0; i < value.Len(); i++ { + elements = append(elements, value.Index(i).Interface()) + } + } + + matchers := []interface{}{} + for _, element := range elements { + matcher, isMatcher := element.(omegaMatcher) + if !isMatcher { + matcher = &EqualMatcher{Expected: element} + } + matchers = append(matchers, matcher) + } + + values := matcher.valuesOf(actual) + + if len(values) != len(matchers) { + return false, nil + } + + neighbours := func(v, m interface{}) (bool, error) { + match, err := m.(omegaMatcher).Match(v) + return match && err == nil, nil + } + + bipartiteGraph, err := bipartitegraph.NewBipartiteGraph(values, matchers, neighbours) + if err != nil { + return false, err + } + + return len(bipartiteGraph.LargestMatching()) == len(values), nil +} + +func (matcher *ConsistOfMatcher) valuesOf(actual interface{}) []interface{} { + value := reflect.ValueOf(actual) + values := []interface{}{} + if isMap(actual) { + keys := value.MapKeys() + for i := 0; i < value.Len(); i++ { + values = append(values, value.MapIndex(keys[i]).Interface()) + } + } else { + for i := 0; i < value.Len(); i++ { + values = append(values, value.Index(i).Interface()) + } + } + + return values +} + +func (matcher *ConsistOfMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to consist of", matcher.Elements) +} + +func (matcher *ConsistOfMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to consist of", matcher.Elements) +} diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of_test.go b/vendor/github.com/onsi/gomega/matchers/consist_of_test.go index 67029a4dbc..dcd1afe947 100644 --- a/vendor/github.com/onsi/gomega/matchers/consist_of_test.go +++ b/vendor/github.com/onsi/gomega/matchers/consist_of_test.go @@ -1,75 +1,75 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("ConsistOf", func() { - Context("with a slice", func() { - It("should do the right thing", func() { - Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz")) - Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz")) - Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("baz", "bar", "foo")) - Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo")) - Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "foo")) - }) - }) - - Context("with an array", func() { - It("should do the right thing", func() { - Ω([3]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz")) - Ω([3]string{"foo", "bar", "baz"}).Should(ConsistOf("baz", "bar", "foo")) - Ω([3]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo")) - Ω([3]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "foo")) - }) - }) - - Context("with a map", func() { - It("should apply to the values", func() { - Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).Should(ConsistOf("foo", "bar", "baz")) - Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).Should(ConsistOf("baz", "bar", "foo")) - Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo")) - Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).ShouldNot(ConsistOf("baz", "foo")) - }) - - }) - - Context("with anything else", func() { - It("should error", func() { - failures := InterceptGomegaFailures(func() { - Ω("foo").Should(ConsistOf("f", "o", "o")) - }) - - Ω(failures).Should(HaveLen(1)) - }) - }) - - Context("when passed matchers", func() { - It("should pass if the matchers pass", func() { - Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", MatchRegexp("^ba"), "baz")) - Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"))) - Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("foo"))) - Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("^ba"))) - Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("turducken"))) - }) - - It("should not depend on the order of the matchers", func() { - Ω([][]int{[]int{1, 2}, []int{2}}).Should(ConsistOf(ContainElement(1), ContainElement(2))) - Ω([][]int{[]int{1, 2}, []int{2}}).Should(ConsistOf(ContainElement(2), ContainElement(1))) - }) - - Context("when a matcher errors", func() { - It("should soldier on", func() { - Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf(BeFalse(), "foo", "bar")) - Ω([]interface{}{"foo", "bar", false}).Should(ConsistOf(BeFalse(), ContainSubstring("foo"), "bar")) - }) - }) - }) - - Context("when passed exactly one argument, and that argument is a slice", func() { - It("should match against the elements of that argument", func() { - Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf([]string{"foo", "bar", "baz"})) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("ConsistOf", func() { + Context("with a slice", func() { + It("should do the right thing", func() { + Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz")) + Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz")) + Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("baz", "bar", "foo")) + Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo")) + Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "foo")) + }) + }) + + Context("with an array", func() { + It("should do the right thing", func() { + Ω([3]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz")) + Ω([3]string{"foo", "bar", "baz"}).Should(ConsistOf("baz", "bar", "foo")) + Ω([3]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo")) + Ω([3]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "foo")) + }) + }) + + Context("with a map", func() { + It("should apply to the values", func() { + Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).Should(ConsistOf("foo", "bar", "baz")) + Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).Should(ConsistOf("baz", "bar", "foo")) + Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo")) + Ω(map[int]string{1: "foo", 2: "bar", 3: "baz"}).ShouldNot(ConsistOf("baz", "foo")) + }) + + }) + + Context("with anything else", func() { + It("should error", func() { + failures := InterceptGomegaFailures(func() { + Ω("foo").Should(ConsistOf("f", "o", "o")) + }) + + Ω(failures).Should(HaveLen(1)) + }) + }) + + Context("when passed matchers", func() { + It("should pass if the matchers pass", func() { + Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", MatchRegexp("^ba"), "baz")) + Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"))) + Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("foo"))) + Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("^ba"))) + Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("turducken"))) + }) + + It("should not depend on the order of the matchers", func() { + Ω([][]int{[]int{1, 2}, []int{2}}).Should(ConsistOf(ContainElement(1), ContainElement(2))) + Ω([][]int{[]int{1, 2}, []int{2}}).Should(ConsistOf(ContainElement(2), ContainElement(1))) + }) + + Context("when a matcher errors", func() { + It("should soldier on", func() { + Ω([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf(BeFalse(), "foo", "bar")) + Ω([]interface{}{"foo", "bar", false}).Should(ConsistOf(BeFalse(), ContainSubstring("foo"), "bar")) + }) + }) + }) + + Context("when passed exactly one argument, and that argument is a slice", func() { + It("should match against the elements of that argument", func() { + Ω([]string{"foo", "bar", "baz"}).Should(ConsistOf([]string{"foo", "bar", "baz"})) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go index 311cb6ee68..4159335d0d 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go @@ -1,56 +1,56 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type ContainElementMatcher struct { - Element interface{} -} - -func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) - } - - elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) - if !elementIsMatcher { - elemMatcher = &EqualMatcher{Expected: matcher.Element} - } - - value := reflect.ValueOf(actual) - var keys []reflect.Value - if isMap(actual) { - keys = value.MapKeys() - } - var lastError error - for i := 0; i < value.Len(); i++ { - var success bool - var err error - if isMap(actual) { - success, err = elemMatcher.Match(value.MapIndex(keys[i]).Interface()) - } else { - success, err = elemMatcher.Match(value.Index(i).Interface()) - } - if err != nil { - lastError = err - continue - } - if success { - return true, nil - } - } - - return false, lastError -} - -func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to contain element matching", matcher.Element) -} - -func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to contain element matching", matcher.Element) -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type ContainElementMatcher struct { + Element interface{} +} + +func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { + if !isArrayOrSlice(actual) && !isMap(actual) { + return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + } + + elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) + if !elementIsMatcher { + elemMatcher = &EqualMatcher{Expected: matcher.Element} + } + + value := reflect.ValueOf(actual) + var keys []reflect.Value + if isMap(actual) { + keys = value.MapKeys() + } + var lastError error + for i := 0; i < value.Len(); i++ { + var success bool + var err error + if isMap(actual) { + success, err = elemMatcher.Match(value.MapIndex(keys[i]).Interface()) + } else { + success, err = elemMatcher.Match(value.Index(i).Interface()) + } + if err != nil { + lastError = err + continue + } + if success { + return true, nil + } + } + + return false, lastError +} + +func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to contain element matching", matcher.Element) +} + +func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to contain element matching", matcher.Element) +} diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go index 191638fa6f..38ee518fbc 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go @@ -1,76 +1,76 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("ContainElement", func() { - Context("when passed a supported type", func() { - Context("and expecting a non-matcher", func() { - It("should do the right thing", func() { - Ω([2]int{1, 2}).Should(ContainElement(2)) - Ω([2]int{1, 2}).ShouldNot(ContainElement(3)) - - Ω([]int{1, 2}).Should(ContainElement(2)) - Ω([]int{1, 2}).ShouldNot(ContainElement(3)) - - Ω(map[string]int{"foo": 1, "bar": 2}).Should(ContainElement(2)) - Ω(map[int]int{3: 1, 4: 2}).ShouldNot(ContainElement(3)) - - arr := make([]myCustomType, 2) - arr[0] = myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}} - arr[1] = myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "c"}} - Ω(arr).Should(ContainElement(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}})) - Ω(arr).ShouldNot(ContainElement(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"b", "c"}})) - }) - }) - - Context("and expecting a matcher", func() { - It("should pass each element through the matcher", func() { - Ω([]int{1, 2, 3}).Should(ContainElement(BeNumerically(">=", 3))) - Ω([]int{1, 2, 3}).ShouldNot(ContainElement(BeNumerically(">", 3))) - Ω(map[string]int{"foo": 1, "bar": 2}).Should(ContainElement(BeNumerically(">=", 2))) - Ω(map[string]int{"foo": 1, "bar": 2}).ShouldNot(ContainElement(BeNumerically(">", 2))) - }) - - It("should power through even if the matcher ever fails", func() { - Ω([]interface{}{1, 2, "3", 4}).Should(ContainElement(BeNumerically(">=", 3))) - }) - - It("should fail if the matcher fails", func() { - actual := []interface{}{1, 2, "3", "4"} - success, err := (&ContainElementMatcher{Element: BeNumerically(">=", 3)}).Match(actual) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - }) - - Context("when passed a correctly typed nil", func() { - It("should operate succesfully on the passed in value", func() { - var nilSlice []int - Ω(nilSlice).ShouldNot(ContainElement(1)) - - var nilMap map[int]string - Ω(nilMap).ShouldNot(ContainElement("foo")) - }) - }) - - Context("when passed an unsupported type", func() { - It("should error", func() { - success, err := (&ContainElementMatcher{Element: 0}).Match(0) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&ContainElementMatcher{Element: 0}).Match("abc") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&ContainElementMatcher{Element: 0}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("ContainElement", func() { + Context("when passed a supported type", func() { + Context("and expecting a non-matcher", func() { + It("should do the right thing", func() { + Ω([2]int{1, 2}).Should(ContainElement(2)) + Ω([2]int{1, 2}).ShouldNot(ContainElement(3)) + + Ω([]int{1, 2}).Should(ContainElement(2)) + Ω([]int{1, 2}).ShouldNot(ContainElement(3)) + + Ω(map[string]int{"foo": 1, "bar": 2}).Should(ContainElement(2)) + Ω(map[int]int{3: 1, 4: 2}).ShouldNot(ContainElement(3)) + + arr := make([]myCustomType, 2) + arr[0] = myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}} + arr[1] = myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "c"}} + Ω(arr).Should(ContainElement(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}})) + Ω(arr).ShouldNot(ContainElement(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"b", "c"}})) + }) + }) + + Context("and expecting a matcher", func() { + It("should pass each element through the matcher", func() { + Ω([]int{1, 2, 3}).Should(ContainElement(BeNumerically(">=", 3))) + Ω([]int{1, 2, 3}).ShouldNot(ContainElement(BeNumerically(">", 3))) + Ω(map[string]int{"foo": 1, "bar": 2}).Should(ContainElement(BeNumerically(">=", 2))) + Ω(map[string]int{"foo": 1, "bar": 2}).ShouldNot(ContainElement(BeNumerically(">", 2))) + }) + + It("should power through even if the matcher ever fails", func() { + Ω([]interface{}{1, 2, "3", 4}).Should(ContainElement(BeNumerically(">=", 3))) + }) + + It("should fail if the matcher fails", func() { + actual := []interface{}{1, 2, "3", "4"} + success, err := (&ContainElementMatcher{Element: BeNumerically(">=", 3)}).Match(actual) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + }) + + Context("when passed a correctly typed nil", func() { + It("should operate succesfully on the passed in value", func() { + var nilSlice []int + Ω(nilSlice).ShouldNot(ContainElement(1)) + + var nilMap map[int]string + Ω(nilMap).ShouldNot(ContainElement("foo")) + }) + }) + + Context("when passed an unsupported type", func() { + It("should error", func() { + success, err := (&ContainElementMatcher{Element: 0}).Match(0) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&ContainElementMatcher{Element: 0}).Match("abc") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&ContainElementMatcher{Element: 0}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go index 5e9d77bcc2..2e7608921a 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go @@ -1,37 +1,37 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "strings" -) - -type ContainSubstringMatcher struct { - Substr string - Args []interface{} -} - -func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { - actualString, ok := toString(actual) - if !ok { - return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) - } - - return strings.Contains(actualString, matcher.stringToMatch()), nil -} - -func (matcher *ContainSubstringMatcher) stringToMatch() string { - stringToMatch := matcher.Substr - if len(matcher.Args) > 0 { - stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...) - } - return stringToMatch -} - -func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to contain substring", matcher.stringToMatch()) -} - -func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to contain substring", matcher.stringToMatch()) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "strings" +) + +type ContainSubstringMatcher struct { + Substr string + Args []interface{} +} + +func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) + } + + return strings.Contains(actualString, matcher.stringToMatch()), nil +} + +func (matcher *ContainSubstringMatcher) stringToMatch() string { + stringToMatch := matcher.Substr + if len(matcher.Args) > 0 { + stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...) + } + return stringToMatch +} + +func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to contain substring", matcher.stringToMatch()) +} + +func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to contain substring", matcher.stringToMatch()) +} diff --git a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go index 97d1d3c354..6935168e5c 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go @@ -1,36 +1,36 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("ContainSubstringMatcher", func() { - Context("when actual is a string", func() { - It("should match against the string", func() { - Ω("Marvelous").Should(ContainSubstring("rve")) - Ω("Marvelous").ShouldNot(ContainSubstring("boo")) - }) - }) - - Context("when the matcher is called with multiple arguments", func() { - It("should pass the string and arguments to sprintf", func() { - Ω("Marvelous3").Should(ContainSubstring("velous%d", 3)) - }) - }) - - Context("when actual is a stringer", func() { - It("should call the stringer and match agains the returned string", func() { - Ω(&myStringer{a: "Abc3"}).Should(ContainSubstring("bc3")) - }) - }) - - Context("when actual is neither a string nor a stringer", func() { - It("should error", func() { - success, err := (&ContainSubstringMatcher{Substr: "2"}).Match(2) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("ContainSubstringMatcher", func() { + Context("when actual is a string", func() { + It("should match against the string", func() { + Ω("Marvelous").Should(ContainSubstring("rve")) + Ω("Marvelous").ShouldNot(ContainSubstring("boo")) + }) + }) + + Context("when the matcher is called with multiple arguments", func() { + It("should pass the string and arguments to sprintf", func() { + Ω("Marvelous3").Should(ContainSubstring("velous%d", 3)) + }) + }) + + Context("when actual is a stringer", func() { + It("should call the stringer and match agains the returned string", func() { + Ω(&myStringer{a: "Abc3"}).Should(ContainSubstring("bc3")) + }) + }) + + Context("when actual is neither a string nor a stringer", func() { + It("should error", func() { + success, err := (&ContainSubstringMatcher{Substr: "2"}).Match(2) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/equal_matcher.go b/vendor/github.com/onsi/gomega/matchers/equal_matcher.go index 0558aa9a79..874e6a6229 100644 --- a/vendor/github.com/onsi/gomega/matchers/equal_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/equal_matcher.go @@ -1,33 +1,33 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type EqualMatcher struct { - Expected interface{} -} - -func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { - if actual == nil && matcher.Expected == nil { - return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") - } - return reflect.DeepEqual(actual, matcher.Expected), nil -} - -func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { - actualString, actualOK := actual.(string) - expectedString, expectedOK := matcher.Expected.(string) - if actualOK && expectedOK { - return format.MessageWithDiff(actualString, "to equal", expectedString) - } - - return format.Message(actual, "to equal", matcher.Expected) -} - -func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to equal", matcher.Expected) -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type EqualMatcher struct { + Expected interface{} +} + +func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil && matcher.Expected == nil { + return false, fmt.Errorf("Refusing to compare to .\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.") + } + return reflect.DeepEqual(actual, matcher.Expected), nil +} + +func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { + actualString, actualOK := actual.(string) + expectedString, expectedOK := matcher.Expected.(string) + if actualOK && expectedOK { + return format.MessageWithDiff(actualString, "to equal", expectedString) + } + + return format.Message(actual, "to equal", matcher.Expected) +} + +func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to equal", matcher.Expected) +} diff --git a/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go index e19a74604b..2add0b7499 100644 --- a/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go @@ -1,78 +1,78 @@ -package matchers_test - -import ( - "errors" - "strings" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("Equal", func() { - Context("when asserting that nil equals nil", func() { - It("should error", func() { - success, err := (&EqualMatcher{Expected: nil}).Match(nil) - - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("When asserting equality between objects", func() { - It("should do the right thing", func() { - Ω(5).Should(Equal(5)) - Ω(5.0).Should(Equal(5.0)) - - Ω(5).ShouldNot(Equal("5")) - Ω(5).ShouldNot(Equal(5.0)) - Ω(5).ShouldNot(Equal(3)) - - Ω("5").Should(Equal("5")) - Ω([]int{1, 2}).Should(Equal([]int{1, 2})) - Ω([]int{1, 2}).ShouldNot(Equal([]int{2, 1})) - Ω(map[string]string{"a": "b", "c": "d"}).Should(Equal(map[string]string{"a": "b", "c": "d"})) - Ω(map[string]string{"a": "b", "c": "d"}).ShouldNot(Equal(map[string]string{"a": "b", "c": "e"})) - Ω(errors.New("foo")).Should(Equal(errors.New("foo"))) - Ω(errors.New("foo")).ShouldNot(Equal(errors.New("bar"))) - - Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).Should(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}})) - Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "bar", n: 3, f: 2.0, arr: []string{"a", "b"}})) - Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 2, f: 2.0, arr: []string{"a", "b"}})) - Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 3.0, arr: []string{"a", "b"}})) - Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b", "c"}})) - }) - }) - - Describe("failure messages", func() { - It("shows the two strings simply when they are short", func() { - subject := EqualMatcher{Expected: "eric"} - - failureMessage := subject.FailureMessage("tim") - Ω(failureMessage).To(BeEquivalentTo(expectedShortStringFailureMessage)) - }) - - It("shows the exact point where two long strings differ", func() { - stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - - subject := EqualMatcher{Expected: stringWithZ} - - failureMessage := subject.FailureMessage(stringWithB) - Ω(failureMessage).To(BeEquivalentTo(expectedLongStringFailureMessage)) - }) - }) -}) - -var expectedShortStringFailureMessage = strings.TrimSpace(` -Expected - : tim -to equal - : eric -`) -var expectedLongStringFailureMessage = strings.TrimSpace(` -Expected - : "...aaaaabaaaaa..." -to equal | - : "...aaaaazaaaaa..." -`) +package matchers_test + +import ( + "errors" + "strings" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("Equal", func() { + Context("when asserting that nil equals nil", func() { + It("should error", func() { + success, err := (&EqualMatcher{Expected: nil}).Match(nil) + + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("When asserting equality between objects", func() { + It("should do the right thing", func() { + Ω(5).Should(Equal(5)) + Ω(5.0).Should(Equal(5.0)) + + Ω(5).ShouldNot(Equal("5")) + Ω(5).ShouldNot(Equal(5.0)) + Ω(5).ShouldNot(Equal(3)) + + Ω("5").Should(Equal("5")) + Ω([]int{1, 2}).Should(Equal([]int{1, 2})) + Ω([]int{1, 2}).ShouldNot(Equal([]int{2, 1})) + Ω(map[string]string{"a": "b", "c": "d"}).Should(Equal(map[string]string{"a": "b", "c": "d"})) + Ω(map[string]string{"a": "b", "c": "d"}).ShouldNot(Equal(map[string]string{"a": "b", "c": "e"})) + Ω(errors.New("foo")).Should(Equal(errors.New("foo"))) + Ω(errors.New("foo")).ShouldNot(Equal(errors.New("bar"))) + + Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).Should(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}})) + Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "bar", n: 3, f: 2.0, arr: []string{"a", "b"}})) + Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 2, f: 2.0, arr: []string{"a", "b"}})) + Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 3.0, arr: []string{"a", "b"}})) + Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b", "c"}})) + }) + }) + + Describe("failure messages", func() { + It("shows the two strings simply when they are short", func() { + subject := EqualMatcher{Expected: "eric"} + + failureMessage := subject.FailureMessage("tim") + Ω(failureMessage).To(BeEquivalentTo(expectedShortStringFailureMessage)) + }) + + It("shows the exact point where two long strings differ", func() { + stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + subject := EqualMatcher{Expected: stringWithZ} + + failureMessage := subject.FailureMessage(stringWithB) + Ω(failureMessage).To(BeEquivalentTo(expectedLongStringFailureMessage)) + }) + }) +}) + +var expectedShortStringFailureMessage = strings.TrimSpace(` +Expected + : tim +to equal + : eric +`) +var expectedLongStringFailureMessage = strings.TrimSpace(` +Expected + : "...aaaaabaaaaa..." +to equal | + : "...aaaaazaaaaa..." +`) diff --git a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go index 94d825e617..7ace93dc36 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go @@ -1,28 +1,28 @@ -package matchers - -import ( - "fmt" - - "github.com/onsi/gomega/format" -) - -type HaveCapMatcher struct { - Count int -} - -func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) { - length, ok := capOf(actual) - if !ok { - return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1)) - } - - return length == matcher.Count, nil -} - -func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count) -} - -func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count) -} +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type HaveCapMatcher struct { + Count int +} + +func (matcher *HaveCapMatcher) Match(actual interface{}) (success bool, err error) { + length, ok := capOf(actual) + if !ok { + return false, fmt.Errorf("HaveCap matcher expects a array/channel/slice. Got:\n%s", format.Object(actual, 1)) + } + + return length == matcher.Count, nil +} + +func (matcher *HaveCapMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nto have capacity %d", format.Object(actual, 1), matcher.Count) +} + +func (matcher *HaveCapMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nnot to have capacity %d", format.Object(actual, 1), matcher.Count) +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go index d61cb1a39a..a92a177b58 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go @@ -1,50 +1,50 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("HaveCap", func() { - Context("when passed a supported type", func() { - It("should do the right thing", func() { - Ω([0]int{}).Should(HaveCap(0)) - Ω([2]int{1}).Should(HaveCap(2)) - - Ω([]int{}).Should(HaveCap(0)) - Ω([]int{1, 2, 3, 4, 5}[:2]).Should(HaveCap(5)) - Ω(make([]int, 0, 5)).Should(HaveCap(5)) - - c := make(chan bool, 3) - Ω(c).Should(HaveCap(3)) - c <- true - c <- true - Ω(c).Should(HaveCap(3)) - - Ω(make(chan bool)).Should(HaveCap(0)) - }) - }) - - Context("when passed a correctly typed nil", func() { - It("should operate succesfully on the passed in value", func() { - var nilSlice []int - Ω(nilSlice).Should(HaveCap(0)) - - var nilChan chan int - Ω(nilChan).Should(HaveCap(0)) - }) - }) - - Context("when passed an unsupported type", func() { - It("should error", func() { - success, err := (&HaveCapMatcher{Count: 0}).Match(0) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&HaveCapMatcher{Count: 0}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("HaveCap", func() { + Context("when passed a supported type", func() { + It("should do the right thing", func() { + Ω([0]int{}).Should(HaveCap(0)) + Ω([2]int{1}).Should(HaveCap(2)) + + Ω([]int{}).Should(HaveCap(0)) + Ω([]int{1, 2, 3, 4, 5}[:2]).Should(HaveCap(5)) + Ω(make([]int, 0, 5)).Should(HaveCap(5)) + + c := make(chan bool, 3) + Ω(c).Should(HaveCap(3)) + c <- true + c <- true + Ω(c).Should(HaveCap(3)) + + Ω(make(chan bool)).Should(HaveCap(0)) + }) + }) + + Context("when passed a correctly typed nil", func() { + It("should operate succesfully on the passed in value", func() { + var nilSlice []int + Ω(nilSlice).Should(HaveCap(0)) + + var nilChan chan int + Ω(nilChan).Should(HaveCap(0)) + }) + }) + + Context("when passed an unsupported type", func() { + It("should error", func() { + success, err := (&HaveCapMatcher{Count: 0}).Match(0) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&HaveCapMatcher{Count: 0}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go index 7360cb0a6a..5701ba6e24 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -1,53 +1,53 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "reflect" -) - -type HaveKeyMatcher struct { - Key interface{} -} - -func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { - if !isMap(actual) { - return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) - } - - keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) - if !keyIsMatcher { - keyMatcher = &EqualMatcher{Expected: matcher.Key} - } - - keys := reflect.ValueOf(actual).MapKeys() - for i := 0; i < len(keys); i++ { - success, err := keyMatcher.Match(keys[i].Interface()) - if err != nil { - return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) - } - if success { - return true, nil - } - } - - return false, nil -} - -func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) { - switch matcher.Key.(type) { - case omegaMatcher: - return format.Message(actual, "to have key matching", matcher.Key) - default: - return format.Message(actual, "to have key", matcher.Key) - } -} - -func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) { - switch matcher.Key.(type) { - case omegaMatcher: - return format.Message(actual, "not to have key matching", matcher.Key) - default: - return format.Message(actual, "not to have key", matcher.Key) - } -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type HaveKeyMatcher struct { + Key interface{} +} + +func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { + if !isMap(actual) { + return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) + } + + keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) + if !keyIsMatcher { + keyMatcher = &EqualMatcher{Expected: matcher.Key} + } + + keys := reflect.ValueOf(actual).MapKeys() + for i := 0; i < len(keys); i++ { + success, err := keyMatcher.Match(keys[i].Interface()) + if err != nil { + return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) + } + if success { + return true, nil + } + } + + return false, nil +} + +func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) { + switch matcher.Key.(type) { + case omegaMatcher: + return format.Message(actual, "to have key matching", matcher.Key) + default: + return format.Message(actual, "to have key", matcher.Key) + } +} + +func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) { + switch matcher.Key.(type) { + case omegaMatcher: + return format.Message(actual, "not to have key matching", matcher.Key) + default: + return format.Message(actual, "not to have key", matcher.Key) + } +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go index 2d9a8d1291..c663e302ba 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go @@ -1,73 +1,73 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("HaveKey", func() { - var ( - stringKeys map[string]int - intKeys map[int]string - objKeys map[*myCustomType]string - - customA *myCustomType - customB *myCustomType - ) - BeforeEach(func() { - stringKeys = map[string]int{"foo": 2, "bar": 3} - intKeys = map[int]string{2: "foo", 3: "bar"} - - customA = &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}} - customB = &myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}} - objKeys = map[*myCustomType]string{customA: "aardvark", customB: "kangaroo"} - }) - - Context("when passed a map", func() { - It("should do the right thing", func() { - Ω(stringKeys).Should(HaveKey("foo")) - Ω(stringKeys).ShouldNot(HaveKey("baz")) - - Ω(intKeys).Should(HaveKey(2)) - Ω(intKeys).ShouldNot(HaveKey(4)) - - Ω(objKeys).Should(HaveKey(customA)) - Ω(objKeys).Should(HaveKey(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}})) - Ω(objKeys).ShouldNot(HaveKey(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"apple", "pie"}})) - }) - }) - - Context("when passed a correctly typed nil", func() { - It("should operate succesfully on the passed in value", func() { - var nilMap map[int]string - Ω(nilMap).ShouldNot(HaveKey("foo")) - }) - }) - - Context("when the passed in key is actually a matcher", func() { - It("should pass each element through the matcher", func() { - Ω(stringKeys).Should(HaveKey(ContainSubstring("oo"))) - Ω(stringKeys).ShouldNot(HaveKey(ContainSubstring("foobar"))) - }) - - It("should fail if the matcher ever fails", func() { - actual := map[int]string{1: "a", 3: "b", 2: "c"} - success, err := (&HaveKeyMatcher{Key: ContainSubstring("ar")}).Match(actual) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed something that is not a map", func() { - It("should error", func() { - success, err := (&HaveKeyMatcher{Key: "foo"}).Match([]string{"foo"}) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&HaveKeyMatcher{Key: "foo"}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("HaveKey", func() { + var ( + stringKeys map[string]int + intKeys map[int]string + objKeys map[*myCustomType]string + + customA *myCustomType + customB *myCustomType + ) + BeforeEach(func() { + stringKeys = map[string]int{"foo": 2, "bar": 3} + intKeys = map[int]string{2: "foo", 3: "bar"} + + customA = &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}} + customB = &myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}} + objKeys = map[*myCustomType]string{customA: "aardvark", customB: "kangaroo"} + }) + + Context("when passed a map", func() { + It("should do the right thing", func() { + Ω(stringKeys).Should(HaveKey("foo")) + Ω(stringKeys).ShouldNot(HaveKey("baz")) + + Ω(intKeys).Should(HaveKey(2)) + Ω(intKeys).ShouldNot(HaveKey(4)) + + Ω(objKeys).Should(HaveKey(customA)) + Ω(objKeys).Should(HaveKey(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}})) + Ω(objKeys).ShouldNot(HaveKey(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"apple", "pie"}})) + }) + }) + + Context("when passed a correctly typed nil", func() { + It("should operate succesfully on the passed in value", func() { + var nilMap map[int]string + Ω(nilMap).ShouldNot(HaveKey("foo")) + }) + }) + + Context("when the passed in key is actually a matcher", func() { + It("should pass each element through the matcher", func() { + Ω(stringKeys).Should(HaveKey(ContainSubstring("oo"))) + Ω(stringKeys).ShouldNot(HaveKey(ContainSubstring("foobar"))) + }) + + It("should fail if the matcher ever fails", func() { + actual := map[int]string{1: "a", 3: "b", 2: "c"} + success, err := (&HaveKeyMatcher{Key: ContainSubstring("ar")}).Match(actual) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed something that is not a map", func() { + It("should error", func() { + success, err := (&HaveKeyMatcher{Key: "foo"}).Match([]string{"foo"}) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&HaveKeyMatcher{Key: "foo"}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go index 0fd7e1ccc0..464ac187e9 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -1,73 +1,73 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "reflect" -) - -type HaveKeyWithValueMatcher struct { - Key interface{} - Value interface{} -} - -func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, err error) { - if !isMap(actual) { - return false, fmt.Errorf("HaveKeyWithValue matcher expects a map. Got:%s", format.Object(actual, 1)) - } - - keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) - if !keyIsMatcher { - keyMatcher = &EqualMatcher{Expected: matcher.Key} - } - - valueMatcher, valueIsMatcher := matcher.Value.(omegaMatcher) - if !valueIsMatcher { - valueMatcher = &EqualMatcher{Expected: matcher.Value} - } - - keys := reflect.ValueOf(actual).MapKeys() - for i := 0; i < len(keys); i++ { - success, err := keyMatcher.Match(keys[i].Interface()) - if err != nil { - return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) - } - if success { - actualValue := reflect.ValueOf(actual).MapIndex(keys[i]) - success, err := valueMatcher.Match(actualValue.Interface()) - if err != nil { - return false, fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) - } - return success, nil - } - } - - return false, nil -} - -func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (message string) { - str := "to have {key: value}" - if _, ok := matcher.Key.(omegaMatcher); ok { - str += " matching" - } else if _, ok := matcher.Value.(omegaMatcher); ok { - str += " matching" - } - - expect := make(map[interface{}]interface{}, 1) - expect[matcher.Key] = matcher.Value - return format.Message(actual, str, expect) -} - -func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) { - kStr := "not to have key" - if _, ok := matcher.Key.(omegaMatcher); ok { - kStr = "not to have key matching" - } - - vStr := "or that key's value not be" - if _, ok := matcher.Value.(omegaMatcher); ok { - vStr = "or to have that key's value not matching" - } - - return format.Message(actual, kStr, matcher.Key, vStr, matcher.Value) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type HaveKeyWithValueMatcher struct { + Key interface{} + Value interface{} +} + +func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, err error) { + if !isMap(actual) { + return false, fmt.Errorf("HaveKeyWithValue matcher expects a map. Got:%s", format.Object(actual, 1)) + } + + keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) + if !keyIsMatcher { + keyMatcher = &EqualMatcher{Expected: matcher.Key} + } + + valueMatcher, valueIsMatcher := matcher.Value.(omegaMatcher) + if !valueIsMatcher { + valueMatcher = &EqualMatcher{Expected: matcher.Value} + } + + keys := reflect.ValueOf(actual).MapKeys() + for i := 0; i < len(keys); i++ { + success, err := keyMatcher.Match(keys[i].Interface()) + if err != nil { + return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) + } + if success { + actualValue := reflect.ValueOf(actual).MapIndex(keys[i]) + success, err := valueMatcher.Match(actualValue.Interface()) + if err != nil { + return false, fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) + } + return success, nil + } + } + + return false, nil +} + +func (matcher *HaveKeyWithValueMatcher) FailureMessage(actual interface{}) (message string) { + str := "to have {key: value}" + if _, ok := matcher.Key.(omegaMatcher); ok { + str += " matching" + } else if _, ok := matcher.Value.(omegaMatcher); ok { + str += " matching" + } + + expect := make(map[interface{}]interface{}, 1) + expect[matcher.Key] = matcher.Value + return format.Message(actual, str, expect) +} + +func (matcher *HaveKeyWithValueMatcher) NegatedFailureMessage(actual interface{}) (message string) { + kStr := "not to have key" + if _, ok := matcher.Key.(omegaMatcher); ok { + kStr = "not to have key matching" + } + + vStr := "or that key's value not be" + if _, ok := matcher.Value.(omegaMatcher); ok { + vStr = "or to have that key's value not matching" + } + + return format.Message(actual, kStr, matcher.Key, vStr, matcher.Value) +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go index 9c20044673..06a2242aec 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go @@ -1,82 +1,82 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("HaveKeyWithValue", func() { - var ( - stringKeys map[string]int - intKeys map[int]string - objKeys map[*myCustomType]*myCustomType - - customA *myCustomType - customB *myCustomType - ) - BeforeEach(func() { - stringKeys = map[string]int{"foo": 2, "bar": 3} - intKeys = map[int]string{2: "foo", 3: "bar"} - - customA = &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}} - customB = &myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}} - objKeys = map[*myCustomType]*myCustomType{customA: customA, customB: customA} - }) - - Context("when passed a map", func() { - It("should do the right thing", func() { - Ω(stringKeys).Should(HaveKeyWithValue("foo", 2)) - Ω(stringKeys).ShouldNot(HaveKeyWithValue("foo", 1)) - Ω(stringKeys).ShouldNot(HaveKeyWithValue("baz", 2)) - Ω(stringKeys).ShouldNot(HaveKeyWithValue("baz", 1)) - - Ω(intKeys).Should(HaveKeyWithValue(2, "foo")) - Ω(intKeys).ShouldNot(HaveKeyWithValue(4, "foo")) - Ω(intKeys).ShouldNot(HaveKeyWithValue(2, "baz")) - - Ω(objKeys).Should(HaveKeyWithValue(customA, customA)) - Ω(objKeys).Should(HaveKeyWithValue(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}}, &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}})) - Ω(objKeys).ShouldNot(HaveKeyWithValue(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"apple", "pie"}}, customA)) - }) - }) - - Context("when passed a correctly typed nil", func() { - It("should operate succesfully on the passed in value", func() { - var nilMap map[int]string - Ω(nilMap).ShouldNot(HaveKeyWithValue("foo", "bar")) - }) - }) - - Context("when the passed in key or value is actually a matcher", func() { - It("should pass each element through the matcher", func() { - Ω(stringKeys).Should(HaveKeyWithValue(ContainSubstring("oo"), 2)) - Ω(intKeys).Should(HaveKeyWithValue(2, ContainSubstring("oo"))) - Ω(stringKeys).ShouldNot(HaveKeyWithValue(ContainSubstring("foobar"), 2)) - }) - - It("should fail if the matcher ever fails", func() { - actual := map[int]string{1: "a", 3: "b", 2: "c"} - success, err := (&HaveKeyWithValueMatcher{Key: ContainSubstring("ar"), Value: 2}).Match(actual) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - otherActual := map[string]int{"a": 1, "b": 2, "c": 3} - success, err = (&HaveKeyWithValueMatcher{Key: "a", Value: ContainSubstring("1")}).Match(otherActual) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed something that is not a map", func() { - It("should error", func() { - success, err := (&HaveKeyWithValueMatcher{Key: "foo", Value: "bar"}).Match([]string{"foo"}) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&HaveKeyWithValueMatcher{Key: "foo", Value: "bar"}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("HaveKeyWithValue", func() { + var ( + stringKeys map[string]int + intKeys map[int]string + objKeys map[*myCustomType]*myCustomType + + customA *myCustomType + customB *myCustomType + ) + BeforeEach(func() { + stringKeys = map[string]int{"foo": 2, "bar": 3} + intKeys = map[int]string{2: "foo", 3: "bar"} + + customA = &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}} + customB = &myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}} + objKeys = map[*myCustomType]*myCustomType{customA: customA, customB: customA} + }) + + Context("when passed a map", func() { + It("should do the right thing", func() { + Ω(stringKeys).Should(HaveKeyWithValue("foo", 2)) + Ω(stringKeys).ShouldNot(HaveKeyWithValue("foo", 1)) + Ω(stringKeys).ShouldNot(HaveKeyWithValue("baz", 2)) + Ω(stringKeys).ShouldNot(HaveKeyWithValue("baz", 1)) + + Ω(intKeys).Should(HaveKeyWithValue(2, "foo")) + Ω(intKeys).ShouldNot(HaveKeyWithValue(4, "foo")) + Ω(intKeys).ShouldNot(HaveKeyWithValue(2, "baz")) + + Ω(objKeys).Should(HaveKeyWithValue(customA, customA)) + Ω(objKeys).Should(HaveKeyWithValue(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}}, &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}})) + Ω(objKeys).ShouldNot(HaveKeyWithValue(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"apple", "pie"}}, customA)) + }) + }) + + Context("when passed a correctly typed nil", func() { + It("should operate succesfully on the passed in value", func() { + var nilMap map[int]string + Ω(nilMap).ShouldNot(HaveKeyWithValue("foo", "bar")) + }) + }) + + Context("when the passed in key or value is actually a matcher", func() { + It("should pass each element through the matcher", func() { + Ω(stringKeys).Should(HaveKeyWithValue(ContainSubstring("oo"), 2)) + Ω(intKeys).Should(HaveKeyWithValue(2, ContainSubstring("oo"))) + Ω(stringKeys).ShouldNot(HaveKeyWithValue(ContainSubstring("foobar"), 2)) + }) + + It("should fail if the matcher ever fails", func() { + actual := map[int]string{1: "a", 3: "b", 2: "c"} + success, err := (&HaveKeyWithValueMatcher{Key: ContainSubstring("ar"), Value: 2}).Match(actual) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + otherActual := map[string]int{"a": 1, "b": 2, "c": 3} + success, err = (&HaveKeyWithValueMatcher{Key: "a", Value: ContainSubstring("1")}).Match(otherActual) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed something that is not a map", func() { + It("should error", func() { + success, err := (&HaveKeyWithValueMatcher{Key: "foo", Value: "bar"}).Match([]string{"foo"}) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&HaveKeyWithValueMatcher{Key: "foo", Value: "bar"}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go index f624320025..a183775570 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go @@ -1,27 +1,27 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" -) - -type HaveLenMatcher struct { - Count int -} - -func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { - length, ok := lengthOf(actual) - if !ok { - return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) - } - - return length == matcher.Count, nil -} - -func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) -} - -func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type HaveLenMatcher struct { + Count int +} + +func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { + length, ok := lengthOf(actual) + if !ok { + return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + } + + return length == matcher.Count, nil +} + +func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) +} + +func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go index d639321e82..1e6aa69d9d 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go @@ -1,53 +1,53 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("HaveLen", func() { - Context("when passed a supported type", func() { - It("should do the right thing", func() { - Ω("").Should(HaveLen(0)) - Ω("AA").Should(HaveLen(2)) - - Ω([0]int{}).Should(HaveLen(0)) - Ω([2]int{1, 2}).Should(HaveLen(2)) - - Ω([]int{}).Should(HaveLen(0)) - Ω([]int{1, 2, 3}).Should(HaveLen(3)) - - Ω(map[string]int{}).Should(HaveLen(0)) - Ω(map[string]int{"a": 1, "b": 2, "c": 3, "d": 4}).Should(HaveLen(4)) - - c := make(chan bool, 3) - Ω(c).Should(HaveLen(0)) - c <- true - c <- true - Ω(c).Should(HaveLen(2)) - }) - }) - - Context("when passed a correctly typed nil", func() { - It("should operate succesfully on the passed in value", func() { - var nilSlice []int - Ω(nilSlice).Should(HaveLen(0)) - - var nilMap map[int]string - Ω(nilMap).Should(HaveLen(0)) - }) - }) - - Context("when passed an unsupported type", func() { - It("should error", func() { - success, err := (&HaveLenMatcher{Count: 0}).Match(0) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&HaveLenMatcher{Count: 0}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("HaveLen", func() { + Context("when passed a supported type", func() { + It("should do the right thing", func() { + Ω("").Should(HaveLen(0)) + Ω("AA").Should(HaveLen(2)) + + Ω([0]int{}).Should(HaveLen(0)) + Ω([2]int{1, 2}).Should(HaveLen(2)) + + Ω([]int{}).Should(HaveLen(0)) + Ω([]int{1, 2, 3}).Should(HaveLen(3)) + + Ω(map[string]int{}).Should(HaveLen(0)) + Ω(map[string]int{"a": 1, "b": 2, "c": 3, "d": 4}).Should(HaveLen(4)) + + c := make(chan bool, 3) + Ω(c).Should(HaveLen(0)) + c <- true + c <- true + Ω(c).Should(HaveLen(2)) + }) + }) + + Context("when passed a correctly typed nil", func() { + It("should operate succesfully on the passed in value", func() { + var nilSlice []int + Ω(nilSlice).Should(HaveLen(0)) + + var nilMap map[int]string + Ω(nilMap).Should(HaveLen(0)) + }) + }) + + Context("when passed an unsupported type", func() { + It("should error", func() { + success, err := (&HaveLenMatcher{Count: 0}).Match(0) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&HaveLenMatcher{Count: 0}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go index b279fedf9a..ebdd71786d 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go @@ -1,33 +1,33 @@ -package matchers - -import ( - "fmt" - - "github.com/onsi/gomega/format" -) - -type HaveOccurredMatcher struct { -} - -func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { - // is purely nil? - if actual == nil { - return false, nil - } - - // must be an 'error' type - if !isError(actual) { - return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) - } - - // must be non-nil (or a pointer to a non-nil) - return !isNil(actual), nil -} - -func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1)) -} - -func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") -} +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type HaveOccurredMatcher struct { +} + +func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { + // is purely nil? + if actual == nil { + return false, nil + } + + // must be an 'error' type + if !isError(actual) { + return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) + } + + // must be non-nil (or a pointer to a non-nil) + return !isNil(actual), nil +} + +func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected an error to have occurred. Got:\n%s", format.Object(actual, 1)) +} + +func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go index 38ac072342..009e23e5fc 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go @@ -1,58 +1,58 @@ -package matchers_test - -import ( - "errors" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -type CustomErr struct { - msg string -} - -func (e *CustomErr) Error() string { - return e.msg -} - -var _ = Describe("HaveOccurred", func() { - It("should succeed if matching an error", func() { - Ω(errors.New("Foo")).Should(HaveOccurred()) - }) - - It("should not succeed with nil", func() { - Ω(nil).ShouldNot(HaveOccurred()) - }) - - It("should only support errors and nil", func() { - success, err := (&HaveOccurredMatcher{}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&HaveOccurredMatcher{}).Match("") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - - It("doesn't support non-error type", func() { - success, err := (&HaveOccurredMatcher{}).Match(AnyType{}) - Ω(success).Should(BeFalse()) - Ω(err).Should(MatchError("Expected an error-type. Got:\n : {}")) - }) - - It("doesn't support non-error pointer type", func() { - success, err := (&HaveOccurredMatcher{}).Match(&AnyType{}) - Ω(success).Should(BeFalse()) - Ω(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`))) - }) - - It("should succeed with pointer types that conform to error interface", func() { - err := &CustomErr{"ohai"} - Ω(err).Should(HaveOccurred()) - }) - - It("should not succeed with nil pointers to types that conform to error interface", func() { - var err *CustomErr = nil - Ω(err).ShouldNot(HaveOccurred()) - }) -}) +package matchers_test + +import ( + "errors" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +type CustomErr struct { + msg string +} + +func (e *CustomErr) Error() string { + return e.msg +} + +var _ = Describe("HaveOccurred", func() { + It("should succeed if matching an error", func() { + Ω(errors.New("Foo")).Should(HaveOccurred()) + }) + + It("should not succeed with nil", func() { + Ω(nil).ShouldNot(HaveOccurred()) + }) + + It("should only support errors and nil", func() { + success, err := (&HaveOccurredMatcher{}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&HaveOccurredMatcher{}).Match("") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + + It("doesn't support non-error type", func() { + success, err := (&HaveOccurredMatcher{}).Match(AnyType{}) + Ω(success).Should(BeFalse()) + Ω(err).Should(MatchError("Expected an error-type. Got:\n : {}")) + }) + + It("doesn't support non-error pointer type", func() { + success, err := (&HaveOccurredMatcher{}).Match(&AnyType{}) + Ω(success).Should(BeFalse()) + Ω(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`))) + }) + + It("should succeed with pointer types that conform to error interface", func() { + err := &CustomErr{"ohai"} + Ω(err).Should(HaveOccurred()) + }) + + It("should not succeed with nil pointers to types that conform to error interface", func() { + var err *CustomErr = nil + Ω(err).ShouldNot(HaveOccurred()) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go index eb6782dd90..8b63a89997 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go @@ -1,35 +1,35 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" -) - -type HavePrefixMatcher struct { - Prefix string - Args []interface{} -} - -func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { - actualString, ok := toString(actual) - if !ok { - return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) - } - prefix := matcher.prefix() - return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil -} - -func (matcher *HavePrefixMatcher) prefix() string { - if len(matcher.Args) > 0 { - return fmt.Sprintf(matcher.Prefix, matcher.Args...) - } - return matcher.Prefix -} - -func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to have prefix", matcher.prefix()) -} - -func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to have prefix", matcher.prefix()) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type HavePrefixMatcher struct { + Prefix string + Args []interface{} +} + +func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) + } + prefix := matcher.prefix() + return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil +} + +func (matcher *HavePrefixMatcher) prefix() string { + if len(matcher.Args) > 0 { + return fmt.Sprintf(matcher.Prefix, matcher.Args...) + } + return matcher.Prefix +} + +func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to have prefix", matcher.prefix()) +} + +func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to have prefix", matcher.prefix()) +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go index 6b0772e0b7..bec3f97582 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go @@ -1,36 +1,36 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("HavePrefixMatcher", func() { - Context("when actual is a string", func() { - It("should match a string prefix", func() { - Ω("Ab").Should(HavePrefix("A")) - Ω("A").ShouldNot(HavePrefix("Ab")) - }) - }) - - Context("when the matcher is called with multiple arguments", func() { - It("should pass the string and arguments to sprintf", func() { - Ω("C3PO").Should(HavePrefix("C%dP", 3)) - }) - }) - - Context("when actual is a stringer", func() { - It("should call the stringer and match against the returned string", func() { - Ω(&myStringer{a: "Ab"}).Should(HavePrefix("A")) - }) - }) - - Context("when actual is neither a string nor a stringer", func() { - It("should error", func() { - success, err := (&HavePrefixMatcher{Prefix: "2"}).Match(2) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("HavePrefixMatcher", func() { + Context("when actual is a string", func() { + It("should match a string prefix", func() { + Ω("Ab").Should(HavePrefix("A")) + Ω("A").ShouldNot(HavePrefix("Ab")) + }) + }) + + Context("when the matcher is called with multiple arguments", func() { + It("should pass the string and arguments to sprintf", func() { + Ω("C3PO").Should(HavePrefix("C%dP", 3)) + }) + }) + + Context("when actual is a stringer", func() { + It("should call the stringer and match against the returned string", func() { + Ω(&myStringer{a: "Ab"}).Should(HavePrefix("A")) + }) + }) + + Context("when actual is neither a string nor a stringer", func() { + It("should error", func() { + success, err := (&HavePrefixMatcher{Prefix: "2"}).Match(2) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go index 1e16642d79..afc78fc901 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go @@ -1,35 +1,35 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" -) - -type HaveSuffixMatcher struct { - Suffix string - Args []interface{} -} - -func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { - actualString, ok := toString(actual) - if !ok { - return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) - } - suffix := matcher.suffix() - return len(actualString) >= len(suffix) && actualString[len(actualString)-len(suffix):] == suffix, nil -} - -func (matcher *HaveSuffixMatcher) suffix() string { - if len(matcher.Args) > 0 { - return fmt.Sprintf(matcher.Suffix, matcher.Args...) - } - return matcher.Suffix -} - -func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to have suffix", matcher.suffix()) -} - -func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to have suffix", matcher.suffix()) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" +) + +type HaveSuffixMatcher struct { + Suffix string + Args []interface{} +} + +func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) + } + suffix := matcher.suffix() + return len(actualString) >= len(suffix) && actualString[len(actualString)-len(suffix):] == suffix, nil +} + +func (matcher *HaveSuffixMatcher) suffix() string { + if len(matcher.Args) > 0 { + return fmt.Sprintf(matcher.Suffix, matcher.Args...) + } + return matcher.Suffix +} + +func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to have suffix", matcher.suffix()) +} + +func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to have suffix", matcher.suffix()) +} diff --git a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go index bd4d75337c..72e8975bae 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go @@ -1,36 +1,36 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("HaveSuffixMatcher", func() { - Context("when actual is a string", func() { - It("should match a string suffix", func() { - Ω("Ab").Should(HaveSuffix("b")) - Ω("A").ShouldNot(HaveSuffix("Ab")) - }) - }) - - Context("when the matcher is called with multiple arguments", func() { - It("should pass the string and arguments to sprintf", func() { - Ω("C3PO").Should(HaveSuffix("%dPO", 3)) - }) - }) - - Context("when actual is a stringer", func() { - It("should call the stringer and match against the returned string", func() { - Ω(&myStringer{a: "Ab"}).Should(HaveSuffix("b")) - }) - }) - - Context("when actual is neither a string nor a stringer", func() { - It("should error", func() { - success, err := (&HaveSuffixMatcher{Suffix: "2"}).Match(2) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("HaveSuffixMatcher", func() { + Context("when actual is a string", func() { + It("should match a string suffix", func() { + Ω("Ab").Should(HaveSuffix("b")) + Ω("A").ShouldNot(HaveSuffix("Ab")) + }) + }) + + Context("when the matcher is called with multiple arguments", func() { + It("should pass the string and arguments to sprintf", func() { + Ω("C3PO").Should(HaveSuffix("%dPO", 3)) + }) + }) + + Context("when actual is a stringer", func() { + It("should call the stringer and match against the returned string", func() { + Ω(&myStringer{a: "Ab"}).Should(HaveSuffix("b")) + }) + }) + + Context("when actual is neither a string nor a stringer", func() { + It("should error", func() { + success, err := (&HaveSuffixMatcher{Suffix: "2"}).Match(2) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go index bcaed53e8b..03cdf04588 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_error_matcher.go @@ -1,50 +1,50 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "reflect" -) - -type MatchErrorMatcher struct { - Expected interface{} -} - -func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { - if isNil(actual) { - return false, fmt.Errorf("Expected an error, got nil") - } - - if !isError(actual) { - return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) - } - - actualErr := actual.(error) - - if isString(matcher.Expected) { - return reflect.DeepEqual(actualErr.Error(), matcher.Expected), nil - } - - if isError(matcher.Expected) { - return reflect.DeepEqual(actualErr, matcher.Expected), nil - } - - var subMatcher omegaMatcher - var hasSubMatcher bool - if matcher.Expected != nil { - subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher) - if hasSubMatcher { - return subMatcher.Match(actualErr.Error()) - } - } - - return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1)) -} - -func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to match error", matcher.Expected) -} - -func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to match error", matcher.Expected) -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "reflect" +) + +type MatchErrorMatcher struct { + Expected interface{} +} + +func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { + if isNil(actual) { + return false, fmt.Errorf("Expected an error, got nil") + } + + if !isError(actual) { + return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) + } + + actualErr := actual.(error) + + if isString(matcher.Expected) { + return reflect.DeepEqual(actualErr.Error(), matcher.Expected), nil + } + + if isError(matcher.Expected) { + return reflect.DeepEqual(actualErr, matcher.Expected), nil + } + + var subMatcher omegaMatcher + var hasSubMatcher bool + if matcher.Expected != nil { + subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher) + if hasSubMatcher { + return subMatcher.Match(actualErr.Error()) + } + } + + return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1)) +} + +func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to match error", matcher.Expected) +} + +func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match error", matcher.Expected) +} diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go index 9ab94d48cb..338b512954 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go @@ -1,93 +1,93 @@ -package matchers_test - -import ( - "errors" - "fmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -type CustomError struct { -} - -func (c CustomError) Error() string { - return "an error" -} - -var _ = Describe("MatchErrorMatcher", func() { - Context("When asserting against an error", func() { - It("should succeed when matching with an error", func() { - err := errors.New("an error") - fmtErr := fmt.Errorf("an error") - customErr := CustomError{} - - Ω(err).Should(MatchError(errors.New("an error"))) - Ω(err).ShouldNot(MatchError(errors.New("another error"))) - - Ω(fmtErr).Should(MatchError(errors.New("an error"))) - Ω(customErr).Should(MatchError(CustomError{})) - }) - - It("should succeed when matching with a string", func() { - err := errors.New("an error") - fmtErr := fmt.Errorf("an error") - customErr := CustomError{} - - Ω(err).Should(MatchError("an error")) - Ω(err).ShouldNot(MatchError("another error")) - - Ω(fmtErr).Should(MatchError("an error")) - Ω(customErr).Should(MatchError("an error")) - }) - - Context("when passed a matcher", func() { - It("should pass if the matcher passes against the error string", func() { - err := errors.New("error 123 abc") - - Ω(err).Should(MatchError(MatchRegexp(`\d{3}`))) - }) - - It("should fail if the matcher fails against the error string", func() { - err := errors.New("no digits") - Ω(err).ShouldNot(MatchError(MatchRegexp(`\d`))) - }) - }) - - It("should fail when passed anything else", func() { - actualErr := errors.New("an error") - _, err := (&MatchErrorMatcher{ - Expected: []byte("an error"), - }).Match(actualErr) - Ω(err).Should(HaveOccurred()) - - _, err = (&MatchErrorMatcher{ - Expected: 3, - }).Match(actualErr) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed nil", func() { - It("should fail", func() { - _, err := (&MatchErrorMatcher{ - Expected: "an error", - }).Match(nil) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed a non-error", func() { - It("should fail", func() { - _, err := (&MatchErrorMatcher{ - Expected: "an error", - }).Match("an error") - Ω(err).Should(HaveOccurred()) - - _, err = (&MatchErrorMatcher{ - Expected: "an error", - }).Match(3) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + "errors" + "fmt" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +type CustomError struct { +} + +func (c CustomError) Error() string { + return "an error" +} + +var _ = Describe("MatchErrorMatcher", func() { + Context("When asserting against an error", func() { + It("should succeed when matching with an error", func() { + err := errors.New("an error") + fmtErr := fmt.Errorf("an error") + customErr := CustomError{} + + Ω(err).Should(MatchError(errors.New("an error"))) + Ω(err).ShouldNot(MatchError(errors.New("another error"))) + + Ω(fmtErr).Should(MatchError(errors.New("an error"))) + Ω(customErr).Should(MatchError(CustomError{})) + }) + + It("should succeed when matching with a string", func() { + err := errors.New("an error") + fmtErr := fmt.Errorf("an error") + customErr := CustomError{} + + Ω(err).Should(MatchError("an error")) + Ω(err).ShouldNot(MatchError("another error")) + + Ω(fmtErr).Should(MatchError("an error")) + Ω(customErr).Should(MatchError("an error")) + }) + + Context("when passed a matcher", func() { + It("should pass if the matcher passes against the error string", func() { + err := errors.New("error 123 abc") + + Ω(err).Should(MatchError(MatchRegexp(`\d{3}`))) + }) + + It("should fail if the matcher fails against the error string", func() { + err := errors.New("no digits") + Ω(err).ShouldNot(MatchError(MatchRegexp(`\d`))) + }) + }) + + It("should fail when passed anything else", func() { + actualErr := errors.New("an error") + _, err := (&MatchErrorMatcher{ + Expected: []byte("an error"), + }).Match(actualErr) + Ω(err).Should(HaveOccurred()) + + _, err = (&MatchErrorMatcher{ + Expected: 3, + }).Match(actualErr) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed nil", func() { + It("should fail", func() { + _, err := (&MatchErrorMatcher{ + Expected: "an error", + }).Match(nil) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed a non-error", func() { + It("should fail", func() { + _, err := (&MatchErrorMatcher{ + Expected: "an error", + }).Match("an error") + Ω(err).Should(HaveOccurred()) + + _, err = (&MatchErrorMatcher{ + Expected: "an error", + }).Match(3) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go index e8479a9016..e61978a1de 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_json_matcher.go @@ -1,64 +1,64 @@ -package matchers - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type MatchJSONMatcher struct { - JSONToMatch interface{} -} - -func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err error) { - actualString, expectedString, err := matcher.prettyPrint(actual) - if err != nil { - return false, err - } - - var aval interface{} - var eval interface{} - - // this is guarded by prettyPrint - json.Unmarshal([]byte(actualString), &aval) - json.Unmarshal([]byte(expectedString), &eval) - - return reflect.DeepEqual(aval, eval), nil -} - -func (matcher *MatchJSONMatcher) FailureMessage(actual interface{}) (message string) { - actualString, expectedString, _ := matcher.prettyPrint(actual) - return format.Message(actualString, "to match JSON of", expectedString) -} - -func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) { - actualString, expectedString, _ := matcher.prettyPrint(actual) - return format.Message(actualString, "not to match JSON of", expectedString) -} - -func (matcher *MatchJSONMatcher) prettyPrint(actual interface{}) (actualFormatted, expectedFormatted string, err error) { - actualString, ok := toString(actual) - if !ok { - return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) - } - expectedString, ok := toString(matcher.JSONToMatch) - if !ok { - return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.JSONToMatch, 1)) - } - - abuf := new(bytes.Buffer) - ebuf := new(bytes.Buffer) - - if err := json.Indent(abuf, []byte(actualString), "", " "); err != nil { - return "", "", fmt.Errorf("Actual '%s' should be valid JSON, but it is not.\nUnderlying error:%s", actualString, err) - } - - if err := json.Indent(ebuf, []byte(expectedString), "", " "); err != nil { - return "", "", fmt.Errorf("Expected '%s' should be valid JSON, but it is not.\nUnderlying error:%s", expectedString, err) - } - - return abuf.String(), ebuf.String(), nil -} +package matchers + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type MatchJSONMatcher struct { + JSONToMatch interface{} +} + +func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err error) { + actualString, expectedString, err := matcher.prettyPrint(actual) + if err != nil { + return false, err + } + + var aval interface{} + var eval interface{} + + // this is guarded by prettyPrint + json.Unmarshal([]byte(actualString), &aval) + json.Unmarshal([]byte(expectedString), &eval) + + return reflect.DeepEqual(aval, eval), nil +} + +func (matcher *MatchJSONMatcher) FailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.prettyPrint(actual) + return format.Message(actualString, "to match JSON of", expectedString) +} + +func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.prettyPrint(actual) + return format.Message(actualString, "not to match JSON of", expectedString) +} + +func (matcher *MatchJSONMatcher) prettyPrint(actual interface{}) (actualFormatted, expectedFormatted string, err error) { + actualString, ok := toString(actual) + if !ok { + return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) + } + expectedString, ok := toString(matcher.JSONToMatch) + if !ok { + return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.JSONToMatch, 1)) + } + + abuf := new(bytes.Buffer) + ebuf := new(bytes.Buffer) + + if err := json.Indent(abuf, []byte(actualString), "", " "); err != nil { + return "", "", fmt.Errorf("Actual '%s' should be valid JSON, but it is not.\nUnderlying error:%s", actualString, err) + } + + if err := json.Indent(ebuf, []byte(expectedString), "", " "); err != nil { + return "", "", fmt.Errorf("Expected '%s' should be valid JSON, but it is not.\nUnderlying error:%s", expectedString, err) + } + + return abuf.String(), ebuf.String(), nil +} diff --git a/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go index fae4d2a17c..755c4ad827 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go @@ -1,73 +1,73 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("MatchJSONMatcher", func() { - Context("When passed stringifiables", func() { - It("should succeed if the JSON matches", func() { - Ω("{}").Should(MatchJSON("{}")) - Ω(`{"a":1}`).Should(MatchJSON(`{"a":1}`)) - Ω(`{ - "a":1 - }`).Should(MatchJSON(`{"a":1}`)) - Ω(`{"a":1, "b":2}`).Should(MatchJSON(`{"b":2, "a":1}`)) - Ω(`{"a":1}`).ShouldNot(MatchJSON(`{"b":2, "a":1}`)) - }) - - It("should work with byte arrays", func() { - Ω([]byte("{}")).Should(MatchJSON([]byte("{}"))) - Ω("{}").Should(MatchJSON([]byte("{}"))) - Ω([]byte("{}")).Should(MatchJSON("{}")) - }) - }) - - Context("when the expected is not valid JSON", func() { - It("should error and explain why", func() { - success, err := (&MatchJSONMatcher{JSONToMatch: `{}`}).Match(`oops`) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - Ω(err.Error()).Should(ContainSubstring("Actual 'oops' should be valid JSON")) - }) - }) - - Context("when the actual is not valid JSON", func() { - It("should error and explain why", func() { - success, err := (&MatchJSONMatcher{JSONToMatch: `oops`}).Match(`{}`) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - Ω(err.Error()).Should(ContainSubstring("Expected 'oops' should be valid JSON")) - }) - }) - - Context("when the expected is neither a string nor a stringer nor a byte array", func() { - It("should error", func() { - success, err := (&MatchJSONMatcher{JSONToMatch: 2}).Match("{}") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n : 2")) - - success, err = (&MatchJSONMatcher{JSONToMatch: nil}).Match("{}") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n : nil")) - }) - }) - - Context("when the actual is neither a string nor a stringer nor a byte array", func() { - It("should error", func() { - success, err := (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(2) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n : 2")) - - success, err = (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n : nil")) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("MatchJSONMatcher", func() { + Context("When passed stringifiables", func() { + It("should succeed if the JSON matches", func() { + Ω("{}").Should(MatchJSON("{}")) + Ω(`{"a":1}`).Should(MatchJSON(`{"a":1}`)) + Ω(`{ + "a":1 + }`).Should(MatchJSON(`{"a":1}`)) + Ω(`{"a":1, "b":2}`).Should(MatchJSON(`{"b":2, "a":1}`)) + Ω(`{"a":1}`).ShouldNot(MatchJSON(`{"b":2, "a":1}`)) + }) + + It("should work with byte arrays", func() { + Ω([]byte("{}")).Should(MatchJSON([]byte("{}"))) + Ω("{}").Should(MatchJSON([]byte("{}"))) + Ω([]byte("{}")).Should(MatchJSON("{}")) + }) + }) + + Context("when the expected is not valid JSON", func() { + It("should error and explain why", func() { + success, err := (&MatchJSONMatcher{JSONToMatch: `{}`}).Match(`oops`) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(ContainSubstring("Actual 'oops' should be valid JSON")) + }) + }) + + Context("when the actual is not valid JSON", func() { + It("should error and explain why", func() { + success, err := (&MatchJSONMatcher{JSONToMatch: `oops`}).Match(`{}`) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(ContainSubstring("Expected 'oops' should be valid JSON")) + }) + }) + + Context("when the expected is neither a string nor a stringer nor a byte array", func() { + It("should error", func() { + success, err := (&MatchJSONMatcher{JSONToMatch: 2}).Match("{}") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n : 2")) + + success, err = (&MatchJSONMatcher{JSONToMatch: nil}).Match("{}") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n : nil")) + }) + }) + + Context("when the actual is neither a string nor a stringer nor a byte array", func() { + It("should error", func() { + success, err := (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(2) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n : 2")) + + success, err = (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n : nil")) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go index 6b25a6a214..7ca79a15be 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go @@ -1,42 +1,42 @@ -package matchers - -import ( - "fmt" - "github.com/onsi/gomega/format" - "regexp" -) - -type MatchRegexpMatcher struct { - Regexp string - Args []interface{} -} - -func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { - actualString, ok := toString(actual) - if !ok { - return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) - } - - match, err := regexp.Match(matcher.regexp(), []byte(actualString)) - if err != nil { - return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error()) - } - - return match, nil -} - -func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to match regular expression", matcher.regexp()) -} - -func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, "not to match regular expression", matcher.regexp()) -} - -func (matcher *MatchRegexpMatcher) regexp() string { - re := matcher.Regexp - if len(matcher.Args) > 0 { - re = fmt.Sprintf(matcher.Regexp, matcher.Args...) - } - return re -} +package matchers + +import ( + "fmt" + "github.com/onsi/gomega/format" + "regexp" +) + +type MatchRegexpMatcher struct { + Regexp string + Args []interface{} +} + +func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { + actualString, ok := toString(actual) + if !ok { + return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) + } + + match, err := regexp.Match(matcher.regexp(), []byte(actualString)) + if err != nil { + return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error()) + } + + return match, nil +} + +func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to match regular expression", matcher.regexp()) +} + +func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, "not to match regular expression", matcher.regexp()) +} + +func (matcher *MatchRegexpMatcher) regexp() string { + re := matcher.Regexp + if len(matcher.Args) > 0 { + re = fmt.Sprintf(matcher.Regexp, matcher.Args...) + } + return re +} diff --git a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go index a01e6ba0b4..bb521cce34 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go @@ -1,44 +1,44 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("MatchRegexp", func() { - Context("when actual is a string", func() { - It("should match against the string", func() { - Ω(" a2!bla").Should(MatchRegexp(`\d!`)) - Ω(" a2!bla").ShouldNot(MatchRegexp(`[A-Z]`)) - }) - }) - - Context("when actual is a stringer", func() { - It("should call the stringer and match agains the returned string", func() { - Ω(&myStringer{a: "Abc3"}).Should(MatchRegexp(`[A-Z][a-z]+\d`)) - }) - }) - - Context("when the matcher is called with multiple arguments", func() { - It("should pass the string and arguments to sprintf", func() { - Ω(" a23!bla").Should(MatchRegexp(`\d%d!`, 3)) - }) - }) - - Context("when actual is neither a string nor a stringer", func() { - It("should error", func() { - success, err := (&MatchRegexpMatcher{Regexp: `\d`}).Match(2) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when the passed in regexp fails to compile", func() { - It("should error", func() { - success, err := (&MatchRegexpMatcher{Regexp: "("}).Match("Foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("MatchRegexp", func() { + Context("when actual is a string", func() { + It("should match against the string", func() { + Ω(" a2!bla").Should(MatchRegexp(`\d!`)) + Ω(" a2!bla").ShouldNot(MatchRegexp(`[A-Z]`)) + }) + }) + + Context("when actual is a stringer", func() { + It("should call the stringer and match agains the returned string", func() { + Ω(&myStringer{a: "Abc3"}).Should(MatchRegexp(`[A-Z][a-z]+\d`)) + }) + }) + + Context("when the matcher is called with multiple arguments", func() { + It("should pass the string and arguments to sprintf", func() { + Ω(" a23!bla").Should(MatchRegexp(`\d%d!`, 3)) + }) + }) + + Context("when actual is neither a string nor a stringer", func() { + It("should error", func() { + success, err := (&MatchRegexpMatcher{Regexp: `\d`}).Match(2) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when the passed in regexp fails to compile", func() { + It("should error", func() { + success, err := (&MatchRegexpMatcher{Regexp: "("}).Match("Foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go index 99b8d3e521..69fb51a859 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher.go @@ -1,74 +1,74 @@ -package matchers - -import ( - "fmt" - "reflect" - "strings" - - "github.com/onsi/gomega/format" - "gopkg.in/yaml.v2" -) - -type MatchYAMLMatcher struct { - YAMLToMatch interface{} -} - -func (matcher *MatchYAMLMatcher) Match(actual interface{}) (success bool, err error) { - actualString, expectedString, err := matcher.toStrings(actual) - if err != nil { - return false, err - } - - var aval interface{} - var eval interface{} - - if err := yaml.Unmarshal([]byte(actualString), &aval); err != nil { - return false, fmt.Errorf("Actual '%s' should be valid YAML, but it is not.\nUnderlying error:%s", actualString, err) - } - if err := yaml.Unmarshal([]byte(expectedString), &eval); err != nil { - return false, fmt.Errorf("Expected '%s' should be valid YAML, but it is not.\nUnderlying error:%s", expectedString, err) - } - - return reflect.DeepEqual(aval, eval), nil -} - -func (matcher *MatchYAMLMatcher) FailureMessage(actual interface{}) (message string) { - actualString, expectedString, _ := matcher.toNormalisedStrings(actual) - return format.Message(actualString, "to match YAML of", expectedString) -} - -func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual interface{}) (message string) { - actualString, expectedString, _ := matcher.toNormalisedStrings(actual) - return format.Message(actualString, "not to match YAML of", expectedString) -} - -func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { - actualString, expectedString, err := matcher.toStrings(actual) - return normalise(actualString), normalise(expectedString), err -} - -func normalise(input string) string { - var val interface{} - err := yaml.Unmarshal([]byte(input), &val) - if err != nil { - panic(err) // guarded by Match - } - output, err := yaml.Marshal(val) - if err != nil { - panic(err) // guarded by Unmarshal - } - return strings.TrimSpace(string(output)) -} - -func (matcher *MatchYAMLMatcher) toStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { - actualString, ok := toString(actual) - if !ok { - return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) - } - expectedString, ok := toString(matcher.YAMLToMatch) - if !ok { - return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.YAMLToMatch, 1)) - } - - return actualString, expectedString, nil -} +package matchers + +import ( + "fmt" + "reflect" + "strings" + + "github.com/onsi/gomega/format" + "gopkg.in/yaml.v2" +) + +type MatchYAMLMatcher struct { + YAMLToMatch interface{} +} + +func (matcher *MatchYAMLMatcher) Match(actual interface{}) (success bool, err error) { + actualString, expectedString, err := matcher.toStrings(actual) + if err != nil { + return false, err + } + + var aval interface{} + var eval interface{} + + if err := yaml.Unmarshal([]byte(actualString), &aval); err != nil { + return false, fmt.Errorf("Actual '%s' should be valid YAML, but it is not.\nUnderlying error:%s", actualString, err) + } + if err := yaml.Unmarshal([]byte(expectedString), &eval); err != nil { + return false, fmt.Errorf("Expected '%s' should be valid YAML, but it is not.\nUnderlying error:%s", expectedString, err) + } + + return reflect.DeepEqual(aval, eval), nil +} + +func (matcher *MatchYAMLMatcher) FailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.toNormalisedStrings(actual) + return format.Message(actualString, "to match YAML of", expectedString) +} + +func (matcher *MatchYAMLMatcher) NegatedFailureMessage(actual interface{}) (message string) { + actualString, expectedString, _ := matcher.toNormalisedStrings(actual) + return format.Message(actualString, "not to match YAML of", expectedString) +} + +func (matcher *MatchYAMLMatcher) toNormalisedStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { + actualString, expectedString, err := matcher.toStrings(actual) + return normalise(actualString), normalise(expectedString), err +} + +func normalise(input string) string { + var val interface{} + err := yaml.Unmarshal([]byte(input), &val) + if err != nil { + panic(err) // guarded by Match + } + output, err := yaml.Marshal(val) + if err != nil { + panic(err) // guarded by Unmarshal + } + return strings.TrimSpace(string(output)) +} + +func (matcher *MatchYAMLMatcher) toStrings(actual interface{}) (actualFormatted, expectedFormatted string, err error) { + actualString, ok := toString(actual) + if !ok { + return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n%s", format.Object(actual, 1)) + } + expectedString, ok := toString(matcher.YAMLToMatch) + if !ok { + return "", "", fmt.Errorf("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n%s", format.Object(matcher.YAMLToMatch, 1)) + } + + return actualString, expectedString, nil +} diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go index 88e12f0cc5..8e63de19e3 100644 --- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go @@ -1,94 +1,94 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("MatchYAMLMatcher", func() { - Context("When passed stringifiables", func() { - It("should succeed if the YAML matches", func() { - Expect("---").Should(MatchYAML("")) - Expect("a: 1").Should(MatchYAML(`{"a":1}`)) - Expect("a: 1\nb: 2").Should(MatchYAML(`{"b":2, "a":1}`)) - }) - - It("should explain if the YAML does not match when it should", func() { - message := (&MatchYAMLMatcher{YAMLToMatch: "a: 1"}).FailureMessage("b: 2") - Expect(message).To(MatchRegexp(`Expected\s+: b: 2\s+to match YAML of\s+: a: 1`)) - }) - - It("should normalise the expected and actual when explaining if the YAML does not match when it should", func() { - message := (&MatchYAMLMatcher{YAMLToMatch: "a: 'one'"}).FailureMessage("{b: two}") - Expect(message).To(MatchRegexp(`Expected\s+: b: two\s+to match YAML of\s+: a: one`)) - }) - - It("should explain if the YAML matches when it should not", func() { - message := (&MatchYAMLMatcher{YAMLToMatch: "a: 1"}).NegatedFailureMessage("a: 1") - Expect(message).To(MatchRegexp(`Expected\s+: a: 1\s+not to match YAML of\s+: a: 1`)) - }) - - It("should normalise the expected and actual when explaining if the YAML matches when it should not", func() { - message := (&MatchYAMLMatcher{YAMLToMatch: "a: 'one'"}).NegatedFailureMessage("{a: one}") - Expect(message).To(MatchRegexp(`Expected\s+: a: one\s+not to match YAML of\s+: a: one`)) - }) - - It("should fail if the YAML does not match", func() { - Expect("a: 1").ShouldNot(MatchYAML(`{"b":2, "a":1}`)) - }) - - It("should work with byte arrays", func() { - Expect([]byte("a: 1")).Should(MatchYAML([]byte("a: 1"))) - Expect("a: 1").Should(MatchYAML([]byte("a: 1"))) - Expect([]byte("a: 1")).Should(MatchYAML("a: 1")) - }) - }) - - Context("when the expected is not valid YAML", func() { - It("should error and explain why", func() { - success, err := (&MatchYAMLMatcher{YAMLToMatch: ""}).Match("good:\nbad") - Expect(success).Should(BeFalse()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).Should(ContainSubstring("Actual 'good:\nbad' should be valid YAML")) - }) - }) - - Context("when the actual is not valid YAML", func() { - It("should error and explain why", func() { - success, err := (&MatchYAMLMatcher{YAMLToMatch: "good:\nbad"}).Match("") - Expect(success).Should(BeFalse()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).Should(ContainSubstring("Expected 'good:\nbad' should be valid YAML")) - }) - }) - - Context("when the expected is neither a string nor a stringer nor a byte array", func() { - It("should error", func() { - success, err := (&MatchYAMLMatcher{YAMLToMatch: 2}).Match("") - Expect(success).Should(BeFalse()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n : 2")) - - success, err = (&MatchYAMLMatcher{YAMLToMatch: nil}).Match("") - Expect(success).Should(BeFalse()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n : nil")) - }) - }) - - Context("when the actual is neither a string nor a stringer nor a byte array", func() { - It("should error", func() { - success, err := (&MatchYAMLMatcher{YAMLToMatch: ""}).Match(2) - Expect(success).Should(BeFalse()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n : 2")) - - success, err = (&MatchYAMLMatcher{YAMLToMatch: ""}).Match(nil) - Expect(success).Should(BeFalse()) - Expect(err).Should(HaveOccurred()) - Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n : nil")) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("MatchYAMLMatcher", func() { + Context("When passed stringifiables", func() { + It("should succeed if the YAML matches", func() { + Expect("---").Should(MatchYAML("")) + Expect("a: 1").Should(MatchYAML(`{"a":1}`)) + Expect("a: 1\nb: 2").Should(MatchYAML(`{"b":2, "a":1}`)) + }) + + It("should explain if the YAML does not match when it should", func() { + message := (&MatchYAMLMatcher{YAMLToMatch: "a: 1"}).FailureMessage("b: 2") + Expect(message).To(MatchRegexp(`Expected\s+: b: 2\s+to match YAML of\s+: a: 1`)) + }) + + It("should normalise the expected and actual when explaining if the YAML does not match when it should", func() { + message := (&MatchYAMLMatcher{YAMLToMatch: "a: 'one'"}).FailureMessage("{b: two}") + Expect(message).To(MatchRegexp(`Expected\s+: b: two\s+to match YAML of\s+: a: one`)) + }) + + It("should explain if the YAML matches when it should not", func() { + message := (&MatchYAMLMatcher{YAMLToMatch: "a: 1"}).NegatedFailureMessage("a: 1") + Expect(message).To(MatchRegexp(`Expected\s+: a: 1\s+not to match YAML of\s+: a: 1`)) + }) + + It("should normalise the expected and actual when explaining if the YAML matches when it should not", func() { + message := (&MatchYAMLMatcher{YAMLToMatch: "a: 'one'"}).NegatedFailureMessage("{a: one}") + Expect(message).To(MatchRegexp(`Expected\s+: a: one\s+not to match YAML of\s+: a: one`)) + }) + + It("should fail if the YAML does not match", func() { + Expect("a: 1").ShouldNot(MatchYAML(`{"b":2, "a":1}`)) + }) + + It("should work with byte arrays", func() { + Expect([]byte("a: 1")).Should(MatchYAML([]byte("a: 1"))) + Expect("a: 1").Should(MatchYAML([]byte("a: 1"))) + Expect([]byte("a: 1")).Should(MatchYAML("a: 1")) + }) + }) + + Context("when the expected is not valid YAML", func() { + It("should error and explain why", func() { + success, err := (&MatchYAMLMatcher{YAMLToMatch: ""}).Match("good:\nbad") + Expect(success).Should(BeFalse()) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).Should(ContainSubstring("Actual 'good:\nbad' should be valid YAML")) + }) + }) + + Context("when the actual is not valid YAML", func() { + It("should error and explain why", func() { + success, err := (&MatchYAMLMatcher{YAMLToMatch: "good:\nbad"}).Match("") + Expect(success).Should(BeFalse()) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).Should(ContainSubstring("Expected 'good:\nbad' should be valid YAML")) + }) + }) + + Context("when the expected is neither a string nor a stringer nor a byte array", func() { + It("should error", func() { + success, err := (&MatchYAMLMatcher{YAMLToMatch: 2}).Match("") + Expect(success).Should(BeFalse()) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n : 2")) + + success, err = (&MatchYAMLMatcher{YAMLToMatch: nil}).Match("") + Expect(success).Should(BeFalse()) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n : nil")) + }) + }) + + Context("when the actual is neither a string nor a stringer nor a byte array", func() { + It("should error", func() { + success, err := (&MatchYAMLMatcher{YAMLToMatch: ""}).Match(2) + Expect(success).Should(BeFalse()) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n : 2")) + + success, err = (&MatchYAMLMatcher{YAMLToMatch: ""}).Match(nil) + Expect(success).Should(BeFalse()) + Expect(err).Should(HaveOccurred()) + Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n : nil")) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go b/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go index a5c1eb63bf..01b11b97d6 100644 --- a/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go +++ b/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go @@ -1,30 +1,30 @@ -package matchers_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -type myStringer struct { - a string -} - -func (s *myStringer) String() string { - return s.a -} - -type StringAlias string - -type myCustomType struct { - s string - n int - f float32 - arr []string -} - -func Test(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Gomega Matchers") -} +package matchers_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +type myStringer struct { + a string +} + +func (s *myStringer) String() string { + return s.a +} + +type StringAlias string + +type myCustomType struct { + s string + n int + f float32 + arr []string +} + +func Test(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Gomega Matchers") +} diff --git a/vendor/github.com/onsi/gomega/matchers/not.go b/vendor/github.com/onsi/gomega/matchers/not.go index 4c920b9f13..2c91670bd9 100644 --- a/vendor/github.com/onsi/gomega/matchers/not.go +++ b/vendor/github.com/onsi/gomega/matchers/not.go @@ -1,30 +1,30 @@ -package matchers - -import ( - "github.com/onsi/gomega/internal/oraclematcher" - "github.com/onsi/gomega/types" -) - -type NotMatcher struct { - Matcher types.GomegaMatcher -} - -func (m *NotMatcher) Match(actual interface{}) (bool, error) { - success, err := m.Matcher.Match(actual) - if err != nil { - return false, err - } - return !success, nil -} - -func (m *NotMatcher) FailureMessage(actual interface{}) (message string) { - return m.Matcher.NegatedFailureMessage(actual) // works beautifully -} - -func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return m.Matcher.FailureMessage(actual) // works beautifully -} - -func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value -} +package matchers + +import ( + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type NotMatcher struct { + Matcher types.GomegaMatcher +} + +func (m *NotMatcher) Match(actual interface{}) (bool, error) { + success, err := m.Matcher.Match(actual) + if err != nil { + return false, err + } + return !success, nil +} + +func (m *NotMatcher) FailureMessage(actual interface{}) (message string) { + return m.Matcher.NegatedFailureMessage(actual) // works beautifully +} + +func (m *NotMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return m.Matcher.FailureMessage(actual) // works beautifully +} + +func (m *NotMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, actual) // just return m.Matcher's value +} diff --git a/vendor/github.com/onsi/gomega/matchers/not_test.go b/vendor/github.com/onsi/gomega/matchers/not_test.go index 57ed5078ab..b3c1fdbf0b 100644 --- a/vendor/github.com/onsi/gomega/matchers/not_test.go +++ b/vendor/github.com/onsi/gomega/matchers/not_test.go @@ -1,57 +1,57 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("NotMatcher", func() { - Context("basic examples", func() { - It("works", func() { - Expect(input).To(Not(false1)) - Expect(input).To(Not(Not(true2))) - Expect(input).ToNot(Not(true3)) - Expect(input).ToNot(Not(Not(false1))) - Expect(input).To(Not(Not(Not(false2)))) - }) - }) - - Context("De Morgan's laws", func() { - It("~(A && B) == ~A || ~B", func() { - Expect(input).To(Not(And(false1, false2))) - Expect(input).To(Or(Not(false1), Not(false2))) - }) - It("~(A || B) == ~A && ~B", func() { - Expect(input).To(Not(Or(false1, false2))) - Expect(input).To(And(Not(false1), Not(false2))) - }) - }) - - Context("failure messages are opposite of original matchers' failure messages", func() { - Context("when match fails", func() { - It("gives a descriptive message", func() { - verifyFailureMessage(Not(HaveLen(2)), input, "not to have length 2") - }) - }) - - Context("when match succeeds, but expected it to fail", func() { - It("gives a descriptive message", func() { - verifyFailureMessage(Not(Not(HaveLen(3))), input, "to have length 3") - }) - }) - }) - - Context("MatchMayChangeInTheFuture()", func() { - It("Propagates value from wrapped matcher", func() { - m := Not(Or()) // an empty Or() always returns false, and indicates it cannot change - Expect(m.Match("anything")).To(BeTrue()) - Expect(m.(*NotMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse()) - }) - It("Defaults to true", func() { - m := Not(Equal(1)) // Equal does not have this method - Expect(m.Match(2)).To(BeTrue()) - Expect(m.(*NotMatcher).MatchMayChangeInTheFuture(2)).To(BeTrue()) // defaults to true - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("NotMatcher", func() { + Context("basic examples", func() { + It("works", func() { + Expect(input).To(Not(false1)) + Expect(input).To(Not(Not(true2))) + Expect(input).ToNot(Not(true3)) + Expect(input).ToNot(Not(Not(false1))) + Expect(input).To(Not(Not(Not(false2)))) + }) + }) + + Context("De Morgan's laws", func() { + It("~(A && B) == ~A || ~B", func() { + Expect(input).To(Not(And(false1, false2))) + Expect(input).To(Or(Not(false1), Not(false2))) + }) + It("~(A || B) == ~A && ~B", func() { + Expect(input).To(Not(Or(false1, false2))) + Expect(input).To(And(Not(false1), Not(false2))) + }) + }) + + Context("failure messages are opposite of original matchers' failure messages", func() { + Context("when match fails", func() { + It("gives a descriptive message", func() { + verifyFailureMessage(Not(HaveLen(2)), input, "not to have length 2") + }) + }) + + Context("when match succeeds, but expected it to fail", func() { + It("gives a descriptive message", func() { + verifyFailureMessage(Not(Not(HaveLen(3))), input, "to have length 3") + }) + }) + }) + + Context("MatchMayChangeInTheFuture()", func() { + It("Propagates value from wrapped matcher", func() { + m := Not(Or()) // an empty Or() always returns false, and indicates it cannot change + Expect(m.Match("anything")).To(BeTrue()) + Expect(m.(*NotMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse()) + }) + It("Defaults to true", func() { + m := Not(Equal(1)) // Equal does not have this method + Expect(m.Match(2)).To(BeTrue()) + Expect(m.(*NotMatcher).MatchMayChangeInTheFuture(2)).To(BeTrue()) // defaults to true + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/or.go b/vendor/github.com/onsi/gomega/matchers/or.go index 8abf276e94..3bf7998001 100644 --- a/vendor/github.com/onsi/gomega/matchers/or.go +++ b/vendor/github.com/onsi/gomega/matchers/or.go @@ -1,67 +1,67 @@ -package matchers - -import ( - "fmt" - - "github.com/onsi/gomega/format" - "github.com/onsi/gomega/internal/oraclematcher" - "github.com/onsi/gomega/types" -) - -type OrMatcher struct { - Matchers []types.GomegaMatcher - - // state - firstSuccessfulMatcher types.GomegaMatcher -} - -func (m *OrMatcher) Match(actual interface{}) (success bool, err error) { - m.firstSuccessfulMatcher = nil - for _, matcher := range m.Matchers { - success, err := matcher.Match(actual) - if err != nil { - return false, err - } - if success { - m.firstSuccessfulMatcher = matcher - return true, nil - } - } - return false, nil -} - -func (m *OrMatcher) FailureMessage(actual interface{}) (message string) { - // not the most beautiful list of matchers, but not bad either... - return format.Message(actual, fmt.Sprintf("To satisfy at least one of these matchers: %s", m.Matchers)) -} - -func (m *OrMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return m.firstSuccessfulMatcher.NegatedFailureMessage(actual) -} - -func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - /* - Example with 3 matchers: A, B, C - - Match evaluates them: F, T, => T - So match is currently T, what should MatchMayChangeInTheFuture() return? - Seems like it only depends on B, since currently B MUST change to allow the result to become F - - Match eval: F, F, F => F - So match is currently F, what should MatchMayChangeInTheFuture() return? - Seems to depend on ANY of them being able to change to T. - */ - - if m.firstSuccessfulMatcher != nil { - // one of the matchers succeeded.. it must be able to change in order to affect the result - return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual) - } else { - // so all matchers failed.. Any one of them changing would change the result. - for _, matcher := range m.Matchers { - if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { - return true - } - } - return false // none of were going to change - } -} +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type OrMatcher struct { + Matchers []types.GomegaMatcher + + // state + firstSuccessfulMatcher types.GomegaMatcher +} + +func (m *OrMatcher) Match(actual interface{}) (success bool, err error) { + m.firstSuccessfulMatcher = nil + for _, matcher := range m.Matchers { + success, err := matcher.Match(actual) + if err != nil { + return false, err + } + if success { + m.firstSuccessfulMatcher = matcher + return true, nil + } + } + return false, nil +} + +func (m *OrMatcher) FailureMessage(actual interface{}) (message string) { + // not the most beautiful list of matchers, but not bad either... + return format.Message(actual, fmt.Sprintf("To satisfy at least one of these matchers: %s", m.Matchers)) +} + +func (m *OrMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return m.firstSuccessfulMatcher.NegatedFailureMessage(actual) +} + +func (m *OrMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + /* + Example with 3 matchers: A, B, C + + Match evaluates them: F, T, => T + So match is currently T, what should MatchMayChangeInTheFuture() return? + Seems like it only depends on B, since currently B MUST change to allow the result to become F + + Match eval: F, F, F => F + So match is currently F, what should MatchMayChangeInTheFuture() return? + Seems to depend on ANY of them being able to change to T. + */ + + if m.firstSuccessfulMatcher != nil { + // one of the matchers succeeded.. it must be able to change in order to affect the result + return oraclematcher.MatchMayChangeInTheFuture(m.firstSuccessfulMatcher, actual) + } else { + // so all matchers failed.. Any one of them changing would change the result. + for _, matcher := range m.Matchers { + if oraclematcher.MatchMayChangeInTheFuture(matcher, actual) { + return true + } + } + return false // none of were going to change + } +} diff --git a/vendor/github.com/onsi/gomega/matchers/or_test.go b/vendor/github.com/onsi/gomega/matchers/or_test.go index c97a1e7353..9589a174da 100644 --- a/vendor/github.com/onsi/gomega/matchers/or_test.go +++ b/vendor/github.com/onsi/gomega/matchers/or_test.go @@ -1,85 +1,85 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("OrMatcher", func() { - It("works with positive cases", func() { - Expect(input).To(Or(true1)) - Expect(input).To(Or(true1, true2)) - Expect(input).To(Or(true1, false1)) - Expect(input).To(Or(false1, true2)) - Expect(input).To(Or(true1, true2, true3)) - Expect(input).To(Or(true1, true2, false3)) - Expect(input).To(Or(true1, false2, true3)) - Expect(input).To(Or(false1, true2, true3)) - Expect(input).To(Or(true1, false2, false3)) - Expect(input).To(Or(false1, false2, true3)) - - // use alias - Expect(input).To(SatisfyAny(false1, false2, true3)) - }) - - It("works with negative cases", func() { - Expect(input).ToNot(Or()) - Expect(input).ToNot(Or(false1)) - Expect(input).ToNot(Or(false1, false2)) - Expect(input).ToNot(Or(false1, false2, false3)) - }) - - Context("failure messages", func() { - Context("when match fails", func() { - It("gives a descriptive message", func() { - verifyFailureMessage(Or(false1, false2), input, - "To satisfy at least one of these matchers: [%!s(*matchers.HaveLenMatcher=&{1}) %!s(*matchers.EqualMatcher=&{hip})]") - }) - }) - - Context("when match succeeds, but expected it to fail", func() { - It("gives a descriptive message", func() { - verifyFailureMessage(Not(Or(true1, true2)), input, `not to have length 2`) - }) - }) - }) - - Context("MatchMayChangeInTheFuture", func() { - Context("Match returned false", func() { - It("returns true if any of the matchers could change", func() { - // 3 matchers, all return false, and all could change - m := Or(BeNil(), Equal("hip"), HaveLen(1)) - Expect(m.Match("hi")).To(BeFalse()) - Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // all 3 of these matchers default to 'true' - }) - It("returns false if none of the matchers could change", func() { - // empty Or() has the property of never matching, and never can change since there are no sub-matchers that could change - m := Or() - Expect(m.Match("anything")).To(BeFalse()) - Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse()) - - // Or() with 3 sub-matchers that return false, and can't change - m = Or(Or(), Or(), Or()) - Expect(m.Match("hi")).To(BeFalse()) - Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // the 3 empty Or()'s won't change - }) - }) - Context("Match returned true", func() { - Context("returns value of the successful matcher", func() { - It("false if successful matcher not going to change", func() { - // 3 matchers: 1st returns false, 2nd returns true and is not going to change, 3rd is never called - m := Or(BeNil(), And(), Equal(1)) - Expect(m.Match("hi")).To(BeTrue()) - Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) - }) - It("true if successful matcher indicates it might change", func() { - // 3 matchers: 1st returns false, 2nd returns true and "might" change, 3rd is never called - m := Or(Not(BeNil()), Equal("hi"), Equal(1)) - Expect(m.Match("hi")).To(BeTrue()) - Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // Equal("hi") indicates it might change - }) - }) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("OrMatcher", func() { + It("works with positive cases", func() { + Expect(input).To(Or(true1)) + Expect(input).To(Or(true1, true2)) + Expect(input).To(Or(true1, false1)) + Expect(input).To(Or(false1, true2)) + Expect(input).To(Or(true1, true2, true3)) + Expect(input).To(Or(true1, true2, false3)) + Expect(input).To(Or(true1, false2, true3)) + Expect(input).To(Or(false1, true2, true3)) + Expect(input).To(Or(true1, false2, false3)) + Expect(input).To(Or(false1, false2, true3)) + + // use alias + Expect(input).To(SatisfyAny(false1, false2, true3)) + }) + + It("works with negative cases", func() { + Expect(input).ToNot(Or()) + Expect(input).ToNot(Or(false1)) + Expect(input).ToNot(Or(false1, false2)) + Expect(input).ToNot(Or(false1, false2, false3)) + }) + + Context("failure messages", func() { + Context("when match fails", func() { + It("gives a descriptive message", func() { + verifyFailureMessage(Or(false1, false2), input, + "To satisfy at least one of these matchers: [%!s(*matchers.HaveLenMatcher=&{1}) %!s(*matchers.EqualMatcher=&{hip})]") + }) + }) + + Context("when match succeeds, but expected it to fail", func() { + It("gives a descriptive message", func() { + verifyFailureMessage(Not(Or(true1, true2)), input, `not to have length 2`) + }) + }) + }) + + Context("MatchMayChangeInTheFuture", func() { + Context("Match returned false", func() { + It("returns true if any of the matchers could change", func() { + // 3 matchers, all return false, and all could change + m := Or(BeNil(), Equal("hip"), HaveLen(1)) + Expect(m.Match("hi")).To(BeFalse()) + Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // all 3 of these matchers default to 'true' + }) + It("returns false if none of the matchers could change", func() { + // empty Or() has the property of never matching, and never can change since there are no sub-matchers that could change + m := Or() + Expect(m.Match("anything")).To(BeFalse()) + Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse()) + + // Or() with 3 sub-matchers that return false, and can't change + m = Or(Or(), Or(), Or()) + Expect(m.Match("hi")).To(BeFalse()) + Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // the 3 empty Or()'s won't change + }) + }) + Context("Match returned true", func() { + Context("returns value of the successful matcher", func() { + It("false if successful matcher not going to change", func() { + // 3 matchers: 1st returns false, 2nd returns true and is not going to change, 3rd is never called + m := Or(BeNil(), And(), Equal(1)) + Expect(m.Match("hi")).To(BeTrue()) + Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) + }) + It("true if successful matcher indicates it might change", func() { + // 3 matchers: 1st returns false, 2nd returns true and "might" change, 3rd is never called + m := Or(Not(BeNil()), Equal("hi"), Equal(1)) + Expect(m.Match("hi")).To(BeTrue()) + Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // Equal("hi") indicates it might change + }) + }) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go index 55fbe2547f..640f4db1a3 100644 --- a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go @@ -1,46 +1,46 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type PanicMatcher struct { - object interface{} -} - -func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { - if actual == nil { - return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") - } - - actualType := reflect.TypeOf(actual) - if actualType.Kind() != reflect.Func { - return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1)) - } - if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) { - return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1)) - } - - success = false - defer func() { - if e := recover(); e != nil { - matcher.object = e - success = true - } - }() - - reflect.ValueOf(actual).Call([]reflect.Value{}) - - return -} - -func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { - return format.Message(actual, "to panic") -} - -func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1))) -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type PanicMatcher struct { + object interface{} +} + +func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { + if actual == nil { + return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") + } + + actualType := reflect.TypeOf(actual) + if actualType.Kind() != reflect.Func { + return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1)) + } + if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) { + return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1)) + } + + success = false + defer func() { + if e := recover(); e != nil { + matcher.object = e + success = true + } + }() + + reflect.ValueOf(actual).Call([]reflect.Value{}) + + return +} + +func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { + return format.Message(actual, "to panic") +} + +func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1))) +} diff --git a/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go index 457e84fa1f..6b859a7e82 100644 --- a/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go @@ -1,45 +1,45 @@ -package matchers_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("Panic", func() { - Context("when passed something that's not a function that takes zero arguments and returns nothing", func() { - It("should error", func() { - success, err := (&PanicMatcher{}).Match("foo") - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&PanicMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&PanicMatcher{}).Match(func(foo string) {}) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&PanicMatcher{}).Match(func() string { return "bar" }) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when passed a function of the correct type", func() { - It("should call the function and pass if the function panics", func() { - Ω(func() { panic("ack!") }).Should(Panic()) - Ω(func() {}).ShouldNot(Panic()) - }) - }) - - Context("when assertion fails", func() { - It("should print the object passed to Panic", func() { - failuresMessages := InterceptGomegaFailures(func() { - Ω(func() { panic("ack!") }).ShouldNot(Panic()) - }) - Ω(failuresMessages).Should(ConsistOf(MatchRegexp("not to panic, but panicked with\\s*: ack!"))) - }) - }) -}) +package matchers_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("Panic", func() { + Context("when passed something that's not a function that takes zero arguments and returns nothing", func() { + It("should error", func() { + success, err := (&PanicMatcher{}).Match("foo") + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&PanicMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&PanicMatcher{}).Match(func(foo string) {}) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&PanicMatcher{}).Match(func() string { return "bar" }) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when passed a function of the correct type", func() { + It("should call the function and pass if the function panics", func() { + Ω(func() { panic("ack!") }).Should(Panic()) + Ω(func() {}).ShouldNot(Panic()) + }) + }) + + Context("when assertion fails", func() { + It("should print the object passed to Panic", func() { + failuresMessages := InterceptGomegaFailures(func() { + Ω(func() { panic("ack!") }).ShouldNot(Panic()) + }) + Ω(failuresMessages).Should(ConsistOf(MatchRegexp("not to panic, but panicked with\\s*: ack!"))) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go index 8b916035ad..7a8c2cda51 100644 --- a/vendor/github.com/onsi/gomega/matchers/receive_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/receive_matcher.go @@ -1,126 +1,126 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/format" -) - -type ReceiveMatcher struct { - Arg interface{} - receivedValue reflect.Value - channelClosed bool -} - -func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err error) { - if !isChan(actual) { - return false, fmt.Errorf("ReceiveMatcher expects a channel. Got:\n%s", format.Object(actual, 1)) - } - - channelType := reflect.TypeOf(actual) - channelValue := reflect.ValueOf(actual) - - if channelType.ChanDir() == reflect.SendDir { - return false, fmt.Errorf("ReceiveMatcher matcher cannot be passed a send-only channel. Got:\n%s", format.Object(actual, 1)) - } - - var subMatcher omegaMatcher - var hasSubMatcher bool - - if matcher.Arg != nil { - subMatcher, hasSubMatcher = (matcher.Arg).(omegaMatcher) - if !hasSubMatcher { - argType := reflect.TypeOf(matcher.Arg) - if argType.Kind() != reflect.Ptr { - return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(matcher.Arg, 1)) - } - - assignable := channelType.Elem().AssignableTo(argType.Elem()) - if !assignable { - return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(matcher.Arg, 1)) - } - } - } - - winnerIndex, value, open := reflect.Select([]reflect.SelectCase{ - reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, - reflect.SelectCase{Dir: reflect.SelectDefault}, - }) - - var closed bool - var didReceive bool - if winnerIndex == 0 { - closed = !open - didReceive = open - } - matcher.channelClosed = closed - - if closed { - return false, nil - } - - if hasSubMatcher { - if didReceive { - matcher.receivedValue = value - return subMatcher.Match(matcher.receivedValue.Interface()) - } else { - return false, nil - } - } - - if didReceive { - if matcher.Arg != nil { - outValue := reflect.ValueOf(matcher.Arg) - reflect.Indirect(outValue).Set(value) - } - - return true, nil - } else { - return false, nil - } -} - -func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) { - subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) - - closedAddendum := "" - if matcher.channelClosed { - closedAddendum = " The channel is closed." - } - - if hasSubMatcher { - if matcher.receivedValue.IsValid() { - return subMatcher.FailureMessage(matcher.receivedValue.Interface()) - } - return "When passed a matcher, ReceiveMatcher's channel *must* receive something." - } else { - return format.Message(actual, "to receive something."+closedAddendum) - } -} - -func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) { - subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) - - closedAddendum := "" - if matcher.channelClosed { - closedAddendum = " The channel is closed." - } - - if hasSubMatcher { - if matcher.receivedValue.IsValid() { - return subMatcher.NegatedFailureMessage(matcher.receivedValue.Interface()) - } - return "When passed a matcher, ReceiveMatcher's channel *must* receive something." - } else { - return format.Message(actual, "not to receive anything."+closedAddendum) - } -} - -func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { - if !isChan(actual) { - return false - } - - return !matcher.channelClosed -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/format" +) + +type ReceiveMatcher struct { + Arg interface{} + receivedValue reflect.Value + channelClosed bool +} + +func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err error) { + if !isChan(actual) { + return false, fmt.Errorf("ReceiveMatcher expects a channel. Got:\n%s", format.Object(actual, 1)) + } + + channelType := reflect.TypeOf(actual) + channelValue := reflect.ValueOf(actual) + + if channelType.ChanDir() == reflect.SendDir { + return false, fmt.Errorf("ReceiveMatcher matcher cannot be passed a send-only channel. Got:\n%s", format.Object(actual, 1)) + } + + var subMatcher omegaMatcher + var hasSubMatcher bool + + if matcher.Arg != nil { + subMatcher, hasSubMatcher = (matcher.Arg).(omegaMatcher) + if !hasSubMatcher { + argType := reflect.TypeOf(matcher.Arg) + if argType.Kind() != reflect.Ptr { + return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(matcher.Arg, 1)) + } + + assignable := channelType.Elem().AssignableTo(argType.Elem()) + if !assignable { + return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(matcher.Arg, 1)) + } + } + } + + winnerIndex, value, open := reflect.Select([]reflect.SelectCase{ + reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, + reflect.SelectCase{Dir: reflect.SelectDefault}, + }) + + var closed bool + var didReceive bool + if winnerIndex == 0 { + closed = !open + didReceive = open + } + matcher.channelClosed = closed + + if closed { + return false, nil + } + + if hasSubMatcher { + if didReceive { + matcher.receivedValue = value + return subMatcher.Match(matcher.receivedValue.Interface()) + } else { + return false, nil + } + } + + if didReceive { + if matcher.Arg != nil { + outValue := reflect.ValueOf(matcher.Arg) + reflect.Indirect(outValue).Set(value) + } + + return true, nil + } else { + return false, nil + } +} + +func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) { + subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) + + closedAddendum := "" + if matcher.channelClosed { + closedAddendum = " The channel is closed." + } + + if hasSubMatcher { + if matcher.receivedValue.IsValid() { + return subMatcher.FailureMessage(matcher.receivedValue.Interface()) + } + return "When passed a matcher, ReceiveMatcher's channel *must* receive something." + } else { + return format.Message(actual, "to receive something."+closedAddendum) + } +} + +func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) { + subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher) + + closedAddendum := "" + if matcher.channelClosed { + closedAddendum = " The channel is closed." + } + + if hasSubMatcher { + if matcher.receivedValue.IsValid() { + return subMatcher.NegatedFailureMessage(matcher.receivedValue.Interface()) + } + return "When passed a matcher, ReceiveMatcher's channel *must* receive something." + } else { + return format.Message(actual, "not to receive anything."+closedAddendum) + } +} + +func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual interface{}) bool { + if !isChan(actual) { + return false + } + + return !matcher.channelClosed +} diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go index 96d27c7d1c..938c078e6f 100644 --- a/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go @@ -1,280 +1,280 @@ -package matchers_test - -import ( - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -type kungFuActor interface { - DrunkenMaster() bool -} - -type jackie struct { - name string -} - -func (j *jackie) DrunkenMaster() bool { - return true -} - -var _ = Describe("ReceiveMatcher", func() { - Context("with no argument", func() { - Context("for a buffered channel", func() { - It("should succeed", func() { - channel := make(chan bool, 1) - - Ω(channel).ShouldNot(Receive()) - - channel <- true - - Ω(channel).Should(Receive()) - }) - }) - - Context("for an unbuffered channel", func() { - It("should succeed (eventually)", func() { - channel := make(chan bool) - - Ω(channel).ShouldNot(Receive()) - - go func() { - time.Sleep(10 * time.Millisecond) - channel <- true - }() - - Eventually(channel).Should(Receive()) - }) - }) - }) - - Context("with a pointer argument", func() { - Context("of the correct type", func() { - It("should write the value received on the channel to the pointer", func() { - channel := make(chan int, 1) - - var value int - - Ω(channel).ShouldNot(Receive(&value)) - Ω(value).Should(BeZero()) - - channel <- 17 - - Ω(channel).Should(Receive(&value)) - Ω(value).Should(Equal(17)) - }) - }) - - Context("to various types of objects", func() { - It("should work", func() { - //channels of strings - stringChan := make(chan string, 1) - stringChan <- "foo" - - var s string - Ω(stringChan).Should(Receive(&s)) - Ω(s).Should(Equal("foo")) - - //channels of slices - sliceChan := make(chan []bool, 1) - sliceChan <- []bool{true, true, false} - - var sl []bool - Ω(sliceChan).Should(Receive(&sl)) - Ω(sl).Should(Equal([]bool{true, true, false})) - - //channels of channels - chanChan := make(chan chan bool, 1) - c := make(chan bool) - chanChan <- c - - var receivedC chan bool - Ω(chanChan).Should(Receive(&receivedC)) - Ω(receivedC).Should(Equal(c)) - - //channels of interfaces - jackieChan := make(chan kungFuActor, 1) - aJackie := &jackie{name: "Jackie Chan"} - jackieChan <- aJackie - - var theJackie kungFuActor - Ω(jackieChan).Should(Receive(&theJackie)) - Ω(theJackie).Should(Equal(aJackie)) - }) - }) - - Context("of the wrong type", func() { - It("should error", func() { - channel := make(chan int) - var incorrectType bool - - success, err := (&ReceiveMatcher{Arg: &incorrectType}).Match(channel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - var notAPointer int - success, err = (&ReceiveMatcher{Arg: notAPointer}).Match(channel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - }) - - Context("with a matcher", func() { - It("should defer to the underlying matcher", func() { - intChannel := make(chan int, 1) - intChannel <- 3 - Ω(intChannel).Should(Receive(Equal(3))) - - intChannel <- 2 - Ω(intChannel).ShouldNot(Receive(Equal(3))) - - stringChannel := make(chan []string, 1) - stringChannel <- []string{"foo", "bar", "baz"} - Ω(stringChannel).Should(Receive(ContainElement(ContainSubstring("fo")))) - - stringChannel <- []string{"foo", "bar", "baz"} - Ω(stringChannel).ShouldNot(Receive(ContainElement(ContainSubstring("archipelago")))) - }) - - It("should defer to the underlying matcher for the message", func() { - matcher := Receive(Equal(3)) - channel := make(chan int, 1) - channel <- 2 - matcher.Match(channel) - Ω(matcher.FailureMessage(channel)).Should(MatchRegexp(`Expected\s+: 2\s+to equal\s+: 3`)) - - channel <- 3 - matcher.Match(channel) - Ω(matcher.NegatedFailureMessage(channel)).Should(MatchRegexp(`Expected\s+: 3\s+not to equal\s+: 3`)) - }) - - It("should work just fine with Eventually", func() { - stringChannel := make(chan string) - - go func() { - time.Sleep(5 * time.Millisecond) - stringChannel <- "A" - time.Sleep(5 * time.Millisecond) - stringChannel <- "B" - }() - - Eventually(stringChannel).Should(Receive(Equal("B"))) - }) - - Context("if the matcher errors", func() { - It("should error", func() { - channel := make(chan int, 1) - channel <- 3 - success, err := (&ReceiveMatcher{Arg: ContainSubstring("three")}).Match(channel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("if nothing is received", func() { - It("should fail", func() { - channel := make(chan int, 1) - success, err := (&ReceiveMatcher{Arg: Equal(1)}).Match(channel) - Ω(success).Should(BeFalse()) - Ω(err).ShouldNot(HaveOccurred()) - }) - }) - }) - - Context("When actual is a *closed* channel", func() { - Context("for a buffered channel", func() { - It("should work until it hits the end of the buffer", func() { - channel := make(chan bool, 1) - channel <- true - - close(channel) - - Ω(channel).Should(Receive()) - Ω(channel).ShouldNot(Receive()) - }) - }) - - Context("for an unbuffered channel", func() { - It("should always fail", func() { - channel := make(chan bool) - close(channel) - - Ω(channel).ShouldNot(Receive()) - }) - }) - }) - - Context("When actual is a send-only channel", func() { - It("should error", func() { - channel := make(chan bool) - - var writerChannel chan<- bool - writerChannel = channel - - success, err := (&ReceiveMatcher{}).Match(writerChannel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Context("when acutal is a non-channel", func() { - It("should error", func() { - var nilChannel chan bool - - success, err := (&ReceiveMatcher{}).Match(nilChannel) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&ReceiveMatcher{}).Match(nil) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - - success, err = (&ReceiveMatcher{}).Match(3) - Ω(success).Should(BeFalse()) - Ω(err).Should(HaveOccurred()) - }) - }) - - Describe("when used with eventually and a custom matcher", func() { - It("should return the matcher's error when a failing value is received on the channel, instead of the must receive something failure", func() { - failures := InterceptGomegaFailures(func() { - c := make(chan string, 0) - Eventually(c, 0.01).Should(Receive(Equal("hello"))) - }) - Ω(failures[0]).Should(ContainSubstring("When passed a matcher, ReceiveMatcher's channel *must* receive something.")) - - failures = InterceptGomegaFailures(func() { - c := make(chan string, 1) - c <- "hi" - Eventually(c, 0.01).Should(Receive(Equal("hello"))) - }) - Ω(failures[0]).Should(ContainSubstring(": hello")) - }) - }) - - Describe("Bailing early", func() { - It("should bail early when passed a closed channel", func() { - c := make(chan bool) - close(c) - - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(c).Should(Receive()) - }) - Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) - Ω(failures).Should(HaveLen(1)) - }) - - It("should bail early when passed a non-channel", func() { - t := time.Now() - failures := InterceptGomegaFailures(func() { - Eventually(3).Should(Receive()) - }) - Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) - Ω(failures).Should(HaveLen(1)) - }) - }) -}) +package matchers_test + +import ( + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +type kungFuActor interface { + DrunkenMaster() bool +} + +type jackie struct { + name string +} + +func (j *jackie) DrunkenMaster() bool { + return true +} + +var _ = Describe("ReceiveMatcher", func() { + Context("with no argument", func() { + Context("for a buffered channel", func() { + It("should succeed", func() { + channel := make(chan bool, 1) + + Ω(channel).ShouldNot(Receive()) + + channel <- true + + Ω(channel).Should(Receive()) + }) + }) + + Context("for an unbuffered channel", func() { + It("should succeed (eventually)", func() { + channel := make(chan bool) + + Ω(channel).ShouldNot(Receive()) + + go func() { + time.Sleep(10 * time.Millisecond) + channel <- true + }() + + Eventually(channel).Should(Receive()) + }) + }) + }) + + Context("with a pointer argument", func() { + Context("of the correct type", func() { + It("should write the value received on the channel to the pointer", func() { + channel := make(chan int, 1) + + var value int + + Ω(channel).ShouldNot(Receive(&value)) + Ω(value).Should(BeZero()) + + channel <- 17 + + Ω(channel).Should(Receive(&value)) + Ω(value).Should(Equal(17)) + }) + }) + + Context("to various types of objects", func() { + It("should work", func() { + //channels of strings + stringChan := make(chan string, 1) + stringChan <- "foo" + + var s string + Ω(stringChan).Should(Receive(&s)) + Ω(s).Should(Equal("foo")) + + //channels of slices + sliceChan := make(chan []bool, 1) + sliceChan <- []bool{true, true, false} + + var sl []bool + Ω(sliceChan).Should(Receive(&sl)) + Ω(sl).Should(Equal([]bool{true, true, false})) + + //channels of channels + chanChan := make(chan chan bool, 1) + c := make(chan bool) + chanChan <- c + + var receivedC chan bool + Ω(chanChan).Should(Receive(&receivedC)) + Ω(receivedC).Should(Equal(c)) + + //channels of interfaces + jackieChan := make(chan kungFuActor, 1) + aJackie := &jackie{name: "Jackie Chan"} + jackieChan <- aJackie + + var theJackie kungFuActor + Ω(jackieChan).Should(Receive(&theJackie)) + Ω(theJackie).Should(Equal(aJackie)) + }) + }) + + Context("of the wrong type", func() { + It("should error", func() { + channel := make(chan int) + var incorrectType bool + + success, err := (&ReceiveMatcher{Arg: &incorrectType}).Match(channel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + var notAPointer int + success, err = (&ReceiveMatcher{Arg: notAPointer}).Match(channel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + }) + + Context("with a matcher", func() { + It("should defer to the underlying matcher", func() { + intChannel := make(chan int, 1) + intChannel <- 3 + Ω(intChannel).Should(Receive(Equal(3))) + + intChannel <- 2 + Ω(intChannel).ShouldNot(Receive(Equal(3))) + + stringChannel := make(chan []string, 1) + stringChannel <- []string{"foo", "bar", "baz"} + Ω(stringChannel).Should(Receive(ContainElement(ContainSubstring("fo")))) + + stringChannel <- []string{"foo", "bar", "baz"} + Ω(stringChannel).ShouldNot(Receive(ContainElement(ContainSubstring("archipelago")))) + }) + + It("should defer to the underlying matcher for the message", func() { + matcher := Receive(Equal(3)) + channel := make(chan int, 1) + channel <- 2 + matcher.Match(channel) + Ω(matcher.FailureMessage(channel)).Should(MatchRegexp(`Expected\s+: 2\s+to equal\s+: 3`)) + + channel <- 3 + matcher.Match(channel) + Ω(matcher.NegatedFailureMessage(channel)).Should(MatchRegexp(`Expected\s+: 3\s+not to equal\s+: 3`)) + }) + + It("should work just fine with Eventually", func() { + stringChannel := make(chan string) + + go func() { + time.Sleep(5 * time.Millisecond) + stringChannel <- "A" + time.Sleep(5 * time.Millisecond) + stringChannel <- "B" + }() + + Eventually(stringChannel).Should(Receive(Equal("B"))) + }) + + Context("if the matcher errors", func() { + It("should error", func() { + channel := make(chan int, 1) + channel <- 3 + success, err := (&ReceiveMatcher{Arg: ContainSubstring("three")}).Match(channel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("if nothing is received", func() { + It("should fail", func() { + channel := make(chan int, 1) + success, err := (&ReceiveMatcher{Arg: Equal(1)}).Match(channel) + Ω(success).Should(BeFalse()) + Ω(err).ShouldNot(HaveOccurred()) + }) + }) + }) + + Context("When actual is a *closed* channel", func() { + Context("for a buffered channel", func() { + It("should work until it hits the end of the buffer", func() { + channel := make(chan bool, 1) + channel <- true + + close(channel) + + Ω(channel).Should(Receive()) + Ω(channel).ShouldNot(Receive()) + }) + }) + + Context("for an unbuffered channel", func() { + It("should always fail", func() { + channel := make(chan bool) + close(channel) + + Ω(channel).ShouldNot(Receive()) + }) + }) + }) + + Context("When actual is a send-only channel", func() { + It("should error", func() { + channel := make(chan bool) + + var writerChannel chan<- bool + writerChannel = channel + + success, err := (&ReceiveMatcher{}).Match(writerChannel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Context("when acutal is a non-channel", func() { + It("should error", func() { + var nilChannel chan bool + + success, err := (&ReceiveMatcher{}).Match(nilChannel) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&ReceiveMatcher{}).Match(nil) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + + success, err = (&ReceiveMatcher{}).Match(3) + Ω(success).Should(BeFalse()) + Ω(err).Should(HaveOccurred()) + }) + }) + + Describe("when used with eventually and a custom matcher", func() { + It("should return the matcher's error when a failing value is received on the channel, instead of the must receive something failure", func() { + failures := InterceptGomegaFailures(func() { + c := make(chan string, 0) + Eventually(c, 0.01).Should(Receive(Equal("hello"))) + }) + Ω(failures[0]).Should(ContainSubstring("When passed a matcher, ReceiveMatcher's channel *must* receive something.")) + + failures = InterceptGomegaFailures(func() { + c := make(chan string, 1) + c <- "hi" + Eventually(c, 0.01).Should(Receive(Equal("hello"))) + }) + Ω(failures[0]).Should(ContainSubstring(": hello")) + }) + }) + + Describe("Bailing early", func() { + It("should bail early when passed a closed channel", func() { + c := make(chan bool) + close(c) + + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(c).Should(Receive()) + }) + Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) + Ω(failures).Should(HaveLen(1)) + }) + + It("should bail early when passed a non-channel", func() { + t := time.Now() + failures := InterceptGomegaFailures(func() { + Eventually(3).Should(Receive()) + }) + Ω(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond)) + Ω(failures).Should(HaveLen(1)) + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go index e7bbf8e990..721ed5529b 100644 --- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/succeed_matcher.go @@ -1,33 +1,33 @@ -package matchers - -import ( - "fmt" - - "github.com/onsi/gomega/format" -) - -type SucceedMatcher struct { -} - -func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) { - // is purely nil? - if actual == nil { - return true, nil - } - - // must be an 'error' type - if !isError(actual) { - return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) - } - - // must be nil (or a pointer to a nil) - return isNil(actual), nil -} - -func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1)) -} - -func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return "Expected failure, but got no error." -} +package matchers + +import ( + "fmt" + + "github.com/onsi/gomega/format" +) + +type SucceedMatcher struct { +} + +func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) { + // is purely nil? + if actual == nil { + return true, nil + } + + // must be an 'error' type + if !isError(actual) { + return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) + } + + // must be nil (or a pointer to a nil) + return isNil(actual), nil +} + +func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { + return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1)) +} + +func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { + return "Expected failure, but got no error." +} diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go index 6a1cf4bc0e..6b62c8bb26 100644 --- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go +++ b/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go @@ -1,62 +1,62 @@ -package matchers_test - -import ( - "errors" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -func Erroring() error { - return errors.New("bam") -} - -func NotErroring() error { - return nil -} - -type AnyType struct{} - -func Invalid() *AnyType { - return nil -} - -var _ = Describe("Succeed", func() { - It("should succeed if the function succeeds", func() { - Ω(NotErroring()).Should(Succeed()) - }) - - It("should succeed (in the negated) if the function errored", func() { - Ω(Erroring()).ShouldNot(Succeed()) - }) - - It("should not if passed a non-error", func() { - success, err := (&SucceedMatcher{}).Match(Invalid()) - Ω(success).Should(BeFalse()) - Ω(err).Should(MatchError("Expected an error-type. Got:\n <*matchers_test.AnyType | 0x0>: nil")) - }) - - It("doesn't support non-error type", func() { - success, err := (&SucceedMatcher{}).Match(AnyType{}) - Ω(success).Should(BeFalse()) - Ω(err).Should(MatchError("Expected an error-type. Got:\n : {}")) - }) - - It("doesn't support non-error pointer type", func() { - success, err := (&SucceedMatcher{}).Match(&AnyType{}) - Ω(success).Should(BeFalse()) - Ω(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`))) - }) - - It("should not succeed with pointer types that conform to error interface", func() { - err := &CustomErr{"ohai"} - Ω(err).ShouldNot(Succeed()) - }) - - It("should succeed with nil pointers to types that conform to error interface", func() { - var err *CustomErr = nil - Ω(err).Should(Succeed()) - }) - -}) +package matchers_test + +import ( + "errors" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +func Erroring() error { + return errors.New("bam") +} + +func NotErroring() error { + return nil +} + +type AnyType struct{} + +func Invalid() *AnyType { + return nil +} + +var _ = Describe("Succeed", func() { + It("should succeed if the function succeeds", func() { + Ω(NotErroring()).Should(Succeed()) + }) + + It("should succeed (in the negated) if the function errored", func() { + Ω(Erroring()).ShouldNot(Succeed()) + }) + + It("should not if passed a non-error", func() { + success, err := (&SucceedMatcher{}).Match(Invalid()) + Ω(success).Should(BeFalse()) + Ω(err).Should(MatchError("Expected an error-type. Got:\n <*matchers_test.AnyType | 0x0>: nil")) + }) + + It("doesn't support non-error type", func() { + success, err := (&SucceedMatcher{}).Match(AnyType{}) + Ω(success).Should(BeFalse()) + Ω(err).Should(MatchError("Expected an error-type. Got:\n : {}")) + }) + + It("doesn't support non-error pointer type", func() { + success, err := (&SucceedMatcher{}).Match(&AnyType{}) + Ω(success).Should(BeFalse()) + Ω(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`))) + }) + + It("should not succeed with pointer types that conform to error interface", func() { + err := &CustomErr{"ohai"} + Ω(err).ShouldNot(Succeed()) + }) + + It("should succeed with nil pointers to types that conform to error interface", func() { + var err *CustomErr = nil + Ω(err).Should(Succeed()) + }) + +}) diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE b/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE index df76b2a1c0..8edd8175ab 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE @@ -1,20 +1,20 @@ -Copyright (c) 2014 Amit Kumar Gupta - -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) 2014 Amit Kumar Gupta + +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/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go index 16b758f7c2..119d21ef31 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go @@ -1,41 +1,41 @@ -package bipartitegraph - -import "errors" -import "fmt" - -import . "github.com/onsi/gomega/matchers/support/goraph/node" -import . "github.com/onsi/gomega/matchers/support/goraph/edge" - -type BipartiteGraph struct { - Left NodeOrderedSet - Right NodeOrderedSet - Edges EdgeSet -} - -func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { - left := NodeOrderedSet{} - for i, _ := range leftValues { - left = append(left, Node{i}) - } - - right := NodeOrderedSet{} - for j, _ := range rightValues { - right = append(right, Node{j + len(left)}) - } - - edges := EdgeSet{} - for i, leftValue := range leftValues { - for j, rightValue := range rightValues { - neighbours, err := neighbours(leftValue, rightValue) - if err != nil { - return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error())) - } - - if neighbours { - edges = append(edges, Edge{left[i], right[j]}) - } - } - } - - return &BipartiteGraph{left, right, edges}, nil -} +package bipartitegraph + +import "errors" +import "fmt" + +import . "github.com/onsi/gomega/matchers/support/goraph/node" +import . "github.com/onsi/gomega/matchers/support/goraph/edge" + +type BipartiteGraph struct { + Left NodeOrderedSet + Right NodeOrderedSet + Edges EdgeSet +} + +func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { + left := NodeOrderedSet{} + for i, _ := range leftValues { + left = append(left, Node{i}) + } + + right := NodeOrderedSet{} + for j, _ := range rightValues { + right = append(right, Node{j + len(left)}) + } + + edges := EdgeSet{} + for i, leftValue := range leftValues { + for j, rightValue := range rightValues { + neighbours, err := neighbours(leftValue, rightValue) + if err != nil { + return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error())) + } + + if neighbours { + edges = append(edges, Edge{left[i], right[j]}) + } + } + } + + return &BipartiteGraph{left, right, edges}, nil +} diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go index 575947b415..32529c5113 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go @@ -1,161 +1,161 @@ -package bipartitegraph - -import . "github.com/onsi/gomega/matchers/support/goraph/node" -import . "github.com/onsi/gomega/matchers/support/goraph/edge" -import "github.com/onsi/gomega/matchers/support/goraph/util" - -func (bg *BipartiteGraph) LargestMatching() (matching EdgeSet) { - paths := bg.maximalDisjointSLAPCollection(matching) - - for len(paths) > 0 { - for _, path := range paths { - matching = matching.SymmetricDifference(path) - } - paths = bg.maximalDisjointSLAPCollection(matching) - } - - return -} - -func (bg *BipartiteGraph) maximalDisjointSLAPCollection(matching EdgeSet) (result []EdgeSet) { - guideLayers := bg.createSLAPGuideLayers(matching) - if len(guideLayers) == 0 { - return - } - - used := make(map[Node]bool) - - for _, u := range guideLayers[len(guideLayers)-1] { - slap, found := bg.findDisjointSLAP(u, matching, guideLayers, used) - if found { - for _, edge := range slap { - used[edge.Node1] = true - used[edge.Node2] = true - } - result = append(result, slap) - } - } - - return -} - -func (bg *BipartiteGraph) findDisjointSLAP( - start Node, - matching EdgeSet, - guideLayers []NodeOrderedSet, - used map[Node]bool, -) ([]Edge, bool) { - return bg.findDisjointSLAPHelper(start, EdgeSet{}, len(guideLayers)-1, matching, guideLayers, used) -} - -func (bg *BipartiteGraph) findDisjointSLAPHelper( - currentNode Node, - currentSLAP EdgeSet, - currentLevel int, - matching EdgeSet, - guideLayers []NodeOrderedSet, - used map[Node]bool, -) (EdgeSet, bool) { - used[currentNode] = true - - if currentLevel == 0 { - return currentSLAP, true - } - - for _, nextNode := range guideLayers[currentLevel-1] { - if used[nextNode] { - continue - } - - edge, found := bg.Edges.FindByNodes(currentNode, nextNode) - if !found { - continue - } - - if matching.Contains(edge) == util.Odd(currentLevel) { - continue - } - - currentSLAP = append(currentSLAP, edge) - slap, found := bg.findDisjointSLAPHelper(nextNode, currentSLAP, currentLevel-1, matching, guideLayers, used) - if found { - return slap, true - } - currentSLAP = currentSLAP[:len(currentSLAP)-1] - } - - used[currentNode] = false - return nil, false -} - -func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers []NodeOrderedSet) { - used := make(map[Node]bool) - currentLayer := NodeOrderedSet{} - - for _, node := range bg.Left { - if matching.Free(node) { - used[node] = true - currentLayer = append(currentLayer, node) - } - } - - if len(currentLayer) == 0 { - return []NodeOrderedSet{} - } else { - guideLayers = append(guideLayers, currentLayer) - } - - done := false - - for !done { - lastLayer := currentLayer - currentLayer = NodeOrderedSet{} - - if util.Odd(len(guideLayers)) { - for _, leftNode := range lastLayer { - for _, rightNode := range bg.Right { - if used[rightNode] { - continue - } - - edge, found := bg.Edges.FindByNodes(leftNode, rightNode) - if !found || matching.Contains(edge) { - continue - } - - currentLayer = append(currentLayer, rightNode) - used[rightNode] = true - - if matching.Free(rightNode) { - done = true - } - } - } - } else { - for _, rightNode := range lastLayer { - for _, leftNode := range bg.Left { - if used[leftNode] { - continue - } - - edge, found := bg.Edges.FindByNodes(leftNode, rightNode) - if !found || !matching.Contains(edge) { - continue - } - - currentLayer = append(currentLayer, leftNode) - used[leftNode] = true - } - } - - } - - if len(currentLayer) == 0 { - return []NodeOrderedSet{} - } else { - guideLayers = append(guideLayers, currentLayer) - } - } - - return -} +package bipartitegraph + +import . "github.com/onsi/gomega/matchers/support/goraph/node" +import . "github.com/onsi/gomega/matchers/support/goraph/edge" +import "github.com/onsi/gomega/matchers/support/goraph/util" + +func (bg *BipartiteGraph) LargestMatching() (matching EdgeSet) { + paths := bg.maximalDisjointSLAPCollection(matching) + + for len(paths) > 0 { + for _, path := range paths { + matching = matching.SymmetricDifference(path) + } + paths = bg.maximalDisjointSLAPCollection(matching) + } + + return +} + +func (bg *BipartiteGraph) maximalDisjointSLAPCollection(matching EdgeSet) (result []EdgeSet) { + guideLayers := bg.createSLAPGuideLayers(matching) + if len(guideLayers) == 0 { + return + } + + used := make(map[Node]bool) + + for _, u := range guideLayers[len(guideLayers)-1] { + slap, found := bg.findDisjointSLAP(u, matching, guideLayers, used) + if found { + for _, edge := range slap { + used[edge.Node1] = true + used[edge.Node2] = true + } + result = append(result, slap) + } + } + + return +} + +func (bg *BipartiteGraph) findDisjointSLAP( + start Node, + matching EdgeSet, + guideLayers []NodeOrderedSet, + used map[Node]bool, +) ([]Edge, bool) { + return bg.findDisjointSLAPHelper(start, EdgeSet{}, len(guideLayers)-1, matching, guideLayers, used) +} + +func (bg *BipartiteGraph) findDisjointSLAPHelper( + currentNode Node, + currentSLAP EdgeSet, + currentLevel int, + matching EdgeSet, + guideLayers []NodeOrderedSet, + used map[Node]bool, +) (EdgeSet, bool) { + used[currentNode] = true + + if currentLevel == 0 { + return currentSLAP, true + } + + for _, nextNode := range guideLayers[currentLevel-1] { + if used[nextNode] { + continue + } + + edge, found := bg.Edges.FindByNodes(currentNode, nextNode) + if !found { + continue + } + + if matching.Contains(edge) == util.Odd(currentLevel) { + continue + } + + currentSLAP = append(currentSLAP, edge) + slap, found := bg.findDisjointSLAPHelper(nextNode, currentSLAP, currentLevel-1, matching, guideLayers, used) + if found { + return slap, true + } + currentSLAP = currentSLAP[:len(currentSLAP)-1] + } + + used[currentNode] = false + return nil, false +} + +func (bg *BipartiteGraph) createSLAPGuideLayers(matching EdgeSet) (guideLayers []NodeOrderedSet) { + used := make(map[Node]bool) + currentLayer := NodeOrderedSet{} + + for _, node := range bg.Left { + if matching.Free(node) { + used[node] = true + currentLayer = append(currentLayer, node) + } + } + + if len(currentLayer) == 0 { + return []NodeOrderedSet{} + } else { + guideLayers = append(guideLayers, currentLayer) + } + + done := false + + for !done { + lastLayer := currentLayer + currentLayer = NodeOrderedSet{} + + if util.Odd(len(guideLayers)) { + for _, leftNode := range lastLayer { + for _, rightNode := range bg.Right { + if used[rightNode] { + continue + } + + edge, found := bg.Edges.FindByNodes(leftNode, rightNode) + if !found || matching.Contains(edge) { + continue + } + + currentLayer = append(currentLayer, rightNode) + used[rightNode] = true + + if matching.Free(rightNode) { + done = true + } + } + } + } else { + for _, rightNode := range lastLayer { + for _, leftNode := range bg.Left { + if used[leftNode] { + continue + } + + edge, found := bg.Edges.FindByNodes(leftNode, rightNode) + if !found || !matching.Contains(edge) { + continue + } + + currentLayer = append(currentLayer, leftNode) + used[leftNode] = true + } + } + + } + + if len(currentLayer) == 0 { + return []NodeOrderedSet{} + } else { + guideLayers = append(guideLayers, currentLayer) + } + } + + return +} diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go index c166f05dd1..4fd15cc069 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go @@ -1,61 +1,61 @@ -package edge - -import . "github.com/onsi/gomega/matchers/support/goraph/node" - -type Edge struct { - Node1 Node - Node2 Node -} - -type EdgeSet []Edge - -func (ec EdgeSet) Free(node Node) bool { - for _, e := range ec { - if e.Node1 == node || e.Node2 == node { - return false - } - } - - return true -} - -func (ec EdgeSet) Contains(edge Edge) bool { - for _, e := range ec { - if e == edge { - return true - } - } - - return false -} - -func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { - for _, e := range ec { - if (e.Node1 == node1 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) { - return e, true - } - } - - return Edge{}, false -} - -func (ec EdgeSet) SymmetricDifference(ec2 EdgeSet) EdgeSet { - edgesToInclude := make(map[Edge]bool) - - for _, e := range ec { - edgesToInclude[e] = true - } - - for _, e := range ec2 { - edgesToInclude[e] = !edgesToInclude[e] - } - - result := EdgeSet{} - for e, include := range edgesToInclude { - if include { - result = append(result, e) - } - } - - return result -} +package edge + +import . "github.com/onsi/gomega/matchers/support/goraph/node" + +type Edge struct { + Node1 Node + Node2 Node +} + +type EdgeSet []Edge + +func (ec EdgeSet) Free(node Node) bool { + for _, e := range ec { + if e.Node1 == node || e.Node2 == node { + return false + } + } + + return true +} + +func (ec EdgeSet) Contains(edge Edge) bool { + for _, e := range ec { + if e == edge { + return true + } + } + + return false +} + +func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { + for _, e := range ec { + if (e.Node1 == node1 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) { + return e, true + } + } + + return Edge{}, false +} + +func (ec EdgeSet) SymmetricDifference(ec2 EdgeSet) EdgeSet { + edgesToInclude := make(map[Edge]bool) + + for _, e := range ec { + edgesToInclude[e] = true + } + + for _, e := range ec2 { + edgesToInclude[e] = !edgesToInclude[e] + } + + result := EdgeSet{} + for e, include := range edgesToInclude { + if include { + result = append(result, e) + } + } + + return result +} diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go index b285343ad3..800c2ea8ca 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go @@ -1,7 +1,7 @@ -package node - -type Node struct { - Id int -} - -type NodeOrderedSet []Node +package node + +type Node struct { + Id int +} + +type NodeOrderedSet []Node diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go index b2b19c4179..d76a1ee00a 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go @@ -1,7 +1,7 @@ -package util - -import "math" - -func Odd(n int) bool { - return math.Mod(float64(n), 2.0) == 1.0 -} +package util + +import "math" + +func Odd(n int) bool { + return math.Mod(float64(n), 2.0) == 1.0 +} diff --git a/vendor/github.com/onsi/gomega/matchers/type_support.go b/vendor/github.com/onsi/gomega/matchers/type_support.go index 8dfb50bdcc..04020f004e 100644 --- a/vendor/github.com/onsi/gomega/matchers/type_support.go +++ b/vendor/github.com/onsi/gomega/matchers/type_support.go @@ -1,176 +1,176 @@ -/* -Gomega matchers - -This package implements the Gomega matchers and does not typically need to be imported. -See the docs for Gomega for documentation on the matchers - -http://onsi.github.io/gomega/ -*/ -package matchers - -import ( - "fmt" - "reflect" -) - -type omegaMatcher interface { - Match(actual interface{}) (success bool, err error) - FailureMessage(actual interface{}) (message string) - NegatedFailureMessage(actual interface{}) (message string) -} - -func isBool(a interface{}) bool { - return reflect.TypeOf(a).Kind() == reflect.Bool -} - -func isNumber(a interface{}) bool { - if a == nil { - return false - } - kind := reflect.TypeOf(a).Kind() - return reflect.Int <= kind && kind <= reflect.Float64 -} - -func isInteger(a interface{}) bool { - kind := reflect.TypeOf(a).Kind() - return reflect.Int <= kind && kind <= reflect.Int64 -} - -func isUnsignedInteger(a interface{}) bool { - kind := reflect.TypeOf(a).Kind() - return reflect.Uint <= kind && kind <= reflect.Uint64 -} - -func isFloat(a interface{}) bool { - kind := reflect.TypeOf(a).Kind() - return reflect.Float32 <= kind && kind <= reflect.Float64 -} - -func toInteger(a interface{}) int64 { - if isInteger(a) { - return reflect.ValueOf(a).Int() - } else if isUnsignedInteger(a) { - return int64(reflect.ValueOf(a).Uint()) - } else if isFloat(a) { - return int64(reflect.ValueOf(a).Float()) - } else { - panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) - } -} - -func toUnsignedInteger(a interface{}) uint64 { - if isInteger(a) { - return uint64(reflect.ValueOf(a).Int()) - } else if isUnsignedInteger(a) { - return reflect.ValueOf(a).Uint() - } else if isFloat(a) { - return uint64(reflect.ValueOf(a).Float()) - } else { - panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) - } -} - -func toFloat(a interface{}) float64 { - if isInteger(a) { - return float64(reflect.ValueOf(a).Int()) - } else if isUnsignedInteger(a) { - return float64(reflect.ValueOf(a).Uint()) - } else if isFloat(a) { - return reflect.ValueOf(a).Float() - } else { - panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) - } -} - -func isError(a interface{}) bool { - _, ok := a.(error) - return ok -} - -func isChan(a interface{}) bool { - if isNil(a) { - return false - } - return reflect.TypeOf(a).Kind() == reflect.Chan -} - -func isMap(a interface{}) bool { - if a == nil { - return false - } - return reflect.TypeOf(a).Kind() == reflect.Map -} - -func isArrayOrSlice(a interface{}) bool { - if a == nil { - return false - } - switch reflect.TypeOf(a).Kind() { - case reflect.Array, reflect.Slice: - return true - default: - return false - } -} - -func isString(a interface{}) bool { - if a == nil { - return false - } - return reflect.TypeOf(a).Kind() == reflect.String -} - -func toString(a interface{}) (string, bool) { - aString, isString := a.(string) - if isString { - return aString, true - } - - aBytes, isBytes := a.([]byte) - if isBytes { - return string(aBytes), true - } - - aStringer, isStringer := a.(fmt.Stringer) - if isStringer { - return aStringer.String(), true - } - - return "", false -} - -func lengthOf(a interface{}) (int, bool) { - if a == nil { - return 0, false - } - switch reflect.TypeOf(a).Kind() { - case reflect.Map, reflect.Array, reflect.String, reflect.Chan, reflect.Slice: - return reflect.ValueOf(a).Len(), true - default: - return 0, false - } -} -func capOf(a interface{}) (int, bool) { - if a == nil { - return 0, false - } - switch reflect.TypeOf(a).Kind() { - case reflect.Array, reflect.Chan, reflect.Slice: - return reflect.ValueOf(a).Cap(), true - default: - return 0, false - } -} - -func isNil(a interface{}) bool { - if a == nil { - return true - } - - switch reflect.TypeOf(a).Kind() { - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return reflect.ValueOf(a).IsNil() - } - - return false -} +/* +Gomega matchers + +This package implements the Gomega matchers and does not typically need to be imported. +See the docs for Gomega for documentation on the matchers + +http://onsi.github.io/gomega/ +*/ +package matchers + +import ( + "fmt" + "reflect" +) + +type omegaMatcher interface { + Match(actual interface{}) (success bool, err error) + FailureMessage(actual interface{}) (message string) + NegatedFailureMessage(actual interface{}) (message string) +} + +func isBool(a interface{}) bool { + return reflect.TypeOf(a).Kind() == reflect.Bool +} + +func isNumber(a interface{}) bool { + if a == nil { + return false + } + kind := reflect.TypeOf(a).Kind() + return reflect.Int <= kind && kind <= reflect.Float64 +} + +func isInteger(a interface{}) bool { + kind := reflect.TypeOf(a).Kind() + return reflect.Int <= kind && kind <= reflect.Int64 +} + +func isUnsignedInteger(a interface{}) bool { + kind := reflect.TypeOf(a).Kind() + return reflect.Uint <= kind && kind <= reflect.Uint64 +} + +func isFloat(a interface{}) bool { + kind := reflect.TypeOf(a).Kind() + return reflect.Float32 <= kind && kind <= reflect.Float64 +} + +func toInteger(a interface{}) int64 { + if isInteger(a) { + return reflect.ValueOf(a).Int() + } else if isUnsignedInteger(a) { + return int64(reflect.ValueOf(a).Uint()) + } else if isFloat(a) { + return int64(reflect.ValueOf(a).Float()) + } else { + panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) + } +} + +func toUnsignedInteger(a interface{}) uint64 { + if isInteger(a) { + return uint64(reflect.ValueOf(a).Int()) + } else if isUnsignedInteger(a) { + return reflect.ValueOf(a).Uint() + } else if isFloat(a) { + return uint64(reflect.ValueOf(a).Float()) + } else { + panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) + } +} + +func toFloat(a interface{}) float64 { + if isInteger(a) { + return float64(reflect.ValueOf(a).Int()) + } else if isUnsignedInteger(a) { + return float64(reflect.ValueOf(a).Uint()) + } else if isFloat(a) { + return reflect.ValueOf(a).Float() + } else { + panic(fmt.Sprintf("Expected a number! Got <%T> %#v", a, a)) + } +} + +func isError(a interface{}) bool { + _, ok := a.(error) + return ok +} + +func isChan(a interface{}) bool { + if isNil(a) { + return false + } + return reflect.TypeOf(a).Kind() == reflect.Chan +} + +func isMap(a interface{}) bool { + if a == nil { + return false + } + return reflect.TypeOf(a).Kind() == reflect.Map +} + +func isArrayOrSlice(a interface{}) bool { + if a == nil { + return false + } + switch reflect.TypeOf(a).Kind() { + case reflect.Array, reflect.Slice: + return true + default: + return false + } +} + +func isString(a interface{}) bool { + if a == nil { + return false + } + return reflect.TypeOf(a).Kind() == reflect.String +} + +func toString(a interface{}) (string, bool) { + aString, isString := a.(string) + if isString { + return aString, true + } + + aBytes, isBytes := a.([]byte) + if isBytes { + return string(aBytes), true + } + + aStringer, isStringer := a.(fmt.Stringer) + if isStringer { + return aStringer.String(), true + } + + return "", false +} + +func lengthOf(a interface{}) (int, bool) { + if a == nil { + return 0, false + } + switch reflect.TypeOf(a).Kind() { + case reflect.Map, reflect.Array, reflect.String, reflect.Chan, reflect.Slice: + return reflect.ValueOf(a).Len(), true + default: + return 0, false + } +} +func capOf(a interface{}) (int, bool) { + if a == nil { + return 0, false + } + switch reflect.TypeOf(a).Kind() { + case reflect.Array, reflect.Chan, reflect.Slice: + return reflect.ValueOf(a).Cap(), true + default: + return 0, false + } +} + +func isNil(a interface{}) bool { + if a == nil { + return true + } + + switch reflect.TypeOf(a).Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return reflect.ValueOf(a).IsNil() + } + + return false +} diff --git a/vendor/github.com/onsi/gomega/matchers/with_transform.go b/vendor/github.com/onsi/gomega/matchers/with_transform.go index 8015042ae0..8e58d8a0fb 100644 --- a/vendor/github.com/onsi/gomega/matchers/with_transform.go +++ b/vendor/github.com/onsi/gomega/matchers/with_transform.go @@ -1,72 +1,72 @@ -package matchers - -import ( - "fmt" - "reflect" - - "github.com/onsi/gomega/internal/oraclematcher" - "github.com/onsi/gomega/types" -) - -type WithTransformMatcher struct { - // input - Transform interface{} // must be a function of one parameter that returns one value - Matcher types.GomegaMatcher - - // cached value - transformArgType reflect.Type - - // state - transformedValue interface{} -} - -func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher) *WithTransformMatcher { - if transform == nil { - panic("transform function cannot be nil") - } - txType := reflect.TypeOf(transform) - if txType.NumIn() != 1 { - panic("transform function must have 1 argument") - } - if txType.NumOut() != 1 { - panic("transform function must have 1 return value") - } - - return &WithTransformMatcher{ - Transform: transform, - Matcher: matcher, - transformArgType: reflect.TypeOf(transform).In(0), - } -} - -func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) { - // return error if actual's type is incompatible with Transform function's argument type - actualType := reflect.TypeOf(actual) - if !actualType.AssignableTo(m.transformArgType) { - return false, fmt.Errorf("Transform function expects '%s' but we have '%s'", m.transformArgType, actualType) - } - - // call the Transform function with `actual` - fn := reflect.ValueOf(m.Transform) - result := fn.Call([]reflect.Value{reflect.ValueOf(actual)}) - m.transformedValue = result[0].Interface() // expect exactly one value - - return m.Matcher.Match(m.transformedValue) -} - -func (m *WithTransformMatcher) FailureMessage(_ interface{}) (message string) { - return m.Matcher.FailureMessage(m.transformedValue) -} - -func (m *WithTransformMatcher) NegatedFailureMessage(_ interface{}) (message string) { - return m.Matcher.NegatedFailureMessage(m.transformedValue) -} - -func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool { - // TODO: Maybe this should always just return true? (Only an issue for non-deterministic transformers.) - // - // Querying the next matcher is fine if the transformer always will return the same value. - // But if the transformer is non-deterministic and returns a different value each time, then there - // is no point in querying the next matcher, since it can only comment on the last transformed value. - return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue) -} +package matchers + +import ( + "fmt" + "reflect" + + "github.com/onsi/gomega/internal/oraclematcher" + "github.com/onsi/gomega/types" +) + +type WithTransformMatcher struct { + // input + Transform interface{} // must be a function of one parameter that returns one value + Matcher types.GomegaMatcher + + // cached value + transformArgType reflect.Type + + // state + transformedValue interface{} +} + +func NewWithTransformMatcher(transform interface{}, matcher types.GomegaMatcher) *WithTransformMatcher { + if transform == nil { + panic("transform function cannot be nil") + } + txType := reflect.TypeOf(transform) + if txType.NumIn() != 1 { + panic("transform function must have 1 argument") + } + if txType.NumOut() != 1 { + panic("transform function must have 1 return value") + } + + return &WithTransformMatcher{ + Transform: transform, + Matcher: matcher, + transformArgType: reflect.TypeOf(transform).In(0), + } +} + +func (m *WithTransformMatcher) Match(actual interface{}) (bool, error) { + // return error if actual's type is incompatible with Transform function's argument type + actualType := reflect.TypeOf(actual) + if !actualType.AssignableTo(m.transformArgType) { + return false, fmt.Errorf("Transform function expects '%s' but we have '%s'", m.transformArgType, actualType) + } + + // call the Transform function with `actual` + fn := reflect.ValueOf(m.Transform) + result := fn.Call([]reflect.Value{reflect.ValueOf(actual)}) + m.transformedValue = result[0].Interface() // expect exactly one value + + return m.Matcher.Match(m.transformedValue) +} + +func (m *WithTransformMatcher) FailureMessage(_ interface{}) (message string) { + return m.Matcher.FailureMessage(m.transformedValue) +} + +func (m *WithTransformMatcher) NegatedFailureMessage(_ interface{}) (message string) { + return m.Matcher.NegatedFailureMessage(m.transformedValue) +} + +func (m *WithTransformMatcher) MatchMayChangeInTheFuture(_ interface{}) bool { + // TODO: Maybe this should always just return true? (Only an issue for non-deterministic transformers.) + // + // Querying the next matcher is fine if the transformer always will return the same value. + // But if the transformer is non-deterministic and returns a different value each time, then there + // is no point in querying the next matcher, since it can only comment on the last transformed value. + return oraclematcher.MatchMayChangeInTheFuture(m.Matcher, m.transformedValue) +} diff --git a/vendor/github.com/onsi/gomega/matchers/with_transform_test.go b/vendor/github.com/onsi/gomega/matchers/with_transform_test.go index 77bb30d1cd..e52bf8e631 100644 --- a/vendor/github.com/onsi/gomega/matchers/with_transform_test.go +++ b/vendor/github.com/onsi/gomega/matchers/with_transform_test.go @@ -1,102 +1,102 @@ -package matchers_test - -import ( - "errors" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/matchers" -) - -var _ = Describe("WithTransformMatcher", func() { - - var plus1 = func(i int) int { return i + 1 } - - Context("Panic if transform function invalid", func() { - panicsWithTransformer := func(transform interface{}) { - ExpectWithOffset(1, func() { WithTransform(transform, nil) }).To(Panic()) - } - It("nil", func() { - panicsWithTransformer(nil) - }) - Context("Invalid number of args, but correct return value count", func() { - It("zero", func() { - panicsWithTransformer(func() int { return 5 }) - }) - It("two", func() { - panicsWithTransformer(func(i, j int) int { return 5 }) - }) - }) - Context("Invalid number of return values, but correct number of arguments", func() { - It("zero", func() { - panicsWithTransformer(func(i int) {}) - }) - It("two", func() { - panicsWithTransformer(func(i int) (int, int) { return 5, 6 }) - }) - }) - }) - - It("works with positive cases", func() { - Expect(1).To(WithTransform(plus1, Equal(2))) - Expect(1).To(WithTransform(plus1, WithTransform(plus1, Equal(3)))) - Expect(1).To(WithTransform(plus1, And(Equal(2), BeNumerically(">", 1)))) - - // transform expects custom type - type S struct { - A int - B string - } - transformer := func(s S) string { return s.B } - Expect(S{1, "hi"}).To(WithTransform(transformer, Equal("hi"))) - - // transform expects interface - errString := func(e error) string { return e.Error() } - Expect(errors.New("abc")).To(WithTransform(errString, Equal("abc"))) - }) - - It("works with negative cases", func() { - Expect(1).ToNot(WithTransform(plus1, Equal(3))) - Expect(1).ToNot(WithTransform(plus1, WithTransform(plus1, Equal(2)))) - }) - - Context("failure messages", func() { - Context("when match fails", func() { - It("gives a descriptive message", func() { - m := WithTransform(plus1, Equal(3)) - Expect(m.Match(1)).To(BeFalse()) - Expect(m.FailureMessage(1)).To(Equal("Expected\n : 2\nto equal\n : 3")) - }) - }) - - Context("when match succeeds, but expected it to fail", func() { - It("gives a descriptive message", func() { - m := Not(WithTransform(plus1, Equal(3))) - Expect(m.Match(2)).To(BeFalse()) - Expect(m.FailureMessage(2)).To(Equal("Expected\n : 3\nnot to equal\n : 3")) - }) - }) - - Context("actual value is incompatible with transform function's argument type", func() { - It("gracefully fails if transform cannot be performed", func() { - m := WithTransform(plus1, Equal(3)) - result, err := m.Match("hi") // give it a string but transform expects int; doesn't panic - Expect(result).To(BeFalse()) - Expect(err).To(MatchError("Transform function expects 'int' but we have 'string'")) - }) - }) - }) - - Context("MatchMayChangeInTheFuture()", func() { - It("Propagates value from wrapped matcher on the transformed value", func() { - m := WithTransform(plus1, Or()) // empty Or() always returns false, and indicates it cannot change - Expect(m.Match(1)).To(BeFalse()) - Expect(m.(*WithTransformMatcher).MatchMayChangeInTheFuture(1)).To(BeFalse()) // empty Or() indicates cannot change - }) - It("Defaults to true", func() { - m := WithTransform(plus1, Equal(2)) // Equal does not have this method - Expect(m.Match(1)).To(BeTrue()) - Expect(m.(*WithTransformMatcher).MatchMayChangeInTheFuture(1)).To(BeTrue()) // defaults to true - }) - }) -}) +package matchers_test + +import ( + "errors" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/matchers" +) + +var _ = Describe("WithTransformMatcher", func() { + + var plus1 = func(i int) int { return i + 1 } + + Context("Panic if transform function invalid", func() { + panicsWithTransformer := func(transform interface{}) { + ExpectWithOffset(1, func() { WithTransform(transform, nil) }).To(Panic()) + } + It("nil", func() { + panicsWithTransformer(nil) + }) + Context("Invalid number of args, but correct return value count", func() { + It("zero", func() { + panicsWithTransformer(func() int { return 5 }) + }) + It("two", func() { + panicsWithTransformer(func(i, j int) int { return 5 }) + }) + }) + Context("Invalid number of return values, but correct number of arguments", func() { + It("zero", func() { + panicsWithTransformer(func(i int) {}) + }) + It("two", func() { + panicsWithTransformer(func(i int) (int, int) { return 5, 6 }) + }) + }) + }) + + It("works with positive cases", func() { + Expect(1).To(WithTransform(plus1, Equal(2))) + Expect(1).To(WithTransform(plus1, WithTransform(plus1, Equal(3)))) + Expect(1).To(WithTransform(plus1, And(Equal(2), BeNumerically(">", 1)))) + + // transform expects custom type + type S struct { + A int + B string + } + transformer := func(s S) string { return s.B } + Expect(S{1, "hi"}).To(WithTransform(transformer, Equal("hi"))) + + // transform expects interface + errString := func(e error) string { return e.Error() } + Expect(errors.New("abc")).To(WithTransform(errString, Equal("abc"))) + }) + + It("works with negative cases", func() { + Expect(1).ToNot(WithTransform(plus1, Equal(3))) + Expect(1).ToNot(WithTransform(plus1, WithTransform(plus1, Equal(2)))) + }) + + Context("failure messages", func() { + Context("when match fails", func() { + It("gives a descriptive message", func() { + m := WithTransform(plus1, Equal(3)) + Expect(m.Match(1)).To(BeFalse()) + Expect(m.FailureMessage(1)).To(Equal("Expected\n : 2\nto equal\n : 3")) + }) + }) + + Context("when match succeeds, but expected it to fail", func() { + It("gives a descriptive message", func() { + m := Not(WithTransform(plus1, Equal(3))) + Expect(m.Match(2)).To(BeFalse()) + Expect(m.FailureMessage(2)).To(Equal("Expected\n : 3\nnot to equal\n : 3")) + }) + }) + + Context("actual value is incompatible with transform function's argument type", func() { + It("gracefully fails if transform cannot be performed", func() { + m := WithTransform(plus1, Equal(3)) + result, err := m.Match("hi") // give it a string but transform expects int; doesn't panic + Expect(result).To(BeFalse()) + Expect(err).To(MatchError("Transform function expects 'int' but we have 'string'")) + }) + }) + }) + + Context("MatchMayChangeInTheFuture()", func() { + It("Propagates value from wrapped matcher on the transformed value", func() { + m := WithTransform(plus1, Or()) // empty Or() always returns false, and indicates it cannot change + Expect(m.Match(1)).To(BeFalse()) + Expect(m.(*WithTransformMatcher).MatchMayChangeInTheFuture(1)).To(BeFalse()) // empty Or() indicates cannot change + }) + It("Defaults to true", func() { + m := WithTransform(plus1, Equal(2)) // Equal does not have this method + Expect(m.Match(1)).To(BeTrue()) + Expect(m.(*WithTransformMatcher).MatchMayChangeInTheFuture(1)).To(BeTrue()) // defaults to true + }) + }) +}) diff --git a/vendor/github.com/onsi/gomega/types/types.go b/vendor/github.com/onsi/gomega/types/types.go index d5d061b192..1c632ade29 100644 --- a/vendor/github.com/onsi/gomega/types/types.go +++ b/vendor/github.com/onsi/gomega/types/types.go @@ -1,17 +1,17 @@ -package types - -type GomegaFailHandler func(message string, callerSkip ...int) - -//A simple *testing.T interface wrapper -type GomegaTestingT interface { - Errorf(format string, args ...interface{}) -} - -//All Gomega matchers must implement the GomegaMatcher interface -// -//For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding_your_own_matchers -type GomegaMatcher interface { - Match(actual interface{}) (success bool, err error) - FailureMessage(actual interface{}) (message string) - NegatedFailureMessage(actual interface{}) (message string) -} +package types + +type GomegaFailHandler func(message string, callerSkip ...int) + +//A simple *testing.T interface wrapper +type GomegaTestingT interface { + Errorf(format string, args ...interface{}) +} + +//All Gomega matchers must implement the GomegaMatcher interface +// +//For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding_your_own_matchers +type GomegaMatcher interface { + Match(actual interface{}) (success bool, err error) + FailureMessage(actual interface{}) (message string) + NegatedFailureMessage(actual interface{}) (message string) +} diff --git a/vendor/github.com/prometheus/common/.travis.yml b/vendor/github.com/prometheus/common/.travis.yml index 3c23cc1974..2fe8e9ad7a 100644 --- a/vendor/github.com/prometheus/common/.travis.yml +++ b/vendor/github.com/prometheus/common/.travis.yml @@ -1,6 +1,6 @@ -sudo: false - -language: go -go: - - 1.7.5 - - tip +sudo: false + +language: go +go: + - 1.7.5 + - tip diff --git a/vendor/github.com/prometheus/common/CONTRIBUTING.md b/vendor/github.com/prometheus/common/CONTRIBUTING.md index b9aa654f45..40503edbf1 100644 --- a/vendor/github.com/prometheus/common/CONTRIBUTING.md +++ b/vendor/github.com/prometheus/common/CONTRIBUTING.md @@ -1,18 +1,18 @@ -# Contributing - -Prometheus uses GitHub to manage reviews of pull requests. - -* If you have a trivial fix or improvement, go ahead and create a pull request, - addressing (with `@...`) the maintainer of this repository (see - [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. - -* If you plan to do something more involved, first discuss your ideas - on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). - This will avoid unnecessary work and surely give you and us a good deal - of inspiration. - -* Relevant coding style guidelines are the [Go Code Review - Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) - and the _Formatting and style_ section of Peter Bourgon's [Go: Best - Practices for Production - Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). +# Contributing + +Prometheus uses GitHub to manage reviews of pull requests. + +* If you have a trivial fix or improvement, go ahead and create a pull request, + addressing (with `@...`) the maintainer of this repository (see + [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. + +* If you plan to do something more involved, first discuss your ideas + on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). + This will avoid unnecessary work and surely give you and us a good deal + of inspiration. + +* Relevant coding style guidelines are the [Go Code Review + Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) + and the _Formatting and style_ section of Peter Bourgon's [Go: Best + Practices for Production + Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). diff --git a/vendor/github.com/prometheus/common/LICENSE b/vendor/github.com/prometheus/common/LICENSE index 29f81d812f..261eeb9e9f 100644 --- a/vendor/github.com/prometheus/common/LICENSE +++ b/vendor/github.com/prometheus/common/LICENSE @@ -1,201 +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. + 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/prometheus/common/MAINTAINERS.md b/vendor/github.com/prometheus/common/MAINTAINERS.md index 789395445d..1b31521616 100644 --- a/vendor/github.com/prometheus/common/MAINTAINERS.md +++ b/vendor/github.com/prometheus/common/MAINTAINERS.md @@ -1 +1 @@ -* Fabian Reinartz +* Fabian Reinartz diff --git a/vendor/github.com/prometheus/common/NOTICE b/vendor/github.com/prometheus/common/NOTICE index 71dba95352..636a2c1a5e 100644 --- a/vendor/github.com/prometheus/common/NOTICE +++ b/vendor/github.com/prometheus/common/NOTICE @@ -1,5 +1,5 @@ -Common libraries shared by Prometheus Go components. -Copyright 2015 The Prometheus Authors - -This product includes software developed at -SoundCloud Ltd. (http://soundcloud.com/). +Common libraries shared by Prometheus Go components. +Copyright 2015 The Prometheus Authors + +This product includes software developed at +SoundCloud Ltd. (http://soundcloud.com/). diff --git a/vendor/github.com/prometheus/common/README.md b/vendor/github.com/prometheus/common/README.md index 7f225a8f0e..98f6ce24b9 100644 --- a/vendor/github.com/prometheus/common/README.md +++ b/vendor/github.com/prometheus/common/README.md @@ -1,12 +1,12 @@ -# Common -[![Build Status](https://travis-ci.org/prometheus/common.svg)](https://travis-ci.org/prometheus/common) - -This repository contains Go libraries that are shared across Prometheus -components and libraries. - -* **config**: Common configuration structures -* **expfmt**: Decoding and encoding for the exposition format -* **log**: A logging wrapper around [logrus](https://github.com/Sirupsen/logrus) -* **model**: Shared data structures -* **route**: A routing wrapper around [httprouter](https://github.com/julienschmidt/httprouter) using `context.Context` -* **version**: Version informations and metric +# Common +[![Build Status](https://travis-ci.org/prometheus/common.svg)](https://travis-ci.org/prometheus/common) + +This repository contains Go libraries that are shared across Prometheus +components and libraries. + +* **config**: Common configuration structures +* **expfmt**: Decoding and encoding for the exposition format +* **log**: A logging wrapper around [logrus](https://github.com/Sirupsen/logrus) +* **model**: Shared data structures +* **route**: A routing wrapper around [httprouter](https://github.com/julienschmidt/httprouter) using `context.Context` +* **version**: Version informations and metric diff --git a/vendor/github.com/prometheus/common/config/config.go b/vendor/github.com/prometheus/common/config/config.go index 6a32599830..33eb922ce8 100644 --- a/vendor/github.com/prometheus/common/config/config.go +++ b/vendor/github.com/prometheus/common/config/config.go @@ -1,30 +1,30 @@ -// Copyright 2016 The Prometheus Authors -// 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 config - -import ( - "fmt" - "strings" -) - -func checkOverflow(m map[string]interface{}, ctx string) error { - if len(m) > 0 { - var keys []string - for k := range m { - keys = append(keys, k) - } - return fmt.Errorf("unknown fields in %s: %s", ctx, strings.Join(keys, ", ")) - } - return nil -} +// Copyright 2016 The Prometheus Authors +// 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 config + +import ( + "fmt" + "strings" +) + +func checkOverflow(m map[string]interface{}, ctx string) error { + if len(m) > 0 { + var keys []string + for k := range m { + keys = append(keys, k) + } + return fmt.Errorf("unknown fields in %s: %s", ctx, strings.Join(keys, ", ")) + } + return nil +} diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml index 707173ccea..7dfdc1ead1 100644 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml +++ b/vendor/github.com/prometheus/common/config/testdata/tls_config.cert_no_key.bad.yml @@ -1 +1 @@ -cert_file: somefile +cert_file: somefile diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml index 53fcbd81c6..d054383f18 100644 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml +++ b/vendor/github.com/prometheus/common/config/testdata/tls_config.insecure.good.yml @@ -1 +1 @@ -insecure_skip_verify: true +insecure_skip_verify: true diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml index 73c6ec5754..12cbaac3b7 100644 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml +++ b/vendor/github.com/prometheus/common/config/testdata/tls_config.invalid_field.bad.yml @@ -1 +1 @@ -something_invalid: true +something_invalid: true diff --git a/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml b/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml index d373cc9339..cec045e89e 100644 --- a/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml +++ b/vendor/github.com/prometheus/common/config/testdata/tls_config.key_no_cert.bad.yml @@ -1 +1 @@ -key_file: somefile +key_file: somefile diff --git a/vendor/github.com/prometheus/common/config/tls_config.go b/vendor/github.com/prometheus/common/config/tls_config.go index 8687636d9c..7c7e7cb02a 100644 --- a/vendor/github.com/prometheus/common/config/tls_config.go +++ b/vendor/github.com/prometheus/common/config/tls_config.go @@ -1,79 +1,79 @@ -// Copyright 2016 The Prometheus Authors -// 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 config - -import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" -) - -// TLSConfig configures the options for TLS connections. -type TLSConfig struct { - // The CA cert to use for the targets. - CAFile string `yaml:"ca_file,omitempty"` - // The client cert file for the targets. - CertFile string `yaml:"cert_file,omitempty"` - // The client key file for the targets. - KeyFile string `yaml:"key_file,omitempty"` - // Disable target certificate validation. - InsecureSkipVerify bool `yaml:"insecure_skip_verify"` - - // Catches all undefined fields and must be empty after parsing. - XXX map[string]interface{} `yaml:",inline"` -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { - type plain TLSConfig - if err := unmarshal((*plain)(c)); err != nil { - return err - } - return checkOverflow(c.XXX, "TLS config") -} - -// GenerateConfig produces a tls.Config based on TLS connection options. -// It loads certificate files from disk if they are defined. -func (c *TLSConfig) GenerateConfig() (*tls.Config, error) { - tlsConfig := &tls.Config{InsecureSkipVerify: c.InsecureSkipVerify} - - // If a CA cert is provided then let's read it in so we can validate the - // scrape target's certificate properly. - if len(c.CAFile) > 0 { - caCertPool := x509.NewCertPool() - // Load CA cert. - caCert, err := ioutil.ReadFile(c.CAFile) - if err != nil { - return nil, fmt.Errorf("unable to use specified CA cert %s: %s", c.CAFile, err) - } - caCertPool.AppendCertsFromPEM(caCert) - tlsConfig.RootCAs = caCertPool - } - - if len(c.CertFile) > 0 && len(c.KeyFile) == 0 { - return nil, fmt.Errorf("client cert file %q specified without client key file", c.CertFile) - } else if len(c.KeyFile) > 0 && len(c.CertFile) == 0 { - return nil, fmt.Errorf("client key file %q specified without client cert file", c.KeyFile) - } else if len(c.CertFile) > 0 && len(c.KeyFile) > 0 { - cert, err := tls.LoadX509KeyPair(c.CertFile, c.KeyFile) - if err != nil { - return nil, fmt.Errorf("unable to use specified client cert (%s) & key (%s): %s", c.CertFile, c.KeyFile, err) - } - tlsConfig.Certificates = []tls.Certificate{cert} - } - tlsConfig.BuildNameToCertificate() - - return tlsConfig, nil -} +// Copyright 2016 The Prometheus Authors +// 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 config + +import ( + "crypto/tls" + "crypto/x509" + "fmt" + "io/ioutil" +) + +// TLSConfig configures the options for TLS connections. +type TLSConfig struct { + // The CA cert to use for the targets. + CAFile string `yaml:"ca_file,omitempty"` + // The client cert file for the targets. + CertFile string `yaml:"cert_file,omitempty"` + // The client key file for the targets. + KeyFile string `yaml:"key_file,omitempty"` + // Disable target certificate validation. + InsecureSkipVerify bool `yaml:"insecure_skip_verify"` + + // Catches all undefined fields and must be empty after parsing. + XXX map[string]interface{} `yaml:",inline"` +} + +// UnmarshalYAML implements the yaml.Unmarshaler interface. +func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { + type plain TLSConfig + if err := unmarshal((*plain)(c)); err != nil { + return err + } + return checkOverflow(c.XXX, "TLS config") +} + +// GenerateConfig produces a tls.Config based on TLS connection options. +// It loads certificate files from disk if they are defined. +func (c *TLSConfig) GenerateConfig() (*tls.Config, error) { + tlsConfig := &tls.Config{InsecureSkipVerify: c.InsecureSkipVerify} + + // If a CA cert is provided then let's read it in so we can validate the + // scrape target's certificate properly. + if len(c.CAFile) > 0 { + caCertPool := x509.NewCertPool() + // Load CA cert. + caCert, err := ioutil.ReadFile(c.CAFile) + if err != nil { + return nil, fmt.Errorf("unable to use specified CA cert %s: %s", c.CAFile, err) + } + caCertPool.AppendCertsFromPEM(caCert) + tlsConfig.RootCAs = caCertPool + } + + if len(c.CertFile) > 0 && len(c.KeyFile) == 0 { + return nil, fmt.Errorf("client cert file %q specified without client key file", c.CertFile) + } else if len(c.KeyFile) > 0 && len(c.CertFile) == 0 { + return nil, fmt.Errorf("client key file %q specified without client cert file", c.KeyFile) + } else if len(c.CertFile) > 0 && len(c.KeyFile) > 0 { + cert, err := tls.LoadX509KeyPair(c.CertFile, c.KeyFile) + if err != nil { + return nil, fmt.Errorf("unable to use specified client cert (%s) & key (%s): %s", c.CertFile, c.KeyFile, err) + } + tlsConfig.Certificates = []tls.Certificate{cert} + } + tlsConfig.BuildNameToCertificate() + + return tlsConfig, nil +} diff --git a/vendor/github.com/prometheus/common/config/tls_config_test.go b/vendor/github.com/prometheus/common/config/tls_config_test.go index 1d06cc7833..444303532e 100644 --- a/vendor/github.com/prometheus/common/config/tls_config_test.go +++ b/vendor/github.com/prometheus/common/config/tls_config_test.go @@ -1,92 +1,92 @@ -// Copyright 2016 The Prometheus Authors -// 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 config - -import ( - "crypto/tls" - "io/ioutil" - "reflect" - "strings" - "testing" - - "gopkg.in/yaml.v2" -) - -// LoadTLSConfig parses the given YAML file into a tls.Config. -func LoadTLSConfig(filename string) (*tls.Config, error) { - content, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - cfg := &TLSConfig{} - if err = yaml.Unmarshal(content, cfg); err != nil { - return nil, err - } - return cfg.GenerateConfig() -} - -var expectedTLSConfigs = []struct { - filename string - config *tls.Config -}{ - { - filename: "tls_config.empty.good.yml", - config: &tls.Config{}, - }, { - filename: "tls_config.insecure.good.yml", - config: &tls.Config{InsecureSkipVerify: true}, - }, -} - -func TestValidTLSConfig(t *testing.T) { - for _, cfg := range expectedTLSConfigs { - cfg.config.BuildNameToCertificate() - got, err := LoadTLSConfig("testdata/" + cfg.filename) - if err != nil { - t.Errorf("Error parsing %s: %s", cfg.filename, err) - } - if !reflect.DeepEqual(*got, *cfg.config) { - t.Fatalf("%s: unexpected config result: \n\n%s\n expected\n\n%s", cfg.filename, got, cfg.config) - } - } -} - -var expectedTLSConfigErrors = []struct { - filename string - errMsg string -}{ - { - filename: "tls_config.invalid_field.bad.yml", - errMsg: "unknown fields in", - }, { - filename: "tls_config.cert_no_key.bad.yml", - errMsg: "specified without client key file", - }, { - filename: "tls_config.key_no_cert.bad.yml", - errMsg: "specified without client cert file", - }, -} - -func TestBadTLSConfigs(t *testing.T) { - for _, ee := range expectedTLSConfigErrors { - _, err := LoadTLSConfig("testdata/" + ee.filename) - if err == nil { - t.Errorf("Expected error parsing %s but got none", ee.filename) - continue - } - if !strings.Contains(err.Error(), ee.errMsg) { - t.Errorf("Expected error for %s to contain %q but got: %s", ee.filename, ee.errMsg, err) - } - } -} +// Copyright 2016 The Prometheus Authors +// 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 config + +import ( + "crypto/tls" + "io/ioutil" + "reflect" + "strings" + "testing" + + "gopkg.in/yaml.v2" +) + +// LoadTLSConfig parses the given YAML file into a tls.Config. +func LoadTLSConfig(filename string) (*tls.Config, error) { + content, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + cfg := &TLSConfig{} + if err = yaml.Unmarshal(content, cfg); err != nil { + return nil, err + } + return cfg.GenerateConfig() +} + +var expectedTLSConfigs = []struct { + filename string + config *tls.Config +}{ + { + filename: "tls_config.empty.good.yml", + config: &tls.Config{}, + }, { + filename: "tls_config.insecure.good.yml", + config: &tls.Config{InsecureSkipVerify: true}, + }, +} + +func TestValidTLSConfig(t *testing.T) { + for _, cfg := range expectedTLSConfigs { + cfg.config.BuildNameToCertificate() + got, err := LoadTLSConfig("testdata/" + cfg.filename) + if err != nil { + t.Errorf("Error parsing %s: %s", cfg.filename, err) + } + if !reflect.DeepEqual(*got, *cfg.config) { + t.Fatalf("%s: unexpected config result: \n\n%s\n expected\n\n%s", cfg.filename, got, cfg.config) + } + } +} + +var expectedTLSConfigErrors = []struct { + filename string + errMsg string +}{ + { + filename: "tls_config.invalid_field.bad.yml", + errMsg: "unknown fields in", + }, { + filename: "tls_config.cert_no_key.bad.yml", + errMsg: "specified without client key file", + }, { + filename: "tls_config.key_no_cert.bad.yml", + errMsg: "specified without client cert file", + }, +} + +func TestBadTLSConfigs(t *testing.T) { + for _, ee := range expectedTLSConfigErrors { + _, err := LoadTLSConfig("testdata/" + ee.filename) + if err == nil { + t.Errorf("Expected error parsing %s but got none", ee.filename) + continue + } + if !strings.Contains(err.Error(), ee.errMsg) { + t.Errorf("Expected error for %s to contain %q but got: %s", ee.filename, ee.errMsg, err) + } + } +} diff --git a/vendor/github.com/prometheus/common/expfmt/bench_test.go b/vendor/github.com/prometheus/common/expfmt/bench_test.go index 492a8f9adc..e539bfc13a 100644 --- a/vendor/github.com/prometheus/common/expfmt/bench_test.go +++ b/vendor/github.com/prometheus/common/expfmt/bench_test.go @@ -1,167 +1,167 @@ -// Copyright 2015 The Prometheus Authors -// 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 expfmt - -import ( - "bytes" - "compress/gzip" - "io" - "io/ioutil" - "testing" - - "github.com/matttproud/golang_protobuf_extensions/pbutil" - - dto "github.com/prometheus/client_model/go" -) - -var parser TextParser - -// Benchmarks to show how much penalty text format parsing actually inflicts. -// -// Example results on Linux 3.13.0, Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz, go1.4. -// -// BenchmarkParseText 1000 1188535 ns/op 205085 B/op 6135 allocs/op -// BenchmarkParseTextGzip 1000 1376567 ns/op 246224 B/op 6151 allocs/op -// BenchmarkParseProto 10000 172790 ns/op 52258 B/op 1160 allocs/op -// BenchmarkParseProtoGzip 5000 324021 ns/op 94931 B/op 1211 allocs/op -// BenchmarkParseProtoMap 10000 187946 ns/op 58714 B/op 1203 allocs/op -// -// CONCLUSION: The overhead for the map is negligible. Text format needs ~5x more allocations. -// Without compression, it needs ~7x longer, but with compression (the more relevant scenario), -// the difference becomes less relevant, only ~4x. -// -// The test data contains 248 samples. - -// BenchmarkParseText benchmarks the parsing of a text-format scrape into metric -// family DTOs. -func BenchmarkParseText(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/text") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - if _, err := parser.TextToMetricFamilies(bytes.NewReader(data)); err != nil { - b.Fatal(err) - } - } -} - -// BenchmarkParseTextGzip benchmarks the parsing of a gzipped text-format scrape -// into metric family DTOs. -func BenchmarkParseTextGzip(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/text.gz") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - in, err := gzip.NewReader(bytes.NewReader(data)) - if err != nil { - b.Fatal(err) - } - if _, err := parser.TextToMetricFamilies(in); err != nil { - b.Fatal(err) - } - } -} - -// BenchmarkParseProto benchmarks the parsing of a protobuf-format scrape into -// metric family DTOs. Note that this does not build a map of metric families -// (as the text version does), because it is not required for Prometheus -// ingestion either. (However, it is required for the text-format parsing, as -// the metric family might be sprinkled all over the text, while the -// protobuf-format guarantees bundling at one place.) -func BenchmarkParseProto(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/protobuf") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - family := &dto.MetricFamily{} - in := bytes.NewReader(data) - for { - family.Reset() - if _, err := pbutil.ReadDelimited(in, family); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - } - } -} - -// BenchmarkParseProtoGzip is like BenchmarkParseProto above, but parses gzipped -// protobuf format. -func BenchmarkParseProtoGzip(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/protobuf.gz") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - family := &dto.MetricFamily{} - in, err := gzip.NewReader(bytes.NewReader(data)) - if err != nil { - b.Fatal(err) - } - for { - family.Reset() - if _, err := pbutil.ReadDelimited(in, family); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - } - } -} - -// BenchmarkParseProtoMap is like BenchmarkParseProto but DOES put the parsed -// metric family DTOs into a map. This is not happening during Prometheus -// ingestion. It is just here to measure the overhead of that map creation and -// separate it from the overhead of the text format parsing. -func BenchmarkParseProtoMap(b *testing.B) { - b.StopTimer() - data, err := ioutil.ReadFile("testdata/protobuf") - if err != nil { - b.Fatal(err) - } - b.StartTimer() - - for i := 0; i < b.N; i++ { - families := map[string]*dto.MetricFamily{} - in := bytes.NewReader(data) - for { - family := &dto.MetricFamily{} - if _, err := pbutil.ReadDelimited(in, family); err != nil { - if err == io.EOF { - break - } - b.Fatal(err) - } - families[family.GetName()] = family - } - } -} +// Copyright 2015 The Prometheus Authors +// 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 expfmt + +import ( + "bytes" + "compress/gzip" + "io" + "io/ioutil" + "testing" + + "github.com/matttproud/golang_protobuf_extensions/pbutil" + + dto "github.com/prometheus/client_model/go" +) + +var parser TextParser + +// Benchmarks to show how much penalty text format parsing actually inflicts. +// +// Example results on Linux 3.13.0, Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz, go1.4. +// +// BenchmarkParseText 1000 1188535 ns/op 205085 B/op 6135 allocs/op +// BenchmarkParseTextGzip 1000 1376567 ns/op 246224 B/op 6151 allocs/op +// BenchmarkParseProto 10000 172790 ns/op 52258 B/op 1160 allocs/op +// BenchmarkParseProtoGzip 5000 324021 ns/op 94931 B/op 1211 allocs/op +// BenchmarkParseProtoMap 10000 187946 ns/op 58714 B/op 1203 allocs/op +// +// CONCLUSION: The overhead for the map is negligible. Text format needs ~5x more allocations. +// Without compression, it needs ~7x longer, but with compression (the more relevant scenario), +// the difference becomes less relevant, only ~4x. +// +// The test data contains 248 samples. + +// BenchmarkParseText benchmarks the parsing of a text-format scrape into metric +// family DTOs. +func BenchmarkParseText(b *testing.B) { + b.StopTimer() + data, err := ioutil.ReadFile("testdata/text") + if err != nil { + b.Fatal(err) + } + b.StartTimer() + + for i := 0; i < b.N; i++ { + if _, err := parser.TextToMetricFamilies(bytes.NewReader(data)); err != nil { + b.Fatal(err) + } + } +} + +// BenchmarkParseTextGzip benchmarks the parsing of a gzipped text-format scrape +// into metric family DTOs. +func BenchmarkParseTextGzip(b *testing.B) { + b.StopTimer() + data, err := ioutil.ReadFile("testdata/text.gz") + if err != nil { + b.Fatal(err) + } + b.StartTimer() + + for i := 0; i < b.N; i++ { + in, err := gzip.NewReader(bytes.NewReader(data)) + if err != nil { + b.Fatal(err) + } + if _, err := parser.TextToMetricFamilies(in); err != nil { + b.Fatal(err) + } + } +} + +// BenchmarkParseProto benchmarks the parsing of a protobuf-format scrape into +// metric family DTOs. Note that this does not build a map of metric families +// (as the text version does), because it is not required for Prometheus +// ingestion either. (However, it is required for the text-format parsing, as +// the metric family might be sprinkled all over the text, while the +// protobuf-format guarantees bundling at one place.) +func BenchmarkParseProto(b *testing.B) { + b.StopTimer() + data, err := ioutil.ReadFile("testdata/protobuf") + if err != nil { + b.Fatal(err) + } + b.StartTimer() + + for i := 0; i < b.N; i++ { + family := &dto.MetricFamily{} + in := bytes.NewReader(data) + for { + family.Reset() + if _, err := pbutil.ReadDelimited(in, family); err != nil { + if err == io.EOF { + break + } + b.Fatal(err) + } + } + } +} + +// BenchmarkParseProtoGzip is like BenchmarkParseProto above, but parses gzipped +// protobuf format. +func BenchmarkParseProtoGzip(b *testing.B) { + b.StopTimer() + data, err := ioutil.ReadFile("testdata/protobuf.gz") + if err != nil { + b.Fatal(err) + } + b.StartTimer() + + for i := 0; i < b.N; i++ { + family := &dto.MetricFamily{} + in, err := gzip.NewReader(bytes.NewReader(data)) + if err != nil { + b.Fatal(err) + } + for { + family.Reset() + if _, err := pbutil.ReadDelimited(in, family); err != nil { + if err == io.EOF { + break + } + b.Fatal(err) + } + } + } +} + +// BenchmarkParseProtoMap is like BenchmarkParseProto but DOES put the parsed +// metric family DTOs into a map. This is not happening during Prometheus +// ingestion. It is just here to measure the overhead of that map creation and +// separate it from the overhead of the text format parsing. +func BenchmarkParseProtoMap(b *testing.B) { + b.StopTimer() + data, err := ioutil.ReadFile("testdata/protobuf") + if err != nil { + b.Fatal(err) + } + b.StartTimer() + + for i := 0; i < b.N; i++ { + families := map[string]*dto.MetricFamily{} + in := bytes.NewReader(data) + for { + family := &dto.MetricFamily{} + if _, err := pbutil.ReadDelimited(in, family); err != nil { + if err == io.EOF { + break + } + b.Fatal(err) + } + families[family.GetName()] = family + } + } +} diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go index f5e05d8f60..a7a42d5ef4 100644 --- a/vendor/github.com/prometheus/common/expfmt/decode.go +++ b/vendor/github.com/prometheus/common/expfmt/decode.go @@ -1,429 +1,429 @@ -// Copyright 2015 The Prometheus Authors -// 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 expfmt - -import ( - "fmt" - "io" - "math" - "mime" - "net/http" - - dto "github.com/prometheus/client_model/go" - - "github.com/matttproud/golang_protobuf_extensions/pbutil" - "github.com/prometheus/common/model" -) - -// Decoder types decode an input stream into metric families. -type Decoder interface { - Decode(*dto.MetricFamily) error -} - -// DecodeOptions contains options used by the Decoder and in sample extraction. -type DecodeOptions struct { - // Timestamp is added to each value from the stream that has no explicit timestamp set. - Timestamp model.Time -} - -// ResponseFormat extracts the correct format from a HTTP response header. -// If no matching format can be found FormatUnknown is returned. -func ResponseFormat(h http.Header) Format { - ct := h.Get(hdrContentType) - - mediatype, params, err := mime.ParseMediaType(ct) - if err != nil { - return FmtUnknown - } - - const textType = "text/plain" - - switch mediatype { - case ProtoType: - if p, ok := params["proto"]; ok && p != ProtoProtocol { - return FmtUnknown - } - if e, ok := params["encoding"]; ok && e != "delimited" { - return FmtUnknown - } - return FmtProtoDelim - - case textType: - if v, ok := params["version"]; ok && v != TextVersion { - return FmtUnknown - } - return FmtText - } - - return FmtUnknown -} - -// NewDecoder returns a new decoder based on the given input format. -// If the input format does not imply otherwise, a text format decoder is returned. -func NewDecoder(r io.Reader, format Format) Decoder { - switch format { - case FmtProtoDelim: - return &protoDecoder{r: r} - } - return &textDecoder{r: r} -} - -// protoDecoder implements the Decoder interface for protocol buffers. -type protoDecoder struct { - r io.Reader -} - -// Decode implements the Decoder interface. -func (d *protoDecoder) Decode(v *dto.MetricFamily) error { - _, err := pbutil.ReadDelimited(d.r, v) - if err != nil { - return err - } - if !model.IsValidMetricName(model.LabelValue(v.GetName())) { - return fmt.Errorf("invalid metric name %q", v.GetName()) - } - for _, m := range v.GetMetric() { - if m == nil { - continue - } - for _, l := range m.GetLabel() { - if l == nil { - continue - } - if !model.LabelValue(l.GetValue()).IsValid() { - return fmt.Errorf("invalid label value %q", l.GetValue()) - } - if !model.LabelName(l.GetName()).IsValid() { - return fmt.Errorf("invalid label name %q", l.GetName()) - } - } - } - return nil -} - -// textDecoder implements the Decoder interface for the text protocol. -type textDecoder struct { - r io.Reader - p TextParser - fams []*dto.MetricFamily -} - -// Decode implements the Decoder interface. -func (d *textDecoder) Decode(v *dto.MetricFamily) error { - // TODO(fabxc): Wrap this as a line reader to make streaming safer. - if len(d.fams) == 0 { - // No cached metric families, read everything and parse metrics. - fams, err := d.p.TextToMetricFamilies(d.r) - if err != nil { - return err - } - if len(fams) == 0 { - return io.EOF - } - d.fams = make([]*dto.MetricFamily, 0, len(fams)) - for _, f := range fams { - d.fams = append(d.fams, f) - } - } - - *v = *d.fams[0] - d.fams = d.fams[1:] - - return nil -} - -// SampleDecoder wraps a Decoder to extract samples from the metric families -// decoded by the wrapped Decoder. -type SampleDecoder struct { - Dec Decoder - Opts *DecodeOptions - - f dto.MetricFamily -} - -// Decode calls the Decode method of the wrapped Decoder and then extracts the -// samples from the decoded MetricFamily into the provided model.Vector. -func (sd *SampleDecoder) Decode(s *model.Vector) error { - err := sd.Dec.Decode(&sd.f) - if err != nil { - return err - } - *s, err = extractSamples(&sd.f, sd.Opts) - return err -} - -// ExtractSamples builds a slice of samples from the provided metric -// families. If an error occurs during sample extraction, it continues to -// extract from the remaining metric families. The returned error is the last -// error that has occured. -func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) { - var ( - all model.Vector - lastErr error - ) - for _, f := range fams { - some, err := extractSamples(f, o) - if err != nil { - lastErr = err - continue - } - all = append(all, some...) - } - return all, lastErr -} - -func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) { - switch f.GetType() { - case dto.MetricType_COUNTER: - return extractCounter(o, f), nil - case dto.MetricType_GAUGE: - return extractGauge(o, f), nil - case dto.MetricType_SUMMARY: - return extractSummary(o, f), nil - case dto.MetricType_UNTYPED: - return extractUntyped(o, f), nil - case dto.MetricType_HISTOGRAM: - return extractHistogram(o, f), nil - } - return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType()) -} - -func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Counter == nil { - continue - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - smpl := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Counter.GetValue()), - } - - if m.TimestampMs != nil { - smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } else { - smpl.Timestamp = o.Timestamp - } - - samples = append(samples, smpl) - } - - return samples -} - -func extractGauge(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Gauge == nil { - continue - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - smpl := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Gauge.GetValue()), - } - - if m.TimestampMs != nil { - smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } else { - smpl.Timestamp = o.Timestamp - } - - samples = append(samples, smpl) - } - - return samples -} - -func extractUntyped(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Untyped == nil { - continue - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - smpl := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Untyped.GetValue()), - } - - if m.TimestampMs != nil { - smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } else { - smpl.Timestamp = o.Timestamp - } - - samples = append(samples, smpl) - } - - return samples -} - -func extractSummary(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Summary == nil { - continue - } - - timestamp := o.Timestamp - if m.TimestampMs != nil { - timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } - - for _, q := range m.Summary.Quantile { - lset := make(model.LabelSet, len(m.Label)+2) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - // BUG(matt): Update other names to "quantile". - lset[model.LabelName(model.QuantileLabel)] = model.LabelValue(fmt.Sprint(q.GetQuantile())) - lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(q.GetValue()), - Timestamp: timestamp, - }) - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Summary.GetSampleSum()), - Timestamp: timestamp, - }) - - lset = make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Summary.GetSampleCount()), - Timestamp: timestamp, - }) - } - - return samples -} - -func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector { - samples := make(model.Vector, 0, len(f.Metric)) - - for _, m := range f.Metric { - if m.Histogram == nil { - continue - } - - timestamp := o.Timestamp - if m.TimestampMs != nil { - timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) - } - - infSeen := false - - for _, q := range m.Histogram.Bucket { - lset := make(model.LabelSet, len(m.Label)+2) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.LabelName(model.BucketLabel)] = model.LabelValue(fmt.Sprint(q.GetUpperBound())) - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket") - - if math.IsInf(q.GetUpperBound(), +1) { - infSeen = true - } - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(q.GetCumulativeCount()), - Timestamp: timestamp, - }) - } - - lset := make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Histogram.GetSampleSum()), - Timestamp: timestamp, - }) - - lset = make(model.LabelSet, len(m.Label)+1) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") - - count := &model.Sample{ - Metric: model.Metric(lset), - Value: model.SampleValue(m.Histogram.GetSampleCount()), - Timestamp: timestamp, - } - samples = append(samples, count) - - if !infSeen { - // Append an infinity bucket sample. - lset := make(model.LabelSet, len(m.Label)+2) - for _, p := range m.Label { - lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) - } - lset[model.LabelName(model.BucketLabel)] = model.LabelValue("+Inf") - lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket") - - samples = append(samples, &model.Sample{ - Metric: model.Metric(lset), - Value: count.Value, - Timestamp: timestamp, - }) - } - } - - return samples -} +// Copyright 2015 The Prometheus Authors +// 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 expfmt + +import ( + "fmt" + "io" + "math" + "mime" + "net/http" + + dto "github.com/prometheus/client_model/go" + + "github.com/matttproud/golang_protobuf_extensions/pbutil" + "github.com/prometheus/common/model" +) + +// Decoder types decode an input stream into metric families. +type Decoder interface { + Decode(*dto.MetricFamily) error +} + +// DecodeOptions contains options used by the Decoder and in sample extraction. +type DecodeOptions struct { + // Timestamp is added to each value from the stream that has no explicit timestamp set. + Timestamp model.Time +} + +// ResponseFormat extracts the correct format from a HTTP response header. +// If no matching format can be found FormatUnknown is returned. +func ResponseFormat(h http.Header) Format { + ct := h.Get(hdrContentType) + + mediatype, params, err := mime.ParseMediaType(ct) + if err != nil { + return FmtUnknown + } + + const textType = "text/plain" + + switch mediatype { + case ProtoType: + if p, ok := params["proto"]; ok && p != ProtoProtocol { + return FmtUnknown + } + if e, ok := params["encoding"]; ok && e != "delimited" { + return FmtUnknown + } + return FmtProtoDelim + + case textType: + if v, ok := params["version"]; ok && v != TextVersion { + return FmtUnknown + } + return FmtText + } + + return FmtUnknown +} + +// NewDecoder returns a new decoder based on the given input format. +// If the input format does not imply otherwise, a text format decoder is returned. +func NewDecoder(r io.Reader, format Format) Decoder { + switch format { + case FmtProtoDelim: + return &protoDecoder{r: r} + } + return &textDecoder{r: r} +} + +// protoDecoder implements the Decoder interface for protocol buffers. +type protoDecoder struct { + r io.Reader +} + +// Decode implements the Decoder interface. +func (d *protoDecoder) Decode(v *dto.MetricFamily) error { + _, err := pbutil.ReadDelimited(d.r, v) + if err != nil { + return err + } + if !model.IsValidMetricName(model.LabelValue(v.GetName())) { + return fmt.Errorf("invalid metric name %q", v.GetName()) + } + for _, m := range v.GetMetric() { + if m == nil { + continue + } + for _, l := range m.GetLabel() { + if l == nil { + continue + } + if !model.LabelValue(l.GetValue()).IsValid() { + return fmt.Errorf("invalid label value %q", l.GetValue()) + } + if !model.LabelName(l.GetName()).IsValid() { + return fmt.Errorf("invalid label name %q", l.GetName()) + } + } + } + return nil +} + +// textDecoder implements the Decoder interface for the text protocol. +type textDecoder struct { + r io.Reader + p TextParser + fams []*dto.MetricFamily +} + +// Decode implements the Decoder interface. +func (d *textDecoder) Decode(v *dto.MetricFamily) error { + // TODO(fabxc): Wrap this as a line reader to make streaming safer. + if len(d.fams) == 0 { + // No cached metric families, read everything and parse metrics. + fams, err := d.p.TextToMetricFamilies(d.r) + if err != nil { + return err + } + if len(fams) == 0 { + return io.EOF + } + d.fams = make([]*dto.MetricFamily, 0, len(fams)) + for _, f := range fams { + d.fams = append(d.fams, f) + } + } + + *v = *d.fams[0] + d.fams = d.fams[1:] + + return nil +} + +// SampleDecoder wraps a Decoder to extract samples from the metric families +// decoded by the wrapped Decoder. +type SampleDecoder struct { + Dec Decoder + Opts *DecodeOptions + + f dto.MetricFamily +} + +// Decode calls the Decode method of the wrapped Decoder and then extracts the +// samples from the decoded MetricFamily into the provided model.Vector. +func (sd *SampleDecoder) Decode(s *model.Vector) error { + err := sd.Dec.Decode(&sd.f) + if err != nil { + return err + } + *s, err = extractSamples(&sd.f, sd.Opts) + return err +} + +// ExtractSamples builds a slice of samples from the provided metric +// families. If an error occurs during sample extraction, it continues to +// extract from the remaining metric families. The returned error is the last +// error that has occured. +func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) { + var ( + all model.Vector + lastErr error + ) + for _, f := range fams { + some, err := extractSamples(f, o) + if err != nil { + lastErr = err + continue + } + all = append(all, some...) + } + return all, lastErr +} + +func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) { + switch f.GetType() { + case dto.MetricType_COUNTER: + return extractCounter(o, f), nil + case dto.MetricType_GAUGE: + return extractGauge(o, f), nil + case dto.MetricType_SUMMARY: + return extractSummary(o, f), nil + case dto.MetricType_UNTYPED: + return extractUntyped(o, f), nil + case dto.MetricType_HISTOGRAM: + return extractHistogram(o, f), nil + } + return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType()) +} + +func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector { + samples := make(model.Vector, 0, len(f.Metric)) + + for _, m := range f.Metric { + if m.Counter == nil { + continue + } + + lset := make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) + + smpl := &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Counter.GetValue()), + } + + if m.TimestampMs != nil { + smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) + } else { + smpl.Timestamp = o.Timestamp + } + + samples = append(samples, smpl) + } + + return samples +} + +func extractGauge(o *DecodeOptions, f *dto.MetricFamily) model.Vector { + samples := make(model.Vector, 0, len(f.Metric)) + + for _, m := range f.Metric { + if m.Gauge == nil { + continue + } + + lset := make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) + + smpl := &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Gauge.GetValue()), + } + + if m.TimestampMs != nil { + smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) + } else { + smpl.Timestamp = o.Timestamp + } + + samples = append(samples, smpl) + } + + return samples +} + +func extractUntyped(o *DecodeOptions, f *dto.MetricFamily) model.Vector { + samples := make(model.Vector, 0, len(f.Metric)) + + for _, m := range f.Metric { + if m.Untyped == nil { + continue + } + + lset := make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) + + smpl := &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Untyped.GetValue()), + } + + if m.TimestampMs != nil { + smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) + } else { + smpl.Timestamp = o.Timestamp + } + + samples = append(samples, smpl) + } + + return samples +} + +func extractSummary(o *DecodeOptions, f *dto.MetricFamily) model.Vector { + samples := make(model.Vector, 0, len(f.Metric)) + + for _, m := range f.Metric { + if m.Summary == nil { + continue + } + + timestamp := o.Timestamp + if m.TimestampMs != nil { + timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) + } + + for _, q := range m.Summary.Quantile { + lset := make(model.LabelSet, len(m.Label)+2) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + // BUG(matt): Update other names to "quantile". + lset[model.LabelName(model.QuantileLabel)] = model.LabelValue(fmt.Sprint(q.GetQuantile())) + lset[model.MetricNameLabel] = model.LabelValue(f.GetName()) + + samples = append(samples, &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(q.GetValue()), + Timestamp: timestamp, + }) + } + + lset := make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum") + + samples = append(samples, &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Summary.GetSampleSum()), + Timestamp: timestamp, + }) + + lset = make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") + + samples = append(samples, &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Summary.GetSampleCount()), + Timestamp: timestamp, + }) + } + + return samples +} + +func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector { + samples := make(model.Vector, 0, len(f.Metric)) + + for _, m := range f.Metric { + if m.Histogram == nil { + continue + } + + timestamp := o.Timestamp + if m.TimestampMs != nil { + timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000) + } + + infSeen := false + + for _, q := range m.Histogram.Bucket { + lset := make(model.LabelSet, len(m.Label)+2) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.LabelName(model.BucketLabel)] = model.LabelValue(fmt.Sprint(q.GetUpperBound())) + lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket") + + if math.IsInf(q.GetUpperBound(), +1) { + infSeen = true + } + + samples = append(samples, &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(q.GetCumulativeCount()), + Timestamp: timestamp, + }) + } + + lset := make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum") + + samples = append(samples, &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Histogram.GetSampleSum()), + Timestamp: timestamp, + }) + + lset = make(model.LabelSet, len(m.Label)+1) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") + + count := &model.Sample{ + Metric: model.Metric(lset), + Value: model.SampleValue(m.Histogram.GetSampleCount()), + Timestamp: timestamp, + } + samples = append(samples, count) + + if !infSeen { + // Append an infinity bucket sample. + lset := make(model.LabelSet, len(m.Label)+2) + for _, p := range m.Label { + lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue()) + } + lset[model.LabelName(model.BucketLabel)] = model.LabelValue("+Inf") + lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket") + + samples = append(samples, &model.Sample{ + Metric: model.Metric(lset), + Value: count.Value, + Timestamp: timestamp, + }) + } + } + + return samples +} diff --git a/vendor/github.com/prometheus/common/expfmt/decode_test.go b/vendor/github.com/prometheus/common/expfmt/decode_test.go index 270018c8cd..82c1130c9d 100644 --- a/vendor/github.com/prometheus/common/expfmt/decode_test.go +++ b/vendor/github.com/prometheus/common/expfmt/decode_test.go @@ -1,435 +1,435 @@ -// Copyright 2015 The Prometheus Authors -// 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 expfmt - -import ( - "io" - "net/http" - "reflect" - "sort" - "strings" - "testing" - - "github.com/golang/protobuf/proto" - dto "github.com/prometheus/client_model/go" - - "github.com/prometheus/common/model" -) - -func TestTextDecoder(t *testing.T) { - var ( - ts = model.Now() - in = ` -# Only a quite simple scenario with two metric families. -# More complicated tests of the parser itself can be found in the text package. -# TYPE mf2 counter -mf2 3 -mf1{label="value1"} -3.14 123456 -mf1{label="value2"} 42 -mf2 4 -` - out = model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf1", - "label": "value1", - }, - Value: -3.14, - Timestamp: 123456, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf1", - "label": "value2", - }, - Value: 42, - Timestamp: ts, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf2", - }, - Value: 3, - Timestamp: ts, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "mf2", - }, - Value: 4, - Timestamp: ts, - }, - } - ) - - dec := &SampleDecoder{ - Dec: &textDecoder{r: strings.NewReader(in)}, - Opts: &DecodeOptions{ - Timestamp: ts, - }, - } - var all model.Vector - for { - var smpls model.Vector - err := dec.Decode(&smpls) - if err == io.EOF { - break - } - if err != nil { - t.Fatal(err) - } - all = append(all, smpls...) - } - sort.Sort(all) - sort.Sort(out) - if !reflect.DeepEqual(all, out) { - t.Fatalf("output does not match") - } -} - -func TestProtoDecoder(t *testing.T) { - - var testTime = model.Now() - - scenarios := []struct { - in string - expected model.Vector - fail bool - }{ - { - in: "", - }, - { - in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_!abel_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@", - fail: true, - }, - { - in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_label_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "some_label_name": "some_label_value", - }, - Value: -42, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "another_label_name": "another_label_value", - }, - Value: 84, - Timestamp: testTime, - }, - }, - }, - { - in: "\xb9\x01\n\rrequest_count\x12\x12Number of requests\x18\x02\"O\n#\n\x0fsome_label_name\x12\x10some_label_value\"(\x1a\x12\t\xaeG\xe1z\x14\xae\xef?\x11\x00\x00\x00\x00\x00\x00E\xc0\x1a\x12\t+\x87\x16\xd9\xce\xf7\xef?\x11\x00\x00\x00\x00\x00\x00U\xc0\"A\n)\n\x12another_label_name\x12\x13another_label_value\"\x14\x1a\x12\t\x00\x00\x00\x00\x00\x00\xe0?\x11\x00\x00\x00\x00\x00\x00$@", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_count", - "some_label_name": "some_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_sum", - "some_label_name": "some_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "some_label_name": "some_label_value", - "quantile": "0.99", - }, - Value: -42, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "some_label_name": "some_label_value", - "quantile": "0.999", - }, - Value: -84, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_count", - "another_label_name": "another_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count_sum", - "another_label_name": "another_label_value", - }, - Value: 0, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - "another_label_name": "another_label_value", - "quantile": "0.5", - }, - Value: 10, - Timestamp: testTime, - }, - }, - }, - { - in: "\x8d\x01\n\x1drequest_duration_microseconds\x12\x15The response latency.\x18\x04\"S:Q\b\x85\x15\x11\xcd\xcc\xccL\x8f\xcb:A\x1a\v\b{\x11\x00\x00\x00\x00\x00\x00Y@\x1a\f\b\x9c\x03\x11\x00\x00\x00\x00\x00\x00^@\x1a\f\b\xd0\x04\x11\x00\x00\x00\x00\x00\x00b@\x1a\f\b\xf4\v\x11\x9a\x99\x99\x99\x99\x99e@\x1a\f\b\x85\x15\x11\x00\x00\x00\x00\x00\x00\xf0\u007f", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "100", - }, - Value: 123, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "120", - }, - Value: 412, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "144", - }, - Value: 592, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "172.8", - }, - Value: 1524, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_bucket", - "le": "+Inf", - }, - Value: 2693, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_sum", - }, - Value: 1756047.3, - Timestamp: testTime, - }, - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_duration_microseconds_count", - }, - Value: 2693, - Timestamp: testTime, - }, - }, - }, - { - // The metric type is unset in this protobuf, which needs to be handled - // correctly by the decoder. - in: "\x1c\n\rrequest_count\"\v\x1a\t\t\x00\x00\x00\x00\x00\x00\xf0?", - expected: model.Vector{ - &model.Sample{ - Metric: model.Metric{ - model.MetricNameLabel: "request_count", - }, - Value: 1, - Timestamp: testTime, - }, - }, - }, - } - - for i, scenario := range scenarios { - dec := &SampleDecoder{ - Dec: &protoDecoder{r: strings.NewReader(scenario.in)}, - Opts: &DecodeOptions{ - Timestamp: testTime, - }, - } - - var all model.Vector - for { - var smpls model.Vector - err := dec.Decode(&smpls) - if err == io.EOF { - break - } - if scenario.fail { - if err == nil { - t.Fatal("Expected error but got none") - } - break - } - if err != nil { - t.Fatal(err) - } - all = append(all, smpls...) - } - sort.Sort(all) - sort.Sort(scenario.expected) - if !reflect.DeepEqual(all, scenario.expected) { - t.Fatalf("%d. output does not match, want: %#v, got %#v", i, scenario.expected, all) - } - } -} - -func testDiscriminatorHTTPHeader(t testing.TB) { - var scenarios = []struct { - input map[string]string - output Format - err error - }{ - { - input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="delimited"`}, - output: FmtProtoDelim, - }, - { - input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="illegal"; encoding="delimited"`}, - output: FmtUnknown, - }, - { - input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="illegal"`}, - output: FmtUnknown, - }, - { - input: map[string]string{"Content-Type": `text/plain; version=0.0.4`}, - output: FmtText, - }, - { - input: map[string]string{"Content-Type": `text/plain`}, - output: FmtText, - }, - { - input: map[string]string{"Content-Type": `text/plain; version=0.0.3`}, - output: FmtUnknown, - }, - } - - for i, scenario := range scenarios { - var header http.Header - - if len(scenario.input) > 0 { - header = http.Header{} - } - - for key, value := range scenario.input { - header.Add(key, value) - } - - actual := ResponseFormat(header) - - if scenario.output != actual { - t.Errorf("%d. expected %s, got %s", i, scenario.output, actual) - } - } -} - -func TestDiscriminatorHTTPHeader(t *testing.T) { - testDiscriminatorHTTPHeader(t) -} - -func BenchmarkDiscriminatorHTTPHeader(b *testing.B) { - for i := 0; i < b.N; i++ { - testDiscriminatorHTTPHeader(b) - } -} - -func TestExtractSamples(t *testing.T) { - var ( - goodMetricFamily1 = &dto.MetricFamily{ - Name: proto.String("foo"), - Help: proto.String("Help for foo."), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Counter: &dto.Counter{ - Value: proto.Float64(4711), - }, - }, - }, - } - goodMetricFamily2 = &dto.MetricFamily{ - Name: proto.String("bar"), - Help: proto.String("Help for bar."), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Gauge: &dto.Gauge{ - Value: proto.Float64(3.14), - }, - }, - }, - } - badMetricFamily = &dto.MetricFamily{ - Name: proto.String("bad"), - Help: proto.String("Help for bad."), - Type: dto.MetricType(42).Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Gauge: &dto.Gauge{ - Value: proto.Float64(2.7), - }, - }, - }, - } - - opts = &DecodeOptions{ - Timestamp: 42, - } - ) - - got, err := ExtractSamples(opts, goodMetricFamily1, goodMetricFamily2) - if err != nil { - t.Error("Unexpected error from ExtractSamples:", err) - } - want := model.Vector{ - &model.Sample{Metric: model.Metric{model.MetricNameLabel: "foo"}, Value: 4711, Timestamp: 42}, - &model.Sample{Metric: model.Metric{model.MetricNameLabel: "bar"}, Value: 3.14, Timestamp: 42}, - } - if !reflect.DeepEqual(got, want) { - t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want) - } - - got, err = ExtractSamples(opts, goodMetricFamily1, badMetricFamily, goodMetricFamily2) - if err == nil { - t.Error("Expected error from ExtractSamples") - } - if !reflect.DeepEqual(got, want) { - t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want) - } -} +// Copyright 2015 The Prometheus Authors +// 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 expfmt + +import ( + "io" + "net/http" + "reflect" + "sort" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + dto "github.com/prometheus/client_model/go" + + "github.com/prometheus/common/model" +) + +func TestTextDecoder(t *testing.T) { + var ( + ts = model.Now() + in = ` +# Only a quite simple scenario with two metric families. +# More complicated tests of the parser itself can be found in the text package. +# TYPE mf2 counter +mf2 3 +mf1{label="value1"} -3.14 123456 +mf1{label="value2"} 42 +mf2 4 +` + out = model.Vector{ + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "mf1", + "label": "value1", + }, + Value: -3.14, + Timestamp: 123456, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "mf1", + "label": "value2", + }, + Value: 42, + Timestamp: ts, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "mf2", + }, + Value: 3, + Timestamp: ts, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "mf2", + }, + Value: 4, + Timestamp: ts, + }, + } + ) + + dec := &SampleDecoder{ + Dec: &textDecoder{r: strings.NewReader(in)}, + Opts: &DecodeOptions{ + Timestamp: ts, + }, + } + var all model.Vector + for { + var smpls model.Vector + err := dec.Decode(&smpls) + if err == io.EOF { + break + } + if err != nil { + t.Fatal(err) + } + all = append(all, smpls...) + } + sort.Sort(all) + sort.Sort(out) + if !reflect.DeepEqual(all, out) { + t.Fatalf("output does not match") + } +} + +func TestProtoDecoder(t *testing.T) { + + var testTime = model.Now() + + scenarios := []struct { + in string + expected model.Vector + fail bool + }{ + { + in: "", + }, + { + in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_!abel_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@", + fail: true, + }, + { + in: "\x8f\x01\n\rrequest_count\x12\x12Number of requests\x18\x00\"0\n#\n\x0fsome_label_name\x12\x10some_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00E\xc0\"6\n)\n\x12another_label_name\x12\x13another_label_value\x1a\t\t\x00\x00\x00\x00\x00\x00U@", + expected: model.Vector{ + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count", + "some_label_name": "some_label_value", + }, + Value: -42, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count", + "another_label_name": "another_label_value", + }, + Value: 84, + Timestamp: testTime, + }, + }, + }, + { + in: "\xb9\x01\n\rrequest_count\x12\x12Number of requests\x18\x02\"O\n#\n\x0fsome_label_name\x12\x10some_label_value\"(\x1a\x12\t\xaeG\xe1z\x14\xae\xef?\x11\x00\x00\x00\x00\x00\x00E\xc0\x1a\x12\t+\x87\x16\xd9\xce\xf7\xef?\x11\x00\x00\x00\x00\x00\x00U\xc0\"A\n)\n\x12another_label_name\x12\x13another_label_value\"\x14\x1a\x12\t\x00\x00\x00\x00\x00\x00\xe0?\x11\x00\x00\x00\x00\x00\x00$@", + expected: model.Vector{ + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count_count", + "some_label_name": "some_label_value", + }, + Value: 0, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count_sum", + "some_label_name": "some_label_value", + }, + Value: 0, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count", + "some_label_name": "some_label_value", + "quantile": "0.99", + }, + Value: -42, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count", + "some_label_name": "some_label_value", + "quantile": "0.999", + }, + Value: -84, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count_count", + "another_label_name": "another_label_value", + }, + Value: 0, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count_sum", + "another_label_name": "another_label_value", + }, + Value: 0, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count", + "another_label_name": "another_label_value", + "quantile": "0.5", + }, + Value: 10, + Timestamp: testTime, + }, + }, + }, + { + in: "\x8d\x01\n\x1drequest_duration_microseconds\x12\x15The response latency.\x18\x04\"S:Q\b\x85\x15\x11\xcd\xcc\xccL\x8f\xcb:A\x1a\v\b{\x11\x00\x00\x00\x00\x00\x00Y@\x1a\f\b\x9c\x03\x11\x00\x00\x00\x00\x00\x00^@\x1a\f\b\xd0\x04\x11\x00\x00\x00\x00\x00\x00b@\x1a\f\b\xf4\v\x11\x9a\x99\x99\x99\x99\x99e@\x1a\f\b\x85\x15\x11\x00\x00\x00\x00\x00\x00\xf0\u007f", + expected: model.Vector{ + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_bucket", + "le": "100", + }, + Value: 123, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_bucket", + "le": "120", + }, + Value: 412, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_bucket", + "le": "144", + }, + Value: 592, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_bucket", + "le": "172.8", + }, + Value: 1524, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_bucket", + "le": "+Inf", + }, + Value: 2693, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_sum", + }, + Value: 1756047.3, + Timestamp: testTime, + }, + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_duration_microseconds_count", + }, + Value: 2693, + Timestamp: testTime, + }, + }, + }, + { + // The metric type is unset in this protobuf, which needs to be handled + // correctly by the decoder. + in: "\x1c\n\rrequest_count\"\v\x1a\t\t\x00\x00\x00\x00\x00\x00\xf0?", + expected: model.Vector{ + &model.Sample{ + Metric: model.Metric{ + model.MetricNameLabel: "request_count", + }, + Value: 1, + Timestamp: testTime, + }, + }, + }, + } + + for i, scenario := range scenarios { + dec := &SampleDecoder{ + Dec: &protoDecoder{r: strings.NewReader(scenario.in)}, + Opts: &DecodeOptions{ + Timestamp: testTime, + }, + } + + var all model.Vector + for { + var smpls model.Vector + err := dec.Decode(&smpls) + if err == io.EOF { + break + } + if scenario.fail { + if err == nil { + t.Fatal("Expected error but got none") + } + break + } + if err != nil { + t.Fatal(err) + } + all = append(all, smpls...) + } + sort.Sort(all) + sort.Sort(scenario.expected) + if !reflect.DeepEqual(all, scenario.expected) { + t.Fatalf("%d. output does not match, want: %#v, got %#v", i, scenario.expected, all) + } + } +} + +func testDiscriminatorHTTPHeader(t testing.TB) { + var scenarios = []struct { + input map[string]string + output Format + err error + }{ + { + input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="delimited"`}, + output: FmtProtoDelim, + }, + { + input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="illegal"; encoding="delimited"`}, + output: FmtUnknown, + }, + { + input: map[string]string{"Content-Type": `application/vnd.google.protobuf; proto="io.prometheus.client.MetricFamily"; encoding="illegal"`}, + output: FmtUnknown, + }, + { + input: map[string]string{"Content-Type": `text/plain; version=0.0.4`}, + output: FmtText, + }, + { + input: map[string]string{"Content-Type": `text/plain`}, + output: FmtText, + }, + { + input: map[string]string{"Content-Type": `text/plain; version=0.0.3`}, + output: FmtUnknown, + }, + } + + for i, scenario := range scenarios { + var header http.Header + + if len(scenario.input) > 0 { + header = http.Header{} + } + + for key, value := range scenario.input { + header.Add(key, value) + } + + actual := ResponseFormat(header) + + if scenario.output != actual { + t.Errorf("%d. expected %s, got %s", i, scenario.output, actual) + } + } +} + +func TestDiscriminatorHTTPHeader(t *testing.T) { + testDiscriminatorHTTPHeader(t) +} + +func BenchmarkDiscriminatorHTTPHeader(b *testing.B) { + for i := 0; i < b.N; i++ { + testDiscriminatorHTTPHeader(b) + } +} + +func TestExtractSamples(t *testing.T) { + var ( + goodMetricFamily1 = &dto.MetricFamily{ + Name: proto.String("foo"), + Help: proto.String("Help for foo."), + Type: dto.MetricType_COUNTER.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Counter: &dto.Counter{ + Value: proto.Float64(4711), + }, + }, + }, + } + goodMetricFamily2 = &dto.MetricFamily{ + Name: proto.String("bar"), + Help: proto.String("Help for bar."), + Type: dto.MetricType_GAUGE.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Gauge: &dto.Gauge{ + Value: proto.Float64(3.14), + }, + }, + }, + } + badMetricFamily = &dto.MetricFamily{ + Name: proto.String("bad"), + Help: proto.String("Help for bad."), + Type: dto.MetricType(42).Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Gauge: &dto.Gauge{ + Value: proto.Float64(2.7), + }, + }, + }, + } + + opts = &DecodeOptions{ + Timestamp: 42, + } + ) + + got, err := ExtractSamples(opts, goodMetricFamily1, goodMetricFamily2) + if err != nil { + t.Error("Unexpected error from ExtractSamples:", err) + } + want := model.Vector{ + &model.Sample{Metric: model.Metric{model.MetricNameLabel: "foo"}, Value: 4711, Timestamp: 42}, + &model.Sample{Metric: model.Metric{model.MetricNameLabel: "bar"}, Value: 3.14, Timestamp: 42}, + } + if !reflect.DeepEqual(got, want) { + t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want) + } + + got, err = ExtractSamples(opts, goodMetricFamily1, badMetricFamily, goodMetricFamily2) + if err == nil { + t.Error("Expected error from ExtractSamples") + } + if !reflect.DeepEqual(got, want) { + t.Errorf("unexpected samples extracted, got: %v, want: %v", got, want) + } +} diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go index a35140b4a9..11839ed65c 100644 --- a/vendor/github.com/prometheus/common/expfmt/encode.go +++ b/vendor/github.com/prometheus/common/expfmt/encode.go @@ -1,88 +1,88 @@ -// Copyright 2015 The Prometheus Authors -// 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 expfmt - -import ( - "fmt" - "io" - "net/http" - - "github.com/golang/protobuf/proto" - "github.com/matttproud/golang_protobuf_extensions/pbutil" - "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" - - dto "github.com/prometheus/client_model/go" -) - -// Encoder types encode metric families into an underlying wire protocol. -type Encoder interface { - Encode(*dto.MetricFamily) error -} - -type encoder func(*dto.MetricFamily) error - -func (e encoder) Encode(v *dto.MetricFamily) error { - return e(v) -} - -// Negotiate returns the Content-Type based on the given Accept header. -// If no appropriate accepted type is found, FmtText is returned. -func Negotiate(h http.Header) Format { - for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) { - // Check for protocol buffer - if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { - switch ac.Params["encoding"] { - case "delimited": - return FmtProtoDelim - case "text": - return FmtProtoText - case "compact-text": - return FmtProtoCompact - } - } - // Check for text format. - ver := ac.Params["version"] - if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { - return FmtText - } - } - return FmtText -} - -// NewEncoder returns a new encoder based on content type negotiation. -func NewEncoder(w io.Writer, format Format) Encoder { - switch format { - case FmtProtoDelim: - return encoder(func(v *dto.MetricFamily) error { - _, err := pbutil.WriteDelimited(w, v) - return err - }) - case FmtProtoCompact: - return encoder(func(v *dto.MetricFamily) error { - _, err := fmt.Fprintln(w, v.String()) - return err - }) - case FmtProtoText: - return encoder(func(v *dto.MetricFamily) error { - _, err := fmt.Fprintln(w, proto.MarshalTextString(v)) - return err - }) - case FmtText: - return encoder(func(v *dto.MetricFamily) error { - _, err := MetricFamilyToText(w, v) - return err - }) - } - panic("expfmt.NewEncoder: unknown format") -} +// Copyright 2015 The Prometheus Authors +// 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 expfmt + +import ( + "fmt" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/matttproud/golang_protobuf_extensions/pbutil" + "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" + + dto "github.com/prometheus/client_model/go" +) + +// Encoder types encode metric families into an underlying wire protocol. +type Encoder interface { + Encode(*dto.MetricFamily) error +} + +type encoder func(*dto.MetricFamily) error + +func (e encoder) Encode(v *dto.MetricFamily) error { + return e(v) +} + +// Negotiate returns the Content-Type based on the given Accept header. +// If no appropriate accepted type is found, FmtText is returned. +func Negotiate(h http.Header) Format { + for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) { + // Check for protocol buffer + if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol { + switch ac.Params["encoding"] { + case "delimited": + return FmtProtoDelim + case "text": + return FmtProtoText + case "compact-text": + return FmtProtoCompact + } + } + // Check for text format. + ver := ac.Params["version"] + if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") { + return FmtText + } + } + return FmtText +} + +// NewEncoder returns a new encoder based on content type negotiation. +func NewEncoder(w io.Writer, format Format) Encoder { + switch format { + case FmtProtoDelim: + return encoder(func(v *dto.MetricFamily) error { + _, err := pbutil.WriteDelimited(w, v) + return err + }) + case FmtProtoCompact: + return encoder(func(v *dto.MetricFamily) error { + _, err := fmt.Fprintln(w, v.String()) + return err + }) + case FmtProtoText: + return encoder(func(v *dto.MetricFamily) error { + _, err := fmt.Fprintln(w, proto.MarshalTextString(v)) + return err + }) + case FmtText: + return encoder(func(v *dto.MetricFamily) error { + _, err := MetricFamilyToText(w, v) + return err + }) + } + panic("expfmt.NewEncoder: unknown format") +} diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index 8db275daa0..371ac75037 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -1,38 +1,38 @@ -// Copyright 2015 The Prometheus Authors -// 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 expfmt contains tools for reading and writing Prometheus metrics. -package expfmt - -// Format specifies the HTTP content type of the different wire protocols. -type Format string - -// Constants to assemble the Content-Type values for the different wire protocols. -const ( - TextVersion = "0.0.4" - ProtoType = `application/vnd.google.protobuf` - ProtoProtocol = `io.prometheus.client.MetricFamily` - ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" - - // The Content-Type values for the different wire protocols. - FmtUnknown Format = `` - FmtText Format = `text/plain; version=` + TextVersion - FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` - FmtProtoText Format = ProtoFmt + ` encoding=text` - FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` -) - -const ( - hdrContentType = "Content-Type" - hdrAccept = "Accept" -) +// Copyright 2015 The Prometheus Authors +// 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 expfmt contains tools for reading and writing Prometheus metrics. +package expfmt + +// Format specifies the HTTP content type of the different wire protocols. +type Format string + +// Constants to assemble the Content-Type values for the different wire protocols. +const ( + TextVersion = "0.0.4" + ProtoType = `application/vnd.google.protobuf` + ProtoProtocol = `io.prometheus.client.MetricFamily` + ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";" + + // The Content-Type values for the different wire protocols. + FmtUnknown Format = `` + FmtText Format = `text/plain; version=` + TextVersion + FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` + FmtProtoText Format = ProtoFmt + ` encoding=text` + FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` +) + +const ( + hdrContentType = "Content-Type" + hdrAccept = "Accept" +) diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz.go b/vendor/github.com/prometheus/common/expfmt/fuzz.go index f915ffde1a..dc2eedeefc 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz.go +++ b/vendor/github.com/prometheus/common/expfmt/fuzz.go @@ -1,36 +1,36 @@ -// Copyright 2014 The Prometheus Authors -// 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. - -// Build only when actually fuzzing -// +build gofuzz - -package expfmt - -import "bytes" - -// Fuzz text metric parser with with github.com/dvyukov/go-fuzz: -// -// go-fuzz-build github.com/prometheus/common/expfmt -// go-fuzz -bin expfmt-fuzz.zip -workdir fuzz -// -// Further input samples should go in the folder fuzz/corpus. -func Fuzz(in []byte) int { - parser := TextParser{} - _, err := parser.TextToMetricFamilies(bytes.NewReader(in)) - - if err != nil { - return 0 - } - - return 1 -} +// Copyright 2014 The Prometheus Authors +// 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. + +// Build only when actually fuzzing +// +build gofuzz + +package expfmt + +import "bytes" + +// Fuzz text metric parser with with github.com/dvyukov/go-fuzz: +// +// go-fuzz-build github.com/prometheus/common/expfmt +// go-fuzz -bin expfmt-fuzz.zip -workdir fuzz +// +// Further input samples should go in the folder fuzz/corpus. +func Fuzz(in []byte) int { + parser := TextParser{} + _, err := parser.TextToMetricFamilies(bytes.NewReader(in)) + + if err != nil { + return 0 + } + + return 1 +} diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 index 99a8091366..139597f9cb 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_0 @@ -1,2 +1,2 @@ - - + + diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 index eeccbf064f..2ae8706797 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_1 @@ -1,6 +1,6 @@ - -minimal_metric 1.234 -another_metric -3e3 103948 -# Even that: -no_labels{} 3 -# HELP line for non-existing metric will be ignored. + +minimal_metric 1.234 +another_metric -3e3 103948 +# Even that: +no_labels{} 3 +# HELP line for non-existing metric will be ignored. diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 index 5d024e2db8..5c351db36d 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_2 @@ -1,12 +1,12 @@ - -# A normal comment. -# -# TYPE name counter -name{labelname="val1",basename="basevalue"} NaN -name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890 -# HELP name two-line\n doc str\\ing - - # HELP name2 doc str"ing 2 - # TYPE name2 gauge -name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321 -name2{ labelname = "val1" , }-Inf + +# A normal comment. +# +# TYPE name counter +name{labelname="val1",basename="basevalue"} NaN +name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890 +# HELP name two-line\n doc str\\ing + + # HELP name2 doc str"ing 2 + # TYPE name2 gauge +name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321 +name2{ labelname = "val1" , }-Inf diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 index 65e6f01296..0b3c345aa9 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_3 @@ -1,22 +1,22 @@ - -# TYPE my_summary summary -my_summary{n1="val1",quantile="0.5"} 110 -decoy -1 -2 -my_summary{n1="val1",quantile="0.9"} 140 1 -my_summary_count{n1="val1"} 42 -# Latest timestamp wins in case of a summary. -my_summary_sum{n1="val1"} 4711 2 -fake_sum{n1="val1"} 2001 -# TYPE another_summary summary -another_summary_count{n2="val2",n1="val1"} 20 -my_summary_count{n2="val2",n1="val1"} 5 5 -another_summary{n1="val1",n2="val2",quantile=".3"} -1.2 -my_summary_sum{n1="val2"} 08 15 -my_summary{n1="val3", quantile="0.2"} 4711 - my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN -# some -# funny comments -# HELP -# HELP -# HELP my_summary -# HELP my_summary + +# TYPE my_summary summary +my_summary{n1="val1",quantile="0.5"} 110 +decoy -1 -2 +my_summary{n1="val1",quantile="0.9"} 140 1 +my_summary_count{n1="val1"} 42 +# Latest timestamp wins in case of a summary. +my_summary_sum{n1="val1"} 4711 2 +fake_sum{n1="val1"} 2001 +# TYPE another_summary summary +another_summary_count{n2="val2",n1="val1"} 20 +my_summary_count{n2="val2",n1="val1"} 5 5 +another_summary{n1="val1",n2="val2",quantile=".3"} -1.2 +my_summary_sum{n1="val2"} 08 15 +my_summary{n1="val3", quantile="0.2"} 4711 + my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN +# some +# funny comments +# HELP +# HELP +# HELP my_summary +# HELP my_summary diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 index 8dfca81e92..bde0a387aa 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_4 @@ -1,10 +1,10 @@ - -# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 + +# HELP request_duration_microseconds The response latency. +# TYPE request_duration_microseconds histogram +request_duration_microseconds_bucket{le="100"} 123 +request_duration_microseconds_bucket{le="120"} 412 +request_duration_microseconds_bucket{le="144"} 592 +request_duration_microseconds_bucket{le="172.8"} 1524 +request_duration_microseconds_bucket{le="+Inf"} 2693 +request_duration_microseconds_sum 1.7560473e+06 +request_duration_microseconds_count 2693 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 index 40f0e06f9b..b5fe5f5a68 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_10 @@ -1 +1 @@ -metric{label="bla"} 3.14 2 3 +metric{label="bla"} 3.14 2 3 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 index 7c508f2574..57c7fbc0bc 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_11 @@ -1 +1 @@ -metric{label="bla"} blubb +metric{label="bla"} blubb diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 index d84a59c427..0a9df79a1e 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_12 @@ -1,3 +1,3 @@ - -# HELP metric one -# HELP metric two + +# HELP metric one +# HELP metric two diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 index 226c23a44d..5bc7427813 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_13 @@ -1,3 +1,3 @@ - -# TYPE metric counter -# TYPE metric untyped + +# TYPE metric counter +# TYPE metric untyped diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 index 4b6b12e606..a9a24265b2 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_14 @@ -1,3 +1,3 @@ - -metric 4.12 -# TYPE metric counter + +metric 4.12 +# TYPE metric counter diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 index e0337efebc..7e95ca8f4c 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_15 @@ -1,2 +1,2 @@ - -# TYPE metric bla + +# TYPE metric bla diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 index e3a30e61cb..7825f88872 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_16 @@ -1,2 +1,2 @@ - -# TYPE met-ric + +# TYPE met-ric diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 index e160c33a5f..7a6ccc0dd4 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_19 @@ -1,3 +1,3 @@ - -# TYPE metric histogram -metric_bucket{le="bla"} 3.14 + +# TYPE metric histogram +metric_bucket{le="bla"} 3.14 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 index cb20d2d521..726d0017cb 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_2 @@ -1,3 +1,3 @@ - -metric{label="new -line"} 3.14 + +metric{label="new +line"} 3.14 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 index 6d8d59570c..97eafc4a65 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_7 @@ -1,3 +1,3 @@ - -# TYPE metric summary -metric{quantile="bla"} 3.14 + +# TYPE metric summary +metric{quantile="bla"} 3.14 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 index 93476e5e89..57b4879c05 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/from_test_parse_error_9 @@ -1 +1 @@ -metric{label="bla"} 3.14 2.72 +metric{label="bla"} 3.14 2.72 diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal index d2a8a82cae..be1e6a369d 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal +++ b/vendor/github.com/prometheus/common/expfmt/fuzz/corpus/minimal @@ -1 +1 @@ -m{} 0 +m{} 0 diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/json2 b/vendor/github.com/prometheus/common/expfmt/testdata/json2 index 6e1ec2872a..b914c93865 100644 --- a/vendor/github.com/prometheus/common/expfmt/testdata/json2 +++ b/vendor/github.com/prometheus/common/expfmt/testdata/json2 @@ -1,46 +1,46 @@ -[ - { - "baseLabels": { - "__name__": "rpc_calls_total", - "job": "batch_job" - }, - "docstring": "RPC calls.", - "metric": { - "type": "counter", - "value": [ - { - "labels": { - "service": "zed" - }, - "value": 25 - }, - { - "labels": { - "service": "bar" - }, - "value": 24 - } - ] - } - }, - { - "baseLabels": { - "__name__": "rpc_latency_microseconds" - }, - "docstring": "RPC latency.", - "metric": { - "type": "histogram", - "value": [ - { - "labels": { - "service": "foo" - }, - "value": { - "0.010000": 15, - "0.990000": 17 - } - } - ] - } - } -] +[ + { + "baseLabels": { + "__name__": "rpc_calls_total", + "job": "batch_job" + }, + "docstring": "RPC calls.", + "metric": { + "type": "counter", + "value": [ + { + "labels": { + "service": "zed" + }, + "value": 25 + }, + { + "labels": { + "service": "bar" + }, + "value": 24 + } + ] + } + }, + { + "baseLabels": { + "__name__": "rpc_latency_microseconds" + }, + "docstring": "RPC latency.", + "metric": { + "type": "histogram", + "value": [ + { + "labels": { + "service": "foo" + }, + "value": { + "0.010000": 15, + "0.990000": 17 + } + } + ] + } + } +] diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad b/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad index 344a56e4e5..cc6ac97c5c 100644 --- a/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad +++ b/vendor/github.com/prometheus/common/expfmt/testdata/json2_bad @@ -1,46 +1,46 @@ -[ - { - "baseLabels": { - "__name__": "rpc_calls_total", - "job": "batch_job" - }, - "docstring": "RPC calls.", - "metric": { - "type": "counter", - "value": [ - { - "labels": { - "servic|e": "zed" - }, - "value": 25 - }, - { - "labels": { - "service": "bar" - }, - "value": 24 - } - ] - } - }, - { - "baseLabels": { - "__name__": "rpc_latency_microseconds" - }, - "docstring": "RPC latency.", - "metric": { - "type": "histogram", - "value": [ - { - "labels": { - "service": "foo" - }, - "value": { - "0.010000": 15, - "0.990000": 17 - } - } - ] - } - } -] +[ + { + "baseLabels": { + "__name__": "rpc_calls_total", + "job": "batch_job" + }, + "docstring": "RPC calls.", + "metric": { + "type": "counter", + "value": [ + { + "labels": { + "servic|e": "zed" + }, + "value": 25 + }, + { + "labels": { + "service": "bar" + }, + "value": 24 + } + ] + } + }, + { + "baseLabels": { + "__name__": "rpc_latency_microseconds" + }, + "docstring": "RPC latency.", + "metric": { + "type": "histogram", + "value": [ + { + "labels": { + "service": "foo" + }, + "value": { + "0.010000": 15, + "0.990000": 17 + } + } + ] + } + } +] diff --git a/vendor/github.com/prometheus/common/expfmt/testdata/text b/vendor/github.com/prometheus/common/expfmt/testdata/text index d941d66e20..f3d8c37844 100644 --- a/vendor/github.com/prometheus/common/expfmt/testdata/text +++ b/vendor/github.com/prometheus/common/expfmt/testdata/text @@ -1,322 +1,322 @@ -# HELP http_request_duration_microseconds The HTTP request latencies in microseconds. -# TYPE http_request_duration_microseconds summary -http_request_duration_microseconds{handler="/",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/"} 0 -http_request_duration_microseconds_count{handler="/"} 0 -http_request_duration_microseconds{handler="/alerts",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/alerts",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/alerts",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/alerts"} 0 -http_request_duration_microseconds_count{handler="/alerts"} 0 -http_request_duration_microseconds{handler="/api/metrics",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/metrics",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/metrics",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/metrics"} 0 -http_request_duration_microseconds_count{handler="/api/metrics"} 0 -http_request_duration_microseconds{handler="/api/query",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/query",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/query",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/query"} 0 -http_request_duration_microseconds_count{handler="/api/query"} 0 -http_request_duration_microseconds{handler="/api/query_range",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/query_range",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/query_range",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/query_range"} 0 -http_request_duration_microseconds_count{handler="/api/query_range"} 0 -http_request_duration_microseconds{handler="/api/targets",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/api/targets",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/api/targets",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/api/targets"} 0 -http_request_duration_microseconds_count{handler="/api/targets"} 0 -http_request_duration_microseconds{handler="/consoles/",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/consoles/",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/consoles/",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/consoles/"} 0 -http_request_duration_microseconds_count{handler="/consoles/"} 0 -http_request_duration_microseconds{handler="/graph",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/graph",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/graph",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/graph"} 0 -http_request_duration_microseconds_count{handler="/graph"} 0 -http_request_duration_microseconds{handler="/heap",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/heap",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/heap",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/heap"} 0 -http_request_duration_microseconds_count{handler="/heap"} 0 -http_request_duration_microseconds{handler="/static/",quantile="0.5"} 0 -http_request_duration_microseconds{handler="/static/",quantile="0.9"} 0 -http_request_duration_microseconds{handler="/static/",quantile="0.99"} 0 -http_request_duration_microseconds_sum{handler="/static/"} 0 -http_request_duration_microseconds_count{handler="/static/"} 0 -http_request_duration_microseconds{handler="prometheus",quantile="0.5"} 1307.275 -http_request_duration_microseconds{handler="prometheus",quantile="0.9"} 1858.632 -http_request_duration_microseconds{handler="prometheus",quantile="0.99"} 3087.384 -http_request_duration_microseconds_sum{handler="prometheus"} 179886.5000000001 -http_request_duration_microseconds_count{handler="prometheus"} 119 -# HELP http_request_size_bytes The HTTP request sizes in bytes. -# TYPE http_request_size_bytes summary -http_request_size_bytes{handler="/",quantile="0.5"} 0 -http_request_size_bytes{handler="/",quantile="0.9"} 0 -http_request_size_bytes{handler="/",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/"} 0 -http_request_size_bytes_count{handler="/"} 0 -http_request_size_bytes{handler="/alerts",quantile="0.5"} 0 -http_request_size_bytes{handler="/alerts",quantile="0.9"} 0 -http_request_size_bytes{handler="/alerts",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/alerts"} 0 -http_request_size_bytes_count{handler="/alerts"} 0 -http_request_size_bytes{handler="/api/metrics",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/metrics",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/metrics",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/metrics"} 0 -http_request_size_bytes_count{handler="/api/metrics"} 0 -http_request_size_bytes{handler="/api/query",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/query",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/query",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/query"} 0 -http_request_size_bytes_count{handler="/api/query"} 0 -http_request_size_bytes{handler="/api/query_range",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/query_range",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/query_range",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/query_range"} 0 -http_request_size_bytes_count{handler="/api/query_range"} 0 -http_request_size_bytes{handler="/api/targets",quantile="0.5"} 0 -http_request_size_bytes{handler="/api/targets",quantile="0.9"} 0 -http_request_size_bytes{handler="/api/targets",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/api/targets"} 0 -http_request_size_bytes_count{handler="/api/targets"} 0 -http_request_size_bytes{handler="/consoles/",quantile="0.5"} 0 -http_request_size_bytes{handler="/consoles/",quantile="0.9"} 0 -http_request_size_bytes{handler="/consoles/",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/consoles/"} 0 -http_request_size_bytes_count{handler="/consoles/"} 0 -http_request_size_bytes{handler="/graph",quantile="0.5"} 0 -http_request_size_bytes{handler="/graph",quantile="0.9"} 0 -http_request_size_bytes{handler="/graph",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/graph"} 0 -http_request_size_bytes_count{handler="/graph"} 0 -http_request_size_bytes{handler="/heap",quantile="0.5"} 0 -http_request_size_bytes{handler="/heap",quantile="0.9"} 0 -http_request_size_bytes{handler="/heap",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/heap"} 0 -http_request_size_bytes_count{handler="/heap"} 0 -http_request_size_bytes{handler="/static/",quantile="0.5"} 0 -http_request_size_bytes{handler="/static/",quantile="0.9"} 0 -http_request_size_bytes{handler="/static/",quantile="0.99"} 0 -http_request_size_bytes_sum{handler="/static/"} 0 -http_request_size_bytes_count{handler="/static/"} 0 -http_request_size_bytes{handler="prometheus",quantile="0.5"} 291 -http_request_size_bytes{handler="prometheus",quantile="0.9"} 291 -http_request_size_bytes{handler="prometheus",quantile="0.99"} 291 -http_request_size_bytes_sum{handler="prometheus"} 34488 -http_request_size_bytes_count{handler="prometheus"} 119 -# HELP http_requests_total Total number of HTTP requests made. -# TYPE http_requests_total counter -http_requests_total{code="200",handler="prometheus",method="get"} 119 -# HELP http_response_size_bytes The HTTP response sizes in bytes. -# TYPE http_response_size_bytes summary -http_response_size_bytes{handler="/",quantile="0.5"} 0 -http_response_size_bytes{handler="/",quantile="0.9"} 0 -http_response_size_bytes{handler="/",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/"} 0 -http_response_size_bytes_count{handler="/"} 0 -http_response_size_bytes{handler="/alerts",quantile="0.5"} 0 -http_response_size_bytes{handler="/alerts",quantile="0.9"} 0 -http_response_size_bytes{handler="/alerts",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/alerts"} 0 -http_response_size_bytes_count{handler="/alerts"} 0 -http_response_size_bytes{handler="/api/metrics",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/metrics",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/metrics",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/metrics"} 0 -http_response_size_bytes_count{handler="/api/metrics"} 0 -http_response_size_bytes{handler="/api/query",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/query",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/query",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/query"} 0 -http_response_size_bytes_count{handler="/api/query"} 0 -http_response_size_bytes{handler="/api/query_range",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/query_range",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/query_range",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/query_range"} 0 -http_response_size_bytes_count{handler="/api/query_range"} 0 -http_response_size_bytes{handler="/api/targets",quantile="0.5"} 0 -http_response_size_bytes{handler="/api/targets",quantile="0.9"} 0 -http_response_size_bytes{handler="/api/targets",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/api/targets"} 0 -http_response_size_bytes_count{handler="/api/targets"} 0 -http_response_size_bytes{handler="/consoles/",quantile="0.5"} 0 -http_response_size_bytes{handler="/consoles/",quantile="0.9"} 0 -http_response_size_bytes{handler="/consoles/",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/consoles/"} 0 -http_response_size_bytes_count{handler="/consoles/"} 0 -http_response_size_bytes{handler="/graph",quantile="0.5"} 0 -http_response_size_bytes{handler="/graph",quantile="0.9"} 0 -http_response_size_bytes{handler="/graph",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/graph"} 0 -http_response_size_bytes_count{handler="/graph"} 0 -http_response_size_bytes{handler="/heap",quantile="0.5"} 0 -http_response_size_bytes{handler="/heap",quantile="0.9"} 0 -http_response_size_bytes{handler="/heap",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/heap"} 0 -http_response_size_bytes_count{handler="/heap"} 0 -http_response_size_bytes{handler="/static/",quantile="0.5"} 0 -http_response_size_bytes{handler="/static/",quantile="0.9"} 0 -http_response_size_bytes{handler="/static/",quantile="0.99"} 0 -http_response_size_bytes_sum{handler="/static/"} 0 -http_response_size_bytes_count{handler="/static/"} 0 -http_response_size_bytes{handler="prometheus",quantile="0.5"} 2049 -http_response_size_bytes{handler="prometheus",quantile="0.9"} 2058 -http_response_size_bytes{handler="prometheus",quantile="0.99"} 2064 -http_response_size_bytes_sum{handler="prometheus"} 247001 -http_response_size_bytes_count{handler="prometheus"} 119 -# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. -# TYPE process_cpu_seconds_total counter -process_cpu_seconds_total 0.55 -# HELP go_goroutines Number of goroutines that currently exist. -# TYPE go_goroutines gauge -go_goroutines 70 -# HELP process_max_fds Maximum number of open file descriptors. -# TYPE process_max_fds gauge -process_max_fds 8192 -# HELP process_open_fds Number of open file descriptors. -# TYPE process_open_fds gauge -process_open_fds 29 -# HELP process_resident_memory_bytes Resident memory size in bytes. -# TYPE process_resident_memory_bytes gauge -process_resident_memory_bytes 5.3870592e+07 -# HELP process_start_time_seconds Start time of the process since unix epoch in seconds. -# TYPE process_start_time_seconds gauge -process_start_time_seconds 1.42236894836e+09 -# HELP process_virtual_memory_bytes Virtual memory size in bytes. -# TYPE process_virtual_memory_bytes gauge -process_virtual_memory_bytes 5.41478912e+08 -# HELP prometheus_dns_sd_lookup_failures_total The number of DNS-SD lookup failures. -# TYPE prometheus_dns_sd_lookup_failures_total counter -prometheus_dns_sd_lookup_failures_total 0 -# HELP prometheus_dns_sd_lookups_total The number of DNS-SD lookups. -# TYPE prometheus_dns_sd_lookups_total counter -prometheus_dns_sd_lookups_total 7 -# HELP prometheus_evaluator_duration_milliseconds The duration for all evaluations to execute. -# TYPE prometheus_evaluator_duration_milliseconds summary -prometheus_evaluator_duration_milliseconds{quantile="0.01"} 0 -prometheus_evaluator_duration_milliseconds{quantile="0.05"} 0 -prometheus_evaluator_duration_milliseconds{quantile="0.5"} 0 -prometheus_evaluator_duration_milliseconds{quantile="0.9"} 1 -prometheus_evaluator_duration_milliseconds{quantile="0.99"} 1 -prometheus_evaluator_duration_milliseconds_sum 12 -prometheus_evaluator_duration_milliseconds_count 23 -# HELP prometheus_local_storage_checkpoint_duration_milliseconds The duration (in milliseconds) it took to checkpoint in-memory metrics and head chunks. -# TYPE prometheus_local_storage_checkpoint_duration_milliseconds gauge -prometheus_local_storage_checkpoint_duration_milliseconds 0 -# HELP prometheus_local_storage_chunk_ops_total The total number of chunk operations by their type. -# TYPE prometheus_local_storage_chunk_ops_total counter -prometheus_local_storage_chunk_ops_total{type="create"} 598 -prometheus_local_storage_chunk_ops_total{type="persist"} 174 -prometheus_local_storage_chunk_ops_total{type="pin"} 920 -prometheus_local_storage_chunk_ops_total{type="transcode"} 415 -prometheus_local_storage_chunk_ops_total{type="unpin"} 920 -# HELP prometheus_local_storage_indexing_batch_latency_milliseconds Quantiles for batch indexing latencies in milliseconds. -# TYPE prometheus_local_storage_indexing_batch_latency_milliseconds summary -prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.5"} 0 -prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.9"} 0 -prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.99"} 0 -prometheus_local_storage_indexing_batch_latency_milliseconds_sum 0 -prometheus_local_storage_indexing_batch_latency_milliseconds_count 1 -# HELP prometheus_local_storage_indexing_batch_sizes Quantiles for indexing batch sizes (number of metrics per batch). -# TYPE prometheus_local_storage_indexing_batch_sizes summary -prometheus_local_storage_indexing_batch_sizes{quantile="0.5"} 2 -prometheus_local_storage_indexing_batch_sizes{quantile="0.9"} 2 -prometheus_local_storage_indexing_batch_sizes{quantile="0.99"} 2 -prometheus_local_storage_indexing_batch_sizes_sum 2 -prometheus_local_storage_indexing_batch_sizes_count 1 -# HELP prometheus_local_storage_indexing_queue_capacity The capacity of the indexing queue. -# TYPE prometheus_local_storage_indexing_queue_capacity gauge -prometheus_local_storage_indexing_queue_capacity 16384 -# HELP prometheus_local_storage_indexing_queue_length The number of metrics waiting to be indexed. -# TYPE prometheus_local_storage_indexing_queue_length gauge -prometheus_local_storage_indexing_queue_length 0 -# HELP prometheus_local_storage_ingested_samples_total The total number of samples ingested. -# TYPE prometheus_local_storage_ingested_samples_total counter -prometheus_local_storage_ingested_samples_total 30473 -# HELP prometheus_local_storage_invalid_preload_requests_total The total number of preload requests referring to a non-existent series. This is an indication of outdated label indexes. -# TYPE prometheus_local_storage_invalid_preload_requests_total counter -prometheus_local_storage_invalid_preload_requests_total 0 -# HELP prometheus_local_storage_memory_chunkdescs The current number of chunk descriptors in memory. -# TYPE prometheus_local_storage_memory_chunkdescs gauge -prometheus_local_storage_memory_chunkdescs 1059 -# HELP prometheus_local_storage_memory_chunks The current number of chunks in memory, excluding cloned chunks (i.e. chunks without a descriptor). -# TYPE prometheus_local_storage_memory_chunks gauge -prometheus_local_storage_memory_chunks 1020 -# HELP prometheus_local_storage_memory_series The current number of series in memory. -# TYPE prometheus_local_storage_memory_series gauge -prometheus_local_storage_memory_series 424 -# HELP prometheus_local_storage_persist_latency_microseconds A summary of latencies for persisting each chunk. -# TYPE prometheus_local_storage_persist_latency_microseconds summary -prometheus_local_storage_persist_latency_microseconds{quantile="0.5"} 30.377 -prometheus_local_storage_persist_latency_microseconds{quantile="0.9"} 203.539 -prometheus_local_storage_persist_latency_microseconds{quantile="0.99"} 2626.463 -prometheus_local_storage_persist_latency_microseconds_sum 20424.415 -prometheus_local_storage_persist_latency_microseconds_count 174 -# HELP prometheus_local_storage_persist_queue_capacity The total capacity of the persist queue. -# TYPE prometheus_local_storage_persist_queue_capacity gauge -prometheus_local_storage_persist_queue_capacity 1024 -# HELP prometheus_local_storage_persist_queue_length The current number of chunks waiting in the persist queue. -# TYPE prometheus_local_storage_persist_queue_length gauge -prometheus_local_storage_persist_queue_length 0 -# HELP prometheus_local_storage_series_ops_total The total number of series operations by their type. -# TYPE prometheus_local_storage_series_ops_total counter -prometheus_local_storage_series_ops_total{type="create"} 2 -prometheus_local_storage_series_ops_total{type="maintenance_in_memory"} 11 -# HELP prometheus_notifications_latency_milliseconds Latency quantiles for sending alert notifications (not including dropped notifications). -# TYPE prometheus_notifications_latency_milliseconds summary -prometheus_notifications_latency_milliseconds{quantile="0.5"} 0 -prometheus_notifications_latency_milliseconds{quantile="0.9"} 0 -prometheus_notifications_latency_milliseconds{quantile="0.99"} 0 -prometheus_notifications_latency_milliseconds_sum 0 -prometheus_notifications_latency_milliseconds_count 0 -# HELP prometheus_notifications_queue_capacity The capacity of the alert notifications queue. -# TYPE prometheus_notifications_queue_capacity gauge -prometheus_notifications_queue_capacity 100 -# HELP prometheus_notifications_queue_length The number of alert notifications in the queue. -# TYPE prometheus_notifications_queue_length gauge -prometheus_notifications_queue_length 0 -# HELP prometheus_rule_evaluation_duration_milliseconds The duration for a rule to execute. -# TYPE prometheus_rule_evaluation_duration_milliseconds summary -prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.5"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.9"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.99"} 2 -prometheus_rule_evaluation_duration_milliseconds_sum{rule_type="alerting"} 12 -prometheus_rule_evaluation_duration_milliseconds_count{rule_type="alerting"} 115 -prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.5"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.9"} 0 -prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.99"} 3 -prometheus_rule_evaluation_duration_milliseconds_sum{rule_type="recording"} 15 -prometheus_rule_evaluation_duration_milliseconds_count{rule_type="recording"} 115 -# HELP prometheus_rule_evaluation_failures_total The total number of rule evaluation failures. -# TYPE prometheus_rule_evaluation_failures_total counter -prometheus_rule_evaluation_failures_total 0 -# HELP prometheus_samples_queue_capacity Capacity of the queue for unwritten samples. -# TYPE prometheus_samples_queue_capacity gauge -prometheus_samples_queue_capacity 4096 -# HELP prometheus_samples_queue_length Current number of items in the queue for unwritten samples. Each item comprises all samples exposed by one target as one metric family (i.e. metrics of the same name). -# TYPE prometheus_samples_queue_length gauge -prometheus_samples_queue_length 0 -# HELP prometheus_target_interval_length_seconds Actual intervals between scrapes. -# TYPE prometheus_target_interval_length_seconds summary -prometheus_target_interval_length_seconds{interval="15s",quantile="0.01"} 14 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.05"} 14 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.5"} 15 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.9"} 15 -prometheus_target_interval_length_seconds{interval="15s",quantile="0.99"} 15 -prometheus_target_interval_length_seconds_sum{interval="15s"} 175 -prometheus_target_interval_length_seconds_count{interval="15s"} 12 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.01"} 0 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.05"} 0 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.5"} 0 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.9"} 1 -prometheus_target_interval_length_seconds{interval="1s",quantile="0.99"} 1 -prometheus_target_interval_length_seconds_sum{interval="1s"} 55 -prometheus_target_interval_length_seconds_count{interval="1s"} 117 +# HELP http_request_duration_microseconds The HTTP request latencies in microseconds. +# TYPE http_request_duration_microseconds summary +http_request_duration_microseconds{handler="/",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/"} 0 +http_request_duration_microseconds_count{handler="/"} 0 +http_request_duration_microseconds{handler="/alerts",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/alerts",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/alerts",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/alerts"} 0 +http_request_duration_microseconds_count{handler="/alerts"} 0 +http_request_duration_microseconds{handler="/api/metrics",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/api/metrics",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/api/metrics",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/api/metrics"} 0 +http_request_duration_microseconds_count{handler="/api/metrics"} 0 +http_request_duration_microseconds{handler="/api/query",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/api/query",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/api/query",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/api/query"} 0 +http_request_duration_microseconds_count{handler="/api/query"} 0 +http_request_duration_microseconds{handler="/api/query_range",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/api/query_range",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/api/query_range",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/api/query_range"} 0 +http_request_duration_microseconds_count{handler="/api/query_range"} 0 +http_request_duration_microseconds{handler="/api/targets",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/api/targets",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/api/targets",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/api/targets"} 0 +http_request_duration_microseconds_count{handler="/api/targets"} 0 +http_request_duration_microseconds{handler="/consoles/",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/consoles/",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/consoles/",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/consoles/"} 0 +http_request_duration_microseconds_count{handler="/consoles/"} 0 +http_request_duration_microseconds{handler="/graph",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/graph",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/graph",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/graph"} 0 +http_request_duration_microseconds_count{handler="/graph"} 0 +http_request_duration_microseconds{handler="/heap",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/heap",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/heap",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/heap"} 0 +http_request_duration_microseconds_count{handler="/heap"} 0 +http_request_duration_microseconds{handler="/static/",quantile="0.5"} 0 +http_request_duration_microseconds{handler="/static/",quantile="0.9"} 0 +http_request_duration_microseconds{handler="/static/",quantile="0.99"} 0 +http_request_duration_microseconds_sum{handler="/static/"} 0 +http_request_duration_microseconds_count{handler="/static/"} 0 +http_request_duration_microseconds{handler="prometheus",quantile="0.5"} 1307.275 +http_request_duration_microseconds{handler="prometheus",quantile="0.9"} 1858.632 +http_request_duration_microseconds{handler="prometheus",quantile="0.99"} 3087.384 +http_request_duration_microseconds_sum{handler="prometheus"} 179886.5000000001 +http_request_duration_microseconds_count{handler="prometheus"} 119 +# HELP http_request_size_bytes The HTTP request sizes in bytes. +# TYPE http_request_size_bytes summary +http_request_size_bytes{handler="/",quantile="0.5"} 0 +http_request_size_bytes{handler="/",quantile="0.9"} 0 +http_request_size_bytes{handler="/",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/"} 0 +http_request_size_bytes_count{handler="/"} 0 +http_request_size_bytes{handler="/alerts",quantile="0.5"} 0 +http_request_size_bytes{handler="/alerts",quantile="0.9"} 0 +http_request_size_bytes{handler="/alerts",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/alerts"} 0 +http_request_size_bytes_count{handler="/alerts"} 0 +http_request_size_bytes{handler="/api/metrics",quantile="0.5"} 0 +http_request_size_bytes{handler="/api/metrics",quantile="0.9"} 0 +http_request_size_bytes{handler="/api/metrics",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/api/metrics"} 0 +http_request_size_bytes_count{handler="/api/metrics"} 0 +http_request_size_bytes{handler="/api/query",quantile="0.5"} 0 +http_request_size_bytes{handler="/api/query",quantile="0.9"} 0 +http_request_size_bytes{handler="/api/query",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/api/query"} 0 +http_request_size_bytes_count{handler="/api/query"} 0 +http_request_size_bytes{handler="/api/query_range",quantile="0.5"} 0 +http_request_size_bytes{handler="/api/query_range",quantile="0.9"} 0 +http_request_size_bytes{handler="/api/query_range",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/api/query_range"} 0 +http_request_size_bytes_count{handler="/api/query_range"} 0 +http_request_size_bytes{handler="/api/targets",quantile="0.5"} 0 +http_request_size_bytes{handler="/api/targets",quantile="0.9"} 0 +http_request_size_bytes{handler="/api/targets",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/api/targets"} 0 +http_request_size_bytes_count{handler="/api/targets"} 0 +http_request_size_bytes{handler="/consoles/",quantile="0.5"} 0 +http_request_size_bytes{handler="/consoles/",quantile="0.9"} 0 +http_request_size_bytes{handler="/consoles/",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/consoles/"} 0 +http_request_size_bytes_count{handler="/consoles/"} 0 +http_request_size_bytes{handler="/graph",quantile="0.5"} 0 +http_request_size_bytes{handler="/graph",quantile="0.9"} 0 +http_request_size_bytes{handler="/graph",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/graph"} 0 +http_request_size_bytes_count{handler="/graph"} 0 +http_request_size_bytes{handler="/heap",quantile="0.5"} 0 +http_request_size_bytes{handler="/heap",quantile="0.9"} 0 +http_request_size_bytes{handler="/heap",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/heap"} 0 +http_request_size_bytes_count{handler="/heap"} 0 +http_request_size_bytes{handler="/static/",quantile="0.5"} 0 +http_request_size_bytes{handler="/static/",quantile="0.9"} 0 +http_request_size_bytes{handler="/static/",quantile="0.99"} 0 +http_request_size_bytes_sum{handler="/static/"} 0 +http_request_size_bytes_count{handler="/static/"} 0 +http_request_size_bytes{handler="prometheus",quantile="0.5"} 291 +http_request_size_bytes{handler="prometheus",quantile="0.9"} 291 +http_request_size_bytes{handler="prometheus",quantile="0.99"} 291 +http_request_size_bytes_sum{handler="prometheus"} 34488 +http_request_size_bytes_count{handler="prometheus"} 119 +# HELP http_requests_total Total number of HTTP requests made. +# TYPE http_requests_total counter +http_requests_total{code="200",handler="prometheus",method="get"} 119 +# HELP http_response_size_bytes The HTTP response sizes in bytes. +# TYPE http_response_size_bytes summary +http_response_size_bytes{handler="/",quantile="0.5"} 0 +http_response_size_bytes{handler="/",quantile="0.9"} 0 +http_response_size_bytes{handler="/",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/"} 0 +http_response_size_bytes_count{handler="/"} 0 +http_response_size_bytes{handler="/alerts",quantile="0.5"} 0 +http_response_size_bytes{handler="/alerts",quantile="0.9"} 0 +http_response_size_bytes{handler="/alerts",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/alerts"} 0 +http_response_size_bytes_count{handler="/alerts"} 0 +http_response_size_bytes{handler="/api/metrics",quantile="0.5"} 0 +http_response_size_bytes{handler="/api/metrics",quantile="0.9"} 0 +http_response_size_bytes{handler="/api/metrics",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/api/metrics"} 0 +http_response_size_bytes_count{handler="/api/metrics"} 0 +http_response_size_bytes{handler="/api/query",quantile="0.5"} 0 +http_response_size_bytes{handler="/api/query",quantile="0.9"} 0 +http_response_size_bytes{handler="/api/query",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/api/query"} 0 +http_response_size_bytes_count{handler="/api/query"} 0 +http_response_size_bytes{handler="/api/query_range",quantile="0.5"} 0 +http_response_size_bytes{handler="/api/query_range",quantile="0.9"} 0 +http_response_size_bytes{handler="/api/query_range",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/api/query_range"} 0 +http_response_size_bytes_count{handler="/api/query_range"} 0 +http_response_size_bytes{handler="/api/targets",quantile="0.5"} 0 +http_response_size_bytes{handler="/api/targets",quantile="0.9"} 0 +http_response_size_bytes{handler="/api/targets",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/api/targets"} 0 +http_response_size_bytes_count{handler="/api/targets"} 0 +http_response_size_bytes{handler="/consoles/",quantile="0.5"} 0 +http_response_size_bytes{handler="/consoles/",quantile="0.9"} 0 +http_response_size_bytes{handler="/consoles/",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/consoles/"} 0 +http_response_size_bytes_count{handler="/consoles/"} 0 +http_response_size_bytes{handler="/graph",quantile="0.5"} 0 +http_response_size_bytes{handler="/graph",quantile="0.9"} 0 +http_response_size_bytes{handler="/graph",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/graph"} 0 +http_response_size_bytes_count{handler="/graph"} 0 +http_response_size_bytes{handler="/heap",quantile="0.5"} 0 +http_response_size_bytes{handler="/heap",quantile="0.9"} 0 +http_response_size_bytes{handler="/heap",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/heap"} 0 +http_response_size_bytes_count{handler="/heap"} 0 +http_response_size_bytes{handler="/static/",quantile="0.5"} 0 +http_response_size_bytes{handler="/static/",quantile="0.9"} 0 +http_response_size_bytes{handler="/static/",quantile="0.99"} 0 +http_response_size_bytes_sum{handler="/static/"} 0 +http_response_size_bytes_count{handler="/static/"} 0 +http_response_size_bytes{handler="prometheus",quantile="0.5"} 2049 +http_response_size_bytes{handler="prometheus",quantile="0.9"} 2058 +http_response_size_bytes{handler="prometheus",quantile="0.99"} 2064 +http_response_size_bytes_sum{handler="prometheus"} 247001 +http_response_size_bytes_count{handler="prometheus"} 119 +# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. +# TYPE process_cpu_seconds_total counter +process_cpu_seconds_total 0.55 +# HELP go_goroutines Number of goroutines that currently exist. +# TYPE go_goroutines gauge +go_goroutines 70 +# HELP process_max_fds Maximum number of open file descriptors. +# TYPE process_max_fds gauge +process_max_fds 8192 +# HELP process_open_fds Number of open file descriptors. +# TYPE process_open_fds gauge +process_open_fds 29 +# HELP process_resident_memory_bytes Resident memory size in bytes. +# TYPE process_resident_memory_bytes gauge +process_resident_memory_bytes 5.3870592e+07 +# HELP process_start_time_seconds Start time of the process since unix epoch in seconds. +# TYPE process_start_time_seconds gauge +process_start_time_seconds 1.42236894836e+09 +# HELP process_virtual_memory_bytes Virtual memory size in bytes. +# TYPE process_virtual_memory_bytes gauge +process_virtual_memory_bytes 5.41478912e+08 +# HELP prometheus_dns_sd_lookup_failures_total The number of DNS-SD lookup failures. +# TYPE prometheus_dns_sd_lookup_failures_total counter +prometheus_dns_sd_lookup_failures_total 0 +# HELP prometheus_dns_sd_lookups_total The number of DNS-SD lookups. +# TYPE prometheus_dns_sd_lookups_total counter +prometheus_dns_sd_lookups_total 7 +# HELP prometheus_evaluator_duration_milliseconds The duration for all evaluations to execute. +# TYPE prometheus_evaluator_duration_milliseconds summary +prometheus_evaluator_duration_milliseconds{quantile="0.01"} 0 +prometheus_evaluator_duration_milliseconds{quantile="0.05"} 0 +prometheus_evaluator_duration_milliseconds{quantile="0.5"} 0 +prometheus_evaluator_duration_milliseconds{quantile="0.9"} 1 +prometheus_evaluator_duration_milliseconds{quantile="0.99"} 1 +prometheus_evaluator_duration_milliseconds_sum 12 +prometheus_evaluator_duration_milliseconds_count 23 +# HELP prometheus_local_storage_checkpoint_duration_milliseconds The duration (in milliseconds) it took to checkpoint in-memory metrics and head chunks. +# TYPE prometheus_local_storage_checkpoint_duration_milliseconds gauge +prometheus_local_storage_checkpoint_duration_milliseconds 0 +# HELP prometheus_local_storage_chunk_ops_total The total number of chunk operations by their type. +# TYPE prometheus_local_storage_chunk_ops_total counter +prometheus_local_storage_chunk_ops_total{type="create"} 598 +prometheus_local_storage_chunk_ops_total{type="persist"} 174 +prometheus_local_storage_chunk_ops_total{type="pin"} 920 +prometheus_local_storage_chunk_ops_total{type="transcode"} 415 +prometheus_local_storage_chunk_ops_total{type="unpin"} 920 +# HELP prometheus_local_storage_indexing_batch_latency_milliseconds Quantiles for batch indexing latencies in milliseconds. +# TYPE prometheus_local_storage_indexing_batch_latency_milliseconds summary +prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.5"} 0 +prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.9"} 0 +prometheus_local_storage_indexing_batch_latency_milliseconds{quantile="0.99"} 0 +prometheus_local_storage_indexing_batch_latency_milliseconds_sum 0 +prometheus_local_storage_indexing_batch_latency_milliseconds_count 1 +# HELP prometheus_local_storage_indexing_batch_sizes Quantiles for indexing batch sizes (number of metrics per batch). +# TYPE prometheus_local_storage_indexing_batch_sizes summary +prometheus_local_storage_indexing_batch_sizes{quantile="0.5"} 2 +prometheus_local_storage_indexing_batch_sizes{quantile="0.9"} 2 +prometheus_local_storage_indexing_batch_sizes{quantile="0.99"} 2 +prometheus_local_storage_indexing_batch_sizes_sum 2 +prometheus_local_storage_indexing_batch_sizes_count 1 +# HELP prometheus_local_storage_indexing_queue_capacity The capacity of the indexing queue. +# TYPE prometheus_local_storage_indexing_queue_capacity gauge +prometheus_local_storage_indexing_queue_capacity 16384 +# HELP prometheus_local_storage_indexing_queue_length The number of metrics waiting to be indexed. +# TYPE prometheus_local_storage_indexing_queue_length gauge +prometheus_local_storage_indexing_queue_length 0 +# HELP prometheus_local_storage_ingested_samples_total The total number of samples ingested. +# TYPE prometheus_local_storage_ingested_samples_total counter +prometheus_local_storage_ingested_samples_total 30473 +# HELP prometheus_local_storage_invalid_preload_requests_total The total number of preload requests referring to a non-existent series. This is an indication of outdated label indexes. +# TYPE prometheus_local_storage_invalid_preload_requests_total counter +prometheus_local_storage_invalid_preload_requests_total 0 +# HELP prometheus_local_storage_memory_chunkdescs The current number of chunk descriptors in memory. +# TYPE prometheus_local_storage_memory_chunkdescs gauge +prometheus_local_storage_memory_chunkdescs 1059 +# HELP prometheus_local_storage_memory_chunks The current number of chunks in memory, excluding cloned chunks (i.e. chunks without a descriptor). +# TYPE prometheus_local_storage_memory_chunks gauge +prometheus_local_storage_memory_chunks 1020 +# HELP prometheus_local_storage_memory_series The current number of series in memory. +# TYPE prometheus_local_storage_memory_series gauge +prometheus_local_storage_memory_series 424 +# HELP prometheus_local_storage_persist_latency_microseconds A summary of latencies for persisting each chunk. +# TYPE prometheus_local_storage_persist_latency_microseconds summary +prometheus_local_storage_persist_latency_microseconds{quantile="0.5"} 30.377 +prometheus_local_storage_persist_latency_microseconds{quantile="0.9"} 203.539 +prometheus_local_storage_persist_latency_microseconds{quantile="0.99"} 2626.463 +prometheus_local_storage_persist_latency_microseconds_sum 20424.415 +prometheus_local_storage_persist_latency_microseconds_count 174 +# HELP prometheus_local_storage_persist_queue_capacity The total capacity of the persist queue. +# TYPE prometheus_local_storage_persist_queue_capacity gauge +prometheus_local_storage_persist_queue_capacity 1024 +# HELP prometheus_local_storage_persist_queue_length The current number of chunks waiting in the persist queue. +# TYPE prometheus_local_storage_persist_queue_length gauge +prometheus_local_storage_persist_queue_length 0 +# HELP prometheus_local_storage_series_ops_total The total number of series operations by their type. +# TYPE prometheus_local_storage_series_ops_total counter +prometheus_local_storage_series_ops_total{type="create"} 2 +prometheus_local_storage_series_ops_total{type="maintenance_in_memory"} 11 +# HELP prometheus_notifications_latency_milliseconds Latency quantiles for sending alert notifications (not including dropped notifications). +# TYPE prometheus_notifications_latency_milliseconds summary +prometheus_notifications_latency_milliseconds{quantile="0.5"} 0 +prometheus_notifications_latency_milliseconds{quantile="0.9"} 0 +prometheus_notifications_latency_milliseconds{quantile="0.99"} 0 +prometheus_notifications_latency_milliseconds_sum 0 +prometheus_notifications_latency_milliseconds_count 0 +# HELP prometheus_notifications_queue_capacity The capacity of the alert notifications queue. +# TYPE prometheus_notifications_queue_capacity gauge +prometheus_notifications_queue_capacity 100 +# HELP prometheus_notifications_queue_length The number of alert notifications in the queue. +# TYPE prometheus_notifications_queue_length gauge +prometheus_notifications_queue_length 0 +# HELP prometheus_rule_evaluation_duration_milliseconds The duration for a rule to execute. +# TYPE prometheus_rule_evaluation_duration_milliseconds summary +prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.5"} 0 +prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.9"} 0 +prometheus_rule_evaluation_duration_milliseconds{rule_type="alerting",quantile="0.99"} 2 +prometheus_rule_evaluation_duration_milliseconds_sum{rule_type="alerting"} 12 +prometheus_rule_evaluation_duration_milliseconds_count{rule_type="alerting"} 115 +prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.5"} 0 +prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.9"} 0 +prometheus_rule_evaluation_duration_milliseconds{rule_type="recording",quantile="0.99"} 3 +prometheus_rule_evaluation_duration_milliseconds_sum{rule_type="recording"} 15 +prometheus_rule_evaluation_duration_milliseconds_count{rule_type="recording"} 115 +# HELP prometheus_rule_evaluation_failures_total The total number of rule evaluation failures. +# TYPE prometheus_rule_evaluation_failures_total counter +prometheus_rule_evaluation_failures_total 0 +# HELP prometheus_samples_queue_capacity Capacity of the queue for unwritten samples. +# TYPE prometheus_samples_queue_capacity gauge +prometheus_samples_queue_capacity 4096 +# HELP prometheus_samples_queue_length Current number of items in the queue for unwritten samples. Each item comprises all samples exposed by one target as one metric family (i.e. metrics of the same name). +# TYPE prometheus_samples_queue_length gauge +prometheus_samples_queue_length 0 +# HELP prometheus_target_interval_length_seconds Actual intervals between scrapes. +# TYPE prometheus_target_interval_length_seconds summary +prometheus_target_interval_length_seconds{interval="15s",quantile="0.01"} 14 +prometheus_target_interval_length_seconds{interval="15s",quantile="0.05"} 14 +prometheus_target_interval_length_seconds{interval="15s",quantile="0.5"} 15 +prometheus_target_interval_length_seconds{interval="15s",quantile="0.9"} 15 +prometheus_target_interval_length_seconds{interval="15s",quantile="0.99"} 15 +prometheus_target_interval_length_seconds_sum{interval="15s"} 175 +prometheus_target_interval_length_seconds_count{interval="15s"} 12 +prometheus_target_interval_length_seconds{interval="1s",quantile="0.01"} 0 +prometheus_target_interval_length_seconds{interval="1s",quantile="0.05"} 0 +prometheus_target_interval_length_seconds{interval="1s",quantile="0.5"} 0 +prometheus_target_interval_length_seconds{interval="1s",quantile="0.9"} 1 +prometheus_target_interval_length_seconds{interval="1s",quantile="0.99"} 1 +prometheus_target_interval_length_seconds_sum{interval="1s"} 55 +prometheus_target_interval_length_seconds_count{interval="1s"} 117 diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index df41ba4a83..f11321cd0c 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -1,303 +1,303 @@ -// Copyright 2014 The Prometheus Authors -// 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 expfmt - -import ( - "fmt" - "io" - "math" - "strings" - - dto "github.com/prometheus/client_model/go" - "github.com/prometheus/common/model" -) - -// MetricFamilyToText converts a MetricFamily proto message into text format and -// writes the resulting lines to 'out'. It returns the number of bytes written -// and any error encountered. The output will have the same order as the input, -// no further sorting is performed. Furthermore, this function assumes the input -// is already sanitized and does not perform any sanity checks. If the input -// contains duplicate metrics or invalid metric or label names, the conversion -// will result in invalid text format output. -// -// This method fulfills the type 'prometheus.encoder'. -func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { - var written int - - // Fail-fast checks. - if len(in.Metric) == 0 { - return written, fmt.Errorf("MetricFamily has no metrics: %s", in) - } - name := in.GetName() - if name == "" { - return written, fmt.Errorf("MetricFamily has no name: %s", in) - } - - // Comments, first HELP, then TYPE. - if in.Help != nil { - n, err := fmt.Fprintf( - out, "# HELP %s %s\n", - name, escapeString(*in.Help, false), - ) - written += n - if err != nil { - return written, err - } - } - metricType := in.GetType() - n, err := fmt.Fprintf( - out, "# TYPE %s %s\n", - name, strings.ToLower(metricType.String()), - ) - written += n - if err != nil { - return written, err - } - - // Finally the samples, one line for each. - for _, metric := range in.Metric { - switch metricType { - case dto.MetricType_COUNTER: - if metric.Counter == nil { - return written, fmt.Errorf( - "expected counter in metric %s %s", name, metric, - ) - } - n, err = writeSample( - name, metric, "", "", - metric.Counter.GetValue(), - out, - ) - case dto.MetricType_GAUGE: - if metric.Gauge == nil { - return written, fmt.Errorf( - "expected gauge in metric %s %s", name, metric, - ) - } - n, err = writeSample( - name, metric, "", "", - metric.Gauge.GetValue(), - out, - ) - case dto.MetricType_UNTYPED: - if metric.Untyped == nil { - return written, fmt.Errorf( - "expected untyped in metric %s %s", name, metric, - ) - } - n, err = writeSample( - name, metric, "", "", - metric.Untyped.GetValue(), - out, - ) - case dto.MetricType_SUMMARY: - if metric.Summary == nil { - return written, fmt.Errorf( - "expected summary in metric %s %s", name, metric, - ) - } - for _, q := range metric.Summary.Quantile { - n, err = writeSample( - name, metric, - model.QuantileLabel, fmt.Sprint(q.GetQuantile()), - q.GetValue(), - out, - ) - written += n - if err != nil { - return written, err - } - } - n, err = writeSample( - name+"_sum", metric, "", "", - metric.Summary.GetSampleSum(), - out, - ) - if err != nil { - return written, err - } - written += n - n, err = writeSample( - name+"_count", metric, "", "", - float64(metric.Summary.GetSampleCount()), - out, - ) - case dto.MetricType_HISTOGRAM: - if metric.Histogram == nil { - return written, fmt.Errorf( - "expected histogram in metric %s %s", name, metric, - ) - } - infSeen := false - for _, q := range metric.Histogram.Bucket { - n, err = writeSample( - name+"_bucket", metric, - model.BucketLabel, fmt.Sprint(q.GetUpperBound()), - float64(q.GetCumulativeCount()), - out, - ) - written += n - if err != nil { - return written, err - } - if math.IsInf(q.GetUpperBound(), +1) { - infSeen = true - } - } - if !infSeen { - n, err = writeSample( - name+"_bucket", metric, - model.BucketLabel, "+Inf", - float64(metric.Histogram.GetSampleCount()), - out, - ) - if err != nil { - return written, err - } - written += n - } - n, err = writeSample( - name+"_sum", metric, "", "", - metric.Histogram.GetSampleSum(), - out, - ) - if err != nil { - return written, err - } - written += n - n, err = writeSample( - name+"_count", metric, "", "", - float64(metric.Histogram.GetSampleCount()), - out, - ) - default: - return written, fmt.Errorf( - "unexpected type in metric %s %s", name, metric, - ) - } - written += n - if err != nil { - return written, err - } - } - return written, nil -} - -// writeSample writes a single sample in text format to out, given the metric -// name, the metric proto message itself, optionally an additional label name -// and value (use empty strings if not required), and the value. The function -// returns the number of bytes written and any error encountered. -func writeSample( - name string, - metric *dto.Metric, - additionalLabelName, additionalLabelValue string, - value float64, - out io.Writer, -) (int, error) { - var written int - n, err := fmt.Fprint(out, name) - written += n - if err != nil { - return written, err - } - n, err = labelPairsToText( - metric.Label, - additionalLabelName, additionalLabelValue, - out, - ) - written += n - if err != nil { - return written, err - } - n, err = fmt.Fprintf(out, " %v", value) - written += n - if err != nil { - return written, err - } - if metric.TimestampMs != nil { - n, err = fmt.Fprintf(out, " %v", *metric.TimestampMs) - written += n - if err != nil { - return written, err - } - } - n, err = out.Write([]byte{'\n'}) - written += n - if err != nil { - return written, err - } - return written, nil -} - -// labelPairsToText converts a slice of LabelPair proto messages plus the -// explicitly given additional label pair into text formatted as required by the -// text format and writes it to 'out'. An empty slice in combination with an -// empty string 'additionalLabelName' results in nothing being -// written. Otherwise, the label pairs are written, escaped as required by the -// text format, and enclosed in '{...}'. The function returns the number of -// bytes written and any error encountered. -func labelPairsToText( - in []*dto.LabelPair, - additionalLabelName, additionalLabelValue string, - out io.Writer, -) (int, error) { - if len(in) == 0 && additionalLabelName == "" { - return 0, nil - } - var written int - separator := '{' - for _, lp := range in { - n, err := fmt.Fprintf( - out, `%c%s="%s"`, - separator, lp.GetName(), escapeString(lp.GetValue(), true), - ) - written += n - if err != nil { - return written, err - } - separator = ',' - } - if additionalLabelName != "" { - n, err := fmt.Fprintf( - out, `%c%s="%s"`, - separator, additionalLabelName, - escapeString(additionalLabelValue, true), - ) - written += n - if err != nil { - return written, err - } - } - n, err := out.Write([]byte{'}'}) - written += n - if err != nil { - return written, err - } - return written, nil -} - -var ( - escape = strings.NewReplacer("\\", `\\`, "\n", `\n`) - escapeWithDoubleQuote = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`) -) - -// escapeString replaces '\' by '\\', new line character by '\n', and - if -// includeDoubleQuote is true - '"' by '\"'. -func escapeString(v string, includeDoubleQuote bool) string { - if includeDoubleQuote { - return escapeWithDoubleQuote.Replace(v) - } - - return escape.Replace(v) -} +// Copyright 2014 The Prometheus Authors +// 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 expfmt + +import ( + "fmt" + "io" + "math" + "strings" + + dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/model" +) + +// MetricFamilyToText converts a MetricFamily proto message into text format and +// writes the resulting lines to 'out'. It returns the number of bytes written +// and any error encountered. The output will have the same order as the input, +// no further sorting is performed. Furthermore, this function assumes the input +// is already sanitized and does not perform any sanity checks. If the input +// contains duplicate metrics or invalid metric or label names, the conversion +// will result in invalid text format output. +// +// This method fulfills the type 'prometheus.encoder'. +func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { + var written int + + // Fail-fast checks. + if len(in.Metric) == 0 { + return written, fmt.Errorf("MetricFamily has no metrics: %s", in) + } + name := in.GetName() + if name == "" { + return written, fmt.Errorf("MetricFamily has no name: %s", in) + } + + // Comments, first HELP, then TYPE. + if in.Help != nil { + n, err := fmt.Fprintf( + out, "# HELP %s %s\n", + name, escapeString(*in.Help, false), + ) + written += n + if err != nil { + return written, err + } + } + metricType := in.GetType() + n, err := fmt.Fprintf( + out, "# TYPE %s %s\n", + name, strings.ToLower(metricType.String()), + ) + written += n + if err != nil { + return written, err + } + + // Finally the samples, one line for each. + for _, metric := range in.Metric { + switch metricType { + case dto.MetricType_COUNTER: + if metric.Counter == nil { + return written, fmt.Errorf( + "expected counter in metric %s %s", name, metric, + ) + } + n, err = writeSample( + name, metric, "", "", + metric.Counter.GetValue(), + out, + ) + case dto.MetricType_GAUGE: + if metric.Gauge == nil { + return written, fmt.Errorf( + "expected gauge in metric %s %s", name, metric, + ) + } + n, err = writeSample( + name, metric, "", "", + metric.Gauge.GetValue(), + out, + ) + case dto.MetricType_UNTYPED: + if metric.Untyped == nil { + return written, fmt.Errorf( + "expected untyped in metric %s %s", name, metric, + ) + } + n, err = writeSample( + name, metric, "", "", + metric.Untyped.GetValue(), + out, + ) + case dto.MetricType_SUMMARY: + if metric.Summary == nil { + return written, fmt.Errorf( + "expected summary in metric %s %s", name, metric, + ) + } + for _, q := range metric.Summary.Quantile { + n, err = writeSample( + name, metric, + model.QuantileLabel, fmt.Sprint(q.GetQuantile()), + q.GetValue(), + out, + ) + written += n + if err != nil { + return written, err + } + } + n, err = writeSample( + name+"_sum", metric, "", "", + metric.Summary.GetSampleSum(), + out, + ) + if err != nil { + return written, err + } + written += n + n, err = writeSample( + name+"_count", metric, "", "", + float64(metric.Summary.GetSampleCount()), + out, + ) + case dto.MetricType_HISTOGRAM: + if metric.Histogram == nil { + return written, fmt.Errorf( + "expected histogram in metric %s %s", name, metric, + ) + } + infSeen := false + for _, q := range metric.Histogram.Bucket { + n, err = writeSample( + name+"_bucket", metric, + model.BucketLabel, fmt.Sprint(q.GetUpperBound()), + float64(q.GetCumulativeCount()), + out, + ) + written += n + if err != nil { + return written, err + } + if math.IsInf(q.GetUpperBound(), +1) { + infSeen = true + } + } + if !infSeen { + n, err = writeSample( + name+"_bucket", metric, + model.BucketLabel, "+Inf", + float64(metric.Histogram.GetSampleCount()), + out, + ) + if err != nil { + return written, err + } + written += n + } + n, err = writeSample( + name+"_sum", metric, "", "", + metric.Histogram.GetSampleSum(), + out, + ) + if err != nil { + return written, err + } + written += n + n, err = writeSample( + name+"_count", metric, "", "", + float64(metric.Histogram.GetSampleCount()), + out, + ) + default: + return written, fmt.Errorf( + "unexpected type in metric %s %s", name, metric, + ) + } + written += n + if err != nil { + return written, err + } + } + return written, nil +} + +// writeSample writes a single sample in text format to out, given the metric +// name, the metric proto message itself, optionally an additional label name +// and value (use empty strings if not required), and the value. The function +// returns the number of bytes written and any error encountered. +func writeSample( + name string, + metric *dto.Metric, + additionalLabelName, additionalLabelValue string, + value float64, + out io.Writer, +) (int, error) { + var written int + n, err := fmt.Fprint(out, name) + written += n + if err != nil { + return written, err + } + n, err = labelPairsToText( + metric.Label, + additionalLabelName, additionalLabelValue, + out, + ) + written += n + if err != nil { + return written, err + } + n, err = fmt.Fprintf(out, " %v", value) + written += n + if err != nil { + return written, err + } + if metric.TimestampMs != nil { + n, err = fmt.Fprintf(out, " %v", *metric.TimestampMs) + written += n + if err != nil { + return written, err + } + } + n, err = out.Write([]byte{'\n'}) + written += n + if err != nil { + return written, err + } + return written, nil +} + +// labelPairsToText converts a slice of LabelPair proto messages plus the +// explicitly given additional label pair into text formatted as required by the +// text format and writes it to 'out'. An empty slice in combination with an +// empty string 'additionalLabelName' results in nothing being +// written. Otherwise, the label pairs are written, escaped as required by the +// text format, and enclosed in '{...}'. The function returns the number of +// bytes written and any error encountered. +func labelPairsToText( + in []*dto.LabelPair, + additionalLabelName, additionalLabelValue string, + out io.Writer, +) (int, error) { + if len(in) == 0 && additionalLabelName == "" { + return 0, nil + } + var written int + separator := '{' + for _, lp := range in { + n, err := fmt.Fprintf( + out, `%c%s="%s"`, + separator, lp.GetName(), escapeString(lp.GetValue(), true), + ) + written += n + if err != nil { + return written, err + } + separator = ',' + } + if additionalLabelName != "" { + n, err := fmt.Fprintf( + out, `%c%s="%s"`, + separator, additionalLabelName, + escapeString(additionalLabelValue, true), + ) + written += n + if err != nil { + return written, err + } + } + n, err := out.Write([]byte{'}'}) + written += n + if err != nil { + return written, err + } + return written, nil +} + +var ( + escape = strings.NewReplacer("\\", `\\`, "\n", `\n`) + escapeWithDoubleQuote = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`) +) + +// escapeString replaces '\' by '\\', new line character by '\n', and - if +// includeDoubleQuote is true - '"' by '\"'. +func escapeString(v string, includeDoubleQuote bool) string { + if includeDoubleQuote { + return escapeWithDoubleQuote.Replace(v) + } + + return escape.Replace(v) +} diff --git a/vendor/github.com/prometheus/common/expfmt/text_create_test.go b/vendor/github.com/prometheus/common/expfmt/text_create_test.go index 0b9d8e136f..e4cc5d803b 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create_test.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create_test.go @@ -1,443 +1,443 @@ -// Copyright 2014 The Prometheus Authors -// 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 expfmt - -import ( - "bytes" - "math" - "strings" - "testing" - - "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" -) - -func testCreate(t testing.TB) { - var scenarios = []struct { - in *dto.MetricFamily - out string - }{ - // 0: Counter, NaN as value, timestamp given. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("two-line\n doc str\\ing"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(math.NaN()), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(.23), - }, - TimestampMs: proto.Int64(1234567890), - }, - }, - }, - out: `# HELP name two-line\n doc str\\ing -# TYPE name counter -name{labelname="val1",basename="basevalue"} NaN -name{labelname="val2",basename="basevalue"} 0.23 1234567890 -`, - }, - // 1: Gauge, some escaping required, +Inf as value, multi-byte characters in label values. - { - in: &dto.MetricFamily{ - Name: proto.String("gauge_name"), - Help: proto.String("gauge\ndoc\nstr\"ing"), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("val with\nnew line"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("val with \\backslash and \"quotes\""), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(math.Inf(+1)), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("Björn"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("佖佥"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(3.14E42), - }, - }, - }, - }, - out: `# HELP gauge_name gauge\ndoc\nstr"ing -# TYPE gauge_name gauge -gauge_name{name_1="val with\nnew line",name_2="val with \\backslash and \"quotes\""} +Inf -gauge_name{name_1="Björn",name_2="佖佥"} 3.14e+42 -`, - }, - // 2: Untyped, no help, one sample with no labels and -Inf as value, another sample with one label. - { - in: &dto.MetricFamily{ - Name: proto.String("untyped_name"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("value 1"), - }, - }, - Untyped: &dto.Untyped{ - Value: proto.Float64(-1.23e-45), - }, - }, - }, - }, - out: `# TYPE untyped_name untyped -untyped_name -Inf -untyped_name{name_1="value 1"} -1.23e-45 -`, - }, - // 3: Summary. - { - in: &dto.MetricFamily{ - Name: proto.String("summary_name"), - Help: proto.String("summary docstring"), - Type: dto.MetricType_SUMMARY.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Summary: &dto.Summary{ - SampleCount: proto.Uint64(42), - SampleSum: proto.Float64(-3.4567), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.5), - Value: proto.Float64(-1.23), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.9), - Value: proto.Float64(.2342354), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.99), - Value: proto.Float64(0), - }, - }, - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("name_1"), - Value: proto.String("value 1"), - }, - &dto.LabelPair{ - Name: proto.String("name_2"), - Value: proto.String("value 2"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(4711), - SampleSum: proto.Float64(2010.1971), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.5), - Value: proto.Float64(1), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.9), - Value: proto.Float64(2), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.99), - Value: proto.Float64(3), - }, - }, - }, - }, - }, - }, - out: `# HELP summary_name summary docstring -# TYPE summary_name summary -summary_name{quantile="0.5"} -1.23 -summary_name{quantile="0.9"} 0.2342354 -summary_name{quantile="0.99"} 0 -summary_name_sum -3.4567 -summary_name_count 42 -summary_name{name_1="value 1",name_2="value 2",quantile="0.5"} 1 -summary_name{name_1="value 1",name_2="value 2",quantile="0.9"} 2 -summary_name{name_1="value 1",name_2="value 2",quantile="0.99"} 3 -summary_name_sum{name_1="value 1",name_2="value 2"} 2010.1971 -summary_name_count{name_1="value 1",name_2="value 2"} 4711 -`, - }, - // 4: Histogram - { - in: &dto.MetricFamily{ - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - &dto.Bucket{ - UpperBound: proto.Float64(math.Inf(+1)), - CumulativeCount: proto.Uint64(2693), - }, - }, - }, - }, - }, - }, - out: `# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 -`, - }, - // 5: Histogram with missing +Inf bucket. - { - in: &dto.MetricFamily{ - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - }, - }, - }, - }, - }, - out: `# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 -`, - }, - // 6: No metric type, should result in default type Counter. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("doc string"), - Metric: []*dto.Metric{ - &dto.Metric{ - Counter: &dto.Counter{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - out: `# HELP name doc string -# TYPE name counter -name -Inf -`, - }, - } - - for i, scenario := range scenarios { - out := bytes.NewBuffer(make([]byte, 0, len(scenario.out))) - n, err := MetricFamilyToText(out, scenario.in) - if err != nil { - t.Errorf("%d. error: %s", i, err) - continue - } - if expected, got := len(scenario.out), n; expected != got { - t.Errorf( - "%d. expected %d bytes written, got %d", - i, expected, got, - ) - } - if expected, got := scenario.out, out.String(); expected != got { - t.Errorf( - "%d. expected out=%q, got %q", - i, expected, got, - ) - } - } - -} - -func TestCreate(t *testing.T) { - testCreate(t) -} - -func BenchmarkCreate(b *testing.B) { - for i := 0; i < b.N; i++ { - testCreate(b) - } -} - -func testCreateError(t testing.TB) { - var scenarios = []struct { - in *dto.MetricFamily - err string - }{ - // 0: No metric. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("doc string"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{}, - }, - err: "MetricFamily has no metrics", - }, - // 1: No metric name. - { - in: &dto.MetricFamily{ - Help: proto.String("doc string"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - err: "MetricFamily has no name", - }, - // 2: Wrong type. - { - in: &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("doc string"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - err: "expected counter in metric", - }, - } - - for i, scenario := range scenarios { - var out bytes.Buffer - _, err := MetricFamilyToText(&out, scenario.in) - if err == nil { - t.Errorf("%d. expected error, got nil", i) - continue - } - if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 { - t.Errorf( - "%d. expected error starting with %q, got %q", - i, expected, got, - ) - } - } - -} - -func TestCreateError(t *testing.T) { - testCreateError(t) -} - -func BenchmarkCreateError(b *testing.B) { - for i := 0; i < b.N; i++ { - testCreateError(b) - } -} +// Copyright 2014 The Prometheus Authors +// 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 expfmt + +import ( + "bytes" + "math" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + + dto "github.com/prometheus/client_model/go" +) + +func testCreate(t testing.TB) { + var scenarios = []struct { + in *dto.MetricFamily + out string + }{ + // 0: Counter, NaN as value, timestamp given. + { + in: &dto.MetricFamily{ + Name: proto.String("name"), + Help: proto.String("two-line\n doc str\\ing"), + Type: dto.MetricType_COUNTER.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("labelname"), + Value: proto.String("val1"), + }, + &dto.LabelPair{ + Name: proto.String("basename"), + Value: proto.String("basevalue"), + }, + }, + Counter: &dto.Counter{ + Value: proto.Float64(math.NaN()), + }, + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("labelname"), + Value: proto.String("val2"), + }, + &dto.LabelPair{ + Name: proto.String("basename"), + Value: proto.String("basevalue"), + }, + }, + Counter: &dto.Counter{ + Value: proto.Float64(.23), + }, + TimestampMs: proto.Int64(1234567890), + }, + }, + }, + out: `# HELP name two-line\n doc str\\ing +# TYPE name counter +name{labelname="val1",basename="basevalue"} NaN +name{labelname="val2",basename="basevalue"} 0.23 1234567890 +`, + }, + // 1: Gauge, some escaping required, +Inf as value, multi-byte characters in label values. + { + in: &dto.MetricFamily{ + Name: proto.String("gauge_name"), + Help: proto.String("gauge\ndoc\nstr\"ing"), + Type: dto.MetricType_GAUGE.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("name_1"), + Value: proto.String("val with\nnew line"), + }, + &dto.LabelPair{ + Name: proto.String("name_2"), + Value: proto.String("val with \\backslash and \"quotes\""), + }, + }, + Gauge: &dto.Gauge{ + Value: proto.Float64(math.Inf(+1)), + }, + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("name_1"), + Value: proto.String("Björn"), + }, + &dto.LabelPair{ + Name: proto.String("name_2"), + Value: proto.String("佖佥"), + }, + }, + Gauge: &dto.Gauge{ + Value: proto.Float64(3.14E42), + }, + }, + }, + }, + out: `# HELP gauge_name gauge\ndoc\nstr"ing +# TYPE gauge_name gauge +gauge_name{name_1="val with\nnew line",name_2="val with \\backslash and \"quotes\""} +Inf +gauge_name{name_1="Björn",name_2="佖佥"} 3.14e+42 +`, + }, + // 2: Untyped, no help, one sample with no labels and -Inf as value, another sample with one label. + { + in: &dto.MetricFamily{ + Name: proto.String("untyped_name"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(math.Inf(-1)), + }, + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("name_1"), + Value: proto.String("value 1"), + }, + }, + Untyped: &dto.Untyped{ + Value: proto.Float64(-1.23e-45), + }, + }, + }, + }, + out: `# TYPE untyped_name untyped +untyped_name -Inf +untyped_name{name_1="value 1"} -1.23e-45 +`, + }, + // 3: Summary. + { + in: &dto.MetricFamily{ + Name: proto.String("summary_name"), + Help: proto.String("summary docstring"), + Type: dto.MetricType_SUMMARY.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Summary: &dto.Summary{ + SampleCount: proto.Uint64(42), + SampleSum: proto.Float64(-3.4567), + Quantile: []*dto.Quantile{ + &dto.Quantile{ + Quantile: proto.Float64(0.5), + Value: proto.Float64(-1.23), + }, + &dto.Quantile{ + Quantile: proto.Float64(0.9), + Value: proto.Float64(.2342354), + }, + &dto.Quantile{ + Quantile: proto.Float64(0.99), + Value: proto.Float64(0), + }, + }, + }, + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("name_1"), + Value: proto.String("value 1"), + }, + &dto.LabelPair{ + Name: proto.String("name_2"), + Value: proto.String("value 2"), + }, + }, + Summary: &dto.Summary{ + SampleCount: proto.Uint64(4711), + SampleSum: proto.Float64(2010.1971), + Quantile: []*dto.Quantile{ + &dto.Quantile{ + Quantile: proto.Float64(0.5), + Value: proto.Float64(1), + }, + &dto.Quantile{ + Quantile: proto.Float64(0.9), + Value: proto.Float64(2), + }, + &dto.Quantile{ + Quantile: proto.Float64(0.99), + Value: proto.Float64(3), + }, + }, + }, + }, + }, + }, + out: `# HELP summary_name summary docstring +# TYPE summary_name summary +summary_name{quantile="0.5"} -1.23 +summary_name{quantile="0.9"} 0.2342354 +summary_name{quantile="0.99"} 0 +summary_name_sum -3.4567 +summary_name_count 42 +summary_name{name_1="value 1",name_2="value 2",quantile="0.5"} 1 +summary_name{name_1="value 1",name_2="value 2",quantile="0.9"} 2 +summary_name{name_1="value 1",name_2="value 2",quantile="0.99"} 3 +summary_name_sum{name_1="value 1",name_2="value 2"} 2010.1971 +summary_name_count{name_1="value 1",name_2="value 2"} 4711 +`, + }, + // 4: Histogram + { + in: &dto.MetricFamily{ + Name: proto.String("request_duration_microseconds"), + Help: proto.String("The response latency."), + Type: dto.MetricType_HISTOGRAM.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Histogram: &dto.Histogram{ + SampleCount: proto.Uint64(2693), + SampleSum: proto.Float64(1756047.3), + Bucket: []*dto.Bucket{ + &dto.Bucket{ + UpperBound: proto.Float64(100), + CumulativeCount: proto.Uint64(123), + }, + &dto.Bucket{ + UpperBound: proto.Float64(120), + CumulativeCount: proto.Uint64(412), + }, + &dto.Bucket{ + UpperBound: proto.Float64(144), + CumulativeCount: proto.Uint64(592), + }, + &dto.Bucket{ + UpperBound: proto.Float64(172.8), + CumulativeCount: proto.Uint64(1524), + }, + &dto.Bucket{ + UpperBound: proto.Float64(math.Inf(+1)), + CumulativeCount: proto.Uint64(2693), + }, + }, + }, + }, + }, + }, + out: `# HELP request_duration_microseconds The response latency. +# TYPE request_duration_microseconds histogram +request_duration_microseconds_bucket{le="100"} 123 +request_duration_microseconds_bucket{le="120"} 412 +request_duration_microseconds_bucket{le="144"} 592 +request_duration_microseconds_bucket{le="172.8"} 1524 +request_duration_microseconds_bucket{le="+Inf"} 2693 +request_duration_microseconds_sum 1.7560473e+06 +request_duration_microseconds_count 2693 +`, + }, + // 5: Histogram with missing +Inf bucket. + { + in: &dto.MetricFamily{ + Name: proto.String("request_duration_microseconds"), + Help: proto.String("The response latency."), + Type: dto.MetricType_HISTOGRAM.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Histogram: &dto.Histogram{ + SampleCount: proto.Uint64(2693), + SampleSum: proto.Float64(1756047.3), + Bucket: []*dto.Bucket{ + &dto.Bucket{ + UpperBound: proto.Float64(100), + CumulativeCount: proto.Uint64(123), + }, + &dto.Bucket{ + UpperBound: proto.Float64(120), + CumulativeCount: proto.Uint64(412), + }, + &dto.Bucket{ + UpperBound: proto.Float64(144), + CumulativeCount: proto.Uint64(592), + }, + &dto.Bucket{ + UpperBound: proto.Float64(172.8), + CumulativeCount: proto.Uint64(1524), + }, + }, + }, + }, + }, + }, + out: `# HELP request_duration_microseconds The response latency. +# TYPE request_duration_microseconds histogram +request_duration_microseconds_bucket{le="100"} 123 +request_duration_microseconds_bucket{le="120"} 412 +request_duration_microseconds_bucket{le="144"} 592 +request_duration_microseconds_bucket{le="172.8"} 1524 +request_duration_microseconds_bucket{le="+Inf"} 2693 +request_duration_microseconds_sum 1.7560473e+06 +request_duration_microseconds_count 2693 +`, + }, + // 6: No metric type, should result in default type Counter. + { + in: &dto.MetricFamily{ + Name: proto.String("name"), + Help: proto.String("doc string"), + Metric: []*dto.Metric{ + &dto.Metric{ + Counter: &dto.Counter{ + Value: proto.Float64(math.Inf(-1)), + }, + }, + }, + }, + out: `# HELP name doc string +# TYPE name counter +name -Inf +`, + }, + } + + for i, scenario := range scenarios { + out := bytes.NewBuffer(make([]byte, 0, len(scenario.out))) + n, err := MetricFamilyToText(out, scenario.in) + if err != nil { + t.Errorf("%d. error: %s", i, err) + continue + } + if expected, got := len(scenario.out), n; expected != got { + t.Errorf( + "%d. expected %d bytes written, got %d", + i, expected, got, + ) + } + if expected, got := scenario.out, out.String(); expected != got { + t.Errorf( + "%d. expected out=%q, got %q", + i, expected, got, + ) + } + } + +} + +func TestCreate(t *testing.T) { + testCreate(t) +} + +func BenchmarkCreate(b *testing.B) { + for i := 0; i < b.N; i++ { + testCreate(b) + } +} + +func testCreateError(t testing.TB) { + var scenarios = []struct { + in *dto.MetricFamily + err string + }{ + // 0: No metric. + { + in: &dto.MetricFamily{ + Name: proto.String("name"), + Help: proto.String("doc string"), + Type: dto.MetricType_COUNTER.Enum(), + Metric: []*dto.Metric{}, + }, + err: "MetricFamily has no metrics", + }, + // 1: No metric name. + { + in: &dto.MetricFamily{ + Help: proto.String("doc string"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(math.Inf(-1)), + }, + }, + }, + }, + err: "MetricFamily has no name", + }, + // 2: Wrong type. + { + in: &dto.MetricFamily{ + Name: proto.String("name"), + Help: proto.String("doc string"), + Type: dto.MetricType_COUNTER.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(math.Inf(-1)), + }, + }, + }, + }, + err: "expected counter in metric", + }, + } + + for i, scenario := range scenarios { + var out bytes.Buffer + _, err := MetricFamilyToText(&out, scenario.in) + if err == nil { + t.Errorf("%d. expected error, got nil", i) + continue + } + if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 { + t.Errorf( + "%d. expected error starting with %q, got %q", + i, expected, got, + ) + } + } + +} + +func TestCreateError(t *testing.T) { + testCreateError(t) +} + +func BenchmarkCreateError(b *testing.B) { + for i := 0; i < b.N; i++ { + testCreateError(b) + } +} diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index f74885b949..ef9a150771 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -1,753 +1,753 @@ -// Copyright 2014 The Prometheus Authors -// 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 expfmt - -import ( - "bufio" - "bytes" - "fmt" - "io" - "math" - "strconv" - "strings" - - dto "github.com/prometheus/client_model/go" - - "github.com/golang/protobuf/proto" - "github.com/prometheus/common/model" -) - -// A stateFn is a function that represents a state in a state machine. By -// executing it, the state is progressed to the next state. The stateFn returns -// another stateFn, which represents the new state. The end state is represented -// by nil. -type stateFn func() stateFn - -// ParseError signals errors while parsing the simple and flat text-based -// exchange format. -type ParseError struct { - Line int - Msg string -} - -// Error implements the error interface. -func (e ParseError) Error() string { - return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg) -} - -// TextParser is used to parse the simple and flat text-based exchange format. Its -// zero value is ready to use. -type TextParser struct { - metricFamiliesByName map[string]*dto.MetricFamily - buf *bufio.Reader // Where the parsed input is read through. - err error // Most recent error. - lineCount int // Tracks the line count for error messages. - currentByte byte // The most recent byte read. - currentToken bytes.Buffer // Re-used each time a token has to be gathered from multiple bytes. - currentMF *dto.MetricFamily - currentMetric *dto.Metric - currentLabelPair *dto.LabelPair - - // The remaining member variables are only used for summaries/histograms. - currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le' - // Summary specific. - summaries map[uint64]*dto.Metric // Key is created with LabelsToSignature. - currentQuantile float64 - // Histogram specific. - histograms map[uint64]*dto.Metric // Key is created with LabelsToSignature. - currentBucket float64 - // These tell us if the currently processed line ends on '_count' or - // '_sum' respectively and belong to a summary/histogram, representing the sample - // count and sum of that summary/histogram. - currentIsSummaryCount, currentIsSummarySum bool - currentIsHistogramCount, currentIsHistogramSum bool -} - -// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange -// format and creates MetricFamily proto messages. It returns the MetricFamily -// proto messages in a map where the metric names are the keys, along with any -// error encountered. -// -// If the input contains duplicate metrics (i.e. lines with the same metric name -// and exactly the same label set), the resulting MetricFamily will contain -// duplicate Metric proto messages. Similar is true for duplicate label -// names. Checks for duplicates have to be performed separately, if required. -// Also note that neither the metrics within each MetricFamily are sorted nor -// the label pairs within each Metric. Sorting is not required for the most -// frequent use of this method, which is sample ingestion in the Prometheus -// server. However, for presentation purposes, you might want to sort the -// metrics, and in some cases, you must sort the labels, e.g. for consumption by -// the metric family injection hook of the Prometheus registry. -// -// Summaries and histograms are rather special beasts. You would probably not -// use them in the simple text format anyway. This method can deal with -// summaries and histograms if they are presented in exactly the way the -// text.Create function creates them. -// -// This method must not be called concurrently. If you want to parse different -// input concurrently, instantiate a separate Parser for each goroutine. -func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) { - p.reset(in) - for nextState := p.startOfLine; nextState != nil; nextState = nextState() { - // Magic happens here... - } - // Get rid of empty metric families. - for k, mf := range p.metricFamiliesByName { - if len(mf.GetMetric()) == 0 { - delete(p.metricFamiliesByName, k) - } - } - // If p.err is io.EOF now, we have run into a premature end of the input - // stream. Turn this error into something nicer and more - // meaningful. (io.EOF is often used as a signal for the legitimate end - // of an input stream.) - if p.err == io.EOF { - p.parseError("unexpected end of input stream") - } - return p.metricFamiliesByName, p.err -} - -func (p *TextParser) reset(in io.Reader) { - p.metricFamiliesByName = map[string]*dto.MetricFamily{} - if p.buf == nil { - p.buf = bufio.NewReader(in) - } else { - p.buf.Reset(in) - } - p.err = nil - p.lineCount = 0 - if p.summaries == nil || len(p.summaries) > 0 { - p.summaries = map[uint64]*dto.Metric{} - } - if p.histograms == nil || len(p.histograms) > 0 { - p.histograms = map[uint64]*dto.Metric{} - } - p.currentQuantile = math.NaN() - p.currentBucket = math.NaN() -} - -// startOfLine represents the state where the next byte read from p.buf is the -// start of a line (or whitespace leading up to it). -func (p *TextParser) startOfLine() stateFn { - p.lineCount++ - if p.skipBlankTab(); p.err != nil { - // End of input reached. This is the only case where - // that is not an error but a signal that we are done. - p.err = nil - return nil - } - switch p.currentByte { - case '#': - return p.startComment - case '\n': - return p.startOfLine // Empty line, start the next one. - } - return p.readingMetricName -} - -// startComment represents the state where the next byte read from p.buf is the -// start of a comment (or whitespace leading up to it). -func (p *TextParser) startComment() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '\n' { - return p.startOfLine - } - if p.readTokenUntilWhitespace(); p.err != nil { - return nil // Unexpected end of input. - } - // If we have hit the end of line already, there is nothing left - // to do. This is not considered a syntax error. - if p.currentByte == '\n' { - return p.startOfLine - } - keyword := p.currentToken.String() - if keyword != "HELP" && keyword != "TYPE" { - // Generic comment, ignore by fast forwarding to end of line. - for p.currentByte != '\n' { - if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil { - return nil // Unexpected end of input. - } - } - return p.startOfLine - } - // There is something. Next has to be a metric name. - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.readTokenAsMetricName(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '\n' { - // At the end of the line already. - // Again, this is not considered a syntax error. - return p.startOfLine - } - if !isBlankOrTab(p.currentByte) { - p.parseError("invalid metric name in comment") - return nil - } - p.setOrCreateCurrentMF() - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '\n' { - // At the end of the line already. - // Again, this is not considered a syntax error. - return p.startOfLine - } - switch keyword { - case "HELP": - return p.readingHelp - case "TYPE": - return p.readingType - } - panic(fmt.Sprintf("code error: unexpected keyword %q", keyword)) -} - -// readingMetricName represents the state where the last byte read (now in -// p.currentByte) is the first byte of a metric name. -func (p *TextParser) readingMetricName() stateFn { - if p.readTokenAsMetricName(); p.err != nil { - return nil - } - if p.currentToken.Len() == 0 { - p.parseError("invalid metric name") - return nil - } - p.setOrCreateCurrentMF() - // Now is the time to fix the type if it hasn't happened yet. - if p.currentMF.Type == nil { - p.currentMF.Type = dto.MetricType_UNTYPED.Enum() - } - p.currentMetric = &dto.Metric{} - // Do not append the newly created currentMetric to - // currentMF.Metric right now. First wait if this is a summary, - // and the metric exists already, which we can only know after - // having read all the labels. - if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - return p.readingLabels -} - -// readingLabels represents the state where the last byte read (now in -// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the -// first byte of the value (otherwise). -func (p *TextParser) readingLabels() stateFn { - // Summaries/histograms are special. We have to reset the - // currentLabels map, currentQuantile and currentBucket before starting to - // read labels. - if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - p.currentLabels = map[string]string{} - p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName() - p.currentQuantile = math.NaN() - p.currentBucket = math.NaN() - } - if p.currentByte != '{' { - return p.readingValue - } - return p.startLabelName -} - -// startLabelName represents the state where the next byte read from p.buf is -// the start of a label name (or whitespace leading up to it). -func (p *TextParser) startLabelName() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte == '}' { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - return p.readingValue - } - if p.readTokenAsLabelName(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentToken.Len() == 0 { - p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName())) - return nil - } - p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())} - if p.currentLabelPair.GetName() == string(model.MetricNameLabel) { - p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel)) - return nil - } - // Special summary/histogram treatment. Don't add 'quantile' and 'le' - // labels to 'real' labels. - if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) && - !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) { - p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair) - } - if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte != '=' { - p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte)) - return nil - } - return p.startLabelValue -} - -// startLabelValue represents the state where the next byte read from p.buf is -// the start of a (quoted) label value (or whitespace leading up to it). -func (p *TextParser) startLabelValue() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentByte != '"' { - p.parseError(fmt.Sprintf("expected '\"' at start of label value, found %q", p.currentByte)) - return nil - } - if p.readTokenAsLabelValue(); p.err != nil { - return nil - } - p.currentLabelPair.Value = proto.String(p.currentToken.String()) - // Special treatment of summaries: - // - Quantile labels are special, will result in dto.Quantile later. - // - Other labels have to be added to currentLabels for signature calculation. - if p.currentMF.GetType() == dto.MetricType_SUMMARY { - if p.currentLabelPair.GetName() == model.QuantileLabel { - if p.currentQuantile, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue())) - return nil - } - } else { - p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue() - } - } - // Similar special treatment of histograms. - if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - if p.currentLabelPair.GetName() == model.BucketLabel { - if p.currentBucket, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected float as value for 'le' label, got %q", p.currentLabelPair.GetValue())) - return nil - } - } else { - p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue() - } - } - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - switch p.currentByte { - case ',': - return p.startLabelName - - case '}': - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - return p.readingValue - default: - p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.Value)) - return nil - } -} - -// readingValue represents the state where the last byte read (now in -// p.currentByte) is the first byte of the sample value (i.e. a float). -func (p *TextParser) readingValue() stateFn { - // When we are here, we have read all the labels, so for the - // special case of a summary/histogram, we can finally find out - // if the metric already exists. - if p.currentMF.GetType() == dto.MetricType_SUMMARY { - signature := model.LabelsToSignature(p.currentLabels) - if summary := p.summaries[signature]; summary != nil { - p.currentMetric = summary - } else { - p.summaries[signature] = p.currentMetric - p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) - } - } else if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - signature := model.LabelsToSignature(p.currentLabels) - if histogram := p.histograms[signature]; histogram != nil { - p.currentMetric = histogram - } else { - p.histograms[signature] = p.currentMetric - p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) - } - } else { - p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) - } - if p.readTokenUntilWhitespace(); p.err != nil { - return nil // Unexpected end of input. - } - value, err := strconv.ParseFloat(p.currentToken.String(), 64) - if err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected float as value, got %q", p.currentToken.String())) - return nil - } - switch p.currentMF.GetType() { - case dto.MetricType_COUNTER: - p.currentMetric.Counter = &dto.Counter{Value: proto.Float64(value)} - case dto.MetricType_GAUGE: - p.currentMetric.Gauge = &dto.Gauge{Value: proto.Float64(value)} - case dto.MetricType_UNTYPED: - p.currentMetric.Untyped = &dto.Untyped{Value: proto.Float64(value)} - case dto.MetricType_SUMMARY: - // *sigh* - if p.currentMetric.Summary == nil { - p.currentMetric.Summary = &dto.Summary{} - } - switch { - case p.currentIsSummaryCount: - p.currentMetric.Summary.SampleCount = proto.Uint64(uint64(value)) - case p.currentIsSummarySum: - p.currentMetric.Summary.SampleSum = proto.Float64(value) - case !math.IsNaN(p.currentQuantile): - p.currentMetric.Summary.Quantile = append( - p.currentMetric.Summary.Quantile, - &dto.Quantile{ - Quantile: proto.Float64(p.currentQuantile), - Value: proto.Float64(value), - }, - ) - } - case dto.MetricType_HISTOGRAM: - // *sigh* - if p.currentMetric.Histogram == nil { - p.currentMetric.Histogram = &dto.Histogram{} - } - switch { - case p.currentIsHistogramCount: - p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value)) - case p.currentIsHistogramSum: - p.currentMetric.Histogram.SampleSum = proto.Float64(value) - case !math.IsNaN(p.currentBucket): - p.currentMetric.Histogram.Bucket = append( - p.currentMetric.Histogram.Bucket, - &dto.Bucket{ - UpperBound: proto.Float64(p.currentBucket), - CumulativeCount: proto.Uint64(uint64(value)), - }, - ) - } - default: - p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName()) - } - if p.currentByte == '\n' { - return p.startOfLine - } - return p.startTimestamp -} - -// startTimestamp represents the state where the next byte read from p.buf is -// the start of the timestamp (or whitespace leading up to it). -func (p *TextParser) startTimestamp() stateFn { - if p.skipBlankTab(); p.err != nil { - return nil // Unexpected end of input. - } - if p.readTokenUntilWhitespace(); p.err != nil { - return nil // Unexpected end of input. - } - timestamp, err := strconv.ParseInt(p.currentToken.String(), 10, 64) - if err != nil { - // Create a more helpful error message. - p.parseError(fmt.Sprintf("expected integer as timestamp, got %q", p.currentToken.String())) - return nil - } - p.currentMetric.TimestampMs = proto.Int64(timestamp) - if p.readTokenUntilNewline(false); p.err != nil { - return nil // Unexpected end of input. - } - if p.currentToken.Len() > 0 { - p.parseError(fmt.Sprintf("spurious string after timestamp: %q", p.currentToken.String())) - return nil - } - return p.startOfLine -} - -// readingHelp represents the state where the last byte read (now in -// p.currentByte) is the first byte of the docstring after 'HELP'. -func (p *TextParser) readingHelp() stateFn { - if p.currentMF.Help != nil { - p.parseError(fmt.Sprintf("second HELP line for metric name %q", p.currentMF.GetName())) - return nil - } - // Rest of line is the docstring. - if p.readTokenUntilNewline(true); p.err != nil { - return nil // Unexpected end of input. - } - p.currentMF.Help = proto.String(p.currentToken.String()) - return p.startOfLine -} - -// readingType represents the state where the last byte read (now in -// p.currentByte) is the first byte of the type hint after 'HELP'. -func (p *TextParser) readingType() stateFn { - if p.currentMF.Type != nil { - p.parseError(fmt.Sprintf("second TYPE line for metric name %q, or TYPE reported after samples", p.currentMF.GetName())) - return nil - } - // Rest of line is the type. - if p.readTokenUntilNewline(false); p.err != nil { - return nil // Unexpected end of input. - } - metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())] - if !ok { - p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String())) - return nil - } - p.currentMF.Type = dto.MetricType(metricType).Enum() - return p.startOfLine -} - -// parseError sets p.err to a ParseError at the current line with the given -// message. -func (p *TextParser) parseError(msg string) { - p.err = ParseError{ - Line: p.lineCount, - Msg: msg, - } -} - -// skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte -// that is neither ' ' nor '\t'. That byte is left in p.currentByte. -func (p *TextParser) skipBlankTab() { - for { - if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil || !isBlankOrTab(p.currentByte) { - return - } - } -} - -// skipBlankTabIfCurrentBlankTab works exactly as skipBlankTab but doesn't do -// anything if p.currentByte is neither ' ' nor '\t'. -func (p *TextParser) skipBlankTabIfCurrentBlankTab() { - if isBlankOrTab(p.currentByte) { - p.skipBlankTab() - } -} - -// readTokenUntilWhitespace copies bytes from p.buf into p.currentToken. The -// first byte considered is the byte already read (now in p.currentByte). The -// first whitespace byte encountered is still copied into p.currentByte, but not -// into p.currentToken. -func (p *TextParser) readTokenUntilWhitespace() { - p.currentToken.Reset() - for p.err == nil && !isBlankOrTab(p.currentByte) && p.currentByte != '\n' { - p.currentToken.WriteByte(p.currentByte) - p.currentByte, p.err = p.buf.ReadByte() - } -} - -// readTokenUntilNewline copies bytes from p.buf into p.currentToken. The first -// byte considered is the byte already read (now in p.currentByte). The first -// newline byte encountered is still copied into p.currentByte, but not into -// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are -// recognized: '\\' tranlates into '\', and '\n' into a line-feed character. All -// other escape sequences are invalid and cause an error. -func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { - p.currentToken.Reset() - escaped := false - for p.err == nil { - if recognizeEscapeSequence && escaped { - switch p.currentByte { - case '\\': - p.currentToken.WriteByte(p.currentByte) - case 'n': - p.currentToken.WriteByte('\n') - default: - p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) - return - } - escaped = false - } else { - switch p.currentByte { - case '\n': - return - case '\\': - escaped = true - default: - p.currentToken.WriteByte(p.currentByte) - } - } - p.currentByte, p.err = p.buf.ReadByte() - } -} - -// readTokenAsMetricName copies a metric name from p.buf into p.currentToken. -// The first byte considered is the byte already read (now in p.currentByte). -// The first byte not part of a metric name is still copied into p.currentByte, -// but not into p.currentToken. -func (p *TextParser) readTokenAsMetricName() { - p.currentToken.Reset() - if !isValidMetricNameStart(p.currentByte) { - return - } - for { - p.currentToken.WriteByte(p.currentByte) - p.currentByte, p.err = p.buf.ReadByte() - if p.err != nil || !isValidMetricNameContinuation(p.currentByte) { - return - } - } -} - -// readTokenAsLabelName copies a label name from p.buf into p.currentToken. -// The first byte considered is the byte already read (now in p.currentByte). -// The first byte not part of a label name is still copied into p.currentByte, -// but not into p.currentToken. -func (p *TextParser) readTokenAsLabelName() { - p.currentToken.Reset() - if !isValidLabelNameStart(p.currentByte) { - return - } - for { - p.currentToken.WriteByte(p.currentByte) - p.currentByte, p.err = p.buf.ReadByte() - if p.err != nil || !isValidLabelNameContinuation(p.currentByte) { - return - } - } -} - -// readTokenAsLabelValue copies a label value from p.buf into p.currentToken. -// In contrast to the other 'readTokenAs...' functions, which start with the -// last read byte in p.currentByte, this method ignores p.currentByte and starts -// with reading a new byte from p.buf. The first byte not part of a label value -// is still copied into p.currentByte, but not into p.currentToken. -func (p *TextParser) readTokenAsLabelValue() { - p.currentToken.Reset() - escaped := false - for { - if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil { - return - } - if escaped { - switch p.currentByte { - case '"', '\\': - p.currentToken.WriteByte(p.currentByte) - case 'n': - p.currentToken.WriteByte('\n') - default: - p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) - return - } - escaped = false - continue - } - switch p.currentByte { - case '"': - return - case '\n': - p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String())) - return - case '\\': - escaped = true - default: - p.currentToken.WriteByte(p.currentByte) - } - } -} - -func (p *TextParser) setOrCreateCurrentMF() { - p.currentIsSummaryCount = false - p.currentIsSummarySum = false - p.currentIsHistogramCount = false - p.currentIsHistogramSum = false - name := p.currentToken.String() - if p.currentMF = p.metricFamiliesByName[name]; p.currentMF != nil { - return - } - // Try out if this is a _sum or _count for a summary/histogram. - summaryName := summaryMetricName(name) - if p.currentMF = p.metricFamiliesByName[summaryName]; p.currentMF != nil { - if p.currentMF.GetType() == dto.MetricType_SUMMARY { - if isCount(name) { - p.currentIsSummaryCount = true - } - if isSum(name) { - p.currentIsSummarySum = true - } - return - } - } - histogramName := histogramMetricName(name) - if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil { - if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { - if isCount(name) { - p.currentIsHistogramCount = true - } - if isSum(name) { - p.currentIsHistogramSum = true - } - return - } - } - p.currentMF = &dto.MetricFamily{Name: proto.String(name)} - p.metricFamiliesByName[name] = p.currentMF -} - -func isValidLabelNameStart(b byte) bool { - return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' -} - -func isValidLabelNameContinuation(b byte) bool { - return isValidLabelNameStart(b) || (b >= '0' && b <= '9') -} - -func isValidMetricNameStart(b byte) bool { - return isValidLabelNameStart(b) || b == ':' -} - -func isValidMetricNameContinuation(b byte) bool { - return isValidLabelNameContinuation(b) || b == ':' -} - -func isBlankOrTab(b byte) bool { - return b == ' ' || b == '\t' -} - -func isCount(name string) bool { - return len(name) > 6 && name[len(name)-6:] == "_count" -} - -func isSum(name string) bool { - return len(name) > 4 && name[len(name)-4:] == "_sum" -} - -func isBucket(name string) bool { - return len(name) > 7 && name[len(name)-7:] == "_bucket" -} - -func summaryMetricName(name string) string { - switch { - case isCount(name): - return name[:len(name)-6] - case isSum(name): - return name[:len(name)-4] - default: - return name - } -} - -func histogramMetricName(name string) string { - switch { - case isCount(name): - return name[:len(name)-6] - case isSum(name): - return name[:len(name)-4] - case isBucket(name): - return name[:len(name)-7] - default: - return name - } -} +// Copyright 2014 The Prometheus Authors +// 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 expfmt + +import ( + "bufio" + "bytes" + "fmt" + "io" + "math" + "strconv" + "strings" + + dto "github.com/prometheus/client_model/go" + + "github.com/golang/protobuf/proto" + "github.com/prometheus/common/model" +) + +// A stateFn is a function that represents a state in a state machine. By +// executing it, the state is progressed to the next state. The stateFn returns +// another stateFn, which represents the new state. The end state is represented +// by nil. +type stateFn func() stateFn + +// ParseError signals errors while parsing the simple and flat text-based +// exchange format. +type ParseError struct { + Line int + Msg string +} + +// Error implements the error interface. +func (e ParseError) Error() string { + return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg) +} + +// TextParser is used to parse the simple and flat text-based exchange format. Its +// zero value is ready to use. +type TextParser struct { + metricFamiliesByName map[string]*dto.MetricFamily + buf *bufio.Reader // Where the parsed input is read through. + err error // Most recent error. + lineCount int // Tracks the line count for error messages. + currentByte byte // The most recent byte read. + currentToken bytes.Buffer // Re-used each time a token has to be gathered from multiple bytes. + currentMF *dto.MetricFamily + currentMetric *dto.Metric + currentLabelPair *dto.LabelPair + + // The remaining member variables are only used for summaries/histograms. + currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le' + // Summary specific. + summaries map[uint64]*dto.Metric // Key is created with LabelsToSignature. + currentQuantile float64 + // Histogram specific. + histograms map[uint64]*dto.Metric // Key is created with LabelsToSignature. + currentBucket float64 + // These tell us if the currently processed line ends on '_count' or + // '_sum' respectively and belong to a summary/histogram, representing the sample + // count and sum of that summary/histogram. + currentIsSummaryCount, currentIsSummarySum bool + currentIsHistogramCount, currentIsHistogramSum bool +} + +// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange +// format and creates MetricFamily proto messages. It returns the MetricFamily +// proto messages in a map where the metric names are the keys, along with any +// error encountered. +// +// If the input contains duplicate metrics (i.e. lines with the same metric name +// and exactly the same label set), the resulting MetricFamily will contain +// duplicate Metric proto messages. Similar is true for duplicate label +// names. Checks for duplicates have to be performed separately, if required. +// Also note that neither the metrics within each MetricFamily are sorted nor +// the label pairs within each Metric. Sorting is not required for the most +// frequent use of this method, which is sample ingestion in the Prometheus +// server. However, for presentation purposes, you might want to sort the +// metrics, and in some cases, you must sort the labels, e.g. for consumption by +// the metric family injection hook of the Prometheus registry. +// +// Summaries and histograms are rather special beasts. You would probably not +// use them in the simple text format anyway. This method can deal with +// summaries and histograms if they are presented in exactly the way the +// text.Create function creates them. +// +// This method must not be called concurrently. If you want to parse different +// input concurrently, instantiate a separate Parser for each goroutine. +func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) { + p.reset(in) + for nextState := p.startOfLine; nextState != nil; nextState = nextState() { + // Magic happens here... + } + // Get rid of empty metric families. + for k, mf := range p.metricFamiliesByName { + if len(mf.GetMetric()) == 0 { + delete(p.metricFamiliesByName, k) + } + } + // If p.err is io.EOF now, we have run into a premature end of the input + // stream. Turn this error into something nicer and more + // meaningful. (io.EOF is often used as a signal for the legitimate end + // of an input stream.) + if p.err == io.EOF { + p.parseError("unexpected end of input stream") + } + return p.metricFamiliesByName, p.err +} + +func (p *TextParser) reset(in io.Reader) { + p.metricFamiliesByName = map[string]*dto.MetricFamily{} + if p.buf == nil { + p.buf = bufio.NewReader(in) + } else { + p.buf.Reset(in) + } + p.err = nil + p.lineCount = 0 + if p.summaries == nil || len(p.summaries) > 0 { + p.summaries = map[uint64]*dto.Metric{} + } + if p.histograms == nil || len(p.histograms) > 0 { + p.histograms = map[uint64]*dto.Metric{} + } + p.currentQuantile = math.NaN() + p.currentBucket = math.NaN() +} + +// startOfLine represents the state where the next byte read from p.buf is the +// start of a line (or whitespace leading up to it). +func (p *TextParser) startOfLine() stateFn { + p.lineCount++ + if p.skipBlankTab(); p.err != nil { + // End of input reached. This is the only case where + // that is not an error but a signal that we are done. + p.err = nil + return nil + } + switch p.currentByte { + case '#': + return p.startComment + case '\n': + return p.startOfLine // Empty line, start the next one. + } + return p.readingMetricName +} + +// startComment represents the state where the next byte read from p.buf is the +// start of a comment (or whitespace leading up to it). +func (p *TextParser) startComment() stateFn { + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte == '\n' { + return p.startOfLine + } + if p.readTokenUntilWhitespace(); p.err != nil { + return nil // Unexpected end of input. + } + // If we have hit the end of line already, there is nothing left + // to do. This is not considered a syntax error. + if p.currentByte == '\n' { + return p.startOfLine + } + keyword := p.currentToken.String() + if keyword != "HELP" && keyword != "TYPE" { + // Generic comment, ignore by fast forwarding to end of line. + for p.currentByte != '\n' { + if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil { + return nil // Unexpected end of input. + } + } + return p.startOfLine + } + // There is something. Next has to be a metric name. + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.readTokenAsMetricName(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte == '\n' { + // At the end of the line already. + // Again, this is not considered a syntax error. + return p.startOfLine + } + if !isBlankOrTab(p.currentByte) { + p.parseError("invalid metric name in comment") + return nil + } + p.setOrCreateCurrentMF() + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte == '\n' { + // At the end of the line already. + // Again, this is not considered a syntax error. + return p.startOfLine + } + switch keyword { + case "HELP": + return p.readingHelp + case "TYPE": + return p.readingType + } + panic(fmt.Sprintf("code error: unexpected keyword %q", keyword)) +} + +// readingMetricName represents the state where the last byte read (now in +// p.currentByte) is the first byte of a metric name. +func (p *TextParser) readingMetricName() stateFn { + if p.readTokenAsMetricName(); p.err != nil { + return nil + } + if p.currentToken.Len() == 0 { + p.parseError("invalid metric name") + return nil + } + p.setOrCreateCurrentMF() + // Now is the time to fix the type if it hasn't happened yet. + if p.currentMF.Type == nil { + p.currentMF.Type = dto.MetricType_UNTYPED.Enum() + } + p.currentMetric = &dto.Metric{} + // Do not append the newly created currentMetric to + // currentMF.Metric right now. First wait if this is a summary, + // and the metric exists already, which we can only know after + // having read all the labels. + if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + return p.readingLabels +} + +// readingLabels represents the state where the last byte read (now in +// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the +// first byte of the value (otherwise). +func (p *TextParser) readingLabels() stateFn { + // Summaries/histograms are special. We have to reset the + // currentLabels map, currentQuantile and currentBucket before starting to + // read labels. + if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + p.currentLabels = map[string]string{} + p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName() + p.currentQuantile = math.NaN() + p.currentBucket = math.NaN() + } + if p.currentByte != '{' { + return p.readingValue + } + return p.startLabelName +} + +// startLabelName represents the state where the next byte read from p.buf is +// the start of a label name (or whitespace leading up to it). +func (p *TextParser) startLabelName() stateFn { + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte == '}' { + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + return p.readingValue + } + if p.readTokenAsLabelName(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentToken.Len() == 0 { + p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName())) + return nil + } + p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())} + if p.currentLabelPair.GetName() == string(model.MetricNameLabel) { + p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel)) + return nil + } + // Special summary/histogram treatment. Don't add 'quantile' and 'le' + // labels to 'real' labels. + if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) && + !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) { + p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair) + } + if p.skipBlankTabIfCurrentBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte != '=' { + p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte)) + return nil + } + return p.startLabelValue +} + +// startLabelValue represents the state where the next byte read from p.buf is +// the start of a (quoted) label value (or whitespace leading up to it). +func (p *TextParser) startLabelValue() stateFn { + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentByte != '"' { + p.parseError(fmt.Sprintf("expected '\"' at start of label value, found %q", p.currentByte)) + return nil + } + if p.readTokenAsLabelValue(); p.err != nil { + return nil + } + p.currentLabelPair.Value = proto.String(p.currentToken.String()) + // Special treatment of summaries: + // - Quantile labels are special, will result in dto.Quantile later. + // - Other labels have to be added to currentLabels for signature calculation. + if p.currentMF.GetType() == dto.MetricType_SUMMARY { + if p.currentLabelPair.GetName() == model.QuantileLabel { + if p.currentQuantile, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil { + // Create a more helpful error message. + p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue())) + return nil + } + } else { + p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue() + } + } + // Similar special treatment of histograms. + if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + if p.currentLabelPair.GetName() == model.BucketLabel { + if p.currentBucket, p.err = strconv.ParseFloat(p.currentLabelPair.GetValue(), 64); p.err != nil { + // Create a more helpful error message. + p.parseError(fmt.Sprintf("expected float as value for 'le' label, got %q", p.currentLabelPair.GetValue())) + return nil + } + } else { + p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue() + } + } + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + switch p.currentByte { + case ',': + return p.startLabelName + + case '}': + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + return p.readingValue + default: + p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.Value)) + return nil + } +} + +// readingValue represents the state where the last byte read (now in +// p.currentByte) is the first byte of the sample value (i.e. a float). +func (p *TextParser) readingValue() stateFn { + // When we are here, we have read all the labels, so for the + // special case of a summary/histogram, we can finally find out + // if the metric already exists. + if p.currentMF.GetType() == dto.MetricType_SUMMARY { + signature := model.LabelsToSignature(p.currentLabels) + if summary := p.summaries[signature]; summary != nil { + p.currentMetric = summary + } else { + p.summaries[signature] = p.currentMetric + p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) + } + } else if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + signature := model.LabelsToSignature(p.currentLabels) + if histogram := p.histograms[signature]; histogram != nil { + p.currentMetric = histogram + } else { + p.histograms[signature] = p.currentMetric + p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) + } + } else { + p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) + } + if p.readTokenUntilWhitespace(); p.err != nil { + return nil // Unexpected end of input. + } + value, err := strconv.ParseFloat(p.currentToken.String(), 64) + if err != nil { + // Create a more helpful error message. + p.parseError(fmt.Sprintf("expected float as value, got %q", p.currentToken.String())) + return nil + } + switch p.currentMF.GetType() { + case dto.MetricType_COUNTER: + p.currentMetric.Counter = &dto.Counter{Value: proto.Float64(value)} + case dto.MetricType_GAUGE: + p.currentMetric.Gauge = &dto.Gauge{Value: proto.Float64(value)} + case dto.MetricType_UNTYPED: + p.currentMetric.Untyped = &dto.Untyped{Value: proto.Float64(value)} + case dto.MetricType_SUMMARY: + // *sigh* + if p.currentMetric.Summary == nil { + p.currentMetric.Summary = &dto.Summary{} + } + switch { + case p.currentIsSummaryCount: + p.currentMetric.Summary.SampleCount = proto.Uint64(uint64(value)) + case p.currentIsSummarySum: + p.currentMetric.Summary.SampleSum = proto.Float64(value) + case !math.IsNaN(p.currentQuantile): + p.currentMetric.Summary.Quantile = append( + p.currentMetric.Summary.Quantile, + &dto.Quantile{ + Quantile: proto.Float64(p.currentQuantile), + Value: proto.Float64(value), + }, + ) + } + case dto.MetricType_HISTOGRAM: + // *sigh* + if p.currentMetric.Histogram == nil { + p.currentMetric.Histogram = &dto.Histogram{} + } + switch { + case p.currentIsHistogramCount: + p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value)) + case p.currentIsHistogramSum: + p.currentMetric.Histogram.SampleSum = proto.Float64(value) + case !math.IsNaN(p.currentBucket): + p.currentMetric.Histogram.Bucket = append( + p.currentMetric.Histogram.Bucket, + &dto.Bucket{ + UpperBound: proto.Float64(p.currentBucket), + CumulativeCount: proto.Uint64(uint64(value)), + }, + ) + } + default: + p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName()) + } + if p.currentByte == '\n' { + return p.startOfLine + } + return p.startTimestamp +} + +// startTimestamp represents the state where the next byte read from p.buf is +// the start of the timestamp (or whitespace leading up to it). +func (p *TextParser) startTimestamp() stateFn { + if p.skipBlankTab(); p.err != nil { + return nil // Unexpected end of input. + } + if p.readTokenUntilWhitespace(); p.err != nil { + return nil // Unexpected end of input. + } + timestamp, err := strconv.ParseInt(p.currentToken.String(), 10, 64) + if err != nil { + // Create a more helpful error message. + p.parseError(fmt.Sprintf("expected integer as timestamp, got %q", p.currentToken.String())) + return nil + } + p.currentMetric.TimestampMs = proto.Int64(timestamp) + if p.readTokenUntilNewline(false); p.err != nil { + return nil // Unexpected end of input. + } + if p.currentToken.Len() > 0 { + p.parseError(fmt.Sprintf("spurious string after timestamp: %q", p.currentToken.String())) + return nil + } + return p.startOfLine +} + +// readingHelp represents the state where the last byte read (now in +// p.currentByte) is the first byte of the docstring after 'HELP'. +func (p *TextParser) readingHelp() stateFn { + if p.currentMF.Help != nil { + p.parseError(fmt.Sprintf("second HELP line for metric name %q", p.currentMF.GetName())) + return nil + } + // Rest of line is the docstring. + if p.readTokenUntilNewline(true); p.err != nil { + return nil // Unexpected end of input. + } + p.currentMF.Help = proto.String(p.currentToken.String()) + return p.startOfLine +} + +// readingType represents the state where the last byte read (now in +// p.currentByte) is the first byte of the type hint after 'HELP'. +func (p *TextParser) readingType() stateFn { + if p.currentMF.Type != nil { + p.parseError(fmt.Sprintf("second TYPE line for metric name %q, or TYPE reported after samples", p.currentMF.GetName())) + return nil + } + // Rest of line is the type. + if p.readTokenUntilNewline(false); p.err != nil { + return nil // Unexpected end of input. + } + metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())] + if !ok { + p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String())) + return nil + } + p.currentMF.Type = dto.MetricType(metricType).Enum() + return p.startOfLine +} + +// parseError sets p.err to a ParseError at the current line with the given +// message. +func (p *TextParser) parseError(msg string) { + p.err = ParseError{ + Line: p.lineCount, + Msg: msg, + } +} + +// skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte +// that is neither ' ' nor '\t'. That byte is left in p.currentByte. +func (p *TextParser) skipBlankTab() { + for { + if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil || !isBlankOrTab(p.currentByte) { + return + } + } +} + +// skipBlankTabIfCurrentBlankTab works exactly as skipBlankTab but doesn't do +// anything if p.currentByte is neither ' ' nor '\t'. +func (p *TextParser) skipBlankTabIfCurrentBlankTab() { + if isBlankOrTab(p.currentByte) { + p.skipBlankTab() + } +} + +// readTokenUntilWhitespace copies bytes from p.buf into p.currentToken. The +// first byte considered is the byte already read (now in p.currentByte). The +// first whitespace byte encountered is still copied into p.currentByte, but not +// into p.currentToken. +func (p *TextParser) readTokenUntilWhitespace() { + p.currentToken.Reset() + for p.err == nil && !isBlankOrTab(p.currentByte) && p.currentByte != '\n' { + p.currentToken.WriteByte(p.currentByte) + p.currentByte, p.err = p.buf.ReadByte() + } +} + +// readTokenUntilNewline copies bytes from p.buf into p.currentToken. The first +// byte considered is the byte already read (now in p.currentByte). The first +// newline byte encountered is still copied into p.currentByte, but not into +// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are +// recognized: '\\' tranlates into '\', and '\n' into a line-feed character. All +// other escape sequences are invalid and cause an error. +func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { + p.currentToken.Reset() + escaped := false + for p.err == nil { + if recognizeEscapeSequence && escaped { + switch p.currentByte { + case '\\': + p.currentToken.WriteByte(p.currentByte) + case 'n': + p.currentToken.WriteByte('\n') + default: + p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) + return + } + escaped = false + } else { + switch p.currentByte { + case '\n': + return + case '\\': + escaped = true + default: + p.currentToken.WriteByte(p.currentByte) + } + } + p.currentByte, p.err = p.buf.ReadByte() + } +} + +// readTokenAsMetricName copies a metric name from p.buf into p.currentToken. +// The first byte considered is the byte already read (now in p.currentByte). +// The first byte not part of a metric name is still copied into p.currentByte, +// but not into p.currentToken. +func (p *TextParser) readTokenAsMetricName() { + p.currentToken.Reset() + if !isValidMetricNameStart(p.currentByte) { + return + } + for { + p.currentToken.WriteByte(p.currentByte) + p.currentByte, p.err = p.buf.ReadByte() + if p.err != nil || !isValidMetricNameContinuation(p.currentByte) { + return + } + } +} + +// readTokenAsLabelName copies a label name from p.buf into p.currentToken. +// The first byte considered is the byte already read (now in p.currentByte). +// The first byte not part of a label name is still copied into p.currentByte, +// but not into p.currentToken. +func (p *TextParser) readTokenAsLabelName() { + p.currentToken.Reset() + if !isValidLabelNameStart(p.currentByte) { + return + } + for { + p.currentToken.WriteByte(p.currentByte) + p.currentByte, p.err = p.buf.ReadByte() + if p.err != nil || !isValidLabelNameContinuation(p.currentByte) { + return + } + } +} + +// readTokenAsLabelValue copies a label value from p.buf into p.currentToken. +// In contrast to the other 'readTokenAs...' functions, which start with the +// last read byte in p.currentByte, this method ignores p.currentByte and starts +// with reading a new byte from p.buf. The first byte not part of a label value +// is still copied into p.currentByte, but not into p.currentToken. +func (p *TextParser) readTokenAsLabelValue() { + p.currentToken.Reset() + escaped := false + for { + if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil { + return + } + if escaped { + switch p.currentByte { + case '"', '\\': + p.currentToken.WriteByte(p.currentByte) + case 'n': + p.currentToken.WriteByte('\n') + default: + p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte)) + return + } + escaped = false + continue + } + switch p.currentByte { + case '"': + return + case '\n': + p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String())) + return + case '\\': + escaped = true + default: + p.currentToken.WriteByte(p.currentByte) + } + } +} + +func (p *TextParser) setOrCreateCurrentMF() { + p.currentIsSummaryCount = false + p.currentIsSummarySum = false + p.currentIsHistogramCount = false + p.currentIsHistogramSum = false + name := p.currentToken.String() + if p.currentMF = p.metricFamiliesByName[name]; p.currentMF != nil { + return + } + // Try out if this is a _sum or _count for a summary/histogram. + summaryName := summaryMetricName(name) + if p.currentMF = p.metricFamiliesByName[summaryName]; p.currentMF != nil { + if p.currentMF.GetType() == dto.MetricType_SUMMARY { + if isCount(name) { + p.currentIsSummaryCount = true + } + if isSum(name) { + p.currentIsSummarySum = true + } + return + } + } + histogramName := histogramMetricName(name) + if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil { + if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + if isCount(name) { + p.currentIsHistogramCount = true + } + if isSum(name) { + p.currentIsHistogramSum = true + } + return + } + } + p.currentMF = &dto.MetricFamily{Name: proto.String(name)} + p.metricFamiliesByName[name] = p.currentMF +} + +func isValidLabelNameStart(b byte) bool { + return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' +} + +func isValidLabelNameContinuation(b byte) bool { + return isValidLabelNameStart(b) || (b >= '0' && b <= '9') +} + +func isValidMetricNameStart(b byte) bool { + return isValidLabelNameStart(b) || b == ':' +} + +func isValidMetricNameContinuation(b byte) bool { + return isValidLabelNameContinuation(b) || b == ':' +} + +func isBlankOrTab(b byte) bool { + return b == ' ' || b == '\t' +} + +func isCount(name string) bool { + return len(name) > 6 && name[len(name)-6:] == "_count" +} + +func isSum(name string) bool { + return len(name) > 4 && name[len(name)-4:] == "_sum" +} + +func isBucket(name string) bool { + return len(name) > 7 && name[len(name)-7:] == "_bucket" +} + +func summaryMetricName(name string) string { + switch { + case isCount(name): + return name[:len(name)-6] + case isSum(name): + return name[:len(name)-4] + default: + return name + } +} + +func histogramMetricName(name string) string { + switch { + case isCount(name): + return name[:len(name)-6] + case isSum(name): + return name[:len(name)-4] + case isBucket(name): + return name[:len(name)-7] + default: + return name + } +} diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse_test.go b/vendor/github.com/prometheus/common/expfmt/text_parse_test.go index a6550a8ae6..7e7388ce96 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse_test.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse_test.go @@ -1,588 +1,588 @@ -// Copyright 2014 The Prometheus Authors -// 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 expfmt - -import ( - "math" - "strings" - "testing" - - "github.com/golang/protobuf/proto" - dto "github.com/prometheus/client_model/go" -) - -func testTextParse(t testing.TB) { - var scenarios = []struct { - in string - out []*dto.MetricFamily - }{ - // 0: Empty lines as input. - { - in: ` - -`, - out: []*dto.MetricFamily{}, - }, - // 1: Minimal case. - { - in: ` -minimal_metric 1.234 -another_metric -3e3 103948 -# Even that: -no_labels{} 3 -# HELP line for non-existing metric will be ignored. -`, - out: []*dto.MetricFamily{ - &dto.MetricFamily{ - Name: proto.String("minimal_metric"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(1.234), - }, - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("another_metric"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(-3e3), - }, - TimestampMs: proto.Int64(103948), - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("no_labels"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(3), - }, - }, - }, - }, - }, - }, - // 2: Counters & gauges, docstrings, various whitespace, escape sequences. - { - in: ` -# A normal comment. -# -# TYPE name counter -name{labelname="val1",basename="basevalue"} NaN -name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890 -# HELP name two-line\n doc str\\ing - - # HELP name2 doc str"ing 2 - # TYPE name2 gauge -name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321 -name2{ labelname = "val1" , }-Inf -`, - out: []*dto.MetricFamily{ - &dto.MetricFamily{ - Name: proto.String("name"), - Help: proto.String("two-line\n doc str\\ing"), - Type: dto.MetricType_COUNTER.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(math.NaN()), - }, - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("base\"v\\al\nue"), - }, - }, - Counter: &dto.Counter{ - Value: proto.Float64(.23), - }, - TimestampMs: proto.Int64(1234567890), - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("name2"), - Help: proto.String("doc str\"ing 2"), - Type: dto.MetricType_GAUGE.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("basename"), - Value: proto.String("basevalue2"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(math.Inf(+1)), - }, - TimestampMs: proto.Int64(54321), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("labelname"), - Value: proto.String("val1"), - }, - }, - Gauge: &dto.Gauge{ - Value: proto.Float64(math.Inf(-1)), - }, - }, - }, - }, - }, - }, - // 3: The evil summary, mixed with other types and funny comments. - { - in: ` -# TYPE my_summary summary -my_summary{n1="val1",quantile="0.5"} 110 -decoy -1 -2 -my_summary{n1="val1",quantile="0.9"} 140 1 -my_summary_count{n1="val1"} 42 -# Latest timestamp wins in case of a summary. -my_summary_sum{n1="val1"} 4711 2 -fake_sum{n1="val1"} 2001 -# TYPE another_summary summary -another_summary_count{n2="val2",n1="val1"} 20 -my_summary_count{n2="val2",n1="val1"} 5 5 -another_summary{n1="val1",n2="val2",quantile=".3"} -1.2 -my_summary_sum{n1="val2"} 08 15 -my_summary{n1="val3", quantile="0.2"} 4711 - my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN -# some -# funny comments -# HELP -# HELP -# HELP my_summary -# HELP my_summary -`, - out: []*dto.MetricFamily{ - &dto.MetricFamily{ - Name: proto.String("fake_sum"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Untyped: &dto.Untyped{ - Value: proto.Float64(2001), - }, - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("decoy"), - Type: dto.MetricType_UNTYPED.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Untyped: &dto.Untyped{ - Value: proto.Float64(-1), - }, - TimestampMs: proto.Int64(-2), - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("my_summary"), - Type: dto.MetricType_SUMMARY.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(42), - SampleSum: proto.Float64(4711), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.5), - Value: proto.Float64(110), - }, - &dto.Quantile{ - Quantile: proto.Float64(0.9), - Value: proto.Float64(140), - }, - }, - }, - TimestampMs: proto.Int64(2), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n2"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(5), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(-12.34), - Value: proto.Float64(math.NaN()), - }, - }, - }, - TimestampMs: proto.Int64(5), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val2"), - }, - }, - Summary: &dto.Summary{ - SampleSum: proto.Float64(8), - }, - TimestampMs: proto.Int64(15), - }, - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val3"), - }, - }, - Summary: &dto.Summary{ - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.2), - Value: proto.Float64(4711), - }, - }, - }, - }, - }, - }, - &dto.MetricFamily{ - Name: proto.String("another_summary"), - Type: dto.MetricType_SUMMARY.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Label: []*dto.LabelPair{ - &dto.LabelPair{ - Name: proto.String("n2"), - Value: proto.String("val2"), - }, - &dto.LabelPair{ - Name: proto.String("n1"), - Value: proto.String("val1"), - }, - }, - Summary: &dto.Summary{ - SampleCount: proto.Uint64(20), - Quantile: []*dto.Quantile{ - &dto.Quantile{ - Quantile: proto.Float64(0.3), - Value: proto.Float64(-1.2), - }, - }, - }, - }, - }, - }, - }, - }, - // 4: The histogram. - { - in: ` -# HELP request_duration_microseconds The response latency. -# TYPE request_duration_microseconds histogram -request_duration_microseconds_bucket{le="100"} 123 -request_duration_microseconds_bucket{le="120"} 412 -request_duration_microseconds_bucket{le="144"} 592 -request_duration_microseconds_bucket{le="172.8"} 1524 -request_duration_microseconds_bucket{le="+Inf"} 2693 -request_duration_microseconds_sum 1.7560473e+06 -request_duration_microseconds_count 2693 -`, - out: []*dto.MetricFamily{ - { - Name: proto.String("request_duration_microseconds"), - Help: proto.String("The response latency."), - Type: dto.MetricType_HISTOGRAM.Enum(), - Metric: []*dto.Metric{ - &dto.Metric{ - Histogram: &dto.Histogram{ - SampleCount: proto.Uint64(2693), - SampleSum: proto.Float64(1756047.3), - Bucket: []*dto.Bucket{ - &dto.Bucket{ - UpperBound: proto.Float64(100), - CumulativeCount: proto.Uint64(123), - }, - &dto.Bucket{ - UpperBound: proto.Float64(120), - CumulativeCount: proto.Uint64(412), - }, - &dto.Bucket{ - UpperBound: proto.Float64(144), - CumulativeCount: proto.Uint64(592), - }, - &dto.Bucket{ - UpperBound: proto.Float64(172.8), - CumulativeCount: proto.Uint64(1524), - }, - &dto.Bucket{ - UpperBound: proto.Float64(math.Inf(+1)), - CumulativeCount: proto.Uint64(2693), - }, - }, - }, - }, - }, - }, - }, - }, - } - - for i, scenario := range scenarios { - out, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in)) - if err != nil { - t.Errorf("%d. error: %s", i, err) - continue - } - if expected, got := len(scenario.out), len(out); expected != got { - t.Errorf( - "%d. expected %d MetricFamilies, got %d", - i, expected, got, - ) - } - for _, expected := range scenario.out { - got, ok := out[expected.GetName()] - if !ok { - t.Errorf( - "%d. expected MetricFamily %q, found none", - i, expected.GetName(), - ) - continue - } - if expected.String() != got.String() { - t.Errorf( - "%d. expected MetricFamily %s, got %s", - i, expected, got, - ) - } - } - } -} - -func TestTextParse(t *testing.T) { - testTextParse(t) -} - -func BenchmarkTextParse(b *testing.B) { - for i := 0; i < b.N; i++ { - testTextParse(b) - } -} - -func testTextParseError(t testing.TB) { - var scenarios = []struct { - in string - err string - }{ - // 0: No new-line at end of input. - { - in: ` -bla 3.14 -blubber 42`, - err: "text format parsing error in line 3: unexpected end of input stream", - }, - // 1: Invalid escape sequence in label value. - { - in: `metric{label="\t"} 3.14`, - err: "text format parsing error in line 1: invalid escape sequence", - }, - // 2: Newline in label value. - { - in: ` -metric{label="new -line"} 3.14 -`, - err: `text format parsing error in line 2: label value "new" contains unescaped new-line`, - }, - // 3: - { - in: `metric{@="bla"} 3.14`, - err: "text format parsing error in line 1: invalid label name for metric", - }, - // 4: - { - in: `metric{__name__="bla"} 3.14`, - err: `text format parsing error in line 1: label name "__name__" is reserved`, - }, - // 5: - { - in: `metric{label+="bla"} 3.14`, - err: "text format parsing error in line 1: expected '=' after label name", - }, - // 6: - { - in: `metric{label=bla} 3.14`, - err: "text format parsing error in line 1: expected '\"' at start of label value", - }, - // 7: - { - in: ` -# TYPE metric summary -metric{quantile="bla"} 3.14 -`, - err: "text format parsing error in line 3: expected float as value for 'quantile' label", - }, - // 8: - { - in: `metric{label="bla"+} 3.14`, - err: "text format parsing error in line 1: unexpected end of label value", - }, - // 9: - { - in: `metric{label="bla"} 3.14 2.72 -`, - err: "text format parsing error in line 1: expected integer as timestamp", - }, - // 10: - { - in: `metric{label="bla"} 3.14 2 3 -`, - err: "text format parsing error in line 1: spurious string after timestamp", - }, - // 11: - { - in: `metric{label="bla"} blubb -`, - err: "text format parsing error in line 1: expected float as value", - }, - // 12: - { - in: ` -# HELP metric one -# HELP metric two -`, - err: "text format parsing error in line 3: second HELP line for metric name", - }, - // 13: - { - in: ` -# TYPE metric counter -# TYPE metric untyped -`, - err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`, - }, - // 14: - { - in: ` -metric 4.12 -# TYPE metric counter -`, - err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`, - }, - // 14: - { - in: ` -# TYPE metric bla -`, - err: "text format parsing error in line 2: unknown metric type", - }, - // 15: - { - in: ` -# TYPE met-ric -`, - err: "text format parsing error in line 2: invalid metric name in comment", - }, - // 16: - { - in: `@invalidmetric{label="bla"} 3.14 2`, - err: "text format parsing error in line 1: invalid metric name", - }, - // 17: - { - in: `{label="bla"} 3.14 2`, - err: "text format parsing error in line 1: invalid metric name", - }, - // 18: - { - in: ` -# TYPE metric histogram -metric_bucket{le="bla"} 3.14 -`, - err: "text format parsing error in line 3: expected float as value for 'le' label", - }, - } - - for i, scenario := range scenarios { - _, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in)) - if err == nil { - t.Errorf("%d. expected error, got nil", i) - continue - } - if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 { - t.Errorf( - "%d. expected error starting with %q, got %q", - i, expected, got, - ) - } - } - -} - -func TestTextParseError(t *testing.T) { - testTextParseError(t) -} - -func BenchmarkParseError(b *testing.B) { - for i := 0; i < b.N; i++ { - testTextParseError(b) - } -} +// Copyright 2014 The Prometheus Authors +// 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 expfmt + +import ( + "math" + "strings" + "testing" + + "github.com/golang/protobuf/proto" + dto "github.com/prometheus/client_model/go" +) + +func testTextParse(t testing.TB) { + var scenarios = []struct { + in string + out []*dto.MetricFamily + }{ + // 0: Empty lines as input. + { + in: ` + +`, + out: []*dto.MetricFamily{}, + }, + // 1: Minimal case. + { + in: ` +minimal_metric 1.234 +another_metric -3e3 103948 +# Even that: +no_labels{} 3 +# HELP line for non-existing metric will be ignored. +`, + out: []*dto.MetricFamily{ + &dto.MetricFamily{ + Name: proto.String("minimal_metric"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(1.234), + }, + }, + }, + }, + &dto.MetricFamily{ + Name: proto.String("another_metric"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(-3e3), + }, + TimestampMs: proto.Int64(103948), + }, + }, + }, + &dto.MetricFamily{ + Name: proto.String("no_labels"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(3), + }, + }, + }, + }, + }, + }, + // 2: Counters & gauges, docstrings, various whitespace, escape sequences. + { + in: ` +# A normal comment. +# +# TYPE name counter +name{labelname="val1",basename="basevalue"} NaN +name {labelname="val2",basename="base\"v\\al\nue"} 0.23 1234567890 +# HELP name two-line\n doc str\\ing + + # HELP name2 doc str"ing 2 + # TYPE name2 gauge +name2{labelname="val2" ,basename = "basevalue2" } +Inf 54321 +name2{ labelname = "val1" , }-Inf +`, + out: []*dto.MetricFamily{ + &dto.MetricFamily{ + Name: proto.String("name"), + Help: proto.String("two-line\n doc str\\ing"), + Type: dto.MetricType_COUNTER.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("labelname"), + Value: proto.String("val1"), + }, + &dto.LabelPair{ + Name: proto.String("basename"), + Value: proto.String("basevalue"), + }, + }, + Counter: &dto.Counter{ + Value: proto.Float64(math.NaN()), + }, + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("labelname"), + Value: proto.String("val2"), + }, + &dto.LabelPair{ + Name: proto.String("basename"), + Value: proto.String("base\"v\\al\nue"), + }, + }, + Counter: &dto.Counter{ + Value: proto.Float64(.23), + }, + TimestampMs: proto.Int64(1234567890), + }, + }, + }, + &dto.MetricFamily{ + Name: proto.String("name2"), + Help: proto.String("doc str\"ing 2"), + Type: dto.MetricType_GAUGE.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("labelname"), + Value: proto.String("val2"), + }, + &dto.LabelPair{ + Name: proto.String("basename"), + Value: proto.String("basevalue2"), + }, + }, + Gauge: &dto.Gauge{ + Value: proto.Float64(math.Inf(+1)), + }, + TimestampMs: proto.Int64(54321), + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("labelname"), + Value: proto.String("val1"), + }, + }, + Gauge: &dto.Gauge{ + Value: proto.Float64(math.Inf(-1)), + }, + }, + }, + }, + }, + }, + // 3: The evil summary, mixed with other types and funny comments. + { + in: ` +# TYPE my_summary summary +my_summary{n1="val1",quantile="0.5"} 110 +decoy -1 -2 +my_summary{n1="val1",quantile="0.9"} 140 1 +my_summary_count{n1="val1"} 42 +# Latest timestamp wins in case of a summary. +my_summary_sum{n1="val1"} 4711 2 +fake_sum{n1="val1"} 2001 +# TYPE another_summary summary +another_summary_count{n2="val2",n1="val1"} 20 +my_summary_count{n2="val2",n1="val1"} 5 5 +another_summary{n1="val1",n2="val2",quantile=".3"} -1.2 +my_summary_sum{n1="val2"} 08 15 +my_summary{n1="val3", quantile="0.2"} 4711 + my_summary{n1="val1",n2="val2",quantile="-12.34",} NaN +# some +# funny comments +# HELP +# HELP +# HELP my_summary +# HELP my_summary +`, + out: []*dto.MetricFamily{ + &dto.MetricFamily{ + Name: proto.String("fake_sum"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("n1"), + Value: proto.String("val1"), + }, + }, + Untyped: &dto.Untyped{ + Value: proto.Float64(2001), + }, + }, + }, + }, + &dto.MetricFamily{ + Name: proto.String("decoy"), + Type: dto.MetricType_UNTYPED.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Untyped: &dto.Untyped{ + Value: proto.Float64(-1), + }, + TimestampMs: proto.Int64(-2), + }, + }, + }, + &dto.MetricFamily{ + Name: proto.String("my_summary"), + Type: dto.MetricType_SUMMARY.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("n1"), + Value: proto.String("val1"), + }, + }, + Summary: &dto.Summary{ + SampleCount: proto.Uint64(42), + SampleSum: proto.Float64(4711), + Quantile: []*dto.Quantile{ + &dto.Quantile{ + Quantile: proto.Float64(0.5), + Value: proto.Float64(110), + }, + &dto.Quantile{ + Quantile: proto.Float64(0.9), + Value: proto.Float64(140), + }, + }, + }, + TimestampMs: proto.Int64(2), + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("n2"), + Value: proto.String("val2"), + }, + &dto.LabelPair{ + Name: proto.String("n1"), + Value: proto.String("val1"), + }, + }, + Summary: &dto.Summary{ + SampleCount: proto.Uint64(5), + Quantile: []*dto.Quantile{ + &dto.Quantile{ + Quantile: proto.Float64(-12.34), + Value: proto.Float64(math.NaN()), + }, + }, + }, + TimestampMs: proto.Int64(5), + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("n1"), + Value: proto.String("val2"), + }, + }, + Summary: &dto.Summary{ + SampleSum: proto.Float64(8), + }, + TimestampMs: proto.Int64(15), + }, + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("n1"), + Value: proto.String("val3"), + }, + }, + Summary: &dto.Summary{ + Quantile: []*dto.Quantile{ + &dto.Quantile{ + Quantile: proto.Float64(0.2), + Value: proto.Float64(4711), + }, + }, + }, + }, + }, + }, + &dto.MetricFamily{ + Name: proto.String("another_summary"), + Type: dto.MetricType_SUMMARY.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Label: []*dto.LabelPair{ + &dto.LabelPair{ + Name: proto.String("n2"), + Value: proto.String("val2"), + }, + &dto.LabelPair{ + Name: proto.String("n1"), + Value: proto.String("val1"), + }, + }, + Summary: &dto.Summary{ + SampleCount: proto.Uint64(20), + Quantile: []*dto.Quantile{ + &dto.Quantile{ + Quantile: proto.Float64(0.3), + Value: proto.Float64(-1.2), + }, + }, + }, + }, + }, + }, + }, + }, + // 4: The histogram. + { + in: ` +# HELP request_duration_microseconds The response latency. +# TYPE request_duration_microseconds histogram +request_duration_microseconds_bucket{le="100"} 123 +request_duration_microseconds_bucket{le="120"} 412 +request_duration_microseconds_bucket{le="144"} 592 +request_duration_microseconds_bucket{le="172.8"} 1524 +request_duration_microseconds_bucket{le="+Inf"} 2693 +request_duration_microseconds_sum 1.7560473e+06 +request_duration_microseconds_count 2693 +`, + out: []*dto.MetricFamily{ + { + Name: proto.String("request_duration_microseconds"), + Help: proto.String("The response latency."), + Type: dto.MetricType_HISTOGRAM.Enum(), + Metric: []*dto.Metric{ + &dto.Metric{ + Histogram: &dto.Histogram{ + SampleCount: proto.Uint64(2693), + SampleSum: proto.Float64(1756047.3), + Bucket: []*dto.Bucket{ + &dto.Bucket{ + UpperBound: proto.Float64(100), + CumulativeCount: proto.Uint64(123), + }, + &dto.Bucket{ + UpperBound: proto.Float64(120), + CumulativeCount: proto.Uint64(412), + }, + &dto.Bucket{ + UpperBound: proto.Float64(144), + CumulativeCount: proto.Uint64(592), + }, + &dto.Bucket{ + UpperBound: proto.Float64(172.8), + CumulativeCount: proto.Uint64(1524), + }, + &dto.Bucket{ + UpperBound: proto.Float64(math.Inf(+1)), + CumulativeCount: proto.Uint64(2693), + }, + }, + }, + }, + }, + }, + }, + }, + } + + for i, scenario := range scenarios { + out, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in)) + if err != nil { + t.Errorf("%d. error: %s", i, err) + continue + } + if expected, got := len(scenario.out), len(out); expected != got { + t.Errorf( + "%d. expected %d MetricFamilies, got %d", + i, expected, got, + ) + } + for _, expected := range scenario.out { + got, ok := out[expected.GetName()] + if !ok { + t.Errorf( + "%d. expected MetricFamily %q, found none", + i, expected.GetName(), + ) + continue + } + if expected.String() != got.String() { + t.Errorf( + "%d. expected MetricFamily %s, got %s", + i, expected, got, + ) + } + } + } +} + +func TestTextParse(t *testing.T) { + testTextParse(t) +} + +func BenchmarkTextParse(b *testing.B) { + for i := 0; i < b.N; i++ { + testTextParse(b) + } +} + +func testTextParseError(t testing.TB) { + var scenarios = []struct { + in string + err string + }{ + // 0: No new-line at end of input. + { + in: ` +bla 3.14 +blubber 42`, + err: "text format parsing error in line 3: unexpected end of input stream", + }, + // 1: Invalid escape sequence in label value. + { + in: `metric{label="\t"} 3.14`, + err: "text format parsing error in line 1: invalid escape sequence", + }, + // 2: Newline in label value. + { + in: ` +metric{label="new +line"} 3.14 +`, + err: `text format parsing error in line 2: label value "new" contains unescaped new-line`, + }, + // 3: + { + in: `metric{@="bla"} 3.14`, + err: "text format parsing error in line 1: invalid label name for metric", + }, + // 4: + { + in: `metric{__name__="bla"} 3.14`, + err: `text format parsing error in line 1: label name "__name__" is reserved`, + }, + // 5: + { + in: `metric{label+="bla"} 3.14`, + err: "text format parsing error in line 1: expected '=' after label name", + }, + // 6: + { + in: `metric{label=bla} 3.14`, + err: "text format parsing error in line 1: expected '\"' at start of label value", + }, + // 7: + { + in: ` +# TYPE metric summary +metric{quantile="bla"} 3.14 +`, + err: "text format parsing error in line 3: expected float as value for 'quantile' label", + }, + // 8: + { + in: `metric{label="bla"+} 3.14`, + err: "text format parsing error in line 1: unexpected end of label value", + }, + // 9: + { + in: `metric{label="bla"} 3.14 2.72 +`, + err: "text format parsing error in line 1: expected integer as timestamp", + }, + // 10: + { + in: `metric{label="bla"} 3.14 2 3 +`, + err: "text format parsing error in line 1: spurious string after timestamp", + }, + // 11: + { + in: `metric{label="bla"} blubb +`, + err: "text format parsing error in line 1: expected float as value", + }, + // 12: + { + in: ` +# HELP metric one +# HELP metric two +`, + err: "text format parsing error in line 3: second HELP line for metric name", + }, + // 13: + { + in: ` +# TYPE metric counter +# TYPE metric untyped +`, + err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`, + }, + // 14: + { + in: ` +metric 4.12 +# TYPE metric counter +`, + err: `text format parsing error in line 3: second TYPE line for metric name "metric", or TYPE reported after samples`, + }, + // 14: + { + in: ` +# TYPE metric bla +`, + err: "text format parsing error in line 2: unknown metric type", + }, + // 15: + { + in: ` +# TYPE met-ric +`, + err: "text format parsing error in line 2: invalid metric name in comment", + }, + // 16: + { + in: `@invalidmetric{label="bla"} 3.14 2`, + err: "text format parsing error in line 1: invalid metric name", + }, + // 17: + { + in: `{label="bla"} 3.14 2`, + err: "text format parsing error in line 1: invalid metric name", + }, + // 18: + { + in: ` +# TYPE metric histogram +metric_bucket{le="bla"} 3.14 +`, + err: "text format parsing error in line 3: expected float as value for 'le' label", + }, + } + + for i, scenario := range scenarios { + _, err := parser.TextToMetricFamilies(strings.NewReader(scenario.in)) + if err == nil { + t.Errorf("%d. expected error, got nil", i) + continue + } + if expected, got := scenario.err, err.Error(); strings.Index(got, expected) != 0 { + t.Errorf( + "%d. expected error starting with %q, got %q", + i, expected, got, + ) + } + } + +} + +func TestTextParseError(t *testing.T) { + testTextParseError(t) +} + +func BenchmarkParseError(b *testing.B) { + for i := 0; i < b.N; i++ { + testTextParseError(b) + } +} diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt index 89715daf0a..7723656d58 100644 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt +++ b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt @@ -1,67 +1,67 @@ -PACKAGE - -package goautoneg -import "bitbucket.org/ww/goautoneg" - -HTTP Content-Type Autonegotiation. - -The functions in this package implement the behaviour specified in -http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - -Copyright (c) 2011, Open Knowledge Foundation Ltd. -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 the Open Knowledge Foundation Ltd. 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 -HOLDER 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. - - -FUNCTIONS - -func Negotiate(header string, alternatives []string) (content_type string) -Negotiate the most appropriate content_type given the accept header -and a list of alternatives. - -func ParseAccept(header string) (accept []Accept) -Parse an Accept Header string returning a sorted list -of clauses - - -TYPES - -type Accept struct { - Type, SubType string - Q float32 - Params map[string]string -} -Structure to represent a clause in an HTTP Accept Header - - -SUBDIRECTORIES - - .hg +PACKAGE + +package goautoneg +import "bitbucket.org/ww/goautoneg" + +HTTP Content-Type Autonegotiation. + +The functions in this package implement the behaviour specified in +http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html + +Copyright (c) 2011, Open Knowledge Foundation Ltd. +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 the Open Knowledge Foundation Ltd. 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 +HOLDER 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. + + +FUNCTIONS + +func Negotiate(header string, alternatives []string) (content_type string) +Negotiate the most appropriate content_type given the accept header +and a list of alternatives. + +func ParseAccept(header string) (accept []Accept) +Parse an Accept Header string returning a sorted list +of clauses + + +TYPES + +type Accept struct { + Type, SubType string + Q float32 + Params map[string]string +} +Structure to represent a clause in an HTTP Accept Header + + +SUBDIRECTORIES + + .hg diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go index 44a616c15b..648b38cb65 100644 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go +++ b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go @@ -1,162 +1,162 @@ -/* -HTTP Content-Type Autonegotiation. - -The functions in this package implement the behaviour specified in -http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - -Copyright (c) 2011, Open Knowledge Foundation Ltd. -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 the Open Knowledge Foundation Ltd. 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 -HOLDER 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. - - -*/ -package goautoneg - -import ( - "sort" - "strconv" - "strings" -) - -// Structure to represent a clause in an HTTP Accept Header -type Accept struct { - Type, SubType string - Q float64 - Params map[string]string -} - -// For internal use, so that we can use the sort interface -type accept_slice []Accept - -func (accept accept_slice) Len() int { - slice := []Accept(accept) - return len(slice) -} - -func (accept accept_slice) Less(i, j int) bool { - slice := []Accept(accept) - ai, aj := slice[i], slice[j] - if ai.Q > aj.Q { - return true - } - if ai.Type != "*" && aj.Type == "*" { - return true - } - if ai.SubType != "*" && aj.SubType == "*" { - return true - } - return false -} - -func (accept accept_slice) Swap(i, j int) { - slice := []Accept(accept) - slice[i], slice[j] = slice[j], slice[i] -} - -// Parse an Accept Header string returning a sorted list -// of clauses -func ParseAccept(header string) (accept []Accept) { - parts := strings.Split(header, ",") - accept = make([]Accept, 0, len(parts)) - for _, part := range parts { - part := strings.Trim(part, " ") - - a := Accept{} - a.Params = make(map[string]string) - a.Q = 1.0 - - mrp := strings.Split(part, ";") - - media_range := mrp[0] - sp := strings.Split(media_range, "/") - a.Type = strings.Trim(sp[0], " ") - - switch { - case len(sp) == 1 && a.Type == "*": - a.SubType = "*" - case len(sp) == 2: - a.SubType = strings.Trim(sp[1], " ") - default: - continue - } - - if len(mrp) == 1 { - accept = append(accept, a) - continue - } - - for _, param := range mrp[1:] { - sp := strings.SplitN(param, "=", 2) - if len(sp) != 2 { - continue - } - token := strings.Trim(sp[0], " ") - if token == "q" { - a.Q, _ = strconv.ParseFloat(sp[1], 32) - } else { - a.Params[token] = strings.Trim(sp[1], " ") - } - } - - accept = append(accept, a) - } - - slice := accept_slice(accept) - sort.Sort(slice) - - return -} - -// Negotiate the most appropriate content_type given the accept header -// and a list of alternatives. -func Negotiate(header string, alternatives []string) (content_type string) { - asp := make([][]string, 0, len(alternatives)) - for _, ctype := range alternatives { - asp = append(asp, strings.SplitN(ctype, "/", 2)) - } - for _, clause := range ParseAccept(header) { - for i, ctsp := range asp { - if clause.Type == ctsp[0] && clause.SubType == ctsp[1] { - content_type = alternatives[i] - return - } - if clause.Type == ctsp[0] && clause.SubType == "*" { - content_type = alternatives[i] - return - } - if clause.Type == "*" && clause.SubType == "*" { - content_type = alternatives[i] - return - } - } - } - return -} +/* +HTTP Content-Type Autonegotiation. + +The functions in this package implement the behaviour specified in +http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html + +Copyright (c) 2011, Open Knowledge Foundation Ltd. +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 the Open Knowledge Foundation Ltd. 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 +HOLDER 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. + + +*/ +package goautoneg + +import ( + "sort" + "strconv" + "strings" +) + +// Structure to represent a clause in an HTTP Accept Header +type Accept struct { + Type, SubType string + Q float64 + Params map[string]string +} + +// For internal use, so that we can use the sort interface +type accept_slice []Accept + +func (accept accept_slice) Len() int { + slice := []Accept(accept) + return len(slice) +} + +func (accept accept_slice) Less(i, j int) bool { + slice := []Accept(accept) + ai, aj := slice[i], slice[j] + if ai.Q > aj.Q { + return true + } + if ai.Type != "*" && aj.Type == "*" { + return true + } + if ai.SubType != "*" && aj.SubType == "*" { + return true + } + return false +} + +func (accept accept_slice) Swap(i, j int) { + slice := []Accept(accept) + slice[i], slice[j] = slice[j], slice[i] +} + +// Parse an Accept Header string returning a sorted list +// of clauses +func ParseAccept(header string) (accept []Accept) { + parts := strings.Split(header, ",") + accept = make([]Accept, 0, len(parts)) + for _, part := range parts { + part := strings.Trim(part, " ") + + a := Accept{} + a.Params = make(map[string]string) + a.Q = 1.0 + + mrp := strings.Split(part, ";") + + media_range := mrp[0] + sp := strings.Split(media_range, "/") + a.Type = strings.Trim(sp[0], " ") + + switch { + case len(sp) == 1 && a.Type == "*": + a.SubType = "*" + case len(sp) == 2: + a.SubType = strings.Trim(sp[1], " ") + default: + continue + } + + if len(mrp) == 1 { + accept = append(accept, a) + continue + } + + for _, param := range mrp[1:] { + sp := strings.SplitN(param, "=", 2) + if len(sp) != 2 { + continue + } + token := strings.Trim(sp[0], " ") + if token == "q" { + a.Q, _ = strconv.ParseFloat(sp[1], 32) + } else { + a.Params[token] = strings.Trim(sp[1], " ") + } + } + + accept = append(accept, a) + } + + slice := accept_slice(accept) + sort.Sort(slice) + + return +} + +// Negotiate the most appropriate content_type given the accept header +// and a list of alternatives. +func Negotiate(header string, alternatives []string) (content_type string) { + asp := make([][]string, 0, len(alternatives)) + for _, ctype := range alternatives { + asp = append(asp, strings.SplitN(ctype, "/", 2)) + } + for _, clause := range ParseAccept(header) { + for i, ctsp := range asp { + if clause.Type == ctsp[0] && clause.SubType == ctsp[1] { + content_type = alternatives[i] + return + } + if clause.Type == ctsp[0] && clause.SubType == "*" { + content_type = alternatives[i] + return + } + if clause.Type == "*" && clause.SubType == "*" { + content_type = alternatives[i] + return + } + } + } + return +} diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go index aa237f393e..41d328f1d5 100644 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go +++ b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go @@ -1,33 +1,33 @@ -package goautoneg - -import ( - "testing" -) - -var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" - -func TestParseAccept(t *testing.T) { - alternatives := []string{"text/html", "image/png"} - content_type := Negotiate(chrome, alternatives) - if content_type != "image/png" { - t.Errorf("got %s expected image/png", content_type) - } - - alternatives = []string{"text/html", "text/plain", "text/n3"} - content_type = Negotiate(chrome, alternatives) - if content_type != "text/html" { - t.Errorf("got %s expected text/html", content_type) - } - - alternatives = []string{"text/n3", "text/plain"} - content_type = Negotiate(chrome, alternatives) - if content_type != "text/plain" { - t.Errorf("got %s expected text/plain", content_type) - } - - alternatives = []string{"text/n3", "application/rdf+xml"} - content_type = Negotiate(chrome, alternatives) - if content_type != "text/n3" { - t.Errorf("got %s expected text/n3", content_type) - } -} +package goautoneg + +import ( + "testing" +) + +var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" + +func TestParseAccept(t *testing.T) { + alternatives := []string{"text/html", "image/png"} + content_type := Negotiate(chrome, alternatives) + if content_type != "image/png" { + t.Errorf("got %s expected image/png", content_type) + } + + alternatives = []string{"text/html", "text/plain", "text/n3"} + content_type = Negotiate(chrome, alternatives) + if content_type != "text/html" { + t.Errorf("got %s expected text/html", content_type) + } + + alternatives = []string{"text/n3", "text/plain"} + content_type = Negotiate(chrome, alternatives) + if content_type != "text/plain" { + t.Errorf("got %s expected text/plain", content_type) + } + + alternatives = []string{"text/n3", "application/rdf+xml"} + content_type = Negotiate(chrome, alternatives) + if content_type != "text/n3" { + t.Errorf("got %s expected text/n3", content_type) + } +} diff --git a/vendor/github.com/prometheus/common/log/eventlog_formatter.go b/vendor/github.com/prometheus/common/log/eventlog_formatter.go index b9e6d62cb4..6d41284ce1 100644 --- a/vendor/github.com/prometheus/common/log/eventlog_formatter.go +++ b/vendor/github.com/prometheus/common/log/eventlog_formatter.go @@ -1,89 +1,89 @@ -// Copyright 2015 The Prometheus Authors -// 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. - -// +build windows - -package log - -import ( - "fmt" - "os" - - "golang.org/x/sys/windows/svc/eventlog" - - "github.com/Sirupsen/logrus" -) - -func init() { - setEventlogFormatter = func(name string, debugAsInfo bool) error { - if name == "" { - return fmt.Errorf("missing name parameter") - } - - fmter, err := newEventlogger(name, debugAsInfo, origLogger.Formatter) - if err != nil { - fmt.Fprintf(os.Stderr, "error creating eventlog formatter: %v\n", err) - origLogger.Errorf("can't connect logger to eventlog: %v", err) - return err - } - origLogger.Formatter = fmter - return nil - } -} - -type eventlogger struct { - log *eventlog.Log - debugAsInfo bool - wrap logrus.Formatter -} - -func newEventlogger(name string, debugAsInfo bool, fmter logrus.Formatter) (*eventlogger, error) { - logHandle, err := eventlog.Open(name) - if err != nil { - return nil, err - } - return &eventlogger{log: logHandle, debugAsInfo: debugAsInfo, wrap: fmter}, nil -} - -func (s *eventlogger) Format(e *logrus.Entry) ([]byte, error) { - data, err := s.wrap.Format(e) - if err != nil { - fmt.Fprintf(os.Stderr, "eventlogger: can't format entry: %v\n", err) - return data, err - } - - switch e.Level { - case logrus.PanicLevel: - fallthrough - case logrus.FatalLevel: - fallthrough - case logrus.ErrorLevel: - err = s.log.Error(102, e.Message) - case logrus.WarnLevel: - err = s.log.Warning(101, e.Message) - case logrus.InfoLevel: - err = s.log.Info(100, e.Message) - case logrus.DebugLevel: - if s.debugAsInfo { - err = s.log.Info(100, e.Message) - } - default: - err = s.log.Info(100, e.Message) - } - - if err != nil { - fmt.Fprintf(os.Stderr, "eventlogger: can't send log to eventlog: %v\n", err) - } - - return data, err -} +// Copyright 2015 The Prometheus Authors +// 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. + +// +build windows + +package log + +import ( + "fmt" + "os" + + "golang.org/x/sys/windows/svc/eventlog" + + "github.com/Sirupsen/logrus" +) + +func init() { + setEventlogFormatter = func(name string, debugAsInfo bool) error { + if name == "" { + return fmt.Errorf("missing name parameter") + } + + fmter, err := newEventlogger(name, debugAsInfo, origLogger.Formatter) + if err != nil { + fmt.Fprintf(os.Stderr, "error creating eventlog formatter: %v\n", err) + origLogger.Errorf("can't connect logger to eventlog: %v", err) + return err + } + origLogger.Formatter = fmter + return nil + } +} + +type eventlogger struct { + log *eventlog.Log + debugAsInfo bool + wrap logrus.Formatter +} + +func newEventlogger(name string, debugAsInfo bool, fmter logrus.Formatter) (*eventlogger, error) { + logHandle, err := eventlog.Open(name) + if err != nil { + return nil, err + } + return &eventlogger{log: logHandle, debugAsInfo: debugAsInfo, wrap: fmter}, nil +} + +func (s *eventlogger) Format(e *logrus.Entry) ([]byte, error) { + data, err := s.wrap.Format(e) + if err != nil { + fmt.Fprintf(os.Stderr, "eventlogger: can't format entry: %v\n", err) + return data, err + } + + switch e.Level { + case logrus.PanicLevel: + fallthrough + case logrus.FatalLevel: + fallthrough + case logrus.ErrorLevel: + err = s.log.Error(102, e.Message) + case logrus.WarnLevel: + err = s.log.Warning(101, e.Message) + case logrus.InfoLevel: + err = s.log.Info(100, e.Message) + case logrus.DebugLevel: + if s.debugAsInfo { + err = s.log.Info(100, e.Message) + } + default: + err = s.log.Info(100, e.Message) + } + + if err != nil { + fmt.Fprintf(os.Stderr, "eventlogger: can't send log to eventlog: %v\n", err) + } + + return data, err +} diff --git a/vendor/github.com/prometheus/common/log/log.go b/vendor/github.com/prometheus/common/log/log.go index 003cc1093e..0a74a7f92a 100644 --- a/vendor/github.com/prometheus/common/log/log.go +++ b/vendor/github.com/prometheus/common/log/log.go @@ -1,365 +1,365 @@ -// Copyright 2015 The Prometheus Authors -// 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 log - -import ( - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "net/url" - "os" - "runtime" - "strconv" - "strings" - - "github.com/Sirupsen/logrus" -) - -type levelFlag string - -// String implements flag.Value. -func (f levelFlag) String() string { - return fmt.Sprintf("%q", origLogger.Level.String()) -} - -// Set implements flag.Value. -func (f levelFlag) Set(level string) error { - l, err := logrus.ParseLevel(level) - if err != nil { - return err - } - origLogger.Level = l - return nil -} - -// setSyslogFormatter is nil if the target architecture does not support syslog. -var setSyslogFormatter func(string, string) error - -// setEventlogFormatter is nil if the target OS does not support Eventlog (i.e., is not Windows). -var setEventlogFormatter func(string, bool) error - -func setJSONFormatter() { - origLogger.Formatter = &logrus.JSONFormatter{} -} - -type logFormatFlag url.URL - -// String implements flag.Value. -func (f logFormatFlag) String() string { - u := url.URL(f) - return fmt.Sprintf("%q", u.String()) -} - -// Set implements flag.Value. -func (f logFormatFlag) Set(format string) error { - u, err := url.Parse(format) - if err != nil { - return err - } - if u.Scheme != "logger" { - return fmt.Errorf("invalid scheme %s", u.Scheme) - } - jsonq := u.Query().Get("json") - if jsonq == "true" { - setJSONFormatter() - } - - switch u.Opaque { - case "syslog": - if setSyslogFormatter == nil { - return fmt.Errorf("system does not support syslog") - } - appname := u.Query().Get("appname") - facility := u.Query().Get("local") - return setSyslogFormatter(appname, facility) - case "eventlog": - if setEventlogFormatter == nil { - return fmt.Errorf("system does not support eventlog") - } - name := u.Query().Get("name") - debugAsInfo := false - debugAsInfoRaw := u.Query().Get("debugAsInfo") - if parsedDebugAsInfo, err := strconv.ParseBool(debugAsInfoRaw); err == nil { - debugAsInfo = parsedDebugAsInfo - } - return setEventlogFormatter(name, debugAsInfo) - case "stdout": - origLogger.Out = os.Stdout - case "stderr": - origLogger.Out = os.Stderr - default: - return fmt.Errorf("unsupported logger %q", u.Opaque) - } - return nil -} - -func init() { - AddFlags(flag.CommandLine) -} - -// AddFlags adds the flags used by this package to the given FlagSet. That's -// useful if working with a custom FlagSet. The init function of this package -// adds the flags to flag.CommandLine anyway. Thus, it's usually enough to call -// flag.Parse() to make the logging flags take effect. -func AddFlags(fs *flag.FlagSet) { - fs.Var( - levelFlag(origLogger.Level.String()), - "log.level", - "Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]", - ) - fs.Var( - logFormatFlag(url.URL{Scheme: "logger", Opaque: "stderr"}), - "log.format", - `Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"`, - ) -} - -// Logger is the interface for loggers used in the Prometheus components. -type Logger interface { - Debug(...interface{}) - Debugln(...interface{}) - Debugf(string, ...interface{}) - - Info(...interface{}) - Infoln(...interface{}) - Infof(string, ...interface{}) - - Warn(...interface{}) - Warnln(...interface{}) - Warnf(string, ...interface{}) - - Error(...interface{}) - Errorln(...interface{}) - Errorf(string, ...interface{}) - - Fatal(...interface{}) - Fatalln(...interface{}) - Fatalf(string, ...interface{}) - - With(key string, value interface{}) Logger -} - -type logger struct { - entry *logrus.Entry -} - -func (l logger) With(key string, value interface{}) Logger { - return logger{l.entry.WithField(key, value)} -} - -// Debug logs a message at level Debug on the standard logger. -func (l logger) Debug(args ...interface{}) { - l.sourced().Debug(args...) -} - -// Debug logs a message at level Debug on the standard logger. -func (l logger) Debugln(args ...interface{}) { - l.sourced().Debugln(args...) -} - -// Debugf logs a message at level Debug on the standard logger. -func (l logger) Debugf(format string, args ...interface{}) { - l.sourced().Debugf(format, args...) -} - -// Info logs a message at level Info on the standard logger. -func (l logger) Info(args ...interface{}) { - l.sourced().Info(args...) -} - -// Info logs a message at level Info on the standard logger. -func (l logger) Infoln(args ...interface{}) { - l.sourced().Infoln(args...) -} - -// Infof logs a message at level Info on the standard logger. -func (l logger) Infof(format string, args ...interface{}) { - l.sourced().Infof(format, args...) -} - -// Warn logs a message at level Warn on the standard logger. -func (l logger) Warn(args ...interface{}) { - l.sourced().Warn(args...) -} - -// Warn logs a message at level Warn on the standard logger. -func (l logger) Warnln(args ...interface{}) { - l.sourced().Warnln(args...) -} - -// Warnf logs a message at level Warn on the standard logger. -func (l logger) Warnf(format string, args ...interface{}) { - l.sourced().Warnf(format, args...) -} - -// Error logs a message at level Error on the standard logger. -func (l logger) Error(args ...interface{}) { - l.sourced().Error(args...) -} - -// Error logs a message at level Error on the standard logger. -func (l logger) Errorln(args ...interface{}) { - l.sourced().Errorln(args...) -} - -// Errorf logs a message at level Error on the standard logger. -func (l logger) Errorf(format string, args ...interface{}) { - l.sourced().Errorf(format, args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func (l logger) Fatal(args ...interface{}) { - l.sourced().Fatal(args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func (l logger) Fatalln(args ...interface{}) { - l.sourced().Fatalln(args...) -} - -// Fatalf logs a message at level Fatal on the standard logger. -func (l logger) Fatalf(format string, args ...interface{}) { - l.sourced().Fatalf(format, args...) -} - -// sourced adds a source field to the logger that contains -// the file name and line where the logging happened. -func (l logger) sourced() *logrus.Entry { - _, file, line, ok := runtime.Caller(2) - if !ok { - file = "" - line = 1 - } else { - slash := strings.LastIndex(file, "/") - file = file[slash+1:] - } - return l.entry.WithField("source", fmt.Sprintf("%s:%d", file, line)) -} - -var origLogger = logrus.New() -var baseLogger = logger{entry: logrus.NewEntry(origLogger)} - -// Base returns the default Logger logging to -func Base() Logger { - return baseLogger -} - -// NewLogger returns a new Logger logging to out. -func NewLogger(w io.Writer) Logger { - l := logrus.New() - l.Out = w - return logger{entry: logrus.NewEntry(l)} -} - -// NewNopLogger returns a logger that discards all log messages. -func NewNopLogger() Logger { - l := logrus.New() - l.Out = ioutil.Discard - return logger{entry: logrus.NewEntry(l)} -} - -// With adds a field to the logger. -func With(key string, value interface{}) Logger { - return baseLogger.With(key, value) -} - -// Debug logs a message at level Debug on the standard logger. -func Debug(args ...interface{}) { - baseLogger.sourced().Debug(args...) -} - -// Debugln logs a message at level Debug on the standard logger. -func Debugln(args ...interface{}) { - baseLogger.sourced().Debugln(args...) -} - -// Debugf logs a message at level Debug on the standard logger. -func Debugf(format string, args ...interface{}) { - baseLogger.sourced().Debugf(format, args...) -} - -// Info logs a message at level Info on the standard logger. -func Info(args ...interface{}) { - baseLogger.sourced().Info(args...) -} - -// Infoln logs a message at level Info on the standard logger. -func Infoln(args ...interface{}) { - baseLogger.sourced().Infoln(args...) -} - -// Infof logs a message at level Info on the standard logger. -func Infof(format string, args ...interface{}) { - baseLogger.sourced().Infof(format, args...) -} - -// Warn logs a message at level Warn on the standard logger. -func Warn(args ...interface{}) { - baseLogger.sourced().Warn(args...) -} - -// Warnln logs a message at level Warn on the standard logger. -func Warnln(args ...interface{}) { - baseLogger.sourced().Warnln(args...) -} - -// Warnf logs a message at level Warn on the standard logger. -func Warnf(format string, args ...interface{}) { - baseLogger.sourced().Warnf(format, args...) -} - -// Error logs a message at level Error on the standard logger. -func Error(args ...interface{}) { - baseLogger.sourced().Error(args...) -} - -// Errorln logs a message at level Error on the standard logger. -func Errorln(args ...interface{}) { - baseLogger.sourced().Errorln(args...) -} - -// Errorf logs a message at level Error on the standard logger. -func Errorf(format string, args ...interface{}) { - baseLogger.sourced().Errorf(format, args...) -} - -// Fatal logs a message at level Fatal on the standard logger. -func Fatal(args ...interface{}) { - baseLogger.sourced().Fatal(args...) -} - -// Fatalln logs a message at level Fatal on the standard logger. -func Fatalln(args ...interface{}) { - baseLogger.sourced().Fatalln(args...) -} - -// Fatalf logs a message at level Fatal on the standard logger. -func Fatalf(format string, args ...interface{}) { - baseLogger.sourced().Fatalf(format, args...) -} - -type errorLogWriter struct{} - -func (errorLogWriter) Write(b []byte) (int, error) { - baseLogger.sourced().Error(string(b)) - return len(b), nil -} - -// NewErrorLogger returns a log.Logger that is meant to be used -// in the ErrorLog field of an http.Server to log HTTP server errors. -func NewErrorLogger() *log.Logger { - return log.New(&errorLogWriter{}, "", 0) -} +// Copyright 2015 The Prometheus Authors +// 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 log + +import ( + "flag" + "fmt" + "io" + "io/ioutil" + "log" + "net/url" + "os" + "runtime" + "strconv" + "strings" + + "github.com/Sirupsen/logrus" +) + +type levelFlag string + +// String implements flag.Value. +func (f levelFlag) String() string { + return fmt.Sprintf("%q", origLogger.Level.String()) +} + +// Set implements flag.Value. +func (f levelFlag) Set(level string) error { + l, err := logrus.ParseLevel(level) + if err != nil { + return err + } + origLogger.Level = l + return nil +} + +// setSyslogFormatter is nil if the target architecture does not support syslog. +var setSyslogFormatter func(string, string) error + +// setEventlogFormatter is nil if the target OS does not support Eventlog (i.e., is not Windows). +var setEventlogFormatter func(string, bool) error + +func setJSONFormatter() { + origLogger.Formatter = &logrus.JSONFormatter{} +} + +type logFormatFlag url.URL + +// String implements flag.Value. +func (f logFormatFlag) String() string { + u := url.URL(f) + return fmt.Sprintf("%q", u.String()) +} + +// Set implements flag.Value. +func (f logFormatFlag) Set(format string) error { + u, err := url.Parse(format) + if err != nil { + return err + } + if u.Scheme != "logger" { + return fmt.Errorf("invalid scheme %s", u.Scheme) + } + jsonq := u.Query().Get("json") + if jsonq == "true" { + setJSONFormatter() + } + + switch u.Opaque { + case "syslog": + if setSyslogFormatter == nil { + return fmt.Errorf("system does not support syslog") + } + appname := u.Query().Get("appname") + facility := u.Query().Get("local") + return setSyslogFormatter(appname, facility) + case "eventlog": + if setEventlogFormatter == nil { + return fmt.Errorf("system does not support eventlog") + } + name := u.Query().Get("name") + debugAsInfo := false + debugAsInfoRaw := u.Query().Get("debugAsInfo") + if parsedDebugAsInfo, err := strconv.ParseBool(debugAsInfoRaw); err == nil { + debugAsInfo = parsedDebugAsInfo + } + return setEventlogFormatter(name, debugAsInfo) + case "stdout": + origLogger.Out = os.Stdout + case "stderr": + origLogger.Out = os.Stderr + default: + return fmt.Errorf("unsupported logger %q", u.Opaque) + } + return nil +} + +func init() { + AddFlags(flag.CommandLine) +} + +// AddFlags adds the flags used by this package to the given FlagSet. That's +// useful if working with a custom FlagSet. The init function of this package +// adds the flags to flag.CommandLine anyway. Thus, it's usually enough to call +// flag.Parse() to make the logging flags take effect. +func AddFlags(fs *flag.FlagSet) { + fs.Var( + levelFlag(origLogger.Level.String()), + "log.level", + "Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]", + ) + fs.Var( + logFormatFlag(url.URL{Scheme: "logger", Opaque: "stderr"}), + "log.format", + `Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"`, + ) +} + +// Logger is the interface for loggers used in the Prometheus components. +type Logger interface { + Debug(...interface{}) + Debugln(...interface{}) + Debugf(string, ...interface{}) + + Info(...interface{}) + Infoln(...interface{}) + Infof(string, ...interface{}) + + Warn(...interface{}) + Warnln(...interface{}) + Warnf(string, ...interface{}) + + Error(...interface{}) + Errorln(...interface{}) + Errorf(string, ...interface{}) + + Fatal(...interface{}) + Fatalln(...interface{}) + Fatalf(string, ...interface{}) + + With(key string, value interface{}) Logger +} + +type logger struct { + entry *logrus.Entry +} + +func (l logger) With(key string, value interface{}) Logger { + return logger{l.entry.WithField(key, value)} +} + +// Debug logs a message at level Debug on the standard logger. +func (l logger) Debug(args ...interface{}) { + l.sourced().Debug(args...) +} + +// Debug logs a message at level Debug on the standard logger. +func (l logger) Debugln(args ...interface{}) { + l.sourced().Debugln(args...) +} + +// Debugf logs a message at level Debug on the standard logger. +func (l logger) Debugf(format string, args ...interface{}) { + l.sourced().Debugf(format, args...) +} + +// Info logs a message at level Info on the standard logger. +func (l logger) Info(args ...interface{}) { + l.sourced().Info(args...) +} + +// Info logs a message at level Info on the standard logger. +func (l logger) Infoln(args ...interface{}) { + l.sourced().Infoln(args...) +} + +// Infof logs a message at level Info on the standard logger. +func (l logger) Infof(format string, args ...interface{}) { + l.sourced().Infof(format, args...) +} + +// Warn logs a message at level Warn on the standard logger. +func (l logger) Warn(args ...interface{}) { + l.sourced().Warn(args...) +} + +// Warn logs a message at level Warn on the standard logger. +func (l logger) Warnln(args ...interface{}) { + l.sourced().Warnln(args...) +} + +// Warnf logs a message at level Warn on the standard logger. +func (l logger) Warnf(format string, args ...interface{}) { + l.sourced().Warnf(format, args...) +} + +// Error logs a message at level Error on the standard logger. +func (l logger) Error(args ...interface{}) { + l.sourced().Error(args...) +} + +// Error logs a message at level Error on the standard logger. +func (l logger) Errorln(args ...interface{}) { + l.sourced().Errorln(args...) +} + +// Errorf logs a message at level Error on the standard logger. +func (l logger) Errorf(format string, args ...interface{}) { + l.sourced().Errorf(format, args...) +} + +// Fatal logs a message at level Fatal on the standard logger. +func (l logger) Fatal(args ...interface{}) { + l.sourced().Fatal(args...) +} + +// Fatal logs a message at level Fatal on the standard logger. +func (l logger) Fatalln(args ...interface{}) { + l.sourced().Fatalln(args...) +} + +// Fatalf logs a message at level Fatal on the standard logger. +func (l logger) Fatalf(format string, args ...interface{}) { + l.sourced().Fatalf(format, args...) +} + +// sourced adds a source field to the logger that contains +// the file name and line where the logging happened. +func (l logger) sourced() *logrus.Entry { + _, file, line, ok := runtime.Caller(2) + if !ok { + file = "" + line = 1 + } else { + slash := strings.LastIndex(file, "/") + file = file[slash+1:] + } + return l.entry.WithField("source", fmt.Sprintf("%s:%d", file, line)) +} + +var origLogger = logrus.New() +var baseLogger = logger{entry: logrus.NewEntry(origLogger)} + +// Base returns the default Logger logging to +func Base() Logger { + return baseLogger +} + +// NewLogger returns a new Logger logging to out. +func NewLogger(w io.Writer) Logger { + l := logrus.New() + l.Out = w + return logger{entry: logrus.NewEntry(l)} +} + +// NewNopLogger returns a logger that discards all log messages. +func NewNopLogger() Logger { + l := logrus.New() + l.Out = ioutil.Discard + return logger{entry: logrus.NewEntry(l)} +} + +// With adds a field to the logger. +func With(key string, value interface{}) Logger { + return baseLogger.With(key, value) +} + +// Debug logs a message at level Debug on the standard logger. +func Debug(args ...interface{}) { + baseLogger.sourced().Debug(args...) +} + +// Debugln logs a message at level Debug on the standard logger. +func Debugln(args ...interface{}) { + baseLogger.sourced().Debugln(args...) +} + +// Debugf logs a message at level Debug on the standard logger. +func Debugf(format string, args ...interface{}) { + baseLogger.sourced().Debugf(format, args...) +} + +// Info logs a message at level Info on the standard logger. +func Info(args ...interface{}) { + baseLogger.sourced().Info(args...) +} + +// Infoln logs a message at level Info on the standard logger. +func Infoln(args ...interface{}) { + baseLogger.sourced().Infoln(args...) +} + +// Infof logs a message at level Info on the standard logger. +func Infof(format string, args ...interface{}) { + baseLogger.sourced().Infof(format, args...) +} + +// Warn logs a message at level Warn on the standard logger. +func Warn(args ...interface{}) { + baseLogger.sourced().Warn(args...) +} + +// Warnln logs a message at level Warn on the standard logger. +func Warnln(args ...interface{}) { + baseLogger.sourced().Warnln(args...) +} + +// Warnf logs a message at level Warn on the standard logger. +func Warnf(format string, args ...interface{}) { + baseLogger.sourced().Warnf(format, args...) +} + +// Error logs a message at level Error on the standard logger. +func Error(args ...interface{}) { + baseLogger.sourced().Error(args...) +} + +// Errorln logs a message at level Error on the standard logger. +func Errorln(args ...interface{}) { + baseLogger.sourced().Errorln(args...) +} + +// Errorf logs a message at level Error on the standard logger. +func Errorf(format string, args ...interface{}) { + baseLogger.sourced().Errorf(format, args...) +} + +// Fatal logs a message at level Fatal on the standard logger. +func Fatal(args ...interface{}) { + baseLogger.sourced().Fatal(args...) +} + +// Fatalln logs a message at level Fatal on the standard logger. +func Fatalln(args ...interface{}) { + baseLogger.sourced().Fatalln(args...) +} + +// Fatalf logs a message at level Fatal on the standard logger. +func Fatalf(format string, args ...interface{}) { + baseLogger.sourced().Fatalf(format, args...) +} + +type errorLogWriter struct{} + +func (errorLogWriter) Write(b []byte) (int, error) { + baseLogger.sourced().Error(string(b)) + return len(b), nil +} + +// NewErrorLogger returns a log.Logger that is meant to be used +// in the ErrorLog field of an http.Server to log HTTP server errors. +func NewErrorLogger() *log.Logger { + return log.New(&errorLogWriter{}, "", 0) +} diff --git a/vendor/github.com/prometheus/common/log/log_test.go b/vendor/github.com/prometheus/common/log/log_test.go index b305f3d268..953adb79cd 100644 --- a/vendor/github.com/prometheus/common/log/log_test.go +++ b/vendor/github.com/prometheus/common/log/log_test.go @@ -1,39 +1,39 @@ -// Copyright 2015 The Prometheus Authors -// 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 log - -import ( - "bytes" - "regexp" - "testing" - - "github.com/Sirupsen/logrus" -) - -func TestFileLineLogging(t *testing.T) { - var buf bytes.Buffer - origLogger.Out = &buf - origLogger.Formatter = &logrus.TextFormatter{ - DisableColors: true, - } - - // The default logging level should be "info". - Debug("This debug-level line should not show up in the output.") - Infof("This %s-level line should show up in the output.", "info") - - re := `^time=".*" level=info msg="This info-level line should show up in the output." source="log_test.go:33" \n$` - if !regexp.MustCompile(re).Match(buf.Bytes()) { - t.Fatalf("%q did not match expected regex %q", buf.String(), re) - } -} +// Copyright 2015 The Prometheus Authors +// 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 log + +import ( + "bytes" + "regexp" + "testing" + + "github.com/Sirupsen/logrus" +) + +func TestFileLineLogging(t *testing.T) { + var buf bytes.Buffer + origLogger.Out = &buf + origLogger.Formatter = &logrus.TextFormatter{ + DisableColors: true, + } + + // The default logging level should be "info". + Debug("This debug-level line should not show up in the output.") + Infof("This %s-level line should show up in the output.", "info") + + re := `^time=".*" level=info msg="This info-level line should show up in the output." source="log_test.go:33" \n$` + if !regexp.MustCompile(re).Match(buf.Bytes()) { + t.Fatalf("%q did not match expected regex %q", buf.String(), re) + } +} diff --git a/vendor/github.com/prometheus/common/log/syslog_formatter.go b/vendor/github.com/prometheus/common/log/syslog_formatter.go index 3ddbcceaaf..64f5fdac95 100644 --- a/vendor/github.com/prometheus/common/log/syslog_formatter.go +++ b/vendor/github.com/prometheus/common/log/syslog_formatter.go @@ -1,126 +1,126 @@ -// Copyright 2015 The Prometheus Authors -// 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. - -// +build !windows,!nacl,!plan9 - -package log - -import ( - "fmt" - "log/syslog" - "os" - - "github.com/Sirupsen/logrus" -) - -var _ logrus.Formatter = (*syslogger)(nil) - -func init() { - setSyslogFormatter = func(appname, local string) error { - if appname == "" { - return fmt.Errorf("missing appname parameter") - } - if local == "" { - return fmt.Errorf("missing local parameter") - } - - fmter, err := newSyslogger(appname, local, origLogger.Formatter) - if err != nil { - fmt.Fprintf(os.Stderr, "error creating syslog formatter: %v\n", err) - origLogger.Errorf("can't connect logger to syslog: %v", err) - return err - } - origLogger.Formatter = fmter - return nil - } -} - -var prefixTag []byte - -type syslogger struct { - wrap logrus.Formatter - out *syslog.Writer -} - -func newSyslogger(appname string, facility string, fmter logrus.Formatter) (*syslogger, error) { - priority, err := getFacility(facility) - if err != nil { - return nil, err - } - out, err := syslog.New(priority, appname) - _, isJSON := fmter.(*logrus.JSONFormatter) - if isJSON { - // add cee tag to json formatted syslogs - prefixTag = []byte("@cee:") - } - return &syslogger{ - out: out, - wrap: fmter, - }, err -} - -func getFacility(facility string) (syslog.Priority, error) { - switch facility { - case "0": - return syslog.LOG_LOCAL0, nil - case "1": - return syslog.LOG_LOCAL1, nil - case "2": - return syslog.LOG_LOCAL2, nil - case "3": - return syslog.LOG_LOCAL3, nil - case "4": - return syslog.LOG_LOCAL4, nil - case "5": - return syslog.LOG_LOCAL5, nil - case "6": - return syslog.LOG_LOCAL6, nil - case "7": - return syslog.LOG_LOCAL7, nil - } - return syslog.LOG_LOCAL0, fmt.Errorf("invalid local(%s) for syslog", facility) -} - -func (s *syslogger) Format(e *logrus.Entry) ([]byte, error) { - data, err := s.wrap.Format(e) - if err != nil { - fmt.Fprintf(os.Stderr, "syslogger: can't format entry: %v\n", err) - return data, err - } - // only append tag to data sent to syslog (line), not to what - // is returned - line := string(append(prefixTag, data...)) - - switch e.Level { - case logrus.PanicLevel: - err = s.out.Crit(line) - case logrus.FatalLevel: - err = s.out.Crit(line) - case logrus.ErrorLevel: - err = s.out.Err(line) - case logrus.WarnLevel: - err = s.out.Warning(line) - case logrus.InfoLevel: - err = s.out.Info(line) - case logrus.DebugLevel: - err = s.out.Debug(line) - default: - err = s.out.Notice(line) - } - - if err != nil { - fmt.Fprintf(os.Stderr, "syslogger: can't send log to syslog: %v\n", err) - } - - return data, err -} +// Copyright 2015 The Prometheus Authors +// 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. + +// +build !windows,!nacl,!plan9 + +package log + +import ( + "fmt" + "log/syslog" + "os" + + "github.com/Sirupsen/logrus" +) + +var _ logrus.Formatter = (*syslogger)(nil) + +func init() { + setSyslogFormatter = func(appname, local string) error { + if appname == "" { + return fmt.Errorf("missing appname parameter") + } + if local == "" { + return fmt.Errorf("missing local parameter") + } + + fmter, err := newSyslogger(appname, local, origLogger.Formatter) + if err != nil { + fmt.Fprintf(os.Stderr, "error creating syslog formatter: %v\n", err) + origLogger.Errorf("can't connect logger to syslog: %v", err) + return err + } + origLogger.Formatter = fmter + return nil + } +} + +var prefixTag []byte + +type syslogger struct { + wrap logrus.Formatter + out *syslog.Writer +} + +func newSyslogger(appname string, facility string, fmter logrus.Formatter) (*syslogger, error) { + priority, err := getFacility(facility) + if err != nil { + return nil, err + } + out, err := syslog.New(priority, appname) + _, isJSON := fmter.(*logrus.JSONFormatter) + if isJSON { + // add cee tag to json formatted syslogs + prefixTag = []byte("@cee:") + } + return &syslogger{ + out: out, + wrap: fmter, + }, err +} + +func getFacility(facility string) (syslog.Priority, error) { + switch facility { + case "0": + return syslog.LOG_LOCAL0, nil + case "1": + return syslog.LOG_LOCAL1, nil + case "2": + return syslog.LOG_LOCAL2, nil + case "3": + return syslog.LOG_LOCAL3, nil + case "4": + return syslog.LOG_LOCAL4, nil + case "5": + return syslog.LOG_LOCAL5, nil + case "6": + return syslog.LOG_LOCAL6, nil + case "7": + return syslog.LOG_LOCAL7, nil + } + return syslog.LOG_LOCAL0, fmt.Errorf("invalid local(%s) for syslog", facility) +} + +func (s *syslogger) Format(e *logrus.Entry) ([]byte, error) { + data, err := s.wrap.Format(e) + if err != nil { + fmt.Fprintf(os.Stderr, "syslogger: can't format entry: %v\n", err) + return data, err + } + // only append tag to data sent to syslog (line), not to what + // is returned + line := string(append(prefixTag, data...)) + + switch e.Level { + case logrus.PanicLevel: + err = s.out.Crit(line) + case logrus.FatalLevel: + err = s.out.Crit(line) + case logrus.ErrorLevel: + err = s.out.Err(line) + case logrus.WarnLevel: + err = s.out.Warning(line) + case logrus.InfoLevel: + err = s.out.Info(line) + case logrus.DebugLevel: + err = s.out.Debug(line) + default: + err = s.out.Notice(line) + } + + if err != nil { + fmt.Fprintf(os.Stderr, "syslogger: can't send log to syslog: %v\n", err) + } + + return data, err +} diff --git a/vendor/github.com/prometheus/common/log/syslog_formatter_test.go b/vendor/github.com/prometheus/common/log/syslog_formatter_test.go index e575c98321..b7e68848f1 100644 --- a/vendor/github.com/prometheus/common/log/syslog_formatter_test.go +++ b/vendor/github.com/prometheus/common/log/syslog_formatter_test.go @@ -1,52 +1,52 @@ -// Copyright 2015 The Prometheus Authors -// 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. - -// +build !windows,!nacl,!plan9 - -package log - -import ( - "errors" - "log/syslog" - "testing" -) - -func TestGetFacility(t *testing.T) { - testCases := []struct { - facility string - expectedPriority syslog.Priority - expectedErr error - }{ - {"0", syslog.LOG_LOCAL0, nil}, - {"1", syslog.LOG_LOCAL1, nil}, - {"2", syslog.LOG_LOCAL2, nil}, - {"3", syslog.LOG_LOCAL3, nil}, - {"4", syslog.LOG_LOCAL4, nil}, - {"5", syslog.LOG_LOCAL5, nil}, - {"6", syslog.LOG_LOCAL6, nil}, - {"7", syslog.LOG_LOCAL7, nil}, - {"8", syslog.LOG_LOCAL0, errors.New("invalid local(8) for syslog")}, - } - for _, tc := range testCases { - priority, err := getFacility(tc.facility) - if err != tc.expectedErr { - if err.Error() != tc.expectedErr.Error() { - t.Errorf("want %s, got %s", tc.expectedErr.Error(), err.Error()) - } - } - - if priority != tc.expectedPriority { - t.Errorf("want %q, got %q", tc.expectedPriority, priority) - } - } -} +// Copyright 2015 The Prometheus Authors +// 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. + +// +build !windows,!nacl,!plan9 + +package log + +import ( + "errors" + "log/syslog" + "testing" +) + +func TestGetFacility(t *testing.T) { + testCases := []struct { + facility string + expectedPriority syslog.Priority + expectedErr error + }{ + {"0", syslog.LOG_LOCAL0, nil}, + {"1", syslog.LOG_LOCAL1, nil}, + {"2", syslog.LOG_LOCAL2, nil}, + {"3", syslog.LOG_LOCAL3, nil}, + {"4", syslog.LOG_LOCAL4, nil}, + {"5", syslog.LOG_LOCAL5, nil}, + {"6", syslog.LOG_LOCAL6, nil}, + {"7", syslog.LOG_LOCAL7, nil}, + {"8", syslog.LOG_LOCAL0, errors.New("invalid local(8) for syslog")}, + } + for _, tc := range testCases { + priority, err := getFacility(tc.facility) + if err != tc.expectedErr { + if err.Error() != tc.expectedErr.Error() { + t.Errorf("want %s, got %s", tc.expectedErr.Error(), err.Error()) + } + } + + if priority != tc.expectedPriority { + t.Errorf("want %q, got %q", tc.expectedPriority, priority) + } + } +} diff --git a/vendor/github.com/prometheus/common/model/alert.go b/vendor/github.com/prometheus/common/model/alert.go index 20b0e99364..35e739c7ad 100644 --- a/vendor/github.com/prometheus/common/model/alert.go +++ b/vendor/github.com/prometheus/common/model/alert.go @@ -1,136 +1,136 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "fmt" - "time" -) - -type AlertStatus string - -const ( - AlertFiring AlertStatus = "firing" - AlertResolved AlertStatus = "resolved" -) - -// Alert is a generic representation of an alert in the Prometheus eco-system. -type Alert struct { - // Label value pairs for purpose of aggregation, matching, and disposition - // dispatching. This must minimally include an "alertname" label. - Labels LabelSet `json:"labels"` - - // Extra key/value information which does not define alert identity. - Annotations LabelSet `json:"annotations"` - - // The known time range for this alert. Both ends are optional. - StartsAt time.Time `json:"startsAt,omitempty"` - EndsAt time.Time `json:"endsAt,omitempty"` - GeneratorURL string `json:"generatorURL"` -} - -// Name returns the name of the alert. It is equivalent to the "alertname" label. -func (a *Alert) Name() string { - return string(a.Labels[AlertNameLabel]) -} - -// Fingerprint returns a unique hash for the alert. It is equivalent to -// the fingerprint of the alert's label set. -func (a *Alert) Fingerprint() Fingerprint { - return a.Labels.Fingerprint() -} - -func (a *Alert) String() string { - s := fmt.Sprintf("%s[%s]", a.Name(), a.Fingerprint().String()[:7]) - if a.Resolved() { - return s + "[resolved]" - } - return s + "[active]" -} - -// Resolved returns true iff the activity interval ended in the past. -func (a *Alert) Resolved() bool { - return a.ResolvedAt(time.Now()) -} - -// ResolvedAt returns true off the activity interval ended before -// the given timestamp. -func (a *Alert) ResolvedAt(ts time.Time) bool { - if a.EndsAt.IsZero() { - return false - } - return !a.EndsAt.After(ts) -} - -// Status returns the status of the alert. -func (a *Alert) Status() AlertStatus { - if a.Resolved() { - return AlertResolved - } - return AlertFiring -} - -// Validate checks whether the alert data is inconsistent. -func (a *Alert) Validate() error { - if a.StartsAt.IsZero() { - return fmt.Errorf("start time missing") - } - if !a.EndsAt.IsZero() && a.EndsAt.Before(a.StartsAt) { - return fmt.Errorf("start time must be before end time") - } - if err := a.Labels.Validate(); err != nil { - return fmt.Errorf("invalid label set: %s", err) - } - if len(a.Labels) == 0 { - return fmt.Errorf("at least one label pair required") - } - if err := a.Annotations.Validate(); err != nil { - return fmt.Errorf("invalid annotations: %s", err) - } - return nil -} - -// Alert is a list of alerts that can be sorted in chronological order. -type Alerts []*Alert - -func (as Alerts) Len() int { return len(as) } -func (as Alerts) Swap(i, j int) { as[i], as[j] = as[j], as[i] } - -func (as Alerts) Less(i, j int) bool { - if as[i].StartsAt.Before(as[j].StartsAt) { - return true - } - if as[i].EndsAt.Before(as[j].EndsAt) { - return true - } - return as[i].Fingerprint() < as[j].Fingerprint() -} - -// HasFiring returns true iff one of the alerts is not resolved. -func (as Alerts) HasFiring() bool { - for _, a := range as { - if !a.Resolved() { - return true - } - } - return false -} - -// Status returns StatusFiring iff at least one of the alerts is firing. -func (as Alerts) Status() AlertStatus { - if as.HasFiring() { - return AlertFiring - } - return AlertResolved -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "fmt" + "time" +) + +type AlertStatus string + +const ( + AlertFiring AlertStatus = "firing" + AlertResolved AlertStatus = "resolved" +) + +// Alert is a generic representation of an alert in the Prometheus eco-system. +type Alert struct { + // Label value pairs for purpose of aggregation, matching, and disposition + // dispatching. This must minimally include an "alertname" label. + Labels LabelSet `json:"labels"` + + // Extra key/value information which does not define alert identity. + Annotations LabelSet `json:"annotations"` + + // The known time range for this alert. Both ends are optional. + StartsAt time.Time `json:"startsAt,omitempty"` + EndsAt time.Time `json:"endsAt,omitempty"` + GeneratorURL string `json:"generatorURL"` +} + +// Name returns the name of the alert. It is equivalent to the "alertname" label. +func (a *Alert) Name() string { + return string(a.Labels[AlertNameLabel]) +} + +// Fingerprint returns a unique hash for the alert. It is equivalent to +// the fingerprint of the alert's label set. +func (a *Alert) Fingerprint() Fingerprint { + return a.Labels.Fingerprint() +} + +func (a *Alert) String() string { + s := fmt.Sprintf("%s[%s]", a.Name(), a.Fingerprint().String()[:7]) + if a.Resolved() { + return s + "[resolved]" + } + return s + "[active]" +} + +// Resolved returns true iff the activity interval ended in the past. +func (a *Alert) Resolved() bool { + return a.ResolvedAt(time.Now()) +} + +// ResolvedAt returns true off the activity interval ended before +// the given timestamp. +func (a *Alert) ResolvedAt(ts time.Time) bool { + if a.EndsAt.IsZero() { + return false + } + return !a.EndsAt.After(ts) +} + +// Status returns the status of the alert. +func (a *Alert) Status() AlertStatus { + if a.Resolved() { + return AlertResolved + } + return AlertFiring +} + +// Validate checks whether the alert data is inconsistent. +func (a *Alert) Validate() error { + if a.StartsAt.IsZero() { + return fmt.Errorf("start time missing") + } + if !a.EndsAt.IsZero() && a.EndsAt.Before(a.StartsAt) { + return fmt.Errorf("start time must be before end time") + } + if err := a.Labels.Validate(); err != nil { + return fmt.Errorf("invalid label set: %s", err) + } + if len(a.Labels) == 0 { + return fmt.Errorf("at least one label pair required") + } + if err := a.Annotations.Validate(); err != nil { + return fmt.Errorf("invalid annotations: %s", err) + } + return nil +} + +// Alert is a list of alerts that can be sorted in chronological order. +type Alerts []*Alert + +func (as Alerts) Len() int { return len(as) } +func (as Alerts) Swap(i, j int) { as[i], as[j] = as[j], as[i] } + +func (as Alerts) Less(i, j int) bool { + if as[i].StartsAt.Before(as[j].StartsAt) { + return true + } + if as[i].EndsAt.Before(as[j].EndsAt) { + return true + } + return as[i].Fingerprint() < as[j].Fingerprint() +} + +// HasFiring returns true iff one of the alerts is not resolved. +func (as Alerts) HasFiring() bool { + for _, a := range as { + if !a.Resolved() { + return true + } + } + return false +} + +// Status returns StatusFiring iff at least one of the alerts is firing. +func (as Alerts) Status() AlertStatus { + if as.HasFiring() { + return AlertFiring + } + return AlertResolved +} diff --git a/vendor/github.com/prometheus/common/model/alert_test.go b/vendor/github.com/prometheus/common/model/alert_test.go index aa963a2d70..9692bca210 100644 --- a/vendor/github.com/prometheus/common/model/alert_test.go +++ b/vendor/github.com/prometheus/common/model/alert_test.go @@ -1,118 +1,118 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "strings" - "testing" - "time" -) - -func TestAlertValidate(t *testing.T) { - ts := time.Now() - - var cases = []struct { - alert *Alert - err string - }{ - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - }, - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - }, - err: "start time missing", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - EndsAt: ts, - }, - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - EndsAt: ts.Add(1 * time.Minute), - }, - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - StartsAt: ts, - EndsAt: ts.Add(-1 * time.Minute), - }, - err: "start time must be before end time", - }, - { - alert: &Alert{ - StartsAt: ts, - }, - err: "at least one label pair required", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b", "!bad": "label"}, - StartsAt: ts, - }, - err: "invalid label set: invalid name", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b", "bad": "\xfflabel"}, - StartsAt: ts, - }, - err: "invalid label set: invalid value", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - Annotations: LabelSet{"!bad": "label"}, - StartsAt: ts, - }, - err: "invalid annotations: invalid name", - }, - { - alert: &Alert{ - Labels: LabelSet{"a": "b"}, - Annotations: LabelSet{"bad": "\xfflabel"}, - StartsAt: ts, - }, - err: "invalid annotations: invalid value", - }, - } - - for i, c := range cases { - err := c.alert.Validate() - if err == nil { - if c.err == "" { - continue - } - t.Errorf("%d. Expected error %q but got none", i, c.err) - continue - } - if c.err == "" && err != nil { - t.Errorf("%d. Expected no error but got %q", i, err) - continue - } - if !strings.Contains(err.Error(), c.err) { - t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) - } - } -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "strings" + "testing" + "time" +) + +func TestAlertValidate(t *testing.T) { + ts := time.Now() + + var cases = []struct { + alert *Alert + err string + }{ + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + StartsAt: ts, + }, + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + }, + err: "start time missing", + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + StartsAt: ts, + EndsAt: ts, + }, + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + StartsAt: ts, + EndsAt: ts.Add(1 * time.Minute), + }, + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + StartsAt: ts, + EndsAt: ts.Add(-1 * time.Minute), + }, + err: "start time must be before end time", + }, + { + alert: &Alert{ + StartsAt: ts, + }, + err: "at least one label pair required", + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b", "!bad": "label"}, + StartsAt: ts, + }, + err: "invalid label set: invalid name", + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b", "bad": "\xfflabel"}, + StartsAt: ts, + }, + err: "invalid label set: invalid value", + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + Annotations: LabelSet{"!bad": "label"}, + StartsAt: ts, + }, + err: "invalid annotations: invalid name", + }, + { + alert: &Alert{ + Labels: LabelSet{"a": "b"}, + Annotations: LabelSet{"bad": "\xfflabel"}, + StartsAt: ts, + }, + err: "invalid annotations: invalid value", + }, + } + + for i, c := range cases { + err := c.alert.Validate() + if err == nil { + if c.err == "" { + continue + } + t.Errorf("%d. Expected error %q but got none", i, c.err) + continue + } + if c.err == "" && err != nil { + t.Errorf("%d. Expected no error but got %q", i, err) + continue + } + if !strings.Contains(err.Error(), c.err) { + t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) + } + } +} diff --git a/vendor/github.com/prometheus/common/model/fingerprinting.go b/vendor/github.com/prometheus/common/model/fingerprinting.go index 81d252ee91..fc4de4106e 100644 --- a/vendor/github.com/prometheus/common/model/fingerprinting.go +++ b/vendor/github.com/prometheus/common/model/fingerprinting.go @@ -1,105 +1,105 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "fmt" - "strconv" -) - -// Fingerprint provides a hash-capable representation of a Metric. -// For our purposes, FNV-1A 64-bit is used. -type Fingerprint uint64 - -// FingerprintFromString transforms a string representation into a Fingerprint. -func FingerprintFromString(s string) (Fingerprint, error) { - num, err := strconv.ParseUint(s, 16, 64) - return Fingerprint(num), err -} - -// ParseFingerprint parses the input string into a fingerprint. -func ParseFingerprint(s string) (Fingerprint, error) { - num, err := strconv.ParseUint(s, 16, 64) - if err != nil { - return 0, err - } - return Fingerprint(num), nil -} - -func (f Fingerprint) String() string { - return fmt.Sprintf("%016x", uint64(f)) -} - -// Fingerprints represents a collection of Fingerprint subject to a given -// natural sorting scheme. It implements sort.Interface. -type Fingerprints []Fingerprint - -// Len implements sort.Interface. -func (f Fingerprints) Len() int { - return len(f) -} - -// Less implements sort.Interface. -func (f Fingerprints) Less(i, j int) bool { - return f[i] < f[j] -} - -// Swap implements sort.Interface. -func (f Fingerprints) Swap(i, j int) { - f[i], f[j] = f[j], f[i] -} - -// FingerprintSet is a set of Fingerprints. -type FingerprintSet map[Fingerprint]struct{} - -// Equal returns true if both sets contain the same elements (and not more). -func (s FingerprintSet) Equal(o FingerprintSet) bool { - if len(s) != len(o) { - return false - } - - for k := range s { - if _, ok := o[k]; !ok { - return false - } - } - - return true -} - -// Intersection returns the elements contained in both sets. -func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet { - myLength, otherLength := len(s), len(o) - if myLength == 0 || otherLength == 0 { - return FingerprintSet{} - } - - subSet := s - superSet := o - - if otherLength < myLength { - subSet = o - superSet = s - } - - out := FingerprintSet{} - - for k := range subSet { - if _, ok := superSet[k]; ok { - out[k] = struct{}{} - } - } - - return out -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "fmt" + "strconv" +) + +// Fingerprint provides a hash-capable representation of a Metric. +// For our purposes, FNV-1A 64-bit is used. +type Fingerprint uint64 + +// FingerprintFromString transforms a string representation into a Fingerprint. +func FingerprintFromString(s string) (Fingerprint, error) { + num, err := strconv.ParseUint(s, 16, 64) + return Fingerprint(num), err +} + +// ParseFingerprint parses the input string into a fingerprint. +func ParseFingerprint(s string) (Fingerprint, error) { + num, err := strconv.ParseUint(s, 16, 64) + if err != nil { + return 0, err + } + return Fingerprint(num), nil +} + +func (f Fingerprint) String() string { + return fmt.Sprintf("%016x", uint64(f)) +} + +// Fingerprints represents a collection of Fingerprint subject to a given +// natural sorting scheme. It implements sort.Interface. +type Fingerprints []Fingerprint + +// Len implements sort.Interface. +func (f Fingerprints) Len() int { + return len(f) +} + +// Less implements sort.Interface. +func (f Fingerprints) Less(i, j int) bool { + return f[i] < f[j] +} + +// Swap implements sort.Interface. +func (f Fingerprints) Swap(i, j int) { + f[i], f[j] = f[j], f[i] +} + +// FingerprintSet is a set of Fingerprints. +type FingerprintSet map[Fingerprint]struct{} + +// Equal returns true if both sets contain the same elements (and not more). +func (s FingerprintSet) Equal(o FingerprintSet) bool { + if len(s) != len(o) { + return false + } + + for k := range s { + if _, ok := o[k]; !ok { + return false + } + } + + return true +} + +// Intersection returns the elements contained in both sets. +func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet { + myLength, otherLength := len(s), len(o) + if myLength == 0 || otherLength == 0 { + return FingerprintSet{} + } + + subSet := s + superSet := o + + if otherLength < myLength { + subSet = o + superSet = s + } + + out := FingerprintSet{} + + for k := range subSet { + if _, ok := superSet[k]; ok { + out[k] = struct{}{} + } + } + + return out +} diff --git a/vendor/github.com/prometheus/common/model/fnv.go b/vendor/github.com/prometheus/common/model/fnv.go index 93d7ff8111..038fc1c900 100644 --- a/vendor/github.com/prometheus/common/model/fnv.go +++ b/vendor/github.com/prometheus/common/model/fnv.go @@ -1,42 +1,42 @@ -// Copyright 2015 The Prometheus Authors -// 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 model - -// Inline and byte-free variant of hash/fnv's fnv64a. - -const ( - offset64 = 14695981039346656037 - prime64 = 1099511628211 -) - -// hashNew initializies a new fnv64a hash value. -func hashNew() uint64 { - return offset64 -} - -// hashAdd adds a string to a fnv64a hash value, returning the updated hash. -func hashAdd(h uint64, s string) uint64 { - for i := 0; i < len(s); i++ { - h ^= uint64(s[i]) - h *= prime64 - } - return h -} - -// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. -func hashAddByte(h uint64, b byte) uint64 { - h ^= uint64(b) - h *= prime64 - return h -} +// Copyright 2015 The Prometheus Authors +// 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 model + +// Inline and byte-free variant of hash/fnv's fnv64a. + +const ( + offset64 = 14695981039346656037 + prime64 = 1099511628211 +) + +// hashNew initializies a new fnv64a hash value. +func hashNew() uint64 { + return offset64 +} + +// hashAdd adds a string to a fnv64a hash value, returning the updated hash. +func hashAdd(h uint64, s string) uint64 { + for i := 0; i < len(s); i++ { + h ^= uint64(s[i]) + h *= prime64 + } + return h +} + +// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. +func hashAddByte(h uint64, b byte) uint64 { + h ^= uint64(b) + h *= prime64 + return h +} diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go index 81f0f14e85..41051a01a3 100644 --- a/vendor/github.com/prometheus/common/model/labels.go +++ b/vendor/github.com/prometheus/common/model/labels.go @@ -1,210 +1,210 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "encoding/json" - "fmt" - "regexp" - "strings" - "unicode/utf8" -) - -const ( - // AlertNameLabel is the name of the label containing the an alert's name. - AlertNameLabel = "alertname" - - // ExportedLabelPrefix is the prefix to prepend to the label names present in - // exported metrics if a label of the same name is added by the server. - ExportedLabelPrefix = "exported_" - - // MetricNameLabel is the label name indicating the metric name of a - // timeseries. - MetricNameLabel = "__name__" - - // SchemeLabel is the name of the label that holds the scheme on which to - // scrape a target. - SchemeLabel = "__scheme__" - - // AddressLabel is the name of the label that holds the address of - // a scrape target. - AddressLabel = "__address__" - - // MetricsPathLabel is the name of the label that holds the path on which to - // scrape a target. - MetricsPathLabel = "__metrics_path__" - - // ReservedLabelPrefix is a prefix which is not legal in user-supplied - // label names. - ReservedLabelPrefix = "__" - - // MetaLabelPrefix is a prefix for labels that provide meta information. - // Labels with this prefix are used for intermediate label processing and - // will not be attached to time series. - MetaLabelPrefix = "__meta_" - - // TmpLabelPrefix is a prefix for temporary labels as part of relabelling. - // Labels with this prefix are used for intermediate label processing and - // will not be attached to time series. This is reserved for use in - // Prometheus configuration files by users. - TmpLabelPrefix = "__tmp_" - - // ParamLabelPrefix is a prefix for labels that provide URL parameters - // used to scrape a target. - ParamLabelPrefix = "__param_" - - // JobLabel is the label name indicating the job from which a timeseries - // was scraped. - JobLabel = "job" - - // InstanceLabel is the label name used for the instance label. - InstanceLabel = "instance" - - // BucketLabel is used for the label that defines the upper bound of a - // bucket of a histogram ("le" -> "less or equal"). - BucketLabel = "le" - - // QuantileLabel is used for the label that defines the quantile in a - // summary. - QuantileLabel = "quantile" -) - -// LabelNameRE is a regular expression matching valid label names. Note that the -// IsValid method of LabelName performs the same check but faster than a match -// with this regular expression. -var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$") - -// A LabelName is a key for a LabelSet or Metric. It has a value associated -// therewith. -type LabelName string - -// IsValid is true iff the label name matches the pattern of LabelNameRE. This -// method, however, does not use LabelNameRE for the check but a much faster -// hardcoded implementation. -func (ln LabelName) IsValid() bool { - if len(ln) == 0 { - return false - } - for i, b := range ln { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { - return false - } - } - return true -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - if err := unmarshal(&s); err != nil { - return err - } - if !LabelName(s).IsValid() { - return fmt.Errorf("%q is not a valid label name", s) - } - *ln = LabelName(s) - return nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (ln *LabelName) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - if !LabelName(s).IsValid() { - return fmt.Errorf("%q is not a valid label name", s) - } - *ln = LabelName(s) - return nil -} - -// LabelNames is a sortable LabelName slice. In implements sort.Interface. -type LabelNames []LabelName - -func (l LabelNames) Len() int { - return len(l) -} - -func (l LabelNames) Less(i, j int) bool { - return l[i] < l[j] -} - -func (l LabelNames) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} - -func (l LabelNames) String() string { - labelStrings := make([]string, 0, len(l)) - for _, label := range l { - labelStrings = append(labelStrings, string(label)) - } - return strings.Join(labelStrings, ", ") -} - -// A LabelValue is an associated value for a LabelName. -type LabelValue string - -// IsValid returns true iff the string is a valid UTF8. -func (lv LabelValue) IsValid() bool { - return utf8.ValidString(string(lv)) -} - -// LabelValues is a sortable LabelValue slice. It implements sort.Interface. -type LabelValues []LabelValue - -func (l LabelValues) Len() int { - return len(l) -} - -func (l LabelValues) Less(i, j int) bool { - return string(l[i]) < string(l[j]) -} - -func (l LabelValues) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} - -// LabelPair pairs a name with a value. -type LabelPair struct { - Name LabelName - Value LabelValue -} - -// LabelPairs is a sortable slice of LabelPair pointers. It implements -// sort.Interface. -type LabelPairs []*LabelPair - -func (l LabelPairs) Len() int { - return len(l) -} - -func (l LabelPairs) Less(i, j int) bool { - switch { - case l[i].Name > l[j].Name: - return false - case l[i].Name < l[j].Name: - return true - case l[i].Value > l[j].Value: - return false - case l[i].Value < l[j].Value: - return true - default: - return false - } -} - -func (l LabelPairs) Swap(i, j int) { - l[i], l[j] = l[j], l[i] -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "encoding/json" + "fmt" + "regexp" + "strings" + "unicode/utf8" +) + +const ( + // AlertNameLabel is the name of the label containing the an alert's name. + AlertNameLabel = "alertname" + + // ExportedLabelPrefix is the prefix to prepend to the label names present in + // exported metrics if a label of the same name is added by the server. + ExportedLabelPrefix = "exported_" + + // MetricNameLabel is the label name indicating the metric name of a + // timeseries. + MetricNameLabel = "__name__" + + // SchemeLabel is the name of the label that holds the scheme on which to + // scrape a target. + SchemeLabel = "__scheme__" + + // AddressLabel is the name of the label that holds the address of + // a scrape target. + AddressLabel = "__address__" + + // MetricsPathLabel is the name of the label that holds the path on which to + // scrape a target. + MetricsPathLabel = "__metrics_path__" + + // ReservedLabelPrefix is a prefix which is not legal in user-supplied + // label names. + ReservedLabelPrefix = "__" + + // MetaLabelPrefix is a prefix for labels that provide meta information. + // Labels with this prefix are used for intermediate label processing and + // will not be attached to time series. + MetaLabelPrefix = "__meta_" + + // TmpLabelPrefix is a prefix for temporary labels as part of relabelling. + // Labels with this prefix are used for intermediate label processing and + // will not be attached to time series. This is reserved for use in + // Prometheus configuration files by users. + TmpLabelPrefix = "__tmp_" + + // ParamLabelPrefix is a prefix for labels that provide URL parameters + // used to scrape a target. + ParamLabelPrefix = "__param_" + + // JobLabel is the label name indicating the job from which a timeseries + // was scraped. + JobLabel = "job" + + // InstanceLabel is the label name used for the instance label. + InstanceLabel = "instance" + + // BucketLabel is used for the label that defines the upper bound of a + // bucket of a histogram ("le" -> "less or equal"). + BucketLabel = "le" + + // QuantileLabel is used for the label that defines the quantile in a + // summary. + QuantileLabel = "quantile" +) + +// LabelNameRE is a regular expression matching valid label names. Note that the +// IsValid method of LabelName performs the same check but faster than a match +// with this regular expression. +var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$") + +// A LabelName is a key for a LabelSet or Metric. It has a value associated +// therewith. +type LabelName string + +// IsValid is true iff the label name matches the pattern of LabelNameRE. This +// method, however, does not use LabelNameRE for the check but a much faster +// hardcoded implementation. +func (ln LabelName) IsValid() bool { + if len(ln) == 0 { + return false + } + for i, b := range ln { + if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) { + return false + } + } + return true +} + +// UnmarshalYAML implements the yaml.Unmarshaler interface. +func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error { + var s string + if err := unmarshal(&s); err != nil { + return err + } + if !LabelName(s).IsValid() { + return fmt.Errorf("%q is not a valid label name", s) + } + *ln = LabelName(s) + return nil +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (ln *LabelName) UnmarshalJSON(b []byte) error { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + if !LabelName(s).IsValid() { + return fmt.Errorf("%q is not a valid label name", s) + } + *ln = LabelName(s) + return nil +} + +// LabelNames is a sortable LabelName slice. In implements sort.Interface. +type LabelNames []LabelName + +func (l LabelNames) Len() int { + return len(l) +} + +func (l LabelNames) Less(i, j int) bool { + return l[i] < l[j] +} + +func (l LabelNames) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} + +func (l LabelNames) String() string { + labelStrings := make([]string, 0, len(l)) + for _, label := range l { + labelStrings = append(labelStrings, string(label)) + } + return strings.Join(labelStrings, ", ") +} + +// A LabelValue is an associated value for a LabelName. +type LabelValue string + +// IsValid returns true iff the string is a valid UTF8. +func (lv LabelValue) IsValid() bool { + return utf8.ValidString(string(lv)) +} + +// LabelValues is a sortable LabelValue slice. It implements sort.Interface. +type LabelValues []LabelValue + +func (l LabelValues) Len() int { + return len(l) +} + +func (l LabelValues) Less(i, j int) bool { + return string(l[i]) < string(l[j]) +} + +func (l LabelValues) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} + +// LabelPair pairs a name with a value. +type LabelPair struct { + Name LabelName + Value LabelValue +} + +// LabelPairs is a sortable slice of LabelPair pointers. It implements +// sort.Interface. +type LabelPairs []*LabelPair + +func (l LabelPairs) Len() int { + return len(l) +} + +func (l LabelPairs) Less(i, j int) bool { + switch { + case l[i].Name > l[j].Name: + return false + case l[i].Name < l[j].Name: + return true + case l[i].Value > l[j].Value: + return false + case l[i].Value < l[j].Value: + return true + default: + return false + } +} + +func (l LabelPairs) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} diff --git a/vendor/github.com/prometheus/common/model/labels_test.go b/vendor/github.com/prometheus/common/model/labels_test.go index 7de0454339..e8df28ffac 100644 --- a/vendor/github.com/prometheus/common/model/labels_test.go +++ b/vendor/github.com/prometheus/common/model/labels_test.go @@ -1,140 +1,140 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "sort" - "testing" -) - -func testLabelNames(t testing.TB) { - var scenarios = []struct { - in LabelNames - out LabelNames - }{ - { - in: LabelNames{"ZZZ", "zzz"}, - out: LabelNames{"ZZZ", "zzz"}, - }, - { - in: LabelNames{"aaa", "AAA"}, - out: LabelNames{"AAA", "aaa"}, - }, - } - - for i, scenario := range scenarios { - sort.Sort(scenario.in) - - for j, expected := range scenario.out { - if expected != scenario.in[j] { - t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j]) - } - } - } -} - -func TestLabelNames(t *testing.T) { - testLabelNames(t) -} - -func BenchmarkLabelNames(b *testing.B) { - for i := 0; i < b.N; i++ { - testLabelNames(b) - } -} - -func testLabelValues(t testing.TB) { - var scenarios = []struct { - in LabelValues - out LabelValues - }{ - { - in: LabelValues{"ZZZ", "zzz"}, - out: LabelValues{"ZZZ", "zzz"}, - }, - { - in: LabelValues{"aaa", "AAA"}, - out: LabelValues{"AAA", "aaa"}, - }, - } - - for i, scenario := range scenarios { - sort.Sort(scenario.in) - - for j, expected := range scenario.out { - if expected != scenario.in[j] { - t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j]) - } - } - } -} - -func TestLabelValues(t *testing.T) { - testLabelValues(t) -} - -func BenchmarkLabelValues(b *testing.B) { - for i := 0; i < b.N; i++ { - testLabelValues(b) - } -} - -func TestLabelNameIsValid(t *testing.T) { - var scenarios = []struct { - ln LabelName - valid bool - }{ - { - ln: "Avalid_23name", - valid: true, - }, - { - ln: "_Avalid_23name", - valid: true, - }, - { - ln: "1valid_23name", - valid: false, - }, - { - ln: "avalid_23name", - valid: true, - }, - { - ln: "Ava:lid_23name", - valid: false, - }, - { - ln: "a lid_23name", - valid: false, - }, - { - ln: ":leading_colon", - valid: false, - }, - { - ln: "colon:in:the:middle", - valid: false, - }, - } - - for _, s := range scenarios { - if s.ln.IsValid() != s.valid { - t.Errorf("Expected %v for %q using IsValid method", s.valid, s.ln) - } - if LabelNameRE.MatchString(string(s.ln)) != s.valid { - t.Errorf("Expected %v for %q using regexp match", s.valid, s.ln) - } - } -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "sort" + "testing" +) + +func testLabelNames(t testing.TB) { + var scenarios = []struct { + in LabelNames + out LabelNames + }{ + { + in: LabelNames{"ZZZ", "zzz"}, + out: LabelNames{"ZZZ", "zzz"}, + }, + { + in: LabelNames{"aaa", "AAA"}, + out: LabelNames{"AAA", "aaa"}, + }, + } + + for i, scenario := range scenarios { + sort.Sort(scenario.in) + + for j, expected := range scenario.out { + if expected != scenario.in[j] { + t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j]) + } + } + } +} + +func TestLabelNames(t *testing.T) { + testLabelNames(t) +} + +func BenchmarkLabelNames(b *testing.B) { + for i := 0; i < b.N; i++ { + testLabelNames(b) + } +} + +func testLabelValues(t testing.TB) { + var scenarios = []struct { + in LabelValues + out LabelValues + }{ + { + in: LabelValues{"ZZZ", "zzz"}, + out: LabelValues{"ZZZ", "zzz"}, + }, + { + in: LabelValues{"aaa", "AAA"}, + out: LabelValues{"AAA", "aaa"}, + }, + } + + for i, scenario := range scenarios { + sort.Sort(scenario.in) + + for j, expected := range scenario.out { + if expected != scenario.in[j] { + t.Errorf("%d.%d expected %s, got %s", i, j, expected, scenario.in[j]) + } + } + } +} + +func TestLabelValues(t *testing.T) { + testLabelValues(t) +} + +func BenchmarkLabelValues(b *testing.B) { + for i := 0; i < b.N; i++ { + testLabelValues(b) + } +} + +func TestLabelNameIsValid(t *testing.T) { + var scenarios = []struct { + ln LabelName + valid bool + }{ + { + ln: "Avalid_23name", + valid: true, + }, + { + ln: "_Avalid_23name", + valid: true, + }, + { + ln: "1valid_23name", + valid: false, + }, + { + ln: "avalid_23name", + valid: true, + }, + { + ln: "Ava:lid_23name", + valid: false, + }, + { + ln: "a lid_23name", + valid: false, + }, + { + ln: ":leading_colon", + valid: false, + }, + { + ln: "colon:in:the:middle", + valid: false, + }, + } + + for _, s := range scenarios { + if s.ln.IsValid() != s.valid { + t.Errorf("Expected %v for %q using IsValid method", s.valid, s.ln) + } + if LabelNameRE.MatchString(string(s.ln)) != s.valid { + t.Errorf("Expected %v for %q using regexp match", s.valid, s.ln) + } + } +} diff --git a/vendor/github.com/prometheus/common/model/labelset.go b/vendor/github.com/prometheus/common/model/labelset.go index 5b4ff63c98..6eda08a739 100644 --- a/vendor/github.com/prometheus/common/model/labelset.go +++ b/vendor/github.com/prometheus/common/model/labelset.go @@ -1,169 +1,169 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "encoding/json" - "fmt" - "sort" - "strings" -) - -// A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet -// may be fully-qualified down to the point where it may resolve to a single -// Metric in the data store or not. All operations that occur within the realm -// of a LabelSet can emit a vector of Metric entities to which the LabelSet may -// match. -type LabelSet map[LabelName]LabelValue - -// Validate checks whether all names and values in the label set -// are valid. -func (ls LabelSet) Validate() error { - for ln, lv := range ls { - if !ln.IsValid() { - return fmt.Errorf("invalid name %q", ln) - } - if !lv.IsValid() { - return fmt.Errorf("invalid value %q", lv) - } - } - return nil -} - -// Equal returns true iff both label sets have exactly the same key/value pairs. -func (ls LabelSet) Equal(o LabelSet) bool { - if len(ls) != len(o) { - return false - } - for ln, lv := range ls { - olv, ok := o[ln] - if !ok { - return false - } - if olv != lv { - return false - } - } - return true -} - -// Before compares the metrics, using the following criteria: -// -// If m has fewer labels than o, it is before o. If it has more, it is not. -// -// If the number of labels is the same, the superset of all label names is -// sorted alphanumerically. The first differing label pair found in that order -// determines the outcome: If the label does not exist at all in m, then m is -// before o, and vice versa. Otherwise the label value is compared -// alphanumerically. -// -// If m and o are equal, the method returns false. -func (ls LabelSet) Before(o LabelSet) bool { - if len(ls) < len(o) { - return true - } - if len(ls) > len(o) { - return false - } - - lns := make(LabelNames, 0, len(ls)+len(o)) - for ln := range ls { - lns = append(lns, ln) - } - for ln := range o { - lns = append(lns, ln) - } - // It's probably not worth it to de-dup lns. - sort.Sort(lns) - for _, ln := range lns { - mlv, ok := ls[ln] - if !ok { - return true - } - olv, ok := o[ln] - if !ok { - return false - } - if mlv < olv { - return true - } - if mlv > olv { - return false - } - } - return false -} - -// Clone returns a copy of the label set. -func (ls LabelSet) Clone() LabelSet { - lsn := make(LabelSet, len(ls)) - for ln, lv := range ls { - lsn[ln] = lv - } - return lsn -} - -// Merge is a helper function to non-destructively merge two label sets. -func (l LabelSet) Merge(other LabelSet) LabelSet { - result := make(LabelSet, len(l)) - - for k, v := range l { - result[k] = v - } - - for k, v := range other { - result[k] = v - } - - return result -} - -func (l LabelSet) String() string { - lstrs := make([]string, 0, len(l)) - for l, v := range l { - lstrs = append(lstrs, fmt.Sprintf("%s=%q", l, v)) - } - - sort.Strings(lstrs) - return fmt.Sprintf("{%s}", strings.Join(lstrs, ", ")) -} - -// Fingerprint returns the LabelSet's fingerprint. -func (ls LabelSet) Fingerprint() Fingerprint { - return labelSetToFingerprint(ls) -} - -// FastFingerprint returns the LabelSet's Fingerprint calculated by a faster hashing -// algorithm, which is, however, more susceptible to hash collisions. -func (ls LabelSet) FastFingerprint() Fingerprint { - return labelSetToFastFingerprint(ls) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (l *LabelSet) UnmarshalJSON(b []byte) error { - var m map[LabelName]LabelValue - if err := json.Unmarshal(b, &m); err != nil { - return err - } - // encoding/json only unmarshals maps of the form map[string]T. It treats - // LabelName as a string and does not call its UnmarshalJSON method. - // Thus, we have to replicate the behavior here. - for ln := range m { - if !ln.IsValid() { - return fmt.Errorf("%q is not a valid label name", ln) - } - } - *l = LabelSet(m) - return nil -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "encoding/json" + "fmt" + "sort" + "strings" +) + +// A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet +// may be fully-qualified down to the point where it may resolve to a single +// Metric in the data store or not. All operations that occur within the realm +// of a LabelSet can emit a vector of Metric entities to which the LabelSet may +// match. +type LabelSet map[LabelName]LabelValue + +// Validate checks whether all names and values in the label set +// are valid. +func (ls LabelSet) Validate() error { + for ln, lv := range ls { + if !ln.IsValid() { + return fmt.Errorf("invalid name %q", ln) + } + if !lv.IsValid() { + return fmt.Errorf("invalid value %q", lv) + } + } + return nil +} + +// Equal returns true iff both label sets have exactly the same key/value pairs. +func (ls LabelSet) Equal(o LabelSet) bool { + if len(ls) != len(o) { + return false + } + for ln, lv := range ls { + olv, ok := o[ln] + if !ok { + return false + } + if olv != lv { + return false + } + } + return true +} + +// Before compares the metrics, using the following criteria: +// +// If m has fewer labels than o, it is before o. If it has more, it is not. +// +// If the number of labels is the same, the superset of all label names is +// sorted alphanumerically. The first differing label pair found in that order +// determines the outcome: If the label does not exist at all in m, then m is +// before o, and vice versa. Otherwise the label value is compared +// alphanumerically. +// +// If m and o are equal, the method returns false. +func (ls LabelSet) Before(o LabelSet) bool { + if len(ls) < len(o) { + return true + } + if len(ls) > len(o) { + return false + } + + lns := make(LabelNames, 0, len(ls)+len(o)) + for ln := range ls { + lns = append(lns, ln) + } + for ln := range o { + lns = append(lns, ln) + } + // It's probably not worth it to de-dup lns. + sort.Sort(lns) + for _, ln := range lns { + mlv, ok := ls[ln] + if !ok { + return true + } + olv, ok := o[ln] + if !ok { + return false + } + if mlv < olv { + return true + } + if mlv > olv { + return false + } + } + return false +} + +// Clone returns a copy of the label set. +func (ls LabelSet) Clone() LabelSet { + lsn := make(LabelSet, len(ls)) + for ln, lv := range ls { + lsn[ln] = lv + } + return lsn +} + +// Merge is a helper function to non-destructively merge two label sets. +func (l LabelSet) Merge(other LabelSet) LabelSet { + result := make(LabelSet, len(l)) + + for k, v := range l { + result[k] = v + } + + for k, v := range other { + result[k] = v + } + + return result +} + +func (l LabelSet) String() string { + lstrs := make([]string, 0, len(l)) + for l, v := range l { + lstrs = append(lstrs, fmt.Sprintf("%s=%q", l, v)) + } + + sort.Strings(lstrs) + return fmt.Sprintf("{%s}", strings.Join(lstrs, ", ")) +} + +// Fingerprint returns the LabelSet's fingerprint. +func (ls LabelSet) Fingerprint() Fingerprint { + return labelSetToFingerprint(ls) +} + +// FastFingerprint returns the LabelSet's Fingerprint calculated by a faster hashing +// algorithm, which is, however, more susceptible to hash collisions. +func (ls LabelSet) FastFingerprint() Fingerprint { + return labelSetToFastFingerprint(ls) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (l *LabelSet) UnmarshalJSON(b []byte) error { + var m map[LabelName]LabelValue + if err := json.Unmarshal(b, &m); err != nil { + return err + } + // encoding/json only unmarshals maps of the form map[string]T. It treats + // LabelName as a string and does not call its UnmarshalJSON method. + // Thus, we have to replicate the behavior here. + for ln := range m { + if !ln.IsValid() { + return fmt.Errorf("%q is not a valid label name", ln) + } + } + *l = LabelSet(m) + return nil +} diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go index bbbc9b6e55..f7250909b9 100644 --- a/vendor/github.com/prometheus/common/model/metric.go +++ b/vendor/github.com/prometheus/common/model/metric.go @@ -1,103 +1,103 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "fmt" - "regexp" - "sort" - "strings" -) - -var ( - separator = []byte{0} - // MetricNameRE is a regular expression matching valid metric - // names. Note that the IsValidMetricName function performs the same - // check but faster than a match with this regular expression. - MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`) -) - -// A Metric is similar to a LabelSet, but the key difference is that a Metric is -// a singleton and refers to one and only one stream of samples. -type Metric LabelSet - -// Equal compares the metrics. -func (m Metric) Equal(o Metric) bool { - return LabelSet(m).Equal(LabelSet(o)) -} - -// Before compares the metrics' underlying label sets. -func (m Metric) Before(o Metric) bool { - return LabelSet(m).Before(LabelSet(o)) -} - -// Clone returns a copy of the Metric. -func (m Metric) Clone() Metric { - clone := make(Metric, len(m)) - for k, v := range m { - clone[k] = v - } - return clone -} - -func (m Metric) String() string { - metricName, hasName := m[MetricNameLabel] - numLabels := len(m) - 1 - if !hasName { - numLabels = len(m) - } - labelStrings := make([]string, 0, numLabels) - for label, value := range m { - if label != MetricNameLabel { - labelStrings = append(labelStrings, fmt.Sprintf("%s=%q", label, value)) - } - } - - switch numLabels { - case 0: - if hasName { - return string(metricName) - } - return "{}" - default: - sort.Strings(labelStrings) - return fmt.Sprintf("%s{%s}", metricName, strings.Join(labelStrings, ", ")) - } -} - -// Fingerprint returns a Metric's Fingerprint. -func (m Metric) Fingerprint() Fingerprint { - return LabelSet(m).Fingerprint() -} - -// FastFingerprint returns a Metric's Fingerprint calculated by a faster hashing -// algorithm, which is, however, more susceptible to hash collisions. -func (m Metric) FastFingerprint() Fingerprint { - return LabelSet(m).FastFingerprint() -} - -// IsValidMetricName returns true iff name matches the pattern of MetricNameRE. -// This function, however, does not use MetricNameRE for the check but a much -// faster hardcoded implementation. -func IsValidMetricName(n LabelValue) bool { - if len(n) == 0 { - return false - } - for i, b := range n { - if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0)) { - return false - } - } - return true -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "fmt" + "regexp" + "sort" + "strings" +) + +var ( + separator = []byte{0} + // MetricNameRE is a regular expression matching valid metric + // names. Note that the IsValidMetricName function performs the same + // check but faster than a match with this regular expression. + MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`) +) + +// A Metric is similar to a LabelSet, but the key difference is that a Metric is +// a singleton and refers to one and only one stream of samples. +type Metric LabelSet + +// Equal compares the metrics. +func (m Metric) Equal(o Metric) bool { + return LabelSet(m).Equal(LabelSet(o)) +} + +// Before compares the metrics' underlying label sets. +func (m Metric) Before(o Metric) bool { + return LabelSet(m).Before(LabelSet(o)) +} + +// Clone returns a copy of the Metric. +func (m Metric) Clone() Metric { + clone := make(Metric, len(m)) + for k, v := range m { + clone[k] = v + } + return clone +} + +func (m Metric) String() string { + metricName, hasName := m[MetricNameLabel] + numLabels := len(m) - 1 + if !hasName { + numLabels = len(m) + } + labelStrings := make([]string, 0, numLabels) + for label, value := range m { + if label != MetricNameLabel { + labelStrings = append(labelStrings, fmt.Sprintf("%s=%q", label, value)) + } + } + + switch numLabels { + case 0: + if hasName { + return string(metricName) + } + return "{}" + default: + sort.Strings(labelStrings) + return fmt.Sprintf("%s{%s}", metricName, strings.Join(labelStrings, ", ")) + } +} + +// Fingerprint returns a Metric's Fingerprint. +func (m Metric) Fingerprint() Fingerprint { + return LabelSet(m).Fingerprint() +} + +// FastFingerprint returns a Metric's Fingerprint calculated by a faster hashing +// algorithm, which is, however, more susceptible to hash collisions. +func (m Metric) FastFingerprint() Fingerprint { + return LabelSet(m).FastFingerprint() +} + +// IsValidMetricName returns true iff name matches the pattern of MetricNameRE. +// This function, however, does not use MetricNameRE for the check but a much +// faster hardcoded implementation. +func IsValidMetricName(n LabelValue) bool { + if len(n) == 0 { + return false + } + for i, b := range n { + if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0)) { + return false + } + } + return true +} diff --git a/vendor/github.com/prometheus/common/model/metric_test.go b/vendor/github.com/prometheus/common/model/metric_test.go index dfb4d81ea4..06f9de525a 100644 --- a/vendor/github.com/prometheus/common/model/metric_test.go +++ b/vendor/github.com/prometheus/common/model/metric_test.go @@ -1,132 +1,132 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import "testing" - -func testMetric(t testing.TB) { - var scenarios = []struct { - input LabelSet - fingerprint Fingerprint - fastFingerprint Fingerprint - }{ - { - input: LabelSet{}, - fingerprint: 14695981039346656037, - fastFingerprint: 14695981039346656037, - }, - { - input: LabelSet{ - "first_name": "electro", - "occupation": "robot", - "manufacturer": "westinghouse", - }, - fingerprint: 5911716720268894962, - fastFingerprint: 11310079640881077873, - }, - { - input: LabelSet{ - "x": "y", - }, - fingerprint: 8241431561484471700, - fastFingerprint: 13948396922932177635, - }, - { - input: LabelSet{ - "a": "bb", - "b": "c", - }, - fingerprint: 3016285359649981711, - fastFingerprint: 3198632812309449502, - }, - { - input: LabelSet{ - "a": "b", - "bb": "c", - }, - fingerprint: 7122421792099404749, - fastFingerprint: 5774953389407657638, - }, - } - - for i, scenario := range scenarios { - input := Metric(scenario.input) - - if scenario.fingerprint != input.Fingerprint() { - t.Errorf("%d. expected %d, got %d", i, scenario.fingerprint, input.Fingerprint()) - } - if scenario.fastFingerprint != input.FastFingerprint() { - t.Errorf("%d. expected %d, got %d", i, scenario.fastFingerprint, input.FastFingerprint()) - } - } -} - -func TestMetric(t *testing.T) { - testMetric(t) -} - -func BenchmarkMetric(b *testing.B) { - for i := 0; i < b.N; i++ { - testMetric(b) - } -} - -func TestMetricNameIsValid(t *testing.T) { - var scenarios = []struct { - mn LabelValue - valid bool - }{ - { - mn: "Avalid_23name", - valid: true, - }, - { - mn: "_Avalid_23name", - valid: true, - }, - { - mn: "1valid_23name", - valid: false, - }, - { - mn: "avalid_23name", - valid: true, - }, - { - mn: "Ava:lid_23name", - valid: true, - }, - { - mn: "a lid_23name", - valid: false, - }, - { - mn: ":leading_colon", - valid: true, - }, - { - mn: "colon:in:the:middle", - valid: true, - }, - } - - for _, s := range scenarios { - if IsValidMetricName(s.mn) != s.valid { - t.Errorf("Expected %v for %q using IsValidMetricName function", s.valid, s.mn) - } - if MetricNameRE.MatchString(string(s.mn)) != s.valid { - t.Errorf("Expected %v for %q using regexp matching", s.valid, s.mn) - } - } -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import "testing" + +func testMetric(t testing.TB) { + var scenarios = []struct { + input LabelSet + fingerprint Fingerprint + fastFingerprint Fingerprint + }{ + { + input: LabelSet{}, + fingerprint: 14695981039346656037, + fastFingerprint: 14695981039346656037, + }, + { + input: LabelSet{ + "first_name": "electro", + "occupation": "robot", + "manufacturer": "westinghouse", + }, + fingerprint: 5911716720268894962, + fastFingerprint: 11310079640881077873, + }, + { + input: LabelSet{ + "x": "y", + }, + fingerprint: 8241431561484471700, + fastFingerprint: 13948396922932177635, + }, + { + input: LabelSet{ + "a": "bb", + "b": "c", + }, + fingerprint: 3016285359649981711, + fastFingerprint: 3198632812309449502, + }, + { + input: LabelSet{ + "a": "b", + "bb": "c", + }, + fingerprint: 7122421792099404749, + fastFingerprint: 5774953389407657638, + }, + } + + for i, scenario := range scenarios { + input := Metric(scenario.input) + + if scenario.fingerprint != input.Fingerprint() { + t.Errorf("%d. expected %d, got %d", i, scenario.fingerprint, input.Fingerprint()) + } + if scenario.fastFingerprint != input.FastFingerprint() { + t.Errorf("%d. expected %d, got %d", i, scenario.fastFingerprint, input.FastFingerprint()) + } + } +} + +func TestMetric(t *testing.T) { + testMetric(t) +} + +func BenchmarkMetric(b *testing.B) { + for i := 0; i < b.N; i++ { + testMetric(b) + } +} + +func TestMetricNameIsValid(t *testing.T) { + var scenarios = []struct { + mn LabelValue + valid bool + }{ + { + mn: "Avalid_23name", + valid: true, + }, + { + mn: "_Avalid_23name", + valid: true, + }, + { + mn: "1valid_23name", + valid: false, + }, + { + mn: "avalid_23name", + valid: true, + }, + { + mn: "Ava:lid_23name", + valid: true, + }, + { + mn: "a lid_23name", + valid: false, + }, + { + mn: ":leading_colon", + valid: true, + }, + { + mn: "colon:in:the:middle", + valid: true, + }, + } + + for _, s := range scenarios { + if IsValidMetricName(s.mn) != s.valid { + t.Errorf("Expected %v for %q using IsValidMetricName function", s.valid, s.mn) + } + if MetricNameRE.MatchString(string(s.mn)) != s.valid { + t.Errorf("Expected %v for %q using regexp matching", s.valid, s.mn) + } + } +} diff --git a/vendor/github.com/prometheus/common/model/model.go b/vendor/github.com/prometheus/common/model/model.go index c16bc9d41a..a7b9691707 100644 --- a/vendor/github.com/prometheus/common/model/model.go +++ b/vendor/github.com/prometheus/common/model/model.go @@ -1,16 +1,16 @@ -// Copyright 2013 The Prometheus Authors -// 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 model contains common data structures that are shared across -// Prometheus components and libraries. -package model +// Copyright 2013 The Prometheus Authors +// 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 model contains common data structures that are shared across +// Prometheus components and libraries. +package model diff --git a/vendor/github.com/prometheus/common/model/signature.go b/vendor/github.com/prometheus/common/model/signature.go index 14a3dbe71e..8762b13c63 100644 --- a/vendor/github.com/prometheus/common/model/signature.go +++ b/vendor/github.com/prometheus/common/model/signature.go @@ -1,144 +1,144 @@ -// Copyright 2014 The Prometheus Authors -// 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 model - -import ( - "sort" -) - -// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is -// used to separate label names, label values, and other strings from each other -// when calculating their combined hash value (aka signature aka fingerprint). -const SeparatorByte byte = 255 - -var ( - // cache the signature of an empty label set. - emptyLabelSignature = hashNew() -) - -// LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a -// given label set. (Collisions are possible but unlikely if the number of label -// sets the function is applied to is small.) -func LabelsToSignature(labels map[string]string) uint64 { - if len(labels) == 0 { - return emptyLabelSignature - } - - labelNames := make([]string, 0, len(labels)) - for labelName := range labels { - labelNames = append(labelNames, labelName) - } - sort.Strings(labelNames) - - sum := hashNew() - for _, labelName := range labelNames { - sum = hashAdd(sum, labelName) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, labels[labelName]) - sum = hashAddByte(sum, SeparatorByte) - } - return sum -} - -// labelSetToFingerprint works exactly as LabelsToSignature but takes a LabelSet as -// parameter (rather than a label map) and returns a Fingerprint. -func labelSetToFingerprint(ls LabelSet) Fingerprint { - if len(ls) == 0 { - return Fingerprint(emptyLabelSignature) - } - - labelNames := make(LabelNames, 0, len(ls)) - for labelName := range ls { - labelNames = append(labelNames, labelName) - } - sort.Sort(labelNames) - - sum := hashNew() - for _, labelName := range labelNames { - sum = hashAdd(sum, string(labelName)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(ls[labelName])) - sum = hashAddByte(sum, SeparatorByte) - } - return Fingerprint(sum) -} - -// labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a -// faster and less allocation-heavy hash function, which is more susceptible to -// create hash collisions. Therefore, collision detection should be applied. -func labelSetToFastFingerprint(ls LabelSet) Fingerprint { - if len(ls) == 0 { - return Fingerprint(emptyLabelSignature) - } - - var result uint64 - for labelName, labelValue := range ls { - sum := hashNew() - sum = hashAdd(sum, string(labelName)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(labelValue)) - result ^= sum - } - return Fingerprint(result) -} - -// SignatureForLabels works like LabelsToSignature but takes a Metric as -// parameter (rather than a label map) and only includes the labels with the -// specified LabelNames into the signature calculation. The labels passed in -// will be sorted by this function. -func SignatureForLabels(m Metric, labels ...LabelName) uint64 { - if len(labels) == 0 { - return emptyLabelSignature - } - - sort.Sort(LabelNames(labels)) - - sum := hashNew() - for _, label := range labels { - sum = hashAdd(sum, string(label)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(m[label])) - sum = hashAddByte(sum, SeparatorByte) - } - return sum -} - -// SignatureWithoutLabels works like LabelsToSignature but takes a Metric as -// parameter (rather than a label map) and excludes the labels with any of the -// specified LabelNames from the signature calculation. -func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 { - if len(m) == 0 { - return emptyLabelSignature - } - - labelNames := make(LabelNames, 0, len(m)) - for labelName := range m { - if _, exclude := labels[labelName]; !exclude { - labelNames = append(labelNames, labelName) - } - } - if len(labelNames) == 0 { - return emptyLabelSignature - } - sort.Sort(labelNames) - - sum := hashNew() - for _, labelName := range labelNames { - sum = hashAdd(sum, string(labelName)) - sum = hashAddByte(sum, SeparatorByte) - sum = hashAdd(sum, string(m[labelName])) - sum = hashAddByte(sum, SeparatorByte) - } - return sum -} +// Copyright 2014 The Prometheus Authors +// 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 model + +import ( + "sort" +) + +// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is +// used to separate label names, label values, and other strings from each other +// when calculating their combined hash value (aka signature aka fingerprint). +const SeparatorByte byte = 255 + +var ( + // cache the signature of an empty label set. + emptyLabelSignature = hashNew() +) + +// LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a +// given label set. (Collisions are possible but unlikely if the number of label +// sets the function is applied to is small.) +func LabelsToSignature(labels map[string]string) uint64 { + if len(labels) == 0 { + return emptyLabelSignature + } + + labelNames := make([]string, 0, len(labels)) + for labelName := range labels { + labelNames = append(labelNames, labelName) + } + sort.Strings(labelNames) + + sum := hashNew() + for _, labelName := range labelNames { + sum = hashAdd(sum, labelName) + sum = hashAddByte(sum, SeparatorByte) + sum = hashAdd(sum, labels[labelName]) + sum = hashAddByte(sum, SeparatorByte) + } + return sum +} + +// labelSetToFingerprint works exactly as LabelsToSignature but takes a LabelSet as +// parameter (rather than a label map) and returns a Fingerprint. +func labelSetToFingerprint(ls LabelSet) Fingerprint { + if len(ls) == 0 { + return Fingerprint(emptyLabelSignature) + } + + labelNames := make(LabelNames, 0, len(ls)) + for labelName := range ls { + labelNames = append(labelNames, labelName) + } + sort.Sort(labelNames) + + sum := hashNew() + for _, labelName := range labelNames { + sum = hashAdd(sum, string(labelName)) + sum = hashAddByte(sum, SeparatorByte) + sum = hashAdd(sum, string(ls[labelName])) + sum = hashAddByte(sum, SeparatorByte) + } + return Fingerprint(sum) +} + +// labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a +// faster and less allocation-heavy hash function, which is more susceptible to +// create hash collisions. Therefore, collision detection should be applied. +func labelSetToFastFingerprint(ls LabelSet) Fingerprint { + if len(ls) == 0 { + return Fingerprint(emptyLabelSignature) + } + + var result uint64 + for labelName, labelValue := range ls { + sum := hashNew() + sum = hashAdd(sum, string(labelName)) + sum = hashAddByte(sum, SeparatorByte) + sum = hashAdd(sum, string(labelValue)) + result ^= sum + } + return Fingerprint(result) +} + +// SignatureForLabels works like LabelsToSignature but takes a Metric as +// parameter (rather than a label map) and only includes the labels with the +// specified LabelNames into the signature calculation. The labels passed in +// will be sorted by this function. +func SignatureForLabels(m Metric, labels ...LabelName) uint64 { + if len(labels) == 0 { + return emptyLabelSignature + } + + sort.Sort(LabelNames(labels)) + + sum := hashNew() + for _, label := range labels { + sum = hashAdd(sum, string(label)) + sum = hashAddByte(sum, SeparatorByte) + sum = hashAdd(sum, string(m[label])) + sum = hashAddByte(sum, SeparatorByte) + } + return sum +} + +// SignatureWithoutLabels works like LabelsToSignature but takes a Metric as +// parameter (rather than a label map) and excludes the labels with any of the +// specified LabelNames from the signature calculation. +func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 { + if len(m) == 0 { + return emptyLabelSignature + } + + labelNames := make(LabelNames, 0, len(m)) + for labelName := range m { + if _, exclude := labels[labelName]; !exclude { + labelNames = append(labelNames, labelName) + } + } + if len(labelNames) == 0 { + return emptyLabelSignature + } + sort.Sort(labelNames) + + sum := hashNew() + for _, labelName := range labelNames { + sum = hashAdd(sum, string(labelName)) + sum = hashAddByte(sum, SeparatorByte) + sum = hashAdd(sum, string(m[labelName])) + sum = hashAddByte(sum, SeparatorByte) + } + return sum +} diff --git a/vendor/github.com/prometheus/common/model/signature_test.go b/vendor/github.com/prometheus/common/model/signature_test.go index 282cb3e282..d59c8a8c30 100644 --- a/vendor/github.com/prometheus/common/model/signature_test.go +++ b/vendor/github.com/prometheus/common/model/signature_test.go @@ -1,314 +1,314 @@ -// Copyright 2014 The Prometheus Authors -// 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 model - -import ( - "runtime" - "sync" - "testing" -) - -func TestLabelsToSignature(t *testing.T) { - var scenarios = []struct { - in map[string]string - out uint64 - }{ - { - in: map[string]string{}, - out: 14695981039346656037, - }, - { - in: map[string]string{"name": "garland, briggs", "fear": "love is not enough"}, - out: 5799056148416392346, - }, - } - - for i, scenario := range scenarios { - actual := LabelsToSignature(scenario.in) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestMetricToFingerprint(t *testing.T) { - var scenarios = []struct { - in LabelSet - out Fingerprint - }{ - { - in: LabelSet{}, - out: 14695981039346656037, - }, - { - in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"}, - out: 5799056148416392346, - }, - } - - for i, scenario := range scenarios { - actual := labelSetToFingerprint(scenario.in) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestMetricToFastFingerprint(t *testing.T) { - var scenarios = []struct { - in LabelSet - out Fingerprint - }{ - { - in: LabelSet{}, - out: 14695981039346656037, - }, - { - in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"}, - out: 12952432476264840823, - }, - } - - for i, scenario := range scenarios { - actual := labelSetToFastFingerprint(scenario.in) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestSignatureForLabels(t *testing.T) { - var scenarios = []struct { - in Metric - labels LabelNames - out uint64 - }{ - { - in: Metric{}, - labels: nil, - out: 14695981039346656037, - }, - { - in: Metric{}, - labels: LabelNames{"empty"}, - out: 7187873163539638612, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: LabelNames{"empty"}, - out: 7187873163539638612, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: LabelNames{"fear", "name"}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"}, - labels: LabelNames{"fear", "name"}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: LabelNames{}, - out: 14695981039346656037, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: nil, - out: 14695981039346656037, - }, - } - - for i, scenario := range scenarios { - actual := SignatureForLabels(scenario.in, scenario.labels...) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func TestSignatureWithoutLabels(t *testing.T) { - var scenarios = []struct { - in Metric - labels map[LabelName]struct{} - out uint64 - }{ - { - in: Metric{}, - labels: nil, - out: 14695981039346656037, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: map[LabelName]struct{}{"fear": struct{}{}, "name": struct{}{}}, - out: 14695981039346656037, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"}, - labels: map[LabelName]struct{}{"foo": struct{}{}}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: map[LabelName]struct{}{}, - out: 5799056148416392346, - }, - { - in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, - labels: nil, - out: 5799056148416392346, - }, - } - - for i, scenario := range scenarios { - actual := SignatureWithoutLabels(scenario.in, scenario.labels) - - if actual != scenario.out { - t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) - } - } -} - -func benchmarkLabelToSignature(b *testing.B, l map[string]string, e uint64) { - for i := 0; i < b.N; i++ { - if a := LabelsToSignature(l); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, l, a) - } - } -} - -func BenchmarkLabelToSignatureScalar(b *testing.B) { - benchmarkLabelToSignature(b, nil, 14695981039346656037) -} - -func BenchmarkLabelToSignatureSingle(b *testing.B) { - benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value"}, 5146282821936882169) -} - -func BenchmarkLabelToSignatureDouble(b *testing.B) { - benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717) -} - -func BenchmarkLabelToSignatureTriple(b *testing.B) { - benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121) -} - -func benchmarkMetricToFingerprint(b *testing.B, ls LabelSet, e Fingerprint) { - for i := 0; i < b.N; i++ { - if a := labelSetToFingerprint(ls); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) - } - } -} - -func BenchmarkMetricToFingerprintScalar(b *testing.B) { - benchmarkMetricToFingerprint(b, nil, 14695981039346656037) -} - -func BenchmarkMetricToFingerprintSingle(b *testing.B) { - benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5146282821936882169) -} - -func BenchmarkMetricToFingerprintDouble(b *testing.B) { - benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717) -} - -func BenchmarkMetricToFingerprintTriple(b *testing.B) { - benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121) -} - -func benchmarkMetricToFastFingerprint(b *testing.B, ls LabelSet, e Fingerprint) { - for i := 0; i < b.N; i++ { - if a := labelSetToFastFingerprint(ls); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) - } - } -} - -func BenchmarkMetricToFastFingerprintScalar(b *testing.B) { - benchmarkMetricToFastFingerprint(b, nil, 14695981039346656037) -} - -func BenchmarkMetricToFastFingerprintSingle(b *testing.B) { - benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5147259542624943964) -} - -func BenchmarkMetricToFastFingerprintDouble(b *testing.B) { - benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 18269973311206963528) -} - -func BenchmarkMetricToFastFingerprintTriple(b *testing.B) { - benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676) -} - -func BenchmarkEmptyLabelSignature(b *testing.B) { - input := []map[string]string{nil, {}} - - var ms runtime.MemStats - runtime.ReadMemStats(&ms) - - alloc := ms.Alloc - - for _, labels := range input { - LabelsToSignature(labels) - } - - runtime.ReadMemStats(&ms) - - if got := ms.Alloc; alloc != got { - b.Fatal("expected LabelsToSignature with empty labels not to perform allocations") - } -} - -func benchmarkMetricToFastFingerprintConc(b *testing.B, ls LabelSet, e Fingerprint, concLevel int) { - var start, end sync.WaitGroup - start.Add(1) - end.Add(concLevel) - - for i := 0; i < concLevel; i++ { - go func() { - start.Wait() - for j := b.N / concLevel; j >= 0; j-- { - if a := labelSetToFastFingerprint(ls); a != e { - b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) - } - } - end.Done() - }() - } - b.ResetTimer() - start.Done() - end.Wait() -} - -func BenchmarkMetricToFastFingerprintTripleConc1(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 1) -} - -func BenchmarkMetricToFastFingerprintTripleConc2(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 2) -} - -func BenchmarkMetricToFastFingerprintTripleConc4(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 4) -} - -func BenchmarkMetricToFastFingerprintTripleConc8(b *testing.B) { - benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 8) -} +// Copyright 2014 The Prometheus Authors +// 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 model + +import ( + "runtime" + "sync" + "testing" +) + +func TestLabelsToSignature(t *testing.T) { + var scenarios = []struct { + in map[string]string + out uint64 + }{ + { + in: map[string]string{}, + out: 14695981039346656037, + }, + { + in: map[string]string{"name": "garland, briggs", "fear": "love is not enough"}, + out: 5799056148416392346, + }, + } + + for i, scenario := range scenarios { + actual := LabelsToSignature(scenario.in) + + if actual != scenario.out { + t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) + } + } +} + +func TestMetricToFingerprint(t *testing.T) { + var scenarios = []struct { + in LabelSet + out Fingerprint + }{ + { + in: LabelSet{}, + out: 14695981039346656037, + }, + { + in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"}, + out: 5799056148416392346, + }, + } + + for i, scenario := range scenarios { + actual := labelSetToFingerprint(scenario.in) + + if actual != scenario.out { + t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) + } + } +} + +func TestMetricToFastFingerprint(t *testing.T) { + var scenarios = []struct { + in LabelSet + out Fingerprint + }{ + { + in: LabelSet{}, + out: 14695981039346656037, + }, + { + in: LabelSet{"name": "garland, briggs", "fear": "love is not enough"}, + out: 12952432476264840823, + }, + } + + for i, scenario := range scenarios { + actual := labelSetToFastFingerprint(scenario.in) + + if actual != scenario.out { + t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) + } + } +} + +func TestSignatureForLabels(t *testing.T) { + var scenarios = []struct { + in Metric + labels LabelNames + out uint64 + }{ + { + in: Metric{}, + labels: nil, + out: 14695981039346656037, + }, + { + in: Metric{}, + labels: LabelNames{"empty"}, + out: 7187873163539638612, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: LabelNames{"empty"}, + out: 7187873163539638612, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: LabelNames{"fear", "name"}, + out: 5799056148416392346, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"}, + labels: LabelNames{"fear", "name"}, + out: 5799056148416392346, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: LabelNames{}, + out: 14695981039346656037, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: nil, + out: 14695981039346656037, + }, + } + + for i, scenario := range scenarios { + actual := SignatureForLabels(scenario.in, scenario.labels...) + + if actual != scenario.out { + t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) + } + } +} + +func TestSignatureWithoutLabels(t *testing.T) { + var scenarios = []struct { + in Metric + labels map[LabelName]struct{} + out uint64 + }{ + { + in: Metric{}, + labels: nil, + out: 14695981039346656037, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: map[LabelName]struct{}{"fear": struct{}{}, "name": struct{}{}}, + out: 14695981039346656037, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough", "foo": "bar"}, + labels: map[LabelName]struct{}{"foo": struct{}{}}, + out: 5799056148416392346, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: map[LabelName]struct{}{}, + out: 5799056148416392346, + }, + { + in: Metric{"name": "garland, briggs", "fear": "love is not enough"}, + labels: nil, + out: 5799056148416392346, + }, + } + + for i, scenario := range scenarios { + actual := SignatureWithoutLabels(scenario.in, scenario.labels) + + if actual != scenario.out { + t.Errorf("%d. expected %d, got %d", i, scenario.out, actual) + } + } +} + +func benchmarkLabelToSignature(b *testing.B, l map[string]string, e uint64) { + for i := 0; i < b.N; i++ { + if a := LabelsToSignature(l); a != e { + b.Fatalf("expected signature of %d for %s, got %d", e, l, a) + } + } +} + +func BenchmarkLabelToSignatureScalar(b *testing.B) { + benchmarkLabelToSignature(b, nil, 14695981039346656037) +} + +func BenchmarkLabelToSignatureSingle(b *testing.B) { + benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value"}, 5146282821936882169) +} + +func BenchmarkLabelToSignatureDouble(b *testing.B) { + benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717) +} + +func BenchmarkLabelToSignatureTriple(b *testing.B) { + benchmarkLabelToSignature(b, map[string]string{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121) +} + +func benchmarkMetricToFingerprint(b *testing.B, ls LabelSet, e Fingerprint) { + for i := 0; i < b.N; i++ { + if a := labelSetToFingerprint(ls); a != e { + b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) + } + } +} + +func BenchmarkMetricToFingerprintScalar(b *testing.B) { + benchmarkMetricToFingerprint(b, nil, 14695981039346656037) +} + +func BenchmarkMetricToFingerprintSingle(b *testing.B) { + benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5146282821936882169) +} + +func BenchmarkMetricToFingerprintDouble(b *testing.B) { + benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 3195800080984914717) +} + +func BenchmarkMetricToFingerprintTriple(b *testing.B) { + benchmarkMetricToFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 13843036195897128121) +} + +func benchmarkMetricToFastFingerprint(b *testing.B, ls LabelSet, e Fingerprint) { + for i := 0; i < b.N; i++ { + if a := labelSetToFastFingerprint(ls); a != e { + b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) + } + } +} + +func BenchmarkMetricToFastFingerprintScalar(b *testing.B) { + benchmarkMetricToFastFingerprint(b, nil, 14695981039346656037) +} + +func BenchmarkMetricToFastFingerprintSingle(b *testing.B) { + benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value"}, 5147259542624943964) +} + +func BenchmarkMetricToFastFingerprintDouble(b *testing.B) { + benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value"}, 18269973311206963528) +} + +func BenchmarkMetricToFastFingerprintTriple(b *testing.B) { + benchmarkMetricToFastFingerprint(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676) +} + +func BenchmarkEmptyLabelSignature(b *testing.B) { + input := []map[string]string{nil, {}} + + var ms runtime.MemStats + runtime.ReadMemStats(&ms) + + alloc := ms.Alloc + + for _, labels := range input { + LabelsToSignature(labels) + } + + runtime.ReadMemStats(&ms) + + if got := ms.Alloc; alloc != got { + b.Fatal("expected LabelsToSignature with empty labels not to perform allocations") + } +} + +func benchmarkMetricToFastFingerprintConc(b *testing.B, ls LabelSet, e Fingerprint, concLevel int) { + var start, end sync.WaitGroup + start.Add(1) + end.Add(concLevel) + + for i := 0; i < concLevel; i++ { + go func() { + start.Wait() + for j := b.N / concLevel; j >= 0; j-- { + if a := labelSetToFastFingerprint(ls); a != e { + b.Fatalf("expected signature of %d for %s, got %d", e, ls, a) + } + } + end.Done() + }() + } + b.ResetTimer() + start.Done() + end.Wait() +} + +func BenchmarkMetricToFastFingerprintTripleConc1(b *testing.B) { + benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 1) +} + +func BenchmarkMetricToFastFingerprintTripleConc2(b *testing.B) { + benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 2) +} + +func BenchmarkMetricToFastFingerprintTripleConc4(b *testing.B) { + benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 4) +} + +func BenchmarkMetricToFastFingerprintTripleConc8(b *testing.B) { + benchmarkMetricToFastFingerprintConc(b, LabelSet{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 8) +} diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go index 385ab9b3fb..7538e29977 100644 --- a/vendor/github.com/prometheus/common/model/silence.go +++ b/vendor/github.com/prometheus/common/model/silence.go @@ -1,106 +1,106 @@ -// Copyright 2015 The Prometheus Authors -// 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 model - -import ( - "encoding/json" - "fmt" - "regexp" - "time" -) - -// Matcher describes a matches the value of a given label. -type Matcher struct { - Name LabelName `json:"name"` - Value string `json:"value"` - IsRegex bool `json:"isRegex"` -} - -func (m *Matcher) UnmarshalJSON(b []byte) error { - type plain Matcher - if err := json.Unmarshal(b, (*plain)(m)); err != nil { - return err - } - - if len(m.Name) == 0 { - return fmt.Errorf("label name in matcher must not be empty") - } - if m.IsRegex { - if _, err := regexp.Compile(m.Value); err != nil { - return err - } - } - return nil -} - -// Validate returns true iff all fields of the matcher have valid values. -func (m *Matcher) Validate() error { - if !m.Name.IsValid() { - return fmt.Errorf("invalid name %q", m.Name) - } - if m.IsRegex { - if _, err := regexp.Compile(m.Value); err != nil { - return fmt.Errorf("invalid regular expression %q", m.Value) - } - } else if !LabelValue(m.Value).IsValid() || len(m.Value) == 0 { - return fmt.Errorf("invalid value %q", m.Value) - } - return nil -} - -// Silence defines the representation of a silence definiton -// in the Prometheus eco-system. -type Silence struct { - ID uint64 `json:"id,omitempty"` - - Matchers []*Matcher `json:"matchers"` - - StartsAt time.Time `json:"startsAt"` - EndsAt time.Time `json:"endsAt"` - - CreatedAt time.Time `json:"createdAt,omitempty"` - CreatedBy string `json:"createdBy"` - Comment string `json:"comment,omitempty"` -} - -// Validate returns true iff all fields of the silence have valid values. -func (s *Silence) Validate() error { - if len(s.Matchers) == 0 { - return fmt.Errorf("at least one matcher required") - } - for _, m := range s.Matchers { - if err := m.Validate(); err != nil { - return fmt.Errorf("invalid matcher: %s", err) - } - } - if s.StartsAt.IsZero() { - return fmt.Errorf("start time missing") - } - if s.EndsAt.IsZero() { - return fmt.Errorf("end time missing") - } - if s.EndsAt.Before(s.StartsAt) { - return fmt.Errorf("start time must be before end time") - } - if s.CreatedBy == "" { - return fmt.Errorf("creator information missing") - } - if s.Comment == "" { - return fmt.Errorf("comment missing") - } - if s.CreatedAt.IsZero() { - return fmt.Errorf("creation timestamp missing") - } - return nil -} +// Copyright 2015 The Prometheus Authors +// 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 model + +import ( + "encoding/json" + "fmt" + "regexp" + "time" +) + +// Matcher describes a matches the value of a given label. +type Matcher struct { + Name LabelName `json:"name"` + Value string `json:"value"` + IsRegex bool `json:"isRegex"` +} + +func (m *Matcher) UnmarshalJSON(b []byte) error { + type plain Matcher + if err := json.Unmarshal(b, (*plain)(m)); err != nil { + return err + } + + if len(m.Name) == 0 { + return fmt.Errorf("label name in matcher must not be empty") + } + if m.IsRegex { + if _, err := regexp.Compile(m.Value); err != nil { + return err + } + } + return nil +} + +// Validate returns true iff all fields of the matcher have valid values. +func (m *Matcher) Validate() error { + if !m.Name.IsValid() { + return fmt.Errorf("invalid name %q", m.Name) + } + if m.IsRegex { + if _, err := regexp.Compile(m.Value); err != nil { + return fmt.Errorf("invalid regular expression %q", m.Value) + } + } else if !LabelValue(m.Value).IsValid() || len(m.Value) == 0 { + return fmt.Errorf("invalid value %q", m.Value) + } + return nil +} + +// Silence defines the representation of a silence definiton +// in the Prometheus eco-system. +type Silence struct { + ID uint64 `json:"id,omitempty"` + + Matchers []*Matcher `json:"matchers"` + + StartsAt time.Time `json:"startsAt"` + EndsAt time.Time `json:"endsAt"` + + CreatedAt time.Time `json:"createdAt,omitempty"` + CreatedBy string `json:"createdBy"` + Comment string `json:"comment,omitempty"` +} + +// Validate returns true iff all fields of the silence have valid values. +func (s *Silence) Validate() error { + if len(s.Matchers) == 0 { + return fmt.Errorf("at least one matcher required") + } + for _, m := range s.Matchers { + if err := m.Validate(); err != nil { + return fmt.Errorf("invalid matcher: %s", err) + } + } + if s.StartsAt.IsZero() { + return fmt.Errorf("start time missing") + } + if s.EndsAt.IsZero() { + return fmt.Errorf("end time missing") + } + if s.EndsAt.Before(s.StartsAt) { + return fmt.Errorf("start time must be before end time") + } + if s.CreatedBy == "" { + return fmt.Errorf("creator information missing") + } + if s.Comment == "" { + return fmt.Errorf("comment missing") + } + if s.CreatedAt.IsZero() { + return fmt.Errorf("creation timestamp missing") + } + return nil +} diff --git a/vendor/github.com/prometheus/common/model/silence_test.go b/vendor/github.com/prometheus/common/model/silence_test.go index 82b4a63b13..8eaaf0744c 100644 --- a/vendor/github.com/prometheus/common/model/silence_test.go +++ b/vendor/github.com/prometheus/common/model/silence_test.go @@ -1,228 +1,228 @@ -// Copyright 2015 The Prometheus Authors -// 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 model - -import ( - "strings" - "testing" - "time" -) - -func TestMatcherValidate(t *testing.T) { - var cases = []struct { - matcher *Matcher - err string - }{ - { - matcher: &Matcher{ - Name: "name", - Value: "value", - }, - }, - { - matcher: &Matcher{ - Name: "name", - Value: "value", - IsRegex: true, - }, - }, - { - matcher: &Matcher{ - Name: "name!", - Value: "value", - }, - err: "invalid name", - }, - { - matcher: &Matcher{ - Name: "", - Value: "value", - }, - err: "invalid name", - }, - { - matcher: &Matcher{ - Name: "name", - Value: "value\xff", - }, - err: "invalid value", - }, - { - matcher: &Matcher{ - Name: "name", - Value: "", - }, - err: "invalid value", - }, - } - - for i, c := range cases { - err := c.matcher.Validate() - if err == nil { - if c.err == "" { - continue - } - t.Errorf("%d. Expected error %q but got none", i, c.err) - continue - } - if c.err == "" && err != nil { - t.Errorf("%d. Expected no error but got %q", i, err) - continue - } - if !strings.Contains(err.Error(), c.err) { - t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) - } - } -} - -func TestSilenceValidate(t *testing.T) { - ts := time.Now() - - var cases = []struct { - sil *Silence - err string - }{ - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - {Name: "name", Value: "value"}, - {Name: "name", Value: "value"}, - {Name: "name", Value: "value", IsRegex: true}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts.Add(-1 * time.Minute), - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "start time must be before end time", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "end time missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "start time missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "!name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "invalid matcher", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - CreatedBy: "name", - }, - err: "comment missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedBy: "name", - Comment: "comment", - }, - err: "creation timestamp missing", - }, - { - sil: &Silence{ - Matchers: []*Matcher{ - {Name: "name", Value: "value"}, - }, - StartsAt: ts, - EndsAt: ts, - CreatedAt: ts, - Comment: "comment", - }, - err: "creator information missing", - }, - } - - for i, c := range cases { - err := c.sil.Validate() - if err == nil { - if c.err == "" { - continue - } - t.Errorf("%d. Expected error %q but got none", i, c.err) - continue - } - if c.err == "" && err != nil { - t.Errorf("%d. Expected no error but got %q", i, err) - continue - } - if !strings.Contains(err.Error(), c.err) { - t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) - } - } -} +// Copyright 2015 The Prometheus Authors +// 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 model + +import ( + "strings" + "testing" + "time" +) + +func TestMatcherValidate(t *testing.T) { + var cases = []struct { + matcher *Matcher + err string + }{ + { + matcher: &Matcher{ + Name: "name", + Value: "value", + }, + }, + { + matcher: &Matcher{ + Name: "name", + Value: "value", + IsRegex: true, + }, + }, + { + matcher: &Matcher{ + Name: "name!", + Value: "value", + }, + err: "invalid name", + }, + { + matcher: &Matcher{ + Name: "", + Value: "value", + }, + err: "invalid name", + }, + { + matcher: &Matcher{ + Name: "name", + Value: "value\xff", + }, + err: "invalid value", + }, + { + matcher: &Matcher{ + Name: "name", + Value: "", + }, + err: "invalid value", + }, + } + + for i, c := range cases { + err := c.matcher.Validate() + if err == nil { + if c.err == "" { + continue + } + t.Errorf("%d. Expected error %q but got none", i, c.err) + continue + } + if c.err == "" && err != nil { + t.Errorf("%d. Expected no error but got %q", i, err) + continue + } + if !strings.Contains(err.Error(), c.err) { + t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) + } + } +} + +func TestSilenceValidate(t *testing.T) { + ts := time.Now() + + var cases = []struct { + sil *Silence + err string + }{ + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + StartsAt: ts, + EndsAt: ts, + CreatedAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + {Name: "name", Value: "value"}, + {Name: "name", Value: "value"}, + {Name: "name", Value: "value", IsRegex: true}, + }, + StartsAt: ts, + EndsAt: ts, + CreatedAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + StartsAt: ts, + EndsAt: ts.Add(-1 * time.Minute), + CreatedAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + err: "start time must be before end time", + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + StartsAt: ts, + CreatedAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + err: "end time missing", + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + EndsAt: ts, + CreatedAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + err: "start time missing", + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "!name", Value: "value"}, + }, + StartsAt: ts, + EndsAt: ts, + CreatedAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + err: "invalid matcher", + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + StartsAt: ts, + EndsAt: ts, + CreatedAt: ts, + CreatedBy: "name", + }, + err: "comment missing", + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + StartsAt: ts, + EndsAt: ts, + CreatedBy: "name", + Comment: "comment", + }, + err: "creation timestamp missing", + }, + { + sil: &Silence{ + Matchers: []*Matcher{ + {Name: "name", Value: "value"}, + }, + StartsAt: ts, + EndsAt: ts, + CreatedAt: ts, + Comment: "comment", + }, + err: "creator information missing", + }, + } + + for i, c := range cases { + err := c.sil.Validate() + if err == nil { + if c.err == "" { + continue + } + t.Errorf("%d. Expected error %q but got none", i, c.err) + continue + } + if c.err == "" && err != nil { + t.Errorf("%d. Expected no error but got %q", i, err) + continue + } + if !strings.Contains(err.Error(), c.err) { + t.Errorf("%d. Expected error to contain %q but got %q", i, c.err, err) + } + } +} diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go index d7d79ec109..548968aebe 100644 --- a/vendor/github.com/prometheus/common/model/time.go +++ b/vendor/github.com/prometheus/common/model/time.go @@ -1,249 +1,249 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "fmt" - "math" - "regexp" - "strconv" - "strings" - "time" -) - -const ( - // MinimumTick is the minimum supported time resolution. This has to be - // at least time.Second in order for the code below to work. - minimumTick = time.Millisecond - // second is the Time duration equivalent to one second. - second = int64(time.Second / minimumTick) - // The number of nanoseconds per minimum tick. - nanosPerTick = int64(minimumTick / time.Nanosecond) - - // Earliest is the earliest Time representable. Handy for - // initializing a high watermark. - Earliest = Time(math.MinInt64) - // Latest is the latest Time representable. Handy for initializing - // a low watermark. - Latest = Time(math.MaxInt64) -) - -// Time is the number of milliseconds since the epoch -// (1970-01-01 00:00 UTC) excluding leap seconds. -type Time int64 - -// Interval describes and interval between two timestamps. -type Interval struct { - Start, End Time -} - -// Now returns the current time as a Time. -func Now() Time { - return TimeFromUnixNano(time.Now().UnixNano()) -} - -// TimeFromUnix returns the Time equivalent to the Unix Time t -// provided in seconds. -func TimeFromUnix(t int64) Time { - return Time(t * second) -} - -// TimeFromUnixNano returns the Time equivalent to the Unix Time -// t provided in nanoseconds. -func TimeFromUnixNano(t int64) Time { - return Time(t / nanosPerTick) -} - -// Equal reports whether two Times represent the same instant. -func (t Time) Equal(o Time) bool { - return t == o -} - -// Before reports whether the Time t is before o. -func (t Time) Before(o Time) bool { - return t < o -} - -// After reports whether the Time t is after o. -func (t Time) After(o Time) bool { - return t > o -} - -// Add returns the Time t + d. -func (t Time) Add(d time.Duration) Time { - return t + Time(d/minimumTick) -} - -// Sub returns the Duration t - o. -func (t Time) Sub(o Time) time.Duration { - return time.Duration(t-o) * minimumTick -} - -// Time returns the time.Time representation of t. -func (t Time) Time() time.Time { - return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick) -} - -// Unix returns t as a Unix time, the number of seconds elapsed -// since January 1, 1970 UTC. -func (t Time) Unix() int64 { - return int64(t) / second -} - -// UnixNano returns t as a Unix time, the number of nanoseconds elapsed -// since January 1, 1970 UTC. -func (t Time) UnixNano() int64 { - return int64(t) * nanosPerTick -} - -// The number of digits after the dot. -var dotPrecision = int(math.Log10(float64(second))) - -// String returns a string representation of the Time. -func (t Time) String() string { - return strconv.FormatFloat(float64(t)/float64(second), 'f', -1, 64) -} - -// MarshalJSON implements the json.Marshaler interface. -func (t Time) MarshalJSON() ([]byte, error) { - return []byte(t.String()), nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (t *Time) UnmarshalJSON(b []byte) error { - p := strings.Split(string(b), ".") - switch len(p) { - case 1: - v, err := strconv.ParseInt(string(p[0]), 10, 64) - if err != nil { - return err - } - *t = Time(v * second) - - case 2: - v, err := strconv.ParseInt(string(p[0]), 10, 64) - if err != nil { - return err - } - v *= second - - prec := dotPrecision - len(p[1]) - if prec < 0 { - p[1] = p[1][:dotPrecision] - } else if prec > 0 { - p[1] = p[1] + strings.Repeat("0", prec) - } - - va, err := strconv.ParseInt(p[1], 10, 32) - if err != nil { - return err - } - - *t = Time(v + va) - - default: - return fmt.Errorf("invalid time %q", string(b)) - } - return nil -} - -// Duration wraps time.Duration. It is used to parse the custom duration format -// from YAML. -// This type should not propagate beyond the scope of input/output processing. -type Duration time.Duration - -var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") - -// StringToDuration parses a string into a time.Duration, assuming that a year -// always has 365d, a week always has 7d, and a day always has 24h. -func ParseDuration(durationStr string) (Duration, error) { - matches := durationRE.FindStringSubmatch(durationStr) - if len(matches) != 3 { - return 0, fmt.Errorf("not a valid duration string: %q", durationStr) - } - var ( - n, _ = strconv.Atoi(matches[1]) - dur = time.Duration(n) * time.Millisecond - ) - switch unit := matches[2]; unit { - case "y": - dur *= 1000 * 60 * 60 * 24 * 365 - case "w": - dur *= 1000 * 60 * 60 * 24 * 7 - case "d": - dur *= 1000 * 60 * 60 * 24 - case "h": - dur *= 1000 * 60 * 60 - case "m": - dur *= 1000 * 60 - case "s": - dur *= 1000 - case "ms": - // Value already correct - default: - return 0, fmt.Errorf("invalid time unit in duration string: %q", unit) - } - return Duration(dur), nil -} - -func (d Duration) String() string { - var ( - ms = int64(time.Duration(d) / time.Millisecond) - unit = "ms" - ) - factors := map[string]int64{ - "y": 1000 * 60 * 60 * 24 * 365, - "w": 1000 * 60 * 60 * 24 * 7, - "d": 1000 * 60 * 60 * 24, - "h": 1000 * 60 * 60, - "m": 1000 * 60, - "s": 1000, - "ms": 1, - } - - switch int64(0) { - case ms % factors["y"]: - unit = "y" - case ms % factors["w"]: - unit = "w" - case ms % factors["d"]: - unit = "d" - case ms % factors["h"]: - unit = "h" - case ms % factors["m"]: - unit = "m" - case ms % factors["s"]: - unit = "s" - } - return fmt.Sprintf("%v%v", ms/factors[unit], unit) -} - -// MarshalYAML implements the yaml.Marshaler interface. -func (d Duration) MarshalYAML() (interface{}, error) { - return d.String(), nil -} - -// UnmarshalYAML implements the yaml.Unmarshaler interface. -func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - if err := unmarshal(&s); err != nil { - return err - } - dur, err := ParseDuration(s) - if err != nil { - return err - } - *d = dur - return nil -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "fmt" + "math" + "regexp" + "strconv" + "strings" + "time" +) + +const ( + // MinimumTick is the minimum supported time resolution. This has to be + // at least time.Second in order for the code below to work. + minimumTick = time.Millisecond + // second is the Time duration equivalent to one second. + second = int64(time.Second / minimumTick) + // The number of nanoseconds per minimum tick. + nanosPerTick = int64(minimumTick / time.Nanosecond) + + // Earliest is the earliest Time representable. Handy for + // initializing a high watermark. + Earliest = Time(math.MinInt64) + // Latest is the latest Time representable. Handy for initializing + // a low watermark. + Latest = Time(math.MaxInt64) +) + +// Time is the number of milliseconds since the epoch +// (1970-01-01 00:00 UTC) excluding leap seconds. +type Time int64 + +// Interval describes and interval between two timestamps. +type Interval struct { + Start, End Time +} + +// Now returns the current time as a Time. +func Now() Time { + return TimeFromUnixNano(time.Now().UnixNano()) +} + +// TimeFromUnix returns the Time equivalent to the Unix Time t +// provided in seconds. +func TimeFromUnix(t int64) Time { + return Time(t * second) +} + +// TimeFromUnixNano returns the Time equivalent to the Unix Time +// t provided in nanoseconds. +func TimeFromUnixNano(t int64) Time { + return Time(t / nanosPerTick) +} + +// Equal reports whether two Times represent the same instant. +func (t Time) Equal(o Time) bool { + return t == o +} + +// Before reports whether the Time t is before o. +func (t Time) Before(o Time) bool { + return t < o +} + +// After reports whether the Time t is after o. +func (t Time) After(o Time) bool { + return t > o +} + +// Add returns the Time t + d. +func (t Time) Add(d time.Duration) Time { + return t + Time(d/minimumTick) +} + +// Sub returns the Duration t - o. +func (t Time) Sub(o Time) time.Duration { + return time.Duration(t-o) * minimumTick +} + +// Time returns the time.Time representation of t. +func (t Time) Time() time.Time { + return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick) +} + +// Unix returns t as a Unix time, the number of seconds elapsed +// since January 1, 1970 UTC. +func (t Time) Unix() int64 { + return int64(t) / second +} + +// UnixNano returns t as a Unix time, the number of nanoseconds elapsed +// since January 1, 1970 UTC. +func (t Time) UnixNano() int64 { + return int64(t) * nanosPerTick +} + +// The number of digits after the dot. +var dotPrecision = int(math.Log10(float64(second))) + +// String returns a string representation of the Time. +func (t Time) String() string { + return strconv.FormatFloat(float64(t)/float64(second), 'f', -1, 64) +} + +// MarshalJSON implements the json.Marshaler interface. +func (t Time) MarshalJSON() ([]byte, error) { + return []byte(t.String()), nil +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (t *Time) UnmarshalJSON(b []byte) error { + p := strings.Split(string(b), ".") + switch len(p) { + case 1: + v, err := strconv.ParseInt(string(p[0]), 10, 64) + if err != nil { + return err + } + *t = Time(v * second) + + case 2: + v, err := strconv.ParseInt(string(p[0]), 10, 64) + if err != nil { + return err + } + v *= second + + prec := dotPrecision - len(p[1]) + if prec < 0 { + p[1] = p[1][:dotPrecision] + } else if prec > 0 { + p[1] = p[1] + strings.Repeat("0", prec) + } + + va, err := strconv.ParseInt(p[1], 10, 32) + if err != nil { + return err + } + + *t = Time(v + va) + + default: + return fmt.Errorf("invalid time %q", string(b)) + } + return nil +} + +// Duration wraps time.Duration. It is used to parse the custom duration format +// from YAML. +// This type should not propagate beyond the scope of input/output processing. +type Duration time.Duration + +var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") + +// StringToDuration parses a string into a time.Duration, assuming that a year +// always has 365d, a week always has 7d, and a day always has 24h. +func ParseDuration(durationStr string) (Duration, error) { + matches := durationRE.FindStringSubmatch(durationStr) + if len(matches) != 3 { + return 0, fmt.Errorf("not a valid duration string: %q", durationStr) + } + var ( + n, _ = strconv.Atoi(matches[1]) + dur = time.Duration(n) * time.Millisecond + ) + switch unit := matches[2]; unit { + case "y": + dur *= 1000 * 60 * 60 * 24 * 365 + case "w": + dur *= 1000 * 60 * 60 * 24 * 7 + case "d": + dur *= 1000 * 60 * 60 * 24 + case "h": + dur *= 1000 * 60 * 60 + case "m": + dur *= 1000 * 60 + case "s": + dur *= 1000 + case "ms": + // Value already correct + default: + return 0, fmt.Errorf("invalid time unit in duration string: %q", unit) + } + return Duration(dur), nil +} + +func (d Duration) String() string { + var ( + ms = int64(time.Duration(d) / time.Millisecond) + unit = "ms" + ) + factors := map[string]int64{ + "y": 1000 * 60 * 60 * 24 * 365, + "w": 1000 * 60 * 60 * 24 * 7, + "d": 1000 * 60 * 60 * 24, + "h": 1000 * 60 * 60, + "m": 1000 * 60, + "s": 1000, + "ms": 1, + } + + switch int64(0) { + case ms % factors["y"]: + unit = "y" + case ms % factors["w"]: + unit = "w" + case ms % factors["d"]: + unit = "d" + case ms % factors["h"]: + unit = "h" + case ms % factors["m"]: + unit = "m" + case ms % factors["s"]: + unit = "s" + } + return fmt.Sprintf("%v%v", ms/factors[unit], unit) +} + +// MarshalYAML implements the yaml.Marshaler interface. +func (d Duration) MarshalYAML() (interface{}, error) { + return d.String(), nil +} + +// UnmarshalYAML implements the yaml.Unmarshaler interface. +func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error { + var s string + if err := unmarshal(&s); err != nil { + return err + } + dur, err := ParseDuration(s) + if err != nil { + return err + } + *d = dur + return nil +} diff --git a/vendor/github.com/prometheus/common/model/time_test.go b/vendor/github.com/prometheus/common/model/time_test.go index 6a081ea1bd..45ffd872d3 100644 --- a/vendor/github.com/prometheus/common/model/time_test.go +++ b/vendor/github.com/prometheus/common/model/time_test.go @@ -1,129 +1,129 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "testing" - "time" -) - -func TestComparators(t *testing.T) { - t1a := TimeFromUnix(0) - t1b := TimeFromUnix(0) - t2 := TimeFromUnix(2*second - 1) - - if !t1a.Equal(t1b) { - t.Fatalf("Expected %s to be equal to %s", t1a, t1b) - } - if t1a.Equal(t2) { - t.Fatalf("Expected %s to not be equal to %s", t1a, t2) - } - - if !t1a.Before(t2) { - t.Fatalf("Expected %s to be before %s", t1a, t2) - } - if t1a.Before(t1b) { - t.Fatalf("Expected %s to not be before %s", t1a, t1b) - } - - if !t2.After(t1a) { - t.Fatalf("Expected %s to be after %s", t2, t1a) - } - if t1b.After(t1a) { - t.Fatalf("Expected %s to not be after %s", t1b, t1a) - } -} - -func TestTimeConversions(t *testing.T) { - unixSecs := int64(1136239445) - unixNsecs := int64(123456789) - unixNano := unixSecs*1e9 + unixNsecs - - t1 := time.Unix(unixSecs, unixNsecs-unixNsecs%nanosPerTick) - t2 := time.Unix(unixSecs, unixNsecs) - - ts := TimeFromUnixNano(unixNano) - if !ts.Time().Equal(t1) { - t.Fatalf("Expected %s, got %s", t1, ts.Time()) - } - - // Test available precision. - ts = TimeFromUnixNano(t2.UnixNano()) - if !ts.Time().Equal(t1) { - t.Fatalf("Expected %s, got %s", t1, ts.Time()) - } - - if ts.UnixNano() != unixNano-unixNano%nanosPerTick { - t.Fatalf("Expected %d, got %d", unixNano, ts.UnixNano()) - } -} - -func TestDuration(t *testing.T) { - duration := time.Second + time.Minute + time.Hour - goTime := time.Unix(1136239445, 0) - - ts := TimeFromUnix(goTime.Unix()) - if !goTime.Add(duration).Equal(ts.Add(duration).Time()) { - t.Fatalf("Expected %s to be equal to %s", goTime.Add(duration), ts.Add(duration)) - } - - earlier := ts.Add(-duration) - delta := ts.Sub(earlier) - if delta != duration { - t.Fatalf("Expected %s to be equal to %s", delta, duration) - } -} - -func TestParseDuration(t *testing.T) { - var cases = []struct { - in string - out time.Duration - }{ - { - in: "324ms", - out: 324 * time.Millisecond, - }, { - in: "3s", - out: 3 * time.Second, - }, { - in: "5m", - out: 5 * time.Minute, - }, { - in: "1h", - out: time.Hour, - }, { - in: "4d", - out: 4 * 24 * time.Hour, - }, { - in: "3w", - out: 3 * 7 * 24 * time.Hour, - }, { - in: "10y", - out: 10 * 365 * 24 * time.Hour, - }, - } - - for _, c := range cases { - d, err := ParseDuration(c.in) - if err != nil { - t.Errorf("Unexpected error on input %q", c.in) - } - if time.Duration(d) != c.out { - t.Errorf("Expected %v but got %v", c.out, d) - } - if d.String() != c.in { - t.Errorf("Expected duration string %q but got %q", c.in, d.String()) - } - } -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "testing" + "time" +) + +func TestComparators(t *testing.T) { + t1a := TimeFromUnix(0) + t1b := TimeFromUnix(0) + t2 := TimeFromUnix(2*second - 1) + + if !t1a.Equal(t1b) { + t.Fatalf("Expected %s to be equal to %s", t1a, t1b) + } + if t1a.Equal(t2) { + t.Fatalf("Expected %s to not be equal to %s", t1a, t2) + } + + if !t1a.Before(t2) { + t.Fatalf("Expected %s to be before %s", t1a, t2) + } + if t1a.Before(t1b) { + t.Fatalf("Expected %s to not be before %s", t1a, t1b) + } + + if !t2.After(t1a) { + t.Fatalf("Expected %s to be after %s", t2, t1a) + } + if t1b.After(t1a) { + t.Fatalf("Expected %s to not be after %s", t1b, t1a) + } +} + +func TestTimeConversions(t *testing.T) { + unixSecs := int64(1136239445) + unixNsecs := int64(123456789) + unixNano := unixSecs*1e9 + unixNsecs + + t1 := time.Unix(unixSecs, unixNsecs-unixNsecs%nanosPerTick) + t2 := time.Unix(unixSecs, unixNsecs) + + ts := TimeFromUnixNano(unixNano) + if !ts.Time().Equal(t1) { + t.Fatalf("Expected %s, got %s", t1, ts.Time()) + } + + // Test available precision. + ts = TimeFromUnixNano(t2.UnixNano()) + if !ts.Time().Equal(t1) { + t.Fatalf("Expected %s, got %s", t1, ts.Time()) + } + + if ts.UnixNano() != unixNano-unixNano%nanosPerTick { + t.Fatalf("Expected %d, got %d", unixNano, ts.UnixNano()) + } +} + +func TestDuration(t *testing.T) { + duration := time.Second + time.Minute + time.Hour + goTime := time.Unix(1136239445, 0) + + ts := TimeFromUnix(goTime.Unix()) + if !goTime.Add(duration).Equal(ts.Add(duration).Time()) { + t.Fatalf("Expected %s to be equal to %s", goTime.Add(duration), ts.Add(duration)) + } + + earlier := ts.Add(-duration) + delta := ts.Sub(earlier) + if delta != duration { + t.Fatalf("Expected %s to be equal to %s", delta, duration) + } +} + +func TestParseDuration(t *testing.T) { + var cases = []struct { + in string + out time.Duration + }{ + { + in: "324ms", + out: 324 * time.Millisecond, + }, { + in: "3s", + out: 3 * time.Second, + }, { + in: "5m", + out: 5 * time.Minute, + }, { + in: "1h", + out: time.Hour, + }, { + in: "4d", + out: 4 * 24 * time.Hour, + }, { + in: "3w", + out: 3 * 7 * 24 * time.Hour, + }, { + in: "10y", + out: 10 * 365 * 24 * time.Hour, + }, + } + + for _, c := range cases { + d, err := ParseDuration(c.in) + if err != nil { + t.Errorf("Unexpected error on input %q", c.in) + } + if time.Duration(d) != c.out { + t.Errorf("Expected %v but got %v", c.out, d) + } + if d.String() != c.in { + t.Errorf("Expected duration string %q but got %q", c.in, d.String()) + } + } +} diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go index 42f4bb6a4d..c9ed3ffd82 100644 --- a/vendor/github.com/prometheus/common/model/value.go +++ b/vendor/github.com/prometheus/common/model/value.go @@ -1,416 +1,416 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "encoding/json" - "fmt" - "math" - "sort" - "strconv" - "strings" -) - -var ( - // ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a - // non-existing sample pair. It is a SamplePair with timestamp Earliest and - // value 0.0. Note that the natural zero value of SamplePair has a timestamp - // of 0, which is possible to appear in a real SamplePair and thus not - // suitable to signal a non-existing SamplePair. - ZeroSamplePair = SamplePair{Timestamp: Earliest} - - // ZeroSample is the pseudo zero-value of Sample used to signal a - // non-existing sample. It is a Sample with timestamp Earliest, value 0.0, - // and metric nil. Note that the natural zero value of Sample has a timestamp - // of 0, which is possible to appear in a real Sample and thus not suitable - // to signal a non-existing Sample. - ZeroSample = Sample{Timestamp: Earliest} -) - -// A SampleValue is a representation of a value for a given sample at a given -// time. -type SampleValue float64 - -// MarshalJSON implements json.Marshaler. -func (v SampleValue) MarshalJSON() ([]byte, error) { - return json.Marshal(v.String()) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (v *SampleValue) UnmarshalJSON(b []byte) error { - if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' { - return fmt.Errorf("sample value must be a quoted string") - } - f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64) - if err != nil { - return err - } - *v = SampleValue(f) - return nil -} - -// Equal returns true if the value of v and o is equal or if both are NaN. Note -// that v==o is false if both are NaN. If you want the conventional float -// behavior, use == to compare two SampleValues. -func (v SampleValue) Equal(o SampleValue) bool { - if v == o { - return true - } - return math.IsNaN(float64(v)) && math.IsNaN(float64(o)) -} - -func (v SampleValue) String() string { - return strconv.FormatFloat(float64(v), 'f', -1, 64) -} - -// SamplePair pairs a SampleValue with a Timestamp. -type SamplePair struct { - Timestamp Time - Value SampleValue -} - -// MarshalJSON implements json.Marshaler. -func (s SamplePair) MarshalJSON() ([]byte, error) { - t, err := json.Marshal(s.Timestamp) - if err != nil { - return nil, err - } - v, err := json.Marshal(s.Value) - if err != nil { - return nil, err - } - return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *SamplePair) UnmarshalJSON(b []byte) error { - v := [...]json.Unmarshaler{&s.Timestamp, &s.Value} - return json.Unmarshal(b, &v) -} - -// Equal returns true if this SamplePair and o have equal Values and equal -// Timestamps. The sematics of Value equality is defined by SampleValue.Equal. -func (s *SamplePair) Equal(o *SamplePair) bool { - return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp)) -} - -func (s SamplePair) String() string { - return fmt.Sprintf("%s @[%s]", s.Value, s.Timestamp) -} - -// Sample is a sample pair associated with a metric. -type Sample struct { - Metric Metric `json:"metric"` - Value SampleValue `json:"value"` - Timestamp Time `json:"timestamp"` -} - -// Equal compares first the metrics, then the timestamp, then the value. The -// sematics of value equality is defined by SampleValue.Equal. -func (s *Sample) Equal(o *Sample) bool { - if s == o { - return true - } - - if !s.Metric.Equal(o.Metric) { - return false - } - if !s.Timestamp.Equal(o.Timestamp) { - return false - } - - return s.Value.Equal(o.Value) -} - -func (s Sample) String() string { - return fmt.Sprintf("%s => %s", s.Metric, SamplePair{ - Timestamp: s.Timestamp, - Value: s.Value, - }) -} - -// MarshalJSON implements json.Marshaler. -func (s Sample) MarshalJSON() ([]byte, error) { - v := struct { - Metric Metric `json:"metric"` - Value SamplePair `json:"value"` - }{ - Metric: s.Metric, - Value: SamplePair{ - Timestamp: s.Timestamp, - Value: s.Value, - }, - } - - return json.Marshal(&v) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *Sample) UnmarshalJSON(b []byte) error { - v := struct { - Metric Metric `json:"metric"` - Value SamplePair `json:"value"` - }{ - Metric: s.Metric, - Value: SamplePair{ - Timestamp: s.Timestamp, - Value: s.Value, - }, - } - - if err := json.Unmarshal(b, &v); err != nil { - return err - } - - s.Metric = v.Metric - s.Timestamp = v.Value.Timestamp - s.Value = v.Value.Value - - return nil -} - -// Samples is a sortable Sample slice. It implements sort.Interface. -type Samples []*Sample - -func (s Samples) Len() int { - return len(s) -} - -// Less compares first the metrics, then the timestamp. -func (s Samples) Less(i, j int) bool { - switch { - case s[i].Metric.Before(s[j].Metric): - return true - case s[j].Metric.Before(s[i].Metric): - return false - case s[i].Timestamp.Before(s[j].Timestamp): - return true - default: - return false - } -} - -func (s Samples) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -// Equal compares two sets of samples and returns true if they are equal. -func (s Samples) Equal(o Samples) bool { - if len(s) != len(o) { - return false - } - - for i, sample := range s { - if !sample.Equal(o[i]) { - return false - } - } - return true -} - -// SampleStream is a stream of Values belonging to an attached COWMetric. -type SampleStream struct { - Metric Metric `json:"metric"` - Values []SamplePair `json:"values"` -} - -func (ss SampleStream) String() string { - vals := make([]string, len(ss.Values)) - for i, v := range ss.Values { - vals[i] = v.String() - } - return fmt.Sprintf("%s =>\n%s", ss.Metric, strings.Join(vals, "\n")) -} - -// Value is a generic interface for values resulting from a query evaluation. -type Value interface { - Type() ValueType - String() string -} - -func (Matrix) Type() ValueType { return ValMatrix } -func (Vector) Type() ValueType { return ValVector } -func (*Scalar) Type() ValueType { return ValScalar } -func (*String) Type() ValueType { return ValString } - -type ValueType int - -const ( - ValNone ValueType = iota - ValScalar - ValVector - ValMatrix - ValString -) - -// MarshalJSON implements json.Marshaler. -func (et ValueType) MarshalJSON() ([]byte, error) { - return json.Marshal(et.String()) -} - -func (et *ValueType) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - switch s { - case "": - *et = ValNone - case "scalar": - *et = ValScalar - case "vector": - *et = ValVector - case "matrix": - *et = ValMatrix - case "string": - *et = ValString - default: - return fmt.Errorf("unknown value type %q", s) - } - return nil -} - -func (e ValueType) String() string { - switch e { - case ValNone: - return "" - case ValScalar: - return "scalar" - case ValVector: - return "vector" - case ValMatrix: - return "matrix" - case ValString: - return "string" - } - panic("ValueType.String: unhandled value type") -} - -// Scalar is a scalar value evaluated at the set timestamp. -type Scalar struct { - Value SampleValue `json:"value"` - Timestamp Time `json:"timestamp"` -} - -func (s Scalar) String() string { - return fmt.Sprintf("scalar: %v @[%v]", s.Value, s.Timestamp) -} - -// MarshalJSON implements json.Marshaler. -func (s Scalar) MarshalJSON() ([]byte, error) { - v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64) - return json.Marshal([...]interface{}{s.Timestamp, string(v)}) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *Scalar) UnmarshalJSON(b []byte) error { - var f string - v := [...]interface{}{&s.Timestamp, &f} - - if err := json.Unmarshal(b, &v); err != nil { - return err - } - - value, err := strconv.ParseFloat(f, 64) - if err != nil { - return fmt.Errorf("error parsing sample value: %s", err) - } - s.Value = SampleValue(value) - return nil -} - -// String is a string value evaluated at the set timestamp. -type String struct { - Value string `json:"value"` - Timestamp Time `json:"timestamp"` -} - -func (s *String) String() string { - return s.Value -} - -// MarshalJSON implements json.Marshaler. -func (s String) MarshalJSON() ([]byte, error) { - return json.Marshal([]interface{}{s.Timestamp, s.Value}) -} - -// UnmarshalJSON implements json.Unmarshaler. -func (s *String) UnmarshalJSON(b []byte) error { - v := [...]interface{}{&s.Timestamp, &s.Value} - return json.Unmarshal(b, &v) -} - -// Vector is basically only an alias for Samples, but the -// contract is that in a Vector, all Samples have the same timestamp. -type Vector []*Sample - -func (vec Vector) String() string { - entries := make([]string, len(vec)) - for i, s := range vec { - entries[i] = s.String() - } - return strings.Join(entries, "\n") -} - -func (vec Vector) Len() int { return len(vec) } -func (vec Vector) Swap(i, j int) { vec[i], vec[j] = vec[j], vec[i] } - -// Less compares first the metrics, then the timestamp. -func (vec Vector) Less(i, j int) bool { - switch { - case vec[i].Metric.Before(vec[j].Metric): - return true - case vec[j].Metric.Before(vec[i].Metric): - return false - case vec[i].Timestamp.Before(vec[j].Timestamp): - return true - default: - return false - } -} - -// Equal compares two sets of samples and returns true if they are equal. -func (vec Vector) Equal(o Vector) bool { - if len(vec) != len(o) { - return false - } - - for i, sample := range vec { - if !sample.Equal(o[i]) { - return false - } - } - return true -} - -// Matrix is a list of time series. -type Matrix []*SampleStream - -func (m Matrix) Len() int { return len(m) } -func (m Matrix) Less(i, j int) bool { return m[i].Metric.Before(m[j].Metric) } -func (m Matrix) Swap(i, j int) { m[i], m[j] = m[j], m[i] } - -func (mat Matrix) String() string { - matCp := make(Matrix, len(mat)) - copy(matCp, mat) - sort.Sort(matCp) - - strs := make([]string, len(matCp)) - - for i, ss := range matCp { - strs[i] = ss.String() - } - - return strings.Join(strs, "\n") -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "encoding/json" + "fmt" + "math" + "sort" + "strconv" + "strings" +) + +var ( + // ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a + // non-existing sample pair. It is a SamplePair with timestamp Earliest and + // value 0.0. Note that the natural zero value of SamplePair has a timestamp + // of 0, which is possible to appear in a real SamplePair and thus not + // suitable to signal a non-existing SamplePair. + ZeroSamplePair = SamplePair{Timestamp: Earliest} + + // ZeroSample is the pseudo zero-value of Sample used to signal a + // non-existing sample. It is a Sample with timestamp Earliest, value 0.0, + // and metric nil. Note that the natural zero value of Sample has a timestamp + // of 0, which is possible to appear in a real Sample and thus not suitable + // to signal a non-existing Sample. + ZeroSample = Sample{Timestamp: Earliest} +) + +// A SampleValue is a representation of a value for a given sample at a given +// time. +type SampleValue float64 + +// MarshalJSON implements json.Marshaler. +func (v SampleValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.String()) +} + +// UnmarshalJSON implements json.Unmarshaler. +func (v *SampleValue) UnmarshalJSON(b []byte) error { + if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' { + return fmt.Errorf("sample value must be a quoted string") + } + f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64) + if err != nil { + return err + } + *v = SampleValue(f) + return nil +} + +// Equal returns true if the value of v and o is equal or if both are NaN. Note +// that v==o is false if both are NaN. If you want the conventional float +// behavior, use == to compare two SampleValues. +func (v SampleValue) Equal(o SampleValue) bool { + if v == o { + return true + } + return math.IsNaN(float64(v)) && math.IsNaN(float64(o)) +} + +func (v SampleValue) String() string { + return strconv.FormatFloat(float64(v), 'f', -1, 64) +} + +// SamplePair pairs a SampleValue with a Timestamp. +type SamplePair struct { + Timestamp Time + Value SampleValue +} + +// MarshalJSON implements json.Marshaler. +func (s SamplePair) MarshalJSON() ([]byte, error) { + t, err := json.Marshal(s.Timestamp) + if err != nil { + return nil, err + } + v, err := json.Marshal(s.Value) + if err != nil { + return nil, err + } + return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (s *SamplePair) UnmarshalJSON(b []byte) error { + v := [...]json.Unmarshaler{&s.Timestamp, &s.Value} + return json.Unmarshal(b, &v) +} + +// Equal returns true if this SamplePair and o have equal Values and equal +// Timestamps. The sematics of Value equality is defined by SampleValue.Equal. +func (s *SamplePair) Equal(o *SamplePair) bool { + return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp)) +} + +func (s SamplePair) String() string { + return fmt.Sprintf("%s @[%s]", s.Value, s.Timestamp) +} + +// Sample is a sample pair associated with a metric. +type Sample struct { + Metric Metric `json:"metric"` + Value SampleValue `json:"value"` + Timestamp Time `json:"timestamp"` +} + +// Equal compares first the metrics, then the timestamp, then the value. The +// sematics of value equality is defined by SampleValue.Equal. +func (s *Sample) Equal(o *Sample) bool { + if s == o { + return true + } + + if !s.Metric.Equal(o.Metric) { + return false + } + if !s.Timestamp.Equal(o.Timestamp) { + return false + } + + return s.Value.Equal(o.Value) +} + +func (s Sample) String() string { + return fmt.Sprintf("%s => %s", s.Metric, SamplePair{ + Timestamp: s.Timestamp, + Value: s.Value, + }) +} + +// MarshalJSON implements json.Marshaler. +func (s Sample) MarshalJSON() ([]byte, error) { + v := struct { + Metric Metric `json:"metric"` + Value SamplePair `json:"value"` + }{ + Metric: s.Metric, + Value: SamplePair{ + Timestamp: s.Timestamp, + Value: s.Value, + }, + } + + return json.Marshal(&v) +} + +// UnmarshalJSON implements json.Unmarshaler. +func (s *Sample) UnmarshalJSON(b []byte) error { + v := struct { + Metric Metric `json:"metric"` + Value SamplePair `json:"value"` + }{ + Metric: s.Metric, + Value: SamplePair{ + Timestamp: s.Timestamp, + Value: s.Value, + }, + } + + if err := json.Unmarshal(b, &v); err != nil { + return err + } + + s.Metric = v.Metric + s.Timestamp = v.Value.Timestamp + s.Value = v.Value.Value + + return nil +} + +// Samples is a sortable Sample slice. It implements sort.Interface. +type Samples []*Sample + +func (s Samples) Len() int { + return len(s) +} + +// Less compares first the metrics, then the timestamp. +func (s Samples) Less(i, j int) bool { + switch { + case s[i].Metric.Before(s[j].Metric): + return true + case s[j].Metric.Before(s[i].Metric): + return false + case s[i].Timestamp.Before(s[j].Timestamp): + return true + default: + return false + } +} + +func (s Samples) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +// Equal compares two sets of samples and returns true if they are equal. +func (s Samples) Equal(o Samples) bool { + if len(s) != len(o) { + return false + } + + for i, sample := range s { + if !sample.Equal(o[i]) { + return false + } + } + return true +} + +// SampleStream is a stream of Values belonging to an attached COWMetric. +type SampleStream struct { + Metric Metric `json:"metric"` + Values []SamplePair `json:"values"` +} + +func (ss SampleStream) String() string { + vals := make([]string, len(ss.Values)) + for i, v := range ss.Values { + vals[i] = v.String() + } + return fmt.Sprintf("%s =>\n%s", ss.Metric, strings.Join(vals, "\n")) +} + +// Value is a generic interface for values resulting from a query evaluation. +type Value interface { + Type() ValueType + String() string +} + +func (Matrix) Type() ValueType { return ValMatrix } +func (Vector) Type() ValueType { return ValVector } +func (*Scalar) Type() ValueType { return ValScalar } +func (*String) Type() ValueType { return ValString } + +type ValueType int + +const ( + ValNone ValueType = iota + ValScalar + ValVector + ValMatrix + ValString +) + +// MarshalJSON implements json.Marshaler. +func (et ValueType) MarshalJSON() ([]byte, error) { + return json.Marshal(et.String()) +} + +func (et *ValueType) UnmarshalJSON(b []byte) error { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + switch s { + case "": + *et = ValNone + case "scalar": + *et = ValScalar + case "vector": + *et = ValVector + case "matrix": + *et = ValMatrix + case "string": + *et = ValString + default: + return fmt.Errorf("unknown value type %q", s) + } + return nil +} + +func (e ValueType) String() string { + switch e { + case ValNone: + return "" + case ValScalar: + return "scalar" + case ValVector: + return "vector" + case ValMatrix: + return "matrix" + case ValString: + return "string" + } + panic("ValueType.String: unhandled value type") +} + +// Scalar is a scalar value evaluated at the set timestamp. +type Scalar struct { + Value SampleValue `json:"value"` + Timestamp Time `json:"timestamp"` +} + +func (s Scalar) String() string { + return fmt.Sprintf("scalar: %v @[%v]", s.Value, s.Timestamp) +} + +// MarshalJSON implements json.Marshaler. +func (s Scalar) MarshalJSON() ([]byte, error) { + v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64) + return json.Marshal([...]interface{}{s.Timestamp, string(v)}) +} + +// UnmarshalJSON implements json.Unmarshaler. +func (s *Scalar) UnmarshalJSON(b []byte) error { + var f string + v := [...]interface{}{&s.Timestamp, &f} + + if err := json.Unmarshal(b, &v); err != nil { + return err + } + + value, err := strconv.ParseFloat(f, 64) + if err != nil { + return fmt.Errorf("error parsing sample value: %s", err) + } + s.Value = SampleValue(value) + return nil +} + +// String is a string value evaluated at the set timestamp. +type String struct { + Value string `json:"value"` + Timestamp Time `json:"timestamp"` +} + +func (s *String) String() string { + return s.Value +} + +// MarshalJSON implements json.Marshaler. +func (s String) MarshalJSON() ([]byte, error) { + return json.Marshal([]interface{}{s.Timestamp, s.Value}) +} + +// UnmarshalJSON implements json.Unmarshaler. +func (s *String) UnmarshalJSON(b []byte) error { + v := [...]interface{}{&s.Timestamp, &s.Value} + return json.Unmarshal(b, &v) +} + +// Vector is basically only an alias for Samples, but the +// contract is that in a Vector, all Samples have the same timestamp. +type Vector []*Sample + +func (vec Vector) String() string { + entries := make([]string, len(vec)) + for i, s := range vec { + entries[i] = s.String() + } + return strings.Join(entries, "\n") +} + +func (vec Vector) Len() int { return len(vec) } +func (vec Vector) Swap(i, j int) { vec[i], vec[j] = vec[j], vec[i] } + +// Less compares first the metrics, then the timestamp. +func (vec Vector) Less(i, j int) bool { + switch { + case vec[i].Metric.Before(vec[j].Metric): + return true + case vec[j].Metric.Before(vec[i].Metric): + return false + case vec[i].Timestamp.Before(vec[j].Timestamp): + return true + default: + return false + } +} + +// Equal compares two sets of samples and returns true if they are equal. +func (vec Vector) Equal(o Vector) bool { + if len(vec) != len(o) { + return false + } + + for i, sample := range vec { + if !sample.Equal(o[i]) { + return false + } + } + return true +} + +// Matrix is a list of time series. +type Matrix []*SampleStream + +func (m Matrix) Len() int { return len(m) } +func (m Matrix) Less(i, j int) bool { return m[i].Metric.Before(m[j].Metric) } +func (m Matrix) Swap(i, j int) { m[i], m[j] = m[j], m[i] } + +func (mat Matrix) String() string { + matCp := make(Matrix, len(mat)) + copy(matCp, mat) + sort.Sort(matCp) + + strs := make([]string, len(matCp)) + + for i, ss := range matCp { + strs[i] = ss.String() + } + + return strings.Join(strs, "\n") +} diff --git a/vendor/github.com/prometheus/common/model/value_test.go b/vendor/github.com/prometheus/common/model/value_test.go index 37433fbb45..b97dcf84cf 100644 --- a/vendor/github.com/prometheus/common/model/value_test.go +++ b/vendor/github.com/prometheus/common/model/value_test.go @@ -1,468 +1,468 @@ -// Copyright 2013 The Prometheus Authors -// 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 model - -import ( - "encoding/json" - "math" - "reflect" - "sort" - "testing" -) - -func TestEqualValues(t *testing.T) { - tests := map[string]struct { - in1, in2 SampleValue - want bool - }{ - "equal floats": { - in1: 3.14, - in2: 3.14, - want: true, - }, - "unequal floats": { - in1: 3.14, - in2: 3.1415, - want: false, - }, - "positive inifinities": { - in1: SampleValue(math.Inf(+1)), - in2: SampleValue(math.Inf(+1)), - want: true, - }, - "negative inifinities": { - in1: SampleValue(math.Inf(-1)), - in2: SampleValue(math.Inf(-1)), - want: true, - }, - "different inifinities": { - in1: SampleValue(math.Inf(+1)), - in2: SampleValue(math.Inf(-1)), - want: false, - }, - "number and infinity": { - in1: 42, - in2: SampleValue(math.Inf(+1)), - want: false, - }, - "number and NaN": { - in1: 42, - in2: SampleValue(math.NaN()), - want: false, - }, - "NaNs": { - in1: SampleValue(math.NaN()), - in2: SampleValue(math.NaN()), - want: true, // !!! - }, - } - - for name, test := range tests { - got := test.in1.Equal(test.in2) - if got != test.want { - t.Errorf("Comparing %s, %f and %f: got %t, want %t", name, test.in1, test.in2, got, test.want) - } - } -} - -func TestEqualSamples(t *testing.T) { - testSample := &Sample{} - - tests := map[string]struct { - in1, in2 *Sample - want bool - }{ - "equal pointers": { - in1: testSample, - in2: testSample, - want: true, - }, - "different metrics": { - in1: &Sample{Metric: Metric{"foo": "bar"}}, - in2: &Sample{Metric: Metric{"foo": "biz"}}, - want: false, - }, - "different timestamp": { - in1: &Sample{Timestamp: 0}, - in2: &Sample{Timestamp: 1}, - want: false, - }, - "different value": { - in1: &Sample{Value: 0}, - in2: &Sample{Value: 1}, - want: false, - }, - "equal samples": { - in1: &Sample{ - Metric: Metric{"foo": "bar"}, - Timestamp: 0, - Value: 1, - }, - in2: &Sample{ - Metric: Metric{"foo": "bar"}, - Timestamp: 0, - Value: 1, - }, - want: true, - }, - } - - for name, test := range tests { - got := test.in1.Equal(test.in2) - if got != test.want { - t.Errorf("Comparing %s, %v and %v: got %t, want %t", name, test.in1, test.in2, got, test.want) - } - } - -} - -func TestSamplePairJSON(t *testing.T) { - input := []struct { - plain string - value SamplePair - }{ - { - plain: `[1234.567,"123.1"]`, - value: SamplePair{ - Value: 123.1, - Timestamp: 1234567, - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sp SamplePair - err = json.Unmarshal(b, &sp) - if err != nil { - t.Error(err) - continue - } - - if sp != test.value { - t.Errorf("decoding error: expected %v, got %v", test.value, sp) - } - } -} - -func TestSampleJSON(t *testing.T) { - input := []struct { - plain string - value Sample - }{ - { - plain: `{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}`, - value: Sample{ - Metric: Metric{ - MetricNameLabel: "test_metric", - }, - Value: 123.1, - Timestamp: 1234567, - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sv Sample - err = json.Unmarshal(b, &sv) - if err != nil { - t.Error(err) - continue - } - - if !reflect.DeepEqual(sv, test.value) { - t.Errorf("decoding error: expected %v, got %v", test.value, sv) - } - } -} - -func TestVectorJSON(t *testing.T) { - input := []struct { - plain string - value Vector - }{ - { - plain: `[]`, - value: Vector{}, - }, - { - plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}]`, - value: Vector{&Sample{ - Metric: Metric{ - MetricNameLabel: "test_metric", - }, - Value: 123.1, - Timestamp: 1234567, - }}, - }, - { - plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]},{"metric":{"foo":"bar"},"value":[1.234,"+Inf"]}]`, - value: Vector{ - &Sample{ - Metric: Metric{ - MetricNameLabel: "test_metric", - }, - Value: 123.1, - Timestamp: 1234567, - }, - &Sample{ - Metric: Metric{ - "foo": "bar", - }, - Value: SampleValue(math.Inf(1)), - Timestamp: 1234, - }, - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var vec Vector - err = json.Unmarshal(b, &vec) - if err != nil { - t.Error(err) - continue - } - - if !reflect.DeepEqual(vec, test.value) { - t.Errorf("decoding error: expected %v, got %v", test.value, vec) - } - } -} - -func TestScalarJSON(t *testing.T) { - input := []struct { - plain string - value Scalar - }{ - { - plain: `[123.456,"456"]`, - value: Scalar{ - Timestamp: 123456, - Value: 456, - }, - }, - { - plain: `[123123.456,"+Inf"]`, - value: Scalar{ - Timestamp: 123123456, - Value: SampleValue(math.Inf(1)), - }, - }, - { - plain: `[123123.456,"-Inf"]`, - value: Scalar{ - Timestamp: 123123456, - Value: SampleValue(math.Inf(-1)), - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sv Scalar - err = json.Unmarshal(b, &sv) - if err != nil { - t.Error(err) - continue - } - - if sv != test.value { - t.Errorf("decoding error: expected %v, got %v", test.value, sv) - } - } -} - -func TestStringJSON(t *testing.T) { - input := []struct { - plain string - value String - }{ - { - plain: `[123.456,"test"]`, - value: String{ - Timestamp: 123456, - Value: "test", - }, - }, - { - plain: `[123123.456,"台北"]`, - value: String{ - Timestamp: 123123456, - Value: "台北", - }, - }, - } - - for _, test := range input { - b, err := json.Marshal(test.value) - if err != nil { - t.Error(err) - continue - } - - if string(b) != test.plain { - t.Errorf("encoding error: expected %q, got %q", test.plain, b) - continue - } - - var sv String - err = json.Unmarshal(b, &sv) - if err != nil { - t.Error(err) - continue - } - - if sv != test.value { - t.Errorf("decoding error: expected %v, got %v", test.value, sv) - } - } -} - -func TestVectorSort(t *testing.T) { - input := Vector{ - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 2, - }, - } - - expected := Vector{ - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "A", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "B", - }, - Timestamp: 2, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 1, - }, - &Sample{ - Metric: Metric{ - MetricNameLabel: "C", - }, - Timestamp: 2, - }, - } - - sort.Sort(input) - - for i, actual := range input { - actualFp := actual.Metric.Fingerprint() - expectedFp := expected[i].Metric.Fingerprint() - - if actualFp != expectedFp { - t.Fatalf("%d. Incorrect fingerprint. Got %s; want %s", i, actualFp.String(), expectedFp.String()) - } - - if actual.Timestamp != expected[i].Timestamp { - t.Fatalf("%d. Incorrect timestamp. Got %s; want %s", i, actual.Timestamp, expected[i].Timestamp) - } - } -} +// Copyright 2013 The Prometheus Authors +// 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 model + +import ( + "encoding/json" + "math" + "reflect" + "sort" + "testing" +) + +func TestEqualValues(t *testing.T) { + tests := map[string]struct { + in1, in2 SampleValue + want bool + }{ + "equal floats": { + in1: 3.14, + in2: 3.14, + want: true, + }, + "unequal floats": { + in1: 3.14, + in2: 3.1415, + want: false, + }, + "positive inifinities": { + in1: SampleValue(math.Inf(+1)), + in2: SampleValue(math.Inf(+1)), + want: true, + }, + "negative inifinities": { + in1: SampleValue(math.Inf(-1)), + in2: SampleValue(math.Inf(-1)), + want: true, + }, + "different inifinities": { + in1: SampleValue(math.Inf(+1)), + in2: SampleValue(math.Inf(-1)), + want: false, + }, + "number and infinity": { + in1: 42, + in2: SampleValue(math.Inf(+1)), + want: false, + }, + "number and NaN": { + in1: 42, + in2: SampleValue(math.NaN()), + want: false, + }, + "NaNs": { + in1: SampleValue(math.NaN()), + in2: SampleValue(math.NaN()), + want: true, // !!! + }, + } + + for name, test := range tests { + got := test.in1.Equal(test.in2) + if got != test.want { + t.Errorf("Comparing %s, %f and %f: got %t, want %t", name, test.in1, test.in2, got, test.want) + } + } +} + +func TestEqualSamples(t *testing.T) { + testSample := &Sample{} + + tests := map[string]struct { + in1, in2 *Sample + want bool + }{ + "equal pointers": { + in1: testSample, + in2: testSample, + want: true, + }, + "different metrics": { + in1: &Sample{Metric: Metric{"foo": "bar"}}, + in2: &Sample{Metric: Metric{"foo": "biz"}}, + want: false, + }, + "different timestamp": { + in1: &Sample{Timestamp: 0}, + in2: &Sample{Timestamp: 1}, + want: false, + }, + "different value": { + in1: &Sample{Value: 0}, + in2: &Sample{Value: 1}, + want: false, + }, + "equal samples": { + in1: &Sample{ + Metric: Metric{"foo": "bar"}, + Timestamp: 0, + Value: 1, + }, + in2: &Sample{ + Metric: Metric{"foo": "bar"}, + Timestamp: 0, + Value: 1, + }, + want: true, + }, + } + + for name, test := range tests { + got := test.in1.Equal(test.in2) + if got != test.want { + t.Errorf("Comparing %s, %v and %v: got %t, want %t", name, test.in1, test.in2, got, test.want) + } + } + +} + +func TestSamplePairJSON(t *testing.T) { + input := []struct { + plain string + value SamplePair + }{ + { + plain: `[1234.567,"123.1"]`, + value: SamplePair{ + Value: 123.1, + Timestamp: 1234567, + }, + }, + } + + for _, test := range input { + b, err := json.Marshal(test.value) + if err != nil { + t.Error(err) + continue + } + + if string(b) != test.plain { + t.Errorf("encoding error: expected %q, got %q", test.plain, b) + continue + } + + var sp SamplePair + err = json.Unmarshal(b, &sp) + if err != nil { + t.Error(err) + continue + } + + if sp != test.value { + t.Errorf("decoding error: expected %v, got %v", test.value, sp) + } + } +} + +func TestSampleJSON(t *testing.T) { + input := []struct { + plain string + value Sample + }{ + { + plain: `{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}`, + value: Sample{ + Metric: Metric{ + MetricNameLabel: "test_metric", + }, + Value: 123.1, + Timestamp: 1234567, + }, + }, + } + + for _, test := range input { + b, err := json.Marshal(test.value) + if err != nil { + t.Error(err) + continue + } + + if string(b) != test.plain { + t.Errorf("encoding error: expected %q, got %q", test.plain, b) + continue + } + + var sv Sample + err = json.Unmarshal(b, &sv) + if err != nil { + t.Error(err) + continue + } + + if !reflect.DeepEqual(sv, test.value) { + t.Errorf("decoding error: expected %v, got %v", test.value, sv) + } + } +} + +func TestVectorJSON(t *testing.T) { + input := []struct { + plain string + value Vector + }{ + { + plain: `[]`, + value: Vector{}, + }, + { + plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]}]`, + value: Vector{&Sample{ + Metric: Metric{ + MetricNameLabel: "test_metric", + }, + Value: 123.1, + Timestamp: 1234567, + }}, + }, + { + plain: `[{"metric":{"__name__":"test_metric"},"value":[1234.567,"123.1"]},{"metric":{"foo":"bar"},"value":[1.234,"+Inf"]}]`, + value: Vector{ + &Sample{ + Metric: Metric{ + MetricNameLabel: "test_metric", + }, + Value: 123.1, + Timestamp: 1234567, + }, + &Sample{ + Metric: Metric{ + "foo": "bar", + }, + Value: SampleValue(math.Inf(1)), + Timestamp: 1234, + }, + }, + }, + } + + for _, test := range input { + b, err := json.Marshal(test.value) + if err != nil { + t.Error(err) + continue + } + + if string(b) != test.plain { + t.Errorf("encoding error: expected %q, got %q", test.plain, b) + continue + } + + var vec Vector + err = json.Unmarshal(b, &vec) + if err != nil { + t.Error(err) + continue + } + + if !reflect.DeepEqual(vec, test.value) { + t.Errorf("decoding error: expected %v, got %v", test.value, vec) + } + } +} + +func TestScalarJSON(t *testing.T) { + input := []struct { + plain string + value Scalar + }{ + { + plain: `[123.456,"456"]`, + value: Scalar{ + Timestamp: 123456, + Value: 456, + }, + }, + { + plain: `[123123.456,"+Inf"]`, + value: Scalar{ + Timestamp: 123123456, + Value: SampleValue(math.Inf(1)), + }, + }, + { + plain: `[123123.456,"-Inf"]`, + value: Scalar{ + Timestamp: 123123456, + Value: SampleValue(math.Inf(-1)), + }, + }, + } + + for _, test := range input { + b, err := json.Marshal(test.value) + if err != nil { + t.Error(err) + continue + } + + if string(b) != test.plain { + t.Errorf("encoding error: expected %q, got %q", test.plain, b) + continue + } + + var sv Scalar + err = json.Unmarshal(b, &sv) + if err != nil { + t.Error(err) + continue + } + + if sv != test.value { + t.Errorf("decoding error: expected %v, got %v", test.value, sv) + } + } +} + +func TestStringJSON(t *testing.T) { + input := []struct { + plain string + value String + }{ + { + plain: `[123.456,"test"]`, + value: String{ + Timestamp: 123456, + Value: "test", + }, + }, + { + plain: `[123123.456,"台北"]`, + value: String{ + Timestamp: 123123456, + Value: "台北", + }, + }, + } + + for _, test := range input { + b, err := json.Marshal(test.value) + if err != nil { + t.Error(err) + continue + } + + if string(b) != test.plain { + t.Errorf("encoding error: expected %q, got %q", test.plain, b) + continue + } + + var sv String + err = json.Unmarshal(b, &sv) + if err != nil { + t.Error(err) + continue + } + + if sv != test.value { + t.Errorf("decoding error: expected %v, got %v", test.value, sv) + } + } +} + +func TestVectorSort(t *testing.T) { + input := Vector{ + &Sample{ + Metric: Metric{ + MetricNameLabel: "A", + }, + Timestamp: 1, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "A", + }, + Timestamp: 2, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "C", + }, + Timestamp: 1, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "C", + }, + Timestamp: 2, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "B", + }, + Timestamp: 1, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "B", + }, + Timestamp: 2, + }, + } + + expected := Vector{ + &Sample{ + Metric: Metric{ + MetricNameLabel: "A", + }, + Timestamp: 1, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "A", + }, + Timestamp: 2, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "B", + }, + Timestamp: 1, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "B", + }, + Timestamp: 2, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "C", + }, + Timestamp: 1, + }, + &Sample{ + Metric: Metric{ + MetricNameLabel: "C", + }, + Timestamp: 2, + }, + } + + sort.Sort(input) + + for i, actual := range input { + actualFp := actual.Metric.Fingerprint() + expectedFp := expected[i].Metric.Fingerprint() + + if actualFp != expectedFp { + t.Fatalf("%d. Incorrect fingerprint. Got %s; want %s", i, actualFp.String(), expectedFp.String()) + } + + if actual.Timestamp != expected[i].Timestamp { + t.Fatalf("%d. Incorrect timestamp. Got %s; want %s", i, actual.Timestamp, expected[i].Timestamp) + } + } +} diff --git a/vendor/github.com/prometheus/common/route/route.go b/vendor/github.com/prometheus/common/route/route.go index 6c73f0cb8b..bb46881736 100644 --- a/vendor/github.com/prometheus/common/route/route.go +++ b/vendor/github.com/prometheus/common/route/route.go @@ -1,100 +1,100 @@ -package route - -import ( - "net/http" - - "github.com/julienschmidt/httprouter" - "golang.org/x/net/context" -) - -type param string - -// Param returns param p for the context. -func Param(ctx context.Context, p string) string { - return ctx.Value(param(p)).(string) -} - -// WithParam returns a new context with param p set to v. -func WithParam(ctx context.Context, p, v string) context.Context { - return context.WithValue(ctx, param(p), v) -} - -// Router wraps httprouter.Router and adds support for prefixed sub-routers -// and per-request context injections. -type Router struct { - rtr *httprouter.Router - prefix string -} - -// New returns a new Router. -func New() *Router { - return &Router{ - rtr: httprouter.New(), - } -} - -// WithPrefix returns a router that prefixes all registered routes with prefix. -func (r *Router) WithPrefix(prefix string) *Router { - return &Router{rtr: r.rtr, prefix: r.prefix + prefix} -} - -// handle turns a HandlerFunc into an httprouter.Handle. -func (r *Router) handle(h http.HandlerFunc) httprouter.Handle { - return func(w http.ResponseWriter, req *http.Request, params httprouter.Params) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - - for _, p := range params { - ctx = context.WithValue(ctx, param(p.Key), p.Value) - } - h(w, req.WithContext(ctx)) - } -} - -// Get registers a new GET route. -func (r *Router) Get(path string, h http.HandlerFunc) { - r.rtr.GET(r.prefix+path, r.handle(h)) -} - -// Options registers a new OPTIONS route. -func (r *Router) Options(path string, h http.HandlerFunc) { - r.rtr.OPTIONS(r.prefix+path, r.handle(h)) -} - -// Del registers a new DELETE route. -func (r *Router) Del(path string, h http.HandlerFunc) { - r.rtr.DELETE(r.prefix+path, r.handle(h)) -} - -// Put registers a new PUT route. -func (r *Router) Put(path string, h http.HandlerFunc) { - r.rtr.PUT(r.prefix+path, r.handle(h)) -} - -// Post registers a new POST route. -func (r *Router) Post(path string, h http.HandlerFunc) { - r.rtr.POST(r.prefix+path, r.handle(h)) -} - -// Redirect takes an absolute path and sends an internal HTTP redirect for it, -// prefixed by the router's path prefix. Note that this method does not include -// functionality for handling relative paths or full URL redirects. -func (r *Router) Redirect(w http.ResponseWriter, req *http.Request, path string, code int) { - http.Redirect(w, req, r.prefix+path, code) -} - -// ServeHTTP implements http.Handler. -func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { - r.rtr.ServeHTTP(w, req) -} - -// FileServe returns a new http.HandlerFunc that serves files from dir. -// Using routes must provide the *filepath parameter. -func FileServe(dir string) http.HandlerFunc { - fs := http.FileServer(http.Dir(dir)) - - return func(w http.ResponseWriter, r *http.Request) { - r.URL.Path = Param(r.Context(), "filepath") - fs.ServeHTTP(w, r) - } -} +package route + +import ( + "net/http" + + "github.com/julienschmidt/httprouter" + "golang.org/x/net/context" +) + +type param string + +// Param returns param p for the context. +func Param(ctx context.Context, p string) string { + return ctx.Value(param(p)).(string) +} + +// WithParam returns a new context with param p set to v. +func WithParam(ctx context.Context, p, v string) context.Context { + return context.WithValue(ctx, param(p), v) +} + +// Router wraps httprouter.Router and adds support for prefixed sub-routers +// and per-request context injections. +type Router struct { + rtr *httprouter.Router + prefix string +} + +// New returns a new Router. +func New() *Router { + return &Router{ + rtr: httprouter.New(), + } +} + +// WithPrefix returns a router that prefixes all registered routes with prefix. +func (r *Router) WithPrefix(prefix string) *Router { + return &Router{rtr: r.rtr, prefix: r.prefix + prefix} +} + +// handle turns a HandlerFunc into an httprouter.Handle. +func (r *Router) handle(h http.HandlerFunc) httprouter.Handle { + return func(w http.ResponseWriter, req *http.Request, params httprouter.Params) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + + for _, p := range params { + ctx = context.WithValue(ctx, param(p.Key), p.Value) + } + h(w, req.WithContext(ctx)) + } +} + +// Get registers a new GET route. +func (r *Router) Get(path string, h http.HandlerFunc) { + r.rtr.GET(r.prefix+path, r.handle(h)) +} + +// Options registers a new OPTIONS route. +func (r *Router) Options(path string, h http.HandlerFunc) { + r.rtr.OPTIONS(r.prefix+path, r.handle(h)) +} + +// Del registers a new DELETE route. +func (r *Router) Del(path string, h http.HandlerFunc) { + r.rtr.DELETE(r.prefix+path, r.handle(h)) +} + +// Put registers a new PUT route. +func (r *Router) Put(path string, h http.HandlerFunc) { + r.rtr.PUT(r.prefix+path, r.handle(h)) +} + +// Post registers a new POST route. +func (r *Router) Post(path string, h http.HandlerFunc) { + r.rtr.POST(r.prefix+path, r.handle(h)) +} + +// Redirect takes an absolute path and sends an internal HTTP redirect for it, +// prefixed by the router's path prefix. Note that this method does not include +// functionality for handling relative paths or full URL redirects. +func (r *Router) Redirect(w http.ResponseWriter, req *http.Request, path string, code int) { + http.Redirect(w, req, r.prefix+path, code) +} + +// ServeHTTP implements http.Handler. +func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { + r.rtr.ServeHTTP(w, req) +} + +// FileServe returns a new http.HandlerFunc that serves files from dir. +// Using routes must provide the *filepath parameter. +func FileServe(dir string) http.HandlerFunc { + fs := http.FileServer(http.Dir(dir)) + + return func(w http.ResponseWriter, r *http.Request) { + r.URL.Path = Param(r.Context(), "filepath") + fs.ServeHTTP(w, r) + } +} diff --git a/vendor/github.com/prometheus/common/route/route_test.go b/vendor/github.com/prometheus/common/route/route_test.go index b36d8e0a5e..a9bb209964 100644 --- a/vendor/github.com/prometheus/common/route/route_test.go +++ b/vendor/github.com/prometheus/common/route/route_test.go @@ -1,44 +1,44 @@ -package route - -import ( - "net/http" - "net/http/httptest" - "testing" -) - -func TestRedirect(t *testing.T) { - router := New().WithPrefix("/test/prefix") - w := httptest.NewRecorder() - r, err := http.NewRequest("GET", "http://localhost:9090/foo", nil) - if err != nil { - t.Fatalf("Error building test request: %s", err) - } - - router.Redirect(w, r, "/some/endpoint", http.StatusFound) - if w.Code != http.StatusFound { - t.Fatalf("Unexpected redirect status code: got %d, want %d", w.Code, http.StatusFound) - } - - want := "/test/prefix/some/endpoint" - got := w.Header()["Location"][0] - if want != got { - t.Fatalf("Unexpected redirect location: got %s, want %s", got, want) - } -} - -func TestContext(t *testing.T) { - router := New() - router.Get("/test/:foo/", func(w http.ResponseWriter, r *http.Request) { - want := "bar" - got := Param(r.Context(), "foo") - if want != got { - t.Fatalf("Unexpected context value: want %q, got %q", want, got) - } - }) - - r, err := http.NewRequest("GET", "http://localhost:9090/test/bar/", nil) - if err != nil { - t.Fatalf("Error building test request: %s", err) - } - router.ServeHTTP(nil, r) -} +package route + +import ( + "net/http" + "net/http/httptest" + "testing" +) + +func TestRedirect(t *testing.T) { + router := New().WithPrefix("/test/prefix") + w := httptest.NewRecorder() + r, err := http.NewRequest("GET", "http://localhost:9090/foo", nil) + if err != nil { + t.Fatalf("Error building test request: %s", err) + } + + router.Redirect(w, r, "/some/endpoint", http.StatusFound) + if w.Code != http.StatusFound { + t.Fatalf("Unexpected redirect status code: got %d, want %d", w.Code, http.StatusFound) + } + + want := "/test/prefix/some/endpoint" + got := w.Header()["Location"][0] + if want != got { + t.Fatalf("Unexpected redirect location: got %s, want %s", got, want) + } +} + +func TestContext(t *testing.T) { + router := New() + router.Get("/test/:foo/", func(w http.ResponseWriter, r *http.Request) { + want := "bar" + got := Param(r.Context(), "foo") + if want != got { + t.Fatalf("Unexpected context value: want %q, got %q", want, got) + } + }) + + r, err := http.NewRequest("GET", "http://localhost:9090/test/bar/", nil) + if err != nil { + t.Fatalf("Error building test request: %s", err) + } + router.ServeHTTP(nil, r) +} diff --git a/vendor/github.com/prometheus/common/version/info.go b/vendor/github.com/prometheus/common/version/info.go index 6f66655655..84489a5104 100644 --- a/vendor/github.com/prometheus/common/version/info.go +++ b/vendor/github.com/prometheus/common/version/info.go @@ -1,89 +1,89 @@ -// Copyright 2016 The Prometheus Authors -// 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 version - -import ( - "bytes" - "fmt" - "runtime" - "strings" - "text/template" - - "github.com/prometheus/client_golang/prometheus" -) - -// Build information. Populated at build-time. -var ( - Version string - Revision string - Branch string - BuildUser string - BuildDate string - GoVersion = runtime.Version() -) - -// NewCollector returns a collector which exports metrics about current version information. -func NewCollector(program string) *prometheus.GaugeVec { - buildInfo := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: program, - Name: "build_info", - Help: fmt.Sprintf( - "A metric with a constant '1' value labeled by version, revision, branch, and goversion from which %s was built.", - program, - ), - }, - []string{"version", "revision", "branch", "goversion"}, - ) - buildInfo.WithLabelValues(Version, Revision, Branch, GoVersion).Set(1) - return buildInfo -} - -// versionInfoTmpl contains the template used by Info. -var versionInfoTmpl = ` -{{.program}}, version {{.version}} (branch: {{.branch}}, revision: {{.revision}}) - build user: {{.buildUser}} - build date: {{.buildDate}} - go version: {{.goVersion}} -` - -// Print returns version information. -func Print(program string) string { - m := map[string]string{ - "program": program, - "version": Version, - "revision": Revision, - "branch": Branch, - "buildUser": BuildUser, - "buildDate": BuildDate, - "goVersion": GoVersion, - } - t := template.Must(template.New("version").Parse(versionInfoTmpl)) - - var buf bytes.Buffer - if err := t.ExecuteTemplate(&buf, "version", m); err != nil { - panic(err) - } - return strings.TrimSpace(buf.String()) -} - -// Info returns version, branch and revision information. -func Info() string { - return fmt.Sprintf("(version=%s, branch=%s, revision=%s)", Version, Branch, Revision) -} - -// BuildContext returns goVersion, buildUser and buildDate information. -func BuildContext() string { - return fmt.Sprintf("(go=%s, user=%s, date=%s)", GoVersion, BuildUser, BuildDate) -} +// Copyright 2016 The Prometheus Authors +// 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 version + +import ( + "bytes" + "fmt" + "runtime" + "strings" + "text/template" + + "github.com/prometheus/client_golang/prometheus" +) + +// Build information. Populated at build-time. +var ( + Version string + Revision string + Branch string + BuildUser string + BuildDate string + GoVersion = runtime.Version() +) + +// NewCollector returns a collector which exports metrics about current version information. +func NewCollector(program string) *prometheus.GaugeVec { + buildInfo := prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: program, + Name: "build_info", + Help: fmt.Sprintf( + "A metric with a constant '1' value labeled by version, revision, branch, and goversion from which %s was built.", + program, + ), + }, + []string{"version", "revision", "branch", "goversion"}, + ) + buildInfo.WithLabelValues(Version, Revision, Branch, GoVersion).Set(1) + return buildInfo +} + +// versionInfoTmpl contains the template used by Info. +var versionInfoTmpl = ` +{{.program}}, version {{.version}} (branch: {{.branch}}, revision: {{.revision}}) + build user: {{.buildUser}} + build date: {{.buildDate}} + go version: {{.goVersion}} +` + +// Print returns version information. +func Print(program string) string { + m := map[string]string{ + "program": program, + "version": Version, + "revision": Revision, + "branch": Branch, + "buildUser": BuildUser, + "buildDate": BuildDate, + "goVersion": GoVersion, + } + t := template.Must(template.New("version").Parse(versionInfoTmpl)) + + var buf bytes.Buffer + if err := t.ExecuteTemplate(&buf, "version", m); err != nil { + panic(err) + } + return strings.TrimSpace(buf.String()) +} + +// Info returns version, branch and revision information. +func Info() string { + return fmt.Sprintf("(version=%s, branch=%s, revision=%s)", Version, Branch, Revision) +} + +// BuildContext returns goVersion, buildUser and buildDate information. +func BuildContext() string { + return fmt.Sprintf("(go=%s, user=%s, date=%s)", GoVersion, BuildUser, BuildDate) +} diff --git a/vendor/github.com/satori/go.uuid/.travis.yml b/vendor/github.com/satori/go.uuid/.travis.yml index fb20e5282a..38517e2ed9 100644 --- a/vendor/github.com/satori/go.uuid/.travis.yml +++ b/vendor/github.com/satori/go.uuid/.travis.yml @@ -1,15 +1,15 @@ -language: go -sudo: false -go: - - 1.2 - - 1.3 - - 1.4 - - 1.5 - - 1.6 -before_install: - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover -script: - - $HOME/gopath/bin/goveralls -service=travis-ci -notifications: - email: false +language: go +sudo: false +go: + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 1.6 +before_install: + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover +script: + - $HOME/gopath/bin/goveralls -service=travis-ci +notifications: + email: false diff --git a/vendor/github.com/satori/go.uuid/LICENSE b/vendor/github.com/satori/go.uuid/LICENSE index 1113670624..488357b8af 100644 --- a/vendor/github.com/satori/go.uuid/LICENSE +++ b/vendor/github.com/satori/go.uuid/LICENSE @@ -1,20 +1,20 @@ -Copyright (C) 2013-2016 by Maxim Bublis - -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) 2013-2016 by Maxim Bublis + +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/satori/go.uuid/README.md b/vendor/github.com/satori/go.uuid/README.md index 43682e4db4..b6aad1c813 100644 --- a/vendor/github.com/satori/go.uuid/README.md +++ b/vendor/github.com/satori/go.uuid/README.md @@ -1,65 +1,65 @@ -# UUID package for Go language - -[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) -[![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) -[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) - -This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. - -With 100% test coverage and benchmarks out of box. - -Supported versions: -* Version 1, based on timestamp and MAC address (RFC 4122) -* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) -* Version 3, based on MD5 hashing (RFC 4122) -* Version 4, based on random numbers (RFC 4122) -* Version 5, based on SHA-1 hashing (RFC 4122) - -## Installation - -Use the `go` command: - - $ go get github.com/satori/go.uuid - -## Requirements - -UUID package requires Go >= 1.2. - -## Example - -```go -package main - -import ( - "fmt" - "github.com/satori/go.uuid" -) - -func main() { - // Creating UUID Version 4 - u1 := uuid.NewV4() - fmt.Printf("UUIDv4: %s\n", u1) - - // Parsing UUID from string input - u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - fmt.Printf("Something gone wrong: %s", err) - } - fmt.Printf("Successfully parsed: %s", u2) -} -``` - -## Documentation - -[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. - -## Links -* [RFC 4122](http://tools.ietf.org/html/rfc4122) -* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) - -## Copyright - -Copyright (C) 2013-2016 by Maxim Bublis . - -UUID package released under MIT License. -See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. +# UUID package for Go language + +[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) +[![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) +[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) + +This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. + +With 100% test coverage and benchmarks out of box. + +Supported versions: +* Version 1, based on timestamp and MAC address (RFC 4122) +* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) +* Version 3, based on MD5 hashing (RFC 4122) +* Version 4, based on random numbers (RFC 4122) +* Version 5, based on SHA-1 hashing (RFC 4122) + +## Installation + +Use the `go` command: + + $ go get github.com/satori/go.uuid + +## Requirements + +UUID package requires Go >= 1.2. + +## Example + +```go +package main + +import ( + "fmt" + "github.com/satori/go.uuid" +) + +func main() { + // Creating UUID Version 4 + u1 := uuid.NewV4() + fmt.Printf("UUIDv4: %s\n", u1) + + // Parsing UUID from string input + u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + if err != nil { + fmt.Printf("Something gone wrong: %s", err) + } + fmt.Printf("Successfully parsed: %s", u2) +} +``` + +## Documentation + +[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. + +## Links +* [RFC 4122](http://tools.ietf.org/html/rfc4122) +* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) + +## Copyright + +Copyright (C) 2013-2016 by Maxim Bublis . + +UUID package released under MIT License. +See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. diff --git a/vendor/github.com/satori/go.uuid/benchmarks_test.go b/vendor/github.com/satori/go.uuid/benchmarks_test.go index 2ee98a3f72..b4e567fc64 100644 --- a/vendor/github.com/satori/go.uuid/benchmarks_test.go +++ b/vendor/github.com/satori/go.uuid/benchmarks_test.go @@ -1,121 +1,121 @@ -// Copyright (C) 2013-2015 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "testing" -) - -func BenchmarkFromBytes(b *testing.B) { - bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - for i := 0; i < b.N; i++ { - FromBytes(bytes) - } -} - -func BenchmarkFromString(b *testing.B) { - s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkFromStringUrn(b *testing.B) { - s := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkFromStringWithBrackets(b *testing.B) { - s := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkNewV1(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV1() - } -} - -func BenchmarkNewV2(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV2(DomainPerson) - } -} - -func BenchmarkNewV3(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV3(NamespaceDNS, "www.example.com") - } -} - -func BenchmarkNewV4(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV4() - } -} - -func BenchmarkNewV5(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV5(NamespaceDNS, "www.example.com") - } -} - -func BenchmarkMarshalBinary(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.MarshalBinary() - } -} - -func BenchmarkMarshalText(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.MarshalText() - } -} - -func BenchmarkUnmarshalBinary(b *testing.B) { - bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - u := UUID{} - for i := 0; i < b.N; i++ { - u.UnmarshalBinary(bytes) - } -} - -func BenchmarkUnmarshalText(b *testing.B) { - bytes := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - u := UUID{} - for i := 0; i < b.N; i++ { - u.UnmarshalText(bytes) - } -} - -func BenchmarkMarshalToString(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.String() - } -} +// Copyright (C) 2013-2015 by Maxim Bublis +// +// 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. + +package uuid + +import ( + "testing" +) + +func BenchmarkFromBytes(b *testing.B) { + bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + for i := 0; i < b.N; i++ { + FromBytes(bytes) + } +} + +func BenchmarkFromString(b *testing.B) { + s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + for i := 0; i < b.N; i++ { + FromString(s) + } +} + +func BenchmarkFromStringUrn(b *testing.B) { + s := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" + for i := 0; i < b.N; i++ { + FromString(s) + } +} + +func BenchmarkFromStringWithBrackets(b *testing.B) { + s := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" + for i := 0; i < b.N; i++ { + FromString(s) + } +} + +func BenchmarkNewV1(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV1() + } +} + +func BenchmarkNewV2(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV2(DomainPerson) + } +} + +func BenchmarkNewV3(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV3(NamespaceDNS, "www.example.com") + } +} + +func BenchmarkNewV4(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV4() + } +} + +func BenchmarkNewV5(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV5(NamespaceDNS, "www.example.com") + } +} + +func BenchmarkMarshalBinary(b *testing.B) { + u := NewV4() + for i := 0; i < b.N; i++ { + u.MarshalBinary() + } +} + +func BenchmarkMarshalText(b *testing.B) { + u := NewV4() + for i := 0; i < b.N; i++ { + u.MarshalText() + } +} + +func BenchmarkUnmarshalBinary(b *testing.B) { + bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + u := UUID{} + for i := 0; i < b.N; i++ { + u.UnmarshalBinary(bytes) + } +} + +func BenchmarkUnmarshalText(b *testing.B) { + bytes := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + u := UUID{} + for i := 0; i < b.N; i++ { + u.UnmarshalText(bytes) + } +} + +func BenchmarkMarshalToString(b *testing.B) { + u := NewV4() + for i := 0; i < b.N; i++ { + u.String() + } +} diff --git a/vendor/github.com/satori/go.uuid/uuid.go b/vendor/github.com/satori/go.uuid/uuid.go index 056a3bb281..9c7fbaa54e 100644 --- a/vendor/github.com/satori/go.uuid/uuid.go +++ b/vendor/github.com/satori/go.uuid/uuid.go @@ -1,488 +1,488 @@ -// Copyright (C) 2013-2015 by Maxim Bublis -// -// 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. - -// Package uuid provides implementation of Universally Unique Identifier (UUID). -// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and -// version 2 (as specified in DCE 1.1). -package uuid - -import ( - "bytes" - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "database/sql/driver" - "encoding/binary" - "encoding/hex" - "fmt" - "hash" - "net" - "os" - "sync" - "time" -) - -// UUID layout variants. -const ( - VariantNCS = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -// Used in string method conversion -const dash byte = '-' - -// UUID v1/v2 storage. -var ( - storageMutex sync.Mutex - storageOnce sync.Once - epochFunc = unixTimeFunc - clockSequence uint16 - lastTime uint64 - hardwareAddr [6]byte - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -func initClockSequence() { - buf := make([]byte, 2) - safeRandom(buf) - clockSequence = binary.BigEndian.Uint16(buf) -} - -func initHardwareAddr() { - interfaces, err := net.Interfaces() - if err == nil { - for _, iface := range interfaces { - if len(iface.HardwareAddr) >= 6 { - copy(hardwareAddr[:], iface.HardwareAddr) - return - } - } - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence - safeRandom(hardwareAddr[:]) - - // Set multicast bit as recommended in RFC 4122 - hardwareAddr[0] |= 0x01 -} - -func initStorage() { - initClockSequence() - initHardwareAddr() -} - -func safeRandom(dest []byte) { - if _, err := rand.Read(dest); err != nil { - panic(err) - } -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -// This is default epoch calculation function. -func unixTimeFunc() uint64 { - return epochStart + uint64(time.Now().UnixNano()/100) -} - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [16]byte - -// NullUUID can be used with the standard sql package to represent a -// UUID value that can be NULL in the database -type NullUUID struct { - UUID UUID - Valid bool -} - -// The nil UUID is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8") - NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8") - NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8") -) - -// And returns result of binary AND of two UUIDs. -func And(u1 UUID, u2 UUID) UUID { - u := UUID{} - for i := 0; i < 16; i++ { - u[i] = u1[i] & u2[i] - } - return u -} - -// Or returns result of binary OR of two UUIDs. -func Or(u1 UUID, u2 UUID) UUID { - u := UUID{} - for i := 0; i < 16; i++ { - u[i] = u1[i] | u2[i] - } - return u -} - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() uint { - return uint(u[6] >> 4) -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() uint { - switch { - case (u[8] & 0x80) == 0x00: - return VariantNCS - case (u[8]&0xc0)|0x80 == 0x80: - return VariantRFC4122 - case (u[8]&0xe0)|0xc0 == 0xc0: - return VariantMicrosoft - } - return VariantFuture -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = dash - hex.Encode(buf[9:13], u[4:6]) - buf[13] = dash - hex.Encode(buf[14:18], u[6:8]) - buf[18] = dash - hex.Encode(buf[19:23], u[8:10]) - buf[23] = dash - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits as described in RFC 4122. -func (u *UUID) SetVariant() { - u[8] = (u[8] & 0xbf) | 0x80 -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -func (u *UUID) UnmarshalText(text []byte) (err error) { - if len(text) < 32 { - err = fmt.Errorf("uuid: UUID string too short: %s", text) - return - } - - t := text[:] - braced := false - - if bytes.Equal(t[:9], urnPrefix) { - t = t[9:] - } else if t[0] == '{' { - braced = true - t = t[1:] - } - - b := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 && t[0] == '-' { - t = t[1:] - } else if i > 0 && t[0] != '-' { - err = fmt.Errorf("uuid: invalid string format") - return - } - - if i == 2 { - if !bytes.Contains([]byte("012345"), []byte{t[0]}) { - err = fmt.Errorf("uuid: invalid version number: %s", t[0]) - return - } - } - - if len(t) < byteGroup { - err = fmt.Errorf("uuid: UUID string too short: %s", text) - return - } - - if i == 4 && len(t) > byteGroup && - ((braced && t[byteGroup] != '}') || len(t[byteGroup:]) > 1 || !braced) { - err = fmt.Errorf("uuid: UUID string too long: %s", t) - return - } - - _, err = hex.Decode(b[:byteGroup/2], t[:byteGroup]) - - if err != nil { - return - } - - t = t[byteGroup:] - b = b[byteGroup/2:] - } - - return -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != 16 { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} - -// Value implements the driver.Valuer interface. -func (u UUID) Value() (driver.Value, error) { - return u.String(), nil -} - -// Scan implements the sql.Scanner interface. -// A 16-byte slice is handled by UnmarshalBinary, while -// a longer byte slice or a string is handled by UnmarshalText. -func (u *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case []byte: - if len(src) == 16 { - return u.UnmarshalBinary(src) - } - return u.UnmarshalText(src) - - case string: - return u.UnmarshalText([]byte(src)) - } - - return fmt.Errorf("uuid: cannot convert %T to UUID", src) -} - -// Value implements the driver.Valuer interface. -func (u NullUUID) Value() (driver.Value, error) { - if !u.Valid { - return nil, nil - } - // Delegate to UUID Value function - return u.UUID.Value() -} - -// Scan implements the sql.Scanner interface. -func (u *NullUUID) Scan(src interface{}) error { - if src == nil { - u.UUID, u.Valid = Nil, false - return nil - } - - // Delegate to UUID Scan function - u.Valid = true - return u.UUID.Scan(src) -} - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// Returns UUID v1/v2 storage state. -// Returns epoch timestamp, clock sequence, and hardware address. -func getStorage() (uint64, uint16, []byte) { - storageOnce.Do(initStorage) - - storageMutex.Lock() - defer storageMutex.Unlock() - - timeNow := epochFunc() - // Clock changed backwards since last UUID generation. - // Should increase clock sequence. - if timeNow <= lastTime { - clockSequence++ - } - lastTime = timeNow - - return timeNow, clockSequence, hardwareAddr[:] -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := getStorage() - - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - copy(u[10:], hardwareAddr) - - u.SetVersion(1) - u.SetVariant() - - return u -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := getStorage() - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[0:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[0:], posixGID) - } - - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - u[9] = domain - - copy(u[10:], hardwareAddr) - - u.SetVersion(2) - u.SetVariant() - - return u -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(3) - u.SetVariant() - - return u -} - -// NewV4 returns random generated UUID. -func NewV4() UUID { - u := UUID{} - safeRandom(u[:]) - u.SetVersion(4) - u.SetVariant() - - return u -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(5) - u.SetVariant() - - return u -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} +// Copyright (C) 2013-2015 by Maxim Bublis +// +// 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. + +// Package uuid provides implementation of Universally Unique Identifier (UUID). +// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and +// version 2 (as specified in DCE 1.1). +package uuid + +import ( + "bytes" + "crypto/md5" + "crypto/rand" + "crypto/sha1" + "database/sql/driver" + "encoding/binary" + "encoding/hex" + "fmt" + "hash" + "net" + "os" + "sync" + "time" +) + +// UUID layout variants. +const ( + VariantNCS = iota + VariantRFC4122 + VariantMicrosoft + VariantFuture +) + +// UUID DCE domains. +const ( + DomainPerson = iota + DomainGroup + DomainOrg +) + +// Difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). +const epochStart = 122192928000000000 + +// Used in string method conversion +const dash byte = '-' + +// UUID v1/v2 storage. +var ( + storageMutex sync.Mutex + storageOnce sync.Once + epochFunc = unixTimeFunc + clockSequence uint16 + lastTime uint64 + hardwareAddr [6]byte + posixUID = uint32(os.Getuid()) + posixGID = uint32(os.Getgid()) +) + +// String parse helpers. +var ( + urnPrefix = []byte("urn:uuid:") + byteGroups = []int{8, 4, 4, 4, 12} +) + +func initClockSequence() { + buf := make([]byte, 2) + safeRandom(buf) + clockSequence = binary.BigEndian.Uint16(buf) +} + +func initHardwareAddr() { + interfaces, err := net.Interfaces() + if err == nil { + for _, iface := range interfaces { + if len(iface.HardwareAddr) >= 6 { + copy(hardwareAddr[:], iface.HardwareAddr) + return + } + } + } + + // Initialize hardwareAddr randomly in case + // of real network interfaces absence + safeRandom(hardwareAddr[:]) + + // Set multicast bit as recommended in RFC 4122 + hardwareAddr[0] |= 0x01 +} + +func initStorage() { + initClockSequence() + initHardwareAddr() +} + +func safeRandom(dest []byte) { + if _, err := rand.Read(dest); err != nil { + panic(err) + } +} + +// Returns difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and current time. +// This is default epoch calculation function. +func unixTimeFunc() uint64 { + return epochStart + uint64(time.Now().UnixNano()/100) +} + +// UUID representation compliant with specification +// described in RFC 4122. +type UUID [16]byte + +// NullUUID can be used with the standard sql package to represent a +// UUID value that can be NULL in the database +type NullUUID struct { + UUID UUID + Valid bool +} + +// The nil UUID is special form of UUID that is specified to have all +// 128 bits set to zero. +var Nil = UUID{} + +// Predefined namespace UUIDs. +var ( + NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8") +) + +// And returns result of binary AND of two UUIDs. +func And(u1 UUID, u2 UUID) UUID { + u := UUID{} + for i := 0; i < 16; i++ { + u[i] = u1[i] & u2[i] + } + return u +} + +// Or returns result of binary OR of two UUIDs. +func Or(u1 UUID, u2 UUID) UUID { + u := UUID{} + for i := 0; i < 16; i++ { + u[i] = u1[i] | u2[i] + } + return u +} + +// Equal returns true if u1 and u2 equals, otherwise returns false. +func Equal(u1 UUID, u2 UUID) bool { + return bytes.Equal(u1[:], u2[:]) +} + +// Version returns algorithm version used to generate UUID. +func (u UUID) Version() uint { + return uint(u[6] >> 4) +} + +// Variant returns UUID layout variant. +func (u UUID) Variant() uint { + switch { + case (u[8] & 0x80) == 0x00: + return VariantNCS + case (u[8]&0xc0)|0x80 == 0x80: + return VariantRFC4122 + case (u[8]&0xe0)|0xc0 == 0xc0: + return VariantMicrosoft + } + return VariantFuture +} + +// Bytes returns bytes slice representation of UUID. +func (u UUID) Bytes() []byte { + return u[:] +} + +// Returns canonical string representation of UUID: +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. +func (u UUID) String() string { + buf := make([]byte, 36) + + hex.Encode(buf[0:8], u[0:4]) + buf[8] = dash + hex.Encode(buf[9:13], u[4:6]) + buf[13] = dash + hex.Encode(buf[14:18], u[6:8]) + buf[18] = dash + hex.Encode(buf[19:23], u[8:10]) + buf[23] = dash + hex.Encode(buf[24:], u[10:]) + + return string(buf) +} + +// SetVersion sets version bits. +func (u *UUID) SetVersion(v byte) { + u[6] = (u[6] & 0x0f) | (v << 4) +} + +// SetVariant sets variant bits as described in RFC 4122. +func (u *UUID) SetVariant() { + u[8] = (u[8] & 0xbf) | 0x80 +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The encoding is the same as returned by String. +func (u UUID) MarshalText() (text []byte, err error) { + text = []byte(u.String()) + return +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// Following formats are supported: +// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", +// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", +// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" +func (u *UUID) UnmarshalText(text []byte) (err error) { + if len(text) < 32 { + err = fmt.Errorf("uuid: UUID string too short: %s", text) + return + } + + t := text[:] + braced := false + + if bytes.Equal(t[:9], urnPrefix) { + t = t[9:] + } else if t[0] == '{' { + braced = true + t = t[1:] + } + + b := u[:] + + for i, byteGroup := range byteGroups { + if i > 0 && t[0] == '-' { + t = t[1:] + } else if i > 0 && t[0] != '-' { + err = fmt.Errorf("uuid: invalid string format") + return + } + + if i == 2 { + if !bytes.Contains([]byte("012345"), []byte{t[0]}) { + err = fmt.Errorf("uuid: invalid version number: %s", t[0]) + return + } + } + + if len(t) < byteGroup { + err = fmt.Errorf("uuid: UUID string too short: %s", text) + return + } + + if i == 4 && len(t) > byteGroup && + ((braced && t[byteGroup] != '}') || len(t[byteGroup:]) > 1 || !braced) { + err = fmt.Errorf("uuid: UUID string too long: %s", t) + return + } + + _, err = hex.Decode(b[:byteGroup/2], t[:byteGroup]) + + if err != nil { + return + } + + t = t[byteGroup:] + b = b[byteGroup/2:] + } + + return +} + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (u UUID) MarshalBinary() (data []byte, err error) { + data = u.Bytes() + return +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +// It will return error if the slice isn't 16 bytes long. +func (u *UUID) UnmarshalBinary(data []byte) (err error) { + if len(data) != 16 { + err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) + return + } + copy(u[:], data) + + return +} + +// Value implements the driver.Valuer interface. +func (u UUID) Value() (driver.Value, error) { + return u.String(), nil +} + +// Scan implements the sql.Scanner interface. +// A 16-byte slice is handled by UnmarshalBinary, while +// a longer byte slice or a string is handled by UnmarshalText. +func (u *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case []byte: + if len(src) == 16 { + return u.UnmarshalBinary(src) + } + return u.UnmarshalText(src) + + case string: + return u.UnmarshalText([]byte(src)) + } + + return fmt.Errorf("uuid: cannot convert %T to UUID", src) +} + +// Value implements the driver.Valuer interface. +func (u NullUUID) Value() (driver.Value, error) { + if !u.Valid { + return nil, nil + } + // Delegate to UUID Value function + return u.UUID.Value() +} + +// Scan implements the sql.Scanner interface. +func (u *NullUUID) Scan(src interface{}) error { + if src == nil { + u.UUID, u.Valid = Nil, false + return nil + } + + // Delegate to UUID Scan function + u.Valid = true + return u.UUID.Scan(src) +} + +// FromBytes returns UUID converted from raw byte slice input. +// It will return error if the slice isn't 16 bytes long. +func FromBytes(input []byte) (u UUID, err error) { + err = u.UnmarshalBinary(input) + return +} + +// FromBytesOrNil returns UUID converted from raw byte slice input. +// Same behavior as FromBytes, but returns a Nil UUID on error. +func FromBytesOrNil(input []byte) UUID { + uuid, err := FromBytes(input) + if err != nil { + return Nil + } + return uuid +} + +// FromString returns UUID parsed from string input. +// Input is expected in a form accepted by UnmarshalText. +func FromString(input string) (u UUID, err error) { + err = u.UnmarshalText([]byte(input)) + return +} + +// FromStringOrNil returns UUID parsed from string input. +// Same behavior as FromString, but returns a Nil UUID on error. +func FromStringOrNil(input string) UUID { + uuid, err := FromString(input) + if err != nil { + return Nil + } + return uuid +} + +// Returns UUID v1/v2 storage state. +// Returns epoch timestamp, clock sequence, and hardware address. +func getStorage() (uint64, uint16, []byte) { + storageOnce.Do(initStorage) + + storageMutex.Lock() + defer storageMutex.Unlock() + + timeNow := epochFunc() + // Clock changed backwards since last UUID generation. + // Should increase clock sequence. + if timeNow <= lastTime { + clockSequence++ + } + lastTime = timeNow + + return timeNow, clockSequence, hardwareAddr[:] +} + +// NewV1 returns UUID based on current timestamp and MAC address. +func NewV1() UUID { + u := UUID{} + + timeNow, clockSeq, hardwareAddr := getStorage() + + binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + + copy(u[10:], hardwareAddr) + + u.SetVersion(1) + u.SetVariant() + + return u +} + +// NewV2 returns DCE Security UUID based on POSIX UID/GID. +func NewV2(domain byte) UUID { + u := UUID{} + + timeNow, clockSeq, hardwareAddr := getStorage() + + switch domain { + case DomainPerson: + binary.BigEndian.PutUint32(u[0:], posixUID) + case DomainGroup: + binary.BigEndian.PutUint32(u[0:], posixGID) + } + + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + u[9] = domain + + copy(u[10:], hardwareAddr) + + u.SetVersion(2) + u.SetVariant() + + return u +} + +// NewV3 returns UUID based on MD5 hash of namespace UUID and name. +func NewV3(ns UUID, name string) UUID { + u := newFromHash(md5.New(), ns, name) + u.SetVersion(3) + u.SetVariant() + + return u +} + +// NewV4 returns random generated UUID. +func NewV4() UUID { + u := UUID{} + safeRandom(u[:]) + u.SetVersion(4) + u.SetVariant() + + return u +} + +// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. +func NewV5(ns UUID, name string) UUID { + u := newFromHash(sha1.New(), ns, name) + u.SetVersion(5) + u.SetVariant() + + return u +} + +// Returns UUID based on hashing of namespace UUID and name. +func newFromHash(h hash.Hash, ns UUID, name string) UUID { + u := UUID{} + h.Write(ns[:]) + h.Write([]byte(name)) + copy(u[:], h.Sum(nil)) + + return u +} diff --git a/vendor/github.com/satori/go.uuid/uuid_test.go b/vendor/github.com/satori/go.uuid/uuid_test.go index 4082745668..aa68ac94f5 100644 --- a/vendor/github.com/satori/go.uuid/uuid_test.go +++ b/vendor/github.com/satori/go.uuid/uuid_test.go @@ -1,633 +1,633 @@ -// Copyright (C) 2013, 2015 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "bytes" - "testing" -) - -func TestBytes(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - if !bytes.Equal(u.Bytes(), bytes1) { - t.Errorf("Incorrect bytes representation for UUID: %s", u) - } -} - -func TestString(t *testing.T) { - if NamespaceDNS.String() != "6ba7b810-9dad-11d1-80b4-00c04fd430c8" { - t.Errorf("Incorrect string representation for UUID: %s", NamespaceDNS.String()) - } -} - -func TestEqual(t *testing.T) { - if !Equal(NamespaceDNS, NamespaceDNS) { - t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceDNS) - } - - if Equal(NamespaceDNS, NamespaceURL) { - t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceURL) - } -} - -func TestOr(t *testing.T) { - u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} - u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} - - u := UUID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} - - if !Equal(u, Or(u1, u2)) { - t.Errorf("Incorrect bitwise OR result %s", Or(u1, u2)) - } -} - -func TestAnd(t *testing.T) { - u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} - u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} - - u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if !Equal(u, And(u1, u2)) { - t.Errorf("Incorrect bitwise AND result %s", And(u1, u2)) - } -} - -func TestVersion(t *testing.T) { - u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u.Version() != 1 { - t.Errorf("Incorrect version for UUID: %d", u.Version()) - } -} - -func TestSetVersion(t *testing.T) { - u := UUID{} - u.SetVersion(4) - - if u.Version() != 4 { - t.Errorf("Incorrect version for UUID after u.setVersion(4): %d", u.Version()) - } -} - -func TestVariant(t *testing.T) { - u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u1.Variant() != VariantNCS { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantNCS, u1.Variant()) - } - - u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u2.Variant() != VariantRFC4122 { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantRFC4122, u2.Variant()) - } - - u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u3.Variant() != VariantMicrosoft { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantMicrosoft, u3.Variant()) - } - - u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u4.Variant() != VariantFuture { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantFuture, u4.Variant()) - } -} - -func TestSetVariant(t *testing.T) { - u := new(UUID) - u.SetVariant() - - if u.Variant() != VariantRFC4122 { - t.Errorf("Incorrect variant for UUID after u.setVariant(): %d", u.Variant()) - } -} - -func TestFromBytes(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1, err := FromBytes(b1) - if err != nil { - t.Errorf("Error parsing UUID from bytes: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - - _, err = FromBytes(b2) - if err == nil { - t.Errorf("Should return error parsing from empty byte slice, got %s", err) - } -} - -func TestMarshalBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - b2, err := u.MarshalBinary() - if err != nil { - t.Errorf("Error marshaling UUID: %s", err) - } - - if !bytes.Equal(b1, b2) { - t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) - } -} - -func TestUnmarshalBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1 := UUID{} - err := u1.UnmarshalBinary(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - u2 := UUID{} - - err = u2.UnmarshalBinary(b2) - if err == nil { - t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) - } -} - -func TestFromString(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - s2 := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" - s3 := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - _, err := FromString("") - if err == nil { - t.Errorf("Should return error trying to parse empty string, got %s", err) - } - - u1, err := FromString(s1) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - u2, err := FromString(s2) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u2) { - t.Errorf("UUIDs should be equal: %s and %s", u, u2) - } - - u3, err := FromString(s3) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u3) { - t.Errorf("UUIDs should be equal: %s and %s", u, u3) - } -} - -func TestFromStringShort(t *testing.T) { - // Invalid 35-character UUID string - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c" - - for i := len(s1); i >= 0; i-- { - _, err := FromString(s1[:i]) - if err == nil { - t.Errorf("Should return error trying to parse too short string, got %s", err) - } - } -} - -func TestFromStringLong(t *testing.T) { - // Invalid 37+ character UUID string - s := []string{ - "6ba7b810-9dad-11d1-80b4-00c04fd430c8=", - "6ba7b810-9dad-11d1-80b4-00c04fd430c8}", - "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}f", - "6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8", - } - - for _, str := range s { - _, err := FromString(str) - if err == nil { - t.Errorf("Should return error trying to parse too long string, passed %s", str) - } - } -} - -func TestFromStringInvalid(t *testing.T) { - // Invalid UUID string formats - s := []string{ - "6ba7b8109dad11d180b400c04fd430c8", - "6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8", - "urn:uuid:{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", - "6ba7b8109-dad-11d1-80b4-00c04fd430c8", - "6ba7b810-9dad1-1d1-80b4-00c04fd430c8", - "6ba7b810-9dad-11d18-0b4-00c04fd430c8", - "6ba7b810-9dad-11d1-80b40-0c04fd430c8", - "6ba7b810+9dad+11d1+80b4+00c04fd430c8", - "6ba7b810-9dad11d180b400c04fd430c8", - "6ba7b8109dad-11d180b400c04fd430c8", - "6ba7b8109dad11d1-80b400c04fd430c8", - "6ba7b8109dad11d180b4-00c04fd430c8", - } - - for _, str := range s { - _, err := FromString(str) - if err == nil { - t.Errorf("Should return error trying to parse invalid string, passed %s", str) - } - } -} - -func TestFromStringOrNil(t *testing.T) { - u := FromStringOrNil("") - if u != Nil { - t.Errorf("Should return Nil UUID on parse failure, got %s", u) - } -} - -func TestFromBytesOrNil(t *testing.T) { - b := []byte{} - u := FromBytesOrNil(b) - if u != Nil { - t.Errorf("Should return Nil UUID on parse failure, got %s", u) - } -} - -func TestMarshalText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - b2, err := u.MarshalText() - if err != nil { - t.Errorf("Error marshaling UUID: %s", err) - } - - if !bytes.Equal(b1, b2) { - t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) - } -} - -func TestUnmarshalText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - u1 := UUID{} - err := u1.UnmarshalText(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte("") - u2 := UUID{} - - err = u2.UnmarshalText(b2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestValue(t *testing.T) { - u, err := FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != u.String() { - t.Errorf("Wrong value returned, should be equal: %s and %s", val, u) - } -} - -func TestValueNil(t *testing.T) { - u := UUID{} - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != Nil.String() { - t.Errorf("Wrong value returned, should be equal to UUID.Nil: %s", val) - } -} - -func TestNullUUIDValueNil(t *testing.T) { - u := NullUUID{} - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != nil { - t.Errorf("Wrong value returned, should be nil: %s", val) - } -} - -func TestScanBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1 := UUID{} - err := u1.Scan(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - u2 := UUID{} - - err = u2.Scan(b2) - if err == nil { - t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) - } -} - -func TestScanString(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - u1 := UUID{} - err := u1.Scan(s1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - s2 := "" - u2 := UUID{} - - err = u2.Scan(s2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestScanText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - u1 := UUID{} - err := u1.Scan(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte("") - u2 := UUID{} - - err = u2.Scan(b2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestScanUnsupported(t *testing.T) { - u := UUID{} - - err := u.Scan(true) - if err == nil { - t.Errorf("Should return error trying to unmarshal from bool") - } -} - -func TestScanNil(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - err := u.Scan(nil) - if err == nil { - t.Errorf("Error UUID shouldn't allow unmarshalling from nil") - } -} - -func TestNullUUIDScanValid(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - u1 := NullUUID{} - err := u1.Scan(s1) - if err != nil { - t.Errorf("Error unmarshaling NullUUID: %s", err) - } - - if !u1.Valid { - t.Errorf("NullUUID should be valid") - } - - if !Equal(u, u1.UUID) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1.UUID) - } -} - -func TestNullUUIDScanNil(t *testing.T) { - u := NullUUID{UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, true} - - err := u.Scan(nil) - if err != nil { - t.Errorf("Error unmarshaling NullUUID: %s", err) - } - - if u.Valid { - t.Errorf("NullUUID should not be valid") - } - - if !Equal(u.UUID, Nil) { - t.Errorf("NullUUID value should be equal to Nil: %s", u) - } -} - -func TestNewV1(t *testing.T) { - u := NewV1() - - if u.Version() != 1 { - t.Errorf("UUIDv1 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv1 generated with incorrect variant: %d", u.Variant()) - } - - u1 := NewV1() - u2 := NewV1() - - if Equal(u1, u2) { - t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u1, u2) - } - - oldFunc := epochFunc - epochFunc = func() uint64 { return 0 } - - u3 := NewV1() - u4 := NewV1() - - if Equal(u3, u4) { - t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u3, u4) - } - - epochFunc = oldFunc -} - -func TestNewV2(t *testing.T) { - u1 := NewV2(DomainPerson) - - if u1.Version() != 2 { - t.Errorf("UUIDv2 generated with incorrect version: %d", u1.Version()) - } - - if u1.Variant() != VariantRFC4122 { - t.Errorf("UUIDv2 generated with incorrect variant: %d", u1.Variant()) - } - - u2 := NewV2(DomainGroup) - - if u2.Version() != 2 { - t.Errorf("UUIDv2 generated with incorrect version: %d", u2.Version()) - } - - if u2.Variant() != VariantRFC4122 { - t.Errorf("UUIDv2 generated with incorrect variant: %d", u2.Variant()) - } -} - -func TestNewV3(t *testing.T) { - u := NewV3(NamespaceDNS, "www.example.com") - - if u.Version() != 3 { - t.Errorf("UUIDv3 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv3 generated with incorrect variant: %d", u.Variant()) - } - - if u.String() != "5df41881-3aed-3515-88a7-2f4a814cf09e" { - t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) - } - - u = NewV3(NamespaceDNS, "python.org") - - if u.String() != "6fa459ea-ee8a-3ca4-894e-db77e160355e" { - t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) - } - - u1 := NewV3(NamespaceDNS, "golang.org") - u2 := NewV3(NamespaceDNS, "golang.org") - if !Equal(u1, u2) { - t.Errorf("UUIDv3 generated different UUIDs for same namespace and name: %s and %s", u1, u2) - } - - u3 := NewV3(NamespaceDNS, "example.com") - if Equal(u1, u3) { - t.Errorf("UUIDv3 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) - } - - u4 := NewV3(NamespaceURL, "golang.org") - if Equal(u1, u4) { - t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) - } -} - -func TestNewV4(t *testing.T) { - u := NewV4() - - if u.Version() != 4 { - t.Errorf("UUIDv4 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv4 generated with incorrect variant: %d", u.Variant()) - } -} - -func TestNewV5(t *testing.T) { - u := NewV5(NamespaceDNS, "www.example.com") - - if u.Version() != 5 { - t.Errorf("UUIDv5 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv5 generated with incorrect variant: %d", u.Variant()) - } - - u = NewV5(NamespaceDNS, "python.org") - - if u.String() != "886313e1-3b8a-5372-9b90-0c9aee199e5d" { - t.Errorf("UUIDv5 generated incorrectly: %s", u.String()) - } - - u1 := NewV5(NamespaceDNS, "golang.org") - u2 := NewV5(NamespaceDNS, "golang.org") - if !Equal(u1, u2) { - t.Errorf("UUIDv5 generated different UUIDs for same namespace and name: %s and %s", u1, u2) - } - - u3 := NewV5(NamespaceDNS, "example.com") - if Equal(u1, u3) { - t.Errorf("UUIDv5 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) - } - - u4 := NewV5(NamespaceURL, "golang.org") - if Equal(u1, u4) { - t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) - } -} +// Copyright (C) 2013, 2015 by Maxim Bublis +// +// 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. + +package uuid + +import ( + "bytes" + "testing" +) + +func TestBytes(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + if !bytes.Equal(u.Bytes(), bytes1) { + t.Errorf("Incorrect bytes representation for UUID: %s", u) + } +} + +func TestString(t *testing.T) { + if NamespaceDNS.String() != "6ba7b810-9dad-11d1-80b4-00c04fd430c8" { + t.Errorf("Incorrect string representation for UUID: %s", NamespaceDNS.String()) + } +} + +func TestEqual(t *testing.T) { + if !Equal(NamespaceDNS, NamespaceDNS) { + t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceDNS) + } + + if Equal(NamespaceDNS, NamespaceURL) { + t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceURL) + } +} + +func TestOr(t *testing.T) { + u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} + u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} + + u := UUID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + + if !Equal(u, Or(u1, u2)) { + t.Errorf("Incorrect bitwise OR result %s", Or(u1, u2)) + } +} + +func TestAnd(t *testing.T) { + u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} + u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} + + u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if !Equal(u, And(u1, u2)) { + t.Errorf("Incorrect bitwise AND result %s", And(u1, u2)) + } +} + +func TestVersion(t *testing.T) { + u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u.Version() != 1 { + t.Errorf("Incorrect version for UUID: %d", u.Version()) + } +} + +func TestSetVersion(t *testing.T) { + u := UUID{} + u.SetVersion(4) + + if u.Version() != 4 { + t.Errorf("Incorrect version for UUID after u.setVersion(4): %d", u.Version()) + } +} + +func TestVariant(t *testing.T) { + u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u1.Variant() != VariantNCS { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantNCS, u1.Variant()) + } + + u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u2.Variant() != VariantRFC4122 { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantRFC4122, u2.Variant()) + } + + u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u3.Variant() != VariantMicrosoft { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantMicrosoft, u3.Variant()) + } + + u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u4.Variant() != VariantFuture { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantFuture, u4.Variant()) + } +} + +func TestSetVariant(t *testing.T) { + u := new(UUID) + u.SetVariant() + + if u.Variant() != VariantRFC4122 { + t.Errorf("Incorrect variant for UUID after u.setVariant(): %d", u.Variant()) + } +} + +func TestFromBytes(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + u1, err := FromBytes(b1) + if err != nil { + t.Errorf("Error parsing UUID from bytes: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte{} + + _, err = FromBytes(b2) + if err == nil { + t.Errorf("Should return error parsing from empty byte slice, got %s", err) + } +} + +func TestMarshalBinary(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + b2, err := u.MarshalBinary() + if err != nil { + t.Errorf("Error marshaling UUID: %s", err) + } + + if !bytes.Equal(b1, b2) { + t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) + } +} + +func TestUnmarshalBinary(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + u1 := UUID{} + err := u1.UnmarshalBinary(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte{} + u2 := UUID{} + + err = u2.UnmarshalBinary(b2) + if err == nil { + t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) + } +} + +func TestFromString(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + s2 := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" + s3 := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" + + _, err := FromString("") + if err == nil { + t.Errorf("Should return error trying to parse empty string, got %s", err) + } + + u1, err := FromString(s1) + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + u2, err := FromString(s2) + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + if !Equal(u, u2) { + t.Errorf("UUIDs should be equal: %s and %s", u, u2) + } + + u3, err := FromString(s3) + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + if !Equal(u, u3) { + t.Errorf("UUIDs should be equal: %s and %s", u, u3) + } +} + +func TestFromStringShort(t *testing.T) { + // Invalid 35-character UUID string + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c" + + for i := len(s1); i >= 0; i-- { + _, err := FromString(s1[:i]) + if err == nil { + t.Errorf("Should return error trying to parse too short string, got %s", err) + } + } +} + +func TestFromStringLong(t *testing.T) { + // Invalid 37+ character UUID string + s := []string{ + "6ba7b810-9dad-11d1-80b4-00c04fd430c8=", + "6ba7b810-9dad-11d1-80b4-00c04fd430c8}", + "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}f", + "6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8", + } + + for _, str := range s { + _, err := FromString(str) + if err == nil { + t.Errorf("Should return error trying to parse too long string, passed %s", str) + } + } +} + +func TestFromStringInvalid(t *testing.T) { + // Invalid UUID string formats + s := []string{ + "6ba7b8109dad11d180b400c04fd430c8", + "6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8", + "urn:uuid:{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", + "6ba7b8109-dad-11d1-80b4-00c04fd430c8", + "6ba7b810-9dad1-1d1-80b4-00c04fd430c8", + "6ba7b810-9dad-11d18-0b4-00c04fd430c8", + "6ba7b810-9dad-11d1-80b40-0c04fd430c8", + "6ba7b810+9dad+11d1+80b4+00c04fd430c8", + "6ba7b810-9dad11d180b400c04fd430c8", + "6ba7b8109dad-11d180b400c04fd430c8", + "6ba7b8109dad11d1-80b400c04fd430c8", + "6ba7b8109dad11d180b4-00c04fd430c8", + } + + for _, str := range s { + _, err := FromString(str) + if err == nil { + t.Errorf("Should return error trying to parse invalid string, passed %s", str) + } + } +} + +func TestFromStringOrNil(t *testing.T) { + u := FromStringOrNil("") + if u != Nil { + t.Errorf("Should return Nil UUID on parse failure, got %s", u) + } +} + +func TestFromBytesOrNil(t *testing.T) { + b := []byte{} + u := FromBytesOrNil(b) + if u != Nil { + t.Errorf("Should return Nil UUID on parse failure, got %s", u) + } +} + +func TestMarshalText(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + b2, err := u.MarshalText() + if err != nil { + t.Errorf("Error marshaling UUID: %s", err) + } + + if !bytes.Equal(b1, b2) { + t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) + } +} + +func TestUnmarshalText(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + u1 := UUID{} + err := u1.UnmarshalText(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte("") + u2 := UUID{} + + err = u2.UnmarshalText(b2) + if err == nil { + t.Errorf("Should return error trying to unmarshal from empty string") + } +} + +func TestValue(t *testing.T) { + u, err := FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + val, err := u.Value() + if err != nil { + t.Errorf("Error getting UUID value: %s", err) + } + + if val != u.String() { + t.Errorf("Wrong value returned, should be equal: %s and %s", val, u) + } +} + +func TestValueNil(t *testing.T) { + u := UUID{} + + val, err := u.Value() + if err != nil { + t.Errorf("Error getting UUID value: %s", err) + } + + if val != Nil.String() { + t.Errorf("Wrong value returned, should be equal to UUID.Nil: %s", val) + } +} + +func TestNullUUIDValueNil(t *testing.T) { + u := NullUUID{} + + val, err := u.Value() + if err != nil { + t.Errorf("Error getting UUID value: %s", err) + } + + if val != nil { + t.Errorf("Wrong value returned, should be nil: %s", val) + } +} + +func TestScanBinary(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + u1 := UUID{} + err := u1.Scan(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte{} + u2 := UUID{} + + err = u2.Scan(b2) + if err == nil { + t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) + } +} + +func TestScanString(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + + u1 := UUID{} + err := u1.Scan(s1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + s2 := "" + u2 := UUID{} + + err = u2.Scan(s2) + if err == nil { + t.Errorf("Should return error trying to unmarshal from empty string") + } +} + +func TestScanText(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + u1 := UUID{} + err := u1.Scan(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte("") + u2 := UUID{} + + err = u2.Scan(b2) + if err == nil { + t.Errorf("Should return error trying to unmarshal from empty string") + } +} + +func TestScanUnsupported(t *testing.T) { + u := UUID{} + + err := u.Scan(true) + if err == nil { + t.Errorf("Should return error trying to unmarshal from bool") + } +} + +func TestScanNil(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + err := u.Scan(nil) + if err == nil { + t.Errorf("Error UUID shouldn't allow unmarshalling from nil") + } +} + +func TestNullUUIDScanValid(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + + u1 := NullUUID{} + err := u1.Scan(s1) + if err != nil { + t.Errorf("Error unmarshaling NullUUID: %s", err) + } + + if !u1.Valid { + t.Errorf("NullUUID should be valid") + } + + if !Equal(u, u1.UUID) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1.UUID) + } +} + +func TestNullUUIDScanNil(t *testing.T) { + u := NullUUID{UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, true} + + err := u.Scan(nil) + if err != nil { + t.Errorf("Error unmarshaling NullUUID: %s", err) + } + + if u.Valid { + t.Errorf("NullUUID should not be valid") + } + + if !Equal(u.UUID, Nil) { + t.Errorf("NullUUID value should be equal to Nil: %s", u) + } +} + +func TestNewV1(t *testing.T) { + u := NewV1() + + if u.Version() != 1 { + t.Errorf("UUIDv1 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv1 generated with incorrect variant: %d", u.Variant()) + } + + u1 := NewV1() + u2 := NewV1() + + if Equal(u1, u2) { + t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u1, u2) + } + + oldFunc := epochFunc + epochFunc = func() uint64 { return 0 } + + u3 := NewV1() + u4 := NewV1() + + if Equal(u3, u4) { + t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u3, u4) + } + + epochFunc = oldFunc +} + +func TestNewV2(t *testing.T) { + u1 := NewV2(DomainPerson) + + if u1.Version() != 2 { + t.Errorf("UUIDv2 generated with incorrect version: %d", u1.Version()) + } + + if u1.Variant() != VariantRFC4122 { + t.Errorf("UUIDv2 generated with incorrect variant: %d", u1.Variant()) + } + + u2 := NewV2(DomainGroup) + + if u2.Version() != 2 { + t.Errorf("UUIDv2 generated with incorrect version: %d", u2.Version()) + } + + if u2.Variant() != VariantRFC4122 { + t.Errorf("UUIDv2 generated with incorrect variant: %d", u2.Variant()) + } +} + +func TestNewV3(t *testing.T) { + u := NewV3(NamespaceDNS, "www.example.com") + + if u.Version() != 3 { + t.Errorf("UUIDv3 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv3 generated with incorrect variant: %d", u.Variant()) + } + + if u.String() != "5df41881-3aed-3515-88a7-2f4a814cf09e" { + t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) + } + + u = NewV3(NamespaceDNS, "python.org") + + if u.String() != "6fa459ea-ee8a-3ca4-894e-db77e160355e" { + t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) + } + + u1 := NewV3(NamespaceDNS, "golang.org") + u2 := NewV3(NamespaceDNS, "golang.org") + if !Equal(u1, u2) { + t.Errorf("UUIDv3 generated different UUIDs for same namespace and name: %s and %s", u1, u2) + } + + u3 := NewV3(NamespaceDNS, "example.com") + if Equal(u1, u3) { + t.Errorf("UUIDv3 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) + } + + u4 := NewV3(NamespaceURL, "golang.org") + if Equal(u1, u4) { + t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) + } +} + +func TestNewV4(t *testing.T) { + u := NewV4() + + if u.Version() != 4 { + t.Errorf("UUIDv4 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv4 generated with incorrect variant: %d", u.Variant()) + } +} + +func TestNewV5(t *testing.T) { + u := NewV5(NamespaceDNS, "www.example.com") + + if u.Version() != 5 { + t.Errorf("UUIDv5 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv5 generated with incorrect variant: %d", u.Variant()) + } + + u = NewV5(NamespaceDNS, "python.org") + + if u.String() != "886313e1-3b8a-5372-9b90-0c9aee199e5d" { + t.Errorf("UUIDv5 generated incorrectly: %s", u.String()) + } + + u1 := NewV5(NamespaceDNS, "golang.org") + u2 := NewV5(NamespaceDNS, "golang.org") + if !Equal(u1, u2) { + t.Errorf("UUIDv5 generated different UUIDs for same namespace and name: %s and %s", u1, u2) + } + + u3 := NewV5(NamespaceDNS, "example.com") + if Equal(u1, u3) { + t.Errorf("UUIDv5 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) + } + + u4 := NewV5(NamespaceURL, "golang.org") + if Equal(u1, u4) { + t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) + } +} diff --git a/vendor/github.com/satori/uuid/.travis.yml b/vendor/github.com/satori/uuid/.travis.yml index b91c40ed88..fdf960e86b 100644 --- a/vendor/github.com/satori/uuid/.travis.yml +++ b/vendor/github.com/satori/uuid/.travis.yml @@ -1,22 +1,22 @@ -language: go -sudo: false -go: - - 1.2 - - 1.3 - - 1.4 - - 1.5 - - 1.6 - - 1.7 - - 1.8 - - tip -matrix: - allow_failures: - - go: tip - fast_finish: true -before_install: - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover -script: - - $HOME/gopath/bin/goveralls -service=travis-ci -notifications: - email: false +language: go +sudo: false +go: + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - 1.7 + - 1.8 + - tip +matrix: + allow_failures: + - go: tip + fast_finish: true +before_install: + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover +script: + - $HOME/gopath/bin/goveralls -service=travis-ci +notifications: + email: false diff --git a/vendor/github.com/satori/uuid/LICENSE b/vendor/github.com/satori/uuid/LICENSE index 1113670624..488357b8af 100644 --- a/vendor/github.com/satori/uuid/LICENSE +++ b/vendor/github.com/satori/uuid/LICENSE @@ -1,20 +1,20 @@ -Copyright (C) 2013-2016 by Maxim Bublis - -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) 2013-2016 by Maxim Bublis + +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/satori/uuid/README.md b/vendor/github.com/satori/uuid/README.md index 43682e4db4..b6aad1c813 100644 --- a/vendor/github.com/satori/uuid/README.md +++ b/vendor/github.com/satori/uuid/README.md @@ -1,65 +1,65 @@ -# UUID package for Go language - -[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) -[![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) -[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) - -This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. - -With 100% test coverage and benchmarks out of box. - -Supported versions: -* Version 1, based on timestamp and MAC address (RFC 4122) -* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) -* Version 3, based on MD5 hashing (RFC 4122) -* Version 4, based on random numbers (RFC 4122) -* Version 5, based on SHA-1 hashing (RFC 4122) - -## Installation - -Use the `go` command: - - $ go get github.com/satori/go.uuid - -## Requirements - -UUID package requires Go >= 1.2. - -## Example - -```go -package main - -import ( - "fmt" - "github.com/satori/go.uuid" -) - -func main() { - // Creating UUID Version 4 - u1 := uuid.NewV4() - fmt.Printf("UUIDv4: %s\n", u1) - - // Parsing UUID from string input - u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - fmt.Printf("Something gone wrong: %s", err) - } - fmt.Printf("Successfully parsed: %s", u2) -} -``` - -## Documentation - -[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. - -## Links -* [RFC 4122](http://tools.ietf.org/html/rfc4122) -* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) - -## Copyright - -Copyright (C) 2013-2016 by Maxim Bublis . - -UUID package released under MIT License. -See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. +# UUID package for Go language + +[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) +[![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) +[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) + +This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. + +With 100% test coverage and benchmarks out of box. + +Supported versions: +* Version 1, based on timestamp and MAC address (RFC 4122) +* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) +* Version 3, based on MD5 hashing (RFC 4122) +* Version 4, based on random numbers (RFC 4122) +* Version 5, based on SHA-1 hashing (RFC 4122) + +## Installation + +Use the `go` command: + + $ go get github.com/satori/go.uuid + +## Requirements + +UUID package requires Go >= 1.2. + +## Example + +```go +package main + +import ( + "fmt" + "github.com/satori/go.uuid" +) + +func main() { + // Creating UUID Version 4 + u1 := uuid.NewV4() + fmt.Printf("UUIDv4: %s\n", u1) + + // Parsing UUID from string input + u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + if err != nil { + fmt.Printf("Something gone wrong: %s", err) + } + fmt.Printf("Successfully parsed: %s", u2) +} +``` + +## Documentation + +[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. + +## Links +* [RFC 4122](http://tools.ietf.org/html/rfc4122) +* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) + +## Copyright + +Copyright (C) 2013-2016 by Maxim Bublis . + +UUID package released under MIT License. +See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. diff --git a/vendor/github.com/satori/uuid/benchmarks_test.go b/vendor/github.com/satori/uuid/benchmarks_test.go index 76a1d47d1b..c3baeab8b2 100644 --- a/vendor/github.com/satori/uuid/benchmarks_test.go +++ b/vendor/github.com/satori/uuid/benchmarks_test.go @@ -1,123 +1,123 @@ -// Copyright (C) 2013-2015 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "testing" -) - -func BenchmarkFromBytes(b *testing.B) { - bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - for i := 0; i < b.N; i++ { - FromBytes(bytes) - } -} - -func BenchmarkFromString(b *testing.B) { - s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkFromStringUrn(b *testing.B) { - s := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkFromStringWithBrackets(b *testing.B) { - s := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" - for i := 0; i < b.N; i++ { - FromString(s) - } -} - -func BenchmarkNewV1(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV1() - } -} - -func BenchmarkNewV2(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV2(DomainPerson) - } -} - -func BenchmarkNewV3(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV3(NamespaceDNS, "www.example.com") - } -} - -func BenchmarkNewV4(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV4() - } -} - -func BenchmarkNewV5(b *testing.B) { - for i := 0; i < b.N; i++ { - NewV5(NamespaceDNS, "www.example.com") - } -} - -func BenchmarkMarshalBinary(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.MarshalBinary() - } -} - -func BenchmarkMarshalText(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - u.MarshalText() - } -} - -func BenchmarkUnmarshalBinary(b *testing.B) { - bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - u := UUID{} - for i := 0; i < b.N; i++ { - u.UnmarshalBinary(bytes) - } -} - -func BenchmarkUnmarshalText(b *testing.B) { - bytes := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - u := UUID{} - for i := 0; i < b.N; i++ { - u.UnmarshalText(bytes) - } -} - -var sink string - -func BenchmarkMarshalToString(b *testing.B) { - u := NewV4() - for i := 0; i < b.N; i++ { - sink = u.String() - } -} +// Copyright (C) 2013-2015 by Maxim Bublis +// +// 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. + +package uuid + +import ( + "testing" +) + +func BenchmarkFromBytes(b *testing.B) { + bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + for i := 0; i < b.N; i++ { + FromBytes(bytes) + } +} + +func BenchmarkFromString(b *testing.B) { + s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + for i := 0; i < b.N; i++ { + FromString(s) + } +} + +func BenchmarkFromStringUrn(b *testing.B) { + s := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" + for i := 0; i < b.N; i++ { + FromString(s) + } +} + +func BenchmarkFromStringWithBrackets(b *testing.B) { + s := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" + for i := 0; i < b.N; i++ { + FromString(s) + } +} + +func BenchmarkNewV1(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV1() + } +} + +func BenchmarkNewV2(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV2(DomainPerson) + } +} + +func BenchmarkNewV3(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV3(NamespaceDNS, "www.example.com") + } +} + +func BenchmarkNewV4(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV4() + } +} + +func BenchmarkNewV5(b *testing.B) { + for i := 0; i < b.N; i++ { + NewV5(NamespaceDNS, "www.example.com") + } +} + +func BenchmarkMarshalBinary(b *testing.B) { + u := NewV4() + for i := 0; i < b.N; i++ { + u.MarshalBinary() + } +} + +func BenchmarkMarshalText(b *testing.B) { + u := NewV4() + for i := 0; i < b.N; i++ { + u.MarshalText() + } +} + +func BenchmarkUnmarshalBinary(b *testing.B) { + bytes := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + u := UUID{} + for i := 0; i < b.N; i++ { + u.UnmarshalBinary(bytes) + } +} + +func BenchmarkUnmarshalText(b *testing.B) { + bytes := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + u := UUID{} + for i := 0; i < b.N; i++ { + u.UnmarshalText(bytes) + } +} + +var sink string + +func BenchmarkMarshalToString(b *testing.B) { + u := NewV4() + for i := 0; i < b.N; i++ { + sink = u.String() + } +} diff --git a/vendor/github.com/satori/uuid/uuid.go b/vendor/github.com/satori/uuid/uuid.go index 68b5a0750b..295f3fc2c5 100644 --- a/vendor/github.com/satori/uuid/uuid.go +++ b/vendor/github.com/satori/uuid/uuid.go @@ -1,481 +1,481 @@ -// Copyright (C) 2013-2015 by Maxim Bublis -// -// 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. - -// Package uuid provides implementation of Universally Unique Identifier (UUID). -// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and -// version 2 (as specified in DCE 1.1). -package uuid - -import ( - "bytes" - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "database/sql/driver" - "encoding/binary" - "encoding/hex" - "fmt" - "hash" - "net" - "os" - "sync" - "time" -) - -// UUID layout variants. -const ( - VariantNCS = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -// Used in string method conversion -const dash byte = '-' - -// UUID v1/v2 storage. -var ( - storageMutex sync.Mutex - storageOnce sync.Once - epochFunc = unixTimeFunc - clockSequence uint16 - lastTime uint64 - hardwareAddr [6]byte - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -func initClockSequence() { - buf := make([]byte, 2) - safeRandom(buf) - clockSequence = binary.BigEndian.Uint16(buf) -} - -func initHardwareAddr() { - interfaces, err := net.Interfaces() - if err == nil { - for _, iface := range interfaces { - if len(iface.HardwareAddr) >= 6 { - copy(hardwareAddr[:], iface.HardwareAddr) - return - } - } - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence - safeRandom(hardwareAddr[:]) - - // Set multicast bit as recommended in RFC 4122 - hardwareAddr[0] |= 0x01 -} - -func initStorage() { - initClockSequence() - initHardwareAddr() -} - -func safeRandom(dest []byte) { - if _, err := rand.Read(dest); err != nil { - panic(err) - } -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -// This is default epoch calculation function. -func unixTimeFunc() uint64 { - return epochStart + uint64(time.Now().UnixNano()/100) -} - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [16]byte - -// NullUUID can be used with the standard sql package to represent a -// UUID value that can be NULL in the database -type NullUUID struct { - UUID UUID - Valid bool -} - -// The nil UUID is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8") - NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8") - NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8") -) - -// And returns result of binary AND of two UUIDs. -func And(u1 UUID, u2 UUID) UUID { - u := UUID{} - for i := 0; i < 16; i++ { - u[i] = u1[i] & u2[i] - } - return u -} - -// Or returns result of binary OR of two UUIDs. -func Or(u1 UUID, u2 UUID) UUID { - u := UUID{} - for i := 0; i < 16; i++ { - u[i] = u1[i] | u2[i] - } - return u -} - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() uint { - return uint(u[6] >> 4) -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() uint { - switch { - case (u[8] & 0x80) == 0x00: - return VariantNCS - case (u[8]&0xc0)|0x80 == 0x80: - return VariantRFC4122 - case (u[8]&0xe0)|0xc0 == 0xc0: - return VariantMicrosoft - } - return VariantFuture -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = dash - hex.Encode(buf[9:13], u[4:6]) - buf[13] = dash - hex.Encode(buf[14:18], u[6:8]) - buf[18] = dash - hex.Encode(buf[19:23], u[8:10]) - buf[23] = dash - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits as described in RFC 4122. -func (u *UUID) SetVariant() { - u[8] = (u[8] & 0xbf) | 0x80 -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -func (u *UUID) UnmarshalText(text []byte) (err error) { - if len(text) < 32 { - err = fmt.Errorf("uuid: UUID string too short: %s", text) - return - } - - t := text[:] - braced := false - - if bytes.Equal(t[:9], urnPrefix) { - t = t[9:] - } else if t[0] == '{' { - braced = true - t = t[1:] - } - - b := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 { - if t[0] != '-' { - err = fmt.Errorf("uuid: invalid string format") - return - } - t = t[1:] - } - - if len(t) < byteGroup { - err = fmt.Errorf("uuid: UUID string too short: %s", text) - return - } - - if i == 4 && len(t) > byteGroup && - ((braced && t[byteGroup] != '}') || len(t[byteGroup:]) > 1 || !braced) { - err = fmt.Errorf("uuid: UUID string too long: %s", text) - return - } - - _, err = hex.Decode(b[:byteGroup/2], t[:byteGroup]) - if err != nil { - return - } - - t = t[byteGroup:] - b = b[byteGroup/2:] - } - - return -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != 16 { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} - -// Value implements the driver.Valuer interface. -func (u UUID) Value() (driver.Value, error) { - return u.String(), nil -} - -// Scan implements the sql.Scanner interface. -// A 16-byte slice is handled by UnmarshalBinary, while -// a longer byte slice or a string is handled by UnmarshalText. -func (u *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case []byte: - if len(src) == 16 { - return u.UnmarshalBinary(src) - } - return u.UnmarshalText(src) - - case string: - return u.UnmarshalText([]byte(src)) - } - - return fmt.Errorf("uuid: cannot convert %T to UUID", src) -} - -// Value implements the driver.Valuer interface. -func (u NullUUID) Value() (driver.Value, error) { - if !u.Valid { - return nil, nil - } - // Delegate to UUID Value function - return u.UUID.Value() -} - -// Scan implements the sql.Scanner interface. -func (u *NullUUID) Scan(src interface{}) error { - if src == nil { - u.UUID, u.Valid = Nil, false - return nil - } - - // Delegate to UUID Scan function - u.Valid = true - return u.UUID.Scan(src) -} - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// Returns UUID v1/v2 storage state. -// Returns epoch timestamp, clock sequence, and hardware address. -func getStorage() (uint64, uint16, []byte) { - storageOnce.Do(initStorage) - - storageMutex.Lock() - defer storageMutex.Unlock() - - timeNow := epochFunc() - // Clock changed backwards since last UUID generation. - // Should increase clock sequence. - if timeNow <= lastTime { - clockSequence++ - } - lastTime = timeNow - - return timeNow, clockSequence, hardwareAddr[:] -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := getStorage() - - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - copy(u[10:], hardwareAddr) - - u.SetVersion(1) - u.SetVariant() - - return u -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := getStorage() - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[0:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[0:], posixGID) - } - - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - u[9] = domain - - copy(u[10:], hardwareAddr) - - u.SetVersion(2) - u.SetVariant() - - return u -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(3) - u.SetVariant() - - return u -} - -// NewV4 returns random generated UUID. -func NewV4() UUID { - u := UUID{} - safeRandom(u[:]) - u.SetVersion(4) - u.SetVariant() - - return u -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(5) - u.SetVariant() - - return u -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} +// Copyright (C) 2013-2015 by Maxim Bublis +// +// 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. + +// Package uuid provides implementation of Universally Unique Identifier (UUID). +// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and +// version 2 (as specified in DCE 1.1). +package uuid + +import ( + "bytes" + "crypto/md5" + "crypto/rand" + "crypto/sha1" + "database/sql/driver" + "encoding/binary" + "encoding/hex" + "fmt" + "hash" + "net" + "os" + "sync" + "time" +) + +// UUID layout variants. +const ( + VariantNCS = iota + VariantRFC4122 + VariantMicrosoft + VariantFuture +) + +// UUID DCE domains. +const ( + DomainPerson = iota + DomainGroup + DomainOrg +) + +// Difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). +const epochStart = 122192928000000000 + +// Used in string method conversion +const dash byte = '-' + +// UUID v1/v2 storage. +var ( + storageMutex sync.Mutex + storageOnce sync.Once + epochFunc = unixTimeFunc + clockSequence uint16 + lastTime uint64 + hardwareAddr [6]byte + posixUID = uint32(os.Getuid()) + posixGID = uint32(os.Getgid()) +) + +// String parse helpers. +var ( + urnPrefix = []byte("urn:uuid:") + byteGroups = []int{8, 4, 4, 4, 12} +) + +func initClockSequence() { + buf := make([]byte, 2) + safeRandom(buf) + clockSequence = binary.BigEndian.Uint16(buf) +} + +func initHardwareAddr() { + interfaces, err := net.Interfaces() + if err == nil { + for _, iface := range interfaces { + if len(iface.HardwareAddr) >= 6 { + copy(hardwareAddr[:], iface.HardwareAddr) + return + } + } + } + + // Initialize hardwareAddr randomly in case + // of real network interfaces absence + safeRandom(hardwareAddr[:]) + + // Set multicast bit as recommended in RFC 4122 + hardwareAddr[0] |= 0x01 +} + +func initStorage() { + initClockSequence() + initHardwareAddr() +} + +func safeRandom(dest []byte) { + if _, err := rand.Read(dest); err != nil { + panic(err) + } +} + +// Returns difference in 100-nanosecond intervals between +// UUID epoch (October 15, 1582) and current time. +// This is default epoch calculation function. +func unixTimeFunc() uint64 { + return epochStart + uint64(time.Now().UnixNano()/100) +} + +// UUID representation compliant with specification +// described in RFC 4122. +type UUID [16]byte + +// NullUUID can be used with the standard sql package to represent a +// UUID value that can be NULL in the database +type NullUUID struct { + UUID UUID + Valid bool +} + +// The nil UUID is special form of UUID that is specified to have all +// 128 bits set to zero. +var Nil = UUID{} + +// Predefined namespace UUIDs. +var ( + NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8") +) + +// And returns result of binary AND of two UUIDs. +func And(u1 UUID, u2 UUID) UUID { + u := UUID{} + for i := 0; i < 16; i++ { + u[i] = u1[i] & u2[i] + } + return u +} + +// Or returns result of binary OR of two UUIDs. +func Or(u1 UUID, u2 UUID) UUID { + u := UUID{} + for i := 0; i < 16; i++ { + u[i] = u1[i] | u2[i] + } + return u +} + +// Equal returns true if u1 and u2 equals, otherwise returns false. +func Equal(u1 UUID, u2 UUID) bool { + return bytes.Equal(u1[:], u2[:]) +} + +// Version returns algorithm version used to generate UUID. +func (u UUID) Version() uint { + return uint(u[6] >> 4) +} + +// Variant returns UUID layout variant. +func (u UUID) Variant() uint { + switch { + case (u[8] & 0x80) == 0x00: + return VariantNCS + case (u[8]&0xc0)|0x80 == 0x80: + return VariantRFC4122 + case (u[8]&0xe0)|0xc0 == 0xc0: + return VariantMicrosoft + } + return VariantFuture +} + +// Bytes returns bytes slice representation of UUID. +func (u UUID) Bytes() []byte { + return u[:] +} + +// Returns canonical string representation of UUID: +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. +func (u UUID) String() string { + buf := make([]byte, 36) + + hex.Encode(buf[0:8], u[0:4]) + buf[8] = dash + hex.Encode(buf[9:13], u[4:6]) + buf[13] = dash + hex.Encode(buf[14:18], u[6:8]) + buf[18] = dash + hex.Encode(buf[19:23], u[8:10]) + buf[23] = dash + hex.Encode(buf[24:], u[10:]) + + return string(buf) +} + +// SetVersion sets version bits. +func (u *UUID) SetVersion(v byte) { + u[6] = (u[6] & 0x0f) | (v << 4) +} + +// SetVariant sets variant bits as described in RFC 4122. +func (u *UUID) SetVariant() { + u[8] = (u[8] & 0xbf) | 0x80 +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The encoding is the same as returned by String. +func (u UUID) MarshalText() (text []byte, err error) { + text = []byte(u.String()) + return +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// Following formats are supported: +// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", +// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", +// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" +func (u *UUID) UnmarshalText(text []byte) (err error) { + if len(text) < 32 { + err = fmt.Errorf("uuid: UUID string too short: %s", text) + return + } + + t := text[:] + braced := false + + if bytes.Equal(t[:9], urnPrefix) { + t = t[9:] + } else if t[0] == '{' { + braced = true + t = t[1:] + } + + b := u[:] + + for i, byteGroup := range byteGroups { + if i > 0 { + if t[0] != '-' { + err = fmt.Errorf("uuid: invalid string format") + return + } + t = t[1:] + } + + if len(t) < byteGroup { + err = fmt.Errorf("uuid: UUID string too short: %s", text) + return + } + + if i == 4 && len(t) > byteGroup && + ((braced && t[byteGroup] != '}') || len(t[byteGroup:]) > 1 || !braced) { + err = fmt.Errorf("uuid: UUID string too long: %s", text) + return + } + + _, err = hex.Decode(b[:byteGroup/2], t[:byteGroup]) + if err != nil { + return + } + + t = t[byteGroup:] + b = b[byteGroup/2:] + } + + return +} + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (u UUID) MarshalBinary() (data []byte, err error) { + data = u.Bytes() + return +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +// It will return error if the slice isn't 16 bytes long. +func (u *UUID) UnmarshalBinary(data []byte) (err error) { + if len(data) != 16 { + err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) + return + } + copy(u[:], data) + + return +} + +// Value implements the driver.Valuer interface. +func (u UUID) Value() (driver.Value, error) { + return u.String(), nil +} + +// Scan implements the sql.Scanner interface. +// A 16-byte slice is handled by UnmarshalBinary, while +// a longer byte slice or a string is handled by UnmarshalText. +func (u *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case []byte: + if len(src) == 16 { + return u.UnmarshalBinary(src) + } + return u.UnmarshalText(src) + + case string: + return u.UnmarshalText([]byte(src)) + } + + return fmt.Errorf("uuid: cannot convert %T to UUID", src) +} + +// Value implements the driver.Valuer interface. +func (u NullUUID) Value() (driver.Value, error) { + if !u.Valid { + return nil, nil + } + // Delegate to UUID Value function + return u.UUID.Value() +} + +// Scan implements the sql.Scanner interface. +func (u *NullUUID) Scan(src interface{}) error { + if src == nil { + u.UUID, u.Valid = Nil, false + return nil + } + + // Delegate to UUID Scan function + u.Valid = true + return u.UUID.Scan(src) +} + +// FromBytes returns UUID converted from raw byte slice input. +// It will return error if the slice isn't 16 bytes long. +func FromBytes(input []byte) (u UUID, err error) { + err = u.UnmarshalBinary(input) + return +} + +// FromBytesOrNil returns UUID converted from raw byte slice input. +// Same behavior as FromBytes, but returns a Nil UUID on error. +func FromBytesOrNil(input []byte) UUID { + uuid, err := FromBytes(input) + if err != nil { + return Nil + } + return uuid +} + +// FromString returns UUID parsed from string input. +// Input is expected in a form accepted by UnmarshalText. +func FromString(input string) (u UUID, err error) { + err = u.UnmarshalText([]byte(input)) + return +} + +// FromStringOrNil returns UUID parsed from string input. +// Same behavior as FromString, but returns a Nil UUID on error. +func FromStringOrNil(input string) UUID { + uuid, err := FromString(input) + if err != nil { + return Nil + } + return uuid +} + +// Returns UUID v1/v2 storage state. +// Returns epoch timestamp, clock sequence, and hardware address. +func getStorage() (uint64, uint16, []byte) { + storageOnce.Do(initStorage) + + storageMutex.Lock() + defer storageMutex.Unlock() + + timeNow := epochFunc() + // Clock changed backwards since last UUID generation. + // Should increase clock sequence. + if timeNow <= lastTime { + clockSequence++ + } + lastTime = timeNow + + return timeNow, clockSequence, hardwareAddr[:] +} + +// NewV1 returns UUID based on current timestamp and MAC address. +func NewV1() UUID { + u := UUID{} + + timeNow, clockSeq, hardwareAddr := getStorage() + + binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + + copy(u[10:], hardwareAddr) + + u.SetVersion(1) + u.SetVariant() + + return u +} + +// NewV2 returns DCE Security UUID based on POSIX UID/GID. +func NewV2(domain byte) UUID { + u := UUID{} + + timeNow, clockSeq, hardwareAddr := getStorage() + + switch domain { + case DomainPerson: + binary.BigEndian.PutUint32(u[0:], posixUID) + case DomainGroup: + binary.BigEndian.PutUint32(u[0:], posixGID) + } + + binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) + binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) + binary.BigEndian.PutUint16(u[8:], clockSeq) + u[9] = domain + + copy(u[10:], hardwareAddr) + + u.SetVersion(2) + u.SetVariant() + + return u +} + +// NewV3 returns UUID based on MD5 hash of namespace UUID and name. +func NewV3(ns UUID, name string) UUID { + u := newFromHash(md5.New(), ns, name) + u.SetVersion(3) + u.SetVariant() + + return u +} + +// NewV4 returns random generated UUID. +func NewV4() UUID { + u := UUID{} + safeRandom(u[:]) + u.SetVersion(4) + u.SetVariant() + + return u +} + +// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. +func NewV5(ns UUID, name string) UUID { + u := newFromHash(sha1.New(), ns, name) + u.SetVersion(5) + u.SetVariant() + + return u +} + +// Returns UUID based on hashing of namespace UUID and name. +func newFromHash(h hash.Hash, ns UUID, name string) UUID { + u := UUID{} + h.Write(ns[:]) + h.Write([]byte(name)) + copy(u[:], h.Sum(nil)) + + return u +} diff --git a/vendor/github.com/satori/uuid/uuid_test.go b/vendor/github.com/satori/uuid/uuid_test.go index 1932a6e22c..56504808f9 100644 --- a/vendor/github.com/satori/uuid/uuid_test.go +++ b/vendor/github.com/satori/uuid/uuid_test.go @@ -1,633 +1,633 @@ -// Copyright (C) 2013, 2015 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "bytes" - "testing" -) - -func TestBytes(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - if !bytes.Equal(u.Bytes(), bytes1) { - t.Errorf("Incorrect bytes representation for UUID: %s", u) - } -} - -func TestString(t *testing.T) { - if NamespaceDNS.String() != "6ba7b810-9dad-11d1-80b4-00c04fd430c8" { - t.Errorf("Incorrect string representation for UUID: %s", NamespaceDNS.String()) - } -} - -func TestEqual(t *testing.T) { - if !Equal(NamespaceDNS, NamespaceDNS) { - t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceDNS) - } - - if Equal(NamespaceDNS, NamespaceURL) { - t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceURL) - } -} - -func TestOr(t *testing.T) { - u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} - u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} - - u := UUID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} - - if !Equal(u, Or(u1, u2)) { - t.Errorf("Incorrect bitwise OR result %s", Or(u1, u2)) - } -} - -func TestAnd(t *testing.T) { - u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} - u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} - - u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if !Equal(u, And(u1, u2)) { - t.Errorf("Incorrect bitwise AND result %s", And(u1, u2)) - } -} - -func TestVersion(t *testing.T) { - u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u.Version() != 1 { - t.Errorf("Incorrect version for UUID: %d", u.Version()) - } -} - -func TestSetVersion(t *testing.T) { - u := UUID{} - u.SetVersion(4) - - if u.Version() != 4 { - t.Errorf("Incorrect version for UUID after u.setVersion(4): %d", u.Version()) - } -} - -func TestVariant(t *testing.T) { - u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u1.Variant() != VariantNCS { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantNCS, u1.Variant()) - } - - u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u2.Variant() != VariantRFC4122 { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantRFC4122, u2.Variant()) - } - - u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u3.Variant() != VariantMicrosoft { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantMicrosoft, u3.Variant()) - } - - u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - - if u4.Variant() != VariantFuture { - t.Errorf("Incorrect variant for UUID variant %d: %d", VariantFuture, u4.Variant()) - } -} - -func TestSetVariant(t *testing.T) { - u := new(UUID) - u.SetVariant() - - if u.Variant() != VariantRFC4122 { - t.Errorf("Incorrect variant for UUID after u.setVariant(): %d", u.Variant()) - } -} - -func TestFromBytes(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1, err := FromBytes(b1) - if err != nil { - t.Errorf("Error parsing UUID from bytes: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - - _, err = FromBytes(b2) - if err == nil { - t.Errorf("Should return error parsing from empty byte slice, got %s", err) - } -} - -func TestMarshalBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - b2, err := u.MarshalBinary() - if err != nil { - t.Errorf("Error marshaling UUID: %s", err) - } - - if !bytes.Equal(b1, b2) { - t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) - } -} - -func TestUnmarshalBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1 := UUID{} - err := u1.UnmarshalBinary(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - u2 := UUID{} - - err = u2.UnmarshalBinary(b2) - if err == nil { - t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) - } -} - -func TestFromString(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - s2 := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" - s3 := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - _, err := FromString("") - if err == nil { - t.Errorf("Should return error trying to parse empty string, got %s", err) - } - - u1, err := FromString(s1) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - u2, err := FromString(s2) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u2) { - t.Errorf("UUIDs should be equal: %s and %s", u, u2) - } - - u3, err := FromString(s3) - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - if !Equal(u, u3) { - t.Errorf("UUIDs should be equal: %s and %s", u, u3) - } -} - -func TestFromStringShort(t *testing.T) { - // Invalid 35-character UUID string - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c" - - for i := len(s1); i >= 0; i-- { - _, err := FromString(s1[:i]) - if err == nil { - t.Errorf("Should return error trying to parse too short string, got %s", err) - } - } -} - -func TestFromStringLong(t *testing.T) { - // Invalid 37+ character UUID string - s := []string{ - "6ba7b810-9dad-11d1-80b4-00c04fd430c8=", - "6ba7b810-9dad-11d1-80b4-00c04fd430c8}", - "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}f", - "6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8", - } - - for _, str := range s { - _, err := FromString(str) - if err == nil { - t.Errorf("Should return error trying to parse too long string, passed %s", str) - } - } -} - -func TestFromStringInvalid(t *testing.T) { - // Invalid UUID string formats - s := []string{ - "6ba7b8109dad11d180b400c04fd430c8", - "6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8", - "urn:uuid:{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", - "6ba7b8109-dad-11d1-80b4-00c04fd430c8", - "6ba7b810-9dad1-1d1-80b4-00c04fd430c8", - "6ba7b810-9dad-11d18-0b4-00c04fd430c8", - "6ba7b810-9dad-11d1-80b40-0c04fd430c8", - "6ba7b810+9dad+11d1+80b4+00c04fd430c8", - "6ba7b810-9dad11d180b400c04fd430c8", - "6ba7b8109dad-11d180b400c04fd430c8", - "6ba7b8109dad11d1-80b400c04fd430c8", - "6ba7b8109dad11d180b4-00c04fd430c8", - } - - for _, str := range s { - _, err := FromString(str) - if err == nil { - t.Errorf("Should return error trying to parse invalid string, passed %s", str) - } - } -} - -func TestFromStringOrNil(t *testing.T) { - u := FromStringOrNil("") - if u != Nil { - t.Errorf("Should return Nil UUID on parse failure, got %s", u) - } -} - -func TestFromBytesOrNil(t *testing.T) { - b := []byte{} - u := FromBytesOrNil(b) - if u != Nil { - t.Errorf("Should return Nil UUID on parse failure, got %s", u) - } -} - -func TestMarshalText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - b2, err := u.MarshalText() - if err != nil { - t.Errorf("Error marshaling UUID: %s", err) - } - - if !bytes.Equal(b1, b2) { - t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) - } -} - -func TestUnmarshalText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - u1 := UUID{} - err := u1.UnmarshalText(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte("") - u2 := UUID{} - - err = u2.UnmarshalText(b2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestValue(t *testing.T) { - u, err := FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - t.Errorf("Error parsing UUID from string: %s", err) - } - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != u.String() { - t.Errorf("Wrong value returned, should be equal: %s and %s", val, u) - } -} - -func TestValueNil(t *testing.T) { - u := UUID{} - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != Nil.String() { - t.Errorf("Wrong value returned, should be equal to UUID.Nil: %s", val) - } -} - -func TestNullUUIDValueNil(t *testing.T) { - u := NullUUID{} - - val, err := u.Value() - if err != nil { - t.Errorf("Error getting UUID value: %s", err) - } - - if val != nil { - t.Errorf("Wrong value returned, should be nil: %s", val) - } -} - -func TestScanBinary(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - u1 := UUID{} - err := u1.Scan(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte{} - u2 := UUID{} - - err = u2.Scan(b2) - if err == nil { - t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) - } -} - -func TestScanString(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - u1 := UUID{} - err := u1.Scan(s1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - s2 := "" - u2 := UUID{} - - err = u2.Scan(s2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestScanText(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - - u1 := UUID{} - err := u1.Scan(b1) - if err != nil { - t.Errorf("Error unmarshaling UUID: %s", err) - } - - if !Equal(u, u1) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1) - } - - b2 := []byte("") - u2 := UUID{} - - err = u2.Scan(b2) - if err == nil { - t.Errorf("Should return error trying to unmarshal from empty string") - } -} - -func TestScanUnsupported(t *testing.T) { - u := UUID{} - - err := u.Scan(true) - if err == nil { - t.Errorf("Should return error trying to unmarshal from bool") - } -} - -func TestScanNil(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - - err := u.Scan(nil) - if err == nil { - t.Errorf("Error UUID shouldn't allow unmarshalling from nil") - } -} - -func TestNullUUIDScanValid(t *testing.T) { - u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} - s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - - u1 := NullUUID{} - err := u1.Scan(s1) - if err != nil { - t.Errorf("Error unmarshaling NullUUID: %s", err) - } - - if !u1.Valid { - t.Errorf("NullUUID should be valid") - } - - if !Equal(u, u1.UUID) { - t.Errorf("UUIDs should be equal: %s and %s", u, u1.UUID) - } -} - -func TestNullUUIDScanNil(t *testing.T) { - u := NullUUID{UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, true} - - err := u.Scan(nil) - if err != nil { - t.Errorf("Error unmarshaling NullUUID: %s", err) - } - - if u.Valid { - t.Errorf("NullUUID should not be valid") - } - - if !Equal(u.UUID, Nil) { - t.Errorf("NullUUID value should be equal to Nil: %v", u) - } -} - -func TestNewV1(t *testing.T) { - u := NewV1() - - if u.Version() != 1 { - t.Errorf("UUIDv1 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv1 generated with incorrect variant: %d", u.Variant()) - } - - u1 := NewV1() - u2 := NewV1() - - if Equal(u1, u2) { - t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u1, u2) - } - - oldFunc := epochFunc - epochFunc = func() uint64 { return 0 } - - u3 := NewV1() - u4 := NewV1() - - if Equal(u3, u4) { - t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u3, u4) - } - - epochFunc = oldFunc -} - -func TestNewV2(t *testing.T) { - u1 := NewV2(DomainPerson) - - if u1.Version() != 2 { - t.Errorf("UUIDv2 generated with incorrect version: %d", u1.Version()) - } - - if u1.Variant() != VariantRFC4122 { - t.Errorf("UUIDv2 generated with incorrect variant: %d", u1.Variant()) - } - - u2 := NewV2(DomainGroup) - - if u2.Version() != 2 { - t.Errorf("UUIDv2 generated with incorrect version: %d", u2.Version()) - } - - if u2.Variant() != VariantRFC4122 { - t.Errorf("UUIDv2 generated with incorrect variant: %d", u2.Variant()) - } -} - -func TestNewV3(t *testing.T) { - u := NewV3(NamespaceDNS, "www.example.com") - - if u.Version() != 3 { - t.Errorf("UUIDv3 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv3 generated with incorrect variant: %d", u.Variant()) - } - - if u.String() != "5df41881-3aed-3515-88a7-2f4a814cf09e" { - t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) - } - - u = NewV3(NamespaceDNS, "python.org") - - if u.String() != "6fa459ea-ee8a-3ca4-894e-db77e160355e" { - t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) - } - - u1 := NewV3(NamespaceDNS, "golang.org") - u2 := NewV3(NamespaceDNS, "golang.org") - if !Equal(u1, u2) { - t.Errorf("UUIDv3 generated different UUIDs for same namespace and name: %s and %s", u1, u2) - } - - u3 := NewV3(NamespaceDNS, "example.com") - if Equal(u1, u3) { - t.Errorf("UUIDv3 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) - } - - u4 := NewV3(NamespaceURL, "golang.org") - if Equal(u1, u4) { - t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) - } -} - -func TestNewV4(t *testing.T) { - u := NewV4() - - if u.Version() != 4 { - t.Errorf("UUIDv4 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv4 generated with incorrect variant: %d", u.Variant()) - } -} - -func TestNewV5(t *testing.T) { - u := NewV5(NamespaceDNS, "www.example.com") - - if u.Version() != 5 { - t.Errorf("UUIDv5 generated with incorrect version: %d", u.Version()) - } - - if u.Variant() != VariantRFC4122 { - t.Errorf("UUIDv5 generated with incorrect variant: %d", u.Variant()) - } - - u = NewV5(NamespaceDNS, "python.org") - - if u.String() != "886313e1-3b8a-5372-9b90-0c9aee199e5d" { - t.Errorf("UUIDv5 generated incorrectly: %s", u.String()) - } - - u1 := NewV5(NamespaceDNS, "golang.org") - u2 := NewV5(NamespaceDNS, "golang.org") - if !Equal(u1, u2) { - t.Errorf("UUIDv5 generated different UUIDs for same namespace and name: %s and %s", u1, u2) - } - - u3 := NewV5(NamespaceDNS, "example.com") - if Equal(u1, u3) { - t.Errorf("UUIDv5 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) - } - - u4 := NewV5(NamespaceURL, "golang.org") - if Equal(u1, u4) { - t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) - } -} +// Copyright (C) 2013, 2015 by Maxim Bublis +// +// 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. + +package uuid + +import ( + "bytes" + "testing" +) + +func TestBytes(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + if !bytes.Equal(u.Bytes(), bytes1) { + t.Errorf("Incorrect bytes representation for UUID: %s", u) + } +} + +func TestString(t *testing.T) { + if NamespaceDNS.String() != "6ba7b810-9dad-11d1-80b4-00c04fd430c8" { + t.Errorf("Incorrect string representation for UUID: %s", NamespaceDNS.String()) + } +} + +func TestEqual(t *testing.T) { + if !Equal(NamespaceDNS, NamespaceDNS) { + t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceDNS) + } + + if Equal(NamespaceDNS, NamespaceURL) { + t.Errorf("Incorrect comparison of %s and %s", NamespaceDNS, NamespaceURL) + } +} + +func TestOr(t *testing.T) { + u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} + u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} + + u := UUID{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + + if !Equal(u, Or(u1, u2)) { + t.Errorf("Incorrect bitwise OR result %s", Or(u1, u2)) + } +} + +func TestAnd(t *testing.T) { + u1 := UUID{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff} + u2 := UUID{0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00} + + u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if !Equal(u, And(u1, u2)) { + t.Errorf("Incorrect bitwise AND result %s", And(u1, u2)) + } +} + +func TestVersion(t *testing.T) { + u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u.Version() != 1 { + t.Errorf("Incorrect version for UUID: %d", u.Version()) + } +} + +func TestSetVersion(t *testing.T) { + u := UUID{} + u.SetVersion(4) + + if u.Version() != 4 { + t.Errorf("Incorrect version for UUID after u.setVersion(4): %d", u.Version()) + } +} + +func TestVariant(t *testing.T) { + u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u1.Variant() != VariantNCS { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantNCS, u1.Variant()) + } + + u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u2.Variant() != VariantRFC4122 { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantRFC4122, u2.Variant()) + } + + u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u3.Variant() != VariantMicrosoft { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantMicrosoft, u3.Variant()) + } + + u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + + if u4.Variant() != VariantFuture { + t.Errorf("Incorrect variant for UUID variant %d: %d", VariantFuture, u4.Variant()) + } +} + +func TestSetVariant(t *testing.T) { + u := new(UUID) + u.SetVariant() + + if u.Variant() != VariantRFC4122 { + t.Errorf("Incorrect variant for UUID after u.setVariant(): %d", u.Variant()) + } +} + +func TestFromBytes(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + u1, err := FromBytes(b1) + if err != nil { + t.Errorf("Error parsing UUID from bytes: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte{} + + _, err = FromBytes(b2) + if err == nil { + t.Errorf("Should return error parsing from empty byte slice, got %s", err) + } +} + +func TestMarshalBinary(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + b2, err := u.MarshalBinary() + if err != nil { + t.Errorf("Error marshaling UUID: %s", err) + } + + if !bytes.Equal(b1, b2) { + t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) + } +} + +func TestUnmarshalBinary(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + u1 := UUID{} + err := u1.UnmarshalBinary(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte{} + u2 := UUID{} + + err = u2.UnmarshalBinary(b2) + if err == nil { + t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) + } +} + +func TestFromString(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + s2 := "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" + s3 := "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" + + _, err := FromString("") + if err == nil { + t.Errorf("Should return error trying to parse empty string, got %s", err) + } + + u1, err := FromString(s1) + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + u2, err := FromString(s2) + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + if !Equal(u, u2) { + t.Errorf("UUIDs should be equal: %s and %s", u, u2) + } + + u3, err := FromString(s3) + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + if !Equal(u, u3) { + t.Errorf("UUIDs should be equal: %s and %s", u, u3) + } +} + +func TestFromStringShort(t *testing.T) { + // Invalid 35-character UUID string + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c" + + for i := len(s1); i >= 0; i-- { + _, err := FromString(s1[:i]) + if err == nil { + t.Errorf("Should return error trying to parse too short string, got %s", err) + } + } +} + +func TestFromStringLong(t *testing.T) { + // Invalid 37+ character UUID string + s := []string{ + "6ba7b810-9dad-11d1-80b4-00c04fd430c8=", + "6ba7b810-9dad-11d1-80b4-00c04fd430c8}", + "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}f", + "6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8", + } + + for _, str := range s { + _, err := FromString(str) + if err == nil { + t.Errorf("Should return error trying to parse too long string, passed %s", str) + } + } +} + +func TestFromStringInvalid(t *testing.T) { + // Invalid UUID string formats + s := []string{ + "6ba7b8109dad11d180b400c04fd430c8", + "6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8", + "urn:uuid:{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", + "6ba7b8109-dad-11d1-80b4-00c04fd430c8", + "6ba7b810-9dad1-1d1-80b4-00c04fd430c8", + "6ba7b810-9dad-11d18-0b4-00c04fd430c8", + "6ba7b810-9dad-11d1-80b40-0c04fd430c8", + "6ba7b810+9dad+11d1+80b4+00c04fd430c8", + "6ba7b810-9dad11d180b400c04fd430c8", + "6ba7b8109dad-11d180b400c04fd430c8", + "6ba7b8109dad11d1-80b400c04fd430c8", + "6ba7b8109dad11d180b4-00c04fd430c8", + } + + for _, str := range s { + _, err := FromString(str) + if err == nil { + t.Errorf("Should return error trying to parse invalid string, passed %s", str) + } + } +} + +func TestFromStringOrNil(t *testing.T) { + u := FromStringOrNil("") + if u != Nil { + t.Errorf("Should return Nil UUID on parse failure, got %s", u) + } +} + +func TestFromBytesOrNil(t *testing.T) { + b := []byte{} + u := FromBytesOrNil(b) + if u != Nil { + t.Errorf("Should return Nil UUID on parse failure, got %s", u) + } +} + +func TestMarshalText(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + b2, err := u.MarshalText() + if err != nil { + t.Errorf("Error marshaling UUID: %s", err) + } + + if !bytes.Equal(b1, b2) { + t.Errorf("Marshaled UUID should be %s, got %s", b1, b2) + } +} + +func TestUnmarshalText(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + u1 := UUID{} + err := u1.UnmarshalText(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte("") + u2 := UUID{} + + err = u2.UnmarshalText(b2) + if err == nil { + t.Errorf("Should return error trying to unmarshal from empty string") + } +} + +func TestValue(t *testing.T) { + u, err := FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + if err != nil { + t.Errorf("Error parsing UUID from string: %s", err) + } + + val, err := u.Value() + if err != nil { + t.Errorf("Error getting UUID value: %s", err) + } + + if val != u.String() { + t.Errorf("Wrong value returned, should be equal: %s and %s", val, u) + } +} + +func TestValueNil(t *testing.T) { + u := UUID{} + + val, err := u.Value() + if err != nil { + t.Errorf("Error getting UUID value: %s", err) + } + + if val != Nil.String() { + t.Errorf("Wrong value returned, should be equal to UUID.Nil: %s", val) + } +} + +func TestNullUUIDValueNil(t *testing.T) { + u := NullUUID{} + + val, err := u.Value() + if err != nil { + t.Errorf("Error getting UUID value: %s", err) + } + + if val != nil { + t.Errorf("Wrong value returned, should be nil: %s", val) + } +} + +func TestScanBinary(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + u1 := UUID{} + err := u1.Scan(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte{} + u2 := UUID{} + + err = u2.Scan(b2) + if err == nil { + t.Errorf("Should return error unmarshalling from empty byte slice, got %s", err) + } +} + +func TestScanString(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + + u1 := UUID{} + err := u1.Scan(s1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + s2 := "" + u2 := UUID{} + + err = u2.Scan(s2) + if err == nil { + t.Errorf("Should return error trying to unmarshal from empty string") + } +} + +func TestScanText(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + b1 := []byte("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + u1 := UUID{} + err := u1.Scan(b1) + if err != nil { + t.Errorf("Error unmarshaling UUID: %s", err) + } + + if !Equal(u, u1) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1) + } + + b2 := []byte("") + u2 := UUID{} + + err = u2.Scan(b2) + if err == nil { + t.Errorf("Should return error trying to unmarshal from empty string") + } +} + +func TestScanUnsupported(t *testing.T) { + u := UUID{} + + err := u.Scan(true) + if err == nil { + t.Errorf("Should return error trying to unmarshal from bool") + } +} + +func TestScanNil(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + + err := u.Scan(nil) + if err == nil { + t.Errorf("Error UUID shouldn't allow unmarshalling from nil") + } +} + +func TestNullUUIDScanValid(t *testing.T) { + u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} + s1 := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + + u1 := NullUUID{} + err := u1.Scan(s1) + if err != nil { + t.Errorf("Error unmarshaling NullUUID: %s", err) + } + + if !u1.Valid { + t.Errorf("NullUUID should be valid") + } + + if !Equal(u, u1.UUID) { + t.Errorf("UUIDs should be equal: %s and %s", u, u1.UUID) + } +} + +func TestNullUUIDScanNil(t *testing.T) { + u := NullUUID{UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}, true} + + err := u.Scan(nil) + if err != nil { + t.Errorf("Error unmarshaling NullUUID: %s", err) + } + + if u.Valid { + t.Errorf("NullUUID should not be valid") + } + + if !Equal(u.UUID, Nil) { + t.Errorf("NullUUID value should be equal to Nil: %v", u) + } +} + +func TestNewV1(t *testing.T) { + u := NewV1() + + if u.Version() != 1 { + t.Errorf("UUIDv1 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv1 generated with incorrect variant: %d", u.Variant()) + } + + u1 := NewV1() + u2 := NewV1() + + if Equal(u1, u2) { + t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u1, u2) + } + + oldFunc := epochFunc + epochFunc = func() uint64 { return 0 } + + u3 := NewV1() + u4 := NewV1() + + if Equal(u3, u4) { + t.Errorf("UUIDv1 generated two equal UUIDs: %s and %s", u3, u4) + } + + epochFunc = oldFunc +} + +func TestNewV2(t *testing.T) { + u1 := NewV2(DomainPerson) + + if u1.Version() != 2 { + t.Errorf("UUIDv2 generated with incorrect version: %d", u1.Version()) + } + + if u1.Variant() != VariantRFC4122 { + t.Errorf("UUIDv2 generated with incorrect variant: %d", u1.Variant()) + } + + u2 := NewV2(DomainGroup) + + if u2.Version() != 2 { + t.Errorf("UUIDv2 generated with incorrect version: %d", u2.Version()) + } + + if u2.Variant() != VariantRFC4122 { + t.Errorf("UUIDv2 generated with incorrect variant: %d", u2.Variant()) + } +} + +func TestNewV3(t *testing.T) { + u := NewV3(NamespaceDNS, "www.example.com") + + if u.Version() != 3 { + t.Errorf("UUIDv3 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv3 generated with incorrect variant: %d", u.Variant()) + } + + if u.String() != "5df41881-3aed-3515-88a7-2f4a814cf09e" { + t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) + } + + u = NewV3(NamespaceDNS, "python.org") + + if u.String() != "6fa459ea-ee8a-3ca4-894e-db77e160355e" { + t.Errorf("UUIDv3 generated incorrectly: %s", u.String()) + } + + u1 := NewV3(NamespaceDNS, "golang.org") + u2 := NewV3(NamespaceDNS, "golang.org") + if !Equal(u1, u2) { + t.Errorf("UUIDv3 generated different UUIDs for same namespace and name: %s and %s", u1, u2) + } + + u3 := NewV3(NamespaceDNS, "example.com") + if Equal(u1, u3) { + t.Errorf("UUIDv3 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) + } + + u4 := NewV3(NamespaceURL, "golang.org") + if Equal(u1, u4) { + t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) + } +} + +func TestNewV4(t *testing.T) { + u := NewV4() + + if u.Version() != 4 { + t.Errorf("UUIDv4 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv4 generated with incorrect variant: %d", u.Variant()) + } +} + +func TestNewV5(t *testing.T) { + u := NewV5(NamespaceDNS, "www.example.com") + + if u.Version() != 5 { + t.Errorf("UUIDv5 generated with incorrect version: %d", u.Version()) + } + + if u.Variant() != VariantRFC4122 { + t.Errorf("UUIDv5 generated with incorrect variant: %d", u.Variant()) + } + + u = NewV5(NamespaceDNS, "python.org") + + if u.String() != "886313e1-3b8a-5372-9b90-0c9aee199e5d" { + t.Errorf("UUIDv5 generated incorrectly: %s", u.String()) + } + + u1 := NewV5(NamespaceDNS, "golang.org") + u2 := NewV5(NamespaceDNS, "golang.org") + if !Equal(u1, u2) { + t.Errorf("UUIDv5 generated different UUIDs for same namespace and name: %s and %s", u1, u2) + } + + u3 := NewV5(NamespaceDNS, "example.com") + if Equal(u1, u3) { + t.Errorf("UUIDv5 generated same UUIDs for different names in same namespace: %s and %s", u1, u2) + } + + u4 := NewV5(NamespaceURL, "golang.org") + if Equal(u1, u4) { + t.Errorf("UUIDv3 generated same UUIDs for sane names in different namespaces: %s and %s", u1, u4) + } +} diff --git a/vendor/github.com/spf13/cobra/.gitignore b/vendor/github.com/spf13/cobra/.gitignore index 99aca3d364..1b8c7c2611 100644 --- a/vendor/github.com/spf13/cobra/.gitignore +++ b/vendor/github.com/spf13/cobra/.gitignore @@ -1,36 +1,36 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -# Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore -# swap -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -# session -Session.vim -# temporary -.netrwhist -*~ -# auto-generated tag files -tags - -*.exe - -cobra.test +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +# Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +# session +Session.vim +# temporary +.netrwhist +*~ +# auto-generated tag files +tags + +*.exe + +cobra.test diff --git a/vendor/github.com/spf13/cobra/.mailmap b/vendor/github.com/spf13/cobra/.mailmap index b288569235..94ec53068a 100644 --- a/vendor/github.com/spf13/cobra/.mailmap +++ b/vendor/github.com/spf13/cobra/.mailmap @@ -1,3 +1,3 @@ -Steve Francia -Bjørn Erik Pedersen -Fabiano Franz +Steve Francia +Bjørn Erik Pedersen +Fabiano Franz diff --git a/vendor/github.com/spf13/cobra/.travis.yml b/vendor/github.com/spf13/cobra/.travis.yml index 0e918179ec..cb2bf0d5c2 100644 --- a/vendor/github.com/spf13/cobra/.travis.yml +++ b/vendor/github.com/spf13/cobra/.travis.yml @@ -1,21 +1,21 @@ -language: go - -matrix: - include: - - go: 1.7.5 - - go: 1.8.1 - - go: tip - allow_failures: - - go: tip - -before_install: - - mkdir -p bin - - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck - - chmod +x bin/shellcheck -script: - - PATH=$PATH:$PWD/bin go test -v ./... - - go build - - diff -u <(echo -n) <(gofmt -d -s .) - - if [ -z $NOVET ]; then - diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); - fi +language: go + +matrix: + include: + - go: 1.7.5 + - go: 1.8.1 + - go: tip + allow_failures: + - go: tip + +before_install: + - mkdir -p bin + - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck + - chmod +x bin/shellcheck +script: + - PATH=$PATH:$PWD/bin go test -v ./... + - go build + - diff -u <(echo -n) <(gofmt -d -s .) + - if [ -z $NOVET ]; then + diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); + fi diff --git a/vendor/github.com/spf13/cobra/LICENSE.txt b/vendor/github.com/spf13/cobra/LICENSE.txt index 2c7ff064ae..298f0e2665 100644 --- a/vendor/github.com/spf13/cobra/LICENSE.txt +++ b/vendor/github.com/spf13/cobra/LICENSE.txt @@ -1,174 +1,174 @@ - 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. + 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. diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index 9b9690f45d..4563c211d0 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -1,887 +1,887 @@ -![cobra logo](https://cloud.githubusercontent.com/assets/173412/10886352/ad566232-814f-11e5-9cd0-aa101788c117.png) - -Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files. - -Many of the most widely used Go projects are built using Cobra including: - -* [Kubernetes](http://kubernetes.io/) -* [Hugo](http://gohugo.io) -* [rkt](https://github.com/coreos/rkt) -* [etcd](https://github.com/coreos/etcd) -* [Moby (former Docker)](https://github.com/moby/moby) -* [Docker (distribution)](https://github.com/docker/distribution) -* [OpenShift](https://www.openshift.com/) -* [Delve](https://github.com/derekparker/delve) -* [GopherJS](http://www.gopherjs.org/) -* [CockroachDB](http://www.cockroachlabs.com/) -* [Bleve](http://www.blevesearch.com/) -* [ProjectAtomic (enterprise)](http://www.projectatomic.io/) -* [GiantSwarm's swarm](https://github.com/giantswarm/cli) -* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) -* [rclone](http://rclone.org/) - - -[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra) -[![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra) -[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra) - -![cobra](https://cloud.githubusercontent.com/assets/173412/10911369/84832a8e-8212-11e5-9f82-cc96660a4794.gif) - -# Overview - -Cobra is a library providing a simple interface to create powerful modern CLI -interfaces similar to git & go tools. - -Cobra is also an application that will generate your application scaffolding to rapidly -develop a Cobra-based application. - -Cobra provides: -* Easy subcommand-based CLIs: `app server`, `app fetch`, etc. -* Fully POSIX-compliant flags (including short & long versions) -* Nested subcommands -* Global, local and cascading flags -* Easy generation of applications & commands with `cobra init appname` & `cobra add cmdname` -* Intelligent suggestions (`app srver`... did you mean `app server`?) -* Automatic help generation for commands and flags -* Automatic detailed help for `app help [command]` -* Automatic help flag recognition of `-h`, `--help`, etc. -* Automatically generated bash autocomplete for your application -* Automatically generated man pages for your application -* Command aliases so you can change things without breaking them -* The flexibility to define your own help, usage, etc. -* Optional tight integration with [viper](http://github.com/spf13/viper) for 12-factor apps - -Cobra has an exceptionally clean interface and simple design without needless -constructors or initialization methods. - -Applications built with Cobra commands are designed to be as user-friendly as -possible. Flags can be placed before or after the command (as long as a -confusing space isn’t provided). Both short and long flags can be used. A -command need not even be fully typed. Help is automatically generated and -available for the application or for a specific command using either the help -command or the `--help` flag. - -# Concepts - -Cobra is built on a structure of commands, arguments & flags. - -**Commands** represent actions, **Args** are things and **Flags** are modifiers for those actions. - -The best applications will read like sentences when used. Users will know how -to use the application because they will natively understand how to use it. - -The pattern to follow is -`APPNAME VERB NOUN --ADJECTIVE.` - or -`APPNAME COMMAND ARG --FLAG` - -A few good real world examples may better illustrate this point. - -In the following example, 'server' is a command, and 'port' is a flag: - - hugo server --port=1313 - -In this command we are telling Git to clone the url bare. - - git clone URL --bare - -## Commands - -Command is the central point of the application. Each interaction that -the application supports will be contained in a Command. A command can -have children commands and optionally run an action. - -In the example above, 'server' is the command. - -A Command has the following structure: - -```go -type Command struct { - Use string // The one-line usage message. - Short string // The short description shown in the 'help' output. - Long string // The long message shown in the 'help ' output. - Run func(cmd *Command, args []string) // Run runs the command. -} -``` - -## Flags - -A Flag is a way to modify the behavior of a command. Cobra supports -fully POSIX-compliant flags as well as the Go [flag package](https://golang.org/pkg/flag/). -A Cobra command can define flags that persist through to children commands -and flags that are only available to that command. - -In the example above, 'port' is the flag. - -Flag functionality is provided by the [pflag -library](https://github.com/spf13/pflag), a fork of the flag standard library -which maintains the same interface while adding POSIX compliance. - -## Usage - -Cobra works by creating a set of commands and then organizing them into a tree. -The tree defines the structure of the application. - -Once each command is defined with its corresponding flags, then the -tree is assigned to the commander which is finally executed. - -# Installing -Using Cobra is easy. First, use `go get` to install the latest version -of the library. This command will install the `cobra` generator executible -along with the library: - - go get -v github.com/spf13/cobra/cobra - -Next, include Cobra in your application: - -```go -import "github.com/spf13/cobra" -``` - -# Getting Started - -While you are welcome to provide your own organization, typically a Cobra based -application will follow the following organizational structure. - -``` - ▾ appName/ - ▾ cmd/ - add.go - your.go - commands.go - here.go - main.go -``` - -In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra. - -```go -package main - -import ( - "fmt" - "os" - - "{pathToYourApp}/cmd" -) - -func main() { - if err := cmd.RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} -``` - -## Using the Cobra Generator - -Cobra provides its own program that will create your application and add any -commands you want. It's the easiest way to incorporate Cobra into your application. - -In order to use the cobra command, compile it using the following command: - - go get github.com/spf13/cobra/cobra - -This will create the cobra executable under your `$GOPATH/bin` directory. - -### cobra init - -The `cobra init [yourApp]` command will create your initial application code -for you. It is a very powerful application that will populate your program with -the right structure so you can immediately enjoy all the benefits of Cobra. It -will also automatically apply the license you specify to your application. - -Cobra init is pretty smart. You can provide it a full path, or simply a path -similar to what is expected in the import. - -``` -cobra init github.com/spf13/newAppName -``` - -### cobra add - -Once an application is initialized Cobra can create additional commands for you. -Let's say you created an app and you wanted the following commands for it: - -* app serve -* app config -* app config create - -In your project directory (where your main.go file is) you would run the following: - -``` -cobra add serve -cobra add config -cobra add create -p 'configCmd' -``` - -*Note: Use camelCase (not snake_case/snake-case) for command names. -Otherwise, you will become unexpected errors. -For example, `cobra add add-user` is incorrect, but `cobra add addUser` is valid.* - -Once you have run these three commands you would have an app structure that would look like: - -``` - ▾ app/ - ▾ cmd/ - serve.go - config.go - create.go - main.go -``` - -at this point you can run `go run main.go` and it would run your app. `go run -main.go serve`, `go run main.go config`, `go run main.go config create` along -with `go run main.go help serve`, etc would all work. - -Obviously you haven't added your own code to these yet, the commands are ready -for you to give them their tasks. Have fun. - -### Configuring the cobra generator - -The cobra generator will be easier to use if you provide a simple configuration -file which will help you eliminate providing a bunch of repeated information in -flags over and over. - -An example ~/.cobra.yaml file: - -```yaml -author: Steve Francia -license: MIT -``` - -You can specify no license by setting `license` to `none` or you can specify -a custom license: - -```yaml -license: - header: This file is part of {{ .appName }}. - text: | - {{ .copyright }} - - This is my license. There are many like it, but this one is mine. - My license is my best friend. It is my life. I must master it as I must - master my life. -``` - -You can also use built-in licenses. For example, **GPLv2**, **GPLv3**, **LGPL**, -**AGPL**, **MIT**, **2-Clause BSD** or **3-Clause BSD**. - -## Manually implementing Cobra - -To manually implement cobra you need to create a bare main.go file and a RootCmd file. -You will optionally provide additional commands as you see fit. - -### Create the root command - -The root command represents your binary itself. - - -#### Manually create rootCmd - -Cobra doesn't require any special constructors. Simply create your commands. - -Ideally you place this in app/cmd/root.go: - -```go -var RootCmd = &cobra.Command{ - Use: "hugo", - Short: "Hugo is a very fast static site generator", - Long: `A Fast and Flexible Static Site Generator built with - love by spf13 and friends in Go. - Complete documentation is available at http://hugo.spf13.com`, - Run: func(cmd *cobra.Command, args []string) { - // Do Stuff Here - }, -} -``` - -You will additionally define flags and handle configuration in your init() function. - -for example cmd/root.go: - -```go -func init() { - cobra.OnInitialize(initConfig) - RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") - RootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory eg. github.com/spf13/") - RootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution") - RootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)") - RootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") - viper.BindPFlag("author", RootCmd.PersistentFlags().Lookup("author")) - viper.BindPFlag("projectbase", RootCmd.PersistentFlags().Lookup("projectbase")) - viper.BindPFlag("useViper", RootCmd.PersistentFlags().Lookup("viper")) - viper.SetDefault("author", "NAME HERE ") - viper.SetDefault("license", "apache") -} -``` - -### Create your main.go - -With the root command you need to have your main function execute it. -Execute should be run on the root for clarity, though it can be called on any command. - -In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra. - -```go -package main - -import ( - "fmt" - "os" - - "{pathToYourApp}/cmd" -) - -func main() { - if err := cmd.RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} -``` - - -### Create additional commands - -Additional commands can be defined and typically are each given their own file -inside of the cmd/ directory. - -If you wanted to create a version command you would create cmd/version.go and -populate it with the following: - -```go -package cmd - -import ( - "github.com/spf13/cobra" - "fmt" -) - -func init() { - RootCmd.AddCommand(versionCmd) -} - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number of Hugo", - Long: `All software has versions. This is Hugo's`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hugo Static Site Generator v0.9 -- HEAD") - }, -} -``` - -### Attach command to its parent - - -If you notice in the above example we attach the command to its parent. In -this case the parent is the rootCmd. In this example we are attaching it to the -root, but commands can be attached at any level. - -```go -RootCmd.AddCommand(versionCmd) -``` - -### Remove a command from its parent - -Removing a command is not a common action in simple programs, but it allows 3rd -parties to customize an existing command tree. - -In this example, we remove the existing `VersionCmd` command of an existing -root command, and we replace it with our own version: - -```go -mainlib.RootCmd.RemoveCommand(mainlib.VersionCmd) -mainlib.RootCmd.AddCommand(versionCmd) -``` - -## Working with Flags - -Flags provide modifiers to control how the action command operates. - -### Assign flags to a command - -Since the flags are defined and used in different locations, we need to -define a variable outside with the correct scope to assign the flag to -work with. - -```go -var Verbose bool -var Source string -``` - -There are two different approaches to assign a flag. - -### Persistent Flags - -A flag can be 'persistent' meaning that this flag will be available to the -command it's assigned to as well as every command under that command. For -global flags, assign a flag as a persistent flag on the root. - -```go -RootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") -``` - -### Local Flags - -A flag can also be assigned locally which will only apply to that specific command. - -```go -RootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") -``` - - -## Example - -In the example below, we have defined three commands. Two are at the top level -and one (cmdTimes) is a child of one of the top commands. In this case the root -is not executable meaning that a subcommand is required. This is accomplished -by not providing a 'Run' for the 'rootCmd'. - -We have only defined one flag for a single command. - -More documentation about flags is available at https://github.com/spf13/pflag - -```go -package main - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" -) - -func main() { - - var echoTimes int - - var cmdPrint = &cobra.Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `print is for printing anything back to the screen. - For many years people have printed back to the screen. - `, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Print: " + strings.Join(args, " ")) - }, - } - - var cmdEcho = &cobra.Command{ - Use: "echo [string to echo]", - Short: "Echo anything to the screen", - Long: `echo is for echoing anything back. - Echo works a lot like print, except it has a child command. - `, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Print: " + strings.Join(args, " ")) - }, - } - - var cmdTimes = &cobra.Command{ - Use: "times [# times] [string to echo]", - Short: "Echo anything to the screen more times", - Long: `echo things multiple times back to the user by providing - a count and a string.`, - Run: func(cmd *cobra.Command, args []string) { - for i := 0; i < echoTimes; i++ { - fmt.Println("Echo: " + strings.Join(args, " ")) - } - }, - } - - cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") - - var rootCmd = &cobra.Command{Use: "app"} - rootCmd.AddCommand(cmdPrint, cmdEcho) - cmdEcho.AddCommand(cmdTimes) - rootCmd.Execute() -} -``` - -For a more complete example of a larger application, please checkout [Hugo](http://gohugo.io/). - -## The Help Command - -Cobra automatically adds a help command to your application when you have subcommands. -This will be called when a user runs 'app help'. Additionally, help will also -support all other commands as input. Say, for instance, you have a command called -'create' without any additional configuration; Cobra will work when 'app help -create' is called. Every command will automatically have the '--help' flag added. - -### Example - -The following output is automatically generated by Cobra. Nothing beyond the -command and flag definitions are needed. - - > hugo help - - hugo is the main command, used to build your Hugo site. - - Hugo is a Fast and Flexible Static Site Generator - built with love by spf13 and friends in Go. - - Complete documentation is available at http://gohugo.io/. - - Usage: - hugo [flags] - hugo [command] - - Available Commands: - server Hugo runs its own webserver to render the files - version Print the version number of Hugo - config Print the site configuration - check Check content in the source directory - benchmark Benchmark hugo by building a site a number of times. - convert Convert your content to different formats - new Create new content for your site - list Listing out various types of content - undraft Undraft changes the content's draft status from 'True' to 'False' - genautocomplete Generate shell autocompletion script for Hugo - gendoc Generate Markdown documentation for the Hugo CLI. - genman Generate man page for Hugo - import Import your site from others. - - Flags: - -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ - -D, --buildDrafts[=false]: include content marked as draft - -F, --buildFuture[=false]: include content with publishdate in the future - --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ - --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL - --config="": config file (default is path/config.yaml|json|toml) - -d, --destination="": filesystem path to write files to - --disableRSS[=false]: Do not build RSS files - --disableSitemap[=false]: Do not build Sitemap file - --editor="": edit new content with this editor, if provided - --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it - --log[=false]: Enable Logging - --logFile="": Log File path (if set, logging enabled automatically) - --noTimes[=false]: Don't sync modification time of files - --pluralizeListTitles[=true]: Pluralize titles in lists using inflect - --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") - -s, --source="": filesystem path to read files relative from - --stepAnalysis[=false]: display memory and timing of different steps of the program - -t, --theme="": theme to use (located in /themes/THEMENAME/) - --uglyURLs[=false]: if true, use /filename.html instead of /filename/ - -v, --verbose[=false]: verbose output - --verboseLog[=false]: verbose logging - -w, --watch[=false]: watch filesystem for changes and recreate as needed - - Use "hugo [command] --help" for more information about a command. - - -Help is just a command like any other. There is no special logic or behavior -around it. In fact, you can provide your own if you want. - -### Defining your own help - -You can provide your own Help command or your own template for the default command to use. - -The default help command is - -```go -func (c *Command) initHelp() { - if c.helpCommand == nil { - c.helpCommand = &Command{ - Use: "help [command]", - Short: "Help about any command", - Long: `Help provides help for any command in the application. - Simply type ` + c.Name() + ` help [path to command] for full details.`, - Run: c.HelpFunc(), - } - } - c.AddCommand(c.helpCommand) -} -``` - -You can provide your own command, function or template through the following methods: - -```go -command.SetHelpCommand(cmd *Command) - -command.SetHelpFunc(f func(*Command, []string)) - -command.SetHelpTemplate(s string) -``` - -The latter two will also apply to any children commands. - -## Usage - -When the user provides an invalid flag or invalid command, Cobra responds by -showing the user the 'usage'. - -### Example -You may recognize this from the help above. That's because the default help -embeds the usage as part of its output. - - Usage: - hugo [flags] - hugo [command] - - Available Commands: - server Hugo runs its own webserver to render the files - version Print the version number of Hugo - config Print the site configuration - check Check content in the source directory - benchmark Benchmark hugo by building a site a number of times. - convert Convert your content to different formats - new Create new content for your site - list Listing out various types of content - undraft Undraft changes the content's draft status from 'True' to 'False' - genautocomplete Generate shell autocompletion script for Hugo - gendoc Generate Markdown documentation for the Hugo CLI. - genman Generate man page for Hugo - import Import your site from others. - - Flags: - -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ - -D, --buildDrafts[=false]: include content marked as draft - -F, --buildFuture[=false]: include content with publishdate in the future - --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ - --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL - --config="": config file (default is path/config.yaml|json|toml) - -d, --destination="": filesystem path to write files to - --disableRSS[=false]: Do not build RSS files - --disableSitemap[=false]: Do not build Sitemap file - --editor="": edit new content with this editor, if provided - --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it - --log[=false]: Enable Logging - --logFile="": Log File path (if set, logging enabled automatically) - --noTimes[=false]: Don't sync modification time of files - --pluralizeListTitles[=true]: Pluralize titles in lists using inflect - --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") - -s, --source="": filesystem path to read files relative from - --stepAnalysis[=false]: display memory and timing of different steps of the program - -t, --theme="": theme to use (located in /themes/THEMENAME/) - --uglyURLs[=false]: if true, use /filename.html instead of /filename/ - -v, --verbose[=false]: verbose output - --verboseLog[=false]: verbose logging - -w, --watch[=false]: watch filesystem for changes and recreate as needed - -### Defining your own usage -You can provide your own usage function or template for Cobra to use. - -The default usage function is: - -```go -return func(c *Command) error { - err := tmpl(c.Out(), c.UsageTemplate(), c) - return err -} -``` - -Like help, the function and template are overridable through public methods: - -```go -command.SetUsageFunc(f func(*Command) error) - -command.SetUsageTemplate(s string) -``` - -## PreRun or PostRun Hooks - -It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order: - -- `PersistentPreRun` -- `PreRun` -- `Run` -- `PostRun` -- `PersistentPostRun` - -An example of two commands which use all of these features is below. When the subcommand is executed, it will run the root command's `PersistentPreRun` but not the root command's `PersistentPostRun`: - -```go -package main - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -func main() { - - var rootCmd = &cobra.Command{ - Use: "root [sub]", - Short: "My root command", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args) - }, - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args) - }, - } - - var subCmd = &cobra.Command{ - Use: "sub [no options!]", - Short: "My subcommand", - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args) - }, - } - - rootCmd.AddCommand(subCmd) - - rootCmd.SetArgs([]string{""}) - _ = rootCmd.Execute() - fmt.Print("\n") - rootCmd.SetArgs([]string{"sub", "arg1", "arg2"}) - _ = rootCmd.Execute() -} -``` - - -## Alternative Error Handling - -Cobra also has functions where the return signature is an error. This allows for errors to bubble up to the top, -providing a way to handle the errors in one location. The current list of functions that return an error is: - -* PersistentPreRunE -* PreRunE -* RunE -* PostRunE -* PersistentPostRunE - -If you would like to silence the default `error` and `usage` output in favor of your own, you can set `SilenceUsage` -and `SilenceErrors` to `true` on the command. A child command respects these flags if they are set on the parent -command. - -**Example Usage using RunE:** - -```go -package main - -import ( - "errors" - "log" - - "github.com/spf13/cobra" -) - -func main() { - var rootCmd = &cobra.Command{ - Use: "hugo", - Short: "Hugo is a very fast static site generator", - Long: `A Fast and Flexible Static Site Generator built with - love by spf13 and friends in Go. - Complete documentation is available at http://hugo.spf13.com`, - RunE: func(cmd *cobra.Command, args []string) error { - // Do Stuff Here - return errors.New("some random error") - }, - } - - if err := rootCmd.Execute(); err != nil { - log.Fatal(err) - } -} -``` - -## Suggestions when "unknown command" happens - -Cobra will print automatic suggestions when "unknown command" errors happen. This allows Cobra to behave similarly to the `git` command when a typo happens. For example: - -``` -$ hugo srever -Error: unknown command "srever" for "hugo" - -Did you mean this? - server - -Run 'hugo --help' for usage. -``` - -Suggestions are automatic based on every subcommand registered and use an implementation of [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance). Every registered command that matches a minimum distance of 2 (ignoring case) will be displayed as a suggestion. - -If you need to disable suggestions or tweak the string distance in your command, use: - -```go -command.DisableSuggestions = true -``` - -or - -```go -command.SuggestionsMinimumDistance = 1 -``` - -You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but makes sense in your set of commands and for some which you don't want aliases. Example: - -``` -$ kubectl remove -Error: unknown command "remove" for "kubectl" - -Did you mean this? - delete - -Run 'kubectl help' for usage. -``` - -## Generating Markdown-formatted documentation for your command - -Cobra can generate a Markdown-formatted document based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Markdown Docs](doc/md_docs.md). - -## Generating man pages for your command - -Cobra can generate a man page based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Man Docs](doc/man_docs.md). - -## Generating bash completions for your command - -Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible. Read more about it in [Bash Completions](bash_completions.md). - -## Debugging - -Cobra provides a ‘DebugFlags’ method on a command which, when called, will print -out everything Cobra knows about the flags for each command. - -### Example - -```go -command.DebugFlags() -``` - -## Extensions - -Libraries for extending Cobra: - -* [cmdns](https://github.com/gosuri/cmdns): Enables name spacing a command's immediate children. It provides an alternative way to structure subcommands, similar to `heroku apps:create` and `ovrclk clusters:launch`. - -## Contributing - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request - -## Contributors - -Names in no particular order: - -* [spf13](https://github.com/spf13), -[eparis](https://github.com/eparis), -[bep](https://github.com/bep), and many more! - -## License - -Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt) +![cobra logo](https://cloud.githubusercontent.com/assets/173412/10886352/ad566232-814f-11e5-9cd0-aa101788c117.png) + +Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files. + +Many of the most widely used Go projects are built using Cobra including: + +* [Kubernetes](http://kubernetes.io/) +* [Hugo](http://gohugo.io) +* [rkt](https://github.com/coreos/rkt) +* [etcd](https://github.com/coreos/etcd) +* [Moby (former Docker)](https://github.com/moby/moby) +* [Docker (distribution)](https://github.com/docker/distribution) +* [OpenShift](https://www.openshift.com/) +* [Delve](https://github.com/derekparker/delve) +* [GopherJS](http://www.gopherjs.org/) +* [CockroachDB](http://www.cockroachlabs.com/) +* [Bleve](http://www.blevesearch.com/) +* [ProjectAtomic (enterprise)](http://www.projectatomic.io/) +* [GiantSwarm's swarm](https://github.com/giantswarm/cli) +* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) +* [rclone](http://rclone.org/) + + +[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra) +[![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra) +[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra) + +![cobra](https://cloud.githubusercontent.com/assets/173412/10911369/84832a8e-8212-11e5-9f82-cc96660a4794.gif) + +# Overview + +Cobra is a library providing a simple interface to create powerful modern CLI +interfaces similar to git & go tools. + +Cobra is also an application that will generate your application scaffolding to rapidly +develop a Cobra-based application. + +Cobra provides: +* Easy subcommand-based CLIs: `app server`, `app fetch`, etc. +* Fully POSIX-compliant flags (including short & long versions) +* Nested subcommands +* Global, local and cascading flags +* Easy generation of applications & commands with `cobra init appname` & `cobra add cmdname` +* Intelligent suggestions (`app srver`... did you mean `app server`?) +* Automatic help generation for commands and flags +* Automatic detailed help for `app help [command]` +* Automatic help flag recognition of `-h`, `--help`, etc. +* Automatically generated bash autocomplete for your application +* Automatically generated man pages for your application +* Command aliases so you can change things without breaking them +* The flexibility to define your own help, usage, etc. +* Optional tight integration with [viper](http://github.com/spf13/viper) for 12-factor apps + +Cobra has an exceptionally clean interface and simple design without needless +constructors or initialization methods. + +Applications built with Cobra commands are designed to be as user-friendly as +possible. Flags can be placed before or after the command (as long as a +confusing space isn’t provided). Both short and long flags can be used. A +command need not even be fully typed. Help is automatically generated and +available for the application or for a specific command using either the help +command or the `--help` flag. + +# Concepts + +Cobra is built on a structure of commands, arguments & flags. + +**Commands** represent actions, **Args** are things and **Flags** are modifiers for those actions. + +The best applications will read like sentences when used. Users will know how +to use the application because they will natively understand how to use it. + +The pattern to follow is +`APPNAME VERB NOUN --ADJECTIVE.` + or +`APPNAME COMMAND ARG --FLAG` + +A few good real world examples may better illustrate this point. + +In the following example, 'server' is a command, and 'port' is a flag: + + hugo server --port=1313 + +In this command we are telling Git to clone the url bare. + + git clone URL --bare + +## Commands + +Command is the central point of the application. Each interaction that +the application supports will be contained in a Command. A command can +have children commands and optionally run an action. + +In the example above, 'server' is the command. + +A Command has the following structure: + +```go +type Command struct { + Use string // The one-line usage message. + Short string // The short description shown in the 'help' output. + Long string // The long message shown in the 'help ' output. + Run func(cmd *Command, args []string) // Run runs the command. +} +``` + +## Flags + +A Flag is a way to modify the behavior of a command. Cobra supports +fully POSIX-compliant flags as well as the Go [flag package](https://golang.org/pkg/flag/). +A Cobra command can define flags that persist through to children commands +and flags that are only available to that command. + +In the example above, 'port' is the flag. + +Flag functionality is provided by the [pflag +library](https://github.com/spf13/pflag), a fork of the flag standard library +which maintains the same interface while adding POSIX compliance. + +## Usage + +Cobra works by creating a set of commands and then organizing them into a tree. +The tree defines the structure of the application. + +Once each command is defined with its corresponding flags, then the +tree is assigned to the commander which is finally executed. + +# Installing +Using Cobra is easy. First, use `go get` to install the latest version +of the library. This command will install the `cobra` generator executible +along with the library: + + go get -v github.com/spf13/cobra/cobra + +Next, include Cobra in your application: + +```go +import "github.com/spf13/cobra" +``` + +# Getting Started + +While you are welcome to provide your own organization, typically a Cobra based +application will follow the following organizational structure. + +``` + ▾ appName/ + ▾ cmd/ + add.go + your.go + commands.go + here.go + main.go +``` + +In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra. + +```go +package main + +import ( + "fmt" + "os" + + "{pathToYourApp}/cmd" +) + +func main() { + if err := cmd.RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} +``` + +## Using the Cobra Generator + +Cobra provides its own program that will create your application and add any +commands you want. It's the easiest way to incorporate Cobra into your application. + +In order to use the cobra command, compile it using the following command: + + go get github.com/spf13/cobra/cobra + +This will create the cobra executable under your `$GOPATH/bin` directory. + +### cobra init + +The `cobra init [yourApp]` command will create your initial application code +for you. It is a very powerful application that will populate your program with +the right structure so you can immediately enjoy all the benefits of Cobra. It +will also automatically apply the license you specify to your application. + +Cobra init is pretty smart. You can provide it a full path, or simply a path +similar to what is expected in the import. + +``` +cobra init github.com/spf13/newAppName +``` + +### cobra add + +Once an application is initialized Cobra can create additional commands for you. +Let's say you created an app and you wanted the following commands for it: + +* app serve +* app config +* app config create + +In your project directory (where your main.go file is) you would run the following: + +``` +cobra add serve +cobra add config +cobra add create -p 'configCmd' +``` + +*Note: Use camelCase (not snake_case/snake-case) for command names. +Otherwise, you will become unexpected errors. +For example, `cobra add add-user` is incorrect, but `cobra add addUser` is valid.* + +Once you have run these three commands you would have an app structure that would look like: + +``` + ▾ app/ + ▾ cmd/ + serve.go + config.go + create.go + main.go +``` + +at this point you can run `go run main.go` and it would run your app. `go run +main.go serve`, `go run main.go config`, `go run main.go config create` along +with `go run main.go help serve`, etc would all work. + +Obviously you haven't added your own code to these yet, the commands are ready +for you to give them their tasks. Have fun. + +### Configuring the cobra generator + +The cobra generator will be easier to use if you provide a simple configuration +file which will help you eliminate providing a bunch of repeated information in +flags over and over. + +An example ~/.cobra.yaml file: + +```yaml +author: Steve Francia +license: MIT +``` + +You can specify no license by setting `license` to `none` or you can specify +a custom license: + +```yaml +license: + header: This file is part of {{ .appName }}. + text: | + {{ .copyright }} + + This is my license. There are many like it, but this one is mine. + My license is my best friend. It is my life. I must master it as I must + master my life. +``` + +You can also use built-in licenses. For example, **GPLv2**, **GPLv3**, **LGPL**, +**AGPL**, **MIT**, **2-Clause BSD** or **3-Clause BSD**. + +## Manually implementing Cobra + +To manually implement cobra you need to create a bare main.go file and a RootCmd file. +You will optionally provide additional commands as you see fit. + +### Create the root command + +The root command represents your binary itself. + + +#### Manually create rootCmd + +Cobra doesn't require any special constructors. Simply create your commands. + +Ideally you place this in app/cmd/root.go: + +```go +var RootCmd = &cobra.Command{ + Use: "hugo", + Short: "Hugo is a very fast static site generator", + Long: `A Fast and Flexible Static Site Generator built with + love by spf13 and friends in Go. + Complete documentation is available at http://hugo.spf13.com`, + Run: func(cmd *cobra.Command, args []string) { + // Do Stuff Here + }, +} +``` + +You will additionally define flags and handle configuration in your init() function. + +for example cmd/root.go: + +```go +func init() { + cobra.OnInitialize(initConfig) + RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") + RootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory eg. github.com/spf13/") + RootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution") + RootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)") + RootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") + viper.BindPFlag("author", RootCmd.PersistentFlags().Lookup("author")) + viper.BindPFlag("projectbase", RootCmd.PersistentFlags().Lookup("projectbase")) + viper.BindPFlag("useViper", RootCmd.PersistentFlags().Lookup("viper")) + viper.SetDefault("author", "NAME HERE ") + viper.SetDefault("license", "apache") +} +``` + +### Create your main.go + +With the root command you need to have your main function execute it. +Execute should be run on the root for clarity, though it can be called on any command. + +In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra. + +```go +package main + +import ( + "fmt" + "os" + + "{pathToYourApp}/cmd" +) + +func main() { + if err := cmd.RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} +``` + + +### Create additional commands + +Additional commands can be defined and typically are each given their own file +inside of the cmd/ directory. + +If you wanted to create a version command you would create cmd/version.go and +populate it with the following: + +```go +package cmd + +import ( + "github.com/spf13/cobra" + "fmt" +) + +func init() { + RootCmd.AddCommand(versionCmd) +} + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print the version number of Hugo", + Long: `All software has versions. This is Hugo's`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Hugo Static Site Generator v0.9 -- HEAD") + }, +} +``` + +### Attach command to its parent + + +If you notice in the above example we attach the command to its parent. In +this case the parent is the rootCmd. In this example we are attaching it to the +root, but commands can be attached at any level. + +```go +RootCmd.AddCommand(versionCmd) +``` + +### Remove a command from its parent + +Removing a command is not a common action in simple programs, but it allows 3rd +parties to customize an existing command tree. + +In this example, we remove the existing `VersionCmd` command of an existing +root command, and we replace it with our own version: + +```go +mainlib.RootCmd.RemoveCommand(mainlib.VersionCmd) +mainlib.RootCmd.AddCommand(versionCmd) +``` + +## Working with Flags + +Flags provide modifiers to control how the action command operates. + +### Assign flags to a command + +Since the flags are defined and used in different locations, we need to +define a variable outside with the correct scope to assign the flag to +work with. + +```go +var Verbose bool +var Source string +``` + +There are two different approaches to assign a flag. + +### Persistent Flags + +A flag can be 'persistent' meaning that this flag will be available to the +command it's assigned to as well as every command under that command. For +global flags, assign a flag as a persistent flag on the root. + +```go +RootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") +``` + +### Local Flags + +A flag can also be assigned locally which will only apply to that specific command. + +```go +RootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") +``` + + +## Example + +In the example below, we have defined three commands. Two are at the top level +and one (cmdTimes) is a child of one of the top commands. In this case the root +is not executable meaning that a subcommand is required. This is accomplished +by not providing a 'Run' for the 'rootCmd'. + +We have only defined one flag for a single command. + +More documentation about flags is available at https://github.com/spf13/pflag + +```go +package main + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" +) + +func main() { + + var echoTimes int + + var cmdPrint = &cobra.Command{ + Use: "print [string to print]", + Short: "Print anything to the screen", + Long: `print is for printing anything back to the screen. + For many years people have printed back to the screen. + `, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Print: " + strings.Join(args, " ")) + }, + } + + var cmdEcho = &cobra.Command{ + Use: "echo [string to echo]", + Short: "Echo anything to the screen", + Long: `echo is for echoing anything back. + Echo works a lot like print, except it has a child command. + `, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Print: " + strings.Join(args, " ")) + }, + } + + var cmdTimes = &cobra.Command{ + Use: "times [# times] [string to echo]", + Short: "Echo anything to the screen more times", + Long: `echo things multiple times back to the user by providing + a count and a string.`, + Run: func(cmd *cobra.Command, args []string) { + for i := 0; i < echoTimes; i++ { + fmt.Println("Echo: " + strings.Join(args, " ")) + } + }, + } + + cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") + + var rootCmd = &cobra.Command{Use: "app"} + rootCmd.AddCommand(cmdPrint, cmdEcho) + cmdEcho.AddCommand(cmdTimes) + rootCmd.Execute() +} +``` + +For a more complete example of a larger application, please checkout [Hugo](http://gohugo.io/). + +## The Help Command + +Cobra automatically adds a help command to your application when you have subcommands. +This will be called when a user runs 'app help'. Additionally, help will also +support all other commands as input. Say, for instance, you have a command called +'create' without any additional configuration; Cobra will work when 'app help +create' is called. Every command will automatically have the '--help' flag added. + +### Example + +The following output is automatically generated by Cobra. Nothing beyond the +command and flag definitions are needed. + + > hugo help + + hugo is the main command, used to build your Hugo site. + + Hugo is a Fast and Flexible Static Site Generator + built with love by spf13 and friends in Go. + + Complete documentation is available at http://gohugo.io/. + + Usage: + hugo [flags] + hugo [command] + + Available Commands: + server Hugo runs its own webserver to render the files + version Print the version number of Hugo + config Print the site configuration + check Check content in the source directory + benchmark Benchmark hugo by building a site a number of times. + convert Convert your content to different formats + new Create new content for your site + list Listing out various types of content + undraft Undraft changes the content's draft status from 'True' to 'False' + genautocomplete Generate shell autocompletion script for Hugo + gendoc Generate Markdown documentation for the Hugo CLI. + genman Generate man page for Hugo + import Import your site from others. + + Flags: + -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ + -D, --buildDrafts[=false]: include content marked as draft + -F, --buildFuture[=false]: include content with publishdate in the future + --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ + --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL + --config="": config file (default is path/config.yaml|json|toml) + -d, --destination="": filesystem path to write files to + --disableRSS[=false]: Do not build RSS files + --disableSitemap[=false]: Do not build Sitemap file + --editor="": edit new content with this editor, if provided + --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it + --log[=false]: Enable Logging + --logFile="": Log File path (if set, logging enabled automatically) + --noTimes[=false]: Don't sync modification time of files + --pluralizeListTitles[=true]: Pluralize titles in lists using inflect + --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") + -s, --source="": filesystem path to read files relative from + --stepAnalysis[=false]: display memory and timing of different steps of the program + -t, --theme="": theme to use (located in /themes/THEMENAME/) + --uglyURLs[=false]: if true, use /filename.html instead of /filename/ + -v, --verbose[=false]: verbose output + --verboseLog[=false]: verbose logging + -w, --watch[=false]: watch filesystem for changes and recreate as needed + + Use "hugo [command] --help" for more information about a command. + + +Help is just a command like any other. There is no special logic or behavior +around it. In fact, you can provide your own if you want. + +### Defining your own help + +You can provide your own Help command or your own template for the default command to use. + +The default help command is + +```go +func (c *Command) initHelp() { + if c.helpCommand == nil { + c.helpCommand = &Command{ + Use: "help [command]", + Short: "Help about any command", + Long: `Help provides help for any command in the application. + Simply type ` + c.Name() + ` help [path to command] for full details.`, + Run: c.HelpFunc(), + } + } + c.AddCommand(c.helpCommand) +} +``` + +You can provide your own command, function or template through the following methods: + +```go +command.SetHelpCommand(cmd *Command) + +command.SetHelpFunc(f func(*Command, []string)) + +command.SetHelpTemplate(s string) +``` + +The latter two will also apply to any children commands. + +## Usage + +When the user provides an invalid flag or invalid command, Cobra responds by +showing the user the 'usage'. + +### Example +You may recognize this from the help above. That's because the default help +embeds the usage as part of its output. + + Usage: + hugo [flags] + hugo [command] + + Available Commands: + server Hugo runs its own webserver to render the files + version Print the version number of Hugo + config Print the site configuration + check Check content in the source directory + benchmark Benchmark hugo by building a site a number of times. + convert Convert your content to different formats + new Create new content for your site + list Listing out various types of content + undraft Undraft changes the content's draft status from 'True' to 'False' + genautocomplete Generate shell autocompletion script for Hugo + gendoc Generate Markdown documentation for the Hugo CLI. + genman Generate man page for Hugo + import Import your site from others. + + Flags: + -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ + -D, --buildDrafts[=false]: include content marked as draft + -F, --buildFuture[=false]: include content with publishdate in the future + --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ + --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL + --config="": config file (default is path/config.yaml|json|toml) + -d, --destination="": filesystem path to write files to + --disableRSS[=false]: Do not build RSS files + --disableSitemap[=false]: Do not build Sitemap file + --editor="": edit new content with this editor, if provided + --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it + --log[=false]: Enable Logging + --logFile="": Log File path (if set, logging enabled automatically) + --noTimes[=false]: Don't sync modification time of files + --pluralizeListTitles[=true]: Pluralize titles in lists using inflect + --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") + -s, --source="": filesystem path to read files relative from + --stepAnalysis[=false]: display memory and timing of different steps of the program + -t, --theme="": theme to use (located in /themes/THEMENAME/) + --uglyURLs[=false]: if true, use /filename.html instead of /filename/ + -v, --verbose[=false]: verbose output + --verboseLog[=false]: verbose logging + -w, --watch[=false]: watch filesystem for changes and recreate as needed + +### Defining your own usage +You can provide your own usage function or template for Cobra to use. + +The default usage function is: + +```go +return func(c *Command) error { + err := tmpl(c.Out(), c.UsageTemplate(), c) + return err +} +``` + +Like help, the function and template are overridable through public methods: + +```go +command.SetUsageFunc(f func(*Command) error) + +command.SetUsageTemplate(s string) +``` + +## PreRun or PostRun Hooks + +It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order: + +- `PersistentPreRun` +- `PreRun` +- `Run` +- `PostRun` +- `PersistentPostRun` + +An example of two commands which use all of these features is below. When the subcommand is executed, it will run the root command's `PersistentPreRun` but not the root command's `PersistentPostRun`: + +```go +package main + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +func main() { + + var rootCmd = &cobra.Command{ + Use: "root [sub]", + Short: "My root command", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args) + }, + PreRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PreRun with args: %v\n", args) + }, + Run: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd Run with args: %v\n", args) + }, + PostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PostRun with args: %v\n", args) + }, + PersistentPostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args) + }, + } + + var subCmd = &cobra.Command{ + Use: "sub [no options!]", + Short: "My subcommand", + PreRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd PreRun with args: %v\n", args) + }, + Run: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd Run with args: %v\n", args) + }, + PostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd PostRun with args: %v\n", args) + }, + PersistentPostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args) + }, + } + + rootCmd.AddCommand(subCmd) + + rootCmd.SetArgs([]string{""}) + _ = rootCmd.Execute() + fmt.Print("\n") + rootCmd.SetArgs([]string{"sub", "arg1", "arg2"}) + _ = rootCmd.Execute() +} +``` + + +## Alternative Error Handling + +Cobra also has functions where the return signature is an error. This allows for errors to bubble up to the top, +providing a way to handle the errors in one location. The current list of functions that return an error is: + +* PersistentPreRunE +* PreRunE +* RunE +* PostRunE +* PersistentPostRunE + +If you would like to silence the default `error` and `usage` output in favor of your own, you can set `SilenceUsage` +and `SilenceErrors` to `true` on the command. A child command respects these flags if they are set on the parent +command. + +**Example Usage using RunE:** + +```go +package main + +import ( + "errors" + "log" + + "github.com/spf13/cobra" +) + +func main() { + var rootCmd = &cobra.Command{ + Use: "hugo", + Short: "Hugo is a very fast static site generator", + Long: `A Fast and Flexible Static Site Generator built with + love by spf13 and friends in Go. + Complete documentation is available at http://hugo.spf13.com`, + RunE: func(cmd *cobra.Command, args []string) error { + // Do Stuff Here + return errors.New("some random error") + }, + } + + if err := rootCmd.Execute(); err != nil { + log.Fatal(err) + } +} +``` + +## Suggestions when "unknown command" happens + +Cobra will print automatic suggestions when "unknown command" errors happen. This allows Cobra to behave similarly to the `git` command when a typo happens. For example: + +``` +$ hugo srever +Error: unknown command "srever" for "hugo" + +Did you mean this? + server + +Run 'hugo --help' for usage. +``` + +Suggestions are automatic based on every subcommand registered and use an implementation of [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance). Every registered command that matches a minimum distance of 2 (ignoring case) will be displayed as a suggestion. + +If you need to disable suggestions or tweak the string distance in your command, use: + +```go +command.DisableSuggestions = true +``` + +or + +```go +command.SuggestionsMinimumDistance = 1 +``` + +You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but makes sense in your set of commands and for some which you don't want aliases. Example: + +``` +$ kubectl remove +Error: unknown command "remove" for "kubectl" + +Did you mean this? + delete + +Run 'kubectl help' for usage. +``` + +## Generating Markdown-formatted documentation for your command + +Cobra can generate a Markdown-formatted document based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Markdown Docs](doc/md_docs.md). + +## Generating man pages for your command + +Cobra can generate a man page based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Man Docs](doc/man_docs.md). + +## Generating bash completions for your command + +Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible. Read more about it in [Bash Completions](bash_completions.md). + +## Debugging + +Cobra provides a ‘DebugFlags’ method on a command which, when called, will print +out everything Cobra knows about the flags for each command. + +### Example + +```go +command.DebugFlags() +``` + +## Extensions + +Libraries for extending Cobra: + +* [cmdns](https://github.com/gosuri/cmdns): Enables name spacing a command's immediate children. It provides an alternative way to structure subcommands, similar to `heroku apps:create` and `ovrclk clusters:launch`. + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + +## Contributors + +Names in no particular order: + +* [spf13](https://github.com/spf13), +[eparis](https://github.com/eparis), +[bep](https://github.com/bep), and many more! + +## License + +Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt) diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index ca211d4407..a0d0402795 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -1,645 +1,645 @@ -package cobra - -import ( - "fmt" - "io" - "os" - "sort" - "strings" - - "github.com/spf13/pflag" -) - -// Annotations for Bash completion. -const ( - BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions" - BashCompCustom = "cobra_annotation_bash_completion_custom" - BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag" - BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir" -) - -func preamble(out io.Writer, name string) error { - _, err := fmt.Fprintf(out, "# bash completion for %-36s -*- shell-script -*-\n", name) - if err != nil { - return err - } - preamStr := ` -__debug() -{ - if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then - echo "$*" >> "${BASH_COMP_DEBUG_FILE}" - fi -} - -# Homebrew on Macs have version 1.3 of bash-completion which doesn't include -# _init_completion. This is a very minimal version of that function. -__my_init_completion() -{ - COMPREPLY=() - _get_comp_words_by_ref "$@" cur prev words cword -} - -__index_of_word() -{ - local w word=$1 - shift - index=0 - for w in "$@"; do - [[ $w = "$word" ]] && return - index=$((index+1)) - done - index=-1 -} - -__contains_word() -{ - local w word=$1; shift - for w in "$@"; do - [[ $w = "$word" ]] && return - done - return 1 -} - -__handle_reply() -{ - __debug "${FUNCNAME[0]}" - case $cur in - -*) - if [[ $(type -t compopt) = "builtin" ]]; then - compopt -o nospace - fi - local allflags - if [ ${#must_have_one_flag[@]} -ne 0 ]; then - allflags=("${must_have_one_flag[@]}") - else - allflags=("${flags[*]} ${two_word_flags[*]}") - fi - COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") ) - if [[ $(type -t compopt) = "builtin" ]]; then - [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace - fi - - # complete after --flag=abc - if [[ $cur == *=* ]]; then - if [[ $(type -t compopt) = "builtin" ]]; then - compopt +o nospace - fi - - local index flag - flag="${cur%%=*}" - __index_of_word "${flag}" "${flags_with_completion[@]}" - COMPREPLY=() - if [[ ${index} -ge 0 ]]; then - PREFIX="" - cur="${cur#*=}" - ${flags_completion[${index}]} - if [ -n "${ZSH_VERSION}" ]; then - # zfs completion needs --flag= prefix - eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )" - fi - fi - fi - return 0; - ;; - esac - - # check if we are handling a flag with special work handling - local index - __index_of_word "${prev}" "${flags_with_completion[@]}" - if [[ ${index} -ge 0 ]]; then - ${flags_completion[${index}]} - return - fi - - # we are parsing a flag and don't have a special handler, no completion - if [[ ${cur} != "${words[cword]}" ]]; then - return - fi - - local completions - completions=("${commands[@]}") - if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then - completions=("${must_have_one_noun[@]}") - fi - if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then - completions+=("${must_have_one_flag[@]}") - fi - COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") ) - - if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then - COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") ) - fi - - if [[ ${#COMPREPLY[@]} -eq 0 ]]; then - declare -F __custom_func >/dev/null && __custom_func - fi - - __ltrim_colon_completions "$cur" -} - -# The arguments should be in the form "ext1|ext2|extn" -__handle_filename_extension_flag() -{ - local ext="$1" - _filedir "@(${ext})" -} - -__handle_subdirs_in_dir_flag() -{ - local dir="$1" - pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 -} - -__handle_flag() -{ - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" - - # if a command required a flag, and we found it, unset must_have_one_flag() - local flagname=${words[c]} - local flagvalue - # if the word contained an = - if [[ ${words[c]} == *"="* ]]; then - flagvalue=${flagname#*=} # take in as flagvalue after the = - flagname=${flagname%%=*} # strip everything after the = - flagname="${flagname}=" # but put the = back - fi - __debug "${FUNCNAME[0]}: looking for ${flagname}" - if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then - must_have_one_flag=() - fi - - # if you set a flag which only applies to this command, don't show subcommands - if __contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then - commands=() - fi - - # keep flag value with flagname as flaghash - if [ -n "${flagvalue}" ] ; then - flaghash[${flagname}]=${flagvalue} - elif [ -n "${words[ $((c+1)) ]}" ] ; then - flaghash[${flagname}]=${words[ $((c+1)) ]} - else - flaghash[${flagname}]="true" # pad "true" for bool flag - fi - - # skip the argument to a two word flag - if __contains_word "${words[c]}" "${two_word_flags[@]}"; then - c=$((c+1)) - # if we are looking for a flags value, don't show commands - if [[ $c -eq $cword ]]; then - commands=() - fi - fi - - c=$((c+1)) - -} - -__handle_noun() -{ - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" - - if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then - must_have_one_noun=() - elif __contains_word "${words[c]}" "${noun_aliases[@]}"; then - must_have_one_noun=() - fi - - nouns+=("${words[c]}") - c=$((c+1)) -} - -__handle_command() -{ - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" - - local next_command - if [[ -n ${last_command} ]]; then - next_command="_${last_command}_${words[c]//:/__}" - else - if [[ $c -eq 0 ]]; then - next_command="_$(basename "${words[c]//:/__}")" - else - next_command="_${words[c]//:/__}" - fi - fi - c=$((c+1)) - __debug "${FUNCNAME[0]}: looking for ${next_command}" - declare -F "$next_command" >/dev/null && $next_command -} - -__handle_word() -{ - if [[ $c -ge $cword ]]; then - __handle_reply - return - fi - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" - if [[ "${words[c]}" == -* ]]; then - __handle_flag - elif __contains_word "${words[c]}" "${commands[@]}"; then - __handle_command - elif [[ $c -eq 0 ]] && __contains_word "$(basename "${words[c]}")" "${commands[@]}"; then - __handle_command - else - __handle_noun - fi - __handle_word -} - -` - _, err = fmt.Fprint(out, preamStr) - return err -} - -func postscript(w io.Writer, name string) error { - name = strings.Replace(name, ":", "__", -1) - _, err := fmt.Fprintf(w, "__start_%s()\n", name) - if err != nil { - return err - } - _, err = fmt.Fprintf(w, `{ - local cur prev words cword - declare -A flaghash 2>/dev/null || : - if declare -F _init_completion >/dev/null 2>&1; then - _init_completion -s || return - else - __my_init_completion -n "=" || return - fi - - local c=0 - local flags=() - local two_word_flags=() - local local_nonpersistent_flags=() - local flags_with_completion=() - local flags_completion=() - local commands=("%s") - local must_have_one_flag=() - local must_have_one_noun=() - local last_command - local nouns=() - - __handle_word -} - -`, name) - if err != nil { - return err - } - _, err = fmt.Fprintf(w, `if [[ $(type -t compopt) = "builtin" ]]; then - complete -o default -F __start_%s %s -else - complete -o default -o nospace -F __start_%s %s -fi - -`, name, name, name, name) - if err != nil { - return err - } - _, err = fmt.Fprintf(w, "# ex: ts=4 sw=4 et filetype=sh\n") - return err -} - -func writeCommands(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " commands=()\n"); err != nil { - return err - } - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c == cmd.helpCommand { - continue - } - if _, err := fmt.Fprintf(w, " commands+=(%q)\n", c.Name()); err != nil { - return err - } - } - _, err := fmt.Fprintf(w, "\n") - return err -} - -func writeFlagHandler(name string, annotations map[string][]string, w io.Writer) error { - for key, value := range annotations { - switch key { - case BashCompFilenameExt: - _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) - if err != nil { - return err - } - - if len(value) > 0 { - ext := "__handle_filename_extension_flag " + strings.Join(value, "|") - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) - } else { - ext := "_filedir" - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) - } - if err != nil { - return err - } - case BashCompCustom: - _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) - if err != nil { - return err - } - if len(value) > 0 { - handlers := strings.Join(value, "; ") - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", handlers) - } else { - _, err = fmt.Fprintf(w, " flags_completion+=(:)\n") - } - if err != nil { - return err - } - case BashCompSubdirsInDir: - _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) - - if len(value) == 1 { - ext := "__handle_subdirs_in_dir_flag " + value[0] - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) - } else { - ext := "_filedir -d" - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) - } - if err != nil { - return err - } - } - } - return nil -} - -func writeShortFlag(flag *pflag.Flag, w io.Writer) error { - b := (len(flag.NoOptDefVal) > 0) - name := flag.Shorthand - format := " " - if !b { - format += "two_word_" - } - format += "flags+=(\"-%s\")\n" - if _, err := fmt.Fprintf(w, format, name); err != nil { - return err - } - return writeFlagHandler("-"+name, flag.Annotations, w) -} - -func writeFlag(flag *pflag.Flag, w io.Writer) error { - b := (len(flag.NoOptDefVal) > 0) - name := flag.Name - format := " flags+=(\"--%s" - if !b { - format += "=" - } - format += "\")\n" - if _, err := fmt.Fprintf(w, format, name); err != nil { - return err - } - return writeFlagHandler("--"+name, flag.Annotations, w) -} - -func writeLocalNonPersistentFlag(flag *pflag.Flag, w io.Writer) error { - b := (len(flag.NoOptDefVal) > 0) - name := flag.Name - format := " local_nonpersistent_flags+=(\"--%s" - if !b { - format += "=" - } - format += "\")\n" - _, err := fmt.Fprintf(w, format, name) - return err -} - -func writeFlags(cmd *Command, w io.Writer) error { - _, err := fmt.Fprintf(w, ` flags=() - two_word_flags=() - local_nonpersistent_flags=() - flags_with_completion=() - flags_completion=() - -`) - if err != nil { - return err - } - localNonPersistentFlags := cmd.LocalNonPersistentFlags() - var visitErr error - cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { - if nonCompletableFlag(flag) { - return - } - if err := writeFlag(flag, w); err != nil { - visitErr = err - return - } - if len(flag.Shorthand) > 0 { - if err := writeShortFlag(flag, w); err != nil { - visitErr = err - return - } - } - if localNonPersistentFlags.Lookup(flag.Name) != nil { - if err := writeLocalNonPersistentFlag(flag, w); err != nil { - visitErr = err - return - } - } - }) - if visitErr != nil { - return visitErr - } - cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { - if nonCompletableFlag(flag) { - return - } - if err := writeFlag(flag, w); err != nil { - visitErr = err - return - } - if len(flag.Shorthand) > 0 { - if err := writeShortFlag(flag, w); err != nil { - visitErr = err - return - } - } - }) - if visitErr != nil { - return visitErr - } - - _, err = fmt.Fprintf(w, "\n") - return err -} - -func writeRequiredFlag(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " must_have_one_flag=()\n"); err != nil { - return err - } - flags := cmd.NonInheritedFlags() - var visitErr error - flags.VisitAll(func(flag *pflag.Flag) { - if nonCompletableFlag(flag) { - return - } - for key := range flag.Annotations { - switch key { - case BashCompOneRequiredFlag: - format := " must_have_one_flag+=(\"--%s" - b := (flag.Value.Type() == "bool") - if !b { - format += "=" - } - format += "\")\n" - if _, err := fmt.Fprintf(w, format, flag.Name); err != nil { - visitErr = err - return - } - - if len(flag.Shorthand) > 0 { - if _, err := fmt.Fprintf(w, " must_have_one_flag+=(\"-%s\")\n", flag.Shorthand); err != nil { - visitErr = err - return - } - } - } - } - }) - return visitErr -} - -func writeRequiredNouns(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " must_have_one_noun=()\n"); err != nil { - return err - } - sort.Sort(sort.StringSlice(cmd.ValidArgs)) - for _, value := range cmd.ValidArgs { - if _, err := fmt.Fprintf(w, " must_have_one_noun+=(%q)\n", value); err != nil { - return err - } - } - return nil -} - -func writeArgAliases(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " noun_aliases=()\n"); err != nil { - return err - } - sort.Sort(sort.StringSlice(cmd.ArgAliases)) - for _, value := range cmd.ArgAliases { - if _, err := fmt.Fprintf(w, " noun_aliases+=(%q)\n", value); err != nil { - return err - } - } - return nil -} - -func gen(cmd *Command, w io.Writer) error { - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c == cmd.helpCommand { - continue - } - if err := gen(c, w); err != nil { - return err - } - } - commandName := cmd.CommandPath() - commandName = strings.Replace(commandName, " ", "_", -1) - commandName = strings.Replace(commandName, ":", "__", -1) - if _, err := fmt.Fprintf(w, "_%s()\n{\n", commandName); err != nil { - return err - } - if _, err := fmt.Fprintf(w, " last_command=%q\n", commandName); err != nil { - return err - } - if err := writeCommands(cmd, w); err != nil { - return err - } - if err := writeFlags(cmd, w); err != nil { - return err - } - if err := writeRequiredFlag(cmd, w); err != nil { - return err - } - if err := writeRequiredNouns(cmd, w); err != nil { - return err - } - if err := writeArgAliases(cmd, w); err != nil { - return err - } - if _, err := fmt.Fprintf(w, "}\n\n"); err != nil { - return err - } - return nil -} - -// GenBashCompletion generates bash completion file and writes to the passed writer. -func (cmd *Command) GenBashCompletion(w io.Writer) error { - if err := preamble(w, cmd.Name()); err != nil { - return err - } - if len(cmd.BashCompletionFunction) > 0 { - if _, err := fmt.Fprintf(w, "%s\n", cmd.BashCompletionFunction); err != nil { - return err - } - } - if err := gen(cmd, w); err != nil { - return err - } - return postscript(w, cmd.Name()) -} - -func nonCompletableFlag(flag *pflag.Flag) bool { - return flag.Hidden || len(flag.Deprecated) > 0 -} - -// GenBashCompletionFile generates bash completion file. -func (cmd *Command) GenBashCompletionFile(filename string) error { - outFile, err := os.Create(filename) - if err != nil { - return err - } - defer outFile.Close() - - return cmd.GenBashCompletion(outFile) -} - -// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag, if it exists. -func (cmd *Command) MarkFlagRequired(name string) error { - return MarkFlagRequired(cmd.Flags(), name) -} - -// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag, if it exists. -func (cmd *Command) MarkPersistentFlagRequired(name string) error { - return MarkFlagRequired(cmd.PersistentFlags(), name) -} - -// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag in the flag set, if it exists. -func MarkFlagRequired(flags *pflag.FlagSet, name string) error { - return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}) -} - -// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func (cmd *Command) MarkFlagFilename(name string, extensions ...string) error { - return MarkFlagFilename(cmd.Flags(), name, extensions...) -} - -// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. -// Generated bash autocompletion will call the bash function f for the flag. -func (cmd *Command) MarkFlagCustom(name string, f string) error { - return MarkFlagCustom(cmd.Flags(), name, f) -} - -// MarkPersistentFlagFilename adds the BashCompFilenameExt annotation to the named persistent flag, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func (cmd *Command) MarkPersistentFlagFilename(name string, extensions ...string) error { - return MarkFlagFilename(cmd.PersistentFlags(), name, extensions...) -} - -// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag in the flag set, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error { - return flags.SetAnnotation(name, BashCompFilenameExt, extensions) -} - -// MarkFlagCustom adds the BashCompCustom annotation to the named flag in the flag set, if it exists. -// Generated bash autocompletion will call the bash function f for the flag. -func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error { - return flags.SetAnnotation(name, BashCompCustom, []string{f}) -} +package cobra + +import ( + "fmt" + "io" + "os" + "sort" + "strings" + + "github.com/spf13/pflag" +) + +// Annotations for Bash completion. +const ( + BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions" + BashCompCustom = "cobra_annotation_bash_completion_custom" + BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag" + BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir" +) + +func preamble(out io.Writer, name string) error { + _, err := fmt.Fprintf(out, "# bash completion for %-36s -*- shell-script -*-\n", name) + if err != nil { + return err + } + preamStr := ` +__debug() +{ + if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then + echo "$*" >> "${BASH_COMP_DEBUG_FILE}" + fi +} + +# Homebrew on Macs have version 1.3 of bash-completion which doesn't include +# _init_completion. This is a very minimal version of that function. +__my_init_completion() +{ + COMPREPLY=() + _get_comp_words_by_ref "$@" cur prev words cword +} + +__index_of_word() +{ + local w word=$1 + shift + index=0 + for w in "$@"; do + [[ $w = "$word" ]] && return + index=$((index+1)) + done + index=-1 +} + +__contains_word() +{ + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done + return 1 +} + +__handle_reply() +{ + __debug "${FUNCNAME[0]}" + case $cur in + -*) + if [[ $(type -t compopt) = "builtin" ]]; then + compopt -o nospace + fi + local allflags + if [ ${#must_have_one_flag[@]} -ne 0 ]; then + allflags=("${must_have_one_flag[@]}") + else + allflags=("${flags[*]} ${two_word_flags[*]}") + fi + COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") ) + if [[ $(type -t compopt) = "builtin" ]]; then + [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace + fi + + # complete after --flag=abc + if [[ $cur == *=* ]]; then + if [[ $(type -t compopt) = "builtin" ]]; then + compopt +o nospace + fi + + local index flag + flag="${cur%%=*}" + __index_of_word "${flag}" "${flags_with_completion[@]}" + COMPREPLY=() + if [[ ${index} -ge 0 ]]; then + PREFIX="" + cur="${cur#*=}" + ${flags_completion[${index}]} + if [ -n "${ZSH_VERSION}" ]; then + # zfs completion needs --flag= prefix + eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )" + fi + fi + fi + return 0; + ;; + esac + + # check if we are handling a flag with special work handling + local index + __index_of_word "${prev}" "${flags_with_completion[@]}" + if [[ ${index} -ge 0 ]]; then + ${flags_completion[${index}]} + return + fi + + # we are parsing a flag and don't have a special handler, no completion + if [[ ${cur} != "${words[cword]}" ]]; then + return + fi + + local completions + completions=("${commands[@]}") + if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then + completions=("${must_have_one_noun[@]}") + fi + if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then + completions+=("${must_have_one_flag[@]}") + fi + COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") ) + + if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then + COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") ) + fi + + if [[ ${#COMPREPLY[@]} -eq 0 ]]; then + declare -F __custom_func >/dev/null && __custom_func + fi + + __ltrim_colon_completions "$cur" +} + +# The arguments should be in the form "ext1|ext2|extn" +__handle_filename_extension_flag() +{ + local ext="$1" + _filedir "@(${ext})" +} + +__handle_subdirs_in_dir_flag() +{ + local dir="$1" + pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 +} + +__handle_flag() +{ + __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + + # if a command required a flag, and we found it, unset must_have_one_flag() + local flagname=${words[c]} + local flagvalue + # if the word contained an = + if [[ ${words[c]} == *"="* ]]; then + flagvalue=${flagname#*=} # take in as flagvalue after the = + flagname=${flagname%%=*} # strip everything after the = + flagname="${flagname}=" # but put the = back + fi + __debug "${FUNCNAME[0]}: looking for ${flagname}" + if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then + must_have_one_flag=() + fi + + # if you set a flag which only applies to this command, don't show subcommands + if __contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then + commands=() + fi + + # keep flag value with flagname as flaghash + if [ -n "${flagvalue}" ] ; then + flaghash[${flagname}]=${flagvalue} + elif [ -n "${words[ $((c+1)) ]}" ] ; then + flaghash[${flagname}]=${words[ $((c+1)) ]} + else + flaghash[${flagname}]="true" # pad "true" for bool flag + fi + + # skip the argument to a two word flag + if __contains_word "${words[c]}" "${two_word_flags[@]}"; then + c=$((c+1)) + # if we are looking for a flags value, don't show commands + if [[ $c -eq $cword ]]; then + commands=() + fi + fi + + c=$((c+1)) + +} + +__handle_noun() +{ + __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + + if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then + must_have_one_noun=() + elif __contains_word "${words[c]}" "${noun_aliases[@]}"; then + must_have_one_noun=() + fi + + nouns+=("${words[c]}") + c=$((c+1)) +} + +__handle_command() +{ + __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + + local next_command + if [[ -n ${last_command} ]]; then + next_command="_${last_command}_${words[c]//:/__}" + else + if [[ $c -eq 0 ]]; then + next_command="_$(basename "${words[c]//:/__}")" + else + next_command="_${words[c]//:/__}" + fi + fi + c=$((c+1)) + __debug "${FUNCNAME[0]}: looking for ${next_command}" + declare -F "$next_command" >/dev/null && $next_command +} + +__handle_word() +{ + if [[ $c -ge $cword ]]; then + __handle_reply + return + fi + __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + if [[ "${words[c]}" == -* ]]; then + __handle_flag + elif __contains_word "${words[c]}" "${commands[@]}"; then + __handle_command + elif [[ $c -eq 0 ]] && __contains_word "$(basename "${words[c]}")" "${commands[@]}"; then + __handle_command + else + __handle_noun + fi + __handle_word +} + +` + _, err = fmt.Fprint(out, preamStr) + return err +} + +func postscript(w io.Writer, name string) error { + name = strings.Replace(name, ":", "__", -1) + _, err := fmt.Fprintf(w, "__start_%s()\n", name) + if err != nil { + return err + } + _, err = fmt.Fprintf(w, `{ + local cur prev words cword + declare -A flaghash 2>/dev/null || : + if declare -F _init_completion >/dev/null 2>&1; then + _init_completion -s || return + else + __my_init_completion -n "=" || return + fi + + local c=0 + local flags=() + local two_word_flags=() + local local_nonpersistent_flags=() + local flags_with_completion=() + local flags_completion=() + local commands=("%s") + local must_have_one_flag=() + local must_have_one_noun=() + local last_command + local nouns=() + + __handle_word +} + +`, name) + if err != nil { + return err + } + _, err = fmt.Fprintf(w, `if [[ $(type -t compopt) = "builtin" ]]; then + complete -o default -F __start_%s %s +else + complete -o default -o nospace -F __start_%s %s +fi + +`, name, name, name, name) + if err != nil { + return err + } + _, err = fmt.Fprintf(w, "# ex: ts=4 sw=4 et filetype=sh\n") + return err +} + +func writeCommands(cmd *Command, w io.Writer) error { + if _, err := fmt.Fprintf(w, " commands=()\n"); err != nil { + return err + } + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c == cmd.helpCommand { + continue + } + if _, err := fmt.Fprintf(w, " commands+=(%q)\n", c.Name()); err != nil { + return err + } + } + _, err := fmt.Fprintf(w, "\n") + return err +} + +func writeFlagHandler(name string, annotations map[string][]string, w io.Writer) error { + for key, value := range annotations { + switch key { + case BashCompFilenameExt: + _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) + if err != nil { + return err + } + + if len(value) > 0 { + ext := "__handle_filename_extension_flag " + strings.Join(value, "|") + _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) + } else { + ext := "_filedir" + _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) + } + if err != nil { + return err + } + case BashCompCustom: + _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) + if err != nil { + return err + } + if len(value) > 0 { + handlers := strings.Join(value, "; ") + _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", handlers) + } else { + _, err = fmt.Fprintf(w, " flags_completion+=(:)\n") + } + if err != nil { + return err + } + case BashCompSubdirsInDir: + _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) + + if len(value) == 1 { + ext := "__handle_subdirs_in_dir_flag " + value[0] + _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) + } else { + ext := "_filedir -d" + _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) + } + if err != nil { + return err + } + } + } + return nil +} + +func writeShortFlag(flag *pflag.Flag, w io.Writer) error { + b := (len(flag.NoOptDefVal) > 0) + name := flag.Shorthand + format := " " + if !b { + format += "two_word_" + } + format += "flags+=(\"-%s\")\n" + if _, err := fmt.Fprintf(w, format, name); err != nil { + return err + } + return writeFlagHandler("-"+name, flag.Annotations, w) +} + +func writeFlag(flag *pflag.Flag, w io.Writer) error { + b := (len(flag.NoOptDefVal) > 0) + name := flag.Name + format := " flags+=(\"--%s" + if !b { + format += "=" + } + format += "\")\n" + if _, err := fmt.Fprintf(w, format, name); err != nil { + return err + } + return writeFlagHandler("--"+name, flag.Annotations, w) +} + +func writeLocalNonPersistentFlag(flag *pflag.Flag, w io.Writer) error { + b := (len(flag.NoOptDefVal) > 0) + name := flag.Name + format := " local_nonpersistent_flags+=(\"--%s" + if !b { + format += "=" + } + format += "\")\n" + _, err := fmt.Fprintf(w, format, name) + return err +} + +func writeFlags(cmd *Command, w io.Writer) error { + _, err := fmt.Fprintf(w, ` flags=() + two_word_flags=() + local_nonpersistent_flags=() + flags_with_completion=() + flags_completion=() + +`) + if err != nil { + return err + } + localNonPersistentFlags := cmd.LocalNonPersistentFlags() + var visitErr error + cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { + if nonCompletableFlag(flag) { + return + } + if err := writeFlag(flag, w); err != nil { + visitErr = err + return + } + if len(flag.Shorthand) > 0 { + if err := writeShortFlag(flag, w); err != nil { + visitErr = err + return + } + } + if localNonPersistentFlags.Lookup(flag.Name) != nil { + if err := writeLocalNonPersistentFlag(flag, w); err != nil { + visitErr = err + return + } + } + }) + if visitErr != nil { + return visitErr + } + cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { + if nonCompletableFlag(flag) { + return + } + if err := writeFlag(flag, w); err != nil { + visitErr = err + return + } + if len(flag.Shorthand) > 0 { + if err := writeShortFlag(flag, w); err != nil { + visitErr = err + return + } + } + }) + if visitErr != nil { + return visitErr + } + + _, err = fmt.Fprintf(w, "\n") + return err +} + +func writeRequiredFlag(cmd *Command, w io.Writer) error { + if _, err := fmt.Fprintf(w, " must_have_one_flag=()\n"); err != nil { + return err + } + flags := cmd.NonInheritedFlags() + var visitErr error + flags.VisitAll(func(flag *pflag.Flag) { + if nonCompletableFlag(flag) { + return + } + for key := range flag.Annotations { + switch key { + case BashCompOneRequiredFlag: + format := " must_have_one_flag+=(\"--%s" + b := (flag.Value.Type() == "bool") + if !b { + format += "=" + } + format += "\")\n" + if _, err := fmt.Fprintf(w, format, flag.Name); err != nil { + visitErr = err + return + } + + if len(flag.Shorthand) > 0 { + if _, err := fmt.Fprintf(w, " must_have_one_flag+=(\"-%s\")\n", flag.Shorthand); err != nil { + visitErr = err + return + } + } + } + } + }) + return visitErr +} + +func writeRequiredNouns(cmd *Command, w io.Writer) error { + if _, err := fmt.Fprintf(w, " must_have_one_noun=()\n"); err != nil { + return err + } + sort.Sort(sort.StringSlice(cmd.ValidArgs)) + for _, value := range cmd.ValidArgs { + if _, err := fmt.Fprintf(w, " must_have_one_noun+=(%q)\n", value); err != nil { + return err + } + } + return nil +} + +func writeArgAliases(cmd *Command, w io.Writer) error { + if _, err := fmt.Fprintf(w, " noun_aliases=()\n"); err != nil { + return err + } + sort.Sort(sort.StringSlice(cmd.ArgAliases)) + for _, value := range cmd.ArgAliases { + if _, err := fmt.Fprintf(w, " noun_aliases+=(%q)\n", value); err != nil { + return err + } + } + return nil +} + +func gen(cmd *Command, w io.Writer) error { + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c == cmd.helpCommand { + continue + } + if err := gen(c, w); err != nil { + return err + } + } + commandName := cmd.CommandPath() + commandName = strings.Replace(commandName, " ", "_", -1) + commandName = strings.Replace(commandName, ":", "__", -1) + if _, err := fmt.Fprintf(w, "_%s()\n{\n", commandName); err != nil { + return err + } + if _, err := fmt.Fprintf(w, " last_command=%q\n", commandName); err != nil { + return err + } + if err := writeCommands(cmd, w); err != nil { + return err + } + if err := writeFlags(cmd, w); err != nil { + return err + } + if err := writeRequiredFlag(cmd, w); err != nil { + return err + } + if err := writeRequiredNouns(cmd, w); err != nil { + return err + } + if err := writeArgAliases(cmd, w); err != nil { + return err + } + if _, err := fmt.Fprintf(w, "}\n\n"); err != nil { + return err + } + return nil +} + +// GenBashCompletion generates bash completion file and writes to the passed writer. +func (cmd *Command) GenBashCompletion(w io.Writer) error { + if err := preamble(w, cmd.Name()); err != nil { + return err + } + if len(cmd.BashCompletionFunction) > 0 { + if _, err := fmt.Fprintf(w, "%s\n", cmd.BashCompletionFunction); err != nil { + return err + } + } + if err := gen(cmd, w); err != nil { + return err + } + return postscript(w, cmd.Name()) +} + +func nonCompletableFlag(flag *pflag.Flag) bool { + return flag.Hidden || len(flag.Deprecated) > 0 +} + +// GenBashCompletionFile generates bash completion file. +func (cmd *Command) GenBashCompletionFile(filename string) error { + outFile, err := os.Create(filename) + if err != nil { + return err + } + defer outFile.Close() + + return cmd.GenBashCompletion(outFile) +} + +// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag, if it exists. +func (cmd *Command) MarkFlagRequired(name string) error { + return MarkFlagRequired(cmd.Flags(), name) +} + +// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag, if it exists. +func (cmd *Command) MarkPersistentFlagRequired(name string) error { + return MarkFlagRequired(cmd.PersistentFlags(), name) +} + +// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag in the flag set, if it exists. +func MarkFlagRequired(flags *pflag.FlagSet, name string) error { + return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}) +} + +// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists. +// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. +func (cmd *Command) MarkFlagFilename(name string, extensions ...string) error { + return MarkFlagFilename(cmd.Flags(), name, extensions...) +} + +// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. +// Generated bash autocompletion will call the bash function f for the flag. +func (cmd *Command) MarkFlagCustom(name string, f string) error { + return MarkFlagCustom(cmd.Flags(), name, f) +} + +// MarkPersistentFlagFilename adds the BashCompFilenameExt annotation to the named persistent flag, if it exists. +// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. +func (cmd *Command) MarkPersistentFlagFilename(name string, extensions ...string) error { + return MarkFlagFilename(cmd.PersistentFlags(), name, extensions...) +} + +// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag in the flag set, if it exists. +// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. +func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error { + return flags.SetAnnotation(name, BashCompFilenameExt, extensions) +} + +// MarkFlagCustom adds the BashCompCustom annotation to the named flag in the flag set, if it exists. +// Generated bash autocompletion will call the bash function f for the flag. +func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error { + return flags.SetAnnotation(name, BashCompCustom, []string{f}) +} diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md index 3e6de9d52b..52bd39ddb1 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ b/vendor/github.com/spf13/cobra/bash_completions.md @@ -1,206 +1,206 @@ -# Generating Bash Completions For Your Own cobra.Command - -Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows: - -```go -package main - -import ( - "io/ioutil" - "os" - - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd" -) - -func main() { - kubectl := cmd.NewFactory(nil).NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard) - kubectl.GenBashCompletionFile("out.sh") -} -``` - -`out.sh` will get you completions of subcommands and flags. Copy it to `/etc/bash_completion.d/` as described [here](https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1) and reset your terminal to use autocompletion. If you make additional annotations to your code, you can get even more intelligent and flexible behavior. - -## Creating your own custom functions - -Some more actual code that works in kubernetes: - -```bash -const ( - bash_completion_func = `__kubectl_parse_get() -{ - local kubectl_output out - if kubectl_output=$(kubectl get --no-headers "$1" 2>/dev/null); then - out=($(echo "${kubectl_output}" | awk '{print $1}')) - COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) - fi -} - -__kubectl_get_resource() -{ - if [[ ${#nouns[@]} -eq 0 ]]; then - return 1 - fi - __kubectl_parse_get ${nouns[${#nouns[@]} -1]} - if [[ $? -eq 0 ]]; then - return 0 - fi -} - -__custom_func() { - case ${last_command} in - kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) - __kubectl_get_resource - return - ;; - *) - ;; - esac -} -`) -``` - -And then I set that in my command definition: - -```go -cmds := &cobra.Command{ - Use: "kubectl", - Short: "kubectl controls the Kubernetes cluster manager", - Long: `kubectl controls the Kubernetes cluster manager. - -Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, - Run: runHelp, - BashCompletionFunction: bash_completion_func, -} -``` - -The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! - -## Have the completions code complete your 'nouns' - -In the above example "pod" was assumed to already be typed. But if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like: - -```go -validArgs []string = { "pod", "node", "service", "replicationcontroller" } - -cmd := &cobra.Command{ - Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)", - Short: "Display one or many resources", - Long: get_long, - Example: get_example, - Run: func(cmd *cobra.Command, args []string) { - err := RunGet(f, out, cmd, args) - util.CheckErr(err) - }, - ValidArgs: validArgs, -} -``` - -Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like - -```bash -# kubectl get [tab][tab] -node pod replicationcontroller service -``` - -## Plural form and shortcuts for nouns - -If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`: - -```go -argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" } - -cmd := &cobra.Command{ - ... - ValidArgs: validArgs, - ArgAliases: argAliases -} -``` - -The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by -the completion algorithm if entered manually, e.g. in: - -```bash -# kubectl get rc [tab][tab] -backend frontend database -``` - -Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns -in this example again instead of the replication controllers. - -## Mark flags as required - -Most of the time completions will only show subcommands. But if a flag is required to make a subcommand work, you probably want it to show up when the user types [tab][tab]. Marking a flag as 'Required' is incredibly easy. - -```go -cmd.MarkFlagRequired("pod") -cmd.MarkFlagRequired("container") -``` - -and you'll get something like - -```bash -# kubectl exec [tab][tab][tab] --c --container= -p --pod= -``` - -# Specify valid filename extensions for flags that take a filename - -In this example we use --filename= and expect to get a json or yaml file as the argument. To make this easier we annotate the --filename flag with valid filename extensions. - -```go - annotations := []string{"json", "yaml", "yml"} - annotation := make(map[string][]string) - annotation[cobra.BashCompFilenameExt] = annotations - - flag := &pflag.Flag{ - Name: "filename", - Shorthand: "f", - Usage: usage, - Value: value, - DefValue: value.String(), - Annotations: annotation, - } - cmd.Flags().AddFlag(flag) -``` - -Now when you run a command with this filename flag you'll get something like - -```bash -# kubectl create -f -test/ example/ rpmbuild/ -hello.yml test.json -``` - -So while there are many other files in the CWD it only shows me subdirs and those with valid extensions. - -# Specifiy custom flag completion - -Similar to the filename completion and filtering using cobra.BashCompFilenameExt, you can specifiy -a custom flag completion function with cobra.BashCompCustom: - -```go - annotation := make(map[string][]string) - annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"} - - flag := &pflag.Flag{ - Name: "namespace", - Usage: usage, - Annotations: annotation, - } - cmd.Flags().AddFlag(flag) -``` - -In addition add the `__handle_namespace_flag` implementation in the `BashCompletionFunction` -value, e.g.: - -```bash -__kubectl_get_namespaces() -{ - local template - template="{{ range .items }}{{ .metadata.name }} {{ end }}" - local kubectl_out - if kubectl_out=$(kubectl get -o template --template="${template}" namespace 2>/dev/null); then - COMPREPLY=( $( compgen -W "${kubectl_out}[*]" -- "$cur" ) ) - fi -} -``` +# Generating Bash Completions For Your Own cobra.Command + +Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows: + +```go +package main + +import ( + "io/ioutil" + "os" + + "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd" +) + +func main() { + kubectl := cmd.NewFactory(nil).NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard) + kubectl.GenBashCompletionFile("out.sh") +} +``` + +`out.sh` will get you completions of subcommands and flags. Copy it to `/etc/bash_completion.d/` as described [here](https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1) and reset your terminal to use autocompletion. If you make additional annotations to your code, you can get even more intelligent and flexible behavior. + +## Creating your own custom functions + +Some more actual code that works in kubernetes: + +```bash +const ( + bash_completion_func = `__kubectl_parse_get() +{ + local kubectl_output out + if kubectl_output=$(kubectl get --no-headers "$1" 2>/dev/null); then + out=($(echo "${kubectl_output}" | awk '{print $1}')) + COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) + fi +} + +__kubectl_get_resource() +{ + if [[ ${#nouns[@]} -eq 0 ]]; then + return 1 + fi + __kubectl_parse_get ${nouns[${#nouns[@]} -1]} + if [[ $? -eq 0 ]]; then + return 0 + fi +} + +__custom_func() { + case ${last_command} in + kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) + __kubectl_get_resource + return + ;; + *) + ;; + esac +} +`) +``` + +And then I set that in my command definition: + +```go +cmds := &cobra.Command{ + Use: "kubectl", + Short: "kubectl controls the Kubernetes cluster manager", + Long: `kubectl controls the Kubernetes cluster manager. + +Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, + Run: runHelp, + BashCompletionFunction: bash_completion_func, +} +``` + +The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! + +## Have the completions code complete your 'nouns' + +In the above example "pod" was assumed to already be typed. But if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like: + +```go +validArgs []string = { "pod", "node", "service", "replicationcontroller" } + +cmd := &cobra.Command{ + Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)", + Short: "Display one or many resources", + Long: get_long, + Example: get_example, + Run: func(cmd *cobra.Command, args []string) { + err := RunGet(f, out, cmd, args) + util.CheckErr(err) + }, + ValidArgs: validArgs, +} +``` + +Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like + +```bash +# kubectl get [tab][tab] +node pod replicationcontroller service +``` + +## Plural form and shortcuts for nouns + +If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`: + +```go +argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" } + +cmd := &cobra.Command{ + ... + ValidArgs: validArgs, + ArgAliases: argAliases +} +``` + +The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by +the completion algorithm if entered manually, e.g. in: + +```bash +# kubectl get rc [tab][tab] +backend frontend database +``` + +Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns +in this example again instead of the replication controllers. + +## Mark flags as required + +Most of the time completions will only show subcommands. But if a flag is required to make a subcommand work, you probably want it to show up when the user types [tab][tab]. Marking a flag as 'Required' is incredibly easy. + +```go +cmd.MarkFlagRequired("pod") +cmd.MarkFlagRequired("container") +``` + +and you'll get something like + +```bash +# kubectl exec [tab][tab][tab] +-c --container= -p --pod= +``` + +# Specify valid filename extensions for flags that take a filename + +In this example we use --filename= and expect to get a json or yaml file as the argument. To make this easier we annotate the --filename flag with valid filename extensions. + +```go + annotations := []string{"json", "yaml", "yml"} + annotation := make(map[string][]string) + annotation[cobra.BashCompFilenameExt] = annotations + + flag := &pflag.Flag{ + Name: "filename", + Shorthand: "f", + Usage: usage, + Value: value, + DefValue: value.String(), + Annotations: annotation, + } + cmd.Flags().AddFlag(flag) +``` + +Now when you run a command with this filename flag you'll get something like + +```bash +# kubectl create -f +test/ example/ rpmbuild/ +hello.yml test.json +``` + +So while there are many other files in the CWD it only shows me subdirs and those with valid extensions. + +# Specifiy custom flag completion + +Similar to the filename completion and filtering using cobra.BashCompFilenameExt, you can specifiy +a custom flag completion function with cobra.BashCompCustom: + +```go + annotation := make(map[string][]string) + annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"} + + flag := &pflag.Flag{ + Name: "namespace", + Usage: usage, + Annotations: annotation, + } + cmd.Flags().AddFlag(flag) +``` + +In addition add the `__handle_namespace_flag` implementation in the `BashCompletionFunction` +value, e.g.: + +```bash +__kubectl_get_namespaces() +{ + local template + template="{{ range .items }}{{ .metadata.name }} {{ end }}" + local kubectl_out + if kubectl_out=$(kubectl get -o template --template="${template}" namespace 2>/dev/null); then + COMPREPLY=( $( compgen -W "${kubectl_out}[*]" -- "$cur" ) ) + fi +} +``` diff --git a/vendor/github.com/spf13/cobra/bash_completions_test.go b/vendor/github.com/spf13/cobra/bash_completions_test.go index 9acc08fc33..185570b2b1 100644 --- a/vendor/github.com/spf13/cobra/bash_completions_test.go +++ b/vendor/github.com/spf13/cobra/bash_completions_test.go @@ -1,180 +1,180 @@ -package cobra - -import ( - "bytes" - "fmt" - "os" - "os/exec" - "strings" - "testing" -) - -var _ = fmt.Println -var _ = os.Stderr - -func checkOmit(t *testing.T, found, unexpected string) { - if strings.Contains(found, unexpected) { - t.Errorf("Unexpected response.\nGot: %q\nBut should not have!\n", unexpected) - } -} - -func check(t *testing.T, found, expected string) { - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } -} - -func runShellCheck(s string) error { - excluded := []string{ - "SC2034", // PREFIX appears unused. Verify it or export it. - } - cmd := exec.Command("shellcheck", "-s", "bash", "-", "-e", strings.Join(excluded, ",")) - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - - stdin, err := cmd.StdinPipe() - if err != nil { - return err - } - go func() { - defer stdin.Close() - stdin.Write([]byte(s)) - }() - - return cmd.Run() -} - -// World worst custom function, just keep telling you to enter hello! -const ( - bashCompletionFunc = `__custom_func() { -COMPREPLY=( "hello" ) -} -` -) - -func TestBashCompletions(t *testing.T) { - c := initializeWithRootCmd() - cmdEcho.AddCommand(cmdTimes) - c.AddCommand(cmdEcho, cmdPrint, cmdDeprecated, cmdColon) - - // custom completion function - c.BashCompletionFunction = bashCompletionFunc - - // required flag - c.MarkFlagRequired("introot") - - // valid nouns - validArgs := []string{"pod", "node", "service", "replicationcontroller"} - c.ValidArgs = validArgs - - // noun aliases - argAliases := []string{"pods", "nodes", "services", "replicationcontrollers", "po", "no", "svc", "rc"} - c.ArgAliases = argAliases - - // filename - var flagval string - c.Flags().StringVar(&flagval, "filename", "", "Enter a filename") - c.MarkFlagFilename("filename", "json", "yaml", "yml") - - // persistent filename - var flagvalPersistent string - c.PersistentFlags().StringVar(&flagvalPersistent, "persistent-filename", "", "Enter a filename") - c.MarkPersistentFlagFilename("persistent-filename") - c.MarkPersistentFlagRequired("persistent-filename") - - // filename extensions - var flagvalExt string - c.Flags().StringVar(&flagvalExt, "filename-ext", "", "Enter a filename (extension limited)") - c.MarkFlagFilename("filename-ext") - - // filename extensions - var flagvalCustom string - c.Flags().StringVar(&flagvalCustom, "custom", "", "Enter a filename (extension limited)") - c.MarkFlagCustom("custom", "__complete_custom") - - // subdirectories in a given directory - var flagvalTheme string - c.Flags().StringVar(&flagvalTheme, "theme", "", "theme to use (located in /themes/THEMENAME/)") - c.Flags().SetAnnotation("theme", BashCompSubdirsInDir, []string{"themes"}) - - out := new(bytes.Buffer) - c.GenBashCompletion(out) - str := out.String() - - check(t, str, "_cobra-test") - check(t, str, "_cobra-test_echo") - check(t, str, "_cobra-test_echo_times") - check(t, str, "_cobra-test_print") - check(t, str, "_cobra-test_cmd__colon") - - // check for required flags - check(t, str, `must_have_one_flag+=("--introot=")`) - check(t, str, `must_have_one_flag+=("--persistent-filename=")`) - // check for custom completion function - check(t, str, `COMPREPLY=( "hello" )`) - // check for required nouns - check(t, str, `must_have_one_noun+=("pod")`) - // check for noun aliases - check(t, str, `noun_aliases+=("pods")`) - check(t, str, `noun_aliases+=("rc")`) - checkOmit(t, str, `must_have_one_noun+=("pods")`) - // check for filename extension flags - check(t, str, `flags_completion+=("_filedir")`) - // check for filename extension flags - check(t, str, `flags_completion+=("__handle_filename_extension_flag json|yaml|yml")`) - // check for custom flags - check(t, str, `flags_completion+=("__complete_custom")`) - // check for subdirs_in_dir flags - check(t, str, `flags_completion+=("__handle_subdirs_in_dir_flag themes")`) - - checkOmit(t, str, cmdDeprecated.Name()) - - // if available, run shellcheck against the script - if err := exec.Command("which", "shellcheck").Run(); err != nil { - return - } - err := runShellCheck(str) - if err != nil { - t.Fatalf("shellcheck failed: %v", err) - } -} - -func TestBashCompletionHiddenFlag(t *testing.T) { - var cmdTrue = &Command{ - Use: "does nothing", - Run: func(cmd *Command, args []string) {}, - } - - const flagName = "hidden-foo-bar-baz" - - var flagValue bool - cmdTrue.Flags().BoolVar(&flagValue, flagName, false, "hidden flag") - cmdTrue.Flags().MarkHidden(flagName) - - out := new(bytes.Buffer) - cmdTrue.GenBashCompletion(out) - bashCompletion := out.String() - if strings.Contains(bashCompletion, flagName) { - t.Errorf("expected completion to not include %q flag: Got %v", flagName, bashCompletion) - } -} - -func TestBashCompletionDeprecatedFlag(t *testing.T) { - var cmdTrue = &Command{ - Use: "does nothing", - Run: func(cmd *Command, args []string) {}, - } - - const flagName = "deprecated-foo-bar-baz" - - var flagValue bool - cmdTrue.Flags().BoolVar(&flagValue, flagName, false, "hidden flag") - cmdTrue.Flags().MarkDeprecated(flagName, "use --does-not-exist instead") - - out := new(bytes.Buffer) - cmdTrue.GenBashCompletion(out) - bashCompletion := out.String() - if strings.Contains(bashCompletion, flagName) { - t.Errorf("expected completion to not include %q flag: Got %v", flagName, bashCompletion) - } -} +package cobra + +import ( + "bytes" + "fmt" + "os" + "os/exec" + "strings" + "testing" +) + +var _ = fmt.Println +var _ = os.Stderr + +func checkOmit(t *testing.T, found, unexpected string) { + if strings.Contains(found, unexpected) { + t.Errorf("Unexpected response.\nGot: %q\nBut should not have!\n", unexpected) + } +} + +func check(t *testing.T, found, expected string) { + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } +} + +func runShellCheck(s string) error { + excluded := []string{ + "SC2034", // PREFIX appears unused. Verify it or export it. + } + cmd := exec.Command("shellcheck", "-s", "bash", "-", "-e", strings.Join(excluded, ",")) + cmd.Stderr = os.Stderr + cmd.Stdout = os.Stdout + + stdin, err := cmd.StdinPipe() + if err != nil { + return err + } + go func() { + defer stdin.Close() + stdin.Write([]byte(s)) + }() + + return cmd.Run() +} + +// World worst custom function, just keep telling you to enter hello! +const ( + bashCompletionFunc = `__custom_func() { +COMPREPLY=( "hello" ) +} +` +) + +func TestBashCompletions(t *testing.T) { + c := initializeWithRootCmd() + cmdEcho.AddCommand(cmdTimes) + c.AddCommand(cmdEcho, cmdPrint, cmdDeprecated, cmdColon) + + // custom completion function + c.BashCompletionFunction = bashCompletionFunc + + // required flag + c.MarkFlagRequired("introot") + + // valid nouns + validArgs := []string{"pod", "node", "service", "replicationcontroller"} + c.ValidArgs = validArgs + + // noun aliases + argAliases := []string{"pods", "nodes", "services", "replicationcontrollers", "po", "no", "svc", "rc"} + c.ArgAliases = argAliases + + // filename + var flagval string + c.Flags().StringVar(&flagval, "filename", "", "Enter a filename") + c.MarkFlagFilename("filename", "json", "yaml", "yml") + + // persistent filename + var flagvalPersistent string + c.PersistentFlags().StringVar(&flagvalPersistent, "persistent-filename", "", "Enter a filename") + c.MarkPersistentFlagFilename("persistent-filename") + c.MarkPersistentFlagRequired("persistent-filename") + + // filename extensions + var flagvalExt string + c.Flags().StringVar(&flagvalExt, "filename-ext", "", "Enter a filename (extension limited)") + c.MarkFlagFilename("filename-ext") + + // filename extensions + var flagvalCustom string + c.Flags().StringVar(&flagvalCustom, "custom", "", "Enter a filename (extension limited)") + c.MarkFlagCustom("custom", "__complete_custom") + + // subdirectories in a given directory + var flagvalTheme string + c.Flags().StringVar(&flagvalTheme, "theme", "", "theme to use (located in /themes/THEMENAME/)") + c.Flags().SetAnnotation("theme", BashCompSubdirsInDir, []string{"themes"}) + + out := new(bytes.Buffer) + c.GenBashCompletion(out) + str := out.String() + + check(t, str, "_cobra-test") + check(t, str, "_cobra-test_echo") + check(t, str, "_cobra-test_echo_times") + check(t, str, "_cobra-test_print") + check(t, str, "_cobra-test_cmd__colon") + + // check for required flags + check(t, str, `must_have_one_flag+=("--introot=")`) + check(t, str, `must_have_one_flag+=("--persistent-filename=")`) + // check for custom completion function + check(t, str, `COMPREPLY=( "hello" )`) + // check for required nouns + check(t, str, `must_have_one_noun+=("pod")`) + // check for noun aliases + check(t, str, `noun_aliases+=("pods")`) + check(t, str, `noun_aliases+=("rc")`) + checkOmit(t, str, `must_have_one_noun+=("pods")`) + // check for filename extension flags + check(t, str, `flags_completion+=("_filedir")`) + // check for filename extension flags + check(t, str, `flags_completion+=("__handle_filename_extension_flag json|yaml|yml")`) + // check for custom flags + check(t, str, `flags_completion+=("__complete_custom")`) + // check for subdirs_in_dir flags + check(t, str, `flags_completion+=("__handle_subdirs_in_dir_flag themes")`) + + checkOmit(t, str, cmdDeprecated.Name()) + + // if available, run shellcheck against the script + if err := exec.Command("which", "shellcheck").Run(); err != nil { + return + } + err := runShellCheck(str) + if err != nil { + t.Fatalf("shellcheck failed: %v", err) + } +} + +func TestBashCompletionHiddenFlag(t *testing.T) { + var cmdTrue = &Command{ + Use: "does nothing", + Run: func(cmd *Command, args []string) {}, + } + + const flagName = "hidden-foo-bar-baz" + + var flagValue bool + cmdTrue.Flags().BoolVar(&flagValue, flagName, false, "hidden flag") + cmdTrue.Flags().MarkHidden(flagName) + + out := new(bytes.Buffer) + cmdTrue.GenBashCompletion(out) + bashCompletion := out.String() + if strings.Contains(bashCompletion, flagName) { + t.Errorf("expected completion to not include %q flag: Got %v", flagName, bashCompletion) + } +} + +func TestBashCompletionDeprecatedFlag(t *testing.T) { + var cmdTrue = &Command{ + Use: "does nothing", + Run: func(cmd *Command, args []string) {}, + } + + const flagName = "deprecated-foo-bar-baz" + + var flagValue bool + cmdTrue.Flags().BoolVar(&flagValue, flagName, false, "hidden flag") + cmdTrue.Flags().MarkDeprecated(flagName, "use --does-not-exist instead") + + out := new(bytes.Buffer) + cmdTrue.GenBashCompletion(out) + bashCompletion := out.String() + if strings.Contains(bashCompletion, flagName) { + t.Errorf("expected completion to not include %q flag: Got %v", flagName, bashCompletion) + } +} diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index be3e479265..2726d19e41 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -1,181 +1,181 @@ -// Copyright © 2013 Steve Francia . -// -// 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. - -// Commands similar to git, go tools and other modern CLI tools -// inspired by go, go-Commander, gh and subcommand - -package cobra - -import ( - "fmt" - "io" - "reflect" - "strconv" - "strings" - "text/template" - "unicode" -) - -var templateFuncs = template.FuncMap{ - "trim": strings.TrimSpace, - "trimRightSpace": trimRightSpace, - "trimTrailingWhitespaces": trimRightSpace, - "appendIfNotPresent": appendIfNotPresent, - "rpad": rpad, - "gt": Gt, - "eq": Eq, -} - -var initializers []func() - -// EnablePrefixMatching allows to set automatic prefix matching. Automatic prefix matching can be a dangerous thing -// to automatically enable in CLI tools. -// Set this to true to enable it. -var EnablePrefixMatching = false - -// EnableCommandSorting controls sorting of the slice of commands, which is turned on by default. -// To disable sorting, set it to false. -var EnableCommandSorting = true - -// AddTemplateFunc adds a template function that's available to Usage and Help -// template generation. -func AddTemplateFunc(name string, tmplFunc interface{}) { - templateFuncs[name] = tmplFunc -} - -// AddTemplateFuncs adds multiple template functions that are available to Usage and -// Help template generation. -func AddTemplateFuncs(tmplFuncs template.FuncMap) { - for k, v := range tmplFuncs { - templateFuncs[k] = v - } -} - -// OnInitialize takes a series of func() arguments and appends them to a slice of func(). -func OnInitialize(y ...func()) { - initializers = append(initializers, y...) -} - -// FIXME Gt is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. - -// Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans, -// Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as -// ints and then compared. -func Gt(a interface{}, b interface{}) bool { - var left, right int64 - av := reflect.ValueOf(a) - - switch av.Kind() { - case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: - left = int64(av.Len()) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - left = av.Int() - case reflect.String: - left, _ = strconv.ParseInt(av.String(), 10, 64) - } - - bv := reflect.ValueOf(b) - - switch bv.Kind() { - case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: - right = int64(bv.Len()) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - right = bv.Int() - case reflect.String: - right, _ = strconv.ParseInt(bv.String(), 10, 64) - } - - return left > right -} - -// FIXME Eq is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. - -// Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic. -func Eq(a interface{}, b interface{}) bool { - av := reflect.ValueOf(a) - bv := reflect.ValueOf(b) - - switch av.Kind() { - case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: - panic("Eq called on unsupported type") - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return av.Int() == bv.Int() - case reflect.String: - return av.String() == bv.String() - } - return false -} - -func trimRightSpace(s string) string { - return strings.TrimRightFunc(s, unicode.IsSpace) -} - -// FIXME appendIfNotPresent is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. - -// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s. -func appendIfNotPresent(s, stringToAppend string) string { - if strings.Contains(s, stringToAppend) { - return s - } - return s + " " + stringToAppend -} - -// rpad adds padding to the right of a string. -func rpad(s string, padding int) string { - template := fmt.Sprintf("%%-%ds", padding) - return fmt.Sprintf(template, s) -} - -// tmpl executes the given template text on data, writing the result to w. -func tmpl(w io.Writer, text string, data interface{}) error { - t := template.New("top") - t.Funcs(templateFuncs) - template.Must(t.Parse(text)) - return t.Execute(w, data) -} - -// ld compares two strings and returns the levenshtein distance between them. -func ld(s, t string, ignoreCase bool) int { - if ignoreCase { - s = strings.ToLower(s) - t = strings.ToLower(t) - } - d := make([][]int, len(s)+1) - for i := range d { - d[i] = make([]int, len(t)+1) - } - for i := range d { - d[i][0] = i - } - for j := range d[0] { - d[0][j] = j - } - for j := 1; j <= len(t); j++ { - for i := 1; i <= len(s); i++ { - if s[i-1] == t[j-1] { - d[i][j] = d[i-1][j-1] - } else { - min := d[i-1][j] - if d[i][j-1] < min { - min = d[i][j-1] - } - if d[i-1][j-1] < min { - min = d[i-1][j-1] - } - d[i][j] = min + 1 - } - } - - } - return d[len(s)][len(t)] -} +// Copyright © 2013 Steve Francia . +// +// 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. + +// Commands similar to git, go tools and other modern CLI tools +// inspired by go, go-Commander, gh and subcommand + +package cobra + +import ( + "fmt" + "io" + "reflect" + "strconv" + "strings" + "text/template" + "unicode" +) + +var templateFuncs = template.FuncMap{ + "trim": strings.TrimSpace, + "trimRightSpace": trimRightSpace, + "trimTrailingWhitespaces": trimRightSpace, + "appendIfNotPresent": appendIfNotPresent, + "rpad": rpad, + "gt": Gt, + "eq": Eq, +} + +var initializers []func() + +// EnablePrefixMatching allows to set automatic prefix matching. Automatic prefix matching can be a dangerous thing +// to automatically enable in CLI tools. +// Set this to true to enable it. +var EnablePrefixMatching = false + +// EnableCommandSorting controls sorting of the slice of commands, which is turned on by default. +// To disable sorting, set it to false. +var EnableCommandSorting = true + +// AddTemplateFunc adds a template function that's available to Usage and Help +// template generation. +func AddTemplateFunc(name string, tmplFunc interface{}) { + templateFuncs[name] = tmplFunc +} + +// AddTemplateFuncs adds multiple template functions that are available to Usage and +// Help template generation. +func AddTemplateFuncs(tmplFuncs template.FuncMap) { + for k, v := range tmplFuncs { + templateFuncs[k] = v + } +} + +// OnInitialize takes a series of func() arguments and appends them to a slice of func(). +func OnInitialize(y ...func()) { + initializers = append(initializers, y...) +} + +// FIXME Gt is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. + +// Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans, +// Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as +// ints and then compared. +func Gt(a interface{}, b interface{}) bool { + var left, right int64 + av := reflect.ValueOf(a) + + switch av.Kind() { + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: + left = int64(av.Len()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + left = av.Int() + case reflect.String: + left, _ = strconv.ParseInt(av.String(), 10, 64) + } + + bv := reflect.ValueOf(b) + + switch bv.Kind() { + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: + right = int64(bv.Len()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + right = bv.Int() + case reflect.String: + right, _ = strconv.ParseInt(bv.String(), 10, 64) + } + + return left > right +} + +// FIXME Eq is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. + +// Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic. +func Eq(a interface{}, b interface{}) bool { + av := reflect.ValueOf(a) + bv := reflect.ValueOf(b) + + switch av.Kind() { + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: + panic("Eq called on unsupported type") + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return av.Int() == bv.Int() + case reflect.String: + return av.String() == bv.String() + } + return false +} + +func trimRightSpace(s string) string { + return strings.TrimRightFunc(s, unicode.IsSpace) +} + +// FIXME appendIfNotPresent is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. + +// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s. +func appendIfNotPresent(s, stringToAppend string) string { + if strings.Contains(s, stringToAppend) { + return s + } + return s + " " + stringToAppend +} + +// rpad adds padding to the right of a string. +func rpad(s string, padding int) string { + template := fmt.Sprintf("%%-%ds", padding) + return fmt.Sprintf(template, s) +} + +// tmpl executes the given template text on data, writing the result to w. +func tmpl(w io.Writer, text string, data interface{}) error { + t := template.New("top") + t.Funcs(templateFuncs) + template.Must(t.Parse(text)) + return t.Execute(w, data) +} + +// ld compares two strings and returns the levenshtein distance between them. +func ld(s, t string, ignoreCase bool) int { + if ignoreCase { + s = strings.ToLower(s) + t = strings.ToLower(t) + } + d := make([][]int, len(s)+1) + for i := range d { + d[i] = make([]int, len(t)+1) + } + for i := range d { + d[i][0] = i + } + for j := range d[0] { + d[0][j] = j + } + for j := 1; j <= len(t); j++ { + for i := 1; i <= len(s); i++ { + if s[i-1] == t[j-1] { + d[i][j] = d[i-1][j-1] + } else { + min := d[i-1][j] + if d[i][j-1] < min { + min = d[i][j-1] + } + if d[i-1][j-1] < min { + min = d[i-1][j-1] + } + d[i][j] = min + 1 + } + } + + } + return d[len(s)][len(t)] +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/add.go b/vendor/github.com/spf13/cobra/cobra/cmd/add.go index 563fad8d3e..8897f8ff00 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/add.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/add.go @@ -1,172 +1,172 @@ -// Copyright © 2015 Steve Francia . -// -// 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 cmd - -import ( - "fmt" - "os" - "path/filepath" - "unicode" - - "github.com/spf13/cobra" -) - -func init() { - addCmd.Flags().StringVarP(&parentName, "parent", "p", "RootCmd", "name of parent command for this command") -} - -var parentName string - -var addCmd = &cobra.Command{ - Use: "add [command name]", - Aliases: []string{"command"}, - Short: "Add a command to a Cobra Application", - Long: `Add (cobra add) will create a new command, with a license and -the appropriate structure for a Cobra-based CLI application, -and register it to its parent (default RootCmd). - -If you want your command to be public, pass in the command name -with an initial uppercase letter. - -Example: cobra add server -> resulting in a new cmd/server.go`, - - Run: func(cmd *cobra.Command, args []string) { - if len(args) < 1 { - er("add needs a name for the command") - } - wd, err := os.Getwd() - if err != nil { - er(err) - } - project := NewProjectFromPath(wd) - - cmdName := validateCmdName(args[0]) - cmdPath := filepath.Join(project.CmdPath(), cmdName+".go") - createCmdFile(project.License(), cmdPath, cmdName) - - fmt.Fprintln(cmd.OutOrStdout(), cmdName, "created at", cmdPath) - }, -} - -// validateCmdName returns source without any dashes and underscore. -// If there will be dash or underscore, next letter will be uppered. -// It supports only ASCII (1-byte character) strings. -// https://github.com/spf13/cobra/issues/269 -func validateCmdName(source string) string { - i := 0 - l := len(source) - // The output is initialized on demand, then first dash or underscore - // occurs. - var output string - - for i < l { - if source[i] == '-' || source[i] == '_' { - if output == "" { - output = source[:i] - } - - // If it's last rune and it's dash or underscore, - // don't add it output and break the loop. - if i == l-1 { - break - } - - // If next character is dash or underscore, - // just skip the current character. - if source[i+1] == '-' || source[i+1] == '_' { - i++ - continue - } - - // If the current character is dash or underscore, - // upper next letter and add to output. - output += string(unicode.ToUpper(rune(source[i+1]))) - // We know, what source[i] is dash or underscore and source[i+1] is - // uppered character, so make i = i+2. - i += 2 - continue - } - - // If the current character isn't dash or underscore, - // just add it. - if output != "" { - output += string(source[i]) - } - i++ - } - - if output == "" { - return source // source is initially valid name. - } - return output -} - -func createCmdFile(license License, path, cmdName string) { - template := `{{comment .copyright}} -{{comment .license}} - -package {{.cmdPackage}} - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -// {{.cmdName}}Cmd represents the {{.cmdName}} command -var {{.cmdName}}Cmd = &cobra.Command{ - Use: "{{.cmdName}}", - Short: "A brief description of your command", - Long: ` + "`" + `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.` + "`" + `, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("{{.cmdName}} called") - }, -} - -func init() { - {{.parentName}}.AddCommand({{.cmdName}}Cmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // {{.cmdName}}Cmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // {{.cmdName}}Cmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} -` - - data := make(map[string]interface{}) - data["copyright"] = copyrightLine() - data["license"] = license.Header - data["cmdPackage"] = filepath.Base(filepath.Dir(path)) // last dir of path - data["parentName"] = parentName - data["cmdName"] = cmdName - - cmdScript, err := executeTemplate(template, data) - if err != nil { - er(err) - } - err = writeStringToFile(path, cmdScript) - if err != nil { - er(err) - } -} +// Copyright © 2015 Steve Francia . +// +// 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 cmd + +import ( + "fmt" + "os" + "path/filepath" + "unicode" + + "github.com/spf13/cobra" +) + +func init() { + addCmd.Flags().StringVarP(&parentName, "parent", "p", "RootCmd", "name of parent command for this command") +} + +var parentName string + +var addCmd = &cobra.Command{ + Use: "add [command name]", + Aliases: []string{"command"}, + Short: "Add a command to a Cobra Application", + Long: `Add (cobra add) will create a new command, with a license and +the appropriate structure for a Cobra-based CLI application, +and register it to its parent (default RootCmd). + +If you want your command to be public, pass in the command name +with an initial uppercase letter. + +Example: cobra add server -> resulting in a new cmd/server.go`, + + Run: func(cmd *cobra.Command, args []string) { + if len(args) < 1 { + er("add needs a name for the command") + } + wd, err := os.Getwd() + if err != nil { + er(err) + } + project := NewProjectFromPath(wd) + + cmdName := validateCmdName(args[0]) + cmdPath := filepath.Join(project.CmdPath(), cmdName+".go") + createCmdFile(project.License(), cmdPath, cmdName) + + fmt.Fprintln(cmd.OutOrStdout(), cmdName, "created at", cmdPath) + }, +} + +// validateCmdName returns source without any dashes and underscore. +// If there will be dash or underscore, next letter will be uppered. +// It supports only ASCII (1-byte character) strings. +// https://github.com/spf13/cobra/issues/269 +func validateCmdName(source string) string { + i := 0 + l := len(source) + // The output is initialized on demand, then first dash or underscore + // occurs. + var output string + + for i < l { + if source[i] == '-' || source[i] == '_' { + if output == "" { + output = source[:i] + } + + // If it's last rune and it's dash or underscore, + // don't add it output and break the loop. + if i == l-1 { + break + } + + // If next character is dash or underscore, + // just skip the current character. + if source[i+1] == '-' || source[i+1] == '_' { + i++ + continue + } + + // If the current character is dash or underscore, + // upper next letter and add to output. + output += string(unicode.ToUpper(rune(source[i+1]))) + // We know, what source[i] is dash or underscore and source[i+1] is + // uppered character, so make i = i+2. + i += 2 + continue + } + + // If the current character isn't dash or underscore, + // just add it. + if output != "" { + output += string(source[i]) + } + i++ + } + + if output == "" { + return source // source is initially valid name. + } + return output +} + +func createCmdFile(license License, path, cmdName string) { + template := `{{comment .copyright}} +{{comment .license}} + +package {{.cmdPackage}} + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// {{.cmdName}}Cmd represents the {{.cmdName}} command +var {{.cmdName}}Cmd = &cobra.Command{ + Use: "{{.cmdName}}", + Short: "A brief description of your command", + Long: ` + "`" + `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.` + "`" + `, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("{{.cmdName}} called") + }, +} + +func init() { + {{.parentName}}.AddCommand({{.cmdName}}Cmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // {{.cmdName}}Cmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // {{.cmdName}}Cmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} +` + + data := make(map[string]interface{}) + data["copyright"] = copyrightLine() + data["license"] = license.Header + data["cmdPackage"] = filepath.Base(filepath.Dir(path)) // last dir of path + data["parentName"] = parentName + data["cmdName"] = cmdName + + cmdScript, err := executeTemplate(template, data) + if err != nil { + er(err) + } + err = writeStringToFile(path, cmdScript) + if err != nil { + er(err) + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/add_test.go b/vendor/github.com/spf13/cobra/cobra/cmd/add_test.go index 6dd61e835a..dacbe838a0 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/add_test.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/add_test.go @@ -1,100 +1,100 @@ -package cmd - -import ( - "errors" - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -// TestGoldenAddCmd initializes the project "github.com/spf13/testproject" -// in GOPATH, adds "test" command -// and compares the content of all files in cmd directory of testproject -// with appropriate golden files. -// Use -update to update existing golden files. -func TestGoldenAddCmd(t *testing.T) { - projectName := "github.com/spf13/testproject" - project := NewProject(projectName) - - // Initialize the project at first. - initializeProject(project) - defer os.RemoveAll(project.AbsPath()) - - // Then add the "test" command. - cmdName := "test" - cmdPath := filepath.Join(project.CmdPath(), cmdName+".go") - createCmdFile(project.License(), cmdPath, cmdName) - - expectedFiles := []string{".", "root.go", "test.go"} - gotFiles := []string{} - - // Check project file hierarchy and compare the content of every single file - // with appropriate golden file. - err := filepath.Walk(project.CmdPath(), func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - // Make path relative to project.CmdPath(). - // E.g. path = "/home/user/go/src/github.com/spf13/testproject/cmd/root.go" - // then it returns just "root.go". - relPath, err := filepath.Rel(project.CmdPath(), path) - if err != nil { - return err - } - relPath = filepath.ToSlash(relPath) - gotFiles = append(gotFiles, relPath) - goldenPath := filepath.Join("testdata", filepath.Base(path)+".golden") - - switch relPath { - // Know directories. - case ".": - return nil - // Known files. - case "root.go", "test.go": - if *update { - got, err := ioutil.ReadFile(path) - if err != nil { - return err - } - ioutil.WriteFile(goldenPath, got, 0644) - } - return compareFiles(path, goldenPath) - } - // Unknown file. - return errors.New("unknown file: " + path) - }) - if err != nil { - t.Fatal(err) - } - - // Check if some files lack. - if err := checkLackFiles(expectedFiles, gotFiles); err != nil { - t.Fatal(err) - } -} - -func TestValidateCmdName(t *testing.T) { - testCases := []struct { - input string - expected string - }{ - {"cmdName", "cmdName"}, - {"cmd_name", "cmdName"}, - {"cmd-name", "cmdName"}, - {"cmd______Name", "cmdName"}, - {"cmd------Name", "cmdName"}, - {"cmd______name", "cmdName"}, - {"cmd------name", "cmdName"}, - {"cmdName-----", "cmdName"}, - {"cmdname-", "cmdname"}, - } - - for _, testCase := range testCases { - got := validateCmdName(testCase.input) - if testCase.expected != got { - t.Errorf("Expected %q, got %q", testCase.expected, got) - } - } -} +package cmd + +import ( + "errors" + "io/ioutil" + "os" + "path/filepath" + "testing" +) + +// TestGoldenAddCmd initializes the project "github.com/spf13/testproject" +// in GOPATH, adds "test" command +// and compares the content of all files in cmd directory of testproject +// with appropriate golden files. +// Use -update to update existing golden files. +func TestGoldenAddCmd(t *testing.T) { + projectName := "github.com/spf13/testproject" + project := NewProject(projectName) + + // Initialize the project at first. + initializeProject(project) + defer os.RemoveAll(project.AbsPath()) + + // Then add the "test" command. + cmdName := "test" + cmdPath := filepath.Join(project.CmdPath(), cmdName+".go") + createCmdFile(project.License(), cmdPath, cmdName) + + expectedFiles := []string{".", "root.go", "test.go"} + gotFiles := []string{} + + // Check project file hierarchy and compare the content of every single file + // with appropriate golden file. + err := filepath.Walk(project.CmdPath(), func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + // Make path relative to project.CmdPath(). + // E.g. path = "/home/user/go/src/github.com/spf13/testproject/cmd/root.go" + // then it returns just "root.go". + relPath, err := filepath.Rel(project.CmdPath(), path) + if err != nil { + return err + } + relPath = filepath.ToSlash(relPath) + gotFiles = append(gotFiles, relPath) + goldenPath := filepath.Join("testdata", filepath.Base(path)+".golden") + + switch relPath { + // Know directories. + case ".": + return nil + // Known files. + case "root.go", "test.go": + if *update { + got, err := ioutil.ReadFile(path) + if err != nil { + return err + } + ioutil.WriteFile(goldenPath, got, 0644) + } + return compareFiles(path, goldenPath) + } + // Unknown file. + return errors.New("unknown file: " + path) + }) + if err != nil { + t.Fatal(err) + } + + // Check if some files lack. + if err := checkLackFiles(expectedFiles, gotFiles); err != nil { + t.Fatal(err) + } +} + +func TestValidateCmdName(t *testing.T) { + testCases := []struct { + input string + expected string + }{ + {"cmdName", "cmdName"}, + {"cmd_name", "cmdName"}, + {"cmd-name", "cmdName"}, + {"cmd______Name", "cmdName"}, + {"cmd------Name", "cmdName"}, + {"cmd______name", "cmdName"}, + {"cmd------name", "cmdName"}, + {"cmdName-----", "cmdName"}, + {"cmdname-", "cmdname"}, + } + + for _, testCase := range testCases { + got := validateCmdName(testCase.input) + if testCase.expected != got { + t.Errorf("Expected %q, got %q", testCase.expected, got) + } + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go b/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go index 8621cceaa0..0ac7e89353 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/golden_test.go @@ -1,77 +1,77 @@ -package cmd - -import ( - "bytes" - "errors" - "flag" - "fmt" - "io/ioutil" - "os/exec" -) - -var update = flag.Bool("update", false, "update .golden files") - -func init() { - // Mute commands. - addCmd.SetOutput(new(bytes.Buffer)) - initCmd.SetOutput(new(bytes.Buffer)) -} - -// compareFiles compares the content of files with pathA and pathB. -// If contents are equal, it returns nil. -// If not, it returns which files are not equal -// and diff (if system has diff command) between these files. -func compareFiles(pathA, pathB string) error { - contentA, err := ioutil.ReadFile(pathA) - if err != nil { - return err - } - contentB, err := ioutil.ReadFile(pathB) - if err != nil { - return err - } - if !bytes.Equal(contentA, contentB) { - output := new(bytes.Buffer) - output.WriteString(fmt.Sprintf("%q and %q are not equal!\n\n", pathA, pathB)) - - diffPath, err := exec.LookPath("diff") - if err != nil { - // Don't execute diff if it can't be found. - return nil - } - diffCmd := exec.Command(diffPath, pathA, pathB) - diffCmd.Stdout = output - diffCmd.Stderr = output - - output.WriteString("$ diff " + pathA + " " + pathB + "\n") - if err := diffCmd.Run(); err != nil { - output.WriteString("\n" + err.Error()) - } - return errors.New(output.String()) - } - return nil -} - -// checkLackFiles checks if all elements of expected are in got. -func checkLackFiles(expected, got []string) error { - lacks := make([]string, 0, len(expected)) - for _, ev := range expected { - if !stringInStringSlice(ev, got) { - lacks = append(lacks, ev) - } - } - if len(lacks) > 0 { - return fmt.Errorf("Lack %v file(s): %v", len(lacks), lacks) - } - return nil -} - -// stringInStringSlice checks if s is an element of slice. -func stringInStringSlice(s string, slice []string) bool { - for _, v := range slice { - if s == v { - return true - } - } - return false -} +package cmd + +import ( + "bytes" + "errors" + "flag" + "fmt" + "io/ioutil" + "os/exec" +) + +var update = flag.Bool("update", false, "update .golden files") + +func init() { + // Mute commands. + addCmd.SetOutput(new(bytes.Buffer)) + initCmd.SetOutput(new(bytes.Buffer)) +} + +// compareFiles compares the content of files with pathA and pathB. +// If contents are equal, it returns nil. +// If not, it returns which files are not equal +// and diff (if system has diff command) between these files. +func compareFiles(pathA, pathB string) error { + contentA, err := ioutil.ReadFile(pathA) + if err != nil { + return err + } + contentB, err := ioutil.ReadFile(pathB) + if err != nil { + return err + } + if !bytes.Equal(contentA, contentB) { + output := new(bytes.Buffer) + output.WriteString(fmt.Sprintf("%q and %q are not equal!\n\n", pathA, pathB)) + + diffPath, err := exec.LookPath("diff") + if err != nil { + // Don't execute diff if it can't be found. + return nil + } + diffCmd := exec.Command(diffPath, pathA, pathB) + diffCmd.Stdout = output + diffCmd.Stderr = output + + output.WriteString("$ diff " + pathA + " " + pathB + "\n") + if err := diffCmd.Run(); err != nil { + output.WriteString("\n" + err.Error()) + } + return errors.New(output.String()) + } + return nil +} + +// checkLackFiles checks if all elements of expected are in got. +func checkLackFiles(expected, got []string) error { + lacks := make([]string, 0, len(expected)) + for _, ev := range expected { + if !stringInStringSlice(ev, got) { + lacks = append(lacks, ev) + } + } + if len(lacks) > 0 { + return fmt.Errorf("Lack %v file(s): %v", len(lacks), lacks) + } + return nil +} + +// stringInStringSlice checks if s is an element of slice. +func stringInStringSlice(s string, slice []string) bool { + for _, v := range slice { + if s == v { + return true + } + } + return false +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/helpers.go b/vendor/github.com/spf13/cobra/cobra/cmd/helpers.go index 8d41b0990c..6114227dbf 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/helpers.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/helpers.go @@ -1,140 +1,140 @@ -// Copyright © 2015 Steve Francia . -// -// 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 cmd - -import ( - "bytes" - "fmt" - "io" - "os" - "path/filepath" - "strings" - "text/template" -) - -var cmdDirs = [...]string{"cmd", "cmds", "command", "commands"} -var srcPaths []string - -func init() { - // Initialize srcPaths. - envGoPath := os.Getenv("GOPATH") - goPaths := filepath.SplitList(envGoPath) - if len(goPaths) == 0 { - er("$GOPATH is not set") - } - srcPaths = make([]string, 0, len(goPaths)) - for _, goPath := range goPaths { - srcPaths = append(srcPaths, filepath.Join(goPath, "src")) - } -} - -func er(msg interface{}) { - fmt.Println("Error:", msg) - os.Exit(1) -} - -// isEmpty checks if a given path is empty. -func isEmpty(path string) bool { - fi, err := os.Stat(path) - if err != nil { - er(err) - } - if fi.IsDir() { - f, err := os.Open(path) - if err != nil { - er(err) - } - defer f.Close() - dirs, err := f.Readdirnames(1) - if err != nil && err != io.EOF { - er(err) - } - return len(dirs) == 0 - } - return fi.Size() == 0 -} - -// exists checks if a file or directory exists. -func exists(path string) bool { - if path == "" { - return false - } - _, err := os.Stat(path) - if err == nil { - return true - } - if !os.IsNotExist(err) { - er(err) - } - return false -} - -func executeTemplate(tmplStr string, data interface{}) (string, error) { - tmpl, err := template.New("").Funcs(template.FuncMap{"comment": commentifyString}).Parse(tmplStr) - if err != nil { - return "", err - } - - buf := new(bytes.Buffer) - err = tmpl.Execute(buf, data) - return buf.String(), err -} - -func writeStringToFile(path string, s string) error { - return writeToFile(path, strings.NewReader(s)) -} - -// writeToFile writes r to file with path only -// if file/directory on given path doesn't exist. -// If file/directory exists on given path, then -// it terminates app and prints an appropriate error. -func writeToFile(path string, r io.Reader) error { - if exists(path) { - return fmt.Errorf("%v already exists", path) - } - - dir := filepath.Dir(path) - if dir != "" { - if err := os.MkdirAll(dir, 0777); err != nil { - return err - } - } - - file, err := os.Create(path) - if err != nil { - return err - } - defer file.Close() - - _, err = io.Copy(file, r) - return err -} - -// commentfyString comments every line of in. -func commentifyString(in string) string { - var newlines []string - lines := strings.Split(in, "\n") - for _, line := range lines { - if strings.HasPrefix(line, "//") { - newlines = append(newlines, line) - } else { - if line == "" { - newlines = append(newlines, "//") - } else { - newlines = append(newlines, "// "+line) - } - } - } - return strings.Join(newlines, "\n") -} +// Copyright © 2015 Steve Francia . +// +// 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 cmd + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "strings" + "text/template" +) + +var cmdDirs = [...]string{"cmd", "cmds", "command", "commands"} +var srcPaths []string + +func init() { + // Initialize srcPaths. + envGoPath := os.Getenv("GOPATH") + goPaths := filepath.SplitList(envGoPath) + if len(goPaths) == 0 { + er("$GOPATH is not set") + } + srcPaths = make([]string, 0, len(goPaths)) + for _, goPath := range goPaths { + srcPaths = append(srcPaths, filepath.Join(goPath, "src")) + } +} + +func er(msg interface{}) { + fmt.Println("Error:", msg) + os.Exit(1) +} + +// isEmpty checks if a given path is empty. +func isEmpty(path string) bool { + fi, err := os.Stat(path) + if err != nil { + er(err) + } + if fi.IsDir() { + f, err := os.Open(path) + if err != nil { + er(err) + } + defer f.Close() + dirs, err := f.Readdirnames(1) + if err != nil && err != io.EOF { + er(err) + } + return len(dirs) == 0 + } + return fi.Size() == 0 +} + +// exists checks if a file or directory exists. +func exists(path string) bool { + if path == "" { + return false + } + _, err := os.Stat(path) + if err == nil { + return true + } + if !os.IsNotExist(err) { + er(err) + } + return false +} + +func executeTemplate(tmplStr string, data interface{}) (string, error) { + tmpl, err := template.New("").Funcs(template.FuncMap{"comment": commentifyString}).Parse(tmplStr) + if err != nil { + return "", err + } + + buf := new(bytes.Buffer) + err = tmpl.Execute(buf, data) + return buf.String(), err +} + +func writeStringToFile(path string, s string) error { + return writeToFile(path, strings.NewReader(s)) +} + +// writeToFile writes r to file with path only +// if file/directory on given path doesn't exist. +// If file/directory exists on given path, then +// it terminates app and prints an appropriate error. +func writeToFile(path string, r io.Reader) error { + if exists(path) { + return fmt.Errorf("%v already exists", path) + } + + dir := filepath.Dir(path) + if dir != "" { + if err := os.MkdirAll(dir, 0777); err != nil { + return err + } + } + + file, err := os.Create(path) + if err != nil { + return err + } + defer file.Close() + + _, err = io.Copy(file, r) + return err +} + +// commentfyString comments every line of in. +func commentifyString(in string) string { + var newlines []string + lines := strings.Split(in, "\n") + for _, line := range lines { + if strings.HasPrefix(line, "//") { + newlines = append(newlines, line) + } else { + if line == "" { + newlines = append(newlines, "//") + } else { + newlines = append(newlines, "// "+line) + } + } + } + return strings.Join(newlines, "\n") +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/init.go b/vendor/github.com/spf13/cobra/cobra/cmd/init.go index 0312539788..0e2b22aa07 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/init.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/init.go @@ -1,234 +1,234 @@ -// Copyright © 2015 Steve Francia . -// -// 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 cmd - -import ( - "fmt" - "os" - "path" - "path/filepath" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var initCmd = &cobra.Command{ - Use: "init [name]", - Aliases: []string{"initialize", "initialise", "create"}, - Short: "Initialize a Cobra Application", - Long: `Initialize (cobra init) will create a new application, with a license -and the appropriate structure for a Cobra-based CLI application. - - * If a name is provided, it will be created in the current directory; - * If no name is provided, the current directory will be assumed; - * If a relative path is provided, it will be created inside $GOPATH - (e.g. github.com/spf13/hugo); - * If an absolute path is provided, it will be created; - * If the directory already exists but is empty, it will be used. - -Init will not use an existing directory with contents.`, - - Run: func(cmd *cobra.Command, args []string) { - wd, err := os.Getwd() - if err != nil { - er(err) - } - - var project *Project - if len(args) == 0 { - project = NewProjectFromPath(wd) - } else if len(args) == 1 { - arg := args[0] - if arg[0] == '.' { - arg = filepath.Join(wd, arg) - } - if filepath.IsAbs(arg) { - project = NewProjectFromPath(arg) - } else { - project = NewProject(arg) - } - } else { - er("please enter the name") - } - - initializeProject(project) - - fmt.Fprintln(cmd.OutOrStdout(), `Your Cobra application is ready at -`+project.AbsPath()+`. - -Give it a try by going there and running `+"`go run main.go`."+` -Add commands to it by running `+"`cobra add [cmdname]`.") - }, -} - -func initializeProject(project *Project) { - if !exists(project.AbsPath()) { // If path doesn't yet exist, create it - err := os.MkdirAll(project.AbsPath(), os.ModePerm) - if err != nil { - er(err) - } - } else if !isEmpty(project.AbsPath()) { // If path exists and is not empty don't use it - er("Cobra will not create a new project in a non empty directory: " + project.AbsPath()) - } - - // We have a directory and it's empty. Time to initialize it. - createLicenseFile(project.License(), project.AbsPath()) - createMainFile(project) - createRootCmdFile(project) -} - -func createLicenseFile(license License, path string) { - data := make(map[string]interface{}) - data["copyright"] = copyrightLine() - - // Generate license template from text and data. - text, err := executeTemplate(license.Text, data) - if err != nil { - er(err) - } - - // Write license text to LICENSE file. - err = writeStringToFile(filepath.Join(path, "LICENSE"), text) - if err != nil { - er(err) - } -} - -func createMainFile(project *Project) { - mainTemplate := `{{ comment .copyright }} -{{if .license}}{{ comment .license }}{{end}} - -package main - -import "{{ .importpath }}" - -func main() { - cmd.Execute() -} -` - data := make(map[string]interface{}) - data["copyright"] = copyrightLine() - data["license"] = project.License().Header - data["importpath"] = path.Join(project.Name(), filepath.Base(project.CmdPath())) - - mainScript, err := executeTemplate(mainTemplate, data) - if err != nil { - er(err) - } - - err = writeStringToFile(filepath.Join(project.AbsPath(), "main.go"), mainScript) - if err != nil { - er(err) - } -} - -func createRootCmdFile(project *Project) { - template := `{{comment .copyright}} -{{if .license}}{{comment .license}}{{end}} - -package cmd - -import ( - "fmt" - "os" - - homedir "github.com/mitchellh/go-homedir" - "github.com/spf13/cobra" -{{if .viper}} "github.com/spf13/viper"{{end}} -) - -{{if .viper}}var cfgFile string{{end}} - -// RootCmd represents the base command when called without any subcommands -var RootCmd = &cobra.Command{ - Use: "{{.appName}}", - Short: "A brief description of your application", - Long: ` + "`" + `A longer description that spans multiple lines and likely contains -examples and usage of using your application. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.` + "`" + `, - // Uncomment the following line if your bare application - // has an action associated with it: - // Run: func(cmd *cobra.Command, args []string) { }, -} - -// Execute adds all child commands to the root command sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. -func Execute() { - if err := RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} - -func init() { -{{if .viper}} cobra.OnInitialize(initConfig){{end}} - - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application.{{ if .viper }} - RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.{{ .appName }}.yaml)"){{ else }} - // RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.{{ .appName }}.yaml)"){{ end }} - - // Cobra also supports local flags, which will only run - // when this action is called directly. - RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -}{{ if .viper }} - -// initConfig reads in config file and ENV variables if set. -func initConfig() { - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := homedir.Dir() - if err != nil { - fmt.Println(err) - os.Exit(1) - } - - // Search config in home directory with name ".{{ .appName }}" (without extension). - viper.AddConfigPath(home) - viper.SetConfigName(".{{ .appName }}") - } - - viper.AutomaticEnv() // read in environment variables that match - - // If a config file is found, read it in. - if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) - } -}{{ end }} -` - - data := make(map[string]interface{}) - data["copyright"] = copyrightLine() - data["viper"] = viper.GetBool("useViper") - data["license"] = project.License().Header - data["appName"] = path.Base(project.Name()) - - rootCmdScript, err := executeTemplate(template, data) - if err != nil { - er(err) - } - - err = writeStringToFile(filepath.Join(project.CmdPath(), "root.go"), rootCmdScript) - if err != nil { - er(err) - } - -} +// Copyright © 2015 Steve Francia . +// +// 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 cmd + +import ( + "fmt" + "os" + "path" + "path/filepath" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var initCmd = &cobra.Command{ + Use: "init [name]", + Aliases: []string{"initialize", "initialise", "create"}, + Short: "Initialize a Cobra Application", + Long: `Initialize (cobra init) will create a new application, with a license +and the appropriate structure for a Cobra-based CLI application. + + * If a name is provided, it will be created in the current directory; + * If no name is provided, the current directory will be assumed; + * If a relative path is provided, it will be created inside $GOPATH + (e.g. github.com/spf13/hugo); + * If an absolute path is provided, it will be created; + * If the directory already exists but is empty, it will be used. + +Init will not use an existing directory with contents.`, + + Run: func(cmd *cobra.Command, args []string) { + wd, err := os.Getwd() + if err != nil { + er(err) + } + + var project *Project + if len(args) == 0 { + project = NewProjectFromPath(wd) + } else if len(args) == 1 { + arg := args[0] + if arg[0] == '.' { + arg = filepath.Join(wd, arg) + } + if filepath.IsAbs(arg) { + project = NewProjectFromPath(arg) + } else { + project = NewProject(arg) + } + } else { + er("please enter the name") + } + + initializeProject(project) + + fmt.Fprintln(cmd.OutOrStdout(), `Your Cobra application is ready at +`+project.AbsPath()+`. + +Give it a try by going there and running `+"`go run main.go`."+` +Add commands to it by running `+"`cobra add [cmdname]`.") + }, +} + +func initializeProject(project *Project) { + if !exists(project.AbsPath()) { // If path doesn't yet exist, create it + err := os.MkdirAll(project.AbsPath(), os.ModePerm) + if err != nil { + er(err) + } + } else if !isEmpty(project.AbsPath()) { // If path exists and is not empty don't use it + er("Cobra will not create a new project in a non empty directory: " + project.AbsPath()) + } + + // We have a directory and it's empty. Time to initialize it. + createLicenseFile(project.License(), project.AbsPath()) + createMainFile(project) + createRootCmdFile(project) +} + +func createLicenseFile(license License, path string) { + data := make(map[string]interface{}) + data["copyright"] = copyrightLine() + + // Generate license template from text and data. + text, err := executeTemplate(license.Text, data) + if err != nil { + er(err) + } + + // Write license text to LICENSE file. + err = writeStringToFile(filepath.Join(path, "LICENSE"), text) + if err != nil { + er(err) + } +} + +func createMainFile(project *Project) { + mainTemplate := `{{ comment .copyright }} +{{if .license}}{{ comment .license }}{{end}} + +package main + +import "{{ .importpath }}" + +func main() { + cmd.Execute() +} +` + data := make(map[string]interface{}) + data["copyright"] = copyrightLine() + data["license"] = project.License().Header + data["importpath"] = path.Join(project.Name(), filepath.Base(project.CmdPath())) + + mainScript, err := executeTemplate(mainTemplate, data) + if err != nil { + er(err) + } + + err = writeStringToFile(filepath.Join(project.AbsPath(), "main.go"), mainScript) + if err != nil { + er(err) + } +} + +func createRootCmdFile(project *Project) { + template := `{{comment .copyright}} +{{if .license}}{{comment .license}}{{end}} + +package cmd + +import ( + "fmt" + "os" + + homedir "github.com/mitchellh/go-homedir" + "github.com/spf13/cobra" +{{if .viper}} "github.com/spf13/viper"{{end}} +) + +{{if .viper}}var cfgFile string{{end}} + +// RootCmd represents the base command when called without any subcommands +var RootCmd = &cobra.Command{ + Use: "{{.appName}}", + Short: "A brief description of your application", + Long: ` + "`" + `A longer description that spans multiple lines and likely contains +examples and usage of using your application. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.` + "`" + `, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// Execute adds all child commands to the root command sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + if err := RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func init() { +{{if .viper}} cobra.OnInitialize(initConfig){{end}} + + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application.{{ if .viper }} + RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.{{ .appName }}.yaml)"){{ else }} + // RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.{{ .appName }}.yaml)"){{ end }} + + // Cobra also supports local flags, which will only run + // when this action is called directly. + RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +}{{ if .viper }} + +// initConfig reads in config file and ENV variables if set. +func initConfig() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := homedir.Dir() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + // Search config in home directory with name ".{{ .appName }}" (without extension). + viper.AddConfigPath(home) + viper.SetConfigName(".{{ .appName }}") + } + + viper.AutomaticEnv() // read in environment variables that match + + // If a config file is found, read it in. + if err := viper.ReadInConfig(); err == nil { + fmt.Println("Using config file:", viper.ConfigFileUsed()) + } +}{{ end }} +` + + data := make(map[string]interface{}) + data["copyright"] = copyrightLine() + data["viper"] = viper.GetBool("useViper") + data["license"] = project.License().Header + data["appName"] = path.Base(project.Name()) + + rootCmdScript, err := executeTemplate(template, data) + if err != nil { + er(err) + } + + err = writeStringToFile(filepath.Join(project.CmdPath(), "root.go"), rootCmdScript) + if err != nil { + er(err) + } + +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/init_test.go b/vendor/github.com/spf13/cobra/cobra/cmd/init_test.go index efd748dae5..9a918b9b46 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/init_test.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/init_test.go @@ -1,74 +1,74 @@ -package cmd - -import ( - "errors" - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -// TestGoldenInitCmd initializes the project "github.com/spf13/testproject" -// in GOPATH and compares the content of files in initialized project with -// appropriate golden files ("testdata/*.golden"). -// Use -update to update existing golden files. -func TestGoldenInitCmd(t *testing.T) { - projectName := "github.com/spf13/testproject" - project := NewProject(projectName) - defer os.RemoveAll(project.AbsPath()) - - os.Args = []string{"cobra", "init", projectName} - if err := rootCmd.Execute(); err != nil { - t.Fatal("Error by execution:", err) - } - - expectedFiles := []string{".", "cmd", "LICENSE", "main.go", "cmd/root.go"} - gotFiles := []string{} - - // Check project file hierarchy and compare the content of every single file - // with appropriate golden file. - err := filepath.Walk(project.AbsPath(), func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - // Make path relative to project.AbsPath(). - // E.g. path = "/home/user/go/src/github.com/spf13/testproject/cmd/root.go" - // then it returns just "cmd/root.go". - relPath, err := filepath.Rel(project.AbsPath(), path) - if err != nil { - return err - } - relPath = filepath.ToSlash(relPath) - gotFiles = append(gotFiles, relPath) - goldenPath := filepath.Join("testdata", filepath.Base(path)+".golden") - - switch relPath { - // Know directories. - case ".", "cmd": - return nil - // Known files. - case "LICENSE", "main.go", "cmd/root.go": - if *update { - got, err := ioutil.ReadFile(path) - if err != nil { - return err - } - if err := ioutil.WriteFile(goldenPath, got, 0644); err != nil { - t.Fatal("Error while updating file:", err) - } - } - return compareFiles(path, goldenPath) - } - // Unknown file. - return errors.New("unknown file: " + path) - }) - if err != nil { - t.Fatal(err) - } - - // Check if some files lack. - if err := checkLackFiles(expectedFiles, gotFiles); err != nil { - t.Fatal(err) - } -} +package cmd + +import ( + "errors" + "io/ioutil" + "os" + "path/filepath" + "testing" +) + +// TestGoldenInitCmd initializes the project "github.com/spf13/testproject" +// in GOPATH and compares the content of files in initialized project with +// appropriate golden files ("testdata/*.golden"). +// Use -update to update existing golden files. +func TestGoldenInitCmd(t *testing.T) { + projectName := "github.com/spf13/testproject" + project := NewProject(projectName) + defer os.RemoveAll(project.AbsPath()) + + os.Args = []string{"cobra", "init", projectName} + if err := rootCmd.Execute(); err != nil { + t.Fatal("Error by execution:", err) + } + + expectedFiles := []string{".", "cmd", "LICENSE", "main.go", "cmd/root.go"} + gotFiles := []string{} + + // Check project file hierarchy and compare the content of every single file + // with appropriate golden file. + err := filepath.Walk(project.AbsPath(), func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + // Make path relative to project.AbsPath(). + // E.g. path = "/home/user/go/src/github.com/spf13/testproject/cmd/root.go" + // then it returns just "cmd/root.go". + relPath, err := filepath.Rel(project.AbsPath(), path) + if err != nil { + return err + } + relPath = filepath.ToSlash(relPath) + gotFiles = append(gotFiles, relPath) + goldenPath := filepath.Join("testdata", filepath.Base(path)+".golden") + + switch relPath { + // Know directories. + case ".", "cmd": + return nil + // Known files. + case "LICENSE", "main.go", "cmd/root.go": + if *update { + got, err := ioutil.ReadFile(path) + if err != nil { + return err + } + if err := ioutil.WriteFile(goldenPath, got, 0644); err != nil { + t.Fatal("Error while updating file:", err) + } + } + return compareFiles(path, goldenPath) + } + // Unknown file. + return errors.New("unknown file: " + path) + }) + if err != nil { + t.Fatal(err) + } + + // Check if some files lack. + if err := checkLackFiles(expectedFiles, gotFiles); err != nil { + t.Fatal(err) + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go index 3134f04f7a..4ea036edef 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go @@ -1,684 +1,684 @@ -package cmd - -func initAgpl() { - Licenses["agpl"] = License{ - Name: "GNU Affero General Public License", - PossibleMatches: []string{"agpl", "affero gpl", "gnu agpl"}, - Header: `{{.copyright}} - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see .`, - Text: ` GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. -`, - } -} +package cmd + +func initAgpl() { + Licenses["agpl"] = License{ + Name: "GNU Affero General Public License", + PossibleMatches: []string{"agpl", "affero gpl", "gnu agpl"}, + Header: `{{.copyright}} + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .`, + Text: ` GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go index cf06f31fdc..3f330867d1 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go @@ -1,237 +1,237 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -func initApache2() { - Licenses["apache"] = License{ - Name: "Apache 2.0", - PossibleMatches: []string{"apache", "apache20", "apache 2.0", "apache2.0", "apache-2.0"}, - Header: `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.`, - Text: ` - 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. -`, - } -} +// Copyright © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initApache2() { + Licenses["apache"] = License{ + Name: "Apache 2.0", + PossibleMatches: []string{"apache", "apache20", "apache 2.0", "apache2.0", "apache-2.0"}, + Header: `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.`, + Text: ` + 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/spf13/cobra/cobra/cmd/license_bsd_clause_2.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go index 42d3e00b1a..f2982dab38 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go @@ -1,72 +1,72 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -func initBsdClause2() { - Licenses["freebsd"] = License{ - Name: "Simplified BSD License", - PossibleMatches: []string{"freebsd", "simpbsd", "simple bsd", "2-clause bsd", - "2 clause bsd", "simplified bsd license"}, - Header: ` -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. 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. - -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 HOLDER 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.`, - Text: `{{ .copyright }} -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. 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. - -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 HOLDER 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. -`, - } -} +// Copyright © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initBsdClause2() { + Licenses["freebsd"] = License{ + Name: "Simplified BSD License", + PossibleMatches: []string{"freebsd", "simpbsd", "simple bsd", "2-clause bsd", + "2 clause bsd", "simplified bsd license"}, + Header: ` +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. 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. + +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 HOLDER 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.`, + Text: `{{ .copyright }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. 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. + +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 HOLDER 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/spf13/cobra/cobra/cmd/license_bsd_clause_3.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go index 5695547bba..39c9571f25 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go @@ -1,79 +1,79 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -func initBsdClause3() { - Licenses["bsd"] = License{ - Name: "NewBSD", - PossibleMatches: []string{"bsd", "newbsd", "3 clause bsd", "3-clause bsd"}, - Header: ` -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder 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 HOLDER 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.`, - Text: `{{ .copyright }} -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder 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 HOLDER 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. -`, - } -} +// Copyright © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initBsdClause3() { + Licenses["bsd"] = License{ + Name: "NewBSD", + PossibleMatches: []string{"bsd", "newbsd", "3 clause bsd", "3-clause bsd"}, + Header: ` +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. 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. + +3. Neither the name of the copyright holder 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 HOLDER 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.`, + Text: `{{ .copyright }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. 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. + +3. Neither the name of the copyright holder 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 HOLDER 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/spf13/cobra/cobra/cmd/license_gpl_2.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go index 52720c6bbe..054b470f1a 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go @@ -1,377 +1,377 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -func initGpl2() { - Licenses["gpl2"] = License{ - Name: "GNU General Public License 2.0", - PossibleMatches: []string{"gpl2", "gnu gpl2", "gplv2"}, - Header: `{{.copyright}} - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see .`, - Text: ` GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type 'show c' for details. - -The hypothetical commands 'show w' and 'show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than 'show w' and 'show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - 'Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. -`, - } -} +// Copyright © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initGpl2() { + Licenses["gpl2"] = License{ + Name: "GNU General Public License 2.0", + PossibleMatches: []string{"gpl2", "gnu gpl2", "gplv2"}, + Header: `{{.copyright}} + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see .`, + Text: ` GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than 'show w' and 'show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + 'Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go index 1046dfb9e7..d1ef656a77 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go @@ -1,712 +1,712 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -func initGpl3() { - Licenses["gpl3"] = License{ - Name: "GNU General Public License 3.0", - PossibleMatches: []string{"gpl3", "gplv3", "gpl", "gnu gpl3", "gnu gpl"}, - Header: `{{.copyright}} - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see .`, - Text: ` GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type 'show c' for details. - -The hypothetical commands 'show w' and 'show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. -`, - } -} +// Copyright © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initGpl3() { + Licenses["gpl3"] = License{ + Name: "GNU General Public License 3.0", + PossibleMatches: []string{"gpl3", "gplv3", "gpl", "gnu gpl3", "gnu gpl"}, + Header: `{{.copyright}} + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see .`, + Text: ` GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go index 86d4a0c0ec..75fd043b80 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go @@ -1,187 +1,187 @@ -package cmd - -func initLgpl() { - Licenses["lgpl"] = License{ - Name: "GNU Lesser General Public License", - PossibleMatches: []string{"lgpl", "lesser gpl", "gnu lgpl"}, - Header: `{{.copyright}} - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with this program. If not, see .`, - Text: ` GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library.`, - } -} +package cmd + +func initLgpl() { + Licenses["lgpl"] = License{ + Name: "GNU Lesser General Public License", + PossibleMatches: []string{"lgpl", "lesser gpl", "gnu lgpl"}, + Header: `{{.copyright}} + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see .`, + Text: ` GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library.`, + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go b/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go index 62dd2e396c..4ff5a4cdf0 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go @@ -1,63 +1,63 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -func initMit() { - Licenses["mit"] = License{ - Name: "Mit", - PossibleMatches: []string{"mit"}, - Header: ` -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.`, - Text: `The MIT License (MIT) - -{{ .copyright }} - -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 © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +func initMit() { + Licenses["mit"] = License{ + Name: "Mit", + PossibleMatches: []string{"mit"}, + Header: ` +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.`, + Text: `The MIT License (MIT) + +{{ .copyright }} + +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/spf13/cobra/cobra/cmd/licenses.go b/vendor/github.com/spf13/cobra/cobra/cmd/licenses.go index 4a5168c137..d73e6fb351 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/licenses.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/licenses.go @@ -1,114 +1,114 @@ -// Copyright © 2015 Steve Francia . -// -// 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. - -// Parts inspired by https://github.com/ryanuber/go-license - -package cmd - -import ( - "strings" - "time" - - "github.com/spf13/viper" -) - -// Licenses contains all possible licenses a user can choose from. -var Licenses = make(map[string]License) - -// License represents a software license agreement, containing the Name of -// the license, its possible matches (on the command line as given to cobra), -// the header to be used with each file on the file's creating, and the text -// of the license -type License struct { - Name string // The type of license in use - PossibleMatches []string // Similar names to guess - Text string // License text data - Header string // License header for source files -} - -func init() { - // Allows a user to not use a license. - Licenses["none"] = License{"None", []string{"none", "false"}, "", ""} - - initApache2() - initMit() - initBsdClause3() - initBsdClause2() - initGpl2() - initGpl3() - initLgpl() - initAgpl() -} - -// getLicense returns license specified by user in flag or in config. -// If user didn't specify the license, it returns Apache License 2.0. -// -// TODO: Inspect project for existing license -func getLicense() License { - // If explicitly flagged, use that. - if userLicense != "" { - return findLicense(userLicense) - } - - // If user wants to have custom license, use that. - if viper.IsSet("license.header") || viper.IsSet("license.text") { - return License{Header: viper.GetString("license.header"), - Text: "license.text"} - } - - // If user wants to have built-in license, use that. - if viper.IsSet("license") { - return findLicense(viper.GetString("license")) - } - - // If user didn't set any license, use Apache 2.0 by default. - return Licenses["apache"] -} - -func copyrightLine() string { - author := viper.GetString("author") - year := time.Now().Format("2006") - - return "Copyright © " + year + " " + author -} - -// findLicense looks for License object of built-in licenses. -// If it didn't find license, then the app will be terminated and -// error will be printed. -func findLicense(name string) License { - found := matchLicense(name) - if found == "" { - er("unknown license: " + name) - } - return Licenses[found] -} - -// matchLicense compares the given a license name -// to PossibleMatches of all built-in licenses. -// It returns blank string, if name is blank string or it didn't find -// then appropriate match to name. -func matchLicense(name string) string { - if name == "" { - return "" - } - - for key, lic := range Licenses { - for _, match := range lic.PossibleMatches { - if strings.EqualFold(name, match) { - return key - } - } - } - - return "" -} +// Copyright © 2015 Steve Francia . +// +// 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. + +// Parts inspired by https://github.com/ryanuber/go-license + +package cmd + +import ( + "strings" + "time" + + "github.com/spf13/viper" +) + +// Licenses contains all possible licenses a user can choose from. +var Licenses = make(map[string]License) + +// License represents a software license agreement, containing the Name of +// the license, its possible matches (on the command line as given to cobra), +// the header to be used with each file on the file's creating, and the text +// of the license +type License struct { + Name string // The type of license in use + PossibleMatches []string // Similar names to guess + Text string // License text data + Header string // License header for source files +} + +func init() { + // Allows a user to not use a license. + Licenses["none"] = License{"None", []string{"none", "false"}, "", ""} + + initApache2() + initMit() + initBsdClause3() + initBsdClause2() + initGpl2() + initGpl3() + initLgpl() + initAgpl() +} + +// getLicense returns license specified by user in flag or in config. +// If user didn't specify the license, it returns Apache License 2.0. +// +// TODO: Inspect project for existing license +func getLicense() License { + // If explicitly flagged, use that. + if userLicense != "" { + return findLicense(userLicense) + } + + // If user wants to have custom license, use that. + if viper.IsSet("license.header") || viper.IsSet("license.text") { + return License{Header: viper.GetString("license.header"), + Text: "license.text"} + } + + // If user wants to have built-in license, use that. + if viper.IsSet("license") { + return findLicense(viper.GetString("license")) + } + + // If user didn't set any license, use Apache 2.0 by default. + return Licenses["apache"] +} + +func copyrightLine() string { + author := viper.GetString("author") + year := time.Now().Format("2006") + + return "Copyright © " + year + " " + author +} + +// findLicense looks for License object of built-in licenses. +// If it didn't find license, then the app will be terminated and +// error will be printed. +func findLicense(name string) License { + found := matchLicense(name) + if found == "" { + er("unknown license: " + name) + } + return Licenses[found] +} + +// matchLicense compares the given a license name +// to PossibleMatches of all built-in licenses. +// It returns blank string, if name is blank string or it didn't find +// then appropriate match to name. +func matchLicense(name string) string { + if name == "" { + return "" + } + + for key, lic := range Licenses { + for _, match := range lic.PossibleMatches { + if strings.EqualFold(name, match) { + return key + } + } + } + + return "" +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/project.go b/vendor/github.com/spf13/cobra/cobra/cmd/project.go index a489d8ba69..de1168a139 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/project.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/project.go @@ -1,195 +1,195 @@ -package cmd - -import ( - "os" - "path/filepath" - "runtime" - "strings" -) - -// Project contains name, license and paths to projects. -type Project struct { - absPath string - cmdPath string - srcPath string - license License - name string -} - -// NewProject returns Project with specified project name. -// If projectName is blank string, it returns nil. -func NewProject(projectName string) *Project { - if projectName == "" { - return nil - } - - p := new(Project) - p.name = projectName - - // 1. Find already created protect. - p.absPath = findPackage(projectName) - - // 2. If there are no created project with this path, and user is in GOPATH, - // then use GOPATH/src/projectName. - if p.absPath == "" { - wd, err := os.Getwd() - if err != nil { - er(err) - } - for _, srcPath := range srcPaths { - goPath := filepath.Dir(srcPath) - if filepathHasPrefix(wd, goPath) { - p.absPath = filepath.Join(srcPath, projectName) - break - } - } - } - - // 3. If user is not in GOPATH, then use (first GOPATH)/src/projectName. - if p.absPath == "" { - p.absPath = filepath.Join(srcPaths[0], projectName) - } - - return p -} - -// findPackage returns full path to existing go package in GOPATHs. -// findPackage returns "", if it can't find path. -// If packageName is "", findPackage returns "". -func findPackage(packageName string) string { - if packageName == "" { - return "" - } - - for _, srcPath := range srcPaths { - packagePath := filepath.Join(srcPath, packageName) - if exists(packagePath) { - return packagePath - } - } - - return "" -} - -// NewProjectFromPath returns Project with specified absolute path to -// package. -// If absPath is blank string or if absPath is not actually absolute, -// it returns nil. -func NewProjectFromPath(absPath string) *Project { - if absPath == "" || !filepath.IsAbs(absPath) { - return nil - } - - p := new(Project) - p.absPath = absPath - p.absPath = strings.TrimSuffix(p.absPath, findCmdDir(p.absPath)) - p.name = filepath.ToSlash(trimSrcPath(p.absPath, p.SrcPath())) - return p -} - -// trimSrcPath trims at the beginning of absPath the srcPath. -func trimSrcPath(absPath, srcPath string) string { - relPath, err := filepath.Rel(srcPath, absPath) - if err != nil { - er("Cobra supports project only within $GOPATH: " + err.Error()) - } - return relPath -} - -// License returns the License object of project. -func (p *Project) License() License { - if p.license.Text == "" && p.license.Name != "None" { - p.license = getLicense() - } - - return p.license -} - -// Name returns the name of project, e.g. "github.com/spf13/cobra" -func (p Project) Name() string { - return p.name -} - -// CmdPath returns absolute path to directory, where all commands are located. -// -// CmdPath returns blank string, only if p.AbsPath() is a blank string. -func (p *Project) CmdPath() string { - if p.absPath == "" { - return "" - } - if p.cmdPath == "" { - p.cmdPath = filepath.Join(p.absPath, findCmdDir(p.absPath)) - } - return p.cmdPath -} - -// findCmdDir checks if base of absPath is cmd dir and returns it or -// looks for existing cmd dir in absPath. -// If the cmd dir doesn't exist, empty, or cannot be found, -// it returns "cmd". -func findCmdDir(absPath string) string { - if !exists(absPath) || isEmpty(absPath) { - return "cmd" - } - - if isCmdDir(absPath) { - return filepath.Base(absPath) - } - - files, _ := filepath.Glob(filepath.Join(absPath, "c*")) - for _, file := range files { - if isCmdDir(file) { - return filepath.Base(file) - } - } - - return "cmd" -} - -// isCmdDir checks if base of name is one of cmdDir. -func isCmdDir(name string) bool { - name = filepath.Base(name) - for _, cmdDir := range cmdDirs { - if name == cmdDir { - return true - } - } - return false -} - -// AbsPath returns absolute path of project. -func (p Project) AbsPath() string { - return p.absPath -} - -// SrcPath returns absolute path to $GOPATH/src where project is located. -func (p *Project) SrcPath() string { - if p.srcPath != "" { - return p.srcPath - } - if p.absPath == "" { - p.srcPath = srcPaths[0] - return p.srcPath - } - - for _, srcPath := range srcPaths { - if filepathHasPrefix(p.absPath, srcPath) { - p.srcPath = srcPath - break - } - } - - return p.srcPath -} - -func filepathHasPrefix(path string, prefix string) bool { - if len(path) <= len(prefix) { - return false - } - if runtime.GOOS == "windows" { - // Paths in windows are case-insensitive. - return strings.EqualFold(path[0:len(prefix)], prefix) - } - return path[0:len(prefix)] == prefix - -} +package cmd + +import ( + "os" + "path/filepath" + "runtime" + "strings" +) + +// Project contains name, license and paths to projects. +type Project struct { + absPath string + cmdPath string + srcPath string + license License + name string +} + +// NewProject returns Project with specified project name. +// If projectName is blank string, it returns nil. +func NewProject(projectName string) *Project { + if projectName == "" { + return nil + } + + p := new(Project) + p.name = projectName + + // 1. Find already created protect. + p.absPath = findPackage(projectName) + + // 2. If there are no created project with this path, and user is in GOPATH, + // then use GOPATH/src/projectName. + if p.absPath == "" { + wd, err := os.Getwd() + if err != nil { + er(err) + } + for _, srcPath := range srcPaths { + goPath := filepath.Dir(srcPath) + if filepathHasPrefix(wd, goPath) { + p.absPath = filepath.Join(srcPath, projectName) + break + } + } + } + + // 3. If user is not in GOPATH, then use (first GOPATH)/src/projectName. + if p.absPath == "" { + p.absPath = filepath.Join(srcPaths[0], projectName) + } + + return p +} + +// findPackage returns full path to existing go package in GOPATHs. +// findPackage returns "", if it can't find path. +// If packageName is "", findPackage returns "". +func findPackage(packageName string) string { + if packageName == "" { + return "" + } + + for _, srcPath := range srcPaths { + packagePath := filepath.Join(srcPath, packageName) + if exists(packagePath) { + return packagePath + } + } + + return "" +} + +// NewProjectFromPath returns Project with specified absolute path to +// package. +// If absPath is blank string or if absPath is not actually absolute, +// it returns nil. +func NewProjectFromPath(absPath string) *Project { + if absPath == "" || !filepath.IsAbs(absPath) { + return nil + } + + p := new(Project) + p.absPath = absPath + p.absPath = strings.TrimSuffix(p.absPath, findCmdDir(p.absPath)) + p.name = filepath.ToSlash(trimSrcPath(p.absPath, p.SrcPath())) + return p +} + +// trimSrcPath trims at the beginning of absPath the srcPath. +func trimSrcPath(absPath, srcPath string) string { + relPath, err := filepath.Rel(srcPath, absPath) + if err != nil { + er("Cobra supports project only within $GOPATH: " + err.Error()) + } + return relPath +} + +// License returns the License object of project. +func (p *Project) License() License { + if p.license.Text == "" && p.license.Name != "None" { + p.license = getLicense() + } + + return p.license +} + +// Name returns the name of project, e.g. "github.com/spf13/cobra" +func (p Project) Name() string { + return p.name +} + +// CmdPath returns absolute path to directory, where all commands are located. +// +// CmdPath returns blank string, only if p.AbsPath() is a blank string. +func (p *Project) CmdPath() string { + if p.absPath == "" { + return "" + } + if p.cmdPath == "" { + p.cmdPath = filepath.Join(p.absPath, findCmdDir(p.absPath)) + } + return p.cmdPath +} + +// findCmdDir checks if base of absPath is cmd dir and returns it or +// looks for existing cmd dir in absPath. +// If the cmd dir doesn't exist, empty, or cannot be found, +// it returns "cmd". +func findCmdDir(absPath string) string { + if !exists(absPath) || isEmpty(absPath) { + return "cmd" + } + + if isCmdDir(absPath) { + return filepath.Base(absPath) + } + + files, _ := filepath.Glob(filepath.Join(absPath, "c*")) + for _, file := range files { + if isCmdDir(file) { + return filepath.Base(file) + } + } + + return "cmd" +} + +// isCmdDir checks if base of name is one of cmdDir. +func isCmdDir(name string) bool { + name = filepath.Base(name) + for _, cmdDir := range cmdDirs { + if name == cmdDir { + return true + } + } + return false +} + +// AbsPath returns absolute path of project. +func (p Project) AbsPath() string { + return p.absPath +} + +// SrcPath returns absolute path to $GOPATH/src where project is located. +func (p *Project) SrcPath() string { + if p.srcPath != "" { + return p.srcPath + } + if p.absPath == "" { + p.srcPath = srcPaths[0] + return p.srcPath + } + + for _, srcPath := range srcPaths { + if filepathHasPrefix(p.absPath, srcPath) { + p.srcPath = srcPath + break + } + } + + return p.srcPath +} + +func filepathHasPrefix(path string, prefix string) bool { + if len(path) <= len(prefix) { + return false + } + if runtime.GOOS == "windows" { + // Paths in windows are case-insensitive. + return strings.EqualFold(path[0:len(prefix)], prefix) + } + return path[0:len(prefix)] == prefix + +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go b/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go index 23dbf146f6..037f7c554e 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go @@ -1,24 +1,24 @@ -package cmd - -import ( - "testing" -) - -func TestFindExistingPackage(t *testing.T) { - path := findPackage("github.com/spf13/cobra") - if path == "" { - t.Fatal("findPackage didn't find the existing package") - } - if !hasGoPathPrefix(path) { - t.Fatalf("%q is not in GOPATH, but must be", path) - } -} - -func hasGoPathPrefix(path string) bool { - for _, srcPath := range srcPaths { - if filepathHasPrefix(path, srcPath) { - return true - } - } - return false -} +package cmd + +import ( + "testing" +) + +func TestFindExistingPackage(t *testing.T) { + path := findPackage("github.com/spf13/cobra") + if path == "" { + t.Fatal("findPackage didn't find the existing package") + } + if !hasGoPathPrefix(path) { + t.Fatalf("%q is not in GOPATH, but must be", path) + } +} + +func hasGoPathPrefix(path string) bool { + for _, srcPath := range srcPaths { + if filepathHasPrefix(path, srcPath) { + return true + } + } + return false +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/root.go b/vendor/github.com/spf13/cobra/cobra/cmd/root.go index 5f7bc28289..cfc7852215 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/root.go +++ b/vendor/github.com/spf13/cobra/cobra/cmd/root.go @@ -1,84 +1,84 @@ -// Copyright © 2015 Steve Francia . -// -// 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 cmd - -import ( - "fmt" - - homedir "github.com/mitchellh/go-homedir" - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var ( - // Used for flags. - cfgFile, projectBase, userLicense string - - rootCmd = &cobra.Command{ - Use: "cobra", - Short: "A generator for Cobra based Applications", - Long: `Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - } -) - -// Execute executes the root command. -func Execute() { - if err := rootCmd.Execute(); err != nil { - er(err) - } -} - -func init() { - initViper() - - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") - rootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory, e.g. github.com/spf13/") - rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution") - rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `license` in config)") - rootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") - viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) - viper.BindPFlag("projectbase", rootCmd.PersistentFlags().Lookup("projectbase")) - viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")) - viper.SetDefault("author", "NAME HERE ") - viper.SetDefault("license", "apache") - - rootCmd.AddCommand(initCmd) - rootCmd.AddCommand(addCmd) - -} - -func initViper() { - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := homedir.Dir() - if err != nil { - er(err) - } - - // Search config in home directory with name ".cobra" (without extension). - viper.AddConfigPath(home) - viper.SetConfigName(".cobra") - } - - viper.AutomaticEnv() - - if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) - } -} +// Copyright © 2015 Steve Francia . +// +// 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 cmd + +import ( + "fmt" + + homedir "github.com/mitchellh/go-homedir" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var ( + // Used for flags. + cfgFile, projectBase, userLicense string + + rootCmd = &cobra.Command{ + Use: "cobra", + Short: "A generator for Cobra based Applications", + Long: `Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + } +) + +// Execute executes the root command. +func Execute() { + if err := rootCmd.Execute(); err != nil { + er(err) + } +} + +func init() { + initViper() + + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") + rootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory, e.g. github.com/spf13/") + rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution") + rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `license` in config)") + rootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") + viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) + viper.BindPFlag("projectbase", rootCmd.PersistentFlags().Lookup("projectbase")) + viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")) + viper.SetDefault("author", "NAME HERE ") + viper.SetDefault("license", "apache") + + rootCmd.AddCommand(initCmd) + rootCmd.AddCommand(addCmd) + +} + +func initViper() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := homedir.Dir() + if err != nil { + er(err) + } + + // Search config in home directory with name ".cobra" (without extension). + viper.AddConfigPath(home) + viper.SetConfigName(".cobra") + } + + viper.AutomaticEnv() + + if err := viper.ReadInConfig(); err == nil { + fmt.Println("Using config file:", viper.ConfigFileUsed()) + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden index 75b52484ea..d645695673 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden +++ b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden @@ -1,202 +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. + + 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/spf13/cobra/cobra/cmd/testdata/main.go.golden b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/main.go.golden index 2f0b43efb0..69ecbd48e4 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/main.go.golden +++ b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/main.go.golden @@ -1,20 +1,20 @@ -// Copyright © 2017 NAME HERE -// 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 main - -import "github.com/spf13/testproject/cmd" - -func main() { - cmd.Execute() -} +// Copyright © 2017 NAME HERE +// 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 main + +import "github.com/spf13/testproject/cmd" + +func main() { + cmd.Execute() +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/root.go.golden b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/root.go.golden index c009a227fd..13e9a77604 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/root.go.golden +++ b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/root.go.golden @@ -1,88 +1,88 @@ -// Copyright © 2017 NAME HERE -// 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 cmd - -import ( - "fmt" - "os" - - homedir "github.com/mitchellh/go-homedir" - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -var cfgFile string - -// RootCmd represents the base command when called without any subcommands -var RootCmd = &cobra.Command{ - Use: "testproject", - Short: "A brief description of your application", - Long: `A longer description that spans multiple lines and likely contains -examples and usage of using your application. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - // Uncomment the following line if your bare application - // has an action associated with it: - // Run: func(cmd *cobra.Command, args []string) { }, -} - -// Execute adds all child commands to the root command sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. -func Execute() { - if err := RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } -} - -func init() { - cobra.OnInitialize(initConfig) - - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application. - RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.testproject.yaml)") - - // Cobra also supports local flags, which will only run - // when this action is called directly. - RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} - -// initConfig reads in config file and ENV variables if set. -func initConfig() { - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - // Find home directory. - home, err := homedir.Dir() - if err != nil { - fmt.Println(err) - os.Exit(1) - } - - // Search config in home directory with name ".testproject" (without extension). - viper.AddConfigPath(home) - viper.SetConfigName(".testproject") - } - - viper.AutomaticEnv() // read in environment variables that match - - // If a config file is found, read it in. - if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) - } -} +// Copyright © 2017 NAME HERE +// 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 cmd + +import ( + "fmt" + "os" + + homedir "github.com/mitchellh/go-homedir" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var cfgFile string + +// RootCmd represents the base command when called without any subcommands +var RootCmd = &cobra.Command{ + Use: "testproject", + Short: "A brief description of your application", + Long: `A longer description that spans multiple lines and likely contains +examples and usage of using your application. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// Execute adds all child commands to the root command sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + if err := RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func init() { + cobra.OnInitialize(initConfig) + + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.testproject.yaml)") + + // Cobra also supports local flags, which will only run + // when this action is called directly. + RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} + +// initConfig reads in config file and ENV variables if set. +func initConfig() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := homedir.Dir() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + // Search config in home directory with name ".testproject" (without extension). + viper.AddConfigPath(home) + viper.SetConfigName(".testproject") + } + + viper.AutomaticEnv() // read in environment variables that match + + // If a config file is found, read it in. + if err := viper.ReadInConfig(); err == nil { + fmt.Println("Using config file:", viper.ConfigFileUsed()) + } +} diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/test.go.golden b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/test.go.golden index 8f39d85c72..c8319d1dd0 100644 --- a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/test.go.golden +++ b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/test.go.golden @@ -1,49 +1,49 @@ -// Copyright © 2017 NAME HERE -// 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 cmd - -import ( - "fmt" - - "github.com/spf13/cobra" -) - -// testCmd represents the test command -var testCmd = &cobra.Command{ - Use: "test", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("test called") - }, -} - -func init() { - RootCmd.AddCommand(testCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // testCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // testCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") -} +// Copyright © 2017 NAME HERE +// 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 cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// testCmd represents the test command +var testCmd = &cobra.Command{ + Use: "test", + Short: "A brief description of your command", + Long: `A longer description that spans multiple lines and likely contains examples +and usage of using your command. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("test called") + }, +} + +func init() { + RootCmd.AddCommand(testCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // testCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // testCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/vendor/github.com/spf13/cobra/cobra/main.go b/vendor/github.com/spf13/cobra/cobra/main.go index 18971344bc..c3a9d9cb04 100644 --- a/vendor/github.com/spf13/cobra/cobra/main.go +++ b/vendor/github.com/spf13/cobra/cobra/main.go @@ -1,20 +1,20 @@ -// Copyright © 2015 Steve Francia . -// -// 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 main - -import "github.com/spf13/cobra/cobra/cmd" - -func main() { - cmd.Execute() -} +// Copyright © 2015 Steve Francia . +// +// 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 main + +import "github.com/spf13/cobra/cobra/cmd" + +func main() { + cmd.Execute() +} diff --git a/vendor/github.com/spf13/cobra/cobra_test.go b/vendor/github.com/spf13/cobra/cobra_test.go index 211468282b..576c97d365 100644 --- a/vendor/github.com/spf13/cobra/cobra_test.go +++ b/vendor/github.com/spf13/cobra/cobra_test.go @@ -1,1173 +1,1173 @@ -package cobra - -import ( - "bytes" - "fmt" - "os" - "reflect" - "runtime" - "strings" - "testing" - "text/template" - - "github.com/spf13/pflag" -) - -var tp, te, tt, tr []string -var rootPersPre, echoPre, echoPersPre, timesPersPre []string -var flagb1, flagb2, flagb3, flagbr, flagbp bool -var flags1, flags2a, flags2b, flags3, outs string -var flagi1, flagi2, flagi3, flagi4, flagir int -var rootcalled bool -var versionUsed int - -const strtwoParentHelp = "help message for parent flag strtwo" -const strtwoChildHelp = "help message for child flag strtwo" - -var cmdHidden = &Command{ - Use: "hide [secret string to print]", - Short: "Print anything to screen (if command is known)", - Long: `an absolutely utterly useless command for testing.`, - Run: func(cmd *Command, args []string) { - outs = "hidden" - }, - Hidden: true, -} - -var cmdPrint = &Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `an absolutely utterly useless command for testing.`, - Run: func(cmd *Command, args []string) { - tp = args - }, -} - -var cmdEcho = &Command{ - Use: "echo [string to echo]", - Aliases: []string{"say"}, - Short: "Echo anything to the screen", - Long: `an utterly useless command for testing.`, - Example: "Just run cobra-test echo", - PersistentPreRun: func(cmd *Command, args []string) { - echoPersPre = args - }, - PreRun: func(cmd *Command, args []string) { - echoPre = args - }, - Run: func(cmd *Command, args []string) { - te = args - }, -} - -var cmdEchoSub = &Command{ - Use: "echosub [string to print]", - Short: "second sub command for echo", - Long: `an absolutely utterly useless command for testing gendocs!.`, - Run: func(cmd *Command, args []string) { - }, -} - -var cmdDeprecated = &Command{ - Use: "deprecated [can't do anything here]", - Short: "A command which is deprecated", - Long: `an absolutely utterly useless command for testing deprecation!.`, - Deprecated: "Please use echo instead", - Run: func(cmd *Command, args []string) { - }, -} - -var cmdTimes = &Command{ - Use: "times [# times] [string to echo]", - SuggestFor: []string{"counts"}, - Short: "Echo anything to the screen more times", - Long: `a slightly useless command for testing.`, - PersistentPreRun: func(cmd *Command, args []string) { - timesPersPre = args - }, - Run: func(cmd *Command, args []string) { - tt = args - }, -} - -var cmdRootNoRun = &Command{ - Use: "cobra-test", - Short: "The root can run its own function", - Long: "The root description for help", - PersistentPreRun: func(cmd *Command, args []string) { - rootPersPre = args - }, -} - -var cmdRootSameName = &Command{ - Use: "print", - Short: "Root with the same name as a subcommand", - Long: "The root description for help", -} - -var cmdRootWithRun = &Command{ - Use: "cobra-test", - Short: "The root can run its own function", - Long: "The root description for help", - Run: func(cmd *Command, args []string) { - tr = args - rootcalled = true - }, -} - -var cmdSubNoRun = &Command{ - Use: "subnorun", - Short: "A subcommand without a Run function", - Long: "A long output about a subcommand without a Run function", -} - -var cmdCustomFlags = &Command{ - Use: "customflags [flags] -- REMOTE_COMMAND", - Short: "A command that expects flags in a custom location", - Long: "A long output about a command that expects flags in a custom location", - Run: func(cmd *Command, args []string) { - }, -} - -var cmdVersion1 = &Command{ - Use: "version", - Short: "Print the version number", - Long: `First version of the version command`, - Run: func(cmd *Command, args []string) { - versionUsed = 1 - }, -} - -var cmdVersion2 = &Command{ - Use: "version", - Short: "Print the version number", - Long: `Second version of the version command`, - Run: func(cmd *Command, args []string) { - versionUsed = 2 - }, -} - -var cmdColon = &Command{ - Use: "cmd:colon", - Run: func(cmd *Command, args []string) { - }, -} - -func flagInit() { - cmdEcho.ResetFlags() - cmdPrint.ResetFlags() - cmdTimes.ResetFlags() - cmdRootNoRun.ResetFlags() - cmdRootSameName.ResetFlags() - cmdRootWithRun.ResetFlags() - cmdSubNoRun.ResetFlags() - cmdCustomFlags.ResetFlags() - cmdVersion1.ResetFlags() - cmdVersion2.ResetFlags() - - cmdRootNoRun.PersistentFlags().StringVarP(&flags2a, "strtwo", "t", "two", strtwoParentHelp) - cmdCustomFlags.Flags().IntVar(&flagi4, "intfour", 456, "help message for flag intfour") - cmdEcho.Flags().BoolVarP(&flagb1, "boolone", "b", true, "help message for flag boolone") - cmdEcho.Flags().IntVarP(&flagi1, "intone", "i", 123, "help message for flag intone") - cmdEcho.PersistentFlags().BoolVarP(&flagbp, "persistentbool", "p", false, "help message for flag persistentbool") - cmdEcho.PersistentFlags().StringVarP(&flags1, "strone", "s", "one", "help message for flag strone") - cmdPrint.Flags().IntVarP(&flagi3, "intthree", "i", 345, "help message for flag intthree") - cmdTimes.Flags().BoolVarP(&flagb2, "booltwo", "c", false, "help message for flag booltwo") - cmdTimes.Flags().IntVarP(&flagi2, "inttwo", "j", 234, "help message for flag inttwo") - cmdTimes.Flags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) - cmdTimes.PersistentFlags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) - cmdPrint.Flags().BoolVarP(&flagb3, "boolthree", "b", true, "help message for flag boolthree") - cmdPrint.PersistentFlags().StringVarP(&flags3, "strthree", "s", "three", "help message for flag strthree") -} - -func commandInit() { - cmdEcho.ResetCommands() - cmdPrint.ResetCommands() - cmdTimes.ResetCommands() - cmdRootNoRun.ResetCommands() - cmdRootSameName.ResetCommands() - cmdRootWithRun.ResetCommands() - cmdSubNoRun.ResetCommands() - cmdCustomFlags.ResetCommands() -} - -func initialize() *Command { - tt, tp, te = nil, nil, nil - rootPersPre, echoPre, echoPersPre, timesPersPre = nil, nil, nil, nil - - var c = cmdRootNoRun - flagInit() - commandInit() - return c -} - -func initializeWithSameName() *Command { - tt, tp, te = nil, nil, nil - rootPersPre, echoPre, echoPersPre, timesPersPre = nil, nil, nil, nil - var c = cmdRootSameName - flagInit() - commandInit() - return c -} - -func initializeWithRootCmd() *Command { - cmdRootWithRun.ResetCommands() - tt, tp, te, tr, rootcalled = nil, nil, nil, nil, false - flagInit() - cmdRootWithRun.Flags().BoolVarP(&flagbr, "boolroot", "b", false, "help message for flag boolroot") - cmdRootWithRun.Flags().IntVarP(&flagir, "introot", "i", 321, "help message for flag introot") - commandInit() - return cmdRootWithRun -} - -type resulter struct { - Error error - Output string - Command *Command -} - -func fullSetupTest(args ...string) resulter { - c := initializeWithRootCmd() - - return fullTester(c, args...) -} - -func noRRSetupTestSilenced(args ...string) resulter { - c := initialize() - c.SilenceErrors = true - c.SilenceUsage = true - return fullTester(c, args...) -} - -func noRRSetupTest(args ...string) resulter { - c := initialize() - - return fullTester(c, args...) -} - -func rootOnlySetupTest(args ...string) resulter { - c := initializeWithRootCmd() - - return simpleTester(c, args...) -} - -func simpleTester(c *Command, args ...string) resulter { - buf := new(bytes.Buffer) - // Testing flag with invalid input - c.SetOutput(buf) - c.SetArgs(args) - - err := c.Execute() - output := buf.String() - - return resulter{err, output, c} -} - -func simpleTesterC(c *Command, args ...string) resulter { - buf := new(bytes.Buffer) - // Testing flag with invalid input - c.SetOutput(buf) - c.SetArgs(args) - - cmd, err := c.ExecuteC() - output := buf.String() - - return resulter{err, output, cmd} -} - -func fullTester(c *Command, args ...string) resulter { - buf := new(bytes.Buffer) - // Testing flag with invalid input - c.SetOutput(buf) - cmdEcho.AddCommand(cmdTimes) - c.AddCommand(cmdPrint, cmdEcho, cmdSubNoRun, cmdCustomFlags, cmdDeprecated) - c.SetArgs(args) - - err := c.Execute() - output := buf.String() - - return resulter{err, output, c} -} - -func logErr(t *testing.T, found, expected string) { - out := new(bytes.Buffer) - - _, _, line, ok := runtime.Caller(2) - if ok { - fmt.Fprintf(out, "Line: %d ", line) - } - fmt.Fprintf(out, "Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - t.Errorf(out.String()) -} - -func checkStringContains(t *testing.T, found, expected string) { - if !strings.Contains(found, expected) { - logErr(t, found, expected) - } -} - -func checkResultContains(t *testing.T, x resulter, check string) { - checkStringContains(t, x.Output, check) -} - -func checkStringOmits(t *testing.T, found, expected string) { - if strings.Contains(found, expected) { - logErr(t, found, expected) - } -} - -func checkResultOmits(t *testing.T, x resulter, check string) { - checkStringOmits(t, x.Output, check) -} - -func checkOutputContains(t *testing.T, c *Command, check string) { - buf := new(bytes.Buffer) - c.SetOutput(buf) - c.Execute() - - if !strings.Contains(buf.String(), check) { - logErr(t, buf.String(), check) - } -} - -func TestSingleCommand(t *testing.T) { - noRRSetupTest("print", "one", "two") - - if te != nil || tt != nil { - t.Error("Wrong command called") - } - if tp == nil { - t.Error("Wrong command called") - } - if strings.Join(tp, " ") != "one two" { - t.Error("Command didn't parse correctly") - } -} - -func TestChildCommand(t *testing.T) { - noRRSetupTest("echo", "times", "one", "two") - - if te != nil || tp != nil { - t.Error("Wrong command called") - } - if tt == nil { - t.Error("Wrong command called") - } - if strings.Join(tt, " ") != "one two" { - t.Error("Command didn't parse correctly") - } -} - -func TestCommandAlias(t *testing.T) { - noRRSetupTest("say", "times", "one", "two") - - if te != nil || tp != nil { - t.Error("Wrong command called") - } - if tt == nil { - t.Error("Wrong command called") - } - if strings.Join(tt, " ") != "one two" { - t.Error("Command didn't parse correctly") - } -} - -func TestPrefixMatching(t *testing.T) { - EnablePrefixMatching = true - noRRSetupTest("ech", "times", "one", "two") - - if te != nil || tp != nil { - t.Error("Wrong command called") - } - if tt == nil { - t.Error("Wrong command called") - } - if strings.Join(tt, " ") != "one two" { - t.Error("Command didn't parse correctly") - } - - EnablePrefixMatching = false -} - -func TestNoPrefixMatching(t *testing.T) { - EnablePrefixMatching = false - - noRRSetupTest("ech", "times", "one", "two") - - if !(tt == nil && te == nil && tp == nil) { - t.Error("Wrong command called") - } -} - -func TestAliasPrefixMatching(t *testing.T) { - EnablePrefixMatching = true - noRRSetupTest("sa", "times", "one", "two") - - if te != nil || tp != nil { - t.Error("Wrong command called") - } - if tt == nil { - t.Error("Wrong command called") - } - if strings.Join(tt, " ") != "one two" { - t.Error("Command didn't parse correctly") - } - EnablePrefixMatching = false -} - -func TestChildSameName(t *testing.T) { - c := initializeWithSameName() - c.AddCommand(cmdPrint, cmdEcho) - c.SetArgs([]string{"print", "one", "two"}) - c.Execute() - - if te != nil || tt != nil { - t.Error("Wrong command called") - } - if tp == nil { - t.Error("Wrong command called") - } - if strings.Join(tp, " ") != "one two" { - t.Error("Command didn't parse correctly") - } -} - -func TestGrandChildSameName(t *testing.T) { - c := initializeWithSameName() - cmdTimes.AddCommand(cmdPrint) - c.AddCommand(cmdTimes) - c.SetArgs([]string{"times", "print", "one", "two"}) - c.Execute() - - if te != nil || tt != nil { - t.Error("Wrong command called") - } - if tp == nil { - t.Error("Wrong command called") - } - if strings.Join(tp, " ") != "one two" { - t.Error("Command didn't parse correctly") - } -} - -func TestUsage(t *testing.T) { - x := fullSetupTest("help") - checkResultContains(t, x, cmdRootWithRun.Use+" [flags]") - x = fullSetupTest("help", "customflags") - checkResultContains(t, x, cmdCustomFlags.Use) - checkResultOmits(t, x, cmdCustomFlags.Use+" [flags]") -} - -func TestFlagLong(t *testing.T) { - noRRSetupTest("echo", "--intone=13", "something", "--", "here") - - if cmdEcho.ArgsLenAtDash() != 1 { - t.Errorf("expected argsLenAtDash: %d but got %d", 1, cmdRootNoRun.ArgsLenAtDash()) - } - if strings.Join(te, " ") != "something here" { - t.Errorf("flags didn't leave proper args remaining..%s given", te) - } - if flagi1 != 13 { - t.Errorf("int flag didn't get correct value, had %d", flagi1) - } - if flagi2 != 234 { - t.Errorf("default flag value changed, 234 expected, %d given", flagi2) - } -} - -func TestFlagShort(t *testing.T) { - noRRSetupTest("echo", "-i13", "--", "something", "here") - - if cmdEcho.ArgsLenAtDash() != 0 { - t.Errorf("expected argsLenAtDash: %d but got %d", 0, cmdRootNoRun.ArgsLenAtDash()) - } - if strings.Join(te, " ") != "something here" { - t.Errorf("flags didn't leave proper args remaining..%s given", te) - } - if flagi1 != 13 { - t.Errorf("int flag didn't get correct value, had %d", flagi1) - } - if flagi2 != 234 { - t.Errorf("default flag value changed, 234 expected, %d given", flagi2) - } - - noRRSetupTest("echo", "-i", "13", "something", "here") - - if strings.Join(te, " ") != "something here" { - t.Errorf("flags didn't leave proper args remaining..%s given", te) - } - if flagi1 != 13 { - t.Errorf("int flag didn't get correct value, had %d", flagi1) - } - if flagi2 != 234 { - t.Errorf("default flag value changed, 234 expected, %d given", flagi2) - } - - noRRSetupTest("print", "-i99", "one", "two") - - if strings.Join(tp, " ") != "one two" { - t.Errorf("flags didn't leave proper args remaining..%s given", tp) - } - if flagi3 != 99 { - t.Errorf("int flag didn't get correct value, had %d", flagi3) - } - if flagi1 != 123 { - t.Errorf("default flag value changed on different command with same shortname, 234 expected, %d given", flagi2) - } -} - -func TestChildCommandFlags(t *testing.T) { - noRRSetupTest("echo", "times", "-j", "99", "one", "two") - - if strings.Join(tt, " ") != "one two" { - t.Errorf("flags didn't leave proper args remaining..%s given", tt) - } - - // Testing with flag that shouldn't be persistent - r := noRRSetupTest("echo", "times", "-j", "99", "-i77", "one", "two") - - if r.Error == nil { - t.Errorf("invalid flag should generate error") - } - - if !strings.Contains(r.Error.Error(), "unknown shorthand") { - t.Errorf("Wrong error message displayed, \n %s", r.Error) - } - - if flagi2 != 99 { - t.Errorf("flag value should be 99, %d given", flagi2) - } - - if flagi1 != 123 { - t.Errorf("unset flag should have default value, expecting 123, given %d", flagi1) - } - - // Testing with flag only existing on child - r = noRRSetupTest("echo", "-j", "99", "-i77", "one", "two") - - if r.Error == nil { - t.Errorf("invalid flag should generate error") - } - if !strings.Contains(r.Error.Error(), "unknown shorthand flag") { - t.Errorf("Wrong error message displayed, \n %s", r.Error) - } - - // Testing with persistent flag overwritten by child - noRRSetupTest("echo", "times", "--strtwo=child", "one", "two") - - if flags2b != "child" { - t.Errorf("flag value should be child, %s given", flags2b) - } - - if flags2a != "two" { - t.Errorf("unset flag should have default value, expecting two, given %s", flags2a) - } - - // Testing flag with invalid input - r = noRRSetupTest("echo", "-i10E") - - if r.Error == nil { - t.Errorf("invalid input should generate error") - } - if !strings.Contains(r.Error.Error(), "invalid syntax") { - t.Errorf("Wrong error message displayed, \n %s", r.Error) - } -} - -func TestTrailingCommandFlags(t *testing.T) { - x := fullSetupTest("echo", "two", "-x") - - if x.Error == nil { - t.Errorf("invalid flag should generate error") - } -} - -func TestInvalidSubcommandFlags(t *testing.T) { - cmd := initializeWithRootCmd() - cmd.AddCommand(cmdTimes) - - result := simpleTester(cmd, "times", "--inttwo=2", "--badflag=bar") - // given that we are not checking here result.Error we check for - // stock usage message - checkResultContains(t, result, "cobra-test times [# times]") - if strings.Contains(result.Error.Error(), "unknown flag: --inttwo") { - t.Errorf("invalid --badflag flag shouldn't fail on 'unknown' --inttwo flag") - } - -} - -func TestSubcommandExecuteC(t *testing.T) { - cmd := initializeWithRootCmd() - double := &Command{ - Use: "double message", - Run: func(c *Command, args []string) { - msg := strings.Join(args, " ") - c.Println(msg, msg) - }, - } - - echo := &Command{ - Use: "echo message", - Run: func(c *Command, args []string) { - msg := strings.Join(args, " ") - c.Println(msg) - }, - } - - cmd.AddCommand(double, echo) - - result := simpleTesterC(cmd, "double", "hello", "world") - checkResultContains(t, result, "hello world hello world") - - if result.Command.Name() != "double" { - t.Errorf("invalid cmd returned from ExecuteC: should be 'double' but got %s", result.Command.Name()) - } - - result = simpleTesterC(cmd, "echo", "msg", "to", "be", "echoed") - checkResultContains(t, result, "msg to be echoed") - - if result.Command.Name() != "echo" { - t.Errorf("invalid cmd returned from ExecuteC: should be 'echo' but got %s", result.Command.Name()) - } -} - -func TestSubcommandArgEvaluation(t *testing.T) { - cmd := initializeWithRootCmd() - - first := &Command{ - Use: "first", - Run: func(cmd *Command, args []string) { - }, - } - cmd.AddCommand(first) - - second := &Command{ - Use: "second", - Run: func(cmd *Command, args []string) { - fmt.Fprintf(cmd.OutOrStdout(), "%v", args) - }, - } - first.AddCommand(second) - - result := simpleTester(cmd, "first", "second", "first", "third") - - expectedOutput := fmt.Sprint([]string{"first third"}) - if result.Output != expectedOutput { - t.Errorf("exptected %v, got %v", expectedOutput, result.Output) - } -} - -func TestPersistentFlags(t *testing.T) { - fullSetupTest("echo", "-s", "something", "-p", "more", "here") - - // persistentFlag should act like normal flag on its own command - if strings.Join(te, " ") != "more here" { - t.Errorf("flags didn't leave proper args remaining..%s given", te) - } - if flags1 != "something" { - t.Errorf("string flag didn't get correct value, had %v", flags1) - } - if !flagbp { - t.Errorf("persistent bool flag not parsed correctly. Expected true, had %v", flagbp) - } - - // persistentFlag should act like normal flag on its own command - fullSetupTest("echo", "times", "-s", "again", "-c", "-p", "test", "here") - - if strings.Join(tt, " ") != "test here" { - t.Errorf("flags didn't leave proper args remaining. %s given", tt) - } - - if flags1 != "again" { - t.Errorf("string flag didn't get correct value, had %v", flags1) - } - - if !flagb2 { - t.Errorf("local flag not parsed correctly. Expected true, had %v", flagb2) - } - if !flagbp { - t.Errorf("persistent bool flag not parsed correctly. Expected true, had %v", flagbp) - } -} - -func TestHelpCommand(t *testing.T) { - x := fullSetupTest("help") - checkResultContains(t, x, cmdRootWithRun.Long) - - x = fullSetupTest("help", "echo") - checkResultContains(t, x, cmdEcho.Long) - - x = fullSetupTest("help", "echo", "times") - checkResultContains(t, x, cmdTimes.Long) -} - -func TestChildCommandHelp(t *testing.T) { - c := noRRSetupTest("print", "--help") - checkResultContains(t, c, strtwoParentHelp) - r := noRRSetupTest("echo", "times", "--help") - checkResultContains(t, r, strtwoChildHelp) -} - -func TestNonRunChildHelp(t *testing.T) { - x := noRRSetupTest("subnorun") - checkResultContains(t, x, cmdSubNoRun.Long) -} - -func TestRunnableRootCommand(t *testing.T) { - x := fullSetupTest("") - - if !rootcalled { - t.Errorf("Root Function was not called\n out:%v", x.Error) - } -} - -func TestVisitParents(t *testing.T) { - c := &Command{Use: "app"} - sub := &Command{Use: "sub"} - dsub := &Command{Use: "dsub"} - sub.AddCommand(dsub) - c.AddCommand(sub) - total := 0 - add := func(x *Command) { - total++ - } - sub.VisitParents(add) - if total != 1 { - t.Errorf("Should have visited 1 parent but visited %d", total) - } - - total = 0 - dsub.VisitParents(add) - if total != 2 { - t.Errorf("Should have visited 2 parent but visited %d", total) - } - - total = 0 - c.VisitParents(add) - if total != 0 { - t.Errorf("Should have not visited any parent but visited %d", total) - } -} - -func TestRunnableRootCommandNilInput(t *testing.T) { - c := initializeWithRootCmd() - - buf := new(bytes.Buffer) - // Testing flag with invalid input - c.SetOutput(buf) - cmdEcho.AddCommand(cmdTimes) - c.AddCommand(cmdPrint, cmdEcho) - c.SetArgs([]string{}) - - err := c.Execute() - if err != nil { - t.Errorf("Execute() failed with %v", err) - } - - if !rootcalled { - t.Errorf("Root Function was not called") - } -} - -func TestRunnableRootCommandEmptyInput(t *testing.T) { - args := []string{"", "--introot=12", ""} - c := initializeWithRootCmd() - - buf := new(bytes.Buffer) - // Testing flag with invalid input - c.SetOutput(buf) - cmdEcho.AddCommand(cmdTimes) - c.AddCommand(cmdPrint, cmdEcho) - c.SetArgs(args) - - c.Execute() - - if !rootcalled { - t.Errorf("Root Function was not called.\nOutput was:\n%s\n", buf) - } -} - -func TestInvalidSubcommandWhenArgsAllowed(t *testing.T) { - fullSetupTest("echo", "invalid-sub") - - if te[0] != "invalid-sub" { - t.Errorf("Subcommand didn't work...") - } -} - -func TestRootFlags(t *testing.T) { - fullSetupTest("-i", "17", "-b") - - if !flagbr { - t.Errorf("flag value should be true, %v given", flagbr) - } - - if flagir != 17 { - t.Errorf("flag value should be 17, %d given", flagir) - } -} - -func TestRootHelp(t *testing.T) { - x := fullSetupTest("--help") - - checkResultContains(t, x, "Available Commands:") - checkResultContains(t, x, "for more information about a command") - - if strings.Contains(x.Output, "unknown flag: --help") { - t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) - } - - if strings.Contains(x.Output, cmdEcho.Use) { - t.Errorf("--help shouldn't display subcommand's usage, Got: \n %s", x.Output) - } - - x = fullSetupTest("echo", "--help") - - if strings.Contains(x.Output, cmdTimes.Use) { - t.Errorf("--help shouldn't display subsubcommand's usage, Got: \n %s", x.Output) - } - - checkResultContains(t, x, "Available Commands:") - checkResultContains(t, x, "for more information about a command") - - if strings.Contains(x.Output, "unknown flag: --help") { - t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) - } - -} - -func TestFlagAccess(t *testing.T) { - initialize() - - local := cmdTimes.LocalFlags() - inherited := cmdTimes.InheritedFlags() - - for _, f := range []string{"inttwo", "strtwo", "booltwo"} { - if local.Lookup(f) == nil { - t.Errorf("LocalFlags expected to contain %s, Got: nil", f) - } - } - if inherited.Lookup("strone") == nil { - t.Errorf("InheritedFlags expected to contain strone, Got: nil") - } - if inherited.Lookup("strtwo") != nil { - t.Errorf("InheritedFlags shouldn not contain overwritten flag strtwo") - } -} - -func TestNoNRunnableRootCommandNilInput(t *testing.T) { - c := initialize() - - buf := new(bytes.Buffer) - // Testing flag with invalid input - c.SetOutput(buf) - cmdEcho.AddCommand(cmdTimes) - c.AddCommand(cmdPrint, cmdEcho) - c.SetArgs([]string{}) - - c.Execute() - - if !strings.Contains(buf.String(), cmdRootNoRun.Long) { - t.Errorf("Expected to get help output, Got: \n %s", buf) - } -} - -func TestRootNoCommandHelp(t *testing.T) { - x := rootOnlySetupTest("--help") - - checkResultOmits(t, x, "Available Commands:") - checkResultOmits(t, x, "for more information about a command") - - if strings.Contains(x.Output, "unknown flag: --help") { - t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) - } - - x = rootOnlySetupTest("echo", "--help") - - checkResultOmits(t, x, "Available Commands:") - checkResultOmits(t, x, "for more information about a command") - - if strings.Contains(x.Output, "unknown flag: --help") { - t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) - } -} - -func TestRootUnknownCommand(t *testing.T) { - r := noRRSetupTest("bogus") - s := "Error: unknown command \"bogus\" for \"cobra-test\"\nRun 'cobra-test --help' for usage.\n" - - if r.Output != s { - t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output) - } - - r = noRRSetupTest("--strtwo=a", "bogus") - if r.Output != s { - t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output) - } -} - -func TestRootUnknownCommandSilenced(t *testing.T) { - r := noRRSetupTestSilenced("bogus") - - if r.Output != "" { - t.Errorf("Unexpected response.\nExpecting to be: \n\"\"\n Got:\n %q\n", r.Output) - } - - r = noRRSetupTestSilenced("--strtwo=a", "bogus") - if r.Output != "" { - t.Errorf("Unexpected response.\nExpecting to be:\n\"\"\nGot:\n %q\n", r.Output) - } -} - -func TestRootSuggestions(t *testing.T) { - outputWithSuggestions := "Error: unknown command \"%s\" for \"cobra-test\"\n\nDid you mean this?\n\t%s\n\nRun 'cobra-test --help' for usage.\n" - outputWithoutSuggestions := "Error: unknown command \"%s\" for \"cobra-test\"\nRun 'cobra-test --help' for usage.\n" - - cmd := initializeWithRootCmd() - cmd.AddCommand(cmdTimes) - - tests := map[string]string{ - "time": "times", - "tiems": "times", - "tims": "times", - "timeS": "times", - "rimes": "times", - "ti": "times", - "t": "times", - "timely": "times", - "ri": "", - "timezone": "", - "foo": "", - "counts": "times", - } - - for typo, suggestion := range tests { - for _, suggestionsDisabled := range []bool{false, true} { - cmd.DisableSuggestions = suggestionsDisabled - result := simpleTester(cmd, typo) - expected := "" - if len(suggestion) == 0 || suggestionsDisabled { - expected = fmt.Sprintf(outputWithoutSuggestions, typo) - } else { - expected = fmt.Sprintf(outputWithSuggestions, typo, suggestion) - } - if result.Output != expected { - t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", expected, result.Output) - } - } - } -} - -func TestFlagsBeforeCommand(t *testing.T) { - // short without space - x := fullSetupTest("-i10", "echo") - if x.Error != nil { - t.Errorf("Valid Input shouldn't have errors, got:\n %q", x.Error) - } - - x = noRRSetupTest("echo", "-i=10") - if x.Error != nil { - t.Errorf("Valid Input shouldn't have errors, got:\n %s", x.Error) - } - - // long with equals - x = noRRSetupTest("--intone=123", "echo", "one", "two") - if x.Error != nil { - t.Errorf("Valid Input shouldn't have errors, got:\n %s", x.Error) - } - - // With parsing error properly reported - x = fullSetupTest("-i10E", "echo") - if !strings.Contains(x.Error.Error(), "invalid syntax") { - t.Errorf("Wrong error message displayed, \n %s", x.Error) - } -} - -func TestRemoveCommand(t *testing.T) { - versionUsed = 0 - c := initializeWithRootCmd() - c.AddCommand(cmdVersion1) - c.RemoveCommand(cmdVersion1) - x := fullTester(c, "version") - if x.Error == nil { - t.Errorf("Removed command should not have been called\n") - return - } -} - -func TestCommandWithoutSubcommands(t *testing.T) { - c := initializeWithRootCmd() - - x := simpleTester(c, "") - if x.Error != nil { - t.Errorf("Calling command without subcommands should not have error: %v", x.Error) - return - } -} - -func TestCommandWithoutSubcommandsWithArg(t *testing.T) { - c := initializeWithRootCmd() - expectedArgs := []string{"arg"} - - x := simpleTester(c, "arg") - if x.Error != nil { - t.Errorf("Calling command without subcommands but with arg should not have error: %v", x.Error) - return - } - if !reflect.DeepEqual(expectedArgs, tr) { - t.Errorf("Calling command without subcommands but with arg has wrong args: expected: %v, actual: %v", expectedArgs, tr) - return - } -} - -func TestReplaceCommandWithRemove(t *testing.T) { - versionUsed = 0 - c := initializeWithRootCmd() - c.AddCommand(cmdVersion1) - c.RemoveCommand(cmdVersion1) - c.AddCommand(cmdVersion2) - x := fullTester(c, "version") - if x.Error != nil { - t.Errorf("Valid Input shouldn't have errors, got:\n %q", x.Error) - return - } - if versionUsed == 1 { - t.Errorf("Removed command shouldn't be called\n") - } - if versionUsed != 2 { - t.Errorf("Replacing command should have been called but didn't\n") - } -} - -func TestDeprecatedSub(t *testing.T) { - c := fullSetupTest("deprecated") - - checkResultContains(t, c, cmdDeprecated.Deprecated) -} - -func TestPreRun(t *testing.T) { - noRRSetupTest("echo", "one", "two") - if echoPre == nil || echoPersPre == nil { - t.Error("PreRun or PersistentPreRun not called") - } - if rootPersPre != nil || timesPersPre != nil { - t.Error("Wrong *Pre functions called!") - } - - noRRSetupTest("echo", "times", "one", "two") - if timesPersPre == nil { - t.Error("PreRun or PersistentPreRun not called") - } - if echoPre != nil || echoPersPre != nil || rootPersPre != nil { - t.Error("Wrong *Pre functions called!") - } - - noRRSetupTest("print", "one", "two") - if rootPersPre == nil { - t.Error("Parent PersistentPreRun not called but should not have been") - } - if echoPre != nil || echoPersPre != nil || timesPersPre != nil { - t.Error("Wrong *Pre functions called!") - } -} - -// Check if cmdEchoSub gets PersistentPreRun from rootCmd even if is added last -func TestPeristentPreRunPropagation(t *testing.T) { - rootCmd := initialize() - - // First add the cmdEchoSub to cmdPrint - cmdPrint.AddCommand(cmdEchoSub) - // Now add cmdPrint to rootCmd - rootCmd.AddCommand(cmdPrint) - - rootCmd.SetArgs([]string{"print", "echosub", "lala"}) - rootCmd.Execute() - - if len(rootPersPre) == 0 || rootPersPre[0] != "lala" { - t.Error("RootCmd PersistentPreRun not called but should have been") - } -} - -func TestGlobalNormFuncPropagation(t *testing.T) { - normFunc := func(f *pflag.FlagSet, name string) pflag.NormalizedName { - return pflag.NormalizedName(name) - } - - rootCmd := initialize() - rootCmd.SetGlobalNormalizationFunc(normFunc) - if reflect.ValueOf(normFunc) != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()) { - t.Error("rootCmd seems to have a wrong normalization function") - } - - // First add the cmdEchoSub to cmdPrint - cmdPrint.AddCommand(cmdEchoSub) - if cmdPrint.GlobalNormalizationFunc() != nil && cmdEchoSub.GlobalNormalizationFunc() != nil { - t.Error("cmdPrint and cmdEchoSub should had no normalization functions") - } - - // Now add cmdPrint to rootCmd - rootCmd.AddCommand(cmdPrint) - if reflect.ValueOf(cmdPrint.GlobalNormalizationFunc()).Pointer() != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()).Pointer() || - reflect.ValueOf(cmdEchoSub.GlobalNormalizationFunc()).Pointer() != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()).Pointer() { - t.Error("cmdPrint and cmdEchoSub should had the normalization function of rootCmd") - } -} - -func TestFlagOnPflagCommandLine(t *testing.T) { - flagName := "flagOnCommandLine" - pflag.String(flagName, "", "about my flag") - r := fullSetupTest("--help") - - checkResultContains(t, r, flagName) - - // Reset pflag.CommandLine flagset. - pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ExitOnError) -} - -func TestAddTemplateFunctions(t *testing.T) { - AddTemplateFunc("t", func() bool { return true }) - AddTemplateFuncs(template.FuncMap{ - "f": func() bool { return false }, - "h": func() string { return "Hello," }, - "w": func() string { return "world." }}) - - const usage = "Hello, world." - - c := &Command{} - c.SetUsageTemplate(`{{if t}}{{h}}{{end}}{{if f}}{{h}}{{end}} {{w}}`) - - if us := c.UsageString(); us != usage { - t.Errorf("c.UsageString() != \"%s\", is \"%s\"", usage, us) - } -} - -func TestUsageIsNotPrintedTwice(t *testing.T) { - var cmd = &Command{Use: "root"} - var sub = &Command{Use: "sub"} - cmd.AddCommand(sub) - - r := simpleTester(cmd, "") - if strings.Count(r.Output, "Usage:") != 1 { - t.Error("Usage output is not printed exactly once") - } -} - -func BenchmarkInheritedFlags(b *testing.B) { - initialize() - cmdEcho.AddCommand(cmdTimes) - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cmdTimes.InheritedFlags() - } -} - -func BenchmarkLocalFlags(b *testing.B) { - initialize() - cmdEcho.AddCommand(cmdTimes) - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cmdTimes.LocalFlags() - } -} +package cobra + +import ( + "bytes" + "fmt" + "os" + "reflect" + "runtime" + "strings" + "testing" + "text/template" + + "github.com/spf13/pflag" +) + +var tp, te, tt, tr []string +var rootPersPre, echoPre, echoPersPre, timesPersPre []string +var flagb1, flagb2, flagb3, flagbr, flagbp bool +var flags1, flags2a, flags2b, flags3, outs string +var flagi1, flagi2, flagi3, flagi4, flagir int +var rootcalled bool +var versionUsed int + +const strtwoParentHelp = "help message for parent flag strtwo" +const strtwoChildHelp = "help message for child flag strtwo" + +var cmdHidden = &Command{ + Use: "hide [secret string to print]", + Short: "Print anything to screen (if command is known)", + Long: `an absolutely utterly useless command for testing.`, + Run: func(cmd *Command, args []string) { + outs = "hidden" + }, + Hidden: true, +} + +var cmdPrint = &Command{ + Use: "print [string to print]", + Short: "Print anything to the screen", + Long: `an absolutely utterly useless command for testing.`, + Run: func(cmd *Command, args []string) { + tp = args + }, +} + +var cmdEcho = &Command{ + Use: "echo [string to echo]", + Aliases: []string{"say"}, + Short: "Echo anything to the screen", + Long: `an utterly useless command for testing.`, + Example: "Just run cobra-test echo", + PersistentPreRun: func(cmd *Command, args []string) { + echoPersPre = args + }, + PreRun: func(cmd *Command, args []string) { + echoPre = args + }, + Run: func(cmd *Command, args []string) { + te = args + }, +} + +var cmdEchoSub = &Command{ + Use: "echosub [string to print]", + Short: "second sub command for echo", + Long: `an absolutely utterly useless command for testing gendocs!.`, + Run: func(cmd *Command, args []string) { + }, +} + +var cmdDeprecated = &Command{ + Use: "deprecated [can't do anything here]", + Short: "A command which is deprecated", + Long: `an absolutely utterly useless command for testing deprecation!.`, + Deprecated: "Please use echo instead", + Run: func(cmd *Command, args []string) { + }, +} + +var cmdTimes = &Command{ + Use: "times [# times] [string to echo]", + SuggestFor: []string{"counts"}, + Short: "Echo anything to the screen more times", + Long: `a slightly useless command for testing.`, + PersistentPreRun: func(cmd *Command, args []string) { + timesPersPre = args + }, + Run: func(cmd *Command, args []string) { + tt = args + }, +} + +var cmdRootNoRun = &Command{ + Use: "cobra-test", + Short: "The root can run its own function", + Long: "The root description for help", + PersistentPreRun: func(cmd *Command, args []string) { + rootPersPre = args + }, +} + +var cmdRootSameName = &Command{ + Use: "print", + Short: "Root with the same name as a subcommand", + Long: "The root description for help", +} + +var cmdRootWithRun = &Command{ + Use: "cobra-test", + Short: "The root can run its own function", + Long: "The root description for help", + Run: func(cmd *Command, args []string) { + tr = args + rootcalled = true + }, +} + +var cmdSubNoRun = &Command{ + Use: "subnorun", + Short: "A subcommand without a Run function", + Long: "A long output about a subcommand without a Run function", +} + +var cmdCustomFlags = &Command{ + Use: "customflags [flags] -- REMOTE_COMMAND", + Short: "A command that expects flags in a custom location", + Long: "A long output about a command that expects flags in a custom location", + Run: func(cmd *Command, args []string) { + }, +} + +var cmdVersion1 = &Command{ + Use: "version", + Short: "Print the version number", + Long: `First version of the version command`, + Run: func(cmd *Command, args []string) { + versionUsed = 1 + }, +} + +var cmdVersion2 = &Command{ + Use: "version", + Short: "Print the version number", + Long: `Second version of the version command`, + Run: func(cmd *Command, args []string) { + versionUsed = 2 + }, +} + +var cmdColon = &Command{ + Use: "cmd:colon", + Run: func(cmd *Command, args []string) { + }, +} + +func flagInit() { + cmdEcho.ResetFlags() + cmdPrint.ResetFlags() + cmdTimes.ResetFlags() + cmdRootNoRun.ResetFlags() + cmdRootSameName.ResetFlags() + cmdRootWithRun.ResetFlags() + cmdSubNoRun.ResetFlags() + cmdCustomFlags.ResetFlags() + cmdVersion1.ResetFlags() + cmdVersion2.ResetFlags() + + cmdRootNoRun.PersistentFlags().StringVarP(&flags2a, "strtwo", "t", "two", strtwoParentHelp) + cmdCustomFlags.Flags().IntVar(&flagi4, "intfour", 456, "help message for flag intfour") + cmdEcho.Flags().BoolVarP(&flagb1, "boolone", "b", true, "help message for flag boolone") + cmdEcho.Flags().IntVarP(&flagi1, "intone", "i", 123, "help message for flag intone") + cmdEcho.PersistentFlags().BoolVarP(&flagbp, "persistentbool", "p", false, "help message for flag persistentbool") + cmdEcho.PersistentFlags().StringVarP(&flags1, "strone", "s", "one", "help message for flag strone") + cmdPrint.Flags().IntVarP(&flagi3, "intthree", "i", 345, "help message for flag intthree") + cmdTimes.Flags().BoolVarP(&flagb2, "booltwo", "c", false, "help message for flag booltwo") + cmdTimes.Flags().IntVarP(&flagi2, "inttwo", "j", 234, "help message for flag inttwo") + cmdTimes.Flags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) + cmdTimes.PersistentFlags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) + cmdPrint.Flags().BoolVarP(&flagb3, "boolthree", "b", true, "help message for flag boolthree") + cmdPrint.PersistentFlags().StringVarP(&flags3, "strthree", "s", "three", "help message for flag strthree") +} + +func commandInit() { + cmdEcho.ResetCommands() + cmdPrint.ResetCommands() + cmdTimes.ResetCommands() + cmdRootNoRun.ResetCommands() + cmdRootSameName.ResetCommands() + cmdRootWithRun.ResetCommands() + cmdSubNoRun.ResetCommands() + cmdCustomFlags.ResetCommands() +} + +func initialize() *Command { + tt, tp, te = nil, nil, nil + rootPersPre, echoPre, echoPersPre, timesPersPre = nil, nil, nil, nil + + var c = cmdRootNoRun + flagInit() + commandInit() + return c +} + +func initializeWithSameName() *Command { + tt, tp, te = nil, nil, nil + rootPersPre, echoPre, echoPersPre, timesPersPre = nil, nil, nil, nil + var c = cmdRootSameName + flagInit() + commandInit() + return c +} + +func initializeWithRootCmd() *Command { + cmdRootWithRun.ResetCommands() + tt, tp, te, tr, rootcalled = nil, nil, nil, nil, false + flagInit() + cmdRootWithRun.Flags().BoolVarP(&flagbr, "boolroot", "b", false, "help message for flag boolroot") + cmdRootWithRun.Flags().IntVarP(&flagir, "introot", "i", 321, "help message for flag introot") + commandInit() + return cmdRootWithRun +} + +type resulter struct { + Error error + Output string + Command *Command +} + +func fullSetupTest(args ...string) resulter { + c := initializeWithRootCmd() + + return fullTester(c, args...) +} + +func noRRSetupTestSilenced(args ...string) resulter { + c := initialize() + c.SilenceErrors = true + c.SilenceUsage = true + return fullTester(c, args...) +} + +func noRRSetupTest(args ...string) resulter { + c := initialize() + + return fullTester(c, args...) +} + +func rootOnlySetupTest(args ...string) resulter { + c := initializeWithRootCmd() + + return simpleTester(c, args...) +} + +func simpleTester(c *Command, args ...string) resulter { + buf := new(bytes.Buffer) + // Testing flag with invalid input + c.SetOutput(buf) + c.SetArgs(args) + + err := c.Execute() + output := buf.String() + + return resulter{err, output, c} +} + +func simpleTesterC(c *Command, args ...string) resulter { + buf := new(bytes.Buffer) + // Testing flag with invalid input + c.SetOutput(buf) + c.SetArgs(args) + + cmd, err := c.ExecuteC() + output := buf.String() + + return resulter{err, output, cmd} +} + +func fullTester(c *Command, args ...string) resulter { + buf := new(bytes.Buffer) + // Testing flag with invalid input + c.SetOutput(buf) + cmdEcho.AddCommand(cmdTimes) + c.AddCommand(cmdPrint, cmdEcho, cmdSubNoRun, cmdCustomFlags, cmdDeprecated) + c.SetArgs(args) + + err := c.Execute() + output := buf.String() + + return resulter{err, output, c} +} + +func logErr(t *testing.T, found, expected string) { + out := new(bytes.Buffer) + + _, _, line, ok := runtime.Caller(2) + if ok { + fmt.Fprintf(out, "Line: %d ", line) + } + fmt.Fprintf(out, "Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + t.Errorf(out.String()) +} + +func checkStringContains(t *testing.T, found, expected string) { + if !strings.Contains(found, expected) { + logErr(t, found, expected) + } +} + +func checkResultContains(t *testing.T, x resulter, check string) { + checkStringContains(t, x.Output, check) +} + +func checkStringOmits(t *testing.T, found, expected string) { + if strings.Contains(found, expected) { + logErr(t, found, expected) + } +} + +func checkResultOmits(t *testing.T, x resulter, check string) { + checkStringOmits(t, x.Output, check) +} + +func checkOutputContains(t *testing.T, c *Command, check string) { + buf := new(bytes.Buffer) + c.SetOutput(buf) + c.Execute() + + if !strings.Contains(buf.String(), check) { + logErr(t, buf.String(), check) + } +} + +func TestSingleCommand(t *testing.T) { + noRRSetupTest("print", "one", "two") + + if te != nil || tt != nil { + t.Error("Wrong command called") + } + if tp == nil { + t.Error("Wrong command called") + } + if strings.Join(tp, " ") != "one two" { + t.Error("Command didn't parse correctly") + } +} + +func TestChildCommand(t *testing.T) { + noRRSetupTest("echo", "times", "one", "two") + + if te != nil || tp != nil { + t.Error("Wrong command called") + } + if tt == nil { + t.Error("Wrong command called") + } + if strings.Join(tt, " ") != "one two" { + t.Error("Command didn't parse correctly") + } +} + +func TestCommandAlias(t *testing.T) { + noRRSetupTest("say", "times", "one", "two") + + if te != nil || tp != nil { + t.Error("Wrong command called") + } + if tt == nil { + t.Error("Wrong command called") + } + if strings.Join(tt, " ") != "one two" { + t.Error("Command didn't parse correctly") + } +} + +func TestPrefixMatching(t *testing.T) { + EnablePrefixMatching = true + noRRSetupTest("ech", "times", "one", "two") + + if te != nil || tp != nil { + t.Error("Wrong command called") + } + if tt == nil { + t.Error("Wrong command called") + } + if strings.Join(tt, " ") != "one two" { + t.Error("Command didn't parse correctly") + } + + EnablePrefixMatching = false +} + +func TestNoPrefixMatching(t *testing.T) { + EnablePrefixMatching = false + + noRRSetupTest("ech", "times", "one", "two") + + if !(tt == nil && te == nil && tp == nil) { + t.Error("Wrong command called") + } +} + +func TestAliasPrefixMatching(t *testing.T) { + EnablePrefixMatching = true + noRRSetupTest("sa", "times", "one", "two") + + if te != nil || tp != nil { + t.Error("Wrong command called") + } + if tt == nil { + t.Error("Wrong command called") + } + if strings.Join(tt, " ") != "one two" { + t.Error("Command didn't parse correctly") + } + EnablePrefixMatching = false +} + +func TestChildSameName(t *testing.T) { + c := initializeWithSameName() + c.AddCommand(cmdPrint, cmdEcho) + c.SetArgs([]string{"print", "one", "two"}) + c.Execute() + + if te != nil || tt != nil { + t.Error("Wrong command called") + } + if tp == nil { + t.Error("Wrong command called") + } + if strings.Join(tp, " ") != "one two" { + t.Error("Command didn't parse correctly") + } +} + +func TestGrandChildSameName(t *testing.T) { + c := initializeWithSameName() + cmdTimes.AddCommand(cmdPrint) + c.AddCommand(cmdTimes) + c.SetArgs([]string{"times", "print", "one", "two"}) + c.Execute() + + if te != nil || tt != nil { + t.Error("Wrong command called") + } + if tp == nil { + t.Error("Wrong command called") + } + if strings.Join(tp, " ") != "one two" { + t.Error("Command didn't parse correctly") + } +} + +func TestUsage(t *testing.T) { + x := fullSetupTest("help") + checkResultContains(t, x, cmdRootWithRun.Use+" [flags]") + x = fullSetupTest("help", "customflags") + checkResultContains(t, x, cmdCustomFlags.Use) + checkResultOmits(t, x, cmdCustomFlags.Use+" [flags]") +} + +func TestFlagLong(t *testing.T) { + noRRSetupTest("echo", "--intone=13", "something", "--", "here") + + if cmdEcho.ArgsLenAtDash() != 1 { + t.Errorf("expected argsLenAtDash: %d but got %d", 1, cmdRootNoRun.ArgsLenAtDash()) + } + if strings.Join(te, " ") != "something here" { + t.Errorf("flags didn't leave proper args remaining..%s given", te) + } + if flagi1 != 13 { + t.Errorf("int flag didn't get correct value, had %d", flagi1) + } + if flagi2 != 234 { + t.Errorf("default flag value changed, 234 expected, %d given", flagi2) + } +} + +func TestFlagShort(t *testing.T) { + noRRSetupTest("echo", "-i13", "--", "something", "here") + + if cmdEcho.ArgsLenAtDash() != 0 { + t.Errorf("expected argsLenAtDash: %d but got %d", 0, cmdRootNoRun.ArgsLenAtDash()) + } + if strings.Join(te, " ") != "something here" { + t.Errorf("flags didn't leave proper args remaining..%s given", te) + } + if flagi1 != 13 { + t.Errorf("int flag didn't get correct value, had %d", flagi1) + } + if flagi2 != 234 { + t.Errorf("default flag value changed, 234 expected, %d given", flagi2) + } + + noRRSetupTest("echo", "-i", "13", "something", "here") + + if strings.Join(te, " ") != "something here" { + t.Errorf("flags didn't leave proper args remaining..%s given", te) + } + if flagi1 != 13 { + t.Errorf("int flag didn't get correct value, had %d", flagi1) + } + if flagi2 != 234 { + t.Errorf("default flag value changed, 234 expected, %d given", flagi2) + } + + noRRSetupTest("print", "-i99", "one", "two") + + if strings.Join(tp, " ") != "one two" { + t.Errorf("flags didn't leave proper args remaining..%s given", tp) + } + if flagi3 != 99 { + t.Errorf("int flag didn't get correct value, had %d", flagi3) + } + if flagi1 != 123 { + t.Errorf("default flag value changed on different command with same shortname, 234 expected, %d given", flagi2) + } +} + +func TestChildCommandFlags(t *testing.T) { + noRRSetupTest("echo", "times", "-j", "99", "one", "two") + + if strings.Join(tt, " ") != "one two" { + t.Errorf("flags didn't leave proper args remaining..%s given", tt) + } + + // Testing with flag that shouldn't be persistent + r := noRRSetupTest("echo", "times", "-j", "99", "-i77", "one", "two") + + if r.Error == nil { + t.Errorf("invalid flag should generate error") + } + + if !strings.Contains(r.Error.Error(), "unknown shorthand") { + t.Errorf("Wrong error message displayed, \n %s", r.Error) + } + + if flagi2 != 99 { + t.Errorf("flag value should be 99, %d given", flagi2) + } + + if flagi1 != 123 { + t.Errorf("unset flag should have default value, expecting 123, given %d", flagi1) + } + + // Testing with flag only existing on child + r = noRRSetupTest("echo", "-j", "99", "-i77", "one", "two") + + if r.Error == nil { + t.Errorf("invalid flag should generate error") + } + if !strings.Contains(r.Error.Error(), "unknown shorthand flag") { + t.Errorf("Wrong error message displayed, \n %s", r.Error) + } + + // Testing with persistent flag overwritten by child + noRRSetupTest("echo", "times", "--strtwo=child", "one", "two") + + if flags2b != "child" { + t.Errorf("flag value should be child, %s given", flags2b) + } + + if flags2a != "two" { + t.Errorf("unset flag should have default value, expecting two, given %s", flags2a) + } + + // Testing flag with invalid input + r = noRRSetupTest("echo", "-i10E") + + if r.Error == nil { + t.Errorf("invalid input should generate error") + } + if !strings.Contains(r.Error.Error(), "invalid syntax") { + t.Errorf("Wrong error message displayed, \n %s", r.Error) + } +} + +func TestTrailingCommandFlags(t *testing.T) { + x := fullSetupTest("echo", "two", "-x") + + if x.Error == nil { + t.Errorf("invalid flag should generate error") + } +} + +func TestInvalidSubcommandFlags(t *testing.T) { + cmd := initializeWithRootCmd() + cmd.AddCommand(cmdTimes) + + result := simpleTester(cmd, "times", "--inttwo=2", "--badflag=bar") + // given that we are not checking here result.Error we check for + // stock usage message + checkResultContains(t, result, "cobra-test times [# times]") + if strings.Contains(result.Error.Error(), "unknown flag: --inttwo") { + t.Errorf("invalid --badflag flag shouldn't fail on 'unknown' --inttwo flag") + } + +} + +func TestSubcommandExecuteC(t *testing.T) { + cmd := initializeWithRootCmd() + double := &Command{ + Use: "double message", + Run: func(c *Command, args []string) { + msg := strings.Join(args, " ") + c.Println(msg, msg) + }, + } + + echo := &Command{ + Use: "echo message", + Run: func(c *Command, args []string) { + msg := strings.Join(args, " ") + c.Println(msg) + }, + } + + cmd.AddCommand(double, echo) + + result := simpleTesterC(cmd, "double", "hello", "world") + checkResultContains(t, result, "hello world hello world") + + if result.Command.Name() != "double" { + t.Errorf("invalid cmd returned from ExecuteC: should be 'double' but got %s", result.Command.Name()) + } + + result = simpleTesterC(cmd, "echo", "msg", "to", "be", "echoed") + checkResultContains(t, result, "msg to be echoed") + + if result.Command.Name() != "echo" { + t.Errorf("invalid cmd returned from ExecuteC: should be 'echo' but got %s", result.Command.Name()) + } +} + +func TestSubcommandArgEvaluation(t *testing.T) { + cmd := initializeWithRootCmd() + + first := &Command{ + Use: "first", + Run: func(cmd *Command, args []string) { + }, + } + cmd.AddCommand(first) + + second := &Command{ + Use: "second", + Run: func(cmd *Command, args []string) { + fmt.Fprintf(cmd.OutOrStdout(), "%v", args) + }, + } + first.AddCommand(second) + + result := simpleTester(cmd, "first", "second", "first", "third") + + expectedOutput := fmt.Sprint([]string{"first third"}) + if result.Output != expectedOutput { + t.Errorf("exptected %v, got %v", expectedOutput, result.Output) + } +} + +func TestPersistentFlags(t *testing.T) { + fullSetupTest("echo", "-s", "something", "-p", "more", "here") + + // persistentFlag should act like normal flag on its own command + if strings.Join(te, " ") != "more here" { + t.Errorf("flags didn't leave proper args remaining..%s given", te) + } + if flags1 != "something" { + t.Errorf("string flag didn't get correct value, had %v", flags1) + } + if !flagbp { + t.Errorf("persistent bool flag not parsed correctly. Expected true, had %v", flagbp) + } + + // persistentFlag should act like normal flag on its own command + fullSetupTest("echo", "times", "-s", "again", "-c", "-p", "test", "here") + + if strings.Join(tt, " ") != "test here" { + t.Errorf("flags didn't leave proper args remaining. %s given", tt) + } + + if flags1 != "again" { + t.Errorf("string flag didn't get correct value, had %v", flags1) + } + + if !flagb2 { + t.Errorf("local flag not parsed correctly. Expected true, had %v", flagb2) + } + if !flagbp { + t.Errorf("persistent bool flag not parsed correctly. Expected true, had %v", flagbp) + } +} + +func TestHelpCommand(t *testing.T) { + x := fullSetupTest("help") + checkResultContains(t, x, cmdRootWithRun.Long) + + x = fullSetupTest("help", "echo") + checkResultContains(t, x, cmdEcho.Long) + + x = fullSetupTest("help", "echo", "times") + checkResultContains(t, x, cmdTimes.Long) +} + +func TestChildCommandHelp(t *testing.T) { + c := noRRSetupTest("print", "--help") + checkResultContains(t, c, strtwoParentHelp) + r := noRRSetupTest("echo", "times", "--help") + checkResultContains(t, r, strtwoChildHelp) +} + +func TestNonRunChildHelp(t *testing.T) { + x := noRRSetupTest("subnorun") + checkResultContains(t, x, cmdSubNoRun.Long) +} + +func TestRunnableRootCommand(t *testing.T) { + x := fullSetupTest("") + + if !rootcalled { + t.Errorf("Root Function was not called\n out:%v", x.Error) + } +} + +func TestVisitParents(t *testing.T) { + c := &Command{Use: "app"} + sub := &Command{Use: "sub"} + dsub := &Command{Use: "dsub"} + sub.AddCommand(dsub) + c.AddCommand(sub) + total := 0 + add := func(x *Command) { + total++ + } + sub.VisitParents(add) + if total != 1 { + t.Errorf("Should have visited 1 parent but visited %d", total) + } + + total = 0 + dsub.VisitParents(add) + if total != 2 { + t.Errorf("Should have visited 2 parent but visited %d", total) + } + + total = 0 + c.VisitParents(add) + if total != 0 { + t.Errorf("Should have not visited any parent but visited %d", total) + } +} + +func TestRunnableRootCommandNilInput(t *testing.T) { + c := initializeWithRootCmd() + + buf := new(bytes.Buffer) + // Testing flag with invalid input + c.SetOutput(buf) + cmdEcho.AddCommand(cmdTimes) + c.AddCommand(cmdPrint, cmdEcho) + c.SetArgs([]string{}) + + err := c.Execute() + if err != nil { + t.Errorf("Execute() failed with %v", err) + } + + if !rootcalled { + t.Errorf("Root Function was not called") + } +} + +func TestRunnableRootCommandEmptyInput(t *testing.T) { + args := []string{"", "--introot=12", ""} + c := initializeWithRootCmd() + + buf := new(bytes.Buffer) + // Testing flag with invalid input + c.SetOutput(buf) + cmdEcho.AddCommand(cmdTimes) + c.AddCommand(cmdPrint, cmdEcho) + c.SetArgs(args) + + c.Execute() + + if !rootcalled { + t.Errorf("Root Function was not called.\nOutput was:\n%s\n", buf) + } +} + +func TestInvalidSubcommandWhenArgsAllowed(t *testing.T) { + fullSetupTest("echo", "invalid-sub") + + if te[0] != "invalid-sub" { + t.Errorf("Subcommand didn't work...") + } +} + +func TestRootFlags(t *testing.T) { + fullSetupTest("-i", "17", "-b") + + if !flagbr { + t.Errorf("flag value should be true, %v given", flagbr) + } + + if flagir != 17 { + t.Errorf("flag value should be 17, %d given", flagir) + } +} + +func TestRootHelp(t *testing.T) { + x := fullSetupTest("--help") + + checkResultContains(t, x, "Available Commands:") + checkResultContains(t, x, "for more information about a command") + + if strings.Contains(x.Output, "unknown flag: --help") { + t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) + } + + if strings.Contains(x.Output, cmdEcho.Use) { + t.Errorf("--help shouldn't display subcommand's usage, Got: \n %s", x.Output) + } + + x = fullSetupTest("echo", "--help") + + if strings.Contains(x.Output, cmdTimes.Use) { + t.Errorf("--help shouldn't display subsubcommand's usage, Got: \n %s", x.Output) + } + + checkResultContains(t, x, "Available Commands:") + checkResultContains(t, x, "for more information about a command") + + if strings.Contains(x.Output, "unknown flag: --help") { + t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) + } + +} + +func TestFlagAccess(t *testing.T) { + initialize() + + local := cmdTimes.LocalFlags() + inherited := cmdTimes.InheritedFlags() + + for _, f := range []string{"inttwo", "strtwo", "booltwo"} { + if local.Lookup(f) == nil { + t.Errorf("LocalFlags expected to contain %s, Got: nil", f) + } + } + if inherited.Lookup("strone") == nil { + t.Errorf("InheritedFlags expected to contain strone, Got: nil") + } + if inherited.Lookup("strtwo") != nil { + t.Errorf("InheritedFlags shouldn not contain overwritten flag strtwo") + } +} + +func TestNoNRunnableRootCommandNilInput(t *testing.T) { + c := initialize() + + buf := new(bytes.Buffer) + // Testing flag with invalid input + c.SetOutput(buf) + cmdEcho.AddCommand(cmdTimes) + c.AddCommand(cmdPrint, cmdEcho) + c.SetArgs([]string{}) + + c.Execute() + + if !strings.Contains(buf.String(), cmdRootNoRun.Long) { + t.Errorf("Expected to get help output, Got: \n %s", buf) + } +} + +func TestRootNoCommandHelp(t *testing.T) { + x := rootOnlySetupTest("--help") + + checkResultOmits(t, x, "Available Commands:") + checkResultOmits(t, x, "for more information about a command") + + if strings.Contains(x.Output, "unknown flag: --help") { + t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) + } + + x = rootOnlySetupTest("echo", "--help") + + checkResultOmits(t, x, "Available Commands:") + checkResultOmits(t, x, "for more information about a command") + + if strings.Contains(x.Output, "unknown flag: --help") { + t.Errorf("--help shouldn't trigger an error, Got: \n %s", x.Output) + } +} + +func TestRootUnknownCommand(t *testing.T) { + r := noRRSetupTest("bogus") + s := "Error: unknown command \"bogus\" for \"cobra-test\"\nRun 'cobra-test --help' for usage.\n" + + if r.Output != s { + t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output) + } + + r = noRRSetupTest("--strtwo=a", "bogus") + if r.Output != s { + t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output) + } +} + +func TestRootUnknownCommandSilenced(t *testing.T) { + r := noRRSetupTestSilenced("bogus") + + if r.Output != "" { + t.Errorf("Unexpected response.\nExpecting to be: \n\"\"\n Got:\n %q\n", r.Output) + } + + r = noRRSetupTestSilenced("--strtwo=a", "bogus") + if r.Output != "" { + t.Errorf("Unexpected response.\nExpecting to be:\n\"\"\nGot:\n %q\n", r.Output) + } +} + +func TestRootSuggestions(t *testing.T) { + outputWithSuggestions := "Error: unknown command \"%s\" for \"cobra-test\"\n\nDid you mean this?\n\t%s\n\nRun 'cobra-test --help' for usage.\n" + outputWithoutSuggestions := "Error: unknown command \"%s\" for \"cobra-test\"\nRun 'cobra-test --help' for usage.\n" + + cmd := initializeWithRootCmd() + cmd.AddCommand(cmdTimes) + + tests := map[string]string{ + "time": "times", + "tiems": "times", + "tims": "times", + "timeS": "times", + "rimes": "times", + "ti": "times", + "t": "times", + "timely": "times", + "ri": "", + "timezone": "", + "foo": "", + "counts": "times", + } + + for typo, suggestion := range tests { + for _, suggestionsDisabled := range []bool{false, true} { + cmd.DisableSuggestions = suggestionsDisabled + result := simpleTester(cmd, typo) + expected := "" + if len(suggestion) == 0 || suggestionsDisabled { + expected = fmt.Sprintf(outputWithoutSuggestions, typo) + } else { + expected = fmt.Sprintf(outputWithSuggestions, typo, suggestion) + } + if result.Output != expected { + t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", expected, result.Output) + } + } + } +} + +func TestFlagsBeforeCommand(t *testing.T) { + // short without space + x := fullSetupTest("-i10", "echo") + if x.Error != nil { + t.Errorf("Valid Input shouldn't have errors, got:\n %q", x.Error) + } + + x = noRRSetupTest("echo", "-i=10") + if x.Error != nil { + t.Errorf("Valid Input shouldn't have errors, got:\n %s", x.Error) + } + + // long with equals + x = noRRSetupTest("--intone=123", "echo", "one", "two") + if x.Error != nil { + t.Errorf("Valid Input shouldn't have errors, got:\n %s", x.Error) + } + + // With parsing error properly reported + x = fullSetupTest("-i10E", "echo") + if !strings.Contains(x.Error.Error(), "invalid syntax") { + t.Errorf("Wrong error message displayed, \n %s", x.Error) + } +} + +func TestRemoveCommand(t *testing.T) { + versionUsed = 0 + c := initializeWithRootCmd() + c.AddCommand(cmdVersion1) + c.RemoveCommand(cmdVersion1) + x := fullTester(c, "version") + if x.Error == nil { + t.Errorf("Removed command should not have been called\n") + return + } +} + +func TestCommandWithoutSubcommands(t *testing.T) { + c := initializeWithRootCmd() + + x := simpleTester(c, "") + if x.Error != nil { + t.Errorf("Calling command without subcommands should not have error: %v", x.Error) + return + } +} + +func TestCommandWithoutSubcommandsWithArg(t *testing.T) { + c := initializeWithRootCmd() + expectedArgs := []string{"arg"} + + x := simpleTester(c, "arg") + if x.Error != nil { + t.Errorf("Calling command without subcommands but with arg should not have error: %v", x.Error) + return + } + if !reflect.DeepEqual(expectedArgs, tr) { + t.Errorf("Calling command without subcommands but with arg has wrong args: expected: %v, actual: %v", expectedArgs, tr) + return + } +} + +func TestReplaceCommandWithRemove(t *testing.T) { + versionUsed = 0 + c := initializeWithRootCmd() + c.AddCommand(cmdVersion1) + c.RemoveCommand(cmdVersion1) + c.AddCommand(cmdVersion2) + x := fullTester(c, "version") + if x.Error != nil { + t.Errorf("Valid Input shouldn't have errors, got:\n %q", x.Error) + return + } + if versionUsed == 1 { + t.Errorf("Removed command shouldn't be called\n") + } + if versionUsed != 2 { + t.Errorf("Replacing command should have been called but didn't\n") + } +} + +func TestDeprecatedSub(t *testing.T) { + c := fullSetupTest("deprecated") + + checkResultContains(t, c, cmdDeprecated.Deprecated) +} + +func TestPreRun(t *testing.T) { + noRRSetupTest("echo", "one", "two") + if echoPre == nil || echoPersPre == nil { + t.Error("PreRun or PersistentPreRun not called") + } + if rootPersPre != nil || timesPersPre != nil { + t.Error("Wrong *Pre functions called!") + } + + noRRSetupTest("echo", "times", "one", "two") + if timesPersPre == nil { + t.Error("PreRun or PersistentPreRun not called") + } + if echoPre != nil || echoPersPre != nil || rootPersPre != nil { + t.Error("Wrong *Pre functions called!") + } + + noRRSetupTest("print", "one", "two") + if rootPersPre == nil { + t.Error("Parent PersistentPreRun not called but should not have been") + } + if echoPre != nil || echoPersPre != nil || timesPersPre != nil { + t.Error("Wrong *Pre functions called!") + } +} + +// Check if cmdEchoSub gets PersistentPreRun from rootCmd even if is added last +func TestPeristentPreRunPropagation(t *testing.T) { + rootCmd := initialize() + + // First add the cmdEchoSub to cmdPrint + cmdPrint.AddCommand(cmdEchoSub) + // Now add cmdPrint to rootCmd + rootCmd.AddCommand(cmdPrint) + + rootCmd.SetArgs([]string{"print", "echosub", "lala"}) + rootCmd.Execute() + + if len(rootPersPre) == 0 || rootPersPre[0] != "lala" { + t.Error("RootCmd PersistentPreRun not called but should have been") + } +} + +func TestGlobalNormFuncPropagation(t *testing.T) { + normFunc := func(f *pflag.FlagSet, name string) pflag.NormalizedName { + return pflag.NormalizedName(name) + } + + rootCmd := initialize() + rootCmd.SetGlobalNormalizationFunc(normFunc) + if reflect.ValueOf(normFunc) != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()) { + t.Error("rootCmd seems to have a wrong normalization function") + } + + // First add the cmdEchoSub to cmdPrint + cmdPrint.AddCommand(cmdEchoSub) + if cmdPrint.GlobalNormalizationFunc() != nil && cmdEchoSub.GlobalNormalizationFunc() != nil { + t.Error("cmdPrint and cmdEchoSub should had no normalization functions") + } + + // Now add cmdPrint to rootCmd + rootCmd.AddCommand(cmdPrint) + if reflect.ValueOf(cmdPrint.GlobalNormalizationFunc()).Pointer() != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()).Pointer() || + reflect.ValueOf(cmdEchoSub.GlobalNormalizationFunc()).Pointer() != reflect.ValueOf(rootCmd.GlobalNormalizationFunc()).Pointer() { + t.Error("cmdPrint and cmdEchoSub should had the normalization function of rootCmd") + } +} + +func TestFlagOnPflagCommandLine(t *testing.T) { + flagName := "flagOnCommandLine" + pflag.String(flagName, "", "about my flag") + r := fullSetupTest("--help") + + checkResultContains(t, r, flagName) + + // Reset pflag.CommandLine flagset. + pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ExitOnError) +} + +func TestAddTemplateFunctions(t *testing.T) { + AddTemplateFunc("t", func() bool { return true }) + AddTemplateFuncs(template.FuncMap{ + "f": func() bool { return false }, + "h": func() string { return "Hello," }, + "w": func() string { return "world." }}) + + const usage = "Hello, world." + + c := &Command{} + c.SetUsageTemplate(`{{if t}}{{h}}{{end}}{{if f}}{{h}}{{end}} {{w}}`) + + if us := c.UsageString(); us != usage { + t.Errorf("c.UsageString() != \"%s\", is \"%s\"", usage, us) + } +} + +func TestUsageIsNotPrintedTwice(t *testing.T) { + var cmd = &Command{Use: "root"} + var sub = &Command{Use: "sub"} + cmd.AddCommand(sub) + + r := simpleTester(cmd, "") + if strings.Count(r.Output, "Usage:") != 1 { + t.Error("Usage output is not printed exactly once") + } +} + +func BenchmarkInheritedFlags(b *testing.B) { + initialize() + cmdEcho.AddCommand(cmdTimes) + b.ResetTimer() + + for i := 0; i < b.N; i++ { + cmdTimes.InheritedFlags() + } +} + +func BenchmarkLocalFlags(b *testing.B) { + initialize() + cmdEcho.AddCommand(cmdTimes) + b.ResetTimer() + + for i := 0; i < b.N; i++ { + cmdTimes.LocalFlags() + } +} diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index d0eff7fb77..01d9683ead 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -1,1289 +1,1289 @@ -// Copyright © 2013 Steve Francia . -// -// 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 cobra is a commander providing a simple interface to create powerful modern CLI interfaces. -// In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. -package cobra - -import ( - "bytes" - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - - flag "github.com/spf13/pflag" -) - -// Command is just that, a command for your application. -// E.g. 'go run ...' - 'run' is the command. Cobra requires -// you to define the usage and description as part of your command -// definition to ensure usability. -type Command struct { - // Use is the one-line usage message. - Use string - - // Aliases is an array of aliases that can be used instead of the first word in Use. - Aliases []string - - // SuggestFor is an array of command names for which this command will be suggested - - // similar to aliases but only suggests. - SuggestFor []string - - // Short is the short description shown in the 'help' output. - Short string - - // Long is the long message shown in the 'help ' output. - Long string - - // Example is examples of how to use the command. - Example string - - // ValidArgs is list of all valid non-flag arguments that are accepted in bash completions - ValidArgs []string - - // ArgAliases is List of aliases for ValidArgs. - // These are not suggested to the user in the bash completion, - // but accepted if entered manually. - ArgAliases []string - - // BashCompletionFunction is custom functions used by the bash autocompletion generator. - BashCompletionFunction string - - // Deprecated defines, if this command is deprecated and should print this string when used. - Deprecated string - - // Hidden defines, if this command is hidden and should NOT show up in the list of available commands. - Hidden bool - - // Annotations are key/value pairs that can be used by applications to identify or - // group commands. - Annotations map[string]string - - // The *Run functions are executed in the following order: - // * PersistentPreRun() - // * PreRun() - // * Run() - // * PostRun() - // * PersistentPostRun() - // All functions get the same args, the arguments after the command name. - // - // PersistentPreRun: children of this command will inherit and execute. - PersistentPreRun func(cmd *Command, args []string) - // PersistentPreRunE: PersistentPreRun but returns an error. - PersistentPreRunE func(cmd *Command, args []string) error - // PreRun: children of this command will not inherit. - PreRun func(cmd *Command, args []string) - // PreRunE: PreRun but returns an error. - PreRunE func(cmd *Command, args []string) error - // Run: Typically the actual work function. Most commands will only implement this. - Run func(cmd *Command, args []string) - // RunE: Run but returns an error. - RunE func(cmd *Command, args []string) error - // PostRun: run after the Run command. - PostRun func(cmd *Command, args []string) - // PostRunE: PostRun but returns an error. - PostRunE func(cmd *Command, args []string) error - // PersistentPostRun: children of this command will inherit and execute after PostRun. - PersistentPostRun func(cmd *Command, args []string) - // PersistentPostRunE: PersistentPostRun but returns an error. - PersistentPostRunE func(cmd *Command, args []string) error - - // SilenceErrors is an option to quiet errors down stream. - SilenceErrors bool - - // SilenceUsage is an option to silence usage when an error occurs. - SilenceUsage bool - - // DisableFlagParsing disables the flag parsing. - // If this is true all flags will be passed to the command as arguments. - DisableFlagParsing bool - - // DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...") - // will be printed by generating docs for this command. - DisableAutoGenTag bool - - // DisableSuggestions disables the suggestions based on Levenshtein distance - // that go along with 'unknown command' messages. - DisableSuggestions bool - // SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions. - // Must be > 0. - SuggestionsMinimumDistance int - - // name is the command name, usually the executable's name. - name string - // commands is the list of commands supported by this program. - commands []*Command - // parent is a parent command for this command. - parent *Command - // Max lengths of commands' string lengths for use in padding. - commandsMaxUseLen int - commandsMaxCommandPathLen int - commandsMaxNameLen int - // commandsAreSorted defines, if command slice are sorted or not. - commandsAreSorted bool - - // args is actual args parsed from flags. - args []string - // flagErrorBuf contains all error messages from pflag. - flagErrorBuf *bytes.Buffer - // flags is full set of flags. - flags *flag.FlagSet - // pflags contains persistent flags. - pflags *flag.FlagSet - // lflags contains local flags. - lflags *flag.FlagSet - // iflags contains inherited flags. - iflags *flag.FlagSet - // parentsPflags is all persistent flags of cmd's parents. - parentsPflags *flag.FlagSet - // globNormFunc is the global normalization function - // that we can use on every pflag set and children commands - globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName - - // output is an output writer defined by user. - output io.Writer - // usageFunc is usage func defined by user. - usageFunc func(*Command) error - // usageTemplate is usage template defined by user. - usageTemplate string - // flagErrorFunc is func defined by user and it's called when the parsing of - // flags returns an error. - flagErrorFunc func(*Command, error) error - // helpTemplate is help template defined by user. - helpTemplate string - // helpFunc is help func defined by user. - helpFunc func(*Command, []string) - // helpCommand is command with usage 'help'. If it's not defined by user, - // cobra uses default help command. - helpCommand *Command -} - -// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden -// particularly useful when testing. -func (c *Command) SetArgs(a []string) { - c.args = a -} - -// SetOutput sets the destination for usage and error messages. -// If output is nil, os.Stderr is used. -func (c *Command) SetOutput(output io.Writer) { - c.output = output -} - -// SetUsageFunc sets usage function. Usage can be defined by application. -func (c *Command) SetUsageFunc(f func(*Command) error) { - c.usageFunc = f -} - -// SetUsageTemplate sets usage template. Can be defined by Application. -func (c *Command) SetUsageTemplate(s string) { - c.usageTemplate = s -} - -// SetFlagErrorFunc sets a function to generate an error when flag parsing -// fails. -func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) { - c.flagErrorFunc = f -} - -// SetHelpFunc sets help function. Can be defined by Application. -func (c *Command) SetHelpFunc(f func(*Command, []string)) { - c.helpFunc = f -} - -// SetHelpCommand sets help command. -func (c *Command) SetHelpCommand(cmd *Command) { - c.helpCommand = cmd -} - -// SetHelpTemplate sets help template to be used. Application can use it to set custom template. -func (c *Command) SetHelpTemplate(s string) { - c.helpTemplate = s -} - -// SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. -// The user should not have a cyclic dependency on commands. -func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) { - c.Flags().SetNormalizeFunc(n) - c.PersistentFlags().SetNormalizeFunc(n) - c.globNormFunc = n - - for _, command := range c.commands { - command.SetGlobalNormalizationFunc(n) - } -} - -// OutOrStdout returns output to stdout. -func (c *Command) OutOrStdout() io.Writer { - return c.getOut(os.Stdout) -} - -// OutOrStderr returns output to stderr -func (c *Command) OutOrStderr() io.Writer { - return c.getOut(os.Stderr) -} - -func (c *Command) getOut(def io.Writer) io.Writer { - if c.output != nil { - return c.output - } - if c.HasParent() { - return c.parent.getOut(def) - } - return def -} - -// UsageFunc returns either the function set by SetUsageFunc for this command -// or a parent, or it returns a default usage function. -func (c *Command) UsageFunc() (f func(*Command) error) { - if c.usageFunc != nil { - return c.usageFunc - } - if c.HasParent() { - return c.Parent().UsageFunc() - } - return func(c *Command) error { - c.mergePersistentFlags() - err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c) - if err != nil { - c.Println(err) - } - return err - } -} - -// Usage puts out the usage for the command. -// Used when a user provides invalid input. -// Can be defined by user by overriding UsageFunc. -func (c *Command) Usage() error { - return c.UsageFunc()(c) -} - -// HelpFunc returns either the function set by SetHelpFunc for this command -// or a parent, or it returns a function with default help behavior. -func (c *Command) HelpFunc() func(*Command, []string) { - if c.helpFunc != nil { - return c.helpFunc - } - if c.HasParent() { - return c.Parent().HelpFunc() - } - return func(c *Command, a []string) { - c.mergePersistentFlags() - err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c) - if err != nil { - c.Println(err) - } - } -} - -// Help puts out the help for the command. -// Used when a user calls help [command]. -// Can be defined by user by overriding HelpFunc. -func (c *Command) Help() error { - c.HelpFunc()(c, []string{}) - return nil -} - -// UsageString return usage string. -func (c *Command) UsageString() string { - tmpOutput := c.output - bb := new(bytes.Buffer) - c.SetOutput(bb) - c.Usage() - c.output = tmpOutput - return bb.String() -} - -// FlagErrorFunc returns either the function set by SetFlagErrorFunc for this -// command or a parent, or it returns a function which returns the original -// error. -func (c *Command) FlagErrorFunc() (f func(*Command, error) error) { - if c.flagErrorFunc != nil { - return c.flagErrorFunc - } - - if c.HasParent() { - return c.parent.FlagErrorFunc() - } - return func(c *Command, err error) error { - return err - } -} - -var minUsagePadding = 25 - -// UsagePadding return padding for the usage. -func (c *Command) UsagePadding() int { - if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen { - return minUsagePadding - } - return c.parent.commandsMaxUseLen -} - -var minCommandPathPadding = 11 - -// CommandPathPadding return padding for the command path. -func (c *Command) CommandPathPadding() int { - if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen { - return minCommandPathPadding - } - return c.parent.commandsMaxCommandPathLen -} - -var minNamePadding = 11 - -// NamePadding returns padding for the name. -func (c *Command) NamePadding() int { - if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen { - return minNamePadding - } - return c.parent.commandsMaxNameLen -} - -// UsageTemplate returns usage template for the command. -func (c *Command) UsageTemplate() string { - if c.usageTemplate != "" { - return c.usageTemplate - } - - if c.HasParent() { - return c.parent.UsageTemplate() - } - return `Usage:{{if .Runnable}} - {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} - {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} - -Aliases: - {{.NameAndAliases}}{{end}}{{if .HasExample}} - -Examples: -{{.Example}}{{end}}{{if .HasAvailableSubCommands}} - -Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} - {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} - -Flags: -{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} - -Global Flags: -{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}} - -Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} - {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}} - -Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}} -` -} - -// HelpTemplate return help template for the command. -func (c *Command) HelpTemplate() string { - if c.helpTemplate != "" { - return c.helpTemplate - } - - if c.HasParent() { - return c.parent.HelpTemplate() - } - return `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} - -{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}` -} - -func hasNoOptDefVal(name string, fs *flag.FlagSet) bool { - flag := fs.Lookup(name) - if flag == nil { - return false - } - return flag.NoOptDefVal != "" -} - -func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool { - if len(name) == 0 { - return false - } - - flag := fs.ShorthandLookup(name[:1]) - if flag == nil { - return false - } - return flag.NoOptDefVal != "" -} - -func stripFlags(args []string, c *Command) []string { - if len(args) == 0 { - return args - } - c.mergePersistentFlags() - - commands := []string{} - flags := c.Flags() - -Loop: - for len(args) > 0 { - s := args[0] - args = args[1:] - switch { - case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags): - // If '--flag arg' then - // delete arg from args. - fallthrough // (do the same as below) - case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags): - // If '-f arg' then - // delete 'arg' from args or break the loop if len(args) <= 1. - if len(args) <= 1 { - break Loop - } else { - args = args[1:] - continue - } - case s != "" && !strings.HasPrefix(s, "-"): - commands = append(commands, s) - } - } - - return commands -} - -// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like -// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]). -func argsMinusFirstX(args []string, x string) []string { - for i, y := range args { - if x == y { - ret := []string{} - ret = append(ret, args[:i]...) - ret = append(ret, args[i+1:]...) - return ret - } - } - return args -} - -// Find the target command given the args and command tree -// Meant to be run on the highest node. Only searches down. -func (c *Command) Find(args []string) (*Command, []string, error) { - if c == nil { - return nil, nil, fmt.Errorf("Called find() on a nil Command") - } - - var innerfind func(*Command, []string) (*Command, []string) - - innerfind = func(c *Command, innerArgs []string) (*Command, []string) { - argsWOflags := stripFlags(innerArgs, c) - if len(argsWOflags) == 0 { - return c, innerArgs - } - nextSubCmd := argsWOflags[0] - matches := make([]*Command, 0) - for _, cmd := range c.commands { - if cmd.Name() == nextSubCmd || cmd.HasAlias(nextSubCmd) { // exact name or alias match - return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd)) - } - if EnablePrefixMatching { - if strings.HasPrefix(cmd.Name(), nextSubCmd) { // prefix match - matches = append(matches, cmd) - } - for _, x := range cmd.Aliases { - if strings.HasPrefix(x, nextSubCmd) { - matches = append(matches, cmd) - } - } - } - } - - // only accept a single prefix match - multiple matches would be ambiguous - if len(matches) == 1 { - return innerfind(matches[0], argsMinusFirstX(innerArgs, argsWOflags[0])) - } - - return c, innerArgs - } - - commandFound, a := innerfind(c, args) - argsWOflags := stripFlags(a, commandFound) - - // no subcommand, always take args - if !commandFound.HasSubCommands() { - return commandFound, a, nil - } - - // root command with subcommands, do subcommand checking - if commandFound == c && len(argsWOflags) > 0 { - suggestionsString := "" - if !c.DisableSuggestions { - if c.SuggestionsMinimumDistance <= 0 { - c.SuggestionsMinimumDistance = 2 - } - if suggestions := c.SuggestionsFor(argsWOflags[0]); len(suggestions) > 0 { - suggestionsString += "\n\nDid you mean this?\n" - for _, s := range suggestions { - suggestionsString += fmt.Sprintf("\t%v\n", s) - } - } - } - return commandFound, a, fmt.Errorf("unknown command %q for %q%s", argsWOflags[0], commandFound.CommandPath(), suggestionsString) - } - - return commandFound, a, nil -} - -// SuggestionsFor provides suggestions for the typedName. -func (c *Command) SuggestionsFor(typedName string) []string { - suggestions := []string{} - for _, cmd := range c.commands { - if cmd.IsAvailableCommand() { - levenshteinDistance := ld(typedName, cmd.Name(), true) - suggestByLevenshtein := levenshteinDistance <= c.SuggestionsMinimumDistance - suggestByPrefix := strings.HasPrefix(strings.ToLower(cmd.Name()), strings.ToLower(typedName)) - if suggestByLevenshtein || suggestByPrefix { - suggestions = append(suggestions, cmd.Name()) - } - for _, explicitSuggestion := range cmd.SuggestFor { - if strings.EqualFold(typedName, explicitSuggestion) { - suggestions = append(suggestions, cmd.Name()) - } - } - } - } - return suggestions -} - -// VisitParents visits all parents of the command and invokes fn on each parent. -func (c *Command) VisitParents(fn func(*Command)) { - if c.HasParent() { - fn(c.Parent()) - c.Parent().VisitParents(fn) - } -} - -// Root finds root command. -func (c *Command) Root() *Command { - if c.HasParent() { - return c.Parent().Root() - } - return c -} - -// ArgsLenAtDash will return the length of f.Args at the moment when a -- was -// found during arg parsing. This allows your program to know which args were -// before the -- and which came after. (Description from -// https://godoc.org/github.com/spf13/pflag#FlagSet.ArgsLenAtDash). -func (c *Command) ArgsLenAtDash() int { - return c.Flags().ArgsLenAtDash() -} - -func (c *Command) execute(a []string) (err error) { - if c == nil { - return fmt.Errorf("Called Execute() on a nil Command") - } - - if len(c.Deprecated) > 0 { - c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated) - } - - // initialize help flag as the last point possible to allow for user - // overriding - c.InitDefaultHelpFlag() - - err = c.ParseFlags(a) - if err != nil { - return c.FlagErrorFunc()(c, err) - } - - // If help is called, regardless of other flags, return we want help. - // Also say we need help if the command isn't runnable. - helpVal, err := c.Flags().GetBool("help") - if err != nil { - // should be impossible to get here as we always declare a help - // flag in InitDefaultHelpFlag() - c.Println("\"help\" flag declared as non-bool. Please correct your code") - return err - } - - if helpVal || !c.Runnable() { - return flag.ErrHelp - } - - c.preRun() - - argWoFlags := c.Flags().Args() - if c.DisableFlagParsing { - argWoFlags = a - } - - for p := c; p != nil; p = p.Parent() { - if p.PersistentPreRunE != nil { - if err := p.PersistentPreRunE(c, argWoFlags); err != nil { - return err - } - break - } else if p.PersistentPreRun != nil { - p.PersistentPreRun(c, argWoFlags) - break - } - } - if c.PreRunE != nil { - if err := c.PreRunE(c, argWoFlags); err != nil { - return err - } - } else if c.PreRun != nil { - c.PreRun(c, argWoFlags) - } - - if c.RunE != nil { - if err := c.RunE(c, argWoFlags); err != nil { - return err - } - } else { - c.Run(c, argWoFlags) - } - if c.PostRunE != nil { - if err := c.PostRunE(c, argWoFlags); err != nil { - return err - } - } else if c.PostRun != nil { - c.PostRun(c, argWoFlags) - } - for p := c; p != nil; p = p.Parent() { - if p.PersistentPostRunE != nil { - if err := p.PersistentPostRunE(c, argWoFlags); err != nil { - return err - } - break - } else if p.PersistentPostRun != nil { - p.PersistentPostRun(c, argWoFlags) - break - } - } - - return nil -} - -func (c *Command) preRun() { - for _, x := range initializers { - x() - } -} - -// Execute Call execute to use the args (os.Args[1:] by default) -// and run through the command tree finding appropriate matches -// for commands and then corresponding flags. -func (c *Command) Execute() error { - _, err := c.ExecuteC() - return err -} - -// ExecuteC executes the command. -func (c *Command) ExecuteC() (cmd *Command, err error) { - // Regardless of what command execute is called on, run on Root only - if c.HasParent() { - return c.Root().ExecuteC() - } - - // windows hook - if preExecHookFn != nil { - preExecHookFn(c) - } - - // initialize help as the last point possible to allow for user - // overriding - c.initHelpCmd() - - var args []string - - // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155 - if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" { - args = os.Args[1:] - } else { - args = c.args - } - - cmd, flags, err := c.Find(args) - if err != nil { - // If found parse to a subcommand and then failed, talk about the subcommand - if cmd != nil { - c = cmd - } - if !c.SilenceErrors { - c.Println("Error:", err.Error()) - c.Printf("Run '%v --help' for usage.\n", c.CommandPath()) - } - return c, err - } - err = cmd.execute(flags) - if err != nil { - // Always show help if requested, even if SilenceErrors is in - // effect - if err == flag.ErrHelp { - cmd.HelpFunc()(cmd, args) - return cmd, nil - } - - // If root command has SilentErrors flagged, - // all subcommands should respect it - if !cmd.SilenceErrors && !c.SilenceErrors { - c.Println("Error:", err.Error()) - } - - // If root command has SilentUsage flagged, - // all subcommands should respect it - if !cmd.SilenceUsage && !c.SilenceUsage { - c.Println(cmd.UsageString()) - } - return cmd, err - } - return cmd, nil -} - -// InitDefaultHelpFlag adds default help flag to c. -// It is called automatically by executing the c or by calling help and usage. -// If c already has help flag, it will do nothing. -func (c *Command) InitDefaultHelpFlag() { - c.mergePersistentFlags() - if c.Flags().Lookup("help") == nil { - usage := "help for " - if c.Name() == "" { - usage += "this command" - } else { - usage += c.Name() - } - c.Flags().BoolP("help", "h", false, usage) - } -} - -func (c *Command) initHelpCmd() { - if c.helpCommand == nil { - if !c.HasSubCommands() { - return - } - - c.helpCommand = &Command{ - Use: "help [command]", - Short: "Help about any command", - Long: `Help provides help for any command in the application. - Simply type ` + c.Name() + ` help [path to command] for full details.`, - PersistentPreRun: func(cmd *Command, args []string) {}, - PersistentPostRun: func(cmd *Command, args []string) {}, - - Run: func(c *Command, args []string) { - cmd, _, e := c.Root().Find(args) - if cmd == nil || e != nil { - c.Printf("Unknown help topic %#q\n", args) - c.Root().Usage() - } else { - cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown - cmd.Help() - } - }, - } - } - c.RemoveCommand(c.helpCommand) - c.AddCommand(c.helpCommand) -} - -// ResetCommands used for testing. -func (c *Command) ResetCommands() { - c.commands = nil - c.helpCommand = nil - c.parentsPflags = nil -} - -// Sorts commands by their names. -type commandSorterByName []*Command - -func (c commandSorterByName) Len() int { return len(c) } -func (c commandSorterByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] } -func (c commandSorterByName) Less(i, j int) bool { return c[i].Name() < c[j].Name() } - -// Commands returns a sorted slice of child commands. -func (c *Command) Commands() []*Command { - // do not sort commands if it already sorted or sorting was disabled - if EnableCommandSorting && !c.commandsAreSorted { - sort.Sort(commandSorterByName(c.commands)) - c.commandsAreSorted = true - } - return c.commands -} - -// AddCommand adds one or more commands to this parent command. -func (c *Command) AddCommand(cmds ...*Command) { - for i, x := range cmds { - if cmds[i] == c { - panic("Command can't be a child of itself") - } - cmds[i].parent = c - // update max lengths - usageLen := len(x.Use) - if usageLen > c.commandsMaxUseLen { - c.commandsMaxUseLen = usageLen - } - commandPathLen := len(x.CommandPath()) - if commandPathLen > c.commandsMaxCommandPathLen { - c.commandsMaxCommandPathLen = commandPathLen - } - nameLen := len(x.Name()) - if nameLen > c.commandsMaxNameLen { - c.commandsMaxNameLen = nameLen - } - // If global normalization function exists, update all children - if c.globNormFunc != nil { - x.SetGlobalNormalizationFunc(c.globNormFunc) - } - c.commands = append(c.commands, x) - c.commandsAreSorted = false - } -} - -// RemoveCommand removes one or more commands from a parent command. -func (c *Command) RemoveCommand(cmds ...*Command) { - commands := []*Command{} -main: - for _, command := range c.commands { - for _, cmd := range cmds { - if command == cmd { - command.parent = nil - continue main - } - } - commands = append(commands, command) - } - c.commands = commands - // recompute all lengths - c.commandsMaxUseLen = 0 - c.commandsMaxCommandPathLen = 0 - c.commandsMaxNameLen = 0 - for _, command := range c.commands { - usageLen := len(command.Use) - if usageLen > c.commandsMaxUseLen { - c.commandsMaxUseLen = usageLen - } - commandPathLen := len(command.CommandPath()) - if commandPathLen > c.commandsMaxCommandPathLen { - c.commandsMaxCommandPathLen = commandPathLen - } - nameLen := len(command.Name()) - if nameLen > c.commandsMaxNameLen { - c.commandsMaxNameLen = nameLen - } - } -} - -// Print is a convenience method to Print to the defined output, fallback to Stderr if not set. -func (c *Command) Print(i ...interface{}) { - fmt.Fprint(c.OutOrStderr(), i...) -} - -// Println is a convenience method to Println to the defined output, fallback to Stderr if not set. -func (c *Command) Println(i ...interface{}) { - c.Print(fmt.Sprintln(i...)) -} - -// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set. -func (c *Command) Printf(format string, i ...interface{}) { - c.Print(fmt.Sprintf(format, i...)) -} - -// CommandPath returns the full path to this command. -func (c *Command) CommandPath() string { - if c.HasParent() { - return c.Parent().CommandPath() + " " + c.Name() - } - return c.Name() -} - -// UseLine puts out the full usage for a given command (including parents). -func (c *Command) UseLine() string { - var useline string - if c.HasParent() { - useline = c.parent.CommandPath() + " " + c.Use - } else { - useline = c.Use - } - if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") { - useline += " [flags]" - } - return useline -} - -// DebugFlags used to determine which flags have been assigned to which commands -// and which persist. -func (c *Command) DebugFlags() { - c.Println("DebugFlags called on", c.Name()) - var debugflags func(*Command) - - debugflags = func(x *Command) { - if x.HasFlags() || x.HasPersistentFlags() { - c.Println(x.Name()) - } - if x.HasFlags() { - x.flags.VisitAll(func(f *flag.Flag) { - if x.HasPersistentFlags() && x.persistentFlag(f.Name) != nil { - c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]") - } else { - c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]") - } - }) - } - if x.HasPersistentFlags() { - x.pflags.VisitAll(func(f *flag.Flag) { - if x.HasFlags() { - if x.flags.Lookup(f.Name) == nil { - c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]") - } - } else { - c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]") - } - }) - } - c.Println(x.flagErrorBuf) - if x.HasSubCommands() { - for _, y := range x.commands { - debugflags(y) - } - } - } - - debugflags(c) -} - -// Name returns the command's name: the first word in the use line. -func (c *Command) Name() string { - if c.name == "" { - name := c.Use - i := strings.Index(name, " ") - if i >= 0 { - name = name[:i] - } - c.name = name - } - return c.name -} - -// HasAlias determines if a given string is an alias of the command. -func (c *Command) HasAlias(s string) bool { - for _, a := range c.Aliases { - if a == s { - return true - } - } - return false -} - -// NameAndAliases returns string containing name and all aliases -func (c *Command) NameAndAliases() string { - return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ") -} - -// HasExample determines if the command has example. -func (c *Command) HasExample() bool { - return len(c.Example) > 0 -} - -// Runnable determines if the command is itself runnable. -func (c *Command) Runnable() bool { - return c.Run != nil || c.RunE != nil -} - -// HasSubCommands determines if the command has children commands. -func (c *Command) HasSubCommands() bool { - return len(c.commands) > 0 -} - -// IsAvailableCommand determines if a command is available as a non-help command -// (this includes all non deprecated/hidden commands). -func (c *Command) IsAvailableCommand() bool { - if len(c.Deprecated) != 0 || c.Hidden { - return false - } - - if c.HasParent() && c.Parent().helpCommand == c { - return false - } - - if c.Runnable() || c.HasAvailableSubCommands() { - return true - } - - return false -} - -// IsAdditionalHelpTopicCommand determines if a command is an additional -// help topic command; additional help topic command is determined by the -// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that -// are runnable/hidden/deprecated. -// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924. -func (c *Command) IsAdditionalHelpTopicCommand() bool { - // if a command is runnable, deprecated, or hidden it is not a 'help' command - if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden { - return false - } - - // if any non-help sub commands are found, the command is not a 'help' command - for _, sub := range c.commands { - if !sub.IsAdditionalHelpTopicCommand() { - return false - } - } - - // the command either has no sub commands, or no non-help sub commands - return true -} - -// HasHelpSubCommands determines if a command has any available 'help' sub commands -// that need to be shown in the usage/help default template under 'additional help -// topics'. -func (c *Command) HasHelpSubCommands() bool { - // return true on the first found available 'help' sub command - for _, sub := range c.commands { - if sub.IsAdditionalHelpTopicCommand() { - return true - } - } - - // the command either has no sub commands, or no available 'help' sub commands - return false -} - -// HasAvailableSubCommands determines if a command has available sub commands that -// need to be shown in the usage/help default template under 'available commands'. -func (c *Command) HasAvailableSubCommands() bool { - // return true on the first found available (non deprecated/help/hidden) - // sub command - for _, sub := range c.commands { - if sub.IsAvailableCommand() { - return true - } - } - - // the command either has no sub comamnds, or no available (non deprecated/help/hidden) - // sub commands - return false -} - -// HasParent determines if the command is a child command. -func (c *Command) HasParent() bool { - return c.parent != nil -} - -// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists. -func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName { - return c.globNormFunc -} - -// Flags returns the complete FlagSet that applies -// to this command (local and persistent declared here and by all parents). -func (c *Command) Flags() *flag.FlagSet { - if c.flags == nil { - c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - if c.flagErrorBuf == nil { - c.flagErrorBuf = new(bytes.Buffer) - } - c.flags.SetOutput(c.flagErrorBuf) - } - - return c.flags -} - -// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands. -func (c *Command) LocalNonPersistentFlags() *flag.FlagSet { - persistentFlags := c.PersistentFlags() - - out := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - c.LocalFlags().VisitAll(func(f *flag.Flag) { - if persistentFlags.Lookup(f.Name) == nil { - out.AddFlag(f) - } - }) - return out -} - -// LocalFlags returns the local FlagSet specifically set in the current command. -func (c *Command) LocalFlags() *flag.FlagSet { - c.mergePersistentFlags() - - if c.lflags == nil { - c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - if c.flagErrorBuf == nil { - c.flagErrorBuf = new(bytes.Buffer) - } - c.lflags.SetOutput(c.flagErrorBuf) - } - c.lflags.SortFlags = c.Flags().SortFlags - - addToLocal := func(f *flag.Flag) { - if c.lflags.Lookup(f.Name) == nil && c.parentsPflags.Lookup(f.Name) == nil { - c.lflags.AddFlag(f) - } - } - c.Flags().VisitAll(addToLocal) - c.PersistentFlags().VisitAll(addToLocal) - return c.lflags -} - -// InheritedFlags returns all flags which were inherited from parents commands. -func (c *Command) InheritedFlags() *flag.FlagSet { - c.mergePersistentFlags() - - if c.iflags == nil { - c.iflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - if c.flagErrorBuf == nil { - c.flagErrorBuf = new(bytes.Buffer) - } - c.iflags.SetOutput(c.flagErrorBuf) - } - - local := c.LocalFlags() - c.parentsPflags.VisitAll(func(f *flag.Flag) { - if c.iflags.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil { - c.iflags.AddFlag(f) - } - }) - return c.iflags -} - -// NonInheritedFlags returns all flags which were not inherited from parent commands. -func (c *Command) NonInheritedFlags() *flag.FlagSet { - return c.LocalFlags() -} - -// PersistentFlags returns the persistent FlagSet specifically set in the current command. -func (c *Command) PersistentFlags() *flag.FlagSet { - if c.pflags == nil { - c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - if c.flagErrorBuf == nil { - c.flagErrorBuf = new(bytes.Buffer) - } - c.pflags.SetOutput(c.flagErrorBuf) - } - return c.pflags -} - -// ResetFlags is used in testing. -func (c *Command) ResetFlags() { - c.flagErrorBuf = new(bytes.Buffer) - c.flagErrorBuf.Reset() - c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - c.flags.SetOutput(c.flagErrorBuf) - c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - c.pflags.SetOutput(c.flagErrorBuf) -} - -// HasFlags checks if the command contains any flags (local plus persistent from the entire structure). -func (c *Command) HasFlags() bool { - return c.Flags().HasFlags() -} - -// HasPersistentFlags checks if the command contains persistent flags. -func (c *Command) HasPersistentFlags() bool { - return c.PersistentFlags().HasFlags() -} - -// HasLocalFlags checks if the command has flags specifically declared locally. -func (c *Command) HasLocalFlags() bool { - return c.LocalFlags().HasFlags() -} - -// HasInheritedFlags checks if the command has flags inherited from its parent command. -func (c *Command) HasInheritedFlags() bool { - return c.InheritedFlags().HasFlags() -} - -// HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire -// structure) which are not hidden or deprecated. -func (c *Command) HasAvailableFlags() bool { - return c.Flags().HasAvailableFlags() -} - -// HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated. -func (c *Command) HasAvailablePersistentFlags() bool { - return c.PersistentFlags().HasAvailableFlags() -} - -// HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden -// or deprecated. -func (c *Command) HasAvailableLocalFlags() bool { - return c.LocalFlags().HasAvailableFlags() -} - -// HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are -// not hidden or deprecated. -func (c *Command) HasAvailableInheritedFlags() bool { - return c.InheritedFlags().HasAvailableFlags() -} - -// Flag climbs up the command tree looking for matching flag. -func (c *Command) Flag(name string) (flag *flag.Flag) { - flag = c.Flags().Lookup(name) - - if flag == nil { - flag = c.persistentFlag(name) - } - - return -} - -// Recursively find matching persistent flag. -func (c *Command) persistentFlag(name string) (flag *flag.Flag) { - if c.HasPersistentFlags() { - flag = c.PersistentFlags().Lookup(name) - } - - if flag == nil { - c.updateParentsPflags() - flag = c.parentsPflags.Lookup(name) - } - return -} - -// ParseFlags parses persistent flag tree and local flags. -func (c *Command) ParseFlags(args []string) (err error) { - if c.DisableFlagParsing { - return nil - } - c.mergePersistentFlags() - err = c.Flags().Parse(args) - return -} - -// Parent returns a commands parent command. -func (c *Command) Parent() *Command { - return c.parent -} - -// mergePersistentFlags merges c.PersistentFlags() to c.Flags() -// and adds missing persistent flags of all parents. -func (c *Command) mergePersistentFlags() { - c.updateParentsPflags() - c.Flags().AddFlagSet(c.PersistentFlags()) - c.Flags().AddFlagSet(c.parentsPflags) -} - -// updateParentsPflags updates c.parentsPflags by adding -// new persistent flags of all parents. -// If c.parentsPflags == nil, it makes new. -func (c *Command) updateParentsPflags() { - if c.parentsPflags == nil { - c.parentsPflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - c.parentsPflags.SetOutput(c.flagErrorBuf) - c.parentsPflags.SortFlags = false - } - - c.Root().PersistentFlags().AddFlagSet(flag.CommandLine) - - c.VisitParents(func(parent *Command) { - c.parentsPflags.AddFlagSet(parent.PersistentFlags()) - }) -} +// Copyright © 2013 Steve Francia . +// +// 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 cobra is a commander providing a simple interface to create powerful modern CLI interfaces. +// In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. +package cobra + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "sort" + "strings" + + flag "github.com/spf13/pflag" +) + +// Command is just that, a command for your application. +// E.g. 'go run ...' - 'run' is the command. Cobra requires +// you to define the usage and description as part of your command +// definition to ensure usability. +type Command struct { + // Use is the one-line usage message. + Use string + + // Aliases is an array of aliases that can be used instead of the first word in Use. + Aliases []string + + // SuggestFor is an array of command names for which this command will be suggested - + // similar to aliases but only suggests. + SuggestFor []string + + // Short is the short description shown in the 'help' output. + Short string + + // Long is the long message shown in the 'help ' output. + Long string + + // Example is examples of how to use the command. + Example string + + // ValidArgs is list of all valid non-flag arguments that are accepted in bash completions + ValidArgs []string + + // ArgAliases is List of aliases for ValidArgs. + // These are not suggested to the user in the bash completion, + // but accepted if entered manually. + ArgAliases []string + + // BashCompletionFunction is custom functions used by the bash autocompletion generator. + BashCompletionFunction string + + // Deprecated defines, if this command is deprecated and should print this string when used. + Deprecated string + + // Hidden defines, if this command is hidden and should NOT show up in the list of available commands. + Hidden bool + + // Annotations are key/value pairs that can be used by applications to identify or + // group commands. + Annotations map[string]string + + // The *Run functions are executed in the following order: + // * PersistentPreRun() + // * PreRun() + // * Run() + // * PostRun() + // * PersistentPostRun() + // All functions get the same args, the arguments after the command name. + // + // PersistentPreRun: children of this command will inherit and execute. + PersistentPreRun func(cmd *Command, args []string) + // PersistentPreRunE: PersistentPreRun but returns an error. + PersistentPreRunE func(cmd *Command, args []string) error + // PreRun: children of this command will not inherit. + PreRun func(cmd *Command, args []string) + // PreRunE: PreRun but returns an error. + PreRunE func(cmd *Command, args []string) error + // Run: Typically the actual work function. Most commands will only implement this. + Run func(cmd *Command, args []string) + // RunE: Run but returns an error. + RunE func(cmd *Command, args []string) error + // PostRun: run after the Run command. + PostRun func(cmd *Command, args []string) + // PostRunE: PostRun but returns an error. + PostRunE func(cmd *Command, args []string) error + // PersistentPostRun: children of this command will inherit and execute after PostRun. + PersistentPostRun func(cmd *Command, args []string) + // PersistentPostRunE: PersistentPostRun but returns an error. + PersistentPostRunE func(cmd *Command, args []string) error + + // SilenceErrors is an option to quiet errors down stream. + SilenceErrors bool + + // SilenceUsage is an option to silence usage when an error occurs. + SilenceUsage bool + + // DisableFlagParsing disables the flag parsing. + // If this is true all flags will be passed to the command as arguments. + DisableFlagParsing bool + + // DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...") + // will be printed by generating docs for this command. + DisableAutoGenTag bool + + // DisableSuggestions disables the suggestions based on Levenshtein distance + // that go along with 'unknown command' messages. + DisableSuggestions bool + // SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions. + // Must be > 0. + SuggestionsMinimumDistance int + + // name is the command name, usually the executable's name. + name string + // commands is the list of commands supported by this program. + commands []*Command + // parent is a parent command for this command. + parent *Command + // Max lengths of commands' string lengths for use in padding. + commandsMaxUseLen int + commandsMaxCommandPathLen int + commandsMaxNameLen int + // commandsAreSorted defines, if command slice are sorted or not. + commandsAreSorted bool + + // args is actual args parsed from flags. + args []string + // flagErrorBuf contains all error messages from pflag. + flagErrorBuf *bytes.Buffer + // flags is full set of flags. + flags *flag.FlagSet + // pflags contains persistent flags. + pflags *flag.FlagSet + // lflags contains local flags. + lflags *flag.FlagSet + // iflags contains inherited flags. + iflags *flag.FlagSet + // parentsPflags is all persistent flags of cmd's parents. + parentsPflags *flag.FlagSet + // globNormFunc is the global normalization function + // that we can use on every pflag set and children commands + globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName + + // output is an output writer defined by user. + output io.Writer + // usageFunc is usage func defined by user. + usageFunc func(*Command) error + // usageTemplate is usage template defined by user. + usageTemplate string + // flagErrorFunc is func defined by user and it's called when the parsing of + // flags returns an error. + flagErrorFunc func(*Command, error) error + // helpTemplate is help template defined by user. + helpTemplate string + // helpFunc is help func defined by user. + helpFunc func(*Command, []string) + // helpCommand is command with usage 'help'. If it's not defined by user, + // cobra uses default help command. + helpCommand *Command +} + +// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden +// particularly useful when testing. +func (c *Command) SetArgs(a []string) { + c.args = a +} + +// SetOutput sets the destination for usage and error messages. +// If output is nil, os.Stderr is used. +func (c *Command) SetOutput(output io.Writer) { + c.output = output +} + +// SetUsageFunc sets usage function. Usage can be defined by application. +func (c *Command) SetUsageFunc(f func(*Command) error) { + c.usageFunc = f +} + +// SetUsageTemplate sets usage template. Can be defined by Application. +func (c *Command) SetUsageTemplate(s string) { + c.usageTemplate = s +} + +// SetFlagErrorFunc sets a function to generate an error when flag parsing +// fails. +func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) { + c.flagErrorFunc = f +} + +// SetHelpFunc sets help function. Can be defined by Application. +func (c *Command) SetHelpFunc(f func(*Command, []string)) { + c.helpFunc = f +} + +// SetHelpCommand sets help command. +func (c *Command) SetHelpCommand(cmd *Command) { + c.helpCommand = cmd +} + +// SetHelpTemplate sets help template to be used. Application can use it to set custom template. +func (c *Command) SetHelpTemplate(s string) { + c.helpTemplate = s +} + +// SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. +// The user should not have a cyclic dependency on commands. +func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) { + c.Flags().SetNormalizeFunc(n) + c.PersistentFlags().SetNormalizeFunc(n) + c.globNormFunc = n + + for _, command := range c.commands { + command.SetGlobalNormalizationFunc(n) + } +} + +// OutOrStdout returns output to stdout. +func (c *Command) OutOrStdout() io.Writer { + return c.getOut(os.Stdout) +} + +// OutOrStderr returns output to stderr +func (c *Command) OutOrStderr() io.Writer { + return c.getOut(os.Stderr) +} + +func (c *Command) getOut(def io.Writer) io.Writer { + if c.output != nil { + return c.output + } + if c.HasParent() { + return c.parent.getOut(def) + } + return def +} + +// UsageFunc returns either the function set by SetUsageFunc for this command +// or a parent, or it returns a default usage function. +func (c *Command) UsageFunc() (f func(*Command) error) { + if c.usageFunc != nil { + return c.usageFunc + } + if c.HasParent() { + return c.Parent().UsageFunc() + } + return func(c *Command) error { + c.mergePersistentFlags() + err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c) + if err != nil { + c.Println(err) + } + return err + } +} + +// Usage puts out the usage for the command. +// Used when a user provides invalid input. +// Can be defined by user by overriding UsageFunc. +func (c *Command) Usage() error { + return c.UsageFunc()(c) +} + +// HelpFunc returns either the function set by SetHelpFunc for this command +// or a parent, or it returns a function with default help behavior. +func (c *Command) HelpFunc() func(*Command, []string) { + if c.helpFunc != nil { + return c.helpFunc + } + if c.HasParent() { + return c.Parent().HelpFunc() + } + return func(c *Command, a []string) { + c.mergePersistentFlags() + err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c) + if err != nil { + c.Println(err) + } + } +} + +// Help puts out the help for the command. +// Used when a user calls help [command]. +// Can be defined by user by overriding HelpFunc. +func (c *Command) Help() error { + c.HelpFunc()(c, []string{}) + return nil +} + +// UsageString return usage string. +func (c *Command) UsageString() string { + tmpOutput := c.output + bb := new(bytes.Buffer) + c.SetOutput(bb) + c.Usage() + c.output = tmpOutput + return bb.String() +} + +// FlagErrorFunc returns either the function set by SetFlagErrorFunc for this +// command or a parent, or it returns a function which returns the original +// error. +func (c *Command) FlagErrorFunc() (f func(*Command, error) error) { + if c.flagErrorFunc != nil { + return c.flagErrorFunc + } + + if c.HasParent() { + return c.parent.FlagErrorFunc() + } + return func(c *Command, err error) error { + return err + } +} + +var minUsagePadding = 25 + +// UsagePadding return padding for the usage. +func (c *Command) UsagePadding() int { + if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen { + return minUsagePadding + } + return c.parent.commandsMaxUseLen +} + +var minCommandPathPadding = 11 + +// CommandPathPadding return padding for the command path. +func (c *Command) CommandPathPadding() int { + if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen { + return minCommandPathPadding + } + return c.parent.commandsMaxCommandPathLen +} + +var minNamePadding = 11 + +// NamePadding returns padding for the name. +func (c *Command) NamePadding() int { + if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen { + return minNamePadding + } + return c.parent.commandsMaxNameLen +} + +// UsageTemplate returns usage template for the command. +func (c *Command) UsageTemplate() string { + if c.usageTemplate != "" { + return c.usageTemplate + } + + if c.HasParent() { + return c.parent.UsageTemplate() + } + return `Usage:{{if .Runnable}} + {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} + {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} + +Aliases: + {{.NameAndAliases}}{{end}}{{if .HasExample}} + +Examples: +{{.Example}}{{end}}{{if .HasAvailableSubCommands}} + +Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} + {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} + +Flags: +{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} + +Global Flags: +{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}} + +Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} + {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}} + +Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}} +` +} + +// HelpTemplate return help template for the command. +func (c *Command) HelpTemplate() string { + if c.helpTemplate != "" { + return c.helpTemplate + } + + if c.HasParent() { + return c.parent.HelpTemplate() + } + return `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} + +{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}` +} + +func hasNoOptDefVal(name string, fs *flag.FlagSet) bool { + flag := fs.Lookup(name) + if flag == nil { + return false + } + return flag.NoOptDefVal != "" +} + +func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool { + if len(name) == 0 { + return false + } + + flag := fs.ShorthandLookup(name[:1]) + if flag == nil { + return false + } + return flag.NoOptDefVal != "" +} + +func stripFlags(args []string, c *Command) []string { + if len(args) == 0 { + return args + } + c.mergePersistentFlags() + + commands := []string{} + flags := c.Flags() + +Loop: + for len(args) > 0 { + s := args[0] + args = args[1:] + switch { + case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags): + // If '--flag arg' then + // delete arg from args. + fallthrough // (do the same as below) + case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags): + // If '-f arg' then + // delete 'arg' from args or break the loop if len(args) <= 1. + if len(args) <= 1 { + break Loop + } else { + args = args[1:] + continue + } + case s != "" && !strings.HasPrefix(s, "-"): + commands = append(commands, s) + } + } + + return commands +} + +// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like +// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]). +func argsMinusFirstX(args []string, x string) []string { + for i, y := range args { + if x == y { + ret := []string{} + ret = append(ret, args[:i]...) + ret = append(ret, args[i+1:]...) + return ret + } + } + return args +} + +// Find the target command given the args and command tree +// Meant to be run on the highest node. Only searches down. +func (c *Command) Find(args []string) (*Command, []string, error) { + if c == nil { + return nil, nil, fmt.Errorf("Called find() on a nil Command") + } + + var innerfind func(*Command, []string) (*Command, []string) + + innerfind = func(c *Command, innerArgs []string) (*Command, []string) { + argsWOflags := stripFlags(innerArgs, c) + if len(argsWOflags) == 0 { + return c, innerArgs + } + nextSubCmd := argsWOflags[0] + matches := make([]*Command, 0) + for _, cmd := range c.commands { + if cmd.Name() == nextSubCmd || cmd.HasAlias(nextSubCmd) { // exact name or alias match + return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd)) + } + if EnablePrefixMatching { + if strings.HasPrefix(cmd.Name(), nextSubCmd) { // prefix match + matches = append(matches, cmd) + } + for _, x := range cmd.Aliases { + if strings.HasPrefix(x, nextSubCmd) { + matches = append(matches, cmd) + } + } + } + } + + // only accept a single prefix match - multiple matches would be ambiguous + if len(matches) == 1 { + return innerfind(matches[0], argsMinusFirstX(innerArgs, argsWOflags[0])) + } + + return c, innerArgs + } + + commandFound, a := innerfind(c, args) + argsWOflags := stripFlags(a, commandFound) + + // no subcommand, always take args + if !commandFound.HasSubCommands() { + return commandFound, a, nil + } + + // root command with subcommands, do subcommand checking + if commandFound == c && len(argsWOflags) > 0 { + suggestionsString := "" + if !c.DisableSuggestions { + if c.SuggestionsMinimumDistance <= 0 { + c.SuggestionsMinimumDistance = 2 + } + if suggestions := c.SuggestionsFor(argsWOflags[0]); len(suggestions) > 0 { + suggestionsString += "\n\nDid you mean this?\n" + for _, s := range suggestions { + suggestionsString += fmt.Sprintf("\t%v\n", s) + } + } + } + return commandFound, a, fmt.Errorf("unknown command %q for %q%s", argsWOflags[0], commandFound.CommandPath(), suggestionsString) + } + + return commandFound, a, nil +} + +// SuggestionsFor provides suggestions for the typedName. +func (c *Command) SuggestionsFor(typedName string) []string { + suggestions := []string{} + for _, cmd := range c.commands { + if cmd.IsAvailableCommand() { + levenshteinDistance := ld(typedName, cmd.Name(), true) + suggestByLevenshtein := levenshteinDistance <= c.SuggestionsMinimumDistance + suggestByPrefix := strings.HasPrefix(strings.ToLower(cmd.Name()), strings.ToLower(typedName)) + if suggestByLevenshtein || suggestByPrefix { + suggestions = append(suggestions, cmd.Name()) + } + for _, explicitSuggestion := range cmd.SuggestFor { + if strings.EqualFold(typedName, explicitSuggestion) { + suggestions = append(suggestions, cmd.Name()) + } + } + } + } + return suggestions +} + +// VisitParents visits all parents of the command and invokes fn on each parent. +func (c *Command) VisitParents(fn func(*Command)) { + if c.HasParent() { + fn(c.Parent()) + c.Parent().VisitParents(fn) + } +} + +// Root finds root command. +func (c *Command) Root() *Command { + if c.HasParent() { + return c.Parent().Root() + } + return c +} + +// ArgsLenAtDash will return the length of f.Args at the moment when a -- was +// found during arg parsing. This allows your program to know which args were +// before the -- and which came after. (Description from +// https://godoc.org/github.com/spf13/pflag#FlagSet.ArgsLenAtDash). +func (c *Command) ArgsLenAtDash() int { + return c.Flags().ArgsLenAtDash() +} + +func (c *Command) execute(a []string) (err error) { + if c == nil { + return fmt.Errorf("Called Execute() on a nil Command") + } + + if len(c.Deprecated) > 0 { + c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated) + } + + // initialize help flag as the last point possible to allow for user + // overriding + c.InitDefaultHelpFlag() + + err = c.ParseFlags(a) + if err != nil { + return c.FlagErrorFunc()(c, err) + } + + // If help is called, regardless of other flags, return we want help. + // Also say we need help if the command isn't runnable. + helpVal, err := c.Flags().GetBool("help") + if err != nil { + // should be impossible to get here as we always declare a help + // flag in InitDefaultHelpFlag() + c.Println("\"help\" flag declared as non-bool. Please correct your code") + return err + } + + if helpVal || !c.Runnable() { + return flag.ErrHelp + } + + c.preRun() + + argWoFlags := c.Flags().Args() + if c.DisableFlagParsing { + argWoFlags = a + } + + for p := c; p != nil; p = p.Parent() { + if p.PersistentPreRunE != nil { + if err := p.PersistentPreRunE(c, argWoFlags); err != nil { + return err + } + break + } else if p.PersistentPreRun != nil { + p.PersistentPreRun(c, argWoFlags) + break + } + } + if c.PreRunE != nil { + if err := c.PreRunE(c, argWoFlags); err != nil { + return err + } + } else if c.PreRun != nil { + c.PreRun(c, argWoFlags) + } + + if c.RunE != nil { + if err := c.RunE(c, argWoFlags); err != nil { + return err + } + } else { + c.Run(c, argWoFlags) + } + if c.PostRunE != nil { + if err := c.PostRunE(c, argWoFlags); err != nil { + return err + } + } else if c.PostRun != nil { + c.PostRun(c, argWoFlags) + } + for p := c; p != nil; p = p.Parent() { + if p.PersistentPostRunE != nil { + if err := p.PersistentPostRunE(c, argWoFlags); err != nil { + return err + } + break + } else if p.PersistentPostRun != nil { + p.PersistentPostRun(c, argWoFlags) + break + } + } + + return nil +} + +func (c *Command) preRun() { + for _, x := range initializers { + x() + } +} + +// Execute Call execute to use the args (os.Args[1:] by default) +// and run through the command tree finding appropriate matches +// for commands and then corresponding flags. +func (c *Command) Execute() error { + _, err := c.ExecuteC() + return err +} + +// ExecuteC executes the command. +func (c *Command) ExecuteC() (cmd *Command, err error) { + // Regardless of what command execute is called on, run on Root only + if c.HasParent() { + return c.Root().ExecuteC() + } + + // windows hook + if preExecHookFn != nil { + preExecHookFn(c) + } + + // initialize help as the last point possible to allow for user + // overriding + c.initHelpCmd() + + var args []string + + // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155 + if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" { + args = os.Args[1:] + } else { + args = c.args + } + + cmd, flags, err := c.Find(args) + if err != nil { + // If found parse to a subcommand and then failed, talk about the subcommand + if cmd != nil { + c = cmd + } + if !c.SilenceErrors { + c.Println("Error:", err.Error()) + c.Printf("Run '%v --help' for usage.\n", c.CommandPath()) + } + return c, err + } + err = cmd.execute(flags) + if err != nil { + // Always show help if requested, even if SilenceErrors is in + // effect + if err == flag.ErrHelp { + cmd.HelpFunc()(cmd, args) + return cmd, nil + } + + // If root command has SilentErrors flagged, + // all subcommands should respect it + if !cmd.SilenceErrors && !c.SilenceErrors { + c.Println("Error:", err.Error()) + } + + // If root command has SilentUsage flagged, + // all subcommands should respect it + if !cmd.SilenceUsage && !c.SilenceUsage { + c.Println(cmd.UsageString()) + } + return cmd, err + } + return cmd, nil +} + +// InitDefaultHelpFlag adds default help flag to c. +// It is called automatically by executing the c or by calling help and usage. +// If c already has help flag, it will do nothing. +func (c *Command) InitDefaultHelpFlag() { + c.mergePersistentFlags() + if c.Flags().Lookup("help") == nil { + usage := "help for " + if c.Name() == "" { + usage += "this command" + } else { + usage += c.Name() + } + c.Flags().BoolP("help", "h", false, usage) + } +} + +func (c *Command) initHelpCmd() { + if c.helpCommand == nil { + if !c.HasSubCommands() { + return + } + + c.helpCommand = &Command{ + Use: "help [command]", + Short: "Help about any command", + Long: `Help provides help for any command in the application. + Simply type ` + c.Name() + ` help [path to command] for full details.`, + PersistentPreRun: func(cmd *Command, args []string) {}, + PersistentPostRun: func(cmd *Command, args []string) {}, + + Run: func(c *Command, args []string) { + cmd, _, e := c.Root().Find(args) + if cmd == nil || e != nil { + c.Printf("Unknown help topic %#q\n", args) + c.Root().Usage() + } else { + cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown + cmd.Help() + } + }, + } + } + c.RemoveCommand(c.helpCommand) + c.AddCommand(c.helpCommand) +} + +// ResetCommands used for testing. +func (c *Command) ResetCommands() { + c.commands = nil + c.helpCommand = nil + c.parentsPflags = nil +} + +// Sorts commands by their names. +type commandSorterByName []*Command + +func (c commandSorterByName) Len() int { return len(c) } +func (c commandSorterByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] } +func (c commandSorterByName) Less(i, j int) bool { return c[i].Name() < c[j].Name() } + +// Commands returns a sorted slice of child commands. +func (c *Command) Commands() []*Command { + // do not sort commands if it already sorted or sorting was disabled + if EnableCommandSorting && !c.commandsAreSorted { + sort.Sort(commandSorterByName(c.commands)) + c.commandsAreSorted = true + } + return c.commands +} + +// AddCommand adds one or more commands to this parent command. +func (c *Command) AddCommand(cmds ...*Command) { + for i, x := range cmds { + if cmds[i] == c { + panic("Command can't be a child of itself") + } + cmds[i].parent = c + // update max lengths + usageLen := len(x.Use) + if usageLen > c.commandsMaxUseLen { + c.commandsMaxUseLen = usageLen + } + commandPathLen := len(x.CommandPath()) + if commandPathLen > c.commandsMaxCommandPathLen { + c.commandsMaxCommandPathLen = commandPathLen + } + nameLen := len(x.Name()) + if nameLen > c.commandsMaxNameLen { + c.commandsMaxNameLen = nameLen + } + // If global normalization function exists, update all children + if c.globNormFunc != nil { + x.SetGlobalNormalizationFunc(c.globNormFunc) + } + c.commands = append(c.commands, x) + c.commandsAreSorted = false + } +} + +// RemoveCommand removes one or more commands from a parent command. +func (c *Command) RemoveCommand(cmds ...*Command) { + commands := []*Command{} +main: + for _, command := range c.commands { + for _, cmd := range cmds { + if command == cmd { + command.parent = nil + continue main + } + } + commands = append(commands, command) + } + c.commands = commands + // recompute all lengths + c.commandsMaxUseLen = 0 + c.commandsMaxCommandPathLen = 0 + c.commandsMaxNameLen = 0 + for _, command := range c.commands { + usageLen := len(command.Use) + if usageLen > c.commandsMaxUseLen { + c.commandsMaxUseLen = usageLen + } + commandPathLen := len(command.CommandPath()) + if commandPathLen > c.commandsMaxCommandPathLen { + c.commandsMaxCommandPathLen = commandPathLen + } + nameLen := len(command.Name()) + if nameLen > c.commandsMaxNameLen { + c.commandsMaxNameLen = nameLen + } + } +} + +// Print is a convenience method to Print to the defined output, fallback to Stderr if not set. +func (c *Command) Print(i ...interface{}) { + fmt.Fprint(c.OutOrStderr(), i...) +} + +// Println is a convenience method to Println to the defined output, fallback to Stderr if not set. +func (c *Command) Println(i ...interface{}) { + c.Print(fmt.Sprintln(i...)) +} + +// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set. +func (c *Command) Printf(format string, i ...interface{}) { + c.Print(fmt.Sprintf(format, i...)) +} + +// CommandPath returns the full path to this command. +func (c *Command) CommandPath() string { + if c.HasParent() { + return c.Parent().CommandPath() + " " + c.Name() + } + return c.Name() +} + +// UseLine puts out the full usage for a given command (including parents). +func (c *Command) UseLine() string { + var useline string + if c.HasParent() { + useline = c.parent.CommandPath() + " " + c.Use + } else { + useline = c.Use + } + if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") { + useline += " [flags]" + } + return useline +} + +// DebugFlags used to determine which flags have been assigned to which commands +// and which persist. +func (c *Command) DebugFlags() { + c.Println("DebugFlags called on", c.Name()) + var debugflags func(*Command) + + debugflags = func(x *Command) { + if x.HasFlags() || x.HasPersistentFlags() { + c.Println(x.Name()) + } + if x.HasFlags() { + x.flags.VisitAll(func(f *flag.Flag) { + if x.HasPersistentFlags() && x.persistentFlag(f.Name) != nil { + c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]") + } else { + c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]") + } + }) + } + if x.HasPersistentFlags() { + x.pflags.VisitAll(func(f *flag.Flag) { + if x.HasFlags() { + if x.flags.Lookup(f.Name) == nil { + c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]") + } + } else { + c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]") + } + }) + } + c.Println(x.flagErrorBuf) + if x.HasSubCommands() { + for _, y := range x.commands { + debugflags(y) + } + } + } + + debugflags(c) +} + +// Name returns the command's name: the first word in the use line. +func (c *Command) Name() string { + if c.name == "" { + name := c.Use + i := strings.Index(name, " ") + if i >= 0 { + name = name[:i] + } + c.name = name + } + return c.name +} + +// HasAlias determines if a given string is an alias of the command. +func (c *Command) HasAlias(s string) bool { + for _, a := range c.Aliases { + if a == s { + return true + } + } + return false +} + +// NameAndAliases returns string containing name and all aliases +func (c *Command) NameAndAliases() string { + return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ") +} + +// HasExample determines if the command has example. +func (c *Command) HasExample() bool { + return len(c.Example) > 0 +} + +// Runnable determines if the command is itself runnable. +func (c *Command) Runnable() bool { + return c.Run != nil || c.RunE != nil +} + +// HasSubCommands determines if the command has children commands. +func (c *Command) HasSubCommands() bool { + return len(c.commands) > 0 +} + +// IsAvailableCommand determines if a command is available as a non-help command +// (this includes all non deprecated/hidden commands). +func (c *Command) IsAvailableCommand() bool { + if len(c.Deprecated) != 0 || c.Hidden { + return false + } + + if c.HasParent() && c.Parent().helpCommand == c { + return false + } + + if c.Runnable() || c.HasAvailableSubCommands() { + return true + } + + return false +} + +// IsAdditionalHelpTopicCommand determines if a command is an additional +// help topic command; additional help topic command is determined by the +// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that +// are runnable/hidden/deprecated. +// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924. +func (c *Command) IsAdditionalHelpTopicCommand() bool { + // if a command is runnable, deprecated, or hidden it is not a 'help' command + if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden { + return false + } + + // if any non-help sub commands are found, the command is not a 'help' command + for _, sub := range c.commands { + if !sub.IsAdditionalHelpTopicCommand() { + return false + } + } + + // the command either has no sub commands, or no non-help sub commands + return true +} + +// HasHelpSubCommands determines if a command has any available 'help' sub commands +// that need to be shown in the usage/help default template under 'additional help +// topics'. +func (c *Command) HasHelpSubCommands() bool { + // return true on the first found available 'help' sub command + for _, sub := range c.commands { + if sub.IsAdditionalHelpTopicCommand() { + return true + } + } + + // the command either has no sub commands, or no available 'help' sub commands + return false +} + +// HasAvailableSubCommands determines if a command has available sub commands that +// need to be shown in the usage/help default template under 'available commands'. +func (c *Command) HasAvailableSubCommands() bool { + // return true on the first found available (non deprecated/help/hidden) + // sub command + for _, sub := range c.commands { + if sub.IsAvailableCommand() { + return true + } + } + + // the command either has no sub comamnds, or no available (non deprecated/help/hidden) + // sub commands + return false +} + +// HasParent determines if the command is a child command. +func (c *Command) HasParent() bool { + return c.parent != nil +} + +// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists. +func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName { + return c.globNormFunc +} + +// Flags returns the complete FlagSet that applies +// to this command (local and persistent declared here and by all parents). +func (c *Command) Flags() *flag.FlagSet { + if c.flags == nil { + c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + c.flags.SetOutput(c.flagErrorBuf) + } + + return c.flags +} + +// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands. +func (c *Command) LocalNonPersistentFlags() *flag.FlagSet { + persistentFlags := c.PersistentFlags() + + out := flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.LocalFlags().VisitAll(func(f *flag.Flag) { + if persistentFlags.Lookup(f.Name) == nil { + out.AddFlag(f) + } + }) + return out +} + +// LocalFlags returns the local FlagSet specifically set in the current command. +func (c *Command) LocalFlags() *flag.FlagSet { + c.mergePersistentFlags() + + if c.lflags == nil { + c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + c.lflags.SetOutput(c.flagErrorBuf) + } + c.lflags.SortFlags = c.Flags().SortFlags + + addToLocal := func(f *flag.Flag) { + if c.lflags.Lookup(f.Name) == nil && c.parentsPflags.Lookup(f.Name) == nil { + c.lflags.AddFlag(f) + } + } + c.Flags().VisitAll(addToLocal) + c.PersistentFlags().VisitAll(addToLocal) + return c.lflags +} + +// InheritedFlags returns all flags which were inherited from parents commands. +func (c *Command) InheritedFlags() *flag.FlagSet { + c.mergePersistentFlags() + + if c.iflags == nil { + c.iflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + c.iflags.SetOutput(c.flagErrorBuf) + } + + local := c.LocalFlags() + c.parentsPflags.VisitAll(func(f *flag.Flag) { + if c.iflags.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil { + c.iflags.AddFlag(f) + } + }) + return c.iflags +} + +// NonInheritedFlags returns all flags which were not inherited from parent commands. +func (c *Command) NonInheritedFlags() *flag.FlagSet { + return c.LocalFlags() +} + +// PersistentFlags returns the persistent FlagSet specifically set in the current command. +func (c *Command) PersistentFlags() *flag.FlagSet { + if c.pflags == nil { + c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + c.pflags.SetOutput(c.flagErrorBuf) + } + return c.pflags +} + +// ResetFlags is used in testing. +func (c *Command) ResetFlags() { + c.flagErrorBuf = new(bytes.Buffer) + c.flagErrorBuf.Reset() + c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.flags.SetOutput(c.flagErrorBuf) + c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.pflags.SetOutput(c.flagErrorBuf) +} + +// HasFlags checks if the command contains any flags (local plus persistent from the entire structure). +func (c *Command) HasFlags() bool { + return c.Flags().HasFlags() +} + +// HasPersistentFlags checks if the command contains persistent flags. +func (c *Command) HasPersistentFlags() bool { + return c.PersistentFlags().HasFlags() +} + +// HasLocalFlags checks if the command has flags specifically declared locally. +func (c *Command) HasLocalFlags() bool { + return c.LocalFlags().HasFlags() +} + +// HasInheritedFlags checks if the command has flags inherited from its parent command. +func (c *Command) HasInheritedFlags() bool { + return c.InheritedFlags().HasFlags() +} + +// HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire +// structure) which are not hidden or deprecated. +func (c *Command) HasAvailableFlags() bool { + return c.Flags().HasAvailableFlags() +} + +// HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated. +func (c *Command) HasAvailablePersistentFlags() bool { + return c.PersistentFlags().HasAvailableFlags() +} + +// HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden +// or deprecated. +func (c *Command) HasAvailableLocalFlags() bool { + return c.LocalFlags().HasAvailableFlags() +} + +// HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are +// not hidden or deprecated. +func (c *Command) HasAvailableInheritedFlags() bool { + return c.InheritedFlags().HasAvailableFlags() +} + +// Flag climbs up the command tree looking for matching flag. +func (c *Command) Flag(name string) (flag *flag.Flag) { + flag = c.Flags().Lookup(name) + + if flag == nil { + flag = c.persistentFlag(name) + } + + return +} + +// Recursively find matching persistent flag. +func (c *Command) persistentFlag(name string) (flag *flag.Flag) { + if c.HasPersistentFlags() { + flag = c.PersistentFlags().Lookup(name) + } + + if flag == nil { + c.updateParentsPflags() + flag = c.parentsPflags.Lookup(name) + } + return +} + +// ParseFlags parses persistent flag tree and local flags. +func (c *Command) ParseFlags(args []string) (err error) { + if c.DisableFlagParsing { + return nil + } + c.mergePersistentFlags() + err = c.Flags().Parse(args) + return +} + +// Parent returns a commands parent command. +func (c *Command) Parent() *Command { + return c.parent +} + +// mergePersistentFlags merges c.PersistentFlags() to c.Flags() +// and adds missing persistent flags of all parents. +func (c *Command) mergePersistentFlags() { + c.updateParentsPflags() + c.Flags().AddFlagSet(c.PersistentFlags()) + c.Flags().AddFlagSet(c.parentsPflags) +} + +// updateParentsPflags updates c.parentsPflags by adding +// new persistent flags of all parents. +// If c.parentsPflags == nil, it makes new. +func (c *Command) updateParentsPflags() { + if c.parentsPflags == nil { + c.parentsPflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.parentsPflags.SetOutput(c.flagErrorBuf) + c.parentsPflags.SortFlags = false + } + + c.Root().PersistentFlags().AddFlagSet(flag.CommandLine) + + c.VisitParents(func(parent *Command) { + c.parentsPflags.AddFlagSet(parent.PersistentFlags()) + }) +} diff --git a/vendor/github.com/spf13/cobra/command_notwin.go b/vendor/github.com/spf13/cobra/command_notwin.go index 3b005d6a7a..6159c1cc19 100644 --- a/vendor/github.com/spf13/cobra/command_notwin.go +++ b/vendor/github.com/spf13/cobra/command_notwin.go @@ -1,5 +1,5 @@ -// +build !windows - -package cobra - -var preExecHookFn func(*Command) +// +build !windows + +package cobra + +var preExecHookFn func(*Command) diff --git a/vendor/github.com/spf13/cobra/command_test.go b/vendor/github.com/spf13/cobra/command_test.go index ee731e7af7..978bacc529 100644 --- a/vendor/github.com/spf13/cobra/command_test.go +++ b/vendor/github.com/spf13/cobra/command_test.go @@ -1,300 +1,300 @@ -package cobra - -import ( - "bytes" - "fmt" - "os" - "reflect" - "strings" - "testing" - - "github.com/spf13/pflag" -) - -// test to ensure hidden commands run as intended -func TestHiddenCommandExecutes(t *testing.T) { - - // ensure that outs does not already equal what the command will be setting it - // to, if it did this test would not actually be testing anything... - if outs == "hidden" { - t.Errorf("outs should NOT EQUAL hidden") - } - - cmdHidden.Execute() - - // upon running the command, the value of outs should now be 'hidden' - if outs != "hidden" { - t.Errorf("Hidden command failed to run!") - } -} - -// test to ensure hidden commands do not show up in usage/help text -func TestHiddenCommandIsHidden(t *testing.T) { - if cmdHidden.IsAvailableCommand() { - t.Errorf("Hidden command found!") - } -} - -func TestStripFlags(t *testing.T) { - tests := []struct { - input []string - output []string - }{ - { - []string{"foo", "bar"}, - []string{"foo", "bar"}, - }, - { - []string{"foo", "--bar", "-b"}, - []string{"foo"}, - }, - { - []string{"-b", "foo", "--bar", "bar"}, - []string{}, - }, - { - []string{"-i10", "echo"}, - []string{"echo"}, - }, - { - []string{"-i=10", "echo"}, - []string{"echo"}, - }, - { - []string{"--int=100", "echo"}, - []string{"echo"}, - }, - { - []string{"-ib", "echo", "-bfoo", "baz"}, - []string{"echo", "baz"}, - }, - { - []string{"-i=baz", "bar", "-i", "foo", "blah"}, - []string{"bar", "blah"}, - }, - { - []string{"--int=baz", "-bbar", "-i", "foo", "blah"}, - []string{"blah"}, - }, - { - []string{"--cat", "bar", "-i", "foo", "blah"}, - []string{"bar", "blah"}, - }, - { - []string{"-c", "bar", "-i", "foo", "blah"}, - []string{"bar", "blah"}, - }, - { - []string{"--persist", "bar"}, - []string{"bar"}, - }, - { - []string{"-p", "bar"}, - []string{"bar"}, - }, - } - - cmdPrint := &Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `an utterly useless command for testing.`, - Run: func(cmd *Command, args []string) { - tp = args - }, - } - - var flagi int - var flagstr string - var flagbool bool - cmdPrint.PersistentFlags().BoolVarP(&flagbool, "persist", "p", false, "help for persistent one") - cmdPrint.Flags().IntVarP(&flagi, "int", "i", 345, "help message for flag int") - cmdPrint.Flags().StringVarP(&flagstr, "bar", "b", "bar", "help message for flag string") - cmdPrint.Flags().BoolVarP(&flagbool, "cat", "c", false, "help message for flag bool") - - for _, test := range tests { - output := stripFlags(test.input, cmdPrint) - if !reflect.DeepEqual(test.output, output) { - t.Errorf("expected: %v, got: %v", test.output, output) - } - } -} - -func TestDisableFlagParsing(t *testing.T) { - as := []string{"-v", "-race", "-file", "foo.go"} - targs := []string{} - cmdPrint := &Command{ - DisableFlagParsing: true, - Run: func(cmd *Command, args []string) { - targs = args - }, - } - osargs := []string{"cmd"} - os.Args = append(osargs, as...) - err := cmdPrint.Execute() - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(as, targs) { - t.Errorf("expected: %v, got: %v", as, targs) - } -} - -func TestInitHelpFlagMergesFlags(t *testing.T) { - usage := "custom flag" - baseCmd := Command{Use: "testcmd"} - baseCmd.PersistentFlags().Bool("help", false, usage) - cmd := Command{Use: "do"} - baseCmd.AddCommand(&cmd) - - cmd.InitDefaultHelpFlag() - actual := cmd.Flags().Lookup("help").Usage - if actual != usage { - t.Fatalf("Expected the help flag from the base command with usage '%s', but got the default with usage '%s'", usage, actual) - } -} - -func TestCommandsAreSorted(t *testing.T) { - EnableCommandSorting = true - - originalNames := []string{"middle", "zlast", "afirst"} - expectedNames := []string{"afirst", "middle", "zlast"} - - var tmpCommand = &Command{Use: "tmp"} - - for _, name := range originalNames { - tmpCommand.AddCommand(&Command{Use: name}) - } - - for i, c := range tmpCommand.Commands() { - if expectedNames[i] != c.Name() { - t.Errorf("expected: %s, got: %s", expectedNames[i], c.Name()) - } - } - - EnableCommandSorting = true -} - -func TestEnableCommandSortingIsDisabled(t *testing.T) { - EnableCommandSorting = false - - originalNames := []string{"middle", "zlast", "afirst"} - - var tmpCommand = &Command{Use: "tmp"} - - for _, name := range originalNames { - tmpCommand.AddCommand(&Command{Use: name}) - } - - for i, c := range tmpCommand.Commands() { - if originalNames[i] != c.Name() { - t.Errorf("expected: %s, got: %s", originalNames[i], c.Name()) - } - } - - EnableCommandSorting = true -} - -func TestSetOutput(t *testing.T) { - cmd := &Command{} - cmd.SetOutput(nil) - if out := cmd.OutOrStdout(); out != os.Stdout { - t.Fatalf("expected setting output to nil to revert back to stdout, got %v", out) - } -} - -func TestFlagErrorFunc(t *testing.T) { - cmd := &Command{ - Use: "print", - RunE: func(cmd *Command, args []string) error { - return nil - }, - } - expectedFmt := "This is expected: %s" - - cmd.SetFlagErrorFunc(func(c *Command, err error) error { - return fmt.Errorf(expectedFmt, err) - }) - cmd.SetArgs([]string{"--bogus-flag"}) - cmd.SetOutput(new(bytes.Buffer)) - - err := cmd.Execute() - - expected := fmt.Sprintf(expectedFmt, "unknown flag: --bogus-flag") - if err.Error() != expected { - t.Errorf("expected %v, got %v", expected, err.Error()) - } -} - -// TestSortedFlags checks, -// if cmd.LocalFlags() is unsorted when cmd.Flags().SortFlags set to false. -// Related to https://github.com/spf13/cobra/issues/404. -func TestSortedFlags(t *testing.T) { - cmd := &Command{} - cmd.Flags().SortFlags = false - names := []string{"C", "B", "A", "D"} - for _, name := range names { - cmd.Flags().Bool(name, false, "") - } - - i := 0 - cmd.LocalFlags().VisitAll(func(f *pflag.Flag) { - if i == len(names) { - return - } - if isStringInStringSlice(f.Name, names) { - if names[i] != f.Name { - t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name) - } - i++ - } - }) -} - -// contains checks, if s is in ss. -func isStringInStringSlice(s string, ss []string) bool { - for _, v := range ss { - if v == s { - return true - } - } - return false -} - -// TestHelpFlagInHelp checks, -// if '--help' flag is shown in help for child (executing `parent help child`), -// that has no other flags. -// Related to https://github.com/spf13/cobra/issues/302. -func TestHelpFlagInHelp(t *testing.T) { - output := new(bytes.Buffer) - parent := &Command{Use: "parent", Run: func(*Command, []string) {}} - parent.SetOutput(output) - - child := &Command{Use: "child", Run: func(*Command, []string) {}} - parent.AddCommand(child) - - parent.SetArgs([]string{"help", "child"}) - err := parent.Execute() - if err != nil { - t.Fatal(err) - } - - if !strings.Contains(output.String(), "[flags]") { - t.Errorf("\nExpecting to contain: %v\nGot: %v", "[flags]", output.String()) - } -} - -// TestMergeCommandLineToFlags checks, -// if pflag.CommandLine is correctly merged to c.Flags() after first call -// of c.mergePersistentFlags. -// Related to https://github.com/spf13/cobra/issues/443. -func TestMergeCommandLineToFlags(t *testing.T) { - pflag.Bool("boolflag", false, "") - c := &Command{Use: "c", Run: func(*Command, []string) {}} - c.mergePersistentFlags() - if c.Flags().Lookup("boolflag") == nil { - t.Fatal("Expecting to have flag from CommandLine in c.Flags()") - } - - // Reset pflag.CommandLine flagset. - pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ExitOnError) -} +package cobra + +import ( + "bytes" + "fmt" + "os" + "reflect" + "strings" + "testing" + + "github.com/spf13/pflag" +) + +// test to ensure hidden commands run as intended +func TestHiddenCommandExecutes(t *testing.T) { + + // ensure that outs does not already equal what the command will be setting it + // to, if it did this test would not actually be testing anything... + if outs == "hidden" { + t.Errorf("outs should NOT EQUAL hidden") + } + + cmdHidden.Execute() + + // upon running the command, the value of outs should now be 'hidden' + if outs != "hidden" { + t.Errorf("Hidden command failed to run!") + } +} + +// test to ensure hidden commands do not show up in usage/help text +func TestHiddenCommandIsHidden(t *testing.T) { + if cmdHidden.IsAvailableCommand() { + t.Errorf("Hidden command found!") + } +} + +func TestStripFlags(t *testing.T) { + tests := []struct { + input []string + output []string + }{ + { + []string{"foo", "bar"}, + []string{"foo", "bar"}, + }, + { + []string{"foo", "--bar", "-b"}, + []string{"foo"}, + }, + { + []string{"-b", "foo", "--bar", "bar"}, + []string{}, + }, + { + []string{"-i10", "echo"}, + []string{"echo"}, + }, + { + []string{"-i=10", "echo"}, + []string{"echo"}, + }, + { + []string{"--int=100", "echo"}, + []string{"echo"}, + }, + { + []string{"-ib", "echo", "-bfoo", "baz"}, + []string{"echo", "baz"}, + }, + { + []string{"-i=baz", "bar", "-i", "foo", "blah"}, + []string{"bar", "blah"}, + }, + { + []string{"--int=baz", "-bbar", "-i", "foo", "blah"}, + []string{"blah"}, + }, + { + []string{"--cat", "bar", "-i", "foo", "blah"}, + []string{"bar", "blah"}, + }, + { + []string{"-c", "bar", "-i", "foo", "blah"}, + []string{"bar", "blah"}, + }, + { + []string{"--persist", "bar"}, + []string{"bar"}, + }, + { + []string{"-p", "bar"}, + []string{"bar"}, + }, + } + + cmdPrint := &Command{ + Use: "print [string to print]", + Short: "Print anything to the screen", + Long: `an utterly useless command for testing.`, + Run: func(cmd *Command, args []string) { + tp = args + }, + } + + var flagi int + var flagstr string + var flagbool bool + cmdPrint.PersistentFlags().BoolVarP(&flagbool, "persist", "p", false, "help for persistent one") + cmdPrint.Flags().IntVarP(&flagi, "int", "i", 345, "help message for flag int") + cmdPrint.Flags().StringVarP(&flagstr, "bar", "b", "bar", "help message for flag string") + cmdPrint.Flags().BoolVarP(&flagbool, "cat", "c", false, "help message for flag bool") + + for _, test := range tests { + output := stripFlags(test.input, cmdPrint) + if !reflect.DeepEqual(test.output, output) { + t.Errorf("expected: %v, got: %v", test.output, output) + } + } +} + +func TestDisableFlagParsing(t *testing.T) { + as := []string{"-v", "-race", "-file", "foo.go"} + targs := []string{} + cmdPrint := &Command{ + DisableFlagParsing: true, + Run: func(cmd *Command, args []string) { + targs = args + }, + } + osargs := []string{"cmd"} + os.Args = append(osargs, as...) + err := cmdPrint.Execute() + if err != nil { + t.Error(err) + } + if !reflect.DeepEqual(as, targs) { + t.Errorf("expected: %v, got: %v", as, targs) + } +} + +func TestInitHelpFlagMergesFlags(t *testing.T) { + usage := "custom flag" + baseCmd := Command{Use: "testcmd"} + baseCmd.PersistentFlags().Bool("help", false, usage) + cmd := Command{Use: "do"} + baseCmd.AddCommand(&cmd) + + cmd.InitDefaultHelpFlag() + actual := cmd.Flags().Lookup("help").Usage + if actual != usage { + t.Fatalf("Expected the help flag from the base command with usage '%s', but got the default with usage '%s'", usage, actual) + } +} + +func TestCommandsAreSorted(t *testing.T) { + EnableCommandSorting = true + + originalNames := []string{"middle", "zlast", "afirst"} + expectedNames := []string{"afirst", "middle", "zlast"} + + var tmpCommand = &Command{Use: "tmp"} + + for _, name := range originalNames { + tmpCommand.AddCommand(&Command{Use: name}) + } + + for i, c := range tmpCommand.Commands() { + if expectedNames[i] != c.Name() { + t.Errorf("expected: %s, got: %s", expectedNames[i], c.Name()) + } + } + + EnableCommandSorting = true +} + +func TestEnableCommandSortingIsDisabled(t *testing.T) { + EnableCommandSorting = false + + originalNames := []string{"middle", "zlast", "afirst"} + + var tmpCommand = &Command{Use: "tmp"} + + for _, name := range originalNames { + tmpCommand.AddCommand(&Command{Use: name}) + } + + for i, c := range tmpCommand.Commands() { + if originalNames[i] != c.Name() { + t.Errorf("expected: %s, got: %s", originalNames[i], c.Name()) + } + } + + EnableCommandSorting = true +} + +func TestSetOutput(t *testing.T) { + cmd := &Command{} + cmd.SetOutput(nil) + if out := cmd.OutOrStdout(); out != os.Stdout { + t.Fatalf("expected setting output to nil to revert back to stdout, got %v", out) + } +} + +func TestFlagErrorFunc(t *testing.T) { + cmd := &Command{ + Use: "print", + RunE: func(cmd *Command, args []string) error { + return nil + }, + } + expectedFmt := "This is expected: %s" + + cmd.SetFlagErrorFunc(func(c *Command, err error) error { + return fmt.Errorf(expectedFmt, err) + }) + cmd.SetArgs([]string{"--bogus-flag"}) + cmd.SetOutput(new(bytes.Buffer)) + + err := cmd.Execute() + + expected := fmt.Sprintf(expectedFmt, "unknown flag: --bogus-flag") + if err.Error() != expected { + t.Errorf("expected %v, got %v", expected, err.Error()) + } +} + +// TestSortedFlags checks, +// if cmd.LocalFlags() is unsorted when cmd.Flags().SortFlags set to false. +// Related to https://github.com/spf13/cobra/issues/404. +func TestSortedFlags(t *testing.T) { + cmd := &Command{} + cmd.Flags().SortFlags = false + names := []string{"C", "B", "A", "D"} + for _, name := range names { + cmd.Flags().Bool(name, false, "") + } + + i := 0 + cmd.LocalFlags().VisitAll(func(f *pflag.Flag) { + if i == len(names) { + return + } + if isStringInStringSlice(f.Name, names) { + if names[i] != f.Name { + t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name) + } + i++ + } + }) +} + +// contains checks, if s is in ss. +func isStringInStringSlice(s string, ss []string) bool { + for _, v := range ss { + if v == s { + return true + } + } + return false +} + +// TestHelpFlagInHelp checks, +// if '--help' flag is shown in help for child (executing `parent help child`), +// that has no other flags. +// Related to https://github.com/spf13/cobra/issues/302. +func TestHelpFlagInHelp(t *testing.T) { + output := new(bytes.Buffer) + parent := &Command{Use: "parent", Run: func(*Command, []string) {}} + parent.SetOutput(output) + + child := &Command{Use: "child", Run: func(*Command, []string) {}} + parent.AddCommand(child) + + parent.SetArgs([]string{"help", "child"}) + err := parent.Execute() + if err != nil { + t.Fatal(err) + } + + if !strings.Contains(output.String(), "[flags]") { + t.Errorf("\nExpecting to contain: %v\nGot: %v", "[flags]", output.String()) + } +} + +// TestMergeCommandLineToFlags checks, +// if pflag.CommandLine is correctly merged to c.Flags() after first call +// of c.mergePersistentFlags. +// Related to https://github.com/spf13/cobra/issues/443. +func TestMergeCommandLineToFlags(t *testing.T) { + pflag.Bool("boolflag", false, "") + c := &Command{Use: "c", Run: func(*Command, []string) {}} + c.mergePersistentFlags() + if c.Flags().Lookup("boolflag") == nil { + t.Fatal("Expecting to have flag from CommandLine in c.Flags()") + } + + // Reset pflag.CommandLine flagset. + pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ExitOnError) +} diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go index 3e81cd289b..4b0eaa1b6b 100644 --- a/vendor/github.com/spf13/cobra/command_win.go +++ b/vendor/github.com/spf13/cobra/command_win.go @@ -1,26 +1,26 @@ -// +build windows - -package cobra - -import ( - "os" - "time" - - "github.com/inconshreveable/mousetrap" -) - -var preExecHookFn = preExecHook - -// enables an information splash screen on Windows if the CLI is started from explorer.exe. -var MousetrapHelpText string = `This is a command line tool - -You need to open cmd.exe and run it from there. -` - -func preExecHook(c *Command) { - if mousetrap.StartedByExplorer() { - c.Print(MousetrapHelpText) - time.Sleep(5 * time.Second) - os.Exit(1) - } -} +// +build windows + +package cobra + +import ( + "os" + "time" + + "github.com/inconshreveable/mousetrap" +) + +var preExecHookFn = preExecHook + +// enables an information splash screen on Windows if the CLI is started from explorer.exe. +var MousetrapHelpText string = `This is a command line tool + +You need to open cmd.exe and run it from there. +` + +func preExecHook(c *Command) { + if mousetrap.StartedByExplorer() { + c.Print(MousetrapHelpText) + time.Sleep(5 * time.Second) + os.Exit(1) + } +} diff --git a/vendor/github.com/spf13/cobra/doc/cmd_test.go b/vendor/github.com/spf13/cobra/doc/cmd_test.go index e13f22ce50..a4b5568faf 100644 --- a/vendor/github.com/spf13/cobra/doc/cmd_test.go +++ b/vendor/github.com/spf13/cobra/doc/cmd_test.go @@ -1,145 +1,145 @@ -package doc - -import ( - "bytes" - "fmt" - "runtime" - "strings" - "testing" - - "github.com/spf13/cobra" -) - -var flagb1, flagb2, flagb3, flagbr, flagbp bool -var flags1, flags2a, flags2b, flags3 string -var flagi1, flagi2, flagi3, flagir int - -const strtwoParentHelp = "help message for parent flag strtwo" -const strtwoChildHelp = "help message for child flag strtwo" - -var cmdEcho = &cobra.Command{ - Use: "echo [string to echo]", - Aliases: []string{"say"}, - Short: "Echo anything to the screen", - Long: `an utterly useless command for testing.`, - Example: "Just run cobra-test echo", -} - -var cmdEchoSub = &cobra.Command{ - Use: "echosub [string to print]", - Short: "second sub command for echo", - Long: `an absolutely utterly useless command for testing gendocs!.`, - Run: func(cmd *cobra.Command, args []string) {}, -} - -var cmdDeprecated = &cobra.Command{ - Use: "deprecated [can't do anything here]", - Short: "A command which is deprecated", - Long: `an absolutely utterly useless command for testing deprecation!.`, - Deprecated: "Please use echo instead", -} - -var cmdTimes = &cobra.Command{ - Use: "times [# times] [string to echo]", - SuggestFor: []string{"counts"}, - Short: "Echo anything to the screen more times", - Long: `a slightly useless command for testing.`, - PersistentPreRun: func(cmd *cobra.Command, args []string) {}, - Run: func(cmd *cobra.Command, args []string) {}, -} - -var cmdPrint = &cobra.Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `an absolutely utterly useless command for testing.`, -} - -var cmdRootNoRun = &cobra.Command{ - Use: "cobra-test", - Short: "The root can run its own function", - Long: "The root description for help", -} - -var cmdRootSameName = &cobra.Command{ - Use: "print", - Short: "Root with the same name as a subcommand", - Long: "The root description for help", -} - -var cmdRootWithRun = &cobra.Command{ - Use: "cobra-test", - Short: "The root can run its own function", - Long: "The root description for help", -} - -var cmdSubNoRun = &cobra.Command{ - Use: "subnorun", - Short: "A subcommand without a Run function", - Long: "A long output about a subcommand without a Run function", -} - -var cmdVersion1 = &cobra.Command{ - Use: "version", - Short: "Print the version number", - Long: `First version of the version command`, -} - -var cmdVersion2 = &cobra.Command{ - Use: "version", - Short: "Print the version number", - Long: `Second version of the version command`, -} - -func flagInit() { - cmdEcho.ResetFlags() - cmdPrint.ResetFlags() - cmdTimes.ResetFlags() - cmdRootNoRun.ResetFlags() - cmdRootSameName.ResetFlags() - cmdRootWithRun.ResetFlags() - cmdSubNoRun.ResetFlags() - cmdRootNoRun.PersistentFlags().StringVarP(&flags2a, "strtwo", "t", "two", strtwoParentHelp) - cmdEcho.Flags().IntVarP(&flagi1, "intone", "i", 123, "help message for flag intone") - cmdTimes.Flags().IntVarP(&flagi2, "inttwo", "j", 234, "help message for flag inttwo") - cmdPrint.Flags().IntVarP(&flagi3, "intthree", "i", 345, "help message for flag intthree") - cmdEcho.PersistentFlags().StringVarP(&flags1, "strone", "s", "one", "help message for flag strone") - cmdEcho.PersistentFlags().BoolVarP(&flagbp, "persistentbool", "p", false, "help message for flag persistentbool") - cmdTimes.PersistentFlags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) - cmdPrint.PersistentFlags().StringVarP(&flags3, "strthree", "s", "three", "help message for flag strthree") - cmdEcho.Flags().BoolVarP(&flagb1, "boolone", "b", true, "help message for flag boolone") - cmdTimes.Flags().BoolVarP(&flagb2, "booltwo", "c", false, "help message for flag booltwo") - cmdPrint.Flags().BoolVarP(&flagb3, "boolthree", "b", true, "help message for flag boolthree") - cmdVersion1.ResetFlags() - cmdVersion2.ResetFlags() -} - -func initializeWithRootCmd() *cobra.Command { - cmdRootWithRun.ResetCommands() - flagInit() - cmdRootWithRun.Flags().BoolVarP(&flagbr, "boolroot", "b", false, "help message for flag boolroot") - cmdRootWithRun.Flags().IntVarP(&flagir, "introot", "i", 321, "help message for flag introot") - return cmdRootWithRun -} - -func checkStringContains(t *testing.T, found, expected string) { - if !strings.Contains(found, expected) { - logErr(t, found, expected) - } -} - -func checkStringOmits(t *testing.T, found, expected string) { - if strings.Contains(found, expected) { - logErr(t, found, expected) - } -} - -func logErr(t *testing.T, found, expected string) { - out := new(bytes.Buffer) - - _, _, line, ok := runtime.Caller(2) - if ok { - fmt.Fprintf(out, "Line: %d ", line) - } - fmt.Fprintf(out, "Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - t.Errorf(out.String()) -} +package doc + +import ( + "bytes" + "fmt" + "runtime" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +var flagb1, flagb2, flagb3, flagbr, flagbp bool +var flags1, flags2a, flags2b, flags3 string +var flagi1, flagi2, flagi3, flagir int + +const strtwoParentHelp = "help message for parent flag strtwo" +const strtwoChildHelp = "help message for child flag strtwo" + +var cmdEcho = &cobra.Command{ + Use: "echo [string to echo]", + Aliases: []string{"say"}, + Short: "Echo anything to the screen", + Long: `an utterly useless command for testing.`, + Example: "Just run cobra-test echo", +} + +var cmdEchoSub = &cobra.Command{ + Use: "echosub [string to print]", + Short: "second sub command for echo", + Long: `an absolutely utterly useless command for testing gendocs!.`, + Run: func(cmd *cobra.Command, args []string) {}, +} + +var cmdDeprecated = &cobra.Command{ + Use: "deprecated [can't do anything here]", + Short: "A command which is deprecated", + Long: `an absolutely utterly useless command for testing deprecation!.`, + Deprecated: "Please use echo instead", +} + +var cmdTimes = &cobra.Command{ + Use: "times [# times] [string to echo]", + SuggestFor: []string{"counts"}, + Short: "Echo anything to the screen more times", + Long: `a slightly useless command for testing.`, + PersistentPreRun: func(cmd *cobra.Command, args []string) {}, + Run: func(cmd *cobra.Command, args []string) {}, +} + +var cmdPrint = &cobra.Command{ + Use: "print [string to print]", + Short: "Print anything to the screen", + Long: `an absolutely utterly useless command for testing.`, +} + +var cmdRootNoRun = &cobra.Command{ + Use: "cobra-test", + Short: "The root can run its own function", + Long: "The root description for help", +} + +var cmdRootSameName = &cobra.Command{ + Use: "print", + Short: "Root with the same name as a subcommand", + Long: "The root description for help", +} + +var cmdRootWithRun = &cobra.Command{ + Use: "cobra-test", + Short: "The root can run its own function", + Long: "The root description for help", +} + +var cmdSubNoRun = &cobra.Command{ + Use: "subnorun", + Short: "A subcommand without a Run function", + Long: "A long output about a subcommand without a Run function", +} + +var cmdVersion1 = &cobra.Command{ + Use: "version", + Short: "Print the version number", + Long: `First version of the version command`, +} + +var cmdVersion2 = &cobra.Command{ + Use: "version", + Short: "Print the version number", + Long: `Second version of the version command`, +} + +func flagInit() { + cmdEcho.ResetFlags() + cmdPrint.ResetFlags() + cmdTimes.ResetFlags() + cmdRootNoRun.ResetFlags() + cmdRootSameName.ResetFlags() + cmdRootWithRun.ResetFlags() + cmdSubNoRun.ResetFlags() + cmdRootNoRun.PersistentFlags().StringVarP(&flags2a, "strtwo", "t", "two", strtwoParentHelp) + cmdEcho.Flags().IntVarP(&flagi1, "intone", "i", 123, "help message for flag intone") + cmdTimes.Flags().IntVarP(&flagi2, "inttwo", "j", 234, "help message for flag inttwo") + cmdPrint.Flags().IntVarP(&flagi3, "intthree", "i", 345, "help message for flag intthree") + cmdEcho.PersistentFlags().StringVarP(&flags1, "strone", "s", "one", "help message for flag strone") + cmdEcho.PersistentFlags().BoolVarP(&flagbp, "persistentbool", "p", false, "help message for flag persistentbool") + cmdTimes.PersistentFlags().StringVarP(&flags2b, "strtwo", "t", "2", strtwoChildHelp) + cmdPrint.PersistentFlags().StringVarP(&flags3, "strthree", "s", "three", "help message for flag strthree") + cmdEcho.Flags().BoolVarP(&flagb1, "boolone", "b", true, "help message for flag boolone") + cmdTimes.Flags().BoolVarP(&flagb2, "booltwo", "c", false, "help message for flag booltwo") + cmdPrint.Flags().BoolVarP(&flagb3, "boolthree", "b", true, "help message for flag boolthree") + cmdVersion1.ResetFlags() + cmdVersion2.ResetFlags() +} + +func initializeWithRootCmd() *cobra.Command { + cmdRootWithRun.ResetCommands() + flagInit() + cmdRootWithRun.Flags().BoolVarP(&flagbr, "boolroot", "b", false, "help message for flag boolroot") + cmdRootWithRun.Flags().IntVarP(&flagir, "introot", "i", 321, "help message for flag introot") + return cmdRootWithRun +} + +func checkStringContains(t *testing.T, found, expected string) { + if !strings.Contains(found, expected) { + logErr(t, found, expected) + } +} + +func checkStringOmits(t *testing.T, found, expected string) { + if strings.Contains(found, expected) { + logErr(t, found, expected) + } +} + +func logErr(t *testing.T, found, expected string) { + out := new(bytes.Buffer) + + _, _, line, ok := runtime.Caller(2) + if ok { + fmt.Fprintf(out, "Line: %d ", line) + } + fmt.Fprintf(out, "Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + t.Errorf(out.String()) +} diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.go b/vendor/github.com/spf13/cobra/doc/man_docs.go index 8ed120abc3..74b284d2d4 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs.go +++ b/vendor/github.com/spf13/cobra/doc/man_docs.go @@ -1,233 +1,233 @@ -// Copyright 2015 Red Hat Inc. All rights reserved. -// -// 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 doc - -import ( - "bytes" - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - "time" - - "github.com/cpuguy83/go-md2man/md2man" - "github.com/spf13/cobra" - "github.com/spf13/pflag" -) - -// GenManTree will generate a man page for this command and all descendants -// in the directory given. The header may be nil. This function may not work -// correctly if your command names have `-` in them. If you have `cmd` with two -// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` -// it is undefined which help output will be in the file `cmd-sub-third.1`. -func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error { - return GenManTreeFromOpts(cmd, GenManTreeOptions{ - Header: header, - Path: dir, - CommandSeparator: "-", - }) -} - -// GenManTreeFromOpts generates a man page for the command and all descendants. -// The pages are written to the opts.Path directory. -func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error { - header := opts.Header - if header == nil { - header = &GenManHeader{} - } - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { - continue - } - if err := GenManTreeFromOpts(c, opts); err != nil { - return err - } - } - section := "1" - if header.Section != "" { - section = header.Section - } - - separator := "_" - if opts.CommandSeparator != "" { - separator = opts.CommandSeparator - } - basename := strings.Replace(cmd.CommandPath(), " ", separator, -1) - filename := filepath.Join(opts.Path, basename+"."+section) - f, err := os.Create(filename) - if err != nil { - return err - } - defer f.Close() - - headerCopy := *header - return GenMan(cmd, &headerCopy, f) -} - -// GenManTreeOptions is the options for generating the man pages. -// Used only in GenManTreeFromOpts. -type GenManTreeOptions struct { - Header *GenManHeader - Path string - CommandSeparator string -} - -// GenManHeader is a lot like the .TH header at the start of man pages. These -// include the title, section, date, source, and manual. We will use the -// current time if Date if unset and will use "Auto generated by spf13/cobra" -// if the Source is unset. -type GenManHeader struct { - Title string - Section string - Date *time.Time - date string - Source string - Manual string -} - -// GenMan will generate a man page for the given command and write it to -// w. The header argument may be nil, however obviously w may not. -func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error { - if header == nil { - header = &GenManHeader{} - } - fillHeader(header, cmd.CommandPath()) - - b := genMan(cmd, header) - _, err := w.Write(md2man.Render(b)) - return err -} - -func fillHeader(header *GenManHeader, name string) { - if header.Title == "" { - header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1)) - } - if header.Section == "" { - header.Section = "1" - } - if header.Date == nil { - now := time.Now() - header.Date = &now - } - header.date = (*header.Date).Format("Jan 2006") - if header.Source == "" { - header.Source = "Auto generated by spf13/cobra" - } -} - -func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) { - description := cmd.Long - if len(description) == 0 { - description = cmd.Short - } - - buf.WriteString(fmt.Sprintf(`%% %s(%s)%s -%% %s -%% %s -# NAME -`, header.Title, header.Section, header.date, header.Source, header.Manual)) - buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short)) - buf.WriteString("# SYNOPSIS\n") - buf.WriteString(fmt.Sprintf("**%s**\n\n", cmd.UseLine())) - buf.WriteString("# DESCRIPTION\n") - buf.WriteString(description + "\n\n") -} - -func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) { - flags.VisitAll(func(flag *pflag.Flag) { - if len(flag.Deprecated) > 0 || flag.Hidden { - return - } - format := "" - if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 { - format = fmt.Sprintf("**-%s**, **--%s**", flag.Shorthand, flag.Name) - } else { - format = fmt.Sprintf("**--%s**", flag.Name) - } - if len(flag.NoOptDefVal) > 0 { - format += "[" - } - if flag.Value.Type() == "string" { - // put quotes on the value - format += "=%q" - } else { - format += "=%s" - } - if len(flag.NoOptDefVal) > 0 { - format += "]" - } - format += "\n\t%s\n\n" - buf.WriteString(fmt.Sprintf(format, flag.DefValue, flag.Usage)) - }) -} - -func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) { - flags := command.NonInheritedFlags() - if flags.HasFlags() { - buf.WriteString("# OPTIONS\n") - manPrintFlags(buf, flags) - buf.WriteString("\n") - } - flags = command.InheritedFlags() - if flags.HasFlags() { - buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n") - manPrintFlags(buf, flags) - buf.WriteString("\n") - } -} - -func genMan(cmd *cobra.Command, header *GenManHeader) []byte { - // something like `rootcmd-subcmd1-subcmd2` - dashCommandName := strings.Replace(cmd.CommandPath(), " ", "-", -1) - - buf := new(bytes.Buffer) - - manPreamble(buf, header, cmd, dashCommandName) - manPrintOptions(buf, cmd) - if len(cmd.Example) > 0 { - buf.WriteString("# EXAMPLE\n") - buf.WriteString(fmt.Sprintf("```\n%s\n```\n", cmd.Example)) - } - if hasSeeAlso(cmd) { - buf.WriteString("# SEE ALSO\n") - seealsos := make([]string, 0) - if cmd.HasParent() { - parentPath := cmd.Parent().CommandPath() - dashParentPath := strings.Replace(parentPath, " ", "-", -1) - seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section) - seealsos = append(seealsos, seealso) - cmd.VisitParents(func(c *cobra.Command) { - if c.DisableAutoGenTag { - cmd.DisableAutoGenTag = c.DisableAutoGenTag - } - }) - } - children := cmd.Commands() - sort.Sort(byName(children)) - for _, c := range children { - if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { - continue - } - seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section) - seealsos = append(seealsos, seealso) - } - buf.WriteString(strings.Join(seealsos, ", ") + "\n") - } - if !cmd.DisableAutoGenTag { - buf.WriteString(fmt.Sprintf("# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006"))) - } - return buf.Bytes() -} +// Copyright 2015 Red Hat Inc. All rights reserved. +// +// 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 doc + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "sort" + "strings" + "time" + + "github.com/cpuguy83/go-md2man/md2man" + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +// GenManTree will generate a man page for this command and all descendants +// in the directory given. The header may be nil. This function may not work +// correctly if your command names have `-` in them. If you have `cmd` with two +// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` +// it is undefined which help output will be in the file `cmd-sub-third.1`. +func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error { + return GenManTreeFromOpts(cmd, GenManTreeOptions{ + Header: header, + Path: dir, + CommandSeparator: "-", + }) +} + +// GenManTreeFromOpts generates a man page for the command and all descendants. +// The pages are written to the opts.Path directory. +func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error { + header := opts.Header + if header == nil { + header = &GenManHeader{} + } + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { + continue + } + if err := GenManTreeFromOpts(c, opts); err != nil { + return err + } + } + section := "1" + if header.Section != "" { + section = header.Section + } + + separator := "_" + if opts.CommandSeparator != "" { + separator = opts.CommandSeparator + } + basename := strings.Replace(cmd.CommandPath(), " ", separator, -1) + filename := filepath.Join(opts.Path, basename+"."+section) + f, err := os.Create(filename) + if err != nil { + return err + } + defer f.Close() + + headerCopy := *header + return GenMan(cmd, &headerCopy, f) +} + +// GenManTreeOptions is the options for generating the man pages. +// Used only in GenManTreeFromOpts. +type GenManTreeOptions struct { + Header *GenManHeader + Path string + CommandSeparator string +} + +// GenManHeader is a lot like the .TH header at the start of man pages. These +// include the title, section, date, source, and manual. We will use the +// current time if Date if unset and will use "Auto generated by spf13/cobra" +// if the Source is unset. +type GenManHeader struct { + Title string + Section string + Date *time.Time + date string + Source string + Manual string +} + +// GenMan will generate a man page for the given command and write it to +// w. The header argument may be nil, however obviously w may not. +func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error { + if header == nil { + header = &GenManHeader{} + } + fillHeader(header, cmd.CommandPath()) + + b := genMan(cmd, header) + _, err := w.Write(md2man.Render(b)) + return err +} + +func fillHeader(header *GenManHeader, name string) { + if header.Title == "" { + header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1)) + } + if header.Section == "" { + header.Section = "1" + } + if header.Date == nil { + now := time.Now() + header.Date = &now + } + header.date = (*header.Date).Format("Jan 2006") + if header.Source == "" { + header.Source = "Auto generated by spf13/cobra" + } +} + +func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) { + description := cmd.Long + if len(description) == 0 { + description = cmd.Short + } + + buf.WriteString(fmt.Sprintf(`%% %s(%s)%s +%% %s +%% %s +# NAME +`, header.Title, header.Section, header.date, header.Source, header.Manual)) + buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short)) + buf.WriteString("# SYNOPSIS\n") + buf.WriteString(fmt.Sprintf("**%s**\n\n", cmd.UseLine())) + buf.WriteString("# DESCRIPTION\n") + buf.WriteString(description + "\n\n") +} + +func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) { + flags.VisitAll(func(flag *pflag.Flag) { + if len(flag.Deprecated) > 0 || flag.Hidden { + return + } + format := "" + if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 { + format = fmt.Sprintf("**-%s**, **--%s**", flag.Shorthand, flag.Name) + } else { + format = fmt.Sprintf("**--%s**", flag.Name) + } + if len(flag.NoOptDefVal) > 0 { + format += "[" + } + if flag.Value.Type() == "string" { + // put quotes on the value + format += "=%q" + } else { + format += "=%s" + } + if len(flag.NoOptDefVal) > 0 { + format += "]" + } + format += "\n\t%s\n\n" + buf.WriteString(fmt.Sprintf(format, flag.DefValue, flag.Usage)) + }) +} + +func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) { + flags := command.NonInheritedFlags() + if flags.HasFlags() { + buf.WriteString("# OPTIONS\n") + manPrintFlags(buf, flags) + buf.WriteString("\n") + } + flags = command.InheritedFlags() + if flags.HasFlags() { + buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n") + manPrintFlags(buf, flags) + buf.WriteString("\n") + } +} + +func genMan(cmd *cobra.Command, header *GenManHeader) []byte { + // something like `rootcmd-subcmd1-subcmd2` + dashCommandName := strings.Replace(cmd.CommandPath(), " ", "-", -1) + + buf := new(bytes.Buffer) + + manPreamble(buf, header, cmd, dashCommandName) + manPrintOptions(buf, cmd) + if len(cmd.Example) > 0 { + buf.WriteString("# EXAMPLE\n") + buf.WriteString(fmt.Sprintf("```\n%s\n```\n", cmd.Example)) + } + if hasSeeAlso(cmd) { + buf.WriteString("# SEE ALSO\n") + seealsos := make([]string, 0) + if cmd.HasParent() { + parentPath := cmd.Parent().CommandPath() + dashParentPath := strings.Replace(parentPath, " ", "-", -1) + seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section) + seealsos = append(seealsos, seealso) + cmd.VisitParents(func(c *cobra.Command) { + if c.DisableAutoGenTag { + cmd.DisableAutoGenTag = c.DisableAutoGenTag + } + }) + } + children := cmd.Commands() + sort.Sort(byName(children)) + for _, c := range children { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { + continue + } + seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section) + seealsos = append(seealsos, seealso) + } + buf.WriteString(strings.Join(seealsos, ", ") + "\n") + } + if !cmd.DisableAutoGenTag { + buf.WriteString(fmt.Sprintf("# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006"))) + } + return buf.Bytes() +} diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.md b/vendor/github.com/spf13/cobra/doc/man_docs.md index e88b097ed0..3709160f34 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs.md +++ b/vendor/github.com/spf13/cobra/doc/man_docs.md @@ -1,31 +1,31 @@ -# Generating Man Pages For Your Own cobra.Command - -Generating man pages from a cobra command is incredibly easy. An example is as follows: - -```go -package main - -import ( - "log" - - "github.com/spf13/cobra" - "github.com/spf13/cobra/doc" -) - -func main() { - cmd := &cobra.Command{ - Use: "test", - Short: "my test program", - } - header := &doc.GenManHeader{ - Title: "MINE", - Section: "3", - } - err := doc.GenManTree(cmd, header, "/tmp") - if err != nil { - log.Fatal(err) - } -} -``` - -That will get you a man page `/tmp/test.3` +# Generating Man Pages For Your Own cobra.Command + +Generating man pages from a cobra command is incredibly easy. An example is as follows: + +```go +package main + +import ( + "log" + + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +func main() { + cmd := &cobra.Command{ + Use: "test", + Short: "my test program", + } + header := &doc.GenManHeader{ + Title: "MINE", + Section: "3", + } + err := doc.GenManTree(cmd, header, "/tmp") + if err != nil { + log.Fatal(err) + } +} +``` + +That will get you a man page `/tmp/test.3` diff --git a/vendor/github.com/spf13/cobra/doc/man_docs_test.go b/vendor/github.com/spf13/cobra/doc/man_docs_test.go index 8c3d1f60fe..87991063ed 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/man_docs_test.go @@ -1,216 +1,216 @@ -package doc - -import ( - "bufio" - "bytes" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" - - "github.com/spf13/cobra" -) - -func translate(in string) string { - return strings.Replace(in, "-", "\\-", -1) -} - -func TestGenManDoc(t *testing.T) { - c := initializeWithRootCmd() - // Need two commands to run the command alphabetical sort - cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) - c.AddCommand(cmdPrint, cmdEcho) - cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) - - out := new(bytes.Buffer) - - header := &GenManHeader{ - Title: "Project", - Section: "2", - } - // We generate on a subcommand so we have both subcommands and parents - if err := GenMan(cmdEcho, header, out); err != nil { - t.Fatal(err) - } - found := out.String() - - // Make sure parent has - in CommandPath() in SEE ALSO: - parentPath := cmdEcho.Parent().CommandPath() - dashParentPath := strings.Replace(parentPath, " ", "-", -1) - expected := translate(dashParentPath) - expected = expected + "(" + header.Section + ")" - checkStringContains(t, found, expected) - - // Our description - expected = translate(cmdEcho.Name()) - checkStringContains(t, found, expected) - - // Better have our example - expected = translate(cmdEcho.Name()) - checkStringContains(t, found, expected) - - // A local flag - expected = "boolone" - checkStringContains(t, found, expected) - - // persistent flag on parent - expected = "rootflag" - checkStringContains(t, found, expected) - - // We better output info about our parent - expected = translate(cmdRootWithRun.Name()) - checkStringContains(t, found, expected) - - // And about subcommands - expected = translate(cmdEchoSub.Name()) - checkStringContains(t, found, expected) - - unexpected := translate(cmdDeprecated.Name()) - checkStringOmits(t, found, unexpected) - - // auto generated - expected = translate("Auto generated") - checkStringContains(t, found, expected) -} - -func TestGenManNoGenTag(t *testing.T) { - c := initializeWithRootCmd() - // Need two commands to run the command alphabetical sort - cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) - c.AddCommand(cmdPrint, cmdEcho) - cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) - cmdEcho.DisableAutoGenTag = true - out := new(bytes.Buffer) - - header := &GenManHeader{ - Title: "Project", - Section: "2", - } - // We generate on a subcommand so we have both subcommands and parents - if err := GenMan(cmdEcho, header, out); err != nil { - t.Fatal(err) - } - found := out.String() - - unexpected := translate("#HISTORY") - checkStringOmits(t, found, unexpected) -} - -func TestGenManSeeAlso(t *testing.T) { - noop := func(cmd *cobra.Command, args []string) {} - - top := &cobra.Command{Use: "top", Run: noop} - aaa := &cobra.Command{Use: "aaa", Run: noop, Hidden: true} // #229 - bbb := &cobra.Command{Use: "bbb", Run: noop} - ccc := &cobra.Command{Use: "ccc", Run: noop} - top.AddCommand(aaa, bbb, ccc) - - out := new(bytes.Buffer) - header := &GenManHeader{} - if err := GenMan(top, header, out); err != nil { - t.Fatal(err) - } - - scanner := bufio.NewScanner(out) - - if err := AssertLineFound(scanner, ".SH SEE ALSO"); err != nil { - t.Fatal(fmt.Errorf("Couldn't find SEE ALSO section header: %s", err.Error())) - } - - if err := AssertNextLineEquals(scanner, ".PP"); err != nil { - t.Fatal(fmt.Errorf("First line after SEE ALSO wasn't break-indent: %s", err.Error())) - } - - if err := AssertNextLineEquals(scanner, `\fBtop\-bbb(1)\fP, \fBtop\-ccc(1)\fP`); err != nil { - t.Fatal(fmt.Errorf("Second line after SEE ALSO wasn't correct: %s", err.Error())) - } -} - -func TestManPrintFlagsHidesShortDeperecated(t *testing.T) { - cmd := &cobra.Command{} - flags := cmd.Flags() - flags.StringP("foo", "f", "default", "Foo flag") - flags.MarkShorthandDeprecated("foo", "don't use it no more") - - out := new(bytes.Buffer) - manPrintFlags(out, flags) - - expected := "**--foo**=\"default\"\n\tFoo flag\n\n" - if out.String() != expected { - t.Fatalf("Expected %s, but got %s", expected, out.String()) - } -} - -func TestGenManTree(t *testing.T) { - cmd := &cobra.Command{ - Use: "do [OPTIONS] arg1 arg2", - } - header := &GenManHeader{Section: "2"} - tmpdir, err := ioutil.TempDir("", "test-gen-man-tree") - if err != nil { - t.Fatalf("Failed to create tmpdir: %s", err.Error()) - } - defer os.RemoveAll(tmpdir) - - if err := GenManTree(cmd, header, tmpdir); err != nil { - t.Fatalf("GenManTree failed: %s", err.Error()) - } - - if _, err := os.Stat(filepath.Join(tmpdir, "do.2")); err != nil { - t.Fatalf("Expected file 'do.2' to exist") - } - - if header.Title != "" { - t.Fatalf("Expected header.Title to be unmodified") - } -} - -func AssertLineFound(scanner *bufio.Scanner, expectedLine string) error { - for scanner.Scan() { - line := scanner.Text() - if line == expectedLine { - return nil - } - } - - if err := scanner.Err(); err != nil { - return fmt.Errorf("AssertLineFound: scan failed: %s", err.Error()) - } - - return fmt.Errorf("AssertLineFound: hit EOF before finding %#v", expectedLine) -} - -func AssertNextLineEquals(scanner *bufio.Scanner, expectedLine string) error { - if scanner.Scan() { - line := scanner.Text() - if line == expectedLine { - return nil - } - return fmt.Errorf("AssertNextLineEquals: got %#v, not %#v", line, expectedLine) - } - - if err := scanner.Err(); err != nil { - return fmt.Errorf("AssertNextLineEquals: scan failed: %s", err.Error()) - } - - return fmt.Errorf("AssertNextLineEquals: hit EOF before finding %#v", expectedLine) -} - -func BenchmarkGenManToFile(b *testing.B) { - c := initializeWithRootCmd() - file, err := ioutil.TempFile("", "") - if err != nil { - b.Fatal(err) - } - defer os.Remove(file.Name()) - defer file.Close() - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if err := GenMan(c, nil, file); err != nil { - b.Fatal(err) - } - } -} +package doc + +import ( + "bufio" + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +func translate(in string) string { + return strings.Replace(in, "-", "\\-", -1) +} + +func TestGenManDoc(t *testing.T) { + c := initializeWithRootCmd() + // Need two commands to run the command alphabetical sort + cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) + c.AddCommand(cmdPrint, cmdEcho) + cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) + + out := new(bytes.Buffer) + + header := &GenManHeader{ + Title: "Project", + Section: "2", + } + // We generate on a subcommand so we have both subcommands and parents + if err := GenMan(cmdEcho, header, out); err != nil { + t.Fatal(err) + } + found := out.String() + + // Make sure parent has - in CommandPath() in SEE ALSO: + parentPath := cmdEcho.Parent().CommandPath() + dashParentPath := strings.Replace(parentPath, " ", "-", -1) + expected := translate(dashParentPath) + expected = expected + "(" + header.Section + ")" + checkStringContains(t, found, expected) + + // Our description + expected = translate(cmdEcho.Name()) + checkStringContains(t, found, expected) + + // Better have our example + expected = translate(cmdEcho.Name()) + checkStringContains(t, found, expected) + + // A local flag + expected = "boolone" + checkStringContains(t, found, expected) + + // persistent flag on parent + expected = "rootflag" + checkStringContains(t, found, expected) + + // We better output info about our parent + expected = translate(cmdRootWithRun.Name()) + checkStringContains(t, found, expected) + + // And about subcommands + expected = translate(cmdEchoSub.Name()) + checkStringContains(t, found, expected) + + unexpected := translate(cmdDeprecated.Name()) + checkStringOmits(t, found, unexpected) + + // auto generated + expected = translate("Auto generated") + checkStringContains(t, found, expected) +} + +func TestGenManNoGenTag(t *testing.T) { + c := initializeWithRootCmd() + // Need two commands to run the command alphabetical sort + cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) + c.AddCommand(cmdPrint, cmdEcho) + cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) + cmdEcho.DisableAutoGenTag = true + out := new(bytes.Buffer) + + header := &GenManHeader{ + Title: "Project", + Section: "2", + } + // We generate on a subcommand so we have both subcommands and parents + if err := GenMan(cmdEcho, header, out); err != nil { + t.Fatal(err) + } + found := out.String() + + unexpected := translate("#HISTORY") + checkStringOmits(t, found, unexpected) +} + +func TestGenManSeeAlso(t *testing.T) { + noop := func(cmd *cobra.Command, args []string) {} + + top := &cobra.Command{Use: "top", Run: noop} + aaa := &cobra.Command{Use: "aaa", Run: noop, Hidden: true} // #229 + bbb := &cobra.Command{Use: "bbb", Run: noop} + ccc := &cobra.Command{Use: "ccc", Run: noop} + top.AddCommand(aaa, bbb, ccc) + + out := new(bytes.Buffer) + header := &GenManHeader{} + if err := GenMan(top, header, out); err != nil { + t.Fatal(err) + } + + scanner := bufio.NewScanner(out) + + if err := AssertLineFound(scanner, ".SH SEE ALSO"); err != nil { + t.Fatal(fmt.Errorf("Couldn't find SEE ALSO section header: %s", err.Error())) + } + + if err := AssertNextLineEquals(scanner, ".PP"); err != nil { + t.Fatal(fmt.Errorf("First line after SEE ALSO wasn't break-indent: %s", err.Error())) + } + + if err := AssertNextLineEquals(scanner, `\fBtop\-bbb(1)\fP, \fBtop\-ccc(1)\fP`); err != nil { + t.Fatal(fmt.Errorf("Second line after SEE ALSO wasn't correct: %s", err.Error())) + } +} + +func TestManPrintFlagsHidesShortDeperecated(t *testing.T) { + cmd := &cobra.Command{} + flags := cmd.Flags() + flags.StringP("foo", "f", "default", "Foo flag") + flags.MarkShorthandDeprecated("foo", "don't use it no more") + + out := new(bytes.Buffer) + manPrintFlags(out, flags) + + expected := "**--foo**=\"default\"\n\tFoo flag\n\n" + if out.String() != expected { + t.Fatalf("Expected %s, but got %s", expected, out.String()) + } +} + +func TestGenManTree(t *testing.T) { + cmd := &cobra.Command{ + Use: "do [OPTIONS] arg1 arg2", + } + header := &GenManHeader{Section: "2"} + tmpdir, err := ioutil.TempDir("", "test-gen-man-tree") + if err != nil { + t.Fatalf("Failed to create tmpdir: %s", err.Error()) + } + defer os.RemoveAll(tmpdir) + + if err := GenManTree(cmd, header, tmpdir); err != nil { + t.Fatalf("GenManTree failed: %s", err.Error()) + } + + if _, err := os.Stat(filepath.Join(tmpdir, "do.2")); err != nil { + t.Fatalf("Expected file 'do.2' to exist") + } + + if header.Title != "" { + t.Fatalf("Expected header.Title to be unmodified") + } +} + +func AssertLineFound(scanner *bufio.Scanner, expectedLine string) error { + for scanner.Scan() { + line := scanner.Text() + if line == expectedLine { + return nil + } + } + + if err := scanner.Err(); err != nil { + return fmt.Errorf("AssertLineFound: scan failed: %s", err.Error()) + } + + return fmt.Errorf("AssertLineFound: hit EOF before finding %#v", expectedLine) +} + +func AssertNextLineEquals(scanner *bufio.Scanner, expectedLine string) error { + if scanner.Scan() { + line := scanner.Text() + if line == expectedLine { + return nil + } + return fmt.Errorf("AssertNextLineEquals: got %#v, not %#v", line, expectedLine) + } + + if err := scanner.Err(); err != nil { + return fmt.Errorf("AssertNextLineEquals: scan failed: %s", err.Error()) + } + + return fmt.Errorf("AssertNextLineEquals: hit EOF before finding %#v", expectedLine) +} + +func BenchmarkGenManToFile(b *testing.B) { + c := initializeWithRootCmd() + file, err := ioutil.TempFile("", "") + if err != nil { + b.Fatal(err) + } + defer os.Remove(file.Name()) + defer file.Close() + + b.ResetTimer() + for i := 0; i < b.N; i++ { + if err := GenMan(c, nil, file); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/github.com/spf13/cobra/doc/man_examples_test.go b/vendor/github.com/spf13/cobra/doc/man_examples_test.go index 62d77ec07c..db6604268a 100644 --- a/vendor/github.com/spf13/cobra/doc/man_examples_test.go +++ b/vendor/github.com/spf13/cobra/doc/man_examples_test.go @@ -1,35 +1,35 @@ -package doc_test - -import ( - "bytes" - "fmt" - - "github.com/spf13/cobra" - "github.com/spf13/cobra/doc" -) - -func ExampleGenManTree() { - cmd := &cobra.Command{ - Use: "test", - Short: "my test program", - } - header := &doc.GenManHeader{ - Title: "MINE", - Section: "3", - } - doc.GenManTree(cmd, header, "/tmp") -} - -func ExampleGenMan() { - cmd := &cobra.Command{ - Use: "test", - Short: "my test program", - } - header := &doc.GenManHeader{ - Title: "MINE", - Section: "3", - } - out := new(bytes.Buffer) - doc.GenMan(cmd, header, out) - fmt.Print(out.String()) -} +package doc_test + +import ( + "bytes" + "fmt" + + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +func ExampleGenManTree() { + cmd := &cobra.Command{ + Use: "test", + Short: "my test program", + } + header := &doc.GenManHeader{ + Title: "MINE", + Section: "3", + } + doc.GenManTree(cmd, header, "/tmp") +} + +func ExampleGenMan() { + cmd := &cobra.Command{ + Use: "test", + Short: "my test program", + } + header := &doc.GenManHeader{ + Title: "MINE", + Section: "3", + } + out := new(bytes.Buffer) + doc.GenMan(cmd, header, out) + fmt.Print(out.String()) +} diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.go b/vendor/github.com/spf13/cobra/doc/md_docs.go index f1b33961e7..9bbfa36ffe 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs.go +++ b/vendor/github.com/spf13/cobra/doc/md_docs.go @@ -1,156 +1,156 @@ -//Copyright 2015 Red Hat Inc. All rights reserved. -// -// 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 doc - -import ( - "bytes" - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - "time" - - "github.com/spf13/cobra" -) - -func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { - flags := cmd.NonInheritedFlags() - flags.SetOutput(buf) - if flags.HasFlags() { - buf.WriteString("### Options\n\n```\n") - flags.PrintDefaults() - buf.WriteString("```\n\n") - } - - parentFlags := cmd.InheritedFlags() - parentFlags.SetOutput(buf) - if parentFlags.HasFlags() { - buf.WriteString("### Options inherited from parent commands\n\n```\n") - parentFlags.PrintDefaults() - buf.WriteString("```\n\n") - } - return nil -} - -// GenMarkdown creates markdown output. -func GenMarkdown(cmd *cobra.Command, w io.Writer) error { - return GenMarkdownCustom(cmd, w, func(s string) string { return s }) -} - -// GenMarkdownCustom creates custom markdown output. -func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { - buf := new(bytes.Buffer) - name := cmd.CommandPath() - - short := cmd.Short - long := cmd.Long - if len(long) == 0 { - long = short - } - - buf.WriteString("## " + name + "\n\n") - buf.WriteString(short + "\n\n") - buf.WriteString("### Synopsis\n\n") - buf.WriteString("\n" + long + "\n\n") - - if cmd.Runnable() { - buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine())) - } - - if len(cmd.Example) > 0 { - buf.WriteString("### Examples\n\n") - buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example)) - } - - if err := printOptions(buf, cmd, name); err != nil { - return err - } - if hasSeeAlso(cmd) { - buf.WriteString("### SEE ALSO\n") - if cmd.HasParent() { - parent := cmd.Parent() - pname := parent.CommandPath() - link := pname + ".md" - link = strings.Replace(link, " ", "_", -1) - buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short)) - cmd.VisitParents(func(c *cobra.Command) { - if c.DisableAutoGenTag { - cmd.DisableAutoGenTag = c.DisableAutoGenTag - } - }) - } - - children := cmd.Commands() - sort.Sort(byName(children)) - - for _, child := range children { - if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { - continue - } - cname := name + " " + child.Name() - link := cname + ".md" - link = strings.Replace(link, " ", "_", -1) - buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short)) - } - buf.WriteString("\n") - } - if !cmd.DisableAutoGenTag { - buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n") - } - _, err := buf.WriteTo(w) - return err -} - -// GenMarkdownTree will generate a markdown page for this command and all -// descendants in the directory given. The header may be nil. -// This function may not work correctly if your command names have `-` in them. -// If you have `cmd` with two subcmds, `sub` and `sub-third`, -// and `sub` has a subcommand called `third`, it is undefined which -// help output will be in the file `cmd-sub-third.1`. -func GenMarkdownTree(cmd *cobra.Command, dir string) error { - identity := func(s string) string { return s } - emptyStr := func(s string) string { return "" } - return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity) -} - -// GenMarkdownTreeCustom is the the same as GenMarkdownTree, but -// with custom filePrepender and linkHandler. -func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error { - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { - continue - } - if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil { - return err - } - } - - basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md" - filename := filepath.Join(dir, basename) - f, err := os.Create(filename) - if err != nil { - return err - } - defer f.Close() - - if _, err := io.WriteString(f, filePrepender(filename)); err != nil { - return err - } - if err := GenMarkdownCustom(cmd, f, linkHandler); err != nil { - return err - } - return nil -} +//Copyright 2015 Red Hat Inc. All rights reserved. +// +// 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 doc + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "sort" + "strings" + "time" + + "github.com/spf13/cobra" +) + +func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { + flags := cmd.NonInheritedFlags() + flags.SetOutput(buf) + if flags.HasFlags() { + buf.WriteString("### Options\n\n```\n") + flags.PrintDefaults() + buf.WriteString("```\n\n") + } + + parentFlags := cmd.InheritedFlags() + parentFlags.SetOutput(buf) + if parentFlags.HasFlags() { + buf.WriteString("### Options inherited from parent commands\n\n```\n") + parentFlags.PrintDefaults() + buf.WriteString("```\n\n") + } + return nil +} + +// GenMarkdown creates markdown output. +func GenMarkdown(cmd *cobra.Command, w io.Writer) error { + return GenMarkdownCustom(cmd, w, func(s string) string { return s }) +} + +// GenMarkdownCustom creates custom markdown output. +func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { + buf := new(bytes.Buffer) + name := cmd.CommandPath() + + short := cmd.Short + long := cmd.Long + if len(long) == 0 { + long = short + } + + buf.WriteString("## " + name + "\n\n") + buf.WriteString(short + "\n\n") + buf.WriteString("### Synopsis\n\n") + buf.WriteString("\n" + long + "\n\n") + + if cmd.Runnable() { + buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine())) + } + + if len(cmd.Example) > 0 { + buf.WriteString("### Examples\n\n") + buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example)) + } + + if err := printOptions(buf, cmd, name); err != nil { + return err + } + if hasSeeAlso(cmd) { + buf.WriteString("### SEE ALSO\n") + if cmd.HasParent() { + parent := cmd.Parent() + pname := parent.CommandPath() + link := pname + ".md" + link = strings.Replace(link, " ", "_", -1) + buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short)) + cmd.VisitParents(func(c *cobra.Command) { + if c.DisableAutoGenTag { + cmd.DisableAutoGenTag = c.DisableAutoGenTag + } + }) + } + + children := cmd.Commands() + sort.Sort(byName(children)) + + for _, child := range children { + if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { + continue + } + cname := name + " " + child.Name() + link := cname + ".md" + link = strings.Replace(link, " ", "_", -1) + buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short)) + } + buf.WriteString("\n") + } + if !cmd.DisableAutoGenTag { + buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n") + } + _, err := buf.WriteTo(w) + return err +} + +// GenMarkdownTree will generate a markdown page for this command and all +// descendants in the directory given. The header may be nil. +// This function may not work correctly if your command names have `-` in them. +// If you have `cmd` with two subcmds, `sub` and `sub-third`, +// and `sub` has a subcommand called `third`, it is undefined which +// help output will be in the file `cmd-sub-third.1`. +func GenMarkdownTree(cmd *cobra.Command, dir string) error { + identity := func(s string) string { return s } + emptyStr := func(s string) string { return "" } + return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity) +} + +// GenMarkdownTreeCustom is the the same as GenMarkdownTree, but +// with custom filePrepender and linkHandler. +func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error { + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { + continue + } + if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil { + return err + } + } + + basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md" + filename := filepath.Join(dir, basename) + f, err := os.Create(filename) + if err != nil { + return err + } + defer f.Close() + + if _, err := io.WriteString(f, filePrepender(filename)); err != nil { + return err + } + if err := GenMarkdownCustom(cmd, f, linkHandler); err != nil { + return err + } + return nil +} diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.md b/vendor/github.com/spf13/cobra/doc/md_docs.md index 023446ca81..56ce9fe819 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs.md +++ b/vendor/github.com/spf13/cobra/doc/md_docs.md @@ -1,115 +1,115 @@ -# Generating Markdown Docs For Your Own cobra.Command - -Generating man pages from a cobra command is incredibly easy. An example is as follows: - -```go -package main - -import ( - "log" - - "github.com/spf13/cobra" - "github.com/spf13/cobra/doc" -) - -func main() { - cmd := &cobra.Command{ - Use: "test", - Short: "my test program", - } - err := doc.GenMarkdownTree(cmd, "/tmp") - if err != nil { - log.Fatal(err) - } -} -``` - -That will get you a Markdown document `/tmp/test.md` - -## Generate markdown docs for the entire command tree - -This program can actually generate docs for the kubectl command in the kubernetes project - -```go -package main - -import ( - "log" - "io/ioutil" - "os" - - "k8s.io/kubernetes/pkg/kubectl/cmd" - cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - - "github.com/spf13/cobra/doc" -) - -func main() { - kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) - err := doc.GenMarkdownTree(kubectl, "./") - if err != nil { - log.Fatal(err) - } -} -``` - -This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./") - -## Generate markdown docs for a single command - -You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenMarkdown` instead of `GenMarkdownTree` - -```go - out := new(bytes.Buffer) - err := doc.GenMarkdown(cmd, out) - if err != nil { - log.Fatal(err) - } -``` - -This will write the markdown doc for ONLY "cmd" into the out, buffer. - -## Customize the output - -Both `GenMarkdown` and `GenMarkdownTree` have alternate versions with callbacks to get some control of the output: - -```go -func GenMarkdownTreeCustom(cmd *Command, dir string, filePrepender, linkHandler func(string) string) error { - //... -} -``` - -```go -func GenMarkdownCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string) string) error { - //... -} -``` - -The `filePrepender` will prepend the return value given the full filepath to the rendered Markdown file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/): - -```go -const fmTemplate = `--- -date: %s -title: "%s" -slug: %s -url: %s ---- -` - -filePrepender := func(filename string) string { - now := time.Now().Format(time.RFC3339) - name := filepath.Base(filename) - base := strings.TrimSuffix(name, path.Ext(name)) - url := "/commands/" + strings.ToLower(base) + "/" - return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url) -} -``` - -The `linkHandler` can be used to customize the rendered internal links to the commands, given a filename: - -```go -linkHandler := func(name string) string { - base := strings.TrimSuffix(name, path.Ext(name)) - return "/commands/" + strings.ToLower(base) + "/" -} -``` +# Generating Markdown Docs For Your Own cobra.Command + +Generating man pages from a cobra command is incredibly easy. An example is as follows: + +```go +package main + +import ( + "log" + + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +func main() { + cmd := &cobra.Command{ + Use: "test", + Short: "my test program", + } + err := doc.GenMarkdownTree(cmd, "/tmp") + if err != nil { + log.Fatal(err) + } +} +``` + +That will get you a Markdown document `/tmp/test.md` + +## Generate markdown docs for the entire command tree + +This program can actually generate docs for the kubectl command in the kubernetes project + +```go +package main + +import ( + "log" + "io/ioutil" + "os" + + "k8s.io/kubernetes/pkg/kubectl/cmd" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + + "github.com/spf13/cobra/doc" +) + +func main() { + kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) + err := doc.GenMarkdownTree(kubectl, "./") + if err != nil { + log.Fatal(err) + } +} +``` + +This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./") + +## Generate markdown docs for a single command + +You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenMarkdown` instead of `GenMarkdownTree` + +```go + out := new(bytes.Buffer) + err := doc.GenMarkdown(cmd, out) + if err != nil { + log.Fatal(err) + } +``` + +This will write the markdown doc for ONLY "cmd" into the out, buffer. + +## Customize the output + +Both `GenMarkdown` and `GenMarkdownTree` have alternate versions with callbacks to get some control of the output: + +```go +func GenMarkdownTreeCustom(cmd *Command, dir string, filePrepender, linkHandler func(string) string) error { + //... +} +``` + +```go +func GenMarkdownCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string) string) error { + //... +} +``` + +The `filePrepender` will prepend the return value given the full filepath to the rendered Markdown file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/): + +```go +const fmTemplate = `--- +date: %s +title: "%s" +slug: %s +url: %s +--- +` + +filePrepender := func(filename string) string { + now := time.Now().Format(time.RFC3339) + name := filepath.Base(filename) + base := strings.TrimSuffix(name, path.Ext(name)) + url := "/commands/" + strings.ToLower(base) + "/" + return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url) +} +``` + +The `linkHandler` can be used to customize the rendered internal links to the commands, given a filename: + +```go +linkHandler := func(name string) string { + base := strings.TrimSuffix(name, path.Ext(name)) + return "/commands/" + strings.ToLower(base) + "/" +} +``` diff --git a/vendor/github.com/spf13/cobra/doc/md_docs_test.go b/vendor/github.com/spf13/cobra/doc/md_docs_test.go index 5138ed5a81..ba6b9a46ea 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/md_docs_test.go @@ -1,124 +1,124 @@ -package doc - -import ( - "bytes" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" - - "github.com/spf13/cobra" -) - -func TestGenMdDoc(t *testing.T) { - c := initializeWithRootCmd() - // Need two commands to run the command alphabetical sort - cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) - c.AddCommand(cmdPrint, cmdEcho) - cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) - - out := new(bytes.Buffer) - - // We generate on s subcommand so we have both subcommands and parents - if err := GenMarkdown(cmdEcho, out); err != nil { - t.Fatal(err) - } - found := out.String() - - // Our description - expected := cmdEcho.Long - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // Better have our example - expected = cmdEcho.Example - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // A local flag - expected = "boolone" - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // persistent flag on parent - expected = "rootflag" - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // We better output info about our parent - expected = cmdRootWithRun.Short - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // And about subcommands - expected = cmdEchoSub.Short - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - unexpected := cmdDeprecated.Short - if strings.Contains(found, unexpected) { - t.Errorf("Unexpected response.\nFound: %v\nBut should not have!!\n", unexpected) - } -} - -func TestGenMdNoTag(t *testing.T) { - c := initializeWithRootCmd() - // Need two commands to run the command alphabetical sort - cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) - c.AddCommand(cmdPrint, cmdEcho) - c.DisableAutoGenTag = true - cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) - out := new(bytes.Buffer) - - if err := GenMarkdown(c, out); err != nil { - t.Fatal(err) - } - found := out.String() - - unexpected := "Auto generated" - checkStringOmits(t, found, unexpected) - -} - -func TestGenMdTree(t *testing.T) { - cmd := &cobra.Command{ - Use: "do [OPTIONS] arg1 arg2", - } - tmpdir, err := ioutil.TempDir("", "test-gen-md-tree") - if err != nil { - t.Fatalf("Failed to create tmpdir: %s", err.Error()) - } - defer os.RemoveAll(tmpdir) - - if err := GenMarkdownTree(cmd, tmpdir); err != nil { - t.Fatalf("GenMarkdownTree failed: %s", err.Error()) - } - - if _, err := os.Stat(filepath.Join(tmpdir, "do.md")); err != nil { - t.Fatalf("Expected file 'do.md' to exist") - } -} - -func BenchmarkGenMarkdownToFile(b *testing.B) { - c := initializeWithRootCmd() - file, err := ioutil.TempFile("", "") - if err != nil { - b.Fatal(err) - } - defer os.Remove(file.Name()) - defer file.Close() - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if err := GenMarkdown(c, file); err != nil { - b.Fatal(err) - } - } -} +package doc + +import ( + "bytes" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +func TestGenMdDoc(t *testing.T) { + c := initializeWithRootCmd() + // Need two commands to run the command alphabetical sort + cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) + c.AddCommand(cmdPrint, cmdEcho) + cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) + + out := new(bytes.Buffer) + + // We generate on s subcommand so we have both subcommands and parents + if err := GenMarkdown(cmdEcho, out); err != nil { + t.Fatal(err) + } + found := out.String() + + // Our description + expected := cmdEcho.Long + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // Better have our example + expected = cmdEcho.Example + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // A local flag + expected = "boolone" + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // persistent flag on parent + expected = "rootflag" + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // We better output info about our parent + expected = cmdRootWithRun.Short + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // And about subcommands + expected = cmdEchoSub.Short + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + unexpected := cmdDeprecated.Short + if strings.Contains(found, unexpected) { + t.Errorf("Unexpected response.\nFound: %v\nBut should not have!!\n", unexpected) + } +} + +func TestGenMdNoTag(t *testing.T) { + c := initializeWithRootCmd() + // Need two commands to run the command alphabetical sort + cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) + c.AddCommand(cmdPrint, cmdEcho) + c.DisableAutoGenTag = true + cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) + out := new(bytes.Buffer) + + if err := GenMarkdown(c, out); err != nil { + t.Fatal(err) + } + found := out.String() + + unexpected := "Auto generated" + checkStringOmits(t, found, unexpected) + +} + +func TestGenMdTree(t *testing.T) { + cmd := &cobra.Command{ + Use: "do [OPTIONS] arg1 arg2", + } + tmpdir, err := ioutil.TempDir("", "test-gen-md-tree") + if err != nil { + t.Fatalf("Failed to create tmpdir: %s", err.Error()) + } + defer os.RemoveAll(tmpdir) + + if err := GenMarkdownTree(cmd, tmpdir); err != nil { + t.Fatalf("GenMarkdownTree failed: %s", err.Error()) + } + + if _, err := os.Stat(filepath.Join(tmpdir, "do.md")); err != nil { + t.Fatalf("Expected file 'do.md' to exist") + } +} + +func BenchmarkGenMarkdownToFile(b *testing.B) { + c := initializeWithRootCmd() + file, err := ioutil.TempFile("", "") + if err != nil { + b.Fatal(err) + } + defer os.Remove(file.Name()) + defer file.Close() + + b.ResetTimer() + for i := 0; i < b.N; i++ { + if err := GenMarkdown(c, file); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/github.com/spf13/cobra/doc/util.go b/vendor/github.com/spf13/cobra/doc/util.go index 0df7b90ba7..8d3dbecec8 100644 --- a/vendor/github.com/spf13/cobra/doc/util.go +++ b/vendor/github.com/spf13/cobra/doc/util.go @@ -1,51 +1,51 @@ -// Copyright 2015 Red Hat Inc. All rights reserved. -// -// 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 doc - -import ( - "strings" - - "github.com/spf13/cobra" -) - -// Test to see if we have a reason to print See Also information in docs -// Basically this is a test for a parent commend or a subcommand which is -// both not deprecated and not the autogenerated help command. -func hasSeeAlso(cmd *cobra.Command) bool { - if cmd.HasParent() { - return true - } - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { - continue - } - return true - } - return false -} - -// Temporary workaround for yaml lib generating incorrect yaml with long strings -// that do not contain \n. -func forceMultiLine(s string) string { - if len(s) > 60 && !strings.Contains(s, "\n") { - s = s + "\n" - } - return s -} - -type byName []*cobra.Command - -func (s byName) Len() int { return len(s) } -func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() } +// Copyright 2015 Red Hat Inc. All rights reserved. +// +// 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 doc + +import ( + "strings" + + "github.com/spf13/cobra" +) + +// Test to see if we have a reason to print See Also information in docs +// Basically this is a test for a parent commend or a subcommand which is +// both not deprecated and not the autogenerated help command. +func hasSeeAlso(cmd *cobra.Command) bool { + if cmd.HasParent() { + return true + } + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { + continue + } + return true + } + return false +} + +// Temporary workaround for yaml lib generating incorrect yaml with long strings +// that do not contain \n. +func forceMultiLine(s string) string { + if len(s) > 60 && !strings.Contains(s, "\n") { + s = s + "\n" + } + return s +} + +type byName []*cobra.Command + +func (s byName) Len() int { return len(s) } +func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() } diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.go b/vendor/github.com/spf13/cobra/doc/yaml_docs.go index f4b4ec2495..54c244d456 100644 --- a/vendor/github.com/spf13/cobra/doc/yaml_docs.go +++ b/vendor/github.com/spf13/cobra/doc/yaml_docs.go @@ -1,166 +1,166 @@ -// Copyright 2016 French Ben. All rights reserved. -// -// 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 doc - -import ( - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/spf13/cobra" - "github.com/spf13/pflag" - "gopkg.in/yaml.v2" -) - -type cmdOption struct { - Name string - Shorthand string `yaml:",omitempty"` - DefaultValue string `yaml:"default_value,omitempty"` - Usage string `yaml:",omitempty"` -} - -type cmdDoc struct { - Name string - Synopsis string `yaml:",omitempty"` - Description string `yaml:",omitempty"` - Options []cmdOption `yaml:",omitempty"` - InheritedOptions []cmdOption `yaml:"inherited_options,omitempty"` - Example string `yaml:",omitempty"` - SeeAlso []string `yaml:"see_also,omitempty"` -} - -// GenYamlTree creates yaml structured ref files for this command and all descendants -// in the directory given. This function may not work -// correctly if your command names have `-` in them. If you have `cmd` with two -// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` -// it is undefined which help output will be in the file `cmd-sub-third.1`. -func GenYamlTree(cmd *cobra.Command, dir string) error { - identity := func(s string) string { return s } - emptyStr := func(s string) string { return "" } - return GenYamlTreeCustom(cmd, dir, emptyStr, identity) -} - -// GenYamlTreeCustom creates yaml structured ref files. -func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error { - for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { - continue - } - if err := GenYamlTreeCustom(c, dir, filePrepender, linkHandler); err != nil { - return err - } - } - - basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".yaml" - filename := filepath.Join(dir, basename) - f, err := os.Create(filename) - if err != nil { - return err - } - defer f.Close() - - if _, err := io.WriteString(f, filePrepender(filename)); err != nil { - return err - } - if err := GenYamlCustom(cmd, f, linkHandler); err != nil { - return err - } - return nil -} - -// GenYaml creates yaml output. -func GenYaml(cmd *cobra.Command, w io.Writer) error { - return GenYamlCustom(cmd, w, func(s string) string { return s }) -} - -// GenYamlCustom creates custom yaml output. -func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { - yamlDoc := cmdDoc{} - yamlDoc.Name = cmd.CommandPath() - - yamlDoc.Synopsis = forceMultiLine(cmd.Short) - yamlDoc.Description = forceMultiLine(cmd.Long) - - if len(cmd.Example) > 0 { - yamlDoc.Example = cmd.Example - } - - flags := cmd.NonInheritedFlags() - if flags.HasFlags() { - yamlDoc.Options = genFlagResult(flags) - } - flags = cmd.InheritedFlags() - if flags.HasFlags() { - yamlDoc.InheritedOptions = genFlagResult(flags) - } - - if hasSeeAlso(cmd) { - result := []string{} - if cmd.HasParent() { - parent := cmd.Parent() - result = append(result, parent.CommandPath()+" - "+parent.Short) - } - children := cmd.Commands() - sort.Sort(byName(children)) - for _, child := range children { - if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { - continue - } - result = append(result, child.Name()+" - "+child.Short) - } - yamlDoc.SeeAlso = result - } - - final, err := yaml.Marshal(&yamlDoc) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - - if _, err := w.Write(final); err != nil { - return err - } - return nil -} - -func genFlagResult(flags *pflag.FlagSet) []cmdOption { - var result []cmdOption - - flags.VisitAll(func(flag *pflag.Flag) { - // Todo, when we mark a shorthand is deprecated, but specify an empty message. - // The flag.ShorthandDeprecated is empty as the shorthand is deprecated. - // Using len(flag.ShorthandDeprecated) > 0 can't handle this, others are ok. - if !(len(flag.ShorthandDeprecated) > 0) && len(flag.Shorthand) > 0 { - opt := cmdOption{ - flag.Name, - flag.Shorthand, - flag.DefValue, - forceMultiLine(flag.Usage), - } - result = append(result, opt) - } else { - opt := cmdOption{ - Name: flag.Name, - DefaultValue: forceMultiLine(flag.DefValue), - Usage: forceMultiLine(flag.Usage), - } - result = append(result, opt) - } - }) - - return result -} +// Copyright 2016 French Ben. All rights reserved. +// +// 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 doc + +import ( + "fmt" + "io" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "gopkg.in/yaml.v2" +) + +type cmdOption struct { + Name string + Shorthand string `yaml:",omitempty"` + DefaultValue string `yaml:"default_value,omitempty"` + Usage string `yaml:",omitempty"` +} + +type cmdDoc struct { + Name string + Synopsis string `yaml:",omitempty"` + Description string `yaml:",omitempty"` + Options []cmdOption `yaml:",omitempty"` + InheritedOptions []cmdOption `yaml:"inherited_options,omitempty"` + Example string `yaml:",omitempty"` + SeeAlso []string `yaml:"see_also,omitempty"` +} + +// GenYamlTree creates yaml structured ref files for this command and all descendants +// in the directory given. This function may not work +// correctly if your command names have `-` in them. If you have `cmd` with two +// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` +// it is undefined which help output will be in the file `cmd-sub-third.1`. +func GenYamlTree(cmd *cobra.Command, dir string) error { + identity := func(s string) string { return s } + emptyStr := func(s string) string { return "" } + return GenYamlTreeCustom(cmd, dir, emptyStr, identity) +} + +// GenYamlTreeCustom creates yaml structured ref files. +func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error { + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { + continue + } + if err := GenYamlTreeCustom(c, dir, filePrepender, linkHandler); err != nil { + return err + } + } + + basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".yaml" + filename := filepath.Join(dir, basename) + f, err := os.Create(filename) + if err != nil { + return err + } + defer f.Close() + + if _, err := io.WriteString(f, filePrepender(filename)); err != nil { + return err + } + if err := GenYamlCustom(cmd, f, linkHandler); err != nil { + return err + } + return nil +} + +// GenYaml creates yaml output. +func GenYaml(cmd *cobra.Command, w io.Writer) error { + return GenYamlCustom(cmd, w, func(s string) string { return s }) +} + +// GenYamlCustom creates custom yaml output. +func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { + yamlDoc := cmdDoc{} + yamlDoc.Name = cmd.CommandPath() + + yamlDoc.Synopsis = forceMultiLine(cmd.Short) + yamlDoc.Description = forceMultiLine(cmd.Long) + + if len(cmd.Example) > 0 { + yamlDoc.Example = cmd.Example + } + + flags := cmd.NonInheritedFlags() + if flags.HasFlags() { + yamlDoc.Options = genFlagResult(flags) + } + flags = cmd.InheritedFlags() + if flags.HasFlags() { + yamlDoc.InheritedOptions = genFlagResult(flags) + } + + if hasSeeAlso(cmd) { + result := []string{} + if cmd.HasParent() { + parent := cmd.Parent() + result = append(result, parent.CommandPath()+" - "+parent.Short) + } + children := cmd.Commands() + sort.Sort(byName(children)) + for _, child := range children { + if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { + continue + } + result = append(result, child.Name()+" - "+child.Short) + } + yamlDoc.SeeAlso = result + } + + final, err := yaml.Marshal(&yamlDoc) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + if _, err := w.Write(final); err != nil { + return err + } + return nil +} + +func genFlagResult(flags *pflag.FlagSet) []cmdOption { + var result []cmdOption + + flags.VisitAll(func(flag *pflag.Flag) { + // Todo, when we mark a shorthand is deprecated, but specify an empty message. + // The flag.ShorthandDeprecated is empty as the shorthand is deprecated. + // Using len(flag.ShorthandDeprecated) > 0 can't handle this, others are ok. + if !(len(flag.ShorthandDeprecated) > 0) && len(flag.Shorthand) > 0 { + opt := cmdOption{ + flag.Name, + flag.Shorthand, + flag.DefValue, + forceMultiLine(flag.Usage), + } + result = append(result, opt) + } else { + opt := cmdOption{ + Name: flag.Name, + DefaultValue: forceMultiLine(flag.DefValue), + Usage: forceMultiLine(flag.Usage), + } + result = append(result, opt) + } + }) + + return result +} diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.md b/vendor/github.com/spf13/cobra/doc/yaml_docs.md index 02db6a9c5e..1a9b7c6a3c 100644 --- a/vendor/github.com/spf13/cobra/doc/yaml_docs.md +++ b/vendor/github.com/spf13/cobra/doc/yaml_docs.md @@ -1,112 +1,112 @@ -# Generating Yaml Docs For Your Own cobra.Command - -Generating yaml files from a cobra command is incredibly easy. An example is as follows: - -```go -package main - -import ( - "log" - - "github.com/spf13/cobra" - "github.com/spf13/cobra/doc" -) - -func main() { - cmd := &cobra.Command{ - Use: "test", - Short: "my test program", - } - err := doc.GenYamlTree(cmd, "/tmp") - if err != nil { - log.Fatal(err) - } -} -``` - -That will get you a Yaml document `/tmp/test.yaml` - -## Generate yaml docs for the entire command tree - -This program can actually generate docs for the kubectl command in the kubernetes project - -```go -package main - -import ( - "io/ioutil" - "log" - "os" - - "k8s.io/kubernetes/pkg/kubectl/cmd" - cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - - "github.com/spf13/cobra/doc" -) - -func main() { - kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) - err := doc.GenYamlTree(kubectl, "./") - if err != nil { - log.Fatal(err) - } -} -``` - -This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./") - -## Generate yaml docs for a single command - -You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenYaml` instead of `GenYamlTree` - -```go - out := new(bytes.Buffer) - doc.GenYaml(cmd, out) -``` - -This will write the yaml doc for ONLY "cmd" into the out, buffer. - -## Customize the output - -Both `GenYaml` and `GenYamlTree` have alternate versions with callbacks to get some control of the output: - -```go -func GenYamlTreeCustom(cmd *Command, dir string, filePrepender, linkHandler func(string) string) error { - //... -} -``` - -```go -func GenYamlCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string) string) error { - //... -} -``` - -The `filePrepender` will prepend the return value given the full filepath to the rendered Yaml file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/): - -```go -const fmTemplate = `--- -date: %s -title: "%s" -slug: %s -url: %s ---- -` - -filePrepender := func(filename string) string { - now := time.Now().Format(time.RFC3339) - name := filepath.Base(filename) - base := strings.TrimSuffix(name, path.Ext(name)) - url := "/commands/" + strings.ToLower(base) + "/" - return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url) -} -``` - -The `linkHandler` can be used to customize the rendered internal links to the commands, given a filename: - -```go -linkHandler := func(name string) string { - base := strings.TrimSuffix(name, path.Ext(name)) - return "/commands/" + strings.ToLower(base) + "/" -} -``` +# Generating Yaml Docs For Your Own cobra.Command + +Generating yaml files from a cobra command is incredibly easy. An example is as follows: + +```go +package main + +import ( + "log" + + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +func main() { + cmd := &cobra.Command{ + Use: "test", + Short: "my test program", + } + err := doc.GenYamlTree(cmd, "/tmp") + if err != nil { + log.Fatal(err) + } +} +``` + +That will get you a Yaml document `/tmp/test.yaml` + +## Generate yaml docs for the entire command tree + +This program can actually generate docs for the kubectl command in the kubernetes project + +```go +package main + +import ( + "io/ioutil" + "log" + "os" + + "k8s.io/kubernetes/pkg/kubectl/cmd" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + + "github.com/spf13/cobra/doc" +) + +func main() { + kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) + err := doc.GenYamlTree(kubectl, "./") + if err != nil { + log.Fatal(err) + } +} +``` + +This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./") + +## Generate yaml docs for a single command + +You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenYaml` instead of `GenYamlTree` + +```go + out := new(bytes.Buffer) + doc.GenYaml(cmd, out) +``` + +This will write the yaml doc for ONLY "cmd" into the out, buffer. + +## Customize the output + +Both `GenYaml` and `GenYamlTree` have alternate versions with callbacks to get some control of the output: + +```go +func GenYamlTreeCustom(cmd *Command, dir string, filePrepender, linkHandler func(string) string) error { + //... +} +``` + +```go +func GenYamlCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string) string) error { + //... +} +``` + +The `filePrepender` will prepend the return value given the full filepath to the rendered Yaml file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/): + +```go +const fmTemplate = `--- +date: %s +title: "%s" +slug: %s +url: %s +--- +` + +filePrepender := func(filename string) string { + now := time.Now().Format(time.RFC3339) + name := filepath.Base(filename) + base := strings.TrimSuffix(name, path.Ext(name)) + url := "/commands/" + strings.ToLower(base) + "/" + return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url) +} +``` + +The `linkHandler` can be used to customize the rendered internal links to the commands, given a filename: + +```go +linkHandler := func(name string) string { + base := strings.TrimSuffix(name, path.Ext(name)) + return "/commands/" + strings.ToLower(base) + "/" +} +``` diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go b/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go index 3c5e13b950..29e985e408 100644 --- a/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go +++ b/vendor/github.com/spf13/cobra/doc/yaml_docs_test.go @@ -1,125 +1,125 @@ -package doc - -import ( - "bytes" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" - - "github.com/spf13/cobra" -) - -func TestGenYamlDoc(t *testing.T) { - c := initializeWithRootCmd() - // Need two commands to run the command alphabetical sort - cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) - c.AddCommand(cmdPrint, cmdEcho) - cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) - - out := new(bytes.Buffer) - - // We generate on s subcommand so we have both subcommands and parents - if err := GenYaml(cmdEcho, out); err != nil { - t.Fatal(err) - } - found := out.String() - - // Our description - expected := cmdEcho.Long - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // Better have our example - expected = cmdEcho.Example - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // A local flag - expected = "boolone" - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // persistent flag on parent - expected = "rootflag" - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // We better output info about our parent - expected = cmdRootWithRun.Short - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - // And about subcommands - expected = cmdEchoSub.Short - if !strings.Contains(found, expected) { - t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) - } - - unexpected := cmdDeprecated.Short - if strings.Contains(found, unexpected) { - t.Errorf("Unexpected response.\nFound: %v\nBut should not have!!\n", unexpected) - } -} - -func TestGenYamlNoTag(t *testing.T) { - c := initializeWithRootCmd() - // Need two commands to run the command alphabetical sort - cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) - c.AddCommand(cmdPrint, cmdEcho) - c.DisableAutoGenTag = true - cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) - out := new(bytes.Buffer) - - if err := GenYaml(c, out); err != nil { - t.Fatal(err) - } - found := out.String() - - unexpected := "Auto generated" - checkStringOmits(t, found, unexpected) - -} - -func TestGenYamlTree(t *testing.T) { - cmd := &cobra.Command{ - Use: "do [OPTIONS] arg1 arg2", - } - - tmpdir, err := ioutil.TempDir("", "test-gen-yaml-tree") - if err != nil { - t.Fatalf("Failed to create tmpdir: %s", err.Error()) - } - defer os.RemoveAll(tmpdir) - - if err := GenYamlTree(cmd, tmpdir); err != nil { - t.Fatalf("GenYamlTree failed: %s", err.Error()) - } - - if _, err := os.Stat(filepath.Join(tmpdir, "do.yaml")); err != nil { - t.Fatalf("Expected file 'do.yaml' to exist") - } -} - -func BenchmarkGenYamlToFile(b *testing.B) { - c := initializeWithRootCmd() - file, err := ioutil.TempFile("", "") - if err != nil { - b.Fatal(err) - } - defer os.Remove(file.Name()) - defer file.Close() - - b.ResetTimer() - for i := 0; i < b.N; i++ { - if err := GenYaml(c, file); err != nil { - b.Fatal(err) - } - } -} +package doc + +import ( + "bytes" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/spf13/cobra" +) + +func TestGenYamlDoc(t *testing.T) { + c := initializeWithRootCmd() + // Need two commands to run the command alphabetical sort + cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) + c.AddCommand(cmdPrint, cmdEcho) + cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) + + out := new(bytes.Buffer) + + // We generate on s subcommand so we have both subcommands and parents + if err := GenYaml(cmdEcho, out); err != nil { + t.Fatal(err) + } + found := out.String() + + // Our description + expected := cmdEcho.Long + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // Better have our example + expected = cmdEcho.Example + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // A local flag + expected = "boolone" + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // persistent flag on parent + expected = "rootflag" + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // We better output info about our parent + expected = cmdRootWithRun.Short + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + // And about subcommands + expected = cmdEchoSub.Short + if !strings.Contains(found, expected) { + t.Errorf("Unexpected response.\nExpecting to contain: \n %q\nGot:\n %q\n", expected, found) + } + + unexpected := cmdDeprecated.Short + if strings.Contains(found, unexpected) { + t.Errorf("Unexpected response.\nFound: %v\nBut should not have!!\n", unexpected) + } +} + +func TestGenYamlNoTag(t *testing.T) { + c := initializeWithRootCmd() + // Need two commands to run the command alphabetical sort + cmdEcho.AddCommand(cmdTimes, cmdEchoSub, cmdDeprecated) + c.AddCommand(cmdPrint, cmdEcho) + c.DisableAutoGenTag = true + cmdRootWithRun.PersistentFlags().StringVarP(&flags2a, "rootflag", "r", "two", strtwoParentHelp) + out := new(bytes.Buffer) + + if err := GenYaml(c, out); err != nil { + t.Fatal(err) + } + found := out.String() + + unexpected := "Auto generated" + checkStringOmits(t, found, unexpected) + +} + +func TestGenYamlTree(t *testing.T) { + cmd := &cobra.Command{ + Use: "do [OPTIONS] arg1 arg2", + } + + tmpdir, err := ioutil.TempDir("", "test-gen-yaml-tree") + if err != nil { + t.Fatalf("Failed to create tmpdir: %s", err.Error()) + } + defer os.RemoveAll(tmpdir) + + if err := GenYamlTree(cmd, tmpdir); err != nil { + t.Fatalf("GenYamlTree failed: %s", err.Error()) + } + + if _, err := os.Stat(filepath.Join(tmpdir, "do.yaml")); err != nil { + t.Fatalf("Expected file 'do.yaml' to exist") + } +} + +func BenchmarkGenYamlToFile(b *testing.B) { + c := initializeWithRootCmd() + file, err := ioutil.TempFile("", "") + if err != nil { + b.Fatal(err) + } + defer os.Remove(file.Name()) + defer file.Close() + + b.ResetTimer() + for i := 0; i < b.N; i++ { + if err := GenYaml(c, file); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/github.com/spf13/pflag/.gitignore b/vendor/github.com/spf13/pflag/.gitignore index 65afb26010..c3da290134 100644 --- a/vendor/github.com/spf13/pflag/.gitignore +++ b/vendor/github.com/spf13/pflag/.gitignore @@ -1,2 +1,2 @@ -.idea/* - +.idea/* + diff --git a/vendor/github.com/spf13/pflag/.travis.yml b/vendor/github.com/spf13/pflag/.travis.yml index 190b01f45f..f8a63b308b 100644 --- a/vendor/github.com/spf13/pflag/.travis.yml +++ b/vendor/github.com/spf13/pflag/.travis.yml @@ -1,21 +1,21 @@ -sudo: false - -language: go - -go: - - 1.7.3 - - 1.8.1 - - tip - -matrix: - allow_failures: - - go: tip - -install: - - go get github.com/golang/lint/golint - - export PATH=$GOPATH/bin:$PATH - - go install ./... - -script: - - verify/all.sh -v - - go test ./... +sudo: false + +language: go + +go: + - 1.7.3 + - 1.8.1 + - tip + +matrix: + allow_failures: + - go: tip + +install: + - go get github.com/golang/lint/golint + - export PATH=$GOPATH/bin:$PATH + - go install ./... + +script: + - verify/all.sh -v + - go test ./... diff --git a/vendor/github.com/spf13/pflag/LICENSE b/vendor/github.com/spf13/pflag/LICENSE index eb32a6f787..63ed1cfea1 100644 --- a/vendor/github.com/spf13/pflag/LICENSE +++ b/vendor/github.com/spf13/pflag/LICENSE @@ -1,28 +1,28 @@ -Copyright (c) 2012 Alex Ogier. 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. +Copyright (c) 2012 Alex Ogier. 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/spf13/pflag/README.md b/vendor/github.com/spf13/pflag/README.md index a2b15e42be..b052414d12 100644 --- a/vendor/github.com/spf13/pflag/README.md +++ b/vendor/github.com/spf13/pflag/README.md @@ -1,296 +1,296 @@ -[![Build Status](https://travis-ci.org/spf13/pflag.svg?branch=master)](https://travis-ci.org/spf13/pflag) -[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/pflag)](https://goreportcard.com/report/github.com/spf13/pflag) -[![GoDoc](https://godoc.org/github.com/spf13/pflag?status.svg)](https://godoc.org/github.com/spf13/pflag) - -## Description - -pflag is a drop-in replacement for Go's flag package, implementing -POSIX/GNU-style --flags. - -pflag is compatible with the [GNU extensions to the POSIX recommendations -for command-line options][1]. For a more precise description, see the -"Command-line flag syntax" section below. - -[1]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html - -pflag is available under the same style of BSD license as the Go language, -which can be found in the LICENSE file. - -## Installation - -pflag is available using the standard `go get` command. - -Install by running: - - go get github.com/spf13/pflag - -Run tests by running: - - go test github.com/spf13/pflag - -## Usage - -pflag is a drop-in replacement of Go's native flag package. If you import -pflag under the name "flag" then all code should continue to function -with no changes. - -``` go -import flag "github.com/spf13/pflag" -``` - -There is one exception to this: if you directly instantiate the Flag struct -there is one more field "Shorthand" that you will need to set. -Most code never instantiates this struct directly, and instead uses -functions such as String(), BoolVar(), and Var(), and is therefore -unaffected. - -Define flags using flag.String(), Bool(), Int(), etc. - -This declares an integer flag, -flagname, stored in the pointer ip, with type *int. - -``` go -var ip *int = flag.Int("flagname", 1234, "help message for flagname") -``` - -If you like, you can bind the flag to a variable using the Var() functions. - -``` go -var flagvar int -func init() { - flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") -} -``` - -Or you can create custom flags that satisfy the Value interface (with -pointer receivers) and couple them to flag parsing by - -``` go -flag.Var(&flagVal, "name", "help message for flagname") -``` - -For such flags, the default value is just the initial value of the variable. - -After all flags are defined, call - -``` go -flag.Parse() -``` - -to parse the command line into the defined flags. - -Flags may then be used directly. If you're using the flags themselves, -they are all pointers; if you bind to variables, they're values. - -``` go -fmt.Println("ip has value ", *ip) -fmt.Println("flagvar has value ", flagvar) -``` - -There are helpers function to get values later if you have the FlagSet but -it was difficult to keep up with all of the flag pointers in your code. -If you have a pflag.FlagSet with a flag called 'flagname' of type int you -can use GetInt() to get the int value. But notice that 'flagname' must exist -and it must be an int. GetString("flagname") will fail. - -``` go -i, err := flagset.GetInt("flagname") -``` - -After parsing, the arguments after the flag are available as the -slice flag.Args() or individually as flag.Arg(i). -The arguments are indexed from 0 through flag.NArg()-1. - -The pflag package also defines some new functions that are not in flag, -that give one-letter shorthands for flags. You can use these by appending -'P' to the name of any function that defines a flag. - -``` go -var ip = flag.IntP("flagname", "f", 1234, "help message") -var flagvar bool -func init() { - flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") -} -flag.VarP(&flagVal, "varname", "v", "help message") -``` - -Shorthand letters can be used with single dashes on the command line. -Boolean shorthand flags can be combined with other shorthand flags. - -The default set of command-line flags is controlled by -top-level functions. The FlagSet type allows one to define -independent sets of flags, such as to implement subcommands -in a command-line interface. The methods of FlagSet are -analogous to the top-level functions for the command-line -flag set. - -## Setting no option default values for flags - -After you create a flag it is possible to set the pflag.NoOptDefVal for -the given flag. Doing this changes the meaning of the flag slightly. If -a flag has a NoOptDefVal and the flag is set on the command line without -an option the flag will be set to the NoOptDefVal. For example given: - -``` go -var ip = flag.IntP("flagname", "f", 1234, "help message") -flag.Lookup("flagname").NoOptDefVal = "4321" -``` - -Would result in something like - -| Parsed Arguments | Resulting Value | -| ------------- | ------------- | -| --flagname=1357 | ip=1357 | -| --flagname | ip=4321 | -| [nothing] | ip=1234 | - -## Command line flag syntax - -``` ---flag // boolean flags, or flags with no option default values ---flag x // only on flags without a default value ---flag=x -``` - -Unlike the flag package, a single dash before an option means something -different than a double dash. Single dashes signify a series of shorthand -letters for flags. All but the last shorthand letter must be boolean flags -or a flag with a default value - -``` -// boolean or flags where the 'no option default value' is set --f --f=true --abc -but --b true is INVALID - -// non-boolean and flags without a 'no option default value' --n 1234 --n=1234 --n1234 - -// mixed --abcs "hello" --absd="hello" --abcs1234 -``` - -Flag parsing stops after the terminator "--". Unlike the flag package, -flags can be interspersed with arguments anywhere on the command line -before this terminator. - -Integer flags accept 1234, 0664, 0x1234 and may be negative. -Boolean flags (in their long form) accept 1, 0, t, f, true, false, -TRUE, FALSE, True, False. -Duration flags accept any input valid for time.ParseDuration. - -## Mutating or "Normalizing" Flag names - -It is possible to set a custom flag name 'normalization function.' It allows flag names to be mutated both when created in the code and when used on the command line to some 'normalized' form. The 'normalized' form is used for comparison. Two examples of using the custom normalization func follow. - -**Example #1**: You want -, _, and . in flags to compare the same. aka --my-flag == --my_flag == --my.flag - -``` go -func wordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName { - from := []string{"-", "_"} - to := "." - for _, sep := range from { - name = strings.Replace(name, sep, to, -1) - } - return pflag.NormalizedName(name) -} - -myFlagSet.SetNormalizeFunc(wordSepNormalizeFunc) -``` - -**Example #2**: You want to alias two flags. aka --old-flag-name == --new-flag-name - -``` go -func aliasNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName { - switch name { - case "old-flag-name": - name = "new-flag-name" - break - } - return pflag.NormalizedName(name) -} - -myFlagSet.SetNormalizeFunc(aliasNormalizeFunc) -``` - -## Deprecating a flag or its shorthand -It is possible to deprecate a flag, or just its shorthand. Deprecating a flag/shorthand hides it from help text and prints a usage message when the deprecated flag/shorthand is used. - -**Example #1**: You want to deprecate a flag named "badflag" as well as inform the users what flag they should use instead. -```go -// deprecate a flag by specifying its name and a usage message -flags.MarkDeprecated("badflag", "please use --good-flag instead") -``` -This hides "badflag" from help text, and prints `Flag --badflag has been deprecated, please use --good-flag instead` when "badflag" is used. - -**Example #2**: You want to keep a flag name "noshorthandflag" but deprecate its shortname "n". -```go -// deprecate a flag shorthand by specifying its flag name and a usage message -flags.MarkShorthandDeprecated("noshorthandflag", "please use --noshorthandflag only") -``` -This hides the shortname "n" from help text, and prints `Flag shorthand -n has been deprecated, please use --noshorthandflag only` when the shorthand "n" is used. - -Note that usage message is essential here, and it should not be empty. - -## Hidden flags -It is possible to mark a flag as hidden, meaning it will still function as normal, however will not show up in usage/help text. - -**Example**: You have a flag named "secretFlag" that you need for internal use only and don't want it showing up in help text, or for its usage text to be available. -```go -// hide a flag by specifying its name -flags.MarkHidden("secretFlag") -``` - -## Disable sorting of flags -`pflag` allows you to disable sorting of flags for help and usage message. - -**Example**: -```go -flags.BoolP("verbose", "v", false, "verbose output") -flags.String("coolflag", "yeaah", "it's really cool flag") -flags.Int("usefulflag", 777, "sometimes it's very useful") -flags.SortFlags = false -flags.PrintDefaults() -``` -**Output**: -``` - -v, --verbose verbose output - --coolflag string it's really cool flag (default "yeaah") - --usefulflag int sometimes it's very useful (default 777) -``` - - -## Supporting Go flags when using pflag -In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary -to support flags defined by third-party dependencies (e.g. `golang/glog`). - -**Example**: You want to add the Go flags to the `CommandLine` flagset -```go -import ( - goflag "flag" - flag "github.com/spf13/pflag" -) - -var ip *int = flag.Int("flagname", 1234, "help message for flagname") - -func main() { - flag.CommandLine.AddGoFlagSet(goflag.CommandLine) - flag.Parse() -} -``` - -## More info - -You can see the full reference documentation of the pflag package -[at godoc.org][3], or through go's standard documentation system by -running `godoc -http=:6060` and browsing to -[http://localhost:6060/pkg/github.com/spf13/pflag][2] after -installation. - -[2]: http://localhost:6060/pkg/github.com/spf13/pflag -[3]: http://godoc.org/github.com/spf13/pflag +[![Build Status](https://travis-ci.org/spf13/pflag.svg?branch=master)](https://travis-ci.org/spf13/pflag) +[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/pflag)](https://goreportcard.com/report/github.com/spf13/pflag) +[![GoDoc](https://godoc.org/github.com/spf13/pflag?status.svg)](https://godoc.org/github.com/spf13/pflag) + +## Description + +pflag is a drop-in replacement for Go's flag package, implementing +POSIX/GNU-style --flags. + +pflag is compatible with the [GNU extensions to the POSIX recommendations +for command-line options][1]. For a more precise description, see the +"Command-line flag syntax" section below. + +[1]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html + +pflag is available under the same style of BSD license as the Go language, +which can be found in the LICENSE file. + +## Installation + +pflag is available using the standard `go get` command. + +Install by running: + + go get github.com/spf13/pflag + +Run tests by running: + + go test github.com/spf13/pflag + +## Usage + +pflag is a drop-in replacement of Go's native flag package. If you import +pflag under the name "flag" then all code should continue to function +with no changes. + +``` go +import flag "github.com/spf13/pflag" +``` + +There is one exception to this: if you directly instantiate the Flag struct +there is one more field "Shorthand" that you will need to set. +Most code never instantiates this struct directly, and instead uses +functions such as String(), BoolVar(), and Var(), and is therefore +unaffected. + +Define flags using flag.String(), Bool(), Int(), etc. + +This declares an integer flag, -flagname, stored in the pointer ip, with type *int. + +``` go +var ip *int = flag.Int("flagname", 1234, "help message for flagname") +``` + +If you like, you can bind the flag to a variable using the Var() functions. + +``` go +var flagvar int +func init() { + flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") +} +``` + +Or you can create custom flags that satisfy the Value interface (with +pointer receivers) and couple them to flag parsing by + +``` go +flag.Var(&flagVal, "name", "help message for flagname") +``` + +For such flags, the default value is just the initial value of the variable. + +After all flags are defined, call + +``` go +flag.Parse() +``` + +to parse the command line into the defined flags. + +Flags may then be used directly. If you're using the flags themselves, +they are all pointers; if you bind to variables, they're values. + +``` go +fmt.Println("ip has value ", *ip) +fmt.Println("flagvar has value ", flagvar) +``` + +There are helpers function to get values later if you have the FlagSet but +it was difficult to keep up with all of the flag pointers in your code. +If you have a pflag.FlagSet with a flag called 'flagname' of type int you +can use GetInt() to get the int value. But notice that 'flagname' must exist +and it must be an int. GetString("flagname") will fail. + +``` go +i, err := flagset.GetInt("flagname") +``` + +After parsing, the arguments after the flag are available as the +slice flag.Args() or individually as flag.Arg(i). +The arguments are indexed from 0 through flag.NArg()-1. + +The pflag package also defines some new functions that are not in flag, +that give one-letter shorthands for flags. You can use these by appending +'P' to the name of any function that defines a flag. + +``` go +var ip = flag.IntP("flagname", "f", 1234, "help message") +var flagvar bool +func init() { + flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") +} +flag.VarP(&flagVal, "varname", "v", "help message") +``` + +Shorthand letters can be used with single dashes on the command line. +Boolean shorthand flags can be combined with other shorthand flags. + +The default set of command-line flags is controlled by +top-level functions. The FlagSet type allows one to define +independent sets of flags, such as to implement subcommands +in a command-line interface. The methods of FlagSet are +analogous to the top-level functions for the command-line +flag set. + +## Setting no option default values for flags + +After you create a flag it is possible to set the pflag.NoOptDefVal for +the given flag. Doing this changes the meaning of the flag slightly. If +a flag has a NoOptDefVal and the flag is set on the command line without +an option the flag will be set to the NoOptDefVal. For example given: + +``` go +var ip = flag.IntP("flagname", "f", 1234, "help message") +flag.Lookup("flagname").NoOptDefVal = "4321" +``` + +Would result in something like + +| Parsed Arguments | Resulting Value | +| ------------- | ------------- | +| --flagname=1357 | ip=1357 | +| --flagname | ip=4321 | +| [nothing] | ip=1234 | + +## Command line flag syntax + +``` +--flag // boolean flags, or flags with no option default values +--flag x // only on flags without a default value +--flag=x +``` + +Unlike the flag package, a single dash before an option means something +different than a double dash. Single dashes signify a series of shorthand +letters for flags. All but the last shorthand letter must be boolean flags +or a flag with a default value + +``` +// boolean or flags where the 'no option default value' is set +-f +-f=true +-abc +but +-b true is INVALID + +// non-boolean and flags without a 'no option default value' +-n 1234 +-n=1234 +-n1234 + +// mixed +-abcs "hello" +-absd="hello" +-abcs1234 +``` + +Flag parsing stops after the terminator "--". Unlike the flag package, +flags can be interspersed with arguments anywhere on the command line +before this terminator. + +Integer flags accept 1234, 0664, 0x1234 and may be negative. +Boolean flags (in their long form) accept 1, 0, t, f, true, false, +TRUE, FALSE, True, False. +Duration flags accept any input valid for time.ParseDuration. + +## Mutating or "Normalizing" Flag names + +It is possible to set a custom flag name 'normalization function.' It allows flag names to be mutated both when created in the code and when used on the command line to some 'normalized' form. The 'normalized' form is used for comparison. Two examples of using the custom normalization func follow. + +**Example #1**: You want -, _, and . in flags to compare the same. aka --my-flag == --my_flag == --my.flag + +``` go +func wordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName { + from := []string{"-", "_"} + to := "." + for _, sep := range from { + name = strings.Replace(name, sep, to, -1) + } + return pflag.NormalizedName(name) +} + +myFlagSet.SetNormalizeFunc(wordSepNormalizeFunc) +``` + +**Example #2**: You want to alias two flags. aka --old-flag-name == --new-flag-name + +``` go +func aliasNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName { + switch name { + case "old-flag-name": + name = "new-flag-name" + break + } + return pflag.NormalizedName(name) +} + +myFlagSet.SetNormalizeFunc(aliasNormalizeFunc) +``` + +## Deprecating a flag or its shorthand +It is possible to deprecate a flag, or just its shorthand. Deprecating a flag/shorthand hides it from help text and prints a usage message when the deprecated flag/shorthand is used. + +**Example #1**: You want to deprecate a flag named "badflag" as well as inform the users what flag they should use instead. +```go +// deprecate a flag by specifying its name and a usage message +flags.MarkDeprecated("badflag", "please use --good-flag instead") +``` +This hides "badflag" from help text, and prints `Flag --badflag has been deprecated, please use --good-flag instead` when "badflag" is used. + +**Example #2**: You want to keep a flag name "noshorthandflag" but deprecate its shortname "n". +```go +// deprecate a flag shorthand by specifying its flag name and a usage message +flags.MarkShorthandDeprecated("noshorthandflag", "please use --noshorthandflag only") +``` +This hides the shortname "n" from help text, and prints `Flag shorthand -n has been deprecated, please use --noshorthandflag only` when the shorthand "n" is used. + +Note that usage message is essential here, and it should not be empty. + +## Hidden flags +It is possible to mark a flag as hidden, meaning it will still function as normal, however will not show up in usage/help text. + +**Example**: You have a flag named "secretFlag" that you need for internal use only and don't want it showing up in help text, or for its usage text to be available. +```go +// hide a flag by specifying its name +flags.MarkHidden("secretFlag") +``` + +## Disable sorting of flags +`pflag` allows you to disable sorting of flags for help and usage message. + +**Example**: +```go +flags.BoolP("verbose", "v", false, "verbose output") +flags.String("coolflag", "yeaah", "it's really cool flag") +flags.Int("usefulflag", 777, "sometimes it's very useful") +flags.SortFlags = false +flags.PrintDefaults() +``` +**Output**: +``` + -v, --verbose verbose output + --coolflag string it's really cool flag (default "yeaah") + --usefulflag int sometimes it's very useful (default 777) +``` + + +## Supporting Go flags when using pflag +In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary +to support flags defined by third-party dependencies (e.g. `golang/glog`). + +**Example**: You want to add the Go flags to the `CommandLine` flagset +```go +import ( + goflag "flag" + flag "github.com/spf13/pflag" +) + +var ip *int = flag.Int("flagname", 1234, "help message for flagname") + +func main() { + flag.CommandLine.AddGoFlagSet(goflag.CommandLine) + flag.Parse() +} +``` + +## More info + +You can see the full reference documentation of the pflag package +[at godoc.org][3], or through go's standard documentation system by +running `godoc -http=:6060` and browsing to +[http://localhost:6060/pkg/github.com/spf13/pflag][2] after +installation. + +[2]: http://localhost:6060/pkg/github.com/spf13/pflag +[3]: http://godoc.org/github.com/spf13/pflag diff --git a/vendor/github.com/spf13/pflag/bool.go b/vendor/github.com/spf13/pflag/bool.go index 5b231724af..c4c5c0bfda 100644 --- a/vendor/github.com/spf13/pflag/bool.go +++ b/vendor/github.com/spf13/pflag/bool.go @@ -1,94 +1,94 @@ -package pflag - -import "strconv" - -// optional interface to indicate boolean flags that can be -// supplied without "=value" text -type boolFlag interface { - Value - IsBoolFlag() bool -} - -// -- bool Value -type boolValue bool - -func newBoolValue(val bool, p *bool) *boolValue { - *p = val - return (*boolValue)(p) -} - -func (b *boolValue) Set(s string) error { - v, err := strconv.ParseBool(s) - *b = boolValue(v) - return err -} - -func (b *boolValue) Type() string { - return "bool" -} - -func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) } - -func (b *boolValue) IsBoolFlag() bool { return true } - -func boolConv(sval string) (interface{}, error) { - return strconv.ParseBool(sval) -} - -// GetBool return the bool value of a flag with the given name -func (f *FlagSet) GetBool(name string) (bool, error) { - val, err := f.getFlagType(name, "bool", boolConv) - if err != nil { - return false, err - } - return val.(bool), nil -} - -// BoolVar defines a bool flag with specified name, default value, and usage string. -// The argument p points to a bool variable in which to store the value of the flag. -func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) { - f.BoolVarP(p, name, "", value, usage) -} - -// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) { - flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage) - flag.NoOptDefVal = "true" -} - -// BoolVar defines a bool flag with specified name, default value, and usage string. -// The argument p points to a bool variable in which to store the value of the flag. -func BoolVar(p *bool, name string, value bool, usage string) { - BoolVarP(p, name, "", value, usage) -} - -// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. -func BoolVarP(p *bool, name, shorthand string, value bool, usage string) { - flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage) - flag.NoOptDefVal = "true" -} - -// Bool defines a bool flag with specified name, default value, and usage string. -// The return value is the address of a bool variable that stores the value of the flag. -func (f *FlagSet) Bool(name string, value bool, usage string) *bool { - return f.BoolP(name, "", value, usage) -} - -// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool { - p := new(bool) - f.BoolVarP(p, name, shorthand, value, usage) - return p -} - -// Bool defines a bool flag with specified name, default value, and usage string. -// The return value is the address of a bool variable that stores the value of the flag. -func Bool(name string, value bool, usage string) *bool { - return BoolP(name, "", value, usage) -} - -// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. -func BoolP(name, shorthand string, value bool, usage string) *bool { - b := CommandLine.BoolP(name, shorthand, value, usage) - return b -} +package pflag + +import "strconv" + +// optional interface to indicate boolean flags that can be +// supplied without "=value" text +type boolFlag interface { + Value + IsBoolFlag() bool +} + +// -- bool Value +type boolValue bool + +func newBoolValue(val bool, p *bool) *boolValue { + *p = val + return (*boolValue)(p) +} + +func (b *boolValue) Set(s string) error { + v, err := strconv.ParseBool(s) + *b = boolValue(v) + return err +} + +func (b *boolValue) Type() string { + return "bool" +} + +func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) } + +func (b *boolValue) IsBoolFlag() bool { return true } + +func boolConv(sval string) (interface{}, error) { + return strconv.ParseBool(sval) +} + +// GetBool return the bool value of a flag with the given name +func (f *FlagSet) GetBool(name string) (bool, error) { + val, err := f.getFlagType(name, "bool", boolConv) + if err != nil { + return false, err + } + return val.(bool), nil +} + +// BoolVar defines a bool flag with specified name, default value, and usage string. +// The argument p points to a bool variable in which to store the value of the flag. +func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) { + f.BoolVarP(p, name, "", value, usage) +} + +// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) { + flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage) + flag.NoOptDefVal = "true" +} + +// BoolVar defines a bool flag with specified name, default value, and usage string. +// The argument p points to a bool variable in which to store the value of the flag. +func BoolVar(p *bool, name string, value bool, usage string) { + BoolVarP(p, name, "", value, usage) +} + +// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash. +func BoolVarP(p *bool, name, shorthand string, value bool, usage string) { + flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage) + flag.NoOptDefVal = "true" +} + +// Bool defines a bool flag with specified name, default value, and usage string. +// The return value is the address of a bool variable that stores the value of the flag. +func (f *FlagSet) Bool(name string, value bool, usage string) *bool { + return f.BoolP(name, "", value, usage) +} + +// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool { + p := new(bool) + f.BoolVarP(p, name, shorthand, value, usage) + return p +} + +// Bool defines a bool flag with specified name, default value, and usage string. +// The return value is the address of a bool variable that stores the value of the flag. +func Bool(name string, value bool, usage string) *bool { + return BoolP(name, "", value, usage) +} + +// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash. +func BoolP(name, shorthand string, value bool, usage string) *bool { + b := CommandLine.BoolP(name, shorthand, value, usage) + return b +} diff --git a/vendor/github.com/spf13/pflag/bool_slice.go b/vendor/github.com/spf13/pflag/bool_slice.go index 21246a785c..5af02f1a75 100644 --- a/vendor/github.com/spf13/pflag/bool_slice.go +++ b/vendor/github.com/spf13/pflag/bool_slice.go @@ -1,147 +1,147 @@ -package pflag - -import ( - "io" - "strconv" - "strings" -) - -// -- boolSlice Value -type boolSliceValue struct { - value *[]bool - changed bool -} - -func newBoolSliceValue(val []bool, p *[]bool) *boolSliceValue { - bsv := new(boolSliceValue) - bsv.value = p - *bsv.value = val - return bsv -} - -// Set converts, and assigns, the comma-separated boolean argument string representation as the []bool value of this flag. -// If Set is called on a flag that already has a []bool assigned, the newly converted values will be appended. -func (s *boolSliceValue) Set(val string) error { - - // remove all quote characters - rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") - - // read flag arguments with CSV parser - boolStrSlice, err := readAsCSV(rmQuote.Replace(val)) - if err != nil && err != io.EOF { - return err - } - - // parse boolean values into slice - out := make([]bool, 0, len(boolStrSlice)) - for _, boolStr := range boolStrSlice { - b, err := strconv.ParseBool(strings.TrimSpace(boolStr)) - if err != nil { - return err - } - out = append(out, b) - } - - if !s.changed { - *s.value = out - } else { - *s.value = append(*s.value, out...) - } - - s.changed = true - - return nil -} - -// Type returns a string that uniquely represents this flag's type. -func (s *boolSliceValue) Type() string { - return "boolSlice" -} - -// String defines a "native" format for this boolean slice flag value. -func (s *boolSliceValue) String() string { - - boolStrSlice := make([]string, len(*s.value)) - for i, b := range *s.value { - boolStrSlice[i] = strconv.FormatBool(b) - } - - out, _ := writeAsCSV(boolStrSlice) - - return "[" + out + "]" -} - -func boolSliceConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") - // Empty string would cause a slice with one (empty) entry - if len(val) == 0 { - return []bool{}, nil - } - ss := strings.Split(val, ",") - out := make([]bool, len(ss)) - for i, t := range ss { - var err error - out[i], err = strconv.ParseBool(t) - if err != nil { - return nil, err - } - } - return out, nil -} - -// GetBoolSlice returns the []bool value of a flag with the given name. -func (f *FlagSet) GetBoolSlice(name string) ([]bool, error) { - val, err := f.getFlagType(name, "boolSlice", boolSliceConv) - if err != nil { - return []bool{}, err - } - return val.([]bool), nil -} - -// BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string. -// The argument p points to a []bool variable in which to store the value of the flag. -func (f *FlagSet) BoolSliceVar(p *[]bool, name string, value []bool, usage string) { - f.VarP(newBoolSliceValue(value, p), name, "", usage) -} - -// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) { - f.VarP(newBoolSliceValue(value, p), name, shorthand, usage) -} - -// BoolSliceVar defines a []bool flag with specified name, default value, and usage string. -// The argument p points to a []bool variable in which to store the value of the flag. -func BoolSliceVar(p *[]bool, name string, value []bool, usage string) { - CommandLine.VarP(newBoolSliceValue(value, p), name, "", usage) -} - -// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash. -func BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) { - CommandLine.VarP(newBoolSliceValue(value, p), name, shorthand, usage) -} - -// BoolSlice defines a []bool flag with specified name, default value, and usage string. -// The return value is the address of a []bool variable that stores the value of the flag. -func (f *FlagSet) BoolSlice(name string, value []bool, usage string) *[]bool { - p := []bool{} - f.BoolSliceVarP(&p, name, "", value, usage) - return &p -} - -// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool { - p := []bool{} - f.BoolSliceVarP(&p, name, shorthand, value, usage) - return &p -} - -// BoolSlice defines a []bool flag with specified name, default value, and usage string. -// The return value is the address of a []bool variable that stores the value of the flag. -func BoolSlice(name string, value []bool, usage string) *[]bool { - return CommandLine.BoolSliceP(name, "", value, usage) -} - -// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash. -func BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool { - return CommandLine.BoolSliceP(name, shorthand, value, usage) -} +package pflag + +import ( + "io" + "strconv" + "strings" +) + +// -- boolSlice Value +type boolSliceValue struct { + value *[]bool + changed bool +} + +func newBoolSliceValue(val []bool, p *[]bool) *boolSliceValue { + bsv := new(boolSliceValue) + bsv.value = p + *bsv.value = val + return bsv +} + +// Set converts, and assigns, the comma-separated boolean argument string representation as the []bool value of this flag. +// If Set is called on a flag that already has a []bool assigned, the newly converted values will be appended. +func (s *boolSliceValue) Set(val string) error { + + // remove all quote characters + rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") + + // read flag arguments with CSV parser + boolStrSlice, err := readAsCSV(rmQuote.Replace(val)) + if err != nil && err != io.EOF { + return err + } + + // parse boolean values into slice + out := make([]bool, 0, len(boolStrSlice)) + for _, boolStr := range boolStrSlice { + b, err := strconv.ParseBool(strings.TrimSpace(boolStr)) + if err != nil { + return err + } + out = append(out, b) + } + + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + + s.changed = true + + return nil +} + +// Type returns a string that uniquely represents this flag's type. +func (s *boolSliceValue) Type() string { + return "boolSlice" +} + +// String defines a "native" format for this boolean slice flag value. +func (s *boolSliceValue) String() string { + + boolStrSlice := make([]string, len(*s.value)) + for i, b := range *s.value { + boolStrSlice[i] = strconv.FormatBool(b) + } + + out, _ := writeAsCSV(boolStrSlice) + + return "[" + out + "]" +} + +func boolSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []bool{}, nil + } + ss := strings.Split(val, ",") + out := make([]bool, len(ss)) + for i, t := range ss { + var err error + out[i], err = strconv.ParseBool(t) + if err != nil { + return nil, err + } + } + return out, nil +} + +// GetBoolSlice returns the []bool value of a flag with the given name. +func (f *FlagSet) GetBoolSlice(name string) ([]bool, error) { + val, err := f.getFlagType(name, "boolSlice", boolSliceConv) + if err != nil { + return []bool{}, err + } + return val.([]bool), nil +} + +// BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string. +// The argument p points to a []bool variable in which to store the value of the flag. +func (f *FlagSet) BoolSliceVar(p *[]bool, name string, value []bool, usage string) { + f.VarP(newBoolSliceValue(value, p), name, "", usage) +} + +// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) { + f.VarP(newBoolSliceValue(value, p), name, shorthand, usage) +} + +// BoolSliceVar defines a []bool flag with specified name, default value, and usage string. +// The argument p points to a []bool variable in which to store the value of the flag. +func BoolSliceVar(p *[]bool, name string, value []bool, usage string) { + CommandLine.VarP(newBoolSliceValue(value, p), name, "", usage) +} + +// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash. +func BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) { + CommandLine.VarP(newBoolSliceValue(value, p), name, shorthand, usage) +} + +// BoolSlice defines a []bool flag with specified name, default value, and usage string. +// The return value is the address of a []bool variable that stores the value of the flag. +func (f *FlagSet) BoolSlice(name string, value []bool, usage string) *[]bool { + p := []bool{} + f.BoolSliceVarP(&p, name, "", value, usage) + return &p +} + +// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool { + p := []bool{} + f.BoolSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// BoolSlice defines a []bool flag with specified name, default value, and usage string. +// The return value is the address of a []bool variable that stores the value of the flag. +func BoolSlice(name string, value []bool, usage string) *[]bool { + return CommandLine.BoolSliceP(name, "", value, usage) +} + +// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash. +func BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool { + return CommandLine.BoolSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/bool_slice_test.go b/vendor/github.com/spf13/pflag/bool_slice_test.go index 5abd817186..b617dd237f 100644 --- a/vendor/github.com/spf13/pflag/bool_slice_test.go +++ b/vendor/github.com/spf13/pflag/bool_slice_test.go @@ -1,215 +1,215 @@ -package pflag - -import ( - "fmt" - "strconv" - "strings" - "testing" -) - -func setUpBSFlagSet(bsp *[]bool) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.BoolSliceVar(bsp, "bs", []bool{}, "Command separated list!") - return f -} - -func setUpBSFlagSetWithDefault(bsp *[]bool) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.BoolSliceVar(bsp, "bs", []bool{false, true}, "Command separated list!") - return f -} - -func TestEmptyBS(t *testing.T) { - var bs []bool - f := setUpBSFlagSet(&bs) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getBS, err := f.GetBoolSlice("bs") - if err != nil { - t.Fatal("got an error from GetBoolSlice():", err) - } - if len(getBS) != 0 { - t.Fatalf("got bs %v with len=%d but expected length=0", getBS, len(getBS)) - } -} - -func TestBS(t *testing.T) { - var bs []bool - f := setUpBSFlagSet(&bs) - - vals := []string{"1", "F", "TRUE", "0"} - arg := fmt.Sprintf("--bs=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range bs { - b, err := strconv.ParseBool(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if b != v { - t.Fatalf("expected is[%d] to be %s but got: %t", i, vals[i], v) - } - } - getBS, err := f.GetBoolSlice("bs") - if err != nil { - t.Fatalf("got error: %v", err) - } - for i, v := range getBS { - b, err := strconv.ParseBool(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if b != v { - t.Fatalf("expected bs[%d] to be %s but got: %t from GetBoolSlice", i, vals[i], v) - } - } -} - -func TestBSDefault(t *testing.T) { - var bs []bool - f := setUpBSFlagSetWithDefault(&bs) - - vals := []string{"false", "T"} - - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range bs { - b, err := strconv.ParseBool(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if b != v { - t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v) - } - } - - getBS, err := f.GetBoolSlice("bs") - if err != nil { - t.Fatal("got an error from GetBoolSlice():", err) - } - for i, v := range getBS { - b, err := strconv.ParseBool(vals[i]) - if err != nil { - t.Fatal("got an error from GetBoolSlice():", err) - } - if b != v { - t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v) - } - } -} - -func TestBSWithDefault(t *testing.T) { - var bs []bool - f := setUpBSFlagSetWithDefault(&bs) - - vals := []string{"FALSE", "1"} - arg := fmt.Sprintf("--bs=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range bs { - b, err := strconv.ParseBool(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if b != v { - t.Fatalf("expected bs[%d] to be %t but got: %t", i, b, v) - } - } - - getBS, err := f.GetBoolSlice("bs") - if err != nil { - t.Fatal("got an error from GetBoolSlice():", err) - } - for i, v := range getBS { - b, err := strconv.ParseBool(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if b != v { - t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v) - } - } -} - -func TestBSCalledTwice(t *testing.T) { - var bs []bool - f := setUpBSFlagSet(&bs) - - in := []string{"T,F", "T"} - expected := []bool{true, false, true} - argfmt := "--bs=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range bs { - if expected[i] != v { - t.Fatalf("expected bs[%d] to be %t but got %t", i, expected[i], v) - } - } -} - -func TestBSBadQuoting(t *testing.T) { - - tests := []struct { - Want []bool - FlagArg []string - }{ - { - Want: []bool{true, false, true}, - FlagArg: []string{"1", "0", "true"}, - }, - { - Want: []bool{true, false}, - FlagArg: []string{"True", "F"}, - }, - { - Want: []bool{true, false}, - FlagArg: []string{"T", "0"}, - }, - { - Want: []bool{true, false}, - FlagArg: []string{"1", "0"}, - }, - { - Want: []bool{true, false, false}, - FlagArg: []string{"true,false", "false"}, - }, - { - Want: []bool{true, false, false, true, false, true, false}, - FlagArg: []string{`"true,false,false,1,0, T"`, " false "}, - }, - { - Want: []bool{false, false, true, false, true, false, true}, - FlagArg: []string{`"0, False, T,false , true,F"`, "true"}, - }, - } - - for i, test := range tests { - - var bs []bool - f := setUpBSFlagSet(&bs) - - if err := f.Parse([]string{fmt.Sprintf("--bs=%s", strings.Join(test.FlagArg, ","))}); err != nil { - t.Fatalf("flag parsing failed with error: %s\nparsing:\t%#v\nwant:\t\t%#v", - err, test.FlagArg, test.Want[i]) - } - - for j, b := range bs { - if b != test.Want[j] { - t.Fatalf("bad value parsed for test %d on bool %d:\nwant:\t%t\ngot:\t%t", i, j, test.Want[j], b) - } - } - } -} +package pflag + +import ( + "fmt" + "strconv" + "strings" + "testing" +) + +func setUpBSFlagSet(bsp *[]bool) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.BoolSliceVar(bsp, "bs", []bool{}, "Command separated list!") + return f +} + +func setUpBSFlagSetWithDefault(bsp *[]bool) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.BoolSliceVar(bsp, "bs", []bool{false, true}, "Command separated list!") + return f +} + +func TestEmptyBS(t *testing.T) { + var bs []bool + f := setUpBSFlagSet(&bs) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getBS, err := f.GetBoolSlice("bs") + if err != nil { + t.Fatal("got an error from GetBoolSlice():", err) + } + if len(getBS) != 0 { + t.Fatalf("got bs %v with len=%d but expected length=0", getBS, len(getBS)) + } +} + +func TestBS(t *testing.T) { + var bs []bool + f := setUpBSFlagSet(&bs) + + vals := []string{"1", "F", "TRUE", "0"} + arg := fmt.Sprintf("--bs=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range bs { + b, err := strconv.ParseBool(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if b != v { + t.Fatalf("expected is[%d] to be %s but got: %t", i, vals[i], v) + } + } + getBS, err := f.GetBoolSlice("bs") + if err != nil { + t.Fatalf("got error: %v", err) + } + for i, v := range getBS { + b, err := strconv.ParseBool(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if b != v { + t.Fatalf("expected bs[%d] to be %s but got: %t from GetBoolSlice", i, vals[i], v) + } + } +} + +func TestBSDefault(t *testing.T) { + var bs []bool + f := setUpBSFlagSetWithDefault(&bs) + + vals := []string{"false", "T"} + + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range bs { + b, err := strconv.ParseBool(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if b != v { + t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v) + } + } + + getBS, err := f.GetBoolSlice("bs") + if err != nil { + t.Fatal("got an error from GetBoolSlice():", err) + } + for i, v := range getBS { + b, err := strconv.ParseBool(vals[i]) + if err != nil { + t.Fatal("got an error from GetBoolSlice():", err) + } + if b != v { + t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v) + } + } +} + +func TestBSWithDefault(t *testing.T) { + var bs []bool + f := setUpBSFlagSetWithDefault(&bs) + + vals := []string{"FALSE", "1"} + arg := fmt.Sprintf("--bs=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range bs { + b, err := strconv.ParseBool(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if b != v { + t.Fatalf("expected bs[%d] to be %t but got: %t", i, b, v) + } + } + + getBS, err := f.GetBoolSlice("bs") + if err != nil { + t.Fatal("got an error from GetBoolSlice():", err) + } + for i, v := range getBS { + b, err := strconv.ParseBool(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if b != v { + t.Fatalf("expected bs[%d] to be %t from GetBoolSlice but got: %t", i, b, v) + } + } +} + +func TestBSCalledTwice(t *testing.T) { + var bs []bool + f := setUpBSFlagSet(&bs) + + in := []string{"T,F", "T"} + expected := []bool{true, false, true} + argfmt := "--bs=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range bs { + if expected[i] != v { + t.Fatalf("expected bs[%d] to be %t but got %t", i, expected[i], v) + } + } +} + +func TestBSBadQuoting(t *testing.T) { + + tests := []struct { + Want []bool + FlagArg []string + }{ + { + Want: []bool{true, false, true}, + FlagArg: []string{"1", "0", "true"}, + }, + { + Want: []bool{true, false}, + FlagArg: []string{"True", "F"}, + }, + { + Want: []bool{true, false}, + FlagArg: []string{"T", "0"}, + }, + { + Want: []bool{true, false}, + FlagArg: []string{"1", "0"}, + }, + { + Want: []bool{true, false, false}, + FlagArg: []string{"true,false", "false"}, + }, + { + Want: []bool{true, false, false, true, false, true, false}, + FlagArg: []string{`"true,false,false,1,0, T"`, " false "}, + }, + { + Want: []bool{false, false, true, false, true, false, true}, + FlagArg: []string{`"0, False, T,false , true,F"`, "true"}, + }, + } + + for i, test := range tests { + + var bs []bool + f := setUpBSFlagSet(&bs) + + if err := f.Parse([]string{fmt.Sprintf("--bs=%s", strings.Join(test.FlagArg, ","))}); err != nil { + t.Fatalf("flag parsing failed with error: %s\nparsing:\t%#v\nwant:\t\t%#v", + err, test.FlagArg, test.Want[i]) + } + + for j, b := range bs { + if b != test.Want[j] { + t.Fatalf("bad value parsed for test %d on bool %d:\nwant:\t%t\ngot:\t%t", i, j, test.Want[j], b) + } + } + } +} diff --git a/vendor/github.com/spf13/pflag/bool_test.go b/vendor/github.com/spf13/pflag/bool_test.go index c8a372de5f..a4319e79fc 100644 --- a/vendor/github.com/spf13/pflag/bool_test.go +++ b/vendor/github.com/spf13/pflag/bool_test.go @@ -1,179 +1,179 @@ -// 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 pflag - -import ( - "bytes" - "strconv" - "testing" -) - -// This value can be a boolean ("true", "false") or "maybe" -type triStateValue int - -const ( - triStateFalse triStateValue = 0 - triStateTrue triStateValue = 1 - triStateMaybe triStateValue = 2 -) - -const strTriStateMaybe = "maybe" - -func (v *triStateValue) IsBoolFlag() bool { - return true -} - -func (v *triStateValue) Get() interface{} { - return triStateValue(*v) -} - -func (v *triStateValue) Set(s string) error { - if s == strTriStateMaybe { - *v = triStateMaybe - return nil - } - boolVal, err := strconv.ParseBool(s) - if boolVal { - *v = triStateTrue - } else { - *v = triStateFalse - } - return err -} - -func (v *triStateValue) String() string { - if *v == triStateMaybe { - return strTriStateMaybe - } - return strconv.FormatBool(*v == triStateTrue) -} - -// The type of the flag as required by the pflag.Value interface -func (v *triStateValue) Type() string { - return "version" -} - -func setUpFlagSet(tristate *triStateValue) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - *tristate = triStateFalse - flag := f.VarPF(tristate, "tristate", "t", "tristate value (true, maybe or false)") - flag.NoOptDefVal = "true" - return f -} - -func TestExplicitTrue(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - err := f.Parse([]string{"--tristate=true"}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateTrue { - t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") - } -} - -func TestImplicitTrue(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - err := f.Parse([]string{"--tristate"}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateTrue { - t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") - } -} - -func TestShortFlag(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - err := f.Parse([]string{"-t"}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateTrue { - t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") - } -} - -func TestShortFlagExtraArgument(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - // The"maybe"turns into an arg, since short boolean options will only do true/false - err := f.Parse([]string{"-t", "maybe"}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateTrue { - t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") - } - args := f.Args() - if len(args) != 1 || args[0] != "maybe" { - t.Fatal("expected an extra 'maybe' argument to stick around") - } -} - -func TestExplicitMaybe(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - err := f.Parse([]string{"--tristate=maybe"}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateMaybe { - t.Fatal("expected", triStateMaybe, "(triStateMaybe) but got", tristate, "instead") - } -} - -func TestExplicitFalse(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - err := f.Parse([]string{"--tristate=false"}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateFalse { - t.Fatal("expected", triStateFalse, "(triStateFalse) but got", tristate, "instead") - } -} - -func TestImplicitFalse(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - if tristate != triStateFalse { - t.Fatal("expected", triStateFalse, "(triStateFalse) but got", tristate, "instead") - } -} - -func TestInvalidValue(t *testing.T) { - var tristate triStateValue - f := setUpFlagSet(&tristate) - var buf bytes.Buffer - f.SetOutput(&buf) - err := f.Parse([]string{"--tristate=invalid"}) - if err == nil { - t.Fatal("expected an error but did not get any, tristate has value", tristate) - } -} - -func TestBoolP(t *testing.T) { - b := BoolP("bool", "b", false, "bool value in CommandLine") - c := BoolP("c", "c", false, "other bool value") - args := []string{"--bool"} - if err := CommandLine.Parse(args); err != nil { - t.Error("expected no error, got ", err) - } - if *b != true { - t.Errorf("expected b=true got b=%v", *b) - } - if *c != false { - t.Errorf("expect c=false got c=%v", *c) - } -} +// 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 pflag + +import ( + "bytes" + "strconv" + "testing" +) + +// This value can be a boolean ("true", "false") or "maybe" +type triStateValue int + +const ( + triStateFalse triStateValue = 0 + triStateTrue triStateValue = 1 + triStateMaybe triStateValue = 2 +) + +const strTriStateMaybe = "maybe" + +func (v *triStateValue) IsBoolFlag() bool { + return true +} + +func (v *triStateValue) Get() interface{} { + return triStateValue(*v) +} + +func (v *triStateValue) Set(s string) error { + if s == strTriStateMaybe { + *v = triStateMaybe + return nil + } + boolVal, err := strconv.ParseBool(s) + if boolVal { + *v = triStateTrue + } else { + *v = triStateFalse + } + return err +} + +func (v *triStateValue) String() string { + if *v == triStateMaybe { + return strTriStateMaybe + } + return strconv.FormatBool(*v == triStateTrue) +} + +// The type of the flag as required by the pflag.Value interface +func (v *triStateValue) Type() string { + return "version" +} + +func setUpFlagSet(tristate *triStateValue) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + *tristate = triStateFalse + flag := f.VarPF(tristate, "tristate", "t", "tristate value (true, maybe or false)") + flag.NoOptDefVal = "true" + return f +} + +func TestExplicitTrue(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + err := f.Parse([]string{"--tristate=true"}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateTrue { + t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") + } +} + +func TestImplicitTrue(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + err := f.Parse([]string{"--tristate"}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateTrue { + t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") + } +} + +func TestShortFlag(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + err := f.Parse([]string{"-t"}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateTrue { + t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") + } +} + +func TestShortFlagExtraArgument(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + // The"maybe"turns into an arg, since short boolean options will only do true/false + err := f.Parse([]string{"-t", "maybe"}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateTrue { + t.Fatal("expected", triStateTrue, "(triStateTrue) but got", tristate, "instead") + } + args := f.Args() + if len(args) != 1 || args[0] != "maybe" { + t.Fatal("expected an extra 'maybe' argument to stick around") + } +} + +func TestExplicitMaybe(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + err := f.Parse([]string{"--tristate=maybe"}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateMaybe { + t.Fatal("expected", triStateMaybe, "(triStateMaybe) but got", tristate, "instead") + } +} + +func TestExplicitFalse(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + err := f.Parse([]string{"--tristate=false"}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateFalse { + t.Fatal("expected", triStateFalse, "(triStateFalse) but got", tristate, "instead") + } +} + +func TestImplicitFalse(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + if tristate != triStateFalse { + t.Fatal("expected", triStateFalse, "(triStateFalse) but got", tristate, "instead") + } +} + +func TestInvalidValue(t *testing.T) { + var tristate triStateValue + f := setUpFlagSet(&tristate) + var buf bytes.Buffer + f.SetOutput(&buf) + err := f.Parse([]string{"--tristate=invalid"}) + if err == nil { + t.Fatal("expected an error but did not get any, tristate has value", tristate) + } +} + +func TestBoolP(t *testing.T) { + b := BoolP("bool", "b", false, "bool value in CommandLine") + c := BoolP("c", "c", false, "other bool value") + args := []string{"--bool"} + if err := CommandLine.Parse(args); err != nil { + t.Error("expected no error, got ", err) + } + if *b != true { + t.Errorf("expected b=true got b=%v", *b) + } + if *c != false { + t.Errorf("expect c=false got c=%v", *c) + } +} diff --git a/vendor/github.com/spf13/pflag/count.go b/vendor/github.com/spf13/pflag/count.go index d0a0f64b5b..250a43814c 100644 --- a/vendor/github.com/spf13/pflag/count.go +++ b/vendor/github.com/spf13/pflag/count.go @@ -1,96 +1,96 @@ -package pflag - -import "strconv" - -// -- count Value -type countValue int - -func newCountValue(val int, p *int) *countValue { - *p = val - return (*countValue)(p) -} - -func (i *countValue) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 64) - // -1 means that no specific value was passed, so increment - if v == -1 { - *i = countValue(*i + 1) - } else { - *i = countValue(v) - } - return err -} - -func (i *countValue) Type() string { - return "count" -} - -func (i *countValue) String() string { return strconv.Itoa(int(*i)) } - -func countConv(sval string) (interface{}, error) { - i, err := strconv.Atoi(sval) - if err != nil { - return nil, err - } - return i, nil -} - -// GetCount return the int value of a flag with the given name -func (f *FlagSet) GetCount(name string) (int, error) { - val, err := f.getFlagType(name, "count", countConv) - if err != nil { - return 0, err - } - return val.(int), nil -} - -// CountVar defines a count flag with specified name, default value, and usage string. -// The argument p points to an int variable in which to store the value of the flag. -// A count flag will add 1 to its value evey time it is found on the command line -func (f *FlagSet) CountVar(p *int, name string, usage string) { - f.CountVarP(p, name, "", usage) -} - -// CountVarP is like CountVar only take a shorthand for the flag name. -func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) { - flag := f.VarPF(newCountValue(0, p), name, shorthand, usage) - flag.NoOptDefVal = "-1" -} - -// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set -func CountVar(p *int, name string, usage string) { - CommandLine.CountVar(p, name, usage) -} - -// CountVarP is like CountVar only take a shorthand for the flag name. -func CountVarP(p *int, name, shorthand string, usage string) { - CommandLine.CountVarP(p, name, shorthand, usage) -} - -// Count defines a count flag with specified name, default value, and usage string. -// The return value is the address of an int variable that stores the value of the flag. -// A count flag will add 1 to its value evey time it is found on the command line -func (f *FlagSet) Count(name string, usage string) *int { - p := new(int) - f.CountVarP(p, name, "", usage) - return p -} - -// CountP is like Count only takes a shorthand for the flag name. -func (f *FlagSet) CountP(name, shorthand string, usage string) *int { - p := new(int) - f.CountVarP(p, name, shorthand, usage) - return p -} - -// Count defines a count flag with specified name, default value, and usage string. -// The return value is the address of an int variable that stores the value of the flag. -// A count flag will add 1 to its value evey time it is found on the command line -func Count(name string, usage string) *int { - return CommandLine.CountP(name, "", usage) -} - -// CountP is like Count only takes a shorthand for the flag name. -func CountP(name, shorthand string, usage string) *int { - return CommandLine.CountP(name, shorthand, usage) -} +package pflag + +import "strconv" + +// -- count Value +type countValue int + +func newCountValue(val int, p *int) *countValue { + *p = val + return (*countValue)(p) +} + +func (i *countValue) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 64) + // -1 means that no specific value was passed, so increment + if v == -1 { + *i = countValue(*i + 1) + } else { + *i = countValue(v) + } + return err +} + +func (i *countValue) Type() string { + return "count" +} + +func (i *countValue) String() string { return strconv.Itoa(int(*i)) } + +func countConv(sval string) (interface{}, error) { + i, err := strconv.Atoi(sval) + if err != nil { + return nil, err + } + return i, nil +} + +// GetCount return the int value of a flag with the given name +func (f *FlagSet) GetCount(name string) (int, error) { + val, err := f.getFlagType(name, "count", countConv) + if err != nil { + return 0, err + } + return val.(int), nil +} + +// CountVar defines a count flag with specified name, default value, and usage string. +// The argument p points to an int variable in which to store the value of the flag. +// A count flag will add 1 to its value evey time it is found on the command line +func (f *FlagSet) CountVar(p *int, name string, usage string) { + f.CountVarP(p, name, "", usage) +} + +// CountVarP is like CountVar only take a shorthand for the flag name. +func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) { + flag := f.VarPF(newCountValue(0, p), name, shorthand, usage) + flag.NoOptDefVal = "-1" +} + +// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set +func CountVar(p *int, name string, usage string) { + CommandLine.CountVar(p, name, usage) +} + +// CountVarP is like CountVar only take a shorthand for the flag name. +func CountVarP(p *int, name, shorthand string, usage string) { + CommandLine.CountVarP(p, name, shorthand, usage) +} + +// Count defines a count flag with specified name, default value, and usage string. +// The return value is the address of an int variable that stores the value of the flag. +// A count flag will add 1 to its value evey time it is found on the command line +func (f *FlagSet) Count(name string, usage string) *int { + p := new(int) + f.CountVarP(p, name, "", usage) + return p +} + +// CountP is like Count only takes a shorthand for the flag name. +func (f *FlagSet) CountP(name, shorthand string, usage string) *int { + p := new(int) + f.CountVarP(p, name, shorthand, usage) + return p +} + +// Count defines a count flag with specified name, default value, and usage string. +// The return value is the address of an int variable that stores the value of the flag. +// A count flag will add 1 to its value evey time it is found on the command line +func Count(name string, usage string) *int { + return CommandLine.CountP(name, "", usage) +} + +// CountP is like Count only takes a shorthand for the flag name. +func CountP(name, shorthand string, usage string) *int { + return CommandLine.CountP(name, shorthand, usage) +} diff --git a/vendor/github.com/spf13/pflag/count_test.go b/vendor/github.com/spf13/pflag/count_test.go index c93d76f14a..460d96a6f1 100644 --- a/vendor/github.com/spf13/pflag/count_test.go +++ b/vendor/github.com/spf13/pflag/count_test.go @@ -1,52 +1,52 @@ -package pflag - -import ( - "os" - "testing" -) - -func setUpCount(c *int) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.CountVarP(c, "verbose", "v", "a counter") - return f -} - -func TestCount(t *testing.T) { - testCases := []struct { - input []string - success bool - expected int - }{ - {[]string{"-vvv"}, true, 3}, - {[]string{"-v", "-v", "-v"}, true, 3}, - {[]string{"-v", "--verbose", "-v"}, true, 3}, - {[]string{"-v=3", "-v"}, true, 4}, - {[]string{"-v=a"}, false, 0}, - } - - devnull, _ := os.Open(os.DevNull) - os.Stderr = devnull - for i := range testCases { - var count int - f := setUpCount(&count) - - tc := &testCases[i] - - err := f.Parse(tc.input) - if err != nil && tc.success == true { - t.Errorf("expected success, got %q", err) - continue - } else if err == nil && tc.success == false { - t.Errorf("expected failure, got success") - continue - } else if tc.success { - c, err := f.GetCount("verbose") - if err != nil { - t.Errorf("Got error trying to fetch the counter flag") - } - if c != tc.expected { - t.Errorf("expected %q, got %q", tc.expected, c) - } - } - } -} +package pflag + +import ( + "os" + "testing" +) + +func setUpCount(c *int) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.CountVarP(c, "verbose", "v", "a counter") + return f +} + +func TestCount(t *testing.T) { + testCases := []struct { + input []string + success bool + expected int + }{ + {[]string{"-vvv"}, true, 3}, + {[]string{"-v", "-v", "-v"}, true, 3}, + {[]string{"-v", "--verbose", "-v"}, true, 3}, + {[]string{"-v=3", "-v"}, true, 4}, + {[]string{"-v=a"}, false, 0}, + } + + devnull, _ := os.Open(os.DevNull) + os.Stderr = devnull + for i := range testCases { + var count int + f := setUpCount(&count) + + tc := &testCases[i] + + err := f.Parse(tc.input) + if err != nil && tc.success == true { + t.Errorf("expected success, got %q", err) + continue + } else if err == nil && tc.success == false { + t.Errorf("expected failure, got success") + continue + } else if tc.success { + c, err := f.GetCount("verbose") + if err != nil { + t.Errorf("Got error trying to fetch the counter flag") + } + if c != tc.expected { + t.Errorf("expected %q, got %q", tc.expected, c) + } + } + } +} diff --git a/vendor/github.com/spf13/pflag/duration.go b/vendor/github.com/spf13/pflag/duration.go index 93a0a1d8d9..e9debef88e 100644 --- a/vendor/github.com/spf13/pflag/duration.go +++ b/vendor/github.com/spf13/pflag/duration.go @@ -1,86 +1,86 @@ -package pflag - -import ( - "time" -) - -// -- time.Duration Value -type durationValue time.Duration - -func newDurationValue(val time.Duration, p *time.Duration) *durationValue { - *p = val - return (*durationValue)(p) -} - -func (d *durationValue) Set(s string) error { - v, err := time.ParseDuration(s) - *d = durationValue(v) - return err -} - -func (d *durationValue) Type() string { - return "duration" -} - -func (d *durationValue) String() string { return (*time.Duration)(d).String() } - -func durationConv(sval string) (interface{}, error) { - return time.ParseDuration(sval) -} - -// GetDuration return the duration value of a flag with the given name -func (f *FlagSet) GetDuration(name string) (time.Duration, error) { - val, err := f.getFlagType(name, "duration", durationConv) - if err != nil { - return 0, err - } - return val.(time.Duration), nil -} - -// DurationVar defines a time.Duration flag with specified name, default value, and usage string. -// The argument p points to a time.Duration variable in which to store the value of the flag. -func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) { - f.VarP(newDurationValue(value, p), name, "", usage) -} - -// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) { - f.VarP(newDurationValue(value, p), name, shorthand, usage) -} - -// DurationVar defines a time.Duration flag with specified name, default value, and usage string. -// The argument p points to a time.Duration variable in which to store the value of the flag. -func DurationVar(p *time.Duration, name string, value time.Duration, usage string) { - CommandLine.VarP(newDurationValue(value, p), name, "", usage) -} - -// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. -func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) { - CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage) -} - -// Duration defines a time.Duration flag with specified name, default value, and usage string. -// The return value is the address of a time.Duration variable that stores the value of the flag. -func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration { - p := new(time.Duration) - f.DurationVarP(p, name, "", value, usage) - return p -} - -// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration { - p := new(time.Duration) - f.DurationVarP(p, name, shorthand, value, usage) - return p -} - -// Duration defines a time.Duration flag with specified name, default value, and usage string. -// The return value is the address of a time.Duration variable that stores the value of the flag. -func Duration(name string, value time.Duration, usage string) *time.Duration { - return CommandLine.DurationP(name, "", value, usage) -} - -// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. -func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration { - return CommandLine.DurationP(name, shorthand, value, usage) -} +package pflag + +import ( + "time" +) + +// -- time.Duration Value +type durationValue time.Duration + +func newDurationValue(val time.Duration, p *time.Duration) *durationValue { + *p = val + return (*durationValue)(p) +} + +func (d *durationValue) Set(s string) error { + v, err := time.ParseDuration(s) + *d = durationValue(v) + return err +} + +func (d *durationValue) Type() string { + return "duration" +} + +func (d *durationValue) String() string { return (*time.Duration)(d).String() } + +func durationConv(sval string) (interface{}, error) { + return time.ParseDuration(sval) +} + +// GetDuration return the duration value of a flag with the given name +func (f *FlagSet) GetDuration(name string) (time.Duration, error) { + val, err := f.getFlagType(name, "duration", durationConv) + if err != nil { + return 0, err + } + return val.(time.Duration), nil +} + +// DurationVar defines a time.Duration flag with specified name, default value, and usage string. +// The argument p points to a time.Duration variable in which to store the value of the flag. +func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) { + f.VarP(newDurationValue(value, p), name, "", usage) +} + +// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) { + f.VarP(newDurationValue(value, p), name, shorthand, usage) +} + +// DurationVar defines a time.Duration flag with specified name, default value, and usage string. +// The argument p points to a time.Duration variable in which to store the value of the flag. +func DurationVar(p *time.Duration, name string, value time.Duration, usage string) { + CommandLine.VarP(newDurationValue(value, p), name, "", usage) +} + +// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash. +func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) { + CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage) +} + +// Duration defines a time.Duration flag with specified name, default value, and usage string. +// The return value is the address of a time.Duration variable that stores the value of the flag. +func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration { + p := new(time.Duration) + f.DurationVarP(p, name, "", value, usage) + return p +} + +// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration { + p := new(time.Duration) + f.DurationVarP(p, name, shorthand, value, usage) + return p +} + +// Duration defines a time.Duration flag with specified name, default value, and usage string. +// The return value is the address of a time.Duration variable that stores the value of the flag. +func Duration(name string, value time.Duration, usage string) *time.Duration { + return CommandLine.DurationP(name, "", value, usage) +} + +// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash. +func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration { + return CommandLine.DurationP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/example_test.go b/vendor/github.com/spf13/pflag/example_test.go index c2e23cccc0..abd7806fad 100644 --- a/vendor/github.com/spf13/pflag/example_test.go +++ b/vendor/github.com/spf13/pflag/example_test.go @@ -1,36 +1,36 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pflag_test - -import ( - "fmt" - - "github.com/spf13/pflag" -) - -func ExampleShorthandLookup() { - name := "verbose" - short := name[:1] - - pflag.BoolP(name, short, false, "verbose output") - - // len(short) must be == 1 - flag := pflag.ShorthandLookup(short) - - fmt.Println(flag.Name) -} - -func ExampleFlagSet_ShorthandLookup() { - name := "verbose" - short := name[:1] - - fs := pflag.NewFlagSet("Example", pflag.ContinueOnError) - fs.BoolP(name, short, false, "verbose output") - - // len(short) must be == 1 - flag := fs.ShorthandLookup(short) - - fmt.Println(flag.Name) -} +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pflag_test + +import ( + "fmt" + + "github.com/spf13/pflag" +) + +func ExampleShorthandLookup() { + name := "verbose" + short := name[:1] + + pflag.BoolP(name, short, false, "verbose output") + + // len(short) must be == 1 + flag := pflag.ShorthandLookup(short) + + fmt.Println(flag.Name) +} + +func ExampleFlagSet_ShorthandLookup() { + name := "verbose" + short := name[:1] + + fs := pflag.NewFlagSet("Example", pflag.ContinueOnError) + fs.BoolP(name, short, false, "verbose output") + + // len(short) must be == 1 + flag := fs.ShorthandLookup(short) + + fmt.Println(flag.Name) +} diff --git a/vendor/github.com/spf13/pflag/export_test.go b/vendor/github.com/spf13/pflag/export_test.go index 69d5320e7c..9318fee00e 100644 --- a/vendor/github.com/spf13/pflag/export_test.go +++ b/vendor/github.com/spf13/pflag/export_test.go @@ -1,29 +1,29 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pflag - -import ( - "io/ioutil" - "os" -) - -// Additional routines compiled into the package only during testing. - -// ResetForTesting clears all flag state and sets the usage function as directed. -// After calling ResetForTesting, parse errors in flag handling will not -// exit the program. -func ResetForTesting(usage func()) { - CommandLine = &FlagSet{ - name: os.Args[0], - errorHandling: ContinueOnError, - output: ioutil.Discard, - } - Usage = usage -} - -// GetCommandLine returns the default FlagSet. -func GetCommandLine() *FlagSet { - return CommandLine -} +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package pflag + +import ( + "io/ioutil" + "os" +) + +// Additional routines compiled into the package only during testing. + +// ResetForTesting clears all flag state and sets the usage function as directed. +// After calling ResetForTesting, parse errors in flag handling will not +// exit the program. +func ResetForTesting(usage func()) { + CommandLine = &FlagSet{ + name: os.Args[0], + errorHandling: ContinueOnError, + output: ioutil.Discard, + } + Usage = usage +} + +// GetCommandLine returns the default FlagSet. +func GetCommandLine() *FlagSet { + return CommandLine +} diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index 5d4f148ae1..6f1fc3007a 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -1,1128 +1,1128 @@ -// 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 pflag is a drop-in replacement for Go's flag package, implementing -POSIX/GNU-style --flags. - -pflag is compatible with the GNU extensions to the POSIX recommendations -for command-line options. See -http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html - -Usage: - -pflag is a drop-in replacement of Go's native flag package. If you import -pflag under the name "flag" then all code should continue to function -with no changes. - - import flag "github.com/spf13/pflag" - -There is one exception to this: if you directly instantiate the Flag struct -there is one more field "Shorthand" that you will need to set. -Most code never instantiates this struct directly, and instead uses -functions such as String(), BoolVar(), and Var(), and is therefore -unaffected. - -Define flags using flag.String(), Bool(), Int(), etc. - -This declares an integer flag, -flagname, stored in the pointer ip, with type *int. - var ip = flag.Int("flagname", 1234, "help message for flagname") -If you like, you can bind the flag to a variable using the Var() functions. - var flagvar int - func init() { - flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") - } -Or you can create custom flags that satisfy the Value interface (with -pointer receivers) and couple them to flag parsing by - flag.Var(&flagVal, "name", "help message for flagname") -For such flags, the default value is just the initial value of the variable. - -After all flags are defined, call - flag.Parse() -to parse the command line into the defined flags. - -Flags may then be used directly. If you're using the flags themselves, -they are all pointers; if you bind to variables, they're values. - fmt.Println("ip has value ", *ip) - fmt.Println("flagvar has value ", flagvar) - -After parsing, the arguments after the flag are available as the -slice flag.Args() or individually as flag.Arg(i). -The arguments are indexed from 0 through flag.NArg()-1. - -The pflag package also defines some new functions that are not in flag, -that give one-letter shorthands for flags. You can use these by appending -'P' to the name of any function that defines a flag. - var ip = flag.IntP("flagname", "f", 1234, "help message") - var flagvar bool - func init() { - flag.BoolVarP("boolname", "b", true, "help message") - } - flag.VarP(&flagVar, "varname", "v", 1234, "help message") -Shorthand letters can be used with single dashes on the command line. -Boolean shorthand flags can be combined with other shorthand flags. - -Command line flag syntax: - --flag // boolean flags only - --flag=x - -Unlike the flag package, a single dash before an option means something -different than a double dash. Single dashes signify a series of shorthand -letters for flags. All but the last shorthand letter must be boolean flags. - // boolean flags - -f - -abc - // non-boolean flags - -n 1234 - -Ifile - // mixed - -abcs "hello" - -abcn1234 - -Flag parsing stops after the terminator "--". Unlike the flag package, -flags can be interspersed with arguments anywhere on the command line -before this terminator. - -Integer flags accept 1234, 0664, 0x1234 and may be negative. -Boolean flags (in their long form) accept 1, 0, t, f, true, false, -TRUE, FALSE, True, False. -Duration flags accept any input valid for time.ParseDuration. - -The default set of command-line flags is controlled by -top-level functions. The FlagSet type allows one to define -independent sets of flags, such as to implement subcommands -in a command-line interface. The methods of FlagSet are -analogous to the top-level functions for the command-line -flag set. -*/ -package pflag - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - "sort" - "strings" -) - -// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined. -var ErrHelp = errors.New("pflag: help requested") - -// ErrorHandling defines how to handle flag parsing errors. -type ErrorHandling int - -const ( - // ContinueOnError will return an err from Parse() if an error is found - ContinueOnError ErrorHandling = iota - // ExitOnError will call os.Exit(2) if an error is found when parsing - ExitOnError - // PanicOnError will panic() if an error is found when parsing flags - PanicOnError -) - -// NormalizedName is a flag name that has been normalized according to rules -// for the FlagSet (e.g. making '-' and '_' equivalent). -type NormalizedName string - -// A FlagSet represents a set of defined flags. -type FlagSet struct { - // Usage is the function called when an error occurs while parsing flags. - // The field is a function (not a method) that may be changed to point to - // a custom error handler. - Usage func() - - // SortFlags is used to indicate, if user wants to have sorted flags in - // help/usage messages. - SortFlags bool - - name string - parsed bool - actual map[NormalizedName]*Flag - orderedActual []*Flag - sortedActual []*Flag - formal map[NormalizedName]*Flag - orderedFormal []*Flag - sortedFormal []*Flag - shorthands map[byte]*Flag - args []string // arguments after flags - argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no -- - errorHandling ErrorHandling - output io.Writer // nil means stderr; use out() accessor - interspersed bool // allow interspersed option/non-option args - normalizeNameFunc func(f *FlagSet, name string) NormalizedName -} - -// A Flag represents the state of a flag. -type Flag struct { - Name string // name as it appears on command line - Shorthand string // one-letter abbreviated flag - Usage string // help message - Value Value // value as set - DefValue string // default value (as text); for usage message - Changed bool // If the user set the value (or if left to default) - NoOptDefVal string // default value (as text); if the flag is on the command line without any options - Deprecated string // If this flag is deprecated, this string is the new or now thing to use - Hidden bool // used by cobra.Command to allow flags to be hidden from help/usage text - ShorthandDeprecated string // If the shorthand of this flag is deprecated, this string is the new or now thing to use - Annotations map[string][]string // used by cobra.Command bash autocomple code -} - -// Value is the interface to the dynamic value stored in a flag. -// (The default value is represented as a string.) -type Value interface { - String() string - Set(string) error - Type() string -} - -// sortFlags returns the flags as a slice in lexicographical sorted order. -func sortFlags(flags map[NormalizedName]*Flag) []*Flag { - list := make(sort.StringSlice, len(flags)) - i := 0 - for k := range flags { - list[i] = string(k) - i++ - } - list.Sort() - result := make([]*Flag, len(list)) - for i, name := range list { - result[i] = flags[NormalizedName(name)] - } - return result -} - -// SetNormalizeFunc allows you to add a function which can translate flag names. -// Flags added to the FlagSet will be translated and then when anything tries to -// look up the flag that will also be translated. So it would be possible to create -// a flag named "getURL" and have it translated to "geturl". A user could then pass -// "--getUrl" which may also be translated to "geturl" and everything will work. -func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) { - f.normalizeNameFunc = n - f.sortedFormal = f.sortedFormal[:0] - for k, v := range f.orderedFormal { - delete(f.formal, NormalizedName(v.Name)) - nname := f.normalizeFlagName(v.Name) - v.Name = string(nname) - f.formal[nname] = v - f.orderedFormal[k] = v - } -} - -// GetNormalizeFunc returns the previously set NormalizeFunc of a function which -// does no translation, if not set previously. -func (f *FlagSet) GetNormalizeFunc() func(f *FlagSet, name string) NormalizedName { - if f.normalizeNameFunc != nil { - return f.normalizeNameFunc - } - return func(f *FlagSet, name string) NormalizedName { return NormalizedName(name) } -} - -func (f *FlagSet) normalizeFlagName(name string) NormalizedName { - n := f.GetNormalizeFunc() - return n(f, name) -} - -func (f *FlagSet) out() io.Writer { - if f.output == nil { - return os.Stderr - } - return f.output -} - -// SetOutput sets the destination for usage and error messages. -// If output is nil, os.Stderr is used. -func (f *FlagSet) SetOutput(output io.Writer) { - f.output = output -} - -// VisitAll visits the flags in lexicographical order or -// in primordial order if f.SortFlags is false, calling fn for each. -// It visits all flags, even those not set. -func (f *FlagSet) VisitAll(fn func(*Flag)) { - if len(f.formal) == 0 { - return - } - - var flags []*Flag - if f.SortFlags { - if len(f.formal) != len(f.sortedFormal) { - f.sortedFormal = sortFlags(f.formal) - } - flags = f.sortedFormal - } else { - flags = f.orderedFormal - } - - for _, flag := range flags { - fn(flag) - } -} - -// HasFlags returns a bool to indicate if the FlagSet has any flags definied. -func (f *FlagSet) HasFlags() bool { - return len(f.formal) > 0 -} - -// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags -// definied that are not hidden or deprecated. -func (f *FlagSet) HasAvailableFlags() bool { - for _, flag := range f.formal { - if !flag.Hidden && len(flag.Deprecated) == 0 { - return true - } - } - return false -} - -// VisitAll visits the command-line flags in lexicographical order or -// in primordial order if f.SortFlags is false, calling fn for each. -// It visits all flags, even those not set. -func VisitAll(fn func(*Flag)) { - CommandLine.VisitAll(fn) -} - -// Visit visits the flags in lexicographical order or -// in primordial order if f.SortFlags is false, calling fn for each. -// It visits only those flags that have been set. -func (f *FlagSet) Visit(fn func(*Flag)) { - if len(f.actual) == 0 { - return - } - - var flags []*Flag - if f.SortFlags { - if len(f.actual) != len(f.sortedActual) { - f.sortedActual = sortFlags(f.actual) - } - flags = f.sortedActual - } else { - flags = f.orderedActual - } - - for _, flag := range flags { - fn(flag) - } -} - -// Visit visits the command-line flags in lexicographical order or -// in primordial order if f.SortFlags is false, calling fn for each. -// It visits only those flags that have been set. -func Visit(fn func(*Flag)) { - CommandLine.Visit(fn) -} - -// Lookup returns the Flag structure of the named flag, returning nil if none exists. -func (f *FlagSet) Lookup(name string) *Flag { - return f.lookup(f.normalizeFlagName(name)) -} - -// ShorthandLookup returns the Flag structure of the short handed flag, -// returning nil if none exists. -// It panics, if len(name) > 1. -func (f *FlagSet) ShorthandLookup(name string) *Flag { - if name == "" { - return nil - } - if len(name) > 1 { - msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name) - fmt.Fprintf(f.out(), msg) - panic(msg) - } - c := name[0] - return f.shorthands[c] -} - -// lookup returns the Flag structure of the named flag, returning nil if none exists. -func (f *FlagSet) lookup(name NormalizedName) *Flag { - return f.formal[name] -} - -// func to return a given type for a given flag name -func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) { - flag := f.Lookup(name) - if flag == nil { - err := fmt.Errorf("flag accessed but not defined: %s", name) - return nil, err - } - - if flag.Value.Type() != ftype { - err := fmt.Errorf("trying to get %s value of flag of type %s", ftype, flag.Value.Type()) - return nil, err - } - - sval := flag.Value.String() - result, err := convFunc(sval) - if err != nil { - return nil, err - } - return result, nil -} - -// ArgsLenAtDash will return the length of f.Args at the moment when a -- was -// found during arg parsing. This allows your program to know which args were -// before the -- and which came after. -func (f *FlagSet) ArgsLenAtDash() int { - return f.argsLenAtDash -} - -// MarkDeprecated indicated that a flag is deprecated in your program. It will -// continue to function but will not show up in help or usage messages. Using -// this flag will also print the given usageMessage. -func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error { - flag := f.Lookup(name) - if flag == nil { - return fmt.Errorf("flag %q does not exist", name) - } - if usageMessage == "" { - return fmt.Errorf("deprecated message for flag %q must be set", name) - } - flag.Deprecated = usageMessage - return nil -} - -// MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your -// program. It will continue to function but will not show up in help or usage -// messages. Using this flag will also print the given usageMessage. -func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error { - flag := f.Lookup(name) - if flag == nil { - return fmt.Errorf("flag %q does not exist", name) - } - if usageMessage == "" { - return fmt.Errorf("deprecated message for flag %q must be set", name) - } - flag.ShorthandDeprecated = usageMessage - return nil -} - -// MarkHidden sets a flag to 'hidden' in your program. It will continue to -// function but will not show up in help or usage messages. -func (f *FlagSet) MarkHidden(name string) error { - flag := f.Lookup(name) - if flag == nil { - return fmt.Errorf("flag %q does not exist", name) - } - flag.Hidden = true - return nil -} - -// Lookup returns the Flag structure of the named command-line flag, -// returning nil if none exists. -func Lookup(name string) *Flag { - return CommandLine.Lookup(name) -} - -// ShorthandLookup returns the Flag structure of the short handed flag, -// returning nil if none exists. -func ShorthandLookup(name string) *Flag { - return CommandLine.ShorthandLookup(name) -} - -// Set sets the value of the named flag. -func (f *FlagSet) Set(name, value string) error { - normalName := f.normalizeFlagName(name) - flag, ok := f.formal[normalName] - if !ok { - return fmt.Errorf("no such flag -%v", name) - } - - err := flag.Value.Set(value) - if err != nil { - var flagName string - if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { - flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name) - } else { - flagName = fmt.Sprintf("--%s", flag.Name) - } - return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err) - } - - if f.actual == nil { - f.actual = make(map[NormalizedName]*Flag) - } - f.actual[normalName] = flag - f.orderedActual = append(f.orderedActual, flag) - - flag.Changed = true - - if flag.Deprecated != "" { - fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) - } - return nil -} - -// SetAnnotation allows one to set arbitrary annotations on a flag in the FlagSet. -// This is sometimes used by spf13/cobra programs which want to generate additional -// bash completion information. -func (f *FlagSet) SetAnnotation(name, key string, values []string) error { - normalName := f.normalizeFlagName(name) - flag, ok := f.formal[normalName] - if !ok { - return fmt.Errorf("no such flag -%v", name) - } - if flag.Annotations == nil { - flag.Annotations = map[string][]string{} - } - flag.Annotations[key] = values - return nil -} - -// Changed returns true if the flag was explicitly set during Parse() and false -// otherwise -func (f *FlagSet) Changed(name string) bool { - flag := f.Lookup(name) - // If a flag doesn't exist, it wasn't changed.... - if flag == nil { - return false - } - return flag.Changed -} - -// Set sets the value of the named command-line flag. -func Set(name, value string) error { - return CommandLine.Set(name, value) -} - -// PrintDefaults prints, to standard error unless configured -// otherwise, the default values of all defined flags in the set. -func (f *FlagSet) PrintDefaults() { - usages := f.FlagUsages() - fmt.Fprint(f.out(), usages) -} - -// defaultIsZeroValue returns true if the default value for this flag represents -// a zero value. -func (f *Flag) defaultIsZeroValue() bool { - switch f.Value.(type) { - case boolFlag: - return f.DefValue == "false" - case *durationValue: - // Beginning in Go 1.7, duration zero values are "0s" - return f.DefValue == "0" || f.DefValue == "0s" - case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value: - return f.DefValue == "0" - case *stringValue: - return f.DefValue == "" - case *ipValue, *ipMaskValue, *ipNetValue: - return f.DefValue == "" - case *intSliceValue, *stringSliceValue, *stringArrayValue: - return f.DefValue == "[]" - default: - switch f.Value.String() { - case "false": - return true - case "": - return true - case "": - return true - case "0": - return true - } - return false - } -} - -// UnquoteUsage extracts a back-quoted name from the usage -// string for a flag and returns it and the un-quoted usage. -// Given "a `name` to show" it returns ("name", "a name to show"). -// If there are no back quotes, the name is an educated guess of the -// type of the flag's value, or the empty string if the flag is boolean. -func UnquoteUsage(flag *Flag) (name string, usage string) { - // Look for a back-quoted name, but avoid the strings package. - usage = flag.Usage - for i := 0; i < len(usage); i++ { - if usage[i] == '`' { - for j := i + 1; j < len(usage); j++ { - if usage[j] == '`' { - name = usage[i+1 : j] - usage = usage[:i] + name + usage[j+1:] - return name, usage - } - } - break // Only one back quote; use type name. - } - } - - name = flag.Value.Type() - switch name { - case "bool": - name = "" - case "float64": - name = "float" - case "int64": - name = "int" - case "uint64": - name = "uint" - } - - return -} - -// Splits the string `s` on whitespace into an initial substring up to -// `i` runes in length and the remainder. Will go `slop` over `i` if -// that encompasses the entire string (which allows the caller to -// avoid short orphan words on the final line). -func wrapN(i, slop int, s string) (string, string) { - if i+slop > len(s) { - return s, "" - } - - w := strings.LastIndexAny(s[:i], " \t") - if w <= 0 { - return s, "" - } - - return s[:w], s[w+1:] -} - -// Wraps the string `s` to a maximum width `w` with leading indent -// `i`. The first line is not indented (this is assumed to be done by -// caller). Pass `w` == 0 to do no wrapping -func wrap(i, w int, s string) string { - if w == 0 { - return s - } - - // space between indent i and end of line width w into which - // we should wrap the text. - wrap := w - i - - var r, l string - - // Not enough space for sensible wrapping. Wrap as a block on - // the next line instead. - if wrap < 24 { - i = 16 - wrap = w - i - r += "\n" + strings.Repeat(" ", i) - } - // If still not enough space then don't even try to wrap. - if wrap < 24 { - return s - } - - // Try to avoid short orphan words on the final line, by - // allowing wrapN to go a bit over if that would fit in the - // remainder of the line. - slop := 5 - wrap = wrap - slop - - // Handle first line, which is indented by the caller (or the - // special case above) - l, s = wrapN(wrap, slop, s) - r = r + l - - // Now wrap the rest - for s != "" { - var t string - - t, s = wrapN(wrap, slop, s) - r = r + "\n" + strings.Repeat(" ", i) + t - } - - return r - -} - -// FlagUsagesWrapped returns a string containing the usage information -// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no -// wrapping) -func (f *FlagSet) FlagUsagesWrapped(cols int) string { - buf := new(bytes.Buffer) - - lines := make([]string, 0, len(f.formal)) - - maxlen := 0 - f.VisitAll(func(flag *Flag) { - if flag.Deprecated != "" || flag.Hidden { - return - } - - line := "" - if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { - line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name) - } else { - line = fmt.Sprintf(" --%s", flag.Name) - } - - varname, usage := UnquoteUsage(flag) - if varname != "" { - line += " " + varname - } - if flag.NoOptDefVal != "" { - switch flag.Value.Type() { - case "string": - line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal) - case "bool": - if flag.NoOptDefVal != "true" { - line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) - } - default: - line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) - } - } - - // This special character will be replaced with spacing once the - // correct alignment is calculated - line += "\x00" - if len(line) > maxlen { - maxlen = len(line) - } - - line += usage - if !flag.defaultIsZeroValue() { - if flag.Value.Type() == "string" { - line += fmt.Sprintf(" (default %q)", flag.DefValue) - } else { - line += fmt.Sprintf(" (default %s)", flag.DefValue) - } - } - - lines = append(lines, line) - }) - - for _, line := range lines { - sidx := strings.Index(line, "\x00") - spacing := strings.Repeat(" ", maxlen-sidx) - // maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx - fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:])) - } - - return buf.String() -} - -// FlagUsages returns a string containing the usage information for all flags in -// the FlagSet -func (f *FlagSet) FlagUsages() string { - return f.FlagUsagesWrapped(0) -} - -// PrintDefaults prints to standard error the default values of all defined command-line flags. -func PrintDefaults() { - CommandLine.PrintDefaults() -} - -// defaultUsage is the default function to print a usage message. -func defaultUsage(f *FlagSet) { - fmt.Fprintf(f.out(), "Usage of %s:\n", f.name) - f.PrintDefaults() -} - -// NOTE: Usage is not just defaultUsage(CommandLine) -// because it serves (via godoc flag Usage) as the example -// for how to write your own usage function. - -// Usage prints to standard error a usage message documenting all defined command-line flags. -// The function is a variable that may be changed to point to a custom function. -// By default it prints a simple header and calls PrintDefaults; for details about the -// format of the output and how to control it, see the documentation for PrintDefaults. -var Usage = func() { - fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) - PrintDefaults() -} - -// NFlag returns the number of flags that have been set. -func (f *FlagSet) NFlag() int { return len(f.actual) } - -// NFlag returns the number of command-line flags that have been set. -func NFlag() int { return len(CommandLine.actual) } - -// Arg returns the i'th argument. Arg(0) is the first remaining argument -// after flags have been processed. -func (f *FlagSet) Arg(i int) string { - if i < 0 || i >= len(f.args) { - return "" - } - return f.args[i] -} - -// Arg returns the i'th command-line argument. Arg(0) is the first remaining argument -// after flags have been processed. -func Arg(i int) string { - return CommandLine.Arg(i) -} - -// NArg is the number of arguments remaining after flags have been processed. -func (f *FlagSet) NArg() int { return len(f.args) } - -// NArg is the number of arguments remaining after flags have been processed. -func NArg() int { return len(CommandLine.args) } - -// Args returns the non-flag arguments. -func (f *FlagSet) Args() []string { return f.args } - -// Args returns the non-flag command-line arguments. -func Args() []string { return CommandLine.args } - -// Var defines a flag with the specified name and usage string. The type and -// value of the flag are represented by the first argument, of type Value, which -// typically holds a user-defined implementation of Value. For instance, the -// caller could create a flag that turns a comma-separated string into a slice -// of strings by giving the slice the methods of Value; in particular, Set would -// decompose the comma-separated string into the slice. -func (f *FlagSet) Var(value Value, name string, usage string) { - f.VarP(value, name, "", usage) -} - -// VarPF is like VarP, but returns the flag created -func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag { - // Remember the default value as a string; it won't change. - flag := &Flag{ - Name: name, - Shorthand: shorthand, - Usage: usage, - Value: value, - DefValue: value.String(), - } - f.AddFlag(flag) - return flag -} - -// VarP is like Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) VarP(value Value, name, shorthand, usage string) { - f.VarPF(value, name, shorthand, usage) -} - -// AddFlag will add the flag to the FlagSet -func (f *FlagSet) AddFlag(flag *Flag) { - normalizedFlagName := f.normalizeFlagName(flag.Name) - - _, alreadyThere := f.formal[normalizedFlagName] - if alreadyThere { - msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name) - fmt.Fprintln(f.out(), msg) - panic(msg) // Happens only if flags are declared with identical names - } - if f.formal == nil { - f.formal = make(map[NormalizedName]*Flag) - } - - flag.Name = string(normalizedFlagName) - f.formal[normalizedFlagName] = flag - f.orderedFormal = append(f.orderedFormal, flag) - - if flag.Shorthand == "" { - return - } - if len(flag.Shorthand) > 1 { - msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand) - fmt.Fprintf(f.out(), msg) - panic(msg) - } - if f.shorthands == nil { - f.shorthands = make(map[byte]*Flag) - } - c := flag.Shorthand[0] - used, alreadyThere := f.shorthands[c] - if alreadyThere { - msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name) - fmt.Fprintf(f.out(), msg) - panic(msg) - } - f.shorthands[c] = flag -} - -// AddFlagSet adds one FlagSet to another. If a flag is already present in f -// the flag from newSet will be ignored. -func (f *FlagSet) AddFlagSet(newSet *FlagSet) { - if newSet == nil { - return - } - newSet.VisitAll(func(flag *Flag) { - if f.Lookup(flag.Name) == nil { - f.AddFlag(flag) - } - }) -} - -// Var defines a flag with the specified name and usage string. The type and -// value of the flag are represented by the first argument, of type Value, which -// typically holds a user-defined implementation of Value. For instance, the -// caller could create a flag that turns a comma-separated string into a slice -// of strings by giving the slice the methods of Value; in particular, Set would -// decompose the comma-separated string into the slice. -func Var(value Value, name string, usage string) { - CommandLine.VarP(value, name, "", usage) -} - -// VarP is like Var, but accepts a shorthand letter that can be used after a single dash. -func VarP(value Value, name, shorthand, usage string) { - CommandLine.VarP(value, name, shorthand, usage) -} - -// failf prints to standard error a formatted error and usage message and -// returns the error. -func (f *FlagSet) failf(format string, a ...interface{}) error { - err := fmt.Errorf(format, a...) - fmt.Fprintln(f.out(), err) - f.usage() - return err -} - -// usage calls the Usage method for the flag set, or the usage function if -// the flag set is CommandLine. -func (f *FlagSet) usage() { - if f == CommandLine { - Usage() - } else if f.Usage == nil { - defaultUsage(f) - } else { - f.Usage() - } -} - -func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) { - a = args - name := s[2:] - if len(name) == 0 || name[0] == '-' || name[0] == '=' { - err = f.failf("bad flag syntax: %s", s) - return - } - - split := strings.SplitN(name, "=", 2) - name = split[0] - flag, exists := f.formal[f.normalizeFlagName(name)] - if !exists { - if name == "help" { // special case for nice help message. - f.usage() - return a, ErrHelp - } - err = f.failf("unknown flag: --%s", name) - return - } - - var value string - if len(split) == 2 { - // '--flag=arg' - value = split[1] - } else if flag.NoOptDefVal != "" { - // '--flag' (arg was optional) - value = flag.NoOptDefVal - } else if len(a) > 0 { - // '--flag arg' - value = a[0] - a = a[1:] - } else { - // '--flag' (arg was required) - err = f.failf("flag needs an argument: %s", s) - return - } - - err = fn(flag, value) - return -} - -func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) { - if strings.HasPrefix(shorthands, "test.") { - return - } - - outArgs = args - outShorts = shorthands[1:] - c := shorthands[0] - - flag, exists := f.shorthands[c] - if !exists { - if c == 'h' { // special case for nice help message. - f.usage() - err = ErrHelp - return - } - err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands) - return - } - - var value string - if len(shorthands) > 2 && shorthands[1] == '=' { - // '-f=arg' - value = shorthands[2:] - outShorts = "" - } else if flag.NoOptDefVal != "" { - // '-f' (arg was optional) - value = flag.NoOptDefVal - } else if len(shorthands) > 1 { - // '-farg' - value = shorthands[1:] - outShorts = "" - } else if len(args) > 0 { - // '-f arg' - value = args[0] - outArgs = args[1:] - } else { - // '-f' (arg was required) - err = f.failf("flag needs an argument: %q in -%s", c, shorthands) - return - } - - if flag.ShorthandDeprecated != "" { - fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) - } - - err = fn(flag, value) - return -} - -func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []string, err error) { - a = args - shorthands := s[1:] - - // "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv"). - for len(shorthands) > 0 { - shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn) - if err != nil { - return - } - } - - return -} - -func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) { - for len(args) > 0 { - s := args[0] - args = args[1:] - if len(s) == 0 || s[0] != '-' || len(s) == 1 { - if !f.interspersed { - f.args = append(f.args, s) - f.args = append(f.args, args...) - return nil - } - f.args = append(f.args, s) - continue - } - - if s[1] == '-' { - if len(s) == 2 { // "--" terminates the flags - f.argsLenAtDash = len(f.args) - f.args = append(f.args, args...) - break - } - args, err = f.parseLongArg(s, args, fn) - } else { - args, err = f.parseShortArg(s, args, fn) - } - if err != nil { - return - } - } - return -} - -// Parse parses flag definitions from the argument list, which should not -// include the command name. Must be called after all flags in the FlagSet -// are defined and before flags are accessed by the program. -// The return value will be ErrHelp if -help was set but not defined. -func (f *FlagSet) Parse(arguments []string) error { - f.parsed = true - - if len(arguments) < 0 { - return nil - } - - f.args = make([]string, 0, len(arguments)) - - set := func(flag *Flag, value string) error { - return f.Set(flag.Name, value) - } - - err := f.parseArgs(arguments, set) - if err != nil { - switch f.errorHandling { - case ContinueOnError: - return err - case ExitOnError: - os.Exit(2) - case PanicOnError: - panic(err) - } - } - return nil -} - -type parseFunc func(flag *Flag, value string) error - -// ParseAll parses flag definitions from the argument list, which should not -// include the command name. The arguments for fn are flag and value. Must be -// called after all flags in the FlagSet are defined and before flags are -// accessed by the program. The return value will be ErrHelp if -help was set -// but not defined. -func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) error) error { - f.parsed = true - f.args = make([]string, 0, len(arguments)) - - err := f.parseArgs(arguments, fn) - if err != nil { - switch f.errorHandling { - case ContinueOnError: - return err - case ExitOnError: - os.Exit(2) - case PanicOnError: - panic(err) - } - } - return nil -} - -// Parsed reports whether f.Parse has been called. -func (f *FlagSet) Parsed() bool { - return f.parsed -} - -// Parse parses the command-line flags from os.Args[1:]. Must be called -// after all flags are defined and before flags are accessed by the program. -func Parse() { - // Ignore errors; CommandLine is set for ExitOnError. - CommandLine.Parse(os.Args[1:]) -} - -// ParseAll parses the command-line flags from os.Args[1:] and called fn for each. -// The arguments for fn are flag and value. Must be called after all flags are -// defined and before flags are accessed by the program. -func ParseAll(fn func(flag *Flag, value string) error) { - // Ignore errors; CommandLine is set for ExitOnError. - CommandLine.ParseAll(os.Args[1:], fn) -} - -// SetInterspersed sets whether to support interspersed option/non-option arguments. -func SetInterspersed(interspersed bool) { - CommandLine.SetInterspersed(interspersed) -} - -// Parsed returns true if the command-line flags have been parsed. -func Parsed() bool { - return CommandLine.Parsed() -} - -// CommandLine is the default set of command-line flags, parsed from os.Args. -var CommandLine = NewFlagSet(os.Args[0], ExitOnError) - -// NewFlagSet returns a new, empty flag set with the specified name, -// error handling property and SortFlags set to true. -func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet { - f := &FlagSet{ - name: name, - errorHandling: errorHandling, - argsLenAtDash: -1, - interspersed: true, - SortFlags: true, - } - return f -} - -// SetInterspersed sets whether to support interspersed option/non-option arguments. -func (f *FlagSet) SetInterspersed(interspersed bool) { - f.interspersed = interspersed -} - -// Init sets the name and error handling property for a flag set. -// By default, the zero FlagSet uses an empty name and the -// ContinueOnError error handling policy. -func (f *FlagSet) Init(name string, errorHandling ErrorHandling) { - f.name = name - f.errorHandling = errorHandling - f.argsLenAtDash = -1 -} +// 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 pflag is a drop-in replacement for Go's flag package, implementing +POSIX/GNU-style --flags. + +pflag is compatible with the GNU extensions to the POSIX recommendations +for command-line options. See +http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html + +Usage: + +pflag is a drop-in replacement of Go's native flag package. If you import +pflag under the name "flag" then all code should continue to function +with no changes. + + import flag "github.com/spf13/pflag" + +There is one exception to this: if you directly instantiate the Flag struct +there is one more field "Shorthand" that you will need to set. +Most code never instantiates this struct directly, and instead uses +functions such as String(), BoolVar(), and Var(), and is therefore +unaffected. + +Define flags using flag.String(), Bool(), Int(), etc. + +This declares an integer flag, -flagname, stored in the pointer ip, with type *int. + var ip = flag.Int("flagname", 1234, "help message for flagname") +If you like, you can bind the flag to a variable using the Var() functions. + var flagvar int + func init() { + flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") + } +Or you can create custom flags that satisfy the Value interface (with +pointer receivers) and couple them to flag parsing by + flag.Var(&flagVal, "name", "help message for flagname") +For such flags, the default value is just the initial value of the variable. + +After all flags are defined, call + flag.Parse() +to parse the command line into the defined flags. + +Flags may then be used directly. If you're using the flags themselves, +they are all pointers; if you bind to variables, they're values. + fmt.Println("ip has value ", *ip) + fmt.Println("flagvar has value ", flagvar) + +After parsing, the arguments after the flag are available as the +slice flag.Args() or individually as flag.Arg(i). +The arguments are indexed from 0 through flag.NArg()-1. + +The pflag package also defines some new functions that are not in flag, +that give one-letter shorthands for flags. You can use these by appending +'P' to the name of any function that defines a flag. + var ip = flag.IntP("flagname", "f", 1234, "help message") + var flagvar bool + func init() { + flag.BoolVarP("boolname", "b", true, "help message") + } + flag.VarP(&flagVar, "varname", "v", 1234, "help message") +Shorthand letters can be used with single dashes on the command line. +Boolean shorthand flags can be combined with other shorthand flags. + +Command line flag syntax: + --flag // boolean flags only + --flag=x + +Unlike the flag package, a single dash before an option means something +different than a double dash. Single dashes signify a series of shorthand +letters for flags. All but the last shorthand letter must be boolean flags. + // boolean flags + -f + -abc + // non-boolean flags + -n 1234 + -Ifile + // mixed + -abcs "hello" + -abcn1234 + +Flag parsing stops after the terminator "--". Unlike the flag package, +flags can be interspersed with arguments anywhere on the command line +before this terminator. + +Integer flags accept 1234, 0664, 0x1234 and may be negative. +Boolean flags (in their long form) accept 1, 0, t, f, true, false, +TRUE, FALSE, True, False. +Duration flags accept any input valid for time.ParseDuration. + +The default set of command-line flags is controlled by +top-level functions. The FlagSet type allows one to define +independent sets of flags, such as to implement subcommands +in a command-line interface. The methods of FlagSet are +analogous to the top-level functions for the command-line +flag set. +*/ +package pflag + +import ( + "bytes" + "errors" + "fmt" + "io" + "os" + "sort" + "strings" +) + +// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined. +var ErrHelp = errors.New("pflag: help requested") + +// ErrorHandling defines how to handle flag parsing errors. +type ErrorHandling int + +const ( + // ContinueOnError will return an err from Parse() if an error is found + ContinueOnError ErrorHandling = iota + // ExitOnError will call os.Exit(2) if an error is found when parsing + ExitOnError + // PanicOnError will panic() if an error is found when parsing flags + PanicOnError +) + +// NormalizedName is a flag name that has been normalized according to rules +// for the FlagSet (e.g. making '-' and '_' equivalent). +type NormalizedName string + +// A FlagSet represents a set of defined flags. +type FlagSet struct { + // Usage is the function called when an error occurs while parsing flags. + // The field is a function (not a method) that may be changed to point to + // a custom error handler. + Usage func() + + // SortFlags is used to indicate, if user wants to have sorted flags in + // help/usage messages. + SortFlags bool + + name string + parsed bool + actual map[NormalizedName]*Flag + orderedActual []*Flag + sortedActual []*Flag + formal map[NormalizedName]*Flag + orderedFormal []*Flag + sortedFormal []*Flag + shorthands map[byte]*Flag + args []string // arguments after flags + argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no -- + errorHandling ErrorHandling + output io.Writer // nil means stderr; use out() accessor + interspersed bool // allow interspersed option/non-option args + normalizeNameFunc func(f *FlagSet, name string) NormalizedName +} + +// A Flag represents the state of a flag. +type Flag struct { + Name string // name as it appears on command line + Shorthand string // one-letter abbreviated flag + Usage string // help message + Value Value // value as set + DefValue string // default value (as text); for usage message + Changed bool // If the user set the value (or if left to default) + NoOptDefVal string // default value (as text); if the flag is on the command line without any options + Deprecated string // If this flag is deprecated, this string is the new or now thing to use + Hidden bool // used by cobra.Command to allow flags to be hidden from help/usage text + ShorthandDeprecated string // If the shorthand of this flag is deprecated, this string is the new or now thing to use + Annotations map[string][]string // used by cobra.Command bash autocomple code +} + +// Value is the interface to the dynamic value stored in a flag. +// (The default value is represented as a string.) +type Value interface { + String() string + Set(string) error + Type() string +} + +// sortFlags returns the flags as a slice in lexicographical sorted order. +func sortFlags(flags map[NormalizedName]*Flag) []*Flag { + list := make(sort.StringSlice, len(flags)) + i := 0 + for k := range flags { + list[i] = string(k) + i++ + } + list.Sort() + result := make([]*Flag, len(list)) + for i, name := range list { + result[i] = flags[NormalizedName(name)] + } + return result +} + +// SetNormalizeFunc allows you to add a function which can translate flag names. +// Flags added to the FlagSet will be translated and then when anything tries to +// look up the flag that will also be translated. So it would be possible to create +// a flag named "getURL" and have it translated to "geturl". A user could then pass +// "--getUrl" which may also be translated to "geturl" and everything will work. +func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) { + f.normalizeNameFunc = n + f.sortedFormal = f.sortedFormal[:0] + for k, v := range f.orderedFormal { + delete(f.formal, NormalizedName(v.Name)) + nname := f.normalizeFlagName(v.Name) + v.Name = string(nname) + f.formal[nname] = v + f.orderedFormal[k] = v + } +} + +// GetNormalizeFunc returns the previously set NormalizeFunc of a function which +// does no translation, if not set previously. +func (f *FlagSet) GetNormalizeFunc() func(f *FlagSet, name string) NormalizedName { + if f.normalizeNameFunc != nil { + return f.normalizeNameFunc + } + return func(f *FlagSet, name string) NormalizedName { return NormalizedName(name) } +} + +func (f *FlagSet) normalizeFlagName(name string) NormalizedName { + n := f.GetNormalizeFunc() + return n(f, name) +} + +func (f *FlagSet) out() io.Writer { + if f.output == nil { + return os.Stderr + } + return f.output +} + +// SetOutput sets the destination for usage and error messages. +// If output is nil, os.Stderr is used. +func (f *FlagSet) SetOutput(output io.Writer) { + f.output = output +} + +// VisitAll visits the flags in lexicographical order or +// in primordial order if f.SortFlags is false, calling fn for each. +// It visits all flags, even those not set. +func (f *FlagSet) VisitAll(fn func(*Flag)) { + if len(f.formal) == 0 { + return + } + + var flags []*Flag + if f.SortFlags { + if len(f.formal) != len(f.sortedFormal) { + f.sortedFormal = sortFlags(f.formal) + } + flags = f.sortedFormal + } else { + flags = f.orderedFormal + } + + for _, flag := range flags { + fn(flag) + } +} + +// HasFlags returns a bool to indicate if the FlagSet has any flags definied. +func (f *FlagSet) HasFlags() bool { + return len(f.formal) > 0 +} + +// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags +// definied that are not hidden or deprecated. +func (f *FlagSet) HasAvailableFlags() bool { + for _, flag := range f.formal { + if !flag.Hidden && len(flag.Deprecated) == 0 { + return true + } + } + return false +} + +// VisitAll visits the command-line flags in lexicographical order or +// in primordial order if f.SortFlags is false, calling fn for each. +// It visits all flags, even those not set. +func VisitAll(fn func(*Flag)) { + CommandLine.VisitAll(fn) +} + +// Visit visits the flags in lexicographical order or +// in primordial order if f.SortFlags is false, calling fn for each. +// It visits only those flags that have been set. +func (f *FlagSet) Visit(fn func(*Flag)) { + if len(f.actual) == 0 { + return + } + + var flags []*Flag + if f.SortFlags { + if len(f.actual) != len(f.sortedActual) { + f.sortedActual = sortFlags(f.actual) + } + flags = f.sortedActual + } else { + flags = f.orderedActual + } + + for _, flag := range flags { + fn(flag) + } +} + +// Visit visits the command-line flags in lexicographical order or +// in primordial order if f.SortFlags is false, calling fn for each. +// It visits only those flags that have been set. +func Visit(fn func(*Flag)) { + CommandLine.Visit(fn) +} + +// Lookup returns the Flag structure of the named flag, returning nil if none exists. +func (f *FlagSet) Lookup(name string) *Flag { + return f.lookup(f.normalizeFlagName(name)) +} + +// ShorthandLookup returns the Flag structure of the short handed flag, +// returning nil if none exists. +// It panics, if len(name) > 1. +func (f *FlagSet) ShorthandLookup(name string) *Flag { + if name == "" { + return nil + } + if len(name) > 1 { + msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name) + fmt.Fprintf(f.out(), msg) + panic(msg) + } + c := name[0] + return f.shorthands[c] +} + +// lookup returns the Flag structure of the named flag, returning nil if none exists. +func (f *FlagSet) lookup(name NormalizedName) *Flag { + return f.formal[name] +} + +// func to return a given type for a given flag name +func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) { + flag := f.Lookup(name) + if flag == nil { + err := fmt.Errorf("flag accessed but not defined: %s", name) + return nil, err + } + + if flag.Value.Type() != ftype { + err := fmt.Errorf("trying to get %s value of flag of type %s", ftype, flag.Value.Type()) + return nil, err + } + + sval := flag.Value.String() + result, err := convFunc(sval) + if err != nil { + return nil, err + } + return result, nil +} + +// ArgsLenAtDash will return the length of f.Args at the moment when a -- was +// found during arg parsing. This allows your program to know which args were +// before the -- and which came after. +func (f *FlagSet) ArgsLenAtDash() int { + return f.argsLenAtDash +} + +// MarkDeprecated indicated that a flag is deprecated in your program. It will +// continue to function but will not show up in help or usage messages. Using +// this flag will also print the given usageMessage. +func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error { + flag := f.Lookup(name) + if flag == nil { + return fmt.Errorf("flag %q does not exist", name) + } + if usageMessage == "" { + return fmt.Errorf("deprecated message for flag %q must be set", name) + } + flag.Deprecated = usageMessage + return nil +} + +// MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your +// program. It will continue to function but will not show up in help or usage +// messages. Using this flag will also print the given usageMessage. +func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error { + flag := f.Lookup(name) + if flag == nil { + return fmt.Errorf("flag %q does not exist", name) + } + if usageMessage == "" { + return fmt.Errorf("deprecated message for flag %q must be set", name) + } + flag.ShorthandDeprecated = usageMessage + return nil +} + +// MarkHidden sets a flag to 'hidden' in your program. It will continue to +// function but will not show up in help or usage messages. +func (f *FlagSet) MarkHidden(name string) error { + flag := f.Lookup(name) + if flag == nil { + return fmt.Errorf("flag %q does not exist", name) + } + flag.Hidden = true + return nil +} + +// Lookup returns the Flag structure of the named command-line flag, +// returning nil if none exists. +func Lookup(name string) *Flag { + return CommandLine.Lookup(name) +} + +// ShorthandLookup returns the Flag structure of the short handed flag, +// returning nil if none exists. +func ShorthandLookup(name string) *Flag { + return CommandLine.ShorthandLookup(name) +} + +// Set sets the value of the named flag. +func (f *FlagSet) Set(name, value string) error { + normalName := f.normalizeFlagName(name) + flag, ok := f.formal[normalName] + if !ok { + return fmt.Errorf("no such flag -%v", name) + } + + err := flag.Value.Set(value) + if err != nil { + var flagName string + if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { + flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name) + } else { + flagName = fmt.Sprintf("--%s", flag.Name) + } + return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err) + } + + if f.actual == nil { + f.actual = make(map[NormalizedName]*Flag) + } + f.actual[normalName] = flag + f.orderedActual = append(f.orderedActual, flag) + + flag.Changed = true + + if flag.Deprecated != "" { + fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) + } + return nil +} + +// SetAnnotation allows one to set arbitrary annotations on a flag in the FlagSet. +// This is sometimes used by spf13/cobra programs which want to generate additional +// bash completion information. +func (f *FlagSet) SetAnnotation(name, key string, values []string) error { + normalName := f.normalizeFlagName(name) + flag, ok := f.formal[normalName] + if !ok { + return fmt.Errorf("no such flag -%v", name) + } + if flag.Annotations == nil { + flag.Annotations = map[string][]string{} + } + flag.Annotations[key] = values + return nil +} + +// Changed returns true if the flag was explicitly set during Parse() and false +// otherwise +func (f *FlagSet) Changed(name string) bool { + flag := f.Lookup(name) + // If a flag doesn't exist, it wasn't changed.... + if flag == nil { + return false + } + return flag.Changed +} + +// Set sets the value of the named command-line flag. +func Set(name, value string) error { + return CommandLine.Set(name, value) +} + +// PrintDefaults prints, to standard error unless configured +// otherwise, the default values of all defined flags in the set. +func (f *FlagSet) PrintDefaults() { + usages := f.FlagUsages() + fmt.Fprint(f.out(), usages) +} + +// defaultIsZeroValue returns true if the default value for this flag represents +// a zero value. +func (f *Flag) defaultIsZeroValue() bool { + switch f.Value.(type) { + case boolFlag: + return f.DefValue == "false" + case *durationValue: + // Beginning in Go 1.7, duration zero values are "0s" + return f.DefValue == "0" || f.DefValue == "0s" + case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value: + return f.DefValue == "0" + case *stringValue: + return f.DefValue == "" + case *ipValue, *ipMaskValue, *ipNetValue: + return f.DefValue == "" + case *intSliceValue, *stringSliceValue, *stringArrayValue: + return f.DefValue == "[]" + default: + switch f.Value.String() { + case "false": + return true + case "": + return true + case "": + return true + case "0": + return true + } + return false + } +} + +// UnquoteUsage extracts a back-quoted name from the usage +// string for a flag and returns it and the un-quoted usage. +// Given "a `name` to show" it returns ("name", "a name to show"). +// If there are no back quotes, the name is an educated guess of the +// type of the flag's value, or the empty string if the flag is boolean. +func UnquoteUsage(flag *Flag) (name string, usage string) { + // Look for a back-quoted name, but avoid the strings package. + usage = flag.Usage + for i := 0; i < len(usage); i++ { + if usage[i] == '`' { + for j := i + 1; j < len(usage); j++ { + if usage[j] == '`' { + name = usage[i+1 : j] + usage = usage[:i] + name + usage[j+1:] + return name, usage + } + } + break // Only one back quote; use type name. + } + } + + name = flag.Value.Type() + switch name { + case "bool": + name = "" + case "float64": + name = "float" + case "int64": + name = "int" + case "uint64": + name = "uint" + } + + return +} + +// Splits the string `s` on whitespace into an initial substring up to +// `i` runes in length and the remainder. Will go `slop` over `i` if +// that encompasses the entire string (which allows the caller to +// avoid short orphan words on the final line). +func wrapN(i, slop int, s string) (string, string) { + if i+slop > len(s) { + return s, "" + } + + w := strings.LastIndexAny(s[:i], " \t") + if w <= 0 { + return s, "" + } + + return s[:w], s[w+1:] +} + +// Wraps the string `s` to a maximum width `w` with leading indent +// `i`. The first line is not indented (this is assumed to be done by +// caller). Pass `w` == 0 to do no wrapping +func wrap(i, w int, s string) string { + if w == 0 { + return s + } + + // space between indent i and end of line width w into which + // we should wrap the text. + wrap := w - i + + var r, l string + + // Not enough space for sensible wrapping. Wrap as a block on + // the next line instead. + if wrap < 24 { + i = 16 + wrap = w - i + r += "\n" + strings.Repeat(" ", i) + } + // If still not enough space then don't even try to wrap. + if wrap < 24 { + return s + } + + // Try to avoid short orphan words on the final line, by + // allowing wrapN to go a bit over if that would fit in the + // remainder of the line. + slop := 5 + wrap = wrap - slop + + // Handle first line, which is indented by the caller (or the + // special case above) + l, s = wrapN(wrap, slop, s) + r = r + l + + // Now wrap the rest + for s != "" { + var t string + + t, s = wrapN(wrap, slop, s) + r = r + "\n" + strings.Repeat(" ", i) + t + } + + return r + +} + +// FlagUsagesWrapped returns a string containing the usage information +// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no +// wrapping) +func (f *FlagSet) FlagUsagesWrapped(cols int) string { + buf := new(bytes.Buffer) + + lines := make([]string, 0, len(f.formal)) + + maxlen := 0 + f.VisitAll(func(flag *Flag) { + if flag.Deprecated != "" || flag.Hidden { + return + } + + line := "" + if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { + line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name) + } else { + line = fmt.Sprintf(" --%s", flag.Name) + } + + varname, usage := UnquoteUsage(flag) + if varname != "" { + line += " " + varname + } + if flag.NoOptDefVal != "" { + switch flag.Value.Type() { + case "string": + line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal) + case "bool": + if flag.NoOptDefVal != "true" { + line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) + } + default: + line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) + } + } + + // This special character will be replaced with spacing once the + // correct alignment is calculated + line += "\x00" + if len(line) > maxlen { + maxlen = len(line) + } + + line += usage + if !flag.defaultIsZeroValue() { + if flag.Value.Type() == "string" { + line += fmt.Sprintf(" (default %q)", flag.DefValue) + } else { + line += fmt.Sprintf(" (default %s)", flag.DefValue) + } + } + + lines = append(lines, line) + }) + + for _, line := range lines { + sidx := strings.Index(line, "\x00") + spacing := strings.Repeat(" ", maxlen-sidx) + // maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx + fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:])) + } + + return buf.String() +} + +// FlagUsages returns a string containing the usage information for all flags in +// the FlagSet +func (f *FlagSet) FlagUsages() string { + return f.FlagUsagesWrapped(0) +} + +// PrintDefaults prints to standard error the default values of all defined command-line flags. +func PrintDefaults() { + CommandLine.PrintDefaults() +} + +// defaultUsage is the default function to print a usage message. +func defaultUsage(f *FlagSet) { + fmt.Fprintf(f.out(), "Usage of %s:\n", f.name) + f.PrintDefaults() +} + +// NOTE: Usage is not just defaultUsage(CommandLine) +// because it serves (via godoc flag Usage) as the example +// for how to write your own usage function. + +// Usage prints to standard error a usage message documenting all defined command-line flags. +// The function is a variable that may be changed to point to a custom function. +// By default it prints a simple header and calls PrintDefaults; for details about the +// format of the output and how to control it, see the documentation for PrintDefaults. +var Usage = func() { + fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) + PrintDefaults() +} + +// NFlag returns the number of flags that have been set. +func (f *FlagSet) NFlag() int { return len(f.actual) } + +// NFlag returns the number of command-line flags that have been set. +func NFlag() int { return len(CommandLine.actual) } + +// Arg returns the i'th argument. Arg(0) is the first remaining argument +// after flags have been processed. +func (f *FlagSet) Arg(i int) string { + if i < 0 || i >= len(f.args) { + return "" + } + return f.args[i] +} + +// Arg returns the i'th command-line argument. Arg(0) is the first remaining argument +// after flags have been processed. +func Arg(i int) string { + return CommandLine.Arg(i) +} + +// NArg is the number of arguments remaining after flags have been processed. +func (f *FlagSet) NArg() int { return len(f.args) } + +// NArg is the number of arguments remaining after flags have been processed. +func NArg() int { return len(CommandLine.args) } + +// Args returns the non-flag arguments. +func (f *FlagSet) Args() []string { return f.args } + +// Args returns the non-flag command-line arguments. +func Args() []string { return CommandLine.args } + +// Var defines a flag with the specified name and usage string. The type and +// value of the flag are represented by the first argument, of type Value, which +// typically holds a user-defined implementation of Value. For instance, the +// caller could create a flag that turns a comma-separated string into a slice +// of strings by giving the slice the methods of Value; in particular, Set would +// decompose the comma-separated string into the slice. +func (f *FlagSet) Var(value Value, name string, usage string) { + f.VarP(value, name, "", usage) +} + +// VarPF is like VarP, but returns the flag created +func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag { + // Remember the default value as a string; it won't change. + flag := &Flag{ + Name: name, + Shorthand: shorthand, + Usage: usage, + Value: value, + DefValue: value.String(), + } + f.AddFlag(flag) + return flag +} + +// VarP is like Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) VarP(value Value, name, shorthand, usage string) { + f.VarPF(value, name, shorthand, usage) +} + +// AddFlag will add the flag to the FlagSet +func (f *FlagSet) AddFlag(flag *Flag) { + normalizedFlagName := f.normalizeFlagName(flag.Name) + + _, alreadyThere := f.formal[normalizedFlagName] + if alreadyThere { + msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name) + fmt.Fprintln(f.out(), msg) + panic(msg) // Happens only if flags are declared with identical names + } + if f.formal == nil { + f.formal = make(map[NormalizedName]*Flag) + } + + flag.Name = string(normalizedFlagName) + f.formal[normalizedFlagName] = flag + f.orderedFormal = append(f.orderedFormal, flag) + + if flag.Shorthand == "" { + return + } + if len(flag.Shorthand) > 1 { + msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand) + fmt.Fprintf(f.out(), msg) + panic(msg) + } + if f.shorthands == nil { + f.shorthands = make(map[byte]*Flag) + } + c := flag.Shorthand[0] + used, alreadyThere := f.shorthands[c] + if alreadyThere { + msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name) + fmt.Fprintf(f.out(), msg) + panic(msg) + } + f.shorthands[c] = flag +} + +// AddFlagSet adds one FlagSet to another. If a flag is already present in f +// the flag from newSet will be ignored. +func (f *FlagSet) AddFlagSet(newSet *FlagSet) { + if newSet == nil { + return + } + newSet.VisitAll(func(flag *Flag) { + if f.Lookup(flag.Name) == nil { + f.AddFlag(flag) + } + }) +} + +// Var defines a flag with the specified name and usage string. The type and +// value of the flag are represented by the first argument, of type Value, which +// typically holds a user-defined implementation of Value. For instance, the +// caller could create a flag that turns a comma-separated string into a slice +// of strings by giving the slice the methods of Value; in particular, Set would +// decompose the comma-separated string into the slice. +func Var(value Value, name string, usage string) { + CommandLine.VarP(value, name, "", usage) +} + +// VarP is like Var, but accepts a shorthand letter that can be used after a single dash. +func VarP(value Value, name, shorthand, usage string) { + CommandLine.VarP(value, name, shorthand, usage) +} + +// failf prints to standard error a formatted error and usage message and +// returns the error. +func (f *FlagSet) failf(format string, a ...interface{}) error { + err := fmt.Errorf(format, a...) + fmt.Fprintln(f.out(), err) + f.usage() + return err +} + +// usage calls the Usage method for the flag set, or the usage function if +// the flag set is CommandLine. +func (f *FlagSet) usage() { + if f == CommandLine { + Usage() + } else if f.Usage == nil { + defaultUsage(f) + } else { + f.Usage() + } +} + +func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) { + a = args + name := s[2:] + if len(name) == 0 || name[0] == '-' || name[0] == '=' { + err = f.failf("bad flag syntax: %s", s) + return + } + + split := strings.SplitN(name, "=", 2) + name = split[0] + flag, exists := f.formal[f.normalizeFlagName(name)] + if !exists { + if name == "help" { // special case for nice help message. + f.usage() + return a, ErrHelp + } + err = f.failf("unknown flag: --%s", name) + return + } + + var value string + if len(split) == 2 { + // '--flag=arg' + value = split[1] + } else if flag.NoOptDefVal != "" { + // '--flag' (arg was optional) + value = flag.NoOptDefVal + } else if len(a) > 0 { + // '--flag arg' + value = a[0] + a = a[1:] + } else { + // '--flag' (arg was required) + err = f.failf("flag needs an argument: %s", s) + return + } + + err = fn(flag, value) + return +} + +func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) { + if strings.HasPrefix(shorthands, "test.") { + return + } + + outArgs = args + outShorts = shorthands[1:] + c := shorthands[0] + + flag, exists := f.shorthands[c] + if !exists { + if c == 'h' { // special case for nice help message. + f.usage() + err = ErrHelp + return + } + err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands) + return + } + + var value string + if len(shorthands) > 2 && shorthands[1] == '=' { + // '-f=arg' + value = shorthands[2:] + outShorts = "" + } else if flag.NoOptDefVal != "" { + // '-f' (arg was optional) + value = flag.NoOptDefVal + } else if len(shorthands) > 1 { + // '-farg' + value = shorthands[1:] + outShorts = "" + } else if len(args) > 0 { + // '-f arg' + value = args[0] + outArgs = args[1:] + } else { + // '-f' (arg was required) + err = f.failf("flag needs an argument: %q in -%s", c, shorthands) + return + } + + if flag.ShorthandDeprecated != "" { + fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) + } + + err = fn(flag, value) + return +} + +func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []string, err error) { + a = args + shorthands := s[1:] + + // "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv"). + for len(shorthands) > 0 { + shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn) + if err != nil { + return + } + } + + return +} + +func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) { + for len(args) > 0 { + s := args[0] + args = args[1:] + if len(s) == 0 || s[0] != '-' || len(s) == 1 { + if !f.interspersed { + f.args = append(f.args, s) + f.args = append(f.args, args...) + return nil + } + f.args = append(f.args, s) + continue + } + + if s[1] == '-' { + if len(s) == 2 { // "--" terminates the flags + f.argsLenAtDash = len(f.args) + f.args = append(f.args, args...) + break + } + args, err = f.parseLongArg(s, args, fn) + } else { + args, err = f.parseShortArg(s, args, fn) + } + if err != nil { + return + } + } + return +} + +// Parse parses flag definitions from the argument list, which should not +// include the command name. Must be called after all flags in the FlagSet +// are defined and before flags are accessed by the program. +// The return value will be ErrHelp if -help was set but not defined. +func (f *FlagSet) Parse(arguments []string) error { + f.parsed = true + + if len(arguments) < 0 { + return nil + } + + f.args = make([]string, 0, len(arguments)) + + set := func(flag *Flag, value string) error { + return f.Set(flag.Name, value) + } + + err := f.parseArgs(arguments, set) + if err != nil { + switch f.errorHandling { + case ContinueOnError: + return err + case ExitOnError: + os.Exit(2) + case PanicOnError: + panic(err) + } + } + return nil +} + +type parseFunc func(flag *Flag, value string) error + +// ParseAll parses flag definitions from the argument list, which should not +// include the command name. The arguments for fn are flag and value. Must be +// called after all flags in the FlagSet are defined and before flags are +// accessed by the program. The return value will be ErrHelp if -help was set +// but not defined. +func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) error) error { + f.parsed = true + f.args = make([]string, 0, len(arguments)) + + err := f.parseArgs(arguments, fn) + if err != nil { + switch f.errorHandling { + case ContinueOnError: + return err + case ExitOnError: + os.Exit(2) + case PanicOnError: + panic(err) + } + } + return nil +} + +// Parsed reports whether f.Parse has been called. +func (f *FlagSet) Parsed() bool { + return f.parsed +} + +// Parse parses the command-line flags from os.Args[1:]. Must be called +// after all flags are defined and before flags are accessed by the program. +func Parse() { + // Ignore errors; CommandLine is set for ExitOnError. + CommandLine.Parse(os.Args[1:]) +} + +// ParseAll parses the command-line flags from os.Args[1:] and called fn for each. +// The arguments for fn are flag and value. Must be called after all flags are +// defined and before flags are accessed by the program. +func ParseAll(fn func(flag *Flag, value string) error) { + // Ignore errors; CommandLine is set for ExitOnError. + CommandLine.ParseAll(os.Args[1:], fn) +} + +// SetInterspersed sets whether to support interspersed option/non-option arguments. +func SetInterspersed(interspersed bool) { + CommandLine.SetInterspersed(interspersed) +} + +// Parsed returns true if the command-line flags have been parsed. +func Parsed() bool { + return CommandLine.Parsed() +} + +// CommandLine is the default set of command-line flags, parsed from os.Args. +var CommandLine = NewFlagSet(os.Args[0], ExitOnError) + +// NewFlagSet returns a new, empty flag set with the specified name, +// error handling property and SortFlags set to true. +func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet { + f := &FlagSet{ + name: name, + errorHandling: errorHandling, + argsLenAtDash: -1, + interspersed: true, + SortFlags: true, + } + return f +} + +// SetInterspersed sets whether to support interspersed option/non-option arguments. +func (f *FlagSet) SetInterspersed(interspersed bool) { + f.interspersed = interspersed +} + +// Init sets the name and error handling property for a flag set. +// By default, the zero FlagSet uses an empty name and the +// ContinueOnError error handling policy. +func (f *FlagSet) Init(name string, errorHandling ErrorHandling) { + f.name = name + f.errorHandling = errorHandling + f.argsLenAtDash = -1 +} diff --git a/vendor/github.com/spf13/pflag/flag_test.go b/vendor/github.com/spf13/pflag/flag_test.go index 211bb5ec7d..c3def0fd41 100644 --- a/vendor/github.com/spf13/pflag/flag_test.go +++ b/vendor/github.com/spf13/pflag/flag_test.go @@ -1,1085 +1,1085 @@ -// 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 pflag - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net" - "os" - "reflect" - "sort" - "strconv" - "strings" - "testing" - "time" -) - -var ( - testBool = Bool("test_bool", false, "bool value") - testInt = Int("test_int", 0, "int value") - testInt64 = Int64("test_int64", 0, "int64 value") - testUint = Uint("test_uint", 0, "uint value") - testUint64 = Uint64("test_uint64", 0, "uint64 value") - testString = String("test_string", "0", "string value") - testFloat = Float64("test_float64", 0, "float64 value") - testDuration = Duration("test_duration", 0, "time.Duration value") - testOptionalInt = Int("test_optional_int", 0, "optional int value") - normalizeFlagNameInvocations = 0 -) - -func boolString(s string) string { - if s == "0" { - return "false" - } - return "true" -} - -func TestEverything(t *testing.T) { - m := make(map[string]*Flag) - desired := "0" - visitor := func(f *Flag) { - if len(f.Name) > 5 && f.Name[0:5] == "test_" { - m[f.Name] = f - ok := false - switch { - case f.Value.String() == desired: - ok = true - case f.Name == "test_bool" && f.Value.String() == boolString(desired): - ok = true - case f.Name == "test_duration" && f.Value.String() == desired+"s": - ok = true - } - if !ok { - t.Error("Visit: bad value", f.Value.String(), "for", f.Name) - } - } - } - VisitAll(visitor) - if len(m) != 9 { - t.Error("VisitAll misses some flags") - for k, v := range m { - t.Log(k, *v) - } - } - m = make(map[string]*Flag) - Visit(visitor) - if len(m) != 0 { - t.Errorf("Visit sees unset flags") - for k, v := range m { - t.Log(k, *v) - } - } - // Now set all flags - Set("test_bool", "true") - Set("test_int", "1") - Set("test_int64", "1") - Set("test_uint", "1") - Set("test_uint64", "1") - Set("test_string", "1") - Set("test_float64", "1") - Set("test_duration", "1s") - Set("test_optional_int", "1") - desired = "1" - Visit(visitor) - if len(m) != 9 { - t.Error("Visit fails after set") - for k, v := range m { - t.Log(k, *v) - } - } - // Now test they're visited in sort order. - var flagNames []string - Visit(func(f *Flag) { flagNames = append(flagNames, f.Name) }) - if !sort.StringsAreSorted(flagNames) { - t.Errorf("flag names not sorted: %v", flagNames) - } -} - -func TestUsage(t *testing.T) { - called := false - ResetForTesting(func() { called = true }) - if GetCommandLine().Parse([]string{"--x"}) == nil { - t.Error("parse did not fail for unknown flag") - } - if !called { - t.Error("did not call Usage for unknown flag") - } -} - -func TestAddFlagSet(t *testing.T) { - oldSet := NewFlagSet("old", ContinueOnError) - newSet := NewFlagSet("new", ContinueOnError) - - oldSet.String("flag1", "flag1", "flag1") - oldSet.String("flag2", "flag2", "flag2") - - newSet.String("flag2", "flag2", "flag2") - newSet.String("flag3", "flag3", "flag3") - - oldSet.AddFlagSet(newSet) - - if len(oldSet.formal) != 3 { - t.Errorf("Unexpected result adding a FlagSet to a FlagSet %v", oldSet) - } -} - -func TestAnnotation(t *testing.T) { - f := NewFlagSet("shorthand", ContinueOnError) - - if err := f.SetAnnotation("missing-flag", "key", nil); err == nil { - t.Errorf("Expected error setting annotation on non-existent flag") - } - - f.StringP("stringa", "a", "", "string value") - if err := f.SetAnnotation("stringa", "key", nil); err != nil { - t.Errorf("Unexpected error setting new nil annotation: %v", err) - } - if annotation := f.Lookup("stringa").Annotations["key"]; annotation != nil { - t.Errorf("Unexpected annotation: %v", annotation) - } - - f.StringP("stringb", "b", "", "string2 value") - if err := f.SetAnnotation("stringb", "key", []string{"value1"}); err != nil { - t.Errorf("Unexpected error setting new annotation: %v", err) - } - if annotation := f.Lookup("stringb").Annotations["key"]; !reflect.DeepEqual(annotation, []string{"value1"}) { - t.Errorf("Unexpected annotation: %v", annotation) - } - - if err := f.SetAnnotation("stringb", "key", []string{"value2"}); err != nil { - t.Errorf("Unexpected error updating annotation: %v", err) - } - if annotation := f.Lookup("stringb").Annotations["key"]; !reflect.DeepEqual(annotation, []string{"value2"}) { - t.Errorf("Unexpected annotation: %v", annotation) - } -} - -func testParse(f *FlagSet, t *testing.T) { - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - boolFlag := f.Bool("bool", false, "bool value") - bool2Flag := f.Bool("bool2", false, "bool2 value") - bool3Flag := f.Bool("bool3", false, "bool3 value") - intFlag := f.Int("int", 0, "int value") - int8Flag := f.Int8("int8", 0, "int value") - int32Flag := f.Int32("int32", 0, "int value") - int64Flag := f.Int64("int64", 0, "int64 value") - uintFlag := f.Uint("uint", 0, "uint value") - uint8Flag := f.Uint8("uint8", 0, "uint value") - uint16Flag := f.Uint16("uint16", 0, "uint value") - uint32Flag := f.Uint32("uint32", 0, "uint value") - uint64Flag := f.Uint64("uint64", 0, "uint64 value") - stringFlag := f.String("string", "0", "string value") - float32Flag := f.Float32("float32", 0, "float32 value") - float64Flag := f.Float64("float64", 0, "float64 value") - ipFlag := f.IP("ip", net.ParseIP("127.0.0.1"), "ip value") - maskFlag := f.IPMask("mask", ParseIPv4Mask("0.0.0.0"), "mask value") - durationFlag := f.Duration("duration", 5*time.Second, "time.Duration value") - optionalIntNoValueFlag := f.Int("optional-int-no-value", 0, "int value") - f.Lookup("optional-int-no-value").NoOptDefVal = "9" - optionalIntWithValueFlag := f.Int("optional-int-with-value", 0, "int value") - f.Lookup("optional-int-no-value").NoOptDefVal = "9" - extra := "one-extra-argument" - args := []string{ - "--bool", - "--bool2=true", - "--bool3=false", - "--int=22", - "--int8=-8", - "--int32=-32", - "--int64=0x23", - "--uint", "24", - "--uint8=8", - "--uint16=16", - "--uint32=32", - "--uint64=25", - "--string=hello", - "--float32=-172e12", - "--float64=2718e28", - "--ip=10.11.12.13", - "--mask=255.255.255.0", - "--duration=2m", - "--optional-int-no-value", - "--optional-int-with-value=42", - extra, - } - if err := f.Parse(args); err != nil { - t.Fatal(err) - } - if !f.Parsed() { - t.Error("f.Parse() = false after Parse") - } - if *boolFlag != true { - t.Error("bool flag should be true, is ", *boolFlag) - } - if v, err := f.GetBool("bool"); err != nil || v != *boolFlag { - t.Error("GetBool does not work.") - } - if *bool2Flag != true { - t.Error("bool2 flag should be true, is ", *bool2Flag) - } - if *bool3Flag != false { - t.Error("bool3 flag should be false, is ", *bool2Flag) - } - if *intFlag != 22 { - t.Error("int flag should be 22, is ", *intFlag) - } - if v, err := f.GetInt("int"); err != nil || v != *intFlag { - t.Error("GetInt does not work.") - } - if *int8Flag != -8 { - t.Error("int8 flag should be 0x23, is ", *int8Flag) - } - if v, err := f.GetInt8("int8"); err != nil || v != *int8Flag { - t.Error("GetInt8 does not work.") - } - if *int32Flag != -32 { - t.Error("int32 flag should be 0x23, is ", *int32Flag) - } - if v, err := f.GetInt32("int32"); err != nil || v != *int32Flag { - t.Error("GetInt32 does not work.") - } - if *int64Flag != 0x23 { - t.Error("int64 flag should be 0x23, is ", *int64Flag) - } - if v, err := f.GetInt64("int64"); err != nil || v != *int64Flag { - t.Error("GetInt64 does not work.") - } - if *uintFlag != 24 { - t.Error("uint flag should be 24, is ", *uintFlag) - } - if v, err := f.GetUint("uint"); err != nil || v != *uintFlag { - t.Error("GetUint does not work.") - } - if *uint8Flag != 8 { - t.Error("uint8 flag should be 8, is ", *uint8Flag) - } - if v, err := f.GetUint8("uint8"); err != nil || v != *uint8Flag { - t.Error("GetUint8 does not work.") - } - if *uint16Flag != 16 { - t.Error("uint16 flag should be 16, is ", *uint16Flag) - } - if v, err := f.GetUint16("uint16"); err != nil || v != *uint16Flag { - t.Error("GetUint16 does not work.") - } - if *uint32Flag != 32 { - t.Error("uint32 flag should be 32, is ", *uint32Flag) - } - if v, err := f.GetUint32("uint32"); err != nil || v != *uint32Flag { - t.Error("GetUint32 does not work.") - } - if *uint64Flag != 25 { - t.Error("uint64 flag should be 25, is ", *uint64Flag) - } - if v, err := f.GetUint64("uint64"); err != nil || v != *uint64Flag { - t.Error("GetUint64 does not work.") - } - if *stringFlag != "hello" { - t.Error("string flag should be `hello`, is ", *stringFlag) - } - if v, err := f.GetString("string"); err != nil || v != *stringFlag { - t.Error("GetString does not work.") - } - if *float32Flag != -172e12 { - t.Error("float32 flag should be -172e12, is ", *float32Flag) - } - if v, err := f.GetFloat32("float32"); err != nil || v != *float32Flag { - t.Errorf("GetFloat32 returned %v but float32Flag was %v", v, *float32Flag) - } - if *float64Flag != 2718e28 { - t.Error("float64 flag should be 2718e28, is ", *float64Flag) - } - if v, err := f.GetFloat64("float64"); err != nil || v != *float64Flag { - t.Errorf("GetFloat64 returned %v but float64Flag was %v", v, *float64Flag) - } - if !(*ipFlag).Equal(net.ParseIP("10.11.12.13")) { - t.Error("ip flag should be 10.11.12.13, is ", *ipFlag) - } - if v, err := f.GetIP("ip"); err != nil || !v.Equal(*ipFlag) { - t.Errorf("GetIP returned %v but ipFlag was %v", v, *ipFlag) - } - if (*maskFlag).String() != ParseIPv4Mask("255.255.255.0").String() { - t.Error("mask flag should be 255.255.255.0, is ", (*maskFlag).String()) - } - if v, err := f.GetIPv4Mask("mask"); err != nil || v.String() != (*maskFlag).String() { - t.Errorf("GetIP returned %v maskFlag was %v error was %v", v, *maskFlag, err) - } - if *durationFlag != 2*time.Minute { - t.Error("duration flag should be 2m, is ", *durationFlag) - } - if v, err := f.GetDuration("duration"); err != nil || v != *durationFlag { - t.Error("GetDuration does not work.") - } - if _, err := f.GetInt("duration"); err == nil { - t.Error("GetInt parsed a time.Duration?!?!") - } - if *optionalIntNoValueFlag != 9 { - t.Error("optional int flag should be the default value, is ", *optionalIntNoValueFlag) - } - if *optionalIntWithValueFlag != 42 { - t.Error("optional int flag should be 42, is ", *optionalIntWithValueFlag) - } - if len(f.Args()) != 1 { - t.Error("expected one argument, got", len(f.Args())) - } else if f.Args()[0] != extra { - t.Errorf("expected argument %q got %q", extra, f.Args()[0]) - } -} - -func testParseAll(f *FlagSet, t *testing.T) { - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - f.BoolP("boola", "a", false, "bool value") - f.BoolP("boolb", "b", false, "bool2 value") - f.BoolP("boolc", "c", false, "bool3 value") - f.BoolP("boold", "d", false, "bool4 value") - f.StringP("stringa", "s", "0", "string value") - f.StringP("stringz", "z", "0", "string value") - f.StringP("stringx", "x", "0", "string value") - f.StringP("stringy", "y", "0", "string value") - f.Lookup("stringx").NoOptDefVal = "1" - args := []string{ - "-ab", - "-cs=xx", - "--stringz=something", - "-d=true", - "-x", - "-y", - "ee", - } - want := []string{ - "boola", "true", - "boolb", "true", - "boolc", "true", - "stringa", "xx", - "stringz", "something", - "boold", "true", - "stringx", "1", - "stringy", "ee", - } - got := []string{} - store := func(flag *Flag, value string) error { - got = append(got, flag.Name) - if len(value) > 0 { - got = append(got, value) - } - return nil - } - if err := f.ParseAll(args, store); err != nil { - t.Errorf("expected no error, got %s", err) - } - if !f.Parsed() { - t.Errorf("f.Parse() = false after Parse") - } - if !reflect.DeepEqual(got, want) { - t.Errorf("f.ParseAll() fail to restore the args") - t.Errorf("Got: %v", got) - t.Errorf("Want: %v", want) - } -} - -func TestShorthand(t *testing.T) { - f := NewFlagSet("shorthand", ContinueOnError) - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - boolaFlag := f.BoolP("boola", "a", false, "bool value") - boolbFlag := f.BoolP("boolb", "b", false, "bool2 value") - boolcFlag := f.BoolP("boolc", "c", false, "bool3 value") - booldFlag := f.BoolP("boold", "d", false, "bool4 value") - stringaFlag := f.StringP("stringa", "s", "0", "string value") - stringzFlag := f.StringP("stringz", "z", "0", "string value") - extra := "interspersed-argument" - notaflag := "--i-look-like-a-flag" - args := []string{ - "-ab", - extra, - "-cs", - "hello", - "-z=something", - "-d=true", - "--", - notaflag, - } - f.SetOutput(ioutil.Discard) - if err := f.Parse(args); err != nil { - t.Error("expected no error, got ", err) - } - if !f.Parsed() { - t.Error("f.Parse() = false after Parse") - } - if *boolaFlag != true { - t.Error("boola flag should be true, is ", *boolaFlag) - } - if *boolbFlag != true { - t.Error("boolb flag should be true, is ", *boolbFlag) - } - if *boolcFlag != true { - t.Error("boolc flag should be true, is ", *boolcFlag) - } - if *booldFlag != true { - t.Error("boold flag should be true, is ", *booldFlag) - } - if *stringaFlag != "hello" { - t.Error("stringa flag should be `hello`, is ", *stringaFlag) - } - if *stringzFlag != "something" { - t.Error("stringz flag should be `something`, is ", *stringzFlag) - } - if len(f.Args()) != 2 { - t.Error("expected one argument, got", len(f.Args())) - } else if f.Args()[0] != extra { - t.Errorf("expected argument %q got %q", extra, f.Args()[0]) - } else if f.Args()[1] != notaflag { - t.Errorf("expected argument %q got %q", notaflag, f.Args()[1]) - } - if f.ArgsLenAtDash() != 1 { - t.Errorf("expected argsLenAtDash %d got %d", f.ArgsLenAtDash(), 1) - } -} - -func TestShorthandLookup(t *testing.T) { - f := NewFlagSet("shorthand", ContinueOnError) - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - f.BoolP("boola", "a", false, "bool value") - f.BoolP("boolb", "b", false, "bool2 value") - args := []string{ - "-ab", - } - f.SetOutput(ioutil.Discard) - if err := f.Parse(args); err != nil { - t.Error("expected no error, got ", err) - } - if !f.Parsed() { - t.Error("f.Parse() = false after Parse") - } - flag := f.ShorthandLookup("a") - if flag == nil { - t.Errorf("f.ShorthandLookup(\"a\") returned nil") - } - if flag.Name != "boola" { - t.Errorf("f.ShorthandLookup(\"a\") found %q instead of \"boola\"", flag.Name) - } - flag = f.ShorthandLookup("") - if flag != nil { - t.Errorf("f.ShorthandLookup(\"\") did not return nil") - } - defer func() { - recover() - }() - flag = f.ShorthandLookup("ab") - // should NEVER get here. lookup should panic. defer'd func should recover it. - t.Errorf("f.ShorthandLookup(\"ab\") did not panic") -} - -func TestParse(t *testing.T) { - ResetForTesting(func() { t.Error("bad parse") }) - testParse(GetCommandLine(), t) -} - -func TestParseAll(t *testing.T) { - ResetForTesting(func() { t.Error("bad parse") }) - testParseAll(GetCommandLine(), t) -} - -func TestFlagSetParse(t *testing.T) { - testParse(NewFlagSet("test", ContinueOnError), t) -} - -func TestChangedHelper(t *testing.T) { - f := NewFlagSet("changedtest", ContinueOnError) - f.Bool("changed", false, "changed bool") - f.Bool("settrue", true, "true to true") - f.Bool("setfalse", false, "false to false") - f.Bool("unchanged", false, "unchanged bool") - - args := []string{"--changed", "--settrue", "--setfalse=false"} - if err := f.Parse(args); err != nil { - t.Error("f.Parse() = false after Parse") - } - if !f.Changed("changed") { - t.Errorf("--changed wasn't changed!") - } - if !f.Changed("settrue") { - t.Errorf("--settrue wasn't changed!") - } - if !f.Changed("setfalse") { - t.Errorf("--setfalse wasn't changed!") - } - if f.Changed("unchanged") { - t.Errorf("--unchanged was changed!") - } - if f.Changed("invalid") { - t.Errorf("--invalid was changed!") - } - if f.ArgsLenAtDash() != -1 { - t.Errorf("Expected argsLenAtDash: %d but got %d", -1, f.ArgsLenAtDash()) - } -} - -func replaceSeparators(name string, from []string, to string) string { - result := name - for _, sep := range from { - result = strings.Replace(result, sep, to, -1) - } - // Type convert to indicate normalization has been done. - return result -} - -func wordSepNormalizeFunc(f *FlagSet, name string) NormalizedName { - seps := []string{"-", "_"} - name = replaceSeparators(name, seps, ".") - normalizeFlagNameInvocations++ - - return NormalizedName(name) -} - -func testWordSepNormalizedNames(args []string, t *testing.T) { - f := NewFlagSet("normalized", ContinueOnError) - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - withDashFlag := f.Bool("with-dash-flag", false, "bool value") - // Set this after some flags have been added and before others. - f.SetNormalizeFunc(wordSepNormalizeFunc) - withUnderFlag := f.Bool("with_under_flag", false, "bool value") - withBothFlag := f.Bool("with-both_flag", false, "bool value") - if err := f.Parse(args); err != nil { - t.Fatal(err) - } - if !f.Parsed() { - t.Error("f.Parse() = false after Parse") - } - if *withDashFlag != true { - t.Error("withDashFlag flag should be true, is ", *withDashFlag) - } - if *withUnderFlag != true { - t.Error("withUnderFlag flag should be true, is ", *withUnderFlag) - } - if *withBothFlag != true { - t.Error("withBothFlag flag should be true, is ", *withBothFlag) - } -} - -func TestWordSepNormalizedNames(t *testing.T) { - args := []string{ - "--with-dash-flag", - "--with-under-flag", - "--with-both-flag", - } - testWordSepNormalizedNames(args, t) - - args = []string{ - "--with_dash_flag", - "--with_under_flag", - "--with_both_flag", - } - testWordSepNormalizedNames(args, t) - - args = []string{ - "--with-dash_flag", - "--with-under_flag", - "--with-both_flag", - } - testWordSepNormalizedNames(args, t) -} - -func aliasAndWordSepFlagNames(f *FlagSet, name string) NormalizedName { - seps := []string{"-", "_"} - - oldName := replaceSeparators("old-valid_flag", seps, ".") - newName := replaceSeparators("valid-flag", seps, ".") - - name = replaceSeparators(name, seps, ".") - switch name { - case oldName: - name = newName - break - } - - return NormalizedName(name) -} - -func TestCustomNormalizedNames(t *testing.T) { - f := NewFlagSet("normalized", ContinueOnError) - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - - validFlag := f.Bool("valid-flag", false, "bool value") - f.SetNormalizeFunc(aliasAndWordSepFlagNames) - someOtherFlag := f.Bool("some-other-flag", false, "bool value") - - args := []string{"--old_valid_flag", "--some-other_flag"} - if err := f.Parse(args); err != nil { - t.Fatal(err) - } - - if *validFlag != true { - t.Errorf("validFlag is %v even though we set the alias --old_valid_falg", *validFlag) - } - if *someOtherFlag != true { - t.Error("someOtherFlag should be true, is ", *someOtherFlag) - } -} - -// Every flag we add, the name (displayed also in usage) should normalized -func TestNormalizationFuncShouldChangeFlagName(t *testing.T) { - // Test normalization after addition - f := NewFlagSet("normalized", ContinueOnError) - - f.Bool("valid_flag", false, "bool value") - if f.Lookup("valid_flag").Name != "valid_flag" { - t.Error("The new flag should have the name 'valid_flag' instead of ", f.Lookup("valid_flag").Name) - } - - f.SetNormalizeFunc(wordSepNormalizeFunc) - if f.Lookup("valid_flag").Name != "valid.flag" { - t.Error("The new flag should have the name 'valid.flag' instead of ", f.Lookup("valid_flag").Name) - } - - // Test normalization before addition - f = NewFlagSet("normalized", ContinueOnError) - f.SetNormalizeFunc(wordSepNormalizeFunc) - - f.Bool("valid_flag", false, "bool value") - if f.Lookup("valid_flag").Name != "valid.flag" { - t.Error("The new flag should have the name 'valid.flag' instead of ", f.Lookup("valid_flag").Name) - } -} - -// Declare a user-defined flag type. -type flagVar []string - -func (f *flagVar) String() string { - return fmt.Sprint([]string(*f)) -} - -func (f *flagVar) Set(value string) error { - *f = append(*f, value) - return nil -} - -func (f *flagVar) Type() string { - return "flagVar" -} - -func TestUserDefined(t *testing.T) { - var flags FlagSet - flags.Init("test", ContinueOnError) - var v flagVar - flags.VarP(&v, "v", "v", "usage") - if err := flags.Parse([]string{"--v=1", "-v2", "-v", "3"}); err != nil { - t.Error(err) - } - if len(v) != 3 { - t.Fatal("expected 3 args; got ", len(v)) - } - expect := "[1 2 3]" - if v.String() != expect { - t.Errorf("expected value %q got %q", expect, v.String()) - } -} - -func TestSetOutput(t *testing.T) { - var flags FlagSet - var buf bytes.Buffer - flags.SetOutput(&buf) - flags.Init("test", ContinueOnError) - flags.Parse([]string{"--unknown"}) - if out := buf.String(); !strings.Contains(out, "--unknown") { - t.Logf("expected output mentioning unknown; got %q", out) - } -} - -// This tests that one can reset the flags. This still works but not well, and is -// superseded by FlagSet. -func TestChangingArgs(t *testing.T) { - ResetForTesting(func() { t.Fatal("bad parse") }) - oldArgs := os.Args - defer func() { os.Args = oldArgs }() - os.Args = []string{"cmd", "--before", "subcmd"} - before := Bool("before", false, "") - if err := GetCommandLine().Parse(os.Args[1:]); err != nil { - t.Fatal(err) - } - cmd := Arg(0) - os.Args = []string{"subcmd", "--after", "args"} - after := Bool("after", false, "") - Parse() - args := Args() - - if !*before || cmd != "subcmd" || !*after || len(args) != 1 || args[0] != "args" { - t.Fatalf("expected true subcmd true [args] got %v %v %v %v", *before, cmd, *after, args) - } -} - -// Test that -help invokes the usage message and returns ErrHelp. -func TestHelp(t *testing.T) { - var helpCalled = false - fs := NewFlagSet("help test", ContinueOnError) - fs.Usage = func() { helpCalled = true } - var flag bool - fs.BoolVar(&flag, "flag", false, "regular flag") - // Regular flag invocation should work - err := fs.Parse([]string{"--flag=true"}) - if err != nil { - t.Fatal("expected no error; got ", err) - } - if !flag { - t.Error("flag was not set by --flag") - } - if helpCalled { - t.Error("help called for regular flag") - helpCalled = false // reset for next test - } - // Help flag should work as expected. - err = fs.Parse([]string{"--help"}) - if err == nil { - t.Fatal("error expected") - } - if err != ErrHelp { - t.Fatal("expected ErrHelp; got ", err) - } - if !helpCalled { - t.Fatal("help was not called") - } - // If we define a help flag, that should override. - var help bool - fs.BoolVar(&help, "help", false, "help flag") - helpCalled = false - err = fs.Parse([]string{"--help"}) - if err != nil { - t.Fatal("expected no error for defined --help; got ", err) - } - if helpCalled { - t.Fatal("help was called; should not have been for defined help flag") - } -} - -func TestNoInterspersed(t *testing.T) { - f := NewFlagSet("test", ContinueOnError) - f.SetInterspersed(false) - f.Bool("true", true, "always true") - f.Bool("false", false, "always false") - err := f.Parse([]string{"--true", "break", "--false"}) - if err != nil { - t.Fatal("expected no error; got ", err) - } - args := f.Args() - if len(args) != 2 || args[0] != "break" || args[1] != "--false" { - t.Fatal("expected interspersed options/non-options to fail") - } -} - -func TestTermination(t *testing.T) { - f := NewFlagSet("termination", ContinueOnError) - boolFlag := f.BoolP("bool", "l", false, "bool value") - if f.Parsed() { - t.Error("f.Parse() = true before Parse") - } - arg1 := "ls" - arg2 := "-l" - args := []string{ - "--", - arg1, - arg2, - } - f.SetOutput(ioutil.Discard) - if err := f.Parse(args); err != nil { - t.Fatal("expected no error; got ", err) - } - if !f.Parsed() { - t.Error("f.Parse() = false after Parse") - } - if *boolFlag { - t.Error("expected boolFlag=false, got true") - } - if len(f.Args()) != 2 { - t.Errorf("expected 2 arguments, got %d: %v", len(f.Args()), f.Args()) - } - if f.Args()[0] != arg1 { - t.Errorf("expected argument %q got %q", arg1, f.Args()[0]) - } - if f.Args()[1] != arg2 { - t.Errorf("expected argument %q got %q", arg2, f.Args()[1]) - } - if f.ArgsLenAtDash() != 0 { - t.Errorf("expected argsLenAtDash %d got %d", 0, f.ArgsLenAtDash()) - } -} - -func TestDeprecatedFlagInDocs(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - f.Bool("badflag", true, "always true") - f.MarkDeprecated("badflag", "use --good-flag instead") - - out := new(bytes.Buffer) - f.SetOutput(out) - f.PrintDefaults() - - if strings.Contains(out.String(), "badflag") { - t.Errorf("found deprecated flag in usage!") - } -} - -func TestDeprecatedFlagShorthandInDocs(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - name := "noshorthandflag" - f.BoolP(name, "n", true, "always true") - f.MarkShorthandDeprecated("noshorthandflag", fmt.Sprintf("use --%s instead", name)) - - out := new(bytes.Buffer) - f.SetOutput(out) - f.PrintDefaults() - - if strings.Contains(out.String(), "-n,") { - t.Errorf("found deprecated flag shorthand in usage!") - } -} - -func parseReturnStderr(t *testing.T, f *FlagSet, args []string) (string, error) { - oldStderr := os.Stderr - r, w, _ := os.Pipe() - os.Stderr = w - - err := f.Parse(args) - - outC := make(chan string) - // copy the output in a separate goroutine so printing can't block indefinitely - go func() { - var buf bytes.Buffer - io.Copy(&buf, r) - outC <- buf.String() - }() - - w.Close() - os.Stderr = oldStderr - out := <-outC - - return out, err -} - -func TestDeprecatedFlagUsage(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - f.Bool("badflag", true, "always true") - usageMsg := "use --good-flag instead" - f.MarkDeprecated("badflag", usageMsg) - - args := []string{"--badflag"} - out, err := parseReturnStderr(t, f, args) - if err != nil { - t.Fatal("expected no error; got ", err) - } - - if !strings.Contains(out, usageMsg) { - t.Errorf("usageMsg not printed when using a deprecated flag!") - } -} - -func TestDeprecatedFlagShorthandUsage(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - name := "noshorthandflag" - f.BoolP(name, "n", true, "always true") - usageMsg := fmt.Sprintf("use --%s instead", name) - f.MarkShorthandDeprecated(name, usageMsg) - - args := []string{"-n"} - out, err := parseReturnStderr(t, f, args) - if err != nil { - t.Fatal("expected no error; got ", err) - } - - if !strings.Contains(out, usageMsg) { - t.Errorf("usageMsg not printed when using a deprecated flag!") - } -} - -func TestDeprecatedFlagUsageNormalized(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - f.Bool("bad-double_flag", true, "always true") - f.SetNormalizeFunc(wordSepNormalizeFunc) - usageMsg := "use --good-flag instead" - f.MarkDeprecated("bad_double-flag", usageMsg) - - args := []string{"--bad_double_flag"} - out, err := parseReturnStderr(t, f, args) - if err != nil { - t.Fatal("expected no error; got ", err) - } - - if !strings.Contains(out, usageMsg) { - t.Errorf("usageMsg not printed when using a deprecated flag!") - } -} - -// Name normalization function should be called only once on flag addition -func TestMultipleNormalizeFlagNameInvocations(t *testing.T) { - normalizeFlagNameInvocations = 0 - - f := NewFlagSet("normalized", ContinueOnError) - f.SetNormalizeFunc(wordSepNormalizeFunc) - f.Bool("with_under_flag", false, "bool value") - - if normalizeFlagNameInvocations != 1 { - t.Fatal("Expected normalizeFlagNameInvocations to be 1; got ", normalizeFlagNameInvocations) - } -} - -// -func TestHiddenFlagInUsage(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - f.Bool("secretFlag", true, "shhh") - f.MarkHidden("secretFlag") - - out := new(bytes.Buffer) - f.SetOutput(out) - f.PrintDefaults() - - if strings.Contains(out.String(), "secretFlag") { - t.Errorf("found hidden flag in usage!") - } -} - -// -func TestHiddenFlagUsage(t *testing.T) { - f := NewFlagSet("bob", ContinueOnError) - f.Bool("secretFlag", true, "shhh") - f.MarkHidden("secretFlag") - - args := []string{"--secretFlag"} - out, err := parseReturnStderr(t, f, args) - if err != nil { - t.Fatal("expected no error; got ", err) - } - - if strings.Contains(out, "shhh") { - t.Errorf("usage message printed when using a hidden flag!") - } -} - -const defaultOutput = ` --A for bootstrapping, allow 'any' type - --Alongflagname disable bounds checking - -C, --CCC a boolean defaulting to true (default true) - --D path set relative path for local imports - -E, --EEE num[=1234] a num with NoOptDefVal (default 4321) - --F number a non-zero number (default 2.7) - --G float a float that defaults to zero - --IP ip IP address with no default - --IPMask ipMask Netmask address with no default - --IPNet ipNet IP network with no default - --Ints intSlice int slice with zero default - --N int a non-zero int (default 27) - --ND1 string[="bar"] a string with NoOptDefVal (default "foo") - --ND2 num[=4321] a num with NoOptDefVal (default 1234) - --StringArray stringArray string array with zero default - --StringSlice stringSlice string slice with zero default - --Z int an int that defaults to zero - --custom custom custom Value implementation - --customP custom a VarP with default (default 10) - --maxT timeout set timeout for dial -` - -// Custom value that satisfies the Value interface. -type customValue int - -func (cv *customValue) String() string { return fmt.Sprintf("%v", *cv) } - -func (cv *customValue) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 64) - *cv = customValue(v) - return err -} - -func (cv *customValue) Type() string { return "custom" } - -func TestPrintDefaults(t *testing.T) { - fs := NewFlagSet("print defaults test", ContinueOnError) - var buf bytes.Buffer - fs.SetOutput(&buf) - fs.Bool("A", false, "for bootstrapping, allow 'any' type") - fs.Bool("Alongflagname", false, "disable bounds checking") - fs.BoolP("CCC", "C", true, "a boolean defaulting to true") - fs.String("D", "", "set relative `path` for local imports") - fs.Float64("F", 2.7, "a non-zero `number`") - fs.Float64("G", 0, "a float that defaults to zero") - fs.Int("N", 27, "a non-zero int") - fs.IntSlice("Ints", []int{}, "int slice with zero default") - fs.IP("IP", nil, "IP address with no default") - fs.IPMask("IPMask", nil, "Netmask address with no default") - fs.IPNet("IPNet", net.IPNet{}, "IP network with no default") - fs.Int("Z", 0, "an int that defaults to zero") - fs.Duration("maxT", 0, "set `timeout` for dial") - fs.String("ND1", "foo", "a string with NoOptDefVal") - fs.Lookup("ND1").NoOptDefVal = "bar" - fs.Int("ND2", 1234, "a `num` with NoOptDefVal") - fs.Lookup("ND2").NoOptDefVal = "4321" - fs.IntP("EEE", "E", 4321, "a `num` with NoOptDefVal") - fs.ShorthandLookup("E").NoOptDefVal = "1234" - fs.StringSlice("StringSlice", []string{}, "string slice with zero default") - fs.StringArray("StringArray", []string{}, "string array with zero default") - - var cv customValue - fs.Var(&cv, "custom", "custom Value implementation") - - cv2 := customValue(10) - fs.VarP(&cv2, "customP", "", "a VarP with default") - - fs.PrintDefaults() - got := buf.String() - if got != defaultOutput { - fmt.Println("\n" + got) - fmt.Println("\n" + defaultOutput) - t.Errorf("got %q want %q\n", got, defaultOutput) - } -} - -func TestVisitAllFlagOrder(t *testing.T) { - fs := NewFlagSet("TestVisitAllFlagOrder", ContinueOnError) - fs.SortFlags = false - // https://github.com/spf13/pflag/issues/120 - fs.SetNormalizeFunc(func(f *FlagSet, name string) NormalizedName { - return NormalizedName(name) - }) - - names := []string{"C", "B", "A", "D"} - for _, name := range names { - fs.Bool(name, false, "") - } - - i := 0 - fs.VisitAll(func(f *Flag) { - if names[i] != f.Name { - t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name) - } - i++ - }) -} - -func TestVisitFlagOrder(t *testing.T) { - fs := NewFlagSet("TestVisitFlagOrder", ContinueOnError) - fs.SortFlags = false - names := []string{"C", "B", "A", "D"} - for _, name := range names { - fs.Bool(name, false, "") - fs.Set(name, "true") - } - - i := 0 - fs.Visit(func(f *Flag) { - if names[i] != f.Name { - t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name) - } - i++ - }) -} +// 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 pflag + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net" + "os" + "reflect" + "sort" + "strconv" + "strings" + "testing" + "time" +) + +var ( + testBool = Bool("test_bool", false, "bool value") + testInt = Int("test_int", 0, "int value") + testInt64 = Int64("test_int64", 0, "int64 value") + testUint = Uint("test_uint", 0, "uint value") + testUint64 = Uint64("test_uint64", 0, "uint64 value") + testString = String("test_string", "0", "string value") + testFloat = Float64("test_float64", 0, "float64 value") + testDuration = Duration("test_duration", 0, "time.Duration value") + testOptionalInt = Int("test_optional_int", 0, "optional int value") + normalizeFlagNameInvocations = 0 +) + +func boolString(s string) string { + if s == "0" { + return "false" + } + return "true" +} + +func TestEverything(t *testing.T) { + m := make(map[string]*Flag) + desired := "0" + visitor := func(f *Flag) { + if len(f.Name) > 5 && f.Name[0:5] == "test_" { + m[f.Name] = f + ok := false + switch { + case f.Value.String() == desired: + ok = true + case f.Name == "test_bool" && f.Value.String() == boolString(desired): + ok = true + case f.Name == "test_duration" && f.Value.String() == desired+"s": + ok = true + } + if !ok { + t.Error("Visit: bad value", f.Value.String(), "for", f.Name) + } + } + } + VisitAll(visitor) + if len(m) != 9 { + t.Error("VisitAll misses some flags") + for k, v := range m { + t.Log(k, *v) + } + } + m = make(map[string]*Flag) + Visit(visitor) + if len(m) != 0 { + t.Errorf("Visit sees unset flags") + for k, v := range m { + t.Log(k, *v) + } + } + // Now set all flags + Set("test_bool", "true") + Set("test_int", "1") + Set("test_int64", "1") + Set("test_uint", "1") + Set("test_uint64", "1") + Set("test_string", "1") + Set("test_float64", "1") + Set("test_duration", "1s") + Set("test_optional_int", "1") + desired = "1" + Visit(visitor) + if len(m) != 9 { + t.Error("Visit fails after set") + for k, v := range m { + t.Log(k, *v) + } + } + // Now test they're visited in sort order. + var flagNames []string + Visit(func(f *Flag) { flagNames = append(flagNames, f.Name) }) + if !sort.StringsAreSorted(flagNames) { + t.Errorf("flag names not sorted: %v", flagNames) + } +} + +func TestUsage(t *testing.T) { + called := false + ResetForTesting(func() { called = true }) + if GetCommandLine().Parse([]string{"--x"}) == nil { + t.Error("parse did not fail for unknown flag") + } + if !called { + t.Error("did not call Usage for unknown flag") + } +} + +func TestAddFlagSet(t *testing.T) { + oldSet := NewFlagSet("old", ContinueOnError) + newSet := NewFlagSet("new", ContinueOnError) + + oldSet.String("flag1", "flag1", "flag1") + oldSet.String("flag2", "flag2", "flag2") + + newSet.String("flag2", "flag2", "flag2") + newSet.String("flag3", "flag3", "flag3") + + oldSet.AddFlagSet(newSet) + + if len(oldSet.formal) != 3 { + t.Errorf("Unexpected result adding a FlagSet to a FlagSet %v", oldSet) + } +} + +func TestAnnotation(t *testing.T) { + f := NewFlagSet("shorthand", ContinueOnError) + + if err := f.SetAnnotation("missing-flag", "key", nil); err == nil { + t.Errorf("Expected error setting annotation on non-existent flag") + } + + f.StringP("stringa", "a", "", "string value") + if err := f.SetAnnotation("stringa", "key", nil); err != nil { + t.Errorf("Unexpected error setting new nil annotation: %v", err) + } + if annotation := f.Lookup("stringa").Annotations["key"]; annotation != nil { + t.Errorf("Unexpected annotation: %v", annotation) + } + + f.StringP("stringb", "b", "", "string2 value") + if err := f.SetAnnotation("stringb", "key", []string{"value1"}); err != nil { + t.Errorf("Unexpected error setting new annotation: %v", err) + } + if annotation := f.Lookup("stringb").Annotations["key"]; !reflect.DeepEqual(annotation, []string{"value1"}) { + t.Errorf("Unexpected annotation: %v", annotation) + } + + if err := f.SetAnnotation("stringb", "key", []string{"value2"}); err != nil { + t.Errorf("Unexpected error updating annotation: %v", err) + } + if annotation := f.Lookup("stringb").Annotations["key"]; !reflect.DeepEqual(annotation, []string{"value2"}) { + t.Errorf("Unexpected annotation: %v", annotation) + } +} + +func testParse(f *FlagSet, t *testing.T) { + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + boolFlag := f.Bool("bool", false, "bool value") + bool2Flag := f.Bool("bool2", false, "bool2 value") + bool3Flag := f.Bool("bool3", false, "bool3 value") + intFlag := f.Int("int", 0, "int value") + int8Flag := f.Int8("int8", 0, "int value") + int32Flag := f.Int32("int32", 0, "int value") + int64Flag := f.Int64("int64", 0, "int64 value") + uintFlag := f.Uint("uint", 0, "uint value") + uint8Flag := f.Uint8("uint8", 0, "uint value") + uint16Flag := f.Uint16("uint16", 0, "uint value") + uint32Flag := f.Uint32("uint32", 0, "uint value") + uint64Flag := f.Uint64("uint64", 0, "uint64 value") + stringFlag := f.String("string", "0", "string value") + float32Flag := f.Float32("float32", 0, "float32 value") + float64Flag := f.Float64("float64", 0, "float64 value") + ipFlag := f.IP("ip", net.ParseIP("127.0.0.1"), "ip value") + maskFlag := f.IPMask("mask", ParseIPv4Mask("0.0.0.0"), "mask value") + durationFlag := f.Duration("duration", 5*time.Second, "time.Duration value") + optionalIntNoValueFlag := f.Int("optional-int-no-value", 0, "int value") + f.Lookup("optional-int-no-value").NoOptDefVal = "9" + optionalIntWithValueFlag := f.Int("optional-int-with-value", 0, "int value") + f.Lookup("optional-int-no-value").NoOptDefVal = "9" + extra := "one-extra-argument" + args := []string{ + "--bool", + "--bool2=true", + "--bool3=false", + "--int=22", + "--int8=-8", + "--int32=-32", + "--int64=0x23", + "--uint", "24", + "--uint8=8", + "--uint16=16", + "--uint32=32", + "--uint64=25", + "--string=hello", + "--float32=-172e12", + "--float64=2718e28", + "--ip=10.11.12.13", + "--mask=255.255.255.0", + "--duration=2m", + "--optional-int-no-value", + "--optional-int-with-value=42", + extra, + } + if err := f.Parse(args); err != nil { + t.Fatal(err) + } + if !f.Parsed() { + t.Error("f.Parse() = false after Parse") + } + if *boolFlag != true { + t.Error("bool flag should be true, is ", *boolFlag) + } + if v, err := f.GetBool("bool"); err != nil || v != *boolFlag { + t.Error("GetBool does not work.") + } + if *bool2Flag != true { + t.Error("bool2 flag should be true, is ", *bool2Flag) + } + if *bool3Flag != false { + t.Error("bool3 flag should be false, is ", *bool2Flag) + } + if *intFlag != 22 { + t.Error("int flag should be 22, is ", *intFlag) + } + if v, err := f.GetInt("int"); err != nil || v != *intFlag { + t.Error("GetInt does not work.") + } + if *int8Flag != -8 { + t.Error("int8 flag should be 0x23, is ", *int8Flag) + } + if v, err := f.GetInt8("int8"); err != nil || v != *int8Flag { + t.Error("GetInt8 does not work.") + } + if *int32Flag != -32 { + t.Error("int32 flag should be 0x23, is ", *int32Flag) + } + if v, err := f.GetInt32("int32"); err != nil || v != *int32Flag { + t.Error("GetInt32 does not work.") + } + if *int64Flag != 0x23 { + t.Error("int64 flag should be 0x23, is ", *int64Flag) + } + if v, err := f.GetInt64("int64"); err != nil || v != *int64Flag { + t.Error("GetInt64 does not work.") + } + if *uintFlag != 24 { + t.Error("uint flag should be 24, is ", *uintFlag) + } + if v, err := f.GetUint("uint"); err != nil || v != *uintFlag { + t.Error("GetUint does not work.") + } + if *uint8Flag != 8 { + t.Error("uint8 flag should be 8, is ", *uint8Flag) + } + if v, err := f.GetUint8("uint8"); err != nil || v != *uint8Flag { + t.Error("GetUint8 does not work.") + } + if *uint16Flag != 16 { + t.Error("uint16 flag should be 16, is ", *uint16Flag) + } + if v, err := f.GetUint16("uint16"); err != nil || v != *uint16Flag { + t.Error("GetUint16 does not work.") + } + if *uint32Flag != 32 { + t.Error("uint32 flag should be 32, is ", *uint32Flag) + } + if v, err := f.GetUint32("uint32"); err != nil || v != *uint32Flag { + t.Error("GetUint32 does not work.") + } + if *uint64Flag != 25 { + t.Error("uint64 flag should be 25, is ", *uint64Flag) + } + if v, err := f.GetUint64("uint64"); err != nil || v != *uint64Flag { + t.Error("GetUint64 does not work.") + } + if *stringFlag != "hello" { + t.Error("string flag should be `hello`, is ", *stringFlag) + } + if v, err := f.GetString("string"); err != nil || v != *stringFlag { + t.Error("GetString does not work.") + } + if *float32Flag != -172e12 { + t.Error("float32 flag should be -172e12, is ", *float32Flag) + } + if v, err := f.GetFloat32("float32"); err != nil || v != *float32Flag { + t.Errorf("GetFloat32 returned %v but float32Flag was %v", v, *float32Flag) + } + if *float64Flag != 2718e28 { + t.Error("float64 flag should be 2718e28, is ", *float64Flag) + } + if v, err := f.GetFloat64("float64"); err != nil || v != *float64Flag { + t.Errorf("GetFloat64 returned %v but float64Flag was %v", v, *float64Flag) + } + if !(*ipFlag).Equal(net.ParseIP("10.11.12.13")) { + t.Error("ip flag should be 10.11.12.13, is ", *ipFlag) + } + if v, err := f.GetIP("ip"); err != nil || !v.Equal(*ipFlag) { + t.Errorf("GetIP returned %v but ipFlag was %v", v, *ipFlag) + } + if (*maskFlag).String() != ParseIPv4Mask("255.255.255.0").String() { + t.Error("mask flag should be 255.255.255.0, is ", (*maskFlag).String()) + } + if v, err := f.GetIPv4Mask("mask"); err != nil || v.String() != (*maskFlag).String() { + t.Errorf("GetIP returned %v maskFlag was %v error was %v", v, *maskFlag, err) + } + if *durationFlag != 2*time.Minute { + t.Error("duration flag should be 2m, is ", *durationFlag) + } + if v, err := f.GetDuration("duration"); err != nil || v != *durationFlag { + t.Error("GetDuration does not work.") + } + if _, err := f.GetInt("duration"); err == nil { + t.Error("GetInt parsed a time.Duration?!?!") + } + if *optionalIntNoValueFlag != 9 { + t.Error("optional int flag should be the default value, is ", *optionalIntNoValueFlag) + } + if *optionalIntWithValueFlag != 42 { + t.Error("optional int flag should be 42, is ", *optionalIntWithValueFlag) + } + if len(f.Args()) != 1 { + t.Error("expected one argument, got", len(f.Args())) + } else if f.Args()[0] != extra { + t.Errorf("expected argument %q got %q", extra, f.Args()[0]) + } +} + +func testParseAll(f *FlagSet, t *testing.T) { + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + f.BoolP("boola", "a", false, "bool value") + f.BoolP("boolb", "b", false, "bool2 value") + f.BoolP("boolc", "c", false, "bool3 value") + f.BoolP("boold", "d", false, "bool4 value") + f.StringP("stringa", "s", "0", "string value") + f.StringP("stringz", "z", "0", "string value") + f.StringP("stringx", "x", "0", "string value") + f.StringP("stringy", "y", "0", "string value") + f.Lookup("stringx").NoOptDefVal = "1" + args := []string{ + "-ab", + "-cs=xx", + "--stringz=something", + "-d=true", + "-x", + "-y", + "ee", + } + want := []string{ + "boola", "true", + "boolb", "true", + "boolc", "true", + "stringa", "xx", + "stringz", "something", + "boold", "true", + "stringx", "1", + "stringy", "ee", + } + got := []string{} + store := func(flag *Flag, value string) error { + got = append(got, flag.Name) + if len(value) > 0 { + got = append(got, value) + } + return nil + } + if err := f.ParseAll(args, store); err != nil { + t.Errorf("expected no error, got %s", err) + } + if !f.Parsed() { + t.Errorf("f.Parse() = false after Parse") + } + if !reflect.DeepEqual(got, want) { + t.Errorf("f.ParseAll() fail to restore the args") + t.Errorf("Got: %v", got) + t.Errorf("Want: %v", want) + } +} + +func TestShorthand(t *testing.T) { + f := NewFlagSet("shorthand", ContinueOnError) + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + boolaFlag := f.BoolP("boola", "a", false, "bool value") + boolbFlag := f.BoolP("boolb", "b", false, "bool2 value") + boolcFlag := f.BoolP("boolc", "c", false, "bool3 value") + booldFlag := f.BoolP("boold", "d", false, "bool4 value") + stringaFlag := f.StringP("stringa", "s", "0", "string value") + stringzFlag := f.StringP("stringz", "z", "0", "string value") + extra := "interspersed-argument" + notaflag := "--i-look-like-a-flag" + args := []string{ + "-ab", + extra, + "-cs", + "hello", + "-z=something", + "-d=true", + "--", + notaflag, + } + f.SetOutput(ioutil.Discard) + if err := f.Parse(args); err != nil { + t.Error("expected no error, got ", err) + } + if !f.Parsed() { + t.Error("f.Parse() = false after Parse") + } + if *boolaFlag != true { + t.Error("boola flag should be true, is ", *boolaFlag) + } + if *boolbFlag != true { + t.Error("boolb flag should be true, is ", *boolbFlag) + } + if *boolcFlag != true { + t.Error("boolc flag should be true, is ", *boolcFlag) + } + if *booldFlag != true { + t.Error("boold flag should be true, is ", *booldFlag) + } + if *stringaFlag != "hello" { + t.Error("stringa flag should be `hello`, is ", *stringaFlag) + } + if *stringzFlag != "something" { + t.Error("stringz flag should be `something`, is ", *stringzFlag) + } + if len(f.Args()) != 2 { + t.Error("expected one argument, got", len(f.Args())) + } else if f.Args()[0] != extra { + t.Errorf("expected argument %q got %q", extra, f.Args()[0]) + } else if f.Args()[1] != notaflag { + t.Errorf("expected argument %q got %q", notaflag, f.Args()[1]) + } + if f.ArgsLenAtDash() != 1 { + t.Errorf("expected argsLenAtDash %d got %d", f.ArgsLenAtDash(), 1) + } +} + +func TestShorthandLookup(t *testing.T) { + f := NewFlagSet("shorthand", ContinueOnError) + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + f.BoolP("boola", "a", false, "bool value") + f.BoolP("boolb", "b", false, "bool2 value") + args := []string{ + "-ab", + } + f.SetOutput(ioutil.Discard) + if err := f.Parse(args); err != nil { + t.Error("expected no error, got ", err) + } + if !f.Parsed() { + t.Error("f.Parse() = false after Parse") + } + flag := f.ShorthandLookup("a") + if flag == nil { + t.Errorf("f.ShorthandLookup(\"a\") returned nil") + } + if flag.Name != "boola" { + t.Errorf("f.ShorthandLookup(\"a\") found %q instead of \"boola\"", flag.Name) + } + flag = f.ShorthandLookup("") + if flag != nil { + t.Errorf("f.ShorthandLookup(\"\") did not return nil") + } + defer func() { + recover() + }() + flag = f.ShorthandLookup("ab") + // should NEVER get here. lookup should panic. defer'd func should recover it. + t.Errorf("f.ShorthandLookup(\"ab\") did not panic") +} + +func TestParse(t *testing.T) { + ResetForTesting(func() { t.Error("bad parse") }) + testParse(GetCommandLine(), t) +} + +func TestParseAll(t *testing.T) { + ResetForTesting(func() { t.Error("bad parse") }) + testParseAll(GetCommandLine(), t) +} + +func TestFlagSetParse(t *testing.T) { + testParse(NewFlagSet("test", ContinueOnError), t) +} + +func TestChangedHelper(t *testing.T) { + f := NewFlagSet("changedtest", ContinueOnError) + f.Bool("changed", false, "changed bool") + f.Bool("settrue", true, "true to true") + f.Bool("setfalse", false, "false to false") + f.Bool("unchanged", false, "unchanged bool") + + args := []string{"--changed", "--settrue", "--setfalse=false"} + if err := f.Parse(args); err != nil { + t.Error("f.Parse() = false after Parse") + } + if !f.Changed("changed") { + t.Errorf("--changed wasn't changed!") + } + if !f.Changed("settrue") { + t.Errorf("--settrue wasn't changed!") + } + if !f.Changed("setfalse") { + t.Errorf("--setfalse wasn't changed!") + } + if f.Changed("unchanged") { + t.Errorf("--unchanged was changed!") + } + if f.Changed("invalid") { + t.Errorf("--invalid was changed!") + } + if f.ArgsLenAtDash() != -1 { + t.Errorf("Expected argsLenAtDash: %d but got %d", -1, f.ArgsLenAtDash()) + } +} + +func replaceSeparators(name string, from []string, to string) string { + result := name + for _, sep := range from { + result = strings.Replace(result, sep, to, -1) + } + // Type convert to indicate normalization has been done. + return result +} + +func wordSepNormalizeFunc(f *FlagSet, name string) NormalizedName { + seps := []string{"-", "_"} + name = replaceSeparators(name, seps, ".") + normalizeFlagNameInvocations++ + + return NormalizedName(name) +} + +func testWordSepNormalizedNames(args []string, t *testing.T) { + f := NewFlagSet("normalized", ContinueOnError) + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + withDashFlag := f.Bool("with-dash-flag", false, "bool value") + // Set this after some flags have been added and before others. + f.SetNormalizeFunc(wordSepNormalizeFunc) + withUnderFlag := f.Bool("with_under_flag", false, "bool value") + withBothFlag := f.Bool("with-both_flag", false, "bool value") + if err := f.Parse(args); err != nil { + t.Fatal(err) + } + if !f.Parsed() { + t.Error("f.Parse() = false after Parse") + } + if *withDashFlag != true { + t.Error("withDashFlag flag should be true, is ", *withDashFlag) + } + if *withUnderFlag != true { + t.Error("withUnderFlag flag should be true, is ", *withUnderFlag) + } + if *withBothFlag != true { + t.Error("withBothFlag flag should be true, is ", *withBothFlag) + } +} + +func TestWordSepNormalizedNames(t *testing.T) { + args := []string{ + "--with-dash-flag", + "--with-under-flag", + "--with-both-flag", + } + testWordSepNormalizedNames(args, t) + + args = []string{ + "--with_dash_flag", + "--with_under_flag", + "--with_both_flag", + } + testWordSepNormalizedNames(args, t) + + args = []string{ + "--with-dash_flag", + "--with-under_flag", + "--with-both_flag", + } + testWordSepNormalizedNames(args, t) +} + +func aliasAndWordSepFlagNames(f *FlagSet, name string) NormalizedName { + seps := []string{"-", "_"} + + oldName := replaceSeparators("old-valid_flag", seps, ".") + newName := replaceSeparators("valid-flag", seps, ".") + + name = replaceSeparators(name, seps, ".") + switch name { + case oldName: + name = newName + break + } + + return NormalizedName(name) +} + +func TestCustomNormalizedNames(t *testing.T) { + f := NewFlagSet("normalized", ContinueOnError) + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + + validFlag := f.Bool("valid-flag", false, "bool value") + f.SetNormalizeFunc(aliasAndWordSepFlagNames) + someOtherFlag := f.Bool("some-other-flag", false, "bool value") + + args := []string{"--old_valid_flag", "--some-other_flag"} + if err := f.Parse(args); err != nil { + t.Fatal(err) + } + + if *validFlag != true { + t.Errorf("validFlag is %v even though we set the alias --old_valid_falg", *validFlag) + } + if *someOtherFlag != true { + t.Error("someOtherFlag should be true, is ", *someOtherFlag) + } +} + +// Every flag we add, the name (displayed also in usage) should normalized +func TestNormalizationFuncShouldChangeFlagName(t *testing.T) { + // Test normalization after addition + f := NewFlagSet("normalized", ContinueOnError) + + f.Bool("valid_flag", false, "bool value") + if f.Lookup("valid_flag").Name != "valid_flag" { + t.Error("The new flag should have the name 'valid_flag' instead of ", f.Lookup("valid_flag").Name) + } + + f.SetNormalizeFunc(wordSepNormalizeFunc) + if f.Lookup("valid_flag").Name != "valid.flag" { + t.Error("The new flag should have the name 'valid.flag' instead of ", f.Lookup("valid_flag").Name) + } + + // Test normalization before addition + f = NewFlagSet("normalized", ContinueOnError) + f.SetNormalizeFunc(wordSepNormalizeFunc) + + f.Bool("valid_flag", false, "bool value") + if f.Lookup("valid_flag").Name != "valid.flag" { + t.Error("The new flag should have the name 'valid.flag' instead of ", f.Lookup("valid_flag").Name) + } +} + +// Declare a user-defined flag type. +type flagVar []string + +func (f *flagVar) String() string { + return fmt.Sprint([]string(*f)) +} + +func (f *flagVar) Set(value string) error { + *f = append(*f, value) + return nil +} + +func (f *flagVar) Type() string { + return "flagVar" +} + +func TestUserDefined(t *testing.T) { + var flags FlagSet + flags.Init("test", ContinueOnError) + var v flagVar + flags.VarP(&v, "v", "v", "usage") + if err := flags.Parse([]string{"--v=1", "-v2", "-v", "3"}); err != nil { + t.Error(err) + } + if len(v) != 3 { + t.Fatal("expected 3 args; got ", len(v)) + } + expect := "[1 2 3]" + if v.String() != expect { + t.Errorf("expected value %q got %q", expect, v.String()) + } +} + +func TestSetOutput(t *testing.T) { + var flags FlagSet + var buf bytes.Buffer + flags.SetOutput(&buf) + flags.Init("test", ContinueOnError) + flags.Parse([]string{"--unknown"}) + if out := buf.String(); !strings.Contains(out, "--unknown") { + t.Logf("expected output mentioning unknown; got %q", out) + } +} + +// This tests that one can reset the flags. This still works but not well, and is +// superseded by FlagSet. +func TestChangingArgs(t *testing.T) { + ResetForTesting(func() { t.Fatal("bad parse") }) + oldArgs := os.Args + defer func() { os.Args = oldArgs }() + os.Args = []string{"cmd", "--before", "subcmd"} + before := Bool("before", false, "") + if err := GetCommandLine().Parse(os.Args[1:]); err != nil { + t.Fatal(err) + } + cmd := Arg(0) + os.Args = []string{"subcmd", "--after", "args"} + after := Bool("after", false, "") + Parse() + args := Args() + + if !*before || cmd != "subcmd" || !*after || len(args) != 1 || args[0] != "args" { + t.Fatalf("expected true subcmd true [args] got %v %v %v %v", *before, cmd, *after, args) + } +} + +// Test that -help invokes the usage message and returns ErrHelp. +func TestHelp(t *testing.T) { + var helpCalled = false + fs := NewFlagSet("help test", ContinueOnError) + fs.Usage = func() { helpCalled = true } + var flag bool + fs.BoolVar(&flag, "flag", false, "regular flag") + // Regular flag invocation should work + err := fs.Parse([]string{"--flag=true"}) + if err != nil { + t.Fatal("expected no error; got ", err) + } + if !flag { + t.Error("flag was not set by --flag") + } + if helpCalled { + t.Error("help called for regular flag") + helpCalled = false // reset for next test + } + // Help flag should work as expected. + err = fs.Parse([]string{"--help"}) + if err == nil { + t.Fatal("error expected") + } + if err != ErrHelp { + t.Fatal("expected ErrHelp; got ", err) + } + if !helpCalled { + t.Fatal("help was not called") + } + // If we define a help flag, that should override. + var help bool + fs.BoolVar(&help, "help", false, "help flag") + helpCalled = false + err = fs.Parse([]string{"--help"}) + if err != nil { + t.Fatal("expected no error for defined --help; got ", err) + } + if helpCalled { + t.Fatal("help was called; should not have been for defined help flag") + } +} + +func TestNoInterspersed(t *testing.T) { + f := NewFlagSet("test", ContinueOnError) + f.SetInterspersed(false) + f.Bool("true", true, "always true") + f.Bool("false", false, "always false") + err := f.Parse([]string{"--true", "break", "--false"}) + if err != nil { + t.Fatal("expected no error; got ", err) + } + args := f.Args() + if len(args) != 2 || args[0] != "break" || args[1] != "--false" { + t.Fatal("expected interspersed options/non-options to fail") + } +} + +func TestTermination(t *testing.T) { + f := NewFlagSet("termination", ContinueOnError) + boolFlag := f.BoolP("bool", "l", false, "bool value") + if f.Parsed() { + t.Error("f.Parse() = true before Parse") + } + arg1 := "ls" + arg2 := "-l" + args := []string{ + "--", + arg1, + arg2, + } + f.SetOutput(ioutil.Discard) + if err := f.Parse(args); err != nil { + t.Fatal("expected no error; got ", err) + } + if !f.Parsed() { + t.Error("f.Parse() = false after Parse") + } + if *boolFlag { + t.Error("expected boolFlag=false, got true") + } + if len(f.Args()) != 2 { + t.Errorf("expected 2 arguments, got %d: %v", len(f.Args()), f.Args()) + } + if f.Args()[0] != arg1 { + t.Errorf("expected argument %q got %q", arg1, f.Args()[0]) + } + if f.Args()[1] != arg2 { + t.Errorf("expected argument %q got %q", arg2, f.Args()[1]) + } + if f.ArgsLenAtDash() != 0 { + t.Errorf("expected argsLenAtDash %d got %d", 0, f.ArgsLenAtDash()) + } +} + +func TestDeprecatedFlagInDocs(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + f.Bool("badflag", true, "always true") + f.MarkDeprecated("badflag", "use --good-flag instead") + + out := new(bytes.Buffer) + f.SetOutput(out) + f.PrintDefaults() + + if strings.Contains(out.String(), "badflag") { + t.Errorf("found deprecated flag in usage!") + } +} + +func TestDeprecatedFlagShorthandInDocs(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + name := "noshorthandflag" + f.BoolP(name, "n", true, "always true") + f.MarkShorthandDeprecated("noshorthandflag", fmt.Sprintf("use --%s instead", name)) + + out := new(bytes.Buffer) + f.SetOutput(out) + f.PrintDefaults() + + if strings.Contains(out.String(), "-n,") { + t.Errorf("found deprecated flag shorthand in usage!") + } +} + +func parseReturnStderr(t *testing.T, f *FlagSet, args []string) (string, error) { + oldStderr := os.Stderr + r, w, _ := os.Pipe() + os.Stderr = w + + err := f.Parse(args) + + outC := make(chan string) + // copy the output in a separate goroutine so printing can't block indefinitely + go func() { + var buf bytes.Buffer + io.Copy(&buf, r) + outC <- buf.String() + }() + + w.Close() + os.Stderr = oldStderr + out := <-outC + + return out, err +} + +func TestDeprecatedFlagUsage(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + f.Bool("badflag", true, "always true") + usageMsg := "use --good-flag instead" + f.MarkDeprecated("badflag", usageMsg) + + args := []string{"--badflag"} + out, err := parseReturnStderr(t, f, args) + if err != nil { + t.Fatal("expected no error; got ", err) + } + + if !strings.Contains(out, usageMsg) { + t.Errorf("usageMsg not printed when using a deprecated flag!") + } +} + +func TestDeprecatedFlagShorthandUsage(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + name := "noshorthandflag" + f.BoolP(name, "n", true, "always true") + usageMsg := fmt.Sprintf("use --%s instead", name) + f.MarkShorthandDeprecated(name, usageMsg) + + args := []string{"-n"} + out, err := parseReturnStderr(t, f, args) + if err != nil { + t.Fatal("expected no error; got ", err) + } + + if !strings.Contains(out, usageMsg) { + t.Errorf("usageMsg not printed when using a deprecated flag!") + } +} + +func TestDeprecatedFlagUsageNormalized(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + f.Bool("bad-double_flag", true, "always true") + f.SetNormalizeFunc(wordSepNormalizeFunc) + usageMsg := "use --good-flag instead" + f.MarkDeprecated("bad_double-flag", usageMsg) + + args := []string{"--bad_double_flag"} + out, err := parseReturnStderr(t, f, args) + if err != nil { + t.Fatal("expected no error; got ", err) + } + + if !strings.Contains(out, usageMsg) { + t.Errorf("usageMsg not printed when using a deprecated flag!") + } +} + +// Name normalization function should be called only once on flag addition +func TestMultipleNormalizeFlagNameInvocations(t *testing.T) { + normalizeFlagNameInvocations = 0 + + f := NewFlagSet("normalized", ContinueOnError) + f.SetNormalizeFunc(wordSepNormalizeFunc) + f.Bool("with_under_flag", false, "bool value") + + if normalizeFlagNameInvocations != 1 { + t.Fatal("Expected normalizeFlagNameInvocations to be 1; got ", normalizeFlagNameInvocations) + } +} + +// +func TestHiddenFlagInUsage(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + f.Bool("secretFlag", true, "shhh") + f.MarkHidden("secretFlag") + + out := new(bytes.Buffer) + f.SetOutput(out) + f.PrintDefaults() + + if strings.Contains(out.String(), "secretFlag") { + t.Errorf("found hidden flag in usage!") + } +} + +// +func TestHiddenFlagUsage(t *testing.T) { + f := NewFlagSet("bob", ContinueOnError) + f.Bool("secretFlag", true, "shhh") + f.MarkHidden("secretFlag") + + args := []string{"--secretFlag"} + out, err := parseReturnStderr(t, f, args) + if err != nil { + t.Fatal("expected no error; got ", err) + } + + if strings.Contains(out, "shhh") { + t.Errorf("usage message printed when using a hidden flag!") + } +} + +const defaultOutput = ` --A for bootstrapping, allow 'any' type + --Alongflagname disable bounds checking + -C, --CCC a boolean defaulting to true (default true) + --D path set relative path for local imports + -E, --EEE num[=1234] a num with NoOptDefVal (default 4321) + --F number a non-zero number (default 2.7) + --G float a float that defaults to zero + --IP ip IP address with no default + --IPMask ipMask Netmask address with no default + --IPNet ipNet IP network with no default + --Ints intSlice int slice with zero default + --N int a non-zero int (default 27) + --ND1 string[="bar"] a string with NoOptDefVal (default "foo") + --ND2 num[=4321] a num with NoOptDefVal (default 1234) + --StringArray stringArray string array with zero default + --StringSlice stringSlice string slice with zero default + --Z int an int that defaults to zero + --custom custom custom Value implementation + --customP custom a VarP with default (default 10) + --maxT timeout set timeout for dial +` + +// Custom value that satisfies the Value interface. +type customValue int + +func (cv *customValue) String() string { return fmt.Sprintf("%v", *cv) } + +func (cv *customValue) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 64) + *cv = customValue(v) + return err +} + +func (cv *customValue) Type() string { return "custom" } + +func TestPrintDefaults(t *testing.T) { + fs := NewFlagSet("print defaults test", ContinueOnError) + var buf bytes.Buffer + fs.SetOutput(&buf) + fs.Bool("A", false, "for bootstrapping, allow 'any' type") + fs.Bool("Alongflagname", false, "disable bounds checking") + fs.BoolP("CCC", "C", true, "a boolean defaulting to true") + fs.String("D", "", "set relative `path` for local imports") + fs.Float64("F", 2.7, "a non-zero `number`") + fs.Float64("G", 0, "a float that defaults to zero") + fs.Int("N", 27, "a non-zero int") + fs.IntSlice("Ints", []int{}, "int slice with zero default") + fs.IP("IP", nil, "IP address with no default") + fs.IPMask("IPMask", nil, "Netmask address with no default") + fs.IPNet("IPNet", net.IPNet{}, "IP network with no default") + fs.Int("Z", 0, "an int that defaults to zero") + fs.Duration("maxT", 0, "set `timeout` for dial") + fs.String("ND1", "foo", "a string with NoOptDefVal") + fs.Lookup("ND1").NoOptDefVal = "bar" + fs.Int("ND2", 1234, "a `num` with NoOptDefVal") + fs.Lookup("ND2").NoOptDefVal = "4321" + fs.IntP("EEE", "E", 4321, "a `num` with NoOptDefVal") + fs.ShorthandLookup("E").NoOptDefVal = "1234" + fs.StringSlice("StringSlice", []string{}, "string slice with zero default") + fs.StringArray("StringArray", []string{}, "string array with zero default") + + var cv customValue + fs.Var(&cv, "custom", "custom Value implementation") + + cv2 := customValue(10) + fs.VarP(&cv2, "customP", "", "a VarP with default") + + fs.PrintDefaults() + got := buf.String() + if got != defaultOutput { + fmt.Println("\n" + got) + fmt.Println("\n" + defaultOutput) + t.Errorf("got %q want %q\n", got, defaultOutput) + } +} + +func TestVisitAllFlagOrder(t *testing.T) { + fs := NewFlagSet("TestVisitAllFlagOrder", ContinueOnError) + fs.SortFlags = false + // https://github.com/spf13/pflag/issues/120 + fs.SetNormalizeFunc(func(f *FlagSet, name string) NormalizedName { + return NormalizedName(name) + }) + + names := []string{"C", "B", "A", "D"} + for _, name := range names { + fs.Bool(name, false, "") + } + + i := 0 + fs.VisitAll(func(f *Flag) { + if names[i] != f.Name { + t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name) + } + i++ + }) +} + +func TestVisitFlagOrder(t *testing.T) { + fs := NewFlagSet("TestVisitFlagOrder", ContinueOnError) + fs.SortFlags = false + names := []string{"C", "B", "A", "D"} + for _, name := range names { + fs.Bool(name, false, "") + fs.Set(name, "true") + } + + i := 0 + fs.Visit(func(f *Flag) { + if names[i] != f.Name { + t.Errorf("Incorrect order. Expected %v, got %v", names[i], f.Name) + } + i++ + }) +} diff --git a/vendor/github.com/spf13/pflag/float32.go b/vendor/github.com/spf13/pflag/float32.go index 3888d0ea80..a243f81f7f 100644 --- a/vendor/github.com/spf13/pflag/float32.go +++ b/vendor/github.com/spf13/pflag/float32.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- float32 Value -type float32Value float32 - -func newFloat32Value(val float32, p *float32) *float32Value { - *p = val - return (*float32Value)(p) -} - -func (f *float32Value) Set(s string) error { - v, err := strconv.ParseFloat(s, 32) - *f = float32Value(v) - return err -} - -func (f *float32Value) Type() string { - return "float32" -} - -func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) } - -func float32Conv(sval string) (interface{}, error) { - v, err := strconv.ParseFloat(sval, 32) - if err != nil { - return 0, err - } - return float32(v), nil -} - -// GetFloat32 return the float32 value of a flag with the given name -func (f *FlagSet) GetFloat32(name string) (float32, error) { - val, err := f.getFlagType(name, "float32", float32Conv) - if err != nil { - return 0, err - } - return val.(float32), nil -} - -// Float32Var defines a float32 flag with specified name, default value, and usage string. -// The argument p points to a float32 variable in which to store the value of the flag. -func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) { - f.VarP(newFloat32Value(value, p), name, "", usage) -} - -// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) { - f.VarP(newFloat32Value(value, p), name, shorthand, usage) -} - -// Float32Var defines a float32 flag with specified name, default value, and usage string. -// The argument p points to a float32 variable in which to store the value of the flag. -func Float32Var(p *float32, name string, value float32, usage string) { - CommandLine.VarP(newFloat32Value(value, p), name, "", usage) -} - -// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. -func Float32VarP(p *float32, name, shorthand string, value float32, usage string) { - CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage) -} - -// Float32 defines a float32 flag with specified name, default value, and usage string. -// The return value is the address of a float32 variable that stores the value of the flag. -func (f *FlagSet) Float32(name string, value float32, usage string) *float32 { - p := new(float32) - f.Float32VarP(p, name, "", value, usage) - return p -} - -// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 { - p := new(float32) - f.Float32VarP(p, name, shorthand, value, usage) - return p -} - -// Float32 defines a float32 flag with specified name, default value, and usage string. -// The return value is the address of a float32 variable that stores the value of the flag. -func Float32(name string, value float32, usage string) *float32 { - return CommandLine.Float32P(name, "", value, usage) -} - -// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. -func Float32P(name, shorthand string, value float32, usage string) *float32 { - return CommandLine.Float32P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- float32 Value +type float32Value float32 + +func newFloat32Value(val float32, p *float32) *float32Value { + *p = val + return (*float32Value)(p) +} + +func (f *float32Value) Set(s string) error { + v, err := strconv.ParseFloat(s, 32) + *f = float32Value(v) + return err +} + +func (f *float32Value) Type() string { + return "float32" +} + +func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) } + +func float32Conv(sval string) (interface{}, error) { + v, err := strconv.ParseFloat(sval, 32) + if err != nil { + return 0, err + } + return float32(v), nil +} + +// GetFloat32 return the float32 value of a flag with the given name +func (f *FlagSet) GetFloat32(name string) (float32, error) { + val, err := f.getFlagType(name, "float32", float32Conv) + if err != nil { + return 0, err + } + return val.(float32), nil +} + +// Float32Var defines a float32 flag with specified name, default value, and usage string. +// The argument p points to a float32 variable in which to store the value of the flag. +func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) { + f.VarP(newFloat32Value(value, p), name, "", usage) +} + +// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) { + f.VarP(newFloat32Value(value, p), name, shorthand, usage) +} + +// Float32Var defines a float32 flag with specified name, default value, and usage string. +// The argument p points to a float32 variable in which to store the value of the flag. +func Float32Var(p *float32, name string, value float32, usage string) { + CommandLine.VarP(newFloat32Value(value, p), name, "", usage) +} + +// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. +func Float32VarP(p *float32, name, shorthand string, value float32, usage string) { + CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage) +} + +// Float32 defines a float32 flag with specified name, default value, and usage string. +// The return value is the address of a float32 variable that stores the value of the flag. +func (f *FlagSet) Float32(name string, value float32, usage string) *float32 { + p := new(float32) + f.Float32VarP(p, name, "", value, usage) + return p +} + +// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 { + p := new(float32) + f.Float32VarP(p, name, shorthand, value, usage) + return p +} + +// Float32 defines a float32 flag with specified name, default value, and usage string. +// The return value is the address of a float32 variable that stores the value of the flag. +func Float32(name string, value float32, usage string) *float32 { + return CommandLine.Float32P(name, "", value, usage) +} + +// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. +func Float32P(name, shorthand string, value float32, usage string) *float32 { + return CommandLine.Float32P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/float64.go b/vendor/github.com/spf13/pflag/float64.go index c45fb67a8f..04b5492a7d 100644 --- a/vendor/github.com/spf13/pflag/float64.go +++ b/vendor/github.com/spf13/pflag/float64.go @@ -1,84 +1,84 @@ -package pflag - -import "strconv" - -// -- float64 Value -type float64Value float64 - -func newFloat64Value(val float64, p *float64) *float64Value { - *p = val - return (*float64Value)(p) -} - -func (f *float64Value) Set(s string) error { - v, err := strconv.ParseFloat(s, 64) - *f = float64Value(v) - return err -} - -func (f *float64Value) Type() string { - return "float64" -} - -func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) } - -func float64Conv(sval string) (interface{}, error) { - return strconv.ParseFloat(sval, 64) -} - -// GetFloat64 return the float64 value of a flag with the given name -func (f *FlagSet) GetFloat64(name string) (float64, error) { - val, err := f.getFlagType(name, "float64", float64Conv) - if err != nil { - return 0, err - } - return val.(float64), nil -} - -// Float64Var defines a float64 flag with specified name, default value, and usage string. -// The argument p points to a float64 variable in which to store the value of the flag. -func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) { - f.VarP(newFloat64Value(value, p), name, "", usage) -} - -// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) { - f.VarP(newFloat64Value(value, p), name, shorthand, usage) -} - -// Float64Var defines a float64 flag with specified name, default value, and usage string. -// The argument p points to a float64 variable in which to store the value of the flag. -func Float64Var(p *float64, name string, value float64, usage string) { - CommandLine.VarP(newFloat64Value(value, p), name, "", usage) -} - -// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. -func Float64VarP(p *float64, name, shorthand string, value float64, usage string) { - CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage) -} - -// Float64 defines a float64 flag with specified name, default value, and usage string. -// The return value is the address of a float64 variable that stores the value of the flag. -func (f *FlagSet) Float64(name string, value float64, usage string) *float64 { - p := new(float64) - f.Float64VarP(p, name, "", value, usage) - return p -} - -// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 { - p := new(float64) - f.Float64VarP(p, name, shorthand, value, usage) - return p -} - -// Float64 defines a float64 flag with specified name, default value, and usage string. -// The return value is the address of a float64 variable that stores the value of the flag. -func Float64(name string, value float64, usage string) *float64 { - return CommandLine.Float64P(name, "", value, usage) -} - -// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. -func Float64P(name, shorthand string, value float64, usage string) *float64 { - return CommandLine.Float64P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- float64 Value +type float64Value float64 + +func newFloat64Value(val float64, p *float64) *float64Value { + *p = val + return (*float64Value)(p) +} + +func (f *float64Value) Set(s string) error { + v, err := strconv.ParseFloat(s, 64) + *f = float64Value(v) + return err +} + +func (f *float64Value) Type() string { + return "float64" +} + +func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) } + +func float64Conv(sval string) (interface{}, error) { + return strconv.ParseFloat(sval, 64) +} + +// GetFloat64 return the float64 value of a flag with the given name +func (f *FlagSet) GetFloat64(name string) (float64, error) { + val, err := f.getFlagType(name, "float64", float64Conv) + if err != nil { + return 0, err + } + return val.(float64), nil +} + +// Float64Var defines a float64 flag with specified name, default value, and usage string. +// The argument p points to a float64 variable in which to store the value of the flag. +func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) { + f.VarP(newFloat64Value(value, p), name, "", usage) +} + +// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) { + f.VarP(newFloat64Value(value, p), name, shorthand, usage) +} + +// Float64Var defines a float64 flag with specified name, default value, and usage string. +// The argument p points to a float64 variable in which to store the value of the flag. +func Float64Var(p *float64, name string, value float64, usage string) { + CommandLine.VarP(newFloat64Value(value, p), name, "", usage) +} + +// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash. +func Float64VarP(p *float64, name, shorthand string, value float64, usage string) { + CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage) +} + +// Float64 defines a float64 flag with specified name, default value, and usage string. +// The return value is the address of a float64 variable that stores the value of the flag. +func (f *FlagSet) Float64(name string, value float64, usage string) *float64 { + p := new(float64) + f.Float64VarP(p, name, "", value, usage) + return p +} + +// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 { + p := new(float64) + f.Float64VarP(p, name, shorthand, value, usage) + return p +} + +// Float64 defines a float64 flag with specified name, default value, and usage string. +// The return value is the address of a float64 variable that stores the value of the flag. +func Float64(name string, value float64, usage string) *float64 { + return CommandLine.Float64P(name, "", value, usage) +} + +// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash. +func Float64P(name, shorthand string, value float64, usage string) *float64 { + return CommandLine.Float64P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/golangflag.go b/vendor/github.com/spf13/pflag/golangflag.go index 82e58cc374..c4f47ebe59 100644 --- a/vendor/github.com/spf13/pflag/golangflag.go +++ b/vendor/github.com/spf13/pflag/golangflag.go @@ -1,101 +1,101 @@ -// 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 pflag - -import ( - goflag "flag" - "reflect" - "strings" -) - -// flagValueWrapper implements pflag.Value around a flag.Value. The main -// difference here is the addition of the Type method that returns a string -// name of the type. As this is generally unknown, we approximate that with -// reflection. -type flagValueWrapper struct { - inner goflag.Value - flagType string -} - -// We are just copying the boolFlag interface out of goflag as that is what -// they use to decide if a flag should get "true" when no arg is given. -type goBoolFlag interface { - goflag.Value - IsBoolFlag() bool -} - -func wrapFlagValue(v goflag.Value) Value { - // If the flag.Value happens to also be a pflag.Value, just use it directly. - if pv, ok := v.(Value); ok { - return pv - } - - pv := &flagValueWrapper{ - inner: v, - } - - t := reflect.TypeOf(v) - if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr { - t = t.Elem() - } - - pv.flagType = strings.TrimSuffix(t.Name(), "Value") - return pv -} - -func (v *flagValueWrapper) String() string { - return v.inner.String() -} - -func (v *flagValueWrapper) Set(s string) error { - return v.inner.Set(s) -} - -func (v *flagValueWrapper) Type() string { - return v.flagType -} - -// PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag -// If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei -// with both `-v` and `--v` in flags. If the golang flag was more than a single -// character (ex: `verbose`) it will only be accessible via `--verbose` -func PFlagFromGoFlag(goflag *goflag.Flag) *Flag { - // Remember the default value as a string; it won't change. - flag := &Flag{ - Name: goflag.Name, - Usage: goflag.Usage, - Value: wrapFlagValue(goflag.Value), - // Looks like golang flags don't set DefValue correctly :-( - //DefValue: goflag.DefValue, - DefValue: goflag.Value.String(), - } - // Ex: if the golang flag was -v, allow both -v and --v to work - if len(flag.Name) == 1 { - flag.Shorthand = flag.Name - } - if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() { - flag.NoOptDefVal = "true" - } - return flag -} - -// AddGoFlag will add the given *flag.Flag to the pflag.FlagSet -func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) { - if f.Lookup(goflag.Name) != nil { - return - } - newflag := PFlagFromGoFlag(goflag) - f.AddFlag(newflag) -} - -// AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet -func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) { - if newSet == nil { - return - } - newSet.VisitAll(func(goflag *goflag.Flag) { - f.AddGoFlag(goflag) - }) -} +// 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 pflag + +import ( + goflag "flag" + "reflect" + "strings" +) + +// flagValueWrapper implements pflag.Value around a flag.Value. The main +// difference here is the addition of the Type method that returns a string +// name of the type. As this is generally unknown, we approximate that with +// reflection. +type flagValueWrapper struct { + inner goflag.Value + flagType string +} + +// We are just copying the boolFlag interface out of goflag as that is what +// they use to decide if a flag should get "true" when no arg is given. +type goBoolFlag interface { + goflag.Value + IsBoolFlag() bool +} + +func wrapFlagValue(v goflag.Value) Value { + // If the flag.Value happens to also be a pflag.Value, just use it directly. + if pv, ok := v.(Value); ok { + return pv + } + + pv := &flagValueWrapper{ + inner: v, + } + + t := reflect.TypeOf(v) + if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr { + t = t.Elem() + } + + pv.flagType = strings.TrimSuffix(t.Name(), "Value") + return pv +} + +func (v *flagValueWrapper) String() string { + return v.inner.String() +} + +func (v *flagValueWrapper) Set(s string) error { + return v.inner.Set(s) +} + +func (v *flagValueWrapper) Type() string { + return v.flagType +} + +// PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag +// If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei +// with both `-v` and `--v` in flags. If the golang flag was more than a single +// character (ex: `verbose`) it will only be accessible via `--verbose` +func PFlagFromGoFlag(goflag *goflag.Flag) *Flag { + // Remember the default value as a string; it won't change. + flag := &Flag{ + Name: goflag.Name, + Usage: goflag.Usage, + Value: wrapFlagValue(goflag.Value), + // Looks like golang flags don't set DefValue correctly :-( + //DefValue: goflag.DefValue, + DefValue: goflag.Value.String(), + } + // Ex: if the golang flag was -v, allow both -v and --v to work + if len(flag.Name) == 1 { + flag.Shorthand = flag.Name + } + if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() { + flag.NoOptDefVal = "true" + } + return flag +} + +// AddGoFlag will add the given *flag.Flag to the pflag.FlagSet +func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) { + if f.Lookup(goflag.Name) != nil { + return + } + newflag := PFlagFromGoFlag(goflag) + f.AddFlag(newflag) +} + +// AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet +func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) { + if newSet == nil { + return + } + newSet.VisitAll(func(goflag *goflag.Flag) { + f.AddGoFlag(goflag) + }) +} diff --git a/vendor/github.com/spf13/pflag/golangflag_test.go b/vendor/github.com/spf13/pflag/golangflag_test.go index fd0a6ac853..77e2d7d80a 100644 --- a/vendor/github.com/spf13/pflag/golangflag_test.go +++ b/vendor/github.com/spf13/pflag/golangflag_test.go @@ -1,39 +1,39 @@ -// 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 pflag - -import ( - goflag "flag" - "testing" -) - -func TestGoflags(t *testing.T) { - goflag.String("stringFlag", "stringFlag", "stringFlag") - goflag.Bool("boolFlag", false, "boolFlag") - - f := NewFlagSet("test", ContinueOnError) - - f.AddGoFlagSet(goflag.CommandLine) - err := f.Parse([]string{"--stringFlag=bob", "--boolFlag"}) - if err != nil { - t.Fatal("expected no error; get", err) - } - - getString, err := f.GetString("stringFlag") - if err != nil { - t.Fatal("expected no error; get", err) - } - if getString != "bob" { - t.Fatalf("expected getString=bob but got getString=%s", getString) - } - - getBool, err := f.GetBool("boolFlag") - if err != nil { - t.Fatal("expected no error; get", err) - } - if getBool != true { - t.Fatalf("expected getBool=true but got getBool=%v", getBool) - } -} +// 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 pflag + +import ( + goflag "flag" + "testing" +) + +func TestGoflags(t *testing.T) { + goflag.String("stringFlag", "stringFlag", "stringFlag") + goflag.Bool("boolFlag", false, "boolFlag") + + f := NewFlagSet("test", ContinueOnError) + + f.AddGoFlagSet(goflag.CommandLine) + err := f.Parse([]string{"--stringFlag=bob", "--boolFlag"}) + if err != nil { + t.Fatal("expected no error; get", err) + } + + getString, err := f.GetString("stringFlag") + if err != nil { + t.Fatal("expected no error; get", err) + } + if getString != "bob" { + t.Fatalf("expected getString=bob but got getString=%s", getString) + } + + getBool, err := f.GetBool("boolFlag") + if err != nil { + t.Fatal("expected no error; get", err) + } + if getBool != true { + t.Fatalf("expected getBool=true but got getBool=%v", getBool) + } +} diff --git a/vendor/github.com/spf13/pflag/int.go b/vendor/github.com/spf13/pflag/int.go index 80a214c0ee..1474b89df6 100644 --- a/vendor/github.com/spf13/pflag/int.go +++ b/vendor/github.com/spf13/pflag/int.go @@ -1,84 +1,84 @@ -package pflag - -import "strconv" - -// -- int Value -type intValue int - -func newIntValue(val int, p *int) *intValue { - *p = val - return (*intValue)(p) -} - -func (i *intValue) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 64) - *i = intValue(v) - return err -} - -func (i *intValue) Type() string { - return "int" -} - -func (i *intValue) String() string { return strconv.Itoa(int(*i)) } - -func intConv(sval string) (interface{}, error) { - return strconv.Atoi(sval) -} - -// GetInt return the int value of a flag with the given name -func (f *FlagSet) GetInt(name string) (int, error) { - val, err := f.getFlagType(name, "int", intConv) - if err != nil { - return 0, err - } - return val.(int), nil -} - -// IntVar defines an int flag with specified name, default value, and usage string. -// The argument p points to an int variable in which to store the value of the flag. -func (f *FlagSet) IntVar(p *int, name string, value int, usage string) { - f.VarP(newIntValue(value, p), name, "", usage) -} - -// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) { - f.VarP(newIntValue(value, p), name, shorthand, usage) -} - -// IntVar defines an int flag with specified name, default value, and usage string. -// The argument p points to an int variable in which to store the value of the flag. -func IntVar(p *int, name string, value int, usage string) { - CommandLine.VarP(newIntValue(value, p), name, "", usage) -} - -// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. -func IntVarP(p *int, name, shorthand string, value int, usage string) { - CommandLine.VarP(newIntValue(value, p), name, shorthand, usage) -} - -// Int defines an int flag with specified name, default value, and usage string. -// The return value is the address of an int variable that stores the value of the flag. -func (f *FlagSet) Int(name string, value int, usage string) *int { - p := new(int) - f.IntVarP(p, name, "", value, usage) - return p -} - -// IntP is like Int, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int { - p := new(int) - f.IntVarP(p, name, shorthand, value, usage) - return p -} - -// Int defines an int flag with specified name, default value, and usage string. -// The return value is the address of an int variable that stores the value of the flag. -func Int(name string, value int, usage string) *int { - return CommandLine.IntP(name, "", value, usage) -} - -// IntP is like Int, but accepts a shorthand letter that can be used after a single dash. -func IntP(name, shorthand string, value int, usage string) *int { - return CommandLine.IntP(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- int Value +type intValue int + +func newIntValue(val int, p *int) *intValue { + *p = val + return (*intValue)(p) +} + +func (i *intValue) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 64) + *i = intValue(v) + return err +} + +func (i *intValue) Type() string { + return "int" +} + +func (i *intValue) String() string { return strconv.Itoa(int(*i)) } + +func intConv(sval string) (interface{}, error) { + return strconv.Atoi(sval) +} + +// GetInt return the int value of a flag with the given name +func (f *FlagSet) GetInt(name string) (int, error) { + val, err := f.getFlagType(name, "int", intConv) + if err != nil { + return 0, err + } + return val.(int), nil +} + +// IntVar defines an int flag with specified name, default value, and usage string. +// The argument p points to an int variable in which to store the value of the flag. +func (f *FlagSet) IntVar(p *int, name string, value int, usage string) { + f.VarP(newIntValue(value, p), name, "", usage) +} + +// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) { + f.VarP(newIntValue(value, p), name, shorthand, usage) +} + +// IntVar defines an int flag with specified name, default value, and usage string. +// The argument p points to an int variable in which to store the value of the flag. +func IntVar(p *int, name string, value int, usage string) { + CommandLine.VarP(newIntValue(value, p), name, "", usage) +} + +// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash. +func IntVarP(p *int, name, shorthand string, value int, usage string) { + CommandLine.VarP(newIntValue(value, p), name, shorthand, usage) +} + +// Int defines an int flag with specified name, default value, and usage string. +// The return value is the address of an int variable that stores the value of the flag. +func (f *FlagSet) Int(name string, value int, usage string) *int { + p := new(int) + f.IntVarP(p, name, "", value, usage) + return p +} + +// IntP is like Int, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int { + p := new(int) + f.IntVarP(p, name, shorthand, value, usage) + return p +} + +// Int defines an int flag with specified name, default value, and usage string. +// The return value is the address of an int variable that stores the value of the flag. +func Int(name string, value int, usage string) *int { + return CommandLine.IntP(name, "", value, usage) +} + +// IntP is like Int, but accepts a shorthand letter that can be used after a single dash. +func IntP(name, shorthand string, value int, usage string) *int { + return CommandLine.IntP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int32.go b/vendor/github.com/spf13/pflag/int32.go index 1c70d00505..9b95944f0f 100644 --- a/vendor/github.com/spf13/pflag/int32.go +++ b/vendor/github.com/spf13/pflag/int32.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- int32 Value -type int32Value int32 - -func newInt32Value(val int32, p *int32) *int32Value { - *p = val - return (*int32Value)(p) -} - -func (i *int32Value) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 32) - *i = int32Value(v) - return err -} - -func (i *int32Value) Type() string { - return "int32" -} - -func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) } - -func int32Conv(sval string) (interface{}, error) { - v, err := strconv.ParseInt(sval, 0, 32) - if err != nil { - return 0, err - } - return int32(v), nil -} - -// GetInt32 return the int32 value of a flag with the given name -func (f *FlagSet) GetInt32(name string) (int32, error) { - val, err := f.getFlagType(name, "int32", int32Conv) - if err != nil { - return 0, err - } - return val.(int32), nil -} - -// Int32Var defines an int32 flag with specified name, default value, and usage string. -// The argument p points to an int32 variable in which to store the value of the flag. -func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) { - f.VarP(newInt32Value(value, p), name, "", usage) -} - -// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) { - f.VarP(newInt32Value(value, p), name, shorthand, usage) -} - -// Int32Var defines an int32 flag with specified name, default value, and usage string. -// The argument p points to an int32 variable in which to store the value of the flag. -func Int32Var(p *int32, name string, value int32, usage string) { - CommandLine.VarP(newInt32Value(value, p), name, "", usage) -} - -// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. -func Int32VarP(p *int32, name, shorthand string, value int32, usage string) { - CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage) -} - -// Int32 defines an int32 flag with specified name, default value, and usage string. -// The return value is the address of an int32 variable that stores the value of the flag. -func (f *FlagSet) Int32(name string, value int32, usage string) *int32 { - p := new(int32) - f.Int32VarP(p, name, "", value, usage) - return p -} - -// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 { - p := new(int32) - f.Int32VarP(p, name, shorthand, value, usage) - return p -} - -// Int32 defines an int32 flag with specified name, default value, and usage string. -// The return value is the address of an int32 variable that stores the value of the flag. -func Int32(name string, value int32, usage string) *int32 { - return CommandLine.Int32P(name, "", value, usage) -} - -// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. -func Int32P(name, shorthand string, value int32, usage string) *int32 { - return CommandLine.Int32P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- int32 Value +type int32Value int32 + +func newInt32Value(val int32, p *int32) *int32Value { + *p = val + return (*int32Value)(p) +} + +func (i *int32Value) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 32) + *i = int32Value(v) + return err +} + +func (i *int32Value) Type() string { + return "int32" +} + +func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) } + +func int32Conv(sval string) (interface{}, error) { + v, err := strconv.ParseInt(sval, 0, 32) + if err != nil { + return 0, err + } + return int32(v), nil +} + +// GetInt32 return the int32 value of a flag with the given name +func (f *FlagSet) GetInt32(name string) (int32, error) { + val, err := f.getFlagType(name, "int32", int32Conv) + if err != nil { + return 0, err + } + return val.(int32), nil +} + +// Int32Var defines an int32 flag with specified name, default value, and usage string. +// The argument p points to an int32 variable in which to store the value of the flag. +func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) { + f.VarP(newInt32Value(value, p), name, "", usage) +} + +// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) { + f.VarP(newInt32Value(value, p), name, shorthand, usage) +} + +// Int32Var defines an int32 flag with specified name, default value, and usage string. +// The argument p points to an int32 variable in which to store the value of the flag. +func Int32Var(p *int32, name string, value int32, usage string) { + CommandLine.VarP(newInt32Value(value, p), name, "", usage) +} + +// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash. +func Int32VarP(p *int32, name, shorthand string, value int32, usage string) { + CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage) +} + +// Int32 defines an int32 flag with specified name, default value, and usage string. +// The return value is the address of an int32 variable that stores the value of the flag. +func (f *FlagSet) Int32(name string, value int32, usage string) *int32 { + p := new(int32) + f.Int32VarP(p, name, "", value, usage) + return p +} + +// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 { + p := new(int32) + f.Int32VarP(p, name, shorthand, value, usage) + return p +} + +// Int32 defines an int32 flag with specified name, default value, and usage string. +// The return value is the address of an int32 variable that stores the value of the flag. +func Int32(name string, value int32, usage string) *int32 { + return CommandLine.Int32P(name, "", value, usage) +} + +// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash. +func Int32P(name, shorthand string, value int32, usage string) *int32 { + return CommandLine.Int32P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int64.go b/vendor/github.com/spf13/pflag/int64.go index fd062b2597..0026d781d9 100644 --- a/vendor/github.com/spf13/pflag/int64.go +++ b/vendor/github.com/spf13/pflag/int64.go @@ -1,84 +1,84 @@ -package pflag - -import "strconv" - -// -- int64 Value -type int64Value int64 - -func newInt64Value(val int64, p *int64) *int64Value { - *p = val - return (*int64Value)(p) -} - -func (i *int64Value) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 64) - *i = int64Value(v) - return err -} - -func (i *int64Value) Type() string { - return "int64" -} - -func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) } - -func int64Conv(sval string) (interface{}, error) { - return strconv.ParseInt(sval, 0, 64) -} - -// GetInt64 return the int64 value of a flag with the given name -func (f *FlagSet) GetInt64(name string) (int64, error) { - val, err := f.getFlagType(name, "int64", int64Conv) - if err != nil { - return 0, err - } - return val.(int64), nil -} - -// Int64Var defines an int64 flag with specified name, default value, and usage string. -// The argument p points to an int64 variable in which to store the value of the flag. -func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) { - f.VarP(newInt64Value(value, p), name, "", usage) -} - -// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) { - f.VarP(newInt64Value(value, p), name, shorthand, usage) -} - -// Int64Var defines an int64 flag with specified name, default value, and usage string. -// The argument p points to an int64 variable in which to store the value of the flag. -func Int64Var(p *int64, name string, value int64, usage string) { - CommandLine.VarP(newInt64Value(value, p), name, "", usage) -} - -// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. -func Int64VarP(p *int64, name, shorthand string, value int64, usage string) { - CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage) -} - -// Int64 defines an int64 flag with specified name, default value, and usage string. -// The return value is the address of an int64 variable that stores the value of the flag. -func (f *FlagSet) Int64(name string, value int64, usage string) *int64 { - p := new(int64) - f.Int64VarP(p, name, "", value, usage) - return p -} - -// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 { - p := new(int64) - f.Int64VarP(p, name, shorthand, value, usage) - return p -} - -// Int64 defines an int64 flag with specified name, default value, and usage string. -// The return value is the address of an int64 variable that stores the value of the flag. -func Int64(name string, value int64, usage string) *int64 { - return CommandLine.Int64P(name, "", value, usage) -} - -// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. -func Int64P(name, shorthand string, value int64, usage string) *int64 { - return CommandLine.Int64P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- int64 Value +type int64Value int64 + +func newInt64Value(val int64, p *int64) *int64Value { + *p = val + return (*int64Value)(p) +} + +func (i *int64Value) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 64) + *i = int64Value(v) + return err +} + +func (i *int64Value) Type() string { + return "int64" +} + +func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) } + +func int64Conv(sval string) (interface{}, error) { + return strconv.ParseInt(sval, 0, 64) +} + +// GetInt64 return the int64 value of a flag with the given name +func (f *FlagSet) GetInt64(name string) (int64, error) { + val, err := f.getFlagType(name, "int64", int64Conv) + if err != nil { + return 0, err + } + return val.(int64), nil +} + +// Int64Var defines an int64 flag with specified name, default value, and usage string. +// The argument p points to an int64 variable in which to store the value of the flag. +func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) { + f.VarP(newInt64Value(value, p), name, "", usage) +} + +// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) { + f.VarP(newInt64Value(value, p), name, shorthand, usage) +} + +// Int64Var defines an int64 flag with specified name, default value, and usage string. +// The argument p points to an int64 variable in which to store the value of the flag. +func Int64Var(p *int64, name string, value int64, usage string) { + CommandLine.VarP(newInt64Value(value, p), name, "", usage) +} + +// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash. +func Int64VarP(p *int64, name, shorthand string, value int64, usage string) { + CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage) +} + +// Int64 defines an int64 flag with specified name, default value, and usage string. +// The return value is the address of an int64 variable that stores the value of the flag. +func (f *FlagSet) Int64(name string, value int64, usage string) *int64 { + p := new(int64) + f.Int64VarP(p, name, "", value, usage) + return p +} + +// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 { + p := new(int64) + f.Int64VarP(p, name, shorthand, value, usage) + return p +} + +// Int64 defines an int64 flag with specified name, default value, and usage string. +// The return value is the address of an int64 variable that stores the value of the flag. +func Int64(name string, value int64, usage string) *int64 { + return CommandLine.Int64P(name, "", value, usage) +} + +// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash. +func Int64P(name, shorthand string, value int64, usage string) *int64 { + return CommandLine.Int64P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int8.go b/vendor/github.com/spf13/pflag/int8.go index be7450a804..4da92228e6 100644 --- a/vendor/github.com/spf13/pflag/int8.go +++ b/vendor/github.com/spf13/pflag/int8.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- int8 Value -type int8Value int8 - -func newInt8Value(val int8, p *int8) *int8Value { - *p = val - return (*int8Value)(p) -} - -func (i *int8Value) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 8) - *i = int8Value(v) - return err -} - -func (i *int8Value) Type() string { - return "int8" -} - -func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) } - -func int8Conv(sval string) (interface{}, error) { - v, err := strconv.ParseInt(sval, 0, 8) - if err != nil { - return 0, err - } - return int8(v), nil -} - -// GetInt8 return the int8 value of a flag with the given name -func (f *FlagSet) GetInt8(name string) (int8, error) { - val, err := f.getFlagType(name, "int8", int8Conv) - if err != nil { - return 0, err - } - return val.(int8), nil -} - -// Int8Var defines an int8 flag with specified name, default value, and usage string. -// The argument p points to an int8 variable in which to store the value of the flag. -func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) { - f.VarP(newInt8Value(value, p), name, "", usage) -} - -// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) { - f.VarP(newInt8Value(value, p), name, shorthand, usage) -} - -// Int8Var defines an int8 flag with specified name, default value, and usage string. -// The argument p points to an int8 variable in which to store the value of the flag. -func Int8Var(p *int8, name string, value int8, usage string) { - CommandLine.VarP(newInt8Value(value, p), name, "", usage) -} - -// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. -func Int8VarP(p *int8, name, shorthand string, value int8, usage string) { - CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage) -} - -// Int8 defines an int8 flag with specified name, default value, and usage string. -// The return value is the address of an int8 variable that stores the value of the flag. -func (f *FlagSet) Int8(name string, value int8, usage string) *int8 { - p := new(int8) - f.Int8VarP(p, name, "", value, usage) - return p -} - -// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 { - p := new(int8) - f.Int8VarP(p, name, shorthand, value, usage) - return p -} - -// Int8 defines an int8 flag with specified name, default value, and usage string. -// The return value is the address of an int8 variable that stores the value of the flag. -func Int8(name string, value int8, usage string) *int8 { - return CommandLine.Int8P(name, "", value, usage) -} - -// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. -func Int8P(name, shorthand string, value int8, usage string) *int8 { - return CommandLine.Int8P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- int8 Value +type int8Value int8 + +func newInt8Value(val int8, p *int8) *int8Value { + *p = val + return (*int8Value)(p) +} + +func (i *int8Value) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 8) + *i = int8Value(v) + return err +} + +func (i *int8Value) Type() string { + return "int8" +} + +func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) } + +func int8Conv(sval string) (interface{}, error) { + v, err := strconv.ParseInt(sval, 0, 8) + if err != nil { + return 0, err + } + return int8(v), nil +} + +// GetInt8 return the int8 value of a flag with the given name +func (f *FlagSet) GetInt8(name string) (int8, error) { + val, err := f.getFlagType(name, "int8", int8Conv) + if err != nil { + return 0, err + } + return val.(int8), nil +} + +// Int8Var defines an int8 flag with specified name, default value, and usage string. +// The argument p points to an int8 variable in which to store the value of the flag. +func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) { + f.VarP(newInt8Value(value, p), name, "", usage) +} + +// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) { + f.VarP(newInt8Value(value, p), name, shorthand, usage) +} + +// Int8Var defines an int8 flag with specified name, default value, and usage string. +// The argument p points to an int8 variable in which to store the value of the flag. +func Int8Var(p *int8, name string, value int8, usage string) { + CommandLine.VarP(newInt8Value(value, p), name, "", usage) +} + +// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash. +func Int8VarP(p *int8, name, shorthand string, value int8, usage string) { + CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage) +} + +// Int8 defines an int8 flag with specified name, default value, and usage string. +// The return value is the address of an int8 variable that stores the value of the flag. +func (f *FlagSet) Int8(name string, value int8, usage string) *int8 { + p := new(int8) + f.Int8VarP(p, name, "", value, usage) + return p +} + +// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 { + p := new(int8) + f.Int8VarP(p, name, shorthand, value, usage) + return p +} + +// Int8 defines an int8 flag with specified name, default value, and usage string. +// The return value is the address of an int8 variable that stores the value of the flag. +func Int8(name string, value int8, usage string) *int8 { + return CommandLine.Int8P(name, "", value, usage) +} + +// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash. +func Int8P(name, shorthand string, value int8, usage string) *int8 { + return CommandLine.Int8P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int_slice.go b/vendor/github.com/spf13/pflag/int_slice.go index 588d67bb07..1e7c9edde9 100644 --- a/vendor/github.com/spf13/pflag/int_slice.go +++ b/vendor/github.com/spf13/pflag/int_slice.go @@ -1,128 +1,128 @@ -package pflag - -import ( - "fmt" - "strconv" - "strings" -) - -// -- intSlice Value -type intSliceValue struct { - value *[]int - changed bool -} - -func newIntSliceValue(val []int, p *[]int) *intSliceValue { - isv := new(intSliceValue) - isv.value = p - *isv.value = val - return isv -} - -func (s *intSliceValue) Set(val string) error { - ss := strings.Split(val, ",") - out := make([]int, len(ss)) - for i, d := range ss { - var err error - out[i], err = strconv.Atoi(d) - if err != nil { - return err - } - - } - if !s.changed { - *s.value = out - } else { - *s.value = append(*s.value, out...) - } - s.changed = true - return nil -} - -func (s *intSliceValue) Type() string { - return "intSlice" -} - -func (s *intSliceValue) String() string { - out := make([]string, len(*s.value)) - for i, d := range *s.value { - out[i] = fmt.Sprintf("%d", d) - } - return "[" + strings.Join(out, ",") + "]" -} - -func intSliceConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") - // Empty string would cause a slice with one (empty) entry - if len(val) == 0 { - return []int{}, nil - } - ss := strings.Split(val, ",") - out := make([]int, len(ss)) - for i, d := range ss { - var err error - out[i], err = strconv.Atoi(d) - if err != nil { - return nil, err - } - - } - return out, nil -} - -// GetIntSlice return the []int value of a flag with the given name -func (f *FlagSet) GetIntSlice(name string) ([]int, error) { - val, err := f.getFlagType(name, "intSlice", intSliceConv) - if err != nil { - return []int{}, err - } - return val.([]int), nil -} - -// IntSliceVar defines a intSlice flag with specified name, default value, and usage string. -// The argument p points to a []int variable in which to store the value of the flag. -func (f *FlagSet) IntSliceVar(p *[]int, name string, value []int, usage string) { - f.VarP(newIntSliceValue(value, p), name, "", usage) -} - -// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) { - f.VarP(newIntSliceValue(value, p), name, shorthand, usage) -} - -// IntSliceVar defines a int[] flag with specified name, default value, and usage string. -// The argument p points to a int[] variable in which to store the value of the flag. -func IntSliceVar(p *[]int, name string, value []int, usage string) { - CommandLine.VarP(newIntSliceValue(value, p), name, "", usage) -} - -// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. -func IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) { - CommandLine.VarP(newIntSliceValue(value, p), name, shorthand, usage) -} - -// IntSlice defines a []int flag with specified name, default value, and usage string. -// The return value is the address of a []int variable that stores the value of the flag. -func (f *FlagSet) IntSlice(name string, value []int, usage string) *[]int { - p := []int{} - f.IntSliceVarP(&p, name, "", value, usage) - return &p -} - -// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IntSliceP(name, shorthand string, value []int, usage string) *[]int { - p := []int{} - f.IntSliceVarP(&p, name, shorthand, value, usage) - return &p -} - -// IntSlice defines a []int flag with specified name, default value, and usage string. -// The return value is the address of a []int variable that stores the value of the flag. -func IntSlice(name string, value []int, usage string) *[]int { - return CommandLine.IntSliceP(name, "", value, usage) -} - -// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. -func IntSliceP(name, shorthand string, value []int, usage string) *[]int { - return CommandLine.IntSliceP(name, shorthand, value, usage) -} +package pflag + +import ( + "fmt" + "strconv" + "strings" +) + +// -- intSlice Value +type intSliceValue struct { + value *[]int + changed bool +} + +func newIntSliceValue(val []int, p *[]int) *intSliceValue { + isv := new(intSliceValue) + isv.value = p + *isv.value = val + return isv +} + +func (s *intSliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]int, len(ss)) + for i, d := range ss { + var err error + out[i], err = strconv.Atoi(d) + if err != nil { + return err + } + + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *intSliceValue) Type() string { + return "intSlice" +} + +func (s *intSliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%d", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func intSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []int{}, nil + } + ss := strings.Split(val, ",") + out := make([]int, len(ss)) + for i, d := range ss { + var err error + out[i], err = strconv.Atoi(d) + if err != nil { + return nil, err + } + + } + return out, nil +} + +// GetIntSlice return the []int value of a flag with the given name +func (f *FlagSet) GetIntSlice(name string) ([]int, error) { + val, err := f.getFlagType(name, "intSlice", intSliceConv) + if err != nil { + return []int{}, err + } + return val.([]int), nil +} + +// IntSliceVar defines a intSlice flag with specified name, default value, and usage string. +// The argument p points to a []int variable in which to store the value of the flag. +func (f *FlagSet) IntSliceVar(p *[]int, name string, value []int, usage string) { + f.VarP(newIntSliceValue(value, p), name, "", usage) +} + +// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) { + f.VarP(newIntSliceValue(value, p), name, shorthand, usage) +} + +// IntSliceVar defines a int[] flag with specified name, default value, and usage string. +// The argument p points to a int[] variable in which to store the value of the flag. +func IntSliceVar(p *[]int, name string, value []int, usage string) { + CommandLine.VarP(newIntSliceValue(value, p), name, "", usage) +} + +// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash. +func IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) { + CommandLine.VarP(newIntSliceValue(value, p), name, shorthand, usage) +} + +// IntSlice defines a []int flag with specified name, default value, and usage string. +// The return value is the address of a []int variable that stores the value of the flag. +func (f *FlagSet) IntSlice(name string, value []int, usage string) *[]int { + p := []int{} + f.IntSliceVarP(&p, name, "", value, usage) + return &p +} + +// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IntSliceP(name, shorthand string, value []int, usage string) *[]int { + p := []int{} + f.IntSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// IntSlice defines a []int flag with specified name, default value, and usage string. +// The return value is the address of a []int variable that stores the value of the flag. +func IntSlice(name string, value []int, usage string) *[]int { + return CommandLine.IntSliceP(name, "", value, usage) +} + +// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash. +func IntSliceP(name, shorthand string, value []int, usage string) *[]int { + return CommandLine.IntSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int_slice_test.go b/vendor/github.com/spf13/pflag/int_slice_test.go index aa1f7d49ff..745aecb950 100644 --- a/vendor/github.com/spf13/pflag/int_slice_test.go +++ b/vendor/github.com/spf13/pflag/int_slice_test.go @@ -1,165 +1,165 @@ -// 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 pflag - -import ( - "fmt" - "strconv" - "strings" - "testing" -) - -func setUpISFlagSet(isp *[]int) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.IntSliceVar(isp, "is", []int{}, "Command separated list!") - return f -} - -func setUpISFlagSetWithDefault(isp *[]int) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.IntSliceVar(isp, "is", []int{0, 1}, "Command separated list!") - return f -} - -func TestEmptyIS(t *testing.T) { - var is []int - f := setUpISFlagSet(&is) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getIS, err := f.GetIntSlice("is") - if err != nil { - t.Fatal("got an error from GetIntSlice():", err) - } - if len(getIS) != 0 { - t.Fatalf("got is %v with len=%d but expected length=0", getIS, len(getIS)) - } -} - -func TestIS(t *testing.T) { - var is []int - f := setUpISFlagSet(&is) - - vals := []string{"1", "2", "4", "3"} - arg := fmt.Sprintf("--is=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range is { - d, err := strconv.Atoi(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if d != v { - t.Fatalf("expected is[%d] to be %s but got: %d", i, vals[i], v) - } - } - getIS, err := f.GetIntSlice("is") - if err != nil { - t.Fatalf("got error: %v", err) - } - for i, v := range getIS { - d, err := strconv.Atoi(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if d != v { - t.Fatalf("expected is[%d] to be %s but got: %d from GetIntSlice", i, vals[i], v) - } - } -} - -func TestISDefault(t *testing.T) { - var is []int - f := setUpISFlagSetWithDefault(&is) - - vals := []string{"0", "1"} - - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range is { - d, err := strconv.Atoi(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if d != v { - t.Fatalf("expected is[%d] to be %d but got: %d", i, d, v) - } - } - - getIS, err := f.GetIntSlice("is") - if err != nil { - t.Fatal("got an error from GetIntSlice():", err) - } - for i, v := range getIS { - d, err := strconv.Atoi(vals[i]) - if err != nil { - t.Fatal("got an error from GetIntSlice():", err) - } - if d != v { - t.Fatalf("expected is[%d] to be %d from GetIntSlice but got: %d", i, d, v) - } - } -} - -func TestISWithDefault(t *testing.T) { - var is []int - f := setUpISFlagSetWithDefault(&is) - - vals := []string{"1", "2"} - arg := fmt.Sprintf("--is=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range is { - d, err := strconv.Atoi(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if d != v { - t.Fatalf("expected is[%d] to be %d but got: %d", i, d, v) - } - } - - getIS, err := f.GetIntSlice("is") - if err != nil { - t.Fatal("got an error from GetIntSlice():", err) - } - for i, v := range getIS { - d, err := strconv.Atoi(vals[i]) - if err != nil { - t.Fatalf("got error: %v", err) - } - if d != v { - t.Fatalf("expected is[%d] to be %d from GetIntSlice but got: %d", i, d, v) - } - } -} - -func TestISCalledTwice(t *testing.T) { - var is []int - f := setUpISFlagSet(&is) - - in := []string{"1,2", "3"} - expected := []int{1, 2, 3} - argfmt := "--is=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range is { - if expected[i] != v { - t.Fatalf("expected is[%d] to be %d but got: %d", i, expected[i], v) - } - } -} +// 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 pflag + +import ( + "fmt" + "strconv" + "strings" + "testing" +) + +func setUpISFlagSet(isp *[]int) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.IntSliceVar(isp, "is", []int{}, "Command separated list!") + return f +} + +func setUpISFlagSetWithDefault(isp *[]int) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.IntSliceVar(isp, "is", []int{0, 1}, "Command separated list!") + return f +} + +func TestEmptyIS(t *testing.T) { + var is []int + f := setUpISFlagSet(&is) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getIS, err := f.GetIntSlice("is") + if err != nil { + t.Fatal("got an error from GetIntSlice():", err) + } + if len(getIS) != 0 { + t.Fatalf("got is %v with len=%d but expected length=0", getIS, len(getIS)) + } +} + +func TestIS(t *testing.T) { + var is []int + f := setUpISFlagSet(&is) + + vals := []string{"1", "2", "4", "3"} + arg := fmt.Sprintf("--is=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range is { + d, err := strconv.Atoi(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if d != v { + t.Fatalf("expected is[%d] to be %s but got: %d", i, vals[i], v) + } + } + getIS, err := f.GetIntSlice("is") + if err != nil { + t.Fatalf("got error: %v", err) + } + for i, v := range getIS { + d, err := strconv.Atoi(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if d != v { + t.Fatalf("expected is[%d] to be %s but got: %d from GetIntSlice", i, vals[i], v) + } + } +} + +func TestISDefault(t *testing.T) { + var is []int + f := setUpISFlagSetWithDefault(&is) + + vals := []string{"0", "1"} + + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range is { + d, err := strconv.Atoi(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if d != v { + t.Fatalf("expected is[%d] to be %d but got: %d", i, d, v) + } + } + + getIS, err := f.GetIntSlice("is") + if err != nil { + t.Fatal("got an error from GetIntSlice():", err) + } + for i, v := range getIS { + d, err := strconv.Atoi(vals[i]) + if err != nil { + t.Fatal("got an error from GetIntSlice():", err) + } + if d != v { + t.Fatalf("expected is[%d] to be %d from GetIntSlice but got: %d", i, d, v) + } + } +} + +func TestISWithDefault(t *testing.T) { + var is []int + f := setUpISFlagSetWithDefault(&is) + + vals := []string{"1", "2"} + arg := fmt.Sprintf("--is=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range is { + d, err := strconv.Atoi(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if d != v { + t.Fatalf("expected is[%d] to be %d but got: %d", i, d, v) + } + } + + getIS, err := f.GetIntSlice("is") + if err != nil { + t.Fatal("got an error from GetIntSlice():", err) + } + for i, v := range getIS { + d, err := strconv.Atoi(vals[i]) + if err != nil { + t.Fatalf("got error: %v", err) + } + if d != v { + t.Fatalf("expected is[%d] to be %d from GetIntSlice but got: %d", i, d, v) + } + } +} + +func TestISCalledTwice(t *testing.T) { + var is []int + f := setUpISFlagSet(&is) + + in := []string{"1,2", "3"} + expected := []int{1, 2, 3} + argfmt := "--is=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range is { + if expected[i] != v { + t.Fatalf("expected is[%d] to be %d but got: %d", i, expected[i], v) + } + } +} diff --git a/vendor/github.com/spf13/pflag/ip.go b/vendor/github.com/spf13/pflag/ip.go index 9b67df6e47..3d414ba69f 100644 --- a/vendor/github.com/spf13/pflag/ip.go +++ b/vendor/github.com/spf13/pflag/ip.go @@ -1,94 +1,94 @@ -package pflag - -import ( - "fmt" - "net" - "strings" -) - -// -- net.IP value -type ipValue net.IP - -func newIPValue(val net.IP, p *net.IP) *ipValue { - *p = val - return (*ipValue)(p) -} - -func (i *ipValue) String() string { return net.IP(*i).String() } -func (i *ipValue) Set(s string) error { - ip := net.ParseIP(strings.TrimSpace(s)) - if ip == nil { - return fmt.Errorf("failed to parse IP: %q", s) - } - *i = ipValue(ip) - return nil -} - -func (i *ipValue) Type() string { - return "ip" -} - -func ipConv(sval string) (interface{}, error) { - ip := net.ParseIP(sval) - if ip != nil { - return ip, nil - } - return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval) -} - -// GetIP return the net.IP value of a flag with the given name -func (f *FlagSet) GetIP(name string) (net.IP, error) { - val, err := f.getFlagType(name, "ip", ipConv) - if err != nil { - return nil, err - } - return val.(net.IP), nil -} - -// IPVar defines an net.IP flag with specified name, default value, and usage string. -// The argument p points to an net.IP variable in which to store the value of the flag. -func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) { - f.VarP(newIPValue(value, p), name, "", usage) -} - -// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { - f.VarP(newIPValue(value, p), name, shorthand, usage) -} - -// IPVar defines an net.IP flag with specified name, default value, and usage string. -// The argument p points to an net.IP variable in which to store the value of the flag. -func IPVar(p *net.IP, name string, value net.IP, usage string) { - CommandLine.VarP(newIPValue(value, p), name, "", usage) -} - -// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. -func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { - CommandLine.VarP(newIPValue(value, p), name, shorthand, usage) -} - -// IP defines an net.IP flag with specified name, default value, and usage string. -// The return value is the address of an net.IP variable that stores the value of the flag. -func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP { - p := new(net.IP) - f.IPVarP(p, name, "", value, usage) - return p -} - -// IPP is like IP, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP { - p := new(net.IP) - f.IPVarP(p, name, shorthand, value, usage) - return p -} - -// IP defines an net.IP flag with specified name, default value, and usage string. -// The return value is the address of an net.IP variable that stores the value of the flag. -func IP(name string, value net.IP, usage string) *net.IP { - return CommandLine.IPP(name, "", value, usage) -} - -// IPP is like IP, but accepts a shorthand letter that can be used after a single dash. -func IPP(name, shorthand string, value net.IP, usage string) *net.IP { - return CommandLine.IPP(name, shorthand, value, usage) -} +package pflag + +import ( + "fmt" + "net" + "strings" +) + +// -- net.IP value +type ipValue net.IP + +func newIPValue(val net.IP, p *net.IP) *ipValue { + *p = val + return (*ipValue)(p) +} + +func (i *ipValue) String() string { return net.IP(*i).String() } +func (i *ipValue) Set(s string) error { + ip := net.ParseIP(strings.TrimSpace(s)) + if ip == nil { + return fmt.Errorf("failed to parse IP: %q", s) + } + *i = ipValue(ip) + return nil +} + +func (i *ipValue) Type() string { + return "ip" +} + +func ipConv(sval string) (interface{}, error) { + ip := net.ParseIP(sval) + if ip != nil { + return ip, nil + } + return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval) +} + +// GetIP return the net.IP value of a flag with the given name +func (f *FlagSet) GetIP(name string) (net.IP, error) { + val, err := f.getFlagType(name, "ip", ipConv) + if err != nil { + return nil, err + } + return val.(net.IP), nil +} + +// IPVar defines an net.IP flag with specified name, default value, and usage string. +// The argument p points to an net.IP variable in which to store the value of the flag. +func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) { + f.VarP(newIPValue(value, p), name, "", usage) +} + +// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { + f.VarP(newIPValue(value, p), name, shorthand, usage) +} + +// IPVar defines an net.IP flag with specified name, default value, and usage string. +// The argument p points to an net.IP variable in which to store the value of the flag. +func IPVar(p *net.IP, name string, value net.IP, usage string) { + CommandLine.VarP(newIPValue(value, p), name, "", usage) +} + +// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash. +func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) { + CommandLine.VarP(newIPValue(value, p), name, shorthand, usage) +} + +// IP defines an net.IP flag with specified name, default value, and usage string. +// The return value is the address of an net.IP variable that stores the value of the flag. +func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP { + p := new(net.IP) + f.IPVarP(p, name, "", value, usage) + return p +} + +// IPP is like IP, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP { + p := new(net.IP) + f.IPVarP(p, name, shorthand, value, usage) + return p +} + +// IP defines an net.IP flag with specified name, default value, and usage string. +// The return value is the address of an net.IP variable that stores the value of the flag. +func IP(name string, value net.IP, usage string) *net.IP { + return CommandLine.IPP(name, "", value, usage) +} + +// IPP is like IP, but accepts a shorthand letter that can be used after a single dash. +func IPP(name, shorthand string, value net.IP, usage string) *net.IP { + return CommandLine.IPP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/ip_slice.go b/vendor/github.com/spf13/pflag/ip_slice.go index d2b8765713..7dd196fe3f 100644 --- a/vendor/github.com/spf13/pflag/ip_slice.go +++ b/vendor/github.com/spf13/pflag/ip_slice.go @@ -1,148 +1,148 @@ -package pflag - -import ( - "fmt" - "io" - "net" - "strings" -) - -// -- ipSlice Value -type ipSliceValue struct { - value *[]net.IP - changed bool -} - -func newIPSliceValue(val []net.IP, p *[]net.IP) *ipSliceValue { - ipsv := new(ipSliceValue) - ipsv.value = p - *ipsv.value = val - return ipsv -} - -// Set converts, and assigns, the comma-separated IP argument string representation as the []net.IP value of this flag. -// If Set is called on a flag that already has a []net.IP assigned, the newly converted values will be appended. -func (s *ipSliceValue) Set(val string) error { - - // remove all quote characters - rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") - - // read flag arguments with CSV parser - ipStrSlice, err := readAsCSV(rmQuote.Replace(val)) - if err != nil && err != io.EOF { - return err - } - - // parse ip values into slice - out := make([]net.IP, 0, len(ipStrSlice)) - for _, ipStr := range ipStrSlice { - ip := net.ParseIP(strings.TrimSpace(ipStr)) - if ip == nil { - return fmt.Errorf("invalid string being converted to IP address: %s", ipStr) - } - out = append(out, ip) - } - - if !s.changed { - *s.value = out - } else { - *s.value = append(*s.value, out...) - } - - s.changed = true - - return nil -} - -// Type returns a string that uniquely represents this flag's type. -func (s *ipSliceValue) Type() string { - return "ipSlice" -} - -// String defines a "native" format for this net.IP slice flag value. -func (s *ipSliceValue) String() string { - - ipStrSlice := make([]string, len(*s.value)) - for i, ip := range *s.value { - ipStrSlice[i] = ip.String() - } - - out, _ := writeAsCSV(ipStrSlice) - - return "[" + out + "]" -} - -func ipSliceConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") - // Emtpy string would cause a slice with one (empty) entry - if len(val) == 0 { - return []net.IP{}, nil - } - ss := strings.Split(val, ",") - out := make([]net.IP, len(ss)) - for i, sval := range ss { - ip := net.ParseIP(strings.TrimSpace(sval)) - if ip == nil { - return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval) - } - out[i] = ip - } - return out, nil -} - -// GetIPSlice returns the []net.IP value of a flag with the given name -func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) { - val, err := f.getFlagType(name, "ipSlice", ipSliceConv) - if err != nil { - return []net.IP{}, err - } - return val.([]net.IP), nil -} - -// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string. -// The argument p points to a []net.IP variable in which to store the value of the flag. -func (f *FlagSet) IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) { - f.VarP(newIPSliceValue(value, p), name, "", usage) -} - -// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) { - f.VarP(newIPSliceValue(value, p), name, shorthand, usage) -} - -// IPSliceVar defines a []net.IP flag with specified name, default value, and usage string. -// The argument p points to a []net.IP variable in which to store the value of the flag. -func IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) { - CommandLine.VarP(newIPSliceValue(value, p), name, "", usage) -} - -// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash. -func IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) { - CommandLine.VarP(newIPSliceValue(value, p), name, shorthand, usage) -} - -// IPSlice defines a []net.IP flag with specified name, default value, and usage string. -// The return value is the address of a []net.IP variable that stores the value of that flag. -func (f *FlagSet) IPSlice(name string, value []net.IP, usage string) *[]net.IP { - p := []net.IP{} - f.IPSliceVarP(&p, name, "", value, usage) - return &p -} - -// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP { - p := []net.IP{} - f.IPSliceVarP(&p, name, shorthand, value, usage) - return &p -} - -// IPSlice defines a []net.IP flag with specified name, default value, and usage string. -// The return value is the address of a []net.IP variable that stores the value of the flag. -func IPSlice(name string, value []net.IP, usage string) *[]net.IP { - return CommandLine.IPSliceP(name, "", value, usage) -} - -// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash. -func IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP { - return CommandLine.IPSliceP(name, shorthand, value, usage) -} +package pflag + +import ( + "fmt" + "io" + "net" + "strings" +) + +// -- ipSlice Value +type ipSliceValue struct { + value *[]net.IP + changed bool +} + +func newIPSliceValue(val []net.IP, p *[]net.IP) *ipSliceValue { + ipsv := new(ipSliceValue) + ipsv.value = p + *ipsv.value = val + return ipsv +} + +// Set converts, and assigns, the comma-separated IP argument string representation as the []net.IP value of this flag. +// If Set is called on a flag that already has a []net.IP assigned, the newly converted values will be appended. +func (s *ipSliceValue) Set(val string) error { + + // remove all quote characters + rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "") + + // read flag arguments with CSV parser + ipStrSlice, err := readAsCSV(rmQuote.Replace(val)) + if err != nil && err != io.EOF { + return err + } + + // parse ip values into slice + out := make([]net.IP, 0, len(ipStrSlice)) + for _, ipStr := range ipStrSlice { + ip := net.ParseIP(strings.TrimSpace(ipStr)) + if ip == nil { + return fmt.Errorf("invalid string being converted to IP address: %s", ipStr) + } + out = append(out, ip) + } + + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + + s.changed = true + + return nil +} + +// Type returns a string that uniquely represents this flag's type. +func (s *ipSliceValue) Type() string { + return "ipSlice" +} + +// String defines a "native" format for this net.IP slice flag value. +func (s *ipSliceValue) String() string { + + ipStrSlice := make([]string, len(*s.value)) + for i, ip := range *s.value { + ipStrSlice[i] = ip.String() + } + + out, _ := writeAsCSV(ipStrSlice) + + return "[" + out + "]" +} + +func ipSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Emtpy string would cause a slice with one (empty) entry + if len(val) == 0 { + return []net.IP{}, nil + } + ss := strings.Split(val, ",") + out := make([]net.IP, len(ss)) + for i, sval := range ss { + ip := net.ParseIP(strings.TrimSpace(sval)) + if ip == nil { + return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval) + } + out[i] = ip + } + return out, nil +} + +// GetIPSlice returns the []net.IP value of a flag with the given name +func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) { + val, err := f.getFlagType(name, "ipSlice", ipSliceConv) + if err != nil { + return []net.IP{}, err + } + return val.([]net.IP), nil +} + +// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string. +// The argument p points to a []net.IP variable in which to store the value of the flag. +func (f *FlagSet) IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) { + f.VarP(newIPSliceValue(value, p), name, "", usage) +} + +// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) { + f.VarP(newIPSliceValue(value, p), name, shorthand, usage) +} + +// IPSliceVar defines a []net.IP flag with specified name, default value, and usage string. +// The argument p points to a []net.IP variable in which to store the value of the flag. +func IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) { + CommandLine.VarP(newIPSliceValue(value, p), name, "", usage) +} + +// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash. +func IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) { + CommandLine.VarP(newIPSliceValue(value, p), name, shorthand, usage) +} + +// IPSlice defines a []net.IP flag with specified name, default value, and usage string. +// The return value is the address of a []net.IP variable that stores the value of that flag. +func (f *FlagSet) IPSlice(name string, value []net.IP, usage string) *[]net.IP { + p := []net.IP{} + f.IPSliceVarP(&p, name, "", value, usage) + return &p +} + +// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP { + p := []net.IP{} + f.IPSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// IPSlice defines a []net.IP flag with specified name, default value, and usage string. +// The return value is the address of a []net.IP variable that stores the value of the flag. +func IPSlice(name string, value []net.IP, usage string) *[]net.IP { + return CommandLine.IPSliceP(name, "", value, usage) +} + +// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash. +func IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP { + return CommandLine.IPSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/ip_slice_test.go b/vendor/github.com/spf13/pflag/ip_slice_test.go index ff18b4051f..b0c681c5b2 100644 --- a/vendor/github.com/spf13/pflag/ip_slice_test.go +++ b/vendor/github.com/spf13/pflag/ip_slice_test.go @@ -1,222 +1,222 @@ -package pflag - -import ( - "fmt" - "net" - "strings" - "testing" -) - -func setUpIPSFlagSet(ipsp *[]net.IP) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.IPSliceVar(ipsp, "ips", []net.IP{}, "Command separated list!") - return f -} - -func setUpIPSFlagSetWithDefault(ipsp *[]net.IP) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.IPSliceVar(ipsp, "ips", - []net.IP{ - net.ParseIP("192.168.1.1"), - net.ParseIP("0:0:0:0:0:0:0:1"), - }, - "Command separated list!") - return f -} - -func TestEmptyIP(t *testing.T) { - var ips []net.IP - f := setUpIPSFlagSet(&ips) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getIPS, err := f.GetIPSlice("ips") - if err != nil { - t.Fatal("got an error from GetIPSlice():", err) - } - if len(getIPS) != 0 { - t.Fatalf("got ips %v with len=%d but expected length=0", getIPS, len(getIPS)) - } -} - -func TestIPS(t *testing.T) { - var ips []net.IP - f := setUpIPSFlagSet(&ips) - - vals := []string{"192.168.1.1", "10.0.0.1", "0:0:0:0:0:0:0:2"} - arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ips { - if ip := net.ParseIP(vals[i]); ip == nil { - t.Fatalf("invalid string being converted to IP address: %s", vals[i]) - } else if !ip.Equal(v) { - t.Fatalf("expected ips[%d] to be %s but got: %s from GetIPSlice", i, vals[i], v) - } - } -} - -func TestIPSDefault(t *testing.T) { - var ips []net.IP - f := setUpIPSFlagSetWithDefault(&ips) - - vals := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"} - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ips { - if ip := net.ParseIP(vals[i]); ip == nil { - t.Fatalf("invalid string being converted to IP address: %s", vals[i]) - } else if !ip.Equal(v) { - t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) - } - } - - getIPS, err := f.GetIPSlice("ips") - if err != nil { - t.Fatal("got an error from GetIPSlice") - } - for i, v := range getIPS { - if ip := net.ParseIP(vals[i]); ip == nil { - t.Fatalf("invalid string being converted to IP address: %s", vals[i]) - } else if !ip.Equal(v) { - t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) - } - } -} - -func TestIPSWithDefault(t *testing.T) { - var ips []net.IP - f := setUpIPSFlagSetWithDefault(&ips) - - vals := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"} - arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ips { - if ip := net.ParseIP(vals[i]); ip == nil { - t.Fatalf("invalid string being converted to IP address: %s", vals[i]) - } else if !ip.Equal(v) { - t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) - } - } - - getIPS, err := f.GetIPSlice("ips") - if err != nil { - t.Fatal("got an error from GetIPSlice") - } - for i, v := range getIPS { - if ip := net.ParseIP(vals[i]); ip == nil { - t.Fatalf("invalid string being converted to IP address: %s", vals[i]) - } else if !ip.Equal(v) { - t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) - } - } -} - -func TestIPSCalledTwice(t *testing.T) { - var ips []net.IP - f := setUpIPSFlagSet(&ips) - - in := []string{"192.168.1.2,0:0:0:0:0:0:0:1", "10.0.0.1"} - expected := []net.IP{net.ParseIP("192.168.1.2"), net.ParseIP("0:0:0:0:0:0:0:1"), net.ParseIP("10.0.0.1")} - argfmt := "ips=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ips { - if !expected[i].Equal(v) { - t.Fatalf("expected ips[%d] to be %s but got: %s", i, expected[i], v) - } - } -} - -func TestIPSBadQuoting(t *testing.T) { - - tests := []struct { - Want []net.IP - FlagArg []string - }{ - { - Want: []net.IP{ - net.ParseIP("a4ab:61d:f03e:5d7d:fad7:d4c2:a1a5:568"), - net.ParseIP("203.107.49.208"), - net.ParseIP("14.57.204.90"), - }, - FlagArg: []string{ - "a4ab:61d:f03e:5d7d:fad7:d4c2:a1a5:568", - "203.107.49.208", - "14.57.204.90", - }, - }, - { - Want: []net.IP{ - net.ParseIP("204.228.73.195"), - net.ParseIP("86.141.15.94"), - }, - FlagArg: []string{ - "204.228.73.195", - "86.141.15.94", - }, - }, - { - Want: []net.IP{ - net.ParseIP("c70c:db36:3001:890f:c6ea:3f9b:7a39:cc3f"), - net.ParseIP("4d17:1d6e:e699:bd7a:88c5:5e7e:ac6a:4472"), - }, - FlagArg: []string{ - "c70c:db36:3001:890f:c6ea:3f9b:7a39:cc3f", - "4d17:1d6e:e699:bd7a:88c5:5e7e:ac6a:4472", - }, - }, - { - Want: []net.IP{ - net.ParseIP("5170:f971:cfac:7be3:512a:af37:952c:bc33"), - net.ParseIP("93.21.145.140"), - net.ParseIP("2cac:61d3:c5ff:6caf:73e0:1b1a:c336:c1ca"), - }, - FlagArg: []string{ - " 5170:f971:cfac:7be3:512a:af37:952c:bc33 , 93.21.145.140 ", - "2cac:61d3:c5ff:6caf:73e0:1b1a:c336:c1ca", - }, - }, - { - Want: []net.IP{ - net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), - net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), - net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), - net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), - }, - FlagArg: []string{ - `"2e5e:66b2:6441:848:5b74:76ea:574c:3a7b, 2e5e:66b2:6441:848:5b74:76ea:574c:3a7b,2e5e:66b2:6441:848:5b74:76ea:574c:3a7b "`, - " 2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"}, - }, - } - - for i, test := range tests { - - var ips []net.IP - f := setUpIPSFlagSet(&ips) - - if err := f.Parse([]string{fmt.Sprintf("--ips=%s", strings.Join(test.FlagArg, ","))}); err != nil { - t.Fatalf("flag parsing failed with error: %s\nparsing:\t%#v\nwant:\t\t%s", - err, test.FlagArg, test.Want[i]) - } - - for j, b := range ips { - if !b.Equal(test.Want[j]) { - t.Fatalf("bad value parsed for test %d on net.IP %d:\nwant:\t%s\ngot:\t%s", i, j, test.Want[j], b) - } - } - } -} +package pflag + +import ( + "fmt" + "net" + "strings" + "testing" +) + +func setUpIPSFlagSet(ipsp *[]net.IP) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.IPSliceVar(ipsp, "ips", []net.IP{}, "Command separated list!") + return f +} + +func setUpIPSFlagSetWithDefault(ipsp *[]net.IP) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.IPSliceVar(ipsp, "ips", + []net.IP{ + net.ParseIP("192.168.1.1"), + net.ParseIP("0:0:0:0:0:0:0:1"), + }, + "Command separated list!") + return f +} + +func TestEmptyIP(t *testing.T) { + var ips []net.IP + f := setUpIPSFlagSet(&ips) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getIPS, err := f.GetIPSlice("ips") + if err != nil { + t.Fatal("got an error from GetIPSlice():", err) + } + if len(getIPS) != 0 { + t.Fatalf("got ips %v with len=%d but expected length=0", getIPS, len(getIPS)) + } +} + +func TestIPS(t *testing.T) { + var ips []net.IP + f := setUpIPSFlagSet(&ips) + + vals := []string{"192.168.1.1", "10.0.0.1", "0:0:0:0:0:0:0:2"} + arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ips { + if ip := net.ParseIP(vals[i]); ip == nil { + t.Fatalf("invalid string being converted to IP address: %s", vals[i]) + } else if !ip.Equal(v) { + t.Fatalf("expected ips[%d] to be %s but got: %s from GetIPSlice", i, vals[i], v) + } + } +} + +func TestIPSDefault(t *testing.T) { + var ips []net.IP + f := setUpIPSFlagSetWithDefault(&ips) + + vals := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"} + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ips { + if ip := net.ParseIP(vals[i]); ip == nil { + t.Fatalf("invalid string being converted to IP address: %s", vals[i]) + } else if !ip.Equal(v) { + t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) + } + } + + getIPS, err := f.GetIPSlice("ips") + if err != nil { + t.Fatal("got an error from GetIPSlice") + } + for i, v := range getIPS { + if ip := net.ParseIP(vals[i]); ip == nil { + t.Fatalf("invalid string being converted to IP address: %s", vals[i]) + } else if !ip.Equal(v) { + t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) + } + } +} + +func TestIPSWithDefault(t *testing.T) { + var ips []net.IP + f := setUpIPSFlagSetWithDefault(&ips) + + vals := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"} + arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ips { + if ip := net.ParseIP(vals[i]); ip == nil { + t.Fatalf("invalid string being converted to IP address: %s", vals[i]) + } else if !ip.Equal(v) { + t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) + } + } + + getIPS, err := f.GetIPSlice("ips") + if err != nil { + t.Fatal("got an error from GetIPSlice") + } + for i, v := range getIPS { + if ip := net.ParseIP(vals[i]); ip == nil { + t.Fatalf("invalid string being converted to IP address: %s", vals[i]) + } else if !ip.Equal(v) { + t.Fatalf("expected ips[%d] to be %s but got: %s", i, vals[i], v) + } + } +} + +func TestIPSCalledTwice(t *testing.T) { + var ips []net.IP + f := setUpIPSFlagSet(&ips) + + in := []string{"192.168.1.2,0:0:0:0:0:0:0:1", "10.0.0.1"} + expected := []net.IP{net.ParseIP("192.168.1.2"), net.ParseIP("0:0:0:0:0:0:0:1"), net.ParseIP("10.0.0.1")} + argfmt := "ips=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ips { + if !expected[i].Equal(v) { + t.Fatalf("expected ips[%d] to be %s but got: %s", i, expected[i], v) + } + } +} + +func TestIPSBadQuoting(t *testing.T) { + + tests := []struct { + Want []net.IP + FlagArg []string + }{ + { + Want: []net.IP{ + net.ParseIP("a4ab:61d:f03e:5d7d:fad7:d4c2:a1a5:568"), + net.ParseIP("203.107.49.208"), + net.ParseIP("14.57.204.90"), + }, + FlagArg: []string{ + "a4ab:61d:f03e:5d7d:fad7:d4c2:a1a5:568", + "203.107.49.208", + "14.57.204.90", + }, + }, + { + Want: []net.IP{ + net.ParseIP("204.228.73.195"), + net.ParseIP("86.141.15.94"), + }, + FlagArg: []string{ + "204.228.73.195", + "86.141.15.94", + }, + }, + { + Want: []net.IP{ + net.ParseIP("c70c:db36:3001:890f:c6ea:3f9b:7a39:cc3f"), + net.ParseIP("4d17:1d6e:e699:bd7a:88c5:5e7e:ac6a:4472"), + }, + FlagArg: []string{ + "c70c:db36:3001:890f:c6ea:3f9b:7a39:cc3f", + "4d17:1d6e:e699:bd7a:88c5:5e7e:ac6a:4472", + }, + }, + { + Want: []net.IP{ + net.ParseIP("5170:f971:cfac:7be3:512a:af37:952c:bc33"), + net.ParseIP("93.21.145.140"), + net.ParseIP("2cac:61d3:c5ff:6caf:73e0:1b1a:c336:c1ca"), + }, + FlagArg: []string{ + " 5170:f971:cfac:7be3:512a:af37:952c:bc33 , 93.21.145.140 ", + "2cac:61d3:c5ff:6caf:73e0:1b1a:c336:c1ca", + }, + }, + { + Want: []net.IP{ + net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), + net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), + net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), + net.ParseIP("2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"), + }, + FlagArg: []string{ + `"2e5e:66b2:6441:848:5b74:76ea:574c:3a7b, 2e5e:66b2:6441:848:5b74:76ea:574c:3a7b,2e5e:66b2:6441:848:5b74:76ea:574c:3a7b "`, + " 2e5e:66b2:6441:848:5b74:76ea:574c:3a7b"}, + }, + } + + for i, test := range tests { + + var ips []net.IP + f := setUpIPSFlagSet(&ips) + + if err := f.Parse([]string{fmt.Sprintf("--ips=%s", strings.Join(test.FlagArg, ","))}); err != nil { + t.Fatalf("flag parsing failed with error: %s\nparsing:\t%#v\nwant:\t\t%s", + err, test.FlagArg, test.Want[i]) + } + + for j, b := range ips { + if !b.Equal(test.Want[j]) { + t.Fatalf("bad value parsed for test %d on net.IP %d:\nwant:\t%s\ngot:\t%s", i, j, test.Want[j], b) + } + } + } +} diff --git a/vendor/github.com/spf13/pflag/ip_test.go b/vendor/github.com/spf13/pflag/ip_test.go index 18f3b8c4ce..1fec50e425 100644 --- a/vendor/github.com/spf13/pflag/ip_test.go +++ b/vendor/github.com/spf13/pflag/ip_test.go @@ -1,63 +1,63 @@ -package pflag - -import ( - "fmt" - "net" - "os" - "testing" -) - -func setUpIP(ip *net.IP) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.IPVar(ip, "address", net.ParseIP("0.0.0.0"), "IP Address") - return f -} - -func TestIP(t *testing.T) { - testCases := []struct { - input string - success bool - expected string - }{ - {"0.0.0.0", true, "0.0.0.0"}, - {" 0.0.0.0 ", true, "0.0.0.0"}, - {"1.2.3.4", true, "1.2.3.4"}, - {"127.0.0.1", true, "127.0.0.1"}, - {"255.255.255.255", true, "255.255.255.255"}, - {"", false, ""}, - {"0", false, ""}, - {"localhost", false, ""}, - {"0.0.0", false, ""}, - {"0.0.0.", false, ""}, - {"0.0.0.0.", false, ""}, - {"0.0.0.256", false, ""}, - {"0 . 0 . 0 . 0", false, ""}, - } - - devnull, _ := os.Open(os.DevNull) - os.Stderr = devnull - for i := range testCases { - var addr net.IP - f := setUpIP(&addr) - - tc := &testCases[i] - - arg := fmt.Sprintf("--address=%s", tc.input) - err := f.Parse([]string{arg}) - if err != nil && tc.success == true { - t.Errorf("expected success, got %q", err) - continue - } else if err == nil && tc.success == false { - t.Errorf("expected failure") - continue - } else if tc.success { - ip, err := f.GetIP("address") - if err != nil { - t.Errorf("Got error trying to fetch the IP flag: %v", err) - } - if ip.String() != tc.expected { - t.Errorf("expected %q, got %q", tc.expected, ip.String()) - } - } - } -} +package pflag + +import ( + "fmt" + "net" + "os" + "testing" +) + +func setUpIP(ip *net.IP) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.IPVar(ip, "address", net.ParseIP("0.0.0.0"), "IP Address") + return f +} + +func TestIP(t *testing.T) { + testCases := []struct { + input string + success bool + expected string + }{ + {"0.0.0.0", true, "0.0.0.0"}, + {" 0.0.0.0 ", true, "0.0.0.0"}, + {"1.2.3.4", true, "1.2.3.4"}, + {"127.0.0.1", true, "127.0.0.1"}, + {"255.255.255.255", true, "255.255.255.255"}, + {"", false, ""}, + {"0", false, ""}, + {"localhost", false, ""}, + {"0.0.0", false, ""}, + {"0.0.0.", false, ""}, + {"0.0.0.0.", false, ""}, + {"0.0.0.256", false, ""}, + {"0 . 0 . 0 . 0", false, ""}, + } + + devnull, _ := os.Open(os.DevNull) + os.Stderr = devnull + for i := range testCases { + var addr net.IP + f := setUpIP(&addr) + + tc := &testCases[i] + + arg := fmt.Sprintf("--address=%s", tc.input) + err := f.Parse([]string{arg}) + if err != nil && tc.success == true { + t.Errorf("expected success, got %q", err) + continue + } else if err == nil && tc.success == false { + t.Errorf("expected failure") + continue + } else if tc.success { + ip, err := f.GetIP("address") + if err != nil { + t.Errorf("Got error trying to fetch the IP flag: %v", err) + } + if ip.String() != tc.expected { + t.Errorf("expected %q, got %q", tc.expected, ip.String()) + } + } + } +} diff --git a/vendor/github.com/spf13/pflag/ipmask.go b/vendor/github.com/spf13/pflag/ipmask.go index 51a67be3fc..5bd44bd21d 100644 --- a/vendor/github.com/spf13/pflag/ipmask.go +++ b/vendor/github.com/spf13/pflag/ipmask.go @@ -1,122 +1,122 @@ -package pflag - -import ( - "fmt" - "net" - "strconv" -) - -// -- net.IPMask value -type ipMaskValue net.IPMask - -func newIPMaskValue(val net.IPMask, p *net.IPMask) *ipMaskValue { - *p = val - return (*ipMaskValue)(p) -} - -func (i *ipMaskValue) String() string { return net.IPMask(*i).String() } -func (i *ipMaskValue) Set(s string) error { - ip := ParseIPv4Mask(s) - if ip == nil { - return fmt.Errorf("failed to parse IP mask: %q", s) - } - *i = ipMaskValue(ip) - return nil -} - -func (i *ipMaskValue) Type() string { - return "ipMask" -} - -// ParseIPv4Mask written in IP form (e.g. 255.255.255.0). -// This function should really belong to the net package. -func ParseIPv4Mask(s string) net.IPMask { - mask := net.ParseIP(s) - if mask == nil { - if len(s) != 8 { - return nil - } - // net.IPMask.String() actually outputs things like ffffff00 - // so write a horrible parser for that as well :-( - m := []int{} - for i := 0; i < 4; i++ { - b := "0x" + s[2*i:2*i+2] - d, err := strconv.ParseInt(b, 0, 0) - if err != nil { - return nil - } - m = append(m, int(d)) - } - s := fmt.Sprintf("%d.%d.%d.%d", m[0], m[1], m[2], m[3]) - mask = net.ParseIP(s) - if mask == nil { - return nil - } - } - return net.IPv4Mask(mask[12], mask[13], mask[14], mask[15]) -} - -func parseIPv4Mask(sval string) (interface{}, error) { - mask := ParseIPv4Mask(sval) - if mask == nil { - return nil, fmt.Errorf("unable to parse %s as net.IPMask", sval) - } - return mask, nil -} - -// GetIPv4Mask return the net.IPv4Mask value of a flag with the given name -func (f *FlagSet) GetIPv4Mask(name string) (net.IPMask, error) { - val, err := f.getFlagType(name, "ipMask", parseIPv4Mask) - if err != nil { - return nil, err - } - return val.(net.IPMask), nil -} - -// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. -// The argument p points to an net.IPMask variable in which to store the value of the flag. -func (f *FlagSet) IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { - f.VarP(newIPMaskValue(value, p), name, "", usage) -} - -// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) { - f.VarP(newIPMaskValue(value, p), name, shorthand, usage) -} - -// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. -// The argument p points to an net.IPMask variable in which to store the value of the flag. -func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { - CommandLine.VarP(newIPMaskValue(value, p), name, "", usage) -} - -// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. -func IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) { - CommandLine.VarP(newIPMaskValue(value, p), name, shorthand, usage) -} - -// IPMask defines an net.IPMask flag with specified name, default value, and usage string. -// The return value is the address of an net.IPMask variable that stores the value of the flag. -func (f *FlagSet) IPMask(name string, value net.IPMask, usage string) *net.IPMask { - p := new(net.IPMask) - f.IPMaskVarP(p, name, "", value, usage) - return p -} - -// IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask { - p := new(net.IPMask) - f.IPMaskVarP(p, name, shorthand, value, usage) - return p -} - -// IPMask defines an net.IPMask flag with specified name, default value, and usage string. -// The return value is the address of an net.IPMask variable that stores the value of the flag. -func IPMask(name string, value net.IPMask, usage string) *net.IPMask { - return CommandLine.IPMaskP(name, "", value, usage) -} - -// IPMaskP is like IP, but accepts a shorthand letter that can be used after a single dash. -func IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask { - return CommandLine.IPMaskP(name, shorthand, value, usage) -} +package pflag + +import ( + "fmt" + "net" + "strconv" +) + +// -- net.IPMask value +type ipMaskValue net.IPMask + +func newIPMaskValue(val net.IPMask, p *net.IPMask) *ipMaskValue { + *p = val + return (*ipMaskValue)(p) +} + +func (i *ipMaskValue) String() string { return net.IPMask(*i).String() } +func (i *ipMaskValue) Set(s string) error { + ip := ParseIPv4Mask(s) + if ip == nil { + return fmt.Errorf("failed to parse IP mask: %q", s) + } + *i = ipMaskValue(ip) + return nil +} + +func (i *ipMaskValue) Type() string { + return "ipMask" +} + +// ParseIPv4Mask written in IP form (e.g. 255.255.255.0). +// This function should really belong to the net package. +func ParseIPv4Mask(s string) net.IPMask { + mask := net.ParseIP(s) + if mask == nil { + if len(s) != 8 { + return nil + } + // net.IPMask.String() actually outputs things like ffffff00 + // so write a horrible parser for that as well :-( + m := []int{} + for i := 0; i < 4; i++ { + b := "0x" + s[2*i:2*i+2] + d, err := strconv.ParseInt(b, 0, 0) + if err != nil { + return nil + } + m = append(m, int(d)) + } + s := fmt.Sprintf("%d.%d.%d.%d", m[0], m[1], m[2], m[3]) + mask = net.ParseIP(s) + if mask == nil { + return nil + } + } + return net.IPv4Mask(mask[12], mask[13], mask[14], mask[15]) +} + +func parseIPv4Mask(sval string) (interface{}, error) { + mask := ParseIPv4Mask(sval) + if mask == nil { + return nil, fmt.Errorf("unable to parse %s as net.IPMask", sval) + } + return mask, nil +} + +// GetIPv4Mask return the net.IPv4Mask value of a flag with the given name +func (f *FlagSet) GetIPv4Mask(name string) (net.IPMask, error) { + val, err := f.getFlagType(name, "ipMask", parseIPv4Mask) + if err != nil { + return nil, err + } + return val.(net.IPMask), nil +} + +// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. +// The argument p points to an net.IPMask variable in which to store the value of the flag. +func (f *FlagSet) IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { + f.VarP(newIPMaskValue(value, p), name, "", usage) +} + +// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) { + f.VarP(newIPMaskValue(value, p), name, shorthand, usage) +} + +// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string. +// The argument p points to an net.IPMask variable in which to store the value of the flag. +func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) { + CommandLine.VarP(newIPMaskValue(value, p), name, "", usage) +} + +// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash. +func IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) { + CommandLine.VarP(newIPMaskValue(value, p), name, shorthand, usage) +} + +// IPMask defines an net.IPMask flag with specified name, default value, and usage string. +// The return value is the address of an net.IPMask variable that stores the value of the flag. +func (f *FlagSet) IPMask(name string, value net.IPMask, usage string) *net.IPMask { + p := new(net.IPMask) + f.IPMaskVarP(p, name, "", value, usage) + return p +} + +// IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask { + p := new(net.IPMask) + f.IPMaskVarP(p, name, shorthand, value, usage) + return p +} + +// IPMask defines an net.IPMask flag with specified name, default value, and usage string. +// The return value is the address of an net.IPMask variable that stores the value of the flag. +func IPMask(name string, value net.IPMask, usage string) *net.IPMask { + return CommandLine.IPMaskP(name, "", value, usage) +} + +// IPMaskP is like IP, but accepts a shorthand letter that can be used after a single dash. +func IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask { + return CommandLine.IPMaskP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/ipnet.go b/vendor/github.com/spf13/pflag/ipnet.go index 934ba14749..e2c1b8bcd5 100644 --- a/vendor/github.com/spf13/pflag/ipnet.go +++ b/vendor/github.com/spf13/pflag/ipnet.go @@ -1,98 +1,98 @@ -package pflag - -import ( - "fmt" - "net" - "strings" -) - -// IPNet adapts net.IPNet for use as a flag. -type ipNetValue net.IPNet - -func (ipnet ipNetValue) String() string { - n := net.IPNet(ipnet) - return n.String() -} - -func (ipnet *ipNetValue) Set(value string) error { - _, n, err := net.ParseCIDR(strings.TrimSpace(value)) - if err != nil { - return err - } - *ipnet = ipNetValue(*n) - return nil -} - -func (*ipNetValue) Type() string { - return "ipNet" -} - -func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue { - *p = val - return (*ipNetValue)(p) -} - -func ipNetConv(sval string) (interface{}, error) { - _, n, err := net.ParseCIDR(strings.TrimSpace(sval)) - if err == nil { - return *n, nil - } - return nil, fmt.Errorf("invalid string being converted to IPNet: %s", sval) -} - -// GetIPNet return the net.IPNet value of a flag with the given name -func (f *FlagSet) GetIPNet(name string) (net.IPNet, error) { - val, err := f.getFlagType(name, "ipNet", ipNetConv) - if err != nil { - return net.IPNet{}, err - } - return val.(net.IPNet), nil -} - -// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. -// The argument p points to an net.IPNet variable in which to store the value of the flag. -func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { - f.VarP(newIPNetValue(value, p), name, "", usage) -} - -// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { - f.VarP(newIPNetValue(value, p), name, shorthand, usage) -} - -// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. -// The argument p points to an net.IPNet variable in which to store the value of the flag. -func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { - CommandLine.VarP(newIPNetValue(value, p), name, "", usage) -} - -// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. -func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { - CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage) -} - -// IPNet defines an net.IPNet flag with specified name, default value, and usage string. -// The return value is the address of an net.IPNet variable that stores the value of the flag. -func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet { - p := new(net.IPNet) - f.IPNetVarP(p, name, "", value, usage) - return p -} - -// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { - p := new(net.IPNet) - f.IPNetVarP(p, name, shorthand, value, usage) - return p -} - -// IPNet defines an net.IPNet flag with specified name, default value, and usage string. -// The return value is the address of an net.IPNet variable that stores the value of the flag. -func IPNet(name string, value net.IPNet, usage string) *net.IPNet { - return CommandLine.IPNetP(name, "", value, usage) -} - -// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. -func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { - return CommandLine.IPNetP(name, shorthand, value, usage) -} +package pflag + +import ( + "fmt" + "net" + "strings" +) + +// IPNet adapts net.IPNet for use as a flag. +type ipNetValue net.IPNet + +func (ipnet ipNetValue) String() string { + n := net.IPNet(ipnet) + return n.String() +} + +func (ipnet *ipNetValue) Set(value string) error { + _, n, err := net.ParseCIDR(strings.TrimSpace(value)) + if err != nil { + return err + } + *ipnet = ipNetValue(*n) + return nil +} + +func (*ipNetValue) Type() string { + return "ipNet" +} + +func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue { + *p = val + return (*ipNetValue)(p) +} + +func ipNetConv(sval string) (interface{}, error) { + _, n, err := net.ParseCIDR(strings.TrimSpace(sval)) + if err == nil { + return *n, nil + } + return nil, fmt.Errorf("invalid string being converted to IPNet: %s", sval) +} + +// GetIPNet return the net.IPNet value of a flag with the given name +func (f *FlagSet) GetIPNet(name string) (net.IPNet, error) { + val, err := f.getFlagType(name, "ipNet", ipNetConv) + if err != nil { + return net.IPNet{}, err + } + return val.(net.IPNet), nil +} + +// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. +// The argument p points to an net.IPNet variable in which to store the value of the flag. +func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { + f.VarP(newIPNetValue(value, p), name, "", usage) +} + +// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { + f.VarP(newIPNetValue(value, p), name, shorthand, usage) +} + +// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string. +// The argument p points to an net.IPNet variable in which to store the value of the flag. +func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) { + CommandLine.VarP(newIPNetValue(value, p), name, "", usage) +} + +// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash. +func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) { + CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage) +} + +// IPNet defines an net.IPNet flag with specified name, default value, and usage string. +// The return value is the address of an net.IPNet variable that stores the value of the flag. +func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet { + p := new(net.IPNet) + f.IPNetVarP(p, name, "", value, usage) + return p +} + +// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { + p := new(net.IPNet) + f.IPNetVarP(p, name, shorthand, value, usage) + return p +} + +// IPNet defines an net.IPNet flag with specified name, default value, and usage string. +// The return value is the address of an net.IPNet variable that stores the value of the flag. +func IPNet(name string, value net.IPNet, usage string) *net.IPNet { + return CommandLine.IPNetP(name, "", value, usage) +} + +// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash. +func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet { + return CommandLine.IPNetP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/ipnet_test.go b/vendor/github.com/spf13/pflag/ipnet_test.go index d81ab9a2a1..335b6fa156 100644 --- a/vendor/github.com/spf13/pflag/ipnet_test.go +++ b/vendor/github.com/spf13/pflag/ipnet_test.go @@ -1,70 +1,70 @@ -package pflag - -import ( - "fmt" - "net" - "os" - "testing" -) - -func setUpIPNet(ip *net.IPNet) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - _, def, _ := net.ParseCIDR("0.0.0.0/0") - f.IPNetVar(ip, "address", *def, "IP Address") - return f -} - -func TestIPNet(t *testing.T) { - testCases := []struct { - input string - success bool - expected string - }{ - {"0.0.0.0/0", true, "0.0.0.0/0"}, - {" 0.0.0.0/0 ", true, "0.0.0.0/0"}, - {"1.2.3.4/8", true, "1.0.0.0/8"}, - {"127.0.0.1/16", true, "127.0.0.0/16"}, - {"255.255.255.255/19", true, "255.255.224.0/19"}, - {"255.255.255.255/32", true, "255.255.255.255/32"}, - {"", false, ""}, - {"/0", false, ""}, - {"0", false, ""}, - {"0/0", false, ""}, - {"localhost/0", false, ""}, - {"0.0.0/4", false, ""}, - {"0.0.0./8", false, ""}, - {"0.0.0.0./12", false, ""}, - {"0.0.0.256/16", false, ""}, - {"0.0.0.0 /20", false, ""}, - {"0.0.0.0/ 24", false, ""}, - {"0 . 0 . 0 . 0 / 28", false, ""}, - {"0.0.0.0/33", false, ""}, - } - - devnull, _ := os.Open(os.DevNull) - os.Stderr = devnull - for i := range testCases { - var addr net.IPNet - f := setUpIPNet(&addr) - - tc := &testCases[i] - - arg := fmt.Sprintf("--address=%s", tc.input) - err := f.Parse([]string{arg}) - if err != nil && tc.success == true { - t.Errorf("expected success, got %q", err) - continue - } else if err == nil && tc.success == false { - t.Errorf("expected failure") - continue - } else if tc.success { - ip, err := f.GetIPNet("address") - if err != nil { - t.Errorf("Got error trying to fetch the IP flag: %v", err) - } - if ip.String() != tc.expected { - t.Errorf("expected %q, got %q", tc.expected, ip.String()) - } - } - } -} +package pflag + +import ( + "fmt" + "net" + "os" + "testing" +) + +func setUpIPNet(ip *net.IPNet) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + _, def, _ := net.ParseCIDR("0.0.0.0/0") + f.IPNetVar(ip, "address", *def, "IP Address") + return f +} + +func TestIPNet(t *testing.T) { + testCases := []struct { + input string + success bool + expected string + }{ + {"0.0.0.0/0", true, "0.0.0.0/0"}, + {" 0.0.0.0/0 ", true, "0.0.0.0/0"}, + {"1.2.3.4/8", true, "1.0.0.0/8"}, + {"127.0.0.1/16", true, "127.0.0.0/16"}, + {"255.255.255.255/19", true, "255.255.224.0/19"}, + {"255.255.255.255/32", true, "255.255.255.255/32"}, + {"", false, ""}, + {"/0", false, ""}, + {"0", false, ""}, + {"0/0", false, ""}, + {"localhost/0", false, ""}, + {"0.0.0/4", false, ""}, + {"0.0.0./8", false, ""}, + {"0.0.0.0./12", false, ""}, + {"0.0.0.256/16", false, ""}, + {"0.0.0.0 /20", false, ""}, + {"0.0.0.0/ 24", false, ""}, + {"0 . 0 . 0 . 0 / 28", false, ""}, + {"0.0.0.0/33", false, ""}, + } + + devnull, _ := os.Open(os.DevNull) + os.Stderr = devnull + for i := range testCases { + var addr net.IPNet + f := setUpIPNet(&addr) + + tc := &testCases[i] + + arg := fmt.Sprintf("--address=%s", tc.input) + err := f.Parse([]string{arg}) + if err != nil && tc.success == true { + t.Errorf("expected success, got %q", err) + continue + } else if err == nil && tc.success == false { + t.Errorf("expected failure") + continue + } else if tc.success { + ip, err := f.GetIPNet("address") + if err != nil { + t.Errorf("Got error trying to fetch the IP flag: %v", err) + } + if ip.String() != tc.expected { + t.Errorf("expected %q, got %q", tc.expected, ip.String()) + } + } + } +} diff --git a/vendor/github.com/spf13/pflag/string.go b/vendor/github.com/spf13/pflag/string.go index d8921e1332..04e0a26ff7 100644 --- a/vendor/github.com/spf13/pflag/string.go +++ b/vendor/github.com/spf13/pflag/string.go @@ -1,80 +1,80 @@ -package pflag - -// -- string Value -type stringValue string - -func newStringValue(val string, p *string) *stringValue { - *p = val - return (*stringValue)(p) -} - -func (s *stringValue) Set(val string) error { - *s = stringValue(val) - return nil -} -func (s *stringValue) Type() string { - return "string" -} - -func (s *stringValue) String() string { return string(*s) } - -func stringConv(sval string) (interface{}, error) { - return sval, nil -} - -// GetString return the string value of a flag with the given name -func (f *FlagSet) GetString(name string) (string, error) { - val, err := f.getFlagType(name, "string", stringConv) - if err != nil { - return "", err - } - return val.(string), nil -} - -// StringVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a string variable in which to store the value of the flag. -func (f *FlagSet) StringVar(p *string, name string, value string, usage string) { - f.VarP(newStringValue(value, p), name, "", usage) -} - -// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) { - f.VarP(newStringValue(value, p), name, shorthand, usage) -} - -// StringVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a string variable in which to store the value of the flag. -func StringVar(p *string, name string, value string, usage string) { - CommandLine.VarP(newStringValue(value, p), name, "", usage) -} - -// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. -func StringVarP(p *string, name, shorthand string, value string, usage string) { - CommandLine.VarP(newStringValue(value, p), name, shorthand, usage) -} - -// String defines a string flag with specified name, default value, and usage string. -// The return value is the address of a string variable that stores the value of the flag. -func (f *FlagSet) String(name string, value string, usage string) *string { - p := new(string) - f.StringVarP(p, name, "", value, usage) - return p -} - -// StringP is like String, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string { - p := new(string) - f.StringVarP(p, name, shorthand, value, usage) - return p -} - -// String defines a string flag with specified name, default value, and usage string. -// The return value is the address of a string variable that stores the value of the flag. -func String(name string, value string, usage string) *string { - return CommandLine.StringP(name, "", value, usage) -} - -// StringP is like String, but accepts a shorthand letter that can be used after a single dash. -func StringP(name, shorthand string, value string, usage string) *string { - return CommandLine.StringP(name, shorthand, value, usage) -} +package pflag + +// -- string Value +type stringValue string + +func newStringValue(val string, p *string) *stringValue { + *p = val + return (*stringValue)(p) +} + +func (s *stringValue) Set(val string) error { + *s = stringValue(val) + return nil +} +func (s *stringValue) Type() string { + return "string" +} + +func (s *stringValue) String() string { return string(*s) } + +func stringConv(sval string) (interface{}, error) { + return sval, nil +} + +// GetString return the string value of a flag with the given name +func (f *FlagSet) GetString(name string) (string, error) { + val, err := f.getFlagType(name, "string", stringConv) + if err != nil { + return "", err + } + return val.(string), nil +} + +// StringVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a string variable in which to store the value of the flag. +func (f *FlagSet) StringVar(p *string, name string, value string, usage string) { + f.VarP(newStringValue(value, p), name, "", usage) +} + +// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) { + f.VarP(newStringValue(value, p), name, shorthand, usage) +} + +// StringVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a string variable in which to store the value of the flag. +func StringVar(p *string, name string, value string, usage string) { + CommandLine.VarP(newStringValue(value, p), name, "", usage) +} + +// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash. +func StringVarP(p *string, name, shorthand string, value string, usage string) { + CommandLine.VarP(newStringValue(value, p), name, shorthand, usage) +} + +// String defines a string flag with specified name, default value, and usage string. +// The return value is the address of a string variable that stores the value of the flag. +func (f *FlagSet) String(name string, value string, usage string) *string { + p := new(string) + f.StringVarP(p, name, "", value, usage) + return p +} + +// StringP is like String, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string { + p := new(string) + f.StringVarP(p, name, shorthand, value, usage) + return p +} + +// String defines a string flag with specified name, default value, and usage string. +// The return value is the address of a string variable that stores the value of the flag. +func String(name string, value string, usage string) *string { + return CommandLine.StringP(name, "", value, usage) +} + +// StringP is like String, but accepts a shorthand letter that can be used after a single dash. +func StringP(name, shorthand string, value string, usage string) *string { + return CommandLine.StringP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_array.go b/vendor/github.com/spf13/pflag/string_array.go index 3a77891e98..276b7ed49e 100644 --- a/vendor/github.com/spf13/pflag/string_array.go +++ b/vendor/github.com/spf13/pflag/string_array.go @@ -1,103 +1,103 @@ -package pflag - -// -- stringArray Value -type stringArrayValue struct { - value *[]string - changed bool -} - -func newStringArrayValue(val []string, p *[]string) *stringArrayValue { - ssv := new(stringArrayValue) - ssv.value = p - *ssv.value = val - return ssv -} - -func (s *stringArrayValue) Set(val string) error { - if !s.changed { - *s.value = []string{val} - s.changed = true - } else { - *s.value = append(*s.value, val) - } - return nil -} - -func (s *stringArrayValue) Type() string { - return "stringArray" -} - -func (s *stringArrayValue) String() string { - str, _ := writeAsCSV(*s.value) - return "[" + str + "]" -} - -func stringArrayConv(sval string) (interface{}, error) { - sval = sval[1 : len(sval)-1] - // An empty string would cause a array with one (empty) string - if len(sval) == 0 { - return []string{}, nil - } - return readAsCSV(sval) -} - -// GetStringArray return the []string value of a flag with the given name -func (f *FlagSet) GetStringArray(name string) ([]string, error) { - val, err := f.getFlagType(name, "stringArray", stringArrayConv) - if err != nil { - return []string{}, err - } - return val.([]string), nil -} - -// StringArrayVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a []string variable in which to store the values of the multiple flags. -// The value of each argument will not try to be separated by comma -func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) { - f.VarP(newStringArrayValue(value, p), name, "", usage) -} - -// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) { - f.VarP(newStringArrayValue(value, p), name, shorthand, usage) -} - -// StringArrayVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a []string variable in which to store the value of the flag. -// The value of each argument will not try to be separated by comma -func StringArrayVar(p *[]string, name string, value []string, usage string) { - CommandLine.VarP(newStringArrayValue(value, p), name, "", usage) -} - -// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. -func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) { - CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage) -} - -// StringArray defines a string flag with specified name, default value, and usage string. -// The return value is the address of a []string variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma -func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string { - p := []string{} - f.StringArrayVarP(&p, name, "", value, usage) - return &p -} - -// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string { - p := []string{} - f.StringArrayVarP(&p, name, shorthand, value, usage) - return &p -} - -// StringArray defines a string flag with specified name, default value, and usage string. -// The return value is the address of a []string variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma -func StringArray(name string, value []string, usage string) *[]string { - return CommandLine.StringArrayP(name, "", value, usage) -} - -// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. -func StringArrayP(name, shorthand string, value []string, usage string) *[]string { - return CommandLine.StringArrayP(name, shorthand, value, usage) -} +package pflag + +// -- stringArray Value +type stringArrayValue struct { + value *[]string + changed bool +} + +func newStringArrayValue(val []string, p *[]string) *stringArrayValue { + ssv := new(stringArrayValue) + ssv.value = p + *ssv.value = val + return ssv +} + +func (s *stringArrayValue) Set(val string) error { + if !s.changed { + *s.value = []string{val} + s.changed = true + } else { + *s.value = append(*s.value, val) + } + return nil +} + +func (s *stringArrayValue) Type() string { + return "stringArray" +} + +func (s *stringArrayValue) String() string { + str, _ := writeAsCSV(*s.value) + return "[" + str + "]" +} + +func stringArrayConv(sval string) (interface{}, error) { + sval = sval[1 : len(sval)-1] + // An empty string would cause a array with one (empty) string + if len(sval) == 0 { + return []string{}, nil + } + return readAsCSV(sval) +} + +// GetStringArray return the []string value of a flag with the given name +func (f *FlagSet) GetStringArray(name string) ([]string, error) { + val, err := f.getFlagType(name, "stringArray", stringArrayConv) + if err != nil { + return []string{}, err + } + return val.([]string), nil +} + +// StringArrayVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a []string variable in which to store the values of the multiple flags. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) { + f.VarP(newStringArrayValue(value, p), name, "", usage) +} + +// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) { + f.VarP(newStringArrayValue(value, p), name, shorthand, usage) +} + +// StringArrayVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a []string variable in which to store the value of the flag. +// The value of each argument will not try to be separated by comma +func StringArrayVar(p *[]string, name string, value []string, usage string) { + CommandLine.VarP(newStringArrayValue(value, p), name, "", usage) +} + +// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash. +func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) { + CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage) +} + +// StringArray defines a string flag with specified name, default value, and usage string. +// The return value is the address of a []string variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string { + p := []string{} + f.StringArrayVarP(&p, name, "", value, usage) + return &p +} + +// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string { + p := []string{} + f.StringArrayVarP(&p, name, shorthand, value, usage) + return &p +} + +// StringArray defines a string flag with specified name, default value, and usage string. +// The return value is the address of a []string variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func StringArray(name string, value []string, usage string) *[]string { + return CommandLine.StringArrayP(name, "", value, usage) +} + +// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash. +func StringArrayP(name, shorthand string, value []string, usage string) *[]string { + return CommandLine.StringArrayP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_array_test.go b/vendor/github.com/spf13/pflag/string_array_test.go index 6d04c89f8a..1ceac8c6c6 100644 --- a/vendor/github.com/spf13/pflag/string_array_test.go +++ b/vendor/github.com/spf13/pflag/string_array_test.go @@ -1,233 +1,233 @@ -// 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 pflag - -import ( - "fmt" - "testing" -) - -func setUpSAFlagSet(sap *[]string) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.StringArrayVar(sap, "sa", []string{}, "Command separated list!") - return f -} - -func setUpSAFlagSetWithDefault(sap *[]string) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.StringArrayVar(sap, "sa", []string{"default", "values"}, "Command separated list!") - return f -} - -func TestEmptySA(t *testing.T) { - var sa []string - f := setUpSAFlagSet(&sa) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getSA, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("got an error from GetStringArray():", err) - } - if len(getSA) != 0 { - t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA)) - } -} - -func TestEmptySAValue(t *testing.T) { - var sa []string - f := setUpSAFlagSet(&sa) - err := f.Parse([]string{"--sa="}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getSA, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("got an error from GetStringArray():", err) - } - if len(getSA) != 0 { - t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA)) - } -} - -func TestSADefault(t *testing.T) { - var sa []string - f := setUpSAFlagSetWithDefault(&sa) - - vals := []string{"default", "values"} - - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range sa { - if vals[i] != v { - t.Fatalf("expected sa[%d] to be %s but got: %s", i, vals[i], v) - } - } - - getSA, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("got an error from GetStringArray():", err) - } - for i, v := range getSA { - if vals[i] != v { - t.Fatalf("expected sa[%d] to be %s from GetStringArray but got: %s", i, vals[i], v) - } - } -} - -func TestSAWithDefault(t *testing.T) { - var sa []string - f := setUpSAFlagSetWithDefault(&sa) - - val := "one" - arg := fmt.Sprintf("--sa=%s", val) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(sa) != 1 { - t.Fatalf("expected number of values to be %d but %d", 1, len(sa)) - } - - if sa[0] != val { - t.Fatalf("expected value to be %s but got: %s", sa[0], val) - } - - getSA, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("got an error from GetStringArray():", err) - } - - if len(getSA) != 1 { - t.Fatalf("expected number of values to be %d but %d", 1, len(getSA)) - } - - if getSA[0] != val { - t.Fatalf("expected value to be %s but got: %s", getSA[0], val) - } -} - -func TestSACalledTwice(t *testing.T) { - var sa []string - f := setUpSAFlagSet(&sa) - - in := []string{"one", "two"} - expected := []string{"one", "two"} - argfmt := "--sa=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(sa) { - t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa)) - } - for i, v := range sa { - if expected[i] != v { - t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v) - } - } - - values, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(values) { - t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(sa)) - } - for i, v := range values { - if expected[i] != v { - t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v) - } - } -} - -func TestSAWithSpecialChar(t *testing.T) { - var sa []string - f := setUpSAFlagSet(&sa) - - in := []string{"one,two", `"three"`, `"four,five",six`, "seven eight"} - expected := []string{"one,two", `"three"`, `"four,five",six`, "seven eight"} - argfmt := "--sa=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - arg3 := fmt.Sprintf(argfmt, in[2]) - arg4 := fmt.Sprintf(argfmt, in[3]) - err := f.Parse([]string{arg1, arg2, arg3, arg4}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(sa) { - t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa)) - } - for i, v := range sa { - if expected[i] != v { - t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v) - } - } - - values, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(values) { - t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) - } - for i, v := range values { - if expected[i] != v { - t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v) - } - } -} - -func TestSAWithSquareBrackets(t *testing.T) { - var sa []string - f := setUpSAFlagSet(&sa) - - in := []string{"][]-[", "[a-z]", "[a-z]+"} - expected := []string{"][]-[", "[a-z]", "[a-z]+"} - argfmt := "--sa=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - arg3 := fmt.Sprintf(argfmt, in[2]) - err := f.Parse([]string{arg1, arg2, arg3}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(sa) { - t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa)) - } - for i, v := range sa { - if expected[i] != v { - t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v) - } - } - - values, err := f.GetStringArray("sa") - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(values) { - t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) - } - for i, v := range values { - if expected[i] != v { - t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v) - } - } -} +// 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 pflag + +import ( + "fmt" + "testing" +) + +func setUpSAFlagSet(sap *[]string) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.StringArrayVar(sap, "sa", []string{}, "Command separated list!") + return f +} + +func setUpSAFlagSetWithDefault(sap *[]string) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.StringArrayVar(sap, "sa", []string{"default", "values"}, "Command separated list!") + return f +} + +func TestEmptySA(t *testing.T) { + var sa []string + f := setUpSAFlagSet(&sa) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getSA, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("got an error from GetStringArray():", err) + } + if len(getSA) != 0 { + t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA)) + } +} + +func TestEmptySAValue(t *testing.T) { + var sa []string + f := setUpSAFlagSet(&sa) + err := f.Parse([]string{"--sa="}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getSA, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("got an error from GetStringArray():", err) + } + if len(getSA) != 0 { + t.Fatalf("got sa %v with len=%d but expected length=0", getSA, len(getSA)) + } +} + +func TestSADefault(t *testing.T) { + var sa []string + f := setUpSAFlagSetWithDefault(&sa) + + vals := []string{"default", "values"} + + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range sa { + if vals[i] != v { + t.Fatalf("expected sa[%d] to be %s but got: %s", i, vals[i], v) + } + } + + getSA, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("got an error from GetStringArray():", err) + } + for i, v := range getSA { + if vals[i] != v { + t.Fatalf("expected sa[%d] to be %s from GetStringArray but got: %s", i, vals[i], v) + } + } +} + +func TestSAWithDefault(t *testing.T) { + var sa []string + f := setUpSAFlagSetWithDefault(&sa) + + val := "one" + arg := fmt.Sprintf("--sa=%s", val) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(sa) != 1 { + t.Fatalf("expected number of values to be %d but %d", 1, len(sa)) + } + + if sa[0] != val { + t.Fatalf("expected value to be %s but got: %s", sa[0], val) + } + + getSA, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("got an error from GetStringArray():", err) + } + + if len(getSA) != 1 { + t.Fatalf("expected number of values to be %d but %d", 1, len(getSA)) + } + + if getSA[0] != val { + t.Fatalf("expected value to be %s but got: %s", getSA[0], val) + } +} + +func TestSACalledTwice(t *testing.T) { + var sa []string + f := setUpSAFlagSet(&sa) + + in := []string{"one", "two"} + expected := []string{"one", "two"} + argfmt := "--sa=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(sa) { + t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa)) + } + for i, v := range sa { + if expected[i] != v { + t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v) + } + } + + values, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(values) { + t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(sa)) + } + for i, v := range values { + if expected[i] != v { + t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v) + } + } +} + +func TestSAWithSpecialChar(t *testing.T) { + var sa []string + f := setUpSAFlagSet(&sa) + + in := []string{"one,two", `"three"`, `"four,five",six`, "seven eight"} + expected := []string{"one,two", `"three"`, `"four,five",six`, "seven eight"} + argfmt := "--sa=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + arg3 := fmt.Sprintf(argfmt, in[2]) + arg4 := fmt.Sprintf(argfmt, in[3]) + err := f.Parse([]string{arg1, arg2, arg3, arg4}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(sa) { + t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa)) + } + for i, v := range sa { + if expected[i] != v { + t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v) + } + } + + values, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(values) { + t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) + } + for i, v := range values { + if expected[i] != v { + t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v) + } + } +} + +func TestSAWithSquareBrackets(t *testing.T) { + var sa []string + f := setUpSAFlagSet(&sa) + + in := []string{"][]-[", "[a-z]", "[a-z]+"} + expected := []string{"][]-[", "[a-z]", "[a-z]+"} + argfmt := "--sa=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + arg3 := fmt.Sprintf(argfmt, in[2]) + err := f.Parse([]string{arg1, arg2, arg3}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(sa) { + t.Fatalf("expected number of sa to be %d but got: %d", len(expected), len(sa)) + } + for i, v := range sa { + if expected[i] != v { + t.Fatalf("expected sa[%d] to be %s but got: %s", i, expected[i], v) + } + } + + values, err := f.GetStringArray("sa") + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(values) { + t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) + } + for i, v := range values { + if expected[i] != v { + t.Fatalf("expected got sa[%d] to be %s but got: %s", i, expected[i], v) + } + } +} diff --git a/vendor/github.com/spf13/pflag/string_slice.go b/vendor/github.com/spf13/pflag/string_slice.go index 7a4c05068e..05eee75438 100644 --- a/vendor/github.com/spf13/pflag/string_slice.go +++ b/vendor/github.com/spf13/pflag/string_slice.go @@ -1,129 +1,129 @@ -package pflag - -import ( - "bytes" - "encoding/csv" - "strings" -) - -// -- stringSlice Value -type stringSliceValue struct { - value *[]string - changed bool -} - -func newStringSliceValue(val []string, p *[]string) *stringSliceValue { - ssv := new(stringSliceValue) - ssv.value = p - *ssv.value = val - return ssv -} - -func readAsCSV(val string) ([]string, error) { - if val == "" { - return []string{}, nil - } - stringReader := strings.NewReader(val) - csvReader := csv.NewReader(stringReader) - return csvReader.Read() -} - -func writeAsCSV(vals []string) (string, error) { - b := &bytes.Buffer{} - w := csv.NewWriter(b) - err := w.Write(vals) - if err != nil { - return "", err - } - w.Flush() - return strings.TrimSuffix(b.String(), "\n"), nil -} - -func (s *stringSliceValue) Set(val string) error { - v, err := readAsCSV(val) - if err != nil { - return err - } - if !s.changed { - *s.value = v - } else { - *s.value = append(*s.value, v...) - } - s.changed = true - return nil -} - -func (s *stringSliceValue) Type() string { - return "stringSlice" -} - -func (s *stringSliceValue) String() string { - str, _ := writeAsCSV(*s.value) - return "[" + str + "]" -} - -func stringSliceConv(sval string) (interface{}, error) { - sval = sval[1 : len(sval)-1] - // An empty string would cause a slice with one (empty) string - if len(sval) == 0 { - return []string{}, nil - } - return readAsCSV(sval) -} - -// GetStringSlice return the []string value of a flag with the given name -func (f *FlagSet) GetStringSlice(name string) ([]string, error) { - val, err := f.getFlagType(name, "stringSlice", stringSliceConv) - if err != nil { - return []string{}, err - } - return val.([]string), nil -} - -// StringSliceVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a []string variable in which to store the value of the flag. -func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) { - f.VarP(newStringSliceValue(value, p), name, "", usage) -} - -// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) { - f.VarP(newStringSliceValue(value, p), name, shorthand, usage) -} - -// StringSliceVar defines a string flag with specified name, default value, and usage string. -// The argument p points to a []string variable in which to store the value of the flag. -func StringSliceVar(p *[]string, name string, value []string, usage string) { - CommandLine.VarP(newStringSliceValue(value, p), name, "", usage) -} - -// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. -func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) { - CommandLine.VarP(newStringSliceValue(value, p), name, shorthand, usage) -} - -// StringSlice defines a string flag with specified name, default value, and usage string. -// The return value is the address of a []string variable that stores the value of the flag. -func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string { - p := []string{} - f.StringSliceVarP(&p, name, "", value, usage) - return &p -} - -// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage string) *[]string { - p := []string{} - f.StringSliceVarP(&p, name, shorthand, value, usage) - return &p -} - -// StringSlice defines a string flag with specified name, default value, and usage string. -// The return value is the address of a []string variable that stores the value of the flag. -func StringSlice(name string, value []string, usage string) *[]string { - return CommandLine.StringSliceP(name, "", value, usage) -} - -// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. -func StringSliceP(name, shorthand string, value []string, usage string) *[]string { - return CommandLine.StringSliceP(name, shorthand, value, usage) -} +package pflag + +import ( + "bytes" + "encoding/csv" + "strings" +) + +// -- stringSlice Value +type stringSliceValue struct { + value *[]string + changed bool +} + +func newStringSliceValue(val []string, p *[]string) *stringSliceValue { + ssv := new(stringSliceValue) + ssv.value = p + *ssv.value = val + return ssv +} + +func readAsCSV(val string) ([]string, error) { + if val == "" { + return []string{}, nil + } + stringReader := strings.NewReader(val) + csvReader := csv.NewReader(stringReader) + return csvReader.Read() +} + +func writeAsCSV(vals []string) (string, error) { + b := &bytes.Buffer{} + w := csv.NewWriter(b) + err := w.Write(vals) + if err != nil { + return "", err + } + w.Flush() + return strings.TrimSuffix(b.String(), "\n"), nil +} + +func (s *stringSliceValue) Set(val string) error { + v, err := readAsCSV(val) + if err != nil { + return err + } + if !s.changed { + *s.value = v + } else { + *s.value = append(*s.value, v...) + } + s.changed = true + return nil +} + +func (s *stringSliceValue) Type() string { + return "stringSlice" +} + +func (s *stringSliceValue) String() string { + str, _ := writeAsCSV(*s.value) + return "[" + str + "]" +} + +func stringSliceConv(sval string) (interface{}, error) { + sval = sval[1 : len(sval)-1] + // An empty string would cause a slice with one (empty) string + if len(sval) == 0 { + return []string{}, nil + } + return readAsCSV(sval) +} + +// GetStringSlice return the []string value of a flag with the given name +func (f *FlagSet) GetStringSlice(name string) ([]string, error) { + val, err := f.getFlagType(name, "stringSlice", stringSliceConv) + if err != nil { + return []string{}, err + } + return val.([]string), nil +} + +// StringSliceVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a []string variable in which to store the value of the flag. +func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) { + f.VarP(newStringSliceValue(value, p), name, "", usage) +} + +// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) { + f.VarP(newStringSliceValue(value, p), name, shorthand, usage) +} + +// StringSliceVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a []string variable in which to store the value of the flag. +func StringSliceVar(p *[]string, name string, value []string, usage string) { + CommandLine.VarP(newStringSliceValue(value, p), name, "", usage) +} + +// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash. +func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) { + CommandLine.VarP(newStringSliceValue(value, p), name, shorthand, usage) +} + +// StringSlice defines a string flag with specified name, default value, and usage string. +// The return value is the address of a []string variable that stores the value of the flag. +func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string { + p := []string{} + f.StringSliceVarP(&p, name, "", value, usage) + return &p +} + +// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage string) *[]string { + p := []string{} + f.StringSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// StringSlice defines a string flag with specified name, default value, and usage string. +// The return value is the address of a []string variable that stores the value of the flag. +func StringSlice(name string, value []string, usage string) *[]string { + return CommandLine.StringSliceP(name, "", value, usage) +} + +// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash. +func StringSliceP(name, shorthand string, value []string, usage string) *[]string { + return CommandLine.StringSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_slice_test.go b/vendor/github.com/spf13/pflag/string_slice_test.go index b74609deb8..c41f3bd660 100644 --- a/vendor/github.com/spf13/pflag/string_slice_test.go +++ b/vendor/github.com/spf13/pflag/string_slice_test.go @@ -1,253 +1,253 @@ -// 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 pflag - -import ( - "fmt" - "strings" - "testing" -) - -func setUpSSFlagSet(ssp *[]string) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.StringSliceVar(ssp, "ss", []string{}, "Command separated list!") - return f -} - -func setUpSSFlagSetWithDefault(ssp *[]string) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.StringSliceVar(ssp, "ss", []string{"default", "values"}, "Command separated list!") - return f -} - -func TestEmptySS(t *testing.T) { - var ss []string - f := setUpSSFlagSet(&ss) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getSS, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("got an error from GetStringSlice():", err) - } - if len(getSS) != 0 { - t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS)) - } -} - -func TestEmptySSValue(t *testing.T) { - var ss []string - f := setUpSSFlagSet(&ss) - err := f.Parse([]string{"--ss="}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getSS, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("got an error from GetStringSlice():", err) - } - if len(getSS) != 0 { - t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS)) - } -} - -func TestSS(t *testing.T) { - var ss []string - f := setUpSSFlagSet(&ss) - - vals := []string{"one", "two", "4", "3"} - arg := fmt.Sprintf("--ss=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ss { - if vals[i] != v { - t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v) - } - } - - getSS, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("got an error from GetStringSlice():", err) - } - for i, v := range getSS { - if vals[i] != v { - t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v) - } - } -} - -func TestSSDefault(t *testing.T) { - var ss []string - f := setUpSSFlagSetWithDefault(&ss) - - vals := []string{"default", "values"} - - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ss { - if vals[i] != v { - t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v) - } - } - - getSS, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("got an error from GetStringSlice():", err) - } - for i, v := range getSS { - if vals[i] != v { - t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v) - } - } -} - -func TestSSWithDefault(t *testing.T) { - var ss []string - f := setUpSSFlagSetWithDefault(&ss) - - vals := []string{"one", "two", "4", "3"} - arg := fmt.Sprintf("--ss=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range ss { - if vals[i] != v { - t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v) - } - } - - getSS, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("got an error from GetStringSlice():", err) - } - for i, v := range getSS { - if vals[i] != v { - t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v) - } - } -} - -func TestSSCalledTwice(t *testing.T) { - var ss []string - f := setUpSSFlagSet(&ss) - - in := []string{"one,two", "three"} - expected := []string{"one", "two", "three"} - argfmt := "--ss=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(ss) { - t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) - } - for i, v := range ss { - if expected[i] != v { - t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) - } - } - - values, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(values) { - t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(ss)) - } - for i, v := range values { - if expected[i] != v { - t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) - } - } -} - -func TestSSWithComma(t *testing.T) { - var ss []string - f := setUpSSFlagSet(&ss) - - in := []string{`"one,two"`, `"three"`, `"four,five",six`} - expected := []string{"one,two", "three", "four,five", "six"} - argfmt := "--ss=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - arg3 := fmt.Sprintf(argfmt, in[2]) - err := f.Parse([]string{arg1, arg2, arg3}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(ss) { - t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) - } - for i, v := range ss { - if expected[i] != v { - t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) - } - } - - values, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(values) { - t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) - } - for i, v := range values { - if expected[i] != v { - t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) - } - } -} - -func TestSSWithSquareBrackets(t *testing.T) { - var ss []string - f := setUpSSFlagSet(&ss) - - in := []string{`"[a-z]"`, `"[a-z]+"`} - expected := []string{"[a-z]", "[a-z]+"} - argfmt := "--ss=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(ss) { - t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) - } - for i, v := range ss { - if expected[i] != v { - t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) - } - } - - values, err := f.GetStringSlice("ss") - if err != nil { - t.Fatal("expected no error; got", err) - } - - if len(expected) != len(values) { - t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) - } - for i, v := range values { - if expected[i] != v { - t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) - } - } -} +// 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 pflag + +import ( + "fmt" + "strings" + "testing" +) + +func setUpSSFlagSet(ssp *[]string) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.StringSliceVar(ssp, "ss", []string{}, "Command separated list!") + return f +} + +func setUpSSFlagSetWithDefault(ssp *[]string) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.StringSliceVar(ssp, "ss", []string{"default", "values"}, "Command separated list!") + return f +} + +func TestEmptySS(t *testing.T) { + var ss []string + f := setUpSSFlagSet(&ss) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getSS, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("got an error from GetStringSlice():", err) + } + if len(getSS) != 0 { + t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS)) + } +} + +func TestEmptySSValue(t *testing.T) { + var ss []string + f := setUpSSFlagSet(&ss) + err := f.Parse([]string{"--ss="}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getSS, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("got an error from GetStringSlice():", err) + } + if len(getSS) != 0 { + t.Fatalf("got ss %v with len=%d but expected length=0", getSS, len(getSS)) + } +} + +func TestSS(t *testing.T) { + var ss []string + f := setUpSSFlagSet(&ss) + + vals := []string{"one", "two", "4", "3"} + arg := fmt.Sprintf("--ss=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ss { + if vals[i] != v { + t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v) + } + } + + getSS, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("got an error from GetStringSlice():", err) + } + for i, v := range getSS { + if vals[i] != v { + t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v) + } + } +} + +func TestSSDefault(t *testing.T) { + var ss []string + f := setUpSSFlagSetWithDefault(&ss) + + vals := []string{"default", "values"} + + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ss { + if vals[i] != v { + t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v) + } + } + + getSS, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("got an error from GetStringSlice():", err) + } + for i, v := range getSS { + if vals[i] != v { + t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v) + } + } +} + +func TestSSWithDefault(t *testing.T) { + var ss []string + f := setUpSSFlagSetWithDefault(&ss) + + vals := []string{"one", "two", "4", "3"} + arg := fmt.Sprintf("--ss=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range ss { + if vals[i] != v { + t.Fatalf("expected ss[%d] to be %s but got: %s", i, vals[i], v) + } + } + + getSS, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("got an error from GetStringSlice():", err) + } + for i, v := range getSS { + if vals[i] != v { + t.Fatalf("expected ss[%d] to be %s from GetStringSlice but got: %s", i, vals[i], v) + } + } +} + +func TestSSCalledTwice(t *testing.T) { + var ss []string + f := setUpSSFlagSet(&ss) + + in := []string{"one,two", "three"} + expected := []string{"one", "two", "three"} + argfmt := "--ss=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(ss) { + t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) + } + for i, v := range ss { + if expected[i] != v { + t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) + } + } + + values, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(values) { + t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(ss)) + } + for i, v := range values { + if expected[i] != v { + t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) + } + } +} + +func TestSSWithComma(t *testing.T) { + var ss []string + f := setUpSSFlagSet(&ss) + + in := []string{`"one,two"`, `"three"`, `"four,five",six`} + expected := []string{"one,two", "three", "four,five", "six"} + argfmt := "--ss=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + arg3 := fmt.Sprintf(argfmt, in[2]) + err := f.Parse([]string{arg1, arg2, arg3}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(ss) { + t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) + } + for i, v := range ss { + if expected[i] != v { + t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) + } + } + + values, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(values) { + t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) + } + for i, v := range values { + if expected[i] != v { + t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) + } + } +} + +func TestSSWithSquareBrackets(t *testing.T) { + var ss []string + f := setUpSSFlagSet(&ss) + + in := []string{`"[a-z]"`, `"[a-z]+"`} + expected := []string{"[a-z]", "[a-z]+"} + argfmt := "--ss=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(ss) { + t.Fatalf("expected number of ss to be %d but got: %d", len(expected), len(ss)) + } + for i, v := range ss { + if expected[i] != v { + t.Fatalf("expected ss[%d] to be %s but got: %s", i, expected[i], v) + } + } + + values, err := f.GetStringSlice("ss") + if err != nil { + t.Fatal("expected no error; got", err) + } + + if len(expected) != len(values) { + t.Fatalf("expected number of values to be %d but got: %d", len(expected), len(values)) + } + for i, v := range values { + if expected[i] != v { + t.Fatalf("expected got ss[%d] to be %s but got: %s", i, expected[i], v) + } + } +} diff --git a/vendor/github.com/spf13/pflag/uint.go b/vendor/github.com/spf13/pflag/uint.go index 82dc6412bd..dcbc2b758c 100644 --- a/vendor/github.com/spf13/pflag/uint.go +++ b/vendor/github.com/spf13/pflag/uint.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- uint Value -type uintValue uint - -func newUintValue(val uint, p *uint) *uintValue { - *p = val - return (*uintValue)(p) -} - -func (i *uintValue) Set(s string) error { - v, err := strconv.ParseUint(s, 0, 64) - *i = uintValue(v) - return err -} - -func (i *uintValue) Type() string { - return "uint" -} - -func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) } - -func uintConv(sval string) (interface{}, error) { - v, err := strconv.ParseUint(sval, 0, 0) - if err != nil { - return 0, err - } - return uint(v), nil -} - -// GetUint return the uint value of a flag with the given name -func (f *FlagSet) GetUint(name string) (uint, error) { - val, err := f.getFlagType(name, "uint", uintConv) - if err != nil { - return 0, err - } - return val.(uint), nil -} - -// UintVar defines a uint flag with specified name, default value, and usage string. -// The argument p points to a uint variable in which to store the value of the flag. -func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) { - f.VarP(newUintValue(value, p), name, "", usage) -} - -// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) { - f.VarP(newUintValue(value, p), name, shorthand, usage) -} - -// UintVar defines a uint flag with specified name, default value, and usage string. -// The argument p points to a uint variable in which to store the value of the flag. -func UintVar(p *uint, name string, value uint, usage string) { - CommandLine.VarP(newUintValue(value, p), name, "", usage) -} - -// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. -func UintVarP(p *uint, name, shorthand string, value uint, usage string) { - CommandLine.VarP(newUintValue(value, p), name, shorthand, usage) -} - -// Uint defines a uint flag with specified name, default value, and usage string. -// The return value is the address of a uint variable that stores the value of the flag. -func (f *FlagSet) Uint(name string, value uint, usage string) *uint { - p := new(uint) - f.UintVarP(p, name, "", value, usage) - return p -} - -// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint { - p := new(uint) - f.UintVarP(p, name, shorthand, value, usage) - return p -} - -// Uint defines a uint flag with specified name, default value, and usage string. -// The return value is the address of a uint variable that stores the value of the flag. -func Uint(name string, value uint, usage string) *uint { - return CommandLine.UintP(name, "", value, usage) -} - -// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. -func UintP(name, shorthand string, value uint, usage string) *uint { - return CommandLine.UintP(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- uint Value +type uintValue uint + +func newUintValue(val uint, p *uint) *uintValue { + *p = val + return (*uintValue)(p) +} + +func (i *uintValue) Set(s string) error { + v, err := strconv.ParseUint(s, 0, 64) + *i = uintValue(v) + return err +} + +func (i *uintValue) Type() string { + return "uint" +} + +func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) } + +func uintConv(sval string) (interface{}, error) { + v, err := strconv.ParseUint(sval, 0, 0) + if err != nil { + return 0, err + } + return uint(v), nil +} + +// GetUint return the uint value of a flag with the given name +func (f *FlagSet) GetUint(name string) (uint, error) { + val, err := f.getFlagType(name, "uint", uintConv) + if err != nil { + return 0, err + } + return val.(uint), nil +} + +// UintVar defines a uint flag with specified name, default value, and usage string. +// The argument p points to a uint variable in which to store the value of the flag. +func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) { + f.VarP(newUintValue(value, p), name, "", usage) +} + +// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) { + f.VarP(newUintValue(value, p), name, shorthand, usage) +} + +// UintVar defines a uint flag with specified name, default value, and usage string. +// The argument p points to a uint variable in which to store the value of the flag. +func UintVar(p *uint, name string, value uint, usage string) { + CommandLine.VarP(newUintValue(value, p), name, "", usage) +} + +// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash. +func UintVarP(p *uint, name, shorthand string, value uint, usage string) { + CommandLine.VarP(newUintValue(value, p), name, shorthand, usage) +} + +// Uint defines a uint flag with specified name, default value, and usage string. +// The return value is the address of a uint variable that stores the value of the flag. +func (f *FlagSet) Uint(name string, value uint, usage string) *uint { + p := new(uint) + f.UintVarP(p, name, "", value, usage) + return p +} + +// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint { + p := new(uint) + f.UintVarP(p, name, shorthand, value, usage) + return p +} + +// Uint defines a uint flag with specified name, default value, and usage string. +// The return value is the address of a uint variable that stores the value of the flag. +func Uint(name string, value uint, usage string) *uint { + return CommandLine.UintP(name, "", value, usage) +} + +// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash. +func UintP(name, shorthand string, value uint, usage string) *uint { + return CommandLine.UintP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint16.go b/vendor/github.com/spf13/pflag/uint16.go index badac3df58..7e9914eddd 100644 --- a/vendor/github.com/spf13/pflag/uint16.go +++ b/vendor/github.com/spf13/pflag/uint16.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- uint16 value -type uint16Value uint16 - -func newUint16Value(val uint16, p *uint16) *uint16Value { - *p = val - return (*uint16Value)(p) -} - -func (i *uint16Value) Set(s string) error { - v, err := strconv.ParseUint(s, 0, 16) - *i = uint16Value(v) - return err -} - -func (i *uint16Value) Type() string { - return "uint16" -} - -func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) } - -func uint16Conv(sval string) (interface{}, error) { - v, err := strconv.ParseUint(sval, 0, 16) - if err != nil { - return 0, err - } - return uint16(v), nil -} - -// GetUint16 return the uint16 value of a flag with the given name -func (f *FlagSet) GetUint16(name string) (uint16, error) { - val, err := f.getFlagType(name, "uint16", uint16Conv) - if err != nil { - return 0, err - } - return val.(uint16), nil -} - -// Uint16Var defines a uint flag with specified name, default value, and usage string. -// The argument p points to a uint variable in which to store the value of the flag. -func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) { - f.VarP(newUint16Value(value, p), name, "", usage) -} - -// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { - f.VarP(newUint16Value(value, p), name, shorthand, usage) -} - -// Uint16Var defines a uint flag with specified name, default value, and usage string. -// The argument p points to a uint variable in which to store the value of the flag. -func Uint16Var(p *uint16, name string, value uint16, usage string) { - CommandLine.VarP(newUint16Value(value, p), name, "", usage) -} - -// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. -func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { - CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage) -} - -// Uint16 defines a uint flag with specified name, default value, and usage string. -// The return value is the address of a uint variable that stores the value of the flag. -func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 { - p := new(uint16) - f.Uint16VarP(p, name, "", value, usage) - return p -} - -// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 { - p := new(uint16) - f.Uint16VarP(p, name, shorthand, value, usage) - return p -} - -// Uint16 defines a uint flag with specified name, default value, and usage string. -// The return value is the address of a uint variable that stores the value of the flag. -func Uint16(name string, value uint16, usage string) *uint16 { - return CommandLine.Uint16P(name, "", value, usage) -} - -// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. -func Uint16P(name, shorthand string, value uint16, usage string) *uint16 { - return CommandLine.Uint16P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- uint16 value +type uint16Value uint16 + +func newUint16Value(val uint16, p *uint16) *uint16Value { + *p = val + return (*uint16Value)(p) +} + +func (i *uint16Value) Set(s string) error { + v, err := strconv.ParseUint(s, 0, 16) + *i = uint16Value(v) + return err +} + +func (i *uint16Value) Type() string { + return "uint16" +} + +func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) } + +func uint16Conv(sval string) (interface{}, error) { + v, err := strconv.ParseUint(sval, 0, 16) + if err != nil { + return 0, err + } + return uint16(v), nil +} + +// GetUint16 return the uint16 value of a flag with the given name +func (f *FlagSet) GetUint16(name string) (uint16, error) { + val, err := f.getFlagType(name, "uint16", uint16Conv) + if err != nil { + return 0, err + } + return val.(uint16), nil +} + +// Uint16Var defines a uint flag with specified name, default value, and usage string. +// The argument p points to a uint variable in which to store the value of the flag. +func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) { + f.VarP(newUint16Value(value, p), name, "", usage) +} + +// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { + f.VarP(newUint16Value(value, p), name, shorthand, usage) +} + +// Uint16Var defines a uint flag with specified name, default value, and usage string. +// The argument p points to a uint variable in which to store the value of the flag. +func Uint16Var(p *uint16, name string, value uint16, usage string) { + CommandLine.VarP(newUint16Value(value, p), name, "", usage) +} + +// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash. +func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { + CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage) +} + +// Uint16 defines a uint flag with specified name, default value, and usage string. +// The return value is the address of a uint variable that stores the value of the flag. +func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 { + p := new(uint16) + f.Uint16VarP(p, name, "", value, usage) + return p +} + +// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 { + p := new(uint16) + f.Uint16VarP(p, name, shorthand, value, usage) + return p +} + +// Uint16 defines a uint flag with specified name, default value, and usage string. +// The return value is the address of a uint variable that stores the value of the flag. +func Uint16(name string, value uint16, usage string) *uint16 { + return CommandLine.Uint16P(name, "", value, usage) +} + +// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash. +func Uint16P(name, shorthand string, value uint16, usage string) *uint16 { + return CommandLine.Uint16P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint32.go b/vendor/github.com/spf13/pflag/uint32.go index 109904e66d..d8024539bf 100644 --- a/vendor/github.com/spf13/pflag/uint32.go +++ b/vendor/github.com/spf13/pflag/uint32.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- uint32 value -type uint32Value uint32 - -func newUint32Value(val uint32, p *uint32) *uint32Value { - *p = val - return (*uint32Value)(p) -} - -func (i *uint32Value) Set(s string) error { - v, err := strconv.ParseUint(s, 0, 32) - *i = uint32Value(v) - return err -} - -func (i *uint32Value) Type() string { - return "uint32" -} - -func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) } - -func uint32Conv(sval string) (interface{}, error) { - v, err := strconv.ParseUint(sval, 0, 32) - if err != nil { - return 0, err - } - return uint32(v), nil -} - -// GetUint32 return the uint32 value of a flag with the given name -func (f *FlagSet) GetUint32(name string) (uint32, error) { - val, err := f.getFlagType(name, "uint32", uint32Conv) - if err != nil { - return 0, err - } - return val.(uint32), nil -} - -// Uint32Var defines a uint32 flag with specified name, default value, and usage string. -// The argument p points to a uint32 variable in which to store the value of the flag. -func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) { - f.VarP(newUint32Value(value, p), name, "", usage) -} - -// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { - f.VarP(newUint32Value(value, p), name, shorthand, usage) -} - -// Uint32Var defines a uint32 flag with specified name, default value, and usage string. -// The argument p points to a uint32 variable in which to store the value of the flag. -func Uint32Var(p *uint32, name string, value uint32, usage string) { - CommandLine.VarP(newUint32Value(value, p), name, "", usage) -} - -// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. -func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { - CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage) -} - -// Uint32 defines a uint32 flag with specified name, default value, and usage string. -// The return value is the address of a uint32 variable that stores the value of the flag. -func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 { - p := new(uint32) - f.Uint32VarP(p, name, "", value, usage) - return p -} - -// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 { - p := new(uint32) - f.Uint32VarP(p, name, shorthand, value, usage) - return p -} - -// Uint32 defines a uint32 flag with specified name, default value, and usage string. -// The return value is the address of a uint32 variable that stores the value of the flag. -func Uint32(name string, value uint32, usage string) *uint32 { - return CommandLine.Uint32P(name, "", value, usage) -} - -// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. -func Uint32P(name, shorthand string, value uint32, usage string) *uint32 { - return CommandLine.Uint32P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- uint32 value +type uint32Value uint32 + +func newUint32Value(val uint32, p *uint32) *uint32Value { + *p = val + return (*uint32Value)(p) +} + +func (i *uint32Value) Set(s string) error { + v, err := strconv.ParseUint(s, 0, 32) + *i = uint32Value(v) + return err +} + +func (i *uint32Value) Type() string { + return "uint32" +} + +func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) } + +func uint32Conv(sval string) (interface{}, error) { + v, err := strconv.ParseUint(sval, 0, 32) + if err != nil { + return 0, err + } + return uint32(v), nil +} + +// GetUint32 return the uint32 value of a flag with the given name +func (f *FlagSet) GetUint32(name string) (uint32, error) { + val, err := f.getFlagType(name, "uint32", uint32Conv) + if err != nil { + return 0, err + } + return val.(uint32), nil +} + +// Uint32Var defines a uint32 flag with specified name, default value, and usage string. +// The argument p points to a uint32 variable in which to store the value of the flag. +func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) { + f.VarP(newUint32Value(value, p), name, "", usage) +} + +// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { + f.VarP(newUint32Value(value, p), name, shorthand, usage) +} + +// Uint32Var defines a uint32 flag with specified name, default value, and usage string. +// The argument p points to a uint32 variable in which to store the value of the flag. +func Uint32Var(p *uint32, name string, value uint32, usage string) { + CommandLine.VarP(newUint32Value(value, p), name, "", usage) +} + +// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash. +func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) { + CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage) +} + +// Uint32 defines a uint32 flag with specified name, default value, and usage string. +// The return value is the address of a uint32 variable that stores the value of the flag. +func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 { + p := new(uint32) + f.Uint32VarP(p, name, "", value, usage) + return p +} + +// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 { + p := new(uint32) + f.Uint32VarP(p, name, shorthand, value, usage) + return p +} + +// Uint32 defines a uint32 flag with specified name, default value, and usage string. +// The return value is the address of a uint32 variable that stores the value of the flag. +func Uint32(name string, value uint32, usage string) *uint32 { + return CommandLine.Uint32P(name, "", value, usage) +} + +// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash. +func Uint32P(name, shorthand string, value uint32, usage string) *uint32 { + return CommandLine.Uint32P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint64.go b/vendor/github.com/spf13/pflag/uint64.go index 78c550dc4c..f62240f2ce 100644 --- a/vendor/github.com/spf13/pflag/uint64.go +++ b/vendor/github.com/spf13/pflag/uint64.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- uint64 Value -type uint64Value uint64 - -func newUint64Value(val uint64, p *uint64) *uint64Value { - *p = val - return (*uint64Value)(p) -} - -func (i *uint64Value) Set(s string) error { - v, err := strconv.ParseUint(s, 0, 64) - *i = uint64Value(v) - return err -} - -func (i *uint64Value) Type() string { - return "uint64" -} - -func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) } - -func uint64Conv(sval string) (interface{}, error) { - v, err := strconv.ParseUint(sval, 0, 64) - if err != nil { - return 0, err - } - return uint64(v), nil -} - -// GetUint64 return the uint64 value of a flag with the given name -func (f *FlagSet) GetUint64(name string) (uint64, error) { - val, err := f.getFlagType(name, "uint64", uint64Conv) - if err != nil { - return 0, err - } - return val.(uint64), nil -} - -// Uint64Var defines a uint64 flag with specified name, default value, and usage string. -// The argument p points to a uint64 variable in which to store the value of the flag. -func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) { - f.VarP(newUint64Value(value, p), name, "", usage) -} - -// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { - f.VarP(newUint64Value(value, p), name, shorthand, usage) -} - -// Uint64Var defines a uint64 flag with specified name, default value, and usage string. -// The argument p points to a uint64 variable in which to store the value of the flag. -func Uint64Var(p *uint64, name string, value uint64, usage string) { - CommandLine.VarP(newUint64Value(value, p), name, "", usage) -} - -// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. -func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { - CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage) -} - -// Uint64 defines a uint64 flag with specified name, default value, and usage string. -// The return value is the address of a uint64 variable that stores the value of the flag. -func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 { - p := new(uint64) - f.Uint64VarP(p, name, "", value, usage) - return p -} - -// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 { - p := new(uint64) - f.Uint64VarP(p, name, shorthand, value, usage) - return p -} - -// Uint64 defines a uint64 flag with specified name, default value, and usage string. -// The return value is the address of a uint64 variable that stores the value of the flag. -func Uint64(name string, value uint64, usage string) *uint64 { - return CommandLine.Uint64P(name, "", value, usage) -} - -// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. -func Uint64P(name, shorthand string, value uint64, usage string) *uint64 { - return CommandLine.Uint64P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- uint64 Value +type uint64Value uint64 + +func newUint64Value(val uint64, p *uint64) *uint64Value { + *p = val + return (*uint64Value)(p) +} + +func (i *uint64Value) Set(s string) error { + v, err := strconv.ParseUint(s, 0, 64) + *i = uint64Value(v) + return err +} + +func (i *uint64Value) Type() string { + return "uint64" +} + +func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) } + +func uint64Conv(sval string) (interface{}, error) { + v, err := strconv.ParseUint(sval, 0, 64) + if err != nil { + return 0, err + } + return uint64(v), nil +} + +// GetUint64 return the uint64 value of a flag with the given name +func (f *FlagSet) GetUint64(name string) (uint64, error) { + val, err := f.getFlagType(name, "uint64", uint64Conv) + if err != nil { + return 0, err + } + return val.(uint64), nil +} + +// Uint64Var defines a uint64 flag with specified name, default value, and usage string. +// The argument p points to a uint64 variable in which to store the value of the flag. +func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) { + f.VarP(newUint64Value(value, p), name, "", usage) +} + +// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { + f.VarP(newUint64Value(value, p), name, shorthand, usage) +} + +// Uint64Var defines a uint64 flag with specified name, default value, and usage string. +// The argument p points to a uint64 variable in which to store the value of the flag. +func Uint64Var(p *uint64, name string, value uint64, usage string) { + CommandLine.VarP(newUint64Value(value, p), name, "", usage) +} + +// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash. +func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) { + CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage) +} + +// Uint64 defines a uint64 flag with specified name, default value, and usage string. +// The return value is the address of a uint64 variable that stores the value of the flag. +func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 { + p := new(uint64) + f.Uint64VarP(p, name, "", value, usage) + return p +} + +// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 { + p := new(uint64) + f.Uint64VarP(p, name, shorthand, value, usage) + return p +} + +// Uint64 defines a uint64 flag with specified name, default value, and usage string. +// The return value is the address of a uint64 variable that stores the value of the flag. +func Uint64(name string, value uint64, usage string) *uint64 { + return CommandLine.Uint64P(name, "", value, usage) +} + +// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash. +func Uint64P(name, shorthand string, value uint64, usage string) *uint64 { + return CommandLine.Uint64P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint8.go b/vendor/github.com/spf13/pflag/uint8.go index 00ca3c2c80..bb0e83c1f6 100644 --- a/vendor/github.com/spf13/pflag/uint8.go +++ b/vendor/github.com/spf13/pflag/uint8.go @@ -1,88 +1,88 @@ -package pflag - -import "strconv" - -// -- uint8 Value -type uint8Value uint8 - -func newUint8Value(val uint8, p *uint8) *uint8Value { - *p = val - return (*uint8Value)(p) -} - -func (i *uint8Value) Set(s string) error { - v, err := strconv.ParseUint(s, 0, 8) - *i = uint8Value(v) - return err -} - -func (i *uint8Value) Type() string { - return "uint8" -} - -func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) } - -func uint8Conv(sval string) (interface{}, error) { - v, err := strconv.ParseUint(sval, 0, 8) - if err != nil { - return 0, err - } - return uint8(v), nil -} - -// GetUint8 return the uint8 value of a flag with the given name -func (f *FlagSet) GetUint8(name string) (uint8, error) { - val, err := f.getFlagType(name, "uint8", uint8Conv) - if err != nil { - return 0, err - } - return val.(uint8), nil -} - -// Uint8Var defines a uint8 flag with specified name, default value, and usage string. -// The argument p points to a uint8 variable in which to store the value of the flag. -func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) { - f.VarP(newUint8Value(value, p), name, "", usage) -} - -// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { - f.VarP(newUint8Value(value, p), name, shorthand, usage) -} - -// Uint8Var defines a uint8 flag with specified name, default value, and usage string. -// The argument p points to a uint8 variable in which to store the value of the flag. -func Uint8Var(p *uint8, name string, value uint8, usage string) { - CommandLine.VarP(newUint8Value(value, p), name, "", usage) -} - -// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. -func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { - CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage) -} - -// Uint8 defines a uint8 flag with specified name, default value, and usage string. -// The return value is the address of a uint8 variable that stores the value of the flag. -func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 { - p := new(uint8) - f.Uint8VarP(p, name, "", value, usage) - return p -} - -// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 { - p := new(uint8) - f.Uint8VarP(p, name, shorthand, value, usage) - return p -} - -// Uint8 defines a uint8 flag with specified name, default value, and usage string. -// The return value is the address of a uint8 variable that stores the value of the flag. -func Uint8(name string, value uint8, usage string) *uint8 { - return CommandLine.Uint8P(name, "", value, usage) -} - -// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. -func Uint8P(name, shorthand string, value uint8, usage string) *uint8 { - return CommandLine.Uint8P(name, shorthand, value, usage) -} +package pflag + +import "strconv" + +// -- uint8 Value +type uint8Value uint8 + +func newUint8Value(val uint8, p *uint8) *uint8Value { + *p = val + return (*uint8Value)(p) +} + +func (i *uint8Value) Set(s string) error { + v, err := strconv.ParseUint(s, 0, 8) + *i = uint8Value(v) + return err +} + +func (i *uint8Value) Type() string { + return "uint8" +} + +func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) } + +func uint8Conv(sval string) (interface{}, error) { + v, err := strconv.ParseUint(sval, 0, 8) + if err != nil { + return 0, err + } + return uint8(v), nil +} + +// GetUint8 return the uint8 value of a flag with the given name +func (f *FlagSet) GetUint8(name string) (uint8, error) { + val, err := f.getFlagType(name, "uint8", uint8Conv) + if err != nil { + return 0, err + } + return val.(uint8), nil +} + +// Uint8Var defines a uint8 flag with specified name, default value, and usage string. +// The argument p points to a uint8 variable in which to store the value of the flag. +func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) { + f.VarP(newUint8Value(value, p), name, "", usage) +} + +// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { + f.VarP(newUint8Value(value, p), name, shorthand, usage) +} + +// Uint8Var defines a uint8 flag with specified name, default value, and usage string. +// The argument p points to a uint8 variable in which to store the value of the flag. +func Uint8Var(p *uint8, name string, value uint8, usage string) { + CommandLine.VarP(newUint8Value(value, p), name, "", usage) +} + +// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash. +func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) { + CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage) +} + +// Uint8 defines a uint8 flag with specified name, default value, and usage string. +// The return value is the address of a uint8 variable that stores the value of the flag. +func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 { + p := new(uint8) + f.Uint8VarP(p, name, "", value, usage) + return p +} + +// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 { + p := new(uint8) + f.Uint8VarP(p, name, shorthand, value, usage) + return p +} + +// Uint8 defines a uint8 flag with specified name, default value, and usage string. +// The return value is the address of a uint8 variable that stores the value of the flag. +func Uint8(name string, value uint8, usage string) *uint8 { + return CommandLine.Uint8P(name, "", value, usage) +} + +// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash. +func Uint8P(name, shorthand string, value uint8, usage string) *uint8 { + return CommandLine.Uint8P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint_slice.go b/vendor/github.com/spf13/pflag/uint_slice.go index ac0f09f0a7..edd94c600a 100644 --- a/vendor/github.com/spf13/pflag/uint_slice.go +++ b/vendor/github.com/spf13/pflag/uint_slice.go @@ -1,126 +1,126 @@ -package pflag - -import ( - "fmt" - "strconv" - "strings" -) - -// -- uintSlice Value -type uintSliceValue struct { - value *[]uint - changed bool -} - -func newUintSliceValue(val []uint, p *[]uint) *uintSliceValue { - uisv := new(uintSliceValue) - uisv.value = p - *uisv.value = val - return uisv -} - -func (s *uintSliceValue) Set(val string) error { - ss := strings.Split(val, ",") - out := make([]uint, len(ss)) - for i, d := range ss { - u, err := strconv.ParseUint(d, 10, 0) - if err != nil { - return err - } - out[i] = uint(u) - } - if !s.changed { - *s.value = out - } else { - *s.value = append(*s.value, out...) - } - s.changed = true - return nil -} - -func (s *uintSliceValue) Type() string { - return "uintSlice" -} - -func (s *uintSliceValue) String() string { - out := make([]string, len(*s.value)) - for i, d := range *s.value { - out[i] = fmt.Sprintf("%d", d) - } - return "[" + strings.Join(out, ",") + "]" -} - -func uintSliceConv(val string) (interface{}, error) { - val = strings.Trim(val, "[]") - // Empty string would cause a slice with one (empty) entry - if len(val) == 0 { - return []uint{}, nil - } - ss := strings.Split(val, ",") - out := make([]uint, len(ss)) - for i, d := range ss { - u, err := strconv.ParseUint(d, 10, 0) - if err != nil { - return nil, err - } - out[i] = uint(u) - } - return out, nil -} - -// GetUintSlice returns the []uint value of a flag with the given name. -func (f *FlagSet) GetUintSlice(name string) ([]uint, error) { - val, err := f.getFlagType(name, "uintSlice", uintSliceConv) - if err != nil { - return []uint{}, err - } - return val.([]uint), nil -} - -// UintSliceVar defines a uintSlice flag with specified name, default value, and usage string. -// The argument p points to a []uint variable in which to store the value of the flag. -func (f *FlagSet) UintSliceVar(p *[]uint, name string, value []uint, usage string) { - f.VarP(newUintSliceValue(value, p), name, "", usage) -} - -// UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) { - f.VarP(newUintSliceValue(value, p), name, shorthand, usage) -} - -// UintSliceVar defines a uint[] flag with specified name, default value, and usage string. -// The argument p points to a uint[] variable in which to store the value of the flag. -func UintSliceVar(p *[]uint, name string, value []uint, usage string) { - CommandLine.VarP(newUintSliceValue(value, p), name, "", usage) -} - -// UintSliceVarP is like the UintSliceVar, but accepts a shorthand letter that can be used after a single dash. -func UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) { - CommandLine.VarP(newUintSliceValue(value, p), name, shorthand, usage) -} - -// UintSlice defines a []uint flag with specified name, default value, and usage string. -// The return value is the address of a []uint variable that stores the value of the flag. -func (f *FlagSet) UintSlice(name string, value []uint, usage string) *[]uint { - p := []uint{} - f.UintSliceVarP(&p, name, "", value, usage) - return &p -} - -// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash. -func (f *FlagSet) UintSliceP(name, shorthand string, value []uint, usage string) *[]uint { - p := []uint{} - f.UintSliceVarP(&p, name, shorthand, value, usage) - return &p -} - -// UintSlice defines a []uint flag with specified name, default value, and usage string. -// The return value is the address of a []uint variable that stores the value of the flag. -func UintSlice(name string, value []uint, usage string) *[]uint { - return CommandLine.UintSliceP(name, "", value, usage) -} - -// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash. -func UintSliceP(name, shorthand string, value []uint, usage string) *[]uint { - return CommandLine.UintSliceP(name, shorthand, value, usage) -} +package pflag + +import ( + "fmt" + "strconv" + "strings" +) + +// -- uintSlice Value +type uintSliceValue struct { + value *[]uint + changed bool +} + +func newUintSliceValue(val []uint, p *[]uint) *uintSliceValue { + uisv := new(uintSliceValue) + uisv.value = p + *uisv.value = val + return uisv +} + +func (s *uintSliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]uint, len(ss)) + for i, d := range ss { + u, err := strconv.ParseUint(d, 10, 0) + if err != nil { + return err + } + out[i] = uint(u) + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *uintSliceValue) Type() string { + return "uintSlice" +} + +func (s *uintSliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%d", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func uintSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []uint{}, nil + } + ss := strings.Split(val, ",") + out := make([]uint, len(ss)) + for i, d := range ss { + u, err := strconv.ParseUint(d, 10, 0) + if err != nil { + return nil, err + } + out[i] = uint(u) + } + return out, nil +} + +// GetUintSlice returns the []uint value of a flag with the given name. +func (f *FlagSet) GetUintSlice(name string) ([]uint, error) { + val, err := f.getFlagType(name, "uintSlice", uintSliceConv) + if err != nil { + return []uint{}, err + } + return val.([]uint), nil +} + +// UintSliceVar defines a uintSlice flag with specified name, default value, and usage string. +// The argument p points to a []uint variable in which to store the value of the flag. +func (f *FlagSet) UintSliceVar(p *[]uint, name string, value []uint, usage string) { + f.VarP(newUintSliceValue(value, p), name, "", usage) +} + +// UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) { + f.VarP(newUintSliceValue(value, p), name, shorthand, usage) +} + +// UintSliceVar defines a uint[] flag with specified name, default value, and usage string. +// The argument p points to a uint[] variable in which to store the value of the flag. +func UintSliceVar(p *[]uint, name string, value []uint, usage string) { + CommandLine.VarP(newUintSliceValue(value, p), name, "", usage) +} + +// UintSliceVarP is like the UintSliceVar, but accepts a shorthand letter that can be used after a single dash. +func UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) { + CommandLine.VarP(newUintSliceValue(value, p), name, shorthand, usage) +} + +// UintSlice defines a []uint flag with specified name, default value, and usage string. +// The return value is the address of a []uint variable that stores the value of the flag. +func (f *FlagSet) UintSlice(name string, value []uint, usage string) *[]uint { + p := []uint{} + f.UintSliceVarP(&p, name, "", value, usage) + return &p +} + +// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) UintSliceP(name, shorthand string, value []uint, usage string) *[]uint { + p := []uint{} + f.UintSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// UintSlice defines a []uint flag with specified name, default value, and usage string. +// The return value is the address of a []uint variable that stores the value of the flag. +func UintSlice(name string, value []uint, usage string) *[]uint { + return CommandLine.UintSliceP(name, "", value, usage) +} + +// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash. +func UintSliceP(name, shorthand string, value []uint, usage string) *[]uint { + return CommandLine.UintSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint_slice_test.go b/vendor/github.com/spf13/pflag/uint_slice_test.go index 278fdaff1f..db1a19dc2d 100644 --- a/vendor/github.com/spf13/pflag/uint_slice_test.go +++ b/vendor/github.com/spf13/pflag/uint_slice_test.go @@ -1,161 +1,161 @@ -package pflag - -import ( - "fmt" - "strconv" - "strings" - "testing" -) - -func setUpUISFlagSet(uisp *[]uint) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.UintSliceVar(uisp, "uis", []uint{}, "Command separated list!") - return f -} - -func setUpUISFlagSetWithDefault(uisp *[]uint) *FlagSet { - f := NewFlagSet("test", ContinueOnError) - f.UintSliceVar(uisp, "uis", []uint{0, 1}, "Command separated list!") - return f -} - -func TestEmptyUIS(t *testing.T) { - var uis []uint - f := setUpUISFlagSet(&uis) - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - - getUIS, err := f.GetUintSlice("uis") - if err != nil { - t.Fatal("got an error from GetUintSlice():", err) - } - if len(getUIS) != 0 { - t.Fatalf("got is %v with len=%d but expected length=0", getUIS, len(getUIS)) - } -} - -func TestUIS(t *testing.T) { - var uis []uint - f := setUpUISFlagSet(&uis) - - vals := []string{"1", "2", "4", "3"} - arg := fmt.Sprintf("--uis=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range uis { - u, err := strconv.ParseUint(vals[i], 10, 0) - if err != nil { - t.Fatalf("got error: %v", err) - } - if uint(u) != v { - t.Fatalf("expected uis[%d] to be %s but got %d", i, vals[i], v) - } - } - getUIS, err := f.GetUintSlice("uis") - if err != nil { - t.Fatalf("got error: %v", err) - } - for i, v := range getUIS { - u, err := strconv.ParseUint(vals[i], 10, 0) - if err != nil { - t.Fatalf("got error: %v", err) - } - if uint(u) != v { - t.Fatalf("expected uis[%d] to be %s but got: %d from GetUintSlice", i, vals[i], v) - } - } -} - -func TestUISDefault(t *testing.T) { - var uis []uint - f := setUpUISFlagSetWithDefault(&uis) - - vals := []string{"0", "1"} - - err := f.Parse([]string{}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range uis { - u, err := strconv.ParseUint(vals[i], 10, 0) - if err != nil { - t.Fatalf("got error: %v", err) - } - if uint(u) != v { - t.Fatalf("expect uis[%d] to be %d but got: %d", i, u, v) - } - } - - getUIS, err := f.GetUintSlice("uis") - if err != nil { - t.Fatal("got an error from GetUintSlice():", err) - } - for i, v := range getUIS { - u, err := strconv.ParseUint(vals[i], 10, 0) - if err != nil { - t.Fatal("got an error from GetIntSlice():", err) - } - if uint(u) != v { - t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v) - } - } -} - -func TestUISWithDefault(t *testing.T) { - var uis []uint - f := setUpUISFlagSetWithDefault(&uis) - - vals := []string{"1", "2"} - arg := fmt.Sprintf("--uis=%s", strings.Join(vals, ",")) - err := f.Parse([]string{arg}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range uis { - u, err := strconv.ParseUint(vals[i], 10, 0) - if err != nil { - t.Fatalf("got error: %v", err) - } - if uint(u) != v { - t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v) - } - } - - getUIS, err := f.GetUintSlice("uis") - if err != nil { - t.Fatal("got an error from GetUintSlice():", err) - } - for i, v := range getUIS { - u, err := strconv.ParseUint(vals[i], 10, 0) - if err != nil { - t.Fatalf("got error: %v", err) - } - if uint(u) != v { - t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v) - } - } -} - -func TestUISCalledTwice(t *testing.T) { - var uis []uint - f := setUpUISFlagSet(&uis) - - in := []string{"1,2", "3"} - expected := []int{1, 2, 3} - argfmt := "--uis=%s" - arg1 := fmt.Sprintf(argfmt, in[0]) - arg2 := fmt.Sprintf(argfmt, in[1]) - err := f.Parse([]string{arg1, arg2}) - if err != nil { - t.Fatal("expected no error; got", err) - } - for i, v := range uis { - if uint(expected[i]) != v { - t.Fatalf("expected uis[%d] to be %d but got: %d", i, expected[i], v) - } - } -} +package pflag + +import ( + "fmt" + "strconv" + "strings" + "testing" +) + +func setUpUISFlagSet(uisp *[]uint) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.UintSliceVar(uisp, "uis", []uint{}, "Command separated list!") + return f +} + +func setUpUISFlagSetWithDefault(uisp *[]uint) *FlagSet { + f := NewFlagSet("test", ContinueOnError) + f.UintSliceVar(uisp, "uis", []uint{0, 1}, "Command separated list!") + return f +} + +func TestEmptyUIS(t *testing.T) { + var uis []uint + f := setUpUISFlagSet(&uis) + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + + getUIS, err := f.GetUintSlice("uis") + if err != nil { + t.Fatal("got an error from GetUintSlice():", err) + } + if len(getUIS) != 0 { + t.Fatalf("got is %v with len=%d but expected length=0", getUIS, len(getUIS)) + } +} + +func TestUIS(t *testing.T) { + var uis []uint + f := setUpUISFlagSet(&uis) + + vals := []string{"1", "2", "4", "3"} + arg := fmt.Sprintf("--uis=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range uis { + u, err := strconv.ParseUint(vals[i], 10, 0) + if err != nil { + t.Fatalf("got error: %v", err) + } + if uint(u) != v { + t.Fatalf("expected uis[%d] to be %s but got %d", i, vals[i], v) + } + } + getUIS, err := f.GetUintSlice("uis") + if err != nil { + t.Fatalf("got error: %v", err) + } + for i, v := range getUIS { + u, err := strconv.ParseUint(vals[i], 10, 0) + if err != nil { + t.Fatalf("got error: %v", err) + } + if uint(u) != v { + t.Fatalf("expected uis[%d] to be %s but got: %d from GetUintSlice", i, vals[i], v) + } + } +} + +func TestUISDefault(t *testing.T) { + var uis []uint + f := setUpUISFlagSetWithDefault(&uis) + + vals := []string{"0", "1"} + + err := f.Parse([]string{}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range uis { + u, err := strconv.ParseUint(vals[i], 10, 0) + if err != nil { + t.Fatalf("got error: %v", err) + } + if uint(u) != v { + t.Fatalf("expect uis[%d] to be %d but got: %d", i, u, v) + } + } + + getUIS, err := f.GetUintSlice("uis") + if err != nil { + t.Fatal("got an error from GetUintSlice():", err) + } + for i, v := range getUIS { + u, err := strconv.ParseUint(vals[i], 10, 0) + if err != nil { + t.Fatal("got an error from GetIntSlice():", err) + } + if uint(u) != v { + t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v) + } + } +} + +func TestUISWithDefault(t *testing.T) { + var uis []uint + f := setUpUISFlagSetWithDefault(&uis) + + vals := []string{"1", "2"} + arg := fmt.Sprintf("--uis=%s", strings.Join(vals, ",")) + err := f.Parse([]string{arg}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range uis { + u, err := strconv.ParseUint(vals[i], 10, 0) + if err != nil { + t.Fatalf("got error: %v", err) + } + if uint(u) != v { + t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v) + } + } + + getUIS, err := f.GetUintSlice("uis") + if err != nil { + t.Fatal("got an error from GetUintSlice():", err) + } + for i, v := range getUIS { + u, err := strconv.ParseUint(vals[i], 10, 0) + if err != nil { + t.Fatalf("got error: %v", err) + } + if uint(u) != v { + t.Fatalf("expected uis[%d] to be %d from GetUintSlice but got: %d", i, u, v) + } + } +} + +func TestUISCalledTwice(t *testing.T) { + var uis []uint + f := setUpUISFlagSet(&uis) + + in := []string{"1,2", "3"} + expected := []int{1, 2, 3} + argfmt := "--uis=%s" + arg1 := fmt.Sprintf(argfmt, in[0]) + arg2 := fmt.Sprintf(argfmt, in[1]) + err := f.Parse([]string{arg1, arg2}) + if err != nil { + t.Fatal("expected no error; got", err) + } + for i, v := range uis { + if uint(expected[i]) != v { + t.Fatalf("expected uis[%d] to be %d but got: %d", i, expected[i], v) + } + } +} diff --git a/vendor/github.com/spf13/pflag/verify/all.sh b/vendor/github.com/spf13/pflag/verify/all.sh index 0ea2978162..739f89c0b4 100644 --- a/vendor/github.com/spf13/pflag/verify/all.sh +++ b/vendor/github.com/spf13/pflag/verify/all.sh @@ -1,69 +1,69 @@ -#!/bin/bash - -set -o errexit -set -o nounset -set -o pipefail - -ROOT=$(dirname "${BASH_SOURCE}")/.. - -# Some useful colors. -if [[ -z "${color_start-}" ]]; then - declare -r color_start="\033[" - declare -r color_red="${color_start}0;31m" - declare -r color_yellow="${color_start}0;33m" - declare -r color_green="${color_start}0;32m" - declare -r color_norm="${color_start}0m" -fi - -SILENT=true - -function is-excluded { - for e in $EXCLUDE; do - if [[ $1 -ef ${BASH_SOURCE} ]]; then - return - fi - if [[ $1 -ef "$ROOT/hack/$e" ]]; then - return - fi - done - return 1 -} - -while getopts ":v" opt; do - case $opt in - v) - SILENT=false - ;; - \?) - echo "Invalid flag: -$OPTARG" >&2 - exit 1 - ;; - esac -done - -if $SILENT ; then - echo "Running in the silent mode, run with -v if you want to see script logs." -fi - -EXCLUDE="all.sh" - -ret=0 -for t in `ls $ROOT/verify/*.sh` -do - if is-excluded $t ; then - echo "Skipping $t" - continue - fi - if $SILENT ; then - echo -e "Verifying $t" - if bash "$t" &> /dev/null; then - echo -e "${color_green}SUCCESS${color_norm}" - else - echo -e "${color_red}FAILED${color_norm}" - ret=1 - fi - else - bash "$t" || ret=1 - fi -done -exit $ret +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT=$(dirname "${BASH_SOURCE}")/.. + +# Some useful colors. +if [[ -z "${color_start-}" ]]; then + declare -r color_start="\033[" + declare -r color_red="${color_start}0;31m" + declare -r color_yellow="${color_start}0;33m" + declare -r color_green="${color_start}0;32m" + declare -r color_norm="${color_start}0m" +fi + +SILENT=true + +function is-excluded { + for e in $EXCLUDE; do + if [[ $1 -ef ${BASH_SOURCE} ]]; then + return + fi + if [[ $1 -ef "$ROOT/hack/$e" ]]; then + return + fi + done + return 1 +} + +while getopts ":v" opt; do + case $opt in + v) + SILENT=false + ;; + \?) + echo "Invalid flag: -$OPTARG" >&2 + exit 1 + ;; + esac +done + +if $SILENT ; then + echo "Running in the silent mode, run with -v if you want to see script logs." +fi + +EXCLUDE="all.sh" + +ret=0 +for t in `ls $ROOT/verify/*.sh` +do + if is-excluded $t ; then + echo "Skipping $t" + continue + fi + if $SILENT ; then + echo -e "Verifying $t" + if bash "$t" &> /dev/null; then + echo -e "${color_green}SUCCESS${color_norm}" + else + echo -e "${color_red}FAILED${color_norm}" + ret=1 + fi + else + bash "$t" || ret=1 + fi +done +exit $ret diff --git a/vendor/github.com/spf13/pflag/verify/gofmt.sh b/vendor/github.com/spf13/pflag/verify/gofmt.sh index 489803bde1..f66acf803b 100644 --- a/vendor/github.com/spf13/pflag/verify/gofmt.sh +++ b/vendor/github.com/spf13/pflag/verify/gofmt.sh @@ -1,19 +1,19 @@ -#!/bin/bash - -set -o errexit -set -o nounset -set -o pipefail - -ROOT=$(dirname "${BASH_SOURCE}")/.. - -pushd "${ROOT}" > /dev/null - -GOFMT=${GOFMT:-"gofmt"} -bad_files=$(find . -name '*.go' | xargs $GOFMT -s -l) -if [[ -n "${bad_files}" ]]; then - echo "!!! '$GOFMT' needs to be run on the following files: " - echo "${bad_files}" - exit 1 -fi - -# ex: ts=2 sw=2 et filetype=sh +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +ROOT=$(dirname "${BASH_SOURCE}")/.. + +pushd "${ROOT}" > /dev/null + +GOFMT=${GOFMT:-"gofmt"} +bad_files=$(find . -name '*.go' | xargs $GOFMT -s -l) +if [[ -n "${bad_files}" ]]; then + echo "!!! '$GOFMT' needs to be run on the following files: " + echo "${bad_files}" + exit 1 +fi + +# ex: ts=2 sw=2 et filetype=sh diff --git a/vendor/github.com/spf13/pflag/verify/golint.sh b/vendor/github.com/spf13/pflag/verify/golint.sh index afd84b1f02..685c1778e5 100644 --- a/vendor/github.com/spf13/pflag/verify/golint.sh +++ b/vendor/github.com/spf13/pflag/verify/golint.sh @@ -1,15 +1,15 @@ -#!/bin/bash - -ROOT=$(dirname "${BASH_SOURCE}")/.. -GOLINT=${GOLINT:-"golint"} - -pushd "${ROOT}" > /dev/null - bad_files=$($GOLINT -min_confidence=0.9 ./...) - if [[ -n "${bad_files}" ]]; then - echo "!!! '$GOLINT' problems: " - echo "${bad_files}" - exit 1 - fi -popd > /dev/null - -# ex: ts=2 sw=2 et filetype=sh +#!/bin/bash + +ROOT=$(dirname "${BASH_SOURCE}")/.. +GOLINT=${GOLINT:-"golint"} + +pushd "${ROOT}" > /dev/null + bad_files=$($GOLINT -min_confidence=0.9 ./...) + if [[ -n "${bad_files}" ]]; then + echo "!!! '$GOLINT' problems: " + echo "${bad_files}" + exit 1 + fi +popd > /dev/null + +# ex: ts=2 sw=2 et filetype=sh diff --git a/vendor/gopkg.in/yaml.v2/.travis.yml b/vendor/gopkg.in/yaml.v2/.travis.yml index dbda685952..004172a2e3 100644 --- a/vendor/gopkg.in/yaml.v2/.travis.yml +++ b/vendor/gopkg.in/yaml.v2/.travis.yml @@ -1,9 +1,9 @@ -language: go - -go: - - 1.4 - - 1.5 - - 1.6 - - tip - -go_import_path: gopkg.in/yaml.v2 +language: go + +go: + - 1.4 + - 1.5 + - 1.6 + - tip + +go_import_path: gopkg.in/yaml.v2 diff --git a/vendor/gopkg.in/yaml.v2/LICENSE b/vendor/gopkg.in/yaml.v2/LICENSE index 2544dd0d82..866d74a7ad 100644 --- a/vendor/gopkg.in/yaml.v2/LICENSE +++ b/vendor/gopkg.in/yaml.v2/LICENSE @@ -1,13 +1,13 @@ -Copyright 2011-2016 Canonical Ltd. - -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. +Copyright 2011-2016 Canonical Ltd. + +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/gopkg.in/yaml.v2/LICENSE.libyaml b/vendor/gopkg.in/yaml.v2/LICENSE.libyaml index a01337d471..8da58fbf6f 100644 --- a/vendor/gopkg.in/yaml.v2/LICENSE.libyaml +++ b/vendor/gopkg.in/yaml.v2/LICENSE.libyaml @@ -1,31 +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. +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/gopkg.in/yaml.v2/README.md b/vendor/gopkg.in/yaml.v2/README.md index c552652fc0..1884de6a7d 100644 --- a/vendor/gopkg.in/yaml.v2/README.md +++ b/vendor/gopkg.in/yaml.v2/README.md @@ -1,131 +1,131 @@ -# 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 -------- - -```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 -``` - +# 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 +------- + +```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/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go index b60cf9935e..95ec014e8c 100644 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ b/vendor/gopkg.in/yaml.v2/apic.go @@ -1,742 +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 -//} -// -// +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/gopkg.in/yaml.v2/decode.go b/vendor/gopkg.in/yaml.v2/decode.go index 8ccd363e8d..052ecfcd19 100644 --- a/vendor/gopkg.in/yaml.v2/decode.go +++ b/vendor/gopkg.in/yaml.v2/decode.go @@ -1,682 +1,682 @@ -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) - 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) - 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 -} - -var ( - mapItemType = reflect.TypeOf(MapItem{}) - durationType = reflect.TypeOf(time.Duration(0)) - defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) - ifaceType = defaultMapType.Elem() -) - -func newDecoder() *decoder { - d := &decoder{mapType: defaultMapType} - d.aliases = make(map[string]bool) - return d -} - -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)) - } - 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) - } - } - 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) -} +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) + 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) + 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 +} + +var ( + mapItemType = reflect.TypeOf(MapItem{}) + durationType = reflect.TypeOf(time.Duration(0)) + defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) + ifaceType = defaultMapType.Elem() +) + +func newDecoder() *decoder { + d := &decoder{mapType: defaultMapType} + d.aliases = make(map[string]bool) + return d +} + +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)) + } + 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) + } + } + 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/gopkg.in/yaml.v2/decode_test.go b/vendor/gopkg.in/yaml.v2/decode_test.go index c2ebdf9c13..a6fea0f20a 100644 --- a/vendor/gopkg.in/yaml.v2/decode_test.go +++ b/vendor/gopkg.in/yaml.v2/decode_test.go @@ -1,998 +1,998 @@ -package yaml_test - -import ( - "errors" - . "gopkg.in/check.v1" - "gopkg.in/yaml.v2" - "math" - "net" - "reflect" - "strings" - "time" -) - -var unmarshalIntTest = 123 - -var unmarshalTests = []struct { - data string - value interface{} -}{ - { - "", - &struct{}{}, - }, { - "{}", &struct{}{}, - }, { - "v: hi", - map[string]string{"v": "hi"}, - }, { - "v: hi", map[string]interface{}{"v": "hi"}, - }, { - "v: true", - map[string]string{"v": "true"}, - }, { - "v: true", - map[string]interface{}{"v": true}, - }, { - "v: 10", - map[string]interface{}{"v": 10}, - }, { - "v: 0b10", - map[string]interface{}{"v": 2}, - }, { - "v: 0xA", - map[string]interface{}{"v": 10}, - }, { - "v: 4294967296", - map[string]int64{"v": 4294967296}, - }, { - "v: 0.1", - map[string]interface{}{"v": 0.1}, - }, { - "v: .1", - map[string]interface{}{"v": 0.1}, - }, { - "v: .Inf", - map[string]interface{}{"v": math.Inf(+1)}, - }, { - "v: -.Inf", - map[string]interface{}{"v": math.Inf(-1)}, - }, { - "v: -10", - map[string]interface{}{"v": -10}, - }, { - "v: -.1", - map[string]interface{}{"v": -0.1}, - }, - - // Simple values. - { - "123", - &unmarshalIntTest, - }, - - // Floats from spec - { - "canonical: 6.8523e+5", - map[string]interface{}{"canonical": 6.8523e+5}, - }, { - "expo: 685.230_15e+03", - map[string]interface{}{"expo": 685.23015e+03}, - }, { - "fixed: 685_230.15", - map[string]interface{}{"fixed": 685230.15}, - }, { - "neginf: -.inf", - map[string]interface{}{"neginf": math.Inf(-1)}, - }, { - "fixed: 685_230.15", - map[string]float64{"fixed": 685230.15}, - }, - //{"sexa: 190:20:30.15", map[string]interface{}{"sexa": 0}}, // Unsupported - //{"notanum: .NaN", map[string]interface{}{"notanum": math.NaN()}}, // Equality of NaN fails. - - // Bools from spec - { - "canonical: y", - map[string]interface{}{"canonical": true}, - }, { - "answer: NO", - map[string]interface{}{"answer": false}, - }, { - "logical: True", - map[string]interface{}{"logical": true}, - }, { - "option: on", - map[string]interface{}{"option": true}, - }, { - "option: on", - map[string]bool{"option": true}, - }, - // Ints from spec - { - "canonical: 685230", - map[string]interface{}{"canonical": 685230}, - }, { - "decimal: +685_230", - map[string]interface{}{"decimal": 685230}, - }, { - "octal: 02472256", - map[string]interface{}{"octal": 685230}, - }, { - "hexa: 0x_0A_74_AE", - map[string]interface{}{"hexa": 685230}, - }, { - "bin: 0b1010_0111_0100_1010_1110", - map[string]interface{}{"bin": 685230}, - }, { - "bin: -0b101010", - map[string]interface{}{"bin": -42}, - }, { - "decimal: +685_230", - map[string]int{"decimal": 685230}, - }, - - //{"sexa: 190:20:30", map[string]interface{}{"sexa": 0}}, // Unsupported - - // Nulls from spec - { - "empty:", - map[string]interface{}{"empty": nil}, - }, { - "canonical: ~", - map[string]interface{}{"canonical": nil}, - }, { - "english: null", - map[string]interface{}{"english": nil}, - }, { - "~: null key", - map[interface{}]string{nil: "null key"}, - }, { - "empty:", - map[string]*bool{"empty": nil}, - }, - - // Flow sequence - { - "seq: [A,B]", - map[string]interface{}{"seq": []interface{}{"A", "B"}}, - }, { - "seq: [A,B,C,]", - map[string][]string{"seq": []string{"A", "B", "C"}}, - }, { - "seq: [A,1,C]", - map[string][]string{"seq": []string{"A", "1", "C"}}, - }, { - "seq: [A,1,C]", - map[string][]int{"seq": []int{1}}, - }, { - "seq: [A,1,C]", - map[string]interface{}{"seq": []interface{}{"A", 1, "C"}}, - }, - // Block sequence - { - "seq:\n - A\n - B", - map[string]interface{}{"seq": []interface{}{"A", "B"}}, - }, { - "seq:\n - A\n - B\n - C", - map[string][]string{"seq": []string{"A", "B", "C"}}, - }, { - "seq:\n - A\n - 1\n - C", - map[string][]string{"seq": []string{"A", "1", "C"}}, - }, { - "seq:\n - A\n - 1\n - C", - map[string][]int{"seq": []int{1}}, - }, { - "seq:\n - A\n - 1\n - C", - map[string]interface{}{"seq": []interface{}{"A", 1, "C"}}, - }, - - // Literal block scalar - { - "scalar: | # Comment\n\n literal\n\n \ttext\n\n", - map[string]string{"scalar": "\nliteral\n\n\ttext\n"}, - }, - - // Folded block scalar - { - "scalar: > # Comment\n\n folded\n line\n \n next\n line\n * one\n * two\n\n last\n line\n\n", - map[string]string{"scalar": "\nfolded line\nnext line\n * one\n * two\n\nlast line\n"}, - }, - - // Map inside interface with no type hints. - { - "a: {b: c}", - map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": "c"}}, - }, - - // Structs and type conversions. - { - "hello: world", - &struct{ Hello string }{"world"}, - }, { - "a: {b: c}", - &struct{ A struct{ B string } }{struct{ B string }{"c"}}, - }, { - "a: {b: c}", - &struct{ A *struct{ B string } }{&struct{ B string }{"c"}}, - }, { - "a: {b: c}", - &struct{ A map[string]string }{map[string]string{"b": "c"}}, - }, { - "a: {b: c}", - &struct{ A *map[string]string }{&map[string]string{"b": "c"}}, - }, { - "a:", - &struct{ A map[string]string }{}, - }, { - "a: 1", - &struct{ A int }{1}, - }, { - "a: 1", - &struct{ A float64 }{1}, - }, { - "a: 1.0", - &struct{ A int }{1}, - }, { - "a: 1.0", - &struct{ A uint }{1}, - }, { - "a: [1, 2]", - &struct{ A []int }{[]int{1, 2}}, - }, { - "a: 1", - &struct{ B int }{0}, - }, { - "a: 1", - &struct { - B int "a" - }{1}, - }, { - "a: y", - &struct{ A bool }{true}, - }, - - // Some cross type conversions - { - "v: 42", - map[string]uint{"v": 42}, - }, { - "v: -42", - map[string]uint{}, - }, { - "v: 4294967296", - map[string]uint64{"v": 4294967296}, - }, { - "v: -4294967296", - map[string]uint64{}, - }, - - // int - { - "int_max: 2147483647", - map[string]int{"int_max": math.MaxInt32}, - }, - { - "int_min: -2147483648", - map[string]int{"int_min": math.MinInt32}, - }, - { - "int_overflow: 9223372036854775808", // math.MaxInt64 + 1 - map[string]int{}, - }, - - // int64 - { - "int64_max: 9223372036854775807", - map[string]int64{"int64_max": math.MaxInt64}, - }, - { - "int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111", - map[string]int64{"int64_max_base2": math.MaxInt64}, - }, - { - "int64_min: -9223372036854775808", - map[string]int64{"int64_min": math.MinInt64}, - }, - { - "int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111", - map[string]int64{"int64_neg_base2": -math.MaxInt64}, - }, - { - "int64_overflow: 9223372036854775808", // math.MaxInt64 + 1 - map[string]int64{}, - }, - - // uint - { - "uint_min: 0", - map[string]uint{"uint_min": 0}, - }, - { - "uint_max: 4294967295", - map[string]uint{"uint_max": math.MaxUint32}, - }, - { - "uint_underflow: -1", - map[string]uint{}, - }, - - // uint64 - { - "uint64_min: 0", - map[string]uint{"uint64_min": 0}, - }, - { - "uint64_max: 18446744073709551615", - map[string]uint64{"uint64_max": math.MaxUint64}, - }, - { - "uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111", - map[string]uint64{"uint64_max_base2": math.MaxUint64}, - }, - { - "uint64_maxint64: 9223372036854775807", - map[string]uint64{"uint64_maxint64": math.MaxInt64}, - }, - { - "uint64_underflow: -1", - map[string]uint64{}, - }, - - // float32 - { - "float32_max: 3.40282346638528859811704183484516925440e+38", - map[string]float32{"float32_max": math.MaxFloat32}, - }, - { - "float32_nonzero: 1.401298464324817070923729583289916131280e-45", - map[string]float32{"float32_nonzero": math.SmallestNonzeroFloat32}, - }, - { - "float32_maxuint64: 18446744073709551615", - map[string]float32{"float32_maxuint64": float32(math.MaxUint64)}, - }, - { - "float32_maxuint64+1: 18446744073709551616", - map[string]float32{"float32_maxuint64+1": float32(math.MaxUint64 + 1)}, - }, - - // float64 - { - "float64_max: 1.797693134862315708145274237317043567981e+308", - map[string]float64{"float64_max": math.MaxFloat64}, - }, - { - "float64_nonzero: 4.940656458412465441765687928682213723651e-324", - map[string]float64{"float64_nonzero": math.SmallestNonzeroFloat64}, - }, - { - "float64_maxuint64: 18446744073709551615", - map[string]float64{"float64_maxuint64": float64(math.MaxUint64)}, - }, - { - "float64_maxuint64+1: 18446744073709551616", - map[string]float64{"float64_maxuint64+1": float64(math.MaxUint64 + 1)}, - }, - - // Overflow cases. - { - "v: 4294967297", - map[string]int32{}, - }, { - "v: 128", - map[string]int8{}, - }, - - // Quoted values. - { - "'1': '\"2\"'", - map[interface{}]interface{}{"1": "\"2\""}, - }, { - "v:\n- A\n- 'B\n\n C'\n", - map[string][]string{"v": []string{"A", "B\nC"}}, - }, - - // Explicit tags. - { - "v: !!float '1.1'", - map[string]interface{}{"v": 1.1}, - }, { - "v: !!null ''", - map[string]interface{}{"v": nil}, - }, { - "%TAG !y! tag:yaml.org,2002:\n---\nv: !y!int '1'", - map[string]interface{}{"v": 1}, - }, - - // Anchors and aliases. - { - "a: &x 1\nb: &y 2\nc: *x\nd: *y\n", - &struct{ A, B, C, D int }{1, 2, 1, 2}, - }, { - "a: &a {c: 1}\nb: *a", - &struct { - A, B struct { - C int - } - }{struct{ C int }{1}, struct{ C int }{1}}, - }, { - "a: &a [1, 2]\nb: *a", - &struct{ B []int }{[]int{1, 2}}, - }, { - "b: *a\na: &a {c: 1}", - &struct { - A, B struct { - C int - } - }{struct{ C int }{1}, struct{ C int }{1}}, - }, - - // Bug #1133337 - { - "foo: ''", - map[string]*string{"foo": new(string)}, - }, { - "foo: null", - map[string]string{"foo": ""}, - }, { - "foo: null", - map[string]interface{}{"foo": nil}, - }, - - // Ignored field - { - "a: 1\nb: 2\n", - &struct { - A int - B int "-" - }{1, 0}, - }, - - // Bug #1191981 - { - "" + - "%YAML 1.1\n" + - "--- !!str\n" + - `"Generic line break (no glyph)\n\` + "\n" + - ` Generic line break (glyphed)\n\` + "\n" + - ` Line separator\u2028\` + "\n" + - ` Paragraph separator\u2029"` + "\n", - "" + - "Generic line break (no glyph)\n" + - "Generic line break (glyphed)\n" + - "Line separator\u2028Paragraph separator\u2029", - }, - - // Struct inlining - { - "a: 1\nb: 2\nc: 3\n", - &struct { - A int - C inlineB `yaml:",inline"` - }{1, inlineB{2, inlineC{3}}}, - }, - - // Map inlining - { - "a: 1\nb: 2\nc: 3\n", - &struct { - A int - C map[string]int `yaml:",inline"` - }{1, map[string]int{"b": 2, "c": 3}}, - }, - - // bug 1243827 - { - "a: -b_c", - map[string]interface{}{"a": "-b_c"}, - }, - { - "a: +b_c", - map[string]interface{}{"a": "+b_c"}, - }, - { - "a: 50cent_of_dollar", - map[string]interface{}{"a": "50cent_of_dollar"}, - }, - - // Duration - { - "a: 3s", - map[string]time.Duration{"a": 3 * time.Second}, - }, - - // Issue #24. - { - "a: ", - map[string]string{"a": ""}, - }, - - // Base 60 floats are obsolete and unsupported. - { - "a: 1:1\n", - map[string]string{"a": "1:1"}, - }, - - // Binary data. - { - "a: !!binary gIGC\n", - map[string]string{"a": "\x80\x81\x82"}, - }, { - "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", - map[string]string{"a": strings.Repeat("\x90", 54)}, - }, { - "a: !!binary |\n " + strings.Repeat("A", 70) + "\n ==\n", - map[string]string{"a": strings.Repeat("\x00", 52)}, - }, - - // Ordered maps. - { - "{b: 2, a: 1, d: 4, c: 3, sub: {e: 5}}", - &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}}, - }, - - // Issue #39. - { - "a:\n b:\n c: d\n", - map[string]struct{ B interface{} }{"a": {map[interface{}]interface{}{"c": "d"}}}, - }, - - // Custom map type. - { - "a: {b: c}", - M{"a": M{"b": "c"}}, - }, - - // Support encoding.TextUnmarshaler. - { - "a: 1.2.3.4\n", - map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, - }, - { - "a: 2015-02-24T18:19:39Z\n", - map[string]time.Time{"a": time.Unix(1424801979, 0).In(time.UTC)}, - }, - - // Encode empty lists as zero-length slices. - { - "a: []", - &struct{ A []int }{[]int{}}, - }, - - // UTF-16-LE - { - "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n\x00", - M{"ñoño": "very yes"}, - }, - // UTF-16-LE with surrogate. - { - "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \x00=\xd8\xd4\xdf\n\x00", - M{"ñoño": "very yes 🟔"}, - }, - - // UTF-16-BE - { - "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n", - M{"ñoño": "very yes"}, - }, - // UTF-16-BE with surrogate. - { - "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \xd8=\xdf\xd4\x00\n", - M{"ñoño": "very yes 🟔"}, - }, - - // YAML Float regex shouldn't match this - { - "a: 123456e1\n", - M{"a": "123456e1"}, - }, { - "a: 123456E1\n", - M{"a": "123456E1"}, - }, -} - -type M map[interface{}]interface{} - -type inlineB struct { - B int - inlineC `yaml:",inline"` -} - -type inlineC struct { - C int -} - -func (s *S) TestUnmarshal(c *C) { - for _, item := range unmarshalTests { - t := reflect.ValueOf(item.value).Type() - var value interface{} - switch t.Kind() { - case reflect.Map: - value = reflect.MakeMap(t).Interface() - case reflect.String: - value = reflect.New(t).Interface() - case reflect.Ptr: - value = reflect.New(t.Elem()).Interface() - default: - c.Fatalf("missing case for %s", t) - } - err := yaml.Unmarshal([]byte(item.data), value) - if _, ok := err.(*yaml.TypeError); !ok { - c.Assert(err, IsNil) - } - if t.Kind() == reflect.String { - c.Assert(*value.(*string), Equals, item.value) - } else { - c.Assert(value, DeepEquals, item.value) - } - } -} - -func (s *S) TestUnmarshalNaN(c *C) { - value := map[string]interface{}{} - err := yaml.Unmarshal([]byte("notanum: .NaN"), &value) - c.Assert(err, IsNil) - c.Assert(math.IsNaN(value["notanum"].(float64)), Equals, true) -} - -var unmarshalErrorTests = []struct { - data, error string -}{ - {"v: !!float 'error'", "yaml: cannot decode !!str `error` as a !!float"}, - {"v: [A,", "yaml: line 1: did not find expected node content"}, - {"v:\n- [A,", "yaml: line 2: did not find expected node content"}, - {"a: *b\n", "yaml: unknown anchor 'b' referenced"}, - {"a: &a\n b: *a\n", "yaml: anchor 'a' value contains itself"}, - {"value: -", "yaml: block sequence entries are not allowed in this context"}, - {"a: !!binary ==", "yaml: !!binary value contains invalid base64 data"}, - {"{[.]}", `yaml: invalid map key: \[\]interface \{\}\{"\."\}`}, - {"{{.}}", `yaml: invalid map key: map\[interface\ \{\}\]interface \{\}\{".":interface \{\}\(nil\)\}`}, -} - -func (s *S) TestUnmarshalErrors(c *C) { - for _, item := range unmarshalErrorTests { - var value interface{} - err := yaml.Unmarshal([]byte(item.data), &value) - c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value)) - } -} - -var unmarshalerTests = []struct { - data, tag string - value interface{} -}{ - {"_: {hi: there}", "!!map", map[interface{}]interface{}{"hi": "there"}}, - {"_: [1,A]", "!!seq", []interface{}{1, "A"}}, - {"_: 10", "!!int", 10}, - {"_: null", "!!null", nil}, - {`_: BAR!`, "!!str", "BAR!"}, - {`_: "BAR!"`, "!!str", "BAR!"}, - {"_: !!foo 'BAR!'", "!!foo", "BAR!"}, - {`_: ""`, "!!str", ""}, -} - -var unmarshalerResult = map[int]error{} - -type unmarshalerType struct { - value interface{} -} - -func (o *unmarshalerType) UnmarshalYAML(unmarshal func(v interface{}) error) error { - if err := unmarshal(&o.value); err != nil { - return err - } - if i, ok := o.value.(int); ok { - if result, ok := unmarshalerResult[i]; ok { - return result - } - } - return nil -} - -type unmarshalerPointer struct { - Field *unmarshalerType "_" -} - -type unmarshalerValue struct { - Field unmarshalerType "_" -} - -func (s *S) TestUnmarshalerPointerField(c *C) { - for _, item := range unmarshalerTests { - obj := &unmarshalerPointer{} - err := yaml.Unmarshal([]byte(item.data), obj) - c.Assert(err, IsNil) - if item.value == nil { - c.Assert(obj.Field, IsNil) - } else { - c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value)) - c.Assert(obj.Field.value, DeepEquals, item.value) - } - } -} - -func (s *S) TestUnmarshalerValueField(c *C) { - for _, item := range unmarshalerTests { - obj := &unmarshalerValue{} - err := yaml.Unmarshal([]byte(item.data), obj) - c.Assert(err, IsNil) - c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value)) - c.Assert(obj.Field.value, DeepEquals, item.value) - } -} - -func (s *S) TestUnmarshalerWholeDocument(c *C) { - obj := &unmarshalerType{} - err := yaml.Unmarshal([]byte(unmarshalerTests[0].data), obj) - c.Assert(err, IsNil) - value, ok := obj.value.(map[interface{}]interface{}) - c.Assert(ok, Equals, true, Commentf("value: %#v", obj.value)) - c.Assert(value["_"], DeepEquals, unmarshalerTests[0].value) -} - -func (s *S) TestUnmarshalerTypeError(c *C) { - unmarshalerResult[2] = &yaml.TypeError{[]string{"foo"}} - unmarshalerResult[4] = &yaml.TypeError{[]string{"bar"}} - defer func() { - delete(unmarshalerResult, 2) - delete(unmarshalerResult, 4) - }() - - type T struct { - Before int - After int - M map[string]*unmarshalerType - } - var v T - data := `{before: A, m: {abc: 1, def: 2, ghi: 3, jkl: 4}, after: B}` - err := yaml.Unmarshal([]byte(data), &v) - c.Assert(err, ErrorMatches, ""+ - "yaml: unmarshal errors:\n"+ - " line 1: cannot unmarshal !!str `A` into int\n"+ - " foo\n"+ - " bar\n"+ - " line 1: cannot unmarshal !!str `B` into int") - c.Assert(v.M["abc"], NotNil) - c.Assert(v.M["def"], IsNil) - c.Assert(v.M["ghi"], NotNil) - c.Assert(v.M["jkl"], IsNil) - - c.Assert(v.M["abc"].value, Equals, 1) - c.Assert(v.M["ghi"].value, Equals, 3) -} - -type proxyTypeError struct{} - -func (v *proxyTypeError) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - var a int32 - var b int64 - if err := unmarshal(&s); err != nil { - panic(err) - } - if s == "a" { - if err := unmarshal(&b); err == nil { - panic("should have failed") - } - return unmarshal(&a) - } - if err := unmarshal(&a); err == nil { - panic("should have failed") - } - return unmarshal(&b) -} - -func (s *S) TestUnmarshalerTypeErrorProxying(c *C) { - type T struct { - Before int - After int - M map[string]*proxyTypeError - } - var v T - data := `{before: A, m: {abc: a, def: b}, after: B}` - err := yaml.Unmarshal([]byte(data), &v) - c.Assert(err, ErrorMatches, ""+ - "yaml: unmarshal errors:\n"+ - " line 1: cannot unmarshal !!str `A` into int\n"+ - " line 1: cannot unmarshal !!str `a` into int32\n"+ - " line 1: cannot unmarshal !!str `b` into int64\n"+ - " line 1: cannot unmarshal !!str `B` into int") -} - -type failingUnmarshaler struct{} - -var failingErr = errors.New("failingErr") - -func (ft *failingUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error { - return failingErr -} - -func (s *S) TestUnmarshalerError(c *C) { - err := yaml.Unmarshal([]byte("a: b"), &failingUnmarshaler{}) - c.Assert(err, Equals, failingErr) -} - -type sliceUnmarshaler []int - -func (su *sliceUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error { - var slice []int - err := unmarshal(&slice) - if err == nil { - *su = slice - return nil - } - - var intVal int - err = unmarshal(&intVal) - if err == nil { - *su = []int{intVal} - return nil - } - - return err -} - -func (s *S) TestUnmarshalerRetry(c *C) { - var su sliceUnmarshaler - err := yaml.Unmarshal([]byte("[1, 2, 3]"), &su) - c.Assert(err, IsNil) - c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1, 2, 3})) - - err = yaml.Unmarshal([]byte("1"), &su) - c.Assert(err, IsNil) - c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1})) -} - -// From http://yaml.org/type/merge.html -var mergeTests = ` -anchors: - list: - - &CENTER { "x": 1, "y": 2 } - - &LEFT { "x": 0, "y": 2 } - - &BIG { "r": 10 } - - &SMALL { "r": 1 } - -# All the following maps are equal: - -plain: - # Explicit keys - "x": 1 - "y": 2 - "r": 10 - label: center/big - -mergeOne: - # Merge one map - << : *CENTER - "r": 10 - label: center/big - -mergeMultiple: - # Merge multiple maps - << : [ *CENTER, *BIG ] - label: center/big - -override: - # Override - << : [ *BIG, *LEFT, *SMALL ] - "x": 1 - label: center/big - -shortTag: - # Explicit short merge tag - !!merge "<<" : [ *CENTER, *BIG ] - label: center/big - -longTag: - # Explicit merge long tag - ! "<<" : [ *CENTER, *BIG ] - label: center/big - -inlineMap: - # Inlined map - << : {"x": 1, "y": 2, "r": 10} - label: center/big - -inlineSequenceMap: - # Inlined map in sequence - << : [ *CENTER, {"r": 10} ] - label: center/big -` - -func (s *S) TestMerge(c *C) { - var want = map[interface{}]interface{}{ - "x": 1, - "y": 2, - "r": 10, - "label": "center/big", - } - - var m map[interface{}]interface{} - err := yaml.Unmarshal([]byte(mergeTests), &m) - c.Assert(err, IsNil) - for name, test := range m { - if name == "anchors" { - continue - } - c.Assert(test, DeepEquals, want, Commentf("test %q failed", name)) - } -} - -func (s *S) TestMergeStruct(c *C) { - type Data struct { - X, Y, R int - Label string - } - want := Data{1, 2, 10, "center/big"} - - var m map[string]Data - err := yaml.Unmarshal([]byte(mergeTests), &m) - c.Assert(err, IsNil) - for name, test := range m { - if name == "anchors" { - continue - } - c.Assert(test, Equals, want, Commentf("test %q failed", name)) - } -} - -var unmarshalNullTests = []func() interface{}{ - func() interface{} { var v interface{}; v = "v"; return &v }, - func() interface{} { var s = "s"; return &s }, - func() interface{} { var s = "s"; sptr := &s; return &sptr }, - func() interface{} { var i = 1; return &i }, - func() interface{} { var i = 1; iptr := &i; return &iptr }, - func() interface{} { m := map[string]int{"s": 1}; return &m }, - func() interface{} { m := map[string]int{"s": 1}; return m }, -} - -func (s *S) TestUnmarshalNull(c *C) { - for _, test := range unmarshalNullTests { - item := test() - zero := reflect.Zero(reflect.TypeOf(item).Elem()).Interface() - err := yaml.Unmarshal([]byte("null"), item) - c.Assert(err, IsNil) - if reflect.TypeOf(item).Kind() == reflect.Map { - c.Assert(reflect.ValueOf(item).Interface(), DeepEquals, reflect.MakeMap(reflect.TypeOf(item)).Interface()) - } else { - c.Assert(reflect.ValueOf(item).Elem().Interface(), DeepEquals, zero) - } - } -} - -func (s *S) TestUnmarshalSliceOnPreset(c *C) { - // Issue #48. - v := struct{ A []int }{[]int{1}} - yaml.Unmarshal([]byte("a: [2]"), &v) - c.Assert(v.A, DeepEquals, []int{2}) -} - -//var data []byte -//func init() { -// var err error -// data, err = ioutil.ReadFile("/tmp/file.yaml") -// if err != nil { -// panic(err) -// } -//} -// -//func (s *S) BenchmarkUnmarshal(c *C) { -// var err error -// for i := 0; i < c.N; i++ { -// var v map[string]interface{} -// err = yaml.Unmarshal(data, &v) -// } -// if err != nil { -// panic(err) -// } -//} -// -//func (s *S) BenchmarkMarshal(c *C) { -// var v map[string]interface{} -// yaml.Unmarshal(data, &v) -// c.ResetTimer() -// for i := 0; i < c.N; i++ { -// yaml.Marshal(&v) -// } -//} +package yaml_test + +import ( + "errors" + . "gopkg.in/check.v1" + "gopkg.in/yaml.v2" + "math" + "net" + "reflect" + "strings" + "time" +) + +var unmarshalIntTest = 123 + +var unmarshalTests = []struct { + data string + value interface{} +}{ + { + "", + &struct{}{}, + }, { + "{}", &struct{}{}, + }, { + "v: hi", + map[string]string{"v": "hi"}, + }, { + "v: hi", map[string]interface{}{"v": "hi"}, + }, { + "v: true", + map[string]string{"v": "true"}, + }, { + "v: true", + map[string]interface{}{"v": true}, + }, { + "v: 10", + map[string]interface{}{"v": 10}, + }, { + "v: 0b10", + map[string]interface{}{"v": 2}, + }, { + "v: 0xA", + map[string]interface{}{"v": 10}, + }, { + "v: 4294967296", + map[string]int64{"v": 4294967296}, + }, { + "v: 0.1", + map[string]interface{}{"v": 0.1}, + }, { + "v: .1", + map[string]interface{}{"v": 0.1}, + }, { + "v: .Inf", + map[string]interface{}{"v": math.Inf(+1)}, + }, { + "v: -.Inf", + map[string]interface{}{"v": math.Inf(-1)}, + }, { + "v: -10", + map[string]interface{}{"v": -10}, + }, { + "v: -.1", + map[string]interface{}{"v": -0.1}, + }, + + // Simple values. + { + "123", + &unmarshalIntTest, + }, + + // Floats from spec + { + "canonical: 6.8523e+5", + map[string]interface{}{"canonical": 6.8523e+5}, + }, { + "expo: 685.230_15e+03", + map[string]interface{}{"expo": 685.23015e+03}, + }, { + "fixed: 685_230.15", + map[string]interface{}{"fixed": 685230.15}, + }, { + "neginf: -.inf", + map[string]interface{}{"neginf": math.Inf(-1)}, + }, { + "fixed: 685_230.15", + map[string]float64{"fixed": 685230.15}, + }, + //{"sexa: 190:20:30.15", map[string]interface{}{"sexa": 0}}, // Unsupported + //{"notanum: .NaN", map[string]interface{}{"notanum": math.NaN()}}, // Equality of NaN fails. + + // Bools from spec + { + "canonical: y", + map[string]interface{}{"canonical": true}, + }, { + "answer: NO", + map[string]interface{}{"answer": false}, + }, { + "logical: True", + map[string]interface{}{"logical": true}, + }, { + "option: on", + map[string]interface{}{"option": true}, + }, { + "option: on", + map[string]bool{"option": true}, + }, + // Ints from spec + { + "canonical: 685230", + map[string]interface{}{"canonical": 685230}, + }, { + "decimal: +685_230", + map[string]interface{}{"decimal": 685230}, + }, { + "octal: 02472256", + map[string]interface{}{"octal": 685230}, + }, { + "hexa: 0x_0A_74_AE", + map[string]interface{}{"hexa": 685230}, + }, { + "bin: 0b1010_0111_0100_1010_1110", + map[string]interface{}{"bin": 685230}, + }, { + "bin: -0b101010", + map[string]interface{}{"bin": -42}, + }, { + "decimal: +685_230", + map[string]int{"decimal": 685230}, + }, + + //{"sexa: 190:20:30", map[string]interface{}{"sexa": 0}}, // Unsupported + + // Nulls from spec + { + "empty:", + map[string]interface{}{"empty": nil}, + }, { + "canonical: ~", + map[string]interface{}{"canonical": nil}, + }, { + "english: null", + map[string]interface{}{"english": nil}, + }, { + "~: null key", + map[interface{}]string{nil: "null key"}, + }, { + "empty:", + map[string]*bool{"empty": nil}, + }, + + // Flow sequence + { + "seq: [A,B]", + map[string]interface{}{"seq": []interface{}{"A", "B"}}, + }, { + "seq: [A,B,C,]", + map[string][]string{"seq": []string{"A", "B", "C"}}, + }, { + "seq: [A,1,C]", + map[string][]string{"seq": []string{"A", "1", "C"}}, + }, { + "seq: [A,1,C]", + map[string][]int{"seq": []int{1}}, + }, { + "seq: [A,1,C]", + map[string]interface{}{"seq": []interface{}{"A", 1, "C"}}, + }, + // Block sequence + { + "seq:\n - A\n - B", + map[string]interface{}{"seq": []interface{}{"A", "B"}}, + }, { + "seq:\n - A\n - B\n - C", + map[string][]string{"seq": []string{"A", "B", "C"}}, + }, { + "seq:\n - A\n - 1\n - C", + map[string][]string{"seq": []string{"A", "1", "C"}}, + }, { + "seq:\n - A\n - 1\n - C", + map[string][]int{"seq": []int{1}}, + }, { + "seq:\n - A\n - 1\n - C", + map[string]interface{}{"seq": []interface{}{"A", 1, "C"}}, + }, + + // Literal block scalar + { + "scalar: | # Comment\n\n literal\n\n \ttext\n\n", + map[string]string{"scalar": "\nliteral\n\n\ttext\n"}, + }, + + // Folded block scalar + { + "scalar: > # Comment\n\n folded\n line\n \n next\n line\n * one\n * two\n\n last\n line\n\n", + map[string]string{"scalar": "\nfolded line\nnext line\n * one\n * two\n\nlast line\n"}, + }, + + // Map inside interface with no type hints. + { + "a: {b: c}", + map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": "c"}}, + }, + + // Structs and type conversions. + { + "hello: world", + &struct{ Hello string }{"world"}, + }, { + "a: {b: c}", + &struct{ A struct{ B string } }{struct{ B string }{"c"}}, + }, { + "a: {b: c}", + &struct{ A *struct{ B string } }{&struct{ B string }{"c"}}, + }, { + "a: {b: c}", + &struct{ A map[string]string }{map[string]string{"b": "c"}}, + }, { + "a: {b: c}", + &struct{ A *map[string]string }{&map[string]string{"b": "c"}}, + }, { + "a:", + &struct{ A map[string]string }{}, + }, { + "a: 1", + &struct{ A int }{1}, + }, { + "a: 1", + &struct{ A float64 }{1}, + }, { + "a: 1.0", + &struct{ A int }{1}, + }, { + "a: 1.0", + &struct{ A uint }{1}, + }, { + "a: [1, 2]", + &struct{ A []int }{[]int{1, 2}}, + }, { + "a: 1", + &struct{ B int }{0}, + }, { + "a: 1", + &struct { + B int "a" + }{1}, + }, { + "a: y", + &struct{ A bool }{true}, + }, + + // Some cross type conversions + { + "v: 42", + map[string]uint{"v": 42}, + }, { + "v: -42", + map[string]uint{}, + }, { + "v: 4294967296", + map[string]uint64{"v": 4294967296}, + }, { + "v: -4294967296", + map[string]uint64{}, + }, + + // int + { + "int_max: 2147483647", + map[string]int{"int_max": math.MaxInt32}, + }, + { + "int_min: -2147483648", + map[string]int{"int_min": math.MinInt32}, + }, + { + "int_overflow: 9223372036854775808", // math.MaxInt64 + 1 + map[string]int{}, + }, + + // int64 + { + "int64_max: 9223372036854775807", + map[string]int64{"int64_max": math.MaxInt64}, + }, + { + "int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111", + map[string]int64{"int64_max_base2": math.MaxInt64}, + }, + { + "int64_min: -9223372036854775808", + map[string]int64{"int64_min": math.MinInt64}, + }, + { + "int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111", + map[string]int64{"int64_neg_base2": -math.MaxInt64}, + }, + { + "int64_overflow: 9223372036854775808", // math.MaxInt64 + 1 + map[string]int64{}, + }, + + // uint + { + "uint_min: 0", + map[string]uint{"uint_min": 0}, + }, + { + "uint_max: 4294967295", + map[string]uint{"uint_max": math.MaxUint32}, + }, + { + "uint_underflow: -1", + map[string]uint{}, + }, + + // uint64 + { + "uint64_min: 0", + map[string]uint{"uint64_min": 0}, + }, + { + "uint64_max: 18446744073709551615", + map[string]uint64{"uint64_max": math.MaxUint64}, + }, + { + "uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111", + map[string]uint64{"uint64_max_base2": math.MaxUint64}, + }, + { + "uint64_maxint64: 9223372036854775807", + map[string]uint64{"uint64_maxint64": math.MaxInt64}, + }, + { + "uint64_underflow: -1", + map[string]uint64{}, + }, + + // float32 + { + "float32_max: 3.40282346638528859811704183484516925440e+38", + map[string]float32{"float32_max": math.MaxFloat32}, + }, + { + "float32_nonzero: 1.401298464324817070923729583289916131280e-45", + map[string]float32{"float32_nonzero": math.SmallestNonzeroFloat32}, + }, + { + "float32_maxuint64: 18446744073709551615", + map[string]float32{"float32_maxuint64": float32(math.MaxUint64)}, + }, + { + "float32_maxuint64+1: 18446744073709551616", + map[string]float32{"float32_maxuint64+1": float32(math.MaxUint64 + 1)}, + }, + + // float64 + { + "float64_max: 1.797693134862315708145274237317043567981e+308", + map[string]float64{"float64_max": math.MaxFloat64}, + }, + { + "float64_nonzero: 4.940656458412465441765687928682213723651e-324", + map[string]float64{"float64_nonzero": math.SmallestNonzeroFloat64}, + }, + { + "float64_maxuint64: 18446744073709551615", + map[string]float64{"float64_maxuint64": float64(math.MaxUint64)}, + }, + { + "float64_maxuint64+1: 18446744073709551616", + map[string]float64{"float64_maxuint64+1": float64(math.MaxUint64 + 1)}, + }, + + // Overflow cases. + { + "v: 4294967297", + map[string]int32{}, + }, { + "v: 128", + map[string]int8{}, + }, + + // Quoted values. + { + "'1': '\"2\"'", + map[interface{}]interface{}{"1": "\"2\""}, + }, { + "v:\n- A\n- 'B\n\n C'\n", + map[string][]string{"v": []string{"A", "B\nC"}}, + }, + + // Explicit tags. + { + "v: !!float '1.1'", + map[string]interface{}{"v": 1.1}, + }, { + "v: !!null ''", + map[string]interface{}{"v": nil}, + }, { + "%TAG !y! tag:yaml.org,2002:\n---\nv: !y!int '1'", + map[string]interface{}{"v": 1}, + }, + + // Anchors and aliases. + { + "a: &x 1\nb: &y 2\nc: *x\nd: *y\n", + &struct{ A, B, C, D int }{1, 2, 1, 2}, + }, { + "a: &a {c: 1}\nb: *a", + &struct { + A, B struct { + C int + } + }{struct{ C int }{1}, struct{ C int }{1}}, + }, { + "a: &a [1, 2]\nb: *a", + &struct{ B []int }{[]int{1, 2}}, + }, { + "b: *a\na: &a {c: 1}", + &struct { + A, B struct { + C int + } + }{struct{ C int }{1}, struct{ C int }{1}}, + }, + + // Bug #1133337 + { + "foo: ''", + map[string]*string{"foo": new(string)}, + }, { + "foo: null", + map[string]string{"foo": ""}, + }, { + "foo: null", + map[string]interface{}{"foo": nil}, + }, + + // Ignored field + { + "a: 1\nb: 2\n", + &struct { + A int + B int "-" + }{1, 0}, + }, + + // Bug #1191981 + { + "" + + "%YAML 1.1\n" + + "--- !!str\n" + + `"Generic line break (no glyph)\n\` + "\n" + + ` Generic line break (glyphed)\n\` + "\n" + + ` Line separator\u2028\` + "\n" + + ` Paragraph separator\u2029"` + "\n", + "" + + "Generic line break (no glyph)\n" + + "Generic line break (glyphed)\n" + + "Line separator\u2028Paragraph separator\u2029", + }, + + // Struct inlining + { + "a: 1\nb: 2\nc: 3\n", + &struct { + A int + C inlineB `yaml:",inline"` + }{1, inlineB{2, inlineC{3}}}, + }, + + // Map inlining + { + "a: 1\nb: 2\nc: 3\n", + &struct { + A int + C map[string]int `yaml:",inline"` + }{1, map[string]int{"b": 2, "c": 3}}, + }, + + // bug 1243827 + { + "a: -b_c", + map[string]interface{}{"a": "-b_c"}, + }, + { + "a: +b_c", + map[string]interface{}{"a": "+b_c"}, + }, + { + "a: 50cent_of_dollar", + map[string]interface{}{"a": "50cent_of_dollar"}, + }, + + // Duration + { + "a: 3s", + map[string]time.Duration{"a": 3 * time.Second}, + }, + + // Issue #24. + { + "a: ", + map[string]string{"a": ""}, + }, + + // Base 60 floats are obsolete and unsupported. + { + "a: 1:1\n", + map[string]string{"a": "1:1"}, + }, + + // Binary data. + { + "a: !!binary gIGC\n", + map[string]string{"a": "\x80\x81\x82"}, + }, { + "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", + map[string]string{"a": strings.Repeat("\x90", 54)}, + }, { + "a: !!binary |\n " + strings.Repeat("A", 70) + "\n ==\n", + map[string]string{"a": strings.Repeat("\x00", 52)}, + }, + + // Ordered maps. + { + "{b: 2, a: 1, d: 4, c: 3, sub: {e: 5}}", + &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}}, + }, + + // Issue #39. + { + "a:\n b:\n c: d\n", + map[string]struct{ B interface{} }{"a": {map[interface{}]interface{}{"c": "d"}}}, + }, + + // Custom map type. + { + "a: {b: c}", + M{"a": M{"b": "c"}}, + }, + + // Support encoding.TextUnmarshaler. + { + "a: 1.2.3.4\n", + map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, + }, + { + "a: 2015-02-24T18:19:39Z\n", + map[string]time.Time{"a": time.Unix(1424801979, 0).In(time.UTC)}, + }, + + // Encode empty lists as zero-length slices. + { + "a: []", + &struct{ A []int }{[]int{}}, + }, + + // UTF-16-LE + { + "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n\x00", + M{"ñoño": "very yes"}, + }, + // UTF-16-LE with surrogate. + { + "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \x00=\xd8\xd4\xdf\n\x00", + M{"ñoño": "very yes 🟔"}, + }, + + // UTF-16-BE + { + "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n", + M{"ñoño": "very yes"}, + }, + // UTF-16-BE with surrogate. + { + "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \xd8=\xdf\xd4\x00\n", + M{"ñoño": "very yes 🟔"}, + }, + + // YAML Float regex shouldn't match this + { + "a: 123456e1\n", + M{"a": "123456e1"}, + }, { + "a: 123456E1\n", + M{"a": "123456E1"}, + }, +} + +type M map[interface{}]interface{} + +type inlineB struct { + B int + inlineC `yaml:",inline"` +} + +type inlineC struct { + C int +} + +func (s *S) TestUnmarshal(c *C) { + for _, item := range unmarshalTests { + t := reflect.ValueOf(item.value).Type() + var value interface{} + switch t.Kind() { + case reflect.Map: + value = reflect.MakeMap(t).Interface() + case reflect.String: + value = reflect.New(t).Interface() + case reflect.Ptr: + value = reflect.New(t.Elem()).Interface() + default: + c.Fatalf("missing case for %s", t) + } + err := yaml.Unmarshal([]byte(item.data), value) + if _, ok := err.(*yaml.TypeError); !ok { + c.Assert(err, IsNil) + } + if t.Kind() == reflect.String { + c.Assert(*value.(*string), Equals, item.value) + } else { + c.Assert(value, DeepEquals, item.value) + } + } +} + +func (s *S) TestUnmarshalNaN(c *C) { + value := map[string]interface{}{} + err := yaml.Unmarshal([]byte("notanum: .NaN"), &value) + c.Assert(err, IsNil) + c.Assert(math.IsNaN(value["notanum"].(float64)), Equals, true) +} + +var unmarshalErrorTests = []struct { + data, error string +}{ + {"v: !!float 'error'", "yaml: cannot decode !!str `error` as a !!float"}, + {"v: [A,", "yaml: line 1: did not find expected node content"}, + {"v:\n- [A,", "yaml: line 2: did not find expected node content"}, + {"a: *b\n", "yaml: unknown anchor 'b' referenced"}, + {"a: &a\n b: *a\n", "yaml: anchor 'a' value contains itself"}, + {"value: -", "yaml: block sequence entries are not allowed in this context"}, + {"a: !!binary ==", "yaml: !!binary value contains invalid base64 data"}, + {"{[.]}", `yaml: invalid map key: \[\]interface \{\}\{"\."\}`}, + {"{{.}}", `yaml: invalid map key: map\[interface\ \{\}\]interface \{\}\{".":interface \{\}\(nil\)\}`}, +} + +func (s *S) TestUnmarshalErrors(c *C) { + for _, item := range unmarshalErrorTests { + var value interface{} + err := yaml.Unmarshal([]byte(item.data), &value) + c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value)) + } +} + +var unmarshalerTests = []struct { + data, tag string + value interface{} +}{ + {"_: {hi: there}", "!!map", map[interface{}]interface{}{"hi": "there"}}, + {"_: [1,A]", "!!seq", []interface{}{1, "A"}}, + {"_: 10", "!!int", 10}, + {"_: null", "!!null", nil}, + {`_: BAR!`, "!!str", "BAR!"}, + {`_: "BAR!"`, "!!str", "BAR!"}, + {"_: !!foo 'BAR!'", "!!foo", "BAR!"}, + {`_: ""`, "!!str", ""}, +} + +var unmarshalerResult = map[int]error{} + +type unmarshalerType struct { + value interface{} +} + +func (o *unmarshalerType) UnmarshalYAML(unmarshal func(v interface{}) error) error { + if err := unmarshal(&o.value); err != nil { + return err + } + if i, ok := o.value.(int); ok { + if result, ok := unmarshalerResult[i]; ok { + return result + } + } + return nil +} + +type unmarshalerPointer struct { + Field *unmarshalerType "_" +} + +type unmarshalerValue struct { + Field unmarshalerType "_" +} + +func (s *S) TestUnmarshalerPointerField(c *C) { + for _, item := range unmarshalerTests { + obj := &unmarshalerPointer{} + err := yaml.Unmarshal([]byte(item.data), obj) + c.Assert(err, IsNil) + if item.value == nil { + c.Assert(obj.Field, IsNil) + } else { + c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value)) + c.Assert(obj.Field.value, DeepEquals, item.value) + } + } +} + +func (s *S) TestUnmarshalerValueField(c *C) { + for _, item := range unmarshalerTests { + obj := &unmarshalerValue{} + err := yaml.Unmarshal([]byte(item.data), obj) + c.Assert(err, IsNil) + c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value)) + c.Assert(obj.Field.value, DeepEquals, item.value) + } +} + +func (s *S) TestUnmarshalerWholeDocument(c *C) { + obj := &unmarshalerType{} + err := yaml.Unmarshal([]byte(unmarshalerTests[0].data), obj) + c.Assert(err, IsNil) + value, ok := obj.value.(map[interface{}]interface{}) + c.Assert(ok, Equals, true, Commentf("value: %#v", obj.value)) + c.Assert(value["_"], DeepEquals, unmarshalerTests[0].value) +} + +func (s *S) TestUnmarshalerTypeError(c *C) { + unmarshalerResult[2] = &yaml.TypeError{[]string{"foo"}} + unmarshalerResult[4] = &yaml.TypeError{[]string{"bar"}} + defer func() { + delete(unmarshalerResult, 2) + delete(unmarshalerResult, 4) + }() + + type T struct { + Before int + After int + M map[string]*unmarshalerType + } + var v T + data := `{before: A, m: {abc: 1, def: 2, ghi: 3, jkl: 4}, after: B}` + err := yaml.Unmarshal([]byte(data), &v) + c.Assert(err, ErrorMatches, ""+ + "yaml: unmarshal errors:\n"+ + " line 1: cannot unmarshal !!str `A` into int\n"+ + " foo\n"+ + " bar\n"+ + " line 1: cannot unmarshal !!str `B` into int") + c.Assert(v.M["abc"], NotNil) + c.Assert(v.M["def"], IsNil) + c.Assert(v.M["ghi"], NotNil) + c.Assert(v.M["jkl"], IsNil) + + c.Assert(v.M["abc"].value, Equals, 1) + c.Assert(v.M["ghi"].value, Equals, 3) +} + +type proxyTypeError struct{} + +func (v *proxyTypeError) UnmarshalYAML(unmarshal func(interface{}) error) error { + var s string + var a int32 + var b int64 + if err := unmarshal(&s); err != nil { + panic(err) + } + if s == "a" { + if err := unmarshal(&b); err == nil { + panic("should have failed") + } + return unmarshal(&a) + } + if err := unmarshal(&a); err == nil { + panic("should have failed") + } + return unmarshal(&b) +} + +func (s *S) TestUnmarshalerTypeErrorProxying(c *C) { + type T struct { + Before int + After int + M map[string]*proxyTypeError + } + var v T + data := `{before: A, m: {abc: a, def: b}, after: B}` + err := yaml.Unmarshal([]byte(data), &v) + c.Assert(err, ErrorMatches, ""+ + "yaml: unmarshal errors:\n"+ + " line 1: cannot unmarshal !!str `A` into int\n"+ + " line 1: cannot unmarshal !!str `a` into int32\n"+ + " line 1: cannot unmarshal !!str `b` into int64\n"+ + " line 1: cannot unmarshal !!str `B` into int") +} + +type failingUnmarshaler struct{} + +var failingErr = errors.New("failingErr") + +func (ft *failingUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error { + return failingErr +} + +func (s *S) TestUnmarshalerError(c *C) { + err := yaml.Unmarshal([]byte("a: b"), &failingUnmarshaler{}) + c.Assert(err, Equals, failingErr) +} + +type sliceUnmarshaler []int + +func (su *sliceUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error { + var slice []int + err := unmarshal(&slice) + if err == nil { + *su = slice + return nil + } + + var intVal int + err = unmarshal(&intVal) + if err == nil { + *su = []int{intVal} + return nil + } + + return err +} + +func (s *S) TestUnmarshalerRetry(c *C) { + var su sliceUnmarshaler + err := yaml.Unmarshal([]byte("[1, 2, 3]"), &su) + c.Assert(err, IsNil) + c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1, 2, 3})) + + err = yaml.Unmarshal([]byte("1"), &su) + c.Assert(err, IsNil) + c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1})) +} + +// From http://yaml.org/type/merge.html +var mergeTests = ` +anchors: + list: + - &CENTER { "x": 1, "y": 2 } + - &LEFT { "x": 0, "y": 2 } + - &BIG { "r": 10 } + - &SMALL { "r": 1 } + +# All the following maps are equal: + +plain: + # Explicit keys + "x": 1 + "y": 2 + "r": 10 + label: center/big + +mergeOne: + # Merge one map + << : *CENTER + "r": 10 + label: center/big + +mergeMultiple: + # Merge multiple maps + << : [ *CENTER, *BIG ] + label: center/big + +override: + # Override + << : [ *BIG, *LEFT, *SMALL ] + "x": 1 + label: center/big + +shortTag: + # Explicit short merge tag + !!merge "<<" : [ *CENTER, *BIG ] + label: center/big + +longTag: + # Explicit merge long tag + ! "<<" : [ *CENTER, *BIG ] + label: center/big + +inlineMap: + # Inlined map + << : {"x": 1, "y": 2, "r": 10} + label: center/big + +inlineSequenceMap: + # Inlined map in sequence + << : [ *CENTER, {"r": 10} ] + label: center/big +` + +func (s *S) TestMerge(c *C) { + var want = map[interface{}]interface{}{ + "x": 1, + "y": 2, + "r": 10, + "label": "center/big", + } + + var m map[interface{}]interface{} + err := yaml.Unmarshal([]byte(mergeTests), &m) + c.Assert(err, IsNil) + for name, test := range m { + if name == "anchors" { + continue + } + c.Assert(test, DeepEquals, want, Commentf("test %q failed", name)) + } +} + +func (s *S) TestMergeStruct(c *C) { + type Data struct { + X, Y, R int + Label string + } + want := Data{1, 2, 10, "center/big"} + + var m map[string]Data + err := yaml.Unmarshal([]byte(mergeTests), &m) + c.Assert(err, IsNil) + for name, test := range m { + if name == "anchors" { + continue + } + c.Assert(test, Equals, want, Commentf("test %q failed", name)) + } +} + +var unmarshalNullTests = []func() interface{}{ + func() interface{} { var v interface{}; v = "v"; return &v }, + func() interface{} { var s = "s"; return &s }, + func() interface{} { var s = "s"; sptr := &s; return &sptr }, + func() interface{} { var i = 1; return &i }, + func() interface{} { var i = 1; iptr := &i; return &iptr }, + func() interface{} { m := map[string]int{"s": 1}; return &m }, + func() interface{} { m := map[string]int{"s": 1}; return m }, +} + +func (s *S) TestUnmarshalNull(c *C) { + for _, test := range unmarshalNullTests { + item := test() + zero := reflect.Zero(reflect.TypeOf(item).Elem()).Interface() + err := yaml.Unmarshal([]byte("null"), item) + c.Assert(err, IsNil) + if reflect.TypeOf(item).Kind() == reflect.Map { + c.Assert(reflect.ValueOf(item).Interface(), DeepEquals, reflect.MakeMap(reflect.TypeOf(item)).Interface()) + } else { + c.Assert(reflect.ValueOf(item).Elem().Interface(), DeepEquals, zero) + } + } +} + +func (s *S) TestUnmarshalSliceOnPreset(c *C) { + // Issue #48. + v := struct{ A []int }{[]int{1}} + yaml.Unmarshal([]byte("a: [2]"), &v) + c.Assert(v.A, DeepEquals, []int{2}) +} + +//var data []byte +//func init() { +// var err error +// data, err = ioutil.ReadFile("/tmp/file.yaml") +// if err != nil { +// panic(err) +// } +//} +// +//func (s *S) BenchmarkUnmarshal(c *C) { +// var err error +// for i := 0; i < c.N; i++ { +// var v map[string]interface{} +// err = yaml.Unmarshal(data, &v) +// } +// if err != nil { +// panic(err) +// } +//} +// +//func (s *S) BenchmarkMarshal(c *C) { +// var v map[string]interface{} +// yaml.Unmarshal(data, &v) +// c.ResetTimer() +// for i := 0; i < c.N; i++ { +// yaml.Marshal(&v) +// } +//} diff --git a/vendor/gopkg.in/yaml.v2/emitterc.go b/vendor/gopkg.in/yaml.v2/emitterc.go index 119ce194ca..6ecdcb3c7f 100644 --- a/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/vendor/gopkg.in/yaml.v2/emitterc.go @@ -1,1684 +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 - - preceeded_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 - } - - preceeded_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 preceeded_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. - preceeded_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 -} +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 + + preceeded_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 + } + + preceeded_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 preceeded_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. + preceeded_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/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go index d6e9b38003..84f8499551 100644 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ b/vendor/gopkg.in/yaml.v2/encode.go @@ -1,306 +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() -} +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/gopkg.in/yaml.v2/encode_test.go b/vendor/gopkg.in/yaml.v2/encode_test.go index 76bf027968..84099bd385 100644 --- a/vendor/gopkg.in/yaml.v2/encode_test.go +++ b/vendor/gopkg.in/yaml.v2/encode_test.go @@ -1,501 +1,501 @@ -package yaml_test - -import ( - "fmt" - "math" - "strconv" - "strings" - "time" - - . "gopkg.in/check.v1" - "gopkg.in/yaml.v2" - "net" - "os" -) - -var marshalIntTest = 123 - -var marshalTests = []struct { - value interface{} - data string -}{ - { - nil, - "null\n", - }, { - &struct{}{}, - "{}\n", - }, { - map[string]string{"v": "hi"}, - "v: hi\n", - }, { - map[string]interface{}{"v": "hi"}, - "v: hi\n", - }, { - map[string]string{"v": "true"}, - "v: \"true\"\n", - }, { - map[string]string{"v": "false"}, - "v: \"false\"\n", - }, { - map[string]interface{}{"v": true}, - "v: true\n", - }, { - map[string]interface{}{"v": false}, - "v: false\n", - }, { - map[string]interface{}{"v": 10}, - "v: 10\n", - }, { - map[string]interface{}{"v": -10}, - "v: -10\n", - }, { - map[string]uint{"v": 42}, - "v: 42\n", - }, { - map[string]interface{}{"v": int64(4294967296)}, - "v: 4294967296\n", - }, { - map[string]int64{"v": int64(4294967296)}, - "v: 4294967296\n", - }, { - map[string]uint64{"v": 4294967296}, - "v: 4294967296\n", - }, { - map[string]interface{}{"v": "10"}, - "v: \"10\"\n", - }, { - map[string]interface{}{"v": 0.1}, - "v: 0.1\n", - }, { - map[string]interface{}{"v": float64(0.1)}, - "v: 0.1\n", - }, { - map[string]interface{}{"v": -0.1}, - "v: -0.1\n", - }, { - map[string]interface{}{"v": math.Inf(+1)}, - "v: .inf\n", - }, { - map[string]interface{}{"v": math.Inf(-1)}, - "v: -.inf\n", - }, { - map[string]interface{}{"v": math.NaN()}, - "v: .nan\n", - }, { - map[string]interface{}{"v": nil}, - "v: null\n", - }, { - map[string]interface{}{"v": ""}, - "v: \"\"\n", - }, { - map[string][]string{"v": []string{"A", "B"}}, - "v:\n- A\n- B\n", - }, { - map[string][]string{"v": []string{"A", "B\nC"}}, - "v:\n- A\n- |-\n B\n C\n", - }, { - map[string][]interface{}{"v": []interface{}{"A", 1, map[string][]int{"B": []int{2, 3}}}}, - "v:\n- A\n- 1\n- B:\n - 2\n - 3\n", - }, { - map[string]interface{}{"a": map[interface{}]interface{}{"b": "c"}}, - "a:\n b: c\n", - }, { - map[string]interface{}{"a": "-"}, - "a: '-'\n", - }, - - // Simple values. - { - &marshalIntTest, - "123\n", - }, - - // Structures - { - &struct{ Hello string }{"world"}, - "hello: world\n", - }, { - &struct { - A struct { - B string - } - }{struct{ B string }{"c"}}, - "a:\n b: c\n", - }, { - &struct { - A *struct { - B string - } - }{&struct{ B string }{"c"}}, - "a:\n b: c\n", - }, { - &struct { - A *struct { - B string - } - }{}, - "a: null\n", - }, { - &struct{ A int }{1}, - "a: 1\n", - }, { - &struct{ A []int }{[]int{1, 2}}, - "a:\n- 1\n- 2\n", - }, { - &struct { - B int "a" - }{1}, - "a: 1\n", - }, { - &struct{ A bool }{true}, - "a: true\n", - }, - - // Conditional flag - { - &struct { - A int "a,omitempty" - B int "b,omitempty" - }{1, 0}, - "a: 1\n", - }, { - &struct { - A int "a,omitempty" - B int "b,omitempty" - }{0, 0}, - "{}\n", - }, { - &struct { - A *struct{ X, y int } "a,omitempty,flow" - }{&struct{ X, y int }{1, 2}}, - "a: {x: 1}\n", - }, { - &struct { - A *struct{ X, y int } "a,omitempty,flow" - }{nil}, - "{}\n", - }, { - &struct { - A *struct{ X, y int } "a,omitempty,flow" - }{&struct{ X, y int }{}}, - "a: {x: 0}\n", - }, { - &struct { - A struct{ X, y int } "a,omitempty,flow" - }{struct{ X, y int }{1, 2}}, - "a: {x: 1}\n", - }, { - &struct { - A struct{ X, y int } "a,omitempty,flow" - }{struct{ X, y int }{0, 1}}, - "{}\n", - }, { - &struct { - A float64 "a,omitempty" - B float64 "b,omitempty" - }{1, 0}, - "a: 1\n", - }, - - // Flow flag - { - &struct { - A []int "a,flow" - }{[]int{1, 2}}, - "a: [1, 2]\n", - }, { - &struct { - A map[string]string "a,flow" - }{map[string]string{"b": "c", "d": "e"}}, - "a: {b: c, d: e}\n", - }, { - &struct { - A struct { - B, D string - } "a,flow" - }{struct{ B, D string }{"c", "e"}}, - "a: {b: c, d: e}\n", - }, - - // Unexported field - { - &struct { - u int - A int - }{0, 1}, - "a: 1\n", - }, - - // Ignored field - { - &struct { - A int - B int "-" - }{1, 2}, - "a: 1\n", - }, - - // Struct inlining - { - &struct { - A int - C inlineB `yaml:",inline"` - }{1, inlineB{2, inlineC{3}}}, - "a: 1\nb: 2\nc: 3\n", - }, - - // Map inlining - { - &struct { - A int - C map[string]int `yaml:",inline"` - }{1, map[string]int{"b": 2, "c": 3}}, - "a: 1\nb: 2\nc: 3\n", - }, - - // Duration - { - map[string]time.Duration{"a": 3 * time.Second}, - "a: 3s\n", - }, - - // Issue #24: bug in map merging logic. - { - map[string]string{"a": ""}, - "a: \n", - }, - - // Issue #34: marshal unsupported base 60 floats quoted for compatibility - // with old YAML 1.1 parsers. - { - map[string]string{"a": "1:1"}, - "a: \"1:1\"\n", - }, - - // Binary data. - { - map[string]string{"a": "\x00"}, - "a: \"\\0\"\n", - }, { - map[string]string{"a": "\x80\x81\x82"}, - "a: !!binary gIGC\n", - }, { - map[string]string{"a": strings.Repeat("\x90", 54)}, - "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", - }, - - // Ordered maps. - { - &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}}, - "b: 2\na: 1\nd: 4\nc: 3\nsub:\n e: 5\n", - }, - - // Encode unicode as utf-8 rather than in escaped form. - { - map[string]string{"a": "你好"}, - "a: 你好\n", - }, - - // Support encoding.TextMarshaler. - { - map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, - "a: 1.2.3.4\n", - }, - { - map[string]time.Time{"a": time.Unix(1424801979, 0)}, - "a: 2015-02-24T18:19:39Z\n", - }, - - // Ensure strings containing ": " are quoted (reported as PR #43, but not reproducible). - { - map[string]string{"a": "b: c"}, - "a: 'b: c'\n", - }, - - // Containing hash mark ('#') in string should be quoted - { - map[string]string{"a": "Hello #comment"}, - "a: 'Hello #comment'\n", - }, - { - map[string]string{"a": "你好 #comment"}, - "a: '你好 #comment'\n", - }, -} - -func (s *S) TestMarshal(c *C) { - defer os.Setenv("TZ", os.Getenv("TZ")) - os.Setenv("TZ", "UTC") - for _, item := range marshalTests { - data, err := yaml.Marshal(item.value) - c.Assert(err, IsNil) - c.Assert(string(data), Equals, item.data) - } -} - -var marshalErrorTests = []struct { - value interface{} - error string - panic string -}{{ - value: &struct { - B int - inlineB ",inline" - }{1, inlineB{2, inlineC{3}}}, - panic: `Duplicated key 'b' in struct struct \{ B int; .*`, -}, { - value: &struct { - A int - B map[string]int ",inline" - }{1, map[string]int{"a": 2}}, - panic: `Can't have key "a" in inlined map; conflicts with struct field`, -}} - -func (s *S) TestMarshalErrors(c *C) { - for _, item := range marshalErrorTests { - if item.panic != "" { - c.Assert(func() { yaml.Marshal(item.value) }, PanicMatches, item.panic) - } else { - _, err := yaml.Marshal(item.value) - c.Assert(err, ErrorMatches, item.error) - } - } -} - -func (s *S) TestMarshalTypeCache(c *C) { - var data []byte - var err error - func() { - type T struct{ A int } - data, err = yaml.Marshal(&T{}) - c.Assert(err, IsNil) - }() - func() { - type T struct{ B int } - data, err = yaml.Marshal(&T{}) - c.Assert(err, IsNil) - }() - c.Assert(string(data), Equals, "b: 0\n") -} - -var marshalerTests = []struct { - data string - value interface{} -}{ - {"_:\n hi: there\n", map[interface{}]interface{}{"hi": "there"}}, - {"_:\n- 1\n- A\n", []interface{}{1, "A"}}, - {"_: 10\n", 10}, - {"_: null\n", nil}, - {"_: BAR!\n", "BAR!"}, -} - -type marshalerType struct { - value interface{} -} - -func (o marshalerType) MarshalText() ([]byte, error) { - panic("MarshalText called on type with MarshalYAML") -} - -func (o marshalerType) MarshalYAML() (interface{}, error) { - return o.value, nil -} - -type marshalerValue struct { - Field marshalerType "_" -} - -func (s *S) TestMarshaler(c *C) { - for _, item := range marshalerTests { - obj := &marshalerValue{} - obj.Field.value = item.value - data, err := yaml.Marshal(obj) - c.Assert(err, IsNil) - c.Assert(string(data), Equals, string(item.data)) - } -} - -func (s *S) TestMarshalerWholeDocument(c *C) { - obj := &marshalerType{} - obj.value = map[string]string{"hello": "world!"} - data, err := yaml.Marshal(obj) - c.Assert(err, IsNil) - c.Assert(string(data), Equals, "hello: world!\n") -} - -type failingMarshaler struct{} - -func (ft *failingMarshaler) MarshalYAML() (interface{}, error) { - return nil, failingErr -} - -func (s *S) TestMarshalerError(c *C) { - _, err := yaml.Marshal(&failingMarshaler{}) - c.Assert(err, Equals, failingErr) -} - -func (s *S) TestSortedOutput(c *C) { - order := []interface{}{ - false, - true, - 1, - uint(1), - 1.0, - 1.1, - 1.2, - 2, - uint(2), - 2.0, - 2.1, - "", - ".1", - ".2", - ".a", - "1", - "2", - "a!10", - "a/2", - "a/10", - "a~10", - "ab/1", - "b/1", - "b/01", - "b/2", - "b/02", - "b/3", - "b/03", - "b1", - "b01", - "b3", - "c2.10", - "c10.2", - "d1", - "d12", - "d12a", - } - m := make(map[interface{}]int) - for _, k := range order { - m[k] = 1 - } - data, err := yaml.Marshal(m) - c.Assert(err, IsNil) - out := "\n" + string(data) - last := 0 - for i, k := range order { - repr := fmt.Sprint(k) - if s, ok := k.(string); ok { - if _, err = strconv.ParseFloat(repr, 32); s == "" || err == nil { - repr = `"` + repr + `"` - } - } - index := strings.Index(out, "\n"+repr+":") - if index == -1 { - c.Fatalf("%#v is not in the output: %#v", k, out) - } - if index < last { - c.Fatalf("%#v was generated before %#v: %q", k, order[i-1], out) - } - last = index - } -} +package yaml_test + +import ( + "fmt" + "math" + "strconv" + "strings" + "time" + + . "gopkg.in/check.v1" + "gopkg.in/yaml.v2" + "net" + "os" +) + +var marshalIntTest = 123 + +var marshalTests = []struct { + value interface{} + data string +}{ + { + nil, + "null\n", + }, { + &struct{}{}, + "{}\n", + }, { + map[string]string{"v": "hi"}, + "v: hi\n", + }, { + map[string]interface{}{"v": "hi"}, + "v: hi\n", + }, { + map[string]string{"v": "true"}, + "v: \"true\"\n", + }, { + map[string]string{"v": "false"}, + "v: \"false\"\n", + }, { + map[string]interface{}{"v": true}, + "v: true\n", + }, { + map[string]interface{}{"v": false}, + "v: false\n", + }, { + map[string]interface{}{"v": 10}, + "v: 10\n", + }, { + map[string]interface{}{"v": -10}, + "v: -10\n", + }, { + map[string]uint{"v": 42}, + "v: 42\n", + }, { + map[string]interface{}{"v": int64(4294967296)}, + "v: 4294967296\n", + }, { + map[string]int64{"v": int64(4294967296)}, + "v: 4294967296\n", + }, { + map[string]uint64{"v": 4294967296}, + "v: 4294967296\n", + }, { + map[string]interface{}{"v": "10"}, + "v: \"10\"\n", + }, { + map[string]interface{}{"v": 0.1}, + "v: 0.1\n", + }, { + map[string]interface{}{"v": float64(0.1)}, + "v: 0.1\n", + }, { + map[string]interface{}{"v": -0.1}, + "v: -0.1\n", + }, { + map[string]interface{}{"v": math.Inf(+1)}, + "v: .inf\n", + }, { + map[string]interface{}{"v": math.Inf(-1)}, + "v: -.inf\n", + }, { + map[string]interface{}{"v": math.NaN()}, + "v: .nan\n", + }, { + map[string]interface{}{"v": nil}, + "v: null\n", + }, { + map[string]interface{}{"v": ""}, + "v: \"\"\n", + }, { + map[string][]string{"v": []string{"A", "B"}}, + "v:\n- A\n- B\n", + }, { + map[string][]string{"v": []string{"A", "B\nC"}}, + "v:\n- A\n- |-\n B\n C\n", + }, { + map[string][]interface{}{"v": []interface{}{"A", 1, map[string][]int{"B": []int{2, 3}}}}, + "v:\n- A\n- 1\n- B:\n - 2\n - 3\n", + }, { + map[string]interface{}{"a": map[interface{}]interface{}{"b": "c"}}, + "a:\n b: c\n", + }, { + map[string]interface{}{"a": "-"}, + "a: '-'\n", + }, + + // Simple values. + { + &marshalIntTest, + "123\n", + }, + + // Structures + { + &struct{ Hello string }{"world"}, + "hello: world\n", + }, { + &struct { + A struct { + B string + } + }{struct{ B string }{"c"}}, + "a:\n b: c\n", + }, { + &struct { + A *struct { + B string + } + }{&struct{ B string }{"c"}}, + "a:\n b: c\n", + }, { + &struct { + A *struct { + B string + } + }{}, + "a: null\n", + }, { + &struct{ A int }{1}, + "a: 1\n", + }, { + &struct{ A []int }{[]int{1, 2}}, + "a:\n- 1\n- 2\n", + }, { + &struct { + B int "a" + }{1}, + "a: 1\n", + }, { + &struct{ A bool }{true}, + "a: true\n", + }, + + // Conditional flag + { + &struct { + A int "a,omitempty" + B int "b,omitempty" + }{1, 0}, + "a: 1\n", + }, { + &struct { + A int "a,omitempty" + B int "b,omitempty" + }{0, 0}, + "{}\n", + }, { + &struct { + A *struct{ X, y int } "a,omitempty,flow" + }{&struct{ X, y int }{1, 2}}, + "a: {x: 1}\n", + }, { + &struct { + A *struct{ X, y int } "a,omitempty,flow" + }{nil}, + "{}\n", + }, { + &struct { + A *struct{ X, y int } "a,omitempty,flow" + }{&struct{ X, y int }{}}, + "a: {x: 0}\n", + }, { + &struct { + A struct{ X, y int } "a,omitempty,flow" + }{struct{ X, y int }{1, 2}}, + "a: {x: 1}\n", + }, { + &struct { + A struct{ X, y int } "a,omitempty,flow" + }{struct{ X, y int }{0, 1}}, + "{}\n", + }, { + &struct { + A float64 "a,omitempty" + B float64 "b,omitempty" + }{1, 0}, + "a: 1\n", + }, + + // Flow flag + { + &struct { + A []int "a,flow" + }{[]int{1, 2}}, + "a: [1, 2]\n", + }, { + &struct { + A map[string]string "a,flow" + }{map[string]string{"b": "c", "d": "e"}}, + "a: {b: c, d: e}\n", + }, { + &struct { + A struct { + B, D string + } "a,flow" + }{struct{ B, D string }{"c", "e"}}, + "a: {b: c, d: e}\n", + }, + + // Unexported field + { + &struct { + u int + A int + }{0, 1}, + "a: 1\n", + }, + + // Ignored field + { + &struct { + A int + B int "-" + }{1, 2}, + "a: 1\n", + }, + + // Struct inlining + { + &struct { + A int + C inlineB `yaml:",inline"` + }{1, inlineB{2, inlineC{3}}}, + "a: 1\nb: 2\nc: 3\n", + }, + + // Map inlining + { + &struct { + A int + C map[string]int `yaml:",inline"` + }{1, map[string]int{"b": 2, "c": 3}}, + "a: 1\nb: 2\nc: 3\n", + }, + + // Duration + { + map[string]time.Duration{"a": 3 * time.Second}, + "a: 3s\n", + }, + + // Issue #24: bug in map merging logic. + { + map[string]string{"a": ""}, + "a: \n", + }, + + // Issue #34: marshal unsupported base 60 floats quoted for compatibility + // with old YAML 1.1 parsers. + { + map[string]string{"a": "1:1"}, + "a: \"1:1\"\n", + }, + + // Binary data. + { + map[string]string{"a": "\x00"}, + "a: \"\\0\"\n", + }, { + map[string]string{"a": "\x80\x81\x82"}, + "a: !!binary gIGC\n", + }, { + map[string]string{"a": strings.Repeat("\x90", 54)}, + "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", + }, + + // Ordered maps. + { + &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}}, + "b: 2\na: 1\nd: 4\nc: 3\nsub:\n e: 5\n", + }, + + // Encode unicode as utf-8 rather than in escaped form. + { + map[string]string{"a": "你好"}, + "a: 你好\n", + }, + + // Support encoding.TextMarshaler. + { + map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, + "a: 1.2.3.4\n", + }, + { + map[string]time.Time{"a": time.Unix(1424801979, 0)}, + "a: 2015-02-24T18:19:39Z\n", + }, + + // Ensure strings containing ": " are quoted (reported as PR #43, but not reproducible). + { + map[string]string{"a": "b: c"}, + "a: 'b: c'\n", + }, + + // Containing hash mark ('#') in string should be quoted + { + map[string]string{"a": "Hello #comment"}, + "a: 'Hello #comment'\n", + }, + { + map[string]string{"a": "你好 #comment"}, + "a: '你好 #comment'\n", + }, +} + +func (s *S) TestMarshal(c *C) { + defer os.Setenv("TZ", os.Getenv("TZ")) + os.Setenv("TZ", "UTC") + for _, item := range marshalTests { + data, err := yaml.Marshal(item.value) + c.Assert(err, IsNil) + c.Assert(string(data), Equals, item.data) + } +} + +var marshalErrorTests = []struct { + value interface{} + error string + panic string +}{{ + value: &struct { + B int + inlineB ",inline" + }{1, inlineB{2, inlineC{3}}}, + panic: `Duplicated key 'b' in struct struct \{ B int; .*`, +}, { + value: &struct { + A int + B map[string]int ",inline" + }{1, map[string]int{"a": 2}}, + panic: `Can't have key "a" in inlined map; conflicts with struct field`, +}} + +func (s *S) TestMarshalErrors(c *C) { + for _, item := range marshalErrorTests { + if item.panic != "" { + c.Assert(func() { yaml.Marshal(item.value) }, PanicMatches, item.panic) + } else { + _, err := yaml.Marshal(item.value) + c.Assert(err, ErrorMatches, item.error) + } + } +} + +func (s *S) TestMarshalTypeCache(c *C) { + var data []byte + var err error + func() { + type T struct{ A int } + data, err = yaml.Marshal(&T{}) + c.Assert(err, IsNil) + }() + func() { + type T struct{ B int } + data, err = yaml.Marshal(&T{}) + c.Assert(err, IsNil) + }() + c.Assert(string(data), Equals, "b: 0\n") +} + +var marshalerTests = []struct { + data string + value interface{} +}{ + {"_:\n hi: there\n", map[interface{}]interface{}{"hi": "there"}}, + {"_:\n- 1\n- A\n", []interface{}{1, "A"}}, + {"_: 10\n", 10}, + {"_: null\n", nil}, + {"_: BAR!\n", "BAR!"}, +} + +type marshalerType struct { + value interface{} +} + +func (o marshalerType) MarshalText() ([]byte, error) { + panic("MarshalText called on type with MarshalYAML") +} + +func (o marshalerType) MarshalYAML() (interface{}, error) { + return o.value, nil +} + +type marshalerValue struct { + Field marshalerType "_" +} + +func (s *S) TestMarshaler(c *C) { + for _, item := range marshalerTests { + obj := &marshalerValue{} + obj.Field.value = item.value + data, err := yaml.Marshal(obj) + c.Assert(err, IsNil) + c.Assert(string(data), Equals, string(item.data)) + } +} + +func (s *S) TestMarshalerWholeDocument(c *C) { + obj := &marshalerType{} + obj.value = map[string]string{"hello": "world!"} + data, err := yaml.Marshal(obj) + c.Assert(err, IsNil) + c.Assert(string(data), Equals, "hello: world!\n") +} + +type failingMarshaler struct{} + +func (ft *failingMarshaler) MarshalYAML() (interface{}, error) { + return nil, failingErr +} + +func (s *S) TestMarshalerError(c *C) { + _, err := yaml.Marshal(&failingMarshaler{}) + c.Assert(err, Equals, failingErr) +} + +func (s *S) TestSortedOutput(c *C) { + order := []interface{}{ + false, + true, + 1, + uint(1), + 1.0, + 1.1, + 1.2, + 2, + uint(2), + 2.0, + 2.1, + "", + ".1", + ".2", + ".a", + "1", + "2", + "a!10", + "a/2", + "a/10", + "a~10", + "ab/1", + "b/1", + "b/01", + "b/2", + "b/02", + "b/3", + "b/03", + "b1", + "b01", + "b3", + "c2.10", + "c10.2", + "d1", + "d12", + "d12a", + } + m := make(map[interface{}]int) + for _, k := range order { + m[k] = 1 + } + data, err := yaml.Marshal(m) + c.Assert(err, IsNil) + out := "\n" + string(data) + last := 0 + for i, k := range order { + repr := fmt.Sprint(k) + if s, ok := k.(string); ok { + if _, err = strconv.ParseFloat(repr, 32); s == "" || err == nil { + repr = `"` + repr + `"` + } + } + index := strings.Index(out, "\n"+repr+":") + if index == -1 { + c.Fatalf("%#v is not in the output: %#v", k, out) + } + if index < last { + c.Fatalf("%#v was generated before %#v: %q", k, order[i-1], out) + } + last = index + } +} diff --git a/vendor/gopkg.in/yaml.v2/parserc.go b/vendor/gopkg.in/yaml.v2/parserc.go index 0cb2cf89ee..81d05dfe57 100644 --- a/vendor/gopkg.in/yaml.v2/parserc.go +++ b/vendor/gopkg.in/yaml.v2/parserc.go @@ -1,1095 +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 -} +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/gopkg.in/yaml.v2/readerc.go b/vendor/gopkg.in/yaml.v2/readerc.go index 4156f92d50..f450791717 100644 --- a/vendor/gopkg.in/yaml.v2/readerc.go +++ b/vendor/gopkg.in/yaml.v2/readerc.go @@ -1,394 +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 -} +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/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v2/resolve.go index ab9074c046..232313cc08 100644 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ b/vendor/gopkg.in/yaml.v2/resolve.go @@ -1,208 +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]) -} +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/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go index d2ce131bec..2c9d5111f9 100644 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/vendor/gopkg.in/yaml.v2/scannerc.go @@ -1,2710 +1,2710 @@ -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, "did not find URI escaped octet") -} - -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 && !(s[0] == '!' && s[1] == 0) { - 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 - - // 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 - } - } - - // Check if the tag is non-empty. - if len(s) == 0 { - 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 -} +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, "did not find URI escaped octet") +} + +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 && !(s[0] == '!' && s[1] == 0) { + 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 + + // 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 + } + } + + // Check if the tag is non-empty. + if len(s) == 0 { + 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/gopkg.in/yaml.v2/sorter.go b/vendor/gopkg.in/yaml.v2/sorter.go index f9c76d3689..5958822f9c 100644 --- a/vendor/gopkg.in/yaml.v2/sorter.go +++ b/vendor/gopkg.in/yaml.v2/sorter.go @@ -1,104 +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") -} +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/gopkg.in/yaml.v2/suite_test.go b/vendor/gopkg.in/yaml.v2/suite_test.go index 8b48a8bdb8..c5cf1ed4f6 100644 --- a/vendor/gopkg.in/yaml.v2/suite_test.go +++ b/vendor/gopkg.in/yaml.v2/suite_test.go @@ -1,12 +1,12 @@ -package yaml_test - -import ( - . "gopkg.in/check.v1" - "testing" -) - -func Test(t *testing.T) { TestingT(t) } - -type S struct{} - -var _ = Suite(&S{}) +package yaml_test + +import ( + . "gopkg.in/check.v1" + "testing" +) + +func Test(t *testing.T) { TestingT(t) } + +type S struct{} + +var _ = Suite(&S{}) diff --git a/vendor/gopkg.in/yaml.v2/writerc.go b/vendor/gopkg.in/yaml.v2/writerc.go index cca255d21f..190362f25d 100644 --- a/vendor/gopkg.in/yaml.v2/writerc.go +++ b/vendor/gopkg.in/yaml.v2/writerc.go @@ -1,89 +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 -} +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/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go index 9e8fc3ce0d..36d6b883a6 100644 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ b/vendor/gopkg.in/yaml.v2/yaml.go @@ -1,346 +1,346 @@ -// 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 -} - -// 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) { - defer handleErr(&err) - d := newDecoder() - 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 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 -} +// 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 +} + +// 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) { + defer handleErr(&err) + d := newDecoder() + 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 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/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v2/yamlh.go index 42567b6f86..d60a6b6b00 100644 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/vendor/gopkg.in/yaml.v2/yamlh.go @@ -1,716 +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 occured. - 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. -} +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 occured. + 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/gopkg.in/yaml.v2/yamlprivateh.go b/vendor/gopkg.in/yaml.v2/yamlprivateh.go index 372e3ebb51..8110ce3c37 100644 --- a/vendor/gopkg.in/yaml.v2/yamlprivateh.go +++ b/vendor/gopkg.in/yaml.v2/yamlprivateh.go @@ -1,173 +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 - -} +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 + +} From 638031bc91dcde2c509e745494560d1cf78106ea Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Thu, 18 May 2017 15:25:40 -0700 Subject: [PATCH 04/13] Rebase and update translation for update and deploy command --- cmd/deploy.go | 34 ++++++++++++-- cmd/generate.go | 7 +-- cmd/upgrade.go | 29 +++++++++++- pkg/acsengine/transform.go | 31 +++++++------ pkg/api/upgradeapiloader.go | 25 ++++++---- .../kubernetes162upgrademasternode.go | 13 +++++- pkg/operations/kubernetes162upgrader.go | 18 +++++--- pkg/operations/upgradecluster.go | 10 ++-- scripts/update-translation.sh | 2 +- translations/default/LC_MESSAGES/acsengine.mo | Bin 1352 -> 2129 bytes translations/default/LC_MESSAGES/acsengine.po | 43 +++++++++++++++--- translations/en_US/LC_MESSAGES/acsengine.mo | Bin 1352 -> 2129 bytes translations/en_US/LC_MESSAGES/acsengine.po | 43 +++++++++++++++--- translations/zh_CN/LC_MESSAGES/acsengine.mo | Bin 1297 -> 2011 bytes translations/zh_CN/LC_MESSAGES/acsengine.po | 41 +++++++++++++++-- 15 files changed, 236 insertions(+), 60 deletions(-) diff --git a/cmd/deploy.go b/cmd/deploy.go index ed8c05bef1..5fe3f80979 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -8,6 +8,7 @@ import ( "time" log "github.com/Sirupsen/logrus" + "github.com/leonelquinteros/gotext" "github.com/spf13/cobra" "encoding/json" @@ -15,6 +16,7 @@ import ( "github.com/Azure/acs-engine/pkg/acsengine" "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/armhelpers" + "github.com/Azure/acs-engine/pkg/i18n" ) const ( @@ -24,6 +26,7 @@ const ( ) type deployCmd struct { + translationsDirectory string authArgs apimodelPath string @@ -37,6 +40,7 @@ type deployCmd struct { // derived containerService *api.ContainerService apiVersion string + locale *gotext.Locale // experimental client armhelpers.ACSEngineClient @@ -60,6 +64,7 @@ func newDeployCmd() *cobra.Command { } f := deployCmd.Flags() + f.StringVar(&dc.translationsDirectory, "translations-directory", "", "translations directory (translations in the current directory if absent)") f.StringVar(&dc.apimodelPath, "api-model", "", "") f.StringVar(&dc.outputDirectory, "output-directory", "", "output directory (derived from FQDN if absent)") f.StringVar(&dc.caCertificatePath, "ca-certificate-path", "", "path to the CA certificate to use for Kubernetes PKI assets") @@ -78,6 +83,13 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) { var caKeyBytes []byte var err error + dc.locale, err = i18n.LoadTranslations(dc.translationsDirectory) + if err != nil { + log.Fatalf("error loading translation files: %s", err.Error()) + } + + i18n.Initialize(dc.locale) + if dc.apimodelPath == "" { if len(args) > 0 { dc.apimodelPath = args[0] @@ -94,7 +106,12 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) { log.Fatalf("specified api model does not exist (%s)", dc.apimodelPath) } - dc.containerService, dc.apiVersion, err = api.LoadContainerServiceFromFile(dc.apimodelPath) + apiloader := &api.Apiloader{ + Translator: &i18n.Translator{ + Locale: dc.locale, + }, + } + dc.containerService, dc.apiVersion, err = apiloader.LoadContainerServiceFromFile(dc.apimodelPath) if err != nil { log.Fatalf("error parsing the api model: %s", err.Error()) } @@ -129,7 +146,13 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) { } func (dc *deployCmd) run() error { - templateGenerator, err := acsengine.InitializeTemplateGenerator(dc.classicMode) + ctx := acsengine.Context{ + Translator: &i18n.Translator{ + Locale: dc.locale, + }, + } + + templateGenerator, err := acsengine.InitializeTemplateGenerator(ctx, dc.classicMode) if err != nil { log.Fatalln("failed to initialize template generator: %s", err.Error()) } @@ -148,7 +171,12 @@ func (dc *deployCmd) run() error { log.Fatalf("error pretty printing template parameters: %s \n", err.Error()) } - if err = acsengine.WriteArtifacts(dc.containerService, dc.apiVersion, template, parameters, dc.outputDirectory, certsgenerated, dc.parametersOnly); err != nil { + writer := &acsengine.ArtifactWriter{ + Translator: &i18n.Translator{ + Locale: dc.locale, + }, + } + if err = writer.WriteArtifacts(dc.containerService, dc.apiVersion, template, parameters, dc.outputDirectory, certsgenerated, dc.parametersOnly); err != nil { log.Fatalf("error writing artifacts: %s \n", err.Error()) } diff --git a/cmd/generate.go b/cmd/generate.go index f48bb3af39..d2c7bf8c16 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -7,11 +7,12 @@ import ( log "github.com/Sirupsen/logrus" "github.com/spf13/cobra" + "io/ioutil" + "github.com/Azure/acs-engine/pkg/acsengine" "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/i18n" "github.com/leonelquinteros/gotext" - "io/ioutil" ) const ( @@ -67,12 +68,12 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) { var caKeyBytes []byte var err error - gc.locale, err := i18n.LoadTranslations(gc.translationsDirectory) + gc.locale, err = i18n.LoadTranslations(gc.translationsDirectory) if err != nil { log.Fatalf("error loading translation files: %s", err.Error()) } - i18n.Initialize(locale) + i18n.Initialize(gc.locale) if gc.apimodelPath == "" { if len(args) > 0 { diff --git a/cmd/upgrade.go b/cmd/upgrade.go index da36efa5c7..d345c66f62 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -6,7 +6,9 @@ import ( "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/armhelpers" + "github.com/Azure/acs-engine/pkg/i18n" "github.com/Azure/acs-engine/pkg/operations" + "github.com/leonelquinteros/gotext" log "github.com/Sirupsen/logrus" "github.com/spf13/cobra" @@ -19,6 +21,7 @@ const ( ) type upgradeCmd struct { + translationsDirectory string authArgs // user input @@ -32,6 +35,7 @@ type upgradeCmd struct { upgradeContainerService *api.UpgradeContainerService upgradeAPIVersion string client armhelpers.ACSEngineClient + locale *gotext.Locale } // NewUpgradeCmd run a command to upgrade a Kubernetes cluster @@ -48,6 +52,7 @@ func newUpgradeCmd() *cobra.Command { } f := upgradeCmd.Flags() + f.StringVar(&uc.translationsDirectory, "translations-directory", "", "translations directory (translations in the current directory if absent)") f.StringVar(&uc.resourceGroupName, "resource-group", "", "the resource group where the cluster is deployed") f.StringVar(&uc.deploymentDirectory, "deployment-dir", "", "the location of the output from `generate`") f.StringVar(&uc.upgradeModelFile, "upgrademodel-file", "", "file path to upgrade API model") @@ -61,6 +66,13 @@ func (uc *upgradeCmd) validate(cmd *cobra.Command, args []string) { var err error + uc.locale, err = i18n.LoadTranslations(uc.translationsDirectory) + if err != nil { + log.Fatalf("error loading translation files: %s", err.Error()) + } + + i18n.Initialize(uc.locale) + if uc.resourceGroupName == "" { cmd.Usage() log.Fatal("--resource-group must be specified") @@ -88,7 +100,12 @@ func (uc *upgradeCmd) validate(cmd *cobra.Command, args []string) { log.Fatalf("specified api model does not exist (%s)", apiModelPath) } - uc.containerService, uc.apiVersion, err = api.LoadContainerServiceFromFile(apiModelPath) + apiloader := &api.Apiloader{ + Translator: &i18n.Translator{ + Locale: uc.locale, + }, + } + uc.containerService, uc.apiVersion, err = apiloader.LoadContainerServiceFromFile(apiModelPath) if err != nil { log.Fatalf("error parsing the api model: %s", err.Error()) } @@ -97,7 +114,12 @@ func (uc *upgradeCmd) validate(cmd *cobra.Command, args []string) { log.Fatalf("specified upgrade model file does not exist (%s)", uc.upgradeModelFile) } - uc.upgradeContainerService, uc.upgradeAPIVersion, err = api.LoadUpgradeContainerServiceFromFile(uc.upgradeModelFile) + upgradeapiloader := &api.UpgradeApiloader{ + Translator: &i18n.Translator{ + Locale: uc.locale, + }, + } + uc.upgradeContainerService, uc.upgradeAPIVersion, err = upgradeapiloader.LoadUpgradeContainerServiceFromFile(uc.upgradeModelFile) if err != nil { log.Fatalf("error parsing the upgrade api model: %s", err.Error()) } @@ -115,6 +137,9 @@ func (uc *upgradeCmd) run(cmd *cobra.Command, args []string) error { uc.validate(cmd, args) upgradeCluster := operations.UpgradeCluster{ + Translator: &i18n.Translator{ + Locale: uc.locale, + }, Client: uc.client, } diff --git a/pkg/acsengine/transform.go b/pkg/acsengine/transform.go index e0daac3a49..3e1c0a9575 100644 --- a/pkg/acsengine/transform.go +++ b/pkg/acsengine/transform.go @@ -1,9 +1,9 @@ package acsengine import ( - "fmt" "strings" + "github.com/Azure/acs-engine/pkg/i18n" "github.com/Sirupsen/logrus" ) @@ -31,9 +31,14 @@ const ( vmExtensionType = "Microsoft.Compute/virtualMachines/extensions" ) +// Transformer represents the object that transforms template +type Transformer struct { + Translator *i18n.Translator +} + // NormalizeForVMSSScaling takes a template and removes elements that are unwanted in a VMSS scale up/down case -func NormalizeForVMSSScaling(logger *logrus.Entry, templateMap map[string]interface{}) error { - if err := NormalizeMasterResourcesForScaling(logger, templateMap); err != nil { +func (t *Transformer) NormalizeForVMSSScaling(logger *logrus.Entry, templateMap map[string]interface{}) error { + if err := t.NormalizeMasterResourcesForScaling(logger, templateMap); err != nil { return err } @@ -62,7 +67,7 @@ func NormalizeForVMSSScaling(logger *logrus.Entry, templateMap map[string]interf continue } - if !removeCustomData(logger, virtualMachineProfile) || !removeImageReference(logger, virtualMachineProfile) { + if !t.removeCustomData(logger, virtualMachineProfile) || !t.removeImageReference(logger, virtualMachineProfile) { continue } } @@ -70,8 +75,8 @@ func NormalizeForVMSSScaling(logger *logrus.Entry, templateMap map[string]interf } // NormalizeForK8sVMASScalingUp takes a template and removes elements that are unwanted in a K8s VMAS scale up/down case -func NormalizeForK8sVMASScalingUp(logger *logrus.Entry, templateMap map[string]interface{}) error { - if err := NormalizeMasterResourcesForScaling(logger, templateMap); err != nil { +func (t *Transformer) NormalizeForK8sVMASScalingUp(logger *logrus.Entry, templateMap map[string]interface{}) error { + if err := t.NormalizeMasterResourcesForScaling(logger, templateMap); err != nil { return err } nsgIndex := -1 @@ -86,7 +91,7 @@ func NormalizeForK8sVMASScalingUp(logger *logrus.Entry, templateMap map[string]i resourceType, ok := resourceMap[typeFieldName].(string) if ok && resourceType == nsgResourceType { if nsgIndex != -1 { - err := fmt.Errorf("Found 2 resources with type %s in the template. There should only be 1", nsgResourceType) + err := t.Translator.Errorf("Found 2 resources with type %s in the template. There should only be 1", nsgResourceType) logger.Errorf(err.Error()) return err } @@ -109,7 +114,7 @@ func NormalizeForK8sVMASScalingUp(logger *logrus.Entry, templateMap map[string]i resourceMap[dependsOnFieldName] = dependencies } if nsgIndex == -1 { - err := fmt.Errorf("Found no resources with type %s in the template. There should have been 1", nsgResourceType) + err := t.Translator.Errorf("Found no resources with type %s in the template. There should have been 1", nsgResourceType) logger.Errorf(err.Error()) return err } @@ -120,7 +125,7 @@ func NormalizeForK8sVMASScalingUp(logger *logrus.Entry, templateMap map[string]i } // NormalizeMasterResourcesForScaling takes a template and removes elements that are unwanted in any scale up/down case -func NormalizeMasterResourcesForScaling(logger *logrus.Entry, templateMap map[string]interface{}) error { +func (t *Transformer) NormalizeMasterResourcesForScaling(logger *logrus.Entry, templateMap map[string]interface{}) error { resources := templateMap[resourcesFieldName].([]interface{}) //update master nodes resources for _, resource := range resources { @@ -162,7 +167,7 @@ func NormalizeMasterResourcesForScaling(logger *logrus.Entry, templateMap map[st delete(hardwareProfile, vmSizeFieldName) } - if !removeCustomData(logger, resourceProperties) || !removeImageReference(logger, resourceProperties) { + if !t.removeCustomData(logger, resourceProperties) || !t.removeImageReference(logger, resourceProperties) { continue } } @@ -170,7 +175,7 @@ func NormalizeMasterResourcesForScaling(logger *logrus.Entry, templateMap map[st return nil } -func removeCustomData(logger *logrus.Entry, resourceProperties map[string]interface{}) bool { +func (t *Transformer) removeCustomData(logger *logrus.Entry, resourceProperties map[string]interface{}) bool { osProfile, ok := resourceProperties[osProfileFieldName].(map[string]interface{}) if !ok { logger.Warnf("Template improperly formatted") @@ -183,7 +188,7 @@ func removeCustomData(logger *logrus.Entry, resourceProperties map[string]interf return ok } -func removeImageReference(logger *logrus.Entry, resourceProperties map[string]interface{}) bool { +func (t *Transformer) removeImageReference(logger *logrus.Entry, resourceProperties map[string]interface{}) bool { storageProfile, ok := resourceProperties[storageProfileFieldName].(map[string]interface{}) if !ok { logger.Warnf("Template improperly formatted") @@ -197,7 +202,7 @@ func removeImageReference(logger *logrus.Entry, resourceProperties map[string]in } // NormalizeResourcesForK8sMasterUpgrade takes a template and removes elements that are unwanted in any scale up/down case -func NormalizeResourcesForK8sMasterUpgrade(logger *logrus.Entry, templateMap map[string]interface{}) error { +func (t *Transformer) NormalizeResourcesForK8sMasterUpgrade(logger *logrus.Entry, templateMap map[string]interface{}) error { var computeResourceTypes = []string{vmResourceType, vmExtensionType} for _, computeResourceType := range computeResourceTypes { diff --git a/pkg/api/upgradeapiloader.go b/pkg/api/upgradeapiloader.go index 46dc645546..4c857cef51 100644 --- a/pkg/api/upgradeapiloader.go +++ b/pkg/api/upgradeapiloader.go @@ -2,35 +2,40 @@ package api import ( "encoding/json" - "fmt" "io/ioutil" "github.com/Azure/acs-engine/pkg/api/vlabs" + "github.com/Azure/acs-engine/pkg/i18n" ) +// UpgradeApiloader represents the object that loads api model +type UpgradeApiloader struct { + Translator *i18n.Translator +} + // LoadUpgradeContainerServiceFromFile loads an ACS Cluster API Model from a JSON file -func LoadUpgradeContainerServiceFromFile(jsonFile string) (*UpgradeContainerService, string, error) { +func (ua *UpgradeApiloader) LoadUpgradeContainerServiceFromFile(jsonFile string) (*UpgradeContainerService, string, error) { contents, e := ioutil.ReadFile(jsonFile) if e != nil { - return nil, "", fmt.Errorf("error reading file %s: %s", jsonFile, e.Error()) + return nil, "", ua.Translator.Errorf("error reading file %s: %s", jsonFile, e.Error()) } - return DeserializeUpgradeContainerService(contents) + return ua.DeserializeUpgradeContainerService(contents) } // DeserializeUpgradeContainerService loads an ACS Cluster API Model, validates it, and returns the unversioned representation -func DeserializeUpgradeContainerService(contents []byte) (*UpgradeContainerService, string, error) { +func (ua *UpgradeApiloader) DeserializeUpgradeContainerService(contents []byte) (*UpgradeContainerService, string, error) { m := &TypeMeta{} if err := json.Unmarshal(contents, &m); err != nil { return nil, "", err } version := m.APIVersion - upgradecontainerservice, err := LoadUpgradeContainerService(contents, version) + upgradecontainerservice, err := ua.LoadUpgradeContainerService(contents, version) return upgradecontainerservice, version, err } // LoadUpgradeContainerService loads an ACS Cluster API Model, validates it, and returns the unversioned representation -func LoadUpgradeContainerService(contents []byte, version string) (*UpgradeContainerService, error) { +func (ua *UpgradeApiloader) LoadUpgradeContainerService(contents []byte, version string) (*UpgradeContainerService, error) { switch version { case vlabs.APIVersion: upgradecontainerService := &vlabs.UpgradeContainerService{} @@ -43,12 +48,12 @@ func LoadUpgradeContainerService(contents []byte, version string) (*UpgradeConta return ConvertVLabsUpgradeContainerService(upgradecontainerService), nil default: - return nil, fmt.Errorf("unrecognized APIVersion '%s'", version) + return nil, ua.Translator.Errorf("unrecognized APIVersion '%s'", version) } } // SerializeUpgradeContainerService takes an unversioned container service and returns the bytes -func SerializeUpgradeContainerService(upgradeContainerService *UpgradeContainerService, version string) ([]byte, error) { +func (ua *UpgradeApiloader) SerializeUpgradeContainerService(upgradeContainerService *UpgradeContainerService, version string) ([]byte, error) { switch version { case vlabs.APIVersion: vlabsUpgradeContainerService := ConvertUpgradeContainerServiceToVLabs(upgradeContainerService) @@ -62,6 +67,6 @@ func SerializeUpgradeContainerService(upgradeContainerService *UpgradeContainerS return b, nil default: - return nil, fmt.Errorf("invalid version %s for conversion back from unversioned object", version) + return nil, ua.Translator.Errorf("invalid version %s for conversion back from unversioned object", version) } } diff --git a/pkg/operations/kubernetes162upgrademasternode.go b/pkg/operations/kubernetes162upgrademasternode.go index 08f15851cd..5cf53579c1 100644 --- a/pkg/operations/kubernetes162upgrademasternode.go +++ b/pkg/operations/kubernetes162upgrademasternode.go @@ -10,6 +10,7 @@ import ( "github.com/Azure/acs-engine/pkg/acsengine" "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/armhelpers" + "github.com/Azure/acs-engine/pkg/i18n" log "github.com/Sirupsen/logrus" ) @@ -18,6 +19,7 @@ var _ UpgradeNode = &UpgradeMasterNode{} // UpgradeMasterNode upgrades a Kubernetes 1.5.3 master node to 1.6.2 type UpgradeMasterNode struct { + Translator *i18n.Translator TemplateMap map[string]interface{} ParametersMap map[string]interface{} UpgradeContainerService *api.ContainerService @@ -43,7 +45,10 @@ func (kmn *UpgradeMasterNode) CreateNode(countForOffset int) error { masterOffset, _ := templateVariables["masterOffset"] log.Infoln(fmt.Sprintf("Master offset: %v", masterOffset)) - if err := acsengine.NormalizeResourcesForK8sMasterUpgrade(log.NewEntry(log.New()), kmn.TemplateMap); err != nil { + transformer := &acsengine.Transformer{ + Translator: kmn.Translator, + } + if err := transformer.NormalizeResourcesForK8sMasterUpgrade(log.NewEntry(log.New()), kmn.TemplateMap); err != nil { log.Fatalln(err) return err } @@ -61,7 +66,11 @@ func (kmn *UpgradeMasterNode) CreateNode(countForOffset int) error { log.Fatalf("error pretty printing template parameters: %s \n", e.Error()) } outputDirectory := path.Join("_output", kmn.UpgradeContainerService.Properties.MasterProfile.DNSPrefix, "Upgrade") - if err := acsengine.WriteArtifacts(kmn.UpgradeContainerService, "vlabs", templateapp, parametersapp, outputDirectory, false, false); err != nil { + + writer := &acsengine.ArtifactWriter{ + Translator: kmn.Translator, + } + if err := writer.WriteArtifacts(kmn.UpgradeContainerService, "vlabs", templateapp, parametersapp, outputDirectory, false, false); err != nil { log.Fatalf("error writing artifacts: %s \n", err.Error()) } // ************************ diff --git a/pkg/operations/kubernetes162upgrader.go b/pkg/operations/kubernetes162upgrader.go index 369b984cce..cd4f01eec8 100644 --- a/pkg/operations/kubernetes162upgrader.go +++ b/pkg/operations/kubernetes162upgrader.go @@ -2,11 +2,11 @@ package operations import ( "encoding/json" - "fmt" "github.com/Azure/acs-engine/pkg/acsengine" "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/armhelpers" + "github.com/Azure/acs-engine/pkg/i18n" ) // Compiler to verify QueueMessageProcessor implements OperationsProcessor @@ -14,6 +14,7 @@ var _ UpgradeWorkFlow = &Kubernetes162upgrader{} // Kubernetes162upgrader upgrades a Kubernetes 1.5.3 cluster to 1.6.2 type Kubernetes162upgrader struct { + Translator *i18n.Translator ClusterTopology Client armhelpers.ACSEngineClient } @@ -22,7 +23,7 @@ type Kubernetes162upgrader struct { func (ku *Kubernetes162upgrader) ClusterPreflightCheck() error { // Check that current cluster is 1.5.3 if ku.DataModel.Properties.OrchestratorProfile.OrchestratorVersion != api.Kubernetes153 { - return fmt.Errorf("Upgrade to Kubernetes 1.6.2 is not supported from version: %s", ku.DataModel.Properties.OrchestratorProfile.OrchestratorVersion) + return ku.Translator.Errorf("Upgrade to Kubernetes 1.6.2 is not supported from version: %s", ku.DataModel.Properties.OrchestratorProfile.OrchestratorVersion) } return nil @@ -37,15 +38,18 @@ func (ku *Kubernetes162upgrader) RunUpgrade() error { upgradeContainerService := ku.ClusterTopology.DataModel upgradeContainerService.Properties.OrchestratorProfile.OrchestratorVersion = api.Kubernetes162 - templateGenerator, err := acsengine.InitializeTemplateGenerator(false) + ctx := acsengine.Context{ + Translator: ku.Translator, + } + templateGenerator, err := acsengine.InitializeTemplateGenerator(ctx, false) if err != nil { - return fmt.Errorf("failed to initialize template generator: %s", err.Error()) + return ku.Translator.Errorf("failed to initialize template generator: %s", err.Error()) } var templateJSON string var parametersJSON string if templateJSON, parametersJSON, _, err = templateGenerator.GenerateTemplate(upgradeContainerService); err != nil { - return fmt.Errorf("error generating upgrade template: %s", err.Error()) + return ku.Translator.Errorf("error generating upgrade template: %s", err.Error()) } var template interface{} @@ -57,7 +61,9 @@ func (ku *Kubernetes162upgrader) RunUpgrade() error { loopCount := 1 - upgradeMasterNode := UpgradeMasterNode{} + upgradeMasterNode := UpgradeMasterNode{ + Translator: ku.Translator, + } upgradeMasterNode.TemplateMap = templateMap upgradeMasterNode.ParametersMap = parametersMap upgradeMasterNode.UpgradeContainerService = upgradeContainerService diff --git a/pkg/operations/upgradecluster.go b/pkg/operations/upgradecluster.go index f30a367f53..bb4dee3dca 100644 --- a/pkg/operations/upgradecluster.go +++ b/pkg/operations/upgradecluster.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/armhelpers" + "github.com/Azure/acs-engine/pkg/i18n" "github.com/Azure/azure-sdk-for-go/arm/compute" log "github.com/Sirupsen/logrus" "github.com/satori/go.uuid" @@ -26,6 +27,7 @@ type ClusterTopology struct { // (or X.X or X.X.X) to version y (or Y.Y or X.X.X). RIght now // upgrades are supported for Kubernetes cluster only. type UpgradeCluster struct { + Translator *i18n.Translator ClusterTopology Client armhelpers.ACSEngineClient @@ -44,20 +46,22 @@ func (uc *UpgradeCluster) UpgradeCluster(subscriptionID uuid.UUID, resourceGroup uc.AgentVMs = &[]compute.VirtualMachine{} if err := uc.getUpgradableResources(subscriptionID, resourceGroup); err != nil { - return fmt.Errorf("Error while querying ARM for resources: %+v", err) + return uc.Translator.Errorf("Error while querying ARM for resources: %+v", err) } switch ucs.OrchestratorProfile.OrchestratorVersion { case api.Kubernetes162: log.Infoln(fmt.Sprintf("Upgrading to Kubernetes 1.6.2")) - upgrader := Kubernetes162upgrader{} + upgrader := Kubernetes162upgrader{ + Translator: uc.Translator, + } upgrader.ClusterTopology = uc.ClusterTopology upgrader.Client = uc.Client if err := upgrader.RunUpgrade(); err != nil { return err } default: - return fmt.Errorf("Upgrade to Kubernetes 1.6.2 is not supported from version: %s", + return uc.Translator.Errorf("Upgrade to Kubernetes 1.6.2 is not supported from version: %s", uc.DataModel.Properties.OrchestratorProfile.OrchestratorVersion) } diff --git a/scripts/update-translation.sh b/scripts/update-translation.sh index 39f2a9fdc5..e79f06f14d 100644 --- a/scripts/update-translation.sh +++ b/scripts/update-translation.sh @@ -1,6 +1,6 @@ #!/bin/bash -GO_SOURCE="pkg/acsengine/*.go pkg/api/*.go" +GO_SOURCE="pkg/acsengine/*.go pkg/api/*.go pkg/operations/*.go" LANGUAGE="en_US" DOMAIN="acsengine" generate_po="false" diff --git a/translations/default/LC_MESSAGES/acsengine.mo b/translations/default/LC_MESSAGES/acsengine.mo index 345731a5a1ff116adcf85ff4740d19cc5b20a050..bc7277f58c6cd25d62cf07282878e28442c09fb3 100644 GIT binary patch literal 2129 zcmeH{&yE{K5XKuw2p9+uB>o5xmBT7Qn|8)VOIEWu5W;S>AuFuK8*xM9net4BakuI2 zan|Gok_SNI0pJ2>o*|c>T%e*gv@kHDbg)8`u<_rRdzJ{WZT z1qK~wPBr^)w%iAUjuH$yegX;n0}MJIfkDUHFElzfK*$il69caGfMoF!EY$MldPWGy z6R*KKuvcIxhjOl$4})zdNlwhp(8@aFr9?IQSH z+25l{z0R4+rtILlJ{LQt(i!y;uAQda$`|Apvk;Y(CSNdlp3cg|bC*U1TP9bSs?5mf zazSIJUK>W6{}!i6=8QP35$Rx-+a$x5hQ6%EY&Cm!)a!oS?UQn(jVD*lX2yEXXkyKj z=4_oZx=x+z+N3Cs4@qara_Ws;(782t?wAK3a$40c%hc-Pw8ezuTr{C_)@++#)lyko zjAP+u2_&qVacuo#ZK~Hy5_BdD87i&3N=o&^s>IapXl(7P^c?TAWs;#Mp^K@}ZQ3+W z((jr=RLeO8H{)B#To{`c>^w5SqELfS!%81jP^{8#&Jkq>oIayOIhnwUEK92zJ0T&^J9Gysi?R zqtu#iDEj2q@~Kpx6~<4|k8WzFm$6RgRg$wDaWai*Tj!;6#nE(3tiL_@y0f>tx4p`$ z*Nr+?jrOduC+vHHX;=(AsMQMSv!G3Ts+L4UX1Vzw`79adf_)ej$wh IzkVV91@ne*\n" "Language-Team: English\n" "Language: en_US\n" @@ -23,6 +23,27 @@ msgstr "" msgid "Error reading file %s, Error: %s" msgstr "Error reading file %s, Error: %s" +#: pkg/operations/upgradecluster.go:49 +#, c-format +msgid "Error while querying ARM for resources: %+v" +msgstr "Error while querying ARM for resources: %+v" + +#: pkg/acsengine/transform.go:94 +#, c-format +msgid "Found 2 resources with type %s in the template. There should only be 1" +msgstr "Found 2 resources with type %s in the template. There should only be 1" + +#: pkg/acsengine/transform.go:117 +#, c-format +msgid "Found no resources with type %s in the template. There should have been 1" +msgstr "Found no resources with type %s in the template. There should have been 1" + +#: pkg/operations/kubernetes162upgrader.go:26 +#: pkg/operations/upgradecluster.go:64 +#, c-format +msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" +msgstr "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" + #: pkg/acsengine/output.go:109 #, c-format msgid "error creating directory '%s': %s" @@ -33,17 +54,27 @@ msgstr "error creating directory '%s': %s" msgid "error executing template for file %s: %v" msgstr "error executing template for file %s: %v" +#: pkg/operations/kubernetes162upgrader.go:52 +#, c-format +msgid "error generating upgrade template: %s" +msgstr "error generating upgrade template: %s" + #: pkg/acsengine/engine.go:1011 #, c-format msgid "error parsing file %s: %v" msgstr "error parsing file %s: %v" -#: pkg/api/apiloader.go:23 +#: pkg/api/apiloader.go:23 pkg/api/upgradeapiloader.go:20 #, c-format msgid "error reading file %s: %s" msgstr "error reading file %s: %s" -#: pkg/api/apiloader.go:136 +#: pkg/operations/kubernetes162upgrader.go:46 +#, c-format +msgid "failed to initialize template generator: %s" +msgstr "failed to initialize template generator: %s" + +#: pkg/api/apiloader.go:136 pkg/api/upgradeapiloader.go:70 #, c-format msgid "invalid version %s for conversion back from unversioned object" msgstr "invalid version %s for conversion back from unversioned object" @@ -58,7 +89,7 @@ msgstr "orchestrator '%s' is unsupported" msgid "template file %s does not exist" msgstr "template file %s does not exist" -#: pkg/api/apiloader.go:84 +#: pkg/api/apiloader.go:84 pkg/api/upgradeapiloader.go:51 #, c-format msgid "unrecognized APIVersion '%s'" msgstr "unrecognized APIVersion '%s'" diff --git a/translations/en_US/LC_MESSAGES/acsengine.mo b/translations/en_US/LC_MESSAGES/acsengine.mo index 345731a5a1ff116adcf85ff4740d19cc5b20a050..bc7277f58c6cd25d62cf07282878e28442c09fb3 100644 GIT binary patch literal 2129 zcmeH{&yE{K5XKuw2p9+uB>o5xmBT7Qn|8)VOIEWu5W;S>AuFuK8*xM9net4BakuI2 zan|Gok_SNI0pJ2>o*|c>T%e*gv@kHDbg)8`u<_rRdzJ{WZT z1qK~wPBr^)w%iAUjuH$yegX;n0}MJIfkDUHFElzfK*$il69caGfMoF!EY$MldPWGy z6R*KKuvcIxhjOl$4})zdNlwhp(8@aFr9?IQSH z+25l{z0R4+rtILlJ{LQt(i!y;uAQda$`|Apvk;Y(CSNdlp3cg|bC*U1TP9bSs?5mf zazSIJUK>W6{}!i6=8QP35$Rx-+a$x5hQ6%EY&Cm!)a!oS?UQn(jVD*lX2yEXXkyKj z=4_oZx=x+z+N3Cs4@qara_Ws;(782t?wAK3a$40c%hc-Pw8ezuTr{C_)@++#)lyko zjAP+u2_&qVacuo#ZK~Hy5_BdD87i&3N=o&^s>IapXl(7P^c?TAWs;#Mp^K@}ZQ3+W z((jr=RLeO8H{)B#To{`c>^w5SqELfS!%81jP^{8#&Jkq>oIayOIhnwUEK92zJ0T&^J9Gysi?R zqtu#iDEj2q@~Kpx6~<4|k8WzFm$6RgRg$wDaWai*Tj!;6#nE(3tiL_@y0f>tx4p`$ z*Nr+?jrOduC+vHHX;=(AsMQMSv!G3Ts+L4UX1Vzw`79adf_)ej$wh IzkVV91@ne*\n" "Language-Team: English\n" "Language: en_US\n" @@ -23,6 +23,27 @@ msgstr "" msgid "Error reading file %s, Error: %s" msgstr "Error reading file %s, Error: %s" +#: pkg/operations/upgradecluster.go:49 +#, c-format +msgid "Error while querying ARM for resources: %+v" +msgstr "Error while querying ARM for resources: %+v" + +#: pkg/acsengine/transform.go:94 +#, c-format +msgid "Found 2 resources with type %s in the template. There should only be 1" +msgstr "Found 2 resources with type %s in the template. There should only be 1" + +#: pkg/acsengine/transform.go:117 +#, c-format +msgid "Found no resources with type %s in the template. There should have been 1" +msgstr "Found no resources with type %s in the template. There should have been 1" + +#: pkg/operations/kubernetes162upgrader.go:26 +#: pkg/operations/upgradecluster.go:64 +#, c-format +msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" +msgstr "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" + #: pkg/acsengine/output.go:109 #, c-format msgid "error creating directory '%s': %s" @@ -33,17 +54,27 @@ msgstr "error creating directory '%s': %s" msgid "error executing template for file %s: %v" msgstr "error executing template for file %s: %v" +#: pkg/operations/kubernetes162upgrader.go:52 +#, c-format +msgid "error generating upgrade template: %s" +msgstr "error generating upgrade template: %s" + #: pkg/acsengine/engine.go:1011 #, c-format msgid "error parsing file %s: %v" msgstr "error parsing file %s: %v" -#: pkg/api/apiloader.go:23 +#: pkg/api/apiloader.go:23 pkg/api/upgradeapiloader.go:20 #, c-format msgid "error reading file %s: %s" msgstr "error reading file %s: %s" -#: pkg/api/apiloader.go:136 +#: pkg/operations/kubernetes162upgrader.go:46 +#, c-format +msgid "failed to initialize template generator: %s" +msgstr "failed to initialize template generator: %s" + +#: pkg/api/apiloader.go:136 pkg/api/upgradeapiloader.go:70 #, c-format msgid "invalid version %s for conversion back from unversioned object" msgstr "invalid version %s for conversion back from unversioned object" @@ -58,7 +89,7 @@ msgstr "orchestrator '%s' is unsupported" msgid "template file %s does not exist" msgstr "template file %s does not exist" -#: pkg/api/apiloader.go:84 +#: pkg/api/apiloader.go:84 pkg/api/upgradeapiloader.go:51 #, c-format msgid "unrecognized APIVersion '%s'" msgstr "unrecognized APIVersion '%s'" diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.mo b/translations/zh_CN/LC_MESSAGES/acsengine.mo index b22463d02498df91bccdecb4e1b3a3594a98b5c0..538271354751ef04ee3f613c8381b7c53b0e1aa8 100644 GIT binary patch delta 1023 zcmb7=T}V@57{}k~{K#7N0ew*BV=xR1bAy=)21N-Kb`f>i#cZ$JiFwX?&)LKXW+AxY zH(Q3HiK0wIP!na%An2y+2)qe`Xynbkhs}^E>A`&+~tu=NYZ|QW^bv z%>I($9EHw8bI?iXq74t67)W3otOFOpR&Wcv1y&U?)&ly$8gL%G0Dc6W;4knrc%s;1 z18Dl(2Cp&}Wf8m(0_$KkxCNSx{07f}$L)+g#ATO2({QlF%3A}k;QKS!2s%nF;~QWV zzC+-7a0oPgR}1k^1#W}2xSu)7EF%wi3W*A6b{qrE!r4On1BgCYIkf-a*UmxD>>y-r z^UzL&G4#idKoyV!!a`UjbO0(f%`g}{oN(Bj(VIdjg1Q1ykkgYe7u}NVr)&4xr~_fa zRV6GQakZJ8brII8gk>MO_rlaAX#vu@L!6u{Nit~xP8#nF1-%-tr~3geIH>_89Q2VQ z2fL}AldE7OE2dA>^8X*BfH%Tn#AR4L2>FHAhdULz6K>~1<{DSYRo__eCP^h((MS!4 zLWaY8;+uTI2RrI~*g`P>~m*@52 zMPo9aP4^&;S(V0{8HB9*e^j>YmhRQ%;xS`#3I5sippjfQ2A=DKeYs3ZkFD(AXX0n^ x^-3e2%FhfKV}04p4RbT+>}|DrY)Vh{>jPs}6S?HH5gXCR7ycekO+2=z{s6$)JG=k@ delta 337 zcmY+;v1`IW6vy!wFDBJkY{a3`6k|bfs!cQ$Ln(CV*g~PJ|3F*eo0y;;=5iTo&$a}HK`fhBX-w=*BG$Nm6Maf<2SZ%haL zW&0cC-Gj2S?g$GcPq-$Gk|J@WDq^$P7oQTj*MX|)Pot!#xhL(Z%lWHPM*b>_JCS}j Z8}_vyhH*ET&&*>(53M`Bux@l@&$c{7BAWmJ diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.po b/translations/zh_CN/LC_MESSAGES/acsengine.po index ccd03d4bce..8b2688dc9b 100644 --- a/translations/zh_CN/LC_MESSAGES/acsengine.po +++ b/translations/zh_CN/LC_MESSAGES/acsengine.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-18 05:35+0000\n" -"PO-Revision-Date: 2017-05-17 22:41-0700\n" +"POT-Creation-Date: 2017-05-18 22:07+0000\n" +"PO-Revision-Date: 2017-05-18 15:18-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: Chinese (simplified)\n" "Language: zh_CN\n" @@ -22,6 +22,27 @@ msgstr "" msgid "Error reading file %s, Error: %s" msgstr "文件 %s,错误读取时出错: %s" +#: pkg/operations/upgradecluster.go:49 +#, c-format +msgid "Error while querying ARM for resources: %+v" +msgstr "查询ARM资源时出错: %+v" + +#: pkg/acsengine/transform.go:94 +#, c-format +msgid "Found 2 resources with type %s in the template. There should only be 1" +msgstr "模板发现两个类型%s 的资源。应该只有一个" + +#: pkg/acsengine/transform.go:117 +#, c-format +msgid "Found no resources with type %s in the template. There should have been 1" +msgstr "模板没有发现类型%s 的资源。应该有一个" + +#: pkg/operations/kubernetes162upgrader.go:26 +#: pkg/operations/upgradecluster.go:64 +#, c-format +msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" +msgstr "版本%s 不支持升级到Kubernetes 1.6.2" + #: pkg/acsengine/output.go:109 #, c-format msgid "error creating directory '%s': %s" @@ -32,17 +53,27 @@ msgstr "创建目录 %s 时出错: %s" msgid "error executing template for file %s: %v" msgstr "执行文件 %s %v 模板时出错" +#: pkg/operations/kubernetes162upgrader.go:52 +#, c-format +msgid "error generating upgrade template: %s" +msgstr "执行文件 %s 模板时出错" + #: pkg/acsengine/engine.go:1011 #, c-format msgid "error parsing file %s: %v" msgstr "解析文件 %s: %v 时出错" -#: pkg/api/apiloader.go:23 +#: pkg/api/apiloader.go:23 pkg/api/upgradeapiloader.go:20 #, c-format msgid "error reading file %s: %s" msgstr "读取文件 %s: %s 时出错" -#: pkg/api/apiloader.go:136 +#: pkg/operations/kubernetes162upgrader.go:46 +#, c-format +msgid "failed to initialize template generator: %s" +msgstr "初始化模板生成器时出错: %s" + +#: pkg/api/apiloader.go:136 pkg/api/upgradeapiloader.go:70 #, c-format msgid "invalid version %s for conversion back from unversioned object" msgstr "与回是非版本化的对象的转换的版本无效 %s" @@ -57,7 +88,7 @@ msgstr "%s 配器是不受支持" msgid "template file %s does not exist" msgstr "模板文件 %s 不存在" -#: pkg/api/apiloader.go:84 +#: pkg/api/apiloader.go:84 pkg/api/upgradeapiloader.go:51 #, c-format msgid "unrecognized APIVersion '%s'" msgstr "无法识别的 APIVersion '%s'" From f9e7193b45bc0f7d0803c94cf49b20dbcfd9385b Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Thu, 18 May 2017 16:33:15 -0700 Subject: [PATCH 05/13] Move test translation files so that translations directory is used for go-bindata --- pkg/i18n/i18n_test.go | 12 ++++++------ .../translations}/default/LC_MESSAGES/acsengine.mo | Bin .../translations}/default/LC_MESSAGES/acsengine.po | 0 .../translations}/en_US/LC_MESSAGES/acsengine.mo | Bin .../translations}/en_US/LC_MESSAGES/acsengine.po | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename {translations/test => test/translations}/default/LC_MESSAGES/acsengine.mo (100%) rename {translations/test => test/translations}/default/LC_MESSAGES/acsengine.po (100%) rename {translations/test => test/translations}/en_US/LC_MESSAGES/acsengine.mo (100%) rename {translations/test => test/translations}/en_US/LC_MESSAGES/acsengine.po (100%) diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go index b20ef6c977..72daa417e8 100644 --- a/pkg/i18n/i18n_test.go +++ b/pkg/i18n/i18n_test.go @@ -11,7 +11,7 @@ import ( func TestLoadTranslations(t *testing.T) { RegisterTestingT(t) - _, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + _, err := LoadTranslations(path.Join("..", "..", "test", "translations")) Expect(err).Should(BeNil()) _, err = LoadTranslations("non_existing_directory") @@ -23,7 +23,7 @@ func TestTranslationLanguage(t *testing.T) { origLang := os.Getenv("LANG") os.Setenv("LANG", "en_US.UTF-8") - _, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + _, err := LoadTranslations(path.Join("..", "..", "test", "translations")) Expect(err).Should(BeNil()) lang := GetLanguage() @@ -37,7 +37,7 @@ func TestTranslationLanguageDefault(t *testing.T) { origLang := os.Getenv("LANG") os.Setenv("LANG", "ll_CC.UTF-8") - _, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + _, err := LoadTranslations(path.Join("..", "..", "test", "translations")) Expect(err).Should(BeNil()) lang := GetLanguage() @@ -49,7 +49,7 @@ func TestTranslationLanguageDefault(t *testing.T) { func TestTranslations(t *testing.T) { RegisterTestingT(t) - l, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + l, err := LoadTranslations(path.Join("..", "..", "test", "translations")) Expect(err).Should(BeNil()) translator := &Translator{ @@ -66,7 +66,7 @@ func TestTranslations(t *testing.T) { func TestTranslationsPlural(t *testing.T) { RegisterTestingT(t) - l, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + l, err := LoadTranslations(path.Join("..", "..", "test", "translations")) Expect(err).Should(BeNil()) translator := &Translator{ @@ -83,7 +83,7 @@ func TestTranslationsPlural(t *testing.T) { func TestTranslationsError(t *testing.T) { RegisterTestingT(t) - l, err := LoadTranslations(path.Join("..", "..", "translations", "test")) + l, err := LoadTranslations(path.Join("..", "..", "test", "translations")) Expect(err).Should(BeNil()) translator := &Translator{ diff --git a/translations/test/default/LC_MESSAGES/acsengine.mo b/test/translations/default/LC_MESSAGES/acsengine.mo similarity index 100% rename from translations/test/default/LC_MESSAGES/acsengine.mo rename to test/translations/default/LC_MESSAGES/acsengine.mo diff --git a/translations/test/default/LC_MESSAGES/acsengine.po b/test/translations/default/LC_MESSAGES/acsengine.po similarity index 100% rename from translations/test/default/LC_MESSAGES/acsengine.po rename to test/translations/default/LC_MESSAGES/acsengine.po diff --git a/translations/test/en_US/LC_MESSAGES/acsengine.mo b/test/translations/en_US/LC_MESSAGES/acsengine.mo similarity index 100% rename from translations/test/en_US/LC_MESSAGES/acsengine.mo rename to test/translations/en_US/LC_MESSAGES/acsengine.mo diff --git a/translations/test/en_US/LC_MESSAGES/acsengine.po b/test/translations/en_US/LC_MESSAGES/acsengine.po similarity index 100% rename from translations/test/en_US/LC_MESSAGES/acsengine.po rename to test/translations/en_US/LC_MESSAGES/acsengine.po From 150b71105a8bad567629bd71a1f0e179a9cd52c7 Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Thu, 18 May 2017 19:43:30 -0700 Subject: [PATCH 06/13] Use go-bindata to add resource strings to acs-engine binary --- cmd/deploy.go | 9 +- cmd/generate.go | 23 +- cmd/upgrade.go | 9 +- pkg/i18n/i18n.go | 13 +- pkg/i18n/i18n_test.go | 16 +- pkg/i18n/resourceloader.go | 6 + pkg/i18n/translations.go | 364 ++++++++++++++++++ .../default/LC_MESSAGES/acsengine.mo | Bin .../default/LC_MESSAGES/acsengine.po | 0 .../en_US/LC_MESSAGES/acsengine.mo | Bin .../en_US/LC_MESSAGES/acsengine.po | 0 11 files changed, 388 insertions(+), 52 deletions(-) create mode 100644 pkg/i18n/resourceloader.go create mode 100644 pkg/i18n/translations.go rename {test => pkg/i18n}/translations/default/LC_MESSAGES/acsengine.mo (100%) rename {test => pkg/i18n}/translations/default/LC_MESSAGES/acsengine.po (100%) rename {test => pkg/i18n}/translations/en_US/LC_MESSAGES/acsengine.mo (100%) rename {test => pkg/i18n}/translations/en_US/LC_MESSAGES/acsengine.po (100%) diff --git a/cmd/deploy.go b/cmd/deploy.go index 5fe3f80979..6e75a9315b 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -26,7 +26,6 @@ const ( ) type deployCmd struct { - translationsDirectory string authArgs apimodelPath string @@ -64,7 +63,6 @@ func newDeployCmd() *cobra.Command { } f := deployCmd.Flags() - f.StringVar(&dc.translationsDirectory, "translations-directory", "", "translations directory (translations in the current directory if absent)") f.StringVar(&dc.apimodelPath, "api-model", "", "") f.StringVar(&dc.outputDirectory, "output-directory", "", "output directory (derived from FQDN if absent)") f.StringVar(&dc.caCertificatePath, "ca-certificate-path", "", "path to the CA certificate to use for Kubernetes PKI assets") @@ -83,12 +81,7 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) { var caKeyBytes []byte var err error - dc.locale, err = i18n.LoadTranslations(dc.translationsDirectory) - if err != nil { - log.Fatalf("error loading translation files: %s", err.Error()) - } - - i18n.Initialize(dc.locale) + dc.locale, err = i18n.LoadTranslations() if dc.apimodelPath == "" { if len(args) > 0 { diff --git a/cmd/generate.go b/cmd/generate.go index d2c7bf8c16..4e88a4a720 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -22,14 +22,13 @@ const ( ) type generateCmd struct { - translationsDirectory string - apimodelPath string - outputDirectory string // can be auto-determined from clusterDefinition - caCertificatePath string - caPrivateKeyPath string - classicMode bool - noPrettyPrint bool - parametersOnly bool + apimodelPath string + outputDirectory string // can be auto-determined from clusterDefinition + caCertificatePath string + caPrivateKeyPath string + classicMode bool + noPrettyPrint bool + parametersOnly bool // derived containerService *api.ContainerService @@ -51,7 +50,6 @@ func newGenerateCmd() *cobra.Command { } f := generateCmd.Flags() - f.StringVar(&gc.translationsDirectory, "translations-directory", "", "translations directory (translations in the current directory if absent)") f.StringVar(&gc.apimodelPath, "api-model", "", "") f.StringVar(&gc.outputDirectory, "output-directory", "", "output directory (derived from FQDN if absent)") f.StringVar(&gc.caCertificatePath, "ca-certificate-path", "", "path to the CA certificate to use for Kubernetes PKI assets") @@ -68,12 +66,7 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) { var caKeyBytes []byte var err error - gc.locale, err = i18n.LoadTranslations(gc.translationsDirectory) - if err != nil { - log.Fatalf("error loading translation files: %s", err.Error()) - } - - i18n.Initialize(gc.locale) + gc.locale, err = i18n.LoadTranslations() if gc.apimodelPath == "" { if len(args) > 0 { diff --git a/cmd/upgrade.go b/cmd/upgrade.go index d345c66f62..5e8f4cdea1 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -21,7 +21,6 @@ const ( ) type upgradeCmd struct { - translationsDirectory string authArgs // user input @@ -52,7 +51,6 @@ func newUpgradeCmd() *cobra.Command { } f := upgradeCmd.Flags() - f.StringVar(&uc.translationsDirectory, "translations-directory", "", "translations directory (translations in the current directory if absent)") f.StringVar(&uc.resourceGroupName, "resource-group", "", "the resource group where the cluster is deployed") f.StringVar(&uc.deploymentDirectory, "deployment-dir", "", "the location of the output from `generate`") f.StringVar(&uc.upgradeModelFile, "upgrademodel-file", "", "file path to upgrade API model") @@ -66,12 +64,7 @@ func (uc *upgradeCmd) validate(cmd *cobra.Command, args []string) { var err error - uc.locale, err = i18n.LoadTranslations(uc.translationsDirectory) - if err != nil { - log.Fatalf("error loading translation files: %s", err.Error()) - } - - i18n.Initialize(uc.locale) + uc.locale, err = i18n.LoadTranslations() if uc.resourceGroupName == "" { cmd.Usage() diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index c74a507e5e..0ae3ed7ac9 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -37,20 +37,11 @@ func loadSystemLanguage() string { // LoadTranslations loads translation files and sets the locale to // the system locale. It should be called by the main program. -func LoadTranslations(translationsDir string) (*gotext.Locale, error) { - dir := defaultLocalDir - if translationsDir != "" { - dir = translationsDir - } - - if stat, err := os.Stat(dir); os.IsNotExist(err) || !stat.IsDir() { - return nil, fmt.Errorf("Translations directory %s does not exist: %v", dir, err) - } - +func LoadTranslations() (*gotext.Locale, error) { lang := loadSystemLanguage() SetLanguage(lang) - locale := gotext.NewLocale(dir, lang) + locale := gotext.NewLocale(defaultLocalDir, lang) Initialize(locale) return locale, nil diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go index 72daa417e8..0e0130dcdc 100644 --- a/pkg/i18n/i18n_test.go +++ b/pkg/i18n/i18n_test.go @@ -2,7 +2,6 @@ package i18n import ( "os" - "path" "testing" . "github.com/onsi/gomega" @@ -11,11 +10,8 @@ import ( func TestLoadTranslations(t *testing.T) { RegisterTestingT(t) - _, err := LoadTranslations(path.Join("..", "..", "test", "translations")) + _, err := LoadTranslations() Expect(err).Should(BeNil()) - - _, err = LoadTranslations("non_existing_directory") - Expect(err).ShouldNot(BeNil()) } func TestTranslationLanguage(t *testing.T) { @@ -23,7 +19,7 @@ func TestTranslationLanguage(t *testing.T) { origLang := os.Getenv("LANG") os.Setenv("LANG", "en_US.UTF-8") - _, err := LoadTranslations(path.Join("..", "..", "test", "translations")) + _, err := LoadTranslations() Expect(err).Should(BeNil()) lang := GetLanguage() @@ -37,7 +33,7 @@ func TestTranslationLanguageDefault(t *testing.T) { origLang := os.Getenv("LANG") os.Setenv("LANG", "ll_CC.UTF-8") - _, err := LoadTranslations(path.Join("..", "..", "test", "translations")) + _, err := LoadTranslations() Expect(err).Should(BeNil()) lang := GetLanguage() @@ -49,7 +45,7 @@ func TestTranslationLanguageDefault(t *testing.T) { func TestTranslations(t *testing.T) { RegisterTestingT(t) - l, err := LoadTranslations(path.Join("..", "..", "test", "translations")) + l, err := LoadTranslations() Expect(err).Should(BeNil()) translator := &Translator{ @@ -66,7 +62,7 @@ func TestTranslations(t *testing.T) { func TestTranslationsPlural(t *testing.T) { RegisterTestingT(t) - l, err := LoadTranslations(path.Join("..", "..", "test", "translations")) + l, err := LoadTranslations() Expect(err).Should(BeNil()) translator := &Translator{ @@ -83,7 +79,7 @@ func TestTranslationsPlural(t *testing.T) { func TestTranslationsError(t *testing.T) { RegisterTestingT(t) - l, err := LoadTranslations(path.Join("..", "..", "test", "translations")) + l, err := LoadTranslations() Expect(err).Should(BeNil()) translator := &Translator{ diff --git a/pkg/i18n/resourceloader.go b/pkg/i18n/resourceloader.go new file mode 100644 index 0000000000..e4ac64ba8a --- /dev/null +++ b/pkg/i18n/resourceloader.go @@ -0,0 +1,6 @@ +package i18n + +//go:generate go-bindata -nometadata -pkg $GOPACKAGE -prefix ../../ -o translations.go ../../translations/... +//go:generate gofmt -s -l -w translations.go +// resourceloader use go-bindata (https://github.com/jteeuwen/go-bindata) +// go-bindata is the way we handle embedded files, like binary, template, etc. diff --git a/pkg/i18n/translations.go b/pkg/i18n/translations.go new file mode 100644 index 0000000000..007034a662 --- /dev/null +++ b/pkg/i18n/translations.go @@ -0,0 +1,364 @@ +// Code generated by go-bindata. +// sources: +// ../../translations/default/LC_MESSAGES/acsengine.mo +// ../../translations/default/LC_MESSAGES/acsengine.po +// ../../translations/en_US/LC_MESSAGES/acsengine.mo +// ../../translations/en_US/LC_MESSAGES/acsengine.po +// ../../translations/zh_CN/LC_MESSAGES/acsengine.mo +// ../../translations/zh_CN/LC_MESSAGES/acsengine.po +// DO NOT EDIT! + +package i18n + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindataFileInfo) Name() string { + return fi.name +} +func (fi bindataFileInfo) Size() int64 { + return fi.size +} +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} +func (fi bindataFileInfo) IsDir() bool { + return false +} +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _translationsDefaultLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcd\x8e\x1b\xc5\x17\xc5\x8f\xed\x99\xf1\xfc\xfb\xcf\x67\x90\xf8\x10\x20\x6e\x16\x56\x82\x26\xed\xb4\x8d\x86\x8c\x7a\x98\x40\x08\x33\x68\xc2\x8c\x62\x0d\x9e\x88\x1d\x2a\x77\x5f\xb7\x2b\xb4\xab\x4c\x55\xb5\x33\x0e\x2f\x40\x1e\x00\x89\x07\x80\x0d\xac\x79\x86\x6c\x58\xc3\x8e\x3d\x3b\x56\x28\x4b\xd4\x5d\xed\x78\xc4\xc7\x86\x1d\x52\x7a\x53\xee\xeb\x73\x4f\xfd\xee\xa9\x56\xfd\x72\x61\xed\x2b\x00\x78\x1e\xc0\x6b\x00\xbe\x01\xf0\x12\x80\x2b\x0d\x54\xcf\x97\x0d\x80\x00\x3c\x68\x00\x5b\x00\xbe\x6b\x00\x07\x00\x7e\x6a\x00\x87\x00\x5e\x6f\x02\x7b\x00\xb2\x26\x70\x11\xc0\xb7\x4d\xe0\x32\x80\x87\x4d\xa0\x03\xe0\xb7\x26\xf0\x0a\x80\x17\x5b\x7e\x8d\x5a\xde\xe7\x56\x0b\xb8\x0e\x60\xde\xf2\xfe\x3f\xb4\x80\x37\x4a\xdf\x96\xe7\xf8\xbd\x05\xbc\x0a\xe0\x85\x35\xe0\x8b\x06\x70\x75\xcd\xeb\xbe\x5f\xf7\xfd\x3f\xae\x7b\x8e\x47\xeb\x9e\xe3\xdd\x0d\xcf\xf1\x60\xc3\x73\x3c\xdc\xf0\x1c\xbf\x6e\x78\x8e\x0b\x6d\xbf\xff\x4e\xbd\x9e\xb4\xbd\x4f\xde\xf6\x1c\x5f\xb7\xbd\xff\xcf\x6d\xcf\xf1\xa8\xed\x39\x5e\xde\xf4\x1c\xdb\x9b\x40\x19\xc9\x26\xfe\xfa\xb4\xeb\xb5\x05\xe0\xff\x75\x96\x4f\xd5\xb5\x75\x00\xcf\x01\x08\x00\x3c\x0d\xa0\x09\xe0\x59\x00\xff\x03\xb0\x01\x60\x0d\xc0\x33\xa5\x70\xdf\x18\x6d\xc8\xb0\x48\xa5\xca\x68\x2c\x73\xa6\x8e\xbd\x42\x55\x39\xa6\x8e\xad\x05\xf7\x26\xe5\x3f\x9f\x17\x6c\x16\xa5\xee\xc6\xc9\x31\x8d\xab\x3e\xab\x0b\x93\xb0\x8d\xa9\xb3\x35\xc7\x81\x2e\x54\x4a\xfd\x55\x99\xee\x49\x37\x21\xb7\x98\x95\xae\x24\x15\xb9\x09\x93\xe3\xe9\x2c\x17\x8e\xbb\x34\x9c\xb0\x61\xb2\x13\x5d\xe4\x29\x69\x95\x2f\x68\xc4\xd4\xab\x6d\x94\xfe\x77\x3e\x13\x31\x67\x1a\x31\x2b\xea\xe1\x74\x96\x19\x91\x32\x39\x4d\x1f\x15\x23\x36\x8a\x1d\x5b\xea\x75\xdf\xee\xf6\x49\x5a\x52\xda\x91\x2d\x66\x33\x6d\x1c\xa7\x34\x36\x7a\x4a\x73\x36\x56\x6a\x55\x8d\xce\xd5\xe8\x89\x61\xe1\xca\xa1\x53\x69\x38\x71\xda\x2c\xe8\x52\xc7\x5e\x3a\xa7\xe0\x33\x4e\x8a\x4a\xb2\x44\xaa\xc2\xa9\xc3\x8c\xa9\x33\xaf\x85\x19\x2b\x36\xde\xac\x58\x92\xd5\x1d\xe7\xec\x66\xc2\xd8\x73\x87\x71\xae\xff\x4f\xc7\x54\xf5\x8c\x85\xcc\x39\x2d\x27\x94\x4a\x3a\x29\x72\x79\x7f\xe5\xba\xdc\xb1\x3e\x4b\xa9\xe6\x22\x97\xe9\x72\xc8\x32\xcb\x12\x34\xd1\x6a\x59\x19\x89\xe4\x33\x1f\x44\xb1\xac\x71\x4a\x7a\x74\x97\x13\x07\x6d\x92\x09\x5b\x57\xf9\x55\x19\x94\x19\x16\xea\x71\x82\x58\x8d\xef\x01\x29\xd5\xec\x53\xe6\x33\x69\x1d\x0a\x65\x38\xd1\x99\x92\xf7\x39\xa5\x1b\x83\xc3\x3b\xf5\xae\xa5\x17\x16\x62\x9a\xff\x53\xe3\xc0\xe8\x92\x20\x3c\x4c\xc3\x3b\xcb\x03\x0a\x4e\xb8\xdc\x36\x3c\xb6\x99\x4c\xc3\xf7\x8b\xcc\x86\x43\x1d\x53\x30\xb8\x3d\x0c\x6f\x56\x67\xa6\x55\xf8\x41\x15\x6d\x3f\xea\x5d\x0b\xa3\xed\xb0\xb7\x43\xfd\x7e\x1c\x45\x5b\x51\x14\x45\xc1\xe0\x76\x78\xc2\x73\x69\xff\x56\xd7\xdb\x8e\xa3\xb7\xc2\xe8\x5a\x14\x05\x47\xc2\xba\x70\x68\x84\xb2\xb9\x4f\xf2\x96\x14\x2a\x73\x52\x28\x3a\x92\xf4\xce\xdd\xe5\x5b\x2e\xdf\x9b\x68\x37\x15\x32\xef\x26\x7a\x7a\x3d\x38\x12\x2a\x2b\x44\xc6\xe1\x90\xc5\x34\xa6\x7d\x95\xe5\xd2\x4e\x1e\x97\x63\x62\xf5\xe9\xe9\xc7\xc1\xf1\xe1\xf1\xfe\x6a\xaa\x5e\x37\x0a\x6e\x6a\xe5\x58\xb9\x70\xb8\x98\x71\x4c\x8e\xcf\xdc\xd5\x59\x2e\xa4\xda\xa5\x64\x22\x8c\x65\xb7\x77\x3a\x3c\x08\x77\x56\xba\x92\x6d\xcc\x26\xdc\x57\x89\x2e\x3f\x90\x98\x76\x46\xd2\x05\x83\xbc\x30\x22\x0f\x0f\xb4\x99\xda\x98\xd4\xac\x7a\xb5\x7b\xfd\x5d\xf2\x3f\xf7\x2e\x2b\xba\xb8\x47\xbd\x37\x77\x83\x4f\xc2\x0f\x57\x5f\xca\x40\x73\x2a\x1d\xf5\xbb\x51\xb7\x1f\x3c\xb9\x21\x9e\xdc\x10\xff\x81\x1b\xe2\x8f\x00\x00\x00\xff\xff\x34\x0a\xa1\x2a\x51\x08\x00\x00") + +func translationsDefaultLc_messagesAcsengineMoBytes() ([]byte, error) { + return bindataRead( + _translationsDefaultLc_messagesAcsengineMo, + "translations/default/LC_MESSAGES/acsengine.mo", + ) +} + +func translationsDefaultLc_messagesAcsengineMo() (*asset, error) { + bytes, err := translationsDefaultLc_messagesAcsengineMoBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/default/LC_MESSAGES/acsengine.mo", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsDefaultLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x4f\xe3\x46\x10\xfe\x9e\x5f\x31\x4d\x14\xdd\x9d\x8e\x35\xb6\x21\x81\x33\xa5\xea\x95\x42\x45\x7b\xa8\x88\x86\xaa\x1f\x2a\x55\x1b\x7b\x62\xef\x61\xef\xba\xfb\x92\x23\xf7\xeb\xab\x5d\xdb\x09\x2f\x9b\x17\x7a\x7c\x40\x38\xeb\x67\x67\x9e\x99\x79\xe6\x49\x06\x70\xce\xf3\x92\xa9\x02\xb4\xa4\x5c\x95\x54\x33\xc1\x15\xcc\x84\x04\x9a\x2a\xe4\x39\xe3\x08\x35\x4d\xef\x68\x8e\x41\x6f\x00\x67\xa2\x5e\x48\x96\x17\x1a\xde\x9e\xbd\x83\x38\x8c\x8e\x7a\x03\x98\x14\x4c\xc1\x8c\x95\x08\x4c\x41\xc6\x94\x96\x6c\x6a\x34\x66\x60\x78\x86\x12\x74\x81\xa0\x68\x85\x50\xb2\x14\xb9\x42\xa0\xca\x9d\x79\x13\xfc\xca\x28\xcf\x35\xa3\x1c\x3e\x31\xf8\xfe\x73\xf7\xa9\x64\x3f\x16\x42\x57\x94\x95\x41\x2a\xaa\x1f\xf6\x5c\xea\xa0\x37\xe8\x55\x2a\x67\x19\xf4\xfb\xf6\x41\x69\x69\x9f\xfa\xd7\x52\x7c\xc6\x54\x93\xcb\x8c\xfc\x89\x52\x31\xc1\x13\xf8\x9b\xf7\x7b\xfd\x1b\xac\x85\xd4\xe4\xca\xde\x21\x3f\x99\x5c\x91\x89\x68\x5f\x5d\xff\x3e\x21\x67\x12\x5d\xfd\xe4\x67\xaa\x31\x71\x29\x48\x38\x22\xd1\x31\xc4\x71\x12\x86\xef\xc3\x30\x0c\x5b\x30\xb9\xc1\x39\x53\x5e\x6c\x34\x4a\xc2\x03\x12\x1e\xb5\xd8\x4f\x54\x69\x32\x69\x9b\x2b\x64\xb2\x63\x85\xed\x5d\x9e\x1b\x9a\x23\x99\x20\xad\x92\x6e\x54\x8f\x5e\x25\x80\xfc\x9f\xdb\x3f\xdc\xd9\xd5\xe5\xd5\xf9\xaa\xe2\x28\x68\x08\x9c\x09\xae\x91\x6b\x32\x59\xd4\x98\x80\xc6\x7b\xbd\x5f\x97\x94\xf1\x13\x48\x0b\x2a\x15\xea\xd3\xdb\xc9\x05\x39\x7e\x8c\xb5\x7c\x67\x28\xc9\x39\x4f\x45\xc6\x78\x9e\xc0\xf1\x94\xe9\xa6\xf8\xd2\x48\x5a\x92\x0b\x21\x2b\x95\x00\xaf\xdd\x47\x75\x1a\x9f\x40\xf3\x78\xfa\x96\xc3\x77\xa7\x10\xbd\x3b\x71\xf0\xbf\xc8\x2f\xc8\x51\x36\xb5\x5f\x0b\xcc\x98\x86\x38\x08\x83\xd8\xbe\xed\x0d\x12\xa8\xef\xf2\xfd\xa5\x14\xf6\x9b\x7f\x41\x2e\x92\x38\x8e\x7a\x83\x3d\x48\xc9\x4c\xc8\x8a\xea\x6e\xd2\xe7\x52\x0a\x09\x12\xa9\xa5\xd5\xa8\x6e\xa8\xf6\xc0\x1d\x27\x30\x54\x2b\x25\x6c\x47\x76\xe9\x45\x6d\x09\x5a\xe5\xef\x9b\x3a\x97\x34\xc3\xb4\x34\x4a\xa3\xb4\x3c\x0e\x3f\xac\xa7\xf1\xa5\xb0\x51\xff\x35\x28\x17\x36\xc7\xc7\x9b\x2b\xb7\x3a\x12\x95\x30\x32\x45\x95\xc0\xf0\xfd\xfc\x29\xa3\x1d\x2f\x3d\xef\x8d\x5b\x51\x4b\xc3\xd2\xfa\x70\xe8\xa3\x75\x21\x0c\xcf\x20\x5e\x05\x83\x2f\x4c\x17\xa0\x17\xb5\x2d\x1e\x18\x77\x9b\xa7\xb1\xaa\x4b\xaa\x31\x80\x49\x81\x12\x41\x15\xc2\x94\x19\x08\x5e\x2e\x60\x8a\x10\xad\x18\xbf\x56\xbc\x2d\xc5\x44\xd6\x47\xd6\x55\xc3\xc5\xff\x4b\x5f\xd0\x39\xc2\x14\x91\x3f\x2f\xe8\x55\x42\x7a\xd4\x73\x67\xa6\x28\x39\x6a\x54\xd1\x38\x6e\xa5\xe4\x44\x14\x8f\x77\xd2\xda\xd8\x3b\xd4\xdb\x06\x07\x5a\xc0\x6f\xcb\x04\x10\x05\xe3\x20\xb6\x8e\xcb\x85\x06\x65\x6a\x6b\x6d\x98\xc1\x4c\x8a\x0a\xe6\x9d\x09\x3c\xdc\x87\x6f\x0c\xf3\x7c\x84\xc2\xe8\xda\x68\x37\xbf\xd0\xbb\x24\xe8\xf4\x9e\x3a\x5b\xe5\x39\x64\x4c\x62\xaa\x85\x5c\xc0\x9b\xa1\x7a\xf3\x98\xdc\x0e\xd0\x4d\x66\x11\x85\xd1\x78\x3d\x03\xbc\xc7\xd4\xb8\xb8\xdd\x5c\xdd\xc6\xb5\x96\x90\xc0\x70\xfe\x94\xc8\x2e\x37\x5e\x32\xff\x51\xbc\x9e\x5d\xde\xf8\xa3\x4d\x66\xba\x11\xb5\x49\x7d\x3d\xda\x0a\xdf\xd2\x27\xaf\xab\x36\xa1\x6b\x2a\xd5\x03\xaf\xf4\x35\xc6\x0b\x59\x66\xac\x99\xfd\x2b\xc5\x52\xf6\x07\xcb\xf3\x96\xeb\xe3\xd7\xe1\x7a\x2e\x4f\x7c\xdb\xd7\x09\x2f\xe4\x25\x53\x39\xf4\x6a\x66\x46\x59\x89\x99\x5d\x13\xc6\x99\x66\xb4\x64\x5f\x57\x2d\xee\xda\xff\xf4\xcb\xe6\x45\x97\xd6\xf6\x2b\x3a\x18\x6f\x6c\xd8\x91\xb7\x61\x8c\xcf\x69\xc9\xb2\x6e\x5d\xad\x8d\x59\xb1\xa6\x82\x77\x27\x53\x9a\xde\x35\x2b\x6d\xba\x33\xcc\x40\x4c\xed\xcf\xa4\x55\x0d\xdf\x1a\x67\x93\xf0\x0e\x42\xef\x06\x08\x99\x16\xa8\xb4\xeb\x8d\x5b\x75\xeb\x44\x86\x2f\x7d\x68\x45\x6e\x3b\x72\xa3\xee\xc7\x5e\x83\x5a\x2d\x77\x23\x21\xc8\x04\x36\x4e\x88\xf7\x4c\x3d\x68\xcd\x56\xe0\xda\x91\x1e\x1f\x6e\x9c\xe8\xc8\xbb\x8e\x86\x4b\x4c\x45\xce\xd9\x57\xcc\xe0\xe3\xf5\x65\xfb\xa3\xce\xd5\xbd\x22\xb5\x19\xb5\xd9\x06\xc2\x91\x2f\xef\x82\x56\xe5\xd6\x5e\x6c\x04\xfd\x17\x00\x00\xff\xff\xeb\xf0\xcc\x89\x51\x0c\x00\x00") + +func translationsDefaultLc_messagesAcsenginePoBytes() ([]byte, error) { + return bindataRead( + _translationsDefaultLc_messagesAcsenginePo, + "translations/default/LC_MESSAGES/acsengine.po", + ) +} + +func translationsDefaultLc_messagesAcsenginePo() (*asset, error) { + bytes, err := translationsDefaultLc_messagesAcsenginePoBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/default/LC_MESSAGES/acsengine.po", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsEn_usLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcd\x8e\x1b\xc5\x17\xc5\x8f\xed\x99\xf1\xfc\xfb\xcf\x67\x90\xf8\x10\x20\x6e\x16\x56\x82\x26\xed\xb4\x8d\x86\x8c\x7a\x98\x40\x08\x33\x68\xc2\x8c\x62\x0d\x9e\x88\x1d\x2a\x77\x5f\xb7\x2b\xb4\xab\x4c\x55\xb5\x33\x0e\x2f\x40\x1e\x00\x89\x07\x80\x0d\xac\x79\x86\x6c\x58\xc3\x8e\x3d\x3b\x56\x28\x4b\xd4\x5d\xed\x78\xc4\xc7\x86\x1d\x52\x7a\x53\xee\xeb\x73\x4f\xfd\xee\xa9\x56\xfd\x72\x61\xed\x2b\x00\x78\x1e\xc0\x6b\x00\xbe\x01\xf0\x12\x80\x2b\x0d\x54\xcf\x97\x0d\x80\x00\x3c\x68\x00\x5b\x00\xbe\x6b\x00\x07\x00\x7e\x6a\x00\x87\x00\x5e\x6f\x02\x7b\x00\xb2\x26\x70\x11\xc0\xb7\x4d\xe0\x32\x80\x87\x4d\xa0\x03\xe0\xb7\x26\xf0\x0a\x80\x17\x5b\x7e\x8d\x5a\xde\xe7\x56\x0b\xb8\x0e\x60\xde\xf2\xfe\x3f\xb4\x80\x37\x4a\xdf\x96\xe7\xf8\xbd\x05\xbc\x0a\xe0\x85\x35\xe0\x8b\x06\x70\x75\xcd\xeb\xbe\x5f\xf7\xfd\x3f\xae\x7b\x8e\x47\xeb\x9e\xe3\xdd\x0d\xcf\xf1\x60\xc3\x73\x3c\xdc\xf0\x1c\xbf\x6e\x78\x8e\x0b\x6d\xbf\xff\x4e\xbd\x9e\xb4\xbd\x4f\xde\xf6\x1c\x5f\xb7\xbd\xff\xcf\x6d\xcf\xf1\xa8\xed\x39\x5e\xde\xf4\x1c\xdb\x9b\x40\x19\xc9\x26\xfe\xfa\xb4\xeb\xb5\x05\xe0\xff\x75\x96\x4f\xd5\xb5\x75\x00\xcf\x01\x08\x00\x3c\x0d\xa0\x09\xe0\x59\x00\xff\x03\xb0\x01\x60\x0d\xc0\x33\xa5\x70\xdf\x18\x6d\xc8\xb0\x48\xa5\xca\x68\x2c\x73\xa6\x8e\xbd\x42\x55\x39\xa6\x8e\xad\x05\xf7\x26\xe5\x3f\x9f\x17\x6c\x16\xa5\xee\xc6\xc9\x31\x8d\xab\x3e\xab\x0b\x93\xb0\x8d\xa9\xb3\x35\xc7\x81\x2e\x54\x4a\xfd\x55\x99\xee\x49\x37\x21\xb7\x98\x95\xae\x24\x15\xb9\x09\x93\xe3\xe9\x2c\x17\x8e\xbb\x34\x9c\xb0\x61\xb2\x13\x5d\xe4\x29\x69\x95\x2f\x68\xc4\xd4\xab\x6d\x94\xfe\x77\x3e\x13\x31\x67\x1a\x31\x2b\xea\xe1\x74\x96\x19\x91\x32\x39\x4d\x1f\x15\x23\x36\x8a\x1d\x5b\xea\x75\xdf\xee\xf6\x49\x5a\x52\xda\x91\x2d\x66\x33\x6d\x1c\xa7\x34\x36\x7a\x4a\x73\x36\x56\x6a\x55\x8d\xce\xd5\xe8\x89\x61\xe1\xca\xa1\x53\x69\x38\x71\xda\x2c\xe8\x52\xc7\x5e\x3a\xa7\xe0\x33\x4e\x8a\x4a\xb2\x44\xaa\xc2\xa9\xc3\x8c\xa9\x33\xaf\x85\x19\x2b\x36\xde\xac\x58\x92\xd5\x1d\xe7\xec\x66\xc2\xd8\x73\x87\x71\xae\xff\x4f\xc7\x54\xf5\x8c\x85\xcc\x39\x2d\x27\x94\x4a\x3a\x29\x72\x79\x7f\xe5\xba\xdc\xb1\x3e\x4b\xa9\xe6\x22\x97\xe9\x72\xc8\x32\xcb\x12\x34\xd1\x6a\x59\x19\x89\xe4\x33\x1f\x44\xb1\xac\x71\x4a\x7a\x74\x97\x13\x07\x6d\x92\x09\x5b\x57\xf9\x55\x19\x94\x19\x16\xea\x71\x82\x58\x8d\xef\x01\x29\xd5\xec\x53\xe6\x33\x69\x1d\x0a\x65\x38\xd1\x99\x92\xf7\x39\xa5\x1b\x83\xc3\x3b\xf5\xae\xa5\x17\x16\x62\x9a\xff\x53\xe3\xc0\xe8\x92\x20\x3c\x4c\xc3\x3b\xcb\x03\x0a\x4e\xb8\xdc\x36\x3c\xb6\x99\x4c\xc3\xf7\x8b\xcc\x86\x43\x1d\x53\x30\xb8\x3d\x0c\x6f\x56\x67\xa6\x55\xf8\x41\x15\x6d\x3f\xea\x5d\x0b\xa3\xed\xb0\xb7\x43\xfd\x7e\x1c\x45\x5b\x51\x14\x45\xc1\xe0\x76\x78\xc2\x73\x69\xff\x56\xd7\xdb\x8e\xa3\xb7\xc2\xe8\x5a\x14\x05\x47\xc2\xba\x70\x68\x84\xb2\xb9\x4f\xf2\x96\x14\x2a\x73\x52\x28\x3a\x92\xf4\xce\xdd\xe5\x5b\x2e\xdf\x9b\x68\x37\x15\x32\xef\x26\x7a\x7a\x3d\x38\x12\x2a\x2b\x44\xc6\xe1\x90\xc5\x34\xa6\x7d\x95\xe5\xd2\x4e\x1e\x97\x63\x62\xf5\xe9\xe9\xc7\xc1\xf1\xe1\xf1\xfe\x6a\xaa\x5e\x37\x0a\x6e\x6a\xe5\x58\xb9\x70\xb8\x98\x71\x4c\x8e\xcf\xdc\xd5\x59\x2e\xa4\xda\xa5\x64\x22\x8c\x65\xb7\x77\x3a\x3c\x08\x77\x56\xba\x92\x6d\xcc\x26\xdc\x57\x89\x2e\x3f\x90\x98\x76\x46\xd2\x05\x83\xbc\x30\x22\x0f\x0f\xb4\x99\xda\x98\xd4\xac\x7a\xb5\x7b\xfd\x5d\xf2\x3f\xf7\x2e\x2b\xba\xb8\x47\xbd\x37\x77\x83\x4f\xc2\x0f\x57\x5f\xca\x40\x73\x2a\x1d\xf5\xbb\x51\xb7\x1f\x3c\xb9\x21\x9e\xdc\x10\xff\x81\x1b\xe2\x8f\x00\x00\x00\xff\xff\x34\x0a\xa1\x2a\x51\x08\x00\x00") + +func translationsEn_usLc_messagesAcsengineMoBytes() ([]byte, error) { + return bindataRead( + _translationsEn_usLc_messagesAcsengineMo, + "translations/en_US/LC_MESSAGES/acsengine.mo", + ) +} + +func translationsEn_usLc_messagesAcsengineMo() (*asset, error) { + bytes, err := translationsEn_usLc_messagesAcsengineMoBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/acsengine.mo", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsEn_usLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x4f\xe3\x46\x10\xfe\x9e\x5f\x31\x4d\x14\xdd\x9d\x8e\x35\xb6\x21\x81\x33\xa5\xea\x95\x42\x45\x7b\xa8\x88\x86\xaa\x1f\x2a\x55\x1b\x7b\x62\xef\x61\xef\xba\xfb\x92\x23\xf7\xeb\xab\x5d\xdb\x09\x2f\x9b\x17\x7a\x7c\x40\x38\xeb\x67\x67\x9e\x99\x79\xe6\x49\x06\x70\xce\xf3\x92\xa9\x02\xb4\xa4\x5c\x95\x54\x33\xc1\x15\xcc\x84\x04\x9a\x2a\xe4\x39\xe3\x08\x35\x4d\xef\x68\x8e\x41\x6f\x00\x67\xa2\x5e\x48\x96\x17\x1a\xde\x9e\xbd\x83\x38\x8c\x8e\x7a\x03\x98\x14\x4c\xc1\x8c\x95\x08\x4c\x41\xc6\x94\x96\x6c\x6a\x34\x66\x60\x78\x86\x12\x74\x81\xa0\x68\x85\x50\xb2\x14\xb9\x42\xa0\xca\x9d\x79\x13\xfc\xca\x28\xcf\x35\xa3\x1c\x3e\x31\xf8\xfe\x73\xf7\xa9\x64\x3f\x16\x42\x57\x94\x95\x41\x2a\xaa\x1f\xf6\x5c\xea\xa0\x37\xe8\x55\x2a\x67\x19\xf4\xfb\xf6\x41\x69\x69\x9f\xfa\xd7\x52\x7c\xc6\x54\x93\xcb\x8c\xfc\x89\x52\x31\xc1\x13\xf8\x9b\xf7\x7b\xfd\x1b\xac\x85\xd4\xe4\xca\xde\x21\x3f\x99\x5c\x91\x89\x68\x5f\x5d\xff\x3e\x21\x67\x12\x5d\xfd\xe4\x67\xaa\x31\x71\x29\x48\x38\x22\xd1\x31\xc4\x71\x12\x86\xef\xc3\x30\x0c\x5b\x30\xb9\xc1\x39\x53\x5e\x6c\x34\x4a\xc2\x03\x12\x1e\xb5\xd8\x4f\x54\x69\x32\x69\x9b\x2b\x64\xb2\x63\x85\xed\x5d\x9e\x1b\x9a\x23\x99\x20\xad\x92\x6e\x54\x8f\x5e\x25\x80\xfc\x9f\xdb\x3f\xdc\xd9\xd5\xe5\xd5\xf9\xaa\xe2\x28\x68\x08\x9c\x09\xae\x91\x6b\x32\x59\xd4\x98\x80\xc6\x7b\xbd\x5f\x97\x94\xf1\x13\x48\x0b\x2a\x15\xea\xd3\xdb\xc9\x05\x39\x7e\x8c\xb5\x7c\x67\x28\xc9\x39\x4f\x45\xc6\x78\x9e\xc0\xf1\x94\xe9\xa6\xf8\xd2\x48\x5a\x92\x0b\x21\x2b\x95\x00\xaf\xdd\x47\x75\x1a\x9f\x40\xf3\x78\xfa\x96\xc3\x77\xa7\x10\xbd\x3b\x71\xf0\xbf\xc8\x2f\xc8\x51\x36\xb5\x5f\x0b\xcc\x98\x86\x38\x08\x83\xd8\xbe\xed\x0d\x12\xa8\xef\xf2\xfd\xa5\x14\xf6\x9b\x7f\x41\x2e\x92\x38\x8e\x7a\x83\x3d\x48\xc9\x4c\xc8\x8a\xea\x6e\xd2\xe7\x52\x0a\x09\x12\xa9\xa5\xd5\xa8\x6e\xa8\xf6\xc0\x1d\x27\x30\x54\x2b\x25\x6c\x47\x76\xe9\x45\x6d\x09\x5a\xe5\xef\x9b\x3a\x97\x34\xc3\xb4\x34\x4a\xa3\xb4\x3c\x0e\x3f\xac\xa7\xf1\xa5\xb0\x51\xff\x35\x28\x17\x36\xc7\xc7\x9b\x2b\xb7\x3a\x12\x95\x30\x32\x45\x95\xc0\xf0\xfd\xfc\x29\xa3\x1d\x2f\x3d\xef\x8d\x5b\x51\x4b\xc3\xd2\xfa\x70\xe8\xa3\x75\x21\x0c\xcf\x20\x5e\x05\x83\x2f\x4c\x17\xa0\x17\xb5\x2d\x1e\x18\x77\x9b\xa7\xb1\xaa\x4b\xaa\x31\x80\x49\x81\x12\x41\x15\xc2\x94\x19\x08\x5e\x2e\x60\x8a\x10\xad\x18\xbf\x56\xbc\x2d\xc5\x44\xd6\x47\xd6\x55\xc3\xc5\xff\x4b\x5f\xd0\x39\xc2\x14\x91\x3f\x2f\xe8\x55\x42\x7a\xd4\x73\x67\xa6\x28\x39\x6a\x54\xd1\x38\x6e\xa5\xe4\x44\x14\x8f\x77\xd2\xda\xd8\x3b\xd4\xdb\x06\x07\x5a\xc0\x6f\xcb\x04\x10\x05\xe3\x20\xb6\x8e\xcb\x85\x06\x65\x6a\x6b\x6d\x98\xc1\x4c\x8a\x0a\xe6\x9d\x09\x3c\xdc\x87\x6f\x0c\xf3\x7c\x84\xc2\xe8\xda\x68\x37\xbf\xd0\xbb\x24\xe8\xf4\x9e\x3a\x5b\xe5\x39\x64\x4c\x62\xaa\x85\x5c\xc0\x9b\xa1\x7a\xf3\x98\xdc\x0e\xd0\x4d\x66\x11\x85\xd1\x78\x3d\x03\xbc\xc7\xd4\xb8\xb8\xdd\x5c\xdd\xc6\xb5\x96\x90\xc0\x70\xfe\x94\xc8\x2e\x37\x5e\x32\xff\x51\xbc\x9e\x5d\xde\xf8\xa3\x4d\x66\xba\x11\xb5\x49\x7d\x3d\xda\x0a\xdf\xd2\x27\xaf\xab\x36\xa1\x6b\x2a\xd5\x03\xaf\xf4\x35\xc6\x0b\x59\x66\xac\x99\xfd\x2b\xc5\x52\xf6\x07\xcb\xf3\x96\xeb\xe3\xd7\xe1\x7a\x2e\x4f\x7c\xdb\xd7\x09\x2f\xe4\x25\x53\x39\xf4\x6a\x66\x46\x59\x89\x99\x5d\x13\xc6\x99\x66\xb4\x64\x5f\x57\x2d\xee\xda\xff\xf4\xcb\xe6\x45\x97\xd6\xf6\x2b\x3a\x18\x6f\x6c\xd8\x91\xb7\x61\x8c\xcf\x69\xc9\xb2\x6e\x5d\xad\x8d\x59\xb1\xa6\x82\x77\x27\x53\x9a\xde\x35\x2b\x6d\xba\x33\xcc\x40\x4c\xed\xcf\xa4\x55\x0d\xdf\x1a\x67\x93\xf0\x0e\x42\xef\x06\x08\x99\x16\xa8\xb4\xeb\x8d\x5b\x75\xeb\x44\x86\x2f\x7d\x68\x45\x6e\x3b\x72\xa3\xee\xc7\x5e\x83\x5a\x2d\x77\x23\x21\xc8\x04\x36\x4e\x88\xf7\x4c\x3d\x68\xcd\x56\xe0\xda\x91\x1e\x1f\x6e\x9c\xe8\xc8\xbb\x8e\x86\x4b\x4c\x45\xce\xd9\x57\xcc\xe0\xe3\xf5\x65\xfb\xa3\xce\xd5\xbd\x22\xb5\x19\xb5\xd9\x06\xc2\x91\x2f\xef\x82\x56\xe5\xd6\x5e\x6c\x04\xfd\x17\x00\x00\xff\xff\xeb\xf0\xcc\x89\x51\x0c\x00\x00") + +func translationsEn_usLc_messagesAcsenginePoBytes() ([]byte, error) { + return bindataRead( + _translationsEn_usLc_messagesAcsenginePo, + "translations/en_US/LC_MESSAGES/acsengine.po", + ) +} + +func translationsEn_usLc_messagesAcsenginePo() (*asset, error) { + bytes, err := translationsEn_usLc_messagesAcsenginePoBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/acsengine.po", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsZh_cnLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x53\x5d\x6c\x14\xd5\x1f\x3d\xed\xf6\xe3\xff\x5f\xbf\x35\xf1\x23\x4a\xbc\x9a\x6c\xc0\xc0\x2c\xb3\x9b\x00\x75\x15\x22\x16\x30\x45\x2a\x4d\xb3\x10\x5f\x8c\x99\xee\xdc\xee\x5e\x9c\xbd\x77\x9d\x3b\xb3\x50\x9e\xd0\x54\xd9\x86\x96\x62\xd2\x16\x28\xa5\x58\x84\x94\x54\x74\x41\x02\x59\x5b\x88\x89\x2f\x3e\x1b\x13\x1f\x7d\x71\x67\x76\xfb\x84\x4f\x3e\x9b\xf9\xd8\xee\x5a\xd0\x07\xe7\xe5\x66\x7e\xbf\x73\xce\xfd\x9d\x73\xef\xfd\xed\xe9\x8e\x69\x00\x78\x0a\xc0\x4b\x00\xae\x00\x78\x0e\xc0\x96\x36\xf8\x5f\xa9\x0d\x20\x00\xc6\xda\x80\xcd\x00\x96\xda\x80\x7d\x00\x7e\x6d\x03\xfa\x00\x6c\x68\x07\x76\x02\xc8\xb6\x03\xaf\x00\xb8\xda\x0e\x6c\x02\xf0\x53\x3b\x10\x03\xf0\x47\x3b\xf0\x02\x80\x67\x23\xc1\xaa\x46\x02\x9d\xfd\x11\x60\x17\x80\x62\x24\xd0\xbf\x1d\x01\x5e\xf6\x74\x23\xc1\x1c\x7f\x46\x80\x17\x01\x3c\xd3\x01\x7c\xd0\x06\x6c\xed\x08\xf4\x26\x3a\x03\xdc\xad\x4e\xe0\x75\x00\xbf\x74\x02\xdb\x01\x3c\xd6\x15\xe8\xee\xe9\x02\x36\x00\x28\x74\x01\xaf\x02\x38\xdd\x15\xe0\x6f\x86\xf5\x9f\xc3\xf5\x7e\x17\xb0\xd1\xe3\x75\x07\x3a\xdb\xba\x81\xe7\x01\x88\xee\x60\xce\x52\x77\xc0\xbb\x1c\xd6\x7f\xec\x06\xbc\x48\xfe\x87\x07\xbf\xee\x70\x8d\x00\x78\x24\xcc\xf2\xd1\xb0\xd6\x09\xe0\x49\x00\x51\x6f\x2f\x00\xed\x00\x9e\x00\xf0\x7f\x00\x5d\x00\x3a\x00\x3c\xee\x01\xf7\x9a\xa6\x30\x89\x49\x35\x9d\xf1\x2c\x19\x66\x06\x25\x31\xb9\x85\xf8\xe5\x14\x89\xc9\x10\x70\x34\xe7\x75\x3e\xb6\xa9\x39\xe2\xe1\x76\x0f\xf6\x93\x61\x9f\x27\x85\x6d\x66\xa8\x4c\x91\xd8\xe6\x22\xf6\x09\x9b\xeb\x24\xd9\x2c\x93\xa3\xcc\xca\x11\x6b\xa4\xe0\xa9\x12\xc6\x89\x95\xa3\xc4\xa2\xf9\x82\xa1\x59\x34\x4e\xd2\x39\x6a\x52\x22\x73\xc2\x36\x74\x22\xb8\x31\x42\x86\x28\x49\x84\x32\x5c\xfc\x37\x9d\x9c\x56\xa4\x64\x88\x52\x4e\x12\x38\x54\xc8\x9a\x9a\x4e\x89\x25\xc8\xbb\xf6\x10\x35\x39\xb5\xa8\x24\x89\xf8\xf6\x78\x92\x30\x49\xb8\xb0\x88\xb4\x0b\x05\x61\x5a\x54\x27\xc3\xa6\xc8\x93\x22\x35\x25\x13\xdc\xb7\x4e\x7d\xeb\x19\x93\x6a\x96\x67\x5a\x67\x26\xcd\x58\xc2\x1c\x21\x1b\x63\x72\x63\x0b\x82\x1e\xa3\x19\xdb\x87\x34\x46\xf2\xc3\x09\xc3\x4c\x91\x58\x31\x04\x66\x29\xa7\x66\x20\x66\x37\x26\x0b\x19\x2d\x72\x05\xcd\x94\x2d\x87\xd1\xc2\x5f\x77\x4c\x3e\x67\x58\x63\x06\xd5\x3d\x87\x8c\x33\x8b\x69\x06\x3b\xde\x54\x6d\xec\x18\x9e\x25\xe3\x45\xcd\x60\x7a\xc3\xa4\x97\xa5\x37\x68\x46\xf0\x46\x65\x48\xcb\x7c\x14\x04\x61\x37\x6a\x54\x27\x62\xe8\x08\xcd\x58\x10\x66\x26\x47\xa5\xe5\xeb\xf9\x19\x78\x19\xda\x7c\x2d\x41\x34\xed\x07\x03\x12\x5d\xd0\x20\x65\x7a\x8c\x49\x0b\x36\x37\x69\x46\x64\x39\x3b\x4e\x75\xb2\x7b\xa0\xef\x70\xb8\xab\xa7\x85\x11\x2d\x6f\xfc\x13\x71\xc0\x14\xde\x04\x4a\x9f\xae\x1c\x6e\x1c\x50\x74\x90\x7a\xdb\x2a\xfd\x32\xcb\x74\xe5\x6d\x3b\x2b\x95\xb4\x48\x91\xe8\xc0\xc1\xb4\xd2\xeb\x9f\x99\xe0\xca\x1e\x3f\xda\xa4\x9a\xd8\xa1\xa8\xdb\x94\x44\x0f\x49\x26\x53\xea\x8e\xcd\xaa\xaa\xaa\xd1\x81\x83\xca\x20\x2d\x32\xf9\x50\x5c\x62\x5b\x2a\xd1\xa3\xa8\x3b\x54\x35\x7a\x40\x93\x96\x92\x36\x35\x2e\x8d\x20\xc9\xfd\x4c\xe3\x59\x8b\x69\x9c\x1c\x60\xe4\xcd\x23\x8d\x3f\x83\xbd\x95\x13\x56\x5e\x63\x46\x3c\x23\xf2\xbb\xa2\x07\x34\x9e\xb5\xb5\x2c\x55\xd2\x54\xcb\xa7\x48\x6f\x8e\x71\x2a\x29\xd9\x24\x59\xbe\x60\xb0\x61\x46\xf5\xd7\xd6\x30\x29\x72\x3c\xf7\x61\xef\x7b\xd1\xfe\xbe\xfe\xbd\x4d\x8b\x89\xb8\x1a\xed\x15\xdc\xa2\xdc\x52\xd2\x23\x05\x9a\x22\x16\x3d\x66\x6d\x2d\x18\x1a\xe3\x6f\x90\x4c\x4e\x33\x25\xb5\x76\x1e\x4a\xef\x53\x7a\x9a\x38\x6f\xd0\x61\x6a\x2a\x7b\x79\x46\x78\xb7\x25\x45\x7a\x86\x98\x15\x7d\x5f\x79\xa7\x79\x17\x06\x04\xd5\x99\x45\x92\x71\x35\x9e\x8c\xc2\x9d\x39\x59\x5d\xb9\x43\x62\xf2\xfe\xdd\xf1\xd5\xa9\xf3\xf5\x72\xb9\x5e\x5e\x71\x26\x67\xdc\xb3\x77\x9c\x93\xcb\xab\x53\xe7\xfd\xcb\xe3\x5e\xba\x5a\x2f\x5f\xde\x3d\xd8\x5f\xbf\x3d\xea\x2e\x9f\x59\x6b\xde\xbf\x3b\xeb\x3f\x7e\xf7\xda\x82\x7b\xf1\x07\x67\xf2\x8b\xda\xe9\x1b\xd5\xca\x95\x6a\x65\xa9\x76\x73\xc5\x99\x3f\x15\x93\xa4\x36\x3b\x1a\x90\x7e\x3f\xf1\xa9\xb3\x3c\x55\x2f\x5f\x75\x26\x97\xdc\xb9\xb1\x6a\xe5\x44\xb5\xb2\x14\x32\xdd\xef\x16\xdc\xb9\xb1\x80\xff\x2f\xcc\x26\xad\x36\x56\x72\xe7\xae\xc7\x24\xa9\x56\x26\xdc\xa9\xb2\x3b\xfe\x89\x33\x71\xb2\xb6\xbc\xe8\x94\x6e\xac\x7f\xec\x70\x4a\x17\x9c\x95\xe5\xda\x85\x6f\x9d\x7b\xd3\xde\xfd\x5a\x67\x6d\x6c\xb1\xbe\x30\xbe\x16\x03\x89\x15\x49\x38\x53\x03\xf6\x00\x64\x7d\xbf\xbe\xf8\x95\x3b\x7f\x66\xad\x9f\xf2\x35\x9a\xdd\x20\xcf\x96\x6e\xcb\x08\x70\x4a\x17\x9d\xc5\x53\xce\xf8\x4c\x20\x5a\x9b\xba\xe4\x96\xce\x38\xe7\xaf\xfd\x3d\x62\x89\x6a\xe5\xb4\x73\x61\xde\x3d\x57\x5e\xbd\x38\x1f\x98\x77\xc6\x67\x6a\xb3\xa3\x4e\xf9\xfb\xfa\xcd\x05\x2f\xaa\x7b\xd7\xdd\x89\xcb\xb5\xd9\xd1\xa0\xeb\x9e\xfd\xd2\x9d\x2e\x79\xcc\x98\x24\xab\x9f\x4d\x78\x92\xe7\xca\xd5\xca\x84\x33\x79\x36\x08\xac\x11\xfd\x9a\x2d\xaf\xf9\xcd\x39\x67\xee\x1a\x3c\xf2\xad\xe9\x7a\xf9\x73\xa7\xf4\x75\x6d\x76\xf4\xe1\xcf\xf5\x61\xc4\xbf\x02\x00\x00\xff\xff\x6b\xf3\x55\xa8\xdb\x07\x00\x00") + +func translationsZh_cnLc_messagesAcsengineMoBytes() ([]byte, error) { + return bindataRead( + _translationsZh_cnLc_messagesAcsengineMo, + "translations/zh_CN/LC_MESSAGES/acsengine.mo", + ) +} + +func translationsZh_cnLc_messagesAcsengineMo() (*asset, error) { + bytes, err := translationsZh_cnLc_messagesAcsengineMoBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/acsengine.mo", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsZh_cnLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x56\x6d\x4f\x14\xd7\x17\x7f\xcf\xa7\x38\x81\x6c\xd4\xe8\x2c\xb3\x2b\x4f\xce\xff\x21\xb5\x54\x1b\x5b\x69\x09\x59\x9b\xbe\x68\xd2\x0c\x33\x87\xd9\x2b\xb3\xf7\x4e\xef\xbd\x83\xae\xaf\x6c\x43\xeb\x12\x41\x6c\x82\xa0\x88\x28\xb6\x06\x63\x6d\x57\xdb\xd4\x6c\x41\xd3\x0f\xd3\x9d\xd9\xe5\x95\x5f\xa1\xb9\x33\xfb\x08\xb3\x60\xfb\x82\xb0\xdc\x7b\x86\xf3\x3b\xe7\xf7\xb0\x33\x00\xe3\x79\x42\x51\x20\x48\x6e\x52\xe1\x9a\x92\x30\x2a\x60\x86\x71\x30\x2d\x81\xd4\x21\x14\xc1\x33\xad\x59\xd3\xc1\x74\xdf\x00\x8c\x33\xaf\xc8\x89\x93\x97\x70\x7c\xfc\x04\x64\xf5\xcc\x68\xdf\x00\xe4\xf2\x44\xc0\x0c\x71\x11\x88\x00\x9b\x08\xc9\xc9\xb4\x2f\xd1\x06\x9f\xda\xc8\x41\xe6\x11\x84\x59\x40\x70\x89\x85\x54\x20\x98\x22\x3a\x4b\x6c\xf0\x11\x31\xa9\x23\x89\x49\xe1\x22\x81\xff\x5e\x6e\xfe\xe5\x92\xf7\xf2\x4c\x16\x4c\xe2\xa6\x2d\x56\xf8\xff\xa9\xa8\x75\xba\x6f\xa0\xaf\x20\x1c\x62\x43\x7f\xbf\xfa\x20\x24\x57\x9f\xfa\x27\x39\xbb\x8c\x96\xd4\x2e\xd8\xda\x67\xc8\x05\x61\xd4\x80\x2f\x68\x7f\x5f\xff\x14\x7a\x8c\x4b\x6d\x42\x3d\xa3\xbd\xef\x3b\x42\xcb\xb1\xc6\xd5\xe4\xa7\x39\x6d\x9c\x63\x34\xbf\xf6\x81\x29\xd1\x88\x5a\x68\xfa\xb0\x96\x19\x83\x6c\xd6\xd0\x47\x4f\xea\xba\xae\x37\x8a\xb5\x29\x9c\x23\x22\xb1\x36\x33\x6c\x64\xc6\x34\x7d\xb4\x51\x7b\xd1\x14\x52\xcb\x35\x96\xcb\xb8\xf1\x8e\x13\x36\x9e\xa5\x8e\x6f\x3a\xa8\xe5\xd0\x2c\x18\x2d\xaa\x8e\x0b\x52\xf0\x5c\x32\x43\xd0\x3e\xd1\x55\x67\xc0\xb5\xfc\x97\xe3\x9f\x44\x67\x13\x17\x26\xce\xb5\xc7\xcf\xa4\x63\x34\xe3\x8c\x4a\xa4\x52\xcb\x15\x3d\x34\x40\xe2\x55\x39\xe8\xb9\x26\xa1\xff\x01\x2b\x6f\x72\x81\xf2\x7f\x97\x72\xe7\xb5\xb1\xee\x5a\x05\x7e\x06\xb9\x76\x8e\x5a\xcc\x26\xd4\x31\x60\x6c\x9a\xc8\xa8\xe6\x73\xed\x43\xa4\xc8\xe3\xc9\x26\x19\xda\x44\x42\x36\xad\xa7\xb3\xea\xb6\x6f\xc0\x00\x6f\xd6\x19\x6c\x11\x3d\x18\xff\x4a\x3b\xcc\xc8\x66\x33\x7d\x03\xa7\xc0\xd2\x66\x18\x2f\x98\xb2\xc9\xe3\x39\xce\x19\x07\x8e\xa6\xea\x13\x6b\x2a\x25\x4e\x41\x74\x6c\x40\x4a\xb4\x79\x0e\x57\x6f\x54\x77\x5f\x41\x4a\xbc\x7d\xbd\xb8\xb7\x72\xaf\x5e\x2e\xd7\xcb\xbb\xc1\xf2\x6a\xb8\xf6\x2a\xb8\xb1\xb3\xb7\x72\x2f\x2e\x6f\x62\x60\x9e\x42\xa9\xc4\x3d\xe8\x7b\x0e\x37\x6d\xb4\x5c\x5f\x48\xe4\x0a\xcc\xd0\x99\xde\x58\xae\xe4\x15\x88\xaf\x7c\xe4\x45\x05\xe9\xec\xd4\x44\xe4\x0e\x8e\x82\xf9\xdc\x42\x61\x40\xea\xe4\x5c\x07\xac\x87\x4f\xea\xe5\xc7\x67\xa7\x26\xea\xbf\xcf\x87\x3b\xb7\x5b\x68\xde\xbe\x5e\x8f\x0b\x0f\x2e\x25\x72\x9e\x6a\xad\xa0\x9c\x19\x4a\x82\x72\x9e\xf9\xd4\x86\x6c\xbb\x2b\x5c\x21\x32\x0f\xb2\xe8\xa9\xfd\x00\xa1\x91\xa1\x24\x16\x3c\xd7\x94\x98\x86\x5c\x1e\x39\x82\xc8\x33\xdf\xb5\x81\x51\xb7\x08\xd3\x08\x99\x0e\x94\x4f\xb7\xc2\x07\x7f\x06\xcb\xdf\xd7\x6e\xbd\xa8\x56\x7e\xac\x56\x9e\xd5\x5e\xee\x06\x9b\x37\x53\x02\x6a\xeb\xf3\x31\xf4\xbf\xae\x7f\x13\xec\xac\xd4\xcb\x4f\x82\xe5\x67\xe1\xc6\x42\xb5\x72\xbd\x5a\x79\x76\x24\xfe\x8c\x4a\x84\x5e\x03\x50\xf6\xef\x26\xc8\x9b\x73\x08\xd3\x88\xf4\xe0\x0c\xe1\xaf\x5b\xe1\xc6\x42\x3c\xc9\x21\x33\x24\x0c\xd0\xa1\x88\x59\x7f\x1a\x39\x45\x89\x22\x33\x92\x6d\xc8\x23\x12\x46\x76\xe4\x9d\xf4\x33\x92\x48\xda\xa5\xb8\x0e\x24\x83\x8f\x5b\x0d\x20\x93\x1e\x49\x67\x55\x50\x52\x26\x41\xf8\x9e\x4a\x24\xb4\x61\x86\xb3\x02\xcc\x35\xed\xda\x29\xf4\xda\x42\x29\xdc\x78\x9e\x12\x50\xad\x2c\x85\x2b\xe5\x70\xf1\xeb\x60\xe9\x46\x6d\x67\x3b\x28\xbd\xd8\xff\x6f\x93\xd8\x61\xbe\xf4\x7c\x19\x51\xa3\x27\xca\x1c\x23\x99\x5b\x51\xf6\x51\x07\x6c\xc2\xd1\x92\x8c\x17\xe1\x58\x4a\x1c\xeb\x86\x12\x94\xee\x07\xbb\x3b\xb5\xfb\xbf\x04\x6f\xee\x28\xd6\x7a\x78\x2d\xc9\xef\x19\x3d\x33\xd2\xbb\x3b\x5e\x45\xcb\x8f\xda\x37\x15\x10\x99\xac\xe1\x7f\x03\x52\x9d\x0e\x5b\xd8\xae\x6f\x2d\xb6\xec\x0f\xa9\x39\x68\x48\xa1\x89\xe6\x9f\x71\x3c\x9c\xed\x8d\xcb\x89\xc3\x4d\x01\xf3\x9b\x6c\x36\x00\xee\x4b\xa3\x7d\xa0\x7a\x22\xea\xb1\x9b\xc4\x30\x8c\x31\x78\x26\x17\x1d\x61\xd8\xbd\x8c\xfa\xf6\x0f\xe1\xe6\xed\x56\x5f\x23\xda\x46\x42\x57\x8f\xa8\x1f\x97\xb5\x84\x7d\xba\x75\xde\x18\xac\xfb\x5a\xef\x8d\x67\x5f\x38\x77\xef\xa1\x91\xc1\x1d\x78\x44\x12\x9e\x77\xe1\x65\x28\x51\x2f\x33\x26\x71\xd1\x56\x9e\x22\x94\x48\x62\xba\xe4\x5a\x9b\x93\x26\x5f\xfb\xbf\x2b\x82\xd2\x83\x60\xfb\x66\xb0\xb8\x1a\xd3\x52\x5b\x79\x18\x96\x6e\x07\xf7\x9e\x76\xa7\xb3\x38\x64\x5f\x99\xd3\x23\x87\x2e\x6c\x34\x71\x61\x84\xce\x99\x2e\xb1\x9b\xbe\x56\xcb\x50\xb2\xb6\x18\x6d\x9e\x4c\x9b\xd6\x6c\xec\x7d\xbf\x79\x86\x36\xb0\x69\xf5\xfe\xd2\xc6\x5f\xad\xdc\x0a\xee\x6f\x86\x77\xcb\x7b\x0f\x36\xe3\x38\x08\x16\x57\x6b\xeb\xf3\x41\xf9\x8f\xfa\xcb\x2d\x95\x76\x6f\x9e\x87\x4b\x8f\x6b\xeb\xf3\xf1\x6d\xb8\xf6\x28\xbc\x53\x3a\xd2\x93\xa7\xf5\x44\xe9\x33\x6e\xe5\x51\xc8\x68\x8f\x51\x08\xa8\xb4\xf2\x69\x2b\xab\xda\xb8\x52\x02\xf6\xbe\x5d\x52\x8b\xbc\x5b\xae\x56\x96\x82\xe5\xb5\x38\xa0\x8e\x90\xfb\x48\x62\x0e\xb5\x9d\x1f\x0b\x0b\x6c\x86\x71\x4a\xe2\x55\x22\xe4\x81\xe0\x6f\x79\x4d\x75\xfe\xf9\x6e\xb0\xf1\xf4\x10\xfe\xc6\x86\x0e\xa5\x6f\x38\xd1\x7f\x3e\xe5\x68\x31\x87\x92\x6b\x68\xc3\xd9\xc9\x0b\x8d\xb7\xa9\x68\x27\x1d\x70\xd6\x1e\x85\xbf\xdd\xa9\x97\xbf\x0b\x4a\x3f\xd5\xd6\xe7\x0f\x16\x1e\x6e\x7d\x7d\x38\xa9\x75\xd1\x2c\xb8\x47\x2e\x22\x2a\x4a\xdc\xc3\xdf\x01\x00\x00\xff\xff\xdb\xce\xf0\x12\xd7\x0b\x00\x00") + +func translationsZh_cnLc_messagesAcsenginePoBytes() ([]byte, error) { + return bindataRead( + _translationsZh_cnLc_messagesAcsenginePo, + "translations/zh_CN/LC_MESSAGES/acsengine.po", + ) +} + +func translationsZh_cnLc_messagesAcsenginePo() (*asset, error) { + bytes, err := translationsZh_cnLc_messagesAcsenginePoBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/acsengine.po", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "translations/default/LC_MESSAGES/acsengine.mo": translationsDefaultLc_messagesAcsengineMo, + "translations/default/LC_MESSAGES/acsengine.po": translationsDefaultLc_messagesAcsenginePo, + "translations/en_US/LC_MESSAGES/acsengine.mo": translationsEn_usLc_messagesAcsengineMo, + "translations/en_US/LC_MESSAGES/acsengine.po": translationsEn_usLc_messagesAcsenginePo, + "translations/zh_CN/LC_MESSAGES/acsengine.mo": translationsZh_cnLc_messagesAcsengineMo, + "translations/zh_CN/LC_MESSAGES/acsengine.po": translationsZh_cnLc_messagesAcsenginePo, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "translations": {nil, map[string]*bintree{ + "default": {nil, map[string]*bintree{ + "LC_MESSAGES": {nil, map[string]*bintree{ + "acsengine.mo": {translationsDefaultLc_messagesAcsengineMo, map[string]*bintree{}}, + "acsengine.po": {translationsDefaultLc_messagesAcsenginePo, map[string]*bintree{}}, + }}, + }}, + "en_US": {nil, map[string]*bintree{ + "LC_MESSAGES": {nil, map[string]*bintree{ + "acsengine.mo": {translationsEn_usLc_messagesAcsengineMo, map[string]*bintree{}}, + "acsengine.po": {translationsEn_usLc_messagesAcsenginePo, map[string]*bintree{}}, + }}, + }}, + "zh_CN": {nil, map[string]*bintree{ + "LC_MESSAGES": {nil, map[string]*bintree{ + "acsengine.mo": {translationsZh_cnLc_messagesAcsengineMo, map[string]*bintree{}}, + "acsengine.po": {translationsZh_cnLc_messagesAcsenginePo, map[string]*bintree{}}, + }}, + }}, + }}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} diff --git a/test/translations/default/LC_MESSAGES/acsengine.mo b/pkg/i18n/translations/default/LC_MESSAGES/acsengine.mo similarity index 100% rename from test/translations/default/LC_MESSAGES/acsengine.mo rename to pkg/i18n/translations/default/LC_MESSAGES/acsengine.mo diff --git a/test/translations/default/LC_MESSAGES/acsengine.po b/pkg/i18n/translations/default/LC_MESSAGES/acsengine.po similarity index 100% rename from test/translations/default/LC_MESSAGES/acsengine.po rename to pkg/i18n/translations/default/LC_MESSAGES/acsengine.po diff --git a/test/translations/en_US/LC_MESSAGES/acsengine.mo b/pkg/i18n/translations/en_US/LC_MESSAGES/acsengine.mo similarity index 100% rename from test/translations/en_US/LC_MESSAGES/acsengine.mo rename to pkg/i18n/translations/en_US/LC_MESSAGES/acsengine.mo diff --git a/test/translations/en_US/LC_MESSAGES/acsengine.po b/pkg/i18n/translations/en_US/LC_MESSAGES/acsengine.po similarity index 100% rename from test/translations/en_US/LC_MESSAGES/acsengine.po rename to pkg/i18n/translations/en_US/LC_MESSAGES/acsengine.po From db742c98e16f4c2c0e38c70c53b2bd6f483d64ec Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Fri, 19 May 2017 13:45:59 -0700 Subject: [PATCH 07/13] Fix reading bindata and unit test --- cmd/deploy.go | 3 +++ cmd/generate.go | 3 +++ cmd/upgrade.go | 3 +++ pkg/i18n/i18n.go | 40 ++++++++++++++++++++++++++++++++++++---- pkg/i18n/i18n_test.go | 25 +++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 4 deletions(-) diff --git a/cmd/deploy.go b/cmd/deploy.go index 6e75a9315b..83e6ba1a6e 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -82,6 +82,9 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) { var err error dc.locale, err = i18n.LoadTranslations() + if err != nil { + log.Fatalf("error loading translation files: %s", err.Error()) + } if dc.apimodelPath == "" { if len(args) > 0 { diff --git a/cmd/generate.go b/cmd/generate.go index 4e88a4a720..b31b9d46d5 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -67,6 +67,9 @@ func (gc *generateCmd) validate(cmd *cobra.Command, args []string) { var err error gc.locale, err = i18n.LoadTranslations() + if err != nil { + log.Fatalf("error loading translation files: %s", err.Error()) + } if gc.apimodelPath == "" { if len(args) > 0 { diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 5e8f4cdea1..59c23c0882 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -65,6 +65,9 @@ func (uc *upgradeCmd) validate(cmd *cobra.Command, args []string) { var err error uc.locale, err = i18n.LoadTranslations() + if err != nil { + log.Fatalf("error loading translation files: %s", err.Error()) + } if uc.resourceGroupName == "" { cmd.Usage() diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index 0ae3ed7ac9..1785ca4e12 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -3,16 +3,20 @@ package i18n import ( "errors" "fmt" + "io/ioutil" "os" "strings" + "path" + "github.com/leonelquinteros/gotext" ) const ( - defaultLanguage = "default" - defaultDomain = "acsengine" - defaultLocalDir = "translations" + defaultLanguage = "default" + defaultDomain = "acsengine" + defaultLocalDir = "translations" + defaultMessageDir = "LC_MESSAGES" ) var supportedTranslations = map[string]bool{ @@ -32,7 +36,10 @@ func loadSystemLanguage() string { if len(parts) == 0 { return defaultLanguage } - return parts[0] + if _, ok := supportedTranslations[parts[0]]; ok { + return parts[0] + } + return defaultLanguage } // LoadTranslations loads translation files and sets the locale to @@ -41,6 +48,31 @@ func LoadTranslations() (*gotext.Locale, error) { lang := loadSystemLanguage() SetLanguage(lang) + dir := path.Join(defaultLocalDir, lang, defaultMessageDir) + translationFiles := []string{ + path.Join(dir, fmt.Sprintf("%s.mo", defaultDomain)), + path.Join(dir, fmt.Sprintf("%s.po", defaultDomain)), + } + + if _, err := os.Stat(dir); os.IsNotExist(err) { + if err := os.MkdirAll(dir, 0700); err != nil { + return nil, err + } + } + + for _, file := range translationFiles { + if _, err := os.Stat(file); os.IsNotExist(err) { + data, err := Asset(file) + if err != nil { + return nil, err + } + err = ioutil.WriteFile(file, data, 0600) + if err != nil { + return nil, err + } + } + } + locale := gotext.NewLocale(defaultLocalDir, lang) Initialize(locale) diff --git a/pkg/i18n/i18n_test.go b/pkg/i18n/i18n_test.go index 0e0130dcdc..7926a68aa6 100644 --- a/pkg/i18n/i18n_test.go +++ b/pkg/i18n/i18n_test.go @@ -2,6 +2,7 @@ package i18n import ( "os" + "strings" "testing" . "github.com/onsi/gomega" @@ -10,6 +11,12 @@ import ( func TestLoadTranslations(t *testing.T) { RegisterTestingT(t) + origLang := os.Getenv("LANG") + if origLang != "" && !strings.HasPrefix(origLang, "en_US") { + // The unit test has only en_US translation files + return + } + _, err := LoadTranslations() Expect(err).Should(BeNil()) } @@ -45,6 +52,12 @@ func TestTranslationLanguageDefault(t *testing.T) { func TestTranslations(t *testing.T) { RegisterTestingT(t) + origLang := os.Getenv("LANG") + if origLang != "" && !strings.HasPrefix(origLang, "en_US") { + // The unit test has only en_US translation files + return + } + l, err := LoadTranslations() Expect(err).Should(BeNil()) @@ -62,6 +75,12 @@ func TestTranslations(t *testing.T) { func TestTranslationsPlural(t *testing.T) { RegisterTestingT(t) + origLang := os.Getenv("LANG") + if origLang != "" && !strings.HasPrefix(origLang, "en_US") { + // The unit test has only en_US translation files + return + } + l, err := LoadTranslations() Expect(err).Should(BeNil()) @@ -79,6 +98,12 @@ func TestTranslationsPlural(t *testing.T) { func TestTranslationsError(t *testing.T) { RegisterTestingT(t) + origLang := os.Getenv("LANG") + if origLang != "" && !strings.HasPrefix(origLang, "en_US") { + // The unit test has only en_US translation files + return + } + l, err := LoadTranslations() Expect(err).Should(BeNil()) From f16bb48ae740544d4203be8a9a6376045e3bb498 Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Thu, 1 Jun 2017 16:33:43 -0700 Subject: [PATCH 08/13] Update translation files --- pkg/i18n/translations.go | 12 ++--- scripts/update-translation.sh | 2 +- translations/default/LC_MESSAGES/acsengine.mo | Bin 2129 -> 2446 bytes translations/default/LC_MESSAGES/acsengine.po | 43 +++++++++++------- translations/en_US/LC_MESSAGES/acsengine.mo | Bin 2129 -> 2446 bytes translations/en_US/LC_MESSAGES/acsengine.po | 43 +++++++++++------- translations/zh_CN/LC_MESSAGES/acsengine.mo | Bin 2011 -> 2288 bytes translations/zh_CN/LC_MESSAGES/acsengine.po | 41 +++++++++++------ 8 files changed, 87 insertions(+), 54 deletions(-) diff --git a/pkg/i18n/translations.go b/pkg/i18n/translations.go index 007034a662..efbfb8b804 100644 --- a/pkg/i18n/translations.go +++ b/pkg/i18n/translations.go @@ -73,7 +73,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _translationsDefaultLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcd\x8e\x1b\xc5\x17\xc5\x8f\xed\x99\xf1\xfc\xfb\xcf\x67\x90\xf8\x10\x20\x6e\x16\x56\x82\x26\xed\xb4\x8d\x86\x8c\x7a\x98\x40\x08\x33\x68\xc2\x8c\x62\x0d\x9e\x88\x1d\x2a\x77\x5f\xb7\x2b\xb4\xab\x4c\x55\xb5\x33\x0e\x2f\x40\x1e\x00\x89\x07\x80\x0d\xac\x79\x86\x6c\x58\xc3\x8e\x3d\x3b\x56\x28\x4b\xd4\x5d\xed\x78\xc4\xc7\x86\x1d\x52\x7a\x53\xee\xeb\x73\x4f\xfd\xee\xa9\x56\xfd\x72\x61\xed\x2b\x00\x78\x1e\xc0\x6b\x00\xbe\x01\xf0\x12\x80\x2b\x0d\x54\xcf\x97\x0d\x80\x00\x3c\x68\x00\x5b\x00\xbe\x6b\x00\x07\x00\x7e\x6a\x00\x87\x00\x5e\x6f\x02\x7b\x00\xb2\x26\x70\x11\xc0\xb7\x4d\xe0\x32\x80\x87\x4d\xa0\x03\xe0\xb7\x26\xf0\x0a\x80\x17\x5b\x7e\x8d\x5a\xde\xe7\x56\x0b\xb8\x0e\x60\xde\xf2\xfe\x3f\xb4\x80\x37\x4a\xdf\x96\xe7\xf8\xbd\x05\xbc\x0a\xe0\x85\x35\xe0\x8b\x06\x70\x75\xcd\xeb\xbe\x5f\xf7\xfd\x3f\xae\x7b\x8e\x47\xeb\x9e\xe3\xdd\x0d\xcf\xf1\x60\xc3\x73\x3c\xdc\xf0\x1c\xbf\x6e\x78\x8e\x0b\x6d\xbf\xff\x4e\xbd\x9e\xb4\xbd\x4f\xde\xf6\x1c\x5f\xb7\xbd\xff\xcf\x6d\xcf\xf1\xa8\xed\x39\x5e\xde\xf4\x1c\xdb\x9b\x40\x19\xc9\x26\xfe\xfa\xb4\xeb\xb5\x05\xe0\xff\x75\x96\x4f\xd5\xb5\x75\x00\xcf\x01\x08\x00\x3c\x0d\xa0\x09\xe0\x59\x00\xff\x03\xb0\x01\x60\x0d\xc0\x33\xa5\x70\xdf\x18\x6d\xc8\xb0\x48\xa5\xca\x68\x2c\x73\xa6\x8e\xbd\x42\x55\x39\xa6\x8e\xad\x05\xf7\x26\xe5\x3f\x9f\x17\x6c\x16\xa5\xee\xc6\xc9\x31\x8d\xab\x3e\xab\x0b\x93\xb0\x8d\xa9\xb3\x35\xc7\x81\x2e\x54\x4a\xfd\x55\x99\xee\x49\x37\x21\xb7\x98\x95\xae\x24\x15\xb9\x09\x93\xe3\xe9\x2c\x17\x8e\xbb\x34\x9c\xb0\x61\xb2\x13\x5d\xe4\x29\x69\x95\x2f\x68\xc4\xd4\xab\x6d\x94\xfe\x77\x3e\x13\x31\x67\x1a\x31\x2b\xea\xe1\x74\x96\x19\x91\x32\x39\x4d\x1f\x15\x23\x36\x8a\x1d\x5b\xea\x75\xdf\xee\xf6\x49\x5a\x52\xda\x91\x2d\x66\x33\x6d\x1c\xa7\x34\x36\x7a\x4a\x73\x36\x56\x6a\x55\x8d\xce\xd5\xe8\x89\x61\xe1\xca\xa1\x53\x69\x38\x71\xda\x2c\xe8\x52\xc7\x5e\x3a\xa7\xe0\x33\x4e\x8a\x4a\xb2\x44\xaa\xc2\xa9\xc3\x8c\xa9\x33\xaf\x85\x19\x2b\x36\xde\xac\x58\x92\xd5\x1d\xe7\xec\x66\xc2\xd8\x73\x87\x71\xae\xff\x4f\xc7\x54\xf5\x8c\x85\xcc\x39\x2d\x27\x94\x4a\x3a\x29\x72\x79\x7f\xe5\xba\xdc\xb1\x3e\x4b\xa9\xe6\x22\x97\xe9\x72\xc8\x32\xcb\x12\x34\xd1\x6a\x59\x19\x89\xe4\x33\x1f\x44\xb1\xac\x71\x4a\x7a\x74\x97\x13\x07\x6d\x92\x09\x5b\x57\xf9\x55\x19\x94\x19\x16\xea\x71\x82\x58\x8d\xef\x01\x29\xd5\xec\x53\xe6\x33\x69\x1d\x0a\x65\x38\xd1\x99\x92\xf7\x39\xa5\x1b\x83\xc3\x3b\xf5\xae\xa5\x17\x16\x62\x9a\xff\x53\xe3\xc0\xe8\x92\x20\x3c\x4c\xc3\x3b\xcb\x03\x0a\x4e\xb8\xdc\x36\x3c\xb6\x99\x4c\xc3\xf7\x8b\xcc\x86\x43\x1d\x53\x30\xb8\x3d\x0c\x6f\x56\x67\xa6\x55\xf8\x41\x15\x6d\x3f\xea\x5d\x0b\xa3\xed\xb0\xb7\x43\xfd\x7e\x1c\x45\x5b\x51\x14\x45\xc1\xe0\x76\x78\xc2\x73\x69\xff\x56\xd7\xdb\x8e\xa3\xb7\xc2\xe8\x5a\x14\x05\x47\xc2\xba\x70\x68\x84\xb2\xb9\x4f\xf2\x96\x14\x2a\x73\x52\x28\x3a\x92\xf4\xce\xdd\xe5\x5b\x2e\xdf\x9b\x68\x37\x15\x32\xef\x26\x7a\x7a\x3d\x38\x12\x2a\x2b\x44\xc6\xe1\x90\xc5\x34\xa6\x7d\x95\xe5\xd2\x4e\x1e\x97\x63\x62\xf5\xe9\xe9\xc7\xc1\xf1\xe1\xf1\xfe\x6a\xaa\x5e\x37\x0a\x6e\x6a\xe5\x58\xb9\x70\xb8\x98\x71\x4c\x8e\xcf\xdc\xd5\x59\x2e\xa4\xda\xa5\x64\x22\x8c\x65\xb7\x77\x3a\x3c\x08\x77\x56\xba\x92\x6d\xcc\x26\xdc\x57\x89\x2e\x3f\x90\x98\x76\x46\xd2\x05\x83\xbc\x30\x22\x0f\x0f\xb4\x99\xda\x98\xd4\xac\x7a\xb5\x7b\xfd\x5d\xf2\x3f\xf7\x2e\x2b\xba\xb8\x47\xbd\x37\x77\x83\x4f\xc2\x0f\x57\x5f\xca\x40\x73\x2a\x1d\xf5\xbb\x51\xb7\x1f\x3c\xb9\x21\x9e\xdc\x10\xff\x81\x1b\xe2\x8f\x00\x00\x00\xff\xff\x34\x0a\xa1\x2a\x51\x08\x00\x00") +var _translationsDefaultLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcf\x6b\x24\xc5\x1b\xc6\x9f\x64\xe6\x9b\x4c\xe6\xeb\xcf\x55\x10\x51\xf1\xdd\xc3\xb8\x2b\xbb\x3d\xf6\x8c\x98\xdd\xed\x35\x8b\x6b\x4c\x34\x9a\x90\x21\x4e\x82\xe0\x41\x6a\xba\xdf\xe9\xa9\x6c\x4f\xd5\x58\x55\x3d\x9b\x59\xf0\x22\xde\x14\x3c\x79\xf6\x26\x08\x1e\x05\xaf\xeb\x51\xf0\xea\xc1\x8b\x07\x41\xff\x0c\x91\xee\xea\xd9\x09\x12\x51\x3c\xa7\x2e\xd5\x5d\xf5\xbc\x4f\x7d\xea\xa9\xa2\x7e\xb9\x50\xff\x02\x00\x9e\x00\xf0\x2c\x80\x6f\x01\x3c\x07\x60\x77\x09\x65\xbb\xbf\x04\x10\x80\xef\x97\x80\x2b\x00\x7e\x5d\x02\xb6\x01\x3c\xb2\x0c\xec\x00\x38\x5c\x06\x6e\x00\xf8\x72\x19\xd8\x00\xf0\xf3\x32\xb0\x09\xe0\xa9\x1a\x70\x11\xc0\xfb\x35\xe0\x32\x80\x8f\x6a\x40\x0b\xc0\x57\x35\xe0\x69\x00\x3f\x56\xfd\xef\x35\xef\x8b\x3a\x70\x0b\xc0\xd5\xba\x5f\xef\x4e\x1d\x78\x1e\xc0\x67\x75\xcf\xf5\x4d\x1d\x78\x06\xc0\x0f\x75\xe0\x93\x25\xe0\xb7\x4a\x77\xbc\xe2\xeb\x3f\x5d\xf1\x5c\xdf\xad\x78\xae\x3f\x56\x3c\xd7\x5b\xab\x9e\xeb\xe3\x55\xcf\x75\x7f\xd5\x73\xd5\x1b\x9e\xeb\x85\x86\xe7\xda\x6f\x78\x9e\xbc\xea\x3f\x6f\x78\xdf\xaf\x1b\x9e\xeb\xa7\x86\x5f\xef\xc9\x35\xcf\xf5\xca\x9a\xe7\x3a\x5c\xf3\x5c\x66\x0d\x28\x22\x7b\x08\xc0\xb2\xdf\x0e\x56\x00\xac\x02\x58\xf3\x51\xe2\x31\x2c\x5a\xb3\xea\x2f\x00\x78\x14\x40\x03\xc0\xe3\x45\xae\x00\xfe\x57\xcd\xd5\xaa\x73\x29\xda\xff\x01\x3c\x8c\x33\xda\x96\x31\xda\x90\x61\x91\x48\x95\xd2\x50\x66\x4c\x2d\x7b\x95\xca\xe1\x88\x5a\xb6\x12\xdc\x1d\x15\x33\x1f\xe6\x6c\x66\x85\xee\xf6\xc1\x1e\x0d\xcb\x3a\xab\x73\x13\xb3\x8d\xa8\x75\x65\x8a\x6d\x9d\xab\x84\xba\x8b\x61\xba\x2b\xdd\x88\xdc\x6c\x52\xb8\x92\x54\xe4\x46\x4c\x8e\xc7\x93\x4c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x9e\x25\xa4\x55\x36\xa3\x01\x53\xa7\xb2\x51\xfa\xbf\xf9\x8c\xc4\x94\x69\xc0\xac\xa8\x83\xbe\x76\x22\xa3\x58\xe7\xca\x91\x1e\xd2\x58\x58\xc7\x86\x8e\xf6\x0a\xde\x84\xf8\x24\x66\x4e\xb8\xf8\x98\x70\xec\x38\xf1\xca\x62\x0e\x87\x93\xd4\x88\x84\xc9\x69\x7a\x27\x1f\xb0\x51\xec\xd8\x52\xa7\xbd\xde\xee\x92\xb4\xa4\xb4\x23\x9b\x4f\x26\xda\x14\x65\x43\xa3\xc7\x34\x65\x63\xa5\x56\x65\x68\x67\x57\x9f\x52\xfc\x0b\x0f\x2e\x83\x8f\x0d\x0b\x57\x44\x9e\x48\xc3\xb1\xd3\x66\x46\x97\x5a\xf6\xd2\x29\x05\x9f\x70\x9c\x97\x92\x79\x20\xe5\xd1\x54\x47\x19\x51\x6b\x5a\x09\x53\x56\x6c\xbc\x59\x3e\xe7\xab\x2a\x4e\xd9\x4d\x84\xb1\xa7\xae\xc2\xa9\xfa\xbf\x5c\x92\xb2\x66\x28\x64\xc6\x49\xb1\x4f\xa9\xa4\x93\x22\x93\xf7\x16\xae\xf3\x15\xab\x9b\x24\xd5\x54\x64\x32\x99\x6f\xb2\x48\xa1\x00\x8d\xb5\x9a\x8f\x0c\x44\x7c\xc7\x07\x91\xcf\xc7\x38\x21\x3d\x38\xe6\xd8\x41\x9b\x78\xc4\xd6\x95\x7e\x65\x06\x45\x86\xb9\x7a\x90\x20\x16\xdb\xf7\x80\x94\x68\xf6\x29\xf3\x89\xb4\x0e\xb9\x32\x1c\xeb\x54\xc9\x7b\x9c\xd0\xed\xde\xce\x51\xb5\x6a\xe1\x85\x99\x18\x67\x7f\x57\xd8\x33\xba\x20\x08\x76\x92\xe0\x68\x7e\x40\x22\xb6\xac\x52\xa9\xb8\x79\xc0\xc5\xfa\xc1\x9e\x4d\x65\x12\xbc\x9e\xa7\x36\xe8\xeb\x88\x9a\xbd\xfd\x7e\xb0\x59\x1e\x9e\x56\xc1\x1b\x65\xc6\xdd\xb0\x73\x2d\x08\xd7\x83\xb0\x43\xdd\x97\xa3\xce\xfa\x95\x30\x0c\xc3\x66\x6f\x3f\x38\xe0\xa9\xb4\x67\xea\x3a\xeb\x51\xe7\x46\x10\x5e\x0b\xc3\xe6\xae\xb0\x2e\xe8\x1b\xa1\x6c\xe6\x23\x7d\x5b\x0a\x95\x3a\x29\x14\xed\x4a\x7a\xf5\x78\xfe\x97\xc9\xd7\x46\xda\x8d\x85\xcc\xda\xb1\x1e\xdf\x6a\xee\x0a\x95\xe6\x22\xe5\xa0\xcf\x62\x1c\xd1\x96\x4a\x33\x69\x47\x0f\x86\x23\x62\xf5\xc1\xe1\xbb\xcd\xbd\x9d\xbd\xad\xc5\xf6\x3a\xed\xb0\xb9\xa9\x95\x63\xe5\x82\xfe\x6c\xc2\x11\x39\x3e\x71\x2f\x4d\x32\x21\xd5\x4d\x8a\x47\xc2\x58\x76\x1b\x87\xfd\xed\xe0\xfa\x42\x57\xb0\x0d\xd9\x04\x5b\x2a\xd6\xc5\x4d\x89\xe8\xfa\x40\xba\x66\x2f\xcb\x8d\xc8\x82\x6d\x6d\xc6\x36\x22\x35\x29\x7f\xed\x46\xf7\x26\xf9\xcf\x8d\xcb\x8a\x2e\x6e\x50\xe7\xc5\x9b\xcd\xf7\x82\x37\x17\x57\xa6\xa7\x39\x91\x8e\xba\xed\xb0\xdd\x6d\x9e\x3f\x54\xe7\x0f\xd5\xf9\x43\xf5\x0f\x0f\xd5\x9f\x01\x00\x00\xff\xff\x4b\x51\xd4\xd3\x8e\x09\x00\x00") func translationsDefaultLc_messagesAcsengineMoBytes() ([]byte, error) { return bindataRead( @@ -93,7 +93,7 @@ func translationsDefaultLc_messagesAcsengineMo() (*asset, error) { return a, nil } -var _translationsDefaultLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x4f\xe3\x46\x10\xfe\x9e\x5f\x31\x4d\x14\xdd\x9d\x8e\x35\xb6\x21\x81\x33\xa5\xea\x95\x42\x45\x7b\xa8\x88\x86\xaa\x1f\x2a\x55\x1b\x7b\x62\xef\x61\xef\xba\xfb\x92\x23\xf7\xeb\xab\x5d\xdb\x09\x2f\x9b\x17\x7a\x7c\x40\x38\xeb\x67\x67\x9e\x99\x79\xe6\x49\x06\x70\xce\xf3\x92\xa9\x02\xb4\xa4\x5c\x95\x54\x33\xc1\x15\xcc\x84\x04\x9a\x2a\xe4\x39\xe3\x08\x35\x4d\xef\x68\x8e\x41\x6f\x00\x67\xa2\x5e\x48\x96\x17\x1a\xde\x9e\xbd\x83\x38\x8c\x8e\x7a\x03\x98\x14\x4c\xc1\x8c\x95\x08\x4c\x41\xc6\x94\x96\x6c\x6a\x34\x66\x60\x78\x86\x12\x74\x81\xa0\x68\x85\x50\xb2\x14\xb9\x42\xa0\xca\x9d\x79\x13\xfc\xca\x28\xcf\x35\xa3\x1c\x3e\x31\xf8\xfe\x73\xf7\xa9\x64\x3f\x16\x42\x57\x94\x95\x41\x2a\xaa\x1f\xf6\x5c\xea\xa0\x37\xe8\x55\x2a\x67\x19\xf4\xfb\xf6\x41\x69\x69\x9f\xfa\xd7\x52\x7c\xc6\x54\x93\xcb\x8c\xfc\x89\x52\x31\xc1\x13\xf8\x9b\xf7\x7b\xfd\x1b\xac\x85\xd4\xe4\xca\xde\x21\x3f\x99\x5c\x91\x89\x68\x5f\x5d\xff\x3e\x21\x67\x12\x5d\xfd\xe4\x67\xaa\x31\x71\x29\x48\x38\x22\xd1\x31\xc4\x71\x12\x86\xef\xc3\x30\x0c\x5b\x30\xb9\xc1\x39\x53\x5e\x6c\x34\x4a\xc2\x03\x12\x1e\xb5\xd8\x4f\x54\x69\x32\x69\x9b\x2b\x64\xb2\x63\x85\xed\x5d\x9e\x1b\x9a\x23\x99\x20\xad\x92\x6e\x54\x8f\x5e\x25\x80\xfc\x9f\xdb\x3f\xdc\xd9\xd5\xe5\xd5\xf9\xaa\xe2\x28\x68\x08\x9c\x09\xae\x91\x6b\x32\x59\xd4\x98\x80\xc6\x7b\xbd\x5f\x97\x94\xf1\x13\x48\x0b\x2a\x15\xea\xd3\xdb\xc9\x05\x39\x7e\x8c\xb5\x7c\x67\x28\xc9\x39\x4f\x45\xc6\x78\x9e\xc0\xf1\x94\xe9\xa6\xf8\xd2\x48\x5a\x92\x0b\x21\x2b\x95\x00\xaf\xdd\x47\x75\x1a\x9f\x40\xf3\x78\xfa\x96\xc3\x77\xa7\x10\xbd\x3b\x71\xf0\xbf\xc8\x2f\xc8\x51\x36\xb5\x5f\x0b\xcc\x98\x86\x38\x08\x83\xd8\xbe\xed\x0d\x12\xa8\xef\xf2\xfd\xa5\x14\xf6\x9b\x7f\x41\x2e\x92\x38\x8e\x7a\x83\x3d\x48\xc9\x4c\xc8\x8a\xea\x6e\xd2\xe7\x52\x0a\x09\x12\xa9\xa5\xd5\xa8\x6e\xa8\xf6\xc0\x1d\x27\x30\x54\x2b\x25\x6c\x47\x76\xe9\x45\x6d\x09\x5a\xe5\xef\x9b\x3a\x97\x34\xc3\xb4\x34\x4a\xa3\xb4\x3c\x0e\x3f\xac\xa7\xf1\xa5\xb0\x51\xff\x35\x28\x17\x36\xc7\xc7\x9b\x2b\xb7\x3a\x12\x95\x30\x32\x45\x95\xc0\xf0\xfd\xfc\x29\xa3\x1d\x2f\x3d\xef\x8d\x5b\x51\x4b\xc3\xd2\xfa\x70\xe8\xa3\x75\x21\x0c\xcf\x20\x5e\x05\x83\x2f\x4c\x17\xa0\x17\xb5\x2d\x1e\x18\x77\x9b\xa7\xb1\xaa\x4b\xaa\x31\x80\x49\x81\x12\x41\x15\xc2\x94\x19\x08\x5e\x2e\x60\x8a\x10\xad\x18\xbf\x56\xbc\x2d\xc5\x44\xd6\x47\xd6\x55\xc3\xc5\xff\x4b\x5f\xd0\x39\xc2\x14\x91\x3f\x2f\xe8\x55\x42\x7a\xd4\x73\x67\xa6\x28\x39\x6a\x54\xd1\x38\x6e\xa5\xe4\x44\x14\x8f\x77\xd2\xda\xd8\x3b\xd4\xdb\x06\x07\x5a\xc0\x6f\xcb\x04\x10\x05\xe3\x20\xb6\x8e\xcb\x85\x06\x65\x6a\x6b\x6d\x98\xc1\x4c\x8a\x0a\xe6\x9d\x09\x3c\xdc\x87\x6f\x0c\xf3\x7c\x84\xc2\xe8\xda\x68\x37\xbf\xd0\xbb\x24\xe8\xf4\x9e\x3a\x5b\xe5\x39\x64\x4c\x62\xaa\x85\x5c\xc0\x9b\xa1\x7a\xf3\x98\xdc\x0e\xd0\x4d\x66\x11\x85\xd1\x78\x3d\x03\xbc\xc7\xd4\xb8\xb8\xdd\x5c\xdd\xc6\xb5\x96\x90\xc0\x70\xfe\x94\xc8\x2e\x37\x5e\x32\xff\x51\xbc\x9e\x5d\xde\xf8\xa3\x4d\x66\xba\x11\xb5\x49\x7d\x3d\xda\x0a\xdf\xd2\x27\xaf\xab\x36\xa1\x6b\x2a\xd5\x03\xaf\xf4\x35\xc6\x0b\x59\x66\xac\x99\xfd\x2b\xc5\x52\xf6\x07\xcb\xf3\x96\xeb\xe3\xd7\xe1\x7a\x2e\x4f\x7c\xdb\xd7\x09\x2f\xe4\x25\x53\x39\xf4\x6a\x66\x46\x59\x89\x99\x5d\x13\xc6\x99\x66\xb4\x64\x5f\x57\x2d\xee\xda\xff\xf4\xcb\xe6\x45\x97\xd6\xf6\x2b\x3a\x18\x6f\x6c\xd8\x91\xb7\x61\x8c\xcf\x69\xc9\xb2\x6e\x5d\xad\x8d\x59\xb1\xa6\x82\x77\x27\x53\x9a\xde\x35\x2b\x6d\xba\x33\xcc\x40\x4c\xed\xcf\xa4\x55\x0d\xdf\x1a\x67\x93\xf0\x0e\x42\xef\x06\x08\x99\x16\xa8\xb4\xeb\x8d\x5b\x75\xeb\x44\x86\x2f\x7d\x68\x45\x6e\x3b\x72\xa3\xee\xc7\x5e\x83\x5a\x2d\x77\x23\x21\xc8\x04\x36\x4e\x88\xf7\x4c\x3d\x68\xcd\x56\xe0\xda\x91\x1e\x1f\x6e\x9c\xe8\xc8\xbb\x8e\x86\x4b\x4c\x45\xce\xd9\x57\xcc\xe0\xe3\xf5\x65\xfb\xa3\xce\xd5\xbd\x22\xb5\x19\xb5\xd9\x06\xc2\x91\x2f\xef\x82\x56\xe5\xd6\x5e\x6c\x04\xfd\x17\x00\x00\xff\xff\xeb\xf0\xcc\x89\x51\x0c\x00\x00") +var _translationsDefaultLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x53\xe3\x36\x10\xfe\x9e\x5f\xb1\x25\xc3\xdc\xdd\x1c\x0e\xb6\x03\x06\x4c\xe9\xf4\x4a\xa1\x43\x7b\x4c\x19\x1a\x6e\xfa\xa1\x33\x1d\x45\xde\xd8\x3a\x6c\xc9\xd5\x4b\x8e\xdc\xaf\xef\x48\xb6\x63\x5e\x1c\x27\x17\xee\x03\x83\x23\xad\x76\x9f\x67\x5f\x1e\x69\x08\x17\x3c\xcd\x99\xca\x40\x4b\xc2\x55\x4e\x34\x13\x5c\xc1\x4c\x48\x20\x54\x21\x4f\x19\x47\x28\x09\xbd\x27\x29\x8e\x06\x43\x38\x17\xe5\x42\xb2\x34\xd3\xf0\xf6\xfc\x1d\x84\x7e\x70\x34\x18\xc2\x24\x63\x0a\x66\x2c\x47\x60\x0a\x12\xa6\xb4\x64\x53\xa3\x31\x01\xc3\x13\x94\xa0\x33\x04\x45\x0a\x84\x9c\x51\xe4\x0a\x81\x28\xb7\xd6\x19\xe0\x77\x46\x78\xaa\x19\xe1\xf0\x91\xc1\x8f\x9f\x9b\x5f\x39\xfb\x39\x13\xba\x20\x2c\x1f\x51\x51\xfc\xb4\xe7\x42\x8f\x06\xc3\x41\xa1\x52\x96\xc0\xce\x8e\xfd\x50\x5a\xda\xaf\x9d\x1b\x29\x3e\x23\xd5\xde\x55\xe2\x7d\x42\xa9\x98\xe0\x71\x1b\xec\x1f\xbe\x33\xd8\xb9\xc5\x52\x48\xed\x5d\xdb\xc3\xde\x2f\x26\x55\xde\x44\xc4\xe0\xb6\x6e\xfe\x9c\x78\xe7\x12\x5d\x22\xbc\x5f\x89\xc6\xd8\xc5\xf2\xfc\xc8\xf3\x03\x08\xc7\x71\x10\xbd\xf7\x7d\xdf\xaf\x8d\xbd\x5b\x9c\x33\xd5\x69\x1b\x44\x71\x70\xe2\xf9\x47\xb5\xed\x47\xa2\xb4\x37\xa9\xb3\x2c\x64\xbc\x21\xd5\xfa\x2c\x4f\x0d\x49\xd1\x9b\x20\x29\xe2\xa6\x66\x4f\xb6\x62\x40\xfe\xef\xdd\x5f\x6e\xed\xfa\xea\xfa\xa2\xa5\x1e\x8c\x2a\x00\xe7\x82\x6b\xe4\xda\x9b\x2c\x4a\x8c\x41\xe3\x83\xde\x2f\x73\xc2\xf8\x29\xd0\x8c\x48\x85\xfa\xec\x6e\x72\xe9\x1d\x3f\xb5\xb5\x78\x67\x28\xbd\x0b\x4e\x45\xc2\x78\x1a\xc3\xf1\x94\xe9\x8a\x7c\x6e\x24\xc9\xbd\x4b\x21\x0b\x15\x03\x2f\xdd\x4f\x75\x16\x9e\x42\xf5\x79\xf6\x96\xc3\x0f\x67\x10\xbc\x3b\x75\xe6\x7f\x7b\xbf\x21\x47\x59\x71\xbf\x11\x98\x30\x0d\xe1\xc8\x1f\x85\x76\x77\x30\x8c\xa1\xbc\x4f\xf7\x97\x65\xda\xaf\xfe\x8d\x52\x11\x87\x61\x34\x18\xee\x01\xf5\x66\x42\x16\x44\x37\x25\xbf\x90\x52\x48\x90\x48\x2c\xac\xaa\xfd\x76\xd5\x1e\xb8\xe5\x18\x76\x55\xdb\x12\xeb\x2d\x9b\xf0\xa2\xb4\x00\xed\x08\xec\xdf\x9b\x29\x4a\x8e\x1a\x95\x29\x53\x49\x12\xdc\xaf\xff\xd3\xdc\x28\x8d\xd2\x22\x8b\x8e\x57\x03\xfb\x92\xd9\x38\xff\x19\x94\x0b\x1b\xf5\xc3\xed\xb5\x9b\x2a\x89\x4a\x18\x49\x51\xc5\xb0\xfb\x7e\xfe\x1c\xe3\x86\x87\x5e\x66\xcb\x4d\xaf\x85\x61\x61\x9d\x1c\x75\xc1\xba\x14\x86\x27\x10\xb6\xce\xe0\x0b\xd3\x19\xe8\x45\x69\xd3\x01\x8c\xbb\xa1\xd4\x58\x94\x39\xd1\x38\x82\x49\x86\x12\x41\x65\xc2\xe4\x09\x08\x9e\x2f\x60\x8a\x10\xb4\x88\xbf\x97\xbf\x35\x64\x82\xd0\x5f\xcd\x86\x8b\xed\xc2\x67\x64\x8e\x30\x45\xe4\x2f\x09\x7d\x17\x97\x1b\xf5\xd3\x3c\x88\xc2\xfa\xdb\x75\x53\xe0\x07\x5d\x4c\x27\x42\x93\x1c\xa8\x30\x5c\x83\x98\x41\x41\x6c\xf7\xc1\xa7\x6b\xdb\x0c\x09\xe0\x03\x45\x4c\xd0\x7e\x94\x48\xad\xe8\x3a\x4b\xbb\xd7\x32\x7b\x85\x8b\xad\x98\x8c\x3b\x4b\x76\x57\x59\x80\x16\xf0\xc7\xd2\x05\x04\xa3\x68\x14\xda\x8b\x83\x0b\x0d\xca\x94\x56\x98\x31\x81\x99\x14\x05\xcc\x1b\x09\x7b\x3c\xcd\xaf\x74\xb3\xe5\xa8\x1f\x8f\x37\xa7\xf4\x28\xde\xeb\x89\x7d\xa3\xb3\x97\xd3\x24\x8c\x2e\x8d\xae\x1a\xec\xa4\x8b\x04\x3a\xe9\xa1\xee\xce\xe3\x29\x24\x4c\x22\xd5\x42\x2e\xe0\xcd\xae\x7a\xf3\x14\xe2\x06\xa6\x7d\x4a\x1e\xf8\xdd\x9d\x51\xb9\xc5\x07\xa4\xc6\xf9\x6d\x46\xcc\x89\x5f\xad\xd7\x31\xec\xce\x9f\x03\xd9\xe4\xc4\x56\x0d\x1c\x45\xdb\x4d\x70\x14\x6c\x75\x2e\x3c\x0c\x57\xa7\x25\xad\x6e\x4d\xcb\xd2\x34\x1d\x52\xb3\xed\x2a\xce\x5a\xf3\xfe\x02\x85\x87\xab\x91\x94\x44\xaa\x47\x37\x68\x57\x45\x3a\x4d\x96\x11\x4b\x66\xff\x72\xb1\xe4\x3d\x5e\xae\xd7\x58\x9f\x6e\xf7\x34\xcb\xb3\xdb\xbc\x2b\x13\x9d\x26\xdb\xd5\xe7\xa0\xf3\x05\x32\x23\x2c\xc7\xc4\xce\x2b\xe3\x4c\x33\x92\xb3\xaf\x6d\xb2\x9b\x42\x3c\x7f\x8c\x7c\xd3\xa1\x95\x99\x0b\xc6\x51\x6f\xea\x8e\x3a\x53\xc7\xf8\x9c\xe4\x2c\x69\x14\xc3\x4a\x8a\x9d\x17\x2a\x78\xb3\x32\x25\xf4\xbe\x52\x15\xd3\xac\x61\x02\x62\x6a\xdf\xd3\x2d\x87\xd7\xfa\xe9\x6b\xc1\xb1\xdf\xf9\x7a\x11\x92\x66\xa8\xb4\xcb\x8d\x53\x1b\x2b\x86\x86\x2f\xa5\xb0\x05\xb7\xde\xb2\x77\x02\x8e\x0e\xba\xc2\xb7\xfa\x52\x35\x13\x24\x02\x2b\x31\xc6\x07\xa6\x1e\xa5\x66\xad\xe1\xca\x92\x1e\x1f\xf4\x56\xf4\xb0\xf3\x71\x60\xb8\x44\x2a\x52\xce\xbe\x62\x02\x1f\x6e\xae\xea\x47\xbf\xe3\xdd\x82\xea\xb7\xea\x17\x84\xa0\xf3\xce\x58\x90\x22\x5f\x9b\x8b\x5e\xa3\xff\x03\x00\x00\xff\xff\x21\x6c\x1f\x71\x7a\x0e\x00\x00") func translationsDefaultLc_messagesAcsenginePoBytes() ([]byte, error) { return bindataRead( @@ -113,7 +113,7 @@ func translationsDefaultLc_messagesAcsenginePo() (*asset, error) { return a, nil } -var _translationsEn_usLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcd\x8e\x1b\xc5\x17\xc5\x8f\xed\x99\xf1\xfc\xfb\xcf\x67\x90\xf8\x10\x20\x6e\x16\x56\x82\x26\xed\xb4\x8d\x86\x8c\x7a\x98\x40\x08\x33\x68\xc2\x8c\x62\x0d\x9e\x88\x1d\x2a\x77\x5f\xb7\x2b\xb4\xab\x4c\x55\xb5\x33\x0e\x2f\x40\x1e\x00\x89\x07\x80\x0d\xac\x79\x86\x6c\x58\xc3\x8e\x3d\x3b\x56\x28\x4b\xd4\x5d\xed\x78\xc4\xc7\x86\x1d\x52\x7a\x53\xee\xeb\x73\x4f\xfd\xee\xa9\x56\xfd\x72\x61\xed\x2b\x00\x78\x1e\xc0\x6b\x00\xbe\x01\xf0\x12\x80\x2b\x0d\x54\xcf\x97\x0d\x80\x00\x3c\x68\x00\x5b\x00\xbe\x6b\x00\x07\x00\x7e\x6a\x00\x87\x00\x5e\x6f\x02\x7b\x00\xb2\x26\x70\x11\xc0\xb7\x4d\xe0\x32\x80\x87\x4d\xa0\x03\xe0\xb7\x26\xf0\x0a\x80\x17\x5b\x7e\x8d\x5a\xde\xe7\x56\x0b\xb8\x0e\x60\xde\xf2\xfe\x3f\xb4\x80\x37\x4a\xdf\x96\xe7\xf8\xbd\x05\xbc\x0a\xe0\x85\x35\xe0\x8b\x06\x70\x75\xcd\xeb\xbe\x5f\xf7\xfd\x3f\xae\x7b\x8e\x47\xeb\x9e\xe3\xdd\x0d\xcf\xf1\x60\xc3\x73\x3c\xdc\xf0\x1c\xbf\x6e\x78\x8e\x0b\x6d\xbf\xff\x4e\xbd\x9e\xb4\xbd\x4f\xde\xf6\x1c\x5f\xb7\xbd\xff\xcf\x6d\xcf\xf1\xa8\xed\x39\x5e\xde\xf4\x1c\xdb\x9b\x40\x19\xc9\x26\xfe\xfa\xb4\xeb\xb5\x05\xe0\xff\x75\x96\x4f\xd5\xb5\x75\x00\xcf\x01\x08\x00\x3c\x0d\xa0\x09\xe0\x59\x00\xff\x03\xb0\x01\x60\x0d\xc0\x33\xa5\x70\xdf\x18\x6d\xc8\xb0\x48\xa5\xca\x68\x2c\x73\xa6\x8e\xbd\x42\x55\x39\xa6\x8e\xad\x05\xf7\x26\xe5\x3f\x9f\x17\x6c\x16\xa5\xee\xc6\xc9\x31\x8d\xab\x3e\xab\x0b\x93\xb0\x8d\xa9\xb3\x35\xc7\x81\x2e\x54\x4a\xfd\x55\x99\xee\x49\x37\x21\xb7\x98\x95\xae\x24\x15\xb9\x09\x93\xe3\xe9\x2c\x17\x8e\xbb\x34\x9c\xb0\x61\xb2\x13\x5d\xe4\x29\x69\x95\x2f\x68\xc4\xd4\xab\x6d\x94\xfe\x77\x3e\x13\x31\x67\x1a\x31\x2b\xea\xe1\x74\x96\x19\x91\x32\x39\x4d\x1f\x15\x23\x36\x8a\x1d\x5b\xea\x75\xdf\xee\xf6\x49\x5a\x52\xda\x91\x2d\x66\x33\x6d\x1c\xa7\x34\x36\x7a\x4a\x73\x36\x56\x6a\x55\x8d\xce\xd5\xe8\x89\x61\xe1\xca\xa1\x53\x69\x38\x71\xda\x2c\xe8\x52\xc7\x5e\x3a\xa7\xe0\x33\x4e\x8a\x4a\xb2\x44\xaa\xc2\xa9\xc3\x8c\xa9\x33\xaf\x85\x19\x2b\x36\xde\xac\x58\x92\xd5\x1d\xe7\xec\x66\xc2\xd8\x73\x87\x71\xae\xff\x4f\xc7\x54\xf5\x8c\x85\xcc\x39\x2d\x27\x94\x4a\x3a\x29\x72\x79\x7f\xe5\xba\xdc\xb1\x3e\x4b\xa9\xe6\x22\x97\xe9\x72\xc8\x32\xcb\x12\x34\xd1\x6a\x59\x19\x89\xe4\x33\x1f\x44\xb1\xac\x71\x4a\x7a\x74\x97\x13\x07\x6d\x92\x09\x5b\x57\xf9\x55\x19\x94\x19\x16\xea\x71\x82\x58\x8d\xef\x01\x29\xd5\xec\x53\xe6\x33\x69\x1d\x0a\x65\x38\xd1\x99\x92\xf7\x39\xa5\x1b\x83\xc3\x3b\xf5\xae\xa5\x17\x16\x62\x9a\xff\x53\xe3\xc0\xe8\x92\x20\x3c\x4c\xc3\x3b\xcb\x03\x0a\x4e\xb8\xdc\x36\x3c\xb6\x99\x4c\xc3\xf7\x8b\xcc\x86\x43\x1d\x53\x30\xb8\x3d\x0c\x6f\x56\x67\xa6\x55\xf8\x41\x15\x6d\x3f\xea\x5d\x0b\xa3\xed\xb0\xb7\x43\xfd\x7e\x1c\x45\x5b\x51\x14\x45\xc1\xe0\x76\x78\xc2\x73\x69\xff\x56\xd7\xdb\x8e\xa3\xb7\xc2\xe8\x5a\x14\x05\x47\xc2\xba\x70\x68\x84\xb2\xb9\x4f\xf2\x96\x14\x2a\x73\x52\x28\x3a\x92\xf4\xce\xdd\xe5\x5b\x2e\xdf\x9b\x68\x37\x15\x32\xef\x26\x7a\x7a\x3d\x38\x12\x2a\x2b\x44\xc6\xe1\x90\xc5\x34\xa6\x7d\x95\xe5\xd2\x4e\x1e\x97\x63\x62\xf5\xe9\xe9\xc7\xc1\xf1\xe1\xf1\xfe\x6a\xaa\x5e\x37\x0a\x6e\x6a\xe5\x58\xb9\x70\xb8\x98\x71\x4c\x8e\xcf\xdc\xd5\x59\x2e\xa4\xda\xa5\x64\x22\x8c\x65\xb7\x77\x3a\x3c\x08\x77\x56\xba\x92\x6d\xcc\x26\xdc\x57\x89\x2e\x3f\x90\x98\x76\x46\xd2\x05\x83\xbc\x30\x22\x0f\x0f\xb4\x99\xda\x98\xd4\xac\x7a\xb5\x7b\xfd\x5d\xf2\x3f\xf7\x2e\x2b\xba\xb8\x47\xbd\x37\x77\x83\x4f\xc2\x0f\x57\x5f\xca\x40\x73\x2a\x1d\xf5\xbb\x51\xb7\x1f\x3c\xb9\x21\x9e\xdc\x10\xff\x81\x1b\xe2\x8f\x00\x00\x00\xff\xff\x34\x0a\xa1\x2a\x51\x08\x00\x00") +var _translationsEn_usLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcf\x6b\x24\xc5\x1b\xc6\x9f\x64\xe6\x9b\x4c\xe6\xeb\xcf\x55\x10\x51\xf1\xdd\xc3\xb8\x2b\xbb\x3d\xf6\x8c\x98\xdd\xed\x35\x8b\x6b\x4c\x34\x9a\x90\x21\x4e\x82\xe0\x41\x6a\xba\xdf\xe9\xa9\x6c\x4f\xd5\x58\x55\x3d\x9b\x59\xf0\x22\xde\x14\x3c\x79\xf6\x26\x08\x1e\x05\xaf\xeb\x51\xf0\xea\xc1\x8b\x07\x41\xff\x0c\x91\xee\xea\xd9\x09\x12\x51\x3c\xa7\x2e\xd5\x5d\xf5\xbc\x4f\x7d\xea\xa9\xa2\x7e\xb9\x50\xff\x02\x00\x9e\x00\xf0\x2c\x80\x6f\x01\x3c\x07\x60\x77\x09\x65\xbb\xbf\x04\x10\x80\xef\x97\x80\x2b\x00\x7e\x5d\x02\xb6\x01\x3c\xb2\x0c\xec\x00\x38\x5c\x06\x6e\x00\xf8\x72\x19\xd8\x00\xf0\xf3\x32\xb0\x09\xe0\xa9\x1a\x70\x11\xc0\xfb\x35\xe0\x32\x80\x8f\x6a\x40\x0b\xc0\x57\x35\xe0\x69\x00\x3f\x56\xfd\xef\x35\xef\x8b\x3a\x70\x0b\xc0\xd5\xba\x5f\xef\x4e\x1d\x78\x1e\xc0\x67\x75\xcf\xf5\x4d\x1d\x78\x06\xc0\x0f\x75\xe0\x93\x25\xe0\xb7\x4a\x77\xbc\xe2\xeb\x3f\x5d\xf1\x5c\xdf\xad\x78\xae\x3f\x56\x3c\xd7\x5b\xab\x9e\xeb\xe3\x55\xcf\x75\x7f\xd5\x73\xd5\x1b\x9e\xeb\x85\x86\xe7\xda\x6f\x78\x9e\xbc\xea\x3f\x6f\x78\xdf\xaf\x1b\x9e\xeb\xa7\x86\x5f\xef\xc9\x35\xcf\xf5\xca\x9a\xe7\x3a\x5c\xf3\x5c\x66\x0d\x28\x22\x7b\x08\xc0\xb2\xdf\x0e\x56\x00\xac\x02\x58\xf3\x51\xe2\x31\x2c\x5a\xb3\xea\x2f\x00\x78\x14\x40\x03\xc0\xe3\x45\xae\x00\xfe\x57\xcd\xd5\xaa\x73\x29\xda\xff\x01\x3c\x8c\x33\xda\x96\x31\xda\x90\x61\x91\x48\x95\xd2\x50\x66\x4c\x2d\x7b\x95\xca\xe1\x88\x5a\xb6\x12\xdc\x1d\x15\x33\x1f\xe6\x6c\x66\x85\xee\xf6\xc1\x1e\x0d\xcb\x3a\xab\x73\x13\xb3\x8d\xa8\x75\x65\x8a\x6d\x9d\xab\x84\xba\x8b\x61\xba\x2b\xdd\x88\xdc\x6c\x52\xb8\x92\x54\xe4\x46\x4c\x8e\xc7\x93\x4c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x9e\x25\xa4\x55\x36\xa3\x01\x53\xa7\xb2\x51\xfa\xbf\xf9\x8c\xc4\x94\x69\xc0\xac\xa8\x83\xbe\x76\x22\xa3\x58\xe7\xca\x91\x1e\xd2\x58\x58\xc7\x86\x8e\xf6\x0a\xde\x84\xf8\x24\x66\x4e\xb8\xf8\x98\x70\xec\x38\xf1\xca\x62\x0e\x87\x93\xd4\x88\x84\xc9\x69\x7a\x27\x1f\xb0\x51\xec\xd8\x52\xa7\xbd\xde\xee\x92\xb4\xa4\xb4\x23\x9b\x4f\x26\xda\x14\x65\x43\xa3\xc7\x34\x65\x63\xa5\x56\x65\x68\x67\x57\x9f\x52\xfc\x0b\x0f\x2e\x83\x8f\x0d\x0b\x57\x44\x9e\x48\xc3\xb1\xd3\x66\x46\x97\x5a\xf6\xd2\x29\x05\x9f\x70\x9c\x97\x92\x79\x20\xe5\xd1\x54\x47\x19\x51\x6b\x5a\x09\x53\x56\x6c\xbc\x59\x3e\xe7\xab\x2a\x4e\xd9\x4d\x84\xb1\xa7\xae\xc2\xa9\xfa\xbf\x5c\x92\xb2\x66\x28\x64\xc6\x49\xb1\x4f\xa9\xa4\x93\x22\x93\xf7\x16\xae\xf3\x15\xab\x9b\x24\xd5\x54\x64\x32\x99\x6f\xb2\x48\xa1\x00\x8d\xb5\x9a\x8f\x0c\x44\x7c\xc7\x07\x91\xcf\xc7\x38\x21\x3d\x38\xe6\xd8\x41\x9b\x78\xc4\xd6\x95\x7e\x65\x06\x45\x86\xb9\x7a\x90\x20\x16\xdb\xf7\x80\x94\x68\xf6\x29\xf3\x89\xb4\x0e\xb9\x32\x1c\xeb\x54\xc9\x7b\x9c\xd0\xed\xde\xce\x51\xb5\x6a\xe1\x85\x99\x18\x67\x7f\x57\xd8\x33\xba\x20\x08\x76\x92\xe0\x68\x7e\x40\x22\xb6\xac\x52\xa9\xb8\x79\xc0\xc5\xfa\xc1\x9e\x4d\x65\x12\xbc\x9e\xa7\x36\xe8\xeb\x88\x9a\xbd\xfd\x7e\xb0\x59\x1e\x9e\x56\xc1\x1b\x65\xc6\xdd\xb0\x73\x2d\x08\xd7\x83\xb0\x43\xdd\x97\xa3\xce\xfa\x95\x30\x0c\xc3\x66\x6f\x3f\x38\xe0\xa9\xb4\x67\xea\x3a\xeb\x51\xe7\x46\x10\x5e\x0b\xc3\xe6\xae\xb0\x2e\xe8\x1b\xa1\x6c\xe6\x23\x7d\x5b\x0a\x95\x3a\x29\x14\xed\x4a\x7a\xf5\x78\xfe\x97\xc9\xd7\x46\xda\x8d\x85\xcc\xda\xb1\x1e\xdf\x6a\xee\x0a\x95\xe6\x22\xe5\xa0\xcf\x62\x1c\xd1\x96\x4a\x33\x69\x47\x0f\x86\x23\x62\xf5\xc1\xe1\xbb\xcd\xbd\x9d\xbd\xad\xc5\xf6\x3a\xed\xb0\xb9\xa9\x95\x63\xe5\x82\xfe\x6c\xc2\x11\x39\x3e\x71\x2f\x4d\x32\x21\xd5\x4d\x8a\x47\xc2\x58\x76\x1b\x87\xfd\xed\xe0\xfa\x42\x57\xb0\x0d\xd9\x04\x5b\x2a\xd6\xc5\x4d\x89\xe8\xfa\x40\xba\x66\x2f\xcb\x8d\xc8\x82\x6d\x6d\xc6\x36\x22\x35\x29\x7f\xed\x46\xf7\x26\xf9\xcf\x8d\xcb\x8a\x2e\x6e\x50\xe7\xc5\x9b\xcd\xf7\x82\x37\x17\x57\xa6\xa7\x39\x91\x8e\xba\xed\xb0\xdd\x6d\x9e\x3f\x54\xe7\x0f\xd5\xf9\x43\xf5\x0f\x0f\xd5\x9f\x01\x00\x00\xff\xff\x4b\x51\xd4\xd3\x8e\x09\x00\x00") func translationsEn_usLc_messagesAcsengineMoBytes() ([]byte, error) { return bindataRead( @@ -133,7 +133,7 @@ func translationsEn_usLc_messagesAcsengineMo() (*asset, error) { return a, nil } -var _translationsEn_usLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x4f\xe3\x46\x10\xfe\x9e\x5f\x31\x4d\x14\xdd\x9d\x8e\x35\xb6\x21\x81\x33\xa5\xea\x95\x42\x45\x7b\xa8\x88\x86\xaa\x1f\x2a\x55\x1b\x7b\x62\xef\x61\xef\xba\xfb\x92\x23\xf7\xeb\xab\x5d\xdb\x09\x2f\x9b\x17\x7a\x7c\x40\x38\xeb\x67\x67\x9e\x99\x79\xe6\x49\x06\x70\xce\xf3\x92\xa9\x02\xb4\xa4\x5c\x95\x54\x33\xc1\x15\xcc\x84\x04\x9a\x2a\xe4\x39\xe3\x08\x35\x4d\xef\x68\x8e\x41\x6f\x00\x67\xa2\x5e\x48\x96\x17\x1a\xde\x9e\xbd\x83\x38\x8c\x8e\x7a\x03\x98\x14\x4c\xc1\x8c\x95\x08\x4c\x41\xc6\x94\x96\x6c\x6a\x34\x66\x60\x78\x86\x12\x74\x81\xa0\x68\x85\x50\xb2\x14\xb9\x42\xa0\xca\x9d\x79\x13\xfc\xca\x28\xcf\x35\xa3\x1c\x3e\x31\xf8\xfe\x73\xf7\xa9\x64\x3f\x16\x42\x57\x94\x95\x41\x2a\xaa\x1f\xf6\x5c\xea\xa0\x37\xe8\x55\x2a\x67\x19\xf4\xfb\xf6\x41\x69\x69\x9f\xfa\xd7\x52\x7c\xc6\x54\x93\xcb\x8c\xfc\x89\x52\x31\xc1\x13\xf8\x9b\xf7\x7b\xfd\x1b\xac\x85\xd4\xe4\xca\xde\x21\x3f\x99\x5c\x91\x89\x68\x5f\x5d\xff\x3e\x21\x67\x12\x5d\xfd\xe4\x67\xaa\x31\x71\x29\x48\x38\x22\xd1\x31\xc4\x71\x12\x86\xef\xc3\x30\x0c\x5b\x30\xb9\xc1\x39\x53\x5e\x6c\x34\x4a\xc2\x03\x12\x1e\xb5\xd8\x4f\x54\x69\x32\x69\x9b\x2b\x64\xb2\x63\x85\xed\x5d\x9e\x1b\x9a\x23\x99\x20\xad\x92\x6e\x54\x8f\x5e\x25\x80\xfc\x9f\xdb\x3f\xdc\xd9\xd5\xe5\xd5\xf9\xaa\xe2\x28\x68\x08\x9c\x09\xae\x91\x6b\x32\x59\xd4\x98\x80\xc6\x7b\xbd\x5f\x97\x94\xf1\x13\x48\x0b\x2a\x15\xea\xd3\xdb\xc9\x05\x39\x7e\x8c\xb5\x7c\x67\x28\xc9\x39\x4f\x45\xc6\x78\x9e\xc0\xf1\x94\xe9\xa6\xf8\xd2\x48\x5a\x92\x0b\x21\x2b\x95\x00\xaf\xdd\x47\x75\x1a\x9f\x40\xf3\x78\xfa\x96\xc3\x77\xa7\x10\xbd\x3b\x71\xf0\xbf\xc8\x2f\xc8\x51\x36\xb5\x5f\x0b\xcc\x98\x86\x38\x08\x83\xd8\xbe\xed\x0d\x12\xa8\xef\xf2\xfd\xa5\x14\xf6\x9b\x7f\x41\x2e\x92\x38\x8e\x7a\x83\x3d\x48\xc9\x4c\xc8\x8a\xea\x6e\xd2\xe7\x52\x0a\x09\x12\xa9\xa5\xd5\xa8\x6e\xa8\xf6\xc0\x1d\x27\x30\x54\x2b\x25\x6c\x47\x76\xe9\x45\x6d\x09\x5a\xe5\xef\x9b\x3a\x97\x34\xc3\xb4\x34\x4a\xa3\xb4\x3c\x0e\x3f\xac\xa7\xf1\xa5\xb0\x51\xff\x35\x28\x17\x36\xc7\xc7\x9b\x2b\xb7\x3a\x12\x95\x30\x32\x45\x95\xc0\xf0\xfd\xfc\x29\xa3\x1d\x2f\x3d\xef\x8d\x5b\x51\x4b\xc3\xd2\xfa\x70\xe8\xa3\x75\x21\x0c\xcf\x20\x5e\x05\x83\x2f\x4c\x17\xa0\x17\xb5\x2d\x1e\x18\x77\x9b\xa7\xb1\xaa\x4b\xaa\x31\x80\x49\x81\x12\x41\x15\xc2\x94\x19\x08\x5e\x2e\x60\x8a\x10\xad\x18\xbf\x56\xbc\x2d\xc5\x44\xd6\x47\xd6\x55\xc3\xc5\xff\x4b\x5f\xd0\x39\xc2\x14\x91\x3f\x2f\xe8\x55\x42\x7a\xd4\x73\x67\xa6\x28\x39\x6a\x54\xd1\x38\x6e\xa5\xe4\x44\x14\x8f\x77\xd2\xda\xd8\x3b\xd4\xdb\x06\x07\x5a\xc0\x6f\xcb\x04\x10\x05\xe3\x20\xb6\x8e\xcb\x85\x06\x65\x6a\x6b\x6d\x98\xc1\x4c\x8a\x0a\xe6\x9d\x09\x3c\xdc\x87\x6f\x0c\xf3\x7c\x84\xc2\xe8\xda\x68\x37\xbf\xd0\xbb\x24\xe8\xf4\x9e\x3a\x5b\xe5\x39\x64\x4c\x62\xaa\x85\x5c\xc0\x9b\xa1\x7a\xf3\x98\xdc\x0e\xd0\x4d\x66\x11\x85\xd1\x78\x3d\x03\xbc\xc7\xd4\xb8\xb8\xdd\x5c\xdd\xc6\xb5\x96\x90\xc0\x70\xfe\x94\xc8\x2e\x37\x5e\x32\xff\x51\xbc\x9e\x5d\xde\xf8\xa3\x4d\x66\xba\x11\xb5\x49\x7d\x3d\xda\x0a\xdf\xd2\x27\xaf\xab\x36\xa1\x6b\x2a\xd5\x03\xaf\xf4\x35\xc6\x0b\x59\x66\xac\x99\xfd\x2b\xc5\x52\xf6\x07\xcb\xf3\x96\xeb\xe3\xd7\xe1\x7a\x2e\x4f\x7c\xdb\xd7\x09\x2f\xe4\x25\x53\x39\xf4\x6a\x66\x46\x59\x89\x99\x5d\x13\xc6\x99\x66\xb4\x64\x5f\x57\x2d\xee\xda\xff\xf4\xcb\xe6\x45\x97\xd6\xf6\x2b\x3a\x18\x6f\x6c\xd8\x91\xb7\x61\x8c\xcf\x69\xc9\xb2\x6e\x5d\xad\x8d\x59\xb1\xa6\x82\x77\x27\x53\x9a\xde\x35\x2b\x6d\xba\x33\xcc\x40\x4c\xed\xcf\xa4\x55\x0d\xdf\x1a\x67\x93\xf0\x0e\x42\xef\x06\x08\x99\x16\xa8\xb4\xeb\x8d\x5b\x75\xeb\x44\x86\x2f\x7d\x68\x45\x6e\x3b\x72\xa3\xee\xc7\x5e\x83\x5a\x2d\x77\x23\x21\xc8\x04\x36\x4e\x88\xf7\x4c\x3d\x68\xcd\x56\xe0\xda\x91\x1e\x1f\x6e\x9c\xe8\xc8\xbb\x8e\x86\x4b\x4c\x45\xce\xd9\x57\xcc\xe0\xe3\xf5\x65\xfb\xa3\xce\xd5\xbd\x22\xb5\x19\xb5\xd9\x06\xc2\x91\x2f\xef\x82\x56\xe5\xd6\x5e\x6c\x04\xfd\x17\x00\x00\xff\xff\xeb\xf0\xcc\x89\x51\x0c\x00\x00") +var _translationsEn_usLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x53\xe3\x36\x10\xfe\x9e\x5f\xb1\x25\xc3\xdc\xdd\x1c\x0e\xb6\x03\x06\x4c\xe9\xf4\x4a\xa1\x43\x7b\x4c\x19\x1a\x6e\xfa\xa1\x33\x1d\x45\xde\xd8\x3a\x6c\xc9\xd5\x4b\x8e\xdc\xaf\xef\x48\xb6\x63\x5e\x1c\x27\x17\xee\x03\x83\x23\xad\x76\x9f\x67\x5f\x1e\x69\x08\x17\x3c\xcd\x99\xca\x40\x4b\xc2\x55\x4e\x34\x13\x5c\xc1\x4c\x48\x20\x54\x21\x4f\x19\x47\x28\x09\xbd\x27\x29\x8e\x06\x43\x38\x17\xe5\x42\xb2\x34\xd3\xf0\xf6\xfc\x1d\x84\x7e\x70\x34\x18\xc2\x24\x63\x0a\x66\x2c\x47\x60\x0a\x12\xa6\xb4\x64\x53\xa3\x31\x01\xc3\x13\x94\xa0\x33\x04\x45\x0a\x84\x9c\x51\xe4\x0a\x81\x28\xb7\xd6\x19\xe0\x77\x46\x78\xaa\x19\xe1\xf0\x91\xc1\x8f\x9f\x9b\x5f\x39\xfb\x39\x13\xba\x20\x2c\x1f\x51\x51\xfc\xb4\xe7\x42\x8f\x06\xc3\x41\xa1\x52\x96\xc0\xce\x8e\xfd\x50\x5a\xda\xaf\x9d\x1b\x29\x3e\x23\xd5\xde\x55\xe2\x7d\x42\xa9\x98\xe0\x71\x1b\xec\x1f\xbe\x33\xd8\xb9\xc5\x52\x48\xed\x5d\xdb\xc3\xde\x2f\x26\x55\xde\x44\xc4\xe0\xb6\x6e\xfe\x9c\x78\xe7\x12\x5d\x22\xbc\x5f\x89\xc6\xd8\xc5\xf2\xfc\xc8\xf3\x03\x08\xc7\x71\x10\xbd\xf7\x7d\xdf\xaf\x8d\xbd\x5b\x9c\x33\xd5\x69\x1b\x44\x71\x70\xe2\xf9\x47\xb5\xed\x47\xa2\xb4\x37\xa9\xb3\x2c\x64\xbc\x21\xd5\xfa\x2c\x4f\x0d\x49\xd1\x9b\x20\x29\xe2\xa6\x66\x4f\xb6\x62\x40\xfe\xef\xdd\x5f\x6e\xed\xfa\xea\xfa\xa2\xa5\x1e\x8c\x2a\x00\xe7\x82\x6b\xe4\xda\x9b\x2c\x4a\x8c\x41\xe3\x83\xde\x2f\x73\xc2\xf8\x29\xd0\x8c\x48\x85\xfa\xec\x6e\x72\xe9\x1d\x3f\xb5\xb5\x78\x67\x28\xbd\x0b\x4e\x45\xc2\x78\x1a\xc3\xf1\x94\xe9\x8a\x7c\x6e\x24\xc9\xbd\x4b\x21\x0b\x15\x03\x2f\xdd\x4f\x75\x16\x9e\x42\xf5\x79\xf6\x96\xc3\x0f\x67\x10\xbc\x3b\x75\xe6\x7f\x7b\xbf\x21\x47\x59\x71\xbf\x11\x98\x30\x0d\xe1\xc8\x1f\x85\x76\x77\x30\x8c\xa1\xbc\x4f\xf7\x97\x65\xda\xaf\xfe\x8d\x52\x11\x87\x61\x34\x18\xee\x01\xf5\x66\x42\x16\x44\x37\x25\xbf\x90\x52\x48\x90\x48\x2c\xac\xaa\xfd\x76\xd5\x1e\xb8\xe5\x18\x76\x55\xdb\x12\xeb\x2d\x9b\xf0\xa2\xb4\x00\xed\x08\xec\xdf\x9b\x29\x4a\x8e\x1a\x95\x29\x53\x49\x12\xdc\xaf\xff\xd3\xdc\x28\x8d\xd2\x22\x8b\x8e\x57\x03\xfb\x92\xd9\x38\xff\x19\x94\x0b\x1b\xf5\xc3\xed\xb5\x9b\x2a\x89\x4a\x18\x49\x51\xc5\xb0\xfb\x7e\xfe\x1c\xe3\x86\x87\x5e\x66\xcb\x4d\xaf\x85\x61\x61\x9d\x1c\x75\xc1\xba\x14\x86\x27\x10\xb6\xce\xe0\x0b\xd3\x19\xe8\x45\x69\xd3\x01\x8c\xbb\xa1\xd4\x58\x94\x39\xd1\x38\x82\x49\x86\x12\x41\x65\xc2\xe4\x09\x08\x9e\x2f\x60\x8a\x10\xb4\x88\xbf\x97\xbf\x35\x64\x82\xd0\x5f\xcd\x86\x8b\xed\xc2\x67\x64\x8e\x30\x45\xe4\x2f\x09\x7d\x17\x97\x1b\xf5\xd3\x3c\x88\xc2\xfa\xdb\x75\x53\xe0\x07\x5d\x4c\x27\x42\x93\x1c\xa8\x30\x5c\x83\x98\x41\x41\x6c\xf7\xc1\xa7\x6b\xdb\x0c\x09\xe0\x03\x45\x4c\xd0\x7e\x94\x48\xad\xe8\x3a\x4b\xbb\xd7\x32\x7b\x85\x8b\xad\x98\x8c\x3b\x4b\x76\x57\x59\x80\x16\xf0\xc7\xd2\x05\x04\xa3\x68\x14\xda\x8b\x83\x0b\x0d\xca\x94\x56\x98\x31\x81\x99\x14\x05\xcc\x1b\x09\x7b\x3c\xcd\xaf\x74\xb3\xe5\xa8\x1f\x8f\x37\xa7\xf4\x28\xde\xeb\x89\x7d\xa3\xb3\x97\xd3\x24\x8c\x2e\x8d\xae\x1a\xec\xa4\x8b\x04\x3a\xe9\xa1\xee\xce\xe3\x29\x24\x4c\x22\xd5\x42\x2e\xe0\xcd\xae\x7a\xf3\x14\xe2\x06\xa6\x7d\x4a\x1e\xf8\xdd\x9d\x51\xb9\xc5\x07\xa4\xc6\xf9\x6d\x46\xcc\x89\x5f\xad\xd7\x31\xec\xce\x9f\x03\xd9\xe4\xc4\x56\x0d\x1c\x45\xdb\x4d\x70\x14\x6c\x75\x2e\x3c\x0c\x57\xa7\x25\xad\x6e\x4d\xcb\xd2\x34\x1d\x52\xb3\xed\x2a\xce\x5a\xf3\xfe\x02\x85\x87\xab\x91\x94\x44\xaa\x47\x37\x68\x57\x45\x3a\x4d\x96\x11\x4b\x66\xff\x72\xb1\xe4\x3d\x5e\xae\xd7\x58\x9f\x6e\xf7\x34\xcb\xb3\xdb\xbc\x2b\x13\x9d\x26\xdb\xd5\xe7\xa0\xf3\x05\x32\x23\x2c\xc7\xc4\xce\x2b\xe3\x4c\x33\x92\xb3\xaf\x6d\xb2\x9b\x42\x3c\x7f\x8c\x7c\xd3\xa1\x95\x99\x0b\xc6\x51\x6f\xea\x8e\x3a\x53\xc7\xf8\x9c\xe4\x2c\x69\x14\xc3\x4a\x8a\x9d\x17\x2a\x78\xb3\x32\x25\xf4\xbe\x52\x15\xd3\xac\x61\x02\x62\x6a\xdf\xd3\x2d\x87\xd7\xfa\xe9\x6b\xc1\xb1\xdf\xf9\x7a\x11\x92\x66\xa8\xb4\xcb\x8d\x53\x1b\x2b\x86\x86\x2f\xa5\xb0\x05\xb7\xde\xb2\x77\x02\x8e\x0e\xba\xc2\xb7\xfa\x52\x35\x13\x24\x02\x2b\x31\xc6\x07\xa6\x1e\xa5\x66\xad\xe1\xca\x92\x1e\x1f\xf4\x56\xf4\xb0\xf3\x71\x60\xb8\x44\x2a\x52\xce\xbe\x62\x02\x1f\x6e\xae\xea\x47\xbf\xe3\xdd\x82\xea\xb7\xea\x17\x84\xa0\xf3\xce\x58\x90\x22\x5f\x9b\x8b\x5e\xa3\xff\x03\x00\x00\xff\xff\x21\x6c\x1f\x71\x7a\x0e\x00\x00") func translationsEn_usLc_messagesAcsenginePoBytes() ([]byte, error) { return bindataRead( @@ -153,7 +153,7 @@ func translationsEn_usLc_messagesAcsenginePo() (*asset, error) { return a, nil } -var _translationsZh_cnLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x53\x5d\x6c\x14\xd5\x1f\x3d\xed\xf6\xe3\xff\x5f\xbf\x35\xf1\x23\x4a\xbc\x9a\x6c\xc0\xc0\x2c\xb3\x9b\x00\x75\x15\x22\x16\x30\x45\x2a\x4d\xb3\x10\x5f\x8c\x99\xee\xdc\xee\x5e\x9c\xbd\x77\x9d\x3b\xb3\x50\x9e\xd0\x54\xd9\x86\x96\x62\xd2\x16\x28\xa5\x58\x84\x94\x54\x74\x41\x02\x59\x5b\x88\x89\x2f\x3e\x1b\x13\x1f\x7d\x71\x67\x76\xfb\x84\x4f\x3e\x9b\xf9\xd8\xee\x5a\xd0\x07\xe7\xe5\x66\x7e\xbf\x73\xce\xfd\x9d\x73\xef\xfd\xed\xe9\x8e\x69\x00\x78\x0a\xc0\x4b\x00\xae\x00\x78\x0e\xc0\x96\x36\xf8\x5f\xa9\x0d\x20\x00\xc6\xda\x80\xcd\x00\x96\xda\x80\x7d\x00\x7e\x6d\x03\xfa\x00\x6c\x68\x07\x76\x02\xc8\xb6\x03\xaf\x00\xb8\xda\x0e\x6c\x02\xf0\x53\x3b\x10\x03\xf0\x47\x3b\xf0\x02\x80\x67\x23\xc1\xaa\x46\x02\x9d\xfd\x11\x60\x17\x80\x62\x24\xd0\xbf\x1d\x01\x5e\xf6\x74\x23\xc1\x1c\x7f\x46\x80\x17\x01\x3c\xd3\x01\x7c\xd0\x06\x6c\xed\x08\xf4\x26\x3a\x03\xdc\xad\x4e\xe0\x75\x00\xbf\x74\x02\xdb\x01\x3c\xd6\x15\xe8\xee\xe9\x02\x36\x00\x28\x74\x01\xaf\x02\x38\xdd\x15\xe0\x6f\x86\xf5\x9f\xc3\xf5\x7e\x17\xb0\xd1\xe3\x75\x07\x3a\xdb\xba\x81\xe7\x01\x88\xee\x60\xce\x52\x77\xc0\xbb\x1c\xd6\x7f\xec\x06\xbc\x48\xfe\x87\x07\xbf\xee\x70\x8d\x00\x78\x24\xcc\xf2\xd1\xb0\xd6\x09\xe0\x49\x00\x51\x6f\x2f\x00\xed\x00\x9e\x00\xf0\x7f\x00\x5d\x00\x3a\x00\x3c\xee\x01\xf7\x9a\xa6\x30\x89\x49\x35\x9d\xf1\x2c\x19\x66\x06\x25\x31\xb9\x85\xf8\xe5\x14\x89\xc9\x10\x70\x34\xe7\x75\x3e\xb6\xa9\x39\xe2\xe1\x76\x0f\xf6\x93\x61\x9f\x27\x85\x6d\x66\xa8\x4c\x91\xd8\xe6\x22\xf6\x09\x9b\xeb\x24\xd9\x2c\x93\xa3\xcc\xca\x11\x6b\xa4\xe0\xa9\x12\xc6\x89\x95\xa3\xc4\xa2\xf9\x82\xa1\x59\x34\x4e\xd2\x39\x6a\x52\x22\x73\xc2\x36\x74\x22\xb8\x31\x42\x86\x28\x49\x84\x32\x5c\xfc\x37\x9d\x9c\x56\xa4\x64\x88\x52\x4e\x12\x38\x54\xc8\x9a\x9a\x4e\x89\x25\xc8\xbb\xf6\x10\x35\x39\xb5\xa8\x24\x89\xf8\xf6\x78\x92\x30\x49\xb8\xb0\x88\xb4\x0b\x05\x61\x5a\x54\x27\xc3\xa6\xc8\x93\x22\x35\x25\x13\xdc\xb7\x4e\x7d\xeb\x19\x93\x6a\x96\x67\x5a\x67\x26\xcd\x58\xc2\x1c\x21\x1b\x63\x72\x63\x0b\x82\x1e\xa3\x19\xdb\x87\x34\x46\xf2\xc3\x09\xc3\x4c\x91\x58\x31\x04\x66\x29\xa7\x66\x20\x66\x37\x26\x0b\x19\x2d\x72\x05\xcd\x94\x2d\x87\xd1\xc2\x5f\x77\x4c\x3e\x67\x58\x63\x06\xd5\x3d\x87\x8c\x33\x8b\x69\x06\x3b\xde\x54\x6d\xec\x18\x9e\x25\xe3\x45\xcd\x60\x7a\xc3\xa4\x97\xa5\x37\x68\x46\xf0\x46\x65\x48\xcb\x7c\x14\x04\x61\x37\x6a\x54\x27\x62\xe8\x08\xcd\x58\x10\x66\x26\x47\xa5\xe5\xeb\xf9\x19\x78\x19\xda\x7c\x2d\x41\x34\xed\x07\x03\x12\x5d\xd0\x20\x65\x7a\x8c\x49\x0b\x36\x37\x69\x46\x64\x39\x3b\x4e\x75\xb2\x7b\xa0\xef\x70\xb8\xab\xa7\x85\x11\x2d\x6f\xfc\x13\x71\xc0\x14\xde\x04\x4a\x9f\xae\x1c\x6e\x1c\x50\x74\x90\x7a\xdb\x2a\xfd\x32\xcb\x74\xe5\x6d\x3b\x2b\x95\xb4\x48\x91\xe8\xc0\xc1\xb4\xd2\xeb\x9f\x99\xe0\xca\x1e\x3f\xda\xa4\x9a\xd8\xa1\xa8\xdb\x94\x44\x0f\x49\x26\x53\xea\x8e\xcd\xaa\xaa\xaa\xd1\x81\x83\xca\x20\x2d\x32\xf9\x50\x5c\x62\x5b\x2a\xd1\xa3\xa8\x3b\x54\x35\x7a\x40\x93\x96\x92\x36\x35\x2e\x8d\x20\xc9\xfd\x4c\xe3\x59\x8b\x69\x9c\x1c\x60\xe4\xcd\x23\x8d\x3f\x83\xbd\x95\x13\x56\x5e\x63\x46\x3c\x23\xf2\xbb\xa2\x07\x34\x9e\xb5\xb5\x2c\x55\xd2\x54\xcb\xa7\x48\x6f\x8e\x71\x2a\x29\xd9\x24\x59\xbe\x60\xb0\x61\x46\xf5\xd7\xd6\x30\x29\x72\x3c\xf7\x61\xef\x7b\xd1\xfe\xbe\xfe\xbd\x4d\x8b\x89\xb8\x1a\xed\x15\xdc\xa2\xdc\x52\xd2\x23\x05\x9a\x22\x16\x3d\x66\x6d\x2d\x18\x1a\xe3\x6f\x90\x4c\x4e\x33\x25\xb5\x76\x1e\x4a\xef\x53\x7a\x9a\x38\x6f\xd0\x61\x6a\x2a\x7b\x79\x46\x78\xb7\x25\x45\x7a\x86\x98\x15\x7d\x5f\x79\xa7\x79\x17\x06\x04\xd5\x99\x45\x92\x71\x35\x9e\x8c\xc2\x9d\x39\x59\x5d\xb9\x43\x62\xf2\xfe\xdd\xf1\xd5\xa9\xf3\xf5\x72\xb9\x5e\x5e\x71\x26\x67\xdc\xb3\x77\x9c\x93\xcb\xab\x53\xe7\xfd\xcb\xe3\x5e\xba\x5a\x2f\x5f\xde\x3d\xd8\x5f\xbf\x3d\xea\x2e\x9f\x59\x6b\xde\xbf\x3b\xeb\x3f\x7e\xf7\xda\x82\x7b\xf1\x07\x67\xf2\x8b\xda\xe9\x1b\xd5\xca\x95\x6a\x65\xa9\x76\x73\xc5\x99\x3f\x15\x93\xa4\x36\x3b\x1a\x90\x7e\x3f\xf1\xa9\xb3\x3c\x55\x2f\x5f\x75\x26\x97\xdc\xb9\xb1\x6a\xe5\x44\xb5\xb2\x14\x32\xdd\xef\x16\xdc\xb9\xb1\x80\xff\x2f\xcc\x26\xad\x36\x56\x72\xe7\xae\xc7\x24\xa9\x56\x26\xdc\xa9\xb2\x3b\xfe\x89\x33\x71\xb2\xb6\xbc\xe8\x94\x6e\xac\x7f\xec\x70\x4a\x17\x9c\x95\xe5\xda\x85\x6f\x9d\x7b\xd3\xde\xfd\x5a\x67\x6d\x6c\xb1\xbe\x30\xbe\x16\x03\x89\x15\x49\x38\x53\x03\xf6\x00\x64\x7d\xbf\xbe\xf8\x95\x3b\x7f\x66\xad\x9f\xf2\x35\x9a\xdd\x20\xcf\x96\x6e\xcb\x08\x70\x4a\x17\x9d\xc5\x53\xce\xf8\x4c\x20\x5a\x9b\xba\xe4\x96\xce\x38\xe7\xaf\xfd\x3d\x62\x89\x6a\xe5\xb4\x73\x61\xde\x3d\x57\x5e\xbd\x38\x1f\x98\x77\xc6\x67\x6a\xb3\xa3\x4e\xf9\xfb\xfa\xcd\x05\x2f\xaa\x7b\xd7\xdd\x89\xcb\xb5\xd9\xd1\xa0\xeb\x9e\xfd\xd2\x9d\x2e\x79\xcc\x98\x24\xab\x9f\x4d\x78\x92\xe7\xca\xd5\xca\x84\x33\x79\x36\x08\xac\x11\xfd\x9a\x2d\xaf\xf9\xcd\x39\x67\xee\x1a\x3c\xf2\xad\xe9\x7a\xf9\x73\xa7\xf4\x75\x6d\x76\xf4\xe1\xcf\xf5\x61\xc4\xbf\x02\x00\x00\xff\xff\x6b\xf3\x55\xa8\xdb\x07\x00\x00") +var _translationsZh_cnLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x54\x5f\x6c\x14\xd5\x17\xfe\xda\xee\xaf\xed\x6f\xfd\x8f\x0f\x6a\xd4\x78\x25\xd9\x80\x29\x53\xa7\x25\x29\xb8\x0a\x11\x2b\x98\x62\x2b\x4d\xb3\xa0\x89\x31\x66\x3a\x73\xbb\x7b\x61\x76\xee\x3a\x73\xa7\xb4\x24\x26\x68\x8a\x6d\x43\x4b\x31\x69\x0b\xfd\x6f\x41\x2c\x41\x64\x8b\x7f\x70\x6d\x21\x68\x4c\x4c\x4c\x7c\x37\xbe\xf8\xa0\x3b\xb3\xdb\x27\xde\x7d\x32\xf3\x67\xbb\x6b\xad\x86\x78\x5f\x66\xf7\x9c\xef\xfb\xee\x39\xdf\x39\xb9\xbf\x6e\x89\x4c\x00\xc0\xc3\x00\x9e\x00\xf0\x25\x80\x27\x01\xb4\x57\xc1\x3f\xdf\x56\x01\x04\xc0\x77\x55\x40\x03\x80\xdf\xaa\x80\x03\x00\xee\xaf\x06\xda\x00\x1c\xae\x06\x9e\x03\xb0\x50\x0d\xec\x01\xf0\x4b\x35\xd0\x0a\xe0\x91\x1a\xe0\x69\x00\x6f\xd6\x00\xdb\x01\xbc\x5b\x03\xc4\x00\x7c\x52\x03\x3c\x06\xe0\xa7\xf0\xeb\xd6\x04\xba\x88\x00\x7b\x01\xec\x88\x04\xf7\x1d\x8b\x00\x4f\x01\x18\x89\x04\x75\x5d\x8d\x00\x8f\x03\xf8\x31\x02\xbc\x55\x05\x38\x91\x40\xaf\xb5\x36\xc0\xb1\xda\xa0\x8e\xe1\x5a\xa0\x05\xc0\xf7\xb5\x80\x0c\xe0\x8f\xda\x40\xbf\xa1\x0e\x90\x00\xbc\x5e\x17\xf4\x77\xaa\x0e\xd8\x0a\xe0\x62\x5d\xc0\xff\x21\x8c\xbb\xe1\x37\x52\x0f\x6c\x03\xb0\xb5\x3e\xd0\x3d\x58\x0f\x3c\x0a\x60\xa0\x3e\xa8\x7b\xae\x3e\xe0\x7d\x1d\xc6\x7f\xae\x07\x3c\xcb\xee\x05\x50\x1d\xb4\x83\x5a\x00\x75\x00\xfe\x1f\x58\x89\x07\x51\x3e\xd1\xf0\xbb\x05\xc0\x03\x00\xea\x01\x3c\xe4\xf9\x0a\xe0\x7f\x61\xae\x26\x9c\x8b\x77\xee\x01\x70\x1f\x36\x39\xfb\x4d\x93\x9b\xc4\xa4\x8a\xc6\x8c\x24\xe9\x61\x3a\x25\x31\x6b\x07\xf1\xc3\x71\x12\xb3\x42\xc0\xf1\x94\x97\x79\xc7\xa6\x66\xbf\x87\xdb\xd7\xd5\x41\x7a\x7c\x9e\xc5\x6d\x53\xa5\x56\x9c\xc4\x1a\x7a\x71\x80\xdb\x86\x46\x9a\xcb\x61\x72\x9c\x89\x14\x11\xfd\x19\x4f\x95\x30\x83\x88\x14\x25\x82\xa6\x33\xba\x22\x68\x23\x49\xa4\xa8\x49\x89\x95\xe2\xb6\xae\x11\x6e\xe8\xfd\xa4\x9b\x92\xa6\x50\xc6\xe0\xff\x4d\x27\xa5\xf4\x52\xd2\x4d\xa9\x41\x9a\x90\xe0\x42\xd1\x89\xca\x6d\x43\x10\xde\x43\xd2\x8a\x25\xa8\x49\x8e\x74\x78\xf5\x6a\x84\xf6\xa9\x94\x6a\xd4\xfb\x91\xa1\xaa\xa0\x5a\x80\xf4\x72\x38\x9c\x49\x9a\x8a\x46\x89\xe0\xe4\x55\xbb\x9b\x9a\x06\x15\xd4\x22\x4d\x8d\x2d\x8d\xcd\x84\x59\xc4\xe0\x82\x58\x76\x26\xc3\x4d\x8f\xd6\x63\xf2\x34\xe9\xa5\xa6\xc5\xb8\xe1\x9b\xb6\x39\xbb\x02\x71\x17\x1a\xd4\x37\x5e\x35\xa9\x22\x3c\xcb\x35\x66\x52\x55\x70\xb3\x9f\x6c\x8b\x59\xdb\x2a\x10\xb4\x8f\xaa\xb6\x0f\x29\x19\xe2\x8f\x26\x1c\x65\x9c\xc4\x7a\x43\x60\x92\x1a\xd4\x0c\xc4\xec\x52\x7d\x21\xa3\x42\x2e\xa3\x98\x56\xc5\x2a\x54\xf0\x37\x2c\x89\xcf\xe9\x51\x98\x4e\x35\xaf\x4f\x66\x30\xc1\x14\x9d\x9d\x28\xab\x96\x6e\x0c\x37\x89\x19\xbd\x8a\xce\xb4\x52\x93\x9e\x0b\x5e\xa1\x2a\x37\x4a\x91\x6e\x45\x3d\x16\x18\x61\x97\x62\x54\x23\xbc\xfb\x28\x55\x05\xb8\xa9\xa6\xa8\x25\x7c\x3d\xdf\x03\xcf\x43\xdb\x58\x77\x10\xe5\xf6\x83\x02\x89\xc6\x69\xe0\x32\xed\x63\x96\x80\x6d\x98\x54\xe5\x49\x83\x9d\xa0\x1a\xd9\xd7\xd9\x76\x24\xbc\xd5\xd3\x42\xbf\x92\xd6\xff\x89\xd8\x69\x72\xaf\x02\xa9\x4d\x93\x8e\x94\x06\x14\xed\xa2\xde\xb5\x52\x87\x95\x64\x9a\xf4\x92\x9d\xb4\xa4\x04\x8f\x93\x68\xe7\xa1\x84\xd4\xea\xcf\x8c\x1b\xd2\xcb\xbe\xb5\xcd\x72\xd3\x2e\x49\x6e\x91\xe4\x26\xd2\xbc\x33\xde\x2c\x37\xc8\xb2\x2c\x47\x3b\x0f\x49\x5d\xb4\x97\x59\x9b\xe2\x9a\x5a\xe2\x3b\x65\x49\xde\x25\xcb\xd1\x76\xc5\x12\x52\xc2\x54\x0c\x4b\x0f\x9c\x3c\xc8\x14\x23\x29\x98\x62\x90\x76\x46\x5e\x38\x5a\xfa\xa7\xb3\x17\x53\x5c\xa4\x15\xa6\x37\xaa\x3c\xbd\x37\xda\xae\x18\x49\x5b\x49\x52\x29\x41\x95\x74\x9c\xb4\xa6\x98\x41\x2d\x4a\xb6\x5b\x2c\x9d\xd1\x59\x0f\xa3\xda\x33\xeb\x98\x38\x39\x91\x7a\xbb\xf5\xb5\x68\x47\x5b\xc7\xfe\x72\x8b\x4d\x8d\x72\xb4\x95\x1b\x82\x1a\x42\x4a\xf4\x67\x68\x9c\x08\xda\x27\x9e\xcd\xe8\x0a\x33\x9e\x27\x6a\x4a\x31\x2d\x2a\xf6\x1c\x4e\x1c\x90\x76\x97\x71\x5e\xa1\x3d\xd4\x94\xf6\x1b\x2a\xf7\xb6\x25\x4e\x76\x77\x33\x11\x7d\x43\x7a\xa5\xbc\x0b\x9d\x9c\x6a\x4c\x90\xe6\x46\xb9\xb1\x39\x0a\x77\x72\x30\xbf\x7a\x83\xc4\xac\x3b\x37\x47\xd6\xc6\xa7\x8a\xd9\x6c\x31\xbb\xea\x8c\x4d\xba\xe7\x6e\x38\x83\x2b\x6b\xe3\x53\xfe\xf2\xb8\x0b\x97\x8a\xd9\x0b\xfb\xba\x3a\x8a\x5f\x0d\xb8\x2b\x67\xd7\x93\x77\x6e\x4e\xfb\x4f\x8f\x7b\x79\xd1\x9d\xbb\xed\x8c\x7d\x58\x38\xb3\x9c\xcf\x7d\x9c\xcf\x5d\x29\x5c\x5f\x75\xe6\x4f\xc7\x2c\x52\x98\x1e\x08\x48\xbf\x9f\x7c\xdf\x59\x19\x2f\x66\x2f\x39\x63\x57\xdc\xd9\xe1\x7c\xee\x64\x3e\x77\x25\x64\xba\x9f\x2f\xba\xb3\xc3\x01\xff\x5f\x98\x65\x5a\x3e\xb7\x5a\x9c\x9a\x76\x4f\x2f\xb8\xb3\x2b\xee\xc9\x55\x77\x62\xd9\x7f\x53\x8a\x37\x4e\x15\x6f\x0f\xba\xb3\x0b\xee\xec\x4c\x61\x7a\xc0\x9d\x58\x2e\xcc\x5c\xf3\x5f\x94\xc2\xf0\x90\x3b\x7b\x35\x66\x91\x7c\x6e\xd4\x1d\xcf\xba\x23\xef\x39\xa3\x83\x85\x95\x25\x67\x68\x79\xe3\x0b\x73\x77\xd8\x12\x08\xce\xd0\x8c\xb3\xba\x52\x98\xb9\xe6\xdc\x9a\xf0\xd6\x77\x83\x73\xc3\x4b\xc5\xc5\x91\x75\x97\x49\xac\x97\x84\x2d\x97\x60\x7f\x83\x6c\xcc\x17\x97\x2e\xba\xf3\x67\xd7\xf3\x71\x5f\xa3\x9c\x0d\xc6\x55\x91\xad\x28\x01\xce\xd0\x9c\xb3\x74\xda\x19\x99\x0c\x44\x0b\xe3\x0b\xee\xd0\x59\x67\xea\xf2\x5f\x27\x68\x21\x9f\x3b\xe3\xcc\xcc\xbb\xe7\xb3\x6b\x73\xf3\x41\x67\xce\xc8\x64\x61\x7a\xc0\xc9\x7e\x53\xbc\xbe\xe8\x4d\xe2\xd6\x55\x77\xf4\x42\x61\x7a\x20\xc8\xba\xe7\x3e\x72\x27\x86\x3c\x66\xcc\x22\x6b\xa7\x46\x3d\xc9\xf3\xd9\x7c\x6e\xd4\x19\x3b\x17\x58\x56\x9a\xec\x7a\x5b\x5e\xf2\xb3\xf3\xce\xec\x65\x78\xe4\x2f\x26\x8a\xd9\x0f\x9c\xa1\x4f\x0b\xd3\x03\x9b\xbf\x06\x9b\x11\xff\x0c\x00\x00\xff\xff\x94\xe2\x35\xc2\xf0\x08\x00\x00") func translationsZh_cnLc_messagesAcsengineMoBytes() ([]byte, error) { return bindataRead( @@ -173,7 +173,7 @@ func translationsZh_cnLc_messagesAcsengineMo() (*asset, error) { return a, nil } -var _translationsZh_cnLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x56\x6d\x4f\x14\xd7\x17\x7f\xcf\xa7\x38\x81\x6c\xd4\xe8\x2c\xb3\x2b\x4f\xce\xff\x21\xb5\x54\x1b\x5b\x69\x09\x59\x9b\xbe\x68\xd2\x0c\x33\x87\xd9\x2b\xb3\xf7\x4e\xef\xbd\x83\xae\xaf\x6c\x43\xeb\x12\x41\x6c\x82\xa0\x88\x28\xb6\x06\x63\x6d\x57\xdb\xd4\x6c\x41\xd3\x0f\xd3\x9d\xd9\xe5\x95\x5f\xa1\xb9\x33\xfb\x08\xb3\x60\xfb\x82\xb0\xdc\x7b\x86\xf3\x3b\xe7\xf7\xb0\x33\x00\xe3\x79\x42\x51\x20\x48\x6e\x52\xe1\x9a\x92\x30\x2a\x60\x86\x71\x30\x2d\x81\xd4\x21\x14\xc1\x33\xad\x59\xd3\xc1\x74\xdf\x00\x8c\x33\xaf\xc8\x89\x93\x97\x70\x7c\xfc\x04\x64\xf5\xcc\x68\xdf\x00\xe4\xf2\x44\xc0\x0c\x71\x11\x88\x00\x9b\x08\xc9\xc9\xb4\x2f\xd1\x06\x9f\xda\xc8\x41\xe6\x11\x84\x59\x40\x70\x89\x85\x54\x20\x98\x22\x3a\x4b\x6c\xf0\x11\x31\xa9\x23\x89\x49\xe1\x22\x81\xff\x5e\x6e\xfe\xe5\x92\xf7\xf2\x4c\x16\x4c\xe2\xa6\x2d\x56\xf8\xff\xa9\xa8\x75\xba\x6f\xa0\xaf\x20\x1c\x62\x43\x7f\xbf\xfa\x20\x24\x57\x9f\xfa\x27\x39\xbb\x8c\x96\xd4\x2e\xd8\xda\x67\xc8\x05\x61\xd4\x80\x2f\x68\x7f\x5f\xff\x14\x7a\x8c\x4b\x6d\x42\x3d\xa3\xbd\xef\x3b\x42\xcb\xb1\xc6\xd5\xe4\xa7\x39\x6d\x9c\x63\x34\xbf\xf6\x81\x29\xd1\x88\x5a\x68\xfa\xb0\x96\x19\x83\x6c\xd6\xd0\x47\x4f\xea\xba\xae\x37\x8a\xb5\x29\x9c\x23\x22\xb1\x36\x33\x6c\x64\xc6\x34\x7d\xb4\x51\x7b\xd1\x14\x52\xcb\x35\x96\xcb\xb8\xf1\x8e\x13\x36\x9e\xa5\x8e\x6f\x3a\xa8\xe5\xd0\x2c\x18\x2d\xaa\x8e\x0b\x52\xf0\x5c\x32\x43\xd0\x3e\xd1\x55\x67\xc0\xb5\xfc\x97\xe3\x9f\x44\x67\x13\x17\x26\xce\xb5\xc7\xcf\xa4\x63\x34\xe3\x8c\x4a\xa4\x52\xcb\x15\x3d\x34\x40\xe2\x55\x39\xe8\xb9\x26\xa1\xff\x01\x2b\x6f\x72\x81\xf2\x7f\x97\x72\xe7\xb5\xb1\xee\x5a\x05\x7e\x06\xb9\x76\x8e\x5a\xcc\x26\xd4\x31\x60\x6c\x9a\xc8\xa8\xe6\x73\xed\x43\xa4\xc8\xe3\xc9\x26\x19\xda\x44\x42\x36\xad\xa7\xb3\xea\xb6\x6f\xc0\x00\x6f\xd6\x19\x6c\x11\x3d\x18\xff\x4a\x3b\xcc\xc8\x66\x33\x7d\x03\xa7\xc0\xd2\x66\x18\x2f\x98\xb2\xc9\xe3\x39\xce\x19\x07\x8e\xa6\xea\x13\x6b\x2a\x25\x4e\x41\x74\x6c\x40\x4a\xb4\x79\x0e\x57\x6f\x54\x77\x5f\x41\x4a\xbc\x7d\xbd\xb8\xb7\x72\xaf\x5e\x2e\xd7\xcb\xbb\xc1\xf2\x6a\xb8\xf6\x2a\xb8\xb1\xb3\xb7\x72\x2f\x2e\x6f\x62\x60\x9e\x42\xa9\xc4\x3d\xe8\x7b\x0e\x37\x6d\xb4\x5c\x5f\x48\xe4\x0a\xcc\xd0\x99\xde\x58\xae\xe4\x15\x88\xaf\x7c\xe4\x45\x05\xe9\xec\xd4\x44\xe4\x0e\x8e\x82\xf9\xdc\x42\x61\x40\xea\xe4\x5c\x07\xac\x87\x4f\xea\xe5\xc7\x67\xa7\x26\xea\xbf\xcf\x87\x3b\xb7\x5b\x68\xde\xbe\x5e\x8f\x0b\x0f\x2e\x25\x72\x9e\x6a\xad\xa0\x9c\x19\x4a\x82\x72\x9e\xf9\xd4\x86\x6c\xbb\x2b\x5c\x21\x32\x0f\xb2\xe8\xa9\xfd\x00\xa1\x91\xa1\x24\x16\x3c\xd7\x94\x98\x86\x5c\x1e\x39\x82\xc8\x33\xdf\xb5\x81\x51\xb7\x08\xd3\x08\x99\x0e\x94\x4f\xb7\xc2\x07\x7f\x06\xcb\xdf\xd7\x6e\xbd\xa8\x56\x7e\xac\x56\x9e\xd5\x5e\xee\x06\x9b\x37\x53\x02\x6a\xeb\xf3\x31\xf4\xbf\xae\x7f\x13\xec\xac\xd4\xcb\x4f\x82\xe5\x67\xe1\xc6\x42\xb5\x72\xbd\x5a\x79\x76\x24\xfe\x8c\x4a\x84\x5e\x03\x50\xf6\xef\x26\xc8\x9b\x73\x08\xd3\x88\xf4\xe0\x0c\xe1\xaf\x5b\xe1\xc6\x42\x3c\xc9\x21\x33\x24\x0c\xd0\xa1\x88\x59\x7f\x1a\x39\x45\x89\x22\x33\x92\x6d\xc8\x23\x12\x46\x76\xe4\x9d\xf4\x33\x92\x48\xda\xa5\xb8\x0e\x24\x83\x8f\x5b\x0d\x20\x93\x1e\x49\x67\x55\x50\x52\x26\x41\xf8\x9e\x4a\x24\xb4\x61\x86\xb3\x02\xcc\x35\xed\xda\x29\xf4\xda\x42\x29\xdc\x78\x9e\x12\x50\xad\x2c\x85\x2b\xe5\x70\xf1\xeb\x60\xe9\x46\x6d\x67\x3b\x28\xbd\xd8\xff\x6f\x93\xd8\x61\xbe\xf4\x7c\x19\x51\xa3\x27\xca\x1c\x23\x99\x5b\x51\xf6\x51\x07\x6c\xc2\xd1\x92\x8c\x17\xe1\x58\x4a\x1c\xeb\x86\x12\x94\xee\x07\xbb\x3b\xb5\xfb\xbf\x04\x6f\xee\x28\xd6\x7a\x78\x2d\xc9\xef\x19\x3d\x33\xd2\xbb\x3b\x5e\x45\xcb\x8f\xda\x37\x15\x10\x99\xac\xe1\x7f\x03\x52\x9d\x0e\x5b\xd8\xae\x6f\x2d\xb6\xec\x0f\xa9\x39\x68\x48\xa1\x89\xe6\x9f\x71\x3c\x9c\xed\x8d\xcb\x89\xc3\x4d\x01\xf3\x9b\x6c\x36\x00\xee\x4b\xa3\x7d\xa0\x7a\x22\xea\xb1\x9b\xc4\x30\x8c\x31\x78\x26\x17\x1d\x61\xd8\xbd\x8c\xfa\xf6\x0f\xe1\xe6\xed\x56\x5f\x23\xda\x46\x42\x57\x8f\xa8\x1f\x97\xb5\x84\x7d\xba\x75\xde\x18\xac\xfb\x5a\xef\x8d\x67\x5f\x38\x77\xef\xa1\x91\xc1\x1d\x78\x44\x12\x9e\x77\xe1\x65\x28\x51\x2f\x33\x26\x71\xd1\x56\x9e\x22\x94\x48\x62\xba\xe4\x5a\x9b\x93\x26\x5f\xfb\xbf\x2b\x82\xd2\x83\x60\xfb\x66\xb0\xb8\x1a\xd3\x52\x5b\x79\x18\x96\x6e\x07\xf7\x9e\x76\xa7\xb3\x38\x64\x5f\x99\xd3\x23\x87\x2e\x6c\x34\x71\x61\x84\xce\x99\x2e\xb1\x9b\xbe\x56\xcb\x50\xb2\xb6\x18\x6d\x9e\x4c\x9b\xd6\x6c\xec\x7d\xbf\x79\x86\x36\xb0\x69\xf5\xfe\xd2\xc6\x5f\xad\xdc\x0a\xee\x6f\x86\x77\xcb\x7b\x0f\x36\xe3\x38\x08\x16\x57\x6b\xeb\xf3\x41\xf9\x8f\xfa\xcb\x2d\x95\x76\x6f\x9e\x87\x4b\x8f\x6b\xeb\xf3\xf1\x6d\xb8\xf6\x28\xbc\x53\x3a\xd2\x93\xa7\xf5\x44\xe9\x33\x6e\xe5\x51\xc8\x68\x8f\x51\x08\xa8\xb4\xf2\x69\x2b\xab\xda\xb8\x52\x02\xf6\xbe\x5d\x52\x8b\xbc\x5b\xae\x56\x96\x82\xe5\xb5\x38\xa0\x8e\x90\xfb\x48\x62\x0e\xb5\x9d\x1f\x0b\x0b\x6c\x86\x71\x4a\xe2\x55\x22\xe4\x81\xe0\x6f\x79\x4d\x75\xfe\xf9\x6e\xb0\xf1\xf4\x10\xfe\xc6\x86\x0e\xa5\x6f\x38\xd1\x7f\x3e\xe5\x68\x31\x87\x92\x6b\x68\xc3\xd9\xc9\x0b\x8d\xb7\xa9\x68\x27\x1d\x70\xd6\x1e\x85\xbf\xdd\xa9\x97\xbf\x0b\x4a\x3f\xd5\xd6\xe7\x0f\x16\x1e\x6e\x7d\x7d\x38\xa9\x75\xd1\x2c\xb8\x47\x2e\x22\x2a\x4a\xdc\xc3\xdf\x01\x00\x00\xff\xff\xdb\xce\xf0\x12\xd7\x0b\x00\x00") +var _translationsZh_cnLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x4f\x1b\xc7\x13\x7f\xcf\xa7\x18\x81\xac\x24\x4a\xce\xd8\x26\x31\xe4\xfe\x0f\x6a\x4a\x93\x2a\x6d\x68\x11\x72\xa2\xbe\xa8\x54\x1d\x77\xe3\xf3\x86\xf3\xee\x75\x77\x8f\x40\x5e\xa5\x15\x29\xa0\x40\x48\x25\x1e\xc2\x43\x20\xa4\x8d\x88\xd2\x34\x26\xad\x1a\x51\x48\x94\x0f\x53\xdf\xd9\xbc\xca\x57\xa8\xf6\xce\x36\x06\x0e\x93\xa2\xbe\x40\x5e\x76\x67\x6f\x7e\xf3\x9b\x99\xdf\x6c\x07\xf4\x16\x08\x45\x81\x20\xb9\x41\x85\x63\x48\xc2\xa8\x80\x3c\xe3\x60\x98\x02\xa9\x4d\x28\x82\x6b\x98\x43\x86\x8d\xc9\xb6\x0e\xe8\x65\xee\x28\x27\x76\x41\xc2\xe9\xde\x33\x90\x49\xa5\xbb\xdb\x3a\x20\x57\x20\x02\xf2\xc4\x41\x20\x02\x2c\x22\x24\x27\x83\x9e\x44\x0b\x3c\x6a\x21\x07\x59\x40\x10\x46\x11\xc1\x21\x26\x52\x81\x60\x88\x70\x2f\xd6\xc1\x67\xc4\xa0\xb6\x24\x06\x85\x6b\x04\xfe\x7b\xb3\xfe\x9f\x43\x3e\x2a\x30\x59\x34\x88\x93\x34\x59\xf1\xff\xe7\x42\xd7\xc9\xb6\x8e\xb6\xa2\xb0\x89\x05\xed\xed\x6a\x21\x24\x57\xab\xf6\x7e\xce\x6e\xa2\x29\xb5\xab\x96\x76\x03\xb9\x20\x8c\xea\xf0\x35\x6d\x6f\x6b\x1f\x40\x97\x71\xa9\xf5\xa9\x3b\xda\xc7\x9e\x2d\xb4\x1c\xab\x1d\xf5\x7f\x99\xd3\x7a\x39\x86\xf1\x6b\x9f\x18\x12\xf5\xd0\x85\x96\xca\x6a\xa9\x34\x64\xba\xf4\x4c\xea\x6c\x2a\x95\x4a\xd5\x8c\xb5\x01\x1c\x26\x22\xd6\x36\x9d\xd5\xbb\x52\x5a\xaa\xbb\x66\x7b\xcd\x10\x52\xcb\xd5\xc8\x65\x5c\xff\xc0\x08\x6b\x77\xa9\xed\x19\x36\x6a\x39\x34\x8a\x7a\x23\x55\xa7\x05\x29\xba\x0e\xc9\x13\xb4\xce\xec\xb3\xd3\xe1\x76\xe1\x9b\xde\x2f\xc2\xbd\xbe\xab\x7d\x97\xf7\xc2\x4f\x27\x23\x34\xbd\x8c\x4a\xa4\x52\xcb\x8d\xba\xa8\x83\xc4\x11\xd9\xe9\x3a\x06\xa1\xff\x01\xb3\x60\x70\x81\xf2\x7f\xd7\x73\x57\xb4\x9e\xfd\xb6\x0a\x7c\x1e\xb9\x76\x99\x9a\xcc\x22\xd4\xd6\xa1\x67\x90\xc8\xd0\xe6\x2b\xed\x53\xa4\xc8\xa3\xc8\xfa\x19\x5a\x44\x42\x26\x99\x4a\x66\xd4\x69\x5b\x87\x0e\xee\x90\xdd\xd9\x48\x74\x67\xf4\x93\xb4\x99\x9e\xc9\x64\xdb\x3a\xce\x81\xa9\xe5\x19\x2f\x1a\xb2\x9e\xc7\xcb\x9c\x33\x0e\x1c\x0d\xe5\x27\xaa\xa9\x84\x38\x07\xe1\xb6\x0e\x09\xb1\x97\xe7\x60\x7e\xbc\xbc\xf3\x1a\x12\xe2\xfd\x9b\xa9\xdd\xd9\xc5\x6a\xa9\x54\x2d\xed\xf8\x33\xf3\xc1\xc2\x6b\x7f\x7c\x7b\x77\x76\x31\x32\xaf\x63\x60\xae\x42\xa9\x8a\xbb\x73\xc8\x1b\x44\x4e\x51\xa2\xf0\x5c\x9b\x1b\x16\x76\xd6\x7e\x4d\xc7\x13\x12\xb9\x82\x97\xed\x39\x1a\xdd\xad\x82\x82\xf5\xad\x87\x7c\x54\x81\xbc\x34\xd0\x17\xf6\x0b\x47\xc1\x3c\x6e\xa2\xd0\x21\x71\x76\xb8\x09\xe8\xda\xd3\x6a\xe9\xc9\xa5\x81\xbe\xea\x1f\x63\xc1\xf6\x83\x06\xbe\xf7\x6f\x96\x22\xc3\xc3\x34\x85\xbd\xa8\x5c\x2b\x28\x17\xbb\xe3\xa0\x5c\x61\x1e\xb5\x20\xb3\xe7\x15\x6e\x11\x59\x00\x39\xea\x2a\xc6\x80\xd0\xb0\xc5\x24\x16\x5d\xc7\x90\x98\x84\x5c\x01\x39\x82\x28\x30\xcf\xb1\x80\x51\x67\x14\x06\x11\xd2\x4d\x28\x9f\xad\x07\x8f\xde\xf9\x33\x3f\x56\xee\x6f\x96\xb7\x7e\x2e\x6f\x3d\xaf\xbc\xda\xf1\x57\xef\x25\x04\x54\x96\xc6\x22\xe8\x7f\xdd\xf9\xde\xdf\x9e\xad\x96\x9e\xfa\x33\xcf\x83\x95\xc9\xf2\xd6\x9d\xf2\xd6\xf3\x63\xf1\xa7\x33\xa9\xa3\x03\xa0\xec\x64\x11\x14\x8c\x61\x84\x41\x44\x7a\x38\x86\xe0\xb7\xf5\x60\x65\x32\x8a\xa4\x45\x0c\x31\x01\xb4\xac\x91\xe1\x74\x36\x53\x5b\x87\x15\x92\x4e\xa5\xe3\xc2\xca\x31\x69\x38\x60\x32\x8f\x4a\x60\x79\x28\x1a\xaa\xa2\xe0\x46\x9f\xaa\x0a\x0b\x70\xc4\x44\xb4\x50\x2d\x5c\x34\x95\x44\x86\x96\xea\x6c\x2f\x8c\xf2\xd6\x4e\x75\x71\x29\xb8\xb7\x16\xac\x6c\x07\x77\x76\x82\xb9\xcd\xf0\x6e\xf5\xf5\xdd\xea\xbb\xf1\x60\x65\x2d\x58\x59\xae\x2c\x8d\x05\x73\x9b\x95\xe5\x97\xd1\xcd\x13\x05\xd0\x15\x9b\x96\xeb\x91\x05\x48\x06\x9f\x37\x3e\x01\xe9\x64\x36\x99\x51\xea\x4e\x99\x04\xe1\xb9\x4a\x46\xd1\x82\x3c\x67\x45\x18\xae\x6b\x4c\x73\x77\x56\x26\x27\x82\x95\x17\x09\x01\xe5\xad\xe9\x60\xb6\x14\x4c\x7d\xe7\x4f\x8f\x57\xb6\x37\xfc\x89\xcd\x83\x9f\x3d\x71\x8f\xf6\x74\x7d\x78\x00\x4d\x20\xff\xf5\x30\xea\x46\x71\x9d\xc0\x3c\xe9\x7a\x32\xaa\x97\x8b\x71\x70\x31\x94\x14\x33\x9c\x3c\xd4\x06\x8b\x70\x34\x25\xe3\xa3\x70\x2a\x21\x4e\xed\x07\xe3\x4f\x2c\xfb\x3b\xdb\x95\xe5\x97\xfe\xdb\x39\x15\xc7\x11\x4a\x17\xa7\xb6\xe9\x54\x7c\xb6\x23\xef\x38\x82\xa6\x17\xba\xaf\x77\x5b\x28\x68\x35\xf5\xd5\x21\xd1\xac\x66\x93\x1b\xd5\xf5\xa9\x86\xf8\x42\x62\x18\x6a\x6d\x57\x47\x73\xc2\x72\xcc\x66\x4f\xd6\x86\xd9\xf4\x89\xee\x65\x2e\x64\x8e\x26\xc4\x8e\x66\x9a\x62\xc4\xab\x97\x53\x8d\x99\x03\x43\xe8\x00\x1b\x47\x52\x11\x9f\x94\xcc\x85\xa3\x31\xb8\x06\x17\x4d\x33\x70\x7f\x16\xaa\x1b\x3f\x05\xab\x0f\x1a\x7e\xf5\x30\x0d\x31\x5e\x5d\xa2\xfe\x1c\xd6\x88\xba\xab\xb1\x5f\x0b\x6c\xff\x71\x8b\x22\x39\x30\x93\xf7\xf3\x50\x1b\xbd\x4d\x78\x44\x1c\x9e\x7f\x96\xa1\xf3\xb1\x2f\x84\xbc\x41\x1c\xb4\x54\x7b\x13\x4a\x24\x31\x1c\x72\x7b\x2f\x3b\xf5\xcc\x1d\x7c\x2c\xf8\x13\x8f\xfc\x8d\x7b\xfe\xd4\x7c\x94\xa0\xca\xec\x5a\x30\xf1\xc0\x5f\x7c\xb6\x7f\x18\x8b\x16\xcc\xa5\xbb\xb2\x2d\xa9\xeb\x8e\xa5\x8e\xd0\x61\xc3\x21\x56\x5d\x5c\x14\x2d\xaa\xb3\x4c\x46\xeb\x3b\x83\x86\x39\x14\x09\x90\x57\xdf\x43\x0b\xd8\xa0\x7a\xc0\x36\x8f\x84\xfb\xfe\xf2\x6a\xf0\xb0\xb4\xfb\x68\x35\x92\x1b\x7f\x6a\xbe\xb2\x34\xe6\x97\xfe\xac\xbe\x5a\x57\xc3\xed\xed\x8b\x60\xfa\x49\x65\x69\x2c\x3a\x0d\x16\x1e\x07\x73\x13\xc7\xca\x42\x57\x2a\xf6\x6d\xc1\xb8\x59\x40\x21\x43\x1e\x43\x1d\x52\x92\xe9\xd1\x86\x60\xee\xe1\x4a\x08\xd8\xbd\x3b\xad\x88\x7c\x58\x2a\x6f\x4d\xfb\x33\x0b\x91\x4a\x1e\x53\xf8\xdd\xe7\xe3\xdc\xee\x89\x4f\x54\x62\x60\x31\x8c\xa4\x1a\x47\x88\x90\x87\xe6\x7c\xa3\xeb\x94\xe7\x5f\x1f\xfa\x2b\xcf\x5a\xe4\xaf\xe7\x7c\xcb\xf4\x5d\x88\x1d\xe6\x1e\xe5\x68\x32\x9b\x92\xdb\x68\xc1\xa5\xfe\xab\xb5\xe7\x74\xc8\x49\x13\x9c\x85\xc7\xc1\xef\x73\xd5\xd2\x0f\xfe\xc4\x2f\x95\xa5\xb1\xc3\x86\xad\x45\x20\x1d\x3b\x17\x46\x8d\xa2\x73\x2c\x11\xa1\x51\x2c\x0f\x7f\x07\x00\x00\xff\xff\x09\x74\xf7\x7e\xd8\x0d\x00\x00") func translationsZh_cnLc_messagesAcsenginePoBytes() ([]byte, error) { return bindataRead( diff --git a/scripts/update-translation.sh b/scripts/update-translation.sh index e79f06f14d..a3d4a49200 100644 --- a/scripts/update-translation.sh +++ b/scripts/update-translation.sh @@ -1,6 +1,6 @@ #!/bin/bash -GO_SOURCE="pkg/acsengine/*.go pkg/api/*.go pkg/operations/*.go" +GO_SOURCE="pkg/acsengine/*.go pkg/api/*.go pkg/operations/*.go pkg/operations/kubernetesupgrade/*.go" LANGUAGE="en_US" DOMAIN="acsengine" generate_po="false" diff --git a/translations/default/LC_MESSAGES/acsengine.mo b/translations/default/LC_MESSAGES/acsengine.mo index bc7277f58c6cd25d62cf07282878e28442c09fb3..8b1c3c7ab08f0b1f257d9694fd885855b7d8eead 100644 GIT binary patch delta 703 zcmci9ziSg=9LMo*nrmvJwy_C_`0MG=QfS4VVjux^2o^=f#dL8xFHb}I<1XA?#6<(r zp`hq+IJ-ze(5XV#I2K$S99$ff_RkRC-(3HOKJdBM_u(#=&)xkfzpV^@Pdo30RUsG1 zS8|a&$Z=o|(cm{+z(2T*lVc+Hu!VK}fH(0MHt}p;WCow$JifqL+`)7BJ#!$340>a6 zL~g+%8eGTA_y)DuXFQMlxJ8KrH0;+3+3#PY7TZHD_7An#-HEK&D{QhKq84*bXt9CF z9D_D{gxais2Q3%{y0p$4daLXATi;p+4SPXMrP$< z+%U6kW1suhwyh35>n9AOEA?EuUAR5d>UAQoZA}uI`~9aj3T$Fy^UOwZHw?Hc-u+nk vl1r~T)uQLeHt2K%n>HP{RJ*d|nrqh^ZY_Q3T*|g?t>M;pcbvbuV`=ptjKz9C delta 454 zcmZY5FH8bq7{~GF1r7xNfUu!X)YstV2F^R&ZHx_UZW66#M=@IrY$h>SZfqtK7KzMg zrdTZ443canNA&yf(tNhxeeQ1W-uHKRUwF@TKJ$s5Fsr0Q`ecn%3>W4WEq1Yt&v=4k zJjJb;NCVrri%+7(w`!lp<^uDG$hc)=YUqZawaO)Mltt~u-wEzbkb zZSaO#WQtnkIO&RXQHzXFi+rON$){X_+T1fNbG}@1Llb#Giyx>(rl>{M7hI7L=^^lM zSUMXz%OcUgxiottLO;oo3|S`p5Xq7>N$O^Nn5;yv<}12MHHYW%M-#=oAQK)0HCwIL XeLre=+wL(4>;BR3!kd`++B@?HDf%un diff --git a/translations/default/LC_MESSAGES/acsengine.po b/translations/default/LC_MESSAGES/acsengine.po index 4033b8c5ea..865906db85 100644 --- a/translations/default/LC_MESSAGES/acsengine.po +++ b/translations/default/LC_MESSAGES/acsengine.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: \n" +"Project-Id-Version: acsengine\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-18 22:00+0000\n" -"PO-Revision-Date: 2017-05-18 15:03-0700\n" +"POT-Creation-Date: 2017-06-01 23:16+0000\n" +"PO-Revision-Date: 2017-06-01 16:19-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: English\n" "Language: en_US\n" @@ -18,48 +18,59 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.0.2\n" -#: pkg/acsengine/engine.go:221 +#: pkg/acsengine/engine.go:226 #, c-format msgid "Error reading file %s, Error: %s" msgstr "Error reading file %s, Error: %s" -#: pkg/operations/upgradecluster.go:49 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:68 #, c-format msgid "Error while querying ARM for resources: %+v" msgstr "Error while querying ARM for resources: %+v" -#: pkg/acsengine/transform.go:94 +#: pkg/acsengine/transform.go:97 #, c-format msgid "Found 2 resources with type %s in the template. There should only be 1" msgstr "Found 2 resources with type %s in the template. There should only be 1" -#: pkg/acsengine/transform.go:117 +#: pkg/acsengine/transform.go:120 #, c-format msgid "Found no resources with type %s in the template. There should have been 1" msgstr "Found no resources with type %s in the template. There should have been 1" -#: pkg/operations/kubernetes162upgrader.go:26 -#: pkg/operations/upgradecluster.go:64 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:101 +#, c-format +msgid "Total count of master VMs: %d exceeded expected count: %d" +msgstr "Total count of master VMs: %d exceeded expected count: %d" + +#: pkg/operations/kubernetesupgrade/v162upgrader.go:30 #, c-format msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" msgstr "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" +#: pkg/operations/kubernetesupgrade/upgradecluster.go:83 +#, c-format +msgid "Upgrade to Kubernetes version: %s is not supported from version: %s" +msgstr "Upgrade to Kubernetes version: %s is not supported from version: %s" + #: pkg/acsengine/output.go:109 #, c-format msgid "error creating directory '%s': %s" msgstr "error creating directory '%s': %s" -#: pkg/acsengine/engine.go:1016 +#: pkg/acsengine/engine.go:1030 #, c-format msgid "error executing template for file %s: %v" msgstr "error executing template for file %s: %v" -#: pkg/operations/kubernetes162upgrader.go:52 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:66 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:161 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:252 #, c-format msgid "error generating upgrade template: %s" msgstr "error generating upgrade template: %s" -#: pkg/acsengine/engine.go:1011 +#: pkg/acsengine/engine.go:1025 #, c-format msgid "error parsing file %s: %v" msgstr "error parsing file %s: %v" @@ -69,7 +80,7 @@ msgstr "error parsing file %s: %v" msgid "error reading file %s: %s" msgstr "error reading file %s: %s" -#: pkg/operations/kubernetes162upgrader.go:46 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:246 #, c-format msgid "failed to initialize template generator: %s" msgstr "failed to initialize template generator: %s" @@ -79,12 +90,12 @@ msgstr "failed to initialize template generator: %s" msgid "invalid version %s for conversion back from unversioned object" msgstr "invalid version %s for conversion back from unversioned object" -#: pkg/acsengine/engine.go:302 +#: pkg/acsengine/engine.go:307 #, c-format msgid "orchestrator '%s' is unsupported" msgstr "orchestrator '%s' is unsupported" -#: pkg/acsengine/engine.go:169 +#: pkg/acsengine/engine.go:174 #, c-format msgid "template file %s does not exist" msgstr "template file %s does not exist" @@ -94,7 +105,7 @@ msgstr "template file %s does not exist" msgid "unrecognized APIVersion '%s'" msgstr "unrecognized APIVersion '%s'" -#: pkg/acsengine/engine.go:1005 +#: pkg/acsengine/engine.go:1019 #, c-format msgid "yaml file %s does not exist" msgstr "yaml file %s does not exist" diff --git a/translations/en_US/LC_MESSAGES/acsengine.mo b/translations/en_US/LC_MESSAGES/acsengine.mo index bc7277f58c6cd25d62cf07282878e28442c09fb3..8b1c3c7ab08f0b1f257d9694fd885855b7d8eead 100644 GIT binary patch delta 703 zcmci9ziSg=9LMo*nrmvJwy_C_`0MG=QfS4VVjux^2o^=f#dL8xFHb}I<1XA?#6<(r zp`hq+IJ-ze(5XV#I2K$S99$ff_RkRC-(3HOKJdBM_u(#=&)xkfzpV^@Pdo30RUsG1 zS8|a&$Z=o|(cm{+z(2T*lVc+Hu!VK}fH(0MHt}p;WCow$JifqL+`)7BJ#!$340>a6 zL~g+%8eGTA_y)DuXFQMlxJ8KrH0;+3+3#PY7TZHD_7An#-HEK&D{QhKq84*bXt9CF z9D_D{gxais2Q3%{y0p$4daLXATi;p+4SPXMrP$< z+%U6kW1suhwyh35>n9AOEA?EuUAR5d>UAQoZA}uI`~9aj3T$Fy^UOwZHw?Hc-u+nk vl1r~T)uQLeHt2K%n>HP{RJ*d|nrqh^ZY_Q3T*|g?t>M;pcbvbuV`=ptjKz9C delta 454 zcmZY5FH8bq7{~GF1r7xNfUu!X)YstV2F^R&ZHx_UZW66#M=@IrY$h>SZfqtK7KzMg zrdTZ443canNA&yf(tNhxeeQ1W-uHKRUwF@TKJ$s5Fsr0Q`ecn%3>W4WEq1Yt&v=4k zJjJb;NCVrri%+7(w`!lp<^uDG$hc)=YUqZawaO)Mltt~u-wEzbkb zZSaO#WQtnkIO&RXQHzXFi+rON$){X_+T1fNbG}@1Llb#Giyx>(rl>{M7hI7L=^^lM zSUMXz%OcUgxiottLO;oo3|S`p5Xq7>N$O^Nn5;yv<}12MHHYW%M-#=oAQK)0HCwIL XeLre=+wL(4>;BR3!kd`++B@?HDf%un diff --git a/translations/en_US/LC_MESSAGES/acsengine.po b/translations/en_US/LC_MESSAGES/acsengine.po index 4033b8c5ea..865906db85 100644 --- a/translations/en_US/LC_MESSAGES/acsengine.po +++ b/translations/en_US/LC_MESSAGES/acsengine.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: \n" +"Project-Id-Version: acsengine\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-05-18 22:00+0000\n" -"PO-Revision-Date: 2017-05-18 15:03-0700\n" +"POT-Creation-Date: 2017-06-01 23:16+0000\n" +"PO-Revision-Date: 2017-06-01 16:19-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: English\n" "Language: en_US\n" @@ -18,48 +18,59 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.0.2\n" -#: pkg/acsengine/engine.go:221 +#: pkg/acsengine/engine.go:226 #, c-format msgid "Error reading file %s, Error: %s" msgstr "Error reading file %s, Error: %s" -#: pkg/operations/upgradecluster.go:49 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:68 #, c-format msgid "Error while querying ARM for resources: %+v" msgstr "Error while querying ARM for resources: %+v" -#: pkg/acsengine/transform.go:94 +#: pkg/acsengine/transform.go:97 #, c-format msgid "Found 2 resources with type %s in the template. There should only be 1" msgstr "Found 2 resources with type %s in the template. There should only be 1" -#: pkg/acsengine/transform.go:117 +#: pkg/acsengine/transform.go:120 #, c-format msgid "Found no resources with type %s in the template. There should have been 1" msgstr "Found no resources with type %s in the template. There should have been 1" -#: pkg/operations/kubernetes162upgrader.go:26 -#: pkg/operations/upgradecluster.go:64 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:101 +#, c-format +msgid "Total count of master VMs: %d exceeded expected count: %d" +msgstr "Total count of master VMs: %d exceeded expected count: %d" + +#: pkg/operations/kubernetesupgrade/v162upgrader.go:30 #, c-format msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" msgstr "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" +#: pkg/operations/kubernetesupgrade/upgradecluster.go:83 +#, c-format +msgid "Upgrade to Kubernetes version: %s is not supported from version: %s" +msgstr "Upgrade to Kubernetes version: %s is not supported from version: %s" + #: pkg/acsengine/output.go:109 #, c-format msgid "error creating directory '%s': %s" msgstr "error creating directory '%s': %s" -#: pkg/acsengine/engine.go:1016 +#: pkg/acsengine/engine.go:1030 #, c-format msgid "error executing template for file %s: %v" msgstr "error executing template for file %s: %v" -#: pkg/operations/kubernetes162upgrader.go:52 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:66 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:161 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:252 #, c-format msgid "error generating upgrade template: %s" msgstr "error generating upgrade template: %s" -#: pkg/acsengine/engine.go:1011 +#: pkg/acsengine/engine.go:1025 #, c-format msgid "error parsing file %s: %v" msgstr "error parsing file %s: %v" @@ -69,7 +80,7 @@ msgstr "error parsing file %s: %v" msgid "error reading file %s: %s" msgstr "error reading file %s: %s" -#: pkg/operations/kubernetes162upgrader.go:46 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:246 #, c-format msgid "failed to initialize template generator: %s" msgstr "failed to initialize template generator: %s" @@ -79,12 +90,12 @@ msgstr "failed to initialize template generator: %s" msgid "invalid version %s for conversion back from unversioned object" msgstr "invalid version %s for conversion back from unversioned object" -#: pkg/acsengine/engine.go:302 +#: pkg/acsengine/engine.go:307 #, c-format msgid "orchestrator '%s' is unsupported" msgstr "orchestrator '%s' is unsupported" -#: pkg/acsengine/engine.go:169 +#: pkg/acsengine/engine.go:174 #, c-format msgid "template file %s does not exist" msgstr "template file %s does not exist" @@ -94,7 +105,7 @@ msgstr "template file %s does not exist" msgid "unrecognized APIVersion '%s'" msgstr "unrecognized APIVersion '%s'" -#: pkg/acsengine/engine.go:1005 +#: pkg/acsengine/engine.go:1019 #, c-format msgid "yaml file %s does not exist" msgstr "yaml file %s does not exist" diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.mo b/translations/zh_CN/LC_MESSAGES/acsengine.mo index 538271354751ef04ee3f613c8381b7c53b0e1aa8..8946af8619d610f5d96edda2cec3c11b79725291 100644 GIT binary patch delta 655 zcmXZZO=uHA7{>8;(->>j*0zF*U(-UUPy?G50u88#sNmPl>OnljWLkpv-7d}-t(uo_Mkt{hYj_OrVj9=*0Dfs%lZZkW zmZZo@IF1Hy;!%8pda!joh+BA_L;OZvu#jran?gOv0_N}&y7&)u{o(B*8N7;m!Fe2% zn#gks-RN`sLDV+cDKfbK6$^ zDX+pTf8#;ouhW&wxLGqYnjdk)d&wiMpV?e~)ZJK1t~l@~ delta 475 zcmZ9|Jxjw-6o>JXzD29GR>2pv7zI&CgGnH^2JBP>T@+V!a41p)D=1w%33bpVxH^a~ zZW0__TpUG&f(Qu z5~_w5$!K4QD_pcN}d z`ZF?z^pXF?t!^>13=s7<2fHgG%qPPnO)`WZB3aT;QmPprCPTrK_8ol0%HdA@RdYSd zDH*Qo+eOo+(p#I>cC}GEsnw6H%KmB9H(c8(T6TAz\n" "Language-Team: Chinese (simplified)\n" "Language: zh_CN\n" @@ -17,48 +17,59 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.2\n" -#: pkg/acsengine/engine.go:221 +#: pkg/acsengine/engine.go:226 #, c-format msgid "Error reading file %s, Error: %s" msgstr "文件 %s,错误读取时出错: %s" -#: pkg/operations/upgradecluster.go:49 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:68 #, c-format msgid "Error while querying ARM for resources: %+v" msgstr "查询ARM资源时出错: %+v" -#: pkg/acsengine/transform.go:94 +#: pkg/acsengine/transform.go:97 #, c-format msgid "Found 2 resources with type %s in the template. There should only be 1" msgstr "模板发现两个类型%s 的资源。应该只有一个" -#: pkg/acsengine/transform.go:117 +#: pkg/acsengine/transform.go:120 #, c-format msgid "Found no resources with type %s in the template. There should have been 1" msgstr "模板没有发现类型%s 的资源。应该有一个" -#: pkg/operations/kubernetes162upgrader.go:26 -#: pkg/operations/upgradecluster.go:64 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:101 +#, c-format +msgid "Total count of master VMs: %d exceeded expected count: %d" +msgstr "主虚拟机总数: %d 超过期望的数目: %d" + +#: pkg/operations/kubernetesupgrade/v162upgrader.go:30 #, c-format msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" msgstr "版本%s 不支持升级到Kubernetes 1.6.2" +#: pkg/operations/kubernetesupgrade/upgradecluster.go:83 +#, c-format +msgid "Upgrade to Kubernetes version: %s is not supported from version: %s" +msgstr "版本%s 不支持升级到Kubernetes版本%s" + #: pkg/acsengine/output.go:109 #, c-format msgid "error creating directory '%s': %s" msgstr "创建目录 %s 时出错: %s" -#: pkg/acsengine/engine.go:1016 +#: pkg/acsengine/engine.go:1030 #, c-format msgid "error executing template for file %s: %v" msgstr "执行文件 %s %v 模板时出错" -#: pkg/operations/kubernetes162upgrader.go:52 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:66 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:161 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:252 #, c-format msgid "error generating upgrade template: %s" msgstr "执行文件 %s 模板时出错" -#: pkg/acsengine/engine.go:1011 +#: pkg/acsengine/engine.go:1025 #, c-format msgid "error parsing file %s: %v" msgstr "解析文件 %s: %v 时出错" @@ -68,7 +79,7 @@ msgstr "解析文件 %s: %v 时出错" msgid "error reading file %s: %s" msgstr "读取文件 %s: %s 时出错" -#: pkg/operations/kubernetes162upgrader.go:46 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:246 #, c-format msgid "failed to initialize template generator: %s" msgstr "初始化模板生成器时出错: %s" @@ -78,12 +89,12 @@ msgstr "初始化模板生成器时出错: %s" msgid "invalid version %s for conversion back from unversioned object" msgstr "与回是非版本化的对象的转换的版本无效 %s" -#: pkg/acsengine/engine.go:302 +#: pkg/acsengine/engine.go:307 #, c-format msgid "orchestrator '%s' is unsupported" msgstr "%s 配器是不受支持" -#: pkg/acsengine/engine.go:169 +#: pkg/acsengine/engine.go:174 #, c-format msgid "template file %s does not exist" msgstr "模板文件 %s 不存在" @@ -93,7 +104,7 @@ msgstr "模板文件 %s 不存在" msgid "unrecognized APIVersion '%s'" msgstr "无法识别的 APIVersion '%s'" -#: pkg/acsengine/engine.go:1005 +#: pkg/acsengine/engine.go:1019 #, c-format msgid "yaml file %s does not exist" msgstr "yaml 文件 %s 不存在" From 67642cbbeb79d3fe855062a39cddb8c3656b6cdb Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Fri, 21 Jul 2017 13:30:58 -0700 Subject: [PATCH 09/13] More fix/refactor after rebase and add README --- cmd/deploy.go | 15 +++++++---- cmd/deploy_test.go | 8 ++++-- pkg/acsengine/filesaver.go | 36 ++++++++++++++++++++++++++ pkg/acsengine/output.go | 52 ++++++++++++-------------------------- pkg/acsengine/ssh.go | 23 ++++++++++++----- pkg/acsengine/ssh_test.go | 5 +++- pkg/api/types_test.go | 5 +++- pkg/i18n/README.md | 25 ++++++++++++++++++ pkg/i18n/i18n.go | 6 +++++ 9 files changed, 123 insertions(+), 52 deletions(-) create mode 100644 pkg/acsengine/filesaver.go create mode 100644 pkg/i18n/README.md diff --git a/cmd/deploy.go b/cmd/deploy.go index c367dc742e..fc53e22d4c 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -125,7 +125,7 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) { // autofillApimodel calls log.Fatal() directly and does not return errors autofillApimodel(dc) - _, _, err = revalidateApimodel(dc.containerService, dc.apiVersion) + _, _, err = revalidateApimodel(apiloader, dc.containerService, dc.apiVersion) if err != nil { log.Fatalf("Failed to validate the apimodel after populating values: %s", err) } @@ -175,7 +175,12 @@ func autofillApimodel(dc *deployCmd) { if dc.containerService.Properties.LinuxProfile.SSH.PublicKeys == nil || len(dc.containerService.Properties.LinuxProfile.SSH.PublicKeys) == 0 || dc.containerService.Properties.LinuxProfile.SSH.PublicKeys[0].KeyData == "" { - _, publicKey, err := acsengine.CreateSaveSSH(dc.containerService.Properties.LinuxProfile.AdminUsername, dc.outputDirectory) + creator := &acsengine.SSHCreator{ + Translator: &i18n.Translator{ + Locale: dc.locale, + }, + } + _, publicKey, err := creator.CreateSaveSSH(dc.containerService.Properties.LinuxProfile.AdminUsername, dc.outputDirectory) if err != nil { log.Fatal("Failed to generate SSH Key") } @@ -230,13 +235,13 @@ func autofillApimodel(dc *deployCmd) { } } -func revalidateApimodel(containerService *api.ContainerService, apiVersion string) (*api.ContainerService, string, error) { +func revalidateApimodel(apiloader *api.Apiloader, containerService *api.ContainerService, apiVersion string) (*api.ContainerService, string, error) { // This isn't terribly elegant, but it's the easiest way to go for now w/o duplicating a bunch of code - rawVersionedAPIModel, err := api.SerializeContainerService(containerService, apiVersion) + rawVersionedAPIModel, err := apiloader.SerializeContainerService(containerService, apiVersion) if err != nil { return nil, "", err } - return api.DeserializeContainerService(rawVersionedAPIModel, true) + return apiloader.DeserializeContainerService(rawVersionedAPIModel, true) } func (dc *deployCmd) run() error { diff --git a/cmd/deploy_test.go b/cmd/deploy_test.go index 7cc3530f4c..eb0151882c 100644 --- a/cmd/deploy_test.go +++ b/cmd/deploy_test.go @@ -47,8 +47,12 @@ func TestAutofillApimodelAllowsPrespecifiedCreds(t *testing.T) { } func testAutodeployCredentialHandling(t *testing.T, useManagedIdentity bool, clientID, clientSecret string) { + apiloader := &api.Apiloader{ + Translator: nil, + } + apimodel := getExampleAPIModel(useManagedIdentity, clientID, clientSecret) - cs, ver, err := api.DeserializeContainerService([]byte(apimodel), false) + cs, ver, err := apiloader.DeserializeContainerService([]byte(apimodel), false) if err != nil { t.Fatalf("unexpected error deserializing the example apimodel: %s", err) } @@ -73,7 +77,7 @@ func testAutodeployCredentialHandling(t *testing.T, useManagedIdentity bool, cli // cleanup, since auto-populations creates dirs and saves the SSH private key that it might create defer os.RemoveAll(deployCmd.outputDirectory) - cs, ver, err = revalidateApimodel(cs, ver) + cs, ver, err = revalidateApimodel(apiloader, cs, ver) if err != nil { log.Fatalf("unexpected error validating apimodel after populating defaults: %s", err) } diff --git a/pkg/acsengine/filesaver.go b/pkg/acsengine/filesaver.go new file mode 100644 index 0000000000..69f9cfb357 --- /dev/null +++ b/pkg/acsengine/filesaver.go @@ -0,0 +1,36 @@ +package acsengine + +import ( + "io/ioutil" + "os" + "path" + + "github.com/Azure/acs-engine/pkg/i18n" + log "github.com/Sirupsen/logrus" +) + +// FileSaver represents the object that save string or byte data to file +type FileSaver struct { + Translator *i18n.Translator +} + +func (f *FileSaver) SaveFileString(dir string, file string, data string) error { + return f.SaveFile(dir, file, []byte(data)) +} + +func (f *FileSaver) SaveFile(dir string, file string, data []byte) error { + if _, err := os.Stat(dir); os.IsNotExist(err) { + if e := os.MkdirAll(dir, 0700); e != nil { + return f.Translator.Errorf("error creating directory '%s': %s", dir, e.Error()) + } + } + + path := path.Join(dir, file) + if err := ioutil.WriteFile(path, []byte(data), 0600); err != nil { + return err + } + + log.Debugf("output: wrote %s", path) + + return nil +} diff --git a/pkg/acsengine/output.go b/pkg/acsengine/output.go index 9bdf6ea02d..bd25be4957 100644 --- a/pkg/acsengine/output.go +++ b/pkg/acsengine/output.go @@ -2,13 +2,10 @@ package acsengine import ( "fmt" - "io/ioutil" - "os" "path" "github.com/Azure/acs-engine/pkg/api" "github.com/Azure/acs-engine/pkg/i18n" - log "github.com/Sirupsen/logrus" ) // ArtifactWriter represents the object that writes artifacts @@ -22,6 +19,10 @@ func (w *ArtifactWriter) WriteArtifacts(containerService *api.ContainerService, artifactsDir = path.Join("_output", artifactsDir) } + f := &FileSaver{ + Translator: w.Translator, + } + // convert back the API object, and write it var b []byte var err error @@ -35,16 +36,16 @@ func (w *ArtifactWriter) WriteArtifacts(containerService *api.ContainerService, return err } - if e := w.saveFile(artifactsDir, "apimodel.json", b); e != nil { + if e := f.SaveFile(artifactsDir, "apimodel.json", b); e != nil { return e } - if e := w.saveFileString(artifactsDir, "azuredeploy.json", template); e != nil { + if e := f.SaveFileString(artifactsDir, "azuredeploy.json", template); e != nil { return e } } - if e := w.saveFileString(artifactsDir, "azuredeploy.parameters.json", parameters); e != nil { + if e := f.SaveFileString(artifactsDir, "azuredeploy.parameters.json", parameters); e != nil { return e } @@ -64,59 +65,38 @@ func (w *ArtifactWriter) WriteArtifacts(containerService *api.ContainerService, if gkcerr != nil { return gkcerr } - if e := w.saveFileString(directory, fmt.Sprintf("kubeconfig.%s.json", location), b); e != nil { + if e := f.SaveFileString(directory, fmt.Sprintf("kubeconfig.%s.json", location), b); e != nil { return e } } } - if e := w.saveFileString(artifactsDir, "ca.key", properties.CertificateProfile.CaPrivateKey); e != nil { + if e := f.SaveFileString(artifactsDir, "ca.key", properties.CertificateProfile.CaPrivateKey); e != nil { return e } - if e := w.saveFileString(artifactsDir, "ca.crt", properties.CertificateProfile.CaCertificate); e != nil { + if e := f.SaveFileString(artifactsDir, "ca.crt", properties.CertificateProfile.CaCertificate); e != nil { return e } - if e := w.saveFileString(artifactsDir, "apiserver.key", properties.CertificateProfile.APIServerPrivateKey); e != nil { + if e := f.SaveFileString(artifactsDir, "apiserver.key", properties.CertificateProfile.APIServerPrivateKey); e != nil { return e } - if e := w.saveFileString(artifactsDir, "apiserver.crt", properties.CertificateProfile.APIServerCertificate); e != nil { + if e := f.SaveFileString(artifactsDir, "apiserver.crt", properties.CertificateProfile.APIServerCertificate); e != nil { return e } - if e := w.saveFileString(artifactsDir, "client.key", properties.CertificateProfile.ClientPrivateKey); e != nil { + if e := f.SaveFileString(artifactsDir, "client.key", properties.CertificateProfile.ClientPrivateKey); e != nil { return e } - if e := w.saveFileString(artifactsDir, "client.crt", properties.CertificateProfile.ClientCertificate); e != nil { + if e := f.SaveFileString(artifactsDir, "client.crt", properties.CertificateProfile.ClientCertificate); e != nil { return e } - if e := w.saveFileString(artifactsDir, "kubectlClient.key", properties.CertificateProfile.KubeConfigPrivateKey); e != nil { + if e := f.SaveFileString(artifactsDir, "kubectlClient.key", properties.CertificateProfile.KubeConfigPrivateKey); e != nil { return e } - if e := w.saveFileString(artifactsDir, "kubectlClient.crt", properties.CertificateProfile.KubeConfigCertificate); e != nil { + if e := f.SaveFileString(artifactsDir, "kubectlClient.crt", properties.CertificateProfile.KubeConfigCertificate); e != nil { return e } } return nil } - -func (w *ArtifactWriter) saveFileString(dir string, file string, data string) error { - return w.saveFile(dir, file, []byte(data)) -} - -func (w *ArtifactWriter) saveFile(dir string, file string, data []byte) error { - if _, err := os.Stat(dir); os.IsNotExist(err) { - if e := os.MkdirAll(dir, 0700); e != nil { - return w.Translator.Errorf("error creating directory '%s': %s", dir, e.Error()) - } - } - - path := path.Join(dir, file) - if err := ioutil.WriteFile(path, []byte(data), 0600); err != nil { - return err - } - - log.Debugf("output: wrote %s", path) - - return nil -} diff --git a/pkg/acsengine/ssh.go b/pkg/acsengine/ssh.go index 72b9786d54..03326177ad 100644 --- a/pkg/acsengine/ssh.go +++ b/pkg/acsengine/ssh.go @@ -6,25 +6,34 @@ import ( "fmt" "io" + "github.com/Azure/acs-engine/pkg/i18n" log "github.com/Sirupsen/logrus" "golang.org/x/crypto/ssh" ) +// SSHCreator represents the object that creates SSH key pair +type SSHCreator struct { + Translator *i18n.Translator +} + const ( - // SshKeySize is the size of SSH key to create + // SSHKeySize is the size of SSH key to create SSHKeySize = 4096 ) // CreateSaveSSH generates and stashes an SSH key pair. -func CreateSaveSSH(username, outputDirectory string) (privateKey *rsa.PrivateKey, publicKeyString string, err error) { - privateKey, publicKeyString, err = CreateSSH(rand.Reader) +func (s *SSHCreator) CreateSaveSSH(username, outputDirectory string) (privateKey *rsa.PrivateKey, publicKeyString string, err error) { + privateKey, publicKeyString, err = s.CreateSSH(rand.Reader) if err != nil { return nil, "", err } privateKeyPem := privateKeyToPem(privateKey) - err = saveFile(outputDirectory, fmt.Sprintf("%s_rsa", username), privateKeyPem) + f := &FileSaver{ + Translator: s.Translator, + } + err = f.SaveFile(outputDirectory, fmt.Sprintf("%s_rsa", username), privateKeyPem) if err != nil { return nil, "", err } @@ -33,17 +42,17 @@ func CreateSaveSSH(username, outputDirectory string) (privateKey *rsa.PrivateKey } // CreateSSH creates an SSH key pair. -func CreateSSH(rg io.Reader) (privateKey *rsa.PrivateKey, publicKeyString string, err error) { +func (s *SSHCreator) CreateSSH(rg io.Reader) (privateKey *rsa.PrivateKey, publicKeyString string, err error) { log.Debugf("ssh: generating %dbit rsa key", SSHKeySize) privateKey, err = rsa.GenerateKey(rg, SSHKeySize) if err != nil { - return nil, "", fmt.Errorf("failed to generate private key for ssh: %q", err) + return nil, "", s.Translator.Errorf("failed to generate private key for ssh: %q", err) } publicKey := privateKey.PublicKey sshPublicKey, err := ssh.NewPublicKey(&publicKey) if err != nil { - return nil, "", fmt.Errorf("failed to create openssh public key string: %q", err) + return nil, "", s.Translator.Errorf("failed to create openssh public key string: %q", err) } authorizedKeyBytes := ssh.MarshalAuthorizedKey(sshPublicKey) authorizedKey := string(authorizedKeyBytes) diff --git a/pkg/acsengine/ssh_test.go b/pkg/acsengine/ssh_test.go index 418b764002..8783ad8412 100644 --- a/pkg/acsengine/ssh_test.go +++ b/pkg/acsengine/ssh_test.go @@ -63,7 +63,10 @@ EPDesL0rH+3s1CKpgkhYdbJ675GFoGoq+X21QaqsdvoXmmuJF9qq9Tq+JaWloUNq -----END RSA PRIVATE KEY----- ` - privateKey, publicKey, err := CreateSSH(rg) + creator := &SSHCreator{ + Translator: nil, + } + privateKey, publicKey, err := creator.CreateSSH(rg) if err != nil { t.Fatalf("failed to generate SSH: %s", err) } diff --git a/pkg/api/types_test.go b/pkg/api/types_test.go index 52f0742372..6c99662194 100644 --- a/pkg/api/types_test.go +++ b/pkg/api/types_test.go @@ -45,7 +45,10 @@ func TestIsDCOS(t *testing.T) { func TestCustomHyperkubeImageField(t *testing.T) { log.Println(exampleAPIModel) - apimodel, _, err := DeserializeContainerService([]byte(exampleAPIModel), false) + apiloader := &Apiloader{ + Translator: nil, + } + apimodel, _, err := apiloader.DeserializeContainerService([]byte(exampleAPIModel), false) if err != nil { t.Fatalf("unexpectedly error deserializing the example apimodel: %s", err) } diff --git a/pkg/i18n/README.md b/pkg/i18n/README.md new file mode 100644 index 0000000000..5ff5dd1592 --- /dev/null +++ b/pkg/i18n/README.md @@ -0,0 +1,25 @@ +# Translation and Internationalization in acs-engine +The translation process in acs-engine borrows some approach from [Kubernetes translation](https://github.com/kubernetes/kubernetes/tree/master/translations). +The strings to be localized are mainly the error message strings under `pkg` directory. Those error message strings are also consumed by other components such as ACS RP. + +The localization in acs-engine depends on github.com/leonelquinteros/gotext, a GNU gettext utility for Go. The package supports concurrency in translating strings in multiple goroutines, e.g., the same acs-engine API called from multiple requests at the same time. + +The translation files containing resource strings are packaged into acs-engine binary using go-bindata. At runtime, the translation files are recreated on disk in the same directory as acs-engine binary, for gotext to load. + +## How to add new string to be localized +When a new error string needs to be localized, it needs to use translation function Errorf in `pkg/i18n/i18n.go`. The locale is passed to acs-engine API from acs-engine command or any other component calls it. If the locale is nil, then it falls back to en-us as in the Go source file. + +Once the Go source file is modified, `scripts/update-translation.sh` needs to be run to extract the resource strings. The script generates PO file according to the locale specified. An example of running the script is: +``` +scripts/update-translation.sh -l en_US -p +``` + +`poedit` is a common tool for translation. After the PO files are translated, MO files can be generated by either `poedit` or tool such as `msgfmt`. Both PO file and MO file need to be placed under `translations//LC_MESSAGES/`. + +## How to add a new language +When the resource strings need to be translated into a new language, the following steps are needed: +``` +1. Use scripts/update-translation.sh with the language to genreate PO file +2. Translate the PO file and generate MO file. +3. Place PO file and MO file under `translations//LC_MESSAGES/` and commit +``` diff --git a/pkg/i18n/i18n.go b/pkg/i18n/i18n.go index 1785ca4e12..2295567ac5 100644 --- a/pkg/i18n/i18n.go +++ b/pkg/i18n/i18n.go @@ -111,11 +111,17 @@ type Translator struct { // T translates a text string, based on GNU's gettext library. func (t *Translator) T(msgid string, vars ...interface{}) string { + if t.Locale == nil { + return fmt.Sprintf(msgid, vars...) + } return t.Locale.GetD(defaultDomain, msgid, vars...) } // NT translates a text string into the appropriate plural form, based on GNU's gettext library. func (t *Translator) NT(msgid, msgidPlural string, n int, vars ...interface{}) string { + if t.Locale == nil { + return fmt.Sprintf(msgidPlural, vars...) + } return t.Locale.GetND(defaultDomain, msgid, msgidPlural, n, vars...) } From 39fbb34cd146d5062d72d857aba4438590a9b736 Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Mon, 24 Jul 2017 17:25:13 -0700 Subject: [PATCH 10/13] Update resource files --- translations/default/LC_MESSAGES/acsengine.mo | Bin 2446 -> 2658 bytes translations/default/LC_MESSAGES/acsengine.po | 58 ++++++++++-------- translations/en_US/LC_MESSAGES/acsengine.mo | Bin 2446 -> 2658 bytes translations/en_US/LC_MESSAGES/acsengine.po | 58 ++++++++++-------- translations/zh_CN/LC_MESSAGES/acsengine.mo | Bin 2288 -> 2491 bytes translations/zh_CN/LC_MESSAGES/acsengine.po | 58 ++++++++++-------- 6 files changed, 102 insertions(+), 72 deletions(-) diff --git a/translations/default/LC_MESSAGES/acsengine.mo b/translations/default/LC_MESSAGES/acsengine.mo index 8b1c3c7ab08f0b1f257d9694fd885855b7d8eead..959e81d01cf760c6408660a87d5418ded0a5893d 100644 GIT binary patch delta 663 zcmb`@-z!659LMqJoY~mOkKsaoJ<{YyG)&8CZdNO9lzYjKV@}pKXPf+p-MDtMTq-_;FDgT5Ja-m!+#rx~UgtSI&v`!Q95z3;lS;~q6W z;1HUoQb`=aX)NL-USJ$QFo98zQa!kf{dkNayumhnb1f-f6))p~#zCA#IcNu`@C-FR zV>kM|ZqYt$XP&?V$}OO*d-A#az142fQIw)vC`GSOihg23m6VFrxJ~y_nx0??Z&8}Q z|LXU0EIsZ7=I}Yg^|Fj-5%xbZA4Z zF4}2pMHjLF{4^%FVnSVdK{N;K12G1aCq5uE@ delta 455 zcmXZYF-yZh7{>AUVxlHP)ute#)^kt<6->oI3%V3UrRdbj!P&YAj#3c8LD3;Ny9t6@ zgs$xlxPYfPhxa&vFPUxmVWSs|E3yGgXz>VV@CvoqBTnKoo>Sr* zE$7x?_WmVmu?}jnU({k-Ls_vitaI+77ITNSSVLrSp4Pmo*05yCApMhe6uI{X3&)1EnWk_-PmIq-IaczGqVmDO4l ZCmpYx9izAwRnt$;F-|2&zs%16, 2017. # msgid "" msgstr "" "Project-Id-Version: acsengine\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-01 23:16+0000\n" -"PO-Revision-Date: 2017-06-01 16:19-0700\n" +"POT-Creation-Date: 2017-07-25 00:04+0000\n" +"PO-Revision-Date: 2017-07-24 17:23-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: English\n" "Language: en_US\n" @@ -16,29 +16,29 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.2\n" +"X-Generator: Poedit 2.0.3\n" -#: pkg/acsengine/engine.go:226 +#: pkg/acsengine/engine.go:239 #, c-format msgid "Error reading file %s, Error: %s" msgstr "Error reading file %s, Error: %s" -#: pkg/operations/kubernetesupgrade/upgradecluster.go:68 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:71 #, c-format msgid "Error while querying ARM for resources: %+v" msgstr "Error while querying ARM for resources: %+v" -#: pkg/acsengine/transform.go:97 +#: pkg/acsengine/transform.go:99 #, c-format msgid "Found 2 resources with type %s in the template. There should only be 1" msgstr "Found 2 resources with type %s in the template. There should only be 1" -#: pkg/acsengine/transform.go:120 +#: pkg/acsengine/transform.go:122 #, c-format msgid "Found no resources with type %s in the template. There should have been 1" msgstr "Found no resources with type %s in the template. There should have been 1" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:101 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:102 #, c-format msgid "Total count of master VMs: %d exceeded expected count: %d" msgstr "Total count of master VMs: %d exceeded expected count: %d" @@ -48,64 +48,74 @@ msgstr "Total count of master VMs: %d exceeded expected count: %d" msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" msgstr "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" -#: pkg/operations/kubernetesupgrade/upgradecluster.go:83 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:86 #, c-format msgid "Upgrade to Kubernetes version: %s is not supported from version: %s" msgstr "Upgrade to Kubernetes version: %s is not supported from version: %s" -#: pkg/acsengine/output.go:109 +#: pkg/acsengine/filesaver.go:24 #, c-format msgid "error creating directory '%s': %s" msgstr "error creating directory '%s': %s" -#: pkg/acsengine/engine.go:1030 +#: pkg/acsengine/engine.go:1194 #, c-format msgid "error executing template for file %s: %v" msgstr "error executing template for file %s: %v" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:66 -#: pkg/operations/kubernetesupgrade/v162upgrader.go:161 -#: pkg/operations/kubernetesupgrade/v162upgrader.go:252 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:67 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:182 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:295 #, c-format msgid "error generating upgrade template: %s" msgstr "error generating upgrade template: %s" -#: pkg/acsengine/engine.go:1025 +#: pkg/acsengine/engine.go:1189 #, c-format msgid "error parsing file %s: %v" msgstr "error parsing file %s: %v" -#: pkg/api/apiloader.go:23 pkg/api/upgradeapiloader.go:20 +#: pkg/api/apiloader.go:24 pkg/api/upgradeapiloader.go:20 #, c-format msgid "error reading file %s: %s" msgstr "error reading file %s: %s" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:246 +#: pkg/acsengine/ssh.go:55 +#, c-format +msgid "failed to create openssh public key string: %q" +msgstr "failed to create openssh public key string: %q" + +#: pkg/acsengine/ssh.go:49 +#, c-format +msgid "failed to generate private key for ssh: %q" +msgstr "failed to generate private key for ssh: %q" + +#: pkg/operations/kubernetesupgrade/v162upgrader.go:289 #, c-format msgid "failed to initialize template generator: %s" msgstr "failed to initialize template generator: %s" -#: pkg/api/apiloader.go:136 pkg/api/upgradeapiloader.go:70 +#: pkg/api/apiloader.go:161 pkg/api/upgradeapiloader.go:70 #, c-format msgid "invalid version %s for conversion back from unversioned object" msgstr "invalid version %s for conversion back from unversioned object" -#: pkg/acsengine/engine.go:307 +#: pkg/acsengine/engine.go:322 #, c-format msgid "orchestrator '%s' is unsupported" msgstr "orchestrator '%s' is unsupported" -#: pkg/acsengine/engine.go:174 +#: pkg/acsengine/engine.go:187 #, c-format msgid "template file %s does not exist" msgstr "template file %s does not exist" -#: pkg/api/apiloader.go:84 pkg/api/upgradeapiloader.go:51 +#: pkg/api/apiloader.go:98 pkg/api/upgradeapiloader.go:51 #, c-format msgid "unrecognized APIVersion '%s'" msgstr "unrecognized APIVersion '%s'" -#: pkg/acsengine/engine.go:1019 +#: pkg/acsengine/engine.go:1183 #, c-format msgid "yaml file %s does not exist" msgstr "yaml file %s does not exist" diff --git a/translations/en_US/LC_MESSAGES/acsengine.mo b/translations/en_US/LC_MESSAGES/acsengine.mo index 8b1c3c7ab08f0b1f257d9694fd885855b7d8eead..959e81d01cf760c6408660a87d5418ded0a5893d 100644 GIT binary patch delta 663 zcmb`@-z!659LMqJoY~mOkKsaoJ<{YyG)&8CZdNO9lzYjKV@}pKXPf+p-MDtMTq-_;FDgT5Ja-m!+#rx~UgtSI&v`!Q95z3;lS;~q6W z;1HUoQb`=aX)NL-USJ$QFo98zQa!kf{dkNayumhnb1f-f6))p~#zCA#IcNu`@C-FR zV>kM|ZqYt$XP&?V$}OO*d-A#az142fQIw)vC`GSOihg23m6VFrxJ~y_nx0??Z&8}Q z|LXU0EIsZ7=I}Yg^|Fj-5%xbZA4Z zF4}2pMHjLF{4^%FVnSVdK{N;K12G1aCq5uE@ delta 455 zcmXZYF-yZh7{>AUVxlHP)ute#)^kt<6->oI3%V3UrRdbj!P&YAj#3c8LD3;Ny9t6@ zgs$xlxPYfPhxa&vFPUxmVWSs|E3yGgXz>VV@CvoqBTnKoo>Sr* zE$7x?_WmVmu?}jnU({k-Ls_vitaI+77ITNSSVLrSp4Pmo*05yCApMhe6uI{X3&)1EnWk_-PmIq-IaczGqVmDO4l ZCmpYx9izAwRnt$;F-|2&zs%16, 2017. # msgid "" msgstr "" "Project-Id-Version: acsengine\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-01 23:16+0000\n" -"PO-Revision-Date: 2017-06-01 16:19-0700\n" +"POT-Creation-Date: 2017-07-25 00:04+0000\n" +"PO-Revision-Date: 2017-07-24 17:23-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: English\n" "Language: en_US\n" @@ -16,29 +16,29 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.2\n" +"X-Generator: Poedit 2.0.3\n" -#: pkg/acsengine/engine.go:226 +#: pkg/acsengine/engine.go:239 #, c-format msgid "Error reading file %s, Error: %s" msgstr "Error reading file %s, Error: %s" -#: pkg/operations/kubernetesupgrade/upgradecluster.go:68 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:71 #, c-format msgid "Error while querying ARM for resources: %+v" msgstr "Error while querying ARM for resources: %+v" -#: pkg/acsengine/transform.go:97 +#: pkg/acsengine/transform.go:99 #, c-format msgid "Found 2 resources with type %s in the template. There should only be 1" msgstr "Found 2 resources with type %s in the template. There should only be 1" -#: pkg/acsengine/transform.go:120 +#: pkg/acsengine/transform.go:122 #, c-format msgid "Found no resources with type %s in the template. There should have been 1" msgstr "Found no resources with type %s in the template. There should have been 1" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:101 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:102 #, c-format msgid "Total count of master VMs: %d exceeded expected count: %d" msgstr "Total count of master VMs: %d exceeded expected count: %d" @@ -48,64 +48,74 @@ msgstr "Total count of master VMs: %d exceeded expected count: %d" msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" msgstr "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" -#: pkg/operations/kubernetesupgrade/upgradecluster.go:83 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:86 #, c-format msgid "Upgrade to Kubernetes version: %s is not supported from version: %s" msgstr "Upgrade to Kubernetes version: %s is not supported from version: %s" -#: pkg/acsengine/output.go:109 +#: pkg/acsengine/filesaver.go:24 #, c-format msgid "error creating directory '%s': %s" msgstr "error creating directory '%s': %s" -#: pkg/acsengine/engine.go:1030 +#: pkg/acsengine/engine.go:1194 #, c-format msgid "error executing template for file %s: %v" msgstr "error executing template for file %s: %v" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:66 -#: pkg/operations/kubernetesupgrade/v162upgrader.go:161 -#: pkg/operations/kubernetesupgrade/v162upgrader.go:252 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:67 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:182 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:295 #, c-format msgid "error generating upgrade template: %s" msgstr "error generating upgrade template: %s" -#: pkg/acsengine/engine.go:1025 +#: pkg/acsengine/engine.go:1189 #, c-format msgid "error parsing file %s: %v" msgstr "error parsing file %s: %v" -#: pkg/api/apiloader.go:23 pkg/api/upgradeapiloader.go:20 +#: pkg/api/apiloader.go:24 pkg/api/upgradeapiloader.go:20 #, c-format msgid "error reading file %s: %s" msgstr "error reading file %s: %s" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:246 +#: pkg/acsengine/ssh.go:55 +#, c-format +msgid "failed to create openssh public key string: %q" +msgstr "failed to create openssh public key string: %q" + +#: pkg/acsengine/ssh.go:49 +#, c-format +msgid "failed to generate private key for ssh: %q" +msgstr "failed to generate private key for ssh: %q" + +#: pkg/operations/kubernetesupgrade/v162upgrader.go:289 #, c-format msgid "failed to initialize template generator: %s" msgstr "failed to initialize template generator: %s" -#: pkg/api/apiloader.go:136 pkg/api/upgradeapiloader.go:70 +#: pkg/api/apiloader.go:161 pkg/api/upgradeapiloader.go:70 #, c-format msgid "invalid version %s for conversion back from unversioned object" msgstr "invalid version %s for conversion back from unversioned object" -#: pkg/acsengine/engine.go:307 +#: pkg/acsengine/engine.go:322 #, c-format msgid "orchestrator '%s' is unsupported" msgstr "orchestrator '%s' is unsupported" -#: pkg/acsengine/engine.go:174 +#: pkg/acsengine/engine.go:187 #, c-format msgid "template file %s does not exist" msgstr "template file %s does not exist" -#: pkg/api/apiloader.go:84 pkg/api/upgradeapiloader.go:51 +#: pkg/api/apiloader.go:98 pkg/api/upgradeapiloader.go:51 #, c-format msgid "unrecognized APIVersion '%s'" msgstr "unrecognized APIVersion '%s'" -#: pkg/acsengine/engine.go:1019 +#: pkg/acsengine/engine.go:1183 #, c-format msgid "yaml file %s does not exist" msgstr "yaml file %s does not exist" diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.mo b/translations/zh_CN/LC_MESSAGES/acsengine.mo index 8946af8619d610f5d96edda2cec3c11b79725291..a6f0c5281924cca35f9f453af1c85fa98cc86c67 100644 GIT binary patch delta 687 zcmX}o-%Aux6u|K_yE>UgrM6I%bQQLuWnyN_78i`d2zpxSIWegUGw9b_ zv_=F*C}=N6(7r@J=p}sdLHq|o$#D@1di6=ax1GFj=5z1m+q0lF#fJv7PEoN z*id*1GpHZBi|26;6$W?=&Bl76$MFd3UhJp10gSW$X4dn5p)M@COXM8(pp7Ne_s^mw zWszkjy5lYE#P+881s727Uk|;Hy3i@qoh{-C{Db;^s??vRm!UoH|P5LK*9IMwK{V+?<)@L)aq6=VI)&l zvP;=^+Hn##qq#3*U3JI3qLr>Cd)SZksgQT1Zm}SkR>)C|$)t`~#|ggLJ8b;1(REgWx1x zQgG;E5d=XT6&FF#Zi2Iu-$(M`m(S&LdAZBb{VjCfi`IouE?FQ0vPfEn3w4Jcj``@6C%rafNOYyD|n4__>|a@F#~NZmdF;Yqld@1gy*OmyTN&U z#6vdmjoPr8P1dzhH*$s{-lLCysQoLGB30Z+J>V&pr6qF3KtJ@5J{YH3j>szWWz@#I zIE!7>6I`Occbm??I?<6S=}MW_OIo?qB2E!jOM&ExO|IJ>&ct2IGr6$p*Sw(K c2>hsTmy+9B*r@x_i~VJSc$ob#(U0@|4;F$lp#T5? diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.po b/translations/zh_CN/LC_MESSAGES/acsengine.po index 282c163073..9555544928 100644 --- a/translations/zh_CN/LC_MESSAGES/acsengine.po +++ b/translations/zh_CN/LC_MESSAGES/acsengine.po @@ -1,43 +1,43 @@ -# Chinese translations for acsengine package. +# Chinese translations for acs-engine package. # Copyright (C) 2017 -# This file is distributed under the same license as the acsengine package. +# This file is distributed under the same license as the acs-engine package. # Jiangtian Li , 2017. # msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-01 23:20+0000\n" -"PO-Revision-Date: 2017-06-01 16:30-0700\n" +"POT-Creation-Date: 2017-07-25 00:11+0000\n" +"PO-Revision-Date: 2017-07-24 17:21-0700\n" "Last-Translator: Jiangtian Li \n" "Language-Team: Chinese (simplified)\n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.2\n" +"X-Generator: Poedit 2.0.3\n" -#: pkg/acsengine/engine.go:226 +#: pkg/acsengine/engine.go:239 #, c-format msgid "Error reading file %s, Error: %s" msgstr "文件 %s,错误读取时出错: %s" -#: pkg/operations/kubernetesupgrade/upgradecluster.go:68 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:71 #, c-format msgid "Error while querying ARM for resources: %+v" msgstr "查询ARM资源时出错: %+v" -#: pkg/acsengine/transform.go:97 +#: pkg/acsengine/transform.go:99 #, c-format msgid "Found 2 resources with type %s in the template. There should only be 1" msgstr "模板发现两个类型%s 的资源。应该只有一个" -#: pkg/acsengine/transform.go:120 +#: pkg/acsengine/transform.go:122 #, c-format msgid "Found no resources with type %s in the template. There should have been 1" msgstr "模板没有发现类型%s 的资源。应该有一个" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:101 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:102 #, c-format msgid "Total count of master VMs: %d exceeded expected count: %d" msgstr "主虚拟机总数: %d 超过期望的数目: %d" @@ -47,64 +47,74 @@ msgstr "主虚拟机总数: %d 超过期望的数目: %d" msgid "Upgrade to Kubernetes 1.6.2 is not supported from version: %s" msgstr "版本%s 不支持升级到Kubernetes 1.6.2" -#: pkg/operations/kubernetesupgrade/upgradecluster.go:83 +#: pkg/operations/kubernetesupgrade/upgradecluster.go:86 #, c-format msgid "Upgrade to Kubernetes version: %s is not supported from version: %s" msgstr "版本%s 不支持升级到Kubernetes版本%s" -#: pkg/acsengine/output.go:109 +#: pkg/acsengine/filesaver.go:24 #, c-format msgid "error creating directory '%s': %s" msgstr "创建目录 %s 时出错: %s" -#: pkg/acsengine/engine.go:1030 +#: pkg/acsengine/engine.go:1194 #, c-format msgid "error executing template for file %s: %v" msgstr "执行文件 %s %v 模板时出错" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:66 -#: pkg/operations/kubernetesupgrade/v162upgrader.go:161 -#: pkg/operations/kubernetesupgrade/v162upgrader.go:252 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:67 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:182 +#: pkg/operations/kubernetesupgrade/v162upgrader.go:295 #, c-format msgid "error generating upgrade template: %s" msgstr "执行文件 %s 模板时出错" -#: pkg/acsengine/engine.go:1025 +#: pkg/acsengine/engine.go:1189 #, c-format msgid "error parsing file %s: %v" msgstr "解析文件 %s: %v 时出错" -#: pkg/api/apiloader.go:23 pkg/api/upgradeapiloader.go:20 +#: pkg/api/apiloader.go:24 pkg/api/upgradeapiloader.go:20 #, c-format msgid "error reading file %s: %s" msgstr "读取文件 %s: %s 时出错" -#: pkg/operations/kubernetesupgrade/v162upgrader.go:246 +#: pkg/acsengine/ssh.go:55 +#, c-format +msgid "failed to create openssh public key string: %q" +msgstr "生成 openssh 公开密钥字符串出错: %q" + +#: pkg/acsengine/ssh.go:49 +#, c-format +msgid "failed to generate private key for ssh: %q" +msgstr "生成 ssh 私有密钥出错: %q" + +#: pkg/operations/kubernetesupgrade/v162upgrader.go:289 #, c-format msgid "failed to initialize template generator: %s" msgstr "初始化模板生成器时出错: %s" -#: pkg/api/apiloader.go:136 pkg/api/upgradeapiloader.go:70 +#: pkg/api/apiloader.go:161 pkg/api/upgradeapiloader.go:70 #, c-format msgid "invalid version %s for conversion back from unversioned object" msgstr "与回是非版本化的对象的转换的版本无效 %s" -#: pkg/acsengine/engine.go:307 +#: pkg/acsengine/engine.go:322 #, c-format msgid "orchestrator '%s' is unsupported" msgstr "%s 配器是不受支持" -#: pkg/acsengine/engine.go:174 +#: pkg/acsengine/engine.go:187 #, c-format msgid "template file %s does not exist" msgstr "模板文件 %s 不存在" -#: pkg/api/apiloader.go:84 pkg/api/upgradeapiloader.go:51 +#: pkg/api/apiloader.go:98 pkg/api/upgradeapiloader.go:51 #, c-format msgid "unrecognized APIVersion '%s'" msgstr "无法识别的 APIVersion '%s'" -#: pkg/acsengine/engine.go:1019 +#: pkg/acsengine/engine.go:1183 #, c-format msgid "yaml file %s does not exist" msgstr "yaml 文件 %s 不存在" From 781613390e2db8cc5e5b3e93ea48570c671a66ff Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Mon, 24 Jul 2017 17:32:19 -0700 Subject: [PATCH 11/13] Add LCG files converted from PO files. --- .../default/LC_MESSAGES/acsengine.po.lcg | 126 ++++++++++++ .../LC_MESSAGES/en-US/lcl/acsengine.po.lcl | 187 ++++++++++++++++++ .../en-US/metadata/acsengine.po.xml | 135 +++++++++++++ .../en_US/LC_MESSAGES/acsengine.po.lcg | 126 ++++++++++++ .../LC_MESSAGES/en-US/lcl/acsengine.po.lcl | 187 ++++++++++++++++++ .../en-US/metadata/acsengine.po.xml | 135 +++++++++++++ .../zh_CN/LC_MESSAGES/acsengine.po.lcg | 126 ++++++++++++ .../LC_MESSAGES/en-US/lcl/acsengine.po.lcl | 187 ++++++++++++++++++ .../en-US/metadata/acsengine.po.xml | 135 +++++++++++++ 9 files changed, 1344 insertions(+) create mode 100644 translations/default/LC_MESSAGES/acsengine.po.lcg create mode 100644 translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl create mode 100644 translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml create mode 100644 translations/en_US/LC_MESSAGES/acsengine.po.lcg create mode 100644 translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl create mode 100644 translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml create mode 100644 translations/zh_CN/LC_MESSAGES/acsengine.po.lcg create mode 100644 translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl create mode 100644 translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml diff --git a/translations/default/LC_MESSAGES/acsengine.po.lcg b/translations/default/LC_MESSAGES/acsengine.po.lcg new file mode 100644 index 0000000000..5f3303db62 --- /dev/null +++ b/translations/default/LC_MESSAGES/acsengine.po.lcg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl b/translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl new file mode 100644 index 0000000000..f391730398 --- /dev/null +++ b/translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml b/translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml new file mode 100644 index 0000000000..885406fa0c --- /dev/null +++ b/translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/en_US/LC_MESSAGES/acsengine.po.lcg b/translations/en_US/LC_MESSAGES/acsengine.po.lcg new file mode 100644 index 0000000000..5f3303db62 --- /dev/null +++ b/translations/en_US/LC_MESSAGES/acsengine.po.lcg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl b/translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl new file mode 100644 index 0000000000..f391730398 --- /dev/null +++ b/translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml b/translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml new file mode 100644 index 0000000000..976dabd856 --- /dev/null +++ b/translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/zh_CN/LC_MESSAGES/acsengine.po.lcg b/translations/zh_CN/LC_MESSAGES/acsengine.po.lcg new file mode 100644 index 0000000000..5f3303db62 --- /dev/null +++ b/translations/zh_CN/LC_MESSAGES/acsengine.po.lcg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl b/translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl new file mode 100644 index 0000000000..f391730398 --- /dev/null +++ b/translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml b/translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml new file mode 100644 index 0000000000..4ddd84864b --- /dev/null +++ b/translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 91ad8cd9fadf6bd4e75ec2308df03392dea96bae Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Tue, 25 Jul 2017 10:15:14 -0700 Subject: [PATCH 12/13] Update translation bindata --- pkg/i18n/translations.go | 261 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 243 insertions(+), 18 deletions(-) diff --git a/pkg/i18n/translations.go b/pkg/i18n/translations.go index efbfb8b804..81af563297 100644 --- a/pkg/i18n/translations.go +++ b/pkg/i18n/translations.go @@ -2,10 +2,19 @@ // sources: // ../../translations/default/LC_MESSAGES/acsengine.mo // ../../translations/default/LC_MESSAGES/acsengine.po +// ../../translations/default/LC_MESSAGES/acsengine.po.lcg +// ../../translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl +// ../../translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml // ../../translations/en_US/LC_MESSAGES/acsengine.mo // ../../translations/en_US/LC_MESSAGES/acsengine.po +// ../../translations/en_US/LC_MESSAGES/acsengine.po.lcg +// ../../translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl +// ../../translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml // ../../translations/zh_CN/LC_MESSAGES/acsengine.mo // ../../translations/zh_CN/LC_MESSAGES/acsengine.po +// ../../translations/zh_CN/LC_MESSAGES/acsengine.po.lcg +// ../../translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl +// ../../translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml // DO NOT EDIT! package i18n @@ -73,7 +82,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _translationsDefaultLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcf\x6b\x24\xc5\x1b\xc6\x9f\x64\xe6\x9b\x4c\xe6\xeb\xcf\x55\x10\x51\xf1\xdd\xc3\xb8\x2b\xbb\x3d\xf6\x8c\x98\xdd\xed\x35\x8b\x6b\x4c\x34\x9a\x90\x21\x4e\x82\xe0\x41\x6a\xba\xdf\xe9\xa9\x6c\x4f\xd5\x58\x55\x3d\x9b\x59\xf0\x22\xde\x14\x3c\x79\xf6\x26\x08\x1e\x05\xaf\xeb\x51\xf0\xea\xc1\x8b\x07\x41\xff\x0c\x91\xee\xea\xd9\x09\x12\x51\x3c\xa7\x2e\xd5\x5d\xf5\xbc\x4f\x7d\xea\xa9\xa2\x7e\xb9\x50\xff\x02\x00\x9e\x00\xf0\x2c\x80\x6f\x01\x3c\x07\x60\x77\x09\x65\xbb\xbf\x04\x10\x80\xef\x97\x80\x2b\x00\x7e\x5d\x02\xb6\x01\x3c\xb2\x0c\xec\x00\x38\x5c\x06\x6e\x00\xf8\x72\x19\xd8\x00\xf0\xf3\x32\xb0\x09\xe0\xa9\x1a\x70\x11\xc0\xfb\x35\xe0\x32\x80\x8f\x6a\x40\x0b\xc0\x57\x35\xe0\x69\x00\x3f\x56\xfd\xef\x35\xef\x8b\x3a\x70\x0b\xc0\xd5\xba\x5f\xef\x4e\x1d\x78\x1e\xc0\x67\x75\xcf\xf5\x4d\x1d\x78\x06\xc0\x0f\x75\xe0\x93\x25\xe0\xb7\x4a\x77\xbc\xe2\xeb\x3f\x5d\xf1\x5c\xdf\xad\x78\xae\x3f\x56\x3c\xd7\x5b\xab\x9e\xeb\xe3\x55\xcf\x75\x7f\xd5\x73\xd5\x1b\x9e\xeb\x85\x86\xe7\xda\x6f\x78\x9e\xbc\xea\x3f\x6f\x78\xdf\xaf\x1b\x9e\xeb\xa7\x86\x5f\xef\xc9\x35\xcf\xf5\xca\x9a\xe7\x3a\x5c\xf3\x5c\x66\x0d\x28\x22\x7b\x08\xc0\xb2\xdf\x0e\x56\x00\xac\x02\x58\xf3\x51\xe2\x31\x2c\x5a\xb3\xea\x2f\x00\x78\x14\x40\x03\xc0\xe3\x45\xae\x00\xfe\x57\xcd\xd5\xaa\x73\x29\xda\xff\x01\x3c\x8c\x33\xda\x96\x31\xda\x90\x61\x91\x48\x95\xd2\x50\x66\x4c\x2d\x7b\x95\xca\xe1\x88\x5a\xb6\x12\xdc\x1d\x15\x33\x1f\xe6\x6c\x66\x85\xee\xf6\xc1\x1e\x0d\xcb\x3a\xab\x73\x13\xb3\x8d\xa8\x75\x65\x8a\x6d\x9d\xab\x84\xba\x8b\x61\xba\x2b\xdd\x88\xdc\x6c\x52\xb8\x92\x54\xe4\x46\x4c\x8e\xc7\x93\x4c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x9e\x25\xa4\x55\x36\xa3\x01\x53\xa7\xb2\x51\xfa\xbf\xf9\x8c\xc4\x94\x69\xc0\xac\xa8\x83\xbe\x76\x22\xa3\x58\xe7\xca\x91\x1e\xd2\x58\x58\xc7\x86\x8e\xf6\x0a\xde\x84\xf8\x24\x66\x4e\xb8\xf8\x98\x70\xec\x38\xf1\xca\x62\x0e\x87\x93\xd4\x88\x84\xc9\x69\x7a\x27\x1f\xb0\x51\xec\xd8\x52\xa7\xbd\xde\xee\x92\xb4\xa4\xb4\x23\x9b\x4f\x26\xda\x14\x65\x43\xa3\xc7\x34\x65\x63\xa5\x56\x65\x68\x67\x57\x9f\x52\xfc\x0b\x0f\x2e\x83\x8f\x0d\x0b\x57\x44\x9e\x48\xc3\xb1\xd3\x66\x46\x97\x5a\xf6\xd2\x29\x05\x9f\x70\x9c\x97\x92\x79\x20\xe5\xd1\x54\x47\x19\x51\x6b\x5a\x09\x53\x56\x6c\xbc\x59\x3e\xe7\xab\x2a\x4e\xd9\x4d\x84\xb1\xa7\xae\xc2\xa9\xfa\xbf\x5c\x92\xb2\x66\x28\x64\xc6\x49\xb1\x4f\xa9\xa4\x93\x22\x93\xf7\x16\xae\xf3\x15\xab\x9b\x24\xd5\x54\x64\x32\x99\x6f\xb2\x48\xa1\x00\x8d\xb5\x9a\x8f\x0c\x44\x7c\xc7\x07\x91\xcf\xc7\x38\x21\x3d\x38\xe6\xd8\x41\x9b\x78\xc4\xd6\x95\x7e\x65\x06\x45\x86\xb9\x7a\x90\x20\x16\xdb\xf7\x80\x94\x68\xf6\x29\xf3\x89\xb4\x0e\xb9\x32\x1c\xeb\x54\xc9\x7b\x9c\xd0\xed\xde\xce\x51\xb5\x6a\xe1\x85\x99\x18\x67\x7f\x57\xd8\x33\xba\x20\x08\x76\x92\xe0\x68\x7e\x40\x22\xb6\xac\x52\xa9\xb8\x79\xc0\xc5\xfa\xc1\x9e\x4d\x65\x12\xbc\x9e\xa7\x36\xe8\xeb\x88\x9a\xbd\xfd\x7e\xb0\x59\x1e\x9e\x56\xc1\x1b\x65\xc6\xdd\xb0\x73\x2d\x08\xd7\x83\xb0\x43\xdd\x97\xa3\xce\xfa\x95\x30\x0c\xc3\x66\x6f\x3f\x38\xe0\xa9\xb4\x67\xea\x3a\xeb\x51\xe7\x46\x10\x5e\x0b\xc3\xe6\xae\xb0\x2e\xe8\x1b\xa1\x6c\xe6\x23\x7d\x5b\x0a\x95\x3a\x29\x14\xed\x4a\x7a\xf5\x78\xfe\x97\xc9\xd7\x46\xda\x8d\x85\xcc\xda\xb1\x1e\xdf\x6a\xee\x0a\x95\xe6\x22\xe5\xa0\xcf\x62\x1c\xd1\x96\x4a\x33\x69\x47\x0f\x86\x23\x62\xf5\xc1\xe1\xbb\xcd\xbd\x9d\xbd\xad\xc5\xf6\x3a\xed\xb0\xb9\xa9\x95\x63\xe5\x82\xfe\x6c\xc2\x11\x39\x3e\x71\x2f\x4d\x32\x21\xd5\x4d\x8a\x47\xc2\x58\x76\x1b\x87\xfd\xed\xe0\xfa\x42\x57\xb0\x0d\xd9\x04\x5b\x2a\xd6\xc5\x4d\x89\xe8\xfa\x40\xba\x66\x2f\xcb\x8d\xc8\x82\x6d\x6d\xc6\x36\x22\x35\x29\x7f\xed\x46\xf7\x26\xf9\xcf\x8d\xcb\x8a\x2e\x6e\x50\xe7\xc5\x9b\xcd\xf7\x82\x37\x17\x57\xa6\xa7\x39\x91\x8e\xba\xed\xb0\xdd\x6d\x9e\x3f\x54\xe7\x0f\xd5\xf9\x43\xf5\x0f\x0f\xd5\x9f\x01\x00\x00\xff\xff\x4b\x51\xd4\xd3\x8e\x09\x00\x00") +var _translationsDefaultLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\x4f\x8b\x5c\x45\x17\xc6\x9f\x99\xe9\xc9\x4c\xdf\xf7\xf5\x5f\xd4\x85\xa8\x78\x82\xb4\x49\x8c\xb7\xbd\xdd\x89\x4e\xec\x38\xc1\x38\xce\xc8\x68\x86\x0c\x63\x27\xb8\x0b\xd5\xf7\x9e\xe9\xae\xe4\x76\xd5\x4d\x55\xdd\xce\x74\x44\x57\x7e\x05\x97\x82\x2b\xc1\x4f\x21\x88\x08\x7e\x09\x51\x50\x70\x21\xb8\x16\x5c\x48\xdd\xba\x9d\x6e\x42\x04\x71\xe3\x66\x6a\x53\xdd\x75\x9f\x73\xce\xaf\x9e\x73\xa8\x1f\x4e\x36\x3e\x03\x80\xa7\x01\x3c\x07\xe0\x5b\x00\xcf\x03\xc8\x97\x50\xad\x1f\x97\x00\x02\xf0\xd3\x12\x70\x0e\xc0\xf2\x32\xb0\x03\xa0\xbd\x0c\xec\x02\x28\x97\x81\x37\x00\x7c\xbd\x0c\x6c\x02\xf8\x63\x19\xd8\x02\xb0\xb1\x02\x9c\x02\xf0\xd1\x0a\x70\x06\xc0\xe7\x2b\x40\x0b\xc0\x77\x2b\xc0\x33\x00\x7e\xab\xf7\x13\x0d\xa0\x0d\x80\x1a\xc0\xcb\x00\xae\x35\x42\x9d\x7b\x0d\xe0\x32\x80\x2f\x1b\xa1\xfe\x2f\x0d\xe0\x05\xaf\x5f\x0d\x9c\x2f\xad\x02\xcf\x02\xd8\x5a\x05\x3e\x5d\x02\x6e\xae\x06\xdd\xcf\x27\x42\xfc\xea\x5a\xe0\xec\xac\x05\xce\xa3\xb5\xc0\xf9\xcd\x5a\xe0\xfc\x73\x2d\x70\xf6\xd6\x03\xe7\x27\xeb\x81\xf3\x8b\xf5\xc0\xf9\xfd\x7a\xe0\xfb\xbd\xde\x9b\xcd\xc0\xf9\x62\x33\x70\x1e\x34\x43\x9d\x8f\x9b\x81\xf3\xab\x66\xa8\xff\x6b\x33\x70\x36\xa3\xc0\x79\x36\x0a\x9c\x3b\x11\xe0\x2d\xfd\xbf\xf7\x10\x40\xc3\xdf\x05\xc0\x9a\xd7\x02\x78\x0c\xc0\x49\xcc\x57\x54\xef\x4f\x01\x78\x02\xc0\x3a\x80\x27\x01\x3c\xea\xef\x06\xe0\x71\x00\x2b\x75\xdf\xfc\xfa\x1f\x80\x47\xf0\x90\xb5\x6d\x8c\x36\x64\x58\x64\x52\x0d\xe9\x50\xe6\x4c\x2d\xfb\x0a\x55\xc7\x3d\x6a\xd9\x5a\x70\x77\xe4\xbf\xdc\x29\xd9\x4c\xbd\xee\xca\xc1\x1e\x1d\x56\x71\x56\x97\x26\x65\xdb\xa3\xd6\xb9\x09\x76\x74\xa9\x32\xea\xce\x8f\xe9\xae\x74\x23\x72\xd3\xc2\x67\x25\xa9\xc8\x8d\x98\x1c\x8f\x8b\x5c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x99\x67\xa4\x55\x3e\xa5\x01\x53\xa7\x4e\xa3\xf4\xbf\xcb\x33\x12\x13\xa6\x01\xb3\xa2\x0e\xfa\xda\x89\x9c\x52\x5d\x2a\x47\xfa\x90\xc6\xc2\x3a\x36\x74\x63\xcf\xf3\x66\xc4\x47\x29\x73\xc6\xfe\x47\xc1\xa9\xe3\x2c\x28\xfd\x37\x5c\x2f\x86\x46\x64\x4c\x4e\xd3\xfb\xe5\x80\x8d\x62\xc7\x96\x3a\xed\xd7\xdb\x5d\x92\x96\x94\x76\x64\xcb\xa2\xd0\xc6\x87\x1d\x1a\x3d\xa6\x09\x1b\x2b\xb5\xaa\x4c\x7b\x78\xf4\x82\xe2\x1f\xe4\xe0\xca\xf8\xd4\xb0\x70\xde\xf2\x4c\x1a\x4e\x9d\x36\x53\x3a\xdd\xb2\xa7\x17\x14\x7c\xc4\x69\x59\x49\x66\x86\x54\xad\xa9\x5b\xd9\xa3\xd6\xa4\x16\x0e\x59\xb1\x09\xc9\xca\x19\x5f\x1d\xb1\x90\xae\x10\xc6\x2e\x8c\xc2\x42\xfc\x03\x43\x52\xc5\x1c\x0a\x99\x73\xe6\xef\x59\x81\x32\xe9\x82\x95\xb5\x23\x2a\xca\x41\x2e\x53\xba\xcd\x53\xb2\xce\x48\x35\xec\x51\xeb\xce\x82\xbc\x86\x61\x2a\x8c\x9c\xf8\xdd\x2b\x3d\xb7\xb5\xa3\x07\xa4\x52\x49\x27\x45\x2e\xef\xcd\x79\x67\xe1\xf5\x8c\x4a\x35\x11\xb9\xcc\x66\xf6\x79\x7f\x7d\xaa\x54\xab\xd9\xc9\x40\xa4\xb7\x83\xc5\xe5\xec\x8c\x33\xd2\x83\x5b\x9c\x3a\x68\x93\x8e\xd8\xba\x2a\x5f\xe5\xae\xef\x4e\xa9\xee\xf7\x06\x73\x63\xc3\xd5\x29\xd3\x1c\xfa\xc7\x47\xd2\x3a\x94\xca\x70\xaa\x87\x4a\xde\xe3\x8c\xae\xec\xef\xde\xa8\xab\xfa\x5c\x98\x8a\x71\xfe\x77\x81\xfb\x46\x7b\x82\x78\x37\x8b\x6f\xcc\x5a\x2f\x52\xcb\x6a\x28\x15\x47\x07\xec\xeb\xc7\x7b\x76\x28\xb3\xf8\xed\x72\x68\xe3\xbe\xee\x51\xb4\x7f\xad\x1f\x6f\x55\x63\xa1\x55\xfc\x4e\xd5\xbd\x6e\xd2\xd9\x88\x93\x8d\xb8\xfb\x1a\x25\x49\x2f\xb9\x70\x2e\x49\x92\x24\xda\xbf\x16\x1f\xf0\x44\xda\x87\xe8\x2e\x50\x67\xa3\xd7\x3d\x1f\x27\x1b\x49\x12\x5d\x15\xd6\xc5\x7d\x23\x94\xcd\x83\xa5\xef\x49\xa1\x86\x4e\x0a\x45\x57\x25\xbd\x79\x6b\xf6\x2f\x97\x6f\x8d\xb4\x1b\x0b\x99\xb7\x53\x3d\xbe\x1c\x5d\x15\x6a\x58\x8a\x21\xc7\x7d\x16\xe3\x1e\x6d\xab\x61\x2e\xed\xe8\xfe\x71\x8f\x58\xdd\xbc\xfe\x41\xb4\xb7\xbb\xb7\x3d\xbf\x5e\xa7\x9d\x44\x5b\x5a\x39\x56\x2e\xee\x4f\x0b\xee\x91\xe3\x23\xf7\x6a\x91\x0b\xa9\x2e\x51\x3a\x12\xc6\xb2\xdb\xbc\xde\xdf\x89\x2f\xce\x75\x9e\xed\x90\x4d\xbc\xad\x52\x9d\x55\xc3\x74\x71\x20\x5d\xb4\x9f\x97\x46\xe4\xf1\x8e\x36\x63\xdb\x23\x55\x54\x7f\xed\x66\xf7\x12\x85\x9f\x9b\x67\x14\x9d\xda\xa4\xce\xd9\x4b\xd1\x87\xf1\xbb\xf3\x91\xd9\xd7\x9c\x49\x47\xdd\x76\xd2\x3e\x1f\x1d\x3f\x81\xc7\x4f\xe0\xf1\x13\xf8\x9f\x3d\x81\x7f\x05\x00\x00\xff\xff\x15\x09\xe4\xac\x62\x0a\x00\x00") func translationsDefaultLc_messagesAcsengineMoBytes() ([]byte, error) { return bindataRead( @@ -93,7 +102,7 @@ func translationsDefaultLc_messagesAcsengineMo() (*asset, error) { return a, nil } -var _translationsDefaultLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x53\xe3\x36\x10\xfe\x9e\x5f\xb1\x25\xc3\xdc\xdd\x1c\x0e\xb6\x03\x06\x4c\xe9\xf4\x4a\xa1\x43\x7b\x4c\x19\x1a\x6e\xfa\xa1\x33\x1d\x45\xde\xd8\x3a\x6c\xc9\xd5\x4b\x8e\xdc\xaf\xef\x48\xb6\x63\x5e\x1c\x27\x17\xee\x03\x83\x23\xad\x76\x9f\x67\x5f\x1e\x69\x08\x17\x3c\xcd\x99\xca\x40\x4b\xc2\x55\x4e\x34\x13\x5c\xc1\x4c\x48\x20\x54\x21\x4f\x19\x47\x28\x09\xbd\x27\x29\x8e\x06\x43\x38\x17\xe5\x42\xb2\x34\xd3\xf0\xf6\xfc\x1d\x84\x7e\x70\x34\x18\xc2\x24\x63\x0a\x66\x2c\x47\x60\x0a\x12\xa6\xb4\x64\x53\xa3\x31\x01\xc3\x13\x94\xa0\x33\x04\x45\x0a\x84\x9c\x51\xe4\x0a\x81\x28\xb7\xd6\x19\xe0\x77\x46\x78\xaa\x19\xe1\xf0\x91\xc1\x8f\x9f\x9b\x5f\x39\xfb\x39\x13\xba\x20\x2c\x1f\x51\x51\xfc\xb4\xe7\x42\x8f\x06\xc3\x41\xa1\x52\x96\xc0\xce\x8e\xfd\x50\x5a\xda\xaf\x9d\x1b\x29\x3e\x23\xd5\xde\x55\xe2\x7d\x42\xa9\x98\xe0\x71\x1b\xec\x1f\xbe\x33\xd8\xb9\xc5\x52\x48\xed\x5d\xdb\xc3\xde\x2f\x26\x55\xde\x44\xc4\xe0\xb6\x6e\xfe\x9c\x78\xe7\x12\x5d\x22\xbc\x5f\x89\xc6\xd8\xc5\xf2\xfc\xc8\xf3\x03\x08\xc7\x71\x10\xbd\xf7\x7d\xdf\xaf\x8d\xbd\x5b\x9c\x33\xd5\x69\x1b\x44\x71\x70\xe2\xf9\x47\xb5\xed\x47\xa2\xb4\x37\xa9\xb3\x2c\x64\xbc\x21\xd5\xfa\x2c\x4f\x0d\x49\xd1\x9b\x20\x29\xe2\xa6\x66\x4f\xb6\x62\x40\xfe\xef\xdd\x5f\x6e\xed\xfa\xea\xfa\xa2\xa5\x1e\x8c\x2a\x00\xe7\x82\x6b\xe4\xda\x9b\x2c\x4a\x8c\x41\xe3\x83\xde\x2f\x73\xc2\xf8\x29\xd0\x8c\x48\x85\xfa\xec\x6e\x72\xe9\x1d\x3f\xb5\xb5\x78\x67\x28\xbd\x0b\x4e\x45\xc2\x78\x1a\xc3\xf1\x94\xe9\x8a\x7c\x6e\x24\xc9\xbd\x4b\x21\x0b\x15\x03\x2f\xdd\x4f\x75\x16\x9e\x42\xf5\x79\xf6\x96\xc3\x0f\x67\x10\xbc\x3b\x75\xe6\x7f\x7b\xbf\x21\x47\x59\x71\xbf\x11\x98\x30\x0d\xe1\xc8\x1f\x85\x76\x77\x30\x8c\xa1\xbc\x4f\xf7\x97\x65\xda\xaf\xfe\x8d\x52\x11\x87\x61\x34\x18\xee\x01\xf5\x66\x42\x16\x44\x37\x25\xbf\x90\x52\x48\x90\x48\x2c\xac\xaa\xfd\x76\xd5\x1e\xb8\xe5\x18\x76\x55\xdb\x12\xeb\x2d\x9b\xf0\xa2\xb4\x00\xed\x08\xec\xdf\x9b\x29\x4a\x8e\x1a\x95\x29\x53\x49\x12\xdc\xaf\xff\xd3\xdc\x28\x8d\xd2\x22\x8b\x8e\x57\x03\xfb\x92\xd9\x38\xff\x19\x94\x0b\x1b\xf5\xc3\xed\xb5\x9b\x2a\x89\x4a\x18\x49\x51\xc5\xb0\xfb\x7e\xfe\x1c\xe3\x86\x87\x5e\x66\xcb\x4d\xaf\x85\x61\x61\x9d\x1c\x75\xc1\xba\x14\x86\x27\x10\xb6\xce\xe0\x0b\xd3\x19\xe8\x45\x69\xd3\x01\x8c\xbb\xa1\xd4\x58\x94\x39\xd1\x38\x82\x49\x86\x12\x41\x65\xc2\xe4\x09\x08\x9e\x2f\x60\x8a\x10\xb4\x88\xbf\x97\xbf\x35\x64\x82\xd0\x5f\xcd\x86\x8b\xed\xc2\x67\x64\x8e\x30\x45\xe4\x2f\x09\x7d\x17\x97\x1b\xf5\xd3\x3c\x88\xc2\xfa\xdb\x75\x53\xe0\x07\x5d\x4c\x27\x42\x93\x1c\xa8\x30\x5c\x83\x98\x41\x41\x6c\xf7\xc1\xa7\x6b\xdb\x0c\x09\xe0\x03\x45\x4c\xd0\x7e\x94\x48\xad\xe8\x3a\x4b\xbb\xd7\x32\x7b\x85\x8b\xad\x98\x8c\x3b\x4b\x76\x57\x59\x80\x16\xf0\xc7\xd2\x05\x04\xa3\x68\x14\xda\x8b\x83\x0b\x0d\xca\x94\x56\x98\x31\x81\x99\x14\x05\xcc\x1b\x09\x7b\x3c\xcd\xaf\x74\xb3\xe5\xa8\x1f\x8f\x37\xa7\xf4\x28\xde\xeb\x89\x7d\xa3\xb3\x97\xd3\x24\x8c\x2e\x8d\xae\x1a\xec\xa4\x8b\x04\x3a\xe9\xa1\xee\xce\xe3\x29\x24\x4c\x22\xd5\x42\x2e\xe0\xcd\xae\x7a\xf3\x14\xe2\x06\xa6\x7d\x4a\x1e\xf8\xdd\x9d\x51\xb9\xc5\x07\xa4\xc6\xf9\x6d\x46\xcc\x89\x5f\xad\xd7\x31\xec\xce\x9f\x03\xd9\xe4\xc4\x56\x0d\x1c\x45\xdb\x4d\x70\x14\x6c\x75\x2e\x3c\x0c\x57\xa7\x25\xad\x6e\x4d\xcb\xd2\x34\x1d\x52\xb3\xed\x2a\xce\x5a\xf3\xfe\x02\x85\x87\xab\x91\x94\x44\xaa\x47\x37\x68\x57\x45\x3a\x4d\x96\x11\x4b\x66\xff\x72\xb1\xe4\x3d\x5e\xae\xd7\x58\x9f\x6e\xf7\x34\xcb\xb3\xdb\xbc\x2b\x13\x9d\x26\xdb\xd5\xe7\xa0\xf3\x05\x32\x23\x2c\xc7\xc4\xce\x2b\xe3\x4c\x33\x92\xb3\xaf\x6d\xb2\x9b\x42\x3c\x7f\x8c\x7c\xd3\xa1\x95\x99\x0b\xc6\x51\x6f\xea\x8e\x3a\x53\xc7\xf8\x9c\xe4\x2c\x69\x14\xc3\x4a\x8a\x9d\x17\x2a\x78\xb3\x32\x25\xf4\xbe\x52\x15\xd3\xac\x61\x02\x62\x6a\xdf\xd3\x2d\x87\xd7\xfa\xe9\x6b\xc1\xb1\xdf\xf9\x7a\x11\x92\x66\xa8\xb4\xcb\x8d\x53\x1b\x2b\x86\x86\x2f\xa5\xb0\x05\xb7\xde\xb2\x77\x02\x8e\x0e\xba\xc2\xb7\xfa\x52\x35\x13\x24\x02\x2b\x31\xc6\x07\xa6\x1e\xa5\x66\xad\xe1\xca\x92\x1e\x1f\xf4\x56\xf4\xb0\xf3\x71\x60\xb8\x44\x2a\x52\xce\xbe\x62\x02\x1f\x6e\xae\xea\x47\xbf\xe3\xdd\x82\xea\xb7\xea\x17\x84\xa0\xf3\xce\x58\x90\x22\x5f\x9b\x8b\x5e\xa3\xff\x03\x00\x00\xff\xff\x21\x6c\x1f\x71\x7a\x0e\x00\x00") +var _translationsDefaultLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x6f\xdb\x36\x10\xfe\xee\x5f\x71\x8b\x61\xb4\x45\x23\x47\x92\x93\xd8\x51\x96\x61\x5d\x96\x0c\xd9\x1a\x2c\xc8\x9c\x62\x1f\x06\x0c\x34\x75\x96\x58\x4b\xa4\x4a\x52\x6e\xdc\x5f\x5f\x90\x92\xac\xbc\xd0\x2f\x71\xfa\x21\x10\x43\x1e\xef\x9e\xe7\x5e\xe9\x2e\x5c\xf0\x24\x63\x2a\x05\x2d\x09\x57\x19\xd1\x4c\x70\x05\x53\x21\x81\x50\xe5\x21\x4f\x18\x47\x28\x08\x9d\x91\x04\xfb\x9d\x2e\x9c\x8b\x62\x21\x59\x92\x6a\x78\x7b\xfe\x0e\x42\x3f\x18\x76\xba\x30\x4e\x99\x82\x29\xcb\x10\x98\x82\x98\x29\x2d\xd9\xa4\xd4\x18\x43\xc9\x63\x94\xa0\x53\x04\x45\x72\x84\x8c\x51\xe4\x0a\x81\x28\xbb\xe7\xb6\xf0\x27\x23\x3c\xd1\x8c\x70\xf8\xc8\xe0\xe7\xcf\xcd\x7f\x19\xfb\x35\x15\x3a\x27\x2c\xeb\x53\x91\xff\xb2\x6f\x6d\xf7\x3b\xdd\x4e\xae\x12\x16\xc3\xde\x9e\x59\x28\x2d\xcd\x6a\xef\x46\x8a\xcf\x48\xb5\x77\x15\x7b\x9f\x50\x2a\x26\x78\x64\xac\x55\xc6\xfe\xe3\x7b\x9d\xbd\x5b\x2c\x84\xd4\xde\xb5\xb9\xec\xfd\x56\x26\xca\x1b\x8b\x08\xec\xd1\xcd\xdf\x63\xef\x5c\xa2\x75\x85\xf7\x3b\xd1\x18\x59\x5b\x9e\x3f\xf4\xc2\x23\xf0\xfd\xc8\x3f\x7c\xef\xfb\xbe\x5f\x0b\x7b\xb7\x38\x67\xca\x21\x7b\x08\xc1\x30\x0a\x07\x9e\x3f\xac\x65\x3f\x12\xa5\xbd\x71\xed\x67\x21\xa3\x2d\xa9\xd6\x77\x79\x52\x92\x04\xbd\x31\x92\x3c\x6a\xa2\xf6\xe8\x28\x02\xe4\xff\xdf\xfd\x63\xf7\xae\xaf\xae\x2f\x5a\xea\x41\xbf\x02\x70\x2e\xb8\x46\xae\xbd\xf1\xa2\xc0\x08\x34\xde\xeb\x83\x22\x23\x8c\x9f\x02\x4d\x89\x54\xa8\xcf\xee\xc6\x97\xde\xe8\xb1\xac\xc1\x3b\x45\xe9\x5d\x70\x2a\x62\xc6\x93\x08\x46\x13\xa6\x2b\xf2\x59\x29\x49\xe6\x5d\x0a\x99\xab\x08\x78\x61\xff\x55\x67\xe1\x29\x54\xcb\xb3\xb7\x1c\x7e\x3a\x83\xe0\xdd\xa9\x15\xff\xd7\xfb\x03\x39\xca\x8a\xfb\x8d\xc0\x98\x69\x08\xfb\x7e\x7f\x60\x4e\x3b\xdd\x08\x8a\x59\x72\xb0\x0c\xd3\x41\xf5\xe9\x27\x22\x0a\x07\x27\x9d\xee\x3e\x50\x6f\x2a\x64\x4e\x74\x13\xf2\x0b\x29\x85\x04\x89\xc4\xc0\xaa\xf2\xaf\xa7\xf6\xc1\x6e\x47\xd0\x53\x6d\x4a\x6c\x96\x6c\xcc\x8b\xc2\x00\x34\x45\x70\x30\x2b\x27\x28\x39\x6a\x54\x65\x91\x48\x12\xe3\x41\xfd\xa5\x59\xa9\x34\x4a\x83\x6c\x18\xac\x06\xf6\x35\x35\x76\xbe\x94\x28\x17\xc6\xea\x87\xdb\x6b\x5b\x57\x12\x95\x28\x25\x45\x15\x41\xef\xfd\xfc\x29\xc6\x2d\x2f\x3d\xf7\x96\xad\x5f\x03\xc3\xc0\x3a\x71\xfa\xeb\x52\x94\x3c\x86\xb0\x55\x06\x5f\x99\x4e\x41\x2f\x0a\xe3\x0e\x60\xdc\x56\xa5\xc6\xbc\xc8\x88\xc6\x3e\x8c\x53\x94\x08\x2a\x15\x65\x16\x83\xe0\xd9\x02\x26\x08\x41\x8b\xf8\x47\xe9\xdb\x40\x26\x08\xc3\xd5\x6c\xb8\xd8\xcd\x7c\x4a\xe6\x08\x13\x44\xfe\x9c\xd0\x0f\x51\xb9\x55\x3e\xcd\x83\xe3\xb0\x5e\xdb\x6c\x0a\x7c\x27\xd3\xb1\xd0\x24\x03\x2a\x4a\xae\x41\x4c\x21\x27\x26\xfb\xe0\xd3\xb5\x49\x86\x18\xf0\x9e\x22\xc6\x68\x16\x05\x52\xd3\x75\xad\xa4\x39\x6b\x99\xbd\x42\xc5\x4e\x4c\x06\xbe\x8b\xc8\x5d\x25\x01\x5a\xc0\x5f\x4b\x15\x10\xf4\x8f\xfb\xa1\x99\x1c\x5c\x68\x50\x65\x61\x1a\x33\xc6\x30\x95\x22\x87\x79\xd3\xc2\x1e\x56\xf3\x2b\xd5\xec\x58\xea\xa3\xe3\xed\x29\x3d\xb0\xf7\x7a\x62\x2f\x54\xf6\xbc\x9a\x4c\xbf\x53\x64\x5e\xd1\x08\x0f\x5d\x34\xd0\x36\x1f\x6a\xa7\x1e\x4f\x20\x66\x12\xa9\x16\x72\x01\x6f\x7a\xea\xcd\x63\x90\x5b\x88\xae\xeb\xe5\x41\x70\xb2\x06\x01\xde\x23\x2d\xad\xde\xa6\xc8\x6c\xfb\xab\x3b\x76\x04\xbd\xf9\x53\x20\xdb\xdc\xd8\x29\x85\x8f\x87\xbb\xd5\xf0\x28\xdc\xe9\x5e\x78\x72\xb4\xda\x2d\x49\x35\x37\x0d\xcb\xb2\xc9\x91\x9a\xad\x2b\x38\x1b\xc5\xd7\x07\x68\xe4\x9c\x1e\x95\xea\x82\x48\xf5\x60\x86\xba\x22\xe2\x14\x59\x5a\x2c\x98\xf9\xcb\xc4\x92\xf7\xe1\x72\xbf\xc6\xfa\xf8\xd8\xd9\x48\xd0\x35\xcf\x5d\x9e\x70\x8a\x3c\x67\xaf\x54\x6a\x8c\x1d\x39\x43\x30\x25\x2c\xc3\xd8\x14\xa5\x4d\x7a\x04\x51\x20\x57\x2a\x85\xa2\x9c\x64\x8c\xc2\x0c\x17\x60\x9e\xbc\xe6\x69\xd4\xfb\xd2\x22\x78\xe9\xbd\x95\xb0\x0e\x9d\xf1\x68\xd5\xd7\xe1\x46\x28\x24\x9b\x9b\xaf\xd1\x6c\x8a\x40\xa9\x74\x15\xa4\xcd\x77\x76\xcb\x62\x77\xee\xb4\x76\x19\x67\x9a\x91\x8c\x7d\x6b\x53\xb2\xc1\xf2\xf4\xd1\xf6\xa2\x4b\x2b\xf3\x2b\x38\x0e\xd6\x26\xd8\xd0\x99\x60\x8c\xcf\x49\xc6\xe2\xa6\xb3\x9a\xd6\x6b\x9c\x43\x05\x6f\x76\x26\x84\xce\xaa\xee\x5b\x36\x7b\x18\x83\x98\x98\xdf\x1d\x2d\x87\xd7\xea\x59\x57\xa8\x03\xf7\xbb\x48\x48\x9a\xa2\xd2\xd6\x37\xb6\x27\x9b\xa1\x51\xf2\xe5\xc8\x68\xc1\x6d\x96\x5c\xdb\x27\x46\x43\x97\xf9\xb6\x0b\x57\x25\x07\xb1\xc0\x6a\x68\xe1\x3d\x53\x0f\x5c\xb3\x51\x70\x65\x48\x4f\x46\x6b\x23\x7a\xe4\x7c\x93\x97\x5c\x22\x15\x09\x67\xdf\x30\x86\x0f\x37\x57\xf5\x8f\x23\xcb\xbb\x05\xb5\x5e\x6a\x43\xdb\x1c\xb8\xec\x2e\x48\x9e\x6d\xf4\xc5\x5a\xa1\xef\x01\x00\x00\xff\xff\x14\x2c\x4e\x08\xa4\x0f\x00\x00") func translationsDefaultLc_messagesAcsenginePoBytes() ([]byte, error) { return bindataRead( @@ -113,7 +122,67 @@ func translationsDefaultLc_messagesAcsenginePo() (*asset, error) { return a, nil } -var _translationsEn_usLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\xcf\x6b\x24\xc5\x1b\xc6\x9f\x64\xe6\x9b\x4c\xe6\xeb\xcf\x55\x10\x51\xf1\xdd\xc3\xb8\x2b\xbb\x3d\xf6\x8c\x98\xdd\xed\x35\x8b\x6b\x4c\x34\x9a\x90\x21\x4e\x82\xe0\x41\x6a\xba\xdf\xe9\xa9\x6c\x4f\xd5\x58\x55\x3d\x9b\x59\xf0\x22\xde\x14\x3c\x79\xf6\x26\x08\x1e\x05\xaf\xeb\x51\xf0\xea\xc1\x8b\x07\x41\xff\x0c\x91\xee\xea\xd9\x09\x12\x51\x3c\xa7\x2e\xd5\x5d\xf5\xbc\x4f\x7d\xea\xa9\xa2\x7e\xb9\x50\xff\x02\x00\x9e\x00\xf0\x2c\x80\x6f\x01\x3c\x07\x60\x77\x09\x65\xbb\xbf\x04\x10\x80\xef\x97\x80\x2b\x00\x7e\x5d\x02\xb6\x01\x3c\xb2\x0c\xec\x00\x38\x5c\x06\x6e\x00\xf8\x72\x19\xd8\x00\xf0\xf3\x32\xb0\x09\xe0\xa9\x1a\x70\x11\xc0\xfb\x35\xe0\x32\x80\x8f\x6a\x40\x0b\xc0\x57\x35\xe0\x69\x00\x3f\x56\xfd\xef\x35\xef\x8b\x3a\x70\x0b\xc0\xd5\xba\x5f\xef\x4e\x1d\x78\x1e\xc0\x67\x75\xcf\xf5\x4d\x1d\x78\x06\xc0\x0f\x75\xe0\x93\x25\xe0\xb7\x4a\x77\xbc\xe2\xeb\x3f\x5d\xf1\x5c\xdf\xad\x78\xae\x3f\x56\x3c\xd7\x5b\xab\x9e\xeb\xe3\x55\xcf\x75\x7f\xd5\x73\xd5\x1b\x9e\xeb\x85\x86\xe7\xda\x6f\x78\x9e\xbc\xea\x3f\x6f\x78\xdf\xaf\x1b\x9e\xeb\xa7\x86\x5f\xef\xc9\x35\xcf\xf5\xca\x9a\xe7\x3a\x5c\xf3\x5c\x66\x0d\x28\x22\x7b\x08\xc0\xb2\xdf\x0e\x56\x00\xac\x02\x58\xf3\x51\xe2\x31\x2c\x5a\xb3\xea\x2f\x00\x78\x14\x40\x03\xc0\xe3\x45\xae\x00\xfe\x57\xcd\xd5\xaa\x73\x29\xda\xff\x01\x3c\x8c\x33\xda\x96\x31\xda\x90\x61\x91\x48\x95\xd2\x50\x66\x4c\x2d\x7b\x95\xca\xe1\x88\x5a\xb6\x12\xdc\x1d\x15\x33\x1f\xe6\x6c\x66\x85\xee\xf6\xc1\x1e\x0d\xcb\x3a\xab\x73\x13\xb3\x8d\xa8\x75\x65\x8a\x6d\x9d\xab\x84\xba\x8b\x61\xba\x2b\xdd\x88\xdc\x6c\x52\xb8\x92\x54\xe4\x46\x4c\x8e\xc7\x93\x4c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x9e\x25\xa4\x55\x36\xa3\x01\x53\xa7\xb2\x51\xfa\xbf\xf9\x8c\xc4\x94\x69\xc0\xac\xa8\x83\xbe\x76\x22\xa3\x58\xe7\xca\x91\x1e\xd2\x58\x58\xc7\x86\x8e\xf6\x0a\xde\x84\xf8\x24\x66\x4e\xb8\xf8\x98\x70\xec\x38\xf1\xca\x62\x0e\x87\x93\xd4\x88\x84\xc9\x69\x7a\x27\x1f\xb0\x51\xec\xd8\x52\xa7\xbd\xde\xee\x92\xb4\xa4\xb4\x23\x9b\x4f\x26\xda\x14\x65\x43\xa3\xc7\x34\x65\x63\xa5\x56\x65\x68\x67\x57\x9f\x52\xfc\x0b\x0f\x2e\x83\x8f\x0d\x0b\x57\x44\x9e\x48\xc3\xb1\xd3\x66\x46\x97\x5a\xf6\xd2\x29\x05\x9f\x70\x9c\x97\x92\x79\x20\xe5\xd1\x54\x47\x19\x51\x6b\x5a\x09\x53\x56\x6c\xbc\x59\x3e\xe7\xab\x2a\x4e\xd9\x4d\x84\xb1\xa7\xae\xc2\xa9\xfa\xbf\x5c\x92\xb2\x66\x28\x64\xc6\x49\xb1\x4f\xa9\xa4\x93\x22\x93\xf7\x16\xae\xf3\x15\xab\x9b\x24\xd5\x54\x64\x32\x99\x6f\xb2\x48\xa1\x00\x8d\xb5\x9a\x8f\x0c\x44\x7c\xc7\x07\x91\xcf\xc7\x38\x21\x3d\x38\xe6\xd8\x41\x9b\x78\xc4\xd6\x95\x7e\x65\x06\x45\x86\xb9\x7a\x90\x20\x16\xdb\xf7\x80\x94\x68\xf6\x29\xf3\x89\xb4\x0e\xb9\x32\x1c\xeb\x54\xc9\x7b\x9c\xd0\xed\xde\xce\x51\xb5\x6a\xe1\x85\x99\x18\x67\x7f\x57\xd8\x33\xba\x20\x08\x76\x92\xe0\x68\x7e\x40\x22\xb6\xac\x52\xa9\xb8\x79\xc0\xc5\xfa\xc1\x9e\x4d\x65\x12\xbc\x9e\xa7\x36\xe8\xeb\x88\x9a\xbd\xfd\x7e\xb0\x59\x1e\x9e\x56\xc1\x1b\x65\xc6\xdd\xb0\x73\x2d\x08\xd7\x83\xb0\x43\xdd\x97\xa3\xce\xfa\x95\x30\x0c\xc3\x66\x6f\x3f\x38\xe0\xa9\xb4\x67\xea\x3a\xeb\x51\xe7\x46\x10\x5e\x0b\xc3\xe6\xae\xb0\x2e\xe8\x1b\xa1\x6c\xe6\x23\x7d\x5b\x0a\x95\x3a\x29\x14\xed\x4a\x7a\xf5\x78\xfe\x97\xc9\xd7\x46\xda\x8d\x85\xcc\xda\xb1\x1e\xdf\x6a\xee\x0a\x95\xe6\x22\xe5\xa0\xcf\x62\x1c\xd1\x96\x4a\x33\x69\x47\x0f\x86\x23\x62\xf5\xc1\xe1\xbb\xcd\xbd\x9d\xbd\xad\xc5\xf6\x3a\xed\xb0\xb9\xa9\x95\x63\xe5\x82\xfe\x6c\xc2\x11\x39\x3e\x71\x2f\x4d\x32\x21\xd5\x4d\x8a\x47\xc2\x58\x76\x1b\x87\xfd\xed\xe0\xfa\x42\x57\xb0\x0d\xd9\x04\x5b\x2a\xd6\xc5\x4d\x89\xe8\xfa\x40\xba\x66\x2f\xcb\x8d\xc8\x82\x6d\x6d\xc6\x36\x22\x35\x29\x7f\xed\x46\xf7\x26\xf9\xcf\x8d\xcb\x8a\x2e\x6e\x50\xe7\xc5\x9b\xcd\xf7\x82\x37\x17\x57\xa6\xa7\x39\x91\x8e\xba\xed\xb0\xdd\x6d\x9e\x3f\x54\xe7\x0f\xd5\xf9\x43\xf5\x0f\x0f\xd5\x9f\x01\x00\x00\xff\xff\x4b\x51\xd4\xd3\x8e\x09\x00\x00") +var _translationsDefaultLc_messagesAcsenginePoLcg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6b\xf3\x36\x14\xc6\xef\x5f\x78\xbf\xc3\x99\x20\xf4\x62\x5b\x9c\x64\x5b\xb6\x05\x3b\x25\xa4\x1b\x84\xa5\x5b\x59\xd2\x52\x28\xbd\x50\xa4\x93\x58\xab\x2c\xb9\xfa\x93\x3a\xfd\xf4\x43\x76\xbc\x94\x31\x18\x0c\x89\xdd\xb4\x8e\x9c\x63\x3f\xbf\x73\xac\xf3\x1c\x27\xbf\x6e\x2a\x09\x47\x34\x56\x68\x55\x90\xf1\x70\x44\xae\xe7\x9f\x3f\xe5\xeb\xe5\x23\x6c\x58\x89\x15\x7d\xe8\xcf\x4d\x87\x23\x02\xbf\xd2\x0a\x0b\x42\x99\x45\x75\x10\x0a\x09\xdc\x59\xb3\xe2\x05\x19\x13\xd8\x18\xb6\xf4\xb2\x20\xa8\xbe\xbe\xdf\x10\x68\x2a\xa9\x6c\x41\x4a\xe7\xea\x59\x96\xd9\xf6\x5a\x76\x58\x09\x66\xb4\xd5\x7b\x37\x64\xba\xca\xa4\x66\xd6\x79\x2e\x74\x36\x19\x8d\xa6\xd9\x34\x93\xac\x21\xf3\xcf\x9f\x00\xf2\x95\xc3\x0a\xc2\x9f\xed\xa9\xc6\x82\x8c\x48\xfb\xe1\x7c\xab\xcb\x4d\xd7\x48\xf7\x05\x71\xc6\x63\x17\x07\x90\x6f\x9c\x81\x25\x75\x05\xd9\x62\xe3\xfa\x55\x80\xfc\x81\xca\x79\xfe\xc5\xd3\xf2\x66\xb1\x5d\x3c\xfd\x64\x8c\x36\x60\x90\x72\xa1\x0e\xb0\x17\x12\x61\x60\xbf\x82\x76\x79\x06\x03\xfb\xfc\x3c\xcf\xb3\x10\x71\xbe\x68\xb6\x71\xa6\x3f\xbe\x11\xb6\x86\x15\x0b\x39\xd9\x38\x43\x20\xeb\x14\x67\x41\xe0\xbf\x89\x9f\xc4\x13\xff\x56\x06\xd5\xaf\x1e\xcd\x29\x30\x2c\x7e\xbf\x85\x7d\xcb\x64\xb5\x37\x0c\xed\x0c\x06\x5f\x1e\x53\x71\x7c\x13\x83\xe3\x67\xed\x15\x87\xc9\x45\x32\xbc\x09\x57\x82\x3b\xd5\xa1\x1a\x20\x14\xb8\x12\xc1\x61\x55\x4b\xea\x70\x08\xdb\x12\x0d\x82\x2d\xb5\x97\x1c\xb4\x92\x27\xd8\x21\x8c\x53\x21\x7e\x1b\x0f\x51\xe9\xff\xc6\x58\xd2\x23\xc2\x0e\x51\xa5\xa3\xfc\x2e\x06\xe5\x56\x3b\x2a\x81\x69\xaf\x1c\xe8\x3d\x54\xd4\x3a\x34\xf0\x70\x1b\x9e\x41\x0e\xd8\x30\x44\x8e\xe1\xa0\x46\xe6\x90\x77\xdf\x0c\xe7\x52\x51\x4d\x63\x50\xdd\xd7\x07\x43\x39\x82\xd3\xf0\x8b\xdf\xa1\x51\xe8\xd0\xc2\x78\x38\x1d\x4e\x40\x58\x50\xda\x81\xf5\x75\xad\x4d\x40\xda\x1b\x5d\xf5\x7d\x34\x65\x03\xf9\x3e\x1d\xd9\x07\xf5\xff\x1f\xdf\x0f\x31\xf8\xb0\x6d\x90\xcc\x20\x75\xa1\x35\x72\x61\x90\x39\x6d\x4e\x70\x35\xb0\x57\x29\xd5\xff\x18\x4f\x3d\x36\xc8\x7c\x2b\xbf\x6f\x0e\x6d\x7b\x3f\x5b\xd5\x0c\x06\xc9\x7a\xfb\x78\x14\x8f\xe2\x80\x0a\x4d\x57\x05\xdf\x3f\x74\x67\x9c\x94\x75\x18\x47\x19\x12\x3a\x84\x9a\x1a\xfb\x61\x48\x48\x9a\xf9\x28\xe3\x01\xfe\xd3\x6c\x93\x34\xdb\x51\xa6\x81\x3d\x15\x12\x79\xe8\x49\xed\xc6\x45\xd0\x35\x2a\x6b\x4b\xa8\xfd\x4e\x0a\x06\x2f\x78\x02\xeb\x8c\x50\x87\x19\x0c\x5e\x93\xb1\x44\xb1\xfd\x0b\xcb\x79\x03\x20\xd4\x46\x1c\xc3\xff\x80\x11\x36\xb2\xb5\x65\x52\x8e\x28\xc6\x7e\xe1\x10\x4a\x38\x41\xa5\x78\xbf\x6c\xe0\x9e\x2d\xed\xc4\x3c\x8e\xe2\xe5\x42\x1d\xa9\x14\xbc\x77\xb0\x60\x71\xa1\x08\x4c\xab\x7e\x65\x47\xd9\x4b\xe7\x72\xbe\x5f\x43\x0e\x7a\xf7\x07\x32\x97\x8c\x2d\x8a\x9b\x6b\xc3\x4a\xb4\xae\xad\x44\xeb\x70\xc1\xbd\xbd\xfa\xcb\xbb\x93\xa9\x8f\xe2\xd5\x17\x77\xeb\x1a\x15\x70\x8d\xdd\xf0\x81\x8d\xb0\xe9\x52\x1f\xc5\xaa\xbd\x32\xc8\xf4\x41\x89\x77\xe4\xb0\xb8\x5b\x9d\x5f\x96\xdb\x2a\x24\x7b\x85\x8c\x62\xcf\x27\x5a\xc9\x24\x29\xff\xed\x4d\x21\x5f\xea\xaa\x42\xe5\x6c\x1f\xb6\xac\xdc\xf9\xa7\x83\x35\x6b\x16\xbc\x12\xea\x12\xfa\xf7\x80\x3c\x5b\x2f\x1f\xe7\x7f\x06\x00\x00\xff\xff\xac\xbb\x9e\xdd\x99\x10\x00\x00") + +func translationsDefaultLc_messagesAcsenginePoLcgBytes() ([]byte, error) { + return bindataRead( + _translationsDefaultLc_messagesAcsenginePoLcg, + "translations/default/LC_MESSAGES/acsengine.po.lcg", + ) +} + +func translationsDefaultLc_messagesAcsenginePoLcg() (*asset, error) { + bytes, err := translationsDefaultLc_messagesAcsenginePoLcgBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/default/LC_MESSAGES/acsengine.po.lcg", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsDefaultLc_messagesEnUsLclAcsenginePoLcl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x99\x51\x8f\x1a\x37\x10\xc7\xdf\x23\xe5\x3b\x4c\x57\x42\x79\x68\xcb\xc2\xb5\xa5\x2d\x02\x12\x44\x5a\xe9\x54\xd2\x9e\x0a\x39\x45\x4a\xf2\x60\xec\x81\x75\xe3\xb5\x37\xf6\x2c\x07\xf9\xf4\x95\x17\x36\x9c\xd4\x4a\x0d\x9c\xe7\xd4\x97\x3b\xaf\xf7\xbc\x33\xf3\x9b\x59\x7b\xfe\xb7\xa3\xe7\xbb\xd2\xc0\x16\x7d\xd0\xce\x8e\xb3\x7e\xb7\x97\x3d\x9f\x3c\x7d\x32\x9a\xcf\xde\xc0\x42\x16\x58\x8a\xdb\xf6\xde\xa0\xdb\xcb\xe0\x77\x51\xe2\x38\x13\x32\xa0\xdd\x68\x8b\x19\xdc\x04\x7f\xad\xc6\x59\x3f\x83\x85\x97\xb3\xda\x8c\x33\xb4\xdf\xbe\x5e\x64\xb0\xdc\xd0\xfd\xcb\x5d\x69\x6c\x18\x67\x05\x51\x35\xcc\xf3\xd0\x3c\x3a\x74\x4b\x2d\xbd\x0b\x6e\x4d\x5d\xe9\xca\xdc\x38\x19\xa8\x56\xda\xe5\x57\xbd\xde\x20\x1f\xe4\x46\xee\xb2\xc9\xd3\x27\x00\xa3\x6b\xc2\x12\xe2\x8f\xe5\xbe\xc2\x71\xd6\xcb\x9a\x8b\xa3\xe5\x93\x0f\x73\x14\xeb\x71\x46\xbe\xc6\xc3\x3a\x80\xd1\x82\x3c\xcc\x04\x8d\xb3\x25\xee\xa8\x9d\x05\x18\xdd\x0a\x33\x19\x7d\xf5\x76\xf6\x72\xba\x9c\xbe\xfd\xc5\x7b\xe7\xc1\xa3\x50\xda\x6e\x60\xad\x0d\x42\x27\x7c\x03\xcd\xf4\x10\x3a\xe1\xfd\xfb\xc9\x28\x8f\x2b\x3e\x2f\x5f\x6e\xe8\xde\x63\x61\x41\x71\x3c\x77\x32\x83\x69\x55\xf9\x71\x76\xe3\x31\x0e\xdc\x16\xd5\xc9\xe8\xc3\xcd\xe6\xcb\x0d\xb5\x91\xe5\x0b\xf2\xed\xf8\xa5\x0e\x15\x5c\xcb\x98\xa7\x05\xf9\x0c\xf2\x03\xb6\x3c\x52\xfa\x2f\x82\x57\xe9\x08\xde\x15\x31\x86\x8f\x35\xfa\x7d\x8c\x68\xfa\xe7\x2b\x58\x37\x11\x06\x57\x7b\x89\x61\x08\x9d\xaf\xb7\xac\x30\x2f\xf4\x80\x83\xeb\x77\x29\xb8\xfe\xea\x6a\xab\xe0\xea\x14\x00\xdc\x69\x2a\x80\xf6\x55\xac\x15\xd0\x16\xa8\x40\x20\x2c\x2b\x23\x08\xbb\xb0\x2c\xd0\x23\x84\xc2\xd5\x46\x81\xb3\x66\x0f\x2b\x84\x3e\x13\x72\x2e\xe7\x38\xb2\xf1\x7d\xba\x6c\x58\x77\x59\xc4\x85\xd8\x22\xac\x10\x2d\x73\x42\x58\xfc\xe3\xc8\xc9\x0f\x29\x72\xb2\x74\x24\x0c\x48\x57\x5b\x02\xb7\x86\x52\x04\x42\x0f\xb7\xaf\xe2\xab\xae\x00\x77\x12\x51\x61\x1c\x54\x28\x09\xd5\xe1\x2f\xe3\x3d\xa6\x1c\x24\xf4\x87\x83\xf9\x20\x05\xf3\xd7\xd5\xc6\x0b\x85\x40\x0e\x7e\xab\x57\xe8\x2d\x12\x06\xe8\x77\x07\xdd\x2b\xd0\x01\xac\x23\x08\x75\x55\x39\x1f\x03\x5c\x7b\x57\xb6\x2d\x06\xe3\x61\x9a\xd8\x27\x0e\xf6\x3f\xf2\xb1\xbf\x17\xcb\xff\x2c\x03\x0f\xf4\x8c\x23\x0f\x3f\xa5\xc8\x03\x36\xfd\x86\xf4\x28\x28\x76\x1a\x4a\x7b\x94\xe4\xfc\x1e\x9e\x75\xc2\x33\x46\xca\x17\xd8\xe5\x60\xf8\x73\x3a\x86\xb8\x43\x59\x37\xc1\xb4\x07\x53\xd3\xb3\x1d\xfb\xe1\x21\x74\xb8\x5a\xc6\xcb\xcd\x73\x10\xed\xf7\xd2\x21\xdd\xa0\x45\x7f\x28\x90\xba\x7d\x2b\x8f\xc1\xb1\x97\xe6\xd9\xb6\x59\x60\x26\xd1\x85\x87\x80\x2a\xe1\xc3\x3d\x81\xc6\x5e\x90\x5f\x64\x8f\x05\x5a\x12\x29\x88\xff\xa6\x6a\xd9\xab\xee\x8b\xec\xb1\x40\x4b\xa2\xf3\xd6\x42\x1b\x54\xf1\xe8\x6c\x76\x76\x04\x57\xa1\x0d\xa1\x80\xaa\x5e\x19\x2d\xe1\x03\xee\x21\x90\xd7\x76\x33\x84\xce\x47\x26\x92\x0f\x75\x82\x05\x6f\x12\xe1\x76\x8a\xec\xb8\x3b\x21\x54\x5e\x6f\xe3\xef\x18\x54\xdc\xef\x43\x28\x1e\x05\xed\xf9\x0e\xb0\x60\x4d\xa2\xbd\x4e\x51\x69\xab\x49\x0b\xa3\x3f\x9d\x36\xfb\x36\x52\xd6\x7f\xa1\x3d\xc8\x03\x16\xb0\x49\x04\x96\xb6\x5b\x61\xb4\x6a\x5b\xe3\xd8\x3b\xc7\x12\x91\xce\xb6\x33\x2b\x21\x3f\x1c\xda\xe7\xba\x9d\x43\x05\x6e\xf5\x17\x4a\x62\x62\x9d\xda\x29\x16\xfc\x49\x34\x96\xf3\xb2\xc0\x40\x4d\xe9\x34\x7d\x75\x54\x2e\xb5\xfd\xac\x5b\x98\x00\x9f\x6f\x96\x05\x61\x12\x79\x74\xea\xa5\x0f\x07\x32\x28\x87\x07\xf5\x87\x3b\x1d\xb8\x4a\xf4\x6c\xab\x2c\x00\x93\x68\xa3\xda\x7a\x94\x6e\x63\xf5\x27\x54\x30\xbd\xb9\x3e\x7e\x88\x69\xea\x82\x89\xde\x79\x26\x59\xbe\x45\x24\xd1\x40\x7b\x51\x9a\xc7\xad\xbb\xb3\x2c\x5e\x0e\xee\x8f\x3b\x8b\x6a\xe6\xca\x12\x2d\x85\x76\xd9\xac\xa4\xe3\x77\xb9\xb9\xdc\x4d\x55\xa9\xed\x69\xe9\x3f\x17\x8c\x16\x48\x51\x9b\x85\xe3\x9a\x17\xdb\x30\x77\x72\xe9\x9c\x09\x2f\xde\xc9\xda\x7b\xb4\xf4\x4e\xe1\x5a\xd4\x86\xba\x26\x84\x0c\x0e\x49\x9a\xc7\x61\x7c\xec\x28\x9f\xcf\xde\x4c\xfe\x0e\x00\x00\xff\xff\x4f\x29\xb2\x58\x39\x1c\x00\x00") + +func translationsDefaultLc_messagesEnUsLclAcsenginePoLclBytes() ([]byte, error) { + return bindataRead( + _translationsDefaultLc_messagesEnUsLclAcsenginePoLcl, + "translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", + ) +} + +func translationsDefaultLc_messagesEnUsLclAcsenginePoLcl() (*asset, error) { + bytes, err := translationsDefaultLc_messagesEnUsLclAcsenginePoLclBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x98\xdf\x53\xdb\x38\x10\xc7\xdf\x3b\xd3\xff\x61\xcf\x37\xd3\x69\xe7\x2a\xdb\x72\x42\x7e\x98\x84\x5e\x2f\x05\x8e\x1b\x28\x99\x26\xf4\x78\xf0\x0c\x23\xec\xc5\x51\x91\x25\x8f\x24\x33\x70\x7f\xfd\x8d\x13\xe3\xe4\xae\xa1\x05\x12\xfc\x00\xb1\x65\x69\xf5\x59\xed\x6a\xf5\xb5\x07\x1f\x6e\x33\x01\x37\xa8\x0d\x57\x72\xe8\x50\xd7\x77\x3e\xec\xbd\x7e\x35\x38\x1e\x9d\xc3\x24\x9e\x61\xc6\xbe\xde\x3f\xeb\xb8\xbe\x03\x9f\x59\x86\x43\x87\xc5\x06\x65\xca\x25\x3a\x30\x36\xfa\x28\x19\x3a\xd4\x81\x89\x8e\x47\x85\x18\x3a\x28\xc9\xd9\xc4\x81\xdb\x4c\x48\x33\x74\x66\xd6\xe6\xa1\xe7\x99\xb9\x2d\xe3\x66\x3c\xd6\xca\xa8\x2b\xeb\xc6\x2a\xf3\x84\x8a\x8d\x2d\x12\xae\xbc\xc0\xf7\x3b\x5e\xc7\x13\xf1\xad\xb3\xf7\xfa\x15\xc0\xe0\xc8\x62\x06\xe5\xbf\x85\xf5\x79\x23\xc0\x60\xac\x55\x6e\xaa\x1b\x80\xc1\xc4\xea\x0a\x69\x7c\x7a\x71\x82\x96\x25\xcc\x32\xdf\x81\xaf\x4c\x0c\x9d\x5f\x43\xc8\xaf\x53\xaf\x86\xf5\x16\x3f\x6e\xaa\xc2\xa0\xd5\x77\xc0\xfb\x89\x1d\x7a\x6f\xe7\x3d\xc4\xe4\x4a\xe9\x8c\xd9\xe5\xa0\x81\xb7\x44\x19\x78\x25\xe8\x1a\xee\x60\x13\x6e\x95\xa3\x66\x96\x2b\x69\xbc\xeb\xe2\x12\xb5\x44\x8b\xa6\xc8\x53\xcd\x12\xf4\xaa\xdf\x58\x14\xc6\xa2\x2e\x5d\xea\xd2\x26\x3c\x6a\x6d\x27\x12\x56\x33\x69\x4a\x80\x92\xbc\xdf\x48\x2c\xda\x2f\x40\x4e\x83\xa0\x09\xf4\x9d\x17\x4b\xa3\x1b\xda\x09\xaa\xeb\x79\x12\x51\xbf\x11\x87\x3a\x8d\x39\xd4\xf2\x9b\xf0\xa7\xdb\xe0\x3e\xef\x75\x9a\xf0\xa8\xb7\x9d\xdd\x72\xc5\x05\x1a\x76\xb3\x20\x0f\xda\x4d\x90\xf7\xb7\x7d\x56\x50\xda\x6f\x04\x9c\xfa\x8d\xed\x8a\x4e\xf7\x09\x0e\x3d\xa7\x8c\xf4\x1e\x51\x46\x82\x0d\x26\x08\xfa\x3b\x3f\x9f\xa0\xb5\x79\x48\xb6\x2e\x3c\x28\xed\x35\x72\xda\xd1\x8d\xa4\x07\xcb\x79\xf9\x27\x54\xbd\xde\xed\xba\xbd\x0a\xc3\x7f\x1f\x37\x52\x65\xe9\x96\xc4\x87\x31\xb3\x12\x7a\xe7\x11\x29\xb4\x05\xe8\x2d\xe9\x8e\x0a\xba\xdd\x4c\xf6\x34\xa7\x38\x82\x86\xf6\xc3\x46\x92\xe3\xbb\xfd\x40\x3b\xf4\x87\x1b\xa2\xdb\xcc\x86\xd8\x48\x77\xac\x2b\x4f\xad\x66\x04\x2d\xdd\x92\xbc\x58\xa9\xab\xbd\xa7\x1c\x69\xcf\x07\xdf\x4c\x5d\xfc\x3f\x8d\xfa\xbd\x1f\x66\xd1\x4e\x23\xaf\x74\xc1\x46\xba\xe3\x81\x43\xae\xf5\x42\xe4\xab\x84\x2b\x66\x47\x2a\xbf\xd3\x3c\x9d\xd9\x3f\xb1\x5c\xbc\x9a\x11\xf6\x65\x2a\xb8\x99\xc1\xfc\xb5\x4d\x2c\xaa\x12\x5c\x29\x0d\x2c\x36\x64\x41\x0c\x39\x8b\xaf\x59\x8a\xee\xca\xec\x0f\x5a\xae\xa1\xa1\x7e\x00\x6f\x47\xef\x20\xf0\x69\xf7\x31\xe3\x6b\xd1\x03\xd3\x19\x37\x50\xea\x63\xe0\x06\x12\x6e\xac\xe6\x97\x85\xc5\x04\x0a\x99\xa0\x06\x3b\x43\x30\x2c\x43\x10\x3c\x46\x69\x10\x98\x99\xb7\x3d\x93\xbb\xd6\x42\xf0\x17\x67\x32\xb5\x9c\x49\x38\xe6\xf0\x46\xd8\xdd\x6f\xf7\x0d\x82\xff\x3e\x53\x36\x63\x5c\xb8\xb1\xca\xde\xa4\x76\xf7\xfd\xdc\xaf\xf5\x13\x1c\x68\x95\x1d\x70\x81\x95\xe1\x4f\x61\x74\xa8\xfe\x56\xfa\x3a\x32\x3a\x8e\x52\x6e\x67\xc5\x65\x69\x26\xfa\xf8\x4f\xa1\x31\x5a\x62\x47\xab\xa1\x88\x12\xbc\x62\x85\xb0\xd1\xf1\xe8\xe2\x64\x7f\x32\xf9\x78\xb8\x3f\x89\xea\x94\x72\x73\xf5\xe0\xd4\x5f\x30\x57\x86\x5b\xa5\xef\x2a\x80\x95\x6f\x52\x6b\x86\x8c\x4f\x2f\x16\x0b\x51\xf5\x1e\x6b\xf5\x0d\x63\x4b\x8e\x12\x52\x7d\xe0\x0a\xa1\xb6\x10\xc9\xd2\xba\xb6\xe4\xc4\xa4\x3c\x21\x7f\x14\xa9\x21\x53\x15\x42\x24\xc7\xa7\x53\x32\xd2\x38\x87\x27\x9f\x98\xc5\x70\xbe\x42\xc4\xef\x92\x60\x07\x7c\x3f\xf4\xdb\xbf\xf9\xbe\xef\x97\x3d\xc9\x17\xbc\xe1\x66\x4d\xc7\x36\xd0\x6e\x18\xb4\x88\xdf\x2d\x3b\x1e\x33\x63\xc9\xb4\x5a\x13\xa5\xc3\x27\x05\xa8\x1c\x2e\xd3\x82\xa5\x48\xa6\xc8\xb2\xf0\x3e\xdf\x97\xed\x21\xa0\xbc\x38\x9b\x44\xf2\xe4\xe8\x64\x7f\xe9\x2b\x75\xfd\x48\x8e\x94\xb4\x28\x2d\x99\xde\xe5\x18\x82\xc5\x5b\xeb\xe5\x82\x71\xb9\x0b\xf1\x8c\x69\x83\x76\x78\x36\x3d\x20\xbd\x95\x8e\xf3\x8f\x1f\xa8\xc9\xbe\x8c\x55\xc2\x65\x1a\x42\xef\x92\xdb\x48\x8e\x45\xa1\x99\x20\x07\x4a\x67\x26\x04\x99\xcf\x6f\xcd\x30\xd8\x85\xc5\xe5\xf0\xad\x84\x5f\x86\x40\xdf\xed\x46\xf2\x9c\x1c\xa2\x2c\x15\x42\xe9\xec\x58\x61\xc2\x2d\x04\xae\xef\xb6\x22\xb9\x36\x74\x9f\x17\xc6\x4d\x15\xb9\xfa\x80\x5a\x96\x88\x81\x77\x3c\x3a\xdf\xfb\x37\x00\x00\xff\xff\xce\xf0\x3f\x78\xcb\x14\x00\x00") + +func translationsDefaultLc_messagesEnUsMetadataAcsenginePoXmlBytes() ([]byte, error) { + return bindataRead( + _translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml, + "translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml", + ) +} + +func translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml() (*asset, error) { + bytes, err := translationsDefaultLc_messagesEnUsMetadataAcsenginePoXmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsEn_usLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\x4f\x8b\x5c\x45\x17\xc6\x9f\x99\xe9\xc9\x4c\xdf\xf7\xf5\x5f\xd4\x85\xa8\x78\x82\xb4\x49\x8c\xb7\xbd\xdd\x89\x4e\xec\x38\xc1\x38\xce\xc8\x68\x86\x0c\x63\x27\xb8\x0b\xd5\xf7\x9e\xe9\xae\xe4\x76\xd5\x4d\x55\xdd\xce\x74\x44\x57\x7e\x05\x97\x82\x2b\xc1\x4f\x21\x88\x08\x7e\x09\x51\x50\x70\x21\xb8\x16\x5c\x48\xdd\xba\x9d\x6e\x42\x04\x71\xe3\x66\x6a\x53\xdd\x75\x9f\x73\xce\xaf\x9e\x73\xa8\x1f\x4e\x36\x3e\x03\x80\xa7\x01\x3c\x07\xe0\x5b\x00\xcf\x03\xc8\x97\x50\xad\x1f\x97\x00\x02\xf0\xd3\x12\x70\x0e\xc0\xf2\x32\xb0\x03\xa0\xbd\x0c\xec\x02\x28\x97\x81\x37\x00\x7c\xbd\x0c\x6c\x02\xf8\x63\x19\xd8\x02\xb0\xb1\x02\x9c\x02\xf0\xd1\x0a\x70\x06\xc0\xe7\x2b\x40\x0b\xc0\x77\x2b\xc0\x33\x00\x7e\xab\xf7\x13\x0d\xa0\x0d\x80\x1a\xc0\xcb\x00\xae\x35\x42\x9d\x7b\x0d\xe0\x32\x80\x2f\x1b\xa1\xfe\x2f\x0d\xe0\x05\xaf\x5f\x0d\x9c\x2f\xad\x02\xcf\x02\xd8\x5a\x05\x3e\x5d\x02\x6e\xae\x06\xdd\xcf\x27\x42\xfc\xea\x5a\xe0\xec\xac\x05\xce\xa3\xb5\xc0\xf9\xcd\x5a\xe0\xfc\x73\x2d\x70\xf6\xd6\x03\xe7\x27\xeb\x81\xf3\x8b\xf5\xc0\xf9\xfd\x7a\xe0\xfb\xbd\xde\x9b\xcd\xc0\xf9\x62\x33\x70\x1e\x34\x43\x9d\x8f\x9b\x81\xf3\xab\x66\xa8\xff\x6b\x33\x70\x36\xa3\xc0\x79\x36\x0a\x9c\x3b\x11\xe0\x2d\xfd\xbf\xf7\x10\x40\xc3\xdf\x05\xc0\x9a\xd7\x02\x78\x0c\xc0\x49\xcc\x57\x54\xef\x4f\x01\x78\x02\xc0\x3a\x80\x27\x01\x3c\xea\xef\x06\xe0\x71\x00\x2b\x75\xdf\xfc\xfa\x1f\x80\x47\xf0\x90\xb5\x6d\x8c\x36\x64\x58\x64\x52\x0d\xe9\x50\xe6\x4c\x2d\xfb\x0a\x55\xc7\x3d\x6a\xd9\x5a\x70\x77\xe4\xbf\xdc\x29\xd9\x4c\xbd\xee\xca\xc1\x1e\x1d\x56\x71\x56\x97\x26\x65\xdb\xa3\xd6\xb9\x09\x76\x74\xa9\x32\xea\xce\x8f\xe9\xae\x74\x23\x72\xd3\xc2\x67\x25\xa9\xc8\x8d\x98\x1c\x8f\x8b\x5c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x99\x67\xa4\x55\x3e\xa5\x01\x53\xa7\x4e\xa3\xf4\xbf\xcb\x33\x12\x13\xa6\x01\xb3\xa2\x0e\xfa\xda\x89\x9c\x52\x5d\x2a\x47\xfa\x90\xc6\xc2\x3a\x36\x74\x63\xcf\xf3\x66\xc4\x47\x29\x73\xc6\xfe\x47\xc1\xa9\xe3\x2c\x28\xfd\x37\x5c\x2f\x86\x46\x64\x4c\x4e\xd3\xfb\xe5\x80\x8d\x62\xc7\x96\x3a\xed\xd7\xdb\x5d\x92\x96\x94\x76\x64\xcb\xa2\xd0\xc6\x87\x1d\x1a\x3d\xa6\x09\x1b\x2b\xb5\xaa\x4c\x7b\x78\xf4\x82\xe2\x1f\xe4\xe0\xca\xf8\xd4\xb0\x70\xde\xf2\x4c\x1a\x4e\x9d\x36\x53\x3a\xdd\xb2\xa7\x17\x14\x7c\xc4\x69\x59\x49\x66\x86\x54\xad\xa9\x5b\xd9\xa3\xd6\xa4\x16\x0e\x59\xb1\x09\xc9\xca\x19\x5f\x1d\xb1\x90\xae\x10\xc6\x2e\x8c\xc2\x42\xfc\x03\x43\x52\xc5\x1c\x0a\x99\x73\xe6\xef\x59\x81\x32\xe9\x82\x95\xb5\x23\x2a\xca\x41\x2e\x53\xba\xcd\x53\xb2\xce\x48\x35\xec\x51\xeb\xce\x82\xbc\x86\x61\x2a\x8c\x9c\xf8\xdd\x2b\x3d\xb7\xb5\xa3\x07\xa4\x52\x49\x27\x45\x2e\xef\xcd\x79\x67\xe1\xf5\x8c\x4a\x35\x11\xb9\xcc\x66\xf6\x79\x7f\x7d\xaa\x54\xab\xd9\xc9\x40\xa4\xb7\x83\xc5\xe5\xec\x8c\x33\xd2\x83\x5b\x9c\x3a\x68\x93\x8e\xd8\xba\x2a\x5f\xe5\xae\xef\x4e\xa9\xee\xf7\x06\x73\x63\xc3\xd5\x29\xd3\x1c\xfa\xc7\x47\xd2\x3a\x94\xca\x70\xaa\x87\x4a\xde\xe3\x8c\xae\xec\xef\xde\xa8\xab\xfa\x5c\x98\x8a\x71\xfe\x77\x81\xfb\x46\x7b\x82\x78\x37\x8b\x6f\xcc\x5a\x2f\x52\xcb\x6a\x28\x15\x47\x07\xec\xeb\xc7\x7b\x76\x28\xb3\xf8\xed\x72\x68\xe3\xbe\xee\x51\xb4\x7f\xad\x1f\x6f\x55\x63\xa1\x55\xfc\x4e\xd5\xbd\x6e\xd2\xd9\x88\x93\x8d\xb8\xfb\x1a\x25\x49\x2f\xb9\x70\x2e\x49\x92\x24\xda\xbf\x16\x1f\xf0\x44\xda\x87\xe8\x2e\x50\x67\xa3\xd7\x3d\x1f\x27\x1b\x49\x12\x5d\x15\xd6\xc5\x7d\x23\x94\xcd\x83\xa5\xef\x49\xa1\x86\x4e\x0a\x45\x57\x25\xbd\x79\x6b\xf6\x2f\x97\x6f\x8d\xb4\x1b\x0b\x99\xb7\x53\x3d\xbe\x1c\x5d\x15\x6a\x58\x8a\x21\xc7\x7d\x16\xe3\x1e\x6d\xab\x61\x2e\xed\xe8\xfe\x71\x8f\x58\xdd\xbc\xfe\x41\xb4\xb7\xbb\xb7\x3d\xbf\x5e\xa7\x9d\x44\x5b\x5a\x39\x56\x2e\xee\x4f\x0b\xee\x91\xe3\x23\xf7\x6a\x91\x0b\xa9\x2e\x51\x3a\x12\xc6\xb2\xdb\xbc\xde\xdf\x89\x2f\xce\x75\x9e\xed\x90\x4d\xbc\xad\x52\x9d\x55\xc3\x74\x71\x20\x5d\xb4\x9f\x97\x46\xe4\xf1\x8e\x36\x63\xdb\x23\x55\x54\x7f\xed\x66\xf7\x12\x85\x9f\x9b\x67\x14\x9d\xda\xa4\xce\xd9\x4b\xd1\x87\xf1\xbb\xf3\x91\xd9\xd7\x9c\x49\x47\xdd\x76\xd2\x3e\x1f\x1d\x3f\x81\xc7\x4f\xe0\xf1\x13\xf8\x9f\x3d\x81\x7f\x05\x00\x00\xff\xff\x15\x09\xe4\xac\x62\x0a\x00\x00") func translationsEn_usLc_messagesAcsengineMoBytes() ([]byte, error) { return bindataRead( @@ -133,7 +202,7 @@ func translationsEn_usLc_messagesAcsengineMo() (*asset, error) { return a, nil } -var _translationsEn_usLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x53\xe3\x36\x10\xfe\x9e\x5f\xb1\x25\xc3\xdc\xdd\x1c\x0e\xb6\x03\x06\x4c\xe9\xf4\x4a\xa1\x43\x7b\x4c\x19\x1a\x6e\xfa\xa1\x33\x1d\x45\xde\xd8\x3a\x6c\xc9\xd5\x4b\x8e\xdc\xaf\xef\x48\xb6\x63\x5e\x1c\x27\x17\xee\x03\x83\x23\xad\x76\x9f\x67\x5f\x1e\x69\x08\x17\x3c\xcd\x99\xca\x40\x4b\xc2\x55\x4e\x34\x13\x5c\xc1\x4c\x48\x20\x54\x21\x4f\x19\x47\x28\x09\xbd\x27\x29\x8e\x06\x43\x38\x17\xe5\x42\xb2\x34\xd3\xf0\xf6\xfc\x1d\x84\x7e\x70\x34\x18\xc2\x24\x63\x0a\x66\x2c\x47\x60\x0a\x12\xa6\xb4\x64\x53\xa3\x31\x01\xc3\x13\x94\xa0\x33\x04\x45\x0a\x84\x9c\x51\xe4\x0a\x81\x28\xb7\xd6\x19\xe0\x77\x46\x78\xaa\x19\xe1\xf0\x91\xc1\x8f\x9f\x9b\x5f\x39\xfb\x39\x13\xba\x20\x2c\x1f\x51\x51\xfc\xb4\xe7\x42\x8f\x06\xc3\x41\xa1\x52\x96\xc0\xce\x8e\xfd\x50\x5a\xda\xaf\x9d\x1b\x29\x3e\x23\xd5\xde\x55\xe2\x7d\x42\xa9\x98\xe0\x71\x1b\xec\x1f\xbe\x33\xd8\xb9\xc5\x52\x48\xed\x5d\xdb\xc3\xde\x2f\x26\x55\xde\x44\xc4\xe0\xb6\x6e\xfe\x9c\x78\xe7\x12\x5d\x22\xbc\x5f\x89\xc6\xd8\xc5\xf2\xfc\xc8\xf3\x03\x08\xc7\x71\x10\xbd\xf7\x7d\xdf\xaf\x8d\xbd\x5b\x9c\x33\xd5\x69\x1b\x44\x71\x70\xe2\xf9\x47\xb5\xed\x47\xa2\xb4\x37\xa9\xb3\x2c\x64\xbc\x21\xd5\xfa\x2c\x4f\x0d\x49\xd1\x9b\x20\x29\xe2\xa6\x66\x4f\xb6\x62\x40\xfe\xef\xdd\x5f\x6e\xed\xfa\xea\xfa\xa2\xa5\x1e\x8c\x2a\x00\xe7\x82\x6b\xe4\xda\x9b\x2c\x4a\x8c\x41\xe3\x83\xde\x2f\x73\xc2\xf8\x29\xd0\x8c\x48\x85\xfa\xec\x6e\x72\xe9\x1d\x3f\xb5\xb5\x78\x67\x28\xbd\x0b\x4e\x45\xc2\x78\x1a\xc3\xf1\x94\xe9\x8a\x7c\x6e\x24\xc9\xbd\x4b\x21\x0b\x15\x03\x2f\xdd\x4f\x75\x16\x9e\x42\xf5\x79\xf6\x96\xc3\x0f\x67\x10\xbc\x3b\x75\xe6\x7f\x7b\xbf\x21\x47\x59\x71\xbf\x11\x98\x30\x0d\xe1\xc8\x1f\x85\x76\x77\x30\x8c\xa1\xbc\x4f\xf7\x97\x65\xda\xaf\xfe\x8d\x52\x11\x87\x61\x34\x18\xee\x01\xf5\x66\x42\x16\x44\x37\x25\xbf\x90\x52\x48\x90\x48\x2c\xac\xaa\xfd\x76\xd5\x1e\xb8\xe5\x18\x76\x55\xdb\x12\xeb\x2d\x9b\xf0\xa2\xb4\x00\xed\x08\xec\xdf\x9b\x29\x4a\x8e\x1a\x95\x29\x53\x49\x12\xdc\xaf\xff\xd3\xdc\x28\x8d\xd2\x22\x8b\x8e\x57\x03\xfb\x92\xd9\x38\xff\x19\x94\x0b\x1b\xf5\xc3\xed\xb5\x9b\x2a\x89\x4a\x18\x49\x51\xc5\xb0\xfb\x7e\xfe\x1c\xe3\x86\x87\x5e\x66\xcb\x4d\xaf\x85\x61\x61\x9d\x1c\x75\xc1\xba\x14\x86\x27\x10\xb6\xce\xe0\x0b\xd3\x19\xe8\x45\x69\xd3\x01\x8c\xbb\xa1\xd4\x58\x94\x39\xd1\x38\x82\x49\x86\x12\x41\x65\xc2\xe4\x09\x08\x9e\x2f\x60\x8a\x10\xb4\x88\xbf\x97\xbf\x35\x64\x82\xd0\x5f\xcd\x86\x8b\xed\xc2\x67\x64\x8e\x30\x45\xe4\x2f\x09\x7d\x17\x97\x1b\xf5\xd3\x3c\x88\xc2\xfa\xdb\x75\x53\xe0\x07\x5d\x4c\x27\x42\x93\x1c\xa8\x30\x5c\x83\x98\x41\x41\x6c\xf7\xc1\xa7\x6b\xdb\x0c\x09\xe0\x03\x45\x4c\xd0\x7e\x94\x48\xad\xe8\x3a\x4b\xbb\xd7\x32\x7b\x85\x8b\xad\x98\x8c\x3b\x4b\x76\x57\x59\x80\x16\xf0\xc7\xd2\x05\x04\xa3\x68\x14\xda\x8b\x83\x0b\x0d\xca\x94\x56\x98\x31\x81\x99\x14\x05\xcc\x1b\x09\x7b\x3c\xcd\xaf\x74\xb3\xe5\xa8\x1f\x8f\x37\xa7\xf4\x28\xde\xeb\x89\x7d\xa3\xb3\x97\xd3\x24\x8c\x2e\x8d\xae\x1a\xec\xa4\x8b\x04\x3a\xe9\xa1\xee\xce\xe3\x29\x24\x4c\x22\xd5\x42\x2e\xe0\xcd\xae\x7a\xf3\x14\xe2\x06\xa6\x7d\x4a\x1e\xf8\xdd\x9d\x51\xb9\xc5\x07\xa4\xc6\xf9\x6d\x46\xcc\x89\x5f\xad\xd7\x31\xec\xce\x9f\x03\xd9\xe4\xc4\x56\x0d\x1c\x45\xdb\x4d\x70\x14\x6c\x75\x2e\x3c\x0c\x57\xa7\x25\xad\x6e\x4d\xcb\xd2\x34\x1d\x52\xb3\xed\x2a\xce\x5a\xf3\xfe\x02\x85\x87\xab\x91\x94\x44\xaa\x47\x37\x68\x57\x45\x3a\x4d\x96\x11\x4b\x66\xff\x72\xb1\xe4\x3d\x5e\xae\xd7\x58\x9f\x6e\xf7\x34\xcb\xb3\xdb\xbc\x2b\x13\x9d\x26\xdb\xd5\xe7\xa0\xf3\x05\x32\x23\x2c\xc7\xc4\xce\x2b\xe3\x4c\x33\x92\xb3\xaf\x6d\xb2\x9b\x42\x3c\x7f\x8c\x7c\xd3\xa1\x95\x99\x0b\xc6\x51\x6f\xea\x8e\x3a\x53\xc7\xf8\x9c\xe4\x2c\x69\x14\xc3\x4a\x8a\x9d\x17\x2a\x78\xb3\x32\x25\xf4\xbe\x52\x15\xd3\xac\x61\x02\x62\x6a\xdf\xd3\x2d\x87\xd7\xfa\xe9\x6b\xc1\xb1\xdf\xf9\x7a\x11\x92\x66\xa8\xb4\xcb\x8d\x53\x1b\x2b\x86\x86\x2f\xa5\xb0\x05\xb7\xde\xb2\x77\x02\x8e\x0e\xba\xc2\xb7\xfa\x52\x35\x13\x24\x02\x2b\x31\xc6\x07\xa6\x1e\xa5\x66\xad\xe1\xca\x92\x1e\x1f\xf4\x56\xf4\xb0\xf3\x71\x60\xb8\x44\x2a\x52\xce\xbe\x62\x02\x1f\x6e\xae\xea\x47\xbf\xe3\xdd\x82\xea\xb7\xea\x17\x84\xa0\xf3\xce\x58\x90\x22\x5f\x9b\x8b\x5e\xa3\xff\x03\x00\x00\xff\xff\x21\x6c\x1f\x71\x7a\x0e\x00\x00") +var _translationsEn_usLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x6f\xdb\x36\x10\xfe\xee\x5f\x71\x8b\x61\xb4\x45\x23\x47\x92\x93\xd8\x51\x96\x61\x5d\x96\x0c\xd9\x1a\x2c\xc8\x9c\x62\x1f\x06\x0c\x34\x75\x96\x58\x4b\xa4\x4a\x52\x6e\xdc\x5f\x5f\x90\x92\xac\xbc\xd0\x2f\x71\xfa\x21\x10\x43\x1e\xef\x9e\xe7\x5e\xe9\x2e\x5c\xf0\x24\x63\x2a\x05\x2d\x09\x57\x19\xd1\x4c\x70\x05\x53\x21\x81\x50\xe5\x21\x4f\x18\x47\x28\x08\x9d\x91\x04\xfb\x9d\x2e\x9c\x8b\x62\x21\x59\x92\x6a\x78\x7b\xfe\x0e\x42\x3f\x18\x76\xba\x30\x4e\x99\x82\x29\xcb\x10\x98\x82\x98\x29\x2d\xd9\xa4\xd4\x18\x43\xc9\x63\x94\xa0\x53\x04\x45\x72\x84\x8c\x51\xe4\x0a\x81\x28\xbb\xe7\xb6\xf0\x27\x23\x3c\xd1\x8c\x70\xf8\xc8\xe0\xe7\xcf\xcd\x7f\x19\xfb\x35\x15\x3a\x27\x2c\xeb\x53\x91\xff\xb2\x6f\x6d\xf7\x3b\xdd\x4e\xae\x12\x16\xc3\xde\x9e\x59\x28\x2d\xcd\x6a\xef\x46\x8a\xcf\x48\xb5\x77\x15\x7b\x9f\x50\x2a\x26\x78\x64\xac\x55\xc6\xfe\xe3\x7b\x9d\xbd\x5b\x2c\x84\xd4\xde\xb5\xb9\xec\xfd\x56\x26\xca\x1b\x8b\x08\xec\xd1\xcd\xdf\x63\xef\x5c\xa2\x75\x85\xf7\x3b\xd1\x18\x59\x5b\x9e\x3f\xf4\xc2\x23\xf0\xfd\xc8\x3f\x7c\xef\xfb\xbe\x5f\x0b\x7b\xb7\x38\x67\xca\x21\x7b\x08\xc1\x30\x0a\x07\x9e\x3f\xac\x65\x3f\x12\xa5\xbd\x71\xed\x67\x21\xa3\x2d\xa9\xd6\x77\x79\x52\x92\x04\xbd\x31\x92\x3c\x6a\xa2\xf6\xe8\x28\x02\xe4\xff\xdf\xfd\x63\xf7\xae\xaf\xae\x2f\x5a\xea\x41\xbf\x02\x70\x2e\xb8\x46\xae\xbd\xf1\xa2\xc0\x08\x34\xde\xeb\x83\x22\x23\x8c\x9f\x02\x4d\x89\x54\xa8\xcf\xee\xc6\x97\xde\xe8\xb1\xac\xc1\x3b\x45\xe9\x5d\x70\x2a\x62\xc6\x93\x08\x46\x13\xa6\x2b\xf2\x59\x29\x49\xe6\x5d\x0a\x99\xab\x08\x78\x61\xff\x55\x67\xe1\x29\x54\xcb\xb3\xb7\x1c\x7e\x3a\x83\xe0\xdd\xa9\x15\xff\xd7\xfb\x03\x39\xca\x8a\xfb\x8d\xc0\x98\x69\x08\xfb\x7e\x7f\x60\x4e\x3b\xdd\x08\x8a\x59\x72\xb0\x0c\xd3\x41\xf5\xe9\x27\x22\x0a\x07\x27\x9d\xee\x3e\x50\x6f\x2a\x64\x4e\x74\x13\xf2\x0b\x29\x85\x04\x89\xc4\xc0\xaa\xf2\xaf\xa7\xf6\xc1\x6e\x47\xd0\x53\x6d\x4a\x6c\x96\x6c\xcc\x8b\xc2\x00\x34\x45\x70\x30\x2b\x27\x28\x39\x6a\x54\x65\x91\x48\x12\xe3\x41\xfd\xa5\x59\xa9\x34\x4a\x83\x6c\x18\xac\x06\xf6\x35\x35\x76\xbe\x94\x28\x17\xc6\xea\x87\xdb\x6b\x5b\x57\x12\x95\x28\x25\x45\x15\x41\xef\xfd\xfc\x29\xc6\x2d\x2f\x3d\xf7\x96\xad\x5f\x03\xc3\xc0\x3a\x71\xfa\xeb\x52\x94\x3c\x86\xb0\x55\x06\x5f\x99\x4e\x41\x2f\x0a\xe3\x0e\x60\xdc\x56\xa5\xc6\xbc\xc8\x88\xc6\x3e\x8c\x53\x94\x08\x2a\x15\x65\x16\x83\xe0\xd9\x02\x26\x08\x41\x8b\xf8\x47\xe9\xdb\x40\x26\x08\xc3\xd5\x6c\xb8\xd8\xcd\x7c\x4a\xe6\x08\x13\x44\xfe\x9c\xd0\x0f\x51\xb9\x55\x3e\xcd\x83\xe3\xb0\x5e\xdb\x6c\x0a\x7c\x27\xd3\xb1\xd0\x24\x03\x2a\x4a\xae\x41\x4c\x21\x27\x26\xfb\xe0\xd3\xb5\x49\x86\x18\xf0\x9e\x22\xc6\x68\x16\x05\x52\xd3\x75\xad\xa4\x39\x6b\x99\xbd\x42\xc5\x4e\x4c\x06\xbe\x8b\xc8\x5d\x25\x01\x5a\xc0\x5f\x4b\x15\x10\xf4\x8f\xfb\xa1\x99\x1c\x5c\x68\x50\x65\x61\x1a\x33\xc6\x30\x95\x22\x87\x79\xd3\xc2\x1e\x56\xf3\x2b\xd5\xec\x58\xea\xa3\xe3\xed\x29\x3d\xb0\xf7\x7a\x62\x2f\x54\xf6\xbc\x9a\x4c\xbf\x53\x64\x5e\xd1\x08\x0f\x5d\x34\xd0\x36\x1f\x6a\xa7\x1e\x4f\x20\x66\x12\xa9\x16\x72\x01\x6f\x7a\xea\xcd\x63\x90\x5b\x88\xae\xeb\xe5\x41\x70\xb2\x06\x01\xde\x23\x2d\xad\xde\xa6\xc8\x6c\xfb\xab\x3b\x76\x04\xbd\xf9\x53\x20\xdb\xdc\xd8\x29\x85\x8f\x87\xbb\xd5\xf0\x28\xdc\xe9\x5e\x78\x72\xb4\xda\x2d\x49\x35\x37\x0d\xcb\xb2\xc9\x91\x9a\xad\x2b\x38\x1b\xc5\xd7\x07\x68\xe4\x9c\x1e\x95\xea\x82\x48\xf5\x60\x86\xba\x22\xe2\x14\x59\x5a\x2c\x98\xf9\xcb\xc4\x92\xf7\xe1\x72\xbf\xc6\xfa\xf8\xd8\xd9\x48\xd0\x35\xcf\x5d\x9e\x70\x8a\x3c\x67\xaf\x54\x6a\x8c\x1d\x39\x43\x30\x25\x2c\xc3\xd8\x14\xa5\x4d\x7a\x04\x51\x20\x57\x2a\x85\xa2\x9c\x64\x8c\xc2\x0c\x17\x60\x9e\xbc\xe6\x69\xd4\xfb\xd2\x22\x78\xe9\xbd\x95\xb0\x0e\x9d\xf1\x68\xd5\xd7\xe1\x46\x28\x24\x9b\x9b\xaf\xd1\x6c\x8a\x40\xa9\x74\x15\xa4\xcd\x77\x76\xcb\x62\x77\xee\xb4\x76\x19\x67\x9a\x91\x8c\x7d\x6b\x53\xb2\xc1\xf2\xf4\xd1\xf6\xa2\x4b\x2b\xf3\x2b\x38\x0e\xd6\x26\xd8\xd0\x99\x60\x8c\xcf\x49\xc6\xe2\xa6\xb3\x9a\xd6\x6b\x9c\x43\x05\x6f\x76\x26\x84\xce\xaa\xee\x5b\x36\x7b\x18\x83\x98\x98\xdf\x1d\x2d\x87\xd7\xea\x59\x57\xa8\x03\xf7\xbb\x48\x48\x9a\xa2\xd2\xd6\x37\xb6\x27\x9b\xa1\x51\xf2\xe5\xc8\x68\xc1\x6d\x96\x5c\xdb\x27\x46\x43\x97\xf9\xb6\x0b\x57\x25\x07\xb1\xc0\x6a\x68\xe1\x3d\x53\x0f\x5c\xb3\x51\x70\x65\x48\x4f\x46\x6b\x23\x7a\xe4\x7c\x93\x97\x5c\x22\x15\x09\x67\xdf\x30\x86\x0f\x37\x57\xf5\x8f\x23\xcb\xbb\x05\xb5\x5e\x6a\x43\xdb\x1c\xb8\xec\x2e\x48\x9e\x6d\xf4\xc5\x5a\xa1\xef\x01\x00\x00\xff\xff\x14\x2c\x4e\x08\xa4\x0f\x00\x00") func translationsEn_usLc_messagesAcsenginePoBytes() ([]byte, error) { return bindataRead( @@ -153,7 +222,67 @@ func translationsEn_usLc_messagesAcsenginePo() (*asset, error) { return a, nil } -var _translationsZh_cnLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x54\x5f\x6c\x14\xd5\x17\xfe\xda\xee\xaf\xed\x6f\xfd\x8f\x0f\x6a\xd4\x78\x25\xd9\x80\x29\x53\xa7\x25\x29\xb8\x0a\x11\x2b\x98\x62\x2b\x4d\xb3\xa0\x89\x31\x66\x3a\x73\xbb\x7b\x61\x76\xee\x3a\x73\xa7\xb4\x24\x26\x68\x8a\x6d\x43\x4b\x31\x69\x0b\xfd\x6f\x41\x2c\x41\x64\x8b\x7f\x70\x6d\x21\x68\x4c\x4c\x4c\x7c\x37\xbe\xf8\xa0\x3b\xb3\xdb\x27\xde\x7d\x32\xf3\x67\xbb\x6b\xad\x86\x78\x5f\x66\xf7\x9c\xef\xfb\xee\x39\xdf\x39\xb9\xbf\x6e\x89\x4c\x00\xc0\xc3\x00\x9e\x00\xf0\x25\x80\x27\x01\xb4\x57\xc1\x3f\xdf\x56\x01\x04\xc0\x77\x55\x40\x03\x80\xdf\xaa\x80\x03\x00\xee\xaf\x06\xda\x00\x1c\xae\x06\x9e\x03\xb0\x50\x0d\xec\x01\xf0\x4b\x35\xd0\x0a\xe0\x91\x1a\xe0\x69\x00\x6f\xd6\x00\xdb\x01\xbc\x5b\x03\xc4\x00\x7c\x52\x03\x3c\x06\xe0\xa7\xf0\xeb\xd6\x04\xba\x88\x00\x7b\x01\xec\x88\x04\xf7\x1d\x8b\x00\x4f\x01\x18\x89\x04\x75\x5d\x8d\x00\x8f\x03\xf8\x31\x02\xbc\x55\x05\x38\x91\x40\xaf\xb5\x36\xc0\xb1\xda\xa0\x8e\xe1\x5a\xa0\x05\xc0\xf7\xb5\x80\x0c\xe0\x8f\xda\x40\xbf\xa1\x0e\x90\x00\xbc\x5e\x17\xf4\x77\xaa\x0e\xd8\x0a\xe0\x62\x5d\xc0\xff\x21\x8c\xbb\xe1\x37\x52\x0f\x6c\x03\xb0\xb5\x3e\xd0\x3d\x58\x0f\x3c\x0a\x60\xa0\x3e\xa8\x7b\xae\x3e\xe0\x7d\x1d\xc6\x7f\xae\x07\x3c\xcb\xee\x05\x50\x1d\xb4\x83\x5a\x00\x75\x00\xfe\x1f\x58\x89\x07\x51\x3e\xd1\xf0\xbb\x05\xc0\x03\x00\xea\x01\x3c\xe4\xf9\x0a\xe0\x7f\x61\xae\x26\x9c\x8b\x77\xee\x01\x70\x1f\x36\x39\xfb\x4d\x93\x9b\xc4\xa4\x8a\xc6\x8c\x24\xe9\x61\x3a\x25\x31\x6b\x07\xf1\xc3\x71\x12\xb3\x42\xc0\xf1\x94\x97\x79\xc7\xa6\x66\xbf\x87\xdb\xd7\xd5\x41\x7a\x7c\x9e\xc5\x6d\x53\xa5\x56\x9c\xc4\x1a\x7a\x71\x80\xdb\x86\x46\x9a\xcb\x61\x72\x9c\x89\x14\x11\xfd\x19\x4f\x95\x30\x83\x88\x14\x25\x82\xa6\x33\xba\x22\x68\x23\x49\xa4\xa8\x49\x89\x95\xe2\xb6\xae\x11\x6e\xe8\xfd\xa4\x9b\x92\xa6\x50\xc6\xe0\xff\x4d\x27\xa5\xf4\x52\xd2\x4d\xa9\x41\x9a\x90\xe0\x42\xd1\x89\xca\x6d\x43\x10\xde\x43\xd2\x8a\x25\xa8\x49\x8e\x74\x78\xf5\x6a\x84\xf6\xa9\x94\x6a\xd4\xfb\x91\xa1\xaa\xa0\x5a\x80\xf4\x72\x38\x9c\x49\x9a\x8a\x46\x89\xe0\xe4\x55\xbb\x9b\x9a\x06\x15\xd4\x22\x4d\x8d\x2d\x8d\xcd\x84\x59\xc4\xe0\x82\x58\x76\x26\xc3\x4d\x8f\xd6\x63\xf2\x34\xe9\xa5\xa6\xc5\xb8\xe1\x9b\xb6\x39\xbb\x02\x71\x17\x1a\xd4\x37\x5e\x35\xa9\x22\x3c\xcb\x35\x66\x52\x55\x70\xb3\x9f\x6c\x8b\x59\xdb\x2a\x10\xb4\x8f\xaa\xb6\x0f\x29\x19\xe2\x8f\x26\x1c\x65\x9c\xc4\x7a\x43\x60\x92\x1a\xd4\x0c\xc4\xec\x52\x7d\x21\xa3\x42\x2e\xa3\x98\x56\xc5\x2a\x54\xf0\x37\x2c\x89\xcf\xe9\x51\x98\x4e\x35\xaf\x4f\x66\x30\xc1\x14\x9d\x9d\x28\xab\x96\x6e\x0c\x37\x89\x19\xbd\x8a\xce\xb4\x52\x93\x9e\x0b\x5e\xa1\x2a\x37\x4a\x91\x6e\x45\x3d\x16\x18\x61\x97\x62\x54\x23\xbc\xfb\x28\x55\x05\xb8\xa9\xa6\xa8\x25\x7c\x3d\xdf\x03\xcf\x43\xdb\x58\x77\x10\xe5\xf6\x83\x02\x89\xc6\x69\xe0\x32\xed\x63\x96\x80\x6d\x98\x54\xe5\x49\x83\x9d\xa0\x1a\xd9\xd7\xd9\x76\x24\xbc\xd5\xd3\x42\xbf\x92\xd6\xff\x89\xd8\x69\x72\xaf\x02\xa9\x4d\x93\x8e\x94\x06\x14\xed\xa2\xde\xb5\x52\x87\x95\x64\x9a\xf4\x92\x9d\xb4\xa4\x04\x8f\x93\x68\xe7\xa1\x84\xd4\xea\xcf\x8c\x1b\xd2\xcb\xbe\xb5\xcd\x72\xd3\x2e\x49\x6e\x91\xe4\x26\xd2\xbc\x33\xde\x2c\x37\xc8\xb2\x2c\x47\x3b\x0f\x49\x5d\xb4\x97\x59\x9b\xe2\x9a\x5a\xe2\x3b\x65\x49\xde\x25\xcb\xd1\x76\xc5\x12\x52\xc2\x54\x0c\x4b\x0f\x9c\x3c\xc8\x14\x23\x29\x98\x62\x90\x76\x46\x5e\x38\x5a\xfa\xa7\xb3\x17\x53\x5c\xa4\x15\xa6\x37\xaa\x3c\xbd\x37\xda\xae\x18\x49\x5b\x49\x52\x29\x41\x95\x74\x9c\xb4\xa6\x98\x41\x2d\x4a\xb6\x5b\x2c\x9d\xd1\x59\x0f\xa3\xda\x33\xeb\x98\x38\x39\x91\x7a\xbb\xf5\xb5\x68\x47\x5b\xc7\xfe\x72\x8b\x4d\x8d\x72\xb4\x95\x1b\x82\x1a\x42\x4a\xf4\x67\x68\x9c\x08\xda\x27\x9e\xcd\xe8\x0a\x33\x9e\x27\x6a\x4a\x31\x2d\x2a\xf6\x1c\x4e\x1c\x90\x76\x97\x71\x5e\xa1\x3d\xd4\x94\xf6\x1b\x2a\xf7\xb6\x25\x4e\x76\x77\x33\x11\x7d\x43\x7a\xa5\xbc\x0b\x9d\x9c\x6a\x4c\x90\xe6\x46\xb9\xb1\x39\x0a\x77\x72\x30\xbf\x7a\x83\xc4\xac\x3b\x37\x47\xd6\xc6\xa7\x8a\xd9\x6c\x31\xbb\xea\x8c\x4d\xba\xe7\x6e\x38\x83\x2b\x6b\xe3\x53\xfe\xf2\xb8\x0b\x97\x8a\xd9\x0b\xfb\xba\x3a\x8a\x5f\x0d\xb8\x2b\x67\xd7\x93\x77\x6e\x4e\xfb\x4f\x8f\x7b\x79\xd1\x9d\xbb\xed\x8c\x7d\x58\x38\xb3\x9c\xcf\x7d\x9c\xcf\x5d\x29\x5c\x5f\x75\xe6\x4f\xc7\x2c\x52\x98\x1e\x08\x48\xbf\x9f\x7c\xdf\x59\x19\x2f\x66\x2f\x39\x63\x57\xdc\xd9\xe1\x7c\xee\x64\x3e\x77\x25\x64\xba\x9f\x2f\xba\xb3\xc3\x01\xff\x5f\x98\x65\x5a\x3e\xb7\x5a\x9c\x9a\x76\x4f\x2f\xb8\xb3\x2b\xee\xc9\x55\x77\x62\xd9\x7f\x53\x8a\x37\x4e\x15\x6f\x0f\xba\xb3\x0b\xee\xec\x4c\x61\x7a\xc0\x9d\x58\x2e\xcc\x5c\xf3\x5f\x94\xc2\xf0\x90\x3b\x7b\x35\x66\x91\x7c\x6e\xd4\x1d\xcf\xba\x23\xef\x39\xa3\x83\x85\x95\x25\x67\x68\x79\xe3\x0b\x73\x77\xd8\x12\x08\xce\xd0\x8c\xb3\xba\x52\x98\xb9\xe6\xdc\x9a\xf0\xd6\x77\x83\x73\xc3\x4b\xc5\xc5\x91\x75\x97\x49\xac\x97\x84\x2d\x97\x60\x7f\x83\x6c\xcc\x17\x97\x2e\xba\xf3\x67\xd7\xf3\x71\x5f\xa3\x9c\x0d\xc6\x55\x91\xad\x28\x01\xce\xd0\x9c\xb3\x74\xda\x19\x99\x0c\x44\x0b\xe3\x0b\xee\xd0\x59\x67\xea\xf2\x5f\x27\x68\x21\x9f\x3b\xe3\xcc\xcc\xbb\xe7\xb3\x6b\x73\xf3\x41\x67\xce\xc8\x64\x61\x7a\xc0\xc9\x7e\x53\xbc\xbe\xe8\x4d\xe2\xd6\x55\x77\xf4\x42\x61\x7a\x20\xc8\xba\xe7\x3e\x72\x27\x86\x3c\x66\xcc\x22\x6b\xa7\x46\x3d\xc9\xf3\xd9\x7c\x6e\xd4\x19\x3b\x17\x58\x56\x9a\xec\x7a\x5b\x5e\xf2\xb3\xf3\xce\xec\x65\x78\xe4\x2f\x26\x8a\xd9\x0f\x9c\xa1\x4f\x0b\xd3\x03\x9b\xbf\x06\x9b\x11\xff\x0c\x00\x00\xff\xff\x94\xe2\x35\xc2\xf0\x08\x00\x00") +var _translationsEn_usLc_messagesAcsenginePoLcg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6b\xf3\x36\x14\xc6\xef\x5f\x78\xbf\xc3\x99\x20\xf4\x62\x5b\x9c\x64\x5b\xb6\x05\x3b\x25\xa4\x1b\x84\xa5\x5b\x59\xd2\x52\x28\xbd\x50\xa4\x93\x58\xab\x2c\xb9\xfa\x93\x3a\xfd\xf4\x43\x76\xbc\x94\x31\x18\x0c\x89\xdd\xb4\x8e\x9c\x63\x3f\xbf\x73\xac\xf3\x1c\x27\xbf\x6e\x2a\x09\x47\x34\x56\x68\x55\x90\xf1\x70\x44\xae\xe7\x9f\x3f\xe5\xeb\xe5\x23\x6c\x58\x89\x15\x7d\xe8\xcf\x4d\x87\x23\x02\xbf\xd2\x0a\x0b\x42\x99\x45\x75\x10\x0a\x09\xdc\x59\xb3\xe2\x05\x19\x13\xd8\x18\xb6\xf4\xb2\x20\xa8\xbe\xbe\xdf\x10\x68\x2a\xa9\x6c\x41\x4a\xe7\xea\x59\x96\xd9\xf6\x5a\x76\x58\x09\x66\xb4\xd5\x7b\x37\x64\xba\xca\xa4\x66\xd6\x79\x2e\x74\x36\x19\x8d\xa6\xd9\x34\x93\xac\x21\xf3\xcf\x9f\x00\xf2\x95\xc3\x0a\xc2\x9f\xed\xa9\xc6\x82\x8c\x48\xfb\xe1\x7c\xab\xcb\x4d\xd7\x48\xf7\x05\x71\xc6\x63\x17\x07\x90\x6f\x9c\x81\x25\x75\x05\xd9\x62\xe3\xfa\x55\x80\xfc\x81\xca\x79\xfe\xc5\xd3\xf2\x66\xb1\x5d\x3c\xfd\x64\x8c\x36\x60\x90\x72\xa1\x0e\xb0\x17\x12\x61\x60\xbf\x82\x76\x79\x06\x03\xfb\xfc\x3c\xcf\xb3\x10\x71\xbe\x68\xb6\x71\xa6\x3f\xbe\x11\xb6\x86\x15\x0b\x39\xd9\x38\x43\x20\xeb\x14\x67\x41\xe0\xbf\x89\x9f\xc4\x13\xff\x56\x06\xd5\xaf\x1e\xcd\x29\x30\x2c\x7e\xbf\x85\x7d\xcb\x64\xb5\x37\x0c\xed\x0c\x06\x5f\x1e\x53\x71\x7c\x13\x83\xe3\x67\xed\x15\x87\xc9\x45\x32\xbc\x09\x57\x82\x3b\xd5\xa1\x1a\x20\x14\xb8\x12\xc1\x61\x55\x4b\xea\x70\x08\xdb\x12\x0d\x82\x2d\xb5\x97\x1c\xb4\x92\x27\xd8\x21\x8c\x53\x21\x7e\x1b\x0f\x51\xe9\xff\xc6\x58\xd2\x23\xc2\x0e\x51\xa5\xa3\xfc\x2e\x06\xe5\x56\x3b\x2a\x81\x69\xaf\x1c\xe8\x3d\x54\xd4\x3a\x34\xf0\x70\x1b\x9e\x41\x0e\xd8\x30\x44\x8e\xe1\xa0\x46\xe6\x90\x77\xdf\x0c\xe7\x52\x51\x4d\x63\x50\xdd\xd7\x07\x43\x39\x82\xd3\xf0\x8b\xdf\xa1\x51\xe8\xd0\xc2\x78\x38\x1d\x4e\x40\x58\x50\xda\x81\xf5\x75\xad\x4d\x40\xda\x1b\x5d\xf5\x7d\x34\x65\x03\xf9\x3e\x1d\xd9\x07\xf5\xff\x1f\xdf\x0f\x31\xf8\xb0\x6d\x90\xcc\x20\x75\xa1\x35\x72\x61\x90\x39\x6d\x4e\x70\x35\xb0\x57\x29\xd5\xff\x18\x4f\x3d\x36\xc8\x7c\x2b\xbf\x6f\x0e\x6d\x7b\x3f\x5b\xd5\x0c\x06\xc9\x7a\xfb\x78\x14\x8f\xe2\x80\x0a\x4d\x57\x05\xdf\x3f\x74\x67\x9c\x94\x75\x18\x47\x19\x12\x3a\x84\x9a\x1a\xfb\x61\x48\x48\x9a\xf9\x28\xe3\x01\xfe\xd3\x6c\x93\x34\xdb\x51\xa6\x81\x3d\x15\x12\x79\xe8\x49\xed\xc6\x45\xd0\x35\x2a\x6b\x4b\xa8\xfd\x4e\x0a\x06\x2f\x78\x02\xeb\x8c\x50\x87\x19\x0c\x5e\x93\xb1\x44\xb1\xfd\x0b\xcb\x79\x03\x20\xd4\x46\x1c\xc3\xff\x80\x11\x36\xb2\xb5\x65\x52\x8e\x28\xc6\x7e\xe1\x10\x4a\x38\x41\xa5\x78\xbf\x6c\xe0\x9e\x2d\xed\xc4\x3c\x8e\xe2\xe5\x42\x1d\xa9\x14\xbc\x77\xb0\x60\x71\xa1\x08\x4c\xab\x7e\x65\x47\xd9\x4b\xe7\x72\xbe\x5f\x43\x0e\x7a\xf7\x07\x32\x97\x8c\x2d\x8a\x9b\x6b\xc3\x4a\xb4\xae\xad\x44\xeb\x70\xc1\xbd\xbd\xfa\xcb\xbb\x93\xa9\x8f\xe2\xd5\x17\x77\xeb\x1a\x15\x70\x8d\xdd\xf0\x81\x8d\xb0\xe9\x52\x1f\xc5\xaa\xbd\x32\xc8\xf4\x41\x89\x77\xe4\xb0\xb8\x5b\x9d\x5f\x96\xdb\x2a\x24\x7b\x85\x8c\x62\xcf\x27\x5a\xc9\x24\x29\xff\xed\x4d\x21\x5f\xea\xaa\x42\xe5\x6c\x1f\xb6\xac\xdc\xf9\xa7\x83\x35\x6b\x16\xbc\x12\xea\x12\xfa\xf7\x80\x3c\x5b\x2f\x1f\xe7\x7f\x06\x00\x00\xff\xff\xac\xbb\x9e\xdd\x99\x10\x00\x00") + +func translationsEn_usLc_messagesAcsenginePoLcgBytes() ([]byte, error) { + return bindataRead( + _translationsEn_usLc_messagesAcsenginePoLcg, + "translations/en_US/LC_MESSAGES/acsengine.po.lcg", + ) +} + +func translationsEn_usLc_messagesAcsenginePoLcg() (*asset, error) { + bytes, err := translationsEn_usLc_messagesAcsenginePoLcgBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/acsengine.po.lcg", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsEn_usLc_messagesEnUsLclAcsenginePoLcl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x99\x51\x8f\x1a\x37\x10\xc7\xdf\x23\xe5\x3b\x4c\x57\x42\x79\x68\xcb\xc2\xb5\xa5\x2d\x02\x12\x44\x5a\xe9\x54\xd2\x9e\x0a\x39\x45\x4a\xf2\x60\xec\x81\x75\xe3\xb5\x37\xf6\x2c\x07\xf9\xf4\x95\x17\x36\x9c\xd4\x4a\x0d\x9c\xe7\xd4\x97\x3b\xaf\xf7\xbc\x33\xf3\x9b\x59\x7b\xfe\xb7\xa3\xe7\xbb\xd2\xc0\x16\x7d\xd0\xce\x8e\xb3\x7e\xb7\x97\x3d\x9f\x3c\x7d\x32\x9a\xcf\xde\xc0\x42\x16\x58\x8a\xdb\xf6\xde\xa0\xdb\xcb\xe0\x77\x51\xe2\x38\x13\x32\xa0\xdd\x68\x8b\x19\xdc\x04\x7f\xad\xc6\x59\x3f\x83\x85\x97\xb3\xda\x8c\x33\xb4\xdf\xbe\x5e\x64\xb0\xdc\xd0\xfd\xcb\x5d\x69\x6c\x18\x67\x05\x51\x35\xcc\xf3\xd0\x3c\x3a\x74\x4b\x2d\xbd\x0b\x6e\x4d\x5d\xe9\xca\xdc\x38\x19\xa8\x56\xda\xe5\x57\xbd\xde\x20\x1f\xe4\x46\xee\xb2\xc9\xd3\x27\x00\xa3\x6b\xc2\x12\xe2\x8f\xe5\xbe\xc2\x71\xd6\xcb\x9a\x8b\xa3\xe5\x93\x0f\x73\x14\xeb\x71\x46\xbe\xc6\xc3\x3a\x80\xd1\x82\x3c\xcc\x04\x8d\xb3\x25\xee\xa8\x9d\x05\x18\xdd\x0a\x33\x19\x7d\xf5\x76\xf6\x72\xba\x9c\xbe\xfd\xc5\x7b\xe7\xc1\xa3\x50\xda\x6e\x60\xad\x0d\x42\x27\x7c\x03\xcd\xf4\x10\x3a\xe1\xfd\xfb\xc9\x28\x8f\x2b\x3e\x2f\x5f\x6e\xe8\xde\x63\x61\x41\x71\x3c\x77\x32\x83\x69\x55\xf9\x71\x76\xe3\x31\x0e\xdc\x16\xd5\xc9\xe8\xc3\xcd\xe6\xcb\x0d\xb5\x91\xe5\x0b\xf2\xed\xf8\xa5\x0e\x15\x5c\xcb\x98\xa7\x05\xf9\x0c\xf2\x03\xb6\x3c\x52\xfa\x2f\x82\x57\xe9\x08\xde\x15\x31\x86\x8f\x35\xfa\x7d\x8c\x68\xfa\xe7\x2b\x58\x37\x11\x06\x57\x7b\x89\x61\x08\x9d\xaf\xb7\xac\x30\x2f\xf4\x80\x83\xeb\x77\x29\xb8\xfe\xea\x6a\xab\xe0\xea\x14\x00\xdc\x69\x2a\x80\xf6\x55\xac\x15\xd0\x16\xa8\x40\x20\x2c\x2b\x23\x08\xbb\xb0\x2c\xd0\x23\x84\xc2\xd5\x46\x81\xb3\x66\x0f\x2b\x84\x3e\x13\x72\x2e\xe7\x38\xb2\xf1\x7d\xba\x6c\x58\x77\x59\xc4\x85\xd8\x22\xac\x10\x2d\x73\x42\x58\xfc\xe3\xc8\xc9\x0f\x29\x72\xb2\x74\x24\x0c\x48\x57\x5b\x02\xb7\x86\x52\x04\x42\x0f\xb7\xaf\xe2\xab\xae\x00\x77\x12\x51\x61\x1c\x54\x28\x09\xd5\xe1\x2f\xe3\x3d\xa6\x1c\x24\xf4\x87\x83\xf9\x20\x05\xf3\xd7\xd5\xc6\x0b\x85\x40\x0e\x7e\xab\x57\xe8\x2d\x12\x06\xe8\x77\x07\xdd\x2b\xd0\x01\xac\x23\x08\x75\x55\x39\x1f\x03\x5c\x7b\x57\xb6\x2d\x06\xe3\x61\x9a\xd8\x27\x0e\xf6\x3f\xf2\xb1\xbf\x17\xcb\xff\x2c\x03\x0f\xf4\x8c\x23\x0f\x3f\xa5\xc8\x03\x36\xfd\x86\xf4\x28\x28\x76\x1a\x4a\x7b\x94\xe4\xfc\x1e\x9e\x75\xc2\x33\x46\xca\x17\xd8\xe5\x60\xf8\x73\x3a\x86\xb8\x43\x59\x37\xc1\xb4\x07\x53\xd3\xb3\x1d\xfb\xe1\x21\x74\xb8\x5a\xc6\xcb\xcd\x73\x10\xed\xf7\xd2\x21\xdd\xa0\x45\x7f\x28\x90\xba\x7d\x2b\x8f\xc1\xb1\x97\xe6\xd9\xb6\x59\x60\x26\xd1\x85\x87\x80\x2a\xe1\xc3\x3d\x81\xc6\x5e\x90\x5f\x64\x8f\x05\x5a\x12\x29\x88\xff\xa6\x6a\xd9\xab\xee\x8b\xec\xb1\x40\x4b\xa2\xf3\xd6\x42\x1b\x54\xf1\xe8\x6c\x76\x76\x04\x57\xa1\x0d\xa1\x80\xaa\x5e\x19\x2d\xe1\x03\xee\x21\x90\xd7\x76\x33\x84\xce\x47\x26\x92\x0f\x75\x82\x05\x6f\x12\xe1\x76\x8a\xec\xb8\x3b\x21\x54\x5e\x6f\xe3\xef\x18\x54\xdc\xef\x43\x28\x1e\x05\xed\xf9\x0e\xb0\x60\x4d\xa2\xbd\x4e\x51\x69\xab\x49\x0b\xa3\x3f\x9d\x36\xfb\x36\x52\xd6\x7f\xa1\x3d\xc8\x03\x16\xb0\x49\x04\x96\xb6\x5b\x61\xb4\x6a\x5b\xe3\xd8\x3b\xc7\x12\x91\xce\xb6\x33\x2b\x21\x3f\x1c\xda\xe7\xba\x9d\x43\x05\x6e\xf5\x17\x4a\x62\x62\x9d\xda\x29\x16\xfc\x49\x34\x96\xf3\xb2\xc0\x40\x4d\xe9\x34\x7d\x75\x54\x2e\xb5\xfd\xac\x5b\x98\x00\x9f\x6f\x96\x05\x61\x12\x79\x74\xea\xa5\x0f\x07\x32\x28\x87\x07\xf5\x87\x3b\x1d\xb8\x4a\xf4\x6c\xab\x2c\x00\x93\x68\xa3\xda\x7a\x94\x6e\x63\xf5\x27\x54\x30\xbd\xb9\x3e\x7e\x88\x69\xea\x82\x89\xde\x79\x26\x59\xbe\x45\x24\xd1\x40\x7b\x51\x9a\xc7\xad\xbb\xb3\x2c\x5e\x0e\xee\x8f\x3b\x8b\x6a\xe6\xca\x12\x2d\x85\x76\xd9\xac\xa4\xe3\x77\xb9\xb9\xdc\x4d\x55\xa9\xed\x69\xe9\x3f\x17\x8c\x16\x48\x51\x9b\x85\xe3\x9a\x17\xdb\x30\x77\x72\xe9\x9c\x09\x2f\xde\xc9\xda\x7b\xb4\xf4\x4e\xe1\x5a\xd4\x86\xba\x26\x84\x0c\x0e\x49\x9a\xc7\x61\x7c\xec\x28\x9f\xcf\xde\x4c\xfe\x0e\x00\x00\xff\xff\x4f\x29\xb2\x58\x39\x1c\x00\x00") + +func translationsEn_usLc_messagesEnUsLclAcsenginePoLclBytes() ([]byte, error) { + return bindataRead( + _translationsEn_usLc_messagesEnUsLclAcsenginePoLcl, + "translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", + ) +} + +func translationsEn_usLc_messagesEnUsLclAcsenginePoLcl() (*asset, error) { + bytes, err := translationsEn_usLc_messagesEnUsLclAcsenginePoLclBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x58\x6d\x6f\xdb\x36\x10\xfe\x5e\xa0\xff\xe1\xa6\x01\x45\x8b\x95\x12\x29\x3b\x7e\x51\xec\x74\x9d\x9b\x64\x19\x92\xc6\xa8\x9d\x2e\x1f\x04\x04\x8c\x74\x91\xd9\x48\xa4\x40\x52\x41\xb2\x5f\x3f\xc8\x56\x64\x6f\x75\xda\x24\x76\xf4\xc1\x96\x44\x91\x77\xcf\xbd\xf2\x11\x07\x1f\x6e\xb3\x14\x6e\x50\x1b\xa1\xe4\xd0\x61\x2e\x75\x3e\xec\xbd\x7e\x35\x38\x1e\x9d\xc3\x24\x9a\x61\xc6\xbf\xde\xbf\xeb\xb8\xd4\x81\xcf\x3c\xc3\xa1\xc3\x23\x83\x32\x11\x12\x1d\x18\x1b\x7d\x14\x0f\x1d\xe6\xc0\x44\x47\xa3\x22\x1d\x3a\x28\xc9\xd9\xc4\x81\xdb\x2c\x95\x66\xe8\xcc\xac\xcd\x03\xcf\x33\x73\x59\xc6\xcd\x44\xa4\x95\x51\x57\xd6\x8d\x54\xe6\xa5\x2a\x32\xb6\x88\x85\xf2\x7c\x4a\x3b\x5e\xc7\x4b\xa3\x5b\x67\xef\xf5\x2b\x80\xc1\x91\xc5\x0c\xca\xbf\x85\xf4\xf9\x20\xc0\x60\xac\x55\x6e\xaa\x07\x80\xc1\xc4\xea\x0a\xd2\xf8\xf4\xe2\x04\x2d\x8f\xb9\xe5\xd4\x81\xaf\x3c\x1d\x3a\xbf\x06\x90\x5f\x27\x5e\x0d\xd6\x5b\x5c\xdc\x44\x05\x7e\xab\xef\x80\xf7\x13\x39\xec\x5e\xce\x7b\x88\xc8\x95\xd2\x19\xb7\xcb\x45\x03\x6f\x09\x65\xe0\x95\x40\xd7\xe0\xf6\x37\xc1\xad\x72\xd4\xdc\x0a\x25\x8d\x77\x5d\x5c\xa2\x96\x68\xd1\x14\x79\xa2\x79\x8c\x5e\x75\x8d\xd2\xc2\x58\xd4\xa5\x49\x5d\xd6\x84\x45\xad\xed\x44\xc2\x6a\x2e\x4d\x09\xa0\x44\xde\x6f\x24\x16\xed\x17\x40\xce\x7c\xbf\x09\xe8\x3b\x2f\x96\x46\x37\xac\xe3\x57\xf7\xf3\x24\x62\xb4\x11\x83\x3a\x8d\x19\xd4\xa2\x4d\xd8\xd3\x6d\xb0\xce\x7b\x9d\x26\x2c\xea\x6d\xa7\x5a\xae\x44\x8a\x86\xdf\x2c\x90\xfb\xed\x26\x90\xf7\xb7\xbd\x57\x30\xd6\x6f\x04\x38\xa3\x8d\x55\x45\xa7\xfb\x04\x83\x9e\xd3\x46\x7a\x8f\x68\x23\xfe\x06\x0a\xfc\xfe\xce\xcf\x15\xb4\x36\x0f\xc9\xd6\x89\x07\x63\xbd\x46\x76\x3b\xb6\x11\xf5\xe0\xb9\x28\x7f\xa9\xaa\xfd\xdd\xae\xc7\xab\x30\xfc\xf7\x75\x23\x5d\x96\x6d\x89\x7c\x18\x33\x2b\x41\xef\x3c\x22\x85\xb6\x00\x7a\x4b\xbc\xa3\x02\xdd\x6e\x26\x7b\x9a\x63\x1c\x7e\x43\xf5\xb0\x11\xe5\xf8\xae\x1e\x58\x87\xfd\xb0\x20\xba\xcd\x14\xc4\x46\xbc\x63\x5d\x7b\x6a\x35\x43\x68\xd9\x96\xe8\xc5\x4a\x5f\xed\x3d\x65\x4b\x7b\x3e\xf0\xcd\xd8\xc5\xff\xd3\xa8\xdf\xfb\x61\x16\xed\x34\xf2\x49\xe7\x6f\xc4\x3b\x1e\xd8\xe4\x5a\x2f\x84\x7c\x15\xe1\x8a\xd8\x91\xca\xef\xb4\x48\x66\xf6\x4f\x2c\x9d\x57\x63\x84\x7d\x99\xa4\xc2\xcc\x60\xfe\xd9\x96\x2e\xba\x12\x5c\x29\x0d\x3c\x32\x64\x81\x18\x72\x1e\x5d\xf3\x04\xdd\x15\xed\x0f\x4a\xae\x41\x43\xfd\x02\xde\x8e\xde\x81\x4f\x59\xf7\x31\xeb\x6b\xd2\x03\xd3\x99\x30\x50\xf2\x63\x10\x06\x62\x61\xac\x16\x97\x85\xc5\x18\x0a\x19\xa3\x06\x3b\x43\x30\x3c\x43\x48\x45\x84\xd2\x20\x70\x33\x1f\x7b\x26\xee\x9a\x0b\xc1\x5f\x82\xcb\xc4\x0a\x2e\xe1\x58\xc0\x9b\xd4\xee\x7e\xbb\x1f\x48\xc5\xef\x33\x65\x33\x2e\x52\x37\x52\xd9\x9b\xc4\xee\xbe\x9f\xdb\xb5\x5e\xc1\x81\x56\xd9\x81\x48\xb1\x12\xfc\x29\x08\x0f\xd5\xdf\x4a\x5f\x87\x46\x47\x61\x22\xec\xac\xb8\x2c\xc5\x84\x1f\xff\x29\x34\x86\x4b\xd8\xe1\x6a\x28\x42\x94\x17\x67\x93\xf0\x78\x74\x71\xb2\x3f\x99\x7c\x3c\xdc\x9f\x84\x75\x42\xb9\xb9\x7a\x50\xf1\x17\xcc\x95\x11\x56\xe9\xbb\x4a\xfd\xca\x89\xd4\x9a\x25\xe3\xd3\x8b\x85\x1b\xaa\xd9\x63\xad\xbe\x61\x64\xc9\x51\x4c\xaa\xe3\xad\x00\x6a\x09\xa1\x2c\xa5\x6b\x4b\x4e\x4c\x22\x62\xf2\x47\x91\x18\x32\x55\x01\x84\x72\x7c\x3a\x25\x23\x8d\x73\xe8\xe4\x13\xb7\x18\xcc\xfd\x43\x68\x97\xf8\x3b\x40\x69\x40\xdb\xbf\x51\x4a\x69\x39\x93\x7c\xc1\x1b\x61\xd6\x4c\x6c\x03\xeb\x06\x7e\x8b\xd0\x6e\x39\xf1\x98\x1b\x4b\xa6\x95\x47\x94\x0e\x9e\x14\x9e\x72\xb9\x4c\x0a\x9e\x20\x99\x22\xcf\x82\xfb\x6c\x5f\x8e\x07\xb0\x70\xb0\x3c\x39\x3a\xd9\x5f\xda\xca\x5c\x1a\xca\x91\x92\x16\xa5\x25\xd3\xbb\x1c\x03\xb0\x78\x6b\xbd\x3c\xe5\x42\xee\x42\x34\xe3\xda\xa0\x1d\x9e\x4d\x0f\x48\x6f\x65\xe2\xfc\xe8\x03\x35\xd9\x97\x91\x8a\x85\x4c\x02\xe8\x5d\x0a\x1b\xca\x71\x5a\x68\x9e\x92\x03\xa5\x33\x13\x80\xcc\xe7\x8f\x66\xe8\xef\xc2\xe2\x76\xf8\x56\xc2\x2f\x43\x60\xef\x76\x43\x79\x4e\x0e\x51\x96\xfc\xa0\x34\x76\xac\x30\x16\x16\x7c\x97\xba\xad\x50\xae\x0d\xdd\xe7\x85\x70\x53\x45\xae\xde\x9e\x96\x0d\x62\xe0\x1d\x8f\xce\xf7\xfe\x0d\x00\x00\xff\xff\xeb\x49\x8e\x42\xc9\x14\x00\x00") + +func translationsEn_usLc_messagesEnUsMetadataAcsenginePoXmlBytes() ([]byte, error) { + return bindataRead( + _translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml, + "translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml", + ) +} + +func translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml() (*asset, error) { + bytes, err := translationsEn_usLc_messagesEnUsMetadataAcsenginePoXmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsZh_cnLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x54\xdf\x6f\x13\xd9\x15\xfe\x92\x38\x24\x71\x7f\xd3\x22\xb5\x6a\xab\xde\x56\x72\xa1\xa5\xe3\xda\x69\x4b\xa8\x5b\x10\x34\x85\x2a\x2d\x29\x51\x64\x50\x5f\x2a\x3a\x99\xb9\xb1\x2f\x8c\x67\xcc\xdc\x19\x93\xa4\x52\x15\x50\x20\x89\x48\x08\xad\xf2\x83\x24\x4e\xd2\xd0\x86\x20\x1a\x70\xa0\x2a\x72\x13\x10\x2f\x55\x5f\xf6\x69\xff\x81\xd5\xae\xf0\x8c\x1d\x69\x57\x3c\xef\xd3\xae\xee\x8c\x7f\x6d\x36\xbb\x42\x3b\x2f\xd7\xbe\xe7\xfb\xce\xfd\xce\x77\x8e\xce\x5b\xfb\x03\x33\x00\x70\x00\xc0\xb7\x00\xfc\x0f\xc0\xb7\x01\x68\x0d\xf0\xbe\xb7\x1b\x00\x02\xe0\x9d\x06\xe0\x30\x80\xc6\x46\xe0\x34\x80\x70\x23\xd0\x05\xc0\x6e\x04\x7e\x0e\xe0\x45\x23\x70\x0c\xc0\xfb\x8d\x40\x27\x80\x8e\x26\xe0\xbb\x00\xfe\xdc\x04\x1c\x02\xb0\xd4\x04\x84\x00\xfc\xbf\x09\xf8\x06\x80\x77\xcb\xe7\xbe\x00\x10\x06\x40\x02\xc0\x0f\x01\x9c\x0d\xf8\xef\x0c\x05\x80\xe3\x00\xee\x05\xfc\xf7\x9d\x00\xf0\x1d\x81\x6f\xf6\x75\x7e\xbf\x19\xf8\x26\x80\xce\x66\xe0\x8f\x0d\xc0\x85\x66\x3f\xff\xf3\x7d\x3e\xee\xe5\x3e\x5f\x57\x53\x0b\x70\x04\xc0\xb1\x16\x20\x02\xc0\x6a\xf1\xf3\xaf\xb5\x00\x12\x80\x37\x5b\xfc\x7a\x3f\x68\x01\xbe\x27\x6a\x6f\xf5\xf9\x27\x5a\xfd\xfb\x3f\x95\xcf\xbf\xb4\xfa\x3a\xb3\xad\x7e\x5d\x6f\xb4\x02\x07\x01\xbc\xd7\xea\xbf\x73\xa0\x0d\xf8\xba\xd0\xdf\xe6\xd7\x95\x6c\xf3\xf3\x5c\x2b\xdf\xdf\x6d\x03\x84\xa5\x9f\x17\x1e\x02\x08\x88\x5a\x00\xb4\x00\x68\x03\xf0\x25\x00\xfb\x51\xfb\x82\xe5\xf3\x6b\x00\xbe\x02\xa0\x15\xc0\x57\x01\x7c\x11\x40\x33\x80\x2f\x8b\xda\xca\x7d\x13\xdf\xe7\x00\x7c\x01\x7b\x7c\xa7\x4c\xd3\x30\x89\x49\x65\x95\xe9\x09\xd2\xcf\x34\x4a\x42\xfc\x47\xc4\xbb\x8e\x91\x10\x2f\x03\xae\x24\x45\xe4\xb2\x4d\xcd\x41\x81\x3b\xd9\xdb\x4d\xfa\x3d\x1e\x37\x6c\x53\xa1\x3c\x46\x42\x87\x33\x38\x6d\xd8\xba\x4a\xda\x6b\xd7\xe4\x0a\xb3\x92\xc4\x1a\x4c\x8b\xac\x84\xe9\xc4\x4a\x52\x62\xd1\x54\x5a\x93\x2d\x1a\x26\xf1\x24\x35\x29\xe1\x49\xc3\xd6\x54\x62\xe8\xda\x20\xe9\xa3\x24\x5a\x4e\xa3\x1b\x9f\x2d\x4f\x52\xce\x50\xd2\x47\xa9\x4e\xa2\x88\x1b\x96\xac\x11\xc5\xb0\x75\x8b\x18\xfd\x24\x25\x73\x8b\x9a\xe4\x7c\xb7\xd0\xab\x12\x3a\xa0\x50\xaa\x52\xf1\x23\x4d\x15\x8b\xaa\x3e\x52\xc4\x70\x2e\x9d\x30\x65\x95\x12\xcb\x20\xbf\xb3\xfb\xa8\xa9\x53\x8b\x72\x12\x0d\x1f\x09\xb7\x13\xc6\x89\x6e\x58\x84\xdb\xe9\xb4\x61\x0a\x5a\xbf\x69\xa4\x48\x86\x9a\x9c\x19\xba\x67\xda\xde\xec\x3a\xc4\x6b\xe4\xa0\x9e\xf1\x8a\x49\x65\x4b\x58\xae\x32\x93\x2a\x96\x61\x0e\x92\x83\x21\x7e\xb0\x0e\x41\x07\xa8\x62\x7b\x90\x8a\x21\x5e\x6b\xca\xad\x8c\x91\x50\xa6\x0c\x4c\x50\x9d\x9a\x7e\x32\xbb\xa2\xaf\xcc\xa8\x4b\x97\x96\x4d\x5e\x37\x0a\x75\xfc\x5d\x43\xe2\x71\xfa\x65\xa6\x51\x55\xd4\xe9\x09\xa5\xc4\x48\x53\x9d\xf3\x24\x49\xdb\x7d\x1a\x53\xc8\x25\x3a\x48\xb8\x65\x32\x3d\x11\x23\xa1\xcb\x75\xf0\xb2\x18\x4a\xd2\x26\xcb\x88\x53\x20\x85\x6e\xce\x93\xbb\xa0\x4c\x67\x16\x93\x35\x36\x54\xd3\x5b\xa1\x97\x67\x94\xe9\x19\x59\x63\x6a\xc5\x3e\xe1\xaf\x48\xa5\x18\x7a\xe5\xa6\x4f\x56\x2e\xf9\x16\xdb\x95\x3b\xaa\x12\xa3\xef\x22\x55\x2c\x18\xa6\x92\xa4\xdc\xf2\xf2\x79\xee\x8a\xee\xd8\x7a\xb5\x37\xa8\x19\xeb\x97\x4e\x54\x83\xfa\xfd\xa3\x03\x8c\x5b\xb0\x75\x93\x2a\x46\x42\x67\x43\x54\x25\x27\x7b\xba\xce\x97\x5f\x15\xb9\x30\x28\xa7\xb4\x4f\x22\xf6\x98\x86\x50\x20\x75\xa9\xd2\xf9\x4a\xeb\x83\xbd\x54\x3c\x2b\x75\xf3\x04\x53\xa5\x5f\xd9\x09\x2e\xc5\x8d\x18\x09\xf6\x9c\x8d\x4b\x9d\xde\x34\x18\xba\xf4\x6b\xaf\x69\xed\x91\x68\x87\x14\xe9\x90\xda\x7f\x46\x22\x91\x58\x34\x7a\x38\x12\x89\x44\x82\x3d\x67\xa5\x5e\x9a\x61\x7c\x0f\xdc\x4f\x49\xb4\x23\xd6\x1e\x95\x22\x1d\x91\x48\xf0\x8c\xcc\x2d\x29\x6e\xca\x3a\xd7\x7c\x27\x7f\xcb\x64\x3d\x61\x31\x59\x27\x67\x18\xf9\xe5\xc5\xca\x3f\x8d\x9d\x48\x1a\x56\x4a\x66\x5a\x58\x31\x52\xc7\x83\x67\x64\x3d\x61\xcb\x09\x2a\xc5\xa9\x9c\x8a\x91\xce\x24\xd3\x29\xa7\xe4\x10\x67\xa9\xb4\xc6\xfa\x19\x55\x7f\x50\xc5\xc4\xc8\x50\xf2\x42\xe7\xef\x83\xdd\x5d\xdd\xa7\x6a\x25\x46\xc3\x91\x60\xa7\xa1\x5b\x54\xb7\xa4\xf8\x60\x9a\xc6\x88\x45\x07\xac\x1f\xa7\x35\x99\xe9\xbf\x20\x4a\x52\x36\x39\xb5\x8e\x9d\x8b\x9f\x96\x8e\xd6\x70\x42\x68\x3f\x35\xa5\x53\xba\x62\xa8\xde\x40\x1d\xed\x63\x56\xf0\x0f\xd2\x6f\x6a\xb3\xd0\x63\x50\x95\x59\xa4\x3d\x1c\x09\xff\x24\x08\x77\x76\xb4\xb0\xfd\x94\x84\xf8\xab\x67\x13\x3b\xd3\xf3\xa5\x5c\xae\x94\xdb\x76\xa6\x66\xdd\xb9\xa7\xce\xe8\xd6\xce\xf4\xbc\x37\x3c\xee\xca\x5a\x29\x77\xf7\x64\x6f\x77\xe9\x3f\x23\xee\xd6\xed\x6a\xf0\xd5\xb3\x05\x6f\xa9\xb9\xf7\x57\xdd\xa5\x17\xce\xd4\x5f\x8b\xb7\x36\x0b\xf9\x7f\x16\xf2\x0f\x8a\x8f\xb7\x9d\xe5\x9b\x21\x4e\x8a\x0b\x23\x3e\xe9\xe5\xf0\x35\x67\x6b\xba\x94\x5b\x73\xa6\x1e\xb8\xd9\xf1\x42\x7e\xb8\x90\x7f\x50\x66\xba\x4f\x56\xdd\xec\xb8\xcf\xff\x14\x66\x8d\x56\xc8\x6f\x97\xe6\x17\xdc\x9b\x2b\x6e\x76\xcb\x1d\xde\x76\x67\x36\xbd\x6d\x55\x7a\x7a\xbd\xf4\x62\xd4\xcd\xae\xb8\xd9\xc5\xe2\xc2\x88\x3b\xb3\x59\x5c\x7c\xe4\xed\xaa\xe2\xf8\x98\x9b\xdd\x08\x71\x52\xc8\x4f\xba\xd3\x39\x77\xe2\xaa\x33\x39\x5a\xdc\x5a\x77\xc6\x36\x77\xef\xae\xd7\xc3\x56\x40\x70\xc6\x16\x9d\xed\xad\xe2\xe2\x23\xe7\xf9\x8c\x18\xdf\x5d\xce\x8d\xaf\x97\x56\x27\xaa\x2e\x93\x50\x86\x94\x4b\xae\xc0\x3e\x06\xd9\x1d\x2f\xad\xff\xc3\x5d\xbe\x5d\x8d\xc7\xbc\x1c\xb5\xa8\xdf\xae\xba\x68\x9d\x04\x14\xa7\x57\xdc\xb1\xdb\xd5\x8d\xe3\x5c\xdf\x70\x9e\x0d\x3b\xb9\x1b\x3b\x7f\x5b\x73\x1e\xce\x15\x37\xee\x15\xf2\x4f\xaa\x6a\x2f\x57\xe0\x02\x5a\x5c\xbf\x2a\x5a\xe2\x43\x6b\x08\x67\x6c\xc9\x59\xbf\xe9\x4c\xcc\xfa\x2a\x7d\x82\x33\x7f\xff\xa3\x23\xc1\x51\xc8\xdf\x72\x16\x97\xdd\x3b\xb9\x9d\xa5\x65\xdf\x2a\x67\x62\xb6\xb8\x30\xe2\xe4\xfe\x5b\x7a\xbc\x2a\x5a\xfb\x7c\xc3\x9d\xbc\x5b\x5c\x18\xf1\xa3\xee\xdc\xdf\xdd\x99\x31\xc1\x0c\x71\xb2\x73\x7d\x52\xa4\xbc\x93\x2b\xe4\x27\x9d\xa9\x39\xbf\x07\x95\x51\xa9\xfa\x24\x82\x0f\xef\x38\xd9\xfb\x10\xe4\x7f\xcf\x94\x72\x37\x9c\xb1\x7f\x15\x17\x46\xf6\x5e\x2f\x7b\x11\x3f\x0c\x00\x00\xff\xff\xde\xb6\x6a\xfc\xbb\x09\x00\x00") func translationsZh_cnLc_messagesAcsengineMoBytes() ([]byte, error) { return bindataRead( @@ -173,7 +302,7 @@ func translationsZh_cnLc_messagesAcsengineMo() (*asset, error) { return a, nil } -var _translationsZh_cnLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x56\x6d\x4f\x1b\xc7\x13\x7f\xcf\xa7\x18\x81\xac\x24\x4a\xce\xd8\x26\x31\xe4\xfe\x0f\x6a\x4a\x93\x2a\x6d\x68\x11\x72\xa2\xbe\xa8\x54\x1d\x77\xe3\xf3\x86\xf3\xee\x75\x77\x8f\x40\x5e\xa5\x15\x29\xa0\x40\x48\x25\x1e\xc2\x43\x20\xa4\x8d\x88\xd2\x34\x26\xad\x1a\x51\x48\x94\x0f\x53\xdf\xd9\xbc\xca\x57\xa8\xf6\xce\x36\x06\x0e\x93\xa2\xbe\x40\x5e\x76\x67\x6f\x7e\xf3\x9b\x99\xdf\x6c\x07\xf4\x16\x08\x45\x81\x20\xb9\x41\x85\x63\x48\xc2\xa8\x80\x3c\xe3\x60\x98\x02\xa9\x4d\x28\x82\x6b\x98\x43\x86\x8d\xc9\xb6\x0e\xe8\x65\xee\x28\x27\x76\x41\xc2\xe9\xde\x33\x90\x49\xa5\xbb\xdb\x3a\x20\x57\x20\x02\xf2\xc4\x41\x20\x02\x2c\x22\x24\x27\x83\x9e\x44\x0b\x3c\x6a\x21\x07\x59\x40\x10\x46\x11\xc1\x21\x26\x52\x81\x60\x88\x70\x2f\xd6\xc1\x67\xc4\xa0\xb6\x24\x06\x85\x6b\x04\xfe\x7b\xb3\xfe\x9f\x43\x3e\x2a\x30\x59\x34\x88\x93\x34\x59\xf1\xff\xe7\x42\xd7\xc9\xb6\x8e\xb6\xa2\xb0\x89\x05\xed\xed\x6a\x21\x24\x57\xab\xf6\x7e\xce\x6e\xa2\x29\xb5\xab\x96\x76\x03\xb9\x20\x8c\xea\xf0\x35\x6d\x6f\x6b\x1f\x40\x97\x71\xa9\xf5\xa9\x3b\xda\xc7\x9e\x2d\xb4\x1c\xab\x1d\xf5\x7f\x99\xd3\x7a\x39\x86\xf1\x6b\x9f\x18\x12\xf5\xd0\x85\x96\xca\x6a\xa9\x34\x64\xba\xf4\x4c\xea\x6c\x2a\x95\x4a\xd5\x8c\xb5\x01\x1c\x26\x22\xd6\x36\x9d\xd5\xbb\x52\x5a\xaa\xbb\x66\x7b\xcd\x10\x52\xcb\xd5\xc8\x65\x5c\xff\xc0\x08\x6b\x77\xa9\xed\x19\x36\x6a\x39\x34\x8a\x7a\x23\x55\xa7\x05\x29\xba\x0e\xc9\x13\xb4\xce\xec\xb3\xd3\xe1\x76\xe1\x9b\xde\x2f\xc2\xbd\xbe\xab\x7d\x97\xf7\xc2\x4f\x27\x23\x34\xbd\x8c\x4a\xa4\x52\xcb\x8d\xba\xa8\x83\xc4\x11\xd9\xe9\x3a\x06\xa1\xff\x01\xb3\x60\x70\x81\xf2\x7f\xd7\x73\x57\xb4\x9e\xfd\xb6\x0a\x7c\x1e\xb9\x76\x99\x9a\xcc\x22\xd4\xd6\xa1\x67\x90\xc8\xd0\xe6\x2b\xed\x53\xa4\xc8\xa3\xc8\xfa\x19\x5a\x44\x42\x26\x99\x4a\x66\xd4\x69\x5b\x87\x0e\xee\x90\xdd\xd9\x48\x74\x67\xf4\x93\xb4\x99\x9e\xc9\x64\xdb\x3a\xce\x81\xa9\xe5\x19\x2f\x1a\xb2\x9e\xc7\xcb\x9c\x33\x0e\x1c\x0d\xe5\x27\xaa\xa9\x84\x38\x07\xe1\xb6\x0e\x09\xb1\x97\xe7\x60\x7e\xbc\xbc\xf3\x1a\x12\xe2\xfd\x9b\xa9\xdd\xd9\xc5\x6a\xa9\x54\x2d\xed\xf8\x33\xf3\xc1\xc2\x6b\x7f\x7c\x7b\x77\x76\x31\x32\xaf\x63\x60\xae\x42\xa9\x8a\xbb\x73\xc8\x1b\x44\x4e\x51\xa2\xf0\x5c\x9b\x1b\x16\x76\xd6\x7e\x4d\xc7\x13\x12\xb9\x82\x97\xed\x39\x1a\xdd\xad\x82\x82\xf5\xad\x87\x7c\x54\x81\xbc\x34\xd0\x17\xf6\x0b\x47\xc1\x3c\x6e\xa2\xd0\x21\x71\x76\xb8\x09\xe8\xda\xd3\x6a\xe9\xc9\xa5\x81\xbe\xea\x1f\x63\xc1\xf6\x83\x06\xbe\xf7\x6f\x96\x22\xc3\xc3\x34\x85\xbd\xa8\x5c\x2b\x28\x17\xbb\xe3\xa0\x5c\x61\x1e\xb5\x20\xb3\xe7\x15\x6e\x11\x59\x00\x39\xea\x2a\xc6\x80\xd0\xb0\xc5\x24\x16\x5d\xc7\x90\x98\x84\x5c\x01\x39\x82\x28\x30\xcf\xb1\x80\x51\x67\x14\x06\x11\xd2\x4d\x28\x9f\xad\x07\x8f\xde\xf9\x33\x3f\x56\xee\x6f\x96\xb7\x7e\x2e\x6f\x3d\xaf\xbc\xda\xf1\x57\xef\x25\x04\x54\x96\xc6\x22\xe8\x7f\xdd\xf9\xde\xdf\x9e\xad\x96\x9e\xfa\x33\xcf\x83\x95\xc9\xf2\xd6\x9d\xf2\xd6\xf3\x63\xf1\xa7\x33\xa9\xa3\x03\xa0\xec\x64\x11\x14\x8c\x61\x84\x41\x44\x7a\x38\x86\xe0\xb7\xf5\x60\x65\x32\x8a\xa4\x45\x0c\x31\x01\xb4\xac\x91\xe1\x74\x36\x53\x5b\x87\x15\x92\x4e\xa5\xe3\xc2\xca\x31\x69\x38\x60\x32\x8f\x4a\x60\x79\x28\x1a\xaa\xa2\xe0\x46\x9f\xaa\x0a\x0b\x70\xc4\x44\xb4\x50\x2d\x5c\x34\x95\x44\x86\x96\xea\x6c\x2f\x8c\xf2\xd6\x4e\x75\x71\x29\xb8\xb7\x16\xac\x6c\x07\x77\x76\x82\xb9\xcd\xf0\x6e\xf5\xf5\xdd\xea\xbb\xf1\x60\x65\x2d\x58\x59\xae\x2c\x8d\x05\x73\x9b\x95\xe5\x97\xd1\xcd\x13\x05\xd0\x15\x9b\x96\xeb\x91\x05\x48\x06\x9f\x37\x3e\x01\xe9\x64\x36\x99\x51\xea\x4e\x99\x04\xe1\xb9\x4a\x46\xd1\x82\x3c\x67\x45\x18\xae\x6b\x4c\x73\x77\x56\x26\x27\x82\x95\x17\x09\x01\xe5\xad\xe9\x60\xb6\x14\x4c\x7d\xe7\x4f\x8f\x57\xb6\x37\xfc\x89\xcd\x83\x9f\x3d\x71\x8f\xf6\x74\x7d\x78\x00\x4d\x20\xff\xf5\x30\xea\x46\x71\x9d\xc0\x3c\xe9\x7a\x32\xaa\x97\x8b\x71\x70\x31\x94\x14\x33\x9c\x3c\xd4\x06\x8b\x70\x34\x25\xe3\xa3\x70\x2a\x21\x4e\xed\x07\xe3\x4f\x2c\xfb\x3b\xdb\x95\xe5\x97\xfe\xdb\x39\x15\xc7\x11\x4a\x17\xa7\xb6\xe9\x54\x7c\xb6\x23\xef\x38\x82\xa6\x17\xba\xaf\x77\x5b\x28\x68\x35\xf5\xd5\x21\xd1\xac\x66\x93\x1b\xd5\xf5\xa9\x86\xf8\x42\x62\x18\x6a\x6d\x57\x47\x73\xc2\x72\xcc\x66\x4f\xd6\x86\xd9\xf4\x89\xee\x65\x2e\x64\x8e\x26\xc4\x8e\x66\x9a\x62\xc4\xab\x97\x53\x8d\x99\x03\x43\xe8\x00\x1b\x47\x52\x11\x9f\x94\xcc\x85\xa3\x31\xb8\x06\x17\x4d\x33\x70\x7f\x16\xaa\x1b\x3f\x05\xab\x0f\x1a\x7e\xf5\x30\x0d\x31\x5e\x5d\xa2\xfe\x1c\xd6\x88\xba\xab\xb1\x5f\x0b\x6c\xff\x71\x8b\x22\x39\x30\x93\xf7\xf3\x50\x1b\xbd\x4d\x78\x44\x1c\x9e\x7f\x96\xa1\xf3\xb1\x2f\x84\xbc\x41\x1c\xb4\x54\x7b\x13\x4a\x24\x31\x1c\x72\x7b\x2f\x3b\xf5\xcc\x1d\x7c\x2c\xf8\x13\x8f\xfc\x8d\x7b\xfe\xd4\x7c\x94\xa0\xca\xec\x5a\x30\xf1\xc0\x5f\x7c\xb6\x7f\x18\x8b\x16\xcc\xa5\xbb\xb2\x2d\xa9\xeb\x8e\xa5\x8e\xd0\x61\xc3\x21\x56\x5d\x5c\x14\x2d\xaa\xb3\x4c\x46\xeb\x3b\x83\x86\x39\x14\x09\x90\x57\xdf\x43\x0b\xd8\xa0\x7a\xc0\x36\x8f\x84\xfb\xfe\xf2\x6a\xf0\xb0\xb4\xfb\x68\x35\x92\x1b\x7f\x6a\xbe\xb2\x34\xe6\x97\xfe\xac\xbe\x5a\x57\xc3\xed\xed\x8b\x60\xfa\x49\x65\x69\x2c\x3a\x0d\x16\x1e\x07\x73\x13\xc7\xca\x42\x57\x2a\xf6\x6d\xc1\xb8\x59\x40\x21\x43\x1e\x43\x1d\x52\x92\xe9\xd1\x86\x60\xee\xe1\x4a\x08\xd8\xbd\x3b\xad\x88\x7c\x58\x2a\x6f\x4d\xfb\x33\x0b\x91\x4a\x1e\x53\xf8\xdd\xe7\xe3\xdc\xee\x89\x4f\x54\x62\x60\x31\x8c\xa4\x1a\x47\x88\x90\x87\xe6\x7c\xa3\xeb\x94\xe7\x5f\x1f\xfa\x2b\xcf\x5a\xe4\xaf\xe7\x7c\xcb\xf4\x5d\x88\x1d\xe6\x1e\xe5\x68\x32\x9b\x92\xdb\x68\xc1\xa5\xfe\xab\xb5\xe7\x74\xc8\x49\x13\x9c\x85\xc7\xc1\xef\x73\xd5\xd2\x0f\xfe\xc4\x2f\x95\xa5\xb1\xc3\x86\xad\x45\x20\x1d\x3b\x17\x46\x8d\xa2\x73\x2c\x11\xa1\x51\x2c\x0f\x7f\x07\x00\x00\xff\xff\x09\x74\xf7\x7e\xd8\x0d\x00\x00") +var _translationsZh_cnLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x4f\x23\xd7\x15\xfe\xce\xaf\x38\x02\x59\x49\x94\x1d\xe3\x31\x0b\x06\xf7\x45\xdd\xd2\x4d\xb5\x6d\x68\x11\x72\xa2\x7e\xa8\x54\x8d\x67\x8e\x3d\x37\x8c\xef\x9d\xbd\xf7\x8e\x83\xf7\x13\xa9\xd8\x00\x5a\x08\xdb\x8a\x97\xe5\x65\x21\xa4\xdd\xb2\xda\x92\x98\xa4\xea\xca\x85\x8d\xf2\x63\xea\x19\x9b\x4f\xf9\x0b\xd5\x9d\xf1\x1b\x30\x98\x14\xe5\x03\x9a\xe1\xde\x73\xe7\x3c\xe7\x39\xe7\x3c\xe7\x7a\x08\x26\x6d\x42\x51\x20\x48\x6e\x50\xe1\x18\x92\x30\x2a\xa0\xc0\x38\x18\xa6\xd0\x90\x16\x09\x45\x70\x0d\x73\xd6\x28\x62\x72\x60\x08\x26\x99\x5b\xe1\xa4\x68\x4b\x78\x7b\xf2\x1d\x48\xa7\xf4\xcc\xc0\x10\xe4\x6c\x22\xa0\x40\x1c\x04\x22\xc0\x22\x42\x72\x92\xf7\x24\x5a\xe0\x51\x0b\x39\x48\x1b\x41\x18\x25\x04\x87\x98\x48\x05\x82\x21\xc2\xb5\x78\x0f\xbf\x21\x06\x2d\x4a\x62\x50\x78\x9f\xc0\x4f\x3f\x6a\xff\xe7\x90\x5f\xd8\x4c\x96\x0c\xe2\x24\x4d\x56\xfa\xf9\x9d\xd0\x77\x72\x60\x68\xa0\x24\x8a\xc4\x82\xc1\x41\xf5\x22\x24\x57\x6f\x83\xd3\x9c\x7d\x84\xa6\xd4\x1e\x58\xda\x87\xc8\x05\x61\x34\x0b\x7f\xa4\x83\x03\x83\x33\xe8\x32\x2e\xb5\x29\x75\x46\xfb\xa5\x57\x14\x5a\x8e\xb5\xb6\xa6\x7f\x9f\xd3\x26\x39\x86\x0c\x68\xbf\x32\x24\x66\x43\x17\x5a\x2a\xa3\xa5\x47\x21\x95\xca\xea\xfa\xbb\xa9\x54\x2a\xd5\x32\xd6\x66\xb0\x4c\x44\x8c\xed\x5d\xd0\x33\xd9\xb4\xae\xa5\x32\x2d\xdb\xf7\x0d\x21\xb5\x5c\x8b\x5e\xc6\xb3\x3f\x30\xc2\xd6\x59\x5a\xf4\x8c\x22\x6a\x39\x34\x4a\xd9\x4e\xb2\xde\x16\xa4\xe4\x3a\xa4\x40\xd0\x7a\xe7\x82\x5d\x16\x1e\xd9\x7f\x9a\xfc\x5d\xb8\x36\xf5\x60\xea\x7e\x37\x7c\x3d\x19\xa1\x99\x64\x54\x22\x95\x5a\xae\xe2\x62\x16\x24\xce\xc9\x61\xd7\x31\x08\xfd\x09\x98\xb6\xc1\x05\xca\x9f\x7d\x90\x7b\x4f\x1b\xbf\x68\xab\xc0\x17\x90\x6b\xf7\xa9\xc9\x2c\x42\x8b\x59\x18\xcf\x13\x19\xda\xfc\x41\xfb\x35\x52\xe4\x51\x64\xd3\x0c\x2d\x22\x21\x9d\x4c\x25\x47\xd4\xee\xc0\x50\x16\xdc\xd9\xe2\xb0\x61\x8a\x28\xd1\xc3\xd1\x23\x59\x64\xd9\xf4\xc8\xc4\xc0\xd0\x1d\x30\xb5\x02\xe3\x25\x43\xb6\xf3\x78\x9f\x73\xc6\x81\xa3\xa1\xfc\x44\x45\x95\x10\x77\x20\x5c\xce\x42\x42\x74\xf3\x1c\x6c\x2e\xd6\xcf\x5e\x43\x42\x7c\xff\x66\xe5\x7c\x7d\xbb\x59\xad\x36\xab\x67\xfe\xda\x66\xb0\xf5\xda\x5f\x3c\x3d\x5f\xdf\x8e\xcc\xdb\x18\x98\xab\x50\xaa\xf2\x1e\x9e\xf5\xf2\xc8\x29\x4a\x14\x9e\x5b\xe4\x86\x85\xc3\xad\xa7\xe9\x78\x42\x22\x57\xf0\x32\xfa\xf5\xe8\x3e\xb6\x15\xac\x87\x1e\xf2\x8a\x02\x79\x6f\x66\x2a\xec\x18\x8e\x82\x79\xdc\x44\x91\x85\xc4\xbb\xe5\x1e\xa0\x07\x2f\x9a\xd5\x2f\xee\xcd\x4c\x35\xff\xbd\x10\x9c\x3e\xed\xe0\xfb\xfe\xcd\x4e\x64\x78\x95\xa6\xb0\x1b\x95\x6b\x05\x65\x22\x96\xa8\xf7\x98\x47\x2d\x48\x77\xbd\xc2\xc7\x44\xda\x20\x2b\xae\x62\x0c\x08\x0d\x7b\x4c\x62\xc9\x75\x0c\x89\x49\xc8\xd9\xc8\x11\x84\xcd\x3c\xc7\x02\x46\x9d\x0a\xe4\x11\xf4\x1e\x94\x2f\x0f\x83\xe7\xdf\xf9\x6b\x7f\x69\x7c\x76\x52\xaf\xfd\xbd\x5e\x7b\xd5\xf8\xfa\xcc\xdf\x7f\x92\x10\xd0\xd8\x59\x88\xa0\xff\x77\xfe\xcf\xfe\xe9\x7a\xb3\xfa\xc2\x5f\x7b\x15\xec\x2d\xd7\x6b\xf3\xf5\xda\xab\x1b\xf1\xeb\xe9\xf4\xf5\x01\x50\x76\xbb\x08\x6c\xa3\x8c\x90\x47\xa4\x57\x63\x08\xbe\x39\x0c\xf6\x96\xa3\x48\xfa\xc4\x10\x13\x40\xdf\x1a\x29\xeb\x63\xe9\xd6\x7b\x58\x21\x7a\x2a\x36\xac\x1c\x93\x86\x03\x26\xf3\xa8\x04\x56\x80\x92\xa1\x2a\x0a\x3e\x9c\x52\x55\x61\x01\xce\x99\x88\x16\xaa\x17\x17\x4d\xa5\x91\xa1\xa5\xda\xeb\x86\x51\xaf\x9d\x35\xb7\x77\x82\x27\x07\xc1\xde\x69\x30\x7f\x16\x6c\x9c\x84\x67\x9b\xaf\x1f\x37\xbf\x5b\x0c\xf6\x0e\x82\xbd\xdd\xc6\xce\x42\xb0\x71\xd2\xd8\xfd\x2a\x3a\x79\xab\x00\x46\x52\x71\xf8\x3f\x88\x2c\x40\x32\xf8\x6d\xe7\x13\xa0\x27\xc7\x92\x69\x25\xef\x94\x49\x10\x9e\xab\x64\x14\x2d\x28\x70\x56\x82\x72\x5b\x63\x7a\xbb\xb3\xb1\xbc\x14\xec\x1d\x27\x04\xd4\x6b\xab\xc1\x7a\x35\x58\xf9\xc4\x5f\x5d\x6c\x9c\x1e\xf9\x4b\x27\x97\x3f\x7b\xeb\x1e\x1d\x1f\xfb\xe1\x01\xf4\x80\xfc\xd1\xc3\x68\x1b\xc5\x75\x82\x52\x30\x61\x94\x23\xc0\xe9\xbb\x71\x80\x31\x14\x15\x33\x9c\x3d\xb4\x08\x16\xe1\x68\x4a\xc6\x2b\xf0\x56\x42\xbc\x75\x11\x8e\xbf\xb4\xeb\x9f\x9d\x36\x76\xbf\xf2\xbf\xdd\x50\x91\x5c\xa3\x75\x71\x7a\xab\xeb\x13\x7d\xbc\xe3\x1c\x9a\x5e\xe8\xbe\xdd\x6f\xa1\xa4\xb5\xf4\x37\x0b\x89\x5e\x3d\x5b\x3e\x6a\x1e\xae\x74\xe4\x17\x12\x65\x68\x35\x5e\x1b\xcd\x2d\x0b\x72\x2c\x73\xbb\x46\x1c\x4f\xdf\xea\x5c\x7a\x62\xf4\x7a\x42\x8a\xd1\x54\x53\x8c\x78\xed\x82\x6a\x31\x73\x69\x0c\x5d\x62\xe3\x5a\x2a\xe2\x93\x32\x1e\x2b\xee\x11\x06\xd7\xe0\xa2\x67\x0a\x5e\xcc\x42\xf3\xe8\x6f\xc1\xfe\xd3\x8e\xdf\x6c\x98\x86\x18\xaf\x2e\x51\x7f\x0e\xeb\x44\x7d\xb7\xb3\xde\x0a\xec\xe2\x76\xac\x28\x60\xdc\x54\xbe\xc8\x43\x6b\xf8\xf6\xe0\x11\xb1\x78\x3a\x2c\x08\x61\x2b\x87\xa3\xb1\x49\x28\x18\xc4\x41\x4b\xf5\x70\xd8\x17\x08\xcc\x45\x2a\x84\x0d\xae\x97\x77\x88\x09\xb3\x58\x01\x75\xcf\x54\x77\x91\xc4\xc3\x9e\x7e\x5d\x3f\x08\x96\x9e\x76\xac\xfd\xc7\xc7\xfe\x9b\x79\xbf\xfa\xe9\xf9\x5f\x5f\xf8\x5f\x6e\x35\x8e\xff\x51\xaf\x7d\xd3\xe9\x98\x87\x7d\x60\xdd\x8d\xcd\x4b\x17\x56\xab\x3e\x10\x5c\x4e\xca\xea\xa9\x10\xa9\x96\x11\xc2\x8e\x85\xa4\xe0\x34\x8e\x3e\x51\x93\x29\x82\x13\x83\xe2\xff\x2b\xdf\xf8\xd2\xe9\x42\x24\x94\x48\x62\x38\xe4\x51\xb7\x74\xdb\xb0\x2f\xdf\xa5\xfc\xa5\xe7\xfe\xd1\x13\x7f\x65\x33\xaa\xde\x08\xb2\xbf\xfd\xf2\xe2\x5d\x45\xf4\x29\x2b\x7d\x4c\xef\x5b\x57\x99\xd8\xba\x22\xb4\x6c\x38\xc4\x6a\x6b\xaf\xaa\x19\xc5\xa1\xc9\x68\x7b\x25\x6f\x98\xb3\x91\x3e\x7b\xed\x35\xb4\x80\xe5\xd5\xfd\xbe\x77\x62\x7e\xe6\xef\xee\x07\xcf\xaa\xe7\xcf\xf7\x23\x35\xf6\x57\x36\x1b\x3b\x0b\x7e\xf5\x3f\xcd\xaf\x0f\xd5\xec\xff\xf6\x38\x58\xfd\xa2\xb1\xb3\x10\xed\x06\x5b\x9f\x07\x1b\x4b\x37\x6a\xe6\x48\xfc\xcd\x85\x71\xd3\x46\x21\x43\x1e\x43\x91\x56\x13\xc5\xa3\x9d\x79\xd2\xc5\x95\x10\x70\xfe\x78\x55\x11\xf9\xac\x5a\xaf\xad\xfa\x6b\x5b\xd1\x10\xb9\x41\x15\xc6\x33\x71\x6e\xbb\xca\x1c\xf5\x1f\x58\x0c\xa3\x49\x86\x73\x44\xc8\x2b\xd7\xa0\x8e\x24\x29\xcf\x5f\x3e\xf3\xf7\x5e\xf6\xc9\xdf\xc4\x78\xdf\xf4\x8d\xc6\x5e\x87\x3d\xca\xd1\x64\x45\x4a\x1e\xa1\x05\xf7\xa6\x1f\xb4\x7e\x6d\x84\x9c\xf4\xc0\xd9\xfa\x3c\xf8\xd7\x46\xb3\xfa\xa9\xbf\xf4\xcf\xc6\xce\xc2\x55\xc3\x1b\x14\x72\x24\xce\x75\xc5\x28\x39\x37\x12\x11\x1a\xc5\xf2\xf0\xbf\x00\x00\x00\xff\xff\x2d\xf1\x9e\x49\xf9\x0e\x00\x00") func translationsZh_cnLc_messagesAcsenginePoBytes() ([]byte, error) { return bindataRead( @@ -193,6 +322,66 @@ func translationsZh_cnLc_messagesAcsenginePo() (*asset, error) { return a, nil } +var _translationsZh_cnLc_messagesAcsenginePoLcg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6b\xf3\x36\x14\xc6\xef\x5f\x78\xbf\xc3\x99\x20\xf4\x62\x5b\x9c\x64\x5b\xb6\x05\x3b\x25\xa4\x1b\x84\xa5\x5b\x59\xd2\x52\x28\xbd\x50\xa4\x93\x58\xab\x2c\xb9\xfa\x93\x3a\xfd\xf4\x43\x76\xbc\x94\x31\x18\x0c\x89\xdd\xb4\x8e\x9c\x63\x3f\xbf\x73\xac\xf3\x1c\x27\xbf\x6e\x2a\x09\x47\x34\x56\x68\x55\x90\xf1\x70\x44\xae\xe7\x9f\x3f\xe5\xeb\xe5\x23\x6c\x58\x89\x15\x7d\xe8\xcf\x4d\x87\x23\x02\xbf\xd2\x0a\x0b\x42\x99\x45\x75\x10\x0a\x09\xdc\x59\xb3\xe2\x05\x19\x13\xd8\x18\xb6\xf4\xb2\x20\xa8\xbe\xbe\xdf\x10\x68\x2a\xa9\x6c\x41\x4a\xe7\xea\x59\x96\xd9\xf6\x5a\x76\x58\x09\x66\xb4\xd5\x7b\x37\x64\xba\xca\xa4\x66\xd6\x79\x2e\x74\x36\x19\x8d\xa6\xd9\x34\x93\xac\x21\xf3\xcf\x9f\x00\xf2\x95\xc3\x0a\xc2\x9f\xed\xa9\xc6\x82\x8c\x48\xfb\xe1\x7c\xab\xcb\x4d\xd7\x48\xf7\x05\x71\xc6\x63\x17\x07\x90\x6f\x9c\x81\x25\x75\x05\xd9\x62\xe3\xfa\x55\x80\xfc\x81\xca\x79\xfe\xc5\xd3\xf2\x66\xb1\x5d\x3c\xfd\x64\x8c\x36\x60\x90\x72\xa1\x0e\xb0\x17\x12\x61\x60\xbf\x82\x76\x79\x06\x03\xfb\xfc\x3c\xcf\xb3\x10\x71\xbe\x68\xb6\x71\xa6\x3f\xbe\x11\xb6\x86\x15\x0b\x39\xd9\x38\x43\x20\xeb\x14\x67\x41\xe0\xbf\x89\x9f\xc4\x13\xff\x56\x06\xd5\xaf\x1e\xcd\x29\x30\x2c\x7e\xbf\x85\x7d\xcb\x64\xb5\x37\x0c\xed\x0c\x06\x5f\x1e\x53\x71\x7c\x13\x83\xe3\x67\xed\x15\x87\xc9\x45\x32\xbc\x09\x57\x82\x3b\xd5\xa1\x1a\x20\x14\xb8\x12\xc1\x61\x55\x4b\xea\x70\x08\xdb\x12\x0d\x82\x2d\xb5\x97\x1c\xb4\x92\x27\xd8\x21\x8c\x53\x21\x7e\x1b\x0f\x51\xe9\xff\xc6\x58\xd2\x23\xc2\x0e\x51\xa5\xa3\xfc\x2e\x06\xe5\x56\x3b\x2a\x81\x69\xaf\x1c\xe8\x3d\x54\xd4\x3a\x34\xf0\x70\x1b\x9e\x41\x0e\xd8\x30\x44\x8e\xe1\xa0\x46\xe6\x90\x77\xdf\x0c\xe7\x52\x51\x4d\x63\x50\xdd\xd7\x07\x43\x39\x82\xd3\xf0\x8b\xdf\xa1\x51\xe8\xd0\xc2\x78\x38\x1d\x4e\x40\x58\x50\xda\x81\xf5\x75\xad\x4d\x40\xda\x1b\x5d\xf5\x7d\x34\x65\x03\xf9\x3e\x1d\xd9\x07\xf5\xff\x1f\xdf\x0f\x31\xf8\xb0\x6d\x90\xcc\x20\x75\xa1\x35\x72\x61\x90\x39\x6d\x4e\x70\x35\xb0\x57\x29\xd5\xff\x18\x4f\x3d\x36\xc8\x7c\x2b\xbf\x6f\x0e\x6d\x7b\x3f\x5b\xd5\x0c\x06\xc9\x7a\xfb\x78\x14\x8f\xe2\x80\x0a\x4d\x57\x05\xdf\x3f\x74\x67\x9c\x94\x75\x18\x47\x19\x12\x3a\x84\x9a\x1a\xfb\x61\x48\x48\x9a\xf9\x28\xe3\x01\xfe\xd3\x6c\x93\x34\xdb\x51\xa6\x81\x3d\x15\x12\x79\xe8\x49\xed\xc6\x45\xd0\x35\x2a\x6b\x4b\xa8\xfd\x4e\x0a\x06\x2f\x78\x02\xeb\x8c\x50\x87\x19\x0c\x5e\x93\xb1\x44\xb1\xfd\x0b\xcb\x79\x03\x20\xd4\x46\x1c\xc3\xff\x80\x11\x36\xb2\xb5\x65\x52\x8e\x28\xc6\x7e\xe1\x10\x4a\x38\x41\xa5\x78\xbf\x6c\xe0\x9e\x2d\xed\xc4\x3c\x8e\xe2\xe5\x42\x1d\xa9\x14\xbc\x77\xb0\x60\x71\xa1\x08\x4c\xab\x7e\x65\x47\xd9\x4b\xe7\x72\xbe\x5f\x43\x0e\x7a\xf7\x07\x32\x97\x8c\x2d\x8a\x9b\x6b\xc3\x4a\xb4\xae\xad\x44\xeb\x70\xc1\xbd\xbd\xfa\xcb\xbb\x93\xa9\x8f\xe2\xd5\x17\x77\xeb\x1a\x15\x70\x8d\xdd\xf0\x81\x8d\xb0\xe9\x52\x1f\xc5\xaa\xbd\x32\xc8\xf4\x41\x89\x77\xe4\xb0\xb8\x5b\x9d\x5f\x96\xdb\x2a\x24\x7b\x85\x8c\x62\xcf\x27\x5a\xc9\x24\x29\xff\xed\x4d\x21\x5f\xea\xaa\x42\xe5\x6c\x1f\xb6\xac\xdc\xf9\xa7\x83\x35\x6b\x16\xbc\x12\xea\x12\xfa\xf7\x80\x3c\x5b\x2f\x1f\xe7\x7f\x06\x00\x00\xff\xff\xac\xbb\x9e\xdd\x99\x10\x00\x00") + +func translationsZh_cnLc_messagesAcsenginePoLcgBytes() ([]byte, error) { + return bindataRead( + _translationsZh_cnLc_messagesAcsenginePoLcg, + "translations/zh_CN/LC_MESSAGES/acsengine.po.lcg", + ) +} + +func translationsZh_cnLc_messagesAcsenginePoLcg() (*asset, error) { + bytes, err := translationsZh_cnLc_messagesAcsenginePoLcgBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/acsengine.po.lcg", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x99\x51\x8f\x1a\x37\x10\xc7\xdf\x23\xe5\x3b\x4c\x57\x42\x79\x68\xcb\xc2\xb5\xa5\x2d\x02\x12\x44\x5a\xe9\x54\xd2\x9e\x0a\x39\x45\x4a\xf2\x60\xec\x81\x75\xe3\xb5\x37\xf6\x2c\x07\xf9\xf4\x95\x17\x36\x9c\xd4\x4a\x0d\x9c\xe7\xd4\x97\x3b\xaf\xf7\xbc\x33\xf3\x9b\x59\x7b\xfe\xb7\xa3\xe7\xbb\xd2\xc0\x16\x7d\xd0\xce\x8e\xb3\x7e\xb7\x97\x3d\x9f\x3c\x7d\x32\x9a\xcf\xde\xc0\x42\x16\x58\x8a\xdb\xf6\xde\xa0\xdb\xcb\xe0\x77\x51\xe2\x38\x13\x32\xa0\xdd\x68\x8b\x19\xdc\x04\x7f\xad\xc6\x59\x3f\x83\x85\x97\xb3\xda\x8c\x33\xb4\xdf\xbe\x5e\x64\xb0\xdc\xd0\xfd\xcb\x5d\x69\x6c\x18\x67\x05\x51\x35\xcc\xf3\xd0\x3c\x3a\x74\x4b\x2d\xbd\x0b\x6e\x4d\x5d\xe9\xca\xdc\x38\x19\xa8\x56\xda\xe5\x57\xbd\xde\x20\x1f\xe4\x46\xee\xb2\xc9\xd3\x27\x00\xa3\x6b\xc2\x12\xe2\x8f\xe5\xbe\xc2\x71\xd6\xcb\x9a\x8b\xa3\xe5\x93\x0f\x73\x14\xeb\x71\x46\xbe\xc6\xc3\x3a\x80\xd1\x82\x3c\xcc\x04\x8d\xb3\x25\xee\xa8\x9d\x05\x18\xdd\x0a\x33\x19\x7d\xf5\x76\xf6\x72\xba\x9c\xbe\xfd\xc5\x7b\xe7\xc1\xa3\x50\xda\x6e\x60\xad\x0d\x42\x27\x7c\x03\xcd\xf4\x10\x3a\xe1\xfd\xfb\xc9\x28\x8f\x2b\x3e\x2f\x5f\x6e\xe8\xde\x63\x61\x41\x71\x3c\x77\x32\x83\x69\x55\xf9\x71\x76\xe3\x31\x0e\xdc\x16\xd5\xc9\xe8\xc3\xcd\xe6\xcb\x0d\xb5\x91\xe5\x0b\xf2\xed\xf8\xa5\x0e\x15\x5c\xcb\x98\xa7\x05\xf9\x0c\xf2\x03\xb6\x3c\x52\xfa\x2f\x82\x57\xe9\x08\xde\x15\x31\x86\x8f\x35\xfa\x7d\x8c\x68\xfa\xe7\x2b\x58\x37\x11\x06\x57\x7b\x89\x61\x08\x9d\xaf\xb7\xac\x30\x2f\xf4\x80\x83\xeb\x77\x29\xb8\xfe\xea\x6a\xab\xe0\xea\x14\x00\xdc\x69\x2a\x80\xf6\x55\xac\x15\xd0\x16\xa8\x40\x20\x2c\x2b\x23\x08\xbb\xb0\x2c\xd0\x23\x84\xc2\xd5\x46\x81\xb3\x66\x0f\x2b\x84\x3e\x13\x72\x2e\xe7\x38\xb2\xf1\x7d\xba\x6c\x58\x77\x59\xc4\x85\xd8\x22\xac\x10\x2d\x73\x42\x58\xfc\xe3\xc8\xc9\x0f\x29\x72\xb2\x74\x24\x0c\x48\x57\x5b\x02\xb7\x86\x52\x04\x42\x0f\xb7\xaf\xe2\xab\xae\x00\x77\x12\x51\x61\x1c\x54\x28\x09\xd5\xe1\x2f\xe3\x3d\xa6\x1c\x24\xf4\x87\x83\xf9\x20\x05\xf3\xd7\xd5\xc6\x0b\x85\x40\x0e\x7e\xab\x57\xe8\x2d\x12\x06\xe8\x77\x07\xdd\x2b\xd0\x01\xac\x23\x08\x75\x55\x39\x1f\x03\x5c\x7b\x57\xb6\x2d\x06\xe3\x61\x9a\xd8\x27\x0e\xf6\x3f\xf2\xb1\xbf\x17\xcb\xff\x2c\x03\x0f\xf4\x8c\x23\x0f\x3f\xa5\xc8\x03\x36\xfd\x86\xf4\x28\x28\x76\x1a\x4a\x7b\x94\xe4\xfc\x1e\x9e\x75\xc2\x33\x46\xca\x17\xd8\xe5\x60\xf8\x73\x3a\x86\xb8\x43\x59\x37\xc1\xb4\x07\x53\xd3\xb3\x1d\xfb\xe1\x21\x74\xb8\x5a\xc6\xcb\xcd\x73\x10\xed\xf7\xd2\x21\xdd\xa0\x45\x7f\x28\x90\xba\x7d\x2b\x8f\xc1\xb1\x97\xe6\xd9\xb6\x59\x60\x26\xd1\x85\x87\x80\x2a\xe1\xc3\x3d\x81\xc6\x5e\x90\x5f\x64\x8f\x05\x5a\x12\x29\x88\xff\xa6\x6a\xd9\xab\xee\x8b\xec\xb1\x40\x4b\xa2\xf3\xd6\x42\x1b\x54\xf1\xe8\x6c\x76\x76\x04\x57\xa1\x0d\xa1\x80\xaa\x5e\x19\x2d\xe1\x03\xee\x21\x90\xd7\x76\x33\x84\xce\x47\x26\x92\x0f\x75\x82\x05\x6f\x12\xe1\x76\x8a\xec\xb8\x3b\x21\x54\x5e\x6f\xe3\xef\x18\x54\xdc\xef\x43\x28\x1e\x05\xed\xf9\x0e\xb0\x60\x4d\xa2\xbd\x4e\x51\x69\xab\x49\x0b\xa3\x3f\x9d\x36\xfb\x36\x52\xd6\x7f\xa1\x3d\xc8\x03\x16\xb0\x49\x04\x96\xb6\x5b\x61\xb4\x6a\x5b\xe3\xd8\x3b\xc7\x12\x91\xce\xb6\x33\x2b\x21\x3f\x1c\xda\xe7\xba\x9d\x43\x05\x6e\xf5\x17\x4a\x62\x62\x9d\xda\x29\x16\xfc\x49\x34\x96\xf3\xb2\xc0\x40\x4d\xe9\x34\x7d\x75\x54\x2e\xb5\xfd\xac\x5b\x98\x00\x9f\x6f\x96\x05\x61\x12\x79\x74\xea\xa5\x0f\x07\x32\x28\x87\x07\xf5\x87\x3b\x1d\xb8\x4a\xf4\x6c\xab\x2c\x00\x93\x68\xa3\xda\x7a\x94\x6e\x63\xf5\x27\x54\x30\xbd\xb9\x3e\x7e\x88\x69\xea\x82\x89\xde\x79\x26\x59\xbe\x45\x24\xd1\x40\x7b\x51\x9a\xc7\xad\xbb\xb3\x2c\x5e\x0e\xee\x8f\x3b\x8b\x6a\xe6\xca\x12\x2d\x85\x76\xd9\xac\xa4\xe3\x77\xb9\xb9\xdc\x4d\x55\xa9\xed\x69\xe9\x3f\x17\x8c\x16\x48\x51\x9b\x85\xe3\x9a\x17\xdb\x30\x77\x72\xe9\x9c\x09\x2f\xde\xc9\xda\x7b\xb4\xf4\x4e\xe1\x5a\xd4\x86\xba\x26\x84\x0c\x0e\x49\x9a\xc7\x61\x7c\xec\x28\x9f\xcf\xde\x4c\xfe\x0e\x00\x00\xff\xff\x4f\x29\xb2\x58\x39\x1c\x00\x00") + +func translationsZh_cnLc_messagesEnUsLclAcsenginePoLclBytes() ([]byte, error) { + return bindataRead( + _translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl, + "translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", + ) +} + +func translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl() (*asset, error) { + bytes, err := translationsZh_cnLc_messagesEnUsLclAcsenginePoLclBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x98\xdf\x6f\xdb\x36\x10\xc7\xdf\x0b\xf4\x7f\x38\x68\x40\xd1\x62\xa5\x24\xca\x89\x7f\x28\x76\xba\x4e\x4d\xb2\x0c\x76\x62\xd4\x6e\x97\x07\x01\x01\x23\x9d\x25\x36\x12\x29\x90\x54\x90\xf4\xaf\x1f\x64\x2b\xb6\xb7\x3a\x6d\x12\x3b\x7a\xb0\x65\x53\xe4\xf1\x73\xbc\x3b\xf2\x2b\xf5\x3f\xdc\xe6\x19\xdc\xa0\xd2\x5c\x8a\x81\x45\x6d\xd7\xfa\x70\xf8\xfa\x55\x7f\x18\x5c\xc0\x24\x4a\x31\x67\x5f\xef\xef\xb5\x6d\xd7\x82\x33\x96\xe3\xc0\x62\x91\x46\x91\x70\x81\x16\x8c\xb5\x3a\x8d\x07\x16\xb5\x60\xa2\xa2\xa0\xcc\x06\x16\x0a\xf2\x65\x62\xc1\x6d\x9e\x09\x3d\xb0\x52\x63\x0a\xdf\x71\xf4\xdc\x96\xb6\x73\x1e\x29\xa9\xe5\xcc\xd8\x91\xcc\x9d\x4c\x46\xda\x94\x31\x97\x8e\xe7\xba\x6d\xa7\xed\x64\xd1\xad\x75\xf8\xfa\x15\x40\xff\xd4\x60\x0e\xd5\xd7\xc2\xfa\xbc\x11\xa0\x3f\x56\xb2\xd0\xf5\x1f\x80\xfe\xc4\xa8\x1a\x69\x7c\x7e\x39\x42\xc3\x62\x66\x98\x6b\xc1\x57\x96\x0d\xac\xdf\x7c\x28\xae\x13\x67\x09\xeb\x2c\x2e\x76\x22\x7d\xaf\xd5\xb3\xc0\xf9\x85\x1d\x7a\x6f\xe7\x3d\x44\x64\x26\x55\xce\xcc\x6a\x50\xdf\x59\xa1\xf4\x9d\x0a\x74\x03\xb7\xb7\x0d\xb7\x2c\x50\x31\xc3\xa5\xd0\xce\x75\x79\x85\x4a\xa0\x41\x5d\x16\x89\x62\x31\x3a\xf5\x35\xca\x4a\x6d\x50\x55\x2e\x75\x68\x13\x1e\xb5\x76\x13\x09\xa3\x98\xd0\x15\x40\x45\xde\x6b\x24\x16\x7b\x2f\x40\x4e\x3d\xaf\x09\xf4\xfd\x17\x4b\xa3\x1b\xda\xf6\xea\xdf\xf3\x24\xa2\x6e\x23\x0e\xb5\x1b\x73\xa8\xe5\x36\xe1\x4f\xa7\xc1\x3a\xef\xb6\x9b\xf0\xa8\xbb\x9b\x6a\x99\xf1\x0c\x35\xbb\x59\x90\x7b\x7b\x4d\x90\xf7\x76\x7d\x56\x50\xda\x6b\x04\x9c\xba\x8d\x55\x45\xbb\xf3\x04\x87\x9e\xb3\x8d\x74\x1f\xb1\x8d\x78\x5b\x4c\xe0\xf5\xf6\x7f\x3d\x41\x6b\xfb\x90\xec\x5c\x78\x50\xda\x6d\xe4\xb4\xa3\x5b\x49\x0f\x56\xf0\xea\x93\xc9\xe5\x7a\xef\x2d\xdb\xeb\x30\xfc\xf7\x76\x23\xbb\x2c\xdd\x91\xf8\xd0\x3a\xad\xa0\xf7\x1f\x91\x42\x3b\x80\xde\x91\xee\xa8\xa1\xf7\x9a\xc9\x9e\xe6\x14\x87\xd7\x50\x3d\x6c\x25\x39\x7e\xa8\x07\xda\xa6\x3f\x2d\x88\x4e\x33\x05\xb1\x95\xee\xd8\xb4\x3d\xb5\x9a\x11\xb4\x74\x47\xf2\x62\x6d\x5f\xed\x3e\xe5\x48\x7b\x3e\xf8\x76\xea\xe2\xff\x69\xd4\xeb\xfe\x34\x8b\xf6\x1b\x79\xa4\xf3\xb6\xd2\x1d\x0f\x1c\x72\xad\x17\x22\x5f\x27\x5c\x33\x1b\xc8\xe2\x4e\xf1\x24\x35\x7f\x61\xb5\x78\x4b\x46\x08\x52\x2e\x50\x23\xcc\x1f\xdb\xb2\xc5\xae\x04\x33\xa9\x80\x45\x9a\x2c\x88\xa1\x60\xd1\x35\x4b\xd0\x5e\x9b\xfd\x41\xcb\x74\x65\xf9\xfe\x06\xbc\x0d\xde\x81\xe7\xd2\xce\x63\xc6\x2f\x45\x0f\x4c\x53\xae\xa1\xd2\xc7\xc0\x35\xc4\x5c\x1b\xc5\xaf\x4a\x83\x31\x94\x22\x46\x05\x26\x45\xd0\x2c\x47\xc8\x78\x84\x42\x23\x30\x3d\x6f\x7b\x26\xf7\x52\x0b\xc1\xdf\x9c\x89\xc4\x70\x26\x60\xc8\xe1\x4d\x66\x0e\xbe\xdd\x37\x64\xfc\x8f\x54\x9a\x9c\xf1\xcc\x8e\x64\xfe\x26\x31\x07\xef\xe7\x7e\x6d\x9e\xe0\x58\xc9\xfc\x98\x67\x58\x1b\xfe\xe4\x87\x27\xf2\x1f\xa9\xae\x43\xad\xa2\x30\xe1\x26\x2d\xaf\x2a\x33\xe1\xc7\xef\xa5\xc2\x70\x85\x1d\xae\x87\x22\xfc\x9e\x5e\x06\x67\xe1\x30\xb8\x1c\x1d\x4d\x26\x1f\x4f\x8e\x26\xe1\x32\xa1\xec\x42\x3e\x38\xf1\x67\x2c\xa4\xe6\x46\xaa\xbb\x7a\xfa\xb5\x37\x52\x1b\x86\x8c\xcf\x2f\x17\xcb\x50\xf7\x1e\x2b\xf9\x0d\x23\x43\x4e\x63\x52\xbf\xde\xf2\x21\x14\x95\x51\x65\xc8\x48\x27\x3c\x26\x7f\x96\x89\x26\x53\x59\xb5\x8f\xcf\xa7\x24\x50\x38\x27\x26\x9f\x98\x41\x7f\xbe\x2c\xc4\xed\x10\x6f\x1f\x5c\xd7\xa7\xf4\x77\xd7\x75\xdd\xaa\x27\xf9\x8c\x37\x5c\x6f\xe8\xb8\x07\xb4\xe3\x7b\x94\xb8\x9d\xaa\xe3\x90\x69\x43\xa6\xf5\x42\x48\xe5\x3f\x29\x2a\xd5\x70\x91\x94\x2c\x41\x32\x45\x96\xfb\xcb\x24\x7f\xab\x79\x5e\x64\x7c\xc6\x31\x7e\xb7\xea\xe4\xc3\x62\x91\xc5\xe8\x74\x74\xb4\xf2\x97\xda\x6e\x28\x02\x29\x0c\x0a\x43\xa6\x77\x05\xfa\x60\xf0\xd6\x38\x45\xc6\xb8\x38\x80\x28\x65\x4a\xa3\x19\x7c\x99\x1e\x93\xee\x5a\xc7\xf9\xeb\x0f\x54\xe4\x48\x44\x32\xe6\x22\xf1\xa1\x7b\xc5\x4d\x28\x2e\xc8\x09\x8a\xea\xdc\xaf\xbc\x19\x4b\x8c\xb9\x01\xcf\x76\xed\x56\x28\x36\x86\xe4\x6c\x9c\x95\x8a\x65\xba\x8e\xc8\xf2\xd8\x59\x15\x7e\xdf\x19\x06\x17\x87\xff\x06\x00\x00\xff\xff\x4a\xb8\x14\x16\xa1\x14\x00\x00") + +func translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXmlBytes() ([]byte, error) { + return bindataRead( + _translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml, + "translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml", + ) +} + +func translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml() (*asset, error) { + bytes, err := translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or // could not be loaded. @@ -245,12 +434,21 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "translations/default/LC_MESSAGES/acsengine.mo": translationsDefaultLc_messagesAcsengineMo, - "translations/default/LC_MESSAGES/acsengine.po": translationsDefaultLc_messagesAcsenginePo, - "translations/en_US/LC_MESSAGES/acsengine.mo": translationsEn_usLc_messagesAcsengineMo, - "translations/en_US/LC_MESSAGES/acsengine.po": translationsEn_usLc_messagesAcsenginePo, - "translations/zh_CN/LC_MESSAGES/acsengine.mo": translationsZh_cnLc_messagesAcsengineMo, - "translations/zh_CN/LC_MESSAGES/acsengine.po": translationsZh_cnLc_messagesAcsenginePo, + "translations/default/LC_MESSAGES/acsengine.mo": translationsDefaultLc_messagesAcsengineMo, + "translations/default/LC_MESSAGES/acsengine.po": translationsDefaultLc_messagesAcsenginePo, + "translations/default/LC_MESSAGES/acsengine.po.lcg": translationsDefaultLc_messagesAcsenginePoLcg, + "translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl": translationsDefaultLc_messagesEnUsLclAcsenginePoLcl, + "translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml": translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml, + "translations/en_US/LC_MESSAGES/acsengine.mo": translationsEn_usLc_messagesAcsengineMo, + "translations/en_US/LC_MESSAGES/acsengine.po": translationsEn_usLc_messagesAcsenginePo, + "translations/en_US/LC_MESSAGES/acsengine.po.lcg": translationsEn_usLc_messagesAcsenginePoLcg, + "translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl": translationsEn_usLc_messagesEnUsLclAcsenginePoLcl, + "translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml": translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml, + "translations/zh_CN/LC_MESSAGES/acsengine.mo": translationsZh_cnLc_messagesAcsengineMo, + "translations/zh_CN/LC_MESSAGES/acsengine.po": translationsZh_cnLc_messagesAcsenginePo, + "translations/zh_CN/LC_MESSAGES/acsengine.po.lcg": translationsZh_cnLc_messagesAcsenginePoLcg, + "translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl": translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl, + "translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml": translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml, } // AssetDir returns the file names below a certain @@ -297,20 +495,47 @@ var _bintree = &bintree{nil, map[string]*bintree{ "translations": {nil, map[string]*bintree{ "default": {nil, map[string]*bintree{ "LC_MESSAGES": {nil, map[string]*bintree{ - "acsengine.mo": {translationsDefaultLc_messagesAcsengineMo, map[string]*bintree{}}, - "acsengine.po": {translationsDefaultLc_messagesAcsenginePo, map[string]*bintree{}}, + "acsengine.mo": {translationsDefaultLc_messagesAcsengineMo, map[string]*bintree{}}, + "acsengine.po": {translationsDefaultLc_messagesAcsenginePo, map[string]*bintree{}}, + "acsengine.po.lcg": {translationsDefaultLc_messagesAcsenginePoLcg, map[string]*bintree{}}, + "en-US": {nil, map[string]*bintree{ + "lcl": {nil, map[string]*bintree{ + "acsengine.po.lcl": {translationsDefaultLc_messagesEnUsLclAcsenginePoLcl, map[string]*bintree{}}, + }}, + "metadata": {nil, map[string]*bintree{ + "acsengine.po.xml": {translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml, map[string]*bintree{}}, + }}, + }}, }}, }}, "en_US": {nil, map[string]*bintree{ "LC_MESSAGES": {nil, map[string]*bintree{ - "acsengine.mo": {translationsEn_usLc_messagesAcsengineMo, map[string]*bintree{}}, - "acsengine.po": {translationsEn_usLc_messagesAcsenginePo, map[string]*bintree{}}, + "acsengine.mo": {translationsEn_usLc_messagesAcsengineMo, map[string]*bintree{}}, + "acsengine.po": {translationsEn_usLc_messagesAcsenginePo, map[string]*bintree{}}, + "acsengine.po.lcg": {translationsEn_usLc_messagesAcsenginePoLcg, map[string]*bintree{}}, + "en-US": {nil, map[string]*bintree{ + "lcl": {nil, map[string]*bintree{ + "acsengine.po.lcl": {translationsEn_usLc_messagesEnUsLclAcsenginePoLcl, map[string]*bintree{}}, + }}, + "metadata": {nil, map[string]*bintree{ + "acsengine.po.xml": {translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml, map[string]*bintree{}}, + }}, + }}, }}, }}, "zh_CN": {nil, map[string]*bintree{ "LC_MESSAGES": {nil, map[string]*bintree{ - "acsengine.mo": {translationsZh_cnLc_messagesAcsengineMo, map[string]*bintree{}}, - "acsengine.po": {translationsZh_cnLc_messagesAcsenginePo, map[string]*bintree{}}, + "acsengine.mo": {translationsZh_cnLc_messagesAcsengineMo, map[string]*bintree{}}, + "acsengine.po": {translationsZh_cnLc_messagesAcsenginePo, map[string]*bintree{}}, + "acsengine.po.lcg": {translationsZh_cnLc_messagesAcsenginePoLcg, map[string]*bintree{}}, + "en-US": {nil, map[string]*bintree{ + "lcl": {nil, map[string]*bintree{ + "acsengine.po.lcl": {translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl, map[string]*bintree{}}, + }}, + "metadata": {nil, map[string]*bintree{ + "acsengine.po.xml": {translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml, map[string]*bintree{}}, + }}, + }}, }}, }}, }}, From 68e8ddb4af48fa19da13790c0d3223ee8fc086d3 Mon Sep 17 00:00:00 2001 From: Jiangtian Li Date: Mon, 31 Jul 2017 11:48:32 -0700 Subject: [PATCH 13/13] Remove go generated translation bindata --- .gitignore | 1 + pkg/i18n/translations.go | 589 --------------------------------------- 2 files changed, 1 insertion(+), 589 deletions(-) delete mode 100644 pkg/i18n/translations.go diff --git a/.gitignore b/.gitignore index b539d0d978..e8aa172a77 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ test/acs-engine-test/acs-engine-test.exe pkg/operations/junit.xml pkg/operations/kubernetesupgrade/junit.xml pkg/acsengine/templates.go +pkg/i18n/translations.go diff --git a/pkg/i18n/translations.go b/pkg/i18n/translations.go deleted file mode 100644 index 81af563297..0000000000 --- a/pkg/i18n/translations.go +++ /dev/null @@ -1,589 +0,0 @@ -// Code generated by go-bindata. -// sources: -// ../../translations/default/LC_MESSAGES/acsengine.mo -// ../../translations/default/LC_MESSAGES/acsengine.po -// ../../translations/default/LC_MESSAGES/acsengine.po.lcg -// ../../translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl -// ../../translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml -// ../../translations/en_US/LC_MESSAGES/acsengine.mo -// ../../translations/en_US/LC_MESSAGES/acsengine.po -// ../../translations/en_US/LC_MESSAGES/acsengine.po.lcg -// ../../translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl -// ../../translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml -// ../../translations/zh_CN/LC_MESSAGES/acsengine.mo -// ../../translations/zh_CN/LC_MESSAGES/acsengine.po -// ../../translations/zh_CN/LC_MESSAGES/acsengine.po.lcg -// ../../translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl -// ../../translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml -// DO NOT EDIT! - -package i18n - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _translationsDefaultLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\x4f\x8b\x5c\x45\x17\xc6\x9f\x99\xe9\xc9\x4c\xdf\xf7\xf5\x5f\xd4\x85\xa8\x78\x82\xb4\x49\x8c\xb7\xbd\xdd\x89\x4e\xec\x38\xc1\x38\xce\xc8\x68\x86\x0c\x63\x27\xb8\x0b\xd5\xf7\x9e\xe9\xae\xe4\x76\xd5\x4d\x55\xdd\xce\x74\x44\x57\x7e\x05\x97\x82\x2b\xc1\x4f\x21\x88\x08\x7e\x09\x51\x50\x70\x21\xb8\x16\x5c\x48\xdd\xba\x9d\x6e\x42\x04\x71\xe3\x66\x6a\x53\xdd\x75\x9f\x73\xce\xaf\x9e\x73\xa8\x1f\x4e\x36\x3e\x03\x80\xa7\x01\x3c\x07\xe0\x5b\x00\xcf\x03\xc8\x97\x50\xad\x1f\x97\x00\x02\xf0\xd3\x12\x70\x0e\xc0\xf2\x32\xb0\x03\xa0\xbd\x0c\xec\x02\x28\x97\x81\x37\x00\x7c\xbd\x0c\x6c\x02\xf8\x63\x19\xd8\x02\xb0\xb1\x02\x9c\x02\xf0\xd1\x0a\x70\x06\xc0\xe7\x2b\x40\x0b\xc0\x77\x2b\xc0\x33\x00\x7e\xab\xf7\x13\x0d\xa0\x0d\x80\x1a\xc0\xcb\x00\xae\x35\x42\x9d\x7b\x0d\xe0\x32\x80\x2f\x1b\xa1\xfe\x2f\x0d\xe0\x05\xaf\x5f\x0d\x9c\x2f\xad\x02\xcf\x02\xd8\x5a\x05\x3e\x5d\x02\x6e\xae\x06\xdd\xcf\x27\x42\xfc\xea\x5a\xe0\xec\xac\x05\xce\xa3\xb5\xc0\xf9\xcd\x5a\xe0\xfc\x73\x2d\x70\xf6\xd6\x03\xe7\x27\xeb\x81\xf3\x8b\xf5\xc0\xf9\xfd\x7a\xe0\xfb\xbd\xde\x9b\xcd\xc0\xf9\x62\x33\x70\x1e\x34\x43\x9d\x8f\x9b\x81\xf3\xab\x66\xa8\xff\x6b\x33\x70\x36\xa3\xc0\x79\x36\x0a\x9c\x3b\x11\xe0\x2d\xfd\xbf\xf7\x10\x40\xc3\xdf\x05\xc0\x9a\xd7\x02\x78\x0c\xc0\x49\xcc\x57\x54\xef\x4f\x01\x78\x02\xc0\x3a\x80\x27\x01\x3c\xea\xef\x06\xe0\x71\x00\x2b\x75\xdf\xfc\xfa\x1f\x80\x47\xf0\x90\xb5\x6d\x8c\x36\x64\x58\x64\x52\x0d\xe9\x50\xe6\x4c\x2d\xfb\x0a\x55\xc7\x3d\x6a\xd9\x5a\x70\x77\xe4\xbf\xdc\x29\xd9\x4c\xbd\xee\xca\xc1\x1e\x1d\x56\x71\x56\x97\x26\x65\xdb\xa3\xd6\xb9\x09\x76\x74\xa9\x32\xea\xce\x8f\xe9\xae\x74\x23\x72\xd3\xc2\x67\x25\xa9\xc8\x8d\x98\x1c\x8f\x8b\x5c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x99\x67\xa4\x55\x3e\xa5\x01\x53\xa7\x4e\xa3\xf4\xbf\xcb\x33\x12\x13\xa6\x01\xb3\xa2\x0e\xfa\xda\x89\x9c\x52\x5d\x2a\x47\xfa\x90\xc6\xc2\x3a\x36\x74\x63\xcf\xf3\x66\xc4\x47\x29\x73\xc6\xfe\x47\xc1\xa9\xe3\x2c\x28\xfd\x37\x5c\x2f\x86\x46\x64\x4c\x4e\xd3\xfb\xe5\x80\x8d\x62\xc7\x96\x3a\xed\xd7\xdb\x5d\x92\x96\x94\x76\x64\xcb\xa2\xd0\xc6\x87\x1d\x1a\x3d\xa6\x09\x1b\x2b\xb5\xaa\x4c\x7b\x78\xf4\x82\xe2\x1f\xe4\xe0\xca\xf8\xd4\xb0\x70\xde\xf2\x4c\x1a\x4e\x9d\x36\x53\x3a\xdd\xb2\xa7\x17\x14\x7c\xc4\x69\x59\x49\x66\x86\x54\xad\xa9\x5b\xd9\xa3\xd6\xa4\x16\x0e\x59\xb1\x09\xc9\xca\x19\x5f\x1d\xb1\x90\xae\x10\xc6\x2e\x8c\xc2\x42\xfc\x03\x43\x52\xc5\x1c\x0a\x99\x73\xe6\xef\x59\x81\x32\xe9\x82\x95\xb5\x23\x2a\xca\x41\x2e\x53\xba\xcd\x53\xb2\xce\x48\x35\xec\x51\xeb\xce\x82\xbc\x86\x61\x2a\x8c\x9c\xf8\xdd\x2b\x3d\xb7\xb5\xa3\x07\xa4\x52\x49\x27\x45\x2e\xef\xcd\x79\x67\xe1\xf5\x8c\x4a\x35\x11\xb9\xcc\x66\xf6\x79\x7f\x7d\xaa\x54\xab\xd9\xc9\x40\xa4\xb7\x83\xc5\xe5\xec\x8c\x33\xd2\x83\x5b\x9c\x3a\x68\x93\x8e\xd8\xba\x2a\x5f\xe5\xae\xef\x4e\xa9\xee\xf7\x06\x73\x63\xc3\xd5\x29\xd3\x1c\xfa\xc7\x47\xd2\x3a\x94\xca\x70\xaa\x87\x4a\xde\xe3\x8c\xae\xec\xef\xde\xa8\xab\xfa\x5c\x98\x8a\x71\xfe\x77\x81\xfb\x46\x7b\x82\x78\x37\x8b\x6f\xcc\x5a\x2f\x52\xcb\x6a\x28\x15\x47\x07\xec\xeb\xc7\x7b\x76\x28\xb3\xf8\xed\x72\x68\xe3\xbe\xee\x51\xb4\x7f\xad\x1f\x6f\x55\x63\xa1\x55\xfc\x4e\xd5\xbd\x6e\xd2\xd9\x88\x93\x8d\xb8\xfb\x1a\x25\x49\x2f\xb9\x70\x2e\x49\x92\x24\xda\xbf\x16\x1f\xf0\x44\xda\x87\xe8\x2e\x50\x67\xa3\xd7\x3d\x1f\x27\x1b\x49\x12\x5d\x15\xd6\xc5\x7d\x23\x94\xcd\x83\xa5\xef\x49\xa1\x86\x4e\x0a\x45\x57\x25\xbd\x79\x6b\xf6\x2f\x97\x6f\x8d\xb4\x1b\x0b\x99\xb7\x53\x3d\xbe\x1c\x5d\x15\x6a\x58\x8a\x21\xc7\x7d\x16\xe3\x1e\x6d\xab\x61\x2e\xed\xe8\xfe\x71\x8f\x58\xdd\xbc\xfe\x41\xb4\xb7\xbb\xb7\x3d\xbf\x5e\xa7\x9d\x44\x5b\x5a\x39\x56\x2e\xee\x4f\x0b\xee\x91\xe3\x23\xf7\x6a\x91\x0b\xa9\x2e\x51\x3a\x12\xc6\xb2\xdb\xbc\xde\xdf\x89\x2f\xce\x75\x9e\xed\x90\x4d\xbc\xad\x52\x9d\x55\xc3\x74\x71\x20\x5d\xb4\x9f\x97\x46\xe4\xf1\x8e\x36\x63\xdb\x23\x55\x54\x7f\xed\x66\xf7\x12\x85\x9f\x9b\x67\x14\x9d\xda\xa4\xce\xd9\x4b\xd1\x87\xf1\xbb\xf3\x91\xd9\xd7\x9c\x49\x47\xdd\x76\xd2\x3e\x1f\x1d\x3f\x81\xc7\x4f\xe0\xf1\x13\xf8\x9f\x3d\x81\x7f\x05\x00\x00\xff\xff\x15\x09\xe4\xac\x62\x0a\x00\x00") - -func translationsDefaultLc_messagesAcsengineMoBytes() ([]byte, error) { - return bindataRead( - _translationsDefaultLc_messagesAcsengineMo, - "translations/default/LC_MESSAGES/acsengine.mo", - ) -} - -func translationsDefaultLc_messagesAcsengineMo() (*asset, error) { - bytes, err := translationsDefaultLc_messagesAcsengineMoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/default/LC_MESSAGES/acsengine.mo", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsDefaultLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x6f\xdb\x36\x10\xfe\xee\x5f\x71\x8b\x61\xb4\x45\x23\x47\x92\x93\xd8\x51\x96\x61\x5d\x96\x0c\xd9\x1a\x2c\xc8\x9c\x62\x1f\x06\x0c\x34\x75\x96\x58\x4b\xa4\x4a\x52\x6e\xdc\x5f\x5f\x90\x92\xac\xbc\xd0\x2f\x71\xfa\x21\x10\x43\x1e\xef\x9e\xe7\x5e\xe9\x2e\x5c\xf0\x24\x63\x2a\x05\x2d\x09\x57\x19\xd1\x4c\x70\x05\x53\x21\x81\x50\xe5\x21\x4f\x18\x47\x28\x08\x9d\x91\x04\xfb\x9d\x2e\x9c\x8b\x62\x21\x59\x92\x6a\x78\x7b\xfe\x0e\x42\x3f\x18\x76\xba\x30\x4e\x99\x82\x29\xcb\x10\x98\x82\x98\x29\x2d\xd9\xa4\xd4\x18\x43\xc9\x63\x94\xa0\x53\x04\x45\x72\x84\x8c\x51\xe4\x0a\x81\x28\xbb\xe7\xb6\xf0\x27\x23\x3c\xd1\x8c\x70\xf8\xc8\xe0\xe7\xcf\xcd\x7f\x19\xfb\x35\x15\x3a\x27\x2c\xeb\x53\x91\xff\xb2\x6f\x6d\xf7\x3b\xdd\x4e\xae\x12\x16\xc3\xde\x9e\x59\x28\x2d\xcd\x6a\xef\x46\x8a\xcf\x48\xb5\x77\x15\x7b\x9f\x50\x2a\x26\x78\x64\xac\x55\xc6\xfe\xe3\x7b\x9d\xbd\x5b\x2c\x84\xd4\xde\xb5\xb9\xec\xfd\x56\x26\xca\x1b\x8b\x08\xec\xd1\xcd\xdf\x63\xef\x5c\xa2\x75\x85\xf7\x3b\xd1\x18\x59\x5b\x9e\x3f\xf4\xc2\x23\xf0\xfd\xc8\x3f\x7c\xef\xfb\xbe\x5f\x0b\x7b\xb7\x38\x67\xca\x21\x7b\x08\xc1\x30\x0a\x07\x9e\x3f\xac\x65\x3f\x12\xa5\xbd\x71\xed\x67\x21\xa3\x2d\xa9\xd6\x77\x79\x52\x92\x04\xbd\x31\x92\x3c\x6a\xa2\xf6\xe8\x28\x02\xe4\xff\xdf\xfd\x63\xf7\xae\xaf\xae\x2f\x5a\xea\x41\xbf\x02\x70\x2e\xb8\x46\xae\xbd\xf1\xa2\xc0\x08\x34\xde\xeb\x83\x22\x23\x8c\x9f\x02\x4d\x89\x54\xa8\xcf\xee\xc6\x97\xde\xe8\xb1\xac\xc1\x3b\x45\xe9\x5d\x70\x2a\x62\xc6\x93\x08\x46\x13\xa6\x2b\xf2\x59\x29\x49\xe6\x5d\x0a\x99\xab\x08\x78\x61\xff\x55\x67\xe1\x29\x54\xcb\xb3\xb7\x1c\x7e\x3a\x83\xe0\xdd\xa9\x15\xff\xd7\xfb\x03\x39\xca\x8a\xfb\x8d\xc0\x98\x69\x08\xfb\x7e\x7f\x60\x4e\x3b\xdd\x08\x8a\x59\x72\xb0\x0c\xd3\x41\xf5\xe9\x27\x22\x0a\x07\x27\x9d\xee\x3e\x50\x6f\x2a\x64\x4e\x74\x13\xf2\x0b\x29\x85\x04\x89\xc4\xc0\xaa\xf2\xaf\xa7\xf6\xc1\x6e\x47\xd0\x53\x6d\x4a\x6c\x96\x6c\xcc\x8b\xc2\x00\x34\x45\x70\x30\x2b\x27\x28\x39\x6a\x54\x65\x91\x48\x12\xe3\x41\xfd\xa5\x59\xa9\x34\x4a\x83\x6c\x18\xac\x06\xf6\x35\x35\x76\xbe\x94\x28\x17\xc6\xea\x87\xdb\x6b\x5b\x57\x12\x95\x28\x25\x45\x15\x41\xef\xfd\xfc\x29\xc6\x2d\x2f\x3d\xf7\x96\xad\x5f\x03\xc3\xc0\x3a\x71\xfa\xeb\x52\x94\x3c\x86\xb0\x55\x06\x5f\x99\x4e\x41\x2f\x0a\xe3\x0e\x60\xdc\x56\xa5\xc6\xbc\xc8\x88\xc6\x3e\x8c\x53\x94\x08\x2a\x15\x65\x16\x83\xe0\xd9\x02\x26\x08\x41\x8b\xf8\x47\xe9\xdb\x40\x26\x08\xc3\xd5\x6c\xb8\xd8\xcd\x7c\x4a\xe6\x08\x13\x44\xfe\x9c\xd0\x0f\x51\xb9\x55\x3e\xcd\x83\xe3\xb0\x5e\xdb\x6c\x0a\x7c\x27\xd3\xb1\xd0\x24\x03\x2a\x4a\xae\x41\x4c\x21\x27\x26\xfb\xe0\xd3\xb5\x49\x86\x18\xf0\x9e\x22\xc6\x68\x16\x05\x52\xd3\x75\xad\xa4\x39\x6b\x99\xbd\x42\xc5\x4e\x4c\x06\xbe\x8b\xc8\x5d\x25\x01\x5a\xc0\x5f\x4b\x15\x10\xf4\x8f\xfb\xa1\x99\x1c\x5c\x68\x50\x65\x61\x1a\x33\xc6\x30\x95\x22\x87\x79\xd3\xc2\x1e\x56\xf3\x2b\xd5\xec\x58\xea\xa3\xe3\xed\x29\x3d\xb0\xf7\x7a\x62\x2f\x54\xf6\xbc\x9a\x4c\xbf\x53\x64\x5e\xd1\x08\x0f\x5d\x34\xd0\x36\x1f\x6a\xa7\x1e\x4f\x20\x66\x12\xa9\x16\x72\x01\x6f\x7a\xea\xcd\x63\x90\x5b\x88\xae\xeb\xe5\x41\x70\xb2\x06\x01\xde\x23\x2d\xad\xde\xa6\xc8\x6c\xfb\xab\x3b\x76\x04\xbd\xf9\x53\x20\xdb\xdc\xd8\x29\x85\x8f\x87\xbb\xd5\xf0\x28\xdc\xe9\x5e\x78\x72\xb4\xda\x2d\x49\x35\x37\x0d\xcb\xb2\xc9\x91\x9a\xad\x2b\x38\x1b\xc5\xd7\x07\x68\xe4\x9c\x1e\x95\xea\x82\x48\xf5\x60\x86\xba\x22\xe2\x14\x59\x5a\x2c\x98\xf9\xcb\xc4\x92\xf7\xe1\x72\xbf\xc6\xfa\xf8\xd8\xd9\x48\xd0\x35\xcf\x5d\x9e\x70\x8a\x3c\x67\xaf\x54\x6a\x8c\x1d\x39\x43\x30\x25\x2c\xc3\xd8\x14\xa5\x4d\x7a\x04\x51\x20\x57\x2a\x85\xa2\x9c\x64\x8c\xc2\x0c\x17\x60\x9e\xbc\xe6\x69\xd4\xfb\xd2\x22\x78\xe9\xbd\x95\xb0\x0e\x9d\xf1\x68\xd5\xd7\xe1\x46\x28\x24\x9b\x9b\xaf\xd1\x6c\x8a\x40\xa9\x74\x15\xa4\xcd\x77\x76\xcb\x62\x77\xee\xb4\x76\x19\x67\x9a\x91\x8c\x7d\x6b\x53\xb2\xc1\xf2\xf4\xd1\xf6\xa2\x4b\x2b\xf3\x2b\x38\x0e\xd6\x26\xd8\xd0\x99\x60\x8c\xcf\x49\xc6\xe2\xa6\xb3\x9a\xd6\x6b\x9c\x43\x05\x6f\x76\x26\x84\xce\xaa\xee\x5b\x36\x7b\x18\x83\x98\x98\xdf\x1d\x2d\x87\xd7\xea\x59\x57\xa8\x03\xf7\xbb\x48\x48\x9a\xa2\xd2\xd6\x37\xb6\x27\x9b\xa1\x51\xf2\xe5\xc8\x68\xc1\x6d\x96\x5c\xdb\x27\x46\x43\x97\xf9\xb6\x0b\x57\x25\x07\xb1\xc0\x6a\x68\xe1\x3d\x53\x0f\x5c\xb3\x51\x70\x65\x48\x4f\x46\x6b\x23\x7a\xe4\x7c\x93\x97\x5c\x22\x15\x09\x67\xdf\x30\x86\x0f\x37\x57\xf5\x8f\x23\xcb\xbb\x05\xb5\x5e\x6a\x43\xdb\x1c\xb8\xec\x2e\x48\x9e\x6d\xf4\xc5\x5a\xa1\xef\x01\x00\x00\xff\xff\x14\x2c\x4e\x08\xa4\x0f\x00\x00") - -func translationsDefaultLc_messagesAcsenginePoBytes() ([]byte, error) { - return bindataRead( - _translationsDefaultLc_messagesAcsenginePo, - "translations/default/LC_MESSAGES/acsengine.po", - ) -} - -func translationsDefaultLc_messagesAcsenginePo() (*asset, error) { - bytes, err := translationsDefaultLc_messagesAcsenginePoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/default/LC_MESSAGES/acsengine.po", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsDefaultLc_messagesAcsenginePoLcg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6b\xf3\x36\x14\xc6\xef\x5f\x78\xbf\xc3\x99\x20\xf4\x62\x5b\x9c\x64\x5b\xb6\x05\x3b\x25\xa4\x1b\x84\xa5\x5b\x59\xd2\x52\x28\xbd\x50\xa4\x93\x58\xab\x2c\xb9\xfa\x93\x3a\xfd\xf4\x43\x76\xbc\x94\x31\x18\x0c\x89\xdd\xb4\x8e\x9c\x63\x3f\xbf\x73\xac\xf3\x1c\x27\xbf\x6e\x2a\x09\x47\x34\x56\x68\x55\x90\xf1\x70\x44\xae\xe7\x9f\x3f\xe5\xeb\xe5\x23\x6c\x58\x89\x15\x7d\xe8\xcf\x4d\x87\x23\x02\xbf\xd2\x0a\x0b\x42\x99\x45\x75\x10\x0a\x09\xdc\x59\xb3\xe2\x05\x19\x13\xd8\x18\xb6\xf4\xb2\x20\xa8\xbe\xbe\xdf\x10\x68\x2a\xa9\x6c\x41\x4a\xe7\xea\x59\x96\xd9\xf6\x5a\x76\x58\x09\x66\xb4\xd5\x7b\x37\x64\xba\xca\xa4\x66\xd6\x79\x2e\x74\x36\x19\x8d\xa6\xd9\x34\x93\xac\x21\xf3\xcf\x9f\x00\xf2\x95\xc3\x0a\xc2\x9f\xed\xa9\xc6\x82\x8c\x48\xfb\xe1\x7c\xab\xcb\x4d\xd7\x48\xf7\x05\x71\xc6\x63\x17\x07\x90\x6f\x9c\x81\x25\x75\x05\xd9\x62\xe3\xfa\x55\x80\xfc\x81\xca\x79\xfe\xc5\xd3\xf2\x66\xb1\x5d\x3c\xfd\x64\x8c\x36\x60\x90\x72\xa1\x0e\xb0\x17\x12\x61\x60\xbf\x82\x76\x79\x06\x03\xfb\xfc\x3c\xcf\xb3\x10\x71\xbe\x68\xb6\x71\xa6\x3f\xbe\x11\xb6\x86\x15\x0b\x39\xd9\x38\x43\x20\xeb\x14\x67\x41\xe0\xbf\x89\x9f\xc4\x13\xff\x56\x06\xd5\xaf\x1e\xcd\x29\x30\x2c\x7e\xbf\x85\x7d\xcb\x64\xb5\x37\x0c\xed\x0c\x06\x5f\x1e\x53\x71\x7c\x13\x83\xe3\x67\xed\x15\x87\xc9\x45\x32\xbc\x09\x57\x82\x3b\xd5\xa1\x1a\x20\x14\xb8\x12\xc1\x61\x55\x4b\xea\x70\x08\xdb\x12\x0d\x82\x2d\xb5\x97\x1c\xb4\x92\x27\xd8\x21\x8c\x53\x21\x7e\x1b\x0f\x51\xe9\xff\xc6\x58\xd2\x23\xc2\x0e\x51\xa5\xa3\xfc\x2e\x06\xe5\x56\x3b\x2a\x81\x69\xaf\x1c\xe8\x3d\x54\xd4\x3a\x34\xf0\x70\x1b\x9e\x41\x0e\xd8\x30\x44\x8e\xe1\xa0\x46\xe6\x90\x77\xdf\x0c\xe7\x52\x51\x4d\x63\x50\xdd\xd7\x07\x43\x39\x82\xd3\xf0\x8b\xdf\xa1\x51\xe8\xd0\xc2\x78\x38\x1d\x4e\x40\x58\x50\xda\x81\xf5\x75\xad\x4d\x40\xda\x1b\x5d\xf5\x7d\x34\x65\x03\xf9\x3e\x1d\xd9\x07\xf5\xff\x1f\xdf\x0f\x31\xf8\xb0\x6d\x90\xcc\x20\x75\xa1\x35\x72\x61\x90\x39\x6d\x4e\x70\x35\xb0\x57\x29\xd5\xff\x18\x4f\x3d\x36\xc8\x7c\x2b\xbf\x6f\x0e\x6d\x7b\x3f\x5b\xd5\x0c\x06\xc9\x7a\xfb\x78\x14\x8f\xe2\x80\x0a\x4d\x57\x05\xdf\x3f\x74\x67\x9c\x94\x75\x18\x47\x19\x12\x3a\x84\x9a\x1a\xfb\x61\x48\x48\x9a\xf9\x28\xe3\x01\xfe\xd3\x6c\x93\x34\xdb\x51\xa6\x81\x3d\x15\x12\x79\xe8\x49\xed\xc6\x45\xd0\x35\x2a\x6b\x4b\xa8\xfd\x4e\x0a\x06\x2f\x78\x02\xeb\x8c\x50\x87\x19\x0c\x5e\x93\xb1\x44\xb1\xfd\x0b\xcb\x79\x03\x20\xd4\x46\x1c\xc3\xff\x80\x11\x36\xb2\xb5\x65\x52\x8e\x28\xc6\x7e\xe1\x10\x4a\x38\x41\xa5\x78\xbf\x6c\xe0\x9e\x2d\xed\xc4\x3c\x8e\xe2\xe5\x42\x1d\xa9\x14\xbc\x77\xb0\x60\x71\xa1\x08\x4c\xab\x7e\x65\x47\xd9\x4b\xe7\x72\xbe\x5f\x43\x0e\x7a\xf7\x07\x32\x97\x8c\x2d\x8a\x9b\x6b\xc3\x4a\xb4\xae\xad\x44\xeb\x70\xc1\xbd\xbd\xfa\xcb\xbb\x93\xa9\x8f\xe2\xd5\x17\x77\xeb\x1a\x15\x70\x8d\xdd\xf0\x81\x8d\xb0\xe9\x52\x1f\xc5\xaa\xbd\x32\xc8\xf4\x41\x89\x77\xe4\xb0\xb8\x5b\x9d\x5f\x96\xdb\x2a\x24\x7b\x85\x8c\x62\xcf\x27\x5a\xc9\x24\x29\xff\xed\x4d\x21\x5f\xea\xaa\x42\xe5\x6c\x1f\xb6\xac\xdc\xf9\xa7\x83\x35\x6b\x16\xbc\x12\xea\x12\xfa\xf7\x80\x3c\x5b\x2f\x1f\xe7\x7f\x06\x00\x00\xff\xff\xac\xbb\x9e\xdd\x99\x10\x00\x00") - -func translationsDefaultLc_messagesAcsenginePoLcgBytes() ([]byte, error) { - return bindataRead( - _translationsDefaultLc_messagesAcsenginePoLcg, - "translations/default/LC_MESSAGES/acsengine.po.lcg", - ) -} - -func translationsDefaultLc_messagesAcsenginePoLcg() (*asset, error) { - bytes, err := translationsDefaultLc_messagesAcsenginePoLcgBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/default/LC_MESSAGES/acsengine.po.lcg", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsDefaultLc_messagesEnUsLclAcsenginePoLcl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x99\x51\x8f\x1a\x37\x10\xc7\xdf\x23\xe5\x3b\x4c\x57\x42\x79\x68\xcb\xc2\xb5\xa5\x2d\x02\x12\x44\x5a\xe9\x54\xd2\x9e\x0a\x39\x45\x4a\xf2\x60\xec\x81\x75\xe3\xb5\x37\xf6\x2c\x07\xf9\xf4\x95\x17\x36\x9c\xd4\x4a\x0d\x9c\xe7\xd4\x97\x3b\xaf\xf7\xbc\x33\xf3\x9b\x59\x7b\xfe\xb7\xa3\xe7\xbb\xd2\xc0\x16\x7d\xd0\xce\x8e\xb3\x7e\xb7\x97\x3d\x9f\x3c\x7d\x32\x9a\xcf\xde\xc0\x42\x16\x58\x8a\xdb\xf6\xde\xa0\xdb\xcb\xe0\x77\x51\xe2\x38\x13\x32\xa0\xdd\x68\x8b\x19\xdc\x04\x7f\xad\xc6\x59\x3f\x83\x85\x97\xb3\xda\x8c\x33\xb4\xdf\xbe\x5e\x64\xb0\xdc\xd0\xfd\xcb\x5d\x69\x6c\x18\x67\x05\x51\x35\xcc\xf3\xd0\x3c\x3a\x74\x4b\x2d\xbd\x0b\x6e\x4d\x5d\xe9\xca\xdc\x38\x19\xa8\x56\xda\xe5\x57\xbd\xde\x20\x1f\xe4\x46\xee\xb2\xc9\xd3\x27\x00\xa3\x6b\xc2\x12\xe2\x8f\xe5\xbe\xc2\x71\xd6\xcb\x9a\x8b\xa3\xe5\x93\x0f\x73\x14\xeb\x71\x46\xbe\xc6\xc3\x3a\x80\xd1\x82\x3c\xcc\x04\x8d\xb3\x25\xee\xa8\x9d\x05\x18\xdd\x0a\x33\x19\x7d\xf5\x76\xf6\x72\xba\x9c\xbe\xfd\xc5\x7b\xe7\xc1\xa3\x50\xda\x6e\x60\xad\x0d\x42\x27\x7c\x03\xcd\xf4\x10\x3a\xe1\xfd\xfb\xc9\x28\x8f\x2b\x3e\x2f\x5f\x6e\xe8\xde\x63\x61\x41\x71\x3c\x77\x32\x83\x69\x55\xf9\x71\x76\xe3\x31\x0e\xdc\x16\xd5\xc9\xe8\xc3\xcd\xe6\xcb\x0d\xb5\x91\xe5\x0b\xf2\xed\xf8\xa5\x0e\x15\x5c\xcb\x98\xa7\x05\xf9\x0c\xf2\x03\xb6\x3c\x52\xfa\x2f\x82\x57\xe9\x08\xde\x15\x31\x86\x8f\x35\xfa\x7d\x8c\x68\xfa\xe7\x2b\x58\x37\x11\x06\x57\x7b\x89\x61\x08\x9d\xaf\xb7\xac\x30\x2f\xf4\x80\x83\xeb\x77\x29\xb8\xfe\xea\x6a\xab\xe0\xea\x14\x00\xdc\x69\x2a\x80\xf6\x55\xac\x15\xd0\x16\xa8\x40\x20\x2c\x2b\x23\x08\xbb\xb0\x2c\xd0\x23\x84\xc2\xd5\x46\x81\xb3\x66\x0f\x2b\x84\x3e\x13\x72\x2e\xe7\x38\xb2\xf1\x7d\xba\x6c\x58\x77\x59\xc4\x85\xd8\x22\xac\x10\x2d\x73\x42\x58\xfc\xe3\xc8\xc9\x0f\x29\x72\xb2\x74\x24\x0c\x48\x57\x5b\x02\xb7\x86\x52\x04\x42\x0f\xb7\xaf\xe2\xab\xae\x00\x77\x12\x51\x61\x1c\x54\x28\x09\xd5\xe1\x2f\xe3\x3d\xa6\x1c\x24\xf4\x87\x83\xf9\x20\x05\xf3\xd7\xd5\xc6\x0b\x85\x40\x0e\x7e\xab\x57\xe8\x2d\x12\x06\xe8\x77\x07\xdd\x2b\xd0\x01\xac\x23\x08\x75\x55\x39\x1f\x03\x5c\x7b\x57\xb6\x2d\x06\xe3\x61\x9a\xd8\x27\x0e\xf6\x3f\xf2\xb1\xbf\x17\xcb\xff\x2c\x03\x0f\xf4\x8c\x23\x0f\x3f\xa5\xc8\x03\x36\xfd\x86\xf4\x28\x28\x76\x1a\x4a\x7b\x94\xe4\xfc\x1e\x9e\x75\xc2\x33\x46\xca\x17\xd8\xe5\x60\xf8\x73\x3a\x86\xb8\x43\x59\x37\xc1\xb4\x07\x53\xd3\xb3\x1d\xfb\xe1\x21\x74\xb8\x5a\xc6\xcb\xcd\x73\x10\xed\xf7\xd2\x21\xdd\xa0\x45\x7f\x28\x90\xba\x7d\x2b\x8f\xc1\xb1\x97\xe6\xd9\xb6\x59\x60\x26\xd1\x85\x87\x80\x2a\xe1\xc3\x3d\x81\xc6\x5e\x90\x5f\x64\x8f\x05\x5a\x12\x29\x88\xff\xa6\x6a\xd9\xab\xee\x8b\xec\xb1\x40\x4b\xa2\xf3\xd6\x42\x1b\x54\xf1\xe8\x6c\x76\x76\x04\x57\xa1\x0d\xa1\x80\xaa\x5e\x19\x2d\xe1\x03\xee\x21\x90\xd7\x76\x33\x84\xce\x47\x26\x92\x0f\x75\x82\x05\x6f\x12\xe1\x76\x8a\xec\xb8\x3b\x21\x54\x5e\x6f\xe3\xef\x18\x54\xdc\xef\x43\x28\x1e\x05\xed\xf9\x0e\xb0\x60\x4d\xa2\xbd\x4e\x51\x69\xab\x49\x0b\xa3\x3f\x9d\x36\xfb\x36\x52\xd6\x7f\xa1\x3d\xc8\x03\x16\xb0\x49\x04\x96\xb6\x5b\x61\xb4\x6a\x5b\xe3\xd8\x3b\xc7\x12\x91\xce\xb6\x33\x2b\x21\x3f\x1c\xda\xe7\xba\x9d\x43\x05\x6e\xf5\x17\x4a\x62\x62\x9d\xda\x29\x16\xfc\x49\x34\x96\xf3\xb2\xc0\x40\x4d\xe9\x34\x7d\x75\x54\x2e\xb5\xfd\xac\x5b\x98\x00\x9f\x6f\x96\x05\x61\x12\x79\x74\xea\xa5\x0f\x07\x32\x28\x87\x07\xf5\x87\x3b\x1d\xb8\x4a\xf4\x6c\xab\x2c\x00\x93\x68\xa3\xda\x7a\x94\x6e\x63\xf5\x27\x54\x30\xbd\xb9\x3e\x7e\x88\x69\xea\x82\x89\xde\x79\x26\x59\xbe\x45\x24\xd1\x40\x7b\x51\x9a\xc7\xad\xbb\xb3\x2c\x5e\x0e\xee\x8f\x3b\x8b\x6a\xe6\xca\x12\x2d\x85\x76\xd9\xac\xa4\xe3\x77\xb9\xb9\xdc\x4d\x55\xa9\xed\x69\xe9\x3f\x17\x8c\x16\x48\x51\x9b\x85\xe3\x9a\x17\xdb\x30\x77\x72\xe9\x9c\x09\x2f\xde\xc9\xda\x7b\xb4\xf4\x4e\xe1\x5a\xd4\x86\xba\x26\x84\x0c\x0e\x49\x9a\xc7\x61\x7c\xec\x28\x9f\xcf\xde\x4c\xfe\x0e\x00\x00\xff\xff\x4f\x29\xb2\x58\x39\x1c\x00\x00") - -func translationsDefaultLc_messagesEnUsLclAcsenginePoLclBytes() ([]byte, error) { - return bindataRead( - _translationsDefaultLc_messagesEnUsLclAcsenginePoLcl, - "translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", - ) -} - -func translationsDefaultLc_messagesEnUsLclAcsenginePoLcl() (*asset, error) { - bytes, err := translationsDefaultLc_messagesEnUsLclAcsenginePoLclBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x98\xdf\x53\xdb\x38\x10\xc7\xdf\x3b\xd3\xff\x61\xcf\x37\xd3\x69\xe7\x2a\xdb\x72\x42\x7e\x98\x84\x5e\x2f\x05\x8e\x1b\x28\x99\x26\xf4\x78\xf0\x0c\x23\xec\xc5\x51\x91\x25\x8f\x24\x33\x70\x7f\xfd\x8d\x13\xe3\xe4\xae\xa1\x05\x12\xfc\x00\xb1\x65\x69\xf5\x59\xed\x6a\xf5\xb5\x07\x1f\x6e\x33\x01\x37\xa8\x0d\x57\x72\xe8\x50\xd7\x77\x3e\xec\xbd\x7e\x35\x38\x1e\x9d\xc3\x24\x9e\x61\xc6\xbe\xde\x3f\xeb\xb8\xbe\x03\x9f\x59\x86\x43\x87\xc5\x06\x65\xca\x25\x3a\x30\x36\xfa\x28\x19\x3a\xd4\x81\x89\x8e\x47\x85\x18\x3a\x28\xc9\xd9\xc4\x81\xdb\x4c\x48\x33\x74\x66\xd6\xe6\xa1\xe7\x99\xb9\x2d\xe3\x66\x3c\xd6\xca\xa8\x2b\xeb\xc6\x2a\xf3\x84\x8a\x8d\x2d\x12\xae\xbc\xc0\xf7\x3b\x5e\xc7\x13\xf1\xad\xb3\xf7\xfa\x15\xc0\xe0\xc8\x62\x06\xe5\xbf\x85\xf5\x79\x23\xc0\x60\xac\x55\x6e\xaa\x1b\x80\xc1\xc4\xea\x0a\x69\x7c\x7a\x71\x82\x96\x25\xcc\x32\xdf\x81\xaf\x4c\x0c\x9d\x5f\x43\xc8\xaf\x53\xaf\x86\xf5\x16\x3f\x6e\xaa\xc2\xa0\xd5\x77\xc0\xfb\x89\x1d\x7a\x6f\xe7\x3d\xc4\xe4\x4a\xe9\x8c\xd9\xe5\xa0\x81\xb7\x44\x19\x78\x25\xe8\x1a\xee\x60\x13\x6e\x95\xa3\x66\x96\x2b\x69\xbc\xeb\xe2\x12\xb5\x44\x8b\xa6\xc8\x53\xcd\x12\xf4\xaa\xdf\x58\x14\xc6\xa2\x2e\x5d\xea\xd2\x26\x3c\x6a\x6d\x27\x12\x56\x33\x69\x4a\x80\x92\xbc\xdf\x48\x2c\xda\x2f\x40\x4e\x83\xa0\x09\xf4\x9d\x17\x4b\xa3\x1b\xda\x09\xaa\xeb\x79\x12\x51\xbf\x11\x87\x3a\x8d\x39\xd4\xf2\x9b\xf0\xa7\xdb\xe0\x3e\xef\x75\x9a\xf0\xa8\xb7\x9d\xdd\x72\xc5\x05\x1a\x76\xb3\x20\x0f\xda\x4d\x90\xf7\xb7\x7d\x56\x50\xda\x6f\x04\x9c\xfa\x8d\xed\x8a\x4e\xf7\x09\x0e\x3d\xa7\x8c\xf4\x1e\x51\x46\x82\x0d\x26\x08\xfa\x3b\x3f\x9f\xa0\xb5\x79\x48\xb6\x2e\x3c\x28\xed\x35\x72\xda\xd1\x8d\xa4\x07\xcb\x79\xf9\x27\x54\xbd\xde\xed\xba\xbd\x0a\xc3\x7f\x1f\x37\x52\x65\xe9\x96\xc4\x87\x31\xb3\x12\x7a\xe7\x11\x29\xb4\x05\xe8\x2d\xe9\x8e\x0a\xba\xdd\x4c\xf6\x34\xa7\x38\x82\x86\xf6\xc3\x46\x92\xe3\xbb\xfd\x40\x3b\xf4\x87\x1b\xa2\xdb\xcc\x86\xd8\x48\x77\xac\x2b\x4f\xad\x66\x04\x2d\xdd\x92\xbc\x58\xa9\xab\xbd\xa7\x1c\x69\xcf\x07\xdf\x4c\x5d\xfc\x3f\x8d\xfa\xbd\x1f\x66\xd1\x4e\x23\xaf\x74\xc1\x46\xba\xe3\x81\x43\xae\xf5\x42\xe4\xab\x84\x2b\x66\x47\x2a\xbf\xd3\x3c\x9d\xd9\x3f\xb1\x5c\xbc\x9a\x11\xf6\x65\x2a\xb8\x99\xc1\xfc\xb5\x4d\x2c\xaa\x12\x5c\x29\x0d\x2c\x36\x64\x41\x0c\x39\x8b\xaf\x59\x8a\xee\xca\xec\x0f\x5a\xae\xa1\xa1\x7e\x00\x6f\x47\xef\x20\xf0\x69\xf7\x31\xe3\x6b\xd1\x03\xd3\x19\x37\x50\xea\x63\xe0\x06\x12\x6e\xac\xe6\x97\x85\xc5\x04\x0a\x99\xa0\x06\x3b\x43\x30\x2c\x43\x10\x3c\x46\x69\x10\x98\x99\xb7\x3d\x93\xbb\xd6\x42\xf0\x17\x67\x32\xb5\x9c\x49\x38\xe6\xf0\x46\xd8\xdd\x6f\xf7\x0d\x82\xff\x3e\x53\x36\x63\x5c\xb8\xb1\xca\xde\xa4\x76\xf7\xfd\xdc\xaf\xf5\x13\x1c\x68\x95\x1d\x70\x81\x95\xe1\x4f\x61\x74\xa8\xfe\x56\xfa\x3a\x32\x3a\x8e\x52\x6e\x67\xc5\x65\x69\x26\xfa\xf8\x4f\xa1\x31\x5a\x62\x47\xab\xa1\x88\x12\xbc\x62\x85\xb0\xd1\xf1\xe8\xe2\x64\x7f\x32\xf9\x78\xb8\x3f\x89\xea\x94\x72\x73\xf5\xe0\xd4\x5f\x30\x57\x86\x5b\xa5\xef\x2a\x80\x95\x6f\x52\x6b\x86\x8c\x4f\x2f\x16\x0b\x51\xf5\x1e\x6b\xf5\x0d\x63\x4b\x8e\x12\x52\x7d\xe0\x0a\xa1\xb6\x10\xc9\xd2\xba\xb6\xe4\xc4\xa4\x3c\x21\x7f\x14\xa9\x21\x53\x15\x42\x24\xc7\xa7\x53\x32\xd2\x38\x87\x27\x9f\x98\xc5\x70\xbe\x42\xc4\xef\x92\x60\x07\x7c\x3f\xf4\xdb\xbf\xf9\xbe\xef\x97\x3d\xc9\x17\xbc\xe1\x66\x4d\xc7\x36\xd0\x6e\x18\xb4\x88\xdf\x2d\x3b\x1e\x33\x63\xc9\xb4\x5a\x13\xa5\xc3\x27\x05\xa8\x1c\x2e\xd3\x82\xa5\x48\xa6\xc8\xb2\xf0\x3e\xdf\x97\xed\x21\xa0\xbc\x38\x9b\x44\xf2\xe4\xe8\x64\x7f\xe9\x2b\x75\xfd\x48\x8e\x94\xb4\x28\x2d\x99\xde\xe5\x18\x82\xc5\x5b\xeb\xe5\x82\x71\xb9\x0b\xf1\x8c\x69\x83\x76\x78\x36\x3d\x20\xbd\x95\x8e\xf3\x8f\x1f\xa8\xc9\xbe\x8c\x55\xc2\x65\x1a\x42\xef\x92\xdb\x48\x8e\x45\xa1\x99\x20\x07\x4a\x67\x26\x04\x99\xcf\x6f\xcd\x30\xd8\x85\xc5\xe5\xf0\xad\x84\x5f\x86\x40\xdf\xed\x46\xf2\x9c\x1c\xa2\x2c\x15\x42\xe9\xec\x58\x61\xc2\x2d\x04\xae\xef\xb6\x22\xb9\x36\x74\x9f\x17\xc6\x4d\x15\xb9\xfa\x80\x5a\x96\x88\x81\x77\x3c\x3a\xdf\xfb\x37\x00\x00\xff\xff\xce\xf0\x3f\x78\xcb\x14\x00\x00") - -func translationsDefaultLc_messagesEnUsMetadataAcsenginePoXmlBytes() ([]byte, error) { - return bindataRead( - _translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml, - "translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml", - ) -} - -func translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml() (*asset, error) { - bytes, err := translationsDefaultLc_messagesEnUsMetadataAcsenginePoXmlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsEn_usLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x94\x4f\x8b\x5c\x45\x17\xc6\x9f\x99\xe9\xc9\x4c\xdf\xf7\xf5\x5f\xd4\x85\xa8\x78\x82\xb4\x49\x8c\xb7\xbd\xdd\x89\x4e\xec\x38\xc1\x38\xce\xc8\x68\x86\x0c\x63\x27\xb8\x0b\xd5\xf7\x9e\xe9\xae\xe4\x76\xd5\x4d\x55\xdd\xce\x74\x44\x57\x7e\x05\x97\x82\x2b\xc1\x4f\x21\x88\x08\x7e\x09\x51\x50\x70\x21\xb8\x16\x5c\x48\xdd\xba\x9d\x6e\x42\x04\x71\xe3\x66\x6a\x53\xdd\x75\x9f\x73\xce\xaf\x9e\x73\xa8\x1f\x4e\x36\x3e\x03\x80\xa7\x01\x3c\x07\xe0\x5b\x00\xcf\x03\xc8\x97\x50\xad\x1f\x97\x00\x02\xf0\xd3\x12\x70\x0e\xc0\xf2\x32\xb0\x03\xa0\xbd\x0c\xec\x02\x28\x97\x81\x37\x00\x7c\xbd\x0c\x6c\x02\xf8\x63\x19\xd8\x02\xb0\xb1\x02\x9c\x02\xf0\xd1\x0a\x70\x06\xc0\xe7\x2b\x40\x0b\xc0\x77\x2b\xc0\x33\x00\x7e\xab\xf7\x13\x0d\xa0\x0d\x80\x1a\xc0\xcb\x00\xae\x35\x42\x9d\x7b\x0d\xe0\x32\x80\x2f\x1b\xa1\xfe\x2f\x0d\xe0\x05\xaf\x5f\x0d\x9c\x2f\xad\x02\xcf\x02\xd8\x5a\x05\x3e\x5d\x02\x6e\xae\x06\xdd\xcf\x27\x42\xfc\xea\x5a\xe0\xec\xac\x05\xce\xa3\xb5\xc0\xf9\xcd\x5a\xe0\xfc\x73\x2d\x70\xf6\xd6\x03\xe7\x27\xeb\x81\xf3\x8b\xf5\xc0\xf9\xfd\x7a\xe0\xfb\xbd\xde\x9b\xcd\xc0\xf9\x62\x33\x70\x1e\x34\x43\x9d\x8f\x9b\x81\xf3\xab\x66\xa8\xff\x6b\x33\x70\x36\xa3\xc0\x79\x36\x0a\x9c\x3b\x11\xe0\x2d\xfd\xbf\xf7\x10\x40\xc3\xdf\x05\xc0\x9a\xd7\x02\x78\x0c\xc0\x49\xcc\x57\x54\xef\x4f\x01\x78\x02\xc0\x3a\x80\x27\x01\x3c\xea\xef\x06\xe0\x71\x00\x2b\x75\xdf\xfc\xfa\x1f\x80\x47\xf0\x90\xb5\x6d\x8c\x36\x64\x58\x64\x52\x0d\xe9\x50\xe6\x4c\x2d\xfb\x0a\x55\xc7\x3d\x6a\xd9\x5a\x70\x77\xe4\xbf\xdc\x29\xd9\x4c\xbd\xee\xca\xc1\x1e\x1d\x56\x71\x56\x97\x26\x65\xdb\xa3\xd6\xb9\x09\x76\x74\xa9\x32\xea\xce\x8f\xe9\xae\x74\x23\x72\xd3\xc2\x67\x25\xa9\xc8\x8d\x98\x1c\x8f\x8b\x5c\x38\x6e\x53\x7f\xc4\x86\xc9\x8e\x74\x99\x67\xa4\x55\x3e\xa5\x01\x53\xa7\x4e\xa3\xf4\xbf\xcb\x33\x12\x13\xa6\x01\xb3\xa2\x0e\xfa\xda\x89\x9c\x52\x5d\x2a\x47\xfa\x90\xc6\xc2\x3a\x36\x74\x63\xcf\xf3\x66\xc4\x47\x29\x73\xc6\xfe\x47\xc1\xa9\xe3\x2c\x28\xfd\x37\x5c\x2f\x86\x46\x64\x4c\x4e\xd3\xfb\xe5\x80\x8d\x62\xc7\x96\x3a\xed\xd7\xdb\x5d\x92\x96\x94\x76\x64\xcb\xa2\xd0\xc6\x87\x1d\x1a\x3d\xa6\x09\x1b\x2b\xb5\xaa\x4c\x7b\x78\xf4\x82\xe2\x1f\xe4\xe0\xca\xf8\xd4\xb0\x70\xde\xf2\x4c\x1a\x4e\x9d\x36\x53\x3a\xdd\xb2\xa7\x17\x14\x7c\xc4\x69\x59\x49\x66\x86\x54\xad\xa9\x5b\xd9\xa3\xd6\xa4\x16\x0e\x59\xb1\x09\xc9\xca\x19\x5f\x1d\xb1\x90\xae\x10\xc6\x2e\x8c\xc2\x42\xfc\x03\x43\x52\xc5\x1c\x0a\x99\x73\xe6\xef\x59\x81\x32\xe9\x82\x95\xb5\x23\x2a\xca\x41\x2e\x53\xba\xcd\x53\xb2\xce\x48\x35\xec\x51\xeb\xce\x82\xbc\x86\x61\x2a\x8c\x9c\xf8\xdd\x2b\x3d\xb7\xb5\xa3\x07\xa4\x52\x49\x27\x45\x2e\xef\xcd\x79\x67\xe1\xf5\x8c\x4a\x35\x11\xb9\xcc\x66\xf6\x79\x7f\x7d\xaa\x54\xab\xd9\xc9\x40\xa4\xb7\x83\xc5\xe5\xec\x8c\x33\xd2\x83\x5b\x9c\x3a\x68\x93\x8e\xd8\xba\x2a\x5f\xe5\xae\xef\x4e\xa9\xee\xf7\x06\x73\x63\xc3\xd5\x29\xd3\x1c\xfa\xc7\x47\xd2\x3a\x94\xca\x70\xaa\x87\x4a\xde\xe3\x8c\xae\xec\xef\xde\xa8\xab\xfa\x5c\x98\x8a\x71\xfe\x77\x81\xfb\x46\x7b\x82\x78\x37\x8b\x6f\xcc\x5a\x2f\x52\xcb\x6a\x28\x15\x47\x07\xec\xeb\xc7\x7b\x76\x28\xb3\xf8\xed\x72\x68\xe3\xbe\xee\x51\xb4\x7f\xad\x1f\x6f\x55\x63\xa1\x55\xfc\x4e\xd5\xbd\x6e\xd2\xd9\x88\x93\x8d\xb8\xfb\x1a\x25\x49\x2f\xb9\x70\x2e\x49\x92\x24\xda\xbf\x16\x1f\xf0\x44\xda\x87\xe8\x2e\x50\x67\xa3\xd7\x3d\x1f\x27\x1b\x49\x12\x5d\x15\xd6\xc5\x7d\x23\x94\xcd\x83\xa5\xef\x49\xa1\x86\x4e\x0a\x45\x57\x25\xbd\x79\x6b\xf6\x2f\x97\x6f\x8d\xb4\x1b\x0b\x99\xb7\x53\x3d\xbe\x1c\x5d\x15\x6a\x58\x8a\x21\xc7\x7d\x16\xe3\x1e\x6d\xab\x61\x2e\xed\xe8\xfe\x71\x8f\x58\xdd\xbc\xfe\x41\xb4\xb7\xbb\xb7\x3d\xbf\x5e\xa7\x9d\x44\x5b\x5a\x39\x56\x2e\xee\x4f\x0b\xee\x91\xe3\x23\xf7\x6a\x91\x0b\xa9\x2e\x51\x3a\x12\xc6\xb2\xdb\xbc\xde\xdf\x89\x2f\xce\x75\x9e\xed\x90\x4d\xbc\xad\x52\x9d\x55\xc3\x74\x71\x20\x5d\xb4\x9f\x97\x46\xe4\xf1\x8e\x36\x63\xdb\x23\x55\x54\x7f\xed\x66\xf7\x12\x85\x9f\x9b\x67\x14\x9d\xda\xa4\xce\xd9\x4b\xd1\x87\xf1\xbb\xf3\x91\xd9\xd7\x9c\x49\x47\xdd\x76\xd2\x3e\x1f\x1d\x3f\x81\xc7\x4f\xe0\xf1\x13\xf8\x9f\x3d\x81\x7f\x05\x00\x00\xff\xff\x15\x09\xe4\xac\x62\x0a\x00\x00") - -func translationsEn_usLc_messagesAcsengineMoBytes() ([]byte, error) { - return bindataRead( - _translationsEn_usLc_messagesAcsengineMo, - "translations/en_US/LC_MESSAGES/acsengine.mo", - ) -} - -func translationsEn_usLc_messagesAcsengineMo() (*asset, error) { - bytes, err := translationsEn_usLc_messagesAcsengineMoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/acsengine.mo", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsEn_usLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x6f\xdb\x36\x10\xfe\xee\x5f\x71\x8b\x61\xb4\x45\x23\x47\x92\x93\xd8\x51\x96\x61\x5d\x96\x0c\xd9\x1a\x2c\xc8\x9c\x62\x1f\x06\x0c\x34\x75\x96\x58\x4b\xa4\x4a\x52\x6e\xdc\x5f\x5f\x90\x92\xac\xbc\xd0\x2f\x71\xfa\x21\x10\x43\x1e\xef\x9e\xe7\x5e\xe9\x2e\x5c\xf0\x24\x63\x2a\x05\x2d\x09\x57\x19\xd1\x4c\x70\x05\x53\x21\x81\x50\xe5\x21\x4f\x18\x47\x28\x08\x9d\x91\x04\xfb\x9d\x2e\x9c\x8b\x62\x21\x59\x92\x6a\x78\x7b\xfe\x0e\x42\x3f\x18\x76\xba\x30\x4e\x99\x82\x29\xcb\x10\x98\x82\x98\x29\x2d\xd9\xa4\xd4\x18\x43\xc9\x63\x94\xa0\x53\x04\x45\x72\x84\x8c\x51\xe4\x0a\x81\x28\xbb\xe7\xb6\xf0\x27\x23\x3c\xd1\x8c\x70\xf8\xc8\xe0\xe7\xcf\xcd\x7f\x19\xfb\x35\x15\x3a\x27\x2c\xeb\x53\x91\xff\xb2\x6f\x6d\xf7\x3b\xdd\x4e\xae\x12\x16\xc3\xde\x9e\x59\x28\x2d\xcd\x6a\xef\x46\x8a\xcf\x48\xb5\x77\x15\x7b\x9f\x50\x2a\x26\x78\x64\xac\x55\xc6\xfe\xe3\x7b\x9d\xbd\x5b\x2c\x84\xd4\xde\xb5\xb9\xec\xfd\x56\x26\xca\x1b\x8b\x08\xec\xd1\xcd\xdf\x63\xef\x5c\xa2\x75\x85\xf7\x3b\xd1\x18\x59\x5b\x9e\x3f\xf4\xc2\x23\xf0\xfd\xc8\x3f\x7c\xef\xfb\xbe\x5f\x0b\x7b\xb7\x38\x67\xca\x21\x7b\x08\xc1\x30\x0a\x07\x9e\x3f\xac\x65\x3f\x12\xa5\xbd\x71\xed\x67\x21\xa3\x2d\xa9\xd6\x77\x79\x52\x92\x04\xbd\x31\x92\x3c\x6a\xa2\xf6\xe8\x28\x02\xe4\xff\xdf\xfd\x63\xf7\xae\xaf\xae\x2f\x5a\xea\x41\xbf\x02\x70\x2e\xb8\x46\xae\xbd\xf1\xa2\xc0\x08\x34\xde\xeb\x83\x22\x23\x8c\x9f\x02\x4d\x89\x54\xa8\xcf\xee\xc6\x97\xde\xe8\xb1\xac\xc1\x3b\x45\xe9\x5d\x70\x2a\x62\xc6\x93\x08\x46\x13\xa6\x2b\xf2\x59\x29\x49\xe6\x5d\x0a\x99\xab\x08\x78\x61\xff\x55\x67\xe1\x29\x54\xcb\xb3\xb7\x1c\x7e\x3a\x83\xe0\xdd\xa9\x15\xff\xd7\xfb\x03\x39\xca\x8a\xfb\x8d\xc0\x98\x69\x08\xfb\x7e\x7f\x60\x4e\x3b\xdd\x08\x8a\x59\x72\xb0\x0c\xd3\x41\xf5\xe9\x27\x22\x0a\x07\x27\x9d\xee\x3e\x50\x6f\x2a\x64\x4e\x74\x13\xf2\x0b\x29\x85\x04\x89\xc4\xc0\xaa\xf2\xaf\xa7\xf6\xc1\x6e\x47\xd0\x53\x6d\x4a\x6c\x96\x6c\xcc\x8b\xc2\x00\x34\x45\x70\x30\x2b\x27\x28\x39\x6a\x54\x65\x91\x48\x12\xe3\x41\xfd\xa5\x59\xa9\x34\x4a\x83\x6c\x18\xac\x06\xf6\x35\x35\x76\xbe\x94\x28\x17\xc6\xea\x87\xdb\x6b\x5b\x57\x12\x95\x28\x25\x45\x15\x41\xef\xfd\xfc\x29\xc6\x2d\x2f\x3d\xf7\x96\xad\x5f\x03\xc3\xc0\x3a\x71\xfa\xeb\x52\x94\x3c\x86\xb0\x55\x06\x5f\x99\x4e\x41\x2f\x0a\xe3\x0e\x60\xdc\x56\xa5\xc6\xbc\xc8\x88\xc6\x3e\x8c\x53\x94\x08\x2a\x15\x65\x16\x83\xe0\xd9\x02\x26\x08\x41\x8b\xf8\x47\xe9\xdb\x40\x26\x08\xc3\xd5\x6c\xb8\xd8\xcd\x7c\x4a\xe6\x08\x13\x44\xfe\x9c\xd0\x0f\x51\xb9\x55\x3e\xcd\x83\xe3\xb0\x5e\xdb\x6c\x0a\x7c\x27\xd3\xb1\xd0\x24\x03\x2a\x4a\xae\x41\x4c\x21\x27\x26\xfb\xe0\xd3\xb5\x49\x86\x18\xf0\x9e\x22\xc6\x68\x16\x05\x52\xd3\x75\xad\xa4\x39\x6b\x99\xbd\x42\xc5\x4e\x4c\x06\xbe\x8b\xc8\x5d\x25\x01\x5a\xc0\x5f\x4b\x15\x10\xf4\x8f\xfb\xa1\x99\x1c\x5c\x68\x50\x65\x61\x1a\x33\xc6\x30\x95\x22\x87\x79\xd3\xc2\x1e\x56\xf3\x2b\xd5\xec\x58\xea\xa3\xe3\xed\x29\x3d\xb0\xf7\x7a\x62\x2f\x54\xf6\xbc\x9a\x4c\xbf\x53\x64\x5e\xd1\x08\x0f\x5d\x34\xd0\x36\x1f\x6a\xa7\x1e\x4f\x20\x66\x12\xa9\x16\x72\x01\x6f\x7a\xea\xcd\x63\x90\x5b\x88\xae\xeb\xe5\x41\x70\xb2\x06\x01\xde\x23\x2d\xad\xde\xa6\xc8\x6c\xfb\xab\x3b\x76\x04\xbd\xf9\x53\x20\xdb\xdc\xd8\x29\x85\x8f\x87\xbb\xd5\xf0\x28\xdc\xe9\x5e\x78\x72\xb4\xda\x2d\x49\x35\x37\x0d\xcb\xb2\xc9\x91\x9a\xad\x2b\x38\x1b\xc5\xd7\x07\x68\xe4\x9c\x1e\x95\xea\x82\x48\xf5\x60\x86\xba\x22\xe2\x14\x59\x5a\x2c\x98\xf9\xcb\xc4\x92\xf7\xe1\x72\xbf\xc6\xfa\xf8\xd8\xd9\x48\xd0\x35\xcf\x5d\x9e\x70\x8a\x3c\x67\xaf\x54\x6a\x8c\x1d\x39\x43\x30\x25\x2c\xc3\xd8\x14\xa5\x4d\x7a\x04\x51\x20\x57\x2a\x85\xa2\x9c\x64\x8c\xc2\x0c\x17\x60\x9e\xbc\xe6\x69\xd4\xfb\xd2\x22\x78\xe9\xbd\x95\xb0\x0e\x9d\xf1\x68\xd5\xd7\xe1\x46\x28\x24\x9b\x9b\xaf\xd1\x6c\x8a\x40\xa9\x74\x15\xa4\xcd\x77\x76\xcb\x62\x77\xee\xb4\x76\x19\x67\x9a\x91\x8c\x7d\x6b\x53\xb2\xc1\xf2\xf4\xd1\xf6\xa2\x4b\x2b\xf3\x2b\x38\x0e\xd6\x26\xd8\xd0\x99\x60\x8c\xcf\x49\xc6\xe2\xa6\xb3\x9a\xd6\x6b\x9c\x43\x05\x6f\x76\x26\x84\xce\xaa\xee\x5b\x36\x7b\x18\x83\x98\x98\xdf\x1d\x2d\x87\xd7\xea\x59\x57\xa8\x03\xf7\xbb\x48\x48\x9a\xa2\xd2\xd6\x37\xb6\x27\x9b\xa1\x51\xf2\xe5\xc8\x68\xc1\x6d\x96\x5c\xdb\x27\x46\x43\x97\xf9\xb6\x0b\x57\x25\x07\xb1\xc0\x6a\x68\xe1\x3d\x53\x0f\x5c\xb3\x51\x70\x65\x48\x4f\x46\x6b\x23\x7a\xe4\x7c\x93\x97\x5c\x22\x15\x09\x67\xdf\x30\x86\x0f\x37\x57\xf5\x8f\x23\xcb\xbb\x05\xb5\x5e\x6a\x43\xdb\x1c\xb8\xec\x2e\x48\x9e\x6d\xf4\xc5\x5a\xa1\xef\x01\x00\x00\xff\xff\x14\x2c\x4e\x08\xa4\x0f\x00\x00") - -func translationsEn_usLc_messagesAcsenginePoBytes() ([]byte, error) { - return bindataRead( - _translationsEn_usLc_messagesAcsenginePo, - "translations/en_US/LC_MESSAGES/acsengine.po", - ) -} - -func translationsEn_usLc_messagesAcsenginePo() (*asset, error) { - bytes, err := translationsEn_usLc_messagesAcsenginePoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/acsengine.po", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsEn_usLc_messagesAcsenginePoLcg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6b\xf3\x36\x14\xc6\xef\x5f\x78\xbf\xc3\x99\x20\xf4\x62\x5b\x9c\x64\x5b\xb6\x05\x3b\x25\xa4\x1b\x84\xa5\x5b\x59\xd2\x52\x28\xbd\x50\xa4\x93\x58\xab\x2c\xb9\xfa\x93\x3a\xfd\xf4\x43\x76\xbc\x94\x31\x18\x0c\x89\xdd\xb4\x8e\x9c\x63\x3f\xbf\x73\xac\xf3\x1c\x27\xbf\x6e\x2a\x09\x47\x34\x56\x68\x55\x90\xf1\x70\x44\xae\xe7\x9f\x3f\xe5\xeb\xe5\x23\x6c\x58\x89\x15\x7d\xe8\xcf\x4d\x87\x23\x02\xbf\xd2\x0a\x0b\x42\x99\x45\x75\x10\x0a\x09\xdc\x59\xb3\xe2\x05\x19\x13\xd8\x18\xb6\xf4\xb2\x20\xa8\xbe\xbe\xdf\x10\x68\x2a\xa9\x6c\x41\x4a\xe7\xea\x59\x96\xd9\xf6\x5a\x76\x58\x09\x66\xb4\xd5\x7b\x37\x64\xba\xca\xa4\x66\xd6\x79\x2e\x74\x36\x19\x8d\xa6\xd9\x34\x93\xac\x21\xf3\xcf\x9f\x00\xf2\x95\xc3\x0a\xc2\x9f\xed\xa9\xc6\x82\x8c\x48\xfb\xe1\x7c\xab\xcb\x4d\xd7\x48\xf7\x05\x71\xc6\x63\x17\x07\x90\x6f\x9c\x81\x25\x75\x05\xd9\x62\xe3\xfa\x55\x80\xfc\x81\xca\x79\xfe\xc5\xd3\xf2\x66\xb1\x5d\x3c\xfd\x64\x8c\x36\x60\x90\x72\xa1\x0e\xb0\x17\x12\x61\x60\xbf\x82\x76\x79\x06\x03\xfb\xfc\x3c\xcf\xb3\x10\x71\xbe\x68\xb6\x71\xa6\x3f\xbe\x11\xb6\x86\x15\x0b\x39\xd9\x38\x43\x20\xeb\x14\x67\x41\xe0\xbf\x89\x9f\xc4\x13\xff\x56\x06\xd5\xaf\x1e\xcd\x29\x30\x2c\x7e\xbf\x85\x7d\xcb\x64\xb5\x37\x0c\xed\x0c\x06\x5f\x1e\x53\x71\x7c\x13\x83\xe3\x67\xed\x15\x87\xc9\x45\x32\xbc\x09\x57\x82\x3b\xd5\xa1\x1a\x20\x14\xb8\x12\xc1\x61\x55\x4b\xea\x70\x08\xdb\x12\x0d\x82\x2d\xb5\x97\x1c\xb4\x92\x27\xd8\x21\x8c\x53\x21\x7e\x1b\x0f\x51\xe9\xff\xc6\x58\xd2\x23\xc2\x0e\x51\xa5\xa3\xfc\x2e\x06\xe5\x56\x3b\x2a\x81\x69\xaf\x1c\xe8\x3d\x54\xd4\x3a\x34\xf0\x70\x1b\x9e\x41\x0e\xd8\x30\x44\x8e\xe1\xa0\x46\xe6\x90\x77\xdf\x0c\xe7\x52\x51\x4d\x63\x50\xdd\xd7\x07\x43\x39\x82\xd3\xf0\x8b\xdf\xa1\x51\xe8\xd0\xc2\x78\x38\x1d\x4e\x40\x58\x50\xda\x81\xf5\x75\xad\x4d\x40\xda\x1b\x5d\xf5\x7d\x34\x65\x03\xf9\x3e\x1d\xd9\x07\xf5\xff\x1f\xdf\x0f\x31\xf8\xb0\x6d\x90\xcc\x20\x75\xa1\x35\x72\x61\x90\x39\x6d\x4e\x70\x35\xb0\x57\x29\xd5\xff\x18\x4f\x3d\x36\xc8\x7c\x2b\xbf\x6f\x0e\x6d\x7b\x3f\x5b\xd5\x0c\x06\xc9\x7a\xfb\x78\x14\x8f\xe2\x80\x0a\x4d\x57\x05\xdf\x3f\x74\x67\x9c\x94\x75\x18\x47\x19\x12\x3a\x84\x9a\x1a\xfb\x61\x48\x48\x9a\xf9\x28\xe3\x01\xfe\xd3\x6c\x93\x34\xdb\x51\xa6\x81\x3d\x15\x12\x79\xe8\x49\xed\xc6\x45\xd0\x35\x2a\x6b\x4b\xa8\xfd\x4e\x0a\x06\x2f\x78\x02\xeb\x8c\x50\x87\x19\x0c\x5e\x93\xb1\x44\xb1\xfd\x0b\xcb\x79\x03\x20\xd4\x46\x1c\xc3\xff\x80\x11\x36\xb2\xb5\x65\x52\x8e\x28\xc6\x7e\xe1\x10\x4a\x38\x41\xa5\x78\xbf\x6c\xe0\x9e\x2d\xed\xc4\x3c\x8e\xe2\xe5\x42\x1d\xa9\x14\xbc\x77\xb0\x60\x71\xa1\x08\x4c\xab\x7e\x65\x47\xd9\x4b\xe7\x72\xbe\x5f\x43\x0e\x7a\xf7\x07\x32\x97\x8c\x2d\x8a\x9b\x6b\xc3\x4a\xb4\xae\xad\x44\xeb\x70\xc1\xbd\xbd\xfa\xcb\xbb\x93\xa9\x8f\xe2\xd5\x17\x77\xeb\x1a\x15\x70\x8d\xdd\xf0\x81\x8d\xb0\xe9\x52\x1f\xc5\xaa\xbd\x32\xc8\xf4\x41\x89\x77\xe4\xb0\xb8\x5b\x9d\x5f\x96\xdb\x2a\x24\x7b\x85\x8c\x62\xcf\x27\x5a\xc9\x24\x29\xff\xed\x4d\x21\x5f\xea\xaa\x42\xe5\x6c\x1f\xb6\xac\xdc\xf9\xa7\x83\x35\x6b\x16\xbc\x12\xea\x12\xfa\xf7\x80\x3c\x5b\x2f\x1f\xe7\x7f\x06\x00\x00\xff\xff\xac\xbb\x9e\xdd\x99\x10\x00\x00") - -func translationsEn_usLc_messagesAcsenginePoLcgBytes() ([]byte, error) { - return bindataRead( - _translationsEn_usLc_messagesAcsenginePoLcg, - "translations/en_US/LC_MESSAGES/acsengine.po.lcg", - ) -} - -func translationsEn_usLc_messagesAcsenginePoLcg() (*asset, error) { - bytes, err := translationsEn_usLc_messagesAcsenginePoLcgBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/acsengine.po.lcg", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsEn_usLc_messagesEnUsLclAcsenginePoLcl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x99\x51\x8f\x1a\x37\x10\xc7\xdf\x23\xe5\x3b\x4c\x57\x42\x79\x68\xcb\xc2\xb5\xa5\x2d\x02\x12\x44\x5a\xe9\x54\xd2\x9e\x0a\x39\x45\x4a\xf2\x60\xec\x81\x75\xe3\xb5\x37\xf6\x2c\x07\xf9\xf4\x95\x17\x36\x9c\xd4\x4a\x0d\x9c\xe7\xd4\x97\x3b\xaf\xf7\xbc\x33\xf3\x9b\x59\x7b\xfe\xb7\xa3\xe7\xbb\xd2\xc0\x16\x7d\xd0\xce\x8e\xb3\x7e\xb7\x97\x3d\x9f\x3c\x7d\x32\x9a\xcf\xde\xc0\x42\x16\x58\x8a\xdb\xf6\xde\xa0\xdb\xcb\xe0\x77\x51\xe2\x38\x13\x32\xa0\xdd\x68\x8b\x19\xdc\x04\x7f\xad\xc6\x59\x3f\x83\x85\x97\xb3\xda\x8c\x33\xb4\xdf\xbe\x5e\x64\xb0\xdc\xd0\xfd\xcb\x5d\x69\x6c\x18\x67\x05\x51\x35\xcc\xf3\xd0\x3c\x3a\x74\x4b\x2d\xbd\x0b\x6e\x4d\x5d\xe9\xca\xdc\x38\x19\xa8\x56\xda\xe5\x57\xbd\xde\x20\x1f\xe4\x46\xee\xb2\xc9\xd3\x27\x00\xa3\x6b\xc2\x12\xe2\x8f\xe5\xbe\xc2\x71\xd6\xcb\x9a\x8b\xa3\xe5\x93\x0f\x73\x14\xeb\x71\x46\xbe\xc6\xc3\x3a\x80\xd1\x82\x3c\xcc\x04\x8d\xb3\x25\xee\xa8\x9d\x05\x18\xdd\x0a\x33\x19\x7d\xf5\x76\xf6\x72\xba\x9c\xbe\xfd\xc5\x7b\xe7\xc1\xa3\x50\xda\x6e\x60\xad\x0d\x42\x27\x7c\x03\xcd\xf4\x10\x3a\xe1\xfd\xfb\xc9\x28\x8f\x2b\x3e\x2f\x5f\x6e\xe8\xde\x63\x61\x41\x71\x3c\x77\x32\x83\x69\x55\xf9\x71\x76\xe3\x31\x0e\xdc\x16\xd5\xc9\xe8\xc3\xcd\xe6\xcb\x0d\xb5\x91\xe5\x0b\xf2\xed\xf8\xa5\x0e\x15\x5c\xcb\x98\xa7\x05\xf9\x0c\xf2\x03\xb6\x3c\x52\xfa\x2f\x82\x57\xe9\x08\xde\x15\x31\x86\x8f\x35\xfa\x7d\x8c\x68\xfa\xe7\x2b\x58\x37\x11\x06\x57\x7b\x89\x61\x08\x9d\xaf\xb7\xac\x30\x2f\xf4\x80\x83\xeb\x77\x29\xb8\xfe\xea\x6a\xab\xe0\xea\x14\x00\xdc\x69\x2a\x80\xf6\x55\xac\x15\xd0\x16\xa8\x40\x20\x2c\x2b\x23\x08\xbb\xb0\x2c\xd0\x23\x84\xc2\xd5\x46\x81\xb3\x66\x0f\x2b\x84\x3e\x13\x72\x2e\xe7\x38\xb2\xf1\x7d\xba\x6c\x58\x77\x59\xc4\x85\xd8\x22\xac\x10\x2d\x73\x42\x58\xfc\xe3\xc8\xc9\x0f\x29\x72\xb2\x74\x24\x0c\x48\x57\x5b\x02\xb7\x86\x52\x04\x42\x0f\xb7\xaf\xe2\xab\xae\x00\x77\x12\x51\x61\x1c\x54\x28\x09\xd5\xe1\x2f\xe3\x3d\xa6\x1c\x24\xf4\x87\x83\xf9\x20\x05\xf3\xd7\xd5\xc6\x0b\x85\x40\x0e\x7e\xab\x57\xe8\x2d\x12\x06\xe8\x77\x07\xdd\x2b\xd0\x01\xac\x23\x08\x75\x55\x39\x1f\x03\x5c\x7b\x57\xb6\x2d\x06\xe3\x61\x9a\xd8\x27\x0e\xf6\x3f\xf2\xb1\xbf\x17\xcb\xff\x2c\x03\x0f\xf4\x8c\x23\x0f\x3f\xa5\xc8\x03\x36\xfd\x86\xf4\x28\x28\x76\x1a\x4a\x7b\x94\xe4\xfc\x1e\x9e\x75\xc2\x33\x46\xca\x17\xd8\xe5\x60\xf8\x73\x3a\x86\xb8\x43\x59\x37\xc1\xb4\x07\x53\xd3\xb3\x1d\xfb\xe1\x21\x74\xb8\x5a\xc6\xcb\xcd\x73\x10\xed\xf7\xd2\x21\xdd\xa0\x45\x7f\x28\x90\xba\x7d\x2b\x8f\xc1\xb1\x97\xe6\xd9\xb6\x59\x60\x26\xd1\x85\x87\x80\x2a\xe1\xc3\x3d\x81\xc6\x5e\x90\x5f\x64\x8f\x05\x5a\x12\x29\x88\xff\xa6\x6a\xd9\xab\xee\x8b\xec\xb1\x40\x4b\xa2\xf3\xd6\x42\x1b\x54\xf1\xe8\x6c\x76\x76\x04\x57\xa1\x0d\xa1\x80\xaa\x5e\x19\x2d\xe1\x03\xee\x21\x90\xd7\x76\x33\x84\xce\x47\x26\x92\x0f\x75\x82\x05\x6f\x12\xe1\x76\x8a\xec\xb8\x3b\x21\x54\x5e\x6f\xe3\xef\x18\x54\xdc\xef\x43\x28\x1e\x05\xed\xf9\x0e\xb0\x60\x4d\xa2\xbd\x4e\x51\x69\xab\x49\x0b\xa3\x3f\x9d\x36\xfb\x36\x52\xd6\x7f\xa1\x3d\xc8\x03\x16\xb0\x49\x04\x96\xb6\x5b\x61\xb4\x6a\x5b\xe3\xd8\x3b\xc7\x12\x91\xce\xb6\x33\x2b\x21\x3f\x1c\xda\xe7\xba\x9d\x43\x05\x6e\xf5\x17\x4a\x62\x62\x9d\xda\x29\x16\xfc\x49\x34\x96\xf3\xb2\xc0\x40\x4d\xe9\x34\x7d\x75\x54\x2e\xb5\xfd\xac\x5b\x98\x00\x9f\x6f\x96\x05\x61\x12\x79\x74\xea\xa5\x0f\x07\x32\x28\x87\x07\xf5\x87\x3b\x1d\xb8\x4a\xf4\x6c\xab\x2c\x00\x93\x68\xa3\xda\x7a\x94\x6e\x63\xf5\x27\x54\x30\xbd\xb9\x3e\x7e\x88\x69\xea\x82\x89\xde\x79\x26\x59\xbe\x45\x24\xd1\x40\x7b\x51\x9a\xc7\xad\xbb\xb3\x2c\x5e\x0e\xee\x8f\x3b\x8b\x6a\xe6\xca\x12\x2d\x85\x76\xd9\xac\xa4\xe3\x77\xb9\xb9\xdc\x4d\x55\xa9\xed\x69\xe9\x3f\x17\x8c\x16\x48\x51\x9b\x85\xe3\x9a\x17\xdb\x30\x77\x72\xe9\x9c\x09\x2f\xde\xc9\xda\x7b\xb4\xf4\x4e\xe1\x5a\xd4\x86\xba\x26\x84\x0c\x0e\x49\x9a\xc7\x61\x7c\xec\x28\x9f\xcf\xde\x4c\xfe\x0e\x00\x00\xff\xff\x4f\x29\xb2\x58\x39\x1c\x00\x00") - -func translationsEn_usLc_messagesEnUsLclAcsenginePoLclBytes() ([]byte, error) { - return bindataRead( - _translationsEn_usLc_messagesEnUsLclAcsenginePoLcl, - "translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", - ) -} - -func translationsEn_usLc_messagesEnUsLclAcsenginePoLcl() (*asset, error) { - bytes, err := translationsEn_usLc_messagesEnUsLclAcsenginePoLclBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x58\x6d\x6f\xdb\x36\x10\xfe\x5e\xa0\xff\xe1\xa6\x01\x45\x8b\x95\x12\x29\x3b\x7e\x51\xec\x74\x9d\x9b\x64\x19\x92\xc6\xa8\x9d\x2e\x1f\x04\x04\x8c\x74\x91\xd9\x48\xa4\x40\x52\x41\xb2\x5f\x3f\xc8\x56\x64\x6f\x75\xda\x24\x76\xf4\xc1\x96\x44\x91\x77\xcf\xbd\xf2\x11\x07\x1f\x6e\xb3\x14\x6e\x50\x1b\xa1\xe4\xd0\x61\x2e\x75\x3e\xec\xbd\x7e\x35\x38\x1e\x9d\xc3\x24\x9a\x61\xc6\xbf\xde\xbf\xeb\xb8\xd4\x81\xcf\x3c\xc3\xa1\xc3\x23\x83\x32\x11\x12\x1d\x18\x1b\x7d\x14\x0f\x1d\xe6\xc0\x44\x47\xa3\x22\x1d\x3a\x28\xc9\xd9\xc4\x81\xdb\x2c\x95\x66\xe8\xcc\xac\xcd\x03\xcf\x33\x73\x59\xc6\xcd\x44\xa4\x95\x51\x57\xd6\x8d\x54\xe6\xa5\x2a\x32\xb6\x88\x85\xf2\x7c\x4a\x3b\x5e\xc7\x4b\xa3\x5b\x67\xef\xf5\x2b\x80\xc1\x91\xc5\x0c\xca\xbf\x85\xf4\xf9\x20\xc0\x60\xac\x55\x6e\xaa\x07\x80\xc1\xc4\xea\x0a\xd2\xf8\xf4\xe2\x04\x2d\x8f\xb9\xe5\xd4\x81\xaf\x3c\x1d\x3a\xbf\x06\x90\x5f\x27\x5e\x0d\xd6\x5b\x5c\xdc\x44\x05\x7e\xab\xef\x80\xf7\x13\x39\xec\x5e\xce\x7b\x88\xc8\x95\xd2\x19\xb7\xcb\x45\x03\x6f\x09\x65\xe0\x95\x40\xd7\xe0\xf6\x37\xc1\xad\x72\xd4\xdc\x0a\x25\x8d\x77\x5d\x5c\xa2\x96\x68\xd1\x14\x79\xa2\x79\x8c\x5e\x75\x8d\xd2\xc2\x58\xd4\xa5\x49\x5d\xd6\x84\x45\xad\xed\x44\xc2\x6a\x2e\x4d\x09\xa0\x44\xde\x6f\x24\x16\xed\x17\x40\xce\x7c\xbf\x09\xe8\x3b\x2f\x96\x46\x37\xac\xe3\x57\xf7\xf3\x24\x62\xb4\x11\x83\x3a\x8d\x19\xd4\xa2\x4d\xd8\xd3\x6d\xb0\xce\x7b\x9d\x26\x2c\xea\x6d\xa7\x5a\xae\x44\x8a\x86\xdf\x2c\x90\xfb\xed\x26\x90\xf7\xb7\xbd\x57\x30\xd6\x6f\x04\x38\xa3\x8d\x55\x45\xa7\xfb\x04\x83\x9e\xd3\x46\x7a\x8f\x68\x23\xfe\x06\x0a\xfc\xfe\xce\xcf\x15\xb4\x36\x0f\xc9\xd6\x89\x07\x63\xbd\x46\x76\x3b\xb6\x11\xf5\xe0\xb9\x28\x7f\xa9\xaa\xfd\xdd\xae\xc7\xab\x30\xfc\xf7\x75\x23\x5d\x96\x6d\x89\x7c\x18\x33\x2b\x41\xef\x3c\x22\x85\xb6\x00\x7a\x4b\xbc\xa3\x02\xdd\x6e\x26\x7b\x9a\x63\x1c\x7e\x43\xf5\xb0\x11\xe5\xf8\xae\x1e\x58\x87\xfd\xb0\x20\xba\xcd\x14\xc4\x46\xbc\x63\x5d\x7b\x6a\x35\x43\x68\xd9\x96\xe8\xc5\x4a\x5f\xed\x3d\x65\x4b\x7b\x3e\xf0\xcd\xd8\xc5\xff\xd3\xa8\xdf\xfb\x61\x16\xed\x34\xf2\x49\xe7\x6f\xc4\x3b\x1e\xd8\xe4\x5a\x2f\x84\x7c\x15\xe1\x8a\xd8\x91\xca\xef\xb4\x48\x66\xf6\x4f\x2c\x9d\x57\x63\x84\x7d\x99\xa4\xc2\xcc\x60\xfe\xd9\x96\x2e\xba\x12\x5c\x29\x0d\x3c\x32\x64\x81\x18\x72\x1e\x5d\xf3\x04\xdd\x15\xed\x0f\x4a\xae\x41\x43\xfd\x02\xde\x8e\xde\x81\x4f\x59\xf7\x31\xeb\x6b\xd2\x03\xd3\x99\x30\x50\xf2\x63\x10\x06\x62\x61\xac\x16\x97\x85\xc5\x18\x0a\x19\xa3\x06\x3b\x43\x30\x3c\x43\x48\x45\x84\xd2\x20\x70\x33\x1f\x7b\x26\xee\x9a\x0b\xc1\x5f\x82\xcb\xc4\x0a\x2e\xe1\x58\xc0\x9b\xd4\xee\x7e\xbb\x1f\x48\xc5\xef\x33\x65\x33\x2e\x52\x37\x52\xd9\x9b\xc4\xee\xbe\x9f\xdb\xb5\x5e\xc1\x81\x56\xd9\x81\x48\xb1\x12\xfc\x29\x08\x0f\xd5\xdf\x4a\x5f\x87\x46\x47\x61\x22\xec\xac\xb8\x2c\xc5\x84\x1f\xff\x29\x34\x86\x4b\xd8\xe1\x6a\x28\x42\x94\x17\x67\x93\xf0\x78\x74\x71\xb2\x3f\x99\x7c\x3c\xdc\x9f\x84\x75\x42\xb9\xb9\x7a\x50\xf1\x17\xcc\x95\x11\x56\xe9\xbb\x4a\xfd\xca\x89\xd4\x9a\x25\xe3\xd3\x8b\x85\x1b\xaa\xd9\x63\xad\xbe\x61\x64\xc9\x51\x4c\xaa\xe3\xad\x00\x6a\x09\xa1\x2c\xa5\x6b\x4b\x4e\x4c\x22\x62\xf2\x47\x91\x18\x32\x55\x01\x84\x72\x7c\x3a\x25\x23\x8d\x73\xe8\xe4\x13\xb7\x18\xcc\xfd\x43\x68\x97\xf8\x3b\x40\x69\x40\xdb\xbf\x51\x4a\x69\x39\x93\x7c\xc1\x1b\x61\xd6\x4c\x6c\x03\xeb\x06\x7e\x8b\xd0\x6e\x39\xf1\x98\x1b\x4b\xa6\x95\x47\x94\x0e\x9e\x14\x9e\x72\xb9\x4c\x0a\x9e\x20\x99\x22\xcf\x82\xfb\x6c\x5f\x8e\x07\xb0\x70\xb0\x3c\x39\x3a\xd9\x5f\xda\xca\x5c\x1a\xca\x91\x92\x16\xa5\x25\xd3\xbb\x1c\x03\xb0\x78\x6b\xbd\x3c\xe5\x42\xee\x42\x34\xe3\xda\xa0\x1d\x9e\x4d\x0f\x48\x6f\x65\xe2\xfc\xe8\x03\x35\xd9\x97\x91\x8a\x85\x4c\x02\xe8\x5d\x0a\x1b\xca\x71\x5a\x68\x9e\x92\x03\xa5\x33\x13\x80\xcc\xe7\x8f\x66\xe8\xef\xc2\xe2\x76\xf8\x56\xc2\x2f\x43\x60\xef\x76\x43\x79\x4e\x0e\x51\x96\xfc\xa0\x34\x76\xac\x30\x16\x16\x7c\x97\xba\xad\x50\xae\x0d\xdd\xe7\x85\x70\x53\x45\xae\xde\x9e\x96\x0d\x62\xe0\x1d\x8f\xce\xf7\xfe\x0d\x00\x00\xff\xff\xeb\x49\x8e\x42\xc9\x14\x00\x00") - -func translationsEn_usLc_messagesEnUsMetadataAcsenginePoXmlBytes() ([]byte, error) { - return bindataRead( - _translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml, - "translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml", - ) -} - -func translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml() (*asset, error) { - bytes, err := translationsEn_usLc_messagesEnUsMetadataAcsenginePoXmlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsZh_cnLc_messagesAcsengineMo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x54\xdf\x6f\x13\xd9\x15\xfe\x92\x38\x24\x71\x7f\xd3\x22\xb5\x6a\xab\xde\x56\x72\xa1\xa5\xe3\xda\x69\x4b\xa8\x5b\x10\x34\x85\x2a\x2d\x29\x51\x64\x50\x5f\x2a\x3a\x99\xb9\xb1\x2f\x8c\x67\xcc\xdc\x19\x93\xa4\x52\x15\x50\x20\x89\x48\x08\xad\xf2\x83\x24\x4e\xd2\xd0\x86\x20\x1a\x70\xa0\x2a\x72\x13\x10\x2f\x55\x5f\xf6\x69\xff\x81\xd5\xae\xf0\x8c\x1d\x69\x57\x3c\xef\xd3\xae\xee\x8c\x7f\x6d\x36\xbb\x42\x3b\x2f\xd7\xbe\xe7\xfb\xce\xfd\xce\x77\x8e\xce\x5b\xfb\x03\x33\x00\x70\x00\xc0\xb7\x00\xfc\x0f\xc0\xb7\x01\x68\x0d\xf0\xbe\xb7\x1b\x00\x02\xe0\x9d\x06\xe0\x30\x80\xc6\x46\xe0\x34\x80\x70\x23\xd0\x05\xc0\x6e\x04\x7e\x0e\xe0\x45\x23\x70\x0c\xc0\xfb\x8d\x40\x27\x80\x8e\x26\xe0\xbb\x00\xfe\xdc\x04\x1c\x02\xb0\xd4\x04\x84\x00\xfc\xbf\x09\xf8\x06\x80\x77\xcb\xe7\xbe\x00\x10\x06\x40\x02\xc0\x0f\x01\x9c\x0d\xf8\xef\x0c\x05\x80\xe3\x00\xee\x05\xfc\xf7\x9d\x00\xf0\x1d\x81\x6f\xf6\x75\x7e\xbf\x19\xf8\x26\x80\xce\x66\xe0\x8f\x0d\xc0\x85\x66\x3f\xff\xf3\x7d\x3e\xee\xe5\x3e\x5f\x57\x53\x0b\x70\x04\xc0\xb1\x16\x20\x02\xc0\x6a\xf1\xf3\xaf\xb5\x00\x12\x80\x37\x5b\xfc\x7a\x3f\x68\x01\xbe\x27\x6a\x6f\xf5\xf9\x27\x5a\xfd\xfb\x3f\x95\xcf\xbf\xb4\xfa\x3a\xb3\xad\x7e\x5d\x6f\xb4\x02\x07\x01\xbc\xd7\xea\xbf\x73\xa0\x0d\xf8\xba\xd0\xdf\xe6\xd7\x95\x6c\xf3\xf3\x5c\x2b\xdf\xdf\x6d\x03\x84\xa5\x9f\x17\x1e\x02\x08\x88\x5a\x00\xb4\x00\x68\x03\xf0\x25\x00\xfb\x51\xfb\x82\xe5\xf3\x6b\x00\xbe\x02\xa0\x15\xc0\x57\x01\x7c\x11\x40\x33\x80\x2f\x8b\xda\xca\x7d\x13\xdf\xe7\x00\x7c\x01\x7b\x7c\xa7\x4c\xd3\x30\x89\x49\x65\x95\xe9\x09\xd2\xcf\x34\x4a\x42\xfc\x47\xc4\xbb\x8e\x91\x10\x2f\x03\xae\x24\x45\xe4\xb2\x4d\xcd\x41\x81\x3b\xd9\xdb\x4d\xfa\x3d\x1e\x37\x6c\x53\xa1\x3c\x46\x42\x87\x33\x38\x6d\xd8\xba\x4a\xda\x6b\xd7\xe4\x0a\xb3\x92\xc4\x1a\x4c\x8b\xac\x84\xe9\xc4\x4a\x52\x62\xd1\x54\x5a\x93\x2d\x1a\x26\xf1\x24\x35\x29\xe1\x49\xc3\xd6\x54\x62\xe8\xda\x20\xe9\xa3\x24\x5a\x4e\xa3\x1b\x9f\x2d\x4f\x52\xce\x50\xd2\x47\xa9\x4e\xa2\x88\x1b\x96\xac\x11\xc5\xb0\x75\x8b\x18\xfd\x24\x25\x73\x8b\x9a\xe4\x7c\xb7\xd0\xab\x12\x3a\xa0\x50\xaa\x52\xf1\x23\x4d\x15\x8b\xaa\x3e\x52\xc4\x70\x2e\x9d\x30\x65\x95\x12\xcb\x20\xbf\xb3\xfb\xa8\xa9\x53\x8b\x72\x12\x0d\x1f\x09\xb7\x13\xc6\x89\x6e\x58\x84\xdb\xe9\xb4\x61\x0a\x5a\xbf\x69\xa4\x48\x86\x9a\x9c\x19\xba\x67\xda\xde\xec\x3a\xc4\x6b\xe4\xa0\x9e\xf1\x8a\x49\x65\x4b\x58\xae\x32\x93\x2a\x96\x61\x0e\x92\x83\x21\x7e\xb0\x0e\x41\x07\xa8\x62\x7b\x90\x8a\x21\x5e\x6b\xca\xad\x8c\x91\x50\xa6\x0c\x4c\x50\x9d\x9a\x7e\x32\xbb\xa2\xaf\xcc\xa8\x4b\x97\x96\x4d\x5e\x37\x0a\x75\xfc\x5d\x43\xe2\x71\xfa\x65\xa6\x51\x55\xd4\xe9\x09\xa5\xc4\x48\x53\x9d\xf3\x24\x49\xdb\x7d\x1a\x53\xc8\x25\x3a\x48\xb8\x65\x32\x3d\x11\x23\xa1\xcb\x75\xf0\xb2\x18\x4a\xd2\x26\xcb\x88\x53\x20\x85\x6e\xce\x93\xbb\xa0\x4c\x67\x16\x93\x35\x36\x54\xd3\x5b\xa1\x97\x67\x94\xe9\x19\x59\x63\x6a\xc5\x3e\xe1\xaf\x48\xa5\x18\x7a\xe5\xa6\x4f\x56\x2e\xf9\x16\xdb\x95\x3b\xaa\x12\xa3\xef\x22\x55\x2c\x18\xa6\x92\xa4\xdc\xf2\xf2\x79\xee\x8a\xee\xd8\x7a\xb5\x37\xa8\x19\xeb\x97\x4e\x54\x83\xfa\xfd\xa3\x03\x8c\x5b\xb0\x75\x93\x2a\x46\x42\x67\x43\x54\x25\x27\x7b\xba\xce\x97\x5f\x15\xb9\x30\x28\xa7\xb4\x4f\x22\xf6\x98\x86\x50\x20\x75\xa9\xd2\xf9\x4a\xeb\x83\xbd\x54\x3c\x2b\x75\xf3\x04\x53\xa5\x5f\xd9\x09\x2e\xc5\x8d\x18\x09\xf6\x9c\x8d\x4b\x9d\xde\x34\x18\xba\xf4\x6b\xaf\x69\xed\x91\x68\x87\x14\xe9\x90\xda\x7f\x46\x22\x91\x58\x34\x7a\x38\x12\x89\x44\x82\x3d\x67\xa5\x5e\x9a\x61\x7c\x0f\xdc\x4f\x49\xb4\x23\xd6\x1e\x95\x22\x1d\x91\x48\xf0\x8c\xcc\x2d\x29\x6e\xca\x3a\xd7\x7c\x27\x7f\xcb\x64\x3d\x61\x31\x59\x27\x67\x18\xf9\xe5\xc5\xca\x3f\x8d\x9d\x48\x1a\x56\x4a\x66\x5a\x58\x31\x52\xc7\x83\x67\x64\x3d\x61\xcb\x09\x2a\xc5\xa9\x9c\x8a\x91\xce\x24\xd3\x29\xa7\xe4\x10\x67\xa9\xb4\xc6\xfa\x19\x55\x7f\x50\xc5\xc4\xc8\x50\xf2\x42\xe7\xef\x83\xdd\x5d\xdd\xa7\x6a\x25\x46\xc3\x91\x60\xa7\xa1\x5b\x54\xb7\xa4\xf8\x60\x9a\xc6\x88\x45\x07\xac\x1f\xa7\x35\x99\xe9\xbf\x20\x4a\x52\x36\x39\xb5\x8e\x9d\x8b\x9f\x96\x8e\xd6\x70\x42\x68\x3f\x35\xa5\x53\xba\x62\xa8\xde\x40\x1d\xed\x63\x56\xf0\x0f\xd2\x6f\x6a\xb3\xd0\x63\x50\x95\x59\xa4\x3d\x1c\x09\xff\x24\x08\x77\x76\xb4\xb0\xfd\x94\x84\xf8\xab\x67\x13\x3b\xd3\xf3\xa5\x5c\xae\x94\xdb\x76\xa6\x66\xdd\xb9\xa7\xce\xe8\xd6\xce\xf4\xbc\x37\x3c\xee\xca\x5a\x29\x77\xf7\x64\x6f\x77\xe9\x3f\x23\xee\xd6\xed\x6a\xf0\xd5\xb3\x05\x6f\xa9\xb9\xf7\x57\xdd\xa5\x17\xce\xd4\x5f\x8b\xb7\x36\x0b\xf9\x7f\x16\xf2\x0f\x8a\x8f\xb7\x9d\xe5\x9b\x21\x4e\x8a\x0b\x23\x3e\xe9\xe5\xf0\x35\x67\x6b\xba\x94\x5b\x73\xa6\x1e\xb8\xd9\xf1\x42\x7e\xb8\x90\x7f\x50\x66\xba\x4f\x56\xdd\xec\xb8\xcf\xff\x14\x66\x8d\x56\xc8\x6f\x97\xe6\x17\xdc\x9b\x2b\x6e\x76\xcb\x1d\xde\x76\x67\x36\xbd\x6d\x55\x7a\x7a\xbd\xf4\x62\xd4\xcd\xae\xb8\xd9\xc5\xe2\xc2\x88\x3b\xb3\x59\x5c\x7c\xe4\xed\xaa\xe2\xf8\x98\x9b\xdd\x08\x71\x52\xc8\x4f\xba\xd3\x39\x77\xe2\xaa\x33\x39\x5a\xdc\x5a\x77\xc6\x36\x77\xef\xae\xd7\xc3\x56\x40\x70\xc6\x16\x9d\xed\xad\xe2\xe2\x23\xe7\xf9\x8c\x18\xdf\x5d\xce\x8d\xaf\x97\x56\x27\xaa\x2e\x93\x50\x86\x94\x4b\xae\xc0\x3e\x06\xd9\x1d\x2f\xad\xff\xc3\x5d\xbe\x5d\x8d\xc7\xbc\x1c\xb5\xa8\xdf\xae\xba\x68\x9d\x04\x14\xa7\x57\xdc\xb1\xdb\xd5\x8d\xe3\x5c\xdf\x70\x9e\x0d\x3b\xb9\x1b\x3b\x7f\x5b\x73\x1e\xce\x15\x37\xee\x15\xf2\x4f\xaa\x6a\x2f\x57\xe0\x02\x5a\x5c\xbf\x2a\x5a\xe2\x43\x6b\x08\x67\x6c\xc9\x59\xbf\xe9\x4c\xcc\xfa\x2a\x7d\x82\x33\x7f\xff\xa3\x23\xc1\x51\xc8\xdf\x72\x16\x97\xdd\x3b\xb9\x9d\xa5\x65\xdf\x2a\x67\x62\xb6\xb8\x30\xe2\xe4\xfe\x5b\x7a\xbc\x2a\x5a\xfb\x7c\xc3\x9d\xbc\x5b\x5c\x18\xf1\xa3\xee\xdc\xdf\xdd\x99\x31\xc1\x0c\x71\xb2\x73\x7d\x52\xa4\xbc\x93\x2b\xe4\x27\x9d\xa9\x39\xbf\x07\x95\x51\xa9\xfa\x24\x82\x0f\xef\x38\xd9\xfb\x10\xe4\x7f\xcf\x94\x72\x37\x9c\xb1\x7f\x15\x17\x46\xf6\x5e\x2f\x7b\x11\x3f\x0c\x00\x00\xff\xff\xde\xb6\x6a\xfc\xbb\x09\x00\x00") - -func translationsZh_cnLc_messagesAcsengineMoBytes() ([]byte, error) { - return bindataRead( - _translationsZh_cnLc_messagesAcsengineMo, - "translations/zh_CN/LC_MESSAGES/acsengine.mo", - ) -} - -func translationsZh_cnLc_messagesAcsengineMo() (*asset, error) { - bytes, err := translationsZh_cnLc_messagesAcsengineMoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/acsengine.mo", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsZh_cnLc_messagesAcsenginePo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x4f\x23\xd7\x15\xfe\xce\xaf\x38\x02\x59\x49\x94\x1d\xe3\x31\x0b\x06\xf7\x45\xdd\xd2\x4d\xb5\x6d\x68\x11\x72\xa2\x7e\xa8\x54\x8d\x67\x8e\x3d\x37\x8c\xef\x9d\xbd\xf7\x8e\x83\xf7\x13\xa9\xd8\x00\x5a\x08\xdb\x8a\x97\xe5\x65\x21\xa4\xdd\xb2\xda\x92\x98\xa4\xea\xca\x85\x8d\xf2\x63\xea\x19\x9b\x4f\xf9\x0b\xd5\x9d\xf1\x1b\x30\x98\x14\xe5\x03\x9a\xe1\xde\x73\xe7\x3c\xe7\x39\xe7\x3c\xe7\x7a\x08\x26\x6d\x42\x51\x20\x48\x6e\x50\xe1\x18\x92\x30\x2a\xa0\xc0\x38\x18\xa6\xd0\x90\x16\x09\x45\x70\x0d\x73\xd6\x28\x62\x72\x60\x08\x26\x99\x5b\xe1\xa4\x68\x4b\x78\x7b\xf2\x1d\x48\xa7\xf4\xcc\xc0\x10\xe4\x6c\x22\xa0\x40\x1c\x04\x22\xc0\x22\x42\x72\x92\xf7\x24\x5a\xe0\x51\x0b\x39\x48\x1b\x41\x18\x25\x04\x87\x98\x48\x05\x82\x21\xc2\xb5\x78\x0f\xbf\x21\x06\x2d\x4a\x62\x50\x78\x9f\xc0\x4f\x3f\x6a\xff\xe7\x90\x5f\xd8\x4c\x96\x0c\xe2\x24\x4d\x56\xfa\xf9\x9d\xd0\x77\x72\x60\x68\xa0\x24\x8a\xc4\x82\xc1\x41\xf5\x22\x24\x57\x6f\x83\xd3\x9c\x7d\x84\xa6\xd4\x1e\x58\xda\x87\xc8\x05\x61\x34\x0b\x7f\xa4\x83\x03\x83\x33\xe8\x32\x2e\xb5\x29\x75\x46\xfb\xa5\x57\x14\x5a\x8e\xb5\xb6\xa6\x7f\x9f\xd3\x26\x39\x86\x0c\x68\xbf\x32\x24\x66\x43\x17\x5a\x2a\xa3\xa5\x47\x21\x95\xca\xea\xfa\xbb\xa9\x54\x2a\xd5\x32\xd6\x66\xb0\x4c\x44\x8c\xed\x5d\xd0\x33\xd9\xb4\xae\xa5\x32\x2d\xdb\xf7\x0d\x21\xb5\x5c\x8b\x5e\xc6\xb3\x3f\x30\xc2\xd6\x59\x5a\xf4\x8c\x22\x6a\x39\x34\x4a\xd9\x4e\xb2\xde\x16\xa4\xe4\x3a\xa4\x40\xd0\x7a\xe7\x82\x5d\x16\x1e\xd9\x7f\x9a\xfc\x5d\xb8\x36\xf5\x60\xea\x7e\x37\x7c\x3d\x19\xa1\x99\x64\x54\x22\x95\x5a\xae\xe2\x62\x16\x24\xce\xc9\x61\xd7\x31\x08\xfd\x09\x98\xb6\xc1\x05\xca\x9f\x7d\x90\x7b\x4f\x1b\xbf\x68\xab\xc0\x17\x90\x6b\xf7\xa9\xc9\x2c\x42\x8b\x59\x18\xcf\x13\x19\xda\xfc\x41\xfb\x35\x52\xe4\x51\x64\xd3\x0c\x2d\x22\x21\x9d\x4c\x25\x47\xd4\xee\xc0\x50\x16\xdc\xd9\xe2\xb0\x61\x8a\x28\xd1\xc3\xd1\x23\x59\x64\xd9\xf4\xc8\xc4\xc0\xd0\x1d\x30\xb5\x02\xe3\x25\x43\xb6\xf3\x78\x9f\x73\xc6\x81\xa3\xa1\xfc\x44\x45\x95\x10\x77\x20\x5c\xce\x42\x42\x74\xf3\x1c\x6c\x2e\xd6\xcf\x5e\x43\x42\x7c\xff\x66\xe5\x7c\x7d\xbb\x59\xad\x36\xab\x67\xfe\xda\x66\xb0\xf5\xda\x5f\x3c\x3d\x5f\xdf\x8e\xcc\xdb\x18\x98\xab\x50\xaa\xf2\x1e\x9e\xf5\xf2\xc8\x29\x4a\x14\x9e\x5b\xe4\x86\x85\xc3\xad\xa7\xe9\x78\x42\x22\x57\xf0\x32\xfa\xf5\xe8\x3e\xb6\x15\xac\x87\x1e\xf2\x8a\x02\x79\x6f\x66\x2a\xec\x18\x8e\x82\x79\xdc\x44\x91\x85\xc4\xbb\xe5\x1e\xa0\x07\x2f\x9a\xd5\x2f\xee\xcd\x4c\x35\xff\xbd\x10\x9c\x3e\xed\xe0\xfb\xfe\xcd\x4e\x64\x78\x95\xa6\xb0\x1b\x95\x6b\x05\x65\x22\x96\xa8\xf7\x98\x47\x2d\x48\x77\xbd\xc2\xc7\x44\xda\x20\x2b\xae\x62\x0c\x08\x0d\x7b\x4c\x62\xc9\x75\x0c\x89\x49\xc8\xd9\xc8\x11\x84\xcd\x3c\xc7\x02\x46\x9d\x0a\xe4\x11\xf4\x1e\x94\x2f\x0f\x83\xe7\xdf\xf9\x6b\x7f\x69\x7c\x76\x52\xaf\xfd\xbd\x5e\x7b\xd5\xf8\xfa\xcc\xdf\x7f\x92\x10\xd0\xd8\x59\x88\xa0\xff\x77\xfe\xcf\xfe\xe9\x7a\xb3\xfa\xc2\x5f\x7b\x15\xec\x2d\xd7\x6b\xf3\xf5\xda\xab\x1b\xf1\xeb\xe9\xf4\xf5\x01\x50\x76\xbb\x08\x6c\xa3\x8c\x90\x47\xa4\x57\x63\x08\xbe\x39\x0c\xf6\x96\xa3\x48\xfa\xc4\x10\x13\x40\xdf\x1a\x29\xeb\x63\xe9\xd6\x7b\x58\x21\x7a\x2a\x36\xac\x1c\x93\x86\x03\x26\xf3\xa8\x04\x56\x80\x92\xa1\x2a\x0a\x3e\x9c\x52\x55\x61\x01\xce\x99\x88\x16\xaa\x17\x17\x4d\xa5\x91\xa1\xa5\xda\xeb\x86\x51\xaf\x9d\x35\xb7\x77\x82\x27\x07\xc1\xde\x69\x30\x7f\x16\x6c\x9c\x84\x67\x9b\xaf\x1f\x37\xbf\x5b\x0c\xf6\x0e\x82\xbd\xdd\xc6\xce\x42\xb0\x71\xd2\xd8\xfd\x2a\x3a\x79\xab\x00\x46\x52\x71\xf8\x3f\x88\x2c\x40\x32\xf8\x6d\xe7\x13\xa0\x27\xc7\x92\x69\x25\xef\x94\x49\x10\x9e\xab\x64\x14\x2d\x28\x70\x56\x82\x72\x5b\x63\x7a\xbb\xb3\xb1\xbc\x14\xec\x1d\x27\x04\xd4\x6b\xab\xc1\x7a\x35\x58\xf9\xc4\x5f\x5d\x6c\x9c\x1e\xf9\x4b\x27\x97\x3f\x7b\xeb\x1e\x1d\x1f\xfb\xe1\x01\xf4\x80\xfc\xd1\xc3\x68\x1b\xc5\x75\x82\x52\x30\x61\x94\x23\xc0\xe9\xbb\x71\x80\x31\x14\x15\x33\x9c\x3d\xb4\x08\x16\xe1\x68\x4a\xc6\x2b\xf0\x56\x42\xbc\x75\x11\x8e\xbf\xb4\xeb\x9f\x9d\x36\x76\xbf\xf2\xbf\xdd\x50\x91\x5c\xa3\x75\x71\x7a\xab\xeb\x13\x7d\xbc\xe3\x1c\x9a\x5e\xe8\xbe\xdd\x6f\xa1\xa4\xb5\xf4\x37\x0b\x89\x5e\x3d\x5b\x3e\x6a\x1e\xae\x74\xe4\x17\x12\x65\x68\x35\x5e\x1b\xcd\x2d\x0b\x72\x2c\x73\xbb\x46\x1c\x4f\xdf\xea\x5c\x7a\x62\xf4\x7a\x42\x8a\xd1\x54\x53\x8c\x78\xed\x82\x6a\x31\x73\x69\x0c\x5d\x62\xe3\x5a\x2a\xe2\x93\x32\x1e\x2b\xee\x11\x06\xd7\xe0\xa2\x67\x0a\x5e\xcc\x42\xf3\xe8\x6f\xc1\xfe\xd3\x8e\xdf\x6c\x98\x86\x18\xaf\x2e\x51\x7f\x0e\xeb\x44\x7d\xb7\xb3\xde\x0a\xec\xe2\x76\xac\x28\x60\xdc\x54\xbe\xc8\x43\x6b\xf8\xf6\xe0\x11\xb1\x78\x3a\x2c\x08\x61\x2b\x87\xa3\xb1\x49\x28\x18\xc4\x41\x4b\xf5\x70\xd8\x17\x08\xcc\x45\x2a\x84\x0d\xae\x97\x77\x88\x09\xb3\x58\x01\x75\xcf\x54\x77\x91\xc4\xc3\x9e\x7e\x5d\x3f\x08\x96\x9e\x76\xac\xfd\xc7\xc7\xfe\x9b\x79\xbf\xfa\xe9\xf9\x5f\x5f\xf8\x5f\x6e\x35\x8e\xff\x51\xaf\x7d\xd3\xe9\x98\x87\x7d\x60\xdd\x8d\xcd\x4b\x17\x56\xab\x3e\x10\x5c\x4e\xca\xea\xa9\x10\xa9\x96\x11\xc2\x8e\x85\xa4\xe0\x34\x8e\x3e\x51\x93\x29\x82\x13\x83\xe2\xff\x2b\xdf\xf8\xd2\xe9\x42\x24\x94\x48\x62\x38\xe4\x51\xb7\x74\xdb\xb0\x2f\xdf\xa5\xfc\xa5\xe7\xfe\xd1\x13\x7f\x65\x33\xaa\xde\x08\xb2\xbf\xfd\xf2\xe2\x5d\x45\xf4\x29\x2b\x7d\x4c\xef\x5b\x57\x99\xd8\xba\x22\xb4\x6c\x38\xc4\x6a\x6b\xaf\xaa\x19\xc5\xa1\xc9\x68\x7b\x25\x6f\x98\xb3\x91\x3e\x7b\xed\x35\xb4\x80\xe5\xd5\xfd\xbe\x77\x62\x7e\xe6\xef\xee\x07\xcf\xaa\xe7\xcf\xf7\x23\x35\xf6\x57\x36\x1b\x3b\x0b\x7e\xf5\x3f\xcd\xaf\x0f\xd5\xec\xff\xf6\x38\x58\xfd\xa2\xb1\xb3\x10\xed\x06\x5b\x9f\x07\x1b\x4b\x37\x6a\xe6\x48\xfc\xcd\x85\x71\xd3\x46\x21\x43\x1e\x43\x91\x56\x13\xc5\xa3\x9d\x79\xd2\xc5\x95\x10\x70\xfe\x78\x55\x11\xf9\xac\x5a\xaf\xad\xfa\x6b\x5b\xd1\x10\xb9\x41\x15\xc6\x33\x71\x6e\xbb\xca\x1c\xf5\x1f\x58\x0c\xa3\x49\x86\x73\x44\xc8\x2b\xd7\xa0\x8e\x24\x29\xcf\x5f\x3e\xf3\xf7\x5e\xf6\xc9\xdf\xc4\x78\xdf\xf4\x8d\xc6\x5e\x87\x3d\xca\xd1\x64\x45\x4a\x1e\xa1\x05\xf7\xa6\x1f\xb4\x7e\x6d\x84\x9c\xf4\xc0\xd9\xfa\x3c\xf8\xd7\x46\xb3\xfa\xa9\xbf\xf4\xcf\xc6\xce\xc2\x55\xc3\x1b\x14\x72\x24\xce\x75\xc5\x28\x39\x37\x12\x11\x1a\xc5\xf2\xf0\xbf\x00\x00\x00\xff\xff\x2d\xf1\x9e\x49\xf9\x0e\x00\x00") - -func translationsZh_cnLc_messagesAcsenginePoBytes() ([]byte, error) { - return bindataRead( - _translationsZh_cnLc_messagesAcsenginePo, - "translations/zh_CN/LC_MESSAGES/acsengine.po", - ) -} - -func translationsZh_cnLc_messagesAcsenginePo() (*asset, error) { - bytes, err := translationsZh_cnLc_messagesAcsenginePoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/acsengine.po", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsZh_cnLc_messagesAcsenginePoLcg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x98\x5f\x6b\xf3\x36\x14\xc6\xef\x5f\x78\xbf\xc3\x99\x20\xf4\x62\x5b\x9c\x64\x5b\xb6\x05\x3b\x25\xa4\x1b\x84\xa5\x5b\x59\xd2\x52\x28\xbd\x50\xa4\x93\x58\xab\x2c\xb9\xfa\x93\x3a\xfd\xf4\x43\x76\xbc\x94\x31\x18\x0c\x89\xdd\xb4\x8e\x9c\x63\x3f\xbf\x73\xac\xf3\x1c\x27\xbf\x6e\x2a\x09\x47\x34\x56\x68\x55\x90\xf1\x70\x44\xae\xe7\x9f\x3f\xe5\xeb\xe5\x23\x6c\x58\x89\x15\x7d\xe8\xcf\x4d\x87\x23\x02\xbf\xd2\x0a\x0b\x42\x99\x45\x75\x10\x0a\x09\xdc\x59\xb3\xe2\x05\x19\x13\xd8\x18\xb6\xf4\xb2\x20\xa8\xbe\xbe\xdf\x10\x68\x2a\xa9\x6c\x41\x4a\xe7\xea\x59\x96\xd9\xf6\x5a\x76\x58\x09\x66\xb4\xd5\x7b\x37\x64\xba\xca\xa4\x66\xd6\x79\x2e\x74\x36\x19\x8d\xa6\xd9\x34\x93\xac\x21\xf3\xcf\x9f\x00\xf2\x95\xc3\x0a\xc2\x9f\xed\xa9\xc6\x82\x8c\x48\xfb\xe1\x7c\xab\xcb\x4d\xd7\x48\xf7\x05\x71\xc6\x63\x17\x07\x90\x6f\x9c\x81\x25\x75\x05\xd9\x62\xe3\xfa\x55\x80\xfc\x81\xca\x79\xfe\xc5\xd3\xf2\x66\xb1\x5d\x3c\xfd\x64\x8c\x36\x60\x90\x72\xa1\x0e\xb0\x17\x12\x61\x60\xbf\x82\x76\x79\x06\x03\xfb\xfc\x3c\xcf\xb3\x10\x71\xbe\x68\xb6\x71\xa6\x3f\xbe\x11\xb6\x86\x15\x0b\x39\xd9\x38\x43\x20\xeb\x14\x67\x41\xe0\xbf\x89\x9f\xc4\x13\xff\x56\x06\xd5\xaf\x1e\xcd\x29\x30\x2c\x7e\xbf\x85\x7d\xcb\x64\xb5\x37\x0c\xed\x0c\x06\x5f\x1e\x53\x71\x7c\x13\x83\xe3\x67\xed\x15\x87\xc9\x45\x32\xbc\x09\x57\x82\x3b\xd5\xa1\x1a\x20\x14\xb8\x12\xc1\x61\x55\x4b\xea\x70\x08\xdb\x12\x0d\x82\x2d\xb5\x97\x1c\xb4\x92\x27\xd8\x21\x8c\x53\x21\x7e\x1b\x0f\x51\xe9\xff\xc6\x58\xd2\x23\xc2\x0e\x51\xa5\xa3\xfc\x2e\x06\xe5\x56\x3b\x2a\x81\x69\xaf\x1c\xe8\x3d\x54\xd4\x3a\x34\xf0\x70\x1b\x9e\x41\x0e\xd8\x30\x44\x8e\xe1\xa0\x46\xe6\x90\x77\xdf\x0c\xe7\x52\x51\x4d\x63\x50\xdd\xd7\x07\x43\x39\x82\xd3\xf0\x8b\xdf\xa1\x51\xe8\xd0\xc2\x78\x38\x1d\x4e\x40\x58\x50\xda\x81\xf5\x75\xad\x4d\x40\xda\x1b\x5d\xf5\x7d\x34\x65\x03\xf9\x3e\x1d\xd9\x07\xf5\xff\x1f\xdf\x0f\x31\xf8\xb0\x6d\x90\xcc\x20\x75\xa1\x35\x72\x61\x90\x39\x6d\x4e\x70\x35\xb0\x57\x29\xd5\xff\x18\x4f\x3d\x36\xc8\x7c\x2b\xbf\x6f\x0e\x6d\x7b\x3f\x5b\xd5\x0c\x06\xc9\x7a\xfb\x78\x14\x8f\xe2\x80\x0a\x4d\x57\x05\xdf\x3f\x74\x67\x9c\x94\x75\x18\x47\x19\x12\x3a\x84\x9a\x1a\xfb\x61\x48\x48\x9a\xf9\x28\xe3\x01\xfe\xd3\x6c\x93\x34\xdb\x51\xa6\x81\x3d\x15\x12\x79\xe8\x49\xed\xc6\x45\xd0\x35\x2a\x6b\x4b\xa8\xfd\x4e\x0a\x06\x2f\x78\x02\xeb\x8c\x50\x87\x19\x0c\x5e\x93\xb1\x44\xb1\xfd\x0b\xcb\x79\x03\x20\xd4\x46\x1c\xc3\xff\x80\x11\x36\xb2\xb5\x65\x52\x8e\x28\xc6\x7e\xe1\x10\x4a\x38\x41\xa5\x78\xbf\x6c\xe0\x9e\x2d\xed\xc4\x3c\x8e\xe2\xe5\x42\x1d\xa9\x14\xbc\x77\xb0\x60\x71\xa1\x08\x4c\xab\x7e\x65\x47\xd9\x4b\xe7\x72\xbe\x5f\x43\x0e\x7a\xf7\x07\x32\x97\x8c\x2d\x8a\x9b\x6b\xc3\x4a\xb4\xae\xad\x44\xeb\x70\xc1\xbd\xbd\xfa\xcb\xbb\x93\xa9\x8f\xe2\xd5\x17\x77\xeb\x1a\x15\x70\x8d\xdd\xf0\x81\x8d\xb0\xe9\x52\x1f\xc5\xaa\xbd\x32\xc8\xf4\x41\x89\x77\xe4\xb0\xb8\x5b\x9d\x5f\x96\xdb\x2a\x24\x7b\x85\x8c\x62\xcf\x27\x5a\xc9\x24\x29\xff\xed\x4d\x21\x5f\xea\xaa\x42\xe5\x6c\x1f\xb6\xac\xdc\xf9\xa7\x83\x35\x6b\x16\xbc\x12\xea\x12\xfa\xf7\x80\x3c\x5b\x2f\x1f\xe7\x7f\x06\x00\x00\xff\xff\xac\xbb\x9e\xdd\x99\x10\x00\x00") - -func translationsZh_cnLc_messagesAcsenginePoLcgBytes() ([]byte, error) { - return bindataRead( - _translationsZh_cnLc_messagesAcsenginePoLcg, - "translations/zh_CN/LC_MESSAGES/acsengine.po.lcg", - ) -} - -func translationsZh_cnLc_messagesAcsenginePoLcg() (*asset, error) { - bytes, err := translationsZh_cnLc_messagesAcsenginePoLcgBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/acsengine.po.lcg", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x99\x51\x8f\x1a\x37\x10\xc7\xdf\x23\xe5\x3b\x4c\x57\x42\x79\x68\xcb\xc2\xb5\xa5\x2d\x02\x12\x44\x5a\xe9\x54\xd2\x9e\x0a\x39\x45\x4a\xf2\x60\xec\x81\x75\xe3\xb5\x37\xf6\x2c\x07\xf9\xf4\x95\x17\x36\x9c\xd4\x4a\x0d\x9c\xe7\xd4\x97\x3b\xaf\xf7\xbc\x33\xf3\x9b\x59\x7b\xfe\xb7\xa3\xe7\xbb\xd2\xc0\x16\x7d\xd0\xce\x8e\xb3\x7e\xb7\x97\x3d\x9f\x3c\x7d\x32\x9a\xcf\xde\xc0\x42\x16\x58\x8a\xdb\xf6\xde\xa0\xdb\xcb\xe0\x77\x51\xe2\x38\x13\x32\xa0\xdd\x68\x8b\x19\xdc\x04\x7f\xad\xc6\x59\x3f\x83\x85\x97\xb3\xda\x8c\x33\xb4\xdf\xbe\x5e\x64\xb0\xdc\xd0\xfd\xcb\x5d\x69\x6c\x18\x67\x05\x51\x35\xcc\xf3\xd0\x3c\x3a\x74\x4b\x2d\xbd\x0b\x6e\x4d\x5d\xe9\xca\xdc\x38\x19\xa8\x56\xda\xe5\x57\xbd\xde\x20\x1f\xe4\x46\xee\xb2\xc9\xd3\x27\x00\xa3\x6b\xc2\x12\xe2\x8f\xe5\xbe\xc2\x71\xd6\xcb\x9a\x8b\xa3\xe5\x93\x0f\x73\x14\xeb\x71\x46\xbe\xc6\xc3\x3a\x80\xd1\x82\x3c\xcc\x04\x8d\xb3\x25\xee\xa8\x9d\x05\x18\xdd\x0a\x33\x19\x7d\xf5\x76\xf6\x72\xba\x9c\xbe\xfd\xc5\x7b\xe7\xc1\xa3\x50\xda\x6e\x60\xad\x0d\x42\x27\x7c\x03\xcd\xf4\x10\x3a\xe1\xfd\xfb\xc9\x28\x8f\x2b\x3e\x2f\x5f\x6e\xe8\xde\x63\x61\x41\x71\x3c\x77\x32\x83\x69\x55\xf9\x71\x76\xe3\x31\x0e\xdc\x16\xd5\xc9\xe8\xc3\xcd\xe6\xcb\x0d\xb5\x91\xe5\x0b\xf2\xed\xf8\xa5\x0e\x15\x5c\xcb\x98\xa7\x05\xf9\x0c\xf2\x03\xb6\x3c\x52\xfa\x2f\x82\x57\xe9\x08\xde\x15\x31\x86\x8f\x35\xfa\x7d\x8c\x68\xfa\xe7\x2b\x58\x37\x11\x06\x57\x7b\x89\x61\x08\x9d\xaf\xb7\xac\x30\x2f\xf4\x80\x83\xeb\x77\x29\xb8\xfe\xea\x6a\xab\xe0\xea\x14\x00\xdc\x69\x2a\x80\xf6\x55\xac\x15\xd0\x16\xa8\x40\x20\x2c\x2b\x23\x08\xbb\xb0\x2c\xd0\x23\x84\xc2\xd5\x46\x81\xb3\x66\x0f\x2b\x84\x3e\x13\x72\x2e\xe7\x38\xb2\xf1\x7d\xba\x6c\x58\x77\x59\xc4\x85\xd8\x22\xac\x10\x2d\x73\x42\x58\xfc\xe3\xc8\xc9\x0f\x29\x72\xb2\x74\x24\x0c\x48\x57\x5b\x02\xb7\x86\x52\x04\x42\x0f\xb7\xaf\xe2\xab\xae\x00\x77\x12\x51\x61\x1c\x54\x28\x09\xd5\xe1\x2f\xe3\x3d\xa6\x1c\x24\xf4\x87\x83\xf9\x20\x05\xf3\xd7\xd5\xc6\x0b\x85\x40\x0e\x7e\xab\x57\xe8\x2d\x12\x06\xe8\x77\x07\xdd\x2b\xd0\x01\xac\x23\x08\x75\x55\x39\x1f\x03\x5c\x7b\x57\xb6\x2d\x06\xe3\x61\x9a\xd8\x27\x0e\xf6\x3f\xf2\xb1\xbf\x17\xcb\xff\x2c\x03\x0f\xf4\x8c\x23\x0f\x3f\xa5\xc8\x03\x36\xfd\x86\xf4\x28\x28\x76\x1a\x4a\x7b\x94\xe4\xfc\x1e\x9e\x75\xc2\x33\x46\xca\x17\xd8\xe5\x60\xf8\x73\x3a\x86\xb8\x43\x59\x37\xc1\xb4\x07\x53\xd3\xb3\x1d\xfb\xe1\x21\x74\xb8\x5a\xc6\xcb\xcd\x73\x10\xed\xf7\xd2\x21\xdd\xa0\x45\x7f\x28\x90\xba\x7d\x2b\x8f\xc1\xb1\x97\xe6\xd9\xb6\x59\x60\x26\xd1\x85\x87\x80\x2a\xe1\xc3\x3d\x81\xc6\x5e\x90\x5f\x64\x8f\x05\x5a\x12\x29\x88\xff\xa6\x6a\xd9\xab\xee\x8b\xec\xb1\x40\x4b\xa2\xf3\xd6\x42\x1b\x54\xf1\xe8\x6c\x76\x76\x04\x57\xa1\x0d\xa1\x80\xaa\x5e\x19\x2d\xe1\x03\xee\x21\x90\xd7\x76\x33\x84\xce\x47\x26\x92\x0f\x75\x82\x05\x6f\x12\xe1\x76\x8a\xec\xb8\x3b\x21\x54\x5e\x6f\xe3\xef\x18\x54\xdc\xef\x43\x28\x1e\x05\xed\xf9\x0e\xb0\x60\x4d\xa2\xbd\x4e\x51\x69\xab\x49\x0b\xa3\x3f\x9d\x36\xfb\x36\x52\xd6\x7f\xa1\x3d\xc8\x03\x16\xb0\x49\x04\x96\xb6\x5b\x61\xb4\x6a\x5b\xe3\xd8\x3b\xc7\x12\x91\xce\xb6\x33\x2b\x21\x3f\x1c\xda\xe7\xba\x9d\x43\x05\x6e\xf5\x17\x4a\x62\x62\x9d\xda\x29\x16\xfc\x49\x34\x96\xf3\xb2\xc0\x40\x4d\xe9\x34\x7d\x75\x54\x2e\xb5\xfd\xac\x5b\x98\x00\x9f\x6f\x96\x05\x61\x12\x79\x74\xea\xa5\x0f\x07\x32\x28\x87\x07\xf5\x87\x3b\x1d\xb8\x4a\xf4\x6c\xab\x2c\x00\x93\x68\xa3\xda\x7a\x94\x6e\x63\xf5\x27\x54\x30\xbd\xb9\x3e\x7e\x88\x69\xea\x82\x89\xde\x79\x26\x59\xbe\x45\x24\xd1\x40\x7b\x51\x9a\xc7\xad\xbb\xb3\x2c\x5e\x0e\xee\x8f\x3b\x8b\x6a\xe6\xca\x12\x2d\x85\x76\xd9\xac\xa4\xe3\x77\xb9\xb9\xdc\x4d\x55\xa9\xed\x69\xe9\x3f\x17\x8c\x16\x48\x51\x9b\x85\xe3\x9a\x17\xdb\x30\x77\x72\xe9\x9c\x09\x2f\xde\xc9\xda\x7b\xb4\xf4\x4e\xe1\x5a\xd4\x86\xba\x26\x84\x0c\x0e\x49\x9a\xc7\x61\x7c\xec\x28\x9f\xcf\xde\x4c\xfe\x0e\x00\x00\xff\xff\x4f\x29\xb2\x58\x39\x1c\x00\x00") - -func translationsZh_cnLc_messagesEnUsLclAcsenginePoLclBytes() ([]byte, error) { - return bindataRead( - _translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl, - "translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", - ) -} - -func translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl() (*asset, error) { - bytes, err := translationsZh_cnLc_messagesEnUsLclAcsenginePoLclBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x98\xdf\x6f\xdb\x36\x10\xc7\xdf\x0b\xf4\x7f\x38\x68\x40\xd1\x62\xa5\x24\xca\x89\x7f\x28\x76\xba\x4e\x4d\xb2\x0c\x76\x62\xd4\x6e\x97\x07\x01\x01\x23\x9d\x25\x36\x12\x29\x90\x54\x90\xf4\xaf\x1f\x64\x2b\xb6\xb7\x3a\x6d\x12\x3b\x7a\xb0\x65\x53\xe4\xf1\x73\xbc\x3b\xf2\x2b\xf5\x3f\xdc\xe6\x19\xdc\xa0\xd2\x5c\x8a\x81\x45\x6d\xd7\xfa\x70\xf8\xfa\x55\x7f\x18\x5c\xc0\x24\x4a\x31\x67\x5f\xef\xef\xb5\x6d\xd7\x82\x33\x96\xe3\xc0\x62\x91\x46\x91\x70\x81\x16\x8c\xb5\x3a\x8d\x07\x16\xb5\x60\xa2\xa2\xa0\xcc\x06\x16\x0a\xf2\x65\x62\xc1\x6d\x9e\x09\x3d\xb0\x52\x63\x0a\xdf\x71\xf4\xdc\x96\xb6\x73\x1e\x29\xa9\xe5\xcc\xd8\x91\xcc\x9d\x4c\x46\xda\x94\x31\x97\x8e\xe7\xba\x6d\xa7\xed\x64\xd1\xad\x75\xf8\xfa\x15\x40\xff\xd4\x60\x0e\xd5\xd7\xc2\xfa\xbc\x11\xa0\x3f\x56\xb2\xd0\xf5\x1f\x80\xfe\xc4\xa8\x1a\x69\x7c\x7e\x39\x42\xc3\x62\x66\x98\x6b\xc1\x57\x96\x0d\xac\xdf\x7c\x28\xae\x13\x67\x09\xeb\x2c\x2e\x76\x22\x7d\xaf\xd5\xb3\xc0\xf9\x85\x1d\x7a\x6f\xe7\x3d\x44\x64\x26\x55\xce\xcc\x6a\x50\xdf\x59\xa1\xf4\x9d\x0a\x74\x03\xb7\xb7\x0d\xb7\x2c\x50\x31\xc3\xa5\xd0\xce\x75\x79\x85\x4a\xa0\x41\x5d\x16\x89\x62\x31\x3a\xf5\x35\xca\x4a\x6d\x50\x55\x2e\x75\x68\x13\x1e\xb5\x76\x13\x09\xa3\x98\xd0\x15\x40\x45\xde\x6b\x24\x16\x7b\x2f\x40\x4e\x3d\xaf\x09\xf4\xfd\x17\x4b\xa3\x1b\xda\xf6\xea\xdf\xf3\x24\xa2\x6e\x23\x0e\xb5\x1b\x73\xa8\xe5\x36\xe1\x4f\xa7\xc1\x3a\xef\xb6\x9b\xf0\xa8\xbb\x9b\x6a\x99\xf1\x0c\x35\xbb\x59\x90\x7b\x7b\x4d\x90\xf7\x76\x7d\x56\x50\xda\x6b\x04\x9c\xba\x8d\x55\x45\xbb\xf3\x04\x87\x9e\xb3\x8d\x74\x1f\xb1\x8d\x78\x5b\x4c\xe0\xf5\xf6\x7f\x3d\x41\x6b\xfb\x90\xec\x5c\x78\x50\xda\x6d\xe4\xb4\xa3\x5b\x49\x0f\x56\xf0\xea\x93\xc9\xe5\x7a\xef\x2d\xdb\xeb\x30\xfc\xf7\x76\x23\xbb\x2c\xdd\x91\xf8\xd0\x3a\xad\xa0\xf7\x1f\x91\x42\x3b\x80\xde\x91\xee\xa8\xa1\xf7\x9a\xc9\x9e\xe6\x14\x87\xd7\x50\x3d\x6c\x25\x39\x7e\xa8\x07\xda\xa6\x3f\x2d\x88\x4e\x33\x05\xb1\x95\xee\xd8\xb4\x3d\xb5\x9a\x11\xb4\x74\x47\xf2\x62\x6d\x5f\xed\x3e\xe5\x48\x7b\x3e\xf8\x76\xea\xe2\xff\x69\xd4\xeb\xfe\x34\x8b\xf6\x1b\x79\xa4\xf3\xb6\xd2\x1d\x0f\x1c\x72\xad\x17\x22\x5f\x27\x5c\x33\x1b\xc8\xe2\x4e\xf1\x24\x35\x7f\x61\xb5\x78\x4b\x46\x08\x52\x2e\x50\x23\xcc\x1f\xdb\xb2\xc5\xae\x04\x33\xa9\x80\x45\x9a\x2c\x88\xa1\x60\xd1\x35\x4b\xd0\x5e\x9b\xfd\x41\xcb\x74\x65\xf9\xfe\x06\xbc\x0d\xde\x81\xe7\xd2\xce\x63\xc6\x2f\x45\x0f\x4c\x53\xae\xa1\xd2\xc7\xc0\x35\xc4\x5c\x1b\xc5\xaf\x4a\x83\x31\x94\x22\x46\x05\x26\x45\xd0\x2c\x47\xc8\x78\x84\x42\x23\x30\x3d\x6f\x7b\x26\xf7\x52\x0b\xc1\xdf\x9c\x89\xc4\x70\x26\x60\xc8\xe1\x4d\x66\x0e\xbe\xdd\x37\x64\xfc\x8f\x54\x9a\x9c\xf1\xcc\x8e\x64\xfe\x26\x31\x07\xef\xe7\x7e\x6d\x9e\xe0\x58\xc9\xfc\x98\x67\x58\x1b\xfe\xe4\x87\x27\xf2\x1f\xa9\xae\x43\xad\xa2\x30\xe1\x26\x2d\xaf\x2a\x33\xe1\xc7\xef\xa5\xc2\x70\x85\x1d\xae\x87\x22\xfc\x9e\x5e\x06\x67\xe1\x30\xb8\x1c\x1d\x4d\x26\x1f\x4f\x8e\x26\xe1\x32\xa1\xec\x42\x3e\x38\xf1\x67\x2c\xa4\xe6\x46\xaa\xbb\x7a\xfa\xb5\x37\x52\x1b\x86\x8c\xcf\x2f\x17\xcb\x50\xf7\x1e\x2b\xf9\x0d\x23\x43\x4e\x63\x52\xbf\xde\xf2\x21\x14\x95\x51\x65\xc8\x48\x27\x3c\x26\x7f\x96\x89\x26\x53\x59\xb5\x8f\xcf\xa7\x24\x50\x38\x27\x26\x9f\x98\x41\x7f\xbe\x2c\xc4\xed\x10\x6f\x1f\x5c\xd7\xa7\xf4\x77\xd7\x75\xdd\xaa\x27\xf9\x8c\x37\x5c\x6f\xe8\xb8\x07\xb4\xe3\x7b\x94\xb8\x9d\xaa\xe3\x90\x69\x43\xa6\xf5\x42\x48\xe5\x3f\x29\x2a\xd5\x70\x91\x94\x2c\x41\x32\x45\x96\xfb\xcb\x24\x7f\xab\x79\x5e\x64\x7c\xc6\x31\x7e\xb7\xea\xe4\xc3\x62\x91\xc5\xe8\x74\x74\xb4\xf2\x97\xda\x6e\x28\x02\x29\x0c\x0a\x43\xa6\x77\x05\xfa\x60\xf0\xd6\x38\x45\xc6\xb8\x38\x80\x28\x65\x4a\xa3\x19\x7c\x99\x1e\x93\xee\x5a\xc7\xf9\xeb\x0f\x54\xe4\x48\x44\x32\xe6\x22\xf1\xa1\x7b\xc5\x4d\x28\x2e\xc8\x09\x8a\xea\xdc\xaf\xbc\x19\x4b\x8c\xb9\x01\xcf\x76\xed\x56\x28\x36\x86\xe4\x6c\x9c\x95\x8a\x65\xba\x8e\xc8\xf2\xd8\x59\x15\x7e\xdf\x19\x06\x17\x87\xff\x06\x00\x00\xff\xff\x4a\xb8\x14\x16\xa1\x14\x00\x00") - -func translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXmlBytes() ([]byte, error) { - return bindataRead( - _translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml, - "translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml", - ) -} - -func translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml() (*asset, error) { - bytes, err := translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXmlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "translations/default/LC_MESSAGES/acsengine.mo": translationsDefaultLc_messagesAcsengineMo, - "translations/default/LC_MESSAGES/acsengine.po": translationsDefaultLc_messagesAcsenginePo, - "translations/default/LC_MESSAGES/acsengine.po.lcg": translationsDefaultLc_messagesAcsenginePoLcg, - "translations/default/LC_MESSAGES/en-US/lcl/acsengine.po.lcl": translationsDefaultLc_messagesEnUsLclAcsenginePoLcl, - "translations/default/LC_MESSAGES/en-US/metadata/acsengine.po.xml": translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml, - "translations/en_US/LC_MESSAGES/acsengine.mo": translationsEn_usLc_messagesAcsengineMo, - "translations/en_US/LC_MESSAGES/acsengine.po": translationsEn_usLc_messagesAcsenginePo, - "translations/en_US/LC_MESSAGES/acsengine.po.lcg": translationsEn_usLc_messagesAcsenginePoLcg, - "translations/en_US/LC_MESSAGES/en-US/lcl/acsengine.po.lcl": translationsEn_usLc_messagesEnUsLclAcsenginePoLcl, - "translations/en_US/LC_MESSAGES/en-US/metadata/acsengine.po.xml": translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml, - "translations/zh_CN/LC_MESSAGES/acsengine.mo": translationsZh_cnLc_messagesAcsengineMo, - "translations/zh_CN/LC_MESSAGES/acsengine.po": translationsZh_cnLc_messagesAcsenginePo, - "translations/zh_CN/LC_MESSAGES/acsengine.po.lcg": translationsZh_cnLc_messagesAcsenginePoLcg, - "translations/zh_CN/LC_MESSAGES/en-US/lcl/acsengine.po.lcl": translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl, - "translations/zh_CN/LC_MESSAGES/en-US/metadata/acsengine.po.xml": translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "translations": {nil, map[string]*bintree{ - "default": {nil, map[string]*bintree{ - "LC_MESSAGES": {nil, map[string]*bintree{ - "acsengine.mo": {translationsDefaultLc_messagesAcsengineMo, map[string]*bintree{}}, - "acsengine.po": {translationsDefaultLc_messagesAcsenginePo, map[string]*bintree{}}, - "acsengine.po.lcg": {translationsDefaultLc_messagesAcsenginePoLcg, map[string]*bintree{}}, - "en-US": {nil, map[string]*bintree{ - "lcl": {nil, map[string]*bintree{ - "acsengine.po.lcl": {translationsDefaultLc_messagesEnUsLclAcsenginePoLcl, map[string]*bintree{}}, - }}, - "metadata": {nil, map[string]*bintree{ - "acsengine.po.xml": {translationsDefaultLc_messagesEnUsMetadataAcsenginePoXml, map[string]*bintree{}}, - }}, - }}, - }}, - }}, - "en_US": {nil, map[string]*bintree{ - "LC_MESSAGES": {nil, map[string]*bintree{ - "acsengine.mo": {translationsEn_usLc_messagesAcsengineMo, map[string]*bintree{}}, - "acsengine.po": {translationsEn_usLc_messagesAcsenginePo, map[string]*bintree{}}, - "acsengine.po.lcg": {translationsEn_usLc_messagesAcsenginePoLcg, map[string]*bintree{}}, - "en-US": {nil, map[string]*bintree{ - "lcl": {nil, map[string]*bintree{ - "acsengine.po.lcl": {translationsEn_usLc_messagesEnUsLclAcsenginePoLcl, map[string]*bintree{}}, - }}, - "metadata": {nil, map[string]*bintree{ - "acsengine.po.xml": {translationsEn_usLc_messagesEnUsMetadataAcsenginePoXml, map[string]*bintree{}}, - }}, - }}, - }}, - }}, - "zh_CN": {nil, map[string]*bintree{ - "LC_MESSAGES": {nil, map[string]*bintree{ - "acsengine.mo": {translationsZh_cnLc_messagesAcsengineMo, map[string]*bintree{}}, - "acsengine.po": {translationsZh_cnLc_messagesAcsenginePo, map[string]*bintree{}}, - "acsengine.po.lcg": {translationsZh_cnLc_messagesAcsenginePoLcg, map[string]*bintree{}}, - "en-US": {nil, map[string]*bintree{ - "lcl": {nil, map[string]*bintree{ - "acsengine.po.lcl": {translationsZh_cnLc_messagesEnUsLclAcsenginePoLcl, map[string]*bintree{}}, - }}, - "metadata": {nil, map[string]*bintree{ - "acsengine.po.xml": {translationsZh_cnLc_messagesEnUsMetadataAcsenginePoXml, map[string]*bintree{}}, - }}, - }}, - }}, - }}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -}

*4E{)7M|0fBot3`IqaLpO4R9&!?l+t6$F+bw0qj)cOK6zyvf) zG3U-GWIvhSnY&_mfq5n{u$bvixn8Qa7HdqKAAeIS#SOGJC=s(2v}l2jmL(UlrRI}Y zENyxRkBCKEyJ{n1h>#I87|lXgNqxw-s$PySU;goQ`ts@c>6gO~@8A9I&zI+?{o@b2 zckg$P54(pCyZiTbe>d$Pq|DP)N-4y`tlWGwjzGm&!*Teop&mo_?H@aelZ7!ljO;4T z88i;K1|=f4FQdo%eQR|HsJox!L?;7GV+m-;SGxkvHqd)j<|+Bp)VI@yt)R44U+HZT zT4dH~t8MDe*w4|mw{j4L56e^PsGu5oBkx-B$?X}moBoU|dU~fvI9j)+t~u8Um0Rk` z7$Esmfgkv5TvW{RFIZu{_&S7t9`|PMw>YpwOI(;QtKLX*bO!yMk+>}%p{FE?bd9P- zhEyuqNWP30Ynws8W$j-((brGD`S_0a9itoi_FKl|=}zxWmy}Xa25K?CwmUKa(G|AF zRXGMP#{Q&R_UqKv`-AaAY#3#qesleEdZVFUk>9uy8&*uj;pFn9H=oqP ze)Aergx&x}ZxT_Y;}AgMgSTizg+@)Qai=hmzjE`XLHnRLF2`><+S|6GHIp5dhuLb0 zLW!Z5?vT-$!TEOtQnRK8trkKEwY9n|*JY{K%jtSPTwb0oPhVf2zP>ztJ%0Uk{PfG= z(_fCCe!d)E>gCY13K>u0!x40m=&hQ)Xd#Y!@Mtj zx(-3S8%ovvg#pcc$~QO|Zb|V~orpkW%>b~fYfl8T$Gc7|!5S_LU$3TC&D5+h7r!G6 zB@hb>Ef<{6$IJ7lr_T=$?|%5@w~OruOJ0{EPyms+_S$Zl%mgsjE%*%sBgl!#XI|tSCDgsf8zAC3s$=l$$4G8#}Zl z4kiU_8$FyFc4-0td6PE+Xd~svoo|YI_q^Qt8O1$~46C2Y>TrD#jal3J;r&+%Oe3Bd zc`x~{zX=)s&f~`8X5Vcm>jA@#&jO^H~Czr$%M2w}KYKVhvx5AiVip#ZR9quUS_4MeAHsdcSNZXwOp zH?Ns~5`xwc#4~i(P^|mjtxCNBYStGU)NoTC?!UG?yeNom`HKT_n#^&&^^OOmAEEXL zdGsA{|K#I>nx2d6la{J0#VEGLPynVdJ5LVDJ{$!4E z+PdptZ4KXyS_*6UFqqcra$V~6d_G-Hr{(x^dir{N{&ITy^z!BN@$;wCr@vml{(L=r zuGbf6WA-(w4*wLg2CW1#F(LWC{ih$jhU`m)S$qV|wJxnKt)5&8X{lPPU6$*zRCR@T zi~I+G23JX~d83N~jYydqQ3bUmAGwZ8FlL#}hZr&==8UqjG~qfGnx=W4CMhJ`n3^z6 zQiO_dAu4&zn-ZF~y42--K0H02UXIJ*c{x8_Pp5jRdcCw|S*}Z47S-w((IIk8p)OZg zOkSJgm8%8g>{IoH&lm_Ah9f44;pR$qlq+>J`^){X)SPAXbw z<}zYa{*Kq@*`>X2o0l{g)8e2KE{SOxKIC=2eCq4B3BOQ>-39cQ3Wlsy7iF z^(#0u8D@Yn{E#(tJT|B6{+!qK7One_NL#U^&-oAiHirq#lW8$Q6pmIwZ($n8Nf}YPaR<*|O*t z*T<-@z}qw45T1V{NnMlYbkE&)5;>W#u^qV{ZcGbjc5?gveIVS)VqpmU6$+haz338FUObX)6=KJ zuRlNk^4F)I|MK;xe|q}se>wd1|8x53zn(w+x8>!pz>%afg8+`nW9nkE0%I_d092-F z2Q&p&^WYU#~y>>G=M4yLa#Rk017rkMqNayZeXf?s3`O%RHB9DrFK87SSe-O0zPt7?b!i zNz3cjP{Y9Z(()axn-%n(`yX-dng!*)TE(r3?*Xdeyb z%kgbI0RC`61hTREwtm5I$O)R!`US%)x9@xP>u~YXOZ5};v$uY`d-9q|?%FBWZ*lsw zxT@yal{4q_RtA^cI`JV5&K4!$o@IaG%*t&kT>EAw0s;=tfy zWW*rVI$DQx>*4bC>;3y5?|=As zdjE0%?)}~4$L0S0?%{{&{(icZOhB*o#|xBdBSwNR8%W7(#-O83R^Mvsuhd&NRh)`?@cr z&fEk>oGs0ssaLrvQW+g1{Tpi)=wsu60$8c@9xN=O8zsX)-Rj23ZZB((QF3qjyV3v| zCFN?Z_`cfD=@m3U%%MMJ;JgAb(y)_cKF9hM>gv~C0dF*=#G!kNx9Ln#OJZxhi`-Qc zdeLxQ3FO?r71`dx6KkTIl>zDuo=%$Cz^8fQeu2F2ZFRUkVNIi%jvp`r_c7IQUmG{j z&gQ_^9D^i7H2w|J(>M}t} z-llQl)Puq`-Sdhx-Lhp54y_Iqt#C`lfAuThsOJ%+r7mbI{ zCq%MaiICmEmg({vu&qJXq;S21L*h$WyTMAO%$UgHvZ!sX(15y-lIQoU)w{t}nAfep zIkwk7Z>TEY78C7@#Ksi7Z_KC=Mw>JFj4=Z#LtE3BNZx9z?OK;*S+3Xf;d(ls4$qh8 zr_1xx%hyjY&!5g;emQ^rbpG@}jQ+25Rd1ik7{i3R*lvUD_fsL=K9U?Kx13 z0rUiJSv({Is}YfEVAT#1h;ZEQP@HP+dx=PxS`Evh&6LCpW=+Jd$EWM*<@EKJG9>^;oZF7mHYeM{rhGAAp83=?WbufrDzkD>ND+xnN)~HnTeoG zSZThHSPC4bHt%ak76V@+wXQD>0*I*-mi&`gW1r_f$cbV%E^WZF{Q86e8YzM|v7x^t z@r4K?qV^bgRwILtVHjAwI@DziWMmSHn48yo2o8)#?dmorjbjaL(Ttd3ts~(^F|nk# z`B}1CZ7n&)&KZkUzF(-45obbGv#M8*O4@@Hag~8v{<;e>|P*C}y4t z+_7+e*x*MKQb~*fqtjWxhFpX&hQQi-s{ITU&hG0#bY~ZjX|#Xg0Qs&^OCq%if9GP` zUI9PMTn?+1j;WWL?g*wB^Gb_C4>}Cq?`J<}BVTDYCaFDV4o@BD%GgwYFnsEW_iop| z^=puC+$6;7mf5uPt`7}`fHj%-W}zrXbRuMClMOLjcU?W-czC2MF>sa`%1wkmv%#`f$nlMl%XV_N13PJOU?3NW z25K8N0vGgUw#kVIW^~G^(yS5eIn`0xYdQ;v=CbFsoQ>qF@i;})pS{km^ zv{}>I%qGD!5fKaXaz4F${i*!4zyJ8|;fEg|KK_U4{qGKs@Amia_Ky#D4Hapy9V=pQtXlLmk=<_*@g{d-mv<)^qZ!D=S%|6wD3s|)ZmO6S48YUbL})vW ze+>V#p}-K@H~?TFm`luTffyq>d}KKWJT~@k159JnNe@%f(V2Dr8@f=#21{Re{i{^l z5K;{8>?2D{$Sr+s_F8xC4#VId(rF_vpLQ&tqIjG}HQ~+;NIsTs71$iyV6#?{A`3PQ zx@TQat7|cZ6YuK{x%;ysY}$w6^=~tGm6OR8PcSqoSOU0SQ z9sOP@Hy?d1azgi;8gVYa9zPIL!*;FWhh(3H1YUL>2W@0Cafo3?+=i~=xEUd5*PmFS z4q@(<7{G+Ws`boRlLZk;6GscL25>i2ud=8-eDj+X+#Wr@{?n^Be&>;N&Ti1w3LnM@ z&#x_ZKefw6 z6^ce$2~dT)>IJUEU}h?u>#g&G;8KA^g?TEw#|gS~`Q4_6h z6E3O^5|IlFiE>eD28AlLpb22+X{@Ocs9m1FwDa-&^=0?&hld~kbb0r~`Q_pAaM(RO z?H}Hi`-l1dvF+~b?oM{QGS4MFvHI*gY1CMljf;yMTXvi09tks?_#8YbSQpp8Ke>Tw z*+9fOwdZ!h{S7szb!nOnO|<9+DKn)kz(gWS4q}*z5t}Im@Ylze#Ao(`Dgdap)VUql zMeF=-Yi!il$FM61u^W{joXZ)NMLyQjDVo%FZqQ|i|K_STO}Y;$}W z%wz%`p3T3#e{}cFJ@#0aF*`Dx(+nOm4D z)LRp2iTZbo^cUmHTIyltwT;}@Ll{X;l?+B?vx5Kv8j%b&CUm7j{}z{Vj_^?n0P@s1 zE}gex#}%+4zV@iw@yhj*4GC+n&Y%NDZ{W;p?R@+E8`rSEb%>4pj_dZX$R5||ghQsz zePUn>dULIHS+2|Vd|WQ)%jtN1c{#m&KEFI2pPvuUUoT&OIeq@8!`Cn8=g(HpS}V+j z8x$n41!e|OMdY!dQi%m9fT5{+hY`{2v>sI}rIb`=1KaFzs7wMFB%wbuRb?TFQ17HR zV)zsVWmAShAvyy@YUalTg9^+{Cy=OCvxOOfMOuvCg$9R?IQnm`nJL)ipNKRJNl*Q# z$OMG_75MX`^VkG zhuz)#>F#m9yDxY9vU@1Ixs<7tS)_0iVpb7iSF!-f^uCR{#Nd}8Y5}lSAZxX&r2$k;gq7R51KgU_dE&8Aml@#g;%o=CEsyLWzT|S9vfr&Wp>=;dOsnuSTZ# z&|sns9?Z-KoLJV~hCg)&wWgNc>sr5kL*+0_z!7%XTCY_Qr*6|~3p>!!5$7Q}#}GL9 zm7rWVYqpE^0!HYe14^(Gt$V@0v)Pc$l=WjWXh*LP>v;OBPYVKpdb)2&ibS`1X#>$& zviT9ol->XmxP?D54c)*%{T2+#YufsR7ghw4UVZY-XWiC%wj0d@8}5KYFM@7)8^1}; z8eOjeIRV$!Xl+nKzzUUbVA^0BQqWpK;S|y3xB8CS!e*W_0G8Mojg69hg;}`L^&#HU z5)*;QhG8wG7sVXKVx~N3U+_WBU;;=pMfj$R?RRj1F<#f;UR~3^<|1ZVA&>#0anIZw z&>1{$)z)fVytn9bIo9KGIUX*@=i|%a`1JYo^7Zum*Ynet%hQ+Rm!InKrL~Ko(xfyc zAxH^EidlVrx)Eti@)cq#M8aWU9gUPiB-$=&O9`P|w>unHh#3hrQ&Uqko}44L12GFC zjdA>0mB6G8&Pw&1fJ>`qW+9%)yoa_DEs23~B535@x9-%fX}@=>YQ!M!`sLY^5Sd)) zWjJq~Kn5`ih&?`phzd+i)jN7vSP7=f_3&vqeK|kf#kFvjWmew>)EW#qfB}Ub%vWm}+R~CwiBoyC_81tJ07gi$2CToiZ z;B|t>wr79cw69CNef19=wA(6IT!_H=ZcIimmIecg#BoITHOi3}`M};zaRkZ0;f((p zEUNo}p+cELK&w+WfR&`wQNYd6lCAl3C{l0gMnr?k!K)3teZPM*WAp%P0OU{RX9d_C z4m!NJWjql+ef-Am9uuWY!O`fCiUMhJ!q=HL-Av?FSeYzYf5or{GMOALPbUc67@^fG zQYw87PQ=%W&u|&ShrW<*Yu_FTr_brn#P;l|U>trgcCTRi3P=y3)lHrCjRgNK%iFI4 z^}TQdU3NR0g`DoX#)8J0Q1&!w=s|exKmFi&fG{`0H8(5n%@fIA3^#miui7T;l3$mh zb60=c_R#`SQVoI`HBYaITV4|G><0_!{m69t=OtL>IcqlHX89|T*}RyBAbSP_Z_V;M zXimIdWDEF=^Y5A5=iDU3Y?$@>Z_e(mU%!!ca7K|p*L%sk?BfBWH0?OEmwa1H3~bFE z@UmQeV&G*tA1}w}%gfXC<@xaZ`TYEJcz(Kk{rUX$AFnS@?Rc!qQB8vm!E3vc|IYwI zAth*}l@5_fb^w9gQIR$RL6rs{efVYn?uWZ~f1LLpc8~Ap zyZin9yZQd(bpLL;yW{=cH1Er9E@hT77hw@r6>g&JLl2Fajj#|AGg%`d_eqIJ2E_;6F>23_>!s*H3T=}$#sq%1BI6+ifO&Yo{&tvQ9bl%hcJ<0Y0el!q`u0M0=ZLKuU z%Di`PP14`Qbyk=8x-{F@d6r$@Qi>i56Q;Q@h8CUM;B^ZiZ$jS9A!cxq3vw7N|2=JI z&lk;j+_JQZ1qoK7an5M?+Wv3PN6m9kM1&@hi~BjIBaNK6E5Z;Ze=58FAlm^%dH8I@ zVo$Ik^q>G3xvrKE9nFfHr9ym~7#cpY6D0e+>n~end0wXz-^hCXgt|)C@L~QRTZ6%V zqt{Z1#RLG==1e1NwY5c6TV0mx<$Ap==i_oZoewYP=cn`W`E>YtdHQ^Q`RVfY%jxUa z>+{cgy=bd26%i&@^@v2&Dsv-h+7!fQrbeo4p_^s!A}frHLoQzpCZ^RZA+1rlf4sk3 z&Q%xC>_e3ard4Z9dRX925w>74J9u}twTnaxruZP@X3ezKrmCdc0E6kovfs_6psIQ* ztIa_SRa0%PHV}B4C*NI78#9P~iXH(#vnY>}+f8j|=A(xcFeWjenQ?1oV1hueB1T-m zE-}drAyW+n4xb(&@R}=~wbAkAiB9M9m*?~2r}^>6{rewx_jjke5A(x^-QBz0-NW?o zPVOFeclTv?U#7iGBGXi)h!kdF5hf-UW&(?_!#xTP`WZ!9M5AFIxBAAa4ZHuf)4f@> zuT$iWOCC11t${Dzwu96a;i%InjNlv%X2fa^(W~D0@Aj)xGdSYxO{QX7%Mu;k9gXt| zmjefTJue%5Rg8XAY}<8K1==(sLqzZA9(t}Yb=mPmWcxJ>k@_C~4j|1rPq>KfxMBdp<mE#gzjobkBq}~+-mjKk zmfHi_SkFg?*GFdCv)oRyUzr9Dai#dts->JXs|0UGBz-I{Y!>;D%)c3@4%vSKOg6Zv z+X!#F@HgM+; z{ECV9G7-e#Kr(S+SMC7k;%chIM;fzRHQFQ>!h@N{{3K0ZAi zUY<@bUyoltwU^K5r+>UYf6?pG>V=KLV6Qy-ofD`v28k2`sZ{gIx0))<*i;M-lQKo- z$AGFS;DVBkL4r~~{Q1N4FLb^xtx06kWGFy|s`4Z-B_(s|4O8J#XflR*U$C!EQU)1j zsYaDV$h0kShE|GM1BhyCUWX)8HCF;?YFea#!DKF_ zq~4%!N`P8xi`qhstmz_!3P{YTHE3gIVl-22hN`8ANdsM(ClWE-8!^=EdOlxH%kdZa z`t$C~ANCLTyT|wC;r;I6{qF8z_waGL`*6K`*xf&ryGPmGmEBIJd7Ac8W)Tq~X7Oun z5*W2Hhz-ON#m9tv!bzxQ@)_IIFfOCl%lggd*WAmc#d-q{u!5OgYc$sEMn-DGi%b{c z|Msy$1~p>mVVIZhwPUli3etuzS@+(s)pPTN4Kpt%gMeVKtox{++`5e^hwLPbJtQ=% zqw57&B4l4_3QhZ`tLsbpQrGB5@bE5+t`^Qt zfD{aXbsn!Jjx!>)NXLoQyTtM3i6O%ebQpt%l=Rij#Xz?XZ?wAbbtR&w+#@_{TQv7| zHajr4hcveTVH<4@#kp))9s|d;zOS;PZxv-W(W)Z@1G7EtGB&=4)XPM1;d%g|*+;z= zcW6D@?Uvj=ZW7s!>B8sLTfcQkm1Y$pgEhDZCdAy_z$Ze_BGAh$%;d2lCKN@FA;>Yo zwG>Pl*zqt@^JW#Sukkb0EE}*O)BzIzk}&Z3mp>bNcS(dc*a8H&h~Yddnt! zHb2eoeO=tpU2jt#oS;4|urAlj<#;`wuE&?t@#XaLbbWa`J$*erKOLSwou7U_fBAHM z`9iH~yFjaIbE`eEfZ521s0n#S(rN>gMLNS!U`jBNsII#Y27yQwFc6z^11i&O*2pg^ zY-Vlo7B?m~T_8p#Qs!xD1SYD?3l%mKGXs;VTJ-7zfSM2$H)qTSYD^6fGbJX{Nkp(` zhAJ9d+e1T~n$qs)S)BwMwej;G6CF3&ve?|1J$P7inc#}D(}@8|m; zb`Ov9-QBc*obKN3?sjGOc-`O2yqo5ol&KUEE-Xb`qrjzw-D43GGkh+W^&Zg31$y5r zZQ)}Z5cjo*5@>k%rK`qfKd)y}={RZJ0vKW|=k3WKRHjtCvxYdyZX8tF zNrNj4Woosqm(9x2U~E&WIduCqmPc(3as~=j{M@Mu;{ohnu(Q|f-$<5zHxb|@NbXk8=l3K%8VQ~K9zNQT~n zYmBf?NOC{-c*?-k13M)3F!e%QF2N#D=N#7J08w=(-NPm~S-y;DWh{0Sp|I;!akBQ@hF(DU~?RR0l1~l&CH(s#$>Th!2Ze*)_b;CoLtxAEZC0n62 zpB7kEYirFEt+l#bmgUke%k_LZpI)w~m($DP{QUWN_-q5WGc|T-D8PmFwMmzWaH8{Qd6nchmjDZvVL7-|z14=eu{){&Bj$ zUv>{=zvpQx^IT*nB2o%_7nl$Wl$c3~$yj{lI<29gDNzjkvXrR`Mq^k-?~vuSPV=T0 z?pZakX)@lzxmku@J3qTA<<(r0`xQdR9J|@|&ljSYd)B|*tGWbo-<$z>|2YUzeGQS3 za<6<2WLvDbaWWe`6>}#txRqP88`NbZiqdjimf*t0?#@ZI2=AC}tB8Vhjv&m8*31Yh zes_Ahx?X2*(!eNV0*j834eqRDh{0KwS0{0CZ1Ruw8eqVf(LLV!Ct9PAgs%s~)juoi z#M=sMzq0{Q`$f@pG4+*W-2kptf_{C6<8eYp!W%KrCgIbJ5XR%jkn!Z*dK+OL6WF)x z_3aM{5s!FyB=pojPi18-nYr-ExTS1e_8G9cuZp8hp|3UQ8IDG6?_Ojn8llOb{X4QX)xbk{#mq5NR1pH%0uc`WsKp)jxm$oeRx?CWswu^AU5CWEOp1B8kXDL@Gy>ausHJ|W24 ze;e~ut%R8-Lu;-bMLZiBplT*kq|8Lcr{0@tVJfz~%-rtx50`R0K3`5}t<}t~EL;i` ziBD-@f&gY};i|k8NDLFd8`XSdU~~n6jhu#M5u<2Ecp!$DX*H`Rg_uEVBB*B7Kuxm% zX;2{sn=PglFa|d?fL-Wyy>~pE-PS)mBt(rKJz65sXNFONh~9he1~bg)V{}RME>iSP zbVjeyOLRfBAW9-g5F+|5TTs}GZA-*C# z>ci%J?z6sYwYyt%VL30OaUh=-n`kTglT3FW($;okx(}^|^4z;D9u!?^n z=5xJuG!J1N=)ti9*5|_p*v0iB^%=}1Fdr3ueO8gy5)H;r z93=F}#A?B51aLo?33*G`l!?&;by0lu&&bPLgviWzw& z%+`xJ0W_*b#^bBzYA*VRzTOF|wb?vt^Ld}kK=D4Yg~O0*%> zkbSuoS4n^`VjisG;%~Zu>BzRO9GA)21O`jsnq@CmOdHsK`*be)Exvp`b&@dUdav~y zy5f-rxGa3O5J+h}JfDvup$fz|sBV?m>a}{X3g0J3R>)UAL3XxJSf}V&rM!CeDcVap zEYJRVQA7K@4{GX0j+@q}I{3iJv7UB-ymERgg>uNA3R%zIM)h`J!@bSe{5>+u9PcDL zmT?Ft#Z1l16x%1RCDU1t_a2#nAnTv(mxfVlH^V!{QoEHaNpvmqZm<^_kq1sTdoG>d zyp3(oH20ax&~ZiMNwgGq@>jt^xUxLtHi(x>DHtw_T$8n(2Ti_}t%#TwB!JXm4Ka`Mc7DJLp?LJQ*3#WVD!VLSVQ8`T8ES@cBo>x&D}}D zJd_Oc^`O*7vy606frE<<{(8Pmz}OO4oU_~U@ZvAbgD$3Yl(2wCrqYm%S(0HXxZFsG z3qAUK|_^Jk-Q{4slqgaQrMG)@aM>?bi3847xEVD zZjiy44qo|8oC3*<^b$rM&*@(BFQNXK7Ox9%Fzt@V2|QwyVMAq%j4Dw>+5>SYf?Sqf zBd4y~ucd;&0{x!|9%uuufLCVj->8!x=Vzbb9RaB)KCM7(f=l><%<$!tg_V&@E8yP5 zxL(2FokDjaltAA;nA-OJL?OFfvws2g^}NMYB?kkDznus2ix4)s@7AK~fynfy z{=X*gyL<{vW)6L5z)us65!Gu7mG^5Q?Wgc#MDPT^G=|G&661gPUU2!u;Re+mJ_V{+E;qPum|} z_)Az+ZdTdT6;-Q^_Q@$|aLXY#H2EQYDp@=4L2TAJc!i7_-D;FCZTmPm_}*g1rLK{d z0I@=sr>B|vN{Bpyp$6L+ucObL_mx~;p6M0@evu20)y(;F8n|Iph}v4Fp`xN8+wmVX zF|k->F6*DHNGzI%yHy z`wpBHL#X2S>9xlQ0Yuh|ouzf&hq`2Bn&+DFy}PPy+<)cbk&S=7v^27$)( zYL9hxDc@nBNoC~rx2{8{`Mr^gr$Q$(yKE14Z!eEgB(z@iUheh=Hf0YHnOckkJZ@%_G+Yo&x zeN+0n#+y9nFKpH5MeMt8Hk7qzVF4V1@s4cQwj()$!a3piQr9Xf5|5BE#t{PZ7}bS^ zr5Xrc)Iz~j>CbQVdbhmj4pR!JG;Kvev9h#;WWD#M?jDs7aJ}5dv*R8>9pQSzzOoug zzp0IHw~#h&`rXbu@mSI3gmGkIxW1`-9p|zXy`^iWky7(USF&(S+tiMsP&MKhY%iK_ zjWDsxunB1m>W^@n!8M*^)(RRVEc;$sybLBCZF%#pezw5z;t6K_&Md`8MZCGa?bT7E z+1MbDJGv7KW>pbn-Cv@>Uw)e89oQE{CcheYnc~NuTYh$?iFpKe0wr69T*iNFoxvBc zQQ-esbojvF_Giijy}ueYVYZ%bO^Z1lc7)42OT+g!$vyWsgyoGUZiwV%#5EUeMJXmm zjM*5Co%>i;o6b;sR(egEEgtz>Y8_$PvV}I+@>s3k4fK9mcYhez!ji3JZJoUK?dPw9 z^VSktjz)QXJHzPlHF3s3#+|#|)KsA}ANmTPCz-VM zR5vGtCFm6?5-Sxfd|gOoa^}31oK{M0s%waR*%Gv4wd`iFu6J@LNnqP*5pH>+Z-AR`p&80kKhI08 zM`#nYw|bZh(-orE@co)6_?t^L<}2y&EQUp>YZz(FR>?1NSu-HJeu2x{vY-V%vQ^vB zY1SY%srlsSrK}7^ODZPtK{$Y-BHnxvBGds;mpl`mn*k*VXIbhg#RF@7g$ zf7;o~a@*?3g+T*TjPg5Vk&CW{VL4+BpH0Z8291(*h&B@0ubDB^HXU&XC(gKuCj3cL z3Ue-%m6hu+SO`=~q4$uMCdi|juCFzovUo?Mx;072A^2Vca2fhwp^`2S22NwNl#X`U zQce&H$*V4n)*>IQ4lr^-R?4h%18Am_z5ihND_j zZ;Y;6v%VI6hZggyVell;X%^Fzx!8Ceu-UZau2Hd1xp-sZML5g+}x;@;zMfTVZ$`STd7}N*G=QEv4x}Jy7yao2cteLEgCBM|a~uBI?L3j$*qZmX>OPkW>NpH ztWja{rp3E`DNL=*UbMmSSqh(-QSn>%`e(BF4~kAxhLO$!LBzb8V)!?gf#s$Ho{dscZN9*__4J{IMq5?QY9rc{WI^ zlqJ!Di^Z*G(O;5MPCS!zop0L*A1HC#IfXlVb%m}p?0k0F65-1+m`+}QGyP_Iq$N86 zxK(m>@-vDTLUDhrVhtv6f~p3hk&4 zbD81wLq^*!fDVdmp(Tc}yRe8nL<%w9tW-DYC+PFCznb}AL?ynG0_wz>MIju0eFY7R z)D1N4KQw~d1@HzW5U&5_7D8&m!rAPJN0bUP)3zLWX`k!Uh~Hi%2LR! zlG(zAPin=Rm{aW1N=mCw?Ya1hOybf-ee23nd&Y?mqAADwWc~7Snvc{tqGN3+Qiyoy z4pgPts^w<~CH@v)*?`%v|*j2HZ- zF+<^#8E@W3zcv=Co0=3$`XUG}yKm z@v|otu;Wip;-PR|laVQAH~WdQYnRW=-Q~r6r+ytPC6oIIsnb?+A;=l!@PbrT&N710 z&{Y0@aja=cMJ)yG%5;o1{F=;nd$faNW8pJ``Ix!>suzd!aOJq;Z!VSP=fg|17cDKK z_c!WV+`f+)f^SxKLZ*FaXX)pLTb^q0GPD3p#K@>_1U9$6 zP`L?2y2>0MIcv_mnX$gHxO}rx#FznnVDYF`u z(bWm79{i7(KbtYf)f)-l=Nk=82!HfF(88*NQhk1D|MCKR;?eOmbMJN$V8;&-Taiw@ z0RBH;y4q{Cy;|yRTRaf)Oe=^=R8@HSa7;It!b^Bo<0UbP?Pr^q8pSt?DEim;#Sd@e z?xxWdGxKjR-aHlH`gPo4$=A^sQX#+2%f6wt!kE{n5#7tb9x$uAV`^l1;f9f(tqOJzw@Q+-v&R zy+3*n?2e&R3&2xzIp^Do!5XiHf4UEd+3XS)6BJ}vX}{1D>04r_@q$Nx;-k!@gX8V``<6W_& z@;{6f6|8cjO8RY8`E&5=&PtLxe__8oqg4fNPvZZj9mS|`bCE}jjsZ9=f z^Qmu_x8nWPR@q?P5(cyqk$(E$JT^g`x0o0mlWF!Gh2i$$si4n4EoAk8+eZJjOi z`|#}SVD8||U{NvNP<5uBG0JpU#BZRQd4OdKuWC=!?r4jfimLD1VBQkG%bTbj&H0K_ zm`hN4BihW;vEYE-05@+7uJ5s#BEc=k4Ql9JXD_^I3#OsN3!n%}7w(?!8XZNOkze=i zf^|P~!8`LhNTm4|Ch#soAv(1T$nnR6fch%-sHz7C$9}e)6gQcP?kEz2Xa3 z|I@sW(i*_iwil1*zXRSQejRIosy+p*1+^J|%R}{mxxYQlBqpjW3p_C6y+Q^~_3kV4 zABKK1J8qaD$<_raCW|$ik+w|W2G(!J+=z!XFI$+p>`dQO|iq*%AHysuLY4tellM=*a~j1m+Y5SV0jcS zPgUPfU@9HI+U2R%dHC*8@h9)|5vU+D?}uKz0~|>S!R=j1WHZsCI4Vit;ILKfy(#`W zpDe}Kc+ZQkRGd@W1lC>^Mhapy0V#Ydx4YZ|#yShr&u3Re$yMC=bKIVPF|IFbdLetw zuQv6U!=x=6&yOEOdUQSejhQ2@^>3!P^{VJClh?86l!K$gKnb?0f!-smIBSkzG2rm( zd-^kFd*s{CpMk!953;moZ*kBn!3AFJTiCF#Etu(t6Os+GaAd2~6*+<*73qLs!pWsX zvG-{X44Nq?$wK@l$NdM9p!6EWn_mha6gvg8h{VRJ&c357F(n;wzQ1?dXO7f*E5A%l z(Qkk(1#f<3acOO>xAlB!t?hh!_iS!+`^dlrWtahJ5s##zvlG3Q$~g5Uo>TCH#bS@1 z?YC%%Gzh&miraI>gJ3eYYHn z}Ix2lf%=m@{d zWALkkPwe-J^UuY5E=k2jM|WrS&BpFL3le-qUE+3sVZ*%ldQVp-@l8;^VFKSb0oS{P z$>|;^uXgc%J(_*7HdxO~xpL>|iwC)bxQQ8a(5P3RtL@thxh3vWzawkwHoQ%;lezA& zUHORZW~+^Os&dVoqD11OI2A`YL>PxnLZi*K*=K8it3>whqt5}6)!ftCe?mrJ=qL>5M z4c@kyh?%zUc*rj1S9hN{Wl+bdc?)ft|e?B z`zDB-E$uB|^?qde>^M7`yYSb+!-V1n+$I zaUepRe_%&;ht>Fizm$b_$MneigGQGN-4`AOT-M8O0U6l5tq?J+ew0z#*qADamw2nJ zLFwB{bht$>`ntYAcp22twpUI~jugh7Yijqoond8Td{-Jt&?gw}npRd)g zjQa$%oa<~{v@IrG^wzg#9G@UMa*pdpC9}POu-)k@YSHy3sWCpnRHVA&@k7cyn=eFs zXBc!G(w|2w##HDwjzE3y6`k;oHMh5Bor^0*=H3+|MEO+?T$|660}_eor3 zBp%~O>}Fjyqj13d$R>st$69|&mzuExbZeMS;S+mS$CBl@7#j1-g@ersg_|~tm05xu zsEp1-;oXxL`iUY$XY++0tYN2E^;HRV&S*hjE{j_$b*I9hN$Cg7?zUZ_6vm*S?v6E6 zNb|YJ>!r4Jx08Jq19Bxbwrpb{As2^v`Y!QX;eL>8l1NPIjS*c zViK0>5JcB;GiyuaMZ>HXp&spy3i+~5!9ozBu!wLYG>Le+Yib>>jw?X6J-R0nYA9@% zy?Y}3_!o#TM*Dbs>B!%ZzhVsQLEY)U)BDAN^7@7&Jz=^W-F>Tw2%cE=(*Us>6+C_e zZz5lW^*B@BMQJkk`BI2BlH4-a$m<)WEJ4l8%F!2!s!z({?H_H?I)$bBfw3PzFuGu4 z;>^?4eK8s{L*yQUzeqA{A+6L*WvY}nF#8dr=gX0wV)zQhi65b`qr9DAUBtUPVz6BF zIePVA#29$AllL6hNCD9&Q2xL2K3;&A#-?^XI-dedRoCCHO*z05lN(F*t*@4{i?cLd zC6*43B5b*-;K@4kwkfzD7|3+@Q?$b8w3=?oicxLx@21{da!G?WwlAo$;zH)n=Zr$D z>D`njZbsTQ++6V(T4|tMf<%r~&%j+|xX)6uy6f~D?q~1Z(EKu-THeXB#J(Q=maTUC z&06?tk)JlRO>-Ql22Mwn`dKv(VjzA+kP6k=2_-38SO=F{=56sMxu>q+^$Zp<3Y+Ho zW#4p9{J$>7c4w{fcH+&c-sYal7@%}3h&1!=~ z3=Q|~S2Is)>PjUpEXEV0(b0-cw)E|?E%N*fwG&6nrx$Eyg(%Huk@Sb%oP1pV-|d-u zq{!yV>^|UEIG^oFu4df(y&ST8`T<(p&o=9*2rNvJCS>q|n_n4bzq_YDE-1s?>BfoX z%*~z5oGdH7fKx(Tic@Q5$_Pq=ZR;%XVb<2VZ#zrnz$S37U#g8?X#5Ck^3FPWq}z{G zXTAA`29o7Izoy>sOoi&#=@8iF^I4?LU85;2eD4$AfbIZgDB&)zo!W7$(CVSAg+V}y` zNzWu9f}mO=N9*AM3W~7UuV-hk_HF5AqFqR6_BU8IzCMF|-oh!xr;ZU=qCxecBNqv$O;pYN0y$&IeGx!D9iyq5qWB z_^TbZVeG)vXkipB^$Qer6}%4Y7tfVT$4yv17cFbAwp*xb*FW+(%By-JKIj%n+Vi~m z8@YsR@`E==TGyFtsybRw1;=d&m@8&|#s5p>o!^ZkYH=vFoxYrM$J#@^k$$4(eqQe}P?FUxW*yKhXiYUptI&gmx)J-2pn zZJ*{-RR?7Xg5h`;Y_?psuSLbLORp3s{MDl6KdD3Xy?jiD|n_y(_i|$>-W7rh8IiX z5uu&uEJ9|isu7n-sp-C=A!op{XGvS1S##W3qRP~Y6#O z+SYK+W^qwvxt3HWm>q9~Z5olpzR+hylTS*sJN5iWAFPTH*+S<7XIExcL)lV$NFMGoW;iG*ZwRa5F6xnOpu~&06i*cvoSstBcV+upp8Z5<7Ee&%Jeg6i2 zz~YciBNpPgnRV)id$cN+PBce;fvms8Q9e;{YFhn1w%tKnIG^84}x zUhUrQYuE5t&3#;0*`rFsGx##ay+3Yq3_WXjUQo<_?)AG#wBT;YBRp+K?@wRGwid9L z89rVPb7mBT_}^w^9rHc?4=Ufn6UuTJ`40J9ocx_Ggffyc)TQh8>{XQ+moeFRic*EQ zmVGpH2I?=FNgu9P{xx{0YlP@Zw$3Bn-enLQbbF}8*6Pt8af_pyK~9;VS5?Gr?RlEN zoc%L_@^XT5vpo(pB+9202x%gSvpVv}W$#!4(UJ4A6Gnh=gdNj$+oCywLN_emEhPK< zRc>ngOUPx&vkOw@l0Q5cM40kcB(jFVM?+TiA*Q-8m6^vpBZjy#!#S_iz!5#~C7R$= zC;cuW(%z`P?SuwKlU04gL4~NdK5D{xFY|}X;^z<6h}nfj>4fb>f>KFU9_c5fDs zCPrq`_(-E@6AkZoQMMt`C$e*IiRfVsv!l*pPXm8}%iFsa&I)H0>1Ge{3F$?r6>v=9 z+lU~>_%PWDeydVi%4-e6cYB+|qCt!_!t^C*C&!41J|Fx>>cZzR=tZB4Qbu>DO9(xSnkQQ*GpQhl7xWs?0TbtwPiPQBvO*-nq!>%ggk}}0iv4ZUkEeDmTQWv=wKgaY zc3l_t5X+iV7xe+w$LA=qeeAu~8)@E%Y(KFP5n+1Zk)*^+laEw&%|A+gtu&@Hht_qi zKYNUh>d+t9j4Qn9=Sp_ErklW< z=|}$3Y1ZYX@duk2@fDk^QEj_Qs4;IG1XW5Rd3 zcQdRu48OgC@~QR!)0|!VUEL`kJ~p16Et%O5d2{xXysgyf^`R@QGgeczM_prW>zuX` zdD~8w_Y&1;=c}0sgEec7ecK0_yI(#tE^ZW_1T%OD%sY6^+&A-`ivz27_+4MF5Wh3o zNMfr1Y4dEM8agy%Gco>*{N7eGc>ev>cbCU@4V^8LR`+mXG6@Nv{DwI&ep#qw@?yYW^G&DGwmmQQH0?)!WWNQJQCZqBe3h<12 z7df)8lMuPR?`@@BL(b}&xw$P>6 z!CngBjlS%hA3wd$YAwdgW{5ual_X>vO_A6ZrR9>3>6ntFv{zF>kh-bCm2+FmO^xd1 zS{d?b1&KWt(k)@45pzs|a*|ZKP9sMcSapB^epu3cB)4IabUJY!BX&krwBdc+SUO(_ zI5al)H7QY-4Gn*k-uvl`SbK0{Q(TlcR({@i?aW)z87HsX$=OD!IIrvecnrU3Aet>Inpj2{Z;C zmPF12XR_Abt$N7p6Okm&Z_zE)*OfH!^lz9ZiSy=vf#hMrBCX!&d;I>`_FPke()cDR zu`-FN3v_PvSS4nvNZjfd;p#7+w|iCmlZ&(Hb9knbWvlUyq0Jph@$Z8Du35p}h>Kn$ z%~$V=&mwBLs(g_0(PHvSX|t4ej%z`T;CIWfY8q3C%ip?vBd3=}tJ9d`!`MQ1ifGHVg>@;A%>bV%+yhn+6we8Ps zj_;$*t6v69m0NSr#~)a#IS)%xproBQ+=*lg((Z$RWR3q~YoW$FXB}09^~0)Alzws| zpqAhH{@>qJb||JUJoHol%iMZxAXlD>-gM~h-ZjOlGvY|`WC>(MwSs?+R| zoyT9Ej4?3rF4)Ip&hH zJ^zoCvTO3QR-GTqRs7JvR}^;&U|k(!HrAx3)sSN-9*$~{$6nXz7G zsgv^e$dlk(XGkU9Nv&|_4z1-EcSkgNB-7qpYYdxhQm~Pq-7*TKfAp*m#4&JbpE(25 zd!Xff=GnufUvcAP+`o;t@1v2oRm<{Gyazd}n|aP0 z3u$av;#yS<`+`D?v8H7eB-;qE+>7Ei&RomQQfATSw*V8YKWd~fTj6^2q>_#>g}WD}tz8xoeN#Zb zCXHj1T=5v4wpe%HFd`l^bFrbOhCgOEP5lHV55K=z%E*OfmU@bS^VsYIgRsJuKu1At z5hyM9CF8f9=lApy7?HG7HwuC))wxR2dvQQi83cFE24QZqNjaFA&TWsLkWPpS>WMc~ zE?9;Gh1n`K%uA0QjGnXZ?v11@X^(eyWNM`}iYrw;WST4qQ@m#C^iUeIA(D#L7hBXL zqLhPVptyz63#n0Q8Y+2ae9XepocK%x84dF!Jb|Kh#`YmjujA`W8)l=@X_Z_^UZFvr zxbJ3saWg6^rWSDol_CANH<^N&OzP?)=VeLtJ>S$zRFNT-oaKs;W!{q;r_vr84278$ zwvO4H(AN}Z9N)FgJnGbtj2db zH{)aM*eEt{u1!;_Z2Glg^_?)&s~^w8^QVf8dB@AxRCL8g>qg6KV-$5BNNt5AegZAY zdPkh-$g%!~{Cr;OGf3z@(vBYsnQ8bgJrw8B*0v~IZ~pY<;rc1}h@Q`9F6qZ7oLX9v z(RG~m7d3N3F66QKnQ+KcC)QZznvua_D`_7gMSUZcwoMO~{f?Jql;TFn}85;Tnr@ zmi2~CI01F@N*B|ub-k+1b$_c$2Xn!>DGyVv@0jMygw2D7?3}AO43X=n(}E5-dQ0B4 zT3MIq8D$cIpqD%^@NZHY<%Xzv2GMKu>4@HyKj7u?B^)J~wy1rssF2tVodj+>TO?2i z7niDJ=f%4MJ=+*O)E?lU7_U{MH7o&|a;3hz^XiM^%{ zktEvv1v-?NNAitxVNG7wXpH<_G!jRvp|%i*qlCRqHGs$4t(6+vhAXy}c4f{DQ2Uh+ zgvJYeP@5r(uvJ2mwh6sspu7HzN{S4o7EKFFsLM208mpl04ZcO05v?5XaA*`|mPWu( zql#C9YM(wJIJ|?nr{`$9yrexPnZ~^=BaTupTB^_3ygJ6s^%EPL5|RD^yvJOqA=n5T z5m8M8PGyK<9s2ndoApbU?%uoqeQVzSq3DY!GYvmardM_Zf@`cLth!BVf*rLyjOpb0 zT1^N6Cg)wTc!QHxE=#AwuCp4a!WqjR^N*EzUf#loU3J}q6_%gwQ1+97Yq=WF`Mjpu zxm7HIx5Ok7wGZ#)WxT9@>w7#i7EZNfKOX9?_$Herq*XwjE5Y@?4DvGGS2=SMOoP!l z2%apw@i41BpZQSgG1znyeMB<~;*|LiOrlw7niKybPj>Z2aKAlkN5IL>zJ`LN`VgMi zmq6=HSxN3yb9c~Ga6^KliRd